From: support Date: Mon, 7 Mar 2022 10:32:45 +0000 (+0000) Subject: Built motion from commit a52505e5.|2.6.4 X-Git-Url: http://repos.xcallymotion.com/base//%22https:/wiki.xcallymotion.com/display/XMV/%C3%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%C2%20%20%20%20%20%20%2014%C3%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%C21110E%C3%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%C202%C3%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%C2%20%20%20%20%20%20%200%C3%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%C205?a=commitdiff_plain;h=93ad1a780cebedb016eebdb3016140e1301f52e4;p=motion2.git Built motion from commit a52505e5.|2.6.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6783da7..65ac97b 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-07T10:02:28.544Z", + "time": "2022-03-07T10:24:54.428Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a091943..baa5367 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-07T10:02:28.544Z", + "time": "2022-03-07T10:24:54.428Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 22d421e..097a052 100644 --- a/server/api/action/action.attributes.js +++ b/server/api/action/action.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5556=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','STRING','contactManager','motionbar','jscripty','urlForward'];(function(_0x385380,_0x1a8069){var _0x1cfcd3=function(_0x516f91){while(--_0x516f91){_0x385380['push'](_0x385380['shift']());}};_0x1cfcd3(++_0x1a8069);}(_0x5556,0x138));var _0x6555=function(_0x3a1dec,_0x1f943f){_0x3a1dec=_0x3a1dec-0x0;var _0x60ede0=_0x5556[_0x3a1dec];return _0x60ede0;};'use strict';var Sequelize=require(_0x6555('0x0'));module[_0x6555('0x1')]={'name':{'type':Sequelize[_0x6555('0x2')],'get':function(_0x50e4d7){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x6555('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6555('0x4'),'integration',_0x6555('0x5'),_0x6555('0x6'),_0x6555('0x7'),_0x6555('0x8'),_0x6555('0x9'),_0x6555('0xa')]],'msg':_0x6555('0xb')}},'comment':_0x6555('0xb')},'data1':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':_0x6555('0xc')},'data3':{'type':Sequelize[_0x6555('0x3')](0x1000),'comment':_0x6555('0xd')},'data4':{'type':Sequelize[_0x6555('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x6555('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x6555('0x3')],'comments':_0x6555('0xe')},'data7':{'type':Sequelize[_0x6555('0xf')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xb714=['VIRTUAL','action','STRING','integration','motionbar','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0xb714,0x196));var _0x4b71=function(_0x532e1f,_0x2c9840){_0x532e1f=_0x532e1f-0x0;var _0x317678=_0xb714[_0x532e1f];return _0x317678;};'use strict';var Sequelize=require(_0x4b71('0x0'));module[_0x4b71('0x1')]={'name':{'type':Sequelize[_0x4b71('0x2')],'get':function(_0xa8ec71){return this['getDataValue'](_0x4b71('0x3'));}},'action':{'type':Sequelize[_0x4b71('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x4b71('0x5'),_0x4b71('0x6'),'jscripty',_0x4b71('0x7'),_0x4b71('0x8'),_0x4b71('0x9'),'script']],'msg':_0x4b71('0xa')}},'comment':_0x4b71('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4b71('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x4b71('0xc')},'data4':{'type':Sequelize[_0x4b71('0x4')](0x1000),'comments':_0x4b71('0xd')},'data5':{'type':Sequelize[_0x4b71('0x4')](0x1000),'comments':_0x4b71('0xe')},'data6':{'type':Sequelize[_0x4b71('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x4b71('0xf')],'comments':_0x4b71('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6b0a59d..1a0a6b9 100644 --- a/server/api/action/action.controller.js +++ b/server/api/action/action.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe613=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','stack','name','send','body','Action','find','catch','eml-format','rimraf','fast-json-patch'];(function(_0x482d01,_0x49c24){var _0x2f928b=function(_0x40e293){while(--_0x40e293){_0x482d01['push'](_0x482d01['shift']());}};_0x2f928b(++_0x49c24);}(_0xe613,0x111));var _0x3e61=function(_0x227588,_0x392465){_0x227588=_0x227588-0x0;var _0x1197d1=_0xe613[_0x227588];return _0x1197d1;};'use strict';var emlformat=require(_0x3e61('0x0'));var rimraf=require(_0x3e61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e61('0x2'));var rp=require(_0x3e61('0x3'));var moment=require(_0x3e61('0x4'));var BPromise=require(_0x3e61('0x5'));var Mustache=require(_0x3e61('0x6'));var util=require(_0x3e61('0x7'));var path=require(_0x3e61('0x8'));var sox=require(_0x3e61('0x9'));var csv=require(_0x3e61('0xa'));var ejs=require(_0x3e61('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e61('0xc'));var squel=require('squel');var crypto=require(_0x3e61('0xd'));var jsforce=require(_0x3e61('0xe'));var deskjs=require(_0x3e61('0xf'));var toCsv=require(_0x3e61('0xa'));var querystring=require('querystring');var Papa=require(_0x3e61('0x10'));var Redis=require(_0x3e61('0x11'));var authService=require(_0x3e61('0x12'));var qs=require(_0x3e61('0x13'));var as=require(_0x3e61('0x14'));var hardwareService=require(_0x3e61('0x15'));var logger=require(_0x3e61('0x16'))('api');var utils=require(_0x3e61('0x17'));var config=require(_0x3e61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e61('0x19'))['db'];function respondWithStatusCode(_0x52b504,_0x5205d2){_0x5205d2=_0x5205d2||0xcc;return function(_0x4bbb93){if(_0x4bbb93){return _0x52b504[_0x3e61('0x1a')](_0x5205d2);}return _0x52b504[_0x3e61('0x1b')](_0x5205d2)[_0x3e61('0x1c')]();};}function respondWithResult(_0x10e3b8,_0x3a3be8){_0x3a3be8=_0x3a3be8||0xc8;return function(_0x62e870){if(_0x62e870){return _0x10e3b8[_0x3e61('0x1b')](_0x3a3be8)[_0x3e61('0x1d')](_0x62e870);}};}function respondWithFilteredResult(_0x4c831a,_0x306ab1){return function(_0x43fc2d){if(_0x43fc2d){var _0x29d2e3=typeof _0x306ab1['offset']==='undefined'&&typeof _0x306ab1[_0x3e61('0x1e')]===_0x3e61('0x1f');var _0x236737=_0x43fc2d[_0x3e61('0x20')];var _0x21eee4=_0x29d2e3?0x0:_0x306ab1[_0x3e61('0x21')];var _0x4218a0=_0x29d2e3?_0x43fc2d[_0x3e61('0x20')]:_0x306ab1[_0x3e61('0x21')]+_0x306ab1['limit'];var _0x3487c0;if(_0x4218a0>=_0x236737){_0x4218a0=_0x236737;_0x3487c0=0xc8;}else{_0x3487c0=0xce;}_0x4c831a[_0x3e61('0x1b')](_0x3487c0);return _0x4c831a[_0x3e61('0x22')]('Content-Range',_0x21eee4+'-'+_0x4218a0+'/'+_0x236737)['json'](_0x43fc2d);}return null;};}function patchUpdates(_0x1e8159){return function(_0x1f20d2){try{jsonpatch[_0x3e61('0x23')](_0x1f20d2,_0x1e8159,!![]);}catch(_0x298e22){return BPromise['reject'](_0x298e22);}return _0x1f20d2[_0x3e61('0x24')]();};}function saveUpdates(_0x5275b1,_0xd447e9){return function(_0x13dba3){if(_0x13dba3){return _0x13dba3[_0x3e61('0x25')](_0x5275b1)[_0x3e61('0x26')](function(_0x16a466){return _0x16a466;});}return null;};}function removeEntity(_0x27d29a,_0x5f1575){return function(_0x12ea08){if(_0x12ea08){return _0x12ea08['destroy']()['then'](function(){_0x27d29a[_0x3e61('0x1b')](0xcc)[_0x3e61('0x1c')]();});}};}function handleEntityNotFound(_0x548163,_0x1d4c3d){return function(_0x40ab07){if(!_0x40ab07){_0x548163['sendStatus'](0x194);}return _0x40ab07;};}function handleError(_0x19122a,_0x1d1804){_0x1d1804=_0x1d1804||0x1f4;return function(_0x27d8e0){logger['error'](_0x27d8e0[_0x3e61('0x27')]);if(_0x27d8e0['name']){delete _0x27d8e0[_0x3e61('0x28')];}_0x19122a[_0x3e61('0x1b')](_0x1d1804)[_0x3e61('0x29')](_0x27d8e0);};}exports[_0x3e61('0x25')]=function(_0x3c55f3,_0x46f1af){if(_0x3c55f3[_0x3e61('0x2a')]['id']){delete _0x3c55f3['body']['id'];}return db[_0x3e61('0x2b')][_0x3e61('0x2c')]({'where':{'id':_0x3c55f3['params']['id']}})[_0x3e61('0x26')](handleEntityNotFound(_0x46f1af,null))[_0x3e61('0x26')](saveUpdates(_0x3c55f3[_0x3e61('0x2a')],null))['then'](respondWithResult(_0x46f1af,null))[_0x3e61('0x2d')](handleError(_0x46f1af,null));};exports['destroy']=function(_0x28a462,_0x545c45){return db['Action'][_0x3e61('0x2c')]({'where':{'id':_0x28a462['params']['id']}})[_0x3e61('0x26')](handleEntityNotFound(_0x545c45,null))['then'](removeEntity(_0x545c45,null))[_0x3e61('0x2d')](handleError(_0x545c45,null));}; \ No newline at end of file +var _0x4d05=['Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','limit','count','offset','set','Content-Range','json','reject','update','then','end','error','stack','name','send','body'];(function(_0x2b1fef,_0x279bcf){var _0x315214=function(_0x310ca0){while(--_0x310ca0){_0x2b1fef['push'](_0x2b1fef['shift']());}};_0x315214(++_0x279bcf);}(_0x4d05,0x92));var _0x54d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4d05[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x54d0('0x0'));var rimraf=require(_0x54d0('0x1'));var zipdir=require(_0x54d0('0x2'));var jsonpatch=require(_0x54d0('0x3'));var rp=require(_0x54d0('0x4'));var moment=require(_0x54d0('0x5'));var BPromise=require(_0x54d0('0x6'));var Mustache=require(_0x54d0('0x7'));var util=require(_0x54d0('0x8'));var path=require(_0x54d0('0x9'));var sox=require('sox');var csv=require(_0x54d0('0xa'));var ejs=require(_0x54d0('0xb'));var fs=require('fs');var fs_extra=require(_0x54d0('0xc'));var _=require(_0x54d0('0xd'));var squel=require(_0x54d0('0xe'));var crypto=require(_0x54d0('0xf'));var jsforce=require(_0x54d0('0x10'));var deskjs=require(_0x54d0('0x11'));var toCsv=require(_0x54d0('0xa'));var querystring=require('querystring');var Papa=require(_0x54d0('0x12'));var Redis=require(_0x54d0('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x54d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54d0('0x15'))(_0x54d0('0x16'));var utils=require(_0x54d0('0x17'));var config=require(_0x54d0('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xebcaca,_0x491d60){_0x491d60=_0x491d60||0xcc;return function(_0x4701de){if(_0x4701de){return _0xebcaca[_0x54d0('0x19')](_0x491d60);}return _0xebcaca[_0x54d0('0x1a')](_0x491d60)['end']();};}function respondWithResult(_0x3117f3,_0x50fbf0){_0x50fbf0=_0x50fbf0||0xc8;return function(_0x58f654){if(_0x58f654){return _0x3117f3[_0x54d0('0x1a')](_0x50fbf0)['json'](_0x58f654);}};}function respondWithFilteredResult(_0x212f96,_0x406a73){return function(_0x2065ac){if(_0x2065ac){var _0x4ebbac=typeof _0x406a73['offset']==='undefined'&&typeof _0x406a73[_0x54d0('0x1b')]==='undefined';var _0x1d8540=_0x2065ac['count'];var _0x4b3a9e=_0x4ebbac?0x0:_0x406a73['offset'];var _0x2503c5=_0x4ebbac?_0x2065ac[_0x54d0('0x1c')]:_0x406a73[_0x54d0('0x1d')]+_0x406a73['limit'];var _0xcc4f3;if(_0x2503c5>=_0x1d8540){_0x2503c5=_0x1d8540;_0xcc4f3=0xc8;}else{_0xcc4f3=0xce;}_0x212f96[_0x54d0('0x1a')](_0xcc4f3);return _0x212f96[_0x54d0('0x1e')](_0x54d0('0x1f'),_0x4b3a9e+'-'+_0x2503c5+'/'+_0x1d8540)[_0x54d0('0x20')](_0x2065ac);}return null;};}function patchUpdates(_0x18caab){return function(_0x39410a){try{jsonpatch['apply'](_0x39410a,_0x18caab,!![]);}catch(_0x44bdd1){return BPromise[_0x54d0('0x21')](_0x44bdd1);}return _0x39410a['save']();};}function saveUpdates(_0x345189,_0xae4f5b){return function(_0x1ac254){if(_0x1ac254){return _0x1ac254[_0x54d0('0x22')](_0x345189)['then'](function(_0x17526d){return _0x17526d;});}return null;};}function removeEntity(_0x57a629,_0x3ff3f7){return function(_0x55e671){if(_0x55e671){return _0x55e671['destroy']()[_0x54d0('0x23')](function(){_0x57a629[_0x54d0('0x1a')](0xcc)[_0x54d0('0x24')]();});}};}function handleEntityNotFound(_0x3caf3c,_0x4ac40c){return function(_0x5c47b6){if(!_0x5c47b6){_0x3caf3c[_0x54d0('0x19')](0x194);}return _0x5c47b6;};}function handleError(_0x5c2ebf,_0x573cfa){_0x573cfa=_0x573cfa||0x1f4;return function(_0x3d1761){logger[_0x54d0('0x25')](_0x3d1761[_0x54d0('0x26')]);if(_0x3d1761[_0x54d0('0x27')]){delete _0x3d1761[_0x54d0('0x27')];}_0x5c2ebf['status'](_0x573cfa)[_0x54d0('0x28')](_0x3d1761);};}exports[_0x54d0('0x22')]=function(_0x74888d,_0x333dec){if(_0x74888d[_0x54d0('0x29')]['id']){delete _0x74888d['body']['id'];}return db[_0x54d0('0x2a')][_0x54d0('0x2b')]({'where':{'id':_0x74888d[_0x54d0('0x2c')]['id']}})[_0x54d0('0x23')](handleEntityNotFound(_0x333dec,null))['then'](saveUpdates(_0x74888d[_0x54d0('0x29')],null))[_0x54d0('0x23')](respondWithResult(_0x333dec,null))[_0x54d0('0x2d')](handleError(_0x333dec,null));};exports[_0x54d0('0x2e')]=function(_0x392ac6,_0x3ace15){return db[_0x54d0('0x2a')][_0x54d0('0x2b')]({'where':{'id':_0x392ac6['params']['id']}})[_0x54d0('0x23')](handleEntityNotFound(_0x3ace15,null))[_0x54d0('0x23')](removeEntity(_0x3ace15,null))[_0x54d0('0x2d')](handleError(_0x3ace15,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2ebe007..a20c205 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd21d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd21d,0x14e));var _0xdd21=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0xd21d[_0x51539c];return _0x4f7914;};'use strict';var _=require('lodash');var util=require(_0xdd21('0x0'));var logger=require(_0xdd21('0x1'))(_0xdd21('0x2'));var moment=require(_0xdd21('0x3'));var BPromise=require(_0xdd21('0x4'));var rp=require(_0xdd21('0x5'));var fs=require('fs');var path=require(_0xdd21('0x6'));var rimraf=require(_0xdd21('0x7'));var config=require(_0xdd21('0x8'));var attributes=require(_0xdd21('0x9'));module[_0xdd21('0xa')]=function(_0x1791e6,_0x55c2fc){return _0x1791e6[_0xdd21('0xb')](_0xdd21('0xc'),attributes,{'tableName':_0xdd21('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbab7=['./action.attributes','exports','define','Action','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x108b7b,_0x4d8bf7){var _0x52796a=function(_0x29a01e){while(--_0x29a01e){_0x108b7b['push'](_0x108b7b['shift']());}};_0x52796a(++_0x4d8bf7);}(_0xbab7,0x19c));var _0x7bab=function(_0x511062,_0x5e3e51){_0x511062=_0x511062-0x0;var _0x51ddc9=_0xbab7[_0x511062];return _0x51ddc9;};'use strict';var _=require(_0x7bab('0x0'));var util=require(_0x7bab('0x1'));var logger=require(_0x7bab('0x2'))(_0x7bab('0x3'));var moment=require(_0x7bab('0x4'));var BPromise=require(_0x7bab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bab('0x6'));var rimraf=require('rimraf');var config=require(_0x7bab('0x7'));var attributes=require(_0x7bab('0x8'));module[_0x7bab('0x9')]=function(_0x306137,_0x12defd){return _0x306137[_0x7bab('0xa')](_0x7bab('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3ff1b46..895fc3c 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Action,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x5dcbaa,_0xbe8cf7){_0x5dcbaa=_0x5dcbaa-0x0;var _0x553930=_0x7a54[_0x5dcbaa];return _0x553930;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x42f76c,_0x3e9c73){var _0x216291=function(_0xb4090e){while(--_0xb4090e){_0x42f76c['push'](_0x42f76c['shift']());}};_0x216291(++_0x3e9c73);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x11fcba,_0x46ac13){_0x11fcba=_0x11fcba-0x0;var _0x2c792a=_0x7fbe[_0x11fcba];return _0x2c792a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 4d246c4..945cedd 100644 --- a/server/api/action/index.js +++ b/server/api/action/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51fd=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x4aa11a,_0x3be0ea){var _0x26559b=function(_0x5c559c){while(--_0x5c559c){_0x4aa11a['push'](_0x4aa11a['shift']());}};_0x26559b(++_0x3be0ea);}(_0x51fd,0x1bc));var _0xd51f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x51fd[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xd51f('0x0'));var util=require('util');var path=require(_0xd51f('0x1'));var timeout=require(_0xd51f('0x2'));var express=require(_0xd51f('0x3'));var router=express['Router']();var fs_extra=require(_0xd51f('0x4'));var auth=require(_0xd51f('0x5'));var interaction=require(_0xd51f('0x6'));var config=require(_0xd51f('0x7'));var controller=require(_0xd51f('0x8'));router['put'](_0xd51f('0x9'),auth[_0xd51f('0xa')](),controller[_0xd51f('0xb')]);router[_0xd51f('0xc')](_0xd51f('0x9'),auth[_0xd51f('0xa')](),controller[_0xd51f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x2bb8=['isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','put','/:id'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2bb8,0xd5));var _0x82bb=function(_0x18fa66,_0x26af70){_0x18fa66=_0x18fa66-0x0;var _0x31ec7b=_0x2bb8[_0x18fa66];return _0x31ec7b;};'use strict';var multer=require(_0x82bb('0x0'));var util=require('util');var path=require(_0x82bb('0x1'));var timeout=require(_0x82bb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x82bb('0x3'));var auth=require(_0x82bb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82bb('0x5'));var controller=require('./action.controller');router[_0x82bb('0x6')](_0x82bb('0x7'),auth[_0x82bb('0x8')](),controller[_0x82bb('0x9')]);router[_0x82bb('0xa')](_0x82bb('0x7'),auth['isAuthenticated'](),controller[_0x82bb('0xb')]);module[_0x82bb('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 77ce71f..1d81677 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.attributes.js +++ b/server/api/analyticCustomReport/analyticCustomReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x1aa4bd,_0xf7b1ba){var _0xebaf39=function(_0x41b54e){while(--_0x41b54e){_0x1aa4bd['push'](_0x1aa4bd['shift']());}};_0xebaf39(++_0xf7b1ba);}(_0x31f0,0xb7));var _0x031f=function(_0xfca315,_0xd1fdca){_0xfca315=_0xfca315-0x0;var _0x2d1eac=_0x31f0[_0xfca315];return _0x2d1eac;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file +var _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x385e7a,_0x2e7d5f){_0x385e7a=_0x385e7a-0x0;var _0x156420=_0x1cb9[_0x385e7a];return _0x156420;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index beffbb5..9bcd4c8 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.controller.js +++ b/server/api/analyticCustomReport/analyticCustomReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38e9=['keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','order','orderBy','DESC','alias','joins','parse','type','parentKey','foreignKey','foreignTable','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','GROUP_CONCAT(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','Please\x20insert\x20at\x20least\x20one\x20field','select','table','clone','output','web','%s-%s.%s','randomstring','generate','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ValidationErrorItem','%s.%s\x20=\x20%s.%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','model'];(function(_0x506b51,_0x2d2b6d){var _0xca5779=function(_0x5f0fcb){while(--_0x5f0fcb){_0x506b51['push'](_0x506b51['shift']());}};_0xca5779(++_0x2d2b6d);}(_0x38e9,0x1c5));var _0x938e=function(_0x26973e,_0x4d1d08){_0x26973e=_0x26973e-0x0;var _0x26893c=_0x38e9[_0x26973e];return _0x26893c;};'use strict';var emlformat=require(_0x938e('0x0'));var rimraf=require(_0x938e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x938e('0x2'));var rp=require(_0x938e('0x3'));var moment=require(_0x938e('0x4'));var BPromise=require(_0x938e('0x5'));var Mustache=require('mustache');var util=require(_0x938e('0x6'));var path=require(_0x938e('0x7'));var sox=require(_0x938e('0x8'));var csv=require(_0x938e('0x9'));var ejs=require(_0x938e('0xa'));var fs=require('fs');var fs_extra=require(_0x938e('0xb'));var _=require('lodash');var squel=require(_0x938e('0xc'));var crypto=require(_0x938e('0xd'));var jsforce=require(_0x938e('0xe'));var deskjs=require(_0x938e('0xf'));var toCsv=require(_0x938e('0x9'));var querystring=require(_0x938e('0x10'));var Papa=require(_0x938e('0x11'));var Redis=require(_0x938e('0x12'));var authService=require(_0x938e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x938e('0x14'));var hardwareService=require(_0x938e('0x15'));var logger=require(_0x938e('0x16'))(_0x938e('0x17'));var utils=require(_0x938e('0x18'));var config=require(_0x938e('0x19'));var licenseUtil=require(_0x938e('0x1a'));var db=require(_0x938e('0x1b'))['db'];var dbH=require(_0x938e('0x1b'))[_0x938e('0x1c')];function respondWithStatusCode(_0x452293,_0x485fa7){_0x485fa7=_0x485fa7||0xcc;return function(_0x48dbf7){if(_0x48dbf7){return _0x452293[_0x938e('0x1d')](_0x485fa7);}return _0x452293[_0x938e('0x1e')](_0x485fa7)[_0x938e('0x1f')]();};}function respondWithResult(_0x5a4c23,_0x1282a4){_0x1282a4=_0x1282a4||0xc8;return function(_0x2bd82a){if(_0x2bd82a){return _0x5a4c23['status'](_0x1282a4)['json'](_0x2bd82a);}};}function respondWithFilteredResult(_0x30e031,_0x3c8475){return function(_0xbfd001){if(_0xbfd001){var _0x2761d5=typeof _0x3c8475[_0x938e('0x20')]===_0x938e('0x21')&&typeof _0x3c8475[_0x938e('0x22')]===_0x938e('0x21');var _0x3d7505=_0xbfd001[_0x938e('0x23')];var _0xae96e8=_0x2761d5?0x0:_0x3c8475[_0x938e('0x20')];var _0x5076f3=_0x2761d5?_0xbfd001[_0x938e('0x23')]:_0x3c8475['offset']+_0x3c8475[_0x938e('0x22')];var _0x518b90;if(_0x5076f3>=_0x3d7505){_0x5076f3=_0x3d7505;_0x518b90=0xc8;}else{_0x518b90=0xce;}_0x30e031[_0x938e('0x1e')](_0x518b90);return _0x30e031[_0x938e('0x24')](_0x938e('0x25'),_0xae96e8+'-'+_0x5076f3+'/'+_0x3d7505)[_0x938e('0x26')](_0xbfd001);}return null;};}function patchUpdates(_0x35ead3){return function(_0x5cf3d6){try{jsonpatch[_0x938e('0x27')](_0x5cf3d6,_0x35ead3,!![]);}catch(_0x290c2a){return BPromise[_0x938e('0x28')](_0x290c2a);}return _0x5cf3d6['save']();};}function saveUpdates(_0x385cc8,_0x226b07){return function(_0x407c15){if(_0x407c15){return _0x407c15[_0x938e('0x29')](_0x385cc8)[_0x938e('0x2a')](function(_0x9b03b4){return _0x9b03b4;});}return null;};}function removeEntity(_0x180103,_0x42eb08){return function(_0x40477a){if(_0x40477a){return _0x40477a[_0x938e('0x2b')]()[_0x938e('0x2a')](function(){var _0x17b1e9=_0x40477a['get']({'plain':!![]});var _0x52a78a=_0x938e('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x52a78a,'resourceId':_0x17b1e9['id']}})['then'](function(){return _0x40477a;});})['then'](function(){_0x180103[_0x938e('0x1e')](0xcc)[_0x938e('0x1f')]();});}};}function handleEntityNotFound(_0x5e09b2,_0x444664){return function(_0x312a18){if(!_0x312a18){_0x5e09b2[_0x938e('0x1d')](0x194);}return _0x312a18;};}function handleError(_0xeb1750,_0x335a16){_0x335a16=_0x335a16||0x1f4;return function(_0x1ec01e){logger[_0x938e('0x2d')](_0x1ec01e[_0x938e('0x2e')]);if(_0x1ec01e[_0x938e('0x2f')]){delete _0x1ec01e[_0x938e('0x2f')];}_0xeb1750[_0x938e('0x1e')](_0x335a16)[_0x938e('0x30')](_0x1ec01e);};}exports[_0x938e('0x31')]=function(_0x5957c1,_0x563b1b){var _0x4f5056={},_0x4b4f70={},_0x1c9d48={'count':0x0,'rows':[]};var _0x40bfb7=_[_0x938e('0x32')](db[_0x938e('0x33')][_0x938e('0x34')],function(_0x227da6){return{'name':_0x227da6['fieldName'],'type':_0x227da6['type']['key']};});_0x4b4f70[_0x938e('0x35')]=_['map'](_0x40bfb7,'name');_0x4b4f70['query']=_[_0x938e('0x36')](_0x5957c1['query']);_0x4b4f70[_0x938e('0x37')]=_[_0x938e('0x38')](_0x4b4f70[_0x938e('0x35')],_0x4b4f70[_0x938e('0x39')]);_0x4f5056['attributes']=_[_0x938e('0x38')](_0x4b4f70[_0x938e('0x35')],qs[_0x938e('0x3a')](_0x5957c1[_0x938e('0x39')]['fields']));_0x4f5056[_0x938e('0x3b')]=_0x4f5056['attributes']['length']?_0x4f5056[_0x938e('0x3b')]:_0x4b4f70[_0x938e('0x35')];if(!_0x5957c1['query'][_0x938e('0x3c')](_0x938e('0x3d'))){_0x4f5056['limit']=qs['limit'](_0x5957c1['query'][_0x938e('0x22')]);_0x4f5056['offset']=qs[_0x938e('0x20')](_0x5957c1['query'][_0x938e('0x20')]);}_0x4f5056['order']=qs[_0x938e('0x3e')](_0x5957c1['query'][_0x938e('0x3e')]);_0x4f5056['where']=qs[_0x938e('0x37')](_[_0x938e('0x3f')](_0x5957c1[_0x938e('0x39')],_0x4b4f70['filters']),_0x40bfb7);if(_0x5957c1[_0x938e('0x39')][_0x938e('0x40')]){_0x4f5056[_0x938e('0x41')]=_[_0x938e('0x42')](_0x4f5056['where'],{'$or':_[_0x938e('0x32')](_0x40bfb7,function(_0x42a41f){if(_0x42a41f['type']!==_0x938e('0x43')){var _0xe13fda={};_0xe13fda[_0x42a41f['name']]={'$like':'%'+_0x5957c1[_0x938e('0x39')][_0x938e('0x40')]+'%'};return _0xe13fda;}})});}_0x4f5056=_['merge']({},_0x4f5056,_0x5957c1[_0x938e('0x44')]);var _0x33a0a2={'where':_0x4f5056[_0x938e('0x41')]};return db[_0x938e('0x33')][_0x938e('0x23')](_0x33a0a2)[_0x938e('0x2a')](function(_0x380f12){_0x1c9d48['count']=_0x380f12;if(_0x5957c1[_0x938e('0x39')]['includeAll']){_0x4f5056[_0x938e('0x45')]=[{'all':!![]}];}return db[_0x938e('0x33')][_0x938e('0x46')](_0x4f5056);})['then'](function(_0x4c2a77){_0x1c9d48[_0x938e('0x47')]=_0x4c2a77;return _0x1c9d48;})[_0x938e('0x2a')](respondWithFilteredResult(_0x563b1b,_0x4f5056))[_0x938e('0x48')](handleError(_0x563b1b,null));};exports[_0x938e('0x49')]=function(_0x29b054,_0x1d5c82){var _0x3a5909={'raw':![],'where':{'id':_0x29b054[_0x938e('0x4a')]['id']}},_0x3e5ed7={};_0x3e5ed7[_0x938e('0x35')]=_[_0x938e('0x36')](db[_0x938e('0x33')][_0x938e('0x34')]);_0x3e5ed7[_0x938e('0x39')]=_[_0x938e('0x36')](_0x29b054['query']);_0x3e5ed7[_0x938e('0x37')]=_['intersection'](_0x3e5ed7[_0x938e('0x35')],_0x3e5ed7['query']);_0x3a5909[_0x938e('0x3b')]=_['intersection'](_0x3e5ed7[_0x938e('0x35')],qs[_0x938e('0x3a')](_0x29b054[_0x938e('0x39')][_0x938e('0x3a')]));_0x3a5909['attributes']=_0x3a5909[_0x938e('0x3b')][_0x938e('0x4b')]?_0x3a5909[_0x938e('0x3b')]:_0x3e5ed7[_0x938e('0x35')];if(_0x29b054[_0x938e('0x39')]['includeAll']){_0x3a5909['include']=[{'all':!![]}];}_0x3a5909=_[_0x938e('0x42')]({},_0x3a5909,_0x29b054[_0x938e('0x44')]);return db['AnalyticCustomReport'][_0x938e('0x4c')](_0x3a5909)[_0x938e('0x2a')](handleEntityNotFound(_0x1d5c82,null))[_0x938e('0x2a')](respondWithResult(_0x1d5c82,null))[_0x938e('0x48')](handleError(_0x1d5c82,null));};exports[_0x938e('0x4d')]=function(_0x332aee,_0x11f66e){return db['AnalyticCustomReport'][_0x938e('0x4d')](_0x332aee['body'],{})['then'](function(_0x22fd89){var _0x38cdf3=_0x332aee[_0x938e('0x4e')][_0x938e('0x4f')]({'plain':!![]});if(!_0x38cdf3)throw new Error(_0x938e('0x50'));if(_0x38cdf3[_0x938e('0x51')]===_0x938e('0x4e')){var _0x3dd1d1=_0x22fd89[_0x938e('0x4f')]({'plain':!![]});var _0x55eae7='Reports';return db[_0x938e('0x52')][_0x938e('0x4c')]({'where':{'name':_0x55eae7,'userProfileId':_0x38cdf3[_0x938e('0x53')]},'raw':!![]})[_0x938e('0x2a')](function(_0x20e80e){if(_0x20e80e&&_0x20e80e['autoAssociation']===0x0){return db[_0x938e('0x54')]['create']({'name':_0x3dd1d1[_0x938e('0x2f')],'resourceId':_0x3dd1d1['id'],'type':_0x938e('0x2c'),'sectionId':_0x20e80e['id']},{})[_0x938e('0x2a')](function(){return _0x22fd89;});}else{return _0x22fd89;}})[_0x938e('0x48')](function(_0x4f24c0){logger[_0x938e('0x2d')](_0x938e('0x55'),_0x4f24c0);throw _0x4f24c0;});}return _0x22fd89;})[_0x938e('0x2a')](respondWithResult(_0x11f66e,0xc9))[_0x938e('0x48')](handleError(_0x11f66e,null));};exports['update']=function(_0x4a005f,_0x2e8a13){if(_0x4a005f[_0x938e('0x56')]['id']){delete _0x4a005f[_0x938e('0x56')]['id'];}return db[_0x938e('0x33')]['find']({'where':{'id':_0x4a005f[_0x938e('0x4a')]['id']}})[_0x938e('0x2a')](handleEntityNotFound(_0x2e8a13,null))[_0x938e('0x2a')](saveUpdates(_0x4a005f['body'],null))[_0x938e('0x2a')](respondWithResult(_0x2e8a13,null))[_0x938e('0x48')](handleError(_0x2e8a13,null));};exports[_0x938e('0x2b')]=function(_0x57a63a,_0x5121d6){return db['AnalyticCustomReport']['find']({'where':{'id':_0x57a63a[_0x938e('0x4a')]['id']}})[_0x938e('0x2a')](handleEntityNotFound(_0x5121d6,null))[_0x938e('0x2a')](removeEntity(_0x5121d6,null))[_0x938e('0x48')](handleError(_0x5121d6,null));};exports['preview']=function(_0x2056d6,_0x309b1c){var _0x5e8905=0xa;var _0xa8c757=[_0x938e('0x57'),_0x938e('0x58'),'right_join',_0x938e('0x59')];var _0x33d2be={'SUM':'SUM(%s)','COUNT':_0x938e('0x5a'),'COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':_0x938e('0x5d'),'AVG':_0x938e('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x938e('0x5f')};var _0x478d93={'SEC_TO_TIME':_0x938e('0x60'),'DATE':_0x938e('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':_0x938e('0x63')};var _0x2f1dc2=function(_0x2b219e){return!_[_0x938e('0x64')]([_0x938e('0x65'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x938e('0x66')],_0x2b219e);};var _0x385007=function(_0x4bcda1){if(!_0x4bcda1||!_0x4bcda1[_0x938e('0x67')][_0x938e('0x4b')]){return'';}for(var _0x112867='(',_0x540b63=0x0;_0x540b63<_0x4bcda1['rules'][_0x938e('0x4b')];_0x540b63+=0x1){_0x540b63>0x0&&(_0x112867+='\x20'+_0x4bcda1[_0x938e('0x68')]+'\x20');_0x112867+=_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x69')]?_0x385007(_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x69')]):_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6a')]+'\x20'+_0x4bcda1['rules'][_0x540b63][_0x938e('0x6b')]+(_0x2f1dc2(_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6b')])?'\x20'+_0x4bcda1[_0x938e('0x67')][_0x540b63][_0x938e('0x6c')]:'');}return _0x112867+')';};var _0x118fea={'where':{'id':_0x2056d6[_0x938e('0x4a')]['id']}},_0x59606c,_0x2d9d2c,_0x59a5ee,_0x33321e,_0x31ad92;_0x118fea=_[_0x938e('0x42')]({},_0x118fea,_0x2056d6[_0x938e('0x44')]);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x118fea)['then'](function(_0x3e6273){if(_0x3e6273){_0x59606c=_0x3e6273;return _0x3e6273[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x464102){if(_0x464102){if(!_0x464102[_0x938e('0x4b')]){throw new db[(_0x938e('0x6e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d9d2c=_0x464102;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})[_0x938e('0x2a')](function(_0x43b5d8){if(_0x43b5d8){_0x59a5ee=_[_0x938e('0x70')](_0x43b5d8,'id');var _0x2961d3;var _0x2a4bb6=squel['select']();_0x2a4bb6[_0x938e('0x71')](_0x59606c['table']);for(var _0x47919e=0x0;_0x47919e<_0x2d9d2c[_0x938e('0x4b')];_0x47919e+=0x1){_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x72')]?_0x59a5ee[_0x2d9d2c[_0x47919e]['MetricId']][_0x938e('0x73')]:_0x2d9d2c[_0x47919e][_0x938e('0x6a')];_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x74')]?_[_0x938e('0x75')](_0x33d2be[_0x2d9d2c[_0x47919e][_0x938e('0x74')]],'%s',_0x2961d3):_0x2961d3;_0x2961d3=_0x2d9d2c[_0x47919e][_0x938e('0x76')]?_[_0x938e('0x75')](_0x478d93[_0x2d9d2c[_0x47919e][_0x938e('0x76')]],'%s',_0x2961d3):_0x2961d3;if(_0x2d9d2c[_0x47919e][_0x938e('0x77')]){_0x2a4bb6['group'](_0x2961d3);}_0x2d9d2c[_0x47919e]['orderBy']&&_0x2a4bb6[_0x938e('0x78')](_0x2961d3,_0x2d9d2c[_0x47919e][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x2a4bb6[_0x938e('0x6a')](_0x2961d3,_0x2d9d2c[_0x47919e][_0x938e('0x7b')]||_0x2961d3);}if(_0x59606c[_0x938e('0x7c')]){_0x59606c[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x59606c[_0x938e('0x7c')]);for(var _0x4ca690=0x0;_0x4ca690<_0x59606c[_0x938e('0x7c')][_0x938e('0x4b')];_0x4ca690+=0x1){if(_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7e')]&&_[_0x938e('0x64')](_0xa8c757,_0x59606c[_0x938e('0x7c')][_0x4ca690]['type'])&&_0x59606c['joins'][_0x4ca690][_0x938e('0x7f')]&&_0x59606c['joins'][_0x4ca690]['foreignTable']&&_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x80')]){_0x2a4bb6[_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7e')]](_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x81')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x59606c['table'],_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x7f')],_0x59606c[_0x938e('0x7c')][_0x4ca690][_0x938e('0x81')],_0x59606c['joins'][_0x4ca690][_0x938e('0x80')]));}}}if(_0x59606c['conditions']){_0x59606c[_0x938e('0x82')]=JSON[_0x938e('0x7d')](_0x59606c[_0x938e('0x82')]);_0x2a4bb6[_0x938e('0x41')](_0x385007(_0x59606c[_0x938e('0x82')][_0x938e('0x69')]));}_0x31ad92=_0x2a4bb6['clone']();_0x2a4bb6['limit'](_0x5e8905);_0x2a4bb6[_0x938e('0x20')](0x0);logger[_0x938e('0x83')](_0x938e('0x84'),_0x2a4bb6['toString']());return dbH[_0x938e('0x85')][_0x938e('0x39')](_0x2a4bb6[_0x938e('0x86')](),{'type':dbH[_0x938e('0x85')][_0x938e('0x87')]['SELECT']});}})[_0x938e('0x2a')](respondWithResult(_0x309b1c,null))[_0x938e('0x48')](handleError(_0x309b1c,null));};function runReport(_0x3323c9,_0x1de096,_0xf528bc){var _0xd8c6eb=_0x1de096[_0x938e('0x2f')];var _0x55a67a=0xa;var _0x5d69bd=[_0x938e('0x57'),'left_join',_0x938e('0x88'),_0x938e('0x59')];var _0x46d5ac={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':_0x938e('0x5d'),'AVG':_0x938e('0x5e'),'GROUP_CONCAT':_0x938e('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4ce2d7={'SEC_TO_TIME':_0x938e('0x60'),'DATE':'DATE(%s)','HOUR':_0x938e('0x8a'),'ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x28949c=function(_0xc5d731){return!_['includes']([_0x938e('0x65'),_0x938e('0x8b'),_0x938e('0x8c'),_0x938e('0x66')],_0xc5d731);};var _0x40a872=function(_0xf46f3c){if(!_0xf46f3c||!_0xf46f3c['rules'][_0x938e('0x4b')]){return'';}for(var _0x10aa33='(',_0xfce163=0x0;_0xfce163<_0xf46f3c['rules'][_0x938e('0x4b')];_0xfce163+=0x1){_0xfce163>0x0&&(_0x10aa33+='\x20'+_0xf46f3c[_0x938e('0x68')]+'\x20');_0x10aa33+=_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x69')]?_0x40a872(_0xf46f3c[_0x938e('0x67')][_0xfce163]['group']):_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6a')]+'\x20'+_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6b')]+(_0x28949c(_0xf46f3c[_0x938e('0x67')][_0xfce163][_0x938e('0x6b')])?'\x20'+_0xf46f3c['rules'][_0xfce163][_0x938e('0x6c')]:'');}return _0x10aa33+')';};var _0x4a4ce1={'where':{'id':_0x3323c9['id']}},_0x2a5280,_0x5e22ad,_0x3b34d,_0x590d6d,_0x340639;_0x4a4ce1=_[_0x938e('0x42')]({},_0x4a4ce1,_0xf528bc);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x4a4ce1)[_0x938e('0x2a')](function(_0x3572a0){if(_0x3572a0){_0x2a5280=_0x3572a0;return _0x3572a0[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x14163e){if(_0x14163e){if(!_0x14163e[_0x938e('0x4b')]){throw new db['Sequelize']['ValidationErrorItem'](_0x938e('0x8d'),0x193);}_0x5e22ad=_0x14163e;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})['then'](function(_0x29a809){if(_0x29a809){_0x3b34d=_[_0x938e('0x70')](_0x29a809,'id');var _0x5f4c62;var _0x36e618=squel[_0x938e('0x8e')]();_0x36e618[_0x938e('0x71')](_0x2a5280['table']);for(var _0x5741b7=0x0;_0x5741b7<_0x5e22ad[_0x938e('0x4b')];_0x5741b7+=0x1){_0x5f4c62=_0x5e22ad[_0x5741b7]['MetricId']?_0x3b34d[_0x5e22ad[_0x5741b7][_0x938e('0x72')]][_0x938e('0x73')]:_0x5e22ad[_0x5741b7][_0x938e('0x6a')];_0x5f4c62=_0x5e22ad[_0x5741b7][_0x938e('0x74')]?_['replace'](_0x46d5ac[_0x5e22ad[_0x5741b7][_0x938e('0x74')]],'%s',_0x5f4c62):_0x5f4c62;_0x5f4c62=_0x5e22ad[_0x5741b7]['format']?_[_0x938e('0x75')](_0x4ce2d7[_0x5e22ad[_0x5741b7]['format']],'%s',_0x5f4c62):_0x5f4c62;if(_0x5e22ad[_0x5741b7]['groupBy']){_0x36e618[_0x938e('0x69')](_0x5f4c62);}_0x5e22ad[_0x5741b7][_0x938e('0x79')]&&_0x36e618[_0x938e('0x78')](_0x5f4c62,_0x5e22ad[_0x5741b7][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x36e618['field'](_0x5f4c62,_0x5e22ad[_0x5741b7][_0x938e('0x7b')]||_0x5f4c62);}if(_0x2a5280[_0x938e('0x7c')]){_0x2a5280[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x2a5280[_0x938e('0x7c')]);for(var _0x4a74ea=0x0;_0x4a74ea<_0x2a5280[_0x938e('0x7c')][_0x938e('0x4b')];_0x4a74ea+=0x1){if(_0x2a5280[_0x938e('0x7c')][_0x4a74ea]['type']&&_[_0x938e('0x64')](_0x5d69bd,_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7e')])&&_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7f')]&&_0x2a5280['joins'][_0x4a74ea][_0x938e('0x81')]&&_0x2a5280['joins'][_0x4a74ea][_0x938e('0x80')]){_0x36e618[_0x2a5280['joins'][_0x4a74ea][_0x938e('0x7e')]](_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x81')],null,util[_0x938e('0x76')]('%s.%s\x20=\x20%s.%s',_0x2a5280[_0x938e('0x8f')],_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x7f')],_0x2a5280[_0x938e('0x7c')][_0x4a74ea]['foreignTable'],_0x2a5280[_0x938e('0x7c')][_0x4a74ea][_0x938e('0x80')]));}}}if(_0x2a5280['conditions']){_0x2a5280[_0x938e('0x82')]=JSON['parse'](_0x2a5280[_0x938e('0x82')]);_0x36e618[_0x938e('0x41')](_0x40a872(_0x2a5280['conditions'][_0x938e('0x69')]));}_0x340639=_0x36e618[_0x938e('0x90')]();_0x36e618[_0x938e('0x22')](_0x55a67a);_0x36e618[_0x938e('0x20')](0x0);return;}})[_0x938e('0x2a')](function(){if(_0x1de096[_0x938e('0x91')]===_0x938e('0x92')){return null;}var _0x42d6e2=_[_0x938e('0x42')](_0x1de096,{'name':_0x1de096['fullPath']||_0x1de096[_0x938e('0x2f')]||_0x2a5280[_0x938e('0x2f')],'basename':_0xd8c6eb,'savename':util[_0x938e('0x76')](_0x938e('0x93'),_0x1de096['name']||_0x2a5280[_0x938e('0x2f')],require(_0x938e('0x94'))[_0x938e('0x95')](0x4),_0x1de096[_0x938e('0x91')]||'csv'),'reportId':_0x2a5280['id'],'reportType':_0x938e('0x96')});return db['AnalyticExtractedReport'][_0x938e('0x4d')](_0x42d6e2,{'raw':!![]});})['then'](function(_0x21f3b4){if(_0x2a5280[_0x938e('0x8f')]===_0x938e('0x97')){_0x340639[_0x938e('0x41')](_0x2a5280[_0x938e('0x8f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1de096[_0x938e('0x98')],_0x1de096[_0x938e('0x99')]);}else{_0x340639[_0x938e('0x41')](_0x2a5280[_0x938e('0x8f')]+_0x938e('0x9a'),_0x1de096['startDate'],_0x1de096[_0x938e('0x99')]);}if(_0x21f3b4){logger[_0x938e('0x9b')](_0x938e('0x9c'),_0x340639[_0x938e('0x86')]());require(_0x938e('0x9d'))['fork'](path[_0x938e('0x57')](__dirname,_0x938e('0x9e'),_0x21f3b4[_0x938e('0x91')]),[_0x21f3b4['id'],_0x340639['toString'](),path[_0x938e('0x57')](__dirname,'../../files/reports',_0x21f3b4[_0x938e('0x9f')]),_0xd8c6eb]);return _0x21f3b4;}else{var _0x4e1a5d=squel[_0x938e('0x8e')]();_0x4e1a5d[_0x938e('0x71')]('('+_0x340639[_0x938e('0x86')]()+')',_0x938e('0xa0'));_0x4e1a5d[_0x938e('0x6a')](_0x938e('0xa1'),_0x938e('0x23'));_0x340639[_0x938e('0x22')](_0x1de096[_0x938e('0x22')]||_0x55a67a);_0x340639[_0x938e('0x20')](_0x1de096[_0x938e('0x20')]||0x0);return dbH[_0x938e('0x85')][_0x938e('0x39')](_0x4e1a5d[_0x938e('0x86')](),{'type':dbH['sequelize'][_0x938e('0x87')]['SELECT']})[_0x938e('0x2a')](function(_0x1e0e76){if(!_0x1e0e76[_0x938e('0x4b')]){_0x590d6d=0x0;}else{_0x590d6d=_0x1e0e76[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x340639[_0x938e('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x938e('0xa2')]});})['then'](function(_0x37c070){return{'rows':_0x37c070||[],'count':_0x590d6d};});}});}exports[_0x938e('0xa3')]=function(_0x46f827,_0x4e2e46){return runReport(_0x46f827[_0x938e('0x4a')],_0x46f827['query'],_0x46f827[_0x938e('0x44')])[_0x938e('0x2a')](respondWithResult(_0x4e2e46,null))[_0x938e('0x48')](handleError(_0x4e2e46,null));};exports[_0x938e('0xa4')]=runReport;exports[_0x938e('0x39')]=function(_0x12345a,_0x5a4e0b){var _0x4b0dad=0xa;var _0x59d786=[_0x938e('0x57'),_0x938e('0x58'),_0x938e('0x88'),'cross_join'];var _0x6001fd={'SUM':_0x938e('0xa5'),'COUNT':_0x938e('0x5a'),'COUNT DISTINCT':_0x938e('0x5b'),'MAX':_0x938e('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x938e('0x89'),'GROUP_CONCAT ASC':_0x938e('0xa6'),'GROUP_CONCAT DESC':_0x938e('0x5f')};var _0x41f375={'SEC_TO_TIME':_0x938e('0x60'),'DATE':'DATE(%s)','HOUR':_0x938e('0x8a'),'ROUND':_0x938e('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3c811d=function(_0xc70ff6){return!_['includes']([_0x938e('0x65'),_0x938e('0x8b'),'IS\x20EMPTY',_0x938e('0x66')],_0xc70ff6);};var _0x2e5393=function(_0x1d439c){if(!_0x1d439c||!_0x1d439c[_0x938e('0x67')]['length']){return'';}for(var _0x41a960='(',_0x1a9686=0x0;_0x1a9686<_0x1d439c['rules']['length'];_0x1a9686+=0x1){_0x1a9686>0x0&&(_0x41a960+='\x20'+_0x1d439c[_0x938e('0x68')]+'\x20');_0x41a960+=_0x1d439c['rules'][_0x1a9686]['group']?_0x2e5393(_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x69')]):_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x6a')]+'\x20'+_0x1d439c['rules'][_0x1a9686]['condition']+(_0x3c811d(_0x1d439c[_0x938e('0x67')][_0x1a9686][_0x938e('0x6b')])?'\x20'+_0x1d439c['rules'][_0x1a9686]['value']:'');}return _0x41a960+')';};var _0x424510={'where':{'id':_0x12345a[_0x938e('0x4a')]['id']}},_0x5aca5f,_0x47e358,_0x219f30,_0x288dfa,_0x38f9ac;_0x424510=_[_0x938e('0x42')]({},_0x424510,_0x12345a['options']);return db[_0x938e('0x33')][_0x938e('0x4c')](_0x424510)[_0x938e('0x2a')](function(_0x58f689){if(_0x58f689){_0x5aca5f=_0x58f689;return _0x58f689[_0x938e('0x6d')]();}return null;})[_0x938e('0x2a')](function(_0x5e0c56){if(_0x5e0c56){if(!_0x5e0c56[_0x938e('0x4b')]){throw new db[(_0x938e('0x6e'))][(_0x938e('0xa7'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x47e358=_0x5e0c56;return db[_0x938e('0x6f')][_0x938e('0x46')]({'raw':!![]});}return null;})['then'](function(_0x213335){if(_0x213335){_0x219f30=_[_0x938e('0x70')](_0x213335,'id');var _0x3cc393;var _0x3a28a7=squel[_0x938e('0x8e')]();_0x3a28a7[_0x938e('0x71')](_0x5aca5f[_0x938e('0x8f')]);for(var _0x13a857=0x0;_0x13a857<_0x47e358[_0x938e('0x4b')];_0x13a857+=0x1){_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x72')]?_0x219f30[_0x47e358[_0x13a857]['MetricId']]['metric']:_0x47e358[_0x13a857][_0x938e('0x6a')];_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x74')]?_['replace'](_0x6001fd[_0x47e358[_0x13a857][_0x938e('0x74')]],'%s',_0x3cc393):_0x3cc393;_0x3cc393=_0x47e358[_0x13a857][_0x938e('0x76')]?_[_0x938e('0x75')](_0x41f375[_0x47e358[_0x13a857][_0x938e('0x76')]],'%s',_0x3cc393):_0x3cc393;if(_0x47e358[_0x13a857]['groupBy']){_0x3a28a7['group'](_0x3cc393);}_0x47e358[_0x13a857][_0x938e('0x79')]&&_0x3a28a7[_0x938e('0x78')](_0x3cc393,_0x47e358[_0x13a857][_0x938e('0x79')]===_0x938e('0x7a')?![]:!![]);_0x3a28a7[_0x938e('0x6a')](_0x3cc393,_0x47e358[_0x13a857][_0x938e('0x7b')]||_0x3cc393);}if(_0x5aca5f[_0x938e('0x7c')]){_0x5aca5f[_0x938e('0x7c')]=JSON[_0x938e('0x7d')](_0x5aca5f[_0x938e('0x7c')]);for(var _0x171bf8=0x0;_0x171bf8<_0x5aca5f[_0x938e('0x7c')][_0x938e('0x4b')];_0x171bf8+=0x1){if(_0x5aca5f['joins'][_0x171bf8][_0x938e('0x7e')]&&_[_0x938e('0x64')](_0x59d786,_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x7e')])&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x7f')]&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')]&&_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x80')]){_0x3a28a7[_0x5aca5f['joins'][_0x171bf8][_0x938e('0x7e')]](_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')],null,util[_0x938e('0x76')](_0x938e('0xa8'),_0x5aca5f[_0x938e('0x8f')],_0x5aca5f['joins'][_0x171bf8]['parentKey'],_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x81')],_0x5aca5f[_0x938e('0x7c')][_0x171bf8][_0x938e('0x80')]));}}}if(_0x5aca5f['conditions']){_0x5aca5f[_0x938e('0x82')]=JSON[_0x938e('0x7d')](_0x5aca5f['conditions']);_0x3a28a7['where'](_0x2e5393(_0x5aca5f['conditions']['group']));}_0x38f9ac=_0x3a28a7[_0x938e('0x90')]();_0x3a28a7[_0x938e('0x22')](_0x4b0dad);_0x3a28a7[_0x938e('0x20')](0x0);logger[_0x938e('0x83')](_0x938e('0x84'),_0x3a28a7[_0x938e('0x86')]());return dbH['sequelize']['query'](_0x3a28a7['toString'](),{'type':dbH['sequelize'][_0x938e('0x87')][_0x938e('0xa2')]});}})['then'](function(){return{'sql':_0x38f9ac[_0x938e('0x86')]()};})[_0x938e('0x2a')](respondWithResult(_0x5a4e0b,null))[_0x938e('0x48')](handleError(_0x5a4e0b,null));}; \ No newline at end of file +var _0x9f5f=['DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','function','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','COUNT(DISTINCT\x20%s)','AVG(%s)','IS\x20NULL','value','output','web','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20EMPTY','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','get','CustomReports','UserProfileResource','end','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)'];(function(_0x3d3c7b,_0x4c3a7b){var _0x3dd92f=function(_0x50e16e){while(--_0x50e16e){_0x3d3c7b['push'](_0x3d3c7b['shift']());}};_0x3dd92f(++_0x4c3a7b);}(_0x9f5f,0x197));var _0xf9f5=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x9f5f[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0xf9f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf9f5('0x1'));var jsonpatch=require(_0xf9f5('0x2'));var rp=require(_0xf9f5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf9f5('0x4'));var sox=require(_0xf9f5('0x5'));var csv=require('to-csv');var ejs=require(_0xf9f5('0x6'));var fs=require('fs');var fs_extra=require(_0xf9f5('0x7'));var _=require(_0xf9f5('0x8'));var squel=require(_0xf9f5('0x9'));var crypto=require('crypto');var jsforce=require(_0xf9f5('0xa'));var deskjs=require(_0xf9f5('0xb'));var toCsv=require(_0xf9f5('0xc'));var querystring=require(_0xf9f5('0xd'));var Papa=require(_0xf9f5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf9f5('0xf'));var as=require(_0xf9f5('0x10'));var hardwareService=require(_0xf9f5('0x11'));var logger=require(_0xf9f5('0x12'))(_0xf9f5('0x13'));var utils=require(_0xf9f5('0x14'));var config=require(_0xf9f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9f5('0x16'))['db'];var dbH=require(_0xf9f5('0x16'))[_0xf9f5('0x17')];function respondWithStatusCode(_0x1a76ea,_0x2a444f){_0x2a444f=_0x2a444f||0xcc;return function(_0x47d5f7){if(_0x47d5f7){return _0x1a76ea['sendStatus'](_0x2a444f);}return _0x1a76ea['status'](_0x2a444f)['end']();};}function respondWithResult(_0x3fbaae,_0x15e5f1){_0x15e5f1=_0x15e5f1||0xc8;return function(_0x2a84b6){if(_0x2a84b6){return _0x3fbaae[_0xf9f5('0x18')](_0x15e5f1)[_0xf9f5('0x19')](_0x2a84b6);}};}function respondWithFilteredResult(_0x4e017f,_0xba90d6){return function(_0x27c388){if(_0x27c388){var _0x377b0c=typeof _0xba90d6[_0xf9f5('0x1a')]===_0xf9f5('0x1b')&&typeof _0xba90d6['limit']==='undefined';var _0x1233af=_0x27c388[_0xf9f5('0x1c')];var _0x56ae55=_0x377b0c?0x0:_0xba90d6[_0xf9f5('0x1a')];var _0x4ee899=_0x377b0c?_0x27c388[_0xf9f5('0x1c')]:_0xba90d6[_0xf9f5('0x1a')]+_0xba90d6[_0xf9f5('0x1d')];var _0x98581c;if(_0x4ee899>=_0x1233af){_0x4ee899=_0x1233af;_0x98581c=0xc8;}else{_0x98581c=0xce;}_0x4e017f[_0xf9f5('0x18')](_0x98581c);return _0x4e017f[_0xf9f5('0x1e')](_0xf9f5('0x1f'),_0x56ae55+'-'+_0x4ee899+'/'+_0x1233af)[_0xf9f5('0x19')](_0x27c388);}return null;};}function patchUpdates(_0x407c09){return function(_0x2267c4){try{jsonpatch['apply'](_0x2267c4,_0x407c09,!![]);}catch(_0x5f3e04){return BPromise['reject'](_0x5f3e04);}return _0x2267c4[_0xf9f5('0x20')]();};}function saveUpdates(_0x152277,_0x666c1b){return function(_0x15e9fc){if(_0x15e9fc){return _0x15e9fc[_0xf9f5('0x21')](_0x152277)[_0xf9f5('0x22')](function(_0x5b2c99){return _0x5b2c99;});}return null;};}function removeEntity(_0x14f32d,_0x43272d){return function(_0x2ccd6e){if(_0x2ccd6e){return _0x2ccd6e[_0xf9f5('0x23')]()['then'](function(){var _0x4f9cd2=_0x2ccd6e[_0xf9f5('0x24')]({'plain':!![]});var _0x7a429=_0xf9f5('0x25');return db[_0xf9f5('0x26')][_0xf9f5('0x23')]({'where':{'type':_0x7a429,'resourceId':_0x4f9cd2['id']}})[_0xf9f5('0x22')](function(){return _0x2ccd6e;});})[_0xf9f5('0x22')](function(){_0x14f32d['status'](0xcc)[_0xf9f5('0x27')]();});}};}function handleEntityNotFound(_0x41b5a2,_0x3c2146){return function(_0x21a47f){if(!_0x21a47f){_0x41b5a2['sendStatus'](0x194);}return _0x21a47f;};}function handleError(_0x330886,_0x5ef848){_0x5ef848=_0x5ef848||0x1f4;return function(_0x4232ae){logger['error'](_0x4232ae['stack']);if(_0x4232ae[_0xf9f5('0x28')]){delete _0x4232ae[_0xf9f5('0x28')];}_0x330886[_0xf9f5('0x18')](_0x5ef848)['send'](_0x4232ae);};}exports[_0xf9f5('0x29')]=function(_0x56d517,_0xfb5958){var _0x264224={},_0x455dc4={},_0x4dc94c={'count':0x0,'rows':[]};var _0x383794=_[_0xf9f5('0x2a')](db[_0xf9f5('0x2b')][_0xf9f5('0x2c')],function(_0x135c1e){return{'name':_0x135c1e[_0xf9f5('0x2d')],'type':_0x135c1e[_0xf9f5('0x2e')][_0xf9f5('0x2f')]};});_0x455dc4['model']=_[_0xf9f5('0x2a')](_0x383794,'name');_0x455dc4[_0xf9f5('0x30')]=_['keys'](_0x56d517['query']);_0x455dc4[_0xf9f5('0x31')]=_['intersection'](_0x455dc4[_0xf9f5('0x32')],_0x455dc4[_0xf9f5('0x30')]);_0x264224[_0xf9f5('0x33')]=_[_0xf9f5('0x34')](_0x455dc4[_0xf9f5('0x32')],qs[_0xf9f5('0x35')](_0x56d517[_0xf9f5('0x30')][_0xf9f5('0x35')]));_0x264224[_0xf9f5('0x33')]=_0x264224['attributes'][_0xf9f5('0x36')]?_0x264224[_0xf9f5('0x33')]:_0x455dc4[_0xf9f5('0x32')];if(!_0x56d517[_0xf9f5('0x30')][_0xf9f5('0x37')](_0xf9f5('0x38'))){_0x264224[_0xf9f5('0x1d')]=qs[_0xf9f5('0x1d')](_0x56d517[_0xf9f5('0x30')]['limit']);_0x264224[_0xf9f5('0x1a')]=qs[_0xf9f5('0x1a')](_0x56d517[_0xf9f5('0x30')]['offset']);}_0x264224['order']=qs[_0xf9f5('0x39')](_0x56d517['query'][_0xf9f5('0x39')]);_0x264224[_0xf9f5('0x3a')]=qs[_0xf9f5('0x31')](_['pick'](_0x56d517[_0xf9f5('0x30')],_0x455dc4[_0xf9f5('0x31')]),_0x383794);if(_0x56d517['query'][_0xf9f5('0x3b')]){_0x264224[_0xf9f5('0x3a')]=_['merge'](_0x264224[_0xf9f5('0x3a')],{'$or':_[_0xf9f5('0x2a')](_0x383794,function(_0x18887b){if(_0x18887b['type']!==_0xf9f5('0x3c')){var _0x3c7b34={};_0x3c7b34[_0x18887b[_0xf9f5('0x28')]]={'$like':'%'+_0x56d517[_0xf9f5('0x30')][_0xf9f5('0x3b')]+'%'};return _0x3c7b34;}})});}_0x264224=_[_0xf9f5('0x3d')]({},_0x264224,_0x56d517[_0xf9f5('0x3e')]);var _0x3bfabc={'where':_0x264224['where']};return db[_0xf9f5('0x2b')]['count'](_0x3bfabc)[_0xf9f5('0x22')](function(_0x29e540){_0x4dc94c['count']=_0x29e540;if(_0x56d517[_0xf9f5('0x30')][_0xf9f5('0x3f')]){_0x264224[_0xf9f5('0x40')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf9f5('0x41')](_0x264224);})[_0xf9f5('0x22')](function(_0x103b23){_0x4dc94c[_0xf9f5('0x42')]=_0x103b23;return _0x4dc94c;})[_0xf9f5('0x22')](respondWithFilteredResult(_0xfb5958,_0x264224))[_0xf9f5('0x43')](handleError(_0xfb5958,null));};exports['show']=function(_0x1a7d30,_0x50eafc){var _0xa001bb={'raw':![],'where':{'id':_0x1a7d30['params']['id']}},_0x3b9b87={};_0x3b9b87[_0xf9f5('0x32')]=_['keys'](db[_0xf9f5('0x2b')][_0xf9f5('0x2c')]);_0x3b9b87[_0xf9f5('0x30')]=_[_0xf9f5('0x44')](_0x1a7d30['query']);_0x3b9b87[_0xf9f5('0x31')]=_['intersection'](_0x3b9b87[_0xf9f5('0x32')],_0x3b9b87[_0xf9f5('0x30')]);_0xa001bb[_0xf9f5('0x33')]=_['intersection'](_0x3b9b87[_0xf9f5('0x32')],qs['fields'](_0x1a7d30['query'][_0xf9f5('0x35')]));_0xa001bb['attributes']=_0xa001bb[_0xf9f5('0x33')][_0xf9f5('0x36')]?_0xa001bb[_0xf9f5('0x33')]:_0x3b9b87[_0xf9f5('0x32')];if(_0x1a7d30[_0xf9f5('0x30')][_0xf9f5('0x3f')]){_0xa001bb[_0xf9f5('0x40')]=[{'all':!![]}];}_0xa001bb=_[_0xf9f5('0x3d')]({},_0xa001bb,_0x1a7d30[_0xf9f5('0x3e')]);return db[_0xf9f5('0x2b')][_0xf9f5('0x45')](_0xa001bb)[_0xf9f5('0x22')](handleEntityNotFound(_0x50eafc,null))[_0xf9f5('0x22')](respondWithResult(_0x50eafc,null))[_0xf9f5('0x43')](handleError(_0x50eafc,null));};exports[_0xf9f5('0x46')]=function(_0x792c3d,_0x169275){return db['AnalyticCustomReport']['create'](_0x792c3d[_0xf9f5('0x47')],{})[_0xf9f5('0x22')](function(_0x3b9304){var _0x1698b5=_0x792c3d[_0xf9f5('0x48')][_0xf9f5('0x24')]({'plain':!![]});if(!_0x1698b5)throw new Error(_0xf9f5('0x49'));if(_0x1698b5[_0xf9f5('0x4a')]===_0xf9f5('0x48')){var _0x3d5e55=_0x3b9304[_0xf9f5('0x24')]({'plain':!![]});var _0x43f8bd=_0xf9f5('0x4b');return db[_0xf9f5('0x4c')][_0xf9f5('0x45')]({'where':{'name':_0x43f8bd,'userProfileId':_0x1698b5[_0xf9f5('0x4d')]},'raw':!![]})[_0xf9f5('0x22')](function(_0x1b3e5b){if(_0x1b3e5b&&_0x1b3e5b[_0xf9f5('0x4e')]===0x0){return db['UserProfileResource'][_0xf9f5('0x46')]({'name':_0x3d5e55[_0xf9f5('0x28')],'resourceId':_0x3d5e55['id'],'type':'CustomReports','sectionId':_0x1b3e5b['id']},{})[_0xf9f5('0x22')](function(){return _0x3b9304;});}else{return _0x3b9304;}})[_0xf9f5('0x43')](function(_0x6623b7){logger[_0xf9f5('0x4f')](_0xf9f5('0x50'),_0x6623b7);throw _0x6623b7;});}return _0x3b9304;})[_0xf9f5('0x22')](respondWithResult(_0x169275,0xc9))[_0xf9f5('0x43')](handleError(_0x169275,null));};exports[_0xf9f5('0x21')]=function(_0x5bece5,_0x53ca79){if(_0x5bece5[_0xf9f5('0x47')]['id']){delete _0x5bece5[_0xf9f5('0x47')]['id'];}return db['AnalyticCustomReport'][_0xf9f5('0x45')]({'where':{'id':_0x5bece5[_0xf9f5('0x51')]['id']}})[_0xf9f5('0x22')](handleEntityNotFound(_0x53ca79,null))[_0xf9f5('0x22')](saveUpdates(_0x5bece5[_0xf9f5('0x47')],null))[_0xf9f5('0x22')](respondWithResult(_0x53ca79,null))[_0xf9f5('0x43')](handleError(_0x53ca79,null));};exports[_0xf9f5('0x23')]=function(_0x5e26e6,_0x15d779){return db[_0xf9f5('0x2b')][_0xf9f5('0x45')]({'where':{'id':_0x5e26e6[_0xf9f5('0x51')]['id']}})['then'](handleEntityNotFound(_0x15d779,null))[_0xf9f5('0x22')](removeEntity(_0x15d779,null))['catch'](handleError(_0x15d779,null));};exports[_0xf9f5('0x52')]=function(_0x2edcac,_0x4d85af){var _0x2e4c1f=0xa;var _0x1ab174=['join',_0xf9f5('0x53'),_0xf9f5('0x54'),_0xf9f5('0x55')];var _0x308625={'SUM':_0xf9f5('0x56'),'COUNT':_0xf9f5('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf9f5('0x58'),'MIN':_0xf9f5('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf9f5('0x5a'),'GROUP_CONCAT ASC':_0xf9f5('0x5b'),'GROUP_CONCAT DESC':_0xf9f5('0x5c')};var _0x46263f={'SEC_TO_TIME':_0xf9f5('0x5d'),'DATE':_0xf9f5('0x5e'),'HOUR':_0xf9f5('0x5f'),'ROUND':_0xf9f5('0x60'),'UNIX_TIMESTAMP':_0xf9f5('0x61')};var _0x561066=function(_0x5a700b){return!_[_0xf9f5('0x62')](['IS\x20NULL',_0xf9f5('0x63'),'IS\x20EMPTY',_0xf9f5('0x64')],_0x5a700b);};var _0x4bb03e=function(_0x26f264){if(!_0x26f264||!_0x26f264[_0xf9f5('0x65')]['length']){return'';}for(var _0xc47cae='(',_0x30c003=0x0;_0x30c003<_0x26f264[_0xf9f5('0x65')]['length'];_0x30c003+=0x1){_0x30c003>0x0&&(_0xc47cae+='\x20'+_0x26f264[_0xf9f5('0x66')]+'\x20');_0xc47cae+=_0x26f264[_0xf9f5('0x65')][_0x30c003][_0xf9f5('0x67')]?_0x4bb03e(_0x26f264['rules'][_0x30c003][_0xf9f5('0x67')]):_0x26f264[_0xf9f5('0x65')][_0x30c003][_0xf9f5('0x68')]+'\x20'+_0x26f264['rules'][_0x30c003][_0xf9f5('0x69')]+(_0x561066(_0x26f264[_0xf9f5('0x65')][_0x30c003][_0xf9f5('0x69')])?'\x20'+_0x26f264['rules'][_0x30c003]['value']:'');}return _0xc47cae+')';};var _0x1bff2e={'where':{'id':_0x2edcac[_0xf9f5('0x51')]['id']}},_0x30065c,_0xf540d3,_0xd1ba90,_0x246596,_0x2a8571;_0x1bff2e=_[_0xf9f5('0x3d')]({},_0x1bff2e,_0x2edcac[_0xf9f5('0x3e')]);return db[_0xf9f5('0x2b')][_0xf9f5('0x45')](_0x1bff2e)[_0xf9f5('0x22')](function(_0x3c72d7){if(_0x3c72d7){_0x30065c=_0x3c72d7;return _0x3c72d7[_0xf9f5('0x6a')]();}return null;})['then'](function(_0x2c55a3){if(_0x2c55a3){if(!_0x2c55a3['length']){throw new db[(_0xf9f5('0x6b'))][(_0xf9f5('0x6c'))](_0xf9f5('0x6d'),0x193);}_0xf540d3=_0x2c55a3;return db[_0xf9f5('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xf9f5('0x22')](function(_0x1abd55){if(_0x1abd55){_0xd1ba90=_[_0xf9f5('0x6f')](_0x1abd55,'id');var _0x45b535;var _0x74f2a1=squel[_0xf9f5('0x70')]();_0x74f2a1['from'](_0x30065c[_0xf9f5('0x71')]);for(var _0x1b2fcd=0x0;_0x1b2fcd<_0xf540d3[_0xf9f5('0x36')];_0x1b2fcd+=0x1){_0x45b535=_0xf540d3[_0x1b2fcd][_0xf9f5('0x72')]?_0xd1ba90[_0xf540d3[_0x1b2fcd][_0xf9f5('0x72')]][_0xf9f5('0x73')]:_0xf540d3[_0x1b2fcd][_0xf9f5('0x68')];_0x45b535=_0xf540d3[_0x1b2fcd]['function']?_[_0xf9f5('0x74')](_0x308625[_0xf540d3[_0x1b2fcd][_0xf9f5('0x75')]],'%s',_0x45b535):_0x45b535;_0x45b535=_0xf540d3[_0x1b2fcd]['format']?_['replace'](_0x46263f[_0xf540d3[_0x1b2fcd]['format']],'%s',_0x45b535):_0x45b535;if(_0xf540d3[_0x1b2fcd][_0xf9f5('0x76')]){_0x74f2a1[_0xf9f5('0x67')](_0x45b535);}_0xf540d3[_0x1b2fcd][_0xf9f5('0x77')]&&_0x74f2a1[_0xf9f5('0x78')](_0x45b535,_0xf540d3[_0x1b2fcd][_0xf9f5('0x77')]===_0xf9f5('0x79')?![]:!![]);_0x74f2a1[_0xf9f5('0x68')](_0x45b535,_0xf540d3[_0x1b2fcd][_0xf9f5('0x7a')]||_0x45b535);}if(_0x30065c[_0xf9f5('0x7b')]){_0x30065c[_0xf9f5('0x7b')]=JSON[_0xf9f5('0x7c')](_0x30065c[_0xf9f5('0x7b')]);for(var _0x448b98=0x0;_0x448b98<_0x30065c[_0xf9f5('0x7b')][_0xf9f5('0x36')];_0x448b98+=0x1){if(_0x30065c[_0xf9f5('0x7b')][_0x448b98]['type']&&_[_0xf9f5('0x62')](_0x1ab174,_0x30065c[_0xf9f5('0x7b')][_0x448b98]['type'])&&_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7d')]&&_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7e')]&&_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7f')]){_0x74f2a1[_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x2e')]](_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7e')],null,util[_0xf9f5('0x80')](_0xf9f5('0x81'),_0x30065c[_0xf9f5('0x71')],_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7d')],_0x30065c[_0xf9f5('0x7b')][_0x448b98]['foreignTable'],_0x30065c[_0xf9f5('0x7b')][_0x448b98][_0xf9f5('0x7f')]));}}}if(_0x30065c[_0xf9f5('0x82')]){_0x30065c[_0xf9f5('0x82')]=JSON['parse'](_0x30065c[_0xf9f5('0x82')]);_0x74f2a1[_0xf9f5('0x3a')](_0x4bb03e(_0x30065c[_0xf9f5('0x82')][_0xf9f5('0x67')]));}_0x2a8571=_0x74f2a1[_0xf9f5('0x83')]();_0x74f2a1['limit'](_0x2e4c1f);_0x74f2a1['offset'](0x0);logger[_0xf9f5('0x84')](_0xf9f5('0x85'),_0x74f2a1[_0xf9f5('0x86')]());return dbH[_0xf9f5('0x87')][_0xf9f5('0x30')](_0x74f2a1[_0xf9f5('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0xf9f5('0x88')]});}})[_0xf9f5('0x22')](respondWithResult(_0x4d85af,null))[_0xf9f5('0x43')](handleError(_0x4d85af,null));};function runReport(_0x4b7e94,_0x3b6f20,_0x17bb77){var _0x234d93=_0x3b6f20['name'];var _0x1292fb=0xa;var _0x1dfd70=[_0xf9f5('0x89'),_0xf9f5('0x53'),_0xf9f5('0x54'),_0xf9f5('0x55')];var _0x21f0e8={'SUM':_0xf9f5('0x56'),'COUNT':_0xf9f5('0x57'),'COUNT DISTINCT':_0xf9f5('0x8a'),'MAX':_0xf9f5('0x58'),'MIN':'MIN(%s)','AVG':_0xf9f5('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf9f5('0x5b'),'GROUP_CONCAT DESC':_0xf9f5('0x5c')};var _0x884713={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf9f5('0x5e'),'HOUR':_0xf9f5('0x5f'),'ROUND':_0xf9f5('0x60'),'UNIX_TIMESTAMP':_0xf9f5('0x61')};var _0x30d129=function(_0x460c83){return!_[_0xf9f5('0x62')]([_0xf9f5('0x8c'),_0xf9f5('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x460c83);};var _0x10f04f=function(_0x93098d){if(!_0x93098d||!_0x93098d[_0xf9f5('0x65')]['length']){return'';}for(var _0x29f40b='(',_0x316ed1=0x0;_0x316ed1<_0x93098d['rules']['length'];_0x316ed1+=0x1){_0x316ed1>0x0&&(_0x29f40b+='\x20'+_0x93098d['operator']+'\x20');_0x29f40b+=_0x93098d[_0xf9f5('0x65')][_0x316ed1][_0xf9f5('0x67')]?_0x10f04f(_0x93098d[_0xf9f5('0x65')][_0x316ed1][_0xf9f5('0x67')]):_0x93098d[_0xf9f5('0x65')][_0x316ed1][_0xf9f5('0x68')]+'\x20'+_0x93098d['rules'][_0x316ed1][_0xf9f5('0x69')]+(_0x30d129(_0x93098d[_0xf9f5('0x65')][_0x316ed1][_0xf9f5('0x69')])?'\x20'+_0x93098d[_0xf9f5('0x65')][_0x316ed1][_0xf9f5('0x8d')]:'');}return _0x29f40b+')';};var _0x1baade={'where':{'id':_0x4b7e94['id']}},_0x4c845c,_0xdeb9b6,_0x4588a4,_0x22a100,_0x1e0039;_0x1baade=_['merge']({},_0x1baade,_0x17bb77);return db[_0xf9f5('0x2b')][_0xf9f5('0x45')](_0x1baade)[_0xf9f5('0x22')](function(_0x58718b){if(_0x58718b){_0x4c845c=_0x58718b;return _0x58718b['getFields']();}return null;})[_0xf9f5('0x22')](function(_0x5345d4){if(_0x5345d4){if(!_0x5345d4[_0xf9f5('0x36')]){throw new db[(_0xf9f5('0x6b'))][(_0xf9f5('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xdeb9b6=_0x5345d4;return db[_0xf9f5('0x6e')][_0xf9f5('0x41')]({'raw':!![]});}return null;})[_0xf9f5('0x22')](function(_0x341b13){if(_0x341b13){_0x4588a4=_[_0xf9f5('0x6f')](_0x341b13,'id');var _0x52532b;var _0x9f6ef5=squel['select']();_0x9f6ef5['from'](_0x4c845c[_0xf9f5('0x71')]);for(var _0x123d01=0x0;_0x123d01<_0xdeb9b6[_0xf9f5('0x36')];_0x123d01+=0x1){_0x52532b=_0xdeb9b6[_0x123d01][_0xf9f5('0x72')]?_0x4588a4[_0xdeb9b6[_0x123d01]['MetricId']][_0xf9f5('0x73')]:_0xdeb9b6[_0x123d01][_0xf9f5('0x68')];_0x52532b=_0xdeb9b6[_0x123d01][_0xf9f5('0x75')]?_[_0xf9f5('0x74')](_0x21f0e8[_0xdeb9b6[_0x123d01][_0xf9f5('0x75')]],'%s',_0x52532b):_0x52532b;_0x52532b=_0xdeb9b6[_0x123d01]['format']?_['replace'](_0x884713[_0xdeb9b6[_0x123d01][_0xf9f5('0x80')]],'%s',_0x52532b):_0x52532b;if(_0xdeb9b6[_0x123d01][_0xf9f5('0x76')]){_0x9f6ef5[_0xf9f5('0x67')](_0x52532b);}_0xdeb9b6[_0x123d01][_0xf9f5('0x77')]&&_0x9f6ef5['order'](_0x52532b,_0xdeb9b6[_0x123d01][_0xf9f5('0x77')]===_0xf9f5('0x79')?![]:!![]);_0x9f6ef5[_0xf9f5('0x68')](_0x52532b,_0xdeb9b6[_0x123d01][_0xf9f5('0x7a')]||_0x52532b);}if(_0x4c845c[_0xf9f5('0x7b')]){_0x4c845c['joins']=JSON['parse'](_0x4c845c[_0xf9f5('0x7b')]);for(var _0xe7dc1d=0x0;_0xe7dc1d<_0x4c845c[_0xf9f5('0x7b')][_0xf9f5('0x36')];_0xe7dc1d+=0x1){if(_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d]['type']&&_[_0xf9f5('0x62')](_0x1dfd70,_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d][_0xf9f5('0x2e')])&&_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d]['parentKey']&&_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d][_0xf9f5('0x7e')]&&_0x4c845c['joins'][_0xe7dc1d][_0xf9f5('0x7f')]){_0x9f6ef5[_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d]['type']](_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d][_0xf9f5('0x7e')],null,util[_0xf9f5('0x80')](_0xf9f5('0x81'),_0x4c845c[_0xf9f5('0x71')],_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d][_0xf9f5('0x7d')],_0x4c845c[_0xf9f5('0x7b')][_0xe7dc1d][_0xf9f5('0x7e')],_0x4c845c['joins'][_0xe7dc1d][_0xf9f5('0x7f')]));}}}if(_0x4c845c['conditions']){_0x4c845c[_0xf9f5('0x82')]=JSON[_0xf9f5('0x7c')](_0x4c845c[_0xf9f5('0x82')]);_0x9f6ef5[_0xf9f5('0x3a')](_0x10f04f(_0x4c845c[_0xf9f5('0x82')][_0xf9f5('0x67')]));}_0x1e0039=_0x9f6ef5['clone']();_0x9f6ef5['limit'](_0x1292fb);_0x9f6ef5[_0xf9f5('0x1a')](0x0);return;}})[_0xf9f5('0x22')](function(){if(_0x3b6f20[_0xf9f5('0x8e')]===_0xf9f5('0x8f')){return null;}var _0x3f6550=_[_0xf9f5('0x3d')](_0x3b6f20,{'name':_0x3b6f20[_0xf9f5('0x90')]||_0x3b6f20[_0xf9f5('0x28')]||_0x4c845c[_0xf9f5('0x28')],'basename':_0x234d93,'savename':util[_0xf9f5('0x80')](_0xf9f5('0x91'),_0x3b6f20[_0xf9f5('0x28')]||_0x4c845c[_0xf9f5('0x28')],require(_0xf9f5('0x92'))[_0xf9f5('0x93')](0x4),_0x3b6f20[_0xf9f5('0x8e')]||'csv'),'reportId':_0x4c845c['id'],'reportType':'custom'});return db[_0xf9f5('0x94')][_0xf9f5('0x46')](_0x3f6550,{'raw':!![]});})[_0xf9f5('0x22')](function(_0x3d2570){if(_0x4c845c['table']===_0xf9f5('0x95')){_0x1e0039[_0xf9f5('0x3a')](_0x4c845c[_0xf9f5('0x71')]+_0xf9f5('0x96'),_0x3b6f20['startDate'],_0x3b6f20[_0xf9f5('0x97')]);}else{_0x1e0039[_0xf9f5('0x3a')](_0x4c845c[_0xf9f5('0x71')]+_0xf9f5('0x98'),_0x3b6f20[_0xf9f5('0x99')],_0x3b6f20[_0xf9f5('0x97')]);}if(_0x3d2570){logger[_0xf9f5('0x9a')]('Run\x20Query:',_0x1e0039[_0xf9f5('0x86')]());require(_0xf9f5('0x9b'))[_0xf9f5('0x9c')](path[_0xf9f5('0x89')](__dirname,_0xf9f5('0x9d'),_0x3d2570[_0xf9f5('0x8e')]),[_0x3d2570['id'],_0x1e0039[_0xf9f5('0x86')](),path[_0xf9f5('0x89')](__dirname,_0xf9f5('0x9e'),_0x3d2570[_0xf9f5('0x9f')]),_0x234d93]);return _0x3d2570;}else{var _0x226233=squel[_0xf9f5('0x70')]();_0x226233[_0xf9f5('0xa0')]('('+_0x1e0039['toString']()+')',_0xf9f5('0xa1'));_0x226233['field'](_0xf9f5('0xa2'),_0xf9f5('0x1c'));_0x1e0039[_0xf9f5('0x1d')](_0x3b6f20['limit']||_0x1292fb);_0x1e0039[_0xf9f5('0x1a')](_0x3b6f20[_0xf9f5('0x1a')]||0x0);return dbH[_0xf9f5('0x87')][_0xf9f5('0x30')](_0x226233['toString'](),{'type':dbH[_0xf9f5('0x87')][_0xf9f5('0xa3')][_0xf9f5('0x88')]})[_0xf9f5('0x22')](function(_0x3cf1a6){if(!_0x3cf1a6[_0xf9f5('0x36')]){_0x22a100=0x0;}else{_0x22a100=_0x3cf1a6[0x0][_0xf9f5('0x1c')]||0x0;}return dbH[_0xf9f5('0x87')][_0xf9f5('0x30')](_0x1e0039['toString'](),{'type':dbH['sequelize'][_0xf9f5('0xa3')][_0xf9f5('0x88')]});})[_0xf9f5('0x22')](function(_0x153b71){return{'rows':_0x153b71||[],'count':_0x22a100};});}});}exports[_0xf9f5('0xa4')]=function(_0x246723,_0x5b85f7){return runReport(_0x246723[_0xf9f5('0x51')],_0x246723[_0xf9f5('0x30')],_0x246723[_0xf9f5('0x3e')])['then'](respondWithResult(_0x5b85f7,null))[_0xf9f5('0x43')](handleError(_0x5b85f7,null));};exports[_0xf9f5('0xa5')]=runReport;exports[_0xf9f5('0x30')]=function(_0x27af32,_0x26aaa3){var _0x56091e=0xa;var _0x88ecc5=[_0xf9f5('0x89'),_0xf9f5('0x53'),_0xf9f5('0x54'),'cross_join'];var _0x52f9f2={'SUM':_0xf9f5('0x56'),'COUNT':_0xf9f5('0x57'),'COUNT DISTINCT':_0xf9f5('0x8a'),'MAX':_0xf9f5('0x58'),'MIN':_0xf9f5('0x59'),'AVG':_0xf9f5('0x8b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf9f5('0x5b'),'GROUP_CONCAT DESC':_0xf9f5('0x5c')};var _0x213e95={'SEC_TO_TIME':_0xf9f5('0x5d'),'DATE':_0xf9f5('0x5e'),'HOUR':_0xf9f5('0x5f'),'ROUND':_0xf9f5('0x60'),'UNIX_TIMESTAMP':_0xf9f5('0x61')};var _0x17ab81=function(_0x2bc00c){return!_[_0xf9f5('0x62')]([_0xf9f5('0x8c'),_0xf9f5('0x63'),_0xf9f5('0xa6'),_0xf9f5('0x64')],_0x2bc00c);};var _0x14a7a0=function(_0x37fc41){if(!_0x37fc41||!_0x37fc41[_0xf9f5('0x65')][_0xf9f5('0x36')]){return'';}for(var _0xb74ac8='(',_0x189fd9=0x0;_0x189fd9<_0x37fc41[_0xf9f5('0x65')][_0xf9f5('0x36')];_0x189fd9+=0x1){_0x189fd9>0x0&&(_0xb74ac8+='\x20'+_0x37fc41['operator']+'\x20');_0xb74ac8+=_0x37fc41[_0xf9f5('0x65')][_0x189fd9]['group']?_0x14a7a0(_0x37fc41['rules'][_0x189fd9][_0xf9f5('0x67')]):_0x37fc41['rules'][_0x189fd9][_0xf9f5('0x68')]+'\x20'+_0x37fc41[_0xf9f5('0x65')][_0x189fd9][_0xf9f5('0x69')]+(_0x17ab81(_0x37fc41[_0xf9f5('0x65')][_0x189fd9]['condition'])?'\x20'+_0x37fc41[_0xf9f5('0x65')][_0x189fd9][_0xf9f5('0x8d')]:'');}return _0xb74ac8+')';};var _0x263652={'where':{'id':_0x27af32[_0xf9f5('0x51')]['id']}},_0xa5be00,_0x45a11b,_0x38c066,_0x37aafb,_0x598b3f;_0x263652=_['merge']({},_0x263652,_0x27af32[_0xf9f5('0x3e')]);return db[_0xf9f5('0x2b')]['find'](_0x263652)[_0xf9f5('0x22')](function(_0x29d743){if(_0x29d743){_0xa5be00=_0x29d743;return _0x29d743[_0xf9f5('0x6a')]();}return null;})[_0xf9f5('0x22')](function(_0x3ca5c1){if(_0x3ca5c1){if(!_0x3ca5c1[_0xf9f5('0x36')]){throw new db[(_0xf9f5('0x6b'))][(_0xf9f5('0x6c'))](_0xf9f5('0x6d'),0x193);}_0x45a11b=_0x3ca5c1;return db[_0xf9f5('0x6e')][_0xf9f5('0x41')]({'raw':!![]});}return null;})['then'](function(_0x3f01ef){if(_0x3f01ef){_0x38c066=_[_0xf9f5('0x6f')](_0x3f01ef,'id');var _0x5a0d78;var _0x800759=squel[_0xf9f5('0x70')]();_0x800759[_0xf9f5('0xa0')](_0xa5be00[_0xf9f5('0x71')]);for(var _0x2a5ef3=0x0;_0x2a5ef3<_0x45a11b[_0xf9f5('0x36')];_0x2a5ef3+=0x1){_0x5a0d78=_0x45a11b[_0x2a5ef3][_0xf9f5('0x72')]?_0x38c066[_0x45a11b[_0x2a5ef3]['MetricId']]['metric']:_0x45a11b[_0x2a5ef3][_0xf9f5('0x68')];_0x5a0d78=_0x45a11b[_0x2a5ef3][_0xf9f5('0x75')]?_[_0xf9f5('0x74')](_0x52f9f2[_0x45a11b[_0x2a5ef3][_0xf9f5('0x75')]],'%s',_0x5a0d78):_0x5a0d78;_0x5a0d78=_0x45a11b[_0x2a5ef3][_0xf9f5('0x80')]?_[_0xf9f5('0x74')](_0x213e95[_0x45a11b[_0x2a5ef3]['format']],'%s',_0x5a0d78):_0x5a0d78;if(_0x45a11b[_0x2a5ef3][_0xf9f5('0x76')]){_0x800759[_0xf9f5('0x67')](_0x5a0d78);}_0x45a11b[_0x2a5ef3][_0xf9f5('0x77')]&&_0x800759['order'](_0x5a0d78,_0x45a11b[_0x2a5ef3]['orderBy']===_0xf9f5('0x79')?![]:!![]);_0x800759[_0xf9f5('0x68')](_0x5a0d78,_0x45a11b[_0x2a5ef3][_0xf9f5('0x7a')]||_0x5a0d78);}if(_0xa5be00['joins']){_0xa5be00[_0xf9f5('0x7b')]=JSON[_0xf9f5('0x7c')](_0xa5be00[_0xf9f5('0x7b')]);for(var _0x5f096e=0x0;_0x5f096e<_0xa5be00[_0xf9f5('0x7b')][_0xf9f5('0x36')];_0x5f096e+=0x1){if(_0xa5be00['joins'][_0x5f096e]['type']&&_[_0xf9f5('0x62')](_0x88ecc5,_0xa5be00[_0xf9f5('0x7b')][_0x5f096e][_0xf9f5('0x2e')])&&_0xa5be00[_0xf9f5('0x7b')][_0x5f096e][_0xf9f5('0x7d')]&&_0xa5be00[_0xf9f5('0x7b')][_0x5f096e]['foreignTable']&&_0xa5be00[_0xf9f5('0x7b')][_0x5f096e]['foreignKey']){_0x800759[_0xa5be00[_0xf9f5('0x7b')][_0x5f096e][_0xf9f5('0x2e')]](_0xa5be00[_0xf9f5('0x7b')][_0x5f096e][_0xf9f5('0x7e')],null,util['format'](_0xf9f5('0x81'),_0xa5be00['table'],_0xa5be00[_0xf9f5('0x7b')][_0x5f096e][_0xf9f5('0x7d')],_0xa5be00[_0xf9f5('0x7b')][_0x5f096e]['foreignTable'],_0xa5be00['joins'][_0x5f096e]['foreignKey']));}}}if(_0xa5be00[_0xf9f5('0x82')]){_0xa5be00[_0xf9f5('0x82')]=JSON['parse'](_0xa5be00[_0xf9f5('0x82')]);_0x800759[_0xf9f5('0x3a')](_0x14a7a0(_0xa5be00[_0xf9f5('0x82')][_0xf9f5('0x67')]));}_0x598b3f=_0x800759[_0xf9f5('0x83')]();_0x800759[_0xf9f5('0x1d')](_0x56091e);_0x800759[_0xf9f5('0x1a')](0x0);logger[_0xf9f5('0x84')](_0xf9f5('0x85'),_0x800759[_0xf9f5('0x86')]());return dbH['sequelize'][_0xf9f5('0x30')](_0x800759['toString'](),{'type':dbH[_0xf9f5('0x87')][_0xf9f5('0xa3')]['SELECT']});}})[_0xf9f5('0x22')](function(){return{'sql':_0x598b3f['toString']()};})[_0xf9f5('0x22')](respondWithResult(_0x26aaa3,null))['catch'](handleError(_0x26aaa3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 6f502ea..9c6ae21 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.model.js +++ b/server/api/analyticCustomReport/analyticCustomReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d05=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','AnalyticCustomReport'];(function(_0x590861,_0x42c7f3){var _0x1d0a80=function(_0x42d3de){while(--_0x42d3de){_0x590861['push'](_0x590861['shift']());}};_0x1d0a80(++_0x42c7f3);}(_0x0d05,0x171));var _0x50d0=function(_0x19fadd,_0x2757eb){_0x19fadd=_0x19fadd-0x0;var _0x247641=_0x0d05[_0x19fadd];return _0x247641;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x50d0('0x0'))(_0x50d0('0x1'));var moment=require('moment');var BPromise=require(_0x50d0('0x2'));var rp=require(_0x50d0('0x3'));var fs=require('fs');var path=require(_0x50d0('0x4'));var rimraf=require(_0x50d0('0x5'));var config=require(_0x50d0('0x6'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x132290,_0x1cf8c6){return _0x132290[_0x50d0('0x7')](_0x50d0('0x8'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x348e=['analytics_custom_reports','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2bdabd,_0x289ce8){var _0x7df2db=function(_0x34f1f0){while(--_0x34f1f0){_0x2bdabd['push'](_0x2bdabd['shift']());}};_0x7df2db(++_0x289ce8);}(_0x348e,0x155));var _0xe348=function(_0x223384,_0x503a80){_0x223384=_0x223384-0x0;var _0x1e7b63=_0x348e[_0x223384];return _0x1e7b63;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe348('0x0'))(_0xe348('0x1'));var moment=require(_0xe348('0x2'));var BPromise=require(_0xe348('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe348('0x4'));var rimraf=require(_0xe348('0x5'));var config=require(_0xe348('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xe348('0x7')]=function(_0xbd8e0e,_0x543a3c){return _0xbd8e0e[_0xe348('0x8')]('AnalyticCustomReport',attributes,{'tableName':_0xe348('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index a662501..485e980 100644 --- a/server/api/analyticCustomReport/analyticCustomReport.rpc.js +++ b/server/api/analyticCustomReport/analyticCustomReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb85=['http','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x64bb04,_0x5f4f72){var _0x21f87d=function(_0x4a0253){while(--_0x4a0253){_0x64bb04['push'](_0x64bb04['shift']());}};_0x21f87d(++_0x5f4f72);}(_0xcb85,0xe8));var _0x5cb8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcb85[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5cb8('0x0'));var util=require('util');var moment=require(_0x5cb8('0x1'));var BPromise=require(_0x5cb8('0x2'));var rs=require(_0x5cb8('0x3'));var fs=require('fs');var Redis=require(_0x5cb8('0x4'));var db=require(_0x5cb8('0x5'))['db'];var utils=require(_0x5cb8('0x6'));var logger=require(_0x5cb8('0x7'))(_0x5cb8('0x8'));var config=require('../../config/environment');var jayson=require(_0x5cb8('0x9'));var client=jayson['client'][_0x5cb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e4fec,_0x3cf8a6,_0x5e4b51){return new BPromise(function(_0x2a1ad3,_0x28829d){return client['request'](_0x4e4fec,_0x5e4b51)[_0x5cb8('0xb')](function(_0x12519a){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0x5cb8('0xc'));logger[_0x5cb8('0xd')](_0x5cb8('0xe'),_0x3cf8a6,_0x5cb8('0xc'),JSON['stringify'](_0x12519a));if(_0x12519a['error']){if(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x10')]===0x1f4){logger['error'](_0x5cb8('0x11'),_0x3cf8a6,_0x12519a[_0x5cb8('0xf')]['message']);return _0x28829d(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);}logger[_0x5cb8('0xf')](_0x5cb8('0x11'),_0x3cf8a6,_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);return _0x2a1ad3(_0x12519a[_0x5cb8('0xf')][_0x5cb8('0x12')]);}else{logger[_0x5cb8('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0x5cb8('0xc'));_0x2a1ad3(_0x12519a[_0x5cb8('0x14')][_0x5cb8('0x12')]);}})[_0x5cb8('0x15')](function(_0xc085b){logger[_0x5cb8('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3cf8a6,_0xc085b);_0x28829d(_0xc085b);});});} \ No newline at end of file +var _0x8116=['rpc','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x401b1c,_0x1f476d){var _0x33eb5d=function(_0x52ebcb){while(--_0x52ebcb){_0x401b1c['push'](_0x401b1c['shift']());}};_0x33eb5d(++_0x1f476d);}(_0x8116,0x9a));var _0x6811=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8116[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x6811('0x0'));var moment=require(_0x6811('0x1'));var BPromise=require('bluebird');var rs=require(_0x6811('0x2'));var fs=require('fs');var Redis=require(_0x6811('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6811('0x4'));var logger=require(_0x6811('0x5'))(_0x6811('0x6'));var config=require('../../config/environment');var jayson=require(_0x6811('0x7'));var client=jayson[_0x6811('0x8')][_0x6811('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28d7e1,_0x249587,_0x492b7d){return new BPromise(function(_0xf06283,_0x5eda31){return client['request'](_0x28d7e1,_0x492b7d)['then'](function(_0x2a15c9){logger[_0x6811('0xa')](_0x6811('0xb'),_0x249587,_0x6811('0xc'));logger['debug'](_0x6811('0xd'),_0x249587,_0x6811('0xc'),JSON[_0x6811('0xe')](_0x2a15c9));if(_0x2a15c9[_0x6811('0xf')]){if(_0x2a15c9[_0x6811('0xf')][_0x6811('0x10')]===0x1f4){logger[_0x6811('0xf')](_0x6811('0xb'),_0x249587,_0x2a15c9[_0x6811('0xf')][_0x6811('0x11')]);return _0x5eda31(_0x2a15c9[_0x6811('0xf')][_0x6811('0x11')]);}logger['error'](_0x6811('0xb'),_0x249587,_0x2a15c9['error'][_0x6811('0x11')]);return _0xf06283(_0x2a15c9[_0x6811('0xf')]['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x249587,'request\x20sent');_0xf06283(_0x2a15c9[_0x6811('0x12')][_0x6811('0x11')]);}})[_0x6811('0x13')](function(_0x43972e){logger[_0x6811('0xf')](_0x6811('0xb'),_0x249587,_0x43972e);_0x5eda31(_0x43972e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3460774..e3fe095 100644 --- a/server/api/analyticCustomReport/index.js +++ b/server/api/analyticCustomReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33f1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','/:id/run','run','/:id/query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0x33f1,0x126));var _0x133f=function(_0x3cc05d,_0x4b8f88){_0x3cc05d=_0x3cc05d-0x0;var _0x28b736=_0x33f1[_0x3cc05d];return _0x28b736;};'use strict';var multer=require(_0x133f('0x0'));var util=require(_0x133f('0x1'));var path=require(_0x133f('0x2'));var timeout=require(_0x133f('0x3'));var express=require(_0x133f('0x4'));var router=express[_0x133f('0x5')]();var fs_extra=require(_0x133f('0x6'));var auth=require(_0x133f('0x7'));var interaction=require(_0x133f('0x8'));var config=require(_0x133f('0x9'));var controller=require(_0x133f('0xa'));router[_0x133f('0xb')]('/',auth[_0x133f('0xc')](),controller[_0x133f('0xd')]);router[_0x133f('0xb')]('/:id',auth[_0x133f('0xc')](),controller[_0x133f('0xe')]);router[_0x133f('0xb')]('/:id/preview',auth[_0x133f('0xc')](),controller[_0x133f('0xf')]);router['get'](_0x133f('0x10'),auth['isAuthenticated'](),controller[_0x133f('0x11')]);router[_0x133f('0xb')](_0x133f('0x12'),auth['isAuthenticated'](),controller['query']);router[_0x133f('0x13')]('/',auth[_0x133f('0xc')](),controller[_0x133f('0x14')]);router[_0x133f('0x15')](_0x133f('0x16'),auth[_0x133f('0xc')](),controller[_0x133f('0x17')]);router[_0x133f('0x18')](_0x133f('0x16'),auth['isAuthenticated'](),controller[_0x133f('0x19')]);module[_0x133f('0x1a')]=router; \ No newline at end of file +var _0x7636=['put','update','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','isAuthenticated','show','run','/:id/query','query','post','create'];(function(_0x3fc39f,_0x1f5e95){var _0x5b81e1=function(_0x162b3c){while(--_0x162b3c){_0x3fc39f['push'](_0x3fc39f['shift']());}};_0x5b81e1(++_0x1f5e95);}(_0x7636,0xc1));var _0x6763=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x7636[_0x38b2d9];return _0x23a3e1;};'use strict';var multer=require('multer');var util=require(_0x6763('0x0'));var path=require(_0x6763('0x1'));var timeout=require('connect-timeout');var express=require(_0x6763('0x2'));var router=express['Router']();var fs_extra=require(_0x6763('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6763('0x4'));var config=require(_0x6763('0x5'));var controller=require(_0x6763('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6763('0x7')]);router[_0x6763('0x8')](_0x6763('0x9'),auth[_0x6763('0xa')](),controller[_0x6763('0xb')]);router['get']('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x6763('0x8')]('/:id/run',auth[_0x6763('0xa')](),controller[_0x6763('0xc')]);router[_0x6763('0x8')](_0x6763('0xd'),auth[_0x6763('0xa')](),controller[_0x6763('0xe')]);router[_0x6763('0xf')]('/',auth[_0x6763('0xa')](),controller[_0x6763('0x10')]);router[_0x6763('0x11')](_0x6763('0x9'),auth[_0x6763('0xa')](),controller[_0x6763('0x12')]);router['delete'](_0x6763('0x9'),auth[_0x6763('0xa')](),controller[_0x6763('0x13')]);module[_0x6763('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f3b23bb..8808370 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8a=['TEXT','sequelize','exports','STRING'];(function(_0x39cd16,_0x5dfe1c){var _0xa7b510=function(_0x3714c6){while(--_0x3714c6){_0x39cd16['push'](_0x39cd16['shift']());}};_0xa7b510(++_0x5dfe1c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3d90f1,_0xf25e08){_0x3d90f1=_0x3d90f1-0x0;var _0x3af913=_0x3f8a[_0x3d90f1];return _0x3af913;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa3f8('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xa3f8('0x2')]},'conditions':{'type':Sequelize[_0xa3f8('0x3')]},'joins':{'type':Sequelize[_0xa3f8('0x3')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x4f357e,_0x2b324a){var _0x1cf1e7=function(_0x1f34a1){while(--_0x1f34a1){_0x4f357e['push'](_0x4f357e['shift']());}};_0x1cf1e7(++_0x2b324a);}(_0x31f0,0xb7));var _0x031f=function(_0x2bb529,_0x305635){_0x2bb529=_0x2bb529-0x0;var _0x4e3f62=_0x31f0[_0x2bb529];return _0x4e3f62;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6c0f75c..85e7ecc 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['keyBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x55131f,_0x4ea454){_0x55131f=_0x55131f-0x0;var _0x136eb0=_0xc6ac[_0x55131f];return _0x136eb0;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x326f,0xd1));var _0xf326=function(_0x1d5cd6,_0x2badbc){_0x1d5cd6=_0x1d5cd6-0x0;var _0x314837=_0x326f[_0x1d5cd6];return _0x314837;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 25a374a..26bb60b 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.model.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f27=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xe1269d,_0x57b7c3){var _0x261ca1=function(_0x13b234){while(--_0x13b234){_0xe1269d['push'](_0xe1269d['shift']());}};_0x261ca1(++_0x57b7c3);}(_0x5f27,0xad));var _0x75f2=function(_0x2610db,_0x1ff983){_0x2610db=_0x2610db-0x0;var _0x5dd7bb=_0x5f27[_0x2610db];return _0x5dd7bb;};'use strict';var _=require(_0x75f2('0x0'));var util=require(_0x75f2('0x1'));var logger=require(_0x75f2('0x2'))(_0x75f2('0x3'));var moment=require(_0x75f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x75f2('0x5'));var fs=require('fs');var path=require(_0x75f2('0x6'));var rimraf=require(_0x75f2('0x7'));var config=require(_0x75f2('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x75f2('0x9')]=function(_0x3c48a5,_0xecde1c){return _0x3c48a5[_0x75f2('0xa')](_0x75f2('0xb'),attributes,{'tableName':_0x75f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x210a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger'];(function(_0x4e96a4,_0x207e09){var _0x1beafa=function(_0x511265){while(--_0x511265){_0x4e96a4['push'](_0x4e96a4['shift']());}};_0x1beafa(++_0x207e09);}(_0x210a,0x73));var _0xa210=function(_0x1c92f0,_0x23fc36){_0x1c92f0=_0x1c92f0-0x0;var _0x5ac77c=_0x210a[_0x1c92f0];return _0x5ac77c;};'use strict';var _=require('lodash');var util=require(_0xa210('0x0'));var logger=require(_0xa210('0x1'))(_0xa210('0x2'));var moment=require(_0xa210('0x3'));var BPromise=require(_0xa210('0x4'));var rp=require(_0xa210('0x5'));var fs=require('fs');var path=require(_0xa210('0x6'));var rimraf=require(_0xa210('0x7'));var config=require(_0xa210('0x8'));var attributes=require(_0xa210('0x9'));module['exports']=function(_0x193998,_0x210419){return _0x193998[_0xa210('0xa')](_0xa210('0xb'),attributes,{'tableName':_0xa210('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4216eae..673c310 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9438=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9438,0x112));var _0x8943=function(_0x574f89,_0x1d75f4){_0x574f89=_0x574f89-0x0;var _0x35aaf3=_0x9438[_0x574f89];return _0x35aaf3;};'use strict';var _=require(_0x8943('0x0'));var util=require('util');var moment=require(_0x8943('0x1'));var BPromise=require(_0x8943('0x2'));var rs=require(_0x8943('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8943('0x4'))['db'];var utils=require(_0x8943('0x5'));var logger=require(_0x8943('0x6'))(_0x8943('0x7'));var config=require(_0x8943('0x8'));var jayson=require(_0x8943('0x9'));var client=jayson[_0x8943('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x343639,_0x42e5b1,_0x1b12d3){return new BPromise(function(_0x295606,_0x338b5b){return client['request'](_0x343639,_0x1b12d3)[_0x8943('0xb')](function(_0x52837d){logger['info'](_0x8943('0xc'),_0x42e5b1,_0x8943('0xd'));logger[_0x8943('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x42e5b1,_0x8943('0xd'),JSON['stringify'](_0x52837d));if(_0x52837d[_0x8943('0xf')]){if(_0x52837d[_0x8943('0xf')][_0x8943('0x10')]===0x1f4){logger[_0x8943('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x42e5b1,_0x52837d[_0x8943('0xf')][_0x8943('0x11')]);return _0x338b5b(_0x52837d['error'][_0x8943('0x11')]);}logger[_0x8943('0xf')](_0x8943('0xc'),_0x42e5b1,_0x52837d[_0x8943('0xf')]['message']);return _0x295606(_0x52837d['error'][_0x8943('0x11')]);}else{logger[_0x8943('0x12')](_0x8943('0xc'),_0x42e5b1,_0x8943('0xd'));_0x295606(_0x52837d[_0x8943('0x13')][_0x8943('0x11')]);}})[_0x8943('0x14')](function(_0x17d42c){logger[_0x8943('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x42e5b1,_0x17d42c);_0x338b5b(_0x17d42c);});});} \ No newline at end of file +var _0x07e7=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x45ce22,_0x4dc507){var _0x6e091d=function(_0x3ded5c){while(--_0x3ded5c){_0x45ce22['push'](_0x45ce22['shift']());}};_0x6e091d(++_0x4dc507);}(_0x07e7,0x1f4));var _0x707e=function(_0x59ac80,_0x40b71f){_0x59ac80=_0x59ac80-0x0;var _0x31a5bd=_0x07e7[_0x59ac80];return _0x31a5bd;};'use strict';var _=require(_0x707e('0x0'));var util=require(_0x707e('0x1'));var moment=require(_0x707e('0x2'));var BPromise=require(_0x707e('0x3'));var rs=require(_0x707e('0x4'));var fs=require('fs');var Redis=require(_0x707e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x707e('0x6'));var logger=require(_0x707e('0x7'))(_0x707e('0x8'));var config=require('../../config/environment');var jayson=require(_0x707e('0x9'));var client=jayson['client'][_0x707e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564f2e,_0x24eb7b,_0x3397d7){return new BPromise(function(_0x48a693,_0x4cb17b){return client[_0x707e('0xb')](_0x564f2e,_0x3397d7)['then'](function(_0x1b36a4){logger[_0x707e('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x24eb7b,_0x707e('0xd'));logger[_0x707e('0xe')](_0x707e('0xf'),_0x24eb7b,_0x707e('0xd'),JSON[_0x707e('0x10')](_0x1b36a4));if(_0x1b36a4[_0x707e('0x11')]){if(_0x1b36a4[_0x707e('0x11')]['code']===0x1f4){logger[_0x707e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x24eb7b,_0x1b36a4[_0x707e('0x11')]['message']);return _0x4cb17b(_0x1b36a4['error'][_0x707e('0x12')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x24eb7b,_0x1b36a4[_0x707e('0x11')][_0x707e('0x12')]);return _0x48a693(_0x1b36a4[_0x707e('0x11')][_0x707e('0x12')]);}else{logger[_0x707e('0xc')](_0x707e('0x13'),_0x24eb7b,_0x707e('0xd'));_0x48a693(_0x1b36a4['result'][_0x707e('0x12')]);}})['catch'](function(_0x5e6924){logger['error'](_0x707e('0x13'),_0x24eb7b,_0x5e6924);_0x4cb17b(_0x5e6924);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index be9f761..a4c666b 100644 --- a/server/api/analyticDefaultReport/index.js +++ b/server/api/analyticDefaultReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2630=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','delete','destroy','exports','multer','util','path','Router'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x2630,0x79));var _0x0263=function(_0x2e8373,_0x49c02c){_0x2e8373=_0x2e8373-0x0;var _0x3cafdb=_0x2630[_0x2e8373];return _0x3cafdb;};'use strict';var multer=require(_0x0263('0x0'));var util=require(_0x0263('0x1'));var path=require(_0x0263('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0263('0x3')]();var fs_extra=require(_0x0263('0x4'));var auth=require(_0x0263('0x5'));var interaction=require(_0x0263('0x6'));var config=require(_0x0263('0x7'));var controller=require(_0x0263('0x8'));router['get']('/',auth[_0x0263('0x9')](),controller[_0x0263('0xa')]);router['get'](_0x0263('0xb'),auth[_0x0263('0x9')](),controller[_0x0263('0xc')]);router[_0x0263('0xd')](_0x0263('0xe'),auth['isAuthenticated'](),controller[_0x0263('0xf')]);router[_0x0263('0xd')](_0x0263('0x10'),auth[_0x0263('0x9')](),controller[_0x0263('0x11')]);router['get'](_0x0263('0x12'),auth['isAuthenticated'](),controller[_0x0263('0x13')]);router[_0x0263('0x14')]('/',auth[_0x0263('0x9')](),controller['create']);router[_0x0263('0x15')]('/:id',auth[_0x0263('0x9')](),controller['update']);router[_0x0263('0x16')](_0x0263('0xb'),auth[_0x0263('0x9')](),controller[_0x0263('0x17')]);module[_0x0263('0x18')]=router; \ No newline at end of file +var _0x2e09=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','post','delete','exports'];(function(_0x4c4e59,_0x247120){var _0x191ccd=function(_0x50443d){while(--_0x50443d){_0x4c4e59['push'](_0x4c4e59['shift']());}};_0x191ccd(++_0x247120);}(_0x2e09,0xc8));var _0x92e0=function(_0x1a70eb,_0xf0bd8a){_0x1a70eb=_0x1a70eb-0x0;var _0x40b0d4=_0x2e09[_0x1a70eb];return _0x40b0d4;};'use strict';var multer=require(_0x92e0('0x0'));var util=require(_0x92e0('0x1'));var path=require(_0x92e0('0x2'));var timeout=require(_0x92e0('0x3'));var express=require(_0x92e0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x92e0('0x5'));var interaction=require(_0x92e0('0x6'));var config=require(_0x92e0('0x7'));var controller=require(_0x92e0('0x8'));router[_0x92e0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x92e0('0x9')](_0x92e0('0xa'),auth[_0x92e0('0xb')](),controller['show']);router['get'](_0x92e0('0xc'),auth[_0x92e0('0xb')](),controller[_0x92e0('0xd')]);router['get'](_0x92e0('0xe'),auth[_0x92e0('0xb')](),controller[_0x92e0('0xf')]);router[_0x92e0('0x9')](_0x92e0('0x10'),auth[_0x92e0('0xb')](),controller['query']);router[_0x92e0('0x11')]('/',auth[_0x92e0('0xb')](),controller['create']);router['put'](_0x92e0('0xa'),auth[_0x92e0('0xb')](),controller['update']);router[_0x92e0('0x12')](_0x92e0('0xa'),auth[_0x92e0('0xb')](),controller['destroy']);module[_0x92e0('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 7353dff..ad1a8d7 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6115=['DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','STRING','ENUM','pdf','xlsx','csv'];(function(_0x1cfba6,_0x35adc8){var _0x4697d3=function(_0x34cacb){while(--_0x34cacb){_0x1cfba6['push'](_0x1cfba6['shift']());}};_0x4697d3(++_0x35adc8);}(_0x6115,0xad));var _0x5611=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6115[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5611('0x0'));var moment=require(_0x5611('0x1'));module['exports']={'name':{'type':Sequelize[_0x5611('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x5611('0x3')]('csv',_0x5611('0x4'),_0x5611('0x5')),'allowNull':![],'defaultValue':_0x5611('0x6')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x5611('0x7')]},'status':{'type':Sequelize[_0x5611('0x2')],'defaultValue':_0x5611('0x8')},'type':{'type':Sequelize[_0x5611('0x3')](_0x5611('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x5611('0x9')},'reportId':{'type':Sequelize[_0x5611('0xa')](0xb)[_0x5611('0xb')]},'reportType':{'type':Sequelize[_0x5611('0x2')]}}; \ No newline at end of file +var _0xaa47=['moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize'];(function(_0x3d2fe5,_0x2f9c71){var _0x48de9d=function(_0x229709){while(--_0x229709){_0x3d2fe5['push'](_0x3d2fe5['shift']());}};_0x48de9d(++_0x2f9c71);}(_0xaa47,0x1c6));var _0x7aa4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaa47[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x7aa4('0x0'));var moment=require(_0x7aa4('0x1'));module[_0x7aa4('0x2')]={'name':{'type':Sequelize[_0x7aa4('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x7aa4('0x4')](_0x7aa4('0x5'),_0x7aa4('0x6'),_0x7aa4('0x7')),'allowNull':![],'defaultValue':_0x7aa4('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x7aa4('0x8')]},'endDate':{'type':Sequelize[_0x7aa4('0x8')]},'status':{'type':Sequelize[_0x7aa4('0x3')],'defaultValue':_0x7aa4('0x9')},'type':{'type':Sequelize[_0x7aa4('0x4')](_0x7aa4('0xa'),_0x7aa4('0xb')),'allowNull':![],'defaultValue':_0x7aa4('0xa')},'reportId':{'type':Sequelize[_0x7aa4('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x7aa4('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index deb245b..84d387b 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab61=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','output','toLowerCase','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body'];(function(_0x38cd76,_0x4f59c1){var _0x98b362=function(_0x8b6c4){while(--_0x8b6c4){_0x38cd76['push'](_0x38cd76['shift']());}};_0x98b362(++_0x4f59c1);}(_0xab61,0xd4));var _0x1ab6=function(_0x1f9115,_0x33a742){_0x1f9115=_0x1f9115-0x0;var _0x533c79=_0xab61[_0x1f9115];return _0x533c79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ab6('0x0'));var zipdir=require(_0x1ab6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ab6('0x2'));var moment=require(_0x1ab6('0x3'));var BPromise=require(_0x1ab6('0x4'));var Mustache=require(_0x1ab6('0x5'));var util=require(_0x1ab6('0x6'));var path=require('path');var sox=require(_0x1ab6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ab6('0x8'));var squel=require(_0x1ab6('0x9'));var crypto=require(_0x1ab6('0xa'));var jsforce=require(_0x1ab6('0xb'));var deskjs=require(_0x1ab6('0xc'));var toCsv=require(_0x1ab6('0xd'));var querystring=require(_0x1ab6('0xe'));var Papa=require('papaparse');var Redis=require(_0x1ab6('0xf'));var authService=require(_0x1ab6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1ab6('0x11'));var hardwareService=require(_0x1ab6('0x12'));var logger=require(_0x1ab6('0x13'))(_0x1ab6('0x14'));var utils=require(_0x1ab6('0x15'));var config=require(_0x1ab6('0x16'));var licenseUtil=require(_0x1ab6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5d9eb,_0x30640a){_0x30640a=_0x30640a||0xcc;return function(_0x19ec09){if(_0x19ec09){return _0xe5d9eb[_0x1ab6('0x18')](_0x30640a);}return _0xe5d9eb[_0x1ab6('0x19')](_0x30640a)[_0x1ab6('0x1a')]();};}function respondWithResult(_0x28dd94,_0x100598){_0x100598=_0x100598||0xc8;return function(_0x374e59){if(_0x374e59){return _0x28dd94[_0x1ab6('0x19')](_0x100598)[_0x1ab6('0x1b')](_0x374e59);}};}function respondWithFilteredResult(_0x113d2b,_0x5d71e7){return function(_0x50df0a){if(_0x50df0a){var _0x455828=typeof _0x5d71e7[_0x1ab6('0x1c')]===_0x1ab6('0x1d')&&typeof _0x5d71e7[_0x1ab6('0x1e')]===_0x1ab6('0x1d');var _0x41128b=_0x50df0a[_0x1ab6('0x1f')];var _0x4b5919=_0x455828?0x0:_0x5d71e7[_0x1ab6('0x1c')];var _0x4434ad=_0x455828?_0x50df0a['count']:_0x5d71e7[_0x1ab6('0x1c')]+_0x5d71e7[_0x1ab6('0x1e')];var _0x3d0acc;if(_0x4434ad>=_0x41128b){_0x4434ad=_0x41128b;_0x3d0acc=0xc8;}else{_0x3d0acc=0xce;}_0x113d2b[_0x1ab6('0x19')](_0x3d0acc);return _0x113d2b['set'](_0x1ab6('0x20'),_0x4b5919+'-'+_0x4434ad+'/'+_0x41128b)[_0x1ab6('0x1b')](_0x50df0a);}return null;};}function patchUpdates(_0x5882c5){return function(_0x406937){try{jsonpatch[_0x1ab6('0x21')](_0x406937,_0x5882c5,!![]);}catch(_0x574b6d){return BPromise['reject'](_0x574b6d);}return _0x406937['save']();};}function saveUpdates(_0x42a34d,_0x1a4ade){return function(_0x5d31a3){if(_0x5d31a3){return _0x5d31a3[_0x1ab6('0x22')](_0x42a34d)['then'](function(_0x196b0f){return _0x196b0f;});}return null;};}function removeEntity(_0x545fa7,_0x5ce42d){return function(_0x2f4b64){if(_0x2f4b64){return _0x2f4b64[_0x1ab6('0x23')]()[_0x1ab6('0x24')](function(){var _0x40c240=_0x2f4b64[_0x1ab6('0x25')]({'plain':!![]});var _0x57e2e3='ExtractedReports';return db[_0x1ab6('0x26')][_0x1ab6('0x23')]({'where':{'type':_0x57e2e3,'resourceId':_0x40c240['id']}})[_0x1ab6('0x24')](function(){return _0x2f4b64;});})[_0x1ab6('0x24')](function(){_0x545fa7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6c4a,_0x91a475){return function(_0x311b24){if(!_0x311b24){_0x2e6c4a[_0x1ab6('0x18')](0x194);}return _0x311b24;};}function handleError(_0x9b1b2,_0x586119){_0x586119=_0x586119||0x1f4;return function(_0x545e79){logger[_0x1ab6('0x27')](_0x545e79[_0x1ab6('0x28')]);if(_0x545e79[_0x1ab6('0x29')]){delete _0x545e79[_0x1ab6('0x29')];}_0x9b1b2[_0x1ab6('0x19')](_0x586119)[_0x1ab6('0x2a')](_0x545e79);};}exports[_0x1ab6('0x2b')]=function(_0x4f2b1d,_0x150b35){var _0x11608b={},_0x578099={},_0x3819f9={'count':0x0,'rows':[]};var _0xc0d2bb=_[_0x1ab6('0x2c')](db[_0x1ab6('0x2d')][_0x1ab6('0x2e')],function(_0x55eb38){return{'name':_0x55eb38[_0x1ab6('0x2f')],'type':_0x55eb38[_0x1ab6('0x30')][_0x1ab6('0x31')]};});_0x578099[_0x1ab6('0x32')]=_[_0x1ab6('0x2c')](_0xc0d2bb,_0x1ab6('0x29'));_0x578099[_0x1ab6('0x33')]=_['keys'](_0x4f2b1d[_0x1ab6('0x33')]);_0x578099[_0x1ab6('0x34')]=_[_0x1ab6('0x35')](_0x578099[_0x1ab6('0x32')],_0x578099[_0x1ab6('0x33')]);_0x11608b[_0x1ab6('0x36')]=_['intersection'](_0x578099[_0x1ab6('0x32')],qs[_0x1ab6('0x37')](_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x37')]));_0x11608b[_0x1ab6('0x36')]=_0x11608b[_0x1ab6('0x36')][_0x1ab6('0x38')]?_0x11608b['attributes']:_0x578099[_0x1ab6('0x32')];if(!_0x4f2b1d['query']['hasOwnProperty']('nolimit')){_0x11608b[_0x1ab6('0x1e')]=qs[_0x1ab6('0x1e')](_0x4f2b1d[_0x1ab6('0x33')]['limit']);_0x11608b[_0x1ab6('0x1c')]=qs['offset'](_0x4f2b1d['query'][_0x1ab6('0x1c')]);}_0x11608b[_0x1ab6('0x39')]=qs['sort'](_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x3a')]);_0x11608b[_0x1ab6('0x3b')]=qs[_0x1ab6('0x34')](_[_0x1ab6('0x3c')](_0x4f2b1d['query'],_0x578099[_0x1ab6('0x34')]),_0xc0d2bb);if(_0x4f2b1d[_0x1ab6('0x33')]['filter']){_0x11608b[_0x1ab6('0x3b')]=_['merge'](_0x11608b['where'],{'$or':_[_0x1ab6('0x2c')](_0xc0d2bb,function(_0x56ce50){if(_0x56ce50[_0x1ab6('0x30')]!==_0x1ab6('0x3d')){var _0x4f7f9f={};_0x4f7f9f[_0x56ce50[_0x1ab6('0x29')]]={'$like':'%'+_0x4f2b1d[_0x1ab6('0x33')]['filter']+'%'};return _0x4f7f9f;}})});}_0x11608b=_['merge']({},_0x11608b,_0x4f2b1d[_0x1ab6('0x3e')]);var _0x59bfb3={'where':_0x11608b['where']};return db[_0x1ab6('0x2d')]['count'](_0x59bfb3)[_0x1ab6('0x24')](function(_0x32afec){_0x3819f9[_0x1ab6('0x1f')]=_0x32afec;if(_0x4f2b1d[_0x1ab6('0x33')][_0x1ab6('0x3f')]){_0x11608b[_0x1ab6('0x40')]=[{'all':!![]}];}return db[_0x1ab6('0x2d')][_0x1ab6('0x41')](_0x11608b);})[_0x1ab6('0x24')](function(_0x529d8d){_0x3819f9[_0x1ab6('0x42')]=_0x529d8d;return _0x3819f9;})[_0x1ab6('0x24')](respondWithFilteredResult(_0x150b35,_0x11608b))[_0x1ab6('0x43')](handleError(_0x150b35,null));};exports[_0x1ab6('0x44')]=function(_0x58fff1,_0x2c8726){var _0x29181f={'raw':!![],'where':{'id':_0x58fff1['params']['id']}},_0x182043={};_0x182043[_0x1ab6('0x32')]=_[_0x1ab6('0x45')](db[_0x1ab6('0x2d')][_0x1ab6('0x2e')]);_0x182043[_0x1ab6('0x33')]=_[_0x1ab6('0x45')](_0x58fff1[_0x1ab6('0x33')]);_0x182043[_0x1ab6('0x34')]=_['intersection'](_0x182043[_0x1ab6('0x32')],_0x182043[_0x1ab6('0x33')]);_0x29181f['attributes']=_[_0x1ab6('0x35')](_0x182043[_0x1ab6('0x32')],qs[_0x1ab6('0x37')](_0x58fff1[_0x1ab6('0x33')][_0x1ab6('0x37')]));_0x29181f[_0x1ab6('0x36')]=_0x29181f[_0x1ab6('0x36')][_0x1ab6('0x38')]?_0x29181f['attributes']:_0x182043[_0x1ab6('0x32')];if(_0x58fff1['query'][_0x1ab6('0x3f')]){_0x29181f[_0x1ab6('0x40')]=[{'all':!![]}];}_0x29181f=_['merge']({},_0x29181f,_0x58fff1[_0x1ab6('0x3e')]);return db[_0x1ab6('0x2d')][_0x1ab6('0x46')](_0x29181f)[_0x1ab6('0x24')](handleEntityNotFound(_0x2c8726,null))['then'](respondWithResult(_0x2c8726,null))['catch'](handleError(_0x2c8726,null));};exports[_0x1ab6('0x47')]=function(_0x2c759f,_0x1cd0ec){return db[_0x1ab6('0x2d')][_0x1ab6('0x47')](_0x2c759f[_0x1ab6('0x48')],{})['then'](function(_0x310ee0){var _0x289de8=_0x2c759f['user']['get']({'plain':!![]});if(!_0x289de8)throw new Error(_0x1ab6('0x49'));if(_0x289de8[_0x1ab6('0x4a')]===_0x1ab6('0x4b')){var _0x72bab2=_0x310ee0['get']({'plain':!![]});var _0x1c219=_0x1ab6('0x4c');return db[_0x1ab6('0x4d')][_0x1ab6('0x46')]({'where':{'name':_0x1c219,'userProfileId':_0x289de8[_0x1ab6('0x4e')]},'raw':!![]})[_0x1ab6('0x24')](function(_0x1cee03){if(_0x1cee03&&_0x1cee03[_0x1ab6('0x4f')]===0x0){return db[_0x1ab6('0x26')][_0x1ab6('0x47')]({'name':_0x72bab2[_0x1ab6('0x29')],'resourceId':_0x72bab2['id'],'type':_0x1cee03[_0x1ab6('0x29')],'sectionId':_0x1cee03['id']},{})[_0x1ab6('0x24')](function(){return _0x310ee0;});}else{return _0x310ee0;}})[_0x1ab6('0x43')](function(_0x4850ff){logger[_0x1ab6('0x27')](_0x1ab6('0x50'),_0x4850ff);throw _0x4850ff;});}return _0x310ee0;})[_0x1ab6('0x24')](respondWithResult(_0x1cd0ec,0xc9))[_0x1ab6('0x43')](handleError(_0x1cd0ec,null));};exports[_0x1ab6('0x22')]=function(_0x323327,_0x595c3a){if(_0x323327[_0x1ab6('0x48')]['id']){delete _0x323327['body']['id'];}return db[_0x1ab6('0x2d')][_0x1ab6('0x46')]({'where':{'id':_0x323327[_0x1ab6('0x51')]['id']}})[_0x1ab6('0x24')](handleEntityNotFound(_0x595c3a,null))[_0x1ab6('0x24')](saveUpdates(_0x323327[_0x1ab6('0x48')],null))[_0x1ab6('0x24')](respondWithResult(_0x595c3a,null))[_0x1ab6('0x43')](handleError(_0x595c3a,null));};exports[_0x1ab6('0x23')]=function(_0x45a233,_0x73216){return db['AnalyticExtractedReport'][_0x1ab6('0x46')]({'where':{'id':_0x45a233['params']['id']}})['then'](handleEntityNotFound(_0x73216,null))[_0x1ab6('0x24')](removeEntity(_0x73216,null))['catch'](handleError(_0x73216,null));};exports[_0x1ab6('0x52')]=function(_0x6fc596,_0x4e8228,_0x299db3){return db[_0x1ab6('0x2d')][_0x1ab6('0x46')]({'where':{'id':_0x6fc596[_0x1ab6('0x51')]['id']},'attributes':[_0x1ab6('0x29'),_0x1ab6('0x53'),_0x1ab6('0x54'),'output'],'raw':!![]})[_0x1ab6('0x24')](handleEntityNotFound(_0x4e8228,null))[_0x1ab6('0x24')](function(_0x37f9b9){if(_0x37f9b9){if(!fs[_0x1ab6('0x55')](path['join'](config[_0x1ab6('0x56')],_0x1ab6('0x57'),_0x37f9b9[_0x1ab6('0x54')]))){throw new db[(_0x1ab6('0x58'))][(_0x1ab6('0x59'))](_0x1ab6('0x5a'));}if(_0x6fc596[_0x1ab6('0x33')][_0x1ab6('0x5b')]){return _0x4e8228[_0x1ab6('0x18')](0xc8);}return _0x4e8228[_0x1ab6('0x52')](path['join'](config[_0x1ab6('0x56')],'server/files/reports',_0x37f9b9['savename']),util[_0x1ab6('0x5c')]('%s.%s',_0x37f9b9['basename']||_0x37f9b9[_0x1ab6('0x29')],_0x37f9b9[_0x1ab6('0x5d')][_0x1ab6('0x5e')]()));}})['catch'](handleError(_0x4e8228,null));}; \ No newline at end of file +var _0xc039=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x33d7f1,_0xc66c41){var _0x5d32c4=function(_0x3792c7){while(--_0x3792c7){_0x33d7f1['push'](_0x33d7f1['shift']());}};_0x5d32c4(++_0xc66c41);}(_0xc039,0xb1));var _0x9c03=function(_0x5da2d1,_0x635d1f){_0x5da2d1=_0x5da2d1-0x0;var _0x44b824=_0xc039[_0x5da2d1];return _0x44b824;};'use strict';var emlformat=require(_0x9c03('0x0'));var rimraf=require(_0x9c03('0x1'));var zipdir=require(_0x9c03('0x2'));var jsonpatch=require(_0x9c03('0x3'));var rp=require(_0x9c03('0x4'));var moment=require(_0x9c03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9c03('0x6'));var util=require(_0x9c03('0x7'));var path=require(_0x9c03('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9c03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c03('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9c03('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c03('0xc'));var Redis=require(_0x9c03('0xd'));var authService=require(_0x9c03('0xe'));var qs=require(_0x9c03('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c03('0x10'));var logger=require(_0x9c03('0x11'))(_0x9c03('0x12'));var utils=require(_0x9c03('0x13'));var config=require(_0x9c03('0x14'));var licenseUtil=require(_0x9c03('0x15'));var db=require(_0x9c03('0x16'))['db'];function respondWithStatusCode(_0x387ac2,_0x10707b){_0x10707b=_0x10707b||0xcc;return function(_0x14b364){if(_0x14b364){return _0x387ac2[_0x9c03('0x17')](_0x10707b);}return _0x387ac2[_0x9c03('0x18')](_0x10707b)[_0x9c03('0x19')]();};}function respondWithResult(_0x25ae0c,_0x5f129c){_0x5f129c=_0x5f129c||0xc8;return function(_0x806f17){if(_0x806f17){return _0x25ae0c[_0x9c03('0x18')](_0x5f129c)['json'](_0x806f17);}};}function respondWithFilteredResult(_0x3286f7,_0x260b1d){return function(_0x590905){if(_0x590905){var _0x39392e=typeof _0x260b1d[_0x9c03('0x1a')]===_0x9c03('0x1b')&&typeof _0x260b1d[_0x9c03('0x1c')]===_0x9c03('0x1b');var _0x5b258a=_0x590905[_0x9c03('0x1d')];var _0xec6f3e=_0x39392e?0x0:_0x260b1d[_0x9c03('0x1a')];var _0x23d681=_0x39392e?_0x590905[_0x9c03('0x1d')]:_0x260b1d[_0x9c03('0x1a')]+_0x260b1d['limit'];var _0x136626;if(_0x23d681>=_0x5b258a){_0x23d681=_0x5b258a;_0x136626=0xc8;}else{_0x136626=0xce;}_0x3286f7['status'](_0x136626);return _0x3286f7['set'](_0x9c03('0x1e'),_0xec6f3e+'-'+_0x23d681+'/'+_0x5b258a)[_0x9c03('0x1f')](_0x590905);}return null;};}function patchUpdates(_0x17ae5f){return function(_0x254040){try{jsonpatch[_0x9c03('0x20')](_0x254040,_0x17ae5f,!![]);}catch(_0x45c831){return BPromise[_0x9c03('0x21')](_0x45c831);}return _0x254040[_0x9c03('0x22')]();};}function saveUpdates(_0x56f6dc,_0x3dc922){return function(_0x2075c7){if(_0x2075c7){return _0x2075c7[_0x9c03('0x23')](_0x56f6dc)[_0x9c03('0x24')](function(_0x3ec2eb){return _0x3ec2eb;});}return null;};}function removeEntity(_0x26875f,_0x58c6b8){return function(_0x751ee5){if(_0x751ee5){return _0x751ee5[_0x9c03('0x25')]()[_0x9c03('0x24')](function(){var _0x5a64be=_0x751ee5[_0x9c03('0x26')]({'plain':!![]});var _0x1edbe5=_0x9c03('0x27');return db[_0x9c03('0x28')][_0x9c03('0x25')]({'where':{'type':_0x1edbe5,'resourceId':_0x5a64be['id']}})[_0x9c03('0x24')](function(){return _0x751ee5;});})[_0x9c03('0x24')](function(){_0x26875f[_0x9c03('0x18')](0xcc)[_0x9c03('0x19')]();});}};}function handleEntityNotFound(_0x172a33,_0x30d18a){return function(_0x2fefef){if(!_0x2fefef){_0x172a33[_0x9c03('0x17')](0x194);}return _0x2fefef;};}function handleError(_0x16bf6a,_0x2b507f){_0x2b507f=_0x2b507f||0x1f4;return function(_0x5fbe00){logger['error'](_0x5fbe00[_0x9c03('0x29')]);if(_0x5fbe00['name']){delete _0x5fbe00[_0x9c03('0x2a')];}_0x16bf6a[_0x9c03('0x18')](_0x2b507f)[_0x9c03('0x2b')](_0x5fbe00);};}exports[_0x9c03('0x2c')]=function(_0x2849cf,_0x41217a){var _0x11d7d9={},_0x249348={},_0x6c63c={'count':0x0,'rows':[]};var _0x473884=_[_0x9c03('0x2d')](db[_0x9c03('0x2e')][_0x9c03('0x2f')],function(_0x4d5937){return{'name':_0x4d5937[_0x9c03('0x30')],'type':_0x4d5937[_0x9c03('0x31')][_0x9c03('0x32')]};});_0x249348[_0x9c03('0x33')]=_[_0x9c03('0x2d')](_0x473884,_0x9c03('0x2a'));_0x249348[_0x9c03('0x34')]=_[_0x9c03('0x35')](_0x2849cf[_0x9c03('0x34')]);_0x249348['filters']=_['intersection'](_0x249348[_0x9c03('0x33')],_0x249348[_0x9c03('0x34')]);_0x11d7d9[_0x9c03('0x36')]=_[_0x9c03('0x37')](_0x249348[_0x9c03('0x33')],qs[_0x9c03('0x38')](_0x2849cf[_0x9c03('0x34')][_0x9c03('0x38')]));_0x11d7d9[_0x9c03('0x36')]=_0x11d7d9['attributes'][_0x9c03('0x39')]?_0x11d7d9[_0x9c03('0x36')]:_0x249348[_0x9c03('0x33')];if(!_0x2849cf[_0x9c03('0x34')][_0x9c03('0x3a')](_0x9c03('0x3b'))){_0x11d7d9[_0x9c03('0x1c')]=qs['limit'](_0x2849cf['query']['limit']);_0x11d7d9['offset']=qs[_0x9c03('0x1a')](_0x2849cf[_0x9c03('0x34')][_0x9c03('0x1a')]);}_0x11d7d9[_0x9c03('0x3c')]=qs['sort'](_0x2849cf[_0x9c03('0x34')][_0x9c03('0x3d')]);_0x11d7d9[_0x9c03('0x3e')]=qs[_0x9c03('0x3f')](_[_0x9c03('0x40')](_0x2849cf[_0x9c03('0x34')],_0x249348[_0x9c03('0x3f')]),_0x473884);if(_0x2849cf[_0x9c03('0x34')][_0x9c03('0x41')]){_0x11d7d9[_0x9c03('0x3e')]=_[_0x9c03('0x42')](_0x11d7d9[_0x9c03('0x3e')],{'$or':_[_0x9c03('0x2d')](_0x473884,function(_0x3a7781){if(_0x3a7781[_0x9c03('0x31')]!==_0x9c03('0x43')){var _0x4724d2={};_0x4724d2[_0x3a7781['name']]={'$like':'%'+_0x2849cf[_0x9c03('0x34')][_0x9c03('0x41')]+'%'};return _0x4724d2;}})});}_0x11d7d9=_['merge']({},_0x11d7d9,_0x2849cf[_0x9c03('0x44')]);var _0x28b795={'where':_0x11d7d9[_0x9c03('0x3e')]};return db[_0x9c03('0x2e')][_0x9c03('0x1d')](_0x28b795)[_0x9c03('0x24')](function(_0x449a93){_0x6c63c[_0x9c03('0x1d')]=_0x449a93;if(_0x2849cf[_0x9c03('0x34')]['includeAll']){_0x11d7d9[_0x9c03('0x45')]=[{'all':!![]}];}return db[_0x9c03('0x2e')][_0x9c03('0x46')](_0x11d7d9);})[_0x9c03('0x24')](function(_0x2d5bf9){_0x6c63c['rows']=_0x2d5bf9;return _0x6c63c;})[_0x9c03('0x24')](respondWithFilteredResult(_0x41217a,_0x11d7d9))['catch'](handleError(_0x41217a,null));};exports[_0x9c03('0x47')]=function(_0x268bc7,_0x295289){var _0x3f5ebf={'raw':!![],'where':{'id':_0x268bc7['params']['id']}},_0x5b772f={};_0x5b772f['model']=_[_0x9c03('0x35')](db[_0x9c03('0x2e')][_0x9c03('0x2f')]);_0x5b772f[_0x9c03('0x34')]=_[_0x9c03('0x35')](_0x268bc7[_0x9c03('0x34')]);_0x5b772f['filters']=_[_0x9c03('0x37')](_0x5b772f[_0x9c03('0x33')],_0x5b772f[_0x9c03('0x34')]);_0x3f5ebf[_0x9c03('0x36')]=_[_0x9c03('0x37')](_0x5b772f[_0x9c03('0x33')],qs[_0x9c03('0x38')](_0x268bc7[_0x9c03('0x34')][_0x9c03('0x38')]));_0x3f5ebf[_0x9c03('0x36')]=_0x3f5ebf['attributes'][_0x9c03('0x39')]?_0x3f5ebf['attributes']:_0x5b772f[_0x9c03('0x33')];if(_0x268bc7[_0x9c03('0x34')][_0x9c03('0x48')]){_0x3f5ebf[_0x9c03('0x45')]=[{'all':!![]}];}_0x3f5ebf=_['merge']({},_0x3f5ebf,_0x268bc7[_0x9c03('0x44')]);return db[_0x9c03('0x2e')][_0x9c03('0x49')](_0x3f5ebf)[_0x9c03('0x24')](handleEntityNotFound(_0x295289,null))['then'](respondWithResult(_0x295289,null))['catch'](handleError(_0x295289,null));};exports['create']=function(_0x9982aa,_0x94d7a9){return db[_0x9c03('0x2e')][_0x9c03('0x4a')](_0x9982aa['body'],{})[_0x9c03('0x24')](function(_0x11e930){var _0x28deb5=_0x9982aa[_0x9c03('0x4b')][_0x9c03('0x26')]({'plain':!![]});if(!_0x28deb5)throw new Error(_0x9c03('0x4c'));if(_0x28deb5[_0x9c03('0x4d')]===_0x9c03('0x4b')){var _0x1c2bb6=_0x11e930['get']({'plain':!![]});var _0x23cfa1=_0x9c03('0x27');return db[_0x9c03('0x4e')][_0x9c03('0x49')]({'where':{'name':_0x23cfa1,'userProfileId':_0x28deb5[_0x9c03('0x4f')]},'raw':!![]})[_0x9c03('0x24')](function(_0x4d2c31){if(_0x4d2c31&&_0x4d2c31[_0x9c03('0x50')]===0x0){return db[_0x9c03('0x28')][_0x9c03('0x4a')]({'name':_0x1c2bb6[_0x9c03('0x2a')],'resourceId':_0x1c2bb6['id'],'type':_0x4d2c31[_0x9c03('0x2a')],'sectionId':_0x4d2c31['id']},{})[_0x9c03('0x24')](function(){return _0x11e930;});}else{return _0x11e930;}})[_0x9c03('0x51')](function(_0x121e56){logger['error'](_0x9c03('0x52'),_0x121e56);throw _0x121e56;});}return _0x11e930;})['then'](respondWithResult(_0x94d7a9,0xc9))[_0x9c03('0x51')](handleError(_0x94d7a9,null));};exports[_0x9c03('0x23')]=function(_0x18d7e8,_0x40fbcd){if(_0x18d7e8[_0x9c03('0x53')]['id']){delete _0x18d7e8[_0x9c03('0x53')]['id'];}return db['AnalyticExtractedReport'][_0x9c03('0x49')]({'where':{'id':_0x18d7e8[_0x9c03('0x54')]['id']}})[_0x9c03('0x24')](handleEntityNotFound(_0x40fbcd,null))[_0x9c03('0x24')](saveUpdates(_0x18d7e8[_0x9c03('0x53')],null))[_0x9c03('0x24')](respondWithResult(_0x40fbcd,null))[_0x9c03('0x51')](handleError(_0x40fbcd,null));};exports[_0x9c03('0x25')]=function(_0x515830,_0x21ccc5){return db[_0x9c03('0x2e')]['find']({'where':{'id':_0x515830[_0x9c03('0x54')]['id']}})['then'](handleEntityNotFound(_0x21ccc5,null))['then'](removeEntity(_0x21ccc5,null))[_0x9c03('0x51')](handleError(_0x21ccc5,null));};exports[_0x9c03('0x55')]=function(_0x1b37c8,_0x36ee62,_0x25ea8f){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x1b37c8['params']['id']},'attributes':[_0x9c03('0x2a'),_0x9c03('0x56'),_0x9c03('0x57'),'output'],'raw':!![]})[_0x9c03('0x24')](handleEntityNotFound(_0x36ee62,null))[_0x9c03('0x24')](function(_0x275849){if(_0x275849){if(!fs[_0x9c03('0x58')](path['join'](config[_0x9c03('0x59')],_0x9c03('0x5a'),_0x275849[_0x9c03('0x57')]))){throw new db[(_0x9c03('0x5b'))][(_0x9c03('0x5c'))](_0x9c03('0x5d'));}if(_0x1b37c8[_0x9c03('0x34')][_0x9c03('0x5e')]){return _0x36ee62['sendStatus'](0xc8);}return _0x36ee62[_0x9c03('0x55')](path[_0x9c03('0x5f')](config[_0x9c03('0x59')],_0x9c03('0x5a'),_0x275849[_0x9c03('0x57')]),util[_0x9c03('0x60')](_0x9c03('0x61'),_0x275849[_0x9c03('0x56')]||_0x275849[_0x9c03('0x2a')],_0x275849[_0x9c03('0x62')][_0x9c03('0x63')]()));}})[_0x9c03('0x51')](handleError(_0x36ee62,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e0e7103..86430b7 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.model.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd978=['bluebird','request-promise','path','../../config/environment','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4885d6,_0x1f0743){var _0x5a2334=function(_0x4d01e1){while(--_0x4d01e1){_0x4885d6['push'](_0x4885d6['shift']());}};_0x5a2334(++_0x1f0743);}(_0xd978,0x187));var _0x8d97=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0xd978[_0x257841];return _0x1b87ed;};'use strict';var _=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));var logger=require(_0x8d97('0x2'))(_0x8d97('0x3'));var moment=require(_0x8d97('0x4'));var BPromise=require(_0x8d97('0x5'));var rp=require(_0x8d97('0x6'));var fs=require('fs');var path=require(_0x8d97('0x7'));var rimraf=require('rimraf');var config=require(_0x8d97('0x8'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x39bf55,_0x4a95b2){return _0x39bf55['define'](_0x8d97('0x9'),attributes,{'tableName':_0x8d97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aaa=['analytics_extracted_reports','lodash','util','api','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport'];(function(_0x17b796,_0x13308a){var _0x436adc=function(_0x1974e3){while(--_0x1974e3){_0x17b796['push'](_0x17b796['shift']());}};_0x436adc(++_0x13308a);}(_0x0aaa,0xc7));var _0xa0aa=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x0aaa[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var logger=require('../../config/logger')(_0xa0aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa0aa('0x3'));var fs=require('fs');var path=require(_0xa0aa('0x4'));var rimraf=require(_0xa0aa('0x5'));var config=require(_0xa0aa('0x6'));var attributes=require(_0xa0aa('0x7'));module['exports']=function(_0x3c05a6,_0x3f1ece){return _0x3c05a6[_0xa0aa('0x8')](_0xa0aa('0x9'),attributes,{'tableName':_0xa0aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 52eb2cb..4362d20 100644 --- a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js +++ b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9b7=['rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x82db7a,_0x1b9129){var _0x76f85=function(_0x51e389){while(--_0x51e389){_0x82db7a['push'](_0x82db7a['shift']());}};_0x76f85(++_0x1b9129);}(_0xf9b7,0x13d));var _0x7f9b=function(_0x506ac7,_0x5db19b){_0x506ac7=_0x506ac7-0x0;var _0x5d4ce5=_0xf9b7[_0x506ac7];return _0x5d4ce5;};'use strict';var _=require(_0x7f9b('0x0'));var util=require('util');var moment=require(_0x7f9b('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f9b('0x2'));var fs=require('fs');var Redis=require(_0x7f9b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f9b('0x4'));var logger=require(_0x7f9b('0x5'))(_0x7f9b('0x6'));var config=require(_0x7f9b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7f9b('0x8')][_0x7f9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d08cd,_0x27d722,_0x2a8aa8){return new BPromise(function(_0xbb9f4,_0x58f78b){return client['request'](_0x3d08cd,_0x2a8aa8)[_0x7f9b('0xa')](function(_0x4e751a){logger[_0x7f9b('0xb')](_0x7f9b('0xc'),_0x27d722,_0x7f9b('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x27d722,_0x7f9b('0xd'),JSON[_0x7f9b('0xe')](_0x4e751a));if(_0x4e751a[_0x7f9b('0xf')]){if(_0x4e751a[_0x7f9b('0xf')]['code']===0x1f4){logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x4e751a[_0x7f9b('0xf')]['message']);return _0x58f78b(_0x4e751a['error'][_0x7f9b('0x10')]);}logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x4e751a[_0x7f9b('0xf')][_0x7f9b('0x10')]);return _0xbb9f4(_0x4e751a[_0x7f9b('0xf')]['message']);}else{logger[_0x7f9b('0xb')](_0x7f9b('0xc'),_0x27d722,'request\x20sent');_0xbb9f4(_0x4e751a[_0x7f9b('0x11')][_0x7f9b('0x10')]);}})[_0x7f9b('0x12')](function(_0x420702){logger[_0x7f9b('0xf')](_0x7f9b('0xc'),_0x27d722,_0x420702);_0x58f78b(_0x420702);});});} \ No newline at end of file +var _0x4e19=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x38d670,_0x2dd730){var _0x374f90=function(_0x55654c){while(--_0x55654c){_0x38d670['push'](_0x38d670['shift']());}};_0x374f90(++_0x2dd730);}(_0x4e19,0xc2));var _0x94e1=function(_0x44d62d,_0x128717){_0x44d62d=_0x44d62d-0x0;var _0xd4383f=_0x4e19[_0x44d62d];return _0xd4383f;};'use strict';var _=require(_0x94e1('0x0'));var util=require('util');var moment=require(_0x94e1('0x1'));var BPromise=require(_0x94e1('0x2'));var rs=require(_0x94e1('0x3'));var fs=require('fs');var Redis=require(_0x94e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x94e1('0x5'));var logger=require(_0x94e1('0x6'))(_0x94e1('0x7'));var config=require(_0x94e1('0x8'));var jayson=require(_0x94e1('0x9'));var client=jayson[_0x94e1('0xa')][_0x94e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a090f,_0x74f07f,_0x14458d){return new BPromise(function(_0x3bf47e,_0x13796e){return client[_0x94e1('0xc')](_0x4a090f,_0x14458d)[_0x94e1('0xd')](function(_0x270694){logger[_0x94e1('0xe')](_0x94e1('0xf'),_0x74f07f,_0x94e1('0x10'));logger[_0x94e1('0x11')](_0x94e1('0x12'),_0x74f07f,_0x94e1('0x10'),JSON['stringify'](_0x270694));if(_0x270694['error']){if(_0x270694[_0x94e1('0x13')][_0x94e1('0x14')]===0x1f4){logger[_0x94e1('0x13')](_0x94e1('0xf'),_0x74f07f,_0x270694[_0x94e1('0x13')][_0x94e1('0x15')]);return _0x13796e(_0x270694[_0x94e1('0x13')][_0x94e1('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x74f07f,_0x270694[_0x94e1('0x13')][_0x94e1('0x15')]);return _0x3bf47e(_0x270694[_0x94e1('0x13')]['message']);}else{logger[_0x94e1('0xe')](_0x94e1('0xf'),_0x74f07f,'request\x20sent');_0x3bf47e(_0x270694[_0x94e1('0x16')][_0x94e1('0x15')]);}})[_0x94e1('0x17')](function(_0x125eaa){logger[_0x94e1('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x74f07f,_0x125eaa);_0x13796e(_0x125eaa);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a4d244a..b751554 100644 --- a/server/api/analyticExtractedReport/index.js +++ b/server/api/analyticExtractedReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4b5=['delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4b5,0x12f));var _0x5a4b=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xa4b5[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0x5a4b('0x0'));var util=require('util');var path=require(_0x5a4b('0x1'));var timeout=require(_0x5a4b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5a4b('0x3'));var auth=require(_0x5a4b('0x4'));var interaction=require(_0x5a4b('0x5'));var config=require(_0x5a4b('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x5a4b('0x7')]('/',auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x9')]);router[_0x5a4b('0x7')](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0xb')]);router[_0x5a4b('0x7')](_0x5a4b('0xc'),auth['isAuthenticated'](),controller[_0x5a4b('0xd')]);router[_0x5a4b('0xe')]('/',auth[_0x5a4b('0x8')](),controller[_0x5a4b('0xf')]);router['put'](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x10')]);router[_0x5a4b('0x11')](_0x5a4b('0xa'),auth[_0x5a4b('0x8')](),controller[_0x5a4b('0x12')]);module[_0x5a4b('0x13')]=router; \ No newline at end of file +var _0x6def=['../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id/download','download','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x367d2b,_0x58d1f1){var _0x58178e=function(_0x13c1de){while(--_0x13c1de){_0x367d2b['push'](_0x367d2b['shift']());}};_0x58178e(++_0x58d1f1);}(_0x6def,0x7f));var _0xf6de=function(_0x58d0a6,_0x596226){_0x58d0a6=_0x58d0a6-0x0;var _0x996648=_0x6def[_0x58d0a6];return _0x996648;};'use strict';var multer=require(_0xf6de('0x0'));var util=require(_0xf6de('0x1'));var path=require(_0xf6de('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6de('0x3'));var router=express[_0xf6de('0x4')]();var fs_extra=require(_0xf6de('0x5'));var auth=require(_0xf6de('0x6'));var interaction=require(_0xf6de('0x7'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xf6de('0x8')](),controller['index']);router[_0xf6de('0x9')]('/:id',auth[_0xf6de('0x8')](),controller['show']);router[_0xf6de('0x9')](_0xf6de('0xa'),auth[_0xf6de('0x8')](),controller[_0xf6de('0xb')]);router[_0xf6de('0xc')]('/',auth[_0xf6de('0x8')](),controller[_0xf6de('0xd')]);router[_0xf6de('0xe')](_0xf6de('0xf'),auth[_0xf6de('0x8')](),controller[_0xf6de('0x10')]);router['delete'](_0xf6de('0xf'),auth[_0xf6de('0x8')](),controller[_0xf6de('0x11')]);module[_0xf6de('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 3c73e86..88e9196 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f8=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x63f8,0xee));var _0x863f=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x63f8[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x863f('0x0'));module[_0x863f('0x1')]={'field':{'type':Sequelize[_0x863f('0x2')]},'alias':{'type':Sequelize[_0x863f('0x3')]},'function':{'type':Sequelize[_0x863f('0x3')]},'format':{'type':Sequelize[_0x863f('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x863f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc4db=['sequelize','exports','TEXT','STRING'];(function(_0x423efe,_0x16497d){var _0x1466b8=function(_0x153100){while(--_0x153100){_0x423efe['push'](_0x423efe['shift']());}};_0x1466b8(++_0x16497d);}(_0xc4db,0xc8));var _0xbc4d=function(_0x5888d8,_0x5431c2){_0x5888d8=_0x5888d8-0x0;var _0x3e4856=_0xc4db[_0x5888d8];return _0x3e4856;};'use strict';var Sequelize=require(_0xbc4d('0x0'));module[_0xbc4d('0x1')]={'field':{'type':Sequelize[_0xbc4d('0x2')]},'alias':{'type':Sequelize[_0xbc4d('0x3')]},'function':{'type':Sequelize[_0xbc4d('0x3')]},'format':{'type':Sequelize[_0xbc4d('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index a9a9f62..fe14564 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.controller.js +++ b/server/api/analyticFieldReport/analyticFieldReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b15=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','query','intersection','model','attributes','length','hasOwnProperty','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','keys','fields','include','find','create','body','bulkCreate','params','destroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format'];(function(_0x2dcf38,_0x33765a){var _0x2295dc=function(_0x1aff4f){while(--_0x1aff4f){_0x2dcf38['push'](_0x2dcf38['shift']());}};_0x2295dc(++_0x33765a);}(_0x2b15,0x147));var _0x52b1=function(_0x3195af,_0x536c46){_0x3195af=_0x3195af-0x0;var _0x358a02=_0x2b15[_0x3195af];return _0x358a02;};'use strict';var emlformat=require(_0x52b1('0x0'));var rimraf=require(_0x52b1('0x1'));var zipdir=require(_0x52b1('0x2'));var jsonpatch=require(_0x52b1('0x3'));var rp=require(_0x52b1('0x4'));var moment=require(_0x52b1('0x5'));var BPromise=require(_0x52b1('0x6'));var Mustache=require('mustache');var util=require(_0x52b1('0x7'));var path=require(_0x52b1('0x8'));var sox=require('sox');var csv=require(_0x52b1('0x9'));var ejs=require(_0x52b1('0xa'));var fs=require('fs');var fs_extra=require(_0x52b1('0xb'));var _=require('lodash');var squel=require(_0x52b1('0xc'));var crypto=require(_0x52b1('0xd'));var jsforce=require(_0x52b1('0xe'));var deskjs=require(_0x52b1('0xf'));var toCsv=require(_0x52b1('0x9'));var querystring=require(_0x52b1('0x10'));var Papa=require(_0x52b1('0x11'));var Redis=require(_0x52b1('0x12'));var authService=require(_0x52b1('0x13'));var qs=require(_0x52b1('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52b1('0x15'));var logger=require(_0x52b1('0x16'))(_0x52b1('0x17'));var utils=require(_0x52b1('0x18'));var config=require(_0x52b1('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x52b1('0x1a'))['db'];function respondWithStatusCode(_0xf737be,_0xc1eb9e){_0xc1eb9e=_0xc1eb9e||0xcc;return function(_0x16f4e9){if(_0x16f4e9){return _0xf737be[_0x52b1('0x1b')](_0xc1eb9e);}return _0xf737be[_0x52b1('0x1c')](_0xc1eb9e)['end']();};}function respondWithResult(_0x345c6f,_0x48b78e){_0x48b78e=_0x48b78e||0xc8;return function(_0x2c7d3f){if(_0x2c7d3f){return _0x345c6f[_0x52b1('0x1c')](_0x48b78e)[_0x52b1('0x1d')](_0x2c7d3f);}};}function respondWithFilteredResult(_0xe96369,_0x1cb5c8){return function(_0x2b8fca){if(_0x2b8fca){var _0x49919a=typeof _0x1cb5c8[_0x52b1('0x1e')]===_0x52b1('0x1f')&&typeof _0x1cb5c8[_0x52b1('0x20')]==='undefined';var _0xb176e5=_0x2b8fca['count'];var _0x5d33e6=_0x49919a?0x0:_0x1cb5c8[_0x52b1('0x1e')];var _0x566528=_0x49919a?_0x2b8fca[_0x52b1('0x21')]:_0x1cb5c8[_0x52b1('0x1e')]+_0x1cb5c8[_0x52b1('0x20')];var _0x2bf5a5;if(_0x566528>=_0xb176e5){_0x566528=_0xb176e5;_0x2bf5a5=0xc8;}else{_0x2bf5a5=0xce;}_0xe96369['status'](_0x2bf5a5);return _0xe96369[_0x52b1('0x22')](_0x52b1('0x23'),_0x5d33e6+'-'+_0x566528+'/'+_0xb176e5)[_0x52b1('0x1d')](_0x2b8fca);}return null;};}function patchUpdates(_0xddfc53){return function(_0x558ae1){try{jsonpatch['apply'](_0x558ae1,_0xddfc53,!![]);}catch(_0x4a316a){return BPromise['reject'](_0x4a316a);}return _0x558ae1[_0x52b1('0x24')]();};}function saveUpdates(_0x1b0357,_0x387523){return function(_0x3f66a5){if(_0x3f66a5){return _0x3f66a5[_0x52b1('0x25')](_0x1b0357)[_0x52b1('0x26')](function(_0x30c04d){return _0x30c04d;});}return null;};}function removeEntity(_0x29bb1d,_0x2dedbb){return function(_0x3ddea8){if(_0x3ddea8){return _0x3ddea8['destroy']()[_0x52b1('0x26')](function(){_0x29bb1d[_0x52b1('0x1c')](0xcc)[_0x52b1('0x27')]();});}};}function handleEntityNotFound(_0x532b75,_0x568b45){return function(_0x160d75){if(!_0x160d75){_0x532b75[_0x52b1('0x1b')](0x194);}return _0x160d75;};}function handleError(_0x121874,_0x4eefb6){_0x4eefb6=_0x4eefb6||0x1f4;return function(_0x133427){logger[_0x52b1('0x28')](_0x133427[_0x52b1('0x29')]);if(_0x133427[_0x52b1('0x2a')]){delete _0x133427['name'];}_0x121874[_0x52b1('0x1c')](_0x4eefb6)[_0x52b1('0x2b')](_0x133427);};}exports[_0x52b1('0x2c')]=function(_0x2d772c,_0x4ebb96){var _0x3b0e63={},_0x3397ff={},_0x5e4a90={'count':0x0,'rows':[]};var _0x40c736=_[_0x52b1('0x2d')](db[_0x52b1('0x2e')][_0x52b1('0x2f')],function(_0x46c3be){return{'name':_0x46c3be[_0x52b1('0x30')],'type':_0x46c3be[_0x52b1('0x31')]['key']};});_0x3397ff['model']=_[_0x52b1('0x2d')](_0x40c736,_0x52b1('0x2a'));_0x3397ff[_0x52b1('0x32')]=_['keys'](_0x2d772c['query']);_0x3397ff['filters']=_[_0x52b1('0x33')](_0x3397ff[_0x52b1('0x34')],_0x3397ff['query']);_0x3b0e63['attributes']=_[_0x52b1('0x33')](_0x3397ff['model'],qs['fields'](_0x2d772c['query']['fields']));_0x3b0e63['attributes']=_0x3b0e63[_0x52b1('0x35')][_0x52b1('0x36')]?_0x3b0e63['attributes']:_0x3397ff[_0x52b1('0x34')];if(!_0x2d772c[_0x52b1('0x32')][_0x52b1('0x37')]('nolimit')){_0x3b0e63[_0x52b1('0x20')]=qs['limit'](_0x2d772c[_0x52b1('0x32')][_0x52b1('0x20')]);_0x3b0e63['offset']=qs['offset'](_0x2d772c[_0x52b1('0x32')][_0x52b1('0x1e')]);}_0x3b0e63['order']=qs['sort'](_0x2d772c[_0x52b1('0x32')]['sort']);_0x3b0e63[_0x52b1('0x38')]=qs[_0x52b1('0x39')](_[_0x52b1('0x3a')](_0x2d772c[_0x52b1('0x32')],_0x3397ff[_0x52b1('0x39')]),_0x40c736);if(_0x2d772c[_0x52b1('0x32')]['filter']){_0x3b0e63[_0x52b1('0x38')]=_[_0x52b1('0x3b')](_0x3b0e63[_0x52b1('0x38')],{'$or':_[_0x52b1('0x2d')](_0x40c736,function(_0x2a6c1b){if(_0x2a6c1b['type']!==_0x52b1('0x3c')){var _0x272c93={};_0x272c93[_0x2a6c1b[_0x52b1('0x2a')]]={'$like':'%'+_0x2d772c[_0x52b1('0x32')][_0x52b1('0x3d')]+'%'};return _0x272c93;}})});}_0x3b0e63=_[_0x52b1('0x3b')]({},_0x3b0e63,_0x2d772c[_0x52b1('0x3e')]);var _0x35162d={'where':_0x3b0e63[_0x52b1('0x38')]};return db[_0x52b1('0x2e')][_0x52b1('0x21')](_0x35162d)[_0x52b1('0x26')](function(_0x20f1d3){_0x5e4a90[_0x52b1('0x21')]=_0x20f1d3;if(_0x2d772c[_0x52b1('0x32')][_0x52b1('0x3f')]){_0x3b0e63['include']=[{'all':!![]}];}return db[_0x52b1('0x2e')]['findAll'](_0x3b0e63);})[_0x52b1('0x26')](function(_0x1ddf03){_0x5e4a90['rows']=_0x1ddf03;return _0x5e4a90;})[_0x52b1('0x26')](respondWithFilteredResult(_0x4ebb96,_0x3b0e63))[_0x52b1('0x40')](handleError(_0x4ebb96,null));};exports[_0x52b1('0x41')]=function(_0xfa4b7a,_0x1aea91){var _0x51af0c={'raw':![],'where':{'id':_0xfa4b7a['params']['id']}},_0xddd384={};_0xddd384[_0x52b1('0x34')]=_[_0x52b1('0x42')](db['AnalyticFieldReport'][_0x52b1('0x2f')]);_0xddd384['query']=_[_0x52b1('0x42')](_0xfa4b7a[_0x52b1('0x32')]);_0xddd384[_0x52b1('0x39')]=_['intersection'](_0xddd384[_0x52b1('0x34')],_0xddd384[_0x52b1('0x32')]);_0x51af0c[_0x52b1('0x35')]=_[_0x52b1('0x33')](_0xddd384[_0x52b1('0x34')],qs[_0x52b1('0x43')](_0xfa4b7a['query']['fields']));_0x51af0c[_0x52b1('0x35')]=_0x51af0c[_0x52b1('0x35')]['length']?_0x51af0c['attributes']:_0xddd384['model'];if(_0xfa4b7a[_0x52b1('0x32')][_0x52b1('0x3f')]){_0x51af0c[_0x52b1('0x44')]=[{'all':!![]}];}_0x51af0c=_[_0x52b1('0x3b')]({},_0x51af0c,_0xfa4b7a['options']);return db[_0x52b1('0x2e')][_0x52b1('0x45')](_0x51af0c)[_0x52b1('0x26')](handleEntityNotFound(_0x1aea91,null))[_0x52b1('0x26')](respondWithResult(_0x1aea91,null))[_0x52b1('0x40')](handleError(_0x1aea91,null));};exports[_0x52b1('0x46')]=function(_0x459b72,_0x238c92){return db[_0x52b1('0x2e')][_0x52b1('0x46')](_0x459b72[_0x52b1('0x47')],{})[_0x52b1('0x26')](respondWithResult(_0x238c92,0xc9))[_0x52b1('0x40')](handleError(_0x238c92,null));};exports[_0x52b1('0x48')]=function(_0xfab58f,_0x13b3c0){return db[_0x52b1('0x2e')][_0x52b1('0x48')](_0xfab58f['body'],{'raw':![],'individualHooks':!![]})[_0x52b1('0x26')](respondWithResult(_0x13b3c0,0xc9))[_0x52b1('0x40')](handleError(_0x13b3c0,null));};exports[_0x52b1('0x25')]=function(_0x5926f1,_0x50a3de){if(_0x5926f1[_0x52b1('0x47')]['id']){delete _0x5926f1[_0x52b1('0x47')]['id'];}return db[_0x52b1('0x2e')][_0x52b1('0x45')]({'where':{'id':_0x5926f1[_0x52b1('0x49')]['id']}})[_0x52b1('0x26')](handleEntityNotFound(_0x50a3de,null))[_0x52b1('0x26')](saveUpdates(_0x5926f1[_0x52b1('0x47')],null))[_0x52b1('0x26')](respondWithResult(_0x50a3de,null))[_0x52b1('0x40')](handleError(_0x50a3de,null));};exports[_0x52b1('0x4a')]=function(_0x5b4ef6,_0x3afba6){return db[_0x52b1('0x2e')][_0x52b1('0x45')]({'where':{'id':_0x5b4ef6[_0x52b1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3afba6,null))['then'](removeEntity(_0x3afba6,null))[_0x52b1('0x40')](handleError(_0x3afba6,null));};exports['bulkDestroy']=function(_0x1e7bc7,_0xd268db){return db['AnalyticFieldReport'][_0x52b1('0x4a')]({'where':{'id':_0x1e7bc7[_0x52b1('0x32')][_0x52b1('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x52b1('0x26')](respondWithResult(_0xd268db,0xcc))[_0x52b1('0x40')](handleError(_0xd268db,null));};exports['addFields']=function(_0x29e194,_0x100ae9,_0x4d16a7){return db[_0x52b1('0x4c')][_0x52b1('0x4d')]({'where':{'id':_0x29e194['params']['id']}})['then'](handleEntityNotFound(_0x100ae9,null))[_0x52b1('0x26')](function(_0x206975){if(_0x206975){return db[_0x52b1('0x4e')][_0x52b1('0x4f')](function(_0x238cf2){return db[_0x52b1('0x2e')][_0x52b1('0x4a')]({'where':{'CustomReportId':_0x29e194[_0x52b1('0x49')]['id']},'transaction':_0x238cf2})['then'](function(_0x8ac284){var _0x279797=_[_0x52b1('0x2d')](_0x29e194[_0x52b1('0x47')],function(_0x25652f){delete _0x25652f['id'];_0x25652f[_0x52b1('0x50')]=_0x29e194[_0x52b1('0x49')]['id'];return _0x25652f;});return db['AnalyticFieldReport'][_0x52b1('0x48')](_0x279797,{'transaction':_0x238cf2});});})[_0x52b1('0x26')](function(){return db[_0x52b1('0x2e')][_0x52b1('0x51')]({'where':{'CustomReportId':_0x29e194['params']['id']}});});}})[_0x52b1('0x26')](respondWithResult(_0x100ae9,null))[_0x52b1('0x40')](handleError(_0x100ae9,null));}; \ No newline at end of file +var _0xd356=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','then','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd356,0x136));var _0x6d35=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd356[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6d35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d35('0x1'));var jsonpatch=require(_0x6d35('0x2'));var rp=require(_0x6d35('0x3'));var moment=require(_0x6d35('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6d35('0x5'));var util=require(_0x6d35('0x6'));var path=require(_0x6d35('0x7'));var sox=require(_0x6d35('0x8'));var csv=require(_0x6d35('0x9'));var ejs=require(_0x6d35('0xa'));var fs=require('fs');var fs_extra=require(_0x6d35('0xb'));var _=require(_0x6d35('0xc'));var squel=require(_0x6d35('0xd'));var crypto=require(_0x6d35('0xe'));var jsforce=require(_0x6d35('0xf'));var deskjs=require(_0x6d35('0x10'));var toCsv=require(_0x6d35('0x9'));var querystring=require(_0x6d35('0x11'));var Papa=require(_0x6d35('0x12'));var Redis=require(_0x6d35('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6d35('0x14'));var as=require(_0x6d35('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d35('0x16'))('api');var utils=require(_0x6d35('0x17'));var config=require(_0x6d35('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d35('0x19'))['db'];function respondWithStatusCode(_0x13ac62,_0x3f9637){_0x3f9637=_0x3f9637||0xcc;return function(_0x2193d6){if(_0x2193d6){return _0x13ac62[_0x6d35('0x1a')](_0x3f9637);}return _0x13ac62['status'](_0x3f9637)[_0x6d35('0x1b')]();};}function respondWithResult(_0x4b6675,_0x5210af){_0x5210af=_0x5210af||0xc8;return function(_0x3a7e6f){if(_0x3a7e6f){return _0x4b6675['status'](_0x5210af)['json'](_0x3a7e6f);}};}function respondWithFilteredResult(_0x1d0e43,_0x5ba172){return function(_0x32547c){if(_0x32547c){var _0xff989f=typeof _0x5ba172['offset']===_0x6d35('0x1c')&&typeof _0x5ba172[_0x6d35('0x1d')]===_0x6d35('0x1c');var _0x53fd50=_0x32547c[_0x6d35('0x1e')];var _0x354600=_0xff989f?0x0:_0x5ba172['offset'];var _0x31d790=_0xff989f?_0x32547c[_0x6d35('0x1e')]:_0x5ba172[_0x6d35('0x1f')]+_0x5ba172[_0x6d35('0x1d')];var _0x46d835;if(_0x31d790>=_0x53fd50){_0x31d790=_0x53fd50;_0x46d835=0xc8;}else{_0x46d835=0xce;}_0x1d0e43[_0x6d35('0x20')](_0x46d835);return _0x1d0e43[_0x6d35('0x21')](_0x6d35('0x22'),_0x354600+'-'+_0x31d790+'/'+_0x53fd50)['json'](_0x32547c);}return null;};}function patchUpdates(_0x4f43f0){return function(_0x4ef21b){try{jsonpatch[_0x6d35('0x23')](_0x4ef21b,_0x4f43f0,!![]);}catch(_0x55aeda){return BPromise[_0x6d35('0x24')](_0x55aeda);}return _0x4ef21b[_0x6d35('0x25')]();};}function saveUpdates(_0x2b9df0,_0x4a4dde){return function(_0xa5f094){if(_0xa5f094){return _0xa5f094[_0x6d35('0x26')](_0x2b9df0)['then'](function(_0x2018b0){return _0x2018b0;});}return null;};}function removeEntity(_0x227f77,_0xa41d7e){return function(_0x4cc11a){if(_0x4cc11a){return _0x4cc11a[_0x6d35('0x27')]()['then'](function(){_0x227f77[_0x6d35('0x20')](0xcc)[_0x6d35('0x1b')]();});}};}function handleEntityNotFound(_0x30511c,_0x5b5672){return function(_0x556c22){if(!_0x556c22){_0x30511c['sendStatus'](0x194);}return _0x556c22;};}function handleError(_0x3d86ef,_0x2bc6c2){_0x2bc6c2=_0x2bc6c2||0x1f4;return function(_0x1543f8){logger[_0x6d35('0x28')](_0x1543f8[_0x6d35('0x29')]);if(_0x1543f8['name']){delete _0x1543f8[_0x6d35('0x2a')];}_0x3d86ef['status'](_0x2bc6c2)['send'](_0x1543f8);};}exports['index']=function(_0x4e0f2c,_0x3936a1){var _0x295fbf={},_0xe99791={},_0x23fb9c={'count':0x0,'rows':[]};var _0x330e9b=_[_0x6d35('0x2b')](db[_0x6d35('0x2c')][_0x6d35('0x2d')],function(_0x5d2d6f){return{'name':_0x5d2d6f[_0x6d35('0x2e')],'type':_0x5d2d6f[_0x6d35('0x2f')][_0x6d35('0x30')]};});_0xe99791['model']=_['map'](_0x330e9b,_0x6d35('0x2a'));_0xe99791['query']=_[_0x6d35('0x31')](_0x4e0f2c[_0x6d35('0x32')]);_0xe99791[_0x6d35('0x33')]=_[_0x6d35('0x34')](_0xe99791[_0x6d35('0x35')],_0xe99791['query']);_0x295fbf[_0x6d35('0x36')]=_[_0x6d35('0x34')](_0xe99791[_0x6d35('0x35')],qs[_0x6d35('0x37')](_0x4e0f2c[_0x6d35('0x32')]['fields']));_0x295fbf[_0x6d35('0x36')]=_0x295fbf[_0x6d35('0x36')][_0x6d35('0x38')]?_0x295fbf['attributes']:_0xe99791['model'];if(!_0x4e0f2c[_0x6d35('0x32')]['hasOwnProperty'](_0x6d35('0x39'))){_0x295fbf[_0x6d35('0x1d')]=qs['limit'](_0x4e0f2c[_0x6d35('0x32')][_0x6d35('0x1d')]);_0x295fbf[_0x6d35('0x1f')]=qs[_0x6d35('0x1f')](_0x4e0f2c[_0x6d35('0x32')][_0x6d35('0x1f')]);}_0x295fbf['order']=qs[_0x6d35('0x3a')](_0x4e0f2c[_0x6d35('0x32')][_0x6d35('0x3a')]);_0x295fbf['where']=qs['filters'](_[_0x6d35('0x3b')](_0x4e0f2c[_0x6d35('0x32')],_0xe99791[_0x6d35('0x33')]),_0x330e9b);if(_0x4e0f2c['query'][_0x6d35('0x3c')]){_0x295fbf[_0x6d35('0x3d')]=_[_0x6d35('0x3e')](_0x295fbf['where'],{'$or':_['map'](_0x330e9b,function(_0x5a755a){if(_0x5a755a[_0x6d35('0x2f')]!=='VIRTUAL'){var _0x32ad2c={};_0x32ad2c[_0x5a755a['name']]={'$like':'%'+_0x4e0f2c[_0x6d35('0x32')][_0x6d35('0x3c')]+'%'};return _0x32ad2c;}})});}_0x295fbf=_[_0x6d35('0x3e')]({},_0x295fbf,_0x4e0f2c[_0x6d35('0x3f')]);var _0x415ca3={'where':_0x295fbf[_0x6d35('0x3d')]};return db[_0x6d35('0x2c')]['count'](_0x415ca3)['then'](function(_0x5c411c){_0x23fb9c[_0x6d35('0x1e')]=_0x5c411c;if(_0x4e0f2c[_0x6d35('0x32')][_0x6d35('0x40')]){_0x295fbf[_0x6d35('0x41')]=[{'all':!![]}];}return db[_0x6d35('0x2c')][_0x6d35('0x42')](_0x295fbf);})[_0x6d35('0x43')](function(_0x38be15){_0x23fb9c[_0x6d35('0x44')]=_0x38be15;return _0x23fb9c;})[_0x6d35('0x43')](respondWithFilteredResult(_0x3936a1,_0x295fbf))[_0x6d35('0x45')](handleError(_0x3936a1,null));};exports[_0x6d35('0x46')]=function(_0x4438d1,_0x45f785){var _0x46082c={'raw':![],'where':{'id':_0x4438d1['params']['id']}},_0x2fdee0={};_0x2fdee0[_0x6d35('0x35')]=_[_0x6d35('0x31')](db['AnalyticFieldReport'][_0x6d35('0x2d')]);_0x2fdee0[_0x6d35('0x32')]=_[_0x6d35('0x31')](_0x4438d1[_0x6d35('0x32')]);_0x2fdee0['filters']=_[_0x6d35('0x34')](_0x2fdee0['model'],_0x2fdee0[_0x6d35('0x32')]);_0x46082c[_0x6d35('0x36')]=_[_0x6d35('0x34')](_0x2fdee0[_0x6d35('0x35')],qs[_0x6d35('0x37')](_0x4438d1[_0x6d35('0x32')]['fields']));_0x46082c[_0x6d35('0x36')]=_0x46082c[_0x6d35('0x36')]['length']?_0x46082c[_0x6d35('0x36')]:_0x2fdee0[_0x6d35('0x35')];if(_0x4438d1[_0x6d35('0x32')][_0x6d35('0x40')]){_0x46082c[_0x6d35('0x41')]=[{'all':!![]}];}_0x46082c=_[_0x6d35('0x3e')]({},_0x46082c,_0x4438d1[_0x6d35('0x3f')]);return db['AnalyticFieldReport'][_0x6d35('0x47')](_0x46082c)[_0x6d35('0x43')](handleEntityNotFound(_0x45f785,null))['then'](respondWithResult(_0x45f785,null))['catch'](handleError(_0x45f785,null));};exports['create']=function(_0x48d048,_0xc70577){return db[_0x6d35('0x2c')][_0x6d35('0x48')](_0x48d048[_0x6d35('0x49')],{})[_0x6d35('0x43')](respondWithResult(_0xc70577,0xc9))[_0x6d35('0x45')](handleError(_0xc70577,null));};exports[_0x6d35('0x4a')]=function(_0x1352ca,_0x48fe94){return db[_0x6d35('0x2c')][_0x6d35('0x4a')](_0x1352ca[_0x6d35('0x49')],{'raw':![],'individualHooks':!![]})[_0x6d35('0x43')](respondWithResult(_0x48fe94,0xc9))[_0x6d35('0x45')](handleError(_0x48fe94,null));};exports[_0x6d35('0x26')]=function(_0x32e4c5,_0xfc1fdb){if(_0x32e4c5['body']['id']){delete _0x32e4c5[_0x6d35('0x49')]['id'];}return db[_0x6d35('0x2c')]['find']({'where':{'id':_0x32e4c5[_0x6d35('0x4b')]['id']}})['then'](handleEntityNotFound(_0xfc1fdb,null))[_0x6d35('0x43')](saveUpdates(_0x32e4c5['body'],null))[_0x6d35('0x43')](respondWithResult(_0xfc1fdb,null))[_0x6d35('0x45')](handleError(_0xfc1fdb,null));};exports[_0x6d35('0x27')]=function(_0x2eef01,_0x2d7816){return db[_0x6d35('0x2c')][_0x6d35('0x47')]({'where':{'id':_0x2eef01[_0x6d35('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2d7816,null))[_0x6d35('0x43')](removeEntity(_0x2d7816,null))[_0x6d35('0x45')](handleError(_0x2d7816,null));};exports[_0x6d35('0x4c')]=function(_0x445720,_0xb3574d){return db[_0x6d35('0x2c')][_0x6d35('0x27')]({'where':{'id':_0x445720['query'][_0x6d35('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x6d35('0x43')](respondWithResult(_0xb3574d,0xcc))[_0x6d35('0x45')](handleError(_0xb3574d,null));};exports[_0x6d35('0x4e')]=function(_0x246493,_0x34cb3c,_0x13e113){return db[_0x6d35('0x4f')][_0x6d35('0x50')]({'where':{'id':_0x246493[_0x6d35('0x4b')]['id']}})[_0x6d35('0x43')](handleEntityNotFound(_0x34cb3c,null))[_0x6d35('0x43')](function(_0x46ce9d){if(_0x46ce9d){return db[_0x6d35('0x51')]['transaction'](function(_0xa3527c){return db[_0x6d35('0x2c')][_0x6d35('0x27')]({'where':{'CustomReportId':_0x246493[_0x6d35('0x4b')]['id']},'transaction':_0xa3527c})[_0x6d35('0x43')](function(_0x48c318){var _0x354340=_[_0x6d35('0x2b')](_0x246493[_0x6d35('0x49')],function(_0x2d512d){delete _0x2d512d['id'];_0x2d512d[_0x6d35('0x52')]=_0x246493[_0x6d35('0x4b')]['id'];return _0x2d512d;});return db[_0x6d35('0x2c')][_0x6d35('0x4a')](_0x354340,{'transaction':_0xa3527c});});})[_0x6d35('0x43')](function(){return db[_0x6d35('0x2c')][_0x6d35('0x42')]({'where':{'CustomReportId':_0x246493[_0x6d35('0x4b')]['id']}});});}})['then'](respondWithResult(_0x34cb3c,null))[_0x6d35('0x45')](handleError(_0x34cb3c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 3d22608..93bceb0 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.model.js +++ b/server/api/analyticFieldReport/analyticFieldReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c0f=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','request-promise'];(function(_0x20d45a,_0x14ae45){var _0x511390=function(_0x420c5b){while(--_0x420c5b){_0x20d45a['push'](_0x20d45a['shift']());}};_0x511390(++_0x14ae45);}(_0x1c0f,0x100));var _0xf1c0=function(_0x146a62,_0x388b09){_0x146a62=_0x146a62-0x0;var _0x83ff3b=_0x1c0f[_0x146a62];return _0x83ff3b;};'use strict';var _=require(_0xf1c0('0x0'));var util=require('util');var logger=require(_0xf1c0('0x1'))('api');var moment=require(_0xf1c0('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1c0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf1c0('0x4'));var config=require(_0xf1c0('0x5'));var attributes=require(_0xf1c0('0x6'));module[_0xf1c0('0x7')]=function(_0x8ca3e7,_0x354273){return _0x8ca3e7['define'](_0xf1c0('0x8'),attributes,{'tableName':_0xf1c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b24=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','path'];(function(_0x16c547,_0x5a1451){var _0x4356fc=function(_0x154edb){while(--_0x154edb){_0x16c547['push'](_0x16c547['shift']());}};_0x4356fc(++_0x5a1451);}(_0x5b24,0xd7));var _0x45b2=function(_0x3a1b90,_0x3c0158){_0x3a1b90=_0x3a1b90-0x0;var _0xf6de77=_0x5b24[_0x3a1b90];return _0xf6de77;};'use strict';var _=require(_0x45b2('0x0'));var util=require(_0x45b2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x45b2('0x2'));var BPromise=require(_0x45b2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x45b2('0x4'));var rimraf=require('rimraf');var config=require(_0x45b2('0x5'));var attributes=require(_0x45b2('0x6'));module[_0x45b2('0x7')]=function(_0x24720e,_0x650a60){return _0x24720e[_0x45b2('0x8')](_0x45b2('0x9'),attributes,{'tableName':_0x45b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c37a40c..5fdac11 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.rpc.js +++ b/server/api/analyticFieldReport/analyticFieldReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55b6=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a38a3,_0x3f13bc){var _0x4034fa=function(_0x11141f){while(--_0x11141f){_0x2a38a3['push'](_0x2a38a3['shift']());}};_0x4034fa(++_0x3f13bc);}(_0x55b6,0x74));var _0x655b=function(_0x18a79c,_0x1e3536){_0x18a79c=_0x18a79c-0x0;var _0x365cf3=_0x55b6[_0x18a79c];return _0x365cf3;};'use strict';var _=require(_0x655b('0x0'));var util=require(_0x655b('0x1'));var moment=require(_0x655b('0x2'));var BPromise=require(_0x655b('0x3'));var rs=require(_0x655b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x655b('0x5'));var config=require(_0x655b('0x6'));var jayson=require(_0x655b('0x7'));var client=jayson['client'][_0x655b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f46e0,_0x1318ea,_0x19ee25){return new BPromise(function(_0x2f972b,_0x258620){return client[_0x655b('0x9')](_0x2f46e0,_0x19ee25)[_0x655b('0xa')](function(_0x1b104a){logger['info'](_0x655b('0xb'),_0x1318ea,_0x655b('0xc'));logger[_0x655b('0xd')](_0x655b('0xe'),_0x1318ea,_0x655b('0xc'),JSON[_0x655b('0xf')](_0x1b104a));if(_0x1b104a[_0x655b('0x10')]){if(_0x1b104a[_0x655b('0x10')][_0x655b('0x11')]===0x1f4){logger[_0x655b('0x10')](_0x655b('0xb'),_0x1318ea,_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);return _0x258620(_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);}logger[_0x655b('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1318ea,_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);return _0x2f972b(_0x1b104a[_0x655b('0x10')][_0x655b('0x12')]);}else{logger[_0x655b('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1318ea,_0x655b('0xc'));_0x2f972b(_0x1b104a[_0x655b('0x14')][_0x655b('0x12')]);}})[_0x655b('0x15')](function(_0xc77331){logger[_0x655b('0x10')](_0x655b('0xb'),_0x1318ea,_0xc77331);_0x258620(_0xc77331);});});} \ No newline at end of file +var _0x068d=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x39d0bc,_0x5a27ba){var _0xa89f71=function(_0xefd51c){while(--_0xefd51c){_0x39d0bc['push'](_0x39d0bc['shift']());}};_0xa89f71(++_0x5a27ba);}(_0x068d,0xd7));var _0xd068=function(_0x3a631f,_0xa03675){_0x3a631f=_0x3a631f-0x0;var _0x3cf8d9=_0x068d[_0x3a631f];return _0x3cf8d9;};'use strict';var _=require(_0xd068('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd068('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xd068('0x2'));var logger=require(_0xd068('0x3'))('rpc');var config=require(_0xd068('0x4'));var jayson=require(_0xd068('0x5'));var client=jayson[_0xd068('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc41504,_0x463495,_0x40c5ab){return new BPromise(function(_0x2c9c6a,_0x2b8553){return client[_0xd068('0x7')](_0xc41504,_0x40c5ab)[_0xd068('0x8')](function(_0x26baad){logger[_0xd068('0x9')](_0xd068('0xa'),_0x463495,'request\x20sent');logger['debug'](_0xd068('0xb'),_0x463495,'request\x20sent',JSON[_0xd068('0xc')](_0x26baad));if(_0x26baad[_0xd068('0xd')]){if(_0x26baad[_0xd068('0xd')][_0xd068('0xe')]===0x1f4){logger['error'](_0xd068('0xa'),_0x463495,_0x26baad['error'][_0xd068('0xf')]);return _0x2b8553(_0x26baad[_0xd068('0xd')][_0xd068('0xf')]);}logger[_0xd068('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x463495,_0x26baad[_0xd068('0xd')]['message']);return _0x2c9c6a(_0x26baad[_0xd068('0xd')][_0xd068('0xf')]);}else{logger[_0xd068('0x9')](_0xd068('0xa'),_0x463495,'request\x20sent');_0x2c9c6a(_0x26baad[_0xd068('0x10')][_0xd068('0xf')]);}})[_0xd068('0x11')](function(_0xcfd440){logger[_0xd068('0xd')](_0xd068('0xa'),_0x463495,_0xcfd440);_0x2b8553(_0xcfd440);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index fa92706..4a2d5e7 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x2715d9,_0x4d2846){var _0x4d0b12=function(_0x26914e){while(--_0x26914e){_0x2715d9['push'](_0x2715d9['shift']());}};_0x4d0b12(++_0x4d2846);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x37b88a,_0x1618a2){var _0x5b0ad0=function(_0x19a29f){while(--_0x19a29f){_0x37b88a['push'](_0x37b88a['shift']());}};_0x5b0ad0(++_0x1618a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3f287a7..4154a63 100644 --- a/server/api/analyticMetric/analyticMetric.attributes.js +++ b/server/api/analyticMetric/analyticMetric.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9be=['name','TEXT','sequelize','exports','STRING'];(function(_0x4708fa,_0x4cac01){var _0x2831ea=function(_0x58f98e){while(--_0x58f98e){_0x4708fa['push'](_0x4708fa['shift']());}};_0x2831ea(++_0x4cac01);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xb9be[_0x3df9dd];return _0x4f11e4;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'name':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![],'unique':_0xeb9b('0x3')},'table':{'type':Sequelize[_0xeb9b('0x2')]},'metric':{'type':Sequelize[_0xeb9b('0x4')]},'description':{'type':Sequelize[_0xeb9b('0x2')]}}; \ No newline at end of file +var _0xddb8=['STRING','name','TEXT','exports'];(function(_0x53d657,_0xb7331f){var _0x283f51=function(_0x201a68){while(--_0x201a68){_0x53d657['push'](_0x53d657['shift']());}};_0x283f51(++_0xb7331f);}(_0xddb8,0xd7));var _0x8ddb=function(_0x1016f2,_0x1398c8){_0x1016f2=_0x1016f2-0x0;var _0x46406a=_0xddb8[_0x1016f2];return _0x46406a;};'use strict';var Sequelize=require('sequelize');module[_0x8ddb('0x0')]={'name':{'type':Sequelize[_0x8ddb('0x1')],'allowNull':![],'unique':_0x8ddb('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x8ddb('0x3')]},'description':{'type':Sequelize[_0x8ddb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index baec7f5..4ab3b78 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x3dde35,_0x2459ee){var _0x23f33d=function(_0x2cf59e){while(--_0x2cf59e){_0x3dde35['push'](_0x3dde35['shift']());}};_0x23f33d(++_0x2459ee);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0x24ca[_0x2df724];return _0x1b2504;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2749c3,_0x590e9e){var _0x55115c=function(_0x43f8e2){while(--_0x43f8e2){_0x2749c3['push'](_0x2749c3['shift']());}};_0x55115c(++_0x590e9e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x00bb[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 59b7354..8d26f16 100644 --- a/server/api/analyticMetric/analyticMetric.model.js +++ b/server/api/analyticMetric/analyticMetric.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f44=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','api','moment'];(function(_0x4057a1,_0x228a4a){var _0x292356=function(_0xed9d12){while(--_0xed9d12){_0x4057a1['push'](_0x4057a1['shift']());}};_0x292356(++_0x228a4a);}(_0x6f44,0x1ea));var _0x46f4=function(_0xae9a70,_0x1e6543){_0xae9a70=_0xae9a70-0x0;var _0x545cd6=_0x6f44[_0xae9a70];return _0x545cd6;};'use strict';var _=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var logger=require('../../config/logger')(_0x46f4('0x2'));var moment=require(_0x46f4('0x3'));var BPromise=require(_0x46f4('0x4'));var rp=require(_0x46f4('0x5'));var fs=require('fs');var path=require(_0x46f4('0x6'));var rimraf=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var attributes=require(_0x46f4('0x9'));module[_0x46f4('0xa')]=function(_0x57f1a9,_0x169a5a){return _0x57f1a9[_0x46f4('0xb')](_0x46f4('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xafc4,0x69));var _0x4afc=function(_0x49318b,_0x885bc6){_0x49318b=_0x49318b-0x0;var _0x326155=_0xafc4[_0x49318b];return _0x326155;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c6e7c1c..b26bcc8 100644 --- a/server/api/analyticMetric/analyticMetric.rpc.js +++ b/server/api/analyticMetric/analyticMetric.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6933=['jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','randomstring','../../config/utils','../../config/logger','../../config/environment'];(function(_0x37cb20,_0x4eb76f){var _0x593727=function(_0x1bbe0c){while(--_0x1bbe0c){_0x37cb20['push'](_0x37cb20['shift']());}};_0x593727(++_0x4eb76f);}(_0x6933,0x6d));var _0x3693=function(_0x25ddfa,_0xbc4e37){_0x25ddfa=_0x25ddfa-0x0;var _0x10ce7b=_0x6933[_0x25ddfa];return _0x10ce7b;};'use strict';var _=require(_0x3693('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3693('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3693('0x2'));var logger=require(_0x3693('0x3'))('rpc');var config=require(_0x3693('0x4'));var jayson=require(_0x3693('0x5'));var client=jayson[_0x3693('0x6')][_0x3693('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16da33,_0x12ef3f,_0x375392){return new BPromise(function(_0x523a47,_0x2b038e){return client[_0x3693('0x8')](_0x16da33,_0x375392)['then'](function(_0x42b214){logger[_0x3693('0x9')](_0x3693('0xa'),_0x12ef3f,'request\x20sent');logger[_0x3693('0xb')](_0x3693('0xc'),_0x12ef3f,_0x3693('0xd'),JSON[_0x3693('0xe')](_0x42b214));if(_0x42b214[_0x3693('0xf')]){if(_0x42b214[_0x3693('0xf')]['code']===0x1f4){logger[_0x3693('0xf')](_0x3693('0xa'),_0x12ef3f,_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);return _0x2b038e(_0x42b214['error']['message']);}logger[_0x3693('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x12ef3f,_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);return _0x523a47(_0x42b214[_0x3693('0xf')][_0x3693('0x10')]);}else{logger['info'](_0x3693('0xa'),_0x12ef3f,_0x3693('0xd'));_0x523a47(_0x42b214[_0x3693('0x11')][_0x3693('0x10')]);}})[_0x3693('0x12')](function(_0x105caa){logger[_0x3693('0xf')](_0x3693('0xa'),_0x12ef3f,_0x105caa);_0x2b038e(_0x105caa);});});} \ No newline at end of file +var _0x2d99=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1a962b,_0x221e6e){var _0x18f5fd=function(_0xa3d5d5){while(--_0xa3d5d5){_0x1a962b['push'](_0x1a962b['shift']());}};_0x18f5fd(++_0x221e6e);}(_0x2d99,0x1ea));var _0x92d9=function(_0x2b7b20,_0x5ccfc7){_0x2b7b20=_0x2b7b20-0x0;var _0x2ef9b5=_0x2d99[_0x2b7b20];return _0x2ef9b5;};'use strict';var _=require(_0x92d9('0x0'));var util=require('util');var moment=require(_0x92d9('0x1'));var BPromise=require(_0x92d9('0x2'));var rs=require(_0x92d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d9('0x4'))['db'];var utils=require(_0x92d9('0x5'));var logger=require(_0x92d9('0x6'))(_0x92d9('0x7'));var config=require(_0x92d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x92d9('0x9')][_0x92d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ede,_0x2c7381,_0x1c34c0){return new BPromise(function(_0x38bcf4,_0x5b0252){return client[_0x92d9('0xb')](_0x3e7ede,_0x1c34c0)[_0x92d9('0xc')](function(_0x4fbc2d){logger[_0x92d9('0xd')](_0x92d9('0xe'),_0x2c7381,_0x92d9('0xf'));logger[_0x92d9('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2c7381,'request\x20sent',JSON['stringify'](_0x4fbc2d));if(_0x4fbc2d['error']){if(_0x4fbc2d[_0x92d9('0x11')][_0x92d9('0x12')]===0x1f4){logger[_0x92d9('0x11')](_0x92d9('0xe'),_0x2c7381,_0x4fbc2d[_0x92d9('0x11')][_0x92d9('0x13')]);return _0x5b0252(_0x4fbc2d[_0x92d9('0x11')][_0x92d9('0x13')]);}logger[_0x92d9('0x11')](_0x92d9('0xe'),_0x2c7381,_0x4fbc2d[_0x92d9('0x11')][_0x92d9('0x13')]);return _0x38bcf4(_0x4fbc2d['error'][_0x92d9('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x2c7381,_0x92d9('0xf'));_0x38bcf4(_0x4fbc2d['result'][_0x92d9('0x13')]);}})['catch'](function(_0x460cd2){logger[_0x92d9('0x11')](_0x92d9('0xe'),_0x2c7381,_0x460cd2);_0x5b0252(_0x460cd2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9cf139c..1e6abc4 100644 --- a/server/api/analyticMetric/index.js +++ b/server/api/analyticMetric/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80c3=['isAuthenticated','post','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','get','/:id'];(function(_0x5b3f54,_0x228613){var _0x5c6bab=function(_0x2a7b4e){while(--_0x2a7b4e){_0x5b3f54['push'](_0x5b3f54['shift']());}};_0x5c6bab(++_0x228613);}(_0x80c3,0x18f));var _0x380c=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x80c3[_0x46a38b];return _0x346e75;};'use strict';var multer=require(_0x380c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x380c('0x1'));var express=require('express');var router=express[_0x380c('0x2')]();var fs_extra=require(_0x380c('0x3'));var auth=require(_0x380c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0x380c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x380c('0x5')](_0x380c('0x6'),auth[_0x380c('0x7')](),controller['show']);router[_0x380c('0x8')]('/',auth[_0x380c('0x7')](),controller['create']);router[_0x380c('0x9')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xa')]);router[_0x380c('0xb')](_0x380c('0x6'),auth['isAuthenticated'](),controller[_0x380c('0xc')]);module[_0x380c('0xd')]=router; \ No newline at end of file +var _0x5a93=['/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x5a93,0xf6));var _0x35a9=function(_0x5b13fb,_0x5ef173){_0x5b13fb=_0x5b13fb-0x0;var _0x40df23=_0x5a93[_0x5b13fb];return _0x40df23;};'use strict';var multer=require('multer');var util=require(_0x35a9('0x0'));var path=require('path');var timeout=require(_0x35a9('0x1'));var express=require(_0x35a9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x35a9('0x3'));var interaction=require(_0x35a9('0x4'));var config=require(_0x35a9('0x5'));var controller=require('./analyticMetric.controller');router[_0x35a9('0x6')]('/',auth[_0x35a9('0x7')](),controller[_0x35a9('0x8')]);router[_0x35a9('0x6')](_0x35a9('0x9'),auth[_0x35a9('0x7')](),controller[_0x35a9('0xa')]);router[_0x35a9('0xb')]('/',auth[_0x35a9('0x7')](),controller[_0x35a9('0xc')]);router[_0x35a9('0xd')](_0x35a9('0x9'),auth[_0x35a9('0x7')](),controller[_0x35a9('0xe')]);router[_0x35a9('0xf')](_0x35a9('0x9'),auth[_0x35a9('0x7')](),controller['destroy']);module[_0x35a9('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 624fcd3..9e64afb 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.attributes.js +++ b/server/api/analyticTreeReport/analyticTreeReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa100=['sequelize','TEXT'];(function(_0x42daca,_0x275738){var _0x94bcf4=function(_0x17bbb2){while(--_0x17bbb2){_0x42daca['push'](_0x42daca['shift']());}};_0x94bcf4(++_0x275738);}(_0xa100,0xb6));var _0x0a10=function(_0x2e8660,_0x5ca0c2){_0x2e8660=_0x2e8660-0x0;var _0x3dc331=_0xa100[_0x2e8660];return _0x3dc331;};'use strict';var Sequelize=require(_0x0a10('0x0'));module['exports']={'tree':{'type':Sequelize[_0x0a10('0x1')],'allowNull':![]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 959e112..b23973d 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.controller.js +++ b/server/api/analyticTreeReport/analyticTreeReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c73=['map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','AnalyticTreeReport','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1c73,0x106));var _0x31c7=function(_0x369ff2,_0x466a61){_0x369ff2=_0x369ff2-0x0;var _0xb53a59=_0x1c73[_0x369ff2];return _0xb53a59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x31c7('0x0'));var jsonpatch=require(_0x31c7('0x1'));var rp=require(_0x31c7('0x2'));var moment=require(_0x31c7('0x3'));var BPromise=require(_0x31c7('0x4'));var Mustache=require(_0x31c7('0x5'));var util=require('util');var path=require(_0x31c7('0x6'));var sox=require('sox');var csv=require(_0x31c7('0x7'));var ejs=require(_0x31c7('0x8'));var fs=require('fs');var fs_extra=require(_0x31c7('0x9'));var _=require(_0x31c7('0xa'));var squel=require(_0x31c7('0xb'));var crypto=require(_0x31c7('0xc'));var jsforce=require(_0x31c7('0xd'));var deskjs=require(_0x31c7('0xe'));var toCsv=require(_0x31c7('0x7'));var querystring=require(_0x31c7('0xf'));var Papa=require(_0x31c7('0x10'));var Redis=require(_0x31c7('0x11'));var authService=require(_0x31c7('0x12'));var qs=require(_0x31c7('0x13'));var as=require(_0x31c7('0x14'));var hardwareService=require(_0x31c7('0x15'));var logger=require(_0x31c7('0x16'))(_0x31c7('0x17'));var utils=require(_0x31c7('0x18'));var config=require(_0x31c7('0x19'));var licenseUtil=require(_0x31c7('0x1a'));var db=require(_0x31c7('0x1b'))['db'];function respondWithStatusCode(_0x24ceea,_0x58e89e){_0x58e89e=_0x58e89e||0xcc;return function(_0x22a0ef){if(_0x22a0ef){return _0x24ceea[_0x31c7('0x1c')](_0x58e89e);}return _0x24ceea[_0x31c7('0x1d')](_0x58e89e)[_0x31c7('0x1e')]();};}function respondWithResult(_0x4c4a23,_0x1383da){_0x1383da=_0x1383da||0xc8;return function(_0x254b71){if(_0x254b71){return _0x4c4a23[_0x31c7('0x1d')](_0x1383da)['json'](_0x254b71);}};}function respondWithFilteredResult(_0x2125dd,_0x1d4750){return function(_0x47a196){if(_0x47a196){var _0x4d09c7=typeof _0x1d4750[_0x31c7('0x1f')]==='undefined'&&typeof _0x1d4750[_0x31c7('0x20')]===_0x31c7('0x21');var _0x310df7=_0x47a196[_0x31c7('0x22')];var _0x3c7faf=_0x4d09c7?0x0:_0x1d4750['offset'];var _0x203f1e=_0x4d09c7?_0x47a196['count']:_0x1d4750[_0x31c7('0x1f')]+_0x1d4750[_0x31c7('0x20')];var _0x45362b;if(_0x203f1e>=_0x310df7){_0x203f1e=_0x310df7;_0x45362b=0xc8;}else{_0x45362b=0xce;}_0x2125dd[_0x31c7('0x1d')](_0x45362b);return _0x2125dd[_0x31c7('0x23')](_0x31c7('0x24'),_0x3c7faf+'-'+_0x203f1e+'/'+_0x310df7)['json'](_0x47a196);}return null;};}function patchUpdates(_0x57b9b2){return function(_0x190830){try{jsonpatch[_0x31c7('0x25')](_0x190830,_0x57b9b2,!![]);}catch(_0x31d128){return BPromise[_0x31c7('0x26')](_0x31d128);}return _0x190830['save']();};}function saveUpdates(_0x4e5186,_0x34e220){return function(_0x2c3a7b){if(_0x2c3a7b){return _0x2c3a7b[_0x31c7('0x27')](_0x4e5186)[_0x31c7('0x28')](function(_0x528b1f){return _0x528b1f;});}return null;};}function removeEntity(_0x50c758,_0x38d60b){return function(_0x4e3576){if(_0x4e3576){return _0x4e3576[_0x31c7('0x29')]()[_0x31c7('0x28')](function(){_0x50c758[_0x31c7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43dd4e,_0x387630){return function(_0x580797){if(!_0x580797){_0x43dd4e['sendStatus'](0x194);}return _0x580797;};}function handleError(_0x52a892,_0x40f1bf){_0x40f1bf=_0x40f1bf||0x1f4;return function(_0x53cd57){logger[_0x31c7('0x2a')](_0x53cd57[_0x31c7('0x2b')]);if(_0x53cd57[_0x31c7('0x2c')]){delete _0x53cd57[_0x31c7('0x2c')];}_0x52a892['status'](_0x40f1bf)['send'](_0x53cd57);};}exports[_0x31c7('0x2d')]=function(_0x44bfe2,_0x2f2bb8){var _0x503512={},_0x5bb7ba={},_0x2a45f3={'count':0x0,'rows':[]};var _0x4f678d=_[_0x31c7('0x2e')](db['AnalyticTreeReport'][_0x31c7('0x2f')],function(_0x44b6f1){return{'name':_0x44b6f1['fieldName'],'type':_0x44b6f1[_0x31c7('0x30')][_0x31c7('0x31')]};});_0x5bb7ba[_0x31c7('0x32')]=_[_0x31c7('0x2e')](_0x4f678d,_0x31c7('0x2c'));_0x5bb7ba[_0x31c7('0x33')]=_[_0x31c7('0x34')](_0x44bfe2[_0x31c7('0x33')]);_0x5bb7ba[_0x31c7('0x35')]=_['intersection'](_0x5bb7ba['model'],_0x5bb7ba[_0x31c7('0x33')]);_0x503512[_0x31c7('0x36')]=_['intersection'](_0x5bb7ba['model'],qs['fields'](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x37')]));_0x503512[_0x31c7('0x36')]=_0x503512[_0x31c7('0x36')][_0x31c7('0x38')]?_0x503512[_0x31c7('0x36')]:_0x5bb7ba['model'];if(!_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x39')](_0x31c7('0x3a'))){_0x503512['limit']=qs[_0x31c7('0x20')](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x20')]);_0x503512[_0x31c7('0x1f')]=qs[_0x31c7('0x1f')](_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x1f')]);}_0x503512['order']=qs[_0x31c7('0x3b')](_0x44bfe2['query'][_0x31c7('0x3b')]);_0x503512[_0x31c7('0x3c')]=qs[_0x31c7('0x35')](_[_0x31c7('0x3d')](_0x44bfe2[_0x31c7('0x33')],_0x5bb7ba[_0x31c7('0x35')]),_0x4f678d);if(_0x44bfe2[_0x31c7('0x33')][_0x31c7('0x3e')]){_0x503512['where']=_[_0x31c7('0x3f')](_0x503512[_0x31c7('0x3c')],{'$or':_[_0x31c7('0x2e')](_0x4f678d,function(_0x10ecc7){if(_0x10ecc7[_0x31c7('0x30')]!==_0x31c7('0x40')){var _0x2f13b0={};_0x2f13b0[_0x10ecc7[_0x31c7('0x2c')]]={'$like':'%'+_0x44bfe2['query'][_0x31c7('0x3e')]+'%'};return _0x2f13b0;}})});}_0x503512=_[_0x31c7('0x3f')]({},_0x503512,_0x44bfe2['options']);var _0x16e6b5={'where':_0x503512['where']};return db[_0x31c7('0x41')]['count'](_0x16e6b5)[_0x31c7('0x28')](function(_0x33caa2){_0x2a45f3['count']=_0x33caa2;if(_0x44bfe2['query']['includeAll']){_0x503512[_0x31c7('0x42')]=[{'all':!![]}];}return db[_0x31c7('0x41')][_0x31c7('0x43')](_0x503512);})[_0x31c7('0x28')](function(_0x5e1133){_0x2a45f3[_0x31c7('0x44')]=_0x5e1133;return _0x2a45f3;})['then'](respondWithFilteredResult(_0x2f2bb8,_0x503512))['catch'](handleError(_0x2f2bb8,null));};exports[_0x31c7('0x45')]=function(_0x4d36f0,_0x11e6b2){var _0x503740={'raw':!![],'where':{'id':_0x4d36f0[_0x31c7('0x46')]['id']}},_0x45a159={};_0x45a159[_0x31c7('0x32')]=_[_0x31c7('0x34')](db[_0x31c7('0x41')]['rawAttributes']);_0x45a159[_0x31c7('0x33')]=_['keys'](_0x4d36f0[_0x31c7('0x33')]);_0x45a159[_0x31c7('0x35')]=_[_0x31c7('0x47')](_0x45a159[_0x31c7('0x32')],_0x45a159[_0x31c7('0x33')]);_0x503740['attributes']=_[_0x31c7('0x47')](_0x45a159[_0x31c7('0x32')],qs['fields'](_0x4d36f0[_0x31c7('0x33')]['fields']));_0x503740[_0x31c7('0x36')]=_0x503740[_0x31c7('0x36')][_0x31c7('0x38')]?_0x503740[_0x31c7('0x36')]:_0x45a159[_0x31c7('0x32')];if(_0x4d36f0['query'][_0x31c7('0x48')]){_0x503740[_0x31c7('0x42')]=[{'all':!![]}];}_0x503740=_[_0x31c7('0x3f')]({},_0x503740,_0x4d36f0['options']);return db['AnalyticTreeReport'][_0x31c7('0x49')](_0x503740)[_0x31c7('0x28')](handleEntityNotFound(_0x11e6b2,null))[_0x31c7('0x28')](respondWithResult(_0x11e6b2,null))[_0x31c7('0x4a')](handleError(_0x11e6b2,null));};exports[_0x31c7('0x4b')]=function(_0x33b50c,_0x1da546){return db[_0x31c7('0x41')][_0x31c7('0x4b')](_0x33b50c[_0x31c7('0x4c')],{})['then'](respondWithResult(_0x1da546,0xc9))['catch'](handleError(_0x1da546,null));};exports['update']=function(_0x3e5671,_0x1016c1){if(_0x3e5671['body']['id']){delete _0x3e5671[_0x31c7('0x4c')]['id'];}return db[_0x31c7('0x41')]['find']({'where':{'id':_0x3e5671[_0x31c7('0x46')]['id']}})[_0x31c7('0x28')](handleEntityNotFound(_0x1016c1,null))[_0x31c7('0x28')](saveUpdates(_0x3e5671[_0x31c7('0x4c')],null))[_0x31c7('0x28')](respondWithResult(_0x1016c1,null))[_0x31c7('0x4a')](handleError(_0x1016c1,null));};exports[_0x31c7('0x29')]=function(_0x53e425,_0x17cd17){return db['AnalyticTreeReport']['find']({'where':{'id':_0x53e425[_0x31c7('0x46')]['id']}})['then'](handleEntityNotFound(_0x17cd17,null))[_0x31c7('0x28')](removeEntity(_0x17cd17,null))[_0x31c7('0x4a')](handleError(_0x17cd17,null));}; \ No newline at end of file +var _0xa287=['update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','params','includeAll','find','catch','create','body'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa287,0x16e));var _0x7a28=function(_0x36284b,_0x2b7436){_0x36284b=_0x36284b-0x0;var _0x23c34a=_0xa287[_0x36284b];return _0x23c34a;};'use strict';var emlformat=require(_0x7a28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a28('0x1'));var jsonpatch=require(_0x7a28('0x2'));var rp=require(_0x7a28('0x3'));var moment=require('moment');var BPromise=require(_0x7a28('0x4'));var Mustache=require(_0x7a28('0x5'));var util=require('util');var path=require(_0x7a28('0x6'));var sox=require(_0x7a28('0x7'));var csv=require('to-csv');var ejs=require(_0x7a28('0x8'));var fs=require('fs');var fs_extra=require(_0x7a28('0x9'));var _=require(_0x7a28('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7a28('0xb'));var toCsv=require(_0x7a28('0xc'));var querystring=require(_0x7a28('0xd'));var Papa=require(_0x7a28('0xe'));var Redis=require('ioredis');var authService=require(_0x7a28('0xf'));var qs=require(_0x7a28('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a28('0x11'));var logger=require(_0x7a28('0x12'))('api');var utils=require(_0x7a28('0x13'));var config=require(_0x7a28('0x14'));var licenseUtil=require(_0x7a28('0x15'));var db=require(_0x7a28('0x16'))['db'];function respondWithStatusCode(_0x5f3cf0,_0x57120c){_0x57120c=_0x57120c||0xcc;return function(_0x1168e8){if(_0x1168e8){return _0x5f3cf0[_0x7a28('0x17')](_0x57120c);}return _0x5f3cf0[_0x7a28('0x18')](_0x57120c)[_0x7a28('0x19')]();};}function respondWithResult(_0x458179,_0x5b6014){_0x5b6014=_0x5b6014||0xc8;return function(_0x2568a7){if(_0x2568a7){return _0x458179[_0x7a28('0x18')](_0x5b6014)[_0x7a28('0x1a')](_0x2568a7);}};}function respondWithFilteredResult(_0x5df3b7,_0x136993){return function(_0x430e80){if(_0x430e80){var _0x2e1c90=typeof _0x136993[_0x7a28('0x1b')]==='undefined'&&typeof _0x136993['limit']===_0x7a28('0x1c');var _0x4c6243=_0x430e80[_0x7a28('0x1d')];var _0x435175=_0x2e1c90?0x0:_0x136993[_0x7a28('0x1b')];var _0x313c9f=_0x2e1c90?_0x430e80[_0x7a28('0x1d')]:_0x136993[_0x7a28('0x1b')]+_0x136993['limit'];var _0x31ce4b;if(_0x313c9f>=_0x4c6243){_0x313c9f=_0x4c6243;_0x31ce4b=0xc8;}else{_0x31ce4b=0xce;}_0x5df3b7[_0x7a28('0x18')](_0x31ce4b);return _0x5df3b7['set'](_0x7a28('0x1e'),_0x435175+'-'+_0x313c9f+'/'+_0x4c6243)[_0x7a28('0x1a')](_0x430e80);}return null;};}function patchUpdates(_0x57ea5e){return function(_0x5bb61d){try{jsonpatch[_0x7a28('0x1f')](_0x5bb61d,_0x57ea5e,!![]);}catch(_0x58dcdb){return BPromise[_0x7a28('0x20')](_0x58dcdb);}return _0x5bb61d[_0x7a28('0x21')]();};}function saveUpdates(_0x1ec0fd,_0x4eb730){return function(_0x5b783c){if(_0x5b783c){return _0x5b783c['update'](_0x1ec0fd)[_0x7a28('0x22')](function(_0x1d5421){return _0x1d5421;});}return null;};}function removeEntity(_0x3df235,_0x47788a){return function(_0x543048){if(_0x543048){return _0x543048[_0x7a28('0x23')]()[_0x7a28('0x22')](function(){_0x3df235[_0x7a28('0x18')](0xcc)[_0x7a28('0x19')]();});}};}function handleEntityNotFound(_0x2252d2,_0x52375c){return function(_0x1cd8a8){if(!_0x1cd8a8){_0x2252d2[_0x7a28('0x17')](0x194);}return _0x1cd8a8;};}function handleError(_0x37f1a6,_0x344557){_0x344557=_0x344557||0x1f4;return function(_0x33c831){logger['error'](_0x33c831[_0x7a28('0x24')]);if(_0x33c831[_0x7a28('0x25')]){delete _0x33c831[_0x7a28('0x25')];}_0x37f1a6[_0x7a28('0x18')](_0x344557)[_0x7a28('0x26')](_0x33c831);};}exports[_0x7a28('0x27')]=function(_0x1cdbef,_0x537233){var _0x1b6e2b={},_0x2c79db={},_0x56fb11={'count':0x0,'rows':[]};var _0x200622=_[_0x7a28('0x28')](db[_0x7a28('0x29')][_0x7a28('0x2a')],function(_0x23a9f9){return{'name':_0x23a9f9[_0x7a28('0x2b')],'type':_0x23a9f9[_0x7a28('0x2c')][_0x7a28('0x2d')]};});_0x2c79db[_0x7a28('0x2e')]=_['map'](_0x200622,_0x7a28('0x25'));_0x2c79db['query']=_[_0x7a28('0x2f')](_0x1cdbef[_0x7a28('0x30')]);_0x2c79db['filters']=_[_0x7a28('0x31')](_0x2c79db[_0x7a28('0x2e')],_0x2c79db[_0x7a28('0x30')]);_0x1b6e2b[_0x7a28('0x32')]=_[_0x7a28('0x31')](_0x2c79db[_0x7a28('0x2e')],qs[_0x7a28('0x33')](_0x1cdbef[_0x7a28('0x30')][_0x7a28('0x33')]));_0x1b6e2b[_0x7a28('0x32')]=_0x1b6e2b['attributes'][_0x7a28('0x34')]?_0x1b6e2b[_0x7a28('0x32')]:_0x2c79db[_0x7a28('0x2e')];if(!_0x1cdbef['query'][_0x7a28('0x35')](_0x7a28('0x36'))){_0x1b6e2b['limit']=qs['limit'](_0x1cdbef['query']['limit']);_0x1b6e2b['offset']=qs[_0x7a28('0x1b')](_0x1cdbef[_0x7a28('0x30')][_0x7a28('0x1b')]);}_0x1b6e2b[_0x7a28('0x37')]=qs[_0x7a28('0x38')](_0x1cdbef[_0x7a28('0x30')]['sort']);_0x1b6e2b[_0x7a28('0x39')]=qs['filters'](_[_0x7a28('0x3a')](_0x1cdbef['query'],_0x2c79db['filters']),_0x200622);if(_0x1cdbef[_0x7a28('0x30')]['filter']){_0x1b6e2b[_0x7a28('0x39')]=_['merge'](_0x1b6e2b[_0x7a28('0x39')],{'$or':_[_0x7a28('0x28')](_0x200622,function(_0x41bf6b){if(_0x41bf6b[_0x7a28('0x2c')]!==_0x7a28('0x3b')){var _0x56ca9b={};_0x56ca9b[_0x41bf6b[_0x7a28('0x25')]]={'$like':'%'+_0x1cdbef[_0x7a28('0x30')][_0x7a28('0x3c')]+'%'};return _0x56ca9b;}})});}_0x1b6e2b=_[_0x7a28('0x3d')]({},_0x1b6e2b,_0x1cdbef[_0x7a28('0x3e')]);var _0x4b2213={'where':_0x1b6e2b[_0x7a28('0x39')]};return db[_0x7a28('0x29')][_0x7a28('0x1d')](_0x4b2213)[_0x7a28('0x22')](function(_0x12f2ed){_0x56fb11[_0x7a28('0x1d')]=_0x12f2ed;if(_0x1cdbef['query']['includeAll']){_0x1b6e2b[_0x7a28('0x3f')]=[{'all':!![]}];}return db[_0x7a28('0x29')][_0x7a28('0x40')](_0x1b6e2b);})[_0x7a28('0x22')](function(_0x5f8660){_0x56fb11[_0x7a28('0x41')]=_0x5f8660;return _0x56fb11;})['then'](respondWithFilteredResult(_0x537233,_0x1b6e2b))['catch'](handleError(_0x537233,null));};exports['show']=function(_0x5a6205,_0x4ea06d){var _0x2e1be0={'raw':!![],'where':{'id':_0x5a6205[_0x7a28('0x42')]['id']}},_0x9e166f={};_0x9e166f[_0x7a28('0x2e')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x9e166f[_0x7a28('0x30')]=_['keys'](_0x5a6205['query']);_0x9e166f['filters']=_[_0x7a28('0x31')](_0x9e166f[_0x7a28('0x2e')],_0x9e166f[_0x7a28('0x30')]);_0x2e1be0['attributes']=_[_0x7a28('0x31')](_0x9e166f[_0x7a28('0x2e')],qs[_0x7a28('0x33')](_0x5a6205[_0x7a28('0x30')][_0x7a28('0x33')]));_0x2e1be0[_0x7a28('0x32')]=_0x2e1be0[_0x7a28('0x32')][_0x7a28('0x34')]?_0x2e1be0[_0x7a28('0x32')]:_0x9e166f[_0x7a28('0x2e')];if(_0x5a6205[_0x7a28('0x30')][_0x7a28('0x43')]){_0x2e1be0[_0x7a28('0x3f')]=[{'all':!![]}];}_0x2e1be0=_[_0x7a28('0x3d')]({},_0x2e1be0,_0x5a6205['options']);return db['AnalyticTreeReport'][_0x7a28('0x44')](_0x2e1be0)[_0x7a28('0x22')](handleEntityNotFound(_0x4ea06d,null))[_0x7a28('0x22')](respondWithResult(_0x4ea06d,null))[_0x7a28('0x45')](handleError(_0x4ea06d,null));};exports[_0x7a28('0x46')]=function(_0x2e0610,_0x4cbaf4){return db[_0x7a28('0x29')][_0x7a28('0x46')](_0x2e0610[_0x7a28('0x47')],{})[_0x7a28('0x22')](respondWithResult(_0x4cbaf4,0xc9))[_0x7a28('0x45')](handleError(_0x4cbaf4,null));};exports[_0x7a28('0x48')]=function(_0x4094a5,_0x12e69d){if(_0x4094a5[_0x7a28('0x47')]['id']){delete _0x4094a5[_0x7a28('0x47')]['id'];}return db['AnalyticTreeReport'][_0x7a28('0x44')]({'where':{'id':_0x4094a5[_0x7a28('0x42')]['id']}})['then'](handleEntityNotFound(_0x12e69d,null))[_0x7a28('0x22')](saveUpdates(_0x4094a5[_0x7a28('0x47')],null))[_0x7a28('0x22')](respondWithResult(_0x12e69d,null))['catch'](handleError(_0x12e69d,null));};exports[_0x7a28('0x23')]=function(_0x15f95d,_0x2790eb){return db[_0x7a28('0x29')][_0x7a28('0x44')]({'where':{'id':_0x15f95d[_0x7a28('0x42')]['id']}})[_0x7a28('0x22')](handleEntityNotFound(_0x2790eb,null))[_0x7a28('0x22')](removeEntity(_0x2790eb,null))[_0x7a28('0x45')](handleError(_0x2790eb,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d897e62..786d432 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.model.js +++ b/server/api/analyticTreeReport/analyticTreeReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6cb8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','util','../../config/logger','api'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x6cb8,0x141));var _0x86cb=function(_0x9d4f38,_0x1e0c77){_0x9d4f38=_0x9d4f38-0x0;var _0x1f211d=_0x6cb8[_0x9d4f38];return _0x1f211d;};'use strict';var _=require('lodash');var util=require(_0x86cb('0x0'));var logger=require(_0x86cb('0x1'))(_0x86cb('0x2'));var moment=require(_0x86cb('0x3'));var BPromise=require(_0x86cb('0x4'));var rp=require(_0x86cb('0x5'));var fs=require('fs');var path=require(_0x86cb('0x6'));var rimraf=require(_0x86cb('0x7'));var config=require(_0x86cb('0x8'));var attributes=require(_0x86cb('0x9'));module[_0x86cb('0xa')]=function(_0xcd813d,_0x540f2a){return _0xcd813d[_0x86cb('0xb')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09eb=['AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2342f9,_0x58e9c6){var _0x2ffb6a=function(_0xf597e3){while(--_0xf597e3){_0x2342f9['push'](_0x2342f9['shift']());}};_0x2ffb6a(++_0x58e9c6);}(_0x09eb,0xe3));var _0xb09e=function(_0x5cd395,_0x507285){_0x5cd395=_0x5cd395-0x0;var _0x141227=_0x09eb[_0x5cd395];return _0x141227;};'use strict';var _=require('lodash');var util=require(_0xb09e('0x0'));var logger=require(_0xb09e('0x1'))(_0xb09e('0x2'));var moment=require(_0xb09e('0x3'));var BPromise=require(_0xb09e('0x4'));var rp=require(_0xb09e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb09e('0x6'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x5b4f0d,_0x506a35){return _0x5b4f0d['define'](_0xb09e('0x7'),attributes,{'tableName':_0xb09e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 5d41d94..f780d42 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x437286,_0x4559e1){var _0x16aade=function(_0x2cd071){while(--_0x2cd071){_0x437286['push'](_0x437286['shift']());}};_0x16aade(++_0x4559e1);}(_0xdb28,0x106));var _0x8db2=function(_0x5c5ffc,_0x27dccd){_0x5c5ffc=_0x5c5ffc-0x0;var _0x4b698c=_0xdb28[_0x5c5ffc];return _0x4b698c;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2c91c0,_0x5c9ae0){var _0x52d1c6=function(_0x5dfe21){while(--_0x5dfe21){_0x2c91c0['push'](_0x2c91c0['shift']());}};_0x52d1c6(++_0x5c9ae0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2dbce7,_0x57cb8d){_0x2dbce7=_0x2dbce7-0x0;var _0x3a3ed0=_0x5f2f[_0x2dbce7];return _0x3a3ed0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 90f51b3..9b08704 100644 --- a/server/api/analyticTreeReport/index.js +++ b/server/api/analyticTreeReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedb5=['show','post','create','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x5609ba,_0x1b7c6c){var _0x202f01=function(_0x239a8a){while(--_0x239a8a){_0x5609ba['push'](_0x5609ba['shift']());}};_0x202f01(++_0x1b7c6c);}(_0xedb5,0x1bf));var _0x5edb=function(_0x4ffb07,_0x31b18b){_0x4ffb07=_0x4ffb07-0x0;var _0x37a523=_0xedb5[_0x4ffb07];return _0x37a523;};'use strict';var multer=require(_0x5edb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5edb('0x1'));var express=require(_0x5edb('0x2'));var router=express[_0x5edb('0x3')]();var fs_extra=require(_0x5edb('0x4'));var auth=require(_0x5edb('0x5'));var interaction=require(_0x5edb('0x6'));var config=require(_0x5edb('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x5edb('0x8')]('/',auth['isAuthenticated'](),controller[_0x5edb('0x9')]);router['get'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0xc')]);router[_0x5edb('0xd')]('/',auth['isAuthenticated'](),controller[_0x5edb('0xe')]);router['put'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0xf')]);router['delete'](_0x5edb('0xa'),auth[_0x5edb('0xb')](),controller[_0x5edb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x29e3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','show','isAuthenticated','create','put','update','destroy','exports','path','connect-timeout','express'];(function(_0x4651ae,_0x3d2bc0){var _0x29a97c=function(_0xf05c25){while(--_0xf05c25){_0x4651ae['push'](_0x4651ae['shift']());}};_0x29a97c(++_0x3d2bc0);}(_0x29e3,0x66));var _0x329e=function(_0x4a5a52,_0x35c23a){_0x4a5a52=_0x4a5a52-0x0;var _0x25c715=_0x29e3[_0x4a5a52];return _0x25c715;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x329e('0x0'));var timeout=require(_0x329e('0x1'));var express=require(_0x329e('0x2'));var router=express[_0x329e('0x3')]();var fs_extra=require(_0x329e('0x4'));var auth=require(_0x329e('0x5'));var interaction=require(_0x329e('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x329e('0x7'),auth['isAuthenticated'](),controller[_0x329e('0x8')]);router['post']('/',auth[_0x329e('0x9')](),controller[_0x329e('0xa')]);router[_0x329e('0xb')](_0x329e('0x7'),auth[_0x329e('0x9')](),controller[_0x329e('0xc')]);router['delete'](_0x329e('0x7'),auth['isAuthenticated'](),controller[_0x329e('0xd')]);module[_0x329e('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index b62fd8c..7eac90f 100644 --- a/server/api/attachment/attachment.attributes.js +++ b/server/api/attachment/attachment.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4853=['STRING','exports'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x3485('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x3485('0x1')]},'type':{'type':Sequelize[_0x3485('0x1')]}}; \ No newline at end of file +var _0xd0b5=['STRING'];(function(_0x31b224,_0x4fcb3f){var _0x2087bb=function(_0x275767){while(--_0x275767){_0x31b224['push'](_0x31b224['shift']());}};_0x2087bb(++_0x4fcb3f);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x334d57,_0x52d2e5){_0x334d57=_0x334d57-0x0;var _0x127346=_0xd0b5[_0x334d57];return _0x127346;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5d0b('0x0')]},'basename':{'type':Sequelize[_0x5d0b('0x0')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5b4d855..c394250 100644 --- a/server/api/attachment/attachment.controller.js +++ b/server/api/attachment/attachment.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57e9=['jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','get','createdAt','updatedAt','omit','body','create','params','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto'];(function(_0x19d54e,_0x54aec7){var _0x3b9d70=function(_0xfb970c){while(--_0xfb970c){_0x19d54e['push'](_0x19d54e['shift']());}};_0x3b9d70(++_0x54aec7);}(_0x57e9,0x1ab));var _0x957e=function(_0x17f2df,_0x29d0fd){_0x17f2df=_0x17f2df-0x0;var _0x59b3c1=_0x57e9[_0x17f2df];return _0x59b3c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x957e('0x0'));var zipdir=require(_0x957e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x957e('0x2'));var moment=require(_0x957e('0x3'));var BPromise=require(_0x957e('0x4'));var Mustache=require(_0x957e('0x5'));var util=require(_0x957e('0x6'));var path=require(_0x957e('0x7'));var sox=require(_0x957e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x957e('0x9'));var _=require(_0x957e('0xa'));var squel=require(_0x957e('0xb'));var crypto=require(_0x957e('0xc'));var jsforce=require(_0x957e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x957e('0xe'));var querystring=require(_0x957e('0xf'));var Papa=require(_0x957e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x957e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x957e('0x12'));var logger=require(_0x957e('0x13'))(_0x957e('0x14'));var utils=require(_0x957e('0x15'));var config=require(_0x957e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x957e('0x17'))['db'];function respondWithStatusCode(_0x3fe3d7,_0x2df447){_0x2df447=_0x2df447||0xcc;return function(_0x271a5a){if(_0x271a5a){return _0x3fe3d7['sendStatus'](_0x2df447);}return _0x3fe3d7[_0x957e('0x18')](_0x2df447)[_0x957e('0x19')]();};}function respondWithResult(_0x5e6235,_0x5bfb36){_0x5bfb36=_0x5bfb36||0xc8;return function(_0x2bf67e){if(_0x2bf67e){return _0x5e6235[_0x957e('0x18')](_0x5bfb36)['json'](_0x2bf67e);}};}function respondWithFilteredResult(_0x3cdd0a,_0x9867ef){return function(_0x57bded){if(_0x57bded){var _0x85b7fe=typeof _0x9867ef[_0x957e('0x1a')]===_0x957e('0x1b')&&typeof _0x9867ef[_0x957e('0x1c')]===_0x957e('0x1b');var _0x39ed19=_0x57bded['count'];var _0x46bf8a=_0x85b7fe?0x0:_0x9867ef[_0x957e('0x1a')];var _0x34a368=_0x85b7fe?_0x57bded[_0x957e('0x1d')]:_0x9867ef[_0x957e('0x1a')]+_0x9867ef[_0x957e('0x1c')];var _0x50d278;if(_0x34a368>=_0x39ed19){_0x34a368=_0x39ed19;_0x50d278=0xc8;}else{_0x50d278=0xce;}_0x3cdd0a[_0x957e('0x18')](_0x50d278);return _0x3cdd0a[_0x957e('0x1e')](_0x957e('0x1f'),_0x46bf8a+'-'+_0x34a368+'/'+_0x39ed19)['json'](_0x57bded);}return null;};}function patchUpdates(_0x2f8fcf){return function(_0x1c7cc8){try{jsonpatch[_0x957e('0x20')](_0x1c7cc8,_0x2f8fcf,!![]);}catch(_0x531390){return BPromise['reject'](_0x531390);}return _0x1c7cc8[_0x957e('0x21')]();};}function saveUpdates(_0x21b78f,_0x49fd52){return function(_0x489b5e){if(_0x489b5e){return _0x489b5e[_0x957e('0x22')](_0x21b78f)[_0x957e('0x23')](function(_0x3c1300){return _0x3c1300;});}return null;};}function removeEntity(_0x5a58c5,_0x5e34ae){return function(_0x15bac3){if(_0x15bac3){return _0x15bac3[_0x957e('0x24')]()['then'](function(){_0x5a58c5[_0x957e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257299,_0x3af39a){return function(_0x2516bd){if(!_0x2516bd){_0x257299[_0x957e('0x25')](0x194);}return _0x2516bd;};}function handleError(_0xa166eb,_0xe4a855){_0xe4a855=_0xe4a855||0x1f4;return function(_0x558c0f){logger['error'](_0x558c0f[_0x957e('0x26')]);if(_0x558c0f[_0x957e('0x27')]){delete _0x558c0f['name'];}_0xa166eb[_0x957e('0x18')](_0xe4a855)[_0x957e('0x28')](_0x558c0f);};}exports[_0x957e('0x29')]=function(_0x115bba,_0x3080cf){var _0x529e8e={},_0x2253a4={},_0x1491cd={'count':0x0,'rows':[]};var _0x2af578=_[_0x957e('0x2a')](db[_0x957e('0x2b')][_0x957e('0x2c')],function(_0x3e1ba4){return{'name':_0x3e1ba4[_0x957e('0x2d')],'type':_0x3e1ba4[_0x957e('0x2e')][_0x957e('0x2f')]};});_0x2253a4['model']=_['map'](_0x2af578,_0x957e('0x27'));_0x2253a4['query']=_[_0x957e('0x30')](_0x115bba[_0x957e('0x31')]);_0x2253a4[_0x957e('0x32')]=_[_0x957e('0x33')](_0x2253a4[_0x957e('0x34')],_0x2253a4[_0x957e('0x31')]);_0x529e8e[_0x957e('0x35')]=_[_0x957e('0x33')](_0x2253a4[_0x957e('0x34')],qs['fields'](_0x115bba['query'][_0x957e('0x36')]));_0x529e8e[_0x957e('0x35')]=_0x529e8e[_0x957e('0x35')][_0x957e('0x37')]?_0x529e8e[_0x957e('0x35')]:_0x2253a4[_0x957e('0x34')];if(!_0x115bba['query'][_0x957e('0x38')](_0x957e('0x39'))){_0x529e8e[_0x957e('0x1c')]=qs['limit'](_0x115bba[_0x957e('0x31')][_0x957e('0x1c')]);_0x529e8e[_0x957e('0x1a')]=qs[_0x957e('0x1a')](_0x115bba[_0x957e('0x31')]['offset']);}_0x529e8e[_0x957e('0x3a')]=qs['sort'](_0x115bba['query']['sort']);_0x529e8e[_0x957e('0x3b')]=qs[_0x957e('0x32')](_[_0x957e('0x3c')](_0x115bba[_0x957e('0x31')],_0x2253a4[_0x957e('0x32')]),_0x2af578);if(_0x115bba[_0x957e('0x31')][_0x957e('0x3d')]){_0x529e8e[_0x957e('0x3b')]=_[_0x957e('0x3e')](_0x529e8e['where'],{'$or':_['map'](_0x2af578,function(_0x228053){if(_0x228053[_0x957e('0x2e')]!==_0x957e('0x3f')){var _0x1d141a={};_0x1d141a[_0x228053['name']]={'$like':'%'+_0x115bba['query'][_0x957e('0x3d')]+'%'};return _0x1d141a;}})});}_0x529e8e=_[_0x957e('0x3e')]({},_0x529e8e,_0x115bba[_0x957e('0x40')]);var _0x19f738={'where':_0x529e8e[_0x957e('0x3b')]};return db[_0x957e('0x2b')]['count'](_0x19f738)[_0x957e('0x23')](function(_0x31732b){_0x1491cd[_0x957e('0x1d')]=_0x31732b;if(_0x115bba[_0x957e('0x31')][_0x957e('0x41')]){_0x529e8e['include']=[{'all':!![]}];}return db[_0x957e('0x2b')]['findAll'](_0x529e8e);})[_0x957e('0x23')](function(_0x35da21){_0x1491cd['rows']=_0x35da21;return _0x1491cd;})[_0x957e('0x23')](respondWithFilteredResult(_0x3080cf,_0x529e8e))['catch'](handleError(_0x3080cf,null));};exports['show']=function(_0x4d4940,_0x37b073){var _0x4d5a4e={'raw':!![],'where':{'id':_0x4d4940['params']['id']}},_0x496125={};_0x496125[_0x957e('0x34')]=_['keys'](db[_0x957e('0x2b')][_0x957e('0x2c')]);_0x496125['query']=_[_0x957e('0x30')](_0x4d4940[_0x957e('0x31')]);_0x496125[_0x957e('0x32')]=_[_0x957e('0x33')](_0x496125[_0x957e('0x34')],_0x496125['query']);_0x4d5a4e[_0x957e('0x35')]=_[_0x957e('0x33')](_0x496125['model'],qs[_0x957e('0x36')](_0x4d4940[_0x957e('0x31')]['fields']));_0x4d5a4e['attributes']=_0x4d5a4e[_0x957e('0x35')][_0x957e('0x37')]?_0x4d5a4e[_0x957e('0x35')]:_0x496125[_0x957e('0x34')];if(_0x4d4940[_0x957e('0x31')][_0x957e('0x41')]){_0x4d5a4e[_0x957e('0x42')]=[{'all':!![]}];}_0x4d5a4e=_[_0x957e('0x3e')]({},_0x4d5a4e,_0x4d4940[_0x957e('0x40')]);return db[_0x957e('0x2b')]['find'](_0x4d5a4e)['then'](handleEntityNotFound(_0x37b073,null))[_0x957e('0x23')](respondWithResult(_0x37b073,null))[_0x957e('0x43')](handleError(_0x37b073,null));};exports['clone']=function(_0x38b8c6,_0x193d8c){var _0x1487c3={'where':{'id':_0x38b8c6['params']['id']}},_0x5080a6={};_0x5080a6[_0x957e('0x34')]=_[_0x957e('0x30')](db['Attachment'][_0x957e('0x2c')]);_0x1487c3[_0x957e('0x35')]=_[_0x957e('0x33')](_0x5080a6[_0x957e('0x34')],qs['fields'](_0x38b8c6[_0x957e('0x31')][_0x957e('0x36')]));_0x1487c3[_0x957e('0x35')]=_0x1487c3[_0x957e('0x35')][_0x957e('0x37')]?_0x1487c3['attributes']:_0x5080a6[_0x957e('0x34')];if(_0x38b8c6[_0x957e('0x31')]['includeAll']){_0x1487c3['include']=[{'all':!![]}];}_0x1487c3=_['merge']({},_0x1487c3,_0x38b8c6[_0x957e('0x40')]);return db['Attachment'][_0x957e('0x44')](_0x1487c3)['then'](handleEntityNotFound(_0x193d8c,null))[_0x957e('0x23')](function(_0x58a3fa){if(_0x58a3fa){var _0x54123b=_0x58a3fa[_0x957e('0x45')]({'plain':!![]});_0x54123b=qs['omit'](_0x54123b,['id',_0x957e('0x46'),_0x957e('0x47')]);_0x38b8c6['body']=_[_0x957e('0x48')](_0x38b8c6[_0x957e('0x49')],['id',_0x957e('0x46'),_0x957e('0x47')]);return db[_0x957e('0x2b')][_0x957e('0x4a')](_[_0x957e('0x3e')](_0x54123b,_0x38b8c6[_0x957e('0x49')]),{'include':_0x38b8c6[_0x957e('0x31')][_0x957e('0x41')]?[{'all':!![]}]:undefined});}})[_0x957e('0x23')](respondWithResult(_0x193d8c,0xc9))[_0x957e('0x43')](handleError(_0x193d8c,null));};exports[_0x957e('0x22')]=function(_0x2bd401,_0x564618){if(_0x2bd401[_0x957e('0x49')]['id']){delete _0x2bd401[_0x957e('0x49')]['id'];}return db[_0x957e('0x2b')][_0x957e('0x44')]({'where':{'id':_0x2bd401[_0x957e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x564618,null))[_0x957e('0x23')](saveUpdates(_0x2bd401['body'],null))[_0x957e('0x23')](respondWithResult(_0x564618,null))[_0x957e('0x43')](handleError(_0x564618,null));};exports[_0x957e('0x24')]=function(_0x5b3e44,_0x522b78){return db[_0x957e('0x2b')][_0x957e('0x44')]({'where':{'id':_0x5b3e44[_0x957e('0x4b')]['id']}})[_0x957e('0x23')](handleEntityNotFound(_0x522b78,null))[_0x957e('0x23')](removeEntity(_0x522b78,null))[_0x957e('0x43')](handleError(_0x522b78,null));};exports['create']=function(_0x52f674,_0x173dc6,_0x1297b0){_0x52f674[_0x957e('0x49')]['name']=_0x52f674[_0x957e('0x4c')][_0x957e('0x4d')];_0x52f674[_0x957e('0x49')]['basename']=_0x52f674[_0x957e('0x4c')][_0x957e('0x4e')];_0x52f674['body'][_0x957e('0x2e')]=_0x52f674[_0x957e('0x4c')][_0x957e('0x4f')];return db['Attachment'][_0x957e('0x4a')](_0x52f674[_0x957e('0x49')])[_0x957e('0x23')](respondWithResult(_0x173dc6,0xc9))[_0x957e('0x43')](handleError(_0x173dc6,null));};exports[_0x957e('0x50')]=function(_0x43b983,_0x17acd9,_0xab00ce){return db[_0x957e('0x2b')][_0x957e('0x51')]({'where':{'id':_0x43b983[_0x957e('0x4b')]['id']},'raw':!![]})[_0x957e('0x23')](handleEntityNotFound(_0x17acd9,null))[_0x957e('0x23')](function(_0x218a9a){if(_0x218a9a){var _0x3ff58f=_0x218a9a[_0x957e('0x52')]!==null;var _0x271cf4=path[_0x957e('0x53')](config[_0x957e('0x54')],_0x957e('0x55'));if(_0x3ff58f){_0x271cf4=path['join'](_0x271cf4,_0x957e('0x56'));}var _0x386740=path[_0x957e('0x53')](_0x271cf4,_0x218a9a[_0x957e('0x57')]);return _0x17acd9[_0x957e('0x50')](_0x386740);}})['catch'](handleError(_0x17acd9,null));}; \ No newline at end of file +var _0x9ab9=['updatedAt','omit','body','create','catch','destroy','file','originalname','filename','mimetype','download','findOne','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','clone','get','createdAt'];(function(_0x5a736d,_0x169014){var _0x531bf5=function(_0x3b9453){while(--_0x3b9453){_0x5a736d['push'](_0x5a736d['shift']());}};_0x531bf5(++_0x169014);}(_0x9ab9,0x121));var _0x99ab=function(_0x2bff8a,_0x142d13){_0x2bff8a=_0x2bff8a-0x0;var _0x24e772=_0x9ab9[_0x2bff8a];return _0x24e772;};'use strict';var emlformat=require(_0x99ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99ab('0x1'));var jsonpatch=require(_0x99ab('0x2'));var rp=require('request-promise');var moment=require(_0x99ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99ab('0x4'));var util=require(_0x99ab('0x5'));var path=require(_0x99ab('0x6'));var sox=require(_0x99ab('0x7'));var csv=require(_0x99ab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99ab('0x9'));var _=require(_0x99ab('0xa'));var squel=require(_0x99ab('0xb'));var crypto=require(_0x99ab('0xc'));var jsforce=require(_0x99ab('0xd'));var deskjs=require(_0x99ab('0xe'));var toCsv=require(_0x99ab('0x8'));var querystring=require('querystring');var Papa=require(_0x99ab('0xf'));var Redis=require(_0x99ab('0x10'));var authService=require(_0x99ab('0x11'));var qs=require(_0x99ab('0x12'));var as=require(_0x99ab('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x99ab('0x14'));var utils=require(_0x99ab('0x15'));var config=require(_0x99ab('0x16'));var licenseUtil=require(_0x99ab('0x17'));var db=require(_0x99ab('0x18'))['db'];function respondWithStatusCode(_0x3120e2,_0xb3641e){_0xb3641e=_0xb3641e||0xcc;return function(_0x13cbd4){if(_0x13cbd4){return _0x3120e2[_0x99ab('0x19')](_0xb3641e);}return _0x3120e2['status'](_0xb3641e)[_0x99ab('0x1a')]();};}function respondWithResult(_0x1a09fa,_0x5120be){_0x5120be=_0x5120be||0xc8;return function(_0x20b625){if(_0x20b625){return _0x1a09fa[_0x99ab('0x1b')](_0x5120be)[_0x99ab('0x1c')](_0x20b625);}};}function respondWithFilteredResult(_0x320099,_0x34ab33){return function(_0x50d4be){if(_0x50d4be){var _0x27660d=typeof _0x34ab33['offset']===_0x99ab('0x1d')&&typeof _0x34ab33[_0x99ab('0x1e')]===_0x99ab('0x1d');var _0x3c4807=_0x50d4be[_0x99ab('0x1f')];var _0x3fccee=_0x27660d?0x0:_0x34ab33[_0x99ab('0x20')];var _0x2acdfc=_0x27660d?_0x50d4be[_0x99ab('0x1f')]:_0x34ab33[_0x99ab('0x20')]+_0x34ab33['limit'];var _0x468b06;if(_0x2acdfc>=_0x3c4807){_0x2acdfc=_0x3c4807;_0x468b06=0xc8;}else{_0x468b06=0xce;}_0x320099[_0x99ab('0x1b')](_0x468b06);return _0x320099[_0x99ab('0x21')](_0x99ab('0x22'),_0x3fccee+'-'+_0x2acdfc+'/'+_0x3c4807)[_0x99ab('0x1c')](_0x50d4be);}return null;};}function patchUpdates(_0x264a2e){return function(_0x2f2856){try{jsonpatch['apply'](_0x2f2856,_0x264a2e,!![]);}catch(_0x3e0fac){return BPromise['reject'](_0x3e0fac);}return _0x2f2856[_0x99ab('0x23')]();};}function saveUpdates(_0x2baeff,_0x5cf3d5){return function(_0x1f1091){if(_0x1f1091){return _0x1f1091[_0x99ab('0x24')](_0x2baeff)['then'](function(_0x4b3521){return _0x4b3521;});}return null;};}function removeEntity(_0x29b166,_0x6c8ac5){return function(_0x27e2a8){if(_0x27e2a8){return _0x27e2a8['destroy']()[_0x99ab('0x25')](function(){_0x29b166[_0x99ab('0x1b')](0xcc)[_0x99ab('0x1a')]();});}};}function handleEntityNotFound(_0x77aefa,_0x102a2f){return function(_0x3d9190){if(!_0x3d9190){_0x77aefa[_0x99ab('0x19')](0x194);}return _0x3d9190;};}function handleError(_0x457cc3,_0x199d3a){_0x199d3a=_0x199d3a||0x1f4;return function(_0xc47856){logger[_0x99ab('0x26')](_0xc47856[_0x99ab('0x27')]);if(_0xc47856[_0x99ab('0x28')]){delete _0xc47856['name'];}_0x457cc3[_0x99ab('0x1b')](_0x199d3a)[_0x99ab('0x29')](_0xc47856);};}exports[_0x99ab('0x2a')]=function(_0x250061,_0x28adaa){var _0x1fa8f8={},_0x2ddf1d={},_0x3ffa4d={'count':0x0,'rows':[]};var _0x20727f=_['map'](db[_0x99ab('0x2b')][_0x99ab('0x2c')],function(_0x281cf8){return{'name':_0x281cf8[_0x99ab('0x2d')],'type':_0x281cf8[_0x99ab('0x2e')]['key']};});_0x2ddf1d[_0x99ab('0x2f')]=_[_0x99ab('0x30')](_0x20727f,_0x99ab('0x28'));_0x2ddf1d[_0x99ab('0x31')]=_[_0x99ab('0x32')](_0x250061[_0x99ab('0x31')]);_0x2ddf1d[_0x99ab('0x33')]=_['intersection'](_0x2ddf1d['model'],_0x2ddf1d[_0x99ab('0x31')]);_0x1fa8f8[_0x99ab('0x34')]=_[_0x99ab('0x35')](_0x2ddf1d[_0x99ab('0x2f')],qs['fields'](_0x250061['query'][_0x99ab('0x36')]));_0x1fa8f8[_0x99ab('0x34')]=_0x1fa8f8[_0x99ab('0x34')][_0x99ab('0x37')]?_0x1fa8f8[_0x99ab('0x34')]:_0x2ddf1d[_0x99ab('0x2f')];if(!_0x250061[_0x99ab('0x31')]['hasOwnProperty'](_0x99ab('0x38'))){_0x1fa8f8[_0x99ab('0x1e')]=qs['limit'](_0x250061[_0x99ab('0x31')]['limit']);_0x1fa8f8[_0x99ab('0x20')]=qs[_0x99ab('0x20')](_0x250061[_0x99ab('0x31')][_0x99ab('0x20')]);}_0x1fa8f8[_0x99ab('0x39')]=qs['sort'](_0x250061['query'][_0x99ab('0x3a')]);_0x1fa8f8[_0x99ab('0x3b')]=qs[_0x99ab('0x33')](_[_0x99ab('0x3c')](_0x250061[_0x99ab('0x31')],_0x2ddf1d[_0x99ab('0x33')]),_0x20727f);if(_0x250061[_0x99ab('0x31')][_0x99ab('0x3d')]){_0x1fa8f8[_0x99ab('0x3b')]=_[_0x99ab('0x3e')](_0x1fa8f8[_0x99ab('0x3b')],{'$or':_[_0x99ab('0x30')](_0x20727f,function(_0xa5a7d6){if(_0xa5a7d6[_0x99ab('0x2e')]!==_0x99ab('0x3f')){var _0x2570cf={};_0x2570cf[_0xa5a7d6[_0x99ab('0x28')]]={'$like':'%'+_0x250061[_0x99ab('0x31')][_0x99ab('0x3d')]+'%'};return _0x2570cf;}})});}_0x1fa8f8=_['merge']({},_0x1fa8f8,_0x250061[_0x99ab('0x40')]);var _0xfda291={'where':_0x1fa8f8[_0x99ab('0x3b')]};return db['Attachment']['count'](_0xfda291)[_0x99ab('0x25')](function(_0x2c5b83){_0x3ffa4d[_0x99ab('0x1f')]=_0x2c5b83;if(_0x250061[_0x99ab('0x31')][_0x99ab('0x41')]){_0x1fa8f8[_0x99ab('0x42')]=[{'all':!![]}];}return db[_0x99ab('0x2b')][_0x99ab('0x43')](_0x1fa8f8);})[_0x99ab('0x25')](function(_0xbaca45){_0x3ffa4d[_0x99ab('0x44')]=_0xbaca45;return _0x3ffa4d;})[_0x99ab('0x25')](respondWithFilteredResult(_0x28adaa,_0x1fa8f8))['catch'](handleError(_0x28adaa,null));};exports[_0x99ab('0x45')]=function(_0x4ba7d3,_0x3f3b6c){var _0x8ba4da={'raw':!![],'where':{'id':_0x4ba7d3[_0x99ab('0x46')]['id']}},_0x53fef={};_0x53fef[_0x99ab('0x2f')]=_[_0x99ab('0x32')](db[_0x99ab('0x2b')][_0x99ab('0x2c')]);_0x53fef[_0x99ab('0x31')]=_['keys'](_0x4ba7d3[_0x99ab('0x31')]);_0x53fef[_0x99ab('0x33')]=_[_0x99ab('0x35')](_0x53fef[_0x99ab('0x2f')],_0x53fef[_0x99ab('0x31')]);_0x8ba4da[_0x99ab('0x34')]=_['intersection'](_0x53fef[_0x99ab('0x2f')],qs['fields'](_0x4ba7d3[_0x99ab('0x31')][_0x99ab('0x36')]));_0x8ba4da[_0x99ab('0x34')]=_0x8ba4da[_0x99ab('0x34')]['length']?_0x8ba4da['attributes']:_0x53fef[_0x99ab('0x2f')];if(_0x4ba7d3[_0x99ab('0x31')]['includeAll']){_0x8ba4da[_0x99ab('0x42')]=[{'all':!![]}];}_0x8ba4da=_[_0x99ab('0x3e')]({},_0x8ba4da,_0x4ba7d3['options']);return db[_0x99ab('0x2b')][_0x99ab('0x47')](_0x8ba4da)['then'](handleEntityNotFound(_0x3f3b6c,null))['then'](respondWithResult(_0x3f3b6c,null))['catch'](handleError(_0x3f3b6c,null));};exports[_0x99ab('0x48')]=function(_0x5a82a9,_0x412c5a){var _0x28e4aa={'where':{'id':_0x5a82a9[_0x99ab('0x46')]['id']}},_0x574ed7={};_0x574ed7[_0x99ab('0x2f')]=_['keys'](db['Attachment']['rawAttributes']);_0x28e4aa['attributes']=_['intersection'](_0x574ed7[_0x99ab('0x2f')],qs[_0x99ab('0x36')](_0x5a82a9['query'][_0x99ab('0x36')]));_0x28e4aa[_0x99ab('0x34')]=_0x28e4aa[_0x99ab('0x34')][_0x99ab('0x37')]?_0x28e4aa[_0x99ab('0x34')]:_0x574ed7['model'];if(_0x5a82a9['query']['includeAll']){_0x28e4aa[_0x99ab('0x42')]=[{'all':!![]}];}_0x28e4aa=_[_0x99ab('0x3e')]({},_0x28e4aa,_0x5a82a9[_0x99ab('0x40')]);return db[_0x99ab('0x2b')][_0x99ab('0x47')](_0x28e4aa)[_0x99ab('0x25')](handleEntityNotFound(_0x412c5a,null))[_0x99ab('0x25')](function(_0x16946e){if(_0x16946e){var _0xd42a95=_0x16946e[_0x99ab('0x49')]({'plain':!![]});_0xd42a95=qs['omit'](_0xd42a95,['id',_0x99ab('0x4a'),_0x99ab('0x4b')]);_0x5a82a9['body']=_[_0x99ab('0x4c')](_0x5a82a9[_0x99ab('0x4d')],['id',_0x99ab('0x4a'),'updatedAt']);return db[_0x99ab('0x2b')][_0x99ab('0x4e')](_[_0x99ab('0x3e')](_0xd42a95,_0x5a82a9['body']),{'include':_0x5a82a9['query'][_0x99ab('0x41')]?[{'all':!![]}]:undefined});}})[_0x99ab('0x25')](respondWithResult(_0x412c5a,0xc9))[_0x99ab('0x4f')](handleError(_0x412c5a,null));};exports[_0x99ab('0x24')]=function(_0xc972e,_0x2daa68){if(_0xc972e[_0x99ab('0x4d')]['id']){delete _0xc972e[_0x99ab('0x4d')]['id'];}return db['Attachment']['find']({'where':{'id':_0xc972e[_0x99ab('0x46')]['id']}})[_0x99ab('0x25')](handleEntityNotFound(_0x2daa68,null))[_0x99ab('0x25')](saveUpdates(_0xc972e[_0x99ab('0x4d')],null))[_0x99ab('0x25')](respondWithResult(_0x2daa68,null))[_0x99ab('0x4f')](handleError(_0x2daa68,null));};exports[_0x99ab('0x50')]=function(_0x368c70,_0xa717d6){return db[_0x99ab('0x2b')][_0x99ab('0x47')]({'where':{'id':_0x368c70['params']['id']}})['then'](handleEntityNotFound(_0xa717d6,null))[_0x99ab('0x25')](removeEntity(_0xa717d6,null))[_0x99ab('0x4f')](handleError(_0xa717d6,null));};exports[_0x99ab('0x4e')]=function(_0x182083,_0x61df0b,_0x5c0fba){_0x182083['body']['name']=_0x182083[_0x99ab('0x51')][_0x99ab('0x52')];_0x182083[_0x99ab('0x4d')]['basename']=_0x182083[_0x99ab('0x51')][_0x99ab('0x53')];_0x182083['body'][_0x99ab('0x2e')]=_0x182083[_0x99ab('0x51')][_0x99ab('0x54')];return db['Attachment']['create'](_0x182083['body'])[_0x99ab('0x25')](respondWithResult(_0x61df0b,0xc9))['catch'](handleError(_0x61df0b,null));};exports[_0x99ab('0x55')]=function(_0x5accfe,_0x45b97a,_0x3084e4){return db[_0x99ab('0x2b')][_0x99ab('0x56')]({'where':{'id':_0x5accfe[_0x99ab('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x45b97a,null))[_0x99ab('0x25')](function(_0xc939c6){if(_0xc939c6){var _0x33d0f2=_0xc939c6['ChatOfflineMessageId']!==null;var _0x304c46=path[_0x99ab('0x57')](config['root'],_0x99ab('0x58'));if(_0x33d0f2){_0x304c46=path[_0x99ab('0x57')](_0x304c46,_0x99ab('0x59'));}var _0x4e23a8=path[_0x99ab('0x57')](_0x304c46,_0xc939c6[_0x99ab('0x5a')]);return _0x45b97a['download'](_0x4e23a8);}})['catch'](handleError(_0x45b97a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 8970132..8b495d8 100644 --- a/server/api/attachment/attachment.model.js +++ b/server/api/attachment/attachment.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe54d=['bluebird','request-promise','rimraf','./attachment.attributes','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x4718bc,_0x295b9c){var _0x5c2b6f=function(_0x5c76f4){while(--_0x5c76f4){_0x4718bc['push'](_0x4718bc['shift']());}};_0x5c2b6f(++_0x295b9c);}(_0xe54d,0x12f));var _0xde54=function(_0x13f286,_0x426f1e){_0x13f286=_0x13f286-0x0;var _0x5648e2=_0xe54d[_0x13f286];return _0x5648e2;};'use strict';var _=require(_0xde54('0x0'));var util=require(_0xde54('0x1'));var logger=require(_0xde54('0x2'))(_0xde54('0x3'));var moment=require(_0xde54('0x4'));var BPromise=require(_0xde54('0x5'));var rp=require(_0xde54('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde54('0x7'));var config=require('../../config/environment');var attributes=require(_0xde54('0x8'));module[_0xde54('0x9')]=function(_0x38c131,_0x3bcd74){return _0x38c131[_0xde54('0xa')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a3=['attachments','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb9a3,0x85));var _0x3b9a=function(_0x2a0b17,_0x469c94){_0x2a0b17=_0x2a0b17-0x0;var _0xb17845=_0xb9a3[_0x2a0b17];return _0xb17845;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3b9a('0x0'))(_0x3b9a('0x1'));var moment=require('moment');var BPromise=require(_0x3b9a('0x2'));var rp=require(_0x3b9a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b9a('0x4'));var config=require(_0x3b9a('0x5'));var attributes=require(_0x3b9a('0x6'));module[_0x3b9a('0x7')]=function(_0xc6615f,_0x590961){return _0xc6615f[_0x3b9a('0x8')](_0x3b9a('0x9'),attributes,{'tableName':_0x3b9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index caf9f8b..168e96d 100644 --- a/server/api/attachment/attachment.rpc.js +++ b/server/api/attachment/attachment.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98e5=['error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','debug','stringify','catch','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x268111,_0x31c1f9){var _0x54e72a=function(_0x16e79c){while(--_0x16e79c){_0x268111['push'](_0x268111['shift']());}};_0x54e72a(++_0x31c1f9);}(_0x98e5,0x8a));var _0x598e=function(_0xd1f854,_0x532346){_0xd1f854=_0xd1f854-0x0;var _0x548294=_0x98e5[_0xd1f854];return _0x548294;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x598e('0x0'));var rs=require(_0x598e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x598e('0x2'))['db'];var utils=require(_0x598e('0x3'));var logger=require('../../config/logger')(_0x598e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x598e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4292c3,_0x1fc8b5,_0x10bf8e){return new BPromise(function(_0x3e0212,_0x9dc046){return client[_0x598e('0x6')](_0x4292c3,_0x10bf8e)[_0x598e('0x7')](function(_0x2550b9){logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));logger['debug'](_0x598e('0xb'),_0x1fc8b5,_0x598e('0xa'),JSON['stringify'](_0x2550b9));if(_0x2550b9[_0x598e('0xc')]){if(_0x2550b9['error'][_0x598e('0xd')]===0x1f4){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);return _0x9dc046(_0x2550b9['error'][_0x598e('0xe')]);}logger['error'](_0x598e('0x9'),_0x1fc8b5,_0x2550b9[_0x598e('0xc')]['message']);return _0x3e0212(_0x2550b9[_0x598e('0xc')][_0x598e('0xe')]);}else{logger[_0x598e('0x8')](_0x598e('0x9'),_0x1fc8b5,_0x598e('0xa'));_0x3e0212(_0x2550b9[_0x598e('0xf')][_0x598e('0xe')]);}})['catch'](function(_0x9ba324){logger[_0x598e('0xc')](_0x598e('0x9'),_0x1fc8b5,_0x9ba324);_0x9dc046(_0x9ba324);});});}exports[_0x598e('0x10')]=function(_0x50ffbb){var _0x1efdfc=this;return new Promise(function(_0x2ecb1e,_0x1727dd){return db[_0x598e('0x11')][_0x598e('0x12')](_0x50ffbb[_0x598e('0x13')],{'raw':_0x50ffbb[_0x598e('0x14')]?_0x50ffbb[_0x598e('0x14')][_0x598e('0x15')]===undefined?!![]:![]:!![]})[_0x598e('0x7')](function(_0x17e5f1){logger[_0x598e('0x8')](_0x598e('0x10'),_0x50ffbb);logger[_0x598e('0x16')](_0x598e('0x10'),_0x50ffbb,JSON[_0x598e('0x17')](_0x17e5f1));_0x2ecb1e(_0x17e5f1);})[_0x598e('0x18')](function(_0x5b9c3){logger['error'](_0x598e('0x10'),_0x5b9c3['message'],_0x50ffbb);_0x1727dd(_0x1efdfc[_0x598e('0xc')](0x1f4,_0x5b9c3[_0x598e('0xe')]));});});}; \ No newline at end of file +var _0xc5ba=['catch','CreateAttachment','Attachment','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28da80,_0x2ff29){var _0x2a9cd2=function(_0x4dbe00){while(--_0x4dbe00){_0x28da80['push'](_0x28da80['shift']());}};_0x2a9cd2(++_0x2ff29);}(_0xc5ba,0xb9));var _0xac5b=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0xc5ba[_0x322522];return _0x293bcf;};'use strict';var _=require(_0xac5b('0x0'));var util=require(_0xac5b('0x1'));var moment=require(_0xac5b('0x2'));var BPromise=require(_0xac5b('0x3'));var rs=require(_0xac5b('0x4'));var fs=require('fs');var Redis=require(_0xac5b('0x5'));var db=require(_0xac5b('0x6'))['db'];var utils=require(_0xac5b('0x7'));var logger=require(_0xac5b('0x8'))(_0xac5b('0x9'));var config=require(_0xac5b('0xa'));var jayson=require(_0xac5b('0xb'));var client=jayson[_0xac5b('0xc')][_0xac5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x38602a,_0xc09fbc,_0xc193a7){return new BPromise(function(_0x4a7fc7,_0x525e20){return client[_0xac5b('0xe')](_0x38602a,_0xc193a7)['then'](function(_0x3c5bd3){logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));logger[_0xac5b('0x12')](_0xac5b('0x13'),_0xc09fbc,_0xac5b('0x11'),JSON[_0xac5b('0x14')](_0x3c5bd3));if(_0x3c5bd3[_0xac5b('0x15')]){if(_0x3c5bd3['error'][_0xac5b('0x16')]===0x1f4){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x525e20(_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);}logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x3c5bd3[_0xac5b('0x15')][_0xac5b('0x17')]);return _0x4a7fc7(_0x3c5bd3[_0xac5b('0x15')]['message']);}else{logger[_0xac5b('0xf')](_0xac5b('0x10'),_0xc09fbc,_0xac5b('0x11'));_0x4a7fc7(_0x3c5bd3[_0xac5b('0x18')][_0xac5b('0x17')]);}})[_0xac5b('0x19')](function(_0x363de5){logger[_0xac5b('0x15')](_0xac5b('0x10'),_0xc09fbc,_0x363de5);_0x525e20(_0x363de5);});});}exports[_0xac5b('0x1a')]=function(_0x11e6fa){var _0x551ccf=this;return new Promise(function(_0x2db8d1,_0x4c46e5){return db[_0xac5b('0x1b')]['create'](_0x11e6fa[_0xac5b('0x1c')],{'raw':_0x11e6fa[_0xac5b('0x1d')]?_0x11e6fa['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3dbc5b){logger['info'](_0xac5b('0x1a'),_0x11e6fa);logger[_0xac5b('0x12')](_0xac5b('0x1a'),_0x11e6fa,JSON[_0xac5b('0x14')](_0x3dbc5b));_0x2db8d1(_0x3dbc5b);})[_0xac5b('0x19')](function(_0x5a4b94){logger['error']('CreateAttachment',_0x5a4b94[_0xac5b('0x17')],_0x11e6fa);_0x4c46e5(_0x551ccf['error'](0x1f4,_0x5a4b94[_0xac5b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3d88a1e..6f84b7c 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdb28,0x106));var _0x8db2=function(_0x244201,_0x107d14){_0x244201=_0x244201-0x0;var _0x227f44=_0xdb28[_0x244201];return _0x227f44;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x4ca552,_0x3b3004){var _0x41e5bc=function(_0x53fc23){while(--_0x53fc23){_0x4ca552['push'](_0x4ca552['shift']());}};_0x41e5bc(++_0x3b3004);}(_0xb10b,0x12a));var _0xbb10=function(_0x2eebfa,_0x2b23fd){_0x2eebfa=_0x2eebfa-0x0;var _0xdb8044=_0xb10b[_0x2eebfa];return _0xdb8044;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index b329f18..d130c7e 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26aa=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','blocked','blockedAt','user','agent','then','name','disabled','minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','User','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x26aa,0xa2));var _0xa26a=function(_0x4fd4f0,_0x4caa4b){_0x4fd4f0=_0x4fd4f0-0x0;var _0x4a1ac2=_0x26aa[_0x4fd4f0];return _0x4a1ac2;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xa26a('0x0'))[_0xa26a('0x1')];var moment=require(_0xa26a('0x2'));var ActiveDirectory=require(_0xa26a('0x3'));var BPromise=require('bluebird');var util=require(_0xa26a('0x4'));var db=require(_0xa26a('0x5'))['db'];var authService=require(_0xa26a('0x6'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa26a('0x7'));function isActiveDirectoryConfigured(_0x2ea383){var _0x1eb8bc=![];if(typeof _0x2ea383[_0xa26a('0x8')]!==_0xa26a('0x9')){_0x1eb8bc=_0x2ea383[_0xa26a('0x8')][_0xa26a('0xa')]&&_0x2ea383[_0xa26a('0x8')][_0xa26a('0xb')]&&_0x2ea383[_0xa26a('0x8')][_0xa26a('0xc')];}return _0x1eb8bc;}function adAuthenticate(_0x2d9002,_0x560a0a,_0x373d1c){return new BPromise(function(_0x5f5d52,_0x1f987f){try{var _0x41b14e=new ActiveDirectory(_0x2d9002);_0x41b14e[_0xa26a('0xd')](_0x560a0a,_0x373d1c,function(_0x94c873,_0x3e962b){if(_0x94c873){logger[_0xa26a('0xe')](_0xa26a('0xf'),_0x560a0a,util[_0xa26a('0x10')](_0x94c873,{'showHidden':![],'depth':null}));_0x1f987f(_0xa26a('0x11'));}else if(!_0x3e962b){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x560a0a);_0x1f987f(_0xa26a('0x11'));}else{_0x5f5d52(_0x3e962b);}});}catch(_0x264184){_0x1f987f(_0x264184);}});}function ActiveDirectoryAuthenticate(_0x49b169,_0x3f0aec,_0x4cfdc7,_0xf47df7){var _0x21dd54,_0x2351ea;if(!isActiveDirectoryConfigured(config)){logger[_0xa26a('0xe')](_0xa26a('0x12'),_0x3f0aec);return _0xf47df7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xa26a('0x13'),_0xa26a('0x14')],'raw':!![]})['then'](function(_0x581f8e){_0x21dd54=_0x581f8e;if(!_0x21dd54[_0xa26a('0x13')]){logger[_0xa26a('0xe')](_0xa26a('0x15'),_0x3f0aec);throw new Error(_0xa26a('0x11'));}return _0x49b169['findOne']({'attributes':['id','name',_0xa26a('0x16'),_0xa26a('0x17'),'role','disabled',_0xa26a('0x18'),_0xa26a('0x19'),'online'],'where':{'name':_0x3f0aec,'role':{'$or':['admin',_0xa26a('0x1a'),_0xa26a('0x1b')]},'adSsoEnabled':!![]}});})[_0xa26a('0x1c')](function(_0xb5c60c){if(!_0xb5c60c||_0xb5c60c&&_0xb5c60c[_0xa26a('0x1d')]!==_0x3f0aec){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x2351ea=_0xb5c60c;var _0x191aba=_0x2351ea[_0xa26a('0x1d')]+'@'+config['activedirectory'][_0xa26a('0xc')];return adAuthenticate(config['activedirectory'],_0x191aba,_0x4cfdc7);})[_0xa26a('0x1c')](function(_0x58a1bf){if(_0x2351ea[_0xa26a('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x21dd54[_0xa26a('0x14')]>0x0){if(_0x2351ea[_0xa26a('0x18')]){if(moment(_0x2351ea['blockedAt'])['add'](_0x21dd54['blockDuration'],_0xa26a('0x1f'))>moment()){throw new Error(_0xa26a('0x11'));}return utils[_0xa26a('0x20')](_0x2351ea,0x0,![],null)[_0xa26a('0x1c')](function(){return utils['getLicense'](_0x2351ea);})[_0xa26a('0x1c')](function(){return _0xf47df7(null,_0x2351ea);});}else{return utils['getLicense'](_0x2351ea)['then'](function(){return _0xf47df7(null,_0x2351ea);});}}else{return utils[_0xa26a('0x21')](_0x2351ea)[_0xa26a('0x1c')](function(){return _0xf47df7(null,_0x2351ea);});}})[_0xa26a('0x22')](function(_0x309392){return _0xf47df7(null,![],_0x309392);});}function handleError(_0x508d3d,_0x346a14,_0x55edf7){return _0x508d3d[_0xa26a('0x23')](_0x346a14||0x1f4)[_0xa26a('0x24')]({'message':_0x55edf7?_0x55edf7['message']||_0x55edf7:''});}exports[_0xa26a('0x25')]=function(_0x450121,_0x3ffc48,_0x25519b){passport[_0xa26a('0xd')](_0xa26a('0x26'),function(_0x5aa567,_0x2c864d,_0x5e5b7d){var _0x49ff9a=_0x5aa567||_0x5e5b7d;if(_0x49ff9a){return handleError(_0x3ffc48,0x191,_0x49ff9a);}if(!_0x2c864d){return handleError(_0x3ffc48,0x194,{'message':_0xa26a('0x27')});}else{var _0x3961f4={'payload':{'id':_0x2c864d['id'],'role':_0x2c864d[_0xa26a('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0xa26a('0x29')](_0x3961f4)['then'](function(_0xa0168b){_0x3ffc48[_0xa26a('0x2a')]({'id':_0x2c864d['id'],'token':_0xa0168b,'statusCall':'','isAlreadyLogged':_0x2c864d[_0xa26a('0x2b')]});});}})(_0x450121,_0x3ffc48,_0x25519b);};passport['use'](_0xa26a('0x26'),new LocalStrategy({'usernameField':_0xa26a('0x1d'),'passwordField':_0xa26a('0x16')},function(_0x3dc07c,_0x79974a,_0x152410){return ActiveDirectoryAuthenticate(db[_0xa26a('0x2c')],_0x3dc07c,_0x79974a,_0x152410);})); \ No newline at end of file +var _0x61d0=['../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','role','disabled','blocked','blockedAt','online','admin','user','agent','name','add','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x61d0,0x181));var _0x061d=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x61d0[_0x21353c];return _0xa99120;};'use strict';var passport=require(_0x061d('0x0'));var LocalStrategy=require(_0x061d('0x1'))[_0x061d('0x2')];var moment=require(_0x061d('0x3'));var ActiveDirectory=require(_0x061d('0x4'));var BPromise=require(_0x061d('0x5'));var util=require('util');var db=require(_0x061d('0x6'))['db'];var authService=require(_0x061d('0x7'));var utils=require('../../config/utils');var config=require(_0x061d('0x8'));var logger=require(_0x061d('0x9'))(_0x061d('0xa'));function isActiveDirectoryConfigured(_0x52b0ba){var _0x313c65=![];if(typeof _0x52b0ba[_0x061d('0xb')]!=='undefined'){_0x313c65=_0x52b0ba[_0x061d('0xb')][_0x061d('0xc')]&&_0x52b0ba['activedirectory'][_0x061d('0xd')]&&_0x52b0ba[_0x061d('0xb')][_0x061d('0xe')];}return _0x313c65;}function adAuthenticate(_0x358517,_0x49109d,_0x50313c){return new BPromise(function(_0x8c167b,_0x4edd74){try{var _0x199f61=new ActiveDirectory(_0x358517);_0x199f61['authenticate'](_0x49109d,_0x50313c,function(_0x4e05d7,_0x50d42e){if(_0x4e05d7){logger[_0x061d('0xf')](_0x061d('0x10'),_0x49109d,util[_0x061d('0x11')](_0x4e05d7,{'showHidden':![],'depth':null}));_0x4edd74('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x50d42e){logger[_0x061d('0xf')](_0x061d('0x12'),_0x49109d);_0x4edd74(_0x061d('0x13'));}else{_0x8c167b(_0x50d42e);}});}catch(_0x3d6440){_0x4edd74(_0x3d6440);}});}function ActiveDirectoryAuthenticate(_0x216b6b,_0x11b850,_0x12527e,_0x2b83b7){var _0x498271,_0x41a00f;if(!isActiveDirectoryConfigured(config)){logger[_0x061d('0xf')](_0x061d('0x14'),_0x11b850);return _0x2b83b7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x061d('0x15')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x061d('0x16')],'raw':!![]})[_0x061d('0x17')](function(_0x209b80){_0x498271=_0x209b80;if(!_0x498271[_0x061d('0x18')]){logger[_0x061d('0xf')](_0x061d('0x19'),_0x11b850);throw new Error(_0x061d('0x13'));}return _0x216b6b[_0x061d('0x1a')]({'attributes':['id','name',_0x061d('0x1b'),'salt',_0x061d('0x1c'),_0x061d('0x1d'),_0x061d('0x1e'),_0x061d('0x1f'),_0x061d('0x20')],'where':{'name':_0x11b850,'role':{'$or':[_0x061d('0x21'),_0x061d('0x22'),_0x061d('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x412a0f){if(!_0x412a0f||_0x412a0f&&_0x412a0f[_0x061d('0x24')]!==_0x11b850){throw new Error(_0x061d('0x13'));}_0x41a00f=_0x412a0f;var _0x4078c1=_0x41a00f['name']+'@'+config['activedirectory'][_0x061d('0xe')];return adAuthenticate(config[_0x061d('0xb')],_0x4078c1,_0x12527e);})[_0x061d('0x17')](function(_0x9a879d){if(_0x41a00f['disabled']){throw new Error(_0x061d('0x13'));}if(_0x498271['blockDuration']>0x0){if(_0x41a00f[_0x061d('0x1e')]){if(moment(_0x41a00f[_0x061d('0x1f')])[_0x061d('0x25')](_0x498271[_0x061d('0x16')],'minutes')>moment()){throw new Error(_0x061d('0x13'));}return utils['clearBlockUser'](_0x41a00f,0x0,![],null)[_0x061d('0x17')](function(){return utils['getLicense'](_0x41a00f);})[_0x061d('0x17')](function(){return _0x2b83b7(null,_0x41a00f);});}else{return utils[_0x061d('0x26')](_0x41a00f)['then'](function(){return _0x2b83b7(null,_0x41a00f);});}}else{return utils['getLicense'](_0x41a00f)[_0x061d('0x17')](function(){return _0x2b83b7(null,_0x41a00f);});}})[_0x061d('0x27')](function(_0x250409){return _0x2b83b7(null,![],_0x250409);});}function handleError(_0x1c355a,_0x25f213,_0x13508b){return _0x1c355a[_0x061d('0x28')](_0x25f213||0x1f4)[_0x061d('0x29')]({'message':_0x13508b?_0x13508b[_0x061d('0x2a')]||_0x13508b:''});}exports[_0x061d('0x2b')]=function(_0x27c258,_0x591f66,_0x4b08bf){passport['authenticate'](_0x061d('0x2c'),function(_0x54289b,_0x190500,_0x1a25d4){var _0x4cb256=_0x54289b||_0x1a25d4;if(_0x4cb256){return handleError(_0x591f66,0x191,_0x4cb256);}if(!_0x190500){return handleError(_0x591f66,0x194,{'message':_0x061d('0x2d')});}else{var _0x1b9230={'payload':{'id':_0x190500['id'],'role':_0x190500[_0x061d('0x1c')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b9230)[_0x061d('0x17')](function(_0x59781a){_0x591f66[_0x061d('0x2e')]({'id':_0x190500['id'],'token':_0x59781a,'statusCall':'','isAlreadyLogged':_0x190500[_0x061d('0x20')]});});}})(_0x27c258,_0x591f66,_0x4b08bf);};passport[_0x061d('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0x061d('0x24'),'passwordField':'password'},function(_0x502de2,_0xe0457d,_0x5ea2fd){return ActiveDirectoryAuthenticate(db[_0x061d('0x30')],_0x502de2,_0xe0457d,_0x5ea2fd);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 4573cbb..d7f7c98 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee7d=['post','login','exports','express','Router'];(function(_0x41852b,_0x305aad){var _0x506908=function(_0x203e0c){while(--_0x203e0c){_0x41852b['push'](_0x41852b['shift']());}};_0x506908(++_0x305aad);}(_0xee7d,0x120));var _0xdee7=function(_0x185ce6,_0x3495e3){_0x185ce6=_0x185ce6-0x0;var _0x252f03=_0xee7d[_0x185ce6];return _0x252f03;};'use strict';var express=require(_0xdee7('0x0'));var router=express[_0xdee7('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xdee7('0x2')]('/',controller[_0xdee7('0x3')]);module[_0xdee7('0x4')]=router; \ No newline at end of file +var _0x58d7=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x54b41e,_0x52bae1){var _0x3ac113=function(_0x45177a){while(--_0x45177a){_0x54b41e['push'](_0x54b41e['shift']());}};_0x3ac113(++_0x52bae1);}(_0x58d7,0x1d8));var _0x758d=function(_0x11a5db,_0x1a0dba){_0x11a5db=_0x11a5db-0x0;var _0x522cba=_0x58d7[_0x11a5db];return _0x522cba;};'use strict';var express=require(_0x758d('0x0'));var router=express[_0x758d('0x1')]();var controller=require(_0x758d('0x2'));router[_0x758d('0x3')]('/',controller[_0x758d('0x4')]);module[_0x758d('0x5')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 2eb01aa..1096feb 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x51a9c8,_0x1e0917){var _0x5d8b7f=function(_0x183af6){while(--_0x183af6){_0x51a9c8['push'](_0x51a9c8['shift']());}};_0x5d8b7f(++_0x1e0917);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x11d2d5,_0x54ea15){var _0x5cc423=function(_0x507e72){while(--_0x507e72){_0x11d2d5['push'](_0x11d2d5['shift']());}};_0x5cc423(++_0x54ea15);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d279977..0841ad3 100644 --- a/server/api/authGoogle/index.js +++ b/server/api/authGoogle/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76d5=['Router','./authGoogle.controller','login','get','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x953701,_0x5d2bf2){var _0x5a2c8f=function(_0xe8a01){while(--_0xe8a01){_0x953701['push'](_0x953701['shift']());}};_0x5a2c8f(++_0x5d2bf2);}(_0x76d5,0x108));var _0x576d=function(_0x126f39,_0x18289b){_0x126f39=_0x126f39-0x0;var _0x3bd5da=_0x76d5[_0x126f39];return _0x3bd5da;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x576d('0x0')]();var controller=require(_0x576d('0x1'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x576d('0x2')]);router[_0x576d('0x3')](_0x576d('0x4'),controller['callback'],authService[_0x576d('0x5')],userController[_0x576d('0x2')],authService[_0x576d('0x6')]);module[_0x576d('0x7')]=router; \ No newline at end of file +var _0x121d=['get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x41f3c8,_0x5976b4){var _0x58d4f7=function(_0x325cc8){while(--_0x325cc8){_0x41f3c8['push'](_0x41f3c8['shift']());}};_0x58d4f7(++_0x5976b4);}(_0x121d,0xea));var _0xd121=function(_0x4aedb1,_0x372868){_0x4aedb1=_0x4aedb1-0x0;var _0x24ffcf=_0x121d[_0x4aedb1];return _0x24ffcf;};'use strict';var express=require(_0xd121('0x0'));var passport=require(_0xd121('0x1'));var router=express[_0xd121('0x2')]();var controller=require(_0xd121('0x3'));var userController=require(_0xd121('0x4'));var authService=require(_0xd121('0x5'));router[_0xd121('0x6')]('/',controller[_0xd121('0x7')]);router[_0xd121('0x6')](_0xd121('0x8'),controller[_0xd121('0x9')],authService[_0xd121('0xa')],userController[_0xd121('0x7')],authService[_0xd121('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index eae8dc4..9c5636f 100644 --- a/server/api/authLocal/authLocal.controller.js +++ b/server/api/authLocal/authLocal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26ec=['The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','User','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','clearBlockUser','blockedAt','add','minutes','catch','getLicense','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','This\x20email\x20is\x20not\x20registered.'];(function(_0x2e682e,_0xf91ba0){var _0x33c2da=function(_0x3fb6d4){while(--_0x3fb6d4){_0x2e682e['push'](_0x2e682e['shift']());}};_0x33c2da(++_0xf91ba0);}(_0x26ec,0x163));var _0xc26e=function(_0x18acbc,_0x5d33f5){_0x18acbc=_0x18acbc-0x0;var _0x201223=_0x26ec[_0x18acbc];return _0x201223;};'use strict';var util=require(_0xc26e('0x0'));var passport=require(_0xc26e('0x1'));var LocalStrategy=require(_0xc26e('0x2'))[_0xc26e('0x3')];var jayson=require(_0xc26e('0x4'));var _=require(_0xc26e('0x5'));var rs=require(_0xc26e('0x6'));var moment=require(_0xc26e('0x7'));var db=require(_0xc26e('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc26e('0x9'));var client=jayson[_0xc26e('0xa')][_0xc26e('0xb')]({'port':0x232b});function localAuthenticate(_0x421d50,_0xf769f8,_0xbb0211,_0x21fe6f){var _0x52a975,_0x24b11;return db[_0xc26e('0xc')][_0xc26e('0xd')]({'where':{'id':0x1},'attributes':[_0xc26e('0xe'),_0xc26e('0xf')],'raw':!![]})[_0xc26e('0x10')](function(_0x3ccf9c){_0x52a975=_0x3ccf9c;return _0x421d50['findOne']({'attributes':['id',_0xc26e('0x11'),_0xc26e('0x12'),'salt',_0xc26e('0x13'),'disabled',_0xc26e('0x14'),'blockedAt',_0xc26e('0x15')],'where':{'name':_0xf769f8,'role':{'$or':[_0xc26e('0x16'),_0xc26e('0x17'),_0xc26e('0x18')]}}});})['then'](function(_0x2560bd){if(!_0x2560bd||_0x2560bd&&_0x2560bd[_0xc26e('0x11')]!==_0xf769f8){throw new Error(_0xc26e('0x19'));}else{_0x24b11=_0x2560bd;return _0x24b11;}})[_0xc26e('0x10')](function(){_0x24b11[_0xc26e('0x1a')](_0xbb0211,function(_0xe71ea0,_0x1bc15a){var _0x58c7b9=_0x24b11[_0xc26e('0x15')]+0x1;if(_0xe71ea0){return _0x21fe6f(_0xe71ea0);}else if(!_0x1bc15a){if(_0x24b11[_0xc26e('0x1b')]){return _0x21fe6f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x52a975[_0xc26e('0xe')]>0x0){if(_0x24b11[_0xc26e('0x14')]){if(_0x52a975['blockDuration']>0x0){if(moment(_0x24b11['blockedAt'])['add'](_0x52a975[_0xc26e('0xf')],'minutes')>moment()){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x1c')](_0x24b11,_0x58c7b9,![],null)[_0xc26e('0x10')](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}}else{return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}}else{if(_0x58c7b9>=_0x52a975[_0xc26e('0xe')]){return utils[_0xc26e('0x1c')](_0x24b11,0x0,!![],moment())[_0xc26e('0x10')](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}else{return utils['clearBlockUser'](_0x24b11,_0x58c7b9,![],null)['then'](function(){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});});}}}else{return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}}else{if(_0x24b11[_0xc26e('0x1b')]){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else if(_0x52a975[_0xc26e('0xe')]>0x0){if(_0x24b11['blocked']){if(_0x52a975['blockDuration']>0x0){if(moment(_0x24b11[_0xc26e('0x1d')])[_0xc26e('0x1e')](_0x52a975[_0xc26e('0xf')],_0xc26e('0x1f'))>moment()){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x1c')](_0x24b11,0x0,![],null)[_0xc26e('0x10')](function(){return utils['getLicense'](_0x24b11);})[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);});}}else{return _0x21fe6f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xc26e('0x1c')](_0x24b11,0x0,![],null)[_0xc26e('0x10')](function(){return utils['getLicense'](_0x24b11);})[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);})[_0xc26e('0x20')](function(_0x15d7bf){return _0x21fe6f(null,![],_0x15d7bf);});}}else{if(_0x24b11[_0xc26e('0x14')]){return _0x21fe6f(null,![],{'message':_0xc26e('0x19')});}else{return utils[_0xc26e('0x21')](_0x24b11)[_0xc26e('0x10')](function(){return _0x21fe6f(null,_0x24b11);});}}}});})['catch'](function(_0x4f4e7a){return _0x21fe6f(null,![],_0x4f4e7a);});}function sendServiceMail(_0x2d99e1){return db[_0xc26e('0x22')][_0xc26e('0x23')]({'where':{'service':!![]},'attributes':['id',_0xc26e('0x11'),_0xc26e('0x24')],'include':[{'model':db[_0xc26e('0x25')],'as':_0xc26e('0x26'),'include':[{'model':db['CloudProvider'],'as':_0xc26e('0x27')}]}]})[_0xc26e('0x10')](function(_0x1c07b1){if(!_0x1c07b1){throw new Error(_0xc26e('0x28'));}var _0x49d1d3=_0x1c07b1[_0xc26e('0x29')]();var _0x2458ec={'account':_0x49d1d3,'message':_['merge']({'from':util[_0xc26e('0x2a')](_0xc26e('0x2b'),_0x1c07b1[_0xc26e('0x11')],_0x1c07b1['email']||_0x1c07b1[_0xc26e('0x26')][_0xc26e('0x17')])},_0x2d99e1)};return client[_0xc26e('0x2c')](_0xc26e('0x2d'),_0x2458ec);})[_0xc26e('0x10')](function(_0x245e0c){if(_0x245e0c[_0xc26e('0x2e')]){throw new Error(util[_0xc26e('0x2a')](_0xc26e('0x2f'),_0x245e0c['error']['message']||JSON['stringify'](_0x245e0c[_0xc26e('0x2e')])));}return!![];});}function handleError(_0x52a547,_0x53208d,_0x340e40){return _0x52a547['status'](_0x53208d||0x1f4)['send']({'message':_0x340e40?_0x340e40[_0xc26e('0x30')]||_0x340e40:''});}exports[_0xc26e('0x31')]=function(_0x5309e4,_0x146aab,_0x83f90b){passport['authenticate'](_0xc26e('0x32'),function(_0x3b78ca,_0x3e5502,_0x6faf6c){var _0x5af567=_0x3b78ca||_0x6faf6c;if(_0x5af567){return handleError(_0x146aab,0x191,_0x5af567);}if(!_0x3e5502){return handleError(_0x146aab,0x194,{'message':_0xc26e('0x33')});}else{var _0x2a2401={'payload':{'id':_0x3e5502['id'],'role':_0x3e5502[_0xc26e('0x13')]},'options':{'expiresIn':0x15180}};return authService[_0xc26e('0x34')](_0x2a2401)[_0xc26e('0x10')](function(_0x24f6a2){_0x146aab[_0xc26e('0x35')]({'id':_0x3e5502['id'],'token':_0x24f6a2,'statusCall':'','isAlreadyLogged':_0x3e5502['online']});});}})(_0x5309e4,_0x146aab,_0x83f90b);};exports[_0xc26e('0x36')]=function(_0x379219,_0x4a5b45){if(!_0x379219['body'][_0xc26e('0x24')]){return handleError(_0x4a5b45,0x1f4,{'message':_0xc26e('0x37')});}var _0x176396=rs[_0xc26e('0x38')]();_0x379219['body']['email']=_0x379219[_0xc26e('0x39')][_0xc26e('0x24')]['trim']()[_0xc26e('0x3a')]();var _0x580215;return db[_0xc26e('0xc')][_0xc26e('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc26e('0xf')],'raw':!![]})[_0xc26e('0x10')](function(_0x19c4dc){_0x580215=_0x19c4dc;return db['User'][_0xc26e('0x23')]({'where':{'email':_0x379219[_0xc26e('0x39')]['email']}});})[_0xc26e('0x10')](function(_0x1726d4){if(!_0x1726d4){throw new Error(_0xc26e('0x3b'));}if(_0x1726d4[_0xc26e('0x1b')]){throw new Error(_0xc26e('0x3c'));}if(_0x1726d4[_0xc26e('0x14')]){if(moment(_0x1726d4[_0xc26e('0x1d')])[_0xc26e('0x1e')](_0x580215[_0xc26e('0xf')],_0xc26e('0x1f'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1726d4[_0xc26e('0x14')]=![];_0x1726d4[_0xc26e('0x1d')]=null;}}_0x1726d4['resetPasswordToken']=_0x176396;_0x1726d4[_0xc26e('0x3d')]=Date[_0xc26e('0x3e')]()+0x36ee80;return _0x1726d4['save']();})[_0xc26e('0x10')](function(){return sendServiceMail({'to':_0x379219[_0xc26e('0x39')][_0xc26e('0x24')],'subject':_0xc26e('0x3f'),'text':_0xc26e('0x40')+_0xc26e('0x41')+'https://'+_0x379219[_0xc26e('0x42')][_0xc26e('0x43')]+_0xc26e('0x44')+_0x176396+'\x0a\x0a'+_0xc26e('0x45')});})['then'](function(){_0x4a5b45[_0xc26e('0x46')](0xc8)[_0xc26e('0x47')]({'message':_0xc26e('0x48')});})['catch'](function(_0x2af0db){return handleError(_0x4a5b45,0x1f4,_0x2af0db);});};exports['reset']=function(_0x304ddd,_0xda5333){return db[_0xc26e('0x49')][_0xc26e('0x23')]({'where':{'resetPasswordToken':_0x304ddd['params'][_0xc26e('0x4a')],'resetPasswordExpires':{'$gt':Date[_0xc26e('0x3e')]()}}})[_0xc26e('0x10')](function(_0x24a050){if(!_0x24a050){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xc26e('0xc')][_0xc26e('0xd')]({'attributes':['id',_0xc26e('0x4b'),_0xc26e('0x4c'),_0xc26e('0x4d')]})[_0xc26e('0x10')](function(_0xe2af2b){if(_0xe2af2b[_0xc26e('0x4b')])authService['validatePasswordPattern'](_0x304ddd['body'][_0xc26e('0x12')]);if(!_0xe2af2b['enforcePasswordHistory']||!_0x24a050[_0xc26e('0x4e')])return _0x24a050;authService[_0xc26e('0x4f')](_0x304ddd[_0xc26e('0x39')][_0xc26e('0x12')],_0x24a050[_0xc26e('0x4e')],_0xe2af2b[_0xc26e('0x4d')]);return _0x24a050;})['then'](function(){_0x24a050[_0xc26e('0x12')]=_0x304ddd[_0xc26e('0x39')]['password'];_0x24a050['resetPasswordToken']=null;_0x24a050['resetPasswordExpires']=null;return _0x24a050[_0xc26e('0x50')]();});})[_0xc26e('0x10')](function(){_0xda5333[_0xc26e('0x46')](0xc8)[_0xc26e('0x47')]({'message':_0xc26e('0x51')});})[_0xc26e('0x20')](function(_0x595bca){return handleError(_0xda5333,0x1f4,_0x595bca);});};passport[_0xc26e('0x52')](_0xc26e('0x32'),new LocalStrategy({'usernameField':_0xc26e('0x11'),'passwordField':'password'},function(_0x1fe757,_0x14a5a6,_0x301fdf){return localAuthenticate(db[_0xc26e('0x49')],_0x1fe757,_0x14a5a6,_0x301fdf);})); \ No newline at end of file +var _0x312f=['message','login','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','use','util','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','then','password','salt','role','blocked','loginAttempts','admin','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','user','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','status','send'];(function(_0xe66145,_0x17c328){var _0x4a19b0=function(_0x356514){while(--_0x356514){_0xe66145['push'](_0xe66145['shift']());}};_0x4a19b0(++_0x17c328);}(_0x312f,0x174));var _0xf312=function(_0x26fee8,_0x3dd736){_0x26fee8=_0x26fee8-0x0;var _0x231db2=_0x312f[_0x26fee8];return _0x231db2;};'use strict';var util=require(_0xf312('0x0'));var passport=require(_0xf312('0x1'));var LocalStrategy=require(_0xf312('0x2'))['Strategy'];var jayson=require(_0xf312('0x3'));var _=require(_0xf312('0x4'));var rs=require(_0xf312('0x5'));var moment=require(_0xf312('0x6'));var db=require(_0xf312('0x7'))['db'];var authService=require(_0xf312('0x8'));var utils=require(_0xf312('0x9'));var client=jayson[_0xf312('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x17e2e9,_0x101c9c,_0x3cbcec,_0x265b37){var _0x9d6ec3,_0x564a5a;return db['Setting'][_0xf312('0xb')]({'where':{'id':0x1},'attributes':[_0xf312('0xc'),'blockDuration'],'raw':!![]})[_0xf312('0xd')](function(_0x1bac26){_0x9d6ec3=_0x1bac26;return _0x17e2e9[_0xf312('0xb')]({'attributes':['id','name',_0xf312('0xe'),_0xf312('0xf'),_0xf312('0x10'),'disabled',_0xf312('0x11'),'blockedAt',_0xf312('0x12')],'where':{'name':_0x101c9c,'role':{'$or':[_0xf312('0x13'),'user',_0xf312('0x14')]}}});})[_0xf312('0xd')](function(_0x3e597e){if(!_0x3e597e||_0x3e597e&&_0x3e597e[_0xf312('0x15')]!==_0x101c9c){throw new Error(_0xf312('0x16'));}else{_0x564a5a=_0x3e597e;return _0x564a5a;}})[_0xf312('0xd')](function(){_0x564a5a[_0xf312('0x17')](_0x3cbcec,function(_0x2eaf39,_0x365103){var _0xbb36e9=_0x564a5a['loginAttempts']+0x1;if(_0x2eaf39){return _0x265b37(_0x2eaf39);}else if(!_0x365103){if(_0x564a5a[_0xf312('0x18')]){return _0x265b37(null,![],{'message':_0xf312('0x16')});}else if(_0x9d6ec3[_0xf312('0xc')]>0x0){if(_0x564a5a[_0xf312('0x11')]){if(_0x9d6ec3[_0xf312('0x19')]>0x0){if(moment(_0x564a5a[_0xf312('0x1a')])[_0xf312('0x1b')](_0x9d6ec3[_0xf312('0x19')],_0xf312('0x1c'))>moment()){return _0x265b37(null,![],{'message':_0xf312('0x16')});}else{return utils[_0xf312('0x1d')](_0x564a5a,_0xbb36e9,![],null)[_0xf312('0xd')](function(){return _0x265b37(null,![],{'message':_0xf312('0x16')});});}}else{return _0x265b37(null,![],{'message':_0xf312('0x16')});}}else{if(_0xbb36e9>=_0x9d6ec3[_0xf312('0xc')]){return utils[_0xf312('0x1d')](_0x564a5a,0x0,!![],moment())[_0xf312('0xd')](function(){return _0x265b37(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf312('0x1d')](_0x564a5a,_0xbb36e9,![],null)[_0xf312('0xd')](function(){return _0x265b37(null,![],{'message':_0xf312('0x16')});});}}}else{return _0x265b37(null,![],{'message':_0xf312('0x16')});}}else{if(_0x564a5a[_0xf312('0x18')]){return _0x265b37(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x9d6ec3[_0xf312('0xc')]>0x0){if(_0x564a5a[_0xf312('0x11')]){if(_0x9d6ec3[_0xf312('0x19')]>0x0){if(moment(_0x564a5a[_0xf312('0x1a')])[_0xf312('0x1b')](_0x9d6ec3[_0xf312('0x19')],_0xf312('0x1c'))>moment()){return _0x265b37(null,![],{'message':_0xf312('0x16')});}else{return utils[_0xf312('0x1d')](_0x564a5a,0x0,![],null)[_0xf312('0xd')](function(){return utils['getLicense'](_0x564a5a);})['then'](function(){return _0x265b37(null,_0x564a5a);});}}else{return _0x265b37(null,![],{'message':_0xf312('0x16')});}}else{return utils[_0xf312('0x1d')](_0x564a5a,0x0,![],null)[_0xf312('0xd')](function(){return utils[_0xf312('0x1e')](_0x564a5a);})[_0xf312('0xd')](function(){return _0x265b37(null,_0x564a5a);})[_0xf312('0x1f')](function(_0x27cfc6){return _0x265b37(null,![],_0x27cfc6);});}}else{if(_0x564a5a['blocked']){return _0x265b37(null,![],{'message':_0xf312('0x16')});}else{return utils[_0xf312('0x1e')](_0x564a5a)['then'](function(){return _0x265b37(null,_0x564a5a);});}}}});})[_0xf312('0x1f')](function(_0x69700e){return _0x265b37(null,![],_0x69700e);});}function sendServiceMail(_0x3bd7e3){return db['MailAccount'][_0xf312('0x20')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xf312('0x21')],'as':_0xf312('0x22'),'include':[{'model':db[_0xf312('0x23')],'as':_0xf312('0x23')}]}]})[_0xf312('0xd')](function(_0x4cc211){if(!_0x4cc211){throw new Error(_0xf312('0x24'));}var _0x3a23d9=_0x4cc211[_0xf312('0x25')]();var _0x1006ae={'account':_0x3a23d9,'message':_['merge']({'from':util[_0xf312('0x26')](_0xf312('0x27'),_0x4cc211[_0xf312('0x15')],_0x4cc211[_0xf312('0x28')]||_0x4cc211[_0xf312('0x22')][_0xf312('0x29')])},_0x3bd7e3)};return client[_0xf312('0x2a')](_0xf312('0x2b'),_0x1006ae);})[_0xf312('0xd')](function(_0x3f0382){if(_0x3f0382['error']){throw new Error(util[_0xf312('0x26')](_0xf312('0x2c'),_0x3f0382[_0xf312('0x2d')]['message']||JSON['stringify'](_0x3f0382[_0xf312('0x2d')])));}return!![];});}function handleError(_0x4c231e,_0x412ee2,_0x5db752){return _0x4c231e[_0xf312('0x2e')](_0x412ee2||0x1f4)[_0xf312('0x2f')]({'message':_0x5db752?_0x5db752[_0xf312('0x30')]||_0x5db752:''});}exports[_0xf312('0x31')]=function(_0x46f11f,_0x2ef165,_0x210e71){passport[_0xf312('0x17')](_0xf312('0x32'),function(_0x281d4b,_0x30d028,_0x4dfc46){var _0x33f61f=_0x281d4b||_0x4dfc46;if(_0x33f61f){return handleError(_0x2ef165,0x191,_0x33f61f);}if(!_0x30d028){return handleError(_0x2ef165,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x418584={'payload':{'id':_0x30d028['id'],'role':_0x30d028[_0xf312('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xf312('0x33')](_0x418584)[_0xf312('0xd')](function(_0x57238e){_0x2ef165[_0xf312('0x34')]({'id':_0x30d028['id'],'token':_0x57238e,'statusCall':'','isAlreadyLogged':_0x30d028[_0xf312('0x35')]});});}})(_0x46f11f,_0x2ef165,_0x210e71);};exports[_0xf312('0x36')]=function(_0x1a03b2,_0x3220b1){if(!_0x1a03b2[_0xf312('0x37')]['email']){return handleError(_0x3220b1,0x1f4,{'message':_0xf312('0x38')});}var _0x1fa828=rs[_0xf312('0x39')]();_0x1a03b2[_0xf312('0x37')][_0xf312('0x28')]=_0x1a03b2[_0xf312('0x37')][_0xf312('0x28')][_0xf312('0x3a')]()[_0xf312('0x3b')]();var _0x4bd177;return db[_0xf312('0x3c')][_0xf312('0xb')]({'where':{'id':0x1},'attributes':[_0xf312('0xc'),_0xf312('0x19')],'raw':!![]})[_0xf312('0xd')](function(_0x12749b){_0x4bd177=_0x12749b;return db[_0xf312('0x3d')]['find']({'where':{'email':_0x1a03b2['body'][_0xf312('0x28')]}});})[_0xf312('0xd')](function(_0x37b84f){if(!_0x37b84f){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x37b84f[_0xf312('0x18')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x37b84f[_0xf312('0x11')]){if(moment(_0x37b84f[_0xf312('0x1a')])[_0xf312('0x1b')](_0x4bd177[_0xf312('0x19')],_0xf312('0x1c'))>moment()){throw new Error(_0xf312('0x3e'));}else{_0x37b84f['blocked']=![];_0x37b84f[_0xf312('0x1a')]=null;}}_0x37b84f[_0xf312('0x3f')]=_0x1fa828;_0x37b84f[_0xf312('0x40')]=Date[_0xf312('0x41')]()+0x36ee80;return _0x37b84f[_0xf312('0x42')]();})[_0xf312('0xd')](function(){return sendServiceMail({'to':_0x1a03b2['body'][_0xf312('0x28')],'subject':_0xf312('0x43'),'text':_0xf312('0x44')+_0xf312('0x45')+'https://'+_0x1a03b2[_0xf312('0x46')][_0xf312('0x47')]+_0xf312('0x48')+_0x1fa828+'\x0a\x0a'+_0xf312('0x49')});})[_0xf312('0xd')](function(){_0x3220b1[_0xf312('0x2e')](0xc8)[_0xf312('0x2f')]({'message':_0xf312('0x4a')});})['catch'](function(_0x2a5f27){return handleError(_0x3220b1,0x1f4,_0x2a5f27);});};exports['reset']=function(_0xe703b2,_0x10c80c){return db[_0xf312('0x3d')][_0xf312('0x20')]({'where':{'resetPasswordToken':_0xe703b2[_0xf312('0x4b')][_0xf312('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x3fda37){if(!_0x3fda37){throw new Error(_0xf312('0x4d'));}return db[_0xf312('0x3c')][_0xf312('0xb')]({'attributes':['id',_0xf312('0x4e'),_0xf312('0x4f'),_0xf312('0x50')]})[_0xf312('0xd')](function(_0x456f2c){if(_0x456f2c[_0xf312('0x4e')])authService[_0xf312('0x51')](_0xe703b2[_0xf312('0x37')][_0xf312('0xe')]);if(!_0x456f2c[_0xf312('0x4f')]||!_0x3fda37[_0xf312('0x52')])return _0x3fda37;authService['validatePasswordHistory'](_0xe703b2['body']['password'],_0x3fda37[_0xf312('0x52')],_0x456f2c['passwordHistoryLimit']);return _0x3fda37;})[_0xf312('0xd')](function(){_0x3fda37[_0xf312('0xe')]=_0xe703b2[_0xf312('0x37')][_0xf312('0xe')];_0x3fda37[_0xf312('0x3f')]=null;_0x3fda37[_0xf312('0x40')]=null;return _0x3fda37[_0xf312('0x42')]();});})[_0xf312('0xd')](function(){_0x10c80c[_0xf312('0x2e')](0xc8)['send']({'message':'Password\x20reset!'});})[_0xf312('0x1f')](function(_0x5457c9){return handleError(_0x10c80c,0x1f4,_0x5457c9);});};passport[_0xf312('0x53')]('local-login',new LocalStrategy({'usernameField':_0xf312('0x15'),'passwordField':_0xf312('0xe')},function(_0x4593c1,_0x2e3f47,_0x13de49){return localAuthenticate(db[_0xf312('0x3d')],_0x4593c1,_0x2e3f47,_0x13de49);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a4aa0de..203c106 100644 --- a/server/api/authLocal/index.js +++ b/server/api/authLocal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf51=['/reset/:token','Router','./authLocal.controller','/forgot','post'];(function(_0x156dd8,_0x284471){var _0x4edf66=function(_0x50a94f){while(--_0x50a94f){_0x156dd8['push'](_0x156dd8['shift']());}};_0x4edf66(++_0x284471);}(_0xcf51,0x1e1));var _0x1cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf51[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0x1cf5('0x0')]();var controller=require(_0x1cf5('0x1'));router['post']('/',controller['login']);router['post'](_0x1cf5('0x2'),controller['forgot']);router[_0x1cf5('0x3')](_0x1cf5('0x4'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0x4ba7=['post','forgot','/reset/:token','reset','exports','express','./authLocal.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ba7,0x147));var _0x74ba=function(_0x3e03b9,_0x874d0a){_0x3e03b9=_0x3e03b9-0x0;var _0x8e9f81=_0x4ba7[_0x3e03b9];return _0x8e9f81;};'use strict';var express=require(_0x74ba('0x0'));var router=express['Router']();var controller=require(_0x74ba('0x1'));router[_0x74ba('0x2')]('/',controller['login']);router[_0x74ba('0x2')]('/forgot',controller[_0x74ba('0x3')]);router['post'](_0x74ba('0x4'),controller[_0x74ba('0x5')]);module[_0x74ba('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 0c683b0..bed394f 100644 --- a/server/api/automation/automation.attributes.js +++ b/server/api/automation/automation.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5784=['sequelize','exports','STRING','BOOLEAN'];(function(_0x187c2d,_0x465bfa){var _0x149f8b=function(_0x473b01){while(--_0x473b01){_0x187c2d['push'](_0x187c2d['shift']());}};_0x149f8b(++_0x465bfa);}(_0x5784,0x1d4));var _0x4578=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5784[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x4578('0x0'));module[_0x4578('0x1')]={'name':{'type':Sequelize[_0x4578('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x4578('0x2')]},'description':{'type':Sequelize[_0x4578('0x2')]},'status':{'type':Sequelize[_0x4578('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x857c=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0xd358c9,_0x4a7a84){var _0x4562bf=function(_0x1158c4){while(--_0x1158c4){_0xd358c9['push'](_0xd358c9['shift']());}};_0x4562bf(++_0x4a7a84);}(_0x857c,0x14b));var _0xc857=function(_0x201a04,_0x22560c){_0x201a04=_0x201a04-0x0;var _0x4248c3=_0x857c[_0x201a04];return _0x4248c3;};'use strict';var Sequelize=require(_0xc857('0x0'));module[_0xc857('0x1')]={'name':{'type':Sequelize[_0xc857('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xc857('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc857('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 51bbfa5..b6e56cf 100644 --- a/server/api/automation/automation.controller.js +++ b/server/api/automation/automation.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc8e2=['status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Automation','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','body','find','addConditions','Condition','ids','omit','getConditions','findOne','sort','addActions','Action','getActions','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x4549f2,_0x3ae7cb){var _0x4957d7=function(_0x1201b2){while(--_0x1201b2){_0x4549f2['push'](_0x4549f2['shift']());}};_0x4957d7(++_0x3ae7cb);}(_0xc8e2,0x1d4));var _0x2c8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc8e2[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2c8e('0x0'));var rimraf=require(_0x2c8e('0x1'));var zipdir=require(_0x2c8e('0x2'));var jsonpatch=require(_0x2c8e('0x3'));var rp=require(_0x2c8e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c8e('0x5'));var util=require('util');var path=require(_0x2c8e('0x6'));var sox=require(_0x2c8e('0x7'));var csv=require('to-csv');var ejs=require(_0x2c8e('0x8'));var fs=require('fs');var fs_extra=require(_0x2c8e('0x9'));var _=require(_0x2c8e('0xa'));var squel=require(_0x2c8e('0xb'));var crypto=require(_0x2c8e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2c8e('0xd'));var toCsv=require(_0x2c8e('0xe'));var querystring=require(_0x2c8e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c8e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2c8e('0x11'));var hardwareService=require(_0x2c8e('0x12'));var logger=require(_0x2c8e('0x13'))('api');var utils=require(_0x2c8e('0x14'));var config=require(_0x2c8e('0x15'));var licenseUtil=require(_0x2c8e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3adeb1,_0x1b0060){_0x1b0060=_0x1b0060||0xcc;return function(_0x5ea2ca){if(_0x5ea2ca){return _0x3adeb1[_0x2c8e('0x17')](_0x1b0060);}return _0x3adeb1[_0x2c8e('0x18')](_0x1b0060)[_0x2c8e('0x19')]();};}function respondWithResult(_0x9e83df,_0x506ff7){_0x506ff7=_0x506ff7||0xc8;return function(_0x365849){if(_0x365849){return _0x9e83df[_0x2c8e('0x18')](_0x506ff7)[_0x2c8e('0x1a')](_0x365849);}};}function respondWithFilteredResult(_0x15ce9c,_0xeb87b9){return function(_0x431a40){if(_0x431a40){var _0x29ac74=typeof _0xeb87b9[_0x2c8e('0x1b')]===_0x2c8e('0x1c')&&typeof _0xeb87b9[_0x2c8e('0x1d')]===_0x2c8e('0x1c');var _0x415fb2=_0x431a40[_0x2c8e('0x1e')];var _0x59f8dc=_0x29ac74?0x0:_0xeb87b9[_0x2c8e('0x1b')];var _0x4a6612=_0x29ac74?_0x431a40['count']:_0xeb87b9['offset']+_0xeb87b9['limit'];var _0x27aca9;if(_0x4a6612>=_0x415fb2){_0x4a6612=_0x415fb2;_0x27aca9=0xc8;}else{_0x27aca9=0xce;}_0x15ce9c[_0x2c8e('0x18')](_0x27aca9);return _0x15ce9c[_0x2c8e('0x1f')](_0x2c8e('0x20'),_0x59f8dc+'-'+_0x4a6612+'/'+_0x415fb2)[_0x2c8e('0x1a')](_0x431a40);}return null;};}function patchUpdates(_0x4624ff){return function(_0x38724){try{jsonpatch['apply'](_0x38724,_0x4624ff,!![]);}catch(_0x508f99){return BPromise[_0x2c8e('0x21')](_0x508f99);}return _0x38724[_0x2c8e('0x22')]();};}function saveUpdates(_0x2f9719,_0x5c8df6){return function(_0x37d942){if(_0x37d942){return _0x37d942[_0x2c8e('0x23')](_0x2f9719)['then'](function(_0x3f9724){return _0x3f9724;});}return null;};}function removeEntity(_0x323f5c,_0x1d0ec4){return function(_0x1fdd1a){if(_0x1fdd1a){return _0x1fdd1a[_0x2c8e('0x24')]()[_0x2c8e('0x25')](function(){_0x323f5c[_0x2c8e('0x18')](0xcc)[_0x2c8e('0x19')]();});}};}function handleEntityNotFound(_0x5dd9dc,_0x11a2b6){return function(_0x37dc11){if(!_0x37dc11){_0x5dd9dc['sendStatus'](0x194);}return _0x37dc11;};}function handleError(_0x1466ed,_0x21a3c5){_0x21a3c5=_0x21a3c5||0x1f4;return function(_0x7020){logger[_0x2c8e('0x26')](_0x7020[_0x2c8e('0x27')]);if(_0x7020[_0x2c8e('0x28')]){delete _0x7020[_0x2c8e('0x28')];}_0x1466ed['status'](_0x21a3c5)[_0x2c8e('0x29')](_0x7020);};}exports[_0x2c8e('0x2a')]=function(_0x5e2747,_0x17e02b){var _0x24fc9f={},_0x5139cd={},_0x31c7ec={'count':0x0,'rows':[]};var _0x6c1c35=_[_0x2c8e('0x2b')](db[_0x2c8e('0x2c')][_0x2c8e('0x2d')],function(_0x46a019){return{'name':_0x46a019['fieldName'],'type':_0x46a019[_0x2c8e('0x2e')]['key']};});_0x5139cd[_0x2c8e('0x2f')]=_['map'](_0x6c1c35,_0x2c8e('0x28'));_0x5139cd[_0x2c8e('0x30')]=_['keys'](_0x5e2747['query']);_0x5139cd['filters']=_[_0x2c8e('0x31')](_0x5139cd[_0x2c8e('0x2f')],_0x5139cd[_0x2c8e('0x30')]);_0x24fc9f['attributes']=_[_0x2c8e('0x31')](_0x5139cd[_0x2c8e('0x2f')],qs[_0x2c8e('0x32')](_0x5e2747[_0x2c8e('0x30')]['fields']));_0x24fc9f[_0x2c8e('0x33')]=_0x24fc9f['attributes'][_0x2c8e('0x34')]?_0x24fc9f[_0x2c8e('0x33')]:_0x5139cd['model'];if(!_0x5e2747['query'][_0x2c8e('0x35')](_0x2c8e('0x36'))){_0x24fc9f[_0x2c8e('0x1d')]=qs['limit'](_0x5e2747['query'][_0x2c8e('0x1d')]);_0x24fc9f[_0x2c8e('0x1b')]=qs[_0x2c8e('0x1b')](_0x5e2747['query'][_0x2c8e('0x1b')]);}_0x24fc9f[_0x2c8e('0x37')]=qs['sort'](_0x5e2747[_0x2c8e('0x30')]['sort']);_0x24fc9f['where']=qs[_0x2c8e('0x38')](_['pick'](_0x5e2747[_0x2c8e('0x30')],_0x5139cd[_0x2c8e('0x38')]),_0x6c1c35);if(_0x5e2747[_0x2c8e('0x30')][_0x2c8e('0x39')]){_0x24fc9f[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x24fc9f['where'],{'$or':_['map'](_0x6c1c35,function(_0x2a8672){if(_0x2a8672['type']!=='VIRTUAL'){var _0x3f89be={};_0x3f89be[_0x2a8672[_0x2c8e('0x28')]]={'$like':'%'+_0x5e2747[_0x2c8e('0x30')][_0x2c8e('0x39')]+'%'};return _0x3f89be;}})});}_0x24fc9f=_[_0x2c8e('0x3b')]({},_0x24fc9f,_0x5e2747[_0x2c8e('0x3c')]);var _0x59b843={'where':_0x24fc9f[_0x2c8e('0x3a')]};return db[_0x2c8e('0x2c')][_0x2c8e('0x1e')](_0x59b843)['then'](function(_0x13f483){_0x31c7ec[_0x2c8e('0x1e')]=_0x13f483;if(_0x5e2747['query'][_0x2c8e('0x3d')]){_0x24fc9f[_0x2c8e('0x3e')]=[{'all':!![]}];}return db['Automation'][_0x2c8e('0x3f')](_0x24fc9f);})['then'](function(_0x582686){_0x31c7ec[_0x2c8e('0x40')]=_0x582686;return _0x31c7ec;})[_0x2c8e('0x25')](respondWithFilteredResult(_0x17e02b,_0x24fc9f))[_0x2c8e('0x41')](handleError(_0x17e02b,null));};exports[_0x2c8e('0x42')]=function(_0x5b2f61,_0x275b40){var _0x93d206={'raw':![],'where':{'id':_0x5b2f61[_0x2c8e('0x43')]['id']}},_0x13b2a9={};_0x13b2a9['model']=_['keys'](db['Automation']['rawAttributes']);_0x13b2a9[_0x2c8e('0x30')]=_[_0x2c8e('0x44')](_0x5b2f61[_0x2c8e('0x30')]);_0x13b2a9[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x13b2a9[_0x2c8e('0x2f')],_0x13b2a9[_0x2c8e('0x30')]);_0x93d206[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x13b2a9[_0x2c8e('0x2f')],qs[_0x2c8e('0x32')](_0x5b2f61['query'][_0x2c8e('0x32')]));_0x93d206[_0x2c8e('0x33')]=_0x93d206[_0x2c8e('0x33')]['length']?_0x93d206[_0x2c8e('0x33')]:_0x13b2a9[_0x2c8e('0x2f')];if(_0x5b2f61[_0x2c8e('0x30')][_0x2c8e('0x3d')]){_0x93d206[_0x2c8e('0x3e')]=[{'all':!![]}];}_0x93d206=_[_0x2c8e('0x3b')]({},_0x93d206,_0x5b2f61[_0x2c8e('0x3c')]);return db[_0x2c8e('0x2c')]['find'](_0x93d206)[_0x2c8e('0x25')](handleEntityNotFound(_0x275b40,null))[_0x2c8e('0x25')](respondWithResult(_0x275b40,null))[_0x2c8e('0x41')](handleError(_0x275b40,null));};exports['create']=function(_0x37e070,_0x120632){return db[_0x2c8e('0x2c')]['create'](_0x37e070[_0x2c8e('0x45')],{})[_0x2c8e('0x25')](respondWithResult(_0x120632,0xc9))[_0x2c8e('0x41')](handleError(_0x120632,null));};exports[_0x2c8e('0x23')]=function(_0x5bbaea,_0x194b3c){if(_0x5bbaea[_0x2c8e('0x45')]['id']){delete _0x5bbaea[_0x2c8e('0x45')]['id'];}return db['Automation'][_0x2c8e('0x46')]({'where':{'id':_0x5bbaea[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x194b3c,null))[_0x2c8e('0x25')](saveUpdates(_0x5bbaea[_0x2c8e('0x45')],null))['then'](respondWithResult(_0x194b3c,null))[_0x2c8e('0x41')](handleError(_0x194b3c,null));};exports[_0x2c8e('0x24')]=function(_0x2de496,_0x4ef6b6){return db['Automation'][_0x2c8e('0x46')]({'where':{'id':_0x2de496[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x4ef6b6,null))[_0x2c8e('0x25')](removeEntity(_0x4ef6b6,null))['catch'](handleError(_0x4ef6b6,null));};exports[_0x2c8e('0x47')]=function(_0x1d3d24,_0xdfc74b,_0x3fd421){return db[_0x2c8e('0x48')][_0x2c8e('0x46')]({'where':{'id':_0x1d3d24[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0xdfc74b,null))[_0x2c8e('0x25')](function(_0xb23c0a){if(_0xb23c0a){return _0xb23c0a[_0x2c8e('0x47')](_0x1d3d24[_0x2c8e('0x45')][_0x2c8e('0x49')],_[_0x2c8e('0x4a')](_0x1d3d24[_0x2c8e('0x45')],[_0x2c8e('0x49'),'id'])||{});}})['then'](respondWithResult(_0xdfc74b,null))[_0x2c8e('0x41')](handleError(_0xdfc74b,null));};exports[_0x2c8e('0x4b')]=function(_0x294943,_0x4f5075,_0x207ca9){var _0x32cb18={};var _0x144729={};var _0x265dc9;var _0x22c6c5;return db[_0x2c8e('0x2c')][_0x2c8e('0x4c')]({'where':{'id':_0x294943[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x4f5075,null))[_0x2c8e('0x25')](function(_0x4cb2af){if(_0x4cb2af){_0x265dc9=_0x4cb2af;_0x144729[_0x2c8e('0x2f')]=_['keys'](db[_0x2c8e('0x48')]['rawAttributes']);_0x144729[_0x2c8e('0x30')]=_['keys'](_0x294943['query']);_0x144729[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x144729['model'],_0x144729[_0x2c8e('0x30')]);_0x32cb18[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x144729['model'],qs['fields'](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x32')]));_0x32cb18[_0x2c8e('0x33')]=_0x32cb18['attributes'][_0x2c8e('0x34')]?_0x32cb18[_0x2c8e('0x33')]:_0x144729['model'];_0x32cb18[_0x2c8e('0x37')]=qs[_0x2c8e('0x4d')](_0x294943['query'][_0x2c8e('0x4d')]);_0x32cb18[_0x2c8e('0x3a')]=qs[_0x2c8e('0x38')](_['pick'](_0x294943[_0x2c8e('0x30')],_0x144729[_0x2c8e('0x38')]));if(_0x294943[_0x2c8e('0x30')][_0x2c8e('0x39')]){_0x32cb18[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x32cb18[_0x2c8e('0x3a')],{'$or':_[_0x2c8e('0x2b')](_0x32cb18[_0x2c8e('0x33')],function(_0x960a36){var _0x3492ad={};_0x3492ad[_0x960a36]={'$like':'%'+_0x294943['query'][_0x2c8e('0x39')]+'%'};return _0x3492ad;})});}_0x32cb18=_['merge']({},_0x32cb18,_0x294943[_0x2c8e('0x3c')]);return _0x265dc9[_0x2c8e('0x4b')](_0x32cb18);}})['then'](function(_0x51a202){if(_0x51a202){_0x22c6c5=_0x51a202['length'];if(!_0x294943['query'][_0x2c8e('0x35')](_0x2c8e('0x36'))){_0x32cb18[_0x2c8e('0x1d')]=qs['limit'](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x1d')]);_0x32cb18[_0x2c8e('0x1b')]=qs[_0x2c8e('0x1b')](_0x294943[_0x2c8e('0x30')][_0x2c8e('0x1b')]);}return _0x265dc9['getConditions'](_0x32cb18);}})[_0x2c8e('0x25')](function(_0x506d81){if(_0x506d81){return _0x506d81?{'count':_0x22c6c5,'rows':_0x506d81}:null;}})[_0x2c8e('0x25')](respondWithResult(_0x4f5075,null))[_0x2c8e('0x41')](handleError(_0x4f5075,null));};exports[_0x2c8e('0x4e')]=function(_0x41f433,_0x59b1f1,_0x185077){return db[_0x2c8e('0x4f')]['find']({'where':{'id':_0x41f433[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x59b1f1,null))['then'](function(_0xe8a344){if(_0xe8a344){return _0xe8a344[_0x2c8e('0x4e')](_0x41f433[_0x2c8e('0x45')][_0x2c8e('0x49')],_[_0x2c8e('0x4a')](_0x41f433['body'],['ids','id'])||{});}})[_0x2c8e('0x25')](respondWithResult(_0x59b1f1,null))[_0x2c8e('0x41')](handleError(_0x59b1f1,null));};exports[_0x2c8e('0x50')]=function(_0x5d2e6e,_0x1e1c34,_0x23e5d0){var _0x55b84c={};var _0x376ad1={};var _0x2e0275;var _0x58fe6f;return db[_0x2c8e('0x2c')][_0x2c8e('0x4c')]({'where':{'id':_0x5d2e6e[_0x2c8e('0x43')]['id']}})[_0x2c8e('0x25')](handleEntityNotFound(_0x1e1c34,null))[_0x2c8e('0x25')](function(_0x5971a3){if(_0x5971a3){_0x2e0275=_0x5971a3;_0x376ad1[_0x2c8e('0x2f')]=_[_0x2c8e('0x44')](db[_0x2c8e('0x4f')][_0x2c8e('0x2d')]);_0x376ad1[_0x2c8e('0x30')]=_[_0x2c8e('0x44')](_0x5d2e6e['query']);_0x376ad1[_0x2c8e('0x38')]=_[_0x2c8e('0x31')](_0x376ad1['model'],_0x376ad1[_0x2c8e('0x30')]);_0x55b84c[_0x2c8e('0x33')]=_[_0x2c8e('0x31')](_0x376ad1[_0x2c8e('0x2f')],qs['fields'](_0x5d2e6e[_0x2c8e('0x30')][_0x2c8e('0x32')]));_0x55b84c['attributes']=_0x55b84c[_0x2c8e('0x33')]['length']?_0x55b84c['attributes']:_0x376ad1[_0x2c8e('0x2f')];_0x55b84c[_0x2c8e('0x37')]=qs[_0x2c8e('0x4d')](_0x5d2e6e[_0x2c8e('0x30')]['sort']);_0x55b84c[_0x2c8e('0x3a')]=qs['filters'](_[_0x2c8e('0x51')](_0x5d2e6e[_0x2c8e('0x30')],_0x376ad1[_0x2c8e('0x38')]));if(_0x5d2e6e['query']['filter']){_0x55b84c[_0x2c8e('0x3a')]=_[_0x2c8e('0x3b')](_0x55b84c['where'],{'$or':_[_0x2c8e('0x2b')](_0x55b84c[_0x2c8e('0x33')],function(_0x2c95b4){var _0x1530dd={};_0x1530dd[_0x2c95b4]={'$like':'%'+_0x5d2e6e[_0x2c8e('0x30')]['filter']+'%'};return _0x1530dd;})});}_0x55b84c=_[_0x2c8e('0x3b')]({},_0x55b84c,_0x5d2e6e['options']);return _0x2e0275[_0x2c8e('0x50')](_0x55b84c);}})[_0x2c8e('0x25')](function(_0x31bcf0){if(_0x31bcf0){_0x58fe6f=_0x31bcf0[_0x2c8e('0x34')];if(!_0x5d2e6e['query'][_0x2c8e('0x35')]('nolimit')){_0x55b84c[_0x2c8e('0x1d')]=qs[_0x2c8e('0x1d')](_0x5d2e6e[_0x2c8e('0x30')][_0x2c8e('0x1d')]);_0x55b84c['offset']=qs[_0x2c8e('0x1b')](_0x5d2e6e['query'][_0x2c8e('0x1b')]);}return _0x2e0275[_0x2c8e('0x50')](_0x55b84c);}})[_0x2c8e('0x25')](function(_0x5862f5){if(_0x5862f5){return _0x5862f5?{'count':_0x58fe6f,'rows':_0x5862f5}:null;}})[_0x2c8e('0x25')](respondWithResult(_0x1e1c34,null))['catch'](handleError(_0x1e1c34,null));}; \ No newline at end of file +var _0x4728=['omit','findOne','order','getConditions','addActions','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','addConditions','Condition','ids'];(function(_0x555ba9,_0x3a210e){var _0xe2fc83=function(_0x20200d){while(--_0x20200d){_0x555ba9['push'](_0x555ba9['shift']());}};_0xe2fc83(++_0x3a210e);}(_0x4728,0x102));var _0x8472=function(_0x3afa96,_0x253f12){_0x3afa96=_0x3afa96-0x0;var _0x5d009c=_0x4728[_0x3afa96];return _0x5d009c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8472('0x0'));var zipdir=require(_0x8472('0x1'));var jsonpatch=require(_0x8472('0x2'));var rp=require(_0x8472('0x3'));var moment=require(_0x8472('0x4'));var BPromise=require(_0x8472('0x5'));var Mustache=require(_0x8472('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8472('0x7'));var csv=require(_0x8472('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8472('0x9'));var _=require('lodash');var squel=require(_0x8472('0xa'));var crypto=require(_0x8472('0xb'));var jsforce=require(_0x8472('0xc'));var deskjs=require(_0x8472('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8472('0xe'));var Papa=require(_0x8472('0xf'));var Redis=require(_0x8472('0x10'));var authService=require(_0x8472('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8472('0x12'));var logger=require(_0x8472('0x13'))(_0x8472('0x14'));var utils=require('../../config/utils');var config=require(_0x8472('0x15'));var licenseUtil=require(_0x8472('0x16'));var db=require(_0x8472('0x17'))['db'];function respondWithStatusCode(_0x37f443,_0x83b628){_0x83b628=_0x83b628||0xcc;return function(_0x13eb22){if(_0x13eb22){return _0x37f443[_0x8472('0x18')](_0x83b628);}return _0x37f443[_0x8472('0x19')](_0x83b628)['end']();};}function respondWithResult(_0x4c8e1b,_0x5ded16){_0x5ded16=_0x5ded16||0xc8;return function(_0x5b76ee){if(_0x5b76ee){return _0x4c8e1b[_0x8472('0x19')](_0x5ded16)[_0x8472('0x1a')](_0x5b76ee);}};}function respondWithFilteredResult(_0x5836a3,_0x26d50d){return function(_0x57164c){if(_0x57164c){var _0x51f74b=typeof _0x26d50d[_0x8472('0x1b')]==='undefined'&&typeof _0x26d50d[_0x8472('0x1c')]===_0x8472('0x1d');var _0x53cb97=_0x57164c[_0x8472('0x1e')];var _0x5d6e37=_0x51f74b?0x0:_0x26d50d[_0x8472('0x1b')];var _0x4b4510=_0x51f74b?_0x57164c[_0x8472('0x1e')]:_0x26d50d['offset']+_0x26d50d['limit'];var _0x3fc5b2;if(_0x4b4510>=_0x53cb97){_0x4b4510=_0x53cb97;_0x3fc5b2=0xc8;}else{_0x3fc5b2=0xce;}_0x5836a3['status'](_0x3fc5b2);return _0x5836a3[_0x8472('0x1f')](_0x8472('0x20'),_0x5d6e37+'-'+_0x4b4510+'/'+_0x53cb97)[_0x8472('0x1a')](_0x57164c);}return null;};}function patchUpdates(_0x209d06){return function(_0x1837da){try{jsonpatch[_0x8472('0x21')](_0x1837da,_0x209d06,!![]);}catch(_0x36a662){return BPromise[_0x8472('0x22')](_0x36a662);}return _0x1837da[_0x8472('0x23')]();};}function saveUpdates(_0x273a37,_0x358e9){return function(_0x2965f8){if(_0x2965f8){return _0x2965f8['update'](_0x273a37)[_0x8472('0x24')](function(_0x5ad293){return _0x5ad293;});}return null;};}function removeEntity(_0xe01ff9,_0x20144e){return function(_0x4b6c66){if(_0x4b6c66){return _0x4b6c66[_0x8472('0x25')]()['then'](function(){_0xe01ff9[_0x8472('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x500c35,_0x2247e2){return function(_0x202556){if(!_0x202556){_0x500c35[_0x8472('0x18')](0x194);}return _0x202556;};}function handleError(_0x229a09,_0x322745){_0x322745=_0x322745||0x1f4;return function(_0x1f23d2){logger[_0x8472('0x26')](_0x1f23d2['stack']);if(_0x1f23d2[_0x8472('0x27')]){delete _0x1f23d2[_0x8472('0x27')];}_0x229a09['status'](_0x322745)[_0x8472('0x28')](_0x1f23d2);};}exports[_0x8472('0x29')]=function(_0x25918e,_0x4f88c7){var _0x4c597a={},_0x337571={},_0x1131bc={'count':0x0,'rows':[]};var _0x30a730=_['map'](db['Automation'][_0x8472('0x2a')],function(_0x14741b){return{'name':_0x14741b[_0x8472('0x2b')],'type':_0x14741b['type'][_0x8472('0x2c')]};});_0x337571[_0x8472('0x2d')]=_[_0x8472('0x2e')](_0x30a730,_0x8472('0x27'));_0x337571[_0x8472('0x2f')]=_[_0x8472('0x30')](_0x25918e[_0x8472('0x2f')]);_0x337571[_0x8472('0x31')]=_[_0x8472('0x32')](_0x337571[_0x8472('0x2d')],_0x337571[_0x8472('0x2f')]);_0x4c597a['attributes']=_[_0x8472('0x32')](_0x337571[_0x8472('0x2d')],qs[_0x8472('0x33')](_0x25918e[_0x8472('0x2f')][_0x8472('0x33')]));_0x4c597a['attributes']=_0x4c597a['attributes'][_0x8472('0x34')]?_0x4c597a[_0x8472('0x35')]:_0x337571[_0x8472('0x2d')];if(!_0x25918e[_0x8472('0x2f')][_0x8472('0x36')](_0x8472('0x37'))){_0x4c597a[_0x8472('0x1c')]=qs['limit'](_0x25918e[_0x8472('0x2f')][_0x8472('0x1c')]);_0x4c597a[_0x8472('0x1b')]=qs[_0x8472('0x1b')](_0x25918e['query'][_0x8472('0x1b')]);}_0x4c597a['order']=qs[_0x8472('0x38')](_0x25918e[_0x8472('0x2f')][_0x8472('0x38')]);_0x4c597a['where']=qs[_0x8472('0x31')](_[_0x8472('0x39')](_0x25918e[_0x8472('0x2f')],_0x337571[_0x8472('0x31')]),_0x30a730);if(_0x25918e['query'][_0x8472('0x3a')]){_0x4c597a['where']=_[_0x8472('0x3b')](_0x4c597a[_0x8472('0x3c')],{'$or':_[_0x8472('0x2e')](_0x30a730,function(_0x2aabc3){if(_0x2aabc3[_0x8472('0x3d')]!=='VIRTUAL'){var _0x3e6dd2={};_0x3e6dd2[_0x2aabc3['name']]={'$like':'%'+_0x25918e[_0x8472('0x2f')][_0x8472('0x3a')]+'%'};return _0x3e6dd2;}})});}_0x4c597a=_['merge']({},_0x4c597a,_0x25918e[_0x8472('0x3e')]);var _0x261e3e={'where':_0x4c597a[_0x8472('0x3c')]};return db[_0x8472('0x3f')]['count'](_0x261e3e)[_0x8472('0x24')](function(_0x238140){_0x1131bc[_0x8472('0x1e')]=_0x238140;if(_0x25918e[_0x8472('0x2f')][_0x8472('0x40')]){_0x4c597a[_0x8472('0x41')]=[{'all':!![]}];}return db[_0x8472('0x3f')][_0x8472('0x42')](_0x4c597a);})['then'](function(_0x1952cd){_0x1131bc[_0x8472('0x43')]=_0x1952cd;return _0x1131bc;})[_0x8472('0x24')](respondWithFilteredResult(_0x4f88c7,_0x4c597a))[_0x8472('0x44')](handleError(_0x4f88c7,null));};exports[_0x8472('0x45')]=function(_0x27ab14,_0x337185){var _0x20239c={'raw':![],'where':{'id':_0x27ab14[_0x8472('0x46')]['id']}},_0x25aa30={};_0x25aa30[_0x8472('0x2d')]=_[_0x8472('0x30')](db[_0x8472('0x3f')][_0x8472('0x2a')]);_0x25aa30[_0x8472('0x2f')]=_[_0x8472('0x30')](_0x27ab14[_0x8472('0x2f')]);_0x25aa30[_0x8472('0x31')]=_[_0x8472('0x32')](_0x25aa30[_0x8472('0x2d')],_0x25aa30[_0x8472('0x2f')]);_0x20239c['attributes']=_['intersection'](_0x25aa30[_0x8472('0x2d')],qs[_0x8472('0x33')](_0x27ab14[_0x8472('0x2f')]['fields']));_0x20239c['attributes']=_0x20239c[_0x8472('0x35')][_0x8472('0x34')]?_0x20239c[_0x8472('0x35')]:_0x25aa30['model'];if(_0x27ab14[_0x8472('0x2f')][_0x8472('0x40')]){_0x20239c[_0x8472('0x41')]=[{'all':!![]}];}_0x20239c=_[_0x8472('0x3b')]({},_0x20239c,_0x27ab14[_0x8472('0x3e')]);return db[_0x8472('0x3f')][_0x8472('0x47')](_0x20239c)['then'](handleEntityNotFound(_0x337185,null))['then'](respondWithResult(_0x337185,null))['catch'](handleError(_0x337185,null));};exports[_0x8472('0x48')]=function(_0x3b06b6,_0x10befb){return db['Automation'][_0x8472('0x48')](_0x3b06b6[_0x8472('0x49')],{})['then'](respondWithResult(_0x10befb,0xc9))[_0x8472('0x44')](handleError(_0x10befb,null));};exports[_0x8472('0x4a')]=function(_0x382150,_0x2c395f){if(_0x382150[_0x8472('0x49')]['id']){delete _0x382150[_0x8472('0x49')]['id'];}return db[_0x8472('0x3f')]['find']({'where':{'id':_0x382150['params']['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x2c395f,null))[_0x8472('0x24')](saveUpdates(_0x382150[_0x8472('0x49')],null))[_0x8472('0x24')](respondWithResult(_0x2c395f,null))[_0x8472('0x44')](handleError(_0x2c395f,null));};exports[_0x8472('0x25')]=function(_0x37f23b,_0x401b50){return db['Automation'][_0x8472('0x47')]({'where':{'id':_0x37f23b[_0x8472('0x46')]['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x401b50,null))['then'](removeEntity(_0x401b50,null))[_0x8472('0x44')](handleError(_0x401b50,null));};exports[_0x8472('0x4b')]=function(_0x2e16d6,_0x37dcb4,_0x2893aa){return db[_0x8472('0x4c')][_0x8472('0x47')]({'where':{'id':_0x2e16d6['params']['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x37dcb4,null))[_0x8472('0x24')](function(_0x691efb){if(_0x691efb){return _0x691efb[_0x8472('0x4b')](_0x2e16d6[_0x8472('0x49')][_0x8472('0x4d')],_[_0x8472('0x4e')](_0x2e16d6[_0x8472('0x49')],[_0x8472('0x4d'),'id'])||{});}})[_0x8472('0x24')](respondWithResult(_0x37dcb4,null))[_0x8472('0x44')](handleError(_0x37dcb4,null));};exports['getConditions']=function(_0x2c147a,_0x400a78,_0x1d9562){var _0x104384={};var _0x4e6eba={};var _0x1ab945;var _0x106ee7;return db['Automation'][_0x8472('0x4f')]({'where':{'id':_0x2c147a[_0x8472('0x46')]['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x400a78,null))['then'](function(_0x533f45){if(_0x533f45){_0x1ab945=_0x533f45;_0x4e6eba[_0x8472('0x2d')]=_['keys'](db[_0x8472('0x4c')]['rawAttributes']);_0x4e6eba[_0x8472('0x2f')]=_[_0x8472('0x30')](_0x2c147a[_0x8472('0x2f')]);_0x4e6eba[_0x8472('0x31')]=_['intersection'](_0x4e6eba[_0x8472('0x2d')],_0x4e6eba['query']);_0x104384['attributes']=_[_0x8472('0x32')](_0x4e6eba[_0x8472('0x2d')],qs[_0x8472('0x33')](_0x2c147a[_0x8472('0x2f')]['fields']));_0x104384[_0x8472('0x35')]=_0x104384[_0x8472('0x35')][_0x8472('0x34')]?_0x104384[_0x8472('0x35')]:_0x4e6eba[_0x8472('0x2d')];_0x104384[_0x8472('0x50')]=qs['sort'](_0x2c147a['query'][_0x8472('0x38')]);_0x104384[_0x8472('0x3c')]=qs[_0x8472('0x31')](_['pick'](_0x2c147a[_0x8472('0x2f')],_0x4e6eba[_0x8472('0x31')]));if(_0x2c147a[_0x8472('0x2f')][_0x8472('0x3a')]){_0x104384[_0x8472('0x3c')]=_[_0x8472('0x3b')](_0x104384[_0x8472('0x3c')],{'$or':_['map'](_0x104384[_0x8472('0x35')],function(_0x2e9151){var _0x44aa09={};_0x44aa09[_0x2e9151]={'$like':'%'+_0x2c147a['query'][_0x8472('0x3a')]+'%'};return _0x44aa09;})});}_0x104384=_['merge']({},_0x104384,_0x2c147a[_0x8472('0x3e')]);return _0x1ab945['getConditions'](_0x104384);}})[_0x8472('0x24')](function(_0x1504a2){if(_0x1504a2){_0x106ee7=_0x1504a2[_0x8472('0x34')];if(!_0x2c147a[_0x8472('0x2f')][_0x8472('0x36')]('nolimit')){_0x104384['limit']=qs['limit'](_0x2c147a[_0x8472('0x2f')][_0x8472('0x1c')]);_0x104384[_0x8472('0x1b')]=qs['offset'](_0x2c147a['query'][_0x8472('0x1b')]);}return _0x1ab945[_0x8472('0x51')](_0x104384);}})[_0x8472('0x24')](function(_0x45749c){if(_0x45749c){return _0x45749c?{'count':_0x106ee7,'rows':_0x45749c}:null;}})['then'](respondWithResult(_0x400a78,null))[_0x8472('0x44')](handleError(_0x400a78,null));};exports[_0x8472('0x52')]=function(_0x4f5a18,_0x3641a4,_0x5369ad){return db['Action'][_0x8472('0x47')]({'where':{'id':_0x4f5a18[_0x8472('0x46')]['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x3641a4,null))[_0x8472('0x24')](function(_0x9e15bd){if(_0x9e15bd){return _0x9e15bd['addActions'](_0x4f5a18[_0x8472('0x49')][_0x8472('0x4d')],_[_0x8472('0x4e')](_0x4f5a18[_0x8472('0x49')],[_0x8472('0x4d'),'id'])||{});}})[_0x8472('0x24')](respondWithResult(_0x3641a4,null))[_0x8472('0x44')](handleError(_0x3641a4,null));};exports[_0x8472('0x53')]=function(_0x5a35f4,_0x72bd1b,_0x27fb37){var _0x551057={};var _0x31cc32={};var _0x3c6183;var _0x2e72cb;return db[_0x8472('0x3f')][_0x8472('0x4f')]({'where':{'id':_0x5a35f4[_0x8472('0x46')]['id']}})[_0x8472('0x24')](handleEntityNotFound(_0x72bd1b,null))[_0x8472('0x24')](function(_0x5dddb4){if(_0x5dddb4){_0x3c6183=_0x5dddb4;_0x31cc32[_0x8472('0x2d')]=_[_0x8472('0x30')](db['Action']['rawAttributes']);_0x31cc32['query']=_[_0x8472('0x30')](_0x5a35f4['query']);_0x31cc32['filters']=_[_0x8472('0x32')](_0x31cc32[_0x8472('0x2d')],_0x31cc32[_0x8472('0x2f')]);_0x551057[_0x8472('0x35')]=_[_0x8472('0x32')](_0x31cc32[_0x8472('0x2d')],qs[_0x8472('0x33')](_0x5a35f4[_0x8472('0x2f')]['fields']));_0x551057[_0x8472('0x35')]=_0x551057[_0x8472('0x35')][_0x8472('0x34')]?_0x551057[_0x8472('0x35')]:_0x31cc32[_0x8472('0x2d')];_0x551057[_0x8472('0x50')]=qs[_0x8472('0x38')](_0x5a35f4[_0x8472('0x2f')][_0x8472('0x38')]);_0x551057[_0x8472('0x3c')]=qs[_0x8472('0x31')](_[_0x8472('0x39')](_0x5a35f4[_0x8472('0x2f')],_0x31cc32['filters']));if(_0x5a35f4['query']['filter']){_0x551057[_0x8472('0x3c')]=_[_0x8472('0x3b')](_0x551057[_0x8472('0x3c')],{'$or':_[_0x8472('0x2e')](_0x551057[_0x8472('0x35')],function(_0xb4cf21){var _0x44473a={};_0x44473a[_0xb4cf21]={'$like':'%'+_0x5a35f4[_0x8472('0x2f')][_0x8472('0x3a')]+'%'};return _0x44473a;})});}_0x551057=_['merge']({},_0x551057,_0x5a35f4['options']);return _0x3c6183[_0x8472('0x53')](_0x551057);}})[_0x8472('0x24')](function(_0x513b90){if(_0x513b90){_0x2e72cb=_0x513b90[_0x8472('0x34')];if(!_0x5a35f4[_0x8472('0x2f')][_0x8472('0x36')](_0x8472('0x37'))){_0x551057[_0x8472('0x1c')]=qs[_0x8472('0x1c')](_0x5a35f4[_0x8472('0x2f')][_0x8472('0x1c')]);_0x551057['offset']=qs['offset'](_0x5a35f4[_0x8472('0x2f')][_0x8472('0x1b')]);}return _0x3c6183[_0x8472('0x53')](_0x551057);}})['then'](function(_0x474fb3){if(_0x474fb3){return _0x474fb3?{'count':_0x2e72cb,'rows':_0x474fb3}:null;}})[_0x8472('0x24')](respondWithResult(_0x72bd1b,null))[_0x8472('0x44')](handleError(_0x72bd1b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 422f01c..e19aa34 100644 --- a/server/api/automation/automation.model.js +++ b/server/api/automation/automation.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f3d=['request-promise','path','rimraf','./automation.attributes','exports','Automation','tools_automations','lodash','util','../../config/logger','api','bluebird'];(function(_0x648818,_0x2169db){var _0x353087=function(_0x142b08){while(--_0x142b08){_0x648818['push'](_0x648818['shift']());}};_0x353087(++_0x2169db);}(_0x8f3d,0x157));var _0xd8f3=function(_0x396b6d,_0x382476){_0x396b6d=_0x396b6d-0x0;var _0x5ee4a3=_0x8f3d[_0x396b6d];return _0x5ee4a3;};'use strict';var _=require(_0xd8f3('0x0'));var util=require(_0xd8f3('0x1'));var logger=require(_0xd8f3('0x2'))(_0xd8f3('0x3'));var moment=require('moment');var BPromise=require(_0xd8f3('0x4'));var rp=require(_0xd8f3('0x5'));var fs=require('fs');var path=require(_0xd8f3('0x6'));var rimraf=require(_0xd8f3('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8f3('0x8'));module[_0xd8f3('0x9')]=function(_0x4914ee,_0x1bd360){return _0x4914ee['define'](_0xd8f3('0xa'),attributes,{'tableName':_0xd8f3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ec=['Automation','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define'];(function(_0x46d9b2,_0x2dd11){var _0x34d05b=function(_0x2cf7e6){while(--_0x2cf7e6){_0x46d9b2['push'](_0x46d9b2['shift']());}};_0x34d05b(++_0x2dd11);}(_0xa4ec,0xb8));var _0xca4e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa4ec[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xca4e('0x0'));var util=require('util');var logger=require(_0xca4e('0x1'))(_0xca4e('0x2'));var moment=require(_0xca4e('0x3'));var BPromise=require(_0xca4e('0x4'));var rp=require(_0xca4e('0x5'));var fs=require('fs');var path=require(_0xca4e('0x6'));var rimraf=require(_0xca4e('0x7'));var config=require(_0xca4e('0x8'));var attributes=require(_0xca4e('0x9'));module['exports']=function(_0x160984,_0x6e37dc){return _0x160984[_0xca4e('0xa')](_0xca4e('0xb'),attributes,{'tableName':_0xca4e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5ebf642..0c18c73 100644 --- a/server/api/automation/automation.rpc.js +++ b/server/api/automation/automation.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da6=['error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x3da6,0xc1));var _0x63da=function(_0x617084,_0x27a65f){_0x617084=_0x617084-0x0;var _0x384ac0=_0x3da6[_0x617084];return _0x384ac0;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require(_0x63da('0x2'));var BPromise=require(_0x63da('0x3'));var rs=require(_0x63da('0x4'));var fs=require('fs');var Redis=require(_0x63da('0x5'));var db=require(_0x63da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x63da('0x7'))(_0x63da('0x8'));var config=require('../../config/environment');var jayson=require(_0x63da('0x9'));var client=jayson['client'][_0x63da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x519714,_0x1e6160,_0x7a48ee){return new BPromise(function(_0xbf0f63,_0x39a442){return client['request'](_0x519714,_0x7a48ee)[_0x63da('0xb')](function(_0xdc10c4){logger['info'](_0x63da('0xc'),_0x1e6160,'request\x20sent');logger[_0x63da('0xd')](_0x63da('0xe'),_0x1e6160,_0x63da('0xf'),JSON[_0x63da('0x10')](_0xdc10c4));if(_0xdc10c4[_0x63da('0x11')]){if(_0xdc10c4['error'][_0x63da('0x12')]===0x1f4){logger['error'](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0x39a442(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0xbf0f63(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}else{logger[_0x63da('0x14')](_0x63da('0xc'),_0x1e6160,'request\x20sent');_0xbf0f63(_0xdc10c4['result'][_0x63da('0x13')]);}})['catch'](function(_0x1f2f88){logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0x1f2f88);_0x39a442(_0x1f2f88);});});} \ No newline at end of file +var _0x4e7b=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','Automation,\x20%s,\x20%s'];(function(_0x52ce66,_0x4c37c5){var _0x30d31f=function(_0x127d71){while(--_0x127d71){_0x52ce66['push'](_0x52ce66['shift']());}};_0x30d31f(++_0x4c37c5);}(_0x4e7b,0xf3));var _0xb4e7=function(_0x36405d,_0x45d89c){_0x36405d=_0x36405d-0x0;var _0x3b0677=_0x4e7b[_0x36405d];return _0x3b0677;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var moment=require('moment');var BPromise=require(_0xb4e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4e7('0x3'));var db=require(_0xb4e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4e7('0x5'))(_0xb4e7('0x6'));var config=require('../../config/environment');var jayson=require(_0xb4e7('0x7'));var client=jayson[_0xb4e7('0x8')][_0xb4e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcf05,_0x315c27,_0x490b1b){return new BPromise(function(_0x366595,_0x3e621e){return client['request'](_0x1dcf05,_0x490b1b)[_0xb4e7('0xa')](function(_0x472973){logger[_0xb4e7('0xb')]('Automation,\x20%s,\x20%s',_0x315c27,_0xb4e7('0xc'));logger[_0xb4e7('0xd')]('Automation,\x20%s,\x20%s,\x20%s',_0x315c27,'request\x20sent',JSON['stringify'](_0x472973));if(_0x472973['error']){if(_0x472973[_0xb4e7('0xe')][_0xb4e7('0xf')]===0x1f4){logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x3e621e(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x366595(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}else{logger['info'](_0xb4e7('0x10'),_0x315c27,_0xb4e7('0xc'));_0x366595(_0x472973[_0xb4e7('0x12')][_0xb4e7('0x11')]);}})[_0xb4e7('0x13')](function(_0x3078a0){logger['error']('Automation,\x20%s,\x20%s',_0x315c27,_0x3078a0);_0x3e621e(_0x3078a0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 306debf..4d15523 100644 --- a/server/api/automation/index.js +++ b/server/api/automation/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafe6=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete'];(function(_0x45fa83,_0x1bf036){var _0x3ddf5d=function(_0x24b9a8){while(--_0x24b9a8){_0x45fa83['push'](_0x45fa83['shift']());}};_0x3ddf5d(++_0x1bf036);}(_0xafe6,0x66));var _0x6afe=function(_0x25ec2d,_0x3220f2){_0x25ec2d=_0x25ec2d-0x0;var _0x4b625b=_0xafe6[_0x25ec2d];return _0x4b625b;};'use strict';var multer=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var path=require(_0x6afe('0x2'));var timeout=require(_0x6afe('0x3'));var express=require(_0x6afe('0x4'));var router=express['Router']();var fs_extra=require(_0x6afe('0x5'));var auth=require(_0x6afe('0x6'));var interaction=require(_0x6afe('0x7'));var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x6afe('0x8')]('/',auth['isAuthenticated'](),controller[_0x6afe('0x9')]);router[_0x6afe('0x8')](_0x6afe('0xa'),auth[_0x6afe('0xb')](),controller[_0x6afe('0xc')]);router['get'](_0x6afe('0xd'),auth['isAuthenticated'](),controller[_0x6afe('0xe')]);router['get'](_0x6afe('0xf'),auth[_0x6afe('0xb')](),controller[_0x6afe('0x10')]);router[_0x6afe('0x11')]('/',auth[_0x6afe('0xb')](),controller[_0x6afe('0x12')]);router[_0x6afe('0x11')](_0x6afe('0xd'),auth[_0x6afe('0xb')](),controller['addConditions']);router[_0x6afe('0x11')]('/:id/actions',auth[_0x6afe('0xb')](),controller[_0x6afe('0x13')]);router[_0x6afe('0x14')](_0x6afe('0xa'),auth[_0x6afe('0xb')](),controller[_0x6afe('0x15')]);router[_0x6afe('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x6afe('0x17')]);module[_0x6afe('0x18')]=router; \ No newline at end of file +var _0x2137=['create','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/conditions','getActions','post'];(function(_0x5bf98a,_0xadd82c){var _0x20f6d0=function(_0x21cf6a){while(--_0x21cf6a){_0x5bf98a['push'](_0x5bf98a['shift']());}};_0x20f6d0(++_0xadd82c);}(_0x2137,0x134));var _0x7213=function(_0x1e4504,_0x467774){_0x1e4504=_0x1e4504-0x0;var _0x31c5b5=_0x2137[_0x1e4504];return _0x31c5b5;};'use strict';var multer=require(_0x7213('0x0'));var util=require(_0x7213('0x1'));var path=require(_0x7213('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7213('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7213('0x4'));var interaction=require(_0x7213('0x5'));var config=require(_0x7213('0x6'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7213('0x7')]);router[_0x7213('0x8')]('/:id',auth[_0x7213('0x9')](),controller[_0x7213('0xa')]);router['get'](_0x7213('0xb'),auth['isAuthenticated'](),controller['getConditions']);router[_0x7213('0x8')]('/:id/actions',auth[_0x7213('0x9')](),controller[_0x7213('0xc')]);router[_0x7213('0xd')]('/',auth[_0x7213('0x9')](),controller[_0x7213('0xe')]);router[_0x7213('0xd')](_0x7213('0xb'),auth[_0x7213('0x9')](),controller[_0x7213('0xf')]);router[_0x7213('0xd')]('/:id/actions',auth[_0x7213('0x9')](),controller[_0x7213('0x10')]);router[_0x7213('0x11')](_0x7213('0x12'),auth[_0x7213('0x9')](),controller[_0x7213('0x13')]);router[_0x7213('0x14')](_0x7213('0x12'),auth[_0x7213('0x9')](),controller[_0x7213('0x15')]);module[_0x7213('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 957d9c2..bfa9ce5 100644 --- a/server/api/campaign/campaign.attributes.js +++ b/server/api/campaign/campaign.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65ac=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC'];(function(_0x4f1026,_0x5aad6e){var _0x18fd21=function(_0x491f97){while(--_0x491f97){_0x4f1026['push'](_0x4f1026['shift']());}};_0x18fd21(++_0x5aad6e);}(_0x65ac,0xf8));var _0xc65a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x65ac[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xc65a('0x0'));module[_0xc65a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc65a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x4')),'allowNull':![],'defaultValue':_0xc65a('0x4')},'description':{'type':Sequelize[_0xc65a('0x5')]},'active':{'type':Sequelize[_0xc65a('0x6')],'defaultValue':0x0,'comment':_0xc65a('0x7')},'limitCalls':{'type':Sequelize[_0xc65a('0x8')](0x4)[_0xc65a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc65a('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc65a('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc65a('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'comment':_0xc65a('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc65a('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc65a('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x13'),_0xc65a('0x14'),_0xc65a('0x15')),'defaultValue':_0xc65a('0x13')},'dialAMDActive':{'type':Sequelize[_0xc65a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc65a('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xc65a('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc65a('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xc65a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc65a('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc65a('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc65a('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc65a('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc65a('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc65a('0x8')](0x9)[_0xc65a('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc65a('0x1d')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc65a('0x3')](_0xc65a('0x1e'),_0xc65a('0x1f')),'defaultValue':_0xc65a('0x1e')},'dialPrefix':{'type':Sequelize[_0xc65a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc65a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc65a('0x20')},'dialCutDigit':{'type':Sequelize[_0xc65a('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xc65a('0x8')](0x3)[_0xc65a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc65a('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc65a('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc65a('0x8')](0x5)[_0xc65a('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xca31=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xca31,0x18a));var _0x1ca3=function(_0x3925ff,_0x3fe6e5){_0x3925ff=_0x3925ff-0x0;var _0x1f16d5=_0xca31[_0x3925ff];return _0x1f16d5;};'use strict';var Sequelize=require(_0x1ca3('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ca3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ca3('0x2')](_0x1ca3('0x3')),'allowNull':![],'defaultValue':_0x1ca3('0x3')},'description':{'type':Sequelize[_0x1ca3('0x1')]},'active':{'type':Sequelize[_0x1ca3('0x4')],'defaultValue':0x0,'comment':_0x1ca3('0x5')},'limitCalls':{'type':Sequelize[_0x1ca3('0x6')](0x4)[_0x1ca3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1ca3('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1ca3('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1ca3('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1ca3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1ca3('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1ca3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1ca3('0x6')](0x3)[_0x1ca3('0x7')],'defaultValue':0x3,'comment':_0x1ca3('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1ca3('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1ca3('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1ca3('0x2')](_0x1ca3('0xf'),_0x1ca3('0x10'),_0x1ca3('0x11')),'defaultValue':_0x1ca3('0xf')},'dialAMDActive':{'type':Sequelize[_0x1ca3('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1ca3('0x6')](0x9)[_0x1ca3('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1ca3('0x12')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1ca3('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1ca3('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1ca3('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1ca3('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1ca3('0x6')](0x9)[_0x1ca3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ca3('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1ca3('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1ca3('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1ca3('0x6')](0x9)[_0x1ca3('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1ca3('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1ca3('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1ca3('0x6')](0x9)[_0x1ca3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ca3('0x18')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1ca3('0x19'),_0x1ca3('0x1a')),'defaultValue':_0x1ca3('0x19')},'dialPrefix':{'type':Sequelize[_0x1ca3('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1ca3('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ca3('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1ca3('0x6')](0x3)[_0x1ca3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ca3('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x1ca3('0x6')](0x3)[_0x1ca3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1ca3('0x6')](0x3)[_0x1ca3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)[_0x1ca3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1ca3('0x6')](0x3)[_0x1ca3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ca3('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1ca3('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ca3('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 616e769..df72f04 100644 --- a/server/api/campaign/campaign.controller.js +++ b/server/api/campaign/campaign.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa1b=['ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','userProfileId','getHoppers','findOne','hasOwnProperty','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','createdAt','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','to-csv'];(function(_0x3cd5b5,_0x2191f1){var _0x2010fb=function(_0x202fae){while(--_0x202fae){_0x3cd5b5['push'](_0x3cd5b5['shift']());}};_0x2010fb(++_0x2191f1);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xbaa1('0x0'));var rimraf=require(_0xbaa1('0x1'));var zipdir=require(_0xbaa1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbaa1('0x3'));var moment=require('moment');var BPromise=require(_0xbaa1('0x4'));var Mustache=require(_0xbaa1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xbaa1('0x6'));var ejs=require(_0xbaa1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaa1('0x8'));var squel=require('squel');var crypto=require(_0xbaa1('0x9'));var jsforce=require(_0xbaa1('0xa'));var deskjs=require(_0xbaa1('0xb'));var toCsv=require(_0xbaa1('0x6'));var querystring=require(_0xbaa1('0xc'));var Papa=require(_0xbaa1('0xd'));var Redis=require('ioredis');var authService=require(_0xbaa1('0xe'));var qs=require(_0xbaa1('0xf'));var as=require(_0xbaa1('0x10'));var hardwareService=require(_0xbaa1('0x11'));var logger=require(_0xbaa1('0x12'))(_0xbaa1('0x13'));var utils=require(_0xbaa1('0x14'));var config=require(_0xbaa1('0x15'));var licenseUtil=require(_0xbaa1('0x16'));var db=require(_0xbaa1('0x17'))['db'];function respondWithStatusCode(_0x8ce72d,_0x1376c6){_0x1376c6=_0x1376c6||0xcc;return function(_0x5064a4){if(_0x5064a4){return _0x8ce72d['sendStatus'](_0x1376c6);}return _0x8ce72d['status'](_0x1376c6)['end']();};}function respondWithResult(_0x2184ab,_0x388cfd){_0x388cfd=_0x388cfd||0xc8;return function(_0x3bfbcc){if(_0x3bfbcc){return _0x2184ab[_0xbaa1('0x18')](_0x388cfd)[_0xbaa1('0x19')](_0x3bfbcc);}};}function respondWithFilteredResult(_0x2e7db5,_0x30f191){return function(_0xdbaa8b){if(_0xdbaa8b){var _0x35a3fd=typeof _0x30f191[_0xbaa1('0x1a')]===_0xbaa1('0x1b')&&typeof _0x30f191[_0xbaa1('0x1c')]===_0xbaa1('0x1b');var _0x16725c=_0xdbaa8b[_0xbaa1('0x1d')];var _0x155a16=_0x35a3fd?0x0:_0x30f191[_0xbaa1('0x1a')];var _0x200f01=_0x35a3fd?_0xdbaa8b[_0xbaa1('0x1d')]:_0x30f191['offset']+_0x30f191[_0xbaa1('0x1c')];var _0x3e3f4a;if(_0x200f01>=_0x16725c){_0x200f01=_0x16725c;_0x3e3f4a=0xc8;}else{_0x3e3f4a=0xce;}_0x2e7db5[_0xbaa1('0x18')](_0x3e3f4a);return _0x2e7db5[_0xbaa1('0x1e')](_0xbaa1('0x1f'),_0x155a16+'-'+_0x200f01+'/'+_0x16725c)[_0xbaa1('0x19')](_0xdbaa8b);}return null;};}function patchUpdates(_0x5c2115){return function(_0x1c587c){try{jsonpatch[_0xbaa1('0x20')](_0x1c587c,_0x5c2115,!![]);}catch(_0x1c38f3){return BPromise[_0xbaa1('0x21')](_0x1c38f3);}return _0x1c587c[_0xbaa1('0x22')]();};}function saveUpdates(_0x5a7d21,_0x4e4a0c){return function(_0x2b01ec){if(_0x2b01ec){return _0x2b01ec[_0xbaa1('0x23')](_0x5a7d21)[_0xbaa1('0x24')](function(_0x34946c){return _0x34946c;});}return null;};}function removeEntity(_0x117079,_0x113bbd){return function(_0x4806e7){if(_0x4806e7){return _0x4806e7[_0xbaa1('0x25')]()[_0xbaa1('0x24')](function(){var _0x28e508=_0x4806e7[_0xbaa1('0x26')]({'plain':!![]});var _0x1204f4=_0xbaa1('0x27');return db[_0xbaa1('0x28')][_0xbaa1('0x25')]({'where':{'type':_0x1204f4,'resourceId':_0x28e508['id']}})[_0xbaa1('0x24')](function(){return _0x4806e7;});})['then'](function(){_0x117079[_0xbaa1('0x18')](0xcc)[_0xbaa1('0x29')]();});}};}function handleEntityNotFound(_0xd2cae3,_0x2913ae){return function(_0x109187){if(!_0x109187){_0xd2cae3[_0xbaa1('0x2a')](0x194);}return _0x109187;};}function handleError(_0x594578,_0x49803c){_0x49803c=_0x49803c||0x1f4;return function(_0x18b6d6){logger[_0xbaa1('0x2b')](_0x18b6d6[_0xbaa1('0x2c')]);if(_0x18b6d6['name']){delete _0x18b6d6[_0xbaa1('0x2d')];}_0x594578[_0xbaa1('0x18')](_0x49803c)['send'](_0x18b6d6);};}exports[_0xbaa1('0x2e')]=function(_0x57a4b4,_0x158437){var _0x3670bd={},_0x344ace={},_0x53fead={'count':0x0,'rows':[]};var _0x594250=_[_0xbaa1('0x2f')](db[_0xbaa1('0x30')][_0xbaa1('0x31')],function(_0x1a98f9){return{'name':_0x1a98f9[_0xbaa1('0x32')],'type':_0x1a98f9[_0xbaa1('0x33')]['key']};});_0x344ace[_0xbaa1('0x34')]=_[_0xbaa1('0x2f')](_0x594250,_0xbaa1('0x2d'));_0x344ace[_0xbaa1('0x35')]=_['keys'](_0x57a4b4[_0xbaa1('0x35')]);_0x344ace['filters']=_[_0xbaa1('0x36')](_0x344ace[_0xbaa1('0x34')],_0x344ace[_0xbaa1('0x35')]);_0x3670bd[_0xbaa1('0x37')]=_['intersection'](_0x344ace[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x57a4b4[_0xbaa1('0x35')]['fields']));_0x3670bd[_0xbaa1('0x37')]=_0x3670bd[_0xbaa1('0x37')]['length']?_0x3670bd[_0xbaa1('0x37')]:_0x344ace[_0xbaa1('0x34')];if(!_0x57a4b4[_0xbaa1('0x35')]['hasOwnProperty'](_0xbaa1('0x39'))){_0x3670bd['limit']=qs['limit'](_0x57a4b4[_0xbaa1('0x35')]['limit']);_0x3670bd[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x57a4b4[_0xbaa1('0x35')]['offset']);}_0x3670bd[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x57a4b4['query'][_0xbaa1('0x3b')]);_0x3670bd[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0x57a4b4[_0xbaa1('0x35')],_0x344ace[_0xbaa1('0x3d')]),_0x594250);if(_0x57a4b4[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x3670bd['where']=_[_0xbaa1('0x40')](_0x3670bd['where'],{'$or':_[_0xbaa1('0x2f')](_0x594250,function(_0x3ba6bf){if(_0x3ba6bf[_0xbaa1('0x33')]!=='VIRTUAL'){var _0x1b2333={};_0x1b2333[_0x3ba6bf['name']]={'$like':'%'+_0x57a4b4['query'][_0xbaa1('0x3f')]+'%'};return _0x1b2333;}})});}_0x3670bd=_[_0xbaa1('0x40')]({},_0x3670bd,_0x57a4b4[_0xbaa1('0x41')]);var _0x5efda0={'where':_0x3670bd['where']};return db[_0xbaa1('0x30')][_0xbaa1('0x1d')](_0x5efda0)[_0xbaa1('0x24')](function(_0x2443e3){_0x53fead[_0xbaa1('0x1d')]=_0x2443e3;if(_0x57a4b4[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x3670bd[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x30')][_0xbaa1('0x44')](_0x3670bd);})[_0xbaa1('0x24')](function(_0xc59188){_0x53fead[_0xbaa1('0x45')]=_0xc59188;return _0x53fead;})[_0xbaa1('0x24')](respondWithFilteredResult(_0x158437,_0x3670bd))['catch'](handleError(_0x158437,null));};exports['show']=function(_0x18c4e1,_0x6cc5ad){var _0x153cab={'raw':![],'where':{'id':_0x18c4e1[_0xbaa1('0x46')]['id']}},_0xfe2c06={};_0xfe2c06[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x30')]['rawAttributes']);_0xfe2c06[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x18c4e1[_0xbaa1('0x35')]);_0xfe2c06[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0xfe2c06[_0xbaa1('0x34')],_0xfe2c06['query']);_0x153cab['attributes']=_[_0xbaa1('0x36')](_0xfe2c06['model'],qs[_0xbaa1('0x38')](_0x18c4e1[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x153cab['attributes']=_0x153cab[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x153cab[_0xbaa1('0x37')]:_0xfe2c06[_0xbaa1('0x34')];if(_0x18c4e1[_0xbaa1('0x35')]['includeAll']){_0x153cab['include']=[{'all':!![]}];}_0x153cab=_[_0xbaa1('0x40')]({},_0x153cab,_0x18c4e1[_0xbaa1('0x41')]);return db[_0xbaa1('0x30')][_0xbaa1('0x49')](_0x153cab)[_0xbaa1('0x24')](handleEntityNotFound(_0x6cc5ad,null))[_0xbaa1('0x24')](respondWithResult(_0x6cc5ad,null))[_0xbaa1('0x4a')](handleError(_0x6cc5ad,null));};exports[_0xbaa1('0x4b')]=function(_0xa4dd12,_0x19c7f5){return db[_0xbaa1('0x30')]['create'](_0xa4dd12[_0xbaa1('0x4c')],{})[_0xbaa1('0x24')](function(_0x2e2f16){var _0x216336=_0xa4dd12[_0xbaa1('0x4d')][_0xbaa1('0x26')]({'plain':!![]});if(!_0x216336)throw new Error(_0xbaa1('0x4e'));if(_0x216336['role']===_0xbaa1('0x4d')){var _0x378bfa=_0x2e2f16['get']({'plain':!![]});var _0x18e207=_0xbaa1('0x27');return db[_0xbaa1('0x4f')][_0xbaa1('0x49')]({'where':{'name':_0x18e207,'userProfileId':_0x216336['userProfileId']},'raw':!![]})[_0xbaa1('0x24')](function(_0x4d70f1){if(_0x4d70f1&&_0x4d70f1[_0xbaa1('0x50')]===0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x4b')]({'name':_0x378bfa[_0xbaa1('0x2d')],'resourceId':_0x378bfa['id'],'type':_0x4d70f1['name'],'sectionId':_0x4d70f1['id']},{})[_0xbaa1('0x24')](function(){return _0x2e2f16;});}else{return _0x2e2f16;}})[_0xbaa1('0x4a')](function(_0x176ce2){logger[_0xbaa1('0x2b')](_0xbaa1('0x51'),_0x176ce2);throw _0x176ce2;});}return _0x2e2f16;})[_0xbaa1('0x24')](respondWithResult(_0x19c7f5,0xc9))[_0xbaa1('0x4a')](handleError(_0x19c7f5,null));};exports[_0xbaa1('0x52')]=function(_0x5018e2,_0x39fb53){var _0x39e35c={'where':{'id':_0x5018e2[_0xbaa1('0x46')]['id']}},_0x348eb6={};_0x348eb6[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x30')]['rawAttributes']);_0x39e35c['attributes']=_[_0xbaa1('0x36')](_0x348eb6[_0xbaa1('0x34')],qs['fields'](_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x39e35c[_0xbaa1('0x37')]=_0x39e35c['attributes'][_0xbaa1('0x48')]?_0x39e35c[_0xbaa1('0x37')]:_0x348eb6[_0xbaa1('0x34')];if(_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x39e35c[_0xbaa1('0x43')]=[{'all':!![]}];}_0x39e35c=_['merge']({},_0x39e35c,_0x5018e2[_0xbaa1('0x41')]);return db[_0xbaa1('0x30')]['find'](_0x39e35c)['then'](handleEntityNotFound(_0x39fb53,null))[_0xbaa1('0x24')](function(_0x4973d4){if(_0x4973d4){var _0x2bb374=_0x4973d4[_0xbaa1('0x26')]({'plain':!![]});_0x2bb374=qs[_0xbaa1('0x53')](_0x2bb374,['id','createdAt',_0xbaa1('0x54')]);_0x5018e2[_0xbaa1('0x4c')]=_[_0xbaa1('0x53')](_0x5018e2[_0xbaa1('0x4c')],['id','createdAt',_0xbaa1('0x54')]);return db[_0xbaa1('0x30')][_0xbaa1('0x4b')](_[_0xbaa1('0x40')](_0x2bb374,_0x5018e2[_0xbaa1('0x4c')]),{'include':_0x5018e2[_0xbaa1('0x35')][_0xbaa1('0x42')]?[{'all':!![]}]:undefined})[_0xbaa1('0x24')](function(_0x2200e0){var _0xf33b78=_0x5018e2[_0xbaa1('0x4d')][_0xbaa1('0x26')]({'plain':!![]});if(!_0xf33b78)throw new Error(_0xbaa1('0x4e'));if(_0xf33b78['role']===_0xbaa1('0x4d')){var _0x1aa65a=_0x2200e0[_0xbaa1('0x26')]({'plain':!![]});var _0x5a1cb4=_0xbaa1('0x27');return db[_0xbaa1('0x4f')][_0xbaa1('0x49')]({'where':{'name':_0x5a1cb4,'userProfileId':_0xf33b78[_0xbaa1('0x55')]},'raw':!![]})[_0xbaa1('0x24')](function(_0x3fb861){if(_0x3fb861&&_0x3fb861[_0xbaa1('0x50')]===0x0){return db[_0xbaa1('0x28')][_0xbaa1('0x4b')]({'name':_0x1aa65a[_0xbaa1('0x2d')],'resourceId':_0x1aa65a['id'],'type':_0x3fb861[_0xbaa1('0x2d')],'sectionId':_0x3fb861['id']},{})[_0xbaa1('0x24')](function(){return _0x2200e0;});}else{return _0x2200e0;}})[_0xbaa1('0x4a')](function(_0x5c369a){logger['error'](_0xbaa1('0x51'),_0x5c369a);throw _0x5c369a;});}return _0x2200e0;});}})[_0xbaa1('0x24')](respondWithResult(_0x39fb53,0xc9))[_0xbaa1('0x4a')](handleError(_0x39fb53,null));};exports[_0xbaa1('0x23')]=function(_0x296d32,_0x15fd0c){if(_0x296d32['body']['id']){delete _0x296d32[_0xbaa1('0x4c')]['id'];}return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x296d32['params']['id']}})['then'](handleEntityNotFound(_0x15fd0c,null))[_0xbaa1('0x24')](saveUpdates(_0x296d32['body'],null))[_0xbaa1('0x24')](respondWithResult(_0x15fd0c,null))['catch'](handleError(_0x15fd0c,null));};exports[_0xbaa1('0x25')]=function(_0x15c1df,_0x2ac192){return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x15c1df[_0xbaa1('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ac192,null))[_0xbaa1('0x24')](removeEntity(_0x2ac192,null))[_0xbaa1('0x4a')](handleError(_0x2ac192,null));};exports[_0xbaa1('0x56')]=function(_0x3ec6a5,_0xd6b380,_0x134906){var _0x4a7f3a={'raw':!![],'where':{}};var _0x43eb9c={};var _0x5c1e78={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x3ec6a5['params']['id']}})['then'](handleEntityNotFound(_0xd6b380,null))[_0xbaa1('0x24')](function(_0x21ac88){if(_0x21ac88){_0x43eb9c['model']=_[_0xbaa1('0x47')](db['CmHopper']['rawAttributes']);_0x43eb9c[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x3ec6a5[_0xbaa1('0x35')]);_0x43eb9c[_0xbaa1('0x3d')]=_['intersection'](_0x43eb9c['model'],_0x43eb9c[_0xbaa1('0x35')]);_0x4a7f3a['attributes']=_[_0xbaa1('0x36')](_0x43eb9c[_0xbaa1('0x34')],qs['fields'](_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x38')]));_0x4a7f3a[_0xbaa1('0x37')]=_0x4a7f3a[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x4a7f3a['attributes']:_0x43eb9c[_0xbaa1('0x34')];if(!_0x3ec6a5['query'][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x4a7f3a[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0x3ec6a5['query'][_0xbaa1('0x1c')]);_0x4a7f3a[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x3ec6a5['query'][_0xbaa1('0x1a')]);}_0x4a7f3a[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x4a7f3a['where']=qs['filters'](_[_0xbaa1('0x3e')](_0x3ec6a5[_0xbaa1('0x35')],_0x43eb9c['filters']));_0x4a7f3a[_0xbaa1('0x3c')][_0xbaa1('0x59')]=_0x21ac88['id'];if(_0x3ec6a5['query']['filter']){_0x4a7f3a[_0xbaa1('0x3c')]=_[_0xbaa1('0x40')](_0x4a7f3a['where'],{'$or':_[_0xbaa1('0x2f')](_0x4a7f3a[_0xbaa1('0x37')],function(_0x49cceb){var _0x485a07={};_0x485a07[_0x49cceb]={'$like':'%'+_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x485a07;})});}_0x4a7f3a=_[_0xbaa1('0x40')]({},_0x4a7f3a,_0x3ec6a5[_0xbaa1('0x41')]);return db[_0xbaa1('0x5a')][_0xbaa1('0x1d')]({'where':_0x4a7f3a['where']})['then'](function(_0x5f3161){_0x5c1e78[_0xbaa1('0x1d')]=_0x5f3161;if(_0x3ec6a5[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x4a7f3a[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5a')]['findAll'](_0x4a7f3a);})[_0xbaa1('0x24')](function(_0x292087){_0x5c1e78[_0xbaa1('0x45')]=_0x292087;return _0x5c1e78;});}})[_0xbaa1('0x24')](respondWithFilteredResult(_0xd6b380,_0x4a7f3a))[_0xbaa1('0x4a')](handleError(_0xd6b380,null));};exports[_0xbaa1('0x5b')]=function(_0x18ffe9,_0x11606e,_0x55e7a4){var _0x2305ee={'raw':!![],'where':{}};var _0x20cca4={};var _0x4ec9bd={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x18ffe9[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x11606e,null))[_0xbaa1('0x24')](function(_0x17f088){if(_0x17f088){_0x20cca4[_0xbaa1('0x34')]=_['keys'](db[_0xbaa1('0x5c')][_0xbaa1('0x31')]);_0x20cca4[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x18ffe9[_0xbaa1('0x35')]);_0x20cca4['filters']=_[_0xbaa1('0x36')](_0x20cca4[_0xbaa1('0x34')],_0x20cca4[_0xbaa1('0x35')]);_0x2305ee['attributes']=_['intersection'](_0x20cca4['model'],qs['fields'](_0x18ffe9[_0xbaa1('0x35')]['fields']));_0x2305ee[_0xbaa1('0x37')]=_0x2305ee[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x2305ee[_0xbaa1('0x37')]:_0x20cca4[_0xbaa1('0x34')];if(!_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x2305ee[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0x18ffe9[_0xbaa1('0x35')]['limit']);_0x2305ee[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x18ffe9[_0xbaa1('0x35')]['offset']);}_0x2305ee[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x18ffe9['query'][_0xbaa1('0x3b')]);_0x2305ee[_0xbaa1('0x3c')]=qs['filters'](_[_0xbaa1('0x3e')](_0x18ffe9[_0xbaa1('0x35')],_0x20cca4[_0xbaa1('0x3d')]));_0x2305ee[_0xbaa1('0x3c')]['CampaignId']=_0x17f088['id'];if(_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x2305ee['where']=_['merge'](_0x2305ee[_0xbaa1('0x3c')],{'$or':_[_0xbaa1('0x2f')](_0x2305ee['attributes'],function(_0x49b4a2){var _0x4b07cc={};_0x4b07cc[_0x49b4a2]={'$like':'%'+_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x4b07cc;})});}_0x2305ee=_[_0xbaa1('0x40')]({},_0x2305ee,_0x18ffe9['options']);return db['CmHopperHistory']['count']({'where':_0x2305ee[_0xbaa1('0x3c')]})[_0xbaa1('0x24')](function(_0x4a6ee2){_0x4ec9bd['count']=_0x4a6ee2;if(_0x18ffe9[_0xbaa1('0x35')][_0xbaa1('0x42')]){_0x2305ee[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5c')][_0xbaa1('0x44')](_0x2305ee);})['then'](function(_0x2619cd){_0x4ec9bd[_0xbaa1('0x45')]=_0x2619cd;return _0x4ec9bd;});}})['then'](respondWithFilteredResult(_0x11606e,_0x2305ee))[_0xbaa1('0x4a')](handleError(_0x11606e,null));};exports[_0xbaa1('0x5d')]=function(_0xa014c9,_0xaf96f3,_0x41f58a){var _0x50b7a8={'raw':!![],'where':{}};var _0x156a8c={};var _0x3cc3a9={'count':0x0,'rows':[]};return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0xa014c9['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0xaf96f3,null))[_0xbaa1('0x24')](function(_0x357bdf){if(_0x357bdf){_0x156a8c[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x5e')][_0xbaa1('0x31')]);_0x156a8c[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0xa014c9[_0xbaa1('0x35')]);_0x156a8c[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x156a8c['model'],_0x156a8c[_0xbaa1('0x35')]);_0x50b7a8[_0xbaa1('0x37')]=_[_0xbaa1('0x36')](_0x156a8c[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0xa014c9['query'][_0xbaa1('0x38')]));_0x50b7a8[_0xbaa1('0x37')]=_0x50b7a8[_0xbaa1('0x37')]['length']?_0x50b7a8[_0xbaa1('0x37')]:_0x156a8c[_0xbaa1('0x34')];if(!_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x58')](_0xbaa1('0x39'))){_0x50b7a8['limit']=qs[_0xbaa1('0x1c')](_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x1c')]);_0x50b7a8['offset']=qs['offset'](_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x1a')]);}_0x50b7a8[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0xa014c9['query']['sort']);_0x50b7a8[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0xa014c9['query'],_0x156a8c[_0xbaa1('0x3d')]));_0x50b7a8['where'][_0xbaa1('0x59')]=_0x357bdf['id'];if(_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x50b7a8['where']=_[_0xbaa1('0x40')](_0x50b7a8[_0xbaa1('0x3c')],{'$or':_[_0xbaa1('0x2f')](_0x50b7a8['attributes'],function(_0x3abcd0){var _0x48aaae={};_0x48aaae[_0x3abcd0]={'$like':'%'+_0xa014c9[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x48aaae;})});}_0x50b7a8=_[_0xbaa1('0x40')]({},_0x50b7a8,_0xa014c9['options']);return db[_0xbaa1('0x5e')]['count']({'where':_0x50b7a8[_0xbaa1('0x3c')]})[_0xbaa1('0x24')](function(_0x57e18b){_0x3cc3a9[_0xbaa1('0x1d')]=_0x57e18b;if(_0xa014c9['query'][_0xbaa1('0x42')]){_0x50b7a8[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5e')][_0xbaa1('0x44')](_0x50b7a8);})[_0xbaa1('0x24')](function(_0x18e56f){_0x3cc3a9[_0xbaa1('0x45')]=_0x18e56f;return _0x3cc3a9;});}})['then'](respondWithFilteredResult(_0xaf96f3,_0x50b7a8))[_0xbaa1('0x4a')](handleError(_0xaf96f3,null));};exports['getHopperBlacks']=function(_0xe6445a,_0x5c65bb,_0x339ff5){var _0x203ab6={'raw':!![],'where':{}};var _0x3666c5={};var _0x24ccf5={'count':0x0,'rows':[]};return db['Campaign'][_0xbaa1('0x57')]({'where':{'id':_0xe6445a['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x5c65bb,null))[_0xbaa1('0x24')](function(_0x4860d8){if(_0x4860d8){_0x3666c5[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x5f')]['rawAttributes']);_0x3666c5[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0xe6445a[_0xbaa1('0x35')]);_0x3666c5[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x3666c5[_0xbaa1('0x34')],_0x3666c5[_0xbaa1('0x35')]);_0x203ab6[_0xbaa1('0x37')]=_['intersection'](_0x3666c5[_0xbaa1('0x34')],qs['fields'](_0xe6445a[_0xbaa1('0x35')]['fields']));_0x203ab6[_0xbaa1('0x37')]=_0x203ab6[_0xbaa1('0x37')]['length']?_0x203ab6['attributes']:_0x3666c5[_0xbaa1('0x34')];if(!_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x58')]('nolimit')){_0x203ab6[_0xbaa1('0x1c')]=qs[_0xbaa1('0x1c')](_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x1c')]);_0x203ab6['offset']=qs[_0xbaa1('0x1a')](_0xe6445a['query'][_0xbaa1('0x1a')]);}_0x203ab6[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x203ab6['where']=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0xe6445a[_0xbaa1('0x35')],_0x3666c5[_0xbaa1('0x3d')]));_0x203ab6[_0xbaa1('0x3c')][_0xbaa1('0x59')]=_0x4860d8['id'];if(_0xe6445a[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x203ab6[_0xbaa1('0x3c')]=_['merge'](_0x203ab6['where'],{'$or':_['map'](_0x203ab6['attributes'],function(_0x56936c){var _0x33f339={};_0x33f339[_0x56936c]={'$like':'%'+_0xe6445a['query'][_0xbaa1('0x3f')]+'%'};return _0x33f339;})});}_0x203ab6=_['merge']({},_0x203ab6,_0xe6445a['options']);return db[_0xbaa1('0x5f')][_0xbaa1('0x1d')]({'where':_0x203ab6['where']})[_0xbaa1('0x24')](function(_0x1ba530){_0x24ccf5['count']=_0x1ba530;if(_0xe6445a['query'][_0xbaa1('0x42')]){_0x203ab6[_0xbaa1('0x43')]=[{'all':!![]}];}return db[_0xbaa1('0x5f')][_0xbaa1('0x44')](_0x203ab6);})['then'](function(_0x206778){_0x24ccf5['rows']=_0x206778;return _0x24ccf5;});}})[_0xbaa1('0x24')](respondWithFilteredResult(_0x5c65bb,_0x203ab6))[_0xbaa1('0x4a')](handleError(_0x5c65bb,null));};exports[_0xbaa1('0x60')]=function(_0x428e16,_0x16f671,_0x5022ce){var _0x35b84a={};var _0x5a9926={};var _0x4bd005;var _0x4e6ae2;return db[_0xbaa1('0x30')][_0xbaa1('0x57')]({'where':{'id':_0x428e16[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x16f671,null))['then'](function(_0x36b752){if(_0x36b752){_0x4bd005=_0x36b752;_0x5a9926[_0xbaa1('0x34')]=_[_0xbaa1('0x47')](db[_0xbaa1('0x61')][_0xbaa1('0x31')]);_0x5a9926[_0xbaa1('0x35')]=_[_0xbaa1('0x47')](_0x428e16[_0xbaa1('0x35')]);_0x5a9926[_0xbaa1('0x3d')]=_['intersection'](_0x5a9926[_0xbaa1('0x34')],_0x5a9926['query']);_0x35b84a['attributes']=_['intersection'](_0x5a9926[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x428e16[_0xbaa1('0x35')]['fields']));_0x35b84a[_0xbaa1('0x37')]=_0x35b84a[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x35b84a[_0xbaa1('0x37')]:_0x5a9926['model'];_0x35b84a[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3b')]);_0x35b84a['where']=qs['filters'](_[_0xbaa1('0x3e')](_0x428e16['query'],_0x5a9926[_0xbaa1('0x3d')]));if(_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3f')]){_0x35b84a[_0xbaa1('0x3c')]=_[_0xbaa1('0x40')](_0x35b84a[_0xbaa1('0x3c')],{'$or':_['map'](_0x35b84a[_0xbaa1('0x37')],function(_0x66e731){var _0x59cfb5={};_0x59cfb5[_0x66e731]={'$like':'%'+_0x428e16[_0xbaa1('0x35')][_0xbaa1('0x3f')]+'%'};return _0x59cfb5;})});}_0x35b84a=_[_0xbaa1('0x40')]({},_0x35b84a,_0x428e16[_0xbaa1('0x41')]);return _0x4bd005[_0xbaa1('0x60')](_0x35b84a);}})[_0xbaa1('0x24')](function(_0x24bf78){if(_0x24bf78){_0x4e6ae2=_0x24bf78[_0xbaa1('0x48')];if(!_0x428e16[_0xbaa1('0x35')]['hasOwnProperty']('nolimit')){_0x35b84a['limit']=qs[_0xbaa1('0x1c')](_0x428e16[_0xbaa1('0x35')]['limit']);_0x35b84a[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x428e16[_0xbaa1('0x35')]['offset']);}return _0x4bd005['getLists'](_0x35b84a);}})[_0xbaa1('0x24')](function(_0x35841d){if(_0x35841d){return _0x35841d?{'count':_0x4e6ae2,'rows':_0x35841d}:null;}})[_0xbaa1('0x24')](respondWithResult(_0x16f671,null))['catch'](handleError(_0x16f671,null));};exports[_0xbaa1('0x62')]=function(_0x5de9e0,_0x14a1c5,_0x3a8c41){var _0x3d0925,_0xd5599d;var _0x4b97a6=[];var _0xed03fd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0xbaa1('0x49')]({'where':{'id':_0x5de9e0[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x14a1c5,null))[_0xbaa1('0x24')](function(_0x371c8d){if(_0x371c8d){_0xd5599d=_0x371c8d;return _0x371c8d[_0xbaa1('0x62')](_0x5de9e0[_0xbaa1('0x4c')]['ids'],_[_0xbaa1('0x53')](_0x5de9e0[_0xbaa1('0x4c')],['ids','id'])||{});}return null;})[_0xbaa1('0x63')](function(_0x130bc9){var _0x5ef444;var _0x3dc1a1;_0x3d0925=_0x130bc9||[];var _0x1d09fc=[];if(_0x130bc9){for(var _0x11d510=0x0;_0x11d510<_0x130bc9[_0xbaa1('0x48')];_0x11d510+=0x1){var _0x4ab5ed=_0x130bc9[_0x11d510][_0xbaa1('0x26')]({'plain':!![]});_0xd5599d[_0xbaa1('0x64')]=_0x5de9e0[_0xbaa1('0x4c')]['dialCheckDuplicateType']?_0x5de9e0[_0xbaa1('0x4c')]['dialCheckDuplicateType']:_0xd5599d[_0xbaa1('0x64')];switch(_0xd5599d[_0xbaa1('0x64')]){case _0xbaa1('0x65'):_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')]('cm_hopper')[_0xbaa1('0x68')]([_0xbaa1('0x69'),_0xbaa1('0x6a'),_0xbaa1('0x6b'),_0xbaa1('0x6c'),_0xbaa1('0x59'),'createdAt',_0xbaa1('0x54')],squel['select']()[_0xbaa1('0x6d')](_0xbaa1('0x69'),'phone')[_0xbaa1('0x6d')]('NOW()',_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))[_0xbaa1('0x6d')](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','createdAt')['field']('\x27'+_0xed03fd+'\x27',_0xbaa1('0x54'))[_0xbaa1('0x70')](_0xbaa1('0x71'))[_0xbaa1('0x3c')](_0xbaa1('0x72'))['where'](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())['where'](_0xbaa1('0x74'))[_0xbaa1('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xbaa1('0x6d')](_0xbaa1('0x75'))['from']('cm_hopper_final')[_0xbaa1('0x3c')](_0xbaa1('0x76'),_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]()))[_0xbaa1('0x3c')](_0xbaa1('0x77'),squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x79'))[_0xbaa1('0x70')](_0xbaa1('0x7a'))[_0xbaa1('0x3c')]('CampaignId\x20=\x20?',_0x5de9e0['params']['id'][_0xbaa1('0x6f')]())))[_0xbaa1('0x6f')]();break;case _0xbaa1('0x7b'):_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7a'))['fromQuery']([_0xbaa1('0x69'),_0xbaa1('0x6a'),_0xbaa1('0x6b'),'ListId',_0xbaa1('0x59'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()['field']('phone',_0xbaa1('0x69'))[_0xbaa1('0x6d')](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))[_0xbaa1('0x6d')](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),_0xbaa1('0x59'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','updatedAt')['from'](_0xbaa1('0x71'))[_0xbaa1('0x3c')](_0xbaa1('0x72'))['where'](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())['where'](_0xbaa1('0x74'))[_0xbaa1('0x3c')](_0xbaa1('0x77'),squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x79'))[_0xbaa1('0x70')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]())))['toString']();break;default:_0x5ef444=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7a'))['fromQuery']([_0xbaa1('0x69'),_0xbaa1('0x6a'),'ContactId',_0xbaa1('0x6c'),_0xbaa1('0x59'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()['field'](_0xbaa1('0x69'),_0xbaa1('0x69'))['field'](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))['field'](_0x4ab5ed['CmListId']['toString'](),_0xbaa1('0x6c'))['field'](_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27','updatedAt')[_0xbaa1('0x70')](_0xbaa1('0x71'))['where'](_0xbaa1('0x72'))[_0xbaa1('0x3c')](_0xbaa1('0x73'),_0x4ab5ed[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x74')))['toString']();}_0x3dc1a1=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x7e'))[_0xbaa1('0x68')]([_0xbaa1('0x7f'),_0xbaa1('0x6a'),_0xbaa1('0x69'),_0xbaa1('0x80'),_0xbaa1('0x7c'),_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')](_0xbaa1('0x81'),'id')['field'](_0xbaa1('0x7d'),_0xbaa1('0x6a'))[_0xbaa1('0x6d')](_0xbaa1('0x82'),_0xbaa1('0x69'))[_0xbaa1('0x6d')](_0xbaa1('0x83'),_0xbaa1('0x80'))['field']('\x27'+_0xed03fd+'\x27',_0xbaa1('0x7c'))[_0xbaa1('0x6d')]('\x27'+_0xed03fd+'\x27',_0xbaa1('0x54'))[_0xbaa1('0x70')](_0xbaa1('0x84'),'ci')[_0xbaa1('0x85')]('cm_hopper','h',_0xbaa1('0x86'))[_0xbaa1('0x3c')](_0xbaa1('0x87'),_0x4ab5ed[_0xbaa1('0x6e')]['toString']())['where'](_0xbaa1('0x88'),_0x5de9e0[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x89'),_0xed03fd))[_0xbaa1('0x6f')]();_0x1d09fc[_0xbaa1('0x8a')](db[_0xbaa1('0x8b')][_0xbaa1('0x35')](_0x5ef444));_0x4b97a6['push'](db['sequelize'][_0xbaa1('0x35')](_0x3dc1a1));}return BPromise[_0xbaa1('0x8c')](_0x1d09fc);}})[_0xbaa1('0x24')](function(){return BPromise[_0xbaa1('0x8c')](_0x4b97a6);})[_0xbaa1('0x24')](function(){return _0x3d0925;})[_0xbaa1('0x24')](respondWithResult(_0x14a1c5,null))[_0xbaa1('0x4a')](handleError(_0x14a1c5,null));};exports[_0xbaa1('0x8d')]=function(_0x2f2f07,_0x809f12,_0x883f59){return db[_0xbaa1('0x30')][_0xbaa1('0x49')]({'where':{'id':_0x2f2f07[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x809f12,null))[_0xbaa1('0x24')](function(_0x54b13d){if(_0x54b13d){return _0x54b13d[_0xbaa1('0x8d')](_0x2f2f07[_0xbaa1('0x35')][_0xbaa1('0x8e')]);}})[_0xbaa1('0x24')](function(_0x418250){if(_0x418250){return db[_0xbaa1('0x5a')][_0xbaa1('0x25')]({'where':{'ListId':_0x2f2f07[_0xbaa1('0x35')][_0xbaa1('0x8e')],'CampaignId':_0x2f2f07[_0xbaa1('0x46')]['id']}})['then'](function(){return _0x418250;});}})['then'](respondWithStatusCode(_0x809f12,null))[_0xbaa1('0x4a')](handleError(_0x809f12,null));};exports[_0xbaa1('0x8f')]=function(_0x3a0738,_0x1538e6,_0x264c17){var _0x585993={};var _0x5ac12d={};var _0x177431;var _0x45b208;return db[_0xbaa1('0x30')]['findOne']({'where':{'id':_0x3a0738[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x1538e6,null))[_0xbaa1('0x24')](function(_0x46f9e5){if(_0x46f9e5){_0x177431=_0x46f9e5;_0x5ac12d['model']=_[_0xbaa1('0x47')](db[_0xbaa1('0x61')][_0xbaa1('0x31')]);_0x5ac12d['query']=_[_0xbaa1('0x47')](_0x3a0738[_0xbaa1('0x35')]);_0x5ac12d[_0xbaa1('0x3d')]=_[_0xbaa1('0x36')](_0x5ac12d[_0xbaa1('0x34')],_0x5ac12d['query']);_0x585993[_0xbaa1('0x37')]=_['intersection'](_0x5ac12d[_0xbaa1('0x34')],qs[_0xbaa1('0x38')](_0x3a0738[_0xbaa1('0x35')]['fields']));_0x585993[_0xbaa1('0x37')]=_0x585993[_0xbaa1('0x37')][_0xbaa1('0x48')]?_0x585993[_0xbaa1('0x37')]:_0x5ac12d[_0xbaa1('0x34')];_0x585993[_0xbaa1('0x3a')]=qs[_0xbaa1('0x3b')](_0x3a0738['query'][_0xbaa1('0x3b')]);_0x585993[_0xbaa1('0x3c')]=qs[_0xbaa1('0x3d')](_[_0xbaa1('0x3e')](_0x3a0738[_0xbaa1('0x35')],_0x5ac12d[_0xbaa1('0x3d')]));if(_0x3a0738['query'][_0xbaa1('0x3f')]){_0x585993['where']=_[_0xbaa1('0x40')](_0x585993['where'],{'$or':_[_0xbaa1('0x2f')](_0x585993['attributes'],function(_0x3cd2e5){var _0x54eecc={};_0x54eecc[_0x3cd2e5]={'$like':'%'+_0x3a0738[_0xbaa1('0x35')]['filter']+'%'};return _0x54eecc;})});}_0x585993=_[_0xbaa1('0x40')]({},_0x585993,_0x3a0738[_0xbaa1('0x41')]);return _0x177431[_0xbaa1('0x8f')](_0x585993);}})['then'](function(_0x3b114e){if(_0x3b114e){_0x45b208=_0x3b114e[_0xbaa1('0x48')];if(!_0x3a0738[_0xbaa1('0x35')]['hasOwnProperty'](_0xbaa1('0x39'))){_0x585993[_0xbaa1('0x1c')]=qs['limit'](_0x3a0738['query'][_0xbaa1('0x1c')]);_0x585993[_0xbaa1('0x1a')]=qs[_0xbaa1('0x1a')](_0x3a0738[_0xbaa1('0x35')]['offset']);}return _0x177431[_0xbaa1('0x8f')](_0x585993);}})[_0xbaa1('0x24')](function(_0x289258){if(_0x289258){return _0x289258?{'count':_0x45b208,'rows':_0x289258}:null;}})[_0xbaa1('0x24')](respondWithResult(_0x1538e6,null))[_0xbaa1('0x4a')](handleError(_0x1538e6,null));};exports[_0xbaa1('0x90')]=function(_0x289421,_0x558f36,_0x5a68c1){var _0x292887,_0x22b8f3;var _0x5d4da6=[];var _0x3d6ce9=moment()[_0xbaa1('0x91')](_0xbaa1('0x92'));return db[_0xbaa1('0x30')]['find']({'where':{'id':_0x289421['params']['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x558f36,null))['then'](function(_0x43d9c2){if(_0x43d9c2){_0x22b8f3=_0x43d9c2;return _0x43d9c2['addBlackLists'](_0x289421[_0xbaa1('0x4c')]['ids'],_['omit'](_0x289421[_0xbaa1('0x4c')],[_0xbaa1('0x8e'),'id'])||{});}return null;})[_0xbaa1('0x63')](function(_0x1dbe68){var _0x58e18a;var _0xbf751d;_0x292887=_0x1dbe68||[];var _0x3c2749=[];if(_0x1dbe68){for(var _0x1b966f=0x0;_0x1b966f<_0x1dbe68[_0xbaa1('0x48')];_0x1b966f+=0x1){var _0x4d00c4=_0x1dbe68[_0x1b966f]['get']({'plain':!![]});_0x58e18a=squel[_0xbaa1('0x66')]()[_0xbaa1('0x67')](_0xbaa1('0x93'))[_0xbaa1('0x68')](['phone',_0xbaa1('0x6b'),'ListId','CampaignId','createdAt',_0xbaa1('0x54')],squel[_0xbaa1('0x78')]()[_0xbaa1('0x6d')]('phone',_0xbaa1('0x69'))[_0xbaa1('0x6d')]('id',_0xbaa1('0x6b'))[_0xbaa1('0x6d')](_0x4d00c4['CmListId'][_0xbaa1('0x6f')](),_0xbaa1('0x6c'))['field'](_0x289421[_0xbaa1('0x46')]['id'][_0xbaa1('0x6f')](),'CampaignId')[_0xbaa1('0x6d')](_0xbaa1('0x7d'),_0xbaa1('0x7c'))['field']('NOW()',_0xbaa1('0x54'))[_0xbaa1('0x70')]('cm_contacts')['where'](_0xbaa1('0x72'))[_0xbaa1('0x3c')]('ListId\x20=\x20?',_0x4d00c4[_0xbaa1('0x6e')][_0xbaa1('0x6f')]())[_0xbaa1('0x3c')](_0xbaa1('0x74')))[_0xbaa1('0x6f')]();_0x3c2749[_0xbaa1('0x8a')](db[_0xbaa1('0x8b')][_0xbaa1('0x35')](_0x58e18a));}return BPromise['all'](_0x3c2749);}})[_0xbaa1('0x24')](function(){return _0x292887;})['then'](respondWithResult(_0x558f36,null))[_0xbaa1('0x4a')](handleError(_0x558f36,null));};exports[_0xbaa1('0x94')]=function(_0x2aa343,_0x33c182,_0x2166e9){return db[_0xbaa1('0x30')][_0xbaa1('0x49')]({'where':{'id':_0x2aa343[_0xbaa1('0x46')]['id']}})[_0xbaa1('0x24')](handleEntityNotFound(_0x33c182,null))[_0xbaa1('0x24')](function(_0xbf957f){if(_0xbf957f){return _0xbf957f[_0xbaa1('0x94')](_0x2aa343['query'][_0xbaa1('0x8e')]);}})[_0xbaa1('0x24')](function(_0x278628){if(_0x278628){return db[_0xbaa1('0x5f')][_0xbaa1('0x25')]({'where':{'ListId':_0x2aa343[_0xbaa1('0x35')][_0xbaa1('0x8e')],'CampaignId':_0x2aa343[_0xbaa1('0x46')]['id']}})['then'](function(){return _0x278628;});}})[_0xbaa1('0x24')](respondWithStatusCode(_0x33c182,null))[_0xbaa1('0x4a')](handleError(_0x33c182,null));}; \ No newline at end of file +var _0x0caf=['cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','removeBlackLists','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','findOne','CmHopper','hasOwnProperty','CampaignId','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','ListId','toString','from','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','into','NOW()','ListId\x20=\x20?','cm_contacts','cm_hopper_additional_phones'];(function(_0x5720ae,_0x1237b4){var _0x4b44e8=function(_0xa40c83){while(--_0xa40c83){_0x5720ae['push'](_0x5720ae['shift']());}};_0x4b44e8(++_0x1237b4);}(_0x0caf,0x9f));var _0xf0ca=function(_0x28483c,_0x3d6dbf){_0x28483c=_0x28483c-0x0;var _0x6fe3cd=_0x0caf[_0x28483c];return _0x6fe3cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ca('0x0'));var rp=require(_0xf0ca('0x1'));var moment=require(_0xf0ca('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0ca('0x3'));var path=require(_0xf0ca('0x4'));var sox=require('sox');var csv=require(_0xf0ca('0x5'));var ejs=require(_0xf0ca('0x6'));var fs=require('fs');var fs_extra=require(_0xf0ca('0x7'));var _=require('lodash');var squel=require(_0xf0ca('0x8'));var crypto=require(_0xf0ca('0x9'));var jsforce=require(_0xf0ca('0xa'));var deskjs=require(_0xf0ca('0xb'));var toCsv=require(_0xf0ca('0x5'));var querystring=require(_0xf0ca('0xc'));var Papa=require(_0xf0ca('0xd'));var Redis=require('ioredis');var authService=require(_0xf0ca('0xe'));var qs=require(_0xf0ca('0xf'));var as=require(_0xf0ca('0x10'));var hardwareService=require(_0xf0ca('0x11'));var logger=require(_0xf0ca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf0ca('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0ca('0x14'))['db'];function respondWithStatusCode(_0x582e00,_0x3c1332){_0x3c1332=_0x3c1332||0xcc;return function(_0x38c595){if(_0x38c595){return _0x582e00[_0xf0ca('0x15')](_0x3c1332);}return _0x582e00[_0xf0ca('0x16')](_0x3c1332)[_0xf0ca('0x17')]();};}function respondWithResult(_0x3f6251,_0x5c5875){_0x5c5875=_0x5c5875||0xc8;return function(_0x6d9157){if(_0x6d9157){return _0x3f6251['status'](_0x5c5875)['json'](_0x6d9157);}};}function respondWithFilteredResult(_0x4545db,_0x34ea00){return function(_0x3b1daa){if(_0x3b1daa){var _0x2b074e=typeof _0x34ea00[_0xf0ca('0x18')]==='undefined'&&typeof _0x34ea00['limit']===_0xf0ca('0x19');var _0x4d08f2=_0x3b1daa['count'];var _0x3245b2=_0x2b074e?0x0:_0x34ea00[_0xf0ca('0x18')];var _0x2473f0=_0x2b074e?_0x3b1daa[_0xf0ca('0x1a')]:_0x34ea00[_0xf0ca('0x18')]+_0x34ea00[_0xf0ca('0x1b')];var _0x48b114;if(_0x2473f0>=_0x4d08f2){_0x2473f0=_0x4d08f2;_0x48b114=0xc8;}else{_0x48b114=0xce;}_0x4545db[_0xf0ca('0x16')](_0x48b114);return _0x4545db['set'](_0xf0ca('0x1c'),_0x3245b2+'-'+_0x2473f0+'/'+_0x4d08f2)[_0xf0ca('0x1d')](_0x3b1daa);}return null;};}function patchUpdates(_0x50f742){return function(_0x24303d){try{jsonpatch[_0xf0ca('0x1e')](_0x24303d,_0x50f742,!![]);}catch(_0x3512b3){return BPromise[_0xf0ca('0x1f')](_0x3512b3);}return _0x24303d[_0xf0ca('0x20')]();};}function saveUpdates(_0x2e54bf,_0x3414eb){return function(_0x520863){if(_0x520863){return _0x520863[_0xf0ca('0x21')](_0x2e54bf)[_0xf0ca('0x22')](function(_0x1ba29d){return _0x1ba29d;});}return null;};}function removeEntity(_0x3d6bad,_0x5f31c6){return function(_0xd8312a){if(_0xd8312a){return _0xd8312a['destroy']()['then'](function(){var _0x1eea57=_0xd8312a[_0xf0ca('0x23')]({'plain':!![]});var _0x8dbaed=_0xf0ca('0x24');return db[_0xf0ca('0x25')][_0xf0ca('0x26')]({'where':{'type':_0x8dbaed,'resourceId':_0x1eea57['id']}})[_0xf0ca('0x22')](function(){return _0xd8312a;});})[_0xf0ca('0x22')](function(){_0x3d6bad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22c0f0,_0x15aaa1){return function(_0x57ad7e){if(!_0x57ad7e){_0x22c0f0[_0xf0ca('0x15')](0x194);}return _0x57ad7e;};}function handleError(_0x41708,_0x214d12){_0x214d12=_0x214d12||0x1f4;return function(_0x2aaae9){logger['error'](_0x2aaae9[_0xf0ca('0x27')]);if(_0x2aaae9[_0xf0ca('0x28')]){delete _0x2aaae9[_0xf0ca('0x28')];}_0x41708[_0xf0ca('0x16')](_0x214d12)[_0xf0ca('0x29')](_0x2aaae9);};}exports[_0xf0ca('0x2a')]=function(_0x3ed79e,_0x56bd3b){var _0x6988a={},_0x4ba8ac={},_0x35d887={'count':0x0,'rows':[]};var _0x5c4625=_[_0xf0ca('0x2b')](db[_0xf0ca('0x2c')][_0xf0ca('0x2d')],function(_0x12d49c){return{'name':_0x12d49c[_0xf0ca('0x2e')],'type':_0x12d49c[_0xf0ca('0x2f')][_0xf0ca('0x30')]};});_0x4ba8ac[_0xf0ca('0x31')]=_[_0xf0ca('0x2b')](_0x5c4625,_0xf0ca('0x28'));_0x4ba8ac[_0xf0ca('0x32')]=_[_0xf0ca('0x33')](_0x3ed79e[_0xf0ca('0x32')]);_0x4ba8ac[_0xf0ca('0x34')]=_['intersection'](_0x4ba8ac[_0xf0ca('0x31')],_0x4ba8ac[_0xf0ca('0x32')]);_0x6988a[_0xf0ca('0x35')]=_[_0xf0ca('0x36')](_0x4ba8ac['model'],qs[_0xf0ca('0x37')](_0x3ed79e['query'][_0xf0ca('0x37')]));_0x6988a['attributes']=_0x6988a[_0xf0ca('0x35')][_0xf0ca('0x38')]?_0x6988a['attributes']:_0x4ba8ac[_0xf0ca('0x31')];if(!_0x3ed79e['query']['hasOwnProperty'](_0xf0ca('0x39'))){_0x6988a[_0xf0ca('0x1b')]=qs[_0xf0ca('0x1b')](_0x3ed79e[_0xf0ca('0x32')][_0xf0ca('0x1b')]);_0x6988a['offset']=qs[_0xf0ca('0x18')](_0x3ed79e[_0xf0ca('0x32')][_0xf0ca('0x18')]);}_0x6988a[_0xf0ca('0x3a')]=qs[_0xf0ca('0x3b')](_0x3ed79e[_0xf0ca('0x32')]['sort']);_0x6988a[_0xf0ca('0x3c')]=qs[_0xf0ca('0x34')](_[_0xf0ca('0x3d')](_0x3ed79e[_0xf0ca('0x32')],_0x4ba8ac['filters']),_0x5c4625);if(_0x3ed79e[_0xf0ca('0x32')]['filter']){_0x6988a[_0xf0ca('0x3c')]=_[_0xf0ca('0x3e')](_0x6988a[_0xf0ca('0x3c')],{'$or':_[_0xf0ca('0x2b')](_0x5c4625,function(_0x4cb568){if(_0x4cb568['type']!=='VIRTUAL'){var _0x13b247={};_0x13b247[_0x4cb568[_0xf0ca('0x28')]]={'$like':'%'+_0x3ed79e[_0xf0ca('0x32')][_0xf0ca('0x3f')]+'%'};return _0x13b247;}})});}_0x6988a=_[_0xf0ca('0x3e')]({},_0x6988a,_0x3ed79e[_0xf0ca('0x40')]);var _0x318c07={'where':_0x6988a[_0xf0ca('0x3c')]};return db[_0xf0ca('0x2c')][_0xf0ca('0x1a')](_0x318c07)['then'](function(_0x466857){_0x35d887[_0xf0ca('0x1a')]=_0x466857;if(_0x3ed79e[_0xf0ca('0x32')][_0xf0ca('0x41')]){_0x6988a['include']=[{'all':!![]}];}return db['Campaign'][_0xf0ca('0x42')](_0x6988a);})[_0xf0ca('0x22')](function(_0x3c808c){_0x35d887['rows']=_0x3c808c;return _0x35d887;})[_0xf0ca('0x22')](respondWithFilteredResult(_0x56bd3b,_0x6988a))[_0xf0ca('0x43')](handleError(_0x56bd3b,null));};exports[_0xf0ca('0x44')]=function(_0x411526,_0x462c78){var _0x577d0c={'raw':![],'where':{'id':_0x411526[_0xf0ca('0x45')]['id']}},_0x2bd7f7={};_0x2bd7f7[_0xf0ca('0x31')]=_[_0xf0ca('0x33')](db[_0xf0ca('0x2c')][_0xf0ca('0x2d')]);_0x2bd7f7[_0xf0ca('0x32')]=_[_0xf0ca('0x33')](_0x411526[_0xf0ca('0x32')]);_0x2bd7f7[_0xf0ca('0x34')]=_[_0xf0ca('0x36')](_0x2bd7f7[_0xf0ca('0x31')],_0x2bd7f7[_0xf0ca('0x32')]);_0x577d0c[_0xf0ca('0x35')]=_[_0xf0ca('0x36')](_0x2bd7f7[_0xf0ca('0x31')],qs[_0xf0ca('0x37')](_0x411526[_0xf0ca('0x32')][_0xf0ca('0x37')]));_0x577d0c['attributes']=_0x577d0c[_0xf0ca('0x35')][_0xf0ca('0x38')]?_0x577d0c[_0xf0ca('0x35')]:_0x2bd7f7[_0xf0ca('0x31')];if(_0x411526[_0xf0ca('0x32')]['includeAll']){_0x577d0c[_0xf0ca('0x46')]=[{'all':!![]}];}_0x577d0c=_[_0xf0ca('0x3e')]({},_0x577d0c,_0x411526['options']);return db['Campaign'][_0xf0ca('0x47')](_0x577d0c)[_0xf0ca('0x22')](handleEntityNotFound(_0x462c78,null))[_0xf0ca('0x22')](respondWithResult(_0x462c78,null))['catch'](handleError(_0x462c78,null));};exports[_0xf0ca('0x48')]=function(_0x5dad46,_0x577f1d){return db[_0xf0ca('0x2c')]['create'](_0x5dad46['body'],{})[_0xf0ca('0x22')](function(_0x51b6bb){var _0xf73184=_0x5dad46[_0xf0ca('0x49')][_0xf0ca('0x23')]({'plain':!![]});if(!_0xf73184)throw new Error(_0xf0ca('0x4a'));if(_0xf73184[_0xf0ca('0x4b')]===_0xf0ca('0x49')){var _0x5ef4dc=_0x51b6bb[_0xf0ca('0x23')]({'plain':!![]});var _0xb8a7b6=_0xf0ca('0x24');return db[_0xf0ca('0x4c')]['find']({'where':{'name':_0xb8a7b6,'userProfileId':_0xf73184[_0xf0ca('0x4d')]},'raw':!![]})[_0xf0ca('0x22')](function(_0x3011d2){if(_0x3011d2&&_0x3011d2[_0xf0ca('0x4e')]===0x0){return db[_0xf0ca('0x25')][_0xf0ca('0x48')]({'name':_0x5ef4dc[_0xf0ca('0x28')],'resourceId':_0x5ef4dc['id'],'type':_0x3011d2[_0xf0ca('0x28')],'sectionId':_0x3011d2['id']},{})['then'](function(){return _0x51b6bb;});}else{return _0x51b6bb;}})['catch'](function(_0x2333f5){logger[_0xf0ca('0x4f')](_0xf0ca('0x50'),_0x2333f5);throw _0x2333f5;});}return _0x51b6bb;})[_0xf0ca('0x22')](respondWithResult(_0x577f1d,0xc9))[_0xf0ca('0x43')](handleError(_0x577f1d,null));};exports[_0xf0ca('0x51')]=function(_0xf2d7b0,_0x45fdc1){var _0x2d4230={'where':{'id':_0xf2d7b0[_0xf0ca('0x45')]['id']}},_0x2de7e0={};_0x2de7e0[_0xf0ca('0x31')]=_[_0xf0ca('0x33')](db[_0xf0ca('0x2c')]['rawAttributes']);_0x2d4230[_0xf0ca('0x35')]=_[_0xf0ca('0x36')](_0x2de7e0['model'],qs[_0xf0ca('0x37')](_0xf2d7b0[_0xf0ca('0x32')]['fields']));_0x2d4230[_0xf0ca('0x35')]=_0x2d4230['attributes'][_0xf0ca('0x38')]?_0x2d4230['attributes']:_0x2de7e0[_0xf0ca('0x31')];if(_0xf2d7b0[_0xf0ca('0x32')][_0xf0ca('0x41')]){_0x2d4230[_0xf0ca('0x46')]=[{'all':!![]}];}_0x2d4230=_[_0xf0ca('0x3e')]({},_0x2d4230,_0xf2d7b0[_0xf0ca('0x40')]);return db[_0xf0ca('0x2c')][_0xf0ca('0x47')](_0x2d4230)[_0xf0ca('0x22')](handleEntityNotFound(_0x45fdc1,null))[_0xf0ca('0x22')](function(_0x36484c){if(_0x36484c){var _0x428280=_0x36484c[_0xf0ca('0x23')]({'plain':!![]});_0x428280=qs[_0xf0ca('0x52')](_0x428280,['id','createdAt',_0xf0ca('0x53')]);_0xf2d7b0[_0xf0ca('0x54')]=_[_0xf0ca('0x52')](_0xf2d7b0[_0xf0ca('0x54')],['id',_0xf0ca('0x55'),'updatedAt']);return db['Campaign']['create'](_['merge'](_0x428280,_0xf2d7b0[_0xf0ca('0x54')]),{'include':_0xf2d7b0[_0xf0ca('0x32')][_0xf0ca('0x41')]?[{'all':!![]}]:undefined})[_0xf0ca('0x22')](function(_0x568ad0){var _0x1ca88c=_0xf2d7b0['user'][_0xf0ca('0x23')]({'plain':!![]});if(!_0x1ca88c)throw new Error(_0xf0ca('0x4a'));if(_0x1ca88c['role']===_0xf0ca('0x49')){var _0x68ff58=_0x568ad0[_0xf0ca('0x23')]({'plain':!![]});var _0x4dac2a=_0xf0ca('0x24');return db['UserProfileSection'][_0xf0ca('0x47')]({'where':{'name':_0x4dac2a,'userProfileId':_0x1ca88c[_0xf0ca('0x4d')]},'raw':!![]})[_0xf0ca('0x22')](function(_0x3c4796){if(_0x3c4796&&_0x3c4796[_0xf0ca('0x4e')]===0x0){return db[_0xf0ca('0x25')][_0xf0ca('0x48')]({'name':_0x68ff58[_0xf0ca('0x28')],'resourceId':_0x68ff58['id'],'type':_0x3c4796[_0xf0ca('0x28')],'sectionId':_0x3c4796['id']},{})['then'](function(){return _0x568ad0;});}else{return _0x568ad0;}})[_0xf0ca('0x43')](function(_0x4bb647){logger[_0xf0ca('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bb647);throw _0x4bb647;});}return _0x568ad0;});}})[_0xf0ca('0x22')](respondWithResult(_0x45fdc1,0xc9))[_0xf0ca('0x43')](handleError(_0x45fdc1,null));};exports[_0xf0ca('0x21')]=function(_0x526bb6,_0x4017a0){if(_0x526bb6[_0xf0ca('0x54')]['id']){delete _0x526bb6[_0xf0ca('0x54')]['id'];}return db[_0xf0ca('0x2c')][_0xf0ca('0x47')]({'where':{'id':_0x526bb6[_0xf0ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x4017a0,null))[_0xf0ca('0x22')](saveUpdates(_0x526bb6['body'],null))['then'](respondWithResult(_0x4017a0,null))['catch'](handleError(_0x4017a0,null));};exports['destroy']=function(_0x311d73,_0x3d1f64){return db[_0xf0ca('0x2c')][_0xf0ca('0x47')]({'where':{'id':_0x311d73[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x3d1f64,null))[_0xf0ca('0x22')](removeEntity(_0x3d1f64,null))[_0xf0ca('0x43')](handleError(_0x3d1f64,null));};exports['getHoppers']=function(_0x383cd,_0x16f58b,_0x36a156){var _0x2a30af={'raw':!![],'where':{}};var _0x13f232={};var _0x1b9995={'count':0x0,'rows':[]};return db['Campaign'][_0xf0ca('0x56')]({'where':{'id':_0x383cd[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x16f58b,null))[_0xf0ca('0x22')](function(_0x4f6065){if(_0x4f6065){_0x13f232['model']=_[_0xf0ca('0x33')](db[_0xf0ca('0x57')][_0xf0ca('0x2d')]);_0x13f232[_0xf0ca('0x32')]=_[_0xf0ca('0x33')](_0x383cd[_0xf0ca('0x32')]);_0x13f232[_0xf0ca('0x34')]=_[_0xf0ca('0x36')](_0x13f232[_0xf0ca('0x31')],_0x13f232[_0xf0ca('0x32')]);_0x2a30af[_0xf0ca('0x35')]=_[_0xf0ca('0x36')](_0x13f232['model'],qs[_0xf0ca('0x37')](_0x383cd[_0xf0ca('0x32')]['fields']));_0x2a30af[_0xf0ca('0x35')]=_0x2a30af['attributes'][_0xf0ca('0x38')]?_0x2a30af[_0xf0ca('0x35')]:_0x13f232[_0xf0ca('0x31')];if(!_0x383cd['query'][_0xf0ca('0x58')](_0xf0ca('0x39'))){_0x2a30af[_0xf0ca('0x1b')]=qs[_0xf0ca('0x1b')](_0x383cd['query'][_0xf0ca('0x1b')]);_0x2a30af[_0xf0ca('0x18')]=qs[_0xf0ca('0x18')](_0x383cd['query']['offset']);}_0x2a30af[_0xf0ca('0x3a')]=qs['sort'](_0x383cd['query'][_0xf0ca('0x3b')]);_0x2a30af[_0xf0ca('0x3c')]=qs[_0xf0ca('0x34')](_[_0xf0ca('0x3d')](_0x383cd['query'],_0x13f232[_0xf0ca('0x34')]));_0x2a30af[_0xf0ca('0x3c')][_0xf0ca('0x59')]=_0x4f6065['id'];if(_0x383cd[_0xf0ca('0x32')][_0xf0ca('0x3f')]){_0x2a30af['where']=_[_0xf0ca('0x3e')](_0x2a30af[_0xf0ca('0x3c')],{'$or':_[_0xf0ca('0x2b')](_0x2a30af[_0xf0ca('0x35')],function(_0x3c13e2){var _0x4b7030={};_0x4b7030[_0x3c13e2]={'$like':'%'+_0x383cd[_0xf0ca('0x32')][_0xf0ca('0x3f')]+'%'};return _0x4b7030;})});}_0x2a30af=_[_0xf0ca('0x3e')]({},_0x2a30af,_0x383cd[_0xf0ca('0x40')]);return db[_0xf0ca('0x57')][_0xf0ca('0x1a')]({'where':_0x2a30af[_0xf0ca('0x3c')]})['then'](function(_0x143b40){_0x1b9995[_0xf0ca('0x1a')]=_0x143b40;if(_0x383cd['query'][_0xf0ca('0x41')]){_0x2a30af['include']=[{'all':!![]}];}return db[_0xf0ca('0x57')][_0xf0ca('0x42')](_0x2a30af);})[_0xf0ca('0x22')](function(_0x3d8e0b){_0x1b9995[_0xf0ca('0x5a')]=_0x3d8e0b;return _0x1b9995;});}})[_0xf0ca('0x22')](respondWithFilteredResult(_0x16f58b,_0x2a30af))[_0xf0ca('0x43')](handleError(_0x16f58b,null));};exports[_0xf0ca('0x5b')]=function(_0x4e9efb,_0x5abd58,_0x5ce9ca){var _0x59a0f8={'raw':!![],'where':{}};var _0x31ddff={};var _0x1addbd={'count':0x0,'rows':[]};return db[_0xf0ca('0x2c')][_0xf0ca('0x56')]({'where':{'id':_0x4e9efb['params']['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x5abd58,null))[_0xf0ca('0x22')](function(_0x233622){if(_0x233622){_0x31ddff['model']=_[_0xf0ca('0x33')](db['CmHopperHistory'][_0xf0ca('0x2d')]);_0x31ddff['query']=_[_0xf0ca('0x33')](_0x4e9efb['query']);_0x31ddff[_0xf0ca('0x34')]=_[_0xf0ca('0x36')](_0x31ddff[_0xf0ca('0x31')],_0x31ddff['query']);_0x59a0f8[_0xf0ca('0x35')]=_[_0xf0ca('0x36')](_0x31ddff[_0xf0ca('0x31')],qs[_0xf0ca('0x37')](_0x4e9efb[_0xf0ca('0x32')]['fields']));_0x59a0f8[_0xf0ca('0x35')]=_0x59a0f8[_0xf0ca('0x35')][_0xf0ca('0x38')]?_0x59a0f8[_0xf0ca('0x35')]:_0x31ddff[_0xf0ca('0x31')];if(!_0x4e9efb['query'][_0xf0ca('0x58')](_0xf0ca('0x39'))){_0x59a0f8[_0xf0ca('0x1b')]=qs[_0xf0ca('0x1b')](_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x1b')]);_0x59a0f8['offset']=qs[_0xf0ca('0x18')](_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x18')]);}_0x59a0f8[_0xf0ca('0x3a')]=qs['sort'](_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x3b')]);_0x59a0f8[_0xf0ca('0x3c')]=qs[_0xf0ca('0x34')](_[_0xf0ca('0x3d')](_0x4e9efb['query'],_0x31ddff[_0xf0ca('0x34')]));_0x59a0f8[_0xf0ca('0x3c')][_0xf0ca('0x59')]=_0x233622['id'];if(_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x3f')]){_0x59a0f8['where']=_[_0xf0ca('0x3e')](_0x59a0f8[_0xf0ca('0x3c')],{'$or':_[_0xf0ca('0x2b')](_0x59a0f8[_0xf0ca('0x35')],function(_0x29d8b2){var _0x3639f5={};_0x3639f5[_0x29d8b2]={'$like':'%'+_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x3f')]+'%'};return _0x3639f5;})});}_0x59a0f8=_['merge']({},_0x59a0f8,_0x4e9efb[_0xf0ca('0x40')]);return db['CmHopperHistory'][_0xf0ca('0x1a')]({'where':_0x59a0f8[_0xf0ca('0x3c')]})[_0xf0ca('0x22')](function(_0xa470be){_0x1addbd[_0xf0ca('0x1a')]=_0xa470be;if(_0x4e9efb[_0xf0ca('0x32')][_0xf0ca('0x41')]){_0x59a0f8[_0xf0ca('0x46')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x59a0f8);})[_0xf0ca('0x22')](function(_0x15d2eb){_0x1addbd[_0xf0ca('0x5a')]=_0x15d2eb;return _0x1addbd;});}})['then'](respondWithFilteredResult(_0x5abd58,_0x59a0f8))[_0xf0ca('0x43')](handleError(_0x5abd58,null));};exports[_0xf0ca('0x5c')]=function(_0x3d2e34,_0x1e40c9,_0x36905e){var _0x296caa={'raw':!![],'where':{}};var _0x1b8884={};var _0x51cc2c={'count':0x0,'rows':[]};return db[_0xf0ca('0x2c')][_0xf0ca('0x56')]({'where':{'id':_0x3d2e34[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x1e40c9,null))[_0xf0ca('0x22')](function(_0x9a4781){if(_0x9a4781){_0x1b8884['model']=_[_0xf0ca('0x33')](db[_0xf0ca('0x5d')][_0xf0ca('0x2d')]);_0x1b8884['query']=_[_0xf0ca('0x33')](_0x3d2e34[_0xf0ca('0x32')]);_0x1b8884[_0xf0ca('0x34')]=_[_0xf0ca('0x36')](_0x1b8884[_0xf0ca('0x31')],_0x1b8884[_0xf0ca('0x32')]);_0x296caa['attributes']=_[_0xf0ca('0x36')](_0x1b8884['model'],qs[_0xf0ca('0x37')](_0x3d2e34[_0xf0ca('0x32')][_0xf0ca('0x37')]));_0x296caa[_0xf0ca('0x35')]=_0x296caa[_0xf0ca('0x35')]['length']?_0x296caa['attributes']:_0x1b8884['model'];if(!_0x3d2e34[_0xf0ca('0x32')][_0xf0ca('0x58')](_0xf0ca('0x39'))){_0x296caa['limit']=qs[_0xf0ca('0x1b')](_0x3d2e34['query']['limit']);_0x296caa[_0xf0ca('0x18')]=qs['offset'](_0x3d2e34[_0xf0ca('0x32')][_0xf0ca('0x18')]);}_0x296caa[_0xf0ca('0x3a')]=qs[_0xf0ca('0x3b')](_0x3d2e34[_0xf0ca('0x32')]['sort']);_0x296caa[_0xf0ca('0x3c')]=qs[_0xf0ca('0x34')](_[_0xf0ca('0x3d')](_0x3d2e34[_0xf0ca('0x32')],_0x1b8884['filters']));_0x296caa[_0xf0ca('0x3c')]['CampaignId']=_0x9a4781['id'];if(_0x3d2e34[_0xf0ca('0x32')][_0xf0ca('0x3f')]){_0x296caa['where']=_[_0xf0ca('0x3e')](_0x296caa[_0xf0ca('0x3c')],{'$or':_[_0xf0ca('0x2b')](_0x296caa[_0xf0ca('0x35')],function(_0x2a3a39){var _0x355962={};_0x355962[_0x2a3a39]={'$like':'%'+_0x3d2e34['query']['filter']+'%'};return _0x355962;})});}_0x296caa=_[_0xf0ca('0x3e')]({},_0x296caa,_0x3d2e34[_0xf0ca('0x40')]);return db[_0xf0ca('0x5d')][_0xf0ca('0x1a')]({'where':_0x296caa[_0xf0ca('0x3c')]})['then'](function(_0x481a18){_0x51cc2c[_0xf0ca('0x1a')]=_0x481a18;if(_0x3d2e34[_0xf0ca('0x32')][_0xf0ca('0x41')]){_0x296caa[_0xf0ca('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x296caa);})['then'](function(_0x293de2){_0x51cc2c['rows']=_0x293de2;return _0x51cc2c;});}})['then'](respondWithFilteredResult(_0x1e40c9,_0x296caa))['catch'](handleError(_0x1e40c9,null));};exports[_0xf0ca('0x5e')]=function(_0x2fc1ab,_0x3a2598,_0x19658f){var _0x4a4605={'raw':!![],'where':{}};var _0x97c415={};var _0x29d082={'count':0x0,'rows':[]};return db[_0xf0ca('0x2c')]['findOne']({'where':{'id':_0x2fc1ab[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x3a2598,null))[_0xf0ca('0x22')](function(_0x120590){if(_0x120590){_0x97c415[_0xf0ca('0x31')]=_[_0xf0ca('0x33')](db[_0xf0ca('0x5f')][_0xf0ca('0x2d')]);_0x97c415[_0xf0ca('0x32')]=_[_0xf0ca('0x33')](_0x2fc1ab[_0xf0ca('0x32')]);_0x97c415[_0xf0ca('0x34')]=_[_0xf0ca('0x36')](_0x97c415[_0xf0ca('0x31')],_0x97c415[_0xf0ca('0x32')]);_0x4a4605[_0xf0ca('0x35')]=_['intersection'](_0x97c415[_0xf0ca('0x31')],qs[_0xf0ca('0x37')](_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x37')]));_0x4a4605[_0xf0ca('0x35')]=_0x4a4605['attributes']['length']?_0x4a4605[_0xf0ca('0x35')]:_0x97c415[_0xf0ca('0x31')];if(!_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x58')](_0xf0ca('0x39'))){_0x4a4605['limit']=qs['limit'](_0x2fc1ab[_0xf0ca('0x32')]['limit']);_0x4a4605[_0xf0ca('0x18')]=qs['offset'](_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x18')]);}_0x4a4605[_0xf0ca('0x3a')]=qs[_0xf0ca('0x3b')](_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x3b')]);_0x4a4605['where']=qs[_0xf0ca('0x34')](_['pick'](_0x2fc1ab['query'],_0x97c415[_0xf0ca('0x34')]));_0x4a4605[_0xf0ca('0x3c')][_0xf0ca('0x59')]=_0x120590['id'];if(_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x3f')]){_0x4a4605[_0xf0ca('0x3c')]=_[_0xf0ca('0x3e')](_0x4a4605[_0xf0ca('0x3c')],{'$or':_[_0xf0ca('0x2b')](_0x4a4605[_0xf0ca('0x35')],function(_0x276c90){var _0x2cab8a={};_0x2cab8a[_0x276c90]={'$like':'%'+_0x2fc1ab[_0xf0ca('0x32')][_0xf0ca('0x3f')]+'%'};return _0x2cab8a;})});}_0x4a4605=_['merge']({},_0x4a4605,_0x2fc1ab[_0xf0ca('0x40')]);return db['CmHopperBlack'][_0xf0ca('0x1a')]({'where':_0x4a4605[_0xf0ca('0x3c')]})['then'](function(_0x570a9b){_0x29d082[_0xf0ca('0x1a')]=_0x570a9b;if(_0x2fc1ab[_0xf0ca('0x32')]['includeAll']){_0x4a4605['include']=[{'all':!![]}];}return db[_0xf0ca('0x5f')][_0xf0ca('0x42')](_0x4a4605);})[_0xf0ca('0x22')](function(_0x1494cb){_0x29d082['rows']=_0x1494cb;return _0x29d082;});}})[_0xf0ca('0x22')](respondWithFilteredResult(_0x3a2598,_0x4a4605))[_0xf0ca('0x43')](handleError(_0x3a2598,null));};exports[_0xf0ca('0x60')]=function(_0x204f19,_0x2b7bdf,_0x300523){var _0x2e3e82={};var _0x11d097={};var _0x5c1952;var _0x5bd657;return db[_0xf0ca('0x2c')][_0xf0ca('0x56')]({'where':{'id':_0x204f19['params']['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x2b7bdf,null))['then'](function(_0x4d741c){if(_0x4d741c){_0x5c1952=_0x4d741c;_0x11d097['model']=_[_0xf0ca('0x33')](db[_0xf0ca('0x61')][_0xf0ca('0x2d')]);_0x11d097[_0xf0ca('0x32')]=_[_0xf0ca('0x33')](_0x204f19[_0xf0ca('0x32')]);_0x11d097[_0xf0ca('0x34')]=_['intersection'](_0x11d097[_0xf0ca('0x31')],_0x11d097[_0xf0ca('0x32')]);_0x2e3e82[_0xf0ca('0x35')]=_['intersection'](_0x11d097[_0xf0ca('0x31')],qs[_0xf0ca('0x37')](_0x204f19[_0xf0ca('0x32')][_0xf0ca('0x37')]));_0x2e3e82['attributes']=_0x2e3e82[_0xf0ca('0x35')]['length']?_0x2e3e82[_0xf0ca('0x35')]:_0x11d097[_0xf0ca('0x31')];_0x2e3e82[_0xf0ca('0x3a')]=qs['sort'](_0x204f19[_0xf0ca('0x32')][_0xf0ca('0x3b')]);_0x2e3e82[_0xf0ca('0x3c')]=qs[_0xf0ca('0x34')](_['pick'](_0x204f19[_0xf0ca('0x32')],_0x11d097[_0xf0ca('0x34')]));if(_0x204f19[_0xf0ca('0x32')][_0xf0ca('0x3f')]){_0x2e3e82[_0xf0ca('0x3c')]=_[_0xf0ca('0x3e')](_0x2e3e82[_0xf0ca('0x3c')],{'$or':_['map'](_0x2e3e82[_0xf0ca('0x35')],function(_0x4a0261){var _0x5c6569={};_0x5c6569[_0x4a0261]={'$like':'%'+_0x204f19[_0xf0ca('0x32')]['filter']+'%'};return _0x5c6569;})});}_0x2e3e82=_['merge']({},_0x2e3e82,_0x204f19['options']);return _0x5c1952[_0xf0ca('0x60')](_0x2e3e82);}})[_0xf0ca('0x22')](function(_0x2659fc){if(_0x2659fc){_0x5bd657=_0x2659fc[_0xf0ca('0x38')];if(!_0x204f19['query']['hasOwnProperty']('nolimit')){_0x2e3e82[_0xf0ca('0x1b')]=qs[_0xf0ca('0x1b')](_0x204f19['query']['limit']);_0x2e3e82[_0xf0ca('0x18')]=qs['offset'](_0x204f19[_0xf0ca('0x32')][_0xf0ca('0x18')]);}return _0x5c1952[_0xf0ca('0x60')](_0x2e3e82);}})[_0xf0ca('0x22')](function(_0x5be9fe){if(_0x5be9fe){return _0x5be9fe?{'count':_0x5bd657,'rows':_0x5be9fe}:null;}})[_0xf0ca('0x22')](respondWithResult(_0x2b7bdf,null))['catch'](handleError(_0x2b7bdf,null));};exports[_0xf0ca('0x62')]=function(_0x66af2e,_0x6e938c,_0x46a498){var _0x19961d,_0x5afcce;var _0x2a17f4=[];var _0x250364=moment()[_0xf0ca('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf0ca('0x2c')]['find']({'where':{'id':_0x66af2e[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x6e938c,null))[_0xf0ca('0x22')](function(_0x55aba9){if(_0x55aba9){_0x5afcce=_0x55aba9;return _0x55aba9[_0xf0ca('0x62')](_0x66af2e[_0xf0ca('0x54')][_0xf0ca('0x64')],_[_0xf0ca('0x52')](_0x66af2e[_0xf0ca('0x54')],['ids','id'])||{});}return null;})[_0xf0ca('0x65')](function(_0x490cea){var _0x102c88;var _0x493e4f;_0x19961d=_0x490cea||[];var _0x2d424b=[];if(_0x490cea){for(var _0x1c5ebe=0x0;_0x1c5ebe<_0x490cea[_0xf0ca('0x38')];_0x1c5ebe+=0x1){var _0x13509b=_0x490cea[_0x1c5ebe][_0xf0ca('0x23')]({'plain':!![]});_0x5afcce[_0xf0ca('0x66')]=_0x66af2e[_0xf0ca('0x54')][_0xf0ca('0x66')]?_0x66af2e[_0xf0ca('0x54')][_0xf0ca('0x66')]:_0x5afcce[_0xf0ca('0x66')];switch(_0x5afcce[_0xf0ca('0x66')]){case'always':_0x102c88=squel[_0xf0ca('0x67')]()['into'](_0xf0ca('0x68'))[_0xf0ca('0x69')]([_0xf0ca('0x6a'),_0xf0ca('0x6b'),_0xf0ca('0x6c'),'ListId','CampaignId',_0xf0ca('0x55'),_0xf0ca('0x53')],squel[_0xf0ca('0x6d')]()[_0xf0ca('0x6e')](_0xf0ca('0x6a'),'phone')[_0xf0ca('0x6e')]('NOW()',_0xf0ca('0x6b'))[_0xf0ca('0x6e')]('id','ContactId')[_0xf0ca('0x6e')](_0x13509b[_0xf0ca('0x6f')]['toString'](),_0xf0ca('0x70'))[_0xf0ca('0x6e')](_0x66af2e[_0xf0ca('0x45')]['id'][_0xf0ca('0x71')](),'CampaignId')[_0xf0ca('0x6e')]('\x27'+_0x250364+'\x27',_0xf0ca('0x55'))[_0xf0ca('0x6e')]('\x27'+_0x250364+'\x27',_0xf0ca('0x53'))[_0xf0ca('0x72')]('cm_contacts')[_0xf0ca('0x3c')](_0xf0ca('0x73'))[_0xf0ca('0x3c')]('ListId\x20=\x20?',_0x13509b[_0xf0ca('0x6f')][_0xf0ca('0x71')]())['where'](_0xf0ca('0x74'))['where'](_0xf0ca('0x75'),squel['select']()[_0xf0ca('0x6e')](_0xf0ca('0x76'))[_0xf0ca('0x72')](_0xf0ca('0x77'))[_0xf0ca('0x3c')](_0xf0ca('0x78'),_0x66af2e[_0xf0ca('0x45')]['id'][_0xf0ca('0x71')]()))[_0xf0ca('0x3c')](_0xf0ca('0x75'),squel['select']()[_0xf0ca('0x6e')](_0xf0ca('0x79'))[_0xf0ca('0x72')](_0xf0ca('0x68'))['where'](_0xf0ca('0x78'),_0x66af2e['params']['id']['toString']())))[_0xf0ca('0x71')]();break;case'onlyIfOpen':_0x102c88=squel[_0xf0ca('0x67')]()[_0xf0ca('0x7a')](_0xf0ca('0x68'))[_0xf0ca('0x69')](['phone',_0xf0ca('0x6b'),_0xf0ca('0x6c'),_0xf0ca('0x70'),'CampaignId','createdAt',_0xf0ca('0x53')],squel[_0xf0ca('0x6d')]()[_0xf0ca('0x6e')](_0xf0ca('0x6a'),_0xf0ca('0x6a'))[_0xf0ca('0x6e')](_0xf0ca('0x7b'),'scheduledAt')[_0xf0ca('0x6e')]('id',_0xf0ca('0x6c'))['field'](_0x13509b[_0xf0ca('0x6f')]['toString'](),_0xf0ca('0x70'))['field'](_0x66af2e[_0xf0ca('0x45')]['id'][_0xf0ca('0x71')](),_0xf0ca('0x59'))['field']('\x27'+_0x250364+'\x27','createdAt')['field']('\x27'+_0x250364+'\x27',_0xf0ca('0x53'))['from']('cm_contacts')[_0xf0ca('0x3c')]('deletedAt\x20IS\x20NULL')[_0xf0ca('0x3c')](_0xf0ca('0x7c'),_0x13509b[_0xf0ca('0x6f')][_0xf0ca('0x71')]())[_0xf0ca('0x3c')](_0xf0ca('0x74'))[_0xf0ca('0x3c')](_0xf0ca('0x75'),squel['select']()['field'](_0xf0ca('0x79'))[_0xf0ca('0x72')](_0xf0ca('0x68'))[_0xf0ca('0x3c')](_0xf0ca('0x78'),_0x66af2e['params']['id'][_0xf0ca('0x71')]())))[_0xf0ca('0x71')]();break;default:_0x102c88=squel['insert']()['into']('cm_hopper')[_0xf0ca('0x69')](['phone',_0xf0ca('0x6b'),_0xf0ca('0x6c'),_0xf0ca('0x70'),'CampaignId','createdAt','updatedAt'],squel[_0xf0ca('0x6d')]()[_0xf0ca('0x6e')](_0xf0ca('0x6a'),_0xf0ca('0x6a'))[_0xf0ca('0x6e')](_0xf0ca('0x7b'),_0xf0ca('0x6b'))[_0xf0ca('0x6e')]('id',_0xf0ca('0x6c'))[_0xf0ca('0x6e')](_0x13509b[_0xf0ca('0x6f')][_0xf0ca('0x71')](),'ListId')[_0xf0ca('0x6e')](_0x66af2e[_0xf0ca('0x45')]['id'][_0xf0ca('0x71')](),_0xf0ca('0x59'))['field']('\x27'+_0x250364+'\x27',_0xf0ca('0x55'))[_0xf0ca('0x6e')]('\x27'+_0x250364+'\x27',_0xf0ca('0x53'))[_0xf0ca('0x72')](_0xf0ca('0x7d'))[_0xf0ca('0x3c')]('deletedAt\x20IS\x20NULL')[_0xf0ca('0x3c')](_0xf0ca('0x7c'),_0x13509b[_0xf0ca('0x6f')]['toString']())[_0xf0ca('0x3c')](_0xf0ca('0x74')))[_0xf0ca('0x71')]();}_0x493e4f=squel[_0xf0ca('0x67')]()[_0xf0ca('0x7a')](_0xf0ca('0x7e'))[_0xf0ca('0x69')]([_0xf0ca('0x7f'),_0xf0ca('0x6b'),_0xf0ca('0x6a'),_0xf0ca('0x80'),_0xf0ca('0x55'),_0xf0ca('0x53')],squel['select']()[_0xf0ca('0x6e')](_0xf0ca('0x81'),'id')[_0xf0ca('0x6e')](_0xf0ca('0x7b'),'scheduledAt')[_0xf0ca('0x6e')](_0xf0ca('0x82'),'phone')[_0xf0ca('0x6e')](_0xf0ca('0x83'),'OrderBy')['field']('\x27'+_0x250364+'\x27','createdAt')[_0xf0ca('0x6e')]('\x27'+_0x250364+'\x27',_0xf0ca('0x53'))['from'](_0xf0ca('0x84'),'ci')[_0xf0ca('0x85')](_0xf0ca('0x68'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xf0ca('0x3c')]('h.ListId\x20=\x20?',_0x13509b['CmListId'][_0xf0ca('0x71')]())[_0xf0ca('0x3c')](_0xf0ca('0x86'),_0x66af2e[_0xf0ca('0x45')]['id'][_0xf0ca('0x71')]())[_0xf0ca('0x3c')]('h.createdAt\x20=\x20?',_0x250364))['toString']();_0x2d424b[_0xf0ca('0x87')](db[_0xf0ca('0x88')]['query'](_0x102c88));_0x2a17f4[_0xf0ca('0x87')](db[_0xf0ca('0x88')][_0xf0ca('0x32')](_0x493e4f));}return BPromise[_0xf0ca('0x89')](_0x2d424b);}})[_0xf0ca('0x22')](function(){return BPromise[_0xf0ca('0x89')](_0x2a17f4);})[_0xf0ca('0x22')](function(){return _0x19961d;})[_0xf0ca('0x22')](respondWithResult(_0x6e938c,null))[_0xf0ca('0x43')](handleError(_0x6e938c,null));};exports['removeLists']=function(_0x2b75ca,_0x464fe9,_0x448eba){return db[_0xf0ca('0x2c')][_0xf0ca('0x47')]({'where':{'id':_0x2b75ca[_0xf0ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x464fe9,null))[_0xf0ca('0x22')](function(_0x4a57d0){if(_0x4a57d0){return _0x4a57d0[_0xf0ca('0x8a')](_0x2b75ca[_0xf0ca('0x32')][_0xf0ca('0x64')]);}})[_0xf0ca('0x22')](function(_0x5b66ec){if(_0x5b66ec){return db[_0xf0ca('0x57')][_0xf0ca('0x26')]({'where':{'ListId':_0x2b75ca[_0xf0ca('0x32')][_0xf0ca('0x64')],'CampaignId':_0x2b75ca['params']['id']}})[_0xf0ca('0x22')](function(){return _0x5b66ec;});}})[_0xf0ca('0x22')](respondWithStatusCode(_0x464fe9,null))[_0xf0ca('0x43')](handleError(_0x464fe9,null));};exports[_0xf0ca('0x8b')]=function(_0x17cbf8,_0x5cf69b,_0x2f4a49){var _0x4a4ef4={};var _0x4ffcfe={};var _0x17c3c0;var _0x42ab24;return db[_0xf0ca('0x2c')][_0xf0ca('0x56')]({'where':{'id':_0x17cbf8[_0xf0ca('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cf69b,null))[_0xf0ca('0x22')](function(_0x29f978){if(_0x29f978){_0x17c3c0=_0x29f978;_0x4ffcfe[_0xf0ca('0x31')]=_['keys'](db[_0xf0ca('0x61')]['rawAttributes']);_0x4ffcfe[_0xf0ca('0x32')]=_['keys'](_0x17cbf8['query']);_0x4ffcfe['filters']=_[_0xf0ca('0x36')](_0x4ffcfe[_0xf0ca('0x31')],_0x4ffcfe['query']);_0x4a4ef4[_0xf0ca('0x35')]=_['intersection'](_0x4ffcfe['model'],qs[_0xf0ca('0x37')](_0x17cbf8[_0xf0ca('0x32')][_0xf0ca('0x37')]));_0x4a4ef4['attributes']=_0x4a4ef4[_0xf0ca('0x35')][_0xf0ca('0x38')]?_0x4a4ef4[_0xf0ca('0x35')]:_0x4ffcfe[_0xf0ca('0x31')];_0x4a4ef4['order']=qs[_0xf0ca('0x3b')](_0x17cbf8['query'][_0xf0ca('0x3b')]);_0x4a4ef4['where']=qs[_0xf0ca('0x34')](_[_0xf0ca('0x3d')](_0x17cbf8['query'],_0x4ffcfe[_0xf0ca('0x34')]));if(_0x17cbf8['query'][_0xf0ca('0x3f')]){_0x4a4ef4[_0xf0ca('0x3c')]=_[_0xf0ca('0x3e')](_0x4a4ef4['where'],{'$or':_[_0xf0ca('0x2b')](_0x4a4ef4[_0xf0ca('0x35')],function(_0x5493be){var _0x196ba5={};_0x196ba5[_0x5493be]={'$like':'%'+_0x17cbf8[_0xf0ca('0x32')][_0xf0ca('0x3f')]+'%'};return _0x196ba5;})});}_0x4a4ef4=_[_0xf0ca('0x3e')]({},_0x4a4ef4,_0x17cbf8['options']);return _0x17c3c0[_0xf0ca('0x8b')](_0x4a4ef4);}})[_0xf0ca('0x22')](function(_0x233dbe){if(_0x233dbe){_0x42ab24=_0x233dbe[_0xf0ca('0x38')];if(!_0x17cbf8['query'][_0xf0ca('0x58')](_0xf0ca('0x39'))){_0x4a4ef4[_0xf0ca('0x1b')]=qs['limit'](_0x17cbf8[_0xf0ca('0x32')][_0xf0ca('0x1b')]);_0x4a4ef4['offset']=qs[_0xf0ca('0x18')](_0x17cbf8[_0xf0ca('0x32')][_0xf0ca('0x18')]);}return _0x17c3c0[_0xf0ca('0x8b')](_0x4a4ef4);}})['then'](function(_0x26c9e8){if(_0x26c9e8){return _0x26c9e8?{'count':_0x42ab24,'rows':_0x26c9e8}:null;}})['then'](respondWithResult(_0x5cf69b,null))[_0xf0ca('0x43')](handleError(_0x5cf69b,null));};exports[_0xf0ca('0x8c')]=function(_0x4d1b65,_0x15ea66,_0x1b14aa){var _0x187225,_0x2c67aa;var _0x3815b3=[];var _0x374584=moment()['format'](_0xf0ca('0x8d'));return db[_0xf0ca('0x2c')][_0xf0ca('0x47')]({'where':{'id':_0x4d1b65[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x15ea66,null))[_0xf0ca('0x22')](function(_0x308b2e){if(_0x308b2e){_0x2c67aa=_0x308b2e;return _0x308b2e[_0xf0ca('0x8c')](_0x4d1b65[_0xf0ca('0x54')][_0xf0ca('0x64')],_[_0xf0ca('0x52')](_0x4d1b65[_0xf0ca('0x54')],[_0xf0ca('0x64'),'id'])||{});}return null;})[_0xf0ca('0x65')](function(_0x418cc8){var _0x4547cb;var _0x13fb79;_0x187225=_0x418cc8||[];var _0x12aeda=[];if(_0x418cc8){for(var _0x354fd0=0x0;_0x354fd0<_0x418cc8[_0xf0ca('0x38')];_0x354fd0+=0x1){var _0x43ec88=_0x418cc8[_0x354fd0][_0xf0ca('0x23')]({'plain':!![]});_0x4547cb=squel[_0xf0ca('0x67')]()[_0xf0ca('0x7a')]('cm_hopper_black')[_0xf0ca('0x69')]([_0xf0ca('0x6a'),'ContactId',_0xf0ca('0x70'),_0xf0ca('0x59'),'createdAt',_0xf0ca('0x53')],squel[_0xf0ca('0x6d')]()[_0xf0ca('0x6e')](_0xf0ca('0x6a'),_0xf0ca('0x6a'))[_0xf0ca('0x6e')]('id','ContactId')[_0xf0ca('0x6e')](_0x43ec88['CmListId'][_0xf0ca('0x71')](),_0xf0ca('0x70'))[_0xf0ca('0x6e')](_0x4d1b65['params']['id'][_0xf0ca('0x71')](),'CampaignId')['field'](_0xf0ca('0x7b'),_0xf0ca('0x55'))[_0xf0ca('0x6e')](_0xf0ca('0x7b'),_0xf0ca('0x53'))[_0xf0ca('0x72')]('cm_contacts')[_0xf0ca('0x3c')](_0xf0ca('0x73'))[_0xf0ca('0x3c')]('ListId\x20=\x20?',_0x43ec88[_0xf0ca('0x6f')]['toString']())[_0xf0ca('0x3c')](_0xf0ca('0x74')))[_0xf0ca('0x71')]();_0x12aeda[_0xf0ca('0x87')](db[_0xf0ca('0x88')][_0xf0ca('0x32')](_0x4547cb));}return BPromise['all'](_0x12aeda);}})['then'](function(){return _0x187225;})[_0xf0ca('0x22')](respondWithResult(_0x15ea66,null))['catch'](handleError(_0x15ea66,null));};exports[_0xf0ca('0x8e')]=function(_0x721b5a,_0x851baf,_0x928c8e){return db['Campaign'][_0xf0ca('0x47')]({'where':{'id':_0x721b5a[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](handleEntityNotFound(_0x851baf,null))[_0xf0ca('0x22')](function(_0x57c9d2){if(_0x57c9d2){return _0x57c9d2[_0xf0ca('0x8e')](_0x721b5a[_0xf0ca('0x32')]['ids']);}})[_0xf0ca('0x22')](function(_0x12b29d){if(_0x12b29d){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x721b5a[_0xf0ca('0x32')]['ids'],'CampaignId':_0x721b5a[_0xf0ca('0x45')]['id']}})[_0xf0ca('0x22')](function(){return _0x12b29d;});}})[_0xf0ca('0x22')](respondWithStatusCode(_0x851baf,null))[_0xf0ca('0x43')](handleError(_0x851baf,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 42dcfe7..4b71c6a 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 287c35a..f3970ac 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf194=['GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x5dda34,_0x4547c3){var _0x40ba81=function(_0x56820a){while(--_0x56820a){_0x5dda34['push'](_0x5dda34['shift']());}};_0x40ba81(++_0x4547c3);}(_0xf194,0x91));var _0x4f19=function(_0x4bb90c,_0x243ad5){_0x4bb90c=_0x4bb90c-0x0;var _0x14f765=_0xf194[_0x4bb90c];return _0x14f765;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f19('0x5'));var config=require(_0x4f19('0x6'));var jayson=require(_0x4f19('0x7'));var client=jayson['client'][_0x4f19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c88a,_0x514d93,_0x4b023f){return new BPromise(function(_0x265d15,_0x116780){return client[_0x4f19('0x9')](_0x45c88a,_0x4b023f)[_0x4f19('0xa')](function(_0x4aaf89){logger[_0x4f19('0xb')](_0x4f19('0xc'),_0x514d93,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x514d93,_0x4f19('0xd'),JSON['stringify'](_0x4aaf89));if(_0x4aaf89['error']){if(_0x4aaf89['error'][_0x4f19('0x10')]===0x1f4){logger[_0x4f19('0x11')]('Campaign,\x20%s,\x20%s',_0x514d93,_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);return _0x116780(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}logger['error'](_0x4f19('0xc'),_0x514d93,_0x4aaf89[_0x4f19('0x11')]['message']);return _0x265d15(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}else{logger['info'](_0x4f19('0xc'),_0x514d93,'request\x20sent');_0x265d15(_0x4aaf89[_0x4f19('0x13')][_0x4f19('0x12')]);}})['catch'](function(_0x4d8021){logger[_0x4f19('0x11')](_0x4f19('0xc'),_0x514d93,_0x4d8021);_0x116780(_0x4d8021);});});}exports[_0x4f19('0x14')]=function(_0x576eef){var _0x1d9bf3=this;return new Promise(function(_0x205fee,_0x1b4d79){return db[_0x4f19('0x15')][_0x4f19('0x16')]({'raw':_0x576eef['options']?_0x576eef[_0x4f19('0x17')][_0x4f19('0x18')]===undefined?!![]:![]:!![],'where':_0x576eef['options']?_0x576eef[_0x4f19('0x17')][_0x4f19('0x19')]||null:null,'attributes':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')]['attributes']||null:null,'limit':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')][_0x4f19('0x1a')]||null:null,'include':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')][_0x4f19('0x1b')]?_[_0x4f19('0x1c')](_0x576eef[_0x4f19('0x17')][_0x4f19('0x1b')],function(_0x10e164){return{'model':db[_0x10e164[_0x4f19('0x1d')]],'as':_0x10e164['as'],'attributes':_0x10e164[_0x4f19('0x1e')],'include':_0x10e164[_0x4f19('0x1b')]?_[_0x4f19('0x1c')](_0x10e164[_0x4f19('0x1b')],function(_0x39cb12){return{'model':db[_0x39cb12[_0x4f19('0x1d')]],'as':_0x39cb12['as'],'attributes':_0x39cb12[_0x4f19('0x1e')],'include':_0x39cb12[_0x4f19('0x1b')]?_['map'](_0x39cb12[_0x4f19('0x1b')],function(_0x5218c6){return{'model':db[_0x5218c6[_0x4f19('0x1d')]],'as':_0x5218c6['as'],'attributes':_0x5218c6['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f19('0xa')](function(_0x5321a8){logger[_0x4f19('0xb')](_0x4f19('0x14'),_0x576eef);logger[_0x4f19('0xe')]('GetCampaign',_0x576eef,JSON[_0x4f19('0x1f')](_0x5321a8));_0x205fee(_0x5321a8);})[_0x4f19('0x20')](function(_0x2175ff){logger[_0x4f19('0x11')](_0x4f19('0x14'),_0x2175ff['message'],_0x576eef);_0x1b4d79(_0x1d9bf3[_0x4f19('0x11')](0x1f4,_0x2175ff[_0x4f19('0x12')]));});});}; \ No newline at end of file +var _0xae7b=['debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','options','raw','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x172a3b,_0x308d3b){var _0x1d3dc0=function(_0x2dff8a){while(--_0x2dff8a){_0x172a3b['push'](_0x172a3b['shift']());}};_0x1d3dc0(++_0x308d3b);}(_0xae7b,0xbe));var _0xbae7=function(_0x920ae3,_0x4652ef){_0x920ae3=_0x920ae3-0x0;var _0x19ea79=_0xae7b[_0x920ae3];return _0x19ea79;};'use strict';var _=require(_0xbae7('0x0'));var util=require(_0xbae7('0x1'));var moment=require(_0xbae7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbae7('0x3'));var db=require(_0xbae7('0x4'))['db'];var utils=require(_0xbae7('0x5'));var logger=require(_0xbae7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbae7('0x7'));var client=jayson[_0xbae7('0x8')][_0xbae7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56c84c,_0x429316,_0x539635){return new BPromise(function(_0x228a90,_0x319b0b){return client[_0xbae7('0xa')](_0x56c84c,_0x539635)['then'](function(_0x1b4162){logger['info'](_0xbae7('0xb'),_0x429316,_0xbae7('0xc'));logger[_0xbae7('0xd')](_0xbae7('0xe'),_0x429316,'request\x20sent',JSON[_0xbae7('0xf')](_0x1b4162));if(_0x1b4162[_0xbae7('0x10')]){if(_0x1b4162['error'][_0xbae7('0x11')]===0x1f4){logger['error'](_0xbae7('0xb'),_0x429316,_0x1b4162[_0xbae7('0x10')]['message']);return _0x319b0b(_0x1b4162['error'][_0xbae7('0x12')]);}logger[_0xbae7('0x10')](_0xbae7('0xb'),_0x429316,_0x1b4162[_0xbae7('0x10')]['message']);return _0x228a90(_0x1b4162[_0xbae7('0x10')]['message']);}else{logger['info'](_0xbae7('0xb'),_0x429316,_0xbae7('0xc'));_0x228a90(_0x1b4162[_0xbae7('0x13')][_0xbae7('0x12')]);}})[_0xbae7('0x14')](function(_0x2d41e4){logger['error'](_0xbae7('0xb'),_0x429316,_0x2d41e4);_0x319b0b(_0x2d41e4);});});}exports[_0xbae7('0x15')]=function(_0x99d88){var _0x2cb970=this;return new Promise(function(_0x1fc9fb,_0x4fddf6){return db['Campaign']['findAll']({'raw':_0x99d88[_0xbae7('0x16')]?_0x99d88[_0xbae7('0x16')][_0xbae7('0x17')]===undefined?!![]:![]:!![],'where':_0x99d88[_0xbae7('0x16')]?_0x99d88[_0xbae7('0x16')]['where']||null:null,'attributes':_0x99d88[_0xbae7('0x16')]?_0x99d88[_0xbae7('0x16')][_0xbae7('0x18')]||null:null,'limit':_0x99d88[_0xbae7('0x16')]?_0x99d88[_0xbae7('0x16')][_0xbae7('0x19')]||null:null,'include':_0x99d88[_0xbae7('0x16')]?_0x99d88[_0xbae7('0x16')][_0xbae7('0x1a')]?_[_0xbae7('0x1b')](_0x99d88[_0xbae7('0x16')][_0xbae7('0x1a')],function(_0x32f8eb){return{'model':db[_0x32f8eb['model']],'as':_0x32f8eb['as'],'attributes':_0x32f8eb['attributes'],'include':_0x32f8eb[_0xbae7('0x1a')]?_[_0xbae7('0x1b')](_0x32f8eb[_0xbae7('0x1a')],function(_0x375df5){return{'model':db[_0x375df5[_0xbae7('0x1c')]],'as':_0x375df5['as'],'attributes':_0x375df5[_0xbae7('0x18')],'include':_0x375df5[_0xbae7('0x1a')]?_[_0xbae7('0x1b')](_0x375df5[_0xbae7('0x1a')],function(_0x3e104e){return{'model':db[_0x3e104e[_0xbae7('0x1c')]],'as':_0x3e104e['as'],'attributes':_0x3e104e[_0xbae7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5865f4){logger['info'](_0xbae7('0x15'),_0x99d88);logger[_0xbae7('0xd')](_0xbae7('0x15'),_0x99d88,JSON[_0xbae7('0xf')](_0x5865f4));_0x1fc9fb(_0x5865f4);})[_0xbae7('0x14')](function(_0x2d8202){logger['error']('GetCampaign',_0x2d8202[_0xbae7('0x12')],_0x99d88);_0x4fddf6(_0x2cb970[_0xbae7('0x10')](0x1f4,_0x2d8202[_0xbae7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f801863..a128b84 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2054=['post','/:id/clone','clone','addBlackLists','put','update','delete','/:id/lists','removeLists','removeBlackLists','multer','express','Router','fs-extra','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists'];(function(_0x5d8048,_0x445203){var _0x3affba=function(_0x5e65c4){while(--_0x5e65c4){_0x5d8048['push'](_0x5d8048['shift']());}};_0x3affba(++_0x445203);}(_0x2054,0x176));var _0x4205=function(_0x5054da,_0x217daf){_0x5054da=_0x5054da-0x0;var _0x76c47b=_0x2054[_0x5054da];return _0x76c47b;};'use strict';var multer=require(_0x4205('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4205('0x1'));var router=express[_0x4205('0x2')]();var fs_extra=require(_0x4205('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4205('0x4'));router[_0x4205('0x5')]('/',auth[_0x4205('0x6')](),controller[_0x4205('0x7')]);router['get'](_0x4205('0x8'),auth['isAuthenticated'](),controller[_0x4205('0x9')]);router[_0x4205('0x5')](_0x4205('0xa'),auth[_0x4205('0x6')](),controller[_0x4205('0xb')]);router[_0x4205('0x5')](_0x4205('0xc'),auth[_0x4205('0x6')](),controller[_0x4205('0xd')]);router[_0x4205('0x5')](_0x4205('0xe'),auth[_0x4205('0x6')](),controller['getHopperFinals']);router['get'](_0x4205('0xf'),auth[_0x4205('0x6')](),controller['getHopperBlacks']);router[_0x4205('0x5')]('/:id/lists',auth[_0x4205('0x6')](),controller[_0x4205('0x10')]);router['get'](_0x4205('0x11'),auth[_0x4205('0x6')](),controller['getBlackLists']);router['post']('/',auth[_0x4205('0x6')](),controller['create']);router[_0x4205('0x12')](_0x4205('0x13'),auth[_0x4205('0x6')](),controller[_0x4205('0x14')]);router[_0x4205('0x12')]('/:id/lists',auth[_0x4205('0x6')](),controller['addLists']);router[_0x4205('0x12')](_0x4205('0x11'),auth['isAuthenticated'](),controller[_0x4205('0x15')]);router[_0x4205('0x16')]('/:id',auth[_0x4205('0x6')](),controller[_0x4205('0x17')]);router[_0x4205('0x18')](_0x4205('0x8'),auth[_0x4205('0x6')](),controller['destroy']);router[_0x4205('0x18')](_0x4205('0x19'),auth[_0x4205('0x6')](),controller[_0x4205('0x1a')]);router[_0x4205('0x18')](_0x4205('0x11'),auth['isAuthenticated'](),controller[_0x4205('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5223=['/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5223,0x11f));var _0x3522=function(_0x342ece,_0x4c20d2){_0x342ece=_0x342ece-0x0;var _0xd20245=_0x5223[_0x342ece];return _0xd20245;};'use strict';var multer=require('multer');var util=require(_0x3522('0x0'));var path=require(_0x3522('0x1'));var timeout=require(_0x3522('0x2'));var express=require('express');var router=express[_0x3522('0x3')]();var fs_extra=require(_0x3522('0x4'));var auth=require(_0x3522('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3522('0x6'));router[_0x3522('0x7')]('/',auth[_0x3522('0x8')](),controller[_0x3522('0x9')]);router['get']('/:id',auth[_0x3522('0x8')](),controller[_0x3522('0xa')]);router[_0x3522('0x7')](_0x3522('0xb'),auth['isAuthenticated'](),controller[_0x3522('0xc')]);router[_0x3522('0x7')]('/:id/hopper_histories',auth[_0x3522('0x8')](),controller['getHopperHistories']);router[_0x3522('0x7')](_0x3522('0xd'),auth[_0x3522('0x8')](),controller[_0x3522('0xe')]);router['get'](_0x3522('0xf'),auth[_0x3522('0x8')](),controller[_0x3522('0x10')]);router[_0x3522('0x7')](_0x3522('0x11'),auth[_0x3522('0x8')](),controller[_0x3522('0x12')]);router[_0x3522('0x7')](_0x3522('0x13'),auth[_0x3522('0x8')](),controller[_0x3522('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3522('0x15')]);router[_0x3522('0x16')](_0x3522('0x17'),auth['isAuthenticated'](),controller[_0x3522('0x18')]);router['post'](_0x3522('0x11'),auth[_0x3522('0x8')](),controller[_0x3522('0x19')]);router[_0x3522('0x16')](_0x3522('0x13'),auth[_0x3522('0x8')](),controller[_0x3522('0x1a')]);router[_0x3522('0x1b')]('/:id',auth[_0x3522('0x8')](),controller[_0x3522('0x1c')]);router[_0x3522('0x1d')]('/:id',auth[_0x3522('0x8')](),controller[_0x3522('0x1e')]);router[_0x3522('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller[_0x3522('0x1f')]);router[_0x3522('0x1d')](_0x3522('0x13'),auth['isAuthenticated'](),controller[_0x3522('0x20')]);module[_0x3522('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 535297b..4ead858 100644 --- a/server/api/cannedAnswer/cannedAnswer.attributes.js +++ b/server/api/cannedAnswer/cannedAnswer.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a5b=['exports','STRING','TEXT','getDataValue','sequelize'];(function(_0x38674e,_0x170f1e){var _0x282a8a=function(_0x308ade){while(--_0x308ade){_0x38674e['push'](_0x38674e['shift']());}};_0x282a8a(++_0x170f1e);}(_0x3a5b,0xb3));var _0xb3a5=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x3a5b[_0x25d2fb];return _0x1ded53;};'use strict';var Sequelize=require(_0xb3a5('0x0'));module[_0xb3a5('0x1')]={'key':{'type':Sequelize[_0xb3a5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb3a5('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb3a5('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb3a5('0x4')]('key');}}}; \ No newline at end of file +var _0x3b0d=['VIRTUAL','key','sequelize','exports','STRING'];(function(_0x1237b5,_0x4786ad){var _0x5a2b68=function(_0x369986){while(--_0x369986){_0x1237b5['push'](_0x1237b5['shift']());}};_0x5a2b68(++_0x4786ad);}(_0x3b0d,0x1d3));var _0xd3b0=function(_0x1e8398,_0x58480e){_0x1e8398=_0x1e8398-0x0;var _0xc67b1a=_0x3b0d[_0x1e8398];return _0xc67b1a;};'use strict';var Sequelize=require(_0xd3b0('0x0'));module[_0xd3b0('0x1')]={'key':{'type':Sequelize[_0xd3b0('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xd3b0('0x2')]},'name':{'type':Sequelize[_0xd3b0('0x3')],'get':function(){return this['getDataValue'](_0xd3b0('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 61079f2..f829b7a 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4984=['includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','index','CannedAnswer','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options'];(function(_0x43fa17,_0x498bc8){var _0x24aafe=function(_0x3cf9e8){while(--_0x3cf9e8){_0x43fa17['push'](_0x43fa17['shift']());}};_0x24aafe(++_0x498bc8);}(_0x4984,0x174));var _0x4498=function(_0x3f8162,_0x5b8808){_0x3f8162=_0x3f8162-0x0;var _0xe80afb=_0x4984[_0x3f8162];return _0xe80afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4498('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4498('0x1'));var rp=require('request-promise');var moment=require(_0x4498('0x2'));var BPromise=require(_0x4498('0x3'));var Mustache=require('mustache');var util=require(_0x4498('0x4'));var path=require('path');var sox=require(_0x4498('0x5'));var csv=require(_0x4498('0x6'));var ejs=require(_0x4498('0x7'));var fs=require('fs');var fs_extra=require(_0x4498('0x8'));var _=require(_0x4498('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4498('0xa'));var deskjs=require(_0x4498('0xb'));var toCsv=require(_0x4498('0x6'));var querystring=require(_0x4498('0xc'));var Papa=require(_0x4498('0xd'));var Redis=require(_0x4498('0xe'));var authService=require(_0x4498('0xf'));var qs=require(_0x4498('0x10'));var as=require(_0x4498('0x11'));var hardwareService=require(_0x4498('0x12'));var logger=require(_0x4498('0x13'))('api');var utils=require(_0x4498('0x14'));var config=require(_0x4498('0x15'));var licenseUtil=require(_0x4498('0x16'));var db=require(_0x4498('0x17'))['db'];function respondWithStatusCode(_0x407c52,_0x538ee9){_0x538ee9=_0x538ee9||0xcc;return function(_0x225fbd){if(_0x225fbd){return _0x407c52[_0x4498('0x18')](_0x538ee9);}return _0x407c52[_0x4498('0x19')](_0x538ee9)[_0x4498('0x1a')]();};}function respondWithResult(_0x5d4dcf,_0xa46acc){_0xa46acc=_0xa46acc||0xc8;return function(_0x37e341){if(_0x37e341){return _0x5d4dcf['status'](_0xa46acc)[_0x4498('0x1b')](_0x37e341);}};}function respondWithFilteredResult(_0x6cafb2,_0x3cb446){return function(_0x48e98f){if(_0x48e98f){var _0x34a6ef=typeof _0x3cb446[_0x4498('0x1c')]===_0x4498('0x1d')&&typeof _0x3cb446[_0x4498('0x1e')]===_0x4498('0x1d');var _0x29a5be=_0x48e98f['count'];var _0x240cfe=_0x34a6ef?0x0:_0x3cb446[_0x4498('0x1c')];var _0xff2aed=_0x34a6ef?_0x48e98f[_0x4498('0x1f')]:_0x3cb446[_0x4498('0x1c')]+_0x3cb446[_0x4498('0x1e')];var _0x492552;if(_0xff2aed>=_0x29a5be){_0xff2aed=_0x29a5be;_0x492552=0xc8;}else{_0x492552=0xce;}_0x6cafb2[_0x4498('0x19')](_0x492552);return _0x6cafb2['set'](_0x4498('0x20'),_0x240cfe+'-'+_0xff2aed+'/'+_0x29a5be)[_0x4498('0x1b')](_0x48e98f);}return null;};}function patchUpdates(_0x2d29cd){return function(_0x209ecb){try{jsonpatch[_0x4498('0x21')](_0x209ecb,_0x2d29cd,!![]);}catch(_0x354c5c){return BPromise['reject'](_0x354c5c);}return _0x209ecb[_0x4498('0x22')]();};}function saveUpdates(_0x501ac7,_0x383997){return function(_0x13c9be){if(_0x13c9be){return _0x13c9be[_0x4498('0x23')](_0x501ac7)[_0x4498('0x24')](function(_0x4d36a9){return _0x4d36a9;});}return null;};}function removeEntity(_0x485e1a,_0x2aa359){return function(_0x357953){if(_0x357953){return _0x357953[_0x4498('0x25')]()[_0x4498('0x24')](function(){var _0x106f8c=_0x357953[_0x4498('0x26')]({'plain':!![]});var _0x4807a9=_0x4498('0x27');return db[_0x4498('0x28')][_0x4498('0x25')]({'where':{'type':_0x4807a9,'resourceId':_0x106f8c['id']}})[_0x4498('0x24')](function(){return _0x357953;});})[_0x4498('0x24')](function(){_0x485e1a[_0x4498('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62d6d1,_0x43ed90){return function(_0x5e7e86){if(!_0x5e7e86){_0x62d6d1[_0x4498('0x18')](0x194);}return _0x5e7e86;};}function handleError(_0x13b0d5,_0x255ea5){_0x255ea5=_0x255ea5||0x1f4;return function(_0x1982be){logger['error'](_0x1982be[_0x4498('0x29')]);if(_0x1982be[_0x4498('0x2a')]){delete _0x1982be[_0x4498('0x2a')];}_0x13b0d5[_0x4498('0x19')](_0x255ea5)[_0x4498('0x2b')](_0x1982be);};}exports[_0x4498('0x2c')]=function(_0x37c588,_0x98823e){var _0x8e18a5={},_0x15e9ab={},_0x5047cd={'count':0x0,'rows':[]};var _0x2b9f19=_['map'](db[_0x4498('0x2d')]['rawAttributes'],function(_0x21ed2f){return{'name':_0x21ed2f[_0x4498('0x2e')],'type':_0x21ed2f[_0x4498('0x2f')][_0x4498('0x30')]};});_0x15e9ab['model']=_['map'](_0x2b9f19,_0x4498('0x2a'));_0x15e9ab[_0x4498('0x31')]=_['keys'](_0x37c588['query']);_0x15e9ab['filters']=_[_0x4498('0x32')](_0x15e9ab['model'],_0x15e9ab[_0x4498('0x31')]);_0x8e18a5[_0x4498('0x33')]=_[_0x4498('0x32')](_0x15e9ab[_0x4498('0x34')],qs[_0x4498('0x35')](_0x37c588[_0x4498('0x31')][_0x4498('0x35')]));_0x8e18a5['attributes']=_0x8e18a5[_0x4498('0x33')][_0x4498('0x36')]?_0x8e18a5[_0x4498('0x33')]:_0x15e9ab['model'];if(!_0x37c588[_0x4498('0x31')][_0x4498('0x37')]('nolimit')){_0x8e18a5[_0x4498('0x1e')]=qs[_0x4498('0x1e')](_0x37c588['query'][_0x4498('0x1e')]);_0x8e18a5[_0x4498('0x1c')]=qs[_0x4498('0x1c')](_0x37c588[_0x4498('0x31')][_0x4498('0x1c')]);}_0x8e18a5['order']=qs['sort'](_0x37c588[_0x4498('0x31')][_0x4498('0x38')]);_0x8e18a5[_0x4498('0x39')]=qs[_0x4498('0x3a')](_[_0x4498('0x3b')](_0x37c588[_0x4498('0x31')],_0x15e9ab[_0x4498('0x3a')]),_0x2b9f19);if(_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]){_0x8e18a5['where']=_[_0x4498('0x3d')](_0x8e18a5[_0x4498('0x39')],{'$or':[{'key':{'$like':'%'+_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]+'%'}},{'value':{'$like':'%'+_0x37c588[_0x4498('0x31')][_0x4498('0x3c')]+'%'}}]});}_0x8e18a5=_['merge']({},_0x8e18a5,_0x37c588[_0x4498('0x3e')]);var _0x4bdbb3={'where':_0x8e18a5[_0x4498('0x39')]};return db['CannedAnswer']['count'](_0x4bdbb3)[_0x4498('0x24')](function(_0x1825aa){_0x5047cd[_0x4498('0x1f')]=_0x1825aa;if(_0x37c588[_0x4498('0x31')][_0x4498('0x3f')]){_0x8e18a5[_0x4498('0x40')]=[{'all':!![]}];}return db[_0x4498('0x2d')][_0x4498('0x41')](_0x8e18a5);})[_0x4498('0x24')](function(_0x31d07c){_0x5047cd[_0x4498('0x42')]=_0x31d07c;return _0x5047cd;})[_0x4498('0x24')](respondWithFilteredResult(_0x98823e,_0x8e18a5))[_0x4498('0x43')](handleError(_0x98823e,null));};exports[_0x4498('0x44')]=function(_0x486aaa,_0x5ef1df){var _0x5a095d={'raw':!![],'where':{'id':_0x486aaa[_0x4498('0x45')]['id']}},_0x339ab5={};_0x339ab5[_0x4498('0x34')]=_[_0x4498('0x46')](db[_0x4498('0x2d')]['rawAttributes']);_0x339ab5[_0x4498('0x31')]=_[_0x4498('0x46')](_0x486aaa[_0x4498('0x31')]);_0x339ab5['filters']=_['intersection'](_0x339ab5[_0x4498('0x34')],_0x339ab5[_0x4498('0x31')]);_0x5a095d['attributes']=_[_0x4498('0x32')](_0x339ab5[_0x4498('0x34')],qs['fields'](_0x486aaa[_0x4498('0x31')][_0x4498('0x35')]));_0x5a095d[_0x4498('0x33')]=_0x5a095d[_0x4498('0x33')][_0x4498('0x36')]?_0x5a095d[_0x4498('0x33')]:_0x339ab5[_0x4498('0x34')];if(_0x486aaa['query'][_0x4498('0x3f')]){_0x5a095d[_0x4498('0x40')]=[{'all':!![]}];}_0x5a095d=_['merge']({},_0x5a095d,_0x486aaa[_0x4498('0x3e')]);return db[_0x4498('0x2d')][_0x4498('0x47')](_0x5a095d)[_0x4498('0x24')](handleEntityNotFound(_0x5ef1df,null))[_0x4498('0x24')](respondWithResult(_0x5ef1df,null))['catch'](handleError(_0x5ef1df,null));};exports['update']=function(_0x44227e,_0x121b8b){if(_0x44227e[_0x4498('0x48')]['id']){delete _0x44227e[_0x4498('0x48')]['id'];}return db[_0x4498('0x2d')]['find']({'where':{'id':_0x44227e['params']['id']}})[_0x4498('0x24')](handleEntityNotFound(_0x121b8b,null))[_0x4498('0x24')](saveUpdates(_0x44227e[_0x4498('0x48')],null))['then'](respondWithResult(_0x121b8b,null))['catch'](handleError(_0x121b8b,null));};exports[_0x4498('0x25')]=function(_0x309b25,_0x3383ec){return db[_0x4498('0x2d')][_0x4498('0x47')]({'where':{'id':_0x309b25[_0x4498('0x45')]['id']}})[_0x4498('0x24')](handleEntityNotFound(_0x3383ec,null))['then'](removeEntity(_0x3383ec,null))[_0x4498('0x43')](handleError(_0x3383ec,null));};exports[_0x4498('0x49')]=function(_0x460100,_0x279d7e){var _0x5eb882={'key':_0x460100['body']['key']};if(_0x460100[_0x4498('0x48')][_0x4498('0x4a')]){_0x5eb882[_0x4498('0x4a')]=_0x460100[_0x4498('0x48')]['MailAccountId'];}else if(_0x460100['body'][_0x4498('0x4b')]){_0x5eb882[_0x4498('0x4b')]=_0x460100['body'][_0x4498('0x4b')];}else if(_0x460100[_0x4498('0x48')][_0x4498('0x4c')]){_0x5eb882['OpenchannelAccountId']=_0x460100[_0x4498('0x48')]['OpenchannelAccountId'];}else if(_0x460100[_0x4498('0x48')][_0x4498('0x4d')]){_0x5eb882[_0x4498('0x4d')]=_0x460100[_0x4498('0x48')]['ChatWebsiteId'];}return db[_0x4498('0x2d')]['find']({'where':_0x5eb882})[_0x4498('0x24')](function(_0x196fb0){if(_0x196fb0){throw new db[(_0x4498('0x4e'))][(_0x4498('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x4498('0x2d')][_0x4498('0x49')](_0x460100['body']);})['then'](function(_0x11e176){var _0x58a6fb=_0x460100[_0x4498('0x50')][_0x4498('0x26')]({'plain':!![]});if(!_0x58a6fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58a6fb[_0x4498('0x51')]===_0x4498('0x50')){var _0x4271b7=_0x11e176[_0x4498('0x26')]({'plain':!![]});return db[_0x4498('0x52')][_0x4498('0x47')]({'where':{'name':_0x4498('0x27'),'userProfileId':_0x58a6fb[_0x4498('0x53')]},'raw':!![]})[_0x4498('0x24')](function(_0x52f8f9){if(_0x52f8f9&&_0x52f8f9[_0x4498('0x54')]===0x0){return db[_0x4498('0x28')]['create']({'name':_0x4271b7[_0x4498('0x2a')],'resourceId':_0x4271b7['id'],'type':_0x52f8f9['name'],'sectionId':_0x52f8f9['id']},{})['then'](function(){return _0x11e176;});}else{return _0x11e176;}})[_0x4498('0x43')](function(_0x5e01d9){logger[_0x4498('0x55')](_0x4498('0x56'),_0x5e01d9);throw _0x5e01d9;});}return _0x11e176;})['then'](respondWithResult(_0x279d7e,0xc9))[_0x4498('0x43')](handleError(_0x279d7e,null));}; \ No newline at end of file +var _0xc1ff=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','squel','crypto'];(function(_0x56cf0f,_0x30c902){var _0x5f4ae5=function(_0x20772c){while(--_0x20772c){_0x56cf0f['push'](_0x56cf0f['shift']());}};_0x5f4ae5(++_0x30c902);}(_0xc1ff,0xa1));var _0xfc1f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ff[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfc1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc1f('0x1'));var jsonpatch=require(_0xfc1f('0x2'));var rp=require(_0xfc1f('0x3'));var moment=require('moment');var BPromise=require(_0xfc1f('0x4'));var Mustache=require('mustache');var util=require(_0xfc1f('0x5'));var path=require(_0xfc1f('0x6'));var sox=require('sox');var csv=require(_0xfc1f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc1f('0x8'));var _=require('lodash');var squel=require(_0xfc1f('0x9'));var crypto=require(_0xfc1f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfc1f('0xb'));var toCsv=require(_0xfc1f('0x7'));var querystring=require('querystring');var Papa=require(_0xfc1f('0xc'));var Redis=require(_0xfc1f('0xd'));var authService=require(_0xfc1f('0xe'));var qs=require(_0xfc1f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc1f('0x10'));var logger=require('../../config/logger')(_0xfc1f('0x11'));var utils=require(_0xfc1f('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc1f('0x13'))['db'];function respondWithStatusCode(_0x32019f,_0x2beab5){_0x2beab5=_0x2beab5||0xcc;return function(_0x2a8820){if(_0x2a8820){return _0x32019f[_0xfc1f('0x14')](_0x2beab5);}return _0x32019f[_0xfc1f('0x15')](_0x2beab5)[_0xfc1f('0x16')]();};}function respondWithResult(_0x256af6,_0x390102){_0x390102=_0x390102||0xc8;return function(_0x281798){if(_0x281798){return _0x256af6[_0xfc1f('0x15')](_0x390102)[_0xfc1f('0x17')](_0x281798);}};}function respondWithFilteredResult(_0x17b06e,_0x86d5c6){return function(_0x4501fa){if(_0x4501fa){var _0x2f559d=typeof _0x86d5c6[_0xfc1f('0x18')]===_0xfc1f('0x19')&&typeof _0x86d5c6[_0xfc1f('0x1a')]===_0xfc1f('0x19');var _0x2dc022=_0x4501fa[_0xfc1f('0x1b')];var _0x4215ac=_0x2f559d?0x0:_0x86d5c6[_0xfc1f('0x18')];var _0x300382=_0x2f559d?_0x4501fa[_0xfc1f('0x1b')]:_0x86d5c6[_0xfc1f('0x18')]+_0x86d5c6[_0xfc1f('0x1a')];var _0x2e319f;if(_0x300382>=_0x2dc022){_0x300382=_0x2dc022;_0x2e319f=0xc8;}else{_0x2e319f=0xce;}_0x17b06e['status'](_0x2e319f);return _0x17b06e[_0xfc1f('0x1c')](_0xfc1f('0x1d'),_0x4215ac+'-'+_0x300382+'/'+_0x2dc022)['json'](_0x4501fa);}return null;};}function patchUpdates(_0x80a281){return function(_0x427b22){try{jsonpatch[_0xfc1f('0x1e')](_0x427b22,_0x80a281,!![]);}catch(_0x4d5ae0){return BPromise['reject'](_0x4d5ae0);}return _0x427b22[_0xfc1f('0x1f')]();};}function saveUpdates(_0x8933f9,_0x4d2805){return function(_0x1c83d8){if(_0x1c83d8){return _0x1c83d8['update'](_0x8933f9)[_0xfc1f('0x20')](function(_0x13efec){return _0x13efec;});}return null;};}function removeEntity(_0x1e4e9a,_0x17d23d){return function(_0x3f8224){if(_0x3f8224){return _0x3f8224[_0xfc1f('0x21')]()['then'](function(){var _0xd9b2fe=_0x3f8224[_0xfc1f('0x22')]({'plain':!![]});var _0x3871b3=_0xfc1f('0x23');return db[_0xfc1f('0x24')][_0xfc1f('0x21')]({'where':{'type':_0x3871b3,'resourceId':_0xd9b2fe['id']}})['then'](function(){return _0x3f8224;});})[_0xfc1f('0x20')](function(){_0x1e4e9a['status'](0xcc)[_0xfc1f('0x16')]();});}};}function handleEntityNotFound(_0x5dab84,_0x1e1ad5){return function(_0x3a415a){if(!_0x3a415a){_0x5dab84[_0xfc1f('0x14')](0x194);}return _0x3a415a;};}function handleError(_0xaa268f,_0x4da73a){_0x4da73a=_0x4da73a||0x1f4;return function(_0x4b4de5){logger[_0xfc1f('0x25')](_0x4b4de5[_0xfc1f('0x26')]);if(_0x4b4de5[_0xfc1f('0x27')]){delete _0x4b4de5[_0xfc1f('0x27')];}_0xaa268f['status'](_0x4da73a)[_0xfc1f('0x28')](_0x4b4de5);};}exports[_0xfc1f('0x29')]=function(_0x3fb77f,_0x1e0e02){var _0x386c04={},_0x19e861={},_0x147409={'count':0x0,'rows':[]};var _0x208e2e=_['map'](db[_0xfc1f('0x2a')][_0xfc1f('0x2b')],function(_0x2617b8){return{'name':_0x2617b8[_0xfc1f('0x2c')],'type':_0x2617b8[_0xfc1f('0x2d')][_0xfc1f('0x2e')]};});_0x19e861['model']=_['map'](_0x208e2e,'name');_0x19e861[_0xfc1f('0x2f')]=_[_0xfc1f('0x30')](_0x3fb77f['query']);_0x19e861[_0xfc1f('0x31')]=_[_0xfc1f('0x32')](_0x19e861[_0xfc1f('0x33')],_0x19e861[_0xfc1f('0x2f')]);_0x386c04['attributes']=_['intersection'](_0x19e861[_0xfc1f('0x33')],qs[_0xfc1f('0x34')](_0x3fb77f['query'][_0xfc1f('0x34')]));_0x386c04['attributes']=_0x386c04[_0xfc1f('0x35')][_0xfc1f('0x36')]?_0x386c04[_0xfc1f('0x35')]:_0x19e861[_0xfc1f('0x33')];if(!_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x37')](_0xfc1f('0x38'))){_0x386c04[_0xfc1f('0x1a')]=qs[_0xfc1f('0x1a')](_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x1a')]);_0x386c04[_0xfc1f('0x18')]=qs[_0xfc1f('0x18')](_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x18')]);}_0x386c04['order']=qs['sort'](_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x39')]);_0x386c04['where']=qs[_0xfc1f('0x31')](_[_0xfc1f('0x3a')](_0x3fb77f[_0xfc1f('0x2f')],_0x19e861[_0xfc1f('0x31')]),_0x208e2e);if(_0x3fb77f[_0xfc1f('0x2f')]['filter']){_0x386c04['where']=_[_0xfc1f('0x3b')](_0x386c04[_0xfc1f('0x3c')],{'$or':[{'key':{'$like':'%'+_0x3fb77f['query']['filter']+'%'}},{'value':{'$like':'%'+_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x3d')]+'%'}}]});}_0x386c04=_[_0xfc1f('0x3b')]({},_0x386c04,_0x3fb77f[_0xfc1f('0x3e')]);var _0x3b1ecb={'where':_0x386c04['where']};return db[_0xfc1f('0x2a')][_0xfc1f('0x1b')](_0x3b1ecb)[_0xfc1f('0x20')](function(_0x5a7f3b){_0x147409[_0xfc1f('0x1b')]=_0x5a7f3b;if(_0x3fb77f[_0xfc1f('0x2f')][_0xfc1f('0x3f')]){_0x386c04[_0xfc1f('0x40')]=[{'all':!![]}];}return db[_0xfc1f('0x2a')][_0xfc1f('0x41')](_0x386c04);})[_0xfc1f('0x20')](function(_0x50aa02){_0x147409[_0xfc1f('0x42')]=_0x50aa02;return _0x147409;})[_0xfc1f('0x20')](respondWithFilteredResult(_0x1e0e02,_0x386c04))[_0xfc1f('0x43')](handleError(_0x1e0e02,null));};exports[_0xfc1f('0x44')]=function(_0x13019d,_0x32ad86){var _0x2d5c07={'raw':!![],'where':{'id':_0x13019d[_0xfc1f('0x45')]['id']}},_0x39f8db={};_0x39f8db[_0xfc1f('0x33')]=_[_0xfc1f('0x30')](db[_0xfc1f('0x2a')][_0xfc1f('0x2b')]);_0x39f8db[_0xfc1f('0x2f')]=_[_0xfc1f('0x30')](_0x13019d[_0xfc1f('0x2f')]);_0x39f8db[_0xfc1f('0x31')]=_['intersection'](_0x39f8db[_0xfc1f('0x33')],_0x39f8db[_0xfc1f('0x2f')]);_0x2d5c07[_0xfc1f('0x35')]=_['intersection'](_0x39f8db[_0xfc1f('0x33')],qs[_0xfc1f('0x34')](_0x13019d[_0xfc1f('0x2f')][_0xfc1f('0x34')]));_0x2d5c07[_0xfc1f('0x35')]=_0x2d5c07['attributes'][_0xfc1f('0x36')]?_0x2d5c07[_0xfc1f('0x35')]:_0x39f8db[_0xfc1f('0x33')];if(_0x13019d[_0xfc1f('0x2f')][_0xfc1f('0x3f')]){_0x2d5c07[_0xfc1f('0x40')]=[{'all':!![]}];}_0x2d5c07=_['merge']({},_0x2d5c07,_0x13019d[_0xfc1f('0x3e')]);return db[_0xfc1f('0x2a')][_0xfc1f('0x46')](_0x2d5c07)[_0xfc1f('0x20')](handleEntityNotFound(_0x32ad86,null))['then'](respondWithResult(_0x32ad86,null))[_0xfc1f('0x43')](handleError(_0x32ad86,null));};exports[_0xfc1f('0x47')]=function(_0x36e666,_0x18f122){if(_0x36e666[_0xfc1f('0x48')]['id']){delete _0x36e666[_0xfc1f('0x48')]['id'];}return db[_0xfc1f('0x2a')][_0xfc1f('0x46')]({'where':{'id':_0x36e666[_0xfc1f('0x45')]['id']}})[_0xfc1f('0x20')](handleEntityNotFound(_0x18f122,null))[_0xfc1f('0x20')](saveUpdates(_0x36e666[_0xfc1f('0x48')],null))[_0xfc1f('0x20')](respondWithResult(_0x18f122,null))[_0xfc1f('0x43')](handleError(_0x18f122,null));};exports['destroy']=function(_0x200ae6,_0x34262e){return db[_0xfc1f('0x2a')][_0xfc1f('0x46')]({'where':{'id':_0x200ae6[_0xfc1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x34262e,null))[_0xfc1f('0x20')](removeEntity(_0x34262e,null))[_0xfc1f('0x43')](handleError(_0x34262e,null));};exports['create']=function(_0x177065,_0x446d8c){var _0x16f420={'key':_0x177065['body'][_0xfc1f('0x2e')]};if(_0x177065['body']['MailAccountId']){_0x16f420['MailAccountId']=_0x177065[_0xfc1f('0x48')]['MailAccountId'];}else if(_0x177065[_0xfc1f('0x48')][_0xfc1f('0x49')]){_0x16f420['SmsAccountId']=_0x177065[_0xfc1f('0x48')][_0xfc1f('0x49')];}else if(_0x177065[_0xfc1f('0x48')][_0xfc1f('0x4a')]){_0x16f420[_0xfc1f('0x4a')]=_0x177065['body'][_0xfc1f('0x4a')];}else if(_0x177065[_0xfc1f('0x48')][_0xfc1f('0x4b')]){_0x16f420[_0xfc1f('0x4b')]=_0x177065[_0xfc1f('0x48')]['ChatWebsiteId'];}return db['CannedAnswer']['find']({'where':_0x16f420})[_0xfc1f('0x20')](function(_0x594588){if(_0x594588){throw new db['Sequelize'][(_0xfc1f('0x4c'))](_0xfc1f('0x4d'));}return db['CannedAnswer']['create'](_0x177065['body']);})[_0xfc1f('0x20')](function(_0x13d630){var _0x3d23c2=_0x177065[_0xfc1f('0x4e')][_0xfc1f('0x22')]({'plain':!![]});if(!_0x3d23c2)throw new Error(_0xfc1f('0x4f'));if(_0x3d23c2[_0xfc1f('0x50')]==='user'){var _0x48baeb=_0x13d630['get']({'plain':!![]});return db[_0xfc1f('0x51')][_0xfc1f('0x46')]({'where':{'name':_0xfc1f('0x23'),'userProfileId':_0x3d23c2[_0xfc1f('0x52')]},'raw':!![]})[_0xfc1f('0x20')](function(_0x50efbb){if(_0x50efbb&&_0x50efbb[_0xfc1f('0x53')]===0x0){return db[_0xfc1f('0x24')][_0xfc1f('0x54')]({'name':_0x48baeb[_0xfc1f('0x27')],'resourceId':_0x48baeb['id'],'type':_0x50efbb[_0xfc1f('0x27')],'sectionId':_0x50efbb['id']},{})[_0xfc1f('0x20')](function(){return _0x13d630;});}else{return _0x13d630;}})[_0xfc1f('0x43')](function(_0x5b20da){logger['error'](_0xfc1f('0x55'),_0x5b20da);throw _0x5b20da;});}return _0x13d630;})[_0xfc1f('0x20')](respondWithResult(_0x446d8c,0xc9))[_0xfc1f('0x43')](handleError(_0x446d8c,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 430d24b..8525f9a 100644 --- a/server/api/cannedAnswer/cannedAnswer.model.js +++ b/server/api/cannedAnswer/cannedAnswer.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95c0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5dff12,_0x13c07f){var _0x292e58=function(_0x513642){while(--_0x513642){_0x5dff12['push'](_0x5dff12['shift']());}};_0x292e58(++_0x13c07f);}(_0x95c0,0x74));var _0x095c=function(_0x10d73c,_0x556760){_0x10d73c=_0x10d73c-0x0;var _0x3dc92b=_0x95c0[_0x10d73c];return _0x3dc92b;};'use strict';var _=require(_0x095c('0x0'));var util=require('util');var logger=require(_0x095c('0x1'))(_0x095c('0x2'));var moment=require('moment');var BPromise=require(_0x095c('0x3'));var rp=require(_0x095c('0x4'));var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require('../../config/environment');var attributes=require(_0x095c('0x7'));module[_0x095c('0x8')]=function(_0x2b7b3e,_0x92c19b){return _0x2b7b3e[_0x095c('0x9')](_0x095c('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x095c('0xb'),'collate':_0x095c('0xc')});}; \ No newline at end of file +var _0xa6fa=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa6fa,0x1bf));var _0xaa6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa6fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa6f('0x0'));var util=require(_0xaa6f('0x1'));var logger=require('../../config/logger')(_0xaa6f('0x2'));var moment=require('moment');var BPromise=require(_0xaa6f('0x3'));var rp=require(_0xaa6f('0x4'));var fs=require('fs');var path=require(_0xaa6f('0x5'));var rimraf=require(_0xaa6f('0x6'));var config=require(_0xaa6f('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xaa6f('0x8')]=function(_0x4c0802,_0x4ddd02){return _0x4c0802[_0xaa6f('0x9')](_0xaa6f('0xa'),attributes,{'tableName':_0xaa6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaa6f('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9407d23..197196b 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x425871,_0x46c821){var _0x3de4ed=function(_0x4dbda1){while(--_0x4dbda1){_0x425871['push'](_0x425871['shift']());}};_0x3de4ed(++_0x46c821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x18b3cf,_0x2c39d5){var _0x5f4bbe=function(_0x24c687){while(--_0x24c687){_0x18b3cf['push'](_0x18b3cf['shift']());}};_0x5f4bbe(++_0x2c39d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 4b172af..d15d63f 100644 --- a/server/api/cannedAnswer/index.js +++ b/server/api/cannedAnswer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74e0=['util','path','express','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','index','isAuthenticated','post','create','put','delete','/:id','destroy','exports','multer'];(function(_0x5c4ed9,_0x2475ea){var _0x3aded2=function(_0x465ba7){while(--_0x465ba7){_0x5c4ed9['push'](_0x5c4ed9['shift']());}};_0x3aded2(++_0x2475ea);}(_0x74e0,0xfb));var _0x074e=function(_0x4ade33,_0x103537){_0x4ade33=_0x4ade33-0x0;var _0x162cc1=_0x74e0[_0x4ade33];return _0x162cc1;};'use strict';var multer=require(_0x074e('0x0'));var util=require(_0x074e('0x1'));var path=require(_0x074e('0x2'));var timeout=require('connect-timeout');var express=require(_0x074e('0x3'));var router=express[_0x074e('0x4')]();var fs_extra=require(_0x074e('0x5'));var auth=require(_0x074e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x074e('0x7'));router[_0x074e('0x8')]('/',auth['isAuthenticated'](),controller[_0x074e('0x9')]);router[_0x074e('0x8')]('/:id',auth[_0x074e('0xa')](),controller['show']);router[_0x074e('0xb')]('/',auth[_0x074e('0xa')](),controller[_0x074e('0xc')]);router[_0x074e('0xd')]('/:id',auth[_0x074e('0xa')](),controller['update']);router[_0x074e('0xe')](_0x074e('0xf'),auth[_0x074e('0xa')](),controller[_0x074e('0x10')]);module[_0x074e('0x11')]=router; \ No newline at end of file +var _0xe0fd=['./cannedAnswer.controller','get','index','/:id','show','isAuthenticated','create','put','update','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a3abd,_0x44e560){var _0x503b9c=function(_0xbbe479){while(--_0xbbe479){_0x3a3abd['push'](_0x3a3abd['shift']());}};_0x503b9c(++_0x44e560);}(_0xe0fd,0xae));var _0xde0f=function(_0x37bece,_0x4a61a8){_0x37bece=_0x37bece-0x0;var _0x1a6d1d=_0xe0fd[_0x37bece];return _0x1a6d1d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xde0f('0x0'));var express=require(_0xde0f('0x1'));var router=express[_0xde0f('0x2')]();var fs_extra=require(_0xde0f('0x3'));var auth=require(_0xde0f('0x4'));var interaction=require(_0xde0f('0x5'));var config=require('../../config/environment');var controller=require(_0xde0f('0x6'));router[_0xde0f('0x7')]('/',auth['isAuthenticated'](),controller[_0xde0f('0x8')]);router[_0xde0f('0x7')](_0xde0f('0x9'),auth['isAuthenticated'](),controller[_0xde0f('0xa')]);router['post']('/',auth[_0xde0f('0xb')](),controller[_0xde0f('0xc')]);router[_0xde0f('0xd')]('/:id',auth[_0xde0f('0xb')](),controller[_0xde0f('0xe')]);router['delete'](_0xde0f('0x9'),auth[_0xde0f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a14401a..2289332 100644 --- a/server/api/cdr/cdr.attributes.js +++ b/server/api/cdr/cdr.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e88=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x17d389,_0x2f85bf){var _0x28a0c4=function(_0x16d20d){while(--_0x16d20d){_0x17d389['push'](_0x17d389['shift']());}};_0x28a0c4(++_0x2f85bf);}(_0x1e88,0x1d3));var _0x81e8=function(_0x5edd12,_0x487384){_0x5edd12=_0x5edd12-0x0;var _0xda9649=_0x1e88[_0x5edd12];return _0xda9649;};'use strict';var Sequelize=require(_0x81e8('0x0'));module[_0x81e8('0x1')]={'calldate':{'type':Sequelize[_0x81e8('0x2')],'allowNull':![],'defaultValue':_0x81e8('0x3')},'clid':{'type':Sequelize[_0x81e8('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x81e8('0x4')]},'channel':{'type':Sequelize[_0x81e8('0x4')]},'dstchannel':{'type':Sequelize[_0x81e8('0x4')]},'lastapp':{'type':Sequelize[_0x81e8('0x4')]},'lastdata':{'type':Sequelize[_0x81e8('0x4')]},'duration':{'type':Sequelize[_0x81e8('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x81e8('0x4')]},'amaflags':{'type':Sequelize[_0x81e8('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x81e8('0x4')]},'userfield':{'type':Sequelize[_0x81e8('0x4')]},'uniqueid':{'type':Sequelize[_0x81e8('0x4')]},'linkedid':{'type':Sequelize[_0x81e8('0x4')]},'sequence':{'type':Sequelize[_0x81e8('0x4')]},'peeraccount':{'type':Sequelize[_0x81e8('0x4')]},'type':{'type':Sequelize[_0x81e8('0x4')]},'tag':{'type':Sequelize[_0x81e8('0x4')]}}; \ No newline at end of file +var _0x4899=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x4899,0x142));var _0x9489=function(_0xdc5334,_0xe68d46){_0xdc5334=_0xdc5334-0x0;var _0x3f97f8=_0x4899[_0xdc5334];return _0x3f97f8;};'use strict';var Sequelize=require('sequelize');module[_0x9489('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x9489('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x9489('0x2')]},'dcontext':{'type':Sequelize[_0x9489('0x2')]},'channel':{'type':Sequelize[_0x9489('0x2')]},'dstchannel':{'type':Sequelize[_0x9489('0x2')]},'lastapp':{'type':Sequelize[_0x9489('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x9489('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9489('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9489('0x2')]},'amaflags':{'type':Sequelize[_0x9489('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9489('0x2')]},'userfield':{'type':Sequelize[_0x9489('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x9489('0x2')]},'peeraccount':{'type':Sequelize[_0x9489('0x2')]},'type':{'type':Sequelize[_0x9489('0x2')]},'tag':{'type':Sequelize[_0x9489('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index d81d363..ea05d27 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4f0a48,_0x1e47d3){_0x4f0a48=_0x4f0a48-0x0;var _0x52384c=_0x6b8f[_0x4f0a48];return _0x52384c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['Cdr']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file +var _0xf69d=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','send','map','Cdr','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x3d3a2d,_0x580270){var _0x57b362=function(_0x2fea9c){while(--_0x2fea9c){_0x3d3a2d['push'](_0x3d3a2d['shift']());}};_0x57b362(++_0x580270);}(_0xf69d,0xd3));var _0xdf69=function(_0x58b360,_0x3d60ca){_0x58b360=_0x58b360-0x0;var _0x2c1bed=_0xf69d[_0x58b360];return _0x2c1bed;};'use strict';var emlformat=require(_0xdf69('0x0'));var rimraf=require(_0xdf69('0x1'));var zipdir=require(_0xdf69('0x2'));var jsonpatch=require(_0xdf69('0x3'));var rp=require(_0xdf69('0x4'));var moment=require('moment');var BPromise=require(_0xdf69('0x5'));var Mustache=require(_0xdf69('0x6'));var util=require(_0xdf69('0x7'));var path=require(_0xdf69('0x8'));var sox=require(_0xdf69('0x9'));var csv=require(_0xdf69('0xa'));var ejs=require(_0xdf69('0xb'));var fs=require('fs');var fs_extra=require(_0xdf69('0xc'));var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xa'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df98a,_0x3dcda8){_0x3dcda8=_0x3dcda8||0xcc;return function(_0xbacdc6){if(_0xbacdc6){return _0x5df98a[_0xdf69('0x1b')](_0x3dcda8);}return _0x5df98a[_0xdf69('0x1c')](_0x3dcda8)[_0xdf69('0x1d')]();};}function respondWithResult(_0x38aee2,_0x584cbd){_0x584cbd=_0x584cbd||0xc8;return function(_0x41cc77){if(_0x41cc77){return _0x38aee2[_0xdf69('0x1c')](_0x584cbd)[_0xdf69('0x1e')](_0x41cc77);}};}function respondWithFilteredResult(_0xef2df5,_0x4f28fc){return function(_0xa4242f){if(_0xa4242f){var _0x56be66=typeof _0x4f28fc[_0xdf69('0x1f')]===_0xdf69('0x20')&&typeof _0x4f28fc['limit']===_0xdf69('0x20');var _0x449908=_0xa4242f[_0xdf69('0x21')];var _0x85d1d=_0x56be66?0x0:_0x4f28fc['offset'];var _0x5ae237=_0x56be66?_0xa4242f[_0xdf69('0x21')]:_0x4f28fc[_0xdf69('0x1f')]+_0x4f28fc['limit'];var _0x32cf65;if(_0x5ae237>=_0x449908){_0x5ae237=_0x449908;_0x32cf65=0xc8;}else{_0x32cf65=0xce;}_0xef2df5[_0xdf69('0x1c')](_0x32cf65);return _0xef2df5[_0xdf69('0x22')]('Content-Range',_0x85d1d+'-'+_0x5ae237+'/'+_0x449908)[_0xdf69('0x1e')](_0xa4242f);}return null;};}function patchUpdates(_0x452cfa){return function(_0x4d09d5){try{jsonpatch['apply'](_0x4d09d5,_0x452cfa,!![]);}catch(_0x32505a){return BPromise[_0xdf69('0x23')](_0x32505a);}return _0x4d09d5[_0xdf69('0x24')]();};}function saveUpdates(_0x5d91b8,_0x50ef18){return function(_0x5be7dd){if(_0x5be7dd){return _0x5be7dd[_0xdf69('0x25')](_0x5d91b8)['then'](function(_0x21f757){return _0x21f757;});}return null;};}function removeEntity(_0x311534,_0x1d37d8){return function(_0x54d2ca){if(_0x54d2ca){return _0x54d2ca['destroy']()[_0xdf69('0x26')](function(){_0x311534[_0xdf69('0x1c')](0xcc)[_0xdf69('0x1d')]();});}};}function handleEntityNotFound(_0x3fd933,_0x549191){return function(_0x3b727c){if(!_0x3b727c){_0x3fd933[_0xdf69('0x1b')](0x194);}return _0x3b727c;};}function handleError(_0x3e4f28,_0x5969cb){_0x5969cb=_0x5969cb||0x1f4;return function(_0x2da3df){logger['error'](_0x2da3df['stack']);if(_0x2da3df['name']){delete _0x2da3df['name'];}_0x3e4f28[_0xdf69('0x1c')](_0x5969cb)[_0xdf69('0x27')](_0x2da3df);};}exports['index']=function(_0x301bd2,_0xd81d0a){var _0x19cf2d={},_0x12aec3={},_0x1b7c16={'count':0x0,'rows':[]};var _0x1b57b3=_[_0xdf69('0x28')](db[_0xdf69('0x29')][_0xdf69('0x2a')],function(_0x3b97df){return{'name':_0x3b97df[_0xdf69('0x2b')],'type':_0x3b97df[_0xdf69('0x2c')][_0xdf69('0x2d')]};});_0x12aec3[_0xdf69('0x2e')]=_[_0xdf69('0x28')](_0x1b57b3,_0xdf69('0x2f'));_0x12aec3[_0xdf69('0x30')]=_['keys'](_0x301bd2[_0xdf69('0x30')]);_0x12aec3[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x12aec3[_0xdf69('0x2e')],_0x12aec3[_0xdf69('0x30')]);_0x19cf2d['attributes']=_[_0xdf69('0x32')](_0x12aec3['model'],qs[_0xdf69('0x33')](_0x301bd2[_0xdf69('0x30')]['fields']));_0x19cf2d[_0xdf69('0x34')]=_0x19cf2d['attributes'][_0xdf69('0x35')]?_0x19cf2d[_0xdf69('0x34')]:_0x12aec3[_0xdf69('0x2e')];if(!_0x301bd2[_0xdf69('0x30')][_0xdf69('0x36')]('nolimit')){_0x19cf2d[_0xdf69('0x37')]=qs['limit'](_0x301bd2[_0xdf69('0x30')][_0xdf69('0x37')]);_0x19cf2d[_0xdf69('0x1f')]=qs[_0xdf69('0x1f')](_0x301bd2['query'][_0xdf69('0x1f')]);}_0x19cf2d['order']=qs[_0xdf69('0x38')](_0x301bd2['query'][_0xdf69('0x38')]);_0x19cf2d['where']=qs[_0xdf69('0x31')](_[_0xdf69('0x39')](_0x301bd2[_0xdf69('0x30')],_0x12aec3[_0xdf69('0x31')]),_0x1b57b3);if(_0x301bd2[_0xdf69('0x30')]['filter']){_0x19cf2d[_0xdf69('0x3a')]=_[_0xdf69('0x3b')](_0x19cf2d['where'],{'$or':_['map'](_0x1b57b3,function(_0x4ee03c){if(_0x4ee03c['type']!==_0xdf69('0x3c')){var _0x5aff7d={};_0x5aff7d[_0x4ee03c[_0xdf69('0x2f')]]={'$like':'%'+_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3d')]+'%'};return _0x5aff7d;}})});}_0x19cf2d=_[_0xdf69('0x3b')]({},_0x19cf2d,_0x301bd2['options']);var _0x3de096={'where':_0x19cf2d[_0xdf69('0x3a')]};return db[_0xdf69('0x29')]['count'](_0x3de096)[_0xdf69('0x26')](function(_0xdd919d){_0x1b7c16[_0xdf69('0x21')]=_0xdd919d;if(_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3e')]){_0x19cf2d[_0xdf69('0x3f')]=[{'all':!![]}];}return db[_0xdf69('0x29')]['findAll'](_0x19cf2d);})['then'](function(_0x1fc4aa){_0x1b7c16[_0xdf69('0x40')]=_0x1fc4aa;return _0x1b7c16;})[_0xdf69('0x26')](respondWithFilteredResult(_0xd81d0a,_0x19cf2d))[_0xdf69('0x41')](handleError(_0xd81d0a,null));};exports['show']=function(_0x4a972c,_0x5980b1){var _0x5454e1={'raw':!![],'where':{'id':_0x4a972c['params']['id']}},_0x2abc7f={};_0x2abc7f[_0xdf69('0x2e')]=_['keys'](db[_0xdf69('0x29')][_0xdf69('0x2a')]);_0x2abc7f[_0xdf69('0x30')]=_[_0xdf69('0x42')](_0x4a972c[_0xdf69('0x30')]);_0x2abc7f[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x2abc7f[_0xdf69('0x2e')],_0x2abc7f[_0xdf69('0x30')]);_0x5454e1['attributes']=_['intersection'](_0x2abc7f[_0xdf69('0x2e')],qs['fields'](_0x4a972c[_0xdf69('0x30')][_0xdf69('0x33')]));_0x5454e1[_0xdf69('0x34')]=_0x5454e1['attributes'][_0xdf69('0x35')]?_0x5454e1[_0xdf69('0x34')]:_0x2abc7f[_0xdf69('0x2e')];if(_0x4a972c[_0xdf69('0x30')]['includeAll']){_0x5454e1[_0xdf69('0x3f')]=[{'all':!![]}];}_0x5454e1=_[_0xdf69('0x3b')]({},_0x5454e1,_0x4a972c['options']);return db['Cdr'][_0xdf69('0x43')](_0x5454e1)[_0xdf69('0x26')](handleEntityNotFound(_0x5980b1,null))[_0xdf69('0x26')](respondWithResult(_0x5980b1,null))[_0xdf69('0x41')](handleError(_0x5980b1,null));};exports[_0xdf69('0x44')]=function(_0x1b46c6,_0x578eec){return db['Cdr'][_0xdf69('0x44')](_0x1b46c6[_0xdf69('0x45')],{})[_0xdf69('0x26')](respondWithResult(_0x578eec,0xc9))[_0xdf69('0x41')](handleError(_0x578eec,null));};exports['update']=function(_0x4bc70f,_0xb34f76){if(_0x4bc70f[_0xdf69('0x45')]['id']){delete _0x4bc70f[_0xdf69('0x45')]['id'];}return db[_0xdf69('0x29')][_0xdf69('0x43')]({'where':{'id':_0x4bc70f[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0xb34f76,null))[_0xdf69('0x26')](saveUpdates(_0x4bc70f[_0xdf69('0x45')],null))[_0xdf69('0x26')](respondWithResult(_0xb34f76,null))[_0xdf69('0x41')](handleError(_0xb34f76,null));};exports[_0xdf69('0x47')]=function(_0x9a24c9,_0x439b06){return db['Cdr'][_0xdf69('0x43')]({'where':{'id':_0x9a24c9[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0x439b06,null))['then'](removeEntity(_0x439b06,null))[_0xdf69('0x41')](handleError(_0x439b06,null));};exports[_0xdf69('0x48')]=function(_0x15ca48,_0x4abeb7){return db[_0xdf69('0x29')]['describe']()[_0xdf69('0x26')](respondWithResult(_0x4abeb7,null))[_0xdf69('0x41')](handleError(_0x4abeb7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 736fdac..69b4ea2 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x412985,_0x1e3b48){var _0x1d10f2=function(_0x2215f3){while(--_0x2215f3){_0x412985['push'](_0x412985['shift']());}};_0x1d10f2(++_0x1e3b48);}(_0x7a54,0x106));var _0x47a5=function(_0xd26d28,_0x1d2e2){_0xd26d28=_0xd26d28-0x0;var _0x412edf=_0x7a54[_0xd26d28];return _0x412edf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5f3562,_0x212f41){var _0x1b39b4=function(_0x153e49){while(--_0x153e49){_0x5f3562['push'](_0x5f3562['shift']());}};_0x1b39b4(++_0x212f41);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 66412bd..6d69eeb 100644 --- a/server/api/cdr/cdr.rpc.js +++ b/server/api/cdr/cdr.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c98=['../../config/utils','rpc','../../config/environment','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x12d773,_0x253abd){var _0x152e37=function(_0x51b1f2){while(--_0x51b1f2){_0x12d773['push'](_0x12d773['shift']());}};_0x152e37(++_0x253abd);}(_0x8c98,0x12e));var _0x88c9=function(_0x3b7ecb,_0x289d8c){_0x3b7ecb=_0x3b7ecb-0x0;var _0x45c8bc=_0x8c98[_0x3b7ecb];return _0x45c8bc;};'use strict';var _=require(_0x88c9('0x0'));var util=require(_0x88c9('0x1'));var moment=require(_0x88c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x88c9('0x3'));var fs=require('fs');var Redis=require(_0x88c9('0x4'));var db=require(_0x88c9('0x5'))['db'];var utils=require(_0x88c9('0x6'));var logger=require('../../config/logger')(_0x88c9('0x7'));var config=require(_0x88c9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x88c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22f026,_0x57f9ba,_0x1614fb){return new BPromise(function(_0x646216,_0x3b9959){return client[_0x88c9('0xa')](_0x22f026,_0x1614fb)[_0x88c9('0xb')](function(_0x3c26a5){logger[_0x88c9('0xc')](_0x88c9('0xd'),_0x57f9ba,_0x88c9('0xe'));logger[_0x88c9('0xf')](_0x88c9('0x10'),_0x57f9ba,_0x88c9('0xe'),JSON['stringify'](_0x3c26a5));if(_0x3c26a5[_0x88c9('0x11')]){if(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x12')]===0x1f4){logger[_0x88c9('0x11')]('Cdr,\x20%s,\x20%s',_0x57f9ba,_0x3c26a5['error']['message']);return _0x3b9959(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);}logger['error'](_0x88c9('0xd'),_0x57f9ba,_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);return _0x646216(_0x3c26a5[_0x88c9('0x11')][_0x88c9('0x13')]);}else{logger[_0x88c9('0xc')](_0x88c9('0xd'),_0x57f9ba,_0x88c9('0xe'));_0x646216(_0x3c26a5[_0x88c9('0x14')]['message']);}})[_0x88c9('0x15')](function(_0x5ef0fe){logger['error']('Cdr,\x20%s,\x20%s',_0x57f9ba,_0x5ef0fe);_0x3b9959(_0x5ef0fe);});});} \ No newline at end of file +var _0x548f=['info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x548f,0x161));var _0xf548=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x548f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xf548('0x0'));var util=require(_0xf548('0x1'));var moment=require(_0xf548('0x2'));var BPromise=require(_0xf548('0x3'));var rs=require(_0xf548('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf548('0x5'))['db'];var utils=require(_0xf548('0x6'));var logger=require(_0xf548('0x7'))(_0xf548('0x8'));var config=require(_0xf548('0x9'));var jayson=require(_0xf548('0xa'));var client=jayson[_0xf548('0xb')][_0xf548('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58c824,_0x588511,_0x1925c5){return new BPromise(function(_0x597121,_0x359905){return client[_0xf548('0xd')](_0x58c824,_0x1925c5)[_0xf548('0xe')](function(_0x26661b){logger[_0xf548('0xf')](_0xf548('0x10'),_0x588511,_0xf548('0x11'));logger['debug'](_0xf548('0x12'),_0x588511,_0xf548('0x11'),JSON['stringify'](_0x26661b));if(_0x26661b[_0xf548('0x13')]){if(_0x26661b[_0xf548('0x13')][_0xf548('0x14')]===0x1f4){logger[_0xf548('0x13')](_0xf548('0x10'),_0x588511,_0x26661b[_0xf548('0x13')][_0xf548('0x15')]);return _0x359905(_0x26661b[_0xf548('0x13')][_0xf548('0x15')]);}logger['error'](_0xf548('0x10'),_0x588511,_0x26661b[_0xf548('0x13')][_0xf548('0x15')]);return _0x597121(_0x26661b['error'][_0xf548('0x15')]);}else{logger[_0xf548('0xf')]('Cdr,\x20%s,\x20%s',_0x588511,_0xf548('0x11'));_0x597121(_0x26661b['result']['message']);}})[_0xf548('0x16')](function(_0x5ce8ce){logger[_0xf548('0x13')](_0xf548('0x10'),_0x588511,_0x5ce8ce);_0x359905(_0x5ce8ce);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0682690..4cef563 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x39f211,_0x3b551b){var _0x1c1f5c=function(_0x14278c){while(--_0x14278c){_0x39f211['push'](_0x39f211['shift']());}};_0x1c1f5c(++_0x3b551b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c8dd502..43ef27a 100644 --- a/server/api/chatApplication/chatApplication.attributes.js +++ b/server/api/chatApplication/chatApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ecb=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0x6ecb,0x12e));var _0xb6ec=function(_0x484a09,_0x31b700){_0x484a09=_0x484a09-0x0;var _0x16ea35=_0x6ecb[_0x484a09];return _0x16ea35;};'use strict';var Sequelize=require(_0xb6ec('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb6ec('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb6ec('0x2')],'allowNull':![],'defaultValue':_0xb6ec('0x3')},'appdata':{'type':Sequelize[_0xb6ec('0x4')]()},'description':{'type':Sequelize[_0xb6ec('0x2')]},'interval':{'type':Sequelize[_0xb6ec('0x2')],'defaultValue':_0xb6ec('0x5')}}; \ No newline at end of file +var _0x5bbd=['INTEGER','STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x24756a,_0x553ee9){var _0x1e3cb8=function(_0x383961){while(--_0x383961){_0x24756a['push'](_0x24756a['shift']());}};_0x1e3cb8(++_0x553ee9);}(_0x5bbd,0x13d));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd5bb('0x0')]={'priority':{'type':Sequelize[_0xd5bb('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd5bb('0x2')],'allowNull':![],'defaultValue':_0xd5bb('0x3')},'appdata':{'type':Sequelize[_0xd5bb('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd5bb('0x2')],'defaultValue':_0xd5bb('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 6e9d8b0..e1445ec 100644 --- a/server/api/chatApplication/chatApplication.controller.js +++ b/server/api/chatApplication/chatApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ce8=['send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8ce8,0xd3));var _0x88ce=function(_0x516ab4,_0x3a8d82){_0x516ab4=_0x516ab4-0x0;var _0x23fff3=_0x8ce8[_0x516ab4];return _0x23fff3;};'use strict';var emlformat=require(_0x88ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x88ce('0x1'));var jsonpatch=require(_0x88ce('0x2'));var rp=require(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var Mustache=require(_0x88ce('0x6'));var util=require(_0x88ce('0x7'));var path=require(_0x88ce('0x8'));var sox=require(_0x88ce('0x9'));var csv=require(_0x88ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x88ce('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e336a,_0x3b67c8){_0x3b67c8=_0x3b67c8||0xcc;return function(_0x50b088){if(_0x50b088){return _0x3e336a['sendStatus'](_0x3b67c8);}return _0x3e336a[_0x88ce('0x1a')](_0x3b67c8)[_0x88ce('0x1b')]();};}function respondWithResult(_0x12e8af,_0xad722b){_0xad722b=_0xad722b||0xc8;return function(_0x417896){if(_0x417896){return _0x12e8af[_0x88ce('0x1a')](_0xad722b)[_0x88ce('0x1c')](_0x417896);}};}function respondWithFilteredResult(_0x48ebd3,_0x3460e5){return function(_0x5bcd5a){if(_0x5bcd5a){var _0x3da93e=typeof _0x3460e5['offset']===_0x88ce('0x1d')&&typeof _0x3460e5[_0x88ce('0x1e')]===_0x88ce('0x1d');var _0x34b0e4=_0x5bcd5a['count'];var _0x50c9df=_0x3da93e?0x0:_0x3460e5[_0x88ce('0x1f')];var _0x65fa81=_0x3da93e?_0x5bcd5a[_0x88ce('0x20')]:_0x3460e5[_0x88ce('0x1f')]+_0x3460e5[_0x88ce('0x1e')];var _0x37f31;if(_0x65fa81>=_0x34b0e4){_0x65fa81=_0x34b0e4;_0x37f31=0xc8;}else{_0x37f31=0xce;}_0x48ebd3[_0x88ce('0x1a')](_0x37f31);return _0x48ebd3[_0x88ce('0x21')](_0x88ce('0x22'),_0x50c9df+'-'+_0x65fa81+'/'+_0x34b0e4)[_0x88ce('0x1c')](_0x5bcd5a);}return null;};}function patchUpdates(_0x106e59){return function(_0x7de0ac){try{jsonpatch[_0x88ce('0x23')](_0x7de0ac,_0x106e59,!![]);}catch(_0x397ee5){return BPromise[_0x88ce('0x24')](_0x397ee5);}return _0x7de0ac[_0x88ce('0x25')]();};}function saveUpdates(_0x4daac4,_0x356d7d){return function(_0x34fbcc){if(_0x34fbcc){return _0x34fbcc[_0x88ce('0x26')](_0x4daac4)[_0x88ce('0x27')](function(_0x33711e){return _0x33711e;});}return null;};}function removeEntity(_0x4e45eb,_0x4c9133){return function(_0x4dcdc4){if(_0x4dcdc4){return _0x4dcdc4[_0x88ce('0x28')]()[_0x88ce('0x27')](function(){_0x4e45eb[_0x88ce('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e35db,_0x1f0adc){return function(_0x3383fa){if(!_0x3383fa){_0x4e35db[_0x88ce('0x29')](0x194);}return _0x3383fa;};}function handleError(_0x357247,_0x4b30db){_0x4b30db=_0x4b30db||0x1f4;return function(_0x1efcea){logger[_0x88ce('0x2a')](_0x1efcea[_0x88ce('0x2b')]);if(_0x1efcea[_0x88ce('0x2c')]){delete _0x1efcea[_0x88ce('0x2c')];}_0x357247[_0x88ce('0x1a')](_0x4b30db)[_0x88ce('0x2d')](_0x1efcea);};}exports[_0x88ce('0x2e')]=function(_0x29698a,_0x12b9a1){var _0x1814d1={'raw':!![],'where':{'id':_0x29698a[_0x88ce('0x2f')]['id']}},_0x47bbff={};_0x47bbff['model']=_[_0x88ce('0x30')](db[_0x88ce('0x31')][_0x88ce('0x32')]);_0x47bbff[_0x88ce('0x33')]=_['keys'](_0x29698a[_0x88ce('0x33')]);_0x47bbff[_0x88ce('0x34')]=_[_0x88ce('0x35')](_0x47bbff[_0x88ce('0x36')],_0x47bbff[_0x88ce('0x33')]);_0x1814d1[_0x88ce('0x37')]=_[_0x88ce('0x35')](_0x47bbff['model'],qs[_0x88ce('0x38')](_0x29698a[_0x88ce('0x33')]['fields']));_0x1814d1[_0x88ce('0x37')]=_0x1814d1[_0x88ce('0x37')][_0x88ce('0x39')]?_0x1814d1[_0x88ce('0x37')]:_0x47bbff[_0x88ce('0x36')];if(_0x29698a[_0x88ce('0x33')][_0x88ce('0x3a')]){_0x1814d1[_0x88ce('0x3b')]=[{'all':!![]}];}_0x1814d1=_[_0x88ce('0x3c')]({},_0x1814d1,_0x29698a['options']);return db[_0x88ce('0x31')][_0x88ce('0x3d')](_0x1814d1)[_0x88ce('0x27')](handleEntityNotFound(_0x12b9a1,null))['then'](respondWithResult(_0x12b9a1,null))[_0x88ce('0x3e')](handleError(_0x12b9a1,null));};exports[_0x88ce('0x26')]=function(_0x545a50,_0x4910f0){if(_0x545a50[_0x88ce('0x3f')]['id']){delete _0x545a50[_0x88ce('0x3f')]['id'];}return db[_0x88ce('0x31')][_0x88ce('0x3d')]({'where':{'id':_0x545a50[_0x88ce('0x2f')]['id']}})[_0x88ce('0x27')](handleEntityNotFound(_0x4910f0,null))['then'](saveUpdates(_0x545a50[_0x88ce('0x3f')],null))[_0x88ce('0x27')](respondWithResult(_0x4910f0,null))['catch'](handleError(_0x4910f0,null));};exports[_0x88ce('0x28')]=function(_0xe0ddfa,_0x55e1c4){return db[_0x88ce('0x31')]['find']({'where':{'id':_0xe0ddfa[_0x88ce('0x2f')]['id']}})[_0x88ce('0x27')](handleEntityNotFound(_0x55e1c4,null))[_0x88ce('0x27')](removeEntity(_0x55e1c4,null))[_0x88ce('0x3e')](handleError(_0x55e1c4,null));}; \ No newline at end of file +var _0x55f1=['status','end','offset','undefined','limit','count','set','json','apply','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','include','merge','options','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x279cef,_0x24e8b9){var _0x3fdd97=function(_0x324bd0){while(--_0x324bd0){_0x279cef['push'](_0x279cef['shift']());}};_0x3fdd97(++_0x24e8b9);}(_0x55f1,0x9b));var _0x155f=function(_0x1ca18a,_0x221e70){_0x1ca18a=_0x1ca18a-0x0;var _0x102f3b=_0x55f1[_0x1ca18a];return _0x102f3b;};'use strict';var emlformat=require(_0x155f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x155f('0x1'));var jsonpatch=require(_0x155f('0x2'));var rp=require(_0x155f('0x3'));var moment=require(_0x155f('0x4'));var BPromise=require(_0x155f('0x5'));var Mustache=require(_0x155f('0x6'));var util=require(_0x155f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x155f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x155f('0x9'));var _=require(_0x155f('0xa'));var squel=require(_0x155f('0xb'));var crypto=require(_0x155f('0xc'));var jsforce=require(_0x155f('0xd'));var deskjs=require(_0x155f('0xe'));var toCsv=require(_0x155f('0x8'));var querystring=require(_0x155f('0xf'));var Papa=require(_0x155f('0x10'));var Redis=require(_0x155f('0x11'));var authService=require(_0x155f('0x12'));var qs=require(_0x155f('0x13'));var as=require(_0x155f('0x14'));var hardwareService=require(_0x155f('0x15'));var logger=require(_0x155f('0x16'))(_0x155f('0x17'));var utils=require(_0x155f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x155f('0x19'));var db=require(_0x155f('0x1a'))['db'];function respondWithStatusCode(_0x18fd42,_0x56f9e9){_0x56f9e9=_0x56f9e9||0xcc;return function(_0x517753){if(_0x517753){return _0x18fd42[_0x155f('0x1b')](_0x56f9e9);}return _0x18fd42[_0x155f('0x1c')](_0x56f9e9)[_0x155f('0x1d')]();};}function respondWithResult(_0x1be2d7,_0x177c4e){_0x177c4e=_0x177c4e||0xc8;return function(_0x2fa0d4){if(_0x2fa0d4){return _0x1be2d7[_0x155f('0x1c')](_0x177c4e)['json'](_0x2fa0d4);}};}function respondWithFilteredResult(_0x3a3207,_0x2ef684){return function(_0x581ee9){if(_0x581ee9){var _0x44c018=typeof _0x2ef684[_0x155f('0x1e')]===_0x155f('0x1f')&&typeof _0x2ef684[_0x155f('0x20')]===_0x155f('0x1f');var _0xc0b11=_0x581ee9[_0x155f('0x21')];var _0x343a1e=_0x44c018?0x0:_0x2ef684[_0x155f('0x1e')];var _0x407e26=_0x44c018?_0x581ee9[_0x155f('0x21')]:_0x2ef684[_0x155f('0x1e')]+_0x2ef684[_0x155f('0x20')];var _0x361131;if(_0x407e26>=_0xc0b11){_0x407e26=_0xc0b11;_0x361131=0xc8;}else{_0x361131=0xce;}_0x3a3207[_0x155f('0x1c')](_0x361131);return _0x3a3207[_0x155f('0x22')]('Content-Range',_0x343a1e+'-'+_0x407e26+'/'+_0xc0b11)[_0x155f('0x23')](_0x581ee9);}return null;};}function patchUpdates(_0x26a322){return function(_0x39c362){try{jsonpatch[_0x155f('0x24')](_0x39c362,_0x26a322,!![]);}catch(_0x57408c){return BPromise['reject'](_0x57408c);}return _0x39c362['save']();};}function saveUpdates(_0x17c74b,_0x3a40b4){return function(_0x2e337e){if(_0x2e337e){return _0x2e337e[_0x155f('0x25')](_0x17c74b)[_0x155f('0x26')](function(_0x50ff9b){return _0x50ff9b;});}return null;};}function removeEntity(_0x1855cd,_0x2047c2){return function(_0x172077){if(_0x172077){return _0x172077[_0x155f('0x27')]()[_0x155f('0x26')](function(){_0x1855cd[_0x155f('0x1c')](0xcc)[_0x155f('0x1d')]();});}};}function handleEntityNotFound(_0x3bdbe1,_0x45b580){return function(_0x2bc5b5){if(!_0x2bc5b5){_0x3bdbe1[_0x155f('0x1b')](0x194);}return _0x2bc5b5;};}function handleError(_0x15ff35,_0x52af8e){_0x52af8e=_0x52af8e||0x1f4;return function(_0x5c0a30){logger[_0x155f('0x28')](_0x5c0a30[_0x155f('0x29')]);if(_0x5c0a30[_0x155f('0x2a')]){delete _0x5c0a30[_0x155f('0x2a')];}_0x15ff35['status'](_0x52af8e)[_0x155f('0x2b')](_0x5c0a30);};}exports[_0x155f('0x2c')]=function(_0x28cd98,_0x29e9dd){var _0x1f53c8={'raw':!![],'where':{'id':_0x28cd98[_0x155f('0x2d')]['id']}},_0x3d3e46={};_0x3d3e46['model']=_[_0x155f('0x2e')](db[_0x155f('0x2f')][_0x155f('0x30')]);_0x3d3e46[_0x155f('0x31')]=_[_0x155f('0x2e')](_0x28cd98[_0x155f('0x31')]);_0x3d3e46[_0x155f('0x32')]=_[_0x155f('0x33')](_0x3d3e46[_0x155f('0x34')],_0x3d3e46['query']);_0x1f53c8[_0x155f('0x35')]=_[_0x155f('0x33')](_0x3d3e46[_0x155f('0x34')],qs['fields'](_0x28cd98[_0x155f('0x31')][_0x155f('0x36')]));_0x1f53c8['attributes']=_0x1f53c8[_0x155f('0x35')]['length']?_0x1f53c8[_0x155f('0x35')]:_0x3d3e46[_0x155f('0x34')];if(_0x28cd98['query']['includeAll']){_0x1f53c8[_0x155f('0x37')]=[{'all':!![]}];}_0x1f53c8=_[_0x155f('0x38')]({},_0x1f53c8,_0x28cd98[_0x155f('0x39')]);return db['ChatApplication'][_0x155f('0x3a')](_0x1f53c8)[_0x155f('0x26')](handleEntityNotFound(_0x29e9dd,null))[_0x155f('0x26')](respondWithResult(_0x29e9dd,null))[_0x155f('0x3b')](handleError(_0x29e9dd,null));};exports['update']=function(_0x2ce226,_0xedfb25){if(_0x2ce226['body']['id']){delete _0x2ce226[_0x155f('0x3c')]['id'];}return db['ChatApplication'][_0x155f('0x3a')]({'where':{'id':_0x2ce226['params']['id']}})[_0x155f('0x26')](handleEntityNotFound(_0xedfb25,null))['then'](saveUpdates(_0x2ce226['body'],null))[_0x155f('0x26')](respondWithResult(_0xedfb25,null))[_0x155f('0x3b')](handleError(_0xedfb25,null));};exports[_0x155f('0x27')]=function(_0x2ea2c9,_0x29023d){return db[_0x155f('0x2f')]['find']({'where':{'id':_0x2ea2c9[_0x155f('0x2d')]['id']}})[_0x155f('0x26')](handleEntityNotFound(_0x29023d,null))[_0x155f('0x26')](removeEntity(_0x29023d,null))['catch'](handleError(_0x29023d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7f64f9c..58e1036 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bfe=['exports','chat_applications','utf8mb4','util','../../config/logger','bluebird','path','rimraf','./chatApplication.attributes'];(function(_0x32703c,_0x17c57c){var _0x50489d=function(_0x4a8b2a){while(--_0x4a8b2a){_0x32703c['push'](_0x32703c['shift']());}};_0x50489d(++_0x17c57c);}(_0x5bfe,0x9c));var _0xe5bf=function(_0x18a5ba,_0x532863){_0x18a5ba=_0x18a5ba-0x0;var _0x287a75=_0x5bfe[_0x18a5ba];return _0x287a75;};'use strict';var _=require('lodash');var util=require(_0xe5bf('0x0'));var logger=require(_0xe5bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe5bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe5bf('0x3'));var rimraf=require(_0xe5bf('0x4'));var config=require('../../config/environment');var attributes=require(_0xe5bf('0x5'));module[_0xe5bf('0x6')]=function(_0x2b48c4,_0x3d4aa9){return _0x2b48c4['define']('ChatApplication',attributes,{'tableName':_0xe5bf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe5bf('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc737=['./chatApplication.attributes','define','chat_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2bc96c,_0x4e4159){var _0x4ae39f=function(_0x10bc7f){while(--_0x10bc7f){_0x2bc96c['push'](_0x2bc96c['shift']());}};_0x4ae39f(++_0x4e4159);}(_0xc737,0x154));var _0x7c73=function(_0x197a8a,_0x148cbc){_0x197a8a=_0x197a8a-0x0;var _0xe2718f=_0xc737[_0x197a8a];return _0xe2718f;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var logger=require(_0x7c73('0x2'))(_0x7c73('0x3'));var moment=require('moment');var BPromise=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var fs=require('fs');var path=require(_0x7c73('0x6'));var rimraf=require('rimraf');var config=require(_0x7c73('0x7'));var attributes=require(_0x7c73('0x8'));module['exports']=function(_0x5ad227,_0x37635c){return _0x5ad227[_0x7c73('0x9')]('ChatApplication',attributes,{'tableName':_0x7c73('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c73('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7618cc1..53323be 100644 --- a/server/api/chatApplication/chatApplication.rpc.js +++ b/server/api/chatApplication/chatApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb56d=['message','request\x20sent','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x299d09,_0x1fdf9d){var _0x3754cb=function(_0x2b211b){while(--_0x2b211b){_0x299d09['push'](_0x299d09['shift']());}};_0x3754cb(++_0x1fdf9d);}(_0xb56d,0x1e7));var _0xdb56=function(_0x26dea1,_0x1d68ba){_0x26dea1=_0x26dea1-0x0;var _0x3da162=_0xb56d[_0x26dea1];return _0x3da162;};'use strict';var _=require('lodash');var util=require(_0xdb56('0x0'));var moment=require(_0xdb56('0x1'));var BPromise=require(_0xdb56('0x2'));var rs=require(_0xdb56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb56('0x5'))('rpc');var config=require(_0xdb56('0x6'));var jayson=require(_0xdb56('0x7'));var client=jayson['client'][_0xdb56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9e88,_0xe913de,_0x2c9987){return new BPromise(function(_0x1b2bec,_0x12f1a6){return client['request'](_0x5d9e88,_0x2c9987)[_0xdb56('0x9')](function(_0x3e6c19){logger[_0xdb56('0xa')](_0xdb56('0xb'),_0xe913de,'request\x20sent');logger[_0xdb56('0xc')](_0xdb56('0xd'),_0xe913de,'request\x20sent',JSON[_0xdb56('0xe')](_0x3e6c19));if(_0x3e6c19[_0xdb56('0xf')]){if(_0x3e6c19['error'][_0xdb56('0x10')]===0x1f4){logger['error'](_0xdb56('0xb'),_0xe913de,_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);return _0x12f1a6(_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0xe913de,_0x3e6c19[_0xdb56('0xf')][_0xdb56('0x11')]);return _0x1b2bec(_0x3e6c19['error'][_0xdb56('0x11')]);}else{logger[_0xdb56('0xa')](_0xdb56('0xb'),_0xe913de,_0xdb56('0x12'));_0x1b2bec(_0x3e6c19[_0xdb56('0x13')]['message']);}})[_0xdb56('0x14')](function(_0x10e2b3){logger[_0xdb56('0xf')](_0xdb56('0xb'),_0xe913de,_0x10e2b3);_0x12f1a6(_0x10e2b3);});});} \ No newline at end of file +var _0x5c3e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4227de,_0x335bd7){var _0x52179b=function(_0x488e82){while(--_0x488e82){_0x4227de['push'](_0x4227de['shift']());}};_0x52179b(++_0x335bd7);}(_0x5c3e,0x182));var _0xe5c3=function(_0x12efa3,_0x34b381){_0x12efa3=_0x12efa3-0x0;var _0x21a6a3=_0x5c3e[_0x12efa3];return _0x21a6a3;};'use strict';var _=require(_0xe5c3('0x0'));var util=require(_0xe5c3('0x1'));var moment=require(_0xe5c3('0x2'));var BPromise=require(_0xe5c3('0x3'));var rs=require(_0xe5c3('0x4'));var fs=require('fs');var Redis=require(_0xe5c3('0x5'));var db=require(_0xe5c3('0x6'))['db'];var utils=require(_0xe5c3('0x7'));var logger=require('../../config/logger')(_0xe5c3('0x8'));var config=require(_0xe5c3('0x9'));var jayson=require(_0xe5c3('0xa'));var client=jayson[_0xe5c3('0xb')][_0xe5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dfe16,_0x250d58,_0xcf56b9){return new BPromise(function(_0x193d17,_0x4f79a4){return client[_0xe5c3('0xd')](_0x3dfe16,_0xcf56b9)[_0xe5c3('0xe')](function(_0x2cb0fc){logger['info']('ChatApplication,\x20%s,\x20%s',_0x250d58,_0xe5c3('0xf'));logger[_0xe5c3('0x10')](_0xe5c3('0x11'),_0x250d58,_0xe5c3('0xf'),JSON[_0xe5c3('0x12')](_0x2cb0fc));if(_0x2cb0fc['error']){if(_0x2cb0fc[_0xe5c3('0x13')][_0xe5c3('0x14')]===0x1f4){logger[_0xe5c3('0x13')](_0xe5c3('0x15'),_0x250d58,_0x2cb0fc[_0xe5c3('0x13')]['message']);return _0x4f79a4(_0x2cb0fc[_0xe5c3('0x13')][_0xe5c3('0x16')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x250d58,_0x2cb0fc[_0xe5c3('0x13')]['message']);return _0x193d17(_0x2cb0fc['error'][_0xe5c3('0x16')]);}else{logger[_0xe5c3('0x17')](_0xe5c3('0x15'),_0x250d58,_0xe5c3('0xf'));_0x193d17(_0x2cb0fc[_0xe5c3('0x18')][_0xe5c3('0x16')]);}})[_0xe5c3('0x19')](function(_0x1c5bac){logger[_0xe5c3('0x13')](_0xe5c3('0x15'),_0x250d58,_0x1c5bac);_0x4f79a4(_0x1c5bac);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index d93b4fd..c22f978 100644 --- a/server/api/chatApplication/index.js +++ b/server/api/chatApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b6b=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','util'];(function(_0x5bf06e,_0x24abf1){var _0x374a73=function(_0x256e8f){while(--_0x256e8f){_0x5bf06e['push'](_0x5bf06e['shift']());}};_0x374a73(++_0x24abf1);}(_0x8b6b,0x149));var _0xb8b6=function(_0x42323a,_0x432571){_0x42323a=_0x42323a-0x0;var _0x1d253c=_0x8b6b[_0x42323a];return _0x1d253c;};'use strict';var multer=require('multer');var util=require(_0xb8b6('0x0'));var path=require(_0xb8b6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb8b6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb8b6('0x3'));var interaction=require(_0xb8b6('0x4'));var config=require(_0xb8b6('0x5'));var controller=require(_0xb8b6('0x6'));router[_0xb8b6('0x7')](_0xb8b6('0x8'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xa')]);router[_0xb8b6('0xb')](_0xb8b6('0x8'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xc')]);router[_0xb8b6('0xd')](_0xb8b6('0x8'),auth['isAuthenticated'](),controller[_0xb8b6('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0905=['multer','util','path','express','Router','../../components/auth/service','/:id','isAuthenticated','show','put','delete','destroy','exports'];(function(_0x109203,_0x565dc4){var _0x1c570a=function(_0x544bf4){while(--_0x544bf4){_0x109203['push'](_0x109203['shift']());}};_0x1c570a(++_0x565dc4);}(_0x0905,0x16c));var _0x5090=function(_0x192ed8,_0x115238){_0x192ed8=_0x192ed8-0x0;var _0x37aff5=_0x0905[_0x192ed8];return _0x37aff5;};'use strict';var multer=require(_0x5090('0x0'));var util=require(_0x5090('0x1'));var path=require(_0x5090('0x2'));var timeout=require('connect-timeout');var express=require(_0x5090('0x3'));var router=express[_0x5090('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5090('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x5090('0x6'),auth[_0x5090('0x7')](),controller[_0x5090('0x8')]);router[_0x5090('0x9')]('/:id',auth[_0x5090('0x7')](),controller['update']);router[_0x5090('0xa')](_0x5090('0x6'),auth[_0x5090('0x7')](),controller[_0x5090('0xb')]);module[_0x5090('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 7538c05..bce154b 100644 --- a/server/api/chatGroup/chatGroup.attributes.js +++ b/server/api/chatGroup/chatGroup.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['STRING','sequelize','exports'];(function(_0xd15876,_0x4690d9){var _0x267815=function(_0x3ee56a){while(--_0x3ee56a){_0xd15876['push'](_0xd15876['shift']());}};_0x267815(++_0x4690d9);}(_0xe706,0x1ab));var _0x6e70=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0xe706[_0x3eb450];return _0x2c4cfd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe870=['BOOLEAN','exports','STRING'];(function(_0x1a9f01,_0x5ecf83){var _0xcb147d=function(_0x58467a){while(--_0x58467a){_0x1a9f01['push'](_0x1a9f01['shift']());}};_0xcb147d(++_0x5ecf83);}(_0xe870,0x91));var _0x0e87=function(_0x3882c3,_0x32e32d){_0x3882c3=_0x3882c3-0x0;var _0x4d6187=_0xe870[_0x3882c3];return _0x4d6187;};'use strict';var Sequelize=require('sequelize');module[_0x0e87('0x0')]={'name':{'type':Sequelize[_0x0e87('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0e87('0x1')]},'write':{'type':Sequelize[_0x0e87('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 8c589d1..67abf4b 100644 --- a/server/api/chatGroup/chatGroup.controller.js +++ b/server/api/chatGroup/chatGroup.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x055d=['register','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','options','include','rows','catch','show','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','params','omit','ids','getMembers','findOne','User','filter','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket'];(function(_0x52456c,_0x2bea26){var _0x3040d9=function(_0x1f31ab){while(--_0x1f31ab){_0x52456c['push'](_0x52456c['shift']());}};_0x3040d9(++_0x2bea26);}(_0x055d,0x103));var _0xd055=function(_0x2d99ca,_0x36a2e0){_0x2d99ca=_0x2d99ca-0x0;var _0x5574e3=_0x055d[_0x2d99ca];return _0x5574e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd055('0x0'));var zipdir=require(_0xd055('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd055('0x2'));var moment=require(_0xd055('0x3'));var BPromise=require(_0xd055('0x4'));var Mustache=require(_0xd055('0x5'));var util=require('util');var path=require('path');var sox=require(_0xd055('0x6'));var csv=require(_0xd055('0x7'));var ejs=require(_0xd055('0x8'));var fs=require('fs');var fs_extra=require(_0xd055('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd055('0xa'));var jsforce=require(_0xd055('0xb'));var deskjs=require(_0xd055('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd055('0xd'));var Papa=require(_0xd055('0xe'));var Redis=require(_0xd055('0xf'));var authService=require(_0xd055('0x10'));var qs=require(_0xd055('0x11'));var as=require(_0xd055('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd055('0x13'))(_0xd055('0x14'));var utils=require(_0xd055('0x15'));var config=require(_0xd055('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd055('0x17'))['db'];config['redis']=_[_0xd055('0x18')](config['redis'],{'host':_0xd055('0x19'),'port':0x18eb});var socket=require(_0xd055('0x1a'))(new Redis(config[_0xd055('0x1b')]));require(_0xd055('0x1c'))[_0xd055('0x1d')](socket);function respondWithStatusCode(_0x18b95a,_0x5e522b){_0x5e522b=_0x5e522b||0xcc;return function(_0x1bb3ca){if(_0x1bb3ca){return _0x18b95a[_0xd055('0x1e')](_0x5e522b);}return _0x18b95a[_0xd055('0x1f')](_0x5e522b)[_0xd055('0x20')]();};}function respondWithResult(_0x4a485f,_0x302071){_0x302071=_0x302071||0xc8;return function(_0x1a1dd9){if(_0x1a1dd9){return _0x4a485f[_0xd055('0x1f')](_0x302071)['json'](_0x1a1dd9);}};}function respondWithFilteredResult(_0x17121f,_0x24c9ea){return function(_0x4a24a9){if(_0x4a24a9){var _0x312f56=typeof _0x24c9ea[_0xd055('0x21')]===_0xd055('0x22')&&typeof _0x24c9ea[_0xd055('0x23')]==='undefined';var _0x5df396=_0x4a24a9[_0xd055('0x24')];var _0x19cf72=_0x312f56?0x0:_0x24c9ea[_0xd055('0x21')];var _0x275436=_0x312f56?_0x4a24a9[_0xd055('0x24')]:_0x24c9ea['offset']+_0x24c9ea[_0xd055('0x23')];var _0x458fef;if(_0x275436>=_0x5df396){_0x275436=_0x5df396;_0x458fef=0xc8;}else{_0x458fef=0xce;}_0x17121f['status'](_0x458fef);return _0x17121f[_0xd055('0x25')]('Content-Range',_0x19cf72+'-'+_0x275436+'/'+_0x5df396)[_0xd055('0x26')](_0x4a24a9);}return null;};}function patchUpdates(_0x4c12f2){return function(_0x38d9da){try{jsonpatch['apply'](_0x38d9da,_0x4c12f2,!![]);}catch(_0x457c61){return BPromise[_0xd055('0x27')](_0x457c61);}return _0x38d9da['save']();};}function saveUpdates(_0x29b66d,_0x461582){return function(_0x447c18){if(_0x447c18){return _0x447c18[_0xd055('0x28')](_0x29b66d)[_0xd055('0x29')](function(_0x14e63d){return _0x14e63d;});}return null;};}function removeEntity(_0x1732e3,_0x29a81a){return function(_0x5bb1c2){if(_0x5bb1c2){return _0x5bb1c2[_0xd055('0x2a')]()[_0xd055('0x29')](function(){_0x1732e3[_0xd055('0x1f')](0xcc)[_0xd055('0x20')]();});}};}function handleEntityNotFound(_0x36fc30,_0x4e85fb){return function(_0x5a5dd9){if(!_0x5a5dd9){_0x36fc30[_0xd055('0x1e')](0x194);}return _0x5a5dd9;};}function handleError(_0x1d9f6a,_0x41b2c6){_0x41b2c6=_0x41b2c6||0x1f4;return function(_0x5aa97f){logger[_0xd055('0x2b')](_0x5aa97f[_0xd055('0x2c')]);if(_0x5aa97f['name']){delete _0x5aa97f[_0xd055('0x2d')];}_0x1d9f6a[_0xd055('0x1f')](_0x41b2c6)[_0xd055('0x2e')](_0x5aa97f);};}exports[_0xd055('0x2f')]=function(_0x2dbf63,_0x2bd7f6){var _0x5a4d77={},_0x54c500={},_0xbe157c={'count':0x0,'rows':[]};var _0xbb0c2=_[_0xd055('0x30')](db[_0xd055('0x31')][_0xd055('0x32')],function(_0xb3f02a){return{'name':_0xb3f02a[_0xd055('0x33')],'type':_0xb3f02a[_0xd055('0x34')][_0xd055('0x35')]};});_0x54c500[_0xd055('0x36')]=_[_0xd055('0x30')](_0xbb0c2,_0xd055('0x2d'));_0x54c500[_0xd055('0x37')]=_[_0xd055('0x38')](_0x2dbf63[_0xd055('0x37')]);_0x54c500[_0xd055('0x39')]=_[_0xd055('0x3a')](_0x54c500[_0xd055('0x36')],_0x54c500[_0xd055('0x37')]);_0x5a4d77['attributes']=_[_0xd055('0x3a')](_0x54c500['model'],qs[_0xd055('0x3b')](_0x2dbf63['query'][_0xd055('0x3b')]));_0x5a4d77['attributes']=_0x5a4d77[_0xd055('0x3c')][_0xd055('0x3d')]?_0x5a4d77[_0xd055('0x3c')]:_0x54c500[_0xd055('0x36')];if(!_0x2dbf63[_0xd055('0x37')]['hasOwnProperty'](_0xd055('0x3e'))){_0x5a4d77[_0xd055('0x23')]=qs['limit'](_0x2dbf63[_0xd055('0x37')][_0xd055('0x23')]);_0x5a4d77[_0xd055('0x21')]=qs['offset'](_0x2dbf63[_0xd055('0x37')]['offset']);}_0x5a4d77[_0xd055('0x3f')]=qs[_0xd055('0x40')](_0x2dbf63[_0xd055('0x37')][_0xd055('0x40')]);_0x5a4d77[_0xd055('0x41')]=qs[_0xd055('0x39')](_[_0xd055('0x42')](_0x2dbf63[_0xd055('0x37')],_0x54c500[_0xd055('0x39')]),_0xbb0c2);if(_0x2dbf63[_0xd055('0x37')]['filter']){_0x5a4d77[_0xd055('0x41')]=_[_0xd055('0x43')](_0x5a4d77[_0xd055('0x41')],{'$or':_['map'](_0xbb0c2,function(_0x56adcf){if(_0x56adcf['type']!=='VIRTUAL'){var _0x158635={};_0x158635[_0x56adcf['name']]={'$like':'%'+_0x2dbf63[_0xd055('0x37')]['filter']+'%'};return _0x158635;}})});}_0x5a4d77=_[_0xd055('0x43')]({},_0x5a4d77,_0x2dbf63[_0xd055('0x44')]);var _0x58221d={'where':_0x5a4d77[_0xd055('0x41')]};return db['ChatGroup'][_0xd055('0x24')](_0x58221d)[_0xd055('0x29')](function(_0x175f63){_0xbe157c[_0xd055('0x24')]=_0x175f63;if(_0x2dbf63[_0xd055('0x37')]['includeAll']){_0x5a4d77[_0xd055('0x45')]=[{'all':!![]}];}return db[_0xd055('0x31')]['findAll'](_0x5a4d77);})[_0xd055('0x29')](function(_0x43c6c5){_0xbe157c[_0xd055('0x46')]=_0x43c6c5;return _0xbe157c;})['then'](respondWithFilteredResult(_0x2bd7f6,_0x5a4d77))[_0xd055('0x47')](handleError(_0x2bd7f6,null));};exports[_0xd055('0x48')]=function(_0x2804e6,_0x1ba175){var _0x9d4b63={'raw':!![],'where':{'id':_0x2804e6['params']['id']}},_0xefed18={};_0xefed18[_0xd055('0x36')]=_[_0xd055('0x38')](db[_0xd055('0x31')][_0xd055('0x32')]);_0xefed18[_0xd055('0x37')]=_[_0xd055('0x38')](_0x2804e6['query']);_0xefed18['filters']=_[_0xd055('0x3a')](_0xefed18['model'],_0xefed18[_0xd055('0x37')]);_0x9d4b63[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0xefed18[_0xd055('0x36')],qs['fields'](_0x2804e6[_0xd055('0x37')]['fields']));_0x9d4b63[_0xd055('0x3c')]=_0x9d4b63['attributes'][_0xd055('0x3d')]?_0x9d4b63['attributes']:_0xefed18['model'];if(_0x2804e6[_0xd055('0x37')]['includeAll']){_0x9d4b63['include']=[{'all':!![]}];}_0x9d4b63=_[_0xd055('0x43')]({},_0x9d4b63,_0x2804e6[_0xd055('0x44')]);return db[_0xd055('0x31')][_0xd055('0x49')](_0x9d4b63)[_0xd055('0x29')](handleEntityNotFound(_0x1ba175,null))['then'](respondWithResult(_0x1ba175,null))[_0xd055('0x47')](handleError(_0x1ba175,null));};exports[_0xd055('0x4a')]=function(_0xe89ec5,_0x5605d8){return db[_0xd055('0x31')][_0xd055('0x4a')](_0xe89ec5[_0xd055('0x4b')],{})[_0xd055('0x29')](respondWithResult(_0x5605d8,0xc9))['catch'](handleError(_0x5605d8,null));};exports['update']=function(_0x4e0f53,_0x406234){if(_0x4e0f53[_0xd055('0x4b')]['id']){delete _0x4e0f53[_0xd055('0x4b')]['id'];}return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x4e0f53['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x406234,null))[_0xd055('0x29')](saveUpdates(_0x4e0f53[_0xd055('0x4b')],null))[_0xd055('0x29')](respondWithResult(_0x406234,null))['catch'](handleError(_0x406234,null));};exports['destroy']=function(_0x13e747,_0x22ef69){return db[_0xd055('0x31')]['find']({'where':{'id':_0x13e747['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x22ef69,null))[_0xd055('0x29')](removeEntity(_0x22ef69,null))[_0xd055('0x47')](handleError(_0x22ef69,null));};exports['describe']=function(_0x1e8b50,_0x5ea1bd){return db['ChatGroup'][_0xd055('0x4c')]()[_0xd055('0x29')](respondWithResult(_0x5ea1bd,null))[_0xd055('0x47')](handleError(_0x5ea1bd,null));};exports[_0xd055('0x4d')]=function(_0x30cf1d,_0x2990e4,_0x5e15a7){return db[_0xd055('0x4e')][_0xd055('0x24')]({'where':{'ChatGroupId':_0x30cf1d['params']['id'],'ToId':_0x30cf1d[_0xd055('0x4f')]['id'],'read':![]}})[_0xd055('0x29')](function(_0x1205ed){return{'id':_['toInteger'](_0x30cf1d['params']['id']),'count':_0x1205ed};})[_0xd055('0x29')](respondWithResult(_0x2990e4,null))['catch'](handleError(_0x2990e4,null));};exports[_0xd055('0x50')]=function(_0xa1f45f,_0x4fcfc0,_0x27d52a){return db[_0xd055('0x31')]['find']({'where':{'id':_0xa1f45f[_0xd055('0x51')]['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x4fcfc0,null))[_0xd055('0x29')](function(_0xdca925){if(_0xdca925){return _0xdca925['addMembers'](_0xa1f45f['body']['ids'],_[_0xd055('0x52')](_0xa1f45f[_0xd055('0x4b')],[_0xd055('0x53'),'id'])||{});}})[_0xd055('0x29')](respondWithResult(_0x4fcfc0,null))[_0xd055('0x47')](handleError(_0x4fcfc0,null));};exports[_0xd055('0x54')]=function(_0x1c750b,_0x655a5,_0x3e29b1){var _0xf0b0c1={};var _0x6da66b={};var _0x4b96af;var _0x5d87fc;return db[_0xd055('0x31')][_0xd055('0x55')]({'where':{'id':_0x1c750b[_0xd055('0x51')]['id']}})['then'](handleEntityNotFound(_0x655a5,null))[_0xd055('0x29')](function(_0x249edc){if(_0x249edc){_0x4b96af=_0x249edc;_0x6da66b[_0xd055('0x36')]=_[_0xd055('0x38')](db[_0xd055('0x56')][_0xd055('0x32')]);_0x6da66b[_0xd055('0x37')]=_[_0xd055('0x38')](_0x1c750b[_0xd055('0x37')]);_0x6da66b[_0xd055('0x39')]=_[_0xd055('0x3a')](_0x6da66b[_0xd055('0x36')],_0x6da66b[_0xd055('0x37')]);_0xf0b0c1[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0x6da66b[_0xd055('0x36')],qs['fields'](_0x1c750b[_0xd055('0x37')][_0xd055('0x3b')]));_0xf0b0c1[_0xd055('0x3c')]=_0xf0b0c1[_0xd055('0x3c')][_0xd055('0x3d')]?_0xf0b0c1['attributes']:_0x6da66b['model'];_0xf0b0c1[_0xd055('0x3f')]=qs['sort'](_0x1c750b[_0xd055('0x37')]['sort']);_0xf0b0c1[_0xd055('0x41')]=qs[_0xd055('0x39')](_[_0xd055('0x42')](_0x1c750b[_0xd055('0x37')],_0x6da66b[_0xd055('0x39')]));if(_0x1c750b[_0xd055('0x37')][_0xd055('0x57')]){_0xf0b0c1[_0xd055('0x41')]=_[_0xd055('0x43')](_0xf0b0c1[_0xd055('0x41')],{'$or':_[_0xd055('0x30')](_0xf0b0c1['attributes'],function(_0x55dcd0){var _0xe3dae={};_0xe3dae[_0x55dcd0]={'$like':'%'+_0x1c750b[_0xd055('0x37')][_0xd055('0x57')]+'%'};return _0xe3dae;})});}_0xf0b0c1=_[_0xd055('0x43')]({},_0xf0b0c1,_0x1c750b['options']);return _0x4b96af[_0xd055('0x54')](_0xf0b0c1);}})[_0xd055('0x29')](function(_0x4e8d36){if(_0x4e8d36){_0x5d87fc=_0x4e8d36[_0xd055('0x3d')];if(!_0x1c750b[_0xd055('0x37')][_0xd055('0x58')]('nolimit')){_0xf0b0c1[_0xd055('0x23')]=qs['limit'](_0x1c750b[_0xd055('0x37')][_0xd055('0x23')]);_0xf0b0c1[_0xd055('0x21')]=qs[_0xd055('0x21')](_0x1c750b[_0xd055('0x37')][_0xd055('0x21')]);}return _0x4b96af[_0xd055('0x54')](_0xf0b0c1);}})[_0xd055('0x29')](function(_0x51a7ce){if(_0x51a7ce){return _0x51a7ce?{'count':_0x5d87fc,'rows':_0x51a7ce}:null;}})[_0xd055('0x29')](respondWithResult(_0x655a5,null))[_0xd055('0x47')](handleError(_0x655a5,null));};exports[_0xd055('0x59')]=function(_0x47550e,_0x2cc944,_0x1cfe6d){return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x47550e[_0xd055('0x51')]['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x2cc944,null))[_0xd055('0x29')](function(_0x32d877){if(_0x32d877){return _0x32d877[_0xd055('0x59')](_0x47550e[_0xd055('0x37')][_0xd055('0x53')]);}})[_0xd055('0x29')](respondWithStatusCode(_0x2cc944,null))[_0xd055('0x47')](handleError(_0x2cc944,null));};exports[_0xd055('0x5a')]=function(_0x739a8c,_0x47369d,_0x3eda5d){if(_0x739a8c[_0xd055('0x4b')]['id']){delete _0x739a8c[_0xd055('0x4b')]['id'];}return db['ChatGroup'][_0xd055('0x49')]({'where':{'id':_0x739a8c[_0xd055('0x51')]['id']}})['then'](handleEntityNotFound(_0x47369d,null))['then'](function(_0x33d1b2){if(_0x33d1b2){_0x739a8c[_0xd055('0x4b')][_0xd055('0x5b')]=_0x33d1b2['id'];return db[_0xd055('0x4e')]['create'](_0x739a8c[_0xd055('0x4b')]);}})[_0xd055('0x29')](respondWithResult(_0x47369d,null))[_0xd055('0x47')](handleError(_0x47369d,null));};exports[_0xd055('0x5c')]=function(_0x97636a,_0x674a6d,_0x4a747d){var _0x23db21={};var _0x1e4fe6={};var _0xa818b0;var _0x4346ef;return db[_0xd055('0x31')][_0xd055('0x55')]({'where':{'id':_0x97636a['params']['id']}})[_0xd055('0x29')](handleEntityNotFound(_0x674a6d,null))[_0xd055('0x29')](function(_0xb0dcf3){if(_0xb0dcf3){_0xa818b0=_0xb0dcf3;_0x1e4fe6[_0xd055('0x36')]=_['keys'](db[_0xd055('0x4e')][_0xd055('0x32')]);_0x1e4fe6[_0xd055('0x37')]=_[_0xd055('0x38')](_0x97636a[_0xd055('0x37')]);_0x1e4fe6['filters']=_[_0xd055('0x3a')](_0x1e4fe6[_0xd055('0x36')],_0x1e4fe6[_0xd055('0x37')]);_0x23db21[_0xd055('0x3c')]=_[_0xd055('0x3a')](_0x1e4fe6[_0xd055('0x36')],qs[_0xd055('0x3b')](_0x97636a[_0xd055('0x37')]['fields']));_0x23db21[_0xd055('0x3c')]=_0x23db21[_0xd055('0x3c')][_0xd055('0x3d')]?_0x23db21['attributes']:_0x1e4fe6[_0xd055('0x36')];_0x23db21[_0xd055('0x3f')]=qs[_0xd055('0x40')](_0x97636a[_0xd055('0x37')][_0xd055('0x40')]);_0x23db21[_0xd055('0x41')]=qs[_0xd055('0x39')](_['pick'](_0x97636a[_0xd055('0x37')],_0x1e4fe6[_0xd055('0x39')]));if(_0x97636a[_0xd055('0x37')][_0xd055('0x57')]){_0x23db21[_0xd055('0x41')]=_[_0xd055('0x43')](_0x23db21[_0xd055('0x41')],{'$or':_[_0xd055('0x30')](_0x23db21[_0xd055('0x3c')],function(_0x2ff0e8){var _0x53bfeb={};_0x53bfeb[_0x2ff0e8]={'$like':'%'+_0x97636a[_0xd055('0x37')][_0xd055('0x57')]+'%'};return _0x53bfeb;})});}if(_0x97636a[_0xd055('0x37')][_0xd055('0x5d')]){var _0x1300c3=_0x97636a[_0xd055('0x37')]['$gte'][_0xd055('0x5e')](',');var _0x4da58a={};_0x4da58a[_0x1300c3[0x0]]={'$gte':moment(_0x1300c3[0x1])['format'](_0xd055('0x5f'))};_0x23db21[_0xd055('0x41')]=_[_0xd055('0x43')](_0x23db21['where'],_0x4da58a);}_0x23db21=_[_0xd055('0x43')]({},_0x23db21,_0x97636a[_0xd055('0x44')]);return _0xa818b0['getMessages'](_0x23db21);}})[_0xd055('0x29')](function(_0x5c6db6){if(_0x5c6db6){_0x4346ef=_0x5c6db6['length'];if(!_0x97636a[_0xd055('0x37')][_0xd055('0x58')](_0xd055('0x3e'))){_0x23db21[_0xd055('0x23')]=qs[_0xd055('0x23')](_0x97636a['query']['limit']);_0x23db21[_0xd055('0x21')]=qs[_0xd055('0x21')](_0x97636a['query'][_0xd055('0x21')]);}return _0xa818b0[_0xd055('0x5c')](_0x23db21);}})[_0xd055('0x29')](function(_0x1db659){if(_0x1db659){return _0x1db659?{'count':_0x4346ef,'rows':_0x1db659}:null;}})['then'](respondWithResult(_0x674a6d,null))['catch'](handleError(_0x674a6d,null));}; \ No newline at end of file +var _0x5df4=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','update','then','end','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','user','addMembers','ids','omit','getMembers','findOne','User','nolimit','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x130f68,_0xee14be){var _0x322e5b=function(_0x32e32d){while(--_0x32e32d){_0x130f68['push'](_0x130f68['shift']());}};_0x322e5b(++_0xee14be);}(_0x5df4,0x174));var _0x45df=function(_0x31a8a7,_0x3e412b){_0x31a8a7=_0x31a8a7-0x0;var _0x570eec=_0x5df4[_0x31a8a7];return _0x570eec;};'use strict';var emlformat=require(_0x45df('0x0'));var rimraf=require(_0x45df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x45df('0x2'));var rp=require('request-promise');var moment=require(_0x45df('0x3'));var BPromise=require(_0x45df('0x4'));var Mustache=require(_0x45df('0x5'));var util=require(_0x45df('0x6'));var path=require(_0x45df('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x45df('0x8'));var fs=require('fs');var fs_extra=require(_0x45df('0x9'));var _=require(_0x45df('0xa'));var squel=require(_0x45df('0xb'));var crypto=require(_0x45df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x45df('0xd'));var toCsv=require(_0x45df('0xe'));var querystring=require('querystring');var Papa=require(_0x45df('0xf'));var Redis=require(_0x45df('0x10'));var authService=require(_0x45df('0x11'));var qs=require(_0x45df('0x12'));var as=require(_0x45df('0x13'));var hardwareService=require(_0x45df('0x14'));var logger=require(_0x45df('0x15'))(_0x45df('0x16'));var utils=require(_0x45df('0x17'));var config=require(_0x45df('0x18'));var licenseUtil=require(_0x45df('0x19'));var db=require(_0x45df('0x1a'))['db'];config[_0x45df('0x1b')]=_['defaults'](config[_0x45df('0x1b')],{'host':_0x45df('0x1c'),'port':0x18eb});var socket=require(_0x45df('0x1d'))(new Redis(config[_0x45df('0x1b')]));require(_0x45df('0x1e'))['register'](socket);function respondWithStatusCode(_0x47e5fe,_0x4da098){_0x4da098=_0x4da098||0xcc;return function(_0x17b25b){if(_0x17b25b){return _0x47e5fe[_0x45df('0x1f')](_0x4da098);}return _0x47e5fe['status'](_0x4da098)['end']();};}function respondWithResult(_0x29a375,_0x4bf4f9){_0x4bf4f9=_0x4bf4f9||0xc8;return function(_0x15e0f0){if(_0x15e0f0){return _0x29a375[_0x45df('0x20')](_0x4bf4f9)[_0x45df('0x21')](_0x15e0f0);}};}function respondWithFilteredResult(_0x3cfe12,_0x49c4d5){return function(_0x5ad38e){if(_0x5ad38e){var _0x4bd7eb=typeof _0x49c4d5[_0x45df('0x22')]==='undefined'&&typeof _0x49c4d5[_0x45df('0x23')]==='undefined';var _0x7e3af3=_0x5ad38e[_0x45df('0x24')];var _0x150b86=_0x4bd7eb?0x0:_0x49c4d5['offset'];var _0x1b66e8=_0x4bd7eb?_0x5ad38e[_0x45df('0x24')]:_0x49c4d5[_0x45df('0x22')]+_0x49c4d5[_0x45df('0x23')];var _0x55a779;if(_0x1b66e8>=_0x7e3af3){_0x1b66e8=_0x7e3af3;_0x55a779=0xc8;}else{_0x55a779=0xce;}_0x3cfe12['status'](_0x55a779);return _0x3cfe12[_0x45df('0x25')](_0x45df('0x26'),_0x150b86+'-'+_0x1b66e8+'/'+_0x7e3af3)['json'](_0x5ad38e);}return null;};}function patchUpdates(_0x22f8b1){return function(_0x1c9e13){try{jsonpatch['apply'](_0x1c9e13,_0x22f8b1,!![]);}catch(_0x443801){return BPromise[_0x45df('0x27')](_0x443801);}return _0x1c9e13['save']();};}function saveUpdates(_0x459fbb,_0x4139d9){return function(_0x5841fd){if(_0x5841fd){return _0x5841fd[_0x45df('0x28')](_0x459fbb)[_0x45df('0x29')](function(_0x480783){return _0x480783;});}return null;};}function removeEntity(_0x72d949,_0x4a3114){return function(_0x3333ed){if(_0x3333ed){return _0x3333ed['destroy']()[_0x45df('0x29')](function(){_0x72d949['status'](0xcc)[_0x45df('0x2a')]();});}};}function handleEntityNotFound(_0x1d8ebc,_0x468d8f){return function(_0x3e2e4d){if(!_0x3e2e4d){_0x1d8ebc[_0x45df('0x1f')](0x194);}return _0x3e2e4d;};}function handleError(_0x4c810c,_0x595c00){_0x595c00=_0x595c00||0x1f4;return function(_0x3e56b6){logger[_0x45df('0x2b')](_0x3e56b6[_0x45df('0x2c')]);if(_0x3e56b6['name']){delete _0x3e56b6[_0x45df('0x2d')];}_0x4c810c[_0x45df('0x20')](_0x595c00)[_0x45df('0x2e')](_0x3e56b6);};}exports[_0x45df('0x2f')]=function(_0x69b102,_0x5cec55){var _0xc2bbbd={},_0x30e7f5={},_0x3de571={'count':0x0,'rows':[]};var _0x1ed24d=_[_0x45df('0x30')](db[_0x45df('0x31')]['rawAttributes'],function(_0x5f3e89){return{'name':_0x5f3e89[_0x45df('0x32')],'type':_0x5f3e89[_0x45df('0x33')][_0x45df('0x34')]};});_0x30e7f5[_0x45df('0x35')]=_[_0x45df('0x30')](_0x1ed24d,_0x45df('0x2d'));_0x30e7f5['query']=_[_0x45df('0x36')](_0x69b102[_0x45df('0x37')]);_0x30e7f5['filters']=_[_0x45df('0x38')](_0x30e7f5[_0x45df('0x35')],_0x30e7f5[_0x45df('0x37')]);_0xc2bbbd[_0x45df('0x39')]=_[_0x45df('0x38')](_0x30e7f5['model'],qs['fields'](_0x69b102['query'][_0x45df('0x3a')]));_0xc2bbbd[_0x45df('0x39')]=_0xc2bbbd['attributes'][_0x45df('0x3b')]?_0xc2bbbd[_0x45df('0x39')]:_0x30e7f5['model'];if(!_0x69b102[_0x45df('0x37')][_0x45df('0x3c')]('nolimit')){_0xc2bbbd[_0x45df('0x23')]=qs['limit'](_0x69b102[_0x45df('0x37')]['limit']);_0xc2bbbd[_0x45df('0x22')]=qs[_0x45df('0x22')](_0x69b102[_0x45df('0x37')][_0x45df('0x22')]);}_0xc2bbbd[_0x45df('0x3d')]=qs[_0x45df('0x3e')](_0x69b102['query'][_0x45df('0x3e')]);_0xc2bbbd[_0x45df('0x3f')]=qs[_0x45df('0x40')](_[_0x45df('0x41')](_0x69b102[_0x45df('0x37')],_0x30e7f5[_0x45df('0x40')]),_0x1ed24d);if(_0x69b102[_0x45df('0x37')][_0x45df('0x42')]){_0xc2bbbd['where']=_['merge'](_0xc2bbbd[_0x45df('0x3f')],{'$or':_[_0x45df('0x30')](_0x1ed24d,function(_0x3519fa){if(_0x3519fa[_0x45df('0x33')]!==_0x45df('0x43')){var _0x6f590={};_0x6f590[_0x3519fa[_0x45df('0x2d')]]={'$like':'%'+_0x69b102[_0x45df('0x37')][_0x45df('0x42')]+'%'};return _0x6f590;}})});}_0xc2bbbd=_[_0x45df('0x44')]({},_0xc2bbbd,_0x69b102[_0x45df('0x45')]);var _0x15378c={'where':_0xc2bbbd['where']};return db[_0x45df('0x31')]['count'](_0x15378c)[_0x45df('0x29')](function(_0x434d35){_0x3de571[_0x45df('0x24')]=_0x434d35;if(_0x69b102['query'][_0x45df('0x46')]){_0xc2bbbd['include']=[{'all':!![]}];}return db[_0x45df('0x31')][_0x45df('0x47')](_0xc2bbbd);})[_0x45df('0x29')](function(_0x51f908){_0x3de571[_0x45df('0x48')]=_0x51f908;return _0x3de571;})[_0x45df('0x29')](respondWithFilteredResult(_0x5cec55,_0xc2bbbd))[_0x45df('0x49')](handleError(_0x5cec55,null));};exports[_0x45df('0x4a')]=function(_0x1a7fa7,_0x3ceaaf){var _0x2b4ef7={'raw':!![],'where':{'id':_0x1a7fa7[_0x45df('0x4b')]['id']}},_0xad40f7={};_0xad40f7[_0x45df('0x35')]=_[_0x45df('0x36')](db[_0x45df('0x31')][_0x45df('0x4c')]);_0xad40f7[_0x45df('0x37')]=_[_0x45df('0x36')](_0x1a7fa7['query']);_0xad40f7[_0x45df('0x40')]=_[_0x45df('0x38')](_0xad40f7[_0x45df('0x35')],_0xad40f7['query']);_0x2b4ef7[_0x45df('0x39')]=_[_0x45df('0x38')](_0xad40f7['model'],qs[_0x45df('0x3a')](_0x1a7fa7[_0x45df('0x37')][_0x45df('0x3a')]));_0x2b4ef7[_0x45df('0x39')]=_0x2b4ef7['attributes'][_0x45df('0x3b')]?_0x2b4ef7[_0x45df('0x39')]:_0xad40f7['model'];if(_0x1a7fa7[_0x45df('0x37')][_0x45df('0x46')]){_0x2b4ef7[_0x45df('0x4d')]=[{'all':!![]}];}_0x2b4ef7=_[_0x45df('0x44')]({},_0x2b4ef7,_0x1a7fa7[_0x45df('0x45')]);return db[_0x45df('0x31')][_0x45df('0x4e')](_0x2b4ef7)['then'](handleEntityNotFound(_0x3ceaaf,null))[_0x45df('0x29')](respondWithResult(_0x3ceaaf,null))[_0x45df('0x49')](handleError(_0x3ceaaf,null));};exports[_0x45df('0x4f')]=function(_0x87556c,_0x3f56e7){return db[_0x45df('0x31')]['create'](_0x87556c[_0x45df('0x50')],{})[_0x45df('0x29')](respondWithResult(_0x3f56e7,0xc9))[_0x45df('0x49')](handleError(_0x3f56e7,null));};exports[_0x45df('0x28')]=function(_0x415dc8,_0x2b7fd1){if(_0x415dc8[_0x45df('0x50')]['id']){delete _0x415dc8[_0x45df('0x50')]['id'];}return db['ChatGroup'][_0x45df('0x4e')]({'where':{'id':_0x415dc8['params']['id']}})[_0x45df('0x29')](handleEntityNotFound(_0x2b7fd1,null))[_0x45df('0x29')](saveUpdates(_0x415dc8['body'],null))[_0x45df('0x29')](respondWithResult(_0x2b7fd1,null))['catch'](handleError(_0x2b7fd1,null));};exports['destroy']=function(_0x5df52f,_0x525a21){return db['ChatGroup'][_0x45df('0x4e')]({'where':{'id':_0x5df52f[_0x45df('0x4b')]['id']}})['then'](handleEntityNotFound(_0x525a21,null))[_0x45df('0x29')](removeEntity(_0x525a21,null))['catch'](handleError(_0x525a21,null));};exports[_0x45df('0x51')]=function(_0x10d677,_0x2485ca){return db[_0x45df('0x31')]['describe']()[_0x45df('0x29')](respondWithResult(_0x2485ca,null))[_0x45df('0x49')](handleError(_0x2485ca,null));};exports['getUnread']=function(_0x29c909,_0x87b61f,_0x17f8c1){return db['ChatInternalMessage'][_0x45df('0x24')]({'where':{'ChatGroupId':_0x29c909[_0x45df('0x4b')]['id'],'ToId':_0x29c909[_0x45df('0x52')]['id'],'read':![]}})['then'](function(_0x1756d7){return{'id':_['toInteger'](_0x29c909[_0x45df('0x4b')]['id']),'count':_0x1756d7};})['then'](respondWithResult(_0x87b61f,null))['catch'](handleError(_0x87b61f,null));};exports[_0x45df('0x53')]=function(_0x332148,_0x44d5ee,_0x259c29){return db[_0x45df('0x31')][_0x45df('0x4e')]({'where':{'id':_0x332148[_0x45df('0x4b')]['id']}})[_0x45df('0x29')](handleEntityNotFound(_0x44d5ee,null))[_0x45df('0x29')](function(_0x4038eb){if(_0x4038eb){return _0x4038eb[_0x45df('0x53')](_0x332148[_0x45df('0x50')][_0x45df('0x54')],_[_0x45df('0x55')](_0x332148[_0x45df('0x50')],[_0x45df('0x54'),'id'])||{});}})['then'](respondWithResult(_0x44d5ee,null))[_0x45df('0x49')](handleError(_0x44d5ee,null));};exports[_0x45df('0x56')]=function(_0x277964,_0x1062da,_0x4f20b9){var _0x2540d6={};var _0x28413e={};var _0x3f2040;var _0x3f7d38;return db['ChatGroup'][_0x45df('0x57')]({'where':{'id':_0x277964['params']['id']}})[_0x45df('0x29')](handleEntityNotFound(_0x1062da,null))[_0x45df('0x29')](function(_0x57d750){if(_0x57d750){_0x3f2040=_0x57d750;_0x28413e[_0x45df('0x35')]=_[_0x45df('0x36')](db[_0x45df('0x58')][_0x45df('0x4c')]);_0x28413e[_0x45df('0x37')]=_['keys'](_0x277964[_0x45df('0x37')]);_0x28413e[_0x45df('0x40')]=_[_0x45df('0x38')](_0x28413e[_0x45df('0x35')],_0x28413e[_0x45df('0x37')]);_0x2540d6[_0x45df('0x39')]=_[_0x45df('0x38')](_0x28413e[_0x45df('0x35')],qs[_0x45df('0x3a')](_0x277964[_0x45df('0x37')][_0x45df('0x3a')]));_0x2540d6[_0x45df('0x39')]=_0x2540d6[_0x45df('0x39')][_0x45df('0x3b')]?_0x2540d6[_0x45df('0x39')]:_0x28413e['model'];_0x2540d6[_0x45df('0x3d')]=qs[_0x45df('0x3e')](_0x277964[_0x45df('0x37')][_0x45df('0x3e')]);_0x2540d6[_0x45df('0x3f')]=qs[_0x45df('0x40')](_[_0x45df('0x41')](_0x277964['query'],_0x28413e['filters']));if(_0x277964[_0x45df('0x37')][_0x45df('0x42')]){_0x2540d6[_0x45df('0x3f')]=_[_0x45df('0x44')](_0x2540d6['where'],{'$or':_[_0x45df('0x30')](_0x2540d6[_0x45df('0x39')],function(_0xb8c927){var _0x4750c0={};_0x4750c0[_0xb8c927]={'$like':'%'+_0x277964[_0x45df('0x37')][_0x45df('0x42')]+'%'};return _0x4750c0;})});}_0x2540d6=_['merge']({},_0x2540d6,_0x277964[_0x45df('0x45')]);return _0x3f2040[_0x45df('0x56')](_0x2540d6);}})[_0x45df('0x29')](function(_0x5c7bbc){if(_0x5c7bbc){_0x3f7d38=_0x5c7bbc[_0x45df('0x3b')];if(!_0x277964[_0x45df('0x37')][_0x45df('0x3c')](_0x45df('0x59'))){_0x2540d6['limit']=qs[_0x45df('0x23')](_0x277964[_0x45df('0x37')][_0x45df('0x23')]);_0x2540d6['offset']=qs[_0x45df('0x22')](_0x277964[_0x45df('0x37')][_0x45df('0x22')]);}return _0x3f2040['getMembers'](_0x2540d6);}})[_0x45df('0x29')](function(_0x59d194){if(_0x59d194){return _0x59d194?{'count':_0x3f7d38,'rows':_0x59d194}:null;}})[_0x45df('0x29')](respondWithResult(_0x1062da,null))[_0x45df('0x49')](handleError(_0x1062da,null));};exports['removeMembers']=function(_0x1e0061,_0x7e7276,_0x1d0176){return db[_0x45df('0x31')][_0x45df('0x4e')]({'where':{'id':_0x1e0061[_0x45df('0x4b')]['id']}})[_0x45df('0x29')](handleEntityNotFound(_0x7e7276,null))[_0x45df('0x29')](function(_0xfcd042){if(_0xfcd042){return _0xfcd042[_0x45df('0x5a')](_0x1e0061['query']['ids']);}})[_0x45df('0x29')](respondWithStatusCode(_0x7e7276,null))[_0x45df('0x49')](handleError(_0x7e7276,null));};exports['addMessage']=function(_0x1184f7,_0x59d1ca,_0x51aaf6){if(_0x1184f7[_0x45df('0x50')]['id']){delete _0x1184f7[_0x45df('0x50')]['id'];}return db[_0x45df('0x31')][_0x45df('0x4e')]({'where':{'id':_0x1184f7[_0x45df('0x4b')]['id']}})['then'](handleEntityNotFound(_0x59d1ca,null))['then'](function(_0x41c86c){if(_0x41c86c){_0x1184f7[_0x45df('0x50')][_0x45df('0x5b')]=_0x41c86c['id'];return db[_0x45df('0x5c')][_0x45df('0x4f')](_0x1184f7['body']);}})['then'](respondWithResult(_0x59d1ca,null))[_0x45df('0x49')](handleError(_0x59d1ca,null));};exports[_0x45df('0x5d')]=function(_0x190c8f,_0x2b42cb,_0x145807){var _0x324010={};var _0x2cb64d={};var _0x401460;var _0x383f2b;return db['ChatGroup'][_0x45df('0x57')]({'where':{'id':_0x190c8f[_0x45df('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b42cb,null))[_0x45df('0x29')](function(_0x41ddca){if(_0x41ddca){_0x401460=_0x41ddca;_0x2cb64d[_0x45df('0x35')]=_[_0x45df('0x36')](db[_0x45df('0x5c')][_0x45df('0x4c')]);_0x2cb64d[_0x45df('0x37')]=_[_0x45df('0x36')](_0x190c8f['query']);_0x2cb64d[_0x45df('0x40')]=_[_0x45df('0x38')](_0x2cb64d[_0x45df('0x35')],_0x2cb64d[_0x45df('0x37')]);_0x324010[_0x45df('0x39')]=_['intersection'](_0x2cb64d[_0x45df('0x35')],qs[_0x45df('0x3a')](_0x190c8f[_0x45df('0x37')][_0x45df('0x3a')]));_0x324010[_0x45df('0x39')]=_0x324010[_0x45df('0x39')][_0x45df('0x3b')]?_0x324010[_0x45df('0x39')]:_0x2cb64d['model'];_0x324010[_0x45df('0x3d')]=qs[_0x45df('0x3e')](_0x190c8f['query'][_0x45df('0x3e')]);_0x324010[_0x45df('0x3f')]=qs['filters'](_['pick'](_0x190c8f[_0x45df('0x37')],_0x2cb64d[_0x45df('0x40')]));if(_0x190c8f['query'][_0x45df('0x42')]){_0x324010[_0x45df('0x3f')]=_[_0x45df('0x44')](_0x324010[_0x45df('0x3f')],{'$or':_[_0x45df('0x30')](_0x324010[_0x45df('0x39')],function(_0x371594){var _0x369354={};_0x369354[_0x371594]={'$like':'%'+_0x190c8f['query']['filter']+'%'};return _0x369354;})});}if(_0x190c8f[_0x45df('0x37')][_0x45df('0x5e')]){var _0x30d268=_0x190c8f[_0x45df('0x37')]['$gte'][_0x45df('0x5f')](',');var _0x5f5b81={};_0x5f5b81[_0x30d268[0x0]]={'$gte':moment(_0x30d268[0x1])[_0x45df('0x60')](_0x45df('0x61'))};_0x324010['where']=_[_0x45df('0x44')](_0x324010[_0x45df('0x3f')],_0x5f5b81);}_0x324010=_['merge']({},_0x324010,_0x190c8f[_0x45df('0x45')]);return _0x401460[_0x45df('0x5d')](_0x324010);}})[_0x45df('0x29')](function(_0x8bc254){if(_0x8bc254){_0x383f2b=_0x8bc254[_0x45df('0x3b')];if(!_0x190c8f[_0x45df('0x37')][_0x45df('0x3c')](_0x45df('0x59'))){_0x324010['limit']=qs[_0x45df('0x23')](_0x190c8f[_0x45df('0x37')][_0x45df('0x23')]);_0x324010['offset']=qs[_0x45df('0x22')](_0x190c8f['query'][_0x45df('0x22')]);}return _0x401460[_0x45df('0x5d')](_0x324010);}})[_0x45df('0x29')](function(_0x49fa4f){if(_0x49fa4f){return _0x49fa4f?{'count':_0x383f2b,'rows':_0x49fa4f}:null;}})[_0x45df('0x29')](respondWithResult(_0x2b42cb,null))[_0x45df('0x49')](handleError(_0x2b42cb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5a62664..146ff98 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9ef=['events','ChatGroup','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2020b6,_0x2ff986){var _0x2e0f62=function(_0x3dbe24){while(--_0x3dbe24){_0x2020b6['push'](_0x2020b6['shift']());}};_0x2e0f62(++_0x2ff986);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0xe9ef[_0x2431d6];return _0x4d0f9b;};'use strict';var EventEmitter=require(_0xfe9e('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfe9e('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfe9e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23904d){return function(_0x45bf15,_0x199f65,_0x20d75f){ChatGroupEvents['emit'](_0x23904d+':'+_0x45bf15['id'],_0x45bf15);ChatGroupEvents[_0xfe9e('0x4')](_0x23904d,_0x45bf15);_0x20d75f(null);};}for(var e in events){if(events[_0xfe9e('0x5')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x50a8=['emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x471755,_0x4be55e){var _0x3da75c=function(_0x457618){while(--_0x457618){_0x471755['push'](_0x471755['shift']());}};_0x3da75c(++_0x4be55e);}(_0x50a8,0x193));var _0x850a=function(_0x1120c7,_0x18f931){_0x1120c7=_0x1120c7-0x0;var _0x436f8a=_0x50a8[_0x1120c7];return _0x436f8a;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x850a('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x850a('0x1')](0x0);var events={'afterCreate':_0x850a('0x2'),'afterUpdate':_0x850a('0x3'),'afterDestroy':_0x850a('0x4')};function emitEvent(_0x5a43e8){return function(_0x5458e6,_0x5ca0f6,_0x412055){ChatGroupEvents[_0x850a('0x5')](_0x5a43e8+':'+_0x5458e6['id'],_0x5458e6);ChatGroupEvents['emit'](_0x5a43e8,_0x5458e6);_0x412055(null);};}for(var e in events){if(events[_0x850a('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x850a('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 4c4fd1c..4b7c778 100644 --- a/server/api/chatGroup/chatGroup.model.js +++ b/server/api/chatGroup/chatGroup.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1271=['../../config/environment','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5beeb7,_0xeeac1b){var _0x5126bf=function(_0x2d115d){while(--_0x2d115d){_0x5beeb7['push'](_0x5beeb7['shift']());}};_0x5126bf(++_0xeeac1b);}(_0x1271,0x1e8));var _0x1127=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0x1271[_0xe9f4a2];return _0x25e066;};'use strict';var _=require(_0x1127('0x0'));var util=require('util');var logger=require(_0x1127('0x1'))(_0x1127('0x2'));var moment=require(_0x1127('0x3'));var BPromise=require(_0x1127('0x4'));var rp=require(_0x1127('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1127('0x6'));var config=require(_0x1127('0x7'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x37a09e,_0x35bd89){return _0x37a09e['define']('ChatGroup',attributes,{'tableName':_0x1127('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d30=['define','chat_groups','moment','bluebird','path','../../config/environment','exports'];(function(_0xd90442,_0x33553d){var _0x2bef72=function(_0x2f30aa){while(--_0x2f30aa){_0xd90442['push'](_0xd90442['shift']());}};_0x2bef72(++_0x33553d);}(_0x8d30,0x87));var _0x08d3=function(_0x5a037a,_0x44a3fc){_0x5a037a=_0x5a037a-0x0;var _0x28ff57=_0x8d30[_0x5a037a];return _0x28ff57;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x08d3('0x0'));var BPromise=require(_0x08d3('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08d3('0x2'));var rimraf=require('rimraf');var config=require(_0x08d3('0x3'));var attributes=require('./chatGroup.attributes');module[_0x08d3('0x4')]=function(_0x541641,_0x5bc84c){return _0x541641[_0x08d3('0x5')]('ChatGroup',attributes,{'tableName':_0x08d3('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5ff7fed..04272c2 100644 --- a/server/api/chatGroup/chatGroup.rpc.js +++ b/server/api/chatGroup/chatGroup.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd7b=['error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0xfd7b[_0x3b96cf];return _0x2e315a;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});config['redis']=_[_0xbfd7('0xd')](config['redis'],{'host':_0xbfd7('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfd7('0xf')]));require(_0xbfd7('0x10'))[_0xbfd7('0x11')](socket);function respondWithRpcPromise(_0x3b7670,_0x47e7c2,_0x19e7bc){return new BPromise(function(_0x14c84b,_0x5d5b48){return client['request'](_0x3b7670,_0x19e7bc)[_0xbfd7('0x12')](function(_0x45606b){logger[_0xbfd7('0x13')](_0xbfd7('0x14'),_0x47e7c2,_0xbfd7('0x15'));logger['debug'](_0xbfd7('0x16'),_0x47e7c2,'request\x20sent',JSON[_0xbfd7('0x17')](_0x45606b));if(_0x45606b['error']){if(_0x45606b['error'][_0xbfd7('0x18')]===0x1f4){logger[_0xbfd7('0x19')](_0xbfd7('0x14'),_0x47e7c2,_0x45606b[_0xbfd7('0x19')]['message']);return _0x5d5b48(_0x45606b['error']['message']);}logger[_0xbfd7('0x19')](_0xbfd7('0x14'),_0x47e7c2,_0x45606b[_0xbfd7('0x19')][_0xbfd7('0x1a')]);return _0x14c84b(_0x45606b[_0xbfd7('0x19')][_0xbfd7('0x1a')]);}else{logger[_0xbfd7('0x13')](_0xbfd7('0x14'),_0x47e7c2,_0xbfd7('0x15'));_0x14c84b(_0x45606b['result']['message']);}})[_0xbfd7('0x1b')](function(_0x1ca43c){logger['error']('ChatGroup,\x20%s,\x20%s',_0x47e7c2,_0x1ca43c);_0x5d5b48(_0x1ca43c);});});} \ No newline at end of file +var _0xdcd0=['message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa85dbd,_0x2838a5){var _0x3be7aa=function(_0x2573f8){while(--_0x2573f8){_0xa85dbd['push'](_0xa85dbd['shift']());}};_0x3be7aa(++_0x2838a5);}(_0xdcd0,0xb9));var _0x0dcd=function(_0x5e93f0,_0x3ce01e){_0x5e93f0=_0x5e93f0-0x0;var _0x448e97=_0xdcd0[_0x5e93f0];return _0x448e97;};'use strict';var _=require(_0x0dcd('0x0'));var util=require('util');var moment=require(_0x0dcd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dcd('0x2'));var db=require(_0x0dcd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0dcd('0x4'))(_0x0dcd('0x5'));var config=require(_0x0dcd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0dcd('0x7')][_0x0dcd('0x8')]({'port':0x232a});config[_0x0dcd('0x9')]=_[_0x0dcd('0xa')](config['redis'],{'host':_0x0dcd('0xb'),'port':0x18eb});var socket=require(_0x0dcd('0xc'))(new Redis(config[_0x0dcd('0x9')]));require(_0x0dcd('0xd'))[_0x0dcd('0xe')](socket);function respondWithRpcPromise(_0x557a26,_0x151a5c,_0x58e254){return new BPromise(function(_0x556347,_0x4b55c1){return client['request'](_0x557a26,_0x58e254)[_0x0dcd('0xf')](function(_0x502756){logger[_0x0dcd('0x10')](_0x0dcd('0x11'),_0x151a5c,_0x0dcd('0x12'));logger[_0x0dcd('0x13')](_0x0dcd('0x14'),_0x151a5c,_0x0dcd('0x12'),JSON[_0x0dcd('0x15')](_0x502756));if(_0x502756['error']){if(_0x502756['error']['code']===0x1f4){logger[_0x0dcd('0x16')]('ChatGroup,\x20%s,\x20%s',_0x151a5c,_0x502756['error'][_0x0dcd('0x17')]);return _0x4b55c1(_0x502756['error']['message']);}logger[_0x0dcd('0x16')]('ChatGroup,\x20%s,\x20%s',_0x151a5c,_0x502756[_0x0dcd('0x16')][_0x0dcd('0x17')]);return _0x556347(_0x502756[_0x0dcd('0x16')][_0x0dcd('0x17')]);}else{logger[_0x0dcd('0x10')](_0x0dcd('0x11'),_0x151a5c,_0x0dcd('0x12'));_0x556347(_0x502756[_0x0dcd('0x18')][_0x0dcd('0x17')]);}})[_0x0dcd('0x19')](function(_0x368e45){logger[_0x0dcd('0x16')]('ChatGroup,\x20%s,\x20%s',_0x151a5c,_0x368e45);_0x4b55c1(_0x368e45);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9f139d4..6af8621 100644 --- a/server/api/chatGroup/chatGroup.socket.js +++ b/server/api/chatGroup/chatGroup.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa932=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x6f362f,_0x1853be){var _0x33d274=function(_0x5e3ae2){while(--_0x5e3ae2){_0x6f362f['push'](_0x6f362f['shift']());}};_0x33d274(++_0x1853be);}(_0xa932,0x1bd));var _0x2a93=function(_0x47bf8b,_0x5c377e){_0x47bf8b=_0x47bf8b-0x0;var _0x2d71ff=_0xa932[_0x47bf8b];return _0x2d71ff;};'use strict';var ChatGroupEvents=require(_0x2a93('0x0'));var events=[_0x2a93('0x1'),_0x2a93('0x2'),_0x2a93('0x3')];function createListener(_0x7513fe,_0x336154){return function(_0x4fe938){_0x336154['emit'](_0x7513fe,_0x4fe938);};}function removeListener(_0x2fc962,_0x490f2e){return function(){ChatGroupEvents[_0x2a93('0x4')](_0x2fc962,_0x490f2e);};}exports[_0x2a93('0x5')]=function(_0x130112){for(var _0x198b17=0x0,_0x5d4ede=events[_0x2a93('0x6')];_0x198b17<_0x5d4ede;_0x198b17++){var _0x44729e=events[_0x198b17];var _0x203fc1=createListener(_0x2a93('0x7')+_0x44729e,_0x130112);ChatGroupEvents['on'](_0x44729e,_0x203fc1);}}; \ No newline at end of file +var _0x76ce=['length','chatGroup:','./chatGroup.events','remove','register'];(function(_0x1b2cc7,_0x491327){var _0x3cbbcd=function(_0x142487){while(--_0x142487){_0x1b2cc7['push'](_0x1b2cc7['shift']());}};_0x3cbbcd(++_0x491327);}(_0x76ce,0x9d));var _0xe76c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x76ce[_0xbca1b1];return _0x4e1686;};'use strict';var ChatGroupEvents=require(_0xe76c('0x0'));var events=['save',_0xe76c('0x1'),'update'];function createListener(_0x19399f,_0x58d78b){return function(_0x5e7d4e){_0x58d78b['emit'](_0x19399f,_0x5e7d4e);};}function removeListener(_0x30c238,_0x28527c){return function(){ChatGroupEvents['removeListener'](_0x30c238,_0x28527c);};}exports[_0xe76c('0x2')]=function(_0x1fedb1){for(var _0xb6146=0x0,_0x50aaa0=events[_0xe76c('0x3')];_0xb6146<_0x50aaa0;_0xb6146++){var _0x4c2fb7=events[_0xb6146];var _0x537589=createListener(_0xe76c('0x4')+_0x4c2fb7,_0x1fedb1);ChatGroupEvents['on'](_0x4c2fb7,_0x537589);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index c0e77eb..42bad8a 100644 --- a/server/api/chatGroup/index.js +++ b/server/api/chatGroup/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb3b=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getMessages','create','post','addMembers','put','update','delete','destroy','removeMembers','exports','multer','path'];(function(_0x47825a,_0x2afee6){var _0x36a42f=function(_0x2aa672){while(--_0x2aa672){_0x47825a['push'](_0x47825a['shift']());}};_0x36a42f(++_0x2afee6);}(_0xcb3b,0x16a));var _0xbcb3=function(_0x603d70,_0x55420f){_0x603d70=_0x603d70-0x0;var _0xac2a32=_0xcb3b[_0x603d70];return _0xac2a32;};'use strict';var multer=require(_0xbcb3('0x0'));var util=require('util');var path=require(_0xbcb3('0x1'));var timeout=require(_0xbcb3('0x2'));var express=require(_0xbcb3('0x3'));var router=express[_0xbcb3('0x4')]();var fs_extra=require(_0xbcb3('0x5'));var auth=require(_0xbcb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcb3('0x7'));var controller=require(_0xbcb3('0x8'));router[_0xbcb3('0x9')]('/',auth[_0xbcb3('0xa')](),controller[_0xbcb3('0xb')]);router[_0xbcb3('0x9')](_0xbcb3('0xc'),auth[_0xbcb3('0xa')](),controller['describe']);router[_0xbcb3('0x9')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller['show']);router[_0xbcb3('0x9')]('/:id/unread',auth[_0xbcb3('0xa')](),controller['getUnread']);router['get'](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0xf')]);router['get']('/:id/messages',auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbcb3('0x11')]);router[_0xbcb3('0x12')](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x13')]);router[_0xbcb3('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0xbcb3('0x14')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x15')]);router[_0xbcb3('0x16')](_0xbcb3('0xd'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x17')]);router[_0xbcb3('0x16')](_0xbcb3('0xe'),auth[_0xbcb3('0xa')](),controller[_0xbcb3('0x18')]);module[_0xbcb3('0x19')]=router; \ No newline at end of file +var _0xc0b8=['/:id','show','/:id/unread','isAuthenticated','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','update','removeMembers','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','describe'];(function(_0x59464b,_0x64f5d4){var _0x475acc=function(_0x19e87a){while(--_0x19e87a){_0x59464b['push'](_0x59464b['shift']());}};_0x475acc(++_0x64f5d4);}(_0xc0b8,0x1e8));var _0x8c0b=function(_0x1d44b6,_0x24b55d){_0x1d44b6=_0x1d44b6-0x0;var _0x100577=_0xc0b8[_0x1d44b6];return _0x100577;};'use strict';var multer=require('multer');var util=require(_0x8c0b('0x0'));var path=require(_0x8c0b('0x1'));var timeout=require(_0x8c0b('0x2'));var express=require('express');var router=express[_0x8c0b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8c0b('0x4'));var interaction=require(_0x8c0b('0x5'));var config=require(_0x8c0b('0x6'));var controller=require(_0x8c0b('0x7'));router[_0x8c0b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c0b('0x9')]);router[_0x8c0b('0x8')](_0x8c0b('0xa'),auth['isAuthenticated'](),controller[_0x8c0b('0xb')]);router[_0x8c0b('0x8')](_0x8c0b('0xc'),auth['isAuthenticated'](),controller[_0x8c0b('0xd')]);router['get'](_0x8c0b('0xe'),auth[_0x8c0b('0xf')](),controller['getUnread']);router['get'](_0x8c0b('0x10'),auth[_0x8c0b('0xf')](),controller[_0x8c0b('0x11')]);router['get'](_0x8c0b('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x8c0b('0x13')]('/',auth[_0x8c0b('0xf')](),controller[_0x8c0b('0x14')]);router[_0x8c0b('0x13')](_0x8c0b('0x10'),auth[_0x8c0b('0xf')](),controller[_0x8c0b('0x15')]);router['post']('/:id/messages',auth[_0x8c0b('0xf')](),controller['addMessage']);router[_0x8c0b('0x16')](_0x8c0b('0xc'),auth['isAuthenticated'](),controller[_0x8c0b('0x17')]);router['delete'](_0x8c0b('0xc'),auth[_0x8c0b('0xf')](),controller['destroy']);router['delete'](_0x8c0b('0x10'),auth[_0x8c0b('0xf')](),controller[_0x8c0b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a53c4d4..196e4e4 100644 --- a/server/api/chatInteraction/chatInteraction.attributes.js +++ b/server/api/chatInteraction/chatInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x705f=['BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x287473,_0x20c8dc){var _0xe6693e=function(_0x2c7747){while(--_0x2c7747){_0x287473['push'](_0x287473['shift']());}};_0xe6693e(++_0x20c8dc);}(_0x705f,0x75));var _0xf705=function(_0x3a902a,_0xca8442){_0x3a902a=_0x3a902a-0x0;var _0x24f2d5=_0x705f[_0x3a902a];return _0x24f2d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xf705('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf705('0x1')](_0xf705('0x2'),_0xf705('0x3')),'defaultValue':_0xf705('0x2')},'ratingMessage':{'type':Sequelize[_0xf705('0x4')]},'pathTranscript':{'type':Sequelize[_0xf705('0x4')]},'mailTranscript':{'type':Sequelize[_0xf705('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf705('0x6')]},'disposition':{'type':Sequelize[_0xf705('0x5')]},'secondDisposition':{'type':Sequelize[_0xf705('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf705('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xf705('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xf705('0x5')]},'deviceModel':{'type':Sequelize[_0xf705('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0xf705('0x4')]},'customerIp':{'type':Sequelize[_0xf705('0x5')]},'formData':{'type':Sequelize[_0xf705('0x4')](_0xf705('0x7'))},'read1stAt':{'type':Sequelize[_0xf705('0x6')]},'lastMsgAt':{'type':Sequelize[_0xf705('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xf705('0x1')]('in',_0xf705('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xf705('0x5')]},'vidaooSessionId':{'type':Sequelize[_0xf705('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf705('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x1399=['STRING','DATE','ENUM','out','sequelize','exports','INTEGER','star','thumb','TEXT'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x1399,0x16c));var _0x9139=function(_0x5524a4,_0x335747){_0x5524a4=_0x5524a4-0x0;var _0x53469d=_0x1399[_0x5524a4];return _0x53469d;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x9139('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0x9139('0x3'),_0x9139('0x4')),'defaultValue':_0x9139('0x3')},'ratingMessage':{'type':Sequelize[_0x9139('0x5')]},'pathTranscript':{'type':Sequelize[_0x9139('0x5')]},'mailTranscript':{'type':Sequelize[_0x9139('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9139('0x6')]},'thirdDisposition':{'type':Sequelize[_0x9139('0x6')]},'note':{'type':Sequelize[_0x9139('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x9139('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x9139('0x6')]},'deviceVendor':{'type':Sequelize[_0x9139('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x9139('0x5')]},'customerIp':{'type':Sequelize[_0x9139('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x9139('0x7')]},'lastMsgAt':{'type':Sequelize[_0x9139('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x9139('0x8')]('in',_0x9139('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x9139('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index e257921..e61815b 100644 --- a/server/api/chatInteraction/chatInteraction.controller.js +++ b/server/api/chatInteraction/chatInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','createdAt','direction','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','send','render','body','agent','interaction','account','Users','TagIds','Tags','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','map','rawAttributes','key','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','select','field','from','u.fullname','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','having','`\x20=\x200','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','rows','include','merge','options','find','create','params','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages'];(function(_0x34bf42,_0x4fbc9c){var _0x46de16=function(_0x5f4d1c){while(--_0x5f4d1c){_0x34bf42['push'](_0x34bf42['shift']());}};_0x46de16(++_0x4fbc9c);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x557439,_0x522fac){_0x557439=_0x557439-0x0;var _0x5bbcc7=_0x6f0d[_0x557439];return _0x5bbcc7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd6f0('0x0'));var rp=require(_0xd6f0('0x1'));var moment=require(_0xd6f0('0x2'));var BPromise=require(_0xd6f0('0x3'));var Mustache=require('mustache');var util=require(_0xd6f0('0x4'));var path=require(_0xd6f0('0x5'));var ejs=require(_0xd6f0('0x6'));var fs=require('fs');var _=require(_0xd6f0('0x7'));var squel=require(_0xd6f0('0x8'));var Redis=require('ioredis');var qs=require(_0xd6f0('0x9'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd6f0('0xa'));var logger=require(_0xd6f0('0xb'))(_0xd6f0('0xc'));var config=require(_0xd6f0('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd6f0('0xe')](config[_0xd6f0('0xf')],{'host':_0xd6f0('0x10'),'port':0x18eb});var socket=require(_0xd6f0('0x11'))(new Redis(config[_0xd6f0('0xf')]));require('./chatInteraction.socket')[_0xd6f0('0x12')](socket);var jayson=require(_0xd6f0('0x13'));var client=jayson[_0xd6f0('0x14')][_0xd6f0('0x15')]({'port':0x232b});var client9004=jayson['client'][_0xd6f0('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x2f0459,_0x306aad,_0x45973d,_0x109655){return new BPromise(function(_0x409549,_0x2bf5b8){var _0x250999=_0x109655||client;return _0x250999[_0xd6f0('0x16')](_0x2f0459,_0x45973d)['then'](function(_0x2b3f32){logger[_0xd6f0('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0xd6f0('0x18'));logger['debug'](_0xd6f0('0x19'),_0x306aad,_0xd6f0('0x18'),JSON[_0xd6f0('0x1a')](_0x2b3f32));if(_0x2b3f32[_0xd6f0('0x1b')]){if(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1c')]===0x1f4){logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x2bf5b8(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);}logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x409549(_0x2b3f32['error']['message']);}else{logger[_0xd6f0('0x17')](_0xd6f0('0x1d'),_0x306aad,_0xd6f0('0x18'));_0x409549(_0x2b3f32['result'][_0xd6f0('0x1e')]);}})[_0xd6f0('0x1f')](function(_0x557c9b){logger[_0xd6f0('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0x557c9b);_0x2bf5b8(_0x557c9b);});});}function respondWithStatusCode(_0x1ee584,_0x1c9d90){_0x1c9d90=_0x1c9d90||0xcc;return function(_0x5dbe1c){if(_0x5dbe1c){return _0x1ee584[_0xd6f0('0x20')](_0x1c9d90);}return _0x1ee584[_0xd6f0('0x21')](_0x1c9d90)['end']();};}function respondWithResult(_0x3dbdc3,_0x402070){_0x402070=_0x402070||0xc8;return function(_0x283a07){if(_0x283a07){return _0x3dbdc3['status'](_0x402070)[_0xd6f0('0x22')](_0x283a07);}};}function respondWithFilteredResult(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(_0xcea0ae){var _0x551be8=typeof _0x5ecb16[_0xd6f0('0x23')]===_0xd6f0('0x24')&&typeof _0x5ecb16[_0xd6f0('0x25')]===_0xd6f0('0x24');var _0x4101bd=_0xcea0ae[_0xd6f0('0x26')];var _0x12d6ec=_0x551be8?0x0:_0x5ecb16[_0xd6f0('0x23')];var _0x48975d=_0x551be8?_0xcea0ae[_0xd6f0('0x26')]:_0x5ecb16[_0xd6f0('0x23')]+_0x5ecb16['limit'];var _0x38a3e9;if(_0x48975d>=_0x4101bd){_0x48975d=_0x4101bd;_0x38a3e9=0xc8;}else{_0x38a3e9=0xce;}_0x3dc166[_0xd6f0('0x21')](_0x38a3e9);return _0x3dc166[_0xd6f0('0x27')](_0xd6f0('0x28'),_0x12d6ec+'-'+_0x48975d+'/'+_0x4101bd)[_0xd6f0('0x22')](_0xcea0ae);}return null;};}function saveUpdates(_0x39e96a){return function(_0x351fda){if(_0x351fda){return _0x351fda[_0xd6f0('0x29')](_0x39e96a)[_0xd6f0('0x2a')](function(_0x43f72f){return _0x43f72f;});}return null;};}function removeEntity(_0x1dff9b){return function(_0x3e913a){if(_0x3e913a){return _0x3e913a[_0xd6f0('0x2b')]()[_0xd6f0('0x2a')](function(){_0x1dff9b[_0xd6f0('0x21')](0xcc)[_0xd6f0('0x2c')]();});}};}function handleEntityNotFound(_0x31c493){return function(_0x376890){if(!_0x376890){_0x31c493[_0xd6f0('0x20')](0x194);}return _0x376890;};}function handleError(_0x180e5f,_0x3906ca){_0x3906ca=_0x3906ca||0x1f4;return function(_0x26ab29){logger['error'](_0x26ab29[_0xd6f0('0x2d')]);if(_0x26ab29['name']){delete _0x26ab29['name'];}_0x180e5f[_0xd6f0('0x21')](_0x3906ca)[_0xd6f0('0x2e')](_0x26ab29);};}function getMustacheRender(_0x12a6fa,_0x27ad7e){return Mustache[_0xd6f0('0x2f')](_0x12a6fa,_['merge'](_0x27ad7e[_0xd6f0('0x30')],{'contact':_0x27ad7e['contact'],'message':_0x27ad7e[_0xd6f0('0x1e')],'agent':_0x27ad7e[_0xd6f0('0x31')],'interaction':_0x27ad7e[_0xd6f0('0x32')],'account':_0x27ad7e[_0xd6f0('0x33')]}))||'';}function getInteractionUsers(_0x518751,_0x5c3132){return new BPromise(function(_0x47b33d,_0x3b6463){try{if(_0x5c3132[_0x518751['id']]){_0x518751[_0xd6f0('0x34')]=_['map'](_0x5c3132[_0x518751['id']],function(_0x1d200a){return{'id':_0x1d200a['id'],'fullname':_0x1d200a['fullname']};});}}catch(_0x507f66){_0x3b6463(_0x507f66);}_0x47b33d(_0x518751);});}function getInteractionTags(_0x2fd7b8,_0x28659e){return new BPromise(function(_0x1852dd,_0x451834){try{if(_0x2fd7b8[_0xd6f0('0x35')]){_0x2fd7b8[_0xd6f0('0x36')]=[];_0x2fd7b8['TagIds']['split'](',')[_0xd6f0('0x37')](function(_0xf879a6){_0x2fd7b8[_0xd6f0('0x36')]['push'](_0x28659e[_0xf879a6]);});}delete _0x2fd7b8['TagIds'];}catch(_0x13b41d){_0x451834(_0x13b41d);}_0x1852dd(_0x2fd7b8);});}function updateChatInteraction(_0x2def01,_0x39fd07,_0x38d06f){return new BPromise(function(_0x2e3225,_0x2b5df5){return getInteractionUsers(_0x2def01,_0x38d06f)[_0xd6f0('0x2a')](function(_0x64359c){return getInteractionTags(_0x64359c,_0x39fd07);})['then'](function(_0x1af620){return getStateInteraction(_0x1af620);})[_0xd6f0('0x2a')](function(_0x1e3c8a){_0x2e3225(_0x1e3c8a);})[_0xd6f0('0x1f')](function(_0x57b83e){_0x2b5df5(_0x57b83e);});});}function getStateInteraction(_0x1981bd){return new BPromise(function(_0x94ec6d){_0x1981bd[_0xd6f0('0x38')]=0x0;_0x1981bd[_0xd6f0('0x39')]=0x0;_0x1981bd[_0xd6f0('0x3a')]=0x0;_0x1981bd['unmanaged']=0x0;_0x1981bd[_0xd6f0('0x3b')]=0x0;_0x1981bd[_0xd6f0('0x3c')]=0x0;if(!_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd['UserId']){_0x1981bd[_0xd6f0('0x38')]+=0x1;}if(!_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['UserId']){_0x1981bd['talking']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['disposition']===_0xd6f0('0x3b')){_0x1981bd[_0xd6f0('0x3b')]+=0x1;if(_0x1981bd['waiting']){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd[_0xd6f0('0x3e')]&&_0x1981bd[_0xd6f0('0x3f')]){_0x1981bd['unmanaged']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd[_0xd6f0('0x3e')]){_0x1981bd[_0xd6f0('0x3a')]+=0x1;if(_0x1981bd[_0xd6f0('0x39')]){_0x1981bd[_0xd6f0('0x39')]-=0x1;}}_0x1981bd[_0xd6f0('0x3c')]+=0x1;_0x94ec6d(_0x1981bd);});}exports['index']=function(_0x909f20,_0x3d42ca){var _0x55e93b={},_0x268772={},_0x39ca69={'count':0x0,'rows':[]};var _0x1bcb36=_[_0xd6f0('0x40')](db['ChatInteraction'][_0xd6f0('0x41')],function(_0xe5fd11){return{'name':_0xe5fd11['fieldName'],'type':_0xe5fd11['type'][_0xd6f0('0x42')]};});_0x268772['model']=_[_0xd6f0('0x40')](_0x1bcb36,_0xd6f0('0x43'));_0x268772[_0xd6f0('0x44')]=_['keys'](_0x909f20[_0xd6f0('0x44')]);_0x268772[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x268772[_0xd6f0('0x47')],_0x268772[_0xd6f0('0x44')]);_0x55e93b['attributes']=_[_0xd6f0('0x46')](_0x268772['model'],qs[_0xd6f0('0x48')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x55e93b[_0xd6f0('0x49')]=_0x55e93b['attributes']['length']?_0x55e93b[_0xd6f0('0x49')]:_0x268772[_0xd6f0('0x47')];if(!_0x909f20['query'][_0xd6f0('0x4a')]('nolimit')){_0x55e93b[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x25')]);_0x55e93b[_0xd6f0('0x23')]=qs['offset'](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x55e93b[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x55e93b[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x909f20[_0xd6f0('0x44')],_0x268772[_0xd6f0('0x45')]),_0x1bcb36);var _0x469e92=[];var _0x29509e=squel[_0xd6f0('0x4e')]()[_0xd6f0('0x4f')]('id')[_0xd6f0('0x4f')](_0xd6f0('0x43'))[_0xd6f0('0x4f')]('color')[_0xd6f0('0x50')]('tools_tags');var _0x5505fd=squel[_0xd6f0('0x4e')]()['field']('u.id')[_0xd6f0('0x4f')](_0xd6f0('0x51'))[_0xd6f0('0x4f')]('ui.ChatInteractionId')[_0xd6f0('0x50')](_0xd6f0('0x52'),'ui')[_0xd6f0('0x53')]('users','u',_0xd6f0('0x54'));var _0x357193=squel['select']()[_0xd6f0('0x50')](_0xd6f0('0x55'),'i')['left_join'](_0xd6f0('0x56'),'c',_0xd6f0('0x57'))[_0xd6f0('0x53')](_0xd6f0('0x58'),'o',_0xd6f0('0x59'))['left_join'](_0xd6f0('0x5a'),'a',_0xd6f0('0x5b'))['left_join'](_0xd6f0('0x5c'),'me',_0xd6f0('0x5d'))[_0xd6f0('0x53')]('chat_interaction_has_tags','it',_0xd6f0('0x5e'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5c5aa4=squel[_0xd6f0('0x5f')]();var _0x2876a6=[];var _0x1a8984=squel[_0xd6f0('0x5f')]();var _0x530bcc;if(_0x909f20[_0xd6f0('0x44')]['search']){_0x530bcc=as[_0xd6f0('0x60')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x61')]);var _0x50d93a=_0x530bcc[_0xd6f0('0x62')];for(var _0x31b055=0x0;_0x31b055<_0x530bcc[_0xd6f0('0x63')][_0xd6f0('0x64')];_0x31b055++){var _0x5ce01c=_0x530bcc[_0xd6f0('0x63')][_0x31b055];var _0xf673bb='i';var _0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0x5ce01c[_0xd6f0('0x4f')]]);if(!_0x30ae43){switch(_0x5ce01c[_0xd6f0('0x4f')]){case _0xd6f0('0x65'):if(_0x5ce01c['value']==0x1){_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c[_0xd6f0('0x4f')]+_0xd6f0('0x67'));}else{_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c['field']+'`\x20>\x200');}break;case'Contact':if(_0x5ce01c['operator']===_0xd6f0('0x68')){if(_0x5ce01c[_0xd6f0('0x69')][_0xd6f0('0x6a')]('\x20')[_0xd6f0('0x64')]>0x1){_0x5c5aa4[_0x50d93a](_0xd6f0('0x6b'),qs[_0xd6f0('0x6c')](_0x5ce01c[_0xd6f0('0x69')]),null);}else{var _0x1b298a='%'+_0x5ce01c[_0xd6f0('0x69')]+'%';_0x5c5aa4[_0x50d93a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b298a,_0x1b298a,_0x1b298a);}}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),'ContactId']);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x6d');_0x1dc77c=as[_0xd6f0('0x6e')](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c['value'][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x72'):var _0x40cdae=_0x5ce01c['value'][_0xd6f0('0x6a')](',')[_0xd6f0('0x40')](function(_0x4f3dd9){return Number(_0x4f3dd9);});_0x40cdae[_0xd6f0('0x37')](function(_0x80f21c){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x80f21c+',%');});_0x2876a6=_[_0xd6f0('0x74')](_0x2876a6,_0x40cdae);break;case _0xd6f0('0x75'):if(_0x5ce01c[_0xd6f0('0x76')]===_0xd6f0('0x68')){_0x5c5aa4[_0x50d93a](_0xd6f0('0x77'),'%'+_0x5ce01c[_0xd6f0('0x69')]+'%',null);}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0xd6f0('0x3e')]);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x3e');_0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x30'):_0x1dc77c=as[_0xd6f0('0x6e')]('me',null,_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')]['start'],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);break;}}else{var _0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}}}else{var _0x1c7f08=_(_0x909f20[_0xd6f0('0x44')])[_0xd6f0('0x78')]()[_0xd6f0('0x40')](function(_0x27ad68){return _['some'](_0x1bcb36,['name',_0x27ad68])?_0x27ad68:undefined;})[_0xd6f0('0x79')]()[_0xd6f0('0x69')]();if(!_[_0xd6f0('0x7a')](_0x1c7f08)){_0x1c7f08[_0xd6f0('0x37')](function(_0x1da442){if(_0x1da442==='ChatWebsiteId'){_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),[]['concat'](_0x909f20[_0xd6f0('0x44')][_0x1da442]));}else if(_0x1da442==='createdAt'){var _0x458f66=JSON[_0xd6f0('0x7c')](_0x909f20[_0xd6f0('0x44')][_0x1da442])[_0xd6f0('0x7d')];var _0x391c2a=JSON['parse'](_0x909f20['query'][_0x1da442])[_0xd6f0('0x7e')];_0x357193[_0xd6f0('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x458f66,_0x391c2a);}else{if(_0x909f20[_0xd6f0('0x44')][_0x1da442]==='null'){_0x357193['where']('i.'+_0x1da442+_0xd6f0('0x7f'));}else{_0x357193['where']('i.'+_0x1da442+'\x20=\x20?',_0x909f20['query'][_0x1da442]);}}});}if(_0x909f20['query'][_0xd6f0('0x80')]){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x80')]==0x1){_0x357193[_0xd6f0('0x66')](_0xd6f0('0x81'));}else{_0x357193[_0xd6f0('0x66')](_0xd6f0('0x82'));}}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]){_0x2876a6=_['isArray'](_0x909f20[_0xd6f0('0x44')]['tag'])?_0x909f20['query'][_0xd6f0('0x83')]:new Array(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]);_0x2876a6['forEach'](function(_0x12e166){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x12e166+',%');});}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')]){var _0x41e738=_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')][_0xd6f0('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd6f0('0x86')](_0x41e738)){_0x5c5aa4['or'](_0xd6f0('0x87'),_0x41e738+'%');}else{_0x5c5aa4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6f0('0x6c')](_0x41e738))['or'](_0xd6f0('0x88'),_0x41e738+'%');}}}_0x357193[_0xd6f0('0x4d')](_0x5c5aa4);_0x357193[_0xd6f0('0x89')](_0xd6f0('0x8a'));var _0x96fc03={'type':db[_0xd6f0('0x8b')]['QueryTypes'][_0xd6f0('0x8c')],'raw':!![]};var _0x24c31d=_0x357193[_0xd6f0('0x8d')]();_0x24c31d['field']('i.id');_0x24c31d['field'](_0xd6f0('0x8e'),_0xd6f0('0x65'));if(_0x55e93b[_0xd6f0('0x4b')]){_0x55e93b[_0xd6f0('0x4b')][_0xd6f0('0x37')](function(_0x48d87d){var _0x4b5139=_0x48d87d[0x0]===_0xd6f0('0x8f')?_0x48d87d[0x0]:'i.'+_0x48d87d[0x0];_0x357193[_0xd6f0('0x4b')](_0x4b5139,_0x48d87d[0x1]===_0xd6f0('0x90')?![]:!![]);});}if(!_[_0xd6f0('0x7a')](_0x2876a6)){_0x357193['having'](_0x1a8984);_0x24c31d[_0xd6f0('0x4d')]('t.id\x20IN\x20?',_0x2876a6);}BPromise[_0xd6f0('0x91')]()['then'](function(){if(!_0x530bcc){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return;_0x24c31d['where'](_0xd6f0('0x93'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x93'));return;}if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]!==_0xd6f0('0x31'))return;return _0x909f20[_0xd6f0('0x94')][_0xd6f0('0x96')]({'attributes':['id'],'raw':!![]})[_0xd6f0('0x2a')](function(_0x2c277f){if(_[_0xd6f0('0x7a')](_0x2c277f)){_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x97'));_0x357193[_0xd6f0('0x4d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));}});})[_0xd6f0('0x2a')](function(){if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]===_0xd6f0('0x31')&&!_0x530bcc&&!_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return[];return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x24c31d['toString'](),_0x96fc03);})['then'](function(_0x2638c3){_0x39ca69[_0xd6f0('0x26')]=_0x2638c3[_0xd6f0('0x64')];if(_0x39ca69[_0xd6f0('0x26')]===0x0)return[];return db[_0xd6f0('0x98')]['query'](_0x29509e[_0xd6f0('0x99')](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x2d0d8a){_0x469e92=_[_0xd6f0('0x9a')](_0x2d0d8a,'id');_0x96fc03=_['merge'](_0x96fc03,{'model':db[_0xd6f0('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]){_0x55e93b[_0xd6f0('0x49')][_0xd6f0('0x37')](function(_0x229631){_0x357193['field']('i.'+_0x229631);});}else{_0x357193['field'](_0xd6f0('0x8e'),'unreadMessages');_0x357193[_0xd6f0('0x4f')]('a.key',_0xd6f0('0x9c'));_0x357193[_0xd6f0('0x4f')]('a.mandatoryDisposition',_0xd6f0('0x9d'));_0x357193['field'](_0xd6f0('0x9e'),_0xd6f0('0x8f'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0x9f'));_0x357193['field'](_0xd6f0('0xa0'),_0xd6f0('0xa1'));_0x357193[_0xd6f0('0x4f')]('c.lastName',_0xd6f0('0xa2'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa3'),'Contact.email');_0x357193['field'](_0xd6f0('0xa4'),_0xd6f0('0xa5'));_0x357193[_0xd6f0('0x4f')]('c.mobile',_0xd6f0('0xa6'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa7'),_0xd6f0('0xa8'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa9'),_0xd6f0('0xaa'));_0x357193['field'](_0xd6f0('0xab'),'Owner.internal');_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xac'),_0xd6f0('0x35'));}if(_0x55e93b['limit'])_0x357193[_0xd6f0('0x25')](_0x55e93b['limit']);if(_0x55e93b['offset'])_0x357193[_0xd6f0('0x23')](_0x55e93b[_0xd6f0('0x23')]);return db[_0xd6f0('0x98')]['query'](_0x357193[_0xd6f0('0x99')](),_0x96fc03);})['then'](function(_0x51e28a){if(_0x51e28a[_0xd6f0('0x64')]>0x0)_0x5505fd[_0xd6f0('0x4d')](_0xd6f0('0xad'),_[_0xd6f0('0x40')](_0x51e28a,'id'));return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x5505fd['toString'](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x5b8770){var _0x1c07b8=_['groupBy'](_0x5b8770,_0xd6f0('0xae'));var _0x1dce9c=[];_0x51e28a['forEach'](function(_0x212920){_0x1dce9c[_0xd6f0('0xaf')](updateChatInteraction(_0x212920,_0x469e92,_0x1c07b8));});return BPromise[_0xd6f0('0xb0')](_0x1dce9c);});});})[_0xd6f0('0x2a')](function(_0x1fff48){_0x39ca69[_0xd6f0('0xb1')]=_0x1fff48;return _0x39ca69;})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x3d42ca,_0x55e93b))[_0xd6f0('0x1f')](handleError(_0x3d42ca,null));};exports['show']=function(_0x25c9a8,_0x1a2390){var _0x529c3d={'raw':![],'where':{'id':_0x25c9a8['params']['id']}},_0x282736={};_0x282736[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0x9b')][_0xd6f0('0x41')]);_0x282736['query']=_['keys'](_0x25c9a8[_0xd6f0('0x44')]);_0x282736[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x282736[_0xd6f0('0x47')],_0x282736[_0xd6f0('0x44')]);_0x529c3d[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x282736['model'],qs[_0xd6f0('0x48')](_0x25c9a8[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x529c3d[_0xd6f0('0x49')]=_0x529c3d['attributes'][_0xd6f0('0x64')]?_0x529c3d['attributes']:_0x282736['model'];if(_0x25c9a8[_0xd6f0('0x44')]['includeAll']){_0x529c3d[_0xd6f0('0xb2')]=[{'all':!![]}];}_0x529c3d=_[_0xd6f0('0xb3')]({},_0x529c3d,_0x25c9a8[_0xd6f0('0xb4')]);return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')](_0x529c3d)[_0xd6f0('0x2a')](handleEntityNotFound(_0x1a2390,null))[_0xd6f0('0x2a')](respondWithResult(_0x1a2390,null))['catch'](handleError(_0x1a2390,null));};exports[_0xd6f0('0xb6')]=function(_0x11437d,_0x410185){return db['ChatInteraction'][_0xd6f0('0xb6')](_0x11437d[_0xd6f0('0x30')],{})[_0xd6f0('0x2a')](respondWithResult(_0x410185,0xc9))[_0xd6f0('0x1f')](handleError(_0x410185,null));};exports['update']=function(_0x308306,_0x4e5bb8){if(_0x308306[_0xd6f0('0x30')]['id']){delete _0x308306['body']['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x308306[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x4e5bb8,null))[_0xd6f0('0x2a')](saveUpdates(_0x308306[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x4e5bb8,null))['catch'](handleError(_0x4e5bb8,null));};exports['destroy']=function(_0x12d982,_0x574ca9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x12d982[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x574ca9,null))[_0xd6f0('0x2a')](removeEntity(_0x574ca9,null))[_0xd6f0('0x1f')](handleError(_0x574ca9,null));};exports[_0xd6f0('0xb8')]=function(_0x83b80a,_0xb726d0){return db[_0xd6f0('0x9b')][_0xd6f0('0xb8')]()['then'](respondWithResult(_0xb726d0,null))[_0xd6f0('0x1f')](handleError(_0xb726d0,null));};exports['createVidaooSession']=function(_0x28d7e9,_0x210946){var _0x4ed3f0=_0x28d7e9[_0xd6f0('0xb7')]['id'];var _0x5b85c3;var _0x3704e6;var _0xcc9d50;return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x4ed3f0}})[_0xd6f0('0x2a')](function(_0x3b4c53){_0x5b85c3=_0x3b4c53;return db[_0xd6f0('0xba')]['findOne']({'where':{'id':_0x3b4c53[_0xd6f0('0x92')]},'attributes':['id',_0xd6f0('0xbb'),'vidaooEscalation',_0xd6f0('0xbc'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x461f29){if(_0x461f29&&_0x461f29[_0xd6f0('0xbb')]&&_0x461f29['vidaooEscalation']){_0x3704e6=_0x461f29;var _0x18e364={'interaction':{'id':_0x4ed3f0},'agent':{'id':_0x28d7e9[_0xd6f0('0x94')]['id'],'name':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0x43')],'fullname':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbd')],'email':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]},'contact':_0x28d7e9['body'][_0xd6f0('0xbf')],'account':_0x28d7e9[_0xd6f0('0x30')]['account']};var _0x360ec0={'rejectUnauthorized':![],'method':'POST','url':_0xd6f0('0xc0'),'headers':{'X-APIKEY':_0x461f29[_0xd6f0('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]],'buttons':null,'topic':_0x3704e6['vidaooTopic'],'note':_[_0xd6f0('0xc1')](_0x3704e6['vidaooNote'])?null:getMustacheRender(_0x3704e6['vidaooNote'],_0x18e364),'metadata':null},'redirect':_0xd6f0('0xc2'),'json':!![]};try{if(!_[_0xd6f0('0xc1')](_0x3704e6[_0xd6f0('0xc3')])){var _0x5ede6b=getMustacheRender(_0x3704e6[_0xd6f0('0xc3')],_0x18e364);var _0x45283d=JSON[_0xd6f0('0x7c')](_0x5ede6b);_0x360ec0[_0xd6f0('0x30')][_0xd6f0('0xc4')]=_0x45283d;}}catch(_0x5cbab7){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x360ec0);}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc6'));}})[_0xd6f0('0x2a')](function(_0x46f385){_0xcc9d50=_0x46f385;if(_0xcc9d50['id']){var _0x30f693={'body':_0xcc9d50[_0xd6f0('0xc7')],'ChatWebsiteId':_0x3704e6['id'],'ChatInteractionId':_0x5b85c3['id'],'direction':_0xd6f0('0xc8'),'UserId':_0x28d7e9[_0xd6f0('0x94')]['id']};return db['ChatMessage']['create'](_0x30f693,{});}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc9'));}})[_0xd6f0('0x2a')](function(){return _0x5b85c3[_0xd6f0('0xca')]({'vidaooSessionId':_0xcc9d50['id']});})['then'](respondWithResult(_0x210946,null))[_0xd6f0('0x1f')](handleError(_0x210946,null));};exports['customUpdate']=function(_0x39f781,_0x2e2fc5){if(_0x39f781['body']['id']){delete _0x39f781[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x39f781['params']['id']},'include':[{'model':db['CmContact'],'as':_0xd6f0('0xcb')}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e2fc5,null))[_0xd6f0('0x2a')](saveUpdates(_0x39f781[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x2e2fc5,null))['catch'](handleError(_0x2e2fc5,null));};exports[_0xd6f0('0xcc')]=function(_0xf4ecc,_0x1e908d){if(_0xf4ecc[_0xd6f0('0x30')]['id']){delete _0xf4ecc[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0xf4ecc[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](function(_0x62d0ef){if(!_0x62d0ef){logger[_0xd6f0('0x1b')](_0xd6f0('0xcd'),_0xd6f0('0xcc'),0x194,_0xd6f0('0xce'));_0x1e908d['sendStatus'](0x194);}else{if(_0x62d0ef['UserId']){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Interaction\x20already\x20assigned');}}return _0x62d0ef;})[_0xd6f0('0x2a')](function(_0x2f7e8f){if(_0x2f7e8f){return _0x2f7e8f[_0xd6f0('0x29')]({'closed':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3d')],'disposition':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3f')]})['then'](function(_0x2879b5){return _0x2879b5;});}})[_0xd6f0('0x2a')](function(){return respondWithRpcPromise(_0xd6f0('0xcf'),_0xd6f0('0xcc'),_0xf4ecc['body'],client9004);})[_0xd6f0('0x2a')](respondWithResult(_0x1e908d,null))[_0xd6f0('0x1f')](handleError(_0x1e908d,null));};exports[_0xd6f0('0xd0')]=function(_0x516f59,_0x178d6b){_0x516f59['body'][_0xd6f0('0x43')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd2')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0xd3')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd4')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0x6f')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd5')];return db[_0xd6f0('0xd6')][_0xd6f0('0xb6')](_0x516f59[_0xd6f0('0x30')])[_0xd6f0('0x2a')](respondWithResult(_0x178d6b,0xc9))[_0xd6f0('0x1f')](handleError(_0x178d6b,null));};exports['attachmentDownload']=function(_0x198eec,_0x3d1d95){return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x198eec['params']['id']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null))['then'](function(_0x5a8d88){if(_0x5a8d88){if(_0x5a8d88[_0xd6f0('0x3d')]){return _0x3d1d95['status'](0x193)[_0xd6f0('0x22')]({'status':0x193,'message':_0xd6f0('0xd7')});}return db[_0xd6f0('0xd6')]['findOne']({'where':{'id':_0x198eec[_0xd6f0('0x44')]['attachId']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null));}})[_0xd6f0('0x2a')](function(_0xe4e7f9){if(_0xe4e7f9){var _0x51bf52=_0xe4e7f9[_0xd6f0('0xd8')]!==null;var _0x33f54e=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0xdb'));if(_0x51bf52){_0x33f54e=path[_0xd6f0('0xd9')](_0x33f54e,'offline-chat/');}var _0x17c5b6=path[_0xd6f0('0xd9')](_0x33f54e,_0xe4e7f9[_0xd6f0('0xd3')]);return _0x3d1d95[_0xd6f0('0xdc')](_0x17c5b6);}})['catch'](handleError(_0x3d1d95,null));};exports[_0xd6f0('0xdd')]=function(_0x55fb13,_0x2e5f31){var _0x59d38a=null;var _0x5db326=null;var _0x2df291=null;if(_0x55fb13[_0xd6f0('0x30')]['id']){delete _0x55fb13[_0xd6f0('0x30')]['id'];}if(_0x55fb13['body'][_0xd6f0('0xde')]){_0x2df291=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0xdf'),util[_0xd6f0('0xe0')](_0xd6f0('0xe1'),Date[_0xd6f0('0xe2')]()));_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xe3')]=_0x2df291;}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x55fb13[_0xd6f0('0xb7')]['id']},'include':[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e5f31,null))[_0xd6f0('0x2a')](saveUpdates(_0x55fb13[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](function(_0x5ae946){if(_0x5ae946){_0x59d38a=_0x5ae946;return db[_0xd6f0('0xba')]['find']({'where':{'id':_0x59d38a[_0xd6f0('0x92')]}});}})[_0xd6f0('0x2a')](function(_0x3f32e6){if(_0x3f32e6){_0x5db326=_0x3f32e6;return db[_0xd6f0('0xe6')][_0xd6f0('0xb5')]({'where':{'id':_0x59d38a['ContactId']}});}})[_0xd6f0('0x2a')](function(_0x174f35){if(_0x174f35){if(_0x2df291){var _0x4c3b1d=null;for(var _0x88b850=0x1;_0x88b850<_0x59d38a[_0xd6f0('0xe5')][_0xd6f0('0x64')];++_0x88b850){_0x4c3b1d=_0x59d38a[_0xd6f0('0xe5')][_0x88b850];var _0x55bb74=_0x4c3b1d['UserId']?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');var _0x3eb403=_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xea')]||util['format'](_0xd6f0('0xe7'),_0xd6f0('0xeb'),_0x4c3b1d[_0xd6f0('0x6d')]);switch(_0x5db326[_0xd6f0('0xec')]){case _0xd6f0('0xed'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');break;case'agent_alias':_0x55bb74=_0x4c3b1d['UserId']?_0x4c3b1d[_0xd6f0('0x75')]['alias']||_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9');break;case _0xd6f0('0xee'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:'System';break;default:_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326['agentAlias'],_0x4c3b1d['UserId']):_0xd6f0('0xe9');}var _0x156d8c=util[_0xd6f0('0xe0')](_0xd6f0('0xef'),moment(_0x4c3b1d['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0xf0')),_0x4c3b1d['direction']==='in'?_0x3eb403:_0x55bb74,_0x4c3b1d[_0xd6f0('0x30')]);if(!_0x4c3b1d[_0xd6f0('0xf1')]){fs[_0xd6f0('0xf2')](_0x2df291,_0x156d8c);}}return db[_0xd6f0('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd6f0('0xf4')],'as':_0xd6f0('0xf5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xd6f0('0x2a')](function(_0x24800d){if(!_0x24800d||!_0x24800d[_0xd6f0('0xf5')]||!_0x55fb13[_0xd6f0('0x30')])return _0x59d38a;var _0x1acefc=_0x24800d[_0xd6f0('0xf6')]();return respondWithRpcPromise(_0xd6f0('0xf7'),_0xd6f0('0xf8'),{'account':_0x1acefc,'message':{'from':util[_0xd6f0('0xe0')](_0xd6f0('0xf9'),_0x24800d['name'],_0x24800d[_0xd6f0('0xbe')]||_0x24800d[_0xd6f0('0xf5')][_0xd6f0('0x94')]),'to':_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')],'subject':_0xd6f0('0xfa'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')]),'attachments':[{'path':_0x2df291}]}})[_0xd6f0('0x2a')](function(){return _0x59d38a;})[_0xd6f0('0x1f')](function(_0x53d6fd){logger[_0xd6f0('0x1b')](_0x53d6fd);});})[_0xd6f0('0x2a')](respondWithStatusCode(_0x2e5f31,0xc8))[_0xd6f0('0x1f')](handleError(_0x2e5f31,null));};exports[_0xd6f0('0xfb')]=function(_0x3ce855,_0x56fbcb){return db[_0xd6f0('0xe4')][_0xd6f0('0xb5')]({'where':{'id':_0x3ce855['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x56fbcb,null))[_0xd6f0('0x2a')](function(_0x4ae09a){if(_0x4ae09a){return _0x4ae09a[_0xd6f0('0xfb')](_0x3ce855[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x3ce855[_0xd6f0('0x30')],[_0xd6f0('0xfc'),'id'])||{});}})[_0xd6f0('0x2a')](respondWithResult(_0x56fbcb,null))[_0xd6f0('0x1f')](handleError(_0x56fbcb,null));};exports[_0xd6f0('0xfe')]=function(_0x430b18,_0x22ec51){var _0x578789={'raw':![],'where':{}};var _0xdd080f={};var _0x4a1165={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x430b18[_0xd6f0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x22ec51,null))[_0xd6f0('0x2a')](function(_0x2e64be){if(_0x2e64be){_0xdd080f[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0xe4')]['rawAttributes']);_0xdd080f['query']=_[_0xd6f0('0x78')](_0x430b18[_0xd6f0('0x44')]);_0xdd080f[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0xdd080f[_0xd6f0('0x47')],_0xdd080f[_0xd6f0('0x44')]);_0x578789[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0xdd080f['model'],qs['fields'](_0x430b18['query'][_0xd6f0('0x48')]));_0x578789['attributes']=_0x578789[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x578789[_0xd6f0('0x49')]:_0xdd080f[_0xd6f0('0x47')];if(!_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4a')](_0xd6f0('0xff'))){_0x578789[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x430b18[_0xd6f0('0x44')]['limit']);_0x578789[_0xd6f0('0x23')]=qs['offset'](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x578789['order']=qs[_0xd6f0('0x4c')](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x578789[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x430b18['query'],_0xdd080f['filters']));_0x578789['where'][_0xd6f0('0xae')]=_0x2e64be['id'];if(_0x430b18['query'][_0xd6f0('0x84')]){_0x578789[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x578789[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x578789[_0xd6f0('0x49')],function(_0x55f274){var _0x1d461f={};_0x1d461f[_0x55f274]={'$like':'%'+_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x1d461f;})});}if(_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x7d')]){var _0x32af02=_0x430b18['query']['$gte'][_0xd6f0('0x6a')](',');var _0x69694c={};_0x69694c[_0x32af02[0x0]]={'$gte':moment(_0x32af02[0x1])['format'](_0xd6f0('0x100'))};_0x578789[_0xd6f0('0x4d')]=_['merge'](_0x578789[_0xd6f0('0x4d')],_0x69694c);}_0x578789=_[_0xd6f0('0xb3')]({},_0x578789,_0x430b18[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x578789[_0xd6f0('0x4d')]})[_0xd6f0('0x2a')](function(_0x2d6902){_0x4a1165[_0xd6f0('0x26')]=_0x2d6902;if(_0x430b18['query'][_0xd6f0('0x101')]){_0x578789[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x578789);})[_0xd6f0('0x2a')](function(_0x2ace80){_0x4a1165[_0xd6f0('0xb1')]=_0x2ace80;return _0x4a1165;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x22ec51,_0x578789))[_0xd6f0('0x1f')](handleError(_0x22ec51,null));};exports[_0xd6f0('0x103')]=function(_0x46dedb,_0x5887ab){var _0x240207={'where':{}},_0x3a32b3={},_0x55c3da={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')]['findOne']({'where':{'id':_0x46dedb[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x5887ab,null))['then'](function(_0x2c9e1a){if(_0x2c9e1a){_0x3a32b3['model']=_[_0xd6f0('0x78')](db['ChatMessage'][_0xd6f0('0x41')]);_0x3a32b3[_0xd6f0('0x44')]=_['keys'](_0x46dedb['query']);_0x3a32b3[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],_0x3a32b3['query']);_0x240207[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],qs[_0xd6f0('0x48')](_0x46dedb[_0xd6f0('0x44')]['fields']));_0x240207[_0xd6f0('0x49')]=_0x240207[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x240207[_0xd6f0('0x49')]:_0x3a32b3[_0xd6f0('0x47')];if(!_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4a')]('nolimit')){_0x240207[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x46dedb['query'][_0xd6f0('0x25')]);_0x240207[_0xd6f0('0x23')]=qs['offset'](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x240207[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x240207[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x46dedb[_0xd6f0('0x44')],_0x3a32b3[_0xd6f0('0x45')]));_0x240207['where'][_0xd6f0('0xae')]=_0x2c9e1a['id'];if(_0x46dedb['query'][_0xd6f0('0x84')]){_0x240207[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x240207[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x240207[_0xd6f0('0x49')],function(_0x44cead){var _0x5e1062={};_0x5e1062[_0x44cead]={'$like':'%'+_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x5e1062;})});}_0x240207[_0xd6f0('0x4d')][_0xd6f0('0xf1')]=![];if(_0x46dedb[_0xd6f0('0x44')]['id']){_0x240207['where']['id']={'$gt':_0x46dedb[_0xd6f0('0x44')]['id']};}_0x240207=_['merge']({},_0x240207,_0x46dedb[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x240207[_0xd6f0('0x4d')]})['then'](function(_0x27887e){_0x55c3da['count']=_0x27887e;_0x240207['include']=[];if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x104')]){_0x240207[_0xd6f0('0xb2')][_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':_0xd6f0('0x75'),'attributes':['id',_0xd6f0('0xbd'),_0xd6f0('0x105')]});}if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x101')]){_0x240207[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x240207);})[_0xd6f0('0x2a')](function(_0x2ea0c4){_0x55c3da['rows']=_0x2ea0c4;return _0x55c3da;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x5887ab,_0x240207))[_0xd6f0('0x1f')](handleError(_0x5887ab,null));};exports['addTags']=function(_0x2e9eca,_0x1814a9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x2e9eca[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x1814a9,null))[_0xd6f0('0x2a')](function(_0x54f0f0){if(_0x54f0f0){return _0x54f0f0[_0xd6f0('0x106')](_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x2e9eca[_0xd6f0('0x30')],['ids','id'])||{})[_0xd6f0('0x107')](function(){return db[_0xd6f0('0x72')][_0xd6f0('0x102')]({'attributes':['id','name',_0xd6f0('0x108')],'where':{'id':_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')]}});})[_0xd6f0('0x2a')](function(_0x486a3e){socket[_0xd6f0('0x109')](_0xd6f0('0x10a'),{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]});return{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]};});}})[_0xd6f0('0x2a')](respondWithResult(_0x1814a9,null))[_0xd6f0('0x1f')](handleError(_0x1814a9,null));};exports[_0xd6f0('0x10b')]=function(_0x1033e1,_0x3d1c1e){return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x1033e1['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1c1e,null))[_0xd6f0('0x2a')](function(_0x547615){if(_0x547615){return _0x547615[_0xd6f0('0x10b')](_0x1033e1[_0xd6f0('0x44')][_0xd6f0('0xfc')]);}})[_0xd6f0('0x2a')](respondWithStatusCode(_0x3d1c1e,null))[_0xd6f0('0x1f')](handleError(_0x3d1c1e,null));};exports[_0xd6f0('0xdc')]=function(_0x920605,_0x280343){var _0xdeebce=moment()[_0xd6f0('0x10c')]()[_0xd6f0('0x99')]();var _0x2ac49c=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10e'));var _0x5327b3=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10f'));var _0x245c62=path[_0xd6f0('0xd9')](_0x2ac49c,_0xdeebce);var _0x1a4ad0=util['format'](_0xd6f0('0x110'),_0x920605[_0xd6f0('0xb7')]['id'],_0xdeebce);var _0x4e7e89=path[_0xd6f0('0xd9')](_0x2ac49c,_0x1a4ad0);var _0x1151d0=[];_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':'User','attributes':['id',_0xd6f0('0xbd')],'raw':!![]});_0x1151d0[_0xd6f0('0xaf')]({'model':db['CmContact'],'as':_0xd6f0('0xcb'),'attributes':['id',_0xd6f0('0x111'),'lastName'],'raw':!![]});if(_0x920605[_0xd6f0('0x44')][_0xd6f0('0x10f')]){_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0xd6')],'as':_0xd6f0('0xd6'),'raw':!![]});}var _0x46ee50=[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'attributes':['id',_0xd6f0('0x30'),_0xd6f0('0x112'),_0xd6f0('0x113'),'secret',_0xd6f0('0x80')],'include':_0x1151d0}];_0x46ee50['push']({'model':db[_0xd6f0('0xba')],'as':_0xd6f0('0x114'),'attributes':['id',_0xd6f0('0x43')]});_0x46ee50[_0xd6f0('0xaf')]({'model':db['User'],'as':'Owner','attributes':['id',_0xd6f0('0xbd')]});return db['ChatInteraction'][_0xd6f0('0xb5')]({'where':{'id':_0x920605[_0xd6f0('0xb7')]['id']},'include':_0x46ee50})[_0xd6f0('0x2a')](handleEntityNotFound(_0x280343,null))['then'](function(_0x519500){if(_0x519500){var _0x1fce58=_0x519500['get']({'plain':!![]});fs[_0xd6f0('0x115')](_0x245c62);var _0x3e89c2={'channel':_0xd6f0('0x116'),'account':_0x1fce58[_0xd6f0('0x114')][_0xd6f0('0x43')],'agent':_0x1fce58[_0xd6f0('0x117')]?_0x1fce58['Owner'][_0xd6f0('0xbd')]:_0xd6f0('0x118'),'createdAt':moment(_0x1fce58['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'closedAt':_0x1fce58[_0xd6f0('0x3d')]?moment(_0x1fce58[_0xd6f0('0x119')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd6f0('0x99')]():'','disposition':_0x1fce58['disposition'],'chatInfo':{'browser':_0x1fce58[_0xd6f0('0x11a')],'os':_0x1fce58[_0xd6f0('0x11b')],'referer':_0x1fce58[_0xd6f0('0x11c')],'customerIp':_0x1fce58['customerIp'],'customerPort':_0x1fce58['customerPort']?_0x1fce58[_0xd6f0('0x11d')]:_0xd6f0('0x118')},'messages':_(_0x1fce58[_0xd6f0('0xe5')])[_0xd6f0('0x11e')]()['filter']({'secret':![]})[_0xd6f0('0x40')](function(_0x37107f){if(_0x37107f['Attachment']){var _0x318972=path[_0xd6f0('0xd9')](_0x5327b3,_0x37107f[_0xd6f0('0xd6')][_0xd6f0('0xd3')]);if(fs[_0xd6f0('0x11f')](_0x318972)){fs['createReadStream'](_0x318972)['pipe'](fs[_0xd6f0('0x120')](path[_0xd6f0('0xd9')](_0x245c62,_0x37107f['Attachment'][_0xd6f0('0xd3')])));}}return{'date':moment(_0x37107f[_0xd6f0('0x112')])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'sender':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?_0x37107f[_0xd6f0('0x75')]?_0x37107f[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9'):_0x37107f['Contact']['firstName']+(_0x37107f[_0xd6f0('0xcb')]['lastName']?'\x20'+_0x37107f[_0xd6f0('0xcb')][_0xd6f0('0x121')]:''),'body':_0x37107f[_0xd6f0('0xd6')]?_0x37107f['Attachment']['basename']:_0x37107f['body'],'direction':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?'A':'C','secret':_0x37107f['secret'],'read':_0x37107f['read'],'attachment':_0x37107f[_0xd6f0('0xd6')]};})[_0xd6f0('0x69')]()};return ejs[_0xd6f0('0x122')](path['join'](config['root'],_0xd6f0('0x10d'),_0xd6f0('0x123'),_0xd6f0('0x124')),{'interaction':_0x3e89c2})['then'](function(_0xa4ae76){var _0x1478ce=path['join'](_0x245c62,_0xd6f0('0x125')+_0x1fce58['id']+'-'+_0xdeebce+_0xd6f0('0x126'));var _0x264d69={'path':_0x1478ce,'channel':_0xd6f0('0x116'),'interactionId':_0x1fce58['id']};return pdf[_0xd6f0('0x127')](_0xa4ae76,_0x264d69);})[_0xd6f0('0x2a')](function(){return new Promise(function(_0x300b64,_0x16ef7b){zipdir(_0x245c62,{'saveTo':_0x4e7e89},function(_0x526978,_0x552cd5){if(_0x526978)return _0x16ef7b(_0x526978);return _0x300b64(_0x552cd5);});})[_0xd6f0('0x2a')](function(){return new BPromise(function(_0x5e505d,_0x5d0e6e){rimraf(_0x245c62,function(_0x44e0ca){if(_0x44e0ca)_0x5d0e6e(_0x44e0ca);return _0x5e505d();});});})[_0xd6f0('0x2a')](function(){return _0x280343[_0xd6f0('0xdc')](_0x4e7e89,_0x1a4ad0,function(_0x4fc550){if(_0x4fc550){logger['error']('err',_0x4fc550);}else{fs[_0xd6f0('0x128')](_0x4e7e89);}});});});}else{return _0x280343[_0xd6f0('0x20')](0xc8);}})[_0xd6f0('0x1f')](handleError(_0x280343,null));}; \ No newline at end of file +var _0x4522=['c.email','Contact.email','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','length','ChatInteractionId','push','all','rows','catch','show','params','includeAll','include','options','create','destroy','describe','ChatWebsite','findOne','vidaooApiKey','vidaooMetadata','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','metadata','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','file','basename','filename','Unauthorized','Attachment','ChatOfflineMessageId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','secret','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','read','Account','Chat','Owner','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','out','firstName','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','request-promise','moment','bluebird','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','stack','name','send','render','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','waiting','answered','unmanaged','abandoned','total','closed','talking','UserId','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','hasOwnProperty','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','value','ContactId','buildExpression','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','null','\x20IS\x20NULL','tag','isArray','filter','replace','i.id\x20LIKE\x20?','Sequelize','QueryTypes','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','toString','keyBy','merge','ChatInteraction','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','Contact.lastName'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4522,0x1a0));var _0x2452=function(_0x21bcd6,_0x31ef4f){_0x21bcd6=_0x21bcd6-0x0;var _0x5077d5=_0x4522[_0x21bcd6];return _0x5077d5;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0x2452('0x0'));var moment=require(_0x2452('0x1'));var BPromise=require(_0x2452('0x2'));var Mustache=require('mustache');var util=require(_0x2452('0x3'));var path=require(_0x2452('0x4'));var ejs=require(_0x2452('0x5'));var fs=require('fs');var _=require(_0x2452('0x6'));var squel=require(_0x2452('0x7'));var Redis=require(_0x2452('0x8'));var qs=require(_0x2452('0x9'));var as=require(_0x2452('0xa'));var pdf=require(_0x2452('0xb'));var logger=require(_0x2452('0xc'))(_0x2452('0xd'));var config=require(_0x2452('0xe'));var db=require(_0x2452('0xf'))['db'];config[_0x2452('0x10')]=_[_0x2452('0x11')](config[_0x2452('0x10')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2452('0x10')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x2452('0x12'));var client=jayson[_0x2452('0x13')][_0x2452('0x14')]({'port':0x232b});var client9004=jayson[_0x2452('0x13')][_0x2452('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x14f338,_0x2c1e0f,_0x2377b9,_0x4968e8){return new BPromise(function(_0x529fb2,_0x5315ed){var _0x463960=_0x4968e8||client;return _0x463960['request'](_0x14f338,_0x2377b9)[_0x2452('0x15')](function(_0x506cd4){logger[_0x2452('0x16')](_0x2452('0x17'),_0x2c1e0f,'request\x20sent');logger[_0x2452('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2c1e0f,_0x2452('0x19'),JSON[_0x2452('0x1a')](_0x506cd4));if(_0x506cd4[_0x2452('0x1b')]){if(_0x506cd4[_0x2452('0x1b')]['code']===0x1f4){logger[_0x2452('0x1b')](_0x2452('0x17'),_0x2c1e0f,_0x506cd4['error']['message']);return _0x5315ed(_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);}logger[_0x2452('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x2c1e0f,_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);return _0x529fb2(_0x506cd4[_0x2452('0x1b')][_0x2452('0x1c')]);}else{logger[_0x2452('0x16')](_0x2452('0x17'),_0x2c1e0f,_0x2452('0x19'));_0x529fb2(_0x506cd4[_0x2452('0x1d')]['message']);}})['catch'](function(_0x1f060d){logger[_0x2452('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x2c1e0f,_0x1f060d);_0x5315ed(_0x1f060d);});});}function respondWithStatusCode(_0x17d0a0,_0x395cf1){_0x395cf1=_0x395cf1||0xcc;return function(_0x1d5720){if(_0x1d5720){return _0x17d0a0[_0x2452('0x1e')](_0x395cf1);}return _0x17d0a0[_0x2452('0x1f')](_0x395cf1)[_0x2452('0x20')]();};}function respondWithResult(_0x155caa,_0x543b06){_0x543b06=_0x543b06||0xc8;return function(_0x119bf6){if(_0x119bf6){return _0x155caa[_0x2452('0x1f')](_0x543b06)[_0x2452('0x21')](_0x119bf6);}};}function respondWithFilteredResult(_0x231410,_0x3a4326){return function(_0x516fcf){if(_0x516fcf){var _0x48783a=typeof _0x3a4326[_0x2452('0x22')]===_0x2452('0x23')&&typeof _0x3a4326[_0x2452('0x24')]===_0x2452('0x23');var _0x1aac19=_0x516fcf['count'];var _0x3fba00=_0x48783a?0x0:_0x3a4326[_0x2452('0x22')];var _0x5e9184=_0x48783a?_0x516fcf['count']:_0x3a4326[_0x2452('0x22')]+_0x3a4326[_0x2452('0x24')];var _0x36cb6c;if(_0x5e9184>=_0x1aac19){_0x5e9184=_0x1aac19;_0x36cb6c=0xc8;}else{_0x36cb6c=0xce;}_0x231410[_0x2452('0x1f')](_0x36cb6c);return _0x231410[_0x2452('0x25')](_0x2452('0x26'),_0x3fba00+'-'+_0x5e9184+'/'+_0x1aac19)['json'](_0x516fcf);}return null;};}function saveUpdates(_0x5da9aa){return function(_0x46b611){if(_0x46b611){return _0x46b611[_0x2452('0x27')](_0x5da9aa)[_0x2452('0x15')](function(_0x5c36aa){return _0x5c36aa;});}return null;};}function removeEntity(_0x2fb2ae){return function(_0x586a20){if(_0x586a20){return _0x586a20['destroy']()[_0x2452('0x15')](function(){_0x2fb2ae[_0x2452('0x1f')](0xcc)[_0x2452('0x20')]();});}};}function handleEntityNotFound(_0xe97b1c){return function(_0x334aba){if(!_0x334aba){_0xe97b1c[_0x2452('0x1e')](0x194);}return _0x334aba;};}function handleError(_0x312f1b,_0x115e09){_0x115e09=_0x115e09||0x1f4;return function(_0x3b96aa){logger[_0x2452('0x1b')](_0x3b96aa[_0x2452('0x28')]);if(_0x3b96aa[_0x2452('0x29')]){delete _0x3b96aa[_0x2452('0x29')];}_0x312f1b['status'](_0x115e09)[_0x2452('0x2a')](_0x3b96aa);};}function getMustacheRender(_0x1689cd,_0x4cd7e2){return Mustache[_0x2452('0x2b')](_0x1689cd,_['merge'](_0x4cd7e2[_0x2452('0x2c')],{'contact':_0x4cd7e2[_0x2452('0x2d')],'message':_0x4cd7e2['message'],'agent':_0x4cd7e2[_0x2452('0x2e')],'interaction':_0x4cd7e2[_0x2452('0x2f')],'account':_0x4cd7e2[_0x2452('0x30')]}))||'';}function getInteractionUsers(_0x5ce5fb,_0x20a4b4){return new BPromise(function(_0x4565c7,_0x4ba2ae){try{if(_0x20a4b4[_0x5ce5fb['id']]){_0x5ce5fb[_0x2452('0x31')]=_[_0x2452('0x32')](_0x20a4b4[_0x5ce5fb['id']],function(_0x11dba4){return{'id':_0x11dba4['id'],'fullname':_0x11dba4[_0x2452('0x33')]};});}}catch(_0x261bd8){_0x4ba2ae(_0x261bd8);}_0x4565c7(_0x5ce5fb);});}function getInteractionTags(_0x54c36a,_0x58b6c2){return new BPromise(function(_0x510b79,_0x1df280){try{if(_0x54c36a[_0x2452('0x34')]){_0x54c36a[_0x2452('0x35')]=[];_0x54c36a[_0x2452('0x34')][_0x2452('0x36')](',')['forEach'](function(_0x22120a){_0x54c36a['Tags']['push'](_0x58b6c2[_0x22120a]);});}delete _0x54c36a[_0x2452('0x34')];}catch(_0x515e7b){_0x1df280(_0x515e7b);}_0x510b79(_0x54c36a);});}function updateChatInteraction(_0x44ef50,_0xac3b74,_0x514037){return new BPromise(function(_0x30b49f,_0x2cc8a4){return getInteractionUsers(_0x44ef50,_0x514037)[_0x2452('0x15')](function(_0x34d7f9){return getInteractionTags(_0x34d7f9,_0xac3b74);})[_0x2452('0x15')](function(_0x112849){return getStateInteraction(_0x112849);})[_0x2452('0x15')](function(_0x46a561){_0x30b49f(_0x46a561);})['catch'](function(_0x262467){_0x2cc8a4(_0x262467);});});}function getStateInteraction(_0x52c6b6){return new BPromise(function(_0xaea800){_0x52c6b6[_0x2452('0x37')]=0x0;_0x52c6b6['talking']=0x0;_0x52c6b6[_0x2452('0x38')]=0x0;_0x52c6b6[_0x2452('0x39')]=0x0;_0x52c6b6[_0x2452('0x3a')]=0x0;_0x52c6b6[_0x2452('0x3b')]=0x0;if(!_0x52c6b6[_0x2452('0x3c')]&&!_0x52c6b6['UserId']){_0x52c6b6[_0x2452('0x37')]+=0x1;}if(!_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['UserId']){_0x52c6b6[_0x2452('0x3d')]+=0x1;if(_0x52c6b6[_0x2452('0x37')]){_0x52c6b6[_0x2452('0x37')]-=0x1;}}if(_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['disposition']===_0x2452('0x3a')){_0x52c6b6[_0x2452('0x3a')]+=0x1;if(_0x52c6b6[_0x2452('0x37')]){_0x52c6b6[_0x2452('0x37')]-=0x1;}}else if(_0x52c6b6[_0x2452('0x3c')]&&!_0x52c6b6[_0x2452('0x3e')]&&_0x52c6b6['disposition']){_0x52c6b6[_0x2452('0x39')]+=0x1;if(_0x52c6b6['waiting']){_0x52c6b6[_0x2452('0x37')]-=0x1;}}else if(_0x52c6b6[_0x2452('0x3c')]&&_0x52c6b6['UserId']){_0x52c6b6['answered']+=0x1;if(_0x52c6b6['talking']){_0x52c6b6['talking']-=0x1;}}_0x52c6b6[_0x2452('0x3b')]+=0x1;_0xaea800(_0x52c6b6);});}exports['index']=function(_0x15f0e7,_0x5e400a){var _0x1ef02b={},_0x16d938={},_0x55de3d={'count':0x0,'rows':[]};var _0x4c6b8a=_[_0x2452('0x32')](db['ChatInteraction'][_0x2452('0x3f')],function(_0x1cb30a){return{'name':_0x1cb30a[_0x2452('0x40')],'type':_0x1cb30a[_0x2452('0x41')]['key']};});_0x16d938['model']=_[_0x2452('0x32')](_0x4c6b8a,_0x2452('0x29'));_0x16d938[_0x2452('0x42')]=_[_0x2452('0x43')](_0x15f0e7[_0x2452('0x42')]);_0x16d938['filters']=_[_0x2452('0x44')](_0x16d938['model'],_0x16d938[_0x2452('0x42')]);_0x1ef02b['attributes']=_[_0x2452('0x44')](_0x16d938[_0x2452('0x45')],qs['fields'](_0x15f0e7[_0x2452('0x42')]['fields']));_0x1ef02b[_0x2452('0x46')]=_0x1ef02b['attributes']['length']?_0x1ef02b['attributes']:_0x16d938[_0x2452('0x45')];if(!_0x15f0e7[_0x2452('0x42')][_0x2452('0x47')]('nolimit')){_0x1ef02b[_0x2452('0x24')]=qs[_0x2452('0x24')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x24')]);_0x1ef02b[_0x2452('0x22')]=qs['offset'](_0x15f0e7[_0x2452('0x42')]['offset']);}_0x1ef02b[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x49')]);_0x1ef02b[_0x2452('0x4a')]=qs[_0x2452('0x4b')](_[_0x2452('0x4c')](_0x15f0e7[_0x2452('0x42')],_0x16d938[_0x2452('0x4b')]),_0x4c6b8a);var _0x4ec01a=[];var _0x443cf9=squel['select']()[_0x2452('0x4d')]('id')['field'](_0x2452('0x29'))[_0x2452('0x4d')]('color')[_0x2452('0x4e')](_0x2452('0x4f'));var _0x18ec2d=squel[_0x2452('0x50')]()[_0x2452('0x4d')](_0x2452('0x51'))[_0x2452('0x4d')](_0x2452('0x52'))[_0x2452('0x4d')](_0x2452('0x53'))[_0x2452('0x4e')]('user_has_chat_interactions','ui')[_0x2452('0x54')]('users','u',_0x2452('0x55'));var _0x4959a7=squel[_0x2452('0x50')]()[_0x2452('0x4e')](_0x2452('0x56'),'i')[_0x2452('0x54')](_0x2452('0x57'),'c',_0x2452('0x58'))[_0x2452('0x54')](_0x2452('0x59'),'o',_0x2452('0x5a'))[_0x2452('0x54')](_0x2452('0x5b'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0x2452('0x54')](_0x2452('0x5c'),'me',_0x2452('0x5d'))[_0x2452('0x54')](_0x2452('0x5e'),'it',_0x2452('0x5f'))['left_join'](_0x2452('0x4f'),'t',_0x2452('0x60'));var _0x4bce9e=squel[_0x2452('0x61')]();var _0x3a64fc=[];var _0x1b8e8b=squel[_0x2452('0x61')]();var _0x2f1b16;if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x62')]){_0x2f1b16=as[_0x2452('0x63')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x62')]);var _0x243b85=_0x2f1b16['sqlOperator'];for(var _0x5cf96b=0x0;_0x5cf96b<_0x2f1b16[_0x2452('0x64')]['length'];_0x5cf96b++){var _0x20875f=_0x2f1b16[_0x2452('0x64')][_0x5cf96b];var _0x192788='i';var _0x17b1ec=_[_0x2452('0x65')](_0x4c6b8a,[_0x2452('0x29'),_0x20875f['field']]);if(!_0x17b1ec){switch(_0x20875f['field']){case _0x2452('0x66'):if(_0x20875f['value']==0x1){_0x4959a7[_0x2452('0x67')]('`'+_0x20875f['field']+_0x2452('0x68'));}else{_0x4959a7[_0x2452('0x67')]('`'+_0x20875f[_0x2452('0x4d')]+_0x2452('0x69'));}break;case'Contact':if(_0x20875f['operator']==='$substring'){if(_0x20875f[_0x2452('0x6a')][_0x2452('0x36')]('\x20')['length']>0x1){_0x4bce9e[_0x243b85]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x20875f['value']),null);}else{var _0x4b563d='%'+_0x20875f[_0x2452('0x6a')]+'%';_0x4bce9e[_0x243b85]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4b563d,_0x4b563d,_0x4b563d);}}else{_0x17b1ec=_['find'](_0x4c6b8a,[_0x2452('0x29'),_0x2452('0x6b')]);_0x20875f[_0x2452('0x4d')]=_0x2452('0x6b');_0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631['text'],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')]['end']);}break;case'Tag':var _0xa692d5=_0x20875f[_0x2452('0x6a')][_0x2452('0x36')](',')[_0x2452('0x32')](function(_0x401628){return Number(_0x401628);});_0xa692d5[_0x2452('0x6e')](function(_0x4dd13d){_0x1b8e8b['or'](_0x2452('0x6f'),'%,'+_0x4dd13d+',%');});_0x3a64fc=_['union'](_0x3a64fc,_0xa692d5);break;case _0x2452('0x70'):if(_0x20875f[_0x2452('0x71')]===_0x2452('0x72')){_0x4bce9e[_0x243b85](_0x2452('0x73'),'%'+_0x20875f['value']+'%',null);}else{_0x17b1ec=_[_0x2452('0x65')](_0x4c6b8a,[_0x2452('0x29'),'UserId']);_0x20875f[_0x2452('0x4d')]=_0x2452('0x3e');_0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631[_0x2452('0x74')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')]['end']);}break;case'body':_0x1ce631=as[_0x2452('0x6c')]('me',null,_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631[_0x2452('0x74')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631['value'][_0x2452('0x20')]);break;}}else{var _0x1ce631=as[_0x2452('0x6c')](_0x192788,_0x17b1ec[_0x2452('0x41')],_0x20875f);_0x4bce9e[_0x243b85](_0x1ce631['text'],_0x1ce631[_0x2452('0x6a')][_0x2452('0x6d')],_0x1ce631[_0x2452('0x6a')][_0x2452('0x20')]);}}}else{var _0x552633=_(_0x15f0e7['query'])[_0x2452('0x43')]()[_0x2452('0x32')](function(_0x4c5192){return _[_0x2452('0x75')](_0x4c6b8a,[_0x2452('0x29'),_0x4c5192])?_0x4c5192:undefined;})[_0x2452('0x76')]()[_0x2452('0x6a')]();if(!_[_0x2452('0x77')](_0x552633)){_0x552633[_0x2452('0x6e')](function(_0x1e9f1a){if(_0x1e9f1a===_0x2452('0x78')){_0x4959a7[_0x2452('0x4a')](_0x2452('0x79'),[][_0x2452('0x7a')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a]));}else if(_0x1e9f1a===_0x2452('0x7b')){var _0x326570=JSON[_0x2452('0x7c')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a])['$gte'];var _0x16ca73=JSON[_0x2452('0x7c')](_0x15f0e7[_0x2452('0x42')][_0x1e9f1a])['$lte'];_0x4959a7['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x326570,_0x16ca73);}else{if(_0x15f0e7[_0x2452('0x42')][_0x1e9f1a]===_0x2452('0x7d')){_0x4959a7[_0x2452('0x4a')]('i.'+_0x1e9f1a+_0x2452('0x7e'));}else{_0x4959a7['where']('i.'+_0x1e9f1a+'\x20=\x20?',_0x15f0e7['query'][_0x1e9f1a]);}}});}if(_0x15f0e7[_0x2452('0x42')]['read']){if(_0x15f0e7[_0x2452('0x42')]['read']==0x1){_0x4959a7[_0x2452('0x67')]('`unreadMessages`\x20=\x200');}else{_0x4959a7[_0x2452('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')]){_0x3a64fc=_[_0x2452('0x80')](_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')])?_0x15f0e7['query'][_0x2452('0x7f')]:new Array(_0x15f0e7[_0x2452('0x42')][_0x2452('0x7f')]);_0x3a64fc[_0x2452('0x6e')](function(_0x285407){_0x1b8e8b['or'](_0x2452('0x6f'),'%,'+_0x285407+',%');});}if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x81')]){var _0x18f94f=_0x15f0e7[_0x2452('0x42')][_0x2452('0x81')]['replace']('\x5c','\x5c\x5c')[_0x2452('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x18f94f)){_0x4bce9e['or'](_0x2452('0x83'),_0x18f94f+'%');}else{_0x4bce9e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x18f94f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x18f94f+'%');}}}_0x4959a7['where'](_0x4bce9e);_0x4959a7['group']('i.id');var _0x3e372d={'type':db[_0x2452('0x84')][_0x2452('0x85')]['SELECT'],'raw':!![]};var _0x4ef9ed=_0x4959a7['clone']();_0x4ef9ed[_0x2452('0x4d')](_0x2452('0x86'));_0x4ef9ed[_0x2452('0x4d')](_0x2452('0x87'),_0x2452('0x66'));if(_0x1ef02b[_0x2452('0x48')]){_0x1ef02b[_0x2452('0x48')]['forEach'](function(_0x4046d9){var _0x218103=_0x4046d9[0x0]==='contactName'?_0x4046d9[0x0]:'i.'+_0x4046d9[0x0];_0x4959a7[_0x2452('0x48')](_0x218103,_0x4046d9[0x1]===_0x2452('0x88')?![]:!![]);});}if(!_[_0x2452('0x77')](_0x3a64fc)){_0x4959a7[_0x2452('0x67')](_0x1b8e8b);_0x4ef9ed['where'](_0x2452('0x89'),_0x3a64fc);}BPromise['resolve']()[_0x2452('0x15')](function(){if(!_0x2f1b16){if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x78')])return;_0x4ef9ed[_0x2452('0x4a')](_0x2452('0x8a'));_0x4959a7['where'](_0x2452('0x8a'));return;}if(_0x15f0e7[_0x2452('0x8b')][_0x2452('0x8c')]!==_0x2452('0x2e'))return;return _0x15f0e7['user'][_0x2452('0x8d')]({'attributes':['id'],'raw':!![]})[_0x2452('0x15')](function(_0xdeeeff){if(_[_0x2452('0x77')](_0xdeeeff)){_0x4ef9ed[_0x2452('0x4a')](_0x2452('0x8e'));_0x4959a7[_0x2452('0x4a')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x4ef9ed[_0x2452('0x4a')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0xdeeeff,'id'));_0x4959a7['where'](_0x2452('0x79'),_[_0x2452('0x32')](_0xdeeeff,'id'));}});})[_0x2452('0x15')](function(){if(_0x15f0e7[_0x2452('0x8b')][_0x2452('0x8c')]===_0x2452('0x2e')&&!_0x2f1b16&&!_0x15f0e7[_0x2452('0x42')][_0x2452('0x78')])return[];return db[_0x2452('0x8f')]['query'](_0x4ef9ed['toString'](),_0x3e372d);})['then'](function(_0x28c8a8){_0x55de3d['count']=_0x28c8a8['length'];if(_0x55de3d[_0x2452('0x90')]===0x0)return[];return db[_0x2452('0x8f')][_0x2452('0x42')](_0x443cf9[_0x2452('0x91')](),_0x3e372d)[_0x2452('0x15')](function(_0x4f51bb){_0x4ec01a=_[_0x2452('0x92')](_0x4f51bb,'id');_0x3e372d=_[_0x2452('0x93')](_0x3e372d,{'model':db[_0x2452('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15f0e7[_0x2452('0x42')][_0x2452('0x95')]){_0x1ef02b['attributes'][_0x2452('0x6e')](function(_0x5bc8e4){_0x4959a7[_0x2452('0x4d')]('i.'+_0x5bc8e4);});}else{_0x4959a7[_0x2452('0x4d')](_0x2452('0x87'),_0x2452('0x66'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x96'),'Account.key');_0x4959a7['field'](_0x2452('0x97'),_0x2452('0x98'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x99'),_0x2452('0x9a'));_0x4959a7[_0x2452('0x4d')]('i.*');_0x4959a7[_0x2452('0x4d')](_0x2452('0x9b'),_0x2452('0x9c'));_0x4959a7[_0x2452('0x4d')]('c.lastName',_0x2452('0x9d'));_0x4959a7[_0x2452('0x4d')](_0x2452('0x9e'),_0x2452('0x9f'));_0x4959a7['field']('c.phone',_0x2452('0xa0'));_0x4959a7[_0x2452('0x4d')](_0x2452('0xa1'),'Contact.mobile');_0x4959a7[_0x2452('0x4d')](_0x2452('0xa2'),'Contact.fax');_0x4959a7['field']('o.fullname',_0x2452('0xa3'));_0x4959a7[_0x2452('0x4d')](_0x2452('0xa4'),'Owner.internal');_0x4959a7[_0x2452('0x4d')](_0x2452('0xa5'),_0x2452('0x34'));}if(_0x1ef02b['limit'])_0x4959a7['limit'](_0x1ef02b[_0x2452('0x24')]);if(_0x1ef02b['offset'])_0x4959a7[_0x2452('0x22')](_0x1ef02b[_0x2452('0x22')]);return db['sequelize'][_0x2452('0x42')](_0x4959a7[_0x2452('0x91')](),_0x3e372d);})[_0x2452('0x15')](function(_0x485f2a){if(_0x485f2a[_0x2452('0xa6')]>0x0)_0x18ec2d[_0x2452('0x4a')]('ui.ChatInteractionId\x20IN\x20?',_[_0x2452('0x32')](_0x485f2a,'id'));return db[_0x2452('0x8f')][_0x2452('0x42')](_0x18ec2d[_0x2452('0x91')](),_0x3e372d)[_0x2452('0x15')](function(_0x229c79){var _0x3454e4=_['groupBy'](_0x229c79,_0x2452('0xa7'));var _0x114ffd=[];_0x485f2a[_0x2452('0x6e')](function(_0x1e3399){_0x114ffd[_0x2452('0xa8')](updateChatInteraction(_0x1e3399,_0x4ec01a,_0x3454e4));});return BPromise[_0x2452('0xa9')](_0x114ffd);});});})[_0x2452('0x15')](function(_0x28bf18){_0x55de3d[_0x2452('0xaa')]=_0x28bf18;return _0x55de3d;})['then'](respondWithFilteredResult(_0x5e400a,_0x1ef02b))[_0x2452('0xab')](handleError(_0x5e400a,null));};exports[_0x2452('0xac')]=function(_0x37957b,_0x37cf09){var _0x360076={'raw':![],'where':{'id':_0x37957b[_0x2452('0xad')]['id']}},_0x28f93c={};_0x28f93c[_0x2452('0x45')]=_[_0x2452('0x43')](db[_0x2452('0x94')][_0x2452('0x3f')]);_0x28f93c['query']=_[_0x2452('0x43')](_0x37957b[_0x2452('0x42')]);_0x28f93c[_0x2452('0x4b')]=_['intersection'](_0x28f93c['model'],_0x28f93c[_0x2452('0x42')]);_0x360076['attributes']=_[_0x2452('0x44')](_0x28f93c[_0x2452('0x45')],qs[_0x2452('0x95')](_0x37957b[_0x2452('0x42')]['fields']));_0x360076[_0x2452('0x46')]=_0x360076[_0x2452('0x46')][_0x2452('0xa6')]?_0x360076[_0x2452('0x46')]:_0x28f93c[_0x2452('0x45')];if(_0x37957b[_0x2452('0x42')][_0x2452('0xae')]){_0x360076[_0x2452('0xaf')]=[{'all':!![]}];}_0x360076=_[_0x2452('0x93')]({},_0x360076,_0x37957b[_0x2452('0xb0')]);return db[_0x2452('0x94')]['find'](_0x360076)['then'](handleEntityNotFound(_0x37cf09,null))['then'](respondWithResult(_0x37cf09,null))[_0x2452('0xab')](handleError(_0x37cf09,null));};exports[_0x2452('0xb1')]=function(_0x430133,_0x2d12f1){return db[_0x2452('0x94')][_0x2452('0xb1')](_0x430133['body'],{})['then'](respondWithResult(_0x2d12f1,0xc9))[_0x2452('0xab')](handleError(_0x2d12f1,null));};exports[_0x2452('0x27')]=function(_0x3ccc5c,_0x39236b){if(_0x3ccc5c[_0x2452('0x2c')]['id']){delete _0x3ccc5c[_0x2452('0x2c')]['id'];}return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x3ccc5c[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x39236b,null))['then'](saveUpdates(_0x3ccc5c[_0x2452('0x2c')],null))[_0x2452('0x15')](respondWithResult(_0x39236b,null))[_0x2452('0xab')](handleError(_0x39236b,null));};exports[_0x2452('0xb2')]=function(_0x1ae483,_0x444447){return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x1ae483[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x444447,null))[_0x2452('0x15')](removeEntity(_0x444447,null))[_0x2452('0xab')](handleError(_0x444447,null));};exports[_0x2452('0xb3')]=function(_0x132ae5,_0x1b9e68){return db[_0x2452('0x94')][_0x2452('0xb3')]()[_0x2452('0x15')](respondWithResult(_0x1b9e68,null))[_0x2452('0xab')](handleError(_0x1b9e68,null));};exports['createVidaooSession']=function(_0x39728d,_0x35365c){var _0x27cc0c=_0x39728d[_0x2452('0xad')]['id'];var _0x2e6ca3;var _0x44677c;var _0x3eeda5;return db[_0x2452('0x94')]['findOne']({'where':{'id':_0x27cc0c}})[_0x2452('0x15')](function(_0x327495){_0x2e6ca3=_0x327495;return db[_0x2452('0xb4')][_0x2452('0xb5')]({'where':{'id':_0x327495[_0x2452('0x78')]},'attributes':['id',_0x2452('0xb6'),'vidaooEscalation','vidaooTopic','vidaooNote',_0x2452('0xb7')],'raw':!![]});})[_0x2452('0x15')](function(_0xe486f7){if(_0xe486f7&&_0xe486f7[_0x2452('0xb6')]&&_0xe486f7[_0x2452('0xb8')]){_0x44677c=_0xe486f7;var _0x593025={'interaction':{'id':_0x27cc0c},'agent':{'id':_0x39728d[_0x2452('0x8b')]['id'],'name':_0x39728d['user'][_0x2452('0x29')],'fullname':_0x39728d[_0x2452('0x8b')][_0x2452('0x33')],'email':_0x39728d['user']['email']},'contact':_0x39728d[_0x2452('0x2c')]['contact'],'account':_0x39728d[_0x2452('0x2c')][_0x2452('0x30')]};var _0xb4400a={'rejectUnauthorized':![],'method':_0x2452('0xb9'),'url':_0x2452('0xba'),'headers':{'X-APIKEY':_0xe486f7[_0x2452('0xb6')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x39728d['user']['email']],'buttons':null,'topic':_0x44677c['vidaooTopic'],'note':_['isNull'](_0x44677c[_0x2452('0xbb')])?null:getMustacheRender(_0x44677c[_0x2452('0xbb')],_0x593025),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x44677c[_0x2452('0xb7')])){var _0x3afe7f=getMustacheRender(_0x44677c['vidaooMetadata'],_0x593025);var _0x3a8e0b=JSON[_0x2452('0x7c')](_0x3afe7f);_0xb4400a[_0x2452('0x2c')][_0x2452('0xbc')]=_0x3a8e0b;}}catch(_0x3a8057){throw new db[(_0x2452('0x84'))]['ValidationError'](_0x2452('0xbd'));}return rp(_0xb4400a);}else{throw new db[(_0x2452('0x84'))][(_0x2452('0xbe'))](_0x2452('0xbf'));}})[_0x2452('0x15')](function(_0x572caa){_0x3eeda5=_0x572caa;if(_0x3eeda5['id']){var _0x257dfd={'body':_0x3eeda5[_0x2452('0xc0')],'ChatWebsiteId':_0x44677c['id'],'ChatInteractionId':_0x2e6ca3['id'],'direction':'out','UserId':_0x39728d['user']['id']};return db[_0x2452('0xc1')][_0x2452('0xb1')](_0x257dfd,{});}else{throw new db[(_0x2452('0x84'))][(_0x2452('0xbe'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x2452('0x15')](function(){return _0x2e6ca3[_0x2452('0xc2')]({'vidaooSessionId':_0x3eeda5['id']});})[_0x2452('0x15')](respondWithResult(_0x35365c,null))[_0x2452('0xab')](handleError(_0x35365c,null));};exports[_0x2452('0xc3')]=function(_0x27ac75,_0x73af1a){if(_0x27ac75[_0x2452('0x2c')]['id']){delete _0x27ac75[_0x2452('0x2c')]['id'];}return db['ChatInteraction'][_0x2452('0x65')]({'where':{'id':_0x27ac75['params']['id']},'include':[{'model':db['CmContact'],'as':_0x2452('0xc4')}]})[_0x2452('0x15')](handleEntityNotFound(_0x73af1a,null))[_0x2452('0x15')](saveUpdates(_0x27ac75[_0x2452('0x2c')],null))[_0x2452('0x15')](respondWithResult(_0x73af1a,null))['catch'](handleError(_0x73af1a,null));};exports[_0x2452('0xc5')]=function(_0x5c1308,_0x4b02e6){if(_0x5c1308['body']['id']){delete _0x5c1308[_0x2452('0x2c')]['id'];}return db[_0x2452('0x94')][_0x2452('0x65')]({'where':{'id':_0x5c1308[_0x2452('0xad')]['id']}})[_0x2452('0x15')](function(_0x1e45ff){if(!_0x1e45ff){logger[_0x2452('0x1b')](_0x2452('0xc6'),_0x2452('0xc5'),0x194,_0x2452('0xc7'));_0x4b02e6['sendStatus'](0x194);}else{if(_0x1e45ff[_0x2452('0x3e')]){throw new db['Sequelize']['ValidationError'](_0x2452('0xc8'));}}return _0x1e45ff;})['then'](function(_0x703ee5){if(_0x703ee5){return _0x703ee5[_0x2452('0x27')]({'closed':_0x5c1308[_0x2452('0x2c')][_0x2452('0x3c')],'disposition':_0x5c1308['body'][_0x2452('0xc9')]})[_0x2452('0x15')](function(_0x419529){return _0x419529;});}})[_0x2452('0x15')](function(){return respondWithRpcPromise(_0x2452('0xca'),_0x2452('0xc5'),_0x5c1308[_0x2452('0x2c')],client9004);})[_0x2452('0x15')](respondWithResult(_0x4b02e6,null))[_0x2452('0xab')](handleError(_0x4b02e6,null));};exports['attachmentUpload']=function(_0x26dbe2,_0x3be01e){_0x26dbe2[_0x2452('0x2c')]['name']=_0x26dbe2[_0x2452('0xcb')]['originalname'];_0x26dbe2[_0x2452('0x2c')][_0x2452('0xcc')]=_0x26dbe2[_0x2452('0xcb')][_0x2452('0xcd')];_0x26dbe2[_0x2452('0x2c')]['type']=_0x26dbe2[_0x2452('0xcb')]['mimetype'];return db['Attachment']['create'](_0x26dbe2[_0x2452('0x2c')])['then'](respondWithResult(_0x3be01e,0xc9))[_0x2452('0xab')](handleError(_0x3be01e,null));};exports['attachmentDownload']=function(_0x12b4c6,_0x59fb94){return db[_0x2452('0x94')][_0x2452('0xb5')]({'where':{'id':_0x12b4c6[_0x2452('0xad')]['id']},'raw':!![]})[_0x2452('0x15')](handleEntityNotFound(_0x59fb94,null))[_0x2452('0x15')](function(_0x17f759){if(_0x17f759){if(_0x17f759['closed']){return _0x59fb94[_0x2452('0x1f')](0x193)['json']({'status':0x193,'message':_0x2452('0xce')});}return db[_0x2452('0xcf')][_0x2452('0xb5')]({'where':{'id':_0x12b4c6[_0x2452('0x42')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x59fb94,null));}})[_0x2452('0x15')](function(_0xc91e25){if(_0xc91e25){var _0xf07c57=_0xc91e25[_0x2452('0xd0')]!==null;var _0x5edb11=path[_0x2452('0xd1')](config[_0x2452('0xd2')],'server/files/attachments/');if(_0xf07c57){_0x5edb11=path[_0x2452('0xd1')](_0x5edb11,_0x2452('0xd3'));}var _0x19722b=path[_0x2452('0xd1')](_0x5edb11,_0xc91e25['basename']);return _0x59fb94[_0x2452('0xd4')](_0x19722b);}})[_0x2452('0xab')](handleError(_0x59fb94,null));};exports['close']=function(_0x4e342c,_0x4e8fd9){var _0x173d77=null;var _0x3c454d=null;var _0x47ba11=null;if(_0x4e342c['body']['id']){delete _0x4e342c[_0x2452('0x2c')]['id'];}if(_0x4e342c[_0x2452('0x2c')][_0x2452('0xd5')]){_0x47ba11=path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0xd6'),util[_0x2452('0xd7')](_0x2452('0xd8'),Date[_0x2452('0xd9')]()));_0x4e342c[_0x2452('0x2c')][_0x2452('0xda')]=_0x47ba11;}return db['ChatInteraction'][_0x2452('0x65')]({'where':{'id':_0x4e342c['params']['id']},'include':[{'model':db[_0x2452('0xc1')],'as':_0x2452('0xdb'),'include':[{'model':db[_0x2452('0x70')],'as':_0x2452('0x70')}]}]})['then'](handleEntityNotFound(_0x4e8fd9,null))[_0x2452('0x15')](saveUpdates(_0x4e342c[_0x2452('0x2c')],null))[_0x2452('0x15')](function(_0x3682ee){if(_0x3682ee){_0x173d77=_0x3682ee;return db[_0x2452('0xb4')][_0x2452('0x65')]({'where':{'id':_0x173d77[_0x2452('0x78')]}});}})[_0x2452('0x15')](function(_0x283cb3){if(_0x283cb3){_0x3c454d=_0x283cb3;return db[_0x2452('0xdc')]['find']({'where':{'id':_0x173d77['ContactId']}});}})[_0x2452('0x15')](function(_0x48ce24){if(_0x48ce24){if(_0x47ba11){var _0x38c7a0=null;for(var _0x48eff7=0x1;_0x48eff7<_0x173d77[_0x2452('0xdb')][_0x2452('0xa6')];++_0x48eff7){_0x38c7a0=_0x173d77[_0x2452('0xdb')][_0x48eff7];var _0x1f0117=_0x38c7a0[_0x2452('0x3e')]?util[_0x2452('0xd7')](_0x2452('0xdd'),_0x3c454d[_0x2452('0xde')],_0x38c7a0[_0x2452('0x3e')]):_0x2452('0xdf');var _0x53ac7a=_0x4e342c['body'][_0x2452('0xe0')]||util[_0x2452('0xd7')](_0x2452('0xdd'),_0x2452('0xe1'),_0x38c7a0[_0x2452('0x6b')]);switch(_0x3c454d[_0x2452('0xe2')]){case _0x2452('0xe3'):_0x1f0117=_0x38c7a0['UserId']?util[_0x2452('0xd7')]('%s%d',_0x3c454d['agentAlias'],_0x38c7a0[_0x2452('0x3e')]):'System';break;case _0x2452('0xe4'):_0x1f0117=_0x38c7a0['UserId']?_0x38c7a0[_0x2452('0x70')][_0x2452('0xe5')]||_0x38c7a0[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf');break;case _0x2452('0xe6'):_0x1f0117=_0x38c7a0[_0x2452('0x3e')]?_0x38c7a0[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf');break;default:_0x1f0117=_0x38c7a0['UserId']?util[_0x2452('0xd7')](_0x2452('0xdd'),_0x3c454d[_0x2452('0xde')],_0x38c7a0[_0x2452('0x3e')]):_0x2452('0xdf');}var _0x3d223d=util['format'](_0x2452('0xe7'),moment(_0x38c7a0[_0x2452('0x7b')])[_0x2452('0xd7')](_0x2452('0xe8')),_0x38c7a0[_0x2452('0xe9')]==='in'?_0x53ac7a:_0x1f0117,_0x38c7a0[_0x2452('0x2c')]);if(!_0x38c7a0['secret']){fs[_0x2452('0xea')](_0x47ba11,_0x3d223d);}}return db[_0x2452('0xeb')][_0x2452('0xb5')]({'where':{'service':!![]},'include':[{'model':db[_0x2452('0xec')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x2452('0xed')],'as':_0x2452('0xed'),'raw':!![]}]}]});}}})['then'](function(_0x8392be){if(!_0x8392be||!_0x8392be[_0x2452('0xee')]||!_0x4e342c[_0x2452('0x2c')])return _0x173d77;var _0x1c5ccc=_0x8392be[_0x2452('0xef')]();return respondWithRpcPromise(_0x2452('0xf0'),'sendMail',{'account':_0x1c5ccc,'message':{'from':util[_0x2452('0xd7')]('\x22%s\x22\x20<%s>',_0x8392be['name'],_0x8392be[_0x2452('0xf1')]||_0x8392be[_0x2452('0xee')][_0x2452('0x8b')]),'to':_0x4e342c['body']['mailTranscript'],'subject':_0x2452('0xf2'),'text':util[_0x2452('0xd7')](_0x2452('0xf3'),_0x4e342c[_0x2452('0x2c')][_0x2452('0xd5')]),'attachments':[{'path':_0x47ba11}]}})[_0x2452('0x15')](function(){return _0x173d77;})[_0x2452('0xab')](function(_0x2cd73c){logger[_0x2452('0x1b')](_0x2cd73c);});})['then'](respondWithStatusCode(_0x4e8fd9,0xc8))['catch'](handleError(_0x4e8fd9,null));};exports[_0x2452('0xf4')]=function(_0x3a79d9,_0xd86a41){return db[_0x2452('0xc1')][_0x2452('0x65')]({'where':{'id':_0x3a79d9['params']['id']}})[_0x2452('0x15')](handleEntityNotFound(_0xd86a41,null))[_0x2452('0x15')](function(_0x56d8b6){if(_0x56d8b6){return _0x56d8b6[_0x2452('0xf4')](_0x3a79d9['body']['ids'],_[_0x2452('0xf5')](_0x3a79d9[_0x2452('0x2c')],[_0x2452('0xf6'),'id'])||{});}})[_0x2452('0x15')](respondWithResult(_0xd86a41,null))[_0x2452('0xab')](handleError(_0xd86a41,null));};exports['getMessages']=function(_0x2ec7b4,_0x2395e0){var _0x5d2e57={'raw':![],'where':{}};var _0x39936f={};var _0x5481d5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2452('0xb5')]({'where':{'id':_0x2ec7b4[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x2395e0,null))[_0x2452('0x15')](function(_0x56a09d){if(_0x56a09d){_0x39936f[_0x2452('0x45')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x39936f[_0x2452('0x42')]=_['keys'](_0x2ec7b4[_0x2452('0x42')]);_0x39936f[_0x2452('0x4b')]=_[_0x2452('0x44')](_0x39936f[_0x2452('0x45')],_0x39936f[_0x2452('0x42')]);_0x5d2e57[_0x2452('0x46')]=_[_0x2452('0x44')](_0x39936f[_0x2452('0x45')],qs[_0x2452('0x95')](_0x2ec7b4['query'][_0x2452('0x95')]));_0x5d2e57[_0x2452('0x46')]=_0x5d2e57[_0x2452('0x46')][_0x2452('0xa6')]?_0x5d2e57[_0x2452('0x46')]:_0x39936f[_0x2452('0x45')];if(!_0x2ec7b4['query'][_0x2452('0x47')](_0x2452('0xf7'))){_0x5d2e57[_0x2452('0x24')]=qs['limit'](_0x2ec7b4['query'][_0x2452('0x24')]);_0x5d2e57['offset']=qs[_0x2452('0x22')](_0x2ec7b4[_0x2452('0x42')][_0x2452('0x22')]);}_0x5d2e57[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x2ec7b4[_0x2452('0x42')][_0x2452('0x49')]);_0x5d2e57['where']=qs['filters'](_[_0x2452('0x4c')](_0x2ec7b4[_0x2452('0x42')],_0x39936f['filters']));_0x5d2e57[_0x2452('0x4a')][_0x2452('0xa7')]=_0x56a09d['id'];if(_0x2ec7b4['query'][_0x2452('0x81')]){_0x5d2e57[_0x2452('0x4a')]=_[_0x2452('0x93')](_0x5d2e57[_0x2452('0x4a')],{'$or':_['map'](_0x5d2e57[_0x2452('0x46')],function(_0x1e6e2c){var _0x45d809={};_0x45d809[_0x1e6e2c]={'$like':'%'+_0x2ec7b4[_0x2452('0x42')][_0x2452('0x81')]+'%'};return _0x45d809;})});}if(_0x2ec7b4['query'][_0x2452('0xf8')]){var _0x4806e4=_0x2ec7b4[_0x2452('0x42')]['$gte']['split'](',');var _0x519968={};_0x519968[_0x4806e4[0x0]]={'$gte':moment(_0x4806e4[0x1])[_0x2452('0xd7')](_0x2452('0xf9'))};_0x5d2e57[_0x2452('0x4a')]=_[_0x2452('0x93')](_0x5d2e57[_0x2452('0x4a')],_0x519968);}_0x5d2e57=_[_0x2452('0x93')]({},_0x5d2e57,_0x2ec7b4[_0x2452('0xb0')]);return db['ChatMessage']['count']({'where':_0x5d2e57['where']})['then'](function(_0x582812){_0x5481d5['count']=_0x582812;if(_0x2ec7b4[_0x2452('0x42')]['includeAll']){_0x5d2e57[_0x2452('0xaf')]=[{'all':!![]}];}return db['ChatMessage'][_0x2452('0xfa')](_0x5d2e57);})[_0x2452('0x15')](function(_0x42d5af){_0x5481d5['rows']=_0x42d5af;return _0x5481d5;});}})[_0x2452('0x15')](respondWithFilteredResult(_0x2395e0,_0x5d2e57))[_0x2452('0xab')](handleError(_0x2395e0,null));};exports[_0x2452('0xfb')]=function(_0x23c05e,_0x447013){var _0xaa3e42={'where':{}},_0x10a04f={},_0x4eaad6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x2452('0xb5')]({'where':{'id':_0x23c05e[_0x2452('0xad')]['id']}})[_0x2452('0x15')](handleEntityNotFound(_0x447013,null))[_0x2452('0x15')](function(_0x59c8d3){if(_0x59c8d3){_0x10a04f[_0x2452('0x45')]=_[_0x2452('0x43')](db[_0x2452('0xc1')]['rawAttributes']);_0x10a04f[_0x2452('0x42')]=_[_0x2452('0x43')](_0x23c05e[_0x2452('0x42')]);_0x10a04f['filters']=_[_0x2452('0x44')](_0x10a04f[_0x2452('0x45')],_0x10a04f['query']);_0xaa3e42['attributes']=_['intersection'](_0x10a04f[_0x2452('0x45')],qs[_0x2452('0x95')](_0x23c05e[_0x2452('0x42')]['fields']));_0xaa3e42[_0x2452('0x46')]=_0xaa3e42['attributes']['length']?_0xaa3e42[_0x2452('0x46')]:_0x10a04f[_0x2452('0x45')];if(!_0x23c05e[_0x2452('0x42')]['hasOwnProperty'](_0x2452('0xf7'))){_0xaa3e42[_0x2452('0x24')]=qs[_0x2452('0x24')](_0x23c05e[_0x2452('0x42')][_0x2452('0x24')]);_0xaa3e42[_0x2452('0x22')]=qs[_0x2452('0x22')](_0x23c05e[_0x2452('0x42')][_0x2452('0x22')]);}_0xaa3e42[_0x2452('0x48')]=qs[_0x2452('0x49')](_0x23c05e[_0x2452('0x42')]['sort']);_0xaa3e42[_0x2452('0x4a')]=qs[_0x2452('0x4b')](_[_0x2452('0x4c')](_0x23c05e['query'],_0x10a04f[_0x2452('0x4b')]));_0xaa3e42['where']['ChatInteractionId']=_0x59c8d3['id'];if(_0x23c05e[_0x2452('0x42')][_0x2452('0x81')]){_0xaa3e42['where']=_[_0x2452('0x93')](_0xaa3e42['where'],{'$or':_['map'](_0xaa3e42[_0x2452('0x46')],function(_0x59a23a){var _0x1d4f38={};_0x1d4f38[_0x59a23a]={'$like':'%'+_0x23c05e[_0x2452('0x42')][_0x2452('0x81')]+'%'};return _0x1d4f38;})});}_0xaa3e42[_0x2452('0x4a')][_0x2452('0xfc')]=![];if(_0x23c05e[_0x2452('0x42')]['id']){_0xaa3e42[_0x2452('0x4a')]['id']={'$gt':_0x23c05e[_0x2452('0x42')]['id']};}_0xaa3e42=_[_0x2452('0x93')]({},_0xaa3e42,_0x23c05e[_0x2452('0xb0')]);return db[_0x2452('0xc1')][_0x2452('0x90')]({'where':_0xaa3e42[_0x2452('0x4a')]})[_0x2452('0x15')](function(_0x1a04a9){_0x4eaad6['count']=_0x1a04a9;_0xaa3e42[_0x2452('0xaf')]=[];if(_0x23c05e[_0x2452('0x42')]['includeAgent']){_0xaa3e42[_0x2452('0xaf')][_0x2452('0xa8')]({'model':db[_0x2452('0x70')],'as':_0x2452('0x70'),'attributes':['id',_0x2452('0x33'),_0x2452('0xe5')]});}if(_0x23c05e['query'][_0x2452('0xae')]){_0xaa3e42[_0x2452('0xaf')]=[{'all':!![]}];}return db[_0x2452('0xc1')][_0x2452('0xfa')](_0xaa3e42);})[_0x2452('0x15')](function(_0x198a21){_0x4eaad6[_0x2452('0xaa')]=_0x198a21;return _0x4eaad6;});}})[_0x2452('0x15')](respondWithFilteredResult(_0x447013,_0xaa3e42))[_0x2452('0xab')](handleError(_0x447013,null));};exports['addTags']=function(_0x35a94a,_0x40d4ed){return db['ChatInteraction']['find']({'where':{'id':_0x35a94a[_0x2452('0xad')]['id']}})['then'](handleEntityNotFound(_0x40d4ed,null))[_0x2452('0x15')](function(_0x5edce1){if(_0x5edce1){return _0x5edce1['setTags'](_0x35a94a[_0x2452('0x2c')][_0x2452('0xf6')],_[_0x2452('0xf5')](_0x35a94a[_0x2452('0x2c')],['ids','id'])||{})[_0x2452('0xfd')](function(){return db[_0x2452('0xfe')][_0x2452('0xfa')]({'attributes':['id','name','color'],'where':{'id':_0x35a94a[_0x2452('0x2c')][_0x2452('0xf6')]}});})[_0x2452('0x15')](function(_0x578cb2){socket['emit'](_0x2452('0xff'),{'id':Number(_0x35a94a[_0x2452('0xad')]['id']),'tags':_0x578cb2||[]});return{'id':Number(_0x35a94a['params']['id']),'tags':_0x578cb2||[]};});}})[_0x2452('0x15')](respondWithResult(_0x40d4ed,null))[_0x2452('0xab')](handleError(_0x40d4ed,null));};exports['removeTags']=function(_0x29aa63,_0x12cf38){return db[_0x2452('0x94')]['find']({'where':{'id':_0x29aa63[_0x2452('0xad')]['id']}})['then'](handleEntityNotFound(_0x12cf38,null))[_0x2452('0x15')](function(_0x3ce9bf){if(_0x3ce9bf){return _0x3ce9bf[_0x2452('0x100')](_0x29aa63[_0x2452('0x42')][_0x2452('0xf6')]);}})[_0x2452('0x15')](respondWithStatusCode(_0x12cf38,null))[_0x2452('0xab')](handleError(_0x12cf38,null));};exports[_0x2452('0xd4')]=function(_0xa57faf,_0x238d8e){var _0x25968d=moment()[_0x2452('0x101')]()['toString']();var _0x16d2fc=path[_0x2452('0xd1')](config['root'],_0x2452('0x102'),_0x2452('0x103'),_0x2452('0x104'));var _0xfdca38=path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0x102'),_0x2452('0x103'),_0x2452('0x105'));var _0x56575a=path[_0x2452('0xd1')](_0x16d2fc,_0x25968d);var _0x4724d2=util['format'](_0x2452('0x106'),_0xa57faf[_0x2452('0xad')]['id'],_0x25968d);var _0x98ad63=path['join'](_0x16d2fc,_0x4724d2);var _0x4d2a07=[];_0x4d2a07[_0x2452('0xa8')]({'model':db[_0x2452('0x70')],'as':_0x2452('0x70'),'attributes':['id',_0x2452('0x33')],'raw':!![]});_0x4d2a07['push']({'model':db[_0x2452('0xdc')],'as':'Contact','attributes':['id','firstName',_0x2452('0x107')],'raw':!![]});if(_0xa57faf[_0x2452('0x42')][_0x2452('0x105')]){_0x4d2a07[_0x2452('0xa8')]({'model':db[_0x2452('0xcf')],'as':'Attachment','raw':!![]});}var _0x4faf49=[{'model':db[_0x2452('0xc1')],'as':_0x2452('0xdb'),'attributes':['id',_0x2452('0x2c'),'createdAt',_0x2452('0xe9'),_0x2452('0xfc'),_0x2452('0x108')],'include':_0x4d2a07}];_0x4faf49[_0x2452('0xa8')]({'model':db[_0x2452('0xb4')],'as':_0x2452('0x109'),'attributes':['id',_0x2452('0x29')]});_0x4faf49[_0x2452('0xa8')]({'model':db['User'],'as':'Owner','attributes':['id',_0x2452('0x33')]});return db[_0x2452('0x94')]['find']({'where':{'id':_0xa57faf[_0x2452('0xad')]['id']},'include':_0x4faf49})[_0x2452('0x15')](handleEntityNotFound(_0x238d8e,null))[_0x2452('0x15')](function(_0x160781){if(_0x160781){var _0x16aa9b=_0x160781['get']({'plain':!![]});fs['mkdirSync'](_0x56575a);var _0x19660b={'channel':_0x2452('0x10a'),'account':_0x16aa9b['Account'][_0x2452('0x29')],'agent':_0x16aa9b['Owner']?_0x16aa9b[_0x2452('0x10b')][_0x2452('0x33')]:'N.A.','createdAt':moment(_0x16aa9b['createdAt'])[_0x2452('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2452('0x91')](),'closedAt':_0x16aa9b[_0x2452('0x3c')]?moment(_0x16aa9b[_0x2452('0x10c')])[_0x2452('0xd7')](_0x2452('0xf9'))['toString']():'','disposition':_0x16aa9b[_0x2452('0xc9')],'chatInfo':{'browser':_0x16aa9b[_0x2452('0x10d')],'os':_0x16aa9b[_0x2452('0x10e')],'referer':_0x16aa9b[_0x2452('0x10f')],'customerIp':_0x16aa9b[_0x2452('0x110')],'customerPort':_0x16aa9b[_0x2452('0x111')]?_0x16aa9b['customerPort']:'N.A.'},'messages':_(_0x16aa9b[_0x2452('0xdb')])[_0x2452('0x112')]()[_0x2452('0x81')]({'secret':![]})[_0x2452('0x32')](function(_0x362b56){if(_0x362b56[_0x2452('0xcf')]){var _0x27b007=path[_0x2452('0xd1')](_0xfdca38,_0x362b56[_0x2452('0xcf')]['basename']);if(fs[_0x2452('0x113')](_0x27b007)){fs[_0x2452('0x114')](_0x27b007)[_0x2452('0x115')](fs['createWriteStream'](path[_0x2452('0xd1')](_0x56575a,_0x362b56['Attachment'][_0x2452('0xcc')])));}}return{'date':moment(_0x362b56['createdAt'])[_0x2452('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x362b56[_0x2452('0xe9')]===_0x2452('0x116')?_0x362b56['User']?_0x362b56[_0x2452('0x70')][_0x2452('0x33')]:_0x2452('0xdf'):_0x362b56[_0x2452('0xc4')][_0x2452('0x117')]+(_0x362b56[_0x2452('0xc4')][_0x2452('0x107')]?'\x20'+_0x362b56[_0x2452('0xc4')][_0x2452('0x107')]:''),'body':_0x362b56['Attachment']?_0x362b56[_0x2452('0xcf')][_0x2452('0xcc')]:_0x362b56[_0x2452('0x2c')],'direction':_0x362b56[_0x2452('0xe9')]===_0x2452('0x116')?'A':'C','secret':_0x362b56[_0x2452('0xfc')],'read':_0x362b56[_0x2452('0x108')],'attachment':_0x362b56[_0x2452('0xcf')]};})[_0x2452('0x6a')]()};return ejs[_0x2452('0x118')](path[_0x2452('0xd1')](config[_0x2452('0xd2')],_0x2452('0x102'),_0x2452('0x119'),_0x2452('0x11a')),{'interaction':_0x19660b})['then'](function(_0x388ee5){var _0xe6661a=path[_0x2452('0xd1')](_0x56575a,'transcript-'+_0x16aa9b['id']+'-'+_0x25968d+_0x2452('0x11b'));var _0x4d298d={'path':_0xe6661a,'channel':'Chat','interactionId':_0x16aa9b['id']};return pdf[_0x2452('0x11c')](_0x388ee5,_0x4d298d);})[_0x2452('0x15')](function(){return new Promise(function(_0x4685a1,_0x569219){zipdir(_0x56575a,{'saveTo':_0x98ad63},function(_0x4aa0c4,_0x18d287){if(_0x4aa0c4)return _0x569219(_0x4aa0c4);return _0x4685a1(_0x18d287);});})[_0x2452('0x15')](function(){return new BPromise(function(_0x4f58bc,_0x910348){rimraf(_0x56575a,function(_0x20d1c5){if(_0x20d1c5)_0x910348(_0x20d1c5);return _0x4f58bc();});});})['then'](function(){return _0x238d8e[_0x2452('0xd4')](_0x98ad63,_0x4724d2,function(_0x1b3952){if(_0x1b3952){logger[_0x2452('0x1b')](_0x2452('0x11d'),_0x1b3952);}else{fs[_0x2452('0x11e')](_0x98ad63);}});});});}else{return _0x238d8e[_0x2452('0x1e')](0xc8);}})['catch'](handleError(_0x238d8e,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fcd9a27..90d5635 100644 --- a/server/api/chatInteraction/chatInteraction.events.js +++ b/server/api/chatInteraction/chatInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x354b=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','setDataValue'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x354b,0x148));var _0xb354=function(_0x21ea1f,_0x3548a9){_0x21ea1f=_0x21ea1f-0x0;var _0x1801e2=_0x354b[_0x21ea1f];return _0x1801e2;};'use strict';var EventEmitter=require(_0xb354('0x0'));var ChatInteraction=require(_0xb354('0x1'))['db'][_0xb354('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0xb354('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb354('0x4')](0x0);var events={'afterCreate':_0xb354('0x5'),'afterUpdate':'update','afterDestroy':_0xb354('0x6')};function emitEvent(_0x34e743){return function(_0x132ae8,_0x31e9b9,_0x597c96){_0x132ae8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5f3e7f){_0x132ae8[_0xb354('0x7')](_0xb354('0x8'),_0x5f3e7f['map'](function(_0x5c6cc9){return{'id':_0x5c6cc9['id']};}));return ChatMessage[_0xb354('0x9')]({'where':{'ChatInteractionId':_0x132ae8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41c5df){_0x132ae8['setDataValue'](_0xb354('0xa'),_0x41c5df['length']);ChatInteractionEvents['emit'](_0x34e743+':'+_0x132ae8['id'],_0x132ae8);ChatInteractionEvents[_0xb354('0xb')](_0x34e743,_0x132ae8);_0x597c96(null);})[_0xb354('0xc')](_0x597c96(null));};}for(var e in events){if(events[_0xb354('0xd')](e)){var event=events[e];ChatInteraction[_0xb354('0xe')](e,emitEvent(event));}}module[_0xb354('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x0129=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','remove','getUsers','then','setDataValue','Users'];(function(_0x3d9b23,_0x52894d){var _0xf22517=function(_0x1933d0){while(--_0x1933d0){_0x3d9b23['push'](_0x3d9b23['shift']());}};_0xf22517(++_0x52894d);}(_0x0129,0x1ab));var _0x9012=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0129[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9012('0x0'));var ChatInteraction=require(_0x9012('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x9012('0x1'))['db'][_0x9012('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9012('0x3')};function emitEvent(_0x357325){return function(_0x2daea0,_0x365391,_0x309680){_0x2daea0[_0x9012('0x4')]({'attributes':['id'],'raw':!![]})[_0x9012('0x5')](function(_0x2bed90){_0x2daea0[_0x9012('0x6')](_0x9012('0x7'),_0x2bed90['map'](function(_0x414c9f){return{'id':_0x414c9f['id']};}));return ChatMessage[_0x9012('0x8')]({'where':{'ChatInteractionId':_0x2daea0['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1f18ac){_0x2daea0['setDataValue'](_0x9012('0x9'),_0x1f18ac[_0x9012('0xa')]);ChatInteractionEvents[_0x9012('0xb')](_0x357325+':'+_0x2daea0['id'],_0x2daea0);ChatInteractionEvents[_0x9012('0xb')](_0x357325,_0x2daea0);_0x309680(null);})[_0x9012('0xc')](_0x309680(null));};}for(var e in events){if(events[_0x9012('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x9012('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index af376f2..ac5bafa 100644 --- a/server/api/chatInteraction/chatInteraction.model.js +++ b/server/api/chatInteraction/chatInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9084=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x9084,0x1ed));var _0x4908=function(_0x5ae619,_0x365b3d){_0x5ae619=_0x5ae619-0x0;var _0x40c0c9=_0x9084[_0x5ae619];return _0x40c0c9;};'use strict';var _=require(_0x4908('0x0'));var util=require(_0x4908('0x1'));var logger=require(_0x4908('0x2'))(_0x4908('0x3'));var moment=require(_0x4908('0x4'));var BPromise=require(_0x4908('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4908('0x6'));var rimraf=require(_0x4908('0x7'));var config=require(_0x4908('0x8'));var attributes=require(_0x4908('0x9'));module[_0x4908('0xa')]=function(_0x1789aa,_0x4807ee){return _0x1789aa[_0x4908('0xb')](_0x4908('0xc'),attributes,{'tableName':_0x4908('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bb508,_0x59819f,_0x2809db){if(_0x3bb508[_0x4908('0xe')](_0x4908('0xf'))){_0x3bb508[_0x4908('0x10')]=moment()[_0x4908('0x11')](_0x4908('0x12'));}_0x2809db(null,_0x3bb508);}},'charset':'utf8mb4','collate':_0x4908('0x13')});}; \ No newline at end of file +var _0xa385=['util','../../config/logger','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash'];(function(_0x1cf752,_0xe827f7){var _0x192b79=function(_0x3090b9){while(--_0x3090b9){_0x1cf752['push'](_0x1cf752['shift']());}};_0x192b79(++_0xe827f7);}(_0xa385,0x8f));var _0x5a38=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xa385[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x5a38('0x0'));var util=require(_0x5a38('0x1'));var logger=require(_0x5a38('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5a38('0x3'));var rp=require(_0x5a38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a38('0x5'));var attributes=require(_0x5a38('0x6'));module[_0x5a38('0x7')]=function(_0x5956e2,_0x57d35b){return _0x5956e2[_0x5a38('0x8')](_0x5a38('0x9'),attributes,{'tableName':_0x5a38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e0920,_0xc0af44,_0x5dbc38){if(_0x2e0920[_0x5a38('0xb')](_0x5a38('0xc'))){_0x2e0920['closedAt']=moment()[_0x5a38('0xd')](_0x5a38('0xe'));}_0x5dbc38(null,_0x2e0920);}},'charset':'utf8mb4','collate':_0x5a38('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 17796dc..28f5f97 100644 --- a/server/api/chatInteraction/chatInteraction.rpc.js +++ b/server/api/chatInteraction/chatInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x111e=['then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ChatInteraction','update','body','options','raw','where','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x111e,0x1d1));var _0xe111=function(_0x31fdd7,_0x10f202){_0x31fdd7=_0x31fdd7-0x0;var _0x268731=_0x111e[_0x31fdd7];return _0x268731;};'use strict';var _=require(_0xe111('0x0'));var util=require('util');var moment=require(_0xe111('0x1'));var BPromise=require(_0xe111('0x2'));var rs=require(_0xe111('0x3'));var fs=require('fs');var Redis=require(_0xe111('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe111('0x5'));var logger=require(_0xe111('0x6'))(_0xe111('0x7'));var config=require(_0xe111('0x8'));var jayson=require(_0xe111('0x9'));var client=jayson[_0xe111('0xa')][_0xe111('0xb')]({'port':0x232a});config[_0xe111('0xc')]=_[_0xe111('0xd')](config[_0xe111('0xc')],{'host':_0xe111('0xe'),'port':0x18eb});var socket=require(_0xe111('0xf'))(new Redis(config[_0xe111('0xc')]));require(_0xe111('0x10'))[_0xe111('0x11')](socket);function respondWithRpcPromise(_0x11089b,_0x56fdd2,_0x5a9821){return new BPromise(function(_0x327d84,_0x120b18){return client[_0xe111('0x12')](_0x11089b,_0x5a9821)[_0xe111('0x13')](function(_0x530ee2){logger['info'](_0xe111('0x14'),_0x56fdd2,_0xe111('0x15'));logger[_0xe111('0x16')](_0xe111('0x17'),_0x56fdd2,_0xe111('0x15'),JSON['stringify'](_0x530ee2));if(_0x530ee2[_0xe111('0x18')]){if(_0x530ee2[_0xe111('0x18')]['code']===0x1f4){logger[_0xe111('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x56fdd2,_0x530ee2[_0xe111('0x18')][_0xe111('0x19')]);return _0x120b18(_0x530ee2[_0xe111('0x18')]['message']);}logger[_0xe111('0x18')](_0xe111('0x14'),_0x56fdd2,_0x530ee2['error']['message']);return _0x327d84(_0x530ee2[_0xe111('0x18')]['message']);}else{logger[_0xe111('0x1a')](_0xe111('0x14'),_0x56fdd2,_0xe111('0x15'));_0x327d84(_0x530ee2[_0xe111('0x1b')][_0xe111('0x19')]);}})[_0xe111('0x1c')](function(_0x2fd7b9){logger[_0xe111('0x18')](_0xe111('0x14'),_0x56fdd2,_0x2fd7b9);_0x120b18(_0x2fd7b9);});});}exports['UpdateChatInteraction']=function(_0x353363){var _0x29fbe5=this;return new Promise(function(_0xbb882f,_0x582365){return db[_0xe111('0x1d')][_0xe111('0x1e')](_0x353363[_0xe111('0x1f')],{'raw':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')][_0xe111('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')][_0xe111('0x22')]||null:null,'attributes':_0x353363[_0xe111('0x20')]?_0x353363[_0xe111('0x20')]['attributes']||null:null,'limit':_0x353363['options']?_0x353363[_0xe111('0x20')]['limit']||null:null})[_0xe111('0x13')](function(_0x2e6b16){logger[_0xe111('0x1a')](_0xe111('0x23'),_0x353363);logger[_0xe111('0x16')]('UpdateChatInteraction',_0x353363,JSON[_0xe111('0x24')](_0x2e6b16));_0xbb882f(_0x2e6b16);})[_0xe111('0x1c')](function(_0x1a4b72){logger[_0xe111('0x18')](_0xe111('0x23'),_0x1a4b72['message'],_0x353363);_0x582365(_0x29fbe5[_0xe111('0x18')](0x1f4,_0x1a4b72[_0xe111('0x19')]));});});};exports[_0xe111('0x25')]=function(_0x54002f){return new Promise(function(_0x2b4de5,_0x40c6dc){return db[_0xe111('0x1d')][_0xe111('0x26')]({'where':_0x54002f['options']?_0x54002f[_0xe111('0x20')][_0xe111('0x22')]||null:null})[_0xe111('0x13')](function(_0x524320){if(_0x524320){return _0x524320[_0xe111('0x27')](_0x54002f[_0xe111('0x1f')][_0xe111('0x28')],_[_0xe111('0x29')](_0x54002f['body'],['ids','id'])||{});}})[_0xe111('0x2a')](function(_0x40f34d){logger[_0xe111('0x1a')](_0xe111('0x2b'),_0x54002f);logger[_0xe111('0x16')](_0xe111('0x2b'),_0x54002f,JSON['stringify'](_0x40f34d));_0x2b4de5(_0x40f34d);})[_0xe111('0x1c')](function(_0x684a67){logger[_0xe111('0x18')]('AddTags',_0x684a67[_0xe111('0x19')],_0x54002f);_0x40c6dc(_this[_0xe111('0x18')](0x1f4,_0x684a67[_0xe111('0x19')]));});});}; \ No newline at end of file +var _0xcd50=['../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','stringify','catch','AddTagsToChatInteraction','find','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd50,0x119));var _0x0cd5=function(_0x5f96e4,_0x27ed2e){_0x5f96e4=_0x5f96e4-0x0;var _0x23f5c2=_0xcd50[_0x5f96e4];return _0x23f5c2;};'use strict';var _=require(_0x0cd5('0x0'));var util=require(_0x0cd5('0x1'));var moment=require(_0x0cd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0cd5('0x3'));var fs=require('fs');var Redis=require(_0x0cd5('0x4'));var db=require(_0x0cd5('0x5'))['db'];var utils=require(_0x0cd5('0x6'));var logger=require('../../config/logger')(_0x0cd5('0x7'));var config=require('../../config/environment');var jayson=require(_0x0cd5('0x8'));var client=jayson['client'][_0x0cd5('0x9')]({'port':0x232a});config[_0x0cd5('0xa')]=_[_0x0cd5('0xb')](config[_0x0cd5('0xa')],{'host':_0x0cd5('0xc'),'port':0x18eb});var socket=require(_0x0cd5('0xd'))(new Redis(config[_0x0cd5('0xa')]));require(_0x0cd5('0xe'))['register'](socket);function respondWithRpcPromise(_0x238259,_0x5567e7,_0x288589){return new BPromise(function(_0x59312d,_0x52e480){return client[_0x0cd5('0xf')](_0x238259,_0x288589)[_0x0cd5('0x10')](function(_0x4b7a0c){logger['info'](_0x0cd5('0x11'),_0x5567e7,_0x0cd5('0x12'));logger[_0x0cd5('0x13')](_0x0cd5('0x14'),_0x5567e7,_0x0cd5('0x12'),JSON['stringify'](_0x4b7a0c));if(_0x4b7a0c[_0x0cd5('0x15')]){if(_0x4b7a0c['error']['code']===0x1f4){logger[_0x0cd5('0x15')](_0x0cd5('0x11'),_0x5567e7,_0x4b7a0c[_0x0cd5('0x15')][_0x0cd5('0x16')]);return _0x52e480(_0x4b7a0c[_0x0cd5('0x15')][_0x0cd5('0x16')]);}logger[_0x0cd5('0x15')](_0x0cd5('0x11'),_0x5567e7,_0x4b7a0c[_0x0cd5('0x15')][_0x0cd5('0x16')]);return _0x59312d(_0x4b7a0c[_0x0cd5('0x15')][_0x0cd5('0x16')]);}else{logger[_0x0cd5('0x17')](_0x0cd5('0x11'),_0x5567e7,_0x0cd5('0x12'));_0x59312d(_0x4b7a0c[_0x0cd5('0x18')][_0x0cd5('0x16')]);}})['catch'](function(_0x12ec21){logger[_0x0cd5('0x15')](_0x0cd5('0x11'),_0x5567e7,_0x12ec21);_0x52e480(_0x12ec21);});});}exports[_0x0cd5('0x19')]=function(_0x3b327e){var _0x495089=this;return new Promise(function(_0x17627e,_0x3202f3){return db[_0x0cd5('0x1a')][_0x0cd5('0x1b')](_0x3b327e[_0x0cd5('0x1c')],{'raw':_0x3b327e[_0x0cd5('0x1d')]?_0x3b327e[_0x0cd5('0x1d')][_0x0cd5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b327e[_0x0cd5('0x1d')]?_0x3b327e[_0x0cd5('0x1d')][_0x0cd5('0x1f')]||null:null,'attributes':_0x3b327e[_0x0cd5('0x1d')]?_0x3b327e[_0x0cd5('0x1d')][_0x0cd5('0x20')]||null:null,'limit':_0x3b327e[_0x0cd5('0x1d')]?_0x3b327e['options'][_0x0cd5('0x21')]||null:null})[_0x0cd5('0x10')](function(_0x303edc){logger['info']('UpdateChatInteraction',_0x3b327e);logger[_0x0cd5('0x13')]('UpdateChatInteraction',_0x3b327e,JSON[_0x0cd5('0x22')](_0x303edc));_0x17627e(_0x303edc);})[_0x0cd5('0x23')](function(_0x51868f){logger[_0x0cd5('0x15')](_0x0cd5('0x19'),_0x51868f[_0x0cd5('0x16')],_0x3b327e);_0x3202f3(_0x495089[_0x0cd5('0x15')](0x1f4,_0x51868f[_0x0cd5('0x16')]));});});};exports[_0x0cd5('0x24')]=function(_0x356b14){return new Promise(function(_0x1c15f3,_0x3089e3){return db['ChatInteraction'][_0x0cd5('0x25')]({'where':_0x356b14[_0x0cd5('0x1d')]?_0x356b14[_0x0cd5('0x1d')]['where']||null:null})[_0x0cd5('0x10')](function(_0x1aefff){if(_0x1aefff){return _0x1aefff['addTags'](_0x356b14['body'][_0x0cd5('0x26')],_[_0x0cd5('0x27')](_0x356b14[_0x0cd5('0x1c')],['ids','id'])||{});}})['spread'](function(_0x170fdd){logger[_0x0cd5('0x17')](_0x0cd5('0x28'),_0x356b14);logger['debug']('AddTags',_0x356b14,JSON[_0x0cd5('0x22')](_0x170fdd));_0x1c15f3(_0x170fdd);})[_0x0cd5('0x23')](function(_0x534b93){logger[_0x0cd5('0x15')](_0x0cd5('0x28'),_0x534b93[_0x0cd5('0x16')],_0x356b14);_0x3089e3(_this[_0x0cd5('0x15')](0x1f4,_0x534b93[_0x0cd5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index c8cb0fd..373df42 100644 --- a/server/api/chatInteraction/chatInteraction.socket.js +++ b/server/api/chatInteraction/chatInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd734=['./chatInteraction.events','save','remove','update','removeListener','chatInteraction:'];(function(_0x3d8b15,_0x3f4a7e){var _0x2f9090=function(_0x51809c){while(--_0x51809c){_0x3d8b15['push'](_0x3d8b15['shift']());}};_0x2f9090(++_0x3f4a7e);}(_0xd734,0x18c));var _0x4d73=function(_0xc237ff,_0x4673ff){_0xc237ff=_0xc237ff-0x0;var _0x4b7b9b=_0xd734[_0xc237ff];return _0x4b7b9b;};'use strict';var ChatInteractionEvents=require(_0x4d73('0x0'));var events=[_0x4d73('0x1'),_0x4d73('0x2'),_0x4d73('0x3')];function createListener(_0x36961b,_0x4fddaa){return function(_0x3866f3){_0x4fddaa['emit'](_0x36961b,_0x3866f3);};}function removeListener(_0x34296c,_0x560518){return function(){ChatInteractionEvents[_0x4d73('0x4')](_0x34296c,_0x560518);};}exports['register']=function(_0x361d70){for(var _0x209d65=0x0,_0x2f05c7=events['length'];_0x209d65<_0x2f05c7;_0x209d65++){var _0x27a0c4=events[_0x209d65];var _0x596663=createListener(_0x4d73('0x5')+_0x27a0c4,_0x361d70);ChatInteractionEvents['on'](_0x27a0c4,_0x596663);}}; \ No newline at end of file +var _0x8094=['chatInteraction:','remove','update','removeListener','register'];(function(_0x4817f9,_0x4070d1){var _0x2dcfa6=function(_0x408973){while(--_0x408973){_0x4817f9['push'](_0x4817f9['shift']());}};_0x2dcfa6(++_0x4070d1);}(_0x8094,0x19b));var _0x4809=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0x8094[_0x5ebe34];return _0x36a3ee;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x4809('0x0'),_0x4809('0x1')];function createListener(_0x136ddb,_0xaf91c5){return function(_0x241228){_0xaf91c5['emit'](_0x136ddb,_0x241228);};}function removeListener(_0x1a43d4,_0x19d6d9){return function(){ChatInteractionEvents[_0x4809('0x2')](_0x1a43d4,_0x19d6d9);};}exports[_0x4809('0x3')]=function(_0x2734fa){for(var _0xa92fd7=0x0,_0x52a023=events['length'];_0xa92fd7<_0x52a023;_0xa92fd7++){var _0x309dd9=events[_0xa92fd7];var _0x16dc9b=createListener(_0x4809('0x4')+_0x309dd9,_0x2734fa);ChatInteractionEvents['on'](_0x309dd9,_0x16dc9b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0df1b94..1c15b85 100644 --- a/server/api/chatInteraction/index.js +++ b/server/api/chatInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12ab=['update','/:id/custom_update','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','put','/:id','chatinteraction:update'];(function(_0x45b964,_0x3505d2){var _0xf78a55=function(_0x3c46cd){while(--_0x3c46cd){_0x45b964['push'](_0x45b964['shift']());}};_0xf78a55(++_0x3505d2);}(_0x12ab,0x103));var _0xb12a=function(_0x1f0157,_0x4d6f65){_0x1f0157=_0x1f0157-0x0;var _0x4a9d01=_0x12ab[_0x1f0157];return _0x4a9d01;};'use strict';var multer=require(_0xb12a('0x0'));var util=require(_0xb12a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb12a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb12a('0x3'));var interaction=require(_0xb12a('0x4'));var config=require('../../config/environment');var controller=require(_0xb12a('0x5'));router[_0xb12a('0x6')]('/',auth[_0xb12a('0x7')](),controller['index']);router[_0xb12a('0x6')](_0xb12a('0x8'),auth['isAuthenticated'](),controller[_0xb12a('0x9')]);router[_0xb12a('0x6')]('/:id',auth[_0xb12a('0xa')](),controller[_0xb12a('0xb')]);router[_0xb12a('0x6')](_0xb12a('0xc'),auth[_0xb12a('0xa')](),controller[_0xb12a('0xd')]);router[_0xb12a('0x6')]('/:id/messages',auth[_0xb12a('0x7')](),controller[_0xb12a('0xe')]);router[_0xb12a('0x6')](_0xb12a('0xf'),auth[_0xb12a('0xa')](),controller[_0xb12a('0x10')]);router[_0xb12a('0x6')](_0xb12a('0x11'),auth[_0xb12a('0x7')](),controller['download']);router[_0xb12a('0x12')]('/',auth[_0xb12a('0x7')](),controller[_0xb12a('0x13')]);router['post'](_0xb12a('0x14'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xb12a('0x15')]({'destination':function(_0x1f46ae,_0x2399d2,_0x5a47e9){_0x5a47e9(null,path[_0xb12a('0x16')](config['root'],_0xb12a('0x17')));},'filename':function(_0x3829f7,_0x5bf865,_0x20eba3){_0x20eba3(null,util[_0xb12a('0x18')](_0xb12a('0x19'),Date[_0xb12a('0x1a')](),_0x5bf865[_0xb12a('0x1b')][_0xb12a('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb12a('0x12')](_0xb12a('0x1d'),upload[_0xb12a('0x1e')](_0xb12a('0x1f')),controller[_0xb12a('0x20')]);router[_0xb12a('0x12')](_0xb12a('0x21'),auth[_0xb12a('0xa')](),controller[_0xb12a('0x22')]);router[_0xb12a('0x12')](_0xb12a('0x23'),auth['isAuthenticated'](),interaction[_0xb12a('0x24')](_0xb12a('0x25'),'chatinteraction:addtags'),controller['addTags']);router[_0xb12a('0x26')](_0xb12a('0x27'),auth[_0xb12a('0x7')](),interaction[_0xb12a('0x24')](_0xb12a('0x25'),_0xb12a('0x28')),controller[_0xb12a('0x29')]);router[_0xb12a('0x26')](_0xb12a('0x2a'),controller['customUpdate']);router[_0xb12a('0x26')]('/:id/abandon',auth[_0xb12a('0xa')](),controller['abandon']);router[_0xb12a('0x26')](_0xb12a('0x2b'),controller[_0xb12a('0x2c')]);router[_0xb12a('0x2d')](_0xb12a('0x27'),auth['isAuthenticated'](),interaction['tracked'](_0xb12a('0x25'),_0xb12a('0x2e')),controller[_0xb12a('0x2f')]);router[_0xb12a('0x2d')](_0xb12a('0x23'),auth['isAuthenticated'](),controller[_0xb12a('0x30')]);module[_0xb12a('0x31')]=router; \ No newline at end of file +var _0xfeca=['abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','/:id','chat','chatinteraction:update','put','customUpdate','/:id/abandon'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0xfeca,0x76));var _0xafec=function(_0x473eb8,_0xa3e4a5){_0x473eb8=_0x473eb8-0x0;var _0x2f4ce2=_0xfeca[_0x473eb8];return _0x2f4ce2;};'use strict';var multer=require(_0xafec('0x0'));var util=require('util');var path=require(_0xafec('0x1'));var timeout=require('connect-timeout');var express=require(_0xafec('0x2'));var router=express[_0xafec('0x3')]();var fs_extra=require(_0xafec('0x4'));var auth=require(_0xafec('0x5'));var interaction=require(_0xafec('0x6'));var config=require(_0xafec('0x7'));var controller=require(_0xafec('0x8'));router['get']('/',auth[_0xafec('0x9')](),controller[_0xafec('0xa')]);router['get'](_0xafec('0xb'),auth[_0xafec('0x9')](),controller[_0xafec('0xc')]);router[_0xafec('0xd')]('/:id',auth[_0xafec('0xe')](),controller[_0xafec('0xf')]);router[_0xafec('0xd')](_0xafec('0x10'),auth[_0xafec('0xe')](),controller[_0xafec('0x11')]);router[_0xafec('0xd')](_0xafec('0x12'),auth['isAuthenticated'](),controller[_0xafec('0x13')]);router[_0xafec('0xd')](_0xafec('0x14'),auth[_0xafec('0xe')](),controller['getMyMessages']);router[_0xafec('0xd')](_0xafec('0x15'),auth[_0xafec('0x9')](),controller[_0xafec('0x16')]);router[_0xafec('0x17')]('/',auth[_0xafec('0x9')](),controller[_0xafec('0x18')]);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller[_0xafec('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29517e,_0x2533e3,_0x1b8091){_0x1b8091(null,path[_0xafec('0x1a')](config[_0xafec('0x1b')],_0xafec('0x1c')));},'filename':function(_0x31f5dc,_0x224c18,_0x149918){_0x149918(null,util[_0xafec('0x1d')]('%s-%s',Date[_0xafec('0x1e')](),_0x224c18[_0xafec('0x1f')][_0xafec('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xafec('0x21'),upload['single'](_0xafec('0x22')),controller[_0xafec('0x23')]);router[_0xafec('0x17')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xafec('0x24')]);router['post'](_0xafec('0x25'),auth[_0xafec('0x9')](),interaction[_0xafec('0x26')]('chat',_0xafec('0x27')),controller[_0xafec('0x28')]);router['put'](_0xafec('0x29'),auth['isAuthenticated'](),interaction[_0xafec('0x26')](_0xafec('0x2a'),_0xafec('0x2b')),controller['update']);router[_0xafec('0x2c')]('/:id/custom_update',controller[_0xafec('0x2d')]);router[_0xafec('0x2c')](_0xafec('0x2e'),auth[_0xafec('0xe')](),controller[_0xafec('0x2f')]);router[_0xafec('0x2c')](_0xafec('0x30'),controller[_0xafec('0x31')]);router[_0xafec('0x32')](_0xafec('0x29'),auth[_0xafec('0x9')](),interaction[_0xafec('0x26')](_0xafec('0x2a'),_0xafec('0x33')),controller[_0xafec('0x34')]);router[_0xafec('0x32')](_0xafec('0x25'),auth[_0xafec('0x9')](),controller[_0xafec('0x35')]);module[_0xafec('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 4fa7825..12c09a4 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.attributes.js +++ b/server/api/chatInternalMessage/chatInternalMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6034=['BOOLEAN','INTEGER'];(function(_0x129d57,_0x2c2a70){var _0xb55bc1=function(_0x1aa191){while(--_0x1aa191){_0x129d57['push'](_0x129d57['shift']());}};_0xb55bc1(++_0x2c2a70);}(_0x6034,0x94));var _0x4603=function(_0xae3dc5,_0x501872){_0xae3dc5=_0xae3dc5-0x0;var _0x1a883a=_0x6034[_0xae3dc5];return _0x1a883a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4603('0x0')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4603('0x1')]}}; \ No newline at end of file +var _0xe784=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xe784,0xb4));var _0x4e78=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xe784[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x4e78('0x0'));module[_0x4e78('0x1')]={'body':{'type':Sequelize[_0x4e78('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4e78('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4e78('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 87ce695..7be821a 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.controller.js +++ b/server/api/chatInternalMessage/chatInternalMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41b0=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','ChatInternalMessage','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filters','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','agent','resourceId','push','FromId','ToId','-createdAt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register'];(function(_0x2a2529,_0x3b1281){var _0x341e23=function(_0x2ccccc){while(--_0x2ccccc){_0x2a2529['push'](_0x2a2529['shift']());}};_0x341e23(++_0x3b1281);}(_0x41b0,0xc4));var _0x041b=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x41b0[_0x47b15f];return _0x55bf25;};'use strict';var emlformat=require(_0x041b('0x0'));var rimraf=require(_0x041b('0x1'));var zipdir=require(_0x041b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x041b('0x3'));var moment=require(_0x041b('0x4'));var BPromise=require(_0x041b('0x5'));var Mustache=require(_0x041b('0x6'));var util=require('util');var path=require(_0x041b('0x7'));var sox=require('sox');var csv=require(_0x041b('0x8'));var ejs=require(_0x041b('0x9'));var fs=require('fs');var fs_extra=require(_0x041b('0xa'));var _=require(_0x041b('0xb'));var squel=require(_0x041b('0xc'));var crypto=require(_0x041b('0xd'));var jsforce=require(_0x041b('0xe'));var deskjs=require(_0x041b('0xf'));var toCsv=require(_0x041b('0x8'));var querystring=require(_0x041b('0x10'));var Papa=require(_0x041b('0x11'));var Redis=require(_0x041b('0x12'));var authService=require(_0x041b('0x13'));var qs=require(_0x041b('0x14'));var as=require(_0x041b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x041b('0x16'))(_0x041b('0x17'));var utils=require(_0x041b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x041b('0x19'));var db=require(_0x041b('0x1a'))['db'];config['redis']=_[_0x041b('0x1b')](config[_0x041b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x041b('0x1d'))(new Redis(config[_0x041b('0x1c')]));require(_0x041b('0x1e'))[_0x041b('0x1f')](socket);function respondWithStatusCode(_0x411465,_0x45fe5e){_0x45fe5e=_0x45fe5e||0xcc;return function(_0x53674f){if(_0x53674f){return _0x411465[_0x041b('0x20')](_0x45fe5e);}return _0x411465[_0x041b('0x21')](_0x45fe5e)[_0x041b('0x22')]();};}function respondWithResult(_0x22164d,_0x395e35){_0x395e35=_0x395e35||0xc8;return function(_0x1b83b1){if(_0x1b83b1){return _0x22164d[_0x041b('0x21')](_0x395e35)['json'](_0x1b83b1);}};}function respondWithFilteredResult(_0x70d1dc,_0x263a59){return function(_0x168aa1){if(_0x168aa1){var _0x58e1d1=typeof _0x263a59[_0x041b('0x23')]===_0x041b('0x24')&&typeof _0x263a59[_0x041b('0x25')]===_0x041b('0x24');var _0x343813=_0x168aa1['count'];var _0x58d0bb=_0x58e1d1?0x0:_0x263a59[_0x041b('0x23')];var _0x255688=_0x58e1d1?_0x168aa1[_0x041b('0x26')]:_0x263a59['offset']+_0x263a59['limit'];var _0x166770;if(_0x255688>=_0x343813){_0x255688=_0x343813;_0x166770=0xc8;}else{_0x166770=0xce;}_0x70d1dc['status'](_0x166770);return _0x70d1dc[_0x041b('0x27')](_0x041b('0x28'),_0x58d0bb+'-'+_0x255688+'/'+_0x343813)[_0x041b('0x29')](_0x168aa1);}return null;};}function patchUpdates(_0x12bdf2){return function(_0x15d0bf){try{jsonpatch['apply'](_0x15d0bf,_0x12bdf2,!![]);}catch(_0x423a93){return BPromise[_0x041b('0x2a')](_0x423a93);}return _0x15d0bf[_0x041b('0x2b')]();};}function saveUpdates(_0x5a0cfc,_0x18cc2a){return function(_0x4e7c7e){if(_0x4e7c7e){return _0x4e7c7e['update'](_0x5a0cfc)[_0x041b('0x2c')](function(_0x2dfb61){return _0x2dfb61;});}return null;};}function removeEntity(_0xe18570,_0x13a455){return function(_0xa99909){if(_0xa99909){return _0xa99909[_0x041b('0x2d')]()[_0x041b('0x2c')](function(){_0xe18570[_0x041b('0x21')](0xcc)[_0x041b('0x22')]();});}};}function handleEntityNotFound(_0x4e0adf,_0x27bd54){return function(_0x575369){if(!_0x575369){_0x4e0adf[_0x041b('0x20')](0x194);}return _0x575369;};}function handleError(_0x599995,_0x22c9b4){_0x22c9b4=_0x22c9b4||0x1f4;return function(_0x1bd3a8){logger[_0x041b('0x2e')](_0x1bd3a8[_0x041b('0x2f')]);if(_0x1bd3a8[_0x041b('0x30')]){delete _0x1bd3a8[_0x041b('0x30')];}_0x599995[_0x041b('0x21')](_0x22c9b4)['send'](_0x1bd3a8);};}exports[_0x041b('0x31')]=function(_0x53b9a0,_0x27b4ec){var _0x5c08c1={},_0x71d08={},_0x5802db={'count':0x0,'rows':[]};var _0x3eb730=_[_0x041b('0x32')](db[_0x041b('0x33')]['rawAttributes'],function(_0x8d07ce){return{'name':_0x8d07ce['fieldName'],'type':_0x8d07ce[_0x041b('0x34')][_0x041b('0x35')]};});_0x71d08['model']=_[_0x041b('0x32')](_0x3eb730,_0x041b('0x30'));_0x71d08[_0x041b('0x36')]=_['keys'](_0x53b9a0['query']);_0x71d08['filters']=_[_0x041b('0x37')](_0x71d08[_0x041b('0x38')],_0x71d08['query']);_0x5c08c1['attributes']=_['intersection'](_0x71d08['model'],qs['fields'](_0x53b9a0[_0x041b('0x36')][_0x041b('0x39')]));_0x5c08c1[_0x041b('0x3a')]=_0x5c08c1[_0x041b('0x3a')][_0x041b('0x3b')]?_0x5c08c1['attributes']:_0x71d08[_0x041b('0x38')];if(!_0x53b9a0['query'][_0x041b('0x3c')](_0x041b('0x3d'))){_0x5c08c1[_0x041b('0x25')]=qs[_0x041b('0x25')](_0x53b9a0[_0x041b('0x36')][_0x041b('0x25')]);_0x5c08c1['offset']=qs[_0x041b('0x23')](_0x53b9a0['query'][_0x041b('0x23')]);}_0x5c08c1['order']=qs[_0x041b('0x3e')](_0x53b9a0['query'][_0x041b('0x3e')]);_0x5c08c1[_0x041b('0x3f')]=qs['filters'](_[_0x041b('0x40')](_0x53b9a0[_0x041b('0x36')],_0x71d08['filters']),_0x3eb730);if(_0x53b9a0[_0x041b('0x36')][_0x041b('0x41')]){_0x5c08c1[_0x041b('0x3f')]=_['merge'](_0x5c08c1['where'],{'$or':_['map'](_0x3eb730,function(_0x306c7d){if(_0x306c7d[_0x041b('0x34')]!==_0x041b('0x42')){var _0x534dac={};_0x534dac[_0x306c7d[_0x041b('0x30')]]={'$like':'%'+_0x53b9a0[_0x041b('0x36')][_0x041b('0x41')]+'%'};return _0x534dac;}})});}_0x5c08c1=_[_0x041b('0x43')]({},_0x5c08c1,_0x53b9a0['options']);var _0x21baa0={'where':_0x5c08c1[_0x041b('0x3f')]};return db[_0x041b('0x33')][_0x041b('0x26')](_0x21baa0)['then'](function(_0x4dd8bb){_0x5802db[_0x041b('0x26')]=_0x4dd8bb;if(_0x53b9a0[_0x041b('0x36')][_0x041b('0x44')]){_0x5c08c1[_0x041b('0x45')]=[{'all':!![]}];}return db[_0x041b('0x33')][_0x041b('0x46')](_0x5c08c1);})[_0x041b('0x2c')](function(_0x421408){_0x5802db[_0x041b('0x47')]=_0x421408;return _0x5802db;})[_0x041b('0x2c')](respondWithFilteredResult(_0x27b4ec,_0x5c08c1))[_0x041b('0x48')](handleError(_0x27b4ec,null));};exports[_0x041b('0x49')]=function(_0x10fa82,_0x385ac8){var _0x415dcf={'raw':!![],'where':{'id':_0x10fa82[_0x041b('0x4a')]['id']}},_0x2574ed={};_0x2574ed['model']=_[_0x041b('0x4b')](db[_0x041b('0x33')][_0x041b('0x4c')]);_0x2574ed[_0x041b('0x36')]=_[_0x041b('0x4b')](_0x10fa82[_0x041b('0x36')]);_0x2574ed[_0x041b('0x4d')]=_[_0x041b('0x37')](_0x2574ed[_0x041b('0x38')],_0x2574ed['query']);_0x415dcf['attributes']=_[_0x041b('0x37')](_0x2574ed[_0x041b('0x38')],qs[_0x041b('0x39')](_0x10fa82[_0x041b('0x36')][_0x041b('0x39')]));_0x415dcf['attributes']=_0x415dcf[_0x041b('0x3a')][_0x041b('0x3b')]?_0x415dcf[_0x041b('0x3a')]:_0x2574ed[_0x041b('0x38')];if(_0x10fa82[_0x041b('0x36')][_0x041b('0x44')]){_0x415dcf[_0x041b('0x45')]=[{'all':!![]}];}_0x415dcf=_['merge']({},_0x415dcf,_0x10fa82['options']);return db[_0x041b('0x33')][_0x041b('0x4e')](_0x415dcf)['then'](handleEntityNotFound(_0x385ac8,null))[_0x041b('0x2c')](respondWithResult(_0x385ac8,null))[_0x041b('0x48')](handleError(_0x385ac8,null));};exports[_0x041b('0x4f')]=function(_0x3e0475,_0x27a19e){return db[_0x041b('0x33')][_0x041b('0x4f')](_0x3e0475[_0x041b('0x50')],{})[_0x041b('0x2c')](respondWithResult(_0x27a19e,0xc9))['catch'](handleError(_0x27a19e,null));};exports[_0x041b('0x51')]=function(_0x1b529c,_0x16d473){if(_0x1b529c[_0x041b('0x50')]['id']){delete _0x1b529c['body']['id'];}return db[_0x041b('0x33')]['find']({'where':{'id':_0x1b529c[_0x041b('0x4a')]['id']}})[_0x041b('0x2c')](handleEntityNotFound(_0x16d473,null))[_0x041b('0x2c')](saveUpdates(_0x1b529c[_0x041b('0x50')],null))[_0x041b('0x2c')](respondWithResult(_0x16d473,null))['catch'](handleError(_0x16d473,null));};exports[_0x041b('0x2d')]=function(_0x47fba4,_0x22d060){return db[_0x041b('0x33')][_0x041b('0x4e')]({'where':{'id':_0x47fba4['params']['id']}})[_0x041b('0x2c')](handleEntityNotFound(_0x22d060,null))['then'](removeEntity(_0x22d060,null))[_0x041b('0x48')](handleError(_0x22d060,null));};exports[_0x041b('0x52')]=function(_0x46e3ef,_0x337b52){return db['ChatInternalMessage'][_0x041b('0x52')]()[_0x041b('0x2c')](respondWithResult(_0x337b52,null))[_0x041b('0x48')](handleError(_0x337b52,null));};function wrapUser(_0xd1a626){return function(_0x587266){var _0x36c73b=_0xd1a626[_0x041b('0x53')]({'plain':!![]});_0x36c73b[_0x041b('0x54')]=[];if(_0x587266){_0x36c73b[_0x041b('0x55')]=_0x587266[_0x041b('0x56')];_0x36c73b[_0x041b('0x57')]=_0x587266;}else{_0x36c73b[_0x041b('0x55')]=moment(0x0)[_0x041b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x36c73b['lastMessage']={};}return _0x36c73b;};}exports[_0x041b('0x59')]=function(_0x1b9ac7,_0x4cc5b7,_0x531454){var _0x272d33=[];return db[_0x041b('0x5a')][_0x041b('0x46')]({'where':{'role':['agent','admin',_0x041b('0x5b')]},'attributes':['id',_0x041b('0x5c'),_0x041b('0x30'),_0x041b('0x5d'),_0x041b('0x5e'),_0x041b('0x5f'),_0x041b('0x60'),_0x041b('0x61'),_0x041b('0x62'),_0x041b('0x63')],'order':qs[_0x041b('0x3e')](_0x041b('0x64')),'include':[{'model':db[_0x041b('0x65')],'as':_0x041b('0x66'),'attributes':['id',_0x041b('0x30'),_0x041b('0x34')],'through':{'attributes':[]}}]})[_0x041b('0x2c')](function(_0x4ada59){if(_0x4ada59){var _0x51cc79=_0x1b9ac7[_0x041b('0x5b')][_0x041b('0x53')]({'plain':!![]});if(!_0x51cc79)throw new Error(_0x041b('0x67'));if(_0x51cc79[_0x041b('0x5d')]==='user'){return db[_0x041b('0x68')]['find']({'where':{'name':_0x041b('0x69'),'userProfileId':_0x51cc79[_0x041b('0x6a')]},'raw':!![]})[_0x041b('0x2c')](function(_0x3d0f29){if(_0x3d0f29){if(_0x3d0f29[_0x041b('0x6b')]===0x0){return db['UserProfileResource'][_0x041b('0x46')]({'where':{'sectionId':_0x3d0f29['id']},'raw':!![]})[_0x041b('0x2c')](function(_0x48f01a){var _0x5bf936=[];if(_['isEmpty'](_0x48f01a)){_0x5bf936=_[_0x041b('0x41')](_0x4ada59,function(_0x426603){if(_0x426603[_0x041b('0x5d')]!==_0x041b('0x6c')){return _0x426603;}});return _0x5bf936;}else{for(var _0x2be507=0x0;_0x2be507<_0x4ada59[_0x041b('0x3b')];_0x2be507++){var _0xb3f04=_0x4ada59[_0x2be507];if(_0xb3f04[_0x041b('0x5d')]===_0x041b('0x6c')){var _0x34c4fe=_['find'](_0x48f01a,function(_0x34ef05){return _0x34ef05[_0x041b('0x6d')]===_0xb3f04['id'];});if(_0x34c4fe)_0x5bf936[_0x041b('0x6e')](_0xb3f04);}else{_0x5bf936[_0x041b('0x6e')](_0xb3f04);}}return _0x5bf936;}});}else{return _0x4ada59;}}else{var _0x2713b6=_[_0x041b('0x41')](_0x4ada59,function(_0x587a4c){if(_0x587a4c[_0x041b('0x5d')]!=='agent'){return _0x587a4c;}});return _0x2713b6;}});}else{return _0x4ada59;}}})[_0x041b('0x2c')](function(_0x235b9e){var _0x25b356=[];if(_0x235b9e){_0x272d33=_0x235b9e;for(var _0x526355=0x0;_0x526355<_0x235b9e[_0x041b('0x3b')];_0x526355+=0x1){_0x272d33[_0x526355][_0x041b('0x54')]=[];_0x25b356[_0x041b('0x6e')](db[_0x041b('0x33')][_0x041b('0x4e')]({'where':{'FromId':[_0x1b9ac7[_0x041b('0x5b')]['id'],_0x235b9e[_0x526355]['id']],'ToId':[_0x1b9ac7[_0x041b('0x5b')]['id'],_0x235b9e[_0x526355]['id']],'ChatGroupId':null},'attributes':['id',_0x041b('0x56'),_0x041b('0x6f'),_0x041b('0x70'),'read',_0x041b('0x50')],'order':qs[_0x041b('0x3e')](_0x041b('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x041b('0x2c')](wrapUser(_0x235b9e[_0x526355])));}return BPromise['all'](_0x25b356);}return[];})[_0x041b('0x2c')](function(_0x21ebb5){return{'rows':_0x21ebb5,'count':_0x21ebb5['length']};})[_0x041b('0x2c')](respondWithResult(_0x4cc5b7,null))[_0x041b('0x48')](handleError(_0x4cc5b7,null));}; \ No newline at end of file +var _0xd35b=['find','create','body','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','admin','user','fullname','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','agent','createdAt','FromId','ToId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','ChatInternalMessage','catch','show','params','length'];(function(_0x597778,_0x1c512e){var _0x29f7bd=function(_0xb247dc){while(--_0xb247dc){_0x597778['push'](_0x597778['shift']());}};_0x29f7bd(++_0x1c512e);}(_0xd35b,0x9b));var _0xbd35=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xd35b[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd35('0x0'));var zipdir=require(_0xbd35('0x1'));var jsonpatch=require(_0xbd35('0x2'));var rp=require('request-promise');var moment=require(_0xbd35('0x3'));var BPromise=require(_0xbd35('0x4'));var Mustache=require(_0xbd35('0x5'));var util=require('util');var path=require(_0xbd35('0x6'));var sox=require(_0xbd35('0x7'));var csv=require(_0xbd35('0x8'));var ejs=require(_0xbd35('0x9'));var fs=require('fs');var fs_extra=require(_0xbd35('0xa'));var _=require(_0xbd35('0xb'));var squel=require(_0xbd35('0xc'));var crypto=require(_0xbd35('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbd35('0x8'));var querystring=require(_0xbd35('0xe'));var Papa=require(_0xbd35('0xf'));var Redis=require(_0xbd35('0x10'));var authService=require(_0xbd35('0x11'));var qs=require(_0xbd35('0x12'));var as=require(_0xbd35('0x13'));var hardwareService=require(_0xbd35('0x14'));var logger=require(_0xbd35('0x15'))(_0xbd35('0x16'));var utils=require(_0xbd35('0x17'));var config=require(_0xbd35('0x18'));var licenseUtil=require(_0xbd35('0x19'));var db=require('../../mysqldb')['db'];config[_0xbd35('0x1a')]=_[_0xbd35('0x1b')](config[_0xbd35('0x1a')],{'host':_0xbd35('0x1c'),'port':0x18eb});var socket=require(_0xbd35('0x1d'))(new Redis(config[_0xbd35('0x1a')]));require('./chatInternalMessage.socket')[_0xbd35('0x1e')](socket);function respondWithStatusCode(_0xd7f6c8,_0x18d41f){_0x18d41f=_0x18d41f||0xcc;return function(_0xa07d98){if(_0xa07d98){return _0xd7f6c8[_0xbd35('0x1f')](_0x18d41f);}return _0xd7f6c8[_0xbd35('0x20')](_0x18d41f)[_0xbd35('0x21')]();};}function respondWithResult(_0x4fe799,_0xa482){_0xa482=_0xa482||0xc8;return function(_0x2e448c){if(_0x2e448c){return _0x4fe799['status'](_0xa482)[_0xbd35('0x22')](_0x2e448c);}};}function respondWithFilteredResult(_0x365ee1,_0x3ea394){return function(_0x3a5e4a){if(_0x3a5e4a){var _0x90ed72=typeof _0x3ea394[_0xbd35('0x23')]===_0xbd35('0x24')&&typeof _0x3ea394[_0xbd35('0x25')]===_0xbd35('0x24');var _0x1d3b5b=_0x3a5e4a[_0xbd35('0x26')];var _0x3f65df=_0x90ed72?0x0:_0x3ea394[_0xbd35('0x23')];var _0x40ceeb=_0x90ed72?_0x3a5e4a['count']:_0x3ea394[_0xbd35('0x23')]+_0x3ea394[_0xbd35('0x25')];var _0x286e2f;if(_0x40ceeb>=_0x1d3b5b){_0x40ceeb=_0x1d3b5b;_0x286e2f=0xc8;}else{_0x286e2f=0xce;}_0x365ee1['status'](_0x286e2f);return _0x365ee1['set'](_0xbd35('0x27'),_0x3f65df+'-'+_0x40ceeb+'/'+_0x1d3b5b)[_0xbd35('0x22')](_0x3a5e4a);}return null;};}function patchUpdates(_0x4c0fe7){return function(_0x2825ea){try{jsonpatch[_0xbd35('0x28')](_0x2825ea,_0x4c0fe7,!![]);}catch(_0x7847b1){return BPromise['reject'](_0x7847b1);}return _0x2825ea[_0xbd35('0x29')]();};}function saveUpdates(_0x1e030a,_0x27b165){return function(_0x417ccd){if(_0x417ccd){return _0x417ccd[_0xbd35('0x2a')](_0x1e030a)[_0xbd35('0x2b')](function(_0x37945d){return _0x37945d;});}return null;};}function removeEntity(_0x3f2797,_0xbdaf85){return function(_0x247b94){if(_0x247b94){return _0x247b94[_0xbd35('0x2c')]()['then'](function(){_0x3f2797[_0xbd35('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x568173,_0x462e7f){return function(_0x11508c){if(!_0x11508c){_0x568173[_0xbd35('0x1f')](0x194);}return _0x11508c;};}function handleError(_0x1fbffa,_0x17f205){_0x17f205=_0x17f205||0x1f4;return function(_0x2d40e1){logger[_0xbd35('0x2d')](_0x2d40e1[_0xbd35('0x2e')]);if(_0x2d40e1[_0xbd35('0x2f')]){delete _0x2d40e1[_0xbd35('0x2f')];}_0x1fbffa[_0xbd35('0x20')](_0x17f205)['send'](_0x2d40e1);};}exports[_0xbd35('0x30')]=function(_0x44c1eb,_0x284bba){var _0x1b47cc={},_0x52c8ca={},_0x1d584a={'count':0x0,'rows':[]};var _0x57ed08=_[_0xbd35('0x31')](db['ChatInternalMessage'][_0xbd35('0x32')],function(_0x25277a){return{'name':_0x25277a['fieldName'],'type':_0x25277a['type'][_0xbd35('0x33')]};});_0x52c8ca['model']=_[_0xbd35('0x31')](_0x57ed08,_0xbd35('0x2f'));_0x52c8ca[_0xbd35('0x34')]=_[_0xbd35('0x35')](_0x44c1eb[_0xbd35('0x34')]);_0x52c8ca[_0xbd35('0x36')]=_[_0xbd35('0x37')](_0x52c8ca[_0xbd35('0x38')],_0x52c8ca[_0xbd35('0x34')]);_0x1b47cc['attributes']=_['intersection'](_0x52c8ca[_0xbd35('0x38')],qs['fields'](_0x44c1eb[_0xbd35('0x34')][_0xbd35('0x39')]));_0x1b47cc[_0xbd35('0x3a')]=_0x1b47cc[_0xbd35('0x3a')]['length']?_0x1b47cc[_0xbd35('0x3a')]:_0x52c8ca['model'];if(!_0x44c1eb[_0xbd35('0x34')][_0xbd35('0x3b')](_0xbd35('0x3c'))){_0x1b47cc[_0xbd35('0x25')]=qs[_0xbd35('0x25')](_0x44c1eb[_0xbd35('0x34')][_0xbd35('0x25')]);_0x1b47cc[_0xbd35('0x23')]=qs[_0xbd35('0x23')](_0x44c1eb[_0xbd35('0x34')]['offset']);}_0x1b47cc[_0xbd35('0x3d')]=qs[_0xbd35('0x3e')](_0x44c1eb[_0xbd35('0x34')]['sort']);_0x1b47cc['where']=qs['filters'](_[_0xbd35('0x3f')](_0x44c1eb[_0xbd35('0x34')],_0x52c8ca[_0xbd35('0x36')]),_0x57ed08);if(_0x44c1eb[_0xbd35('0x34')]['filter']){_0x1b47cc[_0xbd35('0x40')]=_[_0xbd35('0x41')](_0x1b47cc[_0xbd35('0x40')],{'$or':_['map'](_0x57ed08,function(_0x5414a8){if(_0x5414a8[_0xbd35('0x42')]!==_0xbd35('0x43')){var _0x2d01ac={};_0x2d01ac[_0x5414a8[_0xbd35('0x2f')]]={'$like':'%'+_0x44c1eb[_0xbd35('0x34')][_0xbd35('0x44')]+'%'};return _0x2d01ac;}})});}_0x1b47cc=_[_0xbd35('0x41')]({},_0x1b47cc,_0x44c1eb[_0xbd35('0x45')]);var _0x168210={'where':_0x1b47cc[_0xbd35('0x40')]};return db['ChatInternalMessage'][_0xbd35('0x26')](_0x168210)['then'](function(_0x2a0b12){_0x1d584a[_0xbd35('0x26')]=_0x2a0b12;if(_0x44c1eb[_0xbd35('0x34')][_0xbd35('0x46')]){_0x1b47cc[_0xbd35('0x47')]=[{'all':!![]}];}return db[_0xbd35('0x48')]['findAll'](_0x1b47cc);})[_0xbd35('0x2b')](function(_0x1cf771){_0x1d584a['rows']=_0x1cf771;return _0x1d584a;})[_0xbd35('0x2b')](respondWithFilteredResult(_0x284bba,_0x1b47cc))[_0xbd35('0x49')](handleError(_0x284bba,null));};exports[_0xbd35('0x4a')]=function(_0xfdb2e4,_0x5f15ed){var _0x35cf2e={'raw':!![],'where':{'id':_0xfdb2e4[_0xbd35('0x4b')]['id']}},_0x401650={};_0x401650['model']=_[_0xbd35('0x35')](db[_0xbd35('0x48')][_0xbd35('0x32')]);_0x401650['query']=_[_0xbd35('0x35')](_0xfdb2e4['query']);_0x401650['filters']=_[_0xbd35('0x37')](_0x401650[_0xbd35('0x38')],_0x401650[_0xbd35('0x34')]);_0x35cf2e[_0xbd35('0x3a')]=_[_0xbd35('0x37')](_0x401650[_0xbd35('0x38')],qs['fields'](_0xfdb2e4[_0xbd35('0x34')]['fields']));_0x35cf2e[_0xbd35('0x3a')]=_0x35cf2e[_0xbd35('0x3a')][_0xbd35('0x4c')]?_0x35cf2e[_0xbd35('0x3a')]:_0x401650[_0xbd35('0x38')];if(_0xfdb2e4[_0xbd35('0x34')][_0xbd35('0x46')]){_0x35cf2e[_0xbd35('0x47')]=[{'all':!![]}];}_0x35cf2e=_[_0xbd35('0x41')]({},_0x35cf2e,_0xfdb2e4[_0xbd35('0x45')]);return db[_0xbd35('0x48')][_0xbd35('0x4d')](_0x35cf2e)[_0xbd35('0x2b')](handleEntityNotFound(_0x5f15ed,null))[_0xbd35('0x2b')](respondWithResult(_0x5f15ed,null))[_0xbd35('0x49')](handleError(_0x5f15ed,null));};exports[_0xbd35('0x4e')]=function(_0x12d8cf,_0x2f2278){return db[_0xbd35('0x48')]['create'](_0x12d8cf[_0xbd35('0x4f')],{})[_0xbd35('0x2b')](respondWithResult(_0x2f2278,0xc9))['catch'](handleError(_0x2f2278,null));};exports[_0xbd35('0x2a')]=function(_0x8fb39b,_0x1a058c){if(_0x8fb39b[_0xbd35('0x4f')]['id']){delete _0x8fb39b[_0xbd35('0x4f')]['id'];}return db[_0xbd35('0x48')][_0xbd35('0x4d')]({'where':{'id':_0x8fb39b[_0xbd35('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a058c,null))[_0xbd35('0x2b')](saveUpdates(_0x8fb39b['body'],null))['then'](respondWithResult(_0x1a058c,null))['catch'](handleError(_0x1a058c,null));};exports[_0xbd35('0x2c')]=function(_0x3a25c3,_0x5da86d){return db[_0xbd35('0x48')][_0xbd35('0x4d')]({'where':{'id':_0x3a25c3['params']['id']}})['then'](handleEntityNotFound(_0x5da86d,null))[_0xbd35('0x2b')](removeEntity(_0x5da86d,null))[_0xbd35('0x49')](handleError(_0x5da86d,null));};exports[_0xbd35('0x50')]=function(_0x317c65,_0xc3ad7d){return db[_0xbd35('0x48')]['describe']()[_0xbd35('0x2b')](respondWithResult(_0xc3ad7d,null))[_0xbd35('0x49')](handleError(_0xc3ad7d,null));};function wrapUser(_0x185a4c){return function(_0x5b6469){var _0x4eb3d5=_0x185a4c[_0xbd35('0x51')]({'plain':!![]});_0x4eb3d5[_0xbd35('0x52')]=[];if(_0x5b6469){_0x4eb3d5[_0xbd35('0x53')]=_0x5b6469['createdAt'];_0x4eb3d5['lastMessage']=_0x5b6469;}else{_0x4eb3d5[_0xbd35('0x53')]=moment(0x0)[_0xbd35('0x54')](_0xbd35('0x55'));_0x4eb3d5['lastMessage']={};}return _0x4eb3d5;};}exports[_0xbd35('0x56')]=function(_0x1a95fe,_0x19908c,_0x2fe813){var _0x3b3b56=[];return db[_0xbd35('0x57')][_0xbd35('0x58')]({'where':{'role':['agent',_0xbd35('0x59'),_0xbd35('0x5a')]},'attributes':['id',_0xbd35('0x5b'),'name','role',_0xbd35('0x5c'),_0xbd35('0x5d'),_0xbd35('0x5e'),_0xbd35('0x5f'),_0xbd35('0x60'),_0xbd35('0x61')],'order':qs[_0xbd35('0x3e')](_0xbd35('0x62')),'include':[{'model':db[_0xbd35('0x63')],'as':_0xbd35('0x64'),'attributes':['id',_0xbd35('0x2f'),_0xbd35('0x42')],'through':{'attributes':[]}}]})[_0xbd35('0x2b')](function(_0x3b7ec3){if(_0x3b7ec3){var _0x110a4d=_0x1a95fe[_0xbd35('0x5a')][_0xbd35('0x51')]({'plain':!![]});if(!_0x110a4d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x110a4d[_0xbd35('0x65')]===_0xbd35('0x5a')){return db[_0xbd35('0x66')]['find']({'where':{'name':_0xbd35('0x67'),'userProfileId':_0x110a4d[_0xbd35('0x68')]},'raw':!![]})[_0xbd35('0x2b')](function(_0x47cbf0){if(_0x47cbf0){if(_0x47cbf0[_0xbd35('0x69')]===0x0){return db[_0xbd35('0x6a')][_0xbd35('0x58')]({'where':{'sectionId':_0x47cbf0['id']},'raw':!![]})['then'](function(_0x4b8b95){var _0x141304=[];if(_[_0xbd35('0x6b')](_0x4b8b95)){_0x141304=_[_0xbd35('0x44')](_0x3b7ec3,function(_0x417588){if(_0x417588[_0xbd35('0x65')]!=='agent'){return _0x417588;}});return _0x141304;}else{for(var _0x46593e=0x0;_0x46593e<_0x3b7ec3[_0xbd35('0x4c')];_0x46593e++){var _0x5cf51e=_0x3b7ec3[_0x46593e];if(_0x5cf51e['role']==='agent'){var _0x43519d=_[_0xbd35('0x4d')](_0x4b8b95,function(_0x3ac2b0){return _0x3ac2b0['resourceId']===_0x5cf51e['id'];});if(_0x43519d)_0x141304[_0xbd35('0x6c')](_0x5cf51e);}else{_0x141304[_0xbd35('0x6c')](_0x5cf51e);}}return _0x141304;}});}else{return _0x3b7ec3;}}else{var _0x2ec16d=_['filter'](_0x3b7ec3,function(_0x28658c){if(_0x28658c[_0xbd35('0x65')]!==_0xbd35('0x6d')){return _0x28658c;}});return _0x2ec16d;}});}else{return _0x3b7ec3;}}})[_0xbd35('0x2b')](function(_0x46d551){var _0x3b38dc=[];if(_0x46d551){_0x3b3b56=_0x46d551;for(var _0x56738a=0x0;_0x56738a<_0x46d551['length'];_0x56738a+=0x1){_0x3b3b56[_0x56738a][_0xbd35('0x52')]=[];_0x3b38dc[_0xbd35('0x6c')](db[_0xbd35('0x48')][_0xbd35('0x4d')]({'where':{'FromId':[_0x1a95fe[_0xbd35('0x5a')]['id'],_0x46d551[_0x56738a]['id']],'ToId':[_0x1a95fe[_0xbd35('0x5a')]['id'],_0x46d551[_0x56738a]['id']],'ChatGroupId':null},'attributes':['id',_0xbd35('0x6e'),_0xbd35('0x6f'),_0xbd35('0x70'),_0xbd35('0x71'),_0xbd35('0x4f')],'order':qs[_0xbd35('0x3e')](_0xbd35('0x72')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbd35('0x2b')](wrapUser(_0x46d551[_0x56738a])));}return BPromise[_0xbd35('0x73')](_0x3b38dc);}return[];})['then'](function(_0xa14014){return{'rows':_0xa14014,'count':_0xa14014[_0xbd35('0x4c')]};})[_0xbd35('0x2b')](respondWithResult(_0x19908c,null))[_0xbd35('0x49')](handleError(_0x19908c,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1cbd4c0..5601e9d 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.events.js +++ b/server/api/chatInternalMessage/chatInternalMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58a4=['emit','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x2ec644,_0x4018c9){var _0x3de80c=function(_0x7cd0ca){while(--_0x7cd0ca){_0x2ec644['push'](_0x2ec644['shift']());}};_0x3de80c(++_0x4018c9);}(_0x58a4,0xbf));var _0x458a=function(_0x137ef8,_0x3384dc){_0x137ef8=_0x137ef8-0x0;var _0x3b7d28=_0x58a4[_0x137ef8];return _0x3b7d28;};'use strict';var EventEmitter=require(_0x458a('0x0'));var ChatInternalMessage=require(_0x458a('0x1'))['db'][_0x458a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x458a('0x3')](0x0);var events={'afterCreate':_0x458a('0x4'),'afterUpdate':_0x458a('0x5'),'afterDestroy':_0x458a('0x6')};function emitEvent(_0xacd5b3){return function(_0x362079,_0x1b4d2e,_0x2fde72){ChatInternalMessageEvents[_0x458a('0x7')](_0xacd5b3+':'+_0x362079['id'],_0x362079);ChatInternalMessageEvents[_0x458a('0x7')](_0xacd5b3,_0x362079);_0x2fde72(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x458a('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x02fb=['ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x507978,_0x11cc71){var _0x1c3e57=function(_0x3f6c67){while(--_0x3f6c67){_0x507978['push'](_0x507978['shift']());}};_0x1c3e57(++_0x11cc71);}(_0x02fb,0x1b6));var _0xb02f=function(_0x33274f,_0x406bfc){_0x33274f=_0x33274f-0x0;var _0x14092f=_0x02fb[_0x33274f];return _0x14092f;};'use strict';var EventEmitter=require(_0xb02f('0x0'));var ChatInternalMessage=require(_0xb02f('0x1'))['db'][_0xb02f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb02f('0x3')](0x0);var events={'afterCreate':_0xb02f('0x4'),'afterUpdate':_0xb02f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2b0150){return function(_0x40c5a2,_0x533aee,_0x232b16){ChatInternalMessageEvents[_0xb02f('0x6')](_0x2b0150+':'+_0x40c5a2['id'],_0x40c5a2);ChatInternalMessageEvents[_0xb02f('0x6')](_0x2b0150,_0x40c5a2);_0x232b16(null);};}for(var e in events){if(events[_0xb02f('0x7')](e)){var event=events[e];ChatInternalMessage[_0xb02f('0x8')](e,emitEvent(event));}}module[_0xb02f('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e23d48e..94fcd93 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.model.js +++ b/server/api/chatInternalMessage/chatInternalMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe84=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x491a48,_0x138540){var _0x4f48de=function(_0x21e3ec){while(--_0x21e3ec){_0x491a48['push'](_0x491a48['shift']());}};_0x4f48de(++_0x138540);}(_0xfe84,0xef));var _0x4fe8=function(_0x5c96eb,_0x5404da){_0x5c96eb=_0x5c96eb-0x0;var _0x4ddbad=_0xfe84[_0x5c96eb];return _0x4ddbad;};'use strict';var _=require(_0x4fe8('0x0'));var util=require(_0x4fe8('0x1'));var logger=require(_0x4fe8('0x2'))('api');var moment=require(_0x4fe8('0x3'));var BPromise=require(_0x4fe8('0x4'));var rp=require(_0x4fe8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fe8('0x6'));var config=require(_0x4fe8('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x4fe8('0x8')]=function(_0x4bde20,_0x5d0867){return _0x4bde20[_0x4fe8('0x9')](_0x4fe8('0xa'),attributes,{'tableName':_0x4fe8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fe8('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x38e9=['utf8mb4_unicode_ci','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x1cfa7b,_0x132f52){var _0x52ddd9=function(_0x493b0f){while(--_0x493b0f){_0x1cfa7b['push'](_0x1cfa7b['shift']());}};_0x52ddd9(++_0x132f52);}(_0x38e9,0x12d));var _0x938e=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x38e9[_0x4206f5];return _0xa29cf3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x938e('0x0'))(_0x938e('0x1'));var moment=require('moment');var BPromise=require(_0x938e('0x2'));var rp=require(_0x938e('0x3'));var fs=require('fs');var path=require(_0x938e('0x4'));var rimraf=require(_0x938e('0x5'));var config=require(_0x938e('0x6'));var attributes=require(_0x938e('0x7'));module[_0x938e('0x8')]=function(_0x4868dd,_0x2347a9){return _0x4868dd[_0x938e('0x9')](_0x938e('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x938e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 129524e..f092cbd 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.rpc.js +++ b/server/api/chatInternalMessage/chatInternalMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17d7=['register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket'];(function(_0xb8d180,_0x893775){var _0x49f864=function(_0x20ae83){while(--_0x20ae83){_0xb8d180['push'](_0xb8d180['shift']());}};_0x49f864(++_0x893775);}(_0x17d7,0x15b));var _0x717d=function(_0x5d506a,_0x34fa5c){_0x5d506a=_0x5d506a-0x0;var _0x95ec8c=_0x17d7[_0x5d506a];return _0x95ec8c;};'use strict';var _=require(_0x717d('0x0'));var util=require(_0x717d('0x1'));var moment=require('moment');var BPromise=require(_0x717d('0x2'));var rs=require(_0x717d('0x3'));var fs=require('fs');var Redis=require(_0x717d('0x4'));var db=require(_0x717d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x717d('0x6'))(_0x717d('0x7'));var config=require(_0x717d('0x8'));var jayson=require(_0x717d('0x9'));var client=jayson[_0x717d('0xa')][_0x717d('0xb')]({'port':0x232a});config['redis']=_[_0x717d('0xc')](config[_0x717d('0xd')],{'host':_0x717d('0xe'),'port':0x18eb});var socket=require(_0x717d('0xf'))(new Redis(config[_0x717d('0xd')]));require(_0x717d('0x10'))[_0x717d('0x11')](socket);function respondWithRpcPromise(_0x5cfbad,_0x69a26e,_0x1478c1){return new BPromise(function(_0x2fac9e,_0x42a431){return client[_0x717d('0x12')](_0x5cfbad,_0x1478c1)[_0x717d('0x13')](function(_0x3b1b76){logger[_0x717d('0x14')](_0x717d('0x15'),_0x69a26e,_0x717d('0x16'));logger[_0x717d('0x17')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x69a26e,_0x717d('0x16'),JSON['stringify'](_0x3b1b76));if(_0x3b1b76[_0x717d('0x18')]){if(_0x3b1b76[_0x717d('0x18')][_0x717d('0x19')]===0x1f4){logger[_0x717d('0x18')](_0x717d('0x15'),_0x69a26e,_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);return _0x42a431(_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);}logger[_0x717d('0x18')](_0x717d('0x15'),_0x69a26e,_0x3b1b76[_0x717d('0x18')]['message']);return _0x2fac9e(_0x3b1b76[_0x717d('0x18')][_0x717d('0x1a')]);}else{logger[_0x717d('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x69a26e,_0x717d('0x16'));_0x2fac9e(_0x3b1b76['result'][_0x717d('0x1a')]);}})[_0x717d('0x1b')](function(_0x435759){logger['error'](_0x717d('0x15'),_0x69a26e,_0x435759);_0x42a431(_0x435759);});});} \ No newline at end of file +var _0x697c=['defaults','redis','localhost','./chatInternalMessage.socket','register','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x697c,0x177));var _0xc697=function(_0x4eab74,_0x5e37f4){_0x4eab74=_0x4eab74-0x0;var _0xcbfb43=_0x697c[_0x4eab74];return _0xcbfb43;};'use strict';var _=require(_0xc697('0x0'));var util=require(_0xc697('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc697('0x2'));var fs=require('fs');var Redis=require(_0xc697('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc697('0x4'));var logger=require(_0xc697('0x5'))(_0xc697('0x6'));var config=require(_0xc697('0x7'));var jayson=require(_0xc697('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc697('0x9')](config[_0xc697('0xa')],{'host':_0xc697('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc697('0xc'))[_0xc697('0xd')](socket);function respondWithRpcPromise(_0x45c734,_0xc5ab9f,_0x7defb1){return new BPromise(function(_0x3a3446,_0x5c6675){return client['request'](_0x45c734,_0x7defb1)[_0xc697('0xe')](function(_0x47e8f4){logger['info'](_0xc697('0xf'),_0xc5ab9f,'request\x20sent');logger[_0xc697('0x10')](_0xc697('0x11'),_0xc5ab9f,_0xc697('0x12'),JSON[_0xc697('0x13')](_0x47e8f4));if(_0x47e8f4[_0xc697('0x14')]){if(_0x47e8f4[_0xc697('0x14')][_0xc697('0x15')]===0x1f4){logger[_0xc697('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0xc5ab9f,_0x47e8f4['error']['message']);return _0x5c6675(_0x47e8f4['error']['message']);}logger[_0xc697('0x14')](_0xc697('0xf'),_0xc5ab9f,_0x47e8f4['error']['message']);return _0x3a3446(_0x47e8f4[_0xc697('0x14')]['message']);}else{logger['info'](_0xc697('0xf'),_0xc5ab9f,_0xc697('0x12'));_0x3a3446(_0x47e8f4[_0xc697('0x16')]['message']);}})[_0xc697('0x17')](function(_0x22f1df){logger[_0xc697('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0xc5ab9f,_0x22f1df);_0x5c6675(_0x22f1df);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b4773db..7321658 100644 --- a/server/api/chatInternalMessage/chatInternalMessage.socket.js +++ b/server/api/chatInternalMessage/chatInternalMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0401=['update','removeListener','register','length','remove'];(function(_0x1f5d94,_0x3d59c5){var _0x6565ab=function(_0x39dfb1){while(--_0x39dfb1){_0x1f5d94['push'](_0x1f5d94['shift']());}};_0x6565ab(++_0x3d59c5);}(_0x0401,0xf9));var _0x1040=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x0401[_0x576170];return _0x397c70;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x1040('0x0'),_0x1040('0x1')];function createListener(_0x4d61c1,_0x4f5c16){return function(_0x2662e5){_0x4f5c16['emit'](_0x4d61c1,_0x2662e5);};}function removeListener(_0x3088e0,_0x55ddee){return function(){ChatInternalMessageEvents[_0x1040('0x2')](_0x3088e0,_0x55ddee);};}exports[_0x1040('0x3')]=function(_0x29debb){for(var _0x10ba48=0x0,_0x2d1d85=events[_0x1040('0x4')];_0x10ba48<_0x2d1d85;_0x10ba48++){var _0x4ee957=events[_0x10ba48];var _0x2cd702=createListener('chatInternalMessage:'+_0x4ee957,_0x29debb);ChatInternalMessageEvents['on'](_0x4ee957,_0x2cd702);}}; \ No newline at end of file +var _0x7c6c=['remove','update','emit','removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7c6c,0x196));var _0xc7c6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7c6c[_0x465a0c];return _0x1e202e;};'use strict';var ChatInternalMessageEvents=require(_0xc7c6('0x0'));var events=[_0xc7c6('0x1'),_0xc7c6('0x2'),_0xc7c6('0x3')];function createListener(_0x38433e,_0x1d9fe4){return function(_0x395ad1){_0x1d9fe4[_0xc7c6('0x4')](_0x38433e,_0x395ad1);};}function removeListener(_0x5e35eb,_0x251dc7){return function(){ChatInternalMessageEvents[_0xc7c6('0x5')](_0x5e35eb,_0x251dc7);};}exports['register']=function(_0xabc237){for(var _0x615fbc=0x0,_0x4a4fa3=events[_0xc7c6('0x6')];_0x615fbc<_0x4a4fa3;_0x615fbc++){var _0xd5370=events[_0x615fbc];var _0x5d01d2=createListener(_0xc7c6('0x7')+_0xd5370,_0xabc237);ChatInternalMessageEvents['on'](_0xd5370,_0x5d01d2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1d8b09b..797fd40 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfa2=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','show'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcfa2,0x97));var _0x2cfa=function(_0x42792e,_0x34e1e3){_0x42792e=_0x42792e-0x0;var _0x2897ed=_0xcfa2[_0x42792e];return _0x2897ed;};'use strict';var multer=require(_0x2cfa('0x0'));var util=require('util');var path=require(_0x2cfa('0x1'));var timeout=require(_0x2cfa('0x2'));var express=require(_0x2cfa('0x3'));var router=express[_0x2cfa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2cfa('0x5'));var interaction=require(_0x2cfa('0x6'));var config=require(_0x2cfa('0x7'));var controller=require(_0x2cfa('0x8'));router['get']('/',auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xa')]);router[_0x2cfa('0xb')](_0x2cfa('0xc'),auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xd')]);router[_0x2cfa('0xb')](_0x2cfa('0xe'),auth[_0x2cfa('0x9')](),controller[_0x2cfa('0xf')]);router[_0x2cfa('0xb')]('/:id',auth[_0x2cfa('0x9')](),controller[_0x2cfa('0x10')]);router[_0x2cfa('0x11')]('/',auth[_0x2cfa('0x9')](),controller['create']);router[_0x2cfa('0x12')](_0x2cfa('0x13'),controller[_0x2cfa('0x14')]);router[_0x2cfa('0x15')](_0x2cfa('0x13'),auth['isAuthenticated'](),controller[_0x2cfa('0x16')]);module[_0x2cfa('0x17')]=router; \ No newline at end of file +var _0x5034=['isAuthenticated','index','describe','getUsers','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x47b502,_0x385f0e){var _0x506ebc=function(_0x4bf1b8){while(--_0x4bf1b8){_0x47b502['push'](_0x47b502['shift']());}};_0x506ebc(++_0x385f0e);}(_0x5034,0xdc));var _0x4503=function(_0x1364e1,_0x461b69){_0x1364e1=_0x1364e1-0x0;var _0xe1be41=_0x5034[_0x1364e1];return _0xe1be41;};'use strict';var multer=require(_0x4503('0x0'));var util=require(_0x4503('0x1'));var path=require('path');var timeout=require(_0x4503('0x2'));var express=require(_0x4503('0x3'));var router=express[_0x4503('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4503('0x5'));var config=require(_0x4503('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x4503('0x7')]('/',auth[_0x4503('0x8')](),controller[_0x4503('0x9')]);router[_0x4503('0x7')]('/describe',auth[_0x4503('0x8')](),controller[_0x4503('0xa')]);router[_0x4503('0x7')]('/users',auth['isAuthenticated'](),controller[_0x4503('0xb')]);router[_0x4503('0x7')](_0x4503('0xc'),auth[_0x4503('0x8')](),controller[_0x4503('0xd')]);router['post']('/',auth[_0x4503('0x8')](),controller[_0x4503('0xe')]);router[_0x4503('0xf')](_0x4503('0xc'),controller[_0x4503('0x10')]);router[_0x4503('0x11')](_0x4503('0xc'),auth[_0x4503('0x8')](),controller['destroy']);module[_0x4503('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f311165..10c7128 100644 --- a/server/api/chatMessage/chatMessage.attributes.js +++ b/server/api/chatMessage/chatMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4213=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0xbf5f17,_0x17b121){var _0x469583=function(_0x1aa9f3){while(--_0x1aa9f3){_0xbf5f17['push'](_0xbf5f17['shift']());}};_0x469583(++_0x17b121);}(_0x4213,0x77));var _0x3421=function(_0x189564,_0x419229){_0x189564=_0x189564-0x0;var _0x531d23=_0x4213[_0x189564];return _0x531d23;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'body':{'type':Sequelize[_0x3421('0x2')](_0x3421('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3421('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3421('0x5')]('in','out'),'defaultValue':_0x3421('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x3421('0x7')]},'providerResponse':{'type':Sequelize[_0x3421('0x2')]}}; \ No newline at end of file +var _0x00ea=['TEXT','BOOLEAN','ENUM','out','DATE','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x00ea,0x19d));var _0xa00e=function(_0x2a5892,_0x4f74c8){_0x2a5892=_0x2a5892-0x0;var _0x1fbe29=_0x00ea[_0x2a5892];return _0x1fbe29;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'body':{'type':Sequelize[_0xa00e('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa00e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xa00e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa00e('0x3')]('in',_0xa00e('0x4')),'defaultValue':_0xa00e('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xa00e('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa00e('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c4daf45..4af8148 100644 --- a/server/api/chatMessage/chatMessage.controller.js +++ b/server/api/chatMessage/chatMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff71=['desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','name','send','index','map','ChatMessage','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','where','filter','merge','type','options','includeAll','findAll','rows','params','include','find','create','body','describe','../../config/logger','chat-interactions','accept','read','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','interaction','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce'];(function(_0x54fc58,_0x98c62a){var _0x36f9d8=function(_0x55ffa5){while(--_0x55ffa5){_0x54fc58['push'](_0x54fc58['shift']());}};_0x36f9d8(++_0x98c62a);}(_0xff71,0x1eb));var _0x1ff7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xff71[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x1ff7('0x0'));var rimraf=require(_0x1ff7('0x1'));var zipdir=require(_0x1ff7('0x2'));var jsonpatch=require(_0x1ff7('0x3'));var rp=require('request-promise');var moment=require(_0x1ff7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ff7('0x5'));var util=require(_0x1ff7('0x6'));var path=require(_0x1ff7('0x7'));var sox=require(_0x1ff7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ff7('0x9'));var _=require('lodash');var squel=require(_0x1ff7('0xa'));var crypto=require(_0x1ff7('0xb'));var jsforce=require(_0x1ff7('0xc'));var deskjs=require(_0x1ff7('0xd'));var toCsv=require(_0x1ff7('0xe'));var querystring=require('querystring');var Papa=require(_0x1ff7('0xf'));var Redis=require(_0x1ff7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ff7('0x11'));var as=require(_0x1ff7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1ff7('0x13'));var config=require(_0x1ff7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ff7('0x15'))['db'];config[_0x1ff7('0x16')]=_[_0x1ff7('0x17')](config[_0x1ff7('0x16')],{'host':_0x1ff7('0x18'),'port':0x18eb});var socket=require(_0x1ff7('0x19'))(new Redis(config[_0x1ff7('0x16')]));require('./chatMessage.socket')[_0x1ff7('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1ff7('0x1b')][_0x1ff7('0x1c')]({'port':0x232c});var client9002=jayson[_0x1ff7('0x1b')][_0x1ff7('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x46a237,_0x2e73ec,_0xb14f7d,_0x34bbb3){return new BPromise(function(_0x3b1204,_0x2a0a36){var _0x2261a5=_0x34bbb3||client;return _0x2261a5['request'](_0x46a237,_0xb14f7d)[_0x1ff7('0x1d')](function(_0x405659){logger[_0x1ff7('0x1e')](_0x1ff7('0x1f'),_0x2e73ec,_0x1ff7('0x20'));logger[_0x1ff7('0x21')](_0x1ff7('0x22'),_0x2e73ec,_0x1ff7('0x20'),JSON[_0x1ff7('0x23')](_0x405659));if(_0x405659[_0x1ff7('0x24')]){if(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x25')]===0x1f4){logger['error'](_0x1ff7('0x1f'),_0x2e73ec,_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);return _0x2a0a36(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);}logger['error'](_0x1ff7('0x1f'),_0x2e73ec,_0x405659[_0x1ff7('0x24')]['message']);return _0x3b1204(_0x405659[_0x1ff7('0x24')][_0x1ff7('0x26')]);}else{logger[_0x1ff7('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x2e73ec,_0x1ff7('0x20'));_0x3b1204(_0x405659[_0x1ff7('0x27')][_0x1ff7('0x26')]);}})[_0x1ff7('0x28')](function(_0x1ee932){logger[_0x1ff7('0x24')](_0x1ff7('0x1f'),_0x2e73ec,_0x1ee932);_0x2a0a36(_0x1ee932);});});}function respondWithStatusCode(_0x3879ac,_0xb71c00){_0xb71c00=_0xb71c00||0xcc;return function(_0x5657e6){if(_0x5657e6){return _0x3879ac[_0x1ff7('0x29')](_0xb71c00);}return _0x3879ac[_0x1ff7('0x2a')](_0xb71c00)[_0x1ff7('0x2b')]();};}function respondWithResult(_0x51cb91,_0x406592){_0x406592=_0x406592||0xc8;return function(_0x5bf599){if(_0x5bf599){return _0x51cb91[_0x1ff7('0x2a')](_0x406592)[_0x1ff7('0x2c')](_0x5bf599);}};}function respondWithFilteredResult(_0x5e652e,_0x424891){return function(_0x45bc1e){if(_0x45bc1e){var _0x2b73d9=typeof _0x424891[_0x1ff7('0x2d')]===_0x1ff7('0x2e')&&typeof _0x424891[_0x1ff7('0x2f')]===_0x1ff7('0x2e');var _0x3ab82c=_0x45bc1e['count'];var _0x2cadfb=_0x2b73d9?0x0:_0x424891[_0x1ff7('0x2d')];var _0x3351c2=_0x2b73d9?_0x45bc1e[_0x1ff7('0x30')]:_0x424891[_0x1ff7('0x2d')]+_0x424891[_0x1ff7('0x2f')];var _0x52d944;if(_0x3351c2>=_0x3ab82c){_0x3351c2=_0x3ab82c;_0x52d944=0xc8;}else{_0x52d944=0xce;}_0x5e652e[_0x1ff7('0x2a')](_0x52d944);return _0x5e652e[_0x1ff7('0x31')]('Content-Range',_0x2cadfb+'-'+_0x3351c2+'/'+_0x3ab82c)[_0x1ff7('0x2c')](_0x45bc1e);}return null;};}function patchUpdates(_0x36a142){return function(_0x79274a){try{jsonpatch[_0x1ff7('0x32')](_0x79274a,_0x36a142,!![]);}catch(_0x4b2fb1){return BPromise[_0x1ff7('0x33')](_0x4b2fb1);}return _0x79274a['save']();};}function saveUpdates(_0x48a668,_0xcea70){return function(_0x36a491){if(_0x36a491){return _0x36a491[_0x1ff7('0x34')](_0x48a668)['then'](function(_0x387e4a){return _0x387e4a;});}return null;};}function removeEntity(_0x256da8,_0x5334ea){return function(_0x20d6e5){if(_0x20d6e5){return _0x20d6e5[_0x1ff7('0x35')]()[_0x1ff7('0x1d')](function(){_0x256da8[_0x1ff7('0x2a')](0xcc)[_0x1ff7('0x2b')]();});}};}function handleEntityNotFound(_0x1af059,_0x5ac27e){return function(_0x1c0b05){if(!_0x1c0b05){_0x1af059[_0x1ff7('0x29')](0x194);}return _0x1c0b05;};}function handleError(_0xb1b5f0,_0x4e30fa){_0x4e30fa=_0x4e30fa||0x1f4;return function(_0x3af093){logger[_0x1ff7('0x24')](_0x3af093['stack']);if(_0x3af093[_0x1ff7('0x36')]){delete _0x3af093[_0x1ff7('0x36')];}_0xb1b5f0['status'](_0x4e30fa)[_0x1ff7('0x37')](_0x3af093);};}exports[_0x1ff7('0x38')]=function(_0x45b241,_0x5d9800){var _0x40a0d4={},_0x28bf7b={},_0x3898b6={'count':0x0,'rows':[]};var _0x17460c=_[_0x1ff7('0x39')](db[_0x1ff7('0x3a')][_0x1ff7('0x3b')],function(_0x132220){return{'name':_0x132220['fieldName'],'type':_0x132220['type'][_0x1ff7('0x3c')]};});_0x28bf7b[_0x1ff7('0x3d')]=_[_0x1ff7('0x39')](_0x17460c,_0x1ff7('0x36'));_0x28bf7b['query']=_[_0x1ff7('0x3e')](_0x45b241[_0x1ff7('0x3f')]);_0x28bf7b[_0x1ff7('0x40')]=_[_0x1ff7('0x41')](_0x28bf7b[_0x1ff7('0x3d')],_0x28bf7b[_0x1ff7('0x3f')]);_0x40a0d4['attributes']=_[_0x1ff7('0x41')](_0x28bf7b[_0x1ff7('0x3d')],qs[_0x1ff7('0x42')](_0x45b241['query']['fields']));_0x40a0d4[_0x1ff7('0x43')]=_0x40a0d4['attributes'][_0x1ff7('0x44')]?_0x40a0d4['attributes']:_0x28bf7b[_0x1ff7('0x3d')];if(!_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x45')]('nolimit')){_0x40a0d4['limit']=qs[_0x1ff7('0x2f')](_0x45b241[_0x1ff7('0x3f')]['limit']);_0x40a0d4[_0x1ff7('0x2d')]=qs[_0x1ff7('0x2d')](_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x2d')]);}_0x40a0d4['order']=qs['sort'](_0x45b241[_0x1ff7('0x3f')]['sort']);_0x40a0d4[_0x1ff7('0x46')]=qs['filters'](_['pick'](_0x45b241[_0x1ff7('0x3f')],_0x28bf7b[_0x1ff7('0x40')]),_0x17460c);if(_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x47')]){_0x40a0d4[_0x1ff7('0x46')]=_[_0x1ff7('0x48')](_0x40a0d4['where'],{'$or':_[_0x1ff7('0x39')](_0x17460c,function(_0x5164a7){if(_0x5164a7[_0x1ff7('0x49')]!=='VIRTUAL'){var _0x453510={};_0x453510[_0x5164a7['name']]={'$like':'%'+_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x47')]+'%'};return _0x453510;}})});}_0x40a0d4=_[_0x1ff7('0x48')]({},_0x40a0d4,_0x45b241[_0x1ff7('0x4a')]);var _0x50153d={'where':_0x40a0d4[_0x1ff7('0x46')]};return db[_0x1ff7('0x3a')][_0x1ff7('0x30')](_0x50153d)[_0x1ff7('0x1d')](function(_0x2c3d57){_0x3898b6[_0x1ff7('0x30')]=_0x2c3d57;if(_0x45b241[_0x1ff7('0x3f')][_0x1ff7('0x4b')]){_0x40a0d4['include']=[{'all':!![]}];}return db[_0x1ff7('0x3a')][_0x1ff7('0x4c')](_0x40a0d4);})['then'](function(_0x109b29){_0x3898b6[_0x1ff7('0x4d')]=_0x109b29;return _0x3898b6;})['then'](respondWithFilteredResult(_0x5d9800,_0x40a0d4))['catch'](handleError(_0x5d9800,null));};exports['show']=function(_0x4fc674,_0x4c80a2){var _0x1867dc={'raw':!![],'where':{'id':_0x4fc674[_0x1ff7('0x4e')]['id']}},_0x4457c6={};_0x4457c6[_0x1ff7('0x3d')]=_[_0x1ff7('0x3e')](db[_0x1ff7('0x3a')][_0x1ff7('0x3b')]);_0x4457c6['query']=_[_0x1ff7('0x3e')](_0x4fc674['query']);_0x4457c6[_0x1ff7('0x40')]=_[_0x1ff7('0x41')](_0x4457c6[_0x1ff7('0x3d')],_0x4457c6[_0x1ff7('0x3f')]);_0x1867dc[_0x1ff7('0x43')]=_[_0x1ff7('0x41')](_0x4457c6[_0x1ff7('0x3d')],qs['fields'](_0x4fc674[_0x1ff7('0x3f')][_0x1ff7('0x42')]));_0x1867dc[_0x1ff7('0x43')]=_0x1867dc[_0x1ff7('0x43')][_0x1ff7('0x44')]?_0x1867dc[_0x1ff7('0x43')]:_0x4457c6[_0x1ff7('0x3d')];if(_0x4fc674[_0x1ff7('0x3f')][_0x1ff7('0x4b')]){_0x1867dc[_0x1ff7('0x4f')]=[{'all':!![]}];}_0x1867dc=_['merge']({},_0x1867dc,_0x4fc674[_0x1ff7('0x4a')]);return db[_0x1ff7('0x3a')][_0x1ff7('0x50')](_0x1867dc)[_0x1ff7('0x1d')](handleEntityNotFound(_0x4c80a2,null))[_0x1ff7('0x1d')](respondWithResult(_0x4c80a2,null))['catch'](handleError(_0x4c80a2,null));};exports[_0x1ff7('0x51')]=function(_0x43a115,_0x1b53e7){return db[_0x1ff7('0x3a')][_0x1ff7('0x51')](_0x43a115['body'],{})['then'](respondWithResult(_0x1b53e7,0xc9))[_0x1ff7('0x28')](handleError(_0x1b53e7,null));};exports[_0x1ff7('0x34')]=function(_0x5d816c,_0x88bb2a){if(_0x5d816c[_0x1ff7('0x52')]['id']){delete _0x5d816c[_0x1ff7('0x52')]['id'];}return db[_0x1ff7('0x3a')]['find']({'where':{'id':_0x5d816c[_0x1ff7('0x4e')]['id']}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x88bb2a,null))[_0x1ff7('0x1d')](saveUpdates(_0x5d816c[_0x1ff7('0x52')],null))[_0x1ff7('0x1d')](respondWithResult(_0x88bb2a,null))['catch'](handleError(_0x88bb2a,null));};exports[_0x1ff7('0x35')]=function(_0x2a3d51,_0x4bf45f){return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x2a3d51['params']['id']}})['then'](handleEntityNotFound(_0x4bf45f,null))[_0x1ff7('0x1d')](removeEntity(_0x4bf45f,null))[_0x1ff7('0x28')](handleError(_0x4bf45f,null));};exports['describe']=function(_0x47c58c,_0x43d60f){return db[_0x1ff7('0x3a')][_0x1ff7('0x53')]()['then'](respondWithResult(_0x43d60f,null))['catch'](handleError(_0x43d60f,null));};var interaction_log=require(_0x1ff7('0x54'))(_0x1ff7('0x55'));exports[_0x1ff7('0x56')]=function(_0x148668,_0x535461,_0x34775d){var _0x4aea58={'agent':{},'channel':'chat'};if(_0x148668[_0x1ff7('0x52')]['id']){delete _0x148668['body']['id'];}_0x148668['body'][_0x1ff7('0x57')]=!![];_0x148668[_0x1ff7('0x52')]['readAt']=moment()[_0x1ff7('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')]=_0x148668[_0x1ff7('0x52')]['UserId']||_0x148668[_0x1ff7('0x5a')]['id'];_0x4aea58[_0x1ff7('0x5b')]['id']=_0x148668['body'][_0x1ff7('0x59')];return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x148668['params']['id'],'UserId':null}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x535461,null))['then'](saveUpdates(_0x148668['body'],null))[_0x1ff7('0x1d')](function(_0x52d141){if(_0x52d141){_0x4aea58[_0x1ff7('0x26')]=_0x52d141[_0x1ff7('0x5c')]({'plain':!![]});return db[_0x1ff7('0x5d')][_0x1ff7('0x50')]({'where':{'id':_0x52d141[_0x1ff7('0x5e')]}});}return null;})[_0x1ff7('0x1d')](handleEntityNotFound(_0x535461,null))[_0x1ff7('0x1d')](function(_0x1caffa){if(_0x1caffa){return _0x1caffa[_0x1ff7('0x34')]({'UserId':_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')],'read1stAt':_[_0x1ff7('0x5f')](_0x1caffa['read1stAt'])?moment()[_0x1ff7('0x58')](_0x1ff7('0x60')):undefined});}return null;})[_0x1ff7('0x1d')](function(_0x4d1df5){if(_0x4d1df5){_0x4aea58['interaction']=_0x4d1df5[_0x1ff7('0x5c')]({'plain':!![]});interaction_log[_0x1ff7('0x1e')](_0x1ff7('0x61'),_0x148668[_0x1ff7('0x5a')]['id'],_0x148668[_0x1ff7('0x5a')][_0x1ff7('0x36')],_0x148668[_0x1ff7('0x5a')]['role'],_0x4aea58['interaction']['id'],_0x148668[_0x1ff7('0x52')]?JSON[_0x1ff7('0x23')](_0x148668[_0x1ff7('0x52')]):_0x1ff7('0x62'));return respondWithRpcPromise(_0x1ff7('0x63'),_0x1ff7('0x64'),_0x4aea58);}return null;})[_0x1ff7('0x1d')](function(_0x1f6a92){var _0x22d636='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1f6a92['message'][_0x1ff7('0x65')];return db[_0x1ff7('0x66')][_0x1ff7('0x3f')](_0x22d636,{'type':db['Sequelize'][_0x1ff7('0x67')][_0x1ff7('0x68')],'raw':!![]})[_0x1ff7('0x1d')](function(_0x1ebb7c){return _0x1ebb7c;});})[_0x1ff7('0x1d')](function(_0x4e7693){if(_0x4e7693){_0x4aea58[_0x1ff7('0x26')]['contact']=_0x4e7693[0x0];if(!_0x148668[_0x1ff7('0x52')][_0x1ff7('0x59')])return;return db['User']['find']({'where':{'id':_0x148668[_0x1ff7('0x52')]['UserId'],'role':_0x1ff7('0x5b')},'attributes':['id','name',_0x1ff7('0x69'),_0x1ff7('0x6a'),_0x1ff7('0x6b')],'raw':!![]});}return null;})['then'](function(_0x5cfead){if(!_0x5cfead)return null;_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x5b')]=_0x5cfead;return _0x4aea58;})[_0x1ff7('0x1d')](function(_0x50cfa1){if(_0x50cfa1){if(_0x148668[_0x1ff7('0x52')][_0x1ff7('0x6c')]){_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x6d')]=util[_0x1ff7('0x58')](_0x1ff7('0x6e'),_0x148668[_0x1ff7('0x5a')]['name']);_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x6f')]=_0x4aea58[_0x1ff7('0x6f')];_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x70')]=_0x4aea58[_0x1ff7('0x6f')];_0x4aea58[_0x1ff7('0x26')][_0x1ff7('0x71')]=_0x1ff7('0x56');return respondWithRpcPromise(_0x1ff7('0x72'),_0x1ff7('0x72'),{'event':'acceptmessage','message':_[_0x1ff7('0x48')](_0x4aea58[_0x1ff7('0x26')],JSON[_0x1ff7('0x73')](_0x4aea58[_0x1ff7('0x74')][_0x1ff7('0x75')]))},client9002)[_0x1ff7('0x1d')](function(){return _0x4aea58;});}return _0x4aea58;}return null;})[_0x1ff7('0x1d')](respondWithResult(_0x535461,null))[_0x1ff7('0x28')](handleError(_0x535461,null));};var interaction_log=require(_0x1ff7('0x54'))(_0x1ff7('0x55'));exports[_0x1ff7('0x33')]=function(_0x39035e,_0x2c9188,_0x4ca434){var _0x41278a={'agent':{},'channel':_0x1ff7('0x76')};if(_0x39035e[_0x1ff7('0x52')]['id']){delete _0x39035e[_0x1ff7('0x52')]['id'];}_0x39035e['body'][_0x1ff7('0x59')]=_0x39035e[_0x1ff7('0x52')][_0x1ff7('0x59')]||_0x39035e[_0x1ff7('0x5a')]['id'];_0x41278a['agent']['id']=_0x39035e[_0x1ff7('0x52')]['UserId'];return db[_0x1ff7('0x3a')][_0x1ff7('0x50')]({'where':{'id':_0x39035e[_0x1ff7('0x4e')]['id'],'UserId':null}})[_0x1ff7('0x1d')](handleEntityNotFound(_0x2c9188,null))['then'](function(_0x1eb4b3){if(_0x1eb4b3){_0x41278a[_0x1ff7('0x26')]=_0x1eb4b3[_0x1ff7('0x5c')]({'plain':!![]});return db[_0x1ff7('0x5d')][_0x1ff7('0x50')]({'where':{'id':_0x1eb4b3[_0x1ff7('0x5e')]}});}return null;})[_0x1ff7('0x1d')](handleEntityNotFound(_0x2c9188,null))[_0x1ff7('0x1d')](function(_0x8da563){if(_0x8da563){_0x41278a[_0x1ff7('0x74')]=_0x8da563[_0x1ff7('0x5c')]({'plain':!![]});interaction_log[_0x1ff7('0x1e')](_0x1ff7('0x77'),_0x39035e['user']['id'],_0x39035e['user']['name'],_0x39035e['user']['role'],_0x41278a[_0x1ff7('0x74')]['id'],_0x39035e[_0x1ff7('0x52')]?JSON['stringify'](_0x39035e[_0x1ff7('0x52')]):'null');return respondWithRpcPromise(_0x1ff7('0x78'),_0x1ff7('0x79'),_0x41278a);}return null;})[_0x1ff7('0x1d')](function(_0x2cba6a){var _0x2f1940=_0x1ff7('0x7a')+_0x2cba6a['message']['ContactId'];return db[_0x1ff7('0x66')]['query'](_0x2f1940,{'type':db[_0x1ff7('0x7b')][_0x1ff7('0x67')][_0x1ff7('0x68')],'raw':!![]})[_0x1ff7('0x1d')](function(_0xc10793){return _0xc10793;});})[_0x1ff7('0x1d')](function(_0x1578f8){if(_0x1578f8){_0x41278a[_0x1ff7('0x26')][_0x1ff7('0x7c')]=_0x1578f8[0x0];if(!_0x39035e[_0x1ff7('0x52')]['UserId'])return;return db['User'][_0x1ff7('0x50')]({'where':{'id':_0x39035e[_0x1ff7('0x52')][_0x1ff7('0x59')],'role':'agent'},'attributes':['id',_0x1ff7('0x36'),'fullname','email',_0x1ff7('0x6b')],'raw':!![]});}return null;})[_0x1ff7('0x1d')](function(_0x419d0d){if(!_0x419d0d)return null;_0x41278a[_0x1ff7('0x26')][_0x1ff7('0x5b')]=_0x419d0d;return _0x41278a;})[_0x1ff7('0x1d')](function(_0x3d82bc){if(_0x3d82bc){_0x3d82bc['message'][_0x1ff7('0x6d')]=util[_0x1ff7('0x58')](_0x1ff7('0x6e'),_0x39035e['user'][_0x1ff7('0x36')]);_0x3d82bc['message'][_0x1ff7('0x6f')]=_0x41278a[_0x1ff7('0x6f')];_0x3d82bc[_0x1ff7('0x26')]['motionChannel']=_0x41278a[_0x1ff7('0x6f')];_0x3d82bc[_0x1ff7('0x26')][_0x1ff7('0x71')]=_0x1ff7('0x33');respondWithRpcPromise(_0x1ff7('0x72'),_0x1ff7('0x72'),{'event':_0x1ff7('0x7d'),'message':_[_0x1ff7('0x48')](_0x41278a['message'],JSON[_0x1ff7('0x73')](_0x41278a[_0x1ff7('0x74')][_0x1ff7('0x75')]))},client9002);return _0x41278a;}return null;})[_0x1ff7('0x1d')](respondWithResult(_0x2c9188,null))[_0x1ff7('0x28')](handleError(_0x2c9188,null));}; \ No newline at end of file +var _0xf672=['update','then','destroy','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','find','create','body','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','accept','EventManager','parse','formData','get','role','rejectMessage','Sequelize','QueryTypes','contact','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','json','reject','save'];(function(_0x1635fe,_0x5f1d9f){var _0x3c512a=function(_0x26b53d){while(--_0x26b53d){_0x1635fe['push'](_0x1635fe['shift']());}};_0x3c512a(++_0x5f1d9f);}(_0xf672,0xc5));var _0x2f67=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf672[_0xbd08b4];return _0x314f1e;};'use strict';var emlformat=require(_0x2f67('0x0'));var rimraf=require(_0x2f67('0x1'));var zipdir=require(_0x2f67('0x2'));var jsonpatch=require(_0x2f67('0x3'));var rp=require('request-promise');var moment=require(_0x2f67('0x4'));var BPromise=require(_0x2f67('0x5'));var Mustache=require(_0x2f67('0x6'));var util=require(_0x2f67('0x7'));var path=require('path');var sox=require(_0x2f67('0x8'));var csv=require(_0x2f67('0x9'));var ejs=require(_0x2f67('0xa'));var fs=require('fs');var fs_extra=require(_0x2f67('0xb'));var _=require('lodash');var squel=require(_0x2f67('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2f67('0xe'));var Papa=require(_0x2f67('0xf'));var Redis=require(_0x2f67('0x10'));var authService=require(_0x2f67('0x11'));var qs=require(_0x2f67('0x12'));var as=require(_0x2f67('0x13'));var hardwareService=require(_0x2f67('0x14'));var logger=require(_0x2f67('0x15'))(_0x2f67('0x16'));var utils=require(_0x2f67('0x17'));var config=require(_0x2f67('0x18'));var licenseUtil=require(_0x2f67('0x19'));var db=require('../../mysqldb')['db'];config[_0x2f67('0x1a')]=_[_0x2f67('0x1b')](config['redis'],{'host':_0x2f67('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f67('0x1a')]));require('./chatMessage.socket')[_0x2f67('0x1d')](socket);var jayson=require(_0x2f67('0x1e'));var client=jayson[_0x2f67('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x2f67('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x31860a,_0x2b2708,_0x34429e,_0x387767){return new BPromise(function(_0x42517b,_0x116283){var _0x4ab91a=_0x387767||client;return _0x4ab91a['request'](_0x31860a,_0x34429e)['then'](function(_0x54f7c3){logger['info'](_0x2f67('0x21'),_0x2b2708,_0x2f67('0x22'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2b2708,_0x2f67('0x22'),JSON[_0x2f67('0x23')](_0x54f7c3));if(_0x54f7c3[_0x2f67('0x24')]){if(_0x54f7c3[_0x2f67('0x24')][_0x2f67('0x25')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2b2708,_0x54f7c3[_0x2f67('0x24')][_0x2f67('0x26')]);return _0x116283(_0x54f7c3['error'][_0x2f67('0x26')]);}logger[_0x2f67('0x24')](_0x2f67('0x21'),_0x2b2708,_0x54f7c3[_0x2f67('0x24')][_0x2f67('0x26')]);return _0x42517b(_0x54f7c3['error'][_0x2f67('0x26')]);}else{logger[_0x2f67('0x27')](_0x2f67('0x21'),_0x2b2708,_0x2f67('0x22'));_0x42517b(_0x54f7c3[_0x2f67('0x28')]['message']);}})[_0x2f67('0x29')](function(_0x3b43d7){logger[_0x2f67('0x24')]('ChatMessage,\x20%s,\x20%s',_0x2b2708,_0x3b43d7);_0x116283(_0x3b43d7);});});}function respondWithStatusCode(_0x59f257,_0x285183){_0x285183=_0x285183||0xcc;return function(_0x3636ef){if(_0x3636ef){return _0x59f257[_0x2f67('0x2a')](_0x285183);}return _0x59f257[_0x2f67('0x2b')](_0x285183)['end']();};}function respondWithResult(_0xdea0e2,_0x28e925){_0x28e925=_0x28e925||0xc8;return function(_0x8227b7){if(_0x8227b7){return _0xdea0e2[_0x2f67('0x2b')](_0x28e925)['json'](_0x8227b7);}};}function respondWithFilteredResult(_0x406251,_0x11a039){return function(_0x50fdcf){if(_0x50fdcf){var _0x113c5e=typeof _0x11a039[_0x2f67('0x2c')]===_0x2f67('0x2d')&&typeof _0x11a039[_0x2f67('0x2e')]===_0x2f67('0x2d');var _0xdb28d3=_0x50fdcf[_0x2f67('0x2f')];var _0x1619fe=_0x113c5e?0x0:_0x11a039[_0x2f67('0x2c')];var _0x5bfe4e=_0x113c5e?_0x50fdcf['count']:_0x11a039['offset']+_0x11a039[_0x2f67('0x2e')];var _0x1a4a56;if(_0x5bfe4e>=_0xdb28d3){_0x5bfe4e=_0xdb28d3;_0x1a4a56=0xc8;}else{_0x1a4a56=0xce;}_0x406251['status'](_0x1a4a56);return _0x406251['set']('Content-Range',_0x1619fe+'-'+_0x5bfe4e+'/'+_0xdb28d3)[_0x2f67('0x30')](_0x50fdcf);}return null;};}function patchUpdates(_0x314aea){return function(_0x4ef8db){try{jsonpatch['apply'](_0x4ef8db,_0x314aea,!![]);}catch(_0x2c3b85){return BPromise[_0x2f67('0x31')](_0x2c3b85);}return _0x4ef8db[_0x2f67('0x32')]();};}function saveUpdates(_0x5a6f75,_0x412892){return function(_0x51ff3b){if(_0x51ff3b){return _0x51ff3b[_0x2f67('0x33')](_0x5a6f75)[_0x2f67('0x34')](function(_0x211aa2){return _0x211aa2;});}return null;};}function removeEntity(_0x1fb4c1,_0x2d917d){return function(_0x5ba764){if(_0x5ba764){return _0x5ba764[_0x2f67('0x35')]()[_0x2f67('0x34')](function(){_0x1fb4c1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e91a6,_0x38bf9){return function(_0x41d592){if(!_0x41d592){_0x3e91a6[_0x2f67('0x2a')](0x194);}return _0x41d592;};}function handleError(_0x162725,_0x1e7865){_0x1e7865=_0x1e7865||0x1f4;return function(_0x51d889){logger['error'](_0x51d889['stack']);if(_0x51d889['name']){delete _0x51d889['name'];}_0x162725[_0x2f67('0x2b')](_0x1e7865)[_0x2f67('0x36')](_0x51d889);};}exports['index']=function(_0x527a08,_0x1f5b8e){var _0x75e2ea={},_0x18e4ae={},_0x416296={'count':0x0,'rows':[]};var _0x33b38f=_[_0x2f67('0x37')](db[_0x2f67('0x38')][_0x2f67('0x39')],function(_0x35196f){return{'name':_0x35196f[_0x2f67('0x3a')],'type':_0x35196f[_0x2f67('0x3b')][_0x2f67('0x3c')]};});_0x18e4ae[_0x2f67('0x3d')]=_[_0x2f67('0x37')](_0x33b38f,_0x2f67('0x3e'));_0x18e4ae[_0x2f67('0x3f')]=_[_0x2f67('0x40')](_0x527a08[_0x2f67('0x3f')]);_0x18e4ae['filters']=_[_0x2f67('0x41')](_0x18e4ae[_0x2f67('0x3d')],_0x18e4ae[_0x2f67('0x3f')]);_0x75e2ea['attributes']=_[_0x2f67('0x41')](_0x18e4ae[_0x2f67('0x3d')],qs[_0x2f67('0x42')](_0x527a08['query']['fields']));_0x75e2ea[_0x2f67('0x43')]=_0x75e2ea[_0x2f67('0x43')][_0x2f67('0x44')]?_0x75e2ea['attributes']:_0x18e4ae[_0x2f67('0x3d')];if(!_0x527a08[_0x2f67('0x3f')][_0x2f67('0x45')]('nolimit')){_0x75e2ea[_0x2f67('0x2e')]=qs['limit'](_0x527a08[_0x2f67('0x3f')]['limit']);_0x75e2ea[_0x2f67('0x2c')]=qs['offset'](_0x527a08[_0x2f67('0x3f')][_0x2f67('0x2c')]);}_0x75e2ea['order']=qs[_0x2f67('0x46')](_0x527a08[_0x2f67('0x3f')][_0x2f67('0x46')]);_0x75e2ea[_0x2f67('0x47')]=qs['filters'](_['pick'](_0x527a08[_0x2f67('0x3f')],_0x18e4ae[_0x2f67('0x48')]),_0x33b38f);if(_0x527a08[_0x2f67('0x3f')]['filter']){_0x75e2ea[_0x2f67('0x47')]=_[_0x2f67('0x49')](_0x75e2ea[_0x2f67('0x47')],{'$or':_['map'](_0x33b38f,function(_0x167918){if(_0x167918[_0x2f67('0x3b')]!==_0x2f67('0x4a')){var _0x2519b2={};_0x2519b2[_0x167918[_0x2f67('0x3e')]]={'$like':'%'+_0x527a08['query'][_0x2f67('0x4b')]+'%'};return _0x2519b2;}})});}_0x75e2ea=_['merge']({},_0x75e2ea,_0x527a08['options']);var _0x5da5b3={'where':_0x75e2ea[_0x2f67('0x47')]};return db[_0x2f67('0x38')][_0x2f67('0x2f')](_0x5da5b3)['then'](function(_0x262883){_0x416296[_0x2f67('0x2f')]=_0x262883;if(_0x527a08[_0x2f67('0x3f')][_0x2f67('0x4c')]){_0x75e2ea[_0x2f67('0x4d')]=[{'all':!![]}];}return db['ChatMessage'][_0x2f67('0x4e')](_0x75e2ea);})[_0x2f67('0x34')](function(_0x5ba597){_0x416296[_0x2f67('0x4f')]=_0x5ba597;return _0x416296;})[_0x2f67('0x34')](respondWithFilteredResult(_0x1f5b8e,_0x75e2ea))[_0x2f67('0x29')](handleError(_0x1f5b8e,null));};exports['show']=function(_0x29c5de,_0x4f5232){var _0x21d7c4={'raw':!![],'where':{'id':_0x29c5de[_0x2f67('0x50')]['id']}},_0x1c5350={};_0x1c5350[_0x2f67('0x3d')]=_[_0x2f67('0x40')](db[_0x2f67('0x38')]['rawAttributes']);_0x1c5350[_0x2f67('0x3f')]=_['keys'](_0x29c5de[_0x2f67('0x3f')]);_0x1c5350[_0x2f67('0x48')]=_[_0x2f67('0x41')](_0x1c5350[_0x2f67('0x3d')],_0x1c5350[_0x2f67('0x3f')]);_0x21d7c4[_0x2f67('0x43')]=_['intersection'](_0x1c5350[_0x2f67('0x3d')],qs[_0x2f67('0x42')](_0x29c5de[_0x2f67('0x3f')]['fields']));_0x21d7c4[_0x2f67('0x43')]=_0x21d7c4[_0x2f67('0x43')]['length']?_0x21d7c4[_0x2f67('0x43')]:_0x1c5350[_0x2f67('0x3d')];if(_0x29c5de[_0x2f67('0x3f')][_0x2f67('0x4c')]){_0x21d7c4[_0x2f67('0x4d')]=[{'all':!![]}];}_0x21d7c4=_[_0x2f67('0x49')]({},_0x21d7c4,_0x29c5de[_0x2f67('0x51')]);return db[_0x2f67('0x38')][_0x2f67('0x52')](_0x21d7c4)[_0x2f67('0x34')](handleEntityNotFound(_0x4f5232,null))[_0x2f67('0x34')](respondWithResult(_0x4f5232,null))[_0x2f67('0x29')](handleError(_0x4f5232,null));};exports[_0x2f67('0x53')]=function(_0x1a8169,_0x13ff2b){return db[_0x2f67('0x38')][_0x2f67('0x53')](_0x1a8169[_0x2f67('0x54')],{})['then'](respondWithResult(_0x13ff2b,0xc9))[_0x2f67('0x29')](handleError(_0x13ff2b,null));};exports[_0x2f67('0x33')]=function(_0x218c16,_0x5bd84e){if(_0x218c16[_0x2f67('0x54')]['id']){delete _0x218c16[_0x2f67('0x54')]['id'];}return db[_0x2f67('0x38')][_0x2f67('0x52')]({'where':{'id':_0x218c16['params']['id']}})[_0x2f67('0x34')](handleEntityNotFound(_0x5bd84e,null))['then'](saveUpdates(_0x218c16['body'],null))[_0x2f67('0x34')](respondWithResult(_0x5bd84e,null))[_0x2f67('0x29')](handleError(_0x5bd84e,null));};exports[_0x2f67('0x35')]=function(_0x515d89,_0x334843){return db[_0x2f67('0x38')]['find']({'where':{'id':_0x515d89[_0x2f67('0x50')]['id']}})[_0x2f67('0x34')](handleEntityNotFound(_0x334843,null))[_0x2f67('0x34')](removeEntity(_0x334843,null))['catch'](handleError(_0x334843,null));};exports[_0x2f67('0x55')]=function(_0x26394e,_0x1d01bf){return db[_0x2f67('0x38')][_0x2f67('0x55')]()['then'](respondWithResult(_0x1d01bf,null))[_0x2f67('0x29')](handleError(_0x1d01bf,null));};var interaction_log=require(_0x2f67('0x15'))('chat-interactions');exports['accept']=function(_0x2607a3,_0xfc52b0,_0x4c65ff){var _0x122bc5={'agent':{},'channel':_0x2f67('0x56')};if(_0x2607a3[_0x2f67('0x54')]['id']){delete _0x2607a3[_0x2f67('0x54')]['id'];}_0x2607a3[_0x2f67('0x54')][_0x2f67('0x57')]=!![];_0x2607a3[_0x2f67('0x54')][_0x2f67('0x58')]=moment()[_0x2f67('0x59')](_0x2f67('0x5a'));_0x2607a3['body'][_0x2f67('0x5b')]=_0x2607a3['body']['UserId']||_0x2607a3[_0x2f67('0x5c')]['id'];_0x122bc5[_0x2f67('0x5d')]['id']=_0x2607a3['body'][_0x2f67('0x5b')];return db[_0x2f67('0x38')]['find']({'where':{'id':_0x2607a3[_0x2f67('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xfc52b0,null))[_0x2f67('0x34')](saveUpdates(_0x2607a3[_0x2f67('0x54')],null))[_0x2f67('0x34')](function(_0x5f51c3){if(_0x5f51c3){_0x122bc5['message']=_0x5f51c3['get']({'plain':!![]});return db[_0x2f67('0x5e')]['find']({'where':{'id':_0x5f51c3[_0x2f67('0x5f')]}});}return null;})[_0x2f67('0x34')](handleEntityNotFound(_0xfc52b0,null))[_0x2f67('0x34')](function(_0x5bfe86){if(_0x5bfe86){return _0x5bfe86[_0x2f67('0x33')]({'UserId':_0x2607a3['body'][_0x2f67('0x5b')],'read1stAt':_[_0x2f67('0x60')](_0x5bfe86[_0x2f67('0x61')])?moment()['format'](_0x2f67('0x5a')):undefined});}return null;})[_0x2f67('0x34')](function(_0x56bf71){if(_0x56bf71){_0x122bc5[_0x2f67('0x62')]=_0x56bf71['get']({'plain':!![]});interaction_log['info'](_0x2f67('0x63'),_0x2607a3[_0x2f67('0x5c')]['id'],_0x2607a3[_0x2f67('0x5c')][_0x2f67('0x3e')],_0x2607a3[_0x2f67('0x5c')]['role'],_0x122bc5['interaction']['id'],_0x2607a3[_0x2f67('0x54')]?JSON[_0x2f67('0x23')](_0x2607a3[_0x2f67('0x54')]):_0x2f67('0x64'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x122bc5);}return null;})[_0x2f67('0x34')](function(_0x391ace){var _0xe9b0c7=_0x2f67('0x65')+_0x391ace[_0x2f67('0x26')][_0x2f67('0x66')];return db[_0x2f67('0x67')][_0x2f67('0x3f')](_0xe9b0c7,{'type':db['Sequelize']['QueryTypes'][_0x2f67('0x68')],'raw':!![]})[_0x2f67('0x34')](function(_0x4be853){return _0x4be853;});})[_0x2f67('0x34')](function(_0x3afc0e){if(_0x3afc0e){_0x122bc5[_0x2f67('0x26')]['contact']=_0x3afc0e[0x0];if(!_0x2607a3[_0x2f67('0x54')][_0x2f67('0x5b')])return;return db[_0x2f67('0x69')][_0x2f67('0x52')]({'where':{'id':_0x2607a3['body']['UserId'],'role':_0x2f67('0x5d')},'attributes':['id',_0x2f67('0x3e'),_0x2f67('0x6a'),_0x2f67('0x6b'),'internal'],'raw':!![]});}return null;})[_0x2f67('0x34')](function(_0x450bfe){if(!_0x450bfe)return null;_0x122bc5[_0x2f67('0x26')][_0x2f67('0x5d')]=_0x450bfe;return _0x122bc5;})[_0x2f67('0x34')](function(_0xac7dd4){if(_0xac7dd4){if(_0x2607a3['body'][_0x2f67('0x6c')]){_0x122bc5[_0x2f67('0x26')][_0x2f67('0x6d')]=util[_0x2f67('0x59')](_0x2f67('0x6e'),_0x2607a3['user'][_0x2f67('0x3e')]);_0x122bc5['message'][_0x2f67('0x6f')]=_0x122bc5['channel'];_0x122bc5[_0x2f67('0x26')]['motionChannel']=_0x122bc5[_0x2f67('0x6f')];_0x122bc5[_0x2f67('0x26')]['event']=_0x2f67('0x70');return respondWithRpcPromise(_0x2f67('0x71'),_0x2f67('0x71'),{'event':'acceptmessage','message':_[_0x2f67('0x49')](_0x122bc5[_0x2f67('0x26')],JSON[_0x2f67('0x72')](_0x122bc5['interaction'][_0x2f67('0x73')]))},client9002)[_0x2f67('0x34')](function(){return _0x122bc5;});}return _0x122bc5;}return null;})[_0x2f67('0x34')](respondWithResult(_0xfc52b0,null))[_0x2f67('0x29')](handleError(_0xfc52b0,null));};var interaction_log=require(_0x2f67('0x15'))('chat-interactions');exports[_0x2f67('0x31')]=function(_0x405012,_0x153f7b,_0x24517e){var _0x20c015={'agent':{},'channel':_0x2f67('0x56')};if(_0x405012[_0x2f67('0x54')]['id']){delete _0x405012[_0x2f67('0x54')]['id'];}_0x405012[_0x2f67('0x54')][_0x2f67('0x5b')]=_0x405012[_0x2f67('0x54')][_0x2f67('0x5b')]||_0x405012[_0x2f67('0x5c')]['id'];_0x20c015[_0x2f67('0x5d')]['id']=_0x405012[_0x2f67('0x54')][_0x2f67('0x5b')];return db[_0x2f67('0x38')][_0x2f67('0x52')]({'where':{'id':_0x405012['params']['id'],'UserId':null}})[_0x2f67('0x34')](handleEntityNotFound(_0x153f7b,null))[_0x2f67('0x34')](function(_0x4f383e){if(_0x4f383e){_0x20c015['message']=_0x4f383e[_0x2f67('0x74')]({'plain':!![]});return db[_0x2f67('0x5e')][_0x2f67('0x52')]({'where':{'id':_0x4f383e[_0x2f67('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x153f7b,null))[_0x2f67('0x34')](function(_0xb20d48){if(_0xb20d48){_0x20c015[_0x2f67('0x62')]=_0xb20d48[_0x2f67('0x74')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x405012[_0x2f67('0x5c')]['id'],_0x405012[_0x2f67('0x5c')][_0x2f67('0x3e')],_0x405012['user'][_0x2f67('0x75')],_0x20c015[_0x2f67('0x62')]['id'],_0x405012[_0x2f67('0x54')]?JSON[_0x2f67('0x23')](_0x405012[_0x2f67('0x54')]):_0x2f67('0x64'));return respondWithRpcPromise('RejectMessage',_0x2f67('0x76'),_0x20c015);}return null;})[_0x2f67('0x34')](function(_0x145544){var _0x47641a=_0x2f67('0x65')+_0x145544[_0x2f67('0x26')][_0x2f67('0x66')];return db[_0x2f67('0x67')][_0x2f67('0x3f')](_0x47641a,{'type':db[_0x2f67('0x77')][_0x2f67('0x78')][_0x2f67('0x68')],'raw':!![]})[_0x2f67('0x34')](function(_0x182e6f){return _0x182e6f;});})[_0x2f67('0x34')](function(_0xdfe633){if(_0xdfe633){_0x20c015['message'][_0x2f67('0x79')]=_0xdfe633[0x0];if(!_0x405012[_0x2f67('0x54')][_0x2f67('0x5b')])return;return db[_0x2f67('0x69')][_0x2f67('0x52')]({'where':{'id':_0x405012[_0x2f67('0x54')][_0x2f67('0x5b')],'role':_0x2f67('0x5d')},'attributes':['id',_0x2f67('0x3e'),_0x2f67('0x6a'),_0x2f67('0x6b'),'internal'],'raw':!![]});}return null;})[_0x2f67('0x34')](function(_0x4789e1){if(!_0x4789e1)return null;_0x20c015['message'][_0x2f67('0x5d')]=_0x4789e1;return _0x20c015;})[_0x2f67('0x34')](function(_0x1ffeb6){if(_0x1ffeb6){_0x1ffeb6['message']['interface']=util[_0x2f67('0x59')]('SIP/%s',_0x405012[_0x2f67('0x5c')][_0x2f67('0x3e')]);_0x1ffeb6['message'][_0x2f67('0x6f')]=_0x20c015['channel'];_0x1ffeb6[_0x2f67('0x26')]['motionChannel']=_0x20c015[_0x2f67('0x6f')];_0x1ffeb6[_0x2f67('0x26')][_0x2f67('0x7a')]=_0x2f67('0x31');respondWithRpcPromise(_0x2f67('0x71'),_0x2f67('0x71'),{'event':_0x2f67('0x7b'),'message':_[_0x2f67('0x49')](_0x20c015[_0x2f67('0x26')],JSON[_0x2f67('0x72')](_0x20c015['interaction'][_0x2f67('0x73')]))},client9002);return _0x20c015;}return null;})[_0x2f67('0x34')](respondWithResult(_0x153f7b,null))[_0x2f67('0x29')](handleError(_0x153f7b,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 93a2938..3cfa1f7 100644 --- a/server/api/chatMessage/chatMessage.events.js +++ b/server/api/chatMessage/chatMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea6a=['setMaxListeners','save','emit','hasOwnProperty','events','../../mysqldb','ChatMessage'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xea6a,0x12a));var _0xaea6=function(_0x156618,_0x5ad92f){_0x156618=_0x156618-0x0;var _0x1344e8=_0xea6a[_0x156618];return _0x1344e8;};'use strict';var EventEmitter=require(_0xaea6('0x0'));var ChatMessage=require(_0xaea6('0x1'))['db'][_0xaea6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xaea6('0x3')](0x0);var events={'afterCreate':_0xaea6('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4be2d7){return function(_0x2af543,_0x4e166e,_0x775abc){ChatMessageEvents[_0xaea6('0x5')](_0x4be2d7+':'+_0x2af543['id'],_0x2af543);ChatMessageEvents[_0xaea6('0x5')](_0x4be2d7,_0x2af543);_0x775abc(null);};}for(var e in events){if(events[_0xaea6('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x77ac=['exports','events','ChatMessage','save','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77ac,0x182));var _0xc77a=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x77ac[_0x28394f];return _0x2618d2;};'use strict';var EventEmitter=require(_0xc77a('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xc77a('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc77a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xa35859){return function(_0x4ca08a,_0x55c55a,_0x5998a4){ChatMessageEvents[_0xc77a('0x3')](_0xa35859+':'+_0x4ca08a['id'],_0x4ca08a);ChatMessageEvents[_0xc77a('0x3')](_0xa35859,_0x4ca08a);_0x5998a4(null);};}for(var e in events){if(events[_0xc77a('0x4')](e)){var event=events[e];ChatMessage[_0xc77a('0x5')](e,emitEvent(event));}}module[_0xc77a('0x6')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a55fb77..622dec7 100644 --- a/server/api/chatMessage/chatMessage.model.js +++ b/server/api/chatMessage/chatMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3036=['../../config/logger','api','moment','request-promise','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x31022d,_0x79dd91){var _0x5456d6=function(_0x90e8d2){while(--_0x90e8d2){_0x31022d['push'](_0x31022d['shift']());}};_0x5456d6(++_0x79dd91);}(_0x3036,0x1a9));var _0x6303=function(_0x469a09,_0x6181ee){_0x469a09=_0x469a09-0x0;var _0x2886b9=_0x3036[_0x469a09];return _0x2886b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6303('0x0'))(_0x6303('0x1'));var moment=require(_0x6303('0x2'));var BPromise=require('bluebird');var rp=require(_0x6303('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6303('0x4'));module['exports']=function(_0x464b99,_0xaa32ef){return _0x464b99[_0x6303('0x5')]('ChatMessage',attributes,{'tableName':_0x6303('0x6'),'paranoid':![],'indexes':[{'name':_0x6303('0x7'),'fields':[_0x6303('0x8')],'type':_0x6303('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7f88f,_0x2684ac,_0x23b326){var _0x179151=_0x464b99[_0x6303('0xa')];var _0x558fca=_0x7f88f[_0x6303('0xb')]({'plain':!![]});if(_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()==='in'||_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()==='out'&&!_0x558fca[_0x6303('0xe')]&&!_[_0x6303('0xf')](_0x558fca[_0x6303('0x10')])){_0x179151[_0x6303('0x11')][_0x6303('0x12')]({'where':{'id':_0x558fca['ChatInteractionId']}})['then'](function(_0x5d75c1){if(_0x5d75c1){_0x5d75c1[_0x6303('0x13')]({'lastMsgAt':_0x558fca[_0x6303('0x14')],'lastMsgDirection':_0x558fca[_0x6303('0xc')][_0x6303('0xd')]()});}})[_0x6303('0x15')](function(_0x43526d){console[_0x6303('0x16')](_0x43526d);});}_0x23b326();}},'charset':_0x6303('0x17'),'collate':_0x6303('0x18')});}; \ No newline at end of file +var _0x4098=['catch','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','createdAt'];(function(_0x3cc8b4,_0x33bc7d){var _0x20ff15=function(_0x5c30c2){while(--_0x5c30c2){_0x3cc8b4['push'](_0x3cc8b4['shift']());}};_0x20ff15(++_0x33bc7d);}(_0x4098,0x120));var _0x8409=function(_0x1d94ad,_0xc86e5f){_0x1d94ad=_0x1d94ad-0x0;var _0x56a181=_0x4098[_0x1d94ad];return _0x56a181;};'use strict';var _=require('lodash');var util=require(_0x8409('0x0'));var logger=require(_0x8409('0x1'))('api');var moment=require(_0x8409('0x2'));var BPromise=require(_0x8409('0x3'));var rp=require(_0x8409('0x4'));var fs=require('fs');var path=require(_0x8409('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8409('0x6'));module[_0x8409('0x7')]=function(_0x5badeb,_0x226541){return _0x5badeb[_0x8409('0x8')]('ChatMessage',attributes,{'tableName':_0x8409('0x9'),'paranoid':![],'indexes':[{'name':_0x8409('0xa'),'fields':[_0x8409('0xb')],'type':_0x8409('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22af82,_0x51a8d2,_0x3b526e){var _0x2168cc=_0x5badeb[_0x8409('0xd')];var _0x5b952f=_0x22af82[_0x8409('0xe')]({'plain':!![]});if(_0x5b952f[_0x8409('0xf')]['toLowerCase']()==='in'||_0x5b952f[_0x8409('0xf')][_0x8409('0x10')]()==='out'&&!_0x5b952f[_0x8409('0x11')]&&!_[_0x8409('0x12')](_0x5b952f['UserId'])){_0x2168cc[_0x8409('0x13')][_0x8409('0x14')]({'where':{'id':_0x5b952f[_0x8409('0x15')]}})[_0x8409('0x16')](function(_0x9716ad){if(_0x9716ad){_0x9716ad['update']({'lastMsgAt':_0x5b952f[_0x8409('0x17')],'lastMsgDirection':_0x5b952f[_0x8409('0xf')][_0x8409('0x10')]()});}})[_0x8409('0x18')](function(_0x26d275){console['error'](_0x26d275);});}_0x3b526e();}},'charset':_0x8409('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f2d7d32..091ab3e 100644 --- a/server/api/chatMessage/chatMessage.rpc.js +++ b/server/api/chatMessage/chatMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93b2=['ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatMessage','ChatMessage','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x38bf76,_0x313689){var _0x141848=function(_0x2ed9d6){while(--_0x2ed9d6){_0x38bf76['push'](_0x38bf76['shift']());}};_0x141848(++_0x313689);}(_0x93b2,0xcd));var _0x293b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x93b2[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x293b('0x0'));var util=require(_0x293b('0x1'));var moment=require(_0x293b('0x2'));var BPromise=require(_0x293b('0x3'));var rs=require(_0x293b('0x4'));var fs=require('fs');var Redis=require(_0x293b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x293b('0x6'));var logger=require('../../config/logger')(_0x293b('0x7'));var config=require(_0x293b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x293b('0x9')][_0x293b('0xa')]({'port':0x232a});config[_0x293b('0xb')]=_[_0x293b('0xc')](config[_0x293b('0xb')],{'host':_0x293b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x293b('0xb')]));require(_0x293b('0xe'))[_0x293b('0xf')](socket);function respondWithRpcPromise(_0x24ed6e,_0x45581d,_0x4eeec4){return new BPromise(function(_0x53ccf6,_0x5bf0d8){return client['request'](_0x24ed6e,_0x4eeec4)[_0x293b('0x10')](function(_0x5e44b2){logger[_0x293b('0x11')](_0x293b('0x12'),_0x45581d,_0x293b('0x13'));logger[_0x293b('0x14')](_0x293b('0x15'),_0x45581d,_0x293b('0x13'),JSON[_0x293b('0x16')](_0x5e44b2));if(_0x5e44b2[_0x293b('0x17')]){if(_0x5e44b2[_0x293b('0x17')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x45581d,_0x5e44b2[_0x293b('0x17')][_0x293b('0x18')]);return _0x5bf0d8(_0x5e44b2[_0x293b('0x17')][_0x293b('0x18')]);}logger[_0x293b('0x17')](_0x293b('0x12'),_0x45581d,_0x5e44b2[_0x293b('0x17')]['message']);return _0x53ccf6(_0x5e44b2['error'][_0x293b('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x45581d,'request\x20sent');_0x53ccf6(_0x5e44b2['result'][_0x293b('0x18')]);}})[_0x293b('0x19')](function(_0x2cfadb){logger[_0x293b('0x17')](_0x293b('0x12'),_0x45581d,_0x2cfadb);_0x5bf0d8(_0x2cfadb);});});}exports[_0x293b('0x1a')]=function(_0x488fe6){var _0x42e79e=this;return new Promise(function(_0x5f58cd,_0xa4a7bf){return db[_0x293b('0x1b')]['create'](_0x488fe6['body'],{'raw':_0x488fe6['options']?_0x488fe6[_0x293b('0x1c')][_0x293b('0x1d')]===undefined?!![]:![]:!![]})[_0x293b('0x10')](function(_0x1dbad8){logger[_0x293b('0x11')](_0x293b('0x1a'),_0x488fe6);logger[_0x293b('0x14')](_0x293b('0x1a'),_0x488fe6,JSON[_0x293b('0x16')](_0x1dbad8));_0x5f58cd(_0x1dbad8);})[_0x293b('0x19')](function(_0x55d8c1){logger[_0x293b('0x17')](_0x293b('0x1a'),_0x55d8c1[_0x293b('0x18')],_0x488fe6);_0xa4a7bf(_0x42e79e[_0x293b('0x17')](0x1f4,_0x55d8c1[_0x293b('0x18')]));});});}; \ No newline at end of file +var _0x6eba=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','moment','bluebird','randomstring'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6eba,0xc2));var _0xa6eb=function(_0x5bddb9,_0x25473c){_0x5bddb9=_0x5bddb9-0x0;var _0x5a78c5=_0x6eba[_0x5bddb9];return _0x5a78c5;};'use strict';var _=require(_0xa6eb('0x0'));var util=require('util');var moment=require(_0xa6eb('0x1'));var BPromise=require(_0xa6eb('0x2'));var rs=require(_0xa6eb('0x3'));var fs=require('fs');var Redis=require(_0xa6eb('0x4'));var db=require(_0xa6eb('0x5'))['db'];var utils=require(_0xa6eb('0x6'));var logger=require(_0xa6eb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6eb('0x8'));var client=jayson[_0xa6eb('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa6eb('0xa')](config[_0xa6eb('0xb')],{'host':_0xa6eb('0xc'),'port':0x18eb});var socket=require(_0xa6eb('0xd'))(new Redis(config[_0xa6eb('0xb')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x57801f,_0x433e8f,_0x5536a2){return new BPromise(function(_0x166476,_0x50ef23){return client[_0xa6eb('0xe')](_0x57801f,_0x5536a2)[_0xa6eb('0xf')](function(_0x334172){logger[_0xa6eb('0x10')](_0xa6eb('0x11'),_0x433e8f,_0xa6eb('0x12'));logger[_0xa6eb('0x13')](_0xa6eb('0x14'),_0x433e8f,_0xa6eb('0x12'),JSON[_0xa6eb('0x15')](_0x334172));if(_0x334172['error']){if(_0x334172['error'][_0xa6eb('0x16')]===0x1f4){logger['error'](_0xa6eb('0x11'),_0x433e8f,_0x334172[_0xa6eb('0x17')][_0xa6eb('0x18')]);return _0x50ef23(_0x334172['error'][_0xa6eb('0x18')]);}logger[_0xa6eb('0x17')](_0xa6eb('0x11'),_0x433e8f,_0x334172[_0xa6eb('0x17')][_0xa6eb('0x18')]);return _0x166476(_0x334172[_0xa6eb('0x17')][_0xa6eb('0x18')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x433e8f,_0xa6eb('0x12'));_0x166476(_0x334172[_0xa6eb('0x19')][_0xa6eb('0x18')]);}})[_0xa6eb('0x1a')](function(_0x254f39){logger[_0xa6eb('0x17')](_0xa6eb('0x11'),_0x433e8f,_0x254f39);_0x50ef23(_0x254f39);});});}exports[_0xa6eb('0x1b')]=function(_0x2ed967){var _0x5e047a=this;return new Promise(function(_0x1e6681,_0x2ebc75){return db[_0xa6eb('0x1c')][_0xa6eb('0x1d')](_0x2ed967[_0xa6eb('0x1e')],{'raw':_0x2ed967[_0xa6eb('0x1f')]?_0x2ed967[_0xa6eb('0x1f')][_0xa6eb('0x20')]===undefined?!![]:![]:!![]})[_0xa6eb('0xf')](function(_0x222663){logger[_0xa6eb('0x10')](_0xa6eb('0x1b'),_0x2ed967);logger[_0xa6eb('0x13')](_0xa6eb('0x1b'),_0x2ed967,JSON['stringify'](_0x222663));_0x1e6681(_0x222663);})[_0xa6eb('0x1a')](function(_0x123045){logger['error']('CreateChatMessage',_0x123045['message'],_0x2ed967);_0x2ebc75(_0x5e047a['error'](0x1f4,_0x123045[_0xa6eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index b3ee39c..1c9c53b 100644 --- a/server/api/chatMessage/chatMessage.socket.js +++ b/server/api/chatMessage/chatMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f2e=['emit','length','save','remove'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2f2e,0x146));var _0xe2f2=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x2f2e[_0x366e99];return _0x180bbe;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xe2f2('0x0'),_0xe2f2('0x1'),'update'];function createListener(_0xc8150e,_0x5c1823){return function(_0x1d89ba){_0x5c1823[_0xe2f2('0x2')](_0xc8150e,_0x1d89ba);};}function removeListener(_0x2da048,_0x14543c){return function(){ChatMessageEvents['removeListener'](_0x2da048,_0x14543c);};}exports['register']=function(_0x5b202f){for(var _0x3dca30=0x0,_0x23f7a8=events[_0xe2f2('0x3')];_0x3dca30<_0x23f7a8;_0x3dca30++){var _0xc44c89=events[_0x3dca30];var _0x48111c=createListener('chatMessage:'+_0xc44c89,_0x5b202f);ChatMessageEvents['on'](_0xc44c89,_0x48111c);}}; \ No newline at end of file +var _0xb458=['length','./chatMessage.events','save','remove','emit','removeListener'];(function(_0x341a7b,_0x5491f7){var _0x586844=function(_0x5c88ad){while(--_0x5c88ad){_0x341a7b['push'](_0x341a7b['shift']());}};_0x586844(++_0x5491f7);}(_0xb458,0x103));var _0x8b45=function(_0x4f6098,_0x5538bb){_0x4f6098=_0x4f6098-0x0;var _0x1e2eda=_0xb458[_0x4f6098];return _0x1e2eda;};'use strict';var ChatMessageEvents=require(_0x8b45('0x0'));var events=[_0x8b45('0x1'),_0x8b45('0x2'),'update'];function createListener(_0x58a508,_0xdf89d4){return function(_0x93d9cd){_0xdf89d4[_0x8b45('0x3')](_0x58a508,_0x93d9cd);};}function removeListener(_0x13a8c6,_0x5d51e4){return function(){ChatMessageEvents[_0x8b45('0x4')](_0x13a8c6,_0x5d51e4);};}exports['register']=function(_0x5cc2d5){for(var _0xe8d774=0x0,_0x12bd05=events[_0x8b45('0x5')];_0xe8d774<_0x12bd05;_0xe8d774++){var _0x3a8ccb=events[_0xe8d774];var _0x32342f=createListener('chatMessage:'+_0x3a8ccb,_0x5cc2d5);ChatMessageEvents['on'](_0x3a8ccb,_0x32342f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index bca3ed5..48dbb2f 100644 --- a/server/api/chatMessage/index.js +++ b/server/api/chatMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c13=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','chat','chatmessage:create','put','accept','reject','delete','exports','multer'];(function(_0x2f4462,_0x2c6499){var _0x41c315=function(_0x4b1d53){while(--_0x4b1d53){_0x2f4462['push'](_0x2f4462['shift']());}};_0x41c315(++_0x2c6499);}(_0x1c13,0xef));var _0x31c1=function(_0x37e233,_0x483494){_0x37e233=_0x37e233-0x0;var _0x26a59f=_0x1c13[_0x37e233];return _0x26a59f;};'use strict';var multer=require(_0x31c1('0x0'));var util=require(_0x31c1('0x1'));var path=require(_0x31c1('0x2'));var timeout=require(_0x31c1('0x3'));var express=require(_0x31c1('0x4'));var router=express[_0x31c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x31c1('0x6'));var interaction=require(_0x31c1('0x7'));var config=require('../../config/environment');var controller=require(_0x31c1('0x8'));router['get']('/',auth[_0x31c1('0x9')](),controller[_0x31c1('0xa')]);router[_0x31c1('0xb')](_0x31c1('0xc'),auth[_0x31c1('0x9')](),controller['describe']);router[_0x31c1('0xb')](_0x31c1('0xd'),auth[_0x31c1('0x9')](),controller[_0x31c1('0xe')]);router[_0x31c1('0xf')]('/',auth[_0x31c1('0x9')](),interaction[_0x31c1('0x10')](_0x31c1('0x11'),_0x31c1('0x12')),controller['create']);router[_0x31c1('0x13')]('/:id',controller['update']);router[_0x31c1('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x31c1('0x14')]);router[_0x31c1('0x13')]('/:id/reject',auth[_0x31c1('0x9')](),controller[_0x31c1('0x15')]);router[_0x31c1('0x16')](_0x31c1('0xd'),auth[_0x31c1('0x9')](),controller['destroy']);module[_0x31c1('0x17')]=router; \ No newline at end of file +var _0xaeba=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util'];(function(_0x3d6b63,_0x34f871){var _0x406bfd=function(_0x3455e5){while(--_0x3455e5){_0x3d6b63['push'](_0x3d6b63['shift']());}};_0x406bfd(++_0x34f871);}(_0xaeba,0xe8));var _0xaaeb=function(_0x313be5,_0x355592){_0x313be5=_0x313be5-0x0;var _0xf6362=_0xaeba[_0x313be5];return _0xf6362;};'use strict';var multer=require(_0xaaeb('0x0'));var util=require(_0xaaeb('0x1'));var path=require(_0xaaeb('0x2'));var timeout=require(_0xaaeb('0x3'));var express=require(_0xaaeb('0x4'));var router=express[_0xaaeb('0x5')]();var fs_extra=require(_0xaaeb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaaeb('0x7'));var config=require(_0xaaeb('0x8'));var controller=require('./chatMessage.controller');router[_0xaaeb('0x9')]('/',auth[_0xaaeb('0xa')](),controller['index']);router[_0xaaeb('0x9')]('/describe',auth[_0xaaeb('0xa')](),controller[_0xaaeb('0xb')]);router[_0xaaeb('0x9')](_0xaaeb('0xc'),auth[_0xaaeb('0xa')](),controller[_0xaaeb('0xd')]);router[_0xaaeb('0xe')]('/',auth[_0xaaeb('0xa')](),interaction[_0xaaeb('0xf')](_0xaaeb('0x10'),_0xaaeb('0x11')),controller[_0xaaeb('0x12')]);router['put'](_0xaaeb('0xc'),controller['update']);router[_0xaaeb('0x13')](_0xaaeb('0x14'),auth[_0xaaeb('0xa')](),controller[_0xaaeb('0x15')]);router['put'](_0xaaeb('0x16'),auth[_0xaaeb('0xa')](),controller[_0xaaeb('0x17')]);router[_0xaaeb('0x18')](_0xaaeb('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xaaeb('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ac87ddc..0e8177d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x0b0e[_0x478414];return _0x5eb6b9;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x499a83,_0x37c096){var _0x3a2780=function(_0x59d10e){while(--_0x59d10e){_0x499a83['push'](_0x499a83['shift']());}};_0x3a2780(++_0x37c096);}(_0xadb5,0xad));var _0x5adb=function(_0x9e2316,_0x15e5b3){_0x9e2316=_0x9e2316-0x0;var _0x4c1bdc=_0xadb5[_0x9e2316];return _0x4c1bdc;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 35847a0..49c3668 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x26368d,_0x51d04d){var _0x336739=function(_0x1eed79){while(--_0x1eed79){_0x26368d['push'](_0x26368d['shift']());}};_0x336739(++_0x51d04d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x7a54,0x106));var _0x47a5=function(_0x44fde5,_0x1f3343){_0x44fde5=_0x44fde5-0x0;var _0x3cf510=_0x7a54[_0x44fde5];return _0x3cf510;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index b0d7254..4564a7e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc039=['emit','hasOwnProperty','exports','../../mysqldb','remove'];(function(_0x54e5b0,_0x2a0cde){var _0x32761f=function(_0x24011f){while(--_0x24011f){_0x54e5b0['push'](_0x54e5b0['shift']());}};_0x32761f(++_0x2a0cde);}(_0xc039,0x19d));var _0x9c03=function(_0xcef73f,_0x595c46){_0xcef73f=_0xcef73f-0x0;var _0x36f839=_0xc039[_0xcef73f];return _0x36f839;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9c03('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c03('0x1')};function emitEvent(_0x2e6d2f){return function(_0x104bbd,_0xfd5178,_0x30d60d){ChatOfflineMessageEvents['emit'](_0x2e6d2f+':'+_0x104bbd['id'],_0x104bbd);ChatOfflineMessageEvents[_0x9c03('0x2')](_0x2e6d2f,_0x104bbd);_0x30d60d(null);};}for(var e in events){if(events[_0x9c03('0x3')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x9c03('0x4')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xb613=['../../mysqldb','ChatOfflineMessage','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2859f2,_0x1e3102){var _0x4974cd=function(_0x13ec65){while(--_0x13ec65){_0x2859f2['push'](_0x2859f2['shift']());}};_0x4974cd(++_0x1e3102);}(_0xb613,0x1b8));var _0x3b61=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xb613[_0x4a7843];return _0x2c57fe;};'use strict';var EventEmitter=require(_0x3b61('0x0'));var ChatOfflineMessage=require(_0x3b61('0x1'))['db'][_0x3b61('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b61('0x3'),'afterUpdate':'update','afterDestroy':_0x3b61('0x4')};function emitEvent(_0x58222c){return function(_0x27bacf,_0xa4373a,_0xa494af){ChatOfflineMessageEvents[_0x3b61('0x5')](_0x58222c+':'+_0x27bacf['id'],_0x27bacf);ChatOfflineMessageEvents[_0x3b61('0x5')](_0x58222c,_0x27bacf);_0xa494af(null);};}for(var e in events){if(events[_0x3b61('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x3b61('0x7')](e,emitEvent(event));}}module[_0x3b61('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9ac1ae9..a9bdf8a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.model.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81ea=['exports','define','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x81ea,0x1b2));var _0xa81e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x81ea[_0xa464c9];return _0x3d73c4;};'use strict';var attributes=require(_0xa81e('0x0'));module[_0xa81e('0x1')]=function(_0x28a799){return _0x28a799[_0xa81e('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xa81e('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa81e('0x4')});}; \ No newline at end of file +var _0x4e6d=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x375557,_0x445ec2){var _0x311354=function(_0x1b493e){while(--_0x1b493e){_0x375557['push'](_0x375557['shift']());}};_0x311354(++_0x445ec2);}(_0x4e6d,0x154));var _0xd4e6=function(_0x47c39d,_0x3eea90){_0x47c39d=_0x47c39d-0x0;var _0xd41416=_0x4e6d[_0x47c39d];return _0xd41416;};'use strict';var attributes=require(_0xd4e6('0x0'));module[_0xd4e6('0x1')]=function(_0x597ef2){return _0x597ef2[_0xd4e6('0x2')](_0xd4e6('0x3'),attributes,{'tableName':_0xd4e6('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4e6('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7350f02..8482972 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66dd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x45c572,_0x34ac34){var _0x53888f=function(_0x2988b2){while(--_0x2988b2){_0x45c572['push'](_0x45c572['shift']());}};_0x53888f(++_0x34ac34);}(_0x66dd,0xb8));var _0xd66d=function(_0x1c3fbd,_0x2a5a2d){_0x1c3fbd=_0x1c3fbd-0x0;var _0x2082ec=_0x66dd[_0x1c3fbd];return _0x2082ec;};'use strict';var _=require('lodash');var util=require(_0xd66d('0x0'));var moment=require(_0xd66d('0x1'));var BPromise=require(_0xd66d('0x2'));var rs=require(_0xd66d('0x3'));var fs=require('fs');var Redis=require(_0xd66d('0x4'));var db=require(_0xd66d('0x5'))['db'];var utils=require(_0xd66d('0x6'));var logger=require('../../config/logger')(_0xd66d('0x7'));var config=require(_0xd66d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd66d('0x9')][_0xd66d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40432c,_0x1bfd1c,_0x5c631c){return new BPromise(function(_0x4d2723,_0x174b22){return client[_0xd66d('0xb')](_0x40432c,_0x5c631c)[_0xd66d('0xc')](function(_0x5b5651){logger[_0xd66d('0xd')](_0xd66d('0xe'),_0x1bfd1c,'request\x20sent');logger[_0xd66d('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1bfd1c,_0xd66d('0x10'),JSON[_0xd66d('0x11')](_0x5b5651));if(_0x5b5651[_0xd66d('0x12')]){if(_0x5b5651[_0xd66d('0x12')][_0xd66d('0x13')]===0x1f4){logger[_0xd66d('0x12')](_0xd66d('0xe'),_0x1bfd1c,_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);return _0x174b22(_0x5b5651['error'][_0xd66d('0x14')]);}logger['error'](_0xd66d('0xe'),_0x1bfd1c,_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);return _0x4d2723(_0x5b5651[_0xd66d('0x12')][_0xd66d('0x14')]);}else{logger[_0xd66d('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1bfd1c,_0xd66d('0x10'));_0x4d2723(_0x5b5651[_0xd66d('0x15')][_0xd66d('0x14')]);}})[_0xd66d('0x16')](function(_0x3ea3f7){logger['error'](_0xd66d('0xe'),_0x1bfd1c,_0x3ea3f7);_0x174b22(_0x3ea3f7);});});} \ No newline at end of file +var _0xe51b=['jayson/promise','client','request','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2d143a,_0x20bae0){var _0x5a1303=function(_0x88da8c){while(--_0x88da8c){_0x2d143a['push'](_0x2d143a['shift']());}};_0x5a1303(++_0x20bae0);}(_0xe51b,0x92));var _0xbe51=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xe51b[_0x51639a];return _0x3abae4;};'use strict';var _=require(_0xbe51('0x0'));var util=require(_0xbe51('0x1'));var moment=require('moment');var BPromise=require(_0xbe51('0x2'));var rs=require(_0xbe51('0x3'));var fs=require('fs');var Redis=require(_0xbe51('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe51('0x5'));var logger=require(_0xbe51('0x6'))(_0xbe51('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe51('0x8'));var client=jayson[_0xbe51('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fb3c1,_0x50ddf6,_0x4b2308){return new BPromise(function(_0x10ad9c,_0x5d5373){return client[_0xbe51('0xa')](_0x1fb3c1,_0x4b2308)['then'](function(_0x2554f9){logger[_0xbe51('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50ddf6,'request\x20sent');logger[_0xbe51('0xc')](_0xbe51('0xd'),_0x50ddf6,_0xbe51('0xe'),JSON[_0xbe51('0xf')](_0x2554f9));if(_0x2554f9[_0xbe51('0x10')]){if(_0x2554f9[_0xbe51('0x10')][_0xbe51('0x11')]===0x1f4){logger[_0xbe51('0x10')](_0xbe51('0x12'),_0x50ddf6,_0x2554f9[_0xbe51('0x10')][_0xbe51('0x13')]);return _0x5d5373(_0x2554f9[_0xbe51('0x10')][_0xbe51('0x13')]);}logger[_0xbe51('0x10')](_0xbe51('0x12'),_0x50ddf6,_0x2554f9[_0xbe51('0x10')][_0xbe51('0x13')]);return _0x10ad9c(_0x2554f9[_0xbe51('0x10')][_0xbe51('0x13')]);}else{logger[_0xbe51('0xb')](_0xbe51('0x12'),_0x50ddf6,_0xbe51('0xe'));_0x10ad9c(_0x2554f9[_0xbe51('0x14')]['message']);}})[_0xbe51('0x15')](function(_0x2d2ba6){logger[_0xbe51('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50ddf6,_0x2d2ba6);_0x5d5373(_0x2d2ba6);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3fa3310..c7df987 100644 --- a/server/api/chatOfflineMessage/index.js +++ b/server/api/chatOfflineMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71e3=['describe','/:id','show','create','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x71e3,0x150));var _0x371e=function(_0x4ebb6f,_0x49b0ee){_0x4ebb6f=_0x4ebb6f-0x0;var _0x552ccd=_0x71e3[_0x4ebb6f];return _0x552ccd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x371e('0x0'));var timeout=require(_0x371e('0x1'));var express=require(_0x371e('0x2'));var router=express[_0x371e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x371e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x371e('0x5'));router[_0x371e('0x6')]('/',auth[_0x371e('0x7')](),controller['index']);router[_0x371e('0x6')](_0x371e('0x8'),auth[_0x371e('0x7')](),controller[_0x371e('0x9')]);router['get'](_0x371e('0xa'),auth[_0x371e('0x7')](),controller[_0x371e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x371e('0xc')]);router['put']('/:id',auth[_0x371e('0x7')](),controller['update']);router[_0x371e('0xd')]('/:id',auth[_0x371e('0x7')](),controller['destroy']);module[_0x371e('0xe')]=router; \ No newline at end of file +var _0xd621=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete','exports'];(function(_0xeac104,_0x12515d){var _0x246d2f=function(_0x464687){while(--_0x464687){_0xeac104['push'](_0xeac104['shift']());}};_0x246d2f(++_0x12515d);}(_0xd621,0x1ee));var _0x1d62=function(_0x5743e3,_0x4a2aab){_0x5743e3=_0x5743e3-0x0;var _0x24d100=_0xd621[_0x5743e3];return _0x24d100;};'use strict';var multer=require(_0x1d62('0x0'));var util=require('util');var path=require(_0x1d62('0x1'));var timeout=require(_0x1d62('0x2'));var express=require(_0x1d62('0x3'));var router=express[_0x1d62('0x4')]();var fs_extra=require(_0x1d62('0x5'));var auth=require(_0x1d62('0x6'));var interaction=require(_0x1d62('0x7'));var config=require('../../config/environment');var controller=require(_0x1d62('0x8'));router[_0x1d62('0x9')]('/',auth[_0x1d62('0xa')](),controller[_0x1d62('0xb')]);router[_0x1d62('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1d62('0xc')]);router[_0x1d62('0x9')](_0x1d62('0xd'),auth[_0x1d62('0xa')](),controller[_0x1d62('0xe')]);router[_0x1d62('0xf')]('/',auth[_0x1d62('0xa')](),controller[_0x1d62('0x10')]);router['put'](_0x1d62('0xd'),auth[_0x1d62('0xa')](),controller['update']);router[_0x1d62('0x11')]('/:id',auth[_0x1d62('0xa')](),controller['destroy']);module[_0x1d62('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 0a7c17c..d607965 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa569=['exports','STRING','ENUM','mouseOver','timeout','sequelize'];(function(_0x589bad,_0x391d31){var _0x2fea56=function(_0x9aafbe){while(--_0x9aafbe){_0x589bad['push'](_0x589bad['shift']());}};_0x2fea56(++_0x391d31);}(_0xa569,0x137));var _0x9a56=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0xa569[_0x4314d7];return _0x5c599b;};'use strict';var Sequelize=require(_0x9a56('0x0'));module[_0x9a56('0x1')]={'name':{'type':Sequelize[_0x9a56('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a56('0x3')](_0x9a56('0x4'),_0x9a56('0x5')),'defaultValue':_0x9a56('0x4')},'selector':{'type':Sequelize[_0x9a56('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xa734=['INTEGER','sequelize','exports','ENUM','mouseOver','timeout','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa734,0xb0));var _0x4a73=function(_0x2a8926,_0x3706be){_0x2a8926=_0x2a8926-0x0;var _0x483866=_0xa734[_0x2a8926];return _0x483866;};'use strict';var Sequelize=require(_0x4a73('0x0'));module[_0x4a73('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4a73('0x2')](_0x4a73('0x3'),_0x4a73('0x4')),'defaultValue':_0x4a73('0x3')},'selector':{'type':Sequelize[_0x4a73('0x5')]},'timeout':{'type':Sequelize[_0x4a73('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1bb2474..72cee99 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1af5=['destroy','sendStatus','error','stack','name','send','params','model','ChatProactiveAction','keys','query','filters','intersection','attributes','includeAll','options','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x1af5,0x17d));var _0x51af=function(_0x18c5a5,_0x526d6f){_0x18c5a5=_0x18c5a5-0x0;var _0x8be903=_0x1af5[_0x18c5a5];return _0x8be903;};'use strict';var emlformat=require(_0x51af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51af('0x1'));var jsonpatch=require(_0x51af('0x2'));var rp=require(_0x51af('0x3'));var moment=require(_0x51af('0x4'));var BPromise=require(_0x51af('0x5'));var Mustache=require(_0x51af('0x6'));var util=require(_0x51af('0x7'));var path=require(_0x51af('0x8'));var sox=require(_0x51af('0x9'));var csv=require(_0x51af('0xa'));var ejs=require(_0x51af('0xb'));var fs=require('fs');var fs_extra=require(_0x51af('0xc'));var _=require(_0x51af('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51af('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x51af('0xa'));var querystring=require(_0x51af('0xf'));var Papa=require(_0x51af('0x10'));var Redis=require(_0x51af('0x11'));var authService=require(_0x51af('0x12'));var qs=require(_0x51af('0x13'));var as=require(_0x51af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51af('0x15'))(_0x51af('0x16'));var utils=require(_0x51af('0x17'));var config=require(_0x51af('0x18'));var licenseUtil=require(_0x51af('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeb29b4,_0x50b48d){_0x50b48d=_0x50b48d||0xcc;return function(_0x24eca2){if(_0x24eca2){return _0xeb29b4['sendStatus'](_0x50b48d);}return _0xeb29b4[_0x51af('0x1a')](_0x50b48d)[_0x51af('0x1b')]();};}function respondWithResult(_0x85a6ba,_0x5d5d40){_0x5d5d40=_0x5d5d40||0xc8;return function(_0x432a5d){if(_0x432a5d){return _0x85a6ba[_0x51af('0x1a')](_0x5d5d40)[_0x51af('0x1c')](_0x432a5d);}};}function respondWithFilteredResult(_0x3a5414,_0x51f544){return function(_0x32ea74){if(_0x32ea74){var _0x255e7e=typeof _0x51f544[_0x51af('0x1d')]==='undefined'&&typeof _0x51f544['limit']===_0x51af('0x1e');var _0x1f1592=_0x32ea74[_0x51af('0x1f')];var _0x5ecc27=_0x255e7e?0x0:_0x51f544[_0x51af('0x1d')];var _0x1b86f0=_0x255e7e?_0x32ea74[_0x51af('0x1f')]:_0x51f544[_0x51af('0x1d')]+_0x51f544[_0x51af('0x20')];var _0x23d8df;if(_0x1b86f0>=_0x1f1592){_0x1b86f0=_0x1f1592;_0x23d8df=0xc8;}else{_0x23d8df=0xce;}_0x3a5414[_0x51af('0x1a')](_0x23d8df);return _0x3a5414[_0x51af('0x21')](_0x51af('0x22'),_0x5ecc27+'-'+_0x1b86f0+'/'+_0x1f1592)['json'](_0x32ea74);}return null;};}function patchUpdates(_0x530861){return function(_0x733b3b){try{jsonpatch[_0x51af('0x23')](_0x733b3b,_0x530861,!![]);}catch(_0x233e9e){return BPromise[_0x51af('0x24')](_0x233e9e);}return _0x733b3b[_0x51af('0x25')]();};}function saveUpdates(_0x4962a9,_0x31f4c0){return function(_0x5a7360){if(_0x5a7360){return _0x5a7360['update'](_0x4962a9)[_0x51af('0x26')](function(_0x58f227){return _0x58f227;});}return null;};}function removeEntity(_0x81d1b1,_0x5efc62){return function(_0x5e47d3){if(_0x5e47d3){return _0x5e47d3[_0x51af('0x27')]()['then'](function(){_0x81d1b1['status'](0xcc)[_0x51af('0x1b')]();});}};}function handleEntityNotFound(_0x4e771f,_0x3f725a){return function(_0x152ebd){if(!_0x152ebd){_0x4e771f[_0x51af('0x28')](0x194);}return _0x152ebd;};}function handleError(_0x2de497,_0x4d81f9){_0x4d81f9=_0x4d81f9||0x1f4;return function(_0x1320a8){logger[_0x51af('0x29')](_0x1320a8[_0x51af('0x2a')]);if(_0x1320a8[_0x51af('0x2b')]){delete _0x1320a8[_0x51af('0x2b')];}_0x2de497[_0x51af('0x1a')](_0x4d81f9)[_0x51af('0x2c')](_0x1320a8);};}exports['show']=function(_0x203d49,_0x1ba74d){var _0x3eb45c={'raw':!![],'where':{'id':_0x203d49[_0x51af('0x2d')]['id']}},_0x31891e={};_0x31891e[_0x51af('0x2e')]=_['keys'](db[_0x51af('0x2f')]['rawAttributes']);_0x31891e['query']=_[_0x51af('0x30')](_0x203d49[_0x51af('0x31')]);_0x31891e[_0x51af('0x32')]=_[_0x51af('0x33')](_0x31891e[_0x51af('0x2e')],_0x31891e[_0x51af('0x31')]);_0x3eb45c['attributes']=_[_0x51af('0x33')](_0x31891e['model'],qs['fields'](_0x203d49[_0x51af('0x31')]['fields']));_0x3eb45c['attributes']=_0x3eb45c['attributes']['length']?_0x3eb45c[_0x51af('0x34')]:_0x31891e[_0x51af('0x2e')];if(_0x203d49[_0x51af('0x31')][_0x51af('0x35')]){_0x3eb45c['include']=[{'all':!![]}];}_0x3eb45c=_['merge']({},_0x3eb45c,_0x203d49[_0x51af('0x36')]);return db[_0x51af('0x2f')][_0x51af('0x37')](_0x3eb45c)[_0x51af('0x26')](handleEntityNotFound(_0x1ba74d,null))[_0x51af('0x26')](respondWithResult(_0x1ba74d,null))[_0x51af('0x38')](handleError(_0x1ba74d,null));};exports[_0x51af('0x39')]=function(_0x57cfb7,_0xf7b110){return db[_0x51af('0x2f')][_0x51af('0x39')](_0x57cfb7[_0x51af('0x3a')],{})['then'](respondWithResult(_0xf7b110,0xc9))[_0x51af('0x38')](handleError(_0xf7b110,null));};exports[_0x51af('0x3b')]=function(_0x4c3596,_0x1c0432){if(_0x4c3596[_0x51af('0x3a')]['id']){delete _0x4c3596[_0x51af('0x3a')]['id'];}return db[_0x51af('0x2f')][_0x51af('0x37')]({'where':{'id':_0x4c3596[_0x51af('0x2d')]['id']}})[_0x51af('0x26')](handleEntityNotFound(_0x1c0432,null))[_0x51af('0x26')](saveUpdates(_0x4c3596[_0x51af('0x3a')],null))[_0x51af('0x26')](respondWithResult(_0x1c0432,null))[_0x51af('0x38')](handleError(_0x1c0432,null));};exports[_0x51af('0x27')]=function(_0x4f160c,_0x43db83){return db[_0x51af('0x2f')][_0x51af('0x37')]({'where':{'id':_0x4f160c[_0x51af('0x2d')]['id']}})[_0x51af('0x26')](handleEntityNotFound(_0x43db83,null))[_0x51af('0x26')](removeEntity(_0x43db83,null))['catch'](handleError(_0x43db83,null));}; \ No newline at end of file +var _0x562d=['status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','show','model','keys','rawAttributes','query','intersection','fields','length','attributes','includeAll','include','merge','options','find','then','catch','create','ChatProactiveAction','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x2fbff8,_0x37a62f){var _0x415445=function(_0x415b43){while(--_0x415b43){_0x2fbff8['push'](_0x2fbff8['shift']());}};_0x415445(++_0x37a62f);}(_0x562d,0xe1));var _0xd562=function(_0x569998,_0x361b8d){_0x569998=_0x569998-0x0;var _0x2f8256=_0x562d[_0x569998];return _0x2f8256;};'use strict';var emlformat=require(_0xd562('0x0'));var rimraf=require(_0xd562('0x1'));var zipdir=require(_0xd562('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd562('0x3'));var BPromise=require(_0xd562('0x4'));var Mustache=require(_0xd562('0x5'));var util=require('util');var path=require(_0xd562('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd562('0x7'));var fs=require('fs');var fs_extra=require(_0xd562('0x8'));var _=require(_0xd562('0x9'));var squel=require(_0xd562('0xa'));var crypto=require(_0xd562('0xb'));var jsforce=require(_0xd562('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd562('0xd'));var querystring=require('querystring');var Papa=require(_0xd562('0xe'));var Redis=require(_0xd562('0xf'));var authService=require(_0xd562('0x10'));var qs=require(_0xd562('0x11'));var as=require(_0xd562('0x12'));var hardwareService=require(_0xd562('0x13'));var logger=require(_0xd562('0x14'))(_0xd562('0x15'));var utils=require(_0xd562('0x16'));var config=require(_0xd562('0x17'));var licenseUtil=require(_0xd562('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452feb,_0x4a824b){_0x4a824b=_0x4a824b||0xcc;return function(_0x4bff34){if(_0x4bff34){return _0x452feb[_0xd562('0x19')](_0x4a824b);}return _0x452feb['status'](_0x4a824b)[_0xd562('0x1a')]();};}function respondWithResult(_0x5905b2,_0x55a067){_0x55a067=_0x55a067||0xc8;return function(_0x1132d2){if(_0x1132d2){return _0x5905b2[_0xd562('0x1b')](_0x55a067)[_0xd562('0x1c')](_0x1132d2);}};}function respondWithFilteredResult(_0x261b3f,_0x28e0a1){return function(_0x4e358e){if(_0x4e358e){var _0x432903=typeof _0x28e0a1[_0xd562('0x1d')]==='undefined'&&typeof _0x28e0a1[_0xd562('0x1e')]===_0xd562('0x1f');var _0x4a1e67=_0x4e358e[_0xd562('0x20')];var _0xa1211b=_0x432903?0x0:_0x28e0a1[_0xd562('0x1d')];var _0x207dc4=_0x432903?_0x4e358e[_0xd562('0x20')]:_0x28e0a1[_0xd562('0x1d')]+_0x28e0a1[_0xd562('0x1e')];var _0x14c8e8;if(_0x207dc4>=_0x4a1e67){_0x207dc4=_0x4a1e67;_0x14c8e8=0xc8;}else{_0x14c8e8=0xce;}_0x261b3f[_0xd562('0x1b')](_0x14c8e8);return _0x261b3f[_0xd562('0x21')](_0xd562('0x22'),_0xa1211b+'-'+_0x207dc4+'/'+_0x4a1e67)['json'](_0x4e358e);}return null;};}function patchUpdates(_0x4e0af7){return function(_0x3bdf1a){try{jsonpatch['apply'](_0x3bdf1a,_0x4e0af7,!![]);}catch(_0xf82a08){return BPromise[_0xd562('0x23')](_0xf82a08);}return _0x3bdf1a[_0xd562('0x24')]();};}function saveUpdates(_0x276234,_0x59cf51){return function(_0x492f37){if(_0x492f37){return _0x492f37[_0xd562('0x25')](_0x276234)['then'](function(_0x45adc8){return _0x45adc8;});}return null;};}function removeEntity(_0x5f7f6,_0x189a5c){return function(_0x70c0ea){if(_0x70c0ea){return _0x70c0ea[_0xd562('0x26')]()['then'](function(){_0x5f7f6[_0xd562('0x1b')](0xcc)[_0xd562('0x1a')]();});}};}function handleEntityNotFound(_0x3d3f83,_0x42c8b1){return function(_0x18e33){if(!_0x18e33){_0x3d3f83[_0xd562('0x19')](0x194);}return _0x18e33;};}function handleError(_0x572a0c,_0x5dffaa){_0x5dffaa=_0x5dffaa||0x1f4;return function(_0x490613){logger[_0xd562('0x27')](_0x490613[_0xd562('0x28')]);if(_0x490613['name']){delete _0x490613[_0xd562('0x29')];}_0x572a0c[_0xd562('0x1b')](_0x5dffaa)[_0xd562('0x2a')](_0x490613);};}exports[_0xd562('0x2b')]=function(_0xa6c8e7,_0x363746){var _0x28101f={'raw':!![],'where':{'id':_0xa6c8e7['params']['id']}},_0x20abcc={};_0x20abcc[_0xd562('0x2c')]=_[_0xd562('0x2d')](db['ChatProactiveAction'][_0xd562('0x2e')]);_0x20abcc[_0xd562('0x2f')]=_[_0xd562('0x2d')](_0xa6c8e7[_0xd562('0x2f')]);_0x20abcc['filters']=_[_0xd562('0x30')](_0x20abcc[_0xd562('0x2c')],_0x20abcc[_0xd562('0x2f')]);_0x28101f['attributes']=_[_0xd562('0x30')](_0x20abcc['model'],qs['fields'](_0xa6c8e7[_0xd562('0x2f')][_0xd562('0x31')]));_0x28101f['attributes']=_0x28101f['attributes'][_0xd562('0x32')]?_0x28101f[_0xd562('0x33')]:_0x20abcc['model'];if(_0xa6c8e7['query'][_0xd562('0x34')]){_0x28101f[_0xd562('0x35')]=[{'all':!![]}];}_0x28101f=_[_0xd562('0x36')]({},_0x28101f,_0xa6c8e7[_0xd562('0x37')]);return db['ChatProactiveAction'][_0xd562('0x38')](_0x28101f)[_0xd562('0x39')](handleEntityNotFound(_0x363746,null))['then'](respondWithResult(_0x363746,null))[_0xd562('0x3a')](handleError(_0x363746,null));};exports[_0xd562('0x3b')]=function(_0x1e406c,_0x594006){return db[_0xd562('0x3c')][_0xd562('0x3b')](_0x1e406c[_0xd562('0x3d')],{})['then'](respondWithResult(_0x594006,0xc9))[_0xd562('0x3a')](handleError(_0x594006,null));};exports[_0xd562('0x25')]=function(_0x5e6340,_0xecf0d0){if(_0x5e6340[_0xd562('0x3d')]['id']){delete _0x5e6340[_0xd562('0x3d')]['id'];}return db['ChatProactiveAction'][_0xd562('0x38')]({'where':{'id':_0x5e6340[_0xd562('0x3e')]['id']}})['then'](handleEntityNotFound(_0xecf0d0,null))['then'](saveUpdates(_0x5e6340['body'],null))[_0xd562('0x39')](respondWithResult(_0xecf0d0,null))['catch'](handleError(_0xecf0d0,null));};exports[_0xd562('0x26')]=function(_0x124a2a,_0x2b2839){return db[_0xd562('0x3c')][_0xd562('0x38')]({'where':{'id':_0x124a2a['params']['id']}})[_0xd562('0x39')](handleEntityNotFound(_0x2b2839,null))[_0xd562('0x39')](removeEntity(_0x2b2839,null))[_0xd562('0x3a')](handleError(_0x2b2839,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index c3e3017..f2ecac3 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.model.js +++ b/server/api/chatProactiveAction/chatProactiveAction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd004=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20918a,_0x5878e5){var _0x14843f=function(_0x28be32){while(--_0x28be32){_0x20918a['push'](_0x20918a['shift']());}};_0x14843f(++_0x5878e5);}(_0xd004,0xe4));var _0x4d00=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0xd004[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x4d00('0x0'));var util=require('util');var logger=require(_0x4d00('0x1'))(_0x4d00('0x2'));var moment=require(_0x4d00('0x3'));var BPromise=require(_0x4d00('0x4'));var rp=require(_0x4d00('0x5'));var fs=require('fs');var path=require(_0x4d00('0x6'));var rimraf=require(_0x4d00('0x7'));var config=require(_0x4d00('0x8'));var attributes=require(_0x4d00('0x9'));module[_0x4d00('0xa')]=function(_0x721021,_0x2e7a45){return _0x721021[_0x4d00('0xb')](_0x4d00('0xc'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dda=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dda,0x14b));var _0xa3dd=function(_0x22377a,_0x3397cb){_0x22377a=_0x22377a-0x0;var _0x36f105=_0x3dda[_0x22377a];return _0x36f105;};'use strict';var _=require(_0xa3dd('0x0'));var util=require(_0xa3dd('0x1'));var logger=require(_0xa3dd('0x2'))(_0xa3dd('0x3'));var moment=require(_0xa3dd('0x4'));var BPromise=require(_0xa3dd('0x5'));var rp=require(_0xa3dd('0x6'));var fs=require('fs');var path=require(_0xa3dd('0x7'));var rimraf=require(_0xa3dd('0x8'));var config=require(_0xa3dd('0x9'));var attributes=require(_0xa3dd('0xa'));module[_0xa3dd('0xb')]=function(_0x34a3f1,_0xe95ea1){return _0x34a3f1[_0xa3dd('0xc')](_0xa3dd('0xd'),attributes,{'tableName':_0xa3dd('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 1f51213..7492981 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.rpc.js +++ b/server/api/chatProactiveAction/chatProactiveAction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb9b=['then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request'];(function(_0x2ee1a0,_0x1dabe7){var _0x1ce546=function(_0x68e6dc){while(--_0x68e6dc){_0x2ee1a0['push'](_0x2ee1a0['shift']());}};_0x1ce546(++_0x1dabe7);}(_0xdb9b,0x15e));var _0xbdb9=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdb9b[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xbdb9('0x0'));var util=require(_0xbdb9('0x1'));var moment=require(_0xbdb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdb9('0x3'));var fs=require('fs');var Redis=require(_0xbdb9('0x4'));var db=require(_0xbdb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdb9('0x6'))(_0xbdb9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbdb9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9696,_0x630af3,_0x596580){return new BPromise(function(_0x2d9a43,_0x22ffba){return client[_0xbdb9('0x9')](_0x1f9696,_0x596580)[_0xbdb9('0xa')](function(_0x161d45){logger[_0xbdb9('0xb')](_0xbdb9('0xc'),_0x630af3,_0xbdb9('0xd'));logger[_0xbdb9('0xe')](_0xbdb9('0xf'),_0x630af3,_0xbdb9('0xd'),JSON['stringify'](_0x161d45));if(_0x161d45[_0xbdb9('0x10')]){if(_0x161d45[_0xbdb9('0x10')][_0xbdb9('0x11')]===0x1f4){logger[_0xbdb9('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x630af3,_0x161d45[_0xbdb9('0x10')][_0xbdb9('0x12')]);return _0x22ffba(_0x161d45['error']['message']);}logger[_0xbdb9('0x10')](_0xbdb9('0xc'),_0x630af3,_0x161d45[_0xbdb9('0x10')]['message']);return _0x2d9a43(_0x161d45[_0xbdb9('0x10')]['message']);}else{logger[_0xbdb9('0xb')](_0xbdb9('0xc'),_0x630af3,_0xbdb9('0xd'));_0x2d9a43(_0x161d45[_0xbdb9('0x13')][_0xbdb9('0x12')]);}})['catch'](function(_0x51c595){logger['error'](_0xbdb9('0xc'),_0x630af3,_0x51c595);_0x22ffba(_0x51c595);});});} \ No newline at end of file +var _0x7e54=['error','code','ChatProactiveAction,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x7e54,0x18b));var _0x47e5=function(_0x4123ab,_0x259d08){_0x4123ab=_0x4123ab-0x0;var _0x48ca1a=_0x7e54[_0x4123ab];return _0x48ca1a;};'use strict';var _=require(_0x47e5('0x0'));var util=require(_0x47e5('0x1'));var moment=require(_0x47e5('0x2'));var BPromise=require(_0x47e5('0x3'));var rs=require(_0x47e5('0x4'));var fs=require('fs');var Redis=require(_0x47e5('0x5'));var db=require(_0x47e5('0x6'))['db'];var utils=require(_0x47e5('0x7'));var logger=require(_0x47e5('0x8'))('rpc');var config=require(_0x47e5('0x9'));var jayson=require(_0x47e5('0xa'));var client=jayson[_0x47e5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f3765,_0x437e59,_0x361833){return new BPromise(function(_0x57ee0e,_0x2ed393){return client[_0x47e5('0xc')](_0x3f3765,_0x361833)[_0x47e5('0xd')](function(_0x181c3d){logger[_0x47e5('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x437e59,_0x47e5('0xf'));logger[_0x47e5('0x10')](_0x47e5('0x11'),_0x437e59,_0x47e5('0xf'),JSON[_0x47e5('0x12')](_0x181c3d));if(_0x181c3d[_0x47e5('0x13')]){if(_0x181c3d['error'][_0x47e5('0x14')]===0x1f4){logger['error'](_0x47e5('0x15'),_0x437e59,_0x181c3d[_0x47e5('0x13')]['message']);return _0x2ed393(_0x181c3d['error']['message']);}logger['error'](_0x47e5('0x15'),_0x437e59,_0x181c3d[_0x47e5('0x13')]['message']);return _0x57ee0e(_0x181c3d[_0x47e5('0x13')][_0x47e5('0x16')]);}else{logger['info'](_0x47e5('0x15'),_0x437e59,_0x47e5('0xf'));_0x57ee0e(_0x181c3d['result'][_0x47e5('0x16')]);}})['catch'](function(_0x47b0b3){logger['error'](_0x47e5('0x15'),_0x437e59,_0x47b0b3);_0x2ed393(_0x47b0b3);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index cec7af0..612bf02 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xcee193,_0x319b69){var _0x51c4be=function(_0x5f4874){while(--_0x5f4874){_0xcee193['push'](_0xcee193['shift']());}};_0x51c4be(++_0x319b69);}(_0xed1f,0x6a));var _0xfed1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xed1f[_0x616290];return _0x453879;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/',auth[_0xfed1('0xd')](),controller[_0xfed1('0x10')]);router['put'](_0xfed1('0xc'),auth[_0xfed1('0xd')](),controller['update']);router[_0xfed1('0x11')](_0xfed1('0xc'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xae24=['destroy','exports','multer','path','express','Router','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x279f6d,_0x122316){var _0x5874a5=function(_0x4823ae){while(--_0x4823ae){_0x279f6d['push'](_0x279f6d['shift']());}};_0x5874a5(++_0x122316);}(_0xae24,0x182));var _0x4ae2=function(_0x4d660b,_0x1a3887){_0x4d660b=_0x4d660b-0x0;var _0x2eec80=_0xae24[_0x4d660b];return _0x2eec80;};'use strict';var multer=require(_0x4ae2('0x0'));var util=require('util');var path=require(_0x4ae2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ae2('0x2'));var router=express[_0x4ae2('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ae2('0x4'));var config=require('../../config/environment');var controller=require(_0x4ae2('0x5'));router[_0x4ae2('0x6')](_0x4ae2('0x7'),auth[_0x4ae2('0x8')](),controller[_0x4ae2('0x9')]);router[_0x4ae2('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4ae2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x4ae2('0xc')]);router[_0x4ae2('0xd')]('/:id',auth[_0x4ae2('0x8')](),controller[_0x4ae2('0xe')]);module[_0x4ae2('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 72d9d80..8c76a69 100644 --- a/server/api/chatQueue/chatQueue.attributes.js +++ b/server/api/chatQueue/chatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05cb=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4500b6,_0x29d34f){var _0x4b957e=function(_0x58a82e){while(--_0x58a82e){_0x4500b6['push'](_0x4500b6['shift']());}};_0x4b957e(++_0x29d34f);}(_0x05cb,0x1b8));var _0xb05c=function(_0x4bc23e,_0x56939a){_0x4bc23e=_0x4bc23e-0x0;var _0x57dc64=_0x05cb[_0x4bc23e];return _0x57dc64;};'use strict';var Sequelize=require(_0xb05c('0x0'));module['exports']={'name':{'type':Sequelize[_0xb05c('0x1')],'unique':_0xb05c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb05c('0x1')]},'timeout':{'type':Sequelize[_0xb05c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb05c('0x4')](_0xb05c('0x5'),_0xb05c('0x6'),_0xb05c('0x7'))}}; \ No newline at end of file +var _0xc7f5=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','beepall'];(function(_0x4e085c,_0x1c8d6e){var _0x567cf1=function(_0x169e4b){while(--_0x169e4b){_0x4e085c['push'](_0x4e085c['shift']());}};_0x567cf1(++_0x1c8d6e);}(_0xc7f5,0x104));var _0x5c7f=function(_0x5ac83b,_0x418926){_0x5ac83b=_0x5ac83b-0x0;var _0x4251c9=_0xc7f5[_0x5ac83b];return _0x4251c9;};'use strict';var Sequelize=require(_0x5c7f('0x0'));module[_0x5c7f('0x1')]={'name':{'type':Sequelize[_0x5c7f('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5c7f('0x2')]},'timeout':{'type':Sequelize[_0x5c7f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c7f('0x4')]('rrmemory',_0x5c7f('0x5'),_0x5c7f('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index bc3d445..726152c 100644 --- a/server/api/chatQueue/chatQueue.controller.js +++ b/server/api/chatQueue/chatQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef58=['ChatQueue,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','update','destroy','then','UserProfileResource','stack','name','send','index','ChatQueue','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','filters','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','compact','addAgents','omit','spread','removeAgents','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1f9723,_0x5318d4){var _0x366986=function(_0x5b798e){while(--_0x5b798e){_0x1f9723['push'](_0x1f9723['shift']());}};_0x366986(++_0x5318d4);}(_0xef58,0x1ae));var _0x8ef5=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xef58[_0x10d670];return _0x20d6f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef5('0x0'));var zipdir=require(_0x8ef5('0x1'));var jsonpatch=require(_0x8ef5('0x2'));var rp=require('request-promise');var moment=require(_0x8ef5('0x3'));var BPromise=require(_0x8ef5('0x4'));var Mustache=require(_0x8ef5('0x5'));var util=require(_0x8ef5('0x6'));var path=require('path');var sox=require(_0x8ef5('0x7'));var csv=require(_0x8ef5('0x8'));var ejs=require(_0x8ef5('0x9'));var fs=require('fs');var fs_extra=require(_0x8ef5('0xa'));var _=require(_0x8ef5('0xb'));var squel=require(_0x8ef5('0xc'));var crypto=require('crypto');var jsforce=require(_0x8ef5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ef5('0xe'));var Redis=require(_0x8ef5('0xf'));var authService=require(_0x8ef5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8ef5('0x11'));var hardwareService=require(_0x8ef5('0x12'));var logger=require('../../config/logger')(_0x8ef5('0x13'));var utils=require(_0x8ef5('0x14'));var config=require(_0x8ef5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ef5('0x16'))['db'];config[_0x8ef5('0x17')]=_[_0x8ef5('0x18')](config[_0x8ef5('0x17')],{'host':_0x8ef5('0x19'),'port':0x18eb});var socket=require(_0x8ef5('0x1a'))(new Redis(config[_0x8ef5('0x17')]));require(_0x8ef5('0x1b'))[_0x8ef5('0x1c')](socket);var jayson=require(_0x8ef5('0x1d'));var client=jayson['client'][_0x8ef5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x45ded9,_0xbf4727,_0x308eb7,_0x1a59ab){return new BPromise(function(_0x315392,_0x894c40){var _0x2550ea=_0x1a59ab||client;return _0x2550ea[_0x8ef5('0x1f')](_0x45ded9,_0x308eb7)['then'](function(_0x8a4000){logger['info']('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x8ef5('0x20'));logger['debug'](_0x8ef5('0x21'),_0xbf4727,_0x8ef5('0x20'),JSON[_0x8ef5('0x22')](_0x8a4000));if(_0x8a4000[_0x8ef5('0x23')]){if(_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x24')]===0x1f4){logger[_0x8ef5('0x23')]('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x8a4000['error'][_0x8ef5('0x25')]);return _0x894c40(_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x25')]);}logger[_0x8ef5('0x23')](_0x8ef5('0x26'),_0xbf4727,_0x8a4000[_0x8ef5('0x23')][_0x8ef5('0x25')]);return _0x315392(_0x8a4000[_0x8ef5('0x23')]['message']);}else{logger[_0x8ef5('0x27')](_0x8ef5('0x26'),_0xbf4727,'request\x20sent');_0x315392(_0x8a4000[_0x8ef5('0x28')][_0x8ef5('0x25')]);}})[_0x8ef5('0x29')](function(_0x2256e6){logger[_0x8ef5('0x23')]('ChatQueue,\x20%s,\x20%s',_0xbf4727,_0x2256e6);_0x894c40(_0x2256e6);});});}function respondWithStatusCode(_0x17a22e,_0x2ca7be){_0x2ca7be=_0x2ca7be||0xcc;return function(_0x2db10a){if(_0x2db10a){return _0x17a22e[_0x8ef5('0x2a')](_0x2ca7be);}return _0x17a22e[_0x8ef5('0x2b')](_0x2ca7be)[_0x8ef5('0x2c')]();};}function respondWithResult(_0x1619cc,_0x11c4e3){_0x11c4e3=_0x11c4e3||0xc8;return function(_0x280878){if(_0x280878){return _0x1619cc[_0x8ef5('0x2b')](_0x11c4e3)[_0x8ef5('0x2d')](_0x280878);}};}function respondWithFilteredResult(_0x17f1cc,_0x3083a7){return function(_0x49747a){if(_0x49747a){var _0x7d771c=typeof _0x3083a7['offset']==='undefined'&&typeof _0x3083a7[_0x8ef5('0x2e')]===_0x8ef5('0x2f');var _0x412fde=_0x49747a[_0x8ef5('0x30')];var _0x33e5b9=_0x7d771c?0x0:_0x3083a7[_0x8ef5('0x31')];var _0x1e6c6f=_0x7d771c?_0x49747a[_0x8ef5('0x30')]:_0x3083a7['offset']+_0x3083a7[_0x8ef5('0x2e')];var _0x4f58ce;if(_0x1e6c6f>=_0x412fde){_0x1e6c6f=_0x412fde;_0x4f58ce=0xc8;}else{_0x4f58ce=0xce;}_0x17f1cc[_0x8ef5('0x2b')](_0x4f58ce);return _0x17f1cc['set'](_0x8ef5('0x32'),_0x33e5b9+'-'+_0x1e6c6f+'/'+_0x412fde)[_0x8ef5('0x2d')](_0x49747a);}return null;};}function patchUpdates(_0x2096fa){return function(_0x1f9cf9){try{jsonpatch[_0x8ef5('0x33')](_0x1f9cf9,_0x2096fa,!![]);}catch(_0x25e29a){return BPromise['reject'](_0x25e29a);}return _0x1f9cf9['save']();};}function saveUpdates(_0xa8a8ab,_0x23b791){return function(_0x37d33f){if(_0x37d33f){return _0x37d33f[_0x8ef5('0x34')](_0xa8a8ab)['then'](function(_0x44457e){return _0x44457e;});}return null;};}function removeEntity(_0x32eff6,_0x4c87ef){return function(_0x18ad36){if(_0x18ad36){return _0x18ad36[_0x8ef5('0x35')]()[_0x8ef5('0x36')](function(){var _0x59b611=_0x18ad36['get']({'plain':!![]});var _0x10efc9='ChatQueues';return db[_0x8ef5('0x37')][_0x8ef5('0x35')]({'where':{'type':_0x10efc9,'resourceId':_0x59b611['id']}})[_0x8ef5('0x36')](function(){return _0x18ad36;});})[_0x8ef5('0x36')](function(){_0x32eff6[_0x8ef5('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da694,_0x5b8c2b){return function(_0x1177f3){if(!_0x1177f3){_0x5da694[_0x8ef5('0x2a')](0x194);}return _0x1177f3;};}function handleError(_0x400bf4,_0x343d8e){_0x343d8e=_0x343d8e||0x1f4;return function(_0x2186b4){logger[_0x8ef5('0x23')](_0x2186b4[_0x8ef5('0x38')]);if(_0x2186b4[_0x8ef5('0x39')]){delete _0x2186b4[_0x8ef5('0x39')];}_0x400bf4[_0x8ef5('0x2b')](_0x343d8e)[_0x8ef5('0x3a')](_0x2186b4);};}exports[_0x8ef5('0x3b')]=function(_0x52d93b,_0x4bbeae){var _0xdb93e2={},_0x34c821={},_0xbd29f={'count':0x0,'rows':[]};var _0x3497f7=_['map'](db[_0x8ef5('0x3c')]['rawAttributes'],function(_0xa8172c){return{'name':_0xa8172c[_0x8ef5('0x3d')],'type':_0xa8172c[_0x8ef5('0x3e')][_0x8ef5('0x3f')]};});_0x34c821[_0x8ef5('0x40')]=_['map'](_0x3497f7,_0x8ef5('0x39'));_0x34c821['query']=_[_0x8ef5('0x41')](_0x52d93b[_0x8ef5('0x42')]);_0x34c821['filters']=_[_0x8ef5('0x43')](_0x34c821[_0x8ef5('0x40')],_0x34c821[_0x8ef5('0x42')]);_0xdb93e2[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x34c821[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0xdb93e2[_0x8ef5('0x44')]=_0xdb93e2[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0xdb93e2[_0x8ef5('0x44')]:_0x34c821[_0x8ef5('0x40')];if(!_0x52d93b['query']['hasOwnProperty'](_0x8ef5('0x47'))){_0xdb93e2[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0xdb93e2['offset']=qs[_0x8ef5('0x31')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x31')]);}_0xdb93e2['order']=qs[_0x8ef5('0x48')](_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0xdb93e2['where']=qs['filters'](_['pick'](_0x52d93b[_0x8ef5('0x42')],_0x34c821['filters']),_0x3497f7);if(_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0xdb93e2[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0xdb93e2[_0x8ef5('0x4a')],{'$or':_[_0x8ef5('0x4c')](_0x3497f7,function(_0x3ae6bf){if(_0x3ae6bf[_0x8ef5('0x3e')]!==_0x8ef5('0x4d')){var _0x5303e4={};_0x5303e4[_0x3ae6bf[_0x8ef5('0x39')]]={'$like':'%'+_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x49')]+'%'};return _0x5303e4;}})});}_0xdb93e2=_[_0x8ef5('0x4b')]({},_0xdb93e2,_0x52d93b[_0x8ef5('0x4e')]);var _0x232b8c={'where':_0xdb93e2[_0x8ef5('0x4a')]};return db[_0x8ef5('0x3c')]['count'](_0x232b8c)[_0x8ef5('0x36')](function(_0x353ee0){_0xbd29f[_0x8ef5('0x30')]=_0x353ee0;if(_0x52d93b[_0x8ef5('0x42')][_0x8ef5('0x4f')]){_0xdb93e2[_0x8ef5('0x50')]=[{'all':!![]}];}return db[_0x8ef5('0x3c')][_0x8ef5('0x51')](_0xdb93e2);})[_0x8ef5('0x36')](function(_0x49bf57){_0xbd29f[_0x8ef5('0x52')]=_0x49bf57;return _0xbd29f;})['then'](respondWithFilteredResult(_0x4bbeae,_0xdb93e2))[_0x8ef5('0x29')](handleError(_0x4bbeae,null));};exports[_0x8ef5('0x53')]=function(_0x138b2e,_0x5beefb){var _0x5c7406={'raw':!![],'where':{'id':_0x138b2e['params']['id']}},_0x37c2fd={};_0x37c2fd[_0x8ef5('0x40')]=_['keys'](db['ChatQueue'][_0x8ef5('0x54')]);_0x37c2fd[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x138b2e['query']);_0x37c2fd[_0x8ef5('0x55')]=_['intersection'](_0x37c2fd[_0x8ef5('0x40')],_0x37c2fd['query']);_0x5c7406[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x37c2fd[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x138b2e[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x5c7406[_0x8ef5('0x44')]=_0x5c7406['attributes'][_0x8ef5('0x46')]?_0x5c7406[_0x8ef5('0x44')]:_0x37c2fd[_0x8ef5('0x40')];if(_0x138b2e[_0x8ef5('0x42')][_0x8ef5('0x4f')]){_0x5c7406[_0x8ef5('0x50')]=[{'all':!![]}];}_0x5c7406=_[_0x8ef5('0x4b')]({},_0x5c7406,_0x138b2e[_0x8ef5('0x4e')]);return db['ChatQueue'][_0x8ef5('0x56')](_0x5c7406)[_0x8ef5('0x36')](handleEntityNotFound(_0x5beefb,null))['then'](respondWithResult(_0x5beefb,null))[_0x8ef5('0x29')](handleError(_0x5beefb,null));};exports['create']=function(_0x9da3bb,_0x1e9c0e){return db[_0x8ef5('0x3c')]['create'](_0x9da3bb[_0x8ef5('0x57')],{})[_0x8ef5('0x36')](function(_0x575791){var _0x31075d=_0x9da3bb['user'][_0x8ef5('0x58')]({'plain':!![]});if(!_0x31075d)throw new Error(_0x8ef5('0x59'));if(_0x31075d[_0x8ef5('0x5a')]===_0x8ef5('0x5b')){var _0x537da8=_0x575791[_0x8ef5('0x58')]({'plain':!![]});var _0x498c9a='ChatQueues';return db[_0x8ef5('0x5c')]['find']({'where':{'name':_0x498c9a,'userProfileId':_0x31075d[_0x8ef5('0x5d')]},'raw':!![]})['then'](function(_0x485f61){if(_0x485f61&&_0x485f61[_0x8ef5('0x5e')]===0x0){return db[_0x8ef5('0x37')]['create']({'name':_0x537da8['name'],'resourceId':_0x537da8['id'],'type':_0x485f61[_0x8ef5('0x39')],'sectionId':_0x485f61['id']},{})['then'](function(){return _0x575791;});}else{return _0x575791;}})[_0x8ef5('0x29')](function(_0x4fc3aa){logger[_0x8ef5('0x23')](_0x8ef5('0x5f'),_0x4fc3aa);throw _0x4fc3aa;});}return _0x575791;})[_0x8ef5('0x36')](respondWithResult(_0x1e9c0e,0xc9))[_0x8ef5('0x29')](handleError(_0x1e9c0e,null));};exports[_0x8ef5('0x34')]=function(_0x121066,_0x24cf03){if(_0x121066[_0x8ef5('0x57')]['id']){delete _0x121066[_0x8ef5('0x57')]['id'];}return db[_0x8ef5('0x3c')][_0x8ef5('0x56')]({'where':{'id':_0x121066[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x24cf03,null))[_0x8ef5('0x36')](saveUpdates(_0x121066['body'],null))[_0x8ef5('0x36')](respondWithResult(_0x24cf03,null))[_0x8ef5('0x29')](handleError(_0x24cf03,null));};exports['destroy']=function(_0x523d0d,_0x5e08a5){return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x523d0d[_0x8ef5('0x60')]['id']}})['then'](handleEntityNotFound(_0x5e08a5,null))[_0x8ef5('0x36')](removeEntity(_0x5e08a5,null))[_0x8ef5('0x29')](handleError(_0x5e08a5,null));};exports[_0x8ef5('0x61')]=function(_0x3faf83,_0x1c81ad){return db['ChatQueue'][_0x8ef5('0x61')]()[_0x8ef5('0x36')](respondWithResult(_0x1c81ad,null))[_0x8ef5('0x29')](handleError(_0x1c81ad,null));};exports[_0x8ef5('0x62')]=function(_0x5e70c7,_0x445691,_0x47c25f){var _0x2c9cac={'raw':!![],'where':{}},_0x2de3f7={},_0x2b75e5;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x5e70c7[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x445691,null))[_0x8ef5('0x36')](function(_0x186e03){if(_0x186e03){_0x2b75e5=_0x186e03[_0x8ef5('0x58')]({'plain':!![]});_0x2de3f7[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db[_0x8ef5('0x64')][_0x8ef5('0x54')]);_0x2de3f7['query']=_['keys'](_0x5e70c7[_0x8ef5('0x42')]);_0x2de3f7[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x2de3f7[_0x8ef5('0x40')],_0x2de3f7[_0x8ef5('0x42')]);_0x2c9cac[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x2de3f7[_0x8ef5('0x40')],qs[_0x8ef5('0x45')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x2c9cac[_0x8ef5('0x44')]=_0x2c9cac[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x2c9cac[_0x8ef5('0x44')]:_0x2de3f7[_0x8ef5('0x40')];if(!_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x65')]('nolimit')){_0x2c9cac[_0x8ef5('0x2e')]=qs['limit'](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0x2c9cac['offset']=qs[_0x8ef5('0x31')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x31')]);}_0x2c9cac[_0x8ef5('0x66')]=qs[_0x8ef5('0x48')](_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0x2c9cac[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_[_0x8ef5('0x67')](_0x5e70c7[_0x8ef5('0x42')],_0x2de3f7[_0x8ef5('0x55')]));_0x2c9cac[_0x8ef5('0x4a')][_0x8ef5('0x68')]=_0x186e03['id'];if(_0x5e70c7[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0x2c9cac[_0x8ef5('0x4a')]=_['merge'](_0x2c9cac['where'],{'$or':_[_0x8ef5('0x4c')](_0x2c9cac[_0x8ef5('0x44')],function(_0x4257de){var _0x408c72={};_0x408c72[_0x4257de]={'$like':'%'+_0x5e70c7['query'][_0x8ef5('0x49')]+'%'};return _0x408c72;})});}_0x2c9cac=_['merge']({},_0x2c9cac,_0x5e70c7[_0x8ef5('0x4e')]);return db[_0x8ef5('0x64')][_0x8ef5('0x51')](_0x2c9cac);}})[_0x8ef5('0x36')](function(_0x16eb82){if(_0x16eb82){return db[_0x8ef5('0x69')][_0x8ef5('0x6a')]({'where':{'id':_['map'](_0x16eb82,_0x8ef5('0x6b')),'role':_0x8ef5('0x6c')},'attributes':['id','name',_0x8ef5('0x6d'),_0x8ef5('0x6e'),_0x8ef5('0x6f')]});}})['then'](function(_0x16dc2d){if(_0x16dc2d){return{'count':_0x16dc2d[_0x8ef5('0x30')],'rows':_[_0x8ef5('0x4c')](_0x16dc2d[_0x8ef5('0x52')],function(_0x225f10){return{'membername':_0x225f10[_0x8ef5('0x39')],'UserId':_0x225f10['id'],'queue_name':_0x2b75e5['name'],'ChatQueueId':_0x2b75e5['id'],'interface':util[_0x8ef5('0x70')](_0x8ef5('0x71'),_0x8ef5('0x72'),_0x225f10[_0x8ef5('0x39')]),'penalty':0x0,'paused':_0x225f10[_0x8ef5('0x6d')],'createdAt':_0x225f10[_0x8ef5('0x6f')],'updatedAt':_0x225f10[_0x8ef5('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8ef5('0x36')](respondWithFilteredResult(_0x445691,_0x2c9cac))['catch'](handleError(_0x445691,null));};exports[_0x8ef5('0x73')]=function(_0x6ebacf,_0x36c24e,_0x24717f){var _0x3c1f9f={};var _0x2b3fda={};var _0x1d3967;var _0x49441f;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x6ebacf[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x36c24e,null))[_0x8ef5('0x36')](function(_0x2a9e08){if(_0x2a9e08){_0x1d3967=_0x2a9e08;_0x2b3fda[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db[_0x8ef5('0x74')][_0x8ef5('0x54')]);_0x2b3fda[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x6ebacf[_0x8ef5('0x42')]);_0x2b3fda[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x2b3fda['model'],_0x2b3fda[_0x8ef5('0x42')]);_0x3c1f9f[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x2b3fda['model'],qs['fields'](_0x6ebacf[_0x8ef5('0x42')]['fields']));_0x3c1f9f[_0x8ef5('0x44')]=_0x3c1f9f[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x3c1f9f[_0x8ef5('0x44')]:_0x2b3fda[_0x8ef5('0x40')];_0x3c1f9f[_0x8ef5('0x66')]=qs['sort'](_0x6ebacf['query'][_0x8ef5('0x48')]);_0x3c1f9f[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_['pick'](_0x6ebacf[_0x8ef5('0x42')],_0x2b3fda['filters']));if(_0x6ebacf['query']['filter']){_0x3c1f9f[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0x3c1f9f[_0x8ef5('0x4a')],{'$or':_['map'](_0x3c1f9f[_0x8ef5('0x44')],function(_0x3c8e41){var _0x2b85f6={};_0x2b85f6[_0x3c8e41]={'$like':'%'+_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x49')]+'%'};return _0x2b85f6;})});}_0x3c1f9f=_[_0x8ef5('0x4b')]({},_0x3c1f9f,_0x6ebacf[_0x8ef5('0x4e')]);return _0x1d3967[_0x8ef5('0x73')](_0x3c1f9f);}})[_0x8ef5('0x36')](function(_0x531f65){if(_0x531f65){_0x49441f=_0x531f65[_0x8ef5('0x46')];if(!_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x65')](_0x8ef5('0x47'))){_0x3c1f9f[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x6ebacf[_0x8ef5('0x42')]['limit']);_0x3c1f9f['offset']=qs[_0x8ef5('0x31')](_0x6ebacf[_0x8ef5('0x42')][_0x8ef5('0x31')]);}return _0x1d3967[_0x8ef5('0x73')](_0x3c1f9f);}})[_0x8ef5('0x36')](function(_0xca4c37){if(_0xca4c37){return _0xca4c37?{'count':_0x49441f,'rows':_0xca4c37}:null;}})[_0x8ef5('0x36')](respondWithResult(_0x36c24e,null))[_0x8ef5('0x29')](handleError(_0x36c24e,null));};exports[_0x8ef5('0x75')]=function(_0x685f56,_0x5edd93,_0x2e8118){var _0x423884=_0x685f56[_0x8ef5('0x57')][_0x8ef5('0x76')];return db[_0x8ef5('0x74')]['findAll']({'where':{'id':_0x423884},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8ef5('0x77'),'attributes':['id',_0x8ef5('0x39'),'online',_0x8ef5('0x78'),_0x8ef5('0x79')],'raw':!![]}]})[_0x8ef5('0x36')](function(_0xa0c3aa){if(_0xa0c3aa){var _0x43b9f2=_[_0x8ef5('0x7a')](_0xa0c3aa,function(_0xf6aeea){var _0x45cbea=_0xf6aeea[_0x8ef5('0x58')]({'plain':!![]});return _0x45cbea[_0x8ef5('0x77')];});return db['ChatQueue'][_0x8ef5('0x56')]({'where':{'id':_0x685f56[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](function(_0x189e51){return db[_0x8ef5('0x7b')][_0x8ef5('0x7c')](function(_0x795542){return _0x189e51[_0x8ef5('0x75')](_0x423884,{'transaction':_0x795542})['then'](function(){return BPromise[_0x8ef5('0x7d')](_0x43b9f2,function(_0x4cd3cf){return db['UserChatQueue'][_0x8ef5('0x7e')]({'where':{'UserId':_0x4cd3cf['id'],'ChatQueueId':_0x685f56[_0x8ef5('0x60')]['id']},'transaction':_0x795542});});})[_0x8ef5('0x36')](function(){_0x43b9f2[_0x8ef5('0x7f')](function(_0x2d51cf){socket[_0x8ef5('0x80')](_0x8ef5('0x81'),{'UserId':_0x2d51cf['id'],'ChatQueueId':_0x189e51['id']});});});});});}})['then'](respondWithStatusCode(_0x5edd93,null))[_0x8ef5('0x29')](handleError(_0x5edd93,null));};exports[_0x8ef5('0x82')]=function(_0x1d67ba,_0x24548f,_0x4a56c5){return db[_0x8ef5('0x74')][_0x8ef5('0x51')]({'where':{'id':_0x1d67ba[_0x8ef5('0x42')][_0x8ef5('0x76')]},'attributes':['id'],'include':[{'model':db[_0x8ef5('0x69')],'as':_0x8ef5('0x77'),'attributes':['id'],'raw':!![]}]})[_0x8ef5('0x36')](handleEntityNotFound(_0x24548f,null))['then'](function(_0x595efc){var _0x145f17=_['map'](_0x595efc,'id');var _0x2a7643=[];var _0x548cde=[];var _0x344906=squel[_0x8ef5('0x83')]();_0x344906[_0x8ef5('0x84')](_0x8ef5('0x85'))[_0x8ef5('0x86')](_0x8ef5('0x87'),'tq')[_0x8ef5('0x88')](_0x8ef5('0x89'),'ut',_0x8ef5('0x8a'))[_0x8ef5('0x4a')](_0x8ef5('0x8b'),_0x1d67ba[_0x8ef5('0x60')]['id']);for(var _0x51c146=0x0;_0x51c146<_0x595efc[_0x8ef5('0x46')];_0x51c146+=0x1){let _0x190f44=_0x595efc[_0x51c146];for(var _0x1ccf2f=0x0;_0x1ccf2f<_0x190f44[_0x8ef5('0x77')][_0x8ef5('0x46')];_0x1ccf2f+=0x1){let _0xc3a8a7=_0x190f44[_0x8ef5('0x77')][_0x1ccf2f];var _0x30aec4=_0x344906[_0x8ef5('0x8c')]();_0x30aec4['where'](_0x8ef5('0x8d'),_0xc3a8a7['id']);_0x548cde[_0x8ef5('0x8e')](db[_0x8ef5('0x7b')][_0x8ef5('0x42')](_0x30aec4[_0x8ef5('0x8f')](),{'type':db[_0x8ef5('0x7b')][_0x8ef5('0x90')][_0x8ef5('0x91')]})[_0x8ef5('0x36')](function(_0x4cd2d1){if(_0x4cd2d1[_0x8ef5('0x46')]===0x1){return _0xc3a8a7['id'];}else{var _0xbc200c=_['every'](_[_0x8ef5('0x4c')](_0x4cd2d1,_0x8ef5('0x92')),function(_0x441660){return _[_0x8ef5('0x93')](_0x145f17,_0x441660);});if(_0xbc200c){return _0xc3a8a7['id'];}}}));}}return BPromise['all'](_0x548cde)[_0x8ef5('0x36')](function(_0x5916c2){_0x2a7643=_(_0x2a7643)['union'](_0x5916c2)[_0x8ef5('0x94')]()['value']();return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x1d67ba['params']['id']}})[_0x8ef5('0x36')](function(_0x5425c9){return db[_0x8ef5('0x7b')][_0x8ef5('0x7c')](function(_0x2866c5){return _0x5425c9[_0x8ef5('0x82')](_0x1d67ba[_0x8ef5('0x42')][_0x8ef5('0x76')],{'transaction':_0x2866c5})[_0x8ef5('0x36')](function(){if(!_['isEmpty'](_0x2a7643)){return _0x5425c9['removeAgents'](_0x2a7643,{'transaction':_0x2866c5});}})['then'](function(){_0x2a7643[_0x8ef5('0x7f')](function(_0x1507c9){socket['emit']('userChatQueue:remove',{'UserId':_0x1507c9,'ChatQueueId':_0x5425c9['id']});});});});});});})['then'](respondWithStatusCode(_0x24548f,null))[_0x8ef5('0x29')](handleError(_0x24548f,null));};exports[_0x8ef5('0x95')]=function(_0x513c9d,_0x6c27ec,_0x3ce571){return db[_0x8ef5('0x3c')]['find']({'where':{'id':_0x513c9d[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x6c27ec,null))[_0x8ef5('0x36')](function(_0x39451e){if(_0x39451e){return _0x39451e[_0x8ef5('0x95')](_0x513c9d[_0x8ef5('0x57')][_0x8ef5('0x76')],_[_0x8ef5('0x96')](_0x513c9d[_0x8ef5('0x57')],[_0x8ef5('0x76'),'id'])||{})[_0x8ef5('0x97')](function(_0x1c784b){for(var _0x556838=0x0;_0x556838<_0x513c9d[_0x8ef5('0x57')]['ids'][_0x8ef5('0x46')];_0x556838+=0x1){socket['emit'](_0x8ef5('0x81'),{'UserId':Number(_0x513c9d['body'][_0x8ef5('0x76')][_0x556838]),'ChatQueueId':Number(_0x513c9d[_0x8ef5('0x60')]['id'])});}return _0x1c784b;});}})[_0x8ef5('0x36')](respondWithResult(_0x6c27ec,null))[_0x8ef5('0x29')](handleError(_0x6c27ec,null));};exports[_0x8ef5('0x98')]=function(_0x51f7ce,_0x5052d6,_0x4416dc){return db[_0x8ef5('0x3c')][_0x8ef5('0x56')]({'where':{'id':_0x51f7ce['params']['id']}})['then'](handleEntityNotFound(_0x5052d6,null))[_0x8ef5('0x36')](function(_0x5474aa){if(_0x5474aa){return _0x5474aa['removeAgents'](_0x51f7ce['query'][_0x8ef5('0x76')])[_0x8ef5('0x36')](function(){if(_[_0x8ef5('0x99')](_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')])){for(var _0x3175e4=0x0;_0x3175e4<_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')]['length'];_0x3175e4+=0x1){socket[_0x8ef5('0x80')]('userChatQueue:remove',{'UserId':Number(_0x51f7ce['query'][_0x8ef5('0x76')][_0x3175e4]),'ChatQueueId':Number(_0x51f7ce[_0x8ef5('0x60')]['id'])});}}else{socket[_0x8ef5('0x80')](_0x8ef5('0x9a'),{'UserId':Number(_0x51f7ce[_0x8ef5('0x42')][_0x8ef5('0x76')]),'ChatQueueId':Number(_0x51f7ce[_0x8ef5('0x60')]['id'])});}});}})[_0x8ef5('0x36')](respondWithStatusCode(_0x5052d6,null))[_0x8ef5('0x29')](handleError(_0x5052d6,null));};exports[_0x8ef5('0x9b')]=function(_0x2c2276,_0x43cf7f,_0x5547ff){var _0x5ca7d0={};var _0x29b84e={};var _0x271134;var _0x4652ba;return db[_0x8ef5('0x3c')][_0x8ef5('0x63')]({'where':{'id':_0x2c2276[_0x8ef5('0x60')]['id']}})[_0x8ef5('0x36')](handleEntityNotFound(_0x43cf7f,null))[_0x8ef5('0x36')](function(_0x27117f){if(_0x27117f){_0x271134=_0x27117f;_0x29b84e[_0x8ef5('0x40')]=_[_0x8ef5('0x41')](db['User'][_0x8ef5('0x54')]);_0x29b84e[_0x8ef5('0x42')]=_[_0x8ef5('0x41')](_0x2c2276[_0x8ef5('0x42')]);_0x29b84e[_0x8ef5('0x55')]=_[_0x8ef5('0x43')](_0x29b84e[_0x8ef5('0x40')],_0x29b84e[_0x8ef5('0x42')]);_0x5ca7d0[_0x8ef5('0x44')]=_[_0x8ef5('0x43')](_0x29b84e['model'],qs['fields'](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x45')]));_0x5ca7d0[_0x8ef5('0x44')]=_0x5ca7d0[_0x8ef5('0x44')][_0x8ef5('0x46')]?_0x5ca7d0['attributes']:_0x29b84e['model'];_0x5ca7d0[_0x8ef5('0x66')]=qs[_0x8ef5('0x48')](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x48')]);_0x5ca7d0[_0x8ef5('0x4a')]=qs[_0x8ef5('0x55')](_[_0x8ef5('0x67')](_0x2c2276[_0x8ef5('0x42')],_0x29b84e[_0x8ef5('0x55')]));if(_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x49')]){_0x5ca7d0[_0x8ef5('0x4a')]=_[_0x8ef5('0x4b')](_0x5ca7d0[_0x8ef5('0x4a')],{'$or':_[_0x8ef5('0x4c')](_0x5ca7d0[_0x8ef5('0x44')],function(_0xf605d){var _0x9e0d1d={};_0x9e0d1d[_0xf605d]={'$like':'%'+_0x2c2276[_0x8ef5('0x42')]['filter']+'%'};return _0x9e0d1d;})});}_0x5ca7d0=_['merge']({},_0x5ca7d0,_0x2c2276[_0x8ef5('0x4e')]);return _0x271134['getAgents'](_0x5ca7d0);}})['then'](function(_0x193c75){if(_0x193c75){_0x4652ba=_0x193c75[_0x8ef5('0x46')];if(!_0x2c2276['query'][_0x8ef5('0x65')](_0x8ef5('0x47'))){_0x5ca7d0[_0x8ef5('0x2e')]=qs[_0x8ef5('0x2e')](_0x2c2276[_0x8ef5('0x42')][_0x8ef5('0x2e')]);_0x5ca7d0[_0x8ef5('0x31')]=qs[_0x8ef5('0x31')](_0x2c2276['query'][_0x8ef5('0x31')]);}return _0x271134[_0x8ef5('0x9b')](_0x5ca7d0);}})[_0x8ef5('0x36')](function(_0x52fd9f){if(_0x52fd9f){return _0x52fd9f?{'count':_0x4652ba,'rows':_0x52fd9f}:null;}})['then'](respondWithResult(_0x43cf7f,null))[_0x8ef5('0x29')](handleError(_0x43cf7f,null));}; \ No newline at end of file +var _0x1d26=['union','value','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','limit','count','set','apply','save','update','then','destroy','get','ChatQueues','UserProfileResource','sendStatus','name','send','index','ChatQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','body','describe','findOne','UserChatQueue','User','UserId','agent','updatedAt','createdAt','format','%s/%s','chatPause','getTeams','Team','addTeams','ids','online','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','includes'];(function(_0x43ec26,_0x44cc94){var _0x54b403=function(_0x404be6){while(--_0x404be6){_0x43ec26['push'](_0x43ec26['shift']());}};_0x54b403(++_0x44cc94);}(_0x1d26,0x125));var _0x61d2=function(_0x54a892,_0x1a4eeb){_0x54a892=_0x54a892-0x0;var _0x1f24f1=_0x1d26[_0x54a892];return _0x1f24f1;};'use strict';var emlformat=require(_0x61d2('0x0'));var rimraf=require(_0x61d2('0x1'));var zipdir=require(_0x61d2('0x2'));var jsonpatch=require(_0x61d2('0x3'));var rp=require(_0x61d2('0x4'));var moment=require(_0x61d2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x61d2('0x6'));var path=require(_0x61d2('0x7'));var sox=require('sox');var csv=require(_0x61d2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x61d2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x61d2('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x61d2('0xb'));var toCsv=require(_0x61d2('0x8'));var querystring=require(_0x61d2('0xc'));var Papa=require('papaparse');var Redis=require(_0x61d2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x61d2('0xe'));var as=require(_0x61d2('0xf'));var hardwareService=require(_0x61d2('0x10'));var logger=require(_0x61d2('0x11'))(_0x61d2('0x12'));var utils=require(_0x61d2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x61d2('0x14'))['db'];config[_0x61d2('0x15')]=_[_0x61d2('0x16')](config['redis'],{'host':_0x61d2('0x17'),'port':0x18eb});var socket=require(_0x61d2('0x18'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x61d2('0x19')](socket);var jayson=require(_0x61d2('0x1a'));var client=jayson[_0x61d2('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x509682,_0x190eff,_0xdc8d65,_0x27358f){return new BPromise(function(_0x5766aa,_0x307ce2){var _0x1b1cc9=_0x27358f||client;return _0x1b1cc9['request'](_0x509682,_0xdc8d65)['then'](function(_0x4c79ea){logger[_0x61d2('0x1c')](_0x61d2('0x1d'),_0x190eff,_0x61d2('0x1e'));logger[_0x61d2('0x1f')](_0x61d2('0x20'),_0x190eff,'request\x20sent',JSON[_0x61d2('0x21')](_0x4c79ea));if(_0x4c79ea[_0x61d2('0x22')]){if(_0x4c79ea[_0x61d2('0x22')][_0x61d2('0x23')]===0x1f4){logger[_0x61d2('0x22')](_0x61d2('0x1d'),_0x190eff,_0x4c79ea[_0x61d2('0x22')]['message']);return _0x307ce2(_0x4c79ea['error'][_0x61d2('0x24')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x190eff,_0x4c79ea['error'][_0x61d2('0x24')]);return _0x5766aa(_0x4c79ea['error'][_0x61d2('0x24')]);}else{logger[_0x61d2('0x1c')](_0x61d2('0x1d'),_0x190eff,_0x61d2('0x1e'));_0x5766aa(_0x4c79ea[_0x61d2('0x25')][_0x61d2('0x24')]);}})[_0x61d2('0x26')](function(_0x4500b9){logger['error']('ChatQueue,\x20%s,\x20%s',_0x190eff,_0x4500b9);_0x307ce2(_0x4500b9);});});}function respondWithStatusCode(_0x21e18a,_0x2e6829){_0x2e6829=_0x2e6829||0xcc;return function(_0x34e602){if(_0x34e602){return _0x21e18a['sendStatus'](_0x2e6829);}return _0x21e18a['status'](_0x2e6829)[_0x61d2('0x27')]();};}function respondWithResult(_0x2ca454,_0x45946a){_0x45946a=_0x45946a||0xc8;return function(_0x191edf){if(_0x191edf){return _0x2ca454[_0x61d2('0x28')](_0x45946a)[_0x61d2('0x29')](_0x191edf);}};}function respondWithFilteredResult(_0x591cf1,_0x59efe8){return function(_0xf96678){if(_0xf96678){var _0x37bd40=typeof _0x59efe8[_0x61d2('0x2a')]==='undefined'&&typeof _0x59efe8[_0x61d2('0x2b')]==='undefined';var _0x1a01a9=_0xf96678[_0x61d2('0x2c')];var _0x2e1be6=_0x37bd40?0x0:_0x59efe8[_0x61d2('0x2a')];var _0x3a2be5=_0x37bd40?_0xf96678['count']:_0x59efe8[_0x61d2('0x2a')]+_0x59efe8[_0x61d2('0x2b')];var _0x2df2ce;if(_0x3a2be5>=_0x1a01a9){_0x3a2be5=_0x1a01a9;_0x2df2ce=0xc8;}else{_0x2df2ce=0xce;}_0x591cf1['status'](_0x2df2ce);return _0x591cf1[_0x61d2('0x2d')]('Content-Range',_0x2e1be6+'-'+_0x3a2be5+'/'+_0x1a01a9)['json'](_0xf96678);}return null;};}function patchUpdates(_0x4f2b85){return function(_0x2b6909){try{jsonpatch[_0x61d2('0x2e')](_0x2b6909,_0x4f2b85,!![]);}catch(_0x515b5e){return BPromise['reject'](_0x515b5e);}return _0x2b6909[_0x61d2('0x2f')]();};}function saveUpdates(_0x908f58,_0x4d18e1){return function(_0x46d4f3){if(_0x46d4f3){return _0x46d4f3[_0x61d2('0x30')](_0x908f58)[_0x61d2('0x31')](function(_0x3be62d){return _0x3be62d;});}return null;};}function removeEntity(_0x34d9cd,_0x592e81){return function(_0x372d57){if(_0x372d57){return _0x372d57[_0x61d2('0x32')]()[_0x61d2('0x31')](function(){var _0x3c57d0=_0x372d57[_0x61d2('0x33')]({'plain':!![]});var _0x34d2bc=_0x61d2('0x34');return db[_0x61d2('0x35')]['destroy']({'where':{'type':_0x34d2bc,'resourceId':_0x3c57d0['id']}})[_0x61d2('0x31')](function(){return _0x372d57;});})[_0x61d2('0x31')](function(){_0x34d9cd[_0x61d2('0x28')](0xcc)[_0x61d2('0x27')]();});}};}function handleEntityNotFound(_0x432900,_0x14b7e5){return function(_0x3591b2){if(!_0x3591b2){_0x432900[_0x61d2('0x36')](0x194);}return _0x3591b2;};}function handleError(_0x2b9b09,_0x4d29f4){_0x4d29f4=_0x4d29f4||0x1f4;return function(_0x106476){logger[_0x61d2('0x22')](_0x106476['stack']);if(_0x106476[_0x61d2('0x37')]){delete _0x106476[_0x61d2('0x37')];}_0x2b9b09['status'](_0x4d29f4)[_0x61d2('0x38')](_0x106476);};}exports[_0x61d2('0x39')]=function(_0x1a1b88,_0x3febae){var _0x4657f0={},_0x3d3eda={},_0x4b38cb={'count':0x0,'rows':[]};var _0x4ace25=_['map'](db[_0x61d2('0x3a')][_0x61d2('0x3b')],function(_0x1b9962){return{'name':_0x1b9962[_0x61d2('0x3c')],'type':_0x1b9962['type'][_0x61d2('0x3d')]};});_0x3d3eda[_0x61d2('0x3e')]=_[_0x61d2('0x3f')](_0x4ace25,_0x61d2('0x37'));_0x3d3eda[_0x61d2('0x40')]=_[_0x61d2('0x41')](_0x1a1b88[_0x61d2('0x40')]);_0x3d3eda[_0x61d2('0x42')]=_[_0x61d2('0x43')](_0x3d3eda[_0x61d2('0x3e')],_0x3d3eda['query']);_0x4657f0['attributes']=_[_0x61d2('0x43')](_0x3d3eda[_0x61d2('0x3e')],qs[_0x61d2('0x44')](_0x1a1b88[_0x61d2('0x40')][_0x61d2('0x44')]));_0x4657f0['attributes']=_0x4657f0['attributes']['length']?_0x4657f0[_0x61d2('0x45')]:_0x3d3eda[_0x61d2('0x3e')];if(!_0x1a1b88[_0x61d2('0x40')][_0x61d2('0x46')](_0x61d2('0x47'))){_0x4657f0[_0x61d2('0x2b')]=qs['limit'](_0x1a1b88['query']['limit']);_0x4657f0[_0x61d2('0x2a')]=qs['offset'](_0x1a1b88[_0x61d2('0x40')]['offset']);}_0x4657f0[_0x61d2('0x48')]=qs[_0x61d2('0x49')](_0x1a1b88[_0x61d2('0x40')]['sort']);_0x4657f0[_0x61d2('0x4a')]=qs[_0x61d2('0x42')](_[_0x61d2('0x4b')](_0x1a1b88[_0x61d2('0x40')],_0x3d3eda['filters']),_0x4ace25);if(_0x1a1b88['query'][_0x61d2('0x4c')]){_0x4657f0['where']=_[_0x61d2('0x4d')](_0x4657f0[_0x61d2('0x4a')],{'$or':_[_0x61d2('0x3f')](_0x4ace25,function(_0x2c8e50){if(_0x2c8e50[_0x61d2('0x4e')]!=='VIRTUAL'){var _0x2abd52={};_0x2abd52[_0x2c8e50['name']]={'$like':'%'+_0x1a1b88['query'][_0x61d2('0x4c')]+'%'};return _0x2abd52;}})});}_0x4657f0=_[_0x61d2('0x4d')]({},_0x4657f0,_0x1a1b88[_0x61d2('0x4f')]);var _0x19a32b={'where':_0x4657f0[_0x61d2('0x4a')]};return db[_0x61d2('0x3a')][_0x61d2('0x2c')](_0x19a32b)[_0x61d2('0x31')](function(_0x1e24ba){_0x4b38cb[_0x61d2('0x2c')]=_0x1e24ba;if(_0x1a1b88[_0x61d2('0x40')][_0x61d2('0x50')]){_0x4657f0[_0x61d2('0x51')]=[{'all':!![]}];}return db[_0x61d2('0x3a')][_0x61d2('0x52')](_0x4657f0);})[_0x61d2('0x31')](function(_0xe44d26){_0x4b38cb[_0x61d2('0x53')]=_0xe44d26;return _0x4b38cb;})['then'](respondWithFilteredResult(_0x3febae,_0x4657f0))[_0x61d2('0x26')](handleError(_0x3febae,null));};exports[_0x61d2('0x54')]=function(_0x4ea5e6,_0x7405bc){var _0xa32e5c={'raw':!![],'where':{'id':_0x4ea5e6[_0x61d2('0x55')]['id']}},_0xe3008d={};_0xe3008d[_0x61d2('0x3e')]=_[_0x61d2('0x41')](db[_0x61d2('0x3a')]['rawAttributes']);_0xe3008d['query']=_[_0x61d2('0x41')](_0x4ea5e6[_0x61d2('0x40')]);_0xe3008d[_0x61d2('0x42')]=_[_0x61d2('0x43')](_0xe3008d[_0x61d2('0x3e')],_0xe3008d[_0x61d2('0x40')]);_0xa32e5c[_0x61d2('0x45')]=_[_0x61d2('0x43')](_0xe3008d[_0x61d2('0x3e')],qs[_0x61d2('0x44')](_0x4ea5e6[_0x61d2('0x40')][_0x61d2('0x44')]));_0xa32e5c[_0x61d2('0x45')]=_0xa32e5c[_0x61d2('0x45')][_0x61d2('0x56')]?_0xa32e5c[_0x61d2('0x45')]:_0xe3008d[_0x61d2('0x3e')];if(_0x4ea5e6[_0x61d2('0x40')][_0x61d2('0x50')]){_0xa32e5c[_0x61d2('0x51')]=[{'all':!![]}];}_0xa32e5c=_['merge']({},_0xa32e5c,_0x4ea5e6[_0x61d2('0x4f')]);return db[_0x61d2('0x3a')]['find'](_0xa32e5c)[_0x61d2('0x31')](handleEntityNotFound(_0x7405bc,null))[_0x61d2('0x31')](respondWithResult(_0x7405bc,null))[_0x61d2('0x26')](handleError(_0x7405bc,null));};exports[_0x61d2('0x57')]=function(_0x5f1cac,_0x35757a){return db[_0x61d2('0x3a')][_0x61d2('0x57')](_0x5f1cac['body'],{})[_0x61d2('0x31')](function(_0x488271){var _0x5555da=_0x5f1cac[_0x61d2('0x58')][_0x61d2('0x33')]({'plain':!![]});if(!_0x5555da)throw new Error(_0x61d2('0x59'));if(_0x5555da['role']==='user'){var _0x2c75ec=_0x488271[_0x61d2('0x33')]({'plain':!![]});var _0x553cc7=_0x61d2('0x34');return db[_0x61d2('0x5a')][_0x61d2('0x5b')]({'where':{'name':_0x553cc7,'userProfileId':_0x5555da[_0x61d2('0x5c')]},'raw':!![]})['then'](function(_0x32e327){if(_0x32e327&&_0x32e327[_0x61d2('0x5d')]===0x0){return db[_0x61d2('0x35')][_0x61d2('0x57')]({'name':_0x2c75ec[_0x61d2('0x37')],'resourceId':_0x2c75ec['id'],'type':_0x32e327[_0x61d2('0x37')],'sectionId':_0x32e327['id']},{})[_0x61d2('0x31')](function(){return _0x488271;});}else{return _0x488271;}})['catch'](function(_0x2d4095){logger[_0x61d2('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d4095);throw _0x2d4095;});}return _0x488271;})[_0x61d2('0x31')](respondWithResult(_0x35757a,0xc9))['catch'](handleError(_0x35757a,null));};exports[_0x61d2('0x30')]=function(_0x5a1029,_0x16bb42){if(_0x5a1029[_0x61d2('0x5e')]['id']){delete _0x5a1029[_0x61d2('0x5e')]['id'];}return db[_0x61d2('0x3a')][_0x61d2('0x5b')]({'where':{'id':_0x5a1029[_0x61d2('0x55')]['id']}})['then'](handleEntityNotFound(_0x16bb42,null))[_0x61d2('0x31')](saveUpdates(_0x5a1029[_0x61d2('0x5e')],null))[_0x61d2('0x31')](respondWithResult(_0x16bb42,null))[_0x61d2('0x26')](handleError(_0x16bb42,null));};exports[_0x61d2('0x32')]=function(_0xc08c77,_0x5cfda6){return db[_0x61d2('0x3a')][_0x61d2('0x5b')]({'where':{'id':_0xc08c77[_0x61d2('0x55')]['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0x5cfda6,null))[_0x61d2('0x31')](removeEntity(_0x5cfda6,null))['catch'](handleError(_0x5cfda6,null));};exports[_0x61d2('0x5f')]=function(_0xdd23aa,_0x429b68){return db[_0x61d2('0x3a')]['describe']()[_0x61d2('0x31')](respondWithResult(_0x429b68,null))[_0x61d2('0x26')](handleError(_0x429b68,null));};exports['getMembers']=function(_0x82f8fb,_0x353c31,_0x5c1aee){var _0x2c127c={'raw':!![],'where':{}},_0x5ad93b={},_0x2f8553;return db[_0x61d2('0x3a')][_0x61d2('0x60')]({'where':{'id':_0x82f8fb['params']['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0x353c31,null))['then'](function(_0x29d09d){if(_0x29d09d){_0x2f8553=_0x29d09d[_0x61d2('0x33')]({'plain':!![]});_0x5ad93b['model']=_[_0x61d2('0x41')](db[_0x61d2('0x61')]['rawAttributes']);_0x5ad93b[_0x61d2('0x40')]=_[_0x61d2('0x41')](_0x82f8fb['query']);_0x5ad93b[_0x61d2('0x42')]=_[_0x61d2('0x43')](_0x5ad93b['model'],_0x5ad93b[_0x61d2('0x40')]);_0x2c127c[_0x61d2('0x45')]=_[_0x61d2('0x43')](_0x5ad93b[_0x61d2('0x3e')],qs[_0x61d2('0x44')](_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x44')]));_0x2c127c[_0x61d2('0x45')]=_0x2c127c[_0x61d2('0x45')]['length']?_0x2c127c[_0x61d2('0x45')]:_0x5ad93b[_0x61d2('0x3e')];if(!_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x46')](_0x61d2('0x47'))){_0x2c127c[_0x61d2('0x2b')]=qs[_0x61d2('0x2b')](_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x2b')]);_0x2c127c['offset']=qs['offset'](_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x2a')]);}_0x2c127c[_0x61d2('0x48')]=qs[_0x61d2('0x49')](_0x82f8fb[_0x61d2('0x40')]['sort']);_0x2c127c[_0x61d2('0x4a')]=qs[_0x61d2('0x42')](_[_0x61d2('0x4b')](_0x82f8fb[_0x61d2('0x40')],_0x5ad93b['filters']));_0x2c127c[_0x61d2('0x4a')]['ChatQueueId']=_0x29d09d['id'];if(_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x4c')]){_0x2c127c[_0x61d2('0x4a')]=_[_0x61d2('0x4d')](_0x2c127c[_0x61d2('0x4a')],{'$or':_[_0x61d2('0x3f')](_0x2c127c[_0x61d2('0x45')],function(_0x4286d6){var _0x276577={};_0x276577[_0x4286d6]={'$like':'%'+_0x82f8fb[_0x61d2('0x40')][_0x61d2('0x4c')]+'%'};return _0x276577;})});}_0x2c127c=_[_0x61d2('0x4d')]({},_0x2c127c,_0x82f8fb[_0x61d2('0x4f')]);return db[_0x61d2('0x61')][_0x61d2('0x52')](_0x2c127c);}})[_0x61d2('0x31')](function(_0x51ffa3){if(_0x51ffa3){return db[_0x61d2('0x62')]['findAndCountAll']({'where':{'id':_[_0x61d2('0x3f')](_0x51ffa3,_0x61d2('0x63')),'role':_0x61d2('0x64')},'attributes':['id','name','chatPause',_0x61d2('0x65'),_0x61d2('0x66')]});}})[_0x61d2('0x31')](function(_0x1b5d09){if(_0x1b5d09){return{'count':_0x1b5d09['count'],'rows':_[_0x61d2('0x3f')](_0x1b5d09[_0x61d2('0x53')],function(_0x3a0f4d){return{'membername':_0x3a0f4d[_0x61d2('0x37')],'UserId':_0x3a0f4d['id'],'queue_name':_0x2f8553['name'],'ChatQueueId':_0x2f8553['id'],'interface':util[_0x61d2('0x67')](_0x61d2('0x68'),'SIP',_0x3a0f4d['name']),'penalty':0x0,'paused':_0x3a0f4d[_0x61d2('0x69')],'createdAt':_0x3a0f4d[_0x61d2('0x66')],'updatedAt':_0x3a0f4d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x61d2('0x31')](respondWithFilteredResult(_0x353c31,_0x2c127c))[_0x61d2('0x26')](handleError(_0x353c31,null));};exports[_0x61d2('0x6a')]=function(_0x3fe3d9,_0x53ba24,_0x311253){var _0x770379={};var _0x485c4d={};var _0x4cc4d1;var _0x1a4204;return db[_0x61d2('0x3a')]['findOne']({'where':{'id':_0x3fe3d9[_0x61d2('0x55')]['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0x53ba24,null))[_0x61d2('0x31')](function(_0x57c55b){if(_0x57c55b){_0x4cc4d1=_0x57c55b;_0x485c4d[_0x61d2('0x3e')]=_[_0x61d2('0x41')](db[_0x61d2('0x6b')][_0x61d2('0x3b')]);_0x485c4d[_0x61d2('0x40')]=_[_0x61d2('0x41')](_0x3fe3d9[_0x61d2('0x40')]);_0x485c4d[_0x61d2('0x42')]=_[_0x61d2('0x43')](_0x485c4d[_0x61d2('0x3e')],_0x485c4d[_0x61d2('0x40')]);_0x770379[_0x61d2('0x45')]=_[_0x61d2('0x43')](_0x485c4d[_0x61d2('0x3e')],qs[_0x61d2('0x44')](_0x3fe3d9[_0x61d2('0x40')]['fields']));_0x770379[_0x61d2('0x45')]=_0x770379['attributes'][_0x61d2('0x56')]?_0x770379[_0x61d2('0x45')]:_0x485c4d['model'];_0x770379[_0x61d2('0x48')]=qs[_0x61d2('0x49')](_0x3fe3d9[_0x61d2('0x40')]['sort']);_0x770379[_0x61d2('0x4a')]=qs[_0x61d2('0x42')](_[_0x61d2('0x4b')](_0x3fe3d9[_0x61d2('0x40')],_0x485c4d['filters']));if(_0x3fe3d9[_0x61d2('0x40')][_0x61d2('0x4c')]){_0x770379[_0x61d2('0x4a')]=_[_0x61d2('0x4d')](_0x770379['where'],{'$or':_[_0x61d2('0x3f')](_0x770379[_0x61d2('0x45')],function(_0x40cc66){var _0x27aff3={};_0x27aff3[_0x40cc66]={'$like':'%'+_0x3fe3d9[_0x61d2('0x40')][_0x61d2('0x4c')]+'%'};return _0x27aff3;})});}_0x770379=_[_0x61d2('0x4d')]({},_0x770379,_0x3fe3d9[_0x61d2('0x4f')]);return _0x4cc4d1[_0x61d2('0x6a')](_0x770379);}})['then'](function(_0x111888){if(_0x111888){_0x1a4204=_0x111888['length'];if(!_0x3fe3d9[_0x61d2('0x40')][_0x61d2('0x46')](_0x61d2('0x47'))){_0x770379['limit']=qs[_0x61d2('0x2b')](_0x3fe3d9[_0x61d2('0x40')][_0x61d2('0x2b')]);_0x770379['offset']=qs['offset'](_0x3fe3d9[_0x61d2('0x40')][_0x61d2('0x2a')]);}return _0x4cc4d1[_0x61d2('0x6a')](_0x770379);}})['then'](function(_0x4700cb){if(_0x4700cb){return _0x4700cb?{'count':_0x1a4204,'rows':_0x4700cb}:null;}})[_0x61d2('0x31')](respondWithResult(_0x53ba24,null))[_0x61d2('0x26')](handleError(_0x53ba24,null));};exports[_0x61d2('0x6c')]=function(_0x2bc56a,_0x4cef71,_0x2c06eb){var _0x3002d6=_0x2bc56a[_0x61d2('0x5e')][_0x61d2('0x6d')];return db['Team'][_0x61d2('0x52')]({'where':{'id':_0x3002d6},'attributes':['id'],'include':[{'model':db[_0x61d2('0x62')],'as':'Agents','attributes':['id',_0x61d2('0x37'),_0x61d2('0x6e'),'voicePause','interface'],'raw':!![]}]})[_0x61d2('0x31')](function(_0x2ccd6a){if(_0x2ccd6a){var _0xaea755=_[_0x61d2('0x6f')](_0x2ccd6a,function(_0x30d338){var _0x42ef41=_0x30d338[_0x61d2('0x33')]({'plain':!![]});return _0x42ef41['Agents'];});return db[_0x61d2('0x3a')][_0x61d2('0x5b')]({'where':{'id':_0x2bc56a['params']['id']}})[_0x61d2('0x31')](function(_0x5d6706){return db['sequelize'][_0x61d2('0x70')](function(_0x5beeac){return _0x5d6706['addTeams'](_0x3002d6,{'transaction':_0x5beeac})[_0x61d2('0x31')](function(){return BPromise[_0x61d2('0x71')](_0xaea755,function(_0xb385a9){return db[_0x61d2('0x61')][_0x61d2('0x72')]({'where':{'UserId':_0xb385a9['id'],'ChatQueueId':_0x2bc56a[_0x61d2('0x55')]['id']},'transaction':_0x5beeac});});})[_0x61d2('0x31')](function(){_0xaea755[_0x61d2('0x73')](function(_0x9de95d){socket[_0x61d2('0x74')](_0x61d2('0x75'),{'UserId':_0x9de95d['id'],'ChatQueueId':_0x5d6706['id']});});});});});}})['then'](respondWithStatusCode(_0x4cef71,null))[_0x61d2('0x26')](handleError(_0x4cef71,null));};exports[_0x61d2('0x76')]=function(_0x398ef8,_0x217c78,_0x10d3d4){return db[_0x61d2('0x6b')]['findAll']({'where':{'id':_0x398ef8[_0x61d2('0x40')][_0x61d2('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x61d2('0x62')],'as':_0x61d2('0x77'),'attributes':['id'],'raw':!![]}]})[_0x61d2('0x31')](handleEntityNotFound(_0x217c78,null))[_0x61d2('0x31')](function(_0x534ab1){var _0x2322a0=_[_0x61d2('0x3f')](_0x534ab1,'id');var _0x1e1069=[];var _0x2e4dc6=[];var _0x38975a=squel[_0x61d2('0x78')]();_0x38975a[_0x61d2('0x79')](_0x61d2('0x7a'))[_0x61d2('0x7b')](_0x61d2('0x7c'),'tq')[_0x61d2('0x7d')](_0x61d2('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x61d2('0x4a')](_0x61d2('0x7f'),_0x398ef8['params']['id']);for(var _0x366364=0x0;_0x366364<_0x534ab1[_0x61d2('0x56')];_0x366364+=0x1){let _0x44fb17=_0x534ab1[_0x366364];for(var _0x1cbbad=0x0;_0x1cbbad<_0x44fb17[_0x61d2('0x77')][_0x61d2('0x56')];_0x1cbbad+=0x1){let _0x6c1270=_0x44fb17[_0x61d2('0x77')][_0x1cbbad];var _0x4b0473=_0x38975a[_0x61d2('0x80')]();_0x4b0473[_0x61d2('0x4a')]('ut.UserId\x20=\x20?',_0x6c1270['id']);_0x2e4dc6[_0x61d2('0x81')](db[_0x61d2('0x82')]['query'](_0x4b0473['toString'](),{'type':db[_0x61d2('0x82')][_0x61d2('0x83')][_0x61d2('0x84')]})['then'](function(_0x4c1078){if(_0x4c1078[_0x61d2('0x56')]===0x1){return _0x6c1270['id'];}else{var _0x4256a4=_[_0x61d2('0x85')](_[_0x61d2('0x3f')](_0x4c1078,_0x61d2('0x86')),function(_0x16d767){return _[_0x61d2('0x87')](_0x2322a0,_0x16d767);});if(_0x4256a4){return _0x6c1270['id'];}}}));}}return BPromise['all'](_0x2e4dc6)[_0x61d2('0x31')](function(_0x5971ef){_0x1e1069=_(_0x1e1069)[_0x61d2('0x88')](_0x5971ef)['compact']()[_0x61d2('0x89')]();return db[_0x61d2('0x3a')]['find']({'where':{'id':_0x398ef8[_0x61d2('0x55')]['id']}})['then'](function(_0x2954ea){return db['sequelize'][_0x61d2('0x70')](function(_0x32da3d){return _0x2954ea[_0x61d2('0x76')](_0x398ef8[_0x61d2('0x40')][_0x61d2('0x6d')],{'transaction':_0x32da3d})[_0x61d2('0x31')](function(){if(!_['isEmpty'](_0x1e1069)){return _0x2954ea[_0x61d2('0x8a')](_0x1e1069,{'transaction':_0x32da3d});}})[_0x61d2('0x31')](function(){_0x1e1069[_0x61d2('0x73')](function(_0x8f9581){socket[_0x61d2('0x74')](_0x61d2('0x8b'),{'UserId':_0x8f9581,'ChatQueueId':_0x2954ea['id']});});});});});});})[_0x61d2('0x31')](respondWithStatusCode(_0x217c78,null))[_0x61d2('0x26')](handleError(_0x217c78,null));};exports[_0x61d2('0x8c')]=function(_0x1df703,_0xa276b0,_0x374025){return db['ChatQueue'][_0x61d2('0x5b')]({'where':{'id':_0x1df703[_0x61d2('0x55')]['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0xa276b0,null))[_0x61d2('0x31')](function(_0x96a601){if(_0x96a601){return _0x96a601[_0x61d2('0x8c')](_0x1df703[_0x61d2('0x5e')][_0x61d2('0x6d')],_[_0x61d2('0x8d')](_0x1df703[_0x61d2('0x5e')],[_0x61d2('0x6d'),'id'])||{})['spread'](function(_0xc2a2ec){for(var _0x52ca3f=0x0;_0x52ca3f<_0x1df703[_0x61d2('0x5e')][_0x61d2('0x6d')][_0x61d2('0x56')];_0x52ca3f+=0x1){socket[_0x61d2('0x74')]('userChatQueue:save',{'UserId':Number(_0x1df703[_0x61d2('0x5e')][_0x61d2('0x6d')][_0x52ca3f]),'ChatQueueId':Number(_0x1df703[_0x61d2('0x55')]['id'])});}return _0xc2a2ec;});}})[_0x61d2('0x31')](respondWithResult(_0xa276b0,null))[_0x61d2('0x26')](handleError(_0xa276b0,null));};exports[_0x61d2('0x8a')]=function(_0x5afad6,_0x4137d3,_0x14d145){return db['ChatQueue']['find']({'where':{'id':_0x5afad6[_0x61d2('0x55')]['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0x4137d3,null))[_0x61d2('0x31')](function(_0x7f84ea){if(_0x7f84ea){return _0x7f84ea[_0x61d2('0x8a')](_0x5afad6[_0x61d2('0x40')][_0x61d2('0x6d')])[_0x61d2('0x31')](function(){if(_['isArray'](_0x5afad6[_0x61d2('0x40')][_0x61d2('0x6d')])){for(var _0x3fbaa4=0x0;_0x3fbaa4<_0x5afad6[_0x61d2('0x40')][_0x61d2('0x6d')]['length'];_0x3fbaa4+=0x1){socket[_0x61d2('0x74')](_0x61d2('0x8b'),{'UserId':Number(_0x5afad6[_0x61d2('0x40')][_0x61d2('0x6d')][_0x3fbaa4]),'ChatQueueId':Number(_0x5afad6[_0x61d2('0x55')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x5afad6[_0x61d2('0x40')][_0x61d2('0x6d')]),'ChatQueueId':Number(_0x5afad6['params']['id'])});}});}})[_0x61d2('0x31')](respondWithStatusCode(_0x4137d3,null))[_0x61d2('0x26')](handleError(_0x4137d3,null));};exports[_0x61d2('0x8e')]=function(_0x61006e,_0x376653,_0x338b05){var _0x1e9ebf={};var _0x4f9eb0={};var _0x1280d2;var _0x1c3910;return db[_0x61d2('0x3a')][_0x61d2('0x60')]({'where':{'id':_0x61006e[_0x61d2('0x55')]['id']}})[_0x61d2('0x31')](handleEntityNotFound(_0x376653,null))[_0x61d2('0x31')](function(_0x3d7cd1){if(_0x3d7cd1){_0x1280d2=_0x3d7cd1;_0x4f9eb0['model']=_[_0x61d2('0x41')](db[_0x61d2('0x62')][_0x61d2('0x3b')]);_0x4f9eb0[_0x61d2('0x40')]=_['keys'](_0x61006e[_0x61d2('0x40')]);_0x4f9eb0['filters']=_[_0x61d2('0x43')](_0x4f9eb0[_0x61d2('0x3e')],_0x4f9eb0[_0x61d2('0x40')]);_0x1e9ebf[_0x61d2('0x45')]=_['intersection'](_0x4f9eb0[_0x61d2('0x3e')],qs['fields'](_0x61006e['query'][_0x61d2('0x44')]));_0x1e9ebf[_0x61d2('0x45')]=_0x1e9ebf['attributes'][_0x61d2('0x56')]?_0x1e9ebf[_0x61d2('0x45')]:_0x4f9eb0[_0x61d2('0x3e')];_0x1e9ebf[_0x61d2('0x48')]=qs[_0x61d2('0x49')](_0x61006e[_0x61d2('0x40')][_0x61d2('0x49')]);_0x1e9ebf['where']=qs[_0x61d2('0x42')](_['pick'](_0x61006e[_0x61d2('0x40')],_0x4f9eb0[_0x61d2('0x42')]));if(_0x61006e[_0x61d2('0x40')]['filter']){_0x1e9ebf['where']=_['merge'](_0x1e9ebf[_0x61d2('0x4a')],{'$or':_['map'](_0x1e9ebf[_0x61d2('0x45')],function(_0x3e7c54){var _0x34f437={};_0x34f437[_0x3e7c54]={'$like':'%'+_0x61006e[_0x61d2('0x40')]['filter']+'%'};return _0x34f437;})});}_0x1e9ebf=_[_0x61d2('0x4d')]({},_0x1e9ebf,_0x61006e[_0x61d2('0x4f')]);return _0x1280d2[_0x61d2('0x8e')](_0x1e9ebf);}})[_0x61d2('0x31')](function(_0x38da64){if(_0x38da64){_0x1c3910=_0x38da64['length'];if(!_0x61006e[_0x61d2('0x40')][_0x61d2('0x46')]('nolimit')){_0x1e9ebf[_0x61d2('0x2b')]=qs[_0x61d2('0x2b')](_0x61006e['query']['limit']);_0x1e9ebf['offset']=qs[_0x61d2('0x2a')](_0x61006e[_0x61d2('0x40')][_0x61d2('0x2a')]);}return _0x1280d2['getAgents'](_0x1e9ebf);}})[_0x61d2('0x31')](function(_0x4d58b4){if(_0x4d58b4){return _0x4d58b4?{'count':_0x1c3910,'rows':_0x4d58b4}:null;}})[_0x61d2('0x31')](respondWithResult(_0x376653,null))['catch'](handleError(_0x376653,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1356e52..ced08f5 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x385b=['emit','exports','events','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x385b,0x17a));var _0xb385=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0x385b[_0x242a4f];return _0x122117;};'use strict';var EventEmitter=require(_0xb385('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xb385('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb385('0x2')](0x0);var events={'afterCreate':_0xb385('0x3'),'afterUpdate':_0xb385('0x4'),'afterDestroy':_0xb385('0x5')};function emitEvent(_0x3df07f){return function(_0x4a5f1e,_0x599a2d,_0xff424d){ChatQueueEvents[_0xb385('0x6')](_0x3df07f+':'+_0x4a5f1e['id'],_0x4a5f1e);ChatQueueEvents[_0xb385('0x6')](_0x3df07f,_0x4a5f1e);_0xff424d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xb385('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xbec5=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbec5,0xe5));var _0x5bec=function(_0x1bf809,_0x536f55){_0x1bf809=_0x1bf809-0x0;var _0x1caa4e=_0xbec5[_0x1bf809];return _0x1caa4e;};'use strict';var EventEmitter=require(_0x5bec('0x0'));var ChatQueue=require(_0x5bec('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5bec('0x2')](0x0);var events={'afterCreate':_0x5bec('0x3'),'afterUpdate':_0x5bec('0x4'),'afterDestroy':_0x5bec('0x5')};function emitEvent(_0x244027){return function(_0x4ee982,_0x1f8933,_0x376cdb){ChatQueueEvents[_0x5bec('0x6')](_0x244027+':'+_0x4ee982['id'],_0x4ee982);ChatQueueEvents['emit'](_0x244027,_0x4ee982);_0x376cdb(null);};}for(var e in events){if(events[_0x5bec('0x7')](e)){var event=events[e];ChatQueue[_0x5bec('0x8')](e,emitEvent(event));}}module[_0x5bec('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 0c2d668..69fe35a 100644 --- a/server/api/chatQueue/chatQueue.model.js +++ b/server/api/chatQueue/chatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e53=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x225a75,_0x43c1de){var _0xee995d=function(_0x31a816){while(--_0x31a816){_0x225a75['push'](_0x225a75['shift']());}};_0xee995d(++_0x43c1de);}(_0x9e53,0xc3));var _0x39e5=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x9e53[_0x2b9d5c];return _0x37bb93;};'use strict';var _=require(_0x39e5('0x0'));var util=require(_0x39e5('0x1'));var logger=require(_0x39e5('0x2'))(_0x39e5('0x3'));var moment=require(_0x39e5('0x4'));var BPromise=require('bluebird');var rp=require(_0x39e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39e5('0x6'));var config=require(_0x39e5('0x7'));var attributes=require(_0x39e5('0x8'));module[_0x39e5('0x9')]=function(_0x35a6ad,_0x559cf9){return _0x35a6ad[_0x39e5('0xa')](_0x39e5('0xb'),attributes,{'tableName':_0x39e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe88b=['bluebird','request-promise','rimraf','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment'];(function(_0x13eedb,_0x2c1eb){var _0x36713e=function(_0x8a71b9){while(--_0x8a71b9){_0x13eedb['push'](_0x13eedb['shift']());}};_0x36713e(++_0x2c1eb);}(_0xe88b,0x157));var _0xbe88=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0xe88b[_0x33c637];return _0x14aa20;};'use strict';var _=require(_0xbe88('0x0'));var util=require(_0xbe88('0x1'));var logger=require(_0xbe88('0x2'))(_0xbe88('0x3'));var moment=require(_0xbe88('0x4'));var BPromise=require(_0xbe88('0x5'));var rp=require(_0xbe88('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe88('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe88('0x8'));module['exports']=function(_0x361741,_0x177fcb){return _0x361741[_0xbe88('0x9')](_0xbe88('0xa'),attributes,{'tableName':_0xbe88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 54ccdd6..1012b7a 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d28=['localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetChatQueue','findAll','options','raw','where','include','map','model','attributes','catch','ChatQueue','find','ShowChatQueue','lodash','util','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults'];(function(_0x4857c9,_0x4ccb50){var _0x1da42e=function(_0x5cdedf){while(--_0x5cdedf){_0x4857c9['push'](_0x4857c9['shift']());}};_0x1da42e(++_0x4ccb50);}(_0x2d28,0x1be));var _0x82d2=function(_0x7261e6,_0x3e3bf7){_0x7261e6=_0x7261e6-0x0;var _0x20d5ed=_0x2d28[_0x7261e6];return _0x20d5ed;};'use strict';var _=require(_0x82d2('0x0'));var util=require(_0x82d2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82d2('0x2'))['db'];var utils=require(_0x82d2('0x3'));var logger=require('../../config/logger')(_0x82d2('0x4'));var config=require(_0x82d2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x82d2('0x6')]['http']({'port':0x232a});config[_0x82d2('0x7')]=_[_0x82d2('0x8')](config[_0x82d2('0x7')],{'host':_0x82d2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x82d2('0xa'))[_0x82d2('0xb')](socket);function respondWithRpcPromise(_0x17c1c8,_0x132cf9,_0x3c55a5){return new BPromise(function(_0x2affca,_0x508e51){return client['request'](_0x17c1c8,_0x3c55a5)[_0x82d2('0xc')](function(_0x483b6e){logger[_0x82d2('0xd')](_0x82d2('0xe'),_0x132cf9,_0x82d2('0xf'));logger[_0x82d2('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x132cf9,_0x82d2('0xf'),JSON[_0x82d2('0x11')](_0x483b6e));if(_0x483b6e['error']){if(_0x483b6e['error'][_0x82d2('0x12')]===0x1f4){logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);return _0x508e51(_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);}logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x483b6e[_0x82d2('0x13')][_0x82d2('0x14')]);return _0x2affca(_0x483b6e[_0x82d2('0x13')]['message']);}else{logger[_0x82d2('0xd')]('ChatQueue,\x20%s,\x20%s',_0x132cf9,_0x82d2('0xf'));_0x2affca(_0x483b6e[_0x82d2('0x15')][_0x82d2('0x14')]);}})['catch'](function(_0x2539ad){logger[_0x82d2('0x13')](_0x82d2('0xe'),_0x132cf9,_0x2539ad);_0x508e51(_0x2539ad);});});}exports[_0x82d2('0x16')]=function(_0x1d5422){var _0x492348=this;return new Promise(function(_0xb023a3,_0x2374c6){return db['ChatQueue'][_0x82d2('0x17')]({'raw':_0x1d5422[_0x82d2('0x18')]?_0x1d5422[_0x82d2('0x18')][_0x82d2('0x19')]===undefined?!![]:![]:!![],'where':_0x1d5422[_0x82d2('0x18')]?_0x1d5422[_0x82d2('0x18')][_0x82d2('0x1a')]||null:null,'attributes':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options']['attributes']||null:null,'limit':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options']['limit']||null:null,'include':_0x1d5422[_0x82d2('0x18')]?_0x1d5422['options'][_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x1d5422[_0x82d2('0x18')][_0x82d2('0x1b')],function(_0x23d153){return{'model':db[_0x23d153[_0x82d2('0x1d')]],'as':_0x23d153['as'],'attributes':_0x23d153[_0x82d2('0x1e')],'include':_0x23d153[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x23d153[_0x82d2('0x1b')],function(_0x39b82d){return{'model':db[_0x39b82d[_0x82d2('0x1d')]],'as':_0x39b82d['as'],'attributes':_0x39b82d['attributes'],'include':_0x39b82d[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x39b82d[_0x82d2('0x1b')],function(_0x488f48){return{'model':db[_0x488f48[_0x82d2('0x1d')]],'as':_0x488f48['as'],'attributes':_0x488f48[_0x82d2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x82d2('0xc')](function(_0x2a6564){logger[_0x82d2('0xd')](_0x82d2('0x16'),_0x1d5422);logger[_0x82d2('0x10')]('GetChatQueue',_0x1d5422,JSON[_0x82d2('0x11')](_0x2a6564));_0xb023a3(_0x2a6564);})[_0x82d2('0x1f')](function(_0x489b1a){logger[_0x82d2('0x13')](_0x82d2('0x16'),_0x489b1a[_0x82d2('0x14')],_0x1d5422);_0x2374c6(_0x492348['error'](0x1f4,_0x489b1a[_0x82d2('0x14')]));});});};exports['ShowChatQueue']=function(_0xcd7014){var _0x552851=this;return new Promise(function(_0x2e1044,_0x4c98fb){return db[_0x82d2('0x20')][_0x82d2('0x21')]({'raw':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x19')]===undefined?!![]:![]:!![],'where':_0xcd7014[_0x82d2('0x18')]?_0xcd7014['options'][_0x82d2('0x1a')]||null:null,'attributes':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1e')]||null:null,'include':_0xcd7014[_0x82d2('0x18')]?_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0xcd7014[_0x82d2('0x18')][_0x82d2('0x1b')],function(_0x27745a){return{'model':db[_0x27745a[_0x82d2('0x1d')]],'as':_0x27745a['as'],'attributes':_0x27745a[_0x82d2('0x1e')],'include':_0x27745a['include']?_[_0x82d2('0x1c')](_0x27745a['include'],function(_0x4e7ff2){return{'model':db[_0x4e7ff2[_0x82d2('0x1d')]],'as':_0x4e7ff2['as'],'attributes':_0x4e7ff2['attributes'],'include':_0x4e7ff2[_0x82d2('0x1b')]?_[_0x82d2('0x1c')](_0x4e7ff2[_0x82d2('0x1b')],function(_0x37de6c){return{'model':db[_0x37de6c[_0x82d2('0x1d')]],'as':_0x37de6c['as'],'attributes':_0x37de6c[_0x82d2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x82d2('0xc')](function(_0x214a9c){logger[_0x82d2('0xd')](_0x82d2('0x22'),_0xcd7014);logger[_0x82d2('0x10')](_0x82d2('0x22'),_0xcd7014,JSON[_0x82d2('0x11')](_0x214a9c));_0x2e1044(_0x214a9c);})[_0x82d2('0x1f')](function(_0x1c2bd6){logger[_0x82d2('0x13')](_0x82d2('0x22'),_0x1c2bd6['message'],_0xcd7014);_0x4c98fb(_0x552851[_0x82d2('0x13')](0x1f4,_0x1c2bd6[_0x82d2('0x14')]));});});}; \ No newline at end of file +var _0x594d=['request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','find','ShowChatQueue','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0x594d,0x92));var _0xd594=function(_0x4b6b56,_0x41209a){_0x4b6b56=_0x4b6b56-0x0;var _0x55c760=_0x594d[_0x4b6b56];return _0x55c760;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd594('0x1'));var rs=require(_0xd594('0x2'));var fs=require('fs');var Redis=require(_0xd594('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd594('0x4'));var logger=require(_0xd594('0x5'))(_0xd594('0x6'));var config=require(_0xd594('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});config[_0xd594('0x9')]=_[_0xd594('0xa')](config[_0xd594('0x9')],{'host':_0xd594('0xb'),'port':0x18eb});var socket=require(_0xd594('0xc'))(new Redis(config[_0xd594('0x9')]));require(_0xd594('0xd'))[_0xd594('0xe')](socket);function respondWithRpcPromise(_0x143886,_0x20411b,_0x564835){return new BPromise(function(_0x31e19b,_0x3f0381){return client[_0xd594('0xf')](_0x143886,_0x564835)['then'](function(_0xeba835){logger[_0xd594('0x10')](_0xd594('0x11'),_0x20411b,_0xd594('0x12'));logger[_0xd594('0x13')](_0xd594('0x14'),_0x20411b,_0xd594('0x12'),JSON['stringify'](_0xeba835));if(_0xeba835['error']){if(_0xeba835[_0xd594('0x15')][_0xd594('0x16')]===0x1f4){logger['error'](_0xd594('0x11'),_0x20411b,_0xeba835['error'][_0xd594('0x17')]);return _0x3f0381(_0xeba835[_0xd594('0x15')][_0xd594('0x17')]);}logger['error'](_0xd594('0x11'),_0x20411b,_0xeba835['error']['message']);return _0x31e19b(_0xeba835[_0xd594('0x15')][_0xd594('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x20411b,_0xd594('0x12'));_0x31e19b(_0xeba835[_0xd594('0x18')]['message']);}})[_0xd594('0x19')](function(_0x559962){logger[_0xd594('0x15')]('ChatQueue,\x20%s,\x20%s',_0x20411b,_0x559962);_0x3f0381(_0x559962);});});}exports[_0xd594('0x1a')]=function(_0x4fa2c7){var _0x10585c=this;return new Promise(function(_0x575020,_0x3b0fda){return db[_0xd594('0x1b')][_0xd594('0x1c')]({'raw':_0x4fa2c7[_0xd594('0x1d')]?_0x4fa2c7[_0xd594('0x1d')][_0xd594('0x1e')]===undefined?!![]:![]:!![],'where':_0x4fa2c7[_0xd594('0x1d')]?_0x4fa2c7[_0xd594('0x1d')][_0xd594('0x1f')]||null:null,'attributes':_0x4fa2c7[_0xd594('0x1d')]?_0x4fa2c7[_0xd594('0x1d')][_0xd594('0x20')]||null:null,'limit':_0x4fa2c7[_0xd594('0x1d')]?_0x4fa2c7[_0xd594('0x1d')][_0xd594('0x21')]||null:null,'include':_0x4fa2c7[_0xd594('0x1d')]?_0x4fa2c7[_0xd594('0x1d')]['include']?_[_0xd594('0x22')](_0x4fa2c7[_0xd594('0x1d')][_0xd594('0x23')],function(_0x210e7b){return{'model':db[_0x210e7b[_0xd594('0x24')]],'as':_0x210e7b['as'],'attributes':_0x210e7b[_0xd594('0x20')],'include':_0x210e7b[_0xd594('0x23')]?_[_0xd594('0x22')](_0x210e7b[_0xd594('0x23')],function(_0x578f6b){return{'model':db[_0x578f6b[_0xd594('0x24')]],'as':_0x578f6b['as'],'attributes':_0x578f6b[_0xd594('0x20')],'include':_0x578f6b[_0xd594('0x23')]?_[_0xd594('0x22')](_0x578f6b[_0xd594('0x23')],function(_0x3ff7d8){return{'model':db[_0x3ff7d8[_0xd594('0x24')]],'as':_0x3ff7d8['as'],'attributes':_0x3ff7d8[_0xd594('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd594('0x25')](function(_0x199836){logger[_0xd594('0x10')](_0xd594('0x1a'),_0x4fa2c7);logger[_0xd594('0x13')](_0xd594('0x1a'),_0x4fa2c7,JSON[_0xd594('0x26')](_0x199836));_0x575020(_0x199836);})[_0xd594('0x19')](function(_0x1aa827){logger['error']('GetChatQueue',_0x1aa827['message'],_0x4fa2c7);_0x3b0fda(_0x10585c[_0xd594('0x15')](0x1f4,_0x1aa827[_0xd594('0x17')]));});});};exports['ShowChatQueue']=function(_0x5ee2c3){var _0x28bf46=this;return new Promise(function(_0x5efd19,_0x5a22d8){return db[_0xd594('0x1b')][_0xd594('0x27')]({'raw':_0x5ee2c3[_0xd594('0x1d')]?_0x5ee2c3[_0xd594('0x1d')][_0xd594('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ee2c3[_0xd594('0x1d')]?_0x5ee2c3['options'][_0xd594('0x1f')]||null:null,'attributes':_0x5ee2c3[_0xd594('0x1d')]?_0x5ee2c3['options'][_0xd594('0x20')]||null:null,'include':_0x5ee2c3[_0xd594('0x1d')]?_0x5ee2c3[_0xd594('0x1d')][_0xd594('0x23')]?_[_0xd594('0x22')](_0x5ee2c3[_0xd594('0x1d')][_0xd594('0x23')],function(_0x2c9315){return{'model':db[_0x2c9315[_0xd594('0x24')]],'as':_0x2c9315['as'],'attributes':_0x2c9315[_0xd594('0x20')],'include':_0x2c9315[_0xd594('0x23')]?_[_0xd594('0x22')](_0x2c9315[_0xd594('0x23')],function(_0x2559b3){return{'model':db[_0x2559b3[_0xd594('0x24')]],'as':_0x2559b3['as'],'attributes':_0x2559b3[_0xd594('0x20')],'include':_0x2559b3[_0xd594('0x23')]?_[_0xd594('0x22')](_0x2559b3['include'],function(_0xec2421){return{'model':db[_0xec2421[_0xd594('0x24')]],'as':_0xec2421['as'],'attributes':_0xec2421['attributes']};}):[]};}):[]};}):[]:[]})[_0xd594('0x25')](function(_0x19ccef){logger[_0xd594('0x10')](_0xd594('0x28'),_0x5ee2c3);logger[_0xd594('0x13')]('ShowChatQueue',_0x5ee2c3,JSON[_0xd594('0x26')](_0x19ccef));_0x5efd19(_0x19ccef);})[_0xd594('0x19')](function(_0x3fa7b2){logger[_0xd594('0x15')]('ShowChatQueue',_0x3fa7b2[_0xd594('0x17')],_0x5ee2c3);_0x5a22d8(_0x28bf46[_0xd594('0x15')](0x1f4,_0x3fa7b2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f7a57fc..275a8af 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb8=['emit','removeListener','length','chatQueue:','remove'];(function(_0x4a563b,_0x36f42d){var _0x2935ef=function(_0x32593f){while(--_0x32593f){_0x4a563b['push'](_0x4a563b['shift']());}};_0x2935ef(++_0x36f42d);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xadb8[_0x4f4c53];return _0x568ff1;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=['save',_0x8adb('0x0'),'update'];function createListener(_0x2b8a76,_0x2a0b30){return function(_0x24f912){_0x2a0b30[_0x8adb('0x1')](_0x2b8a76,_0x24f912);};}function removeListener(_0x44fdf7,_0x2baedb){return function(){ChatQueueEvents[_0x8adb('0x2')](_0x44fdf7,_0x2baedb);};}exports['register']=function(_0x15bc63){for(var _0x1a5f36=0x0,_0x9f435=events[_0x8adb('0x3')];_0x1a5f36<_0x9f435;_0x1a5f36++){var _0x271bed=events[_0x1a5f36];var _0x16b932=createListener(_0x8adb('0x4')+_0x271bed,_0x15bc63);ChatQueueEvents['on'](_0x271bed,_0x16b932);}}; \ No newline at end of file +var _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0x0faf,0x132));var _0xf0fa=function(_0x23d50e,_0x378059){_0x23d50e=_0x23d50e-0x0;var _0x1ce88f=_0x0faf[_0x23d50e];return _0x1ce88f;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5a0d6b2..b025573 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x393bdf,_0xf2ccb4){var _0xd57701=function(_0x4c9c1a){while(--_0x4c9c1a){_0x393bdf['push'](_0x393bdf['shift']());}};_0xd57701(++_0xf2ccb4);}(_0x814b,0x1a2));var _0xb814=function(_0x16e73a,_0x146629){_0x16e73a=_0x16e73a-0x0;var _0x187aa1=_0x814b[_0x16e73a];return _0x187aa1;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x2b78e3,_0x57aced){var _0x3e41f5=function(_0x2e5456){while(--_0x2e5456){_0x2b78e3['push'](_0x2b78e3['shift']());}};_0x3e41f5(++_0x57aced);}(_0xe14b,0x93));var _0xbe14=function(_0x1cae00,_0x13892c){_0x1cae00=_0x1cae00-0x0;var _0x37f654=_0xe14b[_0x1cae00];return _0x37f654;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 33bb525..84e15a9 100644 --- a/server/api/chatQueueReport/chatQueueReport.attributes.js +++ b/server/api/chatQueueReport/chatQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bee=['DATE','sequelize','exports','STRING'];(function(_0x259cdb,_0x3696ff){var _0x102792=function(_0x59aa1e){while(--_0x59aa1e){_0x259cdb['push'](_0x259cdb['shift']());}};_0x102792(++_0x3696ff);}(_0x7bee,0x13d));var _0xe7be=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7bee[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0xe7be('0x0'));module[_0xe7be('0x1')]={'uniqueid':{'type':Sequelize[_0xe7be('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe7be('0x2')]},'joinAt':{'type':Sequelize[_0xe7be('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xe7be('0x3')]},'exitAt':{'type':Sequelize[_0xe7be('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ef8=['moment','sequelize','exports','STRING','DATE'];(function(_0x3490c8,_0x4292e3){var _0x40fcfd=function(_0x41feb3){while(--_0x41feb3){_0x3490c8['push'](_0x3490c8['shift']());}};_0x40fcfd(++_0x4292e3);}(_0x0ef8,0xe6));var _0x80ef=function(_0x5494b5,_0x5e311c){_0x5494b5=_0x5494b5-0x0;var _0x444330=_0x0ef8[_0x5494b5];return _0x444330;};'use strict';var moment=require(_0x80ef('0x0'));var Sequelize=require(_0x80ef('0x1'));module[_0x80ef('0x2')]={'uniqueid':{'type':Sequelize[_0x80ef('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x80ef('0x3')]},'joinAt':{'type':Sequelize[_0x80ef('0x4')]},'leaveAt':{'type':Sequelize[_0x80ef('0x4')]},'acceptAt':{'type':Sequelize[_0x80ef('0x4')]},'exitAt':{'type':Sequelize[_0x80ef('0x4')]},'reason':{'type':Sequelize[_0x80ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c37d4dc..55d14ba 100644 --- a/server/api/chatQueueReport/chatQueueReport.controller.js +++ b/server/api/chatQueueReport/chatQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe08b=['undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0xe08b,0x10e));var _0xbe08=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0xe08b[_0x26da89];return _0xc95b7b;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe08('0x1'));var jsonpatch=require(_0xbe08('0x2'));var rp=require('request-promise');var moment=require(_0xbe08('0x3'));var BPromise=require(_0xbe08('0x4'));var Mustache=require(_0xbe08('0x5'));var util=require(_0xbe08('0x6'));var path=require(_0xbe08('0x7'));var sox=require(_0xbe08('0x8'));var csv=require(_0xbe08('0x9'));var ejs=require(_0xbe08('0xa'));var fs=require('fs');var fs_extra=require(_0xbe08('0xb'));var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0x9'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ab71,_0x49410b){_0x49410b=_0x49410b||0xcc;return function(_0x18ee13){if(_0x18ee13){return _0x42ab71[_0xbe08('0x19')](_0x49410b);}return _0x42ab71[_0xbe08('0x1a')](_0x49410b)[_0xbe08('0x1b')]();};}function respondWithResult(_0xe1dafa,_0x3050f1){_0x3050f1=_0x3050f1||0xc8;return function(_0x434646){if(_0x434646){return _0xe1dafa[_0xbe08('0x1a')](_0x3050f1)[_0xbe08('0x1c')](_0x434646);}};}function respondWithFilteredResult(_0x191f51,_0x457129){return function(_0x2b0901){if(_0x2b0901){var _0x122f44=typeof _0x457129[_0xbe08('0x1d')]===_0xbe08('0x1e')&&typeof _0x457129[_0xbe08('0x1f')]===_0xbe08('0x1e');var _0x344019=_0x2b0901['count'];var _0x2fa9b3=_0x122f44?0x0:_0x457129[_0xbe08('0x1d')];var _0x154559=_0x122f44?_0x2b0901[_0xbe08('0x20')]:_0x457129[_0xbe08('0x1d')]+_0x457129[_0xbe08('0x1f')];var _0x1f9808;if(_0x154559>=_0x344019){_0x154559=_0x344019;_0x1f9808=0xc8;}else{_0x1f9808=0xce;}_0x191f51['status'](_0x1f9808);return _0x191f51[_0xbe08('0x21')](_0xbe08('0x22'),_0x2fa9b3+'-'+_0x154559+'/'+_0x344019)['json'](_0x2b0901);}return null;};}function patchUpdates(_0x5ab5f5){return function(_0x439a78){try{jsonpatch[_0xbe08('0x23')](_0x439a78,_0x5ab5f5,!![]);}catch(_0x3785e4){return BPromise['reject'](_0x3785e4);}return _0x439a78[_0xbe08('0x24')]();};}function saveUpdates(_0x25ce24,_0x42143c){return function(_0x45697b){if(_0x45697b){return _0x45697b[_0xbe08('0x25')](_0x25ce24)[_0xbe08('0x26')](function(_0xf1c94a){return _0xf1c94a;});}return null;};}function removeEntity(_0x451732,_0x2d6493){return function(_0x493d13){if(_0x493d13){return _0x493d13[_0xbe08('0x27')]()[_0xbe08('0x26')](function(){_0x451732[_0xbe08('0x1a')](0xcc)[_0xbe08('0x1b')]();});}};}function handleEntityNotFound(_0x3310be,_0x28d47b){return function(_0x368122){if(!_0x368122){_0x3310be[_0xbe08('0x19')](0x194);}return _0x368122;};}function handleError(_0x628624,_0x361b06){_0x361b06=_0x361b06||0x1f4;return function(_0x5e470c){logger[_0xbe08('0x28')](_0x5e470c[_0xbe08('0x29')]);if(_0x5e470c[_0xbe08('0x2a')]){delete _0x5e470c[_0xbe08('0x2a')];}_0x628624[_0xbe08('0x1a')](_0x361b06)[_0xbe08('0x2b')](_0x5e470c);};}exports['index']=function(_0x415da3,_0x2aaa12){var _0x3b77bb={},_0x465b7b={},_0x1135c3={'count':0x0,'rows':[]};var _0x523be0=_[_0xbe08('0x2c')](db[_0xbe08('0x2d')][_0xbe08('0x2e')],function(_0x54c913){return{'name':_0x54c913[_0xbe08('0x2f')],'type':_0x54c913[_0xbe08('0x30')]['key']};});_0x465b7b[_0xbe08('0x31')]=_[_0xbe08('0x2c')](_0x523be0,'name');_0x465b7b[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x415da3[_0xbe08('0x32')]);_0x465b7b[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],_0x465b7b[_0xbe08('0x32')]);_0x3b77bb[_0xbe08('0x36')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x37')]));_0x3b77bb[_0xbe08('0x36')]=_0x3b77bb[_0xbe08('0x36')]['length']?_0x3b77bb['attributes']:_0x465b7b[_0xbe08('0x31')];if(!_0x415da3[_0xbe08('0x32')]['hasOwnProperty'](_0xbe08('0x38'))){_0x3b77bb[_0xbe08('0x1f')]=qs[_0xbe08('0x1f')](_0x415da3[_0xbe08('0x32')]['limit']);_0x3b77bb[_0xbe08('0x1d')]=qs[_0xbe08('0x1d')](_0x415da3['query']['offset']);}_0x3b77bb[_0xbe08('0x39')]=qs[_0xbe08('0x3a')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x3a')]);_0x3b77bb['where']=qs[_0xbe08('0x34')](_['pick'](_0x415da3[_0xbe08('0x32')],_0x465b7b[_0xbe08('0x34')]),_0x523be0);if(_0x415da3['query'][_0xbe08('0x3b')]){_0x3b77bb[_0xbe08('0x3c')]=_[_0xbe08('0x3d')](_0x3b77bb[_0xbe08('0x3c')],{'$or':_[_0xbe08('0x2c')](_0x523be0,function(_0x56db9c){if(_0x56db9c[_0xbe08('0x30')]!==_0xbe08('0x3e')){var _0x2c80d7={};_0x2c80d7[_0x56db9c[_0xbe08('0x2a')]]={'$like':'%'+_0x415da3[_0xbe08('0x32')][_0xbe08('0x3b')]+'%'};return _0x2c80d7;}})});}_0x3b77bb=_[_0xbe08('0x3d')]({},_0x3b77bb,_0x415da3[_0xbe08('0x3f')]);var _0x357158={'where':_0x3b77bb['where']};return db[_0xbe08('0x2d')][_0xbe08('0x20')](_0x357158)['then'](function(_0x4f0bbe){_0x1135c3[_0xbe08('0x20')]=_0x4f0bbe;if(_0x415da3['query'][_0xbe08('0x40')]){_0x3b77bb['include']=[{'all':!![]}];}return db[_0xbe08('0x2d')][_0xbe08('0x41')](_0x3b77bb);})[_0xbe08('0x26')](function(_0x337c2b){_0x1135c3[_0xbe08('0x42')]=_0x337c2b;return _0x1135c3;})[_0xbe08('0x26')](respondWithFilteredResult(_0x2aaa12,_0x3b77bb))[_0xbe08('0x43')](handleError(_0x2aaa12,null));};exports['show']=function(_0x274139,_0x16d412){var _0x4b4d7a={'raw':!![],'where':{'id':_0x274139['params']['id']}},_0x59179f={};_0x59179f[_0xbe08('0x31')]=_[_0xbe08('0x33')](db['ChatQueueReport']['rawAttributes']);_0x59179f[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x274139[_0xbe08('0x32')]);_0x59179f[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x59179f[_0xbe08('0x31')],_0x59179f[_0xbe08('0x32')]);_0x4b4d7a[_0xbe08('0x36')]=_['intersection'](_0x59179f[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x274139[_0xbe08('0x32')][_0xbe08('0x37')]));_0x4b4d7a[_0xbe08('0x36')]=_0x4b4d7a[_0xbe08('0x36')][_0xbe08('0x44')]?_0x4b4d7a['attributes']:_0x59179f['model'];if(_0x274139[_0xbe08('0x32')][_0xbe08('0x40')]){_0x4b4d7a[_0xbe08('0x45')]=[{'all':!![]}];}_0x4b4d7a=_[_0xbe08('0x3d')]({},_0x4b4d7a,_0x274139[_0xbe08('0x3f')]);return db['ChatQueueReport']['find'](_0x4b4d7a)['then'](handleEntityNotFound(_0x16d412,null))[_0xbe08('0x26')](respondWithResult(_0x16d412,null))['catch'](handleError(_0x16d412,null));};exports['create']=function(_0x1e6e6e,_0x9a9e38){return db[_0xbe08('0x2d')][_0xbe08('0x46')](_0x1e6e6e[_0xbe08('0x47')],{})[_0xbe08('0x26')](respondWithResult(_0x9a9e38,0xc9))[_0xbe08('0x43')](handleError(_0x9a9e38,null));};exports[_0xbe08('0x25')]=function(_0x592a7e,_0x2bd33a){if(_0x592a7e[_0xbe08('0x47')]['id']){delete _0x592a7e[_0xbe08('0x47')]['id'];}return db['ChatQueueReport'][_0xbe08('0x48')]({'where':{'id':_0x592a7e[_0xbe08('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bd33a,null))[_0xbe08('0x26')](saveUpdates(_0x592a7e[_0xbe08('0x47')],null))['then'](respondWithResult(_0x2bd33a,null))[_0xbe08('0x43')](handleError(_0x2bd33a,null));};exports[_0xbe08('0x27')]=function(_0x50c0ec,_0x52c6f1){return db['ChatQueueReport']['find']({'where':{'id':_0x50c0ec['params']['id']}})[_0xbe08('0x26')](handleEntityNotFound(_0x52c6f1,null))[_0xbe08('0x26')](removeEntity(_0x52c6f1,null))['catch'](handleError(_0x52c6f1,null));};exports['describe']=function(_0x2ecf8d,_0x3b0488){return db[_0xbe08('0x2d')][_0xbe08('0x4a')]()[_0xbe08('0x26')](respondWithResult(_0x3b0488,null))[_0xbe08('0x43')](handleError(_0x3b0488,null));}; \ No newline at end of file +var _0xe14a=['params','describe','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatQueueReport','fieldName','type','key','model','query','keys','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','intersection','length','find','catch','create','body','destroy'];(function(_0xbf76a0,_0x115ce0){var _0x191502=function(_0x34caf3){while(--_0x34caf3){_0xbf76a0['push'](_0xbf76a0['shift']());}};_0x191502(++_0x115ce0);}(_0xe14a,0x94));var _0xae14=function(_0xbe6f8d,_0x2bb83b){_0xbe6f8d=_0xbe6f8d-0x0;var _0x1e250c=_0xe14a[_0xbe6f8d];return _0x1e250c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xae14('0x0'));var BPromise=require(_0xae14('0x1'));var Mustache=require('mustache');var util=require(_0xae14('0x2'));var path=require(_0xae14('0x3'));var sox=require(_0xae14('0x4'));var csv=require(_0xae14('0x5'));var ejs=require(_0xae14('0x6'));var fs=require('fs');var fs_extra=require(_0xae14('0x7'));var _=require(_0xae14('0x8'));var squel=require(_0xae14('0x9'));var crypto=require(_0xae14('0xa'));var jsforce=require(_0xae14('0xb'));var deskjs=require(_0xae14('0xc'));var toCsv=require(_0xae14('0x5'));var querystring=require(_0xae14('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae14('0xe'));var qs=require(_0xae14('0xf'));var as=require(_0xae14('0x10'));var hardwareService=require(_0xae14('0x11'));var logger=require(_0xae14('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xae14('0x13'));var licenseUtil=require(_0xae14('0x14'));var db=require(_0xae14('0x15'))['db'];function respondWithStatusCode(_0x1d795c,_0x45f3e3){_0x45f3e3=_0x45f3e3||0xcc;return function(_0x1fb669){if(_0x1fb669){return _0x1d795c[_0xae14('0x16')](_0x45f3e3);}return _0x1d795c[_0xae14('0x17')](_0x45f3e3)[_0xae14('0x18')]();};}function respondWithResult(_0x473c84,_0x4a2446){_0x4a2446=_0x4a2446||0xc8;return function(_0x2bf01a){if(_0x2bf01a){return _0x473c84[_0xae14('0x17')](_0x4a2446)['json'](_0x2bf01a);}};}function respondWithFilteredResult(_0x2acc7a,_0x2245f0){return function(_0xef6e56){if(_0xef6e56){var _0x578f8c=typeof _0x2245f0[_0xae14('0x19')]==='undefined'&&typeof _0x2245f0['limit']===_0xae14('0x1a');var _0x61133f=_0xef6e56[_0xae14('0x1b')];var _0x4913e7=_0x578f8c?0x0:_0x2245f0['offset'];var _0x1ecd0f=_0x578f8c?_0xef6e56[_0xae14('0x1b')]:_0x2245f0[_0xae14('0x19')]+_0x2245f0[_0xae14('0x1c')];var _0x133604;if(_0x1ecd0f>=_0x61133f){_0x1ecd0f=_0x61133f;_0x133604=0xc8;}else{_0x133604=0xce;}_0x2acc7a[_0xae14('0x17')](_0x133604);return _0x2acc7a[_0xae14('0x1d')](_0xae14('0x1e'),_0x4913e7+'-'+_0x1ecd0f+'/'+_0x61133f)['json'](_0xef6e56);}return null;};}function patchUpdates(_0x459134){return function(_0x453eae){try{jsonpatch[_0xae14('0x1f')](_0x453eae,_0x459134,!![]);}catch(_0x410037){return BPromise[_0xae14('0x20')](_0x410037);}return _0x453eae[_0xae14('0x21')]();};}function saveUpdates(_0x45fec8,_0x58a002){return function(_0x3266cb){if(_0x3266cb){return _0x3266cb[_0xae14('0x22')](_0x45fec8)[_0xae14('0x23')](function(_0x3bb7cc){return _0x3bb7cc;});}return null;};}function removeEntity(_0x32dd4d,_0x33885f){return function(_0x55106c){if(_0x55106c){return _0x55106c['destroy']()['then'](function(){_0x32dd4d[_0xae14('0x17')](0xcc)[_0xae14('0x18')]();});}};}function handleEntityNotFound(_0x32893e,_0x25812a){return function(_0x36042f){if(!_0x36042f){_0x32893e[_0xae14('0x16')](0x194);}return _0x36042f;};}function handleError(_0x2a4499,_0xbad452){_0xbad452=_0xbad452||0x1f4;return function(_0x30c9f1){logger[_0xae14('0x24')](_0x30c9f1[_0xae14('0x25')]);if(_0x30c9f1[_0xae14('0x26')]){delete _0x30c9f1['name'];}_0x2a4499[_0xae14('0x17')](_0xbad452)[_0xae14('0x27')](_0x30c9f1);};}exports[_0xae14('0x28')]=function(_0x35aabc,_0x43c0e8){var _0x1b0f19={},_0x1da1db={},_0x5e9c9f={'count':0x0,'rows':[]};var _0x344640=_[_0xae14('0x29')](db[_0xae14('0x2a')]['rawAttributes'],function(_0x535e79){return{'name':_0x535e79[_0xae14('0x2b')],'type':_0x535e79[_0xae14('0x2c')][_0xae14('0x2d')]};});_0x1da1db[_0xae14('0x2e')]=_['map'](_0x344640,_0xae14('0x26'));_0x1da1db[_0xae14('0x2f')]=_[_0xae14('0x30')](_0x35aabc['query']);_0x1da1db['filters']=_['intersection'](_0x1da1db[_0xae14('0x2e')],_0x1da1db[_0xae14('0x2f')]);_0x1b0f19[_0xae14('0x31')]=_['intersection'](_0x1da1db[_0xae14('0x2e')],qs[_0xae14('0x32')](_0x35aabc[_0xae14('0x2f')]['fields']));_0x1b0f19[_0xae14('0x31')]=_0x1b0f19[_0xae14('0x31')]['length']?_0x1b0f19[_0xae14('0x31')]:_0x1da1db[_0xae14('0x2e')];if(!_0x35aabc[_0xae14('0x2f')][_0xae14('0x33')]('nolimit')){_0x1b0f19[_0xae14('0x1c')]=qs[_0xae14('0x1c')](_0x35aabc['query'][_0xae14('0x1c')]);_0x1b0f19[_0xae14('0x19')]=qs['offset'](_0x35aabc['query'][_0xae14('0x19')]);}_0x1b0f19['order']=qs[_0xae14('0x34')](_0x35aabc[_0xae14('0x2f')][_0xae14('0x34')]);_0x1b0f19['where']=qs[_0xae14('0x35')](_[_0xae14('0x36')](_0x35aabc[_0xae14('0x2f')],_0x1da1db[_0xae14('0x35')]),_0x344640);if(_0x35aabc[_0xae14('0x2f')][_0xae14('0x37')]){_0x1b0f19[_0xae14('0x38')]=_['merge'](_0x1b0f19[_0xae14('0x38')],{'$or':_[_0xae14('0x29')](_0x344640,function(_0x3728f6){if(_0x3728f6[_0xae14('0x2c')]!==_0xae14('0x39')){var _0x138afc={};_0x138afc[_0x3728f6[_0xae14('0x26')]]={'$like':'%'+_0x35aabc[_0xae14('0x2f')][_0xae14('0x37')]+'%'};return _0x138afc;}})});}_0x1b0f19=_[_0xae14('0x3a')]({},_0x1b0f19,_0x35aabc[_0xae14('0x3b')]);var _0x484f24={'where':_0x1b0f19['where']};return db[_0xae14('0x2a')]['count'](_0x484f24)[_0xae14('0x23')](function(_0x2240ae){_0x5e9c9f[_0xae14('0x1b')]=_0x2240ae;if(_0x35aabc[_0xae14('0x2f')][_0xae14('0x3c')]){_0x1b0f19[_0xae14('0x3d')]=[{'all':!![]}];}return db[_0xae14('0x2a')][_0xae14('0x3e')](_0x1b0f19);})['then'](function(_0x102f0f){_0x5e9c9f['rows']=_0x102f0f;return _0x5e9c9f;})[_0xae14('0x23')](respondWithFilteredResult(_0x43c0e8,_0x1b0f19))['catch'](handleError(_0x43c0e8,null));};exports[_0xae14('0x3f')]=function(_0x264318,_0x3cfc2c){var _0x54f6b6={'raw':!![],'where':{'id':_0x264318['params']['id']}},_0x20fa13={};_0x20fa13[_0xae14('0x2e')]=_[_0xae14('0x30')](db[_0xae14('0x2a')]['rawAttributes']);_0x20fa13[_0xae14('0x2f')]=_[_0xae14('0x30')](_0x264318['query']);_0x20fa13['filters']=_['intersection'](_0x20fa13[_0xae14('0x2e')],_0x20fa13[_0xae14('0x2f')]);_0x54f6b6['attributes']=_[_0xae14('0x40')](_0x20fa13[_0xae14('0x2e')],qs[_0xae14('0x32')](_0x264318[_0xae14('0x2f')][_0xae14('0x32')]));_0x54f6b6[_0xae14('0x31')]=_0x54f6b6['attributes'][_0xae14('0x41')]?_0x54f6b6[_0xae14('0x31')]:_0x20fa13['model'];if(_0x264318[_0xae14('0x2f')][_0xae14('0x3c')]){_0x54f6b6[_0xae14('0x3d')]=[{'all':!![]}];}_0x54f6b6=_['merge']({},_0x54f6b6,_0x264318['options']);return db[_0xae14('0x2a')][_0xae14('0x42')](_0x54f6b6)[_0xae14('0x23')](handleEntityNotFound(_0x3cfc2c,null))[_0xae14('0x23')](respondWithResult(_0x3cfc2c,null))[_0xae14('0x43')](handleError(_0x3cfc2c,null));};exports[_0xae14('0x44')]=function(_0x578be2,_0x27b13f){return db[_0xae14('0x2a')]['create'](_0x578be2['body'],{})[_0xae14('0x23')](respondWithResult(_0x27b13f,0xc9))['catch'](handleError(_0x27b13f,null));};exports[_0xae14('0x22')]=function(_0x213a83,_0xdf57a2){if(_0x213a83['body']['id']){delete _0x213a83[_0xae14('0x45')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x213a83['params']['id']}})[_0xae14('0x23')](handleEntityNotFound(_0xdf57a2,null))[_0xae14('0x23')](saveUpdates(_0x213a83['body'],null))['then'](respondWithResult(_0xdf57a2,null))[_0xae14('0x43')](handleError(_0xdf57a2,null));};exports[_0xae14('0x46')]=function(_0x3239de,_0x259781){return db['ChatQueueReport']['find']({'where':{'id':_0x3239de[_0xae14('0x47')]['id']}})[_0xae14('0x23')](handleEntityNotFound(_0x259781,null))[_0xae14('0x23')](removeEntity(_0x259781,null))[_0xae14('0x43')](handleError(_0x259781,null));};exports[_0xae14('0x48')]=function(_0x5bd014,_0x195eed){return db[_0xae14('0x2a')][_0xae14('0x48')]()[_0xae14('0x23')](respondWithResult(_0x195eed,null))['catch'](handleError(_0x195eed,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 888085f..c168171 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36f16e,_0x4b7a16){var _0x5967c4=function(_0x570e32){while(--_0x570e32){_0x36f16e['push'](_0x36f16e['shift']());}};_0x5967c4(++_0x4b7a16);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x898275,_0x108173){var _0x2610ce=function(_0x48ddbd){while(--_0x48ddbd){_0x898275['push'](_0x898275['shift']());}};_0x2610ce(++_0x108173);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb7e7[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1308534..d0b83d6 100644 --- a/server/api/chatQueueReport/chatQueueReport.rpc.js +++ b/server/api/chatQueueReport/chatQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c9c=['stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','raw','UpdateChatQueueReport','update','body','options','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x334fa2,_0x147cc6){var _0x3a1066=function(_0xeb20b){while(--_0xeb20b){_0x334fa2['push'](_0x334fa2['shift']());}};_0x3a1066(++_0x147cc6);}(_0x9c9c,0x1a4));var _0xc9c9=function(_0x22fc1d,_0x5b8ee1){_0x22fc1d=_0x22fc1d-0x0;var _0x29e032=_0x9c9c[_0x22fc1d];return _0x29e032;};'use strict';var _=require(_0xc9c9('0x0'));var util=require(_0xc9c9('0x1'));var moment=require(_0xc9c9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc9c9('0x3'));var fs=require('fs');var Redis=require(_0xc9c9('0x4'));var db=require(_0xc9c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9c9('0x6')][_0xc9c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ae062,_0x54a7d2,_0x2b3df){return new BPromise(function(_0x1e3d50,_0x4feac9){return client[_0xc9c9('0x8')](_0x1ae062,_0x2b3df)[_0xc9c9('0x9')](function(_0x462948){logger[_0xc9c9('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x54a7d2,_0xc9c9('0xb'));logger[_0xc9c9('0xc')](_0xc9c9('0xd'),_0x54a7d2,_0xc9c9('0xb'),JSON[_0xc9c9('0xe')](_0x462948));if(_0x462948[_0xc9c9('0xf')]){if(_0x462948[_0xc9c9('0xf')][_0xc9c9('0x10')]===0x1f4){logger[_0xc9c9('0xf')](_0xc9c9('0x11'),_0x54a7d2,_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);return _0x4feac9(_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);}logger['error'](_0xc9c9('0x11'),_0x54a7d2,_0x462948[_0xc9c9('0xf')][_0xc9c9('0x12')]);return _0x1e3d50(_0x462948['error'][_0xc9c9('0x12')]);}else{logger[_0xc9c9('0xa')](_0xc9c9('0x11'),_0x54a7d2,_0xc9c9('0xb'));_0x1e3d50(_0x462948[_0xc9c9('0x13')][_0xc9c9('0x12')]);}})[_0xc9c9('0x14')](function(_0x59c94d){logger[_0xc9c9('0xf')](_0xc9c9('0x11'),_0x54a7d2,_0x59c94d);_0x4feac9(_0x59c94d);});});}exports[_0xc9c9('0x15')]=function(_0x1d2e29){var _0x2ac465=this;return new Promise(function(_0x418b43,_0xef507f){return db[_0xc9c9('0x16')]['create'](_0x1d2e29['body'],{'raw':_0x1d2e29['options']?_0x1d2e29['options'][_0xc9c9('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x244638){logger[_0xc9c9('0xa')](_0xc9c9('0x15'),_0x1d2e29);logger[_0xc9c9('0xc')](_0xc9c9('0x15'),_0x1d2e29,JSON['stringify'](_0x244638));_0x418b43(_0x244638);})[_0xc9c9('0x14')](function(_0x4642a8){logger[_0xc9c9('0xf')](_0xc9c9('0x15'),_0x4642a8['message'],_0x1d2e29);_0xef507f(_0x2ac465['error'](0x1f4,_0x4642a8[_0xc9c9('0x12')]));});});};exports[_0xc9c9('0x18')]=function(_0x322f8c){var _0x181ede=this;return new Promise(function(_0x42c3ba,_0x3a1770){return db[_0xc9c9('0x16')][_0xc9c9('0x19')](_0x322f8c[_0xc9c9('0x1a')],{'raw':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1c')]||null:null,'attributes':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1d')]||null:null,'limit':_0x322f8c[_0xc9c9('0x1b')]?_0x322f8c['options'][_0xc9c9('0x1e')]||null:null})[_0xc9c9('0x9')](function(_0x4e2b8e){logger[_0xc9c9('0xa')](_0xc9c9('0x18'),_0x322f8c);logger[_0xc9c9('0xc')](_0xc9c9('0x18'),_0x322f8c,JSON[_0xc9c9('0xe')](_0x4e2b8e));_0x42c3ba(_0x4e2b8e);})[_0xc9c9('0x14')](function(_0x2f738c){logger[_0xc9c9('0xf')](_0xc9c9('0x18'),_0x2f738c['message'],_0x322f8c);_0x3a1770(_0x181ede[_0xc9c9('0xf')](0x1f4,_0x2f738c[_0xc9c9('0x12')]));});});}; \ No newline at end of file +var _0x205d=['options','ChatQueueReport','update','where','attributes','limit','UpdateChatQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x205d,0x1f1));var _0xd205=function(_0x50e410,_0x36bb68){_0x50e410=_0x50e410-0x0;var _0x3eb22c=_0x205d[_0x50e410];return _0x3eb22c;};'use strict';var _=require('lodash');var util=require(_0xd205('0x0'));var moment=require(_0xd205('0x1'));var BPromise=require(_0xd205('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd205('0x3'));var db=require(_0xd205('0x4'))['db'];var utils=require(_0xd205('0x5'));var logger=require(_0xd205('0x6'))(_0xd205('0x7'));var config=require(_0xd205('0x8'));var jayson=require(_0xd205('0x9'));var client=jayson[_0xd205('0xa')][_0xd205('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37dd0e,_0x610d65,_0x2e84ff){return new BPromise(function(_0x31f437,_0xa373da){return client[_0xd205('0xc')](_0x37dd0e,_0x2e84ff)[_0xd205('0xd')](function(_0x1e6503){logger[_0xd205('0xe')](_0xd205('0xf'),_0x610d65,'request\x20sent');logger[_0xd205('0x10')](_0xd205('0x11'),_0x610d65,_0xd205('0x12'),JSON[_0xd205('0x13')](_0x1e6503));if(_0x1e6503[_0xd205('0x14')]){if(_0x1e6503['error'][_0xd205('0x15')]===0x1f4){logger[_0xd205('0x14')](_0xd205('0xf'),_0x610d65,_0x1e6503[_0xd205('0x14')][_0xd205('0x16')]);return _0xa373da(_0x1e6503[_0xd205('0x14')][_0xd205('0x16')]);}logger[_0xd205('0x14')](_0xd205('0xf'),_0x610d65,_0x1e6503[_0xd205('0x14')]['message']);return _0x31f437(_0x1e6503[_0xd205('0x14')]['message']);}else{logger[_0xd205('0xe')](_0xd205('0xf'),_0x610d65,_0xd205('0x12'));_0x31f437(_0x1e6503[_0xd205('0x17')][_0xd205('0x16')]);}})[_0xd205('0x18')](function(_0x79b5ed){logger[_0xd205('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x610d65,_0x79b5ed);_0xa373da(_0x79b5ed);});});}exports[_0xd205('0x19')]=function(_0x5ef3c4){var _0xcc12ba=this;return new Promise(function(_0x39c4f7,_0x55c23e){return db['ChatQueueReport'][_0xd205('0x1a')](_0x5ef3c4[_0xd205('0x1b')],{'raw':_0x5ef3c4[_0xd205('0x1c')]?_0x5ef3c4['options']['raw']===undefined?!![]:![]:!![]})[_0xd205('0xd')](function(_0x5c9667){logger[_0xd205('0xe')](_0xd205('0x19'),_0x5ef3c4);logger['debug'](_0xd205('0x19'),_0x5ef3c4,JSON['stringify'](_0x5c9667));_0x39c4f7(_0x5c9667);})[_0xd205('0x18')](function(_0x5d4010){logger[_0xd205('0x14')](_0xd205('0x19'),_0x5d4010[_0xd205('0x16')],_0x5ef3c4);_0x55c23e(_0xcc12ba[_0xd205('0x14')](0x1f4,_0x5d4010[_0xd205('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x34dd5e){var _0x3ef619=this;return new Promise(function(_0x459ea1,_0x3c80cb){return db[_0xd205('0x1d')][_0xd205('0x1e')](_0x34dd5e['body'],{'raw':_0x34dd5e[_0xd205('0x1c')]?_0x34dd5e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34dd5e[_0xd205('0x1c')]?_0x34dd5e[_0xd205('0x1c')][_0xd205('0x1f')]||null:null,'attributes':_0x34dd5e['options']?_0x34dd5e['options'][_0xd205('0x20')]||null:null,'limit':_0x34dd5e[_0xd205('0x1c')]?_0x34dd5e[_0xd205('0x1c')][_0xd205('0x21')]||null:null})['then'](function(_0x213e6d){logger['info'](_0xd205('0x22'),_0x34dd5e);logger['debug'](_0xd205('0x22'),_0x34dd5e,JSON[_0xd205('0x13')](_0x213e6d));_0x459ea1(_0x213e6d);})[_0xd205('0x18')](function(_0x454e14){logger[_0xd205('0x14')](_0xd205('0x22'),_0x454e14[_0xd205('0x16')],_0x34dd5e);_0x3c80cb(_0x3ef619[_0xd205('0x14')](0x1f4,_0x454e14[_0xd205('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8913f1b..3462422 100644 --- a/server/api/chatQueueReport/index.js +++ b/server/api/chatQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ee5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','update','destroy','path','connect-timeout','express'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x0ee5,0xcd));var _0x50ee=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0ee5[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x50ee('0x0'));var timeout=require(_0x50ee('0x1'));var express=require(_0x50ee('0x2'));var router=express[_0x50ee('0x3')]();var fs_extra=require(_0x50ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x50ee('0x5'));var config=require(_0x50ee('0x6'));var controller=require(_0x50ee('0x7'));router[_0x50ee('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x50ee('0x9')](),controller[_0x50ee('0xa')]);router[_0x50ee('0x8')](_0x50ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x50ee('0xc')]('/',auth[_0x50ee('0x9')](),controller[_0x50ee('0xd')]);router['put'](_0x50ee('0xb'),auth[_0x50ee('0x9')](),controller[_0x50ee('0xe')]);router['delete']('/:id',auth[_0x50ee('0x9')](),controller[_0x50ee('0xf')]);module['exports']=router; \ No newline at end of file +var _0x819f=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1251d0,_0x5337ed){var _0x91834=function(_0x42f710){while(--_0x42f710){_0x1251d0['push'](_0x1251d0['shift']());}};_0x91834(++_0x5337ed);}(_0x819f,0x13e));var _0xf819=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x819f[_0x648163];return _0x199d4d;};'use strict';var multer=require(_0xf819('0x0'));var util=require(_0xf819('0x1'));var path=require(_0xf819('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf819('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf819('0x4'));var interaction=require(_0xf819('0x5'));var config=require(_0xf819('0x6'));var controller=require('./chatQueueReport.controller');router[_0xf819('0x7')]('/',auth[_0xf819('0x8')](),controller[_0xf819('0x9')]);router[_0xf819('0x7')](_0xf819('0xa'),auth[_0xf819('0x8')](),controller['describe']);router[_0xf819('0x7')](_0xf819('0xb'),auth[_0xf819('0x8')](),controller[_0xf819('0xc')]);router[_0xf819('0xd')]('/',auth[_0xf819('0x8')](),controller[_0xf819('0xe')]);router[_0xf819('0xf')]('/:id',auth[_0xf819('0x8')](),controller[_0xf819('0x10')]);router[_0xf819('0x11')](_0xf819('0xb'),auth['isAuthenticated'](),controller[_0xf819('0x12')]);module[_0xf819('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index a55a685..0ebf61d 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x52cd64,_0x3d18a0){var _0x90fb85=function(_0x24c71f){while(--_0x24c71f){_0x52cd64['push'](_0x52cd64['shift']());}};_0x90fb85(++_0x3d18a0);}(_0xedd9,0xfc));var _0x9edd=function(_0x35dc22,_0x1a4b64){_0x35dc22=_0x35dc22-0x0;var _0x56d8e6=_0xedd9[_0x35dc22];return _0x56d8e6;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x363f05,_0x4b6f15){var _0x2f86d3=function(_0x49acc8){while(--_0x49acc8){_0x363f05['push'](_0x363f05['shift']());}};_0x2f86d3(++_0x4b6f15);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ded5cca..9babfdb 100644 --- a/server/api/chatTransferReport/chatTransferReport.controller.js +++ b/server/api/chatTransferReport/chatTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb24=['index','map','ChatTransferReport','rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','then','destroy','error','stack','name','send'];(function(_0x507d89,_0x4f46a4){var _0x2cc381=function(_0x132c2d){while(--_0x132c2d){_0x507d89['push'](_0x507d89['shift']());}};_0x2cc381(++_0x4f46a4);}(_0xdb24,0x18e));var _0x4db2=function(_0x4e2bf9,_0x43a8ea){_0x4e2bf9=_0x4e2bf9-0x0;var _0x51c21e=_0xdb24[_0x4e2bf9];return _0x51c21e;};'use strict';var emlformat=require(_0x4db2('0x0'));var rimraf=require(_0x4db2('0x1'));var zipdir=require(_0x4db2('0x2'));var jsonpatch=require(_0x4db2('0x3'));var rp=require('request-promise');var moment=require(_0x4db2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4db2('0x5'));var util=require(_0x4db2('0x6'));var path=require('path');var sox=require(_0x4db2('0x7'));var csv=require(_0x4db2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db2('0x9'));var _=require(_0x4db2('0xa'));var squel=require(_0x4db2('0xb'));var crypto=require(_0x4db2('0xc'));var jsforce=require(_0x4db2('0xd'));var deskjs=require(_0x4db2('0xe'));var toCsv=require(_0x4db2('0x8'));var querystring=require('querystring');var Papa=require(_0x4db2('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4db2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4db2('0x11'));var logger=require(_0x4db2('0x12'))(_0x4db2('0x13'));var utils=require(_0x4db2('0x14'));var config=require(_0x4db2('0x15'));var licenseUtil=require(_0x4db2('0x16'));var db=require(_0x4db2('0x17'))['db'];function respondWithStatusCode(_0x3741db,_0x3fed12){_0x3fed12=_0x3fed12||0xcc;return function(_0x535d40){if(_0x535d40){return _0x3741db[_0x4db2('0x18')](_0x3fed12);}return _0x3741db[_0x4db2('0x19')](_0x3fed12)[_0x4db2('0x1a')]();};}function respondWithResult(_0x532628,_0x2af98e){_0x2af98e=_0x2af98e||0xc8;return function(_0x559970){if(_0x559970){return _0x532628['status'](_0x2af98e)[_0x4db2('0x1b')](_0x559970);}};}function respondWithFilteredResult(_0x2788c4,_0x590b2b){return function(_0x2b81f7){if(_0x2b81f7){var _0x2c29e8=typeof _0x590b2b[_0x4db2('0x1c')]===_0x4db2('0x1d')&&typeof _0x590b2b['limit']===_0x4db2('0x1d');var _0x9ba8c0=_0x2b81f7['count'];var _0x1931d5=_0x2c29e8?0x0:_0x590b2b[_0x4db2('0x1c')];var _0x2aaec9=_0x2c29e8?_0x2b81f7['count']:_0x590b2b['offset']+_0x590b2b[_0x4db2('0x1e')];var _0x104bed;if(_0x2aaec9>=_0x9ba8c0){_0x2aaec9=_0x9ba8c0;_0x104bed=0xc8;}else{_0x104bed=0xce;}_0x2788c4[_0x4db2('0x19')](_0x104bed);return _0x2788c4[_0x4db2('0x1f')](_0x4db2('0x20'),_0x1931d5+'-'+_0x2aaec9+'/'+_0x9ba8c0)[_0x4db2('0x1b')](_0x2b81f7);}return null;};}function patchUpdates(_0x343755){return function(_0x457586){try{jsonpatch['apply'](_0x457586,_0x343755,!![]);}catch(_0x269f58){return BPromise['reject'](_0x269f58);}return _0x457586[_0x4db2('0x21')]();};}function saveUpdates(_0x103b39,_0x5592eb){return function(_0xeaf744){if(_0xeaf744){return _0xeaf744['update'](_0x103b39)[_0x4db2('0x22')](function(_0x660f85){return _0x660f85;});}return null;};}function removeEntity(_0x143e07,_0x104098){return function(_0x4375b2){if(_0x4375b2){return _0x4375b2[_0x4db2('0x23')]()['then'](function(){_0x143e07[_0x4db2('0x19')](0xcc)[_0x4db2('0x1a')]();});}};}function handleEntityNotFound(_0x229934,_0x157bb8){return function(_0x5e3831){if(!_0x5e3831){_0x229934[_0x4db2('0x18')](0x194);}return _0x5e3831;};}function handleError(_0x245dbb,_0x386a70){_0x386a70=_0x386a70||0x1f4;return function(_0x1857aa){logger[_0x4db2('0x24')](_0x1857aa[_0x4db2('0x25')]);if(_0x1857aa[_0x4db2('0x26')]){delete _0x1857aa['name'];}_0x245dbb[_0x4db2('0x19')](_0x386a70)[_0x4db2('0x27')](_0x1857aa);};}exports[_0x4db2('0x28')]=function(_0x13fef7,_0x316a75){var _0x5756cb={},_0x2924c6={},_0x306931={'count':0x0,'rows':[]};var _0x5ab071=_[_0x4db2('0x29')](db[_0x4db2('0x2a')][_0x4db2('0x2b')],function(_0x54fc54){return{'name':_0x54fc54['fieldName'],'type':_0x54fc54[_0x4db2('0x2c')]['key']};});_0x2924c6[_0x4db2('0x2d')]=_[_0x4db2('0x29')](_0x5ab071,_0x4db2('0x26'));_0x2924c6['query']=_[_0x4db2('0x2e')](_0x13fef7['query']);_0x2924c6['filters']=_[_0x4db2('0x2f')](_0x2924c6[_0x4db2('0x2d')],_0x2924c6[_0x4db2('0x30')]);_0x5756cb[_0x4db2('0x31')]=_[_0x4db2('0x2f')](_0x2924c6['model'],qs['fields'](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x32')]));_0x5756cb[_0x4db2('0x31')]=_0x5756cb['attributes'][_0x4db2('0x33')]?_0x5756cb[_0x4db2('0x31')]:_0x2924c6['model'];if(!_0x13fef7['query'][_0x4db2('0x34')](_0x4db2('0x35'))){_0x5756cb['limit']=qs[_0x4db2('0x1e')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x1e')]);_0x5756cb[_0x4db2('0x1c')]=qs[_0x4db2('0x1c')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x1c')]);}_0x5756cb[_0x4db2('0x36')]=qs[_0x4db2('0x37')](_0x13fef7[_0x4db2('0x30')][_0x4db2('0x37')]);_0x5756cb[_0x4db2('0x38')]=qs[_0x4db2('0x39')](_[_0x4db2('0x3a')](_0x13fef7['query'],_0x2924c6['filters']),_0x5ab071);if(_0x13fef7[_0x4db2('0x30')][_0x4db2('0x3b')]){_0x5756cb[_0x4db2('0x38')]=_[_0x4db2('0x3c')](_0x5756cb[_0x4db2('0x38')],{'$or':_['map'](_0x5ab071,function(_0x225df8){if(_0x225df8['type']!=='VIRTUAL'){var _0xc75225={};_0xc75225[_0x225df8[_0x4db2('0x26')]]={'$like':'%'+_0x13fef7[_0x4db2('0x30')]['filter']+'%'};return _0xc75225;}})});}_0x5756cb=_[_0x4db2('0x3c')]({},_0x5756cb,_0x13fef7[_0x4db2('0x3d')]);var _0x4b393e={'where':_0x5756cb['where']};return db[_0x4db2('0x2a')][_0x4db2('0x3e')](_0x4b393e)[_0x4db2('0x22')](function(_0x44d3da){_0x306931[_0x4db2('0x3e')]=_0x44d3da;if(_0x13fef7[_0x4db2('0x30')][_0x4db2('0x3f')]){_0x5756cb[_0x4db2('0x40')]=[{'all':!![]}];}return db[_0x4db2('0x2a')][_0x4db2('0x41')](_0x5756cb);})['then'](function(_0x5ca982){_0x306931['rows']=_0x5ca982;return _0x306931;})[_0x4db2('0x22')](respondWithFilteredResult(_0x316a75,_0x5756cb))[_0x4db2('0x42')](handleError(_0x316a75,null));};exports['show']=function(_0x115ddf,_0x255be8){var _0x205eee={'raw':!![],'where':{'id':_0x115ddf[_0x4db2('0x43')]['id']}},_0x50f48f={};_0x50f48f[_0x4db2('0x2d')]=_[_0x4db2('0x2e')](db[_0x4db2('0x2a')][_0x4db2('0x2b')]);_0x50f48f[_0x4db2('0x30')]=_[_0x4db2('0x2e')](_0x115ddf[_0x4db2('0x30')]);_0x50f48f['filters']=_[_0x4db2('0x2f')](_0x50f48f['model'],_0x50f48f[_0x4db2('0x30')]);_0x205eee['attributes']=_['intersection'](_0x50f48f[_0x4db2('0x2d')],qs[_0x4db2('0x32')](_0x115ddf[_0x4db2('0x30')]['fields']));_0x205eee[_0x4db2('0x31')]=_0x205eee['attributes'][_0x4db2('0x33')]?_0x205eee[_0x4db2('0x31')]:_0x50f48f[_0x4db2('0x2d')];if(_0x115ddf[_0x4db2('0x30')][_0x4db2('0x3f')]){_0x205eee[_0x4db2('0x40')]=[{'all':!![]}];}_0x205eee=_[_0x4db2('0x3c')]({},_0x205eee,_0x115ddf['options']);return db[_0x4db2('0x2a')][_0x4db2('0x44')](_0x205eee)[_0x4db2('0x22')](handleEntityNotFound(_0x255be8,null))[_0x4db2('0x22')](respondWithResult(_0x255be8,null))[_0x4db2('0x42')](handleError(_0x255be8,null));};exports[_0x4db2('0x45')]=function(_0x4499f0,_0x36d7db){return db[_0x4db2('0x2a')][_0x4db2('0x45')](_0x4499f0[_0x4db2('0x46')],{})[_0x4db2('0x22')](respondWithResult(_0x36d7db,0xc9))[_0x4db2('0x42')](handleError(_0x36d7db,null));};exports[_0x4db2('0x47')]=function(_0x1d0cd2,_0x56d149){if(_0x1d0cd2[_0x4db2('0x46')]['id']){delete _0x1d0cd2[_0x4db2('0x46')]['id'];}return db['ChatTransferReport'][_0x4db2('0x44')]({'where':{'id':_0x1d0cd2['params']['id']}})[_0x4db2('0x22')](handleEntityNotFound(_0x56d149,null))[_0x4db2('0x22')](saveUpdates(_0x1d0cd2[_0x4db2('0x46')],null))[_0x4db2('0x22')](respondWithResult(_0x56d149,null))['catch'](handleError(_0x56d149,null));};exports[_0x4db2('0x23')]=function(_0x37beae,_0x168b01){return db[_0x4db2('0x2a')][_0x4db2('0x44')]({'where':{'id':_0x37beae[_0x4db2('0x43')]['id']}})[_0x4db2('0x22')](handleEntityNotFound(_0x168b01,null))[_0x4db2('0x22')](removeEntity(_0x168b01,null))[_0x4db2('0x42')](handleError(_0x168b01,null));};exports['describe']=function(_0x30f663,_0x55c99b){return db[_0x4db2('0x2a')][_0x4db2('0x48')]()[_0x4db2('0x22')](respondWithResult(_0x55c99b,null))[_0x4db2('0x42')](handleError(_0x55c99b,null));}; \ No newline at end of file +var _0xd1e7=['json','apply','reject','save','destroy','then','sendStatus','error','stack','index','map','ChatTransferReport','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x53414e,_0x573d45){var _0x50c72a=function(_0x1b1815){while(--_0x1b1815){_0x53414e['push'](_0x53414e['shift']());}};_0x50c72a(++_0x573d45);}(_0xd1e7,0x1b3));var _0x7d1e=function(_0x3ff29c,_0x1f7e4f){_0x3ff29c=_0x3ff29c-0x0;var _0x359c09=_0xd1e7[_0x3ff29c];return _0x359c09;};'use strict';var emlformat=require(_0x7d1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d1e('0x1'));var jsonpatch=require(_0x7d1e('0x2'));var rp=require(_0x7d1e('0x3'));var moment=require(_0x7d1e('0x4'));var BPromise=require(_0x7d1e('0x5'));var Mustache=require(_0x7d1e('0x6'));var util=require(_0x7d1e('0x7'));var path=require('path');var sox=require(_0x7d1e('0x8'));var csv=require('to-csv');var ejs=require(_0x7d1e('0x9'));var fs=require('fs');var fs_extra=require(_0x7d1e('0xa'));var _=require(_0x7d1e('0xb'));var squel=require(_0x7d1e('0xc'));var crypto=require(_0x7d1e('0xd'));var jsforce=require(_0x7d1e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7d1e('0xf'));var querystring=require('querystring');var Papa=require(_0x7d1e('0x10'));var Redis=require(_0x7d1e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d1e('0x12'));var hardwareService=require(_0x7d1e('0x13'));var logger=require(_0x7d1e('0x14'))(_0x7d1e('0x15'));var utils=require(_0x7d1e('0x16'));var config=require(_0x7d1e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d1e('0x18'))['db'];function respondWithStatusCode(_0x344155,_0x458e01){_0x458e01=_0x458e01||0xcc;return function(_0x35fd75){if(_0x35fd75){return _0x344155['sendStatus'](_0x458e01);}return _0x344155[_0x7d1e('0x19')](_0x458e01)[_0x7d1e('0x1a')]();};}function respondWithResult(_0x255fe9,_0x473b47){_0x473b47=_0x473b47||0xc8;return function(_0x512e89){if(_0x512e89){return _0x255fe9[_0x7d1e('0x19')](_0x473b47)['json'](_0x512e89);}};}function respondWithFilteredResult(_0x516852,_0x309ef6){return function(_0x30f11c){if(_0x30f11c){var _0x2042e7=typeof _0x309ef6['offset']===_0x7d1e('0x1b')&&typeof _0x309ef6['limit']==='undefined';var _0x5d05ce=_0x30f11c[_0x7d1e('0x1c')];var _0xcd97ce=_0x2042e7?0x0:_0x309ef6[_0x7d1e('0x1d')];var _0x21fbed=_0x2042e7?_0x30f11c['count']:_0x309ef6[_0x7d1e('0x1d')]+_0x309ef6[_0x7d1e('0x1e')];var _0x4e0476;if(_0x21fbed>=_0x5d05ce){_0x21fbed=_0x5d05ce;_0x4e0476=0xc8;}else{_0x4e0476=0xce;}_0x516852[_0x7d1e('0x19')](_0x4e0476);return _0x516852[_0x7d1e('0x1f')](_0x7d1e('0x20'),_0xcd97ce+'-'+_0x21fbed+'/'+_0x5d05ce)[_0x7d1e('0x21')](_0x30f11c);}return null;};}function patchUpdates(_0x1be9a6){return function(_0x161d94){try{jsonpatch[_0x7d1e('0x22')](_0x161d94,_0x1be9a6,!![]);}catch(_0x2db1da){return BPromise[_0x7d1e('0x23')](_0x2db1da);}return _0x161d94[_0x7d1e('0x24')]();};}function saveUpdates(_0x3985a1,_0x564c28){return function(_0x54aa83){if(_0x54aa83){return _0x54aa83['update'](_0x3985a1)['then'](function(_0x3f337e){return _0x3f337e;});}return null;};}function removeEntity(_0x3a7553,_0x1edca0){return function(_0x3800a4){if(_0x3800a4){return _0x3800a4[_0x7d1e('0x25')]()[_0x7d1e('0x26')](function(){_0x3a7553[_0x7d1e('0x19')](0xcc)[_0x7d1e('0x1a')]();});}};}function handleEntityNotFound(_0x406c6c,_0x2a86fa){return function(_0x12c0cf){if(!_0x12c0cf){_0x406c6c[_0x7d1e('0x27')](0x194);}return _0x12c0cf;};}function handleError(_0x4d25f2,_0x5d47e4){_0x5d47e4=_0x5d47e4||0x1f4;return function(_0x203918){logger[_0x7d1e('0x28')](_0x203918[_0x7d1e('0x29')]);if(_0x203918['name']){delete _0x203918['name'];}_0x4d25f2['status'](_0x5d47e4)['send'](_0x203918);};}exports[_0x7d1e('0x2a')]=function(_0x1726bd,_0xe438a6){var _0x52632d={},_0x43ee37={},_0x1f14be={'count':0x0,'rows':[]};var _0xd89b56=_[_0x7d1e('0x2b')](db[_0x7d1e('0x2c')]['rawAttributes'],function(_0x32f487){return{'name':_0x32f487['fieldName'],'type':_0x32f487[_0x7d1e('0x2d')][_0x7d1e('0x2e')]};});_0x43ee37[_0x7d1e('0x2f')]=_[_0x7d1e('0x2b')](_0xd89b56,'name');_0x43ee37[_0x7d1e('0x30')]=_[_0x7d1e('0x31')](_0x1726bd[_0x7d1e('0x30')]);_0x43ee37['filters']=_[_0x7d1e('0x32')](_0x43ee37[_0x7d1e('0x2f')],_0x43ee37[_0x7d1e('0x30')]);_0x52632d[_0x7d1e('0x33')]=_[_0x7d1e('0x32')](_0x43ee37[_0x7d1e('0x2f')],qs[_0x7d1e('0x34')](_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x34')]));_0x52632d[_0x7d1e('0x33')]=_0x52632d[_0x7d1e('0x33')]['length']?_0x52632d[_0x7d1e('0x33')]:_0x43ee37[_0x7d1e('0x2f')];if(!_0x1726bd['query'][_0x7d1e('0x35')](_0x7d1e('0x36'))){_0x52632d[_0x7d1e('0x1e')]=qs[_0x7d1e('0x1e')](_0x1726bd[_0x7d1e('0x30')]['limit']);_0x52632d[_0x7d1e('0x1d')]=qs[_0x7d1e('0x1d')](_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x1d')]);}_0x52632d[_0x7d1e('0x37')]=qs[_0x7d1e('0x38')](_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x38')]);_0x52632d['where']=qs[_0x7d1e('0x39')](_[_0x7d1e('0x3a')](_0x1726bd[_0x7d1e('0x30')],_0x43ee37[_0x7d1e('0x39')]),_0xd89b56);if(_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x3b')]){_0x52632d[_0x7d1e('0x3c')]=_[_0x7d1e('0x3d')](_0x52632d[_0x7d1e('0x3c')],{'$or':_['map'](_0xd89b56,function(_0x15b7c1){if(_0x15b7c1[_0x7d1e('0x2d')]!==_0x7d1e('0x3e')){var _0x3b4407={};_0x3b4407[_0x15b7c1[_0x7d1e('0x3f')]]={'$like':'%'+_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x3b')]+'%'};return _0x3b4407;}})});}_0x52632d=_[_0x7d1e('0x3d')]({},_0x52632d,_0x1726bd[_0x7d1e('0x40')]);var _0x316ffc={'where':_0x52632d[_0x7d1e('0x3c')]};return db['ChatTransferReport']['count'](_0x316ffc)[_0x7d1e('0x26')](function(_0x1d3d1e){_0x1f14be[_0x7d1e('0x1c')]=_0x1d3d1e;if(_0x1726bd[_0x7d1e('0x30')][_0x7d1e('0x41')]){_0x52632d[_0x7d1e('0x42')]=[{'all':!![]}];}return db[_0x7d1e('0x2c')][_0x7d1e('0x43')](_0x52632d);})['then'](function(_0x3fcd1e){_0x1f14be['rows']=_0x3fcd1e;return _0x1f14be;})[_0x7d1e('0x26')](respondWithFilteredResult(_0xe438a6,_0x52632d))[_0x7d1e('0x44')](handleError(_0xe438a6,null));};exports[_0x7d1e('0x45')]=function(_0x3e9ae4,_0x37931a){var _0x2dea78={'raw':!![],'where':{'id':_0x3e9ae4[_0x7d1e('0x46')]['id']}},_0x299b06={};_0x299b06['model']=_[_0x7d1e('0x31')](db[_0x7d1e('0x2c')][_0x7d1e('0x47')]);_0x299b06['query']=_[_0x7d1e('0x31')](_0x3e9ae4[_0x7d1e('0x30')]);_0x299b06[_0x7d1e('0x39')]=_[_0x7d1e('0x32')](_0x299b06[_0x7d1e('0x2f')],_0x299b06[_0x7d1e('0x30')]);_0x2dea78[_0x7d1e('0x33')]=_[_0x7d1e('0x32')](_0x299b06[_0x7d1e('0x2f')],qs['fields'](_0x3e9ae4[_0x7d1e('0x30')][_0x7d1e('0x34')]));_0x2dea78[_0x7d1e('0x33')]=_0x2dea78['attributes'][_0x7d1e('0x48')]?_0x2dea78[_0x7d1e('0x33')]:_0x299b06['model'];if(_0x3e9ae4[_0x7d1e('0x30')][_0x7d1e('0x41')]){_0x2dea78[_0x7d1e('0x42')]=[{'all':!![]}];}_0x2dea78=_[_0x7d1e('0x3d')]({},_0x2dea78,_0x3e9ae4[_0x7d1e('0x40')]);return db[_0x7d1e('0x2c')][_0x7d1e('0x49')](_0x2dea78)[_0x7d1e('0x26')](handleEntityNotFound(_0x37931a,null))['then'](respondWithResult(_0x37931a,null))['catch'](handleError(_0x37931a,null));};exports['create']=function(_0xf099e5,_0x5b9703){return db['ChatTransferReport'][_0x7d1e('0x4a')](_0xf099e5[_0x7d1e('0x4b')],{})[_0x7d1e('0x26')](respondWithResult(_0x5b9703,0xc9))['catch'](handleError(_0x5b9703,null));};exports[_0x7d1e('0x4c')]=function(_0x344c9c,_0x3ba877){if(_0x344c9c[_0x7d1e('0x4b')]['id']){delete _0x344c9c['body']['id'];}return db[_0x7d1e('0x2c')][_0x7d1e('0x49')]({'where':{'id':_0x344c9c['params']['id']}})[_0x7d1e('0x26')](handleEntityNotFound(_0x3ba877,null))[_0x7d1e('0x26')](saveUpdates(_0x344c9c['body'],null))['then'](respondWithResult(_0x3ba877,null))[_0x7d1e('0x44')](handleError(_0x3ba877,null));};exports[_0x7d1e('0x25')]=function(_0x54cdf5,_0x1b48cd){return db[_0x7d1e('0x2c')][_0x7d1e('0x49')]({'where':{'id':_0x54cdf5[_0x7d1e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b48cd,null))[_0x7d1e('0x26')](removeEntity(_0x1b48cd,null))[_0x7d1e('0x44')](handleError(_0x1b48cd,null));};exports[_0x7d1e('0x4d')]=function(_0x5cc2a1,_0x2ba63b){return db[_0x7d1e('0x2c')][_0x7d1e('0x4d')]()[_0x7d1e('0x26')](respondWithResult(_0x2ba63b,null))[_0x7d1e('0x44')](handleError(_0x2ba63b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 684bbb7..41545ca 100644 --- a/server/api/chatTransferReport/chatTransferReport.model.js +++ b/server/api/chatTransferReport/chatTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x210b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x5b8476,_0x30945c){var _0x46cf96=function(_0x234a89){while(--_0x234a89){_0x5b8476['push'](_0x5b8476['shift']());}};_0x46cf96(++_0x30945c);}(_0x210b,0x74));var _0xb210=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x210b[_0xbc346f];return _0x9f9260;};'use strict';var _=require(_0xb210('0x0'));var util=require(_0xb210('0x1'));var logger=require(_0xb210('0x2'))(_0xb210('0x3'));var moment=require(_0xb210('0x4'));var BPromise=require(_0xb210('0x5'));var rp=require(_0xb210('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb210('0x7'));var config=require('../../config/environment');var attributes=require(_0xb210('0x8'));module[_0xb210('0x9')]=function(_0x39ef17,_0x3e7149){return _0x39ef17['define'](_0xb210('0xa'),attributes,{'tableName':_0xb210('0xb'),'paranoid':![],'indexes':[{'name':_0xb210('0xc'),'fields':[_0xb210('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61fb=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','util'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x61fb,0x15b));var _0xb61f=function(_0x49bb97,_0x4a633b){_0x49bb97=_0x49bb97-0x0;var _0x13d6aa=_0x61fb[_0x49bb97];return _0x13d6aa;};'use strict';var _=require('lodash');var util=require(_0xb61f('0x0'));var logger=require(_0xb61f('0x1'))(_0xb61f('0x2'));var moment=require('moment');var BPromise=require(_0xb61f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb61f('0x4'));var rimraf=require(_0xb61f('0x5'));var config=require(_0xb61f('0x6'));var attributes=require(_0xb61f('0x7'));module['exports']=function(_0xb064cc,_0x4ffbdc){return _0xb064cc[_0xb61f('0x8')](_0xb61f('0x9'),attributes,{'tableName':_0xb61f('0xa'),'paranoid':![],'indexes':[{'name':_0xb61f('0xb'),'fields':[_0xb61f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 28d0222..809e8b2 100644 --- a/server/api/chatTransferReport/chatTransferReport.rpc.js +++ b/server/api/chatTransferReport/chatTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8f5=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c0194,_0x4f8c24){var _0x5372c6=function(_0x3c6bf2){while(--_0x3c6bf2){_0x5c0194['push'](_0x5c0194['shift']());}};_0x5372c6(++_0x4f8c24);}(_0xb8f5,0xc7));var _0x5b8f=function(_0x3fd10c,_0x444b43){_0x3fd10c=_0x3fd10c-0x0;var _0x3fc148=_0xb8f5[_0x3fd10c];return _0x3fc148;};'use strict';var _=require(_0x5b8f('0x0'));var util=require(_0x5b8f('0x1'));var moment=require(_0x5b8f('0x2'));var BPromise=require(_0x5b8f('0x3'));var rs=require(_0x5b8f('0x4'));var fs=require('fs');var Redis=require(_0x5b8f('0x5'));var db=require(_0x5b8f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b8f('0x7'));var config=require(_0x5b8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5b8f('0x9')][_0x5b8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb351,_0x4d748d,_0x131f66){return new BPromise(function(_0x53900e,_0x662fe2){return client[_0x5b8f('0xb')](_0x2bb351,_0x131f66)[_0x5b8f('0xc')](function(_0x5ae0d5){logger[_0x5b8f('0xd')](_0x5b8f('0xe'),_0x4d748d,_0x5b8f('0xf'));logger[_0x5b8f('0x10')](_0x5b8f('0x11'),_0x4d748d,'request\x20sent',JSON[_0x5b8f('0x12')](_0x5ae0d5));if(_0x5ae0d5[_0x5b8f('0x13')]){if(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x14')]===0x1f4){logger[_0x5b8f('0x13')](_0x5b8f('0xe'),_0x4d748d,_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);return _0x662fe2(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);}logger[_0x5b8f('0x13')](_0x5b8f('0xe'),_0x4d748d,_0x5ae0d5[_0x5b8f('0x13')]['message']);return _0x53900e(_0x5ae0d5[_0x5b8f('0x13')][_0x5b8f('0x15')]);}else{logger[_0x5b8f('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4d748d,_0x5b8f('0xf'));_0x53900e(_0x5ae0d5[_0x5b8f('0x16')][_0x5b8f('0x15')]);}})[_0x5b8f('0x17')](function(_0x21cc49){logger['error'](_0x5b8f('0xe'),_0x4d748d,_0x21cc49);_0x662fe2(_0x21cc49);});});} \ No newline at end of file +var _0x2615=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','debug'];(function(_0x9e5f1d,_0xd17705){var _0x47a99a=function(_0x5b9821){while(--_0x5b9821){_0x9e5f1d['push'](_0x9e5f1d['shift']());}};_0x47a99a(++_0xd17705);}(_0x2615,0xed));var _0x5261=function(_0x51c560,_0x4e6c0e){_0x51c560=_0x51c560-0x0;var _0x594579=_0x2615[_0x51c560];return _0x594579;};'use strict';var _=require(_0x5261('0x0'));var util=require(_0x5261('0x1'));var moment=require(_0x5261('0x2'));var BPromise=require('bluebird');var rs=require(_0x5261('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5261('0x4'))['db'];var utils=require(_0x5261('0x5'));var logger=require('../../config/logger')(_0x5261('0x6'));var config=require(_0x5261('0x7'));var jayson=require(_0x5261('0x8'));var client=jayson[_0x5261('0x9')][_0x5261('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bec29,_0x1fab34,_0x3aae8b){return new BPromise(function(_0x508bb5,_0x2715c8){return client['request'](_0x4bec29,_0x3aae8b)[_0x5261('0xb')](function(_0x5185c2){logger[_0x5261('0xc')](_0x5261('0xd'),_0x1fab34,'request\x20sent');logger[_0x5261('0xe')](_0x5261('0xf'),_0x1fab34,'request\x20sent',JSON[_0x5261('0x10')](_0x5185c2));if(_0x5185c2[_0x5261('0x11')]){if(_0x5185c2['error']['code']===0x1f4){logger[_0x5261('0x11')](_0x5261('0xd'),_0x1fab34,_0x5185c2[_0x5261('0x11')]['message']);return _0x2715c8(_0x5185c2[_0x5261('0x11')]['message']);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1fab34,_0x5185c2[_0x5261('0x11')][_0x5261('0x12')]);return _0x508bb5(_0x5185c2[_0x5261('0x11')][_0x5261('0x12')]);}else{logger[_0x5261('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x1fab34,_0x5261('0x13'));_0x508bb5(_0x5185c2['result'][_0x5261('0x12')]);}})[_0x5261('0x14')](function(_0xf203ee){logger['error'](_0x5261('0xd'),_0x1fab34,_0xf203ee);_0x2715c8(_0xf203ee);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0d5634c..e06fe8e 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9d6=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe9d6,0x67));var _0x6e9d=function(_0x459af2,_0x8dc490){_0x459af2=_0x459af2-0x0;var _0xfada3c=_0xe9d6[_0x459af2];return _0xfada3c;};'use strict';var multer=require(_0x6e9d('0x0'));var util=require(_0x6e9d('0x1'));var path=require(_0x6e9d('0x2'));var timeout=require(_0x6e9d('0x3'));var express=require(_0x6e9d('0x4'));var router=express[_0x6e9d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6e9d('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x6e9d('0x7')]('/',auth[_0x6e9d('0x8')](),controller[_0x6e9d('0x9')]);router[_0x6e9d('0x7')](_0x6e9d('0xa'),auth[_0x6e9d('0x8')](),controller[_0x6e9d('0xb')]);router[_0x6e9d('0x7')](_0x6e9d('0xc'),auth['isAuthenticated'](),controller[_0x6e9d('0xd')]);router[_0x6e9d('0xe')]('/',auth['isAuthenticated'](),controller[_0x6e9d('0xf')]);router[_0x6e9d('0x10')](_0x6e9d('0xc'),auth[_0x6e9d('0x8')](),controller['update']);router[_0x6e9d('0x11')]('/:id',auth[_0x6e9d('0x8')](),controller[_0x6e9d('0x12')]);module[_0x6e9d('0x13')]=router; \ No newline at end of file +var _0x2983=['create','put','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','/:id','post'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2983,0x18b));var _0x3298=function(_0x2a0048,_0x2cc4a8){_0x2a0048=_0x2a0048-0x0;var _0x4e5dd1=_0x2983[_0x2a0048];return _0x4e5dd1;};'use strict';var multer=require(_0x3298('0x0'));var util=require(_0x3298('0x1'));var path=require('path');var timeout=require(_0x3298('0x2'));var express=require('express');var router=express[_0x3298('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3298('0x4'));var interaction=require(_0x3298('0x5'));var config=require(_0x3298('0x6'));var controller=require(_0x3298('0x7'));router[_0x3298('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3298('0x8')]('/describe',auth[_0x3298('0x9')](),controller[_0x3298('0xa')]);router[_0x3298('0x8')](_0x3298('0xb'),auth[_0x3298('0x9')](),controller['show']);router[_0x3298('0xc')]('/',auth[_0x3298('0x9')](),controller[_0x3298('0xd')]);router[_0x3298('0xe')]('/:id',auth[_0x3298('0x9')](),controller['update']);router[_0x3298('0xf')](_0x3298('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3298('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 207b1e2..ace6af5 100644 --- a/server/api/chatWebsite/chatWebsite.attributes.js +++ b/server/api/chatWebsite/chatWebsite.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2750=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Send','Feedback','thumb','star','stringify','name','input','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2750,0x13b));var _0x0275=function(_0x2ae76b,_0x741258){_0x2ae76b=_0x2ae76b-0x0;var _0xc2448e=_0x2750[_0x2ae76b];return _0xc2448e;};'use strict';var Sequelize=require(_0x0275('0x0'));var rs=require('randomstring');module[_0x0275('0x1')]={'name':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'unique':_0x0275('0x3')},'description':{'type':Sequelize[_0x0275('0x2')]},'mapKey':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'mapKeyOffline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'key':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x5')},'customerAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0275('0xa')](_0x0275('0xb'),_0x0275('0xc')),'defaultValue':_0x0275('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0xd')},'start_chat_button':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xf')},'download_transcript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0275('0x11')]},'closingQuestion':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x13')},'noteTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x14')},'skipMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x15')},'ratingType':{'type':Sequelize['ENUM']('star',_0x0275('0x16')),'defaultValue':_0x0275('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0275('0x19'),'type':'text','required':!![]},'props':{'title':_0x0275('0x19'),'helpText':''}},{'type':_0x0275('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':_0x0275('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0275('0x1b')]('onlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x1d'))):{};},'set':function(_0x15813f){return this[_0x0275('0x1e')](_0x0275('0x1d'),JSON['stringify'](_0x15813f));}},'offlineForm':{'type':Sequelize[_0x0275('0x11')],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':_0x0275('0x1a'),'props':{'title':_0x0275('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':'email'},'variable':null},{'type':_0x0275('0x1f'),'config':{'placeholder':_0x0275('0x20')},'props':{'title':_0x0275('0x20'),'helpText':_0x0275('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x0275('0x1b')]('offlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x22'))):{};},'set':function(_0x489d7f){return this['setDataValue'](_0x0275('0x22'),JSON[_0x0275('0x18')](_0x489d7f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0275('0x23')]();}},'autoclose':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0275('0x2')]},'waitingTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x29')},'sendUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0275('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0275('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0275('0x2a');}},'notificationSound':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2c')},'verticalAlignment':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2d')},'defaultTitle':{'type':Sequelize[_0x0275('0x2')]},'customerAvatar':{'type':Sequelize[_0x0275('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0275('0x8')],'comment':_0x0275('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0275('0x31'),'set':function(_0x76b8fa){if(!_0x76b8fa)this[_0x0275('0x1e')](_0x0275('0x32'),null);this[_0x0275('0x1e')](_0x0275('0x33'),_0x76b8fa);}},'vidaooEscalation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x34')},'vidaooNote':{'type':Sequelize[_0x0275('0x2')],'defaultValue':function(){return _0x0275('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0275('0x11')]}}; \ No newline at end of file +var _0x22fb=['email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','TEXT','stringify','input','name','text','getDataValue','parse','setDataValue','textarea','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address'];(function(_0x1e3301,_0x257090){var _0xe9126b=function(_0x400954){while(--_0x400954){_0x1e3301['push'](_0x1e3301['shift']());}};_0xe9126b(++_0x257090);}(_0x22fb,0x192));var _0xb22f=function(_0x5413a4,_0x3c8ddc){_0x5413a4=_0x5413a4-0x0;var _0x3730ba=_0x22fb[_0x5413a4];return _0x3730ba;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb22f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'unique':_0xb22f('0x2')},'description':{'type':Sequelize[_0xb22f('0x1')]},'mapKey':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x3')},'key':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x4')},'customerAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb22f('0x1')]},'animation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0xa'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0xc')},'header_offline':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xd')},'download_transcript':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xf')},'noteTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x10')},'closingMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'skipMessageButton':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x12')},'ratingType':{'type':Sequelize[_0xb22f('0x9')](_0xb22f('0x13'),'thumb'),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'variable':null,'config':{'placeholder':_0xb22f('0x17'),'type':_0xb22f('0x18'),'required':!![]},'props':{'title':_0xb22f('0x17'),'helpText':''}},{'type':_0xb22f('0x16'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb22f('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb22f('0x19')]('onlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')]('onlineForm')):{};},'set':function(_0x4687f2){return this[_0xb22f('0x1b')]('onlineForm',JSON[_0xb22f('0x15')](_0x4687f2));}},'offlineForm':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return JSON[_0xb22f('0x15')]({'items':[{'type':_0xb22f('0x16'),'props':{'title':_0xb22f('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb22f('0x3'),'type':_0xb22f('0x3')},'variable':null},{'type':_0xb22f('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb22f('0x19')]('offlineForm')?JSON[_0xb22f('0x1a')](this[_0xb22f('0x19')](_0xb22f('0x1d'))):{};},'set':function(_0x413575){return this[_0xb22f('0x1b')]('offlineForm',JSON['stringify'](_0x413575));}},'token':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return rs[_0xb22f('0x1e')]();}},'autoclose':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb22f('0x1')]},'forwardOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x1f')},'waitingMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x20')},'offlineMessageSubject':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb22f('0x21')},'enableUnmanagedNote':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x22')},'skipUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x11')},'sendUnmanaged':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':function(){return _0xb22f('0x23');}},'notificationSound':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb22f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x25')},'verticalAlignment':{'type':Sequelize[_0xb22f('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':_0xb22f('0x26')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xb22f('0x1')]},'customerAvatar':{'type':Sequelize[_0xb22f('0x14')]},'showCustomerAvatar':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xb22f('0x14')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb22f('0x7')],'comment':_0xb22f('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb22f('0x29'),'set':function(_0x2d265c){if(!_0x2d265c)this[_0xb22f('0x1b')]('mandatoryDispositionPauseId',null);this[_0xb22f('0x1b')](_0xb22f('0x2a'),_0x2d265c);}},'vidaooEscalation':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb22f('0x1')]},'vidaooTopic':{'type':Sequelize[_0xb22f('0x1')],'allowNull':![],'defaultValue':_0xb22f('0x2b')},'vidaooNote':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':function(){return _0xb22f('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xb22f('0x14')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb22f('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b47721d..89fcef0 100644 --- a/server/api/chatWebsite/chatWebsite.controller.js +++ b/server/api/chatWebsite/chatWebsite.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa539=['getAnswers','removeAnswers','addLogo','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','ChatApplication','List','account','applications','Applications','orderBy','priority','ListId','from','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','basename','sequelize','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','email','user','openNewInteraction','MailAccountId','subjectOffline','mapValues','MailAccount','offlineMessageSubject','notifyMail','offline-chat','remove','addInteraction','omit','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','getProactiveActions','License','increment','Intervals','all','some','remote','stringify','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','getAgents','mustache','util','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer'];(function(_0x587fb1,_0x1fa311){var _0x5aa5d5=function(_0x5d96c7){while(--_0x5d96c7){_0x587fb1['push'](_0x587fb1['shift']());}};_0x5aa5d5(++_0x1fa311);}(_0xa539,0x1e9));var _0x9a53=function(_0x9a460d,_0x17c929){_0x9a460d=_0x9a460d-0x0;var _0x4b915a=_0xa539[_0x9a460d];return _0x4b915a;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x9a53('0x0'));var util=require(_0x9a53('0x1'));var path=require(_0x9a53('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a53('0x3'));var _=require(_0x9a53('0x4'));var querystring=require(_0x9a53('0x5'));var Redis=require(_0x9a53('0x6'));var qs=require(_0x9a53('0x7'));var logger=require('../../config/logger')(_0x9a53('0x8'));var config=require(_0x9a53('0x9'));var db=require(_0x9a53('0xa'))['db'];config[_0x9a53('0xb')]=_[_0x9a53('0xc')](config[_0x9a53('0xb')],{'host':_0x9a53('0xd'),'port':0x18eb});var socket=require(_0x9a53('0xe'))(new Redis(config[_0x9a53('0xb')]));require(_0x9a53('0xf'))[_0x9a53('0x10')](socket);var htmlToText=require(_0x9a53('0x11'));var jayson=require(_0x9a53('0x12'));var client=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232c});var client9002=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232a});var client9003=jayson[_0x9a53('0x13')][_0x9a53('0x14')]({'port':0x232b});var client9001=jayson[_0x9a53('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3ab0d3,_0x5c0650,_0x245ba1,_0x46bc5e){return new BPromise(function(_0x538255,_0x3b08c3){var _0x3322a8=_0x46bc5e||client;return _0x3322a8[_0x9a53('0x15')](_0x3ab0d3,_0x245ba1)[_0x9a53('0x16')](function(_0x2eeff2){logger['info'](_0x9a53('0x17'),_0x5c0650,_0x9a53('0x18'));logger[_0x9a53('0x19')](_0x9a53('0x1a'),_0x5c0650,'request\x20sent',JSON['stringify'](_0x2eeff2));if(_0x2eeff2[_0x9a53('0x1b')]){if(_0x2eeff2['error']['code']===0x1f4){logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2eeff2[_0x9a53('0x1b')][_0x9a53('0x1c')]);return _0x3b08c3(_0x2eeff2[_0x9a53('0x1b')]['message']);}logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2eeff2[_0x9a53('0x1b')][_0x9a53('0x1c')]);return _0x538255(_0x2eeff2['error'][_0x9a53('0x1c')]);}else{logger['info'](_0x9a53('0x17'),_0x5c0650,'request\x20sent');_0x538255(_0x2eeff2[_0x9a53('0x1d')][_0x9a53('0x1c')]);}})[_0x9a53('0x1e')](function(_0x2255ac){logger[_0x9a53('0x1b')](_0x9a53('0x17'),_0x5c0650,_0x2255ac);_0x3b08c3(_0x2255ac);});});}function respondWithStatusCode(_0x136657,_0x21abb9){_0x21abb9=_0x21abb9||0xcc;return function(_0x4cc45e){if(_0x4cc45e){return _0x136657['sendStatus'](_0x21abb9);}return _0x136657[_0x9a53('0x1f')](_0x21abb9)[_0x9a53('0x20')]();};}function respondWithResult(_0x461f00,_0x592af1){_0x592af1=_0x592af1||0xc8;return function(_0x2d602d){if(_0x2d602d){return _0x461f00[_0x9a53('0x1f')](_0x592af1)[_0x9a53('0x21')](_0x2d602d);}};}function respondWithFilteredResult(_0x288300,_0x2671b1){return function(_0x551c1d){if(_0x551c1d){var _0x3456b3=typeof _0x2671b1['offset']==='undefined'&&typeof _0x2671b1[_0x9a53('0x22')]==='undefined';var _0x24aad7=_0x551c1d[_0x9a53('0x23')];var _0x2a92b1=_0x3456b3?0x0:_0x2671b1[_0x9a53('0x24')];var _0x507ceb=_0x3456b3?_0x551c1d['count']:_0x2671b1[_0x9a53('0x24')]+_0x2671b1['limit'];var _0x18f9d5;if(_0x507ceb>=_0x24aad7){_0x507ceb=_0x24aad7;_0x18f9d5=0xc8;}else{_0x18f9d5=0xce;}_0x288300[_0x9a53('0x1f')](_0x18f9d5);return _0x288300[_0x9a53('0x25')](_0x9a53('0x26'),_0x2a92b1+'-'+_0x507ceb+'/'+_0x24aad7)[_0x9a53('0x21')](_0x551c1d);}return null;};}function saveUpdates(_0xa5150b){return function(_0x20e6aa){if(_0x20e6aa){return _0x20e6aa[_0x9a53('0x27')](_0xa5150b)[_0x9a53('0x16')](function(_0x2be02a){return _0x2be02a;});}return null;};}function removeEntity(_0x400947){return function(_0x227f22){if(_0x227f22){return _0x227f22[_0x9a53('0x28')]()[_0x9a53('0x16')](function(){var _0x4b3fdb=_0x227f22[_0x9a53('0x29')]({'plain':!![]});var _0x3f48b1=_0x9a53('0x2a');return db['UserProfileResource'][_0x9a53('0x28')]({'where':{'type':_0x3f48b1,'resourceId':_0x4b3fdb['id']}})[_0x9a53('0x16')](function(){return _0x227f22;});})['then'](function(){_0x400947[_0x9a53('0x1f')](0xcc)[_0x9a53('0x20')]();});}};}function handleEntityNotFound(_0x4e8aeb){return function(_0x16e9a1){if(!_0x16e9a1){_0x4e8aeb[_0x9a53('0x2b')](0x194);}return _0x16e9a1;};}function handleError(_0x4f9218,_0x5d429d){_0x5d429d=_0x5d429d||0x1f4;return function(_0x2d1d9a){logger[_0x9a53('0x1b')](_0x2d1d9a['stack']);if(_0x2d1d9a[_0x9a53('0x2c')]){delete _0x2d1d9a[_0x9a53('0x2c')];}_0x4f9218[_0x9a53('0x1f')](_0x5d429d)[_0x9a53('0x2d')](_0x2d1d9a);};}exports[_0x9a53('0x2e')]=function(_0x396720,_0x1fc9b8){var _0x4ed0c5={'include':[{'model':db[_0x9a53('0x2f')],'as':_0x9a53('0x30')}]},_0x11c839={},_0x5efec8={'count':0x0,'rows':[]};var _0x205b66=_[_0x9a53('0x31')](db[_0x9a53('0x32')][_0x9a53('0x33')],function(_0x16014e){return{'name':_0x16014e[_0x9a53('0x34')],'type':_0x16014e[_0x9a53('0x35')][_0x9a53('0x36')]};});_0x11c839['model']=_['map'](_0x205b66,'name');_0x11c839[_0x9a53('0x37')]=_['keys'](_0x396720['query']);_0x11c839[_0x9a53('0x38')]=_['intersection'](_0x11c839[_0x9a53('0x39')],_0x11c839[_0x9a53('0x37')]);_0x4ed0c5[_0x9a53('0x3a')]=_['intersection'](_0x11c839[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x396720[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x4ed0c5[_0x9a53('0x3a')]=_0x4ed0c5[_0x9a53('0x3a')]['length']?_0x4ed0c5[_0x9a53('0x3a')]:_0x11c839[_0x9a53('0x39')];if(!_0x396720[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x4ed0c5['limit']=qs[_0x9a53('0x22')](_0x396720[_0x9a53('0x37')][_0x9a53('0x22')]);_0x4ed0c5[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x396720[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x4ed0c5['order']=qs[_0x9a53('0x3e')](_0x396720[_0x9a53('0x37')]['sort']);_0x4ed0c5['where']=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x396720[_0x9a53('0x37')],_0x11c839['filters']),_0x205b66);if(_0x396720[_0x9a53('0x37')][_0x9a53('0x40')]){_0x4ed0c5[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x4ed0c5[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x205b66,function(_0x2fe36e){if(_0x2fe36e[_0x9a53('0x35')]!==_0x9a53('0x43')){var _0x38cd58={};_0x38cd58[_0x2fe36e[_0x9a53('0x2c')]]={'$like':'%'+_0x396720[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x38cd58;}})});}_0x4ed0c5=_[_0x9a53('0x42')]({},_0x4ed0c5,_0x396720[_0x9a53('0x44')]);var _0x86e2ab={'where':_0x4ed0c5[_0x9a53('0x41')]};return db[_0x9a53('0x32')]['count'](_0x86e2ab)[_0x9a53('0x16')](function(_0x408253){_0x5efec8[_0x9a53('0x23')]=_0x408253;if(_0x396720[_0x9a53('0x37')][_0x9a53('0x45')]){_0x4ed0c5[_0x9a53('0x46')]=[{'all':!![]}];}return db[_0x9a53('0x32')][_0x9a53('0x47')](_0x4ed0c5);})[_0x9a53('0x16')](function(_0x5f16df){_0x5efec8[_0x9a53('0x48')]=_0x5f16df;return _0x5efec8;})[_0x9a53('0x16')](respondWithFilteredResult(_0x1fc9b8,_0x4ed0c5))[_0x9a53('0x1e')](handleError(_0x1fc9b8,null));};exports[_0x9a53('0x49')]=function(_0x253f14,_0x455d0c){var _0x595000={'raw':![],'where':{'id':_0x253f14[_0x9a53('0x4a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x20157c={};_0x20157c[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db[_0x9a53('0x32')][_0x9a53('0x33')]);_0x20157c[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x253f14[_0x9a53('0x37')]);_0x20157c[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x20157c[_0x9a53('0x39')],_0x20157c[_0x9a53('0x37')]);_0x595000[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x20157c[_0x9a53('0x39')],qs['fields'](_0x253f14['query'][_0x9a53('0x3b')]));_0x595000[_0x9a53('0x3a')]=_0x595000['attributes'][_0x9a53('0x4d')]?_0x595000[_0x9a53('0x3a')]:_0x20157c['model'];if(_0x253f14[_0x9a53('0x37')]['includeAll']){_0x595000[_0x9a53('0x46')]=[{'all':!![]}];}_0x595000=_[_0x9a53('0x42')]({},_0x595000,_0x253f14['options']);return db['ChatWebsite'][_0x9a53('0x4e')](_0x595000)[_0x9a53('0x16')](handleEntityNotFound(_0x455d0c,null))['then'](respondWithResult(_0x455d0c,null))['catch'](handleError(_0x455d0c,null));};exports['create']=function(_0x26faa7,_0x2a547a){return db[_0x9a53('0x32')][_0x9a53('0x4f')](_0x26faa7[_0x9a53('0x50')],{})[_0x9a53('0x16')](function(_0x38d68a){var _0x41784f=_0x26faa7['user']['get']({'plain':!![]});if(!_0x41784f)throw new Error(_0x9a53('0x51'));if(_0x41784f[_0x9a53('0x52')]==='user'){var _0x7b40f0=_0x38d68a['get']({'plain':!![]});var _0x50b6c8=_0x9a53('0x2a');return db[_0x9a53('0x53')]['find']({'where':{'name':_0x50b6c8,'userProfileId':_0x41784f[_0x9a53('0x54')]},'raw':!![]})[_0x9a53('0x16')](function(_0x21831b){if(_0x21831b&&_0x21831b[_0x9a53('0x55')]===0x0){return db[_0x9a53('0x56')][_0x9a53('0x4f')]({'name':_0x7b40f0[_0x9a53('0x2c')],'resourceId':_0x7b40f0['id'],'type':_0x21831b[_0x9a53('0x2c')],'sectionId':_0x21831b['id']},{})[_0x9a53('0x16')](function(){return _0x38d68a;});}else{return _0x38d68a;}})[_0x9a53('0x1e')](function(_0x52c235){logger[_0x9a53('0x1b')](_0x9a53('0x57'),_0x52c235);throw _0x52c235;});}return _0x38d68a;})[_0x9a53('0x16')](respondWithResult(_0x2a547a,0xc9))['catch'](handleError(_0x2a547a,null));};exports[_0x9a53('0x27')]=function(_0x1b5a5a,_0x45e76c){if(_0x1b5a5a['body']['id']){delete _0x1b5a5a[_0x9a53('0x50')]['id'];}return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1b5a5a[_0x9a53('0x4a')]['id']},'include':[{'model':db[_0x9a53('0x2f')],'as':_0x9a53('0x30')}]})[_0x9a53('0x16')](handleEntityNotFound(_0x45e76c,null))[_0x9a53('0x16')](saveUpdates(_0x1b5a5a[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x45e76c,null))[_0x9a53('0x1e')](handleError(_0x45e76c,null));};exports['destroy']=function(_0x192d55,_0xb812fd){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x192d55['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0xb812fd,null))[_0x9a53('0x16')](removeEntity(_0xb812fd,null))[_0x9a53('0x1e')](handleError(_0xb812fd,null));};exports[_0x9a53('0x58')]=function(_0x4602be,_0x3ff117){return db[_0x9a53('0x32')][_0x9a53('0x58')]()[_0x9a53('0x16')](respondWithResult(_0x3ff117,null))['catch'](handleError(_0x3ff117,null));};exports[_0x9a53('0x59')]=function(_0x1513d8,_0x2b9575){if(_0x1513d8[_0x9a53('0x50')]['id']){delete _0x1513d8[_0x9a53('0x50')]['id'];}return db['ChatWebsite'][_0x9a53('0x4e')]({'where':{'id':_0x1513d8[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x2b9575,null))['then'](function(_0x17e26e){if(_0x17e26e){_0x1513d8[_0x9a53('0x50')][_0x9a53('0x5a')]=_0x17e26e['id'];return db['Disposition'][_0x9a53('0x4f')](_0x1513d8[_0x9a53('0x50')]);}})[_0x9a53('0x16')](respondWithResult(_0x2b9575,null))[_0x9a53('0x1e')](handleError(_0x2b9575,null));};exports[_0x9a53('0x5b')]=function(_0x3a55bf,_0x430277){var _0x51967b={'raw':![],'where':{}};var _0x6fcca={};var _0x420564={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9a53('0x5c')]({'where':{'id':_0x3a55bf[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x430277,null))[_0x9a53('0x16')](function(_0x1d87a8){if(_0x1d87a8){_0x6fcca[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['Disposition']['rawAttributes']);_0x6fcca[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x3a55bf['query']);_0x6fcca[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x6fcca[_0x9a53('0x39')],_0x6fcca['query']);_0x51967b[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x6fcca['model'],qs[_0x9a53('0x3b')](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x51967b[_0x9a53('0x3a')]=_0x51967b[_0x9a53('0x3a')]['length']?_0x51967b[_0x9a53('0x3a')]:_0x6fcca[_0x9a53('0x39')];if(!_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x51967b[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x3a55bf['query'][_0x9a53('0x22')]);_0x51967b[_0x9a53('0x24')]=qs['offset'](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x51967b[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x51967b[_0x9a53('0x41')]=qs['filters'](_[_0x9a53('0x3f')](_0x3a55bf['query'],_0x6fcca[_0x9a53('0x38')]));_0x51967b[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x1d87a8['id'];if(_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x40')]){_0x51967b[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x51967b[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x51967b[_0x9a53('0x3a')],function(_0xc15f6){var _0x2f34fc={};_0x2f34fc[_0xc15f6]={'$like':'%'+_0x3a55bf['query'][_0x9a53('0x40')]+'%'};return _0x2f34fc;})});}_0x51967b=_['merge']({},_0x51967b,_0x3a55bf[_0x9a53('0x44')]);return db[_0x9a53('0x5e')]['count']({'where':_0x51967b[_0x9a53('0x41')]})[_0x9a53('0x16')](function(_0x1f0c1a){_0x420564[_0x9a53('0x23')]=_0x1f0c1a;if(_0x3a55bf[_0x9a53('0x37')][_0x9a53('0x45')]){_0x51967b[_0x9a53('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x51967b);})['then'](function(_0x367260){_0x420564[_0x9a53('0x48')]=_0x367260;return _0x420564;});}})['then'](respondWithFilteredResult(_0x430277,_0x51967b))[_0x9a53('0x1e')](handleError(_0x430277,null));};exports[_0x9a53('0x5f')]=function(_0x2d99a8,_0x482e3f){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x2d99a8[_0x9a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x482e3f,null))['then'](function(_0xfe4319){if(_0xfe4319){return _0xfe4319[_0x9a53('0x5f')](_0x2d99a8[_0x9a53('0x37')][_0x9a53('0x60')]);}})['then'](respondWithStatusCode(_0x482e3f,null))[_0x9a53('0x1e')](handleError(_0x482e3f,null));};exports[_0x9a53('0x61')]=function(_0xd65fe3,_0x15f396){if(_0xd65fe3['body']['id']){delete _0xd65fe3[_0x9a53('0x50')]['id'];}return db[_0x9a53('0x32')]['find']({'where':{'id':_0xd65fe3['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x15f396,null))['then'](function(_0x41bcad){if(_0x41bcad){_0xd65fe3[_0x9a53('0x50')][_0x9a53('0x5a')]=_0x41bcad['id'];return db[_0x9a53('0x62')][_0x9a53('0x4f')](_0xd65fe3[_0x9a53('0x50')]);}})[_0x9a53('0x16')](respondWithResult(_0x15f396,null))[_0x9a53('0x1e')](handleError(_0x15f396,null));};exports[_0x9a53('0x63')]=function(_0x5ebba2,_0x568b7b){var _0xba0dd0={'raw':![],'where':{}};var _0x3fe61d={};var _0x1fd699={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0x5ebba2['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x568b7b,null))['then'](function(_0x22ddb5){if(_0x22ddb5){_0x3fe61d[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['CannedAnswer']['rawAttributes']);_0x3fe61d[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x5ebba2[_0x9a53('0x37')]);_0x3fe61d['filters']=_[_0x9a53('0x4c')](_0x3fe61d['model'],_0x3fe61d[_0x9a53('0x37')]);_0xba0dd0[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x3fe61d['model'],qs[_0x9a53('0x3b')](_0x5ebba2['query']['fields']));_0xba0dd0[_0x9a53('0x3a')]=_0xba0dd0[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0xba0dd0[_0x9a53('0x3a')]:_0x3fe61d[_0x9a53('0x39')];if(!_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0xba0dd0[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x5ebba2['query'][_0x9a53('0x22')]);_0xba0dd0[_0x9a53('0x24')]=qs['offset'](_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x24')]);}_0xba0dd0['order']=qs[_0x9a53('0x3e')](_0x5ebba2[_0x9a53('0x37')]['sort']);_0xba0dd0[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_['pick'](_0x5ebba2[_0x9a53('0x37')],_0x3fe61d[_0x9a53('0x38')]));_0xba0dd0[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x22ddb5['id'];if(_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x40')]){_0xba0dd0[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0xba0dd0[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0xba0dd0[_0x9a53('0x3a')],function(_0x4564da){var _0x3d98e0={};_0x3d98e0[_0x4564da]={'$like':'%'+_0x5ebba2['query'][_0x9a53('0x40')]+'%'};return _0x3d98e0;})});}_0xba0dd0=_[_0x9a53('0x42')]({},_0xba0dd0,_0x5ebba2[_0x9a53('0x44')]);return db[_0x9a53('0x62')][_0x9a53('0x23')]({'where':_0xba0dd0['where']})[_0x9a53('0x16')](function(_0x17530e){_0x1fd699[_0x9a53('0x23')]=_0x17530e;if(_0x5ebba2[_0x9a53('0x37')][_0x9a53('0x45')]){_0xba0dd0[_0x9a53('0x46')]=[{'all':!![]}];}return db[_0x9a53('0x62')][_0x9a53('0x47')](_0xba0dd0);})[_0x9a53('0x16')](function(_0x19b52b){_0x1fd699[_0x9a53('0x48')]=_0x19b52b;return _0x1fd699;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x568b7b,_0xba0dd0))[_0x9a53('0x1e')](handleError(_0x568b7b,null));};exports[_0x9a53('0x64')]=function(_0x230c64,_0x36fffa){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x230c64[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x36fffa,null))[_0x9a53('0x16')](function(_0x11ce42){if(_0x11ce42){return _0x11ce42['removeAnswers'](_0x230c64['query'][_0x9a53('0x60')]);}})[_0x9a53('0x16')](respondWithStatusCode(_0x36fffa,null))[_0x9a53('0x1e')](handleError(_0x36fffa,null));};exports[_0x9a53('0x65')]=function(_0x57389f,_0x584502){_0x57389f[_0x9a53('0x50')]['sitepic']=_0x57389f['file']['filename'];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x57389f[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x584502,null))[_0x9a53('0x16')](saveUpdates(_0x57389f[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x584502,null))['catch'](handleError(_0x584502,null));};exports[_0x9a53('0x66')]=function(_0x1158aa,_0x144242){_0x1158aa[_0x9a53('0x50')][_0x9a53('0x67')]=_0x1158aa[_0x9a53('0x68')][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1158aa[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x144242,null))['then'](saveUpdates(_0x1158aa['body'],null))[_0x9a53('0x16')](respondWithResult(_0x144242,null))[_0x9a53('0x1e')](handleError(_0x144242,null));};exports[_0x9a53('0x6a')]=function(_0x547f10,_0x4f4d70){_0x547f10[_0x9a53('0x50')][_0x9a53('0x6b')]=_0x547f10[_0x9a53('0x68')][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x547f10[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x4f4d70,null))[_0x9a53('0x16')](saveUpdates(_0x547f10[_0x9a53('0x50')],null))['then'](respondWithResult(_0x4f4d70,null))[_0x9a53('0x1e')](handleError(_0x4f4d70,null));};exports[_0x9a53('0x6c')]=function(_0x296c15,_0x33c79e){_0x296c15[_0x9a53('0x50')][_0x9a53('0x6d')]=_0x296c15['file'][_0x9a53('0x69')];return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x296c15[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x33c79e,null))[_0x9a53('0x16')](saveUpdates(_0x296c15[_0x9a53('0x50')],null))[_0x9a53('0x16')](respondWithResult(_0x33c79e,null))[_0x9a53('0x1e')](handleError(_0x33c79e,null));};exports[_0x9a53('0x6e')]=function(_0x1ed85c,_0x488642){var _0x2a3d84=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x71'));var _0x11b52b={'where':{'id':_0x1ed85c[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x72')],'raw':!![]};var _0x19a5e4=![];return require(_0x9a53('0x73'))[_0x9a53('0x74')]()[_0x9a53('0x16')](function(_0x8c39ad){if(_0x8c39ad){_0x19a5e4=_0x8c39ad[_0x9a53('0x75')];}})[_0x9a53('0x16')](function(){return db[_0x9a53('0x32')][_0x9a53('0x4e')](_0x11b52b);})[_0x9a53('0x16')](handleEntityNotFound(_0x488642,null))[_0x9a53('0x16')](function(_0x3ec5ef){if(_0x3ec5ef){if(!_[_0x9a53('0x76')](_0x3ec5ef[_0x9a53('0x72')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x78'),_0x3ec5ef[_0x9a53('0x72')]))&&_0x19a5e4){_0x2a3d84=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/logos/',_0x3ec5ef[_0x9a53('0x72')]);}}return _0x488642[_0x9a53('0x79')](_0x2a3d84);}})[_0x9a53('0x1e')](handleError(_0x488642,null));};exports[_0x9a53('0x7a')]=function(_0x89f352,_0x27f58a){var _0x2d77d9=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/avatars/default_avatar.png');var _0x41c4f2={'where':{'id':_0x89f352[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x67')],'raw':!![]};return db[_0x9a53('0x32')]['find'](_0x41c4f2)[_0x9a53('0x16')](handleEntityNotFound(_0x27f58a,null))[_0x9a53('0x16')](function(_0x4823ab){if(_0x4823ab){if(!_[_0x9a53('0x76')](_0x4823ab[_0x9a53('0x67')])){if(fs['existsSync'](path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x4823ab[_0x9a53('0x67')]))){_0x2d77d9=path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x4823ab[_0x9a53('0x67')]);}}return _0x27f58a['download'](_0x2d77d9);}})[_0x9a53('0x1e')](handleError(_0x27f58a,null));};exports[_0x9a53('0x7c')]=function(_0x58787b,_0x24af34){var _0x5885c3=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7d'));var _0x1cb6a8={'where':{'id':_0x58787b[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x6b'),_0x9a53('0x7e')],'raw':!![]};return db['ChatWebsite']['find'](_0x1cb6a8)['then'](handleEntityNotFound(_0x24af34,null))[_0x9a53('0x16')](function(_0x27c9a7){if(_0x27c9a7){if(!_[_0x9a53('0x76')](_0x27c9a7[_0x9a53('0x6b')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config['root'],_0x9a53('0x7b'),_0x27c9a7[_0x9a53('0x6b')]))&&_0x27c9a7[_0x9a53('0x7e')]){_0x5885c3=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/images/avatars/',_0x27c9a7['customerAvatar']);}}return _0x24af34[_0x9a53('0x79')](_0x5885c3);}})['catch'](handleError(_0x24af34,null));};exports[_0x9a53('0x7f')]=function(_0x531ad4,_0x53462a){var _0xb485e5=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x80'));var _0x5c8a46={'where':{'id':_0x531ad4[_0x9a53('0x4a')]['id']},'attributes':['id',_0x9a53('0x6d')],'raw':!![]};return db['ChatWebsite'][_0x9a53('0x4e')](_0x5c8a46)[_0x9a53('0x16')](handleEntityNotFound(_0x53462a,null))[_0x9a53('0x16')](function(_0x3b58e4){if(_0x3b58e4){if(!_[_0x9a53('0x76')](_0x3b58e4[_0x9a53('0x6d')])){if(fs[_0x9a53('0x77')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7b'),_0x3b58e4[_0x9a53('0x6d')]))){_0xb485e5=path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0x7b'),_0x3b58e4[_0x9a53('0x6d')]);}}return _0x53462a[_0x9a53('0x79')](_0xb485e5);}})['catch'](handleError(_0x53462a,null));};exports[_0x9a53('0x81')]=function(_0x1bec48,_0x58f832){var _0x35f46f=require(_0x9a53('0x82'));var _0x57ae27=new _0x35f46f();var _0x1b764c=_0x57ae27[_0x9a53('0x83')](_0x1bec48['headers'][_0x9a53('0x84')])['getResult']();var _0x1a7302={'body':_0x1bec48[_0x9a53('0x50')],'channel':'chat'};var _0x2df2c7=[];var _0x6b1a36=[];var _0x4a1c16={};var _0x17738e=![];return db[_0x9a53('0x85')]['describe']()['then'](function(_0x146ac3){if(!_0x146ac3){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x88'));}_0x2df2c7=_[_0x9a53('0x89')](_[_0x9a53('0x4b')](_0x146ac3),[_0x9a53('0x8a'),_0x9a53('0x8b')]);_0x6b1a36=_[_0x9a53('0x89')](_['keys'](_0x146ac3),[_0x9a53('0x8a'),'updatedAt',_0x9a53('0x8c'),'ListId']);if(_0x1bec48[_0x9a53('0x50')]['id']){delete _0x1bec48[_0x9a53('0x50')]['id'];}if(_[_0x9a53('0x76')](_0x1bec48[_0x9a53('0x50')]['from'])){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x8d'));}if(_['isNil'](_0x1bec48[_0x9a53('0x50')][_0x9a53('0x50')])||_0x1bec48[_0x9a53('0x50')]['body']===''){throw new db[(_0x9a53('0x86'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9a53('0x76')](_0x1bec48[_0x9a53('0x50')][_0x9a53('0x8e')])){throw new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6b1a36);}if(!_[_0x9a53('0x8f')](_0x6b1a36,_0x1bec48[_0x9a53('0x50')][_0x9a53('0x8e')])){throw new db[(_0x9a53('0x86'))]['ValidationError'](_0x9a53('0x90')+_0x6b1a36);}_0x4a1c16[_0x1bec48['body'][_0x9a53('0x8e')]]=_0x1bec48[_0x9a53('0x50')]['from'];})[_0x9a53('0x16')](function(){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1bec48['params']['id']},'include':[{'model':db[_0x9a53('0x91')],'as':'List','include':[{'model':db[_0x9a53('0x85')],'as':_0x9a53('0x92'),'where':_0x4a1c16,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x9a53('0x93')],'as':'Applications'}]});})[_0x9a53('0x16')](handleEntityNotFound(_0x58f832,null))[_0x9a53('0x16')](function(_0x478c2f){if(_0x478c2f&&_0x478c2f[_0x9a53('0x94')]){_0x1a7302[_0x9a53('0x95')]=_0x478c2f;_0x1a7302[_0x9a53('0x96')]=_0x478c2f[_0x9a53('0x97')];_0x1a7302['list']=_0x478c2f[_0x9a53('0x94')];_0x1a7302[_0x9a53('0x96')]=_[_0x9a53('0x98')](_0x1a7302[_0x9a53('0x96')],[_0x9a53('0x99')],['asc']);if(_0x1a7302['account'][_0x9a53('0x97')]){delete _0x1a7302[_0x9a53('0x95')][_0x9a53('0x97')];}if(_0x1a7302[_0x9a53('0x95')][_0x9a53('0x94')]&&_0x1a7302['account'][_0x9a53('0x94')]['Contacts'][_0x9a53('0x4d')]){return _0x1a7302[_0x9a53('0x95')]['List'][_0x9a53('0x92')][0x0];}var _0x532a45=_[_0x9a53('0xc')](_0x1bec48[_0x9a53('0x50')],{'firstName':_0x1bec48[_0x9a53('0x50')]['from'],'ListId':_0x478c2f[_0x9a53('0x9a')]});_0x532a45[_0x1bec48[_0x9a53('0x50')]['mapKey']]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0x9b')];return db[_0x9a53('0x85')][_0x9a53('0x4f')](_0x532a45,{'fields':_0x2df2c7,'raw':!![]});}})['then'](handleEntityNotFound(_0x58f832,null))[_0x9a53('0x16')](function(_0x3fd26a){_0x1a7302[_0x9a53('0x9c')]=_0x3fd26a;var _0x69fea3=_0x1bec48[_0x9a53('0x50')][_0x9a53('0x9d')];if(_0x1bec48[_0x9a53('0x9e')][_0x9a53('0x9f')]){_0x69fea3=_0x1bec48['headers']['cf-connecting-ip'];}else if(_0x1bec48[_0x9a53('0x9e')]['x-forwarded-for']){_0x69fea3=_['first'](_0x1bec48[_0x9a53('0x9e')][_0x9a53('0xa0')][_0x9a53('0xa1')](','));}if(_0x3fd26a){var _0x44709f={'ContactId':_0x3fd26a['id'],'ChatWebsiteId':_0x1bec48[_0x9a53('0x4a')]['id'],'from':(_0x3fd26a[_0x9a53('0xa2')]||'')+'\x20'+(_0x3fd26a['lastName']||''),'customerIp':_0x69fea3,'customerPort':_0x1bec48[_0x9a53('0x9e')]['x-real-port']?_0x1bec48['headers'][_0x9a53('0xa3')]:null,'referer':_0x1bec48['body'][_0x9a53('0xa4')],'browserName':_0x1b764c[_0x9a53('0xa5')][_0x9a53('0x2c')]&&_0x1b764c['browser'][_0x9a53('0xa6')]?util[_0x9a53('0xa7')](_0x9a53('0xa8'),_0x1b764c[_0x9a53('0xa5')][_0x9a53('0x2c')],_0x1b764c[_0x9a53('0xa5')][_0x9a53('0xa6')]):_0x9a53('0xa9'),'browserVersion':_0x1b764c['browser'][_0x9a53('0xa6')]||_0x9a53('0xa9'),'osName':util[_0x9a53('0xa7')](_0x9a53('0xa8'),_0x1b764c['os'][_0x9a53('0x2c')],_0x1b764c['os'][_0x9a53('0xa6')]),'osVersion':_0x1b764c['os']['version'],'deviceModel':_0x1b764c['device'][_0x9a53('0x39')]&&_0x1b764c['device'][_0x9a53('0xaa')]?util['format'](_0x9a53('0xab'),_0x1b764c[_0x9a53('0xac')][_0x9a53('0x39')],_0x1b764c[_0x9a53('0xac')][_0x9a53('0xaa')],_0x1b764c[_0x9a53('0xac')][_0x9a53('0x35')]):null,'deviceVendor':_0x1b764c[_0x9a53('0xac')][_0x9a53('0xaa')],'deviceType':_0x1b764c['device'][_0x9a53('0x35')],'formData':JSON['stringify'](_0x1bec48[_0x9a53('0x50')])};var _0x214762={'ChatWebsiteId':_0x1bec48['params']['id'],'closed':![]};if(_0x1bec48['body'][_0x9a53('0xad')]){_0x214762['threadId']=_0x1bec48[_0x9a53('0x50')]['threadId'];return db[_0x9a53('0xae')][_0x9a53('0x4e')]({'where':_0x214762})[_0x9a53('0x16')](function(_0x4e7266){if(_0x4e7266){return[_0x4e7266,![]];}_0x44709f[_0x9a53('0xad')]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')];_0x44709f[_0x9a53('0xaf')]=_0x1bec48[_0x9a53('0x50')][_0x9a53('0xaf')];return db[_0x9a53('0xae')][_0x9a53('0x4f')](_0x44709f)[_0x9a53('0x16')](function(_0x1ab198){return[_0x1ab198,!![]];});});}_0x214762[_0x9a53('0xb0')]=_0x3fd26a['id'];if(_0x1bec48[_0x9a53('0x50')][_0x9a53('0xb1')]&&_0x1bec48[_0x9a53('0x50')][_0x9a53('0xb1')]['id']){_0x214762['id']=_0x1bec48[_0x9a53('0x50')]['interaction']['id'];return db[_0x9a53('0xae')]['find']({'where':_0x214762})[_0x9a53('0x16')](function(_0xc13c9a){if(_0xc13c9a){return[_0xc13c9a,![]];}return db[_0x9a53('0xae')][_0x9a53('0x4f')](_0x44709f)[_0x9a53('0x16')](function(_0x59aa11){return[_0x59aa11,!![]];});});}return db[_0x9a53('0xae')]['create'](_0x44709f)[_0x9a53('0x16')](function(_0x16be41){return[_0x16be41,!![]];});}})[_0x9a53('0xb2')](function(_0x5f1148,_0x28fcc0){if(_0x5f1148){_0x17738e=_0x28fcc0;if(!_0x28fcc0){var _0x1a6173={'from':(_0x1a7302[_0x9a53('0x9c')][_0x9a53('0xa2')]||'')+'\x20'+(_0x1a7302['contact'][_0x9a53('0xb3')]||'')};if(_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')]&&_0x1bec48[_0x9a53('0x50')]['messageId']&&_0x1bec48[_0x9a53('0x50')][_0x9a53('0xad')]!=_0x1bec48[_0x9a53('0x50')]['messageId']){_0x1a6173['threadId']=_0x1bec48['body'][_0x9a53('0xb4')];}return _0x5f1148['update'](_0x1a6173);}else{return _0x5f1148;}}})[_0x9a53('0x16')](function(_0x277172){_0x1a7302[_0x9a53('0xb1')]=_0x277172[_0x9a53('0x29')]({'plain':!![]});_0x1a7302['interaction'][_0x9a53('0xb5')]=_0x17738e;if(_0x1a7302['interaction'][_0x9a53('0xb5')]){if(_0x1a7302[_0x9a53('0x95')][_0x9a53('0xb6')]){_0x1a7302[_0x9a53('0x96')][_0x9a53('0xb7')]({'id':0x0,'priority':_0x1a7302[_0x9a53('0x96')][_0x9a53('0x4d')]+0x1,'app':'close','appdata':_0x9a53('0xb8'),'interval':_0x9a53('0xb9')});}}return db[_0x9a53('0xba')][_0x9a53('0x4f')]({'body':_0x1bec48[_0x9a53('0x50')][_0x9a53('0x50')],'ChatWebsiteId':_0x1bec48[_0x9a53('0x4a')]['id'],'ChatInteractionId':_0x277172['id'],'direction':'in','ContactId':_0x1a7302[_0x9a53('0x9c')]['id'],'AttachmentId':_0x1bec48[_0x9a53('0x50')]['AttachmentId']});})[_0x9a53('0x16')](function(_0x4904b7){_0x1a7302[_0x9a53('0x1c')]=_0x4904b7;if(_0x1a7302['interaction'][_0x9a53('0xbb')]){return db[_0x9a53('0xbc')][_0x9a53('0x4e')]({'attributes':['id',_0x9a53('0x2c')],'where':{'id':_0x1a7302[_0x9a53('0xb1')][_0x9a53('0xbb')]}})['then'](function(_0x30c5da){if(_0x30c5da){_0x1a7302[_0x9a53('0x96')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9a53('0xbd'),'appdata':_0x30c5da[_0x9a53('0x2c')]+','+(_0x1a7302[_0x9a53('0x95')][_0x9a53('0xbe')]||0xa),'interval':_0x9a53('0xb9')});_0x1a7302[_0x9a53('0xbf')]=!![];}return respondWithRpcPromise(_0x9a53('0xc0'),_0x9a53('0xc1'),_0x1a7302);});}return respondWithRpcPromise(_0x9a53('0xc0'),_0x9a53('0xc1'),_0x1a7302);})['then'](function(_0x1fe2f9){respondWithRpcPromise(_0x9a53('0xc2'),_0x9a53('0xc2'),{'event':_0x9a53('0x81'),'message':_0x1fe2f9},client9002);return _0x1fe2f9;})[_0x9a53('0x16')](respondWithResult(_0x58f832,null))[_0x9a53('0x1e')](handleError(_0x58f832,null));};exports[_0x9a53('0xc3')]=function(_0x15bdc8,_0x7d7498){var _0x4357d7,_0x1fb33,_0x39dade;var _0x5284e1=[];var _0x10ce66={};var _0x9e6485=_0x15bdc8[_0x9a53('0xc4')]||[];var _0x2a3039=[];var _0xf6e343;return db['CmContact'][_0x9a53('0x58')]()['then'](function(_0x60b0b0){if(!_0x60b0b0){throw new db[(_0x9a53('0x86'))]['ValidationError']('no\x20available\x20attributes');}_0x5284e1=_[_0x9a53('0x89')](_[_0x9a53('0x4b')](_0x60b0b0),['createdAt',_0x9a53('0x8b'),'CompanyId',_0x9a53('0x9a')]);if(_0x15bdc8[_0x9a53('0x50')]['id']){delete _0x15bdc8[_0x9a53('0x50')]['id'];}if(_[_0x9a53('0x76')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')])){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)[_0x9a53('0x2d')](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0x8d')));}if(_[_0x9a53('0x76')](_0x15bdc8['body'][_0x9a53('0x50')])||_0x15bdc8['body'][_0x9a53('0x50')]===''){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)['send'](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x9a53('0x76')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0xc5')])){throw _0x7d7498['status'](0x1f4)[_0x9a53('0x2d')](new db[(_0x9a53('0x86'))][(_0x9a53('0x87'))](_0x9a53('0xc6')+_0x5284e1));}if(!_[_0x9a53('0x8f')](_0x5284e1,_0x15bdc8[_0x9a53('0x50')]['mapKeyOffline'])){throw _0x7d7498[_0x9a53('0x1f')](0x1f4)['send'](new db[(_0x9a53('0x86'))]['ValidationError'](_0x9a53('0xc7')+_0x5284e1));}_0x10ce66[_0x15bdc8[_0x9a53('0x50')]['mapKeyOffline']]=_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')];})['then'](function(){return db['ChatWebsite'][_0x9a53('0x4e')]({'where':{'id':_0x15bdc8[_0x9a53('0x4a')]['id']},'include':[{'model':db[_0x9a53('0x91')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x9a53('0x16')](handleEntityNotFound(_0x7d7498,null))[_0x9a53('0x16')](function(_0x5739e9){if(_0x5739e9&&_0x5739e9[_0x9a53('0x94')]){_0x1fb33=_0x5739e9;var _0x35e471=_['defaults'](_0x15bdc8[_0x9a53('0x50')],{'firstName':_0x15bdc8[_0x9a53('0x50')]['from'],'phone':_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')],'ListId':_0x5739e9[_0x9a53('0x9a')]});_0x35e471[_0x15bdc8['body']['mapKeyOffline']]=_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x9b')];return db[_0x9a53('0x85')][_0x9a53('0xc8')]({'where':_0x10ce66,'defaults':_0x35e471});}})[_0x9a53('0xb2')](function(_0x951004){if(_0x951004){_0x39dade=_0x951004;var _0x2eec47=fs[_0x9a53('0xc9')](path[_0x9a53('0x6f')](config[_0x9a53('0x70')],'server/files/templates/chatOfflineMessage.ejs'),_0x9a53('0xca'));var _0x5be535=ejs[_0x9a53('0xcb')](_0x2eec47,{'body':_[_0x9a53('0xcc')](_0x15bdc8[_0x9a53('0x50')][_0x9a53('0x50')]),'bodyTitle':_0x1fb33[_0x9a53('0xcd')]});return db[_0x9a53('0xce')][_0x9a53('0x4f')]({'body':_0x5be535,'plainBody':htmlToText[_0x9a53('0xcf')](_0x5be535),'ContactId':_0x951004['id'],'ChatWebsiteId':_0x1fb33['id']});}})[_0x9a53('0x16')](function(_0x692650){_0xf6e343=_0x692650;if(_0x9e6485[_0x9a53('0x4d')]){var _0x584c57=_0x9e6485[_0x9a53('0x31')](function(_0x3aff0b){return{'name':_0x3aff0b[_0x9a53('0xd0')],'basename':_0x3aff0b['filename'],'type':_0x3aff0b['mimetype'],'ChatOfflineMessageId':_0x692650['id']};});_0x2a3039=_0x584c57[_0x9a53('0x31')](_0x5c08e1=>{var _0x4c12aa={'filename':_0x5c08e1[_0x9a53('0x2c')],'path':path[_0x9a53('0x6f')](config[_0x9a53('0x70')],_0x9a53('0xd1'),'files','attachments','offline-chat',_0x5c08e1[_0x9a53('0xd2')])};return _0x4c12aa;});if(!_0x1fb33['openNewInteraction']){return db[_0x9a53('0xd3')][_0x9a53('0xd4')](function(_0x22bdad){return db['Attachment'][_0x9a53('0xd5')](_0x584c57,{'transaction':_0x22bdad});});}}})[_0x9a53('0x16')](function(){if(_0xf6e343){_0x4357d7=_0xf6e343;return db['MailAccount'][_0x9a53('0x5c')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x9a53('0xd6'),'raw':!![],'include':[{'model':db[_0x9a53('0xd7')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x9a53('0x16')](function(_0x2c9746){if(_0x2c9746&&_0x2c9746[_0x9a53('0xd6')]&&_0x1fb33[_0x9a53('0xd8')]&&_0x1fb33[_0x9a53('0xd9')]){var _0x4d922f=_0x2c9746[_0x9a53('0xda')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4d922f,'message':{'from':util[_0x9a53('0xa7')]('\x22%s\x22\x20<%s>',_0x2c9746[_0x9a53('0x2c')],_0x2c9746[_0x9a53('0xdb')]||_0x2c9746['Smtp'][_0x9a53('0xdc')]),'to':_0x1fb33[_0x9a53('0xd9')],'subject':_0x1fb33['offlineMessageSubject'],'html':_0x4357d7[_0x9a53('0x50')],'attachments':_0x2a3039}},client9003)[_0x9a53('0x16')](function(){return _0x4357d7;})[_0x9a53('0x1e')](function(_0x257370){logger[_0x9a53('0x1b')](_0x257370);});}})[_0x9a53('0x16')](function(){if(_0x1fb33&&_0x1fb33[_0x9a53('0xdd')]&&_0x1fb33[_0x9a53('0xde')]){var _0x1f9a41=[];if(_0x9e6485[_0x9a53('0x4d')]){_0x1f9a41=_0x9e6485[_0x9a53('0x31')](function(_0x3b9469){return{'name':_0x3b9469[_0x9a53('0xd0')],'basename':_0x3b9469[_0x9a53('0x69')],'type':_0x3b9469['mimetype'],'ChatOfflineMessageId':_0xf6e343['id']};});}var _0x3ce8cb;if(!_[_0x9a53('0x76')](_0x1fb33[_0x9a53('0xdf')])){var _0x36bb17=_[_0x9a53('0x31')](_0x15bdc8[_0x9a53('0x50')],function(_0x25f19f){return _0x25f19f;});var _0x385e2=_['toPairsIn'](_0x36bb17)[0x0];var _0x70e47d=_[_0x9a53('0xe0')](_0x385e2,function(_0x302db7){return _0x302db7;});_0x3ce8cb=_0x70e47d[0x1][_0x1fb33['subjectOffline']];}var _0x8602cd={'from':_0x39dade[_0x9a53('0xdb')],'firstName':_0x39dade['firstName'],'lastName':_0x39dade['lastName'],'mapKey':'email','message':{'from':_0x39dade[_0x9a53('0xdb')],'to':_0x1fb33[_0x9a53('0xe1')][_0x9a53('0xdb')],'cc':'','subject':_[_0x9a53('0x76')](_0x3ce8cb)?_0x1fb33[_0x9a53('0xe2')]:_0x3ce8cb,'messageId':'','sentAt':new Date(),'attach':_0x1f9a41[_0x9a53('0x4d')],'attachments':_0x1f9a41,'originChannel':'Chat','ChatWebsiteId':_0x1fb33['id'],'ChatOfflineMessageId':_0x4357d7['id'],'originTo':_0x1fb33[_0x9a53('0xe1')]['email']},'body':_0x4357d7[_0x9a53('0x50')]};var _0x49af96={'account':{'id':_0x1fb33[_0x9a53('0xde')]},'body':_0x8602cd,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x9a53('0xe3'),_0x49af96,client9001)[_0x9a53('0x16')](function(){return _0x4357d7;})['catch'](function(_0x1913b2){logger['error'](_0x1913b2);});}return;})['then'](function(){if(_0x4357d7){return _0x4357d7;}})[_0x9a53('0x16')](respondWithResult(_0x7d7498,null))['catch'](function(_0x5a46f6){logger[_0x9a53('0x1b')](_0x9a53('0x1e'),_0x5a46f6);for(var _0x330cd1 of _0x9e6485){var _0x263ae1=path['join'](config[_0x9a53('0x70')],_0x9a53('0xd1'),_0x9a53('0xc4'),'attachments',_0x9a53('0xe4'),_0x330cd1[_0x9a53('0x69')]);fs_extra[_0x9a53('0xe5')](_0x263ae1)[_0x9a53('0x1e')](function(_0x580141){logger[_0x9a53('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x263ae1,_0x580141);});}});};exports[_0x9a53('0xe6')]=function(_0x106b35,_0x2da7bf){return db['ChatInteraction']['find']({'where':{'id':_0x106b35[_0x9a53('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2da7bf,null))['then'](function(_0x1b1d9d){if(_0x1b1d9d){return _0x1b1d9d[_0x9a53('0xe6')](_0x106b35[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x106b35[_0x9a53('0x50')],[_0x9a53('0x60'),'id'])||{});}})[_0x9a53('0x16')](respondWithResult(_0x2da7bf,null))[_0x9a53('0x1e')](handleError(_0x2da7bf,null));};exports['getInteractions']=function(_0xa48909,_0x1eec4e){var _0x1f2b52={'raw':![],'where':{}};var _0x59cffb={};var _0x122c7d={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0xa48909[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x1eec4e,null))['then'](function(_0xc6b7b9){if(_0xc6b7b9){_0x59cffb[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db['ChatInteraction']['rawAttributes']);_0x59cffb[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0xa48909[_0x9a53('0x37')]);_0x59cffb[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x59cffb[_0x9a53('0x39')],_0x59cffb['query']);_0x1f2b52[_0x9a53('0x3a')]=_[_0x9a53('0x4c')](_0x59cffb[_0x9a53('0x39')],qs['fields'](_0xa48909[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x1f2b52[_0x9a53('0x3a')]=_0x1f2b52[_0x9a53('0x3a')]['length']?_0x1f2b52[_0x9a53('0x3a')]:_0x59cffb[_0x9a53('0x39')];if(!_0xa48909[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x1f2b52[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0xa48909[_0x9a53('0x37')][_0x9a53('0x22')]);_0x1f2b52[_0x9a53('0x24')]=qs['offset'](_0xa48909[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x1f2b52[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0xa48909[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x1f2b52[_0x9a53('0x41')]=qs['filters'](_['pick'](_0xa48909[_0x9a53('0x37')],_0x59cffb[_0x9a53('0x38')]));_0x1f2b52[_0x9a53('0x41')][_0x9a53('0x5a')]=_0xc6b7b9['id'];if(_0xa48909['query'][_0x9a53('0x40')]){_0x1f2b52[_0x9a53('0x41')]=_['merge'](_0x1f2b52[_0x9a53('0x41')],{'$or':_['map'](_0x1f2b52[_0x9a53('0x3a')],function(_0x3f8b42){var _0x547f93={};_0x547f93[_0x3f8b42]={'$like':'%'+_0xa48909['query'][_0x9a53('0x40')]+'%'};return _0x547f93;})});}_0x1f2b52=_['merge']({},_0x1f2b52,_0xa48909[_0x9a53('0x44')]);return db['ChatInteraction'][_0x9a53('0x23')]({'where':_0x1f2b52[_0x9a53('0x41')]})[_0x9a53('0x16')](function(_0x28b60e){_0x122c7d[_0x9a53('0x23')]=_0x28b60e;if(_0xa48909[_0x9a53('0x37')][_0x9a53('0x45')]){_0x1f2b52[_0x9a53('0x46')]=[{'model':db[_0x9a53('0x85')],'as':_0x9a53('0xe8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x9a53('0xe9'),_0x9a53('0xea')],'required':![]},{'model':db[_0x9a53('0xeb')],'as':_0x9a53('0xec'),'attributes':['id',_0x9a53('0x2c'),_0x9a53('0xed')],'where':_0xa48909[_0x9a53('0x37')][_0x9a53('0xee')]?{'id':_0xa48909['query'][_0x9a53('0xee')]}:undefined,'required':_0xa48909[_0x9a53('0x37')][_0x9a53('0xee')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x1f2b52);})['then'](function(_0x2af14b){_0x122c7d[_0x9a53('0x48')]=_0x2af14b;return _0x122c7d;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x1eec4e,_0x1f2b52))[_0x9a53('0x1e')](handleError(_0x1eec4e,null));};function iftimePromise(_0x36cd4f,_0x17336d){return respondWithRpcPromise(_0x9a53('0xef'),_0x9a53('0xf0'),{'command':_0x17336d[_0x9a53('0xf1')]?util[_0x9a53('0xa7')](_0x9a53('0xf2'),_0x36cd4f[_0x9a53('0xf3')],_0x17336d[_0x9a53('0xf1')]):util[_0x9a53('0xa7')](_0x9a53('0xf4'),_0x36cd4f['interval'])},client9002)['then'](function(_0x45cc70){var _0x2ac284=_0x45cc70&&_0x45cc70[_0x9a53('0xf5')]('true')>=0x0?!![]:![];logger[_0x9a53('0xf6')](_0x9a53('0xf7'),_0x17336d['id'],_0x36cd4f['id'],_0x36cd4f['interval'],_0x2ac284?_0x9a53('0xf8'):'OFFLINE',_0x17336d[_0x9a53('0xf1')]?_0x17336d[_0x9a53('0xf1')]:_0x9a53('0xf9'));return _0x2ac284;})[_0x9a53('0x1e')](function(_0xb3ca85){logger[_0x9a53('0x1b')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x17336d['id'],_0x36cd4f['id'],_0x36cd4f['interval'],util[_0x9a53('0xfa')](_0xb3ca85,{'showHidden':![],'depth':null}),_0x17336d[_0x9a53('0xf1')]?_0x17336d[_0x9a53('0xf1')]:_0x9a53('0xf9'));return![];});}exports['getSnippet']=function(_0x2f26b9,_0x2e362c){var _0x5a3ff6=0x0;var _0x4f18cb=0x0;var _0xbdc602=![];var _0xdb7ce6;var _0x4f7f20;return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x2f26b9[_0x9a53('0x4a')]['id']},'include':[{'model':db['Interval'],'as':_0x9a53('0xfb'),'include':[{'model':db[_0x9a53('0xfb')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0x9a53('0x16')](handleEntityNotFound(_0x2e362c,null))['then'](function(_0x3d52ad){if(_0x3d52ad){_0xdb7ce6=_0x3d52ad;return _0x3d52ad[_0x9a53('0xfc')]({'raw':!![]});}})[_0x9a53('0x16')](function(_0x43dfe2){if(_0xdb7ce6){if(_0x43dfe2){_0x4f7f20=_0x43dfe2;}}return require(_0x9a53('0x73'))[_0x9a53('0x74')]();})[_0x9a53('0x16')](function(_0x6c9c6a){if(_0x6c9c6a){_0x4f18cb=_0x6c9c6a['virtual'];_0xbdc602=_0x6c9c6a['custom'];}})[_0x9a53('0x16')](function(){return db[_0x9a53('0xae')][_0x9a53('0x23')]({'where':{'closed':![]}});})['then'](function(_0x3c2eaa){_0x5a3ff6=_0x3c2eaa;if(_0x4f18cb&&_0x3c2eaa>_0x4f18cb){return db[_0x9a53('0xfd')][_0x9a53('0x5c')]({'where':{'id':0x1}})[_0x9a53('0x16')](function(_0x495216){if(_0x495216){_0x495216[_0x9a53('0xfe')]('chatLicenseExceeded');}});}})[_0x9a53('0x16')](function(){if(_0xdb7ce6[_0x9a53('0xfb')]&&_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')]){var _0x6c866=[];for(var _0x3d3913=0x0;_0x3d3913<_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')][_0x9a53('0x4d')];_0x3d3913++){var _0x37f926=_0xdb7ce6[_0x9a53('0xfb')][_0x9a53('0xff')][_0x3d3913]['get']({'plain':!![]});_0x6c866[_0x9a53('0xb7')](iftimePromise(_0x37f926,_0xdb7ce6));}return BPromise[_0x9a53('0x100')](_0x6c866)[_0x9a53('0x16')](function(_0x31f3d9){return _[_0x9a53('0x101')](_0x31f3d9);});}else{return!![];}})[_0x9a53('0x16')](function(_0x2bfe38){var _0x2c4747=fs[_0x9a53('0xc9')](path[_0x9a53('0x6f')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x2c3e4f={'remote':_0xdb7ce6[_0x9a53('0x102')],'query':querystring[_0x9a53('0x103')](_['merge'](_0xdb7ce6['get']({'plain':!![]}),{'customerIp':_0x2f26b9[_0x9a53('0x9e')]['x-forwarded-for']||_0x2f26b9[_0x9a53('0x9e')]['x-real-ip']||_0x2f26b9[_0x9a53('0x104')][_0x9a53('0x105')]||_0x2f26b9['ip'],'referer':_0x2f26b9[_0x9a53('0x9e')][_0x9a53('0xa4')],'openedInteractions':_0x5a3ff6,'maxInteractions':_0x4f18cb,'virtual':_0xbdc602['virtual'],'online':_0x2bfe38,'custom':_0xbdc602}))['replace'](/'/g,'\x5c\x27')};_0x2e362c['send'](ejs[_0x9a53('0xcb')](Mustache[_0x9a53('0xcb')](_0x2c4747,_0x2c3e4f),{'proactiveActions':_0x4f7f20,'alignment':_0xdb7ce6[_0x9a53('0x106')],'verticalAlignment':_0xdb7ce6[_0x9a53('0x107')],'div_color':_0xdb7ce6[_0x9a53('0xed')],'labelText':_0xdb7ce6[_0x9a53('0x108')],'text_color':_0xdb7ce6[_0x9a53('0x109')],'text_button_color':_0xdb7ce6['textButtonColor'],'button_color':_0xdb7ce6['color_button'],'background_color':_0xdb7ce6[_0x9a53('0x10a')],'hideWhenOffline':_0xdb7ce6[_0x9a53('0x10b')],'interval':_0xdb7ce6[_0x9a53('0x10c')]}));})[_0x9a53('0x1e')](handleError(_0x2e362c,null));};exports[_0x9a53('0x10d')]=function(_0x27bd73,_0x339e83){var _0x2fa37e=_0x27bd73[_0x9a53('0x4a')]['id'];var _0x3c2458=_0x27bd73[_0x9a53('0x50')];var _0x2093c1=0xc8;var _0x509c87=null;return db[_0x9a53('0xd3')][_0x9a53('0xd4')]({'isolationLevel':db[_0x9a53('0xd3')]['Transaction'][_0x9a53('0x10e')][_0x9a53('0x10f')]},function(_0x488def){return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x2fa37e},'transaction':_0x488def})[_0x9a53('0x16')](function(_0x4d2690){if(_0x4d2690){return db[_0x9a53('0x93')][_0x9a53('0x28')]({'where':{'ChatWebsiteId':_0x2fa37e},'transaction':_0x488def})[_0x9a53('0x16')](function(){var _0x11237d=_[_0x9a53('0x31')](_0x3c2458,function(_0x238b9d){_0x238b9d['ChatWebsiteId']=_0x2fa37e;return _0x238b9d;});return db[_0x9a53('0x93')][_0x9a53('0xd5')](_0x11237d,{'transaction':_0x488def});});}else{_0x2093c1=0x194;_0x509c87=[];}});})['then'](function(){if(_0x2093c1!==0x194){return db[_0x9a53('0x93')][_0x9a53('0x110')]({'where':{'ChatWebsiteId':_0x2fa37e},'order':_0x9a53('0x99')})['then'](function(_0xf045d6){_0x509c87=_0xf045d6;});}})[_0x9a53('0x1e')](function(_0x4af3d6){_0x2093c1=0x1f4;logger[_0x9a53('0x1b')](_0x4af3d6[_0x9a53('0x111')]);if(_0x4af3d6[_0x9a53('0x2c')]){delete _0x4af3d6[_0x9a53('0x2c')];}_0x509c87=_0x4af3d6;})[_0x9a53('0x112')](function(){if(_0x509c87===null){_0x339e83[_0x9a53('0x2b')](_0x2093c1);}else{if(_0x2093c1===0x1f4){_0x339e83[_0x9a53('0x1f')](_0x2093c1)[_0x9a53('0x2d')](_0x509c87);}else{_0x339e83[_0x9a53('0x1f')](_0x2093c1)[_0x9a53('0x21')](_0x509c87);}}});};exports[_0x9a53('0x113')]=function(_0x49903f,_0x1e610a){var _0x598c8c={};var _0x2f5de0={};var _0x3f6c6d;var _0x233d31;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x49903f[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x1e610a,null))['then'](function(_0x95f618){if(_0x95f618){_0x3f6c6d=_0x95f618;_0x2f5de0[_0x9a53('0x39')]=_[_0x9a53('0x4b')](db[_0x9a53('0x93')][_0x9a53('0x33')]);_0x2f5de0[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x49903f[_0x9a53('0x37')]);_0x2f5de0[_0x9a53('0x38')]=_['intersection'](_0x2f5de0[_0x9a53('0x39')],_0x2f5de0[_0x9a53('0x37')]);_0x598c8c['attributes']=_['intersection'](_0x2f5de0[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x49903f[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x598c8c['attributes']=_0x598c8c['attributes'][_0x9a53('0x4d')]?_0x598c8c[_0x9a53('0x3a')]:_0x2f5de0[_0x9a53('0x39')];_0x598c8c['order']=qs[_0x9a53('0x3e')](_0x49903f[_0x9a53('0x37')]['sort']);_0x598c8c[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x49903f['query'],_0x2f5de0[_0x9a53('0x38')]));if(_0x49903f[_0x9a53('0x37')]['filter']){_0x598c8c[_0x9a53('0x41')]=_['merge'](_0x598c8c['where'],{'$or':_[_0x9a53('0x31')](_0x598c8c[_0x9a53('0x3a')],function(_0x321a88){var _0x193f5e={};_0x193f5e[_0x321a88]={'$like':'%'+_0x49903f[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x193f5e;})});}_0x598c8c=_[_0x9a53('0x42')]({},_0x598c8c,_0x49903f[_0x9a53('0x44')]);return _0x3f6c6d[_0x9a53('0x113')](_0x598c8c);}})[_0x9a53('0x16')](function(_0x40af54){if(_0x40af54){_0x233d31=_0x40af54['length'];if(!_0x49903f['query']['hasOwnProperty'](_0x9a53('0x3d'))){_0x598c8c[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x49903f[_0x9a53('0x37')][_0x9a53('0x22')]);_0x598c8c[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x49903f[_0x9a53('0x37')]['offset']);}return _0x3f6c6d[_0x9a53('0x113')](_0x598c8c);}})[_0x9a53('0x16')](function(_0x5b4900){if(_0x5b4900){return _0x5b4900?{'count':_0x233d31,'rows':_0x5b4900}:null;}})[_0x9a53('0x16')](respondWithResult(_0x1e610a,null))[_0x9a53('0x1e')](handleError(_0x1e610a,null));};exports[_0x9a53('0x114')]=function(_0x43615a,_0x4b2505){return db[_0x9a53('0x115')][_0x9a53('0x4e')]({'where':{'id':_0x43615a[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x4b2505,null))[_0x9a53('0x16')](function(_0x3a3dc6){if(_0x3a3dc6){return _0x3a3dc6[_0x9a53('0x114')](_0x43615a[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x43615a[_0x9a53('0x50')],[_0x9a53('0x60'),'id'])||{});}})['then'](respondWithResult(_0x4b2505,null))[_0x9a53('0x1e')](handleError(_0x4b2505,null));};exports['getProactiveActions']=function(_0x352af1,_0x43f010){var _0x4a93a3={};var _0x584eb5={};var _0x3e494c;var _0xf25850;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x352af1[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x43f010,null))['then'](function(_0x134c53){if(_0x134c53){_0x3e494c=_0x134c53;_0x584eb5[_0x9a53('0x39')]=_['keys'](db[_0x9a53('0x116')][_0x9a53('0x33')]);_0x584eb5['query']=_[_0x9a53('0x4b')](_0x352af1[_0x9a53('0x37')]);_0x584eb5['filters']=_[_0x9a53('0x4c')](_0x584eb5['model'],_0x584eb5['query']);_0x4a93a3[_0x9a53('0x3a')]=_['intersection'](_0x584eb5['model'],qs[_0x9a53('0x3b')](_0x352af1['query'][_0x9a53('0x3b')]));_0x4a93a3[_0x9a53('0x3a')]=_0x4a93a3[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x4a93a3['attributes']:_0x584eb5[_0x9a53('0x39')];_0x4a93a3[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x352af1[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x4a93a3[_0x9a53('0x41')]=qs['filters'](_[_0x9a53('0x3f')](_0x352af1[_0x9a53('0x37')],_0x584eb5[_0x9a53('0x38')]));if(_0x352af1['query']['filter']){_0x4a93a3[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x4a93a3[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x4a93a3['attributes'],function(_0x4e98aa){var _0x5220a5={};_0x5220a5[_0x4e98aa]={'$like':'%'+_0x352af1[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x5220a5;})});}_0x4a93a3=_[_0x9a53('0x42')]({},_0x4a93a3,_0x352af1['options']);return _0x3e494c[_0x9a53('0xfc')](_0x4a93a3);}})[_0x9a53('0x16')](function(_0x194514){if(_0x194514){_0xf25850=_0x194514[_0x9a53('0x4d')];if(!_0x352af1[_0x9a53('0x37')]['hasOwnProperty'](_0x9a53('0x3d'))){_0x4a93a3['limit']=qs[_0x9a53('0x22')](_0x352af1['query']['limit']);_0x4a93a3[_0x9a53('0x24')]=qs[_0x9a53('0x24')](_0x352af1[_0x9a53('0x37')][_0x9a53('0x24')]);}return _0x3e494c[_0x9a53('0xfc')](_0x4a93a3);}})['then'](function(_0x1975fe){if(_0x1975fe){return _0x1975fe?{'count':_0xf25850,'rows':_0x1975fe}:null;}})[_0x9a53('0x16')](respondWithResult(_0x43f010,null))['catch'](handleError(_0x43f010,null));};exports[_0x9a53('0x117')]=function(_0x50c521,_0x280000){var _0x1c7dbe=_0x50c521['query'][_0x9a53('0x118')]===_0x9a53('0x119')?_0x9a53('0x11a'):_0x9a53('0x11b');return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'attributes':['id',_0x1c7dbe],'where':{'id':_0x50c521[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x280000,null))['then'](function(_0x306166){if(_0x306166){var _0x3f1a43=_0x306166[_0x1c7dbe];var _0x27df75=_0x3f1a43&&_0x3f1a43[_0x9a53('0x11c')]?_0x3f1a43[_0x9a53('0x11c')]:[];_0x280000[_0x9a53('0x2d')]({'fromKey':_[_0x9a53('0x76')](_0x3f1a43[_0x9a53('0x11d')])?undefined:_0x3f1a43[_0x9a53('0x11d')],'count':_0x27df75[_0x9a53('0x4d')],'rows':_0x27df75});}})['catch'](handleError(_0x280000,null));};exports[_0x9a53('0x11e')]=function(_0x24e469,_0x5c438b){var _0x55a9e3={'raw':![],'where':{}};var _0x456aba={};var _0x5e738a={'count':0x0,'rows':[]};return db[_0x9a53('0x32')]['findOne']({'where':{'id':_0x24e469['params']['id']}})['then'](handleEntityNotFound(_0x5c438b,null))[_0x9a53('0x16')](function(_0x32195a){if(_0x32195a){_0x456aba['model']=_[_0x9a53('0x4b')](db[_0x9a53('0xce')][_0x9a53('0x33')]);_0x456aba[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x24e469[_0x9a53('0x37')]);_0x456aba[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x456aba[_0x9a53('0x39')],_0x456aba['query']);_0x55a9e3[_0x9a53('0x3a')]=_['intersection'](_0x456aba[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x3b')]));_0x55a9e3[_0x9a53('0x3a')]=_0x55a9e3[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x55a9e3[_0x9a53('0x3a')]:_0x456aba[_0x9a53('0x39')];if(!_0x24e469['query'][_0x9a53('0x3c')]('nolimit')){_0x55a9e3[_0x9a53('0x22')]=qs[_0x9a53('0x22')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x22')]);_0x55a9e3[_0x9a53('0x24')]=qs['offset'](_0x24e469[_0x9a53('0x37')][_0x9a53('0x24')]);}_0x55a9e3[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x24e469[_0x9a53('0x37')][_0x9a53('0x3e')]);_0x55a9e3[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_['pick'](_0x24e469[_0x9a53('0x37')],_0x456aba[_0x9a53('0x38')]));_0x55a9e3[_0x9a53('0x41')][_0x9a53('0x5a')]=_0x32195a['id'];if(_0x24e469[_0x9a53('0x37')]['filter']){_0x55a9e3[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x55a9e3[_0x9a53('0x41')],{'$or':_[_0x9a53('0x31')](_0x55a9e3[_0x9a53('0x3a')],function(_0x280d00){var _0x579946={};_0x579946[_0x280d00]={'$like':'%'+_0x24e469[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x579946;})});}_0x55a9e3=_[_0x9a53('0x42')]({},_0x55a9e3,_0x24e469[_0x9a53('0x44')]);return db['ChatOfflineMessage'][_0x9a53('0x23')]({'where':_0x55a9e3['where']})[_0x9a53('0x16')](function(_0x4ac857){_0x5e738a['count']=_0x4ac857;if(_0x24e469['query']['includeAll']){_0x55a9e3['include']=[{'all':!![]}];}else{_0x55a9e3[_0x9a53('0x46')]=[{'model':db[_0x9a53('0x85')],'as':'Contact','required':![]},{'model':db[_0x9a53('0x11f')],'as':_0x9a53('0x120'),'required':![]}];}return db[_0x9a53('0xce')][_0x9a53('0x47')](_0x55a9e3);})[_0x9a53('0x16')](function(_0x58a106){_0x5e738a['rows']=_0x58a106;return _0x5e738a;});}})[_0x9a53('0x16')](respondWithFilteredResult(_0x5c438b,_0x55a9e3))[_0x9a53('0x1e')](handleError(_0x5c438b,null));};exports['addAgents']=function(_0x3bc2d1,_0xdccdb3){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x3bc2d1[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0xdccdb3,null))[_0x9a53('0x16')](function(_0x214f6c){if(_0x214f6c){return _0x214f6c[_0x9a53('0x121')](_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')],_[_0x9a53('0xe7')](_0x3bc2d1['body'],[_0x9a53('0x60'),'id'])||{})['spread'](function(_0x9519e5){for(var _0x53293a=0x0;_0x53293a<_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')]['length'];_0x53293a+=0x1){socket[_0x9a53('0x122')](_0x9a53('0x123'),{'UserId':Number(_0x3bc2d1[_0x9a53('0x50')][_0x9a53('0x60')][_0x53293a]),'ChatWebsiteId':Number(_0x3bc2d1[_0x9a53('0x4a')]['id'])});}return _0x9519e5;});}})[_0x9a53('0x16')](respondWithResult(_0xdccdb3,null))[_0x9a53('0x1e')](handleError(_0xdccdb3,null));};exports[_0x9a53('0x124')]=function(_0x1dfc7c,_0x3a6b28){return db[_0x9a53('0x32')][_0x9a53('0x4e')]({'where':{'id':_0x1dfc7c[_0x9a53('0x4a')]['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x3a6b28,null))[_0x9a53('0x16')](function(_0x121275){if(_0x121275){return _0x121275[_0x9a53('0x124')](_0x1dfc7c[_0x9a53('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')])){for(var _0x11eaf5=0x0;_0x11eaf5<_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')][_0x9a53('0x4d')];_0x11eaf5+=0x1){socket[_0x9a53('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')][_0x11eaf5]),'ChatWebsiteId':Number(_0x1dfc7c[_0x9a53('0x4a')]['id'])});}}else{socket[_0x9a53('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x1dfc7c[_0x9a53('0x37')][_0x9a53('0x60')]),'ChatWebsiteId':Number(_0x1dfc7c[_0x9a53('0x4a')]['id'])});}});}})[_0x9a53('0x16')](respondWithStatusCode(_0x3a6b28,null))[_0x9a53('0x1e')](handleError(_0x3a6b28,null));};exports[_0x9a53('0x125')]=function(_0x579b00,_0x45da9e){var _0x32034e={};var _0x3e241a={};var _0xeaa98e;var _0x5b97ab;return db[_0x9a53('0x32')][_0x9a53('0x5c')]({'where':{'id':_0x579b00['params']['id']}})[_0x9a53('0x16')](handleEntityNotFound(_0x45da9e,null))[_0x9a53('0x16')](function(_0x462ed9){if(_0x462ed9){_0xeaa98e=_0x462ed9;_0x3e241a['model']=_[_0x9a53('0x4b')](db[_0x9a53('0xbc')][_0x9a53('0x33')]);_0x3e241a[_0x9a53('0x37')]=_[_0x9a53('0x4b')](_0x579b00[_0x9a53('0x37')]);_0x3e241a[_0x9a53('0x38')]=_[_0x9a53('0x4c')](_0x3e241a[_0x9a53('0x39')],_0x3e241a[_0x9a53('0x37')]);_0x32034e[_0x9a53('0x3a')]=_['intersection'](_0x3e241a[_0x9a53('0x39')],qs[_0x9a53('0x3b')](_0x579b00['query'][_0x9a53('0x3b')]));_0x32034e[_0x9a53('0x3a')]=_0x32034e[_0x9a53('0x3a')][_0x9a53('0x4d')]?_0x32034e[_0x9a53('0x3a')]:_0x3e241a[_0x9a53('0x39')];_0x32034e[_0x9a53('0x5d')]=qs[_0x9a53('0x3e')](_0x579b00[_0x9a53('0x37')]['sort']);_0x32034e[_0x9a53('0x41')]=qs[_0x9a53('0x38')](_[_0x9a53('0x3f')](_0x579b00[_0x9a53('0x37')],_0x3e241a['filters']));if(_0x579b00[_0x9a53('0x37')][_0x9a53('0x40')]){_0x32034e[_0x9a53('0x41')]=_[_0x9a53('0x42')](_0x32034e[_0x9a53('0x41')],{'$or':_['map'](_0x32034e[_0x9a53('0x3a')],function(_0x1bada0){var _0x522325={};_0x522325[_0x1bada0]={'$like':'%'+_0x579b00[_0x9a53('0x37')][_0x9a53('0x40')]+'%'};return _0x522325;})});}_0x32034e=_[_0x9a53('0x42')]({},_0x32034e,_0x579b00['options']);return _0xeaa98e[_0x9a53('0x125')](_0x32034e);}})[_0x9a53('0x16')](function(_0x3cd147){if(_0x3cd147){_0x5b97ab=_0x3cd147[_0x9a53('0x4d')];if(!_0x579b00[_0x9a53('0x37')][_0x9a53('0x3c')](_0x9a53('0x3d'))){_0x32034e['limit']=qs[_0x9a53('0x22')](_0x579b00[_0x9a53('0x37')]['limit']);_0x32034e['offset']=qs['offset'](_0x579b00[_0x9a53('0x37')]['offset']);}return _0xeaa98e[_0x9a53('0x125')](_0x32034e);}})[_0x9a53('0x16')](function(_0x4acba4){if(_0x4acba4){return _0x4acba4?{'count':_0x5b97ab,'rows':_0x4acba4}:null;}})[_0x9a53('0x16')](respondWithResult(_0x45da9e,null))['catch'](handleError(_0x45da9e,null));}; \ No newline at end of file +var _0xbd9f=['includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','ChatApplication','Applications','List','list','applications','orderBy','priority','account','ListId','mapKey','cf-connecting-ip','x-forwarded-for','split','x-real-port','referer','browser','format','version','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','lastName','messageId','created','autoclose','close','unmanaged','AttachmentId','UserId','User','agent','forcedOwnership','startRouting','Start','EventManager','offline','files','no\x20available\x20attributes','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','mimetype','server','attachments','basename','sequelize','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','originalname','subjectOffline','mapValues','email','NotifyMailAccount','notifyMail','remove','addInteraction','Contact','Owner','fullname','internal','Tag','color','tag','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','path','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','html-to-text','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','update','get','ChatWebsites','UserProfileResource','destroy','end','name','send','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','Pause','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','options','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addLogo','file','filename','agentAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x2b8f84,_0x349ee2){var _0x2927ca=function(_0x1700be){while(--_0x1700be){_0x2b8f84['push'](_0x2b8f84['shift']());}};_0x2927ca(++_0x349ee2);}(_0xbd9f,0x1b5));var _0xfbd9=function(_0x1aaf60,_0x40a4c0){_0x1aaf60=_0x1aaf60-0x0;var _0x2f49fb=_0xbd9f[_0x1aaf60];return _0x2f49fb;};'use strict';var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfbd9('0x0'));var ejs=require(_0xfbd9('0x1'));var fs=require('fs');var fs_extra=require(_0xfbd9('0x2'));var _=require('lodash');var querystring=require(_0xfbd9('0x3'));var Redis=require(_0xfbd9('0x4'));var qs=require(_0xfbd9('0x5'));var logger=require(_0xfbd9('0x6'))(_0xfbd9('0x7'));var config=require(_0xfbd9('0x8'));var db=require(_0xfbd9('0x9'))['db'];config[_0xfbd9('0xa')]=_[_0xfbd9('0xb')](config[_0xfbd9('0xa')],{'host':_0xfbd9('0xc'),'port':0x18eb});var socket=require(_0xfbd9('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xfbd9('0xe')](socket);var htmlToText=require(_0xfbd9('0xf'));var jayson=require(_0xfbd9('0x10'));var client=jayson['client'][_0xfbd9('0x11')]({'port':0x232c});var client9002=jayson[_0xfbd9('0x12')][_0xfbd9('0x11')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xfbd9('0x12')][_0xfbd9('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x39f97e,_0x3c2f41,_0x160b8d,_0x801e0b){return new BPromise(function(_0x59834e,_0x47b39e){var _0x5174ff=_0x801e0b||client;return _0x5174ff[_0xfbd9('0x13')](_0x39f97e,_0x160b8d)[_0xfbd9('0x14')](function(_0x3cc2d6){logger[_0xfbd9('0x15')](_0xfbd9('0x16'),_0x3c2f41,'request\x20sent');logger[_0xfbd9('0x17')](_0xfbd9('0x18'),_0x3c2f41,_0xfbd9('0x19'),JSON[_0xfbd9('0x1a')](_0x3cc2d6));if(_0x3cc2d6[_0xfbd9('0x1b')]){if(_0x3cc2d6[_0xfbd9('0x1b')][_0xfbd9('0x1c')]===0x1f4){logger['error'](_0xfbd9('0x16'),_0x3c2f41,_0x3cc2d6[_0xfbd9('0x1b')]['message']);return _0x47b39e(_0x3cc2d6[_0xfbd9('0x1b')][_0xfbd9('0x1d')]);}logger[_0xfbd9('0x1b')](_0xfbd9('0x16'),_0x3c2f41,_0x3cc2d6[_0xfbd9('0x1b')][_0xfbd9('0x1d')]);return _0x59834e(_0x3cc2d6[_0xfbd9('0x1b')][_0xfbd9('0x1d')]);}else{logger['info'](_0xfbd9('0x16'),_0x3c2f41,_0xfbd9('0x19'));_0x59834e(_0x3cc2d6[_0xfbd9('0x1e')][_0xfbd9('0x1d')]);}})[_0xfbd9('0x1f')](function(_0x475327){logger[_0xfbd9('0x1b')](_0xfbd9('0x16'),_0x3c2f41,_0x475327);_0x47b39e(_0x475327);});});}function respondWithStatusCode(_0x3b5d2f,_0x5ce39e){_0x5ce39e=_0x5ce39e||0xcc;return function(_0xd3e349){if(_0xd3e349){return _0x3b5d2f[_0xfbd9('0x20')](_0x5ce39e);}return _0x3b5d2f[_0xfbd9('0x21')](_0x5ce39e)['end']();};}function respondWithResult(_0x1fe3fc,_0x120a75){_0x120a75=_0x120a75||0xc8;return function(_0x58ac0b){if(_0x58ac0b){return _0x1fe3fc[_0xfbd9('0x21')](_0x120a75)[_0xfbd9('0x22')](_0x58ac0b);}};}function respondWithFilteredResult(_0x1000b1,_0x287ef4){return function(_0xbcda6){if(_0xbcda6){var _0x1ad1b9=typeof _0x287ef4['offset']===_0xfbd9('0x23')&&typeof _0x287ef4['limit']===_0xfbd9('0x23');var _0x51dc6e=_0xbcda6[_0xfbd9('0x24')];var _0xb37bf5=_0x1ad1b9?0x0:_0x287ef4[_0xfbd9('0x25')];var _0x48dfbd=_0x1ad1b9?_0xbcda6[_0xfbd9('0x24')]:_0x287ef4[_0xfbd9('0x25')]+_0x287ef4['limit'];var _0x81ef66;if(_0x48dfbd>=_0x51dc6e){_0x48dfbd=_0x51dc6e;_0x81ef66=0xc8;}else{_0x81ef66=0xce;}_0x1000b1[_0xfbd9('0x21')](_0x81ef66);return _0x1000b1['set']('Content-Range',_0xb37bf5+'-'+_0x48dfbd+'/'+_0x51dc6e)[_0xfbd9('0x22')](_0xbcda6);}return null;};}function saveUpdates(_0x23e811){return function(_0xa05a75){if(_0xa05a75){return _0xa05a75[_0xfbd9('0x26')](_0x23e811)[_0xfbd9('0x14')](function(_0x2873b6){return _0x2873b6;});}return null;};}function removeEntity(_0xefb4e7){return function(_0x1e3773){if(_0x1e3773){return _0x1e3773['destroy']()[_0xfbd9('0x14')](function(){var _0x4559a6=_0x1e3773[_0xfbd9('0x27')]({'plain':!![]});var _0x2382e0=_0xfbd9('0x28');return db[_0xfbd9('0x29')][_0xfbd9('0x2a')]({'where':{'type':_0x2382e0,'resourceId':_0x4559a6['id']}})[_0xfbd9('0x14')](function(){return _0x1e3773;});})['then'](function(){_0xefb4e7['status'](0xcc)[_0xfbd9('0x2b')]();});}};}function handleEntityNotFound(_0x40f476){return function(_0x6db740){if(!_0x6db740){_0x40f476[_0xfbd9('0x20')](0x194);}return _0x6db740;};}function handleError(_0x10a58c,_0x1cdbd4){_0x1cdbd4=_0x1cdbd4||0x1f4;return function(_0x529ea8){logger['error'](_0x529ea8['stack']);if(_0x529ea8['name']){delete _0x529ea8[_0xfbd9('0x2c')];}_0x10a58c[_0xfbd9('0x21')](_0x1cdbd4)[_0xfbd9('0x2d')](_0x529ea8);};}exports[_0xfbd9('0x2e')]=function(_0x27386c,_0x442adc){var _0x215154={'include':[{'model':db['Pause'],'as':_0xfbd9('0x2f')}]},_0x152b5b={},_0x5dd7c7={'count':0x0,'rows':[]};var _0x34eb9c=_[_0xfbd9('0x30')](db[_0xfbd9('0x31')][_0xfbd9('0x32')],function(_0x35b735){return{'name':_0x35b735['fieldName'],'type':_0x35b735['type'][_0xfbd9('0x33')]};});_0x152b5b['model']=_['map'](_0x34eb9c,_0xfbd9('0x2c'));_0x152b5b[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x27386c[_0xfbd9('0x34')]);_0x152b5b['filters']=_['intersection'](_0x152b5b[_0xfbd9('0x36')],_0x152b5b[_0xfbd9('0x34')]);_0x215154['attributes']=_[_0xfbd9('0x37')](_0x152b5b[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x27386c[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x215154[_0xfbd9('0x39')]=_0x215154[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0x215154[_0xfbd9('0x39')]:_0x152b5b[_0xfbd9('0x36')];if(!_0x27386c[_0xfbd9('0x34')][_0xfbd9('0x3b')](_0xfbd9('0x3c'))){_0x215154[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0x27386c[_0xfbd9('0x34')]['limit']);_0x215154[_0xfbd9('0x25')]=qs[_0xfbd9('0x25')](_0x27386c[_0xfbd9('0x34')]['offset']);}_0x215154[_0xfbd9('0x3e')]=qs[_0xfbd9('0x3f')](_0x27386c[_0xfbd9('0x34')]['sort']);_0x215154[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_[_0xfbd9('0x42')](_0x27386c[_0xfbd9('0x34')],_0x152b5b['filters']),_0x34eb9c);if(_0x27386c[_0xfbd9('0x34')][_0xfbd9('0x43')]){_0x215154[_0xfbd9('0x40')]=_['merge'](_0x215154[_0xfbd9('0x40')],{'$or':_[_0xfbd9('0x30')](_0x34eb9c,function(_0x2761ad){if(_0x2761ad[_0xfbd9('0x44')]!==_0xfbd9('0x45')){var _0x1bf8e1={};_0x1bf8e1[_0x2761ad[_0xfbd9('0x2c')]]={'$like':'%'+_0x27386c[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x1bf8e1;}})});}_0x215154=_[_0xfbd9('0x46')]({},_0x215154,_0x27386c['options']);var _0x5aea38={'where':_0x215154[_0xfbd9('0x40')]};return db[_0xfbd9('0x31')]['count'](_0x5aea38)[_0xfbd9('0x14')](function(_0x9867ed){_0x5dd7c7[_0xfbd9('0x24')]=_0x9867ed;if(_0x27386c[_0xfbd9('0x34')][_0xfbd9('0x47')]){_0x215154[_0xfbd9('0x48')]=[{'all':!![]}];}return db[_0xfbd9('0x31')][_0xfbd9('0x49')](_0x215154);})[_0xfbd9('0x14')](function(_0x53f707){_0x5dd7c7[_0xfbd9('0x4a')]=_0x53f707;return _0x5dd7c7;})[_0xfbd9('0x14')](respondWithFilteredResult(_0x442adc,_0x215154))['catch'](handleError(_0x442adc,null));};exports[_0xfbd9('0x4b')]=function(_0x97bc7,_0x7c8724){var _0x55a174={'raw':![],'where':{'id':_0x97bc7[_0xfbd9('0x4c')]['id']},'include':[{'model':db[_0xfbd9('0x4d')],'as':_0xfbd9('0x2f')}]},_0x4f312d={};_0x4f312d[_0xfbd9('0x36')]=_['keys'](db[_0xfbd9('0x31')][_0xfbd9('0x32')]);_0x4f312d[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x97bc7[_0xfbd9('0x34')]);_0x4f312d[_0xfbd9('0x41')]=_['intersection'](_0x4f312d[_0xfbd9('0x36')],_0x4f312d['query']);_0x55a174[_0xfbd9('0x39')]=_[_0xfbd9('0x37')](_0x4f312d['model'],qs[_0xfbd9('0x38')](_0x97bc7[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x55a174['attributes']=_0x55a174[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0x55a174[_0xfbd9('0x39')]:_0x4f312d['model'];if(_0x97bc7['query']['includeAll']){_0x55a174[_0xfbd9('0x48')]=[{'all':!![]}];}_0x55a174=_[_0xfbd9('0x46')]({},_0x55a174,_0x97bc7['options']);return db[_0xfbd9('0x31')][_0xfbd9('0x4e')](_0x55a174)[_0xfbd9('0x14')](handleEntityNotFound(_0x7c8724,null))[_0xfbd9('0x14')](respondWithResult(_0x7c8724,null))[_0xfbd9('0x1f')](handleError(_0x7c8724,null));};exports[_0xfbd9('0x4f')]=function(_0x39487e,_0x37aec7){return db[_0xfbd9('0x31')][_0xfbd9('0x4f')](_0x39487e['body'],{})[_0xfbd9('0x14')](function(_0x2957c9){var _0x240aa8=_0x39487e[_0xfbd9('0x50')][_0xfbd9('0x27')]({'plain':!![]});if(!_0x240aa8)throw new Error(_0xfbd9('0x51'));if(_0x240aa8[_0xfbd9('0x52')]===_0xfbd9('0x50')){var _0xf64d24=_0x2957c9[_0xfbd9('0x27')]({'plain':!![]});var _0x4ca529=_0xfbd9('0x28');return db[_0xfbd9('0x53')]['find']({'where':{'name':_0x4ca529,'userProfileId':_0x240aa8[_0xfbd9('0x54')]},'raw':!![]})[_0xfbd9('0x14')](function(_0x5cc847){if(_0x5cc847&&_0x5cc847[_0xfbd9('0x55')]===0x0){return db[_0xfbd9('0x29')][_0xfbd9('0x4f')]({'name':_0xf64d24[_0xfbd9('0x2c')],'resourceId':_0xf64d24['id'],'type':_0x5cc847[_0xfbd9('0x2c')],'sectionId':_0x5cc847['id']},{})['then'](function(){return _0x2957c9;});}else{return _0x2957c9;}})['catch'](function(_0x5323d6){logger['error'](_0xfbd9('0x56'),_0x5323d6);throw _0x5323d6;});}return _0x2957c9;})[_0xfbd9('0x14')](respondWithResult(_0x37aec7,0xc9))['catch'](handleError(_0x37aec7,null));};exports[_0xfbd9('0x26')]=function(_0x1bdcfb,_0x4e1527){if(_0x1bdcfb[_0xfbd9('0x57')]['id']){delete _0x1bdcfb[_0xfbd9('0x57')]['id'];}return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x1bdcfb[_0xfbd9('0x4c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xfbd9('0x14')](handleEntityNotFound(_0x4e1527,null))['then'](saveUpdates(_0x1bdcfb[_0xfbd9('0x57')],null))[_0xfbd9('0x14')](respondWithResult(_0x4e1527,null))['catch'](handleError(_0x4e1527,null));};exports[_0xfbd9('0x2a')]=function(_0x581ada,_0x29a1ff){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x581ada[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x29a1ff,null))[_0xfbd9('0x14')](removeEntity(_0x29a1ff,null))[_0xfbd9('0x1f')](handleError(_0x29a1ff,null));};exports[_0xfbd9('0x58')]=function(_0x59c098,_0x18a4e5){return db['ChatWebsite'][_0xfbd9('0x58')]()['then'](respondWithResult(_0x18a4e5,null))[_0xfbd9('0x1f')](handleError(_0x18a4e5,null));};exports[_0xfbd9('0x59')]=function(_0x3abbc7,_0x14326f){if(_0x3abbc7[_0xfbd9('0x57')]['id']){delete _0x3abbc7[_0xfbd9('0x57')]['id'];}return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x3abbc7[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x14326f,null))[_0xfbd9('0x14')](function(_0x5bbc6a){if(_0x5bbc6a){_0x3abbc7['body'][_0xfbd9('0x5a')]=_0x5bbc6a['id'];return db[_0xfbd9('0x5b')][_0xfbd9('0x4f')](_0x3abbc7[_0xfbd9('0x57')]);}})[_0xfbd9('0x14')](respondWithResult(_0x14326f,null))['catch'](handleError(_0x14326f,null));};exports[_0xfbd9('0x5c')]=function(_0x3a2362,_0x153f15){var _0x1f823d={'raw':![],'where':{}};var _0x5b16a3={};var _0xf896f7={'count':0x0,'rows':[]};return db[_0xfbd9('0x31')][_0xfbd9('0x5d')]({'where':{'id':_0x3a2362[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x153f15,null))[_0xfbd9('0x14')](function(_0x382423){if(_0x382423){_0x5b16a3['model']=_['keys'](db['Disposition'][_0xfbd9('0x32')]);_0x5b16a3[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x3a2362['query']);_0x5b16a3[_0xfbd9('0x41')]=_['intersection'](_0x5b16a3[_0xfbd9('0x36')],_0x5b16a3[_0xfbd9('0x34')]);_0x1f823d[_0xfbd9('0x39')]=_[_0xfbd9('0x37')](_0x5b16a3[_0xfbd9('0x36')],qs['fields'](_0x3a2362[_0xfbd9('0x34')]['fields']));_0x1f823d[_0xfbd9('0x39')]=_0x1f823d['attributes'][_0xfbd9('0x3a')]?_0x1f823d[_0xfbd9('0x39')]:_0x5b16a3[_0xfbd9('0x36')];if(!_0x3a2362[_0xfbd9('0x34')][_0xfbd9('0x3b')](_0xfbd9('0x3c'))){_0x1f823d[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0x3a2362[_0xfbd9('0x34')][_0xfbd9('0x3d')]);_0x1f823d[_0xfbd9('0x25')]=qs['offset'](_0x3a2362[_0xfbd9('0x34')]['offset']);}_0x1f823d['order']=qs[_0xfbd9('0x3f')](_0x3a2362[_0xfbd9('0x34')][_0xfbd9('0x3f')]);_0x1f823d[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_[_0xfbd9('0x42')](_0x3a2362['query'],_0x5b16a3[_0xfbd9('0x41')]));_0x1f823d[_0xfbd9('0x40')][_0xfbd9('0x5a')]=_0x382423['id'];if(_0x3a2362[_0xfbd9('0x34')][_0xfbd9('0x43')]){_0x1f823d[_0xfbd9('0x40')]=_[_0xfbd9('0x46')](_0x1f823d['where'],{'$or':_[_0xfbd9('0x30')](_0x1f823d[_0xfbd9('0x39')],function(_0x2ddf35){var _0x7e7c95={};_0x7e7c95[_0x2ddf35]={'$like':'%'+_0x3a2362[_0xfbd9('0x34')]['filter']+'%'};return _0x7e7c95;})});}_0x1f823d=_[_0xfbd9('0x46')]({},_0x1f823d,_0x3a2362[_0xfbd9('0x5e')]);return db[_0xfbd9('0x5b')][_0xfbd9('0x24')]({'where':_0x1f823d[_0xfbd9('0x40')]})[_0xfbd9('0x14')](function(_0x138c5b){_0xf896f7['count']=_0x138c5b;if(_0x3a2362[_0xfbd9('0x34')][_0xfbd9('0x47')]){_0x1f823d[_0xfbd9('0x48')]=[{'all':!![]}];}return db['Disposition'][_0xfbd9('0x49')](_0x1f823d);})[_0xfbd9('0x14')](function(_0x1dedd5){_0xf896f7['rows']=_0x1dedd5;return _0xf896f7;});}})[_0xfbd9('0x14')](respondWithFilteredResult(_0x153f15,_0x1f823d))[_0xfbd9('0x1f')](handleError(_0x153f15,null));};exports[_0xfbd9('0x5f')]=function(_0x2cb31d,_0x57f123){return db['ChatWebsite'][_0xfbd9('0x4e')]({'where':{'id':_0x2cb31d[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x57f123,null))[_0xfbd9('0x14')](function(_0x253936){if(_0x253936){return _0x253936[_0xfbd9('0x5f')](_0x2cb31d[_0xfbd9('0x34')][_0xfbd9('0x60')]);}})['then'](respondWithStatusCode(_0x57f123,null))[_0xfbd9('0x1f')](handleError(_0x57f123,null));};exports[_0xfbd9('0x61')]=function(_0x460213,_0x4bd629){if(_0x460213[_0xfbd9('0x57')]['id']){delete _0x460213[_0xfbd9('0x57')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x460213[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x4bd629,null))[_0xfbd9('0x14')](function(_0x2b91b2){if(_0x2b91b2){_0x460213['body'][_0xfbd9('0x5a')]=_0x2b91b2['id'];return db[_0xfbd9('0x62')][_0xfbd9('0x4f')](_0x460213['body']);}})[_0xfbd9('0x14')](respondWithResult(_0x4bd629,null))['catch'](handleError(_0x4bd629,null));};exports[_0xfbd9('0x63')]=function(_0x5b4bd3,_0x81dba4){var _0x3cacc6={'raw':![],'where':{}};var _0x285168={};var _0x2bb0bb={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5b4bd3['params']['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x81dba4,null))['then'](function(_0x5cf56b){if(_0x5cf56b){_0x285168['model']=_['keys'](db[_0xfbd9('0x62')]['rawAttributes']);_0x285168['query']=_['keys'](_0x5b4bd3['query']);_0x285168[_0xfbd9('0x41')]=_['intersection'](_0x285168[_0xfbd9('0x36')],_0x285168[_0xfbd9('0x34')]);_0x3cacc6[_0xfbd9('0x39')]=_[_0xfbd9('0x37')](_0x285168[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x3cacc6[_0xfbd9('0x39')]=_0x3cacc6[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0x3cacc6[_0xfbd9('0x39')]:_0x285168[_0xfbd9('0x36')];if(!_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x3b')](_0xfbd9('0x3c'))){_0x3cacc6[_0xfbd9('0x3d')]=qs['limit'](_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x3d')]);_0x3cacc6[_0xfbd9('0x25')]=qs[_0xfbd9('0x25')](_0x5b4bd3['query']['offset']);}_0x3cacc6[_0xfbd9('0x3e')]=qs[_0xfbd9('0x3f')](_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x3f')]);_0x3cacc6[_0xfbd9('0x40')]=qs['filters'](_[_0xfbd9('0x42')](_0x5b4bd3['query'],_0x285168[_0xfbd9('0x41')]));_0x3cacc6[_0xfbd9('0x40')][_0xfbd9('0x5a')]=_0x5cf56b['id'];if(_0x5b4bd3['query'][_0xfbd9('0x43')]){_0x3cacc6[_0xfbd9('0x40')]=_[_0xfbd9('0x46')](_0x3cacc6[_0xfbd9('0x40')],{'$or':_[_0xfbd9('0x30')](_0x3cacc6[_0xfbd9('0x39')],function(_0x481dc5){var _0x4dbf69={};_0x4dbf69[_0x481dc5]={'$like':'%'+_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x4dbf69;})});}_0x3cacc6=_[_0xfbd9('0x46')]({},_0x3cacc6,_0x5b4bd3[_0xfbd9('0x5e')]);return db[_0xfbd9('0x62')][_0xfbd9('0x24')]({'where':_0x3cacc6[_0xfbd9('0x40')]})['then'](function(_0x20035a){_0x2bb0bb[_0xfbd9('0x24')]=_0x20035a;if(_0x5b4bd3[_0xfbd9('0x34')][_0xfbd9('0x47')]){_0x3cacc6[_0xfbd9('0x48')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfbd9('0x49')](_0x3cacc6);})['then'](function(_0x2c74f5){_0x2bb0bb[_0xfbd9('0x4a')]=_0x2c74f5;return _0x2bb0bb;});}})[_0xfbd9('0x14')](respondWithFilteredResult(_0x81dba4,_0x3cacc6))['catch'](handleError(_0x81dba4,null));};exports['removeAnswers']=function(_0x6ccdf0,_0x2d73f6){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x6ccdf0[_0xfbd9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d73f6,null))[_0xfbd9('0x14')](function(_0x59b97c){if(_0x59b97c){return _0x59b97c['removeAnswers'](_0x6ccdf0[_0xfbd9('0x34')]['ids']);}})['then'](respondWithStatusCode(_0x2d73f6,null))[_0xfbd9('0x1f')](handleError(_0x2d73f6,null));};exports[_0xfbd9('0x64')]=function(_0x4b4ccd,_0x493926){_0x4b4ccd[_0xfbd9('0x57')]['sitepic']=_0x4b4ccd[_0xfbd9('0x65')][_0xfbd9('0x66')];return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x4b4ccd['params']['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x493926,null))[_0xfbd9('0x14')](saveUpdates(_0x4b4ccd[_0xfbd9('0x57')],null))[_0xfbd9('0x14')](respondWithResult(_0x493926,null))[_0xfbd9('0x1f')](handleError(_0x493926,null));};exports['addAvatar']=function(_0x4e4be8,_0x376486){_0x4e4be8[_0xfbd9('0x57')][_0xfbd9('0x67')]=_0x4e4be8['file']['filename'];return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x4e4be8[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x376486,null))[_0xfbd9('0x14')](saveUpdates(_0x4e4be8[_0xfbd9('0x57')],null))[_0xfbd9('0x14')](respondWithResult(_0x376486,null))[_0xfbd9('0x1f')](handleError(_0x376486,null));};exports['addCustomerAvatar']=function(_0x30efa6,_0xdd5924){_0x30efa6[_0xfbd9('0x57')][_0xfbd9('0x68')]=_0x30efa6[_0xfbd9('0x65')][_0xfbd9('0x66')];return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x30efa6['params']['id']}})['then'](handleEntityNotFound(_0xdd5924,null))[_0xfbd9('0x14')](saveUpdates(_0x30efa6[_0xfbd9('0x57')],null))[_0xfbd9('0x14')](respondWithResult(_0xdd5924,null))[_0xfbd9('0x1f')](handleError(_0xdd5924,null));};exports[_0xfbd9('0x69')]=function(_0x37da31,_0x51b245){_0x37da31[_0xfbd9('0x57')][_0xfbd9('0x6a')]=_0x37da31[_0xfbd9('0x65')]['filename'];return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x37da31[_0xfbd9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51b245,null))[_0xfbd9('0x14')](saveUpdates(_0x37da31['body'],null))[_0xfbd9('0x14')](respondWithResult(_0x51b245,null))[_0xfbd9('0x1f')](handleError(_0x51b245,null));};exports[_0xfbd9('0x6b')]=function(_0x5c1e95,_0x17a18a){var _0x17ddc5=path[_0xfbd9('0x6c')](config['root'],'server/files/images/logos/default_logo.svg');var _0x35892c={'where':{'id':_0x5c1e95[_0xfbd9('0x4c')]['id']},'attributes':['id',_0xfbd9('0x6d')],'raw':!![]};var _0xb9166a=![];return require(_0xfbd9('0x6e'))[_0xfbd9('0x6f')]()['then'](function(_0x49357f){if(_0x49357f){_0xb9166a=_0x49357f[_0xfbd9('0x70')];}})['then'](function(){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')](_0x35892c);})[_0xfbd9('0x14')](handleEntityNotFound(_0x17a18a,null))[_0xfbd9('0x14')](function(_0x2d32f4){if(_0x2d32f4){if(!_[_0xfbd9('0x71')](_0x2d32f4['sitepic'])){if(fs[_0xfbd9('0x72')](path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0x74'),_0x2d32f4[_0xfbd9('0x6d')]))&&_0xb9166a){_0x17ddc5=path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0x74'),_0x2d32f4[_0xfbd9('0x6d')]);}}return _0x17a18a[_0xfbd9('0x75')](_0x17ddc5);}})[_0xfbd9('0x1f')](handleError(_0x17a18a,null));};exports[_0xfbd9('0x76')]=function(_0x561819,_0x4ad831){var _0x439396=path[_0xfbd9('0x6c')](config['root'],_0xfbd9('0x77'));var _0x4afa90={'where':{'id':_0x561819[_0xfbd9('0x4c')]['id']},'attributes':['id',_0xfbd9('0x67')],'raw':!![]};return db['ChatWebsite']['find'](_0x4afa90)[_0xfbd9('0x14')](handleEntityNotFound(_0x4ad831,null))[_0xfbd9('0x14')](function(_0x1c7a0b){if(_0x1c7a0b){if(!_[_0xfbd9('0x71')](_0x1c7a0b['agentAvatar'])){if(fs['existsSync'](path[_0xfbd9('0x6c')](config['root'],'server/files/images/avatars/',_0x1c7a0b[_0xfbd9('0x67')]))){_0x439396=path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],'server/files/images/avatars/',_0x1c7a0b[_0xfbd9('0x67')]);}}return _0x4ad831['download'](_0x439396);}})[_0xfbd9('0x1f')](handleError(_0x4ad831,null));};exports['getCustomerAvatar']=function(_0x1fb68d,_0x176960){var _0x596c84=path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],'server/files/images/avatars/customer_avatar.png');var _0x1392ab={'where':{'id':_0x1fb68d[_0xfbd9('0x4c')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0xfbd9('0x31')]['find'](_0x1392ab)[_0xfbd9('0x14')](handleEntityNotFound(_0x176960,null))[_0xfbd9('0x14')](function(_0x625923){if(_0x625923){if(!_[_0xfbd9('0x71')](_0x625923[_0xfbd9('0x68')])){if(fs[_0xfbd9('0x72')](path[_0xfbd9('0x6c')](config['root'],_0xfbd9('0x78'),_0x625923[_0xfbd9('0x68')]))&&_0x625923[_0xfbd9('0x79')]){_0x596c84=path['join'](config[_0xfbd9('0x73')],_0xfbd9('0x78'),_0x625923[_0xfbd9('0x68')]);}}return _0x176960[_0xfbd9('0x75')](_0x596c84);}})[_0xfbd9('0x1f')](handleError(_0x176960,null));};exports[_0xfbd9('0x7a')]=function(_0x4579ae,_0x2562b8){var _0x209c23=path['join'](config[_0xfbd9('0x73')],_0xfbd9('0x7b'));var _0x564e2f={'where':{'id':_0x4579ae[_0xfbd9('0x4c')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xfbd9('0x4e')](_0x564e2f)[_0xfbd9('0x14')](handleEntityNotFound(_0x2562b8,null))[_0xfbd9('0x14')](function(_0x15165e){if(_0x15165e){if(!_[_0xfbd9('0x71')](_0x15165e[_0xfbd9('0x6a')])){if(fs[_0xfbd9('0x72')](path['join'](config[_0xfbd9('0x73')],_0xfbd9('0x78'),_0x15165e[_0xfbd9('0x6a')]))){_0x209c23=path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0x78'),_0x15165e[_0xfbd9('0x6a')]);}}return _0x2562b8[_0xfbd9('0x75')](_0x209c23);}})['catch'](handleError(_0x2562b8,null));};exports[_0xfbd9('0x7c')]=function(_0x3fcdff,_0x2a15bc){var _0x2b0a0f=require('user-agent-parser');var _0x500054=new _0x2b0a0f();var _0x9e8183=_0x500054[_0xfbd9('0x7d')](_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x7f')])[_0xfbd9('0x80')]();var _0x80b4da={'body':_0x3fcdff[_0xfbd9('0x57')],'channel':_0xfbd9('0x81')};var _0xdbcb75=[];var _0x23a3f7=[];var _0x559f26={};var _0x5157b0=![];return db[_0xfbd9('0x82')][_0xfbd9('0x58')]()[_0xfbd9('0x14')](function(_0x1617a6){if(!_0x1617a6){throw new db[(_0xfbd9('0x83'))][(_0xfbd9('0x84'))]('no\x20available\x20attributes');}_0xdbcb75=_[_0xfbd9('0x85')](_[_0xfbd9('0x35')](_0x1617a6),[_0xfbd9('0x86'),'updatedAt']);_0x23a3f7=_['difference'](_[_0xfbd9('0x35')](_0x1617a6),['createdAt',_0xfbd9('0x87'),_0xfbd9('0x88'),'ListId']);if(_0x3fcdff[_0xfbd9('0x57')]['id']){delete _0x3fcdff[_0xfbd9('0x57')]['id'];}if(_[_0xfbd9('0x71')](_0x3fcdff[_0xfbd9('0x57')]['from'])){throw new db[(_0xfbd9('0x83'))][(_0xfbd9('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x3fcdff['body'][_0xfbd9('0x57')])||_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0x57')]===''){throw new db['Sequelize']['ValidationError'](_0xfbd9('0x89'));}if(_[_0xfbd9('0x71')](_0x3fcdff[_0xfbd9('0x57')]['mapKey'])){throw new db['Sequelize'][(_0xfbd9('0x84'))](_0xfbd9('0x8a')+_0x23a3f7);}if(!_[_0xfbd9('0x8b')](_0x23a3f7,_0x3fcdff['body']['mapKey'])){throw new db[(_0xfbd9('0x83'))][(_0xfbd9('0x84'))](_0xfbd9('0x8c')+_0x23a3f7);}_0x559f26[_0x3fcdff[_0xfbd9('0x57')]['mapKey']]=_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0x8d')];})[_0xfbd9('0x14')](function(){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x3fcdff[_0xfbd9('0x4c')]['id']},'include':[{'model':db[_0xfbd9('0x8e')],'as':'List','include':[{'model':db[_0xfbd9('0x82')],'as':_0xfbd9('0x8f'),'where':_0x559f26,'limit':0x1,'order':[[_0xfbd9('0x87'),'DESC']]}]},{'model':db[_0xfbd9('0x90')],'as':_0xfbd9('0x91')}]});})[_0xfbd9('0x14')](handleEntityNotFound(_0x2a15bc,null))[_0xfbd9('0x14')](function(_0xcbdd80){if(_0xcbdd80&&_0xcbdd80[_0xfbd9('0x92')]){_0x80b4da['account']=_0xcbdd80;_0x80b4da['applications']=_0xcbdd80[_0xfbd9('0x91')];_0x80b4da[_0xfbd9('0x93')]=_0xcbdd80[_0xfbd9('0x92')];_0x80b4da[_0xfbd9('0x94')]=_[_0xfbd9('0x95')](_0x80b4da['applications'],[_0xfbd9('0x96')],['asc']);if(_0x80b4da[_0xfbd9('0x97')][_0xfbd9('0x91')]){delete _0x80b4da[_0xfbd9('0x97')][_0xfbd9('0x91')];}if(_0x80b4da[_0xfbd9('0x97')][_0xfbd9('0x92')]&&_0x80b4da[_0xfbd9('0x97')][_0xfbd9('0x92')][_0xfbd9('0x8f')][_0xfbd9('0x3a')]){return _0x80b4da[_0xfbd9('0x97')]['List'][_0xfbd9('0x8f')][0x0];}var _0x1b1590=_[_0xfbd9('0xb')](_0x3fcdff[_0xfbd9('0x57')],{'firstName':_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0x8d')],'ListId':_0xcbdd80[_0xfbd9('0x98')]});_0x1b1590[_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0x99')]]=_0x3fcdff[_0xfbd9('0x57')]['from'];return db[_0xfbd9('0x82')][_0xfbd9('0x4f')](_0x1b1590,{'fields':_0xdbcb75,'raw':!![]});}})[_0xfbd9('0x14')](handleEntityNotFound(_0x2a15bc,null))[_0xfbd9('0x14')](function(_0x150683){_0x80b4da['contact']=_0x150683;var _0xb98837=_0x3fcdff[_0xfbd9('0x57')]['customerIp'];if(_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9a')]){_0xb98837=_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9a')];}else if(_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9b')]){_0xb98837=_['first'](_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9b')][_0xfbd9('0x9c')](','));}if(_0x150683){var _0x542a8e={'ContactId':_0x150683['id'],'ChatWebsiteId':_0x3fcdff[_0xfbd9('0x4c')]['id'],'from':(_0x150683['firstName']||'')+'\x20'+(_0x150683['lastName']||''),'customerIp':_0xb98837,'customerPort':_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9d')]?_0x3fcdff[_0xfbd9('0x7e')][_0xfbd9('0x9d')]:null,'referer':_0x3fcdff['body'][_0xfbd9('0x9e')],'browserName':_0x9e8183[_0xfbd9('0x9f')][_0xfbd9('0x2c')]&&_0x9e8183[_0xfbd9('0x9f')]['version']?util[_0xfbd9('0xa0')]('%s\x20%s',_0x9e8183[_0xfbd9('0x9f')][_0xfbd9('0x2c')],_0x9e8183['browser'][_0xfbd9('0xa1')]):'unknown','browserVersion':_0x9e8183[_0xfbd9('0x9f')][_0xfbd9('0xa1')]||_0xfbd9('0xa2'),'osName':util[_0xfbd9('0xa0')]('%s\x20%s',_0x9e8183['os'][_0xfbd9('0x2c')],_0x9e8183['os'][_0xfbd9('0xa1')]),'osVersion':_0x9e8183['os'][_0xfbd9('0xa1')],'deviceModel':_0x9e8183['device']['model']&&_0x9e8183[_0xfbd9('0xa3')]['vendor']?util[_0xfbd9('0xa0')](_0xfbd9('0xa4'),_0x9e8183['device']['model'],_0x9e8183[_0xfbd9('0xa3')][_0xfbd9('0xa5')],_0x9e8183[_0xfbd9('0xa3')][_0xfbd9('0x44')]):null,'deviceVendor':_0x9e8183[_0xfbd9('0xa3')][_0xfbd9('0xa5')],'deviceType':_0x9e8183[_0xfbd9('0xa3')][_0xfbd9('0x44')],'formData':JSON[_0xfbd9('0x1a')](_0x3fcdff['body'])};var _0x1ce188={'ChatWebsiteId':_0x3fcdff[_0xfbd9('0x4c')]['id'],'closed':![]};if(_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xa6')]){_0x1ce188[_0xfbd9('0xa6')]=_0x3fcdff['body'][_0xfbd9('0xa6')];return db[_0xfbd9('0xa7')][_0xfbd9('0x4e')]({'where':_0x1ce188})[_0xfbd9('0x14')](function(_0x2b7c69){if(_0x2b7c69){return[_0x2b7c69,![]];}_0x542a8e['threadId']=_0x3fcdff[_0xfbd9('0x57')]['threadId'];_0x542a8e[_0xfbd9('0xa8')]=_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xa8')];return db[_0xfbd9('0xa7')][_0xfbd9('0x4f')](_0x542a8e)[_0xfbd9('0x14')](function(_0x47f3d4){return[_0x47f3d4,!![]];});});}_0x1ce188[_0xfbd9('0xa9')]=_0x150683['id'];if(_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xaa')]&&_0x3fcdff['body'][_0xfbd9('0xaa')]['id']){_0x1ce188['id']=_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xaa')]['id'];return db[_0xfbd9('0xa7')][_0xfbd9('0x4e')]({'where':_0x1ce188})['then'](function(_0x270b81){if(_0x270b81){return[_0x270b81,![]];}return db[_0xfbd9('0xa7')][_0xfbd9('0x4f')](_0x542a8e)[_0xfbd9('0x14')](function(_0x337115){return[_0x337115,!![]];});});}return db[_0xfbd9('0xa7')][_0xfbd9('0x4f')](_0x542a8e)['then'](function(_0x1b06b4){return[_0x1b06b4,!![]];});}})[_0xfbd9('0xab')](function(_0x1c6a28,_0x1bfcd1){if(_0x1c6a28){_0x5157b0=_0x1bfcd1;if(!_0x1bfcd1){var _0x4585b5={'from':(_0x80b4da['contact']['firstName']||'')+'\x20'+(_0x80b4da[_0xfbd9('0xac')][_0xfbd9('0xad')]||'')};if(_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xa6')]&&_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xae')]&&_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xa6')]!=_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xae')]){_0x4585b5['threadId']=_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xae')];}return _0x1c6a28['update'](_0x4585b5);}else{return _0x1c6a28;}}})[_0xfbd9('0x14')](function(_0x5edcb0){_0x80b4da['interaction']=_0x5edcb0['get']({'plain':!![]});_0x80b4da[_0xfbd9('0xaa')][_0xfbd9('0xaf')]=_0x5157b0;if(_0x80b4da[_0xfbd9('0xaa')][_0xfbd9('0xaf')]){if(_0x80b4da[_0xfbd9('0x97')][_0xfbd9('0xb0')]){_0x80b4da[_0xfbd9('0x94')]['push']({'id':0x0,'priority':_0x80b4da['applications'][_0xfbd9('0x3a')]+0x1,'app':_0xfbd9('0xb1'),'appdata':_0xfbd9('0xb2'),'interval':'*,*,*,*'});}}return db['ChatMessage'][_0xfbd9('0x4f')]({'body':_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0x57')],'ChatWebsiteId':_0x3fcdff['params']['id'],'ChatInteractionId':_0x5edcb0['id'],'direction':'in','ContactId':_0x80b4da['contact']['id'],'AttachmentId':_0x3fcdff[_0xfbd9('0x57')][_0xfbd9('0xb3')]});})['then'](function(_0x4899a1){_0x80b4da['message']=_0x4899a1;if(_0x80b4da[_0xfbd9('0xaa')][_0xfbd9('0xb4')]){return db[_0xfbd9('0xb5')][_0xfbd9('0x4e')]({'attributes':['id',_0xfbd9('0x2c')],'where':{'id':_0x80b4da[_0xfbd9('0xaa')]['UserId']}})['then'](function(_0x1ce131){if(_0x1ce131){_0x80b4da['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xfbd9('0xb6'),'appdata':_0x1ce131['name']+','+(_0x80b4da['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x80b4da[_0xfbd9('0xb7')]=!![];}return respondWithRpcPromise('Start',_0xfbd9('0xb8'),_0x80b4da);});}return respondWithRpcPromise(_0xfbd9('0xb9'),'startRouting',_0x80b4da);})['then'](function(_0xf2c84d){respondWithRpcPromise(_0xfbd9('0xba'),_0xfbd9('0xba'),{'event':'notify','message':_0xf2c84d},client9002);return _0xf2c84d;})['then'](respondWithResult(_0x2a15bc,null))[_0xfbd9('0x1f')](handleError(_0x2a15bc,null));};exports[_0xfbd9('0xbb')]=function(_0x279e1d,_0x1b5d18){var _0x41ef1f,_0x75f11d,_0x4a527c;var _0x53e7b8=[];var _0x251e3c={};var _0x222fa0=_0x279e1d[_0xfbd9('0xbc')]||[];var _0xa58245=[];var _0x39bdde;return db[_0xfbd9('0x82')][_0xfbd9('0x58')]()[_0xfbd9('0x14')](function(_0x23fdf9){if(!_0x23fdf9){throw new db[(_0xfbd9('0x83'))][(_0xfbd9('0x84'))](_0xfbd9('0xbd'));}_0x53e7b8=_[_0xfbd9('0x85')](_[_0xfbd9('0x35')](_0x23fdf9),[_0xfbd9('0x86'),_0xfbd9('0x87'),_0xfbd9('0x88'),_0xfbd9('0x98')]);if(_0x279e1d[_0xfbd9('0x57')]['id']){delete _0x279e1d[_0xfbd9('0x57')]['id'];}if(_[_0xfbd9('0x71')](_0x279e1d[_0xfbd9('0x57')][_0xfbd9('0x8d')])){throw _0x1b5d18[_0xfbd9('0x21')](0x1f4)['send'](new db[(_0xfbd9('0x83'))]['ValidationError'](_0xfbd9('0xbe')));}if(_[_0xfbd9('0x71')](_0x279e1d['body'][_0xfbd9('0x57')])||_0x279e1d[_0xfbd9('0x57')][_0xfbd9('0x57')]===''){throw _0x1b5d18['status'](0x1f4)[_0xfbd9('0x2d')](new db['Sequelize'][(_0xfbd9('0x84'))](_0xfbd9('0x89')));}if(_['isNil'](_0x279e1d[_0xfbd9('0x57')]['mapKeyOffline'])){throw _0x1b5d18['status'](0x1f4)[_0xfbd9('0x2d')](new db[(_0xfbd9('0x83'))][(_0xfbd9('0x84'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x53e7b8));}if(!_[_0xfbd9('0x8b')](_0x53e7b8,_0x279e1d[_0xfbd9('0x57')][_0xfbd9('0xbf')])){throw _0x1b5d18[_0xfbd9('0x21')](0x1f4)[_0xfbd9('0x2d')](new db['Sequelize'][(_0xfbd9('0x84'))](_0xfbd9('0xc0')+_0x53e7b8));}_0x251e3c[_0x279e1d['body'][_0xfbd9('0xbf')]]=_0x279e1d['body'][_0xfbd9('0x8d')];})[_0xfbd9('0x14')](function(){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x279e1d[_0xfbd9('0x4c')]['id']},'include':[{'model':db[_0xfbd9('0x8e')],'as':_0xfbd9('0x92')},{'model':db[_0xfbd9('0xc1')],'as':_0xfbd9('0xc1')}]});})['then'](handleEntityNotFound(_0x1b5d18,null))[_0xfbd9('0x14')](function(_0x592ab4){if(_0x592ab4&&_0x592ab4[_0xfbd9('0x92')]){_0x75f11d=_0x592ab4;var _0x1ffc44=_[_0xfbd9('0xb')](_0x279e1d[_0xfbd9('0x57')],{'firstName':_0x279e1d['body'][_0xfbd9('0x8d')],'phone':_0x279e1d[_0xfbd9('0x57')][_0xfbd9('0x8d')],'ListId':_0x592ab4['ListId']});_0x1ffc44[_0x279e1d['body'][_0xfbd9('0xbf')]]=_0x279e1d[_0xfbd9('0x57')][_0xfbd9('0x8d')];return db[_0xfbd9('0x82')][_0xfbd9('0xc2')]({'where':_0x251e3c,'defaults':_0x1ffc44});}})[_0xfbd9('0xab')](function(_0x438fdc){if(_0x438fdc){_0x4a527c=_0x438fdc;var _0x4ae16c=fs[_0xfbd9('0xc3')](path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0xc4')),_0xfbd9('0xc5'));var _0x3fba18=ejs[_0xfbd9('0xc6')](_0x4ae16c,{'body':_['toPairs'](_0x279e1d[_0xfbd9('0x57')]['body']),'bodyTitle':_0x75f11d[_0xfbd9('0xc7')]});return db['ChatOfflineMessage'][_0xfbd9('0x4f')]({'body':_0x3fba18,'plainBody':htmlToText['fromString'](_0x3fba18),'ContactId':_0x438fdc['id'],'ChatWebsiteId':_0x75f11d['id']});}})['then'](function(_0x4f9f19){_0x39bdde=_0x4f9f19;if(_0x222fa0[_0xfbd9('0x3a')]){var _0x18c1bd=_0x222fa0[_0xfbd9('0x30')](function(_0x202b8b){return{'name':_0x202b8b['originalname'],'basename':_0x202b8b['filename'],'type':_0x202b8b[_0xfbd9('0xc8')],'ChatOfflineMessageId':_0x4f9f19['id']};});_0xa58245=_0x18c1bd[_0xfbd9('0x30')](_0x53d5ac=>{var _0x4796b5={'filename':_0x53d5ac[_0xfbd9('0x2c')],'path':path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0xc9'),'files',_0xfbd9('0xca'),'offline-chat',_0x53d5ac[_0xfbd9('0xcb')])};return _0x4796b5;});if(!_0x75f11d['openNewInteraction']){return db[_0xfbd9('0xcc')]['transaction'](function(_0x4464fa){return db[_0xfbd9('0xcd')][_0xfbd9('0xce')](_0x18c1bd,{'transaction':_0x4464fa});});}}})[_0xfbd9('0x14')](function(){if(_0x39bdde){_0x41ef1f=_0x39bdde;return db[_0xfbd9('0xc1')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xfbd9('0xcf')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfbd9('0xd0')],'as':_0xfbd9('0xd0'),'raw':!![]}]}]});}})[_0xfbd9('0x14')](function(_0x1c5b69){if(_0x1c5b69&&_0x1c5b69[_0xfbd9('0xd1')]&&_0x75f11d[_0xfbd9('0xd2')]&&_0x75f11d[_0xfbd9('0xd3')]){var _0x554b1b=_0x1c5b69[_0xfbd9('0xd4')]();return respondWithRpcPromise(_0xfbd9('0xd5'),'sendMail',{'account':_0x554b1b,'message':{'from':util[_0xfbd9('0xa0')](_0xfbd9('0xd6'),_0x1c5b69[_0xfbd9('0x2c')],_0x1c5b69['email']||_0x1c5b69[_0xfbd9('0xd1')][_0xfbd9('0x50')]),'to':_0x75f11d[_0xfbd9('0xd3')],'subject':_0x75f11d[_0xfbd9('0xd7')],'html':_0x41ef1f[_0xfbd9('0x57')],'attachments':_0xa58245}},client9003)['then'](function(){return _0x41ef1f;})[_0xfbd9('0x1f')](function(_0x321d16){logger[_0xfbd9('0x1b')](_0x321d16);});}})[_0xfbd9('0x14')](function(){if(_0x75f11d&&_0x75f11d[_0xfbd9('0xd8')]&&_0x75f11d[_0xfbd9('0xd9')]){var _0x35ad64=[];if(_0x222fa0[_0xfbd9('0x3a')]){_0x35ad64=_0x222fa0[_0xfbd9('0x30')](function(_0x5bb7d5){return{'name':_0x5bb7d5[_0xfbd9('0xda')],'basename':_0x5bb7d5['filename'],'type':_0x5bb7d5['mimetype'],'ChatOfflineMessageId':_0x39bdde['id']};});}var _0xeaca25;if(!_[_0xfbd9('0x71')](_0x75f11d[_0xfbd9('0xdb')])){var _0x4f0990=_['map'](_0x279e1d[_0xfbd9('0x57')],function(_0x59a685){return _0x59a685;});var _0x525ab4=_['toPairsIn'](_0x4f0990)[0x0];var _0x8600ef=_[_0xfbd9('0xdc')](_0x525ab4,function(_0x806ee3){return _0x806ee3;});_0xeaca25=_0x8600ef[0x1][_0x75f11d[_0xfbd9('0xdb')]];}var _0x29a78d={'from':_0x4a527c['email'],'firstName':_0x4a527c['firstName'],'lastName':_0x4a527c[_0xfbd9('0xad')],'mapKey':'email','message':{'from':_0x4a527c['email'],'to':_0x75f11d[_0xfbd9('0xc1')]['email'],'cc':'','subject':_[_0xfbd9('0x71')](_0xeaca25)?_0x75f11d[_0xfbd9('0xd7')]:_0xeaca25,'messageId':'','sentAt':new Date(),'attach':_0x35ad64['length'],'attachments':_0x35ad64,'originChannel':'Chat','ChatWebsiteId':_0x75f11d['id'],'ChatOfflineMessageId':_0x41ef1f['id'],'originTo':_0x75f11d[_0xfbd9('0xc1')][_0xfbd9('0xdd')]},'body':_0x41ef1f[_0xfbd9('0x57')]};var _0x4071b2={'account':{'id':_0x75f11d[_0xfbd9('0xd9')]},'body':_0x29a78d,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xfbd9('0xde'),_0xfbd9('0xdf'),_0x4071b2,client9001)['then'](function(){return _0x41ef1f;})[_0xfbd9('0x1f')](function(_0x2ecda6){logger['error'](_0x2ecda6);});}return;})[_0xfbd9('0x14')](function(){if(_0x41ef1f){return _0x41ef1f;}})[_0xfbd9('0x14')](respondWithResult(_0x1b5d18,null))[_0xfbd9('0x1f')](function(_0x87312d){logger['error']('catch',_0x87312d);for(var _0xbf58c2 of _0x222fa0){var _0x104380=path[_0xfbd9('0x6c')](config[_0xfbd9('0x73')],_0xfbd9('0xc9'),_0xfbd9('0xbc'),'attachments','offline-chat',_0xbf58c2[_0xfbd9('0x66')]);fs_extra[_0xfbd9('0xe0')](_0x104380)['catch'](function(_0x54b6f5){logger[_0xfbd9('0x1b')]('Could\x20not\x20remove\x20attachment\x20file',_0x104380,_0x54b6f5);});}});};exports[_0xfbd9('0xe1')]=function(_0x4e3ef5,_0x1b6c23){return db[_0xfbd9('0xa7')]['find']({'where':{'id':_0x4e3ef5[_0xfbd9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1b6c23,null))[_0xfbd9('0x14')](function(_0x3729ab){if(_0x3729ab){return _0x3729ab[_0xfbd9('0xe1')](_0x4e3ef5[_0xfbd9('0x57')][_0xfbd9('0x60')],_['omit'](_0x4e3ef5[_0xfbd9('0x57')],['ids','id'])||{});}})['then'](respondWithResult(_0x1b6c23,null))[_0xfbd9('0x1f')](handleError(_0x1b6c23,null));};exports['getInteractions']=function(_0x173fd3,_0x6d07b5){var _0xf9e01e={'raw':![],'where':{}};var _0xc7456b={};var _0x59394c={'count':0x0,'rows':[]};return db[_0xfbd9('0x31')][_0xfbd9('0x5d')]({'where':{'id':_0x173fd3['params']['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x6d07b5,null))[_0xfbd9('0x14')](function(_0x12fffb){if(_0x12fffb){_0xc7456b[_0xfbd9('0x36')]=_[_0xfbd9('0x35')](db['ChatInteraction'][_0xfbd9('0x32')]);_0xc7456b[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x173fd3['query']);_0xc7456b['filters']=_['intersection'](_0xc7456b[_0xfbd9('0x36')],_0xc7456b[_0xfbd9('0x34')]);_0xf9e01e[_0xfbd9('0x39')]=_[_0xfbd9('0x37')](_0xc7456b[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x173fd3[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0xf9e01e[_0xfbd9('0x39')]=_0xf9e01e[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0xf9e01e[_0xfbd9('0x39')]:_0xc7456b['model'];if(!_0x173fd3[_0xfbd9('0x34')]['hasOwnProperty']('nolimit')){_0xf9e01e[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0x173fd3[_0xfbd9('0x34')]['limit']);_0xf9e01e[_0xfbd9('0x25')]=qs[_0xfbd9('0x25')](_0x173fd3['query'][_0xfbd9('0x25')]);}_0xf9e01e[_0xfbd9('0x3e')]=qs['sort'](_0x173fd3[_0xfbd9('0x34')]['sort']);_0xf9e01e[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_[_0xfbd9('0x42')](_0x173fd3[_0xfbd9('0x34')],_0xc7456b['filters']));_0xf9e01e[_0xfbd9('0x40')][_0xfbd9('0x5a')]=_0x12fffb['id'];if(_0x173fd3[_0xfbd9('0x34')]['filter']){_0xf9e01e[_0xfbd9('0x40')]=_['merge'](_0xf9e01e[_0xfbd9('0x40')],{'$or':_[_0xfbd9('0x30')](_0xf9e01e[_0xfbd9('0x39')],function(_0x48030e){var _0x5c326a={};_0x5c326a[_0x48030e]={'$like':'%'+_0x173fd3[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x5c326a;})});}_0xf9e01e=_['merge']({},_0xf9e01e,_0x173fd3[_0xfbd9('0x5e')]);return db[_0xfbd9('0xa7')][_0xfbd9('0x24')]({'where':_0xf9e01e[_0xfbd9('0x40')]})['then'](function(_0x53852f){_0x59394c[_0xfbd9('0x24')]=_0x53852f;if(_0x173fd3['query'][_0xfbd9('0x47')]){_0xf9e01e[_0xfbd9('0x48')]=[{'model':db[_0xfbd9('0x82')],'as':_0xfbd9('0xe2'),'required':![]},{'model':db['User'],'as':_0xfbd9('0xe3'),'attributes':[_0xfbd9('0x2c'),_0xfbd9('0xe4'),_0xfbd9('0xe5')],'required':![]},{'model':db[_0xfbd9('0xe6')],'as':'Tags','attributes':['id','name',_0xfbd9('0xe7')],'where':_0x173fd3[_0xfbd9('0x34')][_0xfbd9('0xe8')]?{'id':_0x173fd3['query'][_0xfbd9('0xe8')]}:undefined,'required':_0x173fd3['query'][_0xfbd9('0xe8')]?!![]:![]}];}return db[_0xfbd9('0xa7')][_0xfbd9('0x49')](_0xf9e01e);})[_0xfbd9('0x14')](function(_0x5362de){_0x59394c['rows']=_0x5362de;return _0x59394c;});}})[_0xfbd9('0x14')](respondWithFilteredResult(_0x6d07b5,_0xf9e01e))['catch'](handleError(_0x6d07b5,null));};function iftimePromise(_0x8fa9f,_0x4538fe){return respondWithRpcPromise('Command','getSnippet',{'command':_0x4538fe['timezone']?util[_0xfbd9('0xa0')]('iftime\x20%s,%s',_0x8fa9f['interval'],_0x4538fe[_0xfbd9('0xe9')]):util[_0xfbd9('0xa0')](_0xfbd9('0xea'),_0x8fa9f[_0xfbd9('0xeb')])},client9002)[_0xfbd9('0x14')](function(_0x24ecf3){var _0x695ef1=_0x24ecf3&&_0x24ecf3[_0xfbd9('0xec')](_0xfbd9('0xed'))>=0x0?!![]:![];logger[_0xfbd9('0x15')](_0xfbd9('0xee'),_0x4538fe['id'],_0x8fa9f['id'],_0x8fa9f[_0xfbd9('0xeb')],_0x695ef1?_0xfbd9('0xef'):_0xfbd9('0xf0'),_0x4538fe[_0xfbd9('0xe9')]?_0x4538fe[_0xfbd9('0xe9')]:'No\x20timezone');return _0x695ef1;})[_0xfbd9('0x1f')](function(_0x55d4e5){logger[_0xfbd9('0x1b')](_0xfbd9('0xee'),_0x4538fe['id'],_0x8fa9f['id'],_0x8fa9f[_0xfbd9('0xeb')],util[_0xfbd9('0xf1')](_0x55d4e5,{'showHidden':![],'depth':null}),_0x4538fe[_0xfbd9('0xe9')]?_0x4538fe[_0xfbd9('0xe9')]:_0xfbd9('0xf2'));return![];});}exports[_0xfbd9('0xf3')]=function(_0x319830,_0x1c53f5){var _0x24b71d=0x0;var _0x5bd87a=0x0;var _0xa7d1a1=![];var _0x539161;var _0x4bc2de;return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x319830[_0xfbd9('0x4c')]['id']},'include':[{'model':db[_0xfbd9('0xf4')],'as':_0xfbd9('0xf4'),'include':[{'model':db[_0xfbd9('0xf4')],'as':_0xfbd9('0xf5'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xfbd9('0x14')](handleEntityNotFound(_0x1c53f5,null))['then'](function(_0x35c669){if(_0x35c669){_0x539161=_0x35c669;return _0x35c669[_0xfbd9('0xf6')]({'raw':!![]});}})[_0xfbd9('0x14')](function(_0x4782c6){if(_0x539161){if(_0x4782c6){_0x4bc2de=_0x4782c6;}}return require(_0xfbd9('0x6e'))[_0xfbd9('0x6f')]();})[_0xfbd9('0x14')](function(_0x5d4110){if(_0x5d4110){_0x5bd87a=_0x5d4110[_0xfbd9('0xf7')];_0xa7d1a1=_0x5d4110['custom'];}})['then'](function(){return db[_0xfbd9('0xa7')][_0xfbd9('0x24')]({'where':{'closed':![]}});})[_0xfbd9('0x14')](function(_0xc1a012){_0x24b71d=_0xc1a012;if(_0x5bd87a&&_0xc1a012>_0x5bd87a){return db[_0xfbd9('0xf8')][_0xfbd9('0x5d')]({'where':{'id':0x1}})[_0xfbd9('0x14')](function(_0x5026be){if(_0x5026be){_0x5026be[_0xfbd9('0xf9')](_0xfbd9('0xfa'));}});}})[_0xfbd9('0x14')](function(){if(_0x539161['Interval']&&_0x539161['Interval']['Intervals']){var _0xf321d0=[];for(var _0x27cd0a=0x0;_0x27cd0a<_0x539161[_0xfbd9('0xf4')][_0xfbd9('0xf5')][_0xfbd9('0x3a')];_0x27cd0a++){var _0xc624ee=_0x539161[_0xfbd9('0xf4')]['Intervals'][_0x27cd0a][_0xfbd9('0x27')]({'plain':!![]});_0xf321d0['push'](iftimePromise(_0xc624ee,_0x539161));}return BPromise[_0xfbd9('0xfb')](_0xf321d0)['then'](function(_0x34b346){return _['some'](_0x34b346);});}else{return!![];}})[_0xfbd9('0x14')](function(_0x13f415){var _0x59d3a7=fs[_0xfbd9('0xc3')](path[_0xfbd9('0x6c')](config['root'],_0xfbd9('0xfc')),_0xfbd9('0xc5'));var _0x151887={'remote':_0x539161[_0xfbd9('0xfd')],'query':querystring[_0xfbd9('0x1a')](_['merge'](_0x539161['get']({'plain':!![]}),{'customerIp':_0x319830[_0xfbd9('0x7e')][_0xfbd9('0x9b')]||_0x319830[_0xfbd9('0x7e')][_0xfbd9('0xfe')]||_0x319830[_0xfbd9('0xff')][_0xfbd9('0x100')]||_0x319830['ip'],'referer':_0x319830[_0xfbd9('0x7e')][_0xfbd9('0x9e')],'openedInteractions':_0x24b71d,'maxInteractions':_0x5bd87a,'virtual':_0xa7d1a1[_0xfbd9('0xf7')],'online':_0x13f415,'custom':_0xa7d1a1}))[_0xfbd9('0x101')](/'/g,'\x5c\x27')};_0x1c53f5[_0xfbd9('0x2d')](ejs[_0xfbd9('0xc6')](Mustache[_0xfbd9('0xc6')](_0x59d3a7,_0x151887),{'proactiveActions':_0x4bc2de,'alignment':_0x539161['alignment'],'verticalAlignment':_0x539161[_0xfbd9('0x102')],'div_color':_0x539161[_0xfbd9('0xe7')],'labelText':_0x539161[_0xfbd9('0x103')],'text_color':_0x539161['textColor'],'text_button_color':_0x539161['textButtonColor'],'button_color':_0x539161['color_button'],'background_color':_0x539161['backgroundColor'],'hideWhenOffline':_0x539161[_0xfbd9('0x104')],'interval':_0x539161[_0xfbd9('0x105')]}));})[_0xfbd9('0x1f')](handleError(_0x1c53f5,null));};exports[_0xfbd9('0x106')]=function(_0x2851d1,_0x32dac7){var _0x4beb83=_0x2851d1[_0xfbd9('0x4c')]['id'];var _0x346d48=_0x2851d1[_0xfbd9('0x57')];var _0x76ae72=0xc8;var _0x2cea20=null;return db[_0xfbd9('0xcc')][_0xfbd9('0x107')]({'isolationLevel':db[_0xfbd9('0xcc')][_0xfbd9('0x108')][_0xfbd9('0x109')][_0xfbd9('0x10a')]},function(_0x55dde4){return db[_0xfbd9('0x31')][_0xfbd9('0x5d')]({'where':{'id':_0x4beb83},'transaction':_0x55dde4})[_0xfbd9('0x14')](function(_0xb4386f){if(_0xb4386f){return db[_0xfbd9('0x90')][_0xfbd9('0x2a')]({'where':{'ChatWebsiteId':_0x4beb83},'transaction':_0x55dde4})[_0xfbd9('0x14')](function(){var _0x51c36b=_[_0xfbd9('0x30')](_0x346d48,function(_0x3143c8){_0x3143c8['ChatWebsiteId']=_0x4beb83;return _0x3143c8;});return db[_0xfbd9('0x90')]['bulkCreate'](_0x51c36b,{'transaction':_0x55dde4});});}else{_0x76ae72=0x194;_0x2cea20=[];}});})[_0xfbd9('0x14')](function(){if(_0x76ae72!==0x194){return db[_0xfbd9('0x90')][_0xfbd9('0x10b')]({'where':{'ChatWebsiteId':_0x4beb83},'order':_0xfbd9('0x96')})[_0xfbd9('0x14')](function(_0x4cf35b){_0x2cea20=_0x4cf35b;});}})['catch'](function(_0x1caa92){_0x76ae72=0x1f4;logger[_0xfbd9('0x1b')](_0x1caa92['stack']);if(_0x1caa92[_0xfbd9('0x2c')]){delete _0x1caa92[_0xfbd9('0x2c')];}_0x2cea20=_0x1caa92;})[_0xfbd9('0x10c')](function(){if(_0x2cea20===null){_0x32dac7['sendStatus'](_0x76ae72);}else{if(_0x76ae72===0x1f4){_0x32dac7[_0xfbd9('0x21')](_0x76ae72)[_0xfbd9('0x2d')](_0x2cea20);}else{_0x32dac7[_0xfbd9('0x21')](_0x76ae72)[_0xfbd9('0x22')](_0x2cea20);}}});};exports[_0xfbd9('0x10d')]=function(_0x52672f,_0x19db23){var _0x54f9f1={};var _0x288b80={};var _0x45cf91;var _0x13c9c6;return db[_0xfbd9('0x31')][_0xfbd9('0x5d')]({'where':{'id':_0x52672f[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x19db23,null))[_0xfbd9('0x14')](function(_0x5b80d8){if(_0x5b80d8){_0x45cf91=_0x5b80d8;_0x288b80[_0xfbd9('0x36')]=_[_0xfbd9('0x35')](db[_0xfbd9('0x90')][_0xfbd9('0x32')]);_0x288b80[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x52672f['query']);_0x288b80[_0xfbd9('0x41')]=_[_0xfbd9('0x37')](_0x288b80[_0xfbd9('0x36')],_0x288b80[_0xfbd9('0x34')]);_0x54f9f1[_0xfbd9('0x39')]=_[_0xfbd9('0x37')](_0x288b80[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x52672f['query'][_0xfbd9('0x38')]));_0x54f9f1[_0xfbd9('0x39')]=_0x54f9f1[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0x54f9f1[_0xfbd9('0x39')]:_0x288b80[_0xfbd9('0x36')];_0x54f9f1[_0xfbd9('0x3e')]=qs[_0xfbd9('0x3f')](_0x52672f[_0xfbd9('0x34')]['sort']);_0x54f9f1[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_[_0xfbd9('0x42')](_0x52672f['query'],_0x288b80[_0xfbd9('0x41')]));if(_0x52672f[_0xfbd9('0x34')][_0xfbd9('0x43')]){_0x54f9f1[_0xfbd9('0x40')]=_[_0xfbd9('0x46')](_0x54f9f1[_0xfbd9('0x40')],{'$or':_['map'](_0x54f9f1['attributes'],function(_0x3ffa85){var _0x413fdb={};_0x413fdb[_0x3ffa85]={'$like':'%'+_0x52672f[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x413fdb;})});}_0x54f9f1=_[_0xfbd9('0x46')]({},_0x54f9f1,_0x52672f[_0xfbd9('0x5e')]);return _0x45cf91['getApplications'](_0x54f9f1);}})['then'](function(_0x5ef070){if(_0x5ef070){_0x13c9c6=_0x5ef070[_0xfbd9('0x3a')];if(!_0x52672f['query'][_0xfbd9('0x3b')](_0xfbd9('0x3c'))){_0x54f9f1[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0x52672f[_0xfbd9('0x34')]['limit']);_0x54f9f1[_0xfbd9('0x25')]=qs['offset'](_0x52672f[_0xfbd9('0x34')][_0xfbd9('0x25')]);}return _0x45cf91[_0xfbd9('0x10d')](_0x54f9f1);}})['then'](function(_0x30e45b){if(_0x30e45b){return _0x30e45b?{'count':_0x13c9c6,'rows':_0x30e45b}:null;}})[_0xfbd9('0x14')](respondWithResult(_0x19db23,null))['catch'](handleError(_0x19db23,null));};exports[_0xfbd9('0x10e')]=function(_0x1a06d6,_0x298337){return db['chatProactiveAction']['find']({'where':{'id':_0x1a06d6[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x298337,null))[_0xfbd9('0x14')](function(_0x32071d){if(_0x32071d){return _0x32071d['addProactiveActions'](_0x1a06d6[_0xfbd9('0x57')]['ids'],_[_0xfbd9('0x10f')](_0x1a06d6[_0xfbd9('0x57')],['ids','id'])||{});}})[_0xfbd9('0x14')](respondWithResult(_0x298337,null))['catch'](handleError(_0x298337,null));};exports['getProactiveActions']=function(_0x19b1e7,_0x466c74){var _0x5dd687={};var _0x53a2f4={};var _0x3ae8d9;var _0x201bbb;return db['ChatWebsite'][_0xfbd9('0x5d')]({'where':{'id':_0x19b1e7[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x466c74,null))[_0xfbd9('0x14')](function(_0xb3514a){if(_0xb3514a){_0x3ae8d9=_0xb3514a;_0x53a2f4[_0xfbd9('0x36')]=_['keys'](db[_0xfbd9('0x110')][_0xfbd9('0x32')]);_0x53a2f4[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x19b1e7[_0xfbd9('0x34')]);_0x53a2f4[_0xfbd9('0x41')]=_[_0xfbd9('0x37')](_0x53a2f4[_0xfbd9('0x36')],_0x53a2f4[_0xfbd9('0x34')]);_0x5dd687[_0xfbd9('0x39')]=_['intersection'](_0x53a2f4[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x19b1e7[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x5dd687[_0xfbd9('0x39')]=_0x5dd687['attributes'][_0xfbd9('0x3a')]?_0x5dd687[_0xfbd9('0x39')]:_0x53a2f4[_0xfbd9('0x36')];_0x5dd687['order']=qs['sort'](_0x19b1e7['query'][_0xfbd9('0x3f')]);_0x5dd687[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_['pick'](_0x19b1e7['query'],_0x53a2f4[_0xfbd9('0x41')]));if(_0x19b1e7[_0xfbd9('0x34')]['filter']){_0x5dd687[_0xfbd9('0x40')]=_[_0xfbd9('0x46')](_0x5dd687['where'],{'$or':_[_0xfbd9('0x30')](_0x5dd687[_0xfbd9('0x39')],function(_0x2957cd){var _0x49574={};_0x49574[_0x2957cd]={'$like':'%'+_0x19b1e7[_0xfbd9('0x34')]['filter']+'%'};return _0x49574;})});}_0x5dd687=_[_0xfbd9('0x46')]({},_0x5dd687,_0x19b1e7[_0xfbd9('0x5e')]);return _0x3ae8d9[_0xfbd9('0xf6')](_0x5dd687);}})[_0xfbd9('0x14')](function(_0x1736e0){if(_0x1736e0){_0x201bbb=_0x1736e0[_0xfbd9('0x3a')];if(!_0x19b1e7[_0xfbd9('0x34')][_0xfbd9('0x3b')](_0xfbd9('0x3c'))){_0x5dd687[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0x19b1e7['query']['limit']);_0x5dd687['offset']=qs[_0xfbd9('0x25')](_0x19b1e7[_0xfbd9('0x34')][_0xfbd9('0x25')]);}return _0x3ae8d9[_0xfbd9('0xf6')](_0x5dd687);}})['then'](function(_0x2127c2){if(_0x2127c2){return _0x2127c2?{'count':_0x201bbb,'rows':_0x2127c2}:null;}})[_0xfbd9('0x14')](respondWithResult(_0x466c74,null))[_0xfbd9('0x1f')](handleError(_0x466c74,null));};exports[_0xfbd9('0x111')]=function(_0x3af34d,_0x28296b){var _0x1cd040=_0x3af34d['query'][_0xfbd9('0x112')]===_0xfbd9('0x113')?_0xfbd9('0x114'):'onlineForm';return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'attributes':['id',_0x1cd040],'where':{'id':_0x3af34d[_0xfbd9('0x4c')]['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x28296b,null))['then'](function(_0x3d7908){if(_0x3d7908){var _0x3040e1=_0x3d7908[_0x1cd040];var _0x2940a1=_0x3040e1&&_0x3040e1[_0xfbd9('0x115')]?_0x3040e1[_0xfbd9('0x115')]:[];_0x28296b[_0xfbd9('0x2d')]({'fromKey':_[_0xfbd9('0x71')](_0x3040e1[_0xfbd9('0x116')])?undefined:_0x3040e1[_0xfbd9('0x116')],'count':_0x2940a1[_0xfbd9('0x3a')],'rows':_0x2940a1});}})[_0xfbd9('0x1f')](handleError(_0x28296b,null));};exports[_0xfbd9('0x117')]=function(_0xbbef82,_0x64b015){var _0x308949={'raw':![],'where':{}};var _0x3b6c69={};var _0x316e9c={'count':0x0,'rows':[]};return db[_0xfbd9('0x31')]['findOne']({'where':{'id':_0xbbef82['params']['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x64b015,null))['then'](function(_0x4a92fb){if(_0x4a92fb){_0x3b6c69[_0xfbd9('0x36')]=_['keys'](db[_0xfbd9('0x118')][_0xfbd9('0x32')]);_0x3b6c69[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0xbbef82[_0xfbd9('0x34')]);_0x3b6c69[_0xfbd9('0x41')]=_[_0xfbd9('0x37')](_0x3b6c69[_0xfbd9('0x36')],_0x3b6c69[_0xfbd9('0x34')]);_0x308949['attributes']=_[_0xfbd9('0x37')](_0x3b6c69[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x308949[_0xfbd9('0x39')]=_0x308949['attributes'][_0xfbd9('0x3a')]?_0x308949[_0xfbd9('0x39')]:_0x3b6c69['model'];if(!_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x3b')]('nolimit')){_0x308949[_0xfbd9('0x3d')]=qs[_0xfbd9('0x3d')](_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x3d')]);_0x308949[_0xfbd9('0x25')]=qs[_0xfbd9('0x25')](_0xbbef82[_0xfbd9('0x34')]['offset']);}_0x308949[_0xfbd9('0x3e')]=qs['sort'](_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x3f')]);_0x308949[_0xfbd9('0x40')]=qs[_0xfbd9('0x41')](_[_0xfbd9('0x42')](_0xbbef82['query'],_0x3b6c69['filters']));_0x308949[_0xfbd9('0x40')][_0xfbd9('0x5a')]=_0x4a92fb['id'];if(_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x43')]){_0x308949[_0xfbd9('0x40')]=_[_0xfbd9('0x46')](_0x308949[_0xfbd9('0x40')],{'$or':_['map'](_0x308949[_0xfbd9('0x39')],function(_0x5223f6){var _0x3a1afd={};_0x3a1afd[_0x5223f6]={'$like':'%'+_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x3a1afd;})});}_0x308949=_[_0xfbd9('0x46')]({},_0x308949,_0xbbef82['options']);return db[_0xfbd9('0x118')]['count']({'where':_0x308949[_0xfbd9('0x40')]})['then'](function(_0x3165c5){_0x316e9c[_0xfbd9('0x24')]=_0x3165c5;if(_0xbbef82[_0xfbd9('0x34')][_0xfbd9('0x47')]){_0x308949[_0xfbd9('0x48')]=[{'all':!![]}];}else{_0x308949[_0xfbd9('0x48')]=[{'model':db[_0xfbd9('0x82')],'as':_0xfbd9('0xe2'),'required':![]},{'model':db[_0xfbd9('0xcd')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x308949);})[_0xfbd9('0x14')](function(_0x2c744f){_0x316e9c['rows']=_0x2c744f;return _0x316e9c;});}})['then'](respondWithFilteredResult(_0x64b015,_0x308949))[_0xfbd9('0x1f')](handleError(_0x64b015,null));};exports[_0xfbd9('0x119')]=function(_0x51784d,_0x386bc1){return db[_0xfbd9('0x31')][_0xfbd9('0x4e')]({'where':{'id':_0x51784d['params']['id']}})['then'](handleEntityNotFound(_0x386bc1,null))[_0xfbd9('0x14')](function(_0x182a78){if(_0x182a78){return _0x182a78[_0xfbd9('0x119')](_0x51784d['body']['ids'],_[_0xfbd9('0x10f')](_0x51784d['body'],[_0xfbd9('0x60'),'id'])||{})[_0xfbd9('0xab')](function(_0x3d4663){for(var _0x1f633e=0x0;_0x1f633e<_0x51784d[_0xfbd9('0x57')]['ids'][_0xfbd9('0x3a')];_0x1f633e+=0x1){socket[_0xfbd9('0x11a')](_0xfbd9('0x11b'),{'UserId':Number(_0x51784d['body'][_0xfbd9('0x60')][_0x1f633e]),'ChatWebsiteId':Number(_0x51784d[_0xfbd9('0x4c')]['id'])});}return _0x3d4663;});}})['then'](respondWithResult(_0x386bc1,null))['catch'](handleError(_0x386bc1,null));};exports['removeAgents']=function(_0x529ef1,_0x8a8196){return db['ChatWebsite'][_0xfbd9('0x4e')]({'where':{'id':_0x529ef1[_0xfbd9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x8a8196,null))[_0xfbd9('0x14')](function(_0x40b70f){if(_0x40b70f){return _0x40b70f[_0xfbd9('0x11c')](_0x529ef1['query'][_0xfbd9('0x60')])[_0xfbd9('0x14')](function(){if(_[_0xfbd9('0x11d')](_0x529ef1[_0xfbd9('0x34')][_0xfbd9('0x60')])){for(var _0x52293a=0x0;_0x52293a<_0x529ef1['query'][_0xfbd9('0x60')][_0xfbd9('0x3a')];_0x52293a+=0x1){socket[_0xfbd9('0x11a')](_0xfbd9('0x11e'),{'UserId':Number(_0x529ef1[_0xfbd9('0x34')]['ids'][_0x52293a]),'ChatWebsiteId':Number(_0x529ef1[_0xfbd9('0x4c')]['id'])});}}else{socket[_0xfbd9('0x11a')](_0xfbd9('0x11e'),{'UserId':Number(_0x529ef1['query'][_0xfbd9('0x60')]),'ChatWebsiteId':Number(_0x529ef1['params']['id'])});}});}})[_0xfbd9('0x14')](respondWithStatusCode(_0x8a8196,null))[_0xfbd9('0x1f')](handleError(_0x8a8196,null));};exports[_0xfbd9('0x11f')]=function(_0x3b5646,_0x119166){var _0x1e2824={};var _0x343813={};var _0x126b96;var _0x1c1434;return db[_0xfbd9('0x31')]['findOne']({'where':{'id':_0x3b5646['params']['id']}})[_0xfbd9('0x14')](handleEntityNotFound(_0x119166,null))[_0xfbd9('0x14')](function(_0x53cba0){if(_0x53cba0){_0x126b96=_0x53cba0;_0x343813[_0xfbd9('0x36')]=_['keys'](db[_0xfbd9('0xb5')]['rawAttributes']);_0x343813[_0xfbd9('0x34')]=_[_0xfbd9('0x35')](_0x3b5646['query']);_0x343813[_0xfbd9('0x41')]=_[_0xfbd9('0x37')](_0x343813[_0xfbd9('0x36')],_0x343813['query']);_0x1e2824['attributes']=_[_0xfbd9('0x37')](_0x343813[_0xfbd9('0x36')],qs[_0xfbd9('0x38')](_0x3b5646[_0xfbd9('0x34')][_0xfbd9('0x38')]));_0x1e2824[_0xfbd9('0x39')]=_0x1e2824[_0xfbd9('0x39')][_0xfbd9('0x3a')]?_0x1e2824[_0xfbd9('0x39')]:_0x343813[_0xfbd9('0x36')];_0x1e2824[_0xfbd9('0x3e')]=qs[_0xfbd9('0x3f')](_0x3b5646[_0xfbd9('0x34')][_0xfbd9('0x3f')]);_0x1e2824[_0xfbd9('0x40')]=qs['filters'](_['pick'](_0x3b5646[_0xfbd9('0x34')],_0x343813[_0xfbd9('0x41')]));if(_0x3b5646[_0xfbd9('0x34')][_0xfbd9('0x43')]){_0x1e2824[_0xfbd9('0x40')]=_['merge'](_0x1e2824['where'],{'$or':_[_0xfbd9('0x30')](_0x1e2824['attributes'],function(_0x4a890d){var _0x27b3f0={};_0x27b3f0[_0x4a890d]={'$like':'%'+_0x3b5646[_0xfbd9('0x34')][_0xfbd9('0x43')]+'%'};return _0x27b3f0;})});}_0x1e2824=_[_0xfbd9('0x46')]({},_0x1e2824,_0x3b5646[_0xfbd9('0x5e')]);return _0x126b96[_0xfbd9('0x11f')](_0x1e2824);}})[_0xfbd9('0x14')](function(_0x4f93e8){if(_0x4f93e8){_0x1c1434=_0x4f93e8[_0xfbd9('0x3a')];if(!_0x3b5646['query']['hasOwnProperty']('nolimit')){_0x1e2824['limit']=qs[_0xfbd9('0x3d')](_0x3b5646['query'][_0xfbd9('0x3d')]);_0x1e2824[_0xfbd9('0x25')]=qs[_0xfbd9('0x25')](_0x3b5646[_0xfbd9('0x34')][_0xfbd9('0x25')]);}return _0x126b96['getAgents'](_0x1e2824);}})[_0xfbd9('0x14')](function(_0x2ac7c8){if(_0x2ac7c8){return _0x2ac7c8?{'count':_0x1c1434,'rows':_0x2ac7c8}:null;}})[_0xfbd9('0x14')](respondWithResult(_0x119166,null))[_0xfbd9('0x1f')](handleError(_0x119166,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 0ba2aea..83ab3a6 100644 --- a/server/api/chatWebsite/chatWebsite.events.js +++ b/server/api/chatWebsite/chatWebsite.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac21=['ChatWebsite','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x22c169,_0x3298a6){var _0x30cc6f=function(_0x2cd339){while(--_0x2cd339){_0x22c169['push'](_0x22c169['shift']());}};_0x30cc6f(++_0x3298a6);}(_0xac21,0x1af));var _0x1ac2=function(_0x341462,_0x330bb1){_0x341462=_0x341462-0x0;var _0x3332ab=_0xac21[_0x341462];return _0x3332ab;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x1ac2('0x0'))['db'][_0x1ac2('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ac2('0x2'),'afterUpdate':'update','afterDestroy':_0x1ac2('0x3')};function emitEvent(_0x15bc3f){return function(_0x5b81be,_0x454461,_0x4efe94){ChatWebsiteEvents[_0x1ac2('0x4')](_0x15bc3f+':'+_0x5b81be['id'],_0x5b81be);ChatWebsiteEvents[_0x1ac2('0x4')](_0x15bc3f,_0x5b81be);_0x4efe94(null);};}for(var e in events){if(events[_0x1ac2('0x5')](e)){var event=events[e];ChatWebsite[_0x1ac2('0x6')](e,emitEvent(event));}}module[_0x1ac2('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x615a=['exports','events','ChatWebsite','save','update','remove','emit','hook'];(function(_0x3e0f52,_0x3754e6){var _0xc558fd=function(_0xdebfaf){while(--_0xdebfaf){_0x3e0f52['push'](_0x3e0f52['shift']());}};_0xc558fd(++_0x3754e6);}(_0x615a,0x119));var _0xa615=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x615a[_0x57b432];return _0x2edf2a;};'use strict';var EventEmitter=require(_0xa615('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xa615('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa615('0x2'),'afterUpdate':_0xa615('0x3'),'afterDestroy':_0xa615('0x4')};function emitEvent(_0x11fd6e){return function(_0x52ae35,_0x1d9a38,_0x1463be){ChatWebsiteEvents['emit'](_0x11fd6e+':'+_0x52ae35['id'],_0x52ae35);ChatWebsiteEvents[_0xa615('0x5')](_0x11fd6e,_0x52ae35);_0x1463be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xa615('0x6')](e,emitEvent(event));}}module[_0xa615('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 9760d8d..45c6844 100644 --- a/server/api/chatWebsite/chatWebsite.model.js +++ b/server/api/chatWebsite/chatWebsite.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ac=['../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x2e3df6,_0x19b323){var _0x12526d=function(_0x2d27df){while(--_0x2d27df){_0x2e3df6['push'](_0x2e3df6['shift']());}};_0x12526d(++_0x19b323);}(_0x61ac,0x131));var _0xc61a=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x61ac[_0x389832];return _0x59429e;};'use strict';var _=require(_0xc61a('0x0'));var util=require(_0xc61a('0x1'));var logger=require(_0xc61a('0x2'))('api');var moment=require(_0xc61a('0x3'));var BPromise=require(_0xc61a('0x4'));var rp=require(_0xc61a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc61a('0x6'));var config=require(_0xc61a('0x7'));var attributes=require(_0xc61a('0x8'));module[_0xc61a('0x9')]=function(_0x1847ba,_0x54b600){return _0x1847ba[_0xc61a('0xa')](_0xc61a('0xb'),attributes,{'tableName':_0xc61a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4664=['../../config/logger','api','moment','path','../../config/environment','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x4a6a8b,_0xbe57ac){var _0x303980=function(_0x324ddc){while(--_0x324ddc){_0x4a6a8b['push'](_0x4a6a8b['shift']());}};_0x303980(++_0xbe57ac);}(_0x4664,0x12a));var _0x4466=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x4664[_0x3f3f40];return _0x403b7a;};'use strict';var _=require(_0x4466('0x0'));var util=require(_0x4466('0x1'));var logger=require(_0x4466('0x2'))(_0x4466('0x3'));var moment=require(_0x4466('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4466('0x5'));var rimraf=require('rimraf');var config=require(_0x4466('0x6'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x430756,_0x42de6d){return _0x430756[_0x4466('0x7')](_0x4466('0x8'),attributes,{'tableName':_0x4466('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index f3f2367..7574779 100644 --- a/server/api/chatWebsite/chatWebsite.rpc.js +++ b/server/api/chatWebsite/chatWebsite.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaee=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','then','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfaee,0x17e));var _0xefae=function(_0x88ffd4,_0x25f7e6){_0x88ffd4=_0x88ffd4-0x0;var _0x528f9c=_0xfaee[_0x88ffd4];return _0x528f9c;};'use strict';var _=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var moment=require(_0xefae('0x2'));var BPromise=require(_0xefae('0x3'));var rs=require(_0xefae('0x4'));var fs=require('fs');var Redis=require(_0xefae('0x5'));var db=require(_0xefae('0x6'))['db'];var utils=require(_0xefae('0x7'));var logger=require(_0xefae('0x8'))(_0xefae('0x9'));var config=require('../../config/environment');var jayson=require(_0xefae('0xa'));var client=jayson[_0xefae('0xb')][_0xefae('0xc')]({'port':0x232a});config['redis']=_[_0xefae('0xd')](config['redis'],{'host':_0xefae('0xe'),'port':0x18eb});var socket=require(_0xefae('0xf'))(new Redis(config[_0xefae('0x10')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x5f34bf,_0x1165c9,_0x27dd2b){return new BPromise(function(_0x32fb25,_0x21a718){return client['request'](_0x5f34bf,_0x27dd2b)[_0xefae('0x11')](function(_0x3ade28){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1165c9,_0xefae('0x12'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1165c9,_0xefae('0x12'),JSON[_0xefae('0x13')](_0x3ade28));if(_0x3ade28[_0xefae('0x14')]){if(_0x3ade28[_0xefae('0x14')][_0xefae('0x15')]===0x1f4){logger[_0xefae('0x14')](_0xefae('0x16'),_0x1165c9,_0x3ade28['error'][_0xefae('0x17')]);return _0x21a718(_0x3ade28[_0xefae('0x14')]['message']);}logger[_0xefae('0x14')](_0xefae('0x16'),_0x1165c9,_0x3ade28[_0xefae('0x14')][_0xefae('0x17')]);return _0x32fb25(_0x3ade28[_0xefae('0x14')][_0xefae('0x17')]);}else{logger[_0xefae('0x18')](_0xefae('0x16'),_0x1165c9,'request\x20sent');_0x32fb25(_0x3ade28[_0xefae('0x19')][_0xefae('0x17')]);}})[_0xefae('0x1a')](function(_0x5062de){logger['error'](_0xefae('0x16'),_0x1165c9,_0x5062de);_0x21a718(_0x5062de);});});} \ No newline at end of file +var _0xbd4c=['ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then'];(function(_0x1d5ce7,_0x213179){var _0x58141b=function(_0x297673){while(--_0x297673){_0x1d5ce7['push'](_0x1d5ce7['shift']());}};_0x58141b(++_0x213179);}(_0xbd4c,0x117));var _0xcbd4=function(_0x48ed22,_0x526605){_0x48ed22=_0x48ed22-0x0;var _0x1782d6=_0xbd4c[_0x48ed22];return _0x1782d6;};'use strict';var _=require('lodash');var util=require(_0xcbd4('0x0'));var moment=require(_0xcbd4('0x1'));var BPromise=require(_0xcbd4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbd4('0x3'));var db=require(_0xcbd4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbd4('0x5'));var config=require(_0xcbd4('0x6'));var jayson=require(_0xcbd4('0x7'));var client=jayson[_0xcbd4('0x8')][_0xcbd4('0x9')]({'port':0x232a});config['redis']=_[_0xcbd4('0xa')](config[_0xcbd4('0xb')],{'host':_0xcbd4('0xc'),'port':0x18eb});var socket=require(_0xcbd4('0xd'))(new Redis(config['redis']));require(_0xcbd4('0xe'))[_0xcbd4('0xf')](socket);function respondWithRpcPromise(_0x2f1eef,_0x15da71,_0x22e801){return new BPromise(function(_0x350ae5,_0x1299e8){return client[_0xcbd4('0x10')](_0x2f1eef,_0x22e801)[_0xcbd4('0x11')](function(_0x3a8f2d){logger['info'](_0xcbd4('0x12'),_0x15da71,'request\x20sent');logger[_0xcbd4('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x15da71,_0xcbd4('0x14'),JSON[_0xcbd4('0x15')](_0x3a8f2d));if(_0x3a8f2d[_0xcbd4('0x16')]){if(_0x3a8f2d[_0xcbd4('0x16')]['code']===0x1f4){logger[_0xcbd4('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x15da71,_0x3a8f2d[_0xcbd4('0x16')][_0xcbd4('0x17')]);return _0x1299e8(_0x3a8f2d[_0xcbd4('0x16')]['message']);}logger[_0xcbd4('0x16')](_0xcbd4('0x12'),_0x15da71,_0x3a8f2d[_0xcbd4('0x16')][_0xcbd4('0x17')]);return _0x350ae5(_0x3a8f2d[_0xcbd4('0x16')][_0xcbd4('0x17')]);}else{logger[_0xcbd4('0x18')](_0xcbd4('0x12'),_0x15da71,_0xcbd4('0x14'));_0x350ae5(_0x3a8f2d[_0xcbd4('0x19')][_0xcbd4('0x17')]);}})[_0xcbd4('0x1a')](function(_0x384e61){logger[_0xcbd4('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x15da71,_0x384e61);_0x1299e8(_0x384e61);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e4ee1f7..601d8c0 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x883c=['register','length','chatWebsite:','remove','update','removeListener'];(function(_0x257268,_0x1d0221){var _0x4812bf=function(_0x4d7ea6){while(--_0x4d7ea6){_0x257268['push'](_0x257268['shift']());}};_0x4812bf(++_0x1d0221);}(_0x883c,0xe7));var _0xc883=function(_0x48c784,_0x52b6fc){_0x48c784=_0x48c784-0x0;var _0x4634d9=_0x883c[_0x48c784];return _0x4634d9;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0xc883('0x0'),_0xc883('0x1')];function createListener(_0x263f2b,_0x5a072c){return function(_0x1c1a7f){_0x5a072c['emit'](_0x263f2b,_0x1c1a7f);};}function removeListener(_0x291457,_0x101a6f){return function(){ChatWebsiteEvents[_0xc883('0x2')](_0x291457,_0x101a6f);};}exports[_0xc883('0x3')]=function(_0x400300){for(var _0x57d3b3=0x0,_0x5778b4=events[_0xc883('0x4')];_0x57d3b3<_0x5778b4;_0x57d3b3++){var _0x2b2d4c=events[_0x57d3b3];var _0x232d78=createListener(_0xc883('0x5')+_0x2b2d4c,_0x400300);ChatWebsiteEvents['on'](_0x2b2d4c,_0x232d78);}}; \ No newline at end of file +var _0xc397=['save','remove','emit','register','./chatWebsite.events'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc397,0xe5));var _0x7c39=function(_0x1011a9,_0xb727d7){_0x1011a9=_0x1011a9-0x0;var _0x39fbf5=_0xc397[_0x1011a9];return _0x39fbf5;};'use strict';var ChatWebsiteEvents=require(_0x7c39('0x0'));var events=[_0x7c39('0x1'),_0x7c39('0x2'),'update'];function createListener(_0x3d8251,_0x2f0519){return function(_0x28b6d3){_0x2f0519[_0x7c39('0x3')](_0x3d8251,_0x28b6d3);};}function removeListener(_0x15735a,_0x59e47e){return function(){ChatWebsiteEvents['removeListener'](_0x15735a,_0x59e47e);};}exports[_0x7c39('0x4')]=function(_0x5b592d){for(var _0xa2105e=0x0,_0x6d1c2c=events['length'];_0xa2105e<_0x6d1c2c;_0xa2105e++){var _0x191fc8=events[_0xa2105e];var _0x2dc725=createListener('chatWebsite:'+_0x191fc8,_0x5b592d);ChatWebsiteEvents['on'](_0x191fc8,_0x2dc725);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 410d763..2a84428 100644 --- a/server/api/chatWebsite/index.js +++ b/server/api/chatWebsite/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f77=['getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','format','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x54fafa,_0x31c33f){var _0x24363f=function(_0x1c2204){while(--_0x1c2204){_0x54fafa['push'](_0x54fafa['shift']());}};_0x24363f(++_0x31c33f);}(_0x8f77,0xf1));var _0x78f7=function(_0xc9afae,_0x5303e4){_0xc9afae=_0xc9afae-0x0;var _0x14b3fb=_0x8f77[_0xc9afae];return _0x14b3fb;};'use strict';var multer=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var path=require(_0x78f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x78f7('0x3'));var router=express['Router']();var fs_extra=require(_0x78f7('0x4'));var auth=require(_0x78f7('0x5'));var interaction=require(_0x78f7('0x6'));var config=require('../../config/environment');var controller=require(_0x78f7('0x7'));router[_0x78f7('0x8')]('/',auth[_0x78f7('0x9')](),controller['index']);router[_0x78f7('0x8')]('/describe',auth[_0x78f7('0x9')](),controller[_0x78f7('0xa')]);router['get'](_0x78f7('0xb'),auth[_0x78f7('0x9')](),controller['show']);router[_0x78f7('0x8')](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller[_0x78f7('0xd')]);router[_0x78f7('0x8')](_0x78f7('0xe'),auth[_0x78f7('0x9')](),controller[_0x78f7('0xf')]);router[_0x78f7('0x8')](_0x78f7('0x10'),controller[_0x78f7('0x11')]);router[_0x78f7('0x8')](_0x78f7('0x12'),controller[_0x78f7('0x13')]);router[_0x78f7('0x8')](_0x78f7('0x14'),controller[_0x78f7('0x15')]);router[_0x78f7('0x8')](_0x78f7('0x16'),controller[_0x78f7('0x17')]);router[_0x78f7('0x8')](_0x78f7('0x18'),auth['isAuthenticated'](),controller[_0x78f7('0x19')]);router[_0x78f7('0x8')](_0x78f7('0x1a'),controller[_0x78f7('0x1b')]);router[_0x78f7('0x8')]('/:id/applications',auth[_0x78f7('0x9')](),controller[_0x78f7('0x1c')]);router[_0x78f7('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x78f7('0x1d')]);router[_0x78f7('0x8')](_0x78f7('0x1e'),controller[_0x78f7('0x1f')]);router[_0x78f7('0x8')](_0x78f7('0x20'),auth[_0x78f7('0x9')](),controller['getOfflineMessages']);router[_0x78f7('0x8')](_0x78f7('0x21'),auth['isAuthenticated'](),controller[_0x78f7('0x22')]);router[_0x78f7('0x23')]('/',auth[_0x78f7('0x9')](),controller[_0x78f7('0x24')]);router[_0x78f7('0x23')](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x25')]);router[_0x78f7('0x23')]('/:id/canned_answers',auth[_0x78f7('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x54f2c3,_0x582cf0,_0x2c941f){_0x2c941f(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],'server/files/images/logos/'));},'filename':function(_0x956b02,_0x38a4cb,_0xd79d07){_0xd79d07(null,util['format'](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x38a4cb[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x10'),upload[_0x78f7('0x2c')](_0x78f7('0x2d')),controller[_0x78f7('0x2e')]);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x414181,_0x47c3a7,_0x4d106){_0x4d106(null,path[_0x78f7('0x27')](config['root'],_0x78f7('0x2f')));},'filename':function(_0x44faff,_0x3dfc13,_0x46e9aa){_0x46e9aa(null,util['format'](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x3dfc13[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x12'),upload['single'](_0x78f7('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x4e9360,_0x96b77a,_0x1593bb){_0x1593bb(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],_0x78f7('0x2f')));},'filename':function(_0xd7663b,_0x2416c7,_0x878ef0){_0x878ef0(null,util[_0x78f7('0x30')](_0x78f7('0x29'),Date[_0x78f7('0x2a')](),_0x2416c7[_0x78f7('0x2b')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0x78f7('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0x47e0b1,_0x151eca,_0x4e08a7){_0x4e08a7(null,path[_0x78f7('0x27')](config[_0x78f7('0x28')],_0x78f7('0x2f')));},'filename':function(_0x151221,_0x113fc7,_0x2caa20){_0x2caa20(null,util[_0x78f7('0x30')]('%s-%s',Date[_0x78f7('0x2a')](),_0x113fc7[_0x78f7('0x2b')]));}})});router[_0x78f7('0x23')](_0x78f7('0x16'),upload['single'](_0x78f7('0x2d')),controller['addSystemAvatar']);router[_0x78f7('0x23')](_0x78f7('0x31'),controller[_0x78f7('0x32')]);const offlineUploadMulter=multer({'storage':multer[_0x78f7('0x26')]({'destination':function(_0xb4ace8,_0x4738b6,_0x342a2a){const _0x31e11b=path[_0x78f7('0x27')](config['root'],'server/files',_0x78f7('0x33'),_0x78f7('0x34'));fs_extra[_0x78f7('0x35')](_0x31e11b,function(){_0x342a2a(null,_0x31e11b);});},'filename':function(_0x51cdd8,_0x757ac7,_0x353a56){const _0x1f0c3b=_0x757ac7[_0x78f7('0x2b')][_0x78f7('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x533b2c=path[_0x78f7('0x37')](_0x1f0c3b);const _0x2dd0b4=Date[_0x78f7('0x2a')]()+'-'+_0x1f0c3b[_0x78f7('0x36')](_0x533b2c,'')+_0x533b2c;_0x353a56(null,_0x2dd0b4);}})});router['post'](_0x78f7('0x38'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0x78f7('0x18'),auth[_0x78f7('0x9')](),controller['addInteraction']);router['post'](_0x78f7('0x39'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3a')]);router[_0x78f7('0x23')](_0x78f7('0x3b'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3c')]);router['post'](_0x78f7('0x21'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x3d')]);router[_0x78f7('0x3e')]('/:id',auth[_0x78f7('0x9')](),controller[_0x78f7('0x3f')]);router[_0x78f7('0x40')]('/:id',auth[_0x78f7('0x9')](),controller[_0x78f7('0x41')]);router['delete'](_0x78f7('0xc'),auth[_0x78f7('0x9')](),controller['removeDispositions']);router[_0x78f7('0x40')](_0x78f7('0xe'),auth[_0x78f7('0x9')](),controller[_0x78f7('0x42')]);router['delete'](_0x78f7('0x21'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x0590=['addLogo','join','format','/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','offline','addInteraction','/:id/applications','put','update','destroy','delete','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','show','getDispositions','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','%s-%s','now','originalname','single','file'];(function(_0x316a88,_0x451333){var _0x2d35b1=function(_0x234608){while(--_0x234608){_0x316a88['push'](_0x316a88['shift']());}};_0x2d35b1(++_0x451333);}(_0x0590,0x191));var _0x0059=function(_0x4fba8c,_0x9816b7){_0x4fba8c=_0x4fba8c-0x0;var _0x17bd21=_0x0590[_0x4fba8c];return _0x17bd21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0059('0x0'));var timeout=require(_0x0059('0x1'));var express=require('express');var router=express[_0x0059('0x2')]();var fs_extra=require(_0x0059('0x3'));var auth=require(_0x0059('0x4'));var interaction=require(_0x0059('0x5'));var config=require(_0x0059('0x6'));var controller=require(_0x0059('0x7'));router['get']('/',auth[_0x0059('0x8')](),controller['index']);router[_0x0059('0x9')]('/describe',auth[_0x0059('0x8')](),controller[_0x0059('0xa')]);router[_0x0059('0x9')]('/:id',auth[_0x0059('0x8')](),controller[_0x0059('0xb')]);router[_0x0059('0x9')]('/:id/dispositions',auth[_0x0059('0x8')](),controller[_0x0059('0xc')]);router['get']('/:id/canned_answers',auth[_0x0059('0x8')](),controller['getAnswers']);router[_0x0059('0x9')](_0x0059('0xd'),controller['getLogo']);router[_0x0059('0x9')](_0x0059('0xe'),controller[_0x0059('0xf')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x0059('0x9')](_0x0059('0x10'),controller[_0x0059('0x11')]);router[_0x0059('0x9')](_0x0059('0x12'),auth[_0x0059('0x8')](),controller[_0x0059('0x13')]);router['get'](_0x0059('0x14'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x0059('0x8')](),controller[_0x0059('0x15')]);router[_0x0059('0x9')](_0x0059('0x16'),auth[_0x0059('0x8')](),controller['getProactiveActions']);router[_0x0059('0x9')](_0x0059('0x17'),controller[_0x0059('0x18')]);router[_0x0059('0x9')](_0x0059('0x19'),auth['isAuthenticated'](),controller[_0x0059('0x1a')]);router[_0x0059('0x9')](_0x0059('0x1b'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0059('0x1c')]('/',auth['isAuthenticated'](),controller[_0x0059('0x1d')]);router[_0x0059('0x1c')](_0x0059('0x1e'),auth[_0x0059('0x8')](),controller[_0x0059('0x1f')]);router[_0x0059('0x1c')]('/:id/canned_answers',auth[_0x0059('0x8')](),controller[_0x0059('0x20')]);var upload=multer({'storage':multer[_0x0059('0x21')]({'destination':function(_0x27cbd7,_0x5763f9,_0x15340f){_0x15340f(null,path['join'](config[_0x0059('0x22')],'server/files/images/logos/'));},'filename':function(_0x4e6d54,_0x35253c,_0x156daa){_0x156daa(null,util['format'](_0x0059('0x23'),Date[_0x0059('0x24')](),_0x35253c[_0x0059('0x25')]));}})});router[_0x0059('0x1c')]('/:id/logo',upload[_0x0059('0x26')](_0x0059('0x27')),controller[_0x0059('0x28')]);var upload=multer({'storage':multer[_0x0059('0x21')]({'destination':function(_0x281fd6,_0x19caef,_0x29aa8f){_0x29aa8f(null,path[_0x0059('0x29')](config[_0x0059('0x22')],'server/files/images/avatars/'));},'filename':function(_0x11d31a,_0x25fe3a,_0x3e4982){_0x3e4982(null,util[_0x0059('0x2a')](_0x0059('0x23'),Date[_0x0059('0x24')](),_0x25fe3a['originalname']));}})});router[_0x0059('0x1c')](_0x0059('0xe'),upload['single']('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0x0059('0x21')]({'destination':function(_0x466905,_0x3e3042,_0x3151f3){_0x3151f3(null,path[_0x0059('0x29')](config[_0x0059('0x22')],'server/files/images/avatars/'));},'filename':function(_0x2bdada,_0x986ed1,_0x21b5e2){_0x21b5e2(null,util[_0x0059('0x2a')](_0x0059('0x23'),Date[_0x0059('0x24')](),_0x986ed1[_0x0059('0x25')]));}})});router['post'](_0x0059('0x2b'),upload[_0x0059('0x26')](_0x0059('0x27')),controller[_0x0059('0x2c')]);var upload=multer({'storage':multer[_0x0059('0x21')]({'destination':function(_0xb7a17,_0x502049,_0xd1473d){_0xd1473d(null,path[_0x0059('0x29')](config[_0x0059('0x22')],_0x0059('0x2d')));},'filename':function(_0x22d0ca,_0xd32bca,_0x10151c){_0x10151c(null,util[_0x0059('0x2a')]('%s-%s',Date[_0x0059('0x24')](),_0xd32bca['originalname']));}})});router[_0x0059('0x1c')]('/:id/system_avatar',upload['single'](_0x0059('0x27')),controller['addSystemAvatar']);router[_0x0059('0x1c')](_0x0059('0x2e'),controller[_0x0059('0x2f')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3514d9,_0x422036,_0xc85c3c){const _0xba0d30=path[_0x0059('0x29')](config['root'],_0x0059('0x30'),_0x0059('0x31'),_0x0059('0x32'));fs_extra[_0x0059('0x33')](_0xba0d30,function(){_0xc85c3c(null,_0xba0d30);});},'filename':function(_0x3c73bb,_0x232e5e,_0x539206){const _0x5416e9=_0x232e5e[_0x0059('0x25')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1936f1=path[_0x0059('0x34')](_0x5416e9);const _0x1ba4c1=Date[_0x0059('0x24')]()+'-'+_0x5416e9['replace'](_0x1936f1,'')+_0x1936f1;_0x539206(null,_0x1ba4c1);}})});router['post'](_0x0059('0x35'),offlineUploadMulter['any'](),controller[_0x0059('0x36')]);router['post'](_0x0059('0x12'),auth[_0x0059('0x8')](),controller[_0x0059('0x37')]);router[_0x0059('0x1c')](_0x0059('0x38'),auth[_0x0059('0x8')](),controller['addApplications']);router[_0x0059('0x1c')]('/:id/proactive_actions',auth[_0x0059('0x8')](),controller['addProactiveActions']);router[_0x0059('0x1c')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x0059('0x39')]('/:id',auth[_0x0059('0x8')](),controller[_0x0059('0x3a')]);router['delete']('/:id',auth[_0x0059('0x8')](),controller[_0x0059('0x3b')]);router['delete'](_0x0059('0x1e'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x0059('0x8')](),controller['removeAnswers']);router[_0x0059('0x3c')](_0x0059('0x1b'),auth[_0x0059('0x8')](),controller[_0x0059('0x3d')]);module[_0x0059('0x3e')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 31b9be3..f98adc7 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8a2=['../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','exports','beaver-logger/server','express'];(function(_0x10e504,_0x42e73e){var _0x5c7678=function(_0x32efb9){while(--_0x32efb9){_0x10e504['push'](_0x10e504['shift']());}};_0x5c7678(++_0x42e73e);}(_0xf8a2,0xe8));var _0x2f8a=function(_0x575a38,_0x2e83d7){_0x575a38=_0x575a38-0x0;var _0x5a7bdd=_0xf8a2[_0x575a38];return _0x5a7bdd;};var beaverLogger=require(_0x2f8a('0x0'));var express=require(_0x2f8a('0x1'));var auth=require('../components/auth/service');var config=require(_0x2f8a('0x2'));var router=express[_0x2f8a('0x3')]();var isProduction=config[_0x2f8a('0x4')]===_0x2f8a('0x5')||![];function clientSideLogs(_0x42c2fa,_0x1567ac,_0x7366ff){var _0x320235=_0x42c2fa[_0x2f8a('0x6')][_0x2f8a('0x7')](_0x2f8a('0x8'));if(!_0x320235){throw new Error(_0x2f8a('0x9'));}return beaverLogger['expressEndpoint']({'uri':_0x2f8a('0xa'),'logger':_0x320235,'enableCors':!isProduction})(_0x42c2fa,_0x1567ac,_0x7366ff);}router[_0x2f8a('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x2f8a('0xc')]=router; \ No newline at end of file +var _0x6368=['Router','env','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x6368,0x15a));var _0x8636=function(_0x5a9194,_0x27cc10){_0x5a9194=_0x5a9194-0x0;var _0x253eb6=_0x6368[_0x5a9194];return _0x253eb6;};var beaverLogger=require(_0x8636('0x0'));var express=require(_0x8636('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x8636('0x2')]();var isProduction=config[_0x8636('0x3')]==='production'||![];function clientSideLogs(_0xbec1b1,_0x6974ce,_0x37375){var _0x48aba6=_0xbec1b1['app'][_0x8636('0x4')](_0x8636('0x5'));if(!_0x48aba6){throw new Error(_0x8636('0x6'));}return beaverLogger[_0x8636('0x7')]({'uri':_0x8636('0x8'),'logger':_0x48aba6,'enableCors':!isProduction})(_0xbec1b1,_0x6974ce,_0x37375);}router[_0x8636('0x9')](auth[_0x8636('0xa')](),clientSideLogs);module[_0x8636('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a46c5d7..d4d69cd 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c2e=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant'];(function(_0x17a647,_0x2bbe12){var _0x219a38=function(_0x131c5d){while(--_0x131c5d){_0x17a647['push'](_0x17a647['shift']());}};_0x219a38(++_0x2bbe12);}(_0x6c2e,0x67));var _0xe6c2=function(_0x17fadf,_0x394d52){_0x17fadf=_0x17fadf-0x0;var _0x19dba6=_0x6c2e[_0x17fadf];return _0x19dba6;};'use strict';var Sequelize=require('sequelize');module[_0xe6c2('0x0')]={'name':{'type':Sequelize[_0xe6c2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe6c2('0x2')](_0xe6c2('0x3'),_0xe6c2('0x4'),_0xe6c2('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe6c2('0x2')](_0xe6c2('0x6'),_0xe6c2('0x7'))},'data1':{'type':Sequelize[_0xe6c2('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0x8')},'data3':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0x9')},'data4':{'type':Sequelize[_0xe6c2('0x1')],'comment':_0xe6c2('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xe6c2('0xb')},'data6':{'type':Sequelize[_0xe6c2('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize['TEXT'],'comment':_0xe6c2('0xd')}}; \ No newline at end of file +var _0x1099=['ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING'];(function(_0x28b4aa,_0x4a7223){var _0x4e8e3a=function(_0x41d892){while(--_0x41d892){_0x28b4aa['push'](_0x28b4aa['shift']());}};_0x4e8e3a(++_0x4a7223);}(_0x1099,0x8d));var _0x9109=function(_0x1ce157,_0x3f7b85){_0x1ce157=_0x1ce157-0x0;var _0xfbce14=_0x1099[_0x1ce157];return _0xfbce14;};'use strict';var Sequelize=require(_0x9109('0x0'));module['exports']={'name':{'type':Sequelize[_0x9109('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9109('0x2')](_0x9109('0x3'),_0x9109('0x4'),_0x9109('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9109('0x2')]('Outlook365',_0x9109('0x6'))},'data1':{'type':Sequelize[_0x9109('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x9109('0x1')],'comment':_0x9109('0x7')},'data3':{'type':Sequelize[_0x9109('0x1')],'comment':_0x9109('0x8')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x9109('0x9')],'comment':_0x9109('0xa')},'data6':{'type':Sequelize[_0x9109('0x9')],'comment':_0x9109('0xb')},'data7':{'type':Sequelize[_0x9109('0x9')],'comment':_0x9109('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 7bdf4dc..5bad450 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x92e6=['oauth2MicrosoftCallback','parse','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','../../components/parsers/qs','../../components/encryptor','../../config/logger','api','redis','socket.io-emitter','sendStatus','status','end','json','offset','count','limit','set','Content-Range','then','destroy','error','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','include','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','update','encryptString','oauth2MicrosoftAuthorize','user'];(function(_0x209d2a,_0x59a302){var _0x2d2a4a=function(_0x4d5084){while(--_0x4d5084){_0x209d2a['push'](_0x209d2a['shift']());}};_0x2d2a4a(++_0x59a302);}(_0x92e6,0x16b));var _0x692e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x92e6[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x692e('0x0'));var encryptor=require(_0x692e('0x1'));var config=require('../../config/environment');var logger=require(_0x692e('0x2'))(_0x692e('0x3'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x692e('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x692e('0x5'))(new Redis(config['redis']));var redis=new Redis(config[_0x692e('0x4')]);function respondWithStatusCode(_0x5099eb,_0x515ed7){_0x515ed7=_0x515ed7||0xcc;return function(_0x4d4145){if(_0x4d4145){return _0x5099eb[_0x692e('0x6')](_0x515ed7);}return _0x5099eb[_0x692e('0x7')](_0x515ed7)[_0x692e('0x8')]();};}function respondWithResult(_0x34b385,_0x4e2ca2){_0x4e2ca2=_0x4e2ca2||0xc8;return function(_0x5e2c92){if(_0x5e2c92){return _0x34b385['status'](_0x4e2ca2)[_0x692e('0x9')](_0x5e2c92);}};}function respondWithFilteredResult(_0x397c97,_0x4679d3){return function(_0x3dc6b1){if(_0x3dc6b1){var _0x396c62=typeof _0x4679d3[_0x692e('0xa')]==='undefined'&&typeof _0x4679d3['limit']==='undefined';var _0x129613=_0x3dc6b1[_0x692e('0xb')];var _0x50b4c0=_0x396c62?0x0:_0x4679d3['offset'];var _0x11ee32=_0x396c62?_0x3dc6b1['count']:_0x4679d3[_0x692e('0xa')]+_0x4679d3[_0x692e('0xc')];var _0x17398c;if(_0x11ee32>=_0x129613){_0x11ee32=_0x129613;_0x17398c=0xc8;}else{_0x17398c=0xce;}_0x397c97[_0x692e('0x7')](_0x17398c);return _0x397c97[_0x692e('0xd')](_0x692e('0xe'),_0x50b4c0+'-'+_0x11ee32+'/'+_0x129613)[_0x692e('0x9')](_0x3dc6b1);}return null;};}function saveUpdates(_0x3be789){return function(_0x1cc7f6){if(_0x1cc7f6){return _0x1cc7f6['update'](_0x3be789)[_0x692e('0xf')](function(_0x32f19a){return _0x32f19a;});}return null;};}function removeEntity(_0x5e2d26){return function(_0x219dda){if(_0x219dda){return _0x219dda[_0x692e('0x10')]()[_0x692e('0xf')](function(){_0x5e2d26['status'](0xcc)[_0x692e('0x8')]();});}};}function handleEntityNotFound(_0x149d53){return function(_0x103e9f){if(!_0x103e9f){_0x149d53[_0x692e('0x6')](0x194);}return _0x103e9f;};}function handleError(_0x41bead,_0x2ec76a){_0x2ec76a=_0x2ec76a||0x1f4;return function(_0x496265){logger[_0x692e('0x11')](_0x496265['stack']);if(_0x496265[_0x692e('0x12')]){delete _0x496265[_0x692e('0x12')];}_0x41bead[_0x692e('0x7')](_0x2ec76a)[_0x692e('0x13')](_0x496265);};}function maskClientSecret(_0x4bdb74){return _[_0x692e('0x14')](_0x4bdb74[_0x692e('0x15')](0x0,0x3),0x14,'*');}exports[_0x692e('0x16')]=function(_0x34d641,_0x4cc31b){var _0x228519={},_0x1c503d={},_0x30d72a={'count':0x0,'rows':[]};var _0x19f5fe=_[_0x692e('0x17')](db[_0x692e('0x18')][_0x692e('0x19')],function(_0x4d91d9){return{'name':_0x4d91d9['fieldName'],'type':_0x4d91d9['type'][_0x692e('0x1a')]};});_0x1c503d[_0x692e('0x1b')]=_[_0x692e('0x17')](_0x19f5fe,'name');_0x1c503d[_0x692e('0x1c')]=_['keys'](_0x34d641[_0x692e('0x1c')]);_0x1c503d[_0x692e('0x1d')]=_['intersection'](_0x1c503d[_0x692e('0x1b')],_0x1c503d[_0x692e('0x1c')]);_0x228519['attributes']=_[_0x692e('0x1e')](_0x1c503d[_0x692e('0x1b')],qs[_0x692e('0x1f')](_0x34d641[_0x692e('0x1c')][_0x692e('0x1f')]));_0x228519[_0x692e('0x20')]=_0x228519['attributes'][_0x692e('0x21')]?_0x228519[_0x692e('0x20')]:_0x1c503d[_0x692e('0x1b')];if(!_0x34d641[_0x692e('0x1c')][_0x692e('0x22')](_0x692e('0x23'))){_0x228519['limit']=qs[_0x692e('0xc')](_0x34d641['query'][_0x692e('0xc')]);_0x228519[_0x692e('0xa')]=qs[_0x692e('0xa')](_0x34d641[_0x692e('0x1c')][_0x692e('0xa')]);}_0x228519[_0x692e('0x24')]=qs[_0x692e('0x25')](_0x34d641[_0x692e('0x1c')]['sort']);_0x228519[_0x692e('0x26')]=qs[_0x692e('0x1d')](_[_0x692e('0x27')](_0x34d641[_0x692e('0x1c')],_0x1c503d[_0x692e('0x1d')]),_0x19f5fe);if(_0x34d641['query'][_0x692e('0x28')]){_0x228519[_0x692e('0x26')]=_[_0x692e('0x29')](_0x228519[_0x692e('0x26')],{'$or':_[_0x692e('0x17')](_0x19f5fe,function(_0x1a5520){if(_0x1a5520['type']!==_0x692e('0x2a')){var _0x2fe4c3={};_0x2fe4c3[_0x1a5520[_0x692e('0x12')]]={'$like':'%'+_0x34d641[_0x692e('0x1c')][_0x692e('0x28')]+'%'};return _0x2fe4c3;}})});}_0x228519=_['merge']({},_0x228519,_0x34d641[_0x692e('0x2b')]);var _0x42179a={'where':_0x228519[_0x692e('0x26')]};return db[_0x692e('0x18')][_0x692e('0xb')](_0x42179a)[_0x692e('0xf')](function(_0x55c532){_0x30d72a[_0x692e('0xb')]=_0x55c532;if(_0x34d641['query'][_0x692e('0x2c')]){_0x228519['include']=[{'all':!![]}];}return db[_0x692e('0x18')][_0x692e('0x2d')](_0x228519);})[_0x692e('0xf')](function(_0x5991c3){_0x30d72a['rows']=_[_0x692e('0x17')](_0x5991c3,function(_0x31d4e9){if(_0x31d4e9[_0x692e('0x2e')]===_0x692e('0x2f')){var _0x141837=encryptor[_0x692e('0x30')](_0x31d4e9[_0x692e('0x31')]);_0x31d4e9[_0x692e('0x31')]=maskClientSecret(_0x141837);}return _0x31d4e9;});return _0x30d72a;})[_0x692e('0xf')](respondWithFilteredResult(_0x4cc31b,_0x228519))[_0x692e('0x32')](handleError(_0x4cc31b,null));};exports[_0x692e('0x33')]=function(_0x2d210a,_0xaf23ad){var _0x7b06ef={'raw':!![],'where':{'id':_0x2d210a[_0x692e('0x34')]['id']}},_0x122310={};_0x122310[_0x692e('0x1b')]=_[_0x692e('0x35')](db[_0x692e('0x18')]['rawAttributes']);_0x122310[_0x692e('0x1c')]=_[_0x692e('0x35')](_0x2d210a[_0x692e('0x1c')]);_0x122310[_0x692e('0x1d')]=_[_0x692e('0x1e')](_0x122310[_0x692e('0x1b')],_0x122310[_0x692e('0x1c')]);_0x7b06ef[_0x692e('0x20')]=_[_0x692e('0x1e')](_0x122310[_0x692e('0x1b')],qs[_0x692e('0x1f')](_0x2d210a[_0x692e('0x1c')][_0x692e('0x1f')]));_0x7b06ef[_0x692e('0x20')]=_0x7b06ef[_0x692e('0x20')][_0x692e('0x21')]?_0x7b06ef[_0x692e('0x20')]:_0x122310[_0x692e('0x1b')];if(_0x2d210a[_0x692e('0x1c')]['includeAll']){_0x7b06ef[_0x692e('0x36')]=[{'all':!![]}];}_0x7b06ef=_[_0x692e('0x29')]({},_0x7b06ef,_0x2d210a[_0x692e('0x2b')]);return db[_0x692e('0x18')][_0x692e('0x37')](_0x7b06ef)[_0x692e('0xf')](handleEntityNotFound(_0xaf23ad,null))[_0x692e('0xf')](function(_0x534464){if(_0x534464[_0x692e('0x2e')]===_0x692e('0x2f')){var _0xf6f6bd=encryptor[_0x692e('0x30')](_0x534464[_0x692e('0x31')]);_0x534464[_0x692e('0x31')]=maskClientSecret(_0xf6f6bd);}return _0x534464;})['then'](respondWithResult(_0xaf23ad,null))['catch'](handleError(_0xaf23ad,null));};exports[_0x692e('0x38')]=function(_0x31d823,_0x467b35){if(!_0x31d823[_0x692e('0x39')][_0x692e('0x12')])throw new Error(_0x692e('0x3a'));if(!_0x31d823['body'][_0x692e('0x2e')])throw new Error(_0x692e('0x3b'));var _0xb6b009=db[_0x692e('0x18')][_0x692e('0x19')][_0x692e('0x2e')][_0x692e('0x3c')];if(!_0xb6b009[_0x692e('0x3d')](_0x31d823[_0x692e('0x39')][_0x692e('0x2e')]))throw new Error(_0x692e('0x3e')+_0xb6b009['join'](',\x20'));if(_0x31d823['body']['service']===_0x692e('0x2f')&&_0x31d823[_0x692e('0x39')][_0x692e('0x31')]){_0x31d823[_0x692e('0x39')][_0x692e('0x31')]=encryptor['encryptString'](_0x31d823['body'][_0x692e('0x31')]);}return db[_0x692e('0x18')][_0x692e('0x38')](_0x31d823[_0x692e('0x39')],{})[_0x692e('0xf')](respondWithResult(_0x467b35,0xc9))['catch'](handleError(_0x467b35,null));};exports[_0x692e('0x3f')]=function(_0x169717,_0x49ec2e){if(_0x169717['body']['id']){delete _0x169717[_0x692e('0x39')]['id'];}return db[_0x692e('0x18')][_0x692e('0x37')]({'where':{'id':_0x169717[_0x692e('0x34')]['id']}})[_0x692e('0xf')](handleEntityNotFound(_0x49ec2e,null))['then'](function(_0x214390){if(_0x214390[_0x692e('0x2e')]==='MicrosoftAzure'&&_0x169717[_0x692e('0x39')][_0x692e('0x31')]){_0x169717[_0x692e('0x39')]['data3']=encryptor[_0x692e('0x40')](_0x169717[_0x692e('0x39')]['data3']);}return _0x214390;})[_0x692e('0xf')](saveUpdates(_0x169717[_0x692e('0x39')],null))['then'](respondWithResult(_0x49ec2e,null))['catch'](handleError(_0x49ec2e,null));};exports[_0x692e('0x10')]=function(_0x12f19e,_0x17df67){return db[_0x692e('0x18')][_0x692e('0x37')]({'where':{'id':_0x12f19e[_0x692e('0x34')]['id']}})[_0x692e('0xf')](handleEntityNotFound(_0x17df67,null))['then'](removeEntity(_0x17df67,null))['catch'](handleError(_0x17df67,null));};exports[_0x692e('0x41')]=function(_0x103e92,_0x340b41){return db[_0x692e('0x18')]['findOne']({'where':{'id':_0x103e92[_0x692e('0x34')]['id']},'raw':!![]})[_0x692e('0xf')](function(_0x5408e8){if(!_0x5408e8)return _0x340b41['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x5408e8,_0x103e92[_0x692e('0x42')]['id'])};})['then'](respondWithResult(_0x340b41,null))[_0x692e('0x32')](handleError(_0x340b41,null));};exports[_0x692e('0x43')]=function(_0x309f78,_0x5cd72b){var _0xb5f283=_0x309f78[_0x692e('0x39')];var _0x45ee5a;var _0x42199f;if(_0xb5f283[_0x692e('0x11')])throw _0xb5f283;redis['get'](_0xb5f283['state'])[_0x692e('0xf')](function(_0x302f1d){if(!_0x302f1d)throw new Error('Invalid\x20state\x20parameter');_0x45ee5a=JSON[_0x692e('0x44')](_0x302f1d);var _0x64b6f9=Buffer['from'](_0xb5f283[_0x692e('0x45')],_0x692e('0x46'))[_0x692e('0x47')](_0x692e('0x48'));_0x42199f=JSON[_0x692e('0x44')](_0x64b6f9);if(!oauth[_0x692e('0x49')](_0xb5f283[_0x692e('0x4a')],_0x45ee5a[_0x692e('0x4b')]))throw new Error(_0x692e('0x4c'));redis['del'](_0xb5f283[_0x692e('0x45')]);return oauth[_0x692e('0x4d')](_0xb5f283['code'],_0x45ee5a);})['then'](function(_0x1420ea){_0x45ee5a['data5']=_0x1420ea[_0x692e('0x4e')];_0x45ee5a[_0x692e('0x4f')]=_0x1420ea['refresh_token'];return db['CloudProvider']['update']({'data5':_0x45ee5a[_0x692e('0x50')],'data6':_0x45ee5a[_0x692e('0x4f')]},{'where':{'id':_0x45ee5a['id']}});})['then'](function(){oauth[_0x692e('0x51')](_0x45ee5a);socket[_0x692e('0x52')](_0x692e('0x53'),{'id':_0x42199f['id']});return;})['then'](respondWithStatusCode(_0x5cd72b,null))[_0x692e('0x32')](function(_0x1cf7a4){if(_0x42199f){socket[_0x692e('0x52')](_0x692e('0x54'),{'id':_0x42199f['id']});}if(!_0x45ee5a){logger['error'](_0x692e('0x55'),_0x1cf7a4);return _0x5cd72b[_0x692e('0x7')](0x1f4)[_0x692e('0x13')](_0x1cf7a4['message']);}logger[_0x692e('0x11')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x45ee5a['id'],JSON['stringify'](_0x1cf7a4));});}; \ No newline at end of file +var _0x853a=['data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','stringify','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','redis','defaults','socket.io-emitter','status','end','undefined','offset','count','limit','set','json','update','then','destroy','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','service','decryptString','data3','show','params','find','catch','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','MicrosoftAzure','findOne','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','code'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x853a,0x16d));var _0xa853=function(_0x2b1762,_0x14b5ea){_0x2b1762=_0x2b1762-0x0;var _0x11863e=_0x853a[_0x2b1762];return _0x11863e;};'use strict';var _=require(_0xa853('0x0'));var Redis=require(_0xa853('0x1'));var qs=require(_0xa853('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0xa853('0x3'));var logger=require(_0xa853('0x4'))('api');var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xa853('0x5')]=_[_0xa853('0x6')](config[_0xa853('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xa853('0x7'))(new Redis(config[_0xa853('0x5')]));var redis=new Redis(config[_0xa853('0x5')]);function respondWithStatusCode(_0xad6941,_0x6dd401){_0x6dd401=_0x6dd401||0xcc;return function(_0x5a92e9){if(_0x5a92e9){return _0xad6941['sendStatus'](_0x6dd401);}return _0xad6941[_0xa853('0x8')](_0x6dd401)[_0xa853('0x9')]();};}function respondWithResult(_0x1ec591,_0x367a18){_0x367a18=_0x367a18||0xc8;return function(_0x1c2b04){if(_0x1c2b04){return _0x1ec591['status'](_0x367a18)['json'](_0x1c2b04);}};}function respondWithFilteredResult(_0x3807fd,_0x26c13a){return function(_0x21490b){if(_0x21490b){var _0x498643=typeof _0x26c13a['offset']===_0xa853('0xa')&&typeof _0x26c13a['limit']==='undefined';var _0x12d8ac=_0x21490b['count'];var _0x12957d=_0x498643?0x0:_0x26c13a[_0xa853('0xb')];var _0x11ff67=_0x498643?_0x21490b[_0xa853('0xc')]:_0x26c13a[_0xa853('0xb')]+_0x26c13a[_0xa853('0xd')];var _0x2a4848;if(_0x11ff67>=_0x12d8ac){_0x11ff67=_0x12d8ac;_0x2a4848=0xc8;}else{_0x2a4848=0xce;}_0x3807fd['status'](_0x2a4848);return _0x3807fd[_0xa853('0xe')]('Content-Range',_0x12957d+'-'+_0x11ff67+'/'+_0x12d8ac)[_0xa853('0xf')](_0x21490b);}return null;};}function saveUpdates(_0x4af5f9){return function(_0x41db5e){if(_0x41db5e){return _0x41db5e[_0xa853('0x10')](_0x4af5f9)[_0xa853('0x11')](function(_0x4369df){return _0x4369df;});}return null;};}function removeEntity(_0x3bbe75){return function(_0x389237){if(_0x389237){return _0x389237[_0xa853('0x12')]()[_0xa853('0x11')](function(){_0x3bbe75['status'](0xcc)[_0xa853('0x9')]();});}};}function handleEntityNotFound(_0x10be82){return function(_0x5b6aa5){if(!_0x5b6aa5){_0x10be82['sendStatus'](0x194);}return _0x5b6aa5;};}function handleError(_0x553656,_0x20b374){_0x20b374=_0x20b374||0x1f4;return function(_0x530ac8){logger[_0xa853('0x13')](_0x530ac8[_0xa853('0x14')]);if(_0x530ac8[_0xa853('0x15')]){delete _0x530ac8['name'];}_0x553656[_0xa853('0x8')](_0x20b374)[_0xa853('0x16')](_0x530ac8);};}function maskClientSecret(_0x2cce98){return _['padEnd'](_0x2cce98[_0xa853('0x17')](0x0,0x3),0x14,'*');}exports[_0xa853('0x18')]=function(_0x4d2f5e,_0x3ce93a){var _0x3d9441={},_0x2cf9e7={},_0x539ef2={'count':0x0,'rows':[]};var _0x5abee7=_[_0xa853('0x19')](db[_0xa853('0x1a')][_0xa853('0x1b')],function(_0x30b5a4){return{'name':_0x30b5a4['fieldName'],'type':_0x30b5a4[_0xa853('0x1c')]['key']};});_0x2cf9e7['model']=_['map'](_0x5abee7,'name');_0x2cf9e7[_0xa853('0x1d')]=_[_0xa853('0x1e')](_0x4d2f5e['query']);_0x2cf9e7[_0xa853('0x1f')]=_[_0xa853('0x20')](_0x2cf9e7[_0xa853('0x21')],_0x2cf9e7[_0xa853('0x1d')]);_0x3d9441[_0xa853('0x22')]=_[_0xa853('0x20')](_0x2cf9e7[_0xa853('0x21')],qs[_0xa853('0x23')](_0x4d2f5e[_0xa853('0x1d')][_0xa853('0x23')]));_0x3d9441['attributes']=_0x3d9441[_0xa853('0x22')][_0xa853('0x24')]?_0x3d9441['attributes']:_0x2cf9e7[_0xa853('0x21')];if(!_0x4d2f5e[_0xa853('0x1d')][_0xa853('0x25')](_0xa853('0x26'))){_0x3d9441['limit']=qs['limit'](_0x4d2f5e[_0xa853('0x1d')][_0xa853('0xd')]);_0x3d9441[_0xa853('0xb')]=qs[_0xa853('0xb')](_0x4d2f5e[_0xa853('0x1d')][_0xa853('0xb')]);}_0x3d9441[_0xa853('0x27')]=qs[_0xa853('0x28')](_0x4d2f5e['query'][_0xa853('0x28')]);_0x3d9441[_0xa853('0x29')]=qs[_0xa853('0x1f')](_['pick'](_0x4d2f5e['query'],_0x2cf9e7[_0xa853('0x1f')]),_0x5abee7);if(_0x4d2f5e['query'][_0xa853('0x2a')]){_0x3d9441[_0xa853('0x29')]=_[_0xa853('0x2b')](_0x3d9441[_0xa853('0x29')],{'$or':_[_0xa853('0x19')](_0x5abee7,function(_0x7d3b82){if(_0x7d3b82[_0xa853('0x1c')]!==_0xa853('0x2c')){var _0x4b05c3={};_0x4b05c3[_0x7d3b82['name']]={'$like':'%'+_0x4d2f5e['query'][_0xa853('0x2a')]+'%'};return _0x4b05c3;}})});}_0x3d9441=_['merge']({},_0x3d9441,_0x4d2f5e[_0xa853('0x2d')]);var _0x5b1657={'where':_0x3d9441['where']};return db[_0xa853('0x1a')][_0xa853('0xc')](_0x5b1657)[_0xa853('0x11')](function(_0x486aa5){_0x539ef2[_0xa853('0xc')]=_0x486aa5;if(_0x4d2f5e['query'][_0xa853('0x2e')]){_0x3d9441[_0xa853('0x2f')]=[{'all':!![]}];}return db[_0xa853('0x1a')][_0xa853('0x30')](_0x3d9441);})['then'](function(_0x122054){_0x539ef2['rows']=_[_0xa853('0x19')](_0x122054,function(_0x2f2bed){if(_0x2f2bed[_0xa853('0x31')]==='MicrosoftAzure'){var _0x2a30e7=encryptor[_0xa853('0x32')](_0x2f2bed['data3']);_0x2f2bed[_0xa853('0x33')]=maskClientSecret(_0x2a30e7);}return _0x2f2bed;});return _0x539ef2;})[_0xa853('0x11')](respondWithFilteredResult(_0x3ce93a,_0x3d9441))['catch'](handleError(_0x3ce93a,null));};exports[_0xa853('0x34')]=function(_0x3de72f,_0x1ab7c6){var _0x5e1024={'raw':!![],'where':{'id':_0x3de72f[_0xa853('0x35')]['id']}},_0x536fe2={};_0x536fe2[_0xa853('0x21')]=_[_0xa853('0x1e')](db[_0xa853('0x1a')][_0xa853('0x1b')]);_0x536fe2[_0xa853('0x1d')]=_[_0xa853('0x1e')](_0x3de72f[_0xa853('0x1d')]);_0x536fe2[_0xa853('0x1f')]=_[_0xa853('0x20')](_0x536fe2[_0xa853('0x21')],_0x536fe2[_0xa853('0x1d')]);_0x5e1024['attributes']=_[_0xa853('0x20')](_0x536fe2[_0xa853('0x21')],qs[_0xa853('0x23')](_0x3de72f['query'][_0xa853('0x23')]));_0x5e1024[_0xa853('0x22')]=_0x5e1024[_0xa853('0x22')]['length']?_0x5e1024[_0xa853('0x22')]:_0x536fe2[_0xa853('0x21')];if(_0x3de72f[_0xa853('0x1d')][_0xa853('0x2e')]){_0x5e1024[_0xa853('0x2f')]=[{'all':!![]}];}_0x5e1024=_[_0xa853('0x2b')]({},_0x5e1024,_0x3de72f[_0xa853('0x2d')]);return db['CloudProvider'][_0xa853('0x36')](_0x5e1024)['then'](handleEntityNotFound(_0x1ab7c6,null))[_0xa853('0x11')](function(_0x23d6f0){if(_0x23d6f0['service']==='MicrosoftAzure'){var _0x4b8578=encryptor[_0xa853('0x32')](_0x23d6f0[_0xa853('0x33')]);_0x23d6f0[_0xa853('0x33')]=maskClientSecret(_0x4b8578);}return _0x23d6f0;})[_0xa853('0x11')](respondWithResult(_0x1ab7c6,null))[_0xa853('0x37')](handleError(_0x1ab7c6,null));};exports[_0xa853('0x38')]=function(_0x1ed300,_0x29529c){if(!_0x1ed300['body'][_0xa853('0x15')])throw new Error(_0xa853('0x39'));if(!_0x1ed300[_0xa853('0x3a')][_0xa853('0x31')])throw new Error(_0xa853('0x3b'));var _0x21eaca=db[_0xa853('0x1a')]['rawAttributes'][_0xa853('0x31')]['values'];if(!_0x21eaca[_0xa853('0x3c')](_0x1ed300[_0xa853('0x3a')][_0xa853('0x31')]))throw new Error(_0xa853('0x3d')+_0x21eaca['join'](',\x20'));if(_0x1ed300[_0xa853('0x3a')]['service']==='MicrosoftAzure'&&_0x1ed300[_0xa853('0x3a')]['data3']){_0x1ed300['body'][_0xa853('0x33')]=encryptor[_0xa853('0x3e')](_0x1ed300[_0xa853('0x3a')][_0xa853('0x33')]);}return db[_0xa853('0x1a')][_0xa853('0x38')](_0x1ed300[_0xa853('0x3a')],{})[_0xa853('0x11')](respondWithResult(_0x29529c,0xc9))[_0xa853('0x37')](handleError(_0x29529c,null));};exports[_0xa853('0x10')]=function(_0x1ee14e,_0x24d97b){if(_0x1ee14e[_0xa853('0x3a')]['id']){delete _0x1ee14e[_0xa853('0x3a')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x1ee14e[_0xa853('0x35')]['id']}})[_0xa853('0x11')](handleEntityNotFound(_0x24d97b,null))[_0xa853('0x11')](function(_0x35855b){if(_0x35855b['service']===_0xa853('0x3f')&&_0x1ee14e[_0xa853('0x3a')][_0xa853('0x33')]){_0x1ee14e[_0xa853('0x3a')][_0xa853('0x33')]=encryptor[_0xa853('0x3e')](_0x1ee14e['body'][_0xa853('0x33')]);}return _0x35855b;})['then'](saveUpdates(_0x1ee14e['body'],null))[_0xa853('0x11')](respondWithResult(_0x24d97b,null))[_0xa853('0x37')](handleError(_0x24d97b,null));};exports['destroy']=function(_0x15dfe8,_0x3f3f9b){return db['CloudProvider'][_0xa853('0x36')]({'where':{'id':_0x15dfe8['params']['id']}})['then'](handleEntityNotFound(_0x3f3f9b,null))[_0xa853('0x11')](removeEntity(_0x3f3f9b,null))[_0xa853('0x37')](handleError(_0x3f3f9b,null));};exports['oauth2MicrosoftAuthorize']=function(_0x444bec,_0x3b614e){return db[_0xa853('0x1a')][_0xa853('0x40')]({'where':{'id':_0x444bec['params']['id']},'raw':!![]})[_0xa853('0x11')](function(_0x540522){if(!_0x540522)return _0x3b614e[_0xa853('0x41')](0x194);return{'url':oauth[_0xa853('0x42')](_0x540522,_0x444bec[_0xa853('0x43')]['id'])};})['then'](respondWithResult(_0x3b614e,null))[_0xa853('0x37')](handleError(_0x3b614e,null));};exports[_0xa853('0x44')]=function(_0x2e75ad,_0xe1dbbe){var _0x300979=_0x2e75ad['body'];var _0x148f9a;var _0x59fd0b;if(_0x300979[_0xa853('0x13')])throw _0x300979;redis[_0xa853('0x45')](_0x300979[_0xa853('0x46')])['then'](function(_0x440739){if(!_0x440739)throw new Error(_0xa853('0x47'));_0x148f9a=JSON[_0xa853('0x48')](_0x440739);var _0x270494=Buffer['from'](_0x300979[_0xa853('0x46')],'base64')[_0xa853('0x49')](_0xa853('0x4a'));_0x59fd0b=JSON[_0xa853('0x48')](_0x270494);if(!oauth[_0xa853('0x4b')](_0x300979[_0xa853('0x4c')],_0x148f9a[_0xa853('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xa853('0x4e')](_0x300979['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x300979[_0xa853('0x4f')],_0x148f9a);})[_0xa853('0x11')](function(_0x5c3f9b){_0x148f9a[_0xa853('0x50')]=_0x5c3f9b[_0xa853('0x51')];_0x148f9a[_0xa853('0x52')]=_0x5c3f9b[_0xa853('0x53')];return db[_0xa853('0x1a')][_0xa853('0x10')]({'data5':_0x148f9a[_0xa853('0x50')],'data6':_0x148f9a[_0xa853('0x52')]},{'where':{'id':_0x148f9a['id']}});})['then'](function(){oauth[_0xa853('0x54')](_0x148f9a);socket[_0xa853('0x55')]('microsoftAuthorization:success',{'id':_0x59fd0b['id']});return;})['then'](respondWithStatusCode(_0xe1dbbe,null))[_0xa853('0x37')](function(_0x4e70ac){if(_0x59fd0b){socket[_0xa853('0x55')](_0xa853('0x56'),{'id':_0x59fd0b['id']});}if(!_0x148f9a){logger[_0xa853('0x13')](_0xa853('0x57'),_0x4e70ac);return _0xe1dbbe[_0xa853('0x8')](0x1f4)[_0xa853('0x16')](_0x4e70ac['message']);}logger[_0xa853('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x148f9a['id'],JSON[_0xa853('0x58')](_0x4e70ac));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b164911..9546b76 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c25=['CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x23a9fd,_0x51c59a){var _0x541e7c=function(_0x4297d8){while(--_0x4297d8){_0x23a9fd['push'](_0x23a9fd['shift']());}};_0x541e7c(++_0x51c59a);}(_0x5c25,0x9e));var _0x55c2=function(_0x1378d8,_0x70eabd){_0x1378d8=_0x1378d8-0x0;var _0x445476=_0x5c25[_0x1378d8];return _0x445476;};'use strict';var _=require(_0x55c2('0x0'));var util=require(_0x55c2('0x1'));var logger=require(_0x55c2('0x2'))(_0x55c2('0x3'));var moment=require(_0x55c2('0x4'));var BPromise=require('bluebird');var rp=require(_0x55c2('0x5'));var fs=require('fs');var path=require(_0x55c2('0x6'));var rimraf=require(_0x55c2('0x7'));var config=require('../../config/environment');var attributes=require(_0x55c2('0x8'));module[_0x55c2('0x9')]=function(_0x4bfd59,_0x19739e){return _0x4bfd59[_0x55c2('0xa')](_0x55c2('0xb'),attributes,{'tableName':_0x55c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfe5=['cloud_providers','lodash','util','request-promise','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x408d92,_0x547f29){var _0x195dfc=function(_0x4267b4){while(--_0x4267b4){_0x408d92['push'](_0x408d92['shift']());}};_0x195dfc(++_0x547f29);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x5db59c,_0x11cc79){_0x5db59c=_0x5db59c-0x0;var _0x2a1f41=_0xcfe5[_0x5db59c];return _0x2a1f41;};'use strict';var _=require(_0x5cfe('0x0'));var util=require(_0x5cfe('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cfe('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5cfe('0x3'));var config=require(_0x5cfe('0x4'));var attributes=require(_0x5cfe('0x5'));module['exports']=function(_0x26bdda,_0x4a33f0){return _0x26bdda[_0x5cfe('0x6')]('CloudProvider',attributes,{'tableName':_0x5cfe('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 9788aff..abcb75d 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cc3=['inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','join','Dynamics365','replace','{TENANT_ID}','data2','id_token','stringify','toString','hex','client_id','response_type','response_mode','scope','state','nonce','prompt','key','value','oauth2Claims','oauth2/','data1','decode','payload','iss','issuer','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data4','decryptString','POST','data5','access_token','data6','catch','error','authorization_code','intervals','findAll','map','all'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9cc3,0xf6));var _0x39cc=function(_0x486b2e,_0x5b752a){_0x486b2e=_0x486b2e-0x0;var _0xe43bdd=_0x9cc3[_0x486b2e];return _0xe43bdd;};'use strict';var _=require('lodash');var crypto=require(_0x39cc('0x0'));var jwt=require(_0x39cc('0x1'));var moment=require(_0x39cc('0x2'));var Redis=require(_0x39cc('0x3'));var rp=require(_0x39cc('0x4'));var util=require(_0x39cc('0x5'));var encryptor=require(_0x39cc('0x6'));var config=require(_0x39cc('0x7'));var logger=require(_0x39cc('0x8'))(_0x39cc('0x9'));var schedule=require(_0x39cc('0xa'));var db=require(_0x39cc('0xb'))['db'];config['redis']=_[_0x39cc('0xc')](config[_0x39cc('0xd')],{'host':_0x39cc('0xe'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x39cc('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x39cc('0x10'),_0x39cc('0x11'),_0x39cc('0x12'),_0x39cc('0x13'),_0x39cc('0x14'),_0x39cc('0x15'),_0x39cc('0x16')],'Dynamics365':[_0x39cc('0x10'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x39cc('0x17');var MICROSOFT_TOKEN_ENDPOINT=_0x39cc('0x18');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3863b7){var _0x2c5e2f=_['map'](AZURE_AUTH_SCOPES[_0x3863b7['type']]);if(_0x3863b7[_0x39cc('0x19')]==='Dynamics365')_0x2c5e2f[_0x39cc('0x1a')](_0x3863b7[_0x39cc('0x1b')]+_0x39cc('0x1c'));return _0x2c5e2f[_0x39cc('0x1d')]('\x20');}function getAccessTokenScope(_0x10e9d0){if(_0x10e9d0[_0x39cc('0x19')]==='Outlook365')return _0x39cc('0x14');if(_0x10e9d0[_0x39cc('0x19')]===_0x39cc('0x1e'))return _0x10e9d0[_0x39cc('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5b618b,_0x5b1aa0){var _0x166b65=MICROSOFT_AUTH_URL[_0x39cc('0x1f')](_0x39cc('0x20'),_0x5b618b[_0x39cc('0x21')]);var _0x805058=['code',_0x39cc('0x22')];var _0x3331e8=Buffer['from'](JSON[_0x39cc('0x23')]({'id':_0x5b1aa0}))[_0x39cc('0x24')]('base64');var _0x4da815=crypto['randomBytes'](0x10)['toString'](_0x39cc('0x25'));var _0x5dd158=getAuthorizationScopes(_0x5b618b);var _0x16c0f1=[{'key':_0x39cc('0x26'),'value':_0x5b618b['data1']},{'key':_0x39cc('0x27'),'value':encodeURIComponent(_0x805058[_0x39cc('0x1d')]('\x20'))},{'key':'redirect_uri','value':_0x5b618b['data4']},{'key':_0x39cc('0x28'),'value':'form_post'},{'key':_0x39cc('0x29'),'value':encodeURIComponent(_0x5dd158)},{'key':_0x39cc('0x2a'),'value':_0x3331e8},{'key':_0x39cc('0x2b'),'value':_0x4da815},{'key':_0x39cc('0x2c'),'value':'login'}];var _0x2559b8=_0x166b65+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x16c0f1,function(_0x4bd133){return _0x4bd133[_0x39cc('0x2d')]+'='+_0x4bd133[_0x39cc('0x2e')];})[_0x39cc('0x1d')]('&');_0x5b618b[_0x39cc('0x2f')]={'issuer':_0x166b65['replace'](_0x39cc('0x30'),''),'audience':_0x5b618b[_0x39cc('0x31')],'state':_0x3331e8,'nonce':_0x4da815};redis['set'](_0x3331e8,JSON[_0x39cc('0x23')](_0x5b618b));return _0x2559b8;}function isValidIdToken(_0x31736a,_0x19370e){try{var _0x1bcee3=jwt[_0x39cc('0x32')](_0x31736a,{'complete':!![]});var _0x57c98c=_0x1bcee3[_0x39cc('0x33')];if(_0x57c98c[_0x39cc('0x34')]!==_0x19370e[_0x39cc('0x35')])return![];if(_0x57c98c[_0x39cc('0x36')]!==_0x19370e[_0x39cc('0x37')])return![];if(_0x57c98c[_0x39cc('0x2b')]!==_0x19370e['nonce'])return![];if(moment()[_0x39cc('0x38')](moment[_0x39cc('0x39')](_0x57c98c[_0x39cc('0x3a')])))return![];return!![];}catch(_0x5c4c02){throw _0x5c4c02;}}function refreshOauth2MicrosoftAccessToken(_0x5b1d8e){return Promise[_0x39cc('0x3b')]()[_0x39cc('0x3c')](function(){if(_0x5b1d8e[_0x39cc('0x3d')])return _0x5b1d8e;return db[_0x39cc('0x3e')][_0x39cc('0x3f')]({'where':{'id':_0x5b1d8e['id']},'raw':!![]});})[_0x39cc('0x3c')](function(_0x42eaf8){var _0x187c3e={'grant_type':_0x39cc('0x40'),'refresh_token':_0x42eaf8['data6'],'scope':getAccessTokenScope(_0x42eaf8),'redirect_uri':_0x42eaf8[_0x39cc('0x41')],'client_id':_0x42eaf8[_0x39cc('0x31')],'client_secret':encryptor[_0x39cc('0x42')](_0x42eaf8[_0x39cc('0x3d')])};var _0x132ae0={'method':_0x39cc('0x43'),'uri':MICROSOFT_AUTH_URL[_0x39cc('0x1f')]('{TENANT_ID}',_0x42eaf8[_0x39cc('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x187c3e,'json':!![]};return rp(_0x132ae0);})[_0x39cc('0x3c')](function(_0x36f37d){_0x5b1d8e[_0x39cc('0x44')]=_0x36f37d[_0x39cc('0x45')];_0x5b1d8e[_0x39cc('0x46')]=_0x36f37d['refresh_token'];return db[_0x39cc('0x3e')]['update']({'data5':_0x5b1d8e[_0x39cc('0x44')],'data6':_0x5b1d8e[_0x39cc('0x46')]},{'where':{'id':_0x5b1d8e['id']}});})[_0x39cc('0x3c')](function(){return _0x5b1d8e;})[_0x39cc('0x47')](function(_0x5d85d7){logger[_0x39cc('0x48')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5b1d8e['id'],_0x5d85d7);});}function getOauth2MicrosoftAccessToken(_0x1a3e97,_0x10c59f){var _0x368336={'grant_type':_0x39cc('0x49'),'code':_0x1a3e97,'scope':getAccessTokenScope(_0x10c59f),'redirect_uri':_0x10c59f[_0x39cc('0x41')],'client_id':_0x10c59f[_0x39cc('0x31')],'client_secret':encryptor[_0x39cc('0x42')](_0x10c59f[_0x39cc('0x3d')])};var _0x42290d={'method':_0x39cc('0x43'),'uri':MICROSOFT_AUTH_URL[_0x39cc('0x1f')]('{TENANT_ID}',_0x10c59f[_0x39cc('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x368336,'json':!![]};return rp(_0x42290d);}function startRefreshInterval(_0x26b582){var _0x56e6c2=schedule['intervals'];if(_0x56e6c2[_0x26b582['id']])clearInterval(_0x56e6c2[_0x26b582['id']]);_0x56e6c2[_0x26b582['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x26b582['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x39cc('0x4a')]=_0x56e6c2;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x39cc('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x558779){var _0x36a084=_0x558779[_0x39cc('0x4c')](function(_0x5279f4){return refreshOauth2MicrosoftAccessToken(_0x5279f4)['then'](function(_0x120f47){startRefreshInterval(_0x120f47);});});return Promise[_0x39cc('0x4d')](_0x36a084);})['catch'](function(_0x33d5b6){var _0x3cd737=_0x33d5b6?util[_0x39cc('0x4e')](_0x33d5b6,{'showHidden':![],'depth':null}):'';logger['error'](_0x39cc('0x4f'),_0x3cd737);});}module[_0x39cc('0x50')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xaa01=['exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','replace','data5','update','catch','error','authorization_code','bind','intervals','findAll','all','inspect','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','defaults','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','{TENANT_ID}','data2','code','id_token','from','randomBytes','toString','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2/','data1','set','stringify','payload','iss','isAfter','unix'];(function(_0x143dd4,_0xd3279a){var _0x6a3f0d=function(_0x3f7bf0){while(--_0x3f7bf0){_0x143dd4['push'](_0x143dd4['shift']());}};_0x6a3f0d(++_0xd3279a);}(_0xaa01,0x14c));var _0x1aa0=function(_0x5523ff,_0x101914){_0x5523ff=_0x5523ff-0x0;var _0x23734e=_0xaa01[_0x5523ff];return _0x23734e;};'use strict';var _=require(_0x1aa0('0x0'));var crypto=require(_0x1aa0('0x1'));var jwt=require(_0x1aa0('0x2'));var moment=require(_0x1aa0('0x3'));var Redis=require(_0x1aa0('0x4'));var rp=require(_0x1aa0('0x5'));var util=require(_0x1aa0('0x6'));var encryptor=require(_0x1aa0('0x7'));var config=require(_0x1aa0('0x8'));var logger=require(_0x1aa0('0x9'))(_0x1aa0('0xa'));var schedule=require(_0x1aa0('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1aa0('0xc')](config['redis'],{'host':_0x1aa0('0xd'),'port':0x18eb});var redis=new Redis(config[_0x1aa0('0xe')]);var MICROSOFT_AUTH_URL=_0x1aa0('0xf');var AZURE_AUTH_SCOPES={'Outlook365':[_0x1aa0('0x10'),_0x1aa0('0x11'),_0x1aa0('0x12'),'offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x1aa0('0x10'),_0x1aa0('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x1aa0('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x1aa0('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x585e4e){var _0x4b3048=_[_0x1aa0('0x16')](AZURE_AUTH_SCOPES[_0x585e4e[_0x1aa0('0x17')]]);if(_0x585e4e[_0x1aa0('0x17')]===_0x1aa0('0x18'))_0x4b3048[_0x1aa0('0x19')](_0x585e4e[_0x1aa0('0x1a')]+_0x1aa0('0x1b'));return _0x4b3048[_0x1aa0('0x1c')]('\x20');}function getAccessTokenScope(_0x3a66b1){if(_0x3a66b1[_0x1aa0('0x17')]===_0x1aa0('0x1d'))return _0x1aa0('0x1e');if(_0x3a66b1[_0x1aa0('0x17')]===_0x1aa0('0x18'))return _0x3a66b1[_0x1aa0('0x1a')]+_0x1aa0('0x1b');}function generateMicrosoftAuthorizationUrl(_0x25e957,_0x336e17){var _0x2d9c2c=MICROSOFT_AUTH_URL['replace'](_0x1aa0('0x1f'),_0x25e957[_0x1aa0('0x20')]);var _0xf201f2=[_0x1aa0('0x21'),_0x1aa0('0x22')];var _0x16f5b5=Buffer[_0x1aa0('0x23')](JSON['stringify']({'id':_0x336e17}))['toString']('base64');var _0x271426=crypto[_0x1aa0('0x24')](0x10)[_0x1aa0('0x25')]('hex');var _0x355c9a=getAuthorizationScopes(_0x25e957);var _0x3f8aeb=[{'key':_0x1aa0('0x26'),'value':_0x25e957['data1']},{'key':_0x1aa0('0x27'),'value':encodeURIComponent(_0xf201f2[_0x1aa0('0x1c')]('\x20'))},{'key':_0x1aa0('0x28'),'value':_0x25e957[_0x1aa0('0x29')]},{'key':_0x1aa0('0x2a'),'value':_0x1aa0('0x2b')},{'key':_0x1aa0('0x2c'),'value':encodeURIComponent(_0x355c9a)},{'key':'state','value':_0x16f5b5},{'key':_0x1aa0('0x2d'),'value':_0x271426},{'key':_0x1aa0('0x2e'),'value':_0x1aa0('0x2f')}];var _0x5632d3=_0x2d9c2c+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x1aa0('0x16')](_0x3f8aeb,function(_0x590b46){return _0x590b46[_0x1aa0('0x30')]+'='+_0x590b46[_0x1aa0('0x31')];})[_0x1aa0('0x1c')]('&');_0x25e957['oauth2Claims']={'issuer':_0x2d9c2c['replace'](_0x1aa0('0x32'),''),'audience':_0x25e957[_0x1aa0('0x33')],'state':_0x16f5b5,'nonce':_0x271426};redis[_0x1aa0('0x34')](_0x16f5b5,JSON[_0x1aa0('0x35')](_0x25e957));return _0x5632d3;}function isValidIdToken(_0x57f8f1,_0x4ed7e9){try{var _0x2e224e=jwt['decode'](_0x57f8f1,{'complete':!![]});var _0x587ed0=_0x2e224e[_0x1aa0('0x36')];if(_0x587ed0[_0x1aa0('0x37')]!==_0x4ed7e9['issuer'])return![];if(_0x587ed0['aud']!==_0x4ed7e9['audience'])return![];if(_0x587ed0[_0x1aa0('0x2d')]!==_0x4ed7e9[_0x1aa0('0x2d')])return![];if(moment()[_0x1aa0('0x38')](moment[_0x1aa0('0x39')](_0x587ed0[_0x1aa0('0x3a')])))return![];return!![];}catch(_0x1557db){throw _0x1557db;}}function refreshOauth2MicrosoftAccessToken(_0x2112f3){return Promise[_0x1aa0('0x3b')]()[_0x1aa0('0x3c')](function(){if(_0x2112f3[_0x1aa0('0x3d')])return _0x2112f3;return db[_0x1aa0('0x3e')][_0x1aa0('0x3f')]({'where':{'id':_0x2112f3['id']},'raw':!![]});})[_0x1aa0('0x3c')](function(_0x23703e){var _0x3723c7={'grant_type':_0x1aa0('0x40'),'refresh_token':_0x23703e[_0x1aa0('0x41')],'scope':getAccessTokenScope(_0x23703e),'redirect_uri':_0x23703e[_0x1aa0('0x29')],'client_id':_0x23703e['data1'],'client_secret':encryptor[_0x1aa0('0x42')](_0x23703e['data3'])};var _0x2e714e={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1aa0('0x43')](_0x1aa0('0x1f'),_0x23703e[_0x1aa0('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3723c7,'json':!![]};return rp(_0x2e714e);})[_0x1aa0('0x3c')](function(_0x599943){_0x2112f3[_0x1aa0('0x44')]=_0x599943['access_token'];_0x2112f3[_0x1aa0('0x41')]=_0x599943[_0x1aa0('0x40')];return db['CloudProvider'][_0x1aa0('0x45')]({'data5':_0x2112f3[_0x1aa0('0x44')],'data6':_0x2112f3[_0x1aa0('0x41')]},{'where':{'id':_0x2112f3['id']}});})[_0x1aa0('0x3c')](function(){return _0x2112f3;})[_0x1aa0('0x46')](function(_0x1b736d){logger[_0x1aa0('0x47')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2112f3['id'],_0x1b736d);});}function getOauth2MicrosoftAccessToken(_0x2226f4,_0x43fcae){var _0x4e708c={'grant_type':_0x1aa0('0x48'),'code':_0x2226f4,'scope':getAccessTokenScope(_0x43fcae),'redirect_uri':_0x43fcae['data4'],'client_id':_0x43fcae[_0x1aa0('0x33')],'client_secret':encryptor[_0x1aa0('0x42')](_0x43fcae[_0x1aa0('0x3d')])};var _0x5bae95={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x1aa0('0x43')](_0x1aa0('0x1f'),_0x43fcae[_0x1aa0('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4e708c,'json':!![]};return rp(_0x5bae95);}function startRefreshInterval(_0x260562){var _0x156288=schedule['intervals'];if(_0x156288[_0x260562['id']])clearInterval(_0x156288[_0x260562['id']]);_0x156288[_0x260562['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x1aa0('0x49')](this,{'id':_0x260562['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x1aa0('0x4a')]=_0x156288;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x1aa0('0x4b')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x1aa0('0x3c')](function(_0x4d61e3){var _0x53d67b=_0x4d61e3['map'](function(_0x2f9eb4){return refreshOauth2MicrosoftAccessToken(_0x2f9eb4)[_0x1aa0('0x3c')](function(_0x350f6a){startRefreshInterval(_0x350f6a);});});return Promise[_0x1aa0('0x4c')](_0x53d67b);})[_0x1aa0('0x46')](function(_0x320895){var _0x3d7609=_0x320895?util[_0x1aa0('0x4d')](_0x320895,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3d7609);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1162d3a..b2c32d4 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','client'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x87bc,0x189));var _0xc87b=function(_0x585c82,_0x3d5c40){_0x585c82=_0x585c82-0x0;var _0x26ddfa=_0x87bc[_0x585c82];return _0x26ddfa;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var moment=require('moment');var BPromise=require(_0xc87b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc87b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc87b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc87b('0x5')][_0xc87b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x402aac,_0x5d1813,_0x50b19b){return new BPromise(function(_0x4ed0c5,_0x1999f8){return client[_0xc87b('0x7')](_0x402aac,_0x50b19b)[_0xc87b('0x8')](function(_0x19b571){logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));logger[_0xc87b('0xc')](_0xc87b('0xd'),_0x5d1813,'request\x20sent',JSON['stringify'](_0x19b571));if(_0x19b571[_0xc87b('0xe')]){if(_0x19b571['error'][_0xc87b('0xf')]===0x1f4){logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571[_0xc87b('0xe')]['message']);return _0x1999f8(_0x19b571[_0xc87b('0xe')]['message']);}logger[_0xc87b('0xe')](_0xc87b('0xa'),_0x5d1813,_0x19b571['error'][_0xc87b('0x10')]);return _0x4ed0c5(_0x19b571[_0xc87b('0xe')]['message']);}else{logger[_0xc87b('0x9')](_0xc87b('0xa'),_0x5d1813,_0xc87b('0xb'));_0x4ed0c5(_0x19b571[_0xc87b('0x11')][_0xc87b('0x10')]);}})[_0xc87b('0x12')](function(_0x4009ef){logger[_0xc87b('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5d1813,_0x4009ef);_0x1999f8(_0x4009ef);});});} \ No newline at end of file +var _0xda20=['http','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xda20,0x1d9));var _0x0da2=function(_0x121b84,_0x1aedbd){_0x121b84=_0x121b84-0x0;var _0x2c5792=_0xda20[_0x121b84];return _0x2c5792;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var moment=require(_0x0da2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0da2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0da2('0x3'));var logger=require(_0x0da2('0x4'))('rpc');var config=require(_0x0da2('0x5'));var jayson=require(_0x0da2('0x6'));var client=jayson['client'][_0x0da2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x292ede,_0x166a32,_0x3aa0c5){return new BPromise(function(_0x1e5150,_0x1069a6){return client[_0x0da2('0x8')](_0x292ede,_0x3aa0c5)[_0x0da2('0x9')](function(_0x248bce){logger['info'](_0x0da2('0xa'),_0x166a32,_0x0da2('0xb'));logger[_0x0da2('0xc')](_0x0da2('0xd'),_0x166a32,'request\x20sent',JSON['stringify'](_0x248bce));if(_0x248bce[_0x0da2('0xe')]){if(_0x248bce[_0x0da2('0xe')][_0x0da2('0xf')]===0x1f4){logger[_0x0da2('0xe')](_0x0da2('0xa'),_0x166a32,_0x248bce[_0x0da2('0xe')][_0x0da2('0x10')]);return _0x1069a6(_0x248bce['error'][_0x0da2('0x10')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x166a32,_0x248bce['error'][_0x0da2('0x10')]);return _0x1e5150(_0x248bce['error'][_0x0da2('0x10')]);}else{logger[_0x0da2('0x11')]('CloudProvider,\x20%s,\x20%s',_0x166a32,_0x0da2('0xb'));_0x1e5150(_0x248bce[_0x0da2('0x12')]['message']);}})[_0x0da2('0x13')](function(_0x192772){logger[_0x0da2('0xe')]('CloudProvider,\x20%s,\x20%s',_0x166a32,_0x192772);_0x1069a6(_0x192772);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 11d8f75..373acb7 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4c0fbb,_0x420492){_0x4c0fbb=_0x4c0fbb-0x0;var _0x462c3d=_0x5f2f[_0x4c0fbb];return _0x462c3d;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1db2cb,_0x5c5c8d){var _0x34910b=function(_0x1c0e0b){while(--_0x1c0e0b){_0x1db2cb['push'](_0x1db2cb['shift']());}};_0x34910b(++_0x5c5c8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d9d39c5..328d0ec 100644 --- a/server/api/cmCompany/cmCompany.attributes.js +++ b/server/api/cmCompany/cmCompany.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdba=['sequelize','exports','STRING','name'];(function(_0x30bff4,_0x5d2581){var _0x14518d=function(_0x1e2998){while(--_0x1e2998){_0x30bff4['push'](_0x30bff4['shift']());}};_0x14518d(++_0x5d2581);}(_0xfdba,0xf4));var _0xafdb=function(_0x3cbff8,_0x33ab36){_0x3cbff8=_0x3cbff8-0x0;var _0x10e0e1=_0xfdba[_0x3cbff8];return _0x10e0e1;};'use strict';var Sequelize=require(_0xafdb('0x0'));module[_0xafdb('0x1')]={'name':{'type':Sequelize[_0xafdb('0x2')],'unique':_0xafdb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xafdb('0x2')]},'companyId':{'type':Sequelize[_0xafdb('0x2')]},'website':{'type':Sequelize[_0xafdb('0x2')]},'phone':{'type':Sequelize[_0xafdb('0x2')]},'fax':{'type':Sequelize[_0xafdb('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xafdb('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xafdb('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xafdb('0x2')]},'sStreet':{'type':Sequelize[_0xafdb('0x2')]},'sPostalCode':{'type':Sequelize[_0xafdb('0x2')]},'sCity':{'type':Sequelize[_0xafdb('0x2')]},'sCountry':{'type':Sequelize[_0xafdb('0x2')]},'description':{'type':Sequelize[_0xafdb('0x2')]}}; \ No newline at end of file +var _0x7cba=['name','STRING'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x7cba,0x1d5));var _0xa7cb=function(_0x38f339,_0x4cc1b3){_0x38f339=_0x38f339-0x0;var _0x5e6df4=_0x7cba[_0x38f339];return _0x5e6df4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa7cb('0x0')],'unique':_0xa7cb('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xa7cb('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa7cb('0x0')]},'fax':{'type':Sequelize[_0xa7cb('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa7cb('0x0')]},'postalCode':{'type':Sequelize[_0xa7cb('0x0')]},'city':{'type':Sequelize[_0xa7cb('0x0')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa7cb('0x0')]},'sStreet':{'type':Sequelize[_0xa7cb('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xa7cb('0x0')]},'sCountry':{'type':Sequelize[_0xa7cb('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 29ac5ef..bd58201 100644 --- a/server/api/cmCompany/cmCompany.controller.js +++ b/server/api/cmCompany/cmCompany.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fd2=['sort','where','pick','merge','map','filter','options','includeAll','include','rows','catch','show','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','Companies','UserProfileResource','stack','name','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1c9818,_0x29688a){var _0x2a9b82=function(_0x4bd8ac){while(--_0x4bd8ac){_0x1c9818['push'](_0x1c9818['shift']());}};_0x2a9b82(++_0x29688a);}(_0x7fd2,0xcb));var _0x27fd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7fd2[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x27fd('0x0'));var rimraf=require(_0x27fd('0x1'));var zipdir=require(_0x27fd('0x2'));var jsonpatch=require(_0x27fd('0x3'));var rp=require(_0x27fd('0x4'));var moment=require(_0x27fd('0x5'));var BPromise=require(_0x27fd('0x6'));var Mustache=require('mustache');var util=require(_0x27fd('0x7'));var path=require(_0x27fd('0x8'));var sox=require('sox');var csv=require(_0x27fd('0x9'));var ejs=require(_0x27fd('0xa'));var fs=require('fs');var fs_extra=require(_0x27fd('0xb'));var _=require(_0x27fd('0xc'));var squel=require(_0x27fd('0xd'));var crypto=require(_0x27fd('0xe'));var jsforce=require(_0x27fd('0xf'));var deskjs=require(_0x27fd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x27fd('0x11'));var Papa=require(_0x27fd('0x12'));var Redis=require(_0x27fd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x27fd('0x14'));var hardwareService=require(_0x27fd('0x15'));var logger=require(_0x27fd('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x27fd('0x17'));var licenseUtil=require(_0x27fd('0x18'));var db=require(_0x27fd('0x19'))['db'];function respondWithStatusCode(_0x3f2e5a,_0x16e225){_0x16e225=_0x16e225||0xcc;return function(_0x2b1b32){if(_0x2b1b32){return _0x3f2e5a[_0x27fd('0x1a')](_0x16e225);}return _0x3f2e5a[_0x27fd('0x1b')](_0x16e225)[_0x27fd('0x1c')]();};}function respondWithResult(_0x5c1bcf,_0x368405){_0x368405=_0x368405||0xc8;return function(_0x546727){if(_0x546727){return _0x5c1bcf['status'](_0x368405)[_0x27fd('0x1d')](_0x546727);}};}function respondWithFilteredResult(_0x52e215,_0x1c7501){return function(_0x1e4a67){if(_0x1e4a67){var _0x56b7da=typeof _0x1c7501[_0x27fd('0x1e')]===_0x27fd('0x1f')&&typeof _0x1c7501['limit']===_0x27fd('0x1f');var _0x1ceb72=_0x1e4a67['count'];var _0x525e07=_0x56b7da?0x0:_0x1c7501[_0x27fd('0x1e')];var _0x39629c=_0x56b7da?_0x1e4a67[_0x27fd('0x20')]:_0x1c7501['offset']+_0x1c7501[_0x27fd('0x21')];var _0x3f888e;if(_0x39629c>=_0x1ceb72){_0x39629c=_0x1ceb72;_0x3f888e=0xc8;}else{_0x3f888e=0xce;}_0x52e215[_0x27fd('0x1b')](_0x3f888e);return _0x52e215[_0x27fd('0x22')](_0x27fd('0x23'),_0x525e07+'-'+_0x39629c+'/'+_0x1ceb72)[_0x27fd('0x1d')](_0x1e4a67);}return null;};}function patchUpdates(_0x3d270c){return function(_0x4e3f3a){try{jsonpatch['apply'](_0x4e3f3a,_0x3d270c,!![]);}catch(_0x23ba8b){return BPromise['reject'](_0x23ba8b);}return _0x4e3f3a['save']();};}function saveUpdates(_0x381907,_0x264782){return function(_0x297742){if(_0x297742){return _0x297742[_0x27fd('0x24')](_0x381907)['then'](function(_0x1a63ab){return _0x1a63ab;});}return null;};}function removeEntity(_0x573a1e,_0x2b9e06){return function(_0x34c6b9){if(_0x34c6b9){return _0x34c6b9[_0x27fd('0x25')]()[_0x27fd('0x26')](function(){var _0x5ccba3=_0x34c6b9['get']({'plain':!![]});var _0x421146=_0x27fd('0x27');return db[_0x27fd('0x28')][_0x27fd('0x25')]({'where':{'type':_0x421146,'resourceId':_0x5ccba3['id']}})[_0x27fd('0x26')](function(){return _0x34c6b9;});})[_0x27fd('0x26')](function(){_0x573a1e[_0x27fd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbad5b3,_0x413637){return function(_0x3acea4){if(!_0x3acea4){_0xbad5b3[_0x27fd('0x1a')](0x194);}return _0x3acea4;};}function handleError(_0x46106e,_0x52b576){_0x52b576=_0x52b576||0x1f4;return function(_0x562252){logger['error'](_0x562252[_0x27fd('0x29')]);if(_0x562252[_0x27fd('0x2a')]){delete _0x562252[_0x27fd('0x2a')];}_0x46106e[_0x27fd('0x1b')](_0x52b576)['send'](_0x562252);};}exports[_0x27fd('0x2b')]=function(_0x1b026c,_0x2289f5){var _0x4b2e0a={},_0x5034e2={},_0x37b91b={'count':0x0,'rows':[]};return db[_0x27fd('0x2c')][_0x27fd('0x2d')]()[_0x27fd('0x26')](function(_0x338e47){_0x5034e2[_0x27fd('0x2e')]=_[_0x27fd('0x2f')](_0x338e47);_0x5034e2[_0x27fd('0x30')]=_[_0x27fd('0x2f')](_0x1b026c[_0x27fd('0x30')]);_0x5034e2[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x5034e2[_0x27fd('0x2e')],_0x5034e2['query']);_0x4b2e0a[_0x27fd('0x33')]=_['intersection'](_0x5034e2['model'],qs['fields'](_0x1b026c[_0x27fd('0x30')][_0x27fd('0x34')]));_0x4b2e0a[_0x27fd('0x33')]=_0x4b2e0a[_0x27fd('0x33')][_0x27fd('0x35')]?_0x4b2e0a['attributes']:_0x5034e2['model'];if(!_0x1b026c['query']['hasOwnProperty'](_0x27fd('0x36'))){_0x4b2e0a['limit']=qs[_0x27fd('0x21')](_0x1b026c['query'][_0x27fd('0x21')]);_0x4b2e0a['offset']=qs[_0x27fd('0x1e')](_0x1b026c[_0x27fd('0x30')][_0x27fd('0x1e')]);}_0x4b2e0a['order']=qs['sort'](_0x1b026c['query'][_0x27fd('0x37')]);_0x4b2e0a[_0x27fd('0x38')]=qs['filters'](_[_0x27fd('0x39')](_0x1b026c[_0x27fd('0x30')],_0x5034e2[_0x27fd('0x31')]),_0x338e47);if(_0x1b026c['query']['filter']){_0x4b2e0a[_0x27fd('0x38')]=_[_0x27fd('0x3a')](_0x4b2e0a[_0x27fd('0x38')],{'$or':_[_0x27fd('0x3b')](_0x4b2e0a[_0x27fd('0x33')],function(_0x2a9db9){var _0x50bf32={};_0x50bf32[_0x2a9db9]={'$like':'%'+_0x1b026c['query'][_0x27fd('0x3c')]+'%'};return _0x50bf32;})});}_0x4b2e0a=_[_0x27fd('0x3a')]({},_0x4b2e0a,_0x1b026c[_0x27fd('0x3d')]);var _0x45af30={'where':_0x4b2e0a[_0x27fd('0x38')]};return db[_0x27fd('0x2c')][_0x27fd('0x20')](_0x45af30)['then'](function(_0x3a3997){_0x37b91b[_0x27fd('0x20')]=_0x3a3997;if(_0x1b026c['query'][_0x27fd('0x3e')]){_0x4b2e0a[_0x27fd('0x3f')]=[{'all':!![]}];}return db[_0x27fd('0x2c')]['findAll'](_0x4b2e0a);})[_0x27fd('0x26')](function(_0x565c7e){_0x37b91b[_0x27fd('0x40')]=_0x565c7e;return _0x37b91b;})['then'](respondWithFilteredResult(_0x2289f5,_0x4b2e0a))[_0x27fd('0x41')](handleError(_0x2289f5,null));})[_0x27fd('0x41')](handleError(_0x2289f5,null));};exports[_0x27fd('0x42')]=function(_0x44c2cc,_0x20c12d){var _0x37cf71={'raw':![],'where':{'id':_0x44c2cc['params']['id']}},_0x23dc66={};_0x23dc66['model']=_[_0x27fd('0x2f')](db['CmCompany'][_0x27fd('0x43')]);_0x23dc66['query']=_[_0x27fd('0x2f')](_0x44c2cc[_0x27fd('0x30')]);_0x23dc66[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x23dc66[_0x27fd('0x2e')],_0x23dc66['query']);_0x37cf71[_0x27fd('0x33')]=_[_0x27fd('0x32')](_0x23dc66[_0x27fd('0x2e')],qs[_0x27fd('0x34')](_0x44c2cc[_0x27fd('0x30')][_0x27fd('0x34')]));_0x37cf71[_0x27fd('0x33')]=_0x37cf71[_0x27fd('0x33')][_0x27fd('0x35')]?_0x37cf71[_0x27fd('0x33')]:_0x23dc66[_0x27fd('0x2e')];if(_0x44c2cc[_0x27fd('0x30')][_0x27fd('0x3e')]){_0x37cf71[_0x27fd('0x3f')]=[{'all':!![]}];}_0x37cf71=_['merge']({},_0x37cf71,_0x44c2cc['options']);return db[_0x27fd('0x2c')]['find'](_0x37cf71)[_0x27fd('0x26')](handleEntityNotFound(_0x20c12d,null))['then'](respondWithResult(_0x20c12d,null))[_0x27fd('0x41')](handleError(_0x20c12d,null));};exports[_0x27fd('0x44')]=function(_0x539d54,_0x345ea8){return db[_0x27fd('0x2c')][_0x27fd('0x44')](_0x539d54[_0x27fd('0x45')],{})[_0x27fd('0x26')](function(_0x5b6532){var _0x38f2a3=_0x539d54[_0x27fd('0x46')][_0x27fd('0x47')]({'plain':!![]});if(!_0x38f2a3)throw new Error(_0x27fd('0x48'));if(_0x38f2a3[_0x27fd('0x49')]===_0x27fd('0x46')){var _0x29c69c=_0x5b6532[_0x27fd('0x47')]({'plain':!![]});var _0x362a94=_0x27fd('0x27');return db['UserProfileSection'][_0x27fd('0x4a')]({'where':{'name':_0x362a94,'userProfileId':_0x38f2a3[_0x27fd('0x4b')]},'raw':!![]})['then'](function(_0x2e5906){if(_0x2e5906&&_0x2e5906[_0x27fd('0x4c')]===0x0){return db[_0x27fd('0x28')][_0x27fd('0x44')]({'name':_0x29c69c[_0x27fd('0x2a')],'resourceId':_0x29c69c['id'],'type':_0x2e5906[_0x27fd('0x2a')],'sectionId':_0x2e5906['id']},{})['then'](function(){return _0x5b6532;});}else{return _0x5b6532;}})[_0x27fd('0x41')](function(_0x2fbe37){logger['error'](_0x27fd('0x4d'),_0x2fbe37);throw _0x2fbe37;});}return _0x5b6532;})[_0x27fd('0x26')](respondWithResult(_0x345ea8,0xc9))[_0x27fd('0x41')](handleError(_0x345ea8,null));};exports[_0x27fd('0x24')]=function(_0x119af6,_0x309f07){if(_0x119af6['body']['id']){delete _0x119af6[_0x27fd('0x45')]['id'];}return db[_0x27fd('0x2c')][_0x27fd('0x4a')]({'where':{'id':_0x119af6[_0x27fd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x309f07,null))[_0x27fd('0x26')](saveUpdates(_0x119af6['body'],null))[_0x27fd('0x26')](respondWithResult(_0x309f07,null))[_0x27fd('0x41')](handleError(_0x309f07,null));};exports[_0x27fd('0x25')]=function(_0x424e7c,_0x18e9a6){return db[_0x27fd('0x2c')]['find']({'where':{'id':_0x424e7c['params']['id']}})[_0x27fd('0x26')](handleEntityNotFound(_0x18e9a6,null))['then'](removeEntity(_0x18e9a6,null))[_0x27fd('0x41')](handleError(_0x18e9a6,null));};exports[_0x27fd('0x2d')]=function(_0x5a96e1,_0x24a9f6){return db[_0x27fd('0x2c')][_0x27fd('0x2d')]()[_0x27fd('0x26')](respondWithResult(_0x24a9f6,null))[_0x27fd('0x41')](handleError(_0x24a9f6,null));};exports[_0x27fd('0x4f')]=function(_0x1cbce1,_0x1dfa48,_0x144594){return db[_0x27fd('0x50')][_0x27fd('0x4a')]({'where':{'id':_0x1cbce1[_0x27fd('0x4e')]['id']}})[_0x27fd('0x26')](handleEntityNotFound(_0x1dfa48,null))[_0x27fd('0x26')](function(_0x2644f1){if(_0x2644f1){return _0x2644f1[_0x27fd('0x4f')](_0x1cbce1[_0x27fd('0x45')][_0x27fd('0x51')],_[_0x27fd('0x52')](_0x1cbce1['body'],['ids','id'])||{});}})[_0x27fd('0x26')](respondWithResult(_0x1dfa48,null))[_0x27fd('0x41')](handleError(_0x1dfa48,null));};exports[_0x27fd('0x53')]=function(_0xa26b1c,_0x222e8d,_0x43d344){var _0x560005={};var _0x126ac0={};var _0x7d0f1;var _0x5e0dc5;return db['CmCompany'][_0x27fd('0x54')]({'where':{'id':_0xa26b1c[_0x27fd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x222e8d,null))[_0x27fd('0x26')](function(_0x2fcf8e){if(_0x2fcf8e){_0x7d0f1=_0x2fcf8e;_0x126ac0[_0x27fd('0x2e')]=_['keys'](db[_0x27fd('0x50')]['rawAttributes']);_0x126ac0[_0x27fd('0x30')]=_[_0x27fd('0x2f')](_0xa26b1c[_0x27fd('0x30')]);_0x126ac0[_0x27fd('0x31')]=_[_0x27fd('0x32')](_0x126ac0[_0x27fd('0x2e')],_0x126ac0[_0x27fd('0x30')]);_0x560005[_0x27fd('0x33')]=_[_0x27fd('0x32')](_0x126ac0['model'],qs[_0x27fd('0x34')](_0xa26b1c[_0x27fd('0x30')]['fields']));_0x560005[_0x27fd('0x33')]=_0x560005['attributes'][_0x27fd('0x35')]?_0x560005['attributes']:_0x126ac0[_0x27fd('0x2e')];_0x560005['order']=qs[_0x27fd('0x37')](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x37')]);_0x560005[_0x27fd('0x38')]=qs[_0x27fd('0x31')](_[_0x27fd('0x39')](_0xa26b1c[_0x27fd('0x30')],_0x126ac0[_0x27fd('0x31')]));if(_0xa26b1c[_0x27fd('0x30')]['filter']){_0x560005[_0x27fd('0x38')]=_[_0x27fd('0x3a')](_0x560005['where'],{'$or':_[_0x27fd('0x3b')](_0x560005[_0x27fd('0x33')],function(_0x425aed){var _0x44bbfa={};_0x44bbfa[_0x425aed]={'$like':'%'+_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x3c')]+'%'};return _0x44bbfa;})});}_0x560005=_[_0x27fd('0x3a')]({},_0x560005,_0xa26b1c[_0x27fd('0x3d')]);return _0x7d0f1[_0x27fd('0x53')](_0x560005);}})[_0x27fd('0x26')](function(_0x30ebe2){if(_0x30ebe2){_0x5e0dc5=_0x30ebe2['length'];if(!_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x55')](_0x27fd('0x36'))){_0x560005[_0x27fd('0x21')]=qs[_0x27fd('0x21')](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x21')]);_0x560005[_0x27fd('0x1e')]=qs['offset'](_0xa26b1c[_0x27fd('0x30')][_0x27fd('0x1e')]);}return _0x7d0f1[_0x27fd('0x53')](_0x560005);}})['then'](function(_0x396b4c){if(_0x396b4c){return _0x396b4c?{'count':_0x5e0dc5,'rows':_0x396b4c}:null;}})[_0x27fd('0x26')](respondWithResult(_0x222e8d,null))[_0x27fd('0x41')](handleError(_0x222e8d,null));}; \ No newline at end of file +var _0x85d6=['destroy','get','Companies','UserProfileResource','error','name','index','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','map','options','CmCompany','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then'];(function(_0x29a753,_0x5ce67d){var _0x5d78c7=function(_0x2659dd){while(--_0x2659dd){_0x29a753['push'](_0x29a753['shift']());}};_0x5d78c7(++_0x5ce67d);}(_0x85d6,0x7e));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x685d('0x0'));var rimraf=require(_0x685d('0x1'));var zipdir=require(_0x685d('0x2'));var jsonpatch=require(_0x685d('0x3'));var rp=require(_0x685d('0x4'));var moment=require(_0x685d('0x5'));var BPromise=require(_0x685d('0x6'));var Mustache=require(_0x685d('0x7'));var util=require('util');var path=require(_0x685d('0x8'));var sox=require(_0x685d('0x9'));var csv=require(_0x685d('0xa'));var ejs=require(_0x685d('0xb'));var fs=require('fs');var fs_extra=require(_0x685d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x685d('0xd'));var deskjs=require(_0x685d('0xe'));var toCsv=require(_0x685d('0xa'));var querystring=require(_0x685d('0xf'));var Papa=require(_0x685d('0x10'));var Redis=require(_0x685d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x685d('0x12'));var as=require(_0x685d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x685d('0x14'));var utils=require(_0x685d('0x15'));var config=require(_0x685d('0x16'));var licenseUtil=require(_0x685d('0x17'));var db=require(_0x685d('0x18'))['db'];function respondWithStatusCode(_0x429c30,_0x2b64fb){_0x2b64fb=_0x2b64fb||0xcc;return function(_0x1cc7d7){if(_0x1cc7d7){return _0x429c30[_0x685d('0x19')](_0x2b64fb);}return _0x429c30[_0x685d('0x1a')](_0x2b64fb)[_0x685d('0x1b')]();};}function respondWithResult(_0x197b66,_0x74dbb3){_0x74dbb3=_0x74dbb3||0xc8;return function(_0x305160){if(_0x305160){return _0x197b66['status'](_0x74dbb3)[_0x685d('0x1c')](_0x305160);}};}function respondWithFilteredResult(_0x5a965a,_0x1405c6){return function(_0xb2e837){if(_0xb2e837){var _0x472d42=typeof _0x1405c6[_0x685d('0x1d')]===_0x685d('0x1e')&&typeof _0x1405c6[_0x685d('0x1f')]===_0x685d('0x1e');var _0xc3cd51=_0xb2e837['count'];var _0x436b8e=_0x472d42?0x0:_0x1405c6['offset'];var _0x7decc3=_0x472d42?_0xb2e837[_0x685d('0x20')]:_0x1405c6[_0x685d('0x1d')]+_0x1405c6['limit'];var _0x1a3da0;if(_0x7decc3>=_0xc3cd51){_0x7decc3=_0xc3cd51;_0x1a3da0=0xc8;}else{_0x1a3da0=0xce;}_0x5a965a['status'](_0x1a3da0);return _0x5a965a['set'](_0x685d('0x21'),_0x436b8e+'-'+_0x7decc3+'/'+_0xc3cd51)[_0x685d('0x1c')](_0xb2e837);}return null;};}function patchUpdates(_0x563e44){return function(_0x2510dd){try{jsonpatch['apply'](_0x2510dd,_0x563e44,!![]);}catch(_0x4ec302){return BPromise[_0x685d('0x22')](_0x4ec302);}return _0x2510dd['save']();};}function saveUpdates(_0x272ab6,_0x3947c7){return function(_0x5b2936){if(_0x5b2936){return _0x5b2936['update'](_0x272ab6)[_0x685d('0x23')](function(_0x34693b){return _0x34693b;});}return null;};}function removeEntity(_0x209f17,_0x57b84e){return function(_0x4443fe){if(_0x4443fe){return _0x4443fe[_0x685d('0x24')]()[_0x685d('0x23')](function(){var _0xdd3160=_0x4443fe[_0x685d('0x25')]({'plain':!![]});var _0x55c8b4=_0x685d('0x26');return db[_0x685d('0x27')][_0x685d('0x24')]({'where':{'type':_0x55c8b4,'resourceId':_0xdd3160['id']}})[_0x685d('0x23')](function(){return _0x4443fe;});})[_0x685d('0x23')](function(){_0x209f17[_0x685d('0x1a')](0xcc)[_0x685d('0x1b')]();});}};}function handleEntityNotFound(_0x4cb972,_0x17e1e8){return function(_0x3f75d3){if(!_0x3f75d3){_0x4cb972['sendStatus'](0x194);}return _0x3f75d3;};}function handleError(_0x41773c,_0x519f93){_0x519f93=_0x519f93||0x1f4;return function(_0x22f9bf){logger[_0x685d('0x28')](_0x22f9bf['stack']);if(_0x22f9bf[_0x685d('0x29')]){delete _0x22f9bf[_0x685d('0x29')];}_0x41773c['status'](_0x519f93)['send'](_0x22f9bf);};}exports[_0x685d('0x2a')]=function(_0x5b2abe,_0xf086ee){var _0xf59db7={},_0x164120={},_0x426565={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x685d('0x23')](function(_0x1ff5dc){_0x164120['model']=_['keys'](_0x1ff5dc);_0x164120[_0x685d('0x2b')]=_[_0x685d('0x2c')](_0x5b2abe[_0x685d('0x2b')]);_0x164120[_0x685d('0x2d')]=_['intersection'](_0x164120[_0x685d('0x2e')],_0x164120[_0x685d('0x2b')]);_0xf59db7[_0x685d('0x2f')]=_[_0x685d('0x30')](_0x164120[_0x685d('0x2e')],qs[_0x685d('0x31')](_0x5b2abe[_0x685d('0x2b')]['fields']));_0xf59db7[_0x685d('0x2f')]=_0xf59db7[_0x685d('0x2f')][_0x685d('0x32')]?_0xf59db7[_0x685d('0x2f')]:_0x164120[_0x685d('0x2e')];if(!_0x5b2abe[_0x685d('0x2b')][_0x685d('0x33')]('nolimit')){_0xf59db7[_0x685d('0x1f')]=qs[_0x685d('0x1f')](_0x5b2abe[_0x685d('0x2b')][_0x685d('0x1f')]);_0xf59db7[_0x685d('0x1d')]=qs[_0x685d('0x1d')](_0x5b2abe[_0x685d('0x2b')]['offset']);}_0xf59db7[_0x685d('0x34')]=qs[_0x685d('0x35')](_0x5b2abe[_0x685d('0x2b')][_0x685d('0x35')]);_0xf59db7[_0x685d('0x36')]=qs[_0x685d('0x2d')](_['pick'](_0x5b2abe[_0x685d('0x2b')],_0x164120[_0x685d('0x2d')]),_0x1ff5dc);if(_0x5b2abe[_0x685d('0x2b')][_0x685d('0x37')]){_0xf59db7[_0x685d('0x36')]=_[_0x685d('0x38')](_0xf59db7[_0x685d('0x36')],{'$or':_[_0x685d('0x39')](_0xf59db7[_0x685d('0x2f')],function(_0x28deb4){var _0x61e21d={};_0x61e21d[_0x28deb4]={'$like':'%'+_0x5b2abe[_0x685d('0x2b')]['filter']+'%'};return _0x61e21d;})});}_0xf59db7=_['merge']({},_0xf59db7,_0x5b2abe[_0x685d('0x3a')]);var _0x2da627={'where':_0xf59db7[_0x685d('0x36')]};return db[_0x685d('0x3b')][_0x685d('0x20')](_0x2da627)[_0x685d('0x23')](function(_0x4093f2){_0x426565[_0x685d('0x20')]=_0x4093f2;if(_0x5b2abe['query'][_0x685d('0x3c')]){_0xf59db7[_0x685d('0x3d')]=[{'all':!![]}];}return db[_0x685d('0x3b')][_0x685d('0x3e')](_0xf59db7);})[_0x685d('0x23')](function(_0x568436){_0x426565[_0x685d('0x3f')]=_0x568436;return _0x426565;})[_0x685d('0x23')](respondWithFilteredResult(_0xf086ee,_0xf59db7))['catch'](handleError(_0xf086ee,null));})[_0x685d('0x40')](handleError(_0xf086ee,null));};exports['show']=function(_0x274e81,_0xcf25b5){var _0x249dd5={'raw':![],'where':{'id':_0x274e81[_0x685d('0x41')]['id']}},_0x4c610a={};_0x4c610a[_0x685d('0x2e')]=_[_0x685d('0x2c')](db[_0x685d('0x3b')][_0x685d('0x42')]);_0x4c610a['query']=_[_0x685d('0x2c')](_0x274e81[_0x685d('0x2b')]);_0x4c610a[_0x685d('0x2d')]=_[_0x685d('0x30')](_0x4c610a['model'],_0x4c610a[_0x685d('0x2b')]);_0x249dd5[_0x685d('0x2f')]=_[_0x685d('0x30')](_0x4c610a[_0x685d('0x2e')],qs[_0x685d('0x31')](_0x274e81[_0x685d('0x2b')][_0x685d('0x31')]));_0x249dd5['attributes']=_0x249dd5['attributes'][_0x685d('0x32')]?_0x249dd5['attributes']:_0x4c610a[_0x685d('0x2e')];if(_0x274e81[_0x685d('0x2b')][_0x685d('0x3c')]){_0x249dd5['include']=[{'all':!![]}];}_0x249dd5=_[_0x685d('0x38')]({},_0x249dd5,_0x274e81[_0x685d('0x3a')]);return db[_0x685d('0x3b')]['find'](_0x249dd5)[_0x685d('0x23')](handleEntityNotFound(_0xcf25b5,null))[_0x685d('0x23')](respondWithResult(_0xcf25b5,null))[_0x685d('0x40')](handleError(_0xcf25b5,null));};exports[_0x685d('0x43')]=function(_0x5793aa,_0x559fe9){return db[_0x685d('0x3b')]['create'](_0x5793aa[_0x685d('0x44')],{})[_0x685d('0x23')](function(_0x428f35){var _0x23f127=_0x5793aa['user']['get']({'plain':!![]});if(!_0x23f127)throw new Error(_0x685d('0x45'));if(_0x23f127[_0x685d('0x46')]==='user'){var _0x94a524=_0x428f35[_0x685d('0x25')]({'plain':!![]});var _0x4513cc=_0x685d('0x26');return db[_0x685d('0x47')][_0x685d('0x48')]({'where':{'name':_0x4513cc,'userProfileId':_0x23f127[_0x685d('0x49')]},'raw':!![]})[_0x685d('0x23')](function(_0x7ffd57){if(_0x7ffd57&&_0x7ffd57['autoAssociation']===0x0){return db[_0x685d('0x27')]['create']({'name':_0x94a524[_0x685d('0x29')],'resourceId':_0x94a524['id'],'type':_0x7ffd57['name'],'sectionId':_0x7ffd57['id']},{})['then'](function(){return _0x428f35;});}else{return _0x428f35;}})[_0x685d('0x40')](function(_0x2f8404){logger[_0x685d('0x28')](_0x685d('0x4a'),_0x2f8404);throw _0x2f8404;});}return _0x428f35;})[_0x685d('0x23')](respondWithResult(_0x559fe9,0xc9))[_0x685d('0x40')](handleError(_0x559fe9,null));};exports['update']=function(_0x4c5ede,_0x190ff5){if(_0x4c5ede['body']['id']){delete _0x4c5ede['body']['id'];}return db[_0x685d('0x3b')][_0x685d('0x48')]({'where':{'id':_0x4c5ede[_0x685d('0x41')]['id']}})[_0x685d('0x23')](handleEntityNotFound(_0x190ff5,null))[_0x685d('0x23')](saveUpdates(_0x4c5ede[_0x685d('0x44')],null))['then'](respondWithResult(_0x190ff5,null))[_0x685d('0x40')](handleError(_0x190ff5,null));};exports[_0x685d('0x24')]=function(_0x2b9bd5,_0x28cf20){return db['CmCompany'][_0x685d('0x48')]({'where':{'id':_0x2b9bd5[_0x685d('0x41')]['id']}})[_0x685d('0x23')](handleEntityNotFound(_0x28cf20,null))[_0x685d('0x23')](removeEntity(_0x28cf20,null))[_0x685d('0x40')](handleError(_0x28cf20,null));};exports[_0x685d('0x4b')]=function(_0x9e35db,_0x11b2fd){return db[_0x685d('0x3b')][_0x685d('0x4b')]()[_0x685d('0x23')](respondWithResult(_0x11b2fd,null))['catch'](handleError(_0x11b2fd,null));};exports[_0x685d('0x4c')]=function(_0x52c300,_0x15d103,_0xa30c7a){return db[_0x685d('0x4d')]['find']({'where':{'id':_0x52c300[_0x685d('0x41')]['id']}})[_0x685d('0x23')](handleEntityNotFound(_0x15d103,null))[_0x685d('0x23')](function(_0x9d575c){if(_0x9d575c){return _0x9d575c[_0x685d('0x4c')](_0x52c300[_0x685d('0x44')][_0x685d('0x4e')],_['omit'](_0x52c300[_0x685d('0x44')],['ids','id'])||{});}})[_0x685d('0x23')](respondWithResult(_0x15d103,null))[_0x685d('0x40')](handleError(_0x15d103,null));};exports[_0x685d('0x4f')]=function(_0x59cf05,_0x8a33d8,_0x2bd34d){var _0x228f22={};var _0x46d7ec={};var _0x144611;var _0x20b400;return db[_0x685d('0x3b')][_0x685d('0x50')]({'where':{'id':_0x59cf05[_0x685d('0x41')]['id']}})[_0x685d('0x23')](handleEntityNotFound(_0x8a33d8,null))['then'](function(_0x1a16f0){if(_0x1a16f0){_0x144611=_0x1a16f0;_0x46d7ec[_0x685d('0x2e')]=_[_0x685d('0x2c')](db['CmContact'][_0x685d('0x42')]);_0x46d7ec[_0x685d('0x2b')]=_[_0x685d('0x2c')](_0x59cf05['query']);_0x46d7ec[_0x685d('0x2d')]=_[_0x685d('0x30')](_0x46d7ec['model'],_0x46d7ec[_0x685d('0x2b')]);_0x228f22[_0x685d('0x2f')]=_[_0x685d('0x30')](_0x46d7ec[_0x685d('0x2e')],qs['fields'](_0x59cf05[_0x685d('0x2b')]['fields']));_0x228f22[_0x685d('0x2f')]=_0x228f22[_0x685d('0x2f')]['length']?_0x228f22[_0x685d('0x2f')]:_0x46d7ec[_0x685d('0x2e')];_0x228f22[_0x685d('0x34')]=qs['sort'](_0x59cf05['query'][_0x685d('0x35')]);_0x228f22[_0x685d('0x36')]=qs['filters'](_['pick'](_0x59cf05[_0x685d('0x2b')],_0x46d7ec[_0x685d('0x2d')]));if(_0x59cf05[_0x685d('0x2b')][_0x685d('0x37')]){_0x228f22['where']=_[_0x685d('0x38')](_0x228f22['where'],{'$or':_[_0x685d('0x39')](_0x228f22[_0x685d('0x2f')],function(_0x2454b5){var _0x1eebe6={};_0x1eebe6[_0x2454b5]={'$like':'%'+_0x59cf05[_0x685d('0x2b')][_0x685d('0x37')]+'%'};return _0x1eebe6;})});}_0x228f22=_[_0x685d('0x38')]({},_0x228f22,_0x59cf05[_0x685d('0x3a')]);return _0x144611['getContacts'](_0x228f22);}})[_0x685d('0x23')](function(_0x41d9a7){if(_0x41d9a7){_0x20b400=_0x41d9a7['length'];if(!_0x59cf05['query'][_0x685d('0x33')]('nolimit')){_0x228f22['limit']=qs['limit'](_0x59cf05[_0x685d('0x2b')]['limit']);_0x228f22[_0x685d('0x1d')]=qs[_0x685d('0x1d')](_0x59cf05['query'][_0x685d('0x1d')]);}return _0x144611[_0x685d('0x4f')](_0x228f22);}})[_0x685d('0x23')](function(_0x13a279){if(_0x13a279){return _0x13a279?{'count':_0x20b400,'rows':_0x13a279}:null;}})[_0x685d('0x23')](respondWithResult(_0x8a33d8,null))['catch'](handleError(_0x8a33d8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index f730a08..f13740f 100644 --- a/server/api/cmCompany/cmCompany.model.js +++ b/server/api/cmCompany/cmCompany.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb202=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','util','../../config/logger'];(function(_0x56801d,_0x4a7cef){var _0x4d7a9a=function(_0x34f06b){while(--_0x34f06b){_0x56801d['push'](_0x56801d['shift']());}};_0x4d7a9a(++_0x4a7cef);}(_0xb202,0x77));var _0x2b20=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb202[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require(_0x2b20('0x0'));var logger=require(_0x2b20('0x1'))(_0x2b20('0x2'));var moment=require(_0x2b20('0x3'));var BPromise=require(_0x2b20('0x4'));var rp=require(_0x2b20('0x5'));var fs=require('fs');var path=require(_0x2b20('0x6'));var rimraf=require(_0x2b20('0x7'));var config=require(_0x2b20('0x8'));var attributes=require('./cmCompany.attributes');module[_0x2b20('0x9')]=function(_0x401ce8,_0x47f5a8){return _0x401ce8[_0x2b20('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd84=['../../config/logger','api','moment','bluebird','request-promise','path','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util'];(function(_0xbec8e6,_0x2841b5){var _0x4aa6f2=function(_0x583a0a){while(--_0x583a0a){_0xbec8e6['push'](_0xbec8e6['shift']());}};_0x4aa6f2(++_0x2841b5);}(_0xdd84,0x142));var _0x4dd8=function(_0x52f446,_0x2ff43d){_0x52f446=_0x52f446-0x0;var _0x55b4bb=_0xdd84[_0x52f446];return _0x55b4bb;};'use strict';var _=require(_0x4dd8('0x0'));var util=require(_0x4dd8('0x1'));var logger=require(_0x4dd8('0x2'))(_0x4dd8('0x3'));var moment=require(_0x4dd8('0x4'));var BPromise=require(_0x4dd8('0x5'));var rp=require(_0x4dd8('0x6'));var fs=require('fs');var path=require(_0x4dd8('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4dd8('0x8'));module['exports']=function(_0x20b76d,_0x2564dd){return _0x20b76d[_0x4dd8('0x9')](_0x4dd8('0xa'),attributes,{'tableName':_0x4dd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index f9103b8..02c605d 100644 --- a/server/api/cmCompany/cmCompany.rpc.js +++ b/server/api/cmCompany/cmCompany.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00c6=['error','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x00c6,0x1a8));var _0x600c=function(_0x23d923,_0x2850db){_0x23d923=_0x23d923-0x0;var _0x469b7e=_0x00c6[_0x23d923];return _0x469b7e;};'use strict';var _=require(_0x600c('0x0'));var util=require('util');var moment=require(_0x600c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x600c('0x2'));var db=require(_0x600c('0x3'))['db'];var utils=require(_0x600c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x600c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x600c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593221,_0x2c048c,_0x539001){return new BPromise(function(_0x268221,_0x2a7df7){return client[_0x600c('0x7')](_0x593221,_0x539001)['then'](function(_0x20514a){logger['info'](_0x600c('0x8'),_0x2c048c,_0x600c('0x9'));logger[_0x600c('0xa')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x2c048c,_0x600c('0x9'),JSON['stringify'](_0x20514a));if(_0x20514a[_0x600c('0xb')]){if(_0x20514a[_0x600c('0xb')]['code']===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x2c048c,_0x20514a[_0x600c('0xb')]['message']);return _0x2a7df7(_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);}logger[_0x600c('0xb')](_0x600c('0x8'),_0x2c048c,_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);return _0x268221(_0x20514a[_0x600c('0xb')][_0x600c('0xc')]);}else{logger[_0x600c('0xd')](_0x600c('0x8'),_0x2c048c,_0x600c('0x9'));_0x268221(_0x20514a['result'][_0x600c('0xc')]);}})[_0x600c('0xe')](function(_0xa4e625){logger[_0x600c('0xb')]('CmCompany,\x20%s,\x20%s',_0x2c048c,_0xa4e625);_0x2a7df7(_0xa4e625);});});} \ No newline at end of file +var _0xde6d=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util'];(function(_0x3211ca,_0x247ddb){var _0x346472=function(_0x49d954){while(--_0x49d954){_0x3211ca['push'](_0x3211ca['shift']());}};_0x346472(++_0x247ddb);}(_0xde6d,0xc7));var _0xdde6=function(_0x9ea6a5,_0x5693e8){_0x9ea6a5=_0x9ea6a5-0x0;var _0x466c3b=_0xde6d[_0x9ea6a5];return _0x466c3b;};'use strict';var _=require('lodash');var util=require(_0xdde6('0x0'));var moment=require(_0xdde6('0x1'));var BPromise=require(_0xdde6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdde6('0x3'));var db=require(_0xdde6('0x4'))['db'];var utils=require(_0xdde6('0x5'));var logger=require(_0xdde6('0x6'))('rpc');var config=require(_0xdde6('0x7'));var jayson=require(_0xdde6('0x8'));var client=jayson['client'][_0xdde6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1decde,_0x16f4d3,_0xae28bf){return new BPromise(function(_0x39fb3f,_0x1e0854){return client[_0xdde6('0xa')](_0x1decde,_0xae28bf)['then'](function(_0x369e1d){logger[_0xdde6('0xb')](_0xdde6('0xc'),_0x16f4d3,'request\x20sent');logger['debug'](_0xdde6('0xd'),_0x16f4d3,_0xdde6('0xe'),JSON[_0xdde6('0xf')](_0x369e1d));if(_0x369e1d[_0xdde6('0x10')]){if(_0x369e1d[_0xdde6('0x10')]['code']===0x1f4){logger[_0xdde6('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f4d3,_0x369e1d['error'][_0xdde6('0x11')]);return _0x1e0854(_0x369e1d[_0xdde6('0x10')]['message']);}logger[_0xdde6('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f4d3,_0x369e1d[_0xdde6('0x10')][_0xdde6('0x11')]);return _0x39fb3f(_0x369e1d[_0xdde6('0x10')][_0xdde6('0x11')]);}else{logger[_0xdde6('0xb')](_0xdde6('0xc'),_0x16f4d3,_0xdde6('0xe'));_0x39fb3f(_0x369e1d[_0xdde6('0x12')][_0xdde6('0x11')]);}})[_0xdde6('0x13')](function(_0x5db37a){logger[_0xdde6('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f4d3,_0x5db37a);_0x1e0854(_0x5db37a);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8735013..f3557e2 100644 --- a/server/api/cmCompany/index.js +++ b/server/api/cmCompany/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d63=['/:id/contacts','post','create','addContacts','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x4b7730,_0x160b00){var _0x4f0285=function(_0xd1b8e1){while(--_0xd1b8e1){_0x4b7730['push'](_0x4b7730['shift']());}};_0x4f0285(++_0x160b00);}(_0x4d63,0xee));var _0x34d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4d63[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x34d6('0x0'));var util=require('util');var path=require(_0x34d6('0x1'));var timeout=require('connect-timeout');var express=require(_0x34d6('0x2'));var router=express[_0x34d6('0x3')]();var fs_extra=require(_0x34d6('0x4'));var auth=require(_0x34d6('0x5'));var interaction=require(_0x34d6('0x6'));var config=require(_0x34d6('0x7'));var controller=require(_0x34d6('0x8'));router[_0x34d6('0x9')]('/',auth[_0x34d6('0xa')](),controller[_0x34d6('0xb')]);router[_0x34d6('0x9')](_0x34d6('0xc'),auth[_0x34d6('0xa')](),controller['describe']);router[_0x34d6('0x9')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0xe')]);router[_0x34d6('0x9')](_0x34d6('0xf'),auth['isAuthenticated'](),controller['getContacts']);router[_0x34d6('0x10')]('/',auth[_0x34d6('0xa')](),controller[_0x34d6('0x11')]);router[_0x34d6('0x10')](_0x34d6('0xf'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x12')]);router[_0x34d6('0x13')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x14')]);router[_0x34d6('0x15')](_0x34d6('0xd'),auth[_0x34d6('0xa')](),controller[_0x34d6('0x16')]);module['exports']=router; \ No newline at end of file +var _0x4a1c=['delete','/:id','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','describe','isAuthenticated','getContacts','post','/:id/contacts','addContacts','update'];(function(_0x4644ab,_0x350e77){var _0x2fe9cf=function(_0x1f5d8f){while(--_0x1f5d8f){_0x4644ab['push'](_0x4644ab['shift']());}};_0x2fe9cf(++_0x350e77);}(_0x4a1c,0x1d1));var _0xc4a1=function(_0xd8f7bd,_0x45dc8c){_0xd8f7bd=_0xd8f7bd-0x0;var _0x1bd5ee=_0x4a1c[_0xd8f7bd];return _0x1bd5ee;};'use strict';var multer=require(_0xc4a1('0x0'));var util=require(_0xc4a1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4a1('0x2'));var router=express[_0xc4a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc4a1('0x4'));var interaction=require(_0xc4a1('0x5'));var config=require(_0xc4a1('0x6'));var controller=require(_0xc4a1('0x7'));router[_0xc4a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4a1('0x9')]);router[_0xc4a1('0x8')](_0xc4a1('0xa'),auth['isAuthenticated'](),controller[_0xc4a1('0xb')]);router[_0xc4a1('0x8')]('/:id',auth[_0xc4a1('0xc')](),controller['show']);router[_0xc4a1('0x8')]('/:id/contacts',auth[_0xc4a1('0xc')](),controller[_0xc4a1('0xd')]);router[_0xc4a1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc4a1('0xf'),auth[_0xc4a1('0xc')](),controller[_0xc4a1('0x10')]);router['put']('/:id',auth[_0xc4a1('0xc')](),controller[_0xc4a1('0x11')]);router[_0xc4a1('0x12')](_0xc4a1('0x13'),auth[_0xc4a1('0xc')](),controller[_0xc4a1('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index dcfb0de..4566532 100644 --- a/server/api/cmContact/cmContact.attributes.js +++ b/server/api/cmContact/cmContact.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0a9=['INTEGER','UNSIGNED','DATE','lodash','sequelize','STRING','TEXT'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd0a9,0x15a));var _0x9d0a=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xd0a9[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x9d0a('0x0'));var Sequelize=require(_0x9d0a('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x9d0a('0x2')]},'street':{'type':Sequelize[_0x9d0a('0x2')]},'postalCode':{'type':Sequelize[_0x9d0a('0x2')]},'city':{'type':Sequelize[_0x9d0a('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d0a('0x3')]},'phone':{'type':Sequelize[_0x9d0a('0x2')]},'mobile':{'type':Sequelize[_0x9d0a('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9d0a('0x2')]},'url':{'type':Sequelize[_0x9d0a('0x2')]},'facebook':{'type':Sequelize[_0x9d0a('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9d0a('0x2')]},'skype':{'type':Sequelize[_0x9d0a('0x2')]},'teams':{'type':Sequelize[_0x9d0a('0x2')]},'viber':{'type':Sequelize[_0x9d0a('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x9d0a('0x2')]},'telegram':{'type':Sequelize[_0x9d0a('0x2')]},'UserId':{'type':Sequelize[_0x9d0a('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9d0a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9d0a('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x9d0a('0x2')]},'utcOffset':{'type':Sequelize[_0x9d0a('0x4')]}}; \ No newline at end of file +var _0xbb41=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xbb41,0x121));var _0x1bb4=function(_0x1edd1c,_0x44f430){_0x1edd1c=_0x1edd1c-0x0;var _0x16dde7=_0xbb41[_0x1edd1c];return _0x16dde7;};'use strict';var _=require(_0x1bb4('0x0'));var Sequelize=require(_0x1bb4('0x1'));module[_0x1bb4('0x2')]={'firstName':{'type':Sequelize[_0x1bb4('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x1bb4('0x3')]},'street':{'type':Sequelize[_0x1bb4('0x3')]},'postalCode':{'type':Sequelize[_0x1bb4('0x3')]},'city':{'type':Sequelize[_0x1bb4('0x3')]},'country':{'type':Sequelize[_0x1bb4('0x3')]},'dateOfBirth':{'type':Sequelize[_0x1bb4('0x3')]},'description':{'type':Sequelize[_0x1bb4('0x4')]},'phone':{'type':Sequelize[_0x1bb4('0x3')]},'mobile':{'type':Sequelize[_0x1bb4('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1bb4('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x1bb4('0x3')]},'fb_data':{'type':Sequelize[_0x1bb4('0x3')]},'twitter':{'type':Sequelize[_0x1bb4('0x3')]},'skype':{'type':Sequelize[_0x1bb4('0x3')]},'teams':{'type':Sequelize[_0x1bb4('0x3')]},'viber':{'type':Sequelize[_0x1bb4('0x3')]},'line':{'type':Sequelize[_0x1bb4('0x3')]},'wechat':{'type':Sequelize[_0x1bb4('0x3')]},'telegram':{'type':Sequelize[_0x1bb4('0x3')]},'UserId':{'type':Sequelize[_0x1bb4('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x1bb4('0x3')]},'priority':{'type':Sequelize[_0x1bb4('0x5')](0x2)[_0x1bb4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x1bb4('0x7')],'defaultValue':Sequelize[_0x1bb4('0x8')]},'dialTimezone':{'type':Sequelize[_0x1bb4('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 66bffc8..f2a9b33 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eab=['CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','dialTimezone','isNil','utcOffset','timezones','additionalPhones','bulkCreate','each','duplicates','$or','spread','contact','all','show','params','Tag','CmContactHasItem','ContactItemType','ItemType','literal','Phones.OrderBy','$and','CmCustomField','omit','format','cf_%d','pickBy','table','setFields','toParam','phone','rawAttributes','pick','options','getTags','nolimit','setTags','items','item_types','ItemTypeId','description','item','OrderBy','PHONE','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','meta','binding','No\x20phone\x20column\x20specified','firstName','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','message','getJourney','openchannel','fax','whatsapp','-createdAt','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','source','destination','starttime','endtime','note','createdAt','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','VoiceCallReport','findAndCountAll','Website','Account','closed','disposition','secondDisposition','key','Owner','chat','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','mail','subject','substatus','threadId','startCase','flatten','sortBy','slice','moment','bluebird','util','path','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','redis','localhost','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','findOne','trimStart','fieldType','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','parseSearch','sqlOperator','conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','dateOfBirth','datetime','castTo','DATE','buildExpression','text','filter','push','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','where','resolve','role','agent','getLists','c.ListId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','tags','columnName','displayName','analytics','findAll','custom','type','values','body','get','mergeWith','isArray','join','info'];(function(_0x35c514,_0x22bb8a){var _0x448f20=function(_0x54f93a){while(--_0x54f93a){_0x35c514['push'](_0x35c514['shift']());}};_0x448f20(++_0x22bb8a);}(_0x2eab,0x1db));var _0xb2ea=function(_0x33c94c,_0x57a857){_0x33c94c=_0x33c94c-0x0;var _0x22d438=_0x2eab[_0x33c94c];return _0x22d438;};'use strict';var moment=require(_0xb2ea('0x0'));var BPromise=require(_0xb2ea('0x1'));var util=require(_0xb2ea('0x2'));var path=require(_0xb2ea('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Papa=require(_0xb2ea('0x4'));var Redis=require(_0xb2ea('0x5'));var qs=require(_0xb2ea('0x6'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xb2ea('0x7'))(_0xb2ea('0x8'));var config=require(_0xb2ea('0x9'));var shared=require(_0xb2ea('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb2ea('0xb')](config[_0xb2ea('0xc')],{'host':_0xb2ea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmContact.socket')[_0xb2ea('0xe')](socket);function respondWithResult(_0x395274,_0x96ffe8){_0x96ffe8=_0x96ffe8||0xc8;return function(_0x585d1d){if(_0x585d1d){return _0x395274[_0xb2ea('0xf')](_0x96ffe8)[_0xb2ea('0x10')](_0x585d1d);}};}function respondWithFilteredResult(_0x30ae30,_0x4dea96){return function(_0xbbeccc){if(_0xbbeccc){var _0x3e031c=typeof _0x4dea96[_0xb2ea('0x11')]===_0xb2ea('0x12')&&typeof _0x4dea96[_0xb2ea('0x13')]===_0xb2ea('0x12');var _0x600632=_0xbbeccc[_0xb2ea('0x14')];var _0x3f72c5=_0x3e031c?0x0:_0x4dea96[_0xb2ea('0x11')];var _0x5e8e74=_0x3e031c?_0xbbeccc[_0xb2ea('0x14')]:_0x4dea96[_0xb2ea('0x11')]+_0x4dea96[_0xb2ea('0x13')];var _0x3f836f;if(_0x5e8e74>=_0x600632){_0x5e8e74=_0x600632;_0x3f836f=0xc8;}else{_0x3f836f=0xce;}_0x30ae30[_0xb2ea('0xf')](_0x3f836f);return _0x30ae30[_0xb2ea('0x15')](_0xb2ea('0x16'),_0x3f72c5+'-'+_0x5e8e74+'/'+_0x600632)[_0xb2ea('0x10')](_0xbbeccc);}return null;};}function saveUpdates(_0x9ada34){return function(_0x296de4){if(_0x296de4){return _0x296de4[_0xb2ea('0x17')](_0x9ada34)[_0xb2ea('0x18')](function(_0x36476a){return _0x36476a;});}return null;};}function removeEntity(_0x4ac43f){return function(_0x2607ed){if(_0x2607ed){return _0x2607ed[_0xb2ea('0x19')]()[_0xb2ea('0x18')](function(){_0x4ac43f['status'](0xcc)[_0xb2ea('0x1a')]();});}};}function handleEntityNotFound(_0x4cba9e){return function(_0x1ab6c2){if(!_0x1ab6c2){_0x4cba9e['sendStatus'](0x194);}return _0x1ab6c2;};}function handleError(_0x21911e,_0x3e6ffc){_0x3e6ffc=_0x3e6ffc||0x1f4;return function(_0x2b2193){logger[_0xb2ea('0x1b')](_0x2b2193[_0xb2ea('0x1c')]);if(_0x2b2193[_0xb2ea('0x1d')]){delete _0x2b2193['name'];}_0x21911e[_0xb2ea('0xf')](_0x3e6ffc)[_0xb2ea('0x1e')](_0x2b2193);};}exports[_0xb2ea('0x1f')]=function(_0x4c13ce,_0x24d742){var _0x54f3c7={},_0x285873={},_0xf7f768={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()[_0xb2ea('0x18')](function(_0x5a1e05){var _0x189ee9=[];for(var _0x57bbd7=0x0;_0x57bbd70x1){_0x59dfa6['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb2ea('0x5b')](_0x3de1f5),null);}else{if(qs[_0xb2ea('0x5c')](_0x3de1f5)){_0x59dfa6['or'](_0xb2ea('0x5d'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x5e'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x5f'),_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x60'),_0x3de1f5+'%');}else if(qs[_0xb2ea('0x61')](_0x3de1f5)){_0x59dfa6['or'](_0xb2ea('0x62'),_0x3de1f5+'%');}else{_0x59dfa6['or']('c.firstName\x20LIKE\x20?','%'+_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x63'),'%'+_0x3de1f5+'%');_0x59dfa6['or'](_0xb2ea('0x62'),'%'+_0x3de1f5+'%');}}}}_0x20f045['where'](_0x59dfa6);_0x20f045[_0xb2ea('0x64')]('c.id');var _0x3f572f={'type':db[_0xb2ea('0x65')][_0xb2ea('0x66')]['SELECT'],'raw':!![]};var _0x452bcb=_0x20f045[_0xb2ea('0x67')]()[_0xb2ea('0x33')]('c.id');if(_0x54f3c7['order']){_0x54f3c7['order'][_0xb2ea('0x46')](function(_0x376261){_0x20f045[_0xb2ea('0x30')]('c.'+_0x376261[0x0],_0x376261[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x41aa42)){_0x20f045['having'](_0x1addef);_0x452bcb[_0xb2ea('0x68')]('t.id\x20IN\x20?',_0x41aa42);}BPromise[_0xb2ea('0x69')]()[_0xb2ea('0x18')](function(){if(!_0x52dd86)return;if(_0x4c13ce['user'][_0xb2ea('0x6a')]!==_0xb2ea('0x6b'))return;if(!_['some'](_0x52dd86[_0xb2ea('0x41')],[_0xb2ea('0x33'),'User'])){return _0x4c13ce['user'][_0xb2ea('0x6c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5deeb1){if(_[_0xb2ea('0x53')](_0x5deeb1)){_0x452bcb['where']('c.ListId\x20IS\x20NULL');_0x20f045[_0xb2ea('0x68')](_0xb2ea('0x6d'));}else{_0x452bcb[_0xb2ea('0x68')]('c.ListId\x20IN\x20?',_[_0xb2ea('0x45')](_0x5deeb1,'id'));_0x20f045[_0xb2ea('0x68')](_0xb2ea('0x55'),_[_0xb2ea('0x45')](_0x5deeb1,'id'));}});}})['then'](function(){if(_0x4c13ce[_0xb2ea('0x6e')][_0xb2ea('0x6a')]===_0xb2ea('0x6b')&&!_0x52dd86&&!_0x4c13ce[_0xb2ea('0x2a')]['ListId'])return[];return db[_0xb2ea('0x6f')][_0xb2ea('0x2a')](_0x452bcb[_0xb2ea('0x70')](),_0x3f572f);})[_0xb2ea('0x18')](function(_0x24a37a){_0xf7f768[_0xb2ea('0x14')]=_0x24a37a[_0xb2ea('0x23')];if(_0xf7f768[_0xb2ea('0x14')]===0x0)return[];return db['sequelize']['query'](_0xb3247[_0xb2ea('0x70')](),_0x3f572f)[_0xb2ea('0x18')](function(_0x2e7be4){_0x5978b6=_[_0xb2ea('0x71')](_0x2e7be4,'id');_0x3f572f=_[_0xb2ea('0x72')](_0x3f572f,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c13ce['query'][_0xb2ea('0x2e')]){_0x54f3c7['attributes'][_0xb2ea('0x46')](function(_0x3ea8e2){_0x20f045[_0xb2ea('0x33')]('c.'+_0x3ea8e2);});}else{_0x20f045[_0xb2ea('0x33')]('c.id');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x73'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x74'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x75'));_0x20f045[_0xb2ea('0x33')]('c.mobile');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x76'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x77'));_0x20f045[_0xb2ea('0x33')]('c.ListId');_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x78'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x79'));_0x20f045[_0xb2ea('0x33')](_0xb2ea('0x7a'));_0x20f045[_0xb2ea('0x33')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x54f3c7[_0xb2ea('0x13')])_0x20f045[_0xb2ea('0x13')](_0x54f3c7[_0xb2ea('0x13')]);if(_0x54f3c7[_0xb2ea('0x11')])_0x20f045['offset'](_0x54f3c7[_0xb2ea('0x11')]);return db[_0xb2ea('0x6f')][_0xb2ea('0x2a')](_0x20f045[_0xb2ea('0x70')](),_0x3f572f);});})[_0xb2ea('0x18')](function(_0x437f42){_0x437f42['forEach'](function(_0x1e8b21){if(_0x1e8b21[_0xb2ea('0x7b')]){_0x1e8b21[_0xb2ea('0x7c')]=[];_0x1e8b21[_0xb2ea('0x7b')][_0xb2ea('0x44')](',')[_0xb2ea('0x46')](function(_0xa3ce57){_0x1e8b21['Tags'][_0xb2ea('0x52')](_0x5978b6[_0xa3ce57]);});}delete _0x1e8b21[_0xb2ea('0x7b')];});_0xf7f768[_0xb2ea('0x7d')]=_0x437f42;return _0xf7f768;})['then'](respondWithFilteredResult(_0x24d742,_0x54f3c7));})[_0xb2ea('0x7e')](handleError(_0x24d742,null));};exports[_0xb2ea('0x19')]=function(_0x322d61,_0x34fbe1){return db['CmContact'][_0xb2ea('0x42')]({'where':{'id':_0x322d61['params']['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x34fbe1,null))[_0xb2ea('0x18')](removeEntity(_0x34fbe1,null))[_0xb2ea('0x7e')](handleError(_0x34fbe1,null));};exports[_0xb2ea('0x21')]=function(_0x803d3a,_0x264e78){return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()[_0xb2ea('0x18')](function(_0x2c6e71){delete _0x2c6e71[_0xb2ea('0x7f')];for(var _0x46c7a0=0x0;_0x46c7a00x0){return new Promise(function(_0x567baf,_0x3c1b1b){var _0x1b70b0=[];for(var _0x458f46=0x0;_0x458f46<_0x2075ff['length'];_0x458f46++){_0x1b70b0['push'](insertAdditionalPhones(_0x2075ff[_0x458f46][_0xb2ea('0xac')],_0x2075ff[_0x458f46][_0xb2ea('0xa6')]));}Promise[_0xb2ea('0xad')](_0x1b70b0)[_0xb2ea('0x18')](function(){_0x567baf(0x1);});})[_0xb2ea('0x18')](function(){return{'success':_0x363288,'failure':_0x4afde7,'duplicates':_0x58600a};});}else{return{'success':_0x363288,'failure':_0x4afde7,'duplicates':_0x58600a};}}})[_0xb2ea('0x18')](respondWithResult(_0x4f329c,0xc9))[_0xb2ea('0x7e')](handleError(_0x4f329c,null));};exports[_0xb2ea('0xae')]=function(_0x2630fc,_0x3b3265){var _0x2aae49;return db[_0xb2ea('0x20')][_0xb2ea('0x21')]()['then'](function(_0x13a9df){return db[_0xb2ea('0x20')][_0xb2ea('0x42')]({'where':{'id':_0x2630fc[_0xb2ea('0xaf')]['id']},'include':[{'model':db[_0xb2ea('0xb0')],'as':'Tags','attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x34')],'required':_0x2630fc[_0xb2ea('0x2a')][_0xb2ea('0x59')]?!![]:![]},{'model':db[_0xb2ea('0xb1')],'as':'Phones','where':{'CmContactId':_0x2630fc[_0xb2ea('0xaf')]['id']},'required':![],'include':[{'model':db[_0xb2ea('0xb2')],'as':_0xb2ea('0xb3')}]}],'order':[db['sequelize'][_0xb2ea('0xb4')](_0xb2ea('0xb5'))],'attributes':_[_0xb2ea('0x22')](_0x13a9df)});})[_0xb2ea('0x18')](function(_0x78c5c3){if(!_[_0xb2ea('0xa3')](_0x78c5c3)){_0x2aae49=_0x78c5c3[_0xb2ea('0x88')]({'plain':!![]});var _0x11c3ce={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x78c5c3&&_0x78c5c3[_0xb2ea('0x54')]){if(_0x78c5c3[_0xb2ea('0x54')]){_0x11c3ce[_0xb2ea('0x68')][_0xb2ea('0xb6')][_0xb2ea('0x52')]({'ListId':{'$ne':_0x78c5c3['ListId']}});}}return db[_0xb2ea('0xb7')][_0xb2ea('0x83')](_0x11c3ce);}})[_0xb2ea('0x18')](function(_0x86c520){if(!_[_0xb2ea('0xa3')](_0x86c520)){return _[_0xb2ea('0xb8')](_0x2aae49,_[_0xb2ea('0x45')](_0x86c520,function(_0x35bb15){return util[_0xb2ea('0xb9')](_0xb2ea('0xba'),_0x35bb15['id']);}));}})[_0xb2ea('0x18')](handleEntityNotFound(_0x3b3265,null))[_0xb2ea('0x18')](respondWithResult(_0x3b3265,null))['catch'](handleError(_0x3b3265,null));};exports[_0xb2ea('0x17')]=function(_0x21b9ea,_0x52e98c){var _0x21a7bd;if(_0x21b9ea[_0xb2ea('0x87')]['id']){delete _0x21b9ea[_0xb2ea('0x87')]['id'];}if(!_[_0xb2ea('0xa3')](_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa2')])){var _0x180b30=_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa2')];if(!_[_0xb2ea('0xa3')](shared['timezones'][_0x180b30]))_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xa4')]=shared[_0xb2ea('0xa5')][_0x180b30][_0xb2ea('0xa4')];}return db['CmContact']['find']({'where':{'id':_0x21b9ea[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x52e98c,null))[_0xb2ea('0x18')](saveUpdates(_0x21b9ea[_0xb2ea('0x87')],null))[_0xb2ea('0x18')](function(_0xa3f21b){_0x21a7bd=_0xa3f21b;var _0x701ebb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xa3f21b&&_0xa3f21b[_0xb2ea('0x54')]){if(_0xa3f21b['ListId']){_0x701ebb['where']['$and'][_0xb2ea('0x52')]({'ListId':{'$ne':_0xa3f21b[_0xb2ea('0x54')]}});}}return db[_0xb2ea('0xb7')][_0xb2ea('0x83')](_0x701ebb);})[_0xb2ea('0x18')](function(_0x184085){if(_0x184085){return _['omit'](_[_0xb2ea('0xbb')](_0x21b9ea[_0xb2ea('0x87')],function(_0x4a2818,_0x326dbf){return _[_0xb2ea('0x24')](_0x326dbf,_0xb2ea('0x25'));}),_[_0xb2ea('0x45')](_0x184085,function(_0x452613){return util[_0xb2ea('0xb9')]('cf_%d',_0x452613['id']);}));}})[_0xb2ea('0x18')](function(_0x1bb03c){if(_0x1bb03c&&!_[_0xb2ea('0x53')](_0x1bb03c)){var _0x21d6a9=squel[_0xb2ea('0x17')]()[_0xb2ea('0xbc')](_0xb2ea('0x37'))[_0xb2ea('0xbd')](_0x1bb03c)[_0xb2ea('0x68')]('id\x20=\x20?',_0x21b9ea[_0xb2ea('0xaf')]['id'])[_0xb2ea('0xbe')]();return db['sequelize'][_0xb2ea('0x2a')](_0x21d6a9[_0xb2ea('0x50')],{'replacements':_0x21d6a9[_0xb2ea('0x86')]});}})[_0xb2ea('0x18')](function(){if(_0x21b9ea[_0xb2ea('0x87')][_0xb2ea('0xbf')]&&_0x21a7bd){return db['CmHopper'][_0xb2ea('0x17')]({'phone':_0x21b9ea['body'][_0xb2ea('0xbf')],'OrderBy':0x0},{'where':{'ContactId':_0x21a7bd['id']}});}})[_0xb2ea('0x18')](function(){return _0x21a7bd;})[_0xb2ea('0x18')](respondWithResult(_0x52e98c,null))[_0xb2ea('0x7e')](handleError(_0x52e98c,null));};exports['getTags']=function(_0x5267a1,_0x4b4b2b){var _0x236747={};var _0x5b0812={};var _0x2f67cb;var _0x451b59;return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x5267a1[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x4b4b2b,null))['then'](function(_0x3e5de8){if(_0x3e5de8){_0x2f67cb=_0x3e5de8;_0x5b0812['model']=_[_0xb2ea('0x22')](db[_0xb2ea('0xb0')][_0xb2ea('0xc0')]);_0x5b0812[_0xb2ea('0x2a')]=_['keys'](_0x5267a1[_0xb2ea('0x2a')]);_0x5b0812[_0xb2ea('0x2b')]=_['intersection'](_0x5b0812[_0xb2ea('0x29')],_0x5b0812[_0xb2ea('0x2a')]);_0x236747[_0xb2ea('0x2d')]=_['intersection'](_0x5b0812[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x5267a1['query'][_0xb2ea('0x2e')]));_0x236747[_0xb2ea('0x2d')]=_0x236747[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x236747[_0xb2ea('0x2d')]:_0x5b0812[_0xb2ea('0x29')];_0x236747[_0xb2ea('0x30')]=qs[_0xb2ea('0x31')](_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x236747[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x5267a1[_0xb2ea('0x2a')],_0x5b0812[_0xb2ea('0x2b')]));if(_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x236747[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x236747[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x236747[_0xb2ea('0x2d')],function(_0x19a987){var _0x12675e={};_0x12675e[_0x19a987]={'$like':'%'+_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x12675e;})});}_0x236747=_[_0xb2ea('0x72')]({},_0x236747,_0x5267a1[_0xb2ea('0xc2')]);return _0x2f67cb[_0xb2ea('0xc3')](_0x236747);}})[_0xb2ea('0x18')](function(_0x577466){if(_0x577466){_0x451b59=_0x577466[_0xb2ea('0x23')];if(!_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x2f')](_0xb2ea('0xc4'))){_0x236747[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x5267a1[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x236747['offset']=qs[_0xb2ea('0x11')](_0x5267a1['query'][_0xb2ea('0x11')]);}return _0x2f67cb[_0xb2ea('0xc3')](_0x236747);}})[_0xb2ea('0x18')](function(_0x332757){if(_0x332757){return _0x332757?{'count':_0x451b59,'rows':_0x332757}:null;}})[_0xb2ea('0x18')](respondWithResult(_0x4b4b2b,null))[_0xb2ea('0x7e')](handleError(_0x4b4b2b,null));};exports[_0xb2ea('0xc5')]=function(_0x4296b2,_0x592d24){if(_0x4296b2[_0xb2ea('0x87')]['id']){delete _0x4296b2['body']['id'];}return db[_0xb2ea('0x20')][_0xb2ea('0x26')]({'where':{'id':_0x4296b2['params']['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x592d24,null))[_0xb2ea('0x18')](function(_0x1409fe){if(_0x1409fe){return _0x1409fe[_0xb2ea('0xc5')](_0x4296b2[_0xb2ea('0x87')]['ids']||[]);}return null;})[_0xb2ea('0x18')](respondWithResult(_0x592d24,null))[_0xb2ea('0x7e')](handleError(_0x592d24,null));};exports['setAdditionalPhones']=function(_0x52b57f,_0x561864){var _0x5d5075=[];_0x5d5075[_0xb2ea('0x52')](addAdditionalPhones(_0x52b57f['body']));Promise[_0xb2ea('0xad')](_0x5d5075)['then'](function(){_0x5d5075=[];_0x5d5075[_0xb2ea('0x52')](deleteCmHopperPhones(_0x52b57f['body']['id']));_0x5d5075[_0xb2ea('0x52')](addCmHopperPhones(_0x52b57f[_0xb2ea('0x87')]['id']));Promise[_0xb2ea('0xad')](_0x5d5075)[_0xb2ea('0x18')](function(){return[0x1];})[_0xb2ea('0x18')](respondWithResult(_0x561864,null));});};function addAdditionalPhones(_0x15922d){var _0x353d03;return new Promise(function(_0xeab48f,_0x1e9a4d){return db[_0xb2ea('0xb1')]['destroy']({'where':{'CmContactId':_0x15922d['id']}})[_0xb2ea('0x18')](function(){db[_0xb2ea('0xb2')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id','OrderBy']})[_0xb2ea('0x18')](function(_0x190bc4){var _0x49b3ad=[];for(var _0xb0cf74=0x0;_0xb0cf74<_0x15922d[_0xb2ea('0xc6')][_0xb2ea('0x23')];_0xb0cf74++){var _0x235c9b=_0x15922d[_0xb2ea('0xc7')]?_[_0xb2ea('0xa3')](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])?'':_0x15922d[_0xb2ea('0xc7')][_0xb0cf74]:_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc8')]?_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]:'';var _0x3c95bf=_[_0xb2ea('0xa3')](_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc9')])?'':_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc9')];var _0x1a289f=_0x235c9b+':'+_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xbf')]+'§'+_0x3c95bf;if(_[_0xb2ea('0xa3')](_0x353d03))_0x353d03=_0x1a289f;else _0x353d03+=';'+_0x1a289f;var _0x4a129a=null;if(_0x15922d[_0xb2ea('0xc7')]){if(!_[_0xb2ea('0xa3')](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])){var _0x3aabb6=_[_0xb2ea('0x42')](_0x190bc4,function(_0x536584){return _0x536584['id']===_0x15922d[_0xb2ea('0xc7')][_0xb0cf74];});if(!_['isNil'](_0x3aabb6)){_0x4a129a=_0x3aabb6['OrderBy'];}}}else{if(!_[_0xb2ea('0xa3')](_0x15922d['items'][_0xb0cf74])){var _0x3aabb6=_[_0xb2ea('0x42')](_0x190bc4,function(_0x4a01bb){return _0x4a01bb['id']===_0x15922d['items'][_0xb0cf74][_0xb2ea('0xc8')];});if(!_[_0xb2ea('0xa3')](_0x3aabb6)){_0x4a129a=_0xb0cf74;}}}if(_[_0xb2ea('0xa3')](_0x4a129a)){_0x4a129a=0x64;}_0x49b3ad[_0xb2ea('0x52')](addAdditionalPhone(_0x15922d['id'],_0x15922d['items'][_0xb0cf74][_0xb2ea('0xbf')],_0x15922d[_0xb2ea('0xc7')]?_['isNil'](_0x15922d[_0xb2ea('0xc7')][_0xb0cf74])?null:_0x15922d[_0xb2ea('0xc7')][_0xb0cf74]:_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]?_0x15922d[_0xb2ea('0xc6')][_0xb0cf74][_0xb2ea('0xc8')]:null,_0x4a129a,_0x3c95bf));}Promise[_0xb2ea('0xad')](_0x49b3ad)['then'](function(){db[_0xb2ea('0x20')][_0xb2ea('0x17')]({'AdditionalPhones':_0x353d03},{'where':{'id':_0x15922d['id']}})[_0xb2ea('0x18')](function(){_0xeab48f(0x1);});});});});});}function addAdditionalPhone(_0x2954a8,_0x5b76f4,_0x4d94bf,_0x1cc10d,_0x58047d){return db[_0xb2ea('0xb1')][_0xb2ea('0x42')]({'where':{'CmContactId':_0x2954a8,'item':_0x5b76f4}})[_0xb2ea('0x18')](function(_0x360916){if(_0x360916)logger[_0xb2ea('0x8c')]('contact\x20phone\x20exists',_0x360916);else{db[_0xb2ea('0xb1')][_0xb2ea('0x8f')]({'CmContactId':_0x2954a8,'item':_0x5b76f4,'ItemTypeId':_0x4d94bf,'OrderBy':_0x1cc10d,'ItemClass':'PHONE','description':_0x58047d});}});}function deletePhones(_0x4282ae){return db[_0xb2ea('0xb1')][_0xb2ea('0x19')]({'where':{'CmContactId':_0x4282ae}});}function deleteCmHopperPhones(_0x2d6502){return new Promise(function(_0x42ebb7,_0x28cc2c){return db[_0xb2ea('0x8d')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2d6502}})[_0xb2ea('0x18')](function(_0x2ab493){db['CmHopperAdditionalPhone'][_0xb2ea('0x19')]({'where':{'CmHopperId':{'$in':_['map'](_0x2ab493,'id')}}});})[_0xb2ea('0x18')](function(){_0x42ebb7(0x1);});});}function addCmHopperPhones(_0x1cff38){return new Promise(function(_0x565b55,_0x17dffa){return db[_0xb2ea('0x8d')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1cff38}})[_0xb2ea('0x18')](function(_0x512f66){var _0x4e2f65=[];_['map'](_0x512f66,function(_0x2105ef){_0x4e2f65['push'](createCmHopperPhone(_0x1cff38,_0x2105ef['id']));});Promise[_0xb2ea('0xad')](_0x4e2f65)['then'](function(){_0x565b55(0x1);});});});}function createCmHopperPhone(_0x4a8d57,_0x5277da){return new Promise(function(_0xf913d0,_0xb17704){db[_0xb2ea('0xb1')]['findAll']({'raw':!![],'attributes':[_0xb2ea('0xca'),_0xb2ea('0xcb')],'where':{'CmContactId':_0x4a8d57,'ItemClass':_0xb2ea('0xcc')},'include':[{'model':db[_0xb2ea('0xb2')],'attributes':[_0xb2ea('0xcb')],'as':'ItemType'}],'order':['OrderBy',db[_0xb2ea('0x6f')][_0xb2ea('0xb4')]('`ItemType`.OrderBy')]})['then'](function(_0x4353f9){var _0x1fa33d=0x1;var _0x28a940=_['map'](_0x4353f9,function(_0x17bf6e){_0x17bf6e[_0xb2ea('0xcd')]=_0x5277da;_0x17bf6e[_0xb2ea('0xbf')]=_0x17bf6e[_0xb2ea('0xca')];_0x17bf6e[_0xb2ea('0xcb')]=_0x1fa33d;delete _0x17bf6e[_0xb2ea('0xce')];_0x1fa33d=_0x1fa33d+0x1;return _0x17bf6e;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x28a940,{});})[_0xb2ea('0x18')](function(){_0xf913d0(0x1);});});}function insertAdditionalPhones(_0x59b817,_0x483448){return new Promise(function(_0x2b4c66,_0x5da860){var _0x4a7738=[];for(var _0x32684f=0x0;_0x32684f<_0x483448['length'];_0x32684f++){var _0x493a06=_0x483448[_0x32684f];_0x4a7738[_0xb2ea('0x52')](parseContactItemType(_0x493a06));}Promise[_0xb2ea('0xad')](_0x4a7738)[_0xb2ea('0x18')](function(){var _0x1a4ff5={'id':_0x59b817['id'],'items':_0x483448};return addAdditionalPhones(_0x1a4ff5)[_0xb2ea('0x18')](function(_0x17f215){return addCmHopperPhones(_0x59b817['id']);});})['then'](function(){_0x2b4c66(_0x59b817);});});}function parseContactItemType(_0x397b61){return new Promise(function(_0x186812,_0x3816c9){if(_0x397b61['hasOwnProperty'](_0xb2ea('0xc8'))){_0x186812(_0x397b61);}else{return db[_0xb2ea('0xb2')][_0xb2ea('0x42')]({'where':{'name':_0x397b61[_0xb2ea('0xb3')]}})[_0xb2ea('0x18')](function(_0x1b8888){if(_[_0xb2ea('0xa3')](_0x1b8888))_0x397b61[_0xb2ea('0xc8')]=null;else _0x397b61[_0xb2ea('0xc8')]=_0x1b8888['id'];_0x186812(_0x397b61);});}});}exports[_0xb2ea('0xcf')]=function(_0x5f3900,_0x3e7d86){return db[_0xb2ea('0xb1')][_0xb2ea('0x83')]({'raw':!![],'where':{'CmContactId':_0x5f3900[_0xb2ea('0xaf')]['id'],'ItemClass':_0xb2ea('0xcc')},'include':[{'model':db[_0xb2ea('0xb2')],'as':_0xb2ea('0xb3')}],'order':[[_0xb2ea('0xcb')],[db[_0xb2ea('0x6f')][_0xb2ea('0xb4')](_0xb2ea('0xd0'))]]})[_0xb2ea('0x18')](function(_0x593624){return _0x593624;})[_0xb2ea('0x18')](respondWithResult(_0x3e7d86,null))[_0xb2ea('0x7e')](handleError(_0x3e7d86,null));};exports[_0xb2ea('0xd1')]=function(_0x3dc690,_0x4122d3){return db['CmContactHasItem'][_0xb2ea('0x83')]({'raw':!![],'where':{'CmContactId':_0x3dc690[_0xb2ea('0x87')]['fromContactId']}})[_0xb2ea('0x18')](function(_0xbf66a4){var _0xe5bf6d=_[_0xb2ea('0x45')](_0xbf66a4,function(_0x3adf9a){_0x3adf9a[_0xb2ea('0xd2')]=_0x3dc690[_0xb2ea('0x87')][_0xb2ea('0xd3')];return _0x3adf9a;});return db[_0xb2ea('0xb1')]['bulkCreate'](_0xe5bf6d,{});})['then'](function(_0x248cad){return addCmHopperPhones(_0x3dc690[_0xb2ea('0x87')][_0xb2ea('0xd3')]);})[_0xb2ea('0x18')](function(_0x1f76d2){return['ok'];})[_0xb2ea('0x18')](respondWithResult(_0x4122d3,null))[_0xb2ea('0x7e')](handleError(_0x4122d3,null));};exports[_0xb2ea('0xd4')]=function(_0x9f6813,_0x908df0){var _0x46b440=[];_0x46b440['push'](createCmHopperPhone(_0x9f6813[_0xb2ea('0x87')]['id'],_0x9f6813[_0xb2ea('0x87')]['hopperId']));Promise[_0xb2ea('0xad')](_0x46b440)[_0xb2ea('0x18')](function(){return[0x1];})[_0xb2ea('0x18')](respondWithResult(_0x908df0,null));};exports[_0xb2ea('0xd5')]=function(_0x3c5480,_0x1c7b5a){var _0x433346={'raw':![],'where':{}};var _0x1c253c={};var _0x1c6d8e={'count':0x0,'rows':[]};return db['CmContact'][_0xb2ea('0x26')]({'where':{'id':_0x3c5480[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x1c7b5a,null))[_0xb2ea('0x18')](function(_0x49b9da){if(_0x49b9da){_0x1c253c['model']=_[_0xb2ea('0x22')](db[_0xb2ea('0x8d')][_0xb2ea('0xc0')]);_0x1c253c['query']=_[_0xb2ea('0x22')](_0x3c5480[_0xb2ea('0x2a')]);_0x1c253c['filters']=_[_0xb2ea('0x2c')](_0x1c253c[_0xb2ea('0x29')],_0x1c253c[_0xb2ea('0x2a')]);_0x433346['attributes']=_[_0xb2ea('0x2c')](_0x1c253c['model'],qs[_0xb2ea('0x2e')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x433346['attributes']=_0x433346[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x433346['attributes']:_0x1c253c[_0xb2ea('0x29')];if(!_0x3c5480[_0xb2ea('0x2a')]['hasOwnProperty']('nolimit')){_0x433346[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x433346[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x11')]);}_0x433346[_0xb2ea('0x30')]=qs['sort'](_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x433346[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x3c5480[_0xb2ea('0x2a')],_0x1c253c[_0xb2ea('0x2b')]));_0x433346[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x49b9da['id'];if(_0x3c5480[_0xb2ea('0x2a')]['filter']){_0x433346[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x433346['where'],{'$or':_[_0xb2ea('0x45')](_0x433346[_0xb2ea('0x2d')],function(_0x59c150){var _0x48efb5={};_0x48efb5[_0x59c150]={'$like':'%'+_0x3c5480[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x48efb5;})});}_0x433346=_[_0xb2ea('0x72')]({},_0x433346,_0x3c5480['options']);return db['CmHopper'][_0xb2ea('0x14')]({'where':_0x433346[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x2b6b99){_0x1c6d8e[_0xb2ea('0x14')]=_0x2b6b99;if(_0x3c5480['query'][_0xb2ea('0xd7')]){_0x433346[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0x8d')][_0xb2ea('0x83')](_0x433346);})[_0xb2ea('0x18')](function(_0x3623cf){_0x1c6d8e[_0xb2ea('0x7d')]=_0x3623cf;return _0x1c6d8e;});}})[_0xb2ea('0x18')](respondWithFilteredResult(_0x1c7b5a,_0x433346))[_0xb2ea('0x7e')](handleError(_0x1c7b5a,null));};exports[_0xb2ea('0xd9')]=function(_0x3bbfcc,_0x205150){var _0x143edf={'raw':!![],'where':{}};var _0x2d9502={};var _0x301a30={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x3bbfcc[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x205150,null))[_0xb2ea('0x18')](function(_0x3eb17e){if(_0x3eb17e){_0x2d9502[_0xb2ea('0x29')]=_[_0xb2ea('0x22')](db[_0xb2ea('0xda')][_0xb2ea('0xc0')]);_0x2d9502['query']=_[_0xb2ea('0x22')](_0x3bbfcc[_0xb2ea('0x2a')]);_0x2d9502['filters']=_['intersection'](_0x2d9502[_0xb2ea('0x29')],_0x2d9502['query']);_0x143edf['attributes']=_[_0xb2ea('0x2c')](_0x2d9502[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x3bbfcc[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x143edf[_0xb2ea('0x2d')]=_0x143edf[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x143edf[_0xb2ea('0x2d')]:_0x2d9502[_0xb2ea('0x29')];if(!_0x3bbfcc[_0xb2ea('0x2a')]['hasOwnProperty']('nolimit')){_0x143edf[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x3bbfcc['query'][_0xb2ea('0x13')]);_0x143edf[_0xb2ea('0x11')]=qs['offset'](_0x3bbfcc[_0xb2ea('0x2a')]['offset']);}_0x143edf[_0xb2ea('0x30')]=qs['sort'](_0x3bbfcc['query'][_0xb2ea('0x31')]);_0x143edf[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x3bbfcc[_0xb2ea('0x2a')],_0x2d9502[_0xb2ea('0x2b')]));_0x143edf[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x3eb17e['id'];if(_0x3bbfcc[_0xb2ea('0x2a')]['filter']){_0x143edf[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x143edf[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x143edf[_0xb2ea('0x2d')],function(_0x268c79){var _0x221b55={};_0x221b55[_0x268c79]={'$like':'%'+_0x3bbfcc[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x221b55;})});}_0x143edf=_[_0xb2ea('0x72')]({},_0x143edf,_0x3bbfcc[_0xb2ea('0xc2')]);return db[_0xb2ea('0xda')][_0xb2ea('0x14')]({'where':_0x143edf[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x4d0a66){_0x301a30[_0xb2ea('0x14')]=_0x4d0a66;if(_0x3bbfcc['query']['includeAll']){_0x143edf[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0xda')][_0xb2ea('0x83')](_0x143edf);})[_0xb2ea('0x18')](function(_0x2f19d8){_0x301a30[_0xb2ea('0x7d')]=_0x2f19d8;return _0x301a30;});}})[_0xb2ea('0x18')](respondWithFilteredResult(_0x205150,_0x143edf))[_0xb2ea('0x7e')](handleError(_0x205150,null));};exports[_0xb2ea('0xdb')]=function(_0x17b34d,_0x500f2c){var _0x55e99d={'raw':!![],'where':{}};var _0x4e4b34={};var _0x356390={'count':0x0,'rows':[]};return db[_0xb2ea('0x20')]['findOne']({'where':{'id':_0x17b34d[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x500f2c,null))[_0xb2ea('0x18')](function(_0x274a01){if(_0x274a01){_0x4e4b34[_0xb2ea('0x29')]=_['keys'](db[_0xb2ea('0x9a')][_0xb2ea('0xc0')]);_0x4e4b34[_0xb2ea('0x2a')]=_[_0xb2ea('0x22')](_0x17b34d['query']);_0x4e4b34['filters']=_['intersection'](_0x4e4b34['model'],_0x4e4b34[_0xb2ea('0x2a')]);_0x55e99d[_0xb2ea('0x2d')]=_[_0xb2ea('0x2c')](_0x4e4b34[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x2e')]));_0x55e99d[_0xb2ea('0x2d')]=_0x55e99d[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x55e99d['attributes']:_0x4e4b34[_0xb2ea('0x29')];if(!_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x2f')]('nolimit')){_0x55e99d[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x55e99d[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x17b34d[_0xb2ea('0x2a')]['offset']);}_0x55e99d['order']=qs[_0xb2ea('0x31')](_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x55e99d[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x17b34d[_0xb2ea('0x2a')],_0x4e4b34['filters']));_0x55e99d[_0xb2ea('0x68')][_0xb2ea('0xd6')]=_0x274a01['id'];if(_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x55e99d[_0xb2ea('0x68')]=_['merge'](_0x55e99d[_0xb2ea('0x68')],{'$or':_['map'](_0x55e99d['attributes'],function(_0x10bd66){var _0x30be13={};_0x30be13[_0x10bd66]={'$like':'%'+_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0x51')]+'%'};return _0x30be13;})});}_0x55e99d=_['merge']({},_0x55e99d,_0x17b34d['options']);return db[_0xb2ea('0x9a')][_0xb2ea('0x14')]({'where':_0x55e99d[_0xb2ea('0x68')]})[_0xb2ea('0x18')](function(_0x28b15b){_0x356390[_0xb2ea('0x14')]=_0x28b15b;if(_0x17b34d[_0xb2ea('0x2a')][_0xb2ea('0xd7')]){_0x55e99d['include']=[{'all':!![]}];}return db[_0xb2ea('0x9a')][_0xb2ea('0x83')](_0x55e99d);})[_0xb2ea('0x18')](function(_0x59f029){_0x356390['rows']=_0x59f029;return _0x356390;});}})['then'](respondWithFilteredResult(_0x500f2c,_0x55e99d))[_0xb2ea('0x7e')](handleError(_0x500f2c,null));};exports[_0xb2ea('0xdc')]=function(_0x18ed9f,_0x52dac0){var _0x2a59d2={'raw':!![],'where':{}};var _0x8a1f97={};var _0x224759={'count':0x0,'rows':[]};return db['CmContact'][_0xb2ea('0x26')]({'where':{'id':_0x18ed9f[_0xb2ea('0xaf')]['id']}})[_0xb2ea('0x18')](handleEntityNotFound(_0x52dac0,null))['then'](function(_0x594bee){if(_0x594bee){_0x8a1f97[_0xb2ea('0x29')]=_[_0xb2ea('0x22')](db[_0xb2ea('0x9f')]['rawAttributes']);_0x8a1f97[_0xb2ea('0x2a')]=_['keys'](_0x18ed9f[_0xb2ea('0x2a')]);_0x8a1f97[_0xb2ea('0x2b')]=_[_0xb2ea('0x2c')](_0x8a1f97['model'],_0x8a1f97[_0xb2ea('0x2a')]);_0x2a59d2['attributes']=_['intersection'](_0x8a1f97[_0xb2ea('0x29')],qs[_0xb2ea('0x2e')](_0x18ed9f['query'][_0xb2ea('0x2e')]));_0x2a59d2['attributes']=_0x2a59d2[_0xb2ea('0x2d')][_0xb2ea('0x23')]?_0x2a59d2[_0xb2ea('0x2d')]:_0x8a1f97[_0xb2ea('0x29')];if(!_0x18ed9f[_0xb2ea('0x2a')]['hasOwnProperty'](_0xb2ea('0xc4'))){_0x2a59d2[_0xb2ea('0x13')]=qs[_0xb2ea('0x13')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x13')]);_0x2a59d2[_0xb2ea('0x11')]=qs[_0xb2ea('0x11')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x11')]);}_0x2a59d2[_0xb2ea('0x30')]=qs[_0xb2ea('0x31')](_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x31')]);_0x2a59d2[_0xb2ea('0x68')]=qs[_0xb2ea('0x2b')](_[_0xb2ea('0xc1')](_0x18ed9f[_0xb2ea('0x2a')],_0x8a1f97[_0xb2ea('0x2b')]));_0x2a59d2[_0xb2ea('0x68')]['ContactId']=_0x594bee['id'];if(_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0x51')]){_0x2a59d2[_0xb2ea('0x68')]=_[_0xb2ea('0x72')](_0x2a59d2[_0xb2ea('0x68')],{'$or':_[_0xb2ea('0x45')](_0x2a59d2[_0xb2ea('0x2d')],function(_0x1090ae){var _0x94bd5={};_0x94bd5[_0x1090ae]={'$like':'%'+_0x18ed9f[_0xb2ea('0x2a')]['filter']+'%'};return _0x94bd5;})});}_0x2a59d2=_['merge']({},_0x2a59d2,_0x18ed9f[_0xb2ea('0xc2')]);return db[_0xb2ea('0x9f')][_0xb2ea('0x14')]({'where':_0x2a59d2['where']})[_0xb2ea('0x18')](function(_0x4e8b30){_0x224759[_0xb2ea('0x14')]=_0x4e8b30;if(_0x18ed9f[_0xb2ea('0x2a')][_0xb2ea('0xd7')]){_0x2a59d2[_0xb2ea('0xd8')]=[{'all':!![]}];}return db[_0xb2ea('0x9f')][_0xb2ea('0x83')](_0x2a59d2);})[_0xb2ea('0x18')](function(_0x2f69a7){_0x224759[_0xb2ea('0x7d')]=_0x2f69a7;return _0x224759;});}})['then'](respondWithFilteredResult(_0x52dac0,_0x2a59d2))[_0xb2ea('0x7e')](handleError(_0x52dac0,null));};exports['uploadCsv']=function(_0x276798,_0x48db2e){try{if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x54')]){throw new Error(_0xb2ea('0xdd'));}if(!_0x276798[_0xb2ea('0x87')]['binding_keys']){throw new Error(_0xb2ea('0xde'));}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0xdf')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x3b0013=_0x276798['body'][_0xb2ea('0xe2')][_0xb2ea('0x44')](',');var _0x13163e=_0x276798[_0xb2ea('0x87')][_0xb2ea('0xdf')]['split'](',');if(!_0x3b0013[_0xb2ea('0x23')]||!_0x13163e['length']||_0x3b0013[_0xb2ea('0x23')]!==_0x13163e[_0xb2ea('0x23')]){throw new Error(_0xb2ea('0xe3'));}_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')]=_['zipObject'](_0x3b0013,_0x13163e);if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')][_0xb2ea('0xbf')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x276798[_0xb2ea('0x87')][_0xb2ea('0x2e')]['firstName']){throw new Error(_0xb2ea('0xe4'));}var _0x574e0a=path[_0xb2ea('0x8b')](config[_0xb2ea('0xe5')],_0xb2ea('0xe6'),_0x276798[_0xb2ea('0xe7')][_0xb2ea('0xe8')]);fs[_0xb2ea('0xe9')](_0x574e0a,parseInt('0777',0x8));var _0x297b67=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xec')),[_0x574e0a,_0x276798['body'][_0xb2ea('0xe2')],_0x276798['body']['binding_values'],_0x276798[_0xb2ea('0x87')]['ListId'],_0x276798[_0xb2ea('0x87')][_0xb2ea('0xed')],_0x276798[_0xb2ea('0x87')][_0xb2ea('0xa9')],_0x276798['body']['socket_timestamp']]);return _0x48db2e[_0xb2ea('0xf')](0xc8)[_0xb2ea('0x10')]({'message':_0xb2ea('0xee'),'pid':_0x297b67['pid']});}catch(_0x2ea371){return _0x48db2e['status'](0x1f4)[_0xb2ea('0x1e')](_0x2ea371);}};exports[_0xb2ea('0xef')]=function(_0x1eca13,_0x1a35e9){var _0x14fd2d=fs[_0xb2ea('0xf0')](_0x1eca13[_0xb2ea('0xe7')][_0xb2ea('0x3')]);Papa['parse'](_0x14fd2d,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x13fb42){return _0x1a35e9['status'](0xc8)['json']({'file':_0x1eca13[_0xb2ea('0xe7')],'fields':_0x13fb42[_0xb2ea('0xf1')][_0xb2ea('0x2e')]});}});};exports['import']=function(_0x424975,_0x1d22e4){return db['User'][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2ea('0x6b')}})['then'](function(_0x5ba2a){var _0x913f2=![];if(!_0x424975[_0xb2ea('0x87')]['ListId']){throw new Error(_0xb2ea('0xdd'));}if(!_0x424975[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xbf')]){throw new Error(_0xb2ea('0xf3'));}if(!_0x424975[_0xb2ea('0x87')]['binding'][_0xb2ea('0xf4')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x424975[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x57c297=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xf5')),[_0x424975[_0xb2ea('0xaf')]['id'],JSON[_0xb2ea('0xf6')](_0x424975[_0xb2ea('0x87')]),JSON[_0xb2ea('0xf6')](_0x5ba2a)]);_0x57c297['on']('message',function(){_0x913f2=!![];return _0x1d22e4[_0xb2ea('0xf')](0xc8)['json']({'message':_0xb2ea('0xf7'),'pid':_0x57c297[_0xb2ea('0xf8')]});});_0x57c297['on'](_0xb2ea('0xf9'),function(_0x793008){if(_0x793008&&!_0x913f2){return _0x1d22e4[_0xb2ea('0xf')](0x1f4)['json']({'message':_0xb2ea('0xfa'),'pid':_0x57c297[_0xb2ea('0xf8')]});}});})['catch'](handleError(_0x1d22e4,null));};exports[_0xb2ea('0xfb')]=function(_0x52ae5b,_0x698ed8,_0x2fe458){return db[_0xb2ea('0x49')][_0xb2ea('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb2ea('0x6b')}})[_0xb2ea('0x18')](function(_0x55651f){var _0x59b19d=![];if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0x54')]){throw new Error(_0xb2ea('0xdd'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xbf')]){throw new Error(_0xb2ea('0xf3'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xf2')][_0xb2ea('0xf4')]){throw new Error(_0xb2ea('0xe4'));}if(!_0x52ae5b[_0xb2ea('0x87')][_0xb2ea('0xe0')]){throw new Error(_0xb2ea('0xe1'));}var _0x585a12=require(_0xb2ea('0xea'))[_0xb2ea('0xeb')](path[_0xb2ea('0x8b')](__dirname,_0xb2ea('0xfc')),[_0x52ae5b[_0xb2ea('0xaf')]['id'],JSON[_0xb2ea('0xf6')](_0x52ae5b['body']),JSON[_0xb2ea('0xf6')](_0x55651f)]);_0x585a12['on'](_0xb2ea('0xfd'),function(_0x18cd0e){_0x59b19d=!![];return _0x698ed8[_0xb2ea('0xf')](0xc8)[_0xb2ea('0x10')]({'message':_0xb2ea('0xf7'),'pid':_0x585a12[_0xb2ea('0xf8')]});});_0x585a12['on'](_0xb2ea('0xf9'),function(_0x46edd8){if(_0x46edd8&&!_0x59b19d){return _0x698ed8[_0xb2ea('0xf')](0x1f4)[_0xb2ea('0x10')]({'message':_0xb2ea('0xfa'),'pid':_0x585a12[_0xb2ea('0xf8')]});}});})[_0xb2ea('0x7e')](handleError(_0x698ed8,null));};exports[_0xb2ea('0xfe')]=function(_0x7497ae,_0x42129e){var _0x3f031c=['mail','chat','sms',_0xb2ea('0xff'),_0xb2ea('0x100'),_0xb2ea('0x101'),'voice'];var _0x191f79={'offset':0x0,'order':qs[_0xb2ea('0x31')](_0xb2ea('0x102'))},_0x2a3bbf={'count':0x0,'rows':[]};Promise['resolve']()[_0xb2ea('0x18')](function(){if(_0x7497ae['query'][_0xb2ea('0x103')]){if(!_['includes'](_0x3f031c,_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x103')][_0xb2ea('0x104')]())){throw new Error(_0xb2ea('0x105'));}_0x3f031c=[_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x103')][_0xb2ea('0x104')]()];}if(_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x106')]){try{var _0x62ed5a=JSON[_0xb2ea('0x107')](_0x7497ae['query'][_0xb2ea('0x106')]);if(!moment(_0x62ed5a[_0xb2ea('0x35')])[_0xb2ea('0x108')]()){throw new Error(_0xb2ea('0x109'));}if(!moment(_0x62ed5a['to'])[_0xb2ea('0x108')]()){throw new Error(_0xb2ea('0x10a'));}}catch(_0x175298){throw new Error(_0xb2ea('0x10b'));}}if(!_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x2f')]('nolimit')){_0x191f79['limit']=qs[_0xb2ea('0x13')](_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x13')]||0xa);_0x191f79['offset']=qs[_0xb2ea('0x11')](_0x7497ae[_0xb2ea('0x2a')]['offset']);}var _0xda6b5=_0x3f031c[_0xb2ea('0x45')](function(_0x5e5c0b){if(_0x5e5c0b===_0xb2ea('0x10c')){var _0xdee49={'attributes':['id',_0xb2ea('0x10d'),_0xb2ea('0x85'),_0xb2ea('0x10e'),_0xb2ea('0x10f'),'callerid',_0xb2ea('0x110'),_0xb2ea('0x111'),'duration',_0xb2ea('0x112'),_0xb2ea('0x113'),'userDisposition',_0xb2ea('0x114'),_0xb2ea('0x115'),_0xb2ea('0x116')],'where':{'ContactId':_0x7497ae[_0xb2ea('0xaf')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x117'),_0xb2ea('0x118')]}],'order':[[_0xb2ea('0x113'),_0xb2ea('0x119')]]};if(_0x7497ae['query'][_0xb2ea('0x106')]){_0xdee49[_0xb2ea('0x68')]['createdAt']={'$gte':_0x62ed5a[_0xb2ea('0x35')],'$lte':_0x62ed5a['to']};}return db[_0xb2ea('0x11a')][_0xb2ea('0x11b')](_0xdee49)[_0xb2ea('0x18')](function(_0x28c917){_0x2a3bbf['count']+=_0x28c917['count'];return _[_0xb2ea('0x45')](_0x28c917[_0xb2ea('0x7d')],function(_0x6c3bf8){var _0x69f6ce=_0x6c3bf8[_0xb2ea('0x88')]({'plain':!![]});_0x69f6ce['channel']=_0x5e5c0b;if(_0x69f6ce[_0xb2ea('0x49')]){_0x69f6ce['User']={'id':_0x69f6ce['User']['id'],'name':_0x69f6ce[_0xb2ea('0x49')]['name'],'fullname':_0x69f6ce[_0xb2ea('0x49')]['fullname'],'alias':_0x69f6ce['User'][_0xb2ea('0x118')]};}return _0x69f6ce;});});}else{var _0x23f537=_['startCase'](_0x5e5c0b)+(_0x5e5c0b==='chat'?_0xb2ea('0x11c'):_0xb2ea('0x11d'));var _0x21f9a2={'attributes':['id',_0xb2ea('0x11e'),'closedAt',_0xb2ea('0x113'),_0xb2ea('0x112'),_0xb2ea('0x11f'),_0xb2ea('0x120'),'thirdDisposition','UserId',_0x23f537+'Id'],'where':{'ContactId':_0x7497ae[_0xb2ea('0xaf')]['id']},'include':[{'model':db[_0x23f537],'as':_0xb2ea('0x11d'),'attributes':['id','name',_0xb2ea('0x121')]},{'model':db[_0xb2ea('0x49')],'as':_0xb2ea('0x122'),'attributes':['id',_0xb2ea('0x1d'),_0xb2ea('0x117')]},{'model':db[_0xb2ea('0xb0')],'as':_0xb2ea('0x7c'),'attributes':['id',_0xb2ea('0x1d'),'color'],'through':{'attributes':[]}}],'order':[['createdAt',_0xb2ea('0x119')]]};if(_0x7497ae[_0xb2ea('0x2a')][_0xb2ea('0x106')]){_0x21f9a2['where'][_0xb2ea('0x113')]={'$gte':_0x62ed5a[_0xb2ea('0x35')],'$lte':_0x62ed5a['to']};}switch(_0x5e5c0b){case _0xb2ea('0x123'):_0x21f9a2[_0xb2ea('0x2d')][_0xb2ea('0x52')](_0xb2ea('0x124'),_0xb2ea('0x125'),_0xb2ea('0x126'),_0xb2ea('0x127'),_0xb2ea('0x128'),_0xb2ea('0x129'),'ratingType',_0xb2ea('0x12a'),_0xb2ea('0x12b'));break;case _0xb2ea('0x12c'):_0x21f9a2[_0xb2ea('0x2d')][_0xb2ea('0x52')](_0xb2ea('0x12d'),_0xb2ea('0x12e'));break;case _0xb2ea('0xff'):_0x21f9a2[_0xb2ea('0x2d')]['push']('externalUrl',_0xb2ea('0x12f'));break;}return db[_[_0xb2ea('0x130')](_0x5e5c0b)+'Interaction'][_0xb2ea('0x11b')](_0x21f9a2)['then'](function(_0x2e9fe5){_0x2a3bbf[_0xb2ea('0x14')]+=_0x2e9fe5[_0xb2ea('0x14')];return _[_0xb2ea('0x45')](_0x2e9fe5[_0xb2ea('0x7d')],function(_0x244d65){var _0x32ca48=_0x244d65['get']({'plain':!![]});_0x32ca48[_0xb2ea('0x103')]=_0x5e5c0b;if(_0x32ca48[_0xb2ea('0x122')]){_0x32ca48[_0xb2ea('0x122')]={'id':_0x32ca48[_0xb2ea('0x122')]['id'],'name':_0x32ca48[_0xb2ea('0x122')]['name'],'fullname':_0x32ca48['Owner'][_0xb2ea('0x117')]};}return _0x32ca48;});});}});return Promise[_0xb2ea('0xad')](_0xda6b5);})[_0xb2ea('0x18')](function(_0x51f872){return _(_0x51f872)[_0xb2ea('0x131')]()[_0xb2ea('0x132')](_0xb2ea('0x113'))['reverse']()[_0xb2ea('0x43')]();})[_0xb2ea('0x18')](function(_0x2d71d1){_0x2a3bbf[_0xb2ea('0x7d')]=_0x191f79[_0xb2ea('0x13')]?_0x2d71d1[_0xb2ea('0x133')](_0x191f79[_0xb2ea('0x11')],_0x191f79[_0xb2ea('0x11')]+_0x191f79[_0xb2ea('0x13')]):_0x2d71d1;return _0x2a3bbf;})['then'](respondWithFilteredResult(_0x42129e,_0x191f79))[_0xb2ea('0x7e')](handleError(_0x42129e,null));}; \ No newline at end of file +var _0x37f1=['CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','spread','contact','show','params','Tag','Phones','ItemType','Phones.OrderBy','$and','omit','format','pickBy','cf_%d','table','setFields','id\x20=\x20?','toParam','values','CmHopper','phone','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ContactItemType','literal','`ItemType`.OrderBy','CmHopperId','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','file','meta','import','binding','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','sms','openchannel','voice','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','starttime','endtime','note','userDisposition','userThirdDisposition','UserId','fullname','DESC','startCase','Website','Account','closed','closedAt','createdAt','disposition','secondDisposition','thirdDisposition','Owner','chat','browserName','customerIp','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','Interaction','findAndCountAll','sortBy','reverse','slice','bluebird','lodash','squel','ioredis','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','localhost','socket.io-emitter','redis','json','offset','limit','undefined','count','status','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','push','findOne','all','fieldType','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','cm_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','text','start','map','hasOwnProperty','filter','isNil','Contact','forEach','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','clone','isEmpty','having','t.id\x20IN\x20?','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','ListId','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','columnName','analytics','CmCustomField','displayName','alias','custom','body','findAll','get','mergeWith','join','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem'];(function(_0x13a621,_0x29b45c){var _0x19c55d=function(_0x5b2876){while(--_0x5b2876){_0x13a621['push'](_0x13a621['shift']());}};_0x19c55d(++_0x29b45c);}(_0x37f1,0x9c));var _0x137f=function(_0x4a1b58,_0x460b36){_0x4a1b58=_0x4a1b58-0x0;var _0x55555d=_0x37f1[_0x4a1b58];return _0x55555d;};'use strict';var moment=require('moment');var BPromise=require(_0x137f('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x137f('0x1'));var squel=require(_0x137f('0x2'));var Papa=require('papaparse');var Redis=require(_0x137f('0x3'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x137f('0x4'))('api');var config=require(_0x137f('0x5'));var shared=require(_0x137f('0x6'));var db=require(_0x137f('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x137f('0x8'),'port':0x18eb});var socket=require(_0x137f('0x9'))(new Redis(config[_0x137f('0xa')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x2fec1c,_0x2568b1){_0x2568b1=_0x2568b1||0xc8;return function(_0xc0d069){if(_0xc0d069){return _0x2fec1c['status'](_0x2568b1)[_0x137f('0xb')](_0xc0d069);}};}function respondWithFilteredResult(_0x2f62ec,_0xf92549){return function(_0x281dfc){if(_0x281dfc){var _0x433cd3=typeof _0xf92549[_0x137f('0xc')]==='undefined'&&typeof _0xf92549[_0x137f('0xd')]===_0x137f('0xe');var _0x518a1d=_0x281dfc['count'];var _0x2affb6=_0x433cd3?0x0:_0xf92549['offset'];var _0x59c393=_0x433cd3?_0x281dfc[_0x137f('0xf')]:_0xf92549[_0x137f('0xc')]+_0xf92549[_0x137f('0xd')];var _0x21db4c;if(_0x59c393>=_0x518a1d){_0x59c393=_0x518a1d;_0x21db4c=0xc8;}else{_0x21db4c=0xce;}_0x2f62ec[_0x137f('0x10')](_0x21db4c);return _0x2f62ec['set'](_0x137f('0x11'),_0x2affb6+'-'+_0x59c393+'/'+_0x518a1d)[_0x137f('0xb')](_0x281dfc);}return null;};}function saveUpdates(_0x1a8fac){return function(_0x169106){if(_0x169106){return _0x169106['update'](_0x1a8fac)[_0x137f('0x12')](function(_0x5a24a8){return _0x5a24a8;});}return null;};}function removeEntity(_0x23da9f){return function(_0x4c94e1){if(_0x4c94e1){return _0x4c94e1[_0x137f('0x13')]()[_0x137f('0x12')](function(){_0x23da9f['status'](0xcc)[_0x137f('0x14')]();});}};}function handleEntityNotFound(_0x4b5120){return function(_0x424ddd){if(!_0x424ddd){_0x4b5120[_0x137f('0x15')](0x194);}return _0x424ddd;};}function handleError(_0x1ae825,_0x4ee584){_0x4ee584=_0x4ee584||0x1f4;return function(_0x140148){logger[_0x137f('0x16')](_0x140148[_0x137f('0x17')]);if(_0x140148[_0x137f('0x18')]){delete _0x140148[_0x137f('0x18')];}_0x1ae825[_0x137f('0x10')](_0x4ee584)[_0x137f('0x19')](_0x140148);};}exports[_0x137f('0x1a')]=function(_0x342d97,_0x41c87d){var _0x2863b6={},_0x2486d3={},_0xdbd6cb={'count':0x0,'rows':[]};return db[_0x137f('0x1b')][_0x137f('0x1c')]()['then'](function(_0x4c958e){var _0x2a2b38=[];for(var _0x598bbd=0x0;_0x598bbd0x1){_0x311f1b['or'](_0x137f('0x5a'),qs[_0x137f('0x5b')](_0x3c7aad),null);}else{if(qs[_0x137f('0x5c')](_0x3c7aad)){_0x311f1b['or']('c.id\x20LIKE\x20?',_0x3c7aad+'%');_0x311f1b['or']('c.phone\x20LIKE\x20?',_0x3c7aad+'%');_0x311f1b['or']('c.mobile\x20LIKE\x20?',_0x3c7aad+'%');_0x311f1b['or'](_0x137f('0x5d'),_0x3c7aad+'%');}else if(qs[_0x137f('0x5e')](_0x3c7aad)){_0x311f1b['or'](_0x137f('0x5f'),_0x3c7aad+'%');}else{_0x311f1b['or'](_0x137f('0x60'),'%'+_0x3c7aad+'%');_0x311f1b['or']('c.lastName\x20LIKE\x20?','%'+_0x3c7aad+'%');_0x311f1b['or'](_0x137f('0x5f'),'%'+_0x3c7aad+'%');}}}}_0x20d837[_0x137f('0x2f')](_0x311f1b);_0x20d837[_0x137f('0x61')](_0x137f('0x62'));var _0xf836b5={'type':db['Sequelize'][_0x137f('0x63')][_0x137f('0x64')],'raw':!![]};var _0x2f9541=_0x20d837[_0x137f('0x65')]()[_0x137f('0x32')]('c.id');if(_0x2863b6[_0x137f('0x2d')]){_0x2863b6[_0x137f('0x2d')]['forEach'](function(_0x221383){_0x20d837['order']('c.'+_0x221383[0x0],_0x221383[0x1]==='DESC'?![]:!![]);});}if(!_[_0x137f('0x66')](_0x2d0e6d)){_0x20d837[_0x137f('0x67')](_0x2a3a32);_0x2f9541[_0x137f('0x2f')](_0x137f('0x68'),_0x2d0e6d);}BPromise['resolve']()[_0x137f('0x12')](function(){if(!_0x646514)return;if(_0x342d97[_0x137f('0x69')][_0x137f('0x6a')]!==_0x137f('0x6b'))return;if(!_[_0x137f('0x6c')](_0x646514[_0x137f('0x3f')],[_0x137f('0x32'),_0x137f('0x45')])){return _0x342d97[_0x137f('0x69')][_0x137f('0x6d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3cc43d){if(_[_0x137f('0x66')](_0x3cc43d)){_0x2f9541['where'](_0x137f('0x6e'));_0x20d837[_0x137f('0x2f')](_0x137f('0x6e'));}else{_0x2f9541[_0x137f('0x2f')]('c.ListId\x20IN\x20?',_[_0x137f('0x4d')](_0x3cc43d,'id'));_0x20d837[_0x137f('0x2f')](_0x137f('0x53'),_[_0x137f('0x4d')](_0x3cc43d,'id'));}});}})[_0x137f('0x12')](function(){if(_0x342d97[_0x137f('0x69')]['role']===_0x137f('0x6b')&&!_0x646514&&!_0x342d97[_0x137f('0x27')][_0x137f('0x6f')])return[];return db[_0x137f('0x70')]['query'](_0x2f9541[_0x137f('0x71')](),_0xf836b5);})[_0x137f('0x12')](function(_0x5d6099){_0xdbd6cb[_0x137f('0xf')]=_0x5d6099[_0x137f('0x1e')];if(_0xdbd6cb[_0x137f('0xf')]===0x0)return[];return db[_0x137f('0x70')]['query'](_0x5684e6[_0x137f('0x71')](),_0xf836b5)[_0x137f('0x12')](function(_0x5d2ab8){_0x531208=_['keyBy'](_0x5d2ab8,'id');_0xf836b5=_[_0x137f('0x72')](_0xf836b5,{'model':db[_0x137f('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x342d97['query'][_0x137f('0x2b')]){_0x2863b6[_0x137f('0x2a')][_0x137f('0x52')](function(_0x3f266e){_0x20d837['field']('c.'+_0x3f266e);});}else{_0x20d837['field']('c.id');_0x20d837[_0x137f('0x32')](_0x137f('0x73'));_0x20d837[_0x137f('0x32')](_0x137f('0x74'));_0x20d837[_0x137f('0x32')](_0x137f('0x75'));_0x20d837[_0x137f('0x32')](_0x137f('0x76'));_0x20d837['field']('c.fax');_0x20d837[_0x137f('0x32')](_0x137f('0x77'));_0x20d837[_0x137f('0x32')]('c.ListId');_0x20d837[_0x137f('0x32')](_0x137f('0x78'));_0x20d837[_0x137f('0x32')](_0x137f('0x79'));_0x20d837[_0x137f('0x32')]('c.CompanyId');_0x20d837[_0x137f('0x32')](_0x137f('0x7a'),_0x137f('0x7b'));}if(_0x2863b6['limit'])_0x20d837[_0x137f('0xd')](_0x2863b6[_0x137f('0xd')]);if(_0x2863b6[_0x137f('0xc')])_0x20d837['offset'](_0x2863b6[_0x137f('0xc')]);return db[_0x137f('0x70')][_0x137f('0x27')](_0x20d837[_0x137f('0x71')](),_0xf836b5);});})[_0x137f('0x12')](function(_0x424f52){_0x424f52['forEach'](function(_0x10f3d0){if(_0x10f3d0['TagIds']){_0x10f3d0['Tags']=[];_0x10f3d0[_0x137f('0x7b')][_0x137f('0x42')](',')[_0x137f('0x52')](function(_0x5e1820){_0x10f3d0[_0x137f('0x7c')][_0x137f('0x21')](_0x531208[_0x5e1820]);});}delete _0x10f3d0['TagIds'];});_0xdbd6cb[_0x137f('0x7d')]=_0x424f52;return _0xdbd6cb;})[_0x137f('0x12')](respondWithFilteredResult(_0x41c87d,_0x2863b6));})[_0x137f('0x7e')](handleError(_0x41c87d,null));};exports[_0x137f('0x13')]=function(_0x240485,_0x46897d){return db[_0x137f('0x1b')][_0x137f('0x40')]({'where':{'id':_0x240485['params']['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x46897d,null))['then'](removeEntity(_0x46897d,null))[_0x137f('0x7e')](handleError(_0x46897d,null));};exports[_0x137f('0x1c')]=function(_0x2f6511,_0x4de00b){return db[_0x137f('0x1b')][_0x137f('0x1c')]()['then'](function(_0x49c810){delete _0x49c810[_0x137f('0x7f')];for(var _0x2409a3=0x0;_0x2409a30x0){return new Promise(function(_0x5a855a,_0x548665){var _0x502929=[];for(var _0x39877f=0x0;_0x39877f<_0x257db2['length'];_0x39877f++){_0x502929['push'](insertAdditionalPhones(_0x257db2[_0x39877f][_0x137f('0xae')],_0x257db2[_0x39877f][_0x137f('0xa8')]));}Promise[_0x137f('0x23')](_0x502929)[_0x137f('0x12')](function(){_0x5a855a(0x1);});})[_0x137f('0x12')](function(){return{'success':_0x315510,'failure':_0x443d20,'duplicates':_0x51be03};});}else{return{'success':_0x315510,'failure':_0x443d20,'duplicates':_0x51be03};}}})['then'](respondWithResult(_0x2fbc82,0xc9))[_0x137f('0x7e')](handleError(_0x2fbc82,null));};exports[_0x137f('0xaf')]=function(_0x2d4dfe,_0x349567){var _0x189957;return db[_0x137f('0x1b')][_0x137f('0x1c')]()[_0x137f('0x12')](function(_0x4b4a87){return db[_0x137f('0x1b')]['find']({'where':{'id':_0x2d4dfe[_0x137f('0xb0')]['id']},'include':[{'model':db[_0x137f('0xb1')],'as':_0x137f('0x7c'),'attributes':['id',_0x137f('0x18'),_0x137f('0x33')],'required':_0x2d4dfe[_0x137f('0x27')][_0x137f('0x57')]?!![]:![]},{'model':db[_0x137f('0x99')],'as':_0x137f('0xb2'),'where':{'CmContactId':_0x2d4dfe[_0x137f('0xb0')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x137f('0xb3')}]}],'order':[db['sequelize']['literal'](_0x137f('0xb4'))],'attributes':_['keys'](_0x4b4a87)});})[_0x137f('0x12')](function(_0x4f724d){if(!_['isNil'](_0x4f724d)){_0x189957=_0x4f724d[_0x137f('0x88')]({'plain':!![]});var _0x156df2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4f724d&&_0x4f724d[_0x137f('0x6f')]){if(_0x4f724d['ListId']){_0x156df2[_0x137f('0x2f')][_0x137f('0xb5')]['push']({'ListId':{'$ne':_0x4f724d['ListId']}});}}return db[_0x137f('0x82')]['findAll'](_0x156df2);}})['then'](function(_0x524bc4){if(!_[_0x137f('0x50')](_0x524bc4)){return _[_0x137f('0xb6')](_0x189957,_['map'](_0x524bc4,function(_0x27d767){return util[_0x137f('0xb7')]('cf_%d',_0x27d767['id']);}));}})['then'](handleEntityNotFound(_0x349567,null))[_0x137f('0x12')](respondWithResult(_0x349567,null))[_0x137f('0x7e')](handleError(_0x349567,null));};exports[_0x137f('0x91')]=function(_0x53020,_0x498c7a){var _0x36c71d;if(_0x53020['body']['id']){delete _0x53020[_0x137f('0x86')]['id'];}if(!_[_0x137f('0x50')](_0x53020[_0x137f('0x86')][_0x137f('0xa5')])){var _0x16822d=_0x53020[_0x137f('0x86')][_0x137f('0xa5')];if(!_['isNil'](shared[_0x137f('0xa6')][_0x16822d]))_0x53020['body'][_0x137f('0xa7')]=shared[_0x137f('0xa6')][_0x16822d]['utcOffset'];}return db['CmContact'][_0x137f('0x40')]({'where':{'id':_0x53020['params']['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x498c7a,null))['then'](saveUpdates(_0x53020[_0x137f('0x86')],null))[_0x137f('0x12')](function(_0x3dd411){_0x36c71d=_0x3dd411;var _0x2b3ac6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3dd411&&_0x3dd411['ListId']){if(_0x3dd411['ListId']){_0x2b3ac6[_0x137f('0x2f')][_0x137f('0xb5')]['push']({'ListId':{'$ne':_0x3dd411[_0x137f('0x6f')]}});}}return db['CmCustomField'][_0x137f('0x87')](_0x2b3ac6);})['then'](function(_0x462ed4){if(_0x462ed4){return _[_0x137f('0xb6')](_[_0x137f('0xb8')](_0x53020['body'],function(_0x1ea307,_0x274825){return _[_0x137f('0x1f')](_0x274825,_0x137f('0x20'));}),_[_0x137f('0x4d')](_0x462ed4,function(_0x3319f6){return util[_0x137f('0xb7')](_0x137f('0xb9'),_0x3319f6['id']);}));}})[_0x137f('0x12')](function(_0x1d98c7){if(_0x1d98c7&&!_[_0x137f('0x66')](_0x1d98c7)){var _0xd66ba6=squel[_0x137f('0x91')]()[_0x137f('0xba')](_0x137f('0x36'))[_0x137f('0xbb')](_0x1d98c7)['where'](_0x137f('0xbc'),_0x53020[_0x137f('0xb0')]['id'])[_0x137f('0xbd')]();return db[_0x137f('0x70')][_0x137f('0x27')](_0xd66ba6[_0x137f('0x4b')],{'replacements':_0xd66ba6[_0x137f('0xbe')]});}})[_0x137f('0x12')](function(){if(_0x53020[_0x137f('0x86')]['phone']&&_0x36c71d){return db[_0x137f('0xbf')][_0x137f('0x91')]({'phone':_0x53020['body'][_0x137f('0xc0')],'OrderBy':0x0},{'where':{'ContactId':_0x36c71d['id']}});}})[_0x137f('0x12')](function(){return _0x36c71d;})[_0x137f('0x12')](respondWithResult(_0x498c7a,null))['catch'](handleError(_0x498c7a,null));};exports[_0x137f('0xc1')]=function(_0x4c9d1f,_0x59b346){var _0x2dc747={};var _0x4b64b4={};var _0x3e69a6;var _0xf63608;return db[_0x137f('0x1b')][_0x137f('0x22')]({'where':{'id':_0x4c9d1f[_0x137f('0xb0')]['id']}})['then'](handleEntityNotFound(_0x59b346,null))['then'](function(_0x4ee7fb){if(_0x4ee7fb){_0x3e69a6=_0x4ee7fb;_0x4b64b4[_0x137f('0x26')]=_[_0x137f('0x1d')](db['Tag'][_0x137f('0xc2')]);_0x4b64b4[_0x137f('0x27')]=_['keys'](_0x4c9d1f[_0x137f('0x27')]);_0x4b64b4['filters']=_[_0x137f('0x29')](_0x4b64b4[_0x137f('0x26')],_0x4b64b4['query']);_0x2dc747[_0x137f('0x2a')]=_['intersection'](_0x4b64b4[_0x137f('0x26')],qs[_0x137f('0x2b')](_0x4c9d1f[_0x137f('0x27')][_0x137f('0x2b')]));_0x2dc747['attributes']=_0x2dc747[_0x137f('0x2a')][_0x137f('0x1e')]?_0x2dc747['attributes']:_0x4b64b4['model'];_0x2dc747[_0x137f('0x2d')]=qs[_0x137f('0x2e')](_0x4c9d1f[_0x137f('0x27')][_0x137f('0x2e')]);_0x2dc747['where']=qs[_0x137f('0x28')](_[_0x137f('0x30')](_0x4c9d1f[_0x137f('0x27')],_0x4b64b4[_0x137f('0x28')]));if(_0x4c9d1f['query'][_0x137f('0x4f')]){_0x2dc747['where']=_[_0x137f('0x72')](_0x2dc747['where'],{'$or':_['map'](_0x2dc747[_0x137f('0x2a')],function(_0x175904){var _0x388b62={};_0x388b62[_0x175904]={'$like':'%'+_0x4c9d1f[_0x137f('0x27')][_0x137f('0x4f')]+'%'};return _0x388b62;})});}_0x2dc747=_['merge']({},_0x2dc747,_0x4c9d1f[_0x137f('0xc3')]);return _0x3e69a6[_0x137f('0xc1')](_0x2dc747);}})[_0x137f('0x12')](function(_0x432995){if(_0x432995){_0xf63608=_0x432995[_0x137f('0x1e')];if(!_0x4c9d1f[_0x137f('0x27')][_0x137f('0x4e')](_0x137f('0x2c'))){_0x2dc747[_0x137f('0xd')]=qs['limit'](_0x4c9d1f[_0x137f('0x27')]['limit']);_0x2dc747[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x4c9d1f[_0x137f('0x27')]['offset']);}return _0x3e69a6[_0x137f('0xc1')](_0x2dc747);}})['then'](function(_0x49bd7d){if(_0x49bd7d){return _0x49bd7d?{'count':_0xf63608,'rows':_0x49bd7d}:null;}})[_0x137f('0x12')](respondWithResult(_0x59b346,null))[_0x137f('0x7e')](handleError(_0x59b346,null));};exports[_0x137f('0xc4')]=function(_0x2ef86f,_0x35baf6){if(_0x2ef86f['body']['id']){delete _0x2ef86f['body']['id'];}return db['CmContact'][_0x137f('0x22')]({'where':{'id':_0x2ef86f[_0x137f('0xb0')]['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x35baf6,null))['then'](function(_0x2350e7){if(_0x2350e7){return _0x2350e7[_0x137f('0xc4')](_0x2ef86f[_0x137f('0x86')][_0x137f('0xc5')]||[]);}return null;})[_0x137f('0x12')](respondWithResult(_0x35baf6,null))['catch'](handleError(_0x35baf6,null));};exports[_0x137f('0xc6')]=function(_0x5b1741,_0x3c6912){var _0x533a31=[];_0x533a31[_0x137f('0x21')](addAdditionalPhones(_0x5b1741[_0x137f('0x86')]));Promise['all'](_0x533a31)[_0x137f('0x12')](function(){_0x533a31=[];_0x533a31['push'](deleteCmHopperPhones(_0x5b1741[_0x137f('0x86')]['id']));_0x533a31['push'](addCmHopperPhones(_0x5b1741[_0x137f('0x86')]['id']));Promise[_0x137f('0x23')](_0x533a31)[_0x137f('0x12')](function(){return[0x1];})[_0x137f('0x12')](respondWithResult(_0x3c6912,null));});};function addAdditionalPhones(_0x47dad7){var _0x532699;return new Promise(function(_0x3f7ada,_0x142aa9){return db['CmContactHasItem'][_0x137f('0x13')]({'where':{'CmContactId':_0x47dad7['id']}})[_0x137f('0x12')](function(){db['ContactItemType'][_0x137f('0x87')]({'raw':!![],'attributes':['id',_0x137f('0xc7')]})[_0x137f('0x12')](function(_0x427996){var _0x1f1605=[];for(var _0xa74fff=0x0;_0xa74fff<_0x47dad7[_0x137f('0xc8')][_0x137f('0x1e')];_0xa74fff++){var _0x49bdff=_0x47dad7['item_types']?_[_0x137f('0x50')](_0x47dad7[_0x137f('0xc9')][_0xa74fff])?'':_0x47dad7[_0x137f('0xc9')][_0xa74fff]:_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xca')]?_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xca')]:'';var _0xa60c32=_[_0x137f('0x50')](_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xcb')])?'':_0x47dad7[_0x137f('0xc8')][_0xa74fff]['description'];var _0x51228f=_0x49bdff+':'+_0x47dad7[_0x137f('0xc8')][_0xa74fff]['phone']+'§'+_0xa60c32;if(_[_0x137f('0x50')](_0x532699))_0x532699=_0x51228f;else _0x532699+=';'+_0x51228f;var _0x290ceb=null;if(_0x47dad7[_0x137f('0xc9')]){if(!_[_0x137f('0x50')](_0x47dad7[_0x137f('0xc9')][_0xa74fff])){var _0x49439c=_[_0x137f('0x40')](_0x427996,function(_0x5dd4fb){return _0x5dd4fb['id']===_0x47dad7[_0x137f('0xc9')][_0xa74fff];});if(!_[_0x137f('0x50')](_0x49439c)){_0x290ceb=_0x49439c[_0x137f('0xc7')];}}}else{if(!_[_0x137f('0x50')](_0x47dad7[_0x137f('0xc8')][_0xa74fff])){var _0x49439c=_[_0x137f('0x40')](_0x427996,function(_0x53f6a3){return _0x53f6a3['id']===_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xca')];});if(!_[_0x137f('0x50')](_0x49439c)){_0x290ceb=_0xa74fff;}}}if(_[_0x137f('0x50')](_0x290ceb)){_0x290ceb=0x64;}_0x1f1605['push'](addAdditionalPhone(_0x47dad7['id'],_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xc0')],_0x47dad7[_0x137f('0xc9')]?_[_0x137f('0x50')](_0x47dad7[_0x137f('0xc9')][_0xa74fff])?null:_0x47dad7[_0x137f('0xc9')][_0xa74fff]:_0x47dad7[_0x137f('0xc8')][_0xa74fff][_0x137f('0xca')]?_0x47dad7[_0x137f('0xc8')][_0xa74fff]['ItemTypeId']:null,_0x290ceb,_0xa60c32));}Promise[_0x137f('0x23')](_0x1f1605)['then'](function(){db['CmContact']['update']({'AdditionalPhones':_0x532699},{'where':{'id':_0x47dad7['id']}})[_0x137f('0x12')](function(){_0x3f7ada(0x1);});});});});});}function addAdditionalPhone(_0x8269ae,_0x147358,_0x867d14,_0x26845c,_0x2ee9ca){return db[_0x137f('0x99')]['find']({'where':{'CmContactId':_0x8269ae,'item':_0x147358}})['then'](function(_0x333fc9){if(_0x333fc9)logger[_0x137f('0x8b')](_0x137f('0xcc'),_0x333fc9);else{db[_0x137f('0x99')][_0x137f('0x8f')]({'CmContactId':_0x8269ae,'item':_0x147358,'ItemTypeId':_0x867d14,'OrderBy':_0x26845c,'ItemClass':_0x137f('0xcd'),'description':_0x2ee9ca});}});}function deletePhones(_0x45f949){return db['CmContactHasItem'][_0x137f('0x13')]({'where':{'CmContactId':_0x45f949}});}function deleteCmHopperPhones(_0x20e406){return new Promise(function(_0x167c29,_0x4485b8){return db[_0x137f('0xbf')][_0x137f('0x87')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x20e406}})['then'](function(_0x5bfb10){db[_0x137f('0xce')]['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x5bfb10,'id')}}});})['then'](function(){_0x167c29(0x1);});});}function addCmHopperPhones(_0x583d73){return new Promise(function(_0x3b86b2,_0xa5c22){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x583d73}})[_0x137f('0x12')](function(_0x31efe7){var _0x13c195=[];_[_0x137f('0x4d')](_0x31efe7,function(_0x4dfb8a){_0x13c195['push'](createCmHopperPhone(_0x583d73,_0x4dfb8a['id']));});Promise[_0x137f('0x23')](_0x13c195)[_0x137f('0x12')](function(){_0x3b86b2(0x1);});});});}function createCmHopperPhone(_0x4afd7f,_0x29f08a){return new Promise(function(_0x30e94c,_0x1489b4){db[_0x137f('0x99')][_0x137f('0x87')]({'raw':!![],'attributes':[_0x137f('0xcf'),'OrderBy'],'where':{'CmContactId':_0x4afd7f,'ItemClass':_0x137f('0xcd')},'include':[{'model':db[_0x137f('0xd0')],'attributes':[_0x137f('0xc7')],'as':'ItemType'}],'order':[_0x137f('0xc7'),db[_0x137f('0x70')][_0x137f('0xd1')](_0x137f('0xd2'))]})[_0x137f('0x12')](function(_0x5b8553){var _0x539987=0x1;var _0xf0bf6f=_[_0x137f('0x4d')](_0x5b8553,function(_0x5effff){_0x5effff[_0x137f('0xd3')]=_0x29f08a;_0x5effff[_0x137f('0xc0')]=_0x5effff['item'];_0x5effff[_0x137f('0xc7')]=_0x539987;delete _0x5effff['ItemType.OrderBy'];_0x539987=_0x539987+0x1;return _0x5effff;});return db[_0x137f('0xce')][_0x137f('0xa9')](_0xf0bf6f,{});})[_0x137f('0x12')](function(){_0x30e94c(0x1);});});}function insertAdditionalPhones(_0x2a2192,_0xa734b7){return new Promise(function(_0x304dd8,_0x49793d){var _0x3b89bb=[];for(var _0x349d86=0x0;_0x349d86<_0xa734b7['length'];_0x349d86++){var _0x36ca42=_0xa734b7[_0x349d86];_0x3b89bb[_0x137f('0x21')](parseContactItemType(_0x36ca42));}Promise[_0x137f('0x23')](_0x3b89bb)[_0x137f('0x12')](function(){var _0xe902f1={'id':_0x2a2192['id'],'items':_0xa734b7};return addAdditionalPhones(_0xe902f1)[_0x137f('0x12')](function(_0x3e5d63){return addCmHopperPhones(_0x2a2192['id']);});})[_0x137f('0x12')](function(){_0x304dd8(_0x2a2192);});});}function parseContactItemType(_0x17dcf2){return new Promise(function(_0x276aa6,_0x1e7c0b){if(_0x17dcf2[_0x137f('0x4e')]('ItemTypeId')){_0x276aa6(_0x17dcf2);}else{return db['ContactItemType'][_0x137f('0x40')]({'where':{'name':_0x17dcf2[_0x137f('0xb3')]}})[_0x137f('0x12')](function(_0x3bdbcd){if(_[_0x137f('0x50')](_0x3bdbcd))_0x17dcf2[_0x137f('0xca')]=null;else _0x17dcf2[_0x137f('0xca')]=_0x3bdbcd['id'];_0x276aa6(_0x17dcf2);});}});}exports['getAdditionalPhones']=function(_0x2ec40f,_0x351744){return db['CmContactHasItem'][_0x137f('0x87')]({'raw':!![],'where':{'CmContactId':_0x2ec40f[_0x137f('0xb0')]['id'],'ItemClass':_0x137f('0xcd')},'include':[{'model':db[_0x137f('0xd0')],'as':_0x137f('0xb3')}],'order':[['OrderBy'],[db[_0x137f('0x70')][_0x137f('0xd1')]('`ItemType`.OrderBy')]]})['then'](function(_0x4c89d2){return _0x4c89d2;})[_0x137f('0x12')](respondWithResult(_0x351744,null))[_0x137f('0x7e')](handleError(_0x351744,null));};exports[_0x137f('0xd4')]=function(_0x1c6e3b,_0x182922){return db[_0x137f('0x99')][_0x137f('0x87')]({'raw':!![],'where':{'CmContactId':_0x1c6e3b[_0x137f('0x86')][_0x137f('0xd5')]}})[_0x137f('0x12')](function(_0x5f4d34){var _0xd10ae9=_['map'](_0x5f4d34,function(_0x308e15){_0x308e15[_0x137f('0xd6')]=_0x1c6e3b[_0x137f('0x86')][_0x137f('0xd7')];return _0x308e15;});return db[_0x137f('0x99')][_0x137f('0xa9')](_0xd10ae9,{});})['then'](function(_0x5f06cd){return addCmHopperPhones(_0x1c6e3b[_0x137f('0x86')][_0x137f('0xd7')]);})[_0x137f('0x12')](function(_0x255ad4){return['ok'];})[_0x137f('0x12')](respondWithResult(_0x182922,null))['catch'](handleError(_0x182922,null));};exports[_0x137f('0xd8')]=function(_0x1461c6,_0x35ecf2){var _0x425255=[];_0x425255['push'](createCmHopperPhone(_0x1461c6['body']['id'],_0x1461c6[_0x137f('0x86')][_0x137f('0xd9')]));Promise['all'](_0x425255)[_0x137f('0x12')](function(){return[0x1];})[_0x137f('0x12')](respondWithResult(_0x35ecf2,null));};exports[_0x137f('0xda')]=function(_0x2ac397,_0x299288){var _0x10a18b={'raw':![],'where':{}};var _0x47fcf6={};var _0x71ac78={'count':0x0,'rows':[]};return db[_0x137f('0x1b')]['findOne']({'where':{'id':_0x2ac397[_0x137f('0xb0')]['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x299288,null))['then'](function(_0x484934){if(_0x484934){_0x47fcf6[_0x137f('0x26')]=_['keys'](db[_0x137f('0xbf')][_0x137f('0xc2')]);_0x47fcf6['query']=_[_0x137f('0x1d')](_0x2ac397['query']);_0x47fcf6[_0x137f('0x28')]=_[_0x137f('0x29')](_0x47fcf6[_0x137f('0x26')],_0x47fcf6[_0x137f('0x27')]);_0x10a18b[_0x137f('0x2a')]=_[_0x137f('0x29')](_0x47fcf6[_0x137f('0x26')],qs[_0x137f('0x2b')](_0x2ac397['query'][_0x137f('0x2b')]));_0x10a18b[_0x137f('0x2a')]=_0x10a18b[_0x137f('0x2a')][_0x137f('0x1e')]?_0x10a18b[_0x137f('0x2a')]:_0x47fcf6[_0x137f('0x26')];if(!_0x2ac397[_0x137f('0x27')][_0x137f('0x4e')]('nolimit')){_0x10a18b[_0x137f('0xd')]=qs[_0x137f('0xd')](_0x2ac397[_0x137f('0x27')][_0x137f('0xd')]);_0x10a18b[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x2ac397[_0x137f('0x27')][_0x137f('0xc')]);}_0x10a18b['order']=qs[_0x137f('0x2e')](_0x2ac397[_0x137f('0x27')][_0x137f('0x2e')]);_0x10a18b[_0x137f('0x2f')]=qs[_0x137f('0x28')](_[_0x137f('0x30')](_0x2ac397['query'],_0x47fcf6['filters']));_0x10a18b[_0x137f('0x2f')][_0x137f('0xdb')]=_0x484934['id'];if(_0x2ac397[_0x137f('0x27')][_0x137f('0x4f')]){_0x10a18b['where']=_[_0x137f('0x72')](_0x10a18b[_0x137f('0x2f')],{'$or':_[_0x137f('0x4d')](_0x10a18b[_0x137f('0x2a')],function(_0x3ae5e2){var _0x2eeb05={};_0x2eeb05[_0x3ae5e2]={'$like':'%'+_0x2ac397[_0x137f('0x27')][_0x137f('0x4f')]+'%'};return _0x2eeb05;})});}_0x10a18b=_[_0x137f('0x72')]({},_0x10a18b,_0x2ac397['options']);return db[_0x137f('0xbf')][_0x137f('0xf')]({'where':_0x10a18b[_0x137f('0x2f')]})[_0x137f('0x12')](function(_0xe6392f){_0x71ac78[_0x137f('0xf')]=_0xe6392f;if(_0x2ac397['query'][_0x137f('0xdc')]){_0x10a18b[_0x137f('0xdd')]=[{'all':!![]}];}return db[_0x137f('0xbf')][_0x137f('0x87')](_0x10a18b);})[_0x137f('0x12')](function(_0x58f66a){_0x71ac78['rows']=_0x58f66a;return _0x71ac78;});}})['then'](respondWithFilteredResult(_0x299288,_0x10a18b))[_0x137f('0x7e')](handleError(_0x299288,null));};exports[_0x137f('0xde')]=function(_0x2396af,_0x312ea7){var _0x4bf9a1={'raw':!![],'where':{}};var _0x5e8a61={};var _0x36c067={'count':0x0,'rows':[]};return db[_0x137f('0x1b')][_0x137f('0x22')]({'where':{'id':_0x2396af['params']['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x312ea7,null))[_0x137f('0x12')](function(_0x43ca94){if(_0x43ca94){_0x5e8a61[_0x137f('0x26')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x5e8a61['query']=_[_0x137f('0x1d')](_0x2396af[_0x137f('0x27')]);_0x5e8a61[_0x137f('0x28')]=_[_0x137f('0x29')](_0x5e8a61[_0x137f('0x26')],_0x5e8a61[_0x137f('0x27')]);_0x4bf9a1['attributes']=_[_0x137f('0x29')](_0x5e8a61[_0x137f('0x26')],qs[_0x137f('0x2b')](_0x2396af[_0x137f('0x27')][_0x137f('0x2b')]));_0x4bf9a1[_0x137f('0x2a')]=_0x4bf9a1['attributes']['length']?_0x4bf9a1[_0x137f('0x2a')]:_0x5e8a61[_0x137f('0x26')];if(!_0x2396af[_0x137f('0x27')]['hasOwnProperty']('nolimit')){_0x4bf9a1['limit']=qs[_0x137f('0xd')](_0x2396af['query'][_0x137f('0xd')]);_0x4bf9a1[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x2396af[_0x137f('0x27')][_0x137f('0xc')]);}_0x4bf9a1[_0x137f('0x2d')]=qs['sort'](_0x2396af[_0x137f('0x27')][_0x137f('0x2e')]);_0x4bf9a1[_0x137f('0x2f')]=qs[_0x137f('0x28')](_[_0x137f('0x30')](_0x2396af['query'],_0x5e8a61[_0x137f('0x28')]));_0x4bf9a1[_0x137f('0x2f')][_0x137f('0xdb')]=_0x43ca94['id'];if(_0x2396af[_0x137f('0x27')][_0x137f('0x4f')]){_0x4bf9a1['where']=_[_0x137f('0x72')](_0x4bf9a1[_0x137f('0x2f')],{'$or':_[_0x137f('0x4d')](_0x4bf9a1[_0x137f('0x2a')],function(_0x7cd2d2){var _0x54c8c2={};_0x54c8c2[_0x7cd2d2]={'$like':'%'+_0x2396af[_0x137f('0x27')]['filter']+'%'};return _0x54c8c2;})});}_0x4bf9a1=_[_0x137f('0x72')]({},_0x4bf9a1,_0x2396af[_0x137f('0xc3')]);return db['CmHopperHistory']['count']({'where':_0x4bf9a1['where']})[_0x137f('0x12')](function(_0x349a09){_0x36c067['count']=_0x349a09;if(_0x2396af[_0x137f('0x27')][_0x137f('0xdc')]){_0x4bf9a1[_0x137f('0xdd')]=[{'all':!![]}];}return db[_0x137f('0x9b')][_0x137f('0x87')](_0x4bf9a1);})['then'](function(_0x2cd1d6){_0x36c067[_0x137f('0x7d')]=_0x2cd1d6;return _0x36c067;});}})[_0x137f('0x12')](respondWithFilteredResult(_0x312ea7,_0x4bf9a1))[_0x137f('0x7e')](handleError(_0x312ea7,null));};exports[_0x137f('0xdf')]=function(_0x4a92b4,_0x22c913){var _0x338417={'raw':!![],'where':{}};var _0x3e0090={};var _0x59ffdd={'count':0x0,'rows':[]};return db['CmContact'][_0x137f('0x22')]({'where':{'id':_0x4a92b4[_0x137f('0xb0')]['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x22c913,null))[_0x137f('0x12')](function(_0xeb6f7e){if(_0xeb6f7e){_0x3e0090[_0x137f('0x26')]=_[_0x137f('0x1d')](db[_0x137f('0x9a')][_0x137f('0xc2')]);_0x3e0090[_0x137f('0x27')]=_['keys'](_0x4a92b4[_0x137f('0x27')]);_0x3e0090['filters']=_[_0x137f('0x29')](_0x3e0090[_0x137f('0x26')],_0x3e0090[_0x137f('0x27')]);_0x338417[_0x137f('0x2a')]=_[_0x137f('0x29')](_0x3e0090['model'],qs['fields'](_0x4a92b4[_0x137f('0x27')][_0x137f('0x2b')]));_0x338417['attributes']=_0x338417[_0x137f('0x2a')][_0x137f('0x1e')]?_0x338417['attributes']:_0x3e0090[_0x137f('0x26')];if(!_0x4a92b4[_0x137f('0x27')][_0x137f('0x4e')]('nolimit')){_0x338417['limit']=qs[_0x137f('0xd')](_0x4a92b4[_0x137f('0x27')][_0x137f('0xd')]);_0x338417[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x4a92b4['query'][_0x137f('0xc')]);}_0x338417[_0x137f('0x2d')]=qs['sort'](_0x4a92b4['query'][_0x137f('0x2e')]);_0x338417['where']=qs['filters'](_[_0x137f('0x30')](_0x4a92b4['query'],_0x3e0090[_0x137f('0x28')]));_0x338417[_0x137f('0x2f')][_0x137f('0xdb')]=_0xeb6f7e['id'];if(_0x4a92b4['query'][_0x137f('0x4f')]){_0x338417['where']=_[_0x137f('0x72')](_0x338417[_0x137f('0x2f')],{'$or':_['map'](_0x338417[_0x137f('0x2a')],function(_0x339a43){var _0x448fe5={};_0x448fe5[_0x339a43]={'$like':'%'+_0x4a92b4['query'][_0x137f('0x4f')]+'%'};return _0x448fe5;})});}_0x338417=_['merge']({},_0x338417,_0x4a92b4[_0x137f('0xc3')]);return db[_0x137f('0x9a')][_0x137f('0xf')]({'where':_0x338417[_0x137f('0x2f')]})[_0x137f('0x12')](function(_0x26dbc3){_0x59ffdd[_0x137f('0xf')]=_0x26dbc3;if(_0x4a92b4['query'][_0x137f('0xdc')]){_0x338417['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x137f('0x87')](_0x338417);})[_0x137f('0x12')](function(_0x47ed8b){_0x59ffdd[_0x137f('0x7d')]=_0x47ed8b;return _0x59ffdd;});}})['then'](respondWithFilteredResult(_0x22c913,_0x338417))[_0x137f('0x7e')](handleError(_0x22c913,null));};exports['getJscriptySessions']=function(_0x4b0163,_0x2a896b){var _0x17343e={'raw':!![],'where':{}};var _0x29ebb6={};var _0x393aea={'count':0x0,'rows':[]};return db[_0x137f('0x1b')][_0x137f('0x22')]({'where':{'id':_0x4b0163['params']['id']}})[_0x137f('0x12')](handleEntityNotFound(_0x2a896b,null))['then'](function(_0xf47d63){if(_0xf47d63){_0x29ebb6[_0x137f('0x26')]=_[_0x137f('0x1d')](db['JscriptySessionReport'][_0x137f('0xc2')]);_0x29ebb6['query']=_['keys'](_0x4b0163['query']);_0x29ebb6[_0x137f('0x28')]=_[_0x137f('0x29')](_0x29ebb6[_0x137f('0x26')],_0x29ebb6[_0x137f('0x27')]);_0x17343e[_0x137f('0x2a')]=_[_0x137f('0x29')](_0x29ebb6[_0x137f('0x26')],qs[_0x137f('0x2b')](_0x4b0163[_0x137f('0x27')]['fields']));_0x17343e[_0x137f('0x2a')]=_0x17343e[_0x137f('0x2a')][_0x137f('0x1e')]?_0x17343e['attributes']:_0x29ebb6[_0x137f('0x26')];if(!_0x4b0163[_0x137f('0x27')]['hasOwnProperty'](_0x137f('0x2c'))){_0x17343e['limit']=qs[_0x137f('0xd')](_0x4b0163[_0x137f('0x27')][_0x137f('0xd')]);_0x17343e[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x4b0163[_0x137f('0x27')]['offset']);}_0x17343e['order']=qs['sort'](_0x4b0163['query'][_0x137f('0x2e')]);_0x17343e['where']=qs[_0x137f('0x28')](_[_0x137f('0x30')](_0x4b0163[_0x137f('0x27')],_0x29ebb6[_0x137f('0x28')]));_0x17343e[_0x137f('0x2f')]['ContactId']=_0xf47d63['id'];if(_0x4b0163[_0x137f('0x27')][_0x137f('0x4f')]){_0x17343e[_0x137f('0x2f')]=_[_0x137f('0x72')](_0x17343e[_0x137f('0x2f')],{'$or':_[_0x137f('0x4d')](_0x17343e[_0x137f('0x2a')],function(_0xe98844){var _0x41904c={};_0x41904c[_0xe98844]={'$like':'%'+_0x4b0163[_0x137f('0x27')][_0x137f('0x4f')]+'%'};return _0x41904c;})});}_0x17343e=_[_0x137f('0x72')]({},_0x17343e,_0x4b0163[_0x137f('0xc3')]);return db['JscriptySessionReport'][_0x137f('0xf')]({'where':_0x17343e[_0x137f('0x2f')]})[_0x137f('0x12')](function(_0x5f6f1b){_0x393aea[_0x137f('0xf')]=_0x5f6f1b;if(_0x4b0163[_0x137f('0x27')]['includeAll']){_0x17343e[_0x137f('0xdd')]=[{'all':!![]}];}return db[_0x137f('0xa1')][_0x137f('0x87')](_0x17343e);})[_0x137f('0x12')](function(_0x4a5f1f){_0x393aea[_0x137f('0x7d')]=_0x4a5f1f;return _0x393aea;});}})[_0x137f('0x12')](respondWithFilteredResult(_0x2a896b,_0x17343e))[_0x137f('0x7e')](handleError(_0x2a896b,null));};exports[_0x137f('0xe0')]=function(_0x3c44fb,_0x153e2d){try{if(!_0x3c44fb['body'][_0x137f('0x6f')]){throw new Error(_0x137f('0xe1'));}if(!_0x3c44fb[_0x137f('0x86')][_0x137f('0xe2')]){throw new Error(_0x137f('0xe3'));}if(!_0x3c44fb['body']['binding_values']){throw new Error(_0x137f('0xe4'));}if(!_0x3c44fb[_0x137f('0x86')][_0x137f('0xe5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x18daf1=_0x3c44fb[_0x137f('0x86')][_0x137f('0xe2')][_0x137f('0x42')](',');var _0x5682ec=_0x3c44fb[_0x137f('0x86')][_0x137f('0xe6')][_0x137f('0x42')](',');if(!_0x18daf1['length']||!_0x5682ec[_0x137f('0x1e')]||_0x18daf1[_0x137f('0x1e')]!==_0x5682ec[_0x137f('0x1e')]){throw new Error(_0x137f('0xe7'));}_0x3c44fb['body'][_0x137f('0x2b')]=_[_0x137f('0xe8')](_0x18daf1,_0x5682ec);if(!_0x3c44fb[_0x137f('0x86')][_0x137f('0x2b')][_0x137f('0xc0')]){throw new Error(_0x137f('0xe9'));}if(!_0x3c44fb[_0x137f('0x86')][_0x137f('0x2b')][_0x137f('0xea')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1442cd=path[_0x137f('0x8a')](config[_0x137f('0xeb')],_0x137f('0xec'),_0x3c44fb['file']['filename']);fs[_0x137f('0xed')](_0x1442cd,parseInt(_0x137f('0xee'),0x8));var _0x900f2d=require(_0x137f('0xef'))[_0x137f('0xf0')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x1442cd,_0x3c44fb[_0x137f('0x86')][_0x137f('0xe2')],_0x3c44fb[_0x137f('0x86')]['binding_values'],_0x3c44fb[_0x137f('0x86')]['ListId'],_0x3c44fb['body'][_0x137f('0xf1')],_0x3c44fb['body'][_0x137f('0xab')],_0x3c44fb[_0x137f('0x86')]['socket_timestamp']]);return _0x153e2d[_0x137f('0x10')](0xc8)['json']({'message':_0x137f('0xf2'),'pid':_0x900f2d[_0x137f('0xf3')]});}catch(_0x507019){return _0x153e2d[_0x137f('0x10')](0x1f4)[_0x137f('0x19')](_0x507019);}};exports['upload']=function(_0x3c4118,_0x3de37c){var _0x3c2107=fs[_0x137f('0xf4')](_0x3c4118[_0x137f('0xf5')]['path']);Papa['parse'](_0x3c2107,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4b1e29){return _0x3de37c['status'](0xc8)[_0x137f('0xb')]({'file':_0x3c4118[_0x137f('0xf5')],'fields':_0x4b1e29[_0x137f('0xf6')][_0x137f('0x2b')]});}});};exports[_0x137f('0xf7')]=function(_0x2cd8f3,_0x59a881){return db[_0x137f('0x45')][_0x137f('0x87')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x137f('0x12')](function(_0x1e97dd){var _0x222871=![];if(!_0x2cd8f3[_0x137f('0x86')][_0x137f('0x6f')]){throw new Error(_0x137f('0xe1'));}if(!_0x2cd8f3['body']['binding'][_0x137f('0xc0')]){throw new Error(_0x137f('0xe9'));}if(!_0x2cd8f3[_0x137f('0x86')][_0x137f('0xf8')][_0x137f('0xea')]){throw new Error(_0x137f('0xf9'));}if(!_0x2cd8f3['body']['socket_timestamp']){throw new Error(_0x137f('0xfa'));}var _0x49f339=require(_0x137f('0xef'))[_0x137f('0xf0')](path['join'](__dirname,_0x137f('0xfb')),[_0x2cd8f3['params']['id'],JSON[_0x137f('0xfc')](_0x2cd8f3[_0x137f('0x86')]),JSON[_0x137f('0xfc')](_0x1e97dd)]);_0x49f339['on']('message',function(){_0x222871=!![];return _0x59a881[_0x137f('0x10')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x49f339[_0x137f('0xf3')]});});_0x49f339['on'](_0x137f('0xfd'),function(_0x598c10){if(_0x598c10&&!_0x222871){return _0x59a881[_0x137f('0x10')](0x1f4)[_0x137f('0xb')]({'message':_0x137f('0xfe'),'pid':_0x49f339[_0x137f('0xf3')]});}});})['catch'](handleError(_0x59a881,null));};exports[_0x137f('0xff')]=function(_0x82a859,_0x59abf5,_0x4ecf7d){return db[_0x137f('0x45')][_0x137f('0x87')]({'raw':!![],'attributes':['id'],'where':{'role':_0x137f('0x6b')}})[_0x137f('0x12')](function(_0x5add37){var _0x439b1f=![];if(!_0x82a859[_0x137f('0x86')][_0x137f('0x6f')]){throw new Error(_0x137f('0xe1'));}if(!_0x82a859['body']['binding'][_0x137f('0xc0')]){throw new Error(_0x137f('0xe9'));}if(!_0x82a859[_0x137f('0x86')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x82a859[_0x137f('0x86')][_0x137f('0xe5')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2dae11=require(_0x137f('0xef'))['fork'](path['join'](__dirname,_0x137f('0x100')),[_0x82a859[_0x137f('0xb0')]['id'],JSON['stringify'](_0x82a859[_0x137f('0x86')]),JSON['stringify'](_0x5add37)]);_0x2dae11['on']('message',function(_0x4564e6){_0x439b1f=!![];return _0x59abf5[_0x137f('0x10')](0xc8)[_0x137f('0xb')]({'message':_0x137f('0x101'),'pid':_0x2dae11[_0x137f('0xf3')]});});_0x2dae11['on'](_0x137f('0xfd'),function(_0x40557c){if(_0x40557c&&!_0x439b1f){return _0x59abf5['status'](0x1f4)[_0x137f('0xb')]({'message':_0x137f('0xfe'),'pid':_0x2dae11['pid']});}});})['catch'](handleError(_0x59abf5,null));};exports[_0x137f('0x102')]=function(_0x4057a1,_0x15d8c5){var _0x2960a4=[_0x137f('0x103'),'chat',_0x137f('0x104'),_0x137f('0x105'),'fax','whatsapp',_0x137f('0x106')];var _0x54ac58={'offset':0x0,'order':qs[_0x137f('0x2e')]('-createdAt')},_0x2252cc={'count':0x0,'rows':[]};Promise[_0x137f('0x107')]()[_0x137f('0x12')](function(){if(_0x4057a1[_0x137f('0x27')][_0x137f('0x108')]){if(!_['includes'](_0x2960a4,_0x4057a1[_0x137f('0x27')][_0x137f('0x108')][_0x137f('0x109')]())){throw new Error(_0x137f('0x10a'));}_0x2960a4=[_0x4057a1[_0x137f('0x27')][_0x137f('0x108')]['toLowerCase']()];}if(_0x4057a1['query'][_0x137f('0x10b')]){try{var _0x4f9a7c=JSON[_0x137f('0x10c')](_0x4057a1[_0x137f('0x27')][_0x137f('0x10b')]);if(!moment(_0x4f9a7c[_0x137f('0x34')])[_0x137f('0x10d')]()){throw new Error(_0x137f('0x10e'));}if(!moment(_0x4f9a7c['to'])[_0x137f('0x10d')]()){throw new Error(_0x137f('0x10f'));}}catch(_0x2ebae7){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x4057a1[_0x137f('0x27')][_0x137f('0x4e')](_0x137f('0x2c'))){_0x54ac58['limit']=qs[_0x137f('0xd')](_0x4057a1[_0x137f('0x27')]['limit']||0xa);_0x54ac58[_0x137f('0xc')]=qs[_0x137f('0xc')](_0x4057a1[_0x137f('0x27')][_0x137f('0xc')]);}var _0x29f3ff=_0x2960a4['map'](function(_0x44cfb4){if(_0x44cfb4===_0x137f('0x106')){var _0xead437={'attributes':['id',_0x137f('0x110'),_0x137f('0x25'),_0x137f('0x111'),_0x137f('0x112'),_0x137f('0x113'),_0x137f('0x114'),_0x137f('0x115'),'duration',_0x137f('0x116'),'createdAt',_0x137f('0x117'),'userSecondDisposition',_0x137f('0x118'),_0x137f('0x119')],'where':{'ContactId':_0x4057a1['params']['id']},'include':[{'model':db[_0x137f('0x45')],'as':_0x137f('0x45'),'attributes':['id',_0x137f('0x18'),_0x137f('0x11a'),_0x137f('0x84')]}],'order':[['createdAt',_0x137f('0x11b')]]};if(_0x4057a1['query'][_0x137f('0x10b')]){_0xead437[_0x137f('0x2f')]['createdAt']={'$gte':_0x4f9a7c['from'],'$lte':_0x4f9a7c['to']};}return db['VoiceCallReport']['findAndCountAll'](_0xead437)[_0x137f('0x12')](function(_0x32f47d){_0x2252cc[_0x137f('0xf')]+=_0x32f47d[_0x137f('0xf')];return _[_0x137f('0x4d')](_0x32f47d[_0x137f('0x7d')],function(_0x29e834){var _0x1e77de=_0x29e834[_0x137f('0x88')]({'plain':!![]});_0x1e77de[_0x137f('0x108')]=_0x44cfb4;if(_0x1e77de[_0x137f('0x45')]){_0x1e77de[_0x137f('0x45')]={'id':_0x1e77de[_0x137f('0x45')]['id'],'name':_0x1e77de[_0x137f('0x45')][_0x137f('0x18')],'fullname':_0x1e77de[_0x137f('0x45')][_0x137f('0x11a')],'alias':_0x1e77de[_0x137f('0x45')]['alias']};}return _0x1e77de;});});}else{var _0x5cc700=_[_0x137f('0x11c')](_0x44cfb4)+(_0x44cfb4==='chat'?_0x137f('0x11d'):_0x137f('0x11e'));var _0x5a5a2c={'attributes':['id',_0x137f('0x11f'),_0x137f('0x120'),_0x137f('0x121'),'note',_0x137f('0x122'),_0x137f('0x123'),_0x137f('0x124'),_0x137f('0x119'),_0x5cc700+'Id'],'where':{'ContactId':_0x4057a1[_0x137f('0xb0')]['id']},'include':[{'model':db[_0x5cc700],'as':_0x137f('0x11e'),'attributes':['id',_0x137f('0x18'),'key']},{'model':db[_0x137f('0x45')],'as':_0x137f('0x125'),'attributes':['id',_0x137f('0x18'),'fullname']},{'model':db[_0x137f('0xb1')],'as':_0x137f('0x7c'),'attributes':['id',_0x137f('0x18'),_0x137f('0x33')],'through':{'attributes':[]}}],'order':[['createdAt',_0x137f('0x11b')]]};if(_0x4057a1[_0x137f('0x27')][_0x137f('0x10b')]){_0x5a5a2c[_0x137f('0x2f')][_0x137f('0x121')]={'$gte':_0x4f9a7c['from'],'$lte':_0x4f9a7c['to']};}switch(_0x44cfb4){case _0x137f('0x126'):_0x5a5a2c[_0x137f('0x2a')][_0x137f('0x21')](_0x137f('0x127'),_0x137f('0x128'),'customerPort','deviceModel',_0x137f('0x129'),_0x137f('0x12a'),_0x137f('0x12b'),_0x137f('0x12c'),_0x137f('0x12d'));break;case _0x137f('0x103'):_0x5a5a2c['attributes'][_0x137f('0x21')](_0x137f('0x12e'),'substatus');break;case _0x137f('0x105'):_0x5a5a2c[_0x137f('0x2a')][_0x137f('0x21')](_0x137f('0x12f'),_0x137f('0x130'));break;}return db[_[_0x137f('0x11c')](_0x44cfb4)+_0x137f('0x131')][_0x137f('0x132')](_0x5a5a2c)[_0x137f('0x12')](function(_0x3807a6){_0x2252cc[_0x137f('0xf')]+=_0x3807a6[_0x137f('0xf')];return _['map'](_0x3807a6[_0x137f('0x7d')],function(_0x214047){var _0x66c7f7=_0x214047[_0x137f('0x88')]({'plain':!![]});_0x66c7f7[_0x137f('0x108')]=_0x44cfb4;if(_0x66c7f7[_0x137f('0x125')]){_0x66c7f7[_0x137f('0x125')]={'id':_0x66c7f7[_0x137f('0x125')]['id'],'name':_0x66c7f7[_0x137f('0x125')][_0x137f('0x18')],'fullname':_0x66c7f7['Owner'][_0x137f('0x11a')]};}return _0x66c7f7;});});}});return Promise[_0x137f('0x23')](_0x29f3ff);})[_0x137f('0x12')](function(_0x2d5983){return _(_0x2d5983)['flatten']()[_0x137f('0x133')](_0x137f('0x121'))[_0x137f('0x134')]()[_0x137f('0x41')]();})[_0x137f('0x12')](function(_0x1eb003){_0x2252cc[_0x137f('0x7d')]=_0x54ac58['limit']?_0x1eb003[_0x137f('0x135')](_0x54ac58['offset'],_0x54ac58[_0x137f('0xc')]+_0x54ac58[_0x137f('0xd')]):_0x1eb003;return _0x2252cc;})[_0x137f('0x12')](respondWithFilteredResult(_0x15d8c5,_0x54ac58))['catch'](handleError(_0x15d8c5,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 5ce8eba..b4cc160 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0fb=['emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa0fb,0x1e3));var _0xba0f=function(_0x2c97ed,_0x4c7e87){_0x2c97ed=_0x2c97ed-0x0;var _0xb10b58=_0xa0fb[_0x2c97ed];return _0xb10b58;};'use strict';var EventEmitter=require(_0xba0f('0x0'));var CmContact=require(_0xba0f('0x1'))['db'][_0xba0f('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xba0f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xba0f('0x4')};function emitEvent(_0x443bfc){return function(_0x1127f5,_0x437178,_0x4d8b9e){CmContactEvents[_0xba0f('0x5')](_0x443bfc+':'+_0x1127f5['id'],_0x1127f5);CmContactEvents[_0xba0f('0x5')](_0x443bfc,_0x1127f5);_0x4d8b9e(null);};}for(var e in events){if(events[_0xba0f('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xba0f('0x7')]=CmContactEvents; \ No newline at end of file +var _0xc0ab=['../../mysqldb','CmContact','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x2ce458,_0x271bf6){var _0x386dd9=function(_0x5f394f){while(--_0x5f394f){_0x2ce458['push'](_0x2ce458['shift']());}};_0x386dd9(++_0x271bf6);}(_0xc0ab,0x98));var _0xbc0a=function(_0x2d991c,_0x1583d4){_0x2d991c=_0x2d991c-0x0;var _0x3d5af5=_0xc0ab[_0x2d991c];return _0x3d5af5;};'use strict';var EventEmitter=require(_0xbc0a('0x0'));var CmContact=require(_0xbc0a('0x1'))['db'][_0xbc0a('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xbc0a('0x3')](0x0);var events={'afterCreate':_0xbc0a('0x4'),'afterUpdate':_0xbc0a('0x5'),'afterDestroy':_0xbc0a('0x6')};function emitEvent(_0x1f3287){return function(_0x42a93a,_0xbb5558,_0x11c775){CmContactEvents[_0xbc0a('0x7')](_0x1f3287+':'+_0x42a93a['id'],_0x42a93a);CmContactEvents['emit'](_0x1f3287,_0x42a93a);_0x11c775(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xbc0a('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d942ec6..499db7b 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc260=['info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','email','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','isNil','then','dialTimezone','timezones','utcOffset','scheduledat','add','minutes','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','priority','callbackUniqueid','ret','findOne','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','CmList','Lists','length','dialCheckDuplicateType','always','onlyIfOpen','VoiceQueue','findAll','BlackLists','create','cmContact,\x20%s,\x20%s','message','Campaign','CmHopperBlack','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId'];(function(_0x56ab0a,_0x315bf0){var _0x5d3eb4=function(_0x25aa47){while(--_0x25aa47){_0x56ab0a['push'](_0x56ab0a['shift']());}};_0x5d3eb4(++_0x315bf0);}(_0xc260,0x1bf));var _0x0c26=function(_0x49ad4d,_0x4569f3){_0x49ad4d=_0x49ad4d-0x0;var _0xdb69d9=_0xc260[_0x49ad4d];return _0xdb69d9;};'use strict';var _=require(_0x0c26('0x0'));var util=require('util');var logger=require(_0x0c26('0x1'))(_0x0c26('0x2'));var moment=require(_0x0c26('0x3'));var BPromise=require(_0x0c26('0x4'));var rp=require(_0x0c26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c26('0x6'));var config=require(_0x0c26('0x7'));var shared=require(_0x0c26('0x8'));var attributes=require(_0x0c26('0x9'));module['exports']=function(_0x26e8fb,_0x18b4f8){return _0x26e8fb[_0x0c26('0xa')](_0x0c26('0xb'),attributes,{'tableName':_0x0c26('0xc'),'paranoid':!![],'indexes':[{'name':_0x0c26('0xd'),'fields':[_0x0c26('0xd')]},{'name':'fti_cm_contacts','fields':[_0x0c26('0xe'),_0x0c26('0xf'),_0x0c26('0xd'),_0x0c26('0x10'),'fax',_0x0c26('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c26('0x12'),'hooks':{'afterCreate':function(_0x109e93,_0x228cf9,_0x4a3a64){var _0x2ee585=_0x26e8fb['models'];var _0x399208=_0x109e93[_0x0c26('0x13')]({'plain':!![]});function _0x3e54a5(){return function(_0x56bace){logger[_0x0c26('0x14')](_0x0c26('0x15'),_0x0c26('0x16'),util[_0x0c26('0x17')](_0x56bace,{'showHidden':![],'depth':null}));};}function _0x321f0a(_0x3ee20b,_0x200c44){var _0x4e8c9c=_0x200c44['scheduledat']?_0x200c44['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19'));return new BPromise(function(_0x5f1b69,_0xd4cf4b){if(_[_0x0c26('0x1a')](_0x200c44['dialTimezone'])){_0x5f1b69({'ret':_0x4e8c9c});}else{_0x2ee585['VoiceQueue']['findOne']({'where':{'id':_0x3ee20b['id']}})[_0x0c26('0x1b')](function(_0x2baead){if(!_[_0x0c26('0x1a')](_0x2baead)){var _0x2c5d7d=_0x2baead[_0x0c26('0x1c')];if(!_['isNil'](_0x2c5d7d)){var _0x1b89e8=shared[_0x0c26('0x1d')];var _0x154022=_0x1b89e8[_0x2c5d7d];var _0x5be41d=_0x1b89e8[_0x200c44['dialTimezone']];if(!_[_0x0c26('0x1a')](_0x154022)&&!_['isNil'](_0x5be41d)){var _0x44e30f=_0x154022[_0x0c26('0x1e')]-_0x5be41d[_0x0c26('0x1e')];_0x4e8c9c=_0x200c44[_0x0c26('0x1f')]?_0x200c44[_0x0c26('0x1f')]:moment();var _0x5740a9=moment(_0x4e8c9c)[_0x0c26('0x20')](_0x44e30f,_0x0c26('0x21'));_0x5f1b69({'ret':_0x5740a9[_0x0c26('0x18')](_0x0c26('0x19'))});}else _0x5f1b69({'ret':_0x4e8c9c});}else _0x5f1b69({'ret':_0x4e8c9c});}else{_0x5f1b69({'ret':_0x4e8c9c});}});}});return 0xa;}var _0x35c507=function(_0x321252){return new BPromise(function(_0x4d39e8,_0x40f3af){_0x321f0a(_0x321252,_0x399208)[_0x0c26('0x1b')](function(_0x5f5e2a){_0x399208[_0x0c26('0x1f')]=_0x5f5e2a['ret'];_0x2ee585[_0x0c26('0x22')]['findOne']({'where':{'phone':_0x399208[_0x0c26('0xd')],'VoiceQueueId':_0x321252['id']}})[_0x0c26('0x1b')](function(_0x4c425b){if(!_[_0x0c26('0x1a')](_0x4c425b)){throw new Error(_0x0c26('0x23')+_0x399208['phone']+_0x0c26('0x24')+_0x321252['id']);}return _0x2ee585['CmHopper']['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'priority':_0x399208['priority']?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208['callbackUniqueid']?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208['callbackUniqueid']?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0x321252['id']});})['catch'](function(_0x1e62c2){_0x40f3af(_0x1e62c2);});});});};var _0x2e8b2f=function(_0xc05f99){return new BPromise(function(_0x546df4,_0x5c10df){_0x321f0a(_0xc05f99,_0x399208)[_0x0c26('0x1b')](function(_0x1b8f30){_0x399208[_0x0c26('0x1f')]=_0x1b8f30[_0x0c26('0x27')];_0x2ee585[_0x0c26('0x22')][_0x0c26('0x28')]({'where':{'phone':_0x399208[_0x0c26('0xd')],'VoiceQueueId':_0xc05f99['id']}})[_0x0c26('0x1b')](function(_0x4d2e73){if(!_[_0x0c26('0x1a')](_0x4d2e73)){throw new Error('cmContact,\x20afterCreate\x20'+_0x399208[_0x0c26('0xd')]+_0x0c26('0x29')+_0xc05f99['id']);}return _0x2ee585[_0x0c26('0x2a')]['findOne']({'where':{'calleridnum':_0x399208['phone'],'VoiceQueueId':_0xc05f99['id']}});})['then'](function(_0x3b50e0){if(!_[_0x0c26('0x1a')](_0x3b50e0)){throw new Error(_0x0c26('0x2b')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x2c')+_0xc05f99['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()['format'](_0x0c26('0x19')),'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0xc05f99['id']});})[_0x0c26('0x2e')](function(_0x484092){_0x5c10df(_0x484092);});});});};function _0x330edd(){return function(_0xd83478){logger[_0x0c26('0x14')](_0x0c26('0x15'),'afterCreate',util[_0x0c26('0x17')](_0xd83478,{'showHidden':![],'depth':null}));};}function _0x1ee6d4(_0x54e3a9,_0x1dc745){var _0x1bf819=_0x1dc745[_0x0c26('0x1f')]?_0x1dc745[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')](_0x0c26('0x19'));return new BPromise(function(_0xb19b48,_0x1a2c82){if(_[_0x0c26('0x1a')](_0x1dc745[_0x0c26('0x1c')])){_0xb19b48({'ret':_0x1bf819});}else{_0x2ee585['Campaign'][_0x0c26('0x28')]({'where':{'id':_0x54e3a9['id']}})[_0x0c26('0x1b')](function(_0x4f9658){if(!_[_0x0c26('0x1a')](_0x4f9658)){var _0x4314b3=_0x4f9658[_0x0c26('0x1c')];if(!_['isNil'](_0x4314b3)){var _0x1e2393=shared[_0x0c26('0x1d')];var _0x279682=_0x1e2393[_0x4314b3];var _0x3da8df=_0x1e2393[_0x1dc745['dialTimezone']];if(!_[_0x0c26('0x1a')](_0x279682)&&!_['isNil'](_0x3da8df)){var _0x2c573a=_0x279682['utcOffset']-_0x3da8df[_0x0c26('0x1e')];_0x1bf819=_0x1dc745[_0x0c26('0x1f')]?_0x1dc745[_0x0c26('0x1f')]:moment();var _0x27afe5=moment(_0x1bf819)[_0x0c26('0x20')](_0x2c573a,'minutes');_0xb19b48({'ret':_0x27afe5[_0x0c26('0x18')](_0x0c26('0x19'))});}else _0xb19b48({'ret':_0x1bf819});}else _0xb19b48({'ret':_0x1bf819});}else{_0xb19b48({'ret':_0x1bf819});}});}});return 0xa;}var _0x277508=function(_0x67da2b){return new BPromise(function(_0x11ef2e,_0x442566){_0x1ee6d4(_0x67da2b,_0x399208)[_0x0c26('0x1b')](function(_0x270bf9){_0x399208[_0x0c26('0x1f')]=_0x270bf9[_0x0c26('0x27')];_0x2ee585[_0x0c26('0x22')]['findOne']({'where':{'phone':_0x399208[_0x0c26('0xd')],'CampaignId':_0x67da2b['id']}})['then'](function(_0xa6bb73){if(!_[_0x0c26('0x1a')](_0xa6bb73)){throw new Error(_0x0c26('0x23')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x2f')+_0x67da2b['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'priority':_0x399208['priority']?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208['callbackUniqueid']?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'CampaignId':_0x67da2b['id']});})[_0x0c26('0x2e')](function(_0xd879e9){_0x442566(_0xd879e9);});});});};var _0x1e8b4b=function(_0x533948){return new BPromise(function(_0x2eaa6d,_0x34dbfe){_0x1ee6d4(_0x533948,_0x399208)[_0x0c26('0x1b')](function(_0x3bb8fc){_0x399208[_0x0c26('0x1f')]=_0x3bb8fc[_0x0c26('0x27')];_0x2ee585['CmHopper'][_0x0c26('0x28')]({'where':{'phone':_0x399208[_0x0c26('0xd')],'CampaignId':_0x533948['id']}})[_0x0c26('0x1b')](function(_0x20016b){if(!_['isNil'](_0x20016b)){throw new Error(_0x0c26('0x23')+_0x399208[_0x0c26('0xd')]+_0x0c26('0x30')+_0x533948['id']);}return _0x2ee585['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x399208['phone'],'CampaignId':_0x533948['id']}});})[_0x0c26('0x1b')](function(_0x202f95){if(!_[_0x0c26('0x1a')](_0x202f95)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x399208[_0x0c26('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x533948['id']);}return _0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208['scheduledat']:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()['format'](_0x0c26('0x19')):undefined,'CampaignId':_0x533948['id']});})[_0x0c26('0x2e')](function(_0x4195c2){_0x34dbfe(_0x4195c2);});});});};if(_0x399208[_0x0c26('0x2d')]){_0x2ee585['VoiceQueue']['findAll']({'where':{'type':_0x0c26('0x31')},'attributes':['id','dialCheckDuplicateType',_0x0c26('0x1c')],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x33'),'where':{'id':_0x399208['ListId']}}]})[_0x0c26('0x1b')](function(_0x3d8ea9){if(_0x3d8ea9){var _0x590bfe=[];for(var _0x2a6d4f=0x0,_0x11ae46;_0x2a6d4f<_0x3d8ea9[_0x0c26('0x34')];_0x2a6d4f+=0x1){_0x11ae46=_0x3d8ea9[_0x2a6d4f][_0x0c26('0x13')]({'plain':!![]});switch(_0x11ae46[_0x0c26('0x35')]){case _0x0c26('0x36'):_0x2e8b2f(_0x11ae46)[_0x0c26('0x2e')](_0x3e54a5());break;case _0x0c26('0x37'):_0x35c507(_0x11ae46)['catch'](_0x3e54a5());break;default:_0x1ee6d4(_0x11ae46,_0x399208)['then'](function(_0x3dd535){_0x399208[_0x0c26('0x1f')]=_0x3dd535['ret'];_0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208['phone'],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'scheduledat':_0x399208[_0x0c26('0x1f')]?_0x399208[_0x0c26('0x1f')]:moment()['format'](_0x0c26('0x19')),'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'callback':_0x399208['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'VoiceQueueId':_0x11ae46['id']})[_0x0c26('0x2e')](_0x3e54a5());});}}}})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x38')][_0x0c26('0x39')]({'where':{'type':_0x0c26('0x31')},'attributes':['id'],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x3a'),'where':{'id':_0x399208[_0x0c26('0x2d')]}}]})[_0x0c26('0x1b')](function(_0x381b34){if(_0x381b34){var _0x263bf5=[];for(var _0x42b341=0x0,_0x2c6658;_0x42b341<_0x381b34[_0x0c26('0x34')];_0x42b341+=0x1){_0x2c6658=_0x381b34[_0x42b341][_0x0c26('0x13')]({'plain':!![]});_0x2ee585['CmHopperBlack'][_0x0c26('0x3b')]({'phone':_0x399208['phone'],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'VoiceQueueId':_0x2c6658['id']})['catch'](function(_0xb26a91){logger[_0x0c26('0x14')](_0x0c26('0x3c'),_0x0c26('0x16'),_0xb26a91[_0x0c26('0x3d')]);});}}});})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x3e')]['findAll']({'attributes':['id','dialCheckDuplicateType',_0x0c26('0x1c')],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x33'),'where':{'id':_0x399208['ListId']}}]})[_0x0c26('0x1b')](function(_0x198019){if(_0x198019){var _0x223449=[];for(var _0x4f93cf=0x0,_0x3294b2;_0x4f93cf<_0x198019[_0x0c26('0x34')];_0x4f93cf+=0x1){_0x3294b2=_0x198019[_0x4f93cf]['get']({'plain':!![]});switch(_0x3294b2[_0x0c26('0x35')]){case _0x0c26('0x36'):_0x1e8b4b(_0x3294b2)[_0x0c26('0x2e')](_0x330edd());break;case _0x0c26('0x37'):_0x277508(_0x3294b2)[_0x0c26('0x2e')](_0x330edd());break;default:_0x2ee585[_0x0c26('0x22')]['create']({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208['ListId'],'scheduledat':_0x399208['scheduledat']?_0x399208[_0x0c26('0x1f')]:moment()[_0x0c26('0x18')](_0x0c26('0x19')),'priority':_0x399208[_0x0c26('0x25')]?_0x399208[_0x0c26('0x25')]:0x2,'callback':_0x399208[_0x0c26('0x26')]?!![]:![],'callbackuniqueid':_0x399208[_0x0c26('0x26')]?_0x399208[_0x0c26('0x26')]:undefined,'callbackat':_0x399208[_0x0c26('0x26')]?moment()[_0x0c26('0x18')](_0x0c26('0x19')):undefined,'CampaignId':_0x3294b2['id']})[_0x0c26('0x2e')](_0x330edd());}}}});})[_0x0c26('0x1b')](function(){return _0x2ee585[_0x0c26('0x3e')]['findAll']({'attributes':['id'],'include':[{'model':_0x2ee585[_0x0c26('0x32')],'as':_0x0c26('0x3a'),'where':{'id':_0x399208[_0x0c26('0x2d')]}}]})[_0x0c26('0x1b')](function(_0x1bc91f){if(_0x1bc91f){var _0x4d0d52=[];for(var _0x399e4f=0x0,_0x3e1376;_0x399e4f<_0x1bc91f[_0x0c26('0x34')];_0x399e4f+=0x1){_0x3e1376=_0x1bc91f[_0x399e4f][_0x0c26('0x13')]({'plain':!![]});_0x2ee585[_0x0c26('0x3f')][_0x0c26('0x3b')]({'phone':_0x399208[_0x0c26('0xd')],'ContactId':_0x399208['id'],'ListId':_0x399208[_0x0c26('0x2d')],'CampaignId':_0x3e1376['id']})[_0x0c26('0x2e')](function(_0x244ecd){logger['error'](_0x0c26('0x3c'),'afterCreate',_0x244ecd[_0x0c26('0x3d')]);});}}});})[_0x0c26('0x1b')](function(){_0x4a3a64();})[_0x0c26('0x2e')](function(_0x1f60a6){logger[_0x0c26('0x14')](_0x0c26('0x3c'),_0x0c26('0x16'),_0x1f60a6['message']);_0x4a3a64(_0x1f60a6);});}else{_0x4a3a64(new Error(_0x0c26('0x40')));}},'afterDestroy':function(_0x534aae,_0xa41ac2,_0x438d36){var _0x48d329=_0x26e8fb[_0x0c26('0x41')];var _0x10fb0c=_0x534aae[_0x0c26('0x13')]({'plain':!![]});return _0x48d329['CmHopper'][_0x0c26('0x39')]({'raw':!![],'where':{'ListId':_0x10fb0c['ListId'],'ContactId':_0x10fb0c['id']}})['then'](function(_0xda5b4){if(!_[_0x0c26('0x42')](_0xda5b4)){var _0x57ac1e=[];for(var _0x25401f=0x0;_0x25401f<_0xda5b4[_0x0c26('0x34')];_0x25401f+=0x1){var _0xcba86f=_0x48d329[_0x0c26('0x22')][_0x0c26('0x43')]({'where':{'ListId':_0xda5b4[_0x25401f][_0x0c26('0x2d')],'ContactId':_0xda5b4[_0x25401f][_0x0c26('0x44')],'VoiceQueueId':_0xda5b4[_0x25401f][_0x0c26('0x45')],'CampaignId':_0xda5b4[_0x25401f][_0x0c26('0x46')]}});_0x57ac1e['push'](_0xcba86f);}return BPromise['all'](_0x57ac1e);}})['then'](function(_0x3d62aa){logger[_0x0c26('0x47')](_0x0c26('0x48'),util[_0x0c26('0x17')](_0x3d62aa,{'showHidden':![],'depth':null}));_0x438d36();})[_0x0c26('0x2e')](function(_0x20c678){logger[_0x0c26('0x14')](_0x0c26('0x49'),util[_0x0c26('0x17')](_0x20c678,{'showHidden':![],'depth':null}));_0x438d36(_0x20c678);});}}});}; \ No newline at end of file +var _0x7d87=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','catch','Campaign','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','length','message','List\x20not\x20found','isEmpty','ContactId','push','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','ret'];(function(_0xb37bca,_0x25064f){var _0x12a0ab=function(_0x47df85){while(--_0x47df85){_0xb37bca['push'](_0xb37bca['shift']());}};_0x12a0ab(++_0x25064f);}(_0x7d87,0x6a));var _0x77d8=function(_0x1ee5ef,_0x38d42b){_0x1ee5ef=_0x1ee5ef-0x0;var _0x448ab8=_0x7d87[_0x1ee5ef];return _0x448ab8;};'use strict';var _=require(_0x77d8('0x0'));var util=require('util');var logger=require(_0x77d8('0x1'))(_0x77d8('0x2'));var moment=require('moment');var BPromise=require(_0x77d8('0x3'));var rp=require(_0x77d8('0x4'));var fs=require('fs');var path=require(_0x77d8('0x5'));var rimraf=require(_0x77d8('0x6'));var config=require(_0x77d8('0x7'));var shared=require(_0x77d8('0x8'));var attributes=require(_0x77d8('0x9'));module[_0x77d8('0xa')]=function(_0x5eb9e2,_0x41bfd3){return _0x5eb9e2[_0x77d8('0xb')](_0x77d8('0xc'),attributes,{'tableName':_0x77d8('0xd'),'paranoid':!![],'indexes':[{'name':_0x77d8('0xe'),'fields':[_0x77d8('0xe')]},{'name':_0x77d8('0xf'),'fields':[_0x77d8('0x10'),_0x77d8('0x11'),_0x77d8('0xe'),_0x77d8('0x12'),'fax','email'],'type':_0x77d8('0x13')}],'timestamps':!![],'charset':_0x77d8('0x14'),'collate':_0x77d8('0x15'),'hooks':{'afterCreate':function(_0xbc13da,_0x5325d3,_0x2cb32e){var _0x35a082=_0x5eb9e2[_0x77d8('0x16')];var _0x2bdc71=_0xbc13da[_0x77d8('0x17')]({'plain':!![]});function _0x4f8cb1(){return function(_0x1adc93){logger[_0x77d8('0x18')](_0x77d8('0x19'),_0x77d8('0x1a'),util['inspect'](_0x1adc93,{'showHidden':![],'depth':null}));};}function _0x3b1bdb(_0x2d155a,_0x15584c){var _0x4961cd=_0x15584c[_0x77d8('0x1b')]?_0x15584c[_0x77d8('0x1b')]:moment()[_0x77d8('0x1c')](_0x77d8('0x1d'));return new BPromise(function(_0x283cd7,_0xd1772c){if(_['isNil'](_0x15584c[_0x77d8('0x1e')])){_0x283cd7({'ret':_0x4961cd});}else{_0x35a082[_0x77d8('0x1f')][_0x77d8('0x20')]({'where':{'id':_0x2d155a['id']}})[_0x77d8('0x21')](function(_0x4359e7){if(!_[_0x77d8('0x22')](_0x4359e7)){var _0x300302=_0x4359e7[_0x77d8('0x1e')];if(!_[_0x77d8('0x22')](_0x300302)){var _0x33b185=shared[_0x77d8('0x23')];var _0x4ba767=_0x33b185[_0x300302];var _0xd51263=_0x33b185[_0x15584c[_0x77d8('0x1e')]];if(!_[_0x77d8('0x22')](_0x4ba767)&&!_[_0x77d8('0x22')](_0xd51263)){var _0x44dadf=_0x4ba767['utcOffset']-_0xd51263[_0x77d8('0x24')];_0x4961cd=_0x15584c['scheduledat']?_0x15584c['scheduledat']:moment();var _0x4b98dc=moment(_0x4961cd)[_0x77d8('0x25')](_0x44dadf,_0x77d8('0x26'));_0x283cd7({'ret':_0x4b98dc[_0x77d8('0x1c')](_0x77d8('0x1d'))});}else _0x283cd7({'ret':_0x4961cd});}else _0x283cd7({'ret':_0x4961cd});}else{_0x283cd7({'ret':_0x4961cd});}});}});return 0xa;}var _0x13dae4=function(_0x32f5ad){return new BPromise(function(_0x2b2375,_0x3ebfa3){_0x3b1bdb(_0x32f5ad,_0x2bdc71)[_0x77d8('0x21')](function(_0x124c21){_0x2bdc71[_0x77d8('0x1b')]=_0x124c21[_0x77d8('0x27')];_0x35a082['CmHopper']['findOne']({'where':{'phone':_0x2bdc71[_0x77d8('0xe')],'VoiceQueueId':_0x32f5ad['id']}})[_0x77d8('0x21')](function(_0x29828b){if(!_[_0x77d8('0x22')](_0x29828b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2bdc71[_0x77d8('0xe')]+_0x77d8('0x28')+_0x32f5ad['id']);}return _0x35a082[_0x77d8('0x29')][_0x77d8('0x2a')]({'phone':_0x2bdc71['phone'],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71['ListId'],'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71['scheduledat']:moment()[_0x77d8('0x1c')](_0x77d8('0x1d')),'callback':_0x2bdc71[_0x77d8('0x2c')]?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71[_0x77d8('0x2c')]:undefined,'callbackat':_0x2bdc71['callbackUniqueid']?moment()[_0x77d8('0x1c')](_0x77d8('0x1d')):undefined,'VoiceQueueId':_0x32f5ad['id']});})['catch'](function(_0x26ee60){_0x3ebfa3(_0x26ee60);});});});};var _0x3a69b6=function(_0xf70bd8){return new BPromise(function(_0x1d2b8d,_0x82d983){_0x3b1bdb(_0xf70bd8,_0x2bdc71)[_0x77d8('0x21')](function(_0x99c254){_0x2bdc71[_0x77d8('0x1b')]=_0x99c254[_0x77d8('0x27')];_0x35a082[_0x77d8('0x29')][_0x77d8('0x20')]({'where':{'phone':_0x2bdc71[_0x77d8('0xe')],'VoiceQueueId':_0xf70bd8['id']}})[_0x77d8('0x21')](function(_0x5bf7de){if(!_[_0x77d8('0x22')](_0x5bf7de)){throw new Error('cmContact,\x20afterCreate\x20'+_0x2bdc71[_0x77d8('0xe')]+_0x77d8('0x2d')+_0xf70bd8['id']);}return _0x35a082[_0x77d8('0x2e')][_0x77d8('0x20')]({'where':{'calleridnum':_0x2bdc71[_0x77d8('0xe')],'VoiceQueueId':_0xf70bd8['id']}});})[_0x77d8('0x21')](function(_0x2e1e52){if(!_['isNil'](_0x2e1e52)){throw new Error(_0x77d8('0x2f')+_0x2bdc71[_0x77d8('0xe')]+_0x77d8('0x30')+_0xf70bd8['id']);}return _0x35a082['CmHopper'][_0x77d8('0x2a')]({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71[_0x77d8('0x1b')]:moment()[_0x77d8('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2bdc71[_0x77d8('0x2c')]?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71[_0x77d8('0x2c')]:undefined,'callbackat':_0x2bdc71[_0x77d8('0x2c')]?moment()['format'](_0x77d8('0x1d')):undefined,'VoiceQueueId':_0xf70bd8['id']});})[_0x77d8('0x32')](function(_0x51aa05){_0x82d983(_0x51aa05);});});});};function _0x8dad78(){return function(_0x5f067e){logger[_0x77d8('0x18')](_0x77d8('0x19'),_0x77d8('0x1a'),util['inspect'](_0x5f067e,{'showHidden':![],'depth':null}));};}function _0x266090(_0x47c5d1,_0x2732cb){var _0x5011d5=_0x2732cb[_0x77d8('0x1b')]?_0x2732cb['scheduledat']:moment()[_0x77d8('0x1c')](_0x77d8('0x1d'));return new BPromise(function(_0x439bb5,_0x542357){if(_[_0x77d8('0x22')](_0x2732cb[_0x77d8('0x1e')])){_0x439bb5({'ret':_0x5011d5});}else{_0x35a082[_0x77d8('0x33')]['findOne']({'where':{'id':_0x47c5d1['id']}})['then'](function(_0x19eff7){if(!_['isNil'](_0x19eff7)){var _0x31da49=_0x19eff7['dialTimezone'];if(!_['isNil'](_0x31da49)){var _0x4949ca=shared[_0x77d8('0x23')];var _0x32607e=_0x4949ca[_0x31da49];var _0x64ccb4=_0x4949ca[_0x2732cb['dialTimezone']];if(!_[_0x77d8('0x22')](_0x32607e)&&!_['isNil'](_0x64ccb4)){var _0x150c23=_0x32607e[_0x77d8('0x24')]-_0x64ccb4[_0x77d8('0x24')];_0x5011d5=_0x2732cb['scheduledat']?_0x2732cb[_0x77d8('0x1b')]:moment();var _0x4f388e=moment(_0x5011d5)[_0x77d8('0x25')](_0x150c23,_0x77d8('0x26'));_0x439bb5({'ret':_0x4f388e[_0x77d8('0x1c')](_0x77d8('0x1d'))});}else _0x439bb5({'ret':_0x5011d5});}else _0x439bb5({'ret':_0x5011d5});}else{_0x439bb5({'ret':_0x5011d5});}});}});return 0xa;}var _0x3a7de7=function(_0x1ec970){return new BPromise(function(_0x1bee7d,_0x54300a){_0x266090(_0x1ec970,_0x2bdc71)[_0x77d8('0x21')](function(_0x4b5a76){_0x2bdc71[_0x77d8('0x1b')]=_0x4b5a76['ret'];_0x35a082[_0x77d8('0x29')][_0x77d8('0x20')]({'where':{'phone':_0x2bdc71[_0x77d8('0xe')],'CampaignId':_0x1ec970['id']}})[_0x77d8('0x21')](function(_0xf4c4d0){if(!_[_0x77d8('0x22')](_0xf4c4d0)){throw new Error(_0x77d8('0x34')+_0x2bdc71[_0x77d8('0xe')]+_0x77d8('0x35')+_0x1ec970['id']);}return _0x35a082['CmHopper'][_0x77d8('0x2a')]({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71[_0x77d8('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2bdc71['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71[_0x77d8('0x2c')]:undefined,'callbackat':_0x2bdc71['callbackUniqueid']?moment()[_0x77d8('0x1c')](_0x77d8('0x1d')):undefined,'CampaignId':_0x1ec970['id']});})[_0x77d8('0x32')](function(_0x1a98a6){_0x54300a(_0x1a98a6);});});});};var _0x37b120=function(_0x2e1988){return new BPromise(function(_0x318c17,_0x58fb2e){_0x266090(_0x2e1988,_0x2bdc71)[_0x77d8('0x21')](function(_0x8ce31){_0x2bdc71[_0x77d8('0x1b')]=_0x8ce31[_0x77d8('0x27')];_0x35a082[_0x77d8('0x29')][_0x77d8('0x20')]({'where':{'phone':_0x2bdc71[_0x77d8('0xe')],'CampaignId':_0x2e1988['id']}})[_0x77d8('0x21')](function(_0x35eea3){if(!_[_0x77d8('0x22')](_0x35eea3)){throw new Error(_0x77d8('0x34')+_0x2bdc71['phone']+_0x77d8('0x36')+_0x2e1988['id']);}return _0x35a082[_0x77d8('0x2e')][_0x77d8('0x20')]({'where':{'calleridnum':_0x2bdc71['phone'],'CampaignId':_0x2e1988['id']}});})[_0x77d8('0x21')](function(_0x3e3d82){if(!_[_0x77d8('0x22')](_0x3e3d82)){throw new Error(_0x77d8('0x2f')+_0x2bdc71[_0x77d8('0xe')]+_0x77d8('0x37')+_0x2e1988['id']);}return _0x35a082[_0x77d8('0x29')]['create']({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71['scheduledat']:moment()[_0x77d8('0x1c')](_0x77d8('0x1d')),'callback':_0x2bdc71[_0x77d8('0x2c')]?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71[_0x77d8('0x2c')]:undefined,'callbackat':_0x2bdc71[_0x77d8('0x2c')]?moment()[_0x77d8('0x1c')](_0x77d8('0x1d')):undefined,'CampaignId':_0x2e1988['id']});})[_0x77d8('0x32')](function(_0x2eda23){_0x58fb2e(_0x2eda23);});});});};if(_0x2bdc71[_0x77d8('0x31')]){_0x35a082[_0x77d8('0x1f')][_0x77d8('0x38')]({'where':{'type':_0x77d8('0x39')},'attributes':['id',_0x77d8('0x3a'),_0x77d8('0x1e')],'include':[{'model':_0x35a082[_0x77d8('0x3b')],'as':'Lists','where':{'id':_0x2bdc71[_0x77d8('0x31')]}}]})['then'](function(_0x131a0e){if(_0x131a0e){var _0x377209=[];for(var _0x478f9f=0x0,_0x5c4620;_0x478f9f<_0x131a0e['length'];_0x478f9f+=0x1){_0x5c4620=_0x131a0e[_0x478f9f][_0x77d8('0x17')]({'plain':!![]});switch(_0x5c4620[_0x77d8('0x3a')]){case _0x77d8('0x3c'):_0x3a69b6(_0x5c4620)[_0x77d8('0x32')](_0x4f8cb1());break;case _0x77d8('0x3d'):_0x13dae4(_0x5c4620)[_0x77d8('0x32')](_0x4f8cb1());break;default:_0x266090(_0x5c4620,_0x2bdc71)['then'](function(_0x38ea0b){_0x2bdc71['scheduledat']=_0x38ea0b[_0x77d8('0x27')];_0x35a082['CmHopper']['create']({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71[_0x77d8('0x1b')]:moment()[_0x77d8('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'callback':_0x2bdc71[_0x77d8('0x2c')]?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71['callbackUniqueid']:undefined,'callbackat':_0x2bdc71[_0x77d8('0x2c')]?moment()[_0x77d8('0x1c')](_0x77d8('0x1d')):undefined,'VoiceQueueId':_0x5c4620['id']})[_0x77d8('0x32')](_0x4f8cb1());});}}}})['then'](function(){return _0x35a082['VoiceQueue'][_0x77d8('0x38')]({'where':{'type':_0x77d8('0x39')},'attributes':['id'],'include':[{'model':_0x35a082[_0x77d8('0x3b')],'as':_0x77d8('0x3e'),'where':{'id':_0x2bdc71['ListId']}}]})[_0x77d8('0x21')](function(_0x2cb28a){if(_0x2cb28a){var _0xb525a9=[];for(var _0xbc4637=0x0,_0x7f0c18;_0xbc4637<_0x2cb28a['length'];_0xbc4637+=0x1){_0x7f0c18=_0x2cb28a[_0xbc4637][_0x77d8('0x17')]({'plain':!![]});_0x35a082['CmHopperBlack']['create']({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'VoiceQueueId':_0x7f0c18['id']})['catch'](function(_0x27e66d){logger['error'](_0x77d8('0x3f'),_0x77d8('0x1a'),_0x27e66d['message']);});}}});})[_0x77d8('0x21')](function(){return _0x35a082[_0x77d8('0x33')][_0x77d8('0x38')]({'attributes':['id',_0x77d8('0x3a'),_0x77d8('0x1e')],'include':[{'model':_0x35a082['CmList'],'as':'Lists','where':{'id':_0x2bdc71[_0x77d8('0x31')]}}]})['then'](function(_0x34ef17){if(_0x34ef17){var _0x5f4537=[];for(var _0x3d5044=0x0,_0x18cbce;_0x3d5044<_0x34ef17[_0x77d8('0x40')];_0x3d5044+=0x1){_0x18cbce=_0x34ef17[_0x3d5044]['get']({'plain':!![]});switch(_0x18cbce['dialCheckDuplicateType']){case _0x77d8('0x3c'):_0x37b120(_0x18cbce)[_0x77d8('0x32')](_0x8dad78());break;case'onlyIfOpen':_0x3a7de7(_0x18cbce)[_0x77d8('0x32')](_0x8dad78());break;default:_0x35a082[_0x77d8('0x29')][_0x77d8('0x2a')]({'phone':_0x2bdc71['phone'],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71[_0x77d8('0x31')],'scheduledat':_0x2bdc71[_0x77d8('0x1b')]?_0x2bdc71['scheduledat']:moment()[_0x77d8('0x1c')](_0x77d8('0x1d')),'priority':_0x2bdc71[_0x77d8('0x2b')]?_0x2bdc71[_0x77d8('0x2b')]:0x2,'callback':_0x2bdc71[_0x77d8('0x2c')]?!![]:![],'callbackuniqueid':_0x2bdc71[_0x77d8('0x2c')]?_0x2bdc71['callbackUniqueid']:undefined,'callbackat':_0x2bdc71[_0x77d8('0x2c')]?moment()[_0x77d8('0x1c')](_0x77d8('0x1d')):undefined,'CampaignId':_0x18cbce['id']})['catch'](_0x8dad78());}}}});})['then'](function(){return _0x35a082[_0x77d8('0x33')][_0x77d8('0x38')]({'attributes':['id'],'include':[{'model':_0x35a082['CmList'],'as':'BlackLists','where':{'id':_0x2bdc71[_0x77d8('0x31')]}}]})['then'](function(_0x46a6dd){if(_0x46a6dd){var _0x267233=[];for(var _0x1be009=0x0,_0x310ced;_0x1be009<_0x46a6dd[_0x77d8('0x40')];_0x1be009+=0x1){_0x310ced=_0x46a6dd[_0x1be009][_0x77d8('0x17')]({'plain':!![]});_0x35a082['CmHopperBlack'][_0x77d8('0x2a')]({'phone':_0x2bdc71[_0x77d8('0xe')],'ContactId':_0x2bdc71['id'],'ListId':_0x2bdc71['ListId'],'CampaignId':_0x310ced['id']})[_0x77d8('0x32')](function(_0x1d43e3){logger[_0x77d8('0x18')](_0x77d8('0x3f'),'afterCreate',_0x1d43e3[_0x77d8('0x41')]);});}}});})[_0x77d8('0x21')](function(){_0x2cb32e();})['catch'](function(_0x3c2420){logger[_0x77d8('0x18')](_0x77d8('0x3f'),_0x77d8('0x1a'),_0x3c2420[_0x77d8('0x41')]);_0x2cb32e(_0x3c2420);});}else{_0x2cb32e(new Error(_0x77d8('0x42')));}},'afterDestroy':function(_0x3fec8c,_0x5ab16a,_0x2421b2){var _0x59cc51=_0x5eb9e2[_0x77d8('0x16')];var _0x32ea49=_0x3fec8c[_0x77d8('0x17')]({'plain':!![]});return _0x59cc51[_0x77d8('0x29')][_0x77d8('0x38')]({'raw':!![],'where':{'ListId':_0x32ea49[_0x77d8('0x31')],'ContactId':_0x32ea49['id']}})['then'](function(_0x30b12c){if(!_[_0x77d8('0x43')](_0x30b12c)){var _0x4e4eeb=[];for(var _0x520159=0x0;_0x520159<_0x30b12c[_0x77d8('0x40')];_0x520159+=0x1){var _0x53de1c=_0x59cc51[_0x77d8('0x29')]['destroy']({'where':{'ListId':_0x30b12c[_0x520159][_0x77d8('0x31')],'ContactId':_0x30b12c[_0x520159][_0x77d8('0x44')],'VoiceQueueId':_0x30b12c[_0x520159]['VoiceQueueId'],'CampaignId':_0x30b12c[_0x520159]['CampaignId']}});_0x4e4eeb[_0x77d8('0x45')](_0x53de1c);}return BPromise['all'](_0x4e4eeb);}})['then'](function(_0x675d9b){logger['info'](_0x77d8('0x46'),util['inspect'](_0x675d9b,{'showHidden':![],'depth':null}));_0x2421b2();})[_0x77d8('0x32')](function(_0x3534fb){logger[_0x77d8('0x18')](_0x77d8('0x47'),util[_0x77d8('0x48')](_0x3534fb,{'showHidden':![],'depth':null}));_0x2421b2(_0x3534fb);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 81a521f..03c1d09 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x344a96,_0x57dd56){var _0x77e6b7=function(_0x43e9e2){while(--_0x43e9e2){_0x344a96['push'](_0x344a96['shift']());}};_0x77e6b7(++_0x57dd56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index b740f2e..4b4e624 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['STRING','INTEGER','sequelize','exports'];(function(_0x2f72f8,_0x3b1def){var _0x1b66c2=function(_0x33dc49){while(--_0x33dc49){_0x2f72f8['push'](_0x2f72f8['shift']());}};_0x1b66c2(++_0x3b1def);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2ca4d7,_0x1bdb7b){_0x2ca4d7=_0x2ca4d7-0x0;var _0x61a725=_0xb43b[_0x2ca4d7];return _0x61a725;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3cd1=['STRING','PHONE','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3cd1,0x112));var _0x13cd=function(_0x181b23,_0x3ed1a2){_0x181b23=_0x181b23-0x0;var _0x29bd87=_0x3cd1[_0x181b23];return _0x29bd87;};'use strict';var Sequelize=require('sequelize');module[_0x13cd('0x0')]={'CmContactId':{'type':Sequelize[_0x13cd('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x13cd('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x13cd('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x13cd('0x2')],'defaultValue':_0x13cd('0x3')},'OrderBy':{'type':Sequelize[_0x13cd('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x13cd('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index f6fbb6f..1543c22 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7af=['query','keys','filters','intersection','fields','attributes','length','order','sort','pick','where','merge','map','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xc7af,0x10f));var _0xfc7a=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xc7af[_0x36feb2];return _0x292b43;};'use strict';var emlformat=require(_0xfc7a('0x0'));var rimraf=require(_0xfc7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc7a('0x2'));var rp=require(_0xfc7a('0x3'));var moment=require('moment');var BPromise=require(_0xfc7a('0x4'));var Mustache=require(_0xfc7a('0x5'));var util=require('util');var path=require(_0xfc7a('0x6'));var sox=require('sox');var csv=require(_0xfc7a('0x7'));var ejs=require(_0xfc7a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc7a('0x9'));var squel=require(_0xfc7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xfc7a('0xb'));var deskjs=require(_0xfc7a('0xc'));var toCsv=require(_0xfc7a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfc7a('0xd'));var authService=require(_0xfc7a('0xe'));var qs=require(_0xfc7a('0xf'));var as=require(_0xfc7a('0x10'));var hardwareService=require(_0xfc7a('0x11'));var logger=require('../../config/logger')(_0xfc7a('0x12'));var utils=require(_0xfc7a('0x13'));var config=require(_0xfc7a('0x14'));var licenseUtil=require(_0xfc7a('0x15'));var db=require(_0xfc7a('0x16'))['db'];function respondWithStatusCode(_0x18f28c,_0x121372){_0x121372=_0x121372||0xcc;return function(_0x3e99dd){if(_0x3e99dd){return _0x18f28c[_0xfc7a('0x17')](_0x121372);}return _0x18f28c['status'](_0x121372)[_0xfc7a('0x18')]();};}function respondWithResult(_0x1450c5,_0x10bddf){_0x10bddf=_0x10bddf||0xc8;return function(_0x27c2b7){if(_0x27c2b7){return _0x1450c5[_0xfc7a('0x19')](_0x10bddf)[_0xfc7a('0x1a')](_0x27c2b7);}};}function respondWithFilteredResult(_0x5e8a2b,_0x2e2d5f){return function(_0x3c2f50){if(_0x3c2f50){var _0x443fef=typeof _0x2e2d5f[_0xfc7a('0x1b')]===_0xfc7a('0x1c')&&typeof _0x2e2d5f[_0xfc7a('0x1d')]===_0xfc7a('0x1c');var _0x1fbb9d=_0x3c2f50['count'];var _0xb3ac41=_0x443fef?0x0:_0x2e2d5f[_0xfc7a('0x1b')];var _0x1b3f4f=_0x443fef?_0x3c2f50[_0xfc7a('0x1e')]:_0x2e2d5f[_0xfc7a('0x1b')]+_0x2e2d5f[_0xfc7a('0x1d')];var _0x4b102f;if(_0x1b3f4f>=_0x1fbb9d){_0x1b3f4f=_0x1fbb9d;_0x4b102f=0xc8;}else{_0x4b102f=0xce;}_0x5e8a2b[_0xfc7a('0x19')](_0x4b102f);return _0x5e8a2b[_0xfc7a('0x1f')]('Content-Range',_0xb3ac41+'-'+_0x1b3f4f+'/'+_0x1fbb9d)[_0xfc7a('0x1a')](_0x3c2f50);}return null;};}function patchUpdates(_0x1a072c){return function(_0x1c06a3){try{jsonpatch[_0xfc7a('0x20')](_0x1c06a3,_0x1a072c,!![]);}catch(_0x926868){return BPromise[_0xfc7a('0x21')](_0x926868);}return _0x1c06a3['save']();};}function saveUpdates(_0x1a0499,_0x2c9833){return function(_0x12d5a6){if(_0x12d5a6){return _0x12d5a6[_0xfc7a('0x22')](_0x1a0499)[_0xfc7a('0x23')](function(_0x4d0f5c){return _0x4d0f5c;});}return null;};}function removeEntity(_0x19842a,_0x4fe362){return function(_0x3ae488){if(_0x3ae488){return _0x3ae488[_0xfc7a('0x24')]()[_0xfc7a('0x23')](function(){var _0xf552cc=_0x3ae488[_0xfc7a('0x25')]({'plain':!![]});var _0x1e46db=_0xfc7a('0x26');return db[_0xfc7a('0x27')][_0xfc7a('0x24')]({'where':{'type':_0x1e46db,'resourceId':_0xf552cc['id']}})['then'](function(){return _0x3ae488;});})[_0xfc7a('0x23')](function(){_0x19842a[_0xfc7a('0x19')](0xcc)[_0xfc7a('0x18')]();});}};}function handleEntityNotFound(_0x581de1,_0xd5c485){return function(_0x263f9d){if(!_0x263f9d){_0x581de1[_0xfc7a('0x17')](0x194);}return _0x263f9d;};}function handleError(_0x44ea99,_0x37e2ba){_0x37e2ba=_0x37e2ba||0x1f4;return function(_0x5bccf7){logger[_0xfc7a('0x28')](_0x5bccf7[_0xfc7a('0x29')]);if(_0x5bccf7[_0xfc7a('0x2a')]){delete _0x5bccf7['name'];}_0x44ea99[_0xfc7a('0x19')](_0x37e2ba)[_0xfc7a('0x2b')](_0x5bccf7);};}exports[_0xfc7a('0x2c')]=function(_0x22b07d,_0x5f16a5){var _0x36c868={},_0x1f7454={},_0x4f4de1={'count':0x0,'rows':[]};var _0x4e9204=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x5c8e34){return{'name':_0x5c8e34[_0xfc7a('0x2d')],'type':_0x5c8e34[_0xfc7a('0x2e')][_0xfc7a('0x2f')]};});_0x1f7454[_0xfc7a('0x30')]=_['map'](_0x4e9204,_0xfc7a('0x2a'));_0x1f7454[_0xfc7a('0x31')]=_[_0xfc7a('0x32')](_0x22b07d[_0xfc7a('0x31')]);_0x1f7454[_0xfc7a('0x33')]=_[_0xfc7a('0x34')](_0x1f7454['model'],_0x1f7454['query']);_0x36c868['attributes']=_[_0xfc7a('0x34')](_0x1f7454[_0xfc7a('0x30')],qs['fields'](_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x35')]));_0x36c868[_0xfc7a('0x36')]=_0x36c868[_0xfc7a('0x36')][_0xfc7a('0x37')]?_0x36c868['attributes']:_0x1f7454[_0xfc7a('0x30')];if(!_0x22b07d[_0xfc7a('0x31')]['hasOwnProperty']('nolimit')){_0x36c868[_0xfc7a('0x1d')]=qs[_0xfc7a('0x1d')](_0x22b07d['query'][_0xfc7a('0x1d')]);_0x36c868['offset']=qs[_0xfc7a('0x1b')](_0x22b07d['query'][_0xfc7a('0x1b')]);}_0x36c868[_0xfc7a('0x38')]=qs['sort'](_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x39')]);_0x36c868['where']=qs[_0xfc7a('0x33')](_[_0xfc7a('0x3a')](_0x22b07d[_0xfc7a('0x31')],_0x1f7454[_0xfc7a('0x33')]),_0x4e9204);if(_0x22b07d['query']['filter']){_0x36c868[_0xfc7a('0x3b')]=_[_0xfc7a('0x3c')](_0x36c868[_0xfc7a('0x3b')],{'$or':_[_0xfc7a('0x3d')](_0x4e9204,function(_0x1cc652){if(_0x1cc652['type']!==_0xfc7a('0x3e')){var _0x270e45={};_0x270e45[_0x1cc652[_0xfc7a('0x2a')]]={'$like':'%'+_0x22b07d[_0xfc7a('0x31')]['filter']+'%'};return _0x270e45;}})});}_0x36c868=_[_0xfc7a('0x3c')]({},_0x36c868,_0x22b07d[_0xfc7a('0x3f')]);var _0x18c61d={'where':_0x36c868[_0xfc7a('0x3b')]};return db[_0xfc7a('0x40')][_0xfc7a('0x1e')](_0x18c61d)['then'](function(_0x1735a6){_0x4f4de1[_0xfc7a('0x1e')]=_0x1735a6;if(_0x22b07d[_0xfc7a('0x31')][_0xfc7a('0x41')]){_0x36c868[_0xfc7a('0x42')]=[{'all':!![]}];}return db[_0xfc7a('0x40')][_0xfc7a('0x43')](_0x36c868);})[_0xfc7a('0x23')](function(_0x5da01b){_0x4f4de1[_0xfc7a('0x44')]=_0x5da01b;return _0x4f4de1;})['then'](respondWithFilteredResult(_0x5f16a5,_0x36c868))[_0xfc7a('0x45')](handleError(_0x5f16a5,null));};exports[_0xfc7a('0x46')]=function(_0x11d5d9,_0x2465b6){var _0x13e549={'raw':!![],'where':{'id':_0x11d5d9[_0xfc7a('0x47')]['id']}},_0x4b6660={};_0x4b6660[_0xfc7a('0x30')]=_[_0xfc7a('0x32')](db[_0xfc7a('0x40')]['rawAttributes']);_0x4b6660[_0xfc7a('0x31')]=_['keys'](_0x11d5d9[_0xfc7a('0x31')]);_0x4b6660[_0xfc7a('0x33')]=_[_0xfc7a('0x34')](_0x4b6660[_0xfc7a('0x30')],_0x4b6660[_0xfc7a('0x31')]);_0x13e549[_0xfc7a('0x36')]=_[_0xfc7a('0x34')](_0x4b6660[_0xfc7a('0x30')],qs[_0xfc7a('0x35')](_0x11d5d9[_0xfc7a('0x31')][_0xfc7a('0x35')]));_0x13e549[_0xfc7a('0x36')]=_0x13e549['attributes'][_0xfc7a('0x37')]?_0x13e549['attributes']:_0x4b6660['model'];if(_0x11d5d9[_0xfc7a('0x31')][_0xfc7a('0x41')]){_0x13e549[_0xfc7a('0x42')]=[{'all':!![]}];}_0x13e549=_[_0xfc7a('0x3c')]({},_0x13e549,_0x11d5d9[_0xfc7a('0x3f')]);return db[_0xfc7a('0x40')][_0xfc7a('0x48')](_0x13e549)[_0xfc7a('0x23')](handleEntityNotFound(_0x2465b6,null))[_0xfc7a('0x23')](respondWithResult(_0x2465b6,null))[_0xfc7a('0x45')](handleError(_0x2465b6,null));};exports[_0xfc7a('0x49')]=function(_0x33b68b,_0x1464ed){return db['CmContactHasItem'][_0xfc7a('0x49')](_0x33b68b['body'],{})[_0xfc7a('0x23')](function(_0x484a6e){var _0x4ea3c4=_0x33b68b[_0xfc7a('0x4a')]['get']({'plain':!![]});if(!_0x4ea3c4)throw new Error(_0xfc7a('0x4b'));if(_0x4ea3c4[_0xfc7a('0x4c')]==='user'){var _0x409c89=_0x484a6e[_0xfc7a('0x25')]({'plain':!![]});var _0x6db183='CmContactHasItems';return db[_0xfc7a('0x4d')][_0xfc7a('0x48')]({'where':{'name':_0x6db183,'userProfileId':_0x4ea3c4[_0xfc7a('0x4e')]},'raw':!![]})['then'](function(_0x18ecdf){if(_0x18ecdf&&_0x18ecdf['autoAssociation']===0x0){return db[_0xfc7a('0x27')]['create']({'name':_0x409c89[_0xfc7a('0x2a')],'resourceId':_0x409c89['id'],'type':_0x18ecdf[_0xfc7a('0x2a')],'sectionId':_0x18ecdf['id']},{})[_0xfc7a('0x23')](function(){return _0x484a6e;});}else{return _0x484a6e;}})[_0xfc7a('0x45')](function(_0x4c5c8a){logger[_0xfc7a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c5c8a);throw _0x4c5c8a;});}return _0x484a6e;})[_0xfc7a('0x23')](respondWithResult(_0x1464ed,0xc9))[_0xfc7a('0x45')](handleError(_0x1464ed,null));};exports[_0xfc7a('0x22')]=function(_0x27d2e4,_0x5e354e){if(_0x27d2e4[_0xfc7a('0x4f')]['id']){delete _0x27d2e4['body']['id'];}return db[_0xfc7a('0x40')][_0xfc7a('0x48')]({'where':{'id':_0x27d2e4['params']['id']}})[_0xfc7a('0x23')](handleEntityNotFound(_0x5e354e,null))[_0xfc7a('0x23')](saveUpdates(_0x27d2e4[_0xfc7a('0x4f')],null))[_0xfc7a('0x23')](respondWithResult(_0x5e354e,null))[_0xfc7a('0x45')](handleError(_0x5e354e,null));};exports[_0xfc7a('0x24')]=function(_0x122d97,_0xa146fe){return db['CmContactHasItem'][_0xfc7a('0x48')]({'where':{'id':_0x122d97[_0xfc7a('0x47')]['id']}})[_0xfc7a('0x23')](handleEntityNotFound(_0xa146fe,null))[_0xfc7a('0x23')](removeEntity(_0xa146fe,null))['catch'](handleError(_0xa146fe,null));}; \ No newline at end of file +var _0xceed=['stack','name','index','map','CmContactHasItem','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','CmContactHasItems','error'];(function(_0x3fd11f,_0x4c0271){var _0x432ec6=function(_0x4ce006){while(--_0x4ce006){_0x3fd11f['push'](_0x3fd11f['shift']());}};_0x432ec6(++_0x4c0271);}(_0xceed,0xc5));var _0xdcee=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xceed[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0xdcee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdcee('0x1'));var jsonpatch=require(_0xdcee('0x2'));var rp=require(_0xdcee('0x3'));var moment=require('moment');var BPromise=require(_0xdcee('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdcee('0x5'));var sox=require(_0xdcee('0x6'));var csv=require(_0xdcee('0x7'));var ejs=require(_0xdcee('0x8'));var fs=require('fs');var fs_extra=require(_0xdcee('0x9'));var _=require(_0xdcee('0xa'));var squel=require(_0xdcee('0xb'));var crypto=require(_0xdcee('0xc'));var jsforce=require(_0xdcee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdcee('0x7'));var querystring=require(_0xdcee('0xe'));var Papa=require(_0xdcee('0xf'));var Redis=require(_0xdcee('0x10'));var authService=require(_0xdcee('0x11'));var qs=require(_0xdcee('0x12'));var as=require(_0xdcee('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcee('0x14'))(_0xdcee('0x15'));var utils=require(_0xdcee('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9faee7,_0x5cc4d9){_0x5cc4d9=_0x5cc4d9||0xcc;return function(_0x30d9b1){if(_0x30d9b1){return _0x9faee7[_0xdcee('0x17')](_0x5cc4d9);}return _0x9faee7[_0xdcee('0x18')](_0x5cc4d9)[_0xdcee('0x19')]();};}function respondWithResult(_0x4b1ee5,_0x302935){_0x302935=_0x302935||0xc8;return function(_0x2ade76){if(_0x2ade76){return _0x4b1ee5[_0xdcee('0x18')](_0x302935)['json'](_0x2ade76);}};}function respondWithFilteredResult(_0x50dfeb,_0x3a41df){return function(_0x4ba522){if(_0x4ba522){var _0x373a50=typeof _0x3a41df[_0xdcee('0x1a')]==='undefined'&&typeof _0x3a41df[_0xdcee('0x1b')]===_0xdcee('0x1c');var _0x198809=_0x4ba522[_0xdcee('0x1d')];var _0x5a09be=_0x373a50?0x0:_0x3a41df['offset'];var _0x959fa7=_0x373a50?_0x4ba522['count']:_0x3a41df[_0xdcee('0x1a')]+_0x3a41df[_0xdcee('0x1b')];var _0x4f918a;if(_0x959fa7>=_0x198809){_0x959fa7=_0x198809;_0x4f918a=0xc8;}else{_0x4f918a=0xce;}_0x50dfeb['status'](_0x4f918a);return _0x50dfeb[_0xdcee('0x1e')](_0xdcee('0x1f'),_0x5a09be+'-'+_0x959fa7+'/'+_0x198809)[_0xdcee('0x20')](_0x4ba522);}return null;};}function patchUpdates(_0x12f1c3){return function(_0x44fa11){try{jsonpatch['apply'](_0x44fa11,_0x12f1c3,!![]);}catch(_0x5d2c44){return BPromise[_0xdcee('0x21')](_0x5d2c44);}return _0x44fa11[_0xdcee('0x22')]();};}function saveUpdates(_0xeee2e,_0x2ef6f0){return function(_0x299a55){if(_0x299a55){return _0x299a55[_0xdcee('0x23')](_0xeee2e)[_0xdcee('0x24')](function(_0x4951df){return _0x4951df;});}return null;};}function removeEntity(_0x5e9fb9,_0x10dd4a){return function(_0x127a08){if(_0x127a08){return _0x127a08[_0xdcee('0x25')]()[_0xdcee('0x24')](function(){var _0xc53cba=_0x127a08['get']({'plain':!![]});var _0x26fa60=_0xdcee('0x26');return db['UserProfileResource'][_0xdcee('0x25')]({'where':{'type':_0x26fa60,'resourceId':_0xc53cba['id']}})[_0xdcee('0x24')](function(){return _0x127a08;});})[_0xdcee('0x24')](function(){_0x5e9fb9[_0xdcee('0x18')](0xcc)[_0xdcee('0x19')]();});}};}function handleEntityNotFound(_0xc57588,_0x4ac375){return function(_0x373d8a){if(!_0x373d8a){_0xc57588[_0xdcee('0x17')](0x194);}return _0x373d8a;};}function handleError(_0x267cf7,_0x468592){_0x468592=_0x468592||0x1f4;return function(_0x1d466c){logger[_0xdcee('0x27')](_0x1d466c[_0xdcee('0x28')]);if(_0x1d466c['name']){delete _0x1d466c[_0xdcee('0x29')];}_0x267cf7[_0xdcee('0x18')](_0x468592)['send'](_0x1d466c);};}exports[_0xdcee('0x2a')]=function(_0x2a6c84,_0x8d7961){var _0x39e9ad={},_0x1ab814={},_0x5bdeae={'count':0x0,'rows':[]};var _0x4b9c76=_[_0xdcee('0x2b')](db[_0xdcee('0x2c')][_0xdcee('0x2d')],function(_0x5ab813){return{'name':_0x5ab813[_0xdcee('0x2e')],'type':_0x5ab813[_0xdcee('0x2f')]['key']};});_0x1ab814[_0xdcee('0x30')]=_[_0xdcee('0x2b')](_0x4b9c76,'name');_0x1ab814['query']=_['keys'](_0x2a6c84[_0xdcee('0x31')]);_0x1ab814[_0xdcee('0x32')]=_[_0xdcee('0x33')](_0x1ab814['model'],_0x1ab814['query']);_0x39e9ad[_0xdcee('0x34')]=_[_0xdcee('0x33')](_0x1ab814[_0xdcee('0x30')],qs[_0xdcee('0x35')](_0x2a6c84[_0xdcee('0x31')][_0xdcee('0x35')]));_0x39e9ad[_0xdcee('0x34')]=_0x39e9ad[_0xdcee('0x34')]['length']?_0x39e9ad[_0xdcee('0x34')]:_0x1ab814[_0xdcee('0x30')];if(!_0x2a6c84[_0xdcee('0x31')]['hasOwnProperty'](_0xdcee('0x36'))){_0x39e9ad[_0xdcee('0x1b')]=qs[_0xdcee('0x1b')](_0x2a6c84[_0xdcee('0x31')][_0xdcee('0x1b')]);_0x39e9ad[_0xdcee('0x1a')]=qs[_0xdcee('0x1a')](_0x2a6c84['query'][_0xdcee('0x1a')]);}_0x39e9ad[_0xdcee('0x37')]=qs[_0xdcee('0x38')](_0x2a6c84[_0xdcee('0x31')]['sort']);_0x39e9ad[_0xdcee('0x39')]=qs[_0xdcee('0x32')](_[_0xdcee('0x3a')](_0x2a6c84[_0xdcee('0x31')],_0x1ab814['filters']),_0x4b9c76);if(_0x2a6c84[_0xdcee('0x31')][_0xdcee('0x3b')]){_0x39e9ad['where']=_[_0xdcee('0x3c')](_0x39e9ad[_0xdcee('0x39')],{'$or':_['map'](_0x4b9c76,function(_0x32cfba){if(_0x32cfba['type']!==_0xdcee('0x3d')){var _0x387a53={};_0x387a53[_0x32cfba['name']]={'$like':'%'+_0x2a6c84[_0xdcee('0x31')][_0xdcee('0x3b')]+'%'};return _0x387a53;}})});}_0x39e9ad=_[_0xdcee('0x3c')]({},_0x39e9ad,_0x2a6c84['options']);var _0x1280df={'where':_0x39e9ad[_0xdcee('0x39')]};return db[_0xdcee('0x2c')]['count'](_0x1280df)[_0xdcee('0x24')](function(_0x2ff38f){_0x5bdeae[_0xdcee('0x1d')]=_0x2ff38f;if(_0x2a6c84[_0xdcee('0x31')][_0xdcee('0x3e')]){_0x39e9ad[_0xdcee('0x3f')]=[{'all':!![]}];}return db[_0xdcee('0x2c')]['findAll'](_0x39e9ad);})[_0xdcee('0x24')](function(_0x2bd8b7){_0x5bdeae[_0xdcee('0x40')]=_0x2bd8b7;return _0x5bdeae;})[_0xdcee('0x24')](respondWithFilteredResult(_0x8d7961,_0x39e9ad))['catch'](handleError(_0x8d7961,null));};exports['show']=function(_0x30e51c,_0x4e6771){var _0x20bbd0={'raw':!![],'where':{'id':_0x30e51c[_0xdcee('0x41')]['id']}},_0x5bc9e0={};_0x5bc9e0[_0xdcee('0x30')]=_[_0xdcee('0x42')](db['CmContactHasItem']['rawAttributes']);_0x5bc9e0[_0xdcee('0x31')]=_[_0xdcee('0x42')](_0x30e51c[_0xdcee('0x31')]);_0x5bc9e0[_0xdcee('0x32')]=_[_0xdcee('0x33')](_0x5bc9e0[_0xdcee('0x30')],_0x5bc9e0['query']);_0x20bbd0[_0xdcee('0x34')]=_[_0xdcee('0x33')](_0x5bc9e0[_0xdcee('0x30')],qs[_0xdcee('0x35')](_0x30e51c['query'][_0xdcee('0x35')]));_0x20bbd0['attributes']=_0x20bbd0[_0xdcee('0x34')][_0xdcee('0x43')]?_0x20bbd0[_0xdcee('0x34')]:_0x5bc9e0[_0xdcee('0x30')];if(_0x30e51c['query'][_0xdcee('0x3e')]){_0x20bbd0[_0xdcee('0x3f')]=[{'all':!![]}];}_0x20bbd0=_['merge']({},_0x20bbd0,_0x30e51c['options']);return db['CmContactHasItem'][_0xdcee('0x44')](_0x20bbd0)[_0xdcee('0x24')](handleEntityNotFound(_0x4e6771,null))[_0xdcee('0x24')](respondWithResult(_0x4e6771,null))[_0xdcee('0x45')](handleError(_0x4e6771,null));};exports[_0xdcee('0x46')]=function(_0x36df32,_0x3326d2){return db[_0xdcee('0x2c')][_0xdcee('0x46')](_0x36df32[_0xdcee('0x47')],{})['then'](function(_0xe6ba94){var _0x10a9b4=_0x36df32[_0xdcee('0x48')]['get']({'plain':!![]});if(!_0x10a9b4)throw new Error(_0xdcee('0x49'));if(_0x10a9b4[_0xdcee('0x4a')]===_0xdcee('0x48')){var _0x578f37=_0xe6ba94[_0xdcee('0x4b')]({'plain':!![]});var _0x5ce1b9=_0xdcee('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x5ce1b9,'userProfileId':_0x10a9b4[_0xdcee('0x4c')]},'raw':!![]})['then'](function(_0x31bbc0){if(_0x31bbc0&&_0x31bbc0[_0xdcee('0x4d')]===0x0){return db[_0xdcee('0x4e')]['create']({'name':_0x578f37[_0xdcee('0x29')],'resourceId':_0x578f37['id'],'type':_0x31bbc0['name'],'sectionId':_0x31bbc0['id']},{})[_0xdcee('0x24')](function(){return _0xe6ba94;});}else{return _0xe6ba94;}})[_0xdcee('0x45')](function(_0x350a6d){logger[_0xdcee('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x350a6d);throw _0x350a6d;});}return _0xe6ba94;})[_0xdcee('0x24')](respondWithResult(_0x3326d2,0xc9))[_0xdcee('0x45')](handleError(_0x3326d2,null));};exports[_0xdcee('0x23')]=function(_0x5a8130,_0x13eec5){if(_0x5a8130[_0xdcee('0x47')]['id']){delete _0x5a8130[_0xdcee('0x47')]['id'];}return db[_0xdcee('0x2c')]['find']({'where':{'id':_0x5a8130[_0xdcee('0x41')]['id']}})[_0xdcee('0x24')](handleEntityNotFound(_0x13eec5,null))[_0xdcee('0x24')](saveUpdates(_0x5a8130['body'],null))[_0xdcee('0x24')](respondWithResult(_0x13eec5,null))[_0xdcee('0x45')](handleError(_0x13eec5,null));};exports['destroy']=function(_0x3e1139,_0x48b0f7){return db[_0xdcee('0x2c')][_0xdcee('0x44')]({'where':{'id':_0x3e1139['params']['id']}})['then'](handleEntityNotFound(_0x48b0f7,null))[_0xdcee('0x24')](removeEntity(_0x48b0f7,null))['catch'](handleError(_0x48b0f7,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2f5c718..6a3ddcf 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8beb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','lodash','util','../../config/logger'];(function(_0x246d84,_0x419a53){var _0x1673af=function(_0x4c6fb8){while(--_0x4c6fb8){_0x246d84['push'](_0x246d84['shift']());}};_0x1673af(++_0x419a53);}(_0x8beb,0xed));var _0xb8be=function(_0x33f958,_0x4fc4dc){_0x33f958=_0x33f958-0x0;var _0x502608=_0x8beb[_0x33f958];return _0x502608;};'use strict';var _=require(_0xb8be('0x0'));var util=require(_0xb8be('0x1'));var logger=require(_0xb8be('0x2'))('api');var moment=require(_0xb8be('0x3'));var BPromise=require(_0xb8be('0x4'));var rp=require(_0xb8be('0x5'));var fs=require('fs');var path=require(_0xb8be('0x6'));var rimraf=require(_0xb8be('0x7'));var config=require(_0xb8be('0x8'));var attributes=require(_0xb8be('0x9'));module[_0xb8be('0xa')]=function(_0x5d9315,_0x232e7d){return _0x5d9315['define'](_0xb8be('0xb'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e43=['cm_contact_has_items','util','../../config/logger','api','moment','request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem'];(function(_0x5f1bb2,_0x3d0ec3){var _0x5b0d1e=function(_0x4d8720){while(--_0x4d8720){_0x5f1bb2['push'](_0x5f1bb2['shift']());}};_0x5b0d1e(++_0x3d0ec3);}(_0x2e43,0x182));var _0x32e4=function(_0x35733,_0x919feb){_0x35733=_0x35733-0x0;var _0xa53580=_0x2e43[_0x35733];return _0xa53580;};'use strict';var _=require('lodash');var util=require(_0x32e4('0x0'));var logger=require(_0x32e4('0x1'))(_0x32e4('0x2'));var moment=require(_0x32e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x32e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32e4('0x5'));var attributes=require(_0x32e4('0x6'));module[_0x32e4('0x7')]=function(_0x1b49a5,_0x339bcb){return _0x1b49a5[_0x32e4('0x8')](_0x32e4('0x9'),attributes,{'tableName':_0x32e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index f5ec338..e993199 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b0f=['jayson/promise','http','request','then','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0x51b6f4,_0x5e6420){var _0x536763=function(_0x440d36){while(--_0x440d36){_0x51b6f4['push'](_0x51b6f4['shift']());}};_0x536763(++_0x5e6420);}(_0x8b0f,0x1d4));var _0xf8b0=function(_0x4131dd,_0x1b7297){_0x4131dd=_0x4131dd-0x0;var _0x1d6fcd=_0x8b0f[_0x4131dd];return _0x1d6fcd;};'use strict';var _=require('lodash');var util=require(_0xf8b0('0x0'));var moment=require(_0xf8b0('0x1'));var BPromise=require(_0xf8b0('0x2'));var rs=require(_0xf8b0('0x3'));var fs=require('fs');var Redis=require(_0xf8b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf8b0('0x5'));var config=require(_0xf8b0('0x6'));var jayson=require(_0xf8b0('0x7'));var client=jayson['client'][_0xf8b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55fe3c,_0x4cd543,_0x331fba){return new BPromise(function(_0x270978,_0x4cebcc){return client[_0xf8b0('0x9')](_0x55fe3c,_0x331fba)[_0xf8b0('0xa')](function(_0x38b5b0){logger[_0xf8b0('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x4cd543,_0xf8b0('0xc'));logger['debug'](_0xf8b0('0xd'),_0x4cd543,_0xf8b0('0xc'),JSON[_0xf8b0('0xe')](_0x38b5b0));if(_0x38b5b0['error']){if(_0x38b5b0[_0xf8b0('0xf')]['code']===0x1f4){logger[_0xf8b0('0xf')](_0xf8b0('0x10'),_0x4cd543,_0x38b5b0[_0xf8b0('0xf')]['message']);return _0x4cebcc(_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4cd543,_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);return _0x270978(_0x38b5b0[_0xf8b0('0xf')][_0xf8b0('0x11')]);}else{logger[_0xf8b0('0xb')](_0xf8b0('0x10'),_0x4cd543,'request\x20sent');_0x270978(_0x38b5b0[_0xf8b0('0x12')][_0xf8b0('0x11')]);}})['catch'](function(_0x433a18){logger['error'](_0xf8b0('0x10'),_0x4cd543,_0x433a18);_0x4cebcc(_0x433a18);});});} \ No newline at end of file +var _0xe667=['info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','CmContactHasItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message'];(function(_0x1a9f8b,_0x53ac1b){var _0x12a2c1=function(_0x1123fb){while(--_0x1123fb){_0x1a9f8b['push'](_0x1a9f8b['shift']());}};_0x12a2c1(++_0x53ac1b);}(_0xe667,0x10c));var _0x7e66=function(_0x161de6,_0xf84f87){_0x161de6=_0x161de6-0x0;var _0x59f645=_0xe667[_0x161de6];return _0x59f645;};'use strict';var _=require(_0x7e66('0x0'));var util=require(_0x7e66('0x1'));var moment=require(_0x7e66('0x2'));var BPromise=require(_0x7e66('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e66('0x4'));var db=require(_0x7e66('0x5'))['db'];var utils=require(_0x7e66('0x6'));var logger=require(_0x7e66('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e66('0x8')][_0x7e66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534026,_0x44d1f0,_0x16340e){return new BPromise(function(_0x49d939,_0x4da255){return client[_0x7e66('0xa')](_0x534026,_0x16340e)['then'](function(_0xe35b1a){logger['info'](_0x7e66('0xb'),_0x44d1f0,'request\x20sent');logger[_0x7e66('0xc')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x44d1f0,_0x7e66('0xd'),JSON[_0x7e66('0xe')](_0xe35b1a));if(_0xe35b1a[_0x7e66('0xf')]){if(_0xe35b1a[_0x7e66('0xf')]['code']===0x1f4){logger[_0x7e66('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x44d1f0,_0xe35b1a[_0x7e66('0xf')][_0x7e66('0x10')]);return _0x4da255(_0xe35b1a[_0x7e66('0xf')]['message']);}logger[_0x7e66('0xf')](_0x7e66('0xb'),_0x44d1f0,_0xe35b1a[_0x7e66('0xf')][_0x7e66('0x10')]);return _0x49d939(_0xe35b1a['error']['message']);}else{logger[_0x7e66('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x44d1f0,'request\x20sent');_0x49d939(_0xe35b1a['result'][_0x7e66('0x10')]);}})[_0x7e66('0x12')](function(_0x170f04){logger[_0x7e66('0xf')](_0x7e66('0xb'),_0x44d1f0,_0x170f04);_0x4da255(_0x170f04);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 788f09a..6613785 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c86=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4c86,0x8e));var _0x64c8=function(_0xa1552e,_0x423288){_0xa1552e=_0xa1552e-0x0;var _0x4a3ee7=_0x4c86[_0xa1552e];return _0x4a3ee7;};'use strict';var multer=require(_0x64c8('0x0'));var util=require(_0x64c8('0x1'));var path=require('path');var timeout=require(_0x64c8('0x2'));var express=require(_0x64c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x64c8('0x4'));var interaction=require(_0x64c8('0x5'));var config=require(_0x64c8('0x6'));var controller=require(_0x64c8('0x7'));router[_0x64c8('0x8')]('/',auth[_0x64c8('0x9')](),controller[_0x64c8('0xa')]);router[_0x64c8('0x8')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0xc')]);router['post']('/',auth[_0x64c8('0x9')](),controller[_0x64c8('0xd')]);router[_0x64c8('0xe')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0xf')]);router[_0x64c8('0x10')](_0x64c8('0xb'),auth[_0x64c8('0x9')](),controller[_0x64c8('0x11')]);module[_0x64c8('0x12')]=router; \ No newline at end of file +var _0x24f0=['destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x24f0,0x1f0));var _0x024f=function(_0x372f7f,_0x236596){_0x372f7f=_0x372f7f-0x0;var _0xcc2c=_0x24f0[_0x372f7f];return _0xcc2c;};'use strict';var multer=require('multer');var util=require(_0x024f('0x0'));var path=require('path');var timeout=require(_0x024f('0x1'));var express=require('express');var router=express[_0x024f('0x2')]();var fs_extra=require(_0x024f('0x3'));var auth=require(_0x024f('0x4'));var interaction=require(_0x024f('0x5'));var config=require('../../config/environment');var controller=require(_0x024f('0x6'));router[_0x024f('0x7')]('/',auth[_0x024f('0x8')](),controller[_0x024f('0x9')]);router[_0x024f('0x7')](_0x024f('0xa'),auth[_0x024f('0x8')](),controller[_0x024f('0xb')]);router[_0x024f('0xc')]('/',auth['isAuthenticated'](),controller[_0x024f('0xd')]);router[_0x024f('0xe')]('/:id',auth[_0x024f('0x8')](),controller[_0x024f('0xf')]);router[_0x024f('0x10')](_0x024f('0xa'),auth[_0x024f('0x8')](),controller[_0x024f('0x11')]);module[_0x024f('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index fa47bbe..9cba6a9 100644 --- a/server/api/cmCustomField/cmCustomField.attributes.js +++ b/server/api/cmCustomField/cmCustomField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x182d=['getDataValue','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','alias','STRING','setDataValue','name','long'];(function(_0x18ed54,_0x18a64f){var _0xcd7d86=function(_0x1e7d09){while(--_0x1e7d09){_0x18ed54['push'](_0x18ed54['shift']());}};_0xcd7d86(++_0x18a64f);}(_0x182d,0x1c3));var _0xd182=function(_0x51fb13,_0x4e2640){_0x51fb13=_0x51fb13-0x0;var _0x475b53=_0x182d[_0x51fb13];return _0x475b53;};'use strict';var Sequelize=require(_0xd182('0x0'));var _=require(_0xd182('0x1'));module['exports']={'name':{'type':Sequelize[_0xd182('0x2')],'get':function(_0x2bf599){return this['getDataValue'](_0xd182('0x3'));}},'alias':{'type':Sequelize[_0xd182('0x4')],'allowNull':![],'set':function(_0x2d932f){this[_0xd182('0x5')](_0xd182('0x3'),_0x2d932f?_0x2d932f:this['getDataValue'](_0xd182('0x6')));}},'type':{'type':Sequelize[_0xd182('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xd182('0x7')),'get':function(){if(this[_0xd182('0x8')](_0xd182('0x9'))==='select'){return JSON[_0xd182('0xa')](this[_0xd182('0x8')](_0xd182('0xb')));}else{return this[_0xd182('0x8')](_0xd182('0xb'));}},'set':function(_0x2b5eed){if(Array[_0xd182('0xc')](_0x2b5eed)){this[_0xd182('0x5')](_0xd182('0xb'),JSON[_0xd182('0xd')](_0x2b5eed));}else{this[_0xd182('0x5')](_0xd182('0xb'),_0x2b5eed);}}},'required':{'type':Sequelize[_0xd182('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd182('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd182('0xf')](_0xd182('0x10'))}}; \ No newline at end of file +var _0x1366=['values','isArray','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','select','parse'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x1366,0x122));var _0x6136=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1366[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x6136('0x0'));var _=require('lodash');module[_0x6136('0x1')]={'name':{'type':Sequelize[_0x6136('0x2')],'get':function(_0x3c5a15){return this[_0x6136('0x3')](_0x6136('0x4'));}},'alias':{'type':Sequelize[_0x6136('0x5')],'allowNull':![],'set':function(_0x492ae8){this[_0x6136('0x6')]('alias',_0x492ae8?_0x492ae8:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x6136('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x6136('0x7')]('long'),'get':function(){if(this[_0x6136('0x3')]('type')===_0x6136('0x8')){return JSON[_0x6136('0x9')](this[_0x6136('0x3')](_0x6136('0xa')));}else{return this['getDataValue'](_0x6136('0xa'));}},'set':function(_0x43e09f){if(Array[_0x6136('0xb')](_0x43e09f)){this['setDataValue'](_0x6136('0xa'),JSON['stringify'](_0x43e09f));}else{this[_0x6136('0x6')](_0x6136('0xa'),_0x43e09f);}}},'required':{'type':Sequelize[_0x6136('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6136('0xd')](_0x6136('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8c467da..64c4aad 100644 --- a/server/api/cmCustomField/cmCustomField.controller.js +++ b/server/api/cmCustomField/cmCustomField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3daf=['../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','CmCustomField','rawAttributes','type','key','model','differenceBy','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','params','options','body','find','create','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','format','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x3daf,0x1e4));var _0xf3da=function(_0x3cd645,_0xb705b5){_0x3cd645=_0x3cd645-0x0;var _0x2a04b0=_0x3daf[_0x3cd645];return _0x2a04b0;};'use strict';var emlformat=require(_0xf3da('0x0'));var rimraf=require(_0xf3da('0x1'));var zipdir=require(_0xf3da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3da('0x3'));var moment=require('moment');var BPromise=require(_0xf3da('0x4'));var Mustache=require(_0xf3da('0x5'));var util=require('util');var path=require(_0xf3da('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf3da('0x7'));var fs=require('fs');var fs_extra=require(_0xf3da('0x8'));var _=require('lodash');var squel=require(_0xf3da('0x9'));var crypto=require(_0xf3da('0xa'));var jsforce=require(_0xf3da('0xb'));var deskjs=require(_0xf3da('0xc'));var toCsv=require(_0xf3da('0xd'));var querystring=require(_0xf3da('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf3da('0xf'));var qs=require(_0xf3da('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3da('0x11'))(_0xf3da('0x12'));var utils=require(_0xf3da('0x13'));var config=require(_0xf3da('0x14'));var licenseUtil=require(_0xf3da('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2988eb,_0x3e9b53){_0x3e9b53=_0x3e9b53||0xcc;return function(_0x365d1a){if(_0x365d1a){return _0x2988eb['sendStatus'](_0x3e9b53);}return _0x2988eb[_0xf3da('0x16')](_0x3e9b53)['end']();};}function respondWithResult(_0x20a78c,_0x315e24){_0x315e24=_0x315e24||0xc8;return function(_0x4ae5a8){if(_0x4ae5a8){return _0x20a78c[_0xf3da('0x16')](_0x315e24)[_0xf3da('0x17')](_0x4ae5a8);}};}function respondWithFilteredResult(_0x3daa82,_0x5451b9){return function(_0x357ff4){if(_0x357ff4){var _0x2cd682=typeof _0x5451b9[_0xf3da('0x18')]===_0xf3da('0x19')&&typeof _0x5451b9[_0xf3da('0x1a')]===_0xf3da('0x19');var _0x367d3c=_0x357ff4[_0xf3da('0x1b')];var _0x40b7f3=_0x2cd682?0x0:_0x5451b9['offset'];var _0x51579f=_0x2cd682?_0x357ff4[_0xf3da('0x1b')]:_0x5451b9['offset']+_0x5451b9[_0xf3da('0x1a')];var _0x32d2ad;if(_0x51579f>=_0x367d3c){_0x51579f=_0x367d3c;_0x32d2ad=0xc8;}else{_0x32d2ad=0xce;}_0x3daa82['status'](_0x32d2ad);return _0x3daa82[_0xf3da('0x1c')]('Content-Range',_0x40b7f3+'-'+_0x51579f+'/'+_0x367d3c)[_0xf3da('0x17')](_0x357ff4);}return null;};}function patchUpdates(_0x3d779e){return function(_0x3e3e02){try{jsonpatch[_0xf3da('0x1d')](_0x3e3e02,_0x3d779e,!![]);}catch(_0x3c8328){return BPromise[_0xf3da('0x1e')](_0x3c8328);}return _0x3e3e02[_0xf3da('0x1f')]();};}function saveUpdates(_0xe43c44,_0x444d34){return function(_0x36fd26){if(_0x36fd26){return _0x36fd26[_0xf3da('0x20')](_0xe43c44)[_0xf3da('0x21')](function(_0x49c976){return _0x49c976;});}return null;};}function removeEntity(_0x3ba945,_0xf533ac){return function(_0x1ad17e){if(_0x1ad17e){return _0x1ad17e[_0xf3da('0x22')]()[_0xf3da('0x21')](function(){_0x3ba945['status'](0xcc)[_0xf3da('0x23')]();});}};}function handleEntityNotFound(_0x2f7ae4,_0x24b72b){return function(_0x423518){if(!_0x423518){_0x2f7ae4['sendStatus'](0x194);}return _0x423518;};}function handleError(_0x48cd6c,_0x4a515e){_0x4a515e=_0x4a515e||0x1f4;return function(_0x19c02b){logger[_0xf3da('0x24')](_0x19c02b[_0xf3da('0x25')]);if(_0x19c02b['name']){delete _0x19c02b[_0xf3da('0x26')];}_0x48cd6c[_0xf3da('0x16')](_0x4a515e)[_0xf3da('0x27')](_0x19c02b);};}exports['index']=function(_0x1c88e6,_0x2ffedf){var _0x34550a={},_0x4239a6={},_0x15e0f2={'count':0x0,'rows':[]};var _0x5c9beb=_['map'](db[_0xf3da('0x28')][_0xf3da('0x29')],function(_0x27cbed){return{'name':_0x27cbed['fieldName'],'type':_0x27cbed[_0xf3da('0x2a')][_0xf3da('0x2b')]};});_0x4239a6[_0xf3da('0x2c')]=_[_0xf3da('0x2d')](_[_0xf3da('0x2e')](_0x5c9beb,_0xf3da('0x26')),[_0xf3da('0x26')]);_0x4239a6['query']=_[_0xf3da('0x2f')](_0x1c88e6[_0xf3da('0x30')]);_0x4239a6[_0xf3da('0x31')]=_['intersection'](_0x4239a6[_0xf3da('0x2c')],_0x4239a6['query']);_0x34550a[_0xf3da('0x32')]=_[_0xf3da('0x33')](_0x4239a6[_0xf3da('0x2c')],qs['fields'](_0x1c88e6['query'][_0xf3da('0x34')]));_0x34550a[_0xf3da('0x32')]=_0x34550a[_0xf3da('0x32')][_0xf3da('0x35')]?_0x34550a[_0xf3da('0x32')]:_0x4239a6[_0xf3da('0x2c')];if(!_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x36')](_0xf3da('0x37'))){_0x34550a[_0xf3da('0x1a')]=qs['limit'](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x1a')]);_0x34550a['offset']=qs[_0xf3da('0x18')](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x18')]);}_0x34550a[_0xf3da('0x38')]=qs[_0xf3da('0x39')](_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x39')]);_0x34550a[_0xf3da('0x3a')]=qs[_0xf3da('0x31')](_[_0xf3da('0x3b')](_0x1c88e6[_0xf3da('0x30')],_0x4239a6[_0xf3da('0x31')]),_0x5c9beb);if(_0x1c88e6[_0xf3da('0x30')]['filter']){_0x34550a['where']=_['merge'](_0x34550a['where'],{'$or':_[_0xf3da('0x2e')](_0x5c9beb,function(_0x26282f){if(_0x26282f['type']!==_0xf3da('0x3c')){var _0xda5b60={};_0xda5b60[_0x26282f[_0xf3da('0x26')]]={'$like':'%'+_0x1c88e6['query'][_0xf3da('0x3d')]+'%'};return _0xda5b60;}})});}_0x34550a=_[_0xf3da('0x3e')]({},_0x34550a,_0x1c88e6['options']);var _0x1220c0={'where':_0x34550a[_0xf3da('0x3a')]};return db[_0xf3da('0x28')]['count'](_0x1220c0)['then'](function(_0x558011){_0x15e0f2[_0xf3da('0x1b')]=_0x558011;if(_0x1c88e6[_0xf3da('0x30')][_0xf3da('0x3f')]){_0x34550a[_0xf3da('0x40')]=[{'all':!![]}];}return db[_0xf3da('0x28')][_0xf3da('0x41')](_0x34550a);})[_0xf3da('0x21')](function(_0x822a55){_0x15e0f2[_0xf3da('0x42')]=_0x822a55;return _0x15e0f2;})[_0xf3da('0x21')](respondWithFilteredResult(_0x2ffedf,_0x34550a))[_0xf3da('0x43')](handleError(_0x2ffedf,null));};exports['show']=function(_0x2c6320,_0x8c8559){var _0x2ee0fb={'raw':!![],'where':{'id':_0x2c6320[_0xf3da('0x44')]['id']}},_0x114073={};_0x114073['model']=_[_0xf3da('0x2f')](db[_0xf3da('0x28')]['rawAttributes']);_0x114073['query']=_[_0xf3da('0x2f')](_0x2c6320[_0xf3da('0x30')]);_0x114073['filters']=_[_0xf3da('0x33')](_0x114073[_0xf3da('0x2c')],_0x114073[_0xf3da('0x30')]);_0x2ee0fb['attributes']=_[_0xf3da('0x33')](_0x114073[_0xf3da('0x2c')],qs[_0xf3da('0x34')](_0x2c6320[_0xf3da('0x30')][_0xf3da('0x34')]));_0x2ee0fb[_0xf3da('0x32')]=_0x2ee0fb[_0xf3da('0x32')][_0xf3da('0x35')]?_0x2ee0fb[_0xf3da('0x32')]:_0x114073['model'];if(_0x2c6320[_0xf3da('0x30')]['includeAll']){_0x2ee0fb[_0xf3da('0x40')]=[{'all':!![]}];}_0x2ee0fb=_[_0xf3da('0x3e')]({},_0x2ee0fb,_0x2c6320[_0xf3da('0x45')]);return db[_0xf3da('0x28')]['find'](_0x2ee0fb)[_0xf3da('0x21')](handleEntityNotFound(_0x8c8559,null))['then'](respondWithResult(_0x8c8559,null))[_0xf3da('0x43')](handleError(_0x8c8559,null));};exports[_0xf3da('0x20')]=function(_0x5f4165,_0x5d83cd){if(_0x5f4165[_0xf3da('0x46')]['id']){delete _0x5f4165[_0xf3da('0x46')]['id'];}return db[_0xf3da('0x28')][_0xf3da('0x47')]({'where':{'id':_0x5f4165[_0xf3da('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d83cd,null))[_0xf3da('0x21')](saveUpdates(_0x5f4165['body'],null))['then'](respondWithResult(_0x5d83cd,null))[_0xf3da('0x43')](handleError(_0x5d83cd,null));};exports[_0xf3da('0x22')]=function(_0x130950,_0x115697){return db[_0xf3da('0x28')][_0xf3da('0x47')]({'where':{'id':_0x130950['params']['id']}})[_0xf3da('0x21')](handleEntityNotFound(_0x115697,null))[_0xf3da('0x21')](removeEntity(_0x115697,null))[_0xf3da('0x43')](handleError(_0x115697,null));};exports[_0xf3da('0x48')]=function(_0xb159a7,_0x29e530){var _0x12ee2d;return db['sequelize']['transaction'](function(_0x3dcd9a){return db[_0xf3da('0x28')][_0xf3da('0x48')](_0xb159a7['body'],{'transaction':_0x3dcd9a})[_0xf3da('0x21')](function(_0x1291d6){_0x12ee2d=_0x1291d6;var _0xa43790={'type':db[_0xf3da('0x49')][_0xf3da('0x4a')],'transaction':_0x3dcd9a};switch(_0xb159a7[_0xf3da('0x46')]['type']){case _0xf3da('0x4b'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4a')];break;case _0xf3da('0x4c'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4d')];break;case _0xf3da('0x4e'):_0xa43790[_0xf3da('0x2a')]=db[_0xf3da('0x49')][_0xf3da('0x4f')];_0xa43790['defaultValue']=![];break;default:}return db[_0xf3da('0x50')][_0xf3da('0x51')][_0xf3da('0x52')]('cm_contacts',util[_0xf3da('0x53')]('cf_%d',_0x12ee2d['id']),_0xa43790);})[_0xf3da('0x21')](function(){return _0x12ee2d;});})[_0xf3da('0x21')](respondWithResult(_0x29e530,0xc9))[_0xf3da('0x43')](handleError(_0x29e530,null));}; \ No newline at end of file +var _0x7193=['merge','options','includeAll','findAll','rows','catch','show','length','include','find','body','params','create','sequelize','transaction','Sequelize','INTEGER','switch','BOOLEAN','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','request-promise','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7193,0x1ac));var _0x3719=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x7193[_0xbf8ec1];return _0xc84567;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3719('0x0'));var zipdir=require(_0x3719('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3719('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3719('0x3'));var util=require(_0x3719('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3719('0x5'));var ejs=require(_0x3719('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3719('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3719('0x8'));var deskjs=require(_0x3719('0x9'));var toCsv=require(_0x3719('0x5'));var querystring=require('querystring');var Papa=require(_0x3719('0xa'));var Redis=require('ioredis');var authService=require(_0x3719('0xb'));var qs=require(_0x3719('0xc'));var as=require(_0x3719('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3719('0xe'));var config=require(_0x3719('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x3719('0x10'))['db'];function respondWithStatusCode(_0xf312d,_0x55dc9e){_0x55dc9e=_0x55dc9e||0xcc;return function(_0x10de15){if(_0x10de15){return _0xf312d[_0x3719('0x11')](_0x55dc9e);}return _0xf312d['status'](_0x55dc9e)[_0x3719('0x12')]();};}function respondWithResult(_0x1982df,_0x15f6b6){_0x15f6b6=_0x15f6b6||0xc8;return function(_0x1b20ee){if(_0x1b20ee){return _0x1982df[_0x3719('0x13')](_0x15f6b6)['json'](_0x1b20ee);}};}function respondWithFilteredResult(_0x248168,_0x1f57ef){return function(_0x2e909f){if(_0x2e909f){var _0x375ff4=typeof _0x1f57ef[_0x3719('0x14')]===_0x3719('0x15')&&typeof _0x1f57ef[_0x3719('0x16')]==='undefined';var _0x26ecce=_0x2e909f[_0x3719('0x17')];var _0x34ef40=_0x375ff4?0x0:_0x1f57ef['offset'];var _0x1249ff=_0x375ff4?_0x2e909f[_0x3719('0x17')]:_0x1f57ef[_0x3719('0x14')]+_0x1f57ef['limit'];var _0x1e91d7;if(_0x1249ff>=_0x26ecce){_0x1249ff=_0x26ecce;_0x1e91d7=0xc8;}else{_0x1e91d7=0xce;}_0x248168[_0x3719('0x13')](_0x1e91d7);return _0x248168[_0x3719('0x18')](_0x3719('0x19'),_0x34ef40+'-'+_0x1249ff+'/'+_0x26ecce)[_0x3719('0x1a')](_0x2e909f);}return null;};}function patchUpdates(_0x1e5d90){return function(_0x1c5cd1){try{jsonpatch[_0x3719('0x1b')](_0x1c5cd1,_0x1e5d90,!![]);}catch(_0x3dab7c){return BPromise[_0x3719('0x1c')](_0x3dab7c);}return _0x1c5cd1[_0x3719('0x1d')]();};}function saveUpdates(_0xec025e,_0x1bb60c){return function(_0x126bd5){if(_0x126bd5){return _0x126bd5[_0x3719('0x1e')](_0xec025e)['then'](function(_0x1477e8){return _0x1477e8;});}return null;};}function removeEntity(_0x5a3dad,_0x1c0ff9){return function(_0x5ce0f0){if(_0x5ce0f0){return _0x5ce0f0[_0x3719('0x1f')]()[_0x3719('0x20')](function(){_0x5a3dad[_0x3719('0x13')](0xcc)[_0x3719('0x12')]();});}};}function handleEntityNotFound(_0x4042d9,_0x43f2c1){return function(_0x56d8d4){if(!_0x56d8d4){_0x4042d9['sendStatus'](0x194);}return _0x56d8d4;};}function handleError(_0x3fe5e8,_0x16f016){_0x16f016=_0x16f016||0x1f4;return function(_0x2f7094){logger['error'](_0x2f7094['stack']);if(_0x2f7094[_0x3719('0x21')]){delete _0x2f7094[_0x3719('0x21')];}_0x3fe5e8['status'](_0x16f016)[_0x3719('0x22')](_0x2f7094);};}exports[_0x3719('0x23')]=function(_0x54870c,_0x2b31cd){var _0x1e58d3={},_0x3c67d0={},_0x43791d={'count':0x0,'rows':[]};var _0x331a4b=_[_0x3719('0x24')](db[_0x3719('0x25')][_0x3719('0x26')],function(_0x1c206f){return{'name':_0x1c206f[_0x3719('0x27')],'type':_0x1c206f['type'][_0x3719('0x28')]};});_0x3c67d0[_0x3719('0x29')]=_[_0x3719('0x2a')](_[_0x3719('0x24')](_0x331a4b,_0x3719('0x21')),[_0x3719('0x21')]);_0x3c67d0[_0x3719('0x2b')]=_[_0x3719('0x2c')](_0x54870c[_0x3719('0x2b')]);_0x3c67d0[_0x3719('0x2d')]=_[_0x3719('0x2e')](_0x3c67d0[_0x3719('0x29')],_0x3c67d0[_0x3719('0x2b')]);_0x1e58d3[_0x3719('0x2f')]=_[_0x3719('0x2e')](_0x3c67d0[_0x3719('0x29')],qs[_0x3719('0x30')](_0x54870c[_0x3719('0x2b')][_0x3719('0x30')]));_0x1e58d3[_0x3719('0x2f')]=_0x1e58d3[_0x3719('0x2f')]['length']?_0x1e58d3[_0x3719('0x2f')]:_0x3c67d0[_0x3719('0x29')];if(!_0x54870c[_0x3719('0x2b')][_0x3719('0x31')](_0x3719('0x32'))){_0x1e58d3['limit']=qs['limit'](_0x54870c['query'][_0x3719('0x16')]);_0x1e58d3['offset']=qs[_0x3719('0x14')](_0x54870c['query']['offset']);}_0x1e58d3[_0x3719('0x33')]=qs[_0x3719('0x34')](_0x54870c[_0x3719('0x2b')]['sort']);_0x1e58d3[_0x3719('0x35')]=qs[_0x3719('0x2d')](_[_0x3719('0x36')](_0x54870c[_0x3719('0x2b')],_0x3c67d0[_0x3719('0x2d')]),_0x331a4b);if(_0x54870c[_0x3719('0x2b')][_0x3719('0x37')]){_0x1e58d3['where']=_['merge'](_0x1e58d3['where'],{'$or':_[_0x3719('0x24')](_0x331a4b,function(_0x52524f){if(_0x52524f[_0x3719('0x38')]!==_0x3719('0x39')){var _0x2f979={};_0x2f979[_0x52524f[_0x3719('0x21')]]={'$like':'%'+_0x54870c[_0x3719('0x2b')][_0x3719('0x37')]+'%'};return _0x2f979;}})});}_0x1e58d3=_[_0x3719('0x3a')]({},_0x1e58d3,_0x54870c[_0x3719('0x3b')]);var _0x2d4331={'where':_0x1e58d3[_0x3719('0x35')]};return db[_0x3719('0x25')][_0x3719('0x17')](_0x2d4331)[_0x3719('0x20')](function(_0x3b8602){_0x43791d['count']=_0x3b8602;if(_0x54870c[_0x3719('0x2b')][_0x3719('0x3c')]){_0x1e58d3['include']=[{'all':!![]}];}return db[_0x3719('0x25')][_0x3719('0x3d')](_0x1e58d3);})[_0x3719('0x20')](function(_0x4699bd){_0x43791d[_0x3719('0x3e')]=_0x4699bd;return _0x43791d;})[_0x3719('0x20')](respondWithFilteredResult(_0x2b31cd,_0x1e58d3))[_0x3719('0x3f')](handleError(_0x2b31cd,null));};exports[_0x3719('0x40')]=function(_0x2bfbd7,_0x2cb28c){var _0xef1188={'raw':!![],'where':{'id':_0x2bfbd7['params']['id']}},_0x5f5c64={};_0x5f5c64[_0x3719('0x29')]=_[_0x3719('0x2c')](db['CmCustomField'][_0x3719('0x26')]);_0x5f5c64[_0x3719('0x2b')]=_[_0x3719('0x2c')](_0x2bfbd7[_0x3719('0x2b')]);_0x5f5c64[_0x3719('0x2d')]=_[_0x3719('0x2e')](_0x5f5c64[_0x3719('0x29')],_0x5f5c64[_0x3719('0x2b')]);_0xef1188['attributes']=_['intersection'](_0x5f5c64[_0x3719('0x29')],qs[_0x3719('0x30')](_0x2bfbd7[_0x3719('0x2b')]['fields']));_0xef1188['attributes']=_0xef1188[_0x3719('0x2f')][_0x3719('0x41')]?_0xef1188[_0x3719('0x2f')]:_0x5f5c64['model'];if(_0x2bfbd7[_0x3719('0x2b')]['includeAll']){_0xef1188[_0x3719('0x42')]=[{'all':!![]}];}_0xef1188=_[_0x3719('0x3a')]({},_0xef1188,_0x2bfbd7[_0x3719('0x3b')]);return db[_0x3719('0x25')][_0x3719('0x43')](_0xef1188)[_0x3719('0x20')](handleEntityNotFound(_0x2cb28c,null))['then'](respondWithResult(_0x2cb28c,null))[_0x3719('0x3f')](handleError(_0x2cb28c,null));};exports['update']=function(_0x346181,_0x2e7dae){if(_0x346181['body']['id']){delete _0x346181[_0x3719('0x44')]['id'];}return db['CmCustomField'][_0x3719('0x43')]({'where':{'id':_0x346181[_0x3719('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e7dae,null))[_0x3719('0x20')](saveUpdates(_0x346181[_0x3719('0x44')],null))[_0x3719('0x20')](respondWithResult(_0x2e7dae,null))['catch'](handleError(_0x2e7dae,null));};exports['destroy']=function(_0x41815f,_0x4ac432){return db[_0x3719('0x25')][_0x3719('0x43')]({'where':{'id':_0x41815f['params']['id']}})[_0x3719('0x20')](handleEntityNotFound(_0x4ac432,null))[_0x3719('0x20')](removeEntity(_0x4ac432,null))['catch'](handleError(_0x4ac432,null));};exports[_0x3719('0x46')]=function(_0xf55cd8,_0x1c82c4){var _0x3cadb3;return db[_0x3719('0x47')][_0x3719('0x48')](function(_0x7ef6b){return db[_0x3719('0x25')]['create'](_0xf55cd8['body'],{'transaction':_0x7ef6b})[_0x3719('0x20')](function(_0x5ba7a4){_0x3cadb3=_0x5ba7a4;var _0x62636c={'type':db[_0x3719('0x49')]['TEXT'],'transaction':_0x7ef6b};switch(_0xf55cd8[_0x3719('0x44')][_0x3719('0x38')]){case'text':_0x62636c[_0x3719('0x38')]=db[_0x3719('0x49')]['TEXT'];break;case'number':_0x62636c[_0x3719('0x38')]=db[_0x3719('0x49')][_0x3719('0x4a')];break;case _0x3719('0x4b'):_0x62636c[_0x3719('0x38')]=db[_0x3719('0x49')][_0x3719('0x4c')];_0x62636c['defaultValue']=![];break;default:}return db[_0x3719('0x47')]['queryInterface'][_0x3719('0x4d')](_0x3719('0x4e'),util[_0x3719('0x4f')](_0x3719('0x50'),_0x3cadb3['id']),_0x62636c);})['then'](function(){return _0x3cadb3;});})['then'](respondWithResult(_0x1c82c4,0xc9))[_0x3719('0x3f')](handleError(_0x1c82c4,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9d0fce4..6818a73 100644 --- a/server/api/cmCustomField/cmCustomField.model.js +++ b/server/api/cmCustomField/cmCustomField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e64=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e4800,_0x144aaa){var _0x260452=function(_0x531de3){while(--_0x531de3){_0x1e4800['push'](_0x1e4800['shift']());}};_0x260452(++_0x144aaa);}(_0x8e64,0x19e));var _0x48e6=function(_0xd9ae3,_0x17eec4){_0xd9ae3=_0xd9ae3-0x0;var _0x3daa8b=_0x8e64[_0xd9ae3];return _0x3daa8b;};'use strict';var _=require('lodash');var util=require(_0x48e6('0x0'));var logger=require(_0x48e6('0x1'))(_0x48e6('0x2'));var moment=require(_0x48e6('0x3'));var BPromise=require(_0x48e6('0x4'));var rp=require(_0x48e6('0x5'));var fs=require('fs');var path=require(_0x48e6('0x6'));var rimraf=require(_0x48e6('0x7'));var config=require(_0x48e6('0x8'));var attributes=require(_0x48e6('0x9'));module[_0x48e6('0xa')]=function(_0x25be8b,_0x58db1f){return _0x25be8b[_0x48e6('0xb')](_0x48e6('0xc'),attributes,{'tableName':_0x48e6('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x910b=['request-promise','path','rimraf','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','util','api','moment','bluebird'];(function(_0x594061,_0x3777af){var _0x2a3528=function(_0x58d9e1){while(--_0x58d9e1){_0x594061['push'](_0x594061['shift']());}};_0x2a3528(++_0x3777af);}(_0x910b,0xcd));var _0xb910=function(_0x53cc8e,_0x1a476b){_0x53cc8e=_0x53cc8e-0x0;var _0x93985f=_0x910b[_0x53cc8e];return _0x93985f;};'use strict';var _=require('lodash');var util=require(_0xb910('0x0'));var logger=require('../../config/logger')(_0xb910('0x1'));var moment=require(_0xb910('0x2'));var BPromise=require(_0xb910('0x3'));var rp=require(_0xb910('0x4'));var fs=require('fs');var path=require(_0xb910('0x5'));var rimraf=require(_0xb910('0x6'));var config=require('../../config/environment');var attributes=require(_0xb910('0x7'));module['exports']=function(_0x5cbf6d,_0x36cd49){return _0x5cbf6d[_0xb910('0x8')](_0xb910('0x9'),attributes,{'tableName':_0xb910('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 948a253..8479cad 100644 --- a/server/api/cmCustomField/cmCustomField.rpc.js +++ b/server/api/cmCustomField/cmCustomField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1194=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xdc0e74,_0x4ab035){var _0x222685=function(_0x526e56){while(--_0x526e56){_0xdc0e74['push'](_0xdc0e74['shift']());}};_0x222685(++_0x4ab035);}(_0x1194,0x1d4));var _0x4119=function(_0x44b0af,_0xdb6975){_0x44b0af=_0x44b0af-0x0;var _0xafaa74=_0x1194[_0x44b0af];return _0xafaa74;};'use strict';var _=require(_0x4119('0x0'));var util=require('util');var moment=require(_0x4119('0x1'));var BPromise=require(_0x4119('0x2'));var rs=require(_0x4119('0x3'));var fs=require('fs');var Redis=require(_0x4119('0x4'));var db=require(_0x4119('0x5'))['db'];var utils=require(_0x4119('0x6'));var logger=require('../../config/logger')(_0x4119('0x7'));var config=require(_0x4119('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4119('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2765da,_0x78cc91,_0x33c87e){return new BPromise(function(_0x8f72a9,_0x12374a){return client[_0x4119('0xa')](_0x2765da,_0x33c87e)[_0x4119('0xb')](function(_0x3b6f10){logger[_0x4119('0xc')](_0x4119('0xd'),_0x78cc91,_0x4119('0xe'));logger[_0x4119('0xf')](_0x4119('0x10'),_0x78cc91,_0x4119('0xe'),JSON[_0x4119('0x11')](_0x3b6f10));if(_0x3b6f10[_0x4119('0x12')]){if(_0x3b6f10['error']['code']===0x1f4){logger[_0x4119('0x12')]('CmCustomField,\x20%s,\x20%s',_0x78cc91,_0x3b6f10[_0x4119('0x12')][_0x4119('0x13')]);return _0x12374a(_0x3b6f10['error'][_0x4119('0x13')]);}logger[_0x4119('0x12')](_0x4119('0xd'),_0x78cc91,_0x3b6f10['error'][_0x4119('0x13')]);return _0x8f72a9(_0x3b6f10['error'][_0x4119('0x13')]);}else{logger[_0x4119('0xc')](_0x4119('0xd'),_0x78cc91,_0x4119('0xe'));_0x8f72a9(_0x3b6f10[_0x4119('0x14')][_0x4119('0x13')]);}})[_0x4119('0x15')](function(_0x5baf50){logger[_0x4119('0x12')](_0x4119('0xd'),_0x78cc91,_0x5baf50);_0x12374a(_0x5baf50);});});} \ No newline at end of file +var _0x520a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x4a668a,_0x50b238){var _0x250642=function(_0x4f5493){while(--_0x4f5493){_0x4a668a['push'](_0x4a668a['shift']());}};_0x250642(++_0x50b238);}(_0x520a,0x1de));var _0xa520=function(_0x17bd03,_0x54d196){_0x17bd03=_0x17bd03-0x0;var _0x535eb1=_0x520a[_0x17bd03];return _0x535eb1;};'use strict';var _=require(_0xa520('0x0'));var util=require(_0xa520('0x1'));var moment=require(_0xa520('0x2'));var BPromise=require(_0xa520('0x3'));var rs=require(_0xa520('0x4'));var fs=require('fs');var Redis=require(_0xa520('0x5'));var db=require(_0xa520('0x6'))['db'];var utils=require(_0xa520('0x7'));var logger=require(_0xa520('0x8'))(_0xa520('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x413c18,_0xdc9e3a,_0x4bea9a){return new BPromise(function(_0x179a34,_0x556697){return client[_0xa520('0xb')](_0x413c18,_0x4bea9a)[_0xa520('0xc')](function(_0x161d8e){logger[_0xa520('0xd')](_0xa520('0xe'),_0xdc9e3a,_0xa520('0xf'));logger[_0xa520('0x10')](_0xa520('0x11'),_0xdc9e3a,'request\x20sent',JSON[_0xa520('0x12')](_0x161d8e));if(_0x161d8e[_0xa520('0x13')]){if(_0x161d8e[_0xa520('0x13')][_0xa520('0x14')]===0x1f4){logger[_0xa520('0x13')](_0xa520('0xe'),_0xdc9e3a,_0x161d8e[_0xa520('0x13')][_0xa520('0x15')]);return _0x556697(_0x161d8e[_0xa520('0x13')][_0xa520('0x15')]);}logger[_0xa520('0x13')]('CmCustomField,\x20%s,\x20%s',_0xdc9e3a,_0x161d8e[_0xa520('0x13')][_0xa520('0x15')]);return _0x179a34(_0x161d8e[_0xa520('0x13')]['message']);}else{logger[_0xa520('0xd')](_0xa520('0xe'),_0xdc9e3a,'request\x20sent');_0x179a34(_0x161d8e[_0xa520('0x16')]['message']);}})[_0xa520('0x17')](function(_0x323c7c){logger[_0xa520('0x13')](_0xa520('0xe'),_0xdc9e3a,_0x323c7c);_0x556697(_0x323c7c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d8c455d..348843b 100644 --- a/server/api/cmCustomField/index.js +++ b/server/api/cmCustomField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc6=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','/:id','update','exports'];(function(_0x42095d,_0x4e2d02){var _0x5e7efe=function(_0x2e1170){while(--_0x2e1170){_0x42095d['push'](_0x42095d['shift']());}};_0x5e7efe(++_0x4e2d02);}(_0x4bc6,0xd0));var _0x64bc=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x4bc6[_0x2112d4];return _0x434972;};'use strict';var multer=require('multer');var util=require(_0x64bc('0x0'));var path=require(_0x64bc('0x1'));var timeout=require('connect-timeout');var express=require(_0x64bc('0x2'));var router=express['Router']();var fs_extra=require(_0x64bc('0x3'));var auth=require(_0x64bc('0x4'));var interaction=require(_0x64bc('0x5'));var config=require(_0x64bc('0x6'));var controller=require(_0x64bc('0x7'));router[_0x64bc('0x8')]('/',auth[_0x64bc('0x9')](),controller[_0x64bc('0xa')]);router[_0x64bc('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x64bc('0xb')]('/',auth[_0x64bc('0x9')](),controller[_0x64bc('0xc')]);router['put'](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller[_0x64bc('0xe')]);router['delete'](_0x64bc('0xd'),auth[_0x64bc('0x9')](),controller['destroy']);module[_0x64bc('0xf')]=router; \ No newline at end of file +var _0x5379=['../../config/environment','isAuthenticated','get','/:id','show','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b075e,_0x57874c){var _0x31385c=function(_0x3ab6ef){while(--_0x3ab6ef){_0x4b075e['push'](_0x4b075e['shift']());}};_0x31385c(++_0x57874c);}(_0x5379,0x1a2));var _0x9537=function(_0x345ea4,_0x468b51){_0x345ea4=_0x345ea4-0x0;var _0x19fc89=_0x5379[_0x345ea4];return _0x19fc89;};'use strict';var multer=require(_0x9537('0x0'));var util=require(_0x9537('0x1'));var path=require(_0x9537('0x2'));var timeout=require('connect-timeout');var express=require(_0x9537('0x3'));var router=express['Router']();var fs_extra=require(_0x9537('0x4'));var auth=require(_0x9537('0x5'));var interaction=require(_0x9537('0x6'));var config=require(_0x9537('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x9537('0x8')](),controller['index']);router[_0x9537('0x9')](_0x9537('0xa'),auth[_0x9537('0x8')](),controller[_0x9537('0xb')]);router['post']('/',auth[_0x9537('0x8')](),controller[_0x9537('0xc')]);router[_0x9537('0xd')](_0x9537('0xa'),auth['isAuthenticated'](),controller[_0x9537('0xe')]);router['delete']('/:id',auth[_0x9537('0x8')](),controller[_0x9537('0xf')]);module[_0x9537('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7b63995..63e8bfe 100644 --- a/server/api/cmHopper/cmHopper.attributes.js +++ b/server/api/cmHopper/cmHopper.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7e5=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x4f66c2,_0x47d4ed){var _0x447633=function(_0x3205d4){while(--_0x3205d4){_0x4f66c2['push'](_0x4f66c2['shift']());}};_0x447633(++_0x47d4ed);}(_0xf7e5,0x1d8));var _0x5f7e=function(_0x395aee,_0x43b759){_0x395aee=_0x395aee-0x0;var _0x1837a5=_0xf7e5[_0x395aee];return _0x1837a5;};'use strict';var moment=require(_0x5f7e('0x0'));var Sequelize=require(_0x5f7e('0x1'));module[_0x5f7e('0x2')]={'phone':{'type':Sequelize[_0x5f7e('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5f7e('0x4')],'defaultValue':moment()[_0x5f7e('0x5')](_0x5f7e('0x6'))},'countbusyretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5f7e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5f7e('0x4')]},'priority':{'type':Sequelize[_0x5f7e('0x7')](0x2)[_0x5f7e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5f7e('0x7')],'unique':_0x5f7e('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x5f7e('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x5f7e('0x7')],'unique':_0x5f7e('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5f7e('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x41d6=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN'];(function(_0x1e966e,_0x9a6c97){var _0x1c2f2d=function(_0x486ec4){while(--_0x486ec4){_0x1e966e['push'](_0x1e966e['shift']());}};_0x1c2f2d(++_0x9a6c97);}(_0x41d6,0xec));var _0x641d=function(_0x26eb3d,_0x15d60c){_0x26eb3d=_0x26eb3d-0x0;var _0xb837e=_0x41d6[_0x26eb3d];return _0xb837e;};'use strict';var moment=require(_0x641d('0x0'));var Sequelize=require(_0x641d('0x1'));module['exports']={'phone':{'type':Sequelize[_0x641d('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x641d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x641d('0x4')],'defaultValue':moment()[_0x641d('0x5')](_0x641d('0x6'))},'countbusyretry':{'type':Sequelize[_0x641d('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x641d('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x641d('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x641d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x641d('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x641d('0x4')]},'priority':{'type':Sequelize[_0x641d('0x7')](0x2)[_0x641d('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x641d('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x641d('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x641d('0x7')],'unique':_0x641d('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x641d('0x7')],'unique':_0x641d('0x9')},'CampaignId':{'type':Sequelize[_0x641d('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x641d('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x641d('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x641d('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index fe59821..ffda251 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfe8=['CmHopperAdditionalPhone','end','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','filter','dialPreviewAutoRecallMe','value','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','CmList','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','then','error','stack','name','send','map','CmHopper','type','key','model','query','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','catch','show','keys','rawAttributes','intersection','length','options','find','create','update','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','createdAt','updatedAt','state','deleted','campaign','user','UserId','deletedat','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal'];(function(_0x3877c1,_0x238c29){var _0x59056a=function(_0x3567cd){while(--_0x3567cd){_0x3877c1['push'](_0x3877c1['shift']());}};_0x59056a(++_0x238c29);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x244a8a,_0x53d435){_0x244a8a=_0x244a8a-0x0;var _0x335fa7=_0xbfe8[_0x244a8a];return _0x335fa7;};'use strict';var moment=require('moment');var _=require(_0x8bfe('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8bfe('0x1'))(_0x8bfe('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x101fc1,_0x31df14){_0x31df14=_0x31df14||0xc8;return function(_0x57eb53){if(_0x57eb53){return _0x101fc1[_0x8bfe('0x3')](_0x31df14)[_0x8bfe('0x4')](_0x57eb53);}};}function respondWithFilteredResult(_0x314a9a,_0x4933c9){return function(_0x29bb94){if(_0x29bb94){var _0x1b7dbd=typeof _0x4933c9[_0x8bfe('0x5')]===_0x8bfe('0x6')&&typeof _0x4933c9[_0x8bfe('0x7')]===_0x8bfe('0x6');var _0x19a47e=_0x29bb94[_0x8bfe('0x8')];var _0x243a11=_0x1b7dbd?0x0:_0x4933c9[_0x8bfe('0x5')];var _0x1f19ee=_0x1b7dbd?_0x29bb94[_0x8bfe('0x8')]:_0x4933c9[_0x8bfe('0x5')]+_0x4933c9[_0x8bfe('0x7')];var _0x30f76d;if(_0x1f19ee>=_0x19a47e){_0x1f19ee=_0x19a47e;_0x30f76d=0xc8;}else{_0x30f76d=0xce;}_0x314a9a['status'](_0x30f76d);return _0x314a9a[_0x8bfe('0x9')]('Content-Range',_0x243a11+'-'+_0x1f19ee+'/'+_0x19a47e)[_0x8bfe('0x4')](_0x29bb94);}return null;};}function saveUpdates(_0x2f479d,_0x22a131){return function(_0x5ba48c){if(_0x5ba48c){return _0x5ba48c['update'](_0x2f479d)[_0x8bfe('0xa')](function(_0x425eb8){return _0x425eb8;});}return null;};}function handleEntityNotFound(_0x22737f,_0x36fd25){return function(_0x46c8e3){if(!_0x46c8e3){_0x22737f['sendStatus'](0x194);}return _0x46c8e3;};}function handleError(_0x41cc42,_0x5520d7){_0x5520d7=_0x5520d7||0x1f4;return function(_0x55914b){logger[_0x8bfe('0xb')](_0x55914b[_0x8bfe('0xc')]);if(_0x55914b[_0x8bfe('0xd')]){delete _0x55914b['name'];}_0x41cc42['status'](_0x5520d7)[_0x8bfe('0xe')](_0x55914b);};}exports['index']=function(_0x4d6993,_0x2e7c29){var _0x17d688={},_0x5d8bf1={},_0x13ffc3={'count':0x0,'rows':[]};var _0xfd4a2a=_[_0x8bfe('0xf')](db[_0x8bfe('0x10')]['rawAttributes'],function(_0xbc7fa2){return{'name':_0xbc7fa2['fieldName'],'type':_0xbc7fa2[_0x8bfe('0x11')][_0x8bfe('0x12')]};});_0x5d8bf1[_0x8bfe('0x13')]=_['map'](_0xfd4a2a,'name');_0x5d8bf1[_0x8bfe('0x14')]=_['keys'](_0x4d6993['query']);_0x5d8bf1[_0x8bfe('0x15')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],_0x5d8bf1['query']);_0x5d8bf1[_0x8bfe('0x15')]=_[_0x8bfe('0x16')](_0x5d8bf1[_0x8bfe('0x15')],[_0x8bfe('0x17'),'$or',_0x8bfe('0x18'),_0x8bfe('0x19'),'$lt',_0x8bfe('0x1a'),_0x8bfe('0x1b'),_0x8bfe('0x1c'),_0x8bfe('0x1d'),_0x8bfe('0x1e'),_0x8bfe('0x1f'),'$in',_0x8bfe('0x20'),_0x8bfe('0x21'),_0x8bfe('0x22'),_0x8bfe('0x23'),_0x8bfe('0x24'),_0x8bfe('0x21'),_0x8bfe('0x25'),_0x8bfe('0x26'),_0x8bfe('0x27'),_0x8bfe('0x28')]);_0x17d688[_0x8bfe('0x29')]=_['intersection'](_0x5d8bf1[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x4d6993['query'][_0x8bfe('0x2a')]));_0x17d688[_0x8bfe('0x29')]=_0x17d688[_0x8bfe('0x29')]['length']?_0x17d688[_0x8bfe('0x29')]:_0x5d8bf1[_0x8bfe('0x13')];if(!_0x4d6993['query']['hasOwnProperty'](_0x8bfe('0x2b'))){_0x17d688[_0x8bfe('0x7')]=qs[_0x8bfe('0x7')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x7')]);_0x17d688[_0x8bfe('0x5')]=qs[_0x8bfe('0x5')](_0x4d6993[_0x8bfe('0x14')][_0x8bfe('0x5')]);}_0x17d688[_0x8bfe('0x2c')]=qs['sort'](_0x4d6993['query'][_0x8bfe('0x2d')]);_0x17d688[_0x8bfe('0x2e')]=qs[_0x8bfe('0x15')](_[_0x8bfe('0x2f')](_0x4d6993[_0x8bfe('0x14')],_0x5d8bf1[_0x8bfe('0x15')]),_0xfd4a2a);if(_0x4d6993[_0x8bfe('0x14')]['filter']){_0x17d688[_0x8bfe('0x2e')]=_[_0x8bfe('0x30')](_0x17d688['where'],{'$or':_[_0x8bfe('0xf')](_0xfd4a2a,function(_0x96cdc9){if(_0x96cdc9[_0x8bfe('0x11')]!==_0x8bfe('0x31')){var _0x407763={};_0x407763[_0x96cdc9['name']]={'$like':'%'+_0x4d6993[_0x8bfe('0x14')]['filter']+'%'};return _0x407763;}})});}_0x17d688=_['merge']({},_0x17d688,_0x4d6993['options']);var _0x56e04b={'where':_0x17d688[_0x8bfe('0x2e')]};return db[_0x8bfe('0x10')][_0x8bfe('0x8')](_0x56e04b)[_0x8bfe('0xa')](function(_0x23ac8b){_0x13ffc3[_0x8bfe('0x8')]=_0x23ac8b;if(_0x4d6993[_0x8bfe('0x14')]['includeAll']){_0x17d688[_0x8bfe('0x32')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x17d688);})['then'](function(_0x18e0e7){_0x13ffc3[_0x8bfe('0x33')]=_0x18e0e7;return _0x13ffc3;})[_0x8bfe('0xa')](respondWithFilteredResult(_0x2e7c29,_0x17d688))[_0x8bfe('0x34')](handleError(_0x2e7c29,null));};exports[_0x8bfe('0x35')]=function(_0x6b96d6,_0x3a65a6){var _0x20b085={'raw':!![],'where':{'id':_0x6b96d6['params']['id']}},_0x52c9da={};_0x52c9da[_0x8bfe('0x13')]=_[_0x8bfe('0x36')](db[_0x8bfe('0x10')][_0x8bfe('0x37')]);_0x52c9da[_0x8bfe('0x14')]=_[_0x8bfe('0x36')](_0x6b96d6[_0x8bfe('0x14')]);_0x52c9da[_0x8bfe('0x15')]=_[_0x8bfe('0x38')](_0x52c9da['model'],_0x52c9da[_0x8bfe('0x14')]);_0x20b085[_0x8bfe('0x29')]=_[_0x8bfe('0x38')](_0x52c9da[_0x8bfe('0x13')],qs[_0x8bfe('0x2a')](_0x6b96d6[_0x8bfe('0x14')][_0x8bfe('0x2a')]));_0x20b085['attributes']=_0x20b085[_0x8bfe('0x29')][_0x8bfe('0x39')]?_0x20b085['attributes']:_0x52c9da[_0x8bfe('0x13')];if(_0x6b96d6['query']['includeAll']){_0x20b085[_0x8bfe('0x32')]=[{'all':!![]}];}_0x20b085=_[_0x8bfe('0x30')]({},_0x20b085,_0x6b96d6[_0x8bfe('0x3a')]);return db['CmHopper'][_0x8bfe('0x3b')](_0x20b085)['then'](handleEntityNotFound(_0x3a65a6,null))[_0x8bfe('0xa')](respondWithResult(_0x3a65a6,null))[_0x8bfe('0x34')](handleError(_0x3a65a6,null));};exports['create']=function(_0x1b99ec,_0x3433a1){return db[_0x8bfe('0x10')][_0x8bfe('0x3c')](_0x1b99ec['body'],{})[_0x8bfe('0xa')](respondWithResult(_0x3433a1,0xc9))[_0x8bfe('0x34')](handleError(_0x3433a1,null));};exports[_0x8bfe('0x3d')]=function(_0x4af00f,_0x58342b){if(_0x4af00f[_0x8bfe('0x3e')]['id']){delete _0x4af00f[_0x8bfe('0x3e')]['id'];}return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x4af00f[_0x8bfe('0x3f')]['id']}})[_0x8bfe('0xa')](handleEntityNotFound(_0x58342b,null))[_0x8bfe('0xa')](saveUpdates(_0x4af00f[_0x8bfe('0x3e')],null))['then'](respondWithResult(_0x58342b,null))[_0x8bfe('0x34')](handleError(_0x58342b,null));};exports[_0x8bfe('0x40')]=function(_0x4e6949,_0x4eb069){return db[_0x8bfe('0x10')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](respondWithResult(_0x4eb069,null))['catch'](handleError(_0x4eb069,null));};exports[_0x8bfe('0x41')]=function(_0x3c4086,_0x55ad6e){var _0x1f2788;var _0x2ad3c1=_0x3c4086[_0x8bfe('0x3f')]['id'];return db[_0x8bfe('0x10')][_0x8bfe('0x3b')]({'where':{'id':_0x3c4086[_0x8bfe('0x3f')]['id']}})['then'](handleEntityNotFound(_0x55ad6e,null))['then'](function(_0x5a653d){if(_0x5a653d){return _0x5a653d['destroy']()[_0x8bfe('0xa')](function(_0x2b84a3){return _0x2b84a3;});}})[_0x8bfe('0xa')](function(_0x28947e){_0x1f2788=_0x28947e;if(_0x28947e){if(_0x28947e[_0x8bfe('0x42')]||_0x28947e['CampaignId']){return db[_0x28947e[_0x8bfe('0x42')]?_0x8bfe('0x43'):_0x8bfe('0x44')][_0x8bfe('0x3b')]({'where':{'id':_0x28947e[_0x8bfe('0x42')]?_0x28947e[_0x8bfe('0x42')]:_0x28947e['CampaignId']},'attributes':['id',_0x8bfe('0xd')],'raw':!![]});}}})[_0x8bfe('0xa')](function(_0x4ddb08){var _0x16d99e={};if(_0x4ddb08){_['merge'](_0x16d99e,_['omit'](_0x1f2788['dataValues'],[_0x8bfe('0x45'),_0x8bfe('0x46'),'id']));_0x16d99e[_0x8bfe('0x47')]=0x15;_0x16d99e['statedesc']=_0x8bfe('0x48');_0x16d99e[_0x8bfe('0x49')]=_0x4ddb08[_0x8bfe('0xd')];_0x16d99e['membername']=_0x3c4086[_0x8bfe('0x4a')][_0x8bfe('0xd')];_0x16d99e[_0x8bfe('0x4b')]=_0x3c4086[_0x8bfe('0x4a')]['id'];_0x16d99e['deleted']=!![];_0x16d99e[_0x8bfe('0x4c')]=moment()[_0x8bfe('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x16d99e[_0x8bfe('0x4e')]=_0x1f2788[_0x8bfe('0x4f')];_0x16d99e[_0x8bfe('0x50')]=_0x1f2788['VoiceQueueId']?_0x8bfe('0x51'):_0x8bfe('0x52');return db[_0x8bfe('0x53')][_0x8bfe('0x3b')]({'where':{'id':_0x16d99e[_0x8bfe('0x54')]},'attributes':['firstName',_0x8bfe('0x55')]})[_0x8bfe('0xa')](function(_0x3ff83d){if(!_[_0x8bfe('0x56')](_0x55ad6e)&&!_[_0x8bfe('0x56')](_0x3ff83d[_0x8bfe('0x57')])){_0x16d99e['calleridname']=_0x3ff83d[_0x8bfe('0x57')];if(!_['isNil'](_0x3ff83d[_0x8bfe('0x55')])){_0x16d99e[_0x8bfe('0x58')]+='\x20'+_0x3ff83d[_0x8bfe('0x55')];}}})[_0x8bfe('0x59')](function(){return db[_0x8bfe('0x5a')][_0x8bfe('0x3c')](_0x16d99e);});}})['then'](function(_0x159d37){return db[_0x8bfe('0x5b')][_0x8bfe('0x41')]({'where':{'CmHopperId':_0x2ad3c1}});})['then'](function(){return _0x55ad6e[_0x8bfe('0x3')](0xcc)[_0x8bfe('0x5c')]();})['catch'](handleError(_0x55ad6e,null));};exports[_0x8bfe('0x5d')]=function(_0x29f56c,_0x121bea){var _0x56959e=[];return db[_0x8bfe('0x53')][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x126398){_0x56959e=_[_0x8bfe('0x36')](_0x126398);return _0x29f56c[_0x8bfe('0x4a')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id',_0x8bfe('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8bfe('0xa')](function(_0x500467){if(_0x500467&&_0x500467[_0x8bfe('0x39')]){return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x5062d5){var _0x4b87cb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x500467,'id')},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0xfa5db0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x500467)[_0x8bfe('0x62')]([_0x8bfe('0x63'),0x0])['map']('id')[_0x8bfe('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']}]};var _0x1f153d={'$or':[_0x4b87cb,_0xfa5db0]};var _0x199e90=[];if(_0x29f56c[_0x8bfe('0x3e')]['direction']&&_0x29f56c[_0x8bfe('0x3e')]['direction']===_0x8bfe('0x65')){if(!_[_0x8bfe('0x66')](_0x29f56c['body']['hopperIds'])){_0x1f153d['id']={'$in':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),_0x8bfe('0x69')],['scheduledAt',_0x500467[0x0][_0x8bfe('0x5f')]==='ASC'?_0x8bfe('0x6a'):_0x8bfe('0x69')],db[_0x8bfe('0x60')][_0x8bfe('0x6b')](_0x8bfe('0x6c')),['id',_0x8bfe('0x6a')]];}else{if(!_[_0x8bfe('0x66')](_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')])){_0x1f153d['id']={'$notIn':_0x29f56c[_0x8bfe('0x3e')][_0x8bfe('0x67')]};}_0x199e90=[[_0x8bfe('0x68'),'DESC'],['scheduledAt',_0x500467[0x0]['dialOrderByScheduledAt']],db[_0x8bfe('0x60')]['literal'](_0x8bfe('0x6d')),['id','ASC']];}return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x4f'),_0x8bfe('0x70')],'where':_0x1f153d,'order':_0x199e90,'transaction':_0x5062d5,'lock':_0x5062d5[_0x8bfe('0x71')][_0x8bfe('0x72')],'include':[{'model':db['CmContact'],'as':_0x8bfe('0x73'),'attributes':_0x56959e,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':_0x8bfe('0x77'),'attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x454616){if(_0x454616){return _0x454616['update']({'UserId':_0x29f56c[_0x8bfe('0x4a')]['id']},{'transaction':_0x5062d5});}});});}})[_0x8bfe('0xa')](handleEntityNotFound(_0x121bea,null))[_0x8bfe('0xa')](respondWithResult(_0x121bea,null))['catch'](handleError(_0x121bea,null));};exports[_0x8bfe('0x79')]=function(_0x31bd4b,_0x2d2236,_0x127701){var _0x5e8e2d=[];var _0x23ea23=_0x31bd4b[_0x8bfe('0x3f')]['id'];var _0x1207a4=_0x31bd4b['user']['id'];return db['CmContact'][_0x8bfe('0x40')]()[_0x8bfe('0xa')](function(_0x28012b){_0x5e8e2d=_[_0x8bfe('0x36')](_0x28012b);return db[_0x8bfe('0x60')][_0x8bfe('0x61')](function(_0x781d89){const _0x4619f0={'id':_0x23ea23};return db['CmHopper'][_0x8bfe('0x6e')]({'attributes':['id',_0x8bfe('0x6f'),_0x8bfe('0x70')],'where':_0x4619f0,'transaction':_0x781d89,'lock':_0x781d89['LOCK'][_0x8bfe('0x72')],'include':[{'model':db[_0x8bfe('0x53')],'as':_0x8bfe('0x73'),'attributes':_0x5e8e2d,'include':[{'model':db[_0x8bfe('0x74')],'as':_0x8bfe('0x75'),'attributes':['id',_0x8bfe('0xd')]}]},{'model':db[_0x8bfe('0x7a')],'as':_0x8bfe('0x76'),'attributes':['id',_0x8bfe('0xd')]},{'model':db[_0x8bfe('0x43')],'as':'Queue','attributes':['id',_0x8bfe('0xd'),_0x8bfe('0x78')]}]})['then'](function(_0x29bf2f){if(_0x29bf2f){return _0x29bf2f[_0x8bfe('0x3d')]({'UserId':_0x1207a4},{'transaction':_0x781d89});}});});})[_0x8bfe('0xa')](handleEntityNotFound(_0x2d2236,null))['then'](respondWithResult(_0x2d2236,null))[_0x8bfe('0x34')](handleError(_0x2d2236,null));};exports[_0x8bfe('0x7b')]=function(_0x2ea522,_0x42abcc){return _0x2ea522[_0x8bfe('0x4a')][_0x8bfe('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8bfe('0x5e')},'attributes':['id'],'raw':!![]})[_0x8bfe('0xa')](function(_0x2b6a29){if(_0x2b6a29&&_0x2b6a29[_0x8bfe('0x39')]){return db[_0x8bfe('0x10')][_0x8bfe('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x2b6a29,'id')},'$or':[{'UserId':null},{'UserId':_0x2ea522[_0x8bfe('0x4a')]['id']}]}});}return 0x0;})['then'](function(_0x39ffe1){if(!_[_0x8bfe('0x56')](_0x39ffe1)&&_[_0x8bfe('0x7d')](_0x39ffe1)){return _0x42abcc[_0x8bfe('0x3')](0xc8)['json']({'contacts':_0x39ffe1});}else{logger[_0x8bfe('0xb')](_0x8bfe('0x7e'),_0x8bfe('0x7b'),0x194,_0x8bfe('0x7f'));_0x42abcc[_0x8bfe('0x80')](0x194);}})[_0x8bfe('0x34')](handleError(_0x42abcc,null));};exports[_0x8bfe('0x81')]=function(_0x94b726,_0x1a8a31){var _0x4ace16=shared[_0x8bfe('0x82')];var _0x3ef0ea=[];_[_0x8bfe('0xf')](_0x4ace16,function(_0x580ab5){_0x3ef0ea[_0x8bfe('0x83')]({'id':_0x580ab5[_0x8bfe('0xd')],'name':_0x580ab5[_0x8bfe('0xd')],'utcOffset':_0x580ab5['utcOffset']});});return _0x1a8a31[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')]({'tz':_0x3ef0ea});};exports[_0x8bfe('0x84')]=function(_0x5879b1,_0x5daf7d){var _0xa19a58=shared[_0x8bfe('0x82')];var _0x21d9ec={};if(!_['isNil'](_0xa19a58[_0x5879b1['body']['id']]))_0x21d9ec=_0xa19a58[_0x5879b1[_0x8bfe('0x3e')]['id']];return _0x5daf7d[_0x8bfe('0x3')](0xc8)[_0x8bfe('0x4')](_0x21d9ec);}; \ No newline at end of file +var _0x1dcc=['destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','direction','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','UPDATE','Contact','List','VoiceQueue','findOne','Company','CmList','Queue','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','offset','undefined','count','limit','status','set','Content-Range','then','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x2c7f77,_0x1be2c7){_0x2c7f77=_0x2c7f77-0x0;var _0x4f9f4c=_0x1dcc[_0x2c7f77];return _0x4f9f4c;};'use strict';var moment=require(_0xc1dc('0x0'));var _=require(_0xc1dc('0x1'));var qs=require(_0xc1dc('0x2'));var logger=require(_0xc1dc('0x3'))('api');var shared=require(_0xc1dc('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x20abc9,_0x3eb139){_0x3eb139=_0x3eb139||0xc8;return function(_0x2a8ff9){if(_0x2a8ff9){return _0x20abc9['status'](_0x3eb139)['json'](_0x2a8ff9);}};}function respondWithFilteredResult(_0x1e57ba,_0x381ab6){return function(_0x41b667){if(_0x41b667){var _0x4dab41=typeof _0x381ab6[_0xc1dc('0x5')]===_0xc1dc('0x6')&&typeof _0x381ab6['limit']===_0xc1dc('0x6');var _0x51c02b=_0x41b667[_0xc1dc('0x7')];var _0x49ef48=_0x4dab41?0x0:_0x381ab6[_0xc1dc('0x5')];var _0x16520d=_0x4dab41?_0x41b667[_0xc1dc('0x7')]:_0x381ab6[_0xc1dc('0x5')]+_0x381ab6[_0xc1dc('0x8')];var _0x616175;if(_0x16520d>=_0x51c02b){_0x16520d=_0x51c02b;_0x616175=0xc8;}else{_0x616175=0xce;}_0x1e57ba[_0xc1dc('0x9')](_0x616175);return _0x1e57ba[_0xc1dc('0xa')](_0xc1dc('0xb'),_0x49ef48+'-'+_0x16520d+'/'+_0x51c02b)['json'](_0x41b667);}return null;};}function saveUpdates(_0x226ba3,_0x2c5f41){return function(_0xb7e667){if(_0xb7e667){return _0xb7e667['update'](_0x226ba3)[_0xc1dc('0xc')](function(_0x7d7257){return _0x7d7257;});}return null;};}function handleEntityNotFound(_0x299520,_0xd51b1e){return function(_0x145708){if(!_0x145708){_0x299520[_0xc1dc('0xd')](0x194);}return _0x145708;};}function handleError(_0x188182,_0x21aed1){_0x21aed1=_0x21aed1||0x1f4;return function(_0x265929){logger[_0xc1dc('0xe')](_0x265929[_0xc1dc('0xf')]);if(_0x265929['name']){delete _0x265929[_0xc1dc('0x10')];}_0x188182[_0xc1dc('0x9')](_0x21aed1)[_0xc1dc('0x11')](_0x265929);};}exports[_0xc1dc('0x12')]=function(_0x47c72e,_0x332400){var _0xc01137={},_0x499a42={},_0x484f6c={'count':0x0,'rows':[]};var _0x3f96d3=_[_0xc1dc('0x13')](db[_0xc1dc('0x14')][_0xc1dc('0x15')],function(_0x1707dc){return{'name':_0x1707dc[_0xc1dc('0x16')],'type':_0x1707dc[_0xc1dc('0x17')][_0xc1dc('0x18')]};});_0x499a42['model']=_['map'](_0x3f96d3,'name');_0x499a42[_0xc1dc('0x19')]=_[_0xc1dc('0x1a')](_0x47c72e['query']);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],_0x499a42[_0xc1dc('0x19')]);_0x499a42[_0xc1dc('0x1b')]=_[_0xc1dc('0x1e')](_0x499a42[_0xc1dc('0x1b')],[_0xc1dc('0x1f'),_0xc1dc('0x20'),_0xc1dc('0x21'),'$gte',_0xc1dc('0x22'),_0xc1dc('0x23'),_0xc1dc('0x24'),_0xc1dc('0x25'),'$not',_0xc1dc('0x26'),_0xc1dc('0x27'),_0xc1dc('0x28'),_0xc1dc('0x29'),_0xc1dc('0x2a'),_0xc1dc('0x2b'),_0xc1dc('0x2c'),_0xc1dc('0x2d'),_0xc1dc('0x2a'),'$overlap',_0xc1dc('0x2e'),_0xc1dc('0x2f'),_0xc1dc('0x30')]);_0xc01137[_0xc1dc('0x31')]=_[_0xc1dc('0x1c')](_0x499a42[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x32')]));_0xc01137[_0xc1dc('0x31')]=_0xc01137[_0xc1dc('0x31')]['length']?_0xc01137[_0xc1dc('0x31')]:_0x499a42[_0xc1dc('0x1d')];if(!_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x33')](_0xc1dc('0x34'))){_0xc01137[_0xc1dc('0x8')]=qs[_0xc1dc('0x8')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x8')]);_0xc01137['offset']=qs['offset'](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x5')]);}_0xc01137[_0xc1dc('0x35')]=qs[_0xc1dc('0x36')](_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x36')]);_0xc01137['where']=qs[_0xc1dc('0x1b')](_[_0xc1dc('0x37')](_0x47c72e['query'],_0x499a42[_0xc1dc('0x1b')]),_0x3f96d3);if(_0x47c72e[_0xc1dc('0x19')]['filter']){_0xc01137[_0xc1dc('0x38')]=_[_0xc1dc('0x39')](_0xc01137[_0xc1dc('0x38')],{'$or':_['map'](_0x3f96d3,function(_0x1ee0ba){if(_0x1ee0ba[_0xc1dc('0x17')]!==_0xc1dc('0x3a')){var _0x341bb3={};_0x341bb3[_0x1ee0ba[_0xc1dc('0x10')]]={'$like':'%'+_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3b')]+'%'};return _0x341bb3;}})});}_0xc01137=_[_0xc1dc('0x39')]({},_0xc01137,_0x47c72e[_0xc1dc('0x3c')]);var _0x4e3051={'where':_0xc01137[_0xc1dc('0x38')]};return db[_0xc1dc('0x14')][_0xc1dc('0x7')](_0x4e3051)['then'](function(_0x19bde9){_0x484f6c[_0xc1dc('0x7')]=_0x19bde9;if(_0x47c72e[_0xc1dc('0x19')][_0xc1dc('0x3d')]){_0xc01137[_0xc1dc('0x3e')]=[{'all':!![]}];}return db[_0xc1dc('0x14')][_0xc1dc('0x3f')](_0xc01137);})[_0xc1dc('0xc')](function(_0x5967b2){_0x484f6c[_0xc1dc('0x40')]=_0x5967b2;return _0x484f6c;})[_0xc1dc('0xc')](respondWithFilteredResult(_0x332400,_0xc01137))[_0xc1dc('0x41')](handleError(_0x332400,null));};exports[_0xc1dc('0x42')]=function(_0x1d8107,_0x1fbdb8){var _0x503ec8={'raw':!![],'where':{'id':_0x1d8107[_0xc1dc('0x43')]['id']}},_0x12a92d={};_0x12a92d[_0xc1dc('0x1d')]=_[_0xc1dc('0x1a')](db[_0xc1dc('0x14')]['rawAttributes']);_0x12a92d['query']=_[_0xc1dc('0x1a')](_0x1d8107[_0xc1dc('0x19')]);_0x12a92d[_0xc1dc('0x1b')]=_[_0xc1dc('0x1c')](_0x12a92d[_0xc1dc('0x1d')],_0x12a92d[_0xc1dc('0x19')]);_0x503ec8[_0xc1dc('0x31')]=_['intersection'](_0x12a92d[_0xc1dc('0x1d')],qs[_0xc1dc('0x32')](_0x1d8107[_0xc1dc('0x19')]['fields']));_0x503ec8[_0xc1dc('0x31')]=_0x503ec8[_0xc1dc('0x31')][_0xc1dc('0x44')]?_0x503ec8[_0xc1dc('0x31')]:_0x12a92d['model'];if(_0x1d8107['query'][_0xc1dc('0x3d')]){_0x503ec8[_0xc1dc('0x3e')]=[{'all':!![]}];}_0x503ec8=_['merge']({},_0x503ec8,_0x1d8107[_0xc1dc('0x3c')]);return db[_0xc1dc('0x14')][_0xc1dc('0x45')](_0x503ec8)[_0xc1dc('0xc')](handleEntityNotFound(_0x1fbdb8,null))[_0xc1dc('0xc')](respondWithResult(_0x1fbdb8,null))[_0xc1dc('0x41')](handleError(_0x1fbdb8,null));};exports[_0xc1dc('0x46')]=function(_0x54bb1f,_0x5a74a0){return db[_0xc1dc('0x14')]['create'](_0x54bb1f[_0xc1dc('0x47')],{})[_0xc1dc('0xc')](respondWithResult(_0x5a74a0,0xc9))[_0xc1dc('0x41')](handleError(_0x5a74a0,null));};exports[_0xc1dc('0x48')]=function(_0x452303,_0x40eb12){if(_0x452303[_0xc1dc('0x47')]['id']){delete _0x452303[_0xc1dc('0x47')]['id'];}return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x452303[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x40eb12,null))[_0xc1dc('0xc')](saveUpdates(_0x452303[_0xc1dc('0x47')],null))[_0xc1dc('0xc')](respondWithResult(_0x40eb12,null))[_0xc1dc('0x41')](handleError(_0x40eb12,null));};exports[_0xc1dc('0x49')]=function(_0x2ca7f1,_0x29417d){return db['CmHopper']['describe']()['then'](respondWithResult(_0x29417d,null))[_0xc1dc('0x41')](handleError(_0x29417d,null));};exports[_0xc1dc('0x4a')]=function(_0x57b792,_0x129e23){var _0x6ab7fc;var _0x505272=_0x57b792[_0xc1dc('0x43')]['id'];return db['CmHopper'][_0xc1dc('0x45')]({'where':{'id':_0x57b792[_0xc1dc('0x43')]['id']}})[_0xc1dc('0xc')](handleEntityNotFound(_0x129e23,null))[_0xc1dc('0xc')](function(_0x331d24){if(_0x331d24){return _0x331d24[_0xc1dc('0x4a')]()[_0xc1dc('0xc')](function(_0x34667b){return _0x34667b;});}})['then'](function(_0x21b385){_0x6ab7fc=_0x21b385;if(_0x21b385){if(_0x21b385[_0xc1dc('0x4b')]||_0x21b385[_0xc1dc('0x4c')]){return db[_0x21b385[_0xc1dc('0x4b')]?'VoiceQueue':_0xc1dc('0x4d')][_0xc1dc('0x45')]({'where':{'id':_0x21b385[_0xc1dc('0x4b')]?_0x21b385[_0xc1dc('0x4b')]:_0x21b385[_0xc1dc('0x4c')]},'attributes':['id',_0xc1dc('0x10')],'raw':!![]});}}})[_0xc1dc('0xc')](function(_0x17d80f){var _0x512ec1={};if(_0x17d80f){_[_0xc1dc('0x39')](_0x512ec1,_[_0xc1dc('0x4e')](_0x6ab7fc[_0xc1dc('0x4f')],[_0xc1dc('0x50'),_0xc1dc('0x51'),'id']));_0x512ec1[_0xc1dc('0x52')]=0x15;_0x512ec1[_0xc1dc('0x53')]='deleted';_0x512ec1[_0xc1dc('0x54')]=_0x17d80f[_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x55')]=_0x57b792[_0xc1dc('0x56')][_0xc1dc('0x10')];_0x512ec1[_0xc1dc('0x57')]=_0x57b792[_0xc1dc('0x56')]['id'];_0x512ec1[_0xc1dc('0x58')]=!![];_0x512ec1[_0xc1dc('0x59')]=moment()['format'](_0xc1dc('0x5a'));_0x512ec1['calleridnum']=_0x6ab7fc[_0xc1dc('0x5b')];_0x512ec1[_0xc1dc('0x5c')]=_0x6ab7fc[_0xc1dc('0x4b')]?_0xc1dc('0x5d'):_0xc1dc('0x5e');return db[_0xc1dc('0x5f')][_0xc1dc('0x45')]({'where':{'id':_0x512ec1['ContactId']},'attributes':[_0xc1dc('0x60'),_0xc1dc('0x61')]})['then'](function(_0x5635a6){if(!_[_0xc1dc('0x62')](_0x129e23)&&!_[_0xc1dc('0x62')](_0x5635a6[_0xc1dc('0x60')])){_0x512ec1[_0xc1dc('0x63')]=_0x5635a6['firstName'];if(!_['isNil'](_0x5635a6[_0xc1dc('0x61')])){_0x512ec1[_0xc1dc('0x63')]+='\x20'+_0x5635a6[_0xc1dc('0x61')];}}})['finally'](function(){return db[_0xc1dc('0x64')][_0xc1dc('0x46')](_0x512ec1);});}})[_0xc1dc('0xc')](function(_0x4476eb){return db[_0xc1dc('0x65')]['destroy']({'where':{'CmHopperId':_0x505272}});})[_0xc1dc('0xc')](function(){return _0x129e23[_0xc1dc('0x9')](0xcc)[_0xc1dc('0x66')]();})[_0xc1dc('0x41')](handleError(_0x129e23,null));};exports[_0xc1dc('0x67')]=function(_0x2a1a44,_0x166d59){var _0x145b62=[];return db[_0xc1dc('0x5f')]['describe']()['then'](function(_0x3c1bf8){_0x145b62=_[_0xc1dc('0x1a')](_0x3c1bf8);return _0x2a1a44[_0xc1dc('0x56')][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':_0xc1dc('0x6a')},'attributes':['id',_0xc1dc('0x6b'),_0xc1dc('0x6c')],'raw':!![]});})[_0xc1dc('0xc')](function(_0x4de18d){if(_0x4de18d&&_0x4de18d[_0xc1dc('0x44')]){return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x20a96b){var _0x45ff61={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc1dc('0x6f')](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_[_0xc1dc('0x13')](_0x4de18d,'id')},'$or':[{'UserId':null},{'UserId':_0x2a1a44[_0xc1dc('0x56')]['id']}]};var _0x5c2942={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4de18d)[_0xc1dc('0x3b')]([_0xc1dc('0x6c'),0x0])[_0xc1dc('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2a1a44['user']['id']}]};var _0x32038f={'$or':[_0x45ff61,_0x5c2942]};var _0x5dd75b=[];if(_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]&&_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x70')]==='prev'){if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$in':_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x73')],[_0xc1dc('0x74'),_0x4de18d[0x0]['dialOrderByScheduledAt']===_0xc1dc('0x73')?'DESC':_0xc1dc('0x73')],db[_0xc1dc('0x6d')]['literal'](_0xc1dc('0x75')),['id',_0xc1dc('0x76')]];}else{if(!_['isEmpty'](_0x2a1a44[_0xc1dc('0x47')][_0xc1dc('0x71')])){_0x32038f['id']={'$notIn':_0x2a1a44['body'][_0xc1dc('0x71')]};}_0x5dd75b=[[_0xc1dc('0x72'),_0xc1dc('0x76')],[_0xc1dc('0x74'),_0x4de18d[0x0][_0xc1dc('0x6b')]],db[_0xc1dc('0x6d')][_0xc1dc('0x77')](_0xc1dc('0x78')),['id','ASC']];}return db[_0xc1dc('0x14')]['findOne']({'attributes':['id',_0xc1dc('0x79'),'phone',_0xc1dc('0x7a')],'where':_0x32038f,'order':_0x5dd75b,'transaction':_0x20a96b,'lock':_0x20a96b[_0xc1dc('0x7b')][_0xc1dc('0x7c')],'include':[{'model':db[_0xc1dc('0x5f')],'as':_0xc1dc('0x7d'),'attributes':_0x145b62,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0xc1dc('0x10')]}]},{'model':db['CmList'],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':'Queue','attributes':['id',_0xc1dc('0x10'),'dialActive']}]})[_0xc1dc('0xc')](function(_0x320441){if(_0x320441){return _0x320441[_0xc1dc('0x48')]({'UserId':_0x2a1a44['user']['id']},{'transaction':_0x20a96b});}});});}})[_0xc1dc('0xc')](handleEntityNotFound(_0x166d59,null))[_0xc1dc('0xc')](respondWithResult(_0x166d59,null))[_0xc1dc('0x41')](handleError(_0x166d59,null));};exports['getPreviewRecall']=function(_0x51d4ce,_0x2c6f8b,_0x2ab121){var _0x5d07dc=[];var _0x3a3e3e=_0x51d4ce[_0xc1dc('0x43')]['id'];var _0x813307=_0x51d4ce[_0xc1dc('0x56')]['id'];return db['CmContact'][_0xc1dc('0x49')]()[_0xc1dc('0xc')](function(_0x12c155){_0x5d07dc=_[_0xc1dc('0x1a')](_0x12c155);return db[_0xc1dc('0x6d')][_0xc1dc('0x6e')](function(_0x33e810){const _0x42d1fb={'id':_0x3a3e3e};return db[_0xc1dc('0x14')][_0xc1dc('0x80')]({'attributes':['id',_0xc1dc('0x79'),_0xc1dc('0x7a')],'where':_0x42d1fb,'transaction':_0x33e810,'lock':_0x33e810['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5d07dc,'include':[{'model':db['CmCompany'],'as':_0xc1dc('0x81'),'attributes':['id','name']}]},{'model':db[_0xc1dc('0x82')],'as':_0xc1dc('0x7e'),'attributes':['id',_0xc1dc('0x10')]},{'model':db[_0xc1dc('0x7f')],'as':_0xc1dc('0x83'),'attributes':['id','name','dialActive']}]})[_0xc1dc('0xc')](function(_0x264989){if(_0x264989){return _0x264989['update']({'UserId':_0x813307},{'transaction':_0x33e810});}});});})[_0xc1dc('0xc')](handleEntityNotFound(_0x2c6f8b,null))['then'](respondWithResult(_0x2c6f8b,null))['catch'](handleError(_0x2c6f8b,null));};exports['getOpenContacts']=function(_0x4e3bf2,_0x43634f){return _0x4e3bf2['user'][_0xc1dc('0x68')]({'where':{'type':_0xc1dc('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc1dc('0xc')](function(_0x31f9bc){if(_0x31f9bc&&_0x31f9bc[_0xc1dc('0x44')]){return db[_0xc1dc('0x14')][_0xc1dc('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc1dc('0x5a'))},'VoiceQueueId':{'$in':_['map'](_0x31f9bc,'id')},'$or':[{'UserId':null},{'UserId':_0x4e3bf2['user']['id']}]}});}return 0x0;})['then'](function(_0x2c22a7){if(!_[_0xc1dc('0x62')](_0x2c22a7)&&_[_0xc1dc('0x84')](_0x2c22a7)){return _0x43634f[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'contacts':_0x2c22a7});}else{logger[_0xc1dc('0xe')](_0xc1dc('0x86'),'getOpenContacts',0x194,_0xc1dc('0x87'));_0x43634f[_0xc1dc('0xd')](0x194);}})[_0xc1dc('0x41')](handleError(_0x43634f,null));};exports[_0xc1dc('0x88')]=function(_0x413c40,_0x247cc1){var _0x4bca30=shared[_0xc1dc('0x89')];var _0x1d9dfb=[];_['map'](_0x4bca30,function(_0x5d3625){_0x1d9dfb[_0xc1dc('0x8a')]({'id':_0x5d3625[_0xc1dc('0x10')],'name':_0x5d3625[_0xc1dc('0x10')],'utcOffset':_0x5d3625[_0xc1dc('0x8b')]});});return _0x247cc1[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')]({'tz':_0x1d9dfb});};exports[_0xc1dc('0x8c')]=function(_0x48d6a7,_0x551195){var _0x3750d4=shared['timezones'];var _0x24efce={};if(!_[_0xc1dc('0x62')](_0x3750d4[_0x48d6a7[_0xc1dc('0x47')]['id']]))_0x24efce=_0x3750d4[_0x48d6a7['body']['id']];return _0x551195[_0xc1dc('0x9')](0xc8)[_0xc1dc('0x85')](_0x24efce);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ae55b0c..07ff876 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0xdea1ee,_0x2d2841){var _0x96c530=function(_0x4e743b){while(--_0x4e743b){_0xdea1ee['push'](_0xdea1ee['shift']());}};_0x96c530(++_0x2d2841);}(_0x4975,0x86));var _0x5497=function(_0x1620bb,_0x1a0ed0){_0x1620bb=_0x1620bb-0x0;var _0x4bb717=_0x4975[_0x1620bb];return _0x4bb717;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xabce,0x103));var _0xeabc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xabce[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index eb0cb54..5efc525 100644 --- a/server/api/cmHopper/cmHopper.rpc.js +++ b/server/api/cmHopper/cmHopper.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc664=['raw','CreateCmHopper','create','body','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','UPDATE','CmContact','Contact','keys','User','Agent','name','length','UserId','push','includes','all','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','order','LOCK','GetCmHopperPreview','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','voicePause','CmList','List','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','where','include','map','model','attributes','ShowCmHopper','find'];(function(_0x454bf8,_0x5d6499){var _0xa03dc9=function(_0x3d25e4){while(--_0x3d25e4){_0x454bf8['push'](_0x454bf8['shift']());}};_0xa03dc9(++_0x5d6499);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4c66('0x0'));var util=require(_0x4c66('0x1'));var moment=require('moment');var BPromise=require(_0x4c66('0x2'));var db=require(_0x4c66('0x3'))['db'];var logger=require(_0x4c66('0x4'))(_0x4c66('0x5'));var jayson=require(_0x4c66('0x6'));var client=jayson['client'][_0x4c66('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25031f,_0x1285c7,_0x28a065){return new BPromise(function(_0x4ecac0,_0x14ceba){return client[_0x4c66('0x8')](_0x25031f,_0x28a065)[_0x4c66('0x9')](function(_0x47fb8e){logger['info'](_0x4c66('0xa'),_0x1285c7,_0x4c66('0xb'));logger[_0x4c66('0xc')](_0x4c66('0xd'),_0x1285c7,'request\x20sent',JSON[_0x4c66('0xe')](_0x47fb8e));if(_0x47fb8e[_0x4c66('0xf')]){if(_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x10')]===0x1f4){logger[_0x4c66('0xf')](_0x4c66('0xa'),_0x1285c7,_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x11')]);return _0x14ceba(_0x47fb8e[_0x4c66('0xf')]['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x1285c7,_0x47fb8e['error'][_0x4c66('0x11')]);return _0x4ecac0(_0x47fb8e[_0x4c66('0xf')][_0x4c66('0x11')]);}else{logger[_0x4c66('0x12')](_0x4c66('0xa'),_0x1285c7,_0x4c66('0xb'));_0x4ecac0(_0x47fb8e[_0x4c66('0x13')][_0x4c66('0x11')]);}})[_0x4c66('0x14')](function(_0x23d1b6){logger[_0x4c66('0xf')](_0x4c66('0xa'),_0x1285c7,_0x23d1b6);_0x14ceba(_0x23d1b6);});});}exports[_0x4c66('0x15')]=function(_0x144982){var _0x2ae76f=this;return new Promise(function(_0x541c11,_0x31625d){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'raw':_0x144982['options']?_0x144982['options']['raw']===undefined?!![]:![]:!![],'where':_0x144982['options']?_0x144982[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x144982['options']?_0x144982[_0x4c66('0x18')]['attributes']||null:null,'limit':_0x144982[_0x4c66('0x18')]?_0x144982['options']['limit']||null:null,'include':_0x144982['options']?_0x144982[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x144982[_0x4c66('0x18')][_0x4c66('0x1a')],function(_0x4684b3){return{'model':db[_0x4684b3[_0x4c66('0x1c')]],'as':_0x4684b3['as'],'attributes':_0x4684b3[_0x4c66('0x1d')],'include':_0x4684b3[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x4684b3[_0x4c66('0x1a')],function(_0x2589b6){return{'model':db[_0x2589b6['model']],'as':_0x2589b6['as'],'attributes':_0x2589b6[_0x4c66('0x1d')],'include':_0x2589b6[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x2589b6['include'],function(_0x49885b){return{'model':db[_0x49885b['model']],'as':_0x49885b['as'],'attributes':_0x49885b[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x5258c){logger['info'](_0x4c66('0x15'),_0x144982);logger[_0x4c66('0xc')]('GetCmHopper',_0x144982,JSON[_0x4c66('0xe')](_0x5258c));_0x541c11(_0x5258c);})[_0x4c66('0x14')](function(_0x14c1d3){logger[_0x4c66('0xf')](_0x4c66('0x15'),_0x14c1d3[_0x4c66('0x11')],_0x144982);_0x31625d(_0x2ae76f[_0x4c66('0xf')](0x1f4,_0x14c1d3[_0x4c66('0x11')]));});});};exports[_0x4c66('0x1e')]=function(_0x526c5c){var _0xbb11ab=this;return new Promise(function(_0x75656c,_0x404c10){return db['CmHopper'][_0x4c66('0x1f')]({'raw':_0x526c5c[_0x4c66('0x18')]?_0x526c5c[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'where':_0x526c5c[_0x4c66('0x18')]?_0x526c5c['options']['where']||null:null,'attributes':_0x526c5c[_0x4c66('0x18')]?_0x526c5c[_0x4c66('0x18')][_0x4c66('0x1d')]||null:null,'include':_0x526c5c['options']?_0x526c5c[_0x4c66('0x18')]['include']?_[_0x4c66('0x1b')](_0x526c5c['options'][_0x4c66('0x1a')],function(_0x246024){return{'model':db[_0x246024[_0x4c66('0x1c')]],'as':_0x246024['as'],'attributes':_0x246024[_0x4c66('0x1d')],'include':_0x246024[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x246024[_0x4c66('0x1a')],function(_0x4c86cd){return{'model':db[_0x4c86cd[_0x4c66('0x1c')]],'as':_0x4c86cd['as'],'attributes':_0x4c86cd[_0x4c66('0x1d')],'include':_0x4c86cd[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x4c86cd['include'],function(_0x5499bd){return{'model':db[_0x5499bd[_0x4c66('0x1c')]],'as':_0x5499bd['as'],'attributes':_0x5499bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x73edae){logger[_0x4c66('0x12')](_0x4c66('0x1e'),_0x526c5c);logger['debug'](_0x4c66('0x1e'),_0x526c5c,JSON[_0x4c66('0xe')](_0x73edae));_0x75656c(_0x73edae);})[_0x4c66('0x14')](function(_0x3b900f){logger[_0x4c66('0xf')](_0x4c66('0x1e'),_0x3b900f['message'],_0x526c5c);_0x404c10(_0xbb11ab['error'](0x1f4,_0x3b900f['message']));});});};exports[_0x4c66('0x21')]=function(_0x5d3aba){var _0x33d566=this;return new Promise(function(_0x5d2f5d,_0xe4a1e7){return db['CmHopper'][_0x4c66('0x22')](_0x5d3aba[_0x4c66('0x23')],{'raw':_0x5d3aba[_0x4c66('0x18')]?_0x5d3aba['options'][_0x4c66('0x20')]===undefined?!![]:![]:!![]})[_0x4c66('0x9')](function(_0x4842ef){logger[_0x4c66('0x12')](_0x4c66('0x21'),_0x5d3aba);logger[_0x4c66('0xc')]('CreateCmHopper',_0x5d3aba,JSON[_0x4c66('0xe')](_0x4842ef));_0x5d2f5d(_0x4842ef);})[_0x4c66('0x14')](function(_0x4da7b3){logger[_0x4c66('0xf')]('CreateCmHopper',_0x4da7b3[_0x4c66('0x11')],_0x5d3aba);_0xe4a1e7(_0x33d566[_0x4c66('0xf')](0x1f4,_0x4da7b3[_0x4c66('0x11')]));});});};exports['UpdateCmHopper']=function(_0xc7a687){var _0x426ed0=this;return new Promise(function(_0x5233e2,_0x5bf5a3){return db[_0x4c66('0x16')][_0x4c66('0x24')](_0xc7a687[_0x4c66('0x23')],{'raw':_0xc7a687[_0x4c66('0x18')]?_0xc7a687['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7a687[_0x4c66('0x18')]?_0xc7a687['options']['where']||null:null,'attributes':_0xc7a687['options']?_0xc7a687[_0x4c66('0x18')][_0x4c66('0x1d')]||null:null,'limit':_0xc7a687[_0x4c66('0x18')]?_0xc7a687[_0x4c66('0x18')][_0x4c66('0x25')]||null:null})[_0x4c66('0x9')](function(_0x37836c){logger[_0x4c66('0x12')](_0x4c66('0x26'),_0xc7a687);logger[_0x4c66('0x12')](_0x4c66('0x27'),JSON['stringify'](_0xc7a687[_0x4c66('0x18')][_0x4c66('0x19')]),_0xc7a687[_0x4c66('0x23')]['active']);logger['debug'](_0x4c66('0x26'),_0xc7a687,JSON[_0x4c66('0xe')](_0x37836c));_0x5233e2(_0x37836c);})['catch'](function(_0x569f12){logger[_0x4c66('0xf')](_0x4c66('0x26'),_0x569f12['message'],_0xc7a687);_0x5bf5a3(_0x426ed0[_0x4c66('0xf')](0x1f4,_0x569f12['message']));});});};exports[_0x4c66('0x28')]=function(_0x1c223b){var _0x3d5bee=this;return new Promise(function(_0x1f072a,_0x461f20){return db[_0x4c66('0x16')][_0x4c66('0x29')]({'where':_0x1c223b[_0x4c66('0x18')]?_0x1c223b[_0x4c66('0x18')][_0x4c66('0x19')]||null:null})[_0x4c66('0x9')](function(_0x388499){logger[_0x4c66('0x12')]('DestroyCmHopper',_0x1c223b);logger[_0x4c66('0xc')]('DestroyCmHopper',_0x1c223b,JSON[_0x4c66('0xe')](_0x388499));_0x1f072a(_0x388499);})[_0x4c66('0x14')](function(_0x2444f){logger[_0x4c66('0xf')](_0x4c66('0x28'),_0x2444f['message'],_0x1c223b);_0x461f20(_0x3d5bee['error'](0x1f4,_0x2444f[_0x4c66('0x11')]));});});};exports[_0x4c66('0x2a')]=function(_0x3c0356){var _0x1c45e3=this;return new Promise(function(_0x34b6a2,_0x2089f8){return db['CmContact'][_0x4c66('0x2b')]()[_0x4c66('0x9')](function(_0x4e4dbf){return db[_0x4c66('0x2c')][_0x4c66('0x2d')](function(_0x1a888f){return db[_0x4c66('0x16')]['findAll']({'where':_0x3c0356[_0x4c66('0x18')]?_0x3c0356[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x3c0356[_0x4c66('0x18')]?_0x3c0356['options'][_0x4c66('0x1d')]||null:null,'limit':_0x3c0356[_0x4c66('0x18')]?_0x3c0356[_0x4c66('0x18')][_0x4c66('0x25')]||null:null,'order':_0x3c0356[_0x4c66('0x18')]?_0x3c0356['options']['order']||null:null,'transaction':_0x1a888f,'lock':_0x1a888f['LOCK'][_0x4c66('0x2e')],'include':[{'model':db[_0x4c66('0x2f')],'as':_0x4c66('0x30'),'attributes':_[_0x4c66('0x31')](_0x4e4dbf)},{'model':db[_0x4c66('0x32')],'as':_0x4c66('0x33'),'attributes':['id',_0x4c66('0x34'),'voicePause']}]})['then'](function(_0x4f269b){var _0x255102=[];var _0x26f38a=[];for(var _0x334d49=0x0;_0x334d49<_0x4f269b[_0x4c66('0x35')];_0x334d49+=0x1){var _0x4ae735=_0x4f269b[_0x334d49][_0x4c66('0x36')];if(_0x4ae735===null){_0x255102[_0x4c66('0x37')](_0x4f269b[_0x334d49]['update'](_0x3c0356[_0x4c66('0x23')],{'transaction':_0x1a888f}));}else if(!_0x26f38a[_0x4c66('0x38')](_0x4ae735)){_0x26f38a[_0x4c66('0x37')](_0x4ae735);_0x255102['push'](_0x4f269b[_0x334d49]['update'](_0x3c0356[_0x4c66('0x23')],{'transaction':_0x1a888f}));}}return BPromise[_0x4c66('0x39')](_0x255102);});})[_0x4c66('0x9')](function(_0x42d65e){logger[_0x4c66('0x12')](_0x4c66('0x2a'),_0x3c0356);if(_0x42d65e[_0x4c66('0x35')]>0x0){logger[_0x4c66('0x12')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x42d65e[0x0][_0x4c66('0x3a')]['id'],_0x42d65e[0x0]['dataValues'][_0x4c66('0x3b')],_0x42d65e[0x0]['dataValues'][_0x4c66('0x3c')]);}logger[_0x4c66('0xc')](_0x4c66('0x2a'),_0x3c0356,JSON[_0x4c66('0xe')](_0x42d65e));_0x34b6a2(_0x42d65e);})[_0x4c66('0x14')](function(_0x116ad5){logger[_0x4c66('0xf')](_0x4c66('0x2a'),_0x116ad5[_0x4c66('0x11')],_0x3c0356);_0x2089f8(_0x1c45e3['error'](0x1f4,_0x116ad5['message']));});});});};exports[_0x4c66('0x3d')]=function(_0x1b21a1){var _0x222e1f=this;return new Promise(function(_0xc3bf3c,_0xb7e4be){return db[_0x4c66('0x2c')]['transaction'](function(_0x2e9279){return db[_0x4c66('0x3e')][_0x4c66('0x22')](_0x1b21a1[_0x4c66('0x23')],{'raw':_0x1b21a1[_0x4c66('0x18')]?_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'transaction':_0x2e9279})[_0x4c66('0x9')](function(){logger[_0x4c66('0x12')](_0x4c66('0x3f'),JSON[_0x4c66('0xe')](_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')]),_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')][_0x4c66('0x3c')]);return db[_0x4c66('0x16')][_0x4c66('0x29')]({'where':_0x1b21a1[_0x4c66('0x18')]?_0x1b21a1[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'transaction':_0x2e9279});});})[_0x4c66('0x9')](function(_0x254067){logger[_0x4c66('0x12')]('MoveContactManagedDialer',_0x1b21a1);logger[_0x4c66('0xc')](_0x4c66('0x3d'),_0x1b21a1,JSON[_0x4c66('0xe')](_0x254067));_0xc3bf3c(_0x254067);})[_0x4c66('0x14')](function(_0xd49317){logger[_0x4c66('0xf')](_0x4c66('0x3d'),_0xd49317[_0x4c66('0x11')],_0x1b21a1);_0xb7e4be(_0x222e1f[_0x4c66('0xf')](0x1f4,_0xd49317[_0x4c66('0x11')]));});});};exports['CountReScheduled']=function(_0x40bc07){var _0x5371d8=this;return new Promise(function(_0x3fa41e,_0x73b27b){return db['CmHopper'][_0x4c66('0x17')]({'raw':_0x40bc07['options']?_0x40bc07[_0x4c66('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x40bc07[_0x4c66('0x18')]?_0x40bc07[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':[[db[_0x4c66('0x2c')]['fn'](_0x4c66('0x40'),db[_0x4c66('0x2c')]['fn']('IF',db[_0x4c66('0x2c')][_0x4c66('0x41')]('`scheduledat`\x20>=\x20'+util[_0x4c66('0x42')](_0x4c66('0x43'),moment()[_0x4c66('0x42')](_0x4c66('0x44')))+_0x4c66('0x45')))),'contactsRescheduled']]})[_0x4c66('0x9')](function(_0x3930a5){logger['info'](_0x4c66('0x46'),_0x40bc07);logger[_0x4c66('0xc')]('CountReScheduled',_0x40bc07,JSON[_0x4c66('0xe')](_0x3930a5));_0x3fa41e(_0x3930a5);})[_0x4c66('0x14')](function(_0x5b0847){logger['error'](_0x4c66('0x46'),_0x5b0847[_0x4c66('0x11')],_0x40bc07);_0x73b27b(_0x5371d8[_0x4c66('0xf')](0x1f4,_0x5b0847[_0x4c66('0x11')]));});});};exports[_0x4c66('0x47')]=function(_0x259bdb){var _0x1f39a9=this;return new Promise(function(_0x7504a1,_0x44e1fa){return db[_0x4c66('0x2f')][_0x4c66('0x2b')]()['then'](function(_0x5931ad){return db['sequelize'][_0x4c66('0x2d')](function(_0x151f29){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'where':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')]['where']||null:null,'attributes':_0x259bdb['options']?_0x259bdb[_0x4c66('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')][_0x4c66('0x48')]||null:null,'group':db[_0x4c66('0x16')][_0x4c66('0x36')],'transaction':_0x151f29,'lock':_0x151f29[_0x4c66('0x49')][_0x4c66('0x2e')],'include':_0x259bdb[_0x4c66('0x18')]?_0x259bdb[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x259bdb[_0x4c66('0x18')][_0x4c66('0x1a')],function(_0x3492b9){return{'model':db[_0x3492b9['model']],'as':_0x3492b9['as'],'attributes':_0x3492b9[_0x4c66('0x1d')],'include':_0x3492b9[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x3492b9[_0x4c66('0x1a')],function(_0x1d1899){return{'model':db[_0x1d1899[_0x4c66('0x1c')]],'as':_0x1d1899['as'],'attributes':_0x1d1899[_0x4c66('0x1d')],'include':_0x1d1899['include']?_[_0x4c66('0x1b')](_0x1d1899[_0x4c66('0x1a')],function(_0x4a77dc){return{'model':db[_0x4a77dc[_0x4c66('0x1c')]],'as':_0x4a77dc['as'],'attributes':_0x4a77dc[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x2a7d8c){var _0x29337d=[];for(var _0x18da89=0x0;_0x18da89<_0x2a7d8c[_0x4c66('0x35')];_0x18da89+=0x1){_0x29337d['push'](_0x2a7d8c[_0x18da89][_0x4c66('0x24')](_0x259bdb[_0x4c66('0x23')],{'transaction':_0x151f29}));}return BPromise[_0x4c66('0x39')](_0x29337d);});})[_0x4c66('0x9')](function(_0x1bd22f){logger[_0x4c66('0x12')](_0x4c66('0x47'),_0x259bdb);logger[_0x4c66('0xc')](_0x4c66('0x47'),_0x259bdb,JSON[_0x4c66('0xe')](_0x1bd22f));_0x7504a1(_0x1bd22f);})[_0x4c66('0x14')](function(_0x1ab8a2){logger[_0x4c66('0xf')](_0x4c66('0x47'),_0x1ab8a2[_0x4c66('0x11')],_0x259bdb);_0x44e1fa(_0x1f39a9[_0x4c66('0xf')](0x1f4,_0x1ab8a2[_0x4c66('0x11')]));});});});};exports[_0x4c66('0x4a')]=function(_0x257b21){var _0x30e9fd=this;return new Promise(function(_0x1ce3aa,_0x5754f9){db[_0x4c66('0x2f')]['describe']()[_0x4c66('0x9')](function(_0xd9844e){return db[_0x4c66('0x16')][_0x4c66('0x17')]({'raw':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x20')]===undefined?!![]:![]:!![],'where':_0x257b21[_0x4c66('0x18')]?_0x257b21[_0x4c66('0x18')][_0x4c66('0x19')]||null:null,'attributes':_0x257b21['options']?_0x257b21[_0x4c66('0x18')]['attributes']||null:null,'limit':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x25')]||null:null,'include':_0x257b21['options']?_0x257b21[_0x4c66('0x18')][_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x257b21[_0x4c66('0x18')]['include'],function(_0x159e39){return{'model':db[_0x159e39[_0x4c66('0x1c')]],'as':_0x159e39['as'],'attributes':_0x159e39['as']==='Contact'?_[_0x4c66('0x31')](_0xd9844e):_0x159e39[_0x4c66('0x1d')],'include':_0x159e39[_0x4c66('0x1a')]?_[_0x4c66('0x1b')](_0x159e39['include'],function(_0x287848){return{'model':db[_0x287848['model']],'as':_0x287848['as'],'attributes':_0x287848[_0x4c66('0x1d')],'include':_0x287848['include']?_[_0x4c66('0x1b')](_0x287848[_0x4c66('0x1a')],function(_0x4a6262){return{'model':db[_0x4a6262['model']],'as':_0x4a6262['as'],'attributes':_0x4a6262[_0x4c66('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4c66('0x9')](function(_0x5bdd09){logger[_0x4c66('0x12')](_0x4c66('0x15'),_0x257b21);logger[_0x4c66('0xc')](_0x4c66('0x15'),_0x257b21,JSON[_0x4c66('0xe')](_0x5bdd09));_0x1ce3aa(_0x5bdd09);})[_0x4c66('0x14')](function(_0x359543){logger[_0x4c66('0xf')](_0x4c66('0x15'),_0x359543[_0x4c66('0x11')],_0x257b21);_0x5754f9(_0x30e9fd['error'](0x1f4,_0x359543[_0x4c66('0x11')]));});});});};exports['GetContactByPhone']=function(_0x2e9b69){var _0x17058c=this;return new Promise(function(_0x4dc474,_0x402cd1){return db[_0x4c66('0x2f')][_0x4c66('0x4b')]({'raw':!![],'where':{'phone':_0x2e9b69[_0x4c66('0x18')][_0x4c66('0x19')][_0x4c66('0x4c')]},'attributes':['id',_0x4c66('0x4d')],'order':[['id',_0x4c66('0x4e')]]})['then'](function(_0x59eb6e){logger['info'](_0x4c66('0x4f'),_0x2e9b69);logger[_0x4c66('0xc')](_0x4c66('0x4f'),_0x2e9b69,JSON[_0x4c66('0xe')](_0x59eb6e));_0x4dc474(_0x59eb6e);})['catch'](function(_0x486f83){logger['error'](_0x4c66('0x4f'),_0x486f83[_0x4c66('0x11')],_0x2e9b69);_0x402cd1(_0x17058c['error'](0x1f4,_0x486f83[_0x4c66('0x11')]));});});};exports[_0x4c66('0x50')]=function(_0x3d5a18){var _0x2fdb45=this;return new Promise(function(_0x572527,_0x24ea2f){return db['sequelize'][_0x4c66('0x2d')](function(_0x341026){return db['CmHopper'][_0x4c66('0x24')]({'active':![]},{'where':{},'transaction':_0x341026})[_0x4c66('0x9')](function(_0x16a462){logger[_0x4c66('0x12')](_0x4c66('0x50'),_0x3d5a18);logger[_0x4c66('0xc')](_0x4c66('0x50'),_0x3d5a18,JSON[_0x4c66('0xe')](_0x16a462));_0x572527(_0x16a462);})['catch'](function(_0x1001eb){logger['error'](_0x4c66('0x50'),_0x1001eb[_0x4c66('0x11')],_0x3d5a18);_0x24ea2f(_0x2fdb45[_0x4c66('0xf')](0x1f4,_0x1001eb[_0x4c66('0x11')]));});});});};exports[_0x4c66('0x51')]=function(_0x14e653){var _0x21df57=this;var _0x3f5016=_0x14e653[_0x4c66('0x23')][_0x4c66('0x19')]['voiceQueueIds'];var _0x30d34a=_0x14e653[_0x4c66('0x23')]['where']['interval'];var _0x5dd259=_0x14e653[_0x4c66('0x23')][_0x4c66('0x19')]['availableAgentsIds'];return new Promise(function(_0x2aed3a,_0x48bed3){return db['CmHopper'][_0x4c66('0x17')]({'where':{'voiceQueueId':{'$in':_0x3f5016},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4c66('0x2c')][_0x4c66('0x41')](_0x4c66('0x52')+_0x30d34a+_0x4c66('0x53')),'$gt':db[_0x4c66('0x2c')]['literal'](_0x4c66('0x54'))}},'UserId':{'$in':_0x5dd259}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x4c66('0x32')],'as':_0x4c66('0x33'),'attributes':['id','name',_0x4c66('0x55')]},{'model':db[_0x4c66('0x56')],'as':_0x4c66('0x57')}]})[_0x4c66('0x9')](function(_0x4ab469){if(_0x4ab469[_0x4c66('0x35')]>0x0){return db[_0x4c66('0x2c')][_0x4c66('0x2d')](function(_0x131f57){return db[_0x4c66('0x16')][_0x4c66('0x24')]({'recallmeNotifiedDate':db[_0x4c66('0x2c')][_0x4c66('0x41')](_0x4c66('0x54'))},{'where':{'id':{'$in':_[_0x4c66('0x1b')](_0x4ab469,'id')}},'transaction':_0x131f57})[_0x4c66('0x9')](function(){_0x2aed3a(_0x4ab469);})[_0x4c66('0x14')](function(_0x13b446){logger[_0x4c66('0xf')](_0x4c66('0x51'),_0x13b446['message'],_0x14e653);_0x48bed3(_0x21df57[_0x4c66('0xf')](0x1f4,_0x13b446['message']));});})[_0x4c66('0x14')](function(_0x70001e){logger[_0x4c66('0xf')](_0x4c66('0x51'),_0x70001e[_0x4c66('0x11')],_0x14e653);_0x48bed3(_0x21df57[_0x4c66('0xf')](0x1f4,_0x70001e[_0x4c66('0x11')]));});}else{_0x2aed3a(_0x4ab469);}});});}; \ No newline at end of file +var _0xc306=['lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','debug','stringify','catch','ShowCmHopper','find','create','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','voicePause','length','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','CmList','List','literal'];(function(_0x1cc129,_0x34fc66){var _0x542be8=function(_0x3c8cd5){while(--_0x3c8cd5){_0x1cc129['push'](_0x1cc129['shift']());}};_0x542be8(++_0x34fc66);}(_0xc306,0x1a9));var _0x6c30=function(_0x4ad7fc,_0x418ac7){_0x4ad7fc=_0x4ad7fc-0x0;var _0x32743a=_0xc306[_0x4ad7fc];return _0x32743a;};'use strict';var _=require(_0x6c30('0x0'));var util=require('util');var moment=require(_0x6c30('0x1'));var BPromise=require(_0x6c30('0x2'));var db=require(_0x6c30('0x3'))['db'];var logger=require(_0x6c30('0x4'))(_0x6c30('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6c30('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x363ad5,_0xdd5a4e,_0x38525a){return new BPromise(function(_0x585a80,_0x90c6ea){return client[_0x6c30('0x7')](_0x363ad5,_0x38525a)[_0x6c30('0x8')](function(_0x4e0017){logger[_0x6c30('0x9')](_0x6c30('0xa'),_0xdd5a4e,_0x6c30('0xb'));logger['debug'](_0x6c30('0xc'),_0xdd5a4e,'request\x20sent',JSON['stringify'](_0x4e0017));if(_0x4e0017[_0x6c30('0xd')]){if(_0x4e0017['error']['code']===0x1f4){logger['error'](_0x6c30('0xa'),_0xdd5a4e,_0x4e0017[_0x6c30('0xd')][_0x6c30('0xe')]);return _0x90c6ea(_0x4e0017['error'][_0x6c30('0xe')]);}logger['error'](_0x6c30('0xa'),_0xdd5a4e,_0x4e0017['error']['message']);return _0x585a80(_0x4e0017[_0x6c30('0xd')][_0x6c30('0xe')]);}else{logger['info'](_0x6c30('0xa'),_0xdd5a4e,_0x6c30('0xb'));_0x585a80(_0x4e0017[_0x6c30('0xf')][_0x6c30('0xe')]);}})['catch'](function(_0x141b9a){logger[_0x6c30('0xd')](_0x6c30('0xa'),_0xdd5a4e,_0x141b9a);_0x90c6ea(_0x141b9a);});});}exports[_0x6c30('0x10')]=function(_0x28d847){var _0x1009d0=this;return new Promise(function(_0x439581,_0x2ac7ad){return db[_0x6c30('0x11')][_0x6c30('0x12')]({'raw':_0x28d847['options']?_0x28d847[_0x6c30('0x13')][_0x6c30('0x14')]===undefined?!![]:![]:!![],'where':_0x28d847[_0x6c30('0x13')]?_0x28d847[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':_0x28d847['options']?_0x28d847[_0x6c30('0x13')][_0x6c30('0x16')]||null:null,'limit':_0x28d847[_0x6c30('0x13')]?_0x28d847[_0x6c30('0x13')][_0x6c30('0x17')]||null:null,'include':_0x28d847[_0x6c30('0x13')]?_0x28d847['options']['include']?_[_0x6c30('0x18')](_0x28d847[_0x6c30('0x13')][_0x6c30('0x19')],function(_0x2cf9d7){return{'model':db[_0x2cf9d7[_0x6c30('0x1a')]],'as':_0x2cf9d7['as'],'attributes':_0x2cf9d7[_0x6c30('0x16')],'include':_0x2cf9d7[_0x6c30('0x19')]?_[_0x6c30('0x18')](_0x2cf9d7[_0x6c30('0x19')],function(_0xa4a3bc){return{'model':db[_0xa4a3bc[_0x6c30('0x1a')]],'as':_0xa4a3bc['as'],'attributes':_0xa4a3bc[_0x6c30('0x16')],'include':_0xa4a3bc[_0x6c30('0x19')]?_[_0x6c30('0x18')](_0xa4a3bc['include'],function(_0x42135d){return{'model':db[_0x42135d[_0x6c30('0x1a')]],'as':_0x42135d['as'],'attributes':_0x42135d['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c30('0x8')](function(_0x6fc3f8){logger[_0x6c30('0x9')]('GetCmHopper',_0x28d847);logger[_0x6c30('0x1b')](_0x6c30('0x10'),_0x28d847,JSON[_0x6c30('0x1c')](_0x6fc3f8));_0x439581(_0x6fc3f8);})[_0x6c30('0x1d')](function(_0x32670f){logger[_0x6c30('0xd')](_0x6c30('0x10'),_0x32670f[_0x6c30('0xe')],_0x28d847);_0x2ac7ad(_0x1009d0['error'](0x1f4,_0x32670f[_0x6c30('0xe')]));});});};exports[_0x6c30('0x1e')]=function(_0x231ec0){var _0x3b6ac7=this;return new Promise(function(_0x4ccd1a,_0x5b0990){return db[_0x6c30('0x11')][_0x6c30('0x1f')]({'raw':_0x231ec0[_0x6c30('0x13')]?_0x231ec0[_0x6c30('0x13')][_0x6c30('0x14')]===undefined?!![]:![]:!![],'where':_0x231ec0[_0x6c30('0x13')]?_0x231ec0[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':_0x231ec0[_0x6c30('0x13')]?_0x231ec0[_0x6c30('0x13')]['attributes']||null:null,'include':_0x231ec0[_0x6c30('0x13')]?_0x231ec0[_0x6c30('0x13')]['include']?_[_0x6c30('0x18')](_0x231ec0[_0x6c30('0x13')][_0x6c30('0x19')],function(_0x4cf1c5){return{'model':db[_0x4cf1c5['model']],'as':_0x4cf1c5['as'],'attributes':_0x4cf1c5[_0x6c30('0x16')],'include':_0x4cf1c5['include']?_['map'](_0x4cf1c5['include'],function(_0x27021a){return{'model':db[_0x27021a[_0x6c30('0x1a')]],'as':_0x27021a['as'],'attributes':_0x27021a[_0x6c30('0x16')],'include':_0x27021a[_0x6c30('0x19')]?_[_0x6c30('0x18')](_0x27021a['include'],function(_0x5eacd3){return{'model':db[_0x5eacd3[_0x6c30('0x1a')]],'as':_0x5eacd3['as'],'attributes':_0x5eacd3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3841c6){logger[_0x6c30('0x9')](_0x6c30('0x1e'),_0x231ec0);logger[_0x6c30('0x1b')](_0x6c30('0x1e'),_0x231ec0,JSON[_0x6c30('0x1c')](_0x3841c6));_0x4ccd1a(_0x3841c6);})[_0x6c30('0x1d')](function(_0x260225){logger[_0x6c30('0xd')](_0x6c30('0x1e'),_0x260225[_0x6c30('0xe')],_0x231ec0);_0x5b0990(_0x3b6ac7[_0x6c30('0xd')](0x1f4,_0x260225[_0x6c30('0xe')]));});});};exports['CreateCmHopper']=function(_0x352cc3){var _0x1dfffc=this;return new Promise(function(_0x3f63ea,_0xe0843a){return db[_0x6c30('0x11')][_0x6c30('0x20')](_0x352cc3[_0x6c30('0x21')],{'raw':_0x352cc3[_0x6c30('0x13')]?_0x352cc3[_0x6c30('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x6c30('0x8')](function(_0x77097c){logger[_0x6c30('0x9')](_0x6c30('0x22'),_0x352cc3);logger[_0x6c30('0x1b')]('CreateCmHopper',_0x352cc3,JSON[_0x6c30('0x1c')](_0x77097c));_0x3f63ea(_0x77097c);})[_0x6c30('0x1d')](function(_0x36a7ef){logger[_0x6c30('0xd')](_0x6c30('0x22'),_0x36a7ef[_0x6c30('0xe')],_0x352cc3);_0xe0843a(_0x1dfffc['error'](0x1f4,_0x36a7ef[_0x6c30('0xe')]));});});};exports[_0x6c30('0x23')]=function(_0x4e45a3){var _0x5520c9=this;return new Promise(function(_0x7caa28,_0x3f634c){return db[_0x6c30('0x11')][_0x6c30('0x24')](_0x4e45a3[_0x6c30('0x21')],{'raw':_0x4e45a3[_0x6c30('0x13')]?_0x4e45a3['options'][_0x6c30('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e45a3['options']?_0x4e45a3[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':_0x4e45a3[_0x6c30('0x13')]?_0x4e45a3['options'][_0x6c30('0x16')]||null:null,'limit':_0x4e45a3[_0x6c30('0x13')]?_0x4e45a3['options'][_0x6c30('0x17')]||null:null})[_0x6c30('0x8')](function(_0x41ea7c){logger['info'](_0x6c30('0x23'),_0x4e45a3);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4e45a3[_0x6c30('0x13')][_0x6c30('0x15')]),_0x4e45a3[_0x6c30('0x21')][_0x6c30('0x25')]);logger['debug'](_0x6c30('0x23'),_0x4e45a3,JSON[_0x6c30('0x1c')](_0x41ea7c));_0x7caa28(_0x41ea7c);})[_0x6c30('0x1d')](function(_0xe425dc){logger['error'](_0x6c30('0x23'),_0xe425dc[_0x6c30('0xe')],_0x4e45a3);_0x3f634c(_0x5520c9[_0x6c30('0xd')](0x1f4,_0xe425dc[_0x6c30('0xe')]));});});};exports[_0x6c30('0x26')]=function(_0xc7603a){var _0x5b8fa7=this;return new Promise(function(_0x32e7ca,_0x2ed1ca){return db[_0x6c30('0x11')]['destroy']({'where':_0xc7603a['options']?_0xc7603a['options'][_0x6c30('0x15')]||null:null})[_0x6c30('0x8')](function(_0x1c02c2){logger[_0x6c30('0x9')](_0x6c30('0x26'),_0xc7603a);logger['debug'](_0x6c30('0x26'),_0xc7603a,JSON[_0x6c30('0x1c')](_0x1c02c2));_0x32e7ca(_0x1c02c2);})[_0x6c30('0x1d')](function(_0xc08b00){logger[_0x6c30('0xd')](_0x6c30('0x26'),_0xc08b00[_0x6c30('0xe')],_0xc7603a);_0x2ed1ca(_0x5b8fa7[_0x6c30('0xd')](0x1f4,_0xc08b00[_0x6c30('0xe')]));});});};exports[_0x6c30('0x27')]=function(_0x1a920d){var _0x59fce5=this;return new Promise(function(_0x43f9c2,_0x29f9d0){return db[_0x6c30('0x28')][_0x6c30('0x29')]()[_0x6c30('0x8')](function(_0x36f847){return db[_0x6c30('0x2a')][_0x6c30('0x2b')](function(_0xbbe8a8){return db['CmHopper'][_0x6c30('0x12')]({'where':_0x1a920d[_0x6c30('0x13')]?_0x1a920d['options'][_0x6c30('0x15')]||null:null,'attributes':_0x1a920d['options']?_0x1a920d[_0x6c30('0x13')]['attributes']||null:null,'limit':_0x1a920d[_0x6c30('0x13')]?_0x1a920d[_0x6c30('0x13')][_0x6c30('0x17')]||null:null,'order':_0x1a920d[_0x6c30('0x13')]?_0x1a920d[_0x6c30('0x13')][_0x6c30('0x2c')]||null:null,'transaction':_0xbbe8a8,'lock':_0xbbe8a8[_0x6c30('0x2d')][_0x6c30('0x2e')],'include':[{'model':db[_0x6c30('0x28')],'as':_0x6c30('0x2f'),'attributes':_[_0x6c30('0x30')](_0x36f847)},{'model':db['User'],'as':'Agent','attributes':['id','name',_0x6c30('0x31')]}]})['then'](function(_0x4d3887){var _0x2a98b5=[];var _0x3a56ef=[];for(var _0x4ac6e5=0x0;_0x4ac6e5<_0x4d3887[_0x6c30('0x32')];_0x4ac6e5+=0x1){var _0x1eb878=_0x4d3887[_0x4ac6e5]['UserId'];if(_0x1eb878===null){_0x2a98b5[_0x6c30('0x33')](_0x4d3887[_0x4ac6e5]['update'](_0x1a920d[_0x6c30('0x21')],{'transaction':_0xbbe8a8}));}else if(!_0x3a56ef[_0x6c30('0x34')](_0x1eb878)){_0x3a56ef[_0x6c30('0x33')](_0x1eb878);_0x2a98b5['push'](_0x4d3887[_0x4ac6e5][_0x6c30('0x24')](_0x1a920d[_0x6c30('0x21')],{'transaction':_0xbbe8a8}));}}return BPromise[_0x6c30('0x35')](_0x2a98b5);});})[_0x6c30('0x8')](function(_0x95dce8){logger[_0x6c30('0x9')](_0x6c30('0x27'),_0x1a920d);if(_0x95dce8[_0x6c30('0x32')]>0x0){logger['info'](_0x6c30('0x36'),_0x95dce8[0x0][_0x6c30('0x37')]['id'],_0x95dce8[0x0][_0x6c30('0x37')][_0x6c30('0x38')],_0x95dce8[0x0][_0x6c30('0x37')][_0x6c30('0x25')]);}logger['debug']('GetContactDialer',_0x1a920d,JSON[_0x6c30('0x1c')](_0x95dce8));_0x43f9c2(_0x95dce8);})['catch'](function(_0x1643be){logger[_0x6c30('0xd')](_0x6c30('0x27'),_0x1643be[_0x6c30('0xe')],_0x1a920d);_0x29f9d0(_0x59fce5[_0x6c30('0xd')](0x1f4,_0x1643be[_0x6c30('0xe')]));});});});};exports[_0x6c30('0x39')]=function(_0x10b77c){var _0x175886=this;return new Promise(function(_0x57405e,_0x525acb){return db['sequelize'][_0x6c30('0x2b')](function(_0x4b8e17){return db[_0x6c30('0x3a')]['create'](_0x10b77c['body'],{'raw':_0x10b77c[_0x6c30('0x13')]?_0x10b77c['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x4b8e17})[_0x6c30('0x8')](function(){logger[_0x6c30('0x9')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x10b77c['options'][_0x6c30('0x15')]),_0x10b77c[_0x6c30('0x13')][_0x6c30('0x15')][_0x6c30('0x25')]);return db[_0x6c30('0x11')][_0x6c30('0x3b')]({'where':_0x10b77c[_0x6c30('0x13')]?_0x10b77c[_0x6c30('0x13')]['where']||null:null,'transaction':_0x4b8e17});});})[_0x6c30('0x8')](function(_0xcaf974){logger['info'](_0x6c30('0x39'),_0x10b77c);logger['debug'](_0x6c30('0x39'),_0x10b77c,JSON[_0x6c30('0x1c')](_0xcaf974));_0x57405e(_0xcaf974);})[_0x6c30('0x1d')](function(_0x228787){logger[_0x6c30('0xd')](_0x6c30('0x39'),_0x228787[_0x6c30('0xe')],_0x10b77c);_0x525acb(_0x175886[_0x6c30('0xd')](0x1f4,_0x228787[_0x6c30('0xe')]));});});};exports[_0x6c30('0x3c')]=function(_0x7688d8){var _0x374d81=this;return new Promise(function(_0x4f8102,_0x518359){return db[_0x6c30('0x11')]['findAll']({'raw':_0x7688d8['options']?_0x7688d8[_0x6c30('0x13')][_0x6c30('0x14')]===undefined?!![]:![]:!![],'where':_0x7688d8['options']?_0x7688d8[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':[[db[_0x6c30('0x2a')]['fn'](_0x6c30('0x3d'),db['sequelize']['fn']('IF',db[_0x6c30('0x2a')]['literal'](_0x6c30('0x3e')+util['format'](_0x6c30('0x3f'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x6c30('0x40')))),_0x6c30('0x41')]]})['then'](function(_0x273ce6){logger['info'](_0x6c30('0x3c'),_0x7688d8);logger[_0x6c30('0x1b')]('CountReScheduled',_0x7688d8,JSON[_0x6c30('0x1c')](_0x273ce6));_0x4f8102(_0x273ce6);})['catch'](function(_0x38e21f){logger[_0x6c30('0xd')](_0x6c30('0x3c'),_0x38e21f['message'],_0x7688d8);_0x518359(_0x374d81['error'](0x1f4,_0x38e21f[_0x6c30('0xe')]));});});};exports[_0x6c30('0x42')]=function(_0x1e19f8){var _0x5eed11=this;return new Promise(function(_0xc51fd,_0x140612){return db['CmContact'][_0x6c30('0x29')]()[_0x6c30('0x8')](function(_0x119994){return db[_0x6c30('0x2a')][_0x6c30('0x2b')](function(_0x2441ed){return db[_0x6c30('0x11')][_0x6c30('0x12')]({'where':_0x1e19f8[_0x6c30('0x13')]?_0x1e19f8[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':_0x1e19f8[_0x6c30('0x13')]?_0x1e19f8[_0x6c30('0x13')][_0x6c30('0x16')]||null:null,'limit':0x1,'order':_0x1e19f8[_0x6c30('0x13')]?_0x1e19f8[_0x6c30('0x13')][_0x6c30('0x2c')]||null:null,'group':db[_0x6c30('0x11')][_0x6c30('0x43')],'transaction':_0x2441ed,'lock':_0x2441ed[_0x6c30('0x2d')][_0x6c30('0x2e')],'include':_0x1e19f8[_0x6c30('0x13')]?_0x1e19f8[_0x6c30('0x13')][_0x6c30('0x19')]?_[_0x6c30('0x18')](_0x1e19f8[_0x6c30('0x13')][_0x6c30('0x19')],function(_0x23dc8f){return{'model':db[_0x23dc8f[_0x6c30('0x1a')]],'as':_0x23dc8f['as'],'attributes':_0x23dc8f[_0x6c30('0x16')],'include':_0x23dc8f[_0x6c30('0x19')]?_['map'](_0x23dc8f[_0x6c30('0x19')],function(_0x3ea479){return{'model':db[_0x3ea479['model']],'as':_0x3ea479['as'],'attributes':_0x3ea479[_0x6c30('0x16')],'include':_0x3ea479[_0x6c30('0x19')]?_[_0x6c30('0x18')](_0x3ea479[_0x6c30('0x19')],function(_0xae400c){return{'model':db[_0xae400c[_0x6c30('0x1a')]],'as':_0xae400c['as'],'attributes':_0xae400c[_0x6c30('0x16')]};}):[]};}):[]};}):[]:[]})[_0x6c30('0x8')](function(_0x3d05fb){var _0x32becc=[];for(var _0x230f9f=0x0;_0x230f9f<_0x3d05fb['length'];_0x230f9f+=0x1){_0x32becc[_0x6c30('0x33')](_0x3d05fb[_0x230f9f]['update'](_0x1e19f8[_0x6c30('0x21')],{'transaction':_0x2441ed}));}return BPromise['all'](_0x32becc);});})[_0x6c30('0x8')](function(_0x3d5c9f){logger[_0x6c30('0x9')](_0x6c30('0x42'),_0x1e19f8);logger['debug']('GetContactRecallMe',_0x1e19f8,JSON['stringify'](_0x3d5c9f));_0xc51fd(_0x3d5c9f);})[_0x6c30('0x1d')](function(_0x2f5b9f){logger[_0x6c30('0xd')]('GetContactRecallMe',_0x2f5b9f[_0x6c30('0xe')],_0x1e19f8);_0x140612(_0x5eed11[_0x6c30('0xd')](0x1f4,_0x2f5b9f[_0x6c30('0xe')]));});});});};exports[_0x6c30('0x44')]=function(_0x428aca){var _0x3a9194=this;return new Promise(function(_0x6c0256,_0xbbc489){db[_0x6c30('0x28')][_0x6c30('0x29')]()['then'](function(_0x1c7480){return db[_0x6c30('0x11')][_0x6c30('0x12')]({'raw':_0x428aca['options']?_0x428aca[_0x6c30('0x13')][_0x6c30('0x14')]===undefined?!![]:![]:!![],'where':_0x428aca[_0x6c30('0x13')]?_0x428aca[_0x6c30('0x13')][_0x6c30('0x15')]||null:null,'attributes':_0x428aca[_0x6c30('0x13')]?_0x428aca[_0x6c30('0x13')]['attributes']||null:null,'limit':_0x428aca[_0x6c30('0x13')]?_0x428aca[_0x6c30('0x13')][_0x6c30('0x17')]||null:null,'include':_0x428aca[_0x6c30('0x13')]?_0x428aca[_0x6c30('0x13')]['include']?_[_0x6c30('0x18')](_0x428aca['options'][_0x6c30('0x19')],function(_0x3291fc){return{'model':db[_0x3291fc['model']],'as':_0x3291fc['as'],'attributes':_0x3291fc['as']===_0x6c30('0x2f')?_[_0x6c30('0x30')](_0x1c7480):_0x3291fc['attributes'],'include':_0x3291fc['include']?_[_0x6c30('0x18')](_0x3291fc[_0x6c30('0x19')],function(_0x140ea4){return{'model':db[_0x140ea4[_0x6c30('0x1a')]],'as':_0x140ea4['as'],'attributes':_0x140ea4['attributes'],'include':_0x140ea4['include']?_['map'](_0x140ea4[_0x6c30('0x19')],function(_0x106b2f){return{'model':db[_0x106b2f['model']],'as':_0x106b2f['as'],'attributes':_0x106b2f[_0x6c30('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2817b6){logger[_0x6c30('0x9')](_0x6c30('0x10'),_0x428aca);logger[_0x6c30('0x1b')]('GetCmHopper',_0x428aca,JSON['stringify'](_0x2817b6));_0x6c0256(_0x2817b6);})['catch'](function(_0x40d578){logger[_0x6c30('0xd')](_0x6c30('0x10'),_0x40d578[_0x6c30('0xe')],_0x428aca);_0xbbc489(_0x3a9194[_0x6c30('0xd')](0x1f4,_0x40d578[_0x6c30('0xe')]));});});});};exports[_0x6c30('0x45')]=function(_0x50dcdf){var _0x5d083d=this;return new Promise(function(_0x50044d,_0x5e652e){return db[_0x6c30('0x28')][_0x6c30('0x46')]({'raw':!![],'where':{'phone':_0x50dcdf['options'][_0x6c30('0x15')][_0x6c30('0x47')]},'attributes':['id',_0x6c30('0x48')],'order':[['id',_0x6c30('0x49')]]})[_0x6c30('0x8')](function(_0x6406d){logger[_0x6c30('0x9')](_0x6c30('0x4a'),_0x50dcdf);logger[_0x6c30('0x1b')](_0x6c30('0x4a'),_0x50dcdf,JSON[_0x6c30('0x1c')](_0x6406d));_0x50044d(_0x6406d);})['catch'](function(_0x2bc909){logger[_0x6c30('0xd')](_0x6c30('0x4a'),_0x2bc909[_0x6c30('0xe')],_0x50dcdf);_0x5e652e(_0x5d083d['error'](0x1f4,_0x2bc909['message']));});});};exports['ResetActiveCalls']=function(_0x4c9fe1){var _0x7b828d=this;return new Promise(function(_0x43ce1b,_0x50e769){return db[_0x6c30('0x2a')]['transaction'](function(_0x18e020){return db['CmHopper'][_0x6c30('0x24')]({'active':![]},{'where':{},'transaction':_0x18e020})[_0x6c30('0x8')](function(_0x597471){logger[_0x6c30('0x9')]('ResetActiveCalls',_0x4c9fe1);logger[_0x6c30('0x1b')](_0x6c30('0x4b'),_0x4c9fe1,JSON[_0x6c30('0x1c')](_0x597471));_0x43ce1b(_0x597471);})['catch'](function(_0x5be05c){logger[_0x6c30('0xd')](_0x6c30('0x4b'),_0x5be05c[_0x6c30('0xe')],_0x4c9fe1);_0x50e769(_0x7b828d[_0x6c30('0xd')](0x1f4,_0x5be05c[_0x6c30('0xe')]));});});});};exports[_0x6c30('0x4c')]=function(_0x1b9aca){var _0x5a183d=this;var _0x3e03ef=_0x1b9aca[_0x6c30('0x21')][_0x6c30('0x15')][_0x6c30('0x4d')];var _0x306bd1=_0x1b9aca[_0x6c30('0x21')][_0x6c30('0x15')]['interval'];var _0x48610c=_0x1b9aca[_0x6c30('0x21')][_0x6c30('0x15')]['availableAgentsIds'];return new Promise(function(_0x333e77,_0x40c426){return db[_0x6c30('0x11')][_0x6c30('0x12')]({'where':{'voiceQueueId':{'$in':_0x3e03ef},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x6c30('0x2a')]['literal'](_0x6c30('0x4e')+_0x306bd1+_0x6c30('0x4f')),'$gt':db['sequelize']['literal'](_0x6c30('0x50'))}},'UserId':{'$in':_0x48610c}},'include':[{'model':db[_0x6c30('0x28')],'as':_0x6c30('0x2f')},{'model':db['User'],'as':_0x6c30('0x51'),'attributes':['id','name',_0x6c30('0x31')]},{'model':db[_0x6c30('0x52')],'as':_0x6c30('0x53')}]})['then'](function(_0x25512a){if(_0x25512a['length']>0x0){return db['sequelize'][_0x6c30('0x2b')](function(_0x5cc02c){return db[_0x6c30('0x11')][_0x6c30('0x24')]({'recallmeNotifiedDate':db[_0x6c30('0x2a')][_0x6c30('0x54')](_0x6c30('0x50'))},{'where':{'id':{'$in':_[_0x6c30('0x18')](_0x25512a,'id')}},'transaction':_0x5cc02c})[_0x6c30('0x8')](function(){_0x333e77(_0x25512a);})['catch'](function(_0x3760eb){logger['error'](_0x6c30('0x4c'),_0x3760eb[_0x6c30('0xe')],_0x1b9aca);_0x40c426(_0x5a183d[_0x6c30('0xd')](0x1f4,_0x3760eb[_0x6c30('0xe')]));});})['catch'](function(_0x5d5bd6){logger[_0x6c30('0xd')](_0x6c30('0x4c'),_0x5d5bd6['message'],_0x1b9aca);_0x40c426(_0x5a183d[_0x6c30('0xd')](0x1f4,_0x5d5bd6[_0x6c30('0xe')]));});}else{_0x333e77(_0x25512a);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 6df1a36..44c0b39 100644 --- a/server/api/cmHopper/index.js +++ b/server/api/cmHopper/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9476=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getTimezone','put','update','exports','express','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id'];(function(_0x4fd540,_0x4de6c7){var _0x735bb2=function(_0x12e12d){while(--_0x12e12d){_0x4fd540['push'](_0x4fd540['shift']());}};_0x735bb2(++_0x4de6c7);}(_0x9476,0xfc));var _0x6947=function(_0x43f61a,_0x272658){_0x43f61a=_0x43f61a-0x0;var _0x4af42d=_0x9476[_0x43f61a];return _0x4af42d;};'use strict';var express=require(_0x6947('0x0'));var router=express['Router']();var auth=require(_0x6947('0x1'));var controller=require(_0x6947('0x2'));router[_0x6947('0x3')]('/',auth[_0x6947('0x4')](),controller[_0x6947('0x5')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6947('0x6')]);router[_0x6947('0x3')](_0x6947('0x7'),auth[_0x6947('0x4')](),controller[_0x6947('0x8')]);router[_0x6947('0x3')](_0x6947('0x9'),auth[_0x6947('0x4')](),controller[_0x6947('0xa')]);router['get'](_0x6947('0xb'),auth['isAuthenticated'](),controller[_0x6947('0xc')]);router[_0x6947('0x3')](_0x6947('0xd'),auth[_0x6947('0x4')](),controller[_0x6947('0xe')]);router[_0x6947('0xf')]('/',auth['isAuthenticated'](),controller[_0x6947('0x10')]);router[_0x6947('0xf')](_0x6947('0x11'),auth[_0x6947('0x4')](),controller['getPreview']);router[_0x6947('0xf')]('/timezone',auth[_0x6947('0x4')](),controller[_0x6947('0x12')]);router[_0x6947('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6947('0x14')]);router['delete']('/:id',auth[_0x6947('0x4')](),controller['destroy']);module[_0x6947('0x15')]=router; \ No newline at end of file +var _0xcbe1=['show','/:id/previewrecall','post','create','getPreview','/timezone','getTimezone','put','destroy','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','describe','getOpenContacts','/timezones','isAuthenticated','getTimezones','/:id'];(function(_0x1b6f42,_0xa31e93){var _0x1ef5f2=function(_0x792caa){while(--_0x792caa){_0x1b6f42['push'](_0x1b6f42['shift']());}};_0x1ef5f2(++_0xa31e93);}(_0xcbe1,0xfb));var _0x1cbe=function(_0x1bf639,_0x864d54){_0x1bf639=_0x1bf639-0x0;var _0x553079=_0xcbe1[_0x1bf639];return _0x553079;};'use strict';var express=require(_0x1cbe('0x0'));var router=express[_0x1cbe('0x1')]();var auth=require(_0x1cbe('0x2'));var controller=require(_0x1cbe('0x3'));router[_0x1cbe('0x4')]('/',auth['isAuthenticated'](),controller[_0x1cbe('0x5')]);router[_0x1cbe('0x4')](_0x1cbe('0x6'),auth['isAuthenticated'](),controller[_0x1cbe('0x7')]);router[_0x1cbe('0x4')]('/opencontacts',auth['isAuthenticated'](),controller[_0x1cbe('0x8')]);router[_0x1cbe('0x4')](_0x1cbe('0x9'),auth[_0x1cbe('0xa')](),controller[_0x1cbe('0xb')]);router[_0x1cbe('0x4')](_0x1cbe('0xc'),auth[_0x1cbe('0xa')](),controller[_0x1cbe('0xd')]);router[_0x1cbe('0x4')](_0x1cbe('0xe'),auth[_0x1cbe('0xa')](),controller['getPreviewRecall']);router[_0x1cbe('0xf')]('/',auth[_0x1cbe('0xa')](),controller[_0x1cbe('0x10')]);router['post']('/preview',auth[_0x1cbe('0xa')](),controller[_0x1cbe('0x11')]);router[_0x1cbe('0xf')](_0x1cbe('0x12'),auth[_0x1cbe('0xa')](),controller[_0x1cbe('0x13')]);router[_0x1cbe('0x14')]('/:id',auth[_0x1cbe('0xa')](),controller['update']);router['delete'](_0x1cbe('0xc'),auth[_0x1cbe('0xa')](),controller[_0x1cbe('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 5fe5e01..658ca0d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa54d=['INTEGER','moment','sequelize','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xa54d,0x1bd));var _0xda54=function(_0x2feb43,_0x5be84b){_0x2feb43=_0x2feb43-0x0;var _0x27df57=_0xa54d[_0x2feb43];return _0x27df57;};'use strict';var moment=require(_0xda54('0x0'));var Sequelize=require(_0xda54('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xda54('0x2')],'defaultValue':moment()[_0xda54('0x3')](_0xda54('0x4'))},'countbusyretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda54('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe2bf=['STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x190015,_0x1799f4){var _0x4231ef=function(_0x1106b3){while(--_0x1106b3){_0x190015['push'](_0x190015['shift']());}};_0x4231ef(++_0x1799f4);}(_0xe2bf,0x138));var _0xfe2b=function(_0x16741e,_0x3fa91a){_0x16741e=_0x16741e-0x0;var _0x53d85a=_0xe2bf[_0x16741e];return _0x53d85a;};'use strict';var moment=require(_0xfe2b('0x0'));var Sequelize=require(_0xfe2b('0x1'));module[_0xfe2b('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xfe2b('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xfe2b('0x5')],'defaultValue':moment()['format'](_0xfe2b('0x6'))},'countbusyretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfe2b('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 2b132ee..17e29f1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9254=['sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','rows','catch','show','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x230dab,_0x1de849){var _0xb9f2fc=function(_0x369490){while(--_0x369490){_0x230dab['push'](_0x230dab['shift']());}};_0xb9f2fc(++_0x1de849);}(_0x9254,0x8e));var _0x4925=function(_0x577ce5,_0x515b3f){_0x577ce5=_0x577ce5-0x0;var _0x1ef1ba=_0x9254[_0x577ce5];return _0x1ef1ba;};'use strict';var emlformat=require(_0x4925('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4925('0x1'));var jsonpatch=require(_0x4925('0x2'));var rp=require(_0x4925('0x3'));var moment=require(_0x4925('0x4'));var BPromise=require(_0x4925('0x5'));var Mustache=require(_0x4925('0x6'));var util=require(_0x4925('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4925('0x8'));var ejs=require(_0x4925('0x9'));var fs=require('fs');var fs_extra=require(_0x4925('0xa'));var _=require(_0x4925('0xb'));var squel=require(_0x4925('0xc'));var crypto=require('crypto');var jsforce=require(_0x4925('0xd'));var deskjs=require(_0x4925('0xe'));var toCsv=require(_0x4925('0x8'));var querystring=require(_0x4925('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4925('0x10'));var qs=require(_0x4925('0x11'));var as=require(_0x4925('0x12'));var hardwareService=require(_0x4925('0x13'));var logger=require('../../config/logger')(_0x4925('0x14'));var utils=require(_0x4925('0x15'));var config=require(_0x4925('0x16'));var licenseUtil=require(_0x4925('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5370ff,_0x4e0f29){_0x4e0f29=_0x4e0f29||0xcc;return function(_0x43006c){if(_0x43006c){return _0x5370ff[_0x4925('0x18')](_0x4e0f29);}return _0x5370ff[_0x4925('0x19')](_0x4e0f29)[_0x4925('0x1a')]();};}function respondWithResult(_0x26dfd6,_0x5e5d39){_0x5e5d39=_0x5e5d39||0xc8;return function(_0x62f2c5){if(_0x62f2c5){return _0x26dfd6['status'](_0x5e5d39)['json'](_0x62f2c5);}};}function respondWithFilteredResult(_0x17c7b2,_0x57f826){return function(_0x5ca764){if(_0x5ca764){var _0x24c24d=typeof _0x57f826[_0x4925('0x1b')]===_0x4925('0x1c')&&typeof _0x57f826['limit']===_0x4925('0x1c');var _0x43d9d9=_0x5ca764[_0x4925('0x1d')];var _0x2cbf63=_0x24c24d?0x0:_0x57f826[_0x4925('0x1b')];var _0x5cdceb=_0x24c24d?_0x5ca764[_0x4925('0x1d')]:_0x57f826[_0x4925('0x1b')]+_0x57f826['limit'];var _0x3063b1;if(_0x5cdceb>=_0x43d9d9){_0x5cdceb=_0x43d9d9;_0x3063b1=0xc8;}else{_0x3063b1=0xce;}_0x17c7b2[_0x4925('0x19')](_0x3063b1);return _0x17c7b2['set'](_0x4925('0x1e'),_0x2cbf63+'-'+_0x5cdceb+'/'+_0x43d9d9)[_0x4925('0x1f')](_0x5ca764);}return null;};}function patchUpdates(_0x2f71b4){return function(_0x20f3c1){try{jsonpatch[_0x4925('0x20')](_0x20f3c1,_0x2f71b4,!![]);}catch(_0x251ce7){return BPromise[_0x4925('0x21')](_0x251ce7);}return _0x20f3c1[_0x4925('0x22')]();};}function saveUpdates(_0xa97036,_0x504522){return function(_0x45d932){if(_0x45d932){return _0x45d932[_0x4925('0x23')](_0xa97036)[_0x4925('0x24')](function(_0x71680){return _0x71680;});}return null;};}function removeEntity(_0x44413b,_0x2f8eac){return function(_0x219358){if(_0x219358){return _0x219358[_0x4925('0x25')]()[_0x4925('0x24')](function(){var _0x478566=_0x219358[_0x4925('0x26')]({'plain':!![]});var _0x15db51=_0x4925('0x27');return db[_0x4925('0x28')][_0x4925('0x25')]({'where':{'type':_0x15db51,'resourceId':_0x478566['id']}})[_0x4925('0x24')](function(){return _0x219358;});})[_0x4925('0x24')](function(){_0x44413b[_0x4925('0x19')](0xcc)[_0x4925('0x1a')]();});}};}function handleEntityNotFound(_0x3a4b7b,_0x3e5008){return function(_0x22c398){if(!_0x22c398){_0x3a4b7b[_0x4925('0x18')](0x194);}return _0x22c398;};}function handleError(_0x234029,_0x2cc725){_0x2cc725=_0x2cc725||0x1f4;return function(_0x1b5cfb){logger[_0x4925('0x29')](_0x1b5cfb[_0x4925('0x2a')]);if(_0x1b5cfb[_0x4925('0x2b')]){delete _0x1b5cfb['name'];}_0x234029[_0x4925('0x19')](_0x2cc725)[_0x4925('0x2c')](_0x1b5cfb);};}exports['index']=function(_0x2c0916,_0x27d87f){var _0x105d61={},_0x4e5c5={},_0x2e9fc1={'count':0x0,'rows':[]};var _0x1478ee=_['map'](db['CmHopperAdditionalPhone'][_0x4925('0x2d')],function(_0x881135){return{'name':_0x881135[_0x4925('0x2e')],'type':_0x881135['type'][_0x4925('0x2f')]};});_0x4e5c5[_0x4925('0x30')]=_[_0x4925('0x31')](_0x1478ee,_0x4925('0x2b'));_0x4e5c5[_0x4925('0x32')]=_['keys'](_0x2c0916[_0x4925('0x32')]);_0x4e5c5[_0x4925('0x33')]=_[_0x4925('0x34')](_0x4e5c5[_0x4925('0x30')],_0x4e5c5['query']);_0x105d61[_0x4925('0x35')]=_[_0x4925('0x34')](_0x4e5c5['model'],qs[_0x4925('0x36')](_0x2c0916[_0x4925('0x32')][_0x4925('0x36')]));_0x105d61[_0x4925('0x35')]=_0x105d61[_0x4925('0x35')][_0x4925('0x37')]?_0x105d61[_0x4925('0x35')]:_0x4e5c5[_0x4925('0x30')];if(!_0x2c0916[_0x4925('0x32')][_0x4925('0x38')](_0x4925('0x39'))){_0x105d61[_0x4925('0x3a')]=qs[_0x4925('0x3a')](_0x2c0916[_0x4925('0x32')]['limit']);_0x105d61[_0x4925('0x1b')]=qs[_0x4925('0x1b')](_0x2c0916[_0x4925('0x32')][_0x4925('0x1b')]);}_0x105d61['order']=qs[_0x4925('0x3b')](_0x2c0916['query'][_0x4925('0x3b')]);_0x105d61[_0x4925('0x3c')]=qs[_0x4925('0x33')](_[_0x4925('0x3d')](_0x2c0916[_0x4925('0x32')],_0x4e5c5[_0x4925('0x33')]),_0x1478ee);if(_0x2c0916['query'][_0x4925('0x3e')]){_0x105d61[_0x4925('0x3c')]=_[_0x4925('0x3f')](_0x105d61['where'],{'$or':_[_0x4925('0x31')](_0x1478ee,function(_0x1f5fd3){if(_0x1f5fd3[_0x4925('0x40')]!==_0x4925('0x41')){var _0x10e2a9={};_0x10e2a9[_0x1f5fd3[_0x4925('0x2b')]]={'$like':'%'+_0x2c0916['query'][_0x4925('0x3e')]+'%'};return _0x10e2a9;}})});}_0x105d61=_[_0x4925('0x3f')]({},_0x105d61,_0x2c0916[_0x4925('0x42')]);var _0x52653a={'where':_0x105d61['where']};return db[_0x4925('0x43')][_0x4925('0x1d')](_0x52653a)[_0x4925('0x24')](function(_0xcc9a2e){_0x2e9fc1[_0x4925('0x1d')]=_0xcc9a2e;if(_0x2c0916['query'][_0x4925('0x44')]){_0x105d61[_0x4925('0x45')]=[{'all':!![]}];}return db[_0x4925('0x43')]['findAll'](_0x105d61);})['then'](function(_0x4177cc){_0x2e9fc1[_0x4925('0x46')]=_0x4177cc;return _0x2e9fc1;})[_0x4925('0x24')](respondWithFilteredResult(_0x27d87f,_0x105d61))[_0x4925('0x47')](handleError(_0x27d87f,null));};exports[_0x4925('0x48')]=function(_0x5119d5,_0x3ba83b){var _0x2ee337={'raw':!![],'where':{'id':_0x5119d5[_0x4925('0x49')]['id']}},_0x50351e={};_0x50351e[_0x4925('0x30')]=_[_0x4925('0x4a')](db[_0x4925('0x43')][_0x4925('0x2d')]);_0x50351e['query']=_['keys'](_0x5119d5[_0x4925('0x32')]);_0x50351e[_0x4925('0x33')]=_[_0x4925('0x34')](_0x50351e['model'],_0x50351e[_0x4925('0x32')]);_0x2ee337['attributes']=_[_0x4925('0x34')](_0x50351e[_0x4925('0x30')],qs[_0x4925('0x36')](_0x5119d5[_0x4925('0x32')][_0x4925('0x36')]));_0x2ee337['attributes']=_0x2ee337[_0x4925('0x35')][_0x4925('0x37')]?_0x2ee337[_0x4925('0x35')]:_0x50351e['model'];if(_0x5119d5[_0x4925('0x32')][_0x4925('0x44')]){_0x2ee337['include']=[{'all':!![]}];}_0x2ee337=_[_0x4925('0x3f')]({},_0x2ee337,_0x5119d5[_0x4925('0x42')]);return db[_0x4925('0x43')]['find'](_0x2ee337)['then'](handleEntityNotFound(_0x3ba83b,null))[_0x4925('0x24')](respondWithResult(_0x3ba83b,null))[_0x4925('0x47')](handleError(_0x3ba83b,null));};exports[_0x4925('0x4b')]=function(_0x3706d5,_0x3d8125){return db[_0x4925('0x43')][_0x4925('0x4b')](_0x3706d5[_0x4925('0x4c')],{})['then'](function(_0x1036c2){var _0x2a3f59=_0x3706d5['user'][_0x4925('0x26')]({'plain':!![]});if(!_0x2a3f59)throw new Error(_0x4925('0x4d'));if(_0x2a3f59['role']===_0x4925('0x4e')){var _0xaa927d=_0x1036c2['get']({'plain':!![]});var _0x9a90b0='CmHopperAdditionalPhones';return db[_0x4925('0x4f')][_0x4925('0x50')]({'where':{'name':_0x9a90b0,'userProfileId':_0x2a3f59[_0x4925('0x51')]},'raw':!![]})[_0x4925('0x24')](function(_0x13960b){if(_0x13960b&&_0x13960b[_0x4925('0x52')]===0x0){return db[_0x4925('0x28')]['create']({'name':_0xaa927d['name'],'resourceId':_0xaa927d['id'],'type':_0x13960b[_0x4925('0x2b')],'sectionId':_0x13960b['id']},{})[_0x4925('0x24')](function(){return _0x1036c2;});}else{return _0x1036c2;}})['catch'](function(_0x145776){logger[_0x4925('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x145776);throw _0x145776;});}return _0x1036c2;})[_0x4925('0x24')](respondWithResult(_0x3d8125,0xc9))[_0x4925('0x47')](handleError(_0x3d8125,null));};exports[_0x4925('0x23')]=function(_0x47f292,_0x257805){if(_0x47f292[_0x4925('0x4c')]['id']){delete _0x47f292[_0x4925('0x4c')]['id'];}return db[_0x4925('0x43')][_0x4925('0x50')]({'where':{'id':_0x47f292[_0x4925('0x49')]['id']}})[_0x4925('0x24')](handleEntityNotFound(_0x257805,null))['then'](saveUpdates(_0x47f292[_0x4925('0x4c')],null))[_0x4925('0x24')](respondWithResult(_0x257805,null))[_0x4925('0x47')](handleError(_0x257805,null));};exports[_0x4925('0x25')]=function(_0x123238,_0xcd81){return db[_0x4925('0x43')][_0x4925('0x50')]({'where':{'id':_0x123238[_0x4925('0x49')]['id']}})[_0x4925('0x24')](handleEntityNotFound(_0xcd81,null))['then'](removeEntity(_0xcd81,null))[_0x4925('0x47')](handleError(_0xcd81,null));}; \ No newline at end of file +var _0x8add=['squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash'];(function(_0x1fa68b,_0x152e4e){var _0x32a3c6=function(_0x25c292){while(--_0x25c292){_0x1fa68b['push'](_0x1fa68b['shift']());}};_0x32a3c6(++_0x152e4e);}(_0x8add,0xe0));var _0xd8ad=function(_0x4462a5,_0x451816){_0x4462a5=_0x4462a5-0x0;var _0x38cb74=_0x8add[_0x4462a5];return _0x38cb74;};'use strict';var emlformat=require(_0xd8ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8ad('0x2'));var moment=require('moment');var BPromise=require(_0xd8ad('0x3'));var Mustache=require(_0xd8ad('0x4'));var util=require('util');var path=require(_0xd8ad('0x5'));var sox=require(_0xd8ad('0x6'));var csv=require(_0xd8ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8ad('0x8'));var _=require(_0xd8ad('0x9'));var squel=require(_0xd8ad('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd8ad('0xb'));var toCsv=require(_0xd8ad('0x7'));var querystring=require(_0xd8ad('0xc'));var Papa=require(_0xd8ad('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd8ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8ad('0xf'))(_0xd8ad('0x10'));var utils=require(_0xd8ad('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xd8ad('0x12'));var db=require(_0xd8ad('0x13'))['db'];function respondWithStatusCode(_0x2f8158,_0x540f81){_0x540f81=_0x540f81||0xcc;return function(_0x28c2a4){if(_0x28c2a4){return _0x2f8158[_0xd8ad('0x14')](_0x540f81);}return _0x2f8158[_0xd8ad('0x15')](_0x540f81)['end']();};}function respondWithResult(_0x2fab87,_0x3ee4fe){_0x3ee4fe=_0x3ee4fe||0xc8;return function(_0x43d687){if(_0x43d687){return _0x2fab87[_0xd8ad('0x15')](_0x3ee4fe)[_0xd8ad('0x16')](_0x43d687);}};}function respondWithFilteredResult(_0x91a79a,_0x4e78de){return function(_0x199535){if(_0x199535){var _0x17e915=typeof _0x4e78de[_0xd8ad('0x17')]===_0xd8ad('0x18')&&typeof _0x4e78de[_0xd8ad('0x19')]===_0xd8ad('0x18');var _0x2babf5=_0x199535[_0xd8ad('0x1a')];var _0x461505=_0x17e915?0x0:_0x4e78de[_0xd8ad('0x17')];var _0xa24ed=_0x17e915?_0x199535[_0xd8ad('0x1a')]:_0x4e78de[_0xd8ad('0x17')]+_0x4e78de[_0xd8ad('0x19')];var _0x410e75;if(_0xa24ed>=_0x2babf5){_0xa24ed=_0x2babf5;_0x410e75=0xc8;}else{_0x410e75=0xce;}_0x91a79a[_0xd8ad('0x15')](_0x410e75);return _0x91a79a[_0xd8ad('0x1b')](_0xd8ad('0x1c'),_0x461505+'-'+_0xa24ed+'/'+_0x2babf5)['json'](_0x199535);}return null;};}function patchUpdates(_0x3746ef){return function(_0xdc7d3f){try{jsonpatch['apply'](_0xdc7d3f,_0x3746ef,!![]);}catch(_0x182cc9){return BPromise[_0xd8ad('0x1d')](_0x182cc9);}return _0xdc7d3f[_0xd8ad('0x1e')]();};}function saveUpdates(_0x3e33e1,_0x124218){return function(_0x145c0e){if(_0x145c0e){return _0x145c0e[_0xd8ad('0x1f')](_0x3e33e1)[_0xd8ad('0x20')](function(_0x103a90){return _0x103a90;});}return null;};}function removeEntity(_0x3825de,_0x5680b9){return function(_0x112df7){if(_0x112df7){return _0x112df7[_0xd8ad('0x21')]()[_0xd8ad('0x20')](function(){var _0x8dc2fc=_0x112df7[_0xd8ad('0x22')]({'plain':!![]});var _0x228086=_0xd8ad('0x23');return db[_0xd8ad('0x24')]['destroy']({'where':{'type':_0x228086,'resourceId':_0x8dc2fc['id']}})[_0xd8ad('0x20')](function(){return _0x112df7;});})[_0xd8ad('0x20')](function(){_0x3825de['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5023,_0x2d493c){return function(_0x399591){if(!_0x399591){_0x3a5023['sendStatus'](0x194);}return _0x399591;};}function handleError(_0x355c0a,_0x5c80c2){_0x5c80c2=_0x5c80c2||0x1f4;return function(_0x3b2dbf){logger['error'](_0x3b2dbf[_0xd8ad('0x25')]);if(_0x3b2dbf[_0xd8ad('0x26')]){delete _0x3b2dbf[_0xd8ad('0x26')];}_0x355c0a[_0xd8ad('0x15')](_0x5c80c2)[_0xd8ad('0x27')](_0x3b2dbf);};}exports[_0xd8ad('0x28')]=function(_0x2fb420,_0xe36201){var _0x525178={},_0x31fc4c={},_0x5e93b2={'count':0x0,'rows':[]};var _0x424692=_[_0xd8ad('0x29')](db[_0xd8ad('0x2a')][_0xd8ad('0x2b')],function(_0x24efe4){return{'name':_0x24efe4[_0xd8ad('0x2c')],'type':_0x24efe4[_0xd8ad('0x2d')]['key']};});_0x31fc4c[_0xd8ad('0x2e')]=_['map'](_0x424692,_0xd8ad('0x26'));_0x31fc4c[_0xd8ad('0x2f')]=_[_0xd8ad('0x30')](_0x2fb420[_0xd8ad('0x2f')]);_0x31fc4c[_0xd8ad('0x31')]=_[_0xd8ad('0x32')](_0x31fc4c[_0xd8ad('0x2e')],_0x31fc4c['query']);_0x525178[_0xd8ad('0x33')]=_['intersection'](_0x31fc4c[_0xd8ad('0x2e')],qs['fields'](_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x34')]));_0x525178[_0xd8ad('0x33')]=_0x525178['attributes']['length']?_0x525178['attributes']:_0x31fc4c[_0xd8ad('0x2e')];if(!_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x35')]('nolimit')){_0x525178[_0xd8ad('0x19')]=qs[_0xd8ad('0x19')](_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x19')]);_0x525178['offset']=qs[_0xd8ad('0x17')](_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x17')]);}_0x525178[_0xd8ad('0x36')]=qs[_0xd8ad('0x37')](_0x2fb420[_0xd8ad('0x2f')]['sort']);_0x525178[_0xd8ad('0x38')]=qs[_0xd8ad('0x31')](_[_0xd8ad('0x39')](_0x2fb420['query'],_0x31fc4c[_0xd8ad('0x31')]),_0x424692);if(_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x3a')]){_0x525178[_0xd8ad('0x38')]=_[_0xd8ad('0x3b')](_0x525178[_0xd8ad('0x38')],{'$or':_[_0xd8ad('0x29')](_0x424692,function(_0x487864){if(_0x487864[_0xd8ad('0x2d')]!==_0xd8ad('0x3c')){var _0x17e621={};_0x17e621[_0x487864[_0xd8ad('0x26')]]={'$like':'%'+_0x2fb420[_0xd8ad('0x2f')][_0xd8ad('0x3a')]+'%'};return _0x17e621;}})});}_0x525178=_[_0xd8ad('0x3b')]({},_0x525178,_0x2fb420[_0xd8ad('0x3d')]);var _0x300d57={'where':_0x525178[_0xd8ad('0x38')]};return db['CmHopperAdditionalPhone'][_0xd8ad('0x1a')](_0x300d57)[_0xd8ad('0x20')](function(_0xd1f5f0){_0x5e93b2[_0xd8ad('0x1a')]=_0xd1f5f0;if(_0x2fb420['query'][_0xd8ad('0x3e')]){_0x525178[_0xd8ad('0x3f')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xd8ad('0x40')](_0x525178);})[_0xd8ad('0x20')](function(_0x3e86e3){_0x5e93b2['rows']=_0x3e86e3;return _0x5e93b2;})[_0xd8ad('0x20')](respondWithFilteredResult(_0xe36201,_0x525178))['catch'](handleError(_0xe36201,null));};exports[_0xd8ad('0x41')]=function(_0xb47ef2,_0xad5122){var _0x274417={'raw':!![],'where':{'id':_0xb47ef2[_0xd8ad('0x42')]['id']}},_0x473ea2={};_0x473ea2[_0xd8ad('0x2e')]=_['keys'](db[_0xd8ad('0x2a')][_0xd8ad('0x2b')]);_0x473ea2['query']=_[_0xd8ad('0x30')](_0xb47ef2['query']);_0x473ea2[_0xd8ad('0x31')]=_['intersection'](_0x473ea2[_0xd8ad('0x2e')],_0x473ea2[_0xd8ad('0x2f')]);_0x274417[_0xd8ad('0x33')]=_['intersection'](_0x473ea2[_0xd8ad('0x2e')],qs[_0xd8ad('0x34')](_0xb47ef2[_0xd8ad('0x2f')][_0xd8ad('0x34')]));_0x274417[_0xd8ad('0x33')]=_0x274417['attributes'][_0xd8ad('0x43')]?_0x274417[_0xd8ad('0x33')]:_0x473ea2['model'];if(_0xb47ef2[_0xd8ad('0x2f')][_0xd8ad('0x3e')]){_0x274417['include']=[{'all':!![]}];}_0x274417=_[_0xd8ad('0x3b')]({},_0x274417,_0xb47ef2[_0xd8ad('0x3d')]);return db[_0xd8ad('0x2a')][_0xd8ad('0x44')](_0x274417)[_0xd8ad('0x20')](handleEntityNotFound(_0xad5122,null))[_0xd8ad('0x20')](respondWithResult(_0xad5122,null))[_0xd8ad('0x45')](handleError(_0xad5122,null));};exports[_0xd8ad('0x46')]=function(_0x3f8fde,_0x46670a){return db[_0xd8ad('0x2a')]['create'](_0x3f8fde[_0xd8ad('0x47')],{})['then'](function(_0x1ef861){var _0x1e1d47=_0x3f8fde[_0xd8ad('0x48')][_0xd8ad('0x22')]({'plain':!![]});if(!_0x1e1d47)throw new Error(_0xd8ad('0x49'));if(_0x1e1d47[_0xd8ad('0x4a')]===_0xd8ad('0x48')){var _0x5b3389=_0x1ef861[_0xd8ad('0x22')]({'plain':!![]});var _0x5b9ffa='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xd8ad('0x44')]({'where':{'name':_0x5b9ffa,'userProfileId':_0x1e1d47[_0xd8ad('0x4b')]},'raw':!![]})[_0xd8ad('0x20')](function(_0x43ef1d){if(_0x43ef1d&&_0x43ef1d[_0xd8ad('0x4c')]===0x0){return db[_0xd8ad('0x24')][_0xd8ad('0x46')]({'name':_0x5b3389[_0xd8ad('0x26')],'resourceId':_0x5b3389['id'],'type':_0x43ef1d[_0xd8ad('0x26')],'sectionId':_0x43ef1d['id']},{})['then'](function(){return _0x1ef861;});}else{return _0x1ef861;}})[_0xd8ad('0x45')](function(_0x3fbb5d){logger['error'](_0xd8ad('0x4d'),_0x3fbb5d);throw _0x3fbb5d;});}return _0x1ef861;})['then'](respondWithResult(_0x46670a,0xc9))[_0xd8ad('0x45')](handleError(_0x46670a,null));};exports['update']=function(_0x38322d,_0x41d0cc){if(_0x38322d[_0xd8ad('0x47')]['id']){delete _0x38322d[_0xd8ad('0x47')]['id'];}return db[_0xd8ad('0x2a')][_0xd8ad('0x44')]({'where':{'id':_0x38322d[_0xd8ad('0x42')]['id']}})[_0xd8ad('0x20')](handleEntityNotFound(_0x41d0cc,null))[_0xd8ad('0x20')](saveUpdates(_0x38322d[_0xd8ad('0x47')],null))['then'](respondWithResult(_0x41d0cc,null))[_0xd8ad('0x45')](handleError(_0x41d0cc,null));};exports[_0xd8ad('0x21')]=function(_0x4f4912,_0x3d7254){return db[_0xd8ad('0x2a')]['find']({'where':{'id':_0x4f4912[_0xd8ad('0x42')]['id']}})[_0xd8ad('0x20')](handleEntityNotFound(_0x3d7254,null))[_0xd8ad('0x20')](removeEntity(_0x3d7254,null))['catch'](handleError(_0x3d7254,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 28401aa..9b0457d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd65c=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x4abcf0,_0x3485c0){var _0x3d44df=function(_0x51221a){while(--_0x51221a){_0x4abcf0['push'](_0x4abcf0['shift']());}};_0x3d44df(++_0x3485c0);}(_0xd65c,0x6b));var _0xcd65=function(_0x50edb7,_0x44caf8){_0x50edb7=_0x50edb7-0x0;var _0x15548a=_0xd65c[_0x50edb7];return _0x15548a;};'use strict';var _=require(_0xcd65('0x0'));var util=require(_0xcd65('0x1'));var logger=require(_0xcd65('0x2'))('api');var moment=require(_0xcd65('0x3'));var BPromise=require(_0xcd65('0x4'));var rp=require(_0xcd65('0x5'));var fs=require('fs');var path=require(_0xcd65('0x6'));var rimraf=require('rimraf');var config=require(_0xcd65('0x7'));var attributes=require(_0xcd65('0x8'));module['exports']=function(_0x3e2ac2,_0x5494e3){return _0x3e2ac2[_0xcd65('0x9')](_0xcd65('0xa'),attributes,{'tableName':_0xcd65('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eec=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone'];(function(_0x147e10,_0x52486e){var _0x14149c=function(_0x202f0b){while(--_0x202f0b){_0x147e10['push'](_0x147e10['shift']());}};_0x14149c(++_0x52486e);}(_0x7eec,0x146));var _0xc7ee=function(_0xc186b4,_0x409fd9){_0xc186b4=_0xc186b4-0x0;var _0x28b844=_0x7eec[_0xc186b4];return _0x28b844;};'use strict';var _=require(_0xc7ee('0x0'));var util=require(_0xc7ee('0x1'));var logger=require(_0xc7ee('0x2'))(_0xc7ee('0x3'));var moment=require(_0xc7ee('0x4'));var BPromise=require(_0xc7ee('0x5'));var rp=require(_0xc7ee('0x6'));var fs=require('fs');var path=require(_0xc7ee('0x7'));var rimraf=require(_0xc7ee('0x8'));var config=require(_0xc7ee('0x9'));var attributes=require(_0xc7ee('0xa'));module['exports']=function(_0x867f1d,_0x336a44){return _0x867f1d['define'](_0xc7ee('0xb'),attributes,{'tableName':_0xc7ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 2f8723e..b25118d 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc43=['ListId','VoiceQueueId','CampaignId','then','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countbusyretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findOne','ContactId','body'];(function(_0x55a511,_0x2ec93d){var _0x52dc79=function(_0x1425bb){while(--_0x1425bb){_0x55a511['push'](_0x55a511['shift']());}};_0x52dc79(++_0x2ec93d);}(_0xbc43,0x1a9));var _0x3bc4=function(_0x29addf,_0x714311){_0x29addf=_0x29addf-0x0;var _0x4bb60d=_0xbc43[_0x29addf];return _0x4bb60d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bc4('0x0'));var BPromise=require(_0x3bc4('0x1'));var rs=require(_0x3bc4('0x2'));var fs=require('fs');var Redis=require(_0x3bc4('0x3'));var db=require(_0x3bc4('0x4'))['db'];var utils=require(_0x3bc4('0x5'));var logger=require(_0x3bc4('0x6'))(_0x3bc4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bc4('0x8')][_0x3bc4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40dd20,_0x4a434f,_0x4f659a){return new BPromise(function(_0xe4b579,_0xacd045){return client[_0x3bc4('0xa')](_0x40dd20,_0x4f659a)['then'](function(_0x268b1a){logger['info'](_0x3bc4('0xb'),_0x4a434f,_0x3bc4('0xc'));logger['debug'](_0x3bc4('0xd'),_0x4a434f,_0x3bc4('0xc'),JSON['stringify'](_0x268b1a));if(_0x268b1a[_0x3bc4('0xe')]){if(_0x268b1a['error'][_0x3bc4('0xf')]===0x1f4){logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x268b1a[_0x3bc4('0xe')]['message']);return _0xacd045(_0x268b1a[_0x3bc4('0xe')][_0x3bc4('0x10')]);}logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x268b1a[_0x3bc4('0xe')]['message']);return _0xe4b579(_0x268b1a[_0x3bc4('0xe')][_0x3bc4('0x10')]);}else{logger['info'](_0x3bc4('0xb'),_0x4a434f,_0x3bc4('0xc'));_0xe4b579(_0x268b1a[_0x3bc4('0x11')]['message']);}})[_0x3bc4('0x12')](function(_0x51a336){logger[_0x3bc4('0xe')](_0x3bc4('0xb'),_0x4a434f,_0x51a336);_0xacd045(_0x51a336);});});}exports['VerifyAdditionalPhones']=function(_0x29ab8d){var _0xf281ad=this;return new Promise(function(_0x2f9853,_0x5351f0){return db[_0x3bc4('0x13')][_0x3bc4('0x14')]({'raw':!![],'where':{'ContactId':_0x29ab8d['body'][_0x3bc4('0x15')],'ListId':_0x29ab8d[_0x3bc4('0x16')][_0x3bc4('0x17')],'VoiceQueueId':_0x29ab8d[_0x3bc4('0x16')][_0x3bc4('0x18')]===undefined?null:_0x29ab8d[_0x3bc4('0x16')]['VoiceQueueId'],'CampaignId':_0x29ab8d[_0x3bc4('0x16')]['CampaignId']===undefined?null:_0x29ab8d['body'][_0x3bc4('0x19')]}})[_0x3bc4('0x1a')](function(_0x4b98f4){if(_0x4b98f4!=null){return db['CmHopperAdditionalPhone'][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b98f4['id'],'OrderBy':{'$gt':_0x4b98f4['OrderBy']}},'order':[[_0x3bc4('0x1b'),_0x3bc4('0x1c')]]})[_0x3bc4('0x1a')](function(_0xf06ce5){var _0x2cc4a1=0x0;if(_0xf06ce5){if(_0xf06ce5['countbusyretry']+_0xf06ce5[_0x3bc4('0x1d')]+_0xf06ce5['countnoanswerretry']+_0xf06ce5[_0x3bc4('0x1e')]+_0xf06ce5[_0x3bc4('0x1f')]+_0xf06ce5[_0x3bc4('0x20')]+_0xf06ce5['countmachineretry']+_0xf06ce5[_0x3bc4('0x21')]<_0x29ab8d['entity']['dialGlobalMaxRetry'])_0x2cc4a1=0x1;_0x2f9853({'additional':_0x2cc4a1});}else{return db['CmHopperAdditionalPhone'][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4b98f4['id']},'order':[[_0x3bc4('0x1b'),'ASC']]})[_0x3bc4('0x1a')](function(_0x5499ca){var _0x5c1d00=0x0;if(_0x5499ca){if(_0x5499ca[_0x3bc4('0x22')]+_0x5499ca[_0x3bc4('0x1d')]+_0x5499ca[_0x3bc4('0x23')]+_0x5499ca['countnosuchnumberretry']+_0x5499ca['countdropretry']+_0x5499ca[_0x3bc4('0x20')]+_0x5499ca[_0x3bc4('0x24')]+_0x5499ca[_0x3bc4('0x21')]<_0x29ab8d['entity'][_0x3bc4('0x25')])_0x5c1d00=0x1;_0x2f9853({'additional':_0x5c1d00});}else{_0x2f9853({'additional':0x0});}})[_0x3bc4('0x12')](function(_0x31b736){logger[_0x3bc4('0xe')](_0x3bc4('0x26'),_0x31b736[_0x3bc4('0x10')]);_0x5351f0(_0xf281ad[_0x3bc4('0xe')](0x1f4,_0x31b736[_0x3bc4('0x10')]));});}})['catch'](function(_0x39d4e7){logger[_0x3bc4('0xe')](_0x3bc4('0x26'),_0x39d4e7[_0x3bc4('0x10')]);_0x5351f0(_0xf281ad['error'](0x1f4,_0x39d4e7[_0x3bc4('0x10')]));});}else _0x2f9853({'additional':0x0});});});};exports[_0x3bc4('0x27')]=function(_0x54a6a3){var _0x1a308a=this;return new Promise(function(_0xbd79d8,_0x5b46a5){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x15')],'ListId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x17')],'VoiceQueueId':_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x18')]===undefined?null:_0x54a6a3[_0x3bc4('0x16')][_0x3bc4('0x18')],'CampaignId':_0x54a6a3['body']['CampaignId']===undefined?null:_0x54a6a3[_0x3bc4('0x16')]['CampaignId']}})[_0x3bc4('0x1a')](function(_0x4423a5){if(_0x4423a5!=null){return db[_0x3bc4('0x28')][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4423a5['id'],'OrderBy':{'$gte':_0x4423a5[_0x3bc4('0x1b')]}},'order':[[_0x3bc4('0x1b'),'ASC']]})['then'](function(_0x186158){if(_0x186158)return activateAdditionalPhone(_0x4423a5,_0x54a6a3[_0x3bc4('0x16')],_0x186158,_0x54a6a3[_0x3bc4('0x29')],_0x54a6a3[_0x3bc4('0x2a')])[_0x3bc4('0x1a')](function(_0x7c4f14){_0xbd79d8(_0x7c4f14);});else{return db[_0x3bc4('0x28')][_0x3bc4('0x14')]({'raw':!![],'where':{'CmHopperId':_0x4423a5['id']},'order':[[_0x3bc4('0x1b'),'ASC']]})[_0x3bc4('0x1a')](function(_0x3409ad){if(_0x3409ad)return activateAdditionalPhone(_0x4423a5,_0x54a6a3[_0x3bc4('0x16')],_0x3409ad,_0x54a6a3['duration'],_0x54a6a3[_0x3bc4('0x2a')])[_0x3bc4('0x1a')](function(_0x3fa03e){_0xbd79d8(_0x3fa03e);});else{_0xbd79d8({'id':_0x4423a5['id'],'phone':''});}})[_0x3bc4('0x12')](function(_0x3bc640){logger['error'](_0x3bc4('0x26'),_0x3bc640[_0x3bc4('0x10')]);_0x5b46a5(_0x1a308a[_0x3bc4('0xe')](0x1f4,_0x3bc640['message']));});}})[_0x3bc4('0x12')](function(_0x4ad5cc){logger['error'](_0x3bc4('0x26'),_0x4ad5cc[_0x3bc4('0x10')]);_0x5b46a5(_0x1a308a['error'](0x1f4,_0x4ad5cc['message']));});}else _0xbd79d8(0x1);});});};function activateAdditionalPhone(_0x5cd153,_0x15c697,_0x5d5160,_0x32d33e,_0x5a49a3){return new Promise(function(_0x5020ab,_0x3df27a){var _0x42146e;if(_[_0x3bc4('0x2b')](_0x5d5160['scheduledat'])){_0x5d5160[_0x3bc4('0x2c')]=moment();}if(moment()>moment(_0x5d5160[_0x3bc4('0x2c')])){_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}else{if(_0x5d5160[_0x3bc4('0x1b')]==0x0){_0x42146e=moment(_0x5d5160[_0x3bc4('0x2c')]);}else{_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}}if(_['isNil'](_0x42146e)){_0x42146e=moment()[_0x3bc4('0x2d')](_0x5a49a3||0x3,_0x3bc4('0x2e'));}var _0x4f2551={'phone':_0x5cd153[_0x3bc4('0x2f')],'active':0x0,'OrderBy':_[_0x3bc4('0x2b')](_0x5cd153[_0x3bc4('0x1b')])?0x0:_0x5cd153['OrderBy'],'scheduledat':moment()[_0x3bc4('0x2d')](_0x32d33e||0x1,_0x3bc4('0x2e')),'countbusyretry':_0x15c697[_0x3bc4('0x22')],'countcongestionretry':_0x15c697[_0x3bc4('0x1d')],'countnoanswerretry':_0x15c697[_0x3bc4('0x23')],'countnosuchnumberretry':_0x15c697[_0x3bc4('0x1e')],'countdropretry':_0x15c697['countdropretry'],'countabandonedretry':_0x15c697['countabandonedretry'],'countmachineretry':_0x15c697[_0x3bc4('0x24')],'countagentrejectretry':_0x15c697['countagentrejectretry'],'createdAt':_0x15c697[_0x3bc4('0x30')],'updatedAt':_0x15c697['updatedAt']};var _0x1ba9a6={'CmHopperId':_0x5cd153['id'],'phone':_0x5d5160[_0x3bc4('0x2f')],'active':0x0,'OrderBy':_[_0x3bc4('0x2b')](_0x5d5160[_0x3bc4('0x1b')])?0x0:_0x5d5160[_0x3bc4('0x1b')],'scheduledat':_0x42146e,'countbusyretry':_0x5d5160[_0x3bc4('0x22')],'countcongestionretry':_0x5d5160[_0x3bc4('0x1d')],'countnoanswerretry':_0x5d5160[_0x3bc4('0x23')],'countnosuchnumberretry':_0x5d5160[_0x3bc4('0x1e')],'countdropretry':_0x5d5160['countdropretry'],'countabandonedretry':_0x5d5160[_0x3bc4('0x20')],'countmachineretry':_0x5d5160['countmachineretry'],'countagentrejectretry':_0x5d5160[_0x3bc4('0x21')],'createdAt':_0x5d5160[_0x3bc4('0x30')],'updatedAt':_0x5d5160[_0x3bc4('0x31')]};return db[_0x3bc4('0x32')][_0x3bc4('0x33')](function(_0x38d038){return db[_0x3bc4('0x28')][_0x3bc4('0x34')](_0x4f2551,{'where':{'id':_0x5d5160['id']}},{'transaction':_0x38d038})['then'](function(){return db[_0x3bc4('0x13')][_0x3bc4('0x34')](_0x1ba9a6,{'where':{'id':_0x5cd153['id']}},{'transaction':_0x38d038});});})[_0x3bc4('0x1a')](function(_0xb82764){_0x5020ab({'id':_0x5cd153['id'],'phone':_0x5d5160[_0x3bc4('0x2f')]});})[_0x3bc4('0x12')](function(_0x4a9c51){logger[_0x3bc4('0xe')](_0x3bc4('0x35'),_0x4a9c51[_0x3bc4('0x10')]);_0x3df27a({'error':_0x4a9c51[_0x3bc4('0x10')]});});});}exports[_0x3bc4('0x36')]=function(_0x1f6c82){var _0x2f68e1=this;return new Promise(function(_0x3b51a6,_0x42b0e1){return db['CmHopper']['update'](_0x1f6c82[_0x3bc4('0x16')][_0x3bc4('0x37')],{'where':{'id':_0x1f6c82[_0x3bc4('0x16')]['id']}})[_0x3bc4('0x1a')](function(_0x101dbf){_0x3b51a6(_0x101dbf);})[_0x3bc4('0x12')](function(_0x28bde7){logger[_0x3bc4('0xe')](_0x3bc4('0x36'),_0x28bde7[_0x3bc4('0x10')]);_0x42b0e1(_0x2f68e1[_0x3bc4('0xe')](0x1f4,_0x28bde7[_0x3bc4('0x10')]));});});}; \ No newline at end of file +var _0x82df=['request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','ContactId','ListId','waitTime','isNil','scheduledat','add','minutes','phone','countabandonedretry','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0x82df,0x139));var _0xf82d=function(_0x34be85,_0x1b36ef){_0x34be85=_0x34be85-0x0;var _0x1e55fe=_0x82df[_0x34be85];return _0x1e55fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf82d('0x0'));var rs=require(_0xf82d('0x1'));var fs=require('fs');var Redis=require(_0xf82d('0x2'));var db=require(_0xf82d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xf82d('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xf82d('0x5')][_0xf82d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1cafd3,_0x8dd9c3,_0x46fa3c){return new BPromise(function(_0x3f8214,_0x2df962){return client[_0xf82d('0x7')](_0x1cafd3,_0x46fa3c)[_0xf82d('0x8')](function(_0x511264){logger[_0xf82d('0x9')](_0xf82d('0xa'),_0x8dd9c3,_0xf82d('0xb'));logger[_0xf82d('0xc')](_0xf82d('0xd'),_0x8dd9c3,'request\x20sent',JSON['stringify'](_0x511264));if(_0x511264[_0xf82d('0xe')]){if(_0x511264[_0xf82d('0xe')][_0xf82d('0xf')]===0x1f4){logger['error'](_0xf82d('0xa'),_0x8dd9c3,_0x511264[_0xf82d('0xe')][_0xf82d('0x10')]);return _0x2df962(_0x511264[_0xf82d('0xe')][_0xf82d('0x10')]);}logger[_0xf82d('0xe')](_0xf82d('0xa'),_0x8dd9c3,_0x511264[_0xf82d('0xe')][_0xf82d('0x10')]);return _0x3f8214(_0x511264[_0xf82d('0xe')][_0xf82d('0x10')]);}else{logger[_0xf82d('0x9')](_0xf82d('0xa'),_0x8dd9c3,_0xf82d('0xb'));_0x3f8214(_0x511264[_0xf82d('0x11')]['message']);}})['catch'](function(_0xdbb381){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x8dd9c3,_0xdbb381);_0x2df962(_0xdbb381);});});}exports[_0xf82d('0x12')]=function(_0x5bb1d9){var _0x4ee9da=this;return new Promise(function(_0x1f56ed,_0x2b2afd){return db[_0xf82d('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x5bb1d9[_0xf82d('0x14')]['ContactId'],'ListId':_0x5bb1d9[_0xf82d('0x14')]['ListId'],'VoiceQueueId':_0x5bb1d9['body'][_0xf82d('0x15')]===undefined?null:_0x5bb1d9[_0xf82d('0x14')][_0xf82d('0x15')],'CampaignId':_0x5bb1d9[_0xf82d('0x14')]['CampaignId']===undefined?null:_0x5bb1d9[_0xf82d('0x14')][_0xf82d('0x16')]}})[_0xf82d('0x8')](function(_0x3c6a72){if(_0x3c6a72!=null){return db[_0xf82d('0x17')][_0xf82d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3c6a72['id'],'OrderBy':{'$gt':_0x3c6a72['OrderBy']}},'order':[[_0xf82d('0x19'),_0xf82d('0x1a')]]})[_0xf82d('0x8')](function(_0x1fe45d){var _0x4241cc=0x0;if(_0x1fe45d){if(_0x1fe45d[_0xf82d('0x1b')]+_0x1fe45d[_0xf82d('0x1c')]+_0x1fe45d[_0xf82d('0x1d')]+_0x1fe45d[_0xf82d('0x1e')]+_0x1fe45d[_0xf82d('0x1f')]+_0x1fe45d['countabandonedretry']+_0x1fe45d[_0xf82d('0x20')]+_0x1fe45d[_0xf82d('0x21')]<_0x5bb1d9[_0xf82d('0x22')][_0xf82d('0x23')])_0x4241cc=0x1;_0x1f56ed({'additional':_0x4241cc});}else{return db['CmHopperAdditionalPhone'][_0xf82d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x3c6a72['id']},'order':[[_0xf82d('0x19'),_0xf82d('0x1a')]]})[_0xf82d('0x8')](function(_0x5827aa){var _0x1aa45c=0x0;if(_0x5827aa){if(_0x5827aa['countbusyretry']+_0x5827aa[_0xf82d('0x1c')]+_0x5827aa[_0xf82d('0x1d')]+_0x5827aa[_0xf82d('0x1e')]+_0x5827aa[_0xf82d('0x1f')]+_0x5827aa['countabandonedretry']+_0x5827aa[_0xf82d('0x20')]+_0x5827aa[_0xf82d('0x21')]<_0x5bb1d9['entity'][_0xf82d('0x23')])_0x1aa45c=0x1;_0x1f56ed({'additional':_0x1aa45c});}else{_0x1f56ed({'additional':0x0});}})['catch'](function(_0x19e712){logger[_0xf82d('0xe')](_0xf82d('0x12'),_0x19e712[_0xf82d('0x10')]);_0x2b2afd(_0x4ee9da[_0xf82d('0xe')](0x1f4,_0x19e712['message']));});}})[_0xf82d('0x24')](function(_0x364999){logger[_0xf82d('0xe')]('VerifyAdditionalPhones',_0x364999[_0xf82d('0x10')]);_0x2b2afd(_0x4ee9da['error'](0x1f4,_0x364999[_0xf82d('0x10')]));});}else _0x1f56ed({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0xa59938){var _0x211ece=this;return new Promise(function(_0x2bdaed,_0x31565b){return db[_0xf82d('0x13')][_0xf82d('0x18')]({'raw':!![],'where':{'ContactId':_0xa59938[_0xf82d('0x14')][_0xf82d('0x25')],'ListId':_0xa59938[_0xf82d('0x14')][_0xf82d('0x26')],'VoiceQueueId':_0xa59938[_0xf82d('0x14')][_0xf82d('0x15')]===undefined?null:_0xa59938['body'][_0xf82d('0x15')],'CampaignId':_0xa59938['body']['CampaignId']===undefined?null:_0xa59938[_0xf82d('0x14')][_0xf82d('0x16')]}})['then'](function(_0x1a7087){if(_0x1a7087!=null){return db[_0xf82d('0x17')][_0xf82d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1a7087['id'],'OrderBy':{'$gte':_0x1a7087[_0xf82d('0x19')]}},'order':[[_0xf82d('0x19'),_0xf82d('0x1a')]]})[_0xf82d('0x8')](function(_0x3ea7ec){if(_0x3ea7ec)return activateAdditionalPhone(_0x1a7087,_0xa59938['body'],_0x3ea7ec,_0xa59938['duration'],_0xa59938[_0xf82d('0x27')])[_0xf82d('0x8')](function(_0x5f3b8a){_0x2bdaed(_0x5f3b8a);});else{return db[_0xf82d('0x17')][_0xf82d('0x18')]({'raw':!![],'where':{'CmHopperId':_0x1a7087['id']},'order':[[_0xf82d('0x19'),_0xf82d('0x1a')]]})[_0xf82d('0x8')](function(_0x2f4cd4){if(_0x2f4cd4)return activateAdditionalPhone(_0x1a7087,_0xa59938['body'],_0x2f4cd4,_0xa59938['duration'],_0xa59938[_0xf82d('0x27')])[_0xf82d('0x8')](function(_0x3a3ef7){_0x2bdaed(_0x3a3ef7);});else{_0x2bdaed({'id':_0x1a7087['id'],'phone':''});}})[_0xf82d('0x24')](function(_0x26f6e1){logger['error'](_0xf82d('0x12'),_0x26f6e1['message']);_0x31565b(_0x211ece[_0xf82d('0xe')](0x1f4,_0x26f6e1[_0xf82d('0x10')]));});}})[_0xf82d('0x24')](function(_0x26506b){logger[_0xf82d('0xe')]('VerifyAdditionalPhones',_0x26506b['message']);_0x31565b(_0x211ece[_0xf82d('0xe')](0x1f4,_0x26506b['message']));});}else _0x2bdaed(0x1);});});};function activateAdditionalPhone(_0x28c749,_0x43619b,_0x396732,_0x3562df,_0x4f9056){return new Promise(function(_0x4fea73,_0x4256f3){var _0x2d6d8e;if(_[_0xf82d('0x28')](_0x396732[_0xf82d('0x29')])){_0x396732[_0xf82d('0x29')]=moment();}if(moment()>moment(_0x396732[_0xf82d('0x29')])){_0x2d6d8e=moment()[_0xf82d('0x2a')](_0x4f9056||0x3,_0xf82d('0x2b'));}else{if(_0x396732[_0xf82d('0x19')]==0x0){_0x2d6d8e=moment(_0x396732[_0xf82d('0x29')]);}else{_0x2d6d8e=moment()['add'](_0x4f9056||0x3,_0xf82d('0x2b'));}}if(_[_0xf82d('0x28')](_0x2d6d8e)){_0x2d6d8e=moment()[_0xf82d('0x2a')](_0x4f9056||0x3,'minutes');}var _0x560620={'phone':_0x28c749[_0xf82d('0x2c')],'active':0x0,'OrderBy':_[_0xf82d('0x28')](_0x28c749[_0xf82d('0x19')])?0x0:_0x28c749[_0xf82d('0x19')],'scheduledat':moment()['add'](_0x3562df||0x1,_0xf82d('0x2b')),'countbusyretry':_0x43619b[_0xf82d('0x1b')],'countcongestionretry':_0x43619b['countcongestionretry'],'countnoanswerretry':_0x43619b[_0xf82d('0x1d')],'countnosuchnumberretry':_0x43619b[_0xf82d('0x1e')],'countdropretry':_0x43619b['countdropretry'],'countabandonedretry':_0x43619b[_0xf82d('0x2d')],'countmachineretry':_0x43619b['countmachineretry'],'countagentrejectretry':_0x43619b[_0xf82d('0x21')],'createdAt':_0x43619b['createdAt'],'updatedAt':_0x43619b[_0xf82d('0x2e')]};var _0x22a4fd={'CmHopperId':_0x28c749['id'],'phone':_0x396732[_0xf82d('0x2c')],'active':0x0,'OrderBy':_[_0xf82d('0x28')](_0x396732[_0xf82d('0x19')])?0x0:_0x396732[_0xf82d('0x19')],'scheduledat':_0x2d6d8e,'countbusyretry':_0x396732[_0xf82d('0x1b')],'countcongestionretry':_0x396732[_0xf82d('0x1c')],'countnoanswerretry':_0x396732[_0xf82d('0x1d')],'countnosuchnumberretry':_0x396732[_0xf82d('0x1e')],'countdropretry':_0x396732[_0xf82d('0x1f')],'countabandonedretry':_0x396732[_0xf82d('0x2d')],'countmachineretry':_0x396732[_0xf82d('0x20')],'countagentrejectretry':_0x396732['countagentrejectretry'],'createdAt':_0x396732[_0xf82d('0x2f')],'updatedAt':_0x396732[_0xf82d('0x2e')]};return db[_0xf82d('0x30')][_0xf82d('0x31')](function(_0x3d847d){return db['CmHopperAdditionalPhone'][_0xf82d('0x32')](_0x560620,{'where':{'id':_0x396732['id']}},{'transaction':_0x3d847d})[_0xf82d('0x8')](function(){return db[_0xf82d('0x13')][_0xf82d('0x32')](_0x22a4fd,{'where':{'id':_0x28c749['id']}},{'transaction':_0x3d847d});});})[_0xf82d('0x8')](function(_0xb2ab7d){_0x4fea73({'id':_0x28c749['id'],'phone':_0x396732[_0xf82d('0x2c')]});})[_0xf82d('0x24')](function(_0x116c44){logger[_0xf82d('0xe')](_0xf82d('0x33'),_0x116c44[_0xf82d('0x10')]);_0x4256f3({'error':_0x116c44[_0xf82d('0x10')]});});});}exports[_0xf82d('0x34')]=function(_0x5e746b){var _0x302758=this;return new Promise(function(_0x23bb21,_0x59049b){return db[_0xf82d('0x13')][_0xf82d('0x32')](_0x5e746b[_0xf82d('0x14')][_0xf82d('0x35')],{'where':{'id':_0x5e746b[_0xf82d('0x14')]['id']}})['then'](function(_0x3948b8){_0x23bb21(_0x3948b8);})[_0xf82d('0x24')](function(_0x47a3ba){logger[_0xf82d('0xe')](_0xf82d('0x34'),_0x47a3ba[_0xf82d('0x10')]);_0x59049b(_0x302758[_0xf82d('0xe')](0x1f4,_0x47a3ba['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e6be0b0..47e9fbe 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5346=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x5346,0x112));var _0x6534=function(_0x517e55,_0x2f9447){_0x517e55=_0x517e55-0x0;var _0x3e2f8b=_0x5346[_0x517e55];return _0x3e2f8b;};'use strict';var multer=require(_0x6534('0x0'));var util=require(_0x6534('0x1'));var path=require(_0x6534('0x2'));var timeout=require(_0x6534('0x3'));var express=require(_0x6534('0x4'));var router=express[_0x6534('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6534('0x6'));var controller=require(_0x6534('0x7'));router[_0x6534('0x8')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0xa')]);router[_0x6534('0x8')]('/:id',auth[_0x6534('0x9')](),controller['show']);router[_0x6534('0xb')]('/',auth['isAuthenticated'](),controller[_0x6534('0xc')]);router[_0x6534('0xd')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0xf')]);router[_0x6534('0x10')](_0x6534('0xe'),auth[_0x6534('0x9')](),controller[_0x6534('0x11')]);module[_0x6534('0x12')]=router; \ No newline at end of file +var _0x9fa9=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','util','path'];(function(_0x3a6820,_0x355edc){var _0x3f9d7b=function(_0x1d79e0){while(--_0x1d79e0){_0x3a6820['push'](_0x3a6820['shift']());}};_0x3f9d7b(++_0x355edc);}(_0x9fa9,0xb2));var _0x99fa=function(_0x486fe3,_0x5c07eb){_0x486fe3=_0x486fe3-0x0;var _0x4dbbb9=_0x9fa9[_0x486fe3];return _0x4dbbb9;};'use strict';var multer=require('multer');var util=require(_0x99fa('0x0'));var path=require(_0x99fa('0x1'));var timeout=require('connect-timeout');var express=require(_0x99fa('0x2'));var router=express['Router']();var fs_extra=require(_0x99fa('0x3'));var auth=require(_0x99fa('0x4'));var interaction=require(_0x99fa('0x5'));var config=require(_0x99fa('0x6'));var controller=require(_0x99fa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x99fa('0x8')]);router[_0x99fa('0x9')](_0x99fa('0xa'),auth[_0x99fa('0xb')](),controller['show']);router[_0x99fa('0xc')]('/',auth[_0x99fa('0xb')](),controller[_0x99fa('0xd')]);router[_0x99fa('0xe')](_0x99fa('0xa'),auth[_0x99fa('0xb')](),controller[_0x99fa('0xf')]);router['delete'](_0x99fa('0xa'),auth['isAuthenticated'](),controller[_0x99fa('0x10')]);module[_0x99fa('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 00501cd..304eaa7 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.attributes.js +++ b/server/api/cmHopperBlack/cmHopperBlack.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfef=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0xaf29da,_0x117f5a){var _0x295c51=function(_0x3feaf4){while(--_0x3feaf4){_0xaf29da['push'](_0xaf29da['shift']());}};_0x295c51(++_0x117f5a);}(_0xcfef,0x1cc));var _0xfcfe=function(_0x42708d,_0x251f79){_0x42708d=_0x42708d-0x0;var _0xcff127=_0xcfef[_0x42708d];return _0xcff127;};'use strict';var moment=require('moment');var Sequelize=require(_0xfcfe('0x0'));module[_0xfcfe('0x1')]={'phone':{'type':Sequelize[_0xfcfe('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xfcfe('0x3')],'unique':_0xfcfe('0x4')}}; \ No newline at end of file +var _0x6f7b=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x19ccec,_0x1306f0){var _0x2dacda=function(_0x4b816b){while(--_0x4b816b){_0x19ccec['push'](_0x19ccec['shift']());}};_0x2dacda(++_0x1306f0);}(_0x6f7b,0x168));var _0xb6f7=function(_0x13e18d,_0x27505e){_0x13e18d=_0x13e18d-0x0;var _0x2bcd5c=_0x6f7b[_0x13e18d];return _0x2bcd5c;};'use strict';var moment=require('moment');var Sequelize=require(_0xb6f7('0x0'));module[_0xb6f7('0x1')]={'phone':{'type':Sequelize[_0xb6f7('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb6f7('0x3')],'unique':_0xb6f7('0x4')},'ListId':{'type':Sequelize[_0xb6f7('0x3')],'unique':_0xb6f7('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb6f7('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 2a248cf..fa0a1a5 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.controller.js +++ b/server/api/cmHopperBlack/cmHopperBlack.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f30=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','CmHopperBlack','includeAll','include','findAll','rows','options','find','body','params','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util'];(function(_0x1225c3,_0x3f6e5b){var _0x2ff54c=function(_0x4591b8){while(--_0x4591b8){_0x1225c3['push'](_0x1225c3['shift']());}};_0x2ff54c(++_0x3f6e5b);}(_0x2f30,0xe6));var _0x02f3=function(_0x3ef247,_0x2bd5e0){_0x3ef247=_0x3ef247-0x0;var _0x46240f=_0x2f30[_0x3ef247];return _0x46240f;};'use strict';var emlformat=require(_0x02f3('0x0'));var rimraf=require(_0x02f3('0x1'));var zipdir=require(_0x02f3('0x2'));var jsonpatch=require(_0x02f3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x02f3('0x4'));var Mustache=require(_0x02f3('0x5'));var util=require(_0x02f3('0x6'));var path=require(_0x02f3('0x7'));var sox=require(_0x02f3('0x8'));var csv=require(_0x02f3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02f3('0xa'));var _=require(_0x02f3('0xb'));var squel=require(_0x02f3('0xc'));var crypto=require(_0x02f3('0xd'));var jsforce=require(_0x02f3('0xe'));var deskjs=require(_0x02f3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x02f3('0x10'));var Papa=require('papaparse');var Redis=require(_0x02f3('0x11'));var authService=require(_0x02f3('0x12'));var qs=require(_0x02f3('0x13'));var as=require(_0x02f3('0x14'));var hardwareService=require(_0x02f3('0x15'));var logger=require('../../config/logger')(_0x02f3('0x16'));var utils=require(_0x02f3('0x17'));var config=require(_0x02f3('0x18'));var licenseUtil=require(_0x02f3('0x19'));var db=require(_0x02f3('0x1a'))['db'];function respondWithStatusCode(_0x14ab6c,_0x5970fd){_0x5970fd=_0x5970fd||0xcc;return function(_0x5294ff){if(_0x5294ff){return _0x14ab6c[_0x02f3('0x1b')](_0x5970fd);}return _0x14ab6c['status'](_0x5970fd)['end']();};}function respondWithResult(_0x274ad4,_0x6a001f){_0x6a001f=_0x6a001f||0xc8;return function(_0x3fa347){if(_0x3fa347){return _0x274ad4[_0x02f3('0x1c')](_0x6a001f)[_0x02f3('0x1d')](_0x3fa347);}};}function respondWithFilteredResult(_0x1d3d1c,_0x59b100){return function(_0xb2f2e2){if(_0xb2f2e2){var _0x230718=typeof _0x59b100[_0x02f3('0x1e')]===_0x02f3('0x1f')&&typeof _0x59b100[_0x02f3('0x20')]===_0x02f3('0x1f');var _0x34eb12=_0xb2f2e2[_0x02f3('0x21')];var _0x5c7f47=_0x230718?0x0:_0x59b100[_0x02f3('0x1e')];var _0x6948ef=_0x230718?_0xb2f2e2[_0x02f3('0x21')]:_0x59b100[_0x02f3('0x1e')]+_0x59b100['limit'];var _0x5425e2;if(_0x6948ef>=_0x34eb12){_0x6948ef=_0x34eb12;_0x5425e2=0xc8;}else{_0x5425e2=0xce;}_0x1d3d1c[_0x02f3('0x1c')](_0x5425e2);return _0x1d3d1c[_0x02f3('0x22')](_0x02f3('0x23'),_0x5c7f47+'-'+_0x6948ef+'/'+_0x34eb12)['json'](_0xb2f2e2);}return null;};}function patchUpdates(_0x33db10){return function(_0x216a64){try{jsonpatch[_0x02f3('0x24')](_0x216a64,_0x33db10,!![]);}catch(_0x58ab03){return BPromise[_0x02f3('0x25')](_0x58ab03);}return _0x216a64['save']();};}function saveUpdates(_0x1fa444,_0x12b7c8){return function(_0x29fc05){if(_0x29fc05){return _0x29fc05[_0x02f3('0x26')](_0x1fa444)[_0x02f3('0x27')](function(_0x4b55dd){return _0x4b55dd;});}return null;};}function removeEntity(_0x6cd288,_0x3ff6d5){return function(_0x2638fb){if(_0x2638fb){return _0x2638fb[_0x02f3('0x28')]()[_0x02f3('0x27')](function(){_0x6cd288[_0x02f3('0x1c')](0xcc)[_0x02f3('0x29')]();});}};}function handleEntityNotFound(_0xb7e6bd,_0x2bf84d){return function(_0x16bcba){if(!_0x16bcba){_0xb7e6bd[_0x02f3('0x1b')](0x194);}return _0x16bcba;};}function handleError(_0x52f4a8,_0x190dd2){_0x190dd2=_0x190dd2||0x1f4;return function(_0x33d5f5){logger[_0x02f3('0x2a')](_0x33d5f5[_0x02f3('0x2b')]);if(_0x33d5f5[_0x02f3('0x2c')]){delete _0x33d5f5[_0x02f3('0x2c')];}_0x52f4a8[_0x02f3('0x1c')](_0x190dd2)[_0x02f3('0x2d')](_0x33d5f5);};}exports[_0x02f3('0x2e')]=function(_0x3127d8,_0x1c8c73){var _0x3d8564={},_0x3b951c={},_0x1e4b95={'count':0x0,'rows':[]};var _0x702696=_[_0x02f3('0x2f')](db['CmHopperBlack'][_0x02f3('0x30')],function(_0x449a6b){return{'name':_0x449a6b[_0x02f3('0x31')],'type':_0x449a6b['type'][_0x02f3('0x32')]};});_0x3b951c[_0x02f3('0x33')]=_['map'](_0x702696,_0x02f3('0x2c'));_0x3b951c[_0x02f3('0x34')]=_[_0x02f3('0x35')](_0x3127d8[_0x02f3('0x34')]);_0x3b951c['filters']=_[_0x02f3('0x36')](_0x3b951c['model'],_0x3b951c[_0x02f3('0x34')]);_0x3d8564['attributes']=_[_0x02f3('0x36')](_0x3b951c[_0x02f3('0x33')],qs[_0x02f3('0x37')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x37')]));_0x3d8564[_0x02f3('0x38')]=_0x3d8564[_0x02f3('0x38')][_0x02f3('0x39')]?_0x3d8564[_0x02f3('0x38')]:_0x3b951c['model'];if(!_0x3127d8['query'][_0x02f3('0x3a')](_0x02f3('0x3b'))){_0x3d8564[_0x02f3('0x20')]=qs[_0x02f3('0x20')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x20')]);_0x3d8564[_0x02f3('0x1e')]=qs[_0x02f3('0x1e')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x1e')]);}_0x3d8564[_0x02f3('0x3c')]=qs[_0x02f3('0x3d')](_0x3127d8[_0x02f3('0x34')][_0x02f3('0x3d')]);_0x3d8564[_0x02f3('0x3e')]=qs['filters'](_['pick'](_0x3127d8[_0x02f3('0x34')],_0x3b951c[_0x02f3('0x3f')]),_0x702696);if(_0x3127d8[_0x02f3('0x34')][_0x02f3('0x40')]){_0x3d8564[_0x02f3('0x3e')]=_['merge'](_0x3d8564['where'],{'$or':_[_0x02f3('0x2f')](_0x702696,function(_0x36e4cf){if(_0x36e4cf[_0x02f3('0x41')]!==_0x02f3('0x42')){var _0x8077ae={};_0x8077ae[_0x36e4cf['name']]={'$like':'%'+_0x3127d8[_0x02f3('0x34')][_0x02f3('0x40')]+'%'};return _0x8077ae;}})});}_0x3d8564=_[_0x02f3('0x43')]({},_0x3d8564,_0x3127d8['options']);var _0x22621b={'where':_0x3d8564[_0x02f3('0x3e')]};return db[_0x02f3('0x44')]['count'](_0x22621b)[_0x02f3('0x27')](function(_0x4673fa){_0x1e4b95[_0x02f3('0x21')]=_0x4673fa;if(_0x3127d8['query'][_0x02f3('0x45')]){_0x3d8564[_0x02f3('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x02f3('0x47')](_0x3d8564);})[_0x02f3('0x27')](function(_0x44e3d0){_0x1e4b95[_0x02f3('0x48')]=_0x44e3d0;return _0x1e4b95;})[_0x02f3('0x27')](respondWithFilteredResult(_0x1c8c73,_0x3d8564))['catch'](handleError(_0x1c8c73,null));};exports['show']=function(_0x7c9207,_0x297f2a){var _0xd53b68={'raw':!![],'where':{'id':_0x7c9207['params']['id']}},_0x438984={};_0x438984[_0x02f3('0x33')]=_[_0x02f3('0x35')](db['CmHopperBlack'][_0x02f3('0x30')]);_0x438984[_0x02f3('0x34')]=_[_0x02f3('0x35')](_0x7c9207[_0x02f3('0x34')]);_0x438984[_0x02f3('0x3f')]=_[_0x02f3('0x36')](_0x438984[_0x02f3('0x33')],_0x438984[_0x02f3('0x34')]);_0xd53b68['attributes']=_[_0x02f3('0x36')](_0x438984[_0x02f3('0x33')],qs[_0x02f3('0x37')](_0x7c9207[_0x02f3('0x34')][_0x02f3('0x37')]));_0xd53b68[_0x02f3('0x38')]=_0xd53b68[_0x02f3('0x38')]['length']?_0xd53b68['attributes']:_0x438984['model'];if(_0x7c9207[_0x02f3('0x34')][_0x02f3('0x45')]){_0xd53b68[_0x02f3('0x46')]=[{'all':!![]}];}_0xd53b68=_['merge']({},_0xd53b68,_0x7c9207[_0x02f3('0x49')]);return db[_0x02f3('0x44')][_0x02f3('0x4a')](_0xd53b68)[_0x02f3('0x27')](handleEntityNotFound(_0x297f2a,null))[_0x02f3('0x27')](respondWithResult(_0x297f2a,null))['catch'](handleError(_0x297f2a,null));};exports[_0x02f3('0x26')]=function(_0x277e66,_0x20ad72){if(_0x277e66[_0x02f3('0x4b')]['id']){delete _0x277e66[_0x02f3('0x4b')]['id'];}return db[_0x02f3('0x44')]['find']({'where':{'id':_0x277e66[_0x02f3('0x4c')]['id']}})[_0x02f3('0x27')](handleEntityNotFound(_0x20ad72,null))[_0x02f3('0x27')](saveUpdates(_0x277e66[_0x02f3('0x4b')],null))[_0x02f3('0x27')](respondWithResult(_0x20ad72,null))[_0x02f3('0x4d')](handleError(_0x20ad72,null));};exports[_0x02f3('0x28')]=function(_0x3e1ec2,_0x362df1){return db[_0x02f3('0x44')][_0x02f3('0x4a')]({'where':{'id':_0x3e1ec2[_0x02f3('0x4c')]['id']}})[_0x02f3('0x27')](handleEntityNotFound(_0x362df1,null))[_0x02f3('0x27')](removeEntity(_0x362df1,null))[_0x02f3('0x4d')](handleError(_0x362df1,null));};exports[_0x02f3('0x4e')]=function(_0x44d3f1,_0x507a16){return db[_0x02f3('0x44')]['describe']()['then'](respondWithResult(_0x507a16,null))[_0x02f3('0x4d')](handleError(_0x507a16,null));}; \ No newline at end of file +var _0xa9e7=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','apply','update','then','destroy','sendStatus','error','name','send','index','CmHopperBlack','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','rows','catch','show','keys','include','options','find','body','params','describe','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','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xa9e7,0x19a));var _0x7a9e=function(_0x51ee1c,_0x745d0b){_0x51ee1c=_0x51ee1c-0x0;var _0xae3914=_0xa9e7[_0x51ee1c];return _0xae3914;};'use strict';var emlformat=require(_0x7a9e('0x0'));var rimraf=require(_0x7a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a9e('0x2'));var rp=require(_0x7a9e('0x3'));var moment=require(_0x7a9e('0x4'));var BPromise=require(_0x7a9e('0x5'));var Mustache=require(_0x7a9e('0x6'));var util=require(_0x7a9e('0x7'));var path=require(_0x7a9e('0x8'));var sox=require(_0x7a9e('0x9'));var csv=require(_0x7a9e('0xa'));var ejs=require(_0x7a9e('0xb'));var fs=require('fs');var fs_extra=require(_0x7a9e('0xc'));var _=require(_0x7a9e('0xd'));var squel=require(_0x7a9e('0xe'));var crypto=require(_0x7a9e('0xf'));var jsforce=require(_0x7a9e('0x10'));var deskjs=require(_0x7a9e('0x11'));var toCsv=require(_0x7a9e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a9e('0x12'));var qs=require(_0x7a9e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a9e('0x14'));var logger=require('../../config/logger')(_0x7a9e('0x15'));var utils=require(_0x7a9e('0x16'));var config=require(_0x7a9e('0x17'));var licenseUtil=require(_0x7a9e('0x18'));var db=require(_0x7a9e('0x19'))['db'];function respondWithStatusCode(_0x4e8362,_0x2cb23d){_0x2cb23d=_0x2cb23d||0xcc;return function(_0x42abf1){if(_0x42abf1){return _0x4e8362['sendStatus'](_0x2cb23d);}return _0x4e8362['status'](_0x2cb23d)[_0x7a9e('0x1a')]();};}function respondWithResult(_0x2707e6,_0x2c540c){_0x2c540c=_0x2c540c||0xc8;return function(_0x5a9c80){if(_0x5a9c80){return _0x2707e6[_0x7a9e('0x1b')](_0x2c540c)['json'](_0x5a9c80);}};}function respondWithFilteredResult(_0x163a42,_0x281e63){return function(_0x4ec041){if(_0x4ec041){var _0x5507ad=typeof _0x281e63['offset']===_0x7a9e('0x1c')&&typeof _0x281e63[_0x7a9e('0x1d')]==='undefined';var _0x31059c=_0x4ec041['count'];var _0x132e52=_0x5507ad?0x0:_0x281e63['offset'];var _0x582c14=_0x5507ad?_0x4ec041[_0x7a9e('0x1e')]:_0x281e63[_0x7a9e('0x1f')]+_0x281e63[_0x7a9e('0x1d')];var _0x159633;if(_0x582c14>=_0x31059c){_0x582c14=_0x31059c;_0x159633=0xc8;}else{_0x159633=0xce;}_0x163a42[_0x7a9e('0x1b')](_0x159633);return _0x163a42[_0x7a9e('0x20')]('Content-Range',_0x132e52+'-'+_0x582c14+'/'+_0x31059c)['json'](_0x4ec041);}return null;};}function patchUpdates(_0x2fb698){return function(_0x507d24){try{jsonpatch[_0x7a9e('0x21')](_0x507d24,_0x2fb698,!![]);}catch(_0x2650c2){return BPromise['reject'](_0x2650c2);}return _0x507d24['save']();};}function saveUpdates(_0x41f447,_0x1a0b27){return function(_0x153d62){if(_0x153d62){return _0x153d62[_0x7a9e('0x22')](_0x41f447)[_0x7a9e('0x23')](function(_0x58d5fc){return _0x58d5fc;});}return null;};}function removeEntity(_0x393126,_0x50d9a0){return function(_0x545373){if(_0x545373){return _0x545373[_0x7a9e('0x24')]()[_0x7a9e('0x23')](function(){_0x393126[_0x7a9e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4feb26,_0x336f13){return function(_0x510d00){if(!_0x510d00){_0x4feb26[_0x7a9e('0x25')](0x194);}return _0x510d00;};}function handleError(_0x549b16,_0x584061){_0x584061=_0x584061||0x1f4;return function(_0x574899){logger[_0x7a9e('0x26')](_0x574899['stack']);if(_0x574899['name']){delete _0x574899[_0x7a9e('0x27')];}_0x549b16[_0x7a9e('0x1b')](_0x584061)[_0x7a9e('0x28')](_0x574899);};}exports[_0x7a9e('0x29')]=function(_0x433b08,_0x34db29){var _0x1f6922={},_0x33bfed={},_0x420512={'count':0x0,'rows':[]};var _0x5b9669=_['map'](db[_0x7a9e('0x2a')][_0x7a9e('0x2b')],function(_0x13a990){return{'name':_0x13a990[_0x7a9e('0x2c')],'type':_0x13a990['type'][_0x7a9e('0x2d')]};});_0x33bfed[_0x7a9e('0x2e')]=_[_0x7a9e('0x2f')](_0x5b9669,_0x7a9e('0x27'));_0x33bfed[_0x7a9e('0x30')]=_['keys'](_0x433b08['query']);_0x33bfed[_0x7a9e('0x31')]=_[_0x7a9e('0x32')](_0x33bfed['model'],_0x33bfed['query']);_0x1f6922[_0x7a9e('0x33')]=_[_0x7a9e('0x32')](_0x33bfed['model'],qs[_0x7a9e('0x34')](_0x433b08[_0x7a9e('0x30')][_0x7a9e('0x34')]));_0x1f6922['attributes']=_0x1f6922[_0x7a9e('0x33')][_0x7a9e('0x35')]?_0x1f6922[_0x7a9e('0x33')]:_0x33bfed[_0x7a9e('0x2e')];if(!_0x433b08[_0x7a9e('0x30')]['hasOwnProperty'](_0x7a9e('0x36'))){_0x1f6922[_0x7a9e('0x1d')]=qs[_0x7a9e('0x1d')](_0x433b08[_0x7a9e('0x30')][_0x7a9e('0x1d')]);_0x1f6922['offset']=qs[_0x7a9e('0x1f')](_0x433b08[_0x7a9e('0x30')][_0x7a9e('0x1f')]);}_0x1f6922['order']=qs[_0x7a9e('0x37')](_0x433b08[_0x7a9e('0x30')]['sort']);_0x1f6922[_0x7a9e('0x38')]=qs[_0x7a9e('0x31')](_['pick'](_0x433b08['query'],_0x33bfed[_0x7a9e('0x31')]),_0x5b9669);if(_0x433b08[_0x7a9e('0x30')][_0x7a9e('0x39')]){_0x1f6922[_0x7a9e('0x38')]=_[_0x7a9e('0x3a')](_0x1f6922[_0x7a9e('0x38')],{'$or':_[_0x7a9e('0x2f')](_0x5b9669,function(_0xe4f7a0){if(_0xe4f7a0[_0x7a9e('0x3b')]!==_0x7a9e('0x3c')){var _0x382453={};_0x382453[_0xe4f7a0[_0x7a9e('0x27')]]={'$like':'%'+_0x433b08[_0x7a9e('0x30')]['filter']+'%'};return _0x382453;}})});}_0x1f6922=_[_0x7a9e('0x3a')]({},_0x1f6922,_0x433b08['options']);var _0xc7dcb7={'where':_0x1f6922[_0x7a9e('0x38')]};return db[_0x7a9e('0x2a')]['count'](_0xc7dcb7)[_0x7a9e('0x23')](function(_0x5bb59b){_0x420512['count']=_0x5bb59b;if(_0x433b08['query'][_0x7a9e('0x3d')]){_0x1f6922['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1f6922);})[_0x7a9e('0x23')](function(_0x388e04){_0x420512[_0x7a9e('0x3e')]=_0x388e04;return _0x420512;})[_0x7a9e('0x23')](respondWithFilteredResult(_0x34db29,_0x1f6922))[_0x7a9e('0x3f')](handleError(_0x34db29,null));};exports[_0x7a9e('0x40')]=function(_0xa01cd,_0x5176f5){var _0x492500={'raw':!![],'where':{'id':_0xa01cd['params']['id']}},_0x5bd72f={};_0x5bd72f[_0x7a9e('0x2e')]=_[_0x7a9e('0x41')](db[_0x7a9e('0x2a')][_0x7a9e('0x2b')]);_0x5bd72f[_0x7a9e('0x30')]=_[_0x7a9e('0x41')](_0xa01cd['query']);_0x5bd72f[_0x7a9e('0x31')]=_[_0x7a9e('0x32')](_0x5bd72f['model'],_0x5bd72f[_0x7a9e('0x30')]);_0x492500[_0x7a9e('0x33')]=_[_0x7a9e('0x32')](_0x5bd72f['model'],qs[_0x7a9e('0x34')](_0xa01cd[_0x7a9e('0x30')][_0x7a9e('0x34')]));_0x492500[_0x7a9e('0x33')]=_0x492500[_0x7a9e('0x33')][_0x7a9e('0x35')]?_0x492500[_0x7a9e('0x33')]:_0x5bd72f['model'];if(_0xa01cd[_0x7a9e('0x30')][_0x7a9e('0x3d')]){_0x492500[_0x7a9e('0x42')]=[{'all':!![]}];}_0x492500=_['merge']({},_0x492500,_0xa01cd[_0x7a9e('0x43')]);return db['CmHopperBlack'][_0x7a9e('0x44')](_0x492500)[_0x7a9e('0x23')](handleEntityNotFound(_0x5176f5,null))[_0x7a9e('0x23')](respondWithResult(_0x5176f5,null))[_0x7a9e('0x3f')](handleError(_0x5176f5,null));};exports['update']=function(_0x2eb89a,_0x222462){if(_0x2eb89a[_0x7a9e('0x45')]['id']){delete _0x2eb89a[_0x7a9e('0x45')]['id'];}return db[_0x7a9e('0x2a')][_0x7a9e('0x44')]({'where':{'id':_0x2eb89a[_0x7a9e('0x46')]['id']}})[_0x7a9e('0x23')](handleEntityNotFound(_0x222462,null))[_0x7a9e('0x23')](saveUpdates(_0x2eb89a[_0x7a9e('0x45')],null))[_0x7a9e('0x23')](respondWithResult(_0x222462,null))[_0x7a9e('0x3f')](handleError(_0x222462,null));};exports[_0x7a9e('0x24')]=function(_0x4d52df,_0x4d369d){return db['CmHopperBlack'][_0x7a9e('0x44')]({'where':{'id':_0x4d52df[_0x7a9e('0x46')]['id']}})[_0x7a9e('0x23')](handleEntityNotFound(_0x4d369d,null))['then'](removeEntity(_0x4d369d,null))[_0x7a9e('0x3f')](handleError(_0x4d369d,null));};exports[_0x7a9e('0x47')]=function(_0x3eaf17,_0x2871ef){return db[_0x7a9e('0x2a')][_0x7a9e('0x47')]()[_0x7a9e('0x23')](respondWithResult(_0x2871ef,null))['catch'](handleError(_0x2871ef,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3ebacb8..27843df 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.model.js +++ b/server/api/cmHopperBlack/cmHopperBlack.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce67=['../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x52617,_0x12f9a){var _0x416cb9=function(_0x18638d){while(--_0x18638d){_0x52617['push'](_0x52617['shift']());}};_0x416cb9(++_0x12f9a);}(_0xce67,0xae));var _0x7ce6=function(_0x473388,_0x2d6d57){_0x473388=_0x473388-0x0;var _0x2f7f62=_0xce67[_0x473388];return _0x2f7f62;};'use strict';var _=require(_0x7ce6('0x0'));var util=require('util');var logger=require(_0x7ce6('0x1'))(_0x7ce6('0x2'));var moment=require(_0x7ce6('0x3'));var BPromise=require(_0x7ce6('0x4'));var rp=require(_0x7ce6('0x5'));var fs=require('fs');var path=require(_0x7ce6('0x6'));var rimraf=require(_0x7ce6('0x7'));var config=require(_0x7ce6('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x7ce6('0x9')]=function(_0x5c7c7a,_0x484a4d){return _0x5c7c7a[_0x7ce6('0xa')](_0x7ce6('0xb'),attributes,{'tableName':_0x7ce6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29f8=['api','moment','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','../../config/logger'];(function(_0x1772fb,_0x3eeb99){var _0x1b899a=function(_0x5be58b){while(--_0x5be58b){_0x1772fb['push'](_0x1772fb['shift']());}};_0x1b899a(++_0x3eeb99);}(_0x29f8,0x106));var _0x829f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x29f8[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x829f('0x0'));var util=require('util');var logger=require(_0x829f('0x1'))(_0x829f('0x2'));var moment=require(_0x829f('0x3'));var BPromise=require(_0x829f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x829f('0x5'));var rimraf=require(_0x829f('0x6'));var config=require('../../config/environment');var attributes=require(_0x829f('0x7'));module[_0x829f('0x8')]=function(_0x4e04ca,_0x56795b){return _0x4e04ca[_0x829f('0x9')]('CmHopperBlack',attributes,{'tableName':_0x829f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 9389e7a..b0fe9ab 100644 --- a/server/api/cmHopperBlack/cmHopperBlack.rpc.js +++ b/server/api/cmHopperBlack/cmHopperBlack.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a81=['UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','catch','update','body'];(function(_0xdfa934,_0x44cf3b){var _0xd3964b=function(_0x1a04a5){while(--_0x1a04a5){_0xdfa934['push'](_0xdfa934['shift']());}};_0xd3964b(++_0x44cf3b);}(_0x8a81,0x175));var _0x18a8=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8a81[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x18a8('0x0'));var util=require(_0x18a8('0x1'));var moment=require('moment');var BPromise=require(_0x18a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18a8('0x3'));var db=require(_0x18a8('0x4'))['db'];var utils=require(_0x18a8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x18a8('0x6'));var jayson=require(_0x18a8('0x7'));var client=jayson[_0x18a8('0x8')][_0x18a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45db18,_0x3f94ca,_0x259a45){return new BPromise(function(_0x5a41db,_0x4bec1b){return client[_0x18a8('0xa')](_0x45db18,_0x259a45)[_0x18a8('0xb')](function(_0x4c997f){logger[_0x18a8('0xc')](_0x18a8('0xd'),_0x3f94ca,_0x18a8('0xe'));logger[_0x18a8('0xf')](_0x18a8('0x10'),_0x3f94ca,_0x18a8('0xe'),JSON[_0x18a8('0x11')](_0x4c997f));if(_0x4c997f['error']){if(_0x4c997f['error']['code']===0x1f4){logger[_0x18a8('0x12')](_0x18a8('0xd'),_0x3f94ca,_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);return _0x4bec1b(_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);}logger[_0x18a8('0x12')](_0x18a8('0xd'),_0x3f94ca,_0x4c997f['error'][_0x18a8('0x13')]);return _0x5a41db(_0x4c997f[_0x18a8('0x12')][_0x18a8('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3f94ca,'request\x20sent');_0x5a41db(_0x4c997f[_0x18a8('0x14')][_0x18a8('0x13')]);}})['catch'](function(_0x530113){logger[_0x18a8('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3f94ca,_0x530113);_0x4bec1b(_0x530113);});});}exports[_0x18a8('0x15')]=function(_0x7bc251){var _0x3a3048=this;return new Promise(function(_0x1ac5db,_0x13e146){return db[_0x18a8('0x16')]['findAll']({'raw':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x18')]===undefined?!![]:![]:!![],'where':_0x7bc251[_0x18a8('0x17')]?_0x7bc251['options'][_0x18a8('0x19')]||null:null,'attributes':_0x7bc251[_0x18a8('0x17')]?_0x7bc251['options'][_0x18a8('0x1a')]||null:null,'limit':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1b')]||null:null,'include':_0x7bc251[_0x18a8('0x17')]?_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1c')]?_[_0x18a8('0x1d')](_0x7bc251[_0x18a8('0x17')][_0x18a8('0x1c')],function(_0x3a0648){return{'model':db[_0x3a0648['model']],'as':_0x3a0648['as'],'attributes':_0x3a0648['attributes'],'include':_0x3a0648[_0x18a8('0x1c')]?_[_0x18a8('0x1d')](_0x3a0648[_0x18a8('0x1c')],function(_0x389dd6){return{'model':db[_0x389dd6[_0x18a8('0x1e')]],'as':_0x389dd6['as'],'attributes':_0x389dd6[_0x18a8('0x1a')],'include':_0x389dd6['include']?_['map'](_0x389dd6[_0x18a8('0x1c')],function(_0x2e6c1d){return{'model':db[_0x2e6c1d[_0x18a8('0x1e')]],'as':_0x2e6c1d['as'],'attributes':_0x2e6c1d[_0x18a8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x18a8('0xb')](function(_0x4edc73){logger[_0x18a8('0xc')](_0x18a8('0x15'),_0x7bc251);logger[_0x18a8('0xf')]('GetCmHopperBlack',_0x7bc251,JSON[_0x18a8('0x11')](_0x4edc73));_0x1ac5db(_0x4edc73);})[_0x18a8('0x1f')](function(_0x5534b7){logger[_0x18a8('0x12')](_0x18a8('0x15'),_0x5534b7[_0x18a8('0x13')],_0x7bc251);_0x13e146(_0x3a3048[_0x18a8('0x12')](0x1f4,_0x5534b7[_0x18a8('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x345471){var _0x3739ba=this;return new Promise(function(_0x45404b,_0x441b9c){return db[_0x18a8('0x16')][_0x18a8('0x20')](_0x345471[_0x18a8('0x21')],{'raw':_0x345471[_0x18a8('0x17')]?_0x345471['options'][_0x18a8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345471['options']?_0x345471[_0x18a8('0x17')][_0x18a8('0x19')]||null:null,'attributes':_0x345471[_0x18a8('0x17')]?_0x345471[_0x18a8('0x17')][_0x18a8('0x1a')]||null:null,'limit':_0x345471[_0x18a8('0x17')]?_0x345471[_0x18a8('0x17')][_0x18a8('0x1b')]||null:null})['then'](function(_0x2b2cb6){logger[_0x18a8('0xc')](_0x18a8('0x22'),_0x345471);logger[_0x18a8('0xf')](_0x18a8('0x22'),_0x345471,JSON['stringify'](_0x2b2cb6));_0x45404b(_0x2b2cb6);})[_0x18a8('0x1f')](function(_0x73cce8){logger['error'](_0x18a8('0x22'),_0x73cce8[_0x18a8('0x13')],_0x345471);_0x441b9c(_0x3739ba['error'](0x1f4,_0x73cce8[_0x18a8('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3d14b2){var _0xa4b151=this;return new Promise(function(_0x5c74ab,_0x36d331){return db[_0x18a8('0x16')][_0x18a8('0x23')]({'where':_0x3d14b2[_0x18a8('0x17')]?_0x3d14b2[_0x18a8('0x17')][_0x18a8('0x19')]||null:null})['then'](function(_0x159601){logger[_0x18a8('0xc')](_0x18a8('0x24'),_0x3d14b2);logger['debug']('DestroyCmHopperBlack',_0x3d14b2,JSON[_0x18a8('0x11')](_0x159601));_0x5c74ab(_0x159601);})[_0x18a8('0x1f')](function(_0x22e333){logger[_0x18a8('0x12')](_0x18a8('0x24'),_0x22e333[_0x18a8('0x13')],_0x3d14b2);_0x36d331(_0xa4b151[_0x18a8('0x12')](0x1f4,_0x22e333['message']));});});}; \ No newline at end of file +var _0x05c6=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','include','model','map','info','UpdateCmHopperBlack','body','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d544b,_0x11cd25){var _0x55034e=function(_0x5d1135){while(--_0x5d1135){_0x5d544b['push'](_0x5d544b['shift']());}};_0x55034e(++_0x11cd25);}(_0x05c6,0xef));var _0x605c=function(_0x439b26,_0xeed311){_0x439b26=_0x439b26-0x0;var _0x3874ac=_0x05c6[_0x439b26];return _0x3874ac;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var moment=require(_0x605c('0x2'));var BPromise=require(_0x605c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x605c('0x4'));var db=require(_0x605c('0x5'))['db'];var utils=require(_0x605c('0x6'));var logger=require(_0x605c('0x7'))(_0x605c('0x8'));var config=require('../../config/environment');var jayson=require(_0x605c('0x9'));var client=jayson['client'][_0x605c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b1806,_0x3034db,_0x9292dd){return new BPromise(function(_0x23df27,_0x5b7496){return client['request'](_0x1b1806,_0x9292dd)[_0x605c('0xb')](function(_0x477db7){logger['info'](_0x605c('0xc'),_0x3034db,_0x605c('0xd'));logger[_0x605c('0xe')](_0x605c('0xf'),_0x3034db,'request\x20sent',JSON[_0x605c('0x10')](_0x477db7));if(_0x477db7['error']){if(_0x477db7[_0x605c('0x11')][_0x605c('0x12')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3034db,_0x477db7[_0x605c('0x11')][_0x605c('0x13')]);return _0x5b7496(_0x477db7[_0x605c('0x11')][_0x605c('0x13')]);}logger['error'](_0x605c('0xc'),_0x3034db,_0x477db7[_0x605c('0x11')][_0x605c('0x13')]);return _0x23df27(_0x477db7['error'][_0x605c('0x13')]);}else{logger['info'](_0x605c('0xc'),_0x3034db,_0x605c('0xd'));_0x23df27(_0x477db7[_0x605c('0x14')][_0x605c('0x13')]);}})[_0x605c('0x15')](function(_0x2a66d9){logger[_0x605c('0x11')](_0x605c('0xc'),_0x3034db,_0x2a66d9);_0x5b7496(_0x2a66d9);});});}exports[_0x605c('0x16')]=function(_0x1d0cf5){var _0x1019e6=this;return new Promise(function(_0x3f1d05,_0x538ab9){return db[_0x605c('0x17')][_0x605c('0x18')]({'raw':_0x1d0cf5['options']?_0x1d0cf5[_0x605c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1d0cf5[_0x605c('0x19')]?_0x1d0cf5['options'][_0x605c('0x1a')]||null:null,'attributes':_0x1d0cf5[_0x605c('0x19')]?_0x1d0cf5[_0x605c('0x19')][_0x605c('0x1b')]||null:null,'limit':_0x1d0cf5['options']?_0x1d0cf5['options']['limit']||null:null,'include':_0x1d0cf5[_0x605c('0x19')]?_0x1d0cf5[_0x605c('0x19')][_0x605c('0x1c')]?_['map'](_0x1d0cf5[_0x605c('0x19')][_0x605c('0x1c')],function(_0x372639){return{'model':db[_0x372639[_0x605c('0x1d')]],'as':_0x372639['as'],'attributes':_0x372639['attributes'],'include':_0x372639['include']?_['map'](_0x372639[_0x605c('0x1c')],function(_0x18ad41){return{'model':db[_0x18ad41[_0x605c('0x1d')]],'as':_0x18ad41['as'],'attributes':_0x18ad41[_0x605c('0x1b')],'include':_0x18ad41['include']?_[_0x605c('0x1e')](_0x18ad41[_0x605c('0x1c')],function(_0x10b2a3){return{'model':db[_0x10b2a3[_0x605c('0x1d')]],'as':_0x10b2a3['as'],'attributes':_0x10b2a3[_0x605c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27356d){logger[_0x605c('0x1f')](_0x605c('0x16'),_0x1d0cf5);logger[_0x605c('0xe')](_0x605c('0x16'),_0x1d0cf5,JSON[_0x605c('0x10')](_0x27356d));_0x3f1d05(_0x27356d);})[_0x605c('0x15')](function(_0x54242d){logger['error'](_0x605c('0x16'),_0x54242d[_0x605c('0x13')],_0x1d0cf5);_0x538ab9(_0x1019e6[_0x605c('0x11')](0x1f4,_0x54242d['message']));});});};exports[_0x605c('0x20')]=function(_0x1335c5){var _0x345fab=this;return new Promise(function(_0x29881e,_0x55dd7e){return db['CmHopperBlack']['update'](_0x1335c5[_0x605c('0x21')],{'raw':_0x1335c5[_0x605c('0x19')]?_0x1335c5[_0x605c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1335c5[_0x605c('0x19')]?_0x1335c5[_0x605c('0x19')][_0x605c('0x1a')]||null:null,'attributes':_0x1335c5[_0x605c('0x19')]?_0x1335c5[_0x605c('0x19')][_0x605c('0x1b')]||null:null,'limit':_0x1335c5[_0x605c('0x19')]?_0x1335c5[_0x605c('0x19')][_0x605c('0x22')]||null:null})[_0x605c('0xb')](function(_0x1d90db){logger[_0x605c('0x1f')]('UpdateCmHopperBlack',_0x1335c5);logger['debug'](_0x605c('0x20'),_0x1335c5,JSON[_0x605c('0x10')](_0x1d90db));_0x29881e(_0x1d90db);})[_0x605c('0x15')](function(_0x1de068){logger[_0x605c('0x11')]('UpdateCmHopperBlack',_0x1de068[_0x605c('0x13')],_0x1335c5);_0x55dd7e(_0x345fab[_0x605c('0x11')](0x1f4,_0x1de068[_0x605c('0x13')]));});});};exports[_0x605c('0x23')]=function(_0x57cb29){var _0x1bddbf=this;return new Promise(function(_0x4e5463,_0x57e39d){return db[_0x605c('0x17')][_0x605c('0x24')]({'where':_0x57cb29[_0x605c('0x19')]?_0x57cb29[_0x605c('0x19')][_0x605c('0x1a')]||null:null})[_0x605c('0xb')](function(_0x15d920){logger['info'](_0x605c('0x23'),_0x57cb29);logger[_0x605c('0xe')](_0x605c('0x23'),_0x57cb29,JSON[_0x605c('0x10')](_0x15d920));_0x4e5463(_0x15d920);})['catch'](function(_0x5a24af){logger[_0x605c('0x11')](_0x605c('0x23'),_0x5a24af[_0x605c('0x13')],_0x57cb29);_0x57e39d(_0x1bddbf[_0x605c('0x11')](0x1f4,_0x5a24af['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index f3258f4..d31aca8 100644 --- a/server/api/cmHopperBlack/index.js +++ b/server/api/cmHopperBlack/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90b1=['index','get','/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7860f6,_0x3c20a4){var _0x4bef84=function(_0x52749f){while(--_0x52749f){_0x7860f6['push'](_0x7860f6['shift']());}};_0x4bef84(++_0x3c20a4);}(_0x90b1,0x1bb));var _0x190b=function(_0x1bce53,_0x252ee8){_0x1bce53=_0x1bce53-0x0;var _0x3b13b1=_0x90b1[_0x1bce53];return _0x3b13b1;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var fs_extra=require(_0x190b('0x4'));var auth=require(_0x190b('0x5'));var interaction=require(_0x190b('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x190b('0x7')]);router[_0x190b('0x8')](_0x190b('0x9'),auth[_0x190b('0xa')](),controller[_0x190b('0xb')]);router[_0x190b('0x8')](_0x190b('0xc'),auth['isAuthenticated'](),controller[_0x190b('0xd')]);router[_0x190b('0xe')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller[_0x190b('0xf')]);router[_0x190b('0x10')](_0x190b('0xc'),auth[_0x190b('0xa')](),controller['destroy']);module[_0x190b('0x11')]=router; \ No newline at end of file +var _0xdf55=['../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','delete','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x3b3017,_0x531959){var _0xd8fd8d=function(_0x537d8f){while(--_0x537d8f){_0x3b3017['push'](_0x3b3017['shift']());}};_0xd8fd8d(++_0x531959);}(_0xdf55,0x83));var _0x5df5=function(_0x463183,_0x56bd4e){_0x463183=_0x463183-0x0;var _0xd5fe56=_0xdf55[_0x463183];return _0xd5fe56;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var fs_extra=require(_0x5df5('0x4'));var auth=require(_0x5df5('0x5'));var interaction=require(_0x5df5('0x6'));var config=require('../../config/environment');var controller=require(_0x5df5('0x7'));router[_0x5df5('0x8')]('/',auth[_0x5df5('0x9')](),controller[_0x5df5('0xa')]);router[_0x5df5('0x8')](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xc')]);router['get'](_0x5df5('0xd'),auth[_0x5df5('0x9')](),controller[_0x5df5('0xe')]);router['put']('/:id',auth[_0x5df5('0x9')](),controller['update']);router[_0x5df5('0xf')](_0x5df5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5df5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c14a0d4..91ed858 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.attributes.js +++ b/server/api/cmHopperFinal/cmHopperFinal.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9ff=['moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xc9ff,0x197));var _0xfc9f=function(_0x434562,_0x56b240){_0x434562=_0x434562-0x0;var _0x234e13=_0xc9ff[_0x434562];return _0x234e13;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfc9f('0x0'));module[_0xfc9f('0x1')]={'state':{'type':Sequelize[_0xfc9f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfc9f('0x3')]},'scheduledat':{'type':Sequelize[_0xfc9f('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc9f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xfc9f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfc9f('0x3')]},'calleridname':{'type':Sequelize[_0xfc9f('0x3')]},'starttime':{'type':Sequelize[_0xfc9f('0x4')]},'responsetime':{'type':Sequelize[_0xfc9f('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xfc9f('0x4')]},'endtime':{'type':Sequelize[_0xfc9f('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc9f('0x3')]},'campaign':{'type':Sequelize[_0xfc9f('0x3')]},'campaigntype':{'type':Sequelize[_0xfc9f('0x3')]},'membername':{'type':Sequelize[_0xfc9f('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xfc9f('0x3')]},'secondDisposition':{'type':Sequelize[_0xfc9f('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfc9f('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x191026){var _0x145630=this[_0xfc9f('0x5')](_0xfc9f('0x6'));if(_0x145630&&_0x191026){this[_0xfc9f('0x7')](_0xfc9f('0x8'),moment(_0x191026)[_0xfc9f('0x9')](moment(_0x145630),'seconds'));}}},'amd':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xfc9f('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc9f('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xfc9f('0x4')]},'recallme':{'type':Sequelize[_0xfc9f('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xfc9f('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc9f('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x45f5=['followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue'];(function(_0x6652a1,_0x1c814c){var _0x4fee9a=function(_0x557657){while(--_0x557657){_0x6652a1['push'](_0x6652a1['shift']());}};_0x4fee9a(++_0x1c814c);}(_0x45f5,0x178));var _0x545f=function(_0x142be6,_0x55f613){_0x142be6=_0x142be6-0x0;var _0x3630d9=_0x45f5[_0x142be6];return _0x3630d9;};'use strict';var Sequelize=require(_0x545f('0x0'));var moment=require(_0x545f('0x1'));module[_0x545f('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x545f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x545f('0x4')]},'calleridnum':{'type':Sequelize[_0x545f('0x4')]},'calleridname':{'type':Sequelize[_0x545f('0x4')]},'starttime':{'type':Sequelize[_0x545f('0x5')]},'responsetime':{'type':Sequelize[_0x545f('0x5')]},'answertime':{'type':Sequelize[_0x545f('0x5')]},'droptime':{'type':Sequelize[_0x545f('0x5')]},'endtime':{'type':Sequelize[_0x545f('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x545f('0x4')]},'campaign':{'type':Sequelize[_0x545f('0x4')]},'campaigntype':{'type':Sequelize[_0x545f('0x4')]},'membername':{'type':Sequelize[_0x545f('0x4')]},'reason':{'type':Sequelize[_0x545f('0x4')]},'disposition':{'type':Sequelize[_0x545f('0x4')]},'secondDisposition':{'type':Sequelize[_0x545f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x545f('0x4')]},'dispositionat':{'type':Sequelize[_0x545f('0x5')],'set':function(_0x41437c){var _0x1688a8=this['getDataValue'](_0x545f('0x6'));if(_0x1688a8&&_0x41437c){this[_0x545f('0x7')](_0x545f('0x8'),moment(_0x41437c)[_0x545f('0x9')](moment(_0x1688a8),_0x545f('0xa')));}}},'amd':{'type':Sequelize[_0x545f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x545f('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x545f('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x545f('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x545f('0x5')]},'callback':{'type':Sequelize[_0x545f('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x545f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x545f('0x5')]},'deleted':{'type':Sequelize[_0x545f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x545f('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x545f('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x545f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 581b761..fe23483 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x2b0267,_0x59cab1){var _0x289a4a=function(_0x3ec45c){while(--_0x3ec45c){_0x2b0267['push'](_0x2b0267['shift']());}};_0x289a4a(++_0x59cab1);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file +var _0x57ca=['state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','toString','group','moveContactsIvrCampaignHopperFinal','scheduledAt','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','from','state\x20=\x204','checkContactHopper','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperFinal','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x32d2ec,_0x5a85ef){var _0xea3171=function(_0x154b66){while(--_0x154b66){_0x32d2ec['push'](_0x32d2ec['shift']());}};_0xea3171(++_0x5a85ef);}(_0x57ca,0x108));var _0xa57c=function(_0x1a12bd,_0x52fe61){_0x1a12bd=_0x1a12bd-0x0;var _0x49c87f=_0x57ca[_0x1a12bd];return _0x49c87f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':!![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')]()['then'](respondWithResult(_0x44ea0a,null))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x5082ef,_0x232675){if(_0x5082ef['body'][_0xa57c('0x42')]){delete _0x5082ef[_0xa57c('0x43')]['uniqueid'];}return db[_0xa57c('0x2a')][_0xa57c('0x3f')]({'where':{'uniqueid':_0x5082ef[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x232675,null))[_0xa57c('0x21')](saveUpdates(_0x5082ef['body'],null))[_0xa57c('0x21')](respondWithResult(_0x232675,null))[_0xa57c('0x40')](handleError(_0x232675,null));};exports[_0xa57c('0x44')]=function(_0xd57bac,_0x2e4b84,_0x5ace6d){return db[_0xa57c('0x2a')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0xd57bac['params']['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize']['literal'](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4a')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x4b')))),_0xa57c('0x4c')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),_0xa57c('0x4f')],[db['sequelize']['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db['sequelize']['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0x2e4b84,null))['then'](respondWithResult(_0x2e4b84,null))[_0xa57c('0x40')](handleError(_0x2e4b84,null));};exports[_0xa57c('0x56')]=function(_0x1899ad,_0xb19d93,_0x2adcf6){return db[_0xa57c('0x2a')][_0xa57c('0x3d')]({'raw':![],'where':{'CampaignId':_0x1899ad[_0xa57c('0x3e')]['id']},'attributes':[[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x47')))),_0xa57c('0x48')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0xa57c('0x57')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4b')))),'busyContacts'],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db['sequelize'][_0xa57c('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0xa57c('0x4d')],[db[_0xa57c('0x45')]['fn']('COUNT',db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x4e')))),'dropContacts'],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x50')))),_0xa57c('0x51')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db[_0xa57c('0x45')]['fn']('IF',db[_0xa57c('0x45')][_0xa57c('0x49')](_0xa57c('0x52')))),_0xa57c('0x53')],[db[_0xa57c('0x45')]['fn'](_0xa57c('0x46'),db['sequelize']['fn']('IF',db[_0xa57c('0x45')]['literal'](_0xa57c('0x54')))),_0xa57c('0x55')]]})[_0xa57c('0x21')](handleEntityNotFound(_0xb19d93,null))['then'](respondWithResult(_0xb19d93,null))[_0xa57c('0x40')](handleError(_0xb19d93,null));};exports[_0xa57c('0x58')]=function(_0x1be631,_0x47e3d5,_0x571e10){return db[_0xa57c('0x59')][_0xa57c('0x3f')]({'where':{'id':_0x1be631[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x47e3d5,null))[_0xa57c('0x21')](function(_0x39411b){var _0x2a7aab;if(_0x39411b){_0x2a7aab=squel[_0xa57c('0x5a')]()[_0xa57c('0x5b')]('cm_hopper')[_0xa57c('0x5c')]([_0xa57c('0x5d'),'scheduledAt',_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62')],squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x65'),'phone')[_0xa57c('0x64')](_0xa57c('0x66'),'scheduledAt')[_0xa57c('0x64')](_0xa57c('0x67'),'ContactId')['field'](_0xa57c('0x68'),_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x69'),_0xa57c('0x60'))['field'](_0xa57c('0x66'),_0xa57c('0x61'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x62'))['from'](_0xa57c('0x6a'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1be631[_0xa57c('0x43')][_0xa57c('0x6d')]['toString']())[_0xa57c('0x37')](_0xa57c('0x6e'))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()[_0xa57c('0x64')](_0xa57c('0x5d'))['from'](_0xa57c('0x6f'))[_0xa57c('0x37')](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id']['toString']()))[_0xa57c('0x37')](_0xa57c('0x70'),squel['select']()[_0xa57c('0x64')](_0xa57c('0x71'))['from'](_0xa57c('0x6a'))['where'](_0xa57c('0x6b'),_0x1be631[_0xa57c('0x3e')]['id'][_0xa57c('0x72')]())[_0xa57c('0x37')]('state\x20=\x204'))[_0xa57c('0x73')](_0xa57c('0x5e')))[_0xa57c('0x72')]();return db[_0xa57c('0x45')][_0xa57c('0x2e')](_0x2a7aab);}return[];})[_0xa57c('0x21')](respondWithResult(_0x47e3d5,null))[_0xa57c('0x40')](handleError(_0x47e3d5,null));};exports[_0xa57c('0x74')]=function(_0x1129f,_0x2c4e6c,_0x46dbb1){return db['Campaign']['find']({'where':{'id':_0x1129f['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x2c4e6c,null))['then'](function(_0x43c430){var _0x442dc7;if(_0x43c430){_0x442dc7=squel[_0xa57c('0x5a')]()['into'](_0xa57c('0x6f'))[_0xa57c('0x5c')]([_0xa57c('0x5d'),_0xa57c('0x75'),_0xa57c('0x5e'),_0xa57c('0x5f'),_0xa57c('0x76'),'createdAt',_0xa57c('0x62')],squel[_0xa57c('0x63')]()['field']('ANY_VALUE(calleridnum)',_0xa57c('0x5d'))[_0xa57c('0x64')]('NOW()','scheduledAt')[_0xa57c('0x64')]('ANY_VALUE(ContactId)',_0xa57c('0x5e'))[_0xa57c('0x64')]('ANY_VALUE(ListId)',_0xa57c('0x5f'))[_0xa57c('0x64')](_0xa57c('0x77'),_0xa57c('0x76'))[_0xa57c('0x64')]('NOW()',_0xa57c('0x61'))['field'](_0xa57c('0x66'),_0xa57c('0x62'))['from']('cm_hopper_final')['where'](_0xa57c('0x78'),_0x1129f['params']['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x6c'),_0x1129f[_0xa57c('0x43')]['state'][_0xa57c('0x72')]())[_0xa57c('0x37')](_0xa57c('0x6e'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xa57c('0x63')]()['field'](_0xa57c('0x5d'))[_0xa57c('0x79')]('cm_hopper')[_0xa57c('0x37')]('CampaignId\x20=\x20?',_0x1129f['params']['id']['toString']()))[_0xa57c('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa57c('0x71'))[_0xa57c('0x79')]('cm_hopper_final')[_0xa57c('0x37')](_0xa57c('0x78'),_0x1129f[_0xa57c('0x3e')]['id']['toString']())[_0xa57c('0x37')](_0xa57c('0x7a')))[_0xa57c('0x73')](_0xa57c('0x5e')))['toString']();return db['sequelize'][_0xa57c('0x2e')](_0x442dc7);}return[];})['then'](respondWithResult(_0x2c4e6c,null))[_0xa57c('0x40')](handleError(_0x2c4e6c,null));};exports[_0xa57c('0x7b')]=function(_0x2cc12b,_0x4dc6ac,_0x138c4e){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x2cc12b[_0xa57c('0x43')]['VoiceQueueId'],'CampaignId':_0x2cc12b[_0xa57c('0x43')][_0xa57c('0x76')],'ContactId':_0x2cc12b['body']['ContactId']}})[_0xa57c('0x21')](handleEntityNotFound(_0x4dc6ac,null))[_0xa57c('0x21')](function(_0x50a940){if(_0x50a940){return _0x50a940;}return null;})['then'](respondWithResult(_0x4dc6ac,null))[_0xa57c('0x40')](handleError(_0x4dc6ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 449da26..3e8f0a8 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.model.js +++ b/server/api/cmHopperFinal/cmHopperFinal.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x962e=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x43c001,_0x5a4fed){var _0x2741e7=function(_0xd61a0f){while(--_0xd61a0f){_0x43c001['push'](_0x43c001['shift']());}};_0x2741e7(++_0x5a4fed);}(_0x962e,0x1bd));var _0xe962=function(_0x2958f8,_0x1b8fda){_0x2958f8=_0x2958f8-0x0;var _0x1a02c0=_0x962e[_0x2958f8];return _0x1a02c0;};'use strict';var _=require(_0xe962('0x0'));var util=require(_0xe962('0x1'));var logger=require(_0xe962('0x2'))(_0xe962('0x3'));var moment=require('moment');var BPromise=require(_0xe962('0x4'));var rp=require(_0xe962('0x5'));var fs=require('fs');var path=require(_0xe962('0x6'));var rimraf=require(_0xe962('0x7'));var config=require(_0xe962('0x8'));var attributes=require(_0xe962('0x9'));module[_0xe962('0xa')]=function(_0x5d81d3,_0x843055){return _0x5d81d3[_0xe962('0xb')](_0xe962('0xc'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe962('0xd'),'fields':[_0xe962('0xd')]},{'name':_0xe962('0xe'),'fields':[_0xe962('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb135=['api','moment','request-promise','rimraf','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x2813db,_0x244eb9){var _0x544698=function(_0x122782){while(--_0x122782){_0x2813db['push'](_0x2813db['shift']());}};_0x544698(++_0x244eb9);}(_0xb135,0x169));var _0x5b13=function(_0xdb14a1,_0x322408){_0xdb14a1=_0xdb14a1-0x0;var _0x193d21=_0xb135[_0xdb14a1];return _0x193d21;};'use strict';var _=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var logger=require(_0x5b13('0x2'))(_0x5b13('0x3'));var moment=require(_0x5b13('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b13('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b13('0x6'));var config=require(_0x5b13('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x5b13('0x8')]=function(_0x341292,_0x1f5a8f){return _0x341292[_0x5b13('0x9')](_0x5b13('0xa'),attributes,{'tableName':_0x5b13('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x5b13('0xc')]},{'name':_0x5b13('0xd'),'fields':[_0x5b13('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8c2574d..a9ee82f 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x559294,_0x37aa97){var _0x52d0d2=function(_0x1b4ef1){while(--_0x1b4ef1){_0x559294['push'](_0x559294['shift']());}};_0x52d0d2(++_0x37aa97);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xb10b[_0x4c1ec2];return _0x3f6f1c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5ebe11,_0x3ec5bd){var _0x35fb03=function(_0x39ba5a){while(--_0x39ba5a){_0x5ebe11['push'](_0x5ebe11['shift']());}};_0x35fb03(++_0x3ec5bd);}(_0x7a54,0x106));var _0x47a5=function(_0x3ba78c,_0x17e5e1){_0x3ba78c=_0x3ba78c-0x0;var _0x7cfae9=_0x7a54[_0x3ba78c];return _0x7cfae9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2904153..d1f5717 100644 --- a/server/api/cmHopperFinal/index.js +++ b/server/api/cmHopperFinal/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e56=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','put','update','multer','util','connect-timeout','express','fs-extra'];(function(_0x35fc69,_0x5782b3){var _0x512adf=function(_0x450820){while(--_0x450820){_0x35fc69['push'](_0x35fc69['shift']());}};_0x512adf(++_0x5782b3);}(_0x0e56,0xf5));var _0x60e5=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0x0e56[_0x19c5f2];return _0xb94caf;};'use strict';var multer=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var path=require('path');var timeout=require(_0x60e5('0x2'));var express=require(_0x60e5('0x3'));var router=express['Router']();var fs_extra=require(_0x60e5('0x4'));var auth=require(_0x60e5('0x5'));var interaction=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var controller=require(_0x60e5('0x8'));router[_0x60e5('0x9')]('/',auth[_0x60e5('0xa')](),controller['index']);router[_0x60e5('0x9')](_0x60e5('0xb'),auth[_0x60e5('0xa')](),controller[_0x60e5('0xc')]);router['get'](_0x60e5('0xd'),auth[_0x60e5('0xa')](),controller[_0x60e5('0xe')]);router[_0x60e5('0x9')](_0x60e5('0xf'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x10')]);router[_0x60e5('0x9')](_0x60e5('0x11'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x12')]);router[_0x60e5('0x13')](_0x60e5('0x14'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x15')]);router[_0x60e5('0x13')]('/voice/campaign/moveContacts/:id',auth[_0x60e5('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x60e5('0x16'),auth[_0x60e5('0xa')](),controller['checkContactHopper']);router[_0x60e5('0x17')](_0x60e5('0xd'),auth[_0x60e5('0xa')](),controller[_0x60e5('0x18')]);module['exports']=router; \ No newline at end of file +var _0xeeeb=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x137ad6,_0x48589b){var _0x52f0d4=function(_0x8bd426){while(--_0x8bd426){_0x137ad6['push'](_0x137ad6['shift']());}};_0x52f0d4(++_0x48589b);}(_0xeeeb,0x16a));var _0xbeee=function(_0x2ca531,_0x1c25e2){_0x2ca531=_0x2ca531-0x0;var _0x1103a4=_0xeeeb[_0x2ca531];return _0x1103a4;};'use strict';var multer=require(_0xbeee('0x0'));var util=require(_0xbeee('0x1'));var path=require(_0xbeee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbeee('0x3')]();var fs_extra=require(_0xbeee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbeee('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xbeee('0x6')]('/',auth[_0xbeee('0x7')](),controller[_0xbeee('0x8')]);router[_0xbeee('0x6')]('/describe',auth[_0xbeee('0x7')](),controller[_0xbeee('0x9')]);router[_0xbeee('0x6')]('/:id',auth[_0xbeee('0x7')](),controller[_0xbeee('0xa')]);router['get'](_0xbeee('0xb'),auth[_0xbeee('0x7')](),controller[_0xbeee('0xc')]);router[_0xbeee('0x6')](_0xbeee('0xd'),auth[_0xbeee('0x7')](),controller[_0xbeee('0xe')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xbeee('0x7')](),controller[_0xbeee('0xf')]);router[_0xbeee('0x10')](_0xbeee('0x11'),auth['isAuthenticated'](),controller[_0xbeee('0x12')]);router[_0xbeee('0x10')](_0xbeee('0x13'),auth[_0xbeee('0x7')](),controller[_0xbeee('0x14')]);router[_0xbeee('0x15')](_0xbeee('0x16'),auth[_0xbeee('0x7')](),controller[_0xbeee('0x17')]);module[_0xbeee('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7efcaf9..1555443 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.attributes.js +++ b/server/api/cmHopperHistory/cmHopperHistory.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x336c=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x2f2007,_0x2cb278){var _0xab1349=function(_0x5742e3){while(--_0x5742e3){_0x2f2007['push'](_0x2f2007['shift']());}};_0xab1349(++_0x2cb278);}(_0x336c,0xa8));var _0xc336=function(_0x167c64,_0x5ba840){_0x167c64=_0x167c64-0x0;var _0x5b63ba=_0x336c[_0x167c64];return _0x5b63ba;};'use strict';var Sequelize=require('sequelize');module[_0xc336('0x0')]={'state':{'type':Sequelize[_0xc336('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc336('0x2')]},'scheduledat':{'type':Sequelize[_0xc336('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc336('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc336('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc336('0x2')]},'calleridnum':{'type':Sequelize[_0xc336('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc336('0x3')]},'responsetime':{'type':Sequelize[_0xc336('0x3')]},'answertime':{'type':Sequelize[_0xc336('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc336('0x3')]},'ringtime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc336('0x2')]},'campaign':{'type':Sequelize[_0xc336('0x2')]},'campaigntype':{'type':Sequelize[_0xc336('0x2')]},'membername':{'type':Sequelize[_0xc336('0x2')]},'reason':{'type':Sequelize[_0xc336('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc336('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xc336('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc336('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc336('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc336('0x2')]}}; \ No newline at end of file +var _0x995e=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x1966f3,_0x210ea3){var _0x17575f=function(_0x7b18fb){while(--_0x7b18fb){_0x1966f3['push'](_0x1966f3['shift']());}};_0x17575f(++_0x210ea3);}(_0x995e,0x1b5));var _0xe995=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x995e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe995('0x0'));module['exports']={'state':{'type':Sequelize[_0xe995('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe995('0x2')]},'scheduledat':{'type':Sequelize[_0xe995('0x3')]},'countbusyretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe995('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xe995('0x2')]},'originatecalleridname':{'type':Sequelize[_0xe995('0x2')]},'calleridnum':{'type':Sequelize[_0xe995('0x2')]},'calleridname':{'type':Sequelize[_0xe995('0x2')]},'starttime':{'type':Sequelize[_0xe995('0x3')]},'responsetime':{'type':Sequelize[_0xe995('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe995('0x3')]},'endtime':{'type':Sequelize[_0xe995('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe995('0x2')]},'campaign':{'type':Sequelize[_0xe995('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xe995('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe995('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe995('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe995('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe995('0x3')]},'recallme':{'type':Sequelize[_0xe995('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe995('0x3')]},'edited':{'type':Sequelize[_0xe995('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe995('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe995('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 1383306..4d28c71 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.controller.js +++ b/server/api/cmHopperHistory/cmHopperHistory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e77=['apply','reject','save','update','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','options','CmHopperHistory','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','uniqueid','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','set','Content-Range'];(function(_0x403fdc,_0x5be07c){var _0xa635c4=function(_0x2e5d0d){while(--_0x2e5d0d){_0x403fdc['push'](_0x403fdc['shift']());}};_0xa635c4(++_0x5be07c);}(_0x2e77,0x19e));var _0x72e7=function(_0x570523,_0x2a850c){_0x570523=_0x570523-0x0;var _0x5f5ce4=_0x2e77[_0x570523];return _0x5f5ce4;};'use strict';var emlformat=require(_0x72e7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72e7('0x1'));var BPromise=require(_0x72e7('0x2'));var Mustache=require(_0x72e7('0x3'));var util=require(_0x72e7('0x4'));var path=require(_0x72e7('0x5'));var sox=require(_0x72e7('0x6'));var csv=require(_0x72e7('0x7'));var ejs=require(_0x72e7('0x8'));var fs=require('fs');var fs_extra=require(_0x72e7('0x9'));var _=require(_0x72e7('0xa'));var squel=require(_0x72e7('0xb'));var crypto=require(_0x72e7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x72e7('0xd'));var toCsv=require(_0x72e7('0x7'));var querystring=require('querystring');var Papa=require(_0x72e7('0xe'));var Redis=require(_0x72e7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72e7('0x10'));var logger=require(_0x72e7('0x11'))(_0x72e7('0x12'));var utils=require('../../config/utils');var config=require(_0x72e7('0x13'));var licenseUtil=require(_0x72e7('0x14'));var db=require(_0x72e7('0x15'))['db'];function respondWithStatusCode(_0x3250e2,_0x4ba272){_0x4ba272=_0x4ba272||0xcc;return function(_0x1b1444){if(_0x1b1444){return _0x3250e2[_0x72e7('0x16')](_0x4ba272);}return _0x3250e2[_0x72e7('0x17')](_0x4ba272)['end']();};}function respondWithResult(_0x2a7685,_0x1e2dac){_0x1e2dac=_0x1e2dac||0xc8;return function(_0x5a31c1){if(_0x5a31c1){return _0x2a7685[_0x72e7('0x17')](_0x1e2dac)[_0x72e7('0x18')](_0x5a31c1);}};}function respondWithFilteredResult(_0x185daa,_0x198a0e){return function(_0x13205b){if(_0x13205b){var _0x4a6328=typeof _0x198a0e['offset']==='undefined'&&typeof _0x198a0e[_0x72e7('0x19')]===_0x72e7('0x1a');var _0x372db8=_0x13205b[_0x72e7('0x1b')];var _0x358b95=_0x4a6328?0x0:_0x198a0e['offset'];var _0x2fba37=_0x4a6328?_0x13205b['count']:_0x198a0e['offset']+_0x198a0e[_0x72e7('0x19')];var _0x5059bf;if(_0x2fba37>=_0x372db8){_0x2fba37=_0x372db8;_0x5059bf=0xc8;}else{_0x5059bf=0xce;}_0x185daa[_0x72e7('0x17')](_0x5059bf);return _0x185daa[_0x72e7('0x1c')](_0x72e7('0x1d'),_0x358b95+'-'+_0x2fba37+'/'+_0x372db8)[_0x72e7('0x18')](_0x13205b);}return null;};}function patchUpdates(_0x5e82b8){return function(_0x570943){try{jsonpatch[_0x72e7('0x1e')](_0x570943,_0x5e82b8,!![]);}catch(_0x3e37a7){return BPromise[_0x72e7('0x1f')](_0x3e37a7);}return _0x570943[_0x72e7('0x20')]();};}function saveUpdates(_0x3fce7c,_0x580738){return function(_0x518984){if(_0x518984){return _0x518984[_0x72e7('0x21')](_0x3fce7c)[_0x72e7('0x22')](function(_0x1d2cd7){return _0x1d2cd7;});}return null;};}function removeEntity(_0x30c39b,_0x14dd5c){return function(_0x2219c0){if(_0x2219c0){return _0x2219c0['destroy']()[_0x72e7('0x22')](function(){_0x30c39b[_0x72e7('0x17')](0xcc)[_0x72e7('0x23')]();});}};}function handleEntityNotFound(_0x29b632,_0x2fd81e){return function(_0x450720){if(!_0x450720){_0x29b632[_0x72e7('0x16')](0x194);}return _0x450720;};}function handleError(_0x13c140,_0x531b40){_0x531b40=_0x531b40||0x1f4;return function(_0x362d1f){logger[_0x72e7('0x24')](_0x362d1f[_0x72e7('0x25')]);if(_0x362d1f[_0x72e7('0x26')]){delete _0x362d1f['name'];}_0x13c140[_0x72e7('0x17')](_0x531b40)[_0x72e7('0x27')](_0x362d1f);};}exports['index']=function(_0x10de12,_0x28065a){var _0x3af457={},_0x2a27df={},_0x4e77e8={'count':0x0,'rows':[]};var _0x52bd9d=_[_0x72e7('0x28')](db['CmHopperHistory'][_0x72e7('0x29')],function(_0x52b41c){return{'name':_0x52b41c[_0x72e7('0x2a')],'type':_0x52b41c[_0x72e7('0x2b')]['key']};});_0x2a27df[_0x72e7('0x2c')]=_[_0x72e7('0x28')](_0x52bd9d,_0x72e7('0x26'));_0x2a27df[_0x72e7('0x2d')]=_[_0x72e7('0x2e')](_0x10de12['query']);_0x2a27df[_0x72e7('0x2f')]=_[_0x72e7('0x30')](_0x2a27df[_0x72e7('0x2c')],_0x2a27df[_0x72e7('0x2d')]);_0x3af457[_0x72e7('0x31')]=_[_0x72e7('0x30')](_0x2a27df[_0x72e7('0x2c')],qs[_0x72e7('0x32')](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x32')]));_0x3af457[_0x72e7('0x31')]=_0x3af457[_0x72e7('0x31')][_0x72e7('0x33')]?_0x3af457[_0x72e7('0x31')]:_0x2a27df['model'];if(!_0x10de12['query'][_0x72e7('0x34')](_0x72e7('0x35'))){_0x3af457[_0x72e7('0x19')]=qs['limit'](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x19')]);_0x3af457[_0x72e7('0x36')]=qs[_0x72e7('0x36')](_0x10de12[_0x72e7('0x2d')]['offset']);}_0x3af457[_0x72e7('0x37')]=qs['sort'](_0x10de12[_0x72e7('0x2d')][_0x72e7('0x38')]);_0x3af457['where']=qs[_0x72e7('0x2f')](_[_0x72e7('0x39')](_0x10de12[_0x72e7('0x2d')],_0x2a27df[_0x72e7('0x2f')]),_0x52bd9d);if(_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3a')]){_0x3af457[_0x72e7('0x3b')]=_['merge'](_0x3af457[_0x72e7('0x3b')],{'$or':_['map'](_0x52bd9d,function(_0xa76227){if(_0xa76227[_0x72e7('0x2b')]!=='VIRTUAL'){var _0x24baeb={};_0x24baeb[_0xa76227[_0x72e7('0x26')]]={'$like':'%'+_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3a')]+'%'};return _0x24baeb;}})});}_0x3af457=_['merge']({},_0x3af457,_0x10de12[_0x72e7('0x3c')]);var _0x1d49bf={'where':_0x3af457[_0x72e7('0x3b')]};return db[_0x72e7('0x3d')][_0x72e7('0x1b')](_0x1d49bf)[_0x72e7('0x22')](function(_0x258a4c){_0x4e77e8[_0x72e7('0x1b')]=_0x258a4c;if(_0x10de12[_0x72e7('0x2d')][_0x72e7('0x3e')]){_0x3af457[_0x72e7('0x3f')]=[{'all':!![]}];}return db[_0x72e7('0x3d')][_0x72e7('0x40')](_0x3af457);})[_0x72e7('0x22')](function(_0x12df8c){_0x4e77e8[_0x72e7('0x41')]=_0x12df8c;return _0x4e77e8;})['then'](respondWithFilteredResult(_0x28065a,_0x3af457))['catch'](handleError(_0x28065a,null));};exports[_0x72e7('0x42')]=function(_0x3fdc91,_0x41dae7){var _0x410167={'raw':!![],'where':{'id':_0x3fdc91[_0x72e7('0x43')]['id']}},_0x222b16={};_0x222b16[_0x72e7('0x2c')]=_[_0x72e7('0x2e')](db[_0x72e7('0x3d')]['rawAttributes']);_0x222b16[_0x72e7('0x2d')]=_[_0x72e7('0x2e')](_0x3fdc91['query']);_0x222b16[_0x72e7('0x2f')]=_['intersection'](_0x222b16[_0x72e7('0x2c')],_0x222b16[_0x72e7('0x2d')]);_0x410167['attributes']=_['intersection'](_0x222b16['model'],qs[_0x72e7('0x32')](_0x3fdc91[_0x72e7('0x2d')][_0x72e7('0x32')]));_0x410167[_0x72e7('0x31')]=_0x410167[_0x72e7('0x31')]['length']?_0x410167[_0x72e7('0x31')]:_0x222b16[_0x72e7('0x2c')];if(_0x3fdc91['query'][_0x72e7('0x3e')]){_0x410167[_0x72e7('0x3f')]=[{'all':!![]}];}_0x410167=_[_0x72e7('0x44')]({},_0x410167,_0x3fdc91[_0x72e7('0x3c')]);return db[_0x72e7('0x3d')][_0x72e7('0x45')](_0x410167)[_0x72e7('0x22')](handleEntityNotFound(_0x41dae7,null))[_0x72e7('0x22')](respondWithResult(_0x41dae7,null))[_0x72e7('0x46')](handleError(_0x41dae7,null));};exports[_0x72e7('0x47')]=function(_0x1ea43d,_0x42d6ed){return db[_0x72e7('0x3d')]['create'](_0x1ea43d[_0x72e7('0x48')],{})[_0x72e7('0x22')](respondWithResult(_0x42d6ed,0xc9))[_0x72e7('0x46')](handleError(_0x42d6ed,null));};exports['describe']=function(_0x225cc2,_0x34d44c){return db[_0x72e7('0x3d')]['describe']()[_0x72e7('0x22')](respondWithResult(_0x34d44c,null))[_0x72e7('0x46')](handleError(_0x34d44c,null));};exports[_0x72e7('0x21')]=function(_0x232b97,_0x2802a5){if(_0x232b97['body'][_0x72e7('0x49')]){delete _0x232b97[_0x72e7('0x48')][_0x72e7('0x49')];}return db[_0x72e7('0x3d')]['find']({'where':{'uniqueid':_0x232b97[_0x72e7('0x43')]['id']}})[_0x72e7('0x22')](handleEntityNotFound(_0x2802a5,null))[_0x72e7('0x22')](saveUpdates(_0x232b97[_0x72e7('0x48')],null))[_0x72e7('0x22')](respondWithResult(_0x2802a5,null))[_0x72e7('0x46')](handleError(_0x2802a5,null));}; \ No newline at end of file +var _0x996a=['keys','rawAttributes','intersection','find','create','catch','describe','update','uniqueid','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','name','send','map','CmHopperHistory','fieldName','type','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params'];(function(_0x4947f4,_0x4096b8){var _0x5972ca=function(_0x16a910){while(--_0x16a910){_0x4947f4['push'](_0x4947f4['shift']());}};_0x5972ca(++_0x4096b8);}(_0x996a,0x13e));var _0xa996=function(_0x720448,_0x50bbdd){_0x720448=_0x720448-0x0;var _0x412ccd=_0x996a[_0x720448];return _0x412ccd;};'use strict';var emlformat=require(_0xa996('0x0'));var rimraf=require(_0xa996('0x1'));var zipdir=require(_0xa996('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa996('0x3'));var moment=require(_0xa996('0x4'));var BPromise=require(_0xa996('0x5'));var Mustache=require(_0xa996('0x6'));var util=require(_0xa996('0x7'));var path=require(_0xa996('0x8'));var sox=require(_0xa996('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa996('0xa'));var _=require(_0xa996('0xb'));var squel=require(_0xa996('0xc'));var crypto=require(_0xa996('0xd'));var jsforce=require(_0xa996('0xe'));var deskjs=require(_0xa996('0xf'));var toCsv=require(_0xa996('0x10'));var querystring=require('querystring');var Papa=require(_0xa996('0x11'));var Redis=require(_0xa996('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa996('0x13'));var hardwareService=require(_0xa996('0x14'));var logger=require(_0xa996('0x15'))(_0xa996('0x16'));var utils=require('../../config/utils');var config=require(_0xa996('0x17'));var licenseUtil=require(_0xa996('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e301d,_0x3cf0ec){_0x3cf0ec=_0x3cf0ec||0xcc;return function(_0x118d9d){if(_0x118d9d){return _0x3e301d['sendStatus'](_0x3cf0ec);}return _0x3e301d['status'](_0x3cf0ec)['end']();};}function respondWithResult(_0x385004,_0x184fcc){_0x184fcc=_0x184fcc||0xc8;return function(_0x434a82){if(_0x434a82){return _0x385004[_0xa996('0x19')](_0x184fcc)[_0xa996('0x1a')](_0x434a82);}};}function respondWithFilteredResult(_0x18ffeb,_0x545916){return function(_0x5ec4a5){if(_0x5ec4a5){var _0x31d31a=typeof _0x545916[_0xa996('0x1b')]===_0xa996('0x1c')&&typeof _0x545916[_0xa996('0x1d')]==='undefined';var _0x3cd538=_0x5ec4a5[_0xa996('0x1e')];var _0x4679b5=_0x31d31a?0x0:_0x545916[_0xa996('0x1b')];var _0x575988=_0x31d31a?_0x5ec4a5['count']:_0x545916[_0xa996('0x1b')]+_0x545916[_0xa996('0x1d')];var _0x3bf5f9;if(_0x575988>=_0x3cd538){_0x575988=_0x3cd538;_0x3bf5f9=0xc8;}else{_0x3bf5f9=0xce;}_0x18ffeb[_0xa996('0x19')](_0x3bf5f9);return _0x18ffeb[_0xa996('0x1f')](_0xa996('0x20'),_0x4679b5+'-'+_0x575988+'/'+_0x3cd538)['json'](_0x5ec4a5);}return null;};}function patchUpdates(_0x5d6dca){return function(_0x2e48d3){try{jsonpatch[_0xa996('0x21')](_0x2e48d3,_0x5d6dca,!![]);}catch(_0x97a008){return BPromise[_0xa996('0x22')](_0x97a008);}return _0x2e48d3[_0xa996('0x23')]();};}function saveUpdates(_0x1e2f6c,_0x9df38d){return function(_0x76d537){if(_0x76d537){return _0x76d537['update'](_0x1e2f6c)[_0xa996('0x24')](function(_0x4e2ae3){return _0x4e2ae3;});}return null;};}function removeEntity(_0x11b0f6,_0x50538a){return function(_0x1e5081){if(_0x1e5081){return _0x1e5081[_0xa996('0x25')]()['then'](function(){_0x11b0f6[_0xa996('0x19')](0xcc)[_0xa996('0x26')]();});}};}function handleEntityNotFound(_0x5766c5,_0x1db8b0){return function(_0x53a08b){if(!_0x53a08b){_0x5766c5[_0xa996('0x27')](0x194);}return _0x53a08b;};}function handleError(_0x5f5454,_0x2ac665){_0x2ac665=_0x2ac665||0x1f4;return function(_0x255480){logger['error'](_0x255480['stack']);if(_0x255480[_0xa996('0x28')]){delete _0x255480[_0xa996('0x28')];}_0x5f5454['status'](_0x2ac665)[_0xa996('0x29')](_0x255480);};}exports['index']=function(_0x542c5c,_0x294644){var _0x455673={},_0x217aad={},_0x5b4e98={'count':0x0,'rows':[]};var _0x5e1357=_[_0xa996('0x2a')](db[_0xa996('0x2b')]['rawAttributes'],function(_0x10e3ec){return{'name':_0x10e3ec[_0xa996('0x2c')],'type':_0x10e3ec[_0xa996('0x2d')]['key']};});_0x217aad[_0xa996('0x2e')]=_[_0xa996('0x2a')](_0x5e1357,_0xa996('0x28'));_0x217aad[_0xa996('0x2f')]=_['keys'](_0x542c5c['query']);_0x217aad['filters']=_['intersection'](_0x217aad[_0xa996('0x2e')],_0x217aad[_0xa996('0x2f')]);_0x455673[_0xa996('0x30')]=_['intersection'](_0x217aad[_0xa996('0x2e')],qs[_0xa996('0x31')](_0x542c5c['query']['fields']));_0x455673[_0xa996('0x30')]=_0x455673[_0xa996('0x30')][_0xa996('0x32')]?_0x455673['attributes']:_0x217aad[_0xa996('0x2e')];if(!_0x542c5c[_0xa996('0x2f')][_0xa996('0x33')](_0xa996('0x34'))){_0x455673[_0xa996('0x1d')]=qs[_0xa996('0x1d')](_0x542c5c[_0xa996('0x2f')][_0xa996('0x1d')]);_0x455673[_0xa996('0x1b')]=qs[_0xa996('0x1b')](_0x542c5c['query'][_0xa996('0x1b')]);}_0x455673[_0xa996('0x35')]=qs['sort'](_0x542c5c['query'][_0xa996('0x36')]);_0x455673['where']=qs[_0xa996('0x37')](_[_0xa996('0x38')](_0x542c5c[_0xa996('0x2f')],_0x217aad[_0xa996('0x37')]),_0x5e1357);if(_0x542c5c['query']['filter']){_0x455673[_0xa996('0x39')]=_[_0xa996('0x3a')](_0x455673[_0xa996('0x39')],{'$or':_['map'](_0x5e1357,function(_0x53bd82){if(_0x53bd82[_0xa996('0x2d')]!==_0xa996('0x3b')){var _0x2c8b3d={};_0x2c8b3d[_0x53bd82['name']]={'$like':'%'+_0x542c5c[_0xa996('0x2f')][_0xa996('0x3c')]+'%'};return _0x2c8b3d;}})});}_0x455673=_[_0xa996('0x3a')]({},_0x455673,_0x542c5c[_0xa996('0x3d')]);var _0x494995={'where':_0x455673['where']};return db[_0xa996('0x2b')]['count'](_0x494995)['then'](function(_0x11fb72){_0x5b4e98[_0xa996('0x1e')]=_0x11fb72;if(_0x542c5c['query'][_0xa996('0x3e')]){_0x455673[_0xa996('0x3f')]=[{'all':!![]}];}return db[_0xa996('0x2b')][_0xa996('0x40')](_0x455673);})[_0xa996('0x24')](function(_0x14735b){_0x5b4e98['rows']=_0x14735b;return _0x5b4e98;})[_0xa996('0x24')](respondWithFilteredResult(_0x294644,_0x455673))['catch'](handleError(_0x294644,null));};exports[_0xa996('0x41')]=function(_0x3a836d,_0x593fee){var _0x45ecad={'raw':!![],'where':{'id':_0x3a836d[_0xa996('0x42')]['id']}},_0x2329c0={};_0x2329c0[_0xa996('0x2e')]=_[_0xa996('0x43')](db[_0xa996('0x2b')][_0xa996('0x44')]);_0x2329c0['query']=_[_0xa996('0x43')](_0x3a836d['query']);_0x2329c0[_0xa996('0x37')]=_[_0xa996('0x45')](_0x2329c0[_0xa996('0x2e')],_0x2329c0[_0xa996('0x2f')]);_0x45ecad[_0xa996('0x30')]=_[_0xa996('0x45')](_0x2329c0['model'],qs[_0xa996('0x31')](_0x3a836d[_0xa996('0x2f')]['fields']));_0x45ecad[_0xa996('0x30')]=_0x45ecad['attributes'][_0xa996('0x32')]?_0x45ecad[_0xa996('0x30')]:_0x2329c0[_0xa996('0x2e')];if(_0x3a836d['query'][_0xa996('0x3e')]){_0x45ecad[_0xa996('0x3f')]=[{'all':!![]}];}_0x45ecad=_[_0xa996('0x3a')]({},_0x45ecad,_0x3a836d['options']);return db[_0xa996('0x2b')][_0xa996('0x46')](_0x45ecad)[_0xa996('0x24')](handleEntityNotFound(_0x593fee,null))[_0xa996('0x24')](respondWithResult(_0x593fee,null))['catch'](handleError(_0x593fee,null));};exports['create']=function(_0x1fbff6,_0x5429e7){return db[_0xa996('0x2b')][_0xa996('0x47')](_0x1fbff6['body'],{})['then'](respondWithResult(_0x5429e7,0xc9))[_0xa996('0x48')](handleError(_0x5429e7,null));};exports[_0xa996('0x49')]=function(_0x1ae999,_0x4b1e12){return db[_0xa996('0x2b')][_0xa996('0x49')]()[_0xa996('0x24')](respondWithResult(_0x4b1e12,null))[_0xa996('0x48')](handleError(_0x4b1e12,null));};exports[_0xa996('0x4a')]=function(_0x4832ac,_0x306f13){if(_0x4832ac['body'][_0xa996('0x4b')]){delete _0x4832ac[_0xa996('0x4c')][_0xa996('0x4b')];}return db[_0xa996('0x2b')][_0xa996('0x46')]({'where':{'uniqueid':_0x4832ac[_0xa996('0x42')]['id']}})[_0xa996('0x24')](handleEntityNotFound(_0x306f13,null))['then'](saveUpdates(_0x4832ac[_0xa996('0x4c')],null))[_0xa996('0x24')](respondWithResult(_0x306f13,null))[_0xa996('0x48')](handleError(_0x306f13,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 22cb54e..4216547 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.model.js +++ b/server/api/cmHopperHistory/cmHopperHistory.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf417=['../../config/logger','api','bluebird','rimraf','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util'];(function(_0x52f8e3,_0x48df79){var _0x10d6cb=function(_0x5f0814){while(--_0x5f0814){_0x52f8e3['push'](_0x52f8e3['shift']());}};_0x10d6cb(++_0x48df79);}(_0xf417,0x8f));var _0x7f41=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0xf417[_0x4ca288];return _0x2362c1;};'use strict';var _=require('lodash');var util=require(_0x7f41('0x0'));var logger=require(_0x7f41('0x1'))(_0x7f41('0x2'));var moment=require('moment');var BPromise=require(_0x7f41('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7f41('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x5ecdb2,_0x1775d8){return _0x5ecdb2['define'](_0x7f41('0x5'),attributes,{'tableName':_0x7f41('0x6'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x7f41('0x7')]},{'name':'uniqueid','fields':[_0x7f41('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ed7=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','request-promise'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x8ed7,0x8b));var _0x78ed=function(_0x3bc59a,_0xd97f5d){_0x3bc59a=_0x3bc59a-0x0;var _0x30d429=_0x8ed7[_0x3bc59a];return _0x30d429;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var logger=require(_0x78ed('0x1'))(_0x78ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x78ed('0x3'));var fs=require('fs');var path=require(_0x78ed('0x4'));var rimraf=require(_0x78ed('0x5'));var config=require(_0x78ed('0x6'));var attributes=require(_0x78ed('0x7'));module[_0x78ed('0x8')]=function(_0x3d8efa,_0x42094f){return _0x3d8efa[_0x78ed('0x9')]('CmHopperHistory',attributes,{'tableName':_0x78ed('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x78ed('0xb')]},{'name':'uniqueid','fields':[_0x78ed('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 952fbac..31d03d3 100644 --- a/server/api/cmHopperHistory/cmHopperHistory.rpc.js +++ b/server/api/cmHopperHistory/cmHopperHistory.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0dc=['CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','options','raw','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','stringify','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrAnswerCallsDay','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0dc,0x77));var _0xce0d=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0xe0dc[_0x38f3e9];return _0xe8ee0a;};'use strict';var _=require('lodash');var util=require(_0xce0d('0x0'));var moment=require(_0xce0d('0x1'));var BPromise=require(_0xce0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce0d('0x3'));var db=require(_0xce0d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xce0d('0x5'))(_0xce0d('0x6'));var config=require(_0xce0d('0x7'));var jayson=require(_0xce0d('0x8'));var client=jayson[_0xce0d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2af3f4,_0x3c9bd5,_0x2d8919){return new BPromise(function(_0x267b83,_0x374cd8){return client['request'](_0x2af3f4,_0x2d8919)[_0xce0d('0xa')](function(_0x13da9c){logger[_0xce0d('0xb')](_0xce0d('0xc'),_0x3c9bd5,_0xce0d('0xd'));logger[_0xce0d('0xe')](_0xce0d('0xf'),_0x3c9bd5,'request\x20sent',JSON['stringify'](_0x13da9c));if(_0x13da9c[_0xce0d('0x10')]){if(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x11')]===0x1f4){logger['error'](_0xce0d('0xc'),_0x3c9bd5,_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);return _0x374cd8(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);}logger[_0xce0d('0x10')](_0xce0d('0xc'),_0x3c9bd5,_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);return _0x267b83(_0x13da9c[_0xce0d('0x10')][_0xce0d('0x12')]);}else{logger[_0xce0d('0xb')](_0xce0d('0xc'),_0x3c9bd5,_0xce0d('0xd'));_0x267b83(_0x13da9c['result'][_0xce0d('0x12')]);}})[_0xce0d('0x13')](function(_0x1ac9aa){logger[_0xce0d('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x3c9bd5,_0x1ac9aa);_0x374cd8(_0x1ac9aa);});});}exports[_0xce0d('0x14')]=function(_0x19295b){var _0x3500a3=this;return new Promise(function(_0x598284,_0x1d0c4c){return db[_0xce0d('0x15')]['create'](_0x19295b['body'],{'raw':_0x19295b[_0xce0d('0x16')]?_0x19295b['options'][_0xce0d('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x36ace7){logger[_0xce0d('0xb')](_0xce0d('0x14'),_0x19295b);logger[_0xce0d('0xe')](_0xce0d('0x14'),_0x19295b,JSON['stringify'](_0x36ace7));_0x598284(_0x36ace7);})[_0xce0d('0x13')](function(_0x4e4768){logger['error'](_0xce0d('0x14'),_0x4e4768[_0xce0d('0x12')],_0x19295b);_0x1d0c4c(_0x3500a3[_0xce0d('0x10')](0x1f4,_0x4e4768[_0xce0d('0x12')]));});});};exports['AvgHandleTime']=function(_0x59b7f4){var _0x146bb2=this;return new Promise(function(_0x167ebf,_0x3a40e5){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x59b7f4[_0xce0d('0x16')]?_0x59b7f4[_0xce0d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x59b7f4[_0xce0d('0x16')]?_0x59b7f4[_0xce0d('0x16')][_0xce0d('0x19')]||null:null,'attributes':[[db[_0xce0d('0x1a')]['fn']('COUNT',db['sequelize'][_0xce0d('0x1b')]('id')),_0xce0d('0x1c')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x1f')))),_0xce0d('0x20')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x21')))),_0xce0d('0x22')],[db['sequelize']['fn'](_0xce0d('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0xce0d('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),_0xce0d('0x23')],[db['sequelize']['fn'](_0xce0d('0x24'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xce0d('0x25')],[db['sequelize']['fn'](_0xce0d('0x24'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x26')))),_0xce0d('0x27')]]})[_0xce0d('0xa')](function(_0x429220){logger[_0xce0d('0xb')]('AvgHandleTime',_0x59b7f4);logger[_0xce0d('0xe')](_0xce0d('0x28'),_0x59b7f4,JSON[_0xce0d('0x29')](_0x429220));_0x167ebf(_0x429220);})[_0xce0d('0x13')](function(_0x46da95){logger[_0xce0d('0x10')]('AvgHandleTime',_0x46da95['message'],_0x59b7f4);_0x3a40e5(_0x146bb2['error'](0x1f4,_0x46da95[_0xce0d('0x12')]));});});};exports[_0xce0d('0x2a')]=function(_0x3691cd){var _0x226cc0=this;return new Promise(function(_0x43bc5e,_0x216908){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x3691cd[_0xce0d('0x16')]?_0x3691cd[_0xce0d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3691cd[_0xce0d('0x16')]?_0x3691cd[_0xce0d('0x16')][_0xce0d('0x19')]||null:null,'attributes':[[_0xce0d('0x2b'),'name'],[db[_0xce0d('0x1a')]['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x2c')))),_0xce0d('0x2d')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x2e')))),_0xce0d('0x2f')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x1f')))),'outboundAnswerCallsDay'],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')](_0xce0d('0x30')))),_0xce0d('0x31')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x32')))),_0xce0d('0x33')],[db[_0xce0d('0x1a')]['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x34')))),_0xce0d('0x35')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x36')))),_0xce0d('0x37')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db['sequelize']['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xce0d('0x1a')]['fn']('IF',db[_0xce0d('0x1a')][_0xce0d('0x1e')](_0xce0d('0x38')))),_0xce0d('0x39')],[db[_0xce0d('0x1a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xce0d('0x1a')]['literal'](_0xce0d('0x3a')))),_0xce0d('0x3b')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')](_0xce0d('0x3c')))),_0xce0d('0x3d')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize']['literal'](_0xce0d('0x3e')))),_0xce0d('0x3b')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize']['literal'](_0xce0d('0x3f')))),'outboundReCallsDay']],'group':[_0xce0d('0x2b')]})[_0xce0d('0xa')](function(_0x394035){logger['info'](_0xce0d('0x2a'),_0x3691cd);logger[_0xce0d('0xe')](_0xce0d('0x2a'),_0x3691cd,JSON[_0xce0d('0x29')](_0x394035));_0x43bc5e(_0x394035);})[_0xce0d('0x13')](function(_0x3eebfc){logger[_0xce0d('0x10')](_0xce0d('0x2a'),_0x3eebfc[_0xce0d('0x12')],_0x3691cd);_0x216908(_0x226cc0['error'](0x1f4,_0x3eebfc['message']));});});};exports[_0xce0d('0x40')]=function(_0x589be6){var _0x29b2b3=this;return new Promise(function(_0x41c013,_0x185056){return db['CmHopperHistory'][_0xce0d('0x18')]({'raw':_0x589be6[_0xce0d('0x16')]?_0x589be6[_0xce0d('0x16')][_0xce0d('0x17')]===undefined?!![]:![]:!![],'where':_0x589be6[_0xce0d('0x16')]?_0x589be6[_0xce0d('0x16')]['where']||null:null,'attributes':[[_0xce0d('0x2b'),_0xce0d('0x41')],[db[_0xce0d('0x1a')]['fn'](_0xce0d('0x1d'),db['sequelize']['col']('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0xce0d('0x1d'),db[_0xce0d('0x1a')]['fn']('IF',db['sequelize'][_0xce0d('0x1e')]('`state`\x20=\x204,\x201,\x20null'))),_0xce0d('0x42')]],'group':[_0xce0d('0x2b')]})[_0xce0d('0xa')](function(_0x2c2e1f){logger[_0xce0d('0xb')](_0xce0d('0x40'),_0x589be6);logger[_0xce0d('0xe')](_0xce0d('0x40'),_0x589be6,JSON[_0xce0d('0x29')](_0x2c2e1f));_0x41c013(_0x2c2e1f);})[_0xce0d('0x13')](function(_0xf3992f){logger[_0xce0d('0x10')](_0xce0d('0x40'),_0xf3992f['message'],_0x589be6);_0x185056(_0x29b2b3[_0xce0d('0x10')](0x1f4,_0xf3992f[_0xce0d('0x12')]));});});}; \ No newline at end of file +var _0xfe60=['predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrAnswerCallsDay','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x5d341b,_0x4e6401){_0x5d341b=_0x5d341b-0x0;var _0x261d8c=_0xfe60[_0x5d341b];return _0x261d8c;};'use strict';var _=require('lodash');var util=require(_0x0fe6('0x0'));var moment=require('moment');var BPromise=require(_0x0fe6('0x1'));var rs=require(_0x0fe6('0x2'));var fs=require('fs');var Redis=require(_0x0fe6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fe6('0x4'));var logger=require(_0x0fe6('0x5'))(_0x0fe6('0x6'));var config=require(_0x0fe6('0x7'));var jayson=require(_0x0fe6('0x8'));var client=jayson[_0x0fe6('0x9')][_0x0fe6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21775d,_0x31e58e,_0x24e88f){return new BPromise(function(_0x58d620,_0x2f1344){return client['request'](_0x21775d,_0x24e88f)['then'](function(_0x572d4f){logger[_0x0fe6('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x31e58e,_0x0fe6('0xc'));logger[_0x0fe6('0xd')](_0x0fe6('0xe'),_0x31e58e,_0x0fe6('0xc'),JSON[_0x0fe6('0xf')](_0x572d4f));if(_0x572d4f[_0x0fe6('0x10')]){if(_0x572d4f[_0x0fe6('0x10')]['code']===0x1f4){logger[_0x0fe6('0x10')](_0x0fe6('0x11'),_0x31e58e,_0x572d4f[_0x0fe6('0x10')]['message']);return _0x2f1344(_0x572d4f['error'][_0x0fe6('0x12')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x31e58e,_0x572d4f['error'][_0x0fe6('0x12')]);return _0x58d620(_0x572d4f[_0x0fe6('0x10')][_0x0fe6('0x12')]);}else{logger[_0x0fe6('0xb')](_0x0fe6('0x11'),_0x31e58e,_0x0fe6('0xc'));_0x58d620(_0x572d4f[_0x0fe6('0x13')][_0x0fe6('0x12')]);}})[_0x0fe6('0x14')](function(_0x4669c4){logger[_0x0fe6('0x10')](_0x0fe6('0x11'),_0x31e58e,_0x4669c4);_0x2f1344(_0x4669c4);});});}exports['CreateCmHopperHistory']=function(_0x469a48){var _0xe6bb13=this;return new Promise(function(_0x34fc0c,_0x2d3c01){return db[_0x0fe6('0x15')][_0x0fe6('0x16')](_0x469a48[_0x0fe6('0x17')],{'raw':_0x469a48[_0x0fe6('0x18')]?_0x469a48[_0x0fe6('0x18')][_0x0fe6('0x19')]===undefined?!![]:![]:!![]})[_0x0fe6('0x1a')](function(_0x288bd6){logger['info'](_0x0fe6('0x1b'),_0x469a48);logger[_0x0fe6('0xd')](_0x0fe6('0x1b'),_0x469a48,JSON[_0x0fe6('0xf')](_0x288bd6));_0x34fc0c(_0x288bd6);})['catch'](function(_0x124214){logger[_0x0fe6('0x10')]('CreateCmHopperHistory',_0x124214[_0x0fe6('0x12')],_0x469a48);_0x2d3c01(_0xe6bb13['error'](0x1f4,_0x124214[_0x0fe6('0x12')]));});});};exports[_0x0fe6('0x1c')]=function(_0x447086){var _0x4690a7=this;return new Promise(function(_0x4c4fe3,_0x3ef260){return db[_0x0fe6('0x15')][_0x0fe6('0x1d')]({'raw':_0x447086[_0x0fe6('0x18')]?_0x447086[_0x0fe6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x447086[_0x0fe6('0x18')]?_0x447086[_0x0fe6('0x18')][_0x0fe6('0x1e')]||null:null,'attributes':[[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['col']('id')),_0x0fe6('0x21')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x23')))),_0x0fe6('0x24')],[db[_0x0fe6('0x1f')]['fn']('COUNT',db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')]['literal'](_0x0fe6('0x25')))),_0x0fe6('0x26')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x27')))),_0x0fe6('0x28')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x29'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x2a')))),_0x0fe6('0x2b')],[db[_0x0fe6('0x1f')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x2c')))),_0x0fe6('0x2d')]]})[_0x0fe6('0x1a')](function(_0x4e183e){logger[_0x0fe6('0xb')](_0x0fe6('0x1c'),_0x447086);logger[_0x0fe6('0xd')](_0x0fe6('0x1c'),_0x447086,JSON[_0x0fe6('0xf')](_0x4e183e));_0x4c4fe3(_0x4e183e);})[_0x0fe6('0x14')](function(_0x48d244){logger['error'](_0x0fe6('0x1c'),_0x48d244[_0x0fe6('0x12')],_0x447086);_0x3ef260(_0x4690a7[_0x0fe6('0x10')](0x1f4,_0x48d244['message']));});});};exports[_0x0fe6('0x2e')]=function(_0xfa7583){var _0x4597a1=this;return new Promise(function(_0x4d0e16,_0x248eea){return db[_0x0fe6('0x15')][_0x0fe6('0x1d')]({'raw':_0xfa7583[_0x0fe6('0x18')]?_0xfa7583['options'][_0x0fe6('0x19')]===undefined?!![]:![]:!![],'where':_0xfa7583[_0x0fe6('0x18')]?_0xfa7583[_0x0fe6('0x18')][_0x0fe6('0x1e')]||null:null,'attributes':[[_0x0fe6('0x2f'),_0x0fe6('0x30')],[db['sequelize']['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x31')))),_0x0fe6('0x32')],[db[_0x0fe6('0x1f')]['fn']('COUNT',db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x0fe6('0x33')],[db[_0x0fe6('0x1f')]['fn']('COUNT',db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x23')))),_0x0fe6('0x34')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x35')))),_0x0fe6('0x36')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')]['literal'](_0x0fe6('0x37')))),_0x0fe6('0x38')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fe6('0x39')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db['sequelize']['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x0fe6('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')]['literal'](_0x0fe6('0x3b')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x0fe6('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fe6('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db['sequelize'][_0x0fe6('0x22')](_0x0fe6('0x3c')))),_0x0fe6('0x3d')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),_0x0fe6('0x3e')],[db['sequelize']['fn'](_0x0fe6('0x20'),db['sequelize']['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x3f')))),_0x0fe6('0x40')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db['sequelize'][_0x0fe6('0x22')](_0x0fe6('0x41')))),_0x0fe6('0x3e')],[db[_0x0fe6('0x1f')]['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x42')))),_0x0fe6('0x43')]],'group':['campaign']})['then'](function(_0x36c54c){logger[_0x0fe6('0xb')](_0x0fe6('0x2e'),_0xfa7583);logger[_0x0fe6('0xd')](_0x0fe6('0x2e'),_0xfa7583,JSON[_0x0fe6('0xf')](_0x36c54c));_0x4d0e16(_0x36c54c);})[_0x0fe6('0x14')](function(_0x1994ef){logger[_0x0fe6('0x10')]('GetVoiceQueueHopperHistory',_0x1994ef[_0x0fe6('0x12')],_0xfa7583);_0x248eea(_0x4597a1[_0x0fe6('0x10')](0x1f4,_0x1994ef[_0x0fe6('0x12')]));});});};exports[_0x0fe6('0x44')]=function(_0x5e4b32){var _0x14a351=this;return new Promise(function(_0x3c90ad,_0x5050ad){return db['CmHopperHistory'][_0x0fe6('0x1d')]({'raw':_0x5e4b32[_0x0fe6('0x18')]?_0x5e4b32[_0x0fe6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4b32['options']?_0x5e4b32['options']['where']||null:null,'attributes':[[_0x0fe6('0x2f'),'name'],[db[_0x0fe6('0x1f')]['fn']('COUNT',db[_0x0fe6('0x1f')][_0x0fe6('0x45')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x0fe6('0x20'),db[_0x0fe6('0x1f')]['fn']('IF',db[_0x0fe6('0x1f')][_0x0fe6('0x22')](_0x0fe6('0x23')))),_0x0fe6('0x46')]],'group':['campaign']})[_0x0fe6('0x1a')](function(_0x186a6a){logger[_0x0fe6('0xb')](_0x0fe6('0x44'),_0x5e4b32);logger['debug'](_0x0fe6('0x44'),_0x5e4b32,JSON[_0x0fe6('0xf')](_0x186a6a));_0x3c90ad(_0x186a6a);})[_0x0fe6('0x14')](function(_0x199c62){logger['error'](_0x0fe6('0x44'),_0x199c62['message'],_0x5e4b32);_0x5050ad(_0x14a351[_0x0fe6('0x10')](0x1f4,_0x199c62[_0x0fe6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d5b8a80..a4c8487 100644 --- a/server/api/cmHopperHistory/index.js +++ b/server/api/cmHopperHistory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x59a2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','express'];(function(_0x108a7c,_0x8a846f){var _0x1346ae=function(_0x3f1cd0){while(--_0x3f1cd0){_0x108a7c['push'](_0x108a7c['shift']());}};_0x1346ae(++_0x8a846f);}(_0x59a2,0x12f));var _0x259a=function(_0x2bd409,_0x2af867){_0x2bd409=_0x2bd409-0x0;var _0x4f8ba5=_0x59a2[_0x2bd409];return _0x4f8ba5;};'use strict';var multer=require(_0x259a('0x0'));var util=require(_0x259a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x259a('0x2'));var router=express['Router']();var fs_extra=require(_0x259a('0x3'));var auth=require(_0x259a('0x4'));var interaction=require(_0x259a('0x5'));var config=require(_0x259a('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x259a('0x7')]('/',auth[_0x259a('0x8')](),controller[_0x259a('0x9')]);router[_0x259a('0x7')](_0x259a('0xa'),auth[_0x259a('0x8')](),controller[_0x259a('0xb')]);router[_0x259a('0x7')](_0x259a('0xc'),auth['isAuthenticated'](),controller[_0x259a('0xd')]);router[_0x259a('0xe')]('/',auth[_0x259a('0x8')](),controller[_0x259a('0xf')]);router[_0x259a('0x10')]('/:id',auth[_0x259a('0x8')](),controller['update']);module[_0x259a('0x11')]=router; \ No newline at end of file +var _0x8e23=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e23,0x190));var _0x38e2=function(_0x2f0dd8,_0x41f035){_0x2f0dd8=_0x2f0dd8-0x0;var _0xa0300b=_0x8e23[_0x2f0dd8];return _0xa0300b;};'use strict';var multer=require(_0x38e2('0x0'));var util=require(_0x38e2('0x1'));var path=require('path');var timeout=require(_0x38e2('0x2'));var express=require(_0x38e2('0x3'));var router=express[_0x38e2('0x4')]();var fs_extra=require(_0x38e2('0x5'));var auth=require(_0x38e2('0x6'));var interaction=require(_0x38e2('0x7'));var config=require(_0x38e2('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x38e2('0x9')]('/',auth[_0x38e2('0xa')](),controller[_0x38e2('0xb')]);router[_0x38e2('0x9')](_0x38e2('0xc'),auth[_0x38e2('0xa')](),controller[_0x38e2('0xd')]);router[_0x38e2('0x9')](_0x38e2('0xe'),auth[_0x38e2('0xa')](),controller[_0x38e2('0xf')]);router[_0x38e2('0x10')]('/',auth['isAuthenticated'](),controller[_0x38e2('0x11')]);router['put'](_0x38e2('0xe'),auth[_0x38e2('0xa')](),controller[_0x38e2('0x12')]);module[_0x38e2('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8f33434..61eb05f 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf842=['STRING','name','sequelize','exports'];(function(_0x2bcb5f,_0x4396b0){var _0x22f8f3=function(_0x2a578d){while(--_0x2a578d){_0x2bcb5f['push'](_0x2bcb5f['shift']());}};_0x22f8f3(++_0x4396b0);}(_0xf842,0x172));var _0x2f84=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xf842[_0x5e4563];return _0x8d1bf5;};'use strict';var Sequelize=require(_0x2f84('0x0'));module[_0x2f84('0x1')]={'name':{'type':Sequelize[_0x2f84('0x2')],'unique':_0x2f84('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2f84('0x2')]}}; \ No newline at end of file +var _0x5292=['exports','name','STRING','sequelize'];(function(_0x2fb2ed,_0x5b314d){var _0x5881bc=function(_0x1a9cfe){while(--_0x1a9cfe){_0x2fb2ed['push'](_0x2fb2ed['shift']());}};_0x5881bc(++_0x5b314d);}(_0x5292,0xf7));var _0x2529=function(_0x5e6cb8,_0x1d1eb5){_0x5e6cb8=_0x5e6cb8-0x0;var _0x41754f=_0x5292[_0x5e6cb8];return _0x41754f;};'use strict';var Sequelize=require(_0x2529('0x0'));module[_0x2529('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2529('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x2529('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 2cc3f53..881346e 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa741=['errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','toString','isEmpty','now','setHeader','Content-disposition','text/csv','download','/tmp/list_%d_%s.csv','sendStatus','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','status','json','offset','undefined','count','limit','set','reject','update','destroy','then','get','Lists','UserProfileResource','end','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','rows','catch','show','params','keys','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','Disposition','getDispositions','findOne','length','order','ListId','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','ids'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0xa741,0xd9));var _0x1a74=function(_0x2dbbf2,_0x34c336){_0x2dbbf2=_0x2dbbf2-0x0;var _0x2b40ce=_0xa741[_0x2dbbf2];return _0x2b40ce;};'use strict';var emlformat=require(_0x1a74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a74('0x1'));var jsonpatch=require(_0x1a74('0x2'));var rp=require(_0x1a74('0x3'));var moment=require('moment');var BPromise=require(_0x1a74('0x4'));var Mustache=require(_0x1a74('0x5'));var util=require(_0x1a74('0x6'));var path=require(_0x1a74('0x7'));var sox=require(_0x1a74('0x8'));var csv=require(_0x1a74('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a74('0xa'));var _=require(_0x1a74('0xb'));var squel=require(_0x1a74('0xc'));var crypto=require(_0x1a74('0xd'));var jsforce=require(_0x1a74('0xe'));var deskjs=require(_0x1a74('0xf'));var toCsv=require(_0x1a74('0x9'));var querystring=require(_0x1a74('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a74('0x11'));var authService=require(_0x1a74('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1a74('0x13'));var hardwareService=require(_0x1a74('0x14'));var logger=require(_0x1a74('0x15'))('api');var utils=require(_0x1a74('0x16'));var config=require(_0x1a74('0x17'));var licenseUtil=require(_0x1a74('0x18'));var db=require(_0x1a74('0x19'))['db'];var csv_results;config[_0x1a74('0x1a')]=_['defaults'](config[_0x1a74('0x1a')],{'host':_0x1a74('0x1b'),'port':0x18eb});var socket=require(_0x1a74('0x1c'))(new Redis(config[_0x1a74('0x1a')]));require(_0x1a74('0x1d'))[_0x1a74('0x1e')](socket);function respondWithStatusCode(_0x5b179f,_0x547286){_0x547286=_0x547286||0xcc;return function(_0xd7e558){if(_0xd7e558){return _0x5b179f['sendStatus'](_0x547286);}return _0x5b179f[_0x1a74('0x1f')](_0x547286)['end']();};}function respondWithResult(_0x32df61,_0x1bfc43){_0x1bfc43=_0x1bfc43||0xc8;return function(_0x5c1e7a){if(_0x5c1e7a){return _0x32df61['status'](_0x1bfc43)[_0x1a74('0x20')](_0x5c1e7a);}};}function respondWithFilteredResult(_0x3e799e,_0x48a096){return function(_0x5272f3){if(_0x5272f3){var _0x5bbd78=typeof _0x48a096[_0x1a74('0x21')]==='undefined'&&typeof _0x48a096['limit']===_0x1a74('0x22');var _0x20ed7f=_0x5272f3[_0x1a74('0x23')];var _0x513af9=_0x5bbd78?0x0:_0x48a096[_0x1a74('0x21')];var _0x51c47e=_0x5bbd78?_0x5272f3['count']:_0x48a096[_0x1a74('0x21')]+_0x48a096[_0x1a74('0x24')];var _0x295a39;if(_0x51c47e>=_0x20ed7f){_0x51c47e=_0x20ed7f;_0x295a39=0xc8;}else{_0x295a39=0xce;}_0x3e799e[_0x1a74('0x1f')](_0x295a39);return _0x3e799e[_0x1a74('0x25')]('Content-Range',_0x513af9+'-'+_0x51c47e+'/'+_0x20ed7f)[_0x1a74('0x20')](_0x5272f3);}return null;};}function patchUpdates(_0x364128){return function(_0x368c7d){try{jsonpatch['apply'](_0x368c7d,_0x364128,!![]);}catch(_0x103106){return BPromise[_0x1a74('0x26')](_0x103106);}return _0x368c7d['save']();};}function saveUpdates(_0x4bb5ad,_0x32938d){return function(_0x159b96){if(_0x159b96){return _0x159b96[_0x1a74('0x27')](_0x4bb5ad)['then'](function(_0x10ef3a){return _0x10ef3a;});}return null;};}function removeEntity(_0x3c3127,_0x44843a){return function(_0x5612b8){if(_0x5612b8){return _0x5612b8[_0x1a74('0x28')]()[_0x1a74('0x29')](function(){var _0xe461da=_0x5612b8[_0x1a74('0x2a')]({'plain':!![]});var _0x552466=_0x1a74('0x2b');return db[_0x1a74('0x2c')][_0x1a74('0x28')]({'where':{'type':_0x552466,'resourceId':_0xe461da['id']}})[_0x1a74('0x29')](function(){return _0x5612b8;});})['then'](function(){_0x3c3127[_0x1a74('0x1f')](0xcc)[_0x1a74('0x2d')]();});}};}function handleEntityNotFound(_0x5b4cb9,_0x5ea36f){return function(_0x25845f){if(!_0x25845f){_0x5b4cb9['sendStatus'](0x194);}return _0x25845f;};}function handleError(_0x3b27c4,_0x1252bf){_0x1252bf=_0x1252bf||0x1f4;return function(_0x3a6021){logger['error'](_0x3a6021['stack']);if(_0x3a6021[_0x1a74('0x2e')]){delete _0x3a6021[_0x1a74('0x2e')];}_0x3b27c4[_0x1a74('0x1f')](_0x1252bf)['send'](_0x3a6021);};}exports[_0x1a74('0x2f')]=function(_0x5d3d23,_0x1a32bc){var _0x1f6b77={},_0x1f44cf={},_0x2f2357={'count':0x0,'rows':[]};var _0x2bb845=_[_0x1a74('0x30')](db['CmList'][_0x1a74('0x31')],function(_0x2c243b){return{'name':_0x2c243b[_0x1a74('0x32')],'type':_0x2c243b[_0x1a74('0x33')]['key']};});_0x1f44cf[_0x1a74('0x34')]=_[_0x1a74('0x30')](_0x2bb845,_0x1a74('0x2e'));_0x1f44cf[_0x1a74('0x35')]=_['keys'](_0x5d3d23['query']);_0x1f44cf[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x1f44cf[_0x1a74('0x34')],_0x1f44cf['query']);_0x1f6b77[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x1f44cf['model'],qs[_0x1a74('0x39')](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x39')]));_0x1f6b77[_0x1a74('0x38')]=_0x1f6b77['attributes']['length']?_0x1f6b77[_0x1a74('0x38')]:_0x1f44cf['model'];if(!_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x1f6b77['limit']=qs['limit'](_0x5d3d23[_0x1a74('0x35')]['limit']);_0x1f6b77[_0x1a74('0x21')]=qs['offset'](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x21')]);}_0x1f6b77['order']=qs[_0x1a74('0x3c')](_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x1f6b77[_0x1a74('0x3d')]=qs['filters'](_[_0x1a74('0x3e')](_0x5d3d23['query'],_0x1f44cf[_0x1a74('0x36')]),_0x2bb845);if(_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3f')]){_0x1f6b77[_0x1a74('0x3d')]=_[_0x1a74('0x40')](_0x1f6b77[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x2bb845,function(_0x3f9422){if(_0x3f9422[_0x1a74('0x33')]!==_0x1a74('0x41')){var _0x4c8147={};_0x4c8147[_0x3f9422[_0x1a74('0x2e')]]={'$like':'%'+_0x5d3d23[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x4c8147;}})});}_0x1f6b77=_['merge']({},_0x1f6b77,_0x5d3d23[_0x1a74('0x42')]);var _0x409c24={'where':_0x1f6b77[_0x1a74('0x3d')]};return db[_0x1a74('0x43')][_0x1a74('0x23')](_0x409c24)[_0x1a74('0x29')](function(_0x3c0dfd){_0x2f2357[_0x1a74('0x23')]=_0x3c0dfd;if(_0x5d3d23['query'][_0x1a74('0x44')]){_0x1f6b77['include']=[{'all':!![]}];}return db[_0x1a74('0x43')]['findAll'](_0x1f6b77);})[_0x1a74('0x29')](function(_0x289d8b){_0x2f2357[_0x1a74('0x45')]=_0x289d8b;return _0x2f2357;})[_0x1a74('0x29')](respondWithFilteredResult(_0x1a32bc,_0x1f6b77))[_0x1a74('0x46')](handleError(_0x1a32bc,null));};exports[_0x1a74('0x47')]=function(_0x152839,_0x6de81c){var _0x5a4e70={'raw':![],'where':{'id':_0x152839[_0x1a74('0x48')]['id']}},_0x59d04a={};_0x59d04a[_0x1a74('0x34')]=_['keys'](db[_0x1a74('0x43')][_0x1a74('0x31')]);_0x59d04a[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x152839['query']);_0x59d04a[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x59d04a[_0x1a74('0x34')],_0x59d04a['query']);_0x5a4e70[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x59d04a[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x152839[_0x1a74('0x35')][_0x1a74('0x39')]));_0x5a4e70[_0x1a74('0x38')]=_0x5a4e70[_0x1a74('0x38')]['length']?_0x5a4e70[_0x1a74('0x38')]:_0x59d04a[_0x1a74('0x34')];if(_0x152839[_0x1a74('0x35')][_0x1a74('0x44')]){_0x5a4e70[_0x1a74('0x4a')]=[{'all':!![]}];}_0x5a4e70=_[_0x1a74('0x40')]({},_0x5a4e70,_0x152839[_0x1a74('0x42')]);return db[_0x1a74('0x43')]['find'](_0x5a4e70)[_0x1a74('0x29')](handleEntityNotFound(_0x6de81c,null))[_0x1a74('0x29')](respondWithResult(_0x6de81c,null))[_0x1a74('0x46')](handleError(_0x6de81c,null));};exports[_0x1a74('0x4b')]=function(_0x3eafc7,_0x5a66b3){return db['CmList'][_0x1a74('0x4b')](_0x3eafc7['body'],{})['then'](function(_0x3692d6){var _0x1aed33=_0x3eafc7['user'][_0x1a74('0x2a')]({'plain':!![]});if(!_0x1aed33)throw new Error(_0x1a74('0x4c'));if(_0x1aed33[_0x1a74('0x4d')]==='user'){var _0x173b43=_0x3692d6[_0x1a74('0x2a')]({'plain':!![]});var _0xe5db6=_0x1a74('0x2b');return db[_0x1a74('0x4e')]['find']({'where':{'name':_0xe5db6,'userProfileId':_0x1aed33[_0x1a74('0x4f')]},'raw':!![]})['then'](function(_0x31950f){if(_0x31950f&&_0x31950f[_0x1a74('0x50')]===0x0){return db['UserProfileResource'][_0x1a74('0x4b')]({'name':_0x173b43[_0x1a74('0x2e')],'resourceId':_0x173b43['id'],'type':_0x31950f['name'],'sectionId':_0x31950f['id']},{})[_0x1a74('0x29')](function(){return _0x3692d6;});}else{return _0x3692d6;}})[_0x1a74('0x46')](function(_0xe47913){logger[_0x1a74('0x51')](_0x1a74('0x52'),_0xe47913);throw _0xe47913;});}return _0x3692d6;})[_0x1a74('0x29')](respondWithResult(_0x5a66b3,0xc9))[_0x1a74('0x46')](handleError(_0x5a66b3,null));};exports['update']=function(_0x4d5640,_0x23f3e7){if(_0x4d5640[_0x1a74('0x53')]['id']){delete _0x4d5640[_0x1a74('0x53')]['id'];}return db['CmList'][_0x1a74('0x54')]({'where':{'id':_0x4d5640['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x23f3e7,null))[_0x1a74('0x29')](saveUpdates(_0x4d5640[_0x1a74('0x53')],null))[_0x1a74('0x29')](respondWithResult(_0x23f3e7,null))[_0x1a74('0x46')](handleError(_0x23f3e7,null));};exports['destroy']=function(_0x52089c,_0x1ba85f){return db['CmList']['find']({'where':{'id':_0x52089c[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ba85f,null))[_0x1a74('0x29')](removeEntity(_0x1ba85f,null))[_0x1a74('0x46')](handleError(_0x1ba85f,null));};exports[_0x1a74('0x55')]=function(_0x678bff,_0x28f9be){return db[_0x1a74('0x43')][_0x1a74('0x55')]()['then'](respondWithResult(_0x28f9be,null))[_0x1a74('0x46')](handleError(_0x28f9be,null));};exports['addDisposition']=function(_0x29c39e,_0x1bd7a5,_0x3bb428){if(_0x29c39e[_0x1a74('0x53')]['id']){delete _0x29c39e['body']['id'];}return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x29c39e[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x1bd7a5,null))['then'](function(_0x25082e){if(_0x25082e){_0x29c39e['body']['ListId']=_0x25082e['id'];return db[_0x1a74('0x56')][_0x1a74('0x4b')](_0x29c39e[_0x1a74('0x53')]);}})[_0x1a74('0x29')](respondWithResult(_0x1bd7a5,null))[_0x1a74('0x46')](handleError(_0x1bd7a5,null));};exports[_0x1a74('0x57')]=function(_0x3a5370,_0x43d74e,_0x1e55da){var _0x4e3f88={'raw':![],'where':{}};var _0x35948f={};var _0x1789fb={'count':0x0,'rows':[]};return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x3a5370[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x43d74e,null))[_0x1a74('0x29')](function(_0x2f5836){if(_0x2f5836){_0x35948f[_0x1a74('0x34')]=_[_0x1a74('0x49')](db[_0x1a74('0x56')]['rawAttributes']);_0x35948f[_0x1a74('0x35')]=_['keys'](_0x3a5370[_0x1a74('0x35')]);_0x35948f[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x35948f[_0x1a74('0x34')],_0x35948f[_0x1a74('0x35')]);_0x4e3f88[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x35948f[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x3a5370[_0x1a74('0x35')][_0x1a74('0x39')]));_0x4e3f88[_0x1a74('0x38')]=_0x4e3f88['attributes'][_0x1a74('0x59')]?_0x4e3f88[_0x1a74('0x38')]:_0x35948f['model'];if(!_0x3a5370[_0x1a74('0x35')]['hasOwnProperty'](_0x1a74('0x3b'))){_0x4e3f88['limit']=qs[_0x1a74('0x24')](_0x3a5370[_0x1a74('0x35')][_0x1a74('0x24')]);_0x4e3f88[_0x1a74('0x21')]=qs['offset'](_0x3a5370['query'][_0x1a74('0x21')]);}_0x4e3f88[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x3a5370['query'][_0x1a74('0x3c')]);_0x4e3f88[_0x1a74('0x3d')]=qs[_0x1a74('0x36')](_[_0x1a74('0x3e')](_0x3a5370[_0x1a74('0x35')],_0x35948f[_0x1a74('0x36')]));_0x4e3f88[_0x1a74('0x3d')][_0x1a74('0x5b')]=_0x2f5836['id'];if(_0x3a5370[_0x1a74('0x35')][_0x1a74('0x3f')]){_0x4e3f88[_0x1a74('0x3d')]=_[_0x1a74('0x40')](_0x4e3f88[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x4e3f88[_0x1a74('0x38')],function(_0x41eb1a){var _0x3af208={};_0x3af208[_0x41eb1a]={'$like':'%'+_0x3a5370[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x3af208;})});}_0x4e3f88=_[_0x1a74('0x40')]({},_0x4e3f88,_0x3a5370[_0x1a74('0x42')]);return db[_0x1a74('0x56')][_0x1a74('0x23')]({'where':_0x4e3f88['where']})[_0x1a74('0x29')](function(_0x42a138){_0x1789fb[_0x1a74('0x23')]=_0x42a138;if(_0x3a5370[_0x1a74('0x35')][_0x1a74('0x44')]){_0x4e3f88['include']=[{'all':!![]}];}return db[_0x1a74('0x56')][_0x1a74('0x5c')](_0x4e3f88);})[_0x1a74('0x29')](function(_0x4ded41){_0x1789fb[_0x1a74('0x45')]=_0x4ded41;return _0x1789fb;});}})[_0x1a74('0x29')](respondWithFilteredResult(_0x43d74e,_0x4e3f88))[_0x1a74('0x46')](handleError(_0x43d74e,null));};exports[_0x1a74('0x5d')]=function(_0x179cd3,_0x10ef5f,_0x402012){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x179cd3[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x10ef5f,null))[_0x1a74('0x29')](function(_0x2db532){if(_0x2db532){return _0x2db532[_0x1a74('0x5d')](_0x179cd3['query']['ids']);}})[_0x1a74('0x29')](respondWithStatusCode(_0x10ef5f,null))[_0x1a74('0x46')](handleError(_0x10ef5f,null));};exports[_0x1a74('0x5e')]=function(_0x54ace3,_0x560c23,_0x9fe661){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x54ace3[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x560c23,null))['then'](function(_0x186332){if(_0x186332){var _0x2d7895=[];var _0x3e4594={'success':[],'errors':[]};return db[_0x1a74('0x5f')][_0x1a74('0x55')]()[_0x1a74('0x29')](function(_0x18d932){if(_0x54ace3[_0x1a74('0x53')][_0x1a74('0x60')]&&_[_0x1a74('0x61')](_0x54ace3[_0x1a74('0x53')][_0x1a74('0x60')])){if(_0x54ace3[_0x1a74('0x53')]['tags'][_0x1a74('0x59')]){_0x54ace3['body'][_0x1a74('0x60')]=_0x54ace3[_0x1a74('0x53')]['tags'][_0x1a74('0x62')](';')+';';}else{_0x54ace3[_0x1a74('0x53')]['tags']=null;}}else{_0x54ace3['body'][_0x1a74('0x60')]=null;}if(_0x54ace3['body']&&_[_0x1a74('0x61')](_0x54ace3[_0x1a74('0x53')])){for(var _0x47c42c=0x0;_0x47c42c<_0x54ace3['body'][_0x1a74('0x59')];_0x47c42c+=0x1){_0x54ace3['body'][_0x47c42c]['ListId']=_0x54ace3['params']['id'];_0x2d7895[_0x1a74('0x63')](_0x54ace3[_0x1a74('0x53')][_0x47c42c]);}return BPromise[_0x1a74('0x64')](_0x2d7895,function(_0x48d380){return db[_0x1a74('0x5f')][_0x1a74('0x4b')](_[_0x1a74('0x65')](_0x48d380,[_0x1a74('0x66'),'id'])||{},{'fields':_[_0x1a74('0x49')](_0x18d932),'raw':!![]})['then'](function(_0x5f1ebc){_0x3e4594['success']['push'](_0x5f1ebc['dataValues']);})[_0x1a74('0x46')](function(_0x4597ac){_0x3e4594[_0x1a74('0x67')][_0x1a74('0x63')]({'data':_0x48d380,'error':_0x4597ac[_0x1a74('0x68')]});});})[_0x1a74('0x29')](function(_0x15d2ff){return _0x3e4594;})[_0x1a74('0x46')](function(_0x49c49b){return _0x49c49b;});}else{_0x560c23[_0x1a74('0x1f')](0x190)['json']({'message':_0x1a74('0x69')});}});}})[_0x1a74('0x29')](respondWithResult(_0x560c23,null))[_0x1a74('0x46')](handleError(_0x560c23,null));};exports[_0x1a74('0x6a')]=function(_0x1cf0b4,_0x3f7d52,_0x213d0b){var _0x3da01d;return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x1cf0b4['params']['id']},'include':[{'model':db[_0x1a74('0x6b')],'as':_0x1a74('0x6c')}]})[_0x1a74('0x29')](handleEntityNotFound(_0x3f7d52,null))[_0x1a74('0x29')](function(_0xb724f9){if(_0xb724f9){_0x3da01d=_0xb724f9;return db['CmContact'][_0x1a74('0x31')];}})[_0x1a74('0x29')](function(_0x4f7a1f){if(_0x4f7a1f){var _0x464652={};var _0x3303ee={};_0x3303ee[_0x1a74('0x34')]=_['concat'](_['keys'](_0x4f7a1f),_[_0x1a74('0x30')](_0x3da01d[_0x1a74('0x6c')],function(_0x151472){return util[_0x1a74('0x6d')](_0x1a74('0x6e'),_0x151472['id']);}));_0x3303ee[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x1cf0b4['query']);_0x3303ee['filters']=_[_0x1a74('0x37')](_0x3303ee[_0x1a74('0x34')],_0x3303ee[_0x1a74('0x35')]);_0x464652['attributes']=_[_0x1a74('0x37')](_0x3303ee['model'],qs[_0x1a74('0x39')](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x39')]));_0x464652[_0x1a74('0x38')]=_0x464652['attributes'][_0x1a74('0x59')]?_0x464652[_0x1a74('0x38')]:_0x3303ee[_0x1a74('0x34')];if(!_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x464652[_0x1a74('0x24')]=qs[_0x1a74('0x24')](_0x1cf0b4[_0x1a74('0x35')]['limit']);_0x464652[_0x1a74('0x21')]=qs['offset'](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x21')]);}_0x464652[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x1cf0b4[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x464652['where']=qs[_0x1a74('0x36')](_['pick'](_0x1cf0b4[_0x1a74('0x35')],_0x3303ee[_0x1a74('0x36')]));_0x464652['raw']=!![];if(_0x1cf0b4[_0x1a74('0x35')]['filter']){_0x464652['where']=_[_0x1a74('0x40')](_0x464652[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x464652['attributes'],function(_0x4a0234){var _0x23813d={};_0x23813d[_0x4a0234]={'$like':'%'+_0x1cf0b4[_0x1a74('0x35')]['filter']+'%'};return _0x23813d;})});}_0x464652=_[_0x1a74('0x40')]({},_0x464652,_0x1cf0b4[_0x1a74('0x42')]);return _0x3da01d[_0x1a74('0x6a')](_0x464652);}})[_0x1a74('0x29')](respondWithResult(_0x3f7d52,null))[_0x1a74('0x46')](handleError(_0x3f7d52,null));};exports[_0x1a74('0x6f')]=function(_0x3c0b60,_0x5827d3,_0x233ee9){var _0x496e45;var _0x5308c0;var _0x4f276b;var _0x145d7e=_0x3c0b60[_0x1a74('0x48')]['id'];csv_results=[];return db[_0x1a74('0x70')]['findAll']({'attributes':['id',_0x1a74('0x2e')],'raw':!![],'order':['OrderBy']})[_0x1a74('0x29')](function(_0x4011b5){_0x496e45=_0x4011b5;var _0x1d9e64=_[_0x1a74('0x49')](db['CmContact'][_0x1a74('0x31')]);return db[_0x1a74('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x1a74('0x71')]})[_0x1a74('0x29')](function(_0x5b15ad){_0x5308c0=_0x5b15ad;var _0x3e2b21=squel[_0x1a74('0x72')]()[_0x1a74('0x39')](_0x1d9e64)[_0x1a74('0x73')](_0x1a74('0x74'),'c')[_0x1a74('0x3d')](_0x1a74('0x75'),_0x145d7e)[_0x1a74('0x3d')](_0x1a74('0x76'))[_0x1a74('0x77')]();for(var _0x1b5b0f=0x0;_0x1b5b0f<_0x5308c0[_0x1a74('0x59')];_0x1b5b0f++){_0x3e2b21[_0x1a74('0x78')](_0x1a74('0x79')+_0x5308c0[_0x1b5b0f]['id'],_0x1a74('0x7a')+_0x5308c0[_0x1b5b0f][_0x1a74('0x71')]);}for(var _0x1b5b0f=0x0;_0x1b5b0f<_0x496e45[_0x1a74('0x59')];_0x1b5b0f++){_0x3e2b21['field'](squel['select']()[_0x1a74('0x78')](_0x1a74('0x7b'))[_0x1a74('0x73')](_0x1a74('0x7c'))[_0x1a74('0x3d')](_0x1a74('0x7d'),_0x496e45[_0x1b5b0f]['id'])['where'](_0x1a74('0x7e')),_0x1a74('0x7f')+_0x496e45[_0x1b5b0f][_0x1a74('0x2e')]);_0x3e2b21[_0x1a74('0x78')](squel[_0x1a74('0x72')]()[_0x1a74('0x78')]('description')['from'](_0x1a74('0x7c'))[_0x1a74('0x3d')](_0x1a74('0x7d'),_0x496e45[_0x1b5b0f]['id'])[_0x1a74('0x3d')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x496e45[_0x1b5b0f][_0x1a74('0x2e')]);}var _0x5cc43e=[];_0x5cc43e[_0x1a74('0x63')](_0x3e2b21[_0x1a74('0x80')]());BPromise[_0x1a74('0x64')](_0x5cc43e,handleQuery)['then'](function(_0x414ae3){handleQuery(_0x3e2b21[_0x1a74('0x80')]());var _0x502851=csv_results[0x0];if(!_[_0x1a74('0x81')](_0x502851)){var _0x4e64bc=toCsv(_0x502851);var _0x14a59c=Date[_0x1a74('0x82')]();fs['writeFileSync'](util[_0x1a74('0x6d')]('/tmp/list_%d_%s.csv',_0x145d7e,_0x14a59c),_0x4e64bc);_0x5827d3[_0x1a74('0x83')](_0x1a74('0x84'),'attachment;\x20filename='+util[_0x1a74('0x6d')]('list_%d_%s.csv',_0x145d7e,_0x14a59c));_0x5827d3['setHeader']('Content-type',_0x1a74('0x85'));return _0x5827d3[_0x1a74('0x86')](util[_0x1a74('0x6d')](_0x1a74('0x87'),_0x145d7e,_0x14a59c));}else{return _0x5827d3[_0x1a74('0x88')](0xcc);}});});});};exports['addCustomField']=function(_0x16e8a3,_0x1a187e,_0x2f52cf){var _0x288d05;delete _0x16e8a3[_0x1a74('0x53')]['id'];return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x16e8a3['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x1a187e,null))[_0x1a74('0x29')](function(_0x52e888){if(_0x52e888){return db[_0x1a74('0x89')][_0x1a74('0x8a')](function(_0x28c3a8){return db[_0x1a74('0x6b')]['create'](_0x16e8a3[_0x1a74('0x53')],{'transaction':_0x28c3a8})['then'](function(_0x2b6f36){_0x288d05=_0x2b6f36;return _0x52e888[_0x1a74('0x8b')](_0x2b6f36,{'transaction':_0x28c3a8});})['then'](function(){var _0x4c0147={'type':db[_0x1a74('0x8c')]['TEXT'],'transaction':_0x28c3a8};switch(_0x16e8a3[_0x1a74('0x53')][_0x1a74('0x33')]){case _0x1a74('0x8d'):_0x4c0147[_0x1a74('0x33')]=db[_0x1a74('0x8c')][_0x1a74('0x8e')];break;case'number':_0x4c0147[_0x1a74('0x33')]=db[_0x1a74('0x8c')][_0x1a74('0x8f')];break;case _0x1a74('0x90'):_0x4c0147[_0x1a74('0x33')]=db['Sequelize'][_0x1a74('0x91')];_0x4c0147[_0x1a74('0x92')]=![];break;default:}return db[_0x1a74('0x89')]['queryInterface'][_0x1a74('0x93')](_0x1a74('0x74'),util[_0x1a74('0x6d')](_0x1a74('0x94'),_0x288d05['id']),_0x4c0147);})['then'](function(){return _0x288d05;});});}})[_0x1a74('0x29')](respondWithResult(_0x1a187e,null))[_0x1a74('0x46')](handleError(_0x1a187e,null));};exports[_0x1a74('0x95')]=function(_0x5c972c,_0x47595c,_0x74915d){var _0x11ba92={};var _0x52aa00={};var _0x754078;var _0x3b6e63;return db[_0x1a74('0x43')][_0x1a74('0x58')]({'where':{'id':_0x5c972c[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x47595c,null))['then'](function(_0x43435e){if(_0x43435e){_0x754078=_0x43435e;_0x52aa00['model']=_[_0x1a74('0x49')](db[_0x1a74('0x6b')]['rawAttributes']);_0x52aa00[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x5c972c[_0x1a74('0x35')]);_0x52aa00[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x52aa00[_0x1a74('0x34')],_0x52aa00[_0x1a74('0x35')]);_0x11ba92[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x52aa00['model'],qs[_0x1a74('0x39')](_0x5c972c[_0x1a74('0x35')]['fields']));_0x11ba92['attributes']=_0x11ba92['attributes'][_0x1a74('0x59')]?_0x11ba92[_0x1a74('0x38')]:_0x52aa00['model'];_0x11ba92[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x5c972c['query']['sort']);_0x11ba92[_0x1a74('0x3d')]=qs[_0x1a74('0x36')](_[_0x1a74('0x3e')](_0x5c972c['query'],_0x52aa00[_0x1a74('0x36')]));_0x11ba92['where']=_[_0x1a74('0x40')](_0x11ba92[_0x1a74('0x3d')],{'$or':[{'ListId':_0x43435e['id']},{'ListId':null}]});if(_0x5c972c[_0x1a74('0x35')]['filter']){_0x11ba92['where']=_[_0x1a74('0x40')](_0x11ba92[_0x1a74('0x3d')],{'$or':_[_0x1a74('0x30')](_0x11ba92['attributes'],function(_0x3154cc){var _0x2ff09a={};_0x2ff09a[_0x3154cc]={'$like':'%'+_0x5c972c[_0x1a74('0x35')][_0x1a74('0x3f')]+'%'};return _0x2ff09a;})});}_0x11ba92=_[_0x1a74('0x40')]({},_0x11ba92,_0x5c972c['options']);return db[_0x1a74('0x6b')]['findAndCountAll'](_0x11ba92);}})['then'](respondWithResult(_0x47595c,null))['catch'](handleError(_0x47595c,null));};exports[_0x1a74('0x96')]=function(_0x792c23,_0x3a1d8f){return db['CmCustomField'][_0x1a74('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3a1d8f,null))[_0x1a74('0x29')](function(_0x52dff8){return _0x52dff8;})[_0x1a74('0x29')](respondWithResult(_0x3a1d8f,null))[_0x1a74('0x46')](handleError(_0x3a1d8f,null));};exports['addAgents']=function(_0x9d5217,_0x2cb7a6,_0x5ccc21){return db[_0x1a74('0x43')][_0x1a74('0x54')]({'where':{'id':_0x9d5217[_0x1a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x2cb7a6,null))[_0x1a74('0x29')](function(_0x4bd86e){if(_0x4bd86e){return _0x4bd86e[_0x1a74('0x98')](_0x9d5217['body'][_0x1a74('0x66')],_[_0x1a74('0x65')](_0x9d5217[_0x1a74('0x53')],['ids','id'])||{})[_0x1a74('0x99')](function(_0x490858){for(var _0x528cba=0x0;_0x528cba<_0x9d5217['body'][_0x1a74('0x66')][_0x1a74('0x59')];_0x528cba+=0x1){socket['emit'](_0x1a74('0x9a'),{'UserId':Number(_0x9d5217[_0x1a74('0x53')]['ids'][_0x528cba]),'CmListId':Number(_0x9d5217[_0x1a74('0x48')]['id'])});}return _0x490858;});}})[_0x1a74('0x29')](respondWithResult(_0x2cb7a6,null))['catch'](handleError(_0x2cb7a6,null));};exports[_0x1a74('0x9b')]=function(_0x3b4396,_0xfa0fdd,_0x5a6402){return db['CmList'][_0x1a74('0x54')]({'where':{'id':_0x3b4396[_0x1a74('0x48')]['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0xfa0fdd,null))['then'](function(_0x3ac377){if(_0x3ac377){return _0x3ac377[_0x1a74('0x9b')](_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')])[_0x1a74('0x29')](function(){if(_[_0x1a74('0x61')](_0x3b4396['query']['ids'])){for(var _0x5c176c=0x0;_0x5c176c<_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')][_0x1a74('0x59')];_0x5c176c+=0x1){socket[_0x1a74('0x9c')](_0x1a74('0x9d'),{'UserId':Number(_0x3b4396[_0x1a74('0x35')][_0x1a74('0x66')][_0x5c176c]),'CmListId':Number(_0x3b4396[_0x1a74('0x48')]['id'])});}}else{socket[_0x1a74('0x9c')](_0x1a74('0x9d'),{'UserId':Number(_0x3b4396['query']['ids']),'CmListId':Number(_0x3b4396[_0x1a74('0x48')]['id'])});}});}})[_0x1a74('0x29')](respondWithStatusCode(_0xfa0fdd,null))[_0x1a74('0x46')](handleError(_0xfa0fdd,null));};exports[_0x1a74('0x9e')]=function(_0x359fd5,_0x4bcc9d,_0xfb451b){var _0x3075bb={};var _0x19266a={};var _0x1c143c;var _0x476236;return db[_0x1a74('0x43')]['findOne']({'where':{'id':_0x359fd5['params']['id']}})[_0x1a74('0x29')](handleEntityNotFound(_0x4bcc9d,null))[_0x1a74('0x29')](function(_0x4257f3){if(_0x4257f3){_0x1c143c=_0x4257f3;_0x19266a[_0x1a74('0x34')]=_[_0x1a74('0x49')](db[_0x1a74('0x9f')][_0x1a74('0x31')]);_0x19266a[_0x1a74('0x35')]=_[_0x1a74('0x49')](_0x359fd5['query']);_0x19266a[_0x1a74('0x36')]=_[_0x1a74('0x37')](_0x19266a[_0x1a74('0x34')],_0x19266a[_0x1a74('0x35')]);_0x3075bb[_0x1a74('0x38')]=_[_0x1a74('0x37')](_0x19266a[_0x1a74('0x34')],qs[_0x1a74('0x39')](_0x359fd5['query'][_0x1a74('0x39')]));_0x3075bb[_0x1a74('0x38')]=_0x3075bb[_0x1a74('0x38')]['length']?_0x3075bb[_0x1a74('0x38')]:_0x19266a[_0x1a74('0x34')];_0x3075bb[_0x1a74('0x5a')]=qs[_0x1a74('0x3c')](_0x359fd5[_0x1a74('0x35')][_0x1a74('0x3c')]);_0x3075bb['where']=qs[_0x1a74('0x36')](_['pick'](_0x359fd5[_0x1a74('0x35')],_0x19266a[_0x1a74('0x36')]));if(_0x359fd5['query'][_0x1a74('0x3f')]){_0x3075bb[_0x1a74('0x3d')]=_['merge'](_0x3075bb['where'],{'$or':_['map'](_0x3075bb[_0x1a74('0x38')],function(_0x99365e){var _0x872660={};_0x872660[_0x99365e]={'$like':'%'+_0x359fd5['query'][_0x1a74('0x3f')]+'%'};return _0x872660;})});}_0x3075bb=_[_0x1a74('0x40')]({},_0x3075bb,_0x359fd5[_0x1a74('0x42')]);return _0x1c143c[_0x1a74('0x9e')](_0x3075bb);}})['then'](function(_0x15fd06){if(_0x15fd06){_0x476236=_0x15fd06[_0x1a74('0x59')];if(!_0x359fd5[_0x1a74('0x35')][_0x1a74('0x3a')](_0x1a74('0x3b'))){_0x3075bb[_0x1a74('0x24')]=qs[_0x1a74('0x24')](_0x359fd5[_0x1a74('0x35')]['limit']);_0x3075bb['offset']=qs[_0x1a74('0x21')](_0x359fd5[_0x1a74('0x35')][_0x1a74('0x21')]);}return _0x1c143c[_0x1a74('0x9e')](_0x3075bb);}})[_0x1a74('0x29')](function(_0x4fb300){if(_0x4fb300){return _0x4fb300?{'count':_0x476236,'rows':_0x4fb300}:null;}})[_0x1a74('0x29')](respondWithResult(_0x4bcc9d,null))[_0x1a74('0x46')](handleError(_0x4bcc9d,null));};function handleQuery(_0x5be23b){logger['info'](_0x5be23b);return db[_0x1a74('0x89')][_0x1a74('0x35')](_0x5be23b)['spread'](function(_0x7d2276){csv_results['push'](_0x7d2276);})[_0x1a74('0x46')](function(_0x1f4f6f){logger['error'](_0x1f4f6f[_0x1a74('0x68')]);});} \ No newline at end of file +var _0x2b38=['findOne','sort','pick','Disposition','findAll','removeDispositions','ids','addContacts','tags','join','isArray','push','each','CmContact','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','spread','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','then','get','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','include','rows','catch','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ListId','getDispositions'];(function(_0xafcf00,_0x4429a3){var _0x513af4=function(_0x59554d){while(--_0x59554d){_0xafcf00['push'](_0xafcf00['shift']());}};_0x513af4(++_0x4429a3);}(_0x2b38,0x19f));var _0x82b3=function(_0x38ebc9,_0x10e207){_0x38ebc9=_0x38ebc9-0x0;var _0x3fcea4=_0x2b38[_0x38ebc9];return _0x3fcea4;};'use strict';var emlformat=require(_0x82b3('0x0'));var rimraf=require(_0x82b3('0x1'));var zipdir=require(_0x82b3('0x2'));var jsonpatch=require(_0x82b3('0x3'));var rp=require(_0x82b3('0x4'));var moment=require(_0x82b3('0x5'));var BPromise=require(_0x82b3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x82b3('0x7'));var csv=require('to-csv');var ejs=require(_0x82b3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82b3('0x9'));var squel=require('squel');var crypto=require(_0x82b3('0xa'));var jsforce=require(_0x82b3('0xb'));var deskjs=require(_0x82b3('0xc'));var toCsv=require(_0x82b3('0xd'));var querystring=require(_0x82b3('0xe'));var Papa=require(_0x82b3('0xf'));var Redis=require(_0x82b3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x82b3('0x11'));var as=require(_0x82b3('0x12'));var hardwareService=require(_0x82b3('0x13'));var logger=require(_0x82b3('0x14'))(_0x82b3('0x15'));var utils=require(_0x82b3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x82b3('0x17'))['db'];var csv_results;config[_0x82b3('0x18')]=_[_0x82b3('0x19')](config[_0x82b3('0x18')],{'host':_0x82b3('0x1a'),'port':0x18eb});var socket=require(_0x82b3('0x1b'))(new Redis(config[_0x82b3('0x18')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x1d0992,_0x5621a4){_0x5621a4=_0x5621a4||0xcc;return function(_0x3b8734){if(_0x3b8734){return _0x1d0992[_0x82b3('0x1c')](_0x5621a4);}return _0x1d0992['status'](_0x5621a4)[_0x82b3('0x1d')]();};}function respondWithResult(_0x4e815b,_0x5b3e67){_0x5b3e67=_0x5b3e67||0xc8;return function(_0x45c728){if(_0x45c728){return _0x4e815b[_0x82b3('0x1e')](_0x5b3e67)['json'](_0x45c728);}};}function respondWithFilteredResult(_0x2db983,_0x362ef5){return function(_0x1ad13d){if(_0x1ad13d){var _0xefeab3=typeof _0x362ef5[_0x82b3('0x1f')]===_0x82b3('0x20')&&typeof _0x362ef5[_0x82b3('0x21')]===_0x82b3('0x20');var _0x42d3f2=_0x1ad13d[_0x82b3('0x22')];var _0x430e88=_0xefeab3?0x0:_0x362ef5[_0x82b3('0x1f')];var _0x45a844=_0xefeab3?_0x1ad13d['count']:_0x362ef5['offset']+_0x362ef5[_0x82b3('0x21')];var _0x1994f6;if(_0x45a844>=_0x42d3f2){_0x45a844=_0x42d3f2;_0x1994f6=0xc8;}else{_0x1994f6=0xce;}_0x2db983[_0x82b3('0x1e')](_0x1994f6);return _0x2db983['set'](_0x82b3('0x23'),_0x430e88+'-'+_0x45a844+'/'+_0x42d3f2)[_0x82b3('0x24')](_0x1ad13d);}return null;};}function patchUpdates(_0xdc8ef9){return function(_0x165b09){try{jsonpatch[_0x82b3('0x25')](_0x165b09,_0xdc8ef9,!![]);}catch(_0x3b23eb){return BPromise['reject'](_0x3b23eb);}return _0x165b09['save']();};}function saveUpdates(_0x2ce313,_0x2c46e6){return function(_0x3c84c8){if(_0x3c84c8){return _0x3c84c8[_0x82b3('0x26')](_0x2ce313)['then'](function(_0x396d03){return _0x396d03;});}return null;};}function removeEntity(_0x456d32,_0x5b8ec1){return function(_0x4a4249){if(_0x4a4249){return _0x4a4249[_0x82b3('0x27')]()[_0x82b3('0x28')](function(){var _0x535645=_0x4a4249[_0x82b3('0x29')]({'plain':!![]});var _0x5a6ec2=_0x82b3('0x2a');return db['UserProfileResource'][_0x82b3('0x27')]({'where':{'type':_0x5a6ec2,'resourceId':_0x535645['id']}})[_0x82b3('0x28')](function(){return _0x4a4249;});})[_0x82b3('0x28')](function(){_0x456d32[_0x82b3('0x1e')](0xcc)[_0x82b3('0x1d')]();});}};}function handleEntityNotFound(_0x166b03,_0x5b67c2){return function(_0x3935c1){if(!_0x3935c1){_0x166b03[_0x82b3('0x1c')](0x194);}return _0x3935c1;};}function handleError(_0x42c241,_0x324b76){_0x324b76=_0x324b76||0x1f4;return function(_0x38797c){logger[_0x82b3('0x2b')](_0x38797c[_0x82b3('0x2c')]);if(_0x38797c[_0x82b3('0x2d')]){delete _0x38797c[_0x82b3('0x2d')];}_0x42c241[_0x82b3('0x1e')](_0x324b76)[_0x82b3('0x2e')](_0x38797c);};}exports[_0x82b3('0x2f')]=function(_0x181695,_0x54d2ff){var _0x118ed7={},_0x2b8d2c={},_0x4905d4={'count':0x0,'rows':[]};var _0x1d7836=_[_0x82b3('0x30')](db[_0x82b3('0x31')][_0x82b3('0x32')],function(_0x1aa27c){return{'name':_0x1aa27c[_0x82b3('0x33')],'type':_0x1aa27c[_0x82b3('0x34')][_0x82b3('0x35')]};});_0x2b8d2c[_0x82b3('0x36')]=_[_0x82b3('0x30')](_0x1d7836,'name');_0x2b8d2c['query']=_[_0x82b3('0x37')](_0x181695['query']);_0x2b8d2c[_0x82b3('0x38')]=_[_0x82b3('0x39')](_0x2b8d2c[_0x82b3('0x36')],_0x2b8d2c[_0x82b3('0x3a')]);_0x118ed7[_0x82b3('0x3b')]=_['intersection'](_0x2b8d2c['model'],qs[_0x82b3('0x3c')](_0x181695[_0x82b3('0x3a')]['fields']));_0x118ed7['attributes']=_0x118ed7[_0x82b3('0x3b')][_0x82b3('0x3d')]?_0x118ed7[_0x82b3('0x3b')]:_0x2b8d2c[_0x82b3('0x36')];if(!_0x181695[_0x82b3('0x3a')][_0x82b3('0x3e')](_0x82b3('0x3f'))){_0x118ed7[_0x82b3('0x21')]=qs[_0x82b3('0x21')](_0x181695[_0x82b3('0x3a')][_0x82b3('0x21')]);_0x118ed7['offset']=qs[_0x82b3('0x1f')](_0x181695[_0x82b3('0x3a')][_0x82b3('0x1f')]);}_0x118ed7[_0x82b3('0x40')]=qs['sort'](_0x181695[_0x82b3('0x3a')]['sort']);_0x118ed7['where']=qs[_0x82b3('0x38')](_['pick'](_0x181695[_0x82b3('0x3a')],_0x2b8d2c[_0x82b3('0x38')]),_0x1d7836);if(_0x181695[_0x82b3('0x3a')][_0x82b3('0x41')]){_0x118ed7[_0x82b3('0x42')]=_[_0x82b3('0x43')](_0x118ed7[_0x82b3('0x42')],{'$or':_[_0x82b3('0x30')](_0x1d7836,function(_0x3fc289){if(_0x3fc289[_0x82b3('0x34')]!==_0x82b3('0x44')){var _0x23c646={};_0x23c646[_0x3fc289[_0x82b3('0x2d')]]={'$like':'%'+_0x181695[_0x82b3('0x3a')][_0x82b3('0x41')]+'%'};return _0x23c646;}})});}_0x118ed7=_[_0x82b3('0x43')]({},_0x118ed7,_0x181695['options']);var _0x21bc4f={'where':_0x118ed7[_0x82b3('0x42')]};return db[_0x82b3('0x31')]['count'](_0x21bc4f)['then'](function(_0x3c5d11){_0x4905d4[_0x82b3('0x22')]=_0x3c5d11;if(_0x181695['query']['includeAll']){_0x118ed7[_0x82b3('0x45')]=[{'all':!![]}];}return db[_0x82b3('0x31')]['findAll'](_0x118ed7);})['then'](function(_0x4f8f6e){_0x4905d4[_0x82b3('0x46')]=_0x4f8f6e;return _0x4905d4;})['then'](respondWithFilteredResult(_0x54d2ff,_0x118ed7))[_0x82b3('0x47')](handleError(_0x54d2ff,null));};exports['show']=function(_0x35f3d5,_0x10c3f3){var _0x60709a={'raw':![],'where':{'id':_0x35f3d5[_0x82b3('0x48')]['id']}},_0xbf049a={};_0xbf049a[_0x82b3('0x36')]=_[_0x82b3('0x37')](db['CmList'][_0x82b3('0x32')]);_0xbf049a[_0x82b3('0x3a')]=_[_0x82b3('0x37')](_0x35f3d5[_0x82b3('0x3a')]);_0xbf049a[_0x82b3('0x38')]=_[_0x82b3('0x39')](_0xbf049a[_0x82b3('0x36')],_0xbf049a['query']);_0x60709a[_0x82b3('0x3b')]=_[_0x82b3('0x39')](_0xbf049a['model'],qs['fields'](_0x35f3d5[_0x82b3('0x3a')][_0x82b3('0x3c')]));_0x60709a[_0x82b3('0x3b')]=_0x60709a['attributes'][_0x82b3('0x3d')]?_0x60709a[_0x82b3('0x3b')]:_0xbf049a[_0x82b3('0x36')];if(_0x35f3d5[_0x82b3('0x3a')][_0x82b3('0x49')]){_0x60709a[_0x82b3('0x45')]=[{'all':!![]}];}_0x60709a=_[_0x82b3('0x43')]({},_0x60709a,_0x35f3d5[_0x82b3('0x4a')]);return db[_0x82b3('0x31')][_0x82b3('0x4b')](_0x60709a)['then'](handleEntityNotFound(_0x10c3f3,null))['then'](respondWithResult(_0x10c3f3,null))[_0x82b3('0x47')](handleError(_0x10c3f3,null));};exports[_0x82b3('0x4c')]=function(_0x190570,_0x3f5c88){return db[_0x82b3('0x31')]['create'](_0x190570[_0x82b3('0x4d')],{})[_0x82b3('0x28')](function(_0x561ccf){var _0x15a594=_0x190570[_0x82b3('0x4e')][_0x82b3('0x29')]({'plain':!![]});if(!_0x15a594)throw new Error(_0x82b3('0x4f'));if(_0x15a594[_0x82b3('0x50')]===_0x82b3('0x4e')){var _0x10a027=_0x561ccf[_0x82b3('0x29')]({'plain':!![]});var _0xf7abca='Lists';return db[_0x82b3('0x51')][_0x82b3('0x4b')]({'where':{'name':_0xf7abca,'userProfileId':_0x15a594[_0x82b3('0x52')]},'raw':!![]})['then'](function(_0x19b6b8){if(_0x19b6b8&&_0x19b6b8[_0x82b3('0x53')]===0x0){return db[_0x82b3('0x54')][_0x82b3('0x4c')]({'name':_0x10a027[_0x82b3('0x2d')],'resourceId':_0x10a027['id'],'type':_0x19b6b8[_0x82b3('0x2d')],'sectionId':_0x19b6b8['id']},{})[_0x82b3('0x28')](function(){return _0x561ccf;});}else{return _0x561ccf;}})[_0x82b3('0x47')](function(_0x32d21d){logger[_0x82b3('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32d21d);throw _0x32d21d;});}return _0x561ccf;})[_0x82b3('0x28')](respondWithResult(_0x3f5c88,0xc9))[_0x82b3('0x47')](handleError(_0x3f5c88,null));};exports[_0x82b3('0x26')]=function(_0x3dad63,_0xc5d53a){if(_0x3dad63[_0x82b3('0x4d')]['id']){delete _0x3dad63[_0x82b3('0x4d')]['id'];}return db['CmList'][_0x82b3('0x4b')]({'where':{'id':_0x3dad63['params']['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0xc5d53a,null))['then'](saveUpdates(_0x3dad63[_0x82b3('0x4d')],null))[_0x82b3('0x28')](respondWithResult(_0xc5d53a,null))[_0x82b3('0x47')](handleError(_0xc5d53a,null));};exports['destroy']=function(_0x458be1,_0x3ecff2){return db[_0x82b3('0x31')][_0x82b3('0x4b')]({'where':{'id':_0x458be1[_0x82b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ecff2,null))[_0x82b3('0x28')](removeEntity(_0x3ecff2,null))[_0x82b3('0x47')](handleError(_0x3ecff2,null));};exports['describe']=function(_0x448c47,_0x45d6b0){return db[_0x82b3('0x31')][_0x82b3('0x55')]()[_0x82b3('0x28')](respondWithResult(_0x45d6b0,null))[_0x82b3('0x47')](handleError(_0x45d6b0,null));};exports[_0x82b3('0x56')]=function(_0x8ad350,_0x368a05,_0x2ff061){if(_0x8ad350[_0x82b3('0x4d')]['id']){delete _0x8ad350[_0x82b3('0x4d')]['id'];}return db[_0x82b3('0x31')]['find']({'where':{'id':_0x8ad350[_0x82b3('0x48')]['id']}})['then'](handleEntityNotFound(_0x368a05,null))[_0x82b3('0x28')](function(_0x4052fc){if(_0x4052fc){_0x8ad350[_0x82b3('0x4d')][_0x82b3('0x57')]=_0x4052fc['id'];return db['Disposition'][_0x82b3('0x4c')](_0x8ad350[_0x82b3('0x4d')]);}})[_0x82b3('0x28')](respondWithResult(_0x368a05,null))['catch'](handleError(_0x368a05,null));};exports[_0x82b3('0x58')]=function(_0x4ec91d,_0x534dad,_0x358658){var _0x535306={'raw':![],'where':{}};var _0x5a4fc0={};var _0x3e4667={'count':0x0,'rows':[]};return db['CmList'][_0x82b3('0x59')]({'where':{'id':_0x4ec91d[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x534dad,null))[_0x82b3('0x28')](function(_0x2a19c8){if(_0x2a19c8){_0x5a4fc0[_0x82b3('0x36')]=_[_0x82b3('0x37')](db['Disposition'][_0x82b3('0x32')]);_0x5a4fc0[_0x82b3('0x3a')]=_[_0x82b3('0x37')](_0x4ec91d['query']);_0x5a4fc0[_0x82b3('0x38')]=_['intersection'](_0x5a4fc0['model'],_0x5a4fc0[_0x82b3('0x3a')]);_0x535306[_0x82b3('0x3b')]=_[_0x82b3('0x39')](_0x5a4fc0['model'],qs[_0x82b3('0x3c')](_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x3c')]));_0x535306[_0x82b3('0x3b')]=_0x535306[_0x82b3('0x3b')]['length']?_0x535306['attributes']:_0x5a4fc0['model'];if(!_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x3e')](_0x82b3('0x3f'))){_0x535306[_0x82b3('0x21')]=qs[_0x82b3('0x21')](_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x21')]);_0x535306[_0x82b3('0x1f')]=qs[_0x82b3('0x1f')](_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x1f')]);}_0x535306['order']=qs[_0x82b3('0x5a')](_0x4ec91d['query'][_0x82b3('0x5a')]);_0x535306[_0x82b3('0x42')]=qs[_0x82b3('0x38')](_[_0x82b3('0x5b')](_0x4ec91d[_0x82b3('0x3a')],_0x5a4fc0[_0x82b3('0x38')]));_0x535306[_0x82b3('0x42')][_0x82b3('0x57')]=_0x2a19c8['id'];if(_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x41')]){_0x535306[_0x82b3('0x42')]=_[_0x82b3('0x43')](_0x535306['where'],{'$or':_['map'](_0x535306['attributes'],function(_0x30c23c){var _0x553716={};_0x553716[_0x30c23c]={'$like':'%'+_0x4ec91d[_0x82b3('0x3a')][_0x82b3('0x41')]+'%'};return _0x553716;})});}_0x535306=_[_0x82b3('0x43')]({},_0x535306,_0x4ec91d[_0x82b3('0x4a')]);return db[_0x82b3('0x5c')][_0x82b3('0x22')]({'where':_0x535306['where']})['then'](function(_0x4e394f){_0x3e4667[_0x82b3('0x22')]=_0x4e394f;if(_0x4ec91d['query']['includeAll']){_0x535306[_0x82b3('0x45')]=[{'all':!![]}];}return db[_0x82b3('0x5c')][_0x82b3('0x5d')](_0x535306);})[_0x82b3('0x28')](function(_0x55e01f){_0x3e4667[_0x82b3('0x46')]=_0x55e01f;return _0x3e4667;});}})[_0x82b3('0x28')](respondWithFilteredResult(_0x534dad,_0x535306))['catch'](handleError(_0x534dad,null));};exports['removeDispositions']=function(_0xbabf4e,_0x99ab3b,_0x1b5cf6){return db[_0x82b3('0x31')][_0x82b3('0x4b')]({'where':{'id':_0xbabf4e[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x99ab3b,null))['then'](function(_0xcee089){if(_0xcee089){return _0xcee089[_0x82b3('0x5e')](_0xbabf4e[_0x82b3('0x3a')][_0x82b3('0x5f')]);}})['then'](respondWithStatusCode(_0x99ab3b,null))[_0x82b3('0x47')](handleError(_0x99ab3b,null));};exports[_0x82b3('0x60')]=function(_0x480363,_0x43e2bd,_0x4810b0){return db[_0x82b3('0x31')][_0x82b3('0x4b')]({'where':{'id':_0x480363[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x43e2bd,null))[_0x82b3('0x28')](function(_0xd3230f){if(_0xd3230f){var _0x4459f2=[];var _0x4e9ff5={'success':[],'errors':[]};return db['CmContact'][_0x82b3('0x55')]()['then'](function(_0x4ba772){if(_0x480363[_0x82b3('0x4d')][_0x82b3('0x61')]&&_['isArray'](_0x480363[_0x82b3('0x4d')][_0x82b3('0x61')])){if(_0x480363['body'][_0x82b3('0x61')][_0x82b3('0x3d')]){_0x480363[_0x82b3('0x4d')][_0x82b3('0x61')]=_0x480363[_0x82b3('0x4d')][_0x82b3('0x61')][_0x82b3('0x62')](';')+';';}else{_0x480363[_0x82b3('0x4d')][_0x82b3('0x61')]=null;}}else{_0x480363[_0x82b3('0x4d')]['tags']=null;}if(_0x480363['body']&&_[_0x82b3('0x63')](_0x480363[_0x82b3('0x4d')])){for(var _0x5904a7=0x0;_0x5904a7<_0x480363['body'][_0x82b3('0x3d')];_0x5904a7+=0x1){_0x480363[_0x82b3('0x4d')][_0x5904a7]['ListId']=_0x480363[_0x82b3('0x48')]['id'];_0x4459f2[_0x82b3('0x64')](_0x480363[_0x82b3('0x4d')][_0x5904a7]);}return BPromise[_0x82b3('0x65')](_0x4459f2,function(_0x4593fb){return db[_0x82b3('0x66')]['create'](_[_0x82b3('0x67')](_0x4593fb,[_0x82b3('0x5f'),'id'])||{},{'fields':_[_0x82b3('0x37')](_0x4ba772),'raw':!![]})[_0x82b3('0x28')](function(_0x3ab056){_0x4e9ff5[_0x82b3('0x68')]['push'](_0x3ab056[_0x82b3('0x69')]);})[_0x82b3('0x47')](function(_0x4ec19b){_0x4e9ff5[_0x82b3('0x6a')]['push']({'data':_0x4593fb,'error':_0x4ec19b['message']});});})[_0x82b3('0x28')](function(_0x12a141){return _0x4e9ff5;})[_0x82b3('0x47')](function(_0x2580a1){return _0x2580a1;});}else{_0x43e2bd[_0x82b3('0x1e')](0x190)[_0x82b3('0x24')]({'message':_0x82b3('0x6b')});}});}})[_0x82b3('0x28')](respondWithResult(_0x43e2bd,null))['catch'](handleError(_0x43e2bd,null));};exports[_0x82b3('0x6c')]=function(_0x2afc3e,_0x1f06f5,_0xb5cc2c){var _0x15b79e;return db[_0x82b3('0x31')]['find']({'where':{'id':_0x2afc3e[_0x82b3('0x48')]['id']},'include':[{'model':db[_0x82b3('0x6d')],'as':_0x82b3('0x6e')}]})[_0x82b3('0x28')](handleEntityNotFound(_0x1f06f5,null))[_0x82b3('0x28')](function(_0x3af62c){if(_0x3af62c){_0x15b79e=_0x3af62c;return db[_0x82b3('0x66')]['rawAttributes'];}})[_0x82b3('0x28')](function(_0xcd3358){if(_0xcd3358){var _0x2cae3d={};var _0x228679={};_0x228679[_0x82b3('0x36')]=_[_0x82b3('0x6f')](_['keys'](_0xcd3358),_[_0x82b3('0x30')](_0x15b79e[_0x82b3('0x6e')],function(_0x1a3b7d){return util['format'](_0x82b3('0x70'),_0x1a3b7d['id']);}));_0x228679[_0x82b3('0x3a')]=_[_0x82b3('0x37')](_0x2afc3e[_0x82b3('0x3a')]);_0x228679[_0x82b3('0x38')]=_['intersection'](_0x228679[_0x82b3('0x36')],_0x228679[_0x82b3('0x3a')]);_0x2cae3d['attributes']=_[_0x82b3('0x39')](_0x228679[_0x82b3('0x36')],qs['fields'](_0x2afc3e[_0x82b3('0x3a')][_0x82b3('0x3c')]));_0x2cae3d['attributes']=_0x2cae3d[_0x82b3('0x3b')][_0x82b3('0x3d')]?_0x2cae3d[_0x82b3('0x3b')]:_0x228679[_0x82b3('0x36')];if(!_0x2afc3e[_0x82b3('0x3a')]['hasOwnProperty'](_0x82b3('0x3f'))){_0x2cae3d[_0x82b3('0x21')]=qs['limit'](_0x2afc3e[_0x82b3('0x3a')][_0x82b3('0x21')]);_0x2cae3d[_0x82b3('0x1f')]=qs[_0x82b3('0x1f')](_0x2afc3e[_0x82b3('0x3a')][_0x82b3('0x1f')]);}_0x2cae3d[_0x82b3('0x40')]=qs[_0x82b3('0x5a')](_0x2afc3e['query'][_0x82b3('0x5a')]);_0x2cae3d[_0x82b3('0x42')]=qs[_0x82b3('0x38')](_[_0x82b3('0x5b')](_0x2afc3e[_0x82b3('0x3a')],_0x228679[_0x82b3('0x38')]));_0x2cae3d['raw']=!![];if(_0x2afc3e[_0x82b3('0x3a')][_0x82b3('0x41')]){_0x2cae3d['where']=_['merge'](_0x2cae3d[_0x82b3('0x42')],{'$or':_[_0x82b3('0x30')](_0x2cae3d['attributes'],function(_0x51f9c8){var _0x5a5d46={};_0x5a5d46[_0x51f9c8]={'$like':'%'+_0x2afc3e['query'][_0x82b3('0x41')]+'%'};return _0x5a5d46;})});}_0x2cae3d=_[_0x82b3('0x43')]({},_0x2cae3d,_0x2afc3e[_0x82b3('0x4a')]);return _0x15b79e['getContacts'](_0x2cae3d);}})[_0x82b3('0x28')](respondWithResult(_0x1f06f5,null))['catch'](handleError(_0x1f06f5,null));};exports[_0x82b3('0x71')]=function(_0x1fd7ec,_0x9bfc15,_0x1aea58){var _0x1aa631;var _0x39681a;var _0x302d44;var _0x3c74bf=_0x1fd7ec[_0x82b3('0x48')]['id'];csv_results=[];return db[_0x82b3('0x72')]['findAll']({'attributes':['id',_0x82b3('0x2d')],'raw':!![],'order':[_0x82b3('0x73')]})[_0x82b3('0x28')](function(_0x4efa9f){_0x1aa631=_0x4efa9f;var _0x379919=_[_0x82b3('0x37')](db['CmContact']['rawAttributes']);return db[_0x82b3('0x6d')][_0x82b3('0x5d')]({'raw':!![],'attributes':['id',_0x82b3('0x74')]})[_0x82b3('0x28')](function(_0x126eec){_0x39681a=_0x126eec;var _0x232580=squel[_0x82b3('0x75')]()[_0x82b3('0x3c')](_0x379919)[_0x82b3('0x76')](_0x82b3('0x77'),'c')['where'](_0x82b3('0x78'),_0x3c74bf)[_0x82b3('0x42')]('c.deletedAt\x20is\x20null')[_0x82b3('0x79')]();for(var _0x4ad2a9=0x0;_0x4ad2a9<_0x39681a[_0x82b3('0x3d')];_0x4ad2a9++){_0x232580[_0x82b3('0x7a')](_0x82b3('0x7b')+_0x39681a[_0x4ad2a9]['id'],_0x82b3('0x7c')+_0x39681a[_0x4ad2a9][_0x82b3('0x74')]);}for(var _0x4ad2a9=0x0;_0x4ad2a9<_0x1aa631[_0x82b3('0x3d')];_0x4ad2a9++){_0x232580['field'](squel[_0x82b3('0x75')]()[_0x82b3('0x7a')](_0x82b3('0x7d'))[_0x82b3('0x76')](_0x82b3('0x7e'))[_0x82b3('0x42')](_0x82b3('0x7f'),_0x1aa631[_0x4ad2a9]['id'])['where'](_0x82b3('0x80')),_0x82b3('0x81')+_0x1aa631[_0x4ad2a9]['name']);_0x232580[_0x82b3('0x7a')](squel['select']()[_0x82b3('0x7a')](_0x82b3('0x82'))[_0x82b3('0x76')](_0x82b3('0x7e'))[_0x82b3('0x42')](_0x82b3('0x7f'),_0x1aa631[_0x4ad2a9]['id'])['where'](_0x82b3('0x80')),_0x82b3('0x83')+_0x1aa631[_0x4ad2a9][_0x82b3('0x2d')]);}var _0x10eadd=[];_0x10eadd[_0x82b3('0x64')](_0x232580[_0x82b3('0x84')]());BPromise[_0x82b3('0x65')](_0x10eadd,handleQuery)[_0x82b3('0x28')](function(_0x2a8338){handleQuery(_0x232580[_0x82b3('0x84')]());var _0x4b8bcc=csv_results[0x0];if(!_[_0x82b3('0x85')](_0x4b8bcc)){var _0x1a922b=toCsv(_0x4b8bcc);var _0x46f782=Date[_0x82b3('0x86')]();fs[_0x82b3('0x87')](util[_0x82b3('0x88')](_0x82b3('0x89'),_0x3c74bf,_0x46f782),_0x1a922b);_0x9bfc15[_0x82b3('0x8a')](_0x82b3('0x8b'),_0x82b3('0x8c')+util[_0x82b3('0x88')](_0x82b3('0x8d'),_0x3c74bf,_0x46f782));_0x9bfc15[_0x82b3('0x8a')](_0x82b3('0x8e'),_0x82b3('0x8f'));return _0x9bfc15[_0x82b3('0x90')](util['format'](_0x82b3('0x89'),_0x3c74bf,_0x46f782));}else{return _0x9bfc15[_0x82b3('0x1c')](0xcc);}});});});};exports['addCustomField']=function(_0x438709,_0x4af120,_0x326a4b){var _0x3016a7;delete _0x438709[_0x82b3('0x4d')]['id'];return db[_0x82b3('0x31')]['findOne']({'where':{'id':_0x438709[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x4af120,null))[_0x82b3('0x28')](function(_0x344220){if(_0x344220){return db[_0x82b3('0x91')]['transaction'](function(_0x3c13e7){return db[_0x82b3('0x6d')][_0x82b3('0x4c')](_0x438709[_0x82b3('0x4d')],{'transaction':_0x3c13e7})[_0x82b3('0x28')](function(_0x3b4c5a){_0x3016a7=_0x3b4c5a;return _0x344220[_0x82b3('0x92')](_0x3b4c5a,{'transaction':_0x3c13e7});})[_0x82b3('0x28')](function(){var _0x585163={'type':db[_0x82b3('0x93')][_0x82b3('0x94')],'transaction':_0x3c13e7};switch(_0x438709[_0x82b3('0x4d')][_0x82b3('0x34')]){case'text':_0x585163[_0x82b3('0x34')]=db[_0x82b3('0x93')]['TEXT'];break;case _0x82b3('0x95'):_0x585163['type']=db[_0x82b3('0x93')][_0x82b3('0x96')];break;case _0x82b3('0x97'):_0x585163['type']=db[_0x82b3('0x93')][_0x82b3('0x98')];_0x585163[_0x82b3('0x99')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn']('cm_contacts',util[_0x82b3('0x88')](_0x82b3('0x9a'),_0x3016a7['id']),_0x585163);})[_0x82b3('0x28')](function(){return _0x3016a7;});});}})[_0x82b3('0x28')](respondWithResult(_0x4af120,null))['catch'](handleError(_0x4af120,null));};exports[_0x82b3('0x9b')]=function(_0x1d2302,_0x33080f,_0x5520d7){var _0xcbd653={};var _0x2df55b={};var _0x37ea25;var _0x1dbb1b;return db[_0x82b3('0x31')][_0x82b3('0x59')]({'where':{'id':_0x1d2302[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x33080f,null))[_0x82b3('0x28')](function(_0x4ead94){if(_0x4ead94){_0x37ea25=_0x4ead94;_0x2df55b[_0x82b3('0x36')]=_[_0x82b3('0x37')](db['CmCustomField']['rawAttributes']);_0x2df55b[_0x82b3('0x3a')]=_[_0x82b3('0x37')](_0x1d2302[_0x82b3('0x3a')]);_0x2df55b[_0x82b3('0x38')]=_[_0x82b3('0x39')](_0x2df55b[_0x82b3('0x36')],_0x2df55b['query']);_0xcbd653[_0x82b3('0x3b')]=_[_0x82b3('0x39')](_0x2df55b[_0x82b3('0x36')],qs[_0x82b3('0x3c')](_0x1d2302[_0x82b3('0x3a')][_0x82b3('0x3c')]));_0xcbd653[_0x82b3('0x3b')]=_0xcbd653[_0x82b3('0x3b')][_0x82b3('0x3d')]?_0xcbd653[_0x82b3('0x3b')]:_0x2df55b[_0x82b3('0x36')];_0xcbd653[_0x82b3('0x40')]=qs[_0x82b3('0x5a')](_0x1d2302[_0x82b3('0x3a')][_0x82b3('0x5a')]);_0xcbd653[_0x82b3('0x42')]=qs[_0x82b3('0x38')](_[_0x82b3('0x5b')](_0x1d2302[_0x82b3('0x3a')],_0x2df55b[_0x82b3('0x38')]));_0xcbd653[_0x82b3('0x42')]=_[_0x82b3('0x43')](_0xcbd653[_0x82b3('0x42')],{'$or':[{'ListId':_0x4ead94['id']},{'ListId':null}]});if(_0x1d2302[_0x82b3('0x3a')][_0x82b3('0x41')]){_0xcbd653['where']=_[_0x82b3('0x43')](_0xcbd653['where'],{'$or':_[_0x82b3('0x30')](_0xcbd653[_0x82b3('0x3b')],function(_0x3af94c){var _0x7244cc={};_0x7244cc[_0x3af94c]={'$like':'%'+_0x1d2302[_0x82b3('0x3a')][_0x82b3('0x41')]+'%'};return _0x7244cc;})});}_0xcbd653=_['merge']({},_0xcbd653,_0x1d2302[_0x82b3('0x4a')]);return db[_0x82b3('0x6d')]['findAndCountAll'](_0xcbd653);}})[_0x82b3('0x28')](respondWithResult(_0x33080f,null))[_0x82b3('0x47')](handleError(_0x33080f,null));};exports[_0x82b3('0x9c')]=function(_0xd071ff,_0x2e7e02){return db[_0x82b3('0x6d')][_0x82b3('0x9d')]({'where':{'ListId':null}})[_0x82b3('0x28')](handleEntityNotFound(_0x2e7e02,null))[_0x82b3('0x28')](function(_0x193dc4){return _0x193dc4;})[_0x82b3('0x28')](respondWithResult(_0x2e7e02,null))[_0x82b3('0x47')](handleError(_0x2e7e02,null));};exports[_0x82b3('0x9e')]=function(_0x272443,_0x49da4c,_0xe220de){return db[_0x82b3('0x31')][_0x82b3('0x4b')]({'where':{'id':_0x272443[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x49da4c,null))[_0x82b3('0x28')](function(_0x3abad8){if(_0x3abad8){return _0x3abad8[_0x82b3('0x9e')](_0x272443[_0x82b3('0x4d')][_0x82b3('0x5f')],_[_0x82b3('0x67')](_0x272443[_0x82b3('0x4d')],[_0x82b3('0x5f'),'id'])||{})['spread'](function(_0x1dca8b){for(var _0x7c1d3d=0x0;_0x7c1d3d<_0x272443[_0x82b3('0x4d')][_0x82b3('0x5f')][_0x82b3('0x3d')];_0x7c1d3d+=0x1){socket[_0x82b3('0x9f')](_0x82b3('0xa0'),{'UserId':Number(_0x272443[_0x82b3('0x4d')][_0x82b3('0x5f')][_0x7c1d3d]),'CmListId':Number(_0x272443[_0x82b3('0x48')]['id'])});}return _0x1dca8b;});}})[_0x82b3('0x28')](respondWithResult(_0x49da4c,null))['catch'](handleError(_0x49da4c,null));};exports[_0x82b3('0xa1')]=function(_0x12294d,_0x466b89,_0x53fec0){return db[_0x82b3('0x31')]['find']({'where':{'id':_0x12294d['params']['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x466b89,null))[_0x82b3('0x28')](function(_0x219e62){if(_0x219e62){return _0x219e62[_0x82b3('0xa1')](_0x12294d['query'][_0x82b3('0x5f')])[_0x82b3('0x28')](function(){if(_[_0x82b3('0x63')](_0x12294d[_0x82b3('0x3a')][_0x82b3('0x5f')])){for(var _0x3c15f6=0x0;_0x3c15f6<_0x12294d[_0x82b3('0x3a')][_0x82b3('0x5f')][_0x82b3('0x3d')];_0x3c15f6+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x12294d[_0x82b3('0x3a')]['ids'][_0x3c15f6]),'CmListId':Number(_0x12294d['params']['id'])});}}else{socket['emit'](_0x82b3('0xa2'),{'UserId':Number(_0x12294d[_0x82b3('0x3a')][_0x82b3('0x5f')]),'CmListId':Number(_0x12294d[_0x82b3('0x48')]['id'])});}});}})[_0x82b3('0x28')](respondWithStatusCode(_0x466b89,null))[_0x82b3('0x47')](handleError(_0x466b89,null));};exports['getAgents']=function(_0x28aeac,_0x22ad38,_0x17cbf0){var _0x1875fd={};var _0x97aee6={};var _0x4ea1bd;var _0x296152;return db[_0x82b3('0x31')]['findOne']({'where':{'id':_0x28aeac[_0x82b3('0x48')]['id']}})[_0x82b3('0x28')](handleEntityNotFound(_0x22ad38,null))[_0x82b3('0x28')](function(_0x28ff34){if(_0x28ff34){_0x4ea1bd=_0x28ff34;_0x97aee6['model']=_[_0x82b3('0x37')](db[_0x82b3('0xa3')][_0x82b3('0x32')]);_0x97aee6['query']=_[_0x82b3('0x37')](_0x28aeac[_0x82b3('0x3a')]);_0x97aee6[_0x82b3('0x38')]=_[_0x82b3('0x39')](_0x97aee6[_0x82b3('0x36')],_0x97aee6[_0x82b3('0x3a')]);_0x1875fd[_0x82b3('0x3b')]=_[_0x82b3('0x39')](_0x97aee6[_0x82b3('0x36')],qs['fields'](_0x28aeac[_0x82b3('0x3a')][_0x82b3('0x3c')]));_0x1875fd[_0x82b3('0x3b')]=_0x1875fd[_0x82b3('0x3b')][_0x82b3('0x3d')]?_0x1875fd[_0x82b3('0x3b')]:_0x97aee6[_0x82b3('0x36')];_0x1875fd[_0x82b3('0x40')]=qs[_0x82b3('0x5a')](_0x28aeac['query'][_0x82b3('0x5a')]);_0x1875fd['where']=qs[_0x82b3('0x38')](_[_0x82b3('0x5b')](_0x28aeac['query'],_0x97aee6[_0x82b3('0x38')]));if(_0x28aeac['query'][_0x82b3('0x41')]){_0x1875fd[_0x82b3('0x42')]=_[_0x82b3('0x43')](_0x1875fd[_0x82b3('0x42')],{'$or':_[_0x82b3('0x30')](_0x1875fd[_0x82b3('0x3b')],function(_0xfa1eee){var _0x26d252={};_0x26d252[_0xfa1eee]={'$like':'%'+_0x28aeac[_0x82b3('0x3a')][_0x82b3('0x41')]+'%'};return _0x26d252;})});}_0x1875fd=_['merge']({},_0x1875fd,_0x28aeac[_0x82b3('0x4a')]);return _0x4ea1bd[_0x82b3('0xa4')](_0x1875fd);}})[_0x82b3('0x28')](function(_0x3f94ff){if(_0x3f94ff){_0x296152=_0x3f94ff[_0x82b3('0x3d')];if(!_0x28aeac['query'][_0x82b3('0x3e')]('nolimit')){_0x1875fd['limit']=qs[_0x82b3('0x21')](_0x28aeac[_0x82b3('0x3a')][_0x82b3('0x21')]);_0x1875fd['offset']=qs['offset'](_0x28aeac[_0x82b3('0x3a')][_0x82b3('0x1f')]);}return _0x4ea1bd['getAgents'](_0x1875fd);}})[_0x82b3('0x28')](function(_0x113f4e){if(_0x113f4e){return _0x113f4e?{'count':_0x296152,'rows':_0x113f4e}:null;}})['then'](respondWithResult(_0x22ad38,null))[_0x82b3('0x47')](handleError(_0x22ad38,null));};function handleQuery(_0x1514ed){logger[_0x82b3('0xa5')](_0x1514ed);return db[_0x82b3('0x91')][_0x82b3('0x3a')](_0x1514ed)[_0x82b3('0xa6')](function(_0x8e01b0){csv_results[_0x82b3('0x64')](_0x8e01b0);})[_0x82b3('0x47')](function(_0x24cd6e){logger['error'](_0x24cd6e[_0x82b3('0xa7')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 57e9f6e..be2c0f1 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5b53cb,_0x35a751){_0x5b53cb=_0x5b53cb-0x0;var _0x5a160d=_0x3e74[_0x5b53cb];return _0x5a160d;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x5fc3,0xa8));var _0x35fc=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5fc3[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cf8be00..df2c90d 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14e36e,_0x4f7b4d){_0x14e36e=_0x14e36e-0x0;var _0x885cab=_0x6f0d[_0x14e36e];return _0x885cab;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb7=['request-promise','path','rimraf','./cmList.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2d86f2,_0x5e1b5c){_0x2d86f2=_0x2d86f2-0x0;var _0x4d2124=_0xbdb7[_0x2d86f2];return _0x4d2124;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 5f5e484..d792a57 100644 --- a/server/api/cmList/cmList.rpc.js +++ b/server/api/cmList/cmList.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1080=['../../mysqldb','../../config/logger','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39a7d8,_0x4cba9b){var _0x121e07=function(_0x30efcb){while(--_0x30efcb){_0x39a7d8['push'](_0x39a7d8['shift']());}};_0x121e07(++_0x4cba9b);}(_0x1080,0x1d5));var _0x0108=function(_0x48163f,_0x504381){_0x48163f=_0x48163f-0x0;var _0x1f966a=_0x1080[_0x48163f];return _0x1f966a;};'use strict';var _=require(_0x0108('0x0'));var util=require(_0x0108('0x1'));var moment=require(_0x0108('0x2'));var BPromise=require(_0x0108('0x3'));var rs=require(_0x0108('0x4'));var fs=require('fs');var Redis=require(_0x0108('0x5'));var db=require(_0x0108('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0108('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0108('0x8')]({'port':0x232a});config[_0x0108('0x9')]=_[_0x0108('0xa')](config['redis'],{'host':_0x0108('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0108('0x9')]));require(_0x0108('0xc'))[_0x0108('0xd')](socket);function respondWithRpcPromise(_0x3b7741,_0x45efdc,_0x2078d2){return new BPromise(function(_0x5994c6,_0x152d20){return client[_0x0108('0xe')](_0x3b7741,_0x2078d2)[_0x0108('0xf')](function(_0xd077c9){logger[_0x0108('0x10')]('CmList,\x20%s,\x20%s',_0x45efdc,'request\x20sent');logger[_0x0108('0x11')](_0x0108('0x12'),_0x45efdc,'request\x20sent',JSON[_0x0108('0x13')](_0xd077c9));if(_0xd077c9[_0x0108('0x14')]){if(_0xd077c9['error'][_0x0108('0x15')]===0x1f4){logger['error'](_0x0108('0x16'),_0x45efdc,_0xd077c9[_0x0108('0x14')][_0x0108('0x17')]);return _0x152d20(_0xd077c9['error']['message']);}logger[_0x0108('0x14')](_0x0108('0x16'),_0x45efdc,_0xd077c9[_0x0108('0x14')][_0x0108('0x17')]);return _0x5994c6(_0xd077c9['error']['message']);}else{logger[_0x0108('0x10')](_0x0108('0x16'),_0x45efdc,_0x0108('0x18'));_0x5994c6(_0xd077c9['result'][_0x0108('0x17')]);}})['catch'](function(_0x289881){logger[_0x0108('0x14')](_0x0108('0x16'),_0x45efdc,_0x289881);_0x152d20(_0x289881);});});} \ No newline at end of file +var _0xcd4d=['localhost','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x584004,_0x3a6fb5){var _0x47df6f=function(_0x30f0af){while(--_0x30f0af){_0x584004['push'](_0x584004['shift']());}};_0x47df6f(++_0x3a6fb5);}(_0xcd4d,0x115));var _0xdcd4=function(_0x2378f1,_0xa7e53b){_0x2378f1=_0x2378f1-0x0;var _0xf4b8d6=_0xcd4d[_0x2378f1];return _0xf4b8d6;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcd4('0x6'))(_0xdcd4('0x7'));var config=require(_0xdcd4('0x8'));var jayson=require(_0xdcd4('0x9'));var client=jayson[_0xdcd4('0xa')][_0xdcd4('0xb')]({'port':0x232a});config[_0xdcd4('0xc')]=_['defaults'](config[_0xdcd4('0xc')],{'host':_0xdcd4('0xd'),'port':0x18eb});var socket=require(_0xdcd4('0xe'))(new Redis(config[_0xdcd4('0xc')]));require(_0xdcd4('0xf'))['register'](socket);function respondWithRpcPromise(_0x28e70f,_0x292bc1,_0x1fe00a){return new BPromise(function(_0x20a800,_0x4148b9){return client[_0xdcd4('0x10')](_0x28e70f,_0x1fe00a)[_0xdcd4('0x11')](function(_0x5b205c){logger[_0xdcd4('0x12')](_0xdcd4('0x13'),_0x292bc1,_0xdcd4('0x14'));logger[_0xdcd4('0x15')](_0xdcd4('0x16'),_0x292bc1,_0xdcd4('0x14'),JSON[_0xdcd4('0x17')](_0x5b205c));if(_0x5b205c[_0xdcd4('0x18')]){if(_0x5b205c[_0xdcd4('0x18')][_0xdcd4('0x19')]===0x1f4){logger[_0xdcd4('0x18')](_0xdcd4('0x13'),_0x292bc1,_0x5b205c[_0xdcd4('0x18')][_0xdcd4('0x1a')]);return _0x4148b9(_0x5b205c[_0xdcd4('0x18')][_0xdcd4('0x1a')]);}logger[_0xdcd4('0x18')](_0xdcd4('0x13'),_0x292bc1,_0x5b205c[_0xdcd4('0x18')][_0xdcd4('0x1a')]);return _0x20a800(_0x5b205c[_0xdcd4('0x18')]['message']);}else{logger[_0xdcd4('0x12')]('CmList,\x20%s,\x20%s',_0x292bc1,_0xdcd4('0x14'));_0x20a800(_0x5b205c[_0xdcd4('0x1b')]['message']);}})[_0xdcd4('0x1c')](function(_0x15e46e){logger[_0xdcd4('0x18')](_0xdcd4('0x13'),_0x292bc1,_0x15e46e);_0x4148b9(_0x15e46e);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 85cc94a..5f8349c 100644 --- a/server/api/cmList/cmList.socket.js +++ b/server/api/cmList/cmList.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c5e=['length','cmList:','save','remove','update','emit'];(function(_0x2f3e6a,_0x51af26){var _0x32a113=function(_0x525dd6){while(--_0x525dd6){_0x2f3e6a['push'](_0x2f3e6a['shift']());}};_0x32a113(++_0x51af26);}(_0x7c5e,0xaa));var _0xe7c5=function(_0x360266,_0x5b97de){_0x360266=_0x360266-0x0;var _0x286702=_0x7c5e[_0x360266];return _0x286702;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xe7c5('0x0'),_0xe7c5('0x1'),_0xe7c5('0x2')];function createListener(_0x138287,_0x99dcfc){return function(_0x1fd9ab){_0x99dcfc[_0xe7c5('0x3')](_0x138287,_0x1fd9ab);};}function removeListener(_0x1999b4,_0x885280){return function(){CmListEvents['removeListener'](_0x1999b4,_0x885280);};}exports['register']=function(_0xed1b2c){for(var _0x175771=0x0,_0x5d6f68=events[_0xe7c5('0x4')];_0x175771<_0x5d6f68;_0x175771++){var _0x1cb5ff=events[_0x175771];var _0x1c5baa=createListener(_0xe7c5('0x5')+_0x1cb5ff,_0xed1b2c);CmListEvents['on'](_0x1cb5ff,_0x1c5baa);}}; \ No newline at end of file +var _0x9611=['emit','register','length','cmList:','./cmList.events','remove'];(function(_0x425e98,_0xd0e044){var _0x2703f5=function(_0x19e4ab){while(--_0x19e4ab){_0x425e98['push'](_0x425e98['shift']());}};_0x2703f5(++_0xd0e044);}(_0x9611,0x1b4));var _0x1961=function(_0x387d98,_0x3afbdf){_0x387d98=_0x387d98-0x0;var _0x5263ca=_0x9611[_0x387d98];return _0x5263ca;};'use strict';var CmListEvents=require(_0x1961('0x0'));var events=['save',_0x1961('0x1'),'update'];function createListener(_0x49e91a,_0xd0e4cb){return function(_0x1ba493){_0xd0e4cb[_0x1961('0x2')](_0x49e91a,_0x1ba493);};}function removeListener(_0x13c4a9,_0x4360a2){return function(){CmListEvents['removeListener'](_0x13c4a9,_0x4360a2);};}exports[_0x1961('0x3')]=function(_0x344edb){for(var _0x332742=0x0,_0x4fdc07=events[_0x1961('0x4')];_0x332742<_0x4fdc07;_0x332742++){var _0x28ca1f=events[_0x332742];var _0xc201a1=createListener(_0x1961('0x5')+_0x28ca1f,_0x344edb);CmListEvents['on'](_0x28ca1f,_0xc201a1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fb77b97..430c5dd 100644 --- a/server/api/cmList/index.js +++ b/server/api/cmList/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0e6=['addCustomField','addAgents','put','/:id','update','delete','removeDispositions','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','getDispositions','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','/:id/dispositions','addDisposition','/:id/contacts','addContacts','post'];(function(_0x394dfc,_0x160ee7){var _0x40373b=function(_0x356bc6){while(--_0x356bc6){_0x394dfc['push'](_0x394dfc['shift']());}};_0x40373b(++_0x160ee7);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xc0e6[_0x1a7846];return _0x48049;};'use strict';var multer=require('multer');var util=require(_0x6c0e('0x0'));var path=require('path');var timeout=require(_0x6c0e('0x1'));var express=require(_0x6c0e('0x2'));var router=express[_0x6c0e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c0e('0x4'));var config=require(_0x6c0e('0x5'));var controller=require(_0x6c0e('0x6'));router[_0x6c0e('0x7')]('/',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x9')]);router[_0x6c0e('0x7')](_0x6c0e('0xa'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xb')]);router[_0x6c0e('0x7')](_0x6c0e('0xc'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xd')]);router[_0x6c0e('0x7')]('/:id',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0xe')]);router[_0x6c0e('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x6c0e('0xf')]);router[_0x6c0e('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x6c0e('0x10')]);router['get']('/:id/contacts/csv',auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x11')]);router[_0x6c0e('0x7')](_0x6c0e('0x12'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x13')]);router['get'](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6c0e('0x16')]);router['post'](_0x6c0e('0x17'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x18')]);router['post'](_0x6c0e('0x19'),auth['isAuthenticated'](),controller[_0x6c0e('0x1a')]);router[_0x6c0e('0x1b')](_0x6c0e('0x12'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x1c')]);router[_0x6c0e('0x1b')](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x1d')]);router[_0x6c0e('0x1e')](_0x6c0e('0x1f'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x20')]);router['delete'](_0x6c0e('0x1f'),auth[_0x6c0e('0x8')](),controller['destroy']);router[_0x6c0e('0x21')](_0x6c0e('0x17'),auth[_0x6c0e('0x8')](),controller[_0x6c0e('0x22')]);router[_0x6c0e('0x21')](_0x6c0e('0x14'),auth[_0x6c0e('0x8')](),controller['removeAgents']);module[_0x6c0e('0x23')]=router; \ No newline at end of file +var _0x933b=['/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addAgents','/:id','update','delete','destroy','removeDispositions','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/global_fields'];(function(_0x4e689d,_0x4534d6){var _0x351df3=function(_0x85fa67){while(--_0x85fa67){_0x4e689d['push'](_0x4e689d['shift']());}};_0x351df3(++_0x4534d6);}(_0x933b,0x16e));var _0xb933=function(_0x510ad6,_0x5c4e7b){_0x510ad6=_0x510ad6-0x0;var _0x15d1c0=_0x933b[_0x510ad6];return _0x15d1c0;};'use strict';var multer=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb933('0x2'));var router=express[_0xb933('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb933('0x4'));var interaction=require(_0xb933('0x5'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xb933('0x6')]('/',auth[_0xb933('0x7')](),controller[_0xb933('0x8')]);router[_0xb933('0x6')]('/describe',auth[_0xb933('0x7')](),controller[_0xb933('0x9')]);router[_0xb933('0x6')](_0xb933('0xa'),auth[_0xb933('0x7')](),controller['getGlobalCustomFields']);router[_0xb933('0x6')]('/:id',auth[_0xb933('0x7')](),controller['show']);router[_0xb933('0x6')](_0xb933('0xb'),auth[_0xb933('0x7')](),controller[_0xb933('0xc')]);router[_0xb933('0x6')](_0xb933('0xd'),auth[_0xb933('0x7')](),controller[_0xb933('0xe')]);router[_0xb933('0x6')](_0xb933('0xf'),auth[_0xb933('0x7')](),controller['getContactsCsv']);router[_0xb933('0x6')](_0xb933('0x10'),auth[_0xb933('0x7')](),controller[_0xb933('0x11')]);router[_0xb933('0x6')](_0xb933('0x12'),auth[_0xb933('0x7')](),controller[_0xb933('0x13')]);router[_0xb933('0x14')]('/',auth[_0xb933('0x7')](),controller[_0xb933('0x15')]);router[_0xb933('0x14')](_0xb933('0xb'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb933('0x14')](_0xb933('0xd'),auth[_0xb933('0x7')](),controller['addContacts']);router[_0xb933('0x14')](_0xb933('0x10'),auth[_0xb933('0x7')](),controller['addCustomField']);router[_0xb933('0x14')](_0xb933('0x12'),auth[_0xb933('0x7')](),controller[_0xb933('0x16')]);router['put'](_0xb933('0x17'),auth[_0xb933('0x7')](),controller[_0xb933('0x18')]);router[_0xb933('0x19')]('/:id',auth[_0xb933('0x7')](),controller[_0xb933('0x1a')]);router[_0xb933('0x19')]('/:id/dispositions',auth[_0xb933('0x7')](),controller[_0xb933('0x1b')]);router[_0xb933('0x19')](_0xb933('0x12'),auth[_0xb933('0x7')](),controller['removeAgents']);module[_0xb933('0x1c')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 4406049..251a306 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86f3=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x4a4bf7,_0x53851a){var _0x5e3463=function(_0x7f16ea){while(--_0x7f16ea){_0x4a4bf7['push'](_0x4a4bf7['shift']());}};_0x5e3463(++_0x53851a);}(_0x86f3,0x19f));var _0x386f=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x86f3[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require('sequelize');module[_0x386f('0x0')]={'name':{'type':Sequelize[_0x386f('0x1')],'get':function(_0x4e88e6){return this[_0x386f('0x2')](_0x386f('0x3'));}},'field':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x3d04=['sequelize','exports','getDataValue','STRING'];(function(_0x561641,_0x5d8d30){var _0x3b779c=function(_0x4b3128){while(--_0x4b3128){_0x561641['push'](_0x561641['shift']());}};_0x3b779c(++_0x5d8d30);}(_0x3d04,0x84));var _0x43d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3d04[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x43d0('0x0'));module[_0x43d0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36e9d1){return this[_0x43d0('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x43d0('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0e2512f..0a076c1 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5c288b,_0x58c41d){var _0x53b062=function(_0x348a74){while(--_0x348a74){_0x5c288b['push'](_0x5c288b['shift']());}};_0x53b062(++_0x58c41d);}(_0x7a54,0x106));var _0x47a5=function(_0x2ea490,_0x7d9611){_0x2ea490=_0x2ea490-0x0;var _0x2b01b8=_0x7a54[_0x2ea490];return _0x2b01b8;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3b8055,_0x56ad16){var _0xc20d46=function(_0x4829a6){while(--_0x4829a6){_0x3b8055['push'](_0x3b8055['shift']());}};_0xc20d46(++_0x56ad16);}(_0x7a54,0x106));var _0x47a5=function(_0x5851cf,_0x2c6707){_0x5851cf=_0x5851cf-0x0;var _0x50012f=_0x7a54[_0x5851cf];return _0x50012f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9b674ad..b1336e1 100644 --- a/server/api/condition/condition.model.js +++ b/server/api/condition/condition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7228=['tools_conditions','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','Condition'];(function(_0x300291,_0x447d63){var _0x5df13e=function(_0x27092c){while(--_0x27092c){_0x300291['push'](_0x300291['shift']());}};_0x5df13e(++_0x447d63);}(_0x7228,0x10f));var _0x8722=function(_0x2b6cbc,_0x477292){_0x2b6cbc=_0x2b6cbc-0x0;var _0x49d8c9=_0x7228[_0x2b6cbc];return _0x49d8c9;};'use strict';var _=require(_0x8722('0x0'));var util=require('util');var logger=require(_0x8722('0x1'))('api');var moment=require(_0x8722('0x2'));var BPromise=require(_0x8722('0x3'));var rp=require(_0x8722('0x4'));var fs=require('fs');var path=require(_0x8722('0x5'));var rimraf=require(_0x8722('0x6'));var config=require(_0x8722('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0xe5f871,_0xabacc6){return _0xe5f871['define'](_0x8722('0x8'),attributes,{'tableName':_0x8722('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9183=['path','rimraf','../../config/environment','./condition.attributes','define','Condition','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3a3cab,_0x5a2289){var _0x1b11cd=function(_0x3ce596){while(--_0x3ce596){_0x3a3cab['push'](_0x3a3cab['shift']());}};_0x1b11cd(++_0x5a2289);}(_0x9183,0x1ea));var _0x3918=function(_0x155235,_0x33421d){_0x155235=_0x155235-0x0;var _0x53e15b=_0x9183[_0x155235];return _0x53e15b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3918('0x0'))(_0x3918('0x1'));var moment=require(_0x3918('0x2'));var BPromise=require(_0x3918('0x3'));var rp=require(_0x3918('0x4'));var fs=require('fs');var path=require(_0x3918('0x5'));var rimraf=require(_0x3918('0x6'));var config=require(_0x3918('0x7'));var attributes=require(_0x3918('0x8'));module['exports']=function(_0x3a126e,_0x496cd3){return _0x3a126e[_0x3918('0x9')](_0x3918('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index dbabbc0..9e864cb 100644 --- a/server/api/condition/condition.rpc.js +++ b/server/api/condition/condition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0473=['debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s'];(function(_0x3fb150,_0x5e32ed){var _0x56f4a8=function(_0x57924c){while(--_0x57924c){_0x3fb150['push'](_0x3fb150['shift']());}};_0x56f4a8(++_0x5e32ed);}(_0x0473,0x158));var _0x3047=function(_0x1cedfe,_0x4d841){_0x1cedfe=_0x1cedfe-0x0;var _0xa0510f=_0x0473[_0x1cedfe];return _0xa0510f;};'use strict';var _=require(_0x3047('0x0'));var util=require('util');var moment=require(_0x3047('0x1'));var BPromise=require('bluebird');var rs=require(_0x3047('0x2'));var fs=require('fs');var Redis=require(_0x3047('0x3'));var db=require(_0x3047('0x4'))['db'];var utils=require(_0x3047('0x5'));var logger=require('../../config/logger')(_0x3047('0x6'));var config=require(_0x3047('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3047('0x8')][_0x3047('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c0cd,_0xbcec1d,_0x30a737){return new BPromise(function(_0xddc5ae,_0xb4d19b){return client[_0x3047('0xa')](_0x19c0cd,_0x30a737)['then'](function(_0xcbed5e){logger[_0x3047('0xb')](_0x3047('0xc'),_0xbcec1d,'request\x20sent');logger[_0x3047('0xd')](_0x3047('0xe'),_0xbcec1d,_0x3047('0xf'),JSON[_0x3047('0x10')](_0xcbed5e));if(_0xcbed5e['error']){if(_0xcbed5e[_0x3047('0x11')]['code']===0x1f4){logger[_0x3047('0x11')](_0x3047('0xc'),_0xbcec1d,_0xcbed5e[_0x3047('0x11')]['message']);return _0xb4d19b(_0xcbed5e[_0x3047('0x11')][_0x3047('0x12')]);}logger[_0x3047('0x11')](_0x3047('0xc'),_0xbcec1d,_0xcbed5e[_0x3047('0x11')][_0x3047('0x12')]);return _0xddc5ae(_0xcbed5e['error'][_0x3047('0x12')]);}else{logger['info'](_0x3047('0xc'),_0xbcec1d,'request\x20sent');_0xddc5ae(_0xcbed5e[_0x3047('0x13')][_0x3047('0x12')]);}})[_0x3047('0x14')](function(_0x5d8425){logger['error'](_0x3047('0xc'),_0xbcec1d,_0x5d8425);_0xb4d19b(_0x5d8425);});});} \ No newline at end of file +var _0x2a7b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x1314d4,_0xb0b16d){var _0x584ba5=function(_0x394269){while(--_0x394269){_0x1314d4['push'](_0x1314d4['shift']());}};_0x584ba5(++_0xb0b16d);}(_0x2a7b,0x1b4));var _0xb2a7=function(_0x24ad39,_0x19153d){_0x24ad39=_0x24ad39-0x0;var _0x4ee6bf=_0x2a7b[_0x24ad39];return _0x4ee6bf;};'use strict';var _=require(_0xb2a7('0x0'));var util=require('util');var moment=require(_0xb2a7('0x1'));var BPromise=require(_0xb2a7('0x2'));var rs=require(_0xb2a7('0x3'));var fs=require('fs');var Redis=require(_0xb2a7('0x4'));var db=require(_0xb2a7('0x5'))['db'];var utils=require(_0xb2a7('0x6'));var logger=require('../../config/logger')(_0xb2a7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb2a7('0x8'));var client=jayson[_0xb2a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c5bd4,_0x2b1388,_0x4fdaa2){return new BPromise(function(_0x1bf540,_0xd6eb03){return client[_0xb2a7('0xa')](_0x2c5bd4,_0x4fdaa2)[_0xb2a7('0xb')](function(_0x41731c){logger[_0xb2a7('0xc')](_0xb2a7('0xd'),_0x2b1388,_0xb2a7('0xe'));logger[_0xb2a7('0xf')](_0xb2a7('0x10'),_0x2b1388,'request\x20sent',JSON[_0xb2a7('0x11')](_0x41731c));if(_0x41731c[_0xb2a7('0x12')]){if(_0x41731c[_0xb2a7('0x12')][_0xb2a7('0x13')]===0x1f4){logger[_0xb2a7('0x12')](_0xb2a7('0xd'),_0x2b1388,_0x41731c[_0xb2a7('0x12')][_0xb2a7('0x14')]);return _0xd6eb03(_0x41731c['error'][_0xb2a7('0x14')]);}logger[_0xb2a7('0x12')]('Condition,\x20%s,\x20%s',_0x2b1388,_0x41731c['error'][_0xb2a7('0x14')]);return _0x1bf540(_0x41731c['error'][_0xb2a7('0x14')]);}else{logger[_0xb2a7('0xc')](_0xb2a7('0xd'),_0x2b1388,_0xb2a7('0xe'));_0x1bf540(_0x41731c[_0xb2a7('0x15')][_0xb2a7('0x14')]);}})[_0xb2a7('0x16')](function(_0x142fa6){logger[_0xb2a7('0x12')]('Condition,\x20%s,\x20%s',_0x2b1388,_0x142fa6);_0xd6eb03(_0x142fa6);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4b4cee5..7103019 100644 --- a/server/api/condition/index.js +++ b/server/api/condition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4736=['../../config/environment','./condition.controller','put','isAuthenticated','update','/:id','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x4736,0x13c));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x6473('0x0'));var path=require(_0x6473('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6473('0x2')]();var fs_extra=require(_0x6473('0x3'));var auth=require(_0x6473('0x4'));var interaction=require(_0x6473('0x5'));var config=require(_0x6473('0x6'));var controller=require(_0x6473('0x7'));router[_0x6473('0x8')]('/:id',auth[_0x6473('0x9')](),controller[_0x6473('0xa')]);router['delete'](_0x6473('0xb'),auth[_0x6473('0x9')](),controller[_0x6473('0xc')]);module[_0x6473('0xd')]=router; \ No newline at end of file +var _0x9e12=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x9e12,0xec));var _0x29e1=function(_0x1f6736,_0x563772){_0x1f6736=_0x1f6736-0x0;var _0x25a3a8=_0x9e12[_0x1f6736];return _0x25a3a8;};'use strict';var multer=require(_0x29e1('0x0'));var util=require(_0x29e1('0x1'));var path=require(_0x29e1('0x2'));var timeout=require(_0x29e1('0x3'));var express=require(_0x29e1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x29e1('0x5'));var interaction=require(_0x29e1('0x6'));var config=require(_0x29e1('0x7'));var controller=require(_0x29e1('0x8'));router[_0x29e1('0x9')](_0x29e1('0xa'),auth[_0x29e1('0xb')](),controller[_0x29e1('0xc')]);router[_0x29e1('0xd')](_0x29e1('0xa'),auth[_0x29e1('0xb')](),controller[_0x29e1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 567a37e..ed75aea 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57a1=['sequelize','STRING','INTEGER'];(function(_0x484512,_0x592069){var _0x28c188=function(_0x56d32c){while(--_0x56d32c){_0x484512['push'](_0x484512['shift']());}};_0x28c188(++_0x592069);}(_0x57a1,0x93));var _0x157a=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x57a1[_0x2ca616];return _0x53155f;};'use strict';var Sequelize=require(_0x157a('0x0'));module['exports']={'name':{'type':Sequelize[_0x157a('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x157a('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x157a('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xcc83=['INTEGER','exports','STRING','name'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0xcc83,0x129));var _0x3cc8=function(_0x4f8909,_0x127885){_0x4f8909=_0x4f8909-0x0;var _0x8b66ef=_0xcc83[_0x4f8909];return _0x8b66ef;};'use strict';var Sequelize=require('sequelize');module[_0x3cc8('0x0')]={'name':{'type':Sequelize[_0x3cc8('0x1')],'allowNull':![],'unique':_0x3cc8('0x2')},'OrderBy':{'type':Sequelize[_0x3cc8('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3cc8('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 0eb6903..3e89a6c 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28f2=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','ContactItemType','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x244c67,_0x5604a2){var _0x5459e4=function(_0x9b785d){while(--_0x9b785d){_0x244c67['push'](_0x244c67['shift']());}};_0x5459e4(++_0x5604a2);}(_0x28f2,0x193));var _0x228f=function(_0x44d079,_0x2a9dea){_0x44d079=_0x44d079-0x0;var _0x3966f1=_0x28f2[_0x44d079];return _0x3966f1;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['ContactItemType'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':!![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x25')]=function(_0x561144,_0x3e9f76){if(_0x561144[_0x228f('0x4e')]['id']){delete _0x561144[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')]['find']({'where':{'id':_0x561144[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](saveUpdates(_0x561144[_0x228f('0x4e')],null))['then'](respondWithResult(_0x3e9f76,null))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports[_0x228f('0x27')]=function(_0x4b516e,_0x32787c){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x4b516e[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x32787c,null))[_0x228f('0x26')](db[_0x228f('0x54')][_0x228f('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4b516e[_0x228f('0x53')]['id']}}))[_0x228f('0x26')](removeEntity(_0x32787c,null))['catch'](handleError(_0x32787c,null));}; \ No newline at end of file +var _0x0424=['rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0xf9baed,_0x5862e6){var _0x2ad58f=function(_0x52c899){while(--_0x52c899){_0xf9baed['push'](_0xf9baed['shift']());}};_0x2ad58f(++_0x5862e6);}(_0x0424,0x159));var _0x4042=function(_0xca18be,_0x5bbe40){_0xca18be=_0xca18be-0x0;var _0x2815ad=_0x0424[_0xca18be];return _0x2815ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){var _0x2c5fcf=_0x1daee8[_0x4042('0x25')]({'plain':!![]});var _0x5d5c6d=_0x4042('0x26');return db[_0x4042('0x27')][_0x4042('0x28')]({'where':{'type':_0x5d5c6d,'resourceId':_0x2c5fcf['id']}})[_0x4042('0x24')](function(){return _0x1daee8;});})[_0x4042('0x24')](function(){_0x6d12a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8d48,_0x1acdf2){return function(_0x26542c){if(!_0x26542c){_0x1d8d48[_0x4042('0x17')](0x194);}return _0x26542c;};}function handleError(_0x332fe3,_0x473a0d){_0x473a0d=_0x473a0d||0x1f4;return function(_0x5eb84b){logger[_0x4042('0x29')](_0x5eb84b[_0x4042('0x2a')]);if(_0x5eb84b['name']){delete _0x5eb84b[_0x4042('0x2b')];}_0x332fe3[_0x4042('0x18')](_0x473a0d)[_0x4042('0x2c')](_0x5eb84b);};}exports['index']=function(_0x56d49a,_0x3d1f48){var _0x43bd1c={},_0x59773f={},_0x3e9304={'count':0x0,'rows':[]};var _0xc42d70=_[_0x4042('0x2d')](db[_0x4042('0x2e')][_0x4042('0x2f')],function(_0x349c74){return{'name':_0x349c74[_0x4042('0x30')],'type':_0x349c74[_0x4042('0x31')][_0x4042('0x32')]};});_0x59773f['model']=_[_0x4042('0x2d')](_0xc42d70,_0x4042('0x2b'));_0x59773f['query']=_[_0x4042('0x33')](_0x56d49a[_0x4042('0x34')]);_0x59773f['filters']=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],_0x59773f[_0x4042('0x34')]);_0x43bd1c[_0x4042('0x37')]=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],qs[_0x4042('0x38')](_0x56d49a[_0x4042('0x34')][_0x4042('0x38')]));_0x43bd1c[_0x4042('0x37')]=_0x43bd1c[_0x4042('0x37')][_0x4042('0x39')]?_0x43bd1c[_0x4042('0x37')]:_0x59773f[_0x4042('0x36')];if(!_0x56d49a[_0x4042('0x34')][_0x4042('0x3a')](_0x4042('0x3b'))){_0x43bd1c[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1d')]);_0x43bd1c['offset']=qs[_0x4042('0x1b')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1b')]);}_0x43bd1c[_0x4042('0x3c')]=qs['sort'](_0x56d49a[_0x4042('0x34')][_0x4042('0x3d')]);_0x43bd1c[_0x4042('0x3e')]=qs[_0x4042('0x3f')](_[_0x4042('0x40')](_0x56d49a[_0x4042('0x34')],_0x59773f[_0x4042('0x3f')]),_0xc42d70);if(_0x56d49a[_0x4042('0x34')][_0x4042('0x41')]){_0x43bd1c[_0x4042('0x3e')]=_['merge'](_0x43bd1c[_0x4042('0x3e')],{'$or':_[_0x4042('0x2d')](_0xc42d70,function(_0x2f07d8){if(_0x2f07d8[_0x4042('0x31')]!==_0x4042('0x42')){var _0x112e88={};_0x112e88[_0x2f07d8[_0x4042('0x2b')]]={'$like':'%'+_0x56d49a[_0x4042('0x34')]['filter']+'%'};return _0x112e88;}})});}_0x43bd1c=_['merge']({},_0x43bd1c,_0x56d49a[_0x4042('0x43')]);var _0x16468f={'where':_0x43bd1c[_0x4042('0x3e')]};return db[_0x4042('0x2e')][_0x4042('0x1e')](_0x16468f)[_0x4042('0x24')](function(_0xdfb5cb){_0x3e9304[_0x4042('0x1e')]=_0xdfb5cb;if(_0x56d49a[_0x4042('0x34')][_0x4042('0x44')]){_0x43bd1c[_0x4042('0x45')]=[{'all':!![]}];}return db[_0x4042('0x2e')]['findAll'](_0x43bd1c);})['then'](function(_0x929884){_0x3e9304[_0x4042('0x46')]=_0x929884;return _0x3e9304;})['then'](respondWithFilteredResult(_0x3d1f48,_0x43bd1c))[_0x4042('0x47')](handleError(_0x3d1f48,null));};exports['show']=function(_0x25c516,_0x411354){var _0x32ba6f={'raw':!![],'where':{'id':_0x25c516[_0x4042('0x48')]['id']}},_0x4ece0d={};_0x4ece0d[_0x4042('0x36')]=_['keys'](db[_0x4042('0x2e')][_0x4042('0x2f')]);_0x4ece0d[_0x4042('0x34')]=_[_0x4042('0x33')](_0x25c516[_0x4042('0x34')]);_0x4ece0d['filters']=_['intersection'](_0x4ece0d['model'],_0x4ece0d[_0x4042('0x34')]);_0x32ba6f[_0x4042('0x37')]=_['intersection'](_0x4ece0d['model'],qs['fields'](_0x25c516[_0x4042('0x34')]['fields']));_0x32ba6f['attributes']=_0x32ba6f[_0x4042('0x37')][_0x4042('0x39')]?_0x32ba6f[_0x4042('0x37')]:_0x4ece0d[_0x4042('0x36')];if(_0x25c516[_0x4042('0x34')][_0x4042('0x44')]){_0x32ba6f[_0x4042('0x45')]=[{'all':!![]}];}_0x32ba6f=_[_0x4042('0x49')]({},_0x32ba6f,_0x25c516[_0x4042('0x43')]);return db['ContactItemType']['find'](_0x32ba6f)['then'](handleEntityNotFound(_0x411354,null))['then'](respondWithResult(_0x411354,null))[_0x4042('0x47')](handleError(_0x411354,null));};exports[_0x4042('0x4a')]=function(_0xd898ea,_0x250434){return db[_0x4042('0x2e')][_0x4042('0x4a')](_0xd898ea[_0x4042('0x4b')],{})[_0x4042('0x24')](function(_0x4a14bd){var _0x24071a=_0xd898ea[_0x4042('0x4c')][_0x4042('0x25')]({'plain':!![]});if(!_0x24071a)throw new Error(_0x4042('0x4d'));if(_0x24071a[_0x4042('0x4e')]===_0x4042('0x4c')){var _0xf5f38a=_0x4a14bd['get']({'plain':!![]});var _0x5ed001='ContactItemTypes';return db[_0x4042('0x4f')][_0x4042('0x50')]({'where':{'name':_0x5ed001,'userProfileId':_0x24071a['userProfileId']},'raw':!![]})[_0x4042('0x24')](function(_0xa5323d){if(_0xa5323d&&_0xa5323d['autoAssociation']===0x0){return db['UserProfileResource'][_0x4042('0x4a')]({'name':_0xf5f38a[_0x4042('0x2b')],'resourceId':_0xf5f38a['id'],'type':_0xa5323d[_0x4042('0x2b')],'sectionId':_0xa5323d['id']},{})[_0x4042('0x24')](function(){return _0x4a14bd;});}else{return _0x4a14bd;}})[_0x4042('0x47')](function(_0x478645){logger[_0x4042('0x29')](_0x4042('0x51'),_0x478645);throw _0x478645;});}return _0x4a14bd;})[_0x4042('0x24')](respondWithResult(_0x250434,0xc9))[_0x4042('0x47')](handleError(_0x250434,null));};exports[_0x4042('0x23')]=function(_0xfdd409,_0x3876ce){if(_0xfdd409['body']['id']){delete _0xfdd409['body']['id'];}return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0xfdd409[_0x4042('0x48')]['id']}})['then'](handleEntityNotFound(_0x3876ce,null))[_0x4042('0x24')](saveUpdates(_0xfdd409['body'],null))[_0x4042('0x24')](respondWithResult(_0x3876ce,null))['catch'](handleError(_0x3876ce,null));};exports[_0x4042('0x28')]=function(_0x1cba67,_0x22b633){return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0x1cba67[_0x4042('0x48')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x22b633,null))[_0x4042('0x24')](db[_0x4042('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1cba67[_0x4042('0x48')]['id']}}))[_0x4042('0x24')](removeEntity(_0x22b633,null))[_0x4042('0x47')](handleError(_0x22b633,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index f4a7c2c..a941b6a 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe10a=['path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xe10a,0xc8));var _0xae10=function(_0x5d3f7c,_0x496c75){_0x5d3f7c=_0x5d3f7c-0x0;var _0x370fee=_0xe10a[_0x5d3f7c];return _0x370fee;};'use strict';var _=require(_0xae10('0x0'));var util=require(_0xae10('0x1'));var logger=require(_0xae10('0x2'))(_0xae10('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae10('0x4'));var rimraf=require(_0xae10('0x5'));var config=require(_0xae10('0x6'));var attributes=require(_0xae10('0x7'));module[_0xae10('0x8')]=function(_0x5e2b0d,_0x52e974){return _0x5e2b0d[_0xae10('0x9')](_0xae10('0xa'),attributes,{'tableName':_0xae10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4932=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','api','moment','path','rimraf'];(function(_0x7d16d5,_0xe0a01d){var _0x244128=function(_0x54ee2f){while(--_0x54ee2f){_0x7d16d5['push'](_0x7d16d5['shift']());}};_0x244128(++_0xe0a01d);}(_0x4932,0x1c2));var _0x2493=function(_0x56e0c8,_0x39e14c){_0x56e0c8=_0x56e0c8-0x0;var _0x40887b=_0x4932[_0x56e0c8];return _0x40887b;};'use strict';var _=require(_0x2493('0x0'));var util=require(_0x2493('0x1'));var logger=require('../../config/logger')(_0x2493('0x2'));var moment=require(_0x2493('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2493('0x4'));var rimraf=require(_0x2493('0x5'));var config=require(_0x2493('0x6'));var attributes=require(_0x2493('0x7'));module[_0x2493('0x8')]=function(_0x224157,_0x1ecd53){return _0x224157[_0x2493('0x9')](_0x2493('0xa'),attributes,{'tableName':_0x2493('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 48d6fc1..5e460b9 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bfd=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3450db,_0x5b15c8){var _0x40df87=function(_0x13a4c5){while(--_0x13a4c5){_0x3450db['push'](_0x3450db['shift']());}};_0x40df87(++_0x5b15c8);}(_0x1bfd,0xbc));var _0xd1bf=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x1bfd[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xd1bf('0x0'));var util=require(_0xd1bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd1bf('0x2'));var fs=require('fs');var Redis=require(_0xd1bf('0x3'));var db=require(_0xd1bf('0x4'))['db'];var utils=require(_0xd1bf('0x5'));var logger=require(_0xd1bf('0x6'))(_0xd1bf('0x7'));var config=require(_0xd1bf('0x8'));var jayson=require(_0xd1bf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x283346,_0x33903b,_0x589301){return new BPromise(function(_0x529369,_0x23512d){return client[_0xd1bf('0xa')](_0x283346,_0x589301)[_0xd1bf('0xb')](function(_0x4e3628){logger[_0xd1bf('0xc')](_0xd1bf('0xd'),_0x33903b,_0xd1bf('0xe'));logger[_0xd1bf('0xf')](_0xd1bf('0x10'),_0x33903b,'request\x20sent',JSON[_0xd1bf('0x11')](_0x4e3628));if(_0x4e3628[_0xd1bf('0x12')]){if(_0x4e3628['error'][_0xd1bf('0x13')]===0x1f4){logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x4e3628['error'][_0xd1bf('0x14')]);return _0x23512d(_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);}logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);return _0x529369(_0x4e3628[_0xd1bf('0x12')][_0xd1bf('0x14')]);}else{logger['info'](_0xd1bf('0xd'),_0x33903b,_0xd1bf('0xe'));_0x529369(_0x4e3628[_0xd1bf('0x15')][_0xd1bf('0x14')]);}})[_0xd1bf('0x16')](function(_0x947f8b){logger[_0xd1bf('0x12')](_0xd1bf('0xd'),_0x33903b,_0x947f8b);_0x23512d(_0x947f8b);});});} \ No newline at end of file +var _0xfbd5=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ContactItemType,\x20%s,\x20%s','result'];(function(_0x62f260,_0x5a3dad){var _0x46dcb6=function(_0x47c580){while(--_0x47c580){_0x62f260['push'](_0x62f260['shift']());}};_0x46dcb6(++_0x5a3dad);}(_0xfbd5,0x7e));var _0x5fbd=function(_0x1e1305,_0x4444a2){_0x1e1305=_0x1e1305-0x0;var _0x2d91c5=_0xfbd5[_0x1e1305];return _0x2d91c5;};'use strict';var _=require('lodash');var util=require(_0x5fbd('0x0'));var moment=require('moment');var BPromise=require(_0x5fbd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5fbd('0x2'));var db=require(_0x5fbd('0x3'))['db'];var utils=require(_0x5fbd('0x4'));var logger=require(_0x5fbd('0x5'))(_0x5fbd('0x6'));var config=require(_0x5fbd('0x7'));var jayson=require(_0x5fbd('0x8'));var client=jayson[_0x5fbd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6eb82a,_0x34eb53,_0x5332da){return new BPromise(function(_0x18eff0,_0x3b1124){return client[_0x5fbd('0xa')](_0x6eb82a,_0x5332da)[_0x5fbd('0xb')](function(_0x2cd9b1){logger[_0x5fbd('0xc')]('ContactItemType,\x20%s,\x20%s',_0x34eb53,'request\x20sent');logger[_0x5fbd('0xd')](_0x5fbd('0xe'),_0x34eb53,_0x5fbd('0xf'),JSON[_0x5fbd('0x10')](_0x2cd9b1));if(_0x2cd9b1[_0x5fbd('0x11')]){if(_0x2cd9b1['error']['code']===0x1f4){logger[_0x5fbd('0x11')]('ContactItemType,\x20%s,\x20%s',_0x34eb53,_0x2cd9b1[_0x5fbd('0x11')][_0x5fbd('0x12')]);return _0x3b1124(_0x2cd9b1[_0x5fbd('0x11')][_0x5fbd('0x12')]);}logger[_0x5fbd('0x11')](_0x5fbd('0x13'),_0x34eb53,_0x2cd9b1[_0x5fbd('0x11')][_0x5fbd('0x12')]);return _0x18eff0(_0x2cd9b1[_0x5fbd('0x11')][_0x5fbd('0x12')]);}else{logger[_0x5fbd('0xc')](_0x5fbd('0x13'),_0x34eb53,'request\x20sent');_0x18eff0(_0x2cd9b1[_0x5fbd('0x14')][_0x5fbd('0x12')]);}})['catch'](function(_0x565bad){logger[_0x5fbd('0x11')](_0x5fbd('0x13'),_0x34eb53,_0x565bad);_0x3b1124(_0x565bad);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index dfd8223..2d4b4da 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadf2=['update','delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','show','post','create','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xadf2,0x1f1));var _0x2adf=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xadf2[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x2adf('0x0'));var util=require('util');var path=require(_0x2adf('0x1'));var timeout=require(_0x2adf('0x2'));var express=require(_0x2adf('0x3'));var router=express[_0x2adf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2adf('0x5'));var config=require('../../config/environment');var controller=require(_0x2adf('0x6'));router[_0x2adf('0x7')]('/',auth[_0x2adf('0x8')](),controller['index']);router[_0x2adf('0x7')]('/:id',auth[_0x2adf('0x8')](),controller[_0x2adf('0x9')]);router[_0x2adf('0xa')]('/',auth[_0x2adf('0x8')](),controller[_0x2adf('0xb')]);router[_0x2adf('0xc')]('/:id',auth[_0x2adf('0x8')](),controller[_0x2adf('0xd')]);router[_0x2adf('0xe')](_0x2adf('0xf'),auth[_0x2adf('0x8')](),controller['destroy']);module[_0x2adf('0x10')]=router; \ No newline at end of file +var _0x2afb=['show','post','create','put','update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id'];(function(_0x548ade,_0x516546){var _0x10e139=function(_0xbd5edc){while(--_0xbd5edc){_0x548ade['push'](_0x548ade['shift']());}};_0x10e139(++_0x516546);}(_0x2afb,0xcd));var _0xb2af=function(_0x24693e,_0x2ba888){_0x24693e=_0x24693e-0x0;var _0x53e672=_0x2afb[_0x24693e];return _0x53e672;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2af('0x0'));var timeout=require('connect-timeout');var express=require(_0xb2af('0x1'));var router=express[_0xb2af('0x2')]();var fs_extra=require(_0xb2af('0x3'));var auth=require(_0xb2af('0x4'));var interaction=require(_0xb2af('0x5'));var config=require('../../config/environment');var controller=require(_0xb2af('0x6'));router[_0xb2af('0x7')]('/',auth[_0xb2af('0x8')](),controller[_0xb2af('0x9')]);router[_0xb2af('0x7')](_0xb2af('0xa'),auth[_0xb2af('0x8')](),controller[_0xb2af('0xb')]);router[_0xb2af('0xc')]('/',auth[_0xb2af('0x8')](),controller[_0xb2af('0xd')]);router[_0xb2af('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb2af('0xf')]);router['delete'](_0xb2af('0xa'),auth[_0xb2af('0x8')](),controller[_0xb2af('0x10')]);module[_0xb2af('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1b6bcaa..2b04b6f 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x2d996f,_0xb83a8b){var _0x1fd971=function(_0x6ab50b){while(--_0x6ab50b){_0x2d996f['push'](_0x2d996f['shift']());}};_0x1fd971(++_0xb83a8b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe706,0xa3));var _0x6e70=function(_0x5659f4,_0x3a072a){_0x5659f4=_0x5659f4-0x0;var _0x18e9a5=_0xe706[_0x5659f4];return _0x18e9a5;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 3a1f17c..c1f27ce 100644 --- a/server/api/dashboard/dashboard.controller.js +++ b/server/api/dashboard/dashboard.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43a4=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','destroy','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','order','filter','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./dashboard.socket','register','sendStatus','status'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x43a4,0xee));var _0x443a=function(_0x5d12b3,_0x27bb94){_0x5d12b3=_0x5d12b3-0x0;var _0x59c5b0=_0x43a4[_0x5d12b3];return _0x59c5b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x443a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x443a('0x1'));var moment=require('moment');var BPromise=require(_0x443a('0x2'));var Mustache=require(_0x443a('0x3'));var util=require(_0x443a('0x4'));var path=require(_0x443a('0x5'));var sox=require(_0x443a('0x6'));var csv=require(_0x443a('0x7'));var ejs=require(_0x443a('0x8'));var fs=require('fs');var fs_extra=require(_0x443a('0x9'));var _=require(_0x443a('0xa'));var squel=require('squel');var crypto=require(_0x443a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x443a('0xc'));var toCsv=require(_0x443a('0x7'));var querystring=require(_0x443a('0xd'));var Papa=require(_0x443a('0xe'));var Redis=require(_0x443a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x443a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x443a('0x11'));var logger=require(_0x443a('0x12'))(_0x443a('0x13'));var utils=require(_0x443a('0x14'));var config=require(_0x443a('0x15'));var licenseUtil=require(_0x443a('0x16'));var db=require(_0x443a('0x17'))['db'];config['redis']=_[_0x443a('0x18')](config[_0x443a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x443a('0x19')]));require(_0x443a('0x1a'))[_0x443a('0x1b')](socket);function respondWithStatusCode(_0x4bc903,_0x4d0cc5){_0x4d0cc5=_0x4d0cc5||0xcc;return function(_0x2cbde7){if(_0x2cbde7){return _0x4bc903[_0x443a('0x1c')](_0x4d0cc5);}return _0x4bc903[_0x443a('0x1d')](_0x4d0cc5)[_0x443a('0x1e')]();};}function respondWithResult(_0x5cb3ba,_0x514d9b){_0x514d9b=_0x514d9b||0xc8;return function(_0x34eabc){if(_0x34eabc){return _0x5cb3ba[_0x443a('0x1d')](_0x514d9b)[_0x443a('0x1f')](_0x34eabc);}};}function respondWithFilteredResult(_0x5cd970,_0x41e6b5){return function(_0x201e9e){if(_0x201e9e){var _0xbdcff6=typeof _0x41e6b5[_0x443a('0x20')]==='undefined'&&typeof _0x41e6b5[_0x443a('0x21')]===_0x443a('0x22');var _0x42098b=_0x201e9e[_0x443a('0x23')];var _0x329e83=_0xbdcff6?0x0:_0x41e6b5[_0x443a('0x20')];var _0x1bc11f=_0xbdcff6?_0x201e9e[_0x443a('0x23')]:_0x41e6b5['offset']+_0x41e6b5[_0x443a('0x21')];var _0x1e1a4d;if(_0x1bc11f>=_0x42098b){_0x1bc11f=_0x42098b;_0x1e1a4d=0xc8;}else{_0x1e1a4d=0xce;}_0x5cd970[_0x443a('0x1d')](_0x1e1a4d);return _0x5cd970[_0x443a('0x24')](_0x443a('0x25'),_0x329e83+'-'+_0x1bc11f+'/'+_0x42098b)[_0x443a('0x1f')](_0x201e9e);}return null;};}function patchUpdates(_0x113ee3){return function(_0x137401){try{jsonpatch[_0x443a('0x26')](_0x137401,_0x113ee3,!![]);}catch(_0x93ea6){return BPromise[_0x443a('0x27')](_0x93ea6);}return _0x137401[_0x443a('0x28')]();};}function saveUpdates(_0x31be63,_0x34e88a){return function(_0x12ab21){if(_0x12ab21){return _0x12ab21[_0x443a('0x29')](_0x31be63)[_0x443a('0x2a')](function(_0x373707){return _0x373707;});}return null;};}function removeEntity(_0x4534a6,_0x10c655){return function(_0x2a961f){if(_0x2a961f){return _0x2a961f['destroy']()[_0x443a('0x2a')](function(){var _0x2ed5b5=_0x2a961f['get']({'plain':!![]});var _0x1865bf=_0x443a('0x2b');return db[_0x443a('0x2c')]['destroy']({'where':{'type':_0x1865bf,'resourceId':_0x2ed5b5['id']}})[_0x443a('0x2a')](function(){return _0x2a961f;});})[_0x443a('0x2a')](function(){_0x4534a6[_0x443a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393b2a,_0x5682af){return function(_0x489c8a){if(!_0x489c8a){_0x393b2a[_0x443a('0x1c')](0x194);}return _0x489c8a;};}function handleError(_0x2c3e57,_0x1ad6c5){_0x1ad6c5=_0x1ad6c5||0x1f4;return function(_0x254a25){logger[_0x443a('0x2d')](_0x254a25[_0x443a('0x2e')]);if(_0x254a25['name']){delete _0x254a25[_0x443a('0x2f')];}_0x2c3e57['status'](_0x1ad6c5)['send'](_0x254a25);};}exports[_0x443a('0x30')]=function(_0x7128dd,_0x4fed6c){var _0x25c402={},_0x3209c1={},_0x3e4bb1={'count':0x0,'rows':[]};var _0x1615e6=_[_0x443a('0x31')](db[_0x443a('0x32')][_0x443a('0x33')],function(_0x571b37){return{'name':_0x571b37[_0x443a('0x34')],'type':_0x571b37[_0x443a('0x35')]['key']};});_0x3209c1[_0x443a('0x36')]=_['map'](_0x1615e6,'name');_0x3209c1[_0x443a('0x37')]=_[_0x443a('0x38')](_0x7128dd[_0x443a('0x37')]);_0x3209c1['filters']=_[_0x443a('0x39')](_0x3209c1[_0x443a('0x36')],_0x3209c1['query']);_0x25c402[_0x443a('0x3a')]=_['intersection'](_0x3209c1[_0x443a('0x36')],qs[_0x443a('0x3b')](_0x7128dd[_0x443a('0x37')][_0x443a('0x3b')]));_0x25c402[_0x443a('0x3a')]=_0x25c402[_0x443a('0x3a')][_0x443a('0x3c')]?_0x25c402['attributes']:_0x3209c1['model'];if(!_0x7128dd[_0x443a('0x37')][_0x443a('0x3d')](_0x443a('0x3e'))){_0x25c402[_0x443a('0x21')]=qs[_0x443a('0x21')](_0x7128dd[_0x443a('0x37')][_0x443a('0x21')]);_0x25c402[_0x443a('0x20')]=qs[_0x443a('0x20')](_0x7128dd['query']['offset']);}_0x25c402['order']=qs[_0x443a('0x3f')](_0x7128dd[_0x443a('0x37')][_0x443a('0x3f')]);_0x25c402[_0x443a('0x40')]=qs[_0x443a('0x41')](_[_0x443a('0x42')](_0x7128dd[_0x443a('0x37')],_0x3209c1['filters']),_0x1615e6);if(_0x7128dd[_0x443a('0x37')]['filter']){_0x25c402['where']=_[_0x443a('0x43')](_0x25c402[_0x443a('0x40')],{'$or':_[_0x443a('0x31')](_0x1615e6,function(_0x729d86){if(_0x729d86['type']!==_0x443a('0x44')){var _0x2259c8={};_0x2259c8[_0x729d86[_0x443a('0x2f')]]={'$like':'%'+_0x7128dd[_0x443a('0x37')]['filter']+'%'};return _0x2259c8;}})});}_0x25c402=_[_0x443a('0x43')]({},_0x25c402,_0x7128dd[_0x443a('0x45')]);var _0x150884={'where':_0x25c402[_0x443a('0x40')]};return db[_0x443a('0x32')]['count'](_0x150884)[_0x443a('0x2a')](function(_0x553c2c){_0x3e4bb1['count']=_0x553c2c;if(_0x7128dd[_0x443a('0x37')][_0x443a('0x46')]){_0x25c402['include']=[{'all':!![]}];}return db['Dashboard'][_0x443a('0x47')](_0x25c402);})['then'](function(_0x2079a5){_0x3e4bb1[_0x443a('0x48')]=_0x2079a5;return _0x3e4bb1;})[_0x443a('0x2a')](respondWithFilteredResult(_0x4fed6c,_0x25c402))[_0x443a('0x49')](handleError(_0x4fed6c,null));};exports[_0x443a('0x4a')]=function(_0xbac7a4,_0x26c2b0){var _0x46e840={'raw':![],'where':{'id':_0xbac7a4[_0x443a('0x4b')]['id']}},_0x1f6779={};_0x1f6779['model']=_[_0x443a('0x38')](db[_0x443a('0x32')][_0x443a('0x33')]);_0x1f6779[_0x443a('0x37')]=_[_0x443a('0x38')](_0xbac7a4[_0x443a('0x37')]);_0x1f6779[_0x443a('0x41')]=_[_0x443a('0x39')](_0x1f6779[_0x443a('0x36')],_0x1f6779[_0x443a('0x37')]);_0x46e840[_0x443a('0x3a')]=_[_0x443a('0x39')](_0x1f6779['model'],qs[_0x443a('0x3b')](_0xbac7a4[_0x443a('0x37')][_0x443a('0x3b')]));_0x46e840[_0x443a('0x3a')]=_0x46e840[_0x443a('0x3a')][_0x443a('0x3c')]?_0x46e840['attributes']:_0x1f6779[_0x443a('0x36')];if(_0xbac7a4['query']['includeAll']){_0x46e840[_0x443a('0x4c')]=[{'all':!![]}];}_0x46e840=_[_0x443a('0x43')]({},_0x46e840,_0xbac7a4[_0x443a('0x45')]);return db[_0x443a('0x32')][_0x443a('0x4d')](_0x46e840)['then'](handleEntityNotFound(_0x26c2b0,null))[_0x443a('0x2a')](respondWithResult(_0x26c2b0,null))[_0x443a('0x49')](handleError(_0x26c2b0,null));};exports[_0x443a('0x4e')]=function(_0x4ce07b,_0x5cedcd){return db[_0x443a('0x32')][_0x443a('0x4e')](_0x4ce07b[_0x443a('0x4f')],{})['then'](function(_0x337652){var _0x3c9e9e=_0x4ce07b[_0x443a('0x50')][_0x443a('0x51')]({'plain':!![]});if(!_0x3c9e9e)throw new Error(_0x443a('0x52'));if(_0x3c9e9e[_0x443a('0x53')]==='user'){var _0x4c699a=_0x337652[_0x443a('0x51')]({'plain':!![]});var _0x32a63e=_0x443a('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x32a63e,'userProfileId':_0x3c9e9e[_0x443a('0x54')]},'raw':!![]})[_0x443a('0x2a')](function(_0x2d1f28){if(_0x2d1f28&&_0x2d1f28['autoAssociation']===0x0){return db[_0x443a('0x2c')]['create']({'name':_0x4c699a[_0x443a('0x2f')],'resourceId':_0x4c699a['id'],'type':_0x2d1f28[_0x443a('0x2f')],'sectionId':_0x2d1f28['id']},{})['then'](function(){return _0x337652;});}else{return _0x337652;}})[_0x443a('0x49')](function(_0x15d790){logger['error'](_0x443a('0x55'),_0x15d790);throw _0x15d790;});}return _0x337652;})['then'](respondWithResult(_0x5cedcd,0xc9))[_0x443a('0x49')](handleError(_0x5cedcd,null));};exports[_0x443a('0x56')]=function(_0x1a6c09,_0x2b6d11){var _0x18f29d={'where':{'id':_0x1a6c09[_0x443a('0x4b')]['id']}},_0xb07a67={};_0xb07a67['model']=_[_0x443a('0x38')](db[_0x443a('0x32')][_0x443a('0x33')]);_0x18f29d[_0x443a('0x3a')]=_[_0x443a('0x39')](_0xb07a67[_0x443a('0x36')],qs[_0x443a('0x3b')](_0x1a6c09[_0x443a('0x37')][_0x443a('0x3b')]));_0x18f29d[_0x443a('0x3a')]=_0x18f29d[_0x443a('0x3a')]['length']?_0x18f29d['attributes']:_0xb07a67['model'];if(_0x1a6c09[_0x443a('0x37')][_0x443a('0x46')]){_0x18f29d[_0x443a('0x4c')]=[{'all':!![]}];}_0x18f29d=_[_0x443a('0x43')]({},_0x18f29d,_0x1a6c09[_0x443a('0x45')]);return db[_0x443a('0x32')]['find'](_0x18f29d)['then'](handleEntityNotFound(_0x2b6d11,null))['then'](function(_0x2dc2a3){if(_0x2dc2a3){var _0x2b932a=_0x2dc2a3[_0x443a('0x51')]({'plain':!![]});_0x2b932a=qs[_0x443a('0x57')](_0x2b932a,['id',_0x443a('0x58'),_0x443a('0x59')]);_0x1a6c09[_0x443a('0x4f')]=_[_0x443a('0x57')](_0x1a6c09[_0x443a('0x4f')],['id',_0x443a('0x58'),'updatedAt']);return db[_0x443a('0x32')]['create'](_['merge'](_0x2b932a,_0x1a6c09[_0x443a('0x4f')]),{'include':_0x1a6c09[_0x443a('0x37')][_0x443a('0x46')]?[{'all':!![]}]:undefined})[_0x443a('0x2a')](function(_0x4ecf7e){var _0x5a512c=_0x1a6c09[_0x443a('0x50')][_0x443a('0x51')]({'plain':!![]});if(!_0x5a512c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a512c[_0x443a('0x53')]===_0x443a('0x50')){var _0x2ca789=_0x4ecf7e[_0x443a('0x51')]({'plain':!![]});var _0x160a43=_0x443a('0x2b');return db[_0x443a('0x5a')][_0x443a('0x4d')]({'where':{'name':_0x160a43,'userProfileId':_0x5a512c[_0x443a('0x54')]},'raw':!![]})[_0x443a('0x2a')](function(_0x46a7b9){if(_0x46a7b9&&_0x46a7b9[_0x443a('0x5b')]===0x0){return db[_0x443a('0x2c')]['create']({'name':_0x2ca789[_0x443a('0x2f')],'resourceId':_0x2ca789['id'],'type':_0x46a7b9[_0x443a('0x2f')],'sectionId':_0x46a7b9['id']},{})[_0x443a('0x2a')](function(){return _0x4ecf7e;});}else{return _0x4ecf7e;}})[_0x443a('0x49')](function(_0x578bc6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x578bc6);throw _0x578bc6;});}return _0x4ecf7e;});}})[_0x443a('0x2a')](respondWithResult(_0x2b6d11,0xc9))[_0x443a('0x49')](handleError(_0x2b6d11,null));};exports['update']=function(_0x2b5f22,_0x4a0eed){if(_0x2b5f22['body']['id']){delete _0x2b5f22[_0x443a('0x4f')]['id'];}return db['Dashboard'][_0x443a('0x4d')]({'where':{'id':_0x2b5f22[_0x443a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a0eed,null))[_0x443a('0x2a')](saveUpdates(_0x2b5f22[_0x443a('0x4f')],null))[_0x443a('0x2a')](respondWithResult(_0x4a0eed,null))[_0x443a('0x49')](handleError(_0x4a0eed,null));};exports[_0x443a('0x5c')]=function(_0x4d55d8,_0x37471f){return db[_0x443a('0x32')][_0x443a('0x4d')]({'where':{'id':_0x4d55d8['params']['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x37471f,null))[_0x443a('0x2a')](removeEntity(_0x37471f,null))['catch'](handleError(_0x37471f,null));};function widgetAttributes(_0xa0abd5){try{switch(_0xa0abd5[_0x443a('0x35')]){case _0x443a('0x5d'):return[{'name':_0x443a('0x5e'),'value':_0xa0abd5[_0x443a('0x5e')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5['attrs'][0x0]['value']:undefined)||_0x443a('0x60')}];case _0x443a('0x61'):return[{'name':_0x443a('0x62'),'value':_0xa0abd5[_0x443a('0x62')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5['attrs'][0x0][_0x443a('0x63')]:undefined)||''}];case _0x443a('0x64'):return[{'name':_0x443a('0x65'),'value':_0xa0abd5['attrHourFormat']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x66')},{'name':_0x443a('0x67'),'value':_0xa0abd5[_0x443a('0x67')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x1]?_0xa0abd5['attrs'][0x1][_0x443a('0x63')]:undefined)||_0x443a('0x68')},{'name':_0x443a('0x69'),'value':_0xa0abd5['attrFontSize']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x2]?_0xa0abd5['attrs'][0x2][_0x443a('0x63')]:undefined)||0xc}];case _0x443a('0x6a'):return[{'name':'attrMetric','value':_0xa0abd5[_0x443a('0x6b')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x6c')},{'name':'attrVoiceQueues','value':_0xa0abd5[_0x443a('0x6d')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||[]},{'name':_0x443a('0x69'),'value':_0xa0abd5[_0x443a('0x69')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x2]?_0xa0abd5[_0x443a('0x5f')][0x2][_0x443a('0x63')]:undefined)||0x14},{'name':_0x443a('0x6e'),'value':_0xa0abd5[_0x443a('0x6e')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x3]?_0xa0abd5['attrs'][0x3][_0x443a('0x63')]:undefined)||'voice'},{'name':_0x443a('0x6f'),'value':_0xa0abd5['attrEmailAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x4]?_0xa0abd5[_0x443a('0x5f')][0x4][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x70'),'value':_0xa0abd5['attrFaxAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x5]?_0xa0abd5[_0x443a('0x5f')][0x5][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x71'),'value':_0xa0abd5[_0x443a('0x71')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x6]?_0xa0abd5[_0x443a('0x5f')][0x6][_0x443a('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xa0abd5[_0x443a('0x72')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x7]?_0xa0abd5[_0x443a('0x5f')][0x7][_0x443a('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xa0abd5[_0x443a('0x73')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x8]?_0xa0abd5['attrs'][0x8]['value']:undefined)||''},{'name':_0x443a('0x74'),'value':_0xa0abd5[_0x443a('0x74')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x9]?_0xa0abd5['attrs'][0x9][_0x443a('0x63')]:undefined)||''}];case'multibar-chart':case _0x443a('0x75'):return[{'name':'attrSerie1','value':_0xa0abd5[_0x443a('0x76')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||_0x443a('0x6c')},{'name':_0x443a('0x77'),'value':_0xa0abd5[_0x443a('0x77')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x78'),'value':_0xa0abd5[_0x443a('0x78')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x2]?_0xa0abd5[_0x443a('0x5f')][0x2][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x6d'),'value':_0xa0abd5[_0x443a('0x6d')]||(_0xa0abd5['attrs']&&_0xa0abd5['attrs'][0x3]?_0xa0abd5[_0x443a('0x5f')][0x3][_0x443a('0x63')]:undefined)||[]},{'name':'attrChannel','value':_0xa0abd5['attrChannel']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x4]?_0xa0abd5['attrs'][0x4][_0x443a('0x63')]:undefined)||_0x443a('0x79')},{'name':'attrEmailAccounts','value':_0xa0abd5['attrEmailAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x5]?_0xa0abd5[_0x443a('0x5f')][0x5][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x70'),'value':_0xa0abd5['attrFaxAccounts']||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x6]?_0xa0abd5['attrs'][0x6][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x71'),'value':_0xa0abd5[_0x443a('0x71')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x7]?_0xa0abd5[_0x443a('0x5f')][0x7]['value']:undefined)||''},{'name':_0x443a('0x72'),'value':_0xa0abd5[_0x443a('0x72')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x8]?_0xa0abd5[_0x443a('0x5f')][0x8][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x73'),'value':_0xa0abd5[_0x443a('0x73')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5['attrs'][0x9]?_0xa0abd5[_0x443a('0x5f')][0x9][_0x443a('0x63')]:undefined)||''},{'name':_0x443a('0x74'),'value':_0xa0abd5[_0x443a('0x74')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0xa]?_0xa0abd5[_0x443a('0x5f')][0xa]['value']:undefined)||''}];case _0x443a('0x7a'):return[{'name':'attrReport','type':_0xa0abd5[_0x443a('0x7b')]||(_0xa0abd5[_0x443a('0x5f')]&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x35')]:undefined)||null,'value':_0xa0abd5[_0x443a('0x7c')]||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x0]?_0xa0abd5[_0x443a('0x5f')][0x0][_0x443a('0x63')]:undefined)||null},{'name':_0x443a('0x7d'),'value':_0xa0abd5['attrRefresh']||(_0xa0abd5['attrs']&&_0xa0abd5[_0x443a('0x5f')][0x1]?_0xa0abd5[_0x443a('0x5f')][0x1][_0x443a('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x2ab25c){logger[_0x443a('0x2d')](_0x443a('0x7e'),JSON[_0x443a('0x7f')](_0x2ab25c));return[];}}exports['addItem']=function(_0x1c0d86,_0x3c81ec,_0x171dc){if(_0x1c0d86[_0x443a('0x4f')]['id']){delete _0x1c0d86[_0x443a('0x4f')]['id'];}return db[_0x443a('0x32')][_0x443a('0x4d')]({'where':{'id':_0x1c0d86['params']['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x3c81ec,null))[_0x443a('0x2a')](function(_0x184b5d){if(_0x184b5d){_0x1c0d86[_0x443a('0x4f')][_0x443a('0x80')]=_0x184b5d['id'];_0x1c0d86['body'][_0x443a('0x5f')]=widgetAttributes(_0x1c0d86['body']);return db[_0x443a('0x81')][_0x443a('0x4e')](_0x1c0d86[_0x443a('0x4f')]);}})[_0x443a('0x2a')](respondWithResult(_0x3c81ec,null))[_0x443a('0x49')](handleError(_0x3c81ec,null));};exports[_0x443a('0x82')]=function(_0xc7a95a,_0x98776d,_0x4003bd){var _0x138459={};var _0x514be6={};var _0x5d41d6;var _0x3b8b99;return db[_0x443a('0x32')][_0x443a('0x83')]({'where':{'id':_0xc7a95a[_0x443a('0x4b')]['id']}})[_0x443a('0x2a')](handleEntityNotFound(_0x98776d,null))[_0x443a('0x2a')](function(_0xe4d89b){if(_0xe4d89b){_0x5d41d6=_0xe4d89b;_0x514be6['model']=_[_0x443a('0x38')](db[_0x443a('0x81')]['rawAttributes']);_0x514be6['query']=_[_0x443a('0x38')](_0xc7a95a[_0x443a('0x37')]);_0x514be6[_0x443a('0x41')]=_[_0x443a('0x39')](_0x514be6[_0x443a('0x36')],_0x514be6[_0x443a('0x37')]);_0x138459[_0x443a('0x3a')]=_['intersection'](_0x514be6[_0x443a('0x36')],qs[_0x443a('0x3b')](_0xc7a95a[_0x443a('0x37')][_0x443a('0x3b')]));_0x138459['attributes']=_0x138459[_0x443a('0x3a')][_0x443a('0x3c')]?_0x138459[_0x443a('0x3a')]:_0x514be6[_0x443a('0x36')];_0x138459[_0x443a('0x84')]=qs['sort'](_0xc7a95a['query'][_0x443a('0x3f')]);_0x138459[_0x443a('0x40')]=qs[_0x443a('0x41')](_[_0x443a('0x42')](_0xc7a95a[_0x443a('0x37')],_0x514be6['filters']));if(_0xc7a95a['query']['filter']){_0x138459[_0x443a('0x40')]=_[_0x443a('0x43')](_0x138459[_0x443a('0x40')],{'$or':_['map'](_0x138459['attributes'],function(_0x41969e){var _0x5e76ad={};_0x5e76ad[_0x41969e]={'$like':'%'+_0xc7a95a[_0x443a('0x37')][_0x443a('0x85')]+'%'};return _0x5e76ad;})});}_0x138459=_[_0x443a('0x43')]({},_0x138459,_0xc7a95a[_0x443a('0x45')]);return _0x5d41d6[_0x443a('0x82')](_0x138459);}})[_0x443a('0x2a')](function(_0x2b450f){if(_0x2b450f){_0x3b8b99=_0x2b450f[_0x443a('0x3c')];if(!_0xc7a95a[_0x443a('0x37')][_0x443a('0x3d')](_0x443a('0x3e'))){_0x138459['limit']=qs[_0x443a('0x21')](_0xc7a95a['query']['limit']);_0x138459[_0x443a('0x20')]=qs[_0x443a('0x20')](_0xc7a95a[_0x443a('0x37')][_0x443a('0x20')]);}return _0x5d41d6[_0x443a('0x82')](_0x138459);}})[_0x443a('0x2a')](function(_0x571772){if(_0x571772){return _0x571772?{'count':_0x3b8b99,'rows':_0x571772}:null;}})[_0x443a('0x2a')](respondWithResult(_0x98776d,null))[_0x443a('0x49')](handleError(_0x98776d,null));}; \ No newline at end of file +var _0x5290=['clone','createdAt','updatedAt','omit','update','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','limit','undefined','count','offset','apply','reject','then','destroy','get','CustomDashboards','UserProfileResource','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','options','rows','catch','show','params','includeAll','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x5290,0xa8));var _0x0529=function(_0x62631,_0x913001){_0x62631=_0x62631-0x0;var _0x2ff82e=_0x5290[_0x62631];return _0x2ff82e;};'use strict';var emlformat=require(_0x0529('0x0'));var rimraf=require(_0x0529('0x1'));var zipdir=require(_0x0529('0x2'));var jsonpatch=require(_0x0529('0x3'));var rp=require(_0x0529('0x4'));var moment=require(_0x0529('0x5'));var BPromise=require(_0x0529('0x6'));var Mustache=require(_0x0529('0x7'));var util=require(_0x0529('0x8'));var path=require(_0x0529('0x9'));var sox=require('sox');var csv=require(_0x0529('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0529('0xb'));var _=require(_0x0529('0xc'));var squel=require('squel');var crypto=require(_0x0529('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0529('0xe'));var toCsv=require(_0x0529('0xa'));var querystring=require(_0x0529('0xf'));var Papa=require('papaparse');var Redis=require(_0x0529('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0529('0x11'));var hardwareService=require(_0x0529('0x12'));var logger=require(_0x0529('0x13'))('api');var utils=require(_0x0529('0x14'));var config=require(_0x0529('0x15'));var licenseUtil=require(_0x0529('0x16'));var db=require('../../mysqldb')['db'];config[_0x0529('0x17')]=_[_0x0529('0x18')](config[_0x0529('0x17')],{'host':_0x0529('0x19'),'port':0x18eb});var socket=require(_0x0529('0x1a'))(new Redis(config['redis']));require(_0x0529('0x1b'))['register'](socket);function respondWithStatusCode(_0x51ab72,_0x4574f3){_0x4574f3=_0x4574f3||0xcc;return function(_0x4cf9dc){if(_0x4cf9dc){return _0x51ab72[_0x0529('0x1c')](_0x4574f3);}return _0x51ab72[_0x0529('0x1d')](_0x4574f3)['end']();};}function respondWithResult(_0x193cd4,_0x583884){_0x583884=_0x583884||0xc8;return function(_0x20e37c){if(_0x20e37c){return _0x193cd4['status'](_0x583884)[_0x0529('0x1e')](_0x20e37c);}};}function respondWithFilteredResult(_0x162e0d,_0x4d1beb){return function(_0x13501f){if(_0x13501f){var _0x255930=typeof _0x4d1beb['offset']==='undefined'&&typeof _0x4d1beb[_0x0529('0x1f')]===_0x0529('0x20');var _0x320409=_0x13501f[_0x0529('0x21')];var _0x529982=_0x255930?0x0:_0x4d1beb[_0x0529('0x22')];var _0x471faa=_0x255930?_0x13501f['count']:_0x4d1beb['offset']+_0x4d1beb[_0x0529('0x1f')];var _0x520e76;if(_0x471faa>=_0x320409){_0x471faa=_0x320409;_0x520e76=0xc8;}else{_0x520e76=0xce;}_0x162e0d[_0x0529('0x1d')](_0x520e76);return _0x162e0d['set']('Content-Range',_0x529982+'-'+_0x471faa+'/'+_0x320409)[_0x0529('0x1e')](_0x13501f);}return null;};}function patchUpdates(_0x57c23d){return function(_0x5d1eff){try{jsonpatch[_0x0529('0x23')](_0x5d1eff,_0x57c23d,!![]);}catch(_0xa4f113){return BPromise[_0x0529('0x24')](_0xa4f113);}return _0x5d1eff['save']();};}function saveUpdates(_0x1393dc,_0x1f403d){return function(_0xa2f29b){if(_0xa2f29b){return _0xa2f29b['update'](_0x1393dc)[_0x0529('0x25')](function(_0x490fe0){return _0x490fe0;});}return null;};}function removeEntity(_0x247945,_0x353146){return function(_0x2344bf){if(_0x2344bf){return _0x2344bf[_0x0529('0x26')]()[_0x0529('0x25')](function(){var _0x3838e=_0x2344bf[_0x0529('0x27')]({'plain':!![]});var _0x154258=_0x0529('0x28');return db[_0x0529('0x29')][_0x0529('0x26')]({'where':{'type':_0x154258,'resourceId':_0x3838e['id']}})[_0x0529('0x25')](function(){return _0x2344bf;});})[_0x0529('0x25')](function(){_0x247945[_0x0529('0x1d')](0xcc)[_0x0529('0x2a')]();});}};}function handleEntityNotFound(_0x103e3a,_0x3b1e4f){return function(_0x86873e){if(!_0x86873e){_0x103e3a[_0x0529('0x1c')](0x194);}return _0x86873e;};}function handleError(_0x5ad40f,_0x4dff5d){_0x4dff5d=_0x4dff5d||0x1f4;return function(_0x585c05){logger[_0x0529('0x2b')](_0x585c05[_0x0529('0x2c')]);if(_0x585c05[_0x0529('0x2d')]){delete _0x585c05[_0x0529('0x2d')];}_0x5ad40f['status'](_0x4dff5d)[_0x0529('0x2e')](_0x585c05);};}exports[_0x0529('0x2f')]=function(_0x31a264,_0x22e465){var _0x3eb79d={},_0x30c07e={},_0x533828={'count':0x0,'rows':[]};var _0x1d3e47=_[_0x0529('0x30')](db[_0x0529('0x31')][_0x0529('0x32')],function(_0x3b5338){return{'name':_0x3b5338[_0x0529('0x33')],'type':_0x3b5338['type']['key']};});_0x30c07e['model']=_[_0x0529('0x30')](_0x1d3e47,_0x0529('0x2d'));_0x30c07e[_0x0529('0x34')]=_[_0x0529('0x35')](_0x31a264[_0x0529('0x34')]);_0x30c07e[_0x0529('0x36')]=_[_0x0529('0x37')](_0x30c07e['model'],_0x30c07e[_0x0529('0x34')]);_0x3eb79d[_0x0529('0x38')]=_[_0x0529('0x37')](_0x30c07e[_0x0529('0x39')],qs[_0x0529('0x3a')](_0x31a264[_0x0529('0x34')]['fields']));_0x3eb79d[_0x0529('0x38')]=_0x3eb79d[_0x0529('0x38')][_0x0529('0x3b')]?_0x3eb79d[_0x0529('0x38')]:_0x30c07e[_0x0529('0x39')];if(!_0x31a264[_0x0529('0x34')][_0x0529('0x3c')](_0x0529('0x3d'))){_0x3eb79d[_0x0529('0x1f')]=qs['limit'](_0x31a264[_0x0529('0x34')]['limit']);_0x3eb79d[_0x0529('0x22')]=qs[_0x0529('0x22')](_0x31a264[_0x0529('0x34')]['offset']);}_0x3eb79d[_0x0529('0x3e')]=qs['sort'](_0x31a264[_0x0529('0x34')]['sort']);_0x3eb79d['where']=qs[_0x0529('0x36')](_[_0x0529('0x3f')](_0x31a264['query'],_0x30c07e[_0x0529('0x36')]),_0x1d3e47);if(_0x31a264[_0x0529('0x34')][_0x0529('0x40')]){_0x3eb79d[_0x0529('0x41')]=_['merge'](_0x3eb79d[_0x0529('0x41')],{'$or':_[_0x0529('0x30')](_0x1d3e47,function(_0x144d3d){if(_0x144d3d['type']!==_0x0529('0x42')){var _0x3155eb={};_0x3155eb[_0x144d3d['name']]={'$like':'%'+_0x31a264[_0x0529('0x34')]['filter']+'%'};return _0x3155eb;}})});}_0x3eb79d=_['merge']({},_0x3eb79d,_0x31a264[_0x0529('0x43')]);var _0x31300e={'where':_0x3eb79d[_0x0529('0x41')]};return db[_0x0529('0x31')][_0x0529('0x21')](_0x31300e)['then'](function(_0x214064){_0x533828[_0x0529('0x21')]=_0x214064;if(_0x31a264['query']['includeAll']){_0x3eb79d['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x3eb79d);})[_0x0529('0x25')](function(_0x5358b4){_0x533828[_0x0529('0x44')]=_0x5358b4;return _0x533828;})[_0x0529('0x25')](respondWithFilteredResult(_0x22e465,_0x3eb79d))[_0x0529('0x45')](handleError(_0x22e465,null));};exports[_0x0529('0x46')]=function(_0x35fb99,_0x4b183d){var _0x14317a={'raw':![],'where':{'id':_0x35fb99[_0x0529('0x47')]['id']}},_0xf3aa30={};_0xf3aa30[_0x0529('0x39')]=_[_0x0529('0x35')](db['Dashboard'][_0x0529('0x32')]);_0xf3aa30[_0x0529('0x34')]=_[_0x0529('0x35')](_0x35fb99[_0x0529('0x34')]);_0xf3aa30[_0x0529('0x36')]=_['intersection'](_0xf3aa30[_0x0529('0x39')],_0xf3aa30[_0x0529('0x34')]);_0x14317a[_0x0529('0x38')]=_['intersection'](_0xf3aa30[_0x0529('0x39')],qs[_0x0529('0x3a')](_0x35fb99[_0x0529('0x34')][_0x0529('0x3a')]));_0x14317a[_0x0529('0x38')]=_0x14317a['attributes'][_0x0529('0x3b')]?_0x14317a['attributes']:_0xf3aa30[_0x0529('0x39')];if(_0x35fb99['query'][_0x0529('0x48')]){_0x14317a[_0x0529('0x49')]=[{'all':!![]}];}_0x14317a=_[_0x0529('0x4a')]({},_0x14317a,_0x35fb99[_0x0529('0x43')]);return db[_0x0529('0x31')][_0x0529('0x4b')](_0x14317a)[_0x0529('0x25')](handleEntityNotFound(_0x4b183d,null))[_0x0529('0x25')](respondWithResult(_0x4b183d,null))['catch'](handleError(_0x4b183d,null));};exports['create']=function(_0x3e7b71,_0x3dc48d){return db[_0x0529('0x31')][_0x0529('0x4c')](_0x3e7b71[_0x0529('0x4d')],{})[_0x0529('0x25')](function(_0x10d198){var _0x155666=_0x3e7b71[_0x0529('0x4e')][_0x0529('0x27')]({'plain':!![]});if(!_0x155666)throw new Error(_0x0529('0x4f'));if(_0x155666[_0x0529('0x50')]===_0x0529('0x4e')){var _0xfbc418=_0x10d198[_0x0529('0x27')]({'plain':!![]});var _0x413365=_0x0529('0x28');return db['UserProfileSection'][_0x0529('0x4b')]({'where':{'name':_0x413365,'userProfileId':_0x155666[_0x0529('0x51')]},'raw':!![]})['then'](function(_0x1a1243){if(_0x1a1243&&_0x1a1243[_0x0529('0x52')]===0x0){return db['UserProfileResource'][_0x0529('0x4c')]({'name':_0xfbc418[_0x0529('0x2d')],'resourceId':_0xfbc418['id'],'type':_0x1a1243[_0x0529('0x2d')],'sectionId':_0x1a1243['id']},{})[_0x0529('0x25')](function(){return _0x10d198;});}else{return _0x10d198;}})[_0x0529('0x45')](function(_0x42c5ea){logger[_0x0529('0x2b')](_0x0529('0x53'),_0x42c5ea);throw _0x42c5ea;});}return _0x10d198;})[_0x0529('0x25')](respondWithResult(_0x3dc48d,0xc9))[_0x0529('0x45')](handleError(_0x3dc48d,null));};exports[_0x0529('0x54')]=function(_0x3b7c1b,_0x144c85){var _0x256e51={'where':{'id':_0x3b7c1b['params']['id']}},_0x262055={};_0x262055[_0x0529('0x39')]=_[_0x0529('0x35')](db[_0x0529('0x31')][_0x0529('0x32')]);_0x256e51[_0x0529('0x38')]=_[_0x0529('0x37')](_0x262055[_0x0529('0x39')],qs[_0x0529('0x3a')](_0x3b7c1b['query'][_0x0529('0x3a')]));_0x256e51[_0x0529('0x38')]=_0x256e51[_0x0529('0x38')]['length']?_0x256e51[_0x0529('0x38')]:_0x262055[_0x0529('0x39')];if(_0x3b7c1b[_0x0529('0x34')][_0x0529('0x48')]){_0x256e51[_0x0529('0x49')]=[{'all':!![]}];}_0x256e51=_[_0x0529('0x4a')]({},_0x256e51,_0x3b7c1b[_0x0529('0x43')]);return db[_0x0529('0x31')][_0x0529('0x4b')](_0x256e51)['then'](handleEntityNotFound(_0x144c85,null))[_0x0529('0x25')](function(_0xfde47f){if(_0xfde47f){var _0x103b05=_0xfde47f[_0x0529('0x27')]({'plain':!![]});_0x103b05=qs['omit'](_0x103b05,['id',_0x0529('0x55'),_0x0529('0x56')]);_0x3b7c1b[_0x0529('0x4d')]=_[_0x0529('0x57')](_0x3b7c1b[_0x0529('0x4d')],['id',_0x0529('0x55'),_0x0529('0x56')]);return db[_0x0529('0x31')][_0x0529('0x4c')](_[_0x0529('0x4a')](_0x103b05,_0x3b7c1b[_0x0529('0x4d')]),{'include':_0x3b7c1b['query'][_0x0529('0x48')]?[{'all':!![]}]:undefined})[_0x0529('0x25')](function(_0x46fab3){var _0x2ce33d=_0x3b7c1b[_0x0529('0x4e')][_0x0529('0x27')]({'plain':!![]});if(!_0x2ce33d)throw new Error(_0x0529('0x4f'));if(_0x2ce33d[_0x0529('0x50')]==='user'){var _0x230ade=_0x46fab3[_0x0529('0x27')]({'plain':!![]});var _0x860d6d='CustomDashboards';return db['UserProfileSection'][_0x0529('0x4b')]({'where':{'name':_0x860d6d,'userProfileId':_0x2ce33d['userProfileId']},'raw':!![]})['then'](function(_0x71bcc9){if(_0x71bcc9&&_0x71bcc9[_0x0529('0x52')]===0x0){return db[_0x0529('0x29')][_0x0529('0x4c')]({'name':_0x230ade[_0x0529('0x2d')],'resourceId':_0x230ade['id'],'type':_0x71bcc9['name'],'sectionId':_0x71bcc9['id']},{})[_0x0529('0x25')](function(){return _0x46fab3;});}else{return _0x46fab3;}})[_0x0529('0x45')](function(_0xec891a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xec891a);throw _0xec891a;});}return _0x46fab3;});}})[_0x0529('0x25')](respondWithResult(_0x144c85,0xc9))[_0x0529('0x45')](handleError(_0x144c85,null));};exports[_0x0529('0x58')]=function(_0x26a9cc,_0x5bd7f5){if(_0x26a9cc[_0x0529('0x4d')]['id']){delete _0x26a9cc[_0x0529('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x26a9cc[_0x0529('0x47')]['id']}})[_0x0529('0x25')](handleEntityNotFound(_0x5bd7f5,null))['then'](saveUpdates(_0x26a9cc[_0x0529('0x4d')],null))[_0x0529('0x25')](respondWithResult(_0x5bd7f5,null))[_0x0529('0x45')](handleError(_0x5bd7f5,null));};exports[_0x0529('0x26')]=function(_0x33bbc8,_0x393821){return db[_0x0529('0x31')][_0x0529('0x4b')]({'where':{'id':_0x33bbc8['params']['id']}})[_0x0529('0x25')](handleEntityNotFound(_0x393821,null))[_0x0529('0x25')](removeEntity(_0x393821,null))[_0x0529('0x45')](handleError(_0x393821,null));};function widgetAttributes(_0x5de93a){try{switch(_0x5de93a[_0x0529('0x59')]){case _0x0529('0x5a'):return[{'name':_0x0529('0x5b'),'value':_0x5de93a[_0x0529('0x5b')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0][_0x0529('0x5d')]:undefined)||'https://'}];case'custom':return[{'name':_0x0529('0x5e'),'value':_0x5de93a[_0x0529('0x5e')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0][_0x0529('0x5d')]:undefined)||''}];case _0x0529('0x5f'):return[{'name':'attrHourFormat','value':_0x5de93a[_0x0529('0x60')]||(_0x5de93a['attrs']&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0]['value']:undefined)||_0x0529('0x61')},{'name':_0x0529('0x62'),'value':_0x5de93a[_0x0529('0x62')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x1]?_0x5de93a[_0x0529('0x5c')][0x1][_0x0529('0x5d')]:undefined)||_0x0529('0x63')},{'name':_0x0529('0x64'),'value':_0x5de93a[_0x0529('0x64')]||(_0x5de93a['attrs']&&_0x5de93a[_0x0529('0x5c')][0x2]?_0x5de93a['attrs'][0x2][_0x0529('0x5d')]:undefined)||0xc}];case'counter':return[{'name':_0x0529('0x65'),'value':_0x5de93a['attrMetric']||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0]['value']:undefined)||_0x0529('0x66')},{'name':_0x0529('0x67'),'value':_0x5de93a[_0x0529('0x67')]||(_0x5de93a['attrs']&&_0x5de93a[_0x0529('0x5c')][0x1]?_0x5de93a['attrs'][0x1][_0x0529('0x5d')]:undefined)||[]},{'name':_0x0529('0x64'),'value':_0x5de93a[_0x0529('0x64')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x2]?_0x5de93a['attrs'][0x2][_0x0529('0x5d')]:undefined)||0x14},{'name':_0x0529('0x68'),'value':_0x5de93a['attrChannel']||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x3]?_0x5de93a[_0x0529('0x5c')][0x3][_0x0529('0x5d')]:undefined)||_0x0529('0x69')},{'name':_0x0529('0x6a'),'value':_0x5de93a[_0x0529('0x6a')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x4]?_0x5de93a[_0x0529('0x5c')][0x4]['value']:undefined)||''},{'name':_0x0529('0x6b'),'value':_0x5de93a[_0x0529('0x6b')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x5]?_0x5de93a[_0x0529('0x5c')][0x5][_0x0529('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5de93a[_0x0529('0x6c')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x6]?_0x5de93a[_0x0529('0x5c')][0x6][_0x0529('0x5d')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5de93a[_0x0529('0x6d')]||(_0x5de93a['attrs']&&_0x5de93a[_0x0529('0x5c')][0x7]?_0x5de93a[_0x0529('0x5c')][0x7][_0x0529('0x5d')]:undefined)||''},{'name':_0x0529('0x6e'),'value':_0x5de93a[_0x0529('0x6e')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x8]?_0x5de93a['attrs'][0x8][_0x0529('0x5d')]:undefined)||''},{'name':_0x0529('0x6f'),'value':_0x5de93a['attrChatWebsites']||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x9]?_0x5de93a[_0x0529('0x5c')][0x9]['value']:undefined)||''}];case _0x0529('0x70'):case'pie-chart':return[{'name':_0x0529('0x71'),'value':_0x5de93a[_0x0529('0x71')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0][_0x0529('0x5d')]:undefined)||'total'},{'name':_0x0529('0x72'),'value':_0x5de93a[_0x0529('0x72')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a['attrs'][0x1]?_0x5de93a['attrs'][0x1][_0x0529('0x5d')]:undefined)||null},{'name':_0x0529('0x73'),'value':_0x5de93a[_0x0529('0x73')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x2]?_0x5de93a[_0x0529('0x5c')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5de93a[_0x0529('0x67')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x3]?_0x5de93a['attrs'][0x3][_0x0529('0x5d')]:undefined)||[]},{'name':'attrChannel','value':_0x5de93a[_0x0529('0x68')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x4]?_0x5de93a[_0x0529('0x5c')][0x4][_0x0529('0x5d')]:undefined)||_0x0529('0x69')},{'name':_0x0529('0x6a'),'value':_0x5de93a[_0x0529('0x6a')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x5]?_0x5de93a[_0x0529('0x5c')][0x5][_0x0529('0x5d')]:undefined)||''},{'name':_0x0529('0x6b'),'value':_0x5de93a[_0x0529('0x6b')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x6]?_0x5de93a[_0x0529('0x5c')][0x6][_0x0529('0x5d')]:undefined)||''},{'name':_0x0529('0x6c'),'value':_0x5de93a[_0x0529('0x6c')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x7]?_0x5de93a[_0x0529('0x5c')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5de93a[_0x0529('0x6d')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x8]?_0x5de93a[_0x0529('0x5c')][0x8][_0x0529('0x5d')]:undefined)||''},{'name':_0x0529('0x6e'),'value':_0x5de93a[_0x0529('0x6e')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x9]?_0x5de93a['attrs'][0x9][_0x0529('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5de93a[_0x0529('0x6f')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0xa]?_0x5de93a[_0x0529('0x5c')][0xa][_0x0529('0x5d')]:undefined)||''}];case _0x0529('0x74'):return[{'name':_0x0529('0x75'),'type':_0x5de93a[_0x0529('0x76')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a['attrs'][0x0]['type']:undefined)||null,'value':_0x5de93a[_0x0529('0x75')]||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x0]?_0x5de93a[_0x0529('0x5c')][0x0][_0x0529('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0x5de93a['attrRefresh']||(_0x5de93a[_0x0529('0x5c')]&&_0x5de93a[_0x0529('0x5c')][0x1]?_0x5de93a[_0x0529('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1237b2){logger['error'](_0x0529('0x77'),JSON[_0x0529('0x78')](_0x1237b2));return[];}}exports['addItem']=function(_0x2c8a58,_0x10f20c,_0x216908){if(_0x2c8a58[_0x0529('0x4d')]['id']){delete _0x2c8a58[_0x0529('0x4d')]['id'];}return db[_0x0529('0x31')][_0x0529('0x4b')]({'where':{'id':_0x2c8a58[_0x0529('0x47')]['id']}})[_0x0529('0x25')](handleEntityNotFound(_0x10f20c,null))[_0x0529('0x25')](function(_0x627281){if(_0x627281){_0x2c8a58[_0x0529('0x4d')][_0x0529('0x79')]=_0x627281['id'];_0x2c8a58[_0x0529('0x4d')][_0x0529('0x5c')]=widgetAttributes(_0x2c8a58['body']);return db[_0x0529('0x7a')][_0x0529('0x4c')](_0x2c8a58[_0x0529('0x4d')]);}})['then'](respondWithResult(_0x10f20c,null))['catch'](handleError(_0x10f20c,null));};exports[_0x0529('0x7b')]=function(_0x4654bb,_0x3cfad3,_0x35a1a9){var _0x27eee0={};var _0x20d6c2={};var _0x4213d7;var _0x206f37;return db[_0x0529('0x31')][_0x0529('0x7c')]({'where':{'id':_0x4654bb[_0x0529('0x47')]['id']}})[_0x0529('0x25')](handleEntityNotFound(_0x3cfad3,null))[_0x0529('0x25')](function(_0x4fbfaa){if(_0x4fbfaa){_0x4213d7=_0x4fbfaa;_0x20d6c2[_0x0529('0x39')]=_[_0x0529('0x35')](db[_0x0529('0x7a')][_0x0529('0x32')]);_0x20d6c2['query']=_['keys'](_0x4654bb[_0x0529('0x34')]);_0x20d6c2['filters']=_[_0x0529('0x37')](_0x20d6c2[_0x0529('0x39')],_0x20d6c2['query']);_0x27eee0[_0x0529('0x38')]=_[_0x0529('0x37')](_0x20d6c2[_0x0529('0x39')],qs[_0x0529('0x3a')](_0x4654bb['query'][_0x0529('0x3a')]));_0x27eee0['attributes']=_0x27eee0[_0x0529('0x38')][_0x0529('0x3b')]?_0x27eee0[_0x0529('0x38')]:_0x20d6c2[_0x0529('0x39')];_0x27eee0[_0x0529('0x3e')]=qs['sort'](_0x4654bb[_0x0529('0x34')][_0x0529('0x7d')]);_0x27eee0['where']=qs['filters'](_[_0x0529('0x3f')](_0x4654bb['query'],_0x20d6c2['filters']));if(_0x4654bb['query'][_0x0529('0x40')]){_0x27eee0[_0x0529('0x41')]=_[_0x0529('0x4a')](_0x27eee0[_0x0529('0x41')],{'$or':_[_0x0529('0x30')](_0x27eee0[_0x0529('0x38')],function(_0x541398){var _0x1da890={};_0x1da890[_0x541398]={'$like':'%'+_0x4654bb['query'][_0x0529('0x40')]+'%'};return _0x1da890;})});}_0x27eee0=_['merge']({},_0x27eee0,_0x4654bb[_0x0529('0x43')]);return _0x4213d7['getItems'](_0x27eee0);}})[_0x0529('0x25')](function(_0x4a9185){if(_0x4a9185){_0x206f37=_0x4a9185[_0x0529('0x3b')];if(!_0x4654bb[_0x0529('0x34')][_0x0529('0x3c')](_0x0529('0x3d'))){_0x27eee0[_0x0529('0x1f')]=qs[_0x0529('0x1f')](_0x4654bb[_0x0529('0x34')][_0x0529('0x1f')]);_0x27eee0[_0x0529('0x22')]=qs[_0x0529('0x22')](_0x4654bb[_0x0529('0x34')][_0x0529('0x22')]);}return _0x4213d7[_0x0529('0x7b')](_0x27eee0);}})[_0x0529('0x25')](function(_0x3509b9){if(_0x3509b9){return _0x3509b9?{'count':_0x206f37,'rows':_0x3509b9}:null;}})['then'](respondWithResult(_0x3cfad3,null))[_0x0529('0x45')](handleError(_0x3cfad3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index bb3c591..f6a2536 100644 --- a/server/api/dashboard/dashboard.events.js +++ b/server/api/dashboard/dashboard.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7715=['exports','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4fcb1a,_0x8277db){var _0x39d94d=function(_0x45a744){while(--_0x45a744){_0x4fcb1a['push'](_0x4fcb1a['shift']());}};_0x39d94d(++_0x8277db);}(_0x7715,0xbf));var _0x5771=function(_0x6bbc50,_0x26b8e9){_0x6bbc50=_0x6bbc50-0x0;var _0x5e8e93=_0x7715[_0x6bbc50];return _0x5e8e93;};'use strict';var EventEmitter=require(_0x5771('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x5771('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5771('0x2')](0x0);var events={'afterCreate':_0x5771('0x3'),'afterUpdate':_0x5771('0x4'),'afterDestroy':_0x5771('0x5')};function emitEvent(_0x5dd49a){return function(_0x8242be,_0x39ea41,_0x1e4aff){DashboardEvents[_0x5771('0x6')](_0x5dd49a+':'+_0x8242be['id'],_0x8242be);DashboardEvents[_0x5771('0x6')](_0x5dd49a,_0x8242be);_0x1e4aff(null);};}for(var e in events){if(events[_0x5771('0x7')](e)){var event=events[e];Dashboard[_0x5771('0x8')](e,emitEvent(event));}}module[_0x5771('0x9')]=DashboardEvents; \ No newline at end of file +var _0x6cb7=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x27eab9,_0x49226f){var _0x1a4a17=function(_0x297e66){while(--_0x297e66){_0x27eab9['push'](_0x27eab9['shift']());}};_0x1a4a17(++_0x49226f);}(_0x6cb7,0xa3));var _0x76cb=function(_0x7538f1,_0x3e306d){_0x7538f1=_0x7538f1-0x0;var _0x5e3255=_0x6cb7[_0x7538f1];return _0x5e3255;};'use strict';var EventEmitter=require(_0x76cb('0x0'));var Dashboard=require(_0x76cb('0x1'))['db'][_0x76cb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x76cb('0x3')](0x0);var events={'afterCreate':_0x76cb('0x4'),'afterUpdate':'update','afterDestroy':_0x76cb('0x5')};function emitEvent(_0x525049){return function(_0x4de1e7,_0x3bf2f3,_0x294d66){DashboardEvents[_0x76cb('0x6')](_0x525049+':'+_0x4de1e7['id'],_0x4de1e7);DashboardEvents['emit'](_0x525049,_0x4de1e7);_0x294d66(null);};}for(var e in events){if(events[_0x76cb('0x7')](e)){var event=events[e];Dashboard[_0x76cb('0x8')](e,emitEvent(event));}}module[_0x76cb('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7268e38..9045b86 100644 --- a/server/api/dashboard/dashboard.model.js +++ b/server/api/dashboard/dashboard.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e2=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x70e2,0x7f));var _0x270e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x70e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var logger=require(_0x270e('0x2'))(_0x270e('0x3'));var moment=require(_0x270e('0x4'));var BPromise=require(_0x270e('0x5'));var rp=require(_0x270e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var attributes=require(_0x270e('0x9'));module[_0x270e('0xa')]=function(_0x58fd5d,_0x2cfe8e){return _0x58fd5d[_0x270e('0xb')](_0x270e('0xc'),attributes,{'tableName':_0x270e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dd8=['bluebird','request-promise','./dashboard.attributes','exports','define','Dashboard','lodash','util','api','moment'];(function(_0x1602fc,_0x316443){var _0x4b5b41=function(_0x82755a){while(--_0x82755a){_0x1602fc['push'](_0x1602fc['shift']());}};_0x4b5b41(++_0x316443);}(_0x1dd8,0x13c));var _0x81dd=function(_0x23a299,_0x30e49c){_0x23a299=_0x23a299-0x0;var _0x560bb3=_0x1dd8[_0x23a299];return _0x560bb3;};'use strict';var _=require(_0x81dd('0x0'));var util=require(_0x81dd('0x1'));var logger=require('../../config/logger')(_0x81dd('0x2'));var moment=require(_0x81dd('0x3'));var BPromise=require(_0x81dd('0x4'));var rp=require(_0x81dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x81dd('0x6'));module[_0x81dd('0x7')]=function(_0x2c2387,_0x44aa0f){return _0x2c2387[_0x81dd('0x8')](_0x81dd('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 8ced157..d8eba5b 100644 --- a/server/api/dashboard/dashboard.rpc.js +++ b/server/api/dashboard/dashboard.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2302=['moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2302,0x11d));var _0x2230=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x2302[_0xbeb808];return _0x5d6909;};'use strict';var _=require('lodash');var util=require(_0x2230('0x0'));var moment=require(_0x2230('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2230('0x2'));var logger=require(_0x2230('0x3'))('rpc');var config=require(_0x2230('0x4'));var jayson=require(_0x2230('0x5'));var client=jayson['client'][_0x2230('0x6')]({'port':0x232a});config[_0x2230('0x7')]=_['defaults'](config[_0x2230('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x2230('0x8'))(new Redis(config[_0x2230('0x7')]));require(_0x2230('0x9'))['register'](socket);function respondWithRpcPromise(_0x13d5fc,_0x1e2e28,_0xbc6e91){return new BPromise(function(_0x289420,_0xb14c4b){return client[_0x2230('0xa')](_0x13d5fc,_0xbc6e91)[_0x2230('0xb')](function(_0x431b8e){logger[_0x2230('0xc')](_0x2230('0xd'),_0x1e2e28,'request\x20sent');logger[_0x2230('0xe')](_0x2230('0xf'),_0x1e2e28,'request\x20sent',JSON[_0x2230('0x10')](_0x431b8e));if(_0x431b8e[_0x2230('0x11')]){if(_0x431b8e[_0x2230('0x11')][_0x2230('0x12')]===0x1f4){logger[_0x2230('0x11')](_0x2230('0xd'),_0x1e2e28,_0x431b8e['error'][_0x2230('0x13')]);return _0xb14c4b(_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);}logger[_0x2230('0x11')]('Dashboard,\x20%s,\x20%s',_0x1e2e28,_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);return _0x289420(_0x431b8e[_0x2230('0x11')][_0x2230('0x13')]);}else{logger['info'](_0x2230('0xd'),_0x1e2e28,'request\x20sent');_0x289420(_0x431b8e[_0x2230('0x14')][_0x2230('0x13')]);}})[_0x2230('0x15')](function(_0x41a08e){logger[_0x2230('0x11')](_0x2230('0xd'),_0x1e2e28,_0x41a08e);_0xb14c4b(_0x41a08e);});});} \ No newline at end of file +var _0x58de=['client','http','redis','localhost','socket.io-emitter','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4aedbe,_0x51a918){var _0x246a51=function(_0x57e160){while(--_0x57e160){_0x4aedbe['push'](_0x4aedbe['shift']());}};_0x246a51(++_0x51a918);}(_0x58de,0x177));var _0xe58d=function(_0x3a97cd,_0x5b0109){_0x3a97cd=_0x3a97cd-0x0;var _0x84cbcd=_0x58de[_0x3a97cd];return _0x84cbcd;};'use strict';var _=require(_0xe58d('0x0'));var util=require('util');var moment=require(_0xe58d('0x1'));var BPromise=require(_0xe58d('0x2'));var rs=require(_0xe58d('0x3'));var fs=require('fs');var Redis=require(_0xe58d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe58d('0x5'))(_0xe58d('0x6'));var config=require(_0xe58d('0x7'));var jayson=require(_0xe58d('0x8'));var client=jayson[_0xe58d('0x9')][_0xe58d('0xa')]({'port':0x232a});config[_0xe58d('0xb')]=_['defaults'](config[_0xe58d('0xb')],{'host':_0xe58d('0xc'),'port':0x18eb});var socket=require(_0xe58d('0xd'))(new Redis(config[_0xe58d('0xb')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x58ff2f,_0x5497eb,_0xfde95a){return new BPromise(function(_0x424ba7,_0x33df79){return client['request'](_0x58ff2f,_0xfde95a)[_0xe58d('0xe')](function(_0x5b4b43){logger[_0xe58d('0xf')](_0xe58d('0x10'),_0x5497eb,_0xe58d('0x11'));logger[_0xe58d('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x5497eb,'request\x20sent',JSON[_0xe58d('0x13')](_0x5b4b43));if(_0x5b4b43[_0xe58d('0x14')]){if(_0x5b4b43['error'][_0xe58d('0x15')]===0x1f4){logger[_0xe58d('0x14')](_0xe58d('0x10'),_0x5497eb,_0x5b4b43[_0xe58d('0x14')][_0xe58d('0x16')]);return _0x33df79(_0x5b4b43[_0xe58d('0x14')][_0xe58d('0x16')]);}logger['error'](_0xe58d('0x10'),_0x5497eb,_0x5b4b43[_0xe58d('0x14')]['message']);return _0x424ba7(_0x5b4b43['error'][_0xe58d('0x16')]);}else{logger['info'](_0xe58d('0x10'),_0x5497eb,_0xe58d('0x11'));_0x424ba7(_0x5b4b43[_0xe58d('0x17')][_0xe58d('0x16')]);}})['catch'](function(_0x1a3538){logger[_0xe58d('0x14')]('Dashboard,\x20%s,\x20%s',_0x5497eb,_0x1a3538);_0x33df79(_0x1a3538);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e535cb6..eacd416 100644 --- a/server/api/dashboard/dashboard.socket.js +++ b/server/api/dashboard/dashboard.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb636=['remove','update','emit','register','length','dashboard:','./dashboard.events','save'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb636,0xe6));var _0x6b63=function(_0x424c12,_0x365dab){_0x424c12=_0x424c12-0x0;var _0x493f4e=_0xb636[_0x424c12];return _0x493f4e;};'use strict';var DashboardEvents=require(_0x6b63('0x0'));var events=[_0x6b63('0x1'),_0x6b63('0x2'),_0x6b63('0x3')];function createListener(_0x2a1863,_0x29dbc7){return function(_0x414020){_0x29dbc7[_0x6b63('0x4')](_0x2a1863,_0x414020);};}function removeListener(_0x259046,_0x5339d3){return function(){DashboardEvents['removeListener'](_0x259046,_0x5339d3);};}exports[_0x6b63('0x5')]=function(_0x377bf7){for(var _0x158bbd=0x0,_0x1aa1fa=events[_0x6b63('0x6')];_0x158bbd<_0x1aa1fa;_0x158bbd++){var _0x29bdd7=events[_0x158bbd];var _0x1abb3d=createListener(_0x6b63('0x7')+_0x29bdd7,_0x377bf7);DashboardEvents['on'](_0x29bdd7,_0x1abb3d);}}; \ No newline at end of file +var _0x66c8=['dashboard:','./dashboard.events','save','remove','emit','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66c8,0x1dd));var _0x866c=function(_0x16fef5,_0x44cdbb){_0x16fef5=_0x16fef5-0x0;var _0x1b39bb=_0x66c8[_0x16fef5];return _0x1b39bb;};'use strict';var DashboardEvents=require(_0x866c('0x0'));var events=[_0x866c('0x1'),_0x866c('0x2'),'update'];function createListener(_0x52e207,_0xb4b27e){return function(_0x375006){_0xb4b27e[_0x866c('0x3')](_0x52e207,_0x375006);};}function removeListener(_0x211434,_0x22c235){return function(){DashboardEvents[_0x866c('0x4')](_0x211434,_0x22c235);};}exports['register']=function(_0x5de3ac){for(var _0x4f6851=0x0,_0x3299f3=events[_0x866c('0x5')];_0x4f6851<_0x3299f3;_0x4f6851++){var _0x433d2c=events[_0x4f6851];var _0x49c3da=createListener(_0x866c('0x6')+_0x433d2c,_0x5de3ac);DashboardEvents['on'](_0x433d2c,_0x49c3da);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d1972a4..da5aa2a 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a3a=['connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','create','post','clone','addItem','put','update','delete','destroy','multer','util','path'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5a3a,0x131));var _0xa5a3=function(_0x22ce8e,_0x196b6a){_0x22ce8e=_0x22ce8e-0x0;var _0x53d736=_0x5a3a[_0x22ce8e];return _0x53d736;};'use strict';var multer=require(_0xa5a3('0x0'));var util=require(_0xa5a3('0x1'));var path=require(_0xa5a3('0x2'));var timeout=require(_0xa5a3('0x3'));var express=require(_0xa5a3('0x4'));var router=express[_0xa5a3('0x5')]();var fs_extra=require(_0xa5a3('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa5a3('0x7'));var controller=require(_0xa5a3('0x8'));router[_0xa5a3('0x9')]('/',auth[_0xa5a3('0xa')](),controller['index']);router[_0xa5a3('0x9')](_0xa5a3('0xb'),auth[_0xa5a3('0xa')](),controller[_0xa5a3('0xc')]);router[_0xa5a3('0x9')](_0xa5a3('0xd'),auth[_0xa5a3('0xa')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0xa5a3('0xe')]);router[_0xa5a3('0xf')]('/:id/clone',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x10')]);router['post'](_0xa5a3('0xd'),auth['isAuthenticated'](),controller[_0xa5a3('0x11')]);router[_0xa5a3('0x12')]('/:id',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x13')]);router[_0xa5a3('0x14')]('/:id',auth[_0xa5a3('0xa')](),controller[_0xa5a3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb1bc=['../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','clone','addItem','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x34ebf4,_0xf1f347){var _0x2da04d=function(_0x58744a){while(--_0x58744a){_0x34ebf4['push'](_0x34ebf4['shift']());}};_0x2da04d(++_0xf1f347);}(_0xb1bc,0x19e));var _0xcb1b=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0xb1bc[_0x47e93d];return _0xe86c46;};'use strict';var multer=require('multer');var util=require(_0xcb1b('0x0'));var path=require(_0xcb1b('0x1'));var timeout=require(_0xcb1b('0x2'));var express=require(_0xcb1b('0x3'));var router=express[_0xcb1b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb1b('0x5'));var interaction=require(_0xcb1b('0x6'));var config=require('../../config/environment');var controller=require(_0xcb1b('0x7'));router[_0xcb1b('0x8')]('/',auth[_0xcb1b('0x9')](),controller[_0xcb1b('0xa')]);router['get'](_0xcb1b('0xb'),auth[_0xcb1b('0x9')](),controller['show']);router[_0xcb1b('0x8')](_0xcb1b('0xc'),auth[_0xcb1b('0x9')](),controller[_0xcb1b('0xd')]);router[_0xcb1b('0xe')]('/',auth[_0xcb1b('0x9')](),controller[_0xcb1b('0xf')]);router[_0xcb1b('0xe')]('/:id/clone',auth['isAuthenticated'](),controller[_0xcb1b('0x10')]);router[_0xcb1b('0xe')]('/:id/items',auth[_0xcb1b('0x9')](),controller[_0xcb1b('0x11')]);router[_0xcb1b('0x12')](_0xcb1b('0xb'),auth[_0xcb1b('0x9')](),controller[_0xcb1b('0x13')]);router['delete'](_0xcb1b('0xb'),auth[_0xcb1b('0x9')](),controller[_0xcb1b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 2aeaaf4..bdb49ac 100644 --- a/server/api/dashboardItem/dashboardItem.attributes.js +++ b/server/api/dashboardItem/dashboardItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));var squel=require(_0x901d('0x1'));var _=require(_0x901d('0x2'));module[_0x901d('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x901d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x901d('0x5')](_0x901d('0x6')),'get':function(){try{return JSON[_0x901d('0x7')](this[_0x901d('0x8')](_0x901d('0x9')));}catch(_0xb96b86){return[];}},'set':function(_0x4e7842){try{this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')](_0x4e7842));}catch(_0x12c39f){this[_0x901d('0xa')](_0x901d('0x9'),JSON[_0x901d('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x901d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x901d('0xc')]},'col':{'type':Sequelize[_0x901d('0xc')]},'background':{'type':Sequelize[_0x901d('0x4')],'allowNull':![],'defaultValue':_0x901d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x901d('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x901d('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x21f4ec,_0x10230a){var _0x8b6a3f=function(_0x12123e){while(--_0x12123e){_0x21f4ec['push'](_0x21f4ec['shift']());}};_0x8b6a3f(++_0x10230a);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5a519d,_0x3981b1){_0x5a519d=_0x5a519d-0x0;var _0x5e39b4=_0xd8fb[_0x5a519d];return _0x5e39b4;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index be097d9..91579f6 100644 --- a/server/api/dashboardItem/dashboardItem.controller.js +++ b/server/api/dashboardItem/dashboardItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1c6=['send','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','then','catch','type','iframe','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','redis','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name'];(function(_0x5ce53f,_0x8bf1ed){var _0x43bd0d=function(_0x2a5805){while(--_0x2a5805){_0x5ce53f['push'](_0x5ce53f['shift']());}};_0x43bd0d(++_0x8bf1ed);}(_0xf1c6,0x145));var _0x6f1c=function(_0xea926b,_0x17abeb){_0xea926b=_0xea926b-0x0;var _0x58d701=_0xf1c6[_0xea926b];return _0x58d701;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f1c('0x0'));var jsonpatch=require(_0x6f1c('0x1'));var rp=require(_0x6f1c('0x2'));var moment=require(_0x6f1c('0x3'));var BPromise=require(_0x6f1c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f1c('0x5'));var sox=require('sox');var csv=require(_0x6f1c('0x6'));var ejs=require(_0x6f1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6f1c('0x8'));var _=require('lodash');var squel=require(_0x6f1c('0x9'));var crypto=require('crypto');var jsforce=require(_0x6f1c('0xa'));var deskjs=require(_0x6f1c('0xb'));var toCsv=require(_0x6f1c('0x6'));var querystring=require('querystring');var Papa=require(_0x6f1c('0xc'));var Redis=require('ioredis');var authService=require(_0x6f1c('0xd'));var qs=require(_0x6f1c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f1c('0xf'));var logger=require(_0x6f1c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x11'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f1c('0x12')]));require(_0x6f1c('0x13'))[_0x6f1c('0x14')](socket);function respondWithStatusCode(_0x5549d1,_0x82203a){_0x82203a=_0x82203a||0xcc;return function(_0x238c62){if(_0x238c62){return _0x5549d1[_0x6f1c('0x15')](_0x82203a);}return _0x5549d1['status'](_0x82203a)[_0x6f1c('0x16')]();};}function respondWithResult(_0x210abb,_0x5515fa){_0x5515fa=_0x5515fa||0xc8;return function(_0x28fc5f){if(_0x28fc5f){return _0x210abb[_0x6f1c('0x17')](_0x5515fa)[_0x6f1c('0x18')](_0x28fc5f);}};}function respondWithFilteredResult(_0x6e2d39,_0x3c3e21){return function(_0x16d2bb){if(_0x16d2bb){var _0x491151=typeof _0x3c3e21[_0x6f1c('0x19')]===_0x6f1c('0x1a')&&typeof _0x3c3e21[_0x6f1c('0x1b')]===_0x6f1c('0x1a');var _0x20c2bb=_0x16d2bb[_0x6f1c('0x1c')];var _0x4dbb3f=_0x491151?0x0:_0x3c3e21['offset'];var _0x58c2d8=_0x491151?_0x16d2bb[_0x6f1c('0x1c')]:_0x3c3e21['offset']+_0x3c3e21[_0x6f1c('0x1b')];var _0x4f6637;if(_0x58c2d8>=_0x20c2bb){_0x58c2d8=_0x20c2bb;_0x4f6637=0xc8;}else{_0x4f6637=0xce;}_0x6e2d39[_0x6f1c('0x17')](_0x4f6637);return _0x6e2d39[_0x6f1c('0x1d')](_0x6f1c('0x1e'),_0x4dbb3f+'-'+_0x58c2d8+'/'+_0x20c2bb)[_0x6f1c('0x18')](_0x16d2bb);}return null;};}function patchUpdates(_0x2ed8f1){return function(_0x3a082c){try{jsonpatch[_0x6f1c('0x1f')](_0x3a082c,_0x2ed8f1,!![]);}catch(_0x35934b){return BPromise[_0x6f1c('0x20')](_0x35934b);}return _0x3a082c[_0x6f1c('0x21')]();};}function saveUpdates(_0x130bae,_0x2da230){return function(_0x388416){if(_0x388416){return _0x388416[_0x6f1c('0x22')](_0x130bae)['then'](function(_0x2a3b6a){return _0x2a3b6a;});}return null;};}function removeEntity(_0x2b29af,_0x4a8fc1){return function(_0x3c0dd1){if(_0x3c0dd1){return _0x3c0dd1[_0x6f1c('0x23')]()['then'](function(){_0x2b29af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x500e36,_0x16fe5a){return function(_0x1ac9f5){if(!_0x1ac9f5){_0x500e36[_0x6f1c('0x15')](0x194);}return _0x1ac9f5;};}function handleError(_0x30267d,_0x29b952){_0x29b952=_0x29b952||0x1f4;return function(_0x66cb25){logger[_0x6f1c('0x24')](_0x66cb25[_0x6f1c('0x25')]);if(_0x66cb25[_0x6f1c('0x26')]){delete _0x66cb25[_0x6f1c('0x26')];}_0x30267d[_0x6f1c('0x17')](_0x29b952)[_0x6f1c('0x27')](_0x66cb25);};}exports['show']=function(_0x528e40,_0x1f783a){var _0x4084af={'raw':![],'where':{'id':_0x528e40[_0x6f1c('0x28')]['id']}},_0x383802={};_0x383802[_0x6f1c('0x29')]=_['keys'](db[_0x6f1c('0x2a')]['rawAttributes']);_0x383802[_0x6f1c('0x2b')]=_['keys'](_0x528e40[_0x6f1c('0x2b')]);_0x383802[_0x6f1c('0x2c')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],_0x383802[_0x6f1c('0x2b')]);_0x4084af[_0x6f1c('0x2e')]=_[_0x6f1c('0x2d')](_0x383802[_0x6f1c('0x29')],qs[_0x6f1c('0x2f')](_0x528e40[_0x6f1c('0x2b')]['fields']));_0x4084af[_0x6f1c('0x2e')]=_0x4084af[_0x6f1c('0x2e')][_0x6f1c('0x30')]?_0x4084af[_0x6f1c('0x2e')]:_0x383802[_0x6f1c('0x29')];if(_0x528e40[_0x6f1c('0x2b')][_0x6f1c('0x31')]){_0x4084af[_0x6f1c('0x32')]=[{'all':!![]}];}_0x4084af=_[_0x6f1c('0x33')]({},_0x4084af,_0x528e40['options']);return db['DashboardItem'][_0x6f1c('0x34')](_0x4084af)[_0x6f1c('0x35')](handleEntityNotFound(_0x1f783a,null))[_0x6f1c('0x35')](respondWithResult(_0x1f783a,null))[_0x6f1c('0x36')](handleError(_0x1f783a,null));};exports[_0x6f1c('0x23')]=function(_0x84fa1c,_0x19d62b){return db[_0x6f1c('0x2a')][_0x6f1c('0x34')]({'where':{'id':_0x84fa1c[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x19d62b,null))[_0x6f1c('0x35')](removeEntity(_0x19d62b,null))[_0x6f1c('0x36')](handleError(_0x19d62b,null));};function widgetAttributes(_0x38d241){try{switch(_0x38d241[_0x6f1c('0x37')]){case _0x6f1c('0x38'):return[{'name':'attrUrl','value':_0x38d241['attrUrl']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x3b')}];case _0x6f1c('0x3c'):return[{'name':_0x6f1c('0x3d'),'value':_0x38d241[_0x6f1c('0x3d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x3e'):return[{'name':_0x6f1c('0x3f'),'value':_0x38d241['attrHourFormat']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x40')},{'name':_0x6f1c('0x41'),'value':_0x38d241[_0x6f1c('0x41')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x42')},{'name':_0x6f1c('0x43'),'value':_0x38d241[_0x6f1c('0x43')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||0xc}];case _0x6f1c('0x44'):return[{'name':_0x6f1c('0x45'),'value':_0x38d241[_0x6f1c('0x45')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x43'),'value':_0x38d241['attrFontSize']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241['attrs'][0x2][_0x6f1c('0x3a')]:undefined)||0x14},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241['attrs'][0x4][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4a'),'value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241[_0x6f1c('0x39')][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241[_0x6f1c('0x4b')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x8]?_0x38d241['attrs'][0x8]['value']:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x9]?_0x38d241[_0x6f1c('0x39')][0x9]['value']:undefined)||''}];case _0x6f1c('0x4f'):case _0x6f1c('0x50'):return[{'name':_0x6f1c('0x51'),'value':_0x38d241['attrSerie1']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241['attrs'][0x0][_0x6f1c('0x3a')]:undefined)||'total'},{'name':_0x6f1c('0x52'),'value':_0x38d241[_0x6f1c('0x52')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x38d241['attrSerie3']||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x2]?_0x38d241[_0x6f1c('0x39')][0x2]['value']:undefined)||null},{'name':_0x6f1c('0x46'),'value':_0x38d241['attrVoiceQueues']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x3]?_0x38d241[_0x6f1c('0x39')][0x3][_0x6f1c('0x3a')]:undefined)||[]},{'name':_0x6f1c('0x47'),'value':_0x38d241[_0x6f1c('0x47')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x4]?_0x38d241[_0x6f1c('0x39')][0x4][_0x6f1c('0x3a')]:undefined)||_0x6f1c('0x48')},{'name':_0x6f1c('0x49'),'value':_0x38d241[_0x6f1c('0x49')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x5]?_0x38d241['attrs'][0x5][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x38d241[_0x6f1c('0x4a')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x6]?_0x38d241[_0x6f1c('0x39')][0x6][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x38d241['attrSmsAccounts']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x7]?_0x38d241[_0x6f1c('0x39')][0x7][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4c'),'value':_0x38d241[_0x6f1c('0x4c')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0x8]?_0x38d241[_0x6f1c('0x39')][0x8][_0x6f1c('0x3a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x38d241[_0x6f1c('0x4d')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x9]?_0x38d241['attrs'][0x9][_0x6f1c('0x3a')]:undefined)||''},{'name':_0x6f1c('0x4e'),'value':_0x38d241['attrChatWebsites']||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241[_0x6f1c('0x39')][0xa]?_0x38d241[_0x6f1c('0x39')][0xa][_0x6f1c('0x3a')]:undefined)||''}];case _0x6f1c('0x53'):return[{'name':_0x6f1c('0x54'),'type':_0x38d241[_0x6f1c('0x55')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['type']:undefined)||null,'value':_0x38d241[_0x6f1c('0x54')]||(_0x38d241['attrs']&&_0x38d241[_0x6f1c('0x39')][0x0]?_0x38d241[_0x6f1c('0x39')][0x0]['value']:undefined)||null},{'name':_0x6f1c('0x56'),'value':_0x38d241[_0x6f1c('0x56')]||(_0x38d241[_0x6f1c('0x39')]&&_0x38d241['attrs'][0x1]?_0x38d241[_0x6f1c('0x39')][0x1][_0x6f1c('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x5a69ec){logger[_0x6f1c('0x24')](_0x6f1c('0x57'),JSON[_0x6f1c('0x58')](_0x5a69ec));return[];}}exports[_0x6f1c('0x59')]=function(_0x51ae01,_0xad0e0f){if(_0x51ae01[_0x6f1c('0x5a')]){_0x51ae01[_0x6f1c('0x5a')]['attrs']=widgetAttributes(_0x51ae01[_0x6f1c('0x5a')]);}return db[_0x6f1c('0x2a')]['create'](_0x51ae01[_0x6f1c('0x5a')],{})[_0x6f1c('0x35')](respondWithResult(_0xad0e0f,0xc9))[_0x6f1c('0x36')](handleError(_0xad0e0f,null));};exports[_0x6f1c('0x22')]=function(_0xc3e7c0,_0x4bd3e3){if(_0xc3e7c0['body']['id']){delete _0xc3e7c0[_0x6f1c('0x5a')]['id'];}_0xc3e7c0['body']['attrs']=widgetAttributes(_0xc3e7c0[_0x6f1c('0x5a')]);return db['DashboardItem'][_0x6f1c('0x34')]({'where':{'id':_0xc3e7c0[_0x6f1c('0x28')]['id']}})[_0x6f1c('0x35')](handleEntityNotFound(_0x4bd3e3,null))[_0x6f1c('0x35')](saveUpdates(_0xc3e7c0[_0x6f1c('0x5a')],null))[_0x6f1c('0x35')](respondWithResult(_0x4bd3e3,null))[_0x6f1c('0x36')](handleError(_0x4bd3e3,null));}; \ No newline at end of file +var _0x714c=['multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','destroy','then','error','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites'];(function(_0x132e13,_0x33049e){var _0x505962=function(_0x18700d){while(--_0x18700d){_0x132e13['push'](_0x132e13['shift']());}};_0x505962(++_0x33049e);}(_0x714c,0x18d));var _0xc714=function(_0xdad237,_0x361a1d){_0xdad237=_0xdad237-0x0;var _0x15c575=_0x714c[_0xdad237];return _0x15c575;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc714('0x0'));var zipdir=require(_0xc714('0x1'));var jsonpatch=require(_0xc714('0x2'));var rp=require(_0xc714('0x3'));var moment=require(_0xc714('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc714('0x5'));var util=require(_0xc714('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc714('0x7'));var ejs=require(_0xc714('0x8'));var fs=require('fs');var fs_extra=require(_0xc714('0x9'));var _=require(_0xc714('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc714('0xb'));var deskjs=require(_0xc714('0xc'));var toCsv=require(_0xc714('0x7'));var querystring=require(_0xc714('0xd'));var Papa=require(_0xc714('0xe'));var Redis=require('ioredis');var authService=require(_0xc714('0xf'));var qs=require(_0xc714('0x10'));var as=require(_0xc714('0x11'));var hardwareService=require(_0xc714('0x12'));var logger=require(_0xc714('0x13'))('api');var utils=require(_0xc714('0x14'));var config=require(_0xc714('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc714('0x16')]=_['defaults'](config[_0xc714('0x16')],{'host':_0xc714('0x17'),'port':0x18eb});var socket=require(_0xc714('0x18'))(new Redis(config[_0xc714('0x16')]));require('./dashboardItem.socket')[_0xc714('0x19')](socket);function respondWithStatusCode(_0xde619a,_0x30b839){_0x30b839=_0x30b839||0xcc;return function(_0x25a61c){if(_0x25a61c){return _0xde619a[_0xc714('0x1a')](_0x30b839);}return _0xde619a[_0xc714('0x1b')](_0x30b839)[_0xc714('0x1c')]();};}function respondWithResult(_0x54144c,_0x4fd793){_0x4fd793=_0x4fd793||0xc8;return function(_0x4b2f57){if(_0x4b2f57){return _0x54144c[_0xc714('0x1b')](_0x4fd793)[_0xc714('0x1d')](_0x4b2f57);}};}function respondWithFilteredResult(_0xe22937,_0x3eef2f){return function(_0x310fe3){if(_0x310fe3){var _0x3b877a=typeof _0x3eef2f[_0xc714('0x1e')]===_0xc714('0x1f')&&typeof _0x3eef2f['limit']===_0xc714('0x1f');var _0x309ca2=_0x310fe3[_0xc714('0x20')];var _0x29c3ab=_0x3b877a?0x0:_0x3eef2f['offset'];var _0x751c4d=_0x3b877a?_0x310fe3[_0xc714('0x20')]:_0x3eef2f[_0xc714('0x1e')]+_0x3eef2f[_0xc714('0x21')];var _0x5e8d36;if(_0x751c4d>=_0x309ca2){_0x751c4d=_0x309ca2;_0x5e8d36=0xc8;}else{_0x5e8d36=0xce;}_0xe22937['status'](_0x5e8d36);return _0xe22937[_0xc714('0x22')]('Content-Range',_0x29c3ab+'-'+_0x751c4d+'/'+_0x309ca2)[_0xc714('0x1d')](_0x310fe3);}return null;};}function patchUpdates(_0x379127){return function(_0x3f2542){try{jsonpatch[_0xc714('0x23')](_0x3f2542,_0x379127,!![]);}catch(_0x3c6b1f){return BPromise['reject'](_0x3c6b1f);}return _0x3f2542['save']();};}function saveUpdates(_0x2bc48c,_0x50c332){return function(_0xbc41ee){if(_0xbc41ee){return _0xbc41ee[_0xc714('0x24')](_0x2bc48c)['then'](function(_0x5e1731){return _0x5e1731;});}return null;};}function removeEntity(_0x33ac9c,_0x306dd0){return function(_0x270386){if(_0x270386){return _0x270386[_0xc714('0x25')]()[_0xc714('0x26')](function(){_0x33ac9c['status'](0xcc)[_0xc714('0x1c')]();});}};}function handleEntityNotFound(_0x431a00,_0x56d3c8){return function(_0x2dad21){if(!_0x2dad21){_0x431a00[_0xc714('0x1a')](0x194);}return _0x2dad21;};}function handleError(_0x43f8d9,_0x48b64b){_0x48b64b=_0x48b64b||0x1f4;return function(_0x4e6b70){logger[_0xc714('0x27')](_0x4e6b70['stack']);if(_0x4e6b70[_0xc714('0x28')]){delete _0x4e6b70[_0xc714('0x28')];}_0x43f8d9['status'](_0x48b64b)[_0xc714('0x29')](_0x4e6b70);};}exports[_0xc714('0x2a')]=function(_0x4fb684,_0x21c29a){var _0xc7e7a={'raw':![],'where':{'id':_0x4fb684[_0xc714('0x2b')]['id']}},_0x4a947c={};_0x4a947c[_0xc714('0x2c')]=_[_0xc714('0x2d')](db[_0xc714('0x2e')][_0xc714('0x2f')]);_0x4a947c[_0xc714('0x30')]=_[_0xc714('0x2d')](_0x4fb684['query']);_0x4a947c[_0xc714('0x31')]=_[_0xc714('0x32')](_0x4a947c[_0xc714('0x2c')],_0x4a947c[_0xc714('0x30')]);_0xc7e7a[_0xc714('0x33')]=_[_0xc714('0x32')](_0x4a947c[_0xc714('0x2c')],qs[_0xc714('0x34')](_0x4fb684[_0xc714('0x30')][_0xc714('0x34')]));_0xc7e7a[_0xc714('0x33')]=_0xc7e7a[_0xc714('0x33')][_0xc714('0x35')]?_0xc7e7a[_0xc714('0x33')]:_0x4a947c['model'];if(_0x4fb684[_0xc714('0x30')][_0xc714('0x36')]){_0xc7e7a[_0xc714('0x37')]=[{'all':!![]}];}_0xc7e7a=_[_0xc714('0x38')]({},_0xc7e7a,_0x4fb684[_0xc714('0x39')]);return db[_0xc714('0x2e')][_0xc714('0x3a')](_0xc7e7a)[_0xc714('0x26')](handleEntityNotFound(_0x21c29a,null))[_0xc714('0x26')](respondWithResult(_0x21c29a,null))['catch'](handleError(_0x21c29a,null));};exports[_0xc714('0x25')]=function(_0x487f54,_0x541577){return db[_0xc714('0x2e')]['find']({'where':{'id':_0x487f54['params']['id']}})[_0xc714('0x26')](handleEntityNotFound(_0x541577,null))[_0xc714('0x26')](removeEntity(_0x541577,null))[_0xc714('0x3b')](handleError(_0x541577,null));};function widgetAttributes(_0x2cb513){try{switch(_0x2cb513[_0xc714('0x3c')]){case'iframe':return[{'name':_0xc714('0x3d'),'value':_0x2cb513[_0xc714('0x3d')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x0]?_0x2cb513['attrs'][0x0]['value']:undefined)||'https://'}];case _0xc714('0x3f'):return[{'name':_0xc714('0x40'),'value':_0x2cb513[_0xc714('0x40')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x0]?_0x2cb513[_0xc714('0x3e')][0x0][_0xc714('0x41')]:undefined)||''}];case _0xc714('0x42'):return[{'name':_0xc714('0x43'),'value':_0x2cb513[_0xc714('0x43')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x0]?_0x2cb513[_0xc714('0x3e')][0x0][_0xc714('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xc714('0x44'),'value':_0x2cb513[_0xc714('0x44')]||(_0x2cb513['attrs']&&_0x2cb513['attrs'][0x1]?_0x2cb513[_0xc714('0x3e')][0x1][_0xc714('0x41')]:undefined)||_0xc714('0x45')},{'name':_0xc714('0x46'),'value':_0x2cb513[_0xc714('0x46')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x2]?_0x2cb513['attrs'][0x2]['value']:undefined)||0xc}];case _0xc714('0x47'):return[{'name':_0xc714('0x48'),'value':_0x2cb513[_0xc714('0x48')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x0]?_0x2cb513[_0xc714('0x3e')][0x0][_0xc714('0x41')]:undefined)||_0xc714('0x49')},{'name':'attrVoiceQueues','value':_0x2cb513[_0xc714('0x4a')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x1]?_0x2cb513[_0xc714('0x3e')][0x1]['value']:undefined)||[]},{'name':_0xc714('0x46'),'value':_0x2cb513[_0xc714('0x46')]||(_0x2cb513['attrs']&&_0x2cb513['attrs'][0x2]?_0x2cb513[_0xc714('0x3e')][0x2][_0xc714('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x2cb513[_0xc714('0x4b')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x3]?_0x2cb513[_0xc714('0x3e')][0x3][_0xc714('0x41')]:undefined)||_0xc714('0x4c')},{'name':'attrEmailAccounts','value':_0x2cb513[_0xc714('0x4d')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x4]?_0x2cb513[_0xc714('0x3e')][0x4][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x4e'),'value':_0x2cb513[_0xc714('0x4e')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x5]?_0x2cb513['attrs'][0x5][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x4f'),'value':_0x2cb513[_0xc714('0x4f')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x6]?_0x2cb513[_0xc714('0x3e')][0x6][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x50'),'value':_0x2cb513[_0xc714('0x50')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x7]?_0x2cb513[_0xc714('0x3e')][0x7][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x51'),'value':_0x2cb513[_0xc714('0x51')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x8]?_0x2cb513['attrs'][0x8][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x52'),'value':_0x2cb513[_0xc714('0x52')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x9]?_0x2cb513[_0xc714('0x3e')][0x9][_0xc714('0x41')]:undefined)||''}];case _0xc714('0x53'):case _0xc714('0x54'):return[{'name':_0xc714('0x55'),'value':_0x2cb513[_0xc714('0x55')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x0]?_0x2cb513[_0xc714('0x3e')][0x0][_0xc714('0x41')]:undefined)||_0xc714('0x49')},{'name':'attrSerie2','value':_0x2cb513[_0xc714('0x56')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x1]?_0x2cb513['attrs'][0x1][_0xc714('0x41')]:undefined)||null},{'name':_0xc714('0x57'),'value':_0x2cb513[_0xc714('0x57')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x2]?_0x2cb513[_0xc714('0x3e')][0x2][_0xc714('0x41')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2cb513[_0xc714('0x4a')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x3]?_0x2cb513['attrs'][0x3][_0xc714('0x41')]:undefined)||[]},{'name':'attrChannel','value':_0x2cb513['attrChannel']||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x4]?_0x2cb513[_0xc714('0x3e')][0x4][_0xc714('0x41')]:undefined)||_0xc714('0x4c')},{'name':'attrEmailAccounts','value':_0x2cb513[_0xc714('0x4d')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x5]?_0x2cb513['attrs'][0x5][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x4e'),'value':_0x2cb513['attrFaxAccounts']||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x6]?_0x2cb513[_0xc714('0x3e')][0x6][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x4f'),'value':_0x2cb513['attrSmsAccounts']||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x7]?_0x2cb513[_0xc714('0x3e')][0x7][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x50'),'value':_0x2cb513[_0xc714('0x50')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x8]?_0x2cb513[_0xc714('0x3e')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2cb513[_0xc714('0x51')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x9]?_0x2cb513['attrs'][0x9][_0xc714('0x41')]:undefined)||''},{'name':_0xc714('0x52'),'value':_0x2cb513[_0xc714('0x52')]||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0xa]?_0x2cb513[_0xc714('0x3e')][0xa][_0xc714('0x41')]:undefined)||''}];case _0xc714('0x58'):return[{'name':_0xc714('0x59'),'type':_0x2cb513[_0xc714('0x5a')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513['attrs'][0x0]?_0x2cb513[_0xc714('0x3e')][0x0][_0xc714('0x3c')]:undefined)||null,'value':_0x2cb513[_0xc714('0x59')]||(_0x2cb513[_0xc714('0x3e')]&&_0x2cb513[_0xc714('0x3e')][0x0]?_0x2cb513[_0xc714('0x3e')][0x0]['value']:undefined)||null},{'name':_0xc714('0x5b'),'value':_0x2cb513['attrRefresh']||(_0x2cb513['attrs']&&_0x2cb513[_0xc714('0x3e')][0x1]?_0x2cb513['attrs'][0x1][_0xc714('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x429c1d){logger['error'](_0xc714('0x5c'),JSON[_0xc714('0x5d')](_0x429c1d));return[];}}exports['create']=function(_0x478156,_0x47c26d){if(_0x478156[_0xc714('0x5e')]){_0x478156[_0xc714('0x5e')][_0xc714('0x3e')]=widgetAttributes(_0x478156[_0xc714('0x5e')]);}return db[_0xc714('0x2e')][_0xc714('0x5f')](_0x478156[_0xc714('0x5e')],{})[_0xc714('0x26')](respondWithResult(_0x47c26d,0xc9))[_0xc714('0x3b')](handleError(_0x47c26d,null));};exports['update']=function(_0x185c83,_0x1f184a){if(_0x185c83[_0xc714('0x5e')]['id']){delete _0x185c83[_0xc714('0x5e')]['id'];}_0x185c83['body'][_0xc714('0x3e')]=widgetAttributes(_0x185c83[_0xc714('0x5e')]);return db['DashboardItem']['find']({'where':{'id':_0x185c83[_0xc714('0x2b')]['id']}})[_0xc714('0x26')](handleEntityNotFound(_0x1f184a,null))[_0xc714('0x26')](saveUpdates(_0x185c83[_0xc714('0x5e')],null))[_0xc714('0x26')](respondWithResult(_0x1f184a,null))[_0xc714('0x3b')](handleError(_0x1f184a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index bcf0161..89551c4 100644 --- a/server/api/dashboardItem/dashboardItem.events.js +++ b/server/api/dashboardItem/dashboardItem.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe24a=['hook','events','../../mysqldb','DashboardItem','setMaxListeners','emit'];(function(_0x155c1d,_0x20e1e3){var _0x199869=function(_0x5be264){while(--_0x5be264){_0x155c1d['push'](_0x155c1d['shift']());}};_0x199869(++_0x20e1e3);}(_0xe24a,0x151));var _0xae24=function(_0x559aca,_0x41a249){_0x559aca=_0x559aca-0x0;var _0x5627fe=_0xe24a[_0x559aca];return _0x5627fe;};'use strict';var EventEmitter=require(_0xae24('0x0'));var DashboardItem=require(_0xae24('0x1'))['db'][_0xae24('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xae24('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b31c5){return function(_0x34724c,_0x136d5a,_0x3c8429){DashboardItemEvents[_0xae24('0x4')](_0x1b31c5+':'+_0x34724c['id'],_0x34724c);DashboardItemEvents[_0xae24('0x4')](_0x1b31c5,_0x34724c);_0x3c8429(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xae24('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x9ac9=['emit','hasOwnProperty','hook','exports','events','DashboardItem','save','update','remove'];(function(_0x1f3c3b,_0x44d849){var _0x3fbff4=function(_0x259dc2){while(--_0x259dc2){_0x1f3c3b['push'](_0x1f3c3b['shift']());}};_0x3fbff4(++_0x44d849);}(_0x9ac9,0x190));var _0x99ac=function(_0x36846e,_0x2d29cd){_0x36846e=_0x36846e-0x0;var _0x5667ec=_0x9ac9[_0x36846e];return _0x5667ec;};'use strict';var EventEmitter=require(_0x99ac('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x99ac('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x99ac('0x2'),'afterUpdate':_0x99ac('0x3'),'afterDestroy':_0x99ac('0x4')};function emitEvent(_0x2a2474){return function(_0x4f2015,_0x182dab,_0x262871){DashboardItemEvents['emit'](_0x2a2474+':'+_0x4f2015['id'],_0x4f2015);DashboardItemEvents[_0x99ac('0x5')](_0x2a2474,_0x4f2015);_0x262871(null);};}for(var e in events){if(events[_0x99ac('0x6')](e)){var event=events[e];DashboardItem[_0x99ac('0x7')](e,emitEvent(event));}}module[_0x99ac('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 14537f4..c4b5c9f 100644 --- a/server/api/dashboardItem/dashboardItem.model.js +++ b/server/api/dashboardItem/dashboardItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd0a2=['bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0a2,0x128));var _0x2d0a=function(_0x45735b,_0x15bf2f){_0x45735b=_0x45735b-0x0;var _0x1c7553=_0xd0a2[_0x45735b];return _0x1c7553;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d0a('0x0'))(_0x2d0a('0x1'));var moment=require(_0x2d0a('0x2'));var BPromise=require(_0x2d0a('0x3'));var rp=require(_0x2d0a('0x4'));var fs=require('fs');var path=require(_0x2d0a('0x5'));var rimraf=require(_0x2d0a('0x6'));var config=require(_0x2d0a('0x7'));var attributes=require(_0x2d0a('0x8'));module[_0x2d0a('0x9')]=function(_0x2c76e2,_0x129a7e){return _0x2c76e2[_0x2d0a('0xa')](_0x2d0a('0xb'),attributes,{'tableName':_0x2d0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3e=['DashboardItem','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x445975,_0x3df67c){var _0x4bf86a=function(_0x3fffc5){while(--_0x3fffc5){_0x445975['push'](_0x445975['shift']());}};_0x4bf86a(++_0x3df67c);}(_0x8e3e,0x91));var _0xe8e3=function(_0xea4f29,_0x4ee31c){_0xea4f29=_0xea4f29-0x0;var _0x3ee530=_0x8e3e[_0xea4f29];return _0x3ee530;};'use strict';var _=require('lodash');var util=require(_0xe8e3('0x0'));var logger=require('../../config/logger')(_0xe8e3('0x1'));var moment=require('moment');var BPromise=require(_0xe8e3('0x2'));var rp=require(_0xe8e3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe8e3('0x4'));var config=require(_0xe8e3('0x5'));var attributes=require('./dashboardItem.attributes');module[_0xe8e3('0x6')]=function(_0x32c081,_0x4ffde9){return _0x32c081[_0xe8e3('0x7')](_0xe8e3('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 6a2aea0..4bad319 100644 --- a/server/api/dashboardItem/dashboardItem.rpc.js +++ b/server/api/dashboardItem/dashboardItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc381=['defaults','localhost','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x3b8572,_0x5d4436){var _0xf67c47=function(_0x2cd8c2){while(--_0x2cd8c2){_0x3b8572['push'](_0x3b8572['shift']());}};_0xf67c47(++_0x5d4436);}(_0xc381,0x67));var _0x1c38=function(_0x51dad1,_0x442770){_0x51dad1=_0x51dad1-0x0;var _0x3c041d=_0xc381[_0x51dad1];return _0x3c041d;};'use strict';var _=require(_0x1c38('0x0'));var util=require('util');var moment=require(_0x1c38('0x1'));var BPromise=require(_0x1c38('0x2'));var rs=require(_0x1c38('0x3'));var fs=require('fs');var Redis=require(_0x1c38('0x4'));var db=require(_0x1c38('0x5'))['db'];var utils=require(_0x1c38('0x6'));var logger=require(_0x1c38('0x7'))(_0x1c38('0x8'));var config=require(_0x1c38('0x9'));var jayson=require(_0x1c38('0xa'));var client=jayson['client'][_0x1c38('0xb')]({'port':0x232a});config[_0x1c38('0xc')]=_[_0x1c38('0xd')](config[_0x1c38('0xc')],{'host':_0x1c38('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1c38('0xf'))[_0x1c38('0x10')](socket);function respondWithRpcPromise(_0xdcf64c,_0x1f010e,_0x168360){return new BPromise(function(_0x47ddba,_0x57cd5d){return client[_0x1c38('0x11')](_0xdcf64c,_0x168360)[_0x1c38('0x12')](function(_0x11ba6d){logger[_0x1c38('0x13')](_0x1c38('0x14'),_0x1f010e,'request\x20sent');logger[_0x1c38('0x15')](_0x1c38('0x16'),_0x1f010e,'request\x20sent',JSON[_0x1c38('0x17')](_0x11ba6d));if(_0x11ba6d[_0x1c38('0x18')]){if(_0x11ba6d['error']['code']===0x1f4){logger['error'](_0x1c38('0x14'),_0x1f010e,_0x11ba6d['error'][_0x1c38('0x19')]);return _0x57cd5d(_0x11ba6d[_0x1c38('0x18')][_0x1c38('0x19')]);}logger[_0x1c38('0x18')](_0x1c38('0x14'),_0x1f010e,_0x11ba6d[_0x1c38('0x18')]['message']);return _0x47ddba(_0x11ba6d[_0x1c38('0x18')][_0x1c38('0x19')]);}else{logger[_0x1c38('0x13')](_0x1c38('0x14'),_0x1f010e,_0x1c38('0x1a'));_0x47ddba(_0x11ba6d[_0x1c38('0x1b')][_0x1c38('0x19')]);}})[_0x1c38('0x1c')](function(_0x2a9df5){logger[_0x1c38('0x18')](_0x1c38('0x14'),_0x1f010e,_0x2a9df5);_0x57cd5d(_0x2a9df5);});});} \ No newline at end of file +var _0xebb6=['redis','localhost','./dashboardItem.socket','register','request','info','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebb6,0x1e8));var _0x6ebb=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xebb6[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x6ebb('0x0'));var moment=require(_0x6ebb('0x1'));var BPromise=require(_0x6ebb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ebb('0x3'));var db=require(_0x6ebb('0x4'))['db'];var utils=require(_0x6ebb('0x5'));var logger=require(_0x6ebb('0x6'))(_0x6ebb('0x7'));var config=require(_0x6ebb('0x8'));var jayson=require(_0x6ebb('0x9'));var client=jayson[_0x6ebb('0xa')][_0x6ebb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x6ebb('0xc')],{'host':_0x6ebb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ebb('0xc')]));require(_0x6ebb('0xe'))[_0x6ebb('0xf')](socket);function respondWithRpcPromise(_0x3de81a,_0x4900f9,_0x3660ae){return new BPromise(function(_0x3ef474,_0x33c672){return client[_0x6ebb('0x10')](_0x3de81a,_0x3660ae)['then'](function(_0x36874e){logger[_0x6ebb('0x11')]('DashboardItem,\x20%s,\x20%s',_0x4900f9,_0x6ebb('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x4900f9,_0x6ebb('0x12'),JSON[_0x6ebb('0x13')](_0x36874e));if(_0x36874e['error']){if(_0x36874e[_0x6ebb('0x14')][_0x6ebb('0x15')]===0x1f4){logger['error'](_0x6ebb('0x16'),_0x4900f9,_0x36874e[_0x6ebb('0x14')]['message']);return _0x33c672(_0x36874e[_0x6ebb('0x14')][_0x6ebb('0x17')]);}logger[_0x6ebb('0x14')](_0x6ebb('0x16'),_0x4900f9,_0x36874e[_0x6ebb('0x14')][_0x6ebb('0x17')]);return _0x3ef474(_0x36874e[_0x6ebb('0x14')][_0x6ebb('0x17')]);}else{logger[_0x6ebb('0x11')](_0x6ebb('0x16'),_0x4900f9,'request\x20sent');_0x3ef474(_0x36874e['result'][_0x6ebb('0x17')]);}})[_0x6ebb('0x18')](function(_0x47dd8d){logger[_0x6ebb('0x14')](_0x6ebb('0x16'),_0x4900f9,_0x47dd8d);_0x33c672(_0x47dd8d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index c937d3e..5ba030f 100644 --- a/server/api/dashboardItem/dashboardItem.socket.js +++ b/server/api/dashboardItem/dashboardItem.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fea=['dashboardItem:','./dashboardItem.events','remove','emit','removeListener','register','length'];(function(_0x238c7b,_0x555793){var _0xdfbf6a=function(_0x2b00ed){while(--_0x2b00ed){_0x238c7b['push'](_0x238c7b['shift']());}};_0xdfbf6a(++_0x555793);}(_0x8fea,0x174));var _0xa8fe=function(_0x3187b0,_0x4cee2a){_0x3187b0=_0x3187b0-0x0;var _0x12c691=_0x8fea[_0x3187b0];return _0x12c691;};'use strict';var DashboardItemEvents=require(_0xa8fe('0x0'));var events=['save',_0xa8fe('0x1'),'update'];function createListener(_0x128f18,_0x23ebdb){return function(_0x4682f7){_0x23ebdb[_0xa8fe('0x2')](_0x128f18,_0x4682f7);};}function removeListener(_0x2f0a9e,_0x194666){return function(){DashboardItemEvents[_0xa8fe('0x3')](_0x2f0a9e,_0x194666);};}exports[_0xa8fe('0x4')]=function(_0x1d09db){for(var _0x347ad1=0x0,_0x531d7f=events[_0xa8fe('0x5')];_0x347ad1<_0x531d7f;_0x347ad1++){var _0x593a47=events[_0x347ad1];var _0x14b50a=createListener(_0xa8fe('0x6')+_0x593a47,_0x1d09db);DashboardItemEvents['on'](_0x593a47,_0x14b50a);}}; \ No newline at end of file +var _0x9bd5=['emit','register','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x414f87,_0x179f84){var _0x350bf5=function(_0x33f22f){while(--_0x33f22f){_0x414f87['push'](_0x414f87['shift']());}};_0x350bf5(++_0x179f84);}(_0x9bd5,0xc0));var _0x59bd=function(_0x8cf63c,_0x4286be){_0x8cf63c=_0x8cf63c-0x0;var _0x460f07=_0x9bd5[_0x8cf63c];return _0x460f07;};'use strict';var DashboardItemEvents=require(_0x59bd('0x0'));var events=[_0x59bd('0x1'),_0x59bd('0x2'),_0x59bd('0x3')];function createListener(_0x3a7f6f,_0x2a28e6){return function(_0x25868f){_0x2a28e6[_0x59bd('0x4')](_0x3a7f6f,_0x25868f);};}function removeListener(_0x57fced,_0x28a310){return function(){DashboardItemEvents['removeListener'](_0x57fced,_0x28a310);};}exports[_0x59bd('0x5')]=function(_0x10eff1){for(var _0x4454ec=0x0,_0x4480e5=events['length'];_0x4454ec<_0x4480e5;_0x4454ec++){var _0x2ef139=events[_0x4454ec];var _0x231ea1=createListener(_0x59bd('0x6')+_0x2ef139,_0x10eff1);DashboardItemEvents['on'](_0x2ef139,_0x231ea1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e454f01..26beff6 100644 --- a/server/api/dashboardItem/index.js +++ b/server/api/dashboardItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bbc=['../../components/auth/service','../../components/interaction/service','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x44b276,_0x2d1c08){var _0x411926=function(_0xbfa23e){while(--_0xbfa23e){_0x44b276['push'](_0x44b276['shift']());}};_0x411926(++_0x2d1c08);}(_0x8bbc,0x19b));var _0xc8bb=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x8bbc[_0x401676];return _0x4f13fe;};'use strict';var multer=require(_0xc8bb('0x0'));var util=require(_0xc8bb('0x1'));var path=require(_0xc8bb('0x2'));var timeout=require(_0xc8bb('0x3'));var express=require(_0xc8bb('0x4'));var router=express[_0xc8bb('0x5')]();var fs_extra=require(_0xc8bb('0x6'));var auth=require(_0xc8bb('0x7'));var interaction=require(_0xc8bb('0x8'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0xc8bb('0x9')](_0xc8bb('0xa'),auth['isAuthenticated'](),controller[_0xc8bb('0xb')]);router[_0xc8bb('0xc')]('/',auth[_0xc8bb('0xd')](),controller[_0xc8bb('0xe')]);router[_0xc8bb('0xf')](_0xc8bb('0xa'),auth['isAuthenticated'](),controller[_0xc8bb('0x10')]);router[_0xc8bb('0x11')](_0xc8bb('0xa'),auth[_0xc8bb('0xd')](),controller[_0xc8bb('0x12')]);module['exports']=router; \ No newline at end of file +var _0xae70=['get','/:id','post','isAuthenticated','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae70,0xb8));var _0x0ae7=function(_0x5277cf,_0x3fd8ac){_0x5277cf=_0x5277cf-0x0;var _0x36432e=_0xae70[_0x5277cf];return _0x36432e;};'use strict';var multer=require(_0x0ae7('0x0'));var util=require(_0x0ae7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ae7('0x2'));var router=express[_0x0ae7('0x3')]();var fs_extra=require(_0x0ae7('0x4'));var auth=require(_0x0ae7('0x5'));var interaction=require(_0x0ae7('0x6'));var config=require('../../config/environment');var controller=require(_0x0ae7('0x7'));router[_0x0ae7('0x8')](_0x0ae7('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x0ae7('0xa')]('/',auth[_0x0ae7('0xb')](),controller[_0x0ae7('0xc')]);router[_0x0ae7('0xd')]('/:id',auth[_0x0ae7('0xb')](),controller[_0x0ae7('0xe')]);router[_0x0ae7('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 044c6ff..5490de0 100644 --- a/server/api/disposition/disposition.attributes.js +++ b/server/api/disposition/disposition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c8a=['ENUM','first','third','sequelize','exports','STRING'];(function(_0x2a6b52,_0x19c4a7){var _0x52e5cc=function(_0x5beb81){while(--_0x5beb81){_0x2a6b52['push'](_0x2a6b52['shift']());}};_0x52e5cc(++_0x19c4a7);}(_0x1c8a,0x18f));var _0xa1c8=function(_0x59170f,_0x248ca7){_0x59170f=_0x59170f-0x0;var _0x18534f=_0x1c8a[_0x59170f];return _0x18534f;};'use strict';var Sequelize=require(_0xa1c8('0x0'));module[_0xa1c8('0x1')]={'name':{'type':Sequelize[_0xa1c8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa1c8('0x3')](_0xa1c8('0x4'),'second',_0xa1c8('0x5')),'allowNull':![],'defaultValue':_0xa1c8('0x4')},'description':{'type':Sequelize[_0xa1c8('0x2')]}}; \ No newline at end of file +var _0xe571=['first','sequelize','exports','second'];(function(_0x48a5a7,_0x3e1bf3){var _0x57dfb4=function(_0x27ce88){while(--_0x27ce88){_0x48a5a7['push'](_0x48a5a7['shift']());}};_0x57dfb4(++_0x3e1bf3);}(_0xe571,0x125));var _0x1e57=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe571[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1e57('0x0'));module[_0x1e57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x1e57('0x2'),'third'),'allowNull':![],'defaultValue':_0x1e57('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 73bf442..ba6551e 100644 --- a/server/api/disposition/disposition.controller.js +++ b/server/api/disposition/disposition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77ed=['role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Disposition','include','findAll','rows','catch','show','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x77ed,0x152));var _0xd77e=function(_0x2fbb0a,_0x2af047){_0x2fbb0a=_0x2fbb0a-0x0;var _0x3b5550=_0x77ed[_0x2fbb0a];return _0x3b5550;};'use strict';var emlformat=require(_0xd77e('0x0'));var rimraf=require(_0xd77e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd77e('0x2'));var rp=require('request-promise');var moment=require(_0xd77e('0x3'));var BPromise=require(_0xd77e('0x4'));var Mustache=require('mustache');var util=require(_0xd77e('0x5'));var path=require(_0xd77e('0x6'));var sox=require(_0xd77e('0x7'));var csv=require(_0xd77e('0x8'));var ejs=require(_0xd77e('0x9'));var fs=require('fs');var fs_extra=require(_0xd77e('0xa'));var _=require('lodash');var squel=require(_0xd77e('0xb'));var crypto=require('crypto');var jsforce=require(_0xd77e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd77e('0x8'));var querystring=require(_0xd77e('0xd'));var Papa=require(_0xd77e('0xe'));var Redis=require(_0xd77e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd77e('0x10'));var as=require(_0xd77e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd77e('0x12'))(_0xd77e('0x13'));var utils=require('../../config/utils');var config=require(_0xd77e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd77e('0x15'))['db'];function respondWithStatusCode(_0x4ed0db,_0x3dc914){_0x3dc914=_0x3dc914||0xcc;return function(_0x3e3aac){if(_0x3e3aac){return _0x4ed0db[_0xd77e('0x16')](_0x3dc914);}return _0x4ed0db['status'](_0x3dc914)[_0xd77e('0x17')]();};}function respondWithResult(_0x399a6a,_0x53a2ae){_0x53a2ae=_0x53a2ae||0xc8;return function(_0x91738a){if(_0x91738a){return _0x399a6a[_0xd77e('0x18')](_0x53a2ae)[_0xd77e('0x19')](_0x91738a);}};}function respondWithFilteredResult(_0x181a3e,_0x5ac206){return function(_0x1fbfb2){if(_0x1fbfb2){var _0x53453a=typeof _0x5ac206[_0xd77e('0x1a')]===_0xd77e('0x1b')&&typeof _0x5ac206[_0xd77e('0x1c')]===_0xd77e('0x1b');var _0x1313ec=_0x1fbfb2[_0xd77e('0x1d')];var _0x4818be=_0x53453a?0x0:_0x5ac206['offset'];var _0x4eb60e=_0x53453a?_0x1fbfb2['count']:_0x5ac206[_0xd77e('0x1a')]+_0x5ac206[_0xd77e('0x1c')];var _0x46768d;if(_0x4eb60e>=_0x1313ec){_0x4eb60e=_0x1313ec;_0x46768d=0xc8;}else{_0x46768d=0xce;}_0x181a3e[_0xd77e('0x18')](_0x46768d);return _0x181a3e[_0xd77e('0x1e')]('Content-Range',_0x4818be+'-'+_0x4eb60e+'/'+_0x1313ec)[_0xd77e('0x19')](_0x1fbfb2);}return null;};}function patchUpdates(_0x5b3bb8){return function(_0x38f977){try{jsonpatch[_0xd77e('0x1f')](_0x38f977,_0x5b3bb8,!![]);}catch(_0x3036b7){return BPromise[_0xd77e('0x20')](_0x3036b7);}return _0x38f977[_0xd77e('0x21')]();};}function saveUpdates(_0x1db5f1,_0x581131){return function(_0x14f187){if(_0x14f187){return _0x14f187['update'](_0x1db5f1)['then'](function(_0x488863){return _0x488863;});}return null;};}function removeEntity(_0x10e406,_0x9f33ca){return function(_0x2b2dd6){if(_0x2b2dd6){return _0x2b2dd6[_0xd77e('0x22')]()[_0xd77e('0x23')](function(){var _0x1c2b7c=_0x2b2dd6[_0xd77e('0x24')]({'plain':!![]});var _0x4e1457=_0xd77e('0x25');return db[_0xd77e('0x26')][_0xd77e('0x22')]({'where':{'type':_0x4e1457,'resourceId':_0x1c2b7c['id']}})[_0xd77e('0x23')](function(){return _0x2b2dd6;});})[_0xd77e('0x23')](function(){_0x10e406[_0xd77e('0x18')](0xcc)[_0xd77e('0x17')]();});}};}function handleEntityNotFound(_0x2301a9,_0x333646){return function(_0x414e23){if(!_0x414e23){_0x2301a9[_0xd77e('0x16')](0x194);}return _0x414e23;};}function handleError(_0x5929c4,_0x566cef){_0x566cef=_0x566cef||0x1f4;return function(_0x168988){logger[_0xd77e('0x27')](_0x168988[_0xd77e('0x28')]);if(_0x168988[_0xd77e('0x29')]){delete _0x168988[_0xd77e('0x29')];}_0x5929c4[_0xd77e('0x18')](_0x566cef)[_0xd77e('0x2a')](_0x168988);};}exports[_0xd77e('0x2b')]=function(_0x141a49,_0x3e74b5){var _0x26a861={},_0x5e6004={},_0x533c7a={'count':0x0,'rows':[]};var _0x1ff32e=_[_0xd77e('0x2c')](db['Disposition']['rawAttributes'],function(_0x321e54){return{'name':_0x321e54[_0xd77e('0x2d')],'type':_0x321e54[_0xd77e('0x2e')][_0xd77e('0x2f')]};});_0x5e6004[_0xd77e('0x30')]=_['map'](_0x1ff32e,_0xd77e('0x29'));_0x5e6004[_0xd77e('0x31')]=_[_0xd77e('0x32')](_0x141a49[_0xd77e('0x31')]);_0x5e6004[_0xd77e('0x33')]=_[_0xd77e('0x34')](_0x5e6004['model'],_0x5e6004[_0xd77e('0x31')]);_0x26a861[_0xd77e('0x35')]=_['intersection'](_0x5e6004[_0xd77e('0x30')],qs[_0xd77e('0x36')](_0x141a49['query']['fields']));_0x26a861['attributes']=_0x26a861[_0xd77e('0x35')]['length']?_0x26a861[_0xd77e('0x35')]:_0x5e6004[_0xd77e('0x30')];if(!_0x141a49[_0xd77e('0x31')][_0xd77e('0x37')](_0xd77e('0x38'))){_0x26a861[_0xd77e('0x1c')]=qs['limit'](_0x141a49['query'][_0xd77e('0x1c')]);_0x26a861[_0xd77e('0x1a')]=qs[_0xd77e('0x1a')](_0x141a49[_0xd77e('0x31')][_0xd77e('0x1a')]);}_0x26a861[_0xd77e('0x39')]=qs['sort'](_0x141a49[_0xd77e('0x31')]['sort']);_0x26a861[_0xd77e('0x3a')]=qs['filters'](_[_0xd77e('0x3b')](_0x141a49[_0xd77e('0x31')],_0x5e6004[_0xd77e('0x33')]),_0x1ff32e);if(_0x141a49[_0xd77e('0x31')][_0xd77e('0x3c')]){_0x26a861[_0xd77e('0x3a')]=_[_0xd77e('0x3d')](_0x26a861[_0xd77e('0x3a')],{'$or':_[_0xd77e('0x2c')](_0x1ff32e,function(_0x3e0076){if(_0x3e0076[_0xd77e('0x2e')]!==_0xd77e('0x3e')){var _0x549eff={};_0x549eff[_0x3e0076['name']]={'$like':'%'+_0x141a49[_0xd77e('0x31')][_0xd77e('0x3c')]+'%'};return _0x549eff;}})});}_0x26a861=_['merge']({},_0x26a861,_0x141a49[_0xd77e('0x3f')]);var _0x124ef7={'where':_0x26a861[_0xd77e('0x3a')]};return db[_0xd77e('0x40')][_0xd77e('0x1d')](_0x124ef7)[_0xd77e('0x23')](function(_0x1b2c9c){_0x533c7a[_0xd77e('0x1d')]=_0x1b2c9c;if(_0x141a49['query']['includeAll']){_0x26a861[_0xd77e('0x41')]=[{'all':!![]}];}return db[_0xd77e('0x40')][_0xd77e('0x42')](_0x26a861);})['then'](function(_0x1a5ade){_0x533c7a[_0xd77e('0x43')]=_0x1a5ade;return _0x533c7a;})['then'](respondWithFilteredResult(_0x3e74b5,_0x26a861))[_0xd77e('0x44')](handleError(_0x3e74b5,null));};exports[_0xd77e('0x45')]=function(_0x9d2ad9,_0x3031dd){var _0x3c27e2={'raw':!![],'where':{'id':_0x9d2ad9['params']['id']}},_0xaee7f3={};_0xaee7f3['model']=_[_0xd77e('0x32')](db['Disposition'][_0xd77e('0x46')]);_0xaee7f3[_0xd77e('0x31')]=_[_0xd77e('0x32')](_0x9d2ad9['query']);_0xaee7f3['filters']=_['intersection'](_0xaee7f3[_0xd77e('0x30')],_0xaee7f3[_0xd77e('0x31')]);_0x3c27e2[_0xd77e('0x35')]=_[_0xd77e('0x34')](_0xaee7f3[_0xd77e('0x30')],qs[_0xd77e('0x36')](_0x9d2ad9[_0xd77e('0x31')][_0xd77e('0x36')]));_0x3c27e2[_0xd77e('0x35')]=_0x3c27e2[_0xd77e('0x35')][_0xd77e('0x47')]?_0x3c27e2[_0xd77e('0x35')]:_0xaee7f3[_0xd77e('0x30')];if(_0x9d2ad9[_0xd77e('0x31')][_0xd77e('0x48')]){_0x3c27e2[_0xd77e('0x41')]=[{'all':!![]}];}_0x3c27e2=_[_0xd77e('0x3d')]({},_0x3c27e2,_0x9d2ad9[_0xd77e('0x3f')]);return db[_0xd77e('0x40')][_0xd77e('0x49')](_0x3c27e2)[_0xd77e('0x23')](handleEntityNotFound(_0x3031dd,null))['then'](respondWithResult(_0x3031dd,null))[_0xd77e('0x44')](handleError(_0x3031dd,null));};exports[_0xd77e('0x4a')]=function(_0x3e3d4c,_0x18b9dc){return db['Disposition']['create'](_0x3e3d4c['body'],{})[_0xd77e('0x23')](function(_0x31815e){var _0x3d666c=_0x3e3d4c[_0xd77e('0x4b')][_0xd77e('0x24')]({'plain':!![]});if(!_0x3d666c)throw new Error(_0xd77e('0x4c'));if(_0x3d666c[_0xd77e('0x4d')]===_0xd77e('0x4b')){var _0x37900d=_0x31815e[_0xd77e('0x24')]({'plain':!![]});var _0x173101=_0xd77e('0x25');return db[_0xd77e('0x4e')][_0xd77e('0x49')]({'where':{'name':_0x173101,'userProfileId':_0x3d666c['userProfileId']},'raw':!![]})[_0xd77e('0x23')](function(_0x3941bf){if(_0x3941bf&&_0x3941bf[_0xd77e('0x4f')]===0x0){return db[_0xd77e('0x26')][_0xd77e('0x4a')]({'name':_0x37900d[_0xd77e('0x29')],'resourceId':_0x37900d['id'],'type':_0x3941bf[_0xd77e('0x29')],'sectionId':_0x3941bf['id']},{})[_0xd77e('0x23')](function(){return _0x31815e;});}else{return _0x31815e;}})['catch'](function(_0x4473dd){logger[_0xd77e('0x27')](_0xd77e('0x50'),_0x4473dd);throw _0x4473dd;});}return _0x31815e;})['then'](respondWithResult(_0x18b9dc,0xc9))[_0xd77e('0x44')](handleError(_0x18b9dc,null));};exports[_0xd77e('0x51')]=function(_0x3aff22,_0x5a4664){if(_0x3aff22[_0xd77e('0x52')]['id']){delete _0x3aff22[_0xd77e('0x52')]['id'];}return db[_0xd77e('0x40')][_0xd77e('0x49')]({'where':{'id':_0x3aff22['params']['id']}})[_0xd77e('0x23')](handleEntityNotFound(_0x5a4664,null))[_0xd77e('0x23')](saveUpdates(_0x3aff22[_0xd77e('0x52')],null))['then'](respondWithResult(_0x5a4664,null))[_0xd77e('0x44')](handleError(_0x5a4664,null));};exports[_0xd77e('0x22')]=function(_0x47c6ed,_0x4c2e44){return db[_0xd77e('0x40')][_0xd77e('0x49')]({'where':{'id':_0x47c6ed['params']['id']}})['then'](handleEntityNotFound(_0x4c2e44,null))['then'](removeEntity(_0x4c2e44,null))[_0xd77e('0x44')](handleError(_0x4c2e44,null));}; \ No newline at end of file +var _0x0f89=['catch','show','params','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows'];(function(_0x34951f,_0x277327){var _0x487db1=function(_0x452a5f){while(--_0x452a5f){_0x34951f['push'](_0x34951f['shift']());}};_0x487db1(++_0x277327);}(_0x0f89,0x111));var _0x90f8=function(_0x3bae9c,_0x3a233f){_0x3bae9c=_0x3bae9c-0x0;var _0x15822f=_0x0f89[_0x3bae9c];return _0x15822f;};'use strict';var emlformat=require(_0x90f8('0x0'));var rimraf=require(_0x90f8('0x1'));var zipdir=require(_0x90f8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90f8('0x3'));var moment=require(_0x90f8('0x4'));var BPromise=require(_0x90f8('0x5'));var Mustache=require(_0x90f8('0x6'));var util=require('util');var path=require(_0x90f8('0x7'));var sox=require(_0x90f8('0x8'));var csv=require('to-csv');var ejs=require(_0x90f8('0x9'));var fs=require('fs');var fs_extra=require(_0x90f8('0xa'));var _=require(_0x90f8('0xb'));var squel=require(_0x90f8('0xc'));var crypto=require(_0x90f8('0xd'));var jsforce=require(_0x90f8('0xe'));var deskjs=require(_0x90f8('0xf'));var toCsv=require(_0x90f8('0x10'));var querystring=require(_0x90f8('0x11'));var Papa=require(_0x90f8('0x12'));var Redis=require(_0x90f8('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90f8('0x14'));var hardwareService=require(_0x90f8('0x15'));var logger=require(_0x90f8('0x16'))(_0x90f8('0x17'));var utils=require(_0x90f8('0x18'));var config=require(_0x90f8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x90f8('0x1a'))['db'];function respondWithStatusCode(_0x4a1c3d,_0x4b31e6){_0x4b31e6=_0x4b31e6||0xcc;return function(_0x329f26){if(_0x329f26){return _0x4a1c3d[_0x90f8('0x1b')](_0x4b31e6);}return _0x4a1c3d['status'](_0x4b31e6)[_0x90f8('0x1c')]();};}function respondWithResult(_0x4e230b,_0x270a7d){_0x270a7d=_0x270a7d||0xc8;return function(_0x3f357f){if(_0x3f357f){return _0x4e230b[_0x90f8('0x1d')](_0x270a7d)[_0x90f8('0x1e')](_0x3f357f);}};}function respondWithFilteredResult(_0x4a36f9,_0x7bdc62){return function(_0x2767b3){if(_0x2767b3){var _0xec9212=typeof _0x7bdc62[_0x90f8('0x1f')]==='undefined'&&typeof _0x7bdc62[_0x90f8('0x20')]===_0x90f8('0x21');var _0x5615d2=_0x2767b3[_0x90f8('0x22')];var _0x31cc49=_0xec9212?0x0:_0x7bdc62[_0x90f8('0x1f')];var _0xae253e=_0xec9212?_0x2767b3[_0x90f8('0x22')]:_0x7bdc62[_0x90f8('0x1f')]+_0x7bdc62[_0x90f8('0x20')];var _0x1c3e04;if(_0xae253e>=_0x5615d2){_0xae253e=_0x5615d2;_0x1c3e04=0xc8;}else{_0x1c3e04=0xce;}_0x4a36f9[_0x90f8('0x1d')](_0x1c3e04);return _0x4a36f9[_0x90f8('0x23')](_0x90f8('0x24'),_0x31cc49+'-'+_0xae253e+'/'+_0x5615d2)[_0x90f8('0x1e')](_0x2767b3);}return null;};}function patchUpdates(_0x2994f9){return function(_0x4e9104){try{jsonpatch['apply'](_0x4e9104,_0x2994f9,!![]);}catch(_0xb207f5){return BPromise[_0x90f8('0x25')](_0xb207f5);}return _0x4e9104[_0x90f8('0x26')]();};}function saveUpdates(_0x1892f0,_0x26b420){return function(_0x17dfe7){if(_0x17dfe7){return _0x17dfe7[_0x90f8('0x27')](_0x1892f0)[_0x90f8('0x28')](function(_0x487236){return _0x487236;});}return null;};}function removeEntity(_0xa07586,_0x2a78b8){return function(_0x30e5ed){if(_0x30e5ed){return _0x30e5ed[_0x90f8('0x29')]()['then'](function(){var _0x51b5fb=_0x30e5ed[_0x90f8('0x2a')]({'plain':!![]});var _0x153d61='Dispositions';return db[_0x90f8('0x2b')][_0x90f8('0x29')]({'where':{'type':_0x153d61,'resourceId':_0x51b5fb['id']}})[_0x90f8('0x28')](function(){return _0x30e5ed;});})['then'](function(){_0xa07586[_0x90f8('0x1d')](0xcc)[_0x90f8('0x1c')]();});}};}function handleEntityNotFound(_0x187bbf,_0x185e75){return function(_0x2a6483){if(!_0x2a6483){_0x187bbf[_0x90f8('0x1b')](0x194);}return _0x2a6483;};}function handleError(_0xf82cd0,_0x46eccc){_0x46eccc=_0x46eccc||0x1f4;return function(_0x3877e5){logger['error'](_0x3877e5[_0x90f8('0x2c')]);if(_0x3877e5['name']){delete _0x3877e5[_0x90f8('0x2d')];}_0xf82cd0['status'](_0x46eccc)[_0x90f8('0x2e')](_0x3877e5);};}exports[_0x90f8('0x2f')]=function(_0x91c52b,_0x340658){var _0x58b898={},_0x31c7d7={},_0x2615a={'count':0x0,'rows':[]};var _0x4453d8=_[_0x90f8('0x30')](db[_0x90f8('0x31')][_0x90f8('0x32')],function(_0x54a549){return{'name':_0x54a549[_0x90f8('0x33')],'type':_0x54a549[_0x90f8('0x34')][_0x90f8('0x35')]};});_0x31c7d7[_0x90f8('0x36')]=_['map'](_0x4453d8,_0x90f8('0x2d'));_0x31c7d7[_0x90f8('0x37')]=_[_0x90f8('0x38')](_0x91c52b[_0x90f8('0x37')]);_0x31c7d7['filters']=_[_0x90f8('0x39')](_0x31c7d7['model'],_0x31c7d7[_0x90f8('0x37')]);_0x58b898[_0x90f8('0x3a')]=_[_0x90f8('0x39')](_0x31c7d7[_0x90f8('0x36')],qs[_0x90f8('0x3b')](_0x91c52b['query']['fields']));_0x58b898[_0x90f8('0x3a')]=_0x58b898[_0x90f8('0x3a')]['length']?_0x58b898['attributes']:_0x31c7d7[_0x90f8('0x36')];if(!_0x91c52b[_0x90f8('0x37')]['hasOwnProperty'](_0x90f8('0x3c'))){_0x58b898['limit']=qs['limit'](_0x91c52b[_0x90f8('0x37')]['limit']);_0x58b898[_0x90f8('0x1f')]=qs[_0x90f8('0x1f')](_0x91c52b['query'][_0x90f8('0x1f')]);}_0x58b898[_0x90f8('0x3d')]=qs[_0x90f8('0x3e')](_0x91c52b['query'][_0x90f8('0x3e')]);_0x58b898[_0x90f8('0x3f')]=qs[_0x90f8('0x40')](_['pick'](_0x91c52b[_0x90f8('0x37')],_0x31c7d7[_0x90f8('0x40')]),_0x4453d8);if(_0x91c52b['query'][_0x90f8('0x41')]){_0x58b898['where']=_[_0x90f8('0x42')](_0x58b898[_0x90f8('0x3f')],{'$or':_[_0x90f8('0x30')](_0x4453d8,function(_0x483de8){if(_0x483de8['type']!=='VIRTUAL'){var _0x1d2da8={};_0x1d2da8[_0x483de8[_0x90f8('0x2d')]]={'$like':'%'+_0x91c52b[_0x90f8('0x37')][_0x90f8('0x41')]+'%'};return _0x1d2da8;}})});}_0x58b898=_[_0x90f8('0x42')]({},_0x58b898,_0x91c52b[_0x90f8('0x43')]);var _0x34637f={'where':_0x58b898[_0x90f8('0x3f')]};return db['Disposition'][_0x90f8('0x22')](_0x34637f)[_0x90f8('0x28')](function(_0x1b208c){_0x2615a[_0x90f8('0x22')]=_0x1b208c;if(_0x91c52b['query']['includeAll']){_0x58b898[_0x90f8('0x44')]=[{'all':!![]}];}return db[_0x90f8('0x31')][_0x90f8('0x45')](_0x58b898);})[_0x90f8('0x28')](function(_0x5f0a86){_0x2615a[_0x90f8('0x46')]=_0x5f0a86;return _0x2615a;})[_0x90f8('0x28')](respondWithFilteredResult(_0x340658,_0x58b898))[_0x90f8('0x47')](handleError(_0x340658,null));};exports[_0x90f8('0x48')]=function(_0x285a05,_0x9151df){var _0x49dd51={'raw':!![],'where':{'id':_0x285a05[_0x90f8('0x49')]['id']}},_0x5bde77={};_0x5bde77[_0x90f8('0x36')]=_['keys'](db['Disposition'][_0x90f8('0x32')]);_0x5bde77[_0x90f8('0x37')]=_[_0x90f8('0x38')](_0x285a05[_0x90f8('0x37')]);_0x5bde77[_0x90f8('0x40')]=_[_0x90f8('0x39')](_0x5bde77[_0x90f8('0x36')],_0x5bde77[_0x90f8('0x37')]);_0x49dd51[_0x90f8('0x3a')]=_[_0x90f8('0x39')](_0x5bde77['model'],qs['fields'](_0x285a05[_0x90f8('0x37')]['fields']));_0x49dd51[_0x90f8('0x3a')]=_0x49dd51[_0x90f8('0x3a')][_0x90f8('0x4a')]?_0x49dd51['attributes']:_0x5bde77[_0x90f8('0x36')];if(_0x285a05['query'][_0x90f8('0x4b')]){_0x49dd51[_0x90f8('0x44')]=[{'all':!![]}];}_0x49dd51=_[_0x90f8('0x42')]({},_0x49dd51,_0x285a05[_0x90f8('0x43')]);return db[_0x90f8('0x31')][_0x90f8('0x4c')](_0x49dd51)[_0x90f8('0x28')](handleEntityNotFound(_0x9151df,null))[_0x90f8('0x28')](respondWithResult(_0x9151df,null))['catch'](handleError(_0x9151df,null));};exports[_0x90f8('0x4d')]=function(_0x35c2b9,_0x461913){return db[_0x90f8('0x31')]['create'](_0x35c2b9['body'],{})['then'](function(_0x555445){var _0x1532c7=_0x35c2b9[_0x90f8('0x4e')]['get']({'plain':!![]});if(!_0x1532c7)throw new Error(_0x90f8('0x4f'));if(_0x1532c7[_0x90f8('0x50')]===_0x90f8('0x4e')){var _0x3da03c=_0x555445[_0x90f8('0x2a')]({'plain':!![]});var _0x5d720c=_0x90f8('0x51');return db['UserProfileSection'][_0x90f8('0x4c')]({'where':{'name':_0x5d720c,'userProfileId':_0x1532c7[_0x90f8('0x52')]},'raw':!![]})['then'](function(_0xf7e823){if(_0xf7e823&&_0xf7e823[_0x90f8('0x53')]===0x0){return db[_0x90f8('0x2b')][_0x90f8('0x4d')]({'name':_0x3da03c[_0x90f8('0x2d')],'resourceId':_0x3da03c['id'],'type':_0xf7e823[_0x90f8('0x2d')],'sectionId':_0xf7e823['id']},{})[_0x90f8('0x28')](function(){return _0x555445;});}else{return _0x555445;}})[_0x90f8('0x47')](function(_0x2864f7){logger['error'](_0x90f8('0x54'),_0x2864f7);throw _0x2864f7;});}return _0x555445;})[_0x90f8('0x28')](respondWithResult(_0x461913,0xc9))['catch'](handleError(_0x461913,null));};exports['update']=function(_0x15e7d7,_0x4f287d){if(_0x15e7d7[_0x90f8('0x55')]['id']){delete _0x15e7d7[_0x90f8('0x55')]['id'];}return db[_0x90f8('0x31')][_0x90f8('0x4c')]({'where':{'id':_0x15e7d7[_0x90f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f287d,null))[_0x90f8('0x28')](saveUpdates(_0x15e7d7['body'],null))['then'](respondWithResult(_0x4f287d,null))[_0x90f8('0x47')](handleError(_0x4f287d,null));};exports[_0x90f8('0x29')]=function(_0x5f33d1,_0x590c8f){return db[_0x90f8('0x31')][_0x90f8('0x4c')]({'where':{'id':_0x5f33d1['params']['id']}})[_0x90f8('0x28')](handleEntityNotFound(_0x590c8f,null))['then'](removeEntity(_0x590c8f,null))[_0x90f8('0x47')](handleError(_0x590c8f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 41ff268..1ca4806 100644 --- a/server/api/disposition/disposition.model.js +++ b/server/api/disposition/disposition.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a5c=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a5c,0x82));var _0xc8a5=function(_0x360ff0,_0x5f09de){_0x360ff0=_0x360ff0-0x0;var _0x4eb70d=_0x8a5c[_0x360ff0];return _0x4eb70d;};'use strict';var _=require('lodash');var util=require(_0xc8a5('0x0'));var logger=require(_0xc8a5('0x1'))(_0xc8a5('0x2'));var moment=require('moment');var BPromise=require(_0xc8a5('0x3'));var rp=require(_0xc8a5('0x4'));var fs=require('fs');var path=require(_0xc8a5('0x5'));var rimraf=require(_0xc8a5('0x6'));var config=require(_0xc8a5('0x7'));var attributes=require(_0xc8a5('0x8'));module[_0xc8a5('0x9')]=function(_0x2f8ded,_0x4d5935){return _0x2f8ded[_0xc8a5('0xa')](_0xc8a5('0xb'),attributes,{'tableName':_0xc8a5('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc8a5('0xd'),'fields':[_0xc8a5('0xe'),_0xc8a5('0xf')]},{'unique':!![],'name':_0xc8a5('0x10'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x11')]},{'unique':!![],'name':_0xc8a5('0x12'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x13')]},{'unique':!![],'name':_0xc8a5('0x14'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xc8a5('0x15'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x16')]},{'unique':!![],'name':_0xc8a5('0x17'),'fields':[_0xc8a5('0xe'),_0xc8a5('0x18')]},{'unique':!![],'name':_0xc8a5('0x19'),'fields':['name',_0xc8a5('0x1a')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x247b=['name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','../../config/logger','bluebird','request-promise','path','rimraf','define','Disposition','tools_dispositions','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x539caf,_0x84f432){var _0x283ae9=function(_0x2ea4b6){while(--_0x2ea4b6){_0x539caf['push'](_0x539caf['shift']());}};_0x283ae9(++_0x84f432);}(_0x247b,0xe2));var _0xb247=function(_0x59b6cd,_0x132d2c){_0x59b6cd=_0x59b6cd-0x0;var _0x15e3ba=_0x247b[_0x59b6cd];return _0x15e3ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb247('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb247('0x1'));var rp=require(_0xb247('0x2'));var fs=require('fs');var path=require(_0xb247('0x3'));var rimraf=require(_0xb247('0x4'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module['exports']=function(_0x1a2390,_0x3cddeb){return _0x1a2390[_0xb247('0x5')](_0xb247('0x6'),attributes,{'tableName':_0xb247('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb247('0x8'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0xb247('0x8'),_0xb247('0x9')]},{'unique':!![],'name':_0xb247('0xa'),'fields':[_0xb247('0x8'),_0xb247('0xb')]},{'unique':!![],'name':_0xb247('0xc'),'fields':[_0xb247('0x8'),_0xb247('0xd')]},{'unique':!![],'name':_0xb247('0xe'),'fields':[_0xb247('0x8'),_0xb247('0xf')]},{'unique':!![],'name':_0xb247('0x10'),'fields':[_0xb247('0x8'),_0xb247('0x11')]},{'unique':!![],'name':_0xb247('0x12'),'fields':[_0xb247('0x8'),_0xb247('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e776644..d3f7ff1 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x54e9f8,_0x25fde0){var _0x4a63a5=function(_0x15e64d){while(--_0x15e64d){_0x54e9f8['push'](_0x54e9f8['shift']());}};_0x4a63a5(++_0x25fde0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20e827,_0x2200d0){var _0x96177a=function(_0x15113e){while(--_0x15113e){_0x20e827['push'](_0x20e827['shift']());}};_0x96177a(++_0x2200d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index f81c08d..d64bfd2 100644 --- a/server/api/disposition/index.js +++ b/server/api/disposition/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84c5=['express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','util','path'];(function(_0x984ae5,_0xd2220c){var _0x32d055=function(_0x4e62f7){while(--_0x4e62f7){_0x984ae5['push'](_0x984ae5['shift']());}};_0x32d055(++_0xd2220c);}(_0x84c5,0x1cc));var _0x584c=function(_0x857b30,_0x2092e8){_0x857b30=_0x857b30-0x0;var _0x3f8924=_0x84c5[_0x857b30];return _0x3f8924;};'use strict';var multer=require('multer');var util=require(_0x584c('0x0'));var path=require(_0x584c('0x1'));var timeout=require('connect-timeout');var express=require(_0x584c('0x2'));var router=express['Router']();var fs_extra=require(_0x584c('0x3'));var auth=require(_0x584c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x584c('0x5')]('/',auth['isAuthenticated'](),controller[_0x584c('0x6')]);router['get'](_0x584c('0x7'),auth[_0x584c('0x8')](),controller['show']);router['post']('/',auth[_0x584c('0x8')](),controller[_0x584c('0x9')]);router[_0x584c('0xa')](_0x584c('0x7'),auth['isAuthenticated'](),controller[_0x584c('0xb')]);router[_0x584c('0xc')]('/:id',auth[_0x584c('0x8')](),controller[_0x584c('0xd')]);module['exports']=router; \ No newline at end of file +var _0xc893=['path','express','fs-extra','../../components/interaction/service','./disposition.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer'];(function(_0x169ab2,_0x362958){var _0x2f10e8=function(_0x411591){while(--_0x411591){_0x169ab2['push'](_0x169ab2['shift']());}};_0x2f10e8(++_0x362958);}(_0xc893,0x1bf));var _0x3c89=function(_0x4a310d,_0x50a7fc){_0x4a310d=_0x4a310d-0x0;var _0x139554=_0xc893[_0x4a310d];return _0x139554;};'use strict';var multer=require(_0x3c89('0x0'));var util=require('util');var path=require(_0x3c89('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c89('0x2'));var router=express['Router']();var fs_extra=require(_0x3c89('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3c89('0x4'));var config=require('../../config/environment');var controller=require(_0x3c89('0x5'));router[_0x3c89('0x6')]('/',auth['isAuthenticated'](),controller[_0x3c89('0x7')]);router[_0x3c89('0x6')](_0x3c89('0x8'),auth[_0x3c89('0x9')](),controller[_0x3c89('0xa')]);router['post']('/',auth[_0x3c89('0x9')](),controller[_0x3c89('0xb')]);router[_0x3c89('0xc')](_0x3c89('0x8'),auth[_0x3c89('0x9')](),controller[_0x3c89('0xd')]);router[_0x3c89('0xe')]('/:id',auth[_0x3c89('0x9')](),controller[_0x3c89('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e8284f4..d942960 100644 --- a/server/api/faxAccount/faxAccount.attributes.js +++ b/server/api/faxAccount/faxAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c72=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x1bd5f7,_0x3a3e1d){var _0x309d5b=function(_0x3a14a5){while(--_0x3a14a5){_0x1bd5f7['push'](_0x1bd5f7['shift']());}};_0x309d5b(++_0x3a3e1d);}(_0x9c72,0x193));var _0x29c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c72[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x29c7('0x0'));module[_0x29c7('0x1')]={'name':{'type':Sequelize[_0x29c7('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x29c7('0x3')](_0x29c7('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x29c7('0x2')],'defaultValue':_0x29c7('0x5')},'localstationid':{'type':Sequelize[_0x29c7('0x2')],'unique':_0x29c7('0x6')},'minrate':{'type':Sequelize[_0x29c7('0x3')](_0x29c7('0x7'),_0x29c7('0x8'),_0x29c7('0x9'),_0x29c7('0xa'),_0x29c7('0xb'),_0x29c7('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x29c7('0x3')]('2400',_0x29c7('0x8'),'7200',_0x29c7('0xa'),_0x29c7('0xb'),_0x29c7('0xc')),'defaultValue':_0x29c7('0xc')},'modem':{'type':Sequelize[_0x29c7('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x29c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x29c7('0xe'),_0x29c7('0xf'),_0x29c7('0x10'),'KHOMP'),'defaultValue':_0x29c7('0xe')},'key':{'type':Sequelize[_0x29c7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x29c7('0x11')],'defaultValue':function(){return _0x29c7('0x12');}},'notificationSound':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x29c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29c7('0x13')],'defaultValue':![],'comment':_0x29c7('0x14'),'set':function(_0x2ce1aa){if(!_0x2ce1aa)this[_0x29c7('0x15')](_0x29c7('0x16'),null);this[_0x29c7('0x15')](_0x29c7('0x17'),_0x2ce1aa);}}}; \ No newline at end of file +var _0xc8fb=['SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc8fb,0x169));var _0xbc8f=function(_0xe2e5,_0x23b31d){_0xe2e5=_0xe2e5-0x0;var _0x5005d2=_0xc8fb[_0xe2e5];return _0x5005d2;};'use strict';var Sequelize=require(_0xbc8f('0x0'));module[_0xbc8f('0x1')]={'name':{'type':Sequelize[_0xbc8f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xbc8f('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xbc8f('0x2')],'defaultValue':_0xbc8f('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xbc8f('0x5')},'minrate':{'type':Sequelize[_0xbc8f('0x3')]('2400',_0xbc8f('0x6'),_0xbc8f('0x7'),_0xbc8f('0x8'),_0xbc8f('0x9'),_0xbc8f('0xa')),'defaultValue':_0xbc8f('0x6')},'maxrate':{'type':Sequelize[_0xbc8f('0x3')](_0xbc8f('0xb'),_0xbc8f('0x6'),_0xbc8f('0x7'),_0xbc8f('0x8'),_0xbc8f('0x9'),'14400'),'defaultValue':_0xbc8f('0xa')},'modem':{'type':Sequelize[_0xbc8f('0x2')],'defaultValue':_0xbc8f('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbc8f('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbc8f('0x3')](_0xbc8f('0xe'),_0xbc8f('0xf'),_0xbc8f('0x10'),_0xbc8f('0x11')),'defaultValue':_0xbc8f('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbc8f('0x12')],'defaultValue':function(){return _0xbc8f('0x13');}},'notificationSound':{'type':Sequelize[_0xbc8f('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbc8f('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbc8f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbc8f('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc8f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbc8f('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc8f('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc8f('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xbc8f('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xbc8f('0x14')],'defaultValue':![],'comment':_0xbc8f('0x16'),'set':function(_0x42fe62){if(!_0x42fe62)this[_0xbc8f('0x17')]('mandatoryDispositionPauseId',null);this[_0xbc8f('0x17')](_0xbc8f('0x18'),_0x42fe62);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9c7e2be..405735f 100644 --- a/server/api/faxAccount/faxAccount.controller.js +++ b/server/api/faxAccount/faxAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc300=['\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','FaxAccounts','destroy','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','show','params','Pause','intersection','length','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','fullname','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','path','from'];(function(_0xc135dd,_0x1712fd){var _0x5a0604=function(_0x5b0d4b){while(--_0x5b0d4b){_0xc135dd['push'](_0xc135dd['shift']());}};_0x5a0604(++_0x1712fd);}(_0xc300,0x198));var _0x0c30=function(_0x1f0417,_0x21e933){_0x1f0417=_0x1f0417-0x0;var _0x132a3d=_0xc300[_0x1f0417];return _0x132a3d;};'use strict';var emlformat=require(_0x0c30('0x0'));var rimraf=require(_0x0c30('0x1'));var zipdir=require(_0x0c30('0x2'));var jsonpatch=require(_0x0c30('0x3'));var rp=require(_0x0c30('0x4'));var moment=require(_0x0c30('0x5'));var BPromise=require(_0x0c30('0x6'));var Mustache=require(_0x0c30('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0c30('0x8'));var ejs=require(_0x0c30('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0c30('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c30('0xb'));var toCsv=require(_0x0c30('0x8'));var querystring=require(_0x0c30('0xc'));var Papa=require(_0x0c30('0xd'));var Redis=require(_0x0c30('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0c30('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c30('0x10'));var logger=require('../../config/logger')(_0x0c30('0x11'));var utils=require(_0x0c30('0x12'));var config=require(_0x0c30('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c30('0x14'))['db'];config[_0x0c30('0x15')]=_[_0x0c30('0x16')](config[_0x0c30('0x15')],{'host':_0x0c30('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0x0c30('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0c30('0x19')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c59e3,_0x5025ee,_0x485304,_0x3915cb){return new BPromise(function(_0x17d0aa,_0x109c7a){var _0x2cfab0=_0x3915cb||client;return _0x2cfab0[_0x0c30('0x1a')](_0x4c59e3,_0x485304)['then'](function(_0x3cc340){logger[_0x0c30('0x1b')](_0x0c30('0x1c'),_0x5025ee,'request\x20sent');logger[_0x0c30('0x1d')](_0x0c30('0x1e'),_0x5025ee,_0x0c30('0x1f'),JSON[_0x0c30('0x20')](_0x3cc340));if(_0x3cc340[_0x0c30('0x21')]){if(_0x3cc340[_0x0c30('0x21')][_0x0c30('0x22')]===0x1f4){logger[_0x0c30('0x21')]('FaxAccount,\x20%s,\x20%s',_0x5025ee,_0x3cc340[_0x0c30('0x21')][_0x0c30('0x23')]);return _0x109c7a(_0x3cc340[_0x0c30('0x21')]['message']);}logger[_0x0c30('0x21')](_0x0c30('0x1c'),_0x5025ee,_0x3cc340['error'][_0x0c30('0x23')]);return _0x17d0aa(_0x3cc340['error'][_0x0c30('0x23')]);}else{logger[_0x0c30('0x1b')](_0x0c30('0x1c'),_0x5025ee,_0x0c30('0x1f'));_0x17d0aa(_0x3cc340[_0x0c30('0x24')]['message']);}})[_0x0c30('0x25')](function(_0xd568cf){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5025ee,_0xd568cf);_0x109c7a(_0xd568cf);});});}function respondWithStatusCode(_0x9d8dee,_0x39232f){_0x39232f=_0x39232f||0xcc;return function(_0x4a3e18){if(_0x4a3e18){return _0x9d8dee[_0x0c30('0x26')](_0x39232f);}return _0x9d8dee[_0x0c30('0x27')](_0x39232f)[_0x0c30('0x28')]();};}function respondWithResult(_0x2d3e05,_0x31c350){_0x31c350=_0x31c350||0xc8;return function(_0x27e1d5){if(_0x27e1d5){return _0x2d3e05[_0x0c30('0x27')](_0x31c350)[_0x0c30('0x29')](_0x27e1d5);}};}function respondWithFilteredResult(_0x471fdc,_0x3cda20){return function(_0x3aaf32){if(_0x3aaf32){var _0xfa687f=typeof _0x3cda20[_0x0c30('0x2a')]==='undefined'&&typeof _0x3cda20['limit']===_0x0c30('0x2b');var _0x9696b6=_0x3aaf32[_0x0c30('0x2c')];var _0x23698b=_0xfa687f?0x0:_0x3cda20[_0x0c30('0x2a')];var _0x55a824=_0xfa687f?_0x3aaf32['count']:_0x3cda20['offset']+_0x3cda20[_0x0c30('0x2d')];var _0x1b9367;if(_0x55a824>=_0x9696b6){_0x55a824=_0x9696b6;_0x1b9367=0xc8;}else{_0x1b9367=0xce;}_0x471fdc[_0x0c30('0x27')](_0x1b9367);return _0x471fdc[_0x0c30('0x2e')](_0x0c30('0x2f'),_0x23698b+'-'+_0x55a824+'/'+_0x9696b6)[_0x0c30('0x29')](_0x3aaf32);}return null;};}function patchUpdates(_0x3534eb){return function(_0x42ef6b){try{jsonpatch['apply'](_0x42ef6b,_0x3534eb,!![]);}catch(_0x2f3f6e){return BPromise[_0x0c30('0x30')](_0x2f3f6e);}return _0x42ef6b[_0x0c30('0x31')]();};}function saveUpdates(_0x4967f7,_0x5cad74){return function(_0x2b9863){if(_0x2b9863){return _0x2b9863[_0x0c30('0x32')](_0x4967f7)['then'](function(_0x11f945){return _0x11f945;});}return null;};}function removeEntity(_0x2ea7dc,_0x3abf49){return function(_0x6786c5){if(_0x6786c5){return _0x6786c5['destroy']()[_0x0c30('0x33')](function(){var _0x2622c2=_0x6786c5[_0x0c30('0x34')]({'plain':!![]});var _0x4680f4=_0x0c30('0x35');return db['UserProfileResource'][_0x0c30('0x36')]({'where':{'type':_0x4680f4,'resourceId':_0x2622c2['id']}})[_0x0c30('0x33')](function(){return _0x6786c5;});})['then'](function(){_0x2ea7dc[_0x0c30('0x27')](0xcc)[_0x0c30('0x28')]();});}};}function handleEntityNotFound(_0x5bc94f,_0xec0e63){return function(_0x4d5a6c){if(!_0x4d5a6c){_0x5bc94f[_0x0c30('0x26')](0x194);}return _0x4d5a6c;};}function handleError(_0x3f0c99,_0x4a580c){_0x4a580c=_0x4a580c||0x1f4;return function(_0x27e06b){logger[_0x0c30('0x21')](_0x27e06b['stack']);if(_0x27e06b[_0x0c30('0x37')]){delete _0x27e06b[_0x0c30('0x37')];}_0x3f0c99[_0x0c30('0x27')](_0x4a580c)[_0x0c30('0x38')](_0x27e06b);};}exports[_0x0c30('0x39')]=function(_0x5a9d4d,_0x2cd700){var _0x26793f={'include':[{'model':db['Pause'],'as':_0x0c30('0x3a')}]},_0x348acf={},_0x91bf6a={'count':0x0,'rows':[]};var _0x29c61e=_[_0x0c30('0x3b')](db[_0x0c30('0x3c')][_0x0c30('0x3d')],function(_0xa01891){return{'name':_0xa01891[_0x0c30('0x3e')],'type':_0xa01891[_0x0c30('0x3f')]['key']};});_0x348acf[_0x0c30('0x40')]=_[_0x0c30('0x3b')](_0x29c61e,'name');_0x348acf[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5a9d4d[_0x0c30('0x41')]);_0x348acf['filters']=_['intersection'](_0x348acf['model'],_0x348acf[_0x0c30('0x41')]);_0x26793f[_0x0c30('0x43')]=_['intersection'](_0x348acf['model'],qs[_0x0c30('0x44')](_0x5a9d4d['query']['fields']));_0x26793f['attributes']=_0x26793f['attributes']['length']?_0x26793f[_0x0c30('0x43')]:_0x348acf[_0x0c30('0x40')];if(!_0x5a9d4d[_0x0c30('0x41')][_0x0c30('0x45')]('nolimit')){_0x26793f['limit']=qs[_0x0c30('0x2d')](_0x5a9d4d['query']['limit']);_0x26793f[_0x0c30('0x2a')]=qs['offset'](_0x5a9d4d['query']['offset']);}_0x26793f[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5a9d4d['query'][_0x0c30('0x47')]);_0x26793f[_0x0c30('0x48')]=qs['filters'](_['pick'](_0x5a9d4d['query'],_0x348acf[_0x0c30('0x49')]),_0x29c61e);if(_0x5a9d4d['query'][_0x0c30('0x4a')]){_0x26793f[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x26793f[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x29c61e,function(_0xd6ff6a){if(_0xd6ff6a[_0x0c30('0x3f')]!=='VIRTUAL'){var _0xbe285b={};_0xbe285b[_0xd6ff6a[_0x0c30('0x37')]]={'$like':'%'+_0x5a9d4d[_0x0c30('0x41')]['filter']+'%'};return _0xbe285b;}})});}_0x26793f=_[_0x0c30('0x4b')]({},_0x26793f,_0x5a9d4d['options']);var _0x528fcc={'where':_0x26793f[_0x0c30('0x48')]};return db[_0x0c30('0x3c')][_0x0c30('0x2c')](_0x528fcc)['then'](function(_0x138c4d){_0x91bf6a[_0x0c30('0x2c')]=_0x138c4d;if(_0x5a9d4d[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x26793f[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0x3c')][_0x0c30('0x4e')](_0x26793f);})[_0x0c30('0x33')](function(_0x1080e7){_0x91bf6a[_0x0c30('0x4f')]=_0x1080e7;return _0x91bf6a;})[_0x0c30('0x33')](respondWithFilteredResult(_0x2cd700,_0x26793f))['catch'](handleError(_0x2cd700,null));};exports[_0x0c30('0x50')]=function(_0x29aa20,_0x57495c){var _0x159ec={'raw':![],'where':{'id':_0x29aa20[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0x52')],'as':_0x0c30('0x3a')}]},_0x57098a={};_0x57098a[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x3c')]['rawAttributes']);_0x57098a[_0x0c30('0x41')]=_['keys'](_0x29aa20[_0x0c30('0x41')]);_0x57098a[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0x57098a[_0x0c30('0x40')],_0x57098a[_0x0c30('0x41')]);_0x159ec[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x57098a[_0x0c30('0x40')],qs['fields'](_0x29aa20['query'][_0x0c30('0x44')]));_0x159ec[_0x0c30('0x43')]=_0x159ec['attributes'][_0x0c30('0x54')]?_0x159ec[_0x0c30('0x43')]:_0x57098a[_0x0c30('0x40')];if(_0x29aa20['query']['includeAll']){_0x159ec[_0x0c30('0x4d')]=[{'all':!![]}];}_0x159ec=_[_0x0c30('0x4b')]({},_0x159ec,_0x29aa20[_0x0c30('0x55')]);return db[_0x0c30('0x3c')][_0x0c30('0x56')](_0x159ec)[_0x0c30('0x33')](handleEntityNotFound(_0x57495c,null))['then'](respondWithResult(_0x57495c,null))[_0x0c30('0x25')](handleError(_0x57495c,null));};exports['create']=function(_0x31ede4,_0x3c1686){return db[_0x0c30('0x3c')][_0x0c30('0x57')](_0x31ede4[_0x0c30('0x58')],{})[_0x0c30('0x33')](function(_0x4f46d6){var _0x11d9cb=_0x31ede4['user'][_0x0c30('0x34')]({'plain':!![]});if(!_0x11d9cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11d9cb[_0x0c30('0x59')]===_0x0c30('0x5a')){var _0x5b955b=_0x4f46d6['get']({'plain':!![]});var _0x2c347f='FaxAccounts';return db[_0x0c30('0x5b')][_0x0c30('0x56')]({'where':{'name':_0x2c347f,'userProfileId':_0x11d9cb[_0x0c30('0x5c')]},'raw':!![]})[_0x0c30('0x33')](function(_0x5655b2){if(_0x5655b2&&_0x5655b2[_0x0c30('0x5d')]===0x0){return db[_0x0c30('0x5e')][_0x0c30('0x57')]({'name':_0x5b955b[_0x0c30('0x37')],'resourceId':_0x5b955b['id'],'type':_0x5655b2[_0x0c30('0x37')],'sectionId':_0x5655b2['id']},{})['then'](function(){return _0x4f46d6;});}else{return _0x4f46d6;}})['catch'](function(_0x4ae5db){logger[_0x0c30('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ae5db);throw _0x4ae5db;});}return _0x4f46d6;})[_0x0c30('0x33')](respondWithResult(_0x3c1686,0xc9))[_0x0c30('0x25')](handleError(_0x3c1686,null));};exports[_0x0c30('0x32')]=function(_0x1e478b,_0x11180){if(_0x1e478b[_0x0c30('0x58')]['id']){delete _0x1e478b[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x1e478b[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0x52')],'as':'mandatoryDispositionPause'}]})[_0x0c30('0x33')](handleEntityNotFound(_0x11180,null))[_0x0c30('0x33')](saveUpdates(_0x1e478b['body'],null))[_0x0c30('0x33')](respondWithResult(_0x11180,null))[_0x0c30('0x25')](handleError(_0x11180,null));};exports[_0x0c30('0x36')]=function(_0x4b252a,_0x56c74f){return db['FaxAccount'][_0x0c30('0x56')]({'where':{'id':_0x4b252a['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x56c74f,null))[_0x0c30('0x33')](removeEntity(_0x56c74f,null))[_0x0c30('0x25')](handleError(_0x56c74f,null));};exports[_0x0c30('0x5f')]=function(_0xc1b42e,_0x3e0137){return db['FaxAccount'][_0x0c30('0x5f')]()['then'](respondWithResult(_0x3e0137,null))['catch'](handleError(_0x3e0137,null));};exports[_0x0c30('0x60')]=function(_0x33b27b,_0x388d38,_0x2c4595){if(_0x33b27b['body']['id']){delete _0x33b27b[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')]['find']({'where':{'id':_0x33b27b[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x388d38,null))[_0x0c30('0x33')](function(_0x1d6326){if(_0x1d6326){_0x33b27b[_0x0c30('0x58')][_0x0c30('0x61')]=_0x1d6326['id'];return db[_0x0c30('0x62')][_0x0c30('0x57')](_0x33b27b[_0x0c30('0x58')]);}})[_0x0c30('0x33')](respondWithResult(_0x388d38,null))['catch'](handleError(_0x388d38,null));};exports[_0x0c30('0x63')]=function(_0x26fbbc,_0x5dab2b,_0x213f46){var _0x186185={'raw':![],'where':{}};var _0x10aaf0={};var _0x53e773={'count':0x0,'rows':[]};return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x26fbbc[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x5dab2b,null))[_0x0c30('0x33')](function(_0x3adb91){if(_0x3adb91){_0x10aaf0['model']=_['keys'](db['Disposition'][_0x0c30('0x3d')]);_0x10aaf0['query']=_[_0x0c30('0x42')](_0x26fbbc[_0x0c30('0x41')]);_0x10aaf0[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0x10aaf0['model'],_0x10aaf0[_0x0c30('0x41')]);_0x186185['attributes']=_[_0x0c30('0x53')](_0x10aaf0[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x44')]));_0x186185[_0x0c30('0x43')]=_0x186185[_0x0c30('0x43')]['length']?_0x186185[_0x0c30('0x43')]:_0x10aaf0[_0x0c30('0x40')];if(!_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x186185[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x26fbbc['query'][_0x0c30('0x2d')]);_0x186185[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x186185['order']=qs[_0x0c30('0x47')](_0x26fbbc[_0x0c30('0x41')]['sort']);_0x186185['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x26fbbc[_0x0c30('0x41')],_0x10aaf0['filters']));_0x186185[_0x0c30('0x48')]['FaxAccountId']=_0x3adb91['id'];if(_0x26fbbc[_0x0c30('0x41')]['filter']){_0x186185[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x186185[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x186185[_0x0c30('0x43')],function(_0x43a591){var _0x3cd7da={};_0x3cd7da[_0x43a591]={'$like':'%'+_0x26fbbc['query'][_0x0c30('0x4a')]+'%'};return _0x3cd7da;})});}_0x186185=_[_0x0c30('0x4b')]({},_0x186185,_0x26fbbc[_0x0c30('0x55')]);return db[_0x0c30('0x62')]['count']({'where':_0x186185[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x15ef06){_0x53e773['count']=_0x15ef06;if(_0x26fbbc[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x186185[_0x0c30('0x4d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x186185);})[_0x0c30('0x33')](function(_0x568e26){_0x53e773[_0x0c30('0x4f')]=_0x568e26;return _0x53e773;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x5dab2b,_0x186185))['catch'](handleError(_0x5dab2b,null));};exports['removeDispositions']=function(_0xec23be,_0xc694fe,_0x139a04){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0xec23be[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0xc694fe,null))['then'](function(_0x4eed3b){if(_0x4eed3b){return _0x4eed3b[_0x0c30('0x67')](_0xec23be[_0x0c30('0x41')][_0x0c30('0x68')]);}})[_0x0c30('0x33')](respondWithStatusCode(_0xc694fe,null))[_0x0c30('0x25')](handleError(_0xc694fe,null));};exports[_0x0c30('0x69')]=function(_0x39494e,_0x3fbeda,_0x212b1e){if(_0x39494e['body']['id']){delete _0x39494e[_0x0c30('0x58')]['id'];}return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x39494e['params']['id']}})['then'](handleEntityNotFound(_0x3fbeda,null))[_0x0c30('0x33')](function(_0x188135){if(_0x188135){_0x39494e['body']['FaxAccountId']=_0x188135['id'];return db[_0x0c30('0x6a')]['create'](_0x39494e[_0x0c30('0x58')]);}})[_0x0c30('0x33')](respondWithResult(_0x3fbeda,null))[_0x0c30('0x25')](handleError(_0x3fbeda,null));};exports[_0x0c30('0x6b')]=function(_0x1e9a2b,_0x3d3736,_0x5df8ee){var _0x4220d1={'raw':![],'where':{}};var _0xa0b192={};var _0x5c1685={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0c30('0x64')]({'where':{'id':_0x1e9a2b[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x3d3736,null))[_0x0c30('0x33')](function(_0x54d50e){if(_0x54d50e){_0xa0b192[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x6a')][_0x0c30('0x3d')]);_0xa0b192[_0x0c30('0x41')]=_['keys'](_0x1e9a2b[_0x0c30('0x41')]);_0xa0b192[_0x0c30('0x49')]=_[_0x0c30('0x53')](_0xa0b192[_0x0c30('0x40')],_0xa0b192[_0x0c30('0x41')]);_0x4220d1[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0xa0b192[_0x0c30('0x40')],qs['fields'](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x44')]));_0x4220d1[_0x0c30('0x43')]=_0x4220d1[_0x0c30('0x43')][_0x0c30('0x54')]?_0x4220d1[_0x0c30('0x43')]:_0xa0b192[_0x0c30('0x40')];if(!_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x4220d1[_0x0c30('0x2d')]=qs['limit'](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x2d')]);_0x4220d1[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x1e9a2b[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x4220d1[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x1e9a2b['query'][_0x0c30('0x47')]);_0x4220d1[_0x0c30('0x48')]=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x1e9a2b[_0x0c30('0x41')],_0xa0b192['filters']));_0x4220d1['where'][_0x0c30('0x61')]=_0x54d50e['id'];if(_0x1e9a2b['query'][_0x0c30('0x4a')]){_0x4220d1[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x4220d1[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x4220d1['attributes'],function(_0x1cc982){var _0x4d366f={};_0x4d366f[_0x1cc982]={'$like':'%'+_0x1e9a2b[_0x0c30('0x41')]['filter']+'%'};return _0x4d366f;})});}_0x4220d1=_[_0x0c30('0x4b')]({},_0x4220d1,_0x1e9a2b[_0x0c30('0x55')]);return db[_0x0c30('0x6a')][_0x0c30('0x2c')]({'where':_0x4220d1[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x35aabc){_0x5c1685[_0x0c30('0x2c')]=_0x35aabc;if(_0x1e9a2b['query'][_0x0c30('0x4c')]){_0x4220d1[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0x6a')][_0x0c30('0x4e')](_0x4220d1);})['then'](function(_0x9b4122){_0x5c1685[_0x0c30('0x4f')]=_0x9b4122;return _0x5c1685;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x3d3736,_0x4220d1))[_0x0c30('0x25')](handleError(_0x3d3736,null));};exports[_0x0c30('0x6c')]=function(_0x2008de,_0x4827f6,_0x55f96a){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x2008de['params']['id']}})['then'](handleEntityNotFound(_0x4827f6,null))[_0x0c30('0x33')](function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c6e6d['removeAnswers'](_0x2008de[_0x0c30('0x41')]['ids']);}})[_0x0c30('0x33')](respondWithStatusCode(_0x4827f6,null))[_0x0c30('0x25')](handleError(_0x4827f6,null));};exports[_0x0c30('0x6d')]=function(_0xc50f39,_0x1bcb31,_0x37f568){return db[_0x0c30('0x6e')][_0x0c30('0x56')]({'where':{'id':_0xc50f39['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x1bcb31,null))[_0x0c30('0x33')](function(_0x29311d){if(_0x29311d){return _0x29311d[_0x0c30('0x6d')](_0xc50f39['body'][_0x0c30('0x68')],_['omit'](_0xc50f39['body'],[_0x0c30('0x68'),'id'])||{});}})[_0x0c30('0x33')](respondWithResult(_0x1bcb31,null))[_0x0c30('0x25')](handleError(_0x1bcb31,null));};exports[_0x0c30('0x6f')]=function(_0x2744fa,_0x551214,_0x1d32d7){var _0x3186cd={'raw':![],'where':{}};var _0xf05893={};var _0x1ec0ba={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0c30('0x64')]({'where':{'id':_0x2744fa[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x551214,null))[_0x0c30('0x33')](function(_0x25ee45){if(_0x25ee45){_0xf05893[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x6e')]['rawAttributes']);_0xf05893['query']=_[_0x0c30('0x42')](_0x2744fa[_0x0c30('0x41')]);_0xf05893['filters']=_['intersection'](_0xf05893[_0x0c30('0x40')],_0xf05893['query']);_0x3186cd[_0x0c30('0x43')]=_['intersection'](_0xf05893[_0x0c30('0x40')],qs['fields'](_0x2744fa['query'][_0x0c30('0x44')]));_0x3186cd[_0x0c30('0x43')]=_0x3186cd[_0x0c30('0x43')][_0x0c30('0x54')]?_0x3186cd[_0x0c30('0x43')]:_0xf05893[_0x0c30('0x40')];if(!_0x2744fa[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x3186cd[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x2744fa[_0x0c30('0x41')][_0x0c30('0x2d')]);_0x3186cd[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x2744fa[_0x0c30('0x41')][_0x0c30('0x2a')]);}_0x3186cd[_0x0c30('0x46')]=qs['sort'](_0x2744fa['query'][_0x0c30('0x47')]);_0x3186cd['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x2744fa['query'],_0xf05893[_0x0c30('0x49')]));_0x3186cd[_0x0c30('0x48')][_0x0c30('0x61')]=_0x25ee45['id'];if(_0x2744fa[_0x0c30('0x41')][_0x0c30('0x4a')]){_0x3186cd[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x3186cd[_0x0c30('0x48')],{'$or':_['map'](_0x3186cd['attributes'],function(_0x59b2b8){var _0x263fd8={};_0x263fd8[_0x59b2b8]={'$like':'%'+_0x2744fa['query']['filter']+'%'};return _0x263fd8;})});}_0x3186cd=_[_0x0c30('0x4b')]({},_0x3186cd,_0x2744fa['options']);return db[_0x0c30('0x6e')][_0x0c30('0x2c')]({'where':_0x3186cd[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x5e4261){_0x1ec0ba[_0x0c30('0x2c')]=_0x5e4261;if(_0x2744fa[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x3186cd[_0x0c30('0x4d')]=[{'model':db[_0x0c30('0x70')],'as':_0x0c30('0x71'),'required':![]},{'model':db[_0x0c30('0x72')],'as':'Owner','attributes':[_0x0c30('0x37'),_0x0c30('0x73'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0c30('0x74'),'attributes':['id',_0x0c30('0x37'),_0x0c30('0x75')],'where':_0x2744fa[_0x0c30('0x41')][_0x0c30('0x76')]?{'id':_0x2744fa[_0x0c30('0x41')]['tag']}:undefined,'required':_0x2744fa['query'][_0x0c30('0x76')]?!![]:![]}];}return db[_0x0c30('0x6e')][_0x0c30('0x4e')](_0x3186cd);})[_0x0c30('0x33')](function(_0x2f8a65){_0x1ec0ba[_0x0c30('0x4f')]=_0x2f8a65;return _0x1ec0ba;});}})['then'](respondWithFilteredResult(_0x551214,_0x3186cd))[_0x0c30('0x25')](handleError(_0x551214,null));};exports[_0x0c30('0x77')]=function(_0x2d1673,_0x5bdb58){var _0x2f9e3a=_0x2d1673['params']['id'];var _0xbcdabe=_0x2d1673[_0x0c30('0x58')];var _0x4b76ca=0xc8;var _0x55aeca=null;return db[_0x0c30('0x78')]['transaction']({'isolationLevel':db['sequelize'][_0x0c30('0x79')][_0x0c30('0x7a')][_0x0c30('0x7b')]},function(_0x44da11){return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x2f9e3a},'transaction':_0x44da11})[_0x0c30('0x33')](function(_0x308ba5){if(_0x308ba5){return db[_0x0c30('0x7c')][_0x0c30('0x36')]({'where':{'FaxAccountId':_0x2f9e3a},'transaction':_0x44da11})[_0x0c30('0x33')](function(){var _0x2e2e9e=_[_0x0c30('0x3b')](_0xbcdabe,function(_0x30a92c){_0x30a92c[_0x0c30('0x61')]=_0x2f9e3a;return _0x30a92c;});return db[_0x0c30('0x7c')][_0x0c30('0x7d')](_0x2e2e9e,{'transaction':_0x44da11});});}else{_0x4b76ca=0x194;_0x55aeca=[];}});})['then'](function(){if(_0x4b76ca!==0x194){return db[_0x0c30('0x7c')][_0x0c30('0x7e')]({'where':{'FaxAccountId':_0x2f9e3a},'order':_0x0c30('0x7f')})['then'](function(_0x58e1d0){_0x55aeca=_0x58e1d0;});}})[_0x0c30('0x25')](function(_0x12699d){_0x4b76ca=0x1f4;logger[_0x0c30('0x21')](_0x12699d[_0x0c30('0x80')]);if(_0x12699d[_0x0c30('0x37')]){delete _0x12699d['name'];}_0x55aeca=_0x12699d;})[_0x0c30('0x81')](function(){if(_0x55aeca===null){_0x5bdb58[_0x0c30('0x26')](_0x4b76ca);}else{if(_0x4b76ca===0x1f4){_0x5bdb58[_0x0c30('0x27')](_0x4b76ca)[_0x0c30('0x38')](_0x55aeca);}else{_0x5bdb58['status'](_0x4b76ca)[_0x0c30('0x29')](_0x55aeca);}}});};exports[_0x0c30('0x82')]=function(_0x5d6dca,_0x4313dd,_0x201295){var _0x53a8df={};var _0x1f0aed={};var _0x249bbb;var _0x1b1848;return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x5d6dca[_0x0c30('0x51')]['id']}})['then'](handleEntityNotFound(_0x4313dd,null))[_0x0c30('0x33')](function(_0xa4c754){if(_0xa4c754){_0x249bbb=_0xa4c754;_0x1f0aed[_0x0c30('0x40')]=_[_0x0c30('0x42')](db['FaxApplication'][_0x0c30('0x3d')]);_0x1f0aed[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5d6dca[_0x0c30('0x41')]);_0x1f0aed[_0x0c30('0x49')]=_['intersection'](_0x1f0aed[_0x0c30('0x40')],_0x1f0aed[_0x0c30('0x41')]);_0x53a8df[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x1f0aed[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x44')]));_0x53a8df[_0x0c30('0x43')]=_0x53a8df[_0x0c30('0x43')][_0x0c30('0x54')]?_0x53a8df['attributes']:_0x1f0aed[_0x0c30('0x40')];_0x53a8df[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x47')]);_0x53a8df['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x5d6dca[_0x0c30('0x41')],_0x1f0aed[_0x0c30('0x49')]));if(_0x5d6dca[_0x0c30('0x41')]['filter']){_0x53a8df[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x53a8df[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x53a8df[_0x0c30('0x43')],function(_0x78f276){var _0x48a5b9={};_0x48a5b9[_0x78f276]={'$like':'%'+_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x4a')]+'%'};return _0x48a5b9;})});}_0x53a8df=_[_0x0c30('0x4b')]({},_0x53a8df,_0x5d6dca[_0x0c30('0x55')]);return _0x249bbb[_0x0c30('0x82')](_0x53a8df);}})[_0x0c30('0x33')](function(_0x121bc1){if(_0x121bc1){_0x1b1848=_0x121bc1[_0x0c30('0x54')];if(!_0x5d6dca[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x53a8df['limit']=qs[_0x0c30('0x2d')](_0x5d6dca['query']['limit']);_0x53a8df[_0x0c30('0x2a')]=qs['offset'](_0x5d6dca[_0x0c30('0x41')]['offset']);}return _0x249bbb[_0x0c30('0x82')](_0x53a8df);}})[_0x0c30('0x33')](function(_0x53a038){if(_0x53a038){return _0x53a038?{'count':_0x1b1848,'rows':_0x53a038}:null;}})[_0x0c30('0x33')](respondWithResult(_0x4313dd,null))[_0x0c30('0x25')](handleError(_0x4313dd,null));};function Extension(_0x3b14ad,_0x23de43,_0x55d726,_0x218e8c){this[_0x0c30('0x83')]=_0x0c30('0x84');this[_0x0c30('0x85')]=_0x3b14ad[_0x0c30('0x86')];this['app']=_0x218e8c;this['type']=_0x0c30('0x87');this[_0x0c30('0x88')]=_0x0c30('0x89');this[_0x0c30('0x61')]=_0x3b14ad['id'];this['priority']=_0x23de43;this[_0x0c30('0x8a')]=_0x55d726;}function createExtensionsReciveFax(_0x7b0410){var _0x5acb0d=0x1;var _0x570098=[];_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'',_0x0c30('0x8c')));_0x5acb0d+=0x1;_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,_0x0c30('0x8d'),_0x0c30('0x8e')));_0x5acb0d+=0x1;for(var _0x36936a in _0x7b0410){if(_0x7b0410[_0x0c30('0x45')](_0x36936a)&&(_0x36936a==='ecm'||_0x36936a===_0x0c30('0x86')||_0x36936a===_0x0c30('0x8f')||_0x36936a===_0x0c30('0x90')||_0x36936a===_0x0c30('0x91')||_0x36936a==='maxrate'||_0x36936a==='minrate'||_0x36936a===_0x0c30('0x92')||_0x36936a==='t38timeout')){_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,_0x0c30('0x93')+_0x36936a+')='+_0x7b0410[_0x36936a],_0x0c30('0x8e')));_0x5acb0d+=0x1;}}_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'6',_0x0c30('0x94')));_0x5acb0d+=0x1;_0x570098[_0x0c30('0x8b')](new Extension(_0x7b0410,_0x5acb0d,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0x0c30('0x95')));_0x5acb0d=0x0;return _0x570098;}exports[_0x0c30('0x96')]=function(_0xb597ad,_0x51ba66,_0x147999){var _0x213bf8;return db[_0x0c30('0x78')][_0x0c30('0x97')](function(_0x4746f9){return db[_0x0c30('0x3c')]['create'](_0xb597ad['body'],{'transaction':_0x4746f9})['then'](function(_0x35d332){_0x213bf8=_0x35d332[_0x0c30('0x34')]({'plain':!![]});return db[_0x0c30('0x98')][_0x0c30('0x7d')](createExtensionsReciveFax(_0x213bf8),{'transaction':_0x4746f9});});})[_0x0c30('0x33')](function(){return _0x213bf8;})['then'](respondWithResult(_0x51ba66,null))[_0x0c30('0x25')](handleError(_0x51ba66,null));};exports['updateAccountApplications']=function(_0x287526,_0x5486f3,_0x43f4e0){var _0x3a18e0;return db[_0x0c30('0x78')]['transaction'](function(_0x5b2f23){return db[_0x0c30('0x3c')][_0x0c30('0x32')](_0x287526[_0x0c30('0x58')],{'where':{'id':_0x287526[_0x0c30('0x58')]['id']},'transaction':_0x5b2f23})[_0x0c30('0x33')](function(_0x262d10){return db[_0x0c30('0x98')][_0x0c30('0x36')]({'where':{'FaxAccountId':_0x287526['body']['id']},'transaction':_0x5b2f23})[_0x0c30('0x33')](function(_0x148483){return db[_0x0c30('0x98')][_0x0c30('0x7d')](createExtensionsReciveFax(_[_0x0c30('0x99')](_0x287526[_0x0c30('0x58')],[_0x0c30('0x9a'),'key',_0x0c30('0x9b'),_0x0c30('0x9c'),_0x0c30('0x9d'),_0x0c30('0x9e')])),{'transaction':_0x5b2f23});});});})[_0x0c30('0x33')](function(){return db['FaxAccount'][_0x0c30('0x9f')](_0x287526[_0x0c30('0x58')]['id']);})['then'](respondWithResult(_0x5486f3,null))[_0x0c30('0x25')](handleError(_0x5486f3,null));};exports[_0x0c30('0xa0')]=function(_0x5e3531,_0x4ec451,_0x3e0b3c){var _0x2dd15b={'raw':!![],'where':{}};var _0x2af0c4={};var _0x5bf596={'count':0x0,'rows':[]};return db[_0x0c30('0x3c')][_0x0c30('0x64')]({'where':{'id':_0x5e3531[_0x0c30('0x51')]['id']}})['then'](handleEntityNotFound(_0x4ec451,null))[_0x0c30('0x33')](function(_0x29e181){if(_0x29e181){_0x2af0c4[_0x0c30('0x40')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x2af0c4[_0x0c30('0x41')]=_[_0x0c30('0x42')](_0x5e3531[_0x0c30('0x41')]);_0x2af0c4['filters']=_[_0x0c30('0x53')](_0x2af0c4['model'],_0x2af0c4[_0x0c30('0x41')]);_0x2dd15b[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x2af0c4[_0x0c30('0x40')],qs[_0x0c30('0x44')](_0x5e3531[_0x0c30('0x41')][_0x0c30('0x44')]));_0x2dd15b[_0x0c30('0x43')]=_0x2dd15b[_0x0c30('0x43')][_0x0c30('0x54')]?_0x2dd15b[_0x0c30('0x43')]:_0x2af0c4['model'];if(!_0x5e3531['query'][_0x0c30('0x45')](_0x0c30('0x65'))){_0x2dd15b['limit']=qs['limit'](_0x5e3531[_0x0c30('0x41')]['limit']);_0x2dd15b[_0x0c30('0x2a')]=qs[_0x0c30('0x2a')](_0x5e3531['query']['offset']);}_0x2dd15b[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x5e3531[_0x0c30('0x41')][_0x0c30('0x47')]);_0x2dd15b['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x5e3531[_0x0c30('0x41')],_0x2af0c4['filters']));_0x2dd15b[_0x0c30('0x48')][_0x0c30('0x61')]=_0x29e181['id'];if(_0x5e3531['query'][_0x0c30('0x4a')]){_0x2dd15b[_0x0c30('0x48')]=_['merge'](_0x2dd15b[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x2dd15b[_0x0c30('0x43')],function(_0x4af1e4){var _0x53bf01={};_0x53bf01[_0x4af1e4]={'$like':'%'+_0x5e3531['query'][_0x0c30('0x4a')]+'%'};return _0x53bf01;})});}if(_0x5e3531['query'][_0x0c30('0xa1')]){var _0x37f5d1=_0x5e3531[_0x0c30('0x41')][_0x0c30('0xa1')]['split'](',');var _0x3ce9b3={};_0x3ce9b3[_0x37f5d1[0x0]]={'$gte':moment(_0x37f5d1[0x1])[_0x0c30('0xa2')](_0x0c30('0xa3'))};_0x2dd15b[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x2dd15b[_0x0c30('0x48')],_0x3ce9b3);}_0x2dd15b=_[_0x0c30('0x4b')]({},_0x2dd15b,_0x5e3531[_0x0c30('0x55')]);return db[_0x0c30('0xa4')][_0x0c30('0x2c')]({'where':_0x2dd15b[_0x0c30('0x48')]})[_0x0c30('0x33')](function(_0x265642){_0x5bf596[_0x0c30('0x2c')]=_0x265642;if(_0x5e3531[_0x0c30('0x41')][_0x0c30('0x4c')]){_0x2dd15b[_0x0c30('0x4d')]=[{'all':!![]}];}return db[_0x0c30('0xa4')]['findAll'](_0x2dd15b);})[_0x0c30('0x33')](function(_0x35f7e2){_0x5bf596[_0x0c30('0x4f')]=_0x35f7e2;return _0x5bf596;});}})[_0x0c30('0x33')](respondWithFilteredResult(_0x4ec451,_0x2dd15b))[_0x0c30('0x25')](handleError(_0x4ec451,null));};exports[_0x0c30('0x38')]=function(_0x284776,_0x19872d,_0x606565){var _0x47b433,_0x17f8f3={},_0x2e3479;if(_0x284776['body']['to']){_0x2e3479=_0x284776['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x284776[_0x0c30('0x51')]['id']},'include':[{'model':db[_0x0c30('0xa5')],'as':_0x0c30('0xa6'),'include':[{'model':db[_0x0c30('0x70')],'as':_0x0c30('0xa7'),'where':{'fax':_0x2e3479},'limit':0x1,'order':[['updatedAt',_0x0c30('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x19872d,null))[_0x0c30('0x33')](function(_0x467902){_0x47b433=_0x467902;if(_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')]&&_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x0c30('0x54')]){for(var _0x279b86=0x0;_0x279b86<_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x0c30('0x54')];_0x279b86+=0x1){_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]={'filename':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86][_0x0c30('0x37')],'id':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]['id'],'path':path[_0x0c30('0xaa')](config[_0x0c30('0xab')],_0x0c30('0xac'),_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][_0x279b86]['basename'])};}}return respondWithRpcPromise(_0x0c30('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0x0c30('0xae')](_0x284776['params']['id'])?undefined:_0x284776[_0x0c30('0x51')]['id'],'path':_[_0x0c30('0xae')](_0x284776['body'][_0x0c30('0xa9')][0x0]['path'])?undefined:_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xaf')],'fax':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x58')]['to'][0x0])?undefined:_0x284776[_0x0c30('0x58')]['to'][0x0]},client9002);})[_0x0c30('0x33')](function(){if(_0x47b433){if(_['isNil'](_0x284776[_0x0c30('0x58')]['from'])){_0x284776[_0x0c30('0x58')][_0x0c30('0xb0')]=util[_0x0c30('0xa2')](_0x0c30('0xb1'),_0x47b433[_0x0c30('0x37')],_0x47b433[_0x0c30('0xb2')]);}if(_0x47b433[_0x0c30('0xa6')]){if(_0x47b433[_0x0c30('0xa6')]['Contacts'][_0x0c30('0x54')]){return _0x47b433['List'][_0x0c30('0xa7')][0x0];}else{return db['CmContact'][_0x0c30('0x57')](_[_0x0c30('0x16')](_0x284776['body'],{'firstName':_0x284776[_0x0c30('0x58')]['to'][0x0],'phone':_0x284776[_0x0c30('0x58')]['to'][0x0],'fax':_0x284776['body']['to'][0x0],'ListId':_0x47b433[_0x0c30('0x9e')]}));}}else{throw new Error(_0x0c30('0xb3'));}}else{throw new Error(_0x0c30('0xb4'));}})[_0x0c30('0x33')](function(_0x44b12b){if(_0x44b12b){return db[_0x0c30('0x6e')]['find']({'where':{'ContactId':_0x44b12b['id'],'closed':![],'FaxAccountId':_0x47b433['id']}})[_0x0c30('0x33')](function(_0x392018){if(_0x392018){return[_0x392018,![]];}return db[_0x0c30('0x6e')]['create']({'UserId':_0x284776[_0x0c30('0x5a')]['id'],'ContactId':_0x44b12b['id'],'FaxAccountId':_0x47b433['id'],'fax':_0x284776[_0x0c30('0x58')]['to'][0x0],'firstMsgDirection':_0x0c30('0xb5'),'Messages':[_['merge'](_0x284776['body'],{'read':![],'body':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0][_0x0c30('0xb6')],'FaxAccountId':_0x47b433['id'],'UserId':_0x284776[_0x0c30('0x5a')]['id'],'ContactId':_0x44b12b['id'],'AttachmentId':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x0c30('0xa4')],'as':'Messages'}]})[_0x0c30('0x33')](function(_0x567158){return[_0x567158,!![]];});});}else{throw new Error(_0x0c30('0xb7'));}})[_0x0c30('0xb8')](function(_0x44605b,_0x1bdb6f){if(_0x1bdb6f){return _0x44605b;}return db[_0x0c30('0xa4')][_0x0c30('0x57')]({'direction':'out','read':![],'body':_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xb6')],'FaxAccountId':_0x47b433['id'],'FaxInteractionId':_0x44605b['id'],'UserId':_0x284776['user']['id'],'ContactId':_0x44605b[_0x0c30('0xb9')],'AttachmentId':_0x284776[_0x0c30('0x58')][_0x0c30('0xa9')][0x0]['id']})['then'](function(_0x4e94a4){_0x44605b[_0x0c30('0xba')]['Messages']=[];_0x44605b[_0x0c30('0xba')][_0x0c30('0xbb')][_0x0c30('0x8b')](_0x4e94a4[_0x0c30('0xba')]);return _0x44605b;});})[_0x0c30('0x33')](function(_0x2906a3){respondWithRpcPromise('SendFax',_0x0c30('0xbc'),{'FaxAccountId':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x51')]['id'])?undefined:_0x284776[_0x0c30('0x51')]['id'],'path':_[_0x0c30('0xae')](_0x284776['body'][_0x0c30('0xa9')][0x0][_0x0c30('0xaf')])?undefined:_0x284776['body']['attachments'][0x0][_0x0c30('0xaf')],'fax':_[_0x0c30('0xae')](_0x284776[_0x0c30('0x58')]['to'][0x0])?undefined:_0x284776[_0x0c30('0x58')]['to'][0x0],'AttachmentId':_0x284776[_0x0c30('0x58')]['attachments'][0x0]['id']},client9002)[_0x0c30('0x33')](function(_0x1ebed3){logger[_0x0c30('0x1b')]('SendFaxRpc,\x20%s',_0x1ebed3);})[_0x0c30('0x25')](function(_0x102ee5){logger['info']('SendFaxRpc,\x20%s',_0x102ee5);});return _0x2906a3;})['then'](respondWithResult(_0x19872d,null))[_0x0c30('0x25')](handleError(_0x19872d,null));};exports['addAgents']=function(_0x40cb26,_0x76152,_0xba7dc6){return db[_0x0c30('0x3c')][_0x0c30('0x56')]({'where':{'id':_0x40cb26['params']['id']}})['then'](handleEntityNotFound(_0x76152,null))[_0x0c30('0x33')](function(_0x344ed7){if(_0x344ed7){return _0x344ed7[_0x0c30('0xbd')](_0x40cb26['body'][_0x0c30('0x68')],_['omit'](_0x40cb26['body'],[_0x0c30('0x68'),'id'])||{})[_0x0c30('0xb8')](function(_0x530a64){for(var _0x5642bb=0x0;_0x5642bb<_0x40cb26[_0x0c30('0x58')][_0x0c30('0x68')][_0x0c30('0x54')];_0x5642bb+=0x1){socket[_0x0c30('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x40cb26[_0x0c30('0x58')][_0x0c30('0x68')][_0x5642bb]),'FaxAccountId':Number(_0x40cb26[_0x0c30('0x51')]['id'])});}return _0x530a64;});}})[_0x0c30('0x33')](respondWithResult(_0x76152,null))['catch'](handleError(_0x76152,null));};exports[_0x0c30('0xbf')]=function(_0x1a3631,_0x2f7a7a,_0x5f1967){return db['FaxAccount'][_0x0c30('0x56')]({'where':{'id':_0x1a3631['params']['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x2f7a7a,null))['then'](function(_0x31c40f){if(_0x31c40f){return _0x31c40f[_0x0c30('0xbf')](_0x1a3631[_0x0c30('0x41')]['ids'])['then'](function(){if(_[_0x0c30('0xc0')](_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')])){for(var _0x5225a2=0x0;_0x5225a2<_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')][_0x0c30('0x54')];_0x5225a2+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x1a3631[_0x0c30('0x41')][_0x0c30('0x68')][_0x5225a2]),'FaxAccountId':Number(_0x1a3631[_0x0c30('0x51')]['id'])});}}else{socket[_0x0c30('0xbe')](_0x0c30('0xc1'),{'UserId':Number(_0x1a3631['query'][_0x0c30('0x68')]),'FaxAccountId':Number(_0x1a3631[_0x0c30('0x51')]['id'])});}});}})[_0x0c30('0x33')](respondWithStatusCode(_0x2f7a7a,null))[_0x0c30('0x25')](handleError(_0x2f7a7a,null));};exports[_0x0c30('0xc2')]=function(_0x2d539f,_0x1bd89c,_0x2c7dc5){var _0x52e282={};var _0x2c047a={};var _0x334d01;var _0x2cc7e9;return db[_0x0c30('0x3c')]['findOne']({'where':{'id':_0x2d539f[_0x0c30('0x51')]['id']}})[_0x0c30('0x33')](handleEntityNotFound(_0x1bd89c,null))[_0x0c30('0x33')](function(_0x409c8a){if(_0x409c8a){_0x334d01=_0x409c8a;_0x2c047a[_0x0c30('0x40')]=_[_0x0c30('0x42')](db[_0x0c30('0x72')][_0x0c30('0x3d')]);_0x2c047a['query']=_['keys'](_0x2d539f[_0x0c30('0x41')]);_0x2c047a['filters']=_[_0x0c30('0x53')](_0x2c047a['model'],_0x2c047a[_0x0c30('0x41')]);_0x52e282[_0x0c30('0x43')]=_[_0x0c30('0x53')](_0x2c047a[_0x0c30('0x40')],qs['fields'](_0x2d539f[_0x0c30('0x41')]['fields']));_0x52e282[_0x0c30('0x43')]=_0x52e282['attributes'][_0x0c30('0x54')]?_0x52e282[_0x0c30('0x43')]:_0x2c047a[_0x0c30('0x40')];_0x52e282[_0x0c30('0x46')]=qs[_0x0c30('0x47')](_0x2d539f[_0x0c30('0x41')][_0x0c30('0x47')]);_0x52e282['where']=qs[_0x0c30('0x49')](_[_0x0c30('0x66')](_0x2d539f[_0x0c30('0x41')],_0x2c047a[_0x0c30('0x49')]));if(_0x2d539f[_0x0c30('0x41')][_0x0c30('0x4a')]){_0x52e282[_0x0c30('0x48')]=_[_0x0c30('0x4b')](_0x52e282[_0x0c30('0x48')],{'$or':_[_0x0c30('0x3b')](_0x52e282['attributes'],function(_0x770345){var _0x782cfd={};_0x782cfd[_0x770345]={'$like':'%'+_0x2d539f[_0x0c30('0x41')][_0x0c30('0x4a')]+'%'};return _0x782cfd;})});}_0x52e282=_[_0x0c30('0x4b')]({},_0x52e282,_0x2d539f[_0x0c30('0x55')]);return _0x334d01[_0x0c30('0xc2')](_0x52e282);}})['then'](function(_0x5bafc8){if(_0x5bafc8){_0x2cc7e9=_0x5bafc8[_0x0c30('0x54')];if(!_0x2d539f[_0x0c30('0x41')][_0x0c30('0x45')](_0x0c30('0x65'))){_0x52e282[_0x0c30('0x2d')]=qs[_0x0c30('0x2d')](_0x2d539f[_0x0c30('0x41')]['limit']);_0x52e282['offset']=qs[_0x0c30('0x2a')](_0x2d539f[_0x0c30('0x41')][_0x0c30('0x2a')]);}return _0x334d01[_0x0c30('0xc2')](_0x52e282);}})[_0x0c30('0x33')](function(_0x344e55){if(_0x344e55){return _0x344e55?{'count':_0x2cc7e9,'rows':_0x344e55}:null;}})['then'](respondWithResult(_0x1bd89c,null))['catch'](handleError(_0x1bd89c,null));}; \ No newline at end of file +var _0x877d=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','FaxAccounts','destroy','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','user','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','body','FaxAccountId','Disposition','getDispositions','findOne','rawAttributes','length','merge','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','fullname','internal','Tag','Tags','tag','addApplications','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','app','system','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','sequelize','updateAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','DESC','attachments','join','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','getAgents','User','eml-format','rimraf','request-promise','bluebird','mustache','util'];(function(_0x3cead4,_0xe3df3e){var _0x2e965f=function(_0x57ac6f){while(--_0x57ac6f){_0x3cead4['push'](_0x3cead4['shift']());}};_0x2e965f(++_0xe3df3e);}(_0x877d,0xc0));var _0xd877=function(_0x268396,_0x864c1c){_0x268396=_0x268396-0x0;var _0x2d7b5d=_0x877d[_0x268396];return _0x2d7b5d;};'use strict';var emlformat=require(_0xd877('0x0'));var rimraf=require(_0xd877('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd877('0x2'));var moment=require('moment');var BPromise=require(_0xd877('0x3'));var Mustache=require(_0xd877('0x4'));var util=require(_0xd877('0x5'));var path=require('path');var sox=require(_0xd877('0x6'));var csv=require(_0xd877('0x7'));var ejs=require(_0xd877('0x8'));var fs=require('fs');var fs_extra=require(_0xd877('0x9'));var _=require('lodash');var squel=require(_0xd877('0xa'));var crypto=require(_0xd877('0xb'));var jsforce=require(_0xd877('0xc'));var deskjs=require(_0xd877('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd877('0xe'));var Redis=require(_0xd877('0xf'));var authService=require(_0xd877('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd877('0x11'));var hardwareService=require(_0xd877('0x12'));var logger=require(_0xd877('0x13'))(_0xd877('0x14'));var utils=require(_0xd877('0x15'));var config=require(_0xd877('0x16'));var licenseUtil=require(_0xd877('0x17'));var db=require(_0xd877('0x18'))['db'];config[_0xd877('0x19')]=_[_0xd877('0x1a')](config['redis'],{'host':_0xd877('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd877('0x19')]));require(_0xd877('0x1c'))['register'](socket);var jayson=require(_0xd877('0x1d'));var client=jayson[_0xd877('0x1e')][_0xd877('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fba08,_0x4dbb00,_0x22a1af,_0xf22e04){return new BPromise(function(_0x1b614a,_0x4a32be){var _0x5d6d1a=_0xf22e04||client;return _0x5d6d1a['request'](_0x1fba08,_0x22a1af)[_0xd877('0x20')](function(_0x1c7bda){logger[_0xd877('0x21')](_0xd877('0x22'),_0x4dbb00,_0xd877('0x23'));logger['debug'](_0xd877('0x24'),_0x4dbb00,_0xd877('0x23'),JSON[_0xd877('0x25')](_0x1c7bda));if(_0x1c7bda['error']){if(_0x1c7bda[_0xd877('0x26')][_0xd877('0x27')]===0x1f4){logger[_0xd877('0x26')](_0xd877('0x22'),_0x4dbb00,_0x1c7bda['error'][_0xd877('0x28')]);return _0x4a32be(_0x1c7bda[_0xd877('0x26')]['message']);}logger['error'](_0xd877('0x22'),_0x4dbb00,_0x1c7bda[_0xd877('0x26')][_0xd877('0x28')]);return _0x1b614a(_0x1c7bda[_0xd877('0x26')][_0xd877('0x28')]);}else{logger['info'](_0xd877('0x22'),_0x4dbb00,'request\x20sent');_0x1b614a(_0x1c7bda[_0xd877('0x29')][_0xd877('0x28')]);}})['catch'](function(_0x26f75f){logger[_0xd877('0x26')]('FaxAccount,\x20%s,\x20%s',_0x4dbb00,_0x26f75f);_0x4a32be(_0x26f75f);});});}function respondWithStatusCode(_0x4463fa,_0x1cd927){_0x1cd927=_0x1cd927||0xcc;return function(_0x436560){if(_0x436560){return _0x4463fa[_0xd877('0x2a')](_0x1cd927);}return _0x4463fa[_0xd877('0x2b')](_0x1cd927)['end']();};}function respondWithResult(_0x22dd1c,_0xd43ccb){_0xd43ccb=_0xd43ccb||0xc8;return function(_0x35e95e){if(_0x35e95e){return _0x22dd1c[_0xd877('0x2b')](_0xd43ccb)[_0xd877('0x2c')](_0x35e95e);}};}function respondWithFilteredResult(_0x2053c1,_0x1c208a){return function(_0x8024d){if(_0x8024d){var _0x222d44=typeof _0x1c208a['offset']===_0xd877('0x2d')&&typeof _0x1c208a[_0xd877('0x2e')]===_0xd877('0x2d');var _0x26388b=_0x8024d['count'];var _0x8c24a5=_0x222d44?0x0:_0x1c208a[_0xd877('0x2f')];var _0x15ca2f=_0x222d44?_0x8024d[_0xd877('0x30')]:_0x1c208a[_0xd877('0x2f')]+_0x1c208a['limit'];var _0x5ac653;if(_0x15ca2f>=_0x26388b){_0x15ca2f=_0x26388b;_0x5ac653=0xc8;}else{_0x5ac653=0xce;}_0x2053c1[_0xd877('0x2b')](_0x5ac653);return _0x2053c1['set'](_0xd877('0x31'),_0x8c24a5+'-'+_0x15ca2f+'/'+_0x26388b)[_0xd877('0x2c')](_0x8024d);}return null;};}function patchUpdates(_0x4882c9){return function(_0xc1e9d7){try{jsonpatch[_0xd877('0x32')](_0xc1e9d7,_0x4882c9,!![]);}catch(_0x52b74b){return BPromise[_0xd877('0x33')](_0x52b74b);}return _0xc1e9d7[_0xd877('0x34')]();};}function saveUpdates(_0x15fd7a,_0x32e9d4){return function(_0x3138cb){if(_0x3138cb){return _0x3138cb['update'](_0x15fd7a)['then'](function(_0x5ac958){return _0x5ac958;});}return null;};}function removeEntity(_0x4b5f81,_0x8b8ac4){return function(_0x42f5af){if(_0x42f5af){return _0x42f5af['destroy']()[_0xd877('0x20')](function(){var _0x160555=_0x42f5af['get']({'plain':!![]});var _0x250f0b=_0xd877('0x35');return db['UserProfileResource'][_0xd877('0x36')]({'where':{'type':_0x250f0b,'resourceId':_0x160555['id']}})[_0xd877('0x20')](function(){return _0x42f5af;});})[_0xd877('0x20')](function(){_0x4b5f81[_0xd877('0x2b')](0xcc)[_0xd877('0x37')]();});}};}function handleEntityNotFound(_0x1eee1d,_0x38c42e){return function(_0x314921){if(!_0x314921){_0x1eee1d['sendStatus'](0x194);}return _0x314921;};}function handleError(_0x2fa5d9,_0x5bba42){_0x5bba42=_0x5bba42||0x1f4;return function(_0x2eb1cb){logger[_0xd877('0x26')](_0x2eb1cb[_0xd877('0x38')]);if(_0x2eb1cb[_0xd877('0x39')]){delete _0x2eb1cb[_0xd877('0x39')];}_0x2fa5d9['status'](_0x5bba42)[_0xd877('0x3a')](_0x2eb1cb);};}exports[_0xd877('0x3b')]=function(_0x35e49a,_0x2d1aee){var _0x2c89c7={'include':[{'model':db[_0xd877('0x3c')],'as':_0xd877('0x3d')}]},_0x291d23={},_0x3c4d89={'count':0x0,'rows':[]};var _0x59ff96=_[_0xd877('0x3e')](db[_0xd877('0x3f')]['rawAttributes'],function(_0x3b265f){return{'name':_0x3b265f[_0xd877('0x40')],'type':_0x3b265f['type']['key']};});_0x291d23[_0xd877('0x41')]=_[_0xd877('0x3e')](_0x59ff96,'name');_0x291d23[_0xd877('0x42')]=_[_0xd877('0x43')](_0x35e49a[_0xd877('0x42')]);_0x291d23['filters']=_[_0xd877('0x44')](_0x291d23['model'],_0x291d23['query']);_0x2c89c7[_0xd877('0x45')]=_['intersection'](_0x291d23['model'],qs['fields'](_0x35e49a[_0xd877('0x42')][_0xd877('0x46')]));_0x2c89c7[_0xd877('0x45')]=_0x2c89c7[_0xd877('0x45')]['length']?_0x2c89c7['attributes']:_0x291d23[_0xd877('0x41')];if(!_0x35e49a[_0xd877('0x42')][_0xd877('0x47')](_0xd877('0x48'))){_0x2c89c7['limit']=qs[_0xd877('0x2e')](_0x35e49a['query']['limit']);_0x2c89c7[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x35e49a['query']['offset']);}_0x2c89c7[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x35e49a[_0xd877('0x42')][_0xd877('0x4a')]);_0x2c89c7[_0xd877('0x4b')]=qs['filters'](_[_0xd877('0x4c')](_0x35e49a['query'],_0x291d23[_0xd877('0x4d')]),_0x59ff96);if(_0x35e49a[_0xd877('0x42')][_0xd877('0x4e')]){_0x2c89c7[_0xd877('0x4b')]=_['merge'](_0x2c89c7[_0xd877('0x4b')],{'$or':_[_0xd877('0x3e')](_0x59ff96,function(_0x13acb1){if(_0x13acb1[_0xd877('0x4f')]!==_0xd877('0x50')){var _0x353224={};_0x353224[_0x13acb1['name']]={'$like':'%'+_0x35e49a[_0xd877('0x42')]['filter']+'%'};return _0x353224;}})});}_0x2c89c7=_['merge']({},_0x2c89c7,_0x35e49a[_0xd877('0x51')]);var _0x533f81={'where':_0x2c89c7[_0xd877('0x4b')]};return db[_0xd877('0x3f')][_0xd877('0x30')](_0x533f81)[_0xd877('0x20')](function(_0x30fa77){_0x3c4d89[_0xd877('0x30')]=_0x30fa77;if(_0x35e49a[_0xd877('0x42')][_0xd877('0x52')]){_0x2c89c7[_0xd877('0x53')]=[{'all':!![]}];}return db[_0xd877('0x3f')][_0xd877('0x54')](_0x2c89c7);})[_0xd877('0x20')](function(_0x561889){_0x3c4d89[_0xd877('0x55')]=_0x561889;return _0x3c4d89;})[_0xd877('0x20')](respondWithFilteredResult(_0x2d1aee,_0x2c89c7))['catch'](handleError(_0x2d1aee,null));};exports['show']=function(_0x157ccc,_0x36d845){var _0x1e21ac={'raw':![],'where':{'id':_0x157ccc[_0xd877('0x56')]['id']},'include':[{'model':db[_0xd877('0x3c')],'as':_0xd877('0x3d')}]},_0x2c1b78={};_0x2c1b78[_0xd877('0x41')]=_[_0xd877('0x43')](db[_0xd877('0x3f')]['rawAttributes']);_0x2c1b78['query']=_[_0xd877('0x43')](_0x157ccc[_0xd877('0x42')]);_0x2c1b78[_0xd877('0x4d')]=_['intersection'](_0x2c1b78[_0xd877('0x41')],_0x2c1b78[_0xd877('0x42')]);_0x1e21ac[_0xd877('0x45')]=_[_0xd877('0x44')](_0x2c1b78['model'],qs[_0xd877('0x46')](_0x157ccc['query']['fields']));_0x1e21ac[_0xd877('0x45')]=_0x1e21ac[_0xd877('0x45')]['length']?_0x1e21ac[_0xd877('0x45')]:_0x2c1b78['model'];if(_0x157ccc[_0xd877('0x42')][_0xd877('0x52')]){_0x1e21ac['include']=[{'all':!![]}];}_0x1e21ac=_['merge']({},_0x1e21ac,_0x157ccc[_0xd877('0x51')]);return db['FaxAccount'][_0xd877('0x57')](_0x1e21ac)[_0xd877('0x20')](handleEntityNotFound(_0x36d845,null))[_0xd877('0x20')](respondWithResult(_0x36d845,null))[_0xd877('0x58')](handleError(_0x36d845,null));};exports[_0xd877('0x59')]=function(_0x1074a4,_0x4ca33f){return db[_0xd877('0x3f')][_0xd877('0x59')](_0x1074a4['body'],{})['then'](function(_0x527e55){var _0x2168f1=_0x1074a4['user']['get']({'plain':!![]});if(!_0x2168f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2168f1['role']===_0xd877('0x5a')){var _0xa98dcc=_0x527e55[_0xd877('0x5b')]({'plain':!![]});var _0x3f2d8e='FaxAccounts';return db['UserProfileSection'][_0xd877('0x57')]({'where':{'name':_0x3f2d8e,'userProfileId':_0x2168f1[_0xd877('0x5c')]},'raw':!![]})[_0xd877('0x20')](function(_0x2b7687){if(_0x2b7687&&_0x2b7687['autoAssociation']===0x0){return db[_0xd877('0x5d')][_0xd877('0x59')]({'name':_0xa98dcc['name'],'resourceId':_0xa98dcc['id'],'type':_0x2b7687[_0xd877('0x39')],'sectionId':_0x2b7687['id']},{})[_0xd877('0x20')](function(){return _0x527e55;});}else{return _0x527e55;}})[_0xd877('0x58')](function(_0x53030b){logger['error'](_0xd877('0x5e'),_0x53030b);throw _0x53030b;});}return _0x527e55;})[_0xd877('0x20')](respondWithResult(_0x4ca33f,0xc9))[_0xd877('0x58')](handleError(_0x4ca33f,null));};exports[_0xd877('0x5f')]=function(_0x1e08e4,_0x563d91){if(_0x1e08e4['body']['id']){delete _0x1e08e4['body']['id'];}return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x1e08e4[_0xd877('0x56')]['id']},'include':[{'model':db[_0xd877('0x3c')],'as':_0xd877('0x3d')}]})[_0xd877('0x20')](handleEntityNotFound(_0x563d91,null))[_0xd877('0x20')](saveUpdates(_0x1e08e4['body'],null))[_0xd877('0x20')](respondWithResult(_0x563d91,null))[_0xd877('0x58')](handleError(_0x563d91,null));};exports[_0xd877('0x36')]=function(_0x7c252c,_0x3ebbe0){return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x7c252c['params']['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x3ebbe0,null))[_0xd877('0x20')](removeEntity(_0x3ebbe0,null))[_0xd877('0x58')](handleError(_0x3ebbe0,null));};exports[_0xd877('0x60')]=function(_0x1680ad,_0x567a3b){return db[_0xd877('0x3f')][_0xd877('0x60')]()[_0xd877('0x20')](respondWithResult(_0x567a3b,null))[_0xd877('0x58')](handleError(_0x567a3b,null));};exports['addDisposition']=function(_0x3e382a,_0x4ae340,_0x475045){if(_0x3e382a[_0xd877('0x61')]['id']){delete _0x3e382a[_0xd877('0x61')]['id'];}return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x3e382a[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x4ae340,null))[_0xd877('0x20')](function(_0x4a1f8e){if(_0x4a1f8e){_0x3e382a[_0xd877('0x61')][_0xd877('0x62')]=_0x4a1f8e['id'];return db[_0xd877('0x63')]['create'](_0x3e382a[_0xd877('0x61')]);}})[_0xd877('0x20')](respondWithResult(_0x4ae340,null))[_0xd877('0x58')](handleError(_0x4ae340,null));};exports[_0xd877('0x64')]=function(_0x413d03,_0x1dd651,_0x696308){var _0x1e6e0a={'raw':![],'where':{}};var _0x1c3a3b={};var _0x2bc49e={'count':0x0,'rows':[]};return db[_0xd877('0x3f')][_0xd877('0x65')]({'where':{'id':_0x413d03[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x1dd651,null))[_0xd877('0x20')](function(_0x551eef){if(_0x551eef){_0x1c3a3b[_0xd877('0x41')]=_['keys'](db[_0xd877('0x63')][_0xd877('0x66')]);_0x1c3a3b[_0xd877('0x42')]=_[_0xd877('0x43')](_0x413d03['query']);_0x1c3a3b[_0xd877('0x4d')]=_['intersection'](_0x1c3a3b['model'],_0x1c3a3b['query']);_0x1e6e0a[_0xd877('0x45')]=_[_0xd877('0x44')](_0x1c3a3b[_0xd877('0x41')],qs[_0xd877('0x46')](_0x413d03[_0xd877('0x42')][_0xd877('0x46')]));_0x1e6e0a[_0xd877('0x45')]=_0x1e6e0a[_0xd877('0x45')][_0xd877('0x67')]?_0x1e6e0a[_0xd877('0x45')]:_0x1c3a3b[_0xd877('0x41')];if(!_0x413d03[_0xd877('0x42')]['hasOwnProperty'](_0xd877('0x48'))){_0x1e6e0a[_0xd877('0x2e')]=qs['limit'](_0x413d03[_0xd877('0x42')][_0xd877('0x2e')]);_0x1e6e0a[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x413d03['query']['offset']);}_0x1e6e0a[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x413d03[_0xd877('0x42')][_0xd877('0x4a')]);_0x1e6e0a[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_[_0xd877('0x4c')](_0x413d03[_0xd877('0x42')],_0x1c3a3b['filters']));_0x1e6e0a[_0xd877('0x4b')][_0xd877('0x62')]=_0x551eef['id'];if(_0x413d03[_0xd877('0x42')][_0xd877('0x4e')]){_0x1e6e0a[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x1e6e0a['where'],{'$or':_[_0xd877('0x3e')](_0x1e6e0a['attributes'],function(_0x4cc625){var _0x3c4abe={};_0x3c4abe[_0x4cc625]={'$like':'%'+_0x413d03[_0xd877('0x42')][_0xd877('0x4e')]+'%'};return _0x3c4abe;})});}_0x1e6e0a=_[_0xd877('0x68')]({},_0x1e6e0a,_0x413d03['options']);return db[_0xd877('0x63')][_0xd877('0x30')]({'where':_0x1e6e0a['where']})[_0xd877('0x20')](function(_0x37e966){_0x2bc49e['count']=_0x37e966;if(_0x413d03[_0xd877('0x42')]['includeAll']){_0x1e6e0a[_0xd877('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xd877('0x54')](_0x1e6e0a);})[_0xd877('0x20')](function(_0x596725){_0x2bc49e[_0xd877('0x55')]=_0x596725;return _0x2bc49e;});}})[_0xd877('0x20')](respondWithFilteredResult(_0x1dd651,_0x1e6e0a))[_0xd877('0x58')](handleError(_0x1dd651,null));};exports[_0xd877('0x69')]=function(_0x400f6e,_0x396a94,_0x626d51){return db[_0xd877('0x3f')]['find']({'where':{'id':_0x400f6e[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x396a94,null))[_0xd877('0x20')](function(_0x48510a){if(_0x48510a){return _0x48510a[_0xd877('0x69')](_0x400f6e[_0xd877('0x42')][_0xd877('0x6a')]);}})['then'](respondWithStatusCode(_0x396a94,null))[_0xd877('0x58')](handleError(_0x396a94,null));};exports[_0xd877('0x6b')]=function(_0x59ddd6,_0x1b3f7d,_0x3df03e){if(_0x59ddd6[_0xd877('0x61')]['id']){delete _0x59ddd6[_0xd877('0x61')]['id'];}return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x59ddd6[_0xd877('0x56')]['id']}})['then'](handleEntityNotFound(_0x1b3f7d,null))[_0xd877('0x20')](function(_0x332737){if(_0x332737){_0x59ddd6[_0xd877('0x61')][_0xd877('0x62')]=_0x332737['id'];return db[_0xd877('0x6c')][_0xd877('0x59')](_0x59ddd6[_0xd877('0x61')]);}})['then'](respondWithResult(_0x1b3f7d,null))[_0xd877('0x58')](handleError(_0x1b3f7d,null));};exports[_0xd877('0x6d')]=function(_0x445b56,_0x10121f,_0xf5f637){var _0x49fd06={'raw':![],'where':{}};var _0x45b3e2={};var _0x7f8367={'count':0x0,'rows':[]};return db[_0xd877('0x3f')][_0xd877('0x65')]({'where':{'id':_0x445b56[_0xd877('0x56')]['id']}})['then'](handleEntityNotFound(_0x10121f,null))[_0xd877('0x20')](function(_0x215980){if(_0x215980){_0x45b3e2[_0xd877('0x41')]=_[_0xd877('0x43')](db[_0xd877('0x6c')]['rawAttributes']);_0x45b3e2['query']=_[_0xd877('0x43')](_0x445b56[_0xd877('0x42')]);_0x45b3e2['filters']=_[_0xd877('0x44')](_0x45b3e2[_0xd877('0x41')],_0x45b3e2[_0xd877('0x42')]);_0x49fd06[_0xd877('0x45')]=_[_0xd877('0x44')](_0x45b3e2[_0xd877('0x41')],qs[_0xd877('0x46')](_0x445b56[_0xd877('0x42')][_0xd877('0x46')]));_0x49fd06['attributes']=_0x49fd06['attributes']['length']?_0x49fd06[_0xd877('0x45')]:_0x45b3e2[_0xd877('0x41')];if(!_0x445b56['query'][_0xd877('0x47')](_0xd877('0x48'))){_0x49fd06[_0xd877('0x2e')]=qs[_0xd877('0x2e')](_0x445b56[_0xd877('0x42')]['limit']);_0x49fd06['offset']=qs[_0xd877('0x2f')](_0x445b56[_0xd877('0x42')]['offset']);}_0x49fd06[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x445b56['query'][_0xd877('0x4a')]);_0x49fd06[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_[_0xd877('0x4c')](_0x445b56[_0xd877('0x42')],_0x45b3e2['filters']));_0x49fd06[_0xd877('0x4b')][_0xd877('0x62')]=_0x215980['id'];if(_0x445b56[_0xd877('0x42')][_0xd877('0x4e')]){_0x49fd06[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x49fd06[_0xd877('0x4b')],{'$or':_[_0xd877('0x3e')](_0x49fd06[_0xd877('0x45')],function(_0x239727){var _0x59b920={};_0x59b920[_0x239727]={'$like':'%'+_0x445b56[_0xd877('0x42')][_0xd877('0x4e')]+'%'};return _0x59b920;})});}_0x49fd06=_[_0xd877('0x68')]({},_0x49fd06,_0x445b56['options']);return db[_0xd877('0x6c')]['count']({'where':_0x49fd06['where']})['then'](function(_0x12c371){_0x7f8367[_0xd877('0x30')]=_0x12c371;if(_0x445b56['query'][_0xd877('0x52')]){_0x49fd06['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd877('0x54')](_0x49fd06);})[_0xd877('0x20')](function(_0x420dd3){_0x7f8367['rows']=_0x420dd3;return _0x7f8367;});}})['then'](respondWithFilteredResult(_0x10121f,_0x49fd06))[_0xd877('0x58')](handleError(_0x10121f,null));};exports['removeAnswers']=function(_0x59cd85,_0x3c17ed,_0x915878){return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x59cd85['params']['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x3c17ed,null))[_0xd877('0x20')](function(_0x566806){if(_0x566806){return _0x566806[_0xd877('0x6e')](_0x59cd85[_0xd877('0x42')][_0xd877('0x6a')]);}})[_0xd877('0x20')](respondWithStatusCode(_0x3c17ed,null))['catch'](handleError(_0x3c17ed,null));};exports[_0xd877('0x6f')]=function(_0x4e0a3c,_0x13f7b3,_0x147b32){return db[_0xd877('0x70')]['find']({'where':{'id':_0x4e0a3c[_0xd877('0x56')]['id']}})['then'](handleEntityNotFound(_0x13f7b3,null))['then'](function(_0x51813c){if(_0x51813c){return _0x51813c[_0xd877('0x6f')](_0x4e0a3c['body'][_0xd877('0x6a')],_[_0xd877('0x71')](_0x4e0a3c[_0xd877('0x61')],['ids','id'])||{});}})[_0xd877('0x20')](respondWithResult(_0x13f7b3,null))[_0xd877('0x58')](handleError(_0x13f7b3,null));};exports[_0xd877('0x72')]=function(_0x32c66f,_0xcffa47,_0x5c63d2){var _0x115e9f={'raw':![],'where':{}};var _0x176567={};var _0x5d0b15={'count':0x0,'rows':[]};return db[_0xd877('0x3f')][_0xd877('0x65')]({'where':{'id':_0x32c66f[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0xcffa47,null))[_0xd877('0x20')](function(_0x52b0f2){if(_0x52b0f2){_0x176567[_0xd877('0x41')]=_['keys'](db[_0xd877('0x70')][_0xd877('0x66')]);_0x176567[_0xd877('0x42')]=_[_0xd877('0x43')](_0x32c66f[_0xd877('0x42')]);_0x176567[_0xd877('0x4d')]=_[_0xd877('0x44')](_0x176567[_0xd877('0x41')],_0x176567[_0xd877('0x42')]);_0x115e9f[_0xd877('0x45')]=_[_0xd877('0x44')](_0x176567[_0xd877('0x41')],qs[_0xd877('0x46')](_0x32c66f[_0xd877('0x42')][_0xd877('0x46')]));_0x115e9f[_0xd877('0x45')]=_0x115e9f[_0xd877('0x45')][_0xd877('0x67')]?_0x115e9f[_0xd877('0x45')]:_0x176567[_0xd877('0x41')];if(!_0x32c66f[_0xd877('0x42')][_0xd877('0x47')]('nolimit')){_0x115e9f['limit']=qs[_0xd877('0x2e')](_0x32c66f[_0xd877('0x42')][_0xd877('0x2e')]);_0x115e9f[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x32c66f[_0xd877('0x42')]['offset']);}_0x115e9f[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x32c66f[_0xd877('0x42')][_0xd877('0x4a')]);_0x115e9f[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_[_0xd877('0x4c')](_0x32c66f['query'],_0x176567[_0xd877('0x4d')]));_0x115e9f['where'][_0xd877('0x62')]=_0x52b0f2['id'];if(_0x32c66f['query']['filter']){_0x115e9f[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x115e9f[_0xd877('0x4b')],{'$or':_[_0xd877('0x3e')](_0x115e9f[_0xd877('0x45')],function(_0x2d6cf9){var _0x898b73={};_0x898b73[_0x2d6cf9]={'$like':'%'+_0x32c66f['query'][_0xd877('0x4e')]+'%'};return _0x898b73;})});}_0x115e9f=_['merge']({},_0x115e9f,_0x32c66f[_0xd877('0x51')]);return db[_0xd877('0x70')]['count']({'where':_0x115e9f['where']})[_0xd877('0x20')](function(_0x3f078a){_0x5d0b15['count']=_0x3f078a;if(_0x32c66f[_0xd877('0x42')][_0xd877('0x52')]){_0x115e9f['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd877('0x39'),_0xd877('0x73'),_0xd877('0x74')],'required':![]},{'model':db[_0xd877('0x75')],'as':_0xd877('0x76'),'attributes':['id',_0xd877('0x39'),'color'],'where':_0x32c66f[_0xd877('0x42')][_0xd877('0x77')]?{'id':_0x32c66f[_0xd877('0x42')][_0xd877('0x77')]}:undefined,'required':_0x32c66f[_0xd877('0x42')][_0xd877('0x77')]?!![]:![]}];}return db['FaxInteraction'][_0xd877('0x54')](_0x115e9f);})['then'](function(_0x2c9971){_0x5d0b15['rows']=_0x2c9971;return _0x5d0b15;});}})[_0xd877('0x20')](respondWithFilteredResult(_0xcffa47,_0x115e9f))[_0xd877('0x58')](handleError(_0xcffa47,null));};exports[_0xd877('0x78')]=function(_0x183279,_0x440785){var _0x407b06=_0x183279[_0xd877('0x56')]['id'];var _0x5e95e4=_0x183279[_0xd877('0x61')];var _0x1d8075=0xc8;var _0x36ef4c=null;return db['sequelize'][_0xd877('0x79')]({'isolationLevel':db['sequelize'][_0xd877('0x7a')]['ISOLATION_LEVELS'][_0xd877('0x7b')]},function(_0xad4132){return db['FaxAccount']['findOne']({'where':{'id':_0x407b06},'transaction':_0xad4132})[_0xd877('0x20')](function(_0x4a49d4){if(_0x4a49d4){return db['FaxApplication'][_0xd877('0x36')]({'where':{'FaxAccountId':_0x407b06},'transaction':_0xad4132})[_0xd877('0x20')](function(){var _0x44e238=_[_0xd877('0x3e')](_0x5e95e4,function(_0x11266b){_0x11266b[_0xd877('0x62')]=_0x407b06;return _0x11266b;});return db[_0xd877('0x7c')][_0xd877('0x7d')](_0x44e238,{'transaction':_0xad4132});});}else{_0x1d8075=0x194;_0x36ef4c=[];}});})[_0xd877('0x20')](function(){if(_0x1d8075!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x407b06},'order':_0xd877('0x7e')})[_0xd877('0x20')](function(_0x4a9957){_0x36ef4c=_0x4a9957;});}})[_0xd877('0x58')](function(_0x11d266){_0x1d8075=0x1f4;logger[_0xd877('0x26')](_0x11d266[_0xd877('0x38')]);if(_0x11d266[_0xd877('0x39')]){delete _0x11d266[_0xd877('0x39')];}_0x36ef4c=_0x11d266;})[_0xd877('0x7f')](function(){if(_0x36ef4c===null){_0x440785[_0xd877('0x2a')](_0x1d8075);}else{if(_0x1d8075===0x1f4){_0x440785[_0xd877('0x2b')](_0x1d8075)['send'](_0x36ef4c);}else{_0x440785[_0xd877('0x2b')](_0x1d8075)[_0xd877('0x2c')](_0x36ef4c);}}});};exports[_0xd877('0x80')]=function(_0x4f2293,_0x4201d6,_0x7db40c){var _0x40f8f1={};var _0x443e62={};var _0x3af95c;var _0x4b45bb;return db['FaxAccount'][_0xd877('0x65')]({'where':{'id':_0x4f2293['params']['id']}})['then'](handleEntityNotFound(_0x4201d6,null))['then'](function(_0x1c2516){if(_0x1c2516){_0x3af95c=_0x1c2516;_0x443e62['model']=_[_0xd877('0x43')](db['FaxApplication'][_0xd877('0x66')]);_0x443e62[_0xd877('0x42')]=_[_0xd877('0x43')](_0x4f2293[_0xd877('0x42')]);_0x443e62[_0xd877('0x4d')]=_['intersection'](_0x443e62['model'],_0x443e62[_0xd877('0x42')]);_0x40f8f1['attributes']=_[_0xd877('0x44')](_0x443e62[_0xd877('0x41')],qs[_0xd877('0x46')](_0x4f2293[_0xd877('0x42')][_0xd877('0x46')]));_0x40f8f1[_0xd877('0x45')]=_0x40f8f1[_0xd877('0x45')][_0xd877('0x67')]?_0x40f8f1['attributes']:_0x443e62[_0xd877('0x41')];_0x40f8f1[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x4f2293[_0xd877('0x42')][_0xd877('0x4a')]);_0x40f8f1[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_['pick'](_0x4f2293[_0xd877('0x42')],_0x443e62['filters']));if(_0x4f2293[_0xd877('0x42')]['filter']){_0x40f8f1[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x40f8f1[_0xd877('0x4b')],{'$or':_[_0xd877('0x3e')](_0x40f8f1[_0xd877('0x45')],function(_0x4efdb9){var _0x3dcb41={};_0x3dcb41[_0x4efdb9]={'$like':'%'+_0x4f2293[_0xd877('0x42')][_0xd877('0x4e')]+'%'};return _0x3dcb41;})});}_0x40f8f1=_[_0xd877('0x68')]({},_0x40f8f1,_0x4f2293[_0xd877('0x51')]);return _0x3af95c['getApplications'](_0x40f8f1);}})['then'](function(_0x10b899){if(_0x10b899){_0x4b45bb=_0x10b899[_0xd877('0x67')];if(!_0x4f2293[_0xd877('0x42')][_0xd877('0x47')](_0xd877('0x48'))){_0x40f8f1['limit']=qs[_0xd877('0x2e')](_0x4f2293[_0xd877('0x42')][_0xd877('0x2e')]);_0x40f8f1[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x4f2293['query'][_0xd877('0x2f')]);}return _0x3af95c[_0xd877('0x80')](_0x40f8f1);}})[_0xd877('0x20')](function(_0x5c3af7){if(_0x5c3af7){return _0x5c3af7?{'count':_0x4b45bb,'rows':_0x5c3af7}:null;}})[_0xd877('0x20')](respondWithResult(_0x4201d6,null))['catch'](handleError(_0x4201d6,null));};function Extension(_0xa80a8d,_0x482133,_0x31085c,_0x105741){this[_0xd877('0x81')]=_0xd877('0x82');this[_0xd877('0x83')]=_0xa80a8d['localstationid'];this[_0xd877('0x84')]=_0x105741;this[_0xd877('0x4f')]=_0xd877('0x85');this['description']=_0xd877('0x86');this['FaxAccountId']=_0xa80a8d['id'];this[_0xd877('0x7e')]=_0x482133;this[_0xd877('0x87')]=_0x31085c;}function createExtensionsReciveFax(_0x47a27e){var _0x46a147=0x1;var _0x591cac=[];_0x591cac['push'](new Extension(_0x47a27e,_0x46a147,'',_0xd877('0x88')));_0x46a147+=0x1;_0x591cac[_0xd877('0x89')](new Extension(_0x47a27e,_0x46a147,_0xd877('0x8a'),_0xd877('0x8b')));_0x46a147+=0x1;for(var _0x53dbaf in _0x47a27e){if(_0x47a27e[_0xd877('0x47')](_0x53dbaf)&&(_0x53dbaf===_0xd877('0x8c')||_0x53dbaf===_0xd877('0x8d')||_0x53dbaf===_0xd877('0x8e')||_0x53dbaf===_0xd877('0x8f')||_0x53dbaf===_0xd877('0x90')||_0x53dbaf===_0xd877('0x91')||_0x53dbaf===_0xd877('0x92')||_0x53dbaf===_0xd877('0x93')||_0x53dbaf===_0xd877('0x94'))){_0x591cac[_0xd877('0x89')](new Extension(_0x47a27e,_0x46a147,_0xd877('0x95')+_0x53dbaf+')='+_0x47a27e[_0x53dbaf],_0xd877('0x8b')));_0x46a147+=0x1;}}_0x591cac['push'](new Extension(_0x47a27e,_0x46a147,'6',_0xd877('0x96')));_0x46a147+=0x1;_0x591cac[_0xd877('0x89')](new Extension(_0x47a27e,_0x46a147,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0xd877('0x97')));_0x46a147=0x0;return _0x591cac;}exports[_0xd877('0x98')]=function(_0x4018a1,_0x37230b,_0x14d966){var _0x138cdc;return db[_0xd877('0x99')][_0xd877('0x79')](function(_0x2db4d0){return db[_0xd877('0x3f')][_0xd877('0x59')](_0x4018a1['body'],{'transaction':_0x2db4d0})[_0xd877('0x20')](function(_0x22998e){_0x138cdc=_0x22998e[_0xd877('0x5b')]({'plain':!![]});return db['VoiceExtension'][_0xd877('0x7d')](createExtensionsReciveFax(_0x138cdc),{'transaction':_0x2db4d0});});})['then'](function(){return _0x138cdc;})[_0xd877('0x20')](respondWithResult(_0x37230b,null))[_0xd877('0x58')](handleError(_0x37230b,null));};exports[_0xd877('0x9a')]=function(_0x17ac5c,_0x337181,_0x2b893f){var _0x19a838;return db[_0xd877('0x99')][_0xd877('0x79')](function(_0x2dff1e){return db['FaxAccount'][_0xd877('0x5f')](_0x17ac5c[_0xd877('0x61')],{'where':{'id':_0x17ac5c[_0xd877('0x61')]['id']},'transaction':_0x2dff1e})[_0xd877('0x20')](function(_0x4f3d9a){return db[_0xd877('0x9b')][_0xd877('0x36')]({'where':{'FaxAccountId':_0x17ac5c[_0xd877('0x61')]['id']},'transaction':_0x2dff1e})[_0xd877('0x20')](function(_0x5626e1){return db[_0xd877('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0xd877('0x71')](_0x17ac5c['body'],[_0xd877('0x9c'),_0xd877('0x9d'),_0xd877('0x9e'),_0xd877('0x9f'),_0xd877('0xa0'),'ListId'])),{'transaction':_0x2dff1e});});});})[_0xd877('0x20')](function(){return db[_0xd877('0x3f')]['findById'](_0x17ac5c[_0xd877('0x61')]['id']);})['then'](respondWithResult(_0x337181,null))[_0xd877('0x58')](handleError(_0x337181,null));};exports[_0xd877('0xa1')]=function(_0x576c3f,_0x19de50,_0x2532c3){var _0x588572={'raw':!![],'where':{}};var _0x5a96b5={};var _0x210dee={'count':0x0,'rows':[]};return db[_0xd877('0x3f')]['findOne']({'where':{'id':_0x576c3f[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x19de50,null))[_0xd877('0x20')](function(_0x3a7f9d){if(_0x3a7f9d){_0x5a96b5[_0xd877('0x41')]=_[_0xd877('0x43')](db[_0xd877('0xa2')][_0xd877('0x66')]);_0x5a96b5[_0xd877('0x42')]=_[_0xd877('0x43')](_0x576c3f[_0xd877('0x42')]);_0x5a96b5['filters']=_['intersection'](_0x5a96b5[_0xd877('0x41')],_0x5a96b5['query']);_0x588572[_0xd877('0x45')]=_[_0xd877('0x44')](_0x5a96b5['model'],qs['fields'](_0x576c3f[_0xd877('0x42')][_0xd877('0x46')]));_0x588572[_0xd877('0x45')]=_0x588572[_0xd877('0x45')]['length']?_0x588572[_0xd877('0x45')]:_0x5a96b5[_0xd877('0x41')];if(!_0x576c3f[_0xd877('0x42')][_0xd877('0x47')]('nolimit')){_0x588572[_0xd877('0x2e')]=qs['limit'](_0x576c3f[_0xd877('0x42')][_0xd877('0x2e')]);_0x588572[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x576c3f[_0xd877('0x42')]['offset']);}_0x588572[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x576c3f['query'][_0xd877('0x4a')]);_0x588572[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_['pick'](_0x576c3f[_0xd877('0x42')],_0x5a96b5['filters']));_0x588572[_0xd877('0x4b')][_0xd877('0x62')]=_0x3a7f9d['id'];if(_0x576c3f['query'][_0xd877('0x4e')]){_0x588572[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x588572[_0xd877('0x4b')],{'$or':_[_0xd877('0x3e')](_0x588572['attributes'],function(_0x25c83a){var _0x45db2b={};_0x45db2b[_0x25c83a]={'$like':'%'+_0x576c3f[_0xd877('0x42')][_0xd877('0x4e')]+'%'};return _0x45db2b;})});}if(_0x576c3f['query']['$gte']){var _0x401fa2=_0x576c3f[_0xd877('0x42')][_0xd877('0xa3')][_0xd877('0xa4')](',');var _0x1493d2={};_0x1493d2[_0x401fa2[0x0]]={'$gte':moment(_0x401fa2[0x1])[_0xd877('0xa5')](_0xd877('0xa6'))};_0x588572['where']=_[_0xd877('0x68')](_0x588572[_0xd877('0x4b')],_0x1493d2);}_0x588572=_[_0xd877('0x68')]({},_0x588572,_0x576c3f['options']);return db[_0xd877('0xa2')][_0xd877('0x30')]({'where':_0x588572[_0xd877('0x4b')]})[_0xd877('0x20')](function(_0x19774e){_0x210dee[_0xd877('0x30')]=_0x19774e;if(_0x576c3f[_0xd877('0x42')]['includeAll']){_0x588572[_0xd877('0x53')]=[{'all':!![]}];}return db[_0xd877('0xa2')][_0xd877('0x54')](_0x588572);})[_0xd877('0x20')](function(_0xd921df){_0x210dee[_0xd877('0x55')]=_0xd921df;return _0x210dee;});}})[_0xd877('0x20')](respondWithFilteredResult(_0x19de50,_0x588572))['catch'](handleError(_0x19de50,null));};exports['send']=function(_0x16e69f,_0x2de678,_0x355390){var _0x68f7f0,_0x493296={},_0x2898fc;if(_0x16e69f[_0xd877('0x61')]['to']){_0x2898fc=_0x16e69f['body']['to'][0x0];}return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x16e69f[_0xd877('0x56')]['id']},'include':[{'model':db[_0xd877('0xa7')],'as':'List','include':[{'model':db[_0xd877('0xa8')],'as':'Contacts','where':{'fax':_0x2898fc},'limit':0x1,'order':[[_0xd877('0x9f'),_0xd877('0xa9')]]}]}]})[_0xd877('0x20')](handleEntityNotFound(_0x2de678,null))['then'](function(_0x38d7e9){_0x68f7f0=_0x38d7e9;if(_0x16e69f['body'][_0xd877('0xaa')]&&_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][_0xd877('0x67')]){for(var _0x3e1133=0x0;_0x3e1133<_0x16e69f[_0xd877('0x61')]['attachments'][_0xd877('0x67')];_0x3e1133+=0x1){_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][_0x3e1133]={'filename':_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][_0x3e1133][_0xd877('0x39')],'id':_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][_0x3e1133]['id'],'path':path[_0xd877('0xab')](config['root'],'server/files/attachments',_0x16e69f['body'][_0xd877('0xaa')][_0x3e1133][_0xd877('0xac')])};}}return respondWithRpcPromise(_0xd877('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0xd877('0xae')](_0x16e69f[_0xd877('0x56')]['id'])?undefined:_0x16e69f[_0xd877('0x56')]['id'],'path':_[_0xd877('0xae')](_0x16e69f['body'][_0xd877('0xaa')][0x0][_0xd877('0xaf')])?undefined:_0x16e69f[_0xd877('0x61')]['attachments'][0x0][_0xd877('0xaf')],'fax':_[_0xd877('0xae')](_0x16e69f[_0xd877('0x61')]['to'][0x0])?undefined:_0x16e69f['body']['to'][0x0]},client9002);})[_0xd877('0x20')](function(){if(_0x68f7f0){if(_[_0xd877('0xae')](_0x16e69f[_0xd877('0x61')][_0xd877('0xb0')])){_0x16e69f[_0xd877('0x61')][_0xd877('0xb0')]=util['format'](_0xd877('0xb1'),_0x68f7f0[_0xd877('0x39')],_0x68f7f0[_0xd877('0xb2')]);}if(_0x68f7f0[_0xd877('0xb3')]){if(_0x68f7f0[_0xd877('0xb3')][_0xd877('0xb4')]['length']){return _0x68f7f0[_0xd877('0xb3')][_0xd877('0xb4')][0x0];}else{return db['CmContact']['create'](_[_0xd877('0x1a')](_0x16e69f[_0xd877('0x61')],{'firstName':_0x16e69f[_0xd877('0x61')]['to'][0x0],'phone':_0x16e69f[_0xd877('0x61')]['to'][0x0],'fax':_0x16e69f[_0xd877('0x61')]['to'][0x0],'ListId':_0x68f7f0[_0xd877('0xb5')]}));}}else{throw new Error(_0xd877('0xb6'));}}else{throw new Error(_0xd877('0xb7'));}})[_0xd877('0x20')](function(_0x61acb2){if(_0x61acb2){return db[_0xd877('0x70')][_0xd877('0x57')]({'where':{'ContactId':_0x61acb2['id'],'closed':![],'FaxAccountId':_0x68f7f0['id']}})[_0xd877('0x20')](function(_0x49a7f3){if(_0x49a7f3){return[_0x49a7f3,![]];}return db[_0xd877('0x70')][_0xd877('0x59')]({'UserId':_0x16e69f['user']['id'],'ContactId':_0x61acb2['id'],'FaxAccountId':_0x68f7f0['id'],'fax':_0x16e69f[_0xd877('0x61')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xd877('0x68')](_0x16e69f[_0xd877('0x61')],{'read':![],'body':_0x16e69f[_0xd877('0x61')]['attachments'][0x0][_0xd877('0xb8')],'FaxAccountId':_0x68f7f0['id'],'UserId':_0x16e69f['user']['id'],'ContactId':_0x61acb2['id'],'AttachmentId':_0x16e69f['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xd877('0xa2')],'as':'Messages'}]})[_0xd877('0x20')](function(_0x3096f9){return[_0x3096f9,!![]];});});}else{throw new Error(_0xd877('0xb9'));}})[_0xd877('0xba')](function(_0x324fc5,_0x2bb1b7){if(_0x2bb1b7){return _0x324fc5;}return db[_0xd877('0xa2')][_0xd877('0x59')]({'direction':_0xd877('0xbb'),'read':![],'body':_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][0x0][_0xd877('0xb8')],'FaxAccountId':_0x68f7f0['id'],'FaxInteractionId':_0x324fc5['id'],'UserId':_0x16e69f[_0xd877('0x5a')]['id'],'ContactId':_0x324fc5[_0xd877('0xbc')],'AttachmentId':_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][0x0]['id']})['then'](function(_0x406255){_0x324fc5[_0xd877('0xbd')][_0xd877('0xbe')]=[];_0x324fc5[_0xd877('0xbd')][_0xd877('0xbe')]['push'](_0x406255[_0xd877('0xbd')]);return _0x324fc5;});})[_0xd877('0x20')](function(_0x543871){respondWithRpcPromise(_0xd877('0xbf'),_0xd877('0xbf'),{'FaxAccountId':_['isNil'](_0x16e69f['params']['id'])?undefined:_0x16e69f[_0xd877('0x56')]['id'],'path':_['isNil'](_0x16e69f['body'][_0xd877('0xaa')][0x0][_0xd877('0xaf')])?undefined:_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][0x0][_0xd877('0xaf')],'fax':_['isNil'](_0x16e69f['body']['to'][0x0])?undefined:_0x16e69f[_0xd877('0x61')]['to'][0x0],'AttachmentId':_0x16e69f[_0xd877('0x61')][_0xd877('0xaa')][0x0]['id']},client9002)[_0xd877('0x20')](function(_0x18e8c7){logger[_0xd877('0x21')](_0xd877('0xc0'),_0x18e8c7);})[_0xd877('0x58')](function(_0x3a0a6f){logger[_0xd877('0x21')](_0xd877('0xc0'),_0x3a0a6f);});return _0x543871;})[_0xd877('0x20')](respondWithResult(_0x2de678,null))[_0xd877('0x58')](handleError(_0x2de678,null));};exports['addAgents']=function(_0x356549,_0x166140,_0x27bed0){return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x356549[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x166140,null))[_0xd877('0x20')](function(_0x261198){if(_0x261198){return _0x261198['addAgents'](_0x356549['body']['ids'],_['omit'](_0x356549[_0xd877('0x61')],[_0xd877('0x6a'),'id'])||{})[_0xd877('0xba')](function(_0x3e319c){for(var _0x1e97e7=0x0;_0x1e97e7<_0x356549['body'][_0xd877('0x6a')][_0xd877('0x67')];_0x1e97e7+=0x1){socket[_0xd877('0xc1')](_0xd877('0xc2'),{'UserId':Number(_0x356549[_0xd877('0x61')]['ids'][_0x1e97e7]),'FaxAccountId':Number(_0x356549[_0xd877('0x56')]['id'])});}return _0x3e319c;});}})[_0xd877('0x20')](respondWithResult(_0x166140,null))['catch'](handleError(_0x166140,null));};exports[_0xd877('0xc3')]=function(_0x30a403,_0x21ad9c,_0x13d874){return db[_0xd877('0x3f')][_0xd877('0x57')]({'where':{'id':_0x30a403[_0xd877('0x56')]['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x21ad9c,null))[_0xd877('0x20')](function(_0x534415){if(_0x534415){return _0x534415[_0xd877('0xc3')](_0x30a403['query'][_0xd877('0x6a')])[_0xd877('0x20')](function(){if(_['isArray'](_0x30a403['query'][_0xd877('0x6a')])){for(var _0x1c5810=0x0;_0x1c5810<_0x30a403[_0xd877('0x42')][_0xd877('0x6a')][_0xd877('0x67')];_0x1c5810+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x30a403[_0xd877('0x42')][_0xd877('0x6a')][_0x1c5810]),'FaxAccountId':Number(_0x30a403[_0xd877('0x56')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x30a403[_0xd877('0x42')][_0xd877('0x6a')]),'FaxAccountId':Number(_0x30a403[_0xd877('0x56')]['id'])});}});}})[_0xd877('0x20')](respondWithStatusCode(_0x21ad9c,null))[_0xd877('0x58')](handleError(_0x21ad9c,null));};exports[_0xd877('0xc4')]=function(_0x191640,_0x639879,_0x1657c7){var _0x4e3bba={};var _0x491e88={};var _0x16246e;var _0x37ff4d;return db[_0xd877('0x3f')]['findOne']({'where':{'id':_0x191640['params']['id']}})[_0xd877('0x20')](handleEntityNotFound(_0x639879,null))['then'](function(_0x215d44){if(_0x215d44){_0x16246e=_0x215d44;_0x491e88['model']=_[_0xd877('0x43')](db[_0xd877('0xc5')][_0xd877('0x66')]);_0x491e88[_0xd877('0x42')]=_[_0xd877('0x43')](_0x191640[_0xd877('0x42')]);_0x491e88['filters']=_['intersection'](_0x491e88['model'],_0x491e88['query']);_0x4e3bba['attributes']=_[_0xd877('0x44')](_0x491e88[_0xd877('0x41')],qs[_0xd877('0x46')](_0x191640[_0xd877('0x42')][_0xd877('0x46')]));_0x4e3bba[_0xd877('0x45')]=_0x4e3bba[_0xd877('0x45')][_0xd877('0x67')]?_0x4e3bba[_0xd877('0x45')]:_0x491e88[_0xd877('0x41')];_0x4e3bba[_0xd877('0x49')]=qs[_0xd877('0x4a')](_0x191640['query'][_0xd877('0x4a')]);_0x4e3bba[_0xd877('0x4b')]=qs[_0xd877('0x4d')](_[_0xd877('0x4c')](_0x191640['query'],_0x491e88[_0xd877('0x4d')]));if(_0x191640[_0xd877('0x42')][_0xd877('0x4e')]){_0x4e3bba[_0xd877('0x4b')]=_[_0xd877('0x68')](_0x4e3bba[_0xd877('0x4b')],{'$or':_['map'](_0x4e3bba[_0xd877('0x45')],function(_0x480434){var _0x473846={};_0x473846[_0x480434]={'$like':'%'+_0x191640['query']['filter']+'%'};return _0x473846;})});}_0x4e3bba=_[_0xd877('0x68')]({},_0x4e3bba,_0x191640[_0xd877('0x51')]);return _0x16246e[_0xd877('0xc4')](_0x4e3bba);}})[_0xd877('0x20')](function(_0x3c6a18){if(_0x3c6a18){_0x37ff4d=_0x3c6a18[_0xd877('0x67')];if(!_0x191640[_0xd877('0x42')][_0xd877('0x47')](_0xd877('0x48'))){_0x4e3bba[_0xd877('0x2e')]=qs[_0xd877('0x2e')](_0x191640[_0xd877('0x42')]['limit']);_0x4e3bba[_0xd877('0x2f')]=qs[_0xd877('0x2f')](_0x191640[_0xd877('0x42')][_0xd877('0x2f')]);}return _0x16246e['getAgents'](_0x4e3bba);}})[_0xd877('0x20')](function(_0x338ee8){if(_0x338ee8){return _0x338ee8?{'count':_0x37ff4d,'rows':_0x338ee8}:null;}})[_0xd877('0x20')](respondWithResult(_0x639879,null))[_0xd877('0x58')](handleError(_0x639879,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d4c9f51..4666c4e 100644 --- a/server/api/faxAccount/faxAccount.events.js +++ b/server/api/faxAccount/faxAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b9d=['events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46f332,_0x3b3f89){var _0x1bda08=function(_0x3d5ef4){while(--_0x3d5ef4){_0x46f332['push'](_0x46f332['shift']());}};_0x1bda08(++_0x3b3f89);}(_0x6b9d,0x1e4));var _0xd6b9=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x6b9d[_0x3b6652];return _0x14d39f;};'use strict';var EventEmitter=require(_0xd6b9('0x0'));var FaxAccount=require(_0xd6b9('0x1'))['db'][_0xd6b9('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd6b9('0x3')](0x0);var events={'afterCreate':_0xd6b9('0x4'),'afterUpdate':_0xd6b9('0x5'),'afterDestroy':_0xd6b9('0x6')};function emitEvent(_0x2bcb33){return function(_0x3370ad,_0x2a32e1,_0x55dfd6){FaxAccountEvents[_0xd6b9('0x7')](_0x2bcb33+':'+_0x3370ad['id'],_0x3370ad);FaxAccountEvents[_0xd6b9('0x7')](_0x2bcb33,_0x3370ad);_0x55dfd6(null);};}for(var e in events){if(events[_0xd6b9('0x8')](e)){var event=events[e];FaxAccount[_0xd6b9('0x9')](e,emitEvent(event));}}module[_0xd6b9('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0x86f1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxAccount'];(function(_0x3eedba,_0x37f312){var _0x479d40=function(_0x3aaa79){while(--_0x3aaa79){_0x3eedba['push'](_0x3eedba['shift']());}};_0x479d40(++_0x37f312);}(_0x86f1,0xf8));var _0x186f=function(_0xf96f73,_0x4bfe7f){_0xf96f73=_0xf96f73-0x0;var _0xb1f68=_0x86f1[_0xf96f73];return _0xb1f68;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x186f('0x0'))['db'][_0x186f('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x186f('0x2')](0x0);var events={'afterCreate':_0x186f('0x3'),'afterUpdate':_0x186f('0x4'),'afterDestroy':_0x186f('0x5')};function emitEvent(_0x550830){return function(_0x54a40c,_0x52fd7e,_0x3da5ae){FaxAccountEvents[_0x186f('0x6')](_0x550830+':'+_0x54a40c['id'],_0x54a40c);FaxAccountEvents['emit'](_0x550830,_0x54a40c);_0x3da5ae(null);};}for(var e in events){if(events[_0x186f('0x7')](e)){var event=events[e];FaxAccount[_0x186f('0x8')](e,emitEvent(event));}}module[_0x186f('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7c36913..f7c05e6 100644 --- a/server/api/faxAccount/faxAccount.model.js +++ b/server/api/faxAccount/faxAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6827=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','moment','bluebird'];(function(_0x22f1fd,_0x11d9c3){var _0xfab9b0=function(_0x5af290){while(--_0x5af290){_0x22f1fd['push'](_0x22f1fd['shift']());}};_0xfab9b0(++_0x11d9c3);}(_0x6827,0x11b));var _0x7682=function(_0x4fab6b,_0x505180){_0x4fab6b=_0x4fab6b-0x0;var _0x2564f0=_0x6827[_0x4fab6b];return _0x2564f0;};'use strict';var _=require(_0x7682('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7682('0x1'));var BPromise=require(_0x7682('0x2'));var rp=require(_0x7682('0x3'));var fs=require('fs');var path=require(_0x7682('0x4'));var rimraf=require(_0x7682('0x5'));var config=require(_0x7682('0x6'));var attributes=require(_0x7682('0x7'));module[_0x7682('0x8')]=function(_0x50738a,_0x4b4081){return _0x50738a[_0x7682('0x9')]('FaxAccount',attributes,{'tableName':_0x7682('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57fc=['define','fax_accounts','util','../../config/logger','request-promise','path','rimraf','./faxAccount.attributes','exports'];(function(_0x2a3343,_0x363d2e){var _0x29a521=function(_0x2a41a7){while(--_0x2a41a7){_0x2a3343['push'](_0x2a3343['shift']());}};_0x29a521(++_0x363d2e);}(_0x57fc,0x12b));var _0xc57f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x57fc[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc57f('0x0'));var logger=require(_0xc57f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc57f('0x2'));var fs=require('fs');var path=require(_0xc57f('0x3'));var rimraf=require(_0xc57f('0x4'));var config=require('../../config/environment');var attributes=require(_0xc57f('0x5'));module[_0xc57f('0x6')]=function(_0x5d32a2,_0x4a89a6){return _0x5d32a2[_0xc57f('0x7')]('FaxAccount',attributes,{'tableName':_0xc57f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 5427349..44fb5e3 100644 --- a/server/api/faxAccount/faxAccount.rpc.js +++ b/server/api/faxAccount/faxAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b3e=['isNil','from','Sequelize','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','push','unmanaged','created','FaxMessage','ContactId','AttachmentId','User','interaction','UserId','unshift','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','difference','createdAt','updatedAt','keys','CompanyId','ListId'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x2b3e,0x7d));var _0xe2b3=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2b3e[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xe2b3('0x0'));var util=require(_0xe2b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe2b3('0x2'));var fs=require('fs');var Redis=require(_0xe2b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2b3('0x4'));var logger=require(_0xe2b3('0x5'))(_0xe2b3('0x6'));var config=require(_0xe2b3('0x7'));var jayson=require(_0xe2b3('0x8'));var client=jayson['client'][_0xe2b3('0x9')]({'port':0x232c});config['redis']=_[_0xe2b3('0xa')](config[_0xe2b3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2b3('0xc'))(new Redis(config['redis']));require(_0xe2b3('0xd'))[_0xe2b3('0xe')](socket);function respondWithRpcPromise(_0x194824,_0xfaddc7,_0x1cfed3){return new BPromise(function(_0x265510,_0xd2155c){return client[_0xe2b3('0xf')](_0x194824,_0x1cfed3)[_0xe2b3('0x10')](function(_0x3bd5b4){logger[_0xe2b3('0x11')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,'request\x20sent');logger[_0xe2b3('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xfaddc7,_0xe2b3('0x13'),JSON[_0xe2b3('0x14')](_0x3bd5b4));if(_0x3bd5b4[_0xe2b3('0x15')]){if(_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x16')]===0x1f4){logger[_0xe2b3('0x15')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,_0x3bd5b4['error'][_0xe2b3('0x17')]);return _0xd2155c(_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x17')]);}logger['error'](_0xe2b3('0x18'),_0xfaddc7,_0x3bd5b4[_0xe2b3('0x15')][_0xe2b3('0x17')]);return _0x265510(_0x3bd5b4[_0xe2b3('0x15')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0xfaddc7,'request\x20sent');_0x265510(_0x3bd5b4[_0xe2b3('0x19')]['message']);}})[_0xe2b3('0x1a')](function(_0x13aa32){logger[_0xe2b3('0x15')]('FaxAccount,\x20%s,\x20%s',_0xfaddc7,_0x13aa32);_0xd2155c(_0x13aa32);});});}exports[_0xe2b3('0x1b')]=function(_0x2809bb){var _0x2d7f4d=this;return new Promise(function(_0x50c339,_0x4660a4){return db['FaxAccount'][_0xe2b3('0x1c')]({'raw':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x1e')]===undefined?!![]:![]:!![],'where':_0x2809bb['options']?_0x2809bb[_0xe2b3('0x1d')]['where']||null:null,'attributes':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x1f')]||null:null,'limit':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x20')]||null:null,'include':_0x2809bb[_0xe2b3('0x1d')]?_0x2809bb['options']['include']?_['map'](_0x2809bb[_0xe2b3('0x1d')][_0xe2b3('0x21')],function(_0x795b8b){return{'model':db[_0x795b8b[_0xe2b3('0x22')]],'as':_0x795b8b['as'],'attributes':_0x795b8b[_0xe2b3('0x1f')],'include':_0x795b8b[_0xe2b3('0x21')]?_['map'](_0x795b8b[_0xe2b3('0x21')],function(_0x5e4906){return{'model':db[_0x5e4906['model']],'as':_0x5e4906['as'],'attributes':_0x5e4906[_0xe2b3('0x1f')],'include':_0x5e4906['include']?_[_0xe2b3('0x23')](_0x5e4906[_0xe2b3('0x21')],function(_0x2d6b64){return{'model':db[_0x2d6b64[_0xe2b3('0x22')]],'as':_0x2d6b64['as'],'attributes':_0x2d6b64[_0xe2b3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe2b3('0x10')](function(_0x390db4){logger['info']('GetFaxAccount',_0x2809bb);logger[_0xe2b3('0x12')](_0xe2b3('0x1b'),_0x2809bb,JSON['stringify'](_0x390db4));_0x50c339(_0x390db4);})['catch'](function(_0x1eb89b){logger[_0xe2b3('0x15')](_0xe2b3('0x1b'),_0x1eb89b[_0xe2b3('0x17')],_0x2809bb);_0x4660a4(_0x2d7f4d['error'](0x1f4,_0x1eb89b[_0xe2b3('0x17')]));});});};exports[_0xe2b3('0x24')]=function(_0x271f59,_0x2a06e4,_0x11edb9){var _0x388e16=this;return new Promise(function(_0x4f63a4,_0x168a19){var _0x235938={'body':_0x271f59[_0xe2b3('0x25')],'channel':_0xe2b3('0x26')};var _0x581405=[];var _0x491968=[];var _0x3bcb72={};return db[_0xe2b3('0x27')][_0xe2b3('0x28')]()['then'](function(_0x2e3004){if(!_0x2e3004){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x581405=_[_0xe2b3('0x29')](_['keys'](_0x2e3004),[_0xe2b3('0x2a'),_0xe2b3('0x2b')]);_0x491968=_['difference'](_[_0xe2b3('0x2c')](_0x2e3004),[_0xe2b3('0x2a'),_0xe2b3('0x2b'),_0xe2b3('0x2d'),_0xe2b3('0x2e')]);if(_0x271f59[_0xe2b3('0x25')]['id']){delete _0x271f59[_0xe2b3('0x25')]['id'];}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')])){throw new db[(_0xe2b3('0x31'))][(_0xe2b3('0x32'))]('from\x20is\x20mandatory');}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x25')])||_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x25')]===''){throw new db[(_0xe2b3('0x31'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe2b3('0x2f')](_0x271f59[_0xe2b3('0x25')]['mapKey'])){throw new db[(_0xe2b3('0x31'))][(_0xe2b3('0x32'))](_0xe2b3('0x33')+_0x491968);}if(!_[_0xe2b3('0x34')](_0x491968,_0x271f59[_0xe2b3('0x25')]['mapKey'])){throw new db['Sequelize'][(_0xe2b3('0x32'))](_0xe2b3('0x35')+_0x491968);}_0x3bcb72[_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x36')]]=_0x271f59['body'][_0xe2b3('0x30')];})[_0xe2b3('0x10')](function(){return db['FaxAccount'][_0xe2b3('0x37')]({'where':{'id':_0x271f59[_0xe2b3('0x38')]['id']},'include':[{'model':db['CmList'],'as':_0xe2b3('0x39'),'include':[{'model':db['CmContact'],'as':_0xe2b3('0x3a'),'where':_0x3bcb72,'limit':0x1,'order':[[_0xe2b3('0x2b'),_0xe2b3('0x3b')]]}]},{'model':db[_0xe2b3('0x3c')],'as':_0xe2b3('0x3d')}]});})[_0xe2b3('0x10')](function(_0x2e212b){if(_0x2e212b&&_0x2e212b['List']){var _0x712c74=_0x2e212b[_0xe2b3('0x3e')]({'plain':!![]});_0x235938['account']=_0x712c74;_0x235938[_0xe2b3('0x3f')]=_0x712c74[_0xe2b3('0x3d')];_0x235938[_0xe2b3('0x40')]=_0x712c74[_0xe2b3('0x39')];_0x235938[_0xe2b3('0x3f')]=_[_0xe2b3('0x41')](_0x235938[_0xe2b3('0x3f')],['priority'],[_0xe2b3('0x42')]);if(_0x235938['account'][_0xe2b3('0x3d')]){delete _0x235938[_0xe2b3('0x38')][_0xe2b3('0x3d')];}if(_0x235938[_0xe2b3('0x38')][_0xe2b3('0x39')]&&_0x235938[_0xe2b3('0x38')][_0xe2b3('0x39')][_0xe2b3('0x3a')][_0xe2b3('0x43')]){return _0x235938[_0xe2b3('0x38')]['List'][_0xe2b3('0x3a')][0x0];}var _0x2a2ceb=_['defaults'](_0x271f59[_0xe2b3('0x25')],{'firstName':_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')],'ListId':_0x712c74['ListId']});_0x2a2ceb[_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x36')]]=_0x271f59[_0xe2b3('0x25')][_0xe2b3('0x30')];return db[_0xe2b3('0x27')][_0xe2b3('0x44')](_0x2a2ceb,{'fields':_0x581405,'raw':!![]});}})[_0xe2b3('0x10')](function(_0xb5e75c){_0x235938[_0xe2b3('0x45')]=_0xb5e75c;if(_0xb5e75c){var _0x2f17f6={'ContactId':_0xb5e75c['id'],'FaxAccountId':_0x271f59['account']['id'],'fax':_0xb5e75c[_0xe2b3('0x26')]};return db[_0xe2b3('0x46')]['find']({'where':{'ContactId':_0xb5e75c['id'],'closed':![],'FaxAccountId':_0x271f59[_0xe2b3('0x38')]['id']}})['then'](function(_0x5255f6){if(_0x5255f6){return[_0x5255f6,![]];}return db[_0xe2b3('0x46')][_0xe2b3('0x44')](_0x2f17f6)['then'](function(_0xa8c03f){return[_0xa8c03f,!![]];});});}else{throw new Error(_0xe2b3('0x47'));}})['spread'](function(_0x3d22bf,_0x41479a){var _0x15a99c=_0x3d22bf['get']({'plain':!![]});if(_0x41479a){if(_0x235938[_0xe2b3('0x38')]['autoclose']){_0x235938['applications'][_0xe2b3('0x48')]({'id':0x0,'priority':_0x235938[_0xe2b3('0x3f')]['length']+0x1,'app':'close','appdata':_0xe2b3('0x49'),'interval':'*,*,*,*'});}_0x15a99c[_0xe2b3('0x4a')]=!![];}else{_0x15a99c[_0xe2b3('0x4a')]=![];}_0x235938['interaction']=_0x15a99c;return db[_0xe2b3('0x4b')][_0xe2b3('0x44')]({'body':_0x271f59[_0xe2b3('0x25')]['body'],'FaxAccountId':_0x271f59[_0xe2b3('0x38')]['id'],'FaxInteractionId':_0x3d22bf['id'],'direction':'in','ContactId':_0x3d22bf[_0xe2b3('0x4c')],'AttachmentId':_0x271f59['body'][_0xe2b3('0x4d')]});})[_0xe2b3('0x10')](function(_0x19415a){_0x235938[_0xe2b3('0x17')]=_0x19415a;if(_0x235938['interaction']['UserId']){return db[_0xe2b3('0x4e')][_0xe2b3('0x37')]({'attributes':['id','name'],'where':{'id':_0x235938[_0xe2b3('0x4f')][_0xe2b3('0x50')]}})[_0xe2b3('0x10')](function(_0x3bd469){if(_0x3bd469){_0x235938['applications'][_0xe2b3('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3bd469[_0xe2b3('0x52')]+','+(_0x235938[_0xe2b3('0x38')][_0xe2b3('0x53')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe2b3('0x54'),'startRouting',_0x235938);});}return respondWithRpcPromise(_0xe2b3('0x54'),_0xe2b3('0x55'),_0x235938);})[_0xe2b3('0x10')](function(_0x3287d8){_0x4f63a4(_0x3287d8);})[_0xe2b3('0x1a')](function(_0x4f8bf5){_0x168a19(_0x388e16['error'](0x1f4,_0x4f8bf5[_0xe2b3('0x17')]));});});}; \ No newline at end of file +var _0x22bf=['from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Applications','get','account','orderBy','applications','priority','Contacts','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','created','FaxMessage','AttachmentId','UserId','User','interaction','unshift','agent','name','*,*,*,*','Start','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','model','map','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil'];(function(_0x55cd14,_0x2dfb29){var _0x20732a=function(_0x2646bb){while(--_0x2646bb){_0x55cd14['push'](_0x55cd14['shift']());}};_0x20732a(++_0x2dfb29);}(_0x22bf,0xd6));var _0xf22b=function(_0x2bf05c,_0x132f75){_0x2bf05c=_0x2bf05c-0x0;var _0x3164a8=_0x22bf[_0x2bf05c];return _0x3164a8;};'use strict';var _=require('lodash');var util=require(_0xf22b('0x0'));var moment=require(_0xf22b('0x1'));var BPromise=require(_0xf22b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf22b('0x3'));var db=require(_0xf22b('0x4'))['db'];var utils=require(_0xf22b('0x5'));var logger=require(_0xf22b('0x6'))(_0xf22b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});config[_0xf22b('0x8')]=_[_0xf22b('0x9')](config[_0xf22b('0x8')],{'host':_0xf22b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf22b('0x8')]));require(_0xf22b('0xb'))[_0xf22b('0xc')](socket);function respondWithRpcPromise(_0x2c1449,_0x291228,_0x5e71b1){return new BPromise(function(_0x2e035f,_0x5896b4){return client[_0xf22b('0xd')](_0x2c1449,_0x5e71b1)[_0xf22b('0xe')](function(_0x134f3e){logger[_0xf22b('0xf')](_0xf22b('0x10'),_0x291228,'request\x20sent');logger[_0xf22b('0x11')](_0xf22b('0x12'),_0x291228,_0xf22b('0x13'),JSON[_0xf22b('0x14')](_0x134f3e));if(_0x134f3e[_0xf22b('0x15')]){if(_0x134f3e['error'][_0xf22b('0x16')]===0x1f4){logger['error'](_0xf22b('0x10'),_0x291228,_0x134f3e[_0xf22b('0x15')]['message']);return _0x5896b4(_0x134f3e['error'][_0xf22b('0x17')]);}logger[_0xf22b('0x15')](_0xf22b('0x10'),_0x291228,_0x134f3e[_0xf22b('0x15')]['message']);return _0x2e035f(_0x134f3e[_0xf22b('0x15')][_0xf22b('0x17')]);}else{logger[_0xf22b('0xf')](_0xf22b('0x10'),_0x291228,_0xf22b('0x13'));_0x2e035f(_0x134f3e[_0xf22b('0x18')][_0xf22b('0x17')]);}})[_0xf22b('0x19')](function(_0x380010){logger[_0xf22b('0x15')](_0xf22b('0x10'),_0x291228,_0x380010);_0x5896b4(_0x380010);});});}exports[_0xf22b('0x1a')]=function(_0x5d5e27){var _0x3da01c=this;return new Promise(function(_0x43464b,_0x2fef40){return db[_0xf22b('0x1b')][_0xf22b('0x1c')]({'raw':_0x5d5e27[_0xf22b('0x1d')]?_0x5d5e27[_0xf22b('0x1d')][_0xf22b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d5e27['options']?_0x5d5e27[_0xf22b('0x1d')]['where']||null:null,'attributes':_0x5d5e27[_0xf22b('0x1d')]?_0x5d5e27['options'][_0xf22b('0x1f')]||null:null,'limit':_0x5d5e27[_0xf22b('0x1d')]?_0x5d5e27[_0xf22b('0x1d')][_0xf22b('0x20')]||null:null,'include':_0x5d5e27[_0xf22b('0x1d')]?_0x5d5e27[_0xf22b('0x1d')]['include']?_['map'](_0x5d5e27[_0xf22b('0x1d')][_0xf22b('0x21')],function(_0x34757d){return{'model':db[_0x34757d[_0xf22b('0x22')]],'as':_0x34757d['as'],'attributes':_0x34757d['attributes'],'include':_0x34757d['include']?_['map'](_0x34757d['include'],function(_0xe1bf06){return{'model':db[_0xe1bf06[_0xf22b('0x22')]],'as':_0xe1bf06['as'],'attributes':_0xe1bf06[_0xf22b('0x1f')],'include':_0xe1bf06['include']?_[_0xf22b('0x23')](_0xe1bf06[_0xf22b('0x21')],function(_0x4527bc){return{'model':db[_0x4527bc['model']],'as':_0x4527bc['as'],'attributes':_0x4527bc[_0xf22b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf22b('0xe')](function(_0x18297e){logger[_0xf22b('0xf')]('GetFaxAccount',_0x5d5e27);logger[_0xf22b('0x11')](_0xf22b('0x1a'),_0x5d5e27,JSON[_0xf22b('0x14')](_0x18297e));_0x43464b(_0x18297e);})['catch'](function(_0x3c6944){logger[_0xf22b('0x15')](_0xf22b('0x1a'),_0x3c6944[_0xf22b('0x17')],_0x5d5e27);_0x2fef40(_0x3da01c[_0xf22b('0x15')](0x1f4,_0x3c6944['message']));});});};exports[_0xf22b('0x24')]=function(_0x572fe2,_0xe61f82,_0x4c59bd){var _0x205016=this;return new Promise(function(_0x1f5c2a,_0x11ff98){var _0x4c6062={'body':_0x572fe2['body'],'channel':_0xf22b('0x25')};var _0xe88cae=[];var _0x5f04b6=[];var _0x1f9a18={};return db[_0xf22b('0x26')][_0xf22b('0x27')]()['then'](function(_0x33080b){if(!_0x33080b){throw new db['Sequelize'][(_0xf22b('0x28'))](_0xf22b('0x29'));}_0xe88cae=_[_0xf22b('0x2a')](_[_0xf22b('0x2b')](_0x33080b),[_0xf22b('0x2c'),_0xf22b('0x2d')]);_0x5f04b6=_['difference'](_[_0xf22b('0x2b')](_0x33080b),[_0xf22b('0x2c'),_0xf22b('0x2d'),_0xf22b('0x2e'),_0xf22b('0x2f')]);if(_0x572fe2['body']['id']){delete _0x572fe2[_0xf22b('0x30')]['id'];}if(_[_0xf22b('0x31')](_0x572fe2[_0xf22b('0x30')][_0xf22b('0x32')])){throw new db['Sequelize'][(_0xf22b('0x28'))](_0xf22b('0x33'));}if(_[_0xf22b('0x31')](_0x572fe2[_0xf22b('0x30')][_0xf22b('0x30')])||_0x572fe2[_0xf22b('0x30')][_0xf22b('0x30')]===''){throw new db[(_0xf22b('0x34'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf22b('0x31')](_0x572fe2['body'][_0xf22b('0x35')])){throw new db['Sequelize']['ValidationError'](_0xf22b('0x36')+_0x5f04b6);}if(!_[_0xf22b('0x37')](_0x5f04b6,_0x572fe2[_0xf22b('0x30')]['mapKey'])){throw new db[(_0xf22b('0x34'))][(_0xf22b('0x28'))](_0xf22b('0x38')+_0x5f04b6);}_0x1f9a18[_0x572fe2[_0xf22b('0x30')]['mapKey']]=_0x572fe2[_0xf22b('0x30')][_0xf22b('0x32')];})[_0xf22b('0xe')](function(){return db[_0xf22b('0x1b')][_0xf22b('0x39')]({'where':{'id':_0x572fe2['account']['id']},'include':[{'model':db[_0xf22b('0x3a')],'as':_0xf22b('0x3b'),'include':[{'model':db[_0xf22b('0x26')],'as':'Contacts','where':_0x1f9a18,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['FaxApplication'],'as':_0xf22b('0x3c')}]});})['then'](function(_0x3cedc7){if(_0x3cedc7&&_0x3cedc7[_0xf22b('0x3b')]){var _0x4f49aa=_0x3cedc7[_0xf22b('0x3d')]({'plain':!![]});_0x4c6062[_0xf22b('0x3e')]=_0x4f49aa;_0x4c6062['applications']=_0x4f49aa['Applications'];_0x4c6062['list']=_0x4f49aa[_0xf22b('0x3b')];_0x4c6062['applications']=_[_0xf22b('0x3f')](_0x4c6062[_0xf22b('0x40')],[_0xf22b('0x41')],['asc']);if(_0x4c6062[_0xf22b('0x3e')][_0xf22b('0x3c')]){delete _0x4c6062[_0xf22b('0x3e')][_0xf22b('0x3c')];}if(_0x4c6062['account']['List']&&_0x4c6062[_0xf22b('0x3e')][_0xf22b('0x3b')]['Contacts']['length']){return _0x4c6062[_0xf22b('0x3e')][_0xf22b('0x3b')][_0xf22b('0x42')][0x0];}var _0x79ae6a=_[_0xf22b('0x9')](_0x572fe2[_0xf22b('0x30')],{'firstName':_0x572fe2[_0xf22b('0x30')][_0xf22b('0x32')],'ListId':_0x4f49aa[_0xf22b('0x2f')]});_0x79ae6a[_0x572fe2['body'][_0xf22b('0x35')]]=_0x572fe2['body'][_0xf22b('0x32')];return db[_0xf22b('0x26')][_0xf22b('0x43')](_0x79ae6a,{'fields':_0xe88cae,'raw':!![]});}})[_0xf22b('0xe')](function(_0x41dd7d){_0x4c6062[_0xf22b('0x44')]=_0x41dd7d;if(_0x41dd7d){var _0x23c5c3={'ContactId':_0x41dd7d['id'],'FaxAccountId':_0x572fe2[_0xf22b('0x3e')]['id'],'fax':_0x41dd7d['fax']};return db['FaxInteraction'][_0xf22b('0x39')]({'where':{'ContactId':_0x41dd7d['id'],'closed':![],'FaxAccountId':_0x572fe2[_0xf22b('0x3e')]['id']}})['then'](function(_0x2cd5ae){if(_0x2cd5ae){return[_0x2cd5ae,![]];}return db[_0xf22b('0x45')][_0xf22b('0x43')](_0x23c5c3)['then'](function(_0x1093a8){return[_0x1093a8,!![]];});});}else{throw new Error(_0xf22b('0x46'));}})[_0xf22b('0x47')](function(_0x2876a8,_0x3516ea){var _0x215c08=_0x2876a8[_0xf22b('0x3d')]({'plain':!![]});if(_0x3516ea){if(_0x4c6062[_0xf22b('0x3e')][_0xf22b('0x48')]){_0x4c6062[_0xf22b('0x40')][_0xf22b('0x49')]({'id':0x0,'priority':_0x4c6062[_0xf22b('0x40')][_0xf22b('0x4a')]+0x1,'app':_0xf22b('0x4b'),'appdata':_0xf22b('0x4c'),'interval':'*,*,*,*'});}_0x215c08[_0xf22b('0x4d')]=!![];}else{_0x215c08['created']=![];}_0x4c6062['interaction']=_0x215c08;return db[_0xf22b('0x4e')][_0xf22b('0x43')]({'body':_0x572fe2[_0xf22b('0x30')][_0xf22b('0x30')],'FaxAccountId':_0x572fe2[_0xf22b('0x3e')]['id'],'FaxInteractionId':_0x2876a8['id'],'direction':'in','ContactId':_0x2876a8['ContactId'],'AttachmentId':_0x572fe2[_0xf22b('0x30')][_0xf22b('0x4f')]});})[_0xf22b('0xe')](function(_0x33bf82){_0x4c6062[_0xf22b('0x17')]=_0x33bf82;if(_0x4c6062['interaction'][_0xf22b('0x50')]){return db[_0xf22b('0x51')][_0xf22b('0x39')]({'attributes':['id','name'],'where':{'id':_0x4c6062[_0xf22b('0x52')][_0xf22b('0x50')]}})[_0xf22b('0xe')](function(_0x457db2){if(_0x457db2){_0x4c6062[_0xf22b('0x40')][_0xf22b('0x53')]({'id':0x0,'priority':0x0,'app':_0xf22b('0x54'),'appdata':_0x457db2[_0xf22b('0x55')]+','+(_0x4c6062['account']['waitForTheAssignedAgent']||0xa),'interval':_0xf22b('0x56')});}return respondWithRpcPromise(_0xf22b('0x57'),'startRouting',_0x4c6062);});}return respondWithRpcPromise(_0xf22b('0x57'),'startRouting',_0x4c6062);})[_0xf22b('0xe')](function(_0x28536e){_0x1f5c2a(_0x28536e);})[_0xf22b('0x19')](function(_0x10d07d){_0x11ff98(_0x205016[_0xf22b('0x15')](0x1f4,_0x10d07d[_0xf22b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 1379e9b..d8e56fe 100644 --- a/server/api/faxAccount/faxAccount.socket.js +++ b/server/api/faxAccount/faxAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0019=['removeListener','register','length','faxAccount:','./faxAccount.events','save','emit'];(function(_0x17efa9,_0x47b593){var _0x39b5df=function(_0x2af3ab){while(--_0x2af3ab){_0x17efa9['push'](_0x17efa9['shift']());}};_0x39b5df(++_0x47b593);}(_0x0019,0xeb));var _0x9001=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x0019[_0x3a2a3c];return _0x50ac9a;};'use strict';var FaxAccountEvents=require(_0x9001('0x0'));var events=[_0x9001('0x1'),'remove','update'];function createListener(_0x479698,_0xd03fd3){return function(_0x4d6594){_0xd03fd3[_0x9001('0x2')](_0x479698,_0x4d6594);};}function removeListener(_0xd9ca16,_0x2fe071){return function(){FaxAccountEvents[_0x9001('0x3')](_0xd9ca16,_0x2fe071);};}exports[_0x9001('0x4')]=function(_0x5979fc){for(var _0x33335e=0x0,_0x344acf=events[_0x9001('0x5')];_0x33335e<_0x344acf;_0x33335e++){var _0x175629=events[_0x33335e];var _0x4a1c28=createListener(_0x9001('0x6')+_0x175629,_0x5979fc);FaxAccountEvents['on'](_0x175629,_0x4a1c28);}}; \ No newline at end of file +var _0xc414=['faxAccount:','./faxAccount.events','save','update','emit','register'];(function(_0x597659,_0x14e35f){var _0xb73b28=function(_0x4e0f37){while(--_0x4e0f37){_0x597659['push'](_0x597659['shift']());}};_0xb73b28(++_0x14e35f);}(_0xc414,0x17b));var _0x4c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc414[_0x3dd15e];return _0x231fd0;};'use strict';var FaxAccountEvents=require(_0x4c41('0x0'));var events=[_0x4c41('0x1'),'remove',_0x4c41('0x2')];function createListener(_0x4d98a9,_0x4afaab){return function(_0x340891){_0x4afaab[_0x4c41('0x3')](_0x4d98a9,_0x340891);};}function removeListener(_0x2a5947,_0x114241){return function(){FaxAccountEvents['removeListener'](_0x2a5947,_0x114241);};}exports[_0x4c41('0x4')]=function(_0x44748f){for(var _0xb0d679=0x0,_0x358da1=events['length'];_0xb0d679<_0x358da1;_0xb0d679++){var _0x1999e5=events[_0xb0d679];var _0x1d9688=createListener(_0x4c41('0x5')+_0x1999e5,_0x44748f);FaxAccountEvents['on'](_0x1999e5,_0x1d9688);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 46fe549..b81bfd6 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x4b4b33,_0x58c677){var _0x274e29=function(_0x144d15){while(--_0x144d15){_0x4b4b33['push'](_0x4b4b33['shift']());}};_0x274e29(++_0x58c677);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5a1b60,_0x3896b4){var _0x397393=function(_0x3467e1){while(--_0x3467e1){_0x5a1b60['push'](_0x5a1b60['shift']());}};_0x397393(++_0x3896b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index ca1a90a..efa57de 100644 --- a/server/api/faxApplication/faxApplication.attributes.js +++ b/server/api/faxApplication/faxApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5054=['TEXT','STRING','exports','INTEGER'];(function(_0x14cd66,_0x584878){var _0x312de1=function(_0xdb72b7){while(--_0xdb72b7){_0x14cd66['push'](_0x14cd66['shift']());}};_0x312de1(++_0x584878);}(_0x5054,0xa6));var _0x4505=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5054[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x4505('0x0')]={'priority':{'type':Sequelize[_0x4505('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4505('0x2')]()},'description':{'type':Sequelize[_0x4505('0x3')]},'interval':{'type':Sequelize[_0x4505('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf440=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x270b9d,_0x8e1c){var _0x32ac0c=function(_0x497809){while(--_0x497809){_0x270b9d['push'](_0x270b9d['shift']());}};_0x32ac0c(++_0x8e1c);}(_0xf440,0xb0));var _0x0f44=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xf440[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x0f44('0x0'));module[_0x0f44('0x1')]={'priority':{'type':Sequelize[_0x0f44('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0f44('0x3')],'allowNull':![],'defaultValue':_0x0f44('0x4')},'appdata':{'type':Sequelize[_0x0f44('0x5')]()},'description':{'type':Sequelize[_0x0f44('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0f44('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a094e28..5fc45d7 100644 --- a/server/api/faxApplication/faxApplication.controller.js +++ b/server/api/faxApplication/faxApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fbb=['fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','then','include','catch','show','params','keys','includeAll','find','body','eml-format','zip-dir'];(function(_0x41c62a,_0x292d69){var _0x2af078=function(_0x445bab){while(--_0x445bab){_0x41c62a['push'](_0x41c62a['shift']());}};_0x2af078(++_0x292d69);}(_0x4fbb,0x8c));var _0xb4fb=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x4fbb[_0x2d2498];return _0x447a5b;};'use strict';var emlformat=require(_0xb4fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4fb('0x1'));var jsonpatch=require(_0xb4fb('0x2'));var rp=require(_0xb4fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb4fb('0x4'));var path=require(_0xb4fb('0x5'));var sox=require(_0xb4fb('0x6'));var csv=require(_0xb4fb('0x7'));var ejs=require(_0xb4fb('0x8'));var fs=require('fs');var fs_extra=require(_0xb4fb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb4fb('0xa'));var jsforce=require(_0xb4fb('0xb'));var deskjs=require(_0xb4fb('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb4fb('0xd'));var Papa=require(_0xb4fb('0xe'));var Redis=require(_0xb4fb('0xf'));var authService=require(_0xb4fb('0x10'));var qs=require(_0xb4fb('0x11'));var as=require(_0xb4fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4fb('0x13'))(_0xb4fb('0x14'));var utils=require(_0xb4fb('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a9811,_0x54db0e){_0x54db0e=_0x54db0e||0xcc;return function(_0xb2e757){if(_0xb2e757){return _0x5a9811[_0xb4fb('0x16')](_0x54db0e);}return _0x5a9811[_0xb4fb('0x17')](_0x54db0e)[_0xb4fb('0x18')]();};}function respondWithResult(_0x5321be,_0x5c6613){_0x5c6613=_0x5c6613||0xc8;return function(_0x8c6f02){if(_0x8c6f02){return _0x5321be[_0xb4fb('0x17')](_0x5c6613)[_0xb4fb('0x19')](_0x8c6f02);}};}function respondWithFilteredResult(_0x3bf8f4,_0x3ce32d){return function(_0x2f9b49){if(_0x2f9b49){var _0x1247ae=typeof _0x3ce32d[_0xb4fb('0x1a')]===_0xb4fb('0x1b')&&typeof _0x3ce32d[_0xb4fb('0x1c')]==='undefined';var _0x33b221=_0x2f9b49['count'];var _0x488ad3=_0x1247ae?0x0:_0x3ce32d[_0xb4fb('0x1a')];var _0x206351=_0x1247ae?_0x2f9b49[_0xb4fb('0x1d')]:_0x3ce32d[_0xb4fb('0x1a')]+_0x3ce32d[_0xb4fb('0x1c')];var _0x5e322d;if(_0x206351>=_0x33b221){_0x206351=_0x33b221;_0x5e322d=0xc8;}else{_0x5e322d=0xce;}_0x3bf8f4[_0xb4fb('0x17')](_0x5e322d);return _0x3bf8f4[_0xb4fb('0x1e')](_0xb4fb('0x1f'),_0x488ad3+'-'+_0x206351+'/'+_0x33b221)[_0xb4fb('0x19')](_0x2f9b49);}return null;};}function patchUpdates(_0x5a15a2){return function(_0x1e1c51){try{jsonpatch[_0xb4fb('0x20')](_0x1e1c51,_0x5a15a2,!![]);}catch(_0x180a20){return BPromise['reject'](_0x180a20);}return _0x1e1c51[_0xb4fb('0x21')]();};}function saveUpdates(_0x1c7d57,_0x8080f){return function(_0x26270f){if(_0x26270f){return _0x26270f[_0xb4fb('0x22')](_0x1c7d57)['then'](function(_0x2a8d65){return _0x2a8d65;});}return null;};}function removeEntity(_0x4c023c,_0x32bfb9){return function(_0x2f5466){if(_0x2f5466){return _0x2f5466[_0xb4fb('0x23')]()['then'](function(){_0x4c023c[_0xb4fb('0x17')](0xcc)[_0xb4fb('0x18')]();});}};}function handleEntityNotFound(_0x363762,_0x322b67){return function(_0x321950){if(!_0x321950){_0x363762[_0xb4fb('0x16')](0x194);}return _0x321950;};}function handleError(_0x48fb55,_0xa71b7c){_0xa71b7c=_0xa71b7c||0x1f4;return function(_0x333f3d){logger[_0xb4fb('0x24')](_0x333f3d[_0xb4fb('0x25')]);if(_0x333f3d[_0xb4fb('0x26')]){delete _0x333f3d[_0xb4fb('0x26')];}_0x48fb55['status'](_0xa71b7c)[_0xb4fb('0x27')](_0x333f3d);};}exports[_0xb4fb('0x28')]=function(_0x535bc6,_0x204c6f){var _0x5e58c0={},_0x3ca4ba={},_0x5d37a0={'count':0x0,'rows':[]};var _0x140691=_[_0xb4fb('0x29')](db[_0xb4fb('0x2a')][_0xb4fb('0x2b')],function(_0x397695){return{'name':_0x397695[_0xb4fb('0x2c')],'type':_0x397695[_0xb4fb('0x2d')]['key']};});_0x3ca4ba[_0xb4fb('0x2e')]=_['map'](_0x140691,'name');_0x3ca4ba['query']=_['keys'](_0x535bc6[_0xb4fb('0x2f')]);_0x3ca4ba[_0xb4fb('0x30')]=_[_0xb4fb('0x31')](_0x3ca4ba[_0xb4fb('0x2e')],_0x3ca4ba[_0xb4fb('0x2f')]);_0x5e58c0[_0xb4fb('0x32')]=_['intersection'](_0x3ca4ba['model'],qs[_0xb4fb('0x33')](_0x535bc6[_0xb4fb('0x2f')][_0xb4fb('0x33')]));_0x5e58c0[_0xb4fb('0x32')]=_0x5e58c0[_0xb4fb('0x32')][_0xb4fb('0x34')]?_0x5e58c0['attributes']:_0x3ca4ba['model'];if(!_0x535bc6[_0xb4fb('0x2f')][_0xb4fb('0x35')](_0xb4fb('0x36'))){_0x5e58c0['limit']=qs[_0xb4fb('0x1c')](_0x535bc6['query'][_0xb4fb('0x1c')]);_0x5e58c0[_0xb4fb('0x1a')]=qs['offset'](_0x535bc6[_0xb4fb('0x2f')]['offset']);}_0x5e58c0['order']=qs['sort'](_0x535bc6['query'][_0xb4fb('0x37')]);_0x5e58c0[_0xb4fb('0x38')]=qs['filters'](_[_0xb4fb('0x39')](_0x535bc6[_0xb4fb('0x2f')],_0x3ca4ba[_0xb4fb('0x30')]),_0x140691);if(_0x535bc6['query']['filter']){_0x5e58c0['where']=_['merge'](_0x5e58c0['where'],{'$or':_[_0xb4fb('0x29')](_0x140691,function(_0x138c4f){if(_0x138c4f['type']!==_0xb4fb('0x3a')){var _0x2786c3={};_0x2786c3[_0x138c4f[_0xb4fb('0x26')]]={'$like':'%'+_0x535bc6['query'][_0xb4fb('0x3b')]+'%'};return _0x2786c3;}})});}_0x5e58c0=_[_0xb4fb('0x3c')]({},_0x5e58c0,_0x535bc6[_0xb4fb('0x3d')]);var _0x222bc6={'where':_0x5e58c0[_0xb4fb('0x38')]};return db[_0xb4fb('0x2a')][_0xb4fb('0x1d')](_0x222bc6)[_0xb4fb('0x3e')](function(_0x265c72){_0x5d37a0['count']=_0x265c72;if(_0x535bc6[_0xb4fb('0x2f')]['includeAll']){_0x5e58c0[_0xb4fb('0x3f')]=[{'all':!![]}];}return db[_0xb4fb('0x2a')]['findAll'](_0x5e58c0);})[_0xb4fb('0x3e')](function(_0x1aa41c){_0x5d37a0['rows']=_0x1aa41c;return _0x5d37a0;})[_0xb4fb('0x3e')](respondWithFilteredResult(_0x204c6f,_0x5e58c0))[_0xb4fb('0x40')](handleError(_0x204c6f,null));};exports[_0xb4fb('0x41')]=function(_0x3f4fc3,_0x445dfb){var _0x5f0295={'raw':!![],'where':{'id':_0x3f4fc3[_0xb4fb('0x42')]['id']}},_0x31da3e={};_0x31da3e['model']=_['keys'](db[_0xb4fb('0x2a')][_0xb4fb('0x2b')]);_0x31da3e[_0xb4fb('0x2f')]=_[_0xb4fb('0x43')](_0x3f4fc3[_0xb4fb('0x2f')]);_0x31da3e['filters']=_[_0xb4fb('0x31')](_0x31da3e[_0xb4fb('0x2e')],_0x31da3e[_0xb4fb('0x2f')]);_0x5f0295['attributes']=_[_0xb4fb('0x31')](_0x31da3e[_0xb4fb('0x2e')],qs[_0xb4fb('0x33')](_0x3f4fc3['query'][_0xb4fb('0x33')]));_0x5f0295['attributes']=_0x5f0295[_0xb4fb('0x32')][_0xb4fb('0x34')]?_0x5f0295[_0xb4fb('0x32')]:_0x31da3e[_0xb4fb('0x2e')];if(_0x3f4fc3[_0xb4fb('0x2f')][_0xb4fb('0x44')]){_0x5f0295[_0xb4fb('0x3f')]=[{'all':!![]}];}_0x5f0295=_[_0xb4fb('0x3c')]({},_0x5f0295,_0x3f4fc3['options']);return db[_0xb4fb('0x2a')][_0xb4fb('0x45')](_0x5f0295)[_0xb4fb('0x3e')](handleEntityNotFound(_0x445dfb,null))[_0xb4fb('0x3e')](respondWithResult(_0x445dfb,null))[_0xb4fb('0x40')](handleError(_0x445dfb,null));};exports['create']=function(_0x5cc232,_0x5a5b4c){return db['FaxApplication']['create'](_0x5cc232[_0xb4fb('0x46')],{})[_0xb4fb('0x3e')](respondWithResult(_0x5a5b4c,0xc9))[_0xb4fb('0x40')](handleError(_0x5a5b4c,null));};exports[_0xb4fb('0x22')]=function(_0x5a465d,_0x35ae52){if(_0x5a465d[_0xb4fb('0x46')]['id']){delete _0x5a465d['body']['id'];}return db['FaxApplication'][_0xb4fb('0x45')]({'where':{'id':_0x5a465d[_0xb4fb('0x42')]['id']}})[_0xb4fb('0x3e')](handleEntityNotFound(_0x35ae52,null))[_0xb4fb('0x3e')](saveUpdates(_0x5a465d[_0xb4fb('0x46')],null))[_0xb4fb('0x3e')](respondWithResult(_0x35ae52,null))[_0xb4fb('0x40')](handleError(_0x35ae52,null));};exports[_0xb4fb('0x23')]=function(_0x136e19,_0x43e2d5){return db['FaxApplication']['find']({'where':{'id':_0x136e19['params']['id']}})[_0xb4fb('0x3e')](handleEntityNotFound(_0x43e2d5,null))['then'](removeEntity(_0x43e2d5,null))[_0xb4fb('0x40')](handleError(_0x43e2d5,null));}; \ No newline at end of file +var _0xa958=['offset','undefined','limit','count','set','apply','reject','save','destroy','then','end','error','stack','name','send','FaxApplication','rawAttributes','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','find','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x3c8fdc,_0x2c52ee){var _0x1849c3=function(_0x400e47){while(--_0x400e47){_0x3c8fdc['push'](_0x3c8fdc['shift']());}};_0x1849c3(++_0x2c52ee);}(_0xa958,0x1a2));var _0x8a95=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xa958[_0x33032e];return _0x13316b;};'use strict';var emlformat=require(_0x8a95('0x0'));var rimraf=require(_0x8a95('0x1'));var zipdir=require(_0x8a95('0x2'));var jsonpatch=require(_0x8a95('0x3'));var rp=require(_0x8a95('0x4'));var moment=require(_0x8a95('0x5'));var BPromise=require(_0x8a95('0x6'));var Mustache=require(_0x8a95('0x7'));var util=require(_0x8a95('0x8'));var path=require(_0x8a95('0x9'));var sox=require('sox');var csv=require(_0x8a95('0xa'));var ejs=require(_0x8a95('0xb'));var fs=require('fs');var fs_extra=require(_0x8a95('0xc'));var _=require(_0x8a95('0xd'));var squel=require(_0x8a95('0xe'));var crypto=require('crypto');var jsforce=require(_0x8a95('0xf'));var deskjs=require(_0x8a95('0x10'));var toCsv=require(_0x8a95('0xa'));var querystring=require(_0x8a95('0x11'));var Papa=require(_0x8a95('0x12'));var Redis=require(_0x8a95('0x13'));var authService=require(_0x8a95('0x14'));var qs=require(_0x8a95('0x15'));var as=require(_0x8a95('0x16'));var hardwareService=require(_0x8a95('0x17'));var logger=require(_0x8a95('0x18'))(_0x8a95('0x19'));var utils=require('../../config/utils');var config=require(_0x8a95('0x1a'));var licenseUtil=require(_0x8a95('0x1b'));var db=require(_0x8a95('0x1c'))['db'];function respondWithStatusCode(_0x2bf9cf,_0x4c60d6){_0x4c60d6=_0x4c60d6||0xcc;return function(_0x39e079){if(_0x39e079){return _0x2bf9cf[_0x8a95('0x1d')](_0x4c60d6);}return _0x2bf9cf[_0x8a95('0x1e')](_0x4c60d6)['end']();};}function respondWithResult(_0x5e2dac,_0x3c6f52){_0x3c6f52=_0x3c6f52||0xc8;return function(_0xfe1a5e){if(_0xfe1a5e){return _0x5e2dac[_0x8a95('0x1e')](_0x3c6f52)[_0x8a95('0x1f')](_0xfe1a5e);}};}function respondWithFilteredResult(_0x276254,_0x4d95b9){return function(_0x127b73){if(_0x127b73){var _0x58b192=typeof _0x4d95b9[_0x8a95('0x20')]===_0x8a95('0x21')&&typeof _0x4d95b9[_0x8a95('0x22')]===_0x8a95('0x21');var _0x10482c=_0x127b73[_0x8a95('0x23')];var _0x11a51f=_0x58b192?0x0:_0x4d95b9[_0x8a95('0x20')];var _0x559132=_0x58b192?_0x127b73['count']:_0x4d95b9[_0x8a95('0x20')]+_0x4d95b9[_0x8a95('0x22')];var _0x2aa6b9;if(_0x559132>=_0x10482c){_0x559132=_0x10482c;_0x2aa6b9=0xc8;}else{_0x2aa6b9=0xce;}_0x276254[_0x8a95('0x1e')](_0x2aa6b9);return _0x276254[_0x8a95('0x24')]('Content-Range',_0x11a51f+'-'+_0x559132+'/'+_0x10482c)[_0x8a95('0x1f')](_0x127b73);}return null;};}function patchUpdates(_0x42380c){return function(_0x3b7c0c){try{jsonpatch[_0x8a95('0x25')](_0x3b7c0c,_0x42380c,!![]);}catch(_0x228aa9){return BPromise[_0x8a95('0x26')](_0x228aa9);}return _0x3b7c0c[_0x8a95('0x27')]();};}function saveUpdates(_0x298a50,_0x58d00d){return function(_0x55c9c1){if(_0x55c9c1){return _0x55c9c1['update'](_0x298a50)['then'](function(_0x27daa6){return _0x27daa6;});}return null;};}function removeEntity(_0xc3fcd1,_0x4e3701){return function(_0x12914e){if(_0x12914e){return _0x12914e[_0x8a95('0x28')]()[_0x8a95('0x29')](function(){_0xc3fcd1[_0x8a95('0x1e')](0xcc)[_0x8a95('0x2a')]();});}};}function handleEntityNotFound(_0xbaafd,_0x271e2b){return function(_0x195243){if(!_0x195243){_0xbaafd[_0x8a95('0x1d')](0x194);}return _0x195243;};}function handleError(_0x4076f4,_0x1b4c03){_0x1b4c03=_0x1b4c03||0x1f4;return function(_0xe0bdcd){logger[_0x8a95('0x2b')](_0xe0bdcd[_0x8a95('0x2c')]);if(_0xe0bdcd[_0x8a95('0x2d')]){delete _0xe0bdcd[_0x8a95('0x2d')];}_0x4076f4['status'](_0x1b4c03)[_0x8a95('0x2e')](_0xe0bdcd);};}exports['index']=function(_0x4816d5,_0xb922f9){var _0x5b90ef={},_0x4c15e1={},_0x111183={'count':0x0,'rows':[]};var _0x2b3c2d=_['map'](db[_0x8a95('0x2f')][_0x8a95('0x30')],function(_0x10b58e){return{'name':_0x10b58e[_0x8a95('0x31')],'type':_0x10b58e[_0x8a95('0x32')][_0x8a95('0x33')]};});_0x4c15e1[_0x8a95('0x34')]=_['map'](_0x2b3c2d,_0x8a95('0x2d'));_0x4c15e1['query']=_['keys'](_0x4816d5[_0x8a95('0x35')]);_0x4c15e1['filters']=_[_0x8a95('0x36')](_0x4c15e1[_0x8a95('0x34')],_0x4c15e1['query']);_0x5b90ef['attributes']=_[_0x8a95('0x36')](_0x4c15e1[_0x8a95('0x34')],qs[_0x8a95('0x37')](_0x4816d5[_0x8a95('0x35')][_0x8a95('0x37')]));_0x5b90ef['attributes']=_0x5b90ef['attributes'][_0x8a95('0x38')]?_0x5b90ef[_0x8a95('0x39')]:_0x4c15e1[_0x8a95('0x34')];if(!_0x4816d5[_0x8a95('0x35')][_0x8a95('0x3a')](_0x8a95('0x3b'))){_0x5b90ef['limit']=qs[_0x8a95('0x22')](_0x4816d5['query']['limit']);_0x5b90ef[_0x8a95('0x20')]=qs[_0x8a95('0x20')](_0x4816d5[_0x8a95('0x35')]['offset']);}_0x5b90ef['order']=qs[_0x8a95('0x3c')](_0x4816d5[_0x8a95('0x35')][_0x8a95('0x3c')]);_0x5b90ef[_0x8a95('0x3d')]=qs[_0x8a95('0x3e')](_[_0x8a95('0x3f')](_0x4816d5[_0x8a95('0x35')],_0x4c15e1[_0x8a95('0x3e')]),_0x2b3c2d);if(_0x4816d5[_0x8a95('0x35')]['filter']){_0x5b90ef[_0x8a95('0x3d')]=_[_0x8a95('0x40')](_0x5b90ef['where'],{'$or':_['map'](_0x2b3c2d,function(_0x4f6415){if(_0x4f6415[_0x8a95('0x32')]!==_0x8a95('0x41')){var _0x43eee1={};_0x43eee1[_0x4f6415[_0x8a95('0x2d')]]={'$like':'%'+_0x4816d5['query']['filter']+'%'};return _0x43eee1;}})});}_0x5b90ef=_['merge']({},_0x5b90ef,_0x4816d5[_0x8a95('0x42')]);var _0x3fbe56={'where':_0x5b90ef['where']};return db[_0x8a95('0x2f')]['count'](_0x3fbe56)[_0x8a95('0x29')](function(_0x44e6ae){_0x111183['count']=_0x44e6ae;if(_0x4816d5[_0x8a95('0x35')][_0x8a95('0x43')]){_0x5b90ef[_0x8a95('0x44')]=[{'all':!![]}];}return db[_0x8a95('0x2f')]['findAll'](_0x5b90ef);})[_0x8a95('0x29')](function(_0x250371){_0x111183[_0x8a95('0x45')]=_0x250371;return _0x111183;})[_0x8a95('0x29')](respondWithFilteredResult(_0xb922f9,_0x5b90ef))[_0x8a95('0x46')](handleError(_0xb922f9,null));};exports['show']=function(_0x40b1af,_0x462c71){var _0x136bd5={'raw':!![],'where':{'id':_0x40b1af['params']['id']}},_0x88fc38={};_0x88fc38['model']=_['keys'](db['FaxApplication'][_0x8a95('0x30')]);_0x88fc38[_0x8a95('0x35')]=_['keys'](_0x40b1af[_0x8a95('0x35')]);_0x88fc38[_0x8a95('0x3e')]=_[_0x8a95('0x36')](_0x88fc38['model'],_0x88fc38[_0x8a95('0x35')]);_0x136bd5['attributes']=_['intersection'](_0x88fc38[_0x8a95('0x34')],qs[_0x8a95('0x37')](_0x40b1af[_0x8a95('0x35')][_0x8a95('0x37')]));_0x136bd5[_0x8a95('0x39')]=_0x136bd5[_0x8a95('0x39')][_0x8a95('0x38')]?_0x136bd5[_0x8a95('0x39')]:_0x88fc38[_0x8a95('0x34')];if(_0x40b1af['query'][_0x8a95('0x43')]){_0x136bd5['include']=[{'all':!![]}];}_0x136bd5=_[_0x8a95('0x40')]({},_0x136bd5,_0x40b1af[_0x8a95('0x42')]);return db[_0x8a95('0x2f')][_0x8a95('0x47')](_0x136bd5)[_0x8a95('0x29')](handleEntityNotFound(_0x462c71,null))[_0x8a95('0x29')](respondWithResult(_0x462c71,null))[_0x8a95('0x46')](handleError(_0x462c71,null));};exports['create']=function(_0x8f272a,_0x4c5c16){return db[_0x8a95('0x2f')]['create'](_0x8f272a[_0x8a95('0x48')],{})[_0x8a95('0x29')](respondWithResult(_0x4c5c16,0xc9))[_0x8a95('0x46')](handleError(_0x4c5c16,null));};exports[_0x8a95('0x49')]=function(_0x1c575b,_0x261302){if(_0x1c575b[_0x8a95('0x48')]['id']){delete _0x1c575b[_0x8a95('0x48')]['id'];}return db['FaxApplication'][_0x8a95('0x47')]({'where':{'id':_0x1c575b[_0x8a95('0x4a')]['id']}})[_0x8a95('0x29')](handleEntityNotFound(_0x261302,null))['then'](saveUpdates(_0x1c575b[_0x8a95('0x48')],null))[_0x8a95('0x29')](respondWithResult(_0x261302,null))[_0x8a95('0x46')](handleError(_0x261302,null));};exports['destroy']=function(_0x3265e7,_0x4293cc){return db[_0x8a95('0x2f')][_0x8a95('0x47')]({'where':{'id':_0x3265e7[_0x8a95('0x4a')]['id']}})[_0x8a95('0x29')](handleEntityNotFound(_0x4293cc,null))[_0x8a95('0x29')](removeEntity(_0x4293cc,null))['catch'](handleError(_0x4293cc,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index bf4b9ab..d1fd3cd 100644 --- a/server/api/faxApplication/faxApplication.model.js +++ b/server/api/faxApplication/faxApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55c3=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','request-promise','path'];(function(_0x2e189c,_0x1cf07b){var _0x5bfc41=function(_0x302f76){while(--_0x302f76){_0x2e189c['push'](_0x2e189c['shift']());}};_0x5bfc41(++_0x1cf07b);}(_0x55c3,0x168));var _0x355c=function(_0x1d4bcc,_0x3d0692){_0x1d4bcc=_0x1d4bcc-0x0;var _0x3f00c6=_0x55c3[_0x1d4bcc];return _0x3f00c6;};'use strict';var _=require(_0x355c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x355c('0x1'));var fs=require('fs');var path=require(_0x355c('0x2'));var rimraf=require(_0x355c('0x3'));var config=require(_0x355c('0x4'));var attributes=require(_0x355c('0x5'));module[_0x355c('0x6')]=function(_0x16b1da,_0x2428c3){return _0x16b1da[_0x355c('0x7')](_0x355c('0x8'),attributes,{'tableName':_0x355c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x355c('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc5ec=['bluebird','path','rimraf','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0xc5ec,0x17b));var _0xcc5e=function(_0x4f7d20,_0x310739){_0x4f7d20=_0x4f7d20-0x0;var _0x3e572c=_0xc5ec[_0x4f7d20];return _0x3e572c;};'use strict';var _=require(_0xcc5e('0x0'));var util=require(_0xcc5e('0x1'));var logger=require(_0xcc5e('0x2'))(_0xcc5e('0x3'));var moment=require(_0xcc5e('0x4'));var BPromise=require(_0xcc5e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc5e('0x6'));var rimraf=require(_0xcc5e('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc5e('0x8'));module['exports']=function(_0xcebd5d,_0x48d2dd){return _0xcebd5d['define'](_0xcc5e('0x9'),attributes,{'tableName':_0xcc5e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xcc5e('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 96e3161..03fd724 100644 --- a/server/api/faxApplication/faxApplication.rpc.js +++ b/server/api/faxApplication/faxApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf203=['lodash','util','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','catch','FaxApplication','options','raw','where','then','UpdateFaxApplication'];(function(_0x470d17,_0x32e508){var _0xd6558d=function(_0x23f372){while(--_0x23f372){_0x470d17['push'](_0x470d17['shift']());}};_0xd6558d(++_0x32e508);}(_0xf203,0x190));var _0x3f20=function(_0x1576ff,_0x1c8eab){_0x1576ff=_0x1576ff-0x0;var _0x4c2d70=_0xf203[_0x1576ff];return _0x4c2d70;};'use strict';var _=require(_0x3f20('0x0'));var util=require(_0x3f20('0x1'));var moment=require('moment');var BPromise=require(_0x3f20('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f20('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f20('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3f20('0x5'));var client=jayson[_0x3f20('0x6')][_0x3f20('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5128fa,_0x4b6890,_0xc63803){return new BPromise(function(_0x3df6e,_0x3e0cd0){return client[_0x3f20('0x8')](_0x5128fa,_0xc63803)['then'](function(_0x528c12){logger['info'](_0x3f20('0x9'),_0x4b6890,'request\x20sent');logger[_0x3f20('0xa')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4b6890,_0x3f20('0xb'),JSON[_0x3f20('0xc')](_0x528c12));if(_0x528c12['error']){if(_0x528c12['error'][_0x3f20('0xd')]===0x1f4){logger[_0x3f20('0xe')](_0x3f20('0x9'),_0x4b6890,_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);return _0x3e0cd0(_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x4b6890,_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);return _0x3df6e(_0x528c12[_0x3f20('0xe')][_0x3f20('0xf')]);}else{logger[_0x3f20('0x10')]('FaxApplication,\x20%s,\x20%s',_0x4b6890,_0x3f20('0xb'));_0x3df6e(_0x528c12[_0x3f20('0x11')][_0x3f20('0xf')]);}})[_0x3f20('0x12')](function(_0x534220){logger['error'](_0x3f20('0x9'),_0x4b6890,_0x534220);_0x3e0cd0(_0x534220);});});}exports['UpdateFaxApplication']=function(_0x1041ef){var _0xe8821a=this;return new Promise(function(_0x5820a4,_0x31de2e){return db[_0x3f20('0x13')]['update'](_0x1041ef['body'],{'raw':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')][_0x3f20('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')][_0x3f20('0x16')]||null:null,'attributes':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')]['attributes']||null:null,'limit':_0x1041ef[_0x3f20('0x14')]?_0x1041ef[_0x3f20('0x14')]['limit']||null:null})[_0x3f20('0x17')](function(_0x431a1c){logger[_0x3f20('0x10')](_0x3f20('0x18'),_0x1041ef);logger[_0x3f20('0xa')](_0x3f20('0x18'),_0x1041ef,JSON['stringify'](_0x431a1c));_0x5820a4(_0x431a1c);})[_0x3f20('0x12')](function(_0x56d45b){logger['error'](_0x3f20('0x18'),_0x56d45b[_0x3f20('0xf')],_0x1041ef);_0x31de2e(_0xe8821a[_0x3f20('0xe')](0x1f4,_0x56d45b[_0x3f20('0xf')]));});});}; \ No newline at end of file +var _0xd97f=['stringify','error','code','message','result','catch','UpdateFaxApplication','update','options','raw','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s'];(function(_0x7574d9,_0x4c60ff){var _0x57003f=function(_0x331317){while(--_0x331317){_0x7574d9['push'](_0x7574d9['shift']());}};_0x57003f(++_0x4c60ff);}(_0xd97f,0x15c));var _0xfd97=function(_0x1257e7,_0x2f1e33){_0x1257e7=_0x1257e7-0x0;var _0x1ce636=_0xd97f[_0x1257e7];return _0x1ce636;};'use strict';var _=require(_0xfd97('0x0'));var util=require(_0xfd97('0x1'));var moment=require(_0xfd97('0x2'));var BPromise=require(_0xfd97('0x3'));var rs=require(_0xfd97('0x4'));var fs=require('fs');var Redis=require(_0xfd97('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd97('0x6'))('rpc');var config=require(_0xfd97('0x7'));var jayson=require(_0xfd97('0x8'));var client=jayson[_0xfd97('0x9')][_0xfd97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x449182,_0x412e1e,_0x48aa44){return new BPromise(function(_0x20f6a1,_0x5ee828){return client[_0xfd97('0xb')](_0x449182,_0x48aa44)[_0xfd97('0xc')](function(_0x577683){logger['info'](_0xfd97('0xd'),_0x412e1e,_0xfd97('0xe'));logger['debug'](_0xfd97('0xf'),_0x412e1e,_0xfd97('0xe'),JSON[_0xfd97('0x10')](_0x577683));if(_0x577683[_0xfd97('0x11')]){if(_0x577683[_0xfd97('0x11')][_0xfd97('0x12')]===0x1f4){logger['error'](_0xfd97('0xd'),_0x412e1e,_0x577683[_0xfd97('0x11')][_0xfd97('0x13')]);return _0x5ee828(_0x577683[_0xfd97('0x11')]['message']);}logger[_0xfd97('0x11')]('FaxApplication,\x20%s,\x20%s',_0x412e1e,_0x577683[_0xfd97('0x11')][_0xfd97('0x13')]);return _0x20f6a1(_0x577683[_0xfd97('0x11')][_0xfd97('0x13')]);}else{logger['info'](_0xfd97('0xd'),_0x412e1e,_0xfd97('0xe'));_0x20f6a1(_0x577683[_0xfd97('0x14')][_0xfd97('0x13')]);}})[_0xfd97('0x15')](function(_0x1c2cc3){logger[_0xfd97('0x11')](_0xfd97('0xd'),_0x412e1e,_0x1c2cc3);_0x5ee828(_0x1c2cc3);});});}exports[_0xfd97('0x16')]=function(_0x591834){var _0x91ea4b=this;return new Promise(function(_0x45f605,_0x5ce2f5){return db['FaxApplication'][_0xfd97('0x17')](_0x591834['body'],{'raw':_0x591834[_0xfd97('0x18')]?_0x591834['options'][_0xfd97('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x591834[_0xfd97('0x18')]?_0x591834[_0xfd97('0x18')][_0xfd97('0x1a')]||null:null,'attributes':_0x591834[_0xfd97('0x18')]?_0x591834[_0xfd97('0x18')]['attributes']||null:null,'limit':_0x591834[_0xfd97('0x18')]?_0x591834['options']['limit']||null:null})[_0xfd97('0xc')](function(_0x1cb7fa){logger['info']('UpdateFaxApplication',_0x591834);logger[_0xfd97('0x1b')]('UpdateFaxApplication',_0x591834,JSON[_0xfd97('0x10')](_0x1cb7fa));_0x45f605(_0x1cb7fa);})[_0xfd97('0x15')](function(_0x9620aa){logger[_0xfd97('0x11')](_0xfd97('0x16'),_0x9620aa[_0xfd97('0x13')],_0x591834);_0x5ce2f5(_0x91ea4b[_0xfd97('0x11')](0x1f4,_0x9620aa['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index f9ca6ed..3bb1ce9 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80ed=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x80ed,0x11c));var _0xd80e=function(_0x54c2fe,_0x2b2633){_0x54c2fe=_0x54c2fe-0x0;var _0xc6176e=_0x80ed[_0x54c2fe];return _0xc6176e;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./faxApplication.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0xd')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0xf')](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x10')]);router['delete'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);module[_0xd80e('0x12')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x22a8da,_0x383461){var _0x5a3846=function(_0x459902){while(--_0x459902){_0x22a8da['push'](_0x22a8da['shift']());}};_0x5a3846(++_0x383461);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb7e7[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b568f8f..d99c0de 100644 --- a/server/api/faxInteraction/faxInteraction.attributes.js +++ b/server/api/faxInteraction/faxInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe5=['STRING','out','DATE','sequelize','exports','BOOLEAN'];(function(_0x2f36d2,_0x24285c){var _0x147f7f=function(_0x41db50){while(--_0x41db50){_0x2f36d2['push'](_0x2f36d2['shift']());}};_0x147f7f(++_0x24285c);}(_0xefe5,0xc9));var _0x5efe=function(_0x463a63,_0x58b4e0){_0x463a63=_0x463a63-0x0;var _0x4fa922=_0xefe5[_0x463a63];return _0x4fa922;};'use strict';var Sequelize=require(_0x5efe('0x0'));module[_0x5efe('0x1')]={'closed':{'type':Sequelize[_0x5efe('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5efe('0x3')]},'note':{'type':Sequelize[_0x5efe('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x5efe('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5efe('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5efe('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xbed9=['ENUM','out','sequelize','exports','DATE','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbed9,0x7a));var _0x9bed=function(_0x14a06b,_0x5c1afb){_0x14a06b=_0x14a06b-0x0;var _0x29bda5=_0xbed9[_0x14a06b];return _0x29bda5;};'use strict';var Sequelize=require(_0x9bed('0x0'));module[_0x9bed('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9bed('0x2')]},'disposition':{'type':Sequelize[_0x9bed('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9bed('0x3')]},'note':{'type':Sequelize[_0x9bed('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x9bed('0x4')]('in',_0x9bed('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9bed('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8ad1845..51e56e4 100644 --- a/server/api/faxInteraction/faxInteraction.controller.js +++ b/server/api/faxInteraction/faxInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bd2=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','total','UserId','closed','answered','unmanaged','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','includeAll','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','merge','options','include','findAll','setTags','omit','Tag','emit','faxInteractionTags:save','removeTags','download','root','files','tmp','join','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','createWriteStream','resolve','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x56db82,_0x29cfaf){var _0x2e8232=function(_0x2b5bbb){while(--_0x2b5bbb){_0x56db82['push'](_0x56db82['shift']());}};_0x2e8232(++_0x29cfaf);}(_0x3bd2,0x1b9));var _0x23bd=function(_0x54002a,_0x1b4d38){_0x54002a=_0x54002a-0x0;var _0x129d66=_0x3bd2[_0x54002a];return _0x129d66;};'use strict';var emlformat=require(_0x23bd('0x0'));var rimraf=require(_0x23bd('0x1'));var zipdir=require(_0x23bd('0x2'));var jsonpatch=require(_0x23bd('0x3'));var rp=require(_0x23bd('0x4'));var moment=require(_0x23bd('0x5'));var BPromise=require(_0x23bd('0x6'));var Mustache=require('mustache');var util=require(_0x23bd('0x7'));var path=require(_0x23bd('0x8'));var sox=require(_0x23bd('0x9'));var csv=require(_0x23bd('0xa'));var ejs=require(_0x23bd('0xb'));var fs=require('fs');var fs_extra=require(_0x23bd('0xc'));var _=require(_0x23bd('0xd'));var squel=require(_0x23bd('0xe'));var crypto=require(_0x23bd('0xf'));var jsforce=require(_0x23bd('0x10'));var deskjs=require(_0x23bd('0x11'));var toCsv=require(_0x23bd('0xa'));var querystring=require('querystring');var Papa=require(_0x23bd('0x12'));var Redis=require(_0x23bd('0x13'));var authService=require(_0x23bd('0x14'));var qs=require(_0x23bd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23bd('0x16'));var logger=require(_0x23bd('0x17'))(_0x23bd('0x18'));var utils=require(_0x23bd('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x23bd('0x1a'));var db=require(_0x23bd('0x1b'))['db'];config[_0x23bd('0x1c')]=_[_0x23bd('0x1d')](config[_0x23bd('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x23bd('0x1e'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0x23bd('0x1f')](socket);function respondWithStatusCode(_0x42a72b,_0xe63e45){_0xe63e45=_0xe63e45||0xcc;return function(_0x34875d){if(_0x34875d){return _0x42a72b[_0x23bd('0x20')](_0xe63e45);}return _0x42a72b[_0x23bd('0x21')](_0xe63e45)[_0x23bd('0x22')]();};}function respondWithResult(_0x3dfd0a,_0x10673c){_0x10673c=_0x10673c||0xc8;return function(_0x42ff3f){if(_0x42ff3f){return _0x3dfd0a[_0x23bd('0x21')](_0x10673c)['json'](_0x42ff3f);}};}function respondWithFilteredResult(_0x3f9c18,_0x46b6a1){return function(_0x4ab295){if(_0x4ab295){var _0x1cedd2=typeof _0x46b6a1[_0x23bd('0x23')]===_0x23bd('0x24')&&typeof _0x46b6a1[_0x23bd('0x25')]===_0x23bd('0x24');var _0x33d944=_0x4ab295[_0x23bd('0x26')];var _0x4a182a=_0x1cedd2?0x0:_0x46b6a1[_0x23bd('0x23')];var _0x3c211c=_0x1cedd2?_0x4ab295['count']:_0x46b6a1[_0x23bd('0x23')]+_0x46b6a1[_0x23bd('0x25')];var _0x16ab83;if(_0x3c211c>=_0x33d944){_0x3c211c=_0x33d944;_0x16ab83=0xc8;}else{_0x16ab83=0xce;}_0x3f9c18[_0x23bd('0x21')](_0x16ab83);return _0x3f9c18['set']('Content-Range',_0x4a182a+'-'+_0x3c211c+'/'+_0x33d944)[_0x23bd('0x27')](_0x4ab295);}return null;};}function patchUpdates(_0x1ab986){return function(_0x36ff97){try{jsonpatch['apply'](_0x36ff97,_0x1ab986,!![]);}catch(_0x138507){return BPromise[_0x23bd('0x28')](_0x138507);}return _0x36ff97[_0x23bd('0x29')]();};}function saveUpdates(_0x56a6ee,_0x4cf5f8){return function(_0x2e42ff){if(_0x2e42ff){return _0x2e42ff[_0x23bd('0x2a')](_0x56a6ee)[_0x23bd('0x2b')](function(_0x123306){return _0x123306;});}return null;};}function removeEntity(_0x51bbcf,_0x4aa86b){return function(_0x33d56b){if(_0x33d56b){return _0x33d56b['destroy']()['then'](function(){_0x51bbcf[_0x23bd('0x21')](0xcc)[_0x23bd('0x22')]();});}};}function handleEntityNotFound(_0x95bb74,_0x4d23c6){return function(_0x371f52){if(!_0x371f52){_0x95bb74[_0x23bd('0x20')](0x194);}return _0x371f52;};}function handleError(_0x1b2d07,_0x3b0f87){_0x3b0f87=_0x3b0f87||0x1f4;return function(_0x462d0b){logger[_0x23bd('0x2c')](_0x462d0b[_0x23bd('0x2d')]);if(_0x462d0b[_0x23bd('0x2e')]){delete _0x462d0b[_0x23bd('0x2e')];}_0x1b2d07[_0x23bd('0x21')](_0x3b0f87)[_0x23bd('0x2f')](_0x462d0b);};}function getInteractionUsers(_0x1f018e,_0x2602ac){return new BPromise(function(_0x446239,_0xf1674a){try{if(_0x2602ac[_0x1f018e['id']]){_0x1f018e[_0x23bd('0x30')]=_[_0x23bd('0x31')](_0x2602ac[_0x1f018e['id']],function(_0x1eafa8){return{'id':_0x1eafa8['id'],'fullname':_0x1eafa8[_0x23bd('0x32')]};});}}catch(_0x2b1cb8){_0xf1674a(_0x2b1cb8);}_0x446239(_0x1f018e);});}function getInteractionTags(_0x16164a,_0x30011a){return new BPromise(function(_0x21370d,_0x444da0){try{if(_0x16164a[_0x23bd('0x33')]){_0x16164a[_0x23bd('0x34')]=[];_0x16164a[_0x23bd('0x33')][_0x23bd('0x35')](',')[_0x23bd('0x36')](function(_0x3a80ef){_0x16164a['Tags'][_0x23bd('0x37')](_0x30011a[_0x3a80ef]);});}delete _0x16164a[_0x23bd('0x33')];}catch(_0x5c937d){_0x444da0(_0x5c937d);}_0x21370d(_0x16164a);});}function updateFaxInteraction(_0x20e25c,_0x2a13d8,_0x1ec1bb){return new BPromise(function(_0x2cd0fc,_0x537d0f){return getInteractionUsers(_0x20e25c,_0x1ec1bb)[_0x23bd('0x2b')](function(_0x120264){return getInteractionTags(_0x120264,_0x2a13d8);})[_0x23bd('0x2b')](function(_0x1ccc64){return getStateInteraction(_0x1ccc64);})[_0x23bd('0x2b')](function(_0x4a6298){_0x2cd0fc(_0x4a6298);})[_0x23bd('0x38')](function(_0x1f7c80){_0x537d0f(_0x1f7c80);});});}function getStateInteraction(_0x3e59cb){return new BPromise(function(_0x5b5754){_0x3e59cb[_0x23bd('0x39')]=0x0;_0x3e59cb[_0x23bd('0x3a')]=0x0;_0x3e59cb['answered']=0x0;_0x3e59cb['unmanaged']=0x0;_0x3e59cb[_0x23bd('0x3b')]=0x0;if(!_0x3e59cb['closed']&&!_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x39')]+=0x1;}if(!_0x3e59cb[_0x23bd('0x3d')]&&_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3a')]+=0x1;if(_0x3e59cb[_0x23bd('0x39')]){_0x3e59cb[_0x23bd('0x39')]-=0x1;}}if(_0x3e59cb[_0x23bd('0x3d')]&&_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3e')]+=0x1;if(_0x3e59cb[_0x23bd('0x3a')]){_0x3e59cb[_0x23bd('0x3a')]-=0x1;}}if(_0x3e59cb[_0x23bd('0x3d')]&&!_0x3e59cb[_0x23bd('0x3c')]){_0x3e59cb[_0x23bd('0x3f')]+=0x1;if(_0x3e59cb[_0x23bd('0x39')]){_0x3e59cb['waiting']-=0x1;}}_0x3e59cb[_0x23bd('0x3b')]+=0x1;_0x5b5754(_0x3e59cb);});}exports[_0x23bd('0x40')]=function(_0x4da852,_0x445fe0){var _0x54acb5={},_0x26b830={},_0x4900ce={'count':0x0,'rows':[]};var _0x1489b9=_['map'](db['FaxInteraction'][_0x23bd('0x41')],function(_0x1f2d7d){return{'name':_0x1f2d7d[_0x23bd('0x42')],'type':_0x1f2d7d[_0x23bd('0x43')][_0x23bd('0x44')]};});_0x26b830[_0x23bd('0x45')]=_[_0x23bd('0x31')](_0x1489b9,'name');_0x26b830[_0x23bd('0x46')]=_[_0x23bd('0x47')](_0x4da852[_0x23bd('0x46')]);_0x26b830[_0x23bd('0x48')]=_[_0x23bd('0x49')](_0x26b830[_0x23bd('0x45')],_0x26b830[_0x23bd('0x46')]);_0x54acb5['attributes']=_[_0x23bd('0x49')](_0x26b830[_0x23bd('0x45')],qs['fields'](_0x4da852[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x54acb5[_0x23bd('0x4b')]=_0x54acb5[_0x23bd('0x4b')]['length']?_0x54acb5[_0x23bd('0x4b')]:_0x26b830[_0x23bd('0x45')];if(!_0x4da852[_0x23bd('0x46')][_0x23bd('0x4c')](_0x23bd('0x4d'))){_0x54acb5[_0x23bd('0x25')]=qs[_0x23bd('0x25')](_0x4da852['query'][_0x23bd('0x25')]);_0x54acb5[_0x23bd('0x23')]=qs[_0x23bd('0x23')](_0x4da852[_0x23bd('0x46')][_0x23bd('0x23')]);}_0x54acb5[_0x23bd('0x4e')]=qs[_0x23bd('0x4f')](_0x4da852[_0x23bd('0x46')]['sort']);_0x54acb5['where']=qs[_0x23bd('0x48')](_[_0x23bd('0x50')](_0x4da852[_0x23bd('0x46')],_0x26b830['filters']),_0x1489b9);var _0x27dcb3=[];var _0x2f19b0=squel[_0x23bd('0x51')]()['field']('id')[_0x23bd('0x52')]('name')[_0x23bd('0x52')](_0x23bd('0x53'))[_0x23bd('0x54')]('tools_tags');var _0x2d914c=squel['select']()[_0x23bd('0x52')]('u.id')[_0x23bd('0x52')]('u.fullname')['field'](_0x23bd('0x55'))[_0x23bd('0x54')](_0x23bd('0x56'),'ui')[_0x23bd('0x57')]('users','u','u.id\x20=\x20ui.UserId');var _0x4094bb=squel[_0x23bd('0x51')]()[_0x23bd('0x54')](_0x23bd('0x58'),'i')[_0x23bd('0x57')](_0x23bd('0x59'),'c',_0x23bd('0x5a'))[_0x23bd('0x57')](_0x23bd('0x5b'),'o',_0x23bd('0x5c'))[_0x23bd('0x57')](_0x23bd('0x5d'),'a',_0x23bd('0x5e'))[_0x23bd('0x57')](_0x23bd('0x5f'),'me',_0x23bd('0x60'))[_0x23bd('0x57')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x23bd('0x57')](_0x23bd('0x61'),'t',_0x23bd('0x62'));var _0x482a93=squel['expr']();var _0x12037b=[];var _0x1b11a9=squel[_0x23bd('0x63')]();var _0x534ca7;if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x64')]){_0x534ca7=as[_0x23bd('0x65')](_0x4da852['query'][_0x23bd('0x64')]);var _0x562eee=_0x534ca7['sqlOperator'];for(var _0x440ca6=0x0;_0x440ca6<_0x534ca7[_0x23bd('0x66')][_0x23bd('0x67')];_0x440ca6++){var _0x3601f3=_0x534ca7[_0x23bd('0x66')][_0x440ca6];var _0x3bab6e='i';var _0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),_0x3601f3[_0x23bd('0x52')]]);if(!_0x3ee911){switch(_0x3601f3[_0x23bd('0x52')]){case _0x23bd('0x69'):if(_0x3601f3[_0x23bd('0x6a')]==0x1){_0x4094bb[_0x23bd('0x6b')]('`'+_0x3601f3[_0x23bd('0x52')]+_0x23bd('0x6c'));}else{_0x4094bb[_0x23bd('0x6b')]('`'+_0x3601f3[_0x23bd('0x52')]+_0x23bd('0x6d'));}break;case _0x23bd('0x6e'):if(_0x3601f3['operator']===_0x23bd('0x6f')){if(_0x3601f3['value'][_0x23bd('0x35')]('\x20')['length']>0x1){_0x482a93[_0x562eee](_0x23bd('0x70'),qs[_0x23bd('0x71')](_0x3601f3[_0x23bd('0x6a')]),null);}else{var _0x23d461='%'+_0x3601f3[_0x23bd('0x6a')]+'%';_0x482a93[_0x562eee](_0x23bd('0x72'),_0x23d461,_0x23d461,_0x23d461);}}else{_0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),'ContactId']);_0x3601f3[_0x23bd('0x52')]=_0x23bd('0x73');_0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911[_0x23bd('0x43')],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3[_0x23bd('0x6a')]['start'],_0x2e8ea3['value'][_0x23bd('0x22')]);}break;case'Tag':var _0x59a63e=_0x3601f3[_0x23bd('0x6a')]['split'](',')[_0x23bd('0x31')](function(_0x260160){return Number(_0x260160);});_0x59a63e['forEach'](function(_0x12eebb){_0x1b11a9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x12eebb+',%');});_0x12037b=_[_0x23bd('0x76')](_0x12037b,_0x59a63e);break;case'User':if(_0x3601f3[_0x23bd('0x77')]===_0x23bd('0x6f')){_0x482a93[_0x562eee](_0x23bd('0x78'),'%'+_0x3601f3[_0x23bd('0x6a')]+'%',null);}else{_0x3ee911=_[_0x23bd('0x68')](_0x1489b9,[_0x23bd('0x2e'),_0x23bd('0x3c')]);_0x3601f3[_0x23bd('0x52')]=_0x23bd('0x3c');_0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911['type'],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x22')]);}break;case _0x23bd('0x7a'):_0x2e8ea3=as[_0x23bd('0x74')]('me',null,_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3[_0x23bd('0x75')],_0x2e8ea3['value'][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')]['end']);break;}}else{var _0x2e8ea3=as[_0x23bd('0x74')](_0x3bab6e,_0x3ee911['type'],_0x3601f3);_0x482a93[_0x562eee](_0x2e8ea3['text'],_0x2e8ea3[_0x23bd('0x6a')][_0x23bd('0x79')],_0x2e8ea3[_0x23bd('0x6a')]['end']);}}}else{var _0x338be3=_(_0x4da852[_0x23bd('0x46')])[_0x23bd('0x47')]()[_0x23bd('0x31')](function(_0x86205e){return _[_0x23bd('0x7b')](_0x1489b9,[_0x23bd('0x2e'),_0x86205e])?_0x86205e:undefined;})['compact']()[_0x23bd('0x6a')]();if(!_[_0x23bd('0x7c')](_0x338be3)){_0x338be3['forEach'](function(_0x380888){if(_0x380888===_0x23bd('0x7d')){_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x7f'),[][_0x23bd('0x80')](_0x4da852['query'][_0x380888]));}else if(_0x380888==='createdAt'){var _0x4aa532=JSON[_0x23bd('0x81')](_0x4da852[_0x23bd('0x46')][_0x380888])[_0x23bd('0x82')];var _0x297454=JSON[_0x23bd('0x81')](_0x4da852[_0x23bd('0x46')][_0x380888])[_0x23bd('0x83')];_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x84'),_0x4aa532,_0x297454);}else{if(_0x4da852[_0x23bd('0x46')][_0x380888]===_0x23bd('0x85')){_0x4094bb[_0x23bd('0x7e')]('i.'+_0x380888+_0x23bd('0x86'));}else{_0x4094bb[_0x23bd('0x7e')]('i.'+_0x380888+_0x23bd('0x87'),_0x4da852['query'][_0x380888]);}}});}if(_0x4da852[_0x23bd('0x46')]['read']){if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x88')]==0x1){_0x4094bb['having'](_0x23bd('0x89'));}else{_0x4094bb[_0x23bd('0x6b')](_0x23bd('0x8a'));}}if(_0x4da852['query'][_0x23bd('0x8b')]){_0x12037b=_[_0x23bd('0x8c')](_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')])?_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')]:new Array(_0x4da852[_0x23bd('0x46')][_0x23bd('0x8b')]);_0x12037b[_0x23bd('0x36')](function(_0x5cb4de){_0x1b11a9['or'](_0x23bd('0x8d'),'%,'+_0x5cb4de+',%');});}if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x8e')]){var _0x1e20c1=_0x4da852[_0x23bd('0x46')]['filter'][_0x23bd('0x8f')]('\x5c','\x5c\x5c')[_0x23bd('0x8f')](/'/g,'\x27\x27');if(qs[_0x23bd('0x90')](_0x1e20c1)){_0x482a93['or']('i.id\x20LIKE\x20?',_0x1e20c1+'%')['or'](_0x23bd('0x91'),_0x1e20c1+'%');}_0x482a93['or'](_0x23bd('0x92'),_0x1e20c1+'%');}}_0x4094bb['where'](_0x482a93);_0x4094bb[_0x23bd('0x93')](_0x23bd('0x94'));var _0x2de029={'type':db[_0x23bd('0x95')]['QueryTypes'][_0x23bd('0x96')],'raw':!![]};var _0x4f8dc5=_0x4094bb[_0x23bd('0x97')]();_0x4f8dc5[_0x23bd('0x52')](_0x23bd('0x94'));_0x4f8dc5[_0x23bd('0x52')](_0x23bd('0x98'),_0x23bd('0x69'));if(_0x54acb5[_0x23bd('0x4e')]){_0x54acb5[_0x23bd('0x4e')]['forEach'](function(_0x2e0191){var _0x3dad20=_0x2e0191[0x0]==='contactName'?_0x2e0191[0x0]:'i.'+_0x2e0191[0x0];_0x4094bb[_0x23bd('0x4e')](_0x3dad20,_0x2e0191[0x1]===_0x23bd('0x99')?![]:!![]);});}if(!_[_0x23bd('0x7c')](_0x12037b)){_0x4094bb[_0x23bd('0x6b')](_0x1b11a9);_0x4f8dc5[_0x23bd('0x7e')]('t.id\x20IN\x20?',_0x12037b);}BPromise['resolve']()[_0x23bd('0x2b')](function(){if(!_0x534ca7){if(_0x4da852[_0x23bd('0x46')][_0x23bd('0x7d')])return;_0x4f8dc5[_0x23bd('0x7e')](_0x23bd('0x9a'));_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x9a'));return;}if(_0x4da852[_0x23bd('0x9b')][_0x23bd('0x9c')]!==_0x23bd('0x9d'))return;return _0x4da852['user'][_0x23bd('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3a8bdf){if(_['isEmpty'](_0x3a8bdf)){_0x4f8dc5['where']('i.FaxAccountId\x20IS\x20NULL');_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x9f'));}else{_0x4f8dc5[_0x23bd('0x7e')](_0x23bd('0x7f'),_['map'](_0x3a8bdf,'id'));_0x4094bb[_0x23bd('0x7e')](_0x23bd('0x7f'),_[_0x23bd('0x31')](_0x3a8bdf,'id'));}});})[_0x23bd('0x2b')](function(){if(_0x4da852[_0x23bd('0x9b')]['role']===_0x23bd('0x9d')&&!_0x534ca7&&!_0x4da852[_0x23bd('0x46')]['FaxAccountId'])return[];return db[_0x23bd('0xa0')]['query'](_0x4f8dc5[_0x23bd('0xa1')](),_0x2de029);})[_0x23bd('0x2b')](function(_0x5cfc5f){_0x4900ce[_0x23bd('0x26')]=_0x5cfc5f[_0x23bd('0x67')];if(_0x4900ce[_0x23bd('0x26')]===0x0)return[];return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x2f19b0[_0x23bd('0xa1')](),_0x2de029)[_0x23bd('0x2b')](function(_0x3b1bcb){_0x27dcb3=_[_0x23bd('0xa2')](_0x3b1bcb,'id');_0x2de029=_['merge'](_0x2de029,{'model':db[_0x23bd('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4da852['query'][_0x23bd('0x4a')]){_0x54acb5[_0x23bd('0x4b')]['forEach'](function(_0x3829d2){_0x4094bb[_0x23bd('0x52')]('i.'+_0x3829d2);});}else{_0x4094bb[_0x23bd('0x52')](_0x23bd('0x98'),_0x23bd('0x69'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa4'),_0x23bd('0xa5'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa6'),_0x23bd('0xa7'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xa8'),_0x23bd('0xa9'));_0x4094bb[_0x23bd('0x52')]('i.*');_0x4094bb[_0x23bd('0x52')](_0x23bd('0xaa'),'Contact.firstName');_0x4094bb['field'](_0x23bd('0xab'),_0x23bd('0xac'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xad'),_0x23bd('0xae'));_0x4094bb[_0x23bd('0x52')]('c.phone','Contact.phone');_0x4094bb['field'](_0x23bd('0xaf'),_0x23bd('0xb0'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xb1'),_0x23bd('0xb2'));_0x4094bb[_0x23bd('0x52')](_0x23bd('0xb3'),_0x23bd('0xb4'));_0x4094bb['field'](_0x23bd('0xb5'),_0x23bd('0xb6'));_0x4094bb['field'](_0x23bd('0xb7'),_0x23bd('0x33'));}if(_0x54acb5[_0x23bd('0x25')])_0x4094bb[_0x23bd('0x25')](_0x54acb5['limit']);if(_0x54acb5[_0x23bd('0x23')])_0x4094bb[_0x23bd('0x23')](_0x54acb5['offset']);return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x4094bb[_0x23bd('0xa1')](),_0x2de029);})[_0x23bd('0x2b')](function(_0x25078b){if(_0x25078b[_0x23bd('0x67')]>0x0)_0x2d914c[_0x23bd('0x7e')](_0x23bd('0xb8'),_['map'](_0x25078b,'id'));return db[_0x23bd('0xa0')][_0x23bd('0x46')](_0x2d914c['toString'](),_0x2de029)[_0x23bd('0x2b')](function(_0x5d644f){var _0x159d16=_[_0x23bd('0xb9')](_0x5d644f,_0x23bd('0xba'));var _0xb3563c=[];_0x25078b[_0x23bd('0x36')](function(_0x438d6b){_0xb3563c[_0x23bd('0x37')](updateFaxInteraction(_0x438d6b,_0x27dcb3,_0x159d16));});return BPromise[_0x23bd('0xbb')](_0xb3563c);});});})[_0x23bd('0x2b')](function(_0xc8e478){_0x4900ce[_0x23bd('0xbc')]=_0xc8e478;return _0x4900ce;})[_0x23bd('0x2b')](respondWithFilteredResult(_0x445fe0,_0x54acb5))[_0x23bd('0x38')](handleError(_0x445fe0,null));};exports['show']=function(_0xb98762,_0x5e3ec1){var _0x50d9f9={'raw':![],'where':{'id':_0xb98762[_0x23bd('0xbd')]['id']}},_0x4d9cf4={};_0x4d9cf4[_0x23bd('0x45')]=_['keys'](db[_0x23bd('0xa3')][_0x23bd('0x41')]);_0x4d9cf4[_0x23bd('0x46')]=_[_0x23bd('0x47')](_0xb98762['query']);_0x4d9cf4['filters']=_[_0x23bd('0x49')](_0x4d9cf4[_0x23bd('0x45')],_0x4d9cf4[_0x23bd('0x46')]);_0x50d9f9['attributes']=_[_0x23bd('0x49')](_0x4d9cf4[_0x23bd('0x45')],qs['fields'](_0xb98762[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x50d9f9['attributes']=_0x50d9f9['attributes'][_0x23bd('0x67')]?_0x50d9f9[_0x23bd('0x4b')]:_0x4d9cf4['model'];if(_0xb98762[_0x23bd('0x46')][_0x23bd('0xbe')]){_0x50d9f9['include']=[{'all':!![]}];}_0x50d9f9=_['merge']({},_0x50d9f9,_0xb98762['options']);return db[_0x23bd('0xa3')][_0x23bd('0x68')](_0x50d9f9)[_0x23bd('0x2b')](handleEntityNotFound(_0x5e3ec1,null))[_0x23bd('0x2b')](respondWithResult(_0x5e3ec1,null))['catch'](handleError(_0x5e3ec1,null));};exports[_0x23bd('0xbf')]=function(_0x5094e4,_0x4eda69){return db['FaxInteraction'][_0x23bd('0xbf')](_0x5094e4[_0x23bd('0x7a')],{})[_0x23bd('0x2b')](respondWithResult(_0x4eda69,0xc9))['catch'](handleError(_0x4eda69,null));};exports[_0x23bd('0x2a')]=function(_0x1c5991,_0x46f45e){if(_0x1c5991['body']['id']){delete _0x1c5991['body']['id'];}return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x1c5991['params']['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x46f45e,null))['then'](saveUpdates(_0x1c5991[_0x23bd('0x7a')],null))['then'](respondWithResult(_0x46f45e,null))[_0x23bd('0x38')](handleError(_0x46f45e,null));};exports['destroy']=function(_0x148bb3,_0x1f05e0){return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x148bb3[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x1f05e0,null))['then'](removeEntity(_0x1f05e0,null))['catch'](handleError(_0x1f05e0,null));};exports[_0x23bd('0xc0')]=function(_0x2a329d,_0x42653c){return db['FaxInteraction'][_0x23bd('0xc0')]()[_0x23bd('0x2b')](respondWithResult(_0x42653c,null))[_0x23bd('0x38')](handleError(_0x42653c,null));};exports[_0x23bd('0xc1')]=function(_0x1cd38d,_0x2cab74,_0x2f1d70){return db[_0x23bd('0xc2')]['find']({'where':{'id':_0x1cd38d[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x2cab74,null))[_0x23bd('0x2b')](function(_0x3e6438){if(_0x3e6438){return _0x3e6438[_0x23bd('0xc1')](_0x1cd38d[_0x23bd('0x7a')][_0x23bd('0xc3')],_['omit'](_0x1cd38d['body'],[_0x23bd('0xc3'),'id'])||{});}})[_0x23bd('0x2b')](respondWithResult(_0x2cab74,null))['catch'](handleError(_0x2cab74,null));};exports[_0x23bd('0xc4')]=function(_0x29a900,_0x52b506,_0x264a70){var _0x23eb64={'raw':![],'where':{}};var _0x6a936d={};var _0x401935={'count':0x0,'rows':[]};return db[_0x23bd('0xa3')][_0x23bd('0xc5')]({'where':{'id':_0x29a900[_0x23bd('0xbd')]['id']}})['then'](handleEntityNotFound(_0x52b506,null))['then'](function(_0x262764){if(_0x262764){_0x6a936d[_0x23bd('0x45')]=_[_0x23bd('0x47')](db[_0x23bd('0xc2')][_0x23bd('0x41')]);_0x6a936d['query']=_['keys'](_0x29a900['query']);_0x6a936d[_0x23bd('0x48')]=_[_0x23bd('0x49')](_0x6a936d[_0x23bd('0x45')],_0x6a936d[_0x23bd('0x46')]);_0x23eb64['attributes']=_[_0x23bd('0x49')](_0x6a936d[_0x23bd('0x45')],qs[_0x23bd('0x4a')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x4a')]));_0x23eb64[_0x23bd('0x4b')]=_0x23eb64[_0x23bd('0x4b')][_0x23bd('0x67')]?_0x23eb64[_0x23bd('0x4b')]:_0x6a936d[_0x23bd('0x45')];if(!_0x29a900[_0x23bd('0x46')][_0x23bd('0x4c')](_0x23bd('0x4d'))){_0x23eb64[_0x23bd('0x25')]=qs[_0x23bd('0x25')](_0x29a900['query'][_0x23bd('0x25')]);_0x23eb64[_0x23bd('0x23')]=qs[_0x23bd('0x23')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x23')]);}_0x23eb64[_0x23bd('0x4e')]=qs[_0x23bd('0x4f')](_0x29a900[_0x23bd('0x46')][_0x23bd('0x4f')]);_0x23eb64[_0x23bd('0x7e')]=qs[_0x23bd('0x48')](_[_0x23bd('0x50')](_0x29a900[_0x23bd('0x46')],_0x6a936d[_0x23bd('0x48')]));_0x23eb64[_0x23bd('0x7e')]['FaxInteractionId']=_0x262764['id'];if(_0x29a900['query'][_0x23bd('0x8e')]){_0x23eb64[_0x23bd('0x7e')]=_['merge'](_0x23eb64[_0x23bd('0x7e')],{'$or':_[_0x23bd('0x31')](_0x23eb64[_0x23bd('0x4b')],function(_0x5c2029){var _0x852ea6={};_0x852ea6[_0x5c2029]={'$like':'%'+_0x29a900[_0x23bd('0x46')][_0x23bd('0x8e')]+'%'};return _0x852ea6;})});}if(_0x29a900[_0x23bd('0x46')][_0x23bd('0x82')]){var _0xbea4c0=_0x29a900[_0x23bd('0x46')][_0x23bd('0x82')]['split'](',');var _0x180109={};_0x180109[_0xbea4c0[0x0]]={'$gte':moment(_0xbea4c0[0x1])['format'](_0x23bd('0xc6'))};_0x23eb64[_0x23bd('0x7e')]=_[_0x23bd('0xc7')](_0x23eb64[_0x23bd('0x7e')],_0x180109);}_0x23eb64=_[_0x23bd('0xc7')]({},_0x23eb64,_0x29a900[_0x23bd('0xc8')]);return db[_0x23bd('0xc2')][_0x23bd('0x26')]({'where':_0x23eb64[_0x23bd('0x7e')]})[_0x23bd('0x2b')](function(_0x12712b){_0x401935[_0x23bd('0x26')]=_0x12712b;if(_0x29a900[_0x23bd('0x46')][_0x23bd('0xbe')]){_0x23eb64[_0x23bd('0xc9')]=[{'all':!![]}];}return db[_0x23bd('0xc2')][_0x23bd('0xca')](_0x23eb64);})[_0x23bd('0x2b')](function(_0x54c234){_0x401935['rows']=_0x54c234;return _0x401935;});}})[_0x23bd('0x2b')](respondWithFilteredResult(_0x52b506,_0x23eb64))['catch'](handleError(_0x52b506,null));};exports['addTags']=function(_0x3de7f8,_0x3a8767,_0x48d0ca){return db[_0x23bd('0xa3')]['find']({'where':{'id':_0x3de7f8[_0x23bd('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a8767,null))[_0x23bd('0x2b')](function(_0x5d3c20){if(_0x5d3c20){return _0x5d3c20[_0x23bd('0xcb')](_0x3de7f8[_0x23bd('0x7a')]['ids'],_[_0x23bd('0xcc')](_0x3de7f8[_0x23bd('0x7a')],[_0x23bd('0xc3'),'id'])||{})['spread'](function(){return db[_0x23bd('0xcd')][_0x23bd('0xca')]({'attributes':['id',_0x23bd('0x2e'),'color'],'where':{'id':_0x3de7f8[_0x23bd('0x7a')]['ids']}});})[_0x23bd('0x2b')](function(_0x35bd3b){socket[_0x23bd('0xce')](_0x23bd('0xcf'),{'id':Number(_0x3de7f8[_0x23bd('0xbd')]['id']),'tags':_0x35bd3b||[]});return{'id':Number(_0x3de7f8[_0x23bd('0xbd')]['id']),'tags':_0x35bd3b||[]};});}})[_0x23bd('0x2b')](respondWithResult(_0x3a8767,null))[_0x23bd('0x38')](handleError(_0x3a8767,null));};exports[_0x23bd('0xd0')]=function(_0x40fcfa,_0x54a3cf,_0x123ba7){return db[_0x23bd('0xa3')][_0x23bd('0x68')]({'where':{'id':_0x40fcfa[_0x23bd('0xbd')]['id']}})[_0x23bd('0x2b')](handleEntityNotFound(_0x54a3cf,null))['then'](function(_0x3ec75d){if(_0x3ec75d){return _0x3ec75d[_0x23bd('0xd0')](_0x40fcfa[_0x23bd('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x54a3cf,null))[_0x23bd('0x38')](handleError(_0x54a3cf,null));};exports[_0x23bd('0xd1')]=function(_0x5e9a5e,_0x3b0b1b){var _0x1301f3=moment()['unix']()[_0x23bd('0xa1')]();var _0x5c7d8d=path['join'](config[_0x23bd('0xd2')],'server',_0x23bd('0xd3'),_0x23bd('0xd4'));var _0x4f8ccc=path[_0x23bd('0xd5')](config[_0x23bd('0xd2')],_0x23bd('0xd6'),_0x23bd('0xd3'),_0x23bd('0xd7'));var _0x25a2cd=path[_0x23bd('0xd5')](_0x5c7d8d,_0x1301f3);var _0x4bdbfd=util[_0x23bd('0xd8')](_0x23bd('0xd9'),_0x5e9a5e[_0x23bd('0xbd')]['id'],_0x1301f3);var _0x2451d3=path['join'](_0x5c7d8d,_0x4bdbfd);var _0x5d2482=[];_0x5d2482[_0x23bd('0x37')]({'model':db[_0x23bd('0xda')],'as':_0x23bd('0xda'),'raw':!![]});var _0x47d4fb=[{'model':db[_0x23bd('0xc2')],'as':_0x23bd('0xdb'),'attributes':['id',_0x23bd('0x7a'),'createdAt'],'include':_0x5d2482}];return db[_0x23bd('0xa3')][_0x23bd('0x68')]({'where':{'id':_0x5e9a5e['params']['id']},'include':_0x47d4fb})[_0x23bd('0x2b')](handleEntityNotFound(_0x3b0b1b,null))[_0x23bd('0x2b')](function(_0x2580c2){if(_0x2580c2&&_0x2580c2[_0x23bd('0xdb')]){var _0xbba42e=_0x2580c2[_0x23bd('0xdc')]({'plain':!![]});fs[_0x23bd('0xdd')](_0x25a2cd);for(var _0x1cb6cc=0x0;_0x1cb6cc<_0xbba42e['Messages'][_0x23bd('0x67')];_0x1cb6cc++){var _0x2c5937=_0xbba42e[_0x23bd('0xdb')][_0x1cb6cc][_0x23bd('0xda')];if(_0x2c5937){var _0x3fc51b=path[_0x23bd('0xd5')](_0x4f8ccc,_0x2c5937['basename']);if(fs[_0x23bd('0xde')](_0x3fc51b)){fs[_0x23bd('0xdf')](_0x3fc51b)['pipe'](fs[_0x23bd('0xe0')](path['join'](_0x25a2cd,_0x2c5937['basename'])));}}}return BPromise[_0x23bd('0xe1')]()[_0x23bd('0x2b')](function(){return new BPromise(function(_0xd17731,_0x30db66){zipdir(_0x25a2cd,{'saveTo':_0x2451d3},function(_0x2c5c17,_0x26dc7a){if(_0x2c5c17)return _0x30db66(_0x2c5c17);return _0xd17731(_0x26dc7a);});})[_0x23bd('0x2b')](function(){return new BPromise(function(_0x3659b4,_0x2ed971){rimraf(_0x25a2cd,function(_0x26ba4c){if(_0x26ba4c)_0x2ed971(_0x26ba4c);return _0x3659b4();});});})[_0x23bd('0x2b')](function(){return _0x3b0b1b['download'](_0x2451d3,_0x4bdbfd,function(_0x3b96ab){if(_0x3b96ab){console[_0x23bd('0xe2')](_0x23bd('0xe3'),_0x3b96ab);}else{fs['unlinkSync'](_0x2451d3);}});});});}else{return _0x3b0b1b['sendStatus'](0xc8);}})[_0x23bd('0x38')](handleError(_0x3b0b1b,null));}; \ No newline at end of file +var _0x3c57=['u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','find','text','start','body','some','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','show','params','includeAll','include','options','create','describe','FaxMessage','addMessage','ids','getMessages','nolimit','format','findAll','rows','addTags','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','get','mkdirSync','Messages','basename','createReadStream','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','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','../../config/logger','api','../../config/utils','../../config/license/util','redis','./faxInteraction.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','Users','map','TagIds','split','forEach','Tags','catch','waiting','talking','answered','closed','UserId','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','select','field','from','tools_tags'];(function(_0x6352b7,_0xe18178){var _0x56da78=function(_0x4fd98c){while(--_0x4fd98c){_0x6352b7['push'](_0x6352b7['shift']());}};_0x56da78(++_0xe18178);}(_0x3c57,0x91));var _0x73c5=function(_0x37438b,_0x300ea5){_0x37438b=_0x37438b-0x0;var _0x18a032=_0x3c57[_0x37438b];return _0x18a032;};'use strict';var emlformat=require(_0x73c5('0x0'));var rimraf=require(_0x73c5('0x1'));var zipdir=require(_0x73c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x73c5('0x3'));var Mustache=require('mustache');var util=require(_0x73c5('0x4'));var path=require('path');var sox=require(_0x73c5('0x5'));var csv=require(_0x73c5('0x6'));var ejs=require(_0x73c5('0x7'));var fs=require('fs');var fs_extra=require(_0x73c5('0x8'));var _=require(_0x73c5('0x9'));var squel=require(_0x73c5('0xa'));var crypto=require(_0x73c5('0xb'));var jsforce=require(_0x73c5('0xc'));var deskjs=require(_0x73c5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x73c5('0xe'));var Papa=require('papaparse');var Redis=require(_0x73c5('0xf'));var authService=require(_0x73c5('0x10'));var qs=require(_0x73c5('0x11'));var as=require(_0x73c5('0x12'));var hardwareService=require(_0x73c5('0x13'));var logger=require(_0x73c5('0x14'))(_0x73c5('0x15'));var utils=require(_0x73c5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x73c5('0x17'));var db=require('../../mysqldb')['db'];config[_0x73c5('0x18')]=_['defaults'](config[_0x73c5('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73c5('0x18')]));require(_0x73c5('0x19'))[_0x73c5('0x1a')](socket);function respondWithStatusCode(_0x3ef031,_0x70d3bd){_0x70d3bd=_0x70d3bd||0xcc;return function(_0x2d092a){if(_0x2d092a){return _0x3ef031['sendStatus'](_0x70d3bd);}return _0x3ef031[_0x73c5('0x1b')](_0x70d3bd)[_0x73c5('0x1c')]();};}function respondWithResult(_0x8fe1de,_0x554369){_0x554369=_0x554369||0xc8;return function(_0x2d565c){if(_0x2d565c){return _0x8fe1de[_0x73c5('0x1b')](_0x554369)[_0x73c5('0x1d')](_0x2d565c);}};}function respondWithFilteredResult(_0x1a4f15,_0x2c7023){return function(_0x45b2de){if(_0x45b2de){var _0xb5e142=typeof _0x2c7023[_0x73c5('0x1e')]===_0x73c5('0x1f')&&typeof _0x2c7023['limit']===_0x73c5('0x1f');var _0xae2c93=_0x45b2de[_0x73c5('0x20')];var _0x3a73f0=_0xb5e142?0x0:_0x2c7023['offset'];var _0x523f93=_0xb5e142?_0x45b2de[_0x73c5('0x20')]:_0x2c7023['offset']+_0x2c7023[_0x73c5('0x21')];var _0x152be5;if(_0x523f93>=_0xae2c93){_0x523f93=_0xae2c93;_0x152be5=0xc8;}else{_0x152be5=0xce;}_0x1a4f15['status'](_0x152be5);return _0x1a4f15[_0x73c5('0x22')](_0x73c5('0x23'),_0x3a73f0+'-'+_0x523f93+'/'+_0xae2c93)[_0x73c5('0x1d')](_0x45b2de);}return null;};}function patchUpdates(_0x49114b){return function(_0x8d7bc6){try{jsonpatch[_0x73c5('0x24')](_0x8d7bc6,_0x49114b,!![]);}catch(_0x173f50){return BPromise[_0x73c5('0x25')](_0x173f50);}return _0x8d7bc6['save']();};}function saveUpdates(_0x2fb5f0,_0x2f9d00){return function(_0xfdfe37){if(_0xfdfe37){return _0xfdfe37[_0x73c5('0x26')](_0x2fb5f0)[_0x73c5('0x27')](function(_0x2c322a){return _0x2c322a;});}return null;};}function removeEntity(_0x525b2a,_0x176561){return function(_0x1efc80){if(_0x1efc80){return _0x1efc80[_0x73c5('0x28')]()[_0x73c5('0x27')](function(){_0x525b2a[_0x73c5('0x1b')](0xcc)[_0x73c5('0x1c')]();});}};}function handleEntityNotFound(_0x35feb8,_0x3601f5){return function(_0x5a7fb5){if(!_0x5a7fb5){_0x35feb8[_0x73c5('0x29')](0x194);}return _0x5a7fb5;};}function handleError(_0x557642,_0x576c2f){_0x576c2f=_0x576c2f||0x1f4;return function(_0xfcd5aa){logger[_0x73c5('0x2a')](_0xfcd5aa['stack']);if(_0xfcd5aa[_0x73c5('0x2b')]){delete _0xfcd5aa[_0x73c5('0x2b')];}_0x557642[_0x73c5('0x1b')](_0x576c2f)[_0x73c5('0x2c')](_0xfcd5aa);};}function getInteractionUsers(_0x4a4986,_0x1a2b48){return new BPromise(function(_0x118577,_0x1769ba){try{if(_0x1a2b48[_0x4a4986['id']]){_0x4a4986[_0x73c5('0x2d')]=_[_0x73c5('0x2e')](_0x1a2b48[_0x4a4986['id']],function(_0x256b55){return{'id':_0x256b55['id'],'fullname':_0x256b55['fullname']};});}}catch(_0x41d059){_0x1769ba(_0x41d059);}_0x118577(_0x4a4986);});}function getInteractionTags(_0xd0f021,_0xd819f7){return new BPromise(function(_0x12be6e,_0x51226a){try{if(_0xd0f021[_0x73c5('0x2f')]){_0xd0f021['Tags']=[];_0xd0f021[_0x73c5('0x2f')][_0x73c5('0x30')](',')[_0x73c5('0x31')](function(_0x390cb4){_0xd0f021[_0x73c5('0x32')]['push'](_0xd819f7[_0x390cb4]);});}delete _0xd0f021[_0x73c5('0x2f')];}catch(_0x48fa74){_0x51226a(_0x48fa74);}_0x12be6e(_0xd0f021);});}function updateFaxInteraction(_0x2eaa50,_0x2bbd46,_0x22939a){return new BPromise(function(_0x24a86a,_0x16a296){return getInteractionUsers(_0x2eaa50,_0x22939a)['then'](function(_0x478861){return getInteractionTags(_0x478861,_0x2bbd46);})[_0x73c5('0x27')](function(_0x5400c9){return getStateInteraction(_0x5400c9);})[_0x73c5('0x27')](function(_0x5c5db3){_0x24a86a(_0x5c5db3);})[_0x73c5('0x33')](function(_0x50370a){_0x16a296(_0x50370a);});});}function getStateInteraction(_0x424285){return new BPromise(function(_0x261cc8){_0x424285[_0x73c5('0x34')]=0x0;_0x424285[_0x73c5('0x35')]=0x0;_0x424285[_0x73c5('0x36')]=0x0;_0x424285['unmanaged']=0x0;_0x424285['total']=0x0;if(!_0x424285[_0x73c5('0x37')]&&!_0x424285[_0x73c5('0x38')]){_0x424285[_0x73c5('0x34')]+=0x1;}if(!_0x424285[_0x73c5('0x37')]&&_0x424285['UserId']){_0x424285[_0x73c5('0x35')]+=0x1;if(_0x424285[_0x73c5('0x34')]){_0x424285[_0x73c5('0x34')]-=0x1;}}if(_0x424285['closed']&&_0x424285['UserId']){_0x424285[_0x73c5('0x36')]+=0x1;if(_0x424285['talking']){_0x424285[_0x73c5('0x35')]-=0x1;}}if(_0x424285[_0x73c5('0x37')]&&!_0x424285[_0x73c5('0x38')]){_0x424285['unmanaged']+=0x1;if(_0x424285['waiting']){_0x424285[_0x73c5('0x34')]-=0x1;}}_0x424285['total']+=0x1;_0x261cc8(_0x424285);});}exports['index']=function(_0x58b222,_0x1c7a0e){var _0xa9cb1={},_0x16dddc={},_0x147452={'count':0x0,'rows':[]};var _0xb3cfce=_['map'](db[_0x73c5('0x39')][_0x73c5('0x3a')],function(_0x5e37ae){return{'name':_0x5e37ae['fieldName'],'type':_0x5e37ae[_0x73c5('0x3b')][_0x73c5('0x3c')]};});_0x16dddc[_0x73c5('0x3d')]=_[_0x73c5('0x2e')](_0xb3cfce,_0x73c5('0x2b'));_0x16dddc[_0x73c5('0x3e')]=_[_0x73c5('0x3f')](_0x58b222[_0x73c5('0x3e')]);_0x16dddc[_0x73c5('0x40')]=_[_0x73c5('0x41')](_0x16dddc['model'],_0x16dddc['query']);_0xa9cb1['attributes']=_[_0x73c5('0x41')](_0x16dddc[_0x73c5('0x3d')],qs['fields'](_0x58b222['query'][_0x73c5('0x42')]));_0xa9cb1[_0x73c5('0x43')]=_0xa9cb1[_0x73c5('0x43')][_0x73c5('0x44')]?_0xa9cb1[_0x73c5('0x43')]:_0x16dddc['model'];if(!_0x58b222[_0x73c5('0x3e')]['hasOwnProperty']('nolimit')){_0xa9cb1[_0x73c5('0x21')]=qs['limit'](_0x58b222[_0x73c5('0x3e')][_0x73c5('0x21')]);_0xa9cb1[_0x73c5('0x1e')]=qs[_0x73c5('0x1e')](_0x58b222['query'][_0x73c5('0x1e')]);}_0xa9cb1[_0x73c5('0x45')]=qs[_0x73c5('0x46')](_0x58b222[_0x73c5('0x3e')]['sort']);_0xa9cb1['where']=qs['filters'](_[_0x73c5('0x47')](_0x58b222[_0x73c5('0x3e')],_0x16dddc[_0x73c5('0x40')]),_0xb3cfce);var _0x140f04=[];var _0x385762=squel[_0x73c5('0x48')]()[_0x73c5('0x49')]('id')[_0x73c5('0x49')](_0x73c5('0x2b'))[_0x73c5('0x49')]('color')[_0x73c5('0x4a')](_0x73c5('0x4b'));var _0xf9f6f8=squel[_0x73c5('0x48')]()['field'](_0x73c5('0x4c'))[_0x73c5('0x49')](_0x73c5('0x4d'))[_0x73c5('0x49')](_0x73c5('0x4e'))[_0x73c5('0x4a')](_0x73c5('0x4f'),'ui')[_0x73c5('0x50')]('users','u','u.id\x20=\x20ui.UserId');var _0x2d3a3a=squel[_0x73c5('0x48')]()[_0x73c5('0x4a')](_0x73c5('0x51'),'i')[_0x73c5('0x50')](_0x73c5('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x73c5('0x53'),'o',_0x73c5('0x54'))['left_join'](_0x73c5('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0x73c5('0x50')]('fax_messages','me',_0x73c5('0x56'))[_0x73c5('0x50')](_0x73c5('0x57'),'it',_0x73c5('0x58'))['left_join'](_0x73c5('0x4b'),'t',_0x73c5('0x59'));var _0x13516e=squel[_0x73c5('0x5a')]();var _0x5823bf=[];var _0x2e683f=squel[_0x73c5('0x5a')]();var _0x52e174;if(_0x58b222[_0x73c5('0x3e')]['search']){_0x52e174=as[_0x73c5('0x5b')](_0x58b222[_0x73c5('0x3e')][_0x73c5('0x5c')]);var _0x419763=_0x52e174[_0x73c5('0x5d')];for(var _0x1008de=0x0;_0x1008de<_0x52e174[_0x73c5('0x5e')][_0x73c5('0x44')];_0x1008de++){var _0x323770=_0x52e174[_0x73c5('0x5e')][_0x1008de];var _0x125e86='i';var _0x13ea1e=_['find'](_0xb3cfce,[_0x73c5('0x2b'),_0x323770[_0x73c5('0x49')]]);if(!_0x13ea1e){switch(_0x323770[_0x73c5('0x49')]){case _0x73c5('0x5f'):if(_0x323770[_0x73c5('0x60')]==0x1){_0x2d3a3a[_0x73c5('0x61')]('`'+_0x323770[_0x73c5('0x49')]+_0x73c5('0x62'));}else{_0x2d3a3a[_0x73c5('0x61')]('`'+_0x323770[_0x73c5('0x49')]+_0x73c5('0x63'));}break;case _0x73c5('0x64'):if(_0x323770['operator']==='$substring'){if(_0x323770[_0x73c5('0x60')][_0x73c5('0x30')]('\x20')['length']>0x1){_0x13516e[_0x419763](_0x73c5('0x65'),qs[_0x73c5('0x66')](_0x323770[_0x73c5('0x60')]),null);}else{var _0x4ea521='%'+_0x323770[_0x73c5('0x60')]+'%';_0x13516e[_0x419763](_0x73c5('0x67'),_0x4ea521,_0x4ea521,_0x4ea521);}}else{_0x13ea1e=_['find'](_0xb3cfce,[_0x73c5('0x2b'),'ContactId']);_0x323770[_0x73c5('0x49')]=_0x73c5('0x68');_0x1f4308=as[_0x73c5('0x69')](_0x125e86,_0x13ea1e[_0x73c5('0x3b')],_0x323770);_0x13516e[_0x419763](_0x1f4308['text'],_0x1f4308[_0x73c5('0x60')]['start'],_0x1f4308['value'][_0x73c5('0x1c')]);}break;case _0x73c5('0x6a'):var _0x3b7558=_0x323770['value'][_0x73c5('0x30')](',')[_0x73c5('0x2e')](function(_0x152158){return Number(_0x152158);});_0x3b7558['forEach'](function(_0x42e45d){_0x2e683f['or'](_0x73c5('0x6b'),'%,'+_0x42e45d+',%');});_0x5823bf=_[_0x73c5('0x6c')](_0x5823bf,_0x3b7558);break;case _0x73c5('0x6d'):if(_0x323770[_0x73c5('0x6e')]==='$substring'){_0x13516e[_0x419763]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x323770[_0x73c5('0x60')]+'%',null);}else{_0x13ea1e=_[_0x73c5('0x6f')](_0xb3cfce,[_0x73c5('0x2b'),_0x73c5('0x38')]);_0x323770[_0x73c5('0x49')]=_0x73c5('0x38');_0x1f4308=as['buildExpression'](_0x125e86,_0x13ea1e['type'],_0x323770);_0x13516e[_0x419763](_0x1f4308[_0x73c5('0x70')],_0x1f4308['value'][_0x73c5('0x71')],_0x1f4308[_0x73c5('0x60')]['end']);}break;case _0x73c5('0x72'):_0x1f4308=as['buildExpression']('me',null,_0x323770);_0x13516e[_0x419763](_0x1f4308['text'],_0x1f4308[_0x73c5('0x60')][_0x73c5('0x71')],_0x1f4308[_0x73c5('0x60')][_0x73c5('0x1c')]);break;}}else{var _0x1f4308=as[_0x73c5('0x69')](_0x125e86,_0x13ea1e[_0x73c5('0x3b')],_0x323770);_0x13516e[_0x419763](_0x1f4308[_0x73c5('0x70')],_0x1f4308['value'][_0x73c5('0x71')],_0x1f4308[_0x73c5('0x60')]['end']);}}}else{var _0x14f91d=_(_0x58b222[_0x73c5('0x3e')])[_0x73c5('0x3f')]()['map'](function(_0x2b917a){return _[_0x73c5('0x73')](_0xb3cfce,[_0x73c5('0x2b'),_0x2b917a])?_0x2b917a:undefined;})['compact']()['value']();if(!_[_0x73c5('0x74')](_0x14f91d)){_0x14f91d[_0x73c5('0x31')](function(_0x135e29){if(_0x135e29==='FaxAccountId'){_0x2d3a3a['where'](_0x73c5('0x75'),[][_0x73c5('0x76')](_0x58b222[_0x73c5('0x3e')][_0x135e29]));}else if(_0x135e29===_0x73c5('0x77')){var _0x5805b2=JSON[_0x73c5('0x78')](_0x58b222['query'][_0x135e29])[_0x73c5('0x79')];var _0x55d921=JSON['parse'](_0x58b222[_0x73c5('0x3e')][_0x135e29])[_0x73c5('0x7a')];_0x2d3a3a[_0x73c5('0x7b')](_0x73c5('0x7c'),_0x5805b2,_0x55d921);}else{if(_0x58b222['query'][_0x135e29]===_0x73c5('0x7d')){_0x2d3a3a[_0x73c5('0x7b')]('i.'+_0x135e29+_0x73c5('0x7e'));}else{_0x2d3a3a[_0x73c5('0x7b')]('i.'+_0x135e29+_0x73c5('0x7f'),_0x58b222[_0x73c5('0x3e')][_0x135e29]);}}});}if(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x80')]){if(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x80')]==0x1){_0x2d3a3a[_0x73c5('0x61')](_0x73c5('0x81'));}else{_0x2d3a3a[_0x73c5('0x61')](_0x73c5('0x82'));}}if(_0x58b222['query']['tag']){_0x5823bf=_[_0x73c5('0x83')](_0x58b222[_0x73c5('0x3e')][_0x73c5('0x84')])?_0x58b222[_0x73c5('0x3e')]['tag']:new Array(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x84')]);_0x5823bf[_0x73c5('0x31')](function(_0x3a9b40){_0x2e683f['or'](_0x73c5('0x6b'),'%,'+_0x3a9b40+',%');});}if(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x85')]){var _0x44b522=_0x58b222[_0x73c5('0x3e')][_0x73c5('0x85')][_0x73c5('0x86')]('\x5c','\x5c\x5c')[_0x73c5('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44b522)){_0x13516e['or'](_0x73c5('0x87'),_0x44b522+'%')['or'](_0x73c5('0x88'),_0x44b522+'%');}_0x13516e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44b522+'%');}}_0x2d3a3a[_0x73c5('0x7b')](_0x13516e);_0x2d3a3a[_0x73c5('0x89')](_0x73c5('0x8a'));var _0x5456de={'type':db[_0x73c5('0x8b')][_0x73c5('0x8c')][_0x73c5('0x8d')],'raw':!![]};var _0x4df549=_0x2d3a3a[_0x73c5('0x8e')]();_0x4df549[_0x73c5('0x49')](_0x73c5('0x8a'));_0x4df549[_0x73c5('0x49')](_0x73c5('0x8f'),_0x73c5('0x5f'));if(_0xa9cb1['order']){_0xa9cb1[_0x73c5('0x45')][_0x73c5('0x31')](function(_0x50c128){var _0x224645=_0x50c128[0x0]===_0x73c5('0x90')?_0x50c128[0x0]:'i.'+_0x50c128[0x0];_0x2d3a3a['order'](_0x224645,_0x50c128[0x1]===_0x73c5('0x91')?![]:!![]);});}if(!_[_0x73c5('0x74')](_0x5823bf)){_0x2d3a3a['having'](_0x2e683f);_0x4df549['where'](_0x73c5('0x92'),_0x5823bf);}BPromise[_0x73c5('0x93')]()[_0x73c5('0x27')](function(){if(!_0x52e174){if(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x94')])return;_0x4df549[_0x73c5('0x7b')](_0x73c5('0x95'));_0x2d3a3a[_0x73c5('0x7b')](_0x73c5('0x95'));return;}if(_0x58b222[_0x73c5('0x96')][_0x73c5('0x97')]!==_0x73c5('0x98'))return;return _0x58b222[_0x73c5('0x96')][_0x73c5('0x99')]({'attributes':['id'],'raw':!![]})[_0x73c5('0x27')](function(_0x54d0d7){if(_[_0x73c5('0x74')](_0x54d0d7)){_0x4df549[_0x73c5('0x7b')](_0x73c5('0x9a'));_0x2d3a3a[_0x73c5('0x7b')](_0x73c5('0x9a'));}else{_0x4df549[_0x73c5('0x7b')](_0x73c5('0x75'),_[_0x73c5('0x2e')](_0x54d0d7,'id'));_0x2d3a3a[_0x73c5('0x7b')](_0x73c5('0x75'),_[_0x73c5('0x2e')](_0x54d0d7,'id'));}});})[_0x73c5('0x27')](function(){if(_0x58b222['user'][_0x73c5('0x97')]==='agent'&&!_0x52e174&&!_0x58b222[_0x73c5('0x3e')][_0x73c5('0x94')])return[];return db['sequelize'][_0x73c5('0x3e')](_0x4df549['toString'](),_0x5456de);})['then'](function(_0x266ea0){_0x147452[_0x73c5('0x20')]=_0x266ea0['length'];if(_0x147452[_0x73c5('0x20')]===0x0)return[];return db['sequelize'][_0x73c5('0x3e')](_0x385762[_0x73c5('0x9b')](),_0x5456de)[_0x73c5('0x27')](function(_0x3027bb){_0x140f04=_['keyBy'](_0x3027bb,'id');_0x5456de=_[_0x73c5('0x9c')](_0x5456de,{'model':db[_0x73c5('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x58b222[_0x73c5('0x3e')][_0x73c5('0x42')]){_0xa9cb1[_0x73c5('0x43')]['forEach'](function(_0x45bb38){_0x2d3a3a[_0x73c5('0x49')]('i.'+_0x45bb38);});}else{_0x2d3a3a['field'](_0x73c5('0x8f'),_0x73c5('0x5f'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0x9d'),_0x73c5('0x9e'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0x9f'),'Account.mandatoryDisposition');_0x2d3a3a['field'](_0x73c5('0xa0'),'contactName');_0x2d3a3a['field']('i.*');_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0xa1'),_0x73c5('0xa2'));_0x2d3a3a['field']('c.lastName',_0x73c5('0xa3'));_0x2d3a3a[_0x73c5('0x49')]('c.email',_0x73c5('0xa4'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0xa5'),_0x73c5('0xa6'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0xa7'),_0x73c5('0xa8'));_0x2d3a3a['field'](_0x73c5('0xa9'),_0x73c5('0xaa'));_0x2d3a3a['field'](_0x73c5('0xab'),_0x73c5('0xac'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0xad'),_0x73c5('0xae'));_0x2d3a3a[_0x73c5('0x49')](_0x73c5('0xaf'),_0x73c5('0x2f'));}if(_0xa9cb1[_0x73c5('0x21')])_0x2d3a3a[_0x73c5('0x21')](_0xa9cb1[_0x73c5('0x21')]);if(_0xa9cb1['offset'])_0x2d3a3a['offset'](_0xa9cb1[_0x73c5('0x1e')]);return db['sequelize'][_0x73c5('0x3e')](_0x2d3a3a[_0x73c5('0x9b')](),_0x5456de);})[_0x73c5('0x27')](function(_0x2ddba6){if(_0x2ddba6['length']>0x0)_0xf9f6f8[_0x73c5('0x7b')](_0x73c5('0xb0'),_[_0x73c5('0x2e')](_0x2ddba6,'id'));return db['sequelize'][_0x73c5('0x3e')](_0xf9f6f8['toString'](),_0x5456de)[_0x73c5('0x27')](function(_0x2072f5){var _0x546c97=_[_0x73c5('0xb1')](_0x2072f5,_0x73c5('0xb2'));var _0x480cb2=[];_0x2ddba6[_0x73c5('0x31')](function(_0x52cc7f){_0x480cb2[_0x73c5('0xb3')](updateFaxInteraction(_0x52cc7f,_0x140f04,_0x546c97));});return BPromise[_0x73c5('0xb4')](_0x480cb2);});});})[_0x73c5('0x27')](function(_0x56f40e){_0x147452['rows']=_0x56f40e;return _0x147452;})[_0x73c5('0x27')](respondWithFilteredResult(_0x1c7a0e,_0xa9cb1))[_0x73c5('0x33')](handleError(_0x1c7a0e,null));};exports[_0x73c5('0xb5')]=function(_0x91d98d,_0x3397c2){var _0x523097={'raw':![],'where':{'id':_0x91d98d[_0x73c5('0xb6')]['id']}},_0x1c0d87={};_0x1c0d87[_0x73c5('0x3d')]=_[_0x73c5('0x3f')](db[_0x73c5('0x39')][_0x73c5('0x3a')]);_0x1c0d87[_0x73c5('0x3e')]=_[_0x73c5('0x3f')](_0x91d98d[_0x73c5('0x3e')]);_0x1c0d87[_0x73c5('0x40')]=_[_0x73c5('0x41')](_0x1c0d87[_0x73c5('0x3d')],_0x1c0d87[_0x73c5('0x3e')]);_0x523097[_0x73c5('0x43')]=_[_0x73c5('0x41')](_0x1c0d87[_0x73c5('0x3d')],qs[_0x73c5('0x42')](_0x91d98d[_0x73c5('0x3e')]['fields']));_0x523097[_0x73c5('0x43')]=_0x523097['attributes'][_0x73c5('0x44')]?_0x523097[_0x73c5('0x43')]:_0x1c0d87['model'];if(_0x91d98d[_0x73c5('0x3e')][_0x73c5('0xb7')]){_0x523097[_0x73c5('0xb8')]=[{'all':!![]}];}_0x523097=_[_0x73c5('0x9c')]({},_0x523097,_0x91d98d[_0x73c5('0xb9')]);return db[_0x73c5('0x39')][_0x73c5('0x6f')](_0x523097)[_0x73c5('0x27')](handleEntityNotFound(_0x3397c2,null))['then'](respondWithResult(_0x3397c2,null))[_0x73c5('0x33')](handleError(_0x3397c2,null));};exports['create']=function(_0x10f83a,_0x1e7f6c){return db[_0x73c5('0x39')][_0x73c5('0xba')](_0x10f83a[_0x73c5('0x72')],{})[_0x73c5('0x27')](respondWithResult(_0x1e7f6c,0xc9))[_0x73c5('0x33')](handleError(_0x1e7f6c,null));};exports[_0x73c5('0x26')]=function(_0x253840,_0xb84129){if(_0x253840[_0x73c5('0x72')]['id']){delete _0x253840[_0x73c5('0x72')]['id'];}return db[_0x73c5('0x39')][_0x73c5('0x6f')]({'where':{'id':_0x253840['params']['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0xb84129,null))[_0x73c5('0x27')](saveUpdates(_0x253840[_0x73c5('0x72')],null))[_0x73c5('0x27')](respondWithResult(_0xb84129,null))[_0x73c5('0x33')](handleError(_0xb84129,null));};exports[_0x73c5('0x28')]=function(_0x2cc3cf,_0x2c0fcb){return db[_0x73c5('0x39')][_0x73c5('0x6f')]({'where':{'id':_0x2cc3cf[_0x73c5('0xb6')]['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0x2c0fcb,null))[_0x73c5('0x27')](removeEntity(_0x2c0fcb,null))[_0x73c5('0x33')](handleError(_0x2c0fcb,null));};exports[_0x73c5('0xbb')]=function(_0x394ab8,_0x44e76c){return db[_0x73c5('0x39')]['describe']()[_0x73c5('0x27')](respondWithResult(_0x44e76c,null))[_0x73c5('0x33')](handleError(_0x44e76c,null));};exports['addMessage']=function(_0x347349,_0x298dd3,_0x38b311){return db[_0x73c5('0xbc')][_0x73c5('0x6f')]({'where':{'id':_0x347349[_0x73c5('0xb6')]['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0x298dd3,null))['then'](function(_0x4468a2){if(_0x4468a2){return _0x4468a2[_0x73c5('0xbd')](_0x347349[_0x73c5('0x72')][_0x73c5('0xbe')],_['omit'](_0x347349[_0x73c5('0x72')],['ids','id'])||{});}})[_0x73c5('0x27')](respondWithResult(_0x298dd3,null))[_0x73c5('0x33')](handleError(_0x298dd3,null));};exports[_0x73c5('0xbf')]=function(_0x86aa41,_0x27726b,_0x53529b){var _0x494a0a={'raw':![],'where':{}};var _0x3c2747={};var _0x28adfa={'count':0x0,'rows':[]};return db[_0x73c5('0x39')]['findOne']({'where':{'id':_0x86aa41[_0x73c5('0xb6')]['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0x27726b,null))[_0x73c5('0x27')](function(_0x117927){if(_0x117927){_0x3c2747[_0x73c5('0x3d')]=_[_0x73c5('0x3f')](db[_0x73c5('0xbc')][_0x73c5('0x3a')]);_0x3c2747[_0x73c5('0x3e')]=_[_0x73c5('0x3f')](_0x86aa41[_0x73c5('0x3e')]);_0x3c2747[_0x73c5('0x40')]=_[_0x73c5('0x41')](_0x3c2747[_0x73c5('0x3d')],_0x3c2747[_0x73c5('0x3e')]);_0x494a0a[_0x73c5('0x43')]=_['intersection'](_0x3c2747[_0x73c5('0x3d')],qs['fields'](_0x86aa41[_0x73c5('0x3e')]['fields']));_0x494a0a[_0x73c5('0x43')]=_0x494a0a[_0x73c5('0x43')]['length']?_0x494a0a['attributes']:_0x3c2747[_0x73c5('0x3d')];if(!_0x86aa41[_0x73c5('0x3e')]['hasOwnProperty'](_0x73c5('0xc0'))){_0x494a0a[_0x73c5('0x21')]=qs['limit'](_0x86aa41['query'][_0x73c5('0x21')]);_0x494a0a['offset']=qs[_0x73c5('0x1e')](_0x86aa41[_0x73c5('0x3e')][_0x73c5('0x1e')]);}_0x494a0a[_0x73c5('0x45')]=qs[_0x73c5('0x46')](_0x86aa41[_0x73c5('0x3e')][_0x73c5('0x46')]);_0x494a0a[_0x73c5('0x7b')]=qs[_0x73c5('0x40')](_[_0x73c5('0x47')](_0x86aa41[_0x73c5('0x3e')],_0x3c2747['filters']));_0x494a0a[_0x73c5('0x7b')][_0x73c5('0xb2')]=_0x117927['id'];if(_0x86aa41[_0x73c5('0x3e')][_0x73c5('0x85')]){_0x494a0a[_0x73c5('0x7b')]=_['merge'](_0x494a0a[_0x73c5('0x7b')],{'$or':_[_0x73c5('0x2e')](_0x494a0a[_0x73c5('0x43')],function(_0xdc04e1){var _0x2ec93a={};_0x2ec93a[_0xdc04e1]={'$like':'%'+_0x86aa41[_0x73c5('0x3e')][_0x73c5('0x85')]+'%'};return _0x2ec93a;})});}if(_0x86aa41[_0x73c5('0x3e')][_0x73c5('0x79')]){var _0x242444=_0x86aa41['query']['$gte'][_0x73c5('0x30')](',');var _0x2f0a0d={};_0x2f0a0d[_0x242444[0x0]]={'$gte':moment(_0x242444[0x1])[_0x73c5('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x494a0a[_0x73c5('0x7b')]=_[_0x73c5('0x9c')](_0x494a0a['where'],_0x2f0a0d);}_0x494a0a=_[_0x73c5('0x9c')]({},_0x494a0a,_0x86aa41['options']);return db[_0x73c5('0xbc')][_0x73c5('0x20')]({'where':_0x494a0a['where']})[_0x73c5('0x27')](function(_0x5a2319){_0x28adfa['count']=_0x5a2319;if(_0x86aa41[_0x73c5('0x3e')]['includeAll']){_0x494a0a[_0x73c5('0xb8')]=[{'all':!![]}];}return db[_0x73c5('0xbc')][_0x73c5('0xc2')](_0x494a0a);})['then'](function(_0x398f2b){_0x28adfa[_0x73c5('0xc3')]=_0x398f2b;return _0x28adfa;});}})[_0x73c5('0x27')](respondWithFilteredResult(_0x27726b,_0x494a0a))[_0x73c5('0x33')](handleError(_0x27726b,null));};exports[_0x73c5('0xc4')]=function(_0x283403,_0x44ddf2,_0x3e0593){return db['FaxInteraction'][_0x73c5('0x6f')]({'where':{'id':_0x283403[_0x73c5('0xb6')]['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0x44ddf2,null))[_0x73c5('0x27')](function(_0x4d1d93){if(_0x4d1d93){return _0x4d1d93[_0x73c5('0xc5')](_0x283403[_0x73c5('0x72')]['ids'],_['omit'](_0x283403[_0x73c5('0x72')],[_0x73c5('0xbe'),'id'])||{})[_0x73c5('0xc6')](function(){return db[_0x73c5('0x6a')]['findAll']({'attributes':['id',_0x73c5('0x2b'),_0x73c5('0xc7')],'where':{'id':_0x283403[_0x73c5('0x72')]['ids']}});})[_0x73c5('0x27')](function(_0x2b16db){socket[_0x73c5('0xc8')](_0x73c5('0xc9'),{'id':Number(_0x283403['params']['id']),'tags':_0x2b16db||[]});return{'id':Number(_0x283403[_0x73c5('0xb6')]['id']),'tags':_0x2b16db||[]};});}})[_0x73c5('0x27')](respondWithResult(_0x44ddf2,null))[_0x73c5('0x33')](handleError(_0x44ddf2,null));};exports[_0x73c5('0xca')]=function(_0x3861a1,_0x4a0e71,_0x456421){return db[_0x73c5('0x39')][_0x73c5('0x6f')]({'where':{'id':_0x3861a1[_0x73c5('0xb6')]['id']}})[_0x73c5('0x27')](handleEntityNotFound(_0x4a0e71,null))[_0x73c5('0x27')](function(_0x31da45){if(_0x31da45){return _0x31da45[_0x73c5('0xca')](_0x3861a1[_0x73c5('0x3e')][_0x73c5('0xbe')]);}})[_0x73c5('0x27')](respondWithStatusCode(_0x4a0e71,null))[_0x73c5('0x33')](handleError(_0x4a0e71,null));};exports[_0x73c5('0xcb')]=function(_0x2a3054,_0xa6b80d){var _0x2ecfdc=moment()[_0x73c5('0xcc')]()[_0x73c5('0x9b')]();var _0x3a8645=path[_0x73c5('0xcd')](config[_0x73c5('0xce')],_0x73c5('0xcf'),_0x73c5('0xd0'),'tmp');var _0x134234=path[_0x73c5('0xcd')](config['root'],_0x73c5('0xcf'),_0x73c5('0xd0'),_0x73c5('0xd1'));var _0x4e592d=path['join'](_0x3a8645,_0x2ecfdc);var _0x228eea=util['format'](_0x73c5('0xd2'),_0x2a3054[_0x73c5('0xb6')]['id'],_0x2ecfdc);var _0x10fec3=path['join'](_0x3a8645,_0x228eea);var _0x414972=[];_0x414972[_0x73c5('0xb3')]({'model':db['Attachment'],'as':_0x73c5('0xd3'),'raw':!![]});var _0x59efef=[{'model':db[_0x73c5('0xbc')],'as':'Messages','attributes':['id',_0x73c5('0x72'),'createdAt'],'include':_0x414972}];return db[_0x73c5('0x39')]['find']({'where':{'id':_0x2a3054[_0x73c5('0xb6')]['id']},'include':_0x59efef})[_0x73c5('0x27')](handleEntityNotFound(_0xa6b80d,null))[_0x73c5('0x27')](function(_0x30ae7c){if(_0x30ae7c&&_0x30ae7c['Messages']){var _0x43df78=_0x30ae7c[_0x73c5('0xd4')]({'plain':!![]});fs[_0x73c5('0xd5')](_0x4e592d);for(var _0x20903e=0x0;_0x20903e<_0x43df78[_0x73c5('0xd6')][_0x73c5('0x44')];_0x20903e++){var _0x582a03=_0x43df78[_0x73c5('0xd6')][_0x20903e]['Attachment'];if(_0x582a03){var _0xe59570=path[_0x73c5('0xcd')](_0x134234,_0x582a03[_0x73c5('0xd7')]);if(fs['existsSync'](_0xe59570)){fs[_0x73c5('0xd8')](_0xe59570)['pipe'](fs[_0x73c5('0xd9')](path[_0x73c5('0xcd')](_0x4e592d,_0x582a03[_0x73c5('0xd7')])));}}}return BPromise[_0x73c5('0x93')]()['then'](function(){return new BPromise(function(_0x517dd8,_0x21d04f){zipdir(_0x4e592d,{'saveTo':_0x10fec3},function(_0x51cbdc,_0x14692c){if(_0x51cbdc)return _0x21d04f(_0x51cbdc);return _0x517dd8(_0x14692c);});})['then'](function(){return new BPromise(function(_0x43d3f1,_0x305f6b){rimraf(_0x4e592d,function(_0x515cfd){if(_0x515cfd)_0x305f6b(_0x515cfd);return _0x43d3f1();});});})['then'](function(){return _0xa6b80d[_0x73c5('0xcb')](_0x10fec3,_0x228eea,function(_0x5409da){if(_0x5409da){console[_0x73c5('0xda')](_0x73c5('0xdb'),_0x5409da);}else{fs[_0x73c5('0xdc')](_0x10fec3);}});});});}else{return _0xa6b80d[_0x73c5('0x29')](0xc8);}})[_0x73c5('0x33')](handleError(_0xa6b80d,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4cbf201..3761c63 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f66=['emit','catch','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','length'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f66,0x74));var _0x67f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f66[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x67f6('0x0'))['db'][_0x67f6('0x1')];var FaxMessage=require(_0x67f6('0x0'))['db'][_0x67f6('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x67f6('0x3')](0x0);var events={'afterCreate':_0x67f6('0x4'),'afterUpdate':'update','afterDestroy':_0x67f6('0x5')};function emitEvent(_0x109496){return function(_0x11ac8a,_0x414028,_0xb5f69e){_0x11ac8a[_0x67f6('0x6')]({'attributes':['id'],'raw':!![]})[_0x67f6('0x7')](function(_0x50988e){_0x11ac8a[_0x67f6('0x8')](_0x67f6('0x9'),_0x50988e[_0x67f6('0xa')](function(_0x59486f){return{'id':_0x59486f['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x11ac8a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xf1a643){_0x11ac8a[_0x67f6('0x8')]('unreadMessages',_0xf1a643[_0x67f6('0xb')]);FaxInteractionEvents['emit'](_0x109496+':'+_0x11ac8a['id'],_0x11ac8a);FaxInteractionEvents[_0x67f6('0xc')](_0x109496,_0x11ac8a);_0xb5f69e(null);})[_0x67f6('0xd')](_0xb5f69e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x67f6('0xe')](e,emitEvent(event));}}module[_0x67f6('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a81=['setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','update','remove','getUsers','then'];(function(_0x7192c3,_0x29d1aa){var _0x79a6ed=function(_0x3feb55){while(--_0x3feb55){_0x7192c3['push'](_0x7192c3['shift']());}};_0x79a6ed(++_0x29d1aa);}(_0x7a81,0xf9));var _0x17a8=function(_0x341a3c,_0x3a2dad){_0x341a3c=_0x341a3c-0x0;var _0xacaa19=_0x7a81[_0x341a3c];return _0xacaa19;};'use strict';var EventEmitter=require(_0x17a8('0x0'));var FaxInteraction=require(_0x17a8('0x1'))['db'][_0x17a8('0x2')];var FaxMessage=require(_0x17a8('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x17a8('0x3'),'afterDestroy':_0x17a8('0x4')};function emitEvent(_0x591579){return function(_0x5bc522,_0x58e09c,_0x433af6){_0x5bc522[_0x17a8('0x5')]({'attributes':['id'],'raw':!![]})[_0x17a8('0x6')](function(_0x4d42a7){_0x5bc522[_0x17a8('0x7')](_0x17a8('0x8'),_0x4d42a7[_0x17a8('0x9')](function(_0x1ecffe){return{'id':_0x1ecffe['id']};}));return FaxMessage[_0x17a8('0xa')]({'where':{'FaxInteractionId':_0x5bc522['id'],'direction':'in','read':![]},'raw':!![]});})[_0x17a8('0x6')](function(_0x4599d6){_0x5bc522[_0x17a8('0x7')]('unreadMessages',_0x4599d6[_0x17a8('0xb')]);FaxInteractionEvents[_0x17a8('0xc')](_0x591579+':'+_0x5bc522['id'],_0x5bc522);FaxInteractionEvents[_0x17a8('0xc')](_0x591579,_0x5bc522);_0x433af6(null);})['catch'](_0x433af6(null));};}for(var e in events){if(events[_0x17a8('0xd')](e)){var event=events[e];FaxInteraction[_0x17a8('0xe')](e,emitEvent(event));}}module[_0x17a8('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 59942f5..2dfccfc 100644 --- a/server/api/faxInteraction/faxInteraction.model.js +++ b/server/api/faxInteraction/faxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc599=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed'];(function(_0xe7d42b,_0x1e5a1c){var _0x356072=function(_0x174e93){while(--_0x174e93){_0xe7d42b['push'](_0xe7d42b['shift']());}};_0x356072(++_0x1e5a1c);}(_0xc599,0x123));var _0x9c59=function(_0x167211,_0x52c558){_0x167211=_0x167211-0x0;var _0x395f67=_0xc599[_0x167211];return _0x395f67;};'use strict';var _=require(_0x9c59('0x0'));var util=require(_0x9c59('0x1'));var logger=require(_0x9c59('0x2'))(_0x9c59('0x3'));var moment=require(_0x9c59('0x4'));var BPromise=require(_0x9c59('0x5'));var rp=require(_0x9c59('0x6'));var fs=require('fs');var path=require(_0x9c59('0x7'));var rimraf=require(_0x9c59('0x8'));var config=require('../../config/environment');var attributes=require(_0x9c59('0x9'));module[_0x9c59('0xa')]=function(_0x452511,_0x2bcf35){return _0x452511[_0x9c59('0xb')](_0x9c59('0xc'),attributes,{'tableName':_0x9c59('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xb963b,_0x8deecd,_0x368c1d){if(_0xb963b[_0x9c59('0xe')]('closed')){_0xb963b[_0x9c59('0xf')]=moment()[_0x9c59('0x10')](_0x9c59('0x11'));}_0x368c1d(null,_0xb963b);}}});}; \ No newline at end of file +var _0xd6f9=['changed','closed','closedAt','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','fax_interactions'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd6f9[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x9d6f('0x0'));var util=require(_0x9d6f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d6f('0x2'));var BPromise=require(_0x9d6f('0x3'));var rp=require(_0x9d6f('0x4'));var fs=require('fs');var path=require(_0x9d6f('0x5'));var rimraf=require('rimraf');var config=require(_0x9d6f('0x6'));var attributes=require(_0x9d6f('0x7'));module[_0x9d6f('0x8')]=function(_0x5ec60d,_0x12d741){return _0x5ec60d['define']('FaxInteraction',attributes,{'tableName':_0x9d6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x523a52,_0x193661,_0x3a55ba){if(_0x523a52[_0x9d6f('0xa')](_0x9d6f('0xb'))){_0x523a52[_0x9d6f('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3a55ba(null,_0x523a52);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 9fd2dd3..d042905 100644 --- a/server/api/faxInteraction/faxInteraction.rpc.js +++ b/server/api/faxInteraction/faxInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb36=['./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter'];(function(_0x349077,_0x2eafb1){var _0x277000=function(_0x26de51){while(--_0x26de51){_0x349077['push'](_0x349077['shift']());}};_0x277000(++_0x2eafb1);}(_0xeb36,0x66));var _0x6eb3=function(_0x357ac5,_0x5d030){_0x357ac5=_0x357ac5-0x0;var _0x1534bd=_0xeb36[_0x357ac5];return _0x1534bd;};'use strict';var _=require('lodash');var util=require(_0x6eb3('0x0'));var moment=require(_0x6eb3('0x1'));var BPromise=require(_0x6eb3('0x2'));var rs=require(_0x6eb3('0x3'));var fs=require('fs');var Redis=require(_0x6eb3('0x4'));var db=require(_0x6eb3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6eb3('0x6'))('rpc');var config=require(_0x6eb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6eb3('0x8')]['http']({'port':0x232a});config[_0x6eb3('0x9')]=_['defaults'](config[_0x6eb3('0x9')],{'host':_0x6eb3('0xa'),'port':0x18eb});var socket=require(_0x6eb3('0xb'))(new Redis(config[_0x6eb3('0x9')]));require(_0x6eb3('0xc'))[_0x6eb3('0xd')](socket);function respondWithRpcPromise(_0x48f1d8,_0x291d0d,_0x628e38){return new BPromise(function(_0x18a41a,_0x2a207c){return client[_0x6eb3('0xe')](_0x48f1d8,_0x628e38)[_0x6eb3('0xf')](function(_0x2917bb){logger[_0x6eb3('0x10')](_0x6eb3('0x11'),_0x291d0d,'request\x20sent');logger[_0x6eb3('0x12')](_0x6eb3('0x13'),_0x291d0d,_0x6eb3('0x14'),JSON[_0x6eb3('0x15')](_0x2917bb));if(_0x2917bb['error']){if(_0x2917bb[_0x6eb3('0x16')][_0x6eb3('0x17')]===0x1f4){logger[_0x6eb3('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x291d0d,_0x2917bb[_0x6eb3('0x16')]['message']);return _0x2a207c(_0x2917bb[_0x6eb3('0x16')]['message']);}logger['error'](_0x6eb3('0x11'),_0x291d0d,_0x2917bb['error'][_0x6eb3('0x18')]);return _0x18a41a(_0x2917bb['error']['message']);}else{logger[_0x6eb3('0x10')](_0x6eb3('0x11'),_0x291d0d,_0x6eb3('0x14'));_0x18a41a(_0x2917bb['result'][_0x6eb3('0x18')]);}})[_0x6eb3('0x19')](function(_0x7c29cd){logger[_0x6eb3('0x16')](_0x6eb3('0x11'),_0x291d0d,_0x7c29cd);_0x2a207c(_0x7c29cd);});});}exports[_0x6eb3('0x1a')]=function(_0x36f150){var _0x59fff1=this;return new Promise(function(_0x1efc0e,_0x27d79c){return db[_0x6eb3('0x1b')]['update'](_0x36f150[_0x6eb3('0x1c')],{'raw':_0x36f150[_0x6eb3('0x1d')]?_0x36f150[_0x6eb3('0x1d')][_0x6eb3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f150['options']?_0x36f150['options'][_0x6eb3('0x1f')]||null:null,'attributes':_0x36f150['options']?_0x36f150[_0x6eb3('0x1d')][_0x6eb3('0x20')]||null:null,'limit':_0x36f150[_0x6eb3('0x1d')]?_0x36f150[_0x6eb3('0x1d')]['limit']||null:null})[_0x6eb3('0xf')](function(_0x3d8dce){logger[_0x6eb3('0x10')]('UpdateFaxInteraction',_0x36f150);logger['debug']('UpdateFaxInteraction',_0x36f150,JSON[_0x6eb3('0x15')](_0x3d8dce));_0x1efc0e(_0x3d8dce);})['catch'](function(_0x30b30f){logger[_0x6eb3('0x16')](_0x6eb3('0x1a'),_0x30b30f['message'],_0x36f150);_0x27d79c(_0x59fff1[_0x6eb3('0x16')](0x1f4,_0x30b30f['message']));});});};exports[_0x6eb3('0x21')]=function(_0x555fe9){return new Promise(function(_0x9a8a17,_0x31d9d2){return db['FaxInteraction']['find']({'where':_0x555fe9[_0x6eb3('0x1d')]?_0x555fe9[_0x6eb3('0x1d')][_0x6eb3('0x1f')]||null:null})['then'](function(_0x3ce89c){if(_0x3ce89c){return _0x3ce89c[_0x6eb3('0x22')](_0x555fe9[_0x6eb3('0x1c')][_0x6eb3('0x23')],_[_0x6eb3('0x24')](_0x555fe9[_0x6eb3('0x1c')],[_0x6eb3('0x23'),'id'])||{});}})['spread'](function(_0x4f821c){logger[_0x6eb3('0x10')](_0x6eb3('0x25'),_0x555fe9);logger['debug'](_0x6eb3('0x25'),_0x555fe9,JSON[_0x6eb3('0x15')](_0x4f821c));_0x9a8a17(_0x4f821c);})['catch'](function(_0x11d5ef){logger[_0x6eb3('0x16')](_0x6eb3('0x25'),_0x11d5ef['message'],_0x555fe9);_0x31d9d2(_this['error'](0x1f4,_0x11d5ef[_0x6eb3('0x18')]));});});}; \ No newline at end of file +var _0x77d9=['code','message','result','catch','update','body','raw','options','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x47b3e1,_0x28f43b){var _0x33d2f5=function(_0xc42700){while(--_0xc42700){_0x47b3e1['push'](_0x47b3e1['shift']());}};_0x33d2f5(++_0x28f43b);}(_0x77d9,0x198));var _0x977d=function(_0x5acaea,_0x442cb0){_0x5acaea=_0x5acaea-0x0;var _0x509dfa=_0x77d9[_0x5acaea];return _0x509dfa;};'use strict';var _=require(_0x977d('0x0'));var util=require(_0x977d('0x1'));var moment=require(_0x977d('0x2'));var BPromise=require('bluebird');var rs=require(_0x977d('0x3'));var fs=require('fs');var Redis=require(_0x977d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x977d('0x5'))(_0x977d('0x6'));var config=require('../../config/environment');var jayson=require(_0x977d('0x7'));var client=jayson[_0x977d('0x8')]['http']({'port':0x232a});config[_0x977d('0x9')]=_[_0x977d('0xa')](config['redis'],{'host':_0x977d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x977d('0x9')]));require(_0x977d('0xc'))[_0x977d('0xd')](socket);function respondWithRpcPromise(_0x1f647f,_0x50eaca,_0x1ec1e){return new BPromise(function(_0x107f5a,_0x134d4e){return client[_0x977d('0xe')](_0x1f647f,_0x1ec1e)[_0x977d('0xf')](function(_0x556fe5){logger[_0x977d('0x10')](_0x977d('0x11'),_0x50eaca,'request\x20sent');logger['debug'](_0x977d('0x12'),_0x50eaca,_0x977d('0x13'),JSON[_0x977d('0x14')](_0x556fe5));if(_0x556fe5[_0x977d('0x15')]){if(_0x556fe5[_0x977d('0x15')][_0x977d('0x16')]===0x1f4){logger[_0x977d('0x15')](_0x977d('0x11'),_0x50eaca,_0x556fe5[_0x977d('0x15')][_0x977d('0x17')]);return _0x134d4e(_0x556fe5[_0x977d('0x15')]['message']);}logger['error'](_0x977d('0x11'),_0x50eaca,_0x556fe5[_0x977d('0x15')][_0x977d('0x17')]);return _0x107f5a(_0x556fe5[_0x977d('0x15')][_0x977d('0x17')]);}else{logger[_0x977d('0x10')](_0x977d('0x11'),_0x50eaca,_0x977d('0x13'));_0x107f5a(_0x556fe5[_0x977d('0x18')][_0x977d('0x17')]);}})[_0x977d('0x19')](function(_0x288116){logger['error'](_0x977d('0x11'),_0x50eaca,_0x288116);_0x134d4e(_0x288116);});});}exports['UpdateFaxInteraction']=function(_0x5472ca){var _0x1d114d=this;return new Promise(function(_0x2bf832,_0x354735){return db['FaxInteraction'][_0x977d('0x1a')](_0x5472ca[_0x977d('0x1b')],{'raw':_0x5472ca['options']?_0x5472ca['options'][_0x977d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5472ca['options']?_0x5472ca[_0x977d('0x1d')][_0x977d('0x1e')]||null:null,'attributes':_0x5472ca['options']?_0x5472ca['options'][_0x977d('0x1f')]||null:null,'limit':_0x5472ca[_0x977d('0x1d')]?_0x5472ca[_0x977d('0x1d')][_0x977d('0x20')]||null:null})[_0x977d('0xf')](function(_0x41d499){logger[_0x977d('0x10')]('UpdateFaxInteraction',_0x5472ca);logger['debug'](_0x977d('0x21'),_0x5472ca,JSON[_0x977d('0x14')](_0x41d499));_0x2bf832(_0x41d499);})[_0x977d('0x19')](function(_0x31861d){logger[_0x977d('0x15')]('UpdateFaxInteraction',_0x31861d[_0x977d('0x17')],_0x5472ca);_0x354735(_0x1d114d[_0x977d('0x15')](0x1f4,_0x31861d[_0x977d('0x17')]));});});};exports[_0x977d('0x22')]=function(_0x573228){return new Promise(function(_0x1f4677,_0x5491c1){return db[_0x977d('0x23')][_0x977d('0x24')]({'where':_0x573228[_0x977d('0x1d')]?_0x573228[_0x977d('0x1d')]['where']||null:null})['then'](function(_0x1d2a97){if(_0x1d2a97){return _0x1d2a97[_0x977d('0x25')](_0x573228[_0x977d('0x1b')][_0x977d('0x26')],_[_0x977d('0x27')](_0x573228[_0x977d('0x1b')],['ids','id'])||{});}})[_0x977d('0x28')](function(_0x3080f9){logger['info'](_0x977d('0x29'),_0x573228);logger[_0x977d('0x2a')](_0x977d('0x29'),_0x573228,JSON[_0x977d('0x14')](_0x3080f9));_0x1f4677(_0x3080f9);})[_0x977d('0x19')](function(_0xee5e6a){logger[_0x977d('0x15')](_0x977d('0x29'),_0xee5e6a[_0x977d('0x17')],_0x573228);_0x5491c1(_this[_0x977d('0x15')](0x1f4,_0xee5e6a[_0x977d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5653b56..1776d0e 100644 --- a/server/api/faxInteraction/faxInteraction.socket.js +++ b/server/api/faxInteraction/faxInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8190=['faxInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x204967,_0x2a506a){var _0x134dff=function(_0x3acfb2){while(--_0x3acfb2){_0x204967['push'](_0x204967['shift']());}};_0x134dff(++_0x2a506a);}(_0x8190,0x12e));var _0x0819=function(_0x268ce0,_0x596a6e){_0x268ce0=_0x268ce0-0x0;var _0x207df1=_0x8190[_0x268ce0];return _0x207df1;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0819('0x0'),_0x0819('0x1'),_0x0819('0x2')];function createListener(_0xf4e19e,_0x4d7d6b){return function(_0x448f53){_0x4d7d6b[_0x0819('0x3')](_0xf4e19e,_0x448f53);};}function removeListener(_0x52ffc6,_0x4b54de){return function(){FaxInteractionEvents[_0x0819('0x4')](_0x52ffc6,_0x4b54de);};}exports[_0x0819('0x5')]=function(_0x328558){for(var _0x50e91b=0x0,_0x1428fc=events['length'];_0x50e91b<_0x1428fc;_0x50e91b++){var _0x4c9fb9=events[_0x50e91b];var _0x22a2c1=createListener(_0x0819('0x6')+_0x4c9fb9,_0x328558);FaxInteractionEvents['on'](_0x4c9fb9,_0x22a2c1);}}; \ No newline at end of file +var _0xd457=['update','emit','length','faxInteraction:','save','remove'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0xd457,0x15a));var _0x7d45=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xd457[_0x40ac5e];return _0x2839d6;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7d45('0x0'),_0x7d45('0x1'),_0x7d45('0x2')];function createListener(_0x24e598,_0x1e08c1){return function(_0x5453ec){_0x1e08c1[_0x7d45('0x3')](_0x24e598,_0x5453ec);};}function removeListener(_0x878e12,_0x4fb161){return function(){FaxInteractionEvents['removeListener'](_0x878e12,_0x4fb161);};}exports['register']=function(_0x314835){for(var _0x107419=0x0,_0x541cea=events[_0x7d45('0x4')];_0x107419<_0x541cea;_0x107419++){var _0x12bf98=events[_0x107419];var _0x2bf631=createListener(_0x7d45('0x5')+_0x12bf98,_0x314835);FaxInteractionEvents['on'](_0x12bf98,_0x2bf631);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 174bcd8..ceed81c 100644 --- a/server/api/faxInteraction/index.js +++ b/server/api/faxInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe300=['addTags','put','tracked','fax','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','/:id/messages','addMessage','faxinteraction:addtags'];(function(_0x37f1ec,_0x4e5888){var _0x487919=function(_0xfa5bb1){while(--_0xfa5bb1){_0x37f1ec['push'](_0x37f1ec['shift']());}};_0x487919(++_0x4e5888);}(_0xe300,0xa4));var _0x0e30=function(_0x130ba1,_0x598cbc){_0x130ba1=_0x130ba1-0x0;var _0x192471=_0xe300[_0x130ba1];return _0x192471;};'use strict';var multer=require(_0x0e30('0x0'));var util=require(_0x0e30('0x1'));var path=require('path');var timeout=require(_0x0e30('0x2'));var express=require(_0x0e30('0x3'));var router=express[_0x0e30('0x4')]();var fs_extra=require(_0x0e30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e30('0x6'));var config=require(_0x0e30('0x7'));var controller=require(_0x0e30('0x8'));router[_0x0e30('0x9')]('/',auth[_0x0e30('0xa')](),controller[_0x0e30('0xb')]);router['get'](_0x0e30('0xc'),auth[_0x0e30('0xa')](),controller[_0x0e30('0xd')]);router[_0x0e30('0x9')](_0x0e30('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0e30('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0e30('0xf')]);router[_0x0e30('0x9')](_0x0e30('0x10'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x11')]);router['post']('/',auth[_0x0e30('0xa')](),controller['create']);router[_0x0e30('0x12')](_0x0e30('0x13'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x14')]);router[_0x0e30('0x12')]('/:id/tags',auth[_0x0e30('0xa')](),interaction['tracked']('fax',_0x0e30('0x15')),controller[_0x0e30('0x16')]);router[_0x0e30('0x17')]('/:id',auth[_0x0e30('0xa')](),interaction[_0x0e30('0x18')](_0x0e30('0x19'),'faxinteraction:update'),controller['update']);router[_0x0e30('0x1a')](_0x0e30('0xe'),auth[_0x0e30('0xa')](),interaction[_0x0e30('0x18')](_0x0e30('0x19'),_0x0e30('0x1b')),controller['destroy']);router[_0x0e30('0x1a')](_0x0e30('0x1c'),auth[_0x0e30('0xa')](),controller[_0x0e30('0x1d')]);module[_0x0e30('0x1e')]=router; \ No newline at end of file +var _0x0c92=['express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','/describe','isAuthenticated','describe','show','/:id/messages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','multer','util','connect-timeout'];(function(_0x1f2f67,_0xb4a692){var _0x3fb585=function(_0x24c86b){while(--_0x24c86b){_0x1f2f67['push'](_0x1f2f67['shift']());}};_0x3fb585(++_0xb4a692);}(_0x0c92,0x1af));var _0x20c9=function(_0x651909,_0x15c6b4){_0x651909=_0x651909-0x0;var _0x572299=_0x0c92[_0x651909];return _0x572299;};'use strict';var multer=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var path=require('path');var timeout=require(_0x20c9('0x2'));var express=require(_0x20c9('0x3'));var router=express[_0x20c9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x20c9('0x5'));var interaction=require(_0x20c9('0x6'));var config=require('../../config/environment');var controller=require(_0x20c9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x20c9('0x8')](_0x20c9('0x9'),auth[_0x20c9('0xa')](),controller[_0x20c9('0xb')]);router[_0x20c9('0x8')]('/:id',auth[_0x20c9('0xa')](),controller[_0x20c9('0xc')]);router[_0x20c9('0x8')](_0x20c9('0xd'),auth[_0x20c9('0xa')](),controller['getMessages']);router[_0x20c9('0x8')](_0x20c9('0xe'),auth[_0x20c9('0xa')](),controller[_0x20c9('0xf')]);router['post']('/',auth[_0x20c9('0xa')](),controller[_0x20c9('0x10')]);router[_0x20c9('0x11')](_0x20c9('0xd'),auth[_0x20c9('0xa')](),controller[_0x20c9('0x12')]);router[_0x20c9('0x11')](_0x20c9('0x13'),auth[_0x20c9('0xa')](),interaction[_0x20c9('0x14')](_0x20c9('0x15'),_0x20c9('0x16')),controller[_0x20c9('0x17')]);router[_0x20c9('0x18')](_0x20c9('0x19'),auth['isAuthenticated'](),interaction[_0x20c9('0x14')](_0x20c9('0x15'),_0x20c9('0x1a')),controller[_0x20c9('0x1b')]);router[_0x20c9('0x1c')](_0x20c9('0x19'),auth[_0x20c9('0xa')](),interaction[_0x20c9('0x14')]('fax',_0x20c9('0x1d')),controller['destroy']);router['delete'](_0x20c9('0x13'),auth[_0x20c9('0xa')](),controller[_0x20c9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b1ba57e..aa46621 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22fb=['ENUM','out','TEXT','BOOLEAN'];(function(_0x17d58d,_0x4f2093){var _0x3316bb=function(_0x6270ad){while(--_0x6270ad){_0x17d58d['push'](_0x17d58d['shift']());}};_0x3316bb(++_0x4f2093);}(_0x22fb,0x192));var _0xb22f=function(_0x1d113d,_0x4d8726){_0x1d113d=_0x1d113d-0x0;var _0x2f49fa=_0x22fb[_0x1d113d];return _0x2f49fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xb22f('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb22f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb22f('0x2')]('in',_0xb22f('0x3')),'defaultValue':_0xb22f('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xb22f('0x0')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xdd0c=['ENUM','out','DATE','exports','TEXT','medium'];(function(_0x206e8e,_0x2cc618){var _0x326b61=function(_0x25093b){while(--_0x25093b){_0x206e8e['push'](_0x206e8e['shift']());}};_0x326b61(++_0x2cc618);}(_0xdd0c,0x165));var _0xcdd0=function(_0x4856ab,_0x286ece){_0x4856ab=_0x4856ab-0x0;var _0xeccf1a=_0xdd0c[_0x4856ab];return _0xeccf1a;};'use strict';var Sequelize=require('sequelize');module[_0xcdd0('0x0')]={'body':{'type':Sequelize[_0xcdd0('0x1')](_0xcdd0('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xcdd0('0x3')]('in','out'),'defaultValue':_0xcdd0('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xcdd0('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xcdd0('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 32cc406..56ebbb1 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f7a=['order','sort','where','pick','filter','VIRTUAL','options','include','findAll','show','params','rawAttributes','keys','includeAll','merge','body','find','destroy','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','channel','motionChannel','accept','EventManager','acceptmessage','reject','RejectMessage','sequelize','contact','SIP/%s','event','rejectmessage','create','CmContact','isNil','Attachment','SendFax','FaxAccountId','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','stack','name','send','FaxMessage','type','key','model','map','filters','intersection','query','fields','attributes','length','hasOwnProperty'];(function(_0x314134,_0x28129f){var _0x49b69b=function(_0x3a53d3){while(--_0x3a53d3){_0x314134['push'](_0x314134['shift']());}};_0x49b69b(++_0x28129f);}(_0x9f7a,0x170));var _0xa9f7=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9f7a[_0x1ccdf7];return _0x52a0ae;};'use strict';var emlformat=require(_0xa9f7('0x0'));var rimraf=require(_0xa9f7('0x1'));var zipdir=require(_0xa9f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9f7('0x3'));var moment=require(_0xa9f7('0x4'));var BPromise=require(_0xa9f7('0x5'));var Mustache=require(_0xa9f7('0x6'));var util=require(_0xa9f7('0x7'));var path=require(_0xa9f7('0x8'));var sox=require(_0xa9f7('0x9'));var csv=require('to-csv');var ejs=require(_0xa9f7('0xa'));var fs=require('fs');var fs_extra=require(_0xa9f7('0xb'));var _=require('lodash');var squel=require(_0xa9f7('0xc'));var crypto=require(_0xa9f7('0xd'));var jsforce=require(_0xa9f7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9f7('0x10'));var authService=require(_0xa9f7('0x11'));var qs=require(_0xa9f7('0x12'));var as=require(_0xa9f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9f7('0x14'))('api');var utils=require(_0xa9f7('0x15'));var config=require(_0xa9f7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9f7('0x17'))['db'];config[_0xa9f7('0x18')]=_[_0xa9f7('0x19')](config[_0xa9f7('0x18')],{'host':_0xa9f7('0x1a'),'port':0x18eb});var socket=require(_0xa9f7('0x1b'))(new Redis(config[_0xa9f7('0x18')]));require(_0xa9f7('0x1c'))[_0xa9f7('0x1d')](socket);var jayson=require(_0xa9f7('0x1e'));var client=jayson[_0xa9f7('0x1f')][_0xa9f7('0x20')]({'port':0x232c});var client9002=jayson[_0xa9f7('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a68cb,_0x1d1e14,_0x353344,_0x529840){return new BPromise(function(_0x2adcee,_0x536175){var _0x80c3b3=_0x529840||client;return _0x80c3b3[_0xa9f7('0x21')](_0x2a68cb,_0x353344)[_0xa9f7('0x22')](function(_0x5bfb8c){logger[_0xa9f7('0x23')](_0xa9f7('0x24'),_0x1d1e14,_0xa9f7('0x25'));logger[_0xa9f7('0x26')](_0xa9f7('0x27'),_0x1d1e14,'request\x20sent',JSON[_0xa9f7('0x28')](_0x5bfb8c));if(_0x5bfb8c[_0xa9f7('0x29')]){if(_0x5bfb8c['error'][_0xa9f7('0x2a')]===0x1f4){logger[_0xa9f7('0x29')](_0xa9f7('0x24'),_0x1d1e14,_0x5bfb8c[_0xa9f7('0x29')]['message']);return _0x536175(_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);}logger[_0xa9f7('0x29')](_0xa9f7('0x24'),_0x1d1e14,_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);return _0x2adcee(_0x5bfb8c[_0xa9f7('0x29')][_0xa9f7('0x2b')]);}else{logger[_0xa9f7('0x23')](_0xa9f7('0x24'),_0x1d1e14,'request\x20sent');_0x2adcee(_0x5bfb8c[_0xa9f7('0x2c')][_0xa9f7('0x2b')]);}})[_0xa9f7('0x2d')](function(_0x222cce){logger['error'](_0xa9f7('0x24'),_0x1d1e14,_0x222cce);_0x536175(_0x222cce);});});}function respondWithStatusCode(_0x5a8b4a,_0x5c0799){_0x5c0799=_0x5c0799||0xcc;return function(_0x142286){if(_0x142286){return _0x5a8b4a[_0xa9f7('0x2e')](_0x5c0799);}return _0x5a8b4a[_0xa9f7('0x2f')](_0x5c0799)[_0xa9f7('0x30')]();};}function respondWithResult(_0x462070,_0x458a28){_0x458a28=_0x458a28||0xc8;return function(_0x192372){if(_0x192372){return _0x462070[_0xa9f7('0x2f')](_0x458a28)[_0xa9f7('0x31')](_0x192372);}};}function respondWithFilteredResult(_0x414772,_0x1d7e0b){return function(_0x29dee3){if(_0x29dee3){var _0x31827b=typeof _0x1d7e0b[_0xa9f7('0x32')]===_0xa9f7('0x33')&&typeof _0x1d7e0b[_0xa9f7('0x34')]===_0xa9f7('0x33');var _0x5330d7=_0x29dee3['count'];var _0x210ced=_0x31827b?0x0:_0x1d7e0b[_0xa9f7('0x32')];var _0x53aee0=_0x31827b?_0x29dee3[_0xa9f7('0x35')]:_0x1d7e0b[_0xa9f7('0x32')]+_0x1d7e0b[_0xa9f7('0x34')];var _0x4c59fa;if(_0x53aee0>=_0x5330d7){_0x53aee0=_0x5330d7;_0x4c59fa=0xc8;}else{_0x4c59fa=0xce;}_0x414772[_0xa9f7('0x2f')](_0x4c59fa);return _0x414772[_0xa9f7('0x36')](_0xa9f7('0x37'),_0x210ced+'-'+_0x53aee0+'/'+_0x5330d7)['json'](_0x29dee3);}return null;};}function patchUpdates(_0x407ec1){return function(_0x2f4943){try{jsonpatch[_0xa9f7('0x38')](_0x2f4943,_0x407ec1,!![]);}catch(_0x7b9c8e){return BPromise['reject'](_0x7b9c8e);}return _0x2f4943[_0xa9f7('0x39')]();};}function saveUpdates(_0x558370,_0x1be2d5){return function(_0x296207){if(_0x296207){return _0x296207['update'](_0x558370)[_0xa9f7('0x22')](function(_0x4f8242){return _0x4f8242;});}return null;};}function removeEntity(_0x5339af,_0x283632){return function(_0x1850b5){if(_0x1850b5){return _0x1850b5['destroy']()[_0xa9f7('0x22')](function(){_0x5339af[_0xa9f7('0x2f')](0xcc)[_0xa9f7('0x30')]();});}};}function handleEntityNotFound(_0x5e8347,_0x5abc79){return function(_0x58819a){if(!_0x58819a){_0x5e8347[_0xa9f7('0x2e')](0x194);}return _0x58819a;};}function handleError(_0x172855,_0x429c1a){_0x429c1a=_0x429c1a||0x1f4;return function(_0x4f7feb){logger[_0xa9f7('0x29')](_0x4f7feb[_0xa9f7('0x3a')]);if(_0x4f7feb[_0xa9f7('0x3b')]){delete _0x4f7feb[_0xa9f7('0x3b')];}_0x172855[_0xa9f7('0x2f')](_0x429c1a)[_0xa9f7('0x3c')](_0x4f7feb);};}exports['index']=function(_0x1558e0,_0x27dbf8){var _0x30a887={},_0xc63edb={},_0x507f54={'count':0x0,'rows':[]};var _0x50a878=_['map'](db[_0xa9f7('0x3d')]['rawAttributes'],function(_0x26c856){return{'name':_0x26c856['fieldName'],'type':_0x26c856[_0xa9f7('0x3e')][_0xa9f7('0x3f')]};});_0xc63edb[_0xa9f7('0x40')]=_[_0xa9f7('0x41')](_0x50a878,_0xa9f7('0x3b'));_0xc63edb['query']=_['keys'](_0x1558e0['query']);_0xc63edb[_0xa9f7('0x42')]=_[_0xa9f7('0x43')](_0xc63edb[_0xa9f7('0x40')],_0xc63edb[_0xa9f7('0x44')]);_0x30a887['attributes']=_[_0xa9f7('0x43')](_0xc63edb[_0xa9f7('0x40')],qs[_0xa9f7('0x45')](_0x1558e0[_0xa9f7('0x44')]['fields']));_0x30a887[_0xa9f7('0x46')]=_0x30a887[_0xa9f7('0x46')][_0xa9f7('0x47')]?_0x30a887[_0xa9f7('0x46')]:_0xc63edb['model'];if(!_0x1558e0['query'][_0xa9f7('0x48')]('nolimit')){_0x30a887['limit']=qs[_0xa9f7('0x34')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x34')]);_0x30a887['offset']=qs[_0xa9f7('0x32')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x32')]);}_0x30a887[_0xa9f7('0x49')]=qs[_0xa9f7('0x4a')](_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x4a')]);_0x30a887[_0xa9f7('0x4b')]=qs[_0xa9f7('0x42')](_[_0xa9f7('0x4c')](_0x1558e0[_0xa9f7('0x44')],_0xc63edb[_0xa9f7('0x42')]),_0x50a878);if(_0x1558e0[_0xa9f7('0x44')][_0xa9f7('0x4d')]){_0x30a887['where']=_['merge'](_0x30a887[_0xa9f7('0x4b')],{'$or':_[_0xa9f7('0x41')](_0x50a878,function(_0xb7b2b6){if(_0xb7b2b6[_0xa9f7('0x3e')]!==_0xa9f7('0x4e')){var _0x4ddebd={};_0x4ddebd[_0xb7b2b6['name']]={'$like':'%'+_0x1558e0['query'][_0xa9f7('0x4d')]+'%'};return _0x4ddebd;}})});}_0x30a887=_['merge']({},_0x30a887,_0x1558e0[_0xa9f7('0x4f')]);var _0x55f8fb={'where':_0x30a887[_0xa9f7('0x4b')]};return db[_0xa9f7('0x3d')][_0xa9f7('0x35')](_0x55f8fb)[_0xa9f7('0x22')](function(_0x3edbb0){_0x507f54[_0xa9f7('0x35')]=_0x3edbb0;if(_0x1558e0[_0xa9f7('0x44')]['includeAll']){_0x30a887[_0xa9f7('0x50')]=[{'all':!![]}];}return db[_0xa9f7('0x3d')][_0xa9f7('0x51')](_0x30a887);})[_0xa9f7('0x22')](function(_0x4ae72b){_0x507f54['rows']=_0x4ae72b;return _0x507f54;})['then'](respondWithFilteredResult(_0x27dbf8,_0x30a887))['catch'](handleError(_0x27dbf8,null));};exports[_0xa9f7('0x52')]=function(_0x3a0768,_0x45876c){var _0x15610e={'raw':!![],'where':{'id':_0x3a0768[_0xa9f7('0x53')]['id']}},_0x8b8857={};_0x8b8857[_0xa9f7('0x40')]=_['keys'](db[_0xa9f7('0x3d')][_0xa9f7('0x54')]);_0x8b8857['query']=_[_0xa9f7('0x55')](_0x3a0768['query']);_0x8b8857[_0xa9f7('0x42')]=_[_0xa9f7('0x43')](_0x8b8857[_0xa9f7('0x40')],_0x8b8857[_0xa9f7('0x44')]);_0x15610e[_0xa9f7('0x46')]=_[_0xa9f7('0x43')](_0x8b8857[_0xa9f7('0x40')],qs[_0xa9f7('0x45')](_0x3a0768['query'][_0xa9f7('0x45')]));_0x15610e[_0xa9f7('0x46')]=_0x15610e[_0xa9f7('0x46')][_0xa9f7('0x47')]?_0x15610e[_0xa9f7('0x46')]:_0x8b8857[_0xa9f7('0x40')];if(_0x3a0768[_0xa9f7('0x44')][_0xa9f7('0x56')]){_0x15610e[_0xa9f7('0x50')]=[{'all':!![]}];}_0x15610e=_[_0xa9f7('0x57')]({},_0x15610e,_0x3a0768[_0xa9f7('0x4f')]);return db[_0xa9f7('0x3d')]['find'](_0x15610e)['then'](handleEntityNotFound(_0x45876c,null))['then'](respondWithResult(_0x45876c,null))[_0xa9f7('0x2d')](handleError(_0x45876c,null));};exports['update']=function(_0x1e8d51,_0xaeb264){if(_0x1e8d51[_0xa9f7('0x58')]['id']){delete _0x1e8d51['body']['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x1e8d51[_0xa9f7('0x53')]['id']}})[_0xa9f7('0x22')](handleEntityNotFound(_0xaeb264,null))['then'](saveUpdates(_0x1e8d51[_0xa9f7('0x58')],null))[_0xa9f7('0x22')](respondWithResult(_0xaeb264,null))[_0xa9f7('0x2d')](handleError(_0xaeb264,null));};exports[_0xa9f7('0x5a')]=function(_0x4d4592,_0x45c42b){return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x4d4592[_0xa9f7('0x53')]['id']}})[_0xa9f7('0x22')](handleEntityNotFound(_0x45c42b,null))[_0xa9f7('0x22')](removeEntity(_0x45c42b,null))['catch'](handleError(_0x45c42b,null));};exports[_0xa9f7('0x5b')]=function(_0x2a51aa,_0x3836a3){return db[_0xa9f7('0x3d')][_0xa9f7('0x5b')]()[_0xa9f7('0x22')](respondWithResult(_0x3836a3,null))[_0xa9f7('0x2d')](handleError(_0x3836a3,null));};var interaction_log=require('../../config/logger')(_0xa9f7('0x5c'));exports['accept']=function(_0xfd2cbc,_0x358510,_0xae67ad){var _0x5b7e8d={'agent':{},'channel':_0xa9f7('0x5d')};if(_0xfd2cbc[_0xa9f7('0x58')]['id']){delete _0xfd2cbc[_0xa9f7('0x58')]['id'];}_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x5e')]=!![];_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x5f')]=moment()[_0xa9f7('0x60')](_0xa9f7('0x61'));_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')]=_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')]||_0xfd2cbc[_0xa9f7('0x63')]['id'];_0x5b7e8d[_0xa9f7('0x64')]['id']=_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')];return db['FaxMessage'][_0xa9f7('0x59')]({'where':{'id':_0xfd2cbc[_0xa9f7('0x53')]['id'],'UserId':null}})[_0xa9f7('0x22')](handleEntityNotFound(_0x358510,null))[_0xa9f7('0x22')](saveUpdates(_0xfd2cbc[_0xa9f7('0x58')],null))[_0xa9f7('0x22')](function(_0x590bd4){if(_0x590bd4){_0x5b7e8d[_0xa9f7('0x2b')]=_0x590bd4[_0xa9f7('0x65')]({'plain':!![]});return db[_0xa9f7('0x66')][_0xa9f7('0x59')]({'where':{'id':_0x590bd4[_0xa9f7('0x67')]}});}return null;})[_0xa9f7('0x22')](handleEntityNotFound(_0x358510,null))['then'](function(_0x210bad){if(_0x210bad){return _0x210bad[_0xa9f7('0x68')]({'UserId':_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')],'read1stAt':_['isNil'](_0x210bad[_0xa9f7('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa9f7('0x22')](function(_0x4a4d3a){if(_0x4a4d3a){_0x5b7e8d[_0xa9f7('0x6a')]=_0x4a4d3a[_0xa9f7('0x65')]({'plain':!![]});interaction_log[_0xa9f7('0x23')](_0xa9f7('0x6b'),_0xfd2cbc[_0xa9f7('0x63')]['id'],_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x3b')],_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x6c')],_0x5b7e8d[_0xa9f7('0x6a')]['id'],_0xfd2cbc[_0xa9f7('0x58')]?JSON['stringify'](_0xfd2cbc['body']):_0xa9f7('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xa9f7('0x6e'),_0x5b7e8d);}return null;})['then'](function(_0x5152b9){var _0x35566e=_0xa9f7('0x6f')+_0x5152b9[_0xa9f7('0x2b')][_0xa9f7('0x70')];return db['sequelize'][_0xa9f7('0x44')](_0x35566e,{'type':db[_0xa9f7('0x71')][_0xa9f7('0x72')][_0xa9f7('0x73')],'raw':!![]})['then'](function(_0x3eefc9){return _0x3eefc9;});})['then'](function(_0x1f4cca){if(_0x1f4cca){_0x5b7e8d[_0xa9f7('0x2b')]['contact']=_0x1f4cca[0x0];if(!_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x62')])return;return db[_0xa9f7('0x74')][_0xa9f7('0x59')]({'where':{'id':_0xfd2cbc[_0xa9f7('0x58')]['UserId'],'role':_0xa9f7('0x64')},'attributes':['id',_0xa9f7('0x3b'),_0xa9f7('0x75'),_0xa9f7('0x76'),_0xa9f7('0x77')],'raw':!![]});}return null;})[_0xa9f7('0x22')](function(_0x54cef4){if(!_0x54cef4)return null;_0x5b7e8d[_0xa9f7('0x2b')]['agent']=_0x54cef4;return _0x5b7e8d;})[_0xa9f7('0x22')](function(_0xa91b0b){if(_0xa91b0b){if(_0xfd2cbc[_0xa9f7('0x58')][_0xa9f7('0x78')]){_0x5b7e8d['message']['interface']=util[_0xa9f7('0x60')]('SIP/%s',_0xfd2cbc[_0xa9f7('0x63')][_0xa9f7('0x3b')]);_0x5b7e8d[_0xa9f7('0x2b')][_0xa9f7('0x79')]=_0x5b7e8d[_0xa9f7('0x79')];_0x5b7e8d[_0xa9f7('0x2b')][_0xa9f7('0x7a')]=_0x5b7e8d[_0xa9f7('0x79')];_0x5b7e8d[_0xa9f7('0x2b')]['event']=_0xa9f7('0x7b');return respondWithRpcPromise('EventManager',_0xa9f7('0x7c'),{'event':_0xa9f7('0x7d'),'message':_0x5b7e8d[_0xa9f7('0x2b')]},client9002)[_0xa9f7('0x22')](function(){return _0x5b7e8d;});}return _0x5b7e8d;}return null;})[_0xa9f7('0x22')](respondWithResult(_0x358510,null))[_0xa9f7('0x2d')](handleError(_0x358510,null));};var interaction_log=require('../../config/logger')(_0xa9f7('0x5c'));exports[_0xa9f7('0x7e')]=function(_0x3ed963,_0x568770,_0x424fb3){var _0x23d000={'agent':{},'channel':_0xa9f7('0x5d')};if(_0x3ed963[_0xa9f7('0x58')]['id']){delete _0x3ed963[_0xa9f7('0x58')]['id'];}_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')]=_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')]||_0x3ed963[_0xa9f7('0x63')]['id'];_0x23d000[_0xa9f7('0x64')]['id']=_0x3ed963[_0xa9f7('0x58')]['UserId'];return db['FaxMessage'][_0xa9f7('0x59')]({'where':{'id':_0x3ed963[_0xa9f7('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x568770,null))[_0xa9f7('0x22')](function(_0x482318){if(_0x482318){_0x23d000[_0xa9f7('0x2b')]=_0x482318[_0xa9f7('0x65')]({'plain':!![]});return db['FaxInteraction'][_0xa9f7('0x59')]({'where':{'id':_0x482318[_0xa9f7('0x67')]}});}return null;})[_0xa9f7('0x22')](handleEntityNotFound(_0x568770,null))[_0xa9f7('0x22')](function(_0x31fd6e){if(_0x31fd6e){_0x23d000[_0xa9f7('0x6a')]=_0x31fd6e['get']({'plain':!![]});interaction_log[_0xa9f7('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ed963[_0xa9f7('0x63')]['id'],_0x3ed963[_0xa9f7('0x63')]['name'],_0x3ed963[_0xa9f7('0x63')][_0xa9f7('0x6c')],_0x23d000[_0xa9f7('0x6a')]['id'],_0x3ed963[_0xa9f7('0x58')]?JSON[_0xa9f7('0x28')](_0x3ed963[_0xa9f7('0x58')]):_0xa9f7('0x6d'));return respondWithRpcPromise(_0xa9f7('0x7f'),'rejectMessage',_0x23d000);}return null;})[_0xa9f7('0x22')](function(_0x337ef6){var _0xfda3b8=_0xa9f7('0x6f')+_0x337ef6[_0xa9f7('0x2b')][_0xa9f7('0x70')];return db[_0xa9f7('0x80')][_0xa9f7('0x44')](_0xfda3b8,{'type':db[_0xa9f7('0x71')][_0xa9f7('0x72')][_0xa9f7('0x73')],'raw':!![]})[_0xa9f7('0x22')](function(_0x4959df){return _0x4959df;});})[_0xa9f7('0x22')](function(_0xc527cf){if(_0xc527cf){_0x23d000[_0xa9f7('0x2b')][_0xa9f7('0x81')]=_0xc527cf[0x0];if(!_0x3ed963[_0xa9f7('0x58')][_0xa9f7('0x62')])return;return db[_0xa9f7('0x74')]['find']({'where':{'id':_0x3ed963[_0xa9f7('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xa9f7('0x3b'),'fullname',_0xa9f7('0x76'),_0xa9f7('0x77')],'raw':!![]});}return null;})[_0xa9f7('0x22')](function(_0x5e01e6){if(!_0x5e01e6)return null;_0x23d000[_0xa9f7('0x2b')][_0xa9f7('0x64')]=_0x5e01e6;return _0x23d000;})[_0xa9f7('0x22')](function(_0x325915){if(_0x325915){_0x325915[_0xa9f7('0x2b')]['interface']=util[_0xa9f7('0x60')](_0xa9f7('0x82'),_0x3ed963['user'][_0xa9f7('0x3b')]);_0x325915[_0xa9f7('0x2b')][_0xa9f7('0x79')]=_0x23d000[_0xa9f7('0x79')];_0x325915['message'][_0xa9f7('0x7a')]=_0x23d000['channel'];_0x325915[_0xa9f7('0x2b')][_0xa9f7('0x83')]=_0xa9f7('0x7e');respondWithRpcPromise(_0xa9f7('0x7c'),_0xa9f7('0x7c'),{'event':_0xa9f7('0x84'),'message':_0x325915[_0xa9f7('0x2b')]},client9002);return _0x23d000;}return null;})[_0xa9f7('0x22')](respondWithResult(_0x568770,null))[_0xa9f7('0x2d')](handleError(_0x568770,null));};exports[_0xa9f7('0x85')]=function(_0x2a6aa9,_0x2f6ee7){var _0x340286;return db[_0xa9f7('0x3d')][_0xa9f7('0x85')](_0x2a6aa9['body'],{})[_0xa9f7('0x22')](function(_0xfbce4a){_0x340286=_0xfbce4a;return db[_0xa9f7('0x86')]['findOne']({'where':{'id':_0x340286[_0xa9f7('0x70')]}});})['then'](function(_0x42f365){if(_[_0xa9f7('0x87')](_0x42f365)){return;}else{_0x340286[_0xa9f7('0x5d')]=_0x42f365[_0xa9f7('0x5d')];return db[_0xa9f7('0x88')]['findOne']({'where':{'id':_0x340286['AttachmentId']}});}})[_0xa9f7('0x22')](function(_0x43c464){return respondWithRpcPromise(_0xa9f7('0x89'),'SendFax',{'FaxAccountId':_[_0xa9f7('0x87')](_0x2a6aa9[_0xa9f7('0x58')])?undefined:_0x2a6aa9[_0xa9f7('0x58')][_0xa9f7('0x8a')],'path':_[_0xa9f7('0x87')](_0x43c464)?undefined:util[_0xa9f7('0x60')]('/var/opt/motion2/server/files/attachments/%s',_0x43c464[_0xa9f7('0x8b')]),'fax':_['isNil'](_0x340286['fax'])?undefined:_0x340286[_0xa9f7('0x5d')],'AttachmentId':_0x340286[_0xa9f7('0x8c')]},client9002);})[_0xa9f7('0x22')](respondWithResult(_0x2f6ee7,0xc9))[_0xa9f7('0x2d')](handleError(_0x2f6ee7,null));};exports[_0xa9f7('0x8d')]=function(_0x4ad4c2,_0x5b2c1d){var _0x559ae1=path[_0xa9f7('0x8e')](config[_0xa9f7('0x8f')],_0xa9f7('0x90'),_0xa9f7('0x91'),_0xa9f7('0x92'));return db[_0xa9f7('0x3d')][_0xa9f7('0x59')]({'where':{'id':_0x4ad4c2[_0xa9f7('0x53')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xa9f7('0x22')](handleEntityNotFound(_0x5b2c1d,null))['then'](function(_0x523b52){if(_0x523b52){return _0x5b2c1d[_0xa9f7('0x8d')](path[_0xa9f7('0x8e')](_0x559ae1,_0x523b52[_0xa9f7('0x88')][_0xa9f7('0x8b')]));}})[_0xa9f7('0x2d')](handleError(_0x5b2c1d,null));}; \ No newline at end of file +var _0x0c29=['join','rimraf','zip-dir','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','body','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','SIP/%s','channel','event','EventManager','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','root','server','files','attachments','download'];(function(_0x150912,_0x10b1ed){var _0x2b4928=function(_0xd03d47){while(--_0xd03d47){_0x150912['push'](_0x150912['shift']());}};_0x2b4928(++_0x10b1ed);}(_0x0c29,0x1a8));var _0x90c2=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x0c29[_0x481af3];return _0x3354ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90c2('0x0'));var zipdir=require(_0x90c2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x90c2('0x2'));var Mustache=require(_0x90c2('0x3'));var util=require('util');var path=require(_0x90c2('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x90c2('0x5'));var fs=require('fs');var fs_extra=require(_0x90c2('0x6'));var _=require(_0x90c2('0x7'));var squel=require(_0x90c2('0x8'));var crypto=require(_0x90c2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x90c2('0xa'));var toCsv=require(_0x90c2('0xb'));var querystring=require(_0x90c2('0xc'));var Papa=require(_0x90c2('0xd'));var Redis=require(_0x90c2('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90c2('0xf'));var hardwareService=require(_0x90c2('0x10'));var logger=require('../../config/logger')(_0x90c2('0x11'));var utils=require(_0x90c2('0x12'));var config=require(_0x90c2('0x13'));var licenseUtil=require(_0x90c2('0x14'));var db=require(_0x90c2('0x15'))['db'];config[_0x90c2('0x16')]=_[_0x90c2('0x17')](config[_0x90c2('0x16')],{'host':_0x90c2('0x18'),'port':0x18eb});var socket=require(_0x90c2('0x19'))(new Redis(config['redis']));require(_0x90c2('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x90c2('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x90c2('0x1b')][_0x90c2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5f368c,_0x24fee5,_0x55407c,_0x4fc4ab){return new BPromise(function(_0x348dc8,_0x4c2f9e){var _0x4eafbd=_0x4fc4ab||client;return _0x4eafbd['request'](_0x5f368c,_0x55407c)[_0x90c2('0x1d')](function(_0x990767){logger[_0x90c2('0x1e')](_0x90c2('0x1f'),_0x24fee5,_0x90c2('0x20'));logger[_0x90c2('0x21')](_0x90c2('0x22'),_0x24fee5,_0x90c2('0x20'),JSON['stringify'](_0x990767));if(_0x990767['error']){if(_0x990767[_0x90c2('0x23')][_0x90c2('0x24')]===0x1f4){logger[_0x90c2('0x23')](_0x90c2('0x1f'),_0x24fee5,_0x990767[_0x90c2('0x23')][_0x90c2('0x25')]);return _0x4c2f9e(_0x990767[_0x90c2('0x23')][_0x90c2('0x25')]);}logger['error'](_0x90c2('0x1f'),_0x24fee5,_0x990767['error'][_0x90c2('0x25')]);return _0x348dc8(_0x990767['error']['message']);}else{logger['info'](_0x90c2('0x1f'),_0x24fee5,_0x90c2('0x20'));_0x348dc8(_0x990767[_0x90c2('0x26')][_0x90c2('0x25')]);}})[_0x90c2('0x27')](function(_0x9b35df){logger['error'](_0x90c2('0x1f'),_0x24fee5,_0x9b35df);_0x4c2f9e(_0x9b35df);});});}function respondWithStatusCode(_0x3df6ef,_0x5d5128){_0x5d5128=_0x5d5128||0xcc;return function(_0x1217ff){if(_0x1217ff){return _0x3df6ef[_0x90c2('0x28')](_0x5d5128);}return _0x3df6ef[_0x90c2('0x29')](_0x5d5128)[_0x90c2('0x2a')]();};}function respondWithResult(_0x5ba450,_0x22d1bf){_0x22d1bf=_0x22d1bf||0xc8;return function(_0x455a74){if(_0x455a74){return _0x5ba450['status'](_0x22d1bf)[_0x90c2('0x2b')](_0x455a74);}};}function respondWithFilteredResult(_0x43aba5,_0x1f9109){return function(_0x1b328a){if(_0x1b328a){var _0x36a567=typeof _0x1f9109[_0x90c2('0x2c')]==='undefined'&&typeof _0x1f9109[_0x90c2('0x2d')]===_0x90c2('0x2e');var _0x2048ec=_0x1b328a[_0x90c2('0x2f')];var _0x2eec16=_0x36a567?0x0:_0x1f9109[_0x90c2('0x2c')];var _0x592af5=_0x36a567?_0x1b328a[_0x90c2('0x2f')]:_0x1f9109[_0x90c2('0x2c')]+_0x1f9109['limit'];var _0x313f6c;if(_0x592af5>=_0x2048ec){_0x592af5=_0x2048ec;_0x313f6c=0xc8;}else{_0x313f6c=0xce;}_0x43aba5[_0x90c2('0x29')](_0x313f6c);return _0x43aba5[_0x90c2('0x30')](_0x90c2('0x31'),_0x2eec16+'-'+_0x592af5+'/'+_0x2048ec)['json'](_0x1b328a);}return null;};}function patchUpdates(_0x3266ca){return function(_0x5a08c8){try{jsonpatch['apply'](_0x5a08c8,_0x3266ca,!![]);}catch(_0x52560a){return BPromise[_0x90c2('0x32')](_0x52560a);}return _0x5a08c8['save']();};}function saveUpdates(_0x4c4887,_0x2edbd2){return function(_0x112f96){if(_0x112f96){return _0x112f96[_0x90c2('0x33')](_0x4c4887)[_0x90c2('0x1d')](function(_0x402a65){return _0x402a65;});}return null;};}function removeEntity(_0x2bb05e,_0x4d0b24){return function(_0x4f7da3){if(_0x4f7da3){return _0x4f7da3[_0x90c2('0x34')]()['then'](function(){_0x2bb05e[_0x90c2('0x29')](0xcc)[_0x90c2('0x2a')]();});}};}function handleEntityNotFound(_0x26f347,_0x3212ef){return function(_0x2287df){if(!_0x2287df){_0x26f347[_0x90c2('0x28')](0x194);}return _0x2287df;};}function handleError(_0x5d75e7,_0x411b60){_0x411b60=_0x411b60||0x1f4;return function(_0x4872cf){logger[_0x90c2('0x23')](_0x4872cf[_0x90c2('0x35')]);if(_0x4872cf[_0x90c2('0x36')]){delete _0x4872cf[_0x90c2('0x36')];}_0x5d75e7['status'](_0x411b60)[_0x90c2('0x37')](_0x4872cf);};}exports[_0x90c2('0x38')]=function(_0x40a0b3,_0x394555){var _0x8060fa={},_0x307547={},_0x277c98={'count':0x0,'rows':[]};var _0x25a7df=_[_0x90c2('0x39')](db[_0x90c2('0x3a')][_0x90c2('0x3b')],function(_0x50d1c7){return{'name':_0x50d1c7[_0x90c2('0x3c')],'type':_0x50d1c7[_0x90c2('0x3d')][_0x90c2('0x3e')]};});_0x307547[_0x90c2('0x3f')]=_['map'](_0x25a7df,_0x90c2('0x36'));_0x307547['query']=_[_0x90c2('0x40')](_0x40a0b3[_0x90c2('0x41')]);_0x307547['filters']=_[_0x90c2('0x42')](_0x307547[_0x90c2('0x3f')],_0x307547[_0x90c2('0x41')]);_0x8060fa[_0x90c2('0x43')]=_['intersection'](_0x307547['model'],qs[_0x90c2('0x44')](_0x40a0b3['query'][_0x90c2('0x44')]));_0x8060fa[_0x90c2('0x43')]=_0x8060fa[_0x90c2('0x43')][_0x90c2('0x45')]?_0x8060fa[_0x90c2('0x43')]:_0x307547['model'];if(!_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x46')](_0x90c2('0x47'))){_0x8060fa['limit']=qs[_0x90c2('0x2d')](_0x40a0b3[_0x90c2('0x41')]['limit']);_0x8060fa[_0x90c2('0x2c')]=qs[_0x90c2('0x2c')](_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x2c')]);}_0x8060fa[_0x90c2('0x48')]=qs['sort'](_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x49')]);_0x8060fa[_0x90c2('0x4a')]=qs['filters'](_['pick'](_0x40a0b3[_0x90c2('0x41')],_0x307547[_0x90c2('0x4b')]),_0x25a7df);if(_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x4c')]){_0x8060fa[_0x90c2('0x4a')]=_[_0x90c2('0x4d')](_0x8060fa[_0x90c2('0x4a')],{'$or':_[_0x90c2('0x39')](_0x25a7df,function(_0x1e35dd){if(_0x1e35dd[_0x90c2('0x3d')]!=='VIRTUAL'){var _0x5274d0={};_0x5274d0[_0x1e35dd['name']]={'$like':'%'+_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x4c')]+'%'};return _0x5274d0;}})});}_0x8060fa=_[_0x90c2('0x4d')]({},_0x8060fa,_0x40a0b3[_0x90c2('0x4e')]);var _0x522a81={'where':_0x8060fa[_0x90c2('0x4a')]};return db[_0x90c2('0x3a')][_0x90c2('0x2f')](_0x522a81)['then'](function(_0x4de8f5){_0x277c98[_0x90c2('0x2f')]=_0x4de8f5;if(_0x40a0b3[_0x90c2('0x41')][_0x90c2('0x4f')]){_0x8060fa[_0x90c2('0x50')]=[{'all':!![]}];}return db[_0x90c2('0x3a')][_0x90c2('0x51')](_0x8060fa);})[_0x90c2('0x1d')](function(_0x5e4b23){_0x277c98[_0x90c2('0x52')]=_0x5e4b23;return _0x277c98;})[_0x90c2('0x1d')](respondWithFilteredResult(_0x394555,_0x8060fa))[_0x90c2('0x27')](handleError(_0x394555,null));};exports[_0x90c2('0x53')]=function(_0x2435db,_0x5b7477){var _0x3c77ec={'raw':!![],'where':{'id':_0x2435db[_0x90c2('0x54')]['id']}},_0x24d7c2={};_0x24d7c2[_0x90c2('0x3f')]=_[_0x90c2('0x40')](db[_0x90c2('0x3a')][_0x90c2('0x3b')]);_0x24d7c2[_0x90c2('0x41')]=_[_0x90c2('0x40')](_0x2435db[_0x90c2('0x41')]);_0x24d7c2[_0x90c2('0x4b')]=_[_0x90c2('0x42')](_0x24d7c2['model'],_0x24d7c2[_0x90c2('0x41')]);_0x3c77ec[_0x90c2('0x43')]=_['intersection'](_0x24d7c2[_0x90c2('0x3f')],qs[_0x90c2('0x44')](_0x2435db[_0x90c2('0x41')][_0x90c2('0x44')]));_0x3c77ec[_0x90c2('0x43')]=_0x3c77ec[_0x90c2('0x43')][_0x90c2('0x45')]?_0x3c77ec[_0x90c2('0x43')]:_0x24d7c2[_0x90c2('0x3f')];if(_0x2435db[_0x90c2('0x41')][_0x90c2('0x4f')]){_0x3c77ec[_0x90c2('0x50')]=[{'all':!![]}];}_0x3c77ec=_[_0x90c2('0x4d')]({},_0x3c77ec,_0x2435db[_0x90c2('0x4e')]);return db[_0x90c2('0x3a')][_0x90c2('0x55')](_0x3c77ec)[_0x90c2('0x1d')](handleEntityNotFound(_0x5b7477,null))[_0x90c2('0x1d')](respondWithResult(_0x5b7477,null))[_0x90c2('0x27')](handleError(_0x5b7477,null));};exports[_0x90c2('0x33')]=function(_0x54ae2e,_0x1c0cd4){if(_0x54ae2e[_0x90c2('0x56')]['id']){delete _0x54ae2e[_0x90c2('0x56')]['id'];}return db[_0x90c2('0x3a')][_0x90c2('0x55')]({'where':{'id':_0x54ae2e[_0x90c2('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c0cd4,null))[_0x90c2('0x1d')](saveUpdates(_0x54ae2e[_0x90c2('0x56')],null))['then'](respondWithResult(_0x1c0cd4,null))[_0x90c2('0x27')](handleError(_0x1c0cd4,null));};exports[_0x90c2('0x34')]=function(_0x8e59ae,_0xf7488c){return db['FaxMessage']['find']({'where':{'id':_0x8e59ae[_0x90c2('0x54')]['id']}})[_0x90c2('0x1d')](handleEntityNotFound(_0xf7488c,null))[_0x90c2('0x1d')](removeEntity(_0xf7488c,null))[_0x90c2('0x27')](handleError(_0xf7488c,null));};exports[_0x90c2('0x57')]=function(_0x3653a5,_0x3d1dcf){return db['FaxMessage'][_0x90c2('0x57')]()[_0x90c2('0x1d')](respondWithResult(_0x3d1dcf,null))['catch'](handleError(_0x3d1dcf,null));};var interaction_log=require(_0x90c2('0x58'))(_0x90c2('0x59'));exports[_0x90c2('0x5a')]=function(_0x3461fd,_0x3c04d4,_0x1d12d8){var _0x3fafbe={'agent':{},'channel':_0x90c2('0x5b')};if(_0x3461fd['body']['id']){delete _0x3461fd[_0x90c2('0x56')]['id'];}_0x3461fd[_0x90c2('0x56')][_0x90c2('0x5c')]=!![];_0x3461fd[_0x90c2('0x56')]['readAt']=moment()[_0x90c2('0x5d')](_0x90c2('0x5e'));_0x3461fd['body']['UserId']=_0x3461fd[_0x90c2('0x56')][_0x90c2('0x5f')]||_0x3461fd[_0x90c2('0x60')]['id'];_0x3fafbe['agent']['id']=_0x3461fd['body']['UserId'];return db[_0x90c2('0x3a')][_0x90c2('0x55')]({'where':{'id':_0x3461fd[_0x90c2('0x54')]['id'],'UserId':null}})[_0x90c2('0x1d')](handleEntityNotFound(_0x3c04d4,null))['then'](saveUpdates(_0x3461fd[_0x90c2('0x56')],null))['then'](function(_0x1a3590){if(_0x1a3590){_0x3fafbe[_0x90c2('0x25')]=_0x1a3590[_0x90c2('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x90c2('0x55')]({'where':{'id':_0x1a3590[_0x90c2('0x62')]}});}return null;})[_0x90c2('0x1d')](handleEntityNotFound(_0x3c04d4,null))[_0x90c2('0x1d')](function(_0x3d2c40){if(_0x3d2c40){return _0x3d2c40['update']({'UserId':_0x3461fd[_0x90c2('0x56')][_0x90c2('0x5f')],'read1stAt':_[_0x90c2('0x63')](_0x3d2c40['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x90c2('0x1d')](function(_0x2b1288){if(_0x2b1288){_0x3fafbe[_0x90c2('0x64')]=_0x2b1288[_0x90c2('0x61')]({'plain':!![]});interaction_log[_0x90c2('0x1e')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3461fd['user']['id'],_0x3461fd[_0x90c2('0x60')][_0x90c2('0x36')],_0x3461fd[_0x90c2('0x60')][_0x90c2('0x65')],_0x3fafbe['interaction']['id'],_0x3461fd[_0x90c2('0x56')]?JSON[_0x90c2('0x66')](_0x3461fd[_0x90c2('0x56')]):'null');return respondWithRpcPromise(_0x90c2('0x67'),_0x90c2('0x68'),_0x3fafbe);}return null;})[_0x90c2('0x1d')](function(_0x244ad1){var _0x3870c3=_0x90c2('0x69')+_0x244ad1[_0x90c2('0x25')][_0x90c2('0x6a')];return db[_0x90c2('0x6b')]['query'](_0x3870c3,{'type':db[_0x90c2('0x6c')][_0x90c2('0x6d')][_0x90c2('0x6e')],'raw':!![]})['then'](function(_0x51c069){return _0x51c069;});})[_0x90c2('0x1d')](function(_0x47236e){if(_0x47236e){_0x3fafbe[_0x90c2('0x25')][_0x90c2('0x6f')]=_0x47236e[0x0];if(!_0x3461fd[_0x90c2('0x56')]['UserId'])return;return db[_0x90c2('0x70')]['find']({'where':{'id':_0x3461fd[_0x90c2('0x56')][_0x90c2('0x5f')],'role':_0x90c2('0x71')},'attributes':['id','name',_0x90c2('0x72'),_0x90c2('0x73'),_0x90c2('0x74')],'raw':!![]});}return null;})['then'](function(_0x38dfe4){if(!_0x38dfe4)return null;_0x3fafbe[_0x90c2('0x25')][_0x90c2('0x71')]=_0x38dfe4;return _0x3fafbe;})[_0x90c2('0x1d')](function(_0x2f2eb1){if(_0x2f2eb1){if(_0x3461fd[_0x90c2('0x56')]['manual']){_0x3fafbe[_0x90c2('0x25')]['interface']=util['format'](_0x90c2('0x75'),_0x3461fd['user'][_0x90c2('0x36')]);_0x3fafbe[_0x90c2('0x25')]['channel']=_0x3fafbe['channel'];_0x3fafbe['message']['motionChannel']=_0x3fafbe[_0x90c2('0x76')];_0x3fafbe[_0x90c2('0x25')][_0x90c2('0x77')]='accept';return respondWithRpcPromise(_0x90c2('0x78'),_0x90c2('0x78'),{'event':'acceptmessage','message':_0x3fafbe[_0x90c2('0x25')]},client9002)[_0x90c2('0x1d')](function(){return _0x3fafbe;});}return _0x3fafbe;}return null;})[_0x90c2('0x1d')](respondWithResult(_0x3c04d4,null))[_0x90c2('0x27')](handleError(_0x3c04d4,null));};var interaction_log=require(_0x90c2('0x58'))(_0x90c2('0x59'));exports[_0x90c2('0x32')]=function(_0xe79f50,_0x50673a,_0x3823db){var _0x23d62b={'agent':{},'channel':_0x90c2('0x5b')};if(_0xe79f50['body']['id']){delete _0xe79f50[_0x90c2('0x56')]['id'];}_0xe79f50['body'][_0x90c2('0x5f')]=_0xe79f50[_0x90c2('0x56')][_0x90c2('0x5f')]||_0xe79f50['user']['id'];_0x23d62b[_0x90c2('0x71')]['id']=_0xe79f50[_0x90c2('0x56')][_0x90c2('0x5f')];return db[_0x90c2('0x3a')][_0x90c2('0x55')]({'where':{'id':_0xe79f50[_0x90c2('0x54')]['id'],'UserId':null}})[_0x90c2('0x1d')](handleEntityNotFound(_0x50673a,null))[_0x90c2('0x1d')](function(_0x4b1bee){if(_0x4b1bee){_0x23d62b['message']=_0x4b1bee[_0x90c2('0x61')]({'plain':!![]});return db[_0x90c2('0x79')][_0x90c2('0x55')]({'where':{'id':_0x4b1bee['FaxInteractionId']}});}return null;})[_0x90c2('0x1d')](handleEntityNotFound(_0x50673a,null))['then'](function(_0x4d598c){if(_0x4d598c){_0x23d62b[_0x90c2('0x64')]=_0x4d598c[_0x90c2('0x61')]({'plain':!![]});interaction_log['info'](_0x90c2('0x7a'),_0xe79f50[_0x90c2('0x60')]['id'],_0xe79f50[_0x90c2('0x60')][_0x90c2('0x36')],_0xe79f50[_0x90c2('0x60')]['role'],_0x23d62b[_0x90c2('0x64')]['id'],_0xe79f50['body']?JSON['stringify'](_0xe79f50[_0x90c2('0x56')]):_0x90c2('0x7b'));return respondWithRpcPromise(_0x90c2('0x7c'),'rejectMessage',_0x23d62b);}return null;})[_0x90c2('0x1d')](function(_0x4f2bed){var _0x1a0c5b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4f2bed[_0x90c2('0x25')]['ContactId'];return db[_0x90c2('0x6b')][_0x90c2('0x41')](_0x1a0c5b,{'type':db[_0x90c2('0x6c')][_0x90c2('0x6d')][_0x90c2('0x6e')],'raw':!![]})[_0x90c2('0x1d')](function(_0x495dd8){return _0x495dd8;});})[_0x90c2('0x1d')](function(_0x512a0d){if(_0x512a0d){_0x23d62b[_0x90c2('0x25')][_0x90c2('0x6f')]=_0x512a0d[0x0];if(!_0xe79f50['body'][_0x90c2('0x5f')])return;return db[_0x90c2('0x70')]['find']({'where':{'id':_0xe79f50[_0x90c2('0x56')]['UserId'],'role':_0x90c2('0x71')},'attributes':['id',_0x90c2('0x36'),_0x90c2('0x72'),_0x90c2('0x73'),_0x90c2('0x74')],'raw':!![]});}return null;})['then'](function(_0x3ae6ca){if(!_0x3ae6ca)return null;_0x23d62b[_0x90c2('0x25')][_0x90c2('0x71')]=_0x3ae6ca;return _0x23d62b;})[_0x90c2('0x1d')](function(_0x39c71f){if(_0x39c71f){_0x39c71f[_0x90c2('0x25')]['interface']=util['format'](_0x90c2('0x75'),_0xe79f50[_0x90c2('0x60')][_0x90c2('0x36')]);_0x39c71f['message'][_0x90c2('0x76')]=_0x23d62b[_0x90c2('0x76')];_0x39c71f[_0x90c2('0x25')][_0x90c2('0x7d')]=_0x23d62b['channel'];_0x39c71f[_0x90c2('0x25')][_0x90c2('0x77')]=_0x90c2('0x32');respondWithRpcPromise(_0x90c2('0x78'),_0x90c2('0x78'),{'event':_0x90c2('0x7e'),'message':_0x39c71f[_0x90c2('0x25')]},client9002);return _0x23d62b;}return null;})[_0x90c2('0x1d')](respondWithResult(_0x50673a,null))[_0x90c2('0x27')](handleError(_0x50673a,null));};exports[_0x90c2('0x7f')]=function(_0x2da9d7,_0x29225a){var _0x17fab6;return db[_0x90c2('0x3a')][_0x90c2('0x7f')](_0x2da9d7['body'],{})[_0x90c2('0x1d')](function(_0x21835f){_0x17fab6=_0x21835f;return db[_0x90c2('0x80')][_0x90c2('0x81')]({'where':{'id':_0x17fab6[_0x90c2('0x6a')]}});})['then'](function(_0x3c403c){if(_[_0x90c2('0x63')](_0x3c403c)){return;}else{_0x17fab6[_0x90c2('0x5b')]=_0x3c403c[_0x90c2('0x5b')];return db[_0x90c2('0x82')]['findOne']({'where':{'id':_0x17fab6[_0x90c2('0x83')]}});}})[_0x90c2('0x1d')](function(_0x1d4c52){return respondWithRpcPromise('SendFax',_0x90c2('0x84'),{'FaxAccountId':_[_0x90c2('0x63')](_0x2da9d7[_0x90c2('0x56')])?undefined:_0x2da9d7[_0x90c2('0x56')]['FaxAccountId'],'path':_[_0x90c2('0x63')](_0x1d4c52)?undefined:util[_0x90c2('0x5d')](_0x90c2('0x85'),_0x1d4c52[_0x90c2('0x86')]),'fax':_[_0x90c2('0x63')](_0x17fab6[_0x90c2('0x5b')])?undefined:_0x17fab6[_0x90c2('0x5b')],'AttachmentId':_0x17fab6[_0x90c2('0x83')]},client9002);})[_0x90c2('0x1d')](respondWithResult(_0x29225a,0xc9))['catch'](handleError(_0x29225a,null));};exports['download']=function(_0x2def40,_0x311836){var _0x54964a=path['join'](config[_0x90c2('0x87')],_0x90c2('0x88'),_0x90c2('0x89'),_0x90c2('0x8a'));return db['FaxMessage']['find']({'where':{'id':_0x2def40[_0x90c2('0x54')]['id']},'include':[{'model':db[_0x90c2('0x82')],'as':'Attachment'}]})[_0x90c2('0x1d')](handleEntityNotFound(_0x311836,null))[_0x90c2('0x1d')](function(_0x569895){if(_0x569895){return _0x311836[_0x90c2('0x8b')](path[_0x90c2('0x8c')](_0x54964a,_0x569895[_0x90c2('0x82')][_0x90c2('0x86')]));}})[_0x90c2('0x27')](handleError(_0x311836,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ba26ddf..150adfc 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0a=['exports','events','../../mysqldb','FaxMessage','save','update','emit','hasOwnProperty','hook'];(function(_0x1277ea,_0x94beab){var _0x585923=function(_0x46aa8c){while(--_0x46aa8c){_0x1277ea['push'](_0x1277ea['shift']());}};_0x585923(++_0x94beab);}(_0x8d0a,0x172));var _0xa8d0=function(_0x4d99d8,_0x3a1a59){_0x4d99d8=_0x4d99d8-0x0;var _0x3726ab=_0x8d0a[_0x4d99d8];return _0x3726ab;};'use strict';var EventEmitter=require(_0xa8d0('0x0'));var FaxMessage=require(_0xa8d0('0x1'))['db'][_0xa8d0('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8d0('0x3'),'afterUpdate':_0xa8d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c8cc4){return function(_0x3812b4,_0x33c4b1,_0x55bc97){FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4+':'+_0x3812b4['id'],_0x3812b4);FaxMessageEvents[_0xa8d0('0x5')](_0x3c8cc4,_0x3812b4);_0x55bc97(null);};}for(var e in events){if(events[_0xa8d0('0x6')](e)){var event=events[e];FaxMessage[_0xa8d0('0x7')](e,emitEvent(event));}}module[_0xa8d0('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xad5f=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xa69592,_0x571583){var _0x4c5ec5=function(_0x4c7050){while(--_0x4c7050){_0xa69592['push'](_0xa69592['shift']());}};_0x4c5ec5(++_0x571583);}(_0xad5f,0x1a8));var _0xfad5=function(_0x5ea82f,_0x41ef96){_0x5ea82f=_0x5ea82f-0x0;var _0x2f38b6=_0xad5f[_0x5ea82f];return _0x2f38b6;};'use strict';var EventEmitter=require(_0xfad5('0x0'));var FaxMessage=require(_0xfad5('0x1'))['db'][_0xfad5('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xfad5('0x3')](0x0);var events={'afterCreate':_0xfad5('0x4'),'afterUpdate':_0xfad5('0x5'),'afterDestroy':'remove'};function emitEvent(_0xcc61b1){return function(_0x316561,_0x1ae06d,_0x2da73e){FaxMessageEvents[_0xfad5('0x6')](_0xcc61b1+':'+_0x316561['id'],_0x316561);FaxMessageEvents[_0xfad5('0x6')](_0xcc61b1,_0x316561);_0x2da73e(null);};}for(var e in events){if(events[_0xfad5('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xfad5('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 08e93e1..8064623 100644 --- a/server/api/faxMessage/faxMessage.model.js +++ b/server/api/faxMessage/faxMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe19=['then','update','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','FaxInteractionId'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xfe19,0x13a));var _0x9fe1=function(_0x6e3090,_0x53aa85){_0x6e3090=_0x6e3090-0x0;var _0x30a5cb=_0xfe19[_0x6e3090];return _0x30a5cb;};'use strict';var _=require(_0x9fe1('0x0'));var util=require(_0x9fe1('0x1'));var logger=require(_0x9fe1('0x2'))(_0x9fe1('0x3'));var moment=require(_0x9fe1('0x4'));var BPromise=require(_0x9fe1('0x5'));var rp=require(_0x9fe1('0x6'));var fs=require('fs');var path=require(_0x9fe1('0x7'));var rimraf=require(_0x9fe1('0x8'));var config=require('../../config/environment');var attributes=require(_0x9fe1('0x9'));module[_0x9fe1('0xa')]=function(_0x3b0074,_0x52a9ae){return _0x3b0074[_0x9fe1('0xb')](_0x9fe1('0xc'),attributes,{'tableName':_0x9fe1('0xd'),'paranoid':![],'indexes':[{'name':_0x9fe1('0xe'),'fields':[_0x9fe1('0xf')],'type':_0x9fe1('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24cb08,_0x44e850,_0xe693dc){var _0x48ed4c=_0x3b0074[_0x9fe1('0x11')];var _0x1d8532=_0x24cb08[_0x9fe1('0x12')]({'plain':!![]});if(_0x1d8532['direction'][_0x9fe1('0x13')]()==='in'||_0x1d8532[_0x9fe1('0x14')][_0x9fe1('0x13')]()===_0x9fe1('0x15')&&!_0x1d8532[_0x9fe1('0x16')]&&!_[_0x9fe1('0x17')](_0x1d8532[_0x9fe1('0x18')])){_0x48ed4c['FaxInteraction'][_0x9fe1('0x19')]({'where':{'id':_0x1d8532[_0x9fe1('0x1a')]}})[_0x9fe1('0x1b')](function(_0x6ae465){if(_0x6ae465){_0x6ae465[_0x9fe1('0x1c')]({'lastMsgAt':_0x1d8532['createdAt'],'lastMsgDirection':_0x1d8532[_0x9fe1('0x14')][_0x9fe1('0x13')]()});}})[_0x9fe1('0x1d')](function(_0x109bfa){console[_0x9fe1('0x1e')](_0x109bfa);});}_0xe693dc();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbad8=['FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','error','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x20640d,_0x31ffa6){var _0x593e91=function(_0x56f14e){while(--_0x56f14e){_0x20640d['push'](_0x20640d['shift']());}};_0x593e91(++_0x31ffa6);}(_0xbad8,0xea));var _0x8bad=function(_0x437472,_0x31db2d){_0x437472=_0x437472-0x0;var _0x217fce=_0xbad8[_0x437472];return _0x217fce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bad('0x0'))('api');var moment=require(_0x8bad('0x1'));var BPromise=require(_0x8bad('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bad('0x3'));var rimraf=require(_0x8bad('0x4'));var config=require(_0x8bad('0x5'));var attributes=require(_0x8bad('0x6'));module[_0x8bad('0x7')]=function(_0x5e7dc2,_0x2b28c0){return _0x5e7dc2[_0x8bad('0x8')](_0x8bad('0x9'),attributes,{'tableName':_0x8bad('0xa'),'paranoid':![],'indexes':[{'name':_0x8bad('0xb'),'fields':['body'],'type':_0x8bad('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x444b86,_0x41a3a5,_0x20ef90){var _0xc8a552=_0x5e7dc2['models'];var _0x345f09=_0x444b86[_0x8bad('0xd')]({'plain':!![]});if(_0x345f09[_0x8bad('0xe')]['toLowerCase']()==='in'||_0x345f09[_0x8bad('0xe')][_0x8bad('0xf')]()===_0x8bad('0x10')&&!_0x345f09[_0x8bad('0x11')]&&!_[_0x8bad('0x12')](_0x345f09[_0x8bad('0x13')])){_0xc8a552[_0x8bad('0x14')][_0x8bad('0x15')]({'where':{'id':_0x345f09[_0x8bad('0x16')]}})['then'](function(_0x16ebfc){if(_0x16ebfc){_0x16ebfc[_0x8bad('0x17')]({'lastMsgAt':_0x345f09[_0x8bad('0x18')],'lastMsgDirection':_0x345f09[_0x8bad('0xe')][_0x8bad('0xf')]()});}})['catch'](function(_0x1b1c00){console[_0x8bad('0x19')](_0x1b1c00);});}_0x20ef90();}},'charset':'utf8mb4','collate':_0x8bad('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 8530eea..4122331 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x207c=['result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message'];(function(_0x33afba,_0x5830dc){var _0x182f57=function(_0x42e942){while(--_0x42e942){_0x33afba['push'](_0x33afba['shift']());}};_0x182f57(++_0x5830dc);}(_0x207c,0x1e8));var _0xc207=function(_0x3f32ca,_0x2212f2){_0x3f32ca=_0x3f32ca-0x0;var _0xf444d=_0x207c[_0x3f32ca];return _0xf444d;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});config[_0xc207('0x9')]=_[_0xc207('0xa')](config['redis'],{'host':_0xc207('0xb'),'port':0x18eb});var socket=require(_0xc207('0xc'))(new Redis(config[_0xc207('0x9')]));require('./faxMessage.socket')[_0xc207('0xd')](socket);function respondWithRpcPromise(_0x817576,_0x216e14,_0x13ec41){return new BPromise(function(_0x201162,_0x347549){return client['request'](_0x817576,_0x13ec41)['then'](function(_0x5b556f){logger[_0xc207('0xe')]('FaxMessage,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'));logger[_0xc207('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x216e14,_0xc207('0xf'),JSON[_0xc207('0x11')](_0x5b556f));if(_0x5b556f[_0xc207('0x12')]){if(_0x5b556f[_0xc207('0x12')][_0xc207('0x13')]===0x1f4){logger['error'](_0xc207('0x14'),_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x347549(_0x5b556f[_0xc207('0x12')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x216e14,_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);return _0x201162(_0x5b556f[_0xc207('0x12')][_0xc207('0x15')]);}else{logger['info'](_0xc207('0x14'),_0x216e14,_0xc207('0xf'));_0x201162(_0x5b556f[_0xc207('0x16')]['message']);}})[_0xc207('0x17')](function(_0x488cc0){logger[_0xc207('0x12')](_0xc207('0x14'),_0x216e14,_0x488cc0);_0x347549(_0x488cc0);});});}exports[_0xc207('0x18')]=function(_0x461f6a){var _0xce0770=this;return new Promise(function(_0x2caec5,_0x35c0b0){return db[_0xc207('0x19')][_0xc207('0x1a')](_0x461f6a[_0xc207('0x1b')],{'raw':_0x461f6a[_0xc207('0x1c')]?_0x461f6a[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x163b36){logger['info'](_0xc207('0x18'),_0x461f6a);logger[_0xc207('0x10')](_0xc207('0x18'),_0x461f6a,JSON[_0xc207('0x11')](_0x163b36));_0x2caec5(_0x163b36);})[_0xc207('0x17')](function(_0xd209ac){logger[_0xc207('0x12')](_0xc207('0x18'),_0xd209ac[_0xc207('0x15')],_0x461f6a);_0x35c0b0(_0xce0770[_0xc207('0x12')](0x1f4,_0xd209ac[_0xc207('0x15')]));});});};exports[_0xc207('0x1e')]=function(_0x3f738e){var _0x138970=this;return new Promise(function(_0x1445d3,_0x56a066){return db[_0xc207('0x19')]['update'](_0x3f738e['body'],{'raw':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')]['where']||null:null,'attributes':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x1f')]||null:null,'limit':_0x3f738e[_0xc207('0x1c')]?_0x3f738e[_0xc207('0x1c')][_0xc207('0x20')]||null:null})[_0xc207('0x21')](function(_0x27bc72){logger[_0xc207('0xe')](_0xc207('0x1e'),_0x3f738e);logger[_0xc207('0x10')](_0xc207('0x1e'),_0x3f738e,JSON[_0xc207('0x11')](_0x27bc72));_0x1445d3(_0x27bc72);})['catch'](function(_0x1cc799){logger[_0xc207('0x12')](_0xc207('0x1e'),_0x1cc799[_0xc207('0x15')],_0x3f738e);_0x56a066(_0x138970[_0xc207('0x12')](0x1f4,_0x1cc799[_0xc207('0x15')]));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','code','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55ca,0x126));var _0xa55c=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x55ca[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});config[_0xa55c('0xa')]=_['defaults'](config[_0xa55c('0xa')],{'host':_0xa55c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0xa')]));require(_0xa55c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5849ad,_0x473d0e,_0x20c76a){return new BPromise(function(_0x381d07,_0x5d8e5a){return client[_0xa55c('0xd')](_0x5849ad,_0x20c76a)[_0xa55c('0xe')](function(_0x508342){logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x473d0e,_0xa55c('0x11'),JSON['stringify'](_0x508342));if(_0x508342['error']){if(_0x508342['error'][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x5d8e5a(_0x508342[_0xa55c('0x13')]['message']);}logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x381d07(_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);}else{logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));_0x381d07(_0x508342['result'][_0xa55c('0x14')]);}})[_0xa55c('0x15')](function(_0x461284){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x461284);_0x5d8e5a(_0x461284);});});}exports[_0xa55c('0x16')]=function(_0x4c0daf){var _0x5f5158=this;return new Promise(function(_0xd643cc,_0x3776ac){return db[_0xa55c('0x17')]['create'](_0x4c0daf[_0xa55c('0x18')],{'raw':_0x4c0daf[_0xa55c('0x19')]?_0x4c0daf['options'][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})[_0xa55c('0xe')](function(_0x940f28){logger[_0xa55c('0xf')](_0xa55c('0x16'),_0x4c0daf);logger['debug'](_0xa55c('0x16'),_0x4c0daf,JSON['stringify'](_0x940f28));_0xd643cc(_0x940f28);})['catch'](function(_0x59d89a){logger[_0xa55c('0x13')]('CreateFaxMessage',_0x59d89a[_0xa55c('0x14')],_0x4c0daf);_0x3776ac(_0x5f5158[_0xa55c('0x13')](0x1f4,_0x59d89a[_0xa55c('0x14')]));});});};exports[_0xa55c('0x1b')]=function(_0x2313a9){var _0x170ba4=this;return new Promise(function(_0x1da633,_0x11e7f7){return db[_0xa55c('0x17')][_0xa55c('0x1c')](_0x2313a9[_0xa55c('0x18')],{'raw':_0x2313a9['options']?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')]['where']||null:null,'attributes':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1d')]||null:null,'limit':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1e')]||null:null})['then'](function(_0x23e698){logger['info'](_0xa55c('0x1b'),_0x2313a9);logger[_0xa55c('0x1f')](_0xa55c('0x1b'),_0x2313a9,JSON[_0xa55c('0x20')](_0x23e698));_0x1da633(_0x23e698);})['catch'](function(_0x3d28fb){logger[_0xa55c('0x13')](_0xa55c('0x1b'),_0x3d28fb[_0xa55c('0x14')],_0x2313a9);_0x11e7f7(_0x170ba4[_0xa55c('0x13')](0x1f4,_0x3d28fb[_0xa55c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index fe3b5b7..d1f6dc0 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb978=['register','faxMessage:','save','update','emit','removeListener'];(function(_0x5f1669,_0x171790){var _0x1fccbe=function(_0x15d175){while(--_0x15d175){_0x5f1669['push'](_0x5f1669['shift']());}};_0x1fccbe(++_0x171790);}(_0xb978,0x1a6));var _0x8b97=function(_0x45a0a3,_0x2b4752){_0x45a0a3=_0x45a0a3-0x0;var _0x154618=_0xb978[_0x45a0a3];return _0x154618;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8b97('0x0'),'remove',_0x8b97('0x1')];function createListener(_0x53e203,_0x75ca6a){return function(_0x2c8008){_0x75ca6a[_0x8b97('0x2')](_0x53e203,_0x2c8008);};}function removeListener(_0x55d21e,_0x4f9f48){return function(){FaxMessageEvents[_0x8b97('0x3')](_0x55d21e,_0x4f9f48);};}exports[_0x8b97('0x4')]=function(_0xb378e0){for(var _0x9b1bd3=0x0,_0x2c596d=events['length'];_0x9b1bd3<_0x2c596d;_0x9b1bd3++){var _0x4d3b6e=events[_0x9b1bd3];var _0xc274bf=createListener(_0x8b97('0x5')+_0x4d3b6e,_0xb378e0);FaxMessageEvents['on'](_0x4d3b6e,_0xc274bf);}}; \ No newline at end of file +var _0x5ee8=['save','emit','removeListener','faxMessage:','./faxMessage.events'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5ee8,0x68));var _0x85ee=function(_0x3cc9e5,_0x4def7b){_0x3cc9e5=_0x3cc9e5-0x0;var _0x4517a8=_0x5ee8[_0x3cc9e5];return _0x4517a8;};'use strict';var FaxMessageEvents=require(_0x85ee('0x0'));var events=[_0x85ee('0x1'),'remove','update'];function createListener(_0x2653b6,_0x2a2f5e){return function(_0x3dcd7d){_0x2a2f5e[_0x85ee('0x2')](_0x2653b6,_0x3dcd7d);};}function removeListener(_0x1753cf,_0x236e04){return function(){FaxMessageEvents[_0x85ee('0x3')](_0x1753cf,_0x236e04);};}exports['register']=function(_0x47a508){for(var _0x384450=0x0,_0x4b3107=events['length'];_0x384450<_0x4b3107;_0x384450++){var _0x3fa1a4=events[_0x384450];var _0x408c38=createListener(_0x85ee('0x4')+_0x3fa1a4,_0x47a508);FaxMessageEvents['on'](_0x3fa1a4,_0x408c38);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 42a8cc5..0111793 100644 --- a/server/api/faxMessage/index.js +++ b/server/api/faxMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x222f,0x1a4));var _0xf222=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x222f[_0x1c8cc6];return _0x522936;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router; \ No newline at end of file +var _0x6b20=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','post','fax','faxmessage:create','create','put','update','/:id/accept'];(function(_0x512962,_0x48e35c){var _0xaa9c69=function(_0x138024){while(--_0x138024){_0x512962['push'](_0x512962['shift']());}};_0xaa9c69(++_0x48e35c);}(_0x6b20,0xd1));var _0x06b2=function(_0x52910d,_0x15bf09){_0x52910d=_0x52910d-0x0;var _0x52d48d=_0x6b20[_0x52910d];return _0x52d48d;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var fs_extra=require(_0x06b2('0x4'));var auth=require(_0x06b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x06b2('0x6'));var controller=require(_0x06b2('0x7'));router[_0x06b2('0x8')]('/',auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0x8')](_0x06b2('0xb'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0x8')](_0x06b2('0xd'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);router['get'](_0x06b2('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x06b2('0x10')]('/',auth[_0x06b2('0x9')](),interaction['tracked'](_0x06b2('0x11'),_0x06b2('0x12')),controller[_0x06b2('0x13')]);router[_0x06b2('0x14')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x15')]);router[_0x06b2('0x14')](_0x06b2('0x16'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x17')]);router[_0x06b2('0x14')](_0x06b2('0x18'),auth['isAuthenticated'](),controller[_0x06b2('0x19')]);router[_0x06b2('0x1a')](_0x06b2('0xd'),auth[_0x06b2('0x9')](),controller[_0x06b2('0x1b')]);module[_0x06b2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 8d2cc07..e1b704b 100644 --- a/server/api/faxQueue/faxQueue.attributes.js +++ b/server/api/faxQueue/faxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd48=['sequelize','exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0x3c2a57,_0x2e9229){var _0x44e1d6=function(_0x32a143){while(--_0x32a143){_0x3c2a57['push'](_0x3c2a57['shift']());}};_0x44e1d6(++_0x2e9229);}(_0xfd48,0xe7));var _0x8fd4=function(_0x3c5fc7,_0x2b35c3){_0x3c5fc7=_0x3c5fc7-0x0;var _0x557c44=_0xfd48[_0x3c5fc7];return _0x557c44;};'use strict';var Sequelize=require(_0x8fd4('0x0'));module[_0x8fd4('0x1')]={'name':{'type':Sequelize[_0x8fd4('0x2')],'unique':_0x8fd4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8fd4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8fd4('0x4')](_0x8fd4('0x5'),'beepall',_0x8fd4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf4bb=['sequelize','exports','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x6477e4,_0x26b917){var _0x1c85ee=function(_0x9282b8){while(--_0x9282b8){_0x6477e4['push'](_0x6477e4['shift']());}};_0x1c85ee(++_0x26b917);}(_0xf4bb,0x118));var _0xbf4b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xf4bb[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0xbf4b('0x0'));module[_0xbf4b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbf4b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbf4b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xbf4b('0x4'),_0xbf4b('0x5'),_0xbf4b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 236c15d..b96390b 100644 --- a/server/api/faxQueue/faxQueue.controller.js +++ b/server/api/faxQueue/faxQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a9e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','localhost','redis','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','save','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','createdAt','rows','format','SIP','faxPause','updatedAt','getTeams','Team','ids','User','Agents','online','flatMap','sequelize','addTeams','each','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','userFaxQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1dbde9,_0x503ab3){var _0x4492a3=function(_0x1b2890){while(--_0x1b2890){_0x1dbde9['push'](_0x1dbde9['shift']());}};_0x4492a3(++_0x503ab3);}(_0x6a9e,0x18f));var _0xe6a9=function(_0x4430d2,_0x23bc33){_0x4430d2=_0x4430d2-0x0;var _0x60d400=_0x6a9e[_0x4430d2];return _0x60d400;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6a9('0x0'));var zipdir=require(_0xe6a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6a9('0x2'));var moment=require(_0xe6a9('0x3'));var BPromise=require(_0xe6a9('0x4'));var Mustache=require('mustache');var util=require(_0xe6a9('0x5'));var path=require(_0xe6a9('0x6'));var sox=require(_0xe6a9('0x7'));var csv=require(_0xe6a9('0x8'));var ejs=require(_0xe6a9('0x9'));var fs=require('fs');var fs_extra=require(_0xe6a9('0xa'));var _=require(_0xe6a9('0xb'));var squel=require(_0xe6a9('0xc'));var crypto=require(_0xe6a9('0xd'));var jsforce=require(_0xe6a9('0xe'));var deskjs=require(_0xe6a9('0xf'));var toCsv=require(_0xe6a9('0x8'));var querystring=require(_0xe6a9('0x10'));var Papa=require(_0xe6a9('0x11'));var Redis=require('ioredis');var authService=require(_0xe6a9('0x12'));var qs=require(_0xe6a9('0x13'));var as=require(_0xe6a9('0x14'));var hardwareService=require(_0xe6a9('0x15'));var logger=require('../../config/logger')(_0xe6a9('0x16'));var utils=require(_0xe6a9('0x17'));var config=require(_0xe6a9('0x18'));var licenseUtil=require(_0xe6a9('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xe6a9('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6a9('0x1b')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x568dc8,_0x25a401){_0x25a401=_0x25a401||0xcc;return function(_0x49293f){if(_0x49293f){return _0x568dc8[_0xe6a9('0x1c')](_0x25a401);}return _0x568dc8[_0xe6a9('0x1d')](_0x25a401)[_0xe6a9('0x1e')]();};}function respondWithResult(_0x5c2c27,_0x38b8b8){_0x38b8b8=_0x38b8b8||0xc8;return function(_0x124998){if(_0x124998){return _0x5c2c27[_0xe6a9('0x1d')](_0x38b8b8)['json'](_0x124998);}};}function respondWithFilteredResult(_0x1c1e9a,_0x58c589){return function(_0x2d7ca5){if(_0x2d7ca5){var _0x70edb2=typeof _0x58c589[_0xe6a9('0x1f')]==='undefined'&&typeof _0x58c589[_0xe6a9('0x20')]==='undefined';var _0x29ad32=_0x2d7ca5[_0xe6a9('0x21')];var _0x46e595=_0x70edb2?0x0:_0x58c589[_0xe6a9('0x1f')];var _0x51f4ee=_0x70edb2?_0x2d7ca5[_0xe6a9('0x21')]:_0x58c589[_0xe6a9('0x1f')]+_0x58c589['limit'];var _0x3bf0dc;if(_0x51f4ee>=_0x29ad32){_0x51f4ee=_0x29ad32;_0x3bf0dc=0xc8;}else{_0x3bf0dc=0xce;}_0x1c1e9a[_0xe6a9('0x1d')](_0x3bf0dc);return _0x1c1e9a[_0xe6a9('0x22')](_0xe6a9('0x23'),_0x46e595+'-'+_0x51f4ee+'/'+_0x29ad32)['json'](_0x2d7ca5);}return null;};}function patchUpdates(_0x2fcf49){return function(_0x15d503){try{jsonpatch[_0xe6a9('0x24')](_0x15d503,_0x2fcf49,!![]);}catch(_0x2f9443){return BPromise[_0xe6a9('0x25')](_0x2f9443);}return _0x15d503[_0xe6a9('0x26')]();};}function saveUpdates(_0x5a9b65,_0x589521){return function(_0x66a56b){if(_0x66a56b){return _0x66a56b['update'](_0x5a9b65)[_0xe6a9('0x27')](function(_0x465057){return _0x465057;});}return null;};}function removeEntity(_0x531384,_0xf3a39e){return function(_0x1399c5){if(_0x1399c5){return _0x1399c5['destroy']()[_0xe6a9('0x27')](function(){var _0x1b5864=_0x1399c5['get']({'plain':!![]});var _0x9d04ca=_0xe6a9('0x28');return db[_0xe6a9('0x29')][_0xe6a9('0x2a')]({'where':{'type':_0x9d04ca,'resourceId':_0x1b5864['id']}})[_0xe6a9('0x27')](function(){return _0x1399c5;});})[_0xe6a9('0x27')](function(){_0x531384['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23121d,_0x48bfa9){return function(_0x48f0eb){if(!_0x48f0eb){_0x23121d['sendStatus'](0x194);}return _0x48f0eb;};}function handleError(_0x53efdf,_0x2d2e46){_0x2d2e46=_0x2d2e46||0x1f4;return function(_0x137906){logger[_0xe6a9('0x2b')](_0x137906[_0xe6a9('0x2c')]);if(_0x137906[_0xe6a9('0x2d')]){delete _0x137906['name'];}_0x53efdf[_0xe6a9('0x1d')](_0x2d2e46)[_0xe6a9('0x2e')](_0x137906);};}exports[_0xe6a9('0x2f')]=function(_0x306ba4,_0x2ffab8){var _0x2ced8b={},_0x265575={},_0x47d9da={'count':0x0,'rows':[]};var _0x154136=_[_0xe6a9('0x30')](db[_0xe6a9('0x31')][_0xe6a9('0x32')],function(_0x20e2f4){return{'name':_0x20e2f4[_0xe6a9('0x33')],'type':_0x20e2f4[_0xe6a9('0x34')]['key']};});_0x265575[_0xe6a9('0x35')]=_[_0xe6a9('0x30')](_0x154136,_0xe6a9('0x2d'));_0x265575[_0xe6a9('0x36')]=_[_0xe6a9('0x37')](_0x306ba4['query']);_0x265575[_0xe6a9('0x38')]=_[_0xe6a9('0x39')](_0x265575[_0xe6a9('0x35')],_0x265575['query']);_0x2ced8b[_0xe6a9('0x3a')]=_['intersection'](_0x265575['model'],qs[_0xe6a9('0x3b')](_0x306ba4['query'][_0xe6a9('0x3b')]));_0x2ced8b[_0xe6a9('0x3a')]=_0x2ced8b['attributes'][_0xe6a9('0x3c')]?_0x2ced8b[_0xe6a9('0x3a')]:_0x265575[_0xe6a9('0x35')];if(!_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x3d')](_0xe6a9('0x3e'))){_0x2ced8b[_0xe6a9('0x20')]=qs['limit'](_0x306ba4[_0xe6a9('0x36')]['limit']);_0x2ced8b['offset']=qs[_0xe6a9('0x1f')](_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}_0x2ced8b[_0xe6a9('0x3f')]=qs['sort'](_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x40')]);_0x2ced8b[_0xe6a9('0x41')]=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0x306ba4[_0xe6a9('0x36')],_0x265575[_0xe6a9('0x38')]),_0x154136);if(_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x43')]){_0x2ced8b[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0x2ced8b['where'],{'$or':_['map'](_0x154136,function(_0x29102d){if(_0x29102d['type']!=='VIRTUAL'){var _0x1e627c={};_0x1e627c[_0x29102d[_0xe6a9('0x2d')]]={'$like':'%'+_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x1e627c;}})});}_0x2ced8b=_[_0xe6a9('0x44')]({},_0x2ced8b,_0x306ba4[_0xe6a9('0x45')]);var _0x5d7fad={'where':_0x2ced8b['where']};return db[_0xe6a9('0x31')][_0xe6a9('0x21')](_0x5d7fad)[_0xe6a9('0x27')](function(_0x1fc793){_0x47d9da['count']=_0x1fc793;if(_0x306ba4[_0xe6a9('0x36')][_0xe6a9('0x46')]){_0x2ced8b[_0xe6a9('0x47')]=[{'all':!![]}];}return db[_0xe6a9('0x31')][_0xe6a9('0x48')](_0x2ced8b);})[_0xe6a9('0x27')](function(_0x580ef4){_0x47d9da['rows']=_0x580ef4;return _0x47d9da;})[_0xe6a9('0x27')](respondWithFilteredResult(_0x2ffab8,_0x2ced8b))['catch'](handleError(_0x2ffab8,null));};exports[_0xe6a9('0x49')]=function(_0x5c197a,_0xd7d02a){var _0x2106b8={'raw':!![],'where':{'id':_0x5c197a[_0xe6a9('0x4a')]['id']}},_0x2af141={};_0x2af141['model']=_[_0xe6a9('0x37')](db['FaxQueue'][_0xe6a9('0x32')]);_0x2af141['query']=_[_0xe6a9('0x37')](_0x5c197a['query']);_0x2af141[_0xe6a9('0x38')]=_[_0xe6a9('0x39')](_0x2af141[_0xe6a9('0x35')],_0x2af141[_0xe6a9('0x36')]);_0x2106b8[_0xe6a9('0x3a')]=_[_0xe6a9('0x39')](_0x2af141['model'],qs['fields'](_0x5c197a[_0xe6a9('0x36')][_0xe6a9('0x3b')]));_0x2106b8[_0xe6a9('0x3a')]=_0x2106b8[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0x2106b8[_0xe6a9('0x3a')]:_0x2af141[_0xe6a9('0x35')];if(_0x5c197a['query'][_0xe6a9('0x46')]){_0x2106b8[_0xe6a9('0x47')]=[{'all':!![]}];}_0x2106b8=_[_0xe6a9('0x44')]({},_0x2106b8,_0x5c197a[_0xe6a9('0x45')]);return db[_0xe6a9('0x31')]['find'](_0x2106b8)['then'](handleEntityNotFound(_0xd7d02a,null))[_0xe6a9('0x27')](respondWithResult(_0xd7d02a,null))[_0xe6a9('0x4b')](handleError(_0xd7d02a,null));};exports['create']=function(_0x40972b,_0x4a8fd2){return db[_0xe6a9('0x31')][_0xe6a9('0x4c')](_0x40972b[_0xe6a9('0x4d')],{})[_0xe6a9('0x27')](function(_0x185250){var _0xdd5bf6=_0x40972b[_0xe6a9('0x4e')][_0xe6a9('0x4f')]({'plain':!![]});if(!_0xdd5bf6)throw new Error(_0xe6a9('0x50'));if(_0xdd5bf6[_0xe6a9('0x51')]==='user'){var _0x442e0d=_0x185250[_0xe6a9('0x4f')]({'plain':!![]});var _0x266c77='FaxQueues';return db[_0xe6a9('0x52')][_0xe6a9('0x53')]({'where':{'name':_0x266c77,'userProfileId':_0xdd5bf6[_0xe6a9('0x54')]},'raw':!![]})[_0xe6a9('0x27')](function(_0xa5e74){if(_0xa5e74&&_0xa5e74[_0xe6a9('0x55')]===0x0){return db['UserProfileResource'][_0xe6a9('0x4c')]({'name':_0x442e0d[_0xe6a9('0x2d')],'resourceId':_0x442e0d['id'],'type':_0xa5e74[_0xe6a9('0x2d')],'sectionId':_0xa5e74['id']},{})[_0xe6a9('0x27')](function(){return _0x185250;});}else{return _0x185250;}})[_0xe6a9('0x4b')](function(_0x5d2cd0){logger[_0xe6a9('0x2b')](_0xe6a9('0x56'),_0x5d2cd0);throw _0x5d2cd0;});}return _0x185250;})[_0xe6a9('0x27')](respondWithResult(_0x4a8fd2,0xc9))[_0xe6a9('0x4b')](handleError(_0x4a8fd2,null));};exports['update']=function(_0x149311,_0x45d46e){if(_0x149311[_0xe6a9('0x4d')]['id']){delete _0x149311[_0xe6a9('0x4d')]['id'];}return db['FaxQueue'][_0xe6a9('0x53')]({'where':{'id':_0x149311[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0x45d46e,null))[_0xe6a9('0x27')](saveUpdates(_0x149311[_0xe6a9('0x4d')],null))[_0xe6a9('0x27')](respondWithResult(_0x45d46e,null))['catch'](handleError(_0x45d46e,null));};exports[_0xe6a9('0x2a')]=function(_0x5dd5a1,_0x4a38bd){return db['FaxQueue'][_0xe6a9('0x53')]({'where':{'id':_0x5dd5a1[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a38bd,null))[_0xe6a9('0x27')](removeEntity(_0x4a38bd,null))['catch'](handleError(_0x4a38bd,null));};exports[_0xe6a9('0x57')]=function(_0x2d20a3,_0x29c0b1){return db[_0xe6a9('0x31')][_0xe6a9('0x57')]()[_0xe6a9('0x27')](respondWithResult(_0x29c0b1,null))['catch'](handleError(_0x29c0b1,null));};exports[_0xe6a9('0x58')]=function(_0xc5a511,_0xf395ed,_0x2d6363){var _0x3673c={'raw':!![],'where':{}},_0x45df38={},_0x19fc0b;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0xc5a511[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0xf395ed,null))[_0xe6a9('0x27')](function(_0x433457){if(_0x433457){_0x19fc0b=_0x433457['get']({'plain':!![]});_0x45df38['model']=_[_0xe6a9('0x37')](db[_0xe6a9('0x5a')][_0xe6a9('0x32')]);_0x45df38['query']=_[_0xe6a9('0x37')](_0xc5a511[_0xe6a9('0x36')]);_0x45df38[_0xe6a9('0x38')]=_['intersection'](_0x45df38[_0xe6a9('0x35')],_0x45df38[_0xe6a9('0x36')]);_0x3673c['attributes']=_[_0xe6a9('0x39')](_0x45df38['model'],qs[_0xe6a9('0x3b')](_0xc5a511['query'][_0xe6a9('0x3b')]));_0x3673c[_0xe6a9('0x3a')]=_0x3673c[_0xe6a9('0x3a')]['length']?_0x3673c[_0xe6a9('0x3a')]:_0x45df38[_0xe6a9('0x35')];if(!_0xc5a511['query'][_0xe6a9('0x3d')](_0xe6a9('0x3e'))){_0x3673c[_0xe6a9('0x20')]=qs[_0xe6a9('0x20')](_0xc5a511[_0xe6a9('0x36')]['limit']);_0x3673c[_0xe6a9('0x1f')]=qs['offset'](_0xc5a511['query'][_0xe6a9('0x1f')]);}_0x3673c[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0xc5a511[_0xe6a9('0x36')][_0xe6a9('0x40')]);_0x3673c[_0xe6a9('0x41')]=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0xc5a511[_0xe6a9('0x36')],_0x45df38[_0xe6a9('0x38')]));_0x3673c['where'][_0xe6a9('0x5b')]=_0x433457['id'];if(_0xc5a511['query'][_0xe6a9('0x43')]){_0x3673c['where']=_['merge'](_0x3673c['where'],{'$or':_[_0xe6a9('0x30')](_0x3673c['attributes'],function(_0x38f5af){var _0x226b77={};_0x226b77[_0x38f5af]={'$like':'%'+_0xc5a511[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x226b77;})});}_0x3673c=_['merge']({},_0x3673c,_0xc5a511[_0xe6a9('0x45')]);return db[_0xe6a9('0x5a')][_0xe6a9('0x48')](_0x3673c);}})[_0xe6a9('0x27')](function(_0x447da9){if(_0x447da9){return db['User'][_0xe6a9('0x5c')]({'where':{'id':_[_0xe6a9('0x30')](_0x447da9,_0xe6a9('0x5d')),'role':'agent'},'attributes':['id',_0xe6a9('0x2d'),'faxPause','updatedAt',_0xe6a9('0x5e')]});}})[_0xe6a9('0x27')](function(_0x3d28a9){if(_0x3d28a9){return{'count':_0x3d28a9[_0xe6a9('0x21')],'rows':_['map'](_0x3d28a9[_0xe6a9('0x5f')],function(_0x5223a8){return{'membername':_0x5223a8['name'],'UserId':_0x5223a8['id'],'queue_name':_0x19fc0b['name'],'FaxQueueId':_0x19fc0b['id'],'interface':util[_0xe6a9('0x60')]('%s/%s',_0xe6a9('0x61'),_0x5223a8['name']),'penalty':0x0,'paused':_0x5223a8[_0xe6a9('0x62')],'createdAt':_0x5223a8[_0xe6a9('0x5e')],'updatedAt':_0x5223a8[_0xe6a9('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe6a9('0x27')](respondWithFilteredResult(_0xf395ed,_0x3673c))[_0xe6a9('0x4b')](handleError(_0xf395ed,null));};exports[_0xe6a9('0x64')]=function(_0xa46919,_0x341657,_0x30a5f4){var _0x3ee646={};var _0x1e40b4={};var _0x158b11;var _0x397c7b;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0xa46919[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x341657,null))[_0xe6a9('0x27')](function(_0x45f22e){if(_0x45f22e){_0x158b11=_0x45f22e;_0x1e40b4[_0xe6a9('0x35')]=_['keys'](db[_0xe6a9('0x65')]['rawAttributes']);_0x1e40b4[_0xe6a9('0x36')]=_['keys'](_0xa46919[_0xe6a9('0x36')]);_0x1e40b4['filters']=_[_0xe6a9('0x39')](_0x1e40b4[_0xe6a9('0x35')],_0x1e40b4[_0xe6a9('0x36')]);_0x3ee646[_0xe6a9('0x3a')]=_[_0xe6a9('0x39')](_0x1e40b4[_0xe6a9('0x35')],qs[_0xe6a9('0x3b')](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x3b')]));_0x3ee646[_0xe6a9('0x3a')]=_0x3ee646[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0x3ee646[_0xe6a9('0x3a')]:_0x1e40b4['model'];_0x3ee646[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0xa46919['query'][_0xe6a9('0x40')]);_0x3ee646['where']=qs[_0xe6a9('0x38')](_[_0xe6a9('0x42')](_0xa46919[_0xe6a9('0x36')],_0x1e40b4['filters']));if(_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x43')]){_0x3ee646[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0x3ee646[_0xe6a9('0x41')],{'$or':_[_0xe6a9('0x30')](_0x3ee646[_0xe6a9('0x3a')],function(_0x4a9436){var _0x3534b8={};_0x3534b8[_0x4a9436]={'$like':'%'+_0xa46919['query']['filter']+'%'};return _0x3534b8;})});}_0x3ee646=_['merge']({},_0x3ee646,_0xa46919[_0xe6a9('0x45')]);return _0x158b11[_0xe6a9('0x64')](_0x3ee646);}})['then'](function(_0x3d919c){if(_0x3d919c){_0x397c7b=_0x3d919c[_0xe6a9('0x3c')];if(!_0xa46919['query']['hasOwnProperty'](_0xe6a9('0x3e'))){_0x3ee646['limit']=qs['limit'](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x20')]);_0x3ee646[_0xe6a9('0x1f')]=qs[_0xe6a9('0x1f')](_0xa46919[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}return _0x158b11[_0xe6a9('0x64')](_0x3ee646);}})['then'](function(_0x4b9e8d){if(_0x4b9e8d){return _0x4b9e8d?{'count':_0x397c7b,'rows':_0x4b9e8d}:null;}})[_0xe6a9('0x27')](respondWithResult(_0x341657,null))[_0xe6a9('0x4b')](handleError(_0x341657,null));};exports['addTeams']=function(_0x2a39da,_0x49af05,_0x33a8a1){var _0x5cf48f=_0x2a39da[_0xe6a9('0x4d')][_0xe6a9('0x66')];return db[_0xe6a9('0x65')][_0xe6a9('0x48')]({'where':{'id':_0x5cf48f},'attributes':['id'],'include':[{'model':db[_0xe6a9('0x67')],'as':_0xe6a9('0x68'),'attributes':['id','name',_0xe6a9('0x69'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x305d2f){if(_0x305d2f){var _0x314023=_[_0xe6a9('0x6a')](_0x305d2f,function(_0x4cb107){var _0x1857ff=_0x4cb107[_0xe6a9('0x4f')]({'plain':!![]});return _0x1857ff[_0xe6a9('0x68')];});return db[_0xe6a9('0x31')]['find']({'where':{'id':_0x2a39da[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](function(_0x3d2023){return db[_0xe6a9('0x6b')]['transaction'](function(_0x43019b){return _0x3d2023[_0xe6a9('0x6c')](_0x5cf48f,{'transaction':_0x43019b})[_0xe6a9('0x27')](function(){return BPromise[_0xe6a9('0x6d')](_0x314023,function(_0x41c4c5){return db[_0xe6a9('0x5a')]['findOrCreate']({'where':{'UserId':_0x41c4c5['id'],'FaxQueueId':_0x2a39da['params']['id']},'transaction':_0x43019b});});})[_0xe6a9('0x27')](function(){_0x314023['forEach'](function(_0x380d22){socket[_0xe6a9('0x6e')](_0xe6a9('0x6f'),{'UserId':_0x380d22['id'],'FaxQueueId':_0x3d2023['id']});});});});});}})['then'](respondWithStatusCode(_0x49af05,null))[_0xe6a9('0x4b')](handleError(_0x49af05,null));};exports[_0xe6a9('0x70')]=function(_0x1f7661,_0x1b939f,_0x42b219){return db[_0xe6a9('0x65')][_0xe6a9('0x48')]({'where':{'id':_0x1f7661[_0xe6a9('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe6a9('0x67')],'as':_0xe6a9('0x68'),'attributes':['id'],'raw':!![]}]})[_0xe6a9('0x27')](handleEntityNotFound(_0x1b939f,null))[_0xe6a9('0x27')](function(_0x27ded8){var _0x35fe87=_['map'](_0x27ded8,'id');var _0x2a7a1a=[];var _0xbd3de=[];var _0x4467e3=squel[_0xe6a9('0x71')]();_0x4467e3[_0xe6a9('0x72')](_0xe6a9('0x73'))[_0xe6a9('0x74')](_0xe6a9('0x75'),'tq')[_0xe6a9('0x76')](_0xe6a9('0x77'),'ut',_0xe6a9('0x78'))[_0xe6a9('0x41')]('FaxQueueId\x20=\x20?',_0x1f7661[_0xe6a9('0x4a')]['id']);for(var _0x5951f8=0x0;_0x5951f8<_0x27ded8['length'];_0x5951f8+=0x1){let _0x3ac812=_0x27ded8[_0x5951f8];for(var _0x3b79cc=0x0;_0x3b79cc<_0x3ac812[_0xe6a9('0x68')][_0xe6a9('0x3c')];_0x3b79cc+=0x1){let _0x596d98=_0x3ac812[_0xe6a9('0x68')][_0x3b79cc];var _0x683e32=_0x4467e3['clone']();_0x683e32['where'](_0xe6a9('0x79'),_0x596d98['id']);_0xbd3de[_0xe6a9('0x7a')](db[_0xe6a9('0x6b')][_0xe6a9('0x36')](_0x683e32['toString'](),{'type':db[_0xe6a9('0x6b')][_0xe6a9('0x7b')]['SELECT']})[_0xe6a9('0x27')](function(_0x52ca28){if(_0x52ca28[_0xe6a9('0x3c')]===0x1){return _0x596d98['id'];}else{var _0x496de9=_[_0xe6a9('0x7c')](_[_0xe6a9('0x30')](_0x52ca28,'TeamId'),function(_0x5cf19f){return _[_0xe6a9('0x7d')](_0x35fe87,_0x5cf19f);});if(_0x496de9){return _0x596d98['id'];}}}));}}return BPromise[_0xe6a9('0x7e')](_0xbd3de)[_0xe6a9('0x27')](function(_0x5db40){_0x2a7a1a=_(_0x2a7a1a)[_0xe6a9('0x7f')](_0x5db40)[_0xe6a9('0x80')]()[_0xe6a9('0x81')]();return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x1f7661['params']['id']}})[_0xe6a9('0x27')](function(_0x1bff92){return db[_0xe6a9('0x6b')][_0xe6a9('0x82')](function(_0x3a7aba){return _0x1bff92['removeTeams'](_0x1f7661[_0xe6a9('0x36')]['ids'],{'transaction':_0x3a7aba})[_0xe6a9('0x27')](function(){if(!_[_0xe6a9('0x83')](_0x2a7a1a)){return _0x1bff92[_0xe6a9('0x84')](_0x2a7a1a,{'transaction':_0x3a7aba});}})[_0xe6a9('0x27')](function(){_0x2a7a1a[_0xe6a9('0x85')](function(_0x18a9cc){socket[_0xe6a9('0x6e')]('userFaxQueue:remove',{'UserId':_0x18a9cc,'FaxQueueId':_0x1bff92['id']});});});});});});})[_0xe6a9('0x27')](respondWithStatusCode(_0x1b939f,null))[_0xe6a9('0x4b')](handleError(_0x1b939f,null));};exports[_0xe6a9('0x86')]=function(_0x2fddd5,_0x30c09b,_0x5503d0){return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x2fddd5[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30c09b,null))[_0xe6a9('0x27')](function(_0x2c13fd){if(_0x2c13fd){return _0x2c13fd['addAgents'](_0x2fddd5[_0xe6a9('0x4d')][_0xe6a9('0x66')],_[_0xe6a9('0x87')](_0x2fddd5['body'],[_0xe6a9('0x66'),'id'])||{})[_0xe6a9('0x88')](function(_0x322a79){for(var _0x4b7fb1=0x0;_0x4b7fb1<_0x2fddd5[_0xe6a9('0x4d')]['ids']['length'];_0x4b7fb1+=0x1){socket[_0xe6a9('0x6e')](_0xe6a9('0x6f'),{'UserId':Number(_0x2fddd5['body'][_0xe6a9('0x66')][_0x4b7fb1]),'FaxQueueId':Number(_0x2fddd5['params']['id'])});}return _0x322a79;});}})[_0xe6a9('0x27')](respondWithResult(_0x30c09b,null))[_0xe6a9('0x4b')](handleError(_0x30c09b,null));};exports['removeAgents']=function(_0x5b89be,_0x78c5f6,_0x1273f9){return db[_0xe6a9('0x31')][_0xe6a9('0x53')]({'where':{'id':_0x5b89be[_0xe6a9('0x4a')]['id']}})[_0xe6a9('0x27')](handleEntityNotFound(_0x78c5f6,null))[_0xe6a9('0x27')](function(_0x4e819d){if(_0x4e819d){return _0x4e819d[_0xe6a9('0x84')](_0x5b89be['query'][_0xe6a9('0x66')])['then'](function(){if(_['isArray'](_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')])){for(var _0x4c99a4=0x0;_0x4c99a4<_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')][_0xe6a9('0x3c')];_0x4c99a4+=0x1){socket[_0xe6a9('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x5b89be['query'][_0xe6a9('0x66')][_0x4c99a4]),'FaxQueueId':Number(_0x5b89be[_0xe6a9('0x4a')]['id'])});}}else{socket[_0xe6a9('0x6e')](_0xe6a9('0x89'),{'UserId':Number(_0x5b89be[_0xe6a9('0x36')][_0xe6a9('0x66')]),'FaxQueueId':Number(_0x5b89be[_0xe6a9('0x4a')]['id'])});}});}})[_0xe6a9('0x27')](respondWithStatusCode(_0x78c5f6,null))[_0xe6a9('0x4b')](handleError(_0x78c5f6,null));};exports[_0xe6a9('0x8a')]=function(_0x16f1f8,_0x4c2b90,_0x945c76){var _0xe371c9={};var _0x2987fa={};var _0x2fb42a;var _0x1a4a82;return db[_0xe6a9('0x31')][_0xe6a9('0x59')]({'where':{'id':_0x16f1f8[_0xe6a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c2b90,null))[_0xe6a9('0x27')](function(_0x214333){if(_0x214333){_0x2fb42a=_0x214333;_0x2987fa[_0xe6a9('0x35')]=_[_0xe6a9('0x37')](db[_0xe6a9('0x67')][_0xe6a9('0x32')]);_0x2987fa[_0xe6a9('0x36')]=_[_0xe6a9('0x37')](_0x16f1f8[_0xe6a9('0x36')]);_0x2987fa[_0xe6a9('0x38')]=_['intersection'](_0x2987fa[_0xe6a9('0x35')],_0x2987fa[_0xe6a9('0x36')]);_0xe371c9[_0xe6a9('0x3a')]=_['intersection'](_0x2987fa['model'],qs[_0xe6a9('0x3b')](_0x16f1f8[_0xe6a9('0x36')]['fields']));_0xe371c9[_0xe6a9('0x3a')]=_0xe371c9[_0xe6a9('0x3a')][_0xe6a9('0x3c')]?_0xe371c9[_0xe6a9('0x3a')]:_0x2987fa[_0xe6a9('0x35')];_0xe371c9[_0xe6a9('0x3f')]=qs[_0xe6a9('0x40')](_0x16f1f8['query']['sort']);_0xe371c9[_0xe6a9('0x41')]=qs['filters'](_[_0xe6a9('0x42')](_0x16f1f8[_0xe6a9('0x36')],_0x2987fa[_0xe6a9('0x38')]));if(_0x16f1f8[_0xe6a9('0x36')]['filter']){_0xe371c9[_0xe6a9('0x41')]=_[_0xe6a9('0x44')](_0xe371c9[_0xe6a9('0x41')],{'$or':_[_0xe6a9('0x30')](_0xe371c9[_0xe6a9('0x3a')],function(_0x10587a){var _0x229dbe={};_0x229dbe[_0x10587a]={'$like':'%'+_0x16f1f8[_0xe6a9('0x36')][_0xe6a9('0x43')]+'%'};return _0x229dbe;})});}_0xe371c9=_[_0xe6a9('0x44')]({},_0xe371c9,_0x16f1f8[_0xe6a9('0x45')]);return _0x2fb42a[_0xe6a9('0x8a')](_0xe371c9);}})['then'](function(_0x5ac3b1){if(_0x5ac3b1){_0x1a4a82=_0x5ac3b1[_0xe6a9('0x3c')];if(!_0x16f1f8['query'][_0xe6a9('0x3d')]('nolimit')){_0xe371c9[_0xe6a9('0x20')]=qs[_0xe6a9('0x20')](_0x16f1f8['query'][_0xe6a9('0x20')]);_0xe371c9['offset']=qs[_0xe6a9('0x1f')](_0x16f1f8[_0xe6a9('0x36')][_0xe6a9('0x1f')]);}return _0x2fb42a[_0xe6a9('0x8a')](_0xe371c9);}})[_0xe6a9('0x27')](function(_0x3a8bae){if(_0x3a8bae){return _0x3a8bae?{'count':_0x1a4a82,'rows':_0x3a8bae}:null;}})[_0xe6a9('0x27')](respondWithResult(_0x4c2b90,null))['catch'](handleError(_0x4c2b90,null));}; \ No newline at end of file +var _0xe727=['FaxQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','findAndCountAll','UserId','faxPause','createdAt','SIP','updatedAt','getTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','emit','userFaxQueue:save','removeTeams','Team','select','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','removeAgents','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','json','undefined','limit','offset','count','Content-Range','reject','save','then','destroy','get','FaxQueues','UserProfileResource','end','sendStatus','error','name','send','index','map'];(function(_0x4737fc,_0x371a5b){var _0x5bfca8=function(_0x16979c){while(--_0x16979c){_0x4737fc['push'](_0x4737fc['shift']());}};_0x5bfca8(++_0x371a5b);}(_0xe727,0x1ef));var _0x7e72=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe727[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e72('0x0'));var zipdir=require(_0x7e72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e72('0x2'));var moment=require(_0x7e72('0x3'));var BPromise=require(_0x7e72('0x4'));var Mustache=require(_0x7e72('0x5'));var util=require(_0x7e72('0x6'));var path=require(_0x7e72('0x7'));var sox=require(_0x7e72('0x8'));var csv=require(_0x7e72('0x9'));var ejs=require(_0x7e72('0xa'));var fs=require('fs');var fs_extra=require(_0x7e72('0xb'));var _=require(_0x7e72('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7e72('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7e72('0x9'));var querystring=require(_0x7e72('0xe'));var Papa=require(_0x7e72('0xf'));var Redis=require(_0x7e72('0x10'));var authService=require(_0x7e72('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e72('0x12'));var hardwareService=require(_0x7e72('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7e72('0x14'));var config=require(_0x7e72('0x15'));var licenseUtil=require(_0x7e72('0x16'));var db=require(_0x7e72('0x17'))['db'];config[_0x7e72('0x18')]=_[_0x7e72('0x19')](config[_0x7e72('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e72('0x1a'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x7e72('0x1b')](socket);function respondWithStatusCode(_0x478621,_0x198053){_0x198053=_0x198053||0xcc;return function(_0x22f920){if(_0x22f920){return _0x478621['sendStatus'](_0x198053);}return _0x478621[_0x7e72('0x1c')](_0x198053)['end']();};}function respondWithResult(_0x23d8c8,_0x1cd614){_0x1cd614=_0x1cd614||0xc8;return function(_0x2ca627){if(_0x2ca627){return _0x23d8c8[_0x7e72('0x1c')](_0x1cd614)[_0x7e72('0x1d')](_0x2ca627);}};}function respondWithFilteredResult(_0x33c6a1,_0x5cb722){return function(_0x272dc9){if(_0x272dc9){var _0x43ee0a=typeof _0x5cb722['offset']===_0x7e72('0x1e')&&typeof _0x5cb722[_0x7e72('0x1f')]==='undefined';var _0x373604=_0x272dc9['count'];var _0x5b0644=_0x43ee0a?0x0:_0x5cb722[_0x7e72('0x20')];var _0x913b98=_0x43ee0a?_0x272dc9[_0x7e72('0x21')]:_0x5cb722['offset']+_0x5cb722[_0x7e72('0x1f')];var _0x54be8a;if(_0x913b98>=_0x373604){_0x913b98=_0x373604;_0x54be8a=0xc8;}else{_0x54be8a=0xce;}_0x33c6a1[_0x7e72('0x1c')](_0x54be8a);return _0x33c6a1['set'](_0x7e72('0x22'),_0x5b0644+'-'+_0x913b98+'/'+_0x373604)[_0x7e72('0x1d')](_0x272dc9);}return null;};}function patchUpdates(_0x3a2e64){return function(_0x3f7528){try{jsonpatch['apply'](_0x3f7528,_0x3a2e64,!![]);}catch(_0x47c7ce){return BPromise[_0x7e72('0x23')](_0x47c7ce);}return _0x3f7528[_0x7e72('0x24')]();};}function saveUpdates(_0x30fcda,_0x585d58){return function(_0x18d177){if(_0x18d177){return _0x18d177['update'](_0x30fcda)[_0x7e72('0x25')](function(_0x49ad0f){return _0x49ad0f;});}return null;};}function removeEntity(_0x363a3f,_0x487208){return function(_0x2d67c0){if(_0x2d67c0){return _0x2d67c0[_0x7e72('0x26')]()[_0x7e72('0x25')](function(){var _0x26bd47=_0x2d67c0[_0x7e72('0x27')]({'plain':!![]});var _0x3674c6=_0x7e72('0x28');return db[_0x7e72('0x29')][_0x7e72('0x26')]({'where':{'type':_0x3674c6,'resourceId':_0x26bd47['id']}})[_0x7e72('0x25')](function(){return _0x2d67c0;});})[_0x7e72('0x25')](function(){_0x363a3f[_0x7e72('0x1c')](0xcc)[_0x7e72('0x2a')]();});}};}function handleEntityNotFound(_0x36daf0,_0x429f33){return function(_0x2b5e7b){if(!_0x2b5e7b){_0x36daf0[_0x7e72('0x2b')](0x194);}return _0x2b5e7b;};}function handleError(_0x3e1446,_0x23b104){_0x23b104=_0x23b104||0x1f4;return function(_0x2bdde5){logger[_0x7e72('0x2c')](_0x2bdde5['stack']);if(_0x2bdde5['name']){delete _0x2bdde5[_0x7e72('0x2d')];}_0x3e1446[_0x7e72('0x1c')](_0x23b104)[_0x7e72('0x2e')](_0x2bdde5);};}exports[_0x7e72('0x2f')]=function(_0x309591,_0x5983ad){var _0x4344b9={},_0x1e833d={},_0x493c1f={'count':0x0,'rows':[]};var _0x4f03df=_[_0x7e72('0x30')](db[_0x7e72('0x31')]['rawAttributes'],function(_0x440354){return{'name':_0x440354[_0x7e72('0x32')],'type':_0x440354['type'][_0x7e72('0x33')]};});_0x1e833d[_0x7e72('0x34')]=_[_0x7e72('0x30')](_0x4f03df,_0x7e72('0x2d'));_0x1e833d[_0x7e72('0x35')]=_[_0x7e72('0x36')](_0x309591[_0x7e72('0x35')]);_0x1e833d[_0x7e72('0x37')]=_[_0x7e72('0x38')](_0x1e833d[_0x7e72('0x34')],_0x1e833d['query']);_0x4344b9[_0x7e72('0x39')]=_['intersection'](_0x1e833d[_0x7e72('0x34')],qs[_0x7e72('0x3a')](_0x309591[_0x7e72('0x35')][_0x7e72('0x3a')]));_0x4344b9[_0x7e72('0x39')]=_0x4344b9[_0x7e72('0x39')][_0x7e72('0x3b')]?_0x4344b9[_0x7e72('0x39')]:_0x1e833d['model'];if(!_0x309591[_0x7e72('0x35')][_0x7e72('0x3c')](_0x7e72('0x3d'))){_0x4344b9[_0x7e72('0x1f')]=qs[_0x7e72('0x1f')](_0x309591[_0x7e72('0x35')][_0x7e72('0x1f')]);_0x4344b9['offset']=qs[_0x7e72('0x20')](_0x309591[_0x7e72('0x35')]['offset']);}_0x4344b9[_0x7e72('0x3e')]=qs[_0x7e72('0x3f')](_0x309591[_0x7e72('0x35')][_0x7e72('0x3f')]);_0x4344b9[_0x7e72('0x40')]=qs[_0x7e72('0x37')](_[_0x7e72('0x41')](_0x309591[_0x7e72('0x35')],_0x1e833d[_0x7e72('0x37')]),_0x4f03df);if(_0x309591['query'][_0x7e72('0x42')]){_0x4344b9[_0x7e72('0x40')]=_['merge'](_0x4344b9[_0x7e72('0x40')],{'$or':_[_0x7e72('0x30')](_0x4f03df,function(_0x593a57){if(_0x593a57['type']!=='VIRTUAL'){var _0x2e09da={};_0x2e09da[_0x593a57['name']]={'$like':'%'+_0x309591[_0x7e72('0x35')][_0x7e72('0x42')]+'%'};return _0x2e09da;}})});}_0x4344b9=_[_0x7e72('0x43')]({},_0x4344b9,_0x309591[_0x7e72('0x44')]);var _0x25fb46={'where':_0x4344b9[_0x7e72('0x40')]};return db[_0x7e72('0x31')][_0x7e72('0x21')](_0x25fb46)[_0x7e72('0x25')](function(_0x41ede1){_0x493c1f[_0x7e72('0x21')]=_0x41ede1;if(_0x309591[_0x7e72('0x35')]['includeAll']){_0x4344b9[_0x7e72('0x45')]=[{'all':!![]}];}return db[_0x7e72('0x31')][_0x7e72('0x46')](_0x4344b9);})[_0x7e72('0x25')](function(_0x1c01fc){_0x493c1f[_0x7e72('0x47')]=_0x1c01fc;return _0x493c1f;})[_0x7e72('0x25')](respondWithFilteredResult(_0x5983ad,_0x4344b9))[_0x7e72('0x48')](handleError(_0x5983ad,null));};exports[_0x7e72('0x49')]=function(_0x138e94,_0x359055){var _0x48eb37={'raw':!![],'where':{'id':_0x138e94[_0x7e72('0x4a')]['id']}},_0xdcc72c={};_0xdcc72c['model']=_[_0x7e72('0x36')](db[_0x7e72('0x31')][_0x7e72('0x4b')]);_0xdcc72c['query']=_[_0x7e72('0x36')](_0x138e94[_0x7e72('0x35')]);_0xdcc72c[_0x7e72('0x37')]=_[_0x7e72('0x38')](_0xdcc72c[_0x7e72('0x34')],_0xdcc72c[_0x7e72('0x35')]);_0x48eb37[_0x7e72('0x39')]=_['intersection'](_0xdcc72c[_0x7e72('0x34')],qs[_0x7e72('0x3a')](_0x138e94[_0x7e72('0x35')][_0x7e72('0x3a')]));_0x48eb37[_0x7e72('0x39')]=_0x48eb37[_0x7e72('0x39')][_0x7e72('0x3b')]?_0x48eb37[_0x7e72('0x39')]:_0xdcc72c[_0x7e72('0x34')];if(_0x138e94[_0x7e72('0x35')][_0x7e72('0x4c')]){_0x48eb37[_0x7e72('0x45')]=[{'all':!![]}];}_0x48eb37=_['merge']({},_0x48eb37,_0x138e94[_0x7e72('0x44')]);return db[_0x7e72('0x31')][_0x7e72('0x4d')](_0x48eb37)[_0x7e72('0x25')](handleEntityNotFound(_0x359055,null))[_0x7e72('0x25')](respondWithResult(_0x359055,null))['catch'](handleError(_0x359055,null));};exports[_0x7e72('0x4e')]=function(_0x2f96c5,_0x177234){return db[_0x7e72('0x31')][_0x7e72('0x4e')](_0x2f96c5['body'],{})[_0x7e72('0x25')](function(_0x3dd6f8){var _0x159f0d=_0x2f96c5[_0x7e72('0x4f')][_0x7e72('0x27')]({'plain':!![]});if(!_0x159f0d)throw new Error(_0x7e72('0x50'));if(_0x159f0d['role']==='user'){var _0x549b38=_0x3dd6f8[_0x7e72('0x27')]({'plain':!![]});var _0x59717d=_0x7e72('0x28');return db[_0x7e72('0x51')][_0x7e72('0x4d')]({'where':{'name':_0x59717d,'userProfileId':_0x159f0d[_0x7e72('0x52')]},'raw':!![]})[_0x7e72('0x25')](function(_0x4c677e){if(_0x4c677e&&_0x4c677e[_0x7e72('0x53')]===0x0){return db[_0x7e72('0x29')]['create']({'name':_0x549b38[_0x7e72('0x2d')],'resourceId':_0x549b38['id'],'type':_0x4c677e['name'],'sectionId':_0x4c677e['id']},{})[_0x7e72('0x25')](function(){return _0x3dd6f8;});}else{return _0x3dd6f8;}})['catch'](function(_0x4b643f){logger[_0x7e72('0x2c')](_0x7e72('0x54'),_0x4b643f);throw _0x4b643f;});}return _0x3dd6f8;})[_0x7e72('0x25')](respondWithResult(_0x177234,0xc9))['catch'](handleError(_0x177234,null));};exports[_0x7e72('0x55')]=function(_0x341dec,_0x37f321){if(_0x341dec[_0x7e72('0x56')]['id']){delete _0x341dec['body']['id'];}return db[_0x7e72('0x31')][_0x7e72('0x4d')]({'where':{'id':_0x341dec[_0x7e72('0x4a')]['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0x37f321,null))['then'](saveUpdates(_0x341dec[_0x7e72('0x56')],null))[_0x7e72('0x25')](respondWithResult(_0x37f321,null))[_0x7e72('0x48')](handleError(_0x37f321,null));};exports[_0x7e72('0x26')]=function(_0x917f56,_0x4ad6d6){return db[_0x7e72('0x31')][_0x7e72('0x4d')]({'where':{'id':_0x917f56[_0x7e72('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ad6d6,null))[_0x7e72('0x25')](removeEntity(_0x4ad6d6,null))[_0x7e72('0x48')](handleError(_0x4ad6d6,null));};exports['describe']=function(_0x527625,_0x2db864){return db[_0x7e72('0x31')][_0x7e72('0x57')]()[_0x7e72('0x25')](respondWithResult(_0x2db864,null))[_0x7e72('0x48')](handleError(_0x2db864,null));};exports[_0x7e72('0x58')]=function(_0x4bb6e7,_0x53b1a2,_0x10abd4){var _0x2fc030={'raw':!![],'where':{}},_0x5105bf={},_0x5f0d68;return db[_0x7e72('0x31')][_0x7e72('0x59')]({'where':{'id':_0x4bb6e7['params']['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0x53b1a2,null))[_0x7e72('0x25')](function(_0x22d125){if(_0x22d125){_0x5f0d68=_0x22d125[_0x7e72('0x27')]({'plain':!![]});_0x5105bf[_0x7e72('0x34')]=_[_0x7e72('0x36')](db[_0x7e72('0x5a')][_0x7e72('0x4b')]);_0x5105bf[_0x7e72('0x35')]=_[_0x7e72('0x36')](_0x4bb6e7[_0x7e72('0x35')]);_0x5105bf[_0x7e72('0x37')]=_[_0x7e72('0x38')](_0x5105bf[_0x7e72('0x34')],_0x5105bf[_0x7e72('0x35')]);_0x2fc030[_0x7e72('0x39')]=_[_0x7e72('0x38')](_0x5105bf[_0x7e72('0x34')],qs[_0x7e72('0x3a')](_0x4bb6e7[_0x7e72('0x35')]['fields']));_0x2fc030['attributes']=_0x2fc030[_0x7e72('0x39')][_0x7e72('0x3b')]?_0x2fc030[_0x7e72('0x39')]:_0x5105bf['model'];if(!_0x4bb6e7['query'][_0x7e72('0x3c')](_0x7e72('0x3d'))){_0x2fc030[_0x7e72('0x1f')]=qs[_0x7e72('0x1f')](_0x4bb6e7[_0x7e72('0x35')][_0x7e72('0x1f')]);_0x2fc030[_0x7e72('0x20')]=qs[_0x7e72('0x20')](_0x4bb6e7[_0x7e72('0x35')][_0x7e72('0x20')]);}_0x2fc030['order']=qs[_0x7e72('0x3f')](_0x4bb6e7[_0x7e72('0x35')][_0x7e72('0x3f')]);_0x2fc030['where']=qs[_0x7e72('0x37')](_[_0x7e72('0x41')](_0x4bb6e7[_0x7e72('0x35')],_0x5105bf[_0x7e72('0x37')]));_0x2fc030['where']['FaxQueueId']=_0x22d125['id'];if(_0x4bb6e7[_0x7e72('0x35')][_0x7e72('0x42')]){_0x2fc030[_0x7e72('0x40')]=_[_0x7e72('0x43')](_0x2fc030[_0x7e72('0x40')],{'$or':_[_0x7e72('0x30')](_0x2fc030[_0x7e72('0x39')],function(_0x4601ce){var _0x59780d={};_0x59780d[_0x4601ce]={'$like':'%'+_0x4bb6e7[_0x7e72('0x35')][_0x7e72('0x42')]+'%'};return _0x59780d;})});}_0x2fc030=_['merge']({},_0x2fc030,_0x4bb6e7[_0x7e72('0x44')]);return db[_0x7e72('0x5a')]['findAll'](_0x2fc030);}})[_0x7e72('0x25')](function(_0x6ab39d){if(_0x6ab39d){return db['User'][_0x7e72('0x5b')]({'where':{'id':_[_0x7e72('0x30')](_0x6ab39d,_0x7e72('0x5c')),'role':'agent'},'attributes':['id','name',_0x7e72('0x5d'),'updatedAt',_0x7e72('0x5e')]});}})[_0x7e72('0x25')](function(_0x68e12f){if(_0x68e12f){return{'count':_0x68e12f[_0x7e72('0x21')],'rows':_[_0x7e72('0x30')](_0x68e12f[_0x7e72('0x47')],function(_0x31a666){return{'membername':_0x31a666[_0x7e72('0x2d')],'UserId':_0x31a666['id'],'queue_name':_0x5f0d68['name'],'FaxQueueId':_0x5f0d68['id'],'interface':util['format']('%s/%s',_0x7e72('0x5f'),_0x31a666[_0x7e72('0x2d')]),'penalty':0x0,'paused':_0x31a666[_0x7e72('0x5d')],'createdAt':_0x31a666[_0x7e72('0x5e')],'updatedAt':_0x31a666[_0x7e72('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e72('0x25')](respondWithFilteredResult(_0x53b1a2,_0x2fc030))[_0x7e72('0x48')](handleError(_0x53b1a2,null));};exports[_0x7e72('0x61')]=function(_0x2b20eb,_0xebf1f7,_0x18cd79){var _0x39c6ba={};var _0x370df7={};var _0x1a4356;var _0x5d2cf1;return db[_0x7e72('0x31')]['findOne']({'where':{'id':_0x2b20eb['params']['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0xebf1f7,null))[_0x7e72('0x25')](function(_0x2b6cd9){if(_0x2b6cd9){_0x1a4356=_0x2b6cd9;_0x370df7[_0x7e72('0x34')]=_[_0x7e72('0x36')](db['Team'][_0x7e72('0x4b')]);_0x370df7[_0x7e72('0x35')]=_[_0x7e72('0x36')](_0x2b20eb[_0x7e72('0x35')]);_0x370df7[_0x7e72('0x37')]=_[_0x7e72('0x38')](_0x370df7[_0x7e72('0x34')],_0x370df7[_0x7e72('0x35')]);_0x39c6ba['attributes']=_[_0x7e72('0x38')](_0x370df7[_0x7e72('0x34')],qs[_0x7e72('0x3a')](_0x2b20eb[_0x7e72('0x35')][_0x7e72('0x3a')]));_0x39c6ba[_0x7e72('0x39')]=_0x39c6ba[_0x7e72('0x39')][_0x7e72('0x3b')]?_0x39c6ba[_0x7e72('0x39')]:_0x370df7[_0x7e72('0x34')];_0x39c6ba[_0x7e72('0x3e')]=qs['sort'](_0x2b20eb[_0x7e72('0x35')][_0x7e72('0x3f')]);_0x39c6ba[_0x7e72('0x40')]=qs[_0x7e72('0x37')](_[_0x7e72('0x41')](_0x2b20eb['query'],_0x370df7[_0x7e72('0x37')]));if(_0x2b20eb[_0x7e72('0x35')][_0x7e72('0x42')]){_0x39c6ba[_0x7e72('0x40')]=_[_0x7e72('0x43')](_0x39c6ba['where'],{'$or':_['map'](_0x39c6ba[_0x7e72('0x39')],function(_0x1f6d68){var _0x263f3a={};_0x263f3a[_0x1f6d68]={'$like':'%'+_0x2b20eb[_0x7e72('0x35')][_0x7e72('0x42')]+'%'};return _0x263f3a;})});}_0x39c6ba=_[_0x7e72('0x43')]({},_0x39c6ba,_0x2b20eb[_0x7e72('0x44')]);return _0x1a4356['getTeams'](_0x39c6ba);}})[_0x7e72('0x25')](function(_0x1b922a){if(_0x1b922a){_0x5d2cf1=_0x1b922a[_0x7e72('0x3b')];if(!_0x2b20eb[_0x7e72('0x35')][_0x7e72('0x3c')](_0x7e72('0x3d'))){_0x39c6ba['limit']=qs[_0x7e72('0x1f')](_0x2b20eb[_0x7e72('0x35')]['limit']);_0x39c6ba[_0x7e72('0x20')]=qs[_0x7e72('0x20')](_0x2b20eb[_0x7e72('0x35')]['offset']);}return _0x1a4356[_0x7e72('0x61')](_0x39c6ba);}})[_0x7e72('0x25')](function(_0x25c6a5){if(_0x25c6a5){return _0x25c6a5?{'count':_0x5d2cf1,'rows':_0x25c6a5}:null;}})[_0x7e72('0x25')](respondWithResult(_0xebf1f7,null))[_0x7e72('0x48')](handleError(_0xebf1f7,null));};exports['addTeams']=function(_0x260129,_0x78e72b,_0x1f0681){var _0x36be34=_0x260129[_0x7e72('0x56')][_0x7e72('0x62')];return db['Team'][_0x7e72('0x46')]({'where':{'id':_0x36be34},'attributes':['id'],'include':[{'model':db[_0x7e72('0x63')],'as':_0x7e72('0x64'),'attributes':['id',_0x7e72('0x2d'),'online',_0x7e72('0x65'),_0x7e72('0x66')],'raw':!![]}]})[_0x7e72('0x25')](function(_0x59e1f8){if(_0x59e1f8){var _0x417063=_[_0x7e72('0x67')](_0x59e1f8,function(_0x44bea4){var _0x45803e=_0x44bea4[_0x7e72('0x27')]({'plain':!![]});return _0x45803e['Agents'];});return db[_0x7e72('0x31')][_0x7e72('0x4d')]({'where':{'id':_0x260129[_0x7e72('0x4a')]['id']}})['then'](function(_0x21a174){return db[_0x7e72('0x68')][_0x7e72('0x69')](function(_0x16ec4f){return _0x21a174[_0x7e72('0x6a')](_0x36be34,{'transaction':_0x16ec4f})['then'](function(){return BPromise[_0x7e72('0x6b')](_0x417063,function(_0x489c78){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x489c78['id'],'FaxQueueId':_0x260129[_0x7e72('0x4a')]['id']},'transaction':_0x16ec4f});});})[_0x7e72('0x25')](function(){_0x417063['forEach'](function(_0x3af1f7){socket[_0x7e72('0x6c')](_0x7e72('0x6d'),{'UserId':_0x3af1f7['id'],'FaxQueueId':_0x21a174['id']});});});});});}})[_0x7e72('0x25')](respondWithStatusCode(_0x78e72b,null))[_0x7e72('0x48')](handleError(_0x78e72b,null));};exports[_0x7e72('0x6e')]=function(_0x227349,_0x490071,_0x1b353d){return db[_0x7e72('0x6f')][_0x7e72('0x46')]({'where':{'id':_0x227349[_0x7e72('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7e72('0x63')],'as':_0x7e72('0x64'),'attributes':['id'],'raw':!![]}]})[_0x7e72('0x25')](handleEntityNotFound(_0x490071,null))['then'](function(_0x2ccf29){var _0x352acd=_[_0x7e72('0x30')](_0x2ccf29,'id');var _0x5b5819=[];var _0x10c7c0=[];var _0x1e3eb3=squel[_0x7e72('0x70')]();_0x1e3eb3['field']('tq.TeamId')[_0x7e72('0x71')](_0x7e72('0x72'),'tq')[_0x7e72('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7e72('0x74'),_0x227349[_0x7e72('0x4a')]['id']);for(var _0x55b363=0x0;_0x55b363<_0x2ccf29[_0x7e72('0x3b')];_0x55b363+=0x1){let _0x1edc35=_0x2ccf29[_0x55b363];for(var _0x3fc283=0x0;_0x3fc283<_0x1edc35[_0x7e72('0x64')][_0x7e72('0x3b')];_0x3fc283+=0x1){let _0x1da179=_0x1edc35[_0x7e72('0x64')][_0x3fc283];var _0x284022=_0x1e3eb3[_0x7e72('0x75')]();_0x284022[_0x7e72('0x40')](_0x7e72('0x76'),_0x1da179['id']);_0x10c7c0[_0x7e72('0x77')](db[_0x7e72('0x68')][_0x7e72('0x35')](_0x284022['toString'](),{'type':db[_0x7e72('0x68')][_0x7e72('0x78')][_0x7e72('0x79')]})[_0x7e72('0x25')](function(_0x3956c2){if(_0x3956c2[_0x7e72('0x3b')]===0x1){return _0x1da179['id'];}else{var _0x2d1aca=_[_0x7e72('0x7a')](_[_0x7e72('0x30')](_0x3956c2,_0x7e72('0x7b')),function(_0x33f43e){return _[_0x7e72('0x7c')](_0x352acd,_0x33f43e);});if(_0x2d1aca){return _0x1da179['id'];}}}));}}return BPromise[_0x7e72('0x7d')](_0x10c7c0)['then'](function(_0x31a94e){_0x5b5819=_(_0x5b5819)[_0x7e72('0x7e')](_0x31a94e)[_0x7e72('0x7f')]()[_0x7e72('0x80')]();return db[_0x7e72('0x31')]['find']({'where':{'id':_0x227349[_0x7e72('0x4a')]['id']}})[_0x7e72('0x25')](function(_0x28d74a){return db[_0x7e72('0x68')]['transaction'](function(_0x650f69){return _0x28d74a[_0x7e72('0x6e')](_0x227349['query'][_0x7e72('0x62')],{'transaction':_0x650f69})['then'](function(){if(!_[_0x7e72('0x81')](_0x5b5819)){return _0x28d74a['removeAgents'](_0x5b5819,{'transaction':_0x650f69});}})[_0x7e72('0x25')](function(){_0x5b5819['forEach'](function(_0x8346a1){socket['emit']('userFaxQueue:remove',{'UserId':_0x8346a1,'FaxQueueId':_0x28d74a['id']});});});});});});})[_0x7e72('0x25')](respondWithStatusCode(_0x490071,null))[_0x7e72('0x48')](handleError(_0x490071,null));};exports[_0x7e72('0x82')]=function(_0x961d1f,_0xc00f4,_0x5590b4){return db[_0x7e72('0x31')]['find']({'where':{'id':_0x961d1f[_0x7e72('0x4a')]['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0xc00f4,null))[_0x7e72('0x25')](function(_0x270900){if(_0x270900){return _0x270900[_0x7e72('0x82')](_0x961d1f[_0x7e72('0x56')][_0x7e72('0x62')],_[_0x7e72('0x83')](_0x961d1f[_0x7e72('0x56')],[_0x7e72('0x62'),'id'])||{})['spread'](function(_0x370db0){for(var _0x53a3fb=0x0;_0x53a3fb<_0x961d1f['body'][_0x7e72('0x62')][_0x7e72('0x3b')];_0x53a3fb+=0x1){socket[_0x7e72('0x6c')](_0x7e72('0x6d'),{'UserId':Number(_0x961d1f[_0x7e72('0x56')][_0x7e72('0x62')][_0x53a3fb]),'FaxQueueId':Number(_0x961d1f[_0x7e72('0x4a')]['id'])});}return _0x370db0;});}})['then'](respondWithResult(_0xc00f4,null))[_0x7e72('0x48')](handleError(_0xc00f4,null));};exports[_0x7e72('0x84')]=function(_0x18aa50,_0x1ba195,_0x5df5a4){return db['FaxQueue'][_0x7e72('0x4d')]({'where':{'id':_0x18aa50[_0x7e72('0x4a')]['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0x1ba195,null))[_0x7e72('0x25')](function(_0x244c05){if(_0x244c05){return _0x244c05['removeAgents'](_0x18aa50['query'][_0x7e72('0x62')])['then'](function(){if(_[_0x7e72('0x85')](_0x18aa50[_0x7e72('0x35')][_0x7e72('0x62')])){for(var _0x4becd5=0x0;_0x4becd5<_0x18aa50['query']['ids'][_0x7e72('0x3b')];_0x4becd5+=0x1){socket[_0x7e72('0x6c')](_0x7e72('0x86'),{'UserId':Number(_0x18aa50[_0x7e72('0x35')]['ids'][_0x4becd5]),'FaxQueueId':Number(_0x18aa50['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x18aa50[_0x7e72('0x35')][_0x7e72('0x62')]),'FaxQueueId':Number(_0x18aa50[_0x7e72('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ba195,null))[_0x7e72('0x48')](handleError(_0x1ba195,null));};exports[_0x7e72('0x87')]=function(_0x3db50b,_0x5bc60e,_0x3b285b){var _0x42878f={};var _0x623606={};var _0x386171;var _0x1ce1d5;return db[_0x7e72('0x31')][_0x7e72('0x59')]({'where':{'id':_0x3db50b['params']['id']}})[_0x7e72('0x25')](handleEntityNotFound(_0x5bc60e,null))['then'](function(_0x146f9c){if(_0x146f9c){_0x386171=_0x146f9c;_0x623606[_0x7e72('0x34')]=_[_0x7e72('0x36')](db['User'][_0x7e72('0x4b')]);_0x623606[_0x7e72('0x35')]=_['keys'](_0x3db50b[_0x7e72('0x35')]);_0x623606[_0x7e72('0x37')]=_[_0x7e72('0x38')](_0x623606[_0x7e72('0x34')],_0x623606[_0x7e72('0x35')]);_0x42878f[_0x7e72('0x39')]=_['intersection'](_0x623606[_0x7e72('0x34')],qs['fields'](_0x3db50b[_0x7e72('0x35')]['fields']));_0x42878f[_0x7e72('0x39')]=_0x42878f[_0x7e72('0x39')][_0x7e72('0x3b')]?_0x42878f[_0x7e72('0x39')]:_0x623606[_0x7e72('0x34')];_0x42878f[_0x7e72('0x3e')]=qs[_0x7e72('0x3f')](_0x3db50b[_0x7e72('0x35')]['sort']);_0x42878f[_0x7e72('0x40')]=qs['filters'](_[_0x7e72('0x41')](_0x3db50b[_0x7e72('0x35')],_0x623606['filters']));if(_0x3db50b[_0x7e72('0x35')][_0x7e72('0x42')]){_0x42878f[_0x7e72('0x40')]=_[_0x7e72('0x43')](_0x42878f[_0x7e72('0x40')],{'$or':_[_0x7e72('0x30')](_0x42878f[_0x7e72('0x39')],function(_0x11f90b){var _0x1605c5={};_0x1605c5[_0x11f90b]={'$like':'%'+_0x3db50b['query'][_0x7e72('0x42')]+'%'};return _0x1605c5;})});}_0x42878f=_[_0x7e72('0x43')]({},_0x42878f,_0x3db50b['options']);return _0x386171[_0x7e72('0x87')](_0x42878f);}})[_0x7e72('0x25')](function(_0x53135c){if(_0x53135c){_0x1ce1d5=_0x53135c[_0x7e72('0x3b')];if(!_0x3db50b[_0x7e72('0x35')][_0x7e72('0x3c')]('nolimit')){_0x42878f[_0x7e72('0x1f')]=qs[_0x7e72('0x1f')](_0x3db50b['query'][_0x7e72('0x1f')]);_0x42878f['offset']=qs['offset'](_0x3db50b['query'][_0x7e72('0x20')]);}return _0x386171[_0x7e72('0x87')](_0x42878f);}})['then'](function(_0x507aba){if(_0x507aba){return _0x507aba?{'count':_0x1ce1d5,'rows':_0x507aba}:null;}})[_0x7e72('0x25')](respondWithResult(_0x5bc60e,null))[_0x7e72('0x48')](handleError(_0x5bc60e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d4d08e6..e72704b 100644 --- a/server/api/faxQueue/faxQueue.events.js +++ b/server/api/faxQueue/faxQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe9a1=['FaxQueue','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x4146ea,_0x5b3b71){var _0x17bf92=function(_0x374dea){while(--_0x374dea){_0x4146ea['push'](_0x4146ea['shift']());}};_0x17bf92(++_0x5b3b71);}(_0xe9a1,0x8f));var _0x1e9a=function(_0x554895,_0x1d8ad4){_0x554895=_0x554895-0x0;var _0x86a927=_0xe9a1[_0x554895];return _0x86a927;};'use strict';var EventEmitter=require(_0x1e9a('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x1e9a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1e9a('0x2')](0x0);var events={'afterCreate':_0x1e9a('0x3'),'afterUpdate':_0x1e9a('0x4'),'afterDestroy':_0x1e9a('0x5')};function emitEvent(_0x13caaa){return function(_0x38cd53,_0x4647d0,_0x3e7131){FaxQueueEvents[_0x1e9a('0x6')](_0x13caaa+':'+_0x38cd53['id'],_0x38cd53);FaxQueueEvents[_0x1e9a('0x6')](_0x13caaa,_0x38cd53);_0x3e7131(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x1e9a('0x7')](e,emitEvent(event));}}module[_0x1e9a('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x267b=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x59ef39,_0x38d7f7){var _0x2ebea0=function(_0x33b0cc){while(--_0x33b0cc){_0x59ef39['push'](_0x59ef39['shift']());}};_0x2ebea0(++_0x38d7f7);}(_0x267b,0xb4));var _0xb267=function(_0x33edda,_0x16fdf5){_0x33edda=_0x33edda-0x0;var _0x6e2dc0=_0x267b[_0x33edda];return _0x6e2dc0;};'use strict';var EventEmitter=require(_0xb267('0x0'));var FaxQueue=require(_0xb267('0x1'))['db'][_0xb267('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb267('0x3')](0x0);var events={'afterCreate':_0xb267('0x4'),'afterUpdate':_0xb267('0x5'),'afterDestroy':'remove'};function emitEvent(_0x567909){return function(_0x42f312,_0x44638f,_0x440009){FaxQueueEvents[_0xb267('0x6')](_0x567909+':'+_0x42f312['id'],_0x42f312);FaxQueueEvents[_0xb267('0x6')](_0x567909,_0x42f312);_0x440009(null);};}for(var e in events){if(events[_0xb267('0x7')](e)){var event=events[e];FaxQueue[_0xb267('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 3117c27..4d40404 100644 --- a/server/api/faxQueue/faxQueue.model.js +++ b/server/api/faxQueue/faxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab29=['fax_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue'];(function(_0x1d32e2,_0x2c9a43){var _0x2b5319=function(_0x5a831d){while(--_0x5a831d){_0x1d32e2['push'](_0x1d32e2['shift']());}};_0x2b5319(++_0x2c9a43);}(_0xab29,0xa6));var _0x9ab2=function(_0x36ab6e,_0x4e1b52){_0x36ab6e=_0x36ab6e-0x0;var _0x73a78f=_0xab29[_0x36ab6e];return _0x73a78f;};'use strict';var _=require(_0x9ab2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9ab2('0x1'));var rp=require(_0x9ab2('0x2'));var fs=require('fs');var path=require(_0x9ab2('0x3'));var rimraf=require(_0x9ab2('0x4'));var config=require(_0x9ab2('0x5'));var attributes=require(_0x9ab2('0x6'));module[_0x9ab2('0x7')]=function(_0x3f26a3,_0x346b3b){return _0x3f26a3[_0x9ab2('0x8')](_0x9ab2('0x9'),attributes,{'tableName':_0x9ab2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a66=['exports','define','fax_queues','lodash','api','bluebird','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x5e0a35,_0x371f2e){var _0x1d3032=function(_0x3c7ed3){while(--_0x3c7ed3){_0x5e0a35['push'](_0x5e0a35['shift']());}};_0x1d3032(++_0x371f2e);}(_0x5a66,0x186));var _0x65a6=function(_0x331bdd,_0x1d0c15){_0x331bdd=_0x331bdd-0x0;var _0x30f50c=_0x5a66[_0x331bdd];return _0x30f50c;};'use strict';var _=require(_0x65a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x65a6('0x1'));var moment=require('moment');var BPromise=require(_0x65a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65a6('0x3'));var config=require(_0x65a6('0x4'));var attributes=require(_0x65a6('0x5'));module[_0x65a6('0x6')]=function(_0x395d40,_0x7d580e){return _0x395d40[_0x65a6('0x7')]('FaxQueue',attributes,{'tableName':_0x65a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 729c2cf..76d8f99 100644 --- a/server/api/faxQueue/faxQueue.rpc.js +++ b/server/api/faxQueue/faxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90a4=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','stringify','ShowFaxQueue','find','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x90a4,0x113));var _0x490a=function(_0x3c38ee,_0x48f99e){_0x3c38ee=_0x3c38ee-0x0;var _0x1874ea=_0x90a4[_0x3c38ee];return _0x1874ea;};'use strict';var _=require(_0x490a('0x0'));var util=require(_0x490a('0x1'));var moment=require('moment');var BPromise=require(_0x490a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x490a('0x3'));var db=require(_0x490a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x490a('0x5'))(_0x490a('0x6'));var config=require('../../config/environment');var jayson=require(_0x490a('0x7'));var client=jayson[_0x490a('0x8')][_0x490a('0x9')]({'port':0x232a});config[_0x490a('0xa')]=_[_0x490a('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x490a('0xc'))(new Redis(config[_0x490a('0xa')]));require(_0x490a('0xd'))[_0x490a('0xe')](socket);function respondWithRpcPromise(_0x19ba55,_0xef5810,_0x5ae41c){return new BPromise(function(_0x3779ca,_0x554dea){return client['request'](_0x19ba55,_0x5ae41c)['then'](function(_0x33093c){logger['info'](_0x490a('0xf'),_0xef5810,'request\x20sent');logger['debug'](_0x490a('0x10'),_0xef5810,_0x490a('0x11'),JSON['stringify'](_0x33093c));if(_0x33093c[_0x490a('0x12')]){if(_0x33093c['error'][_0x490a('0x13')]===0x1f4){logger[_0x490a('0x12')](_0x490a('0xf'),_0xef5810,_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);return _0x554dea(_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);}logger['error'](_0x490a('0xf'),_0xef5810,_0x33093c[_0x490a('0x12')][_0x490a('0x14')]);return _0x3779ca(_0x33093c[_0x490a('0x12')]['message']);}else{logger[_0x490a('0x15')](_0x490a('0xf'),_0xef5810,'request\x20sent');_0x3779ca(_0x33093c[_0x490a('0x16')][_0x490a('0x14')]);}})[_0x490a('0x17')](function(_0x1bcc2e){logger[_0x490a('0x12')](_0x490a('0xf'),_0xef5810,_0x1bcc2e);_0x554dea(_0x1bcc2e);});});}exports[_0x490a('0x18')]=function(_0x325064){var _0x48edea=this;return new Promise(function(_0x36cb5d,_0x4bbacb){return db[_0x490a('0x19')][_0x490a('0x1a')]({'raw':_0x325064[_0x490a('0x1b')]?_0x325064[_0x490a('0x1b')][_0x490a('0x1c')]===undefined?!![]:![]:!![],'where':_0x325064[_0x490a('0x1b')]?_0x325064['options'][_0x490a('0x1d')]||null:null,'attributes':_0x325064['options']?_0x325064[_0x490a('0x1b')][_0x490a('0x1e')]||null:null,'limit':_0x325064[_0x490a('0x1b')]?_0x325064[_0x490a('0x1b')][_0x490a('0x1f')]||null:null,'include':_0x325064[_0x490a('0x1b')]?_0x325064['options'][_0x490a('0x20')]?_['map'](_0x325064['options'][_0x490a('0x20')],function(_0x546e88){return{'model':db[_0x546e88[_0x490a('0x21')]],'as':_0x546e88['as'],'attributes':_0x546e88[_0x490a('0x1e')],'include':_0x546e88[_0x490a('0x20')]?_['map'](_0x546e88[_0x490a('0x20')],function(_0x5aa16c){return{'model':db[_0x5aa16c[_0x490a('0x21')]],'as':_0x5aa16c['as'],'attributes':_0x5aa16c[_0x490a('0x1e')],'include':_0x5aa16c[_0x490a('0x20')]?_[_0x490a('0x22')](_0x5aa16c[_0x490a('0x20')],function(_0x591291){return{'model':db[_0x591291['model']],'as':_0x591291['as'],'attributes':_0x591291['attributes']};}):[]};}):[]};}):[]:[]})[_0x490a('0x23')](function(_0x23a5bc){logger['info']('GetFaxQueue',_0x325064);logger[_0x490a('0x24')](_0x490a('0x18'),_0x325064,JSON[_0x490a('0x25')](_0x23a5bc));_0x36cb5d(_0x23a5bc);})[_0x490a('0x17')](function(_0x415b38){logger[_0x490a('0x12')](_0x490a('0x18'),_0x415b38['message'],_0x325064);_0x4bbacb(_0x48edea[_0x490a('0x12')](0x1f4,_0x415b38[_0x490a('0x14')]));});});};exports[_0x490a('0x26')]=function(_0x4dfa7f){var _0x3432fe=this;return new Promise(function(_0x437ea9,_0xd9df5c){return db[_0x490a('0x19')][_0x490a('0x27')]({'raw':_0x4dfa7f[_0x490a('0x1b')]?_0x4dfa7f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4dfa7f['options']?_0x4dfa7f[_0x490a('0x1b')][_0x490a('0x1d')]||null:null,'attributes':_0x4dfa7f[_0x490a('0x1b')]?_0x4dfa7f['options']['attributes']||null:null,'include':_0x4dfa7f['options']?_0x4dfa7f[_0x490a('0x1b')][_0x490a('0x20')]?_[_0x490a('0x22')](_0x4dfa7f['options'][_0x490a('0x20')],function(_0x1deeda){return{'model':db[_0x1deeda[_0x490a('0x21')]],'as':_0x1deeda['as'],'attributes':_0x1deeda[_0x490a('0x1e')],'include':_0x1deeda[_0x490a('0x20')]?_['map'](_0x1deeda[_0x490a('0x20')],function(_0xa53717){return{'model':db[_0xa53717[_0x490a('0x21')]],'as':_0xa53717['as'],'attributes':_0xa53717[_0x490a('0x1e')],'include':_0xa53717[_0x490a('0x20')]?_[_0x490a('0x22')](_0xa53717[_0x490a('0x20')],function(_0x2f8031){return{'model':db[_0x2f8031['model']],'as':_0x2f8031['as'],'attributes':_0x2f8031['attributes']};}):[]};}):[]};}):[]:[]})[_0x490a('0x23')](function(_0x30dc0){logger[_0x490a('0x15')](_0x490a('0x26'),_0x4dfa7f);logger['debug']('ShowFaxQueue',_0x4dfa7f,JSON['stringify'](_0x30dc0));_0x437ea9(_0x30dc0);})[_0x490a('0x17')](function(_0x35acb7){logger['error'](_0x490a('0x26'),_0x35acb7['message'],_0x4dfa7f);_0xd9df5c(_0x3432fe[_0x490a('0x12')](0x1f4,_0x35acb7[_0x490a('0x14')]));});});}; \ No newline at end of file +var _0x8015=['raw','attributes','limit','include','model','map','ShowFaxQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options'];(function(_0x100338,_0x5cdbcc){var _0x330d32=function(_0x50c3dc){while(--_0x50c3dc){_0x100338['push'](_0x100338['shift']());}};_0x330d32(++_0x5cdbcc);}(_0x8015,0x17a));var _0x5801=function(_0x13d341,_0x491bfb){_0x13d341=_0x13d341-0x0;var _0x266f68=_0x8015[_0x13d341];return _0x266f68;};'use strict';var _=require(_0x5801('0x0'));var util=require('util');var moment=require(_0x5801('0x1'));var BPromise=require(_0x5801('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5801('0x3'));var db=require(_0x5801('0x4'))['db'];var utils=require(_0x5801('0x5'));var logger=require(_0x5801('0x6'))(_0x5801('0x7'));var config=require(_0x5801('0x8'));var jayson=require(_0x5801('0x9'));var client=jayson[_0x5801('0xa')][_0x5801('0xb')]({'port':0x232a});config[_0x5801('0xc')]=_[_0x5801('0xd')](config[_0x5801('0xc')],{'host':_0x5801('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5801('0xc')]));require(_0x5801('0xf'))['register'](socket);function respondWithRpcPromise(_0x26f407,_0x4f9321,_0x272252){return new BPromise(function(_0x3fb178,_0x55453b){return client['request'](_0x26f407,_0x272252)[_0x5801('0x10')](function(_0x164211){logger[_0x5801('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4f9321,_0x5801('0x12'));logger[_0x5801('0x13')](_0x5801('0x14'),_0x4f9321,_0x5801('0x12'),JSON[_0x5801('0x15')](_0x164211));if(_0x164211[_0x5801('0x16')]){if(_0x164211[_0x5801('0x16')][_0x5801('0x17')]===0x1f4){logger[_0x5801('0x16')](_0x5801('0x18'),_0x4f9321,_0x164211[_0x5801('0x16')]['message']);return _0x55453b(_0x164211[_0x5801('0x16')]['message']);}logger[_0x5801('0x16')](_0x5801('0x18'),_0x4f9321,_0x164211['error'][_0x5801('0x19')]);return _0x3fb178(_0x164211['error']['message']);}else{logger['info'](_0x5801('0x18'),_0x4f9321,_0x5801('0x12'));_0x3fb178(_0x164211[_0x5801('0x1a')][_0x5801('0x19')]);}})[_0x5801('0x1b')](function(_0x142f9f){logger[_0x5801('0x16')](_0x5801('0x18'),_0x4f9321,_0x142f9f);_0x55453b(_0x142f9f);});});}exports[_0x5801('0x1c')]=function(_0x23a41b){var _0x5a6a6f=this;return new Promise(function(_0x24a0bf,_0x1d3284){return db[_0x5801('0x1d')][_0x5801('0x1e')]({'raw':_0x23a41b[_0x5801('0x1f')]?_0x23a41b[_0x5801('0x1f')][_0x5801('0x20')]===undefined?!![]:![]:!![],'where':_0x23a41b[_0x5801('0x1f')]?_0x23a41b[_0x5801('0x1f')]['where']||null:null,'attributes':_0x23a41b[_0x5801('0x1f')]?_0x23a41b['options'][_0x5801('0x21')]||null:null,'limit':_0x23a41b[_0x5801('0x1f')]?_0x23a41b[_0x5801('0x1f')][_0x5801('0x22')]||null:null,'include':_0x23a41b[_0x5801('0x1f')]?_0x23a41b[_0x5801('0x1f')]['include']?_['map'](_0x23a41b[_0x5801('0x1f')][_0x5801('0x23')],function(_0x1d05f8){return{'model':db[_0x1d05f8[_0x5801('0x24')]],'as':_0x1d05f8['as'],'attributes':_0x1d05f8[_0x5801('0x21')],'include':_0x1d05f8[_0x5801('0x23')]?_[_0x5801('0x25')](_0x1d05f8['include'],function(_0x5bd4cd){return{'model':db[_0x5bd4cd['model']],'as':_0x5bd4cd['as'],'attributes':_0x5bd4cd['attributes'],'include':_0x5bd4cd['include']?_[_0x5801('0x25')](_0x5bd4cd['include'],function(_0x453e7c){return{'model':db[_0x453e7c[_0x5801('0x24')]],'as':_0x453e7c['as'],'attributes':_0x453e7c[_0x5801('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5801('0x10')](function(_0x2a8e73){logger['info'](_0x5801('0x1c'),_0x23a41b);logger[_0x5801('0x13')](_0x5801('0x1c'),_0x23a41b,JSON[_0x5801('0x15')](_0x2a8e73));_0x24a0bf(_0x2a8e73);})[_0x5801('0x1b')](function(_0x4ddb0d){logger[_0x5801('0x16')](_0x5801('0x1c'),_0x4ddb0d[_0x5801('0x19')],_0x23a41b);_0x1d3284(_0x5a6a6f[_0x5801('0x16')](0x1f4,_0x4ddb0d['message']));});});};exports[_0x5801('0x26')]=function(_0x21cac3){var _0x27f94e=this;return new Promise(function(_0xcd1df3,_0x1bbe6a){return db[_0x5801('0x1d')][_0x5801('0x27')]({'raw':_0x21cac3[_0x5801('0x1f')]?_0x21cac3[_0x5801('0x1f')][_0x5801('0x20')]===undefined?!![]:![]:!![],'where':_0x21cac3[_0x5801('0x1f')]?_0x21cac3[_0x5801('0x1f')][_0x5801('0x28')]||null:null,'attributes':_0x21cac3[_0x5801('0x1f')]?_0x21cac3[_0x5801('0x1f')][_0x5801('0x21')]||null:null,'include':_0x21cac3[_0x5801('0x1f')]?_0x21cac3[_0x5801('0x1f')]['include']?_[_0x5801('0x25')](_0x21cac3[_0x5801('0x1f')][_0x5801('0x23')],function(_0x1397b2){return{'model':db[_0x1397b2[_0x5801('0x24')]],'as':_0x1397b2['as'],'attributes':_0x1397b2[_0x5801('0x21')],'include':_0x1397b2[_0x5801('0x23')]?_['map'](_0x1397b2[_0x5801('0x23')],function(_0x58ba2f){return{'model':db[_0x58ba2f[_0x5801('0x24')]],'as':_0x58ba2f['as'],'attributes':_0x58ba2f[_0x5801('0x21')],'include':_0x58ba2f[_0x5801('0x23')]?_[_0x5801('0x25')](_0x58ba2f[_0x5801('0x23')],function(_0x52913e){return{'model':db[_0x52913e[_0x5801('0x24')]],'as':_0x52913e['as'],'attributes':_0x52913e[_0x5801('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5801('0x10')](function(_0x4d982a){logger[_0x5801('0x11')]('ShowFaxQueue',_0x21cac3);logger[_0x5801('0x13')](_0x5801('0x26'),_0x21cac3,JSON[_0x5801('0x15')](_0x4d982a));_0xcd1df3(_0x4d982a);})['catch'](function(_0x48e999){logger[_0x5801('0x16')](_0x5801('0x26'),_0x48e999[_0x5801('0x19')],_0x21cac3);_0x1bbe6a(_0x27f94e[_0x5801('0x16')](0x1f4,_0x48e999[_0x5801('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7e929ac..020aac2 100644 --- a/server/api/faxQueue/faxQueue.socket.js +++ b/server/api/faxQueue/faxQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8255=['removeListener','register','length','./faxQueue.events','save','remove','update'];(function(_0x21aefc,_0x1177eb){var _0x53ffe7=function(_0x1e6462){while(--_0x1e6462){_0x21aefc['push'](_0x21aefc['shift']());}};_0x53ffe7(++_0x1177eb);}(_0x8255,0x176));var _0x5825=function(_0x49151a,_0xa5d082){_0x49151a=_0x49151a-0x0;var _0xd7a927=_0x8255[_0x49151a];return _0xd7a927;};'use strict';var FaxQueueEvents=require(_0x5825('0x0'));var events=[_0x5825('0x1'),_0x5825('0x2'),_0x5825('0x3')];function createListener(_0x201689,_0x65c6e){return function(_0x2f0ce0){_0x65c6e['emit'](_0x201689,_0x2f0ce0);};}function removeListener(_0x4d1534,_0x5f2bc3){return function(){FaxQueueEvents[_0x5825('0x4')](_0x4d1534,_0x5f2bc3);};}exports[_0x5825('0x5')]=function(_0x122c90){for(var _0xa8e4d1=0x0,_0x383a49=events[_0x5825('0x6')];_0xa8e4d1<_0x383a49;_0xa8e4d1++){var _0x27d87e=events[_0xa8e4d1];var _0x577974=createListener('faxQueue:'+_0x27d87e,_0x122c90);FaxQueueEvents['on'](_0x27d87e,_0x577974);}}; \ No newline at end of file +var _0xfd66=['length','./faxQueue.events','save','update','emit','removeListener','register'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xfd66,0x71));var _0x6fd6=function(_0x81e944,_0x50a1e2){_0x81e944=_0x81e944-0x0;var _0x17b8e9=_0xfd66[_0x81e944];return _0x17b8e9;};'use strict';var FaxQueueEvents=require(_0x6fd6('0x0'));var events=[_0x6fd6('0x1'),'remove',_0x6fd6('0x2')];function createListener(_0x54e1a1,_0x4312b3){return function(_0x525723){_0x4312b3[_0x6fd6('0x3')](_0x54e1a1,_0x525723);};}function removeListener(_0x56c177,_0x5e35de){return function(){FaxQueueEvents[_0x6fd6('0x4')](_0x56c177,_0x5e35de);};}exports[_0x6fd6('0x5')]=function(_0x723dae){for(var _0x275aae=0x0,_0x472173=events[_0x6fd6('0x6')];_0x275aae<_0x472173;_0x275aae++){var _0x474cb6=events[_0x275aae];var _0x471d83=createListener('faxQueue:'+_0x474cb6,_0x723dae);FaxQueueEvents['on'](_0x474cb6,_0x471d83);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 18e1f59..68b9739 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b0d=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams'];(function(_0x1eae1d,_0x122bc2){var _0x4df950=function(_0x42503c){while(--_0x42503c){_0x1eae1d['push'](_0x1eae1d['shift']());}};_0x4df950(++_0x122bc2);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x1b1428,_0x3215f0){_0x1b1428=_0x1b1428-0x0;var _0x4d3692=_0x9b0d[_0x1b1428];return _0x4d3692;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var fs_extra=require(_0xd9b0('0x4'));var auth=require(_0xd9b0('0x5'));var interaction=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var controller=require('./faxQueue.controller');router[_0xd9b0('0x8')]('/',auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xa')]);router[_0xd9b0('0x8')](_0xd9b0('0xb'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xc')]);router['get'](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['show']);router[_0xd9b0('0x8')]('/:id/members',auth[_0xd9b0('0x9')](),controller['getMembers']);router[_0xd9b0('0x8')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xf')]);router[_0xd9b0('0x8')](_0xd9b0('0x10'),auth['isAuthenticated'](),controller[_0xd9b0('0x11')]);router[_0xd9b0('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9b0('0x13')]);router[_0xd9b0('0x12')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x14')]);router[_0xd9b0('0x12')]('/:id/users',auth[_0xd9b0('0x9')](),controller['addAgents']);router[_0xd9b0('0x15')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x16')]);router[_0xd9b0('0x17')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['destroy']);router[_0xd9b0('0x17')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x18')]);router[_0xd9b0('0x17')](_0xd9b0('0x10'),auth[_0xd9b0('0x9')](),controller['removeAgents']);module[_0xd9b0('0x19')]=router; \ No newline at end of file +var _0xf072=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xf072,0x1cf));var _0x2f07=function(_0x345251,_0x338c8a){_0x345251=_0x345251-0x0;var _0x1aef6d=_0xf072[_0x345251];return _0x1aef6d;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0x8')](_0x2f07('0xf'),auth[_0x2f07('0x9')](),controller['getMembers']);router[_0x2f07('0x8')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router['get']('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x12')]);router['post']('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x13')]);router[_0x2f07('0x14')]('/:id/teams',auth[_0x2f07('0x9')](),controller[_0x2f07('0x15')]);router[_0x2f07('0x14')](_0x2f07('0x16'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x17')]);router['put'](_0x2f07('0xd'),auth['isAuthenticated'](),controller[_0x2f07('0x18')]);router[_0x2f07('0x19')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x1a')]);router[_0x2f07('0x19')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller['removeTeams']);router[_0x2f07('0x19')]('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x1b')]);module[_0x2f07('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 675f630..38900c3 100644 --- a/server/api/faxQueueReport/faxQueueReport.attributes.js +++ b/server/api/faxQueueReport/faxQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2a3=['STRING','DATE','moment'];(function(_0xb1f870,_0x2d0065){var _0x245c0a=function(_0x51ce55){while(--_0x51ce55){_0xb1f870['push'](_0xb1f870['shift']());}};_0x245c0a(++_0x2d0065);}(_0xc2a3,0x131));var _0x3c2a=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0xc2a3[_0x43b08];return _0x5e05f4;};'use strict';var moment=require(_0x3c2a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3c2a('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x3c2a('0x1')]},'joinAt':{'type':Sequelize[_0x3c2a('0x2')]},'leaveAt':{'type':Sequelize[_0x3c2a('0x2')]},'acceptAt':{'type':Sequelize[_0x3c2a('0x2')]},'exitAt':{'type':Sequelize[_0x3c2a('0x2')]},'reason':{'type':Sequelize[_0x3c2a('0x1')]}}; \ No newline at end of file +var _0xe6b8=['exports','STRING','DATE','moment','sequelize'];(function(_0x5e05d1,_0x5b22c7){var _0x2c5909=function(_0x5b9cca){while(--_0x5b9cca){_0x5e05d1['push'](_0x5e05d1['shift']());}};_0x2c5909(++_0x5b22c7);}(_0xe6b8,0x76));var _0x8e6b=function(_0x4b01ec,_0x2c1040){_0x4b01ec=_0x4b01ec-0x0;var _0x4db377=_0xe6b8[_0x4b01ec];return _0x4db377;};'use strict';var moment=require(_0x8e6b('0x0'));var Sequelize=require(_0x8e6b('0x1'));module[_0x8e6b('0x2')]={'uniqueid':{'type':Sequelize[_0x8e6b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8e6b('0x3')]},'joinAt':{'type':Sequelize[_0x8e6b('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8e6b('0x4')]},'exitAt':{'type':Sequelize[_0x8e6b('0x4')]},'reason':{'type':Sequelize[_0x8e6b('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 34fe13a..c579d60 100644 --- a/server/api/faxQueueReport/faxQueueReport.controller.js +++ b/server/api/faxQueueReport/faxQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee3=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xbee3,0xd5));var _0x3bee=function(_0x5dabde,_0x8ac431){_0x5dabde=_0x5dabde-0x0;var _0x2139cf=_0xbee3[_0x5dabde];return _0x2139cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['index']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={},_0x496abd={},_0x1115ed={'count':0x0,'rows':[]};var _0x24d523=_[_0x3bee('0x2b')](db[_0x3bee('0x2c')][_0x3bee('0x2d')],function(_0x559c2b){return{'name':_0x559c2b['fieldName'],'type':_0x559c2b[_0x3bee('0x2e')][_0x3bee('0x2f')]};});_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2b')](_0x24d523,'name');_0x496abd['query']=_[_0x3bee('0x31')](_0x239fa4[_0x3bee('0x32')]);_0x496abd['filters']=_['intersection'](_0x496abd[_0x3bee('0x30')],_0x496abd[_0x3bee('0x32')]);_0x3a3d92[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x496abd[_0x3bee('0x30')],qs[_0x3bee('0x35')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x35')]));_0x3a3d92[_0x3bee('0x33')]=_0x3a3d92[_0x3bee('0x33')]['length']?_0x3a3d92['attributes']:_0x496abd[_0x3bee('0x30')];if(!_0x239fa4['query']['hasOwnProperty'](_0x3bee('0x36'))){_0x3a3d92[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x1d')]);_0x3a3d92[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x239fa4[_0x3bee('0x32')]['offset']);}_0x3a3d92[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x239fa4['query'][_0x3bee('0x38')]);_0x3a3d92[_0x3bee('0x39')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x3b')](_0x239fa4[_0x3bee('0x32')],_0x496abd['filters']),_0x24d523);if(_0x239fa4['query'][_0x3bee('0x3c')]){_0x3a3d92[_0x3bee('0x39')]=_[_0x3bee('0x3d')](_0x3a3d92[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2b')](_0x24d523,function(_0x3d9656){if(_0x3d9656[_0x3bee('0x2e')]!==_0x3bee('0x3e')){var _0x2fb349={};_0x2fb349[_0x3d9656[_0x3bee('0x29')]]={'$like':'%'+_0x239fa4[_0x3bee('0x32')][_0x3bee('0x3c')]+'%'};return _0x2fb349;}})});}_0x3a3d92=_['merge']({},_0x3a3d92,_0x239fa4[_0x3bee('0x3f')]);var _0x1b5eca={'where':_0x3a3d92[_0x3bee('0x39')]};return db[_0x3bee('0x2c')][_0x3bee('0x1c')](_0x1b5eca)[_0x3bee('0x24')](function(_0x1622b9){_0x1115ed[_0x3bee('0x1c')]=_0x1622b9;if(_0x239fa4[_0x3bee('0x32')][_0x3bee('0x40')]){_0x3a3d92[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x2c')][_0x3bee('0x42')](_0x3a3d92);})['then'](function(_0x2b773d){_0x1115ed[_0x3bee('0x43')]=_0x2b773d;return _0x1115ed;})[_0x3bee('0x24')](respondWithFilteredResult(_0xf08fb3,_0x3a3d92))[_0x3bee('0x44')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x45')]=function(_0x44489f,_0x13dd72){var _0xd1140d={'raw':!![],'where':{'id':_0x44489f[_0x3bee('0x46')]['id']}},_0x5d9e1b={};_0x5d9e1b[_0x3bee('0x30')]=_[_0x3bee('0x31')](db['FaxQueueReport'][_0x3bee('0x2d')]);_0x5d9e1b['query']=_[_0x3bee('0x31')](_0x44489f['query']);_0x5d9e1b['filters']=_[_0x3bee('0x34')](_0x5d9e1b[_0x3bee('0x30')],_0x5d9e1b[_0x3bee('0x32')]);_0xd1140d[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x5d9e1b['model'],qs['fields'](_0x44489f[_0x3bee('0x32')]['fields']));_0xd1140d[_0x3bee('0x33')]=_0xd1140d['attributes'][_0x3bee('0x47')]?_0xd1140d['attributes']:_0x5d9e1b[_0x3bee('0x30')];if(_0x44489f[_0x3bee('0x32')][_0x3bee('0x40')]){_0xd1140d[_0x3bee('0x41')]=[{'all':!![]}];}_0xd1140d=_['merge']({},_0xd1140d,_0x44489f['options']);return db[_0x3bee('0x2c')]['find'](_0xd1140d)['then'](handleEntityNotFound(_0x13dd72,null))['then'](respondWithResult(_0x13dd72,null))[_0x3bee('0x44')](handleError(_0x13dd72,null));};exports['create']=function(_0x125fa5,_0x33d615){return db[_0x3bee('0x2c')]['create'](_0x125fa5[_0x3bee('0x48')],{})['then'](respondWithResult(_0x33d615,0xc9))[_0x3bee('0x44')](handleError(_0x33d615,null));};exports['update']=function(_0x26ccd7,_0x16b096){if(_0x26ccd7[_0x3bee('0x48')]['id']){delete _0x26ccd7['body']['id'];}return db[_0x3bee('0x2c')][_0x3bee('0x49')]({'where':{'id':_0x26ccd7[_0x3bee('0x46')]['id']}})['then'](handleEntityNotFound(_0x16b096,null))['then'](saveUpdates(_0x26ccd7[_0x3bee('0x48')],null))[_0x3bee('0x24')](respondWithResult(_0x16b096,null))[_0x3bee('0x44')](handleError(_0x16b096,null));};exports[_0x3bee('0x25')]=function(_0x3b5d7a,_0x21ab40){return db[_0x3bee('0x2c')]['find']({'where':{'id':_0x3b5d7a[_0x3bee('0x46')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x21ab40,null))['then'](removeEntity(_0x21ab40,null))['catch'](handleError(_0x21ab40,null));};exports[_0x3bee('0x4a')]=function(_0x5d4755,_0x1cb54e){return db[_0x3bee('0x2c')][_0x3bee('0x4a')]()['then'](respondWithResult(_0x1cb54e,null))[_0x3bee('0x44')](handleError(_0x1cb54e,null));}; \ No newline at end of file +var _0xf197=['VIRTUAL','includeAll','include','findAll','show','params','keys','rawAttributes','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','error','name','send','map','FaxQueueReport','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf197,0x130));var _0x7f19=function(_0x1937a7,_0x48b408){_0x1937a7=_0x1937a7-0x0;var _0x1f8a14=_0xf197[_0x1937a7];return _0x1f8a14;};'use strict';var emlformat=require(_0x7f19('0x0'));var rimraf=require(_0x7f19('0x1'));var zipdir=require(_0x7f19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7f19('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7f19('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f19('0x5'));var fs=require('fs');var fs_extra=require(_0x7f19('0x6'));var _=require(_0x7f19('0x7'));var squel=require(_0x7f19('0x8'));var crypto=require(_0x7f19('0x9'));var jsforce=require(_0x7f19('0xa'));var deskjs=require(_0x7f19('0xb'));var toCsv=require('to-csv');var querystring=require(_0x7f19('0xc'));var Papa=require(_0x7f19('0xd'));var Redis=require(_0x7f19('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7f19('0xf'));var as=require(_0x7f19('0x10'));var hardwareService=require(_0x7f19('0x11'));var logger=require(_0x7f19('0x12'))('api');var utils=require(_0x7f19('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7f19('0x14'));var db=require(_0x7f19('0x15'))['db'];function respondWithStatusCode(_0x3715f3,_0x580372){_0x580372=_0x580372||0xcc;return function(_0x540723){if(_0x540723){return _0x3715f3[_0x7f19('0x16')](_0x580372);}return _0x3715f3[_0x7f19('0x17')](_0x580372)[_0x7f19('0x18')]();};}function respondWithResult(_0x5b71ec,_0x446f5f){_0x446f5f=_0x446f5f||0xc8;return function(_0x20fe84){if(_0x20fe84){return _0x5b71ec['status'](_0x446f5f)[_0x7f19('0x19')](_0x20fe84);}};}function respondWithFilteredResult(_0x37f5a5,_0x11acd8){return function(_0x5c0b64){if(_0x5c0b64){var _0x3d81d1=typeof _0x11acd8['offset']===_0x7f19('0x1a')&&typeof _0x11acd8[_0x7f19('0x1b')]===_0x7f19('0x1a');var _0x2e2295=_0x5c0b64[_0x7f19('0x1c')];var _0x5c56a1=_0x3d81d1?0x0:_0x11acd8[_0x7f19('0x1d')];var _0x3b38d7=_0x3d81d1?_0x5c0b64[_0x7f19('0x1c')]:_0x11acd8['offset']+_0x11acd8[_0x7f19('0x1b')];var _0x52bcf;if(_0x3b38d7>=_0x2e2295){_0x3b38d7=_0x2e2295;_0x52bcf=0xc8;}else{_0x52bcf=0xce;}_0x37f5a5[_0x7f19('0x17')](_0x52bcf);return _0x37f5a5[_0x7f19('0x1e')]('Content-Range',_0x5c56a1+'-'+_0x3b38d7+'/'+_0x2e2295)[_0x7f19('0x19')](_0x5c0b64);}return null;};}function patchUpdates(_0xb8a760){return function(_0x277000){try{jsonpatch[_0x7f19('0x1f')](_0x277000,_0xb8a760,!![]);}catch(_0x4c3d6c){return BPromise[_0x7f19('0x20')](_0x4c3d6c);}return _0x277000[_0x7f19('0x21')]();};}function saveUpdates(_0x18ea37,_0x5168be){return function(_0x211fe4){if(_0x211fe4){return _0x211fe4['update'](_0x18ea37)[_0x7f19('0x22')](function(_0x33ac16){return _0x33ac16;});}return null;};}function removeEntity(_0x37eecd,_0x34c4fb){return function(_0x1f0ea6){if(_0x1f0ea6){return _0x1f0ea6['destroy']()['then'](function(){_0x37eecd[_0x7f19('0x17')](0xcc)[_0x7f19('0x18')]();});}};}function handleEntityNotFound(_0x4b3649,_0x3eab7f){return function(_0xf07ec5){if(!_0xf07ec5){_0x4b3649[_0x7f19('0x16')](0x194);}return _0xf07ec5;};}function handleError(_0x9d694d,_0x463ad8){_0x463ad8=_0x463ad8||0x1f4;return function(_0x7858fa){logger[_0x7f19('0x23')](_0x7858fa['stack']);if(_0x7858fa[_0x7f19('0x24')]){delete _0x7858fa[_0x7f19('0x24')];}_0x9d694d['status'](_0x463ad8)[_0x7f19('0x25')](_0x7858fa);};}exports['index']=function(_0x1f5aa9,_0x4884fd){var _0x4b8ea1={},_0x1c66cc={},_0x5193e2={'count':0x0,'rows':[]};var _0x3b2d0c=_[_0x7f19('0x26')](db[_0x7f19('0x27')]['rawAttributes'],function(_0x3d15e7){return{'name':_0x3d15e7['fieldName'],'type':_0x3d15e7[_0x7f19('0x28')]['key']};});_0x1c66cc[_0x7f19('0x29')]=_[_0x7f19('0x26')](_0x3b2d0c,_0x7f19('0x24'));_0x1c66cc['query']=_['keys'](_0x1f5aa9[_0x7f19('0x2a')]);_0x1c66cc[_0x7f19('0x2b')]=_[_0x7f19('0x2c')](_0x1c66cc[_0x7f19('0x29')],_0x1c66cc[_0x7f19('0x2a')]);_0x4b8ea1['attributes']=_['intersection'](_0x1c66cc['model'],qs[_0x7f19('0x2d')](_0x1f5aa9[_0x7f19('0x2a')]['fields']));_0x4b8ea1[_0x7f19('0x2e')]=_0x4b8ea1[_0x7f19('0x2e')][_0x7f19('0x2f')]?_0x4b8ea1[_0x7f19('0x2e')]:_0x1c66cc[_0x7f19('0x29')];if(!_0x1f5aa9[_0x7f19('0x2a')][_0x7f19('0x30')](_0x7f19('0x31'))){_0x4b8ea1['limit']=qs['limit'](_0x1f5aa9[_0x7f19('0x2a')][_0x7f19('0x1b')]);_0x4b8ea1[_0x7f19('0x1d')]=qs[_0x7f19('0x1d')](_0x1f5aa9[_0x7f19('0x2a')][_0x7f19('0x1d')]);}_0x4b8ea1[_0x7f19('0x32')]=qs[_0x7f19('0x33')](_0x1f5aa9[_0x7f19('0x2a')]['sort']);_0x4b8ea1[_0x7f19('0x34')]=qs[_0x7f19('0x2b')](_[_0x7f19('0x35')](_0x1f5aa9[_0x7f19('0x2a')],_0x1c66cc['filters']),_0x3b2d0c);if(_0x1f5aa9[_0x7f19('0x2a')][_0x7f19('0x36')]){_0x4b8ea1[_0x7f19('0x34')]=_[_0x7f19('0x37')](_0x4b8ea1['where'],{'$or':_[_0x7f19('0x26')](_0x3b2d0c,function(_0x568f34){if(_0x568f34[_0x7f19('0x28')]!==_0x7f19('0x38')){var _0x5be22c={};_0x5be22c[_0x568f34['name']]={'$like':'%'+_0x1f5aa9[_0x7f19('0x2a')][_0x7f19('0x36')]+'%'};return _0x5be22c;}})});}_0x4b8ea1=_['merge']({},_0x4b8ea1,_0x1f5aa9['options']);var _0x58d972={'where':_0x4b8ea1['where']};return db['FaxQueueReport']['count'](_0x58d972)[_0x7f19('0x22')](function(_0x3afa96){_0x5193e2[_0x7f19('0x1c')]=_0x3afa96;if(_0x1f5aa9['query'][_0x7f19('0x39')]){_0x4b8ea1[_0x7f19('0x3a')]=[{'all':!![]}];}return db[_0x7f19('0x27')][_0x7f19('0x3b')](_0x4b8ea1);})[_0x7f19('0x22')](function(_0x29e758){_0x5193e2['rows']=_0x29e758;return _0x5193e2;})[_0x7f19('0x22')](respondWithFilteredResult(_0x4884fd,_0x4b8ea1))['catch'](handleError(_0x4884fd,null));};exports[_0x7f19('0x3c')]=function(_0x3fa297,_0x1f467b){var _0x524347={'raw':!![],'where':{'id':_0x3fa297[_0x7f19('0x3d')]['id']}},_0x3e3445={};_0x3e3445[_0x7f19('0x29')]=_[_0x7f19('0x3e')](db[_0x7f19('0x27')][_0x7f19('0x3f')]);_0x3e3445[_0x7f19('0x2a')]=_['keys'](_0x3fa297[_0x7f19('0x2a')]);_0x3e3445['filters']=_[_0x7f19('0x2c')](_0x3e3445[_0x7f19('0x29')],_0x3e3445[_0x7f19('0x2a')]);_0x524347[_0x7f19('0x2e')]=_[_0x7f19('0x2c')](_0x3e3445[_0x7f19('0x29')],qs[_0x7f19('0x2d')](_0x3fa297[_0x7f19('0x2a')][_0x7f19('0x2d')]));_0x524347[_0x7f19('0x2e')]=_0x524347['attributes'][_0x7f19('0x2f')]?_0x524347[_0x7f19('0x2e')]:_0x3e3445['model'];if(_0x3fa297[_0x7f19('0x2a')][_0x7f19('0x39')]){_0x524347[_0x7f19('0x3a')]=[{'all':!![]}];}_0x524347=_[_0x7f19('0x37')]({},_0x524347,_0x3fa297[_0x7f19('0x40')]);return db[_0x7f19('0x27')][_0x7f19('0x41')](_0x524347)[_0x7f19('0x22')](handleEntityNotFound(_0x1f467b,null))[_0x7f19('0x22')](respondWithResult(_0x1f467b,null))[_0x7f19('0x42')](handleError(_0x1f467b,null));};exports[_0x7f19('0x43')]=function(_0x1cf585,_0x25a303){return db[_0x7f19('0x27')][_0x7f19('0x43')](_0x1cf585[_0x7f19('0x44')],{})[_0x7f19('0x22')](respondWithResult(_0x25a303,0xc9))[_0x7f19('0x42')](handleError(_0x25a303,null));};exports[_0x7f19('0x45')]=function(_0x49766c,_0x247234){if(_0x49766c[_0x7f19('0x44')]['id']){delete _0x49766c[_0x7f19('0x44')]['id'];}return db[_0x7f19('0x27')]['find']({'where':{'id':_0x49766c['params']['id']}})[_0x7f19('0x22')](handleEntityNotFound(_0x247234,null))[_0x7f19('0x22')](saveUpdates(_0x49766c['body'],null))['then'](respondWithResult(_0x247234,null))[_0x7f19('0x42')](handleError(_0x247234,null));};exports[_0x7f19('0x46')]=function(_0x49c18b,_0x3091c8){return db[_0x7f19('0x27')][_0x7f19('0x41')]({'where':{'id':_0x49c18b[_0x7f19('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3091c8,null))['then'](removeEntity(_0x3091c8,null))[_0x7f19('0x42')](handleError(_0x3091c8,null));};exports[_0x7f19('0x47')]=function(_0x3cd4c1,_0x1d35ed){return db[_0x7f19('0x27')][_0x7f19('0x47')]()[_0x7f19('0x22')](respondWithResult(_0x1d35ed,null))[_0x7f19('0x42')](handleError(_0x1d35ed,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 46fd907..6502363 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x1cb9,0x14e));var _0x91cb=function(_0x52bcff,_0x55d76a){_0x52bcff=_0x52bcff-0x0;var _0x2081cb=_0x1cb9[_0x52bcff];return _0x2081cb;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x293e8c,_0x4f912c){var _0x751aeb=function(_0xdbe407){while(--_0xdbe407){_0x293e8c['push'](_0x293e8c['shift']());}};_0x751aeb(++_0x4f912c);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x14c8ee,_0x34d4fb){_0x14c8ee=_0x14c8ee-0x0;var _0x51acc2=_0x7fbe[_0x14c8ee];return _0x51acc2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1602d5a..8f93185 100644 --- a/server/api/faxQueueReport/faxQueueReport.rpc.js +++ b/server/api/faxQueueReport/faxQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacfb=['catch','CreateFaxQueueReport','FaxQueueReport','create','raw','UpdateFaxQueueReport','body','options','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4a8a5d,_0x389853){var _0x2876b0=function(_0xd32d0d){while(--_0xd32d0d){_0x4a8a5d['push'](_0x4a8a5d['shift']());}};_0x2876b0(++_0x389853);}(_0xacfb,0x112));var _0xbacf=function(_0x59c1ad,_0x4f845e){_0x59c1ad=_0x59c1ad-0x0;var _0x30d22a=_0xacfb[_0x59c1ad];return _0x30d22a;};'use strict';var _=require(_0xbacf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbacf('0x1'));var rs=require(_0xbacf('0x2'));var fs=require('fs');var Redis=require(_0xbacf('0x3'));var db=require(_0xbacf('0x4'))['db'];var utils=require(_0xbacf('0x5'));var logger=require(_0xbacf('0x6'))(_0xbacf('0x7'));var config=require(_0xbacf('0x8'));var jayson=require(_0xbacf('0x9'));var client=jayson[_0xbacf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4151f0,_0x5f33d8,_0x62af29){return new BPromise(function(_0x43a7c7,_0x390786){return client[_0xbacf('0xb')](_0x4151f0,_0x62af29)[_0xbacf('0xc')](function(_0x3aa5a1){logger[_0xbacf('0xd')](_0xbacf('0xe'),_0x5f33d8,_0xbacf('0xf'));logger[_0xbacf('0x10')](_0xbacf('0x11'),_0x5f33d8,_0xbacf('0xf'),JSON[_0xbacf('0x12')](_0x3aa5a1));if(_0x3aa5a1[_0xbacf('0x13')]){if(_0x3aa5a1['error'][_0xbacf('0x14')]===0x1f4){logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);return _0x390786(_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);}logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x3aa5a1[_0xbacf('0x13')][_0xbacf('0x15')]);return _0x43a7c7(_0x3aa5a1['error'][_0xbacf('0x15')]);}else{logger['info'](_0xbacf('0xe'),_0x5f33d8,_0xbacf('0xf'));_0x43a7c7(_0x3aa5a1[_0xbacf('0x16')]['message']);}})[_0xbacf('0x17')](function(_0x1844c9){logger[_0xbacf('0x13')](_0xbacf('0xe'),_0x5f33d8,_0x1844c9);_0x390786(_0x1844c9);});});}exports[_0xbacf('0x18')]=function(_0x833310){var _0x18786b=this;return new Promise(function(_0xdfa65f,_0x4d10bf){return db[_0xbacf('0x19')][_0xbacf('0x1a')](_0x833310['body'],{'raw':_0x833310['options']?_0x833310['options'][_0xbacf('0x1b')]===undefined?!![]:![]:!![]})[_0xbacf('0xc')](function(_0x1abce2){logger[_0xbacf('0xd')]('CreateFaxQueueReport',_0x833310);logger[_0xbacf('0x10')](_0xbacf('0x18'),_0x833310,JSON[_0xbacf('0x12')](_0x1abce2));_0xdfa65f(_0x1abce2);})[_0xbacf('0x17')](function(_0x161b84){logger[_0xbacf('0x13')](_0xbacf('0x18'),_0x161b84[_0xbacf('0x15')],_0x833310);_0x4d10bf(_0x18786b[_0xbacf('0x13')](0x1f4,_0x161b84['message']));});});};exports[_0xbacf('0x1c')]=function(_0xb4d6c5){var _0x1f8ac0=this;return new Promise(function(_0x32100f,_0x320b19){return db[_0xbacf('0x19')]['update'](_0xb4d6c5[_0xbacf('0x1d')],{'raw':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')]['where']||null:null,'attributes':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')][_0xbacf('0x1f')]||null:null,'limit':_0xb4d6c5[_0xbacf('0x1e')]?_0xb4d6c5[_0xbacf('0x1e')][_0xbacf('0x20')]||null:null})[_0xbacf('0xc')](function(_0x36b767){logger['info'](_0xbacf('0x1c'),_0xb4d6c5);logger[_0xbacf('0x10')](_0xbacf('0x1c'),_0xb4d6c5,JSON[_0xbacf('0x12')](_0x36b767));_0x32100f(_0x36b767);})[_0xbacf('0x17')](function(_0x286983){logger[_0xbacf('0x13')](_0xbacf('0x1c'),_0x286983[_0xbacf('0x15')],_0xb4d6c5);_0x320b19(_0x1f8ac0[_0xbacf('0x13')](0x1f4,_0x286983['message']));});});}; \ No newline at end of file +var _0x0dca=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','info','UpdateFaxQueueReport','update','raw','where','limit','moment','bluebird','randomstring','ioredis'];(function(_0x192058,_0x4baaae){var _0x321d28=function(_0x136b31){while(--_0x136b31){_0x192058['push'](_0x192058['shift']());}};_0x321d28(++_0x4baaae);}(_0x0dca,0x13c));var _0xa0dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0dca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0dc('0x0'));var BPromise=require(_0xa0dc('0x1'));var rs=require(_0xa0dc('0x2'));var fs=require('fs');var Redis=require(_0xa0dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0dc('0x4'));var logger=require(_0xa0dc('0x5'))(_0xa0dc('0x6'));var config=require(_0xa0dc('0x7'));var jayson=require(_0xa0dc('0x8'));var client=jayson[_0xa0dc('0x9')][_0xa0dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525642,_0x3c9169,_0x58bd45){return new BPromise(function(_0x275962,_0x54beaa){return client[_0xa0dc('0xb')](_0x525642,_0x58bd45)[_0xa0dc('0xc')](function(_0x4bb66d){logger['info'](_0xa0dc('0xd'),_0x3c9169,_0xa0dc('0xe'));logger[_0xa0dc('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x3c9169,_0xa0dc('0xe'),JSON[_0xa0dc('0x10')](_0x4bb66d));if(_0x4bb66d[_0xa0dc('0x11')]){if(_0x4bb66d[_0xa0dc('0x11')][_0xa0dc('0x12')]===0x1f4){logger[_0xa0dc('0x11')](_0xa0dc('0xd'),_0x3c9169,_0x4bb66d[_0xa0dc('0x11')][_0xa0dc('0x13')]);return _0x54beaa(_0x4bb66d[_0xa0dc('0x11')]['message']);}logger[_0xa0dc('0x11')](_0xa0dc('0xd'),_0x3c9169,_0x4bb66d[_0xa0dc('0x11')][_0xa0dc('0x13')]);return _0x275962(_0x4bb66d[_0xa0dc('0x11')][_0xa0dc('0x13')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3c9169,_0xa0dc('0xe'));_0x275962(_0x4bb66d[_0xa0dc('0x14')][_0xa0dc('0x13')]);}})[_0xa0dc('0x15')](function(_0x27ac09){logger['error'](_0xa0dc('0xd'),_0x3c9169,_0x27ac09);_0x54beaa(_0x27ac09);});});}exports[_0xa0dc('0x16')]=function(_0x91a3f0){var _0x55fc59=this;return new Promise(function(_0x1a3146,_0xdc1295){return db[_0xa0dc('0x17')]['create'](_0x91a3f0[_0xa0dc('0x18')],{'raw':_0x91a3f0[_0xa0dc('0x19')]?_0x91a3f0[_0xa0dc('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa0dc('0xc')](function(_0x71bad7){logger[_0xa0dc('0x1a')](_0xa0dc('0x16'),_0x91a3f0);logger['debug'](_0xa0dc('0x16'),_0x91a3f0,JSON[_0xa0dc('0x10')](_0x71bad7));_0x1a3146(_0x71bad7);})[_0xa0dc('0x15')](function(_0x272341){logger['error']('CreateFaxQueueReport',_0x272341['message'],_0x91a3f0);_0xdc1295(_0x55fc59[_0xa0dc('0x11')](0x1f4,_0x272341['message']));});});};exports[_0xa0dc('0x1b')]=function(_0x46c662){var _0x48a7b5=this;return new Promise(function(_0x22abbf,_0x2cfd64){return db['FaxQueueReport'][_0xa0dc('0x1c')](_0x46c662[_0xa0dc('0x18')],{'raw':_0x46c662[_0xa0dc('0x19')]?_0x46c662[_0xa0dc('0x19')][_0xa0dc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c662[_0xa0dc('0x19')]?_0x46c662[_0xa0dc('0x19')][_0xa0dc('0x1e')]||null:null,'attributes':_0x46c662['options']?_0x46c662[_0xa0dc('0x19')]['attributes']||null:null,'limit':_0x46c662[_0xa0dc('0x19')]?_0x46c662[_0xa0dc('0x19')][_0xa0dc('0x1f')]||null:null})['then'](function(_0xfb6145){logger[_0xa0dc('0x1a')]('UpdateFaxQueueReport',_0x46c662);logger['debug'](_0xa0dc('0x1b'),_0x46c662,JSON[_0xa0dc('0x10')](_0xfb6145));_0x22abbf(_0xfb6145);})['catch'](function(_0x5d72f9){logger[_0xa0dc('0x11')](_0xa0dc('0x1b'),_0x5d72f9[_0xa0dc('0x13')],_0x46c662);_0x2cfd64(_0x48a7b5[_0xa0dc('0x11')](0x1f4,_0x5d72f9[_0xa0dc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f48a0a3..d0f5984 100644 --- a/server/api/faxQueueReport/index.js +++ b/server/api/faxQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8208=['isAuthenticated','index','/describe','/:id','show','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x9d14e3,_0x5a6072){var _0x19bf32=function(_0x19da07){while(--_0x19da07){_0x9d14e3['push'](_0x9d14e3['shift']());}};_0x19bf32(++_0x5a6072);}(_0x8208,0x125));var _0x8820=function(_0x73bc57,_0x17d046){_0x73bc57=_0x73bc57-0x0;var _0x244fae=_0x8208[_0x73bc57];return _0x244fae;};'use strict';var multer=require(_0x8820('0x0'));var util=require(_0x8820('0x1'));var path=require(_0x8820('0x2'));var timeout=require('connect-timeout');var express=require(_0x8820('0x3'));var router=express[_0x8820('0x4')]();var fs_extra=require(_0x8820('0x5'));var auth=require(_0x8820('0x6'));var interaction=require(_0x8820('0x7'));var config=require(_0x8820('0x8'));var controller=require(_0x8820('0x9'));router[_0x8820('0xa')]('/',auth[_0x8820('0xb')](),controller[_0x8820('0xc')]);router[_0x8820('0xa')](_0x8820('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x8820('0xa')](_0x8820('0xe'),auth['isAuthenticated'](),controller[_0x8820('0xf')]);router['post']('/',auth[_0x8820('0xb')](),controller['create']);router[_0x8820('0x10')](_0x8820('0xe'),auth['isAuthenticated'](),controller[_0x8820('0x11')]);router['delete'](_0x8820('0xe'),auth[_0x8820('0xb')](),controller[_0x8820('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe05b=['/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x2c19fd,_0x4f6af7){var _0xfd55fa=function(_0x2b3c63){while(--_0x2b3c63){_0x2c19fd['push'](_0x2c19fd['shift']());}};_0xfd55fa(++_0x4f6af7);}(_0xe05b,0x1d6));var _0xbe05=function(_0xf2554e,_0x1d867b){_0xf2554e=_0xf2554e-0x0;var _0xb321ad=_0xe05b[_0xf2554e];return _0xb321ad;};'use strict';var multer=require('multer');var util=require(_0xbe05('0x0'));var path=require(_0xbe05('0x1'));var timeout=require(_0xbe05('0x2'));var express=require(_0xbe05('0x3'));var router=express[_0xbe05('0x4')]();var fs_extra=require(_0xbe05('0x5'));var auth=require(_0xbe05('0x6'));var interaction=require(_0xbe05('0x7'));var config=require(_0xbe05('0x8'));var controller=require(_0xbe05('0x9'));router[_0xbe05('0xa')]('/',auth[_0xbe05('0xb')](),controller[_0xbe05('0xc')]);router[_0xbe05('0xa')](_0xbe05('0xd'),auth[_0xbe05('0xb')](),controller[_0xbe05('0xe')]);router[_0xbe05('0xa')](_0xbe05('0xf'),auth[_0xbe05('0xb')](),controller[_0xbe05('0x10')]);router[_0xbe05('0x11')]('/',auth['isAuthenticated'](),controller[_0xbe05('0x12')]);router[_0xbe05('0x13')](_0xbe05('0xf'),auth[_0xbe05('0xb')](),controller[_0xbe05('0x14')]);router['delete']('/:id',auth[_0xbe05('0xb')](),controller[_0xbe05('0x15')]);module[_0xbe05('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 9db04f8..4abff13 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x523c39,_0x349b7b){var _0x4d2065=function(_0x3f3671){while(--_0x3f3671){_0x523c39['push'](_0x523c39['shift']());}};_0x4d2065(++_0x349b7b);}(_0xedd9,0xfc));var _0x9edd=function(_0x47699a,_0x5d0fbc){_0x47699a=_0x47699a-0x0;var _0x4def9e=_0xedd9[_0x47699a];return _0x4def9e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xb43b,0x1b2));var _0xbb43=function(_0x135a63,_0x5bda42){_0x135a63=_0x135a63-0x0;var _0x112905=_0xb43b[_0x135a63];return _0x112905;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2009fc4..b8e4fa7 100644 --- a/server/api/faxTransferReport/faxTransferReport.controller.js +++ b/server/api/faxTransferReport/faxTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb727=['../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','map','merge','options','includeAll','include','rows','catch','params','body','find','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x667521,_0x43845b){var _0x44323a=function(_0x324618){while(--_0x324618){_0x667521['push'](_0x667521['shift']());}};_0x44323a(++_0x43845b);}(_0xb727,0x78));var _0x7b72=function(_0x235345,_0x12910f){_0x235345=_0x235345-0x0;var _0xfc05b4=_0xb727[_0x235345];return _0xfc05b4;};'use strict';var emlformat=require(_0x7b72('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b72('0x1'));var rp=require(_0x7b72('0x2'));var moment=require('moment');var BPromise=require(_0x7b72('0x3'));var Mustache=require(_0x7b72('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7b72('0x5'));var csv=require(_0x7b72('0x6'));var ejs=require(_0x7b72('0x7'));var fs=require('fs');var fs_extra=require(_0x7b72('0x8'));var _=require(_0x7b72('0x9'));var squel=require(_0x7b72('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b72('0xb'));var Redis=require('ioredis');var authService=require(_0x7b72('0xc'));var qs=require(_0x7b72('0xd'));var as=require(_0x7b72('0xe'));var hardwareService=require(_0x7b72('0xf'));var logger=require('../../config/logger')(_0x7b72('0x10'));var utils=require(_0x7b72('0x11'));var config=require(_0x7b72('0x12'));var licenseUtil=require(_0x7b72('0x13'));var db=require(_0x7b72('0x14'))['db'];function respondWithStatusCode(_0x4e0ad7,_0x291e9c){_0x291e9c=_0x291e9c||0xcc;return function(_0x4515e4){if(_0x4515e4){return _0x4e0ad7[_0x7b72('0x15')](_0x291e9c);}return _0x4e0ad7['status'](_0x291e9c)['end']();};}function respondWithResult(_0x4fc8f4,_0x1d0730){_0x1d0730=_0x1d0730||0xc8;return function(_0x457f81){if(_0x457f81){return _0x4fc8f4['status'](_0x1d0730)[_0x7b72('0x16')](_0x457f81);}};}function respondWithFilteredResult(_0x339755,_0x364fdd){return function(_0x1640b9){if(_0x1640b9){var _0x5f420c=typeof _0x364fdd[_0x7b72('0x17')]===_0x7b72('0x18')&&typeof _0x364fdd[_0x7b72('0x19')]===_0x7b72('0x18');var _0x26c73d=_0x1640b9[_0x7b72('0x1a')];var _0x1c173e=_0x5f420c?0x0:_0x364fdd[_0x7b72('0x17')];var _0x472396=_0x5f420c?_0x1640b9['count']:_0x364fdd[_0x7b72('0x17')]+_0x364fdd['limit'];var _0x351944;if(_0x472396>=_0x26c73d){_0x472396=_0x26c73d;_0x351944=0xc8;}else{_0x351944=0xce;}_0x339755[_0x7b72('0x1b')](_0x351944);return _0x339755[_0x7b72('0x1c')](_0x7b72('0x1d'),_0x1c173e+'-'+_0x472396+'/'+_0x26c73d)['json'](_0x1640b9);}return null;};}function patchUpdates(_0x3e011b){return function(_0x70fd02){try{jsonpatch[_0x7b72('0x1e')](_0x70fd02,_0x3e011b,!![]);}catch(_0x3928ce){return BPromise[_0x7b72('0x1f')](_0x3928ce);}return _0x70fd02[_0x7b72('0x20')]();};}function saveUpdates(_0x233f53,_0x21da54){return function(_0x9f09a7){if(_0x9f09a7){return _0x9f09a7[_0x7b72('0x21')](_0x233f53)[_0x7b72('0x22')](function(_0x444099){return _0x444099;});}return null;};}function removeEntity(_0x34996c,_0x52ee3f){return function(_0x3af133){if(_0x3af133){return _0x3af133[_0x7b72('0x23')]()[_0x7b72('0x22')](function(){_0x34996c['status'](0xcc)[_0x7b72('0x24')]();});}};}function handleEntityNotFound(_0xa565c6,_0x2d6817){return function(_0x31280c){if(!_0x31280c){_0xa565c6[_0x7b72('0x15')](0x194);}return _0x31280c;};}function handleError(_0x5e309a,_0x281ad6){_0x281ad6=_0x281ad6||0x1f4;return function(_0x1dd566){logger['error'](_0x1dd566[_0x7b72('0x25')]);if(_0x1dd566[_0x7b72('0x26')]){delete _0x1dd566[_0x7b72('0x26')];}_0x5e309a[_0x7b72('0x1b')](_0x281ad6)[_0x7b72('0x27')](_0x1dd566);};}exports[_0x7b72('0x28')]=function(_0x3b7170,_0x3df7f4){var _0x1e3b7e={},_0x4faaf8={},_0xc64864={'count':0x0,'rows':[]};var _0x4d38b3=_['map'](db[_0x7b72('0x29')][_0x7b72('0x2a')],function(_0x257880){return{'name':_0x257880[_0x7b72('0x2b')],'type':_0x257880[_0x7b72('0x2c')][_0x7b72('0x2d')]};});_0x4faaf8[_0x7b72('0x2e')]=_['map'](_0x4d38b3,_0x7b72('0x26'));_0x4faaf8[_0x7b72('0x2f')]=_[_0x7b72('0x30')](_0x3b7170['query']);_0x4faaf8[_0x7b72('0x31')]=_['intersection'](_0x4faaf8[_0x7b72('0x2e')],_0x4faaf8[_0x7b72('0x2f')]);_0x1e3b7e[_0x7b72('0x32')]=_[_0x7b72('0x33')](_0x4faaf8[_0x7b72('0x2e')],qs[_0x7b72('0x34')](_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x34')]));_0x1e3b7e['attributes']=_0x1e3b7e['attributes']['length']?_0x1e3b7e[_0x7b72('0x32')]:_0x4faaf8['model'];if(!_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x35')](_0x7b72('0x36'))){_0x1e3b7e[_0x7b72('0x19')]=qs[_0x7b72('0x19')](_0x3b7170[_0x7b72('0x2f')]['limit']);_0x1e3b7e[_0x7b72('0x17')]=qs['offset'](_0x3b7170['query'][_0x7b72('0x17')]);}_0x1e3b7e[_0x7b72('0x37')]=qs['sort'](_0x3b7170[_0x7b72('0x2f')]['sort']);_0x1e3b7e[_0x7b72('0x38')]=qs['filters'](_[_0x7b72('0x39')](_0x3b7170['query'],_0x4faaf8[_0x7b72('0x31')]),_0x4d38b3);if(_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x3a')]){_0x1e3b7e[_0x7b72('0x38')]=_['merge'](_0x1e3b7e[_0x7b72('0x38')],{'$or':_[_0x7b72('0x3b')](_0x4d38b3,function(_0x70a5ea){if(_0x70a5ea[_0x7b72('0x2c')]!=='VIRTUAL'){var _0x54123f={};_0x54123f[_0x70a5ea[_0x7b72('0x26')]]={'$like':'%'+_0x3b7170[_0x7b72('0x2f')][_0x7b72('0x3a')]+'%'};return _0x54123f;}})});}_0x1e3b7e=_[_0x7b72('0x3c')]({},_0x1e3b7e,_0x3b7170[_0x7b72('0x3d')]);var _0x2e4df6={'where':_0x1e3b7e[_0x7b72('0x38')]};return db['FaxTransferReport'][_0x7b72('0x1a')](_0x2e4df6)[_0x7b72('0x22')](function(_0x15a9ba){_0xc64864['count']=_0x15a9ba;if(_0x3b7170['query'][_0x7b72('0x3e')]){_0x1e3b7e[_0x7b72('0x3f')]=[{'all':!![]}];}return db[_0x7b72('0x29')]['findAll'](_0x1e3b7e);})[_0x7b72('0x22')](function(_0x294a24){_0xc64864[_0x7b72('0x40')]=_0x294a24;return _0xc64864;})[_0x7b72('0x22')](respondWithFilteredResult(_0x3df7f4,_0x1e3b7e))[_0x7b72('0x41')](handleError(_0x3df7f4,null));};exports['show']=function(_0x27e307,_0xe60c38){var _0x4c175a={'raw':!![],'where':{'id':_0x27e307[_0x7b72('0x42')]['id']}},_0x17131b={};_0x17131b['model']=_[_0x7b72('0x30')](db[_0x7b72('0x29')]['rawAttributes']);_0x17131b[_0x7b72('0x2f')]=_[_0x7b72('0x30')](_0x27e307[_0x7b72('0x2f')]);_0x17131b[_0x7b72('0x31')]=_[_0x7b72('0x33')](_0x17131b[_0x7b72('0x2e')],_0x17131b[_0x7b72('0x2f')]);_0x4c175a[_0x7b72('0x32')]=_[_0x7b72('0x33')](_0x17131b[_0x7b72('0x2e')],qs[_0x7b72('0x34')](_0x27e307[_0x7b72('0x2f')]['fields']));_0x4c175a[_0x7b72('0x32')]=_0x4c175a[_0x7b72('0x32')]['length']?_0x4c175a[_0x7b72('0x32')]:_0x17131b[_0x7b72('0x2e')];if(_0x27e307[_0x7b72('0x2f')][_0x7b72('0x3e')]){_0x4c175a[_0x7b72('0x3f')]=[{'all':!![]}];}_0x4c175a=_['merge']({},_0x4c175a,_0x27e307[_0x7b72('0x3d')]);return db['FaxTransferReport']['find'](_0x4c175a)[_0x7b72('0x22')](handleEntityNotFound(_0xe60c38,null))[_0x7b72('0x22')](respondWithResult(_0xe60c38,null))[_0x7b72('0x41')](handleError(_0xe60c38,null));};exports['create']=function(_0x317b8a,_0x5307bf){return db[_0x7b72('0x29')]['create'](_0x317b8a[_0x7b72('0x43')],{})[_0x7b72('0x22')](respondWithResult(_0x5307bf,0xc9))['catch'](handleError(_0x5307bf,null));};exports[_0x7b72('0x21')]=function(_0x5b6eec,_0x42867f){if(_0x5b6eec['body']['id']){delete _0x5b6eec[_0x7b72('0x43')]['id'];}return db[_0x7b72('0x29')]['find']({'where':{'id':_0x5b6eec[_0x7b72('0x42')]['id']}})[_0x7b72('0x22')](handleEntityNotFound(_0x42867f,null))[_0x7b72('0x22')](saveUpdates(_0x5b6eec['body'],null))[_0x7b72('0x22')](respondWithResult(_0x42867f,null))[_0x7b72('0x41')](handleError(_0x42867f,null));};exports['destroy']=function(_0x29e2aa,_0x3db243){return db[_0x7b72('0x29')][_0x7b72('0x44')]({'where':{'id':_0x29e2aa[_0x7b72('0x42')]['id']}})[_0x7b72('0x22')](handleEntityNotFound(_0x3db243,null))[_0x7b72('0x22')](removeEntity(_0x3db243,null))[_0x7b72('0x41')](handleError(_0x3db243,null));};exports[_0x7b72('0x45')]=function(_0x1de6d3,_0x35b53c){return db[_0x7b72('0x29')]['describe']()[_0x7b72('0x22')](respondWithResult(_0x35b53c,null))[_0x7b72('0x41')](handleError(_0x35b53c,null));}; \ No newline at end of file +var _0xb338=['send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','apply','reject','save','update','then','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb338,0x196));var _0x8b33=function(_0x1410a9,_0x2d4289){_0x1410a9=_0x1410a9-0x0;var _0x43339d=_0xb338[_0x1410a9];return _0x43339d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b33('0x0'));var zipdir=require(_0x8b33('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b33('0x2'));var moment=require(_0x8b33('0x3'));var BPromise=require(_0x8b33('0x4'));var Mustache=require(_0x8b33('0x5'));var util=require('util');var path=require(_0x8b33('0x6'));var sox=require(_0x8b33('0x7'));var csv=require('to-csv');var ejs=require(_0x8b33('0x8'));var fs=require('fs');var fs_extra=require(_0x8b33('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8b33('0xa'));var jsforce=require(_0x8b33('0xb'));var deskjs=require(_0x8b33('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8b33('0xd'));var Papa=require(_0x8b33('0xe'));var Redis=require(_0x8b33('0xf'));var authService=require(_0x8b33('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b33('0x11'));var logger=require(_0x8b33('0x12'))(_0x8b33('0x13'));var utils=require(_0x8b33('0x14'));var config=require(_0x8b33('0x15'));var licenseUtil=require(_0x8b33('0x16'));var db=require(_0x8b33('0x17'))['db'];function respondWithStatusCode(_0x1fc3bc,_0x25cf29){_0x25cf29=_0x25cf29||0xcc;return function(_0x146f4f){if(_0x146f4f){return _0x1fc3bc[_0x8b33('0x18')](_0x25cf29);}return _0x1fc3bc[_0x8b33('0x19')](_0x25cf29)[_0x8b33('0x1a')]();};}function respondWithResult(_0x12856e,_0x38d935){_0x38d935=_0x38d935||0xc8;return function(_0x2c3fc0){if(_0x2c3fc0){return _0x12856e['status'](_0x38d935)[_0x8b33('0x1b')](_0x2c3fc0);}};}function respondWithFilteredResult(_0x342d46,_0xbd6c8d){return function(_0x476291){if(_0x476291){var _0x36b3c4=typeof _0xbd6c8d['offset']==='undefined'&&typeof _0xbd6c8d[_0x8b33('0x1c')]===_0x8b33('0x1d');var _0x1d9c96=_0x476291['count'];var _0x4d4a53=_0x36b3c4?0x0:_0xbd6c8d[_0x8b33('0x1e')];var _0x5f2c03=_0x36b3c4?_0x476291[_0x8b33('0x1f')]:_0xbd6c8d[_0x8b33('0x1e')]+_0xbd6c8d[_0x8b33('0x1c')];var _0x24d9aa;if(_0x5f2c03>=_0x1d9c96){_0x5f2c03=_0x1d9c96;_0x24d9aa=0xc8;}else{_0x24d9aa=0xce;}_0x342d46[_0x8b33('0x19')](_0x24d9aa);return _0x342d46['set']('Content-Range',_0x4d4a53+'-'+_0x5f2c03+'/'+_0x1d9c96)[_0x8b33('0x1b')](_0x476291);}return null;};}function patchUpdates(_0x53492c){return function(_0x3e3194){try{jsonpatch[_0x8b33('0x20')](_0x3e3194,_0x53492c,!![]);}catch(_0x36c7e3){return BPromise[_0x8b33('0x21')](_0x36c7e3);}return _0x3e3194[_0x8b33('0x22')]();};}function saveUpdates(_0x3edcf7,_0x196b9b){return function(_0x14b1e2){if(_0x14b1e2){return _0x14b1e2[_0x8b33('0x23')](_0x3edcf7)[_0x8b33('0x24')](function(_0x4da4c6){return _0x4da4c6;});}return null;};}function removeEntity(_0x340882,_0x4f7a39){return function(_0x2e4095){if(_0x2e4095){return _0x2e4095['destroy']()[_0x8b33('0x24')](function(){_0x340882[_0x8b33('0x19')](0xcc)[_0x8b33('0x1a')]();});}};}function handleEntityNotFound(_0x297ba0,_0x19a23a){return function(_0x59e761){if(!_0x59e761){_0x297ba0[_0x8b33('0x18')](0x194);}return _0x59e761;};}function handleError(_0x1b7803,_0x23d105){_0x23d105=_0x23d105||0x1f4;return function(_0x8e915){logger['error'](_0x8e915['stack']);if(_0x8e915[_0x8b33('0x25')]){delete _0x8e915['name'];}_0x1b7803[_0x8b33('0x19')](_0x23d105)[_0x8b33('0x26')](_0x8e915);};}exports[_0x8b33('0x27')]=function(_0x20fa22,_0x42fe31){var _0x27f15d={},_0x2911ce={},_0x3fd655={'count':0x0,'rows':[]};var _0x2f0d57=_[_0x8b33('0x28')](db[_0x8b33('0x29')][_0x8b33('0x2a')],function(_0x14111e){return{'name':_0x14111e[_0x8b33('0x2b')],'type':_0x14111e['type'][_0x8b33('0x2c')]};});_0x2911ce[_0x8b33('0x2d')]=_[_0x8b33('0x28')](_0x2f0d57,_0x8b33('0x25'));_0x2911ce[_0x8b33('0x2e')]=_[_0x8b33('0x2f')](_0x20fa22[_0x8b33('0x2e')]);_0x2911ce['filters']=_[_0x8b33('0x30')](_0x2911ce['model'],_0x2911ce[_0x8b33('0x2e')]);_0x27f15d[_0x8b33('0x31')]=_['intersection'](_0x2911ce[_0x8b33('0x2d')],qs[_0x8b33('0x32')](_0x20fa22[_0x8b33('0x2e')][_0x8b33('0x32')]));_0x27f15d['attributes']=_0x27f15d[_0x8b33('0x31')]['length']?_0x27f15d[_0x8b33('0x31')]:_0x2911ce[_0x8b33('0x2d')];if(!_0x20fa22[_0x8b33('0x2e')][_0x8b33('0x33')](_0x8b33('0x34'))){_0x27f15d['limit']=qs[_0x8b33('0x1c')](_0x20fa22[_0x8b33('0x2e')][_0x8b33('0x1c')]);_0x27f15d[_0x8b33('0x1e')]=qs[_0x8b33('0x1e')](_0x20fa22['query'][_0x8b33('0x1e')]);}_0x27f15d[_0x8b33('0x35')]=qs[_0x8b33('0x36')](_0x20fa22[_0x8b33('0x2e')][_0x8b33('0x36')]);_0x27f15d[_0x8b33('0x37')]=qs[_0x8b33('0x38')](_[_0x8b33('0x39')](_0x20fa22['query'],_0x2911ce[_0x8b33('0x38')]),_0x2f0d57);if(_0x20fa22[_0x8b33('0x2e')][_0x8b33('0x3a')]){_0x27f15d[_0x8b33('0x37')]=_['merge'](_0x27f15d[_0x8b33('0x37')],{'$or':_[_0x8b33('0x28')](_0x2f0d57,function(_0x62bb51){if(_0x62bb51[_0x8b33('0x3b')]!=='VIRTUAL'){var _0x54c4d0={};_0x54c4d0[_0x62bb51[_0x8b33('0x25')]]={'$like':'%'+_0x20fa22['query'][_0x8b33('0x3a')]+'%'};return _0x54c4d0;}})});}_0x27f15d=_[_0x8b33('0x3c')]({},_0x27f15d,_0x20fa22[_0x8b33('0x3d')]);var _0x2e1087={'where':_0x27f15d[_0x8b33('0x37')]};return db[_0x8b33('0x29')]['count'](_0x2e1087)[_0x8b33('0x24')](function(_0x3dfce8){_0x3fd655[_0x8b33('0x1f')]=_0x3dfce8;if(_0x20fa22['query'][_0x8b33('0x3e')]){_0x27f15d[_0x8b33('0x3f')]=[{'all':!![]}];}return db[_0x8b33('0x29')]['findAll'](_0x27f15d);})[_0x8b33('0x24')](function(_0x252e3f){_0x3fd655[_0x8b33('0x40')]=_0x252e3f;return _0x3fd655;})['then'](respondWithFilteredResult(_0x42fe31,_0x27f15d))[_0x8b33('0x41')](handleError(_0x42fe31,null));};exports[_0x8b33('0x42')]=function(_0x16c966,_0x3cf00e){var _0x1a3de1={'raw':!![],'where':{'id':_0x16c966[_0x8b33('0x43')]['id']}},_0x1f515c={};_0x1f515c[_0x8b33('0x2d')]=_['keys'](db[_0x8b33('0x29')][_0x8b33('0x2a')]);_0x1f515c[_0x8b33('0x2e')]=_[_0x8b33('0x2f')](_0x16c966[_0x8b33('0x2e')]);_0x1f515c[_0x8b33('0x38')]=_[_0x8b33('0x30')](_0x1f515c[_0x8b33('0x2d')],_0x1f515c[_0x8b33('0x2e')]);_0x1a3de1[_0x8b33('0x31')]=_[_0x8b33('0x30')](_0x1f515c[_0x8b33('0x2d')],qs['fields'](_0x16c966[_0x8b33('0x2e')][_0x8b33('0x32')]));_0x1a3de1[_0x8b33('0x31')]=_0x1a3de1['attributes'][_0x8b33('0x44')]?_0x1a3de1[_0x8b33('0x31')]:_0x1f515c[_0x8b33('0x2d')];if(_0x16c966[_0x8b33('0x2e')][_0x8b33('0x3e')]){_0x1a3de1[_0x8b33('0x3f')]=[{'all':!![]}];}_0x1a3de1=_[_0x8b33('0x3c')]({},_0x1a3de1,_0x16c966[_0x8b33('0x3d')]);return db[_0x8b33('0x29')][_0x8b33('0x45')](_0x1a3de1)['then'](handleEntityNotFound(_0x3cf00e,null))['then'](respondWithResult(_0x3cf00e,null))[_0x8b33('0x41')](handleError(_0x3cf00e,null));};exports[_0x8b33('0x46')]=function(_0x1e857d,_0x304343){return db[_0x8b33('0x29')][_0x8b33('0x46')](_0x1e857d['body'],{})[_0x8b33('0x24')](respondWithResult(_0x304343,0xc9))[_0x8b33('0x41')](handleError(_0x304343,null));};exports[_0x8b33('0x23')]=function(_0x178ce0,_0x114ae4){if(_0x178ce0[_0x8b33('0x47')]['id']){delete _0x178ce0['body']['id'];}return db[_0x8b33('0x29')]['find']({'where':{'id':_0x178ce0['params']['id']}})[_0x8b33('0x24')](handleEntityNotFound(_0x114ae4,null))['then'](saveUpdates(_0x178ce0[_0x8b33('0x47')],null))[_0x8b33('0x24')](respondWithResult(_0x114ae4,null))[_0x8b33('0x41')](handleError(_0x114ae4,null));};exports[_0x8b33('0x48')]=function(_0x15c9e1,_0x6c9f40){return db[_0x8b33('0x29')][_0x8b33('0x45')]({'where':{'id':_0x15c9e1[_0x8b33('0x43')]['id']}})[_0x8b33('0x24')](handleEntityNotFound(_0x6c9f40,null))[_0x8b33('0x24')](removeEntity(_0x6c9f40,null))[_0x8b33('0x41')](handleError(_0x6c9f40,null));};exports[_0x8b33('0x49')]=function(_0x2028da,_0x1debe3){return db[_0x8b33('0x29')][_0x8b33('0x49')]()[_0x8b33('0x24')](respondWithResult(_0x1debe3,null))[_0x8b33('0x41')](handleError(_0x1debe3,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 23a4c5e..93f26ff 100644 --- a/server/api/faxTransferReport/faxTransferReport.model.js +++ b/server/api/faxTransferReport/faxTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x052c=['moment','bluebird','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x052c,0xe6));var _0xc052=function(_0x36a36d,_0x556689){_0x36a36d=_0x36a36d-0x0;var _0x3ab194=_0x052c[_0x36a36d];return _0x3ab194;};'use strict';var _=require(_0xc052('0x0'));var util=require(_0xc052('0x1'));var logger=require(_0xc052('0x2'))(_0xc052('0x3'));var moment=require(_0xc052('0x4'));var BPromise=require(_0xc052('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc052('0x6'));var config=require(_0xc052('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xc052('0x8')]=function(_0x22a664,_0x1a96e7){return _0x22a664[_0xc052('0x9')](_0xc052('0xa'),attributes,{'tableName':_0xc052('0xb'),'paranoid':![],'indexes':[{'name':_0xc052('0xc'),'fields':[_0xc052('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3064=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3064,0x73));var _0x4306=function(_0x14ae2e,_0x3e077a){_0x14ae2e=_0x14ae2e-0x0;var _0x2084b1=_0x3064[_0x14ae2e];return _0x2084b1;};'use strict';var _=require(_0x4306('0x0'));var util=require(_0x4306('0x1'));var logger=require(_0x4306('0x2'))(_0x4306('0x3'));var moment=require(_0x4306('0x4'));var BPromise=require(_0x4306('0x5'));var rp=require(_0x4306('0x6'));var fs=require('fs');var path=require(_0x4306('0x7'));var rimraf=require(_0x4306('0x8'));var config=require(_0x4306('0x9'));var attributes=require(_0x4306('0xa'));module[_0x4306('0xb')]=function(_0x367506,_0x806eab){return _0x367506[_0x4306('0xc')](_0x4306('0xd'),attributes,{'tableName':_0x4306('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4306('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0094fb0..0c0f96d 100644 --- a/server/api/faxTransferReport/faxTransferReport.rpc.js +++ b/server/api/faxTransferReport/faxTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b61=['rpc','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6b61,0x1e8));var _0x16b6=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x6b61[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x16b6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x16b6('0x1'));var rs=require(_0x16b6('0x2'));var fs=require('fs');var Redis=require(_0x16b6('0x3'));var db=require(_0x16b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16b6('0x5'))(_0x16b6('0x6'));var config=require('../../config/environment');var jayson=require(_0x16b6('0x7'));var client=jayson[_0x16b6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xec7d6e,_0x3409dc,_0x659039){return new BPromise(function(_0x3a21f4,_0x1e8227){return client[_0x16b6('0x9')](_0xec7d6e,_0x659039)[_0x16b6('0xa')](function(_0x3dcaa5){logger['info'](_0x16b6('0xb'),_0x3409dc,'request\x20sent');logger['debug'](_0x16b6('0xc'),_0x3409dc,_0x16b6('0xd'),JSON[_0x16b6('0xe')](_0x3dcaa5));if(_0x3dcaa5[_0x16b6('0xf')]){if(_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x10')]===0x1f4){logger[_0x16b6('0xf')](_0x16b6('0xb'),_0x3409dc,_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);return _0x1e8227(_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);}logger[_0x16b6('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3409dc,_0x3dcaa5[_0x16b6('0xf')][_0x16b6('0x11')]);return _0x3a21f4(_0x3dcaa5['error'][_0x16b6('0x11')]);}else{logger['info'](_0x16b6('0xb'),_0x3409dc,'request\x20sent');_0x3a21f4(_0x3dcaa5[_0x16b6('0x12')][_0x16b6('0x11')]);}})['catch'](function(_0x2ee428){logger['error'](_0x16b6('0xb'),_0x3409dc,_0x2ee428);_0x1e8227(_0x2ee428);});});} \ No newline at end of file +var _0x654f=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xce8de1,_0x26902d){var _0x193eb4=function(_0x44f0bf){while(--_0x44f0bf){_0xce8de1['push'](_0xce8de1['shift']());}};_0x193eb4(++_0x26902d);}(_0x654f,0x74));var _0xf654=function(_0x51dc90,_0x34ec47){_0x51dc90=_0x51dc90-0x0;var _0x542207=_0x654f[_0x51dc90];return _0x542207;};'use strict';var _=require('lodash');var util=require(_0xf654('0x0'));var moment=require(_0xf654('0x1'));var BPromise=require(_0xf654('0x2'));var rs=require(_0xf654('0x3'));var fs=require('fs');var Redis=require(_0xf654('0x4'));var db=require(_0xf654('0x5'))['db'];var utils=require(_0xf654('0x6'));var logger=require(_0xf654('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf654('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x546868,_0x535780,_0x3e6997){return new BPromise(function(_0x399c88,_0x4bac9f){return client[_0xf654('0x9')](_0x546868,_0x3e6997)[_0xf654('0xa')](function(_0x153d76){logger[_0xf654('0xb')](_0xf654('0xc'),_0x535780,'request\x20sent');logger[_0xf654('0xd')](_0xf654('0xe'),_0x535780,_0xf654('0xf'),JSON[_0xf654('0x10')](_0x153d76));if(_0x153d76['error']){if(_0x153d76[_0xf654('0x11')][_0xf654('0x12')]===0x1f4){logger[_0xf654('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x535780,_0x153d76['error']['message']);return _0x4bac9f(_0x153d76[_0xf654('0x11')][_0xf654('0x13')]);}logger[_0xf654('0x11')](_0xf654('0xc'),_0x535780,_0x153d76[_0xf654('0x11')][_0xf654('0x13')]);return _0x399c88(_0x153d76[_0xf654('0x11')]['message']);}else{logger[_0xf654('0xb')](_0xf654('0xc'),_0x535780,_0xf654('0xf'));_0x399c88(_0x153d76[_0xf654('0x14')][_0xf654('0x13')]);}})[_0xf654('0x15')](function(_0x1f68d7){logger[_0xf654('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x535780,_0x1f68d7);_0x4bac9f(_0x1f68d7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index bef00cc..ba44e71 100644 --- a/server/api/faxTransferReport/index.js +++ b/server/api/faxTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3814=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy'];(function(_0x372f70,_0x58e47d){var _0x282eab=function(_0x59f311){while(--_0x59f311){_0x372f70['push'](_0x372f70['shift']());}};_0x282eab(++_0x58e47d);}(_0x3814,0x74));var _0x4381=function(_0x26d957,_0x40d8c7){_0x26d957=_0x26d957-0x0;var _0x2e64dc=_0x3814[_0x26d957];return _0x2e64dc;};'use strict';var multer=require(_0x4381('0x0'));var util=require(_0x4381('0x1'));var path=require(_0x4381('0x2'));var timeout=require(_0x4381('0x3'));var express=require(_0x4381('0x4'));var router=express[_0x4381('0x5')]();var fs_extra=require(_0x4381('0x6'));var auth=require(_0x4381('0x7'));var interaction=require(_0x4381('0x8'));var config=require(_0x4381('0x9'));var controller=require('./faxTransferReport.controller');router[_0x4381('0xa')]('/',auth['isAuthenticated'](),controller[_0x4381('0xb')]);router[_0x4381('0xa')](_0x4381('0xc'),auth[_0x4381('0xd')](),controller[_0x4381('0xe')]);router['get'](_0x4381('0xf'),auth[_0x4381('0xd')](),controller[_0x4381('0x10')]);router[_0x4381('0x11')]('/',auth[_0x4381('0xd')](),controller[_0x4381('0x12')]);router[_0x4381('0x13')](_0x4381('0xf'),auth[_0x4381('0xd')](),controller[_0x4381('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4381('0x15')]);module[_0x4381('0x16')]=router; \ No newline at end of file +var _0x27b1=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','exports','multer'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x27b1,0x179));var _0x127b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x27b1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x127b('0x0'));var util=require(_0x127b('0x1'));var path=require(_0x127b('0x2'));var timeout=require(_0x127b('0x3'));var express=require(_0x127b('0x4'));var router=express[_0x127b('0x5')]();var fs_extra=require(_0x127b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x127b('0x7'));var config=require(_0x127b('0x8'));var controller=require(_0x127b('0x9'));router[_0x127b('0xa')]('/',auth[_0x127b('0xb')](),controller[_0x127b('0xc')]);router['get'](_0x127b('0xd'),auth[_0x127b('0xb')](),controller[_0x127b('0xe')]);router[_0x127b('0xa')](_0x127b('0xf'),auth[_0x127b('0xb')](),controller['show']);router[_0x127b('0x10')]('/',auth[_0x127b('0xb')](),controller[_0x127b('0x11')]);router['put'](_0x127b('0xf'),auth[_0x127b('0xb')](),controller[_0x127b('0x12')]);router[_0x127b('0x13')](_0x127b('0xf'),auth[_0x127b('0xb')](),controller['destroy']);module[_0x127b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c13b711..654db8d 100644 --- a/server/api/intDeskAccount/index.js +++ b/server/api/intDeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0db=['create','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x191bba,_0xc6b52a){var _0x53b444=function(_0x571dda){while(--_0x571dda){_0x191bba['push'](_0x191bba['shift']());}};_0x53b444(++_0xc6b52a);}(_0xe0db,0x18e));var _0xbe0d=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe0db[_0x21aec3];return _0x288bbc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbe0d('0x0'));var express=require(_0xbe0d('0x1'));var router=express[_0xbe0d('0x2')]();var fs_extra=require(_0xbe0d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbe0d('0x4'));var config=require(_0xbe0d('0x5'));var controller=require(_0xbe0d('0x6'));router[_0xbe0d('0x7')]('/',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x9')]);router[_0xbe0d('0x7')](_0xbe0d('0xa'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xb')]);router[_0xbe0d('0x7')](_0xbe0d('0xc'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xd')]);router[_0xbe0d('0x7')]('/:id/fields',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0xe')]);router[_0xbe0d('0xf')]('/',auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x10')]);router[_0xbe0d('0xf')](_0xbe0d('0xc'),auth[_0xbe0d('0x8')](),controller[_0xbe0d('0x11')]);router[_0xbe0d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbe0d('0x13')]);router[_0xbe0d('0x14')](_0xbe0d('0xa'),auth['isAuthenticated'](),controller[_0xbe0d('0x15')]);module[_0xbe0d('0x16')]=router; \ No newline at end of file +var _0xc023=['./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc023,0xe8));var _0x3c02=function(_0x347733,_0x5de9fa){_0x347733=_0x347733-0x0;var _0x398c75=_0xc023[_0x347733];return _0x398c75;};'use strict';var multer=require(_0x3c02('0x0'));var util=require(_0x3c02('0x1'));var path=require(_0x3c02('0x2'));var timeout=require(_0x3c02('0x3'));var express=require(_0x3c02('0x4'));var router=express[_0x3c02('0x5')]();var fs_extra=require(_0x3c02('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c02('0x7'));var controller=require(_0x3c02('0x8'));router['get']('/',auth[_0x3c02('0x9')](),controller[_0x3c02('0xa')]);router[_0x3c02('0xb')](_0x3c02('0xc'),auth[_0x3c02('0x9')](),controller[_0x3c02('0xd')]);router[_0x3c02('0xb')]('/:id/configurations',auth[_0x3c02('0x9')](),controller[_0x3c02('0xe')]);router['get']('/:id/fields',auth[_0x3c02('0x9')](),controller[_0x3c02('0xf')]);router[_0x3c02('0x10')]('/',auth['isAuthenticated'](),controller[_0x3c02('0x11')]);router[_0x3c02('0x10')]('/:id/configurations',auth[_0x3c02('0x9')](),controller[_0x3c02('0x12')]);router[_0x3c02('0x13')](_0x3c02('0xc'),auth[_0x3c02('0x9')](),controller[_0x3c02('0x14')]);router[_0x3c02('0x15')](_0x3c02('0xc'),auth[_0x3c02('0x9')](),controller[_0x3c02('0x16')]);module[_0x3c02('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7c8a447..84744fe 100644 --- a/server/api/intDeskAccount/intDeskAccount.attributes.js +++ b/server/api/intDeskAccount/intDeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74ce=['STRING','basic','ENUM','newTab','sequelize','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x74ce,0xa6));var _0xe74c=function(_0x547a19,_0x3d6284){_0x547a19=_0x547a19-0x0;var _0x445415=_0x74ce[_0x547a19];return _0x445415;};'use strict';var Sequelize=require(_0xe74c('0x0'));module[_0xe74c('0x1')]={'name':{'type':Sequelize[_0xe74c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe74c('0x2')]},'remoteUri':{'type':Sequelize[_0xe74c('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xe74c('0x3')),'defaultValue':_0xe74c('0x3')},'password':{'type':Sequelize[_0xe74c('0x2')]},'consumerKey':{'type':Sequelize[_0xe74c('0x2')]},'consumerSecret':{'type':Sequelize[_0xe74c('0x2')]},'token':{'type':Sequelize[_0xe74c('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe74c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe74c('0x4')]('integrationTab',_0xe74c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x80fd=['sequelize','exports','STRING','basic','integrationTab','newTab'];(function(_0x342301,_0x49df52){var _0x11d1d0=function(_0x58ddbb){while(--_0x58ddbb){_0x342301['push'](_0x342301['shift']());}};_0x11d1d0(++_0x49df52);}(_0x80fd,0x1ec));var _0xd80f=function(_0x5c18d8,_0x62ec4a){_0x5c18d8=_0x5c18d8-0x0;var _0x3c9805=_0x80fd[_0x5c18d8];return _0x3c9805;};'use strict';var Sequelize=require(_0xd80f('0x0'));module[_0xd80f('0x1')]={'name':{'type':Sequelize[_0xd80f('0x2')]},'description':{'type':Sequelize[_0xd80f('0x2')]},'username':{'type':Sequelize[_0xd80f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xd80f('0x3')),'defaultValue':_0xd80f('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xd80f('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xd80f('0x2')]},'tokenSecret':{'type':Sequelize[_0xd80f('0x2')]},'serverUrl':{'type':Sequelize[_0xd80f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd80f('0x4'),_0xd80f('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index c75691c..47ff8f7 100644 --- a/server/api/intDeskAccount/intDeskAccount.controller.js +++ b/server/api/intDeskAccount/intDeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b98=['entries','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','find','getConfigurations','findOne','addConfiguration','channel','Descriptions','getDescriptions','DeskConfiguration','Subjects','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','Authorization','format','Basic\x20%s','toString','concat','_embedded'];(function(_0x4793ed,_0xf5816c){var _0x4dfd3e=function(_0x2d6e5f){while(--_0x2d6e5f){_0x4793ed['push'](_0x4793ed['shift']());}};_0x4dfd3e(++_0xf5816c);}(_0x2b98,0x161));var _0x82b9=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x2b98[_0x298ed3];return _0x5aad28;};'use strict';var emlformat=require(_0x82b9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82b9('0x1'));var jsonpatch=require(_0x82b9('0x2'));var rp=require(_0x82b9('0x3'));var moment=require('moment');var BPromise=require(_0x82b9('0x4'));var Mustache=require(_0x82b9('0x5'));var util=require('util');var path=require(_0x82b9('0x6'));var sox=require(_0x82b9('0x7'));var csv=require(_0x82b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x82b9('0x9'));var squel=require(_0x82b9('0xa'));var crypto=require(_0x82b9('0xb'));var jsforce=require(_0x82b9('0xc'));var deskjs=require(_0x82b9('0xd'));var toCsv=require(_0x82b9('0x8'));var querystring=require(_0x82b9('0xe'));var Papa=require(_0x82b9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82b9('0x10'));var as=require(_0x82b9('0x11'));var hardwareService=require(_0x82b9('0x12'));var logger=require(_0x82b9('0x13'))(_0x82b9('0x14'));var utils=require(_0x82b9('0x15'));var config=require(_0x82b9('0x16'));var licenseUtil=require(_0x82b9('0x17'));var db=require(_0x82b9('0x18'))['db'];var integrations=require(_0x82b9('0x19'));function respondWithStatusCode(_0x254ff4,_0x31a98b){_0x31a98b=_0x31a98b||0xcc;return function(_0x3bb1b9){if(_0x3bb1b9){return _0x254ff4[_0x82b9('0x1a')](_0x31a98b);}return _0x254ff4[_0x82b9('0x1b')](_0x31a98b)['end']();};}function respondWithResult(_0x26449b,_0x5cd03b){_0x5cd03b=_0x5cd03b||0xc8;return function(_0x1fb20e){if(_0x1fb20e){return _0x26449b[_0x82b9('0x1b')](_0x5cd03b)[_0x82b9('0x1c')](_0x1fb20e);}};}function respondWithFilteredResult(_0x5bed0d,_0x499200){return function(_0x8ee399){if(_0x8ee399){var _0x427a27=typeof _0x499200[_0x82b9('0x1d')]==='undefined'&&typeof _0x499200[_0x82b9('0x1e')]===_0x82b9('0x1f');var _0x17acde=_0x8ee399[_0x82b9('0x20')];var _0x175467=_0x427a27?0x0:_0x499200[_0x82b9('0x1d')];var _0x3b8842=_0x427a27?_0x8ee399[_0x82b9('0x20')]:_0x499200[_0x82b9('0x1d')]+_0x499200[_0x82b9('0x1e')];var _0x3a4af0;if(_0x3b8842>=_0x17acde){_0x3b8842=_0x17acde;_0x3a4af0=0xc8;}else{_0x3a4af0=0xce;}_0x5bed0d[_0x82b9('0x1b')](_0x3a4af0);return _0x5bed0d[_0x82b9('0x21')](_0x82b9('0x22'),_0x175467+'-'+_0x3b8842+'/'+_0x17acde)[_0x82b9('0x1c')](_0x8ee399);}return null;};}function patchUpdates(_0x49bffa){return function(_0x5381af){try{jsonpatch['apply'](_0x5381af,_0x49bffa,!![]);}catch(_0x2205c8){return BPromise[_0x82b9('0x23')](_0x2205c8);}return _0x5381af[_0x82b9('0x24')]();};}function saveUpdates(_0x17eb10,_0x2ed408){return function(_0x335aba){if(_0x335aba){return _0x335aba[_0x82b9('0x25')](_0x17eb10)[_0x82b9('0x26')](function(_0xe61d3a){return _0xe61d3a;});}return null;};}function removeEntity(_0x2873cb,_0x4fa1d4){return function(_0x18c4e7){if(_0x18c4e7){return _0x18c4e7[_0x82b9('0x27')]()[_0x82b9('0x26')](function(){_0x2873cb[_0x82b9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20026b,_0x1e5c9e){return function(_0x557f9e){if(!_0x557f9e){_0x20026b[_0x82b9('0x1a')](0x194);}return _0x557f9e;};}function handleError(_0x21663c,_0x3932f0){_0x3932f0=_0x3932f0||0x1f4;return function(_0x44fc61){logger['error'](_0x44fc61['stack']);if(_0x44fc61[_0x82b9('0x28')]){delete _0x44fc61[_0x82b9('0x28')];}_0x21663c['status'](_0x3932f0)[_0x82b9('0x29')](_0x44fc61);};}exports['index']=function(_0x4b6dab,_0x20f303){var _0x1fe5da={},_0x52397b={},_0x5cbefe={'count':0x0,'rows':[]};var _0x354645=_[_0x82b9('0x2a')](db[_0x82b9('0x2b')][_0x82b9('0x2c')],function(_0x29bc2a){return{'name':_0x29bc2a[_0x82b9('0x2d')],'type':_0x29bc2a[_0x82b9('0x2e')][_0x82b9('0x2f')]};});_0x52397b['model']=_['map'](_0x354645,'name');_0x52397b[_0x82b9('0x30')]=_[_0x82b9('0x31')](_0x4b6dab[_0x82b9('0x30')]);_0x52397b[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x52397b[_0x82b9('0x34')],_0x52397b['query']);_0x1fe5da[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x52397b[_0x82b9('0x34')],qs[_0x82b9('0x36')](_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x36')]));_0x1fe5da[_0x82b9('0x35')]=_0x1fe5da[_0x82b9('0x35')][_0x82b9('0x37')]?_0x1fe5da[_0x82b9('0x35')]:_0x52397b['model'];if(!_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x38')](_0x82b9('0x39'))){_0x1fe5da['limit']=qs[_0x82b9('0x1e')](_0x4b6dab['query'][_0x82b9('0x1e')]);_0x1fe5da[_0x82b9('0x1d')]=qs[_0x82b9('0x1d')](_0x4b6dab['query'][_0x82b9('0x1d')]);}_0x1fe5da[_0x82b9('0x3a')]=qs[_0x82b9('0x3b')](_0x4b6dab[_0x82b9('0x30')][_0x82b9('0x3b')]);_0x1fe5da['where']=qs[_0x82b9('0x32')](_[_0x82b9('0x3c')](_0x4b6dab[_0x82b9('0x30')],_0x52397b[_0x82b9('0x32')]),_0x354645);if(_0x4b6dab['query']['filter']){_0x1fe5da[_0x82b9('0x3d')]=_[_0x82b9('0x3e')](_0x1fe5da[_0x82b9('0x3d')],{'$or':_[_0x82b9('0x2a')](_0x354645,function(_0x19c420){if(_0x19c420[_0x82b9('0x2e')]!==_0x82b9('0x3f')){var _0x35df9d={};_0x35df9d[_0x19c420[_0x82b9('0x28')]]={'$like':'%'+_0x4b6dab['query'][_0x82b9('0x40')]+'%'};return _0x35df9d;}})});}_0x1fe5da=_['merge']({},_0x1fe5da,_0x4b6dab[_0x82b9('0x41')]);var _0x251afa={'where':_0x1fe5da[_0x82b9('0x3d')]};return db[_0x82b9('0x2b')][_0x82b9('0x20')](_0x251afa)['then'](function(_0x229d1a){_0x5cbefe[_0x82b9('0x20')]=_0x229d1a;if(_0x4b6dab[_0x82b9('0x30')]['includeAll']){_0x1fe5da[_0x82b9('0x42')]=[{'all':!![]}];}return db[_0x82b9('0x2b')][_0x82b9('0x43')](_0x1fe5da);})['then'](function(_0x239b5f){_0x5cbefe[_0x82b9('0x44')]=_0x239b5f;return _0x5cbefe;})[_0x82b9('0x26')](respondWithFilteredResult(_0x20f303,_0x1fe5da))['catch'](handleError(_0x20f303,null));};exports[_0x82b9('0x45')]=function(_0x1b1d4c,_0xf7dab3){var _0x722ebd={'raw':![],'where':{'id':_0x1b1d4c[_0x82b9('0x46')]['id']}},_0x465ce2={};_0x465ce2[_0x82b9('0x34')]=_[_0x82b9('0x31')](db[_0x82b9('0x2b')]['rawAttributes']);_0x465ce2['query']=_[_0x82b9('0x31')](_0x1b1d4c[_0x82b9('0x30')]);_0x465ce2[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x465ce2[_0x82b9('0x34')],_0x465ce2[_0x82b9('0x30')]);_0x722ebd[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x465ce2['model'],qs['fields'](_0x1b1d4c['query'][_0x82b9('0x36')]));_0x722ebd[_0x82b9('0x35')]=_0x722ebd[_0x82b9('0x35')][_0x82b9('0x37')]?_0x722ebd[_0x82b9('0x35')]:_0x465ce2[_0x82b9('0x34')];if(_0x1b1d4c['query'][_0x82b9('0x47')]){_0x722ebd[_0x82b9('0x42')]=[{'all':!![]}];}_0x722ebd=_[_0x82b9('0x3e')]({},_0x722ebd,_0x1b1d4c['options']);return db['DeskAccount']['find'](_0x722ebd)[_0x82b9('0x26')](handleEntityNotFound(_0xf7dab3,null))[_0x82b9('0x26')](respondWithResult(_0xf7dab3,null))[_0x82b9('0x48')](handleError(_0xf7dab3,null));};exports[_0x82b9('0x49')]=function(_0x1ba33b,_0x377f38){return db['DeskAccount'][_0x82b9('0x49')](_0x1ba33b[_0x82b9('0x4a')],{})[_0x82b9('0x26')](respondWithResult(_0x377f38,0xc9))[_0x82b9('0x48')](handleError(_0x377f38,null));};exports[_0x82b9('0x25')]=function(_0x33c3c8,_0x4a7927){if(_0x33c3c8[_0x82b9('0x4a')]['id']){delete _0x33c3c8[_0x82b9('0x4a')]['id'];}return db['DeskAccount'][_0x82b9('0x4b')]({'where':{'id':_0x33c3c8['params']['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x4a7927,null))[_0x82b9('0x26')](saveUpdates(_0x33c3c8['body'],null))[_0x82b9('0x26')](respondWithResult(_0x4a7927,null))[_0x82b9('0x48')](handleError(_0x4a7927,null));};exports[_0x82b9('0x27')]=function(_0xc3afb0,_0x52b6db){return db[_0x82b9('0x2b')][_0x82b9('0x4b')]({'where':{'id':_0xc3afb0[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x52b6db,null))[_0x82b9('0x26')](removeEntity(_0x52b6db,null))['catch'](handleError(_0x52b6db,null));};exports[_0x82b9('0x4c')]=function(_0x451fe2,_0x414cd1,_0x15c611){var _0x31035a={};var _0x39dbe8={};var _0x3549bc;var _0x15e94a;return db[_0x82b9('0x2b')][_0x82b9('0x4d')]({'where':{'id':_0x451fe2[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0x414cd1,null))[_0x82b9('0x26')](function(_0x2378dd){if(_0x2378dd){_0x3549bc=_0x2378dd;_0x39dbe8['model']=_[_0x82b9('0x31')](db['DeskConfiguration'][_0x82b9('0x2c')]);_0x39dbe8[_0x82b9('0x30')]=_['keys'](_0x451fe2[_0x82b9('0x30')]);_0x39dbe8[_0x82b9('0x32')]=_[_0x82b9('0x33')](_0x39dbe8[_0x82b9('0x34')],_0x39dbe8[_0x82b9('0x30')]);_0x31035a[_0x82b9('0x35')]=_[_0x82b9('0x33')](_0x39dbe8[_0x82b9('0x34')],qs['fields'](_0x451fe2[_0x82b9('0x30')][_0x82b9('0x36')]));_0x31035a[_0x82b9('0x35')]=_0x31035a[_0x82b9('0x35')][_0x82b9('0x37')]?_0x31035a[_0x82b9('0x35')]:_0x39dbe8[_0x82b9('0x34')];_0x31035a['order']=qs['sort'](_0x451fe2['query']['sort']);_0x31035a[_0x82b9('0x3d')]=qs[_0x82b9('0x32')](_[_0x82b9('0x3c')](_0x451fe2[_0x82b9('0x30')],_0x39dbe8['filters']));if(_0x451fe2[_0x82b9('0x30')][_0x82b9('0x40')]){_0x31035a[_0x82b9('0x3d')]=_[_0x82b9('0x3e')](_0x31035a[_0x82b9('0x3d')],{'$or':_[_0x82b9('0x2a')](_0x31035a[_0x82b9('0x35')],function(_0x556d8b){var _0x44d68c={};_0x44d68c[_0x556d8b]={'$like':'%'+_0x451fe2['query']['filter']+'%'};return _0x44d68c;})});}_0x31035a=_[_0x82b9('0x3e')]({},_0x31035a,_0x451fe2[_0x82b9('0x41')]);return _0x3549bc['getConfigurations'](_0x31035a);}})[_0x82b9('0x26')](function(_0x34afcc){if(_0x34afcc){_0x15e94a=_0x34afcc[_0x82b9('0x37')];if(!_0x451fe2[_0x82b9('0x30')]['hasOwnProperty']('nolimit')){_0x31035a[_0x82b9('0x1e')]=qs[_0x82b9('0x1e')](_0x451fe2['query']['limit']);_0x31035a[_0x82b9('0x1d')]=qs[_0x82b9('0x1d')](_0x451fe2['query'][_0x82b9('0x1d')]);}return _0x3549bc[_0x82b9('0x4c')](_0x31035a);}})['then'](function(_0x34b5ee){if(_0x34b5ee){return _0x34b5ee?{'count':_0x15e94a,'rows':_0x34b5ee}:null;}})['then'](respondWithResult(_0x414cd1,null))[_0x82b9('0x48')](handleError(_0x414cd1,null));};exports[_0x82b9('0x4e')]=function(_0x3824fe,_0xf4ff9,_0x92eafd){if(_0x3824fe[_0x82b9('0x4a')]['id']){delete _0x3824fe['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x3824fe[_0x82b9('0x46')]['id']}})[_0x82b9('0x26')](handleEntityNotFound(_0xf4ff9,null))['then'](function(_0x4a6418){if(_0x4a6418){_0x3824fe['body']['AccountId']=_0x4a6418['id'];_0x3824fe['body']['Subjects']=integrations['getSubjects'](_0x3824fe['body'][_0x82b9('0x4f')],_0x3824fe[_0x82b9('0x4a')]['type']);_0x3824fe['body'][_0x82b9('0x50')]=integrations[_0x82b9('0x51')](_0x3824fe[_0x82b9('0x4a')]['channel'],_0x3824fe['body'][_0x82b9('0x2e')]);return db[_0x82b9('0x52')]['create'](_0x3824fe[_0x82b9('0x4a')],{'include':[{'model':db['DeskField'],'as':_0x82b9('0x53')},{'model':db[_0x82b9('0x54')],'as':'Descriptions'}]});}return null;})[_0x82b9('0x26')](respondWithResult(_0xf4ff9,null))['catch'](handleError(_0xf4ff9,null));};exports[_0x82b9('0x55')]=function(_0xef88d1,_0x30d7e6,_0x1f4706){var _0x504ad6=[{'name':_0x82b9('0x56'),'label':_0x82b9('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x23b273='';return db['DeskAccount'][_0x82b9('0x4d')]({'where':{'id':_0xef88d1[_0x82b9('0x46')]['id']},'attributes':['id',_0x82b9('0x57'),_0x82b9('0x58'),_0x82b9('0x59'),_0x82b9('0x5a'),_0x82b9('0x5b'),_0x82b9('0x5c'),_0x82b9('0x5d'),_0x82b9('0x5e')]})[_0x82b9('0x26')](handleEntityNotFound(_0x30d7e6,null))[_0x82b9('0x26')](function(_0x3a4afa){if(_0x3a4afa){_0x23b273=_0x3a4afa[_0x82b9('0x57')];var _0x43b0e5=_0x23b273['slice'](-0x1);if(_0x43b0e5==='/'){_0x23b273=_0x23b273[_0x82b9('0x5f')](0x0,_0x23b273[_0x82b9('0x60')](_0x43b0e5));}var _0x472cbe={'method':_0x82b9('0x61'),'uri':util['format'](_0x82b9('0x62'),_0x23b273),'headers':{'Content-Type':_0x82b9('0x63'),'Accept':'application/json'},'json':!![]};if(_0x3a4afa[_0x82b9('0x58')]===_0x82b9('0x64')){_0x472cbe['headers'][_0x82b9('0x65')]=util[_0x82b9('0x66')](_0x82b9('0x67'),new Buffer(util['format']('%s:%s',_0x3a4afa['username'],_0x3a4afa[_0x82b9('0x5a')]))[_0x82b9('0x68')]('base64'));}return rp(_0x472cbe)[_0x82b9('0x26')](function(_0xcf7b34){return _0x504ad6[_0x82b9('0x69')](_[_0x82b9('0x2a')](_0xcf7b34[_0x82b9('0x6a')][_0x82b9('0x6b')],function(_0x35178d){return{'id':_0x35178d[_0x82b9('0x28')],'name':_0x35178d[_0x82b9('0x28')],'type':_0x35178d[_0x82b9('0x2e')],'active':_0x35178d[_0x82b9('0x6c')],'label':_0x35178d[_0x82b9('0x6d')],'custom':!![]};}));});}})[_0x82b9('0x26')](function(_0x57e395){return{'count':_0x57e395[_0x82b9('0x37')],'rows':_0x57e395};})['then'](respondWithResult(_0x30d7e6,null))[_0x82b9('0x48')](function(_0x4d6a6e){var _0x5d8f41=_0xef88d1[_0x82b9('0x30')]['test']?0x1f4:_0x4d6a6e[_0x82b9('0x6e')]||0x1f4;logger[_0x82b9('0x6f')](_0x82b9('0x70'),_0x82b9('0x55'),_0x5d8f41,JSON[_0x82b9('0x71')](_0x4d6a6e));delete _0x4d6a6e[_0x82b9('0x28')];if(_0x5d8f41===0x191){_0x5d8f41=0x190;}_0x30d7e6[_0x82b9('0x1b')](_0x5d8f41)['send'](_0xef88d1['query'][_0x82b9('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x4d6a6e[_0x82b9('0x6e')]}:_0x4d6a6e);});}; \ No newline at end of file +var _0xf166=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','DeskAccount','rawAttributes','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','type','VIRTUAL','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','getConfigurations','DeskConfiguration','pick','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','lastIndexOf','GET','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash'];(function(_0x52d0eb,_0x53a74f){var _0x445040=function(_0x21f093){while(--_0x21f093){_0x52d0eb['push'](_0x52d0eb['shift']());}};_0x445040(++_0x53a74f);}(_0xf166,0x69));var _0x6f16=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf166[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x6f16('0x0'));var rimraf=require(_0x6f16('0x1'));var zipdir=require(_0x6f16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f16('0x3'));var moment=require('moment');var BPromise=require(_0x6f16('0x4'));var Mustache=require('mustache');var util=require(_0x6f16('0x5'));var path=require('path');var sox=require(_0x6f16('0x6'));var csv=require('to-csv');var ejs=require(_0x6f16('0x7'));var fs=require('fs');var fs_extra=require(_0x6f16('0x8'));var _=require(_0x6f16('0x9'));var squel=require('squel');var crypto=require(_0x6f16('0xa'));var jsforce=require(_0x6f16('0xb'));var deskjs=require(_0x6f16('0xc'));var toCsv=require(_0x6f16('0xd'));var querystring=require(_0x6f16('0xe'));var Papa=require(_0x6f16('0xf'));var Redis=require('ioredis');var authService=require(_0x6f16('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6f16('0x11'));var hardwareService=require(_0x6f16('0x12'));var logger=require(_0x6f16('0x13'))(_0x6f16('0x14'));var utils=require(_0x6f16('0x15'));var config=require(_0x6f16('0x16'));var licenseUtil=require(_0x6f16('0x17'));var db=require(_0x6f16('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31ce43,_0x1b3088){_0x1b3088=_0x1b3088||0xcc;return function(_0x5c2be5){if(_0x5c2be5){return _0x31ce43[_0x6f16('0x19')](_0x1b3088);}return _0x31ce43[_0x6f16('0x1a')](_0x1b3088)[_0x6f16('0x1b')]();};}function respondWithResult(_0x4b5393,_0x5b5e7a){_0x5b5e7a=_0x5b5e7a||0xc8;return function(_0x825997){if(_0x825997){return _0x4b5393[_0x6f16('0x1a')](_0x5b5e7a)['json'](_0x825997);}};}function respondWithFilteredResult(_0x1b170e,_0x5caef0){return function(_0x30a527){if(_0x30a527){var _0xbc0d81=typeof _0x5caef0[_0x6f16('0x1c')]===_0x6f16('0x1d')&&typeof _0x5caef0['limit']===_0x6f16('0x1d');var _0x18d096=_0x30a527[_0x6f16('0x1e')];var _0xdbfbaa=_0xbc0d81?0x0:_0x5caef0[_0x6f16('0x1c')];var _0x3214b0=_0xbc0d81?_0x30a527[_0x6f16('0x1e')]:_0x5caef0[_0x6f16('0x1c')]+_0x5caef0['limit'];var _0x1e323b;if(_0x3214b0>=_0x18d096){_0x3214b0=_0x18d096;_0x1e323b=0xc8;}else{_0x1e323b=0xce;}_0x1b170e[_0x6f16('0x1a')](_0x1e323b);return _0x1b170e['set'](_0x6f16('0x1f'),_0xdbfbaa+'-'+_0x3214b0+'/'+_0x18d096)[_0x6f16('0x20')](_0x30a527);}return null;};}function patchUpdates(_0x400878){return function(_0x54a269){try{jsonpatch[_0x6f16('0x21')](_0x54a269,_0x400878,!![]);}catch(_0x5f303c){return BPromise[_0x6f16('0x22')](_0x5f303c);}return _0x54a269[_0x6f16('0x23')]();};}function saveUpdates(_0x438226,_0x111b58){return function(_0x201fc8){if(_0x201fc8){return _0x201fc8[_0x6f16('0x24')](_0x438226)[_0x6f16('0x25')](function(_0x4b276a){return _0x4b276a;});}return null;};}function removeEntity(_0x33e098,_0x5ea596){return function(_0x102d40){if(_0x102d40){return _0x102d40[_0x6f16('0x26')]()['then'](function(){_0x33e098[_0x6f16('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4265e5,_0x4dfc4c){return function(_0x5ef4a6){if(!_0x5ef4a6){_0x4265e5['sendStatus'](0x194);}return _0x5ef4a6;};}function handleError(_0x47794f,_0x550a75){_0x550a75=_0x550a75||0x1f4;return function(_0x5e72bb){logger['error'](_0x5e72bb[_0x6f16('0x27')]);if(_0x5e72bb['name']){delete _0x5e72bb['name'];}_0x47794f[_0x6f16('0x1a')](_0x550a75)[_0x6f16('0x28')](_0x5e72bb);};}exports['index']=function(_0x1078ca,_0x228230){var _0x541cc4={},_0x139416={},_0x5f2ffd={'count':0x0,'rows':[]};var _0x131712=_['map'](db[_0x6f16('0x29')][_0x6f16('0x2a')],function(_0x1906d2){return{'name':_0x1906d2[_0x6f16('0x2b')],'type':_0x1906d2['type'][_0x6f16('0x2c')]};});_0x139416['model']=_['map'](_0x131712,_0x6f16('0x2d'));_0x139416['query']=_['keys'](_0x1078ca[_0x6f16('0x2e')]);_0x139416[_0x6f16('0x2f')]=_[_0x6f16('0x30')](_0x139416[_0x6f16('0x31')],_0x139416[_0x6f16('0x2e')]);_0x541cc4[_0x6f16('0x32')]=_[_0x6f16('0x30')](_0x139416[_0x6f16('0x31')],qs[_0x6f16('0x33')](_0x1078ca['query']['fields']));_0x541cc4[_0x6f16('0x32')]=_0x541cc4[_0x6f16('0x32')][_0x6f16('0x34')]?_0x541cc4[_0x6f16('0x32')]:_0x139416[_0x6f16('0x31')];if(!_0x1078ca[_0x6f16('0x2e')][_0x6f16('0x35')]('nolimit')){_0x541cc4[_0x6f16('0x36')]=qs[_0x6f16('0x36')](_0x1078ca[_0x6f16('0x2e')]['limit']);_0x541cc4[_0x6f16('0x1c')]=qs[_0x6f16('0x1c')](_0x1078ca[_0x6f16('0x2e')][_0x6f16('0x1c')]);}_0x541cc4[_0x6f16('0x37')]=qs[_0x6f16('0x38')](_0x1078ca['query'][_0x6f16('0x38')]);_0x541cc4[_0x6f16('0x39')]=qs['filters'](_['pick'](_0x1078ca['query'],_0x139416['filters']),_0x131712);if(_0x1078ca[_0x6f16('0x2e')][_0x6f16('0x3a')]){_0x541cc4[_0x6f16('0x39')]=_[_0x6f16('0x3b')](_0x541cc4['where'],{'$or':_[_0x6f16('0x3c')](_0x131712,function(_0x33be30){if(_0x33be30[_0x6f16('0x3d')]!==_0x6f16('0x3e')){var _0x1be2a1={};_0x1be2a1[_0x33be30[_0x6f16('0x2d')]]={'$like':'%'+_0x1078ca[_0x6f16('0x2e')]['filter']+'%'};return _0x1be2a1;}})});}_0x541cc4=_[_0x6f16('0x3b')]({},_0x541cc4,_0x1078ca['options']);var _0x220f19={'where':_0x541cc4[_0x6f16('0x39')]};return db[_0x6f16('0x29')][_0x6f16('0x1e')](_0x220f19)[_0x6f16('0x25')](function(_0x434c29){_0x5f2ffd[_0x6f16('0x1e')]=_0x434c29;if(_0x1078ca['query']['includeAll']){_0x541cc4[_0x6f16('0x3f')]=[{'all':!![]}];}return db[_0x6f16('0x29')][_0x6f16('0x40')](_0x541cc4);})['then'](function(_0x3d42fe){_0x5f2ffd[_0x6f16('0x41')]=_0x3d42fe;return _0x5f2ffd;})['then'](respondWithFilteredResult(_0x228230,_0x541cc4))[_0x6f16('0x42')](handleError(_0x228230,null));};exports[_0x6f16('0x43')]=function(_0x36c8d2,_0x2a67d6){var _0x5785f3={'raw':![],'where':{'id':_0x36c8d2['params']['id']}},_0x76d4dc={};_0x76d4dc[_0x6f16('0x31')]=_[_0x6f16('0x44')](db['DeskAccount']['rawAttributes']);_0x76d4dc['query']=_[_0x6f16('0x44')](_0x36c8d2[_0x6f16('0x2e')]);_0x76d4dc[_0x6f16('0x2f')]=_['intersection'](_0x76d4dc[_0x6f16('0x31')],_0x76d4dc[_0x6f16('0x2e')]);_0x5785f3[_0x6f16('0x32')]=_['intersection'](_0x76d4dc['model'],qs[_0x6f16('0x33')](_0x36c8d2[_0x6f16('0x2e')]['fields']));_0x5785f3[_0x6f16('0x32')]=_0x5785f3[_0x6f16('0x32')][_0x6f16('0x34')]?_0x5785f3['attributes']:_0x76d4dc[_0x6f16('0x31')];if(_0x36c8d2[_0x6f16('0x2e')][_0x6f16('0x45')]){_0x5785f3['include']=[{'all':!![]}];}_0x5785f3=_['merge']({},_0x5785f3,_0x36c8d2[_0x6f16('0x46')]);return db['DeskAccount'][_0x6f16('0x47')](_0x5785f3)[_0x6f16('0x25')](handleEntityNotFound(_0x2a67d6,null))['then'](respondWithResult(_0x2a67d6,null))[_0x6f16('0x42')](handleError(_0x2a67d6,null));};exports[_0x6f16('0x48')]=function(_0x1669b9,_0x4d1089){return db['DeskAccount']['create'](_0x1669b9[_0x6f16('0x49')],{})[_0x6f16('0x25')](respondWithResult(_0x4d1089,0xc9))[_0x6f16('0x42')](handleError(_0x4d1089,null));};exports['update']=function(_0x1b4090,_0x3536ba){if(_0x1b4090[_0x6f16('0x49')]['id']){delete _0x1b4090[_0x6f16('0x49')]['id'];}return db[_0x6f16('0x29')][_0x6f16('0x47')]({'where':{'id':_0x1b4090[_0x6f16('0x4a')]['id']}})[_0x6f16('0x25')](handleEntityNotFound(_0x3536ba,null))[_0x6f16('0x25')](saveUpdates(_0x1b4090['body'],null))['then'](respondWithResult(_0x3536ba,null))[_0x6f16('0x42')](handleError(_0x3536ba,null));};exports[_0x6f16('0x26')]=function(_0x319793,_0x50f661){return db[_0x6f16('0x29')][_0x6f16('0x47')]({'where':{'id':_0x319793[_0x6f16('0x4a')]['id']}})[_0x6f16('0x25')](handleEntityNotFound(_0x50f661,null))['then'](removeEntity(_0x50f661,null))[_0x6f16('0x42')](handleError(_0x50f661,null));};exports[_0x6f16('0x4b')]=function(_0x2a74fd,_0x3352ed,_0x1ae7c6){var _0x34e939={};var _0xea4fe6={};var _0x290d13;var _0x3d9c73;return db[_0x6f16('0x29')]['findOne']({'where':{'id':_0x2a74fd[_0x6f16('0x4a')]['id']}})[_0x6f16('0x25')](handleEntityNotFound(_0x3352ed,null))[_0x6f16('0x25')](function(_0x37f599){if(_0x37f599){_0x290d13=_0x37f599;_0xea4fe6[_0x6f16('0x31')]=_[_0x6f16('0x44')](db[_0x6f16('0x4c')][_0x6f16('0x2a')]);_0xea4fe6['query']=_[_0x6f16('0x44')](_0x2a74fd[_0x6f16('0x2e')]);_0xea4fe6['filters']=_[_0x6f16('0x30')](_0xea4fe6['model'],_0xea4fe6['query']);_0x34e939[_0x6f16('0x32')]=_[_0x6f16('0x30')](_0xea4fe6['model'],qs['fields'](_0x2a74fd[_0x6f16('0x2e')][_0x6f16('0x33')]));_0x34e939['attributes']=_0x34e939[_0x6f16('0x32')][_0x6f16('0x34')]?_0x34e939[_0x6f16('0x32')]:_0xea4fe6[_0x6f16('0x31')];_0x34e939[_0x6f16('0x37')]=qs[_0x6f16('0x38')](_0x2a74fd[_0x6f16('0x2e')][_0x6f16('0x38')]);_0x34e939[_0x6f16('0x39')]=qs[_0x6f16('0x2f')](_[_0x6f16('0x4d')](_0x2a74fd[_0x6f16('0x2e')],_0xea4fe6['filters']));if(_0x2a74fd['query']['filter']){_0x34e939[_0x6f16('0x39')]=_[_0x6f16('0x3b')](_0x34e939[_0x6f16('0x39')],{'$or':_[_0x6f16('0x3c')](_0x34e939['attributes'],function(_0x187286){var _0x2a2cbf={};_0x2a2cbf[_0x187286]={'$like':'%'+_0x2a74fd[_0x6f16('0x2e')]['filter']+'%'};return _0x2a2cbf;})});}_0x34e939=_[_0x6f16('0x3b')]({},_0x34e939,_0x2a74fd[_0x6f16('0x46')]);return _0x290d13['getConfigurations'](_0x34e939);}})[_0x6f16('0x25')](function(_0x15f2f2){if(_0x15f2f2){_0x3d9c73=_0x15f2f2['length'];if(!_0x2a74fd[_0x6f16('0x2e')][_0x6f16('0x35')](_0x6f16('0x4e'))){_0x34e939['limit']=qs['limit'](_0x2a74fd[_0x6f16('0x2e')]['limit']);_0x34e939[_0x6f16('0x1c')]=qs[_0x6f16('0x1c')](_0x2a74fd['query'][_0x6f16('0x1c')]);}return _0x290d13[_0x6f16('0x4b')](_0x34e939);}})[_0x6f16('0x25')](function(_0x5d3d2f){if(_0x5d3d2f){return _0x5d3d2f?{'count':_0x3d9c73,'rows':_0x5d3d2f}:null;}})['then'](respondWithResult(_0x3352ed,null))['catch'](handleError(_0x3352ed,null));};exports[_0x6f16('0x4f')]=function(_0x4f9860,_0x26983f,_0xa483e4){if(_0x4f9860[_0x6f16('0x49')]['id']){delete _0x4f9860[_0x6f16('0x49')]['id'];}return db[_0x6f16('0x29')][_0x6f16('0x50')]({'where':{'id':_0x4f9860[_0x6f16('0x4a')]['id']}})[_0x6f16('0x25')](handleEntityNotFound(_0x26983f,null))[_0x6f16('0x25')](function(_0x5c6df8){if(_0x5c6df8){_0x4f9860[_0x6f16('0x49')][_0x6f16('0x51')]=_0x5c6df8['id'];_0x4f9860[_0x6f16('0x49')][_0x6f16('0x52')]=integrations[_0x6f16('0x53')](_0x4f9860[_0x6f16('0x49')]['channel'],_0x4f9860[_0x6f16('0x49')][_0x6f16('0x3d')]);_0x4f9860[_0x6f16('0x49')]['Descriptions']=integrations['getDescriptions'](_0x4f9860['body'][_0x6f16('0x54')],_0x4f9860['body'][_0x6f16('0x3d')]);return db[_0x6f16('0x4c')][_0x6f16('0x48')](_0x4f9860[_0x6f16('0x49')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x6f16('0x55')}]});}return null;})[_0x6f16('0x25')](respondWithResult(_0x26983f,null))['catch'](handleError(_0x26983f,null));};exports[_0x6f16('0x56')]=function(_0x4f73c9,_0x4c681e,_0x4a70cb){var _0x7f54fb=[{'name':'priority','label':_0x6f16('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x10e940='';return db[_0x6f16('0x29')][_0x6f16('0x50')]({'where':{'id':_0x4f73c9[_0x6f16('0x4a')]['id']},'attributes':['id',_0x6f16('0x58'),_0x6f16('0x59'),_0x6f16('0x5a'),_0x6f16('0x5b'),_0x6f16('0x5c'),_0x6f16('0x5d'),_0x6f16('0x5e'),'tokenSecret']})[_0x6f16('0x25')](handleEntityNotFound(_0x4c681e,null))[_0x6f16('0x25')](function(_0x514a8e){if(_0x514a8e){_0x10e940=_0x514a8e['remoteUri'];var _0x216882=_0x10e940[_0x6f16('0x5f')](-0x1);if(_0x216882==='/'){_0x10e940=_0x10e940['substring'](0x0,_0x10e940[_0x6f16('0x60')](_0x216882));}var _0x24db4e={'method':_0x6f16('0x61'),'uri':util['format'](_0x6f16('0x62'),_0x10e940),'headers':{'Content-Type':_0x6f16('0x63'),'Accept':_0x6f16('0x63')},'json':!![]};if(_0x514a8e[_0x6f16('0x59')]==='basic'){_0x24db4e[_0x6f16('0x64')][_0x6f16('0x65')]=util[_0x6f16('0x66')](_0x6f16('0x67'),new Buffer(util[_0x6f16('0x66')](_0x6f16('0x68'),_0x514a8e[_0x6f16('0x5a')],_0x514a8e[_0x6f16('0x5b')]))[_0x6f16('0x69')](_0x6f16('0x6a')));}return rp(_0x24db4e)[_0x6f16('0x25')](function(_0x13d275){return _0x7f54fb[_0x6f16('0x6b')](_[_0x6f16('0x3c')](_0x13d275['_embedded'][_0x6f16('0x6c')],function(_0x583c43){return{'id':_0x583c43[_0x6f16('0x2d')],'name':_0x583c43[_0x6f16('0x2d')],'type':_0x583c43['type'],'active':_0x583c43[_0x6f16('0x6d')],'label':_0x583c43[_0x6f16('0x6e')],'custom':!![]};}));});}})[_0x6f16('0x25')](function(_0x3106cf){return{'count':_0x3106cf[_0x6f16('0x34')],'rows':_0x3106cf};})[_0x6f16('0x25')](respondWithResult(_0x4c681e,null))['catch'](function(_0x1cee73){var _0xade1f8=_0x4f73c9['query'][_0x6f16('0x6f')]?0x1f4:_0x1cee73[_0x6f16('0x70')]||0x1f4;logger['error'](_0x6f16('0x71'),_0x6f16('0x56'),_0xade1f8,JSON['stringify'](_0x1cee73));delete _0x1cee73[_0x6f16('0x2d')];if(_0xade1f8===0x191){_0xade1f8=0x190;}_0x4c681e[_0x6f16('0x1a')](_0xade1f8)[_0x6f16('0x28')](_0x4f73c9['query'][_0x6f16('0x6f')]?{'message':_0x6f16('0x72'),'statusCode':_0x1cee73[_0x6f16('0x70')]}:_0x1cee73);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2dfdfca..7ae846e 100644 --- a/server/api/intDeskAccount/intDeskAccount.model.js +++ b/server/api/intDeskAccount/intDeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abe=['../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x375fa3,_0x3d9e45){var _0x240dc7=function(_0x5e12cb){while(--_0x5e12cb){_0x375fa3['push'](_0x375fa3['shift']());}};_0x240dc7(++_0x3d9e45);}(_0x0abe,0x183));var _0xe0ab=function(_0x3e5da3,_0x100cbe){_0x3e5da3=_0x3e5da3-0x0;var _0x202bb6=_0x0abe[_0x3e5da3];return _0x202bb6;};'use strict';var _=require(_0xe0ab('0x0'));var util=require(_0xe0ab('0x1'));var logger=require(_0xe0ab('0x2'))(_0xe0ab('0x3'));var moment=require('moment');var BPromise=require(_0xe0ab('0x4'));var rp=require(_0xe0ab('0x5'));var fs=require('fs');var path=require(_0xe0ab('0x6'));var rimraf=require(_0xe0ab('0x7'));var config=require(_0xe0ab('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xe0ab('0x9'));module['exports']=function(_0x258c34,_0x2bb123){return _0x258c34[_0xe0ab('0xa')]('DeskAccount',attributes,{'tableName':_0xe0ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc80=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','exports','define'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xbc80,0xc6));var _0x0bc8=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0xbc80[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x0bc8('0x0'));var util=require(_0x0bc8('0x1'));var logger=require(_0x0bc8('0x2'))(_0x0bc8('0x3'));var moment=require(_0x0bc8('0x4'));var BPromise=require(_0x0bc8('0x5'));var rp=require(_0x0bc8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bc8('0x7'));var config=require(_0x0bc8('0x8'));var attributes=require(_0x0bc8('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x0bc8('0xa')]=function(_0x142db2,_0x5b7527){return _0x142db2[_0x0bc8('0xb')](_0x0bc8('0xc'),attributes,{'tableName':_0x0bc8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 6da41e3..afac043 100644 --- a/server/api/intDeskAccount/intDeskAccount.rpc.js +++ b/server/api/intDeskAccount/intDeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76a0=['http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','model','raw','ShowDeskAccount','stringify','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1a93a5,_0x13f256){var _0x4893a2=function(_0x4a176c){while(--_0x4a176c){_0x1a93a5['push'](_0x1a93a5['shift']());}};_0x4893a2(++_0x13f256);}(_0x76a0,0x1b8));var _0x076a=function(_0x15b298,_0x5bd763){_0x15b298=_0x15b298-0x0;var _0x301ee4=_0x76a0[_0x15b298];return _0x301ee4;};'use strict';var _=require(_0x076a('0x0'));var util=require('util');var moment=require(_0x076a('0x1'));var BPromise=require('bluebird');var rs=require(_0x076a('0x2'));var fs=require('fs');var Redis=require(_0x076a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x076a('0x4'));var logger=require('../../config/logger')(_0x076a('0x5'));var config=require(_0x076a('0x6'));var jayson=require(_0x076a('0x7'));var client=jayson['client'][_0x076a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1912a4,_0x458c75,_0xf598e4){return new BPromise(function(_0x4bd8dc,_0x76765){return client[_0x076a('0x9')](_0x1912a4,_0xf598e4)[_0x076a('0xa')](function(_0xc57bf0){logger['info'](_0x076a('0xb'),_0x458c75,_0x076a('0xc'));logger[_0x076a('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x458c75,_0x076a('0xc'),JSON['stringify'](_0xc57bf0));if(_0xc57bf0['error']){if(_0xc57bf0['error'][_0x076a('0xe')]===0x1f4){logger[_0x076a('0xf')](_0x076a('0xb'),_0x458c75,_0xc57bf0[_0x076a('0xf')]['message']);return _0x76765(_0xc57bf0[_0x076a('0xf')]['message']);}logger['error'](_0x076a('0xb'),_0x458c75,_0xc57bf0[_0x076a('0xf')][_0x076a('0x10')]);return _0x4bd8dc(_0xc57bf0[_0x076a('0xf')][_0x076a('0x10')]);}else{logger[_0x076a('0x11')](_0x076a('0xb'),_0x458c75,_0x076a('0xc'));_0x4bd8dc(_0xc57bf0[_0x076a('0x12')][_0x076a('0x10')]);}})[_0x076a('0x13')](function(_0x4ee4a8){logger['error'](_0x076a('0xb'),_0x458c75,_0x4ee4a8);_0x76765(_0x4ee4a8);});});}exports[_0x076a('0x14')]=function(_0x1f6719){var _0x1382ab=this;return new Promise(function(_0x11f76c,_0x438bc8){return db[_0x076a('0x15')][_0x076a('0x16')]({'raw':_0x1f6719['options']?_0x1f6719['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x18')]||null:null,'attributes':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x19')]||null:null,'limit':_0x1f6719[_0x076a('0x17')]?_0x1f6719['options']['limit']||null:null,'include':_0x1f6719[_0x076a('0x17')]?_0x1f6719[_0x076a('0x17')][_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x1f6719['options']['include'],function(_0xf4d5b7){return{'model':db[_0xf4d5b7[_0x076a('0x1c')]],'as':_0xf4d5b7['as'],'attributes':_0xf4d5b7[_0x076a('0x19')],'include':_0xf4d5b7['include']?_[_0x076a('0x1b')](_0xf4d5b7[_0x076a('0x1a')],function(_0x488142){return{'model':db[_0x488142[_0x076a('0x1c')]],'as':_0x488142['as'],'attributes':_0x488142[_0x076a('0x19')],'include':_0x488142[_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x488142[_0x076a('0x1a')],function(_0x530ccf){return{'model':db[_0x530ccf[_0x076a('0x1c')]],'as':_0x530ccf['as'],'attributes':_0x530ccf[_0x076a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x076a('0xa')](function(_0x2dde70){logger[_0x076a('0x11')](_0x076a('0x14'),_0x1f6719);logger[_0x076a('0xd')](_0x076a('0x14'),_0x1f6719,JSON['stringify'](_0x2dde70));_0x11f76c(_0x2dde70);})['catch'](function(_0x3e9999){logger[_0x076a('0xf')](_0x076a('0x14'),_0x3e9999[_0x076a('0x10')],_0x1f6719);_0x438bc8(_0x1382ab['error'](0x1f4,_0x3e9999[_0x076a('0x10')]));});});};exports['ShowDeskAccount']=function(_0x382cb3){var _0x3b82a7=this;return new Promise(function(_0x2ca386,_0x179ec8){return db[_0x076a('0x15')]['find']({'raw':_0x382cb3[_0x076a('0x17')]?_0x382cb3[_0x076a('0x17')][_0x076a('0x1d')]===undefined?!![]:![]:!![],'where':_0x382cb3['options']?_0x382cb3[_0x076a('0x17')][_0x076a('0x18')]||null:null,'attributes':_0x382cb3[_0x076a('0x17')]?_0x382cb3['options'][_0x076a('0x19')]||null:null,'include':_0x382cb3[_0x076a('0x17')]?_0x382cb3[_0x076a('0x17')][_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x382cb3[_0x076a('0x17')]['include'],function(_0x36170a){return{'model':db[_0x36170a[_0x076a('0x1c')]],'as':_0x36170a['as'],'attributes':_0x36170a[_0x076a('0x19')],'include':_0x36170a[_0x076a('0x1a')]?_[_0x076a('0x1b')](_0x36170a['include'],function(_0x3d7ef9){return{'model':db[_0x3d7ef9[_0x076a('0x1c')]],'as':_0x3d7ef9['as'],'attributes':_0x3d7ef9[_0x076a('0x19')],'include':_0x3d7ef9[_0x076a('0x1a')]?_['map'](_0x3d7ef9[_0x076a('0x1a')],function(_0x550ded){return{'model':db[_0x550ded['model']],'as':_0x550ded['as'],'attributes':_0x550ded[_0x076a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x076a('0xa')](function(_0xcb579d){logger[_0x076a('0x11')](_0x076a('0x1e'),_0x382cb3);logger[_0x076a('0xd')](_0x076a('0x1e'),_0x382cb3,JSON[_0x076a('0x1f')](_0xcb579d));_0x2ca386(_0xcb579d);})[_0x076a('0x13')](function(_0x3da5c0){logger[_0x076a('0xf')](_0x076a('0x1e'),_0x3da5c0[_0x076a('0x10')],_0x382cb3);_0x179ec8(_0x3b82a7[_0x076a('0xf')](0x1f4,_0x3da5c0[_0x076a('0x10')]));});});}; \ No newline at end of file +var _0xb324=['GetDeskAccount','findAll','options','raw','where','attributes','include','model','info','ShowDeskAccount','DeskAccount','find','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x73a98f,_0xa35b69){var _0x52a7f8=function(_0x334f1a){while(--_0x334f1a){_0x73a98f['push'](_0x73a98f['shift']());}};_0x52a7f8(++_0xa35b69);}(_0xb324,0x1c9));var _0x4b32=function(_0x4aad01,_0x4d9f82){_0x4aad01=_0x4aad01-0x0;var _0x14cfe2=_0xb324[_0x4aad01];return _0x14cfe2;};'use strict';var _=require(_0x4b32('0x0'));var util=require(_0x4b32('0x1'));var moment=require(_0x4b32('0x2'));var BPromise=require(_0x4b32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b32('0x4'));var db=require(_0x4b32('0x5'))['db'];var utils=require(_0x4b32('0x6'));var logger=require(_0x4b32('0x7'))(_0x4b32('0x8'));var config=require(_0x4b32('0x9'));var jayson=require(_0x4b32('0xa'));var client=jayson[_0x4b32('0xb')][_0x4b32('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8bcf20,_0x3999e7,_0x5c2a6e){return new BPromise(function(_0x10db29,_0x2c1cd0){return client['request'](_0x8bcf20,_0x5c2a6e)[_0x4b32('0xd')](function(_0x427ed1){logger['info'](_0x4b32('0xe'),_0x3999e7,_0x4b32('0xf'));logger[_0x4b32('0x10')](_0x4b32('0x11'),_0x3999e7,_0x4b32('0xf'),JSON[_0x4b32('0x12')](_0x427ed1));if(_0x427ed1[_0x4b32('0x13')]){if(_0x427ed1[_0x4b32('0x13')][_0x4b32('0x14')]===0x1f4){logger[_0x4b32('0x13')](_0x4b32('0xe'),_0x3999e7,_0x427ed1[_0x4b32('0x13')][_0x4b32('0x15')]);return _0x2c1cd0(_0x427ed1['error']['message']);}logger[_0x4b32('0x13')](_0x4b32('0xe'),_0x3999e7,_0x427ed1[_0x4b32('0x13')][_0x4b32('0x15')]);return _0x10db29(_0x427ed1[_0x4b32('0x13')]['message']);}else{logger['info'](_0x4b32('0xe'),_0x3999e7,_0x4b32('0xf'));_0x10db29(_0x427ed1[_0x4b32('0x16')][_0x4b32('0x15')]);}})[_0x4b32('0x17')](function(_0x3af337){logger[_0x4b32('0x13')]('DeskAccount,\x20%s,\x20%s',_0x3999e7,_0x3af337);_0x2c1cd0(_0x3af337);});});}exports[_0x4b32('0x18')]=function(_0x25d9e4){var _0x53554e=this;return new Promise(function(_0x2f6fba,_0x20a773){return db['DeskAccount'][_0x4b32('0x19')]({'raw':_0x25d9e4[_0x4b32('0x1a')]?_0x25d9e4[_0x4b32('0x1a')][_0x4b32('0x1b')]===undefined?!![]:![]:!![],'where':_0x25d9e4[_0x4b32('0x1a')]?_0x25d9e4[_0x4b32('0x1a')][_0x4b32('0x1c')]||null:null,'attributes':_0x25d9e4[_0x4b32('0x1a')]?_0x25d9e4[_0x4b32('0x1a')][_0x4b32('0x1d')]||null:null,'limit':_0x25d9e4[_0x4b32('0x1a')]?_0x25d9e4['options']['limit']||null:null,'include':_0x25d9e4[_0x4b32('0x1a')]?_0x25d9e4['options'][_0x4b32('0x1e')]?_['map'](_0x25d9e4[_0x4b32('0x1a')][_0x4b32('0x1e')],function(_0x42cf9e){return{'model':db[_0x42cf9e['model']],'as':_0x42cf9e['as'],'attributes':_0x42cf9e[_0x4b32('0x1d')],'include':_0x42cf9e[_0x4b32('0x1e')]?_['map'](_0x42cf9e[_0x4b32('0x1e')],function(_0x29d2e8){return{'model':db[_0x29d2e8[_0x4b32('0x1f')]],'as':_0x29d2e8['as'],'attributes':_0x29d2e8[_0x4b32('0x1d')],'include':_0x29d2e8[_0x4b32('0x1e')]?_['map'](_0x29d2e8[_0x4b32('0x1e')],function(_0x34cb42){return{'model':db[_0x34cb42[_0x4b32('0x1f')]],'as':_0x34cb42['as'],'attributes':_0x34cb42[_0x4b32('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45b10d){logger[_0x4b32('0x20')](_0x4b32('0x18'),_0x25d9e4);logger[_0x4b32('0x10')](_0x4b32('0x18'),_0x25d9e4,JSON[_0x4b32('0x12')](_0x45b10d));_0x2f6fba(_0x45b10d);})[_0x4b32('0x17')](function(_0x340433){logger[_0x4b32('0x13')](_0x4b32('0x18'),_0x340433[_0x4b32('0x15')],_0x25d9e4);_0x20a773(_0x53554e['error'](0x1f4,_0x340433[_0x4b32('0x15')]));});});};exports[_0x4b32('0x21')]=function(_0x80359f){var _0x4bd292=this;return new Promise(function(_0x12ccc4,_0x3b2fd6){return db[_0x4b32('0x22')][_0x4b32('0x23')]({'raw':_0x80359f[_0x4b32('0x1a')]?_0x80359f[_0x4b32('0x1a')][_0x4b32('0x1b')]===undefined?!![]:![]:!![],'where':_0x80359f[_0x4b32('0x1a')]?_0x80359f['options'][_0x4b32('0x1c')]||null:null,'attributes':_0x80359f[_0x4b32('0x1a')]?_0x80359f['options'][_0x4b32('0x1d')]||null:null,'include':_0x80359f[_0x4b32('0x1a')]?_0x80359f['options']['include']?_[_0x4b32('0x24')](_0x80359f['options'][_0x4b32('0x1e')],function(_0x40a6cc){return{'model':db[_0x40a6cc[_0x4b32('0x1f')]],'as':_0x40a6cc['as'],'attributes':_0x40a6cc[_0x4b32('0x1d')],'include':_0x40a6cc[_0x4b32('0x1e')]?_[_0x4b32('0x24')](_0x40a6cc[_0x4b32('0x1e')],function(_0x3bffec){return{'model':db[_0x3bffec['model']],'as':_0x3bffec['as'],'attributes':_0x3bffec[_0x4b32('0x1d')],'include':_0x3bffec[_0x4b32('0x1e')]?_['map'](_0x3bffec['include'],function(_0x533143){return{'model':db[_0x533143[_0x4b32('0x1f')]],'as':_0x533143['as'],'attributes':_0x533143['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b32('0xd')](function(_0x194206){logger['info'](_0x4b32('0x21'),_0x80359f);logger['debug'](_0x4b32('0x21'),_0x80359f,JSON[_0x4b32('0x12')](_0x194206));_0x12ccc4(_0x194206);})['catch'](function(_0x24fab7){logger['error'](_0x4b32('0x21'),_0x24fab7['message'],_0x80359f);_0x3b2fd6(_0x4bd292['error'](0x1f4,_0x24fab7[_0x4b32('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8b657d7..c119881 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3ca8c9,_0x43013e){var _0x340c7a=function(_0x161419){while(--_0x161419){_0x3ca8c9['push'](_0x3ca8c9['shift']());}};_0x340c7a(++_0x43013e);}(_0x34e8,0x12c));var _0x834e=function(_0x30b440,_0x41eeab){_0x30b440=_0x30b440-0x0;var _0x2c1d22=_0x34e8[_0x30b440];return _0x2c1d22;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x272c81,_0x5b6d26){var _0x4f5ef0=function(_0x138e90){while(--_0x138e90){_0x272c81['push'](_0x272c81['shift']());}};_0x4f5ef0(++_0x5b6d26);}(_0x7217,0x19e));var _0x7721=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x7217[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d358c4e..674354a 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe630=['STRING','sequelize'];(function(_0x2af3e6,_0x22aee5){var _0x37ca36=function(_0x2a01a1){while(--_0x2a01a1){_0x2af3e6['push'](_0x2af3e6['shift']());}};_0x37ca36(++_0x22aee5);}(_0xe630,0x1a5));var _0x0e63=function(_0x5c7d4b,_0x305110){_0x5c7d4b=_0x5c7d4b-0x0;var _0x422e90=_0xe630[_0x5c7d4b];return _0x422e90;};'use strict';var Sequelize=require(_0x0e63('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e63('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbdfa=['exports','STRING'];(function(_0x4929d4,_0xc5450b){var _0x2cf2ce=function(_0x4df81a){while(--_0x4df81a){_0x4929d4['push'](_0x4929d4['shift']());}};_0x2cf2ce(++_0xc5450b);}(_0xbdfa,0x160));var _0xabdf=function(_0x377a1a,_0x1b2918){_0x377a1a=_0x377a1a-0x0;var _0x1b64c0=_0xbdfa[_0x377a1a];return _0x1b64c0;};'use strict';var Sequelize=require('sequelize');module[_0xabdf('0x0')]={'name':{'type':Sequelize[_0xabdf('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4d92a27..cffd38d 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x714c=['DeskConfiguration','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0x714c,0x123));var _0xc714=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0x714c[_0xefb4e];return _0x36c78c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc714('0x0'));var jsonpatch=require(_0xc714('0x1'));var rp=require(_0xc714('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc714('0x3'));var util=require(_0xc714('0x4'));var path=require(_0xc714('0x5'));var sox=require(_0xc714('0x6'));var csv=require(_0xc714('0x7'));var ejs=require(_0xc714('0x8'));var fs=require('fs');var fs_extra=require(_0xc714('0x9'));var _=require(_0xc714('0xa'));var squel=require('squel');var crypto=require(_0xc714('0xb'));var jsforce=require(_0xc714('0xc'));var deskjs=require(_0xc714('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc714('0xe'));var Papa=require(_0xc714('0xf'));var Redis=require(_0xc714('0x10'));var authService=require(_0xc714('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc714('0x12'));var hardwareService=require(_0xc714('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc714('0x14'));var config=require(_0xc714('0x15'));var licenseUtil=require(_0xc714('0x16'));var db=require(_0xc714('0x17'))['db'];function respondWithStatusCode(_0x410ef5,_0x3089f5){_0x3089f5=_0x3089f5||0xcc;return function(_0x53b1d2){if(_0x53b1d2){return _0x410ef5['sendStatus'](_0x3089f5);}return _0x410ef5['status'](_0x3089f5)[_0xc714('0x18')]();};}function respondWithResult(_0x567591,_0xd170f5){_0xd170f5=_0xd170f5||0xc8;return function(_0x4f6a6f){if(_0x4f6a6f){return _0x567591['status'](_0xd170f5)[_0xc714('0x19')](_0x4f6a6f);}};}function respondWithFilteredResult(_0x2f31da,_0x41e8ca){return function(_0x407948){if(_0x407948){var _0xdaf234=typeof _0x41e8ca['offset']===_0xc714('0x1a')&&typeof _0x41e8ca[_0xc714('0x1b')]===_0xc714('0x1a');var _0xb40869=_0x407948[_0xc714('0x1c')];var _0x5a3f57=_0xdaf234?0x0:_0x41e8ca[_0xc714('0x1d')];var _0x4d4697=_0xdaf234?_0x407948[_0xc714('0x1c')]:_0x41e8ca[_0xc714('0x1d')]+_0x41e8ca[_0xc714('0x1b')];var _0x35dfb0;if(_0x4d4697>=_0xb40869){_0x4d4697=_0xb40869;_0x35dfb0=0xc8;}else{_0x35dfb0=0xce;}_0x2f31da[_0xc714('0x1e')](_0x35dfb0);return _0x2f31da[_0xc714('0x1f')](_0xc714('0x20'),_0x5a3f57+'-'+_0x4d4697+'/'+_0xb40869)['json'](_0x407948);}return null;};}function patchUpdates(_0x309a0d){return function(_0x3768e0){try{jsonpatch[_0xc714('0x21')](_0x3768e0,_0x309a0d,!![]);}catch(_0x36c99d){return BPromise[_0xc714('0x22')](_0x36c99d);}return _0x3768e0[_0xc714('0x23')]();};}function saveUpdates(_0x564bf5,_0x5e61e7){return function(_0x4ea8bb){if(_0x4ea8bb){return _0x4ea8bb['update'](_0x564bf5)[_0xc714('0x24')](function(_0x176548){return _0x176548;});}return null;};}function removeEntity(_0xed9f6,_0x204497){return function(_0x5eb991){if(_0x5eb991){return _0x5eb991[_0xc714('0x25')]()[_0xc714('0x24')](function(){_0xed9f6[_0xc714('0x1e')](0xcc)[_0xc714('0x18')]();});}};}function handleEntityNotFound(_0x2c769c,_0x65744f){return function(_0x28f045){if(!_0x28f045){_0x2c769c[_0xc714('0x26')](0x194);}return _0x28f045;};}function handleError(_0x376803,_0x323738){_0x323738=_0x323738||0x1f4;return function(_0x436c89){logger['error'](_0x436c89['stack']);if(_0x436c89['name']){delete _0x436c89[_0xc714('0x27')];}_0x376803[_0xc714('0x1e')](_0x323738)['send'](_0x436c89);};}exports[_0xc714('0x28')]=function(_0x47adf0,_0x4ab5ac){var _0x381d8f={},_0x4e8445={},_0x339976={'count':0x0,'rows':[]};var _0x38b665=_['map'](db[_0xc714('0x29')][_0xc714('0x2a')],function(_0x3a0638){return{'name':_0x3a0638[_0xc714('0x2b')],'type':_0x3a0638['type']['key']};});_0x4e8445[_0xc714('0x2c')]=_[_0xc714('0x2d')](_0x38b665,_0xc714('0x27'));_0x4e8445[_0xc714('0x2e')]=_['keys'](_0x47adf0[_0xc714('0x2e')]);_0x4e8445[_0xc714('0x2f')]=_['intersection'](_0x4e8445['model'],_0x4e8445['query']);_0x381d8f[_0xc714('0x30')]=_[_0xc714('0x31')](_0x4e8445['model'],qs[_0xc714('0x32')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x32')]));_0x381d8f[_0xc714('0x30')]=_0x381d8f[_0xc714('0x30')][_0xc714('0x33')]?_0x381d8f[_0xc714('0x30')]:_0x4e8445[_0xc714('0x2c')];if(!_0x47adf0[_0xc714('0x2e')][_0xc714('0x34')]('nolimit')){_0x381d8f[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x47adf0[_0xc714('0x2e')]['limit']);_0x381d8f[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x1d')]);}_0x381d8f[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x47adf0[_0xc714('0x2e')][_0xc714('0x36')]);_0x381d8f['where']=qs[_0xc714('0x2f')](_['pick'](_0x47adf0['query'],_0x4e8445['filters']),_0x38b665);if(_0x47adf0[_0xc714('0x2e')][_0xc714('0x37')]){_0x381d8f[_0xc714('0x38')]=_[_0xc714('0x39')](_0x381d8f[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x38b665,function(_0x21f4ab){if(_0x21f4ab[_0xc714('0x3a')]!==_0xc714('0x3b')){var _0x5de3a8={};_0x5de3a8[_0x21f4ab[_0xc714('0x27')]]={'$like':'%'+_0x47adf0[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0x5de3a8;}})});}_0x381d8f=_['merge']({},_0x381d8f,_0x47adf0[_0xc714('0x3c')]);var _0x35ada2={'where':_0x381d8f[_0xc714('0x38')]};return db[_0xc714('0x29')][_0xc714('0x1c')](_0x35ada2)[_0xc714('0x24')](function(_0xee0155){_0x339976[_0xc714('0x1c')]=_0xee0155;if(_0x47adf0[_0xc714('0x2e')]['includeAll']){_0x381d8f[_0xc714('0x3d')]=[{'all':!![]}];}return db[_0xc714('0x29')][_0xc714('0x3e')](_0x381d8f);})[_0xc714('0x24')](function(_0x2eb88a){_0x339976[_0xc714('0x3f')]=_0x2eb88a;return _0x339976;})['then'](respondWithFilteredResult(_0x4ab5ac,_0x381d8f))[_0xc714('0x40')](handleError(_0x4ab5ac,null));};exports[_0xc714('0x41')]=function(_0x1445dd,_0x43ccb3){var _0x48c8ea={'raw':![],'where':{'id':_0x1445dd[_0xc714('0x42')]['id']}},_0x2425ed={};_0x2425ed[_0xc714('0x2c')]=_[_0xc714('0x43')](db[_0xc714('0x29')][_0xc714('0x2a')]);_0x2425ed[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x1445dd[_0xc714('0x2e')]);_0x2425ed[_0xc714('0x2f')]=_[_0xc714('0x31')](_0x2425ed[_0xc714('0x2c')],_0x2425ed[_0xc714('0x2e')]);_0x48c8ea[_0xc714('0x30')]=_['intersection'](_0x2425ed[_0xc714('0x2c')],qs[_0xc714('0x32')](_0x1445dd[_0xc714('0x2e')][_0xc714('0x32')]));_0x48c8ea[_0xc714('0x30')]=_0x48c8ea[_0xc714('0x30')][_0xc714('0x33')]?_0x48c8ea[_0xc714('0x30')]:_0x2425ed[_0xc714('0x2c')];if(_0x1445dd[_0xc714('0x2e')][_0xc714('0x44')]){_0x48c8ea[_0xc714('0x3d')]=[{'all':!![]}];}_0x48c8ea=_[_0xc714('0x39')]({},_0x48c8ea,_0x1445dd[_0xc714('0x3c')]);return db[_0xc714('0x29')]['find'](_0x48c8ea)[_0xc714('0x24')](handleEntityNotFound(_0x43ccb3,null))[_0xc714('0x24')](respondWithResult(_0x43ccb3,null))['catch'](handleError(_0x43ccb3,null));};exports[_0xc714('0x45')]=function(_0x4e08f2,_0x541c95){return db[_0xc714('0x29')][_0xc714('0x45')](_0x4e08f2[_0xc714('0x46')],{})[_0xc714('0x24')](respondWithResult(_0x541c95,0xc9))['catch'](handleError(_0x541c95,null));};exports[_0xc714('0x47')]=function(_0x54c3b0,_0x244571){if(_0x54c3b0['body']['id']){delete _0x54c3b0[_0xc714('0x46')]['id'];}return db[_0xc714('0x29')][_0xc714('0x48')]({'where':{'id':_0x54c3b0['params']['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x244571,null))[_0xc714('0x24')](saveUpdates(_0x54c3b0['body'],null))[_0xc714('0x24')](respondWithResult(_0x244571,null))[_0xc714('0x40')](handleError(_0x244571,null));};exports[_0xc714('0x25')]=function(_0x3bd26e,_0x47c90b){return db[_0xc714('0x29')][_0xc714('0x48')]({'where':{'id':_0x3bd26e['params']['id']}})['then'](handleEntityNotFound(_0x47c90b,null))['then'](removeEntity(_0x47c90b,null))[_0xc714('0x40')](handleError(_0x47c90b,null));};exports[_0xc714('0x49')]=function(_0x23035c,_0xab56ec,_0x434854){var _0xf39c61={};var _0x431cb4={};var _0x53f277;var _0x3d9031;return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x23035c[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0xab56ec,null))['then'](function(_0x50cda8){if(_0x50cda8){_0x53f277=_0x50cda8;_0x431cb4['model']=_[_0xc714('0x43')](db[_0xc714('0x4b')][_0xc714('0x2a')]);_0x431cb4[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x23035c[_0xc714('0x2e')]);_0x431cb4[_0xc714('0x2f')]=_[_0xc714('0x31')](_0x431cb4[_0xc714('0x2c')],_0x431cb4[_0xc714('0x2e')]);_0xf39c61[_0xc714('0x30')]=_['intersection'](_0x431cb4['model'],qs['fields'](_0x23035c[_0xc714('0x2e')][_0xc714('0x32')]));_0xf39c61[_0xc714('0x30')]=_0xf39c61['attributes']['length']?_0xf39c61[_0xc714('0x30')]:_0x431cb4[_0xc714('0x2c')];_0xf39c61[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x23035c[_0xc714('0x2e')][_0xc714('0x36')]);_0xf39c61[_0xc714('0x38')]=qs[_0xc714('0x2f')](_[_0xc714('0x4c')](_0x23035c[_0xc714('0x2e')],_0x431cb4[_0xc714('0x2f')]));if(_0x23035c[_0xc714('0x2e')][_0xc714('0x37')]){_0xf39c61['where']=_[_0xc714('0x39')](_0xf39c61[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0xf39c61[_0xc714('0x30')],function(_0x354eed){var _0xf6bc8b={};_0xf6bc8b[_0x354eed]={'$like':'%'+_0x23035c[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0xf6bc8b;})});}_0xf39c61=_[_0xc714('0x39')]({},_0xf39c61,_0x23035c[_0xc714('0x3c')]);return _0x53f277[_0xc714('0x49')](_0xf39c61);}})[_0xc714('0x24')](function(_0xadf84f){if(_0xadf84f){_0x3d9031=_0xadf84f[_0xc714('0x33')];if(!_0x23035c[_0xc714('0x2e')][_0xc714('0x34')](_0xc714('0x4d'))){_0xf39c61[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x23035c[_0xc714('0x2e')][_0xc714('0x1b')]);_0xf39c61[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x23035c[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x53f277[_0xc714('0x49')](_0xf39c61);}})[_0xc714('0x24')](function(_0x43bb96){if(_0x43bb96){return _0x43bb96?{'count':_0x3d9031,'rows':_0x43bb96}:null;}})[_0xc714('0x24')](respondWithResult(_0xab56ec,null))[_0xc714('0x40')](handleError(_0xab56ec,null));};exports[_0xc714('0x4e')]=function(_0x279c35,_0x4e4907,_0x4ef87c){var _0x2749b3={};var _0x4619f={};var _0x5dbf46;var _0x4fe2f5;return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x279c35[_0xc714('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e4907,null))[_0xc714('0x24')](function(_0x34920a){if(_0x34920a){_0x5dbf46=_0x34920a;_0x4619f[_0xc714('0x2c')]=_['keys'](db[_0xc714('0x4b')][_0xc714('0x2a')]);_0x4619f['query']=_[_0xc714('0x43')](_0x279c35['query']);_0x4619f[_0xc714('0x2f')]=_['intersection'](_0x4619f['model'],_0x4619f[_0xc714('0x2e')]);_0x2749b3[_0xc714('0x30')]=_['intersection'](_0x4619f[_0xc714('0x2c')],qs[_0xc714('0x32')](_0x279c35[_0xc714('0x2e')][_0xc714('0x32')]));_0x2749b3[_0xc714('0x30')]=_0x2749b3[_0xc714('0x30')][_0xc714('0x33')]?_0x2749b3[_0xc714('0x30')]:_0x4619f[_0xc714('0x2c')];_0x2749b3[_0xc714('0x35')]=qs[_0xc714('0x36')](_0x279c35[_0xc714('0x2e')]['sort']);_0x2749b3[_0xc714('0x38')]=qs[_0xc714('0x2f')](_[_0xc714('0x4c')](_0x279c35[_0xc714('0x2e')],_0x4619f['filters']));if(_0x279c35['query']['filter']){_0x2749b3[_0xc714('0x38')]=_[_0xc714('0x39')](_0x2749b3[_0xc714('0x38')],{'$or':_['map'](_0x2749b3['attributes'],function(_0x39f115){var _0xc7ce3d={};_0xc7ce3d[_0x39f115]={'$like':'%'+_0x279c35[_0xc714('0x2e')]['filter']+'%'};return _0xc7ce3d;})});}_0x2749b3=_['merge']({},_0x2749b3,_0x279c35[_0xc714('0x3c')]);return _0x5dbf46[_0xc714('0x4e')](_0x2749b3);}})[_0xc714('0x24')](function(_0x1de1eb){if(_0x1de1eb){_0x4fe2f5=_0x1de1eb[_0xc714('0x33')];if(!_0x279c35['query'][_0xc714('0x34')](_0xc714('0x4d'))){_0x2749b3[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x279c35[_0xc714('0x2e')][_0xc714('0x1b')]);_0x2749b3['offset']=qs['offset'](_0x279c35[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x5dbf46['getSubjects'](_0x2749b3);}})[_0xc714('0x24')](function(_0x511087){if(_0x511087){return _0x511087?{'count':_0x4fe2f5,'rows':_0x511087}:null;}})[_0xc714('0x24')](respondWithResult(_0x4e4907,null))[_0xc714('0x40')](handleError(_0x4e4907,null));};exports['getDescriptions']=function(_0x29cea9,_0x1e45b3,_0x4202d5){var _0x43dfb3={};var _0x47ebb6={};var _0x9cb282;var _0x1c2e7c;return db[_0xc714('0x29')][_0xc714('0x4a')]({'where':{'id':_0x29cea9[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x1e45b3,null))[_0xc714('0x24')](function(_0x53924c){if(_0x53924c){_0x9cb282=_0x53924c;_0x47ebb6[_0xc714('0x2c')]=_[_0xc714('0x43')](db[_0xc714('0x4b')]['rawAttributes']);_0x47ebb6[_0xc714('0x2e')]=_[_0xc714('0x43')](_0x29cea9['query']);_0x47ebb6['filters']=_[_0xc714('0x31')](_0x47ebb6[_0xc714('0x2c')],_0x47ebb6[_0xc714('0x2e')]);_0x43dfb3[_0xc714('0x30')]=_['intersection'](_0x47ebb6['model'],qs['fields'](_0x29cea9[_0xc714('0x2e')]['fields']));_0x43dfb3[_0xc714('0x30')]=_0x43dfb3[_0xc714('0x30')][_0xc714('0x33')]?_0x43dfb3[_0xc714('0x30')]:_0x47ebb6[_0xc714('0x2c')];_0x43dfb3[_0xc714('0x35')]=qs['sort'](_0x29cea9[_0xc714('0x2e')][_0xc714('0x36')]);_0x43dfb3['where']=qs[_0xc714('0x2f')](_['pick'](_0x29cea9[_0xc714('0x2e')],_0x47ebb6[_0xc714('0x2f')]));if(_0x29cea9['query'][_0xc714('0x37')]){_0x43dfb3['where']=_['merge'](_0x43dfb3[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x43dfb3[_0xc714('0x30')],function(_0x24088c){var _0x4a31f7={};_0x4a31f7[_0x24088c]={'$like':'%'+_0x29cea9[_0xc714('0x2e')]['filter']+'%'};return _0x4a31f7;})});}_0x43dfb3=_[_0xc714('0x39')]({},_0x43dfb3,_0x29cea9[_0xc714('0x3c')]);return _0x9cb282['getDescriptions'](_0x43dfb3);}})[_0xc714('0x24')](function(_0x292dda){if(_0x292dda){_0x1c2e7c=_0x292dda[_0xc714('0x33')];if(!_0x29cea9['query'][_0xc714('0x34')](_0xc714('0x4d'))){_0x43dfb3[_0xc714('0x1b')]=qs[_0xc714('0x1b')](_0x29cea9[_0xc714('0x2e')][_0xc714('0x1b')]);_0x43dfb3[_0xc714('0x1d')]=qs[_0xc714('0x1d')](_0x29cea9['query']['offset']);}return _0x9cb282[_0xc714('0x4f')](_0x43dfb3);}})[_0xc714('0x24')](function(_0x21a705){if(_0x21a705){return _0x21a705?{'count':_0x1c2e7c,'rows':_0x21a705}:null;}})['then'](respondWithResult(_0x1e45b3,null))[_0xc714('0x40')](handleError(_0x1e45b3,null));};exports['getTags']=function(_0xe1be16,_0x3a394d,_0x4738b7){var _0x565a26={};var _0x17c042={};var _0x454aab;var _0x4c34a0;return db[_0xc714('0x29')][_0xc714('0x4a')]({'where':{'id':_0xe1be16['params']['id']}})[_0xc714('0x24')](handleEntityNotFound(_0x3a394d,null))[_0xc714('0x24')](function(_0xeaec2f){if(_0xeaec2f){_0x454aab=_0xeaec2f;_0x17c042[_0xc714('0x2c')]=_['keys'](db['Tag'][_0xc714('0x2a')]);_0x17c042[_0xc714('0x2e')]=_[_0xc714('0x43')](_0xe1be16[_0xc714('0x2e')]);_0x17c042[_0xc714('0x2f')]=_['intersection'](_0x17c042[_0xc714('0x2c')],_0x17c042[_0xc714('0x2e')]);_0x565a26[_0xc714('0x30')]=_[_0xc714('0x31')](_0x17c042[_0xc714('0x2c')],qs[_0xc714('0x32')](_0xe1be16[_0xc714('0x2e')][_0xc714('0x32')]));_0x565a26[_0xc714('0x30')]=_0x565a26[_0xc714('0x30')][_0xc714('0x33')]?_0x565a26['attributes']:_0x17c042['model'];_0x565a26[_0xc714('0x35')]=qs['sort'](_0xe1be16[_0xc714('0x2e')][_0xc714('0x36')]);_0x565a26['where']=qs[_0xc714('0x2f')](_['pick'](_0xe1be16[_0xc714('0x2e')],_0x17c042[_0xc714('0x2f')]));if(_0xe1be16[_0xc714('0x2e')][_0xc714('0x37')]){_0x565a26[_0xc714('0x38')]=_[_0xc714('0x39')](_0x565a26[_0xc714('0x38')],{'$or':_[_0xc714('0x2d')](_0x565a26[_0xc714('0x30')],function(_0x3e5c11){var _0x301cb1={};_0x301cb1[_0x3e5c11]={'$like':'%'+_0xe1be16[_0xc714('0x2e')][_0xc714('0x37')]+'%'};return _0x301cb1;})});}_0x565a26=_[_0xc714('0x39')]({},_0x565a26,_0xe1be16[_0xc714('0x3c')]);return _0x454aab[_0xc714('0x50')](_0x565a26);}})['then'](function(_0x3766f8){if(_0x3766f8){_0x4c34a0=_0x3766f8['length'];if(!_0xe1be16[_0xc714('0x2e')][_0xc714('0x34')](_0xc714('0x4d'))){_0x565a26['limit']=qs[_0xc714('0x1b')](_0xe1be16[_0xc714('0x2e')][_0xc714('0x1b')]);_0x565a26[_0xc714('0x1d')]=qs['offset'](_0xe1be16[_0xc714('0x2e')][_0xc714('0x1d')]);}return _0x454aab[_0xc714('0x50')](_0x565a26);}})[_0xc714('0x24')](function(_0x23957a){if(_0x23957a){return _0x23957a?{'count':_0x4c34a0,'rows':_0x23957a}:null;}})['then'](respondWithResult(_0x3a394d,null))[_0xc714('0x40')](handleError(_0x3a394d,null));};exports[_0xc714('0x51')]=function(_0x3eca5f,_0xce200e,_0x4def8e){if(_0x3eca5f[_0xc714('0x46')]['id']){delete _0x3eca5f[_0xc714('0x46')]['id'];}return db['DeskConfiguration'][_0xc714('0x4a')]({'where':{'id':_0x3eca5f[_0xc714('0x42')]['id']}})[_0xc714('0x24')](handleEntityNotFound(_0xce200e,null))[_0xc714('0x24')](function(_0x1ade86){if(_0x1ade86){return _0x1ade86[_0xc714('0x51')](_0x3eca5f[_0xc714('0x46')][_0xc714('0x52')]||[]);}return null;})['then'](respondWithResult(_0xce200e,null))[_0xc714('0x40')](handleError(_0xce200e,null));}; \ No newline at end of file +var _0x0ed1=['options','includeAll','include','findAll','rows','show','catch','create','body','find','params','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge'];(function(_0x29b2eb,_0x3669ea){var _0x521dee=function(_0x395efc){while(--_0x395efc){_0x29b2eb['push'](_0x29b2eb['shift']());}};_0x521dee(++_0x3669ea);}(_0x0ed1,0xbb));var _0x10ed=function(_0xdc4048,_0x5b5c5b){_0xdc4048=_0xdc4048-0x0;var _0x48c414=_0x0ed1[_0xdc4048];return _0x48c414;};'use strict';var emlformat=require(_0x10ed('0x0'));var rimraf=require(_0x10ed('0x1'));var zipdir=require(_0x10ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x10ed('0x3'));var moment=require(_0x10ed('0x4'));var BPromise=require(_0x10ed('0x5'));var Mustache=require(_0x10ed('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x10ed('0x7'));var ejs=require(_0x10ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x10ed('0x9'));var crypto=require(_0x10ed('0xa'));var jsforce=require(_0x10ed('0xb'));var deskjs=require(_0x10ed('0xc'));var toCsv=require(_0x10ed('0x7'));var querystring=require(_0x10ed('0xd'));var Papa=require(_0x10ed('0xe'));var Redis=require('ioredis');var authService=require(_0x10ed('0xf'));var qs=require(_0x10ed('0x10'));var as=require(_0x10ed('0x11'));var hardwareService=require(_0x10ed('0x12'));var logger=require(_0x10ed('0x13'))(_0x10ed('0x14'));var utils=require(_0x10ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x10ed('0x16'));var db=require(_0x10ed('0x17'))['db'];function respondWithStatusCode(_0x2379c0,_0x581b53){_0x581b53=_0x581b53||0xcc;return function(_0x562ffa){if(_0x562ffa){return _0x2379c0[_0x10ed('0x18')](_0x581b53);}return _0x2379c0['status'](_0x581b53)[_0x10ed('0x19')]();};}function respondWithResult(_0x1e55c3,_0x29f2b3){_0x29f2b3=_0x29f2b3||0xc8;return function(_0x212b9a){if(_0x212b9a){return _0x1e55c3[_0x10ed('0x1a')](_0x29f2b3)['json'](_0x212b9a);}};}function respondWithFilteredResult(_0x1e06f6,_0x2db7fc){return function(_0x42b7e0){if(_0x42b7e0){var _0x4757bd=typeof _0x2db7fc['offset']==='undefined'&&typeof _0x2db7fc[_0x10ed('0x1b')]===_0x10ed('0x1c');var _0x4f91bb=_0x42b7e0[_0x10ed('0x1d')];var _0x1bc6d7=_0x4757bd?0x0:_0x2db7fc[_0x10ed('0x1e')];var _0x527a0c=_0x4757bd?_0x42b7e0['count']:_0x2db7fc[_0x10ed('0x1e')]+_0x2db7fc['limit'];var _0x41e667;if(_0x527a0c>=_0x4f91bb){_0x527a0c=_0x4f91bb;_0x41e667=0xc8;}else{_0x41e667=0xce;}_0x1e06f6[_0x10ed('0x1a')](_0x41e667);return _0x1e06f6[_0x10ed('0x1f')](_0x10ed('0x20'),_0x1bc6d7+'-'+_0x527a0c+'/'+_0x4f91bb)[_0x10ed('0x21')](_0x42b7e0);}return null;};}function patchUpdates(_0x5db422){return function(_0x4eff6b){try{jsonpatch[_0x10ed('0x22')](_0x4eff6b,_0x5db422,!![]);}catch(_0x3f449b){return BPromise[_0x10ed('0x23')](_0x3f449b);}return _0x4eff6b[_0x10ed('0x24')]();};}function saveUpdates(_0x3152f5,_0x3dc319){return function(_0x22f7c7){if(_0x22f7c7){return _0x22f7c7[_0x10ed('0x25')](_0x3152f5)[_0x10ed('0x26')](function(_0x30c4bf){return _0x30c4bf;});}return null;};}function removeEntity(_0x5f33c0,_0x113e48){return function(_0x1c592a){if(_0x1c592a){return _0x1c592a[_0x10ed('0x27')]()[_0x10ed('0x26')](function(){_0x5f33c0[_0x10ed('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x197790,_0x1e5a1f){return function(_0x30a7d7){if(!_0x30a7d7){_0x197790[_0x10ed('0x18')](0x194);}return _0x30a7d7;};}function handleError(_0x1c4b8d,_0x3b88ae){_0x3b88ae=_0x3b88ae||0x1f4;return function(_0x51d645){logger[_0x10ed('0x28')](_0x51d645[_0x10ed('0x29')]);if(_0x51d645['name']){delete _0x51d645[_0x10ed('0x2a')];}_0x1c4b8d['status'](_0x3b88ae)['send'](_0x51d645);};}exports['index']=function(_0x437476,_0xd83bf7){var _0x56fe71={},_0x5f23fa={},_0x500211={'count':0x0,'rows':[]};var _0x1c502f=_[_0x10ed('0x2b')](db[_0x10ed('0x2c')][_0x10ed('0x2d')],function(_0x297480){return{'name':_0x297480[_0x10ed('0x2e')],'type':_0x297480[_0x10ed('0x2f')][_0x10ed('0x30')]};});_0x5f23fa['model']=_[_0x10ed('0x2b')](_0x1c502f,_0x10ed('0x2a'));_0x5f23fa[_0x10ed('0x31')]=_[_0x10ed('0x32')](_0x437476[_0x10ed('0x31')]);_0x5f23fa['filters']=_[_0x10ed('0x33')](_0x5f23fa[_0x10ed('0x34')],_0x5f23fa['query']);_0x56fe71[_0x10ed('0x35')]=_['intersection'](_0x5f23fa['model'],qs[_0x10ed('0x36')](_0x437476[_0x10ed('0x31')]['fields']));_0x56fe71[_0x10ed('0x35')]=_0x56fe71[_0x10ed('0x35')][_0x10ed('0x37')]?_0x56fe71[_0x10ed('0x35')]:_0x5f23fa['model'];if(!_0x437476['query'][_0x10ed('0x38')](_0x10ed('0x39'))){_0x56fe71[_0x10ed('0x1b')]=qs['limit'](_0x437476[_0x10ed('0x31')]['limit']);_0x56fe71[_0x10ed('0x1e')]=qs[_0x10ed('0x1e')](_0x437476['query'][_0x10ed('0x1e')]);}_0x56fe71[_0x10ed('0x3a')]=qs[_0x10ed('0x3b')](_0x437476[_0x10ed('0x31')][_0x10ed('0x3b')]);_0x56fe71[_0x10ed('0x3c')]=qs[_0x10ed('0x3d')](_[_0x10ed('0x3e')](_0x437476['query'],_0x5f23fa['filters']),_0x1c502f);if(_0x437476[_0x10ed('0x31')][_0x10ed('0x3f')]){_0x56fe71[_0x10ed('0x3c')]=_['merge'](_0x56fe71[_0x10ed('0x3c')],{'$or':_[_0x10ed('0x2b')](_0x1c502f,function(_0x145680){if(_0x145680[_0x10ed('0x2f')]!=='VIRTUAL'){var _0x23126a={};_0x23126a[_0x145680[_0x10ed('0x2a')]]={'$like':'%'+_0x437476['query'][_0x10ed('0x3f')]+'%'};return _0x23126a;}})});}_0x56fe71=_[_0x10ed('0x40')]({},_0x56fe71,_0x437476[_0x10ed('0x41')]);var _0x244c9b={'where':_0x56fe71['where']};return db[_0x10ed('0x2c')]['count'](_0x244c9b)[_0x10ed('0x26')](function(_0x467614){_0x500211[_0x10ed('0x1d')]=_0x467614;if(_0x437476[_0x10ed('0x31')][_0x10ed('0x42')]){_0x56fe71[_0x10ed('0x43')]=[{'all':!![]}];}return db[_0x10ed('0x2c')][_0x10ed('0x44')](_0x56fe71);})['then'](function(_0x50dd86){_0x500211[_0x10ed('0x45')]=_0x50dd86;return _0x500211;})[_0x10ed('0x26')](respondWithFilteredResult(_0xd83bf7,_0x56fe71))['catch'](handleError(_0xd83bf7,null));};exports[_0x10ed('0x46')]=function(_0x3581a1,_0x270076){var _0x407c8c={'raw':![],'where':{'id':_0x3581a1['params']['id']}},_0x353695={};_0x353695[_0x10ed('0x34')]=_[_0x10ed('0x32')](db[_0x10ed('0x2c')]['rawAttributes']);_0x353695['query']=_[_0x10ed('0x32')](_0x3581a1['query']);_0x353695[_0x10ed('0x3d')]=_[_0x10ed('0x33')](_0x353695[_0x10ed('0x34')],_0x353695[_0x10ed('0x31')]);_0x407c8c[_0x10ed('0x35')]=_[_0x10ed('0x33')](_0x353695['model'],qs[_0x10ed('0x36')](_0x3581a1[_0x10ed('0x31')]['fields']));_0x407c8c[_0x10ed('0x35')]=_0x407c8c['attributes'][_0x10ed('0x37')]?_0x407c8c[_0x10ed('0x35')]:_0x353695[_0x10ed('0x34')];if(_0x3581a1[_0x10ed('0x31')][_0x10ed('0x42')]){_0x407c8c[_0x10ed('0x43')]=[{'all':!![]}];}_0x407c8c=_[_0x10ed('0x40')]({},_0x407c8c,_0x3581a1['options']);return db[_0x10ed('0x2c')]['find'](_0x407c8c)[_0x10ed('0x26')](handleEntityNotFound(_0x270076,null))[_0x10ed('0x26')](respondWithResult(_0x270076,null))[_0x10ed('0x47')](handleError(_0x270076,null));};exports[_0x10ed('0x48')]=function(_0xcdbfb1,_0x339b48){return db[_0x10ed('0x2c')][_0x10ed('0x48')](_0xcdbfb1[_0x10ed('0x49')],{})[_0x10ed('0x26')](respondWithResult(_0x339b48,0xc9))['catch'](handleError(_0x339b48,null));};exports[_0x10ed('0x25')]=function(_0x4a3a48,_0x1f7b7f){if(_0x4a3a48[_0x10ed('0x49')]['id']){delete _0x4a3a48['body']['id'];}return db[_0x10ed('0x2c')][_0x10ed('0x4a')]({'where':{'id':_0x4a3a48[_0x10ed('0x4b')]['id']}})[_0x10ed('0x26')](handleEntityNotFound(_0x1f7b7f,null))['then'](saveUpdates(_0x4a3a48[_0x10ed('0x49')],null))['then'](respondWithResult(_0x1f7b7f,null))['catch'](handleError(_0x1f7b7f,null));};exports['destroy']=function(_0x3b39c0,_0x331954){return db[_0x10ed('0x2c')]['find']({'where':{'id':_0x3b39c0['params']['id']}})[_0x10ed('0x26')](handleEntityNotFound(_0x331954,null))['then'](removeEntity(_0x331954,null))['catch'](handleError(_0x331954,null));};exports['getFields']=function(_0x49f1fa,_0x1997d8,_0x33a6e8){var _0x419dec={};var _0x214804={};var _0x298f36;var _0x4c2860;return db[_0x10ed('0x2c')][_0x10ed('0x4c')]({'where':{'id':_0x49f1fa[_0x10ed('0x4b')]['id']}})[_0x10ed('0x26')](handleEntityNotFound(_0x1997d8,null))[_0x10ed('0x26')](function(_0x46230d){if(_0x46230d){_0x298f36=_0x46230d;_0x214804[_0x10ed('0x34')]=_[_0x10ed('0x32')](db[_0x10ed('0x4d')]['rawAttributes']);_0x214804[_0x10ed('0x31')]=_[_0x10ed('0x32')](_0x49f1fa[_0x10ed('0x31')]);_0x214804[_0x10ed('0x3d')]=_[_0x10ed('0x33')](_0x214804[_0x10ed('0x34')],_0x214804['query']);_0x419dec[_0x10ed('0x35')]=_[_0x10ed('0x33')](_0x214804[_0x10ed('0x34')],qs['fields'](_0x49f1fa[_0x10ed('0x31')][_0x10ed('0x36')]));_0x419dec[_0x10ed('0x35')]=_0x419dec['attributes']['length']?_0x419dec[_0x10ed('0x35')]:_0x214804['model'];_0x419dec[_0x10ed('0x3a')]=qs[_0x10ed('0x3b')](_0x49f1fa[_0x10ed('0x31')][_0x10ed('0x3b')]);_0x419dec['where']=qs[_0x10ed('0x3d')](_['pick'](_0x49f1fa[_0x10ed('0x31')],_0x214804[_0x10ed('0x3d')]));if(_0x49f1fa['query'][_0x10ed('0x3f')]){_0x419dec[_0x10ed('0x3c')]=_[_0x10ed('0x40')](_0x419dec['where'],{'$or':_[_0x10ed('0x2b')](_0x419dec[_0x10ed('0x35')],function(_0x876a8f){var _0x15aa36={};_0x15aa36[_0x876a8f]={'$like':'%'+_0x49f1fa[_0x10ed('0x31')][_0x10ed('0x3f')]+'%'};return _0x15aa36;})});}_0x419dec=_['merge']({},_0x419dec,_0x49f1fa[_0x10ed('0x41')]);return _0x298f36[_0x10ed('0x4e')](_0x419dec);}})[_0x10ed('0x26')](function(_0x3e51c9){if(_0x3e51c9){_0x4c2860=_0x3e51c9[_0x10ed('0x37')];if(!_0x49f1fa['query'][_0x10ed('0x38')](_0x10ed('0x39'))){_0x419dec[_0x10ed('0x1b')]=qs[_0x10ed('0x1b')](_0x49f1fa[_0x10ed('0x31')][_0x10ed('0x1b')]);_0x419dec[_0x10ed('0x1e')]=qs['offset'](_0x49f1fa[_0x10ed('0x31')][_0x10ed('0x1e')]);}return _0x298f36[_0x10ed('0x4e')](_0x419dec);}})['then'](function(_0x54bdea){if(_0x54bdea){return _0x54bdea?{'count':_0x4c2860,'rows':_0x54bdea}:null;}})[_0x10ed('0x26')](respondWithResult(_0x1997d8,null))[_0x10ed('0x47')](handleError(_0x1997d8,null));};exports[_0x10ed('0x4f')]=function(_0x593817,_0x213723,_0x17c6a6){var _0x22a215={};var _0x28aaca={};var _0xbfd894;var _0x3cb072;return db[_0x10ed('0x2c')][_0x10ed('0x4c')]({'where':{'id':_0x593817[_0x10ed('0x4b')]['id']}})['then'](handleEntityNotFound(_0x213723,null))['then'](function(_0x51605a){if(_0x51605a){_0xbfd894=_0x51605a;_0x28aaca['model']=_[_0x10ed('0x32')](db[_0x10ed('0x4d')][_0x10ed('0x2d')]);_0x28aaca[_0x10ed('0x31')]=_[_0x10ed('0x32')](_0x593817['query']);_0x28aaca[_0x10ed('0x3d')]=_[_0x10ed('0x33')](_0x28aaca['model'],_0x28aaca['query']);_0x22a215['attributes']=_[_0x10ed('0x33')](_0x28aaca[_0x10ed('0x34')],qs[_0x10ed('0x36')](_0x593817[_0x10ed('0x31')][_0x10ed('0x36')]));_0x22a215[_0x10ed('0x35')]=_0x22a215['attributes'][_0x10ed('0x37')]?_0x22a215['attributes']:_0x28aaca[_0x10ed('0x34')];_0x22a215[_0x10ed('0x3a')]=qs['sort'](_0x593817[_0x10ed('0x31')][_0x10ed('0x3b')]);_0x22a215[_0x10ed('0x3c')]=qs[_0x10ed('0x3d')](_[_0x10ed('0x3e')](_0x593817['query'],_0x28aaca[_0x10ed('0x3d')]));if(_0x593817['query'][_0x10ed('0x3f')]){_0x22a215[_0x10ed('0x3c')]=_[_0x10ed('0x40')](_0x22a215[_0x10ed('0x3c')],{'$or':_[_0x10ed('0x2b')](_0x22a215[_0x10ed('0x35')],function(_0x303cff){var _0x1cce07={};_0x1cce07[_0x303cff]={'$like':'%'+_0x593817[_0x10ed('0x31')]['filter']+'%'};return _0x1cce07;})});}_0x22a215=_[_0x10ed('0x40')]({},_0x22a215,_0x593817[_0x10ed('0x41')]);return _0xbfd894[_0x10ed('0x4f')](_0x22a215);}})[_0x10ed('0x26')](function(_0x1f9c1b){if(_0x1f9c1b){_0x3cb072=_0x1f9c1b['length'];if(!_0x593817['query'][_0x10ed('0x38')](_0x10ed('0x39'))){_0x22a215[_0x10ed('0x1b')]=qs[_0x10ed('0x1b')](_0x593817[_0x10ed('0x31')][_0x10ed('0x1b')]);_0x22a215['offset']=qs[_0x10ed('0x1e')](_0x593817[_0x10ed('0x31')][_0x10ed('0x1e')]);}return _0xbfd894[_0x10ed('0x4f')](_0x22a215);}})['then'](function(_0x27c028){if(_0x27c028){return _0x27c028?{'count':_0x3cb072,'rows':_0x27c028}:null;}})[_0x10ed('0x26')](respondWithResult(_0x213723,null))['catch'](handleError(_0x213723,null));};exports[_0x10ed('0x50')]=function(_0x1838dc,_0x34758e,_0x3dfd90){var _0x2011f4={};var _0x3a7481={};var _0x5eae18;var _0x12fb56;return db[_0x10ed('0x2c')][_0x10ed('0x4c')]({'where':{'id':_0x1838dc['params']['id']}})['then'](handleEntityNotFound(_0x34758e,null))[_0x10ed('0x26')](function(_0x111682){if(_0x111682){_0x5eae18=_0x111682;_0x3a7481['model']=_[_0x10ed('0x32')](db['DeskField'][_0x10ed('0x2d')]);_0x3a7481['query']=_[_0x10ed('0x32')](_0x1838dc[_0x10ed('0x31')]);_0x3a7481[_0x10ed('0x3d')]=_['intersection'](_0x3a7481[_0x10ed('0x34')],_0x3a7481[_0x10ed('0x31')]);_0x2011f4[_0x10ed('0x35')]=_['intersection'](_0x3a7481[_0x10ed('0x34')],qs[_0x10ed('0x36')](_0x1838dc[_0x10ed('0x31')][_0x10ed('0x36')]));_0x2011f4[_0x10ed('0x35')]=_0x2011f4[_0x10ed('0x35')]['length']?_0x2011f4[_0x10ed('0x35')]:_0x3a7481[_0x10ed('0x34')];_0x2011f4['order']=qs[_0x10ed('0x3b')](_0x1838dc[_0x10ed('0x31')][_0x10ed('0x3b')]);_0x2011f4[_0x10ed('0x3c')]=qs[_0x10ed('0x3d')](_[_0x10ed('0x3e')](_0x1838dc[_0x10ed('0x31')],_0x3a7481[_0x10ed('0x3d')]));if(_0x1838dc['query'][_0x10ed('0x3f')]){_0x2011f4['where']=_[_0x10ed('0x40')](_0x2011f4['where'],{'$or':_[_0x10ed('0x2b')](_0x2011f4['attributes'],function(_0x1ff5f0){var _0x16a20e={};_0x16a20e[_0x1ff5f0]={'$like':'%'+_0x1838dc[_0x10ed('0x31')][_0x10ed('0x3f')]+'%'};return _0x16a20e;})});}_0x2011f4=_[_0x10ed('0x40')]({},_0x2011f4,_0x1838dc[_0x10ed('0x41')]);return _0x5eae18['getDescriptions'](_0x2011f4);}})[_0x10ed('0x26')](function(_0x44d3ea){if(_0x44d3ea){_0x12fb56=_0x44d3ea[_0x10ed('0x37')];if(!_0x1838dc[_0x10ed('0x31')][_0x10ed('0x38')](_0x10ed('0x39'))){_0x2011f4['limit']=qs[_0x10ed('0x1b')](_0x1838dc['query']['limit']);_0x2011f4['offset']=qs[_0x10ed('0x1e')](_0x1838dc[_0x10ed('0x31')][_0x10ed('0x1e')]);}return _0x5eae18[_0x10ed('0x50')](_0x2011f4);}})[_0x10ed('0x26')](function(_0x4f8015){if(_0x4f8015){return _0x4f8015?{'count':_0x12fb56,'rows':_0x4f8015}:null;}})[_0x10ed('0x26')](respondWithResult(_0x34758e,null))['catch'](handleError(_0x34758e,null));};exports[_0x10ed('0x51')]=function(_0x3f48a2,_0x54b0b7,_0x5ee5d5){var _0x346810={};var _0x112741={};var _0x4c3058;var _0xd1e718;return db[_0x10ed('0x2c')][_0x10ed('0x4c')]({'where':{'id':_0x3f48a2[_0x10ed('0x4b')]['id']}})[_0x10ed('0x26')](handleEntityNotFound(_0x54b0b7,null))[_0x10ed('0x26')](function(_0x49c8f0){if(_0x49c8f0){_0x4c3058=_0x49c8f0;_0x112741[_0x10ed('0x34')]=_[_0x10ed('0x32')](db['Tag'][_0x10ed('0x2d')]);_0x112741[_0x10ed('0x31')]=_['keys'](_0x3f48a2['query']);_0x112741[_0x10ed('0x3d')]=_[_0x10ed('0x33')](_0x112741[_0x10ed('0x34')],_0x112741[_0x10ed('0x31')]);_0x346810[_0x10ed('0x35')]=_[_0x10ed('0x33')](_0x112741[_0x10ed('0x34')],qs[_0x10ed('0x36')](_0x3f48a2[_0x10ed('0x31')][_0x10ed('0x36')]));_0x346810[_0x10ed('0x35')]=_0x346810['attributes'][_0x10ed('0x37')]?_0x346810[_0x10ed('0x35')]:_0x112741[_0x10ed('0x34')];_0x346810[_0x10ed('0x3a')]=qs['sort'](_0x3f48a2[_0x10ed('0x31')]['sort']);_0x346810[_0x10ed('0x3c')]=qs[_0x10ed('0x3d')](_[_0x10ed('0x3e')](_0x3f48a2[_0x10ed('0x31')],_0x112741[_0x10ed('0x3d')]));if(_0x3f48a2['query'][_0x10ed('0x3f')]){_0x346810[_0x10ed('0x3c')]=_[_0x10ed('0x40')](_0x346810[_0x10ed('0x3c')],{'$or':_[_0x10ed('0x2b')](_0x346810[_0x10ed('0x35')],function(_0xccca05){var _0x14420b={};_0x14420b[_0xccca05]={'$like':'%'+_0x3f48a2[_0x10ed('0x31')][_0x10ed('0x3f')]+'%'};return _0x14420b;})});}_0x346810=_[_0x10ed('0x40')]({},_0x346810,_0x3f48a2[_0x10ed('0x41')]);return _0x4c3058[_0x10ed('0x51')](_0x346810);}})['then'](function(_0x2eeedf){if(_0x2eeedf){_0xd1e718=_0x2eeedf[_0x10ed('0x37')];if(!_0x3f48a2[_0x10ed('0x31')]['hasOwnProperty'](_0x10ed('0x39'))){_0x346810[_0x10ed('0x1b')]=qs[_0x10ed('0x1b')](_0x3f48a2[_0x10ed('0x31')][_0x10ed('0x1b')]);_0x346810['offset']=qs[_0x10ed('0x1e')](_0x3f48a2[_0x10ed('0x31')][_0x10ed('0x1e')]);}return _0x4c3058[_0x10ed('0x51')](_0x346810);}})[_0x10ed('0x26')](function(_0x4a0bae){if(_0x4a0bae){return _0x4a0bae?{'count':_0xd1e718,'rows':_0x4a0bae}:null;}})[_0x10ed('0x26')](respondWithResult(_0x54b0b7,null))[_0x10ed('0x47')](handleError(_0x54b0b7,null));};exports[_0x10ed('0x52')]=function(_0x3e03b0,_0x406617,_0x4d2b59){if(_0x3e03b0[_0x10ed('0x49')]['id']){delete _0x3e03b0[_0x10ed('0x49')]['id'];}return db['DeskConfiguration'][_0x10ed('0x4c')]({'where':{'id':_0x3e03b0[_0x10ed('0x4b')]['id']}})[_0x10ed('0x26')](handleEntityNotFound(_0x406617,null))[_0x10ed('0x26')](function(_0x391030){if(_0x391030){return _0x391030[_0x10ed('0x52')](_0x3e03b0[_0x10ed('0x49')][_0x10ed('0x53')]||[]);}return null;})[_0x10ed('0x26')](respondWithResult(_0x406617,null))[_0x10ed('0x47')](handleError(_0x406617,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 98211a6..7c2710d 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.model.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fb7=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','api','moment'];(function(_0x52b655,_0x5132ac){var _0x4185fc=function(_0x19b9e2){while(--_0x19b9e2){_0x52b655['push'](_0x52b655['shift']());}};_0x4185fc(++_0x5132ac);}(_0x3fb7,0x189));var _0x73fb=function(_0x419d00,_0x4ebfb7){_0x419d00=_0x419d00-0x0;var _0x465068=_0x3fb7[_0x419d00];return _0x465068;};'use strict';var _=require('lodash');var util=require(_0x73fb('0x0'));var logger=require('../../config/logger')(_0x73fb('0x1'));var moment=require(_0x73fb('0x2'));var BPromise=require('bluebird');var rp=require(_0x73fb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73fb('0x4'));var config=require(_0x73fb('0x5'));var attributes=require(_0x73fb('0x6'));module[_0x73fb('0x7')]=function(_0x3330e3,_0x423496){return _0x3330e3[_0x73fb('0x8')](_0x73fb('0x9'),attributes,{'tableName':_0x73fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x851a=['exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5a0ed8,_0x1c18df){var _0xf88bc1=function(_0x2434a0){while(--_0x2434a0){_0x5a0ed8['push'](_0x5a0ed8['shift']());}};_0xf88bc1(++_0x1c18df);}(_0x851a,0x19b));var _0xa851=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x851a[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xa851('0x0'));var util=require('util');var logger=require(_0xa851('0x1'))(_0xa851('0x2'));var moment=require(_0xa851('0x3'));var BPromise=require(_0xa851('0x4'));var rp=require(_0xa851('0x5'));var fs=require('fs');var path=require(_0xa851('0x6'));var rimraf=require(_0xa851('0x7'));var config=require(_0xa851('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0xa851('0x9')]=function(_0x57a7c4,_0x1cba67){return _0x57a7c4[_0xa851('0xa')](_0xa851('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index d37aa2e..c7b2563 100644 --- a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js +++ b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c71=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4919c7,_0x45153f){var _0x250542=function(_0x183280){while(--_0x183280){_0x4919c7['push'](_0x4919c7['shift']());}};_0x250542(++_0x45153f);}(_0x7c71,0x177));var _0x17c7=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x7c71[_0x456b57];return _0x18f49f;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c061b,_0xf284a2,_0x1ff4ec){return new BPromise(function(_0x50feb0,_0x13fdad){return client[_0x17c7('0xb')](_0x3c061b,_0x1ff4ec)[_0x17c7('0xc')](function(_0xdb3575){logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));logger[_0x17c7('0x10')](_0x17c7('0x11'),_0xf284a2,_0x17c7('0xf'),JSON['stringify'](_0xdb3575));if(_0xdb3575['error']){if(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x13')]===0x1f4){logger['error'](_0x17c7('0xe'),_0xf284a2,_0xdb3575[_0x17c7('0x12')]['message']);return _0x13fdad(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xf284a2,_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);return _0x50feb0(_0xdb3575[_0x17c7('0x12')][_0x17c7('0x14')]);}else{logger[_0x17c7('0xd')](_0x17c7('0xe'),_0xf284a2,_0x17c7('0xf'));_0x50feb0(_0xdb3575[_0x17c7('0x15')][_0x17c7('0x14')]);}})[_0x17c7('0x16')](function(_0x296f9c){logger[_0x17c7('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf284a2,_0x296f9c);_0x13fdad(_0x296f9c);});});} \ No newline at end of file +var _0x6edc=['code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x43f47b,_0x311636){var _0x4af9a6=function(_0x4fb7f0){while(--_0x4fb7f0){_0x43f47b['push'](_0x43f47b['shift']());}};_0x4af9a6(++_0x311636);}(_0x6edc,0x138));var _0xc6ed=function(_0x6b8ff9,_0x219253){_0x6b8ff9=_0x6b8ff9-0x0;var _0x295099=_0x6edc[_0x6b8ff9];return _0x295099;};'use strict';var _=require(_0xc6ed('0x0'));var util=require(_0xc6ed('0x1'));var moment=require(_0xc6ed('0x2'));var BPromise=require(_0xc6ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6ed('0x4'))['db'];var utils=require(_0xc6ed('0x5'));var logger=require(_0xc6ed('0x6'))(_0xc6ed('0x7'));var config=require('../../config/environment');var jayson=require(_0xc6ed('0x8'));var client=jayson[_0xc6ed('0x9')][_0xc6ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x548a14,_0x274b0d,_0x5a077d){return new BPromise(function(_0xd46c3f,_0x13fed0){return client[_0xc6ed('0xb')](_0x548a14,_0x5a077d)[_0xc6ed('0xc')](function(_0x496e6a){logger[_0xc6ed('0xd')](_0xc6ed('0xe'),_0x274b0d,_0xc6ed('0xf'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x274b0d,_0xc6ed('0xf'),JSON[_0xc6ed('0x10')](_0x496e6a));if(_0x496e6a[_0xc6ed('0x11')]){if(_0x496e6a[_0xc6ed('0x11')][_0xc6ed('0x12')]===0x1f4){logger['error'](_0xc6ed('0xe'),_0x274b0d,_0x496e6a['error'][_0xc6ed('0x13')]);return _0x13fed0(_0x496e6a['error'][_0xc6ed('0x13')]);}logger[_0xc6ed('0x11')](_0xc6ed('0xe'),_0x274b0d,_0x496e6a['error'][_0xc6ed('0x13')]);return _0xd46c3f(_0x496e6a[_0xc6ed('0x11')][_0xc6ed('0x13')]);}else{logger['info'](_0xc6ed('0xe'),_0x274b0d,'request\x20sent');_0xd46c3f(_0x496e6a[_0xc6ed('0x14')][_0xc6ed('0x13')]);}})[_0xc6ed('0x15')](function(_0x5346fe){logger[_0xc6ed('0x11')](_0xc6ed('0xe'),_0x274b0d,_0x5346fe);_0x13fed0(_0x5346fe);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 409d00e..1079014 100644 --- a/server/api/intDeskField/index.js +++ b/server/api/intDeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc87=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','/:id','delete'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0xcc87,0x158));var _0x7cc8=function(_0x4734c3,_0x32b465){_0x4734c3=_0x4734c3-0x0;var _0x298191=_0xcc87[_0x4734c3];return _0x298191;};'use strict';var multer=require(_0x7cc8('0x0'));var util=require('util');var path=require(_0x7cc8('0x1'));var timeout=require(_0x7cc8('0x2'));var express=require(_0x7cc8('0x3'));var router=express[_0x7cc8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7cc8('0x5'));var interaction=require(_0x7cc8('0x6'));var config=require(_0x7cc8('0x7'));var controller=require(_0x7cc8('0x8'));router[_0x7cc8('0x9')]('/',auth[_0x7cc8('0xa')](),controller[_0x7cc8('0xb')]);router[_0x7cc8('0x9')]('/:id',auth[_0x7cc8('0xa')](),controller[_0x7cc8('0xc')]);router[_0x7cc8('0xd')]('/',auth[_0x7cc8('0xa')](),controller['create']);router['put'](_0x7cc8('0xe'),auth[_0x7cc8('0xa')](),controller['update']);router[_0x7cc8('0xf')](_0x7cc8('0xe'),auth[_0x7cc8('0xa')](),controller[_0x7cc8('0x10')]);module[_0x7cc8('0x11')]=router; \ No newline at end of file +var _0x39d7=['../../components/auth/service','./intDeskField.controller','get','isAuthenticated','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router'];(function(_0x1cff7d,_0xcad317){var _0x2705cb=function(_0x2775e9){while(--_0x2775e9){_0x1cff7d['push'](_0x1cff7d['shift']());}};_0x2705cb(++_0xcad317);}(_0x39d7,0x12d));var _0x739d=function(_0x538761,_0x3694cd){_0x538761=_0x538761-0x0;var _0x9a0637=_0x39d7[_0x538761];return _0x9a0637;};'use strict';var multer=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var path=require(_0x739d('0x2'));var timeout=require('connect-timeout');var express=require(_0x739d('0x3'));var router=express[_0x739d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x739d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x739d('0x6'));router[_0x739d('0x7')]('/',auth[_0x739d('0x8')](),controller['index']);router[_0x739d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x739d('0x9')]);router['post']('/',auth[_0x739d('0x8')](),controller[_0x739d('0xa')]);router[_0x739d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x739d('0xc')]);router[_0x739d('0xd')](_0x739d('0xe'),auth[_0x739d('0x8')](),controller[_0x739d('0xf')]);module[_0x739d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 63b3241..b0c8ab6 100644 --- a/server/api/intDeskField/intDeskField.attributes.js +++ b/server/api/intDeskField/intDeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb998=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x5448b4,_0x4154f){var _0x10cfca=function(_0x3f8ef7){while(--_0x3f8ef7){_0x5448b4['push'](_0x5448b4['shift']());}};_0x10cfca(++_0x4154f);}(_0xb998,0x1ce));var _0x8b99=function(_0x461605,_0x1dbdf8){_0x461605=_0x461605-0x0;var _0x27fe3e=_0xb998[_0x461605];return _0x27fe3e;};'use strict';var Sequelize=require(_0x8b99('0x0'));module[_0x8b99('0x1')]={'type':{'type':Sequelize[_0x8b99('0x2')]('string',_0x8b99('0x3'),_0x8b99('0x4'),_0x8b99('0x5'),_0x8b99('0x6')),'defaultValue':_0x8b99('0x7')},'content':{'type':Sequelize[_0x8b99('0x8')]},'key':{'type':Sequelize[_0x8b99('0x8')]},'keyType':{'type':Sequelize[_0x8b99('0x2')]('string','variable',_0x8b99('0x4'))},'keyContent':{'type':Sequelize[_0x8b99('0x8')]},'idField':{'type':Sequelize[_0x8b99('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8b99('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b99('0x8')]}}; \ No newline at end of file +var _0xfa2d=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x5502a7,_0x325618){var _0x3946fa=function(_0x1c8383){while(--_0x1c8383){_0x5502a7['push'](_0x5502a7['shift']());}};_0x3946fa(++_0x325618);}(_0xfa2d,0x153));var _0xdfa2=function(_0x4bb955,_0x19ec50){_0x4bb955=_0x4bb955-0x0;var _0x494440=_0xfa2d[_0x4bb955];return _0x494440;};'use strict';var Sequelize=require('sequelize');module[_0xdfa2('0x0')]={'type':{'type':Sequelize[_0xdfa2('0x1')](_0xdfa2('0x2'),_0xdfa2('0x3'),_0xdfa2('0x4'),_0xdfa2('0x5'),_0xdfa2('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdfa2('0x7')]},'keyType':{'type':Sequelize[_0xdfa2('0x1')]('string','variable',_0xdfa2('0x4'))},'keyContent':{'type':Sequelize[_0xdfa2('0x7')]},'idField':{'type':Sequelize[_0xdfa2('0x7')]},'nameField':{'type':Sequelize[_0xdfa2('0x7')]},'customField':{'type':Sequelize[_0xdfa2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdfa2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 3923f37..30fd79d 100644 --- a/server/api/intDeskField/intDeskField.controller.js +++ b/server/api/intDeskField/intDeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83de=['options','includeAll','include','findAll','catch','show','find','create','body','params','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x83de,0x116));var _0xe83d=function(_0x4cbc55,_0x34872d){_0x4cbc55=_0x4cbc55-0x0;var _0x1ebb48=_0x83de[_0x4cbc55];return _0x1ebb48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe83d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe83d('0x1'));var rp=require(_0xe83d('0x2'));var moment=require('moment');var BPromise=require(_0xe83d('0x3'));var Mustache=require(_0xe83d('0x4'));var util=require(_0xe83d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe83d('0x6'));var ejs=require(_0xe83d('0x7'));var fs=require('fs');var fs_extra=require(_0xe83d('0x8'));var _=require(_0xe83d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe83d('0xa'));var deskjs=require(_0xe83d('0xb'));var toCsv=require(_0xe83d('0x6'));var querystring=require('querystring');var Papa=require(_0xe83d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe83d('0xd'));var hardwareService=require(_0xe83d('0xe'));var logger=require(_0xe83d('0xf'))('api');var utils=require(_0xe83d('0x10'));var config=require(_0xe83d('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe83d('0x12'))['db'];function respondWithStatusCode(_0x5dd8b3,_0xe0b944){_0xe0b944=_0xe0b944||0xcc;return function(_0x91619a){if(_0x91619a){return _0x5dd8b3[_0xe83d('0x13')](_0xe0b944);}return _0x5dd8b3[_0xe83d('0x14')](_0xe0b944)[_0xe83d('0x15')]();};}function respondWithResult(_0xa19d1,_0xcf4622){_0xcf4622=_0xcf4622||0xc8;return function(_0x825139){if(_0x825139){return _0xa19d1[_0xe83d('0x14')](_0xcf4622)['json'](_0x825139);}};}function respondWithFilteredResult(_0xaf38d7,_0x4c707d){return function(_0x36487e){if(_0x36487e){var _0x472514=typeof _0x4c707d[_0xe83d('0x16')]===_0xe83d('0x17')&&typeof _0x4c707d[_0xe83d('0x18')]==='undefined';var _0x1309ce=_0x36487e[_0xe83d('0x19')];var _0x1d3cc3=_0x472514?0x0:_0x4c707d[_0xe83d('0x16')];var _0x20aac0=_0x472514?_0x36487e[_0xe83d('0x19')]:_0x4c707d[_0xe83d('0x16')]+_0x4c707d['limit'];var _0xb2f3c3;if(_0x20aac0>=_0x1309ce){_0x20aac0=_0x1309ce;_0xb2f3c3=0xc8;}else{_0xb2f3c3=0xce;}_0xaf38d7[_0xe83d('0x14')](_0xb2f3c3);return _0xaf38d7['set'](_0xe83d('0x1a'),_0x1d3cc3+'-'+_0x20aac0+'/'+_0x1309ce)[_0xe83d('0x1b')](_0x36487e);}return null;};}function patchUpdates(_0x15fd5c){return function(_0x487b22){try{jsonpatch['apply'](_0x487b22,_0x15fd5c,!![]);}catch(_0xb4b46e){return BPromise[_0xe83d('0x1c')](_0xb4b46e);}return _0x487b22[_0xe83d('0x1d')]();};}function saveUpdates(_0x57bb5f,_0x1662e8){return function(_0x50129b){if(_0x50129b){return _0x50129b[_0xe83d('0x1e')](_0x57bb5f)[_0xe83d('0x1f')](function(_0x254551){return _0x254551;});}return null;};}function removeEntity(_0x4ea9eb,_0x1dff3f){return function(_0x569cb2){if(_0x569cb2){return _0x569cb2[_0xe83d('0x20')]()[_0xe83d('0x1f')](function(){_0x4ea9eb[_0xe83d('0x14')](0xcc)[_0xe83d('0x15')]();});}};}function handleEntityNotFound(_0xcd1f9a,_0x510e6a){return function(_0x47d945){if(!_0x47d945){_0xcd1f9a['sendStatus'](0x194);}return _0x47d945;};}function handleError(_0xcbad13,_0x4127ba){_0x4127ba=_0x4127ba||0x1f4;return function(_0x5e14fb){logger[_0xe83d('0x21')](_0x5e14fb[_0xe83d('0x22')]);if(_0x5e14fb['name']){delete _0x5e14fb[_0xe83d('0x23')];}_0xcbad13[_0xe83d('0x14')](_0x4127ba)[_0xe83d('0x24')](_0x5e14fb);};}exports[_0xe83d('0x25')]=function(_0x314cec,_0x58fd1b){var _0x4890ab={},_0x2afbab={},_0x379be8={'count':0x0,'rows':[]};var _0x2f63c4=_[_0xe83d('0x26')](db[_0xe83d('0x27')][_0xe83d('0x28')],function(_0x417159){return{'name':_0x417159[_0xe83d('0x29')],'type':_0x417159['type'][_0xe83d('0x2a')]};});_0x2afbab[_0xe83d('0x2b')]=_['map'](_0x2f63c4,'name');_0x2afbab[_0xe83d('0x2c')]=_[_0xe83d('0x2d')](_0x314cec[_0xe83d('0x2c')]);_0x2afbab['filters']=_[_0xe83d('0x2e')](_0x2afbab[_0xe83d('0x2b')],_0x2afbab[_0xe83d('0x2c')]);_0x4890ab['attributes']=_[_0xe83d('0x2e')](_0x2afbab[_0xe83d('0x2b')],qs[_0xe83d('0x2f')](_0x314cec['query']['fields']));_0x4890ab[_0xe83d('0x30')]=_0x4890ab[_0xe83d('0x30')][_0xe83d('0x31')]?_0x4890ab[_0xe83d('0x30')]:_0x2afbab[_0xe83d('0x2b')];if(!_0x314cec[_0xe83d('0x2c')][_0xe83d('0x32')](_0xe83d('0x33'))){_0x4890ab['limit']=qs[_0xe83d('0x18')](_0x314cec[_0xe83d('0x2c')][_0xe83d('0x18')]);_0x4890ab[_0xe83d('0x16')]=qs[_0xe83d('0x16')](_0x314cec['query'][_0xe83d('0x16')]);}_0x4890ab['order']=qs[_0xe83d('0x34')](_0x314cec[_0xe83d('0x2c')][_0xe83d('0x34')]);_0x4890ab['where']=qs[_0xe83d('0x35')](_['pick'](_0x314cec[_0xe83d('0x2c')],_0x2afbab['filters']),_0x2f63c4);if(_0x314cec[_0xe83d('0x2c')][_0xe83d('0x36')]){_0x4890ab[_0xe83d('0x37')]=_[_0xe83d('0x38')](_0x4890ab[_0xe83d('0x37')],{'$or':_[_0xe83d('0x26')](_0x2f63c4,function(_0x5b7ad0){if(_0x5b7ad0['type']!=='VIRTUAL'){var _0x3b2ab4={};_0x3b2ab4[_0x5b7ad0[_0xe83d('0x23')]]={'$like':'%'+_0x314cec[_0xe83d('0x2c')][_0xe83d('0x36')]+'%'};return _0x3b2ab4;}})});}_0x4890ab=_['merge']({},_0x4890ab,_0x314cec[_0xe83d('0x39')]);var _0xea7d23={'where':_0x4890ab[_0xe83d('0x37')]};return db[_0xe83d('0x27')][_0xe83d('0x19')](_0xea7d23)[_0xe83d('0x1f')](function(_0x4e93f4){_0x379be8[_0xe83d('0x19')]=_0x4e93f4;if(_0x314cec['query'][_0xe83d('0x3a')]){_0x4890ab[_0xe83d('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0xe83d('0x3c')](_0x4890ab);})[_0xe83d('0x1f')](function(_0x533776){_0x379be8['rows']=_0x533776;return _0x379be8;})[_0xe83d('0x1f')](respondWithFilteredResult(_0x58fd1b,_0x4890ab))[_0xe83d('0x3d')](handleError(_0x58fd1b,null));};exports[_0xe83d('0x3e')]=function(_0x2e3149,_0x1ab219){var _0x44a9ba={'raw':!![],'where':{'id':_0x2e3149['params']['id']}},_0x263c8e={};_0x263c8e[_0xe83d('0x2b')]=_['keys'](db[_0xe83d('0x27')]['rawAttributes']);_0x263c8e[_0xe83d('0x2c')]=_[_0xe83d('0x2d')](_0x2e3149['query']);_0x263c8e[_0xe83d('0x35')]=_['intersection'](_0x263c8e[_0xe83d('0x2b')],_0x263c8e[_0xe83d('0x2c')]);_0x44a9ba[_0xe83d('0x30')]=_['intersection'](_0x263c8e['model'],qs[_0xe83d('0x2f')](_0x2e3149[_0xe83d('0x2c')][_0xe83d('0x2f')]));_0x44a9ba[_0xe83d('0x30')]=_0x44a9ba['attributes'][_0xe83d('0x31')]?_0x44a9ba[_0xe83d('0x30')]:_0x263c8e['model'];if(_0x2e3149['query'][_0xe83d('0x3a')]){_0x44a9ba[_0xe83d('0x3b')]=[{'all':!![]}];}_0x44a9ba=_[_0xe83d('0x38')]({},_0x44a9ba,_0x2e3149[_0xe83d('0x39')]);return db[_0xe83d('0x27')][_0xe83d('0x3f')](_0x44a9ba)[_0xe83d('0x1f')](handleEntityNotFound(_0x1ab219,null))['then'](respondWithResult(_0x1ab219,null))[_0xe83d('0x3d')](handleError(_0x1ab219,null));};exports[_0xe83d('0x40')]=function(_0x261502,_0x2b45d1){return db[_0xe83d('0x27')]['create'](_0x261502['body'],{})[_0xe83d('0x1f')](respondWithResult(_0x2b45d1,0xc9))['catch'](handleError(_0x2b45d1,null));};exports[_0xe83d('0x1e')]=function(_0xe8bda8,_0xdcad13){if(_0xe8bda8['body']['id']){delete _0xe8bda8[_0xe83d('0x41')]['id'];}return db[_0xe83d('0x27')][_0xe83d('0x3f')]({'where':{'id':_0xe8bda8[_0xe83d('0x42')]['id']}})[_0xe83d('0x1f')](handleEntityNotFound(_0xdcad13,null))[_0xe83d('0x1f')](saveUpdates(_0xe8bda8['body'],null))['then'](respondWithResult(_0xdcad13,null))[_0xe83d('0x3d')](handleError(_0xdcad13,null));};exports['destroy']=function(_0x48c58a,_0x39748e){return db[_0xe83d('0x27')][_0xe83d('0x3f')]({'where':{'id':_0x48c58a[_0xe83d('0x42')]['id']}})[_0xe83d('0x1f')](handleEntityNotFound(_0x39748e,null))[_0xe83d('0x1f')](removeEntity(_0x39748e,null))[_0xe83d('0x3d')](handleError(_0x39748e,null));}; \ No newline at end of file +var _0x9131=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','then','sendStatus','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','show','include','merge','find','catch','create','update','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x469056,_0x4f46e1){var _0xba97aa=function(_0x217722){while(--_0x217722){_0x469056['push'](_0x469056['shift']());}};_0xba97aa(++_0x4f46e1);}(_0x9131,0xc6));var _0x1913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9131[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1913('0x0'));var rimraf=require(_0x1913('0x1'));var zipdir=require(_0x1913('0x2'));var jsonpatch=require(_0x1913('0x3'));var rp=require('request-promise');var moment=require(_0x1913('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1913('0x5'));var util=require(_0x1913('0x6'));var path=require(_0x1913('0x7'));var sox=require('sox');var csv=require(_0x1913('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1913('0x9'));var squel=require('squel');var crypto=require(_0x1913('0xa'));var jsforce=require(_0x1913('0xb'));var deskjs=require(_0x1913('0xc'));var toCsv=require(_0x1913('0x8'));var querystring=require(_0x1913('0xd'));var Papa=require(_0x1913('0xe'));var Redis=require(_0x1913('0xf'));var authService=require(_0x1913('0x10'));var qs=require(_0x1913('0x11'));var as=require(_0x1913('0x12'));var hardwareService=require(_0x1913('0x13'));var logger=require(_0x1913('0x14'))(_0x1913('0x15'));var utils=require('../../config/utils');var config=require(_0x1913('0x16'));var licenseUtil=require(_0x1913('0x17'));var db=require(_0x1913('0x18'))['db'];function respondWithStatusCode(_0x22744f,_0x24bce1){_0x24bce1=_0x24bce1||0xcc;return function(_0x387947){if(_0x387947){return _0x22744f['sendStatus'](_0x24bce1);}return _0x22744f[_0x1913('0x19')](_0x24bce1)[_0x1913('0x1a')]();};}function respondWithResult(_0x1b51b5,_0x2d7d4e){_0x2d7d4e=_0x2d7d4e||0xc8;return function(_0x4d873f){if(_0x4d873f){return _0x1b51b5['status'](_0x2d7d4e)[_0x1913('0x1b')](_0x4d873f);}};}function respondWithFilteredResult(_0x36672e,_0x4ff251){return function(_0x446550){if(_0x446550){var _0x1eb39e=typeof _0x4ff251[_0x1913('0x1c')]===_0x1913('0x1d')&&typeof _0x4ff251[_0x1913('0x1e')]==='undefined';var _0x5381d3=_0x446550[_0x1913('0x1f')];var _0x81c551=_0x1eb39e?0x0:_0x4ff251[_0x1913('0x1c')];var _0x319808=_0x1eb39e?_0x446550['count']:_0x4ff251[_0x1913('0x1c')]+_0x4ff251['limit'];var _0x201114;if(_0x319808>=_0x5381d3){_0x319808=_0x5381d3;_0x201114=0xc8;}else{_0x201114=0xce;}_0x36672e['status'](_0x201114);return _0x36672e[_0x1913('0x20')]('Content-Range',_0x81c551+'-'+_0x319808+'/'+_0x5381d3)['json'](_0x446550);}return null;};}function patchUpdates(_0x120d4f){return function(_0xa76aa2){try{jsonpatch['apply'](_0xa76aa2,_0x120d4f,!![]);}catch(_0x4e1626){return BPromise[_0x1913('0x21')](_0x4e1626);}return _0xa76aa2['save']();};}function saveUpdates(_0x5dac29,_0x55bb9a){return function(_0x3106dd){if(_0x3106dd){return _0x3106dd['update'](_0x5dac29)[_0x1913('0x22')](function(_0x4f47c6){return _0x4f47c6;});}return null;};}function removeEntity(_0xd2ad3,_0x2cbf80){return function(_0x3b2e3b){if(_0x3b2e3b){return _0x3b2e3b['destroy']()[_0x1913('0x22')](function(){_0xd2ad3[_0x1913('0x19')](0xcc)[_0x1913('0x1a')]();});}};}function handleEntityNotFound(_0x1477fe,_0x72ce42){return function(_0x57d109){if(!_0x57d109){_0x1477fe[_0x1913('0x23')](0x194);}return _0x57d109;};}function handleError(_0x3a3157,_0x411354){_0x411354=_0x411354||0x1f4;return function(_0xf8b486){logger[_0x1913('0x24')](_0xf8b486[_0x1913('0x25')]);if(_0xf8b486[_0x1913('0x26')]){delete _0xf8b486[_0x1913('0x26')];}_0x3a3157['status'](_0x411354)[_0x1913('0x27')](_0xf8b486);};}exports['index']=function(_0x24235a,_0x5e3cd4){var _0x1cb337={},_0x3b96f8={},_0x173498={'count':0x0,'rows':[]};var _0x38cee0=_[_0x1913('0x28')](db[_0x1913('0x29')][_0x1913('0x2a')],function(_0x181a65){return{'name':_0x181a65[_0x1913('0x2b')],'type':_0x181a65[_0x1913('0x2c')][_0x1913('0x2d')]};});_0x3b96f8[_0x1913('0x2e')]=_[_0x1913('0x28')](_0x38cee0,'name');_0x3b96f8[_0x1913('0x2f')]=_[_0x1913('0x30')](_0x24235a[_0x1913('0x2f')]);_0x3b96f8['filters']=_[_0x1913('0x31')](_0x3b96f8['model'],_0x3b96f8[_0x1913('0x2f')]);_0x1cb337['attributes']=_['intersection'](_0x3b96f8['model'],qs['fields'](_0x24235a[_0x1913('0x2f')][_0x1913('0x32')]));_0x1cb337[_0x1913('0x33')]=_0x1cb337[_0x1913('0x33')][_0x1913('0x34')]?_0x1cb337[_0x1913('0x33')]:_0x3b96f8[_0x1913('0x2e')];if(!_0x24235a['query']['hasOwnProperty'](_0x1913('0x35'))){_0x1cb337['limit']=qs['limit'](_0x24235a[_0x1913('0x2f')][_0x1913('0x1e')]);_0x1cb337[_0x1913('0x1c')]=qs['offset'](_0x24235a[_0x1913('0x2f')][_0x1913('0x1c')]);}_0x1cb337[_0x1913('0x36')]=qs['sort'](_0x24235a[_0x1913('0x2f')][_0x1913('0x37')]);_0x1cb337[_0x1913('0x38')]=qs[_0x1913('0x39')](_['pick'](_0x24235a['query'],_0x3b96f8[_0x1913('0x39')]),_0x38cee0);if(_0x24235a[_0x1913('0x2f')][_0x1913('0x3a')]){_0x1cb337[_0x1913('0x38')]=_['merge'](_0x1cb337['where'],{'$or':_[_0x1913('0x28')](_0x38cee0,function(_0x2ad419){if(_0x2ad419['type']!==_0x1913('0x3b')){var _0x3b97ea={};_0x3b97ea[_0x2ad419[_0x1913('0x26')]]={'$like':'%'+_0x24235a[_0x1913('0x2f')]['filter']+'%'};return _0x3b97ea;}})});}_0x1cb337=_['merge']({},_0x1cb337,_0x24235a[_0x1913('0x3c')]);var _0x2b5a78={'where':_0x1cb337[_0x1913('0x38')]};return db[_0x1913('0x29')][_0x1913('0x1f')](_0x2b5a78)['then'](function(_0x1451be){_0x173498[_0x1913('0x1f')]=_0x1451be;if(_0x24235a[_0x1913('0x2f')]['includeAll']){_0x1cb337['include']=[{'all':!![]}];}return db[_0x1913('0x29')]['findAll'](_0x1cb337);})[_0x1913('0x22')](function(_0x5d74ca){_0x173498['rows']=_0x5d74ca;return _0x173498;})[_0x1913('0x22')](respondWithFilteredResult(_0x5e3cd4,_0x1cb337))['catch'](handleError(_0x5e3cd4,null));};exports[_0x1913('0x3d')]=function(_0x3524b3,_0x50ea0e){var _0x43d956={'raw':!![],'where':{'id':_0x3524b3['params']['id']}},_0x732b4f={};_0x732b4f[_0x1913('0x2e')]=_['keys'](db['DeskField'][_0x1913('0x2a')]);_0x732b4f['query']=_[_0x1913('0x30')](_0x3524b3[_0x1913('0x2f')]);_0x732b4f[_0x1913('0x39')]=_['intersection'](_0x732b4f[_0x1913('0x2e')],_0x732b4f[_0x1913('0x2f')]);_0x43d956[_0x1913('0x33')]=_[_0x1913('0x31')](_0x732b4f[_0x1913('0x2e')],qs[_0x1913('0x32')](_0x3524b3[_0x1913('0x2f')]['fields']));_0x43d956['attributes']=_0x43d956[_0x1913('0x33')]['length']?_0x43d956[_0x1913('0x33')]:_0x732b4f[_0x1913('0x2e')];if(_0x3524b3[_0x1913('0x2f')]['includeAll']){_0x43d956[_0x1913('0x3e')]=[{'all':!![]}];}_0x43d956=_[_0x1913('0x3f')]({},_0x43d956,_0x3524b3[_0x1913('0x3c')]);return db[_0x1913('0x29')][_0x1913('0x40')](_0x43d956)[_0x1913('0x22')](handleEntityNotFound(_0x50ea0e,null))[_0x1913('0x22')](respondWithResult(_0x50ea0e,null))[_0x1913('0x41')](handleError(_0x50ea0e,null));};exports[_0x1913('0x42')]=function(_0x25bc7f,_0x5c033a){return db['DeskField'][_0x1913('0x42')](_0x25bc7f['body'],{})[_0x1913('0x22')](respondWithResult(_0x5c033a,0xc9))[_0x1913('0x41')](handleError(_0x5c033a,null));};exports[_0x1913('0x43')]=function(_0x4d20b1,_0x5a7370){if(_0x4d20b1['body']['id']){delete _0x4d20b1[_0x1913('0x44')]['id'];}return db['DeskField'][_0x1913('0x40')]({'where':{'id':_0x4d20b1[_0x1913('0x45')]['id']}})[_0x1913('0x22')](handleEntityNotFound(_0x5a7370,null))[_0x1913('0x22')](saveUpdates(_0x4d20b1[_0x1913('0x44')],null))['then'](respondWithResult(_0x5a7370,null))[_0x1913('0x41')](handleError(_0x5a7370,null));};exports[_0x1913('0x46')]=function(_0x12cbd6,_0x564b67){return db[_0x1913('0x29')][_0x1913('0x40')]({'where':{'id':_0x12cbd6[_0x1913('0x45')]['id']}})[_0x1913('0x22')](handleEntityNotFound(_0x564b67,null))[_0x1913('0x22')](removeEntity(_0x564b67,null))[_0x1913('0x41')](handleError(_0x564b67,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 6896cbe..26e6cf6 100644 --- a/server/api/intDeskField/intDeskField.model.js +++ b/server/api/intDeskField/intDeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6a9=['../../config/environment','./intDeskField.attributes','int_desk_fields','idField','lodash','api','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd6a9,0x1cf));var _0x9d6a=function(_0x111c00,_0x5df487){_0x111c00=_0x111c00-0x0;var _0xb1af07=_0xd6a9[_0x111c00];return _0xb1af07;};'use strict';var _=require(_0x9d6a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d6a('0x1'));var moment=require('moment');var BPromise=require(_0x9d6a('0x2'));var rp=require(_0x9d6a('0x3'));var fs=require('fs');var path=require(_0x9d6a('0x4'));var rimraf=require('rimraf');var config=require(_0x9d6a('0x5'));var attributes=require(_0x9d6a('0x6'));module['exports']=function(_0x1597de,_0x39c44f){return _0x1597de['define']('DeskField',attributes,{'tableName':_0x9d6a('0x7'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x9d6a('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf193=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf193,0xe0));var _0x3f19=function(_0x3b1616,_0x5f2a3f){_0x3b1616=_0x3b1616-0x0;var _0x3425dc=_0xf193[_0x3b1616];return _0x3425dc;};'use strict';var _=require(_0x3f19('0x0'));var util=require(_0x3f19('0x1'));var logger=require(_0x3f19('0x2'))(_0x3f19('0x3'));var moment=require(_0x3f19('0x4'));var BPromise=require('bluebird');var rp=require(_0x3f19('0x5'));var fs=require('fs');var path=require(_0x3f19('0x6'));var rimraf=require(_0x3f19('0x7'));var config=require(_0x3f19('0x8'));var attributes=require('./intDeskField.attributes');module[_0x3f19('0x9')]=function(_0x231ed2,_0x29f57d){return _0x231ed2[_0x3f19('0xa')](_0x3f19('0xb'),attributes,{'tableName':_0x3f19('0xc'),'paranoid':![],'indexes':[{'name':_0x3f19('0xd'),'fields':[_0x3f19('0xe'),_0x3f19('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index d890ef7..2c4f3cc 100644 --- a/server/api/intDeskField/intDeskField.rpc.js +++ b/server/api/intDeskField/intDeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1be98d,_0x4c0cab){var _0x291536=function(_0x2b7a4c){while(--_0x2b7a4c){_0x1be98d['push'](_0x1be98d['shift']());}};_0x291536(++_0x4c0cab);}(_0x6f0d,0xa9));var _0xd6f0=function(_0x2c6d3b,_0x4d33da){_0x2c6d3b=_0x2c6d3b-0x0;var _0x3c410c=_0x6f0d[_0x2c6d3b];return _0x3c410c;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var utils=require(_0xd6f0('0x6'));var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var config=require(_0xd6f0('0x9'));var jayson=require(_0xd6f0('0xa'));var client=jayson[_0xd6f0('0xb')][_0xd6f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x332309,_0x49655b,_0x20a1e3){return new BPromise(function(_0x5ede4c,_0x571b00){return client[_0xd6f0('0xd')](_0x332309,_0x20a1e3)['then'](function(_0x25e0da){logger[_0xd6f0('0xe')](_0xd6f0('0xf'),_0x49655b,_0xd6f0('0x10'));logger[_0xd6f0('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x49655b,'request\x20sent',JSON[_0xd6f0('0x12')](_0x25e0da));if(_0x25e0da['error']){if(_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x14')]===0x1f4){logger[_0xd6f0('0x13')]('DeskField,\x20%s,\x20%s',_0x49655b,_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x571b00(_0x25e0da[_0xd6f0('0x13')]['message']);}logger[_0xd6f0('0x13')](_0xd6f0('0xf'),_0x49655b,_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x5ede4c(_0x25e0da[_0xd6f0('0x13')][_0xd6f0('0x15')]);}else{logger['info'](_0xd6f0('0xf'),_0x49655b,_0xd6f0('0x10'));_0x5ede4c(_0x25e0da[_0xd6f0('0x16')]['message']);}})[_0xd6f0('0x17')](function(_0x18d198){logger[_0xd6f0('0x13')]('DeskField,\x20%s,\x20%s',_0x49655b,_0x18d198);_0x571b00(_0x18d198);});});} \ No newline at end of file +var _0x82e5=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x82e5,0x19a));var _0x582e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x82e5[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x582e('0x0'));var util=require(_0x582e('0x1'));var moment=require(_0x582e('0x2'));var BPromise=require('bluebird');var rs=require(_0x582e('0x3'));var fs=require('fs');var Redis=require(_0x582e('0x4'));var db=require(_0x582e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x582e('0x6'))('rpc');var config=require(_0x582e('0x7'));var jayson=require(_0x582e('0x8'));var client=jayson['client'][_0x582e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3c72,_0x400141,_0x350095){return new BPromise(function(_0x169342,_0x36bb1f){return client[_0x582e('0xa')](_0x2f3c72,_0x350095)[_0x582e('0xb')](function(_0xbb2a83){logger[_0x582e('0xc')](_0x582e('0xd'),_0x400141,_0x582e('0xe'));logger[_0x582e('0xf')](_0x582e('0x10'),_0x400141,_0x582e('0xe'),JSON[_0x582e('0x11')](_0xbb2a83));if(_0xbb2a83[_0x582e('0x12')]){if(_0xbb2a83[_0x582e('0x12')][_0x582e('0x13')]===0x1f4){logger[_0x582e('0x12')](_0x582e('0xd'),_0x400141,_0xbb2a83[_0x582e('0x12')]['message']);return _0x36bb1f(_0xbb2a83[_0x582e('0x12')][_0x582e('0x14')]);}logger[_0x582e('0x12')](_0x582e('0xd'),_0x400141,_0xbb2a83[_0x582e('0x12')]['message']);return _0x169342(_0xbb2a83['error']['message']);}else{logger[_0x582e('0xc')](_0x582e('0xd'),_0x400141,_0x582e('0xe'));_0x169342(_0xbb2a83[_0x582e('0x15')][_0x582e('0x14')]);}})[_0x582e('0x16')](function(_0x38e79c){logger['error'](_0x582e('0xd'),_0x400141,_0x38e79c);_0x36bb1f(_0x38e79c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 2a48a73..44c67e9 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91b7=['index','getConfigurations','get','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x37d2d3,_0x3d042c){var _0x792538=function(_0x3e1798){while(--_0x3e1798){_0x37d2d3['push'](_0x37d2d3['shift']());}};_0x792538(++_0x3d042c);}(_0x91b7,0xfe));var _0x791b=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x91b7[_0x599f41];return _0x2e4d58;};'use strict';var multer=require('multer');var util=require(_0x791b('0x0'));var path=require(_0x791b('0x1'));var timeout=require(_0x791b('0x2'));var express=require(_0x791b('0x3'));var router=express[_0x791b('0x4')]();var fs_extra=require(_0x791b('0x5'));var auth=require(_0x791b('0x6'));var interaction=require(_0x791b('0x7'));var config=require(_0x791b('0x8'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x791b('0x9')](),controller[_0x791b('0xa')]);router['get']('/:id',auth[_0x791b('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0x791b('0x9')](),controller[_0x791b('0xb')]);router[_0x791b('0xc')]('/:id/fields',auth[_0x791b('0x9')](),controller[_0x791b('0xd')]);router[_0x791b('0xe')]('/',auth['isAuthenticated'](),controller[_0x791b('0xf')]);router['post'](_0x791b('0x10'),auth[_0x791b('0x9')](),controller[_0x791b('0x11')]);router[_0x791b('0x12')]('/:id',auth[_0x791b('0x9')](),controller[_0x791b('0x13')]);router[_0x791b('0x14')](_0x791b('0x15'),auth[_0x791b('0x9')](),controller[_0x791b('0x16')]);module[_0x791b('0x17')]=router; \ No newline at end of file +var _0x11eb=['./intDynamics365Account.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x11eb,0x187));var _0xb11e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x11eb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xb11e('0x0'));var util=require(_0xb11e('0x1'));var path=require(_0xb11e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb11e('0x3'));var router=express[_0xb11e('0x4')]();var fs_extra=require(_0xb11e('0x5'));var auth=require(_0xb11e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb11e('0x7'));var controller=require(_0xb11e('0x8'));router['get']('/',auth[_0xb11e('0x9')](),controller[_0xb11e('0xa')]);router[_0xb11e('0xb')](_0xb11e('0xc'),auth[_0xb11e('0x9')](),controller['show']);router[_0xb11e('0xb')](_0xb11e('0xd'),auth[_0xb11e('0x9')](),controller[_0xb11e('0xe')]);router['get']('/:id/fields',auth[_0xb11e('0x9')](),controller[_0xb11e('0xf')]);router['post']('/',auth[_0xb11e('0x9')](),controller[_0xb11e('0x10')]);router[_0xb11e('0x11')](_0xb11e('0xd'),auth[_0xb11e('0x9')](),controller[_0xb11e('0x12')]);router[_0xb11e('0x13')]('/:id',auth[_0xb11e('0x9')](),controller['update']);router['delete'](_0xb11e('0xc'),auth[_0xb11e('0x9')](),controller[_0xb11e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 8c75c4a..196a204 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89b8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x5d4e2a,_0x3d868c){var _0x4d9086=function(_0x185237){while(--_0x185237){_0x5d4e2a['push'](_0x5d4e2a['shift']());}};_0x4d9086(++_0x3d868c);}(_0x89b8,0x19f));var _0x889b=function(_0x33f925,_0x4a5ecf){_0x33f925=_0x33f925-0x0;var _0x368a02=_0x89b8[_0x33f925];return _0x368a02;};'use strict';var Sequelize=require(_0x889b('0x0'));module[_0x889b('0x1')]={'name':{'type':Sequelize[_0x889b('0x2')]},'username':{'type':Sequelize[_0x889b('0x2')]},'password':{'type':Sequelize[_0x889b('0x2')]},'remoteUri':{'type':Sequelize[_0x889b('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x889b('0x2')]},'clientSecret':{'type':Sequelize[_0x889b('0x2')]},'serverUrl':{'type':Sequelize[_0x889b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x889b('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x15c6=['BOOLEAN','sequelize','exports','STRING'];(function(_0x5dce54,_0x4c89bb){var _0x2c8aaf=function(_0x46d92b){while(--_0x46d92b){_0x5dce54['push'](_0x5dce54['shift']());}};_0x2c8aaf(++_0x4c89bb);}(_0x15c6,0x1cd));var _0x615c=function(_0x52fd3d,_0x3af718){_0x52fd3d=_0x52fd3d-0x0;var _0x49b06d=_0x15c6[_0x52fd3d];return _0x49b06d;};'use strict';var Sequelize=require(_0x615c('0x0'));module[_0x615c('0x1')]={'name':{'type':Sequelize[_0x615c('0x2')]},'username':{'type':Sequelize[_0x615c('0x2')]},'password':{'type':Sequelize[_0x615c('0x2')]},'remoteUri':{'type':Sequelize[_0x615c('0x2')]},'tenantId':{'type':Sequelize[_0x615c('0x2')]},'clientId':{'type':Sequelize[_0x615c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x615c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c837046..cd112b1 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e29=['true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','status','send','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','getConfigurations','findOne','Dynamics365Configuration','order','filter','hasOwnProperty','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','format','getFields','ticketType','incident','Incident','description','customerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','remoteUri','POST','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','all','forEach','isNil','BooleanAttributeMetadata','push','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','4.0'];(function(_0x57aa06,_0x3b14d8){var _0x14cf0e=function(_0x4da756){while(--_0x4da756){_0x57aa06['push'](_0x57aa06['shift']());}};_0x14cf0e(++_0x3b14d8);}(_0x7e29,0x177));var _0x97e2=function(_0x1db4f4,_0x2395cc){_0x1db4f4=_0x1db4f4-0x0;var _0x4ab48c=_0x7e29[_0x1db4f4];return _0x4ab48c;};'use strict';var rp=require(_0x97e2('0x0'));var util=require(_0x97e2('0x1'));var _=require('lodash');var qs=require(_0x97e2('0x2'));var logger=require(_0x97e2('0x3'))(_0x97e2('0x4'));var db=require(_0x97e2('0x5'))['db'];var integrations=require(_0x97e2('0x6'));function respondWithResult(_0x74cc91,_0x5dc9f8){_0x5dc9f8=_0x5dc9f8||0xc8;return function(_0x59a887){if(_0x59a887){return _0x74cc91['status'](_0x5dc9f8)[_0x97e2('0x7')](_0x59a887);}};}function respondWithFilteredResult(_0x3750a8,_0x3c79ec){return function(_0x47f4aa){if(_0x47f4aa){var _0x34650e=typeof _0x3c79ec[_0x97e2('0x8')]===_0x97e2('0x9')&&typeof _0x3c79ec[_0x97e2('0xa')]===_0x97e2('0x9');var _0x2e9b9d=_0x47f4aa['count'];var _0x44da38=_0x34650e?0x0:_0x3c79ec['offset'];var _0x15e75d=_0x34650e?_0x47f4aa[_0x97e2('0xb')]:_0x3c79ec[_0x97e2('0x8')]+_0x3c79ec[_0x97e2('0xa')];var _0x2c8cab;if(_0x15e75d>=_0x2e9b9d){_0x15e75d=_0x2e9b9d;_0x2c8cab=0xc8;}else{_0x2c8cab=0xce;}_0x3750a8['status'](_0x2c8cab);return _0x3750a8['set'](_0x97e2('0xc'),_0x44da38+'-'+_0x15e75d+'/'+_0x2e9b9d)[_0x97e2('0x7')](_0x47f4aa);}return null;};}function saveUpdates(_0x1b31af){return function(_0x55defb){if(_0x55defb){return _0x55defb[_0x97e2('0xd')](_0x1b31af)[_0x97e2('0xe')](function(_0x28fee8){return _0x28fee8;});}return null;};}function removeEntity(_0x1fca8a){return function(_0x21c1a6){if(_0x21c1a6){return _0x21c1a6[_0x97e2('0xf')]()[_0x97e2('0xe')](function(){_0x1fca8a['status'](0xcc)[_0x97e2('0x10')]();});}};}function handleEntityNotFound(_0x2f7182){return function(_0x8ede7a){if(!_0x8ede7a){_0x2f7182[_0x97e2('0x11')](0x194);}return _0x8ede7a;};}function handleError(_0x2bf4af,_0x5d86a8){_0x5d86a8=_0x5d86a8||0x1f4;return function(_0x4ff89e){logger[_0x97e2('0x12')](_0x4ff89e[_0x97e2('0x13')]);if(_0x4ff89e[_0x97e2('0x14')]){delete _0x4ff89e[_0x97e2('0x14')];}_0x2bf4af[_0x97e2('0x15')](_0x5d86a8)[_0x97e2('0x16')](_0x4ff89e);};}exports['index']=function(_0x5d3bf4,_0x294b4c){var _0x2483f9={},_0x55979a={},_0x1c79d9={'count':0x0,'rows':[]};var _0x2d4f9e=_['map'](db[_0x97e2('0x17')][_0x97e2('0x18')],function(_0x7ed80){return{'name':_0x7ed80[_0x97e2('0x19')],'type':_0x7ed80[_0x97e2('0x1a')][_0x97e2('0x1b')]};});_0x55979a[_0x97e2('0x1c')]=_[_0x97e2('0x1d')](_0x2d4f9e,_0x97e2('0x14'));_0x55979a[_0x97e2('0x1e')]=_['keys'](_0x5d3bf4[_0x97e2('0x1e')]);_0x55979a[_0x97e2('0x1f')]=_['intersection'](_0x55979a[_0x97e2('0x1c')],_0x55979a[_0x97e2('0x1e')]);_0x2483f9['attributes']=_[_0x97e2('0x20')](_0x55979a[_0x97e2('0x1c')],qs['fields'](_0x5d3bf4[_0x97e2('0x1e')][_0x97e2('0x21')]));_0x2483f9[_0x97e2('0x22')]=_0x2483f9[_0x97e2('0x22')][_0x97e2('0x23')]?_0x2483f9[_0x97e2('0x22')]:_0x55979a[_0x97e2('0x1c')];if(!_0x5d3bf4[_0x97e2('0x1e')]['hasOwnProperty'](_0x97e2('0x24'))){_0x2483f9[_0x97e2('0xa')]=qs[_0x97e2('0xa')](_0x5d3bf4[_0x97e2('0x1e')]['limit']);_0x2483f9[_0x97e2('0x8')]=qs['offset'](_0x5d3bf4['query'][_0x97e2('0x8')]);}_0x2483f9['order']=qs['sort'](_0x5d3bf4['query'][_0x97e2('0x25')]);_0x2483f9[_0x97e2('0x26')]=qs[_0x97e2('0x1f')](_[_0x97e2('0x27')](_0x5d3bf4[_0x97e2('0x1e')],_0x55979a[_0x97e2('0x1f')]),_0x2d4f9e);if(_0x5d3bf4[_0x97e2('0x1e')]['filter']){_0x2483f9[_0x97e2('0x26')]=_[_0x97e2('0x28')](_0x2483f9[_0x97e2('0x26')],{'$or':_['map'](_0x2d4f9e,function(_0x70aff5){if(_0x70aff5['type']!==_0x97e2('0x29')){var _0x338da6={};_0x338da6[_0x70aff5[_0x97e2('0x14')]]={'$like':'%'+_0x5d3bf4['query']['filter']+'%'};return _0x338da6;}})});}_0x2483f9=_[_0x97e2('0x28')]({},_0x2483f9,_0x5d3bf4[_0x97e2('0x2a')]);var _0x490ddc={'where':_0x2483f9[_0x97e2('0x26')]};return db[_0x97e2('0x17')]['count'](_0x490ddc)[_0x97e2('0xe')](function(_0x1bf4ff){_0x1c79d9[_0x97e2('0xb')]=_0x1bf4ff;if(_0x5d3bf4[_0x97e2('0x1e')][_0x97e2('0x2b')]){_0x2483f9[_0x97e2('0x2c')]=[{'all':!![]}];}return db[_0x97e2('0x17')][_0x97e2('0x2d')](_0x2483f9);})[_0x97e2('0xe')](function(_0x42326c){_0x1c79d9['rows']=_0x42326c;return _0x1c79d9;})[_0x97e2('0xe')](respondWithFilteredResult(_0x294b4c,_0x2483f9))[_0x97e2('0x2e')](handleError(_0x294b4c,null));};exports[_0x97e2('0x2f')]=function(_0x1f8abd,_0x15cfb4){var _0x416767={'raw':![],'where':{'id':_0x1f8abd[_0x97e2('0x30')]['id']}},_0x318cf2={};_0x318cf2['model']=_[_0x97e2('0x31')](db[_0x97e2('0x17')][_0x97e2('0x18')]);_0x318cf2['query']=_['keys'](_0x1f8abd[_0x97e2('0x1e')]);_0x318cf2[_0x97e2('0x1f')]=_[_0x97e2('0x20')](_0x318cf2['model'],_0x318cf2[_0x97e2('0x1e')]);_0x416767[_0x97e2('0x22')]=_[_0x97e2('0x20')](_0x318cf2[_0x97e2('0x1c')],qs[_0x97e2('0x21')](_0x1f8abd['query'][_0x97e2('0x21')]));_0x416767[_0x97e2('0x22')]=_0x416767[_0x97e2('0x22')]['length']?_0x416767['attributes']:_0x318cf2[_0x97e2('0x1c')];if(_0x1f8abd[_0x97e2('0x1e')][_0x97e2('0x2b')]){_0x416767[_0x97e2('0x2c')]=[{'all':!![]}];}_0x416767=_[_0x97e2('0x28')]({},_0x416767,_0x1f8abd['options']);return db[_0x97e2('0x17')]['find'](_0x416767)[_0x97e2('0xe')](handleEntityNotFound(_0x15cfb4,null))[_0x97e2('0xe')](respondWithResult(_0x15cfb4,null))['catch'](handleError(_0x15cfb4,null));};exports[_0x97e2('0x32')]=function(_0x497a22,_0x1ae7db){return db[_0x97e2('0x17')][_0x97e2('0x32')](_0x497a22[_0x97e2('0x33')],{})[_0x97e2('0xe')](respondWithResult(_0x1ae7db,0xc9))[_0x97e2('0x2e')](handleError(_0x1ae7db,null));};exports[_0x97e2('0xd')]=function(_0x20a168,_0x44c77e){if(_0x20a168[_0x97e2('0x33')]['id']){delete _0x20a168[_0x97e2('0x33')]['id'];}return db['Dynamics365Account'][_0x97e2('0x34')]({'where':{'id':_0x20a168[_0x97e2('0x30')]['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x44c77e,null))[_0x97e2('0xe')](saveUpdates(_0x20a168[_0x97e2('0x33')],null))['then'](respondWithResult(_0x44c77e,null))[_0x97e2('0x2e')](handleError(_0x44c77e,null));};exports[_0x97e2('0xf')]=function(_0x1bcdf6,_0x151019){return db[_0x97e2('0x17')]['find']({'where':{'id':_0x1bcdf6['params']['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x151019,null))[_0x97e2('0xe')](removeEntity(_0x151019,null))['catch'](handleError(_0x151019,null));};exports[_0x97e2('0x35')]=function(_0x334fc3,_0x2c5936){var _0x3a0600={};var _0x166fd9={};var _0x3f14a7;var _0x325692;return db[_0x97e2('0x17')][_0x97e2('0x36')]({'where':{'id':_0x334fc3[_0x97e2('0x30')]['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x2c5936,null))[_0x97e2('0xe')](function(_0x153dd1){if(_0x153dd1){_0x3f14a7=_0x153dd1;_0x166fd9[_0x97e2('0x1c')]=_['keys'](db[_0x97e2('0x37')][_0x97e2('0x18')]);_0x166fd9[_0x97e2('0x1e')]=_[_0x97e2('0x31')](_0x334fc3[_0x97e2('0x1e')]);_0x166fd9[_0x97e2('0x1f')]=_[_0x97e2('0x20')](_0x166fd9[_0x97e2('0x1c')],_0x166fd9[_0x97e2('0x1e')]);_0x3a0600[_0x97e2('0x22')]=_[_0x97e2('0x20')](_0x166fd9['model'],qs[_0x97e2('0x21')](_0x334fc3[_0x97e2('0x1e')]['fields']));_0x3a0600[_0x97e2('0x22')]=_0x3a0600[_0x97e2('0x22')]['length']?_0x3a0600[_0x97e2('0x22')]:_0x166fd9[_0x97e2('0x1c')];_0x3a0600[_0x97e2('0x38')]=qs['sort'](_0x334fc3['query']['sort']);_0x3a0600[_0x97e2('0x26')]=qs[_0x97e2('0x1f')](_[_0x97e2('0x27')](_0x334fc3[_0x97e2('0x1e')],_0x166fd9[_0x97e2('0x1f')]));if(_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x39')]){_0x3a0600['where']=_['merge'](_0x3a0600[_0x97e2('0x26')],{'$or':_[_0x97e2('0x1d')](_0x3a0600[_0x97e2('0x22')],function(_0x3970cc){var _0x44590a={};_0x44590a[_0x3970cc]={'$like':'%'+_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x39')]+'%'};return _0x44590a;})});}_0x3a0600=_[_0x97e2('0x28')]({},_0x3a0600,_0x334fc3[_0x97e2('0x2a')]);return _0x3f14a7[_0x97e2('0x35')](_0x3a0600);}})[_0x97e2('0xe')](function(_0x35e275){if(_0x35e275){_0x325692=_0x35e275['length'];if(!_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x3a')](_0x97e2('0x24'))){_0x3a0600[_0x97e2('0xa')]=qs['limit'](_0x334fc3[_0x97e2('0x1e')][_0x97e2('0xa')]);_0x3a0600[_0x97e2('0x8')]=qs[_0x97e2('0x8')](_0x334fc3[_0x97e2('0x1e')][_0x97e2('0x8')]);}return _0x3f14a7[_0x97e2('0x35')](_0x3a0600);}})[_0x97e2('0xe')](function(_0x4e9141){if(_0x4e9141){return _0x4e9141?{'count':_0x325692,'rows':_0x4e9141}:null;}})[_0x97e2('0xe')](respondWithResult(_0x2c5936,null))[_0x97e2('0x2e')](handleError(_0x2c5936,null));};exports['addConfiguration']=function(_0x3bda17,_0x3d9647){if(_0x3bda17[_0x97e2('0x33')]['id']){delete _0x3bda17[_0x97e2('0x33')]['id'];}return db[_0x97e2('0x17')]['findOne']({'where':{'id':_0x3bda17['params']['id']}})[_0x97e2('0xe')](handleEntityNotFound(_0x3d9647,null))['then'](function(_0x130717){if(_0x130717){_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3b')]=_0x130717['id'];_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3c')]=integrations['getSubjects'](_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3d')],_0x3bda17[_0x97e2('0x33')][_0x97e2('0x1a')]);_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3e')]=integrations[_0x97e2('0x3f')](_0x3bda17[_0x97e2('0x33')][_0x97e2('0x3d')],_0x3bda17[_0x97e2('0x33')][_0x97e2('0x1a')]);return db[_0x97e2('0x37')][_0x97e2('0x32')](_0x3bda17['body'],{'include':[{'model':db[_0x97e2('0x40')],'as':_0x97e2('0x3c')},{'model':db[_0x97e2('0x40')],'as':'Descriptions'}]});}return null;})[_0x97e2('0xe')](respondWithResult(_0x3d9647,null))['catch'](handleError(_0x3d9647,null));};function sanitizeRemoteUri(_0x83b87b){var _0x329fe4=_0x83b87b['slice'](-0x1);if(_0x329fe4==='/')return _0x83b87b[_0x97e2('0x41')](0x0,_0x83b87b['lastIndexOf'](_0x329fe4));return _0x83b87b;}function getWebApiUrl(_0x3f6c26){return util[_0x97e2('0x42')]('%s/api/data/v9.0/',_0x3f6c26);}exports[_0x97e2('0x43')]=function(_0x850590,_0x5e840e){var _0x18abb6=_0x850590[_0x97e2('0x1e')][_0x97e2('0x44')];var _0x5a2199=_0x18abb6===_0x97e2('0x45')?_0x97e2('0x46'):'PhoneCall';var _0x491631='';var _0x4edb2d='';var _0x5d9298='';var _0x2b75a5='';var _0x24f2ff='';var _0x226529='';var _0x1eeea4='';var _0x16c8f0='';var _0x39e14a=['title',_0x97e2('0x47'),_0x97e2('0x48'),'ownerid','caseorigincode',_0x97e2('0x49'),_0x97e2('0x4a'),_0x97e2('0x4b'),_0x97e2('0x4c'),_0x97e2('0x4d')];var _0x287d12=[_0x97e2('0x4e'),'accountidyominame',_0x97e2('0x4f'),_0x97e2('0x50'),'contactidname',_0x97e2('0x51'),'contractdetailidname',_0x97e2('0x52'),_0x97e2('0x53'),'createdbyexternalpartyyominame',_0x97e2('0x54'),_0x97e2('0x55'),_0x97e2('0x56'),_0x97e2('0x57'),_0x97e2('0x58'),_0x97e2('0x59'),_0x97e2('0x5a'),_0x97e2('0x5b'),_0x97e2('0x5c'),_0x97e2('0x5d'),_0x97e2('0x5e'),'entityimage_url','escalatedon','exchangerate',_0x97e2('0x5f'),_0x97e2('0x60'),'importsequencenumber',_0x97e2('0x61'),'kbarticleidname',_0x97e2('0x62'),_0x97e2('0x63'),'modifiedbyexternalpartyname',_0x97e2('0x64'),_0x97e2('0x65'),_0x97e2('0x66'),'modifiedon',_0x97e2('0x67'),_0x97e2('0x68'),_0x97e2('0x69'),_0x97e2('0x6a'),_0x97e2('0x6b'),_0x97e2('0x6c'),_0x97e2('0x6d'),'owneridname','owneridtype','owneridyominame',_0x97e2('0x6e'),'primarycontactidname',_0x97e2('0x6f'),_0x97e2('0x70'),_0x97e2('0x71'),_0x97e2('0x72'),_0x97e2('0x73'),_0x97e2('0x74'),_0x97e2('0x75'),_0x97e2('0x76'),_0x97e2('0x77'),_0x97e2('0x78'),_0x97e2('0x79'),_0x97e2('0x7a'),'socialprofileidname','statecode',_0x97e2('0x7b'),_0x97e2('0x7c'),_0x97e2('0x7d'),_0x97e2('0x7e'),_0x97e2('0x7f'),_0x97e2('0x80'),'utcconversiontimezonecode',_0x97e2('0x81')];var _0x3f5c90=_0x39e14a[_0x97e2('0x82')](_0x287d12);return db[_0x97e2('0x17')][_0x97e2('0x36')]({'where':{'id':_0x850590['params']['id']},'attributes':['id',_0x97e2('0x83'),_0x97e2('0x84'),'remoteUri',_0x97e2('0x85'),_0x97e2('0x86'),_0x97e2('0x87'),_0x97e2('0x88')],'include':[{'model':db[_0x97e2('0x89')],'as':_0x97e2('0x89'),'attributes':['id',_0x97e2('0x8a'),'data7']}]})['then'](handleEntityNotFound(_0x5e840e,null))[_0x97e2('0xe')](function(_0x3eb0ea){if(_0x3eb0ea){if(_0x3eb0ea['modernAuthentication']){_0x3eb0ea[_0x97e2('0x8b')]=_0x3eb0ea[_0x97e2('0x89')]['data5'];_0x16c8f0=sanitizeRemoteUri(_0x3eb0ea[_0x97e2('0x89')][_0x97e2('0x8c')]);_0x1eeea4=getWebApiUrl(_0x16c8f0);return _0x3eb0ea;}_0x16c8f0=sanitizeRemoteUri(_0x3eb0ea[_0x97e2('0x8d')]);_0x1eeea4=getWebApiUrl(_0x16c8f0);var _0x3e4fcf={'method':_0x97e2('0x8e'),'uri':_0x97e2('0x8f')+_0x3eb0ea[_0x97e2('0x85')]+'/oauth2/token','form':{'client_id':_0x3eb0ea['clientId'],'resource':_0x16c8f0,'username':_0x3eb0ea[_0x97e2('0x83')],'password':_0x3eb0ea[_0x97e2('0x84')],'grant_type':'password','client_secret':_0x3eb0ea['clientSecret']},'json':!![]};return rp(_0x3e4fcf);}})[_0x97e2('0xe')](function(_0x49a510){_0x226529=_0x49a510['access_token'];var _0x444403={'method':_0x97e2('0x90'),'uri':encodeURI(_0x1eeea4+_0x97e2('0x91')+_0x5a2199+'\x27'),'headers':{'Authorization':_0x97e2('0x92')+_0x226529,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x444403);})[_0x97e2('0xe')](function(_0x3d91d2){var _0x1f1efc=_0x3d91d2[_0x97e2('0x93')][0x0];var _0x2d27c7=_0x1f1efc[_0x97e2('0x94')];var _0x554ea8={'method':'GET','uri':_0x1eeea4+_0x97e2('0x95')+_0x2d27c7+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x226529,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x554ea8);})[_0x97e2('0xe')](function(_0x5da639){_0x491631=_0x5da639;_0x4edb2d=_0x491631[_0x97e2('0x96')];_0x4edb2d=_[_0x97e2('0x97')](_0x4edb2d,function(_0x215898){return!_0x3f5c90[_0x97e2('0x98')](_0x215898[_0x97e2('0x99')]);});var _0x4df200=[];var _0x3a9716=[];_0x4edb2d['forEach'](function(_0x2fb9e6){if(_0x2fb9e6['@odata.type']){var _0x1d49aa=_0x2fb9e6[_0x97e2('0x9a')][_0x97e2('0x41')](_0x2fb9e6[_0x97e2('0x9a')][_0x97e2('0x9b')]('.')+0x1);if(_0x1d49aa==='PicklistAttributeMetadata'){_0x4df200['push'](getSelectList(_0x1eeea4,_0x18abb6,_0x3a9716,_0x491631[_0x97e2('0x94')],_0x2fb9e6[_0x97e2('0x94')],_0x226529));}}});return Promise[_0x97e2('0x9c')](_0x4df200);})['then'](function(_0xe309a){_0x5d9298=_0xe309a[0x0];var _0x10663d=[];var _0x4de0ea=[];_0x4edb2d[_0x97e2('0x9d')](function(_0x435553){if(!_[_0x97e2('0x9e')](_0x435553[_0x97e2('0x9a')])){var _0x111448=_0x435553[_0x97e2('0x9a')][_0x97e2('0x41')](_0x435553[_0x97e2('0x9a')][_0x97e2('0x9b')]('.')+0x1);if(_0x111448===_0x97e2('0x9f')){_0x10663d[_0x97e2('0xa0')](getBooleanList(_0x1eeea4,_0x18abb6,_0x4de0ea,_0x491631[_0x97e2('0x94')],_0x435553[_0x97e2('0x94')],_0x226529));}}});return Promise[_0x97e2('0x9c')](_0x10663d);})[_0x97e2('0xe')](function(_0x4abca3){_0x2b75a5=_0x4abca3[0x0];var _0x2956e6=[];var _0x384d27=[];_0x4edb2d['forEach'](function(_0x311159){if(_0x311159[_0x97e2('0x9a')]){var _0x2eaab2=_0x311159[_0x97e2('0x9a')][_0x97e2('0x41')](_0x311159['@odata.type'][_0x97e2('0x9b')]('.')+0x1);if(_0x2eaab2==='StringAttributeMetadata'||_0x2eaab2==='DoubleAttributeMetadata'||_0x2eaab2===_0x97e2('0xa1')||_0x2eaab2===_0x97e2('0xa2')||_0x2eaab2===_0x97e2('0xa3')||_0x2eaab2===_0x97e2('0xa4')||_0x2eaab2==='StatusAttributeMetadata'||_0x2eaab2===_0x97e2('0xa5')||_0x2eaab2===_0x97e2('0xa6')||_0x2eaab2===_0x97e2('0xa7')){_0x2956e6['push'](getInputList(_0x1eeea4,_0x18abb6,_0x2eaab2,_0x384d27,_0x491631[_0x97e2('0x94')],_0x311159[_0x97e2('0x94')],_0x226529));}}});return Promise['all'](_0x2956e6);})[_0x97e2('0xe')](function(_0x6aa0d){_0x24f2ff=_0x6aa0d[0x0];var _0x579e93=_0x5d9298[_0x97e2('0x82')](_0x2b75a5)[_0x97e2('0x82')](_0x24f2ff);var _0x52e10b={'count':_0x579e93['length'],'rows':_0x579e93};return _0x52e10b;})['then'](respondWithResult(_0x5e840e,null))['catch'](function(_0xd46c7){var _0x2bbb3b=_0x850590[_0x97e2('0x1e')][_0x97e2('0xa8')]?0x1f4:_0xd46c7['statusCode']||0x1f4;logger[_0x97e2('0x12')](_0xd46c7['stack']);delete _0xd46c7[_0x97e2('0x14')];if(_0x2bbb3b===0x191){_0x2bbb3b=0x190;}_0x5e840e['status'](_0x2bbb3b)['send'](_0x850590[_0x97e2('0x1e')][_0x97e2('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0xd46c7['statusCode']}:_0xd46c7);});};function getSelectList(_0x23b940,_0x1ee17b,_0x498419,_0x2e2b18,_0x493d7f,_0x28e49e){var _0x200dbd={'method':_0x97e2('0x90'),'uri':_0x23b940+_0x97e2('0x95')+_0x2e2b18+_0x97e2('0xa9')+_0x493d7f+_0x97e2('0xaa')+_0x97e2('0xab'),'headers':{'Authorization':_0x97e2('0x92')+_0x28e49e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x200dbd)[_0x97e2('0xe')](function(_0x4d25d8){var _0x244649=[];var _0xb66753=_0x4d25d8[_0x97e2('0xac')][_0x97e2('0xad')];_0xb66753[_0x97e2('0x9d')](function(_0x2779be){_0x244649[_0x97e2('0xa0')]({'name':_0x2779be[_0x97e2('0xae')]['UserLocalizedLabel']['Label'],'value':String(_0x2779be[_0x97e2('0xaf')])});});var _0x533ee1={'id':_0x1ee17b+'_'+_0x4d25d8['LogicalName'],'name':_0x4d25d8[_0x97e2('0xb0')][_0x97e2('0xb1')]['Label'],'custom':![],'options':_0x244649};_0x498419['push'](_0x533ee1);return _0x498419;});}function getBooleanList(_0x2a9de4,_0x27b5ff,_0x381532,_0x2b1604,_0x33f86c,_0x59bcf1){var _0x151653={'method':'GET','uri':_0x2a9de4+_0x97e2('0x95')+_0x2b1604+')/Attributes('+_0x33f86c+_0x97e2('0xb2'),'headers':{'Authorization':'Bearer\x20'+_0x59bcf1,'If-None-Match':null,'OData-Version':_0x97e2('0xb3')},'json':!![]};return rp(_0x151653)[_0x97e2('0xe')](function(_0x44b1c1){var _0x1700dc=[];_0x1700dc[_0x97e2('0xa0')]({'name':_0x44b1c1['OptionSet']['TrueOption'][_0x97e2('0xae')]['UserLocalizedLabel'][_0x97e2('0xae')],'value':_0x97e2('0xb4')},{'name':_0x44b1c1[_0x97e2('0xac')][_0x97e2('0xb5')]['Label'][_0x97e2('0xb1')]['Label'],'value':_0x97e2('0xb6')});var _0x126db7={'id':_0x27b5ff+'_'+_0x44b1c1[_0x97e2('0x99')],'name':_0x44b1c1[_0x97e2('0xb0')][_0x97e2('0xb1')]['Label'],'custom':![],'options':_0x1700dc};_0x381532[_0x97e2('0xa0')](_0x126db7);return _0x381532;});}function getInputList(_0x34d8b6,_0x18f20a,_0x2435ab,_0x2fc8a4,_0x2d66af,_0x334b26,_0xa16510){var _0x357400={'method':'GET','uri':_0x34d8b6+_0x97e2('0x95')+_0x2d66af+')/Attributes('+_0x334b26+_0x97e2('0xb7')+_0x2435ab+_0x97e2('0xb8'),'headers':{'Authorization':_0x97e2('0x92')+_0xa16510,'If-None-Match':null,'OData-Version':_0x97e2('0xb3')},'json':!![]};return rp(_0x357400)['then'](function(_0x244107){var _0x1d12cd={'id':_0x18f20a+'_'+_0x244107[_0x97e2('0x99')],'name':_0x244107[_0x97e2('0xb0')]['UserLocalizedLabel']?_0x244107['DisplayName'][_0x97e2('0xb1')][_0x97e2('0xae')]:_0x244107[_0x97e2('0x99')],'custom':![],'options':[]};_0x2fc8a4[_0x97e2('0xa0')](_0x1d12cd);return _0x2fc8a4;});} \ No newline at end of file +var _0x6146=['lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','modernAuthentication','access_token','data7','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x6146,0xba));var _0x6614=function(_0xb4d928,_0x579093){_0xb4d928=_0xb4d928-0x0;var _0x47166e=_0x6146[_0xb4d928];return _0x47166e;};'use strict';var rp=require(_0x6614('0x0'));var util=require('util');var _=require(_0x6614('0x1'));var qs=require(_0x6614('0x2'));var logger=require(_0x6614('0x3'))(_0x6614('0x4'));var db=require(_0x6614('0x5'))['db'];var integrations=require(_0x6614('0x6'));function respondWithResult(_0x45a0d1,_0x582543){_0x582543=_0x582543||0xc8;return function(_0x11cc56){if(_0x11cc56){return _0x45a0d1[_0x6614('0x7')](_0x582543)[_0x6614('0x8')](_0x11cc56);}};}function respondWithFilteredResult(_0x43c7a7,_0x3b158b){return function(_0x2e84fa){if(_0x2e84fa){var _0x4116e4=typeof _0x3b158b[_0x6614('0x9')]===_0x6614('0xa')&&typeof _0x3b158b['limit']===_0x6614('0xa');var _0x267e1b=_0x2e84fa[_0x6614('0xb')];var _0x5e9932=_0x4116e4?0x0:_0x3b158b[_0x6614('0x9')];var _0x42c7db=_0x4116e4?_0x2e84fa[_0x6614('0xb')]:_0x3b158b[_0x6614('0x9')]+_0x3b158b[_0x6614('0xc')];var _0x4776c4;if(_0x42c7db>=_0x267e1b){_0x42c7db=_0x267e1b;_0x4776c4=0xc8;}else{_0x4776c4=0xce;}_0x43c7a7[_0x6614('0x7')](_0x4776c4);return _0x43c7a7['set'](_0x6614('0xd'),_0x5e9932+'-'+_0x42c7db+'/'+_0x267e1b)['json'](_0x2e84fa);}return null;};}function saveUpdates(_0x3550a7){return function(_0x11b16b){if(_0x11b16b){return _0x11b16b[_0x6614('0xe')](_0x3550a7)[_0x6614('0xf')](function(_0x1f163e){return _0x1f163e;});}return null;};}function removeEntity(_0x1d0d2b){return function(_0x1bae1d){if(_0x1bae1d){return _0x1bae1d[_0x6614('0x10')]()[_0x6614('0xf')](function(){_0x1d0d2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x219365){return function(_0x40a008){if(!_0x40a008){_0x219365['sendStatus'](0x194);}return _0x40a008;};}function handleError(_0x15a983,_0x148a0e){_0x148a0e=_0x148a0e||0x1f4;return function(_0x3a0fee){logger['error'](_0x3a0fee[_0x6614('0x11')]);if(_0x3a0fee[_0x6614('0x12')]){delete _0x3a0fee[_0x6614('0x12')];}_0x15a983['status'](_0x148a0e)['send'](_0x3a0fee);};}exports[_0x6614('0x13')]=function(_0x207b15,_0x35532c){var _0x30c5bc={},_0x491d88={},_0x251ccd={'count':0x0,'rows':[]};var _0xf0ddd4=_[_0x6614('0x14')](db[_0x6614('0x15')][_0x6614('0x16')],function(_0x323d8f){return{'name':_0x323d8f[_0x6614('0x17')],'type':_0x323d8f[_0x6614('0x18')][_0x6614('0x19')]};});_0x491d88[_0x6614('0x1a')]=_[_0x6614('0x14')](_0xf0ddd4,_0x6614('0x12'));_0x491d88['query']=_[_0x6614('0x1b')](_0x207b15['query']);_0x491d88[_0x6614('0x1c')]=_[_0x6614('0x1d')](_0x491d88[_0x6614('0x1a')],_0x491d88['query']);_0x30c5bc['attributes']=_[_0x6614('0x1d')](_0x491d88['model'],qs[_0x6614('0x1e')](_0x207b15['query'][_0x6614('0x1e')]));_0x30c5bc[_0x6614('0x1f')]=_0x30c5bc['attributes'][_0x6614('0x20')]?_0x30c5bc['attributes']:_0x491d88[_0x6614('0x1a')];if(!_0x207b15[_0x6614('0x21')][_0x6614('0x22')](_0x6614('0x23'))){_0x30c5bc[_0x6614('0xc')]=qs[_0x6614('0xc')](_0x207b15[_0x6614('0x21')][_0x6614('0xc')]);_0x30c5bc[_0x6614('0x9')]=qs[_0x6614('0x9')](_0x207b15[_0x6614('0x21')][_0x6614('0x9')]);}_0x30c5bc[_0x6614('0x24')]=qs['sort'](_0x207b15[_0x6614('0x21')][_0x6614('0x25')]);_0x30c5bc[_0x6614('0x26')]=qs[_0x6614('0x1c')](_[_0x6614('0x27')](_0x207b15[_0x6614('0x21')],_0x491d88[_0x6614('0x1c')]),_0xf0ddd4);if(_0x207b15[_0x6614('0x21')]['filter']){_0x30c5bc[_0x6614('0x26')]=_[_0x6614('0x28')](_0x30c5bc[_0x6614('0x26')],{'$or':_['map'](_0xf0ddd4,function(_0x5b3e53){if(_0x5b3e53[_0x6614('0x18')]!=='VIRTUAL'){var _0x239b39={};_0x239b39[_0x5b3e53[_0x6614('0x12')]]={'$like':'%'+_0x207b15['query'][_0x6614('0x29')]+'%'};return _0x239b39;}})});}_0x30c5bc=_[_0x6614('0x28')]({},_0x30c5bc,_0x207b15[_0x6614('0x2a')]);var _0x4920eb={'where':_0x30c5bc[_0x6614('0x26')]};return db[_0x6614('0x15')][_0x6614('0xb')](_0x4920eb)[_0x6614('0xf')](function(_0x14cfa7){_0x251ccd[_0x6614('0xb')]=_0x14cfa7;if(_0x207b15[_0x6614('0x21')][_0x6614('0x2b')]){_0x30c5bc[_0x6614('0x2c')]=[{'all':!![]}];}return db[_0x6614('0x15')][_0x6614('0x2d')](_0x30c5bc);})[_0x6614('0xf')](function(_0x1b1bf7){_0x251ccd[_0x6614('0x2e')]=_0x1b1bf7;return _0x251ccd;})[_0x6614('0xf')](respondWithFilteredResult(_0x35532c,_0x30c5bc))[_0x6614('0x2f')](handleError(_0x35532c,null));};exports[_0x6614('0x30')]=function(_0x2beec3,_0x151e14){var _0x3440fd={'raw':![],'where':{'id':_0x2beec3[_0x6614('0x31')]['id']}},_0x5e5827={};_0x5e5827[_0x6614('0x1a')]=_[_0x6614('0x1b')](db[_0x6614('0x15')][_0x6614('0x16')]);_0x5e5827[_0x6614('0x21')]=_[_0x6614('0x1b')](_0x2beec3[_0x6614('0x21')]);_0x5e5827[_0x6614('0x1c')]=_[_0x6614('0x1d')](_0x5e5827[_0x6614('0x1a')],_0x5e5827[_0x6614('0x21')]);_0x3440fd[_0x6614('0x1f')]=_[_0x6614('0x1d')](_0x5e5827[_0x6614('0x1a')],qs[_0x6614('0x1e')](_0x2beec3[_0x6614('0x21')][_0x6614('0x1e')]));_0x3440fd[_0x6614('0x1f')]=_0x3440fd['attributes'][_0x6614('0x20')]?_0x3440fd[_0x6614('0x1f')]:_0x5e5827[_0x6614('0x1a')];if(_0x2beec3[_0x6614('0x21')]['includeAll']){_0x3440fd['include']=[{'all':!![]}];}_0x3440fd=_[_0x6614('0x28')]({},_0x3440fd,_0x2beec3[_0x6614('0x2a')]);return db['Dynamics365Account']['find'](_0x3440fd)[_0x6614('0xf')](handleEntityNotFound(_0x151e14,null))['then'](respondWithResult(_0x151e14,null))[_0x6614('0x2f')](handleError(_0x151e14,null));};exports['create']=function(_0xa27c89,_0x57b53e){return db[_0x6614('0x15')][_0x6614('0x32')](_0xa27c89[_0x6614('0x33')],{})[_0x6614('0xf')](respondWithResult(_0x57b53e,0xc9))[_0x6614('0x2f')](handleError(_0x57b53e,null));};exports['update']=function(_0x4de2b2,_0x6518b0){if(_0x4de2b2[_0x6614('0x33')]['id']){delete _0x4de2b2[_0x6614('0x33')]['id'];}return db[_0x6614('0x15')][_0x6614('0x34')]({'where':{'id':_0x4de2b2['params']['id']}})[_0x6614('0xf')](handleEntityNotFound(_0x6518b0,null))[_0x6614('0xf')](saveUpdates(_0x4de2b2[_0x6614('0x33')],null))[_0x6614('0xf')](respondWithResult(_0x6518b0,null))[_0x6614('0x2f')](handleError(_0x6518b0,null));};exports[_0x6614('0x10')]=function(_0x550956,_0x7ae311){return db['Dynamics365Account'][_0x6614('0x34')]({'where':{'id':_0x550956['params']['id']}})[_0x6614('0xf')](handleEntityNotFound(_0x7ae311,null))['then'](removeEntity(_0x7ae311,null))['catch'](handleError(_0x7ae311,null));};exports[_0x6614('0x35')]=function(_0x1e2d97,_0xa6da4d){var _0x5db0c2={};var _0x255a95={};var _0x48b02d;var _0x134581;return db[_0x6614('0x15')][_0x6614('0x36')]({'where':{'id':_0x1e2d97[_0x6614('0x31')]['id']}})[_0x6614('0xf')](handleEntityNotFound(_0xa6da4d,null))[_0x6614('0xf')](function(_0x54b8c3){if(_0x54b8c3){_0x48b02d=_0x54b8c3;_0x255a95[_0x6614('0x1a')]=_[_0x6614('0x1b')](db['Dynamics365Configuration'][_0x6614('0x16')]);_0x255a95[_0x6614('0x21')]=_[_0x6614('0x1b')](_0x1e2d97['query']);_0x255a95[_0x6614('0x1c')]=_[_0x6614('0x1d')](_0x255a95[_0x6614('0x1a')],_0x255a95[_0x6614('0x21')]);_0x5db0c2[_0x6614('0x1f')]=_['intersection'](_0x255a95[_0x6614('0x1a')],qs[_0x6614('0x1e')](_0x1e2d97[_0x6614('0x21')][_0x6614('0x1e')]));_0x5db0c2[_0x6614('0x1f')]=_0x5db0c2[_0x6614('0x1f')][_0x6614('0x20')]?_0x5db0c2[_0x6614('0x1f')]:_0x255a95[_0x6614('0x1a')];_0x5db0c2['order']=qs[_0x6614('0x25')](_0x1e2d97[_0x6614('0x21')][_0x6614('0x25')]);_0x5db0c2[_0x6614('0x26')]=qs['filters'](_['pick'](_0x1e2d97[_0x6614('0x21')],_0x255a95[_0x6614('0x1c')]));if(_0x1e2d97[_0x6614('0x21')][_0x6614('0x29')]){_0x5db0c2[_0x6614('0x26')]=_[_0x6614('0x28')](_0x5db0c2['where'],{'$or':_[_0x6614('0x14')](_0x5db0c2[_0x6614('0x1f')],function(_0x55feef){var _0x184a62={};_0x184a62[_0x55feef]={'$like':'%'+_0x1e2d97[_0x6614('0x21')]['filter']+'%'};return _0x184a62;})});}_0x5db0c2=_['merge']({},_0x5db0c2,_0x1e2d97[_0x6614('0x2a')]);return _0x48b02d[_0x6614('0x35')](_0x5db0c2);}})[_0x6614('0xf')](function(_0x580de5){if(_0x580de5){_0x134581=_0x580de5['length'];if(!_0x1e2d97[_0x6614('0x21')][_0x6614('0x22')](_0x6614('0x23'))){_0x5db0c2[_0x6614('0xc')]=qs[_0x6614('0xc')](_0x1e2d97['query'][_0x6614('0xc')]);_0x5db0c2[_0x6614('0x9')]=qs[_0x6614('0x9')](_0x1e2d97[_0x6614('0x21')][_0x6614('0x9')]);}return _0x48b02d[_0x6614('0x35')](_0x5db0c2);}})[_0x6614('0xf')](function(_0x1d951e){if(_0x1d951e){return _0x1d951e?{'count':_0x134581,'rows':_0x1d951e}:null;}})['then'](respondWithResult(_0xa6da4d,null))[_0x6614('0x2f')](handleError(_0xa6da4d,null));};exports[_0x6614('0x37')]=function(_0x43b0ee,_0x385498){if(_0x43b0ee['body']['id']){delete _0x43b0ee['body']['id'];}return db[_0x6614('0x15')][_0x6614('0x36')]({'where':{'id':_0x43b0ee[_0x6614('0x31')]['id']}})[_0x6614('0xf')](handleEntityNotFound(_0x385498,null))[_0x6614('0xf')](function(_0x39238e){if(_0x39238e){_0x43b0ee[_0x6614('0x33')][_0x6614('0x38')]=_0x39238e['id'];_0x43b0ee[_0x6614('0x33')][_0x6614('0x39')]=integrations[_0x6614('0x3a')](_0x43b0ee[_0x6614('0x33')]['channel'],_0x43b0ee['body'][_0x6614('0x18')]);_0x43b0ee[_0x6614('0x33')][_0x6614('0x3b')]=integrations['getDescriptions'](_0x43b0ee['body'][_0x6614('0x3c')],_0x43b0ee[_0x6614('0x33')][_0x6614('0x18')]);return db['Dynamics365Configuration']['create'](_0x43b0ee[_0x6614('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':_0x6614('0x39')},{'model':db[_0x6614('0x3d')],'as':_0x6614('0x3b')}]});}return null;})[_0x6614('0xf')](respondWithResult(_0x385498,null))[_0x6614('0x2f')](handleError(_0x385498,null));};function sanitizeRemoteUri(_0x3d6905){var _0x489810=_0x3d6905[_0x6614('0x3e')](-0x1);if(_0x489810==='/')return _0x3d6905['substring'](0x0,_0x3d6905[_0x6614('0x3f')](_0x489810));return _0x3d6905;}function getWebApiUrl(_0x40924e){return util[_0x6614('0x40')](_0x6614('0x41'),_0x40924e);}exports[_0x6614('0x42')]=function(_0x2381b2,_0x377a7a){var _0x32e035=_0x2381b2[_0x6614('0x21')][_0x6614('0x43')];var _0x488d06=_0x32e035==='incident'?_0x6614('0x44'):_0x6614('0x45');var _0x1bea19='';var _0x40dc6f='';var _0x46d6f5='';var _0x4c12e6='';var _0x427998='';var _0x3cf200='';var _0x3c382b='';var _0x42a9ac='';var _0x1071bd=[_0x6614('0x46'),'description',_0x6614('0x47'),_0x6614('0x48'),'caseorigincode',_0x6614('0x49'),_0x6614('0x4a'),_0x6614('0x4b'),_0x6614('0x4c'),_0x6614('0x4d')];var _0xa0b66=[_0x6614('0x4e'),_0x6614('0x4f'),_0x6614('0x50'),_0x6614('0x51'),'contactidname',_0x6614('0x52'),_0x6614('0x53'),'contractidname',_0x6614('0x54'),_0x6614('0x55'),_0x6614('0x56'),_0x6614('0x57'),_0x6614('0x58'),_0x6614('0x59'),_0x6614('0x5a'),_0x6614('0x5b'),_0x6614('0x5c'),'customeridyominame','emailaddress',_0x6614('0x5d'),_0x6614('0x5e'),'entityimage_url','escalatedon',_0x6614('0x5f'),'firstresponsebykpiidname',_0x6614('0x60'),_0x6614('0x61'),_0x6614('0x62'),_0x6614('0x63'),_0x6614('0x64'),_0x6614('0x65'),_0x6614('0x66'),_0x6614('0x67'),'modifiedbyname',_0x6614('0x68'),_0x6614('0x69'),_0x6614('0x6a'),_0x6614('0x6b'),'msdyn_incidenttypename',_0x6614('0x6c'),_0x6614('0x6d'),_0x6614('0x6e'),_0x6614('0x6f'),_0x6614('0x70'),'owneridtype',_0x6614('0x71'),_0x6614('0x72'),_0x6614('0x73'),_0x6614('0x74'),_0x6614('0x75'),'productidname',_0x6614('0x76'),_0x6614('0x77'),_0x6614('0x78'),_0x6614('0x79'),_0x6614('0x7a'),_0x6614('0x7b'),_0x6614('0x7c'),'slainvokedidname','slaname',_0x6614('0x7d'),_0x6614('0x7e'),_0x6614('0x7f'),'subjectidname',_0x6614('0x80'),_0x6614('0x81'),'transactioncurrencyidname',_0x6614('0x82'),_0x6614('0x83'),'versionnumber'];var _0x880010=_0x1071bd[_0x6614('0x84')](_0xa0b66);return db[_0x6614('0x15')][_0x6614('0x36')]({'where':{'id':_0x2381b2[_0x6614('0x31')]['id']},'attributes':['id','username',_0x6614('0x85'),_0x6614('0x86'),_0x6614('0x87'),_0x6614('0x88'),_0x6614('0x89'),'modernAuthentication'],'include':[{'model':db[_0x6614('0x8a')],'as':'CloudProvider','attributes':['id',_0x6614('0x8b'),'data7']}]})[_0x6614('0xf')](handleEntityNotFound(_0x377a7a,null))[_0x6614('0xf')](function(_0x16b091){if(_0x16b091){if(_0x16b091[_0x6614('0x8c')]){_0x16b091[_0x6614('0x8d')]=_0x16b091[_0x6614('0x8a')][_0x6614('0x8b')];_0x42a9ac=sanitizeRemoteUri(_0x16b091[_0x6614('0x8a')][_0x6614('0x8e')]);_0x3c382b=getWebApiUrl(_0x42a9ac);return _0x16b091;}_0x42a9ac=sanitizeRemoteUri(_0x16b091[_0x6614('0x86')]);_0x3c382b=getWebApiUrl(_0x42a9ac);var _0x4f0ac9={'method':_0x6614('0x8f'),'uri':'https://login.microsoftonline.com/'+_0x16b091[_0x6614('0x87')]+_0x6614('0x90'),'form':{'client_id':_0x16b091['clientId'],'resource':_0x42a9ac,'username':_0x16b091['username'],'password':_0x16b091['password'],'grant_type':_0x6614('0x85'),'client_secret':_0x16b091[_0x6614('0x89')]},'json':!![]};return rp(_0x4f0ac9);}})['then'](function(_0x379791){_0x3cf200=_0x379791['access_token'];var _0x4876fb={'method':_0x6614('0x91'),'uri':encodeURI(_0x3c382b+_0x6614('0x92')+_0x488d06+'\x27'),'headers':{'Authorization':_0x6614('0x93')+_0x3cf200,'If-None-Match':null,'OData-Version':_0x6614('0x94')},'json':!![]};return rp(_0x4876fb);})[_0x6614('0xf')](function(_0x3a3403){var _0x39275c=_0x3a3403[_0x6614('0x95')][0x0];var _0x19f6bf=_0x39275c['MetadataId'];var _0x35931d={'method':'GET','uri':_0x3c382b+_0x6614('0x96')+_0x19f6bf+_0x6614('0x97'),'headers':{'Authorization':_0x6614('0x93')+_0x3cf200,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35931d);})['then'](function(_0x1dac98){_0x1bea19=_0x1dac98;_0x40dc6f=_0x1bea19['Attributes'];_0x40dc6f=_[_0x6614('0x98')](_0x40dc6f,function(_0x6aca46){return!_0x880010[_0x6614('0x99')](_0x6aca46[_0x6614('0x9a')]);});var _0x5c084b=[];var _0xecabd0=[];_0x40dc6f[_0x6614('0x9b')](function(_0x121693){if(_0x121693[_0x6614('0x9c')]){var _0x4d33a4=_0x121693[_0x6614('0x9c')][_0x6614('0x9d')](_0x121693[_0x6614('0x9c')][_0x6614('0x3f')]('.')+0x1);if(_0x4d33a4===_0x6614('0x9e')){_0x5c084b[_0x6614('0x9f')](getSelectList(_0x3c382b,_0x32e035,_0xecabd0,_0x1bea19[_0x6614('0xa0')],_0x121693[_0x6614('0xa0')],_0x3cf200));}}});return Promise['all'](_0x5c084b);})[_0x6614('0xf')](function(_0xdc40bc){_0x46d6f5=_0xdc40bc[0x0];var _0x46bb1d=[];var _0x4f45d1=[];_0x40dc6f[_0x6614('0x9b')](function(_0x1cbe43){if(!_[_0x6614('0xa1')](_0x1cbe43[_0x6614('0x9c')])){var _0x4b1938=_0x1cbe43['@odata.type'][_0x6614('0x9d')](_0x1cbe43['@odata.type'][_0x6614('0x3f')]('.')+0x1);if(_0x4b1938===_0x6614('0xa2')){_0x46bb1d[_0x6614('0x9f')](getBooleanList(_0x3c382b,_0x32e035,_0x4f45d1,_0x1bea19[_0x6614('0xa0')],_0x1cbe43[_0x6614('0xa0')],_0x3cf200));}}});return Promise[_0x6614('0xa3')](_0x46bb1d);})[_0x6614('0xf')](function(_0xbf19d3){_0x4c12e6=_0xbf19d3[0x0];var _0x1c42ff=[];var _0x5b0006=[];_0x40dc6f['forEach'](function(_0x2d1f46){if(_0x2d1f46[_0x6614('0x9c')]){var _0x35e208=_0x2d1f46[_0x6614('0x9c')][_0x6614('0x9d')](_0x2d1f46[_0x6614('0x9c')][_0x6614('0x3f')]('.')+0x1);if(_0x35e208===_0x6614('0xa4')||_0x35e208===_0x6614('0xa5')||_0x35e208===_0x6614('0xa6')||_0x35e208===_0x6614('0xa7')||_0x35e208==='MemoAttributeMetadata'||_0x35e208===_0x6614('0xa8')||_0x35e208===_0x6614('0xa9')||_0x35e208==='EntityNameAttributeMetadata'||_0x35e208==='StateAttributeMetadata'||_0x35e208==='DecimalAttributeMetadata'){_0x1c42ff[_0x6614('0x9f')](getInputList(_0x3c382b,_0x32e035,_0x35e208,_0x5b0006,_0x1bea19[_0x6614('0xa0')],_0x2d1f46[_0x6614('0xa0')],_0x3cf200));}}});return Promise[_0x6614('0xa3')](_0x1c42ff);})[_0x6614('0xf')](function(_0x3d2e0f){_0x427998=_0x3d2e0f[0x0];var _0x5649b8=_0x46d6f5[_0x6614('0x84')](_0x4c12e6)[_0x6614('0x84')](_0x427998);var _0x40dfbd={'count':_0x5649b8[_0x6614('0x20')],'rows':_0x5649b8};return _0x40dfbd;})[_0x6614('0xf')](respondWithResult(_0x377a7a,null))[_0x6614('0x2f')](function(_0x17c1d2){var _0x26974d=_0x2381b2[_0x6614('0x21')][_0x6614('0xaa')]?0x1f4:_0x17c1d2[_0x6614('0xab')]||0x1f4;logger[_0x6614('0xac')](_0x17c1d2[_0x6614('0x11')]);delete _0x17c1d2[_0x6614('0x12')];if(_0x26974d===0x191){_0x26974d=0x190;}_0x377a7a[_0x6614('0x7')](_0x26974d)[_0x6614('0xad')](_0x2381b2['query'][_0x6614('0xaa')]?{'message':_0x6614('0xae'),'statusCode':_0x17c1d2[_0x6614('0xab')]}:_0x17c1d2);});};function getSelectList(_0x204252,_0x180a1c,_0x57f90c,_0x269048,_0x4ac1d5,_0x2b4912){var _0x1abbb8={'method':_0x6614('0x91'),'uri':_0x204252+'EntityDefinitions('+_0x269048+_0x6614('0xaf')+_0x4ac1d5+_0x6614('0xb0')+_0x6614('0xb1'),'headers':{'Authorization':_0x6614('0x93')+_0x2b4912,'If-None-Match':null,'OData-Version':_0x6614('0x94')},'json':!![]};return rp(_0x1abbb8)[_0x6614('0xf')](function(_0x2f0e30){var _0x28ccf9=[];var _0x370bcf=_0x2f0e30[_0x6614('0xb2')][_0x6614('0xb3')];_0x370bcf[_0x6614('0x9b')](function(_0xfeb0f4){_0x28ccf9['push']({'name':_0xfeb0f4[_0x6614('0xb4')][_0x6614('0xb5')][_0x6614('0xb4')],'value':String(_0xfeb0f4['Value'])});});var _0x2211f9={'id':_0x180a1c+'_'+_0x2f0e30['LogicalName'],'name':_0x2f0e30[_0x6614('0xb6')][_0x6614('0xb5')][_0x6614('0xb4')],'custom':![],'options':_0x28ccf9};_0x57f90c[_0x6614('0x9f')](_0x2211f9);return _0x57f90c;});}function getBooleanList(_0x2ed5e6,_0xe0cfc3,_0x36ee25,_0x42e241,_0x3dc7d3,_0x3b8c1c){var _0xd8052b={'method':_0x6614('0x91'),'uri':_0x2ed5e6+_0x6614('0x96')+_0x42e241+')/Attributes('+_0x3dc7d3+_0x6614('0xb7'),'headers':{'Authorization':_0x6614('0x93')+_0x3b8c1c,'If-None-Match':null,'OData-Version':_0x6614('0x94')},'json':!![]};return rp(_0xd8052b)['then'](function(_0x2408e4){var _0x5b29c5=[];_0x5b29c5[_0x6614('0x9f')]({'name':_0x2408e4[_0x6614('0xb2')]['TrueOption']['Label'][_0x6614('0xb5')][_0x6614('0xb4')],'value':_0x6614('0xb8')},{'name':_0x2408e4[_0x6614('0xb2')]['FalseOption'][_0x6614('0xb4')][_0x6614('0xb5')][_0x6614('0xb4')],'value':'false'});var _0x317055={'id':_0xe0cfc3+'_'+_0x2408e4[_0x6614('0x9a')],'name':_0x2408e4[_0x6614('0xb6')][_0x6614('0xb5')][_0x6614('0xb4')],'custom':![],'options':_0x5b29c5};_0x36ee25[_0x6614('0x9f')](_0x317055);return _0x36ee25;});}function getInputList(_0x404cd1,_0x5d1e2a,_0x16da47,_0xfe164,_0x151245,_0x5f42bc,_0xa842db){var _0x231bd8={'method':_0x6614('0x91'),'uri':_0x404cd1+_0x6614('0x96')+_0x151245+')/Attributes('+_0x5f42bc+_0x6614('0xb9')+_0x16da47+_0x6614('0xba'),'headers':{'Authorization':_0x6614('0x93')+_0xa842db,'If-None-Match':null,'OData-Version':_0x6614('0x94')},'json':!![]};return rp(_0x231bd8)['then'](function(_0x3db121){var _0x49feb9={'id':_0x5d1e2a+'_'+_0x3db121['LogicalName'],'name':_0x3db121[_0x6614('0xb6')][_0x6614('0xb5')]?_0x3db121[_0x6614('0xb6')][_0x6614('0xb5')][_0x6614('0xb4')]:_0x3db121[_0x6614('0x9a')],'custom':![],'options':[]};_0xfe164[_0x6614('0x9f')](_0x49feb9);return _0xfe164;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5a1e38a..51165bc 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x23a5e4,_0x300100){var _0x3b7568=function(_0x5d43ee){while(--_0x5d43ee){_0x23a5e4['push'](_0x23a5e4['shift']());}};_0x3b7568(++_0x300100);}(_0x757a,0xde));var _0xa757=function(_0x3ad27e,_0x1ff5e0){_0x3ad27e=_0x3ad27e-0x0;var _0x533985=_0x757a[_0x3ad27e];return _0x533985;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x34b29f,_0x5949d1){var _0x74ff03=function(_0x10cd6b){while(--_0x10cd6b){_0x34b29f['push'](_0x34b29f['shift']());}};_0x74ff03(++_0x5949d1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index db3bcde..5c72369 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2726=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','GetDynamics365Account','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2726,0xcd));var _0x6272=function(_0x333fed,_0x3d2122){_0x333fed=_0x333fed-0x0;var _0x12cac2=_0x2726[_0x333fed];return _0x12cac2;};'use strict';var _=require(_0x6272('0x0'));var util=require(_0x6272('0x1'));var moment=require(_0x6272('0x2'));var BPromise=require(_0x6272('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6272('0x4'))['db'];var utils=require(_0x6272('0x5'));var logger=require(_0x6272('0x6'))(_0x6272('0x7'));var config=require(_0x6272('0x8'));var jayson=require(_0x6272('0x9'));var client=jayson[_0x6272('0xa')][_0x6272('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x847e6,_0x13d694,_0x5a54ec){return new BPromise(function(_0x1ba5be,_0xf01e70){return client[_0x6272('0xc')](_0x847e6,_0x5a54ec)[_0x6272('0xd')](function(_0x162a17){logger['info'](_0x6272('0xe'),_0x13d694,_0x6272('0xf'));logger[_0x6272('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x13d694,_0x6272('0xf'),JSON['stringify'](_0x162a17));if(_0x162a17[_0x6272('0x11')]){if(_0x162a17[_0x6272('0x11')][_0x6272('0x12')]===0x1f4){logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x162a17['error'][_0x6272('0x13')]);return _0xf01e70(_0x162a17[_0x6272('0x11')][_0x6272('0x13')]);}logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x162a17[_0x6272('0x11')][_0x6272('0x13')]);return _0x1ba5be(_0x162a17[_0x6272('0x11')]['message']);}else{logger[_0x6272('0x14')](_0x6272('0xe'),_0x13d694,'request\x20sent');_0x1ba5be(_0x162a17['result'][_0x6272('0x13')]);}})[_0x6272('0x15')](function(_0x344ce8){logger[_0x6272('0x11')](_0x6272('0xe'),_0x13d694,_0x344ce8);_0xf01e70(_0x344ce8);});});}exports['GetDynamics365Account']=function(_0x196a8c){var _0x427dc6=this;return new Promise(function(_0x185060,_0x16b2a1){return db[_0x6272('0x16')][_0x6272('0x17')]({'raw':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options'][_0x6272('0x19')]===undefined?!![]:![]:!![],'where':_0x196a8c['options']?_0x196a8c['options'][_0x6272('0x1a')]||null:null,'attributes':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options'][_0x6272('0x1b')]||null:null,'limit':_0x196a8c[_0x6272('0x18')]?_0x196a8c['options']['limit']||null:null,'include':_0x196a8c[_0x6272('0x18')]?_0x196a8c[_0x6272('0x18')][_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x196a8c['options'][_0x6272('0x1c')],function(_0x4e1170){return{'model':db[_0x4e1170['model']],'as':_0x4e1170['as'],'attributes':_0x4e1170['attributes'],'include':_0x4e1170['include']?_[_0x6272('0x1d')](_0x4e1170[_0x6272('0x1c')],function(_0x211ce3){return{'model':db[_0x211ce3[_0x6272('0x1e')]],'as':_0x211ce3['as'],'attributes':_0x211ce3[_0x6272('0x1b')],'include':_0x211ce3[_0x6272('0x1c')]?_['map'](_0x211ce3[_0x6272('0x1c')],function(_0x51101d){return{'model':db[_0x51101d[_0x6272('0x1e')]],'as':_0x51101d['as'],'attributes':_0x51101d[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x4ec61b){logger['info'](_0x6272('0x1f'),_0x196a8c);logger[_0x6272('0x10')]('GetDynamics365Account',_0x196a8c,JSON[_0x6272('0x20')](_0x4ec61b));_0x185060(_0x4ec61b);})['catch'](function(_0x285654){logger[_0x6272('0x11')](_0x6272('0x1f'),_0x285654[_0x6272('0x13')],_0x196a8c);_0x16b2a1(_0x427dc6[_0x6272('0x11')](0x1f4,_0x285654[_0x6272('0x13')]));});});};exports[_0x6272('0x21')]=function(_0x12b432){var _0x5a2e9f=this;return new Promise(function(_0x54f2cb,_0x499c39){return db[_0x6272('0x16')][_0x6272('0x22')]({'raw':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')][_0x6272('0x19')]===undefined?!![]:![]:!![],'where':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')][_0x6272('0x1a')]||null:null,'attributes':_0x12b432[_0x6272('0x18')]?_0x12b432[_0x6272('0x18')]['attributes']||null:null,'include':_0x12b432[_0x6272('0x18')]?_0x12b432['options'][_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x12b432['options'][_0x6272('0x1c')],function(_0x3e7941){return{'model':db[_0x3e7941[_0x6272('0x1e')]],'as':_0x3e7941['as'],'attributes':_0x3e7941[_0x6272('0x1b')],'include':_0x3e7941[_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x3e7941[_0x6272('0x1c')],function(_0x4a3c5f){return{'model':db[_0x4a3c5f[_0x6272('0x1e')]],'as':_0x4a3c5f['as'],'attributes':_0x4a3c5f[_0x6272('0x1b')],'include':_0x4a3c5f[_0x6272('0x1c')]?_[_0x6272('0x1d')](_0x4a3c5f[_0x6272('0x1c')],function(_0x4e1827){return{'model':db[_0x4e1827[_0x6272('0x1e')]],'as':_0x4e1827['as'],'attributes':_0x4e1827[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x587709){logger[_0x6272('0x14')](_0x6272('0x21'),_0x12b432);logger[_0x6272('0x10')](_0x6272('0x21'),_0x12b432,JSON['stringify'](_0x587709));_0x54f2cb(_0x587709);})['catch'](function(_0x15dfa3){logger[_0x6272('0x11')]('ShowDynamics365Account',_0x15dfa3['message'],_0x12b432);_0x499c39(_0x5a2e9f['error'](0x1f4,_0x15dfa3[_0x6272('0x13')]));});});}; \ No newline at end of file +var _0xa1ca=['error','code','message','Dynamics365Account','options','raw','where','attributes','limit','map','include','model','GetDynamics365Account','catch','ShowDynamics365Account','find','lodash','util','moment','bluebird','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4e30c0,_0x534a76){var _0x5db594=function(_0x1832e7){while(--_0x1832e7){_0x4e30c0['push'](_0x4e30c0['shift']());}};_0x5db594(++_0x534a76);}(_0xa1ca,0x1c2));var _0xaa1c=function(_0x34145e,_0x689e31){_0x34145e=_0x34145e-0x0;var _0x27ed04=_0xa1ca[_0x34145e];return _0x27ed04;};'use strict';var _=require(_0xaa1c('0x0'));var util=require(_0xaa1c('0x1'));var moment=require(_0xaa1c('0x2'));var BPromise=require(_0xaa1c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaa1c('0x4'));var config=require(_0xaa1c('0x5'));var jayson=require(_0xaa1c('0x6'));var client=jayson['client'][_0xaa1c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e112b,_0x34e03d,_0x3f9e85){return new BPromise(function(_0x107aa4,_0x33e036){return client['request'](_0x1e112b,_0x3f9e85)[_0xaa1c('0x8')](function(_0x5be051){logger[_0xaa1c('0x9')](_0xaa1c('0xa'),_0x34e03d,_0xaa1c('0xb'));logger[_0xaa1c('0xc')](_0xaa1c('0xd'),_0x34e03d,'request\x20sent',JSON[_0xaa1c('0xe')](_0x5be051));if(_0x5be051['error']){if(_0x5be051[_0xaa1c('0xf')][_0xaa1c('0x10')]===0x1f4){logger[_0xaa1c('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x34e03d,_0x5be051[_0xaa1c('0xf')][_0xaa1c('0x11')]);return _0x33e036(_0x5be051[_0xaa1c('0xf')][_0xaa1c('0x11')]);}logger['error'](_0xaa1c('0xa'),_0x34e03d,_0x5be051['error'][_0xaa1c('0x11')]);return _0x107aa4(_0x5be051[_0xaa1c('0xf')][_0xaa1c('0x11')]);}else{logger[_0xaa1c('0x9')](_0xaa1c('0xa'),_0x34e03d,_0xaa1c('0xb'));_0x107aa4(_0x5be051['result'][_0xaa1c('0x11')]);}})['catch'](function(_0x5c359c){logger[_0xaa1c('0xf')](_0xaa1c('0xa'),_0x34e03d,_0x5c359c);_0x33e036(_0x5c359c);});});}exports['GetDynamics365Account']=function(_0x5f22fa){var _0x4b5d61=this;return new Promise(function(_0x2fe318,_0x4a7fe0){return db[_0xaa1c('0x12')]['findAll']({'raw':_0x5f22fa[_0xaa1c('0x13')]?_0x5f22fa[_0xaa1c('0x13')][_0xaa1c('0x14')]===undefined?!![]:![]:!![],'where':_0x5f22fa[_0xaa1c('0x13')]?_0x5f22fa[_0xaa1c('0x13')][_0xaa1c('0x15')]||null:null,'attributes':_0x5f22fa['options']?_0x5f22fa['options'][_0xaa1c('0x16')]||null:null,'limit':_0x5f22fa['options']?_0x5f22fa['options'][_0xaa1c('0x17')]||null:null,'include':_0x5f22fa[_0xaa1c('0x13')]?_0x5f22fa[_0xaa1c('0x13')]['include']?_[_0xaa1c('0x18')](_0x5f22fa[_0xaa1c('0x13')][_0xaa1c('0x19')],function(_0x3f71eb){return{'model':db[_0x3f71eb[_0xaa1c('0x1a')]],'as':_0x3f71eb['as'],'attributes':_0x3f71eb['attributes'],'include':_0x3f71eb[_0xaa1c('0x19')]?_[_0xaa1c('0x18')](_0x3f71eb[_0xaa1c('0x19')],function(_0x450cba){return{'model':db[_0x450cba[_0xaa1c('0x1a')]],'as':_0x450cba['as'],'attributes':_0x450cba[_0xaa1c('0x16')],'include':_0x450cba[_0xaa1c('0x19')]?_[_0xaa1c('0x18')](_0x450cba[_0xaa1c('0x19')],function(_0x21142d){return{'model':db[_0x21142d[_0xaa1c('0x1a')]],'as':_0x21142d['as'],'attributes':_0x21142d[_0xaa1c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xaa1c('0x8')](function(_0x372223){logger['info']('GetDynamics365Account',_0x5f22fa);logger[_0xaa1c('0xc')](_0xaa1c('0x1b'),_0x5f22fa,JSON[_0xaa1c('0xe')](_0x372223));_0x2fe318(_0x372223);})[_0xaa1c('0x1c')](function(_0x41c823){logger[_0xaa1c('0xf')](_0xaa1c('0x1b'),_0x41c823[_0xaa1c('0x11')],_0x5f22fa);_0x4a7fe0(_0x4b5d61['error'](0x1f4,_0x41c823['message']));});});};exports[_0xaa1c('0x1d')]=function(_0x24b8fc){var _0x3b96d8=this;return new Promise(function(_0xcb6b6,_0xdecd4a){return db['Dynamics365Account'][_0xaa1c('0x1e')]({'raw':_0x24b8fc['options']?_0x24b8fc[_0xaa1c('0x13')][_0xaa1c('0x14')]===undefined?!![]:![]:!![],'where':_0x24b8fc[_0xaa1c('0x13')]?_0x24b8fc[_0xaa1c('0x13')][_0xaa1c('0x15')]||null:null,'attributes':_0x24b8fc[_0xaa1c('0x13')]?_0x24b8fc[_0xaa1c('0x13')][_0xaa1c('0x16')]||null:null,'include':_0x24b8fc[_0xaa1c('0x13')]?_0x24b8fc[_0xaa1c('0x13')][_0xaa1c('0x19')]?_[_0xaa1c('0x18')](_0x24b8fc[_0xaa1c('0x13')][_0xaa1c('0x19')],function(_0x38cfd9){return{'model':db[_0x38cfd9[_0xaa1c('0x1a')]],'as':_0x38cfd9['as'],'attributes':_0x38cfd9[_0xaa1c('0x16')],'include':_0x38cfd9['include']?_['map'](_0x38cfd9[_0xaa1c('0x19')],function(_0x32b4e8){return{'model':db[_0x32b4e8[_0xaa1c('0x1a')]],'as':_0x32b4e8['as'],'attributes':_0x32b4e8[_0xaa1c('0x16')],'include':_0x32b4e8[_0xaa1c('0x19')]?_[_0xaa1c('0x18')](_0x32b4e8[_0xaa1c('0x19')],function(_0x420927){return{'model':db[_0x420927['model']],'as':_0x420927['as'],'attributes':_0x420927[_0xaa1c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xaa1c('0x8')](function(_0xe115fe){logger[_0xaa1c('0x9')](_0xaa1c('0x1d'),_0x24b8fc);logger[_0xaa1c('0xc')]('ShowDynamics365Account',_0x24b8fc,JSON[_0xaa1c('0xe')](_0xe115fe));_0xcb6b6(_0xe115fe);})[_0xaa1c('0x1c')](function(_0x230320){logger[_0xaa1c('0xf')](_0xaa1c('0x1d'),_0x230320[_0xaa1c('0x11')],_0x24b8fc);_0xdecd4a(_0x3b96d8[_0xaa1c('0xf')](0x1f4,_0x230320['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 552fc33..4f97da8 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00d0=['update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','/:id'];(function(_0x459318,_0x4cb2c9){var _0x26c14e=function(_0x4f17eb){while(--_0x4f17eb){_0x459318['push'](_0x459318['shift']());}};_0x26c14e(++_0x4cb2c9);}(_0x00d0,0x163));var _0x000d=function(_0x353a0a,_0x344e98){_0x353a0a=_0x353a0a-0x0;var _0x730b36=_0x00d0[_0x353a0a];return _0x730b36;};'use strict';var multer=require(_0x000d('0x0'));var util=require(_0x000d('0x1'));var path=require('path');var timeout=require(_0x000d('0x2'));var express=require(_0x000d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x000d('0x4'));var interaction=require(_0x000d('0x5'));var config=require('../../config/environment');var controller=require(_0x000d('0x6'));router[_0x000d('0x7')]('/',auth[_0x000d('0x8')](),controller[_0x000d('0x9')]);router['get']('/:id',auth[_0x000d('0x8')](),controller[_0x000d('0xa')]);router[_0x000d('0x7')](_0x000d('0xb'),auth[_0x000d('0x8')](),controller[_0x000d('0xc')]);router['get'](_0x000d('0xd'),auth[_0x000d('0x8')](),controller['getSubjects']);router[_0x000d('0x7')]('/:id/descriptions',auth[_0x000d('0x8')](),controller[_0x000d('0xe')]);router[_0x000d('0xf')]('/',auth[_0x000d('0x8')](),controller[_0x000d('0x10')]);router[_0x000d('0x11')](_0x000d('0x12'),auth['isAuthenticated'](),controller[_0x000d('0x13')]);router[_0x000d('0x14')](_0x000d('0x12'),auth[_0x000d('0x8')](),controller[_0x000d('0x15')]);module['exports']=router; \ No newline at end of file +var _0x69d3=['path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','multer','util'];(function(_0x369c1d,_0x1fd9ee){var _0x52a0a5=function(_0x117b68){while(--_0x117b68){_0x369c1d['push'](_0x369c1d['shift']());}};_0x52a0a5(++_0x1fd9ee);}(_0x69d3,0xda));var _0x369d=function(_0x28d0dc,_0xff465a){_0x28d0dc=_0x28d0dc-0x0;var _0x111ea9=_0x69d3[_0x28d0dc];return _0x111ea9;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['get']('/:id/descriptions',auth[_0x369d('0x7')](),controller[_0x369d('0xe')]);router[_0x369d('0xf')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0x11')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index d98e771..6f178d4 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f32=['ENUM','incident','phonecall','contact','BOOLEAN','sequelize','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2f32,0x139));var _0x22f3=function(_0x59fce5,_0x58cce8){_0x59fce5=_0x59fce5-0x0;var _0x4348b0=_0x2f32[_0x59fce5];return _0x4348b0;};'use strict';var Sequelize=require(_0x22f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x22f3('0x1')]},'description':{'type':Sequelize[_0x22f3('0x1')]},'ticketType':{'type':Sequelize[_0x22f3('0x2')](_0x22f3('0x3'),_0x22f3('0x4')),'defaultValue':_0x22f3('0x3')},'moduleCreate':{'type':Sequelize[_0x22f3('0x2')](_0x22f3('0x5'),'nothing'),'defaultValue':_0x22f3('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x22f3('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x22f3('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf5c2=['ENUM','incident','phonecall','contact','nothing','sequelize','exports','STRING'];(function(_0x182b7d,_0x416e33){var _0x4f3e12=function(_0x595fde){while(--_0x595fde){_0x182b7d['push'](_0x182b7d['shift']());}};_0x4f3e12(++_0x416e33);}(_0xf5c2,0x175));var _0x2f5c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xf5c2[_0x43776a];return _0x18eb8f;};'use strict';var Sequelize=require(_0x2f5c('0x0'));module[_0x2f5c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2f5c('0x2')]},'ticketType':{'type':Sequelize[_0x2f5c('0x3')](_0x2f5c('0x4'),_0x2f5c('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x2f5c('0x3')](_0x2f5c('0x6'),_0x2f5c('0x7')),'defaultValue':_0x2f5c('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x2f5c('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7c7623a..66f4263 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x40e0=['type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','Dynamics365Configuration','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','options','find','create','body','destroy','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','fieldName'];(function(_0x58d499,_0x2f1ec1){var _0x13a0d9=function(_0x3b3932){while(--_0x3b3932){_0x58d499['push'](_0x58d499['shift']());}};_0x13a0d9(++_0x2f1ec1);}(_0x40e0,0x170));var _0x040e=function(_0x4a6eb1,_0x454559){_0x4a6eb1=_0x4a6eb1-0x0;var _0x2222ae=_0x40e0[_0x4a6eb1];return _0x2222ae;};'use strict';var emlformat=require(_0x040e('0x0'));var rimraf=require(_0x040e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x040e('0x2'));var rp=require('request-promise');var moment=require(_0x040e('0x3'));var BPromise=require(_0x040e('0x4'));var Mustache=require(_0x040e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x040e('0x6'));var csv=require(_0x040e('0x7'));var ejs=require(_0x040e('0x8'));var fs=require('fs');var fs_extra=require(_0x040e('0x9'));var _=require(_0x040e('0xa'));var squel=require(_0x040e('0xb'));var crypto=require(_0x040e('0xc'));var jsforce=require(_0x040e('0xd'));var deskjs=require(_0x040e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x040e('0xf'));var Papa=require(_0x040e('0x10'));var Redis=require(_0x040e('0x11'));var authService=require(_0x040e('0x12'));var qs=require(_0x040e('0x13'));var as=require(_0x040e('0x14'));var hardwareService=require(_0x040e('0x15'));var logger=require(_0x040e('0x16'))('api');var utils=require(_0x040e('0x17'));var config=require(_0x040e('0x18'));var licenseUtil=require(_0x040e('0x19'));var db=require(_0x040e('0x1a'))['db'];function respondWithStatusCode(_0x182c29,_0x4fd3d5){_0x4fd3d5=_0x4fd3d5||0xcc;return function(_0x1b8466){if(_0x1b8466){return _0x182c29[_0x040e('0x1b')](_0x4fd3d5);}return _0x182c29[_0x040e('0x1c')](_0x4fd3d5)[_0x040e('0x1d')]();};}function respondWithResult(_0x587995,_0x18b39a){_0x18b39a=_0x18b39a||0xc8;return function(_0x18b4d7){if(_0x18b4d7){return _0x587995['status'](_0x18b39a)[_0x040e('0x1e')](_0x18b4d7);}};}function respondWithFilteredResult(_0x397929,_0x1569ab){return function(_0x4f7f86){if(_0x4f7f86){var _0x553a57=typeof _0x1569ab['offset']===_0x040e('0x1f')&&typeof _0x1569ab[_0x040e('0x20')]===_0x040e('0x1f');var _0x1785d6=_0x4f7f86[_0x040e('0x21')];var _0x494940=_0x553a57?0x0:_0x1569ab[_0x040e('0x22')];var _0x18b08b=_0x553a57?_0x4f7f86['count']:_0x1569ab[_0x040e('0x22')]+_0x1569ab['limit'];var _0x486838;if(_0x18b08b>=_0x1785d6){_0x18b08b=_0x1785d6;_0x486838=0xc8;}else{_0x486838=0xce;}_0x397929[_0x040e('0x1c')](_0x486838);return _0x397929[_0x040e('0x23')](_0x040e('0x24'),_0x494940+'-'+_0x18b08b+'/'+_0x1785d6)[_0x040e('0x1e')](_0x4f7f86);}return null;};}function patchUpdates(_0xc4b7d9){return function(_0x39382f){try{jsonpatch[_0x040e('0x25')](_0x39382f,_0xc4b7d9,!![]);}catch(_0x43379c){return BPromise[_0x040e('0x26')](_0x43379c);}return _0x39382f['save']();};}function saveUpdates(_0x47b033,_0x1185a0){return function(_0x1a6ba4){if(_0x1a6ba4){return _0x1a6ba4[_0x040e('0x27')](_0x47b033)[_0x040e('0x28')](function(_0x224550){return _0x224550;});}return null;};}function removeEntity(_0x47aa68,_0x46fe4c){return function(_0x1381af){if(_0x1381af){return _0x1381af['destroy']()[_0x040e('0x28')](function(){_0x47aa68[_0x040e('0x1c')](0xcc)[_0x040e('0x1d')]();});}};}function handleEntityNotFound(_0x2c8b48,_0x39ba37){return function(_0x230117){if(!_0x230117){_0x2c8b48['sendStatus'](0x194);}return _0x230117;};}function handleError(_0x20b122,_0x223339){_0x223339=_0x223339||0x1f4;return function(_0x3ee14f){logger[_0x040e('0x29')](_0x3ee14f[_0x040e('0x2a')]);if(_0x3ee14f[_0x040e('0x2b')]){delete _0x3ee14f[_0x040e('0x2b')];}_0x20b122[_0x040e('0x1c')](_0x223339)[_0x040e('0x2c')](_0x3ee14f);};}exports['index']=function(_0x11b67c,_0x1f65b3){var _0x29bedc={},_0x633525={},_0x417c8b={'count':0x0,'rows':[]};var _0x174cca=_[_0x040e('0x2d')](db['Dynamics365Configuration']['rawAttributes'],function(_0xd949a9){return{'name':_0xd949a9[_0x040e('0x2e')],'type':_0xd949a9[_0x040e('0x2f')][_0x040e('0x30')]};});_0x633525['model']=_['map'](_0x174cca,_0x040e('0x2b'));_0x633525[_0x040e('0x31')]=_[_0x040e('0x32')](_0x11b67c['query']);_0x633525[_0x040e('0x33')]=_[_0x040e('0x34')](_0x633525[_0x040e('0x35')],_0x633525[_0x040e('0x31')]);_0x29bedc[_0x040e('0x36')]=_[_0x040e('0x34')](_0x633525[_0x040e('0x35')],qs['fields'](_0x11b67c['query']['fields']));_0x29bedc[_0x040e('0x36')]=_0x29bedc[_0x040e('0x36')][_0x040e('0x37')]?_0x29bedc[_0x040e('0x36')]:_0x633525[_0x040e('0x35')];if(!_0x11b67c[_0x040e('0x31')][_0x040e('0x38')](_0x040e('0x39'))){_0x29bedc[_0x040e('0x20')]=qs[_0x040e('0x20')](_0x11b67c['query'][_0x040e('0x20')]);_0x29bedc[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x11b67c[_0x040e('0x31')][_0x040e('0x22')]);}_0x29bedc[_0x040e('0x3a')]=qs[_0x040e('0x3b')](_0x11b67c[_0x040e('0x31')][_0x040e('0x3b')]);_0x29bedc[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x11b67c[_0x040e('0x31')],_0x633525[_0x040e('0x33')]),_0x174cca);if(_0x11b67c[_0x040e('0x31')]['filter']){_0x29bedc[_0x040e('0x3c')]=_[_0x040e('0x3d')](_0x29bedc[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x174cca,function(_0x279516){if(_0x279516[_0x040e('0x2f')]!=='VIRTUAL'){var _0x4ded43={};_0x4ded43[_0x279516['name']]={'$like':'%'+_0x11b67c[_0x040e('0x31')][_0x040e('0x3e')]+'%'};return _0x4ded43;}})});}_0x29bedc=_[_0x040e('0x3d')]({},_0x29bedc,_0x11b67c['options']);var _0x2618d0={'where':_0x29bedc[_0x040e('0x3c')]};return db[_0x040e('0x3f')][_0x040e('0x21')](_0x2618d0)[_0x040e('0x28')](function(_0x503700){_0x417c8b[_0x040e('0x21')]=_0x503700;if(_0x11b67c[_0x040e('0x31')][_0x040e('0x40')]){_0x29bedc[_0x040e('0x41')]=[{'all':!![]}];}return db[_0x040e('0x3f')][_0x040e('0x42')](_0x29bedc);})[_0x040e('0x28')](function(_0x314b4e){_0x417c8b[_0x040e('0x43')]=_0x314b4e;return _0x417c8b;})['then'](respondWithFilteredResult(_0x1f65b3,_0x29bedc))[_0x040e('0x44')](handleError(_0x1f65b3,null));};exports['show']=function(_0x326ff0,_0x3f304d){var _0x4c5d2d={'raw':![],'where':{'id':_0x326ff0[_0x040e('0x45')]['id']}},_0x192866={};_0x192866['model']=_[_0x040e('0x32')](db['Dynamics365Configuration'][_0x040e('0x46')]);_0x192866[_0x040e('0x31')]=_[_0x040e('0x32')](_0x326ff0[_0x040e('0x31')]);_0x192866[_0x040e('0x33')]=_[_0x040e('0x34')](_0x192866[_0x040e('0x35')],_0x192866[_0x040e('0x31')]);_0x4c5d2d[_0x040e('0x36')]=_[_0x040e('0x34')](_0x192866[_0x040e('0x35')],qs[_0x040e('0x47')](_0x326ff0['query'][_0x040e('0x47')]));_0x4c5d2d['attributes']=_0x4c5d2d[_0x040e('0x36')]['length']?_0x4c5d2d['attributes']:_0x192866['model'];if(_0x326ff0[_0x040e('0x31')][_0x040e('0x40')]){_0x4c5d2d[_0x040e('0x41')]=[{'all':!![]}];}_0x4c5d2d=_[_0x040e('0x3d')]({},_0x4c5d2d,_0x326ff0[_0x040e('0x48')]);return db['Dynamics365Configuration'][_0x040e('0x49')](_0x4c5d2d)['then'](handleEntityNotFound(_0x3f304d,null))['then'](respondWithResult(_0x3f304d,null))[_0x040e('0x44')](handleError(_0x3f304d,null));};exports['create']=function(_0x45a680,_0xd44c9c){return db[_0x040e('0x3f')][_0x040e('0x4a')](_0x45a680[_0x040e('0x4b')],{})[_0x040e('0x28')](respondWithResult(_0xd44c9c,0xc9))[_0x040e('0x44')](handleError(_0xd44c9c,null));};exports[_0x040e('0x27')]=function(_0x465eb1,_0x32b3c8){if(_0x465eb1[_0x040e('0x4b')]['id']){delete _0x465eb1[_0x040e('0x4b')]['id'];}return db[_0x040e('0x3f')][_0x040e('0x49')]({'where':{'id':_0x465eb1[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x32b3c8,null))[_0x040e('0x28')](saveUpdates(_0x465eb1['body'],null))[_0x040e('0x28')](respondWithResult(_0x32b3c8,null))[_0x040e('0x44')](handleError(_0x32b3c8,null));};exports[_0x040e('0x4c')]=function(_0x2984d6,_0x5c55ec){return db['Dynamics365Configuration']['find']({'where':{'id':_0x2984d6['params']['id']}})['then'](handleEntityNotFound(_0x5c55ec,null))[_0x040e('0x28')](removeEntity(_0x5c55ec,null))[_0x040e('0x44')](handleError(_0x5c55ec,null));};exports[_0x040e('0x4d')]=function(_0x1545dd,_0x431be6,_0x48306d){var _0x4019d3={};var _0x5b284b={};var _0x5081c8;var _0x3ffbc2;return db[_0x040e('0x3f')]['findOne']({'where':{'id':_0x1545dd[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x431be6,null))[_0x040e('0x28')](function(_0x4fcd9c){if(_0x4fcd9c){_0x5081c8=_0x4fcd9c;_0x5b284b[_0x040e('0x35')]=_['keys'](db[_0x040e('0x4e')][_0x040e('0x46')]);_0x5b284b[_0x040e('0x31')]=_[_0x040e('0x32')](_0x1545dd[_0x040e('0x31')]);_0x5b284b['filters']=_['intersection'](_0x5b284b[_0x040e('0x35')],_0x5b284b[_0x040e('0x31')]);_0x4019d3[_0x040e('0x36')]=_[_0x040e('0x34')](_0x5b284b[_0x040e('0x35')],qs[_0x040e('0x47')](_0x1545dd['query'][_0x040e('0x47')]));_0x4019d3['attributes']=_0x4019d3['attributes'][_0x040e('0x37')]?_0x4019d3[_0x040e('0x36')]:_0x5b284b[_0x040e('0x35')];_0x4019d3['order']=qs[_0x040e('0x3b')](_0x1545dd[_0x040e('0x31')]['sort']);_0x4019d3['where']=qs[_0x040e('0x33')](_[_0x040e('0x4f')](_0x1545dd[_0x040e('0x31')],_0x5b284b[_0x040e('0x33')]));if(_0x1545dd['query']['filter']){_0x4019d3['where']=_[_0x040e('0x3d')](_0x4019d3['where'],{'$or':_['map'](_0x4019d3[_0x040e('0x36')],function(_0x247229){var _0x477dae={};_0x477dae[_0x247229]={'$like':'%'+_0x1545dd[_0x040e('0x31')][_0x040e('0x3e')]+'%'};return _0x477dae;})});}_0x4019d3=_[_0x040e('0x3d')]({},_0x4019d3,_0x1545dd[_0x040e('0x48')]);return _0x5081c8[_0x040e('0x4d')](_0x4019d3);}})[_0x040e('0x28')](function(_0x4b98d9){if(_0x4b98d9){_0x3ffbc2=_0x4b98d9[_0x040e('0x37')];if(!_0x1545dd[_0x040e('0x31')]['hasOwnProperty']('nolimit')){_0x4019d3[_0x040e('0x20')]=qs[_0x040e('0x20')](_0x1545dd[_0x040e('0x31')]['limit']);_0x4019d3[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x1545dd[_0x040e('0x31')]['offset']);}return _0x5081c8[_0x040e('0x4d')](_0x4019d3);}})[_0x040e('0x28')](function(_0x49f4ed){if(_0x49f4ed){return _0x49f4ed?{'count':_0x3ffbc2,'rows':_0x49f4ed}:null;}})['then'](respondWithResult(_0x431be6,null))[_0x040e('0x44')](handleError(_0x431be6,null));};exports[_0x040e('0x50')]=function(_0x3dfd85,_0x4f8bc9,_0x59ef00){var _0x4b2790={};var _0x177367={};var _0x497fda;var _0x58051b;return db['Dynamics365Configuration'][_0x040e('0x51')]({'where':{'id':_0x3dfd85[_0x040e('0x45')]['id']}})[_0x040e('0x28')](handleEntityNotFound(_0x4f8bc9,null))[_0x040e('0x28')](function(_0x5778c6){if(_0x5778c6){_0x497fda=_0x5778c6;_0x177367[_0x040e('0x35')]=_[_0x040e('0x32')](db[_0x040e('0x4e')][_0x040e('0x46')]);_0x177367[_0x040e('0x31')]=_[_0x040e('0x32')](_0x3dfd85[_0x040e('0x31')]);_0x177367['filters']=_['intersection'](_0x177367[_0x040e('0x35')],_0x177367[_0x040e('0x31')]);_0x4b2790[_0x040e('0x36')]=_[_0x040e('0x34')](_0x177367[_0x040e('0x35')],qs[_0x040e('0x47')](_0x3dfd85[_0x040e('0x31')][_0x040e('0x47')]));_0x4b2790[_0x040e('0x36')]=_0x4b2790[_0x040e('0x36')][_0x040e('0x37')]?_0x4b2790[_0x040e('0x36')]:_0x177367[_0x040e('0x35')];_0x4b2790['order']=qs[_0x040e('0x3b')](_0x3dfd85['query'][_0x040e('0x3b')]);_0x4b2790[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x3dfd85[_0x040e('0x31')],_0x177367[_0x040e('0x33')]));if(_0x3dfd85['query']['filter']){_0x4b2790['where']=_[_0x040e('0x3d')](_0x4b2790[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x4b2790[_0x040e('0x36')],function(_0x11bcea){var _0x163fea={};_0x163fea[_0x11bcea]={'$like':'%'+_0x3dfd85['query'][_0x040e('0x3e')]+'%'};return _0x163fea;})});}_0x4b2790=_[_0x040e('0x3d')]({},_0x4b2790,_0x3dfd85[_0x040e('0x48')]);return _0x497fda[_0x040e('0x50')](_0x4b2790);}})['then'](function(_0x1da243){if(_0x1da243){_0x58051b=_0x1da243[_0x040e('0x37')];if(!_0x3dfd85['query']['hasOwnProperty'](_0x040e('0x39'))){_0x4b2790[_0x040e('0x20')]=qs['limit'](_0x3dfd85[_0x040e('0x31')]['limit']);_0x4b2790[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x3dfd85['query'][_0x040e('0x22')]);}return _0x497fda[_0x040e('0x50')](_0x4b2790);}})[_0x040e('0x28')](function(_0x549847){if(_0x549847){return _0x549847?{'count':_0x58051b,'rows':_0x549847}:null;}})[_0x040e('0x28')](respondWithResult(_0x4f8bc9,null))['catch'](handleError(_0x4f8bc9,null));};exports[_0x040e('0x52')]=function(_0x2a8f1a,_0x28eff3,_0x575c08){var _0x55dd05={};var _0x32da2f={};var _0x42c8de;var _0x1530e4;return db['Dynamics365Configuration'][_0x040e('0x51')]({'where':{'id':_0x2a8f1a['params']['id']}})['then'](handleEntityNotFound(_0x28eff3,null))[_0x040e('0x28')](function(_0xc1414){if(_0xc1414){_0x42c8de=_0xc1414;_0x32da2f['model']=_[_0x040e('0x32')](db['Dynamics365Field'][_0x040e('0x46')]);_0x32da2f[_0x040e('0x31')]=_[_0x040e('0x32')](_0x2a8f1a[_0x040e('0x31')]);_0x32da2f['filters']=_[_0x040e('0x34')](_0x32da2f[_0x040e('0x35')],_0x32da2f[_0x040e('0x31')]);_0x55dd05['attributes']=_[_0x040e('0x34')](_0x32da2f[_0x040e('0x35')],qs['fields'](_0x2a8f1a[_0x040e('0x31')]['fields']));_0x55dd05[_0x040e('0x36')]=_0x55dd05[_0x040e('0x36')][_0x040e('0x37')]?_0x55dd05[_0x040e('0x36')]:_0x32da2f[_0x040e('0x35')];_0x55dd05[_0x040e('0x3a')]=qs[_0x040e('0x3b')](_0x2a8f1a[_0x040e('0x31')][_0x040e('0x3b')]);_0x55dd05[_0x040e('0x3c')]=qs['filters'](_['pick'](_0x2a8f1a[_0x040e('0x31')],_0x32da2f[_0x040e('0x33')]));if(_0x2a8f1a[_0x040e('0x31')][_0x040e('0x3e')]){_0x55dd05[_0x040e('0x3c')]=_['merge'](_0x55dd05[_0x040e('0x3c')],{'$or':_[_0x040e('0x2d')](_0x55dd05[_0x040e('0x36')],function(_0x30600f){var _0x2db2fb={};_0x2db2fb[_0x30600f]={'$like':'%'+_0x2a8f1a[_0x040e('0x31')]['filter']+'%'};return _0x2db2fb;})});}_0x55dd05=_[_0x040e('0x3d')]({},_0x55dd05,_0x2a8f1a[_0x040e('0x48')]);return _0x42c8de[_0x040e('0x52')](_0x55dd05);}})['then'](function(_0x5b3a66){if(_0x5b3a66){_0x1530e4=_0x5b3a66['length'];if(!_0x2a8f1a[_0x040e('0x31')][_0x040e('0x38')](_0x040e('0x39'))){_0x55dd05['limit']=qs[_0x040e('0x20')](_0x2a8f1a[_0x040e('0x31')][_0x040e('0x20')]);_0x55dd05[_0x040e('0x22')]=qs[_0x040e('0x22')](_0x2a8f1a[_0x040e('0x31')]['offset']);}return _0x42c8de[_0x040e('0x52')](_0x55dd05);}})['then'](function(_0x2002e0){if(_0x2002e0){return _0x2002e0?{'count':_0x1530e4,'rows':_0x2002e0}:null;}})[_0x040e('0x28')](respondWithResult(_0x28eff3,null))[_0x040e('0x44')](handleError(_0x28eff3,null));}; \ No newline at end of file +var _0xe0b2=['offset','set','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body','params','findOne','Dynamics365Field','order','sort','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count'];(function(_0x1eca7f,_0x401474){var _0x485345=function(_0x595339){while(--_0x595339){_0x1eca7f['push'](_0x1eca7f['shift']());}};_0x485345(++_0x401474);}(_0xe0b2,0x127));var _0x2e0b=function(_0x136c76,_0x1c9f96){_0x136c76=_0x136c76-0x0;var _0x4a7f5c=_0xe0b2[_0x136c76];return _0x4a7f5c;};'use strict';var emlformat=require(_0x2e0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2e0b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2e0b('0x2'));var Mustache=require(_0x2e0b('0x3'));var util=require(_0x2e0b('0x4'));var path=require('path');var sox=require(_0x2e0b('0x5'));var csv=require(_0x2e0b('0x6'));var ejs=require(_0x2e0b('0x7'));var fs=require('fs');var fs_extra=require(_0x2e0b('0x8'));var _=require(_0x2e0b('0x9'));var squel=require(_0x2e0b('0xa'));var crypto=require(_0x2e0b('0xb'));var jsforce=require(_0x2e0b('0xc'));var deskjs=require(_0x2e0b('0xd'));var toCsv=require(_0x2e0b('0x6'));var querystring=require(_0x2e0b('0xe'));var Papa=require(_0x2e0b('0xf'));var Redis=require(_0x2e0b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e0b('0x11'));var hardwareService=require(_0x2e0b('0x12'));var logger=require(_0x2e0b('0x13'))(_0x2e0b('0x14'));var utils=require('../../config/utils');var config=require(_0x2e0b('0x15'));var licenseUtil=require(_0x2e0b('0x16'));var db=require(_0x2e0b('0x17'))['db'];function respondWithStatusCode(_0x48cd00,_0x587d73){_0x587d73=_0x587d73||0xcc;return function(_0x4bf9c3){if(_0x4bf9c3){return _0x48cd00[_0x2e0b('0x18')](_0x587d73);}return _0x48cd00[_0x2e0b('0x19')](_0x587d73)['end']();};}function respondWithResult(_0x1ae345,_0x26e506){_0x26e506=_0x26e506||0xc8;return function(_0x403083){if(_0x403083){return _0x1ae345[_0x2e0b('0x19')](_0x26e506)['json'](_0x403083);}};}function respondWithFilteredResult(_0x128cfb,_0x4c4e21){return function(_0x508cc1){if(_0x508cc1){var _0x1aefa7=typeof _0x4c4e21['offset']===_0x2e0b('0x1a')&&typeof _0x4c4e21[_0x2e0b('0x1b')]===_0x2e0b('0x1a');var _0x41a1be=_0x508cc1['count'];var _0x35aec9=_0x1aefa7?0x0:_0x4c4e21['offset'];var _0x4a52a6=_0x1aefa7?_0x508cc1[_0x2e0b('0x1c')]:_0x4c4e21[_0x2e0b('0x1d')]+_0x4c4e21[_0x2e0b('0x1b')];var _0x4cf00d;if(_0x4a52a6>=_0x41a1be){_0x4a52a6=_0x41a1be;_0x4cf00d=0xc8;}else{_0x4cf00d=0xce;}_0x128cfb[_0x2e0b('0x19')](_0x4cf00d);return _0x128cfb[_0x2e0b('0x1e')]('Content-Range',_0x35aec9+'-'+_0x4a52a6+'/'+_0x41a1be)[_0x2e0b('0x1f')](_0x508cc1);}return null;};}function patchUpdates(_0x569967){return function(_0x4eb2ae){try{jsonpatch[_0x2e0b('0x20')](_0x4eb2ae,_0x569967,!![]);}catch(_0x33148b){return BPromise[_0x2e0b('0x21')](_0x33148b);}return _0x4eb2ae[_0x2e0b('0x22')]();};}function saveUpdates(_0x7ac5f0,_0x12b1fe){return function(_0x518ccd){if(_0x518ccd){return _0x518ccd['update'](_0x7ac5f0)[_0x2e0b('0x23')](function(_0x2814d5){return _0x2814d5;});}return null;};}function removeEntity(_0x40aa92,_0x3ebdb1){return function(_0x54ae53){if(_0x54ae53){return _0x54ae53[_0x2e0b('0x24')]()[_0x2e0b('0x23')](function(){_0x40aa92[_0x2e0b('0x19')](0xcc)[_0x2e0b('0x25')]();});}};}function handleEntityNotFound(_0x27cd49,_0x3397ce){return function(_0x5d4360){if(!_0x5d4360){_0x27cd49[_0x2e0b('0x18')](0x194);}return _0x5d4360;};}function handleError(_0x586901,_0x5d3848){_0x5d3848=_0x5d3848||0x1f4;return function(_0x11bd62){logger[_0x2e0b('0x26')](_0x11bd62[_0x2e0b('0x27')]);if(_0x11bd62['name']){delete _0x11bd62[_0x2e0b('0x28')];}_0x586901['status'](_0x5d3848)[_0x2e0b('0x29')](_0x11bd62);};}exports[_0x2e0b('0x2a')]=function(_0xb75285,_0x486fdf){var _0x465b79={},_0x5abc11={},_0x31b206={'count':0x0,'rows':[]};var _0x489d47=_[_0x2e0b('0x2b')](db[_0x2e0b('0x2c')][_0x2e0b('0x2d')],function(_0x5b580b){return{'name':_0x5b580b[_0x2e0b('0x2e')],'type':_0x5b580b[_0x2e0b('0x2f')][_0x2e0b('0x30')]};});_0x5abc11[_0x2e0b('0x31')]=_[_0x2e0b('0x2b')](_0x489d47,_0x2e0b('0x28'));_0x5abc11['query']=_[_0x2e0b('0x32')](_0xb75285[_0x2e0b('0x33')]);_0x5abc11[_0x2e0b('0x34')]=_[_0x2e0b('0x35')](_0x5abc11[_0x2e0b('0x31')],_0x5abc11['query']);_0x465b79['attributes']=_[_0x2e0b('0x35')](_0x5abc11[_0x2e0b('0x31')],qs['fields'](_0xb75285[_0x2e0b('0x33')]['fields']));_0x465b79[_0x2e0b('0x36')]=_0x465b79['attributes'][_0x2e0b('0x37')]?_0x465b79[_0x2e0b('0x36')]:_0x5abc11[_0x2e0b('0x31')];if(!_0xb75285['query'][_0x2e0b('0x38')](_0x2e0b('0x39'))){_0x465b79[_0x2e0b('0x1b')]=qs[_0x2e0b('0x1b')](_0xb75285[_0x2e0b('0x33')][_0x2e0b('0x1b')]);_0x465b79['offset']=qs['offset'](_0xb75285[_0x2e0b('0x33')][_0x2e0b('0x1d')]);}_0x465b79['order']=qs['sort'](_0xb75285[_0x2e0b('0x33')]['sort']);_0x465b79[_0x2e0b('0x3a')]=qs[_0x2e0b('0x34')](_[_0x2e0b('0x3b')](_0xb75285['query'],_0x5abc11['filters']),_0x489d47);if(_0xb75285['query'][_0x2e0b('0x3c')]){_0x465b79[_0x2e0b('0x3a')]=_[_0x2e0b('0x3d')](_0x465b79[_0x2e0b('0x3a')],{'$or':_['map'](_0x489d47,function(_0x11c28c){if(_0x11c28c['type']!==_0x2e0b('0x3e')){var _0x521263={};_0x521263[_0x11c28c[_0x2e0b('0x28')]]={'$like':'%'+_0xb75285[_0x2e0b('0x33')]['filter']+'%'};return _0x521263;}})});}_0x465b79=_['merge']({},_0x465b79,_0xb75285[_0x2e0b('0x3f')]);var _0x7eef54={'where':_0x465b79['where']};return db[_0x2e0b('0x2c')][_0x2e0b('0x1c')](_0x7eef54)[_0x2e0b('0x23')](function(_0x5a8d5f){_0x31b206[_0x2e0b('0x1c')]=_0x5a8d5f;if(_0xb75285['query'][_0x2e0b('0x40')]){_0x465b79[_0x2e0b('0x41')]=[{'all':!![]}];}return db[_0x2e0b('0x2c')]['findAll'](_0x465b79);})[_0x2e0b('0x23')](function(_0x43c772){_0x31b206[_0x2e0b('0x42')]=_0x43c772;return _0x31b206;})[_0x2e0b('0x23')](respondWithFilteredResult(_0x486fdf,_0x465b79))[_0x2e0b('0x43')](handleError(_0x486fdf,null));};exports[_0x2e0b('0x44')]=function(_0x4289a1,_0x1f08bc){var _0x63021={'raw':![],'where':{'id':_0x4289a1['params']['id']}},_0x3ede3c={};_0x3ede3c[_0x2e0b('0x31')]=_[_0x2e0b('0x32')](db[_0x2e0b('0x2c')][_0x2e0b('0x2d')]);_0x3ede3c[_0x2e0b('0x33')]=_[_0x2e0b('0x32')](_0x4289a1[_0x2e0b('0x33')]);_0x3ede3c[_0x2e0b('0x34')]=_[_0x2e0b('0x35')](_0x3ede3c[_0x2e0b('0x31')],_0x3ede3c['query']);_0x63021['attributes']=_[_0x2e0b('0x35')](_0x3ede3c[_0x2e0b('0x31')],qs[_0x2e0b('0x45')](_0x4289a1[_0x2e0b('0x33')][_0x2e0b('0x45')]));_0x63021[_0x2e0b('0x36')]=_0x63021['attributes']['length']?_0x63021[_0x2e0b('0x36')]:_0x3ede3c[_0x2e0b('0x31')];if(_0x4289a1[_0x2e0b('0x33')][_0x2e0b('0x40')]){_0x63021[_0x2e0b('0x41')]=[{'all':!![]}];}_0x63021=_['merge']({},_0x63021,_0x4289a1[_0x2e0b('0x3f')]);return db['Dynamics365Configuration'][_0x2e0b('0x46')](_0x63021)[_0x2e0b('0x23')](handleEntityNotFound(_0x1f08bc,null))[_0x2e0b('0x23')](respondWithResult(_0x1f08bc,null))[_0x2e0b('0x43')](handleError(_0x1f08bc,null));};exports['create']=function(_0x3e5851,_0x33365c){return db[_0x2e0b('0x2c')][_0x2e0b('0x47')](_0x3e5851[_0x2e0b('0x48')],{})['then'](respondWithResult(_0x33365c,0xc9))[_0x2e0b('0x43')](handleError(_0x33365c,null));};exports['update']=function(_0x5149ba,_0x24ead4){if(_0x5149ba[_0x2e0b('0x48')]['id']){delete _0x5149ba[_0x2e0b('0x48')]['id'];}return db[_0x2e0b('0x2c')]['find']({'where':{'id':_0x5149ba[_0x2e0b('0x49')]['id']}})[_0x2e0b('0x23')](handleEntityNotFound(_0x24ead4,null))[_0x2e0b('0x23')](saveUpdates(_0x5149ba[_0x2e0b('0x48')],null))[_0x2e0b('0x23')](respondWithResult(_0x24ead4,null))[_0x2e0b('0x43')](handleError(_0x24ead4,null));};exports['destroy']=function(_0xfd6710,_0x55378a){return db['Dynamics365Configuration'][_0x2e0b('0x46')]({'where':{'id':_0xfd6710['params']['id']}})[_0x2e0b('0x23')](handleEntityNotFound(_0x55378a,null))[_0x2e0b('0x23')](removeEntity(_0x55378a,null))[_0x2e0b('0x43')](handleError(_0x55378a,null));};exports['getFields']=function(_0x4aef18,_0x37f7ed,_0x1fdeaa){var _0x1e9e62={};var _0x176824={};var _0x50506e;var _0x1fb677;return db[_0x2e0b('0x2c')][_0x2e0b('0x4a')]({'where':{'id':_0x4aef18[_0x2e0b('0x49')]['id']}})['then'](handleEntityNotFound(_0x37f7ed,null))[_0x2e0b('0x23')](function(_0xaf8937){if(_0xaf8937){_0x50506e=_0xaf8937;_0x176824['model']=_[_0x2e0b('0x32')](db[_0x2e0b('0x4b')][_0x2e0b('0x2d')]);_0x176824[_0x2e0b('0x33')]=_[_0x2e0b('0x32')](_0x4aef18['query']);_0x176824['filters']=_[_0x2e0b('0x35')](_0x176824['model'],_0x176824[_0x2e0b('0x33')]);_0x1e9e62[_0x2e0b('0x36')]=_[_0x2e0b('0x35')](_0x176824[_0x2e0b('0x31')],qs[_0x2e0b('0x45')](_0x4aef18[_0x2e0b('0x33')][_0x2e0b('0x45')]));_0x1e9e62[_0x2e0b('0x36')]=_0x1e9e62['attributes'][_0x2e0b('0x37')]?_0x1e9e62[_0x2e0b('0x36')]:_0x176824[_0x2e0b('0x31')];_0x1e9e62[_0x2e0b('0x4c')]=qs[_0x2e0b('0x4d')](_0x4aef18[_0x2e0b('0x33')]['sort']);_0x1e9e62[_0x2e0b('0x3a')]=qs['filters'](_[_0x2e0b('0x3b')](_0x4aef18[_0x2e0b('0x33')],_0x176824['filters']));if(_0x4aef18[_0x2e0b('0x33')]['filter']){_0x1e9e62['where']=_['merge'](_0x1e9e62['where'],{'$or':_[_0x2e0b('0x2b')](_0x1e9e62['attributes'],function(_0x5586de){var _0x439d4d={};_0x439d4d[_0x5586de]={'$like':'%'+_0x4aef18[_0x2e0b('0x33')][_0x2e0b('0x3c')]+'%'};return _0x439d4d;})});}_0x1e9e62=_[_0x2e0b('0x3d')]({},_0x1e9e62,_0x4aef18[_0x2e0b('0x3f')]);return _0x50506e[_0x2e0b('0x4e')](_0x1e9e62);}})['then'](function(_0x651b06){if(_0x651b06){_0x1fb677=_0x651b06[_0x2e0b('0x37')];if(!_0x4aef18[_0x2e0b('0x33')][_0x2e0b('0x38')](_0x2e0b('0x39'))){_0x1e9e62[_0x2e0b('0x1b')]=qs[_0x2e0b('0x1b')](_0x4aef18['query'][_0x2e0b('0x1b')]);_0x1e9e62['offset']=qs[_0x2e0b('0x1d')](_0x4aef18[_0x2e0b('0x33')][_0x2e0b('0x1d')]);}return _0x50506e[_0x2e0b('0x4e')](_0x1e9e62);}})[_0x2e0b('0x23')](function(_0x517059){if(_0x517059){return _0x517059?{'count':_0x1fb677,'rows':_0x517059}:null;}})[_0x2e0b('0x23')](respondWithResult(_0x37f7ed,null))[_0x2e0b('0x43')](handleError(_0x37f7ed,null));};exports[_0x2e0b('0x4f')]=function(_0x5db500,_0x1af964,_0x524e05){var _0x5693be={};var _0x507d92={};var _0x728955;var _0x59a06a;return db[_0x2e0b('0x2c')][_0x2e0b('0x4a')]({'where':{'id':_0x5db500[_0x2e0b('0x49')]['id']}})[_0x2e0b('0x23')](handleEntityNotFound(_0x1af964,null))[_0x2e0b('0x23')](function(_0x2fe5d3){if(_0x2fe5d3){_0x728955=_0x2fe5d3;_0x507d92[_0x2e0b('0x31')]=_[_0x2e0b('0x32')](db[_0x2e0b('0x4b')][_0x2e0b('0x2d')]);_0x507d92[_0x2e0b('0x33')]=_[_0x2e0b('0x32')](_0x5db500[_0x2e0b('0x33')]);_0x507d92[_0x2e0b('0x34')]=_[_0x2e0b('0x35')](_0x507d92[_0x2e0b('0x31')],_0x507d92[_0x2e0b('0x33')]);_0x5693be['attributes']=_['intersection'](_0x507d92['model'],qs['fields'](_0x5db500[_0x2e0b('0x33')]['fields']));_0x5693be['attributes']=_0x5693be[_0x2e0b('0x36')][_0x2e0b('0x37')]?_0x5693be[_0x2e0b('0x36')]:_0x507d92['model'];_0x5693be[_0x2e0b('0x4c')]=qs[_0x2e0b('0x4d')](_0x5db500[_0x2e0b('0x33')][_0x2e0b('0x4d')]);_0x5693be[_0x2e0b('0x3a')]=qs['filters'](_[_0x2e0b('0x3b')](_0x5db500[_0x2e0b('0x33')],_0x507d92['filters']));if(_0x5db500[_0x2e0b('0x33')][_0x2e0b('0x3c')]){_0x5693be[_0x2e0b('0x3a')]=_[_0x2e0b('0x3d')](_0x5693be[_0x2e0b('0x3a')],{'$or':_[_0x2e0b('0x2b')](_0x5693be[_0x2e0b('0x36')],function(_0x4d0d5){var _0x19b117={};_0x19b117[_0x4d0d5]={'$like':'%'+_0x5db500['query'][_0x2e0b('0x3c')]+'%'};return _0x19b117;})});}_0x5693be=_[_0x2e0b('0x3d')]({},_0x5693be,_0x5db500[_0x2e0b('0x3f')]);return _0x728955['getSubjects'](_0x5693be);}})['then'](function(_0x453cb3){if(_0x453cb3){_0x59a06a=_0x453cb3[_0x2e0b('0x37')];if(!_0x5db500[_0x2e0b('0x33')][_0x2e0b('0x38')](_0x2e0b('0x39'))){_0x5693be['limit']=qs['limit'](_0x5db500[_0x2e0b('0x33')][_0x2e0b('0x1b')]);_0x5693be[_0x2e0b('0x1d')]=qs[_0x2e0b('0x1d')](_0x5db500[_0x2e0b('0x33')][_0x2e0b('0x1d')]);}return _0x728955[_0x2e0b('0x4f')](_0x5693be);}})[_0x2e0b('0x23')](function(_0x17e5fa){if(_0x17e5fa){return _0x17e5fa?{'count':_0x59a06a,'rows':_0x17e5fa}:null;}})[_0x2e0b('0x23')](respondWithResult(_0x1af964,null))[_0x2e0b('0x43')](handleError(_0x1af964,null));};exports[_0x2e0b('0x50')]=function(_0xe2bb73,_0x58e5d7,_0x9e9306){var _0x3401cd={};var _0x2b889c={};var _0x541bfb;var _0x3e729e;return db['Dynamics365Configuration'][_0x2e0b('0x4a')]({'where':{'id':_0xe2bb73[_0x2e0b('0x49')]['id']}})[_0x2e0b('0x23')](handleEntityNotFound(_0x58e5d7,null))[_0x2e0b('0x23')](function(_0x15cbb4){if(_0x15cbb4){_0x541bfb=_0x15cbb4;_0x2b889c[_0x2e0b('0x31')]=_['keys'](db[_0x2e0b('0x4b')][_0x2e0b('0x2d')]);_0x2b889c[_0x2e0b('0x33')]=_[_0x2e0b('0x32')](_0xe2bb73['query']);_0x2b889c[_0x2e0b('0x34')]=_[_0x2e0b('0x35')](_0x2b889c[_0x2e0b('0x31')],_0x2b889c['query']);_0x3401cd[_0x2e0b('0x36')]=_[_0x2e0b('0x35')](_0x2b889c[_0x2e0b('0x31')],qs[_0x2e0b('0x45')](_0xe2bb73[_0x2e0b('0x33')][_0x2e0b('0x45')]));_0x3401cd[_0x2e0b('0x36')]=_0x3401cd[_0x2e0b('0x36')]['length']?_0x3401cd[_0x2e0b('0x36')]:_0x2b889c['model'];_0x3401cd[_0x2e0b('0x4c')]=qs[_0x2e0b('0x4d')](_0xe2bb73['query'][_0x2e0b('0x4d')]);_0x3401cd[_0x2e0b('0x3a')]=qs['filters'](_[_0x2e0b('0x3b')](_0xe2bb73[_0x2e0b('0x33')],_0x2b889c['filters']));if(_0xe2bb73[_0x2e0b('0x33')][_0x2e0b('0x3c')]){_0x3401cd['where']=_[_0x2e0b('0x3d')](_0x3401cd['where'],{'$or':_[_0x2e0b('0x2b')](_0x3401cd[_0x2e0b('0x36')],function(_0x4ed894){var _0x220448={};_0x220448[_0x4ed894]={'$like':'%'+_0xe2bb73['query']['filter']+'%'};return _0x220448;})});}_0x3401cd=_['merge']({},_0x3401cd,_0xe2bb73['options']);return _0x541bfb[_0x2e0b('0x50')](_0x3401cd);}})['then'](function(_0x3cad0a){if(_0x3cad0a){_0x3e729e=_0x3cad0a['length'];if(!_0xe2bb73[_0x2e0b('0x33')][_0x2e0b('0x38')](_0x2e0b('0x39'))){_0x3401cd['limit']=qs['limit'](_0xe2bb73[_0x2e0b('0x33')][_0x2e0b('0x1b')]);_0x3401cd[_0x2e0b('0x1d')]=qs[_0x2e0b('0x1d')](_0xe2bb73[_0x2e0b('0x33')][_0x2e0b('0x1d')]);}return _0x541bfb[_0x2e0b('0x50')](_0x3401cd);}})[_0x2e0b('0x23')](function(_0xbdaed5){if(_0xbdaed5){return _0xbdaed5?{'count':_0x3e729e,'rows':_0xbdaed5}:null;}})[_0x2e0b('0x23')](respondWithResult(_0x58e5d7,null))[_0x2e0b('0x43')](handleError(_0x58e5d7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 331162e..62ee656 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0xc0f0d6,_0x4f4015){var _0x40d7ee=function(_0x246eac){while(--_0x246eac){_0xc0f0d6['push'](_0xc0f0d6['shift']());}};_0x40d7ee(++_0x4f4015);}(_0x84ab,0x12f));var _0xb84a=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x84ab[_0x4aba15];return _0x1c8122;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x216a08,_0x4314c7){var _0x2c5a70=function(_0x4561b7){while(--_0x4561b7){_0x216a08['push'](_0x216a08['shift']());}};_0x2c5a70(++_0x4314c7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5b9b46,_0x471d93){_0x5b9b46=_0x5b9b46-0x0;var _0x453787=_0x9bde[_0x5b9b46];return _0x453787;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index fde97f4..b428426 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a09=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x3b58d1,_0x979f58){var _0x2ecdcb=function(_0x12b773){while(--_0x12b773){_0x3b58d1['push'](_0x3b58d1['shift']());}};_0x2ecdcb(++_0x979f58);}(_0x5a09,0x141));var _0x95a0=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x5a09[_0x5c6299];return _0x23b564;};'use strict';var _=require(_0x95a0('0x0'));var util=require(_0x95a0('0x1'));var moment=require(_0x95a0('0x2'));var BPromise=require(_0x95a0('0x3'));var rs=require(_0x95a0('0x4'));var fs=require('fs');var Redis=require(_0x95a0('0x5'));var db=require(_0x95a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x95a0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x95a0('0x8')][_0x95a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1f00,_0x381a90,_0x1cf6fb){return new BPromise(function(_0x2148ca,_0x413f73){return client[_0x95a0('0xa')](_0x5e1f00,_0x1cf6fb)['then'](function(_0x30a224){logger[_0x95a0('0xb')](_0x95a0('0xc'),_0x381a90,_0x95a0('0xd'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x381a90,_0x95a0('0xd'),JSON[_0x95a0('0xe')](_0x30a224));if(_0x30a224[_0x95a0('0xf')]){if(_0x30a224[_0x95a0('0xf')][_0x95a0('0x10')]===0x1f4){logger['error'](_0x95a0('0xc'),_0x381a90,_0x30a224['error'][_0x95a0('0x11')]);return _0x413f73(_0x30a224['error']['message']);}logger[_0x95a0('0xf')](_0x95a0('0xc'),_0x381a90,_0x30a224[_0x95a0('0xf')][_0x95a0('0x11')]);return _0x2148ca(_0x30a224[_0x95a0('0xf')]['message']);}else{logger['info'](_0x95a0('0xc'),_0x381a90,_0x95a0('0xd'));_0x2148ca(_0x30a224['result']['message']);}})[_0x95a0('0x12')](function(_0x132869){logger['error'](_0x95a0('0xc'),_0x381a90,_0x132869);_0x413f73(_0x132869);});});} \ No newline at end of file +var _0x116f=['request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x116f,0x145));var _0xf116=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x116f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf116('0x0'));var util=require(_0xf116('0x1'));var moment=require(_0xf116('0x2'));var BPromise=require(_0xf116('0x3'));var rs=require(_0xf116('0x4'));var fs=require('fs');var Redis=require(_0xf116('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf116('0x6'));var logger=require(_0xf116('0x7'))(_0xf116('0x8'));var config=require(_0xf116('0x9'));var jayson=require(_0xf116('0xa'));var client=jayson[_0xf116('0xb')][_0xf116('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb42047,_0x37cfa5,_0x5bb8e3){return new BPromise(function(_0xf349d8,_0x3c404d){return client[_0xf116('0xd')](_0xb42047,_0x5bb8e3)[_0xf116('0xe')](function(_0x4b2a5e){logger['info'](_0xf116('0xf'),_0x37cfa5,_0xf116('0x10'));logger[_0xf116('0x11')](_0xf116('0x12'),_0x37cfa5,_0xf116('0x10'),JSON[_0xf116('0x13')](_0x4b2a5e));if(_0x4b2a5e['error']){if(_0x4b2a5e['error'][_0xf116('0x14')]===0x1f4){logger['error'](_0xf116('0xf'),_0x37cfa5,_0x4b2a5e[_0xf116('0x15')][_0xf116('0x16')]);return _0x3c404d(_0x4b2a5e['error']['message']);}logger[_0xf116('0x15')]('Dynamics365Configuration,\x20%s,\x20%s',_0x37cfa5,_0x4b2a5e['error'][_0xf116('0x16')]);return _0xf349d8(_0x4b2a5e[_0xf116('0x15')][_0xf116('0x16')]);}else{logger[_0xf116('0x17')](_0xf116('0xf'),_0x37cfa5,_0xf116('0x10'));_0xf349d8(_0x4b2a5e[_0xf116('0x18')][_0xf116('0x16')]);}})[_0xf116('0x19')](function(_0x525a4c){logger['error'](_0xf116('0xf'),_0x37cfa5,_0x525a4c);_0x3c404d(_0x525a4c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 3cc1b38..e0d9090 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d64=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x7d64,0x18d));var _0x47d6=function(_0x3b78a2,_0x5e9793){_0x3b78a2=_0x3b78a2-0x0;var _0x4592b4=_0x7d64[_0x3b78a2];return _0x4592b4;};'use strict';var multer=require('multer');var util=require(_0x47d6('0x0'));var path=require(_0x47d6('0x1'));var timeout=require(_0x47d6('0x2'));var express=require(_0x47d6('0x3'));var router=express[_0x47d6('0x4')]();var fs_extra=require(_0x47d6('0x5'));var auth=require(_0x47d6('0x6'));var interaction=require(_0x47d6('0x7'));var config=require(_0x47d6('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x47d6('0x9')]('/',auth[_0x47d6('0xa')](),controller['index']);router[_0x47d6('0x9')](_0x47d6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x47d6('0xc')]('/',auth[_0x47d6('0xa')](),controller[_0x47d6('0xd')]);router[_0x47d6('0xe')](_0x47d6('0xb'),auth[_0x47d6('0xa')](),controller['update']);router[_0x47d6('0xf')](_0x47d6('0xb'),auth['isAuthenticated'](),controller[_0x47d6('0x10')]);module[_0x47d6('0x11')]=router; \ No newline at end of file +var _0xa2a3=['/:id','post','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x161891,_0xe8715){var _0x2ba235=function(_0x469229){while(--_0x469229){_0x161891['push'](_0x161891['shift']());}};_0x2ba235(++_0xe8715);}(_0xa2a3,0x73));var _0x3a2a=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0xa2a3[_0x29cd14];return _0x4229d1;};'use strict';var multer=require('multer');var util=require(_0x3a2a('0x0'));var path=require(_0x3a2a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3a2a('0x2')]();var fs_extra=require(_0x3a2a('0x3'));var auth=require(_0x3a2a('0x4'));var interaction=require(_0x3a2a('0x5'));var config=require(_0x3a2a('0x6'));var controller=require(_0x3a2a('0x7'));router[_0x3a2a('0x8')]('/',auth[_0x3a2a('0x9')](),controller[_0x3a2a('0xa')]);router['get'](_0x3a2a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3a2a('0xc')]('/',auth['isAuthenticated'](),controller[_0x3a2a('0xd')]);router[_0x3a2a('0xe')](_0x3a2a('0xb'),auth[_0x3a2a('0x9')](),controller[_0x3a2a('0xf')]);router[_0x3a2a('0x10')](_0x3a2a('0xb'),auth[_0x3a2a('0x9')](),controller['destroy']);module[_0x3a2a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0bec00f..3d18cfe 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c20=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5c20,0x14a));var _0x05c2=function(_0x333162,_0xa11eb8){_0x333162=_0x333162-0x0;var _0x1883fa=_0x5c20[_0x333162];return _0x1883fa;};'use strict';var Sequelize=require('sequelize');module[_0x05c2('0x0')]={'type':{'type':Sequelize['ENUM'](_0x05c2('0x1'),_0x05c2('0x2'),_0x05c2('0x3'),_0x05c2('0x4'),'picklist'),'defaultValue':_0x05c2('0x1')},'content':{'type':Sequelize[_0x05c2('0x5')]},'key':{'type':Sequelize[_0x05c2('0x5')]},'keyType':{'type':Sequelize[_0x05c2('0x6')](_0x05c2('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x05c2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x59e9=['STRING','BOOLEAN','ENUM','string','variable','keyValue','picklist'];(function(_0x4160c1,_0x437ac1){var _0x1c742c=function(_0x38bbd2){while(--_0x38bbd2){_0x4160c1['push'](_0x4160c1['shift']());}};_0x1c742c(++_0x437ac1);}(_0x59e9,0x167));var _0x959e=function(_0x1883a0,_0x1f7265){_0x1883a0=_0x1883a0-0x0;var _0x466045=_0x59e9[_0x1883a0];return _0x466045;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x959e('0x0')](_0x959e('0x1'),_0x959e('0x2'),'customVariable',_0x959e('0x3'),_0x959e('0x4')),'defaultValue':_0x959e('0x1')},'content':{'type':Sequelize[_0x959e('0x5')]},'key':{'type':Sequelize[_0x959e('0x5')]},'keyType':{'type':Sequelize[_0x959e('0x0')]('string',_0x959e('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x959e('0x5')]},'idField':{'type':Sequelize[_0x959e('0x5')]},'nameField':{'type':Sequelize[_0x959e('0x5')]},'customField':{'type':Sequelize[_0x959e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x959e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c124100..c579635 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9893=['show','params','keys','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','name','send','index','map','Dynamics365Field','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x1ee85d,_0x288347){var _0x26a7a5=function(_0x430a79){while(--_0x430a79){_0x1ee85d['push'](_0x1ee85d['shift']());}};_0x26a7a5(++_0x288347);}(_0x9893,0x9f));var _0x3989=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9893[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3989('0x0'));var rimraf=require(_0x3989('0x1'));var zipdir=require(_0x3989('0x2'));var jsonpatch=require(_0x3989('0x3'));var rp=require(_0x3989('0x4'));var moment=require(_0x3989('0x5'));var BPromise=require(_0x3989('0x6'));var Mustache=require(_0x3989('0x7'));var util=require(_0x3989('0x8'));var path=require(_0x3989('0x9'));var sox=require(_0x3989('0xa'));var csv=require(_0x3989('0xb'));var ejs=require(_0x3989('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3989('0xd'));var crypto=require(_0x3989('0xe'));var jsforce=require(_0x3989('0xf'));var deskjs=require(_0x3989('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3989('0x11'));var Papa=require('papaparse');var Redis=require(_0x3989('0x12'));var authService=require(_0x3989('0x13'));var qs=require(_0x3989('0x14'));var as=require(_0x3989('0x15'));var hardwareService=require(_0x3989('0x16'));var logger=require(_0x3989('0x17'))(_0x3989('0x18'));var utils=require(_0x3989('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3989('0x1a'));var db=require(_0x3989('0x1b'))['db'];function respondWithStatusCode(_0x11c76a,_0x21e73a){_0x21e73a=_0x21e73a||0xcc;return function(_0x1c056f){if(_0x1c056f){return _0x11c76a[_0x3989('0x1c')](_0x21e73a);}return _0x11c76a[_0x3989('0x1d')](_0x21e73a)[_0x3989('0x1e')]();};}function respondWithResult(_0x4db378,_0x586c61){_0x586c61=_0x586c61||0xc8;return function(_0x28183a){if(_0x28183a){return _0x4db378['status'](_0x586c61)[_0x3989('0x1f')](_0x28183a);}};}function respondWithFilteredResult(_0x214dd9,_0x5134b2){return function(_0xcd0a8a){if(_0xcd0a8a){var _0x222953=typeof _0x5134b2[_0x3989('0x20')]===_0x3989('0x21')&&typeof _0x5134b2[_0x3989('0x22')]===_0x3989('0x21');var _0x13de40=_0xcd0a8a[_0x3989('0x23')];var _0x43b304=_0x222953?0x0:_0x5134b2['offset'];var _0x349c20=_0x222953?_0xcd0a8a[_0x3989('0x23')]:_0x5134b2[_0x3989('0x20')]+_0x5134b2[_0x3989('0x22')];var _0x213346;if(_0x349c20>=_0x13de40){_0x349c20=_0x13de40;_0x213346=0xc8;}else{_0x213346=0xce;}_0x214dd9[_0x3989('0x1d')](_0x213346);return _0x214dd9[_0x3989('0x24')]('Content-Range',_0x43b304+'-'+_0x349c20+'/'+_0x13de40)[_0x3989('0x1f')](_0xcd0a8a);}return null;};}function patchUpdates(_0x3c9257){return function(_0x54f62a){try{jsonpatch[_0x3989('0x25')](_0x54f62a,_0x3c9257,!![]);}catch(_0xb50280){return BPromise[_0x3989('0x26')](_0xb50280);}return _0x54f62a['save']();};}function saveUpdates(_0x541b5d,_0x516000){return function(_0x3be449){if(_0x3be449){return _0x3be449[_0x3989('0x27')](_0x541b5d)[_0x3989('0x28')](function(_0x1ef7f6){return _0x1ef7f6;});}return null;};}function removeEntity(_0x5e7c37,_0x34808d){return function(_0x5aac34){if(_0x5aac34){return _0x5aac34[_0x3989('0x29')]()[_0x3989('0x28')](function(){_0x5e7c37[_0x3989('0x1d')](0xcc)[_0x3989('0x1e')]();});}};}function handleEntityNotFound(_0x2ecfa5,_0x4cb770){return function(_0x483dc7){if(!_0x483dc7){_0x2ecfa5[_0x3989('0x1c')](0x194);}return _0x483dc7;};}function handleError(_0x520af1,_0x5de3f4){_0x5de3f4=_0x5de3f4||0x1f4;return function(_0x4ce04c){logger['error'](_0x4ce04c['stack']);if(_0x4ce04c[_0x3989('0x2a')]){delete _0x4ce04c[_0x3989('0x2a')];}_0x520af1[_0x3989('0x1d')](_0x5de3f4)[_0x3989('0x2b')](_0x4ce04c);};}exports[_0x3989('0x2c')]=function(_0x6dfb35,_0x18d707){var _0xed1275={},_0x2f8b84={},_0x14a17d={'count':0x0,'rows':[]};var _0x31e645=_[_0x3989('0x2d')](db[_0x3989('0x2e')][_0x3989('0x2f')],function(_0x29d022){return{'name':_0x29d022['fieldName'],'type':_0x29d022[_0x3989('0x30')][_0x3989('0x31')]};});_0x2f8b84['model']=_[_0x3989('0x2d')](_0x31e645,_0x3989('0x2a'));_0x2f8b84['query']=_['keys'](_0x6dfb35[_0x3989('0x32')]);_0x2f8b84[_0x3989('0x33')]=_['intersection'](_0x2f8b84[_0x3989('0x34')],_0x2f8b84[_0x3989('0x32')]);_0xed1275[_0x3989('0x35')]=_[_0x3989('0x36')](_0x2f8b84[_0x3989('0x34')],qs[_0x3989('0x37')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x37')]));_0xed1275[_0x3989('0x35')]=_0xed1275[_0x3989('0x35')][_0x3989('0x38')]?_0xed1275[_0x3989('0x35')]:_0x2f8b84[_0x3989('0x34')];if(!_0x6dfb35[_0x3989('0x32')]['hasOwnProperty'](_0x3989('0x39'))){_0xed1275[_0x3989('0x22')]=qs[_0x3989('0x22')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x22')]);_0xed1275[_0x3989('0x20')]=qs[_0x3989('0x20')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x20')]);}_0xed1275['order']=qs[_0x3989('0x3a')](_0x6dfb35[_0x3989('0x32')][_0x3989('0x3a')]);_0xed1275[_0x3989('0x3b')]=qs[_0x3989('0x33')](_[_0x3989('0x3c')](_0x6dfb35[_0x3989('0x32')],_0x2f8b84['filters']),_0x31e645);if(_0x6dfb35[_0x3989('0x32')][_0x3989('0x3d')]){_0xed1275[_0x3989('0x3b')]=_[_0x3989('0x3e')](_0xed1275[_0x3989('0x3b')],{'$or':_[_0x3989('0x2d')](_0x31e645,function(_0x2a7dd7){if(_0x2a7dd7[_0x3989('0x30')]!==_0x3989('0x3f')){var _0x1f2c23={};_0x1f2c23[_0x2a7dd7[_0x3989('0x2a')]]={'$like':'%'+_0x6dfb35[_0x3989('0x32')][_0x3989('0x3d')]+'%'};return _0x1f2c23;}})});}_0xed1275=_['merge']({},_0xed1275,_0x6dfb35[_0x3989('0x40')]);var _0x156cce={'where':_0xed1275[_0x3989('0x3b')]};return db[_0x3989('0x2e')][_0x3989('0x23')](_0x156cce)['then'](function(_0x1bad3a){_0x14a17d[_0x3989('0x23')]=_0x1bad3a;if(_0x6dfb35['query'][_0x3989('0x41')]){_0xed1275['include']=[{'all':!![]}];}return db[_0x3989('0x2e')][_0x3989('0x42')](_0xed1275);})[_0x3989('0x28')](function(_0x5db8b0){_0x14a17d[_0x3989('0x43')]=_0x5db8b0;return _0x14a17d;})['then'](respondWithFilteredResult(_0x18d707,_0xed1275))[_0x3989('0x44')](handleError(_0x18d707,null));};exports[_0x3989('0x45')]=function(_0x3e7984,_0x4fb427){var _0x36fbbf={'raw':!![],'where':{'id':_0x3e7984[_0x3989('0x46')]['id']}},_0x24027a={};_0x24027a['model']=_[_0x3989('0x47')](db[_0x3989('0x2e')][_0x3989('0x2f')]);_0x24027a[_0x3989('0x32')]=_[_0x3989('0x47')](_0x3e7984[_0x3989('0x32')]);_0x24027a[_0x3989('0x33')]=_[_0x3989('0x36')](_0x24027a['model'],_0x24027a[_0x3989('0x32')]);_0x36fbbf['attributes']=_[_0x3989('0x36')](_0x24027a['model'],qs[_0x3989('0x37')](_0x3e7984[_0x3989('0x32')][_0x3989('0x37')]));_0x36fbbf[_0x3989('0x35')]=_0x36fbbf[_0x3989('0x35')]['length']?_0x36fbbf['attributes']:_0x24027a['model'];if(_0x3e7984[_0x3989('0x32')]['includeAll']){_0x36fbbf[_0x3989('0x48')]=[{'all':!![]}];}_0x36fbbf=_[_0x3989('0x3e')]({},_0x36fbbf,_0x3e7984['options']);return db[_0x3989('0x2e')]['find'](_0x36fbbf)['then'](handleEntityNotFound(_0x4fb427,null))[_0x3989('0x28')](respondWithResult(_0x4fb427,null))['catch'](handleError(_0x4fb427,null));};exports[_0x3989('0x49')]=function(_0x4b6e3b,_0x5ba0d8){return db['Dynamics365Field'][_0x3989('0x49')](_0x4b6e3b[_0x3989('0x4a')],{})[_0x3989('0x28')](respondWithResult(_0x5ba0d8,0xc9))[_0x3989('0x44')](handleError(_0x5ba0d8,null));};exports[_0x3989('0x27')]=function(_0x28df42,_0x797dd){if(_0x28df42[_0x3989('0x4a')]['id']){delete _0x28df42['body']['id'];}return db[_0x3989('0x2e')][_0x3989('0x4b')]({'where':{'id':_0x28df42['params']['id']}})[_0x3989('0x28')](handleEntityNotFound(_0x797dd,null))[_0x3989('0x28')](saveUpdates(_0x28df42[_0x3989('0x4a')],null))[_0x3989('0x28')](respondWithResult(_0x797dd,null))[_0x3989('0x44')](handleError(_0x797dd,null));};exports[_0x3989('0x29')]=function(_0x39cee7,_0x400da3){return db['Dynamics365Field']['find']({'where':{'id':_0x39cee7[_0x3989('0x46')]['id']}})[_0x3989('0x28')](handleEntityNotFound(_0x400da3,null))[_0x3989('0x28')](removeEntity(_0x400da3,null))[_0x3989('0x44')](handleError(_0x400da3,null));}; \ No newline at end of file +var _0x7c79=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7c79,0x118));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x97c7('0x0'));var rimraf=require(_0x97c7('0x1'));var zipdir=require(_0x97c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c7('0x3'));var moment=require(_0x97c7('0x4'));var BPromise=require(_0x97c7('0x5'));var Mustache=require('mustache');var util=require(_0x97c7('0x6'));var path=require(_0x97c7('0x7'));var sox=require(_0x97c7('0x8'));var csv=require(_0x97c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c7('0xa'));var squel=require(_0x97c7('0xb'));var crypto=require(_0x97c7('0xc'));var jsforce=require(_0x97c7('0xd'));var deskjs=require(_0x97c7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x97c7('0xf'));var Papa=require(_0x97c7('0x10'));var Redis=require('ioredis');var authService=require(_0x97c7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x97c7('0x12'));var hardwareService=require(_0x97c7('0x13'));var logger=require(_0x97c7('0x14'))(_0x97c7('0x15'));var utils=require(_0x97c7('0x16'));var config=require(_0x97c7('0x17'));var licenseUtil=require(_0x97c7('0x18'));var db=require(_0x97c7('0x19'))['db'];function respondWithStatusCode(_0x1382be,_0x5eaca5){_0x5eaca5=_0x5eaca5||0xcc;return function(_0x317503){if(_0x317503){return _0x1382be[_0x97c7('0x1a')](_0x5eaca5);}return _0x1382be[_0x97c7('0x1b')](_0x5eaca5)[_0x97c7('0x1c')]();};}function respondWithResult(_0x48b414,_0x79ecda){_0x79ecda=_0x79ecda||0xc8;return function(_0x4ed0c0){if(_0x4ed0c0){return _0x48b414[_0x97c7('0x1b')](_0x79ecda)[_0x97c7('0x1d')](_0x4ed0c0);}};}function respondWithFilteredResult(_0x25ed3d,_0x42c399){return function(_0x201ced){if(_0x201ced){var _0xb35ff0=typeof _0x42c399[_0x97c7('0x1e')]===_0x97c7('0x1f')&&typeof _0x42c399[_0x97c7('0x20')]===_0x97c7('0x1f');var _0x1aac0c=_0x201ced[_0x97c7('0x21')];var _0x2b4a68=_0xb35ff0?0x0:_0x42c399[_0x97c7('0x1e')];var _0x2c3620=_0xb35ff0?_0x201ced['count']:_0x42c399[_0x97c7('0x1e')]+_0x42c399[_0x97c7('0x20')];var _0x1f4ec5;if(_0x2c3620>=_0x1aac0c){_0x2c3620=_0x1aac0c;_0x1f4ec5=0xc8;}else{_0x1f4ec5=0xce;}_0x25ed3d[_0x97c7('0x1b')](_0x1f4ec5);return _0x25ed3d[_0x97c7('0x22')](_0x97c7('0x23'),_0x2b4a68+'-'+_0x2c3620+'/'+_0x1aac0c)[_0x97c7('0x1d')](_0x201ced);}return null;};}function patchUpdates(_0x297033){return function(_0x4d295a){try{jsonpatch[_0x97c7('0x24')](_0x4d295a,_0x297033,!![]);}catch(_0x509d18){return BPromise[_0x97c7('0x25')](_0x509d18);}return _0x4d295a['save']();};}function saveUpdates(_0x3b57c2,_0x18bf3a){return function(_0x1f0dd5){if(_0x1f0dd5){return _0x1f0dd5['update'](_0x3b57c2)['then'](function(_0x224f18){return _0x224f18;});}return null;};}function removeEntity(_0x241af8,_0x4d4115){return function(_0x4dac34){if(_0x4dac34){return _0x4dac34[_0x97c7('0x26')]()[_0x97c7('0x27')](function(){_0x241af8[_0x97c7('0x1b')](0xcc)[_0x97c7('0x1c')]();});}};}function handleEntityNotFound(_0x279a9c,_0x5afe99){return function(_0x4bcaf7){if(!_0x4bcaf7){_0x279a9c['sendStatus'](0x194);}return _0x4bcaf7;};}function handleError(_0x14d976,_0x1fbe7e){_0x1fbe7e=_0x1fbe7e||0x1f4;return function(_0x35af7e){logger[_0x97c7('0x28')](_0x35af7e['stack']);if(_0x35af7e[_0x97c7('0x29')]){delete _0x35af7e[_0x97c7('0x29')];}_0x14d976[_0x97c7('0x1b')](_0x1fbe7e)[_0x97c7('0x2a')](_0x35af7e);};}exports['index']=function(_0x2c152e,_0x596ed8){var _0xc53691={},_0x2e830e={},_0x5798b7={'count':0x0,'rows':[]};var _0x2ced8d=_[_0x97c7('0x2b')](db[_0x97c7('0x2c')][_0x97c7('0x2d')],function(_0x70b3a){return{'name':_0x70b3a[_0x97c7('0x2e')],'type':_0x70b3a[_0x97c7('0x2f')][_0x97c7('0x30')]};});_0x2e830e['model']=_[_0x97c7('0x2b')](_0x2ced8d,_0x97c7('0x29'));_0x2e830e[_0x97c7('0x31')]=_[_0x97c7('0x32')](_0x2c152e[_0x97c7('0x31')]);_0x2e830e['filters']=_[_0x97c7('0x33')](_0x2e830e[_0x97c7('0x34')],_0x2e830e[_0x97c7('0x31')]);_0xc53691[_0x97c7('0x35')]=_[_0x97c7('0x33')](_0x2e830e[_0x97c7('0x34')],qs[_0x97c7('0x36')](_0x2c152e[_0x97c7('0x31')][_0x97c7('0x36')]));_0xc53691['attributes']=_0xc53691[_0x97c7('0x35')][_0x97c7('0x37')]?_0xc53691[_0x97c7('0x35')]:_0x2e830e[_0x97c7('0x34')];if(!_0x2c152e['query'][_0x97c7('0x38')]('nolimit')){_0xc53691[_0x97c7('0x20')]=qs[_0x97c7('0x20')](_0x2c152e[_0x97c7('0x31')][_0x97c7('0x20')]);_0xc53691[_0x97c7('0x1e')]=qs[_0x97c7('0x1e')](_0x2c152e['query'][_0x97c7('0x1e')]);}_0xc53691[_0x97c7('0x39')]=qs[_0x97c7('0x3a')](_0x2c152e[_0x97c7('0x31')][_0x97c7('0x3a')]);_0xc53691[_0x97c7('0x3b')]=qs[_0x97c7('0x3c')](_['pick'](_0x2c152e[_0x97c7('0x31')],_0x2e830e[_0x97c7('0x3c')]),_0x2ced8d);if(_0x2c152e[_0x97c7('0x31')][_0x97c7('0x3d')]){_0xc53691[_0x97c7('0x3b')]=_[_0x97c7('0x3e')](_0xc53691[_0x97c7('0x3b')],{'$or':_[_0x97c7('0x2b')](_0x2ced8d,function(_0x2c74dd){if(_0x2c74dd[_0x97c7('0x2f')]!==_0x97c7('0x3f')){var _0xad11df={};_0xad11df[_0x2c74dd[_0x97c7('0x29')]]={'$like':'%'+_0x2c152e[_0x97c7('0x31')][_0x97c7('0x3d')]+'%'};return _0xad11df;}})});}_0xc53691=_[_0x97c7('0x3e')]({},_0xc53691,_0x2c152e[_0x97c7('0x40')]);var _0x1a4e06={'where':_0xc53691[_0x97c7('0x3b')]};return db[_0x97c7('0x2c')][_0x97c7('0x21')](_0x1a4e06)[_0x97c7('0x27')](function(_0x24c5d9){_0x5798b7[_0x97c7('0x21')]=_0x24c5d9;if(_0x2c152e['query']['includeAll']){_0xc53691[_0x97c7('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x97c7('0x42')](_0xc53691);})[_0x97c7('0x27')](function(_0x418b73){_0x5798b7['rows']=_0x418b73;return _0x5798b7;})[_0x97c7('0x27')](respondWithFilteredResult(_0x596ed8,_0xc53691))[_0x97c7('0x43')](handleError(_0x596ed8,null));};exports[_0x97c7('0x44')]=function(_0xc89cad,_0x2e6658){var _0x54f7a0={'raw':!![],'where':{'id':_0xc89cad['params']['id']}},_0x15e188={};_0x15e188['model']=_[_0x97c7('0x32')](db[_0x97c7('0x2c')]['rawAttributes']);_0x15e188[_0x97c7('0x31')]=_['keys'](_0xc89cad[_0x97c7('0x31')]);_0x15e188[_0x97c7('0x3c')]=_[_0x97c7('0x33')](_0x15e188[_0x97c7('0x34')],_0x15e188['query']);_0x54f7a0[_0x97c7('0x35')]=_[_0x97c7('0x33')](_0x15e188[_0x97c7('0x34')],qs[_0x97c7('0x36')](_0xc89cad[_0x97c7('0x31')]['fields']));_0x54f7a0[_0x97c7('0x35')]=_0x54f7a0[_0x97c7('0x35')]['length']?_0x54f7a0[_0x97c7('0x35')]:_0x15e188['model'];if(_0xc89cad[_0x97c7('0x31')]['includeAll']){_0x54f7a0[_0x97c7('0x41')]=[{'all':!![]}];}_0x54f7a0=_[_0x97c7('0x3e')]({},_0x54f7a0,_0xc89cad[_0x97c7('0x40')]);return db['Dynamics365Field'][_0x97c7('0x45')](_0x54f7a0)['then'](handleEntityNotFound(_0x2e6658,null))[_0x97c7('0x27')](respondWithResult(_0x2e6658,null))[_0x97c7('0x43')](handleError(_0x2e6658,null));};exports[_0x97c7('0x46')]=function(_0x5eb51f,_0x4ab684){return db['Dynamics365Field'][_0x97c7('0x46')](_0x5eb51f['body'],{})[_0x97c7('0x27')](respondWithResult(_0x4ab684,0xc9))[_0x97c7('0x43')](handleError(_0x4ab684,null));};exports[_0x97c7('0x47')]=function(_0x4c2164,_0x365264){if(_0x4c2164[_0x97c7('0x48')]['id']){delete _0x4c2164['body']['id'];}return db[_0x97c7('0x2c')][_0x97c7('0x45')]({'where':{'id':_0x4c2164[_0x97c7('0x49')]['id']}})[_0x97c7('0x27')](handleEntityNotFound(_0x365264,null))[_0x97c7('0x27')](saveUpdates(_0x4c2164[_0x97c7('0x48')],null))[_0x97c7('0x27')](respondWithResult(_0x365264,null))[_0x97c7('0x43')](handleError(_0x365264,null));};exports['destroy']=function(_0x2d70b2,_0xd9eef7){return db[_0x97c7('0x2c')]['find']({'where':{'id':_0x2d70b2[_0x97c7('0x49')]['id']}})[_0x97c7('0x27')](handleEntityNotFound(_0xd9eef7,null))[_0x97c7('0x27')](removeEntity(_0xd9eef7,null))['catch'](handleError(_0xd9eef7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a6519a7..46f6f8e 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe802=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x305ba6,_0x1945c1){var _0x2846fa=function(_0x565721){while(--_0x565721){_0x305ba6['push'](_0x305ba6['shift']());}};_0x2846fa(++_0x1945c1);}(_0xe802,0x15f));var _0x2e80=function(_0x5884e1,_0x5d4b6e){_0x5884e1=_0x5884e1-0x0;var _0x33e132=_0xe802[_0x5884e1];return _0x33e132;};'use strict';var _=require(_0x2e80('0x0'));var util=require('util');var logger=require(_0x2e80('0x1'))(_0x2e80('0x2'));var moment=require(_0x2e80('0x3'));var BPromise=require('bluebird');var rp=require(_0x2e80('0x4'));var fs=require('fs');var path=require(_0x2e80('0x5'));var rimraf=require(_0x2e80('0x6'));var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x2e80('0x7')]=function(_0x57af29,_0x61fd60){return _0x57af29[_0x2e80('0x8')](_0x2e80('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x2e80('0xa'),'fields':[_0x2e80('0xb'),_0x2e80('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x105b=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash'];(function(_0x302aec,_0x43dc46){var _0x371cbe=function(_0x339a89){while(--_0x339a89){_0x302aec['push'](_0x302aec['shift']());}};_0x371cbe(++_0x43dc46);}(_0x105b,0x141));var _0xb105=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x105b[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xb105('0x0'));var util=require(_0xb105('0x1'));var logger=require(_0xb105('0x2'))(_0xb105('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb105('0x4'));var fs=require('fs');var path=require(_0xb105('0x5'));var rimraf=require(_0xb105('0x6'));var config=require(_0xb105('0x7'));var attributes=require(_0xb105('0x8'));module[_0xb105('0x9')]=function(_0x5e3079,_0x2b6444){return _0x5e3079['define'](_0xb105('0xa'),attributes,{'tableName':_0xb105('0xb'),'paranoid':![],'indexes':[{'name':_0xb105('0xc'),'fields':[_0xb105('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 5d711ef..7331343 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0911=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3e20a7,_0x43b9d1){var _0x3644c5=function(_0x172327){while(--_0x172327){_0x3e20a7['push'](_0x3e20a7['shift']());}};_0x3644c5(++_0x43b9d1);}(_0x0911,0x136));var _0x1091=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x0911[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var moment=require(_0x1091('0x2'));var BPromise=require(_0x1091('0x3'));var rs=require(_0x1091('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1091('0x5'));var logger=require(_0x1091('0x6'))(_0x1091('0x7'));var config=require('../../config/environment');var jayson=require(_0x1091('0x8'));var client=jayson[_0x1091('0x9')][_0x1091('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17fad8,_0x8c5f5d,_0x1719c4){return new BPromise(function(_0x5f68d3,_0x4ef34c){return client['request'](_0x17fad8,_0x1719c4)[_0x1091('0xb')](function(_0x527200){logger['info'](_0x1091('0xc'),_0x8c5f5d,_0x1091('0xd'));logger[_0x1091('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x8c5f5d,_0x1091('0xd'),JSON[_0x1091('0xf')](_0x527200));if(_0x527200['error']){if(_0x527200[_0x1091('0x10')][_0x1091('0x11')]===0x1f4){logger[_0x1091('0x10')](_0x1091('0xc'),_0x8c5f5d,_0x527200[_0x1091('0x10')]['message']);return _0x4ef34c(_0x527200['error'][_0x1091('0x12')]);}logger[_0x1091('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x8c5f5d,_0x527200[_0x1091('0x10')][_0x1091('0x12')]);return _0x5f68d3(_0x527200['error'][_0x1091('0x12')]);}else{logger[_0x1091('0x13')](_0x1091('0xc'),_0x8c5f5d,'request\x20sent');_0x5f68d3(_0x527200[_0x1091('0x14')][_0x1091('0x12')]);}})[_0x1091('0x15')](function(_0x190ef1){logger['error'](_0x1091('0xc'),_0x8c5f5d,_0x190ef1);_0x4ef34c(_0x190ef1);});});} \ No newline at end of file +var _0xa7ee=['rpc','../../config/environment','jayson/promise','http','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa7ee,0x162));var _0xea7e=function(_0x29d4b5,_0x1913e2){_0x29d4b5=_0x29d4b5-0x0;var _0x3fbb01=_0xa7ee[_0x29d4b5];return _0x3fbb01;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var moment=require(_0xea7e('0x2'));var BPromise=require('bluebird');var rs=require(_0xea7e('0x3'));var fs=require('fs');var Redis=require(_0xea7e('0x4'));var db=require(_0xea7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea7e('0x6'))(_0xea7e('0x7'));var config=require(_0xea7e('0x8'));var jayson=require(_0xea7e('0x9'));var client=jayson['client'][_0xea7e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50d161,_0x18282e,_0x2fb616){return new BPromise(function(_0x44e869,_0x5944fe){return client['request'](_0x50d161,_0x2fb616)['then'](function(_0x6e07c4){logger['info'](_0xea7e('0xb'),_0x18282e,_0xea7e('0xc'));logger[_0xea7e('0xd')](_0xea7e('0xe'),_0x18282e,_0xea7e('0xc'),JSON['stringify'](_0x6e07c4));if(_0x6e07c4[_0xea7e('0xf')]){if(_0x6e07c4[_0xea7e('0xf')][_0xea7e('0x10')]===0x1f4){logger['error'](_0xea7e('0xb'),_0x18282e,_0x6e07c4[_0xea7e('0xf')][_0xea7e('0x11')]);return _0x5944fe(_0x6e07c4[_0xea7e('0xf')][_0xea7e('0x11')]);}logger[_0xea7e('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x18282e,_0x6e07c4[_0xea7e('0xf')][_0xea7e('0x11')]);return _0x44e869(_0x6e07c4[_0xea7e('0xf')][_0xea7e('0x11')]);}else{logger['info'](_0xea7e('0xb'),_0x18282e,_0xea7e('0xc'));_0x44e869(_0x6e07c4['result'][_0xea7e('0x11')]);}})[_0xea7e('0x12')](function(_0x856ad3){logger[_0xea7e('0xf')](_0xea7e('0xb'),_0x18282e,_0x856ad3);_0x5944fe(_0x856ad3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7709da5..7e5cc6f 100644 --- a/server/api/intFreshdeskAccount/index.js +++ b/server/api/intFreshdeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde57=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','multer','util','Router','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index'];(function(_0x167fbf,_0xcf3949){var _0x1bc57f=function(_0x248377){while(--_0x248377){_0x167fbf['push'](_0x167fbf['shift']());}};_0x1bc57f(++_0xcf3949);}(_0xde57,0x1d8));var _0x7de5=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0xde57[_0x47cfa0];return _0x386b1d;};'use strict';var multer=require(_0x7de5('0x0'));var util=require(_0x7de5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7de5('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7de5('0x3'));var config=require('../../config/environment');var controller=require(_0x7de5('0x4'));router[_0x7de5('0x5')]('/',auth[_0x7de5('0x6')](),controller[_0x7de5('0x7')]);router[_0x7de5('0x5')](_0x7de5('0x8'),auth[_0x7de5('0x6')](),controller[_0x7de5('0x9')]);router[_0x7de5('0x5')](_0x7de5('0xa'),auth['isAuthenticated'](),controller[_0x7de5('0xb')]);router['get'](_0x7de5('0xc'),auth[_0x7de5('0x6')](),controller[_0x7de5('0xd')]);router['post']('/',auth[_0x7de5('0x6')](),controller[_0x7de5('0xe')]);router[_0x7de5('0xf')](_0x7de5('0xa'),auth[_0x7de5('0x6')](),controller[_0x7de5('0x10')]);router[_0x7de5('0x11')](_0x7de5('0x8'),auth[_0x7de5('0x6')](),controller['update']);router[_0x7de5('0x12')](_0x7de5('0x8'),auth['isAuthenticated'](),controller[_0x7de5('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe82e=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','post','put','update','delete'];(function(_0x5925b6,_0x61a73c){var _0x4467c4=function(_0x4c8a65){while(--_0x4c8a65){_0x5925b6['push'](_0x5925b6['shift']());}};_0x4467c4(++_0x61a73c);}(_0xe82e,0x178));var _0xee82=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xe82e[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require(_0xee82('0x0'));var util=require(_0xee82('0x1'));var path=require('path');var timeout=require(_0xee82('0x2'));var express=require(_0xee82('0x3'));var router=express[_0xee82('0x4')]();var fs_extra=require(_0xee82('0x5'));var auth=require(_0xee82('0x6'));var interaction=require(_0xee82('0x7'));var config=require(_0xee82('0x8'));var controller=require(_0xee82('0x9'));router[_0xee82('0xa')]('/',auth[_0xee82('0xb')](),controller[_0xee82('0xc')]);router[_0xee82('0xa')](_0xee82('0xd'),auth[_0xee82('0xb')](),controller[_0xee82('0xe')]);router['get'](_0xee82('0xf'),auth[_0xee82('0xb')](),controller['getConfigurations']);router[_0xee82('0xa')]('/:id/fields',auth[_0xee82('0xb')](),controller['getFields']);router[_0xee82('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xee82('0x10')](_0xee82('0xf'),auth[_0xee82('0xb')](),controller['addConfiguration']);router[_0xee82('0x11')](_0xee82('0xd'),auth['isAuthenticated'](),controller[_0xee82('0x12')]);router[_0xee82('0x13')](_0xee82('0xd'),auth[_0xee82('0xb')](),controller[_0xee82('0x14')]);module[_0xee82('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index bd315f5..b87e875 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['exports','STRING','username','remoteUri'];(function(_0x1e749a,_0x212e81){var _0x2532ec=function(_0x1287b5){while(--_0x1287b5){_0x1e749a['push'](_0x1e749a['shift']());}};_0x2532ec(++_0x212e81);}(_0x57ca,0x108));var _0xa57c=function(_0x444373,_0x2f35a1){_0x444373=_0x444373-0x0;var _0x1b8c3d=_0x57ca[_0x444373];return _0x1b8c3d;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'name':{'type':Sequelize[_0xa57c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x2')},'apiKey':{'type':Sequelize[_0xa57c('0x1')]},'remoteUri':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf61e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1ec7b2,_0x1c2c02){var _0x296f3b=function(_0x319815){while(--_0x319815){_0x1ec7b2['push'](_0x1ec7b2['shift']());}};_0x296f3b(++_0x1c2c02);}(_0xf61e,0x191));var _0xef61=function(_0x5187b6,_0xb90f75){_0x5187b6=_0x5187b6-0x0;var _0x20e7c3=_0xf61e[_0x5187b6];return _0x20e7c3;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'name':{'type':Sequelize[_0xef61('0x2')]},'description':{'type':Sequelize[_0xef61('0x2')]},'username':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x3')},'apiKey':{'type':Sequelize[_0xef61('0x2')]},'remoteUri':{'type':Sequelize[_0xef61('0x2')],'unique':_0xef61('0x4')},'serverUrl':{'type':Sequelize[_0xef61('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 84d066a..3ffe06d 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd404=['ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','show','keys','merge','create','body','catch','find','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','getSubjects','channel','type','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','toString','requester','subject','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1d28cf,_0x266ab6){var _0x59d797=function(_0x4f5f64){while(--_0x4f5f64){_0x1d28cf['push'](_0x1d28cf['shift']());}};_0x59d797(++_0x266ab6);}(_0xd404,0x15b));var _0x4d40=function(_0xc3a516,_0x32c235){_0xc3a516=_0xc3a516-0x0;var _0x1aec8a=_0xd404[_0xc3a516];return _0x1aec8a;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d40('0x2'));var rp=require(_0x4d40('0x3'));var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require(_0x4d40('0x8'));var csv=require(_0x4d40('0x9'));var ejs=require(_0x4d40('0xa'));var fs=require('fs');var fs_extra=require(_0x4d40('0xb'));var _=require(_0x4d40('0xc'));var squel=require('squel');var crypto=require(_0x4d40('0xd'));var jsforce=require(_0x4d40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4d40('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d40('0xf'));var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require(_0x4d40('0x13'));var logger=require(_0x4d40('0x14'))(_0x4d40('0x15'));var utils=require(_0x4d40('0x16'));var config=require(_0x4d40('0x17'));var licenseUtil=require(_0x4d40('0x18'));var db=require(_0x4d40('0x19'))['db'];var integrations=require(_0x4d40('0x1a'));function respondWithStatusCode(_0x28e5bf,_0x42a621){_0x42a621=_0x42a621||0xcc;return function(_0x5162f9){if(_0x5162f9){return _0x28e5bf[_0x4d40('0x1b')](_0x42a621);}return _0x28e5bf[_0x4d40('0x1c')](_0x42a621)[_0x4d40('0x1d')]();};}function respondWithResult(_0x2083bd,_0x477a91){_0x477a91=_0x477a91||0xc8;return function(_0x478cdd){if(_0x478cdd){return _0x2083bd[_0x4d40('0x1c')](_0x477a91)[_0x4d40('0x1e')](_0x478cdd);}};}function respondWithFilteredResult(_0x20bc1b,_0xcee25a){return function(_0x453857){if(_0x453857){var _0x361a41=typeof _0xcee25a[_0x4d40('0x1f')]===_0x4d40('0x20')&&typeof _0xcee25a[_0x4d40('0x21')]==='undefined';var _0x535989=_0x453857[_0x4d40('0x22')];var _0x1c0cd8=_0x361a41?0x0:_0xcee25a['offset'];var _0x23b8fd=_0x361a41?_0x453857[_0x4d40('0x22')]:_0xcee25a['offset']+_0xcee25a[_0x4d40('0x21')];var _0x5a77e0;if(_0x23b8fd>=_0x535989){_0x23b8fd=_0x535989;_0x5a77e0=0xc8;}else{_0x5a77e0=0xce;}_0x20bc1b[_0x4d40('0x1c')](_0x5a77e0);return _0x20bc1b[_0x4d40('0x23')]('Content-Range',_0x1c0cd8+'-'+_0x23b8fd+'/'+_0x535989)['json'](_0x453857);}return null;};}function patchUpdates(_0x375ce0){return function(_0x569190){try{jsonpatch['apply'](_0x569190,_0x375ce0,!![]);}catch(_0xc458da){return BPromise[_0x4d40('0x24')](_0xc458da);}return _0x569190[_0x4d40('0x25')]();};}function saveUpdates(_0x5d4c24,_0x356fd6){return function(_0x2ccafa){if(_0x2ccafa){return _0x2ccafa[_0x4d40('0x26')](_0x5d4c24)['then'](function(_0x4eebc3){return _0x4eebc3;});}return null;};}function removeEntity(_0x2df33a,_0x90b652){return function(_0x1285f6){if(_0x1285f6){return _0x1285f6[_0x4d40('0x27')]()[_0x4d40('0x28')](function(){_0x2df33a['status'](0xcc)[_0x4d40('0x1d')]();});}};}function handleEntityNotFound(_0x1f5e5b,_0x560df8){return function(_0x5540ee){if(!_0x5540ee){_0x1f5e5b[_0x4d40('0x1b')](0x194);}return _0x5540ee;};}function handleError(_0x2a0c82,_0x3fa83e){_0x3fa83e=_0x3fa83e||0x1f4;return function(_0x3ad1d7){logger[_0x4d40('0x29')](_0x3ad1d7[_0x4d40('0x2a')]);if(_0x3ad1d7[_0x4d40('0x2b')]){delete _0x3ad1d7[_0x4d40('0x2b')];}_0x2a0c82[_0x4d40('0x1c')](_0x3fa83e)[_0x4d40('0x2c')](_0x3ad1d7);};}exports[_0x4d40('0x2d')]=function(_0x4ca431,_0x4e4e61){var _0x52f706={},_0x158a86={},_0x350488={'count':0x0,'rows':[]};var _0x1ac240=_[_0x4d40('0x2e')](db['FreshdeskAccount'][_0x4d40('0x2f')],function(_0x1c8a1b){return{'name':_0x1c8a1b[_0x4d40('0x30')],'type':_0x1c8a1b['type'][_0x4d40('0x31')]};});_0x158a86[_0x4d40('0x32')]=_[_0x4d40('0x2e')](_0x1ac240,_0x4d40('0x2b'));_0x158a86[_0x4d40('0x33')]=_['keys'](_0x4ca431[_0x4d40('0x33')]);_0x158a86['filters']=_[_0x4d40('0x34')](_0x158a86[_0x4d40('0x32')],_0x158a86[_0x4d40('0x33')]);_0x52f706[_0x4d40('0x35')]=_['intersection'](_0x158a86['model'],qs[_0x4d40('0x36')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x36')]));_0x52f706[_0x4d40('0x35')]=_0x52f706['attributes'][_0x4d40('0x37')]?_0x52f706['attributes']:_0x158a86[_0x4d40('0x32')];if(!_0x4ca431[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x52f706[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0x4ca431[_0x4d40('0x33')][_0x4d40('0x21')]);_0x52f706[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0x4ca431['query'][_0x4d40('0x1f')]);}_0x52f706[_0x4d40('0x3a')]=qs['sort'](_0x4ca431['query']['sort']);_0x52f706[_0x4d40('0x3b')]=qs[_0x4d40('0x3c')](_['pick'](_0x4ca431[_0x4d40('0x33')],_0x158a86[_0x4d40('0x3c')]),_0x1ac240);if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x52f706[_0x4d40('0x3b')]=_['merge'](_0x52f706[_0x4d40('0x3b')],{'$or':_[_0x4d40('0x2e')](_0x1ac240,function(_0x4a84fa){if(_0x4a84fa['type']!==_0x4d40('0x3e')){var _0x11ed1a={};_0x11ed1a[_0x4a84fa['name']]={'$like':'%'+_0x4ca431[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x11ed1a;}})});}_0x52f706=_['merge']({},_0x52f706,_0x4ca431[_0x4d40('0x3f')]);var _0x1a9586={'where':_0x52f706['where']};return db[_0x4d40('0x40')][_0x4d40('0x22')](_0x1a9586)['then'](function(_0x2b5db0){_0x350488['count']=_0x2b5db0;if(_0x4ca431[_0x4d40('0x33')][_0x4d40('0x41')]){_0x52f706[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x40')][_0x4d40('0x43')](_0x52f706);})[_0x4d40('0x28')](function(_0x91f44d){_0x350488[_0x4d40('0x44')]=_0x91f44d;return _0x350488;})[_0x4d40('0x28')](respondWithFilteredResult(_0x4e4e61,_0x52f706))['catch'](handleError(_0x4e4e61,null));};exports[_0x4d40('0x45')]=function(_0x3718a8,_0x1c2fa8){var _0xcdde22={'raw':![],'where':{'id':_0x3718a8['params']['id']}},_0x22861a={};_0x22861a[_0x4d40('0x32')]=_['keys'](db[_0x4d40('0x40')][_0x4d40('0x2f')]);_0x22861a[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0x3718a8['query']);_0x22861a[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x22861a['model'],_0x22861a[_0x4d40('0x33')]);_0xcdde22['attributes']=_[_0x4d40('0x34')](_0x22861a[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0x3718a8[_0x4d40('0x33')]['fields']));_0xcdde22[_0x4d40('0x35')]=_0xcdde22['attributes'][_0x4d40('0x37')]?_0xcdde22[_0x4d40('0x35')]:_0x22861a[_0x4d40('0x32')];if(_0x3718a8[_0x4d40('0x33')]['includeAll']){_0xcdde22[_0x4d40('0x42')]=[{'all':!![]}];}_0xcdde22=_[_0x4d40('0x47')]({},_0xcdde22,_0x3718a8[_0x4d40('0x3f')]);return db[_0x4d40('0x40')]['find'](_0xcdde22)[_0x4d40('0x28')](handleEntityNotFound(_0x1c2fa8,null))[_0x4d40('0x28')](respondWithResult(_0x1c2fa8,null))['catch'](handleError(_0x1c2fa8,null));};exports[_0x4d40('0x48')]=function(_0x493d8e,_0x3d4283){return db[_0x4d40('0x40')][_0x4d40('0x48')](_0x493d8e[_0x4d40('0x49')],{})[_0x4d40('0x28')](respondWithResult(_0x3d4283,0xc9))[_0x4d40('0x4a')](handleError(_0x3d4283,null));};exports[_0x4d40('0x26')]=function(_0x37b6bf,_0x1cb8e7){if(_0x37b6bf['body']['id']){delete _0x37b6bf[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x37b6bf[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x1cb8e7,null))['then'](saveUpdates(_0x37b6bf[_0x4d40('0x49')],null))[_0x4d40('0x28')](respondWithResult(_0x1cb8e7,null))['catch'](handleError(_0x1cb8e7,null));};exports[_0x4d40('0x27')]=function(_0x48ffd7,_0x282945){return db[_0x4d40('0x40')][_0x4d40('0x4b')]({'where':{'id':_0x48ffd7['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x282945,null))[_0x4d40('0x28')](removeEntity(_0x282945,null))[_0x4d40('0x4a')](handleError(_0x282945,null));};exports[_0x4d40('0x4d')]=function(_0xd3e7cd,_0x52861d,_0x3191a2){var _0x14c6f8={};var _0x5aef99={};var _0x1000f4;var _0x584552;return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0xd3e7cd[_0x4d40('0x4c')]['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x52861d,null))['then'](function(_0xf62fef){if(_0xf62fef){_0x1000f4=_0xf62fef;_0x5aef99[_0x4d40('0x32')]=_[_0x4d40('0x46')](db[_0x4d40('0x4e')][_0x4d40('0x2f')]);_0x5aef99[_0x4d40('0x33')]=_[_0x4d40('0x46')](_0xd3e7cd[_0x4d40('0x33')]);_0x5aef99[_0x4d40('0x3c')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],_0x5aef99[_0x4d40('0x33')]);_0x14c6f8[_0x4d40('0x35')]=_[_0x4d40('0x34')](_0x5aef99[_0x4d40('0x32')],qs[_0x4d40('0x36')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x36')]));_0x14c6f8[_0x4d40('0x35')]=_0x14c6f8['attributes'][_0x4d40('0x37')]?_0x14c6f8[_0x4d40('0x35')]:_0x5aef99['model'];_0x14c6f8['order']=qs[_0x4d40('0x4f')](_0xd3e7cd[_0x4d40('0x33')]['sort']);_0x14c6f8['where']=qs[_0x4d40('0x3c')](_['pick'](_0xd3e7cd[_0x4d40('0x33')],_0x5aef99['filters']));if(_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]){_0x14c6f8[_0x4d40('0x3b')]=_[_0x4d40('0x47')](_0x14c6f8[_0x4d40('0x3b')],{'$or':_['map'](_0x14c6f8['attributes'],function(_0x4e5b26){var _0x259f9d={};_0x259f9d[_0x4e5b26]={'$like':'%'+_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x3d')]+'%'};return _0x259f9d;})});}_0x14c6f8=_[_0x4d40('0x47')]({},_0x14c6f8,_0xd3e7cd[_0x4d40('0x3f')]);return _0x1000f4['getConfigurations'](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x5b6a54){if(_0x5b6a54){_0x584552=_0x5b6a54[_0x4d40('0x37')];if(!_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x14c6f8[_0x4d40('0x21')]=qs[_0x4d40('0x21')](_0xd3e7cd['query']['limit']);_0x14c6f8[_0x4d40('0x1f')]=qs[_0x4d40('0x1f')](_0xd3e7cd[_0x4d40('0x33')][_0x4d40('0x1f')]);}return _0x1000f4[_0x4d40('0x4d')](_0x14c6f8);}})[_0x4d40('0x28')](function(_0x132543){if(_0x132543){return _0x132543?{'count':_0x584552,'rows':_0x132543}:null;}})[_0x4d40('0x28')](respondWithResult(_0x52861d,null))['catch'](handleError(_0x52861d,null));};exports[_0x4d40('0x50')]=function(_0x50917a,_0x5aa05b,_0x512a11){if(_0x50917a[_0x4d40('0x49')]['id']){delete _0x50917a[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x40')][_0x4d40('0x51')]({'where':{'id':_0x50917a['params']['id']}})[_0x4d40('0x28')](handleEntityNotFound(_0x5aa05b,null))[_0x4d40('0x28')](function(_0x1e1a6c){if(_0x1e1a6c){_0x50917a[_0x4d40('0x49')][_0x4d40('0x52')]=_0x1e1a6c['id'];_0x50917a['body']['Subjects']=integrations[_0x4d40('0x53')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')][_0x4d40('0x55')]);_0x50917a['body']['Descriptions']=integrations[_0x4d40('0x56')](_0x50917a['body'][_0x4d40('0x54')],_0x50917a[_0x4d40('0x49')]['type']);return db[_0x4d40('0x4e')][_0x4d40('0x48')](_0x50917a[_0x4d40('0x49')],{'include':[{'model':db[_0x4d40('0x57')],'as':_0x4d40('0x58')},{'model':db[_0x4d40('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5aa05b,null))['catch'](handleError(_0x5aa05b,null));};exports[_0x4d40('0x59')]=function(_0x358218,_0x37fd2b,_0x542d06){var _0xcf9e5b='';return db[_0x4d40('0x40')]['findOne']({'where':{'id':_0x358218['params']['id']},'attributes':['id',_0x4d40('0x5a'),_0x4d40('0x5b')]})['then'](handleEntityNotFound(_0x37fd2b,null))[_0x4d40('0x28')](function(_0x471863){if(_0x471863){_0xcf9e5b=_0x471863[_0x4d40('0x5a')];var _0x25258e=_0xcf9e5b[_0x4d40('0x5c')](-0x1);if(_0x25258e==='/'){_0xcf9e5b=_0xcf9e5b[_0x4d40('0x5d')](0x0,_0xcf9e5b['lastIndexOf'](_0x25258e));}return rp({'method':_0x4d40('0x5e'),'uri':util['format'](_0x4d40('0x5f'),_0xcf9e5b,_0x4d40('0x60')),'headers':{'Authorization':util['format'](_0x4d40('0x61'),new Buffer(util[_0x4d40('0x62')]('%s:X',_0x471863[_0x4d40('0x5b')]))[_0x4d40('0x63')]('base64'))},'json':!![]});}})[_0x4d40('0x28')](function(_0xe7e67c){if(_0xe7e67c){var _0x325128=[_0x4d40('0x64'),_0x4d40('0x65'),'agent',_0x4d40('0x66'),_0x4d40('0x1c'),_0x4d40('0x67'),_0x4d40('0x68'),_0x4d40('0x69'),_0x4d40('0x6a'),'group',_0x4d40('0x6b')];_['remove'](_0xe7e67c,function(_0x2856c4){return _0x325128[_0x4d40('0x6c')](_0x2856c4[_0x4d40('0x2b')])||!_0x2856c4[_0x4d40('0x6d')]&&_0x2856c4[_0x4d40('0x55')]!=='custom_text'&&_0x2856c4[_0x4d40('0x55')]!==_0x4d40('0x6e');});return{'count':_0xe7e67c[_0x4d40('0x37')],'rows':_[_0x4d40('0x2e')](_0xe7e67c,function(_0x54a3e7){return{'id':_0x54a3e7[_0x4d40('0x2b')],'name':_0x54a3e7[_0x4d40('0x6f')],'custom':!_0x54a3e7[_0x4d40('0x6d')],'options':_0x54a3e7[_0x4d40('0x70')]?_['map'](_0x54a3e7[_0x4d40('0x70')],function(_0x4e6d11){return{'name':_[_0x4d40('0x71')](_0x4e6d11),'value':_0x4e6d11};}):[]};})};}})[_0x4d40('0x28')](respondWithResult(_0x37fd2b,null))[_0x4d40('0x4a')](function(_0x1b3f7f){var _0x5cfa9c=_0x358218['query'][_0x4d40('0x72')]?0x1f4:_0x1b3f7f[_0x4d40('0x73')]||0x1f4;logger['error'](_0x4d40('0x74'),_0x4d40('0x59'),_0x5cfa9c,JSON[_0x4d40('0x75')](_0x1b3f7f));delete _0x1b3f7f[_0x4d40('0x2b')];if(_0x5cfa9c===0x191){_0x5cfa9c=0x190;}_0x37fd2b[_0x4d40('0x1c')](_0x5cfa9c)['send'](_0x358218[_0x4d40('0x33')][_0x4d40('0x72')]?{'message':_0x4d40('0x76'),'statusCode':_0x1b3f7f[_0x4d40('0x73')]}:_0x1b3f7f);});}; \ No newline at end of file +var _0x4b8a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','getFields','remoteUri','slice','lastIndexOf','%s/%s','api/v2/ticket_fields','format','%s:X','apiKey','toString','base64','subject','agent','group','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4b8a[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa4b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4b8('0x1'));var rp=require(_0xa4b8('0x2'));var moment=require(_0xa4b8('0x3'));var BPromise=require(_0xa4b8('0x4'));var Mustache=require(_0xa4b8('0x5'));var util=require(_0xa4b8('0x6'));var path=require(_0xa4b8('0x7'));var sox=require(_0xa4b8('0x8'));var csv=require(_0xa4b8('0x9'));var ejs=require(_0xa4b8('0xa'));var fs=require('fs');var fs_extra=require(_0xa4b8('0xb'));var _=require(_0xa4b8('0xc'));var squel=require(_0xa4b8('0xd'));var crypto=require(_0xa4b8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa4b8('0xf'));var toCsv=require(_0xa4b8('0x9'));var querystring=require(_0xa4b8('0x10'));var Papa=require(_0xa4b8('0x11'));var Redis=require(_0xa4b8('0x12'));var authService=require(_0xa4b8('0x13'));var qs=require(_0xa4b8('0x14'));var as=require(_0xa4b8('0x15'));var hardwareService=require(_0xa4b8('0x16'));var logger=require(_0xa4b8('0x17'))(_0xa4b8('0x18'));var utils=require(_0xa4b8('0x19'));var config=require(_0xa4b8('0x1a'));var licenseUtil=require(_0xa4b8('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x83aa39,_0x488b99){_0x488b99=_0x488b99||0xcc;return function(_0x1da512){if(_0x1da512){return _0x83aa39[_0xa4b8('0x1c')](_0x488b99);}return _0x83aa39['status'](_0x488b99)[_0xa4b8('0x1d')]();};}function respondWithResult(_0x157d7f,_0x1c8369){_0x1c8369=_0x1c8369||0xc8;return function(_0x17c3be){if(_0x17c3be){return _0x157d7f[_0xa4b8('0x1e')](_0x1c8369)[_0xa4b8('0x1f')](_0x17c3be);}};}function respondWithFilteredResult(_0x238cac,_0x443d7f){return function(_0x2fd884){if(_0x2fd884){var _0x48fda9=typeof _0x443d7f[_0xa4b8('0x20')]===_0xa4b8('0x21')&&typeof _0x443d7f['limit']===_0xa4b8('0x21');var _0x3dc7a4=_0x2fd884[_0xa4b8('0x22')];var _0x2b7f3a=_0x48fda9?0x0:_0x443d7f[_0xa4b8('0x20')];var _0x4c6341=_0x48fda9?_0x2fd884['count']:_0x443d7f['offset']+_0x443d7f['limit'];var _0x2678b2;if(_0x4c6341>=_0x3dc7a4){_0x4c6341=_0x3dc7a4;_0x2678b2=0xc8;}else{_0x2678b2=0xce;}_0x238cac[_0xa4b8('0x1e')](_0x2678b2);return _0x238cac[_0xa4b8('0x23')](_0xa4b8('0x24'),_0x2b7f3a+'-'+_0x4c6341+'/'+_0x3dc7a4)[_0xa4b8('0x1f')](_0x2fd884);}return null;};}function patchUpdates(_0x113812){return function(_0xf236d6){try{jsonpatch[_0xa4b8('0x25')](_0xf236d6,_0x113812,!![]);}catch(_0x3717ef){return BPromise[_0xa4b8('0x26')](_0x3717ef);}return _0xf236d6[_0xa4b8('0x27')]();};}function saveUpdates(_0x46c994,_0x144e62){return function(_0x3e218d){if(_0x3e218d){return _0x3e218d[_0xa4b8('0x28')](_0x46c994)[_0xa4b8('0x29')](function(_0x34f5d2){return _0x34f5d2;});}return null;};}function removeEntity(_0x4b28ae,_0x27530c){return function(_0x1f3c4b){if(_0x1f3c4b){return _0x1f3c4b['destroy']()[_0xa4b8('0x29')](function(){_0x4b28ae[_0xa4b8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b94d,_0x4cd363){return function(_0xc17660){if(!_0xc17660){_0x58b94d[_0xa4b8('0x1c')](0x194);}return _0xc17660;};}function handleError(_0x239b62,_0xa11b76){_0xa11b76=_0xa11b76||0x1f4;return function(_0x5242ec){logger[_0xa4b8('0x2a')](_0x5242ec[_0xa4b8('0x2b')]);if(_0x5242ec[_0xa4b8('0x2c')]){delete _0x5242ec[_0xa4b8('0x2c')];}_0x239b62['status'](_0xa11b76)[_0xa4b8('0x2d')](_0x5242ec);};}exports[_0xa4b8('0x2e')]=function(_0x3d5ed1,_0x39b754){var _0x33fa28={},_0x3a6652={},_0x3d60ff={'count':0x0,'rows':[]};var _0x2868bc=_[_0xa4b8('0x2f')](db[_0xa4b8('0x30')][_0xa4b8('0x31')],function(_0x127d1d){return{'name':_0x127d1d['fieldName'],'type':_0x127d1d[_0xa4b8('0x32')][_0xa4b8('0x33')]};});_0x3a6652[_0xa4b8('0x34')]=_['map'](_0x2868bc,_0xa4b8('0x2c'));_0x3a6652[_0xa4b8('0x35')]=_['keys'](_0x3d5ed1['query']);_0x3a6652['filters']=_['intersection'](_0x3a6652[_0xa4b8('0x34')],_0x3a6652['query']);_0x33fa28[_0xa4b8('0x36')]=_[_0xa4b8('0x37')](_0x3a6652[_0xa4b8('0x34')],qs['fields'](_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x38')]));_0x33fa28[_0xa4b8('0x36')]=_0x33fa28[_0xa4b8('0x36')][_0xa4b8('0x39')]?_0x33fa28['attributes']:_0x3a6652[_0xa4b8('0x34')];if(!_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x3a')](_0xa4b8('0x3b'))){_0x33fa28[_0xa4b8('0x3c')]=qs[_0xa4b8('0x3c')](_0x3d5ed1[_0xa4b8('0x35')]['limit']);_0x33fa28[_0xa4b8('0x20')]=qs[_0xa4b8('0x20')](_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x20')]);}_0x33fa28[_0xa4b8('0x3d')]=qs['sort'](_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x3e')]);_0x33fa28[_0xa4b8('0x3f')]=qs[_0xa4b8('0x40')](_['pick'](_0x3d5ed1['query'],_0x3a6652[_0xa4b8('0x40')]),_0x2868bc);if(_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x41')]){_0x33fa28[_0xa4b8('0x3f')]=_[_0xa4b8('0x42')](_0x33fa28[_0xa4b8('0x3f')],{'$or':_[_0xa4b8('0x2f')](_0x2868bc,function(_0xf656b5){if(_0xf656b5[_0xa4b8('0x32')]!==_0xa4b8('0x43')){var _0x1dc394={};_0x1dc394[_0xf656b5[_0xa4b8('0x2c')]]={'$like':'%'+_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x41')]+'%'};return _0x1dc394;}})});}_0x33fa28=_['merge']({},_0x33fa28,_0x3d5ed1[_0xa4b8('0x44')]);var _0x500f44={'where':_0x33fa28[_0xa4b8('0x3f')]};return db[_0xa4b8('0x30')]['count'](_0x500f44)['then'](function(_0x3d4f02){_0x3d60ff[_0xa4b8('0x22')]=_0x3d4f02;if(_0x3d5ed1[_0xa4b8('0x35')][_0xa4b8('0x45')]){_0x33fa28[_0xa4b8('0x46')]=[{'all':!![]}];}return db[_0xa4b8('0x30')]['findAll'](_0x33fa28);})[_0xa4b8('0x29')](function(_0x398ca7){_0x3d60ff[_0xa4b8('0x47')]=_0x398ca7;return _0x3d60ff;})['then'](respondWithFilteredResult(_0x39b754,_0x33fa28))[_0xa4b8('0x48')](handleError(_0x39b754,null));};exports[_0xa4b8('0x49')]=function(_0xff9fc0,_0x13a27c){var _0x6c6438={'raw':![],'where':{'id':_0xff9fc0[_0xa4b8('0x4a')]['id']}},_0x2554f8={};_0x2554f8[_0xa4b8('0x34')]=_[_0xa4b8('0x4b')](db['FreshdeskAccount'][_0xa4b8('0x31')]);_0x2554f8[_0xa4b8('0x35')]=_[_0xa4b8('0x4b')](_0xff9fc0[_0xa4b8('0x35')]);_0x2554f8[_0xa4b8('0x40')]=_[_0xa4b8('0x37')](_0x2554f8[_0xa4b8('0x34')],_0x2554f8['query']);_0x6c6438[_0xa4b8('0x36')]=_['intersection'](_0x2554f8[_0xa4b8('0x34')],qs[_0xa4b8('0x38')](_0xff9fc0['query'][_0xa4b8('0x38')]));_0x6c6438['attributes']=_0x6c6438[_0xa4b8('0x36')][_0xa4b8('0x39')]?_0x6c6438[_0xa4b8('0x36')]:_0x2554f8[_0xa4b8('0x34')];if(_0xff9fc0[_0xa4b8('0x35')][_0xa4b8('0x45')]){_0x6c6438[_0xa4b8('0x46')]=[{'all':!![]}];}_0x6c6438=_[_0xa4b8('0x42')]({},_0x6c6438,_0xff9fc0[_0xa4b8('0x44')]);return db['FreshdeskAccount'][_0xa4b8('0x4c')](_0x6c6438)['then'](handleEntityNotFound(_0x13a27c,null))[_0xa4b8('0x29')](respondWithResult(_0x13a27c,null))[_0xa4b8('0x48')](handleError(_0x13a27c,null));};exports[_0xa4b8('0x4d')]=function(_0x551638,_0x545e06){return db[_0xa4b8('0x30')][_0xa4b8('0x4d')](_0x551638['body'],{})[_0xa4b8('0x29')](respondWithResult(_0x545e06,0xc9))['catch'](handleError(_0x545e06,null));};exports[_0xa4b8('0x28')]=function(_0x6b9b99,_0x46764d){if(_0x6b9b99['body']['id']){delete _0x6b9b99[_0xa4b8('0x4e')]['id'];}return db[_0xa4b8('0x30')][_0xa4b8('0x4c')]({'where':{'id':_0x6b9b99['params']['id']}})['then'](handleEntityNotFound(_0x46764d,null))[_0xa4b8('0x29')](saveUpdates(_0x6b9b99[_0xa4b8('0x4e')],null))[_0xa4b8('0x29')](respondWithResult(_0x46764d,null))[_0xa4b8('0x48')](handleError(_0x46764d,null));};exports[_0xa4b8('0x4f')]=function(_0x510175,_0x4155cb){return db['FreshdeskAccount'][_0xa4b8('0x4c')]({'where':{'id':_0x510175[_0xa4b8('0x4a')]['id']}})[_0xa4b8('0x29')](handleEntityNotFound(_0x4155cb,null))['then'](removeEntity(_0x4155cb,null))[_0xa4b8('0x48')](handleError(_0x4155cb,null));};exports[_0xa4b8('0x50')]=function(_0x3edebc,_0x46ba07,_0x2d6c21){var _0x1e65ac={};var _0x16e702={};var _0x3ad9f5;var _0x3c2c6b;return db[_0xa4b8('0x30')][_0xa4b8('0x51')]({'where':{'id':_0x3edebc['params']['id']}})[_0xa4b8('0x29')](handleEntityNotFound(_0x46ba07,null))[_0xa4b8('0x29')](function(_0x40231d){if(_0x40231d){_0x3ad9f5=_0x40231d;_0x16e702[_0xa4b8('0x34')]=_[_0xa4b8('0x4b')](db[_0xa4b8('0x52')][_0xa4b8('0x31')]);_0x16e702['query']=_['keys'](_0x3edebc[_0xa4b8('0x35')]);_0x16e702[_0xa4b8('0x40')]=_['intersection'](_0x16e702['model'],_0x16e702['query']);_0x1e65ac['attributes']=_['intersection'](_0x16e702[_0xa4b8('0x34')],qs[_0xa4b8('0x38')](_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x38')]));_0x1e65ac[_0xa4b8('0x36')]=_0x1e65ac[_0xa4b8('0x36')]['length']?_0x1e65ac['attributes']:_0x16e702['model'];_0x1e65ac['order']=qs[_0xa4b8('0x3e')](_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x3e')]);_0x1e65ac['where']=qs[_0xa4b8('0x40')](_['pick'](_0x3edebc[_0xa4b8('0x35')],_0x16e702['filters']));if(_0x3edebc['query']['filter']){_0x1e65ac[_0xa4b8('0x3f')]=_['merge'](_0x1e65ac[_0xa4b8('0x3f')],{'$or':_[_0xa4b8('0x2f')](_0x1e65ac[_0xa4b8('0x36')],function(_0x4fb182){var _0x1ed77e={};_0x1ed77e[_0x4fb182]={'$like':'%'+_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x41')]+'%'};return _0x1ed77e;})});}_0x1e65ac=_[_0xa4b8('0x42')]({},_0x1e65ac,_0x3edebc[_0xa4b8('0x44')]);return _0x3ad9f5[_0xa4b8('0x50')](_0x1e65ac);}})[_0xa4b8('0x29')](function(_0x15e85a){if(_0x15e85a){_0x3c2c6b=_0x15e85a[_0xa4b8('0x39')];if(!_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x3a')](_0xa4b8('0x3b'))){_0x1e65ac[_0xa4b8('0x3c')]=qs[_0xa4b8('0x3c')](_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x3c')]);_0x1e65ac[_0xa4b8('0x20')]=qs[_0xa4b8('0x20')](_0x3edebc[_0xa4b8('0x35')][_0xa4b8('0x20')]);}return _0x3ad9f5[_0xa4b8('0x50')](_0x1e65ac);}})[_0xa4b8('0x29')](function(_0x271878){if(_0x271878){return _0x271878?{'count':_0x3c2c6b,'rows':_0x271878}:null;}})['then'](respondWithResult(_0x46ba07,null))[_0xa4b8('0x48')](handleError(_0x46ba07,null));};exports[_0xa4b8('0x53')]=function(_0x4f9015,_0x34b37b,_0x1123be){if(_0x4f9015['body']['id']){delete _0x4f9015[_0xa4b8('0x4e')]['id'];}return db[_0xa4b8('0x30')][_0xa4b8('0x51')]({'where':{'id':_0x4f9015[_0xa4b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x34b37b,null))[_0xa4b8('0x29')](function(_0x4ba35c){if(_0x4ba35c){_0x4f9015['body']['AccountId']=_0x4ba35c['id'];_0x4f9015['body'][_0xa4b8('0x54')]=integrations[_0xa4b8('0x55')](_0x4f9015[_0xa4b8('0x4e')][_0xa4b8('0x56')],_0x4f9015[_0xa4b8('0x4e')][_0xa4b8('0x32')]);_0x4f9015[_0xa4b8('0x4e')]['Descriptions']=integrations[_0xa4b8('0x57')](_0x4f9015[_0xa4b8('0x4e')][_0xa4b8('0x56')],_0x4f9015[_0xa4b8('0x4e')][_0xa4b8('0x32')]);return db['FreshdeskConfiguration'][_0xa4b8('0x4d')](_0x4f9015[_0xa4b8('0x4e')],{'include':[{'model':db[_0xa4b8('0x58')],'as':_0xa4b8('0x54')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xa4b8('0x29')](respondWithResult(_0x34b37b,null))[_0xa4b8('0x48')](handleError(_0x34b37b,null));};exports[_0xa4b8('0x59')]=function(_0x1f46d4,_0x5a70b5,_0x9aaa96){var _0x3b68da='';return db[_0xa4b8('0x30')][_0xa4b8('0x51')]({'where':{'id':_0x1f46d4['params']['id']},'attributes':['id',_0xa4b8('0x5a'),'apiKey']})[_0xa4b8('0x29')](handleEntityNotFound(_0x5a70b5,null))[_0xa4b8('0x29')](function(_0x4ab776){if(_0x4ab776){_0x3b68da=_0x4ab776[_0xa4b8('0x5a')];var _0x18f7bb=_0x3b68da[_0xa4b8('0x5b')](-0x1);if(_0x18f7bb==='/'){_0x3b68da=_0x3b68da['substring'](0x0,_0x3b68da[_0xa4b8('0x5c')](_0x18f7bb));}return rp({'method':'GET','uri':util['format'](_0xa4b8('0x5d'),_0x3b68da,_0xa4b8('0x5e')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xa4b8('0x5f')](_0xa4b8('0x60'),_0x4ab776[_0xa4b8('0x61')]))[_0xa4b8('0x62')](_0xa4b8('0x63')))},'json':!![]});}})[_0xa4b8('0x29')](function(_0x44b136){if(_0x44b136){var _0x372cc6=['requester',_0xa4b8('0x64'),_0xa4b8('0x65'),'description',_0xa4b8('0x1e'),'priority',_0xa4b8('0x66'),'source',_0xa4b8('0x67'),_0xa4b8('0x66'),_0xa4b8('0x68')];_['remove'](_0x44b136,function(_0x38b87e){return _0x372cc6[_0xa4b8('0x69')](_0x38b87e[_0xa4b8('0x2c')])||!_0x38b87e[_0xa4b8('0x6a')]&&_0x38b87e[_0xa4b8('0x32')]!=='custom_text'&&_0x38b87e[_0xa4b8('0x32')]!==_0xa4b8('0x6b');});return{'count':_0x44b136[_0xa4b8('0x39')],'rows':_[_0xa4b8('0x2f')](_0x44b136,function(_0x321dc9){return{'id':_0x321dc9[_0xa4b8('0x2c')],'name':_0x321dc9[_0xa4b8('0x6c')],'custom':!_0x321dc9['default'],'options':_0x321dc9[_0xa4b8('0x6d')]?_['map'](_0x321dc9[_0xa4b8('0x6d')],function(_0x504e07){return{'name':_[_0xa4b8('0x6e')](_0x504e07),'value':_0x504e07};}):[]};})};}})[_0xa4b8('0x29')](respondWithResult(_0x5a70b5,null))['catch'](function(_0x2098c6){var _0x2c0e2d=_0x1f46d4[_0xa4b8('0x35')][_0xa4b8('0x6f')]?0x1f4:_0x2098c6[_0xa4b8('0x70')]||0x1f4;logger[_0xa4b8('0x2a')](_0xa4b8('0x71'),_0xa4b8('0x59'),_0x2c0e2d,JSON[_0xa4b8('0x72')](_0x2098c6));delete _0x2098c6[_0xa4b8('0x2c')];if(_0x2c0e2d===0x191){_0x2c0e2d=0x190;}_0x5a70b5[_0xa4b8('0x1e')](_0x2c0e2d)[_0xa4b8('0x2d')](_0x1f46d4[_0xa4b8('0x35')]['test']?{'message':_0xa4b8('0x73'),'statusCode':_0x2098c6[_0xa4b8('0x70')]}:_0x2098c6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index eb91697..70e32f9 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbed1=['lodash','util','api','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0xbed1,0x104));var _0x1bed=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xbed1[_0x256d6a];return _0x460058;};'use strict';var _=require(_0x1bed('0x0'));var util=require(_0x1bed('0x1'));var logger=require('../../config/logger')(_0x1bed('0x2'));var moment=require(_0x1bed('0x3'));var BPromise=require('bluebird');var rp=require(_0x1bed('0x4'));var fs=require('fs');var path=require(_0x1bed('0x5'));var rimraf=require('rimraf');var config=require(_0x1bed('0x6'));var attributes=require(_0x1bed('0x7'));var integrations=require(_0x1bed('0x8'));module[_0x1bed('0x9')]=function(_0x2364a4,_0x3f1674){return _0x2364a4[_0x1bed('0xa')](_0x1bed('0xb'),attributes,{'tableName':_0x1bed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b5b=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4cad90,_0x21070d){var _0x3cf2d4=function(_0xb7f5f8){while(--_0xb7f5f8){_0x4cad90['push'](_0x4cad90['shift']());}};_0x3cf2d4(++_0x21070d);}(_0x0b5b,0x18c));var _0xb0b5=function(_0xa9ce78,_0x3a8867){_0xa9ce78=_0xa9ce78-0x0;var _0x24f747=_0x0b5b[_0xa9ce78];return _0x24f747;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb0b5('0x0'))(_0xb0b5('0x1'));var moment=require(_0xb0b5('0x2'));var BPromise=require(_0xb0b5('0x3'));var rp=require(_0xb0b5('0x4'));var fs=require('fs');var path=require(_0xb0b5('0x5'));var rimraf=require('rimraf');var config=require(_0xb0b5('0x6'));var attributes=require(_0xb0b5('0x7'));var integrations=require(_0xb0b5('0x8'));module[_0xb0b5('0x9')]=function(_0x257d01,_0x4e14e6){return _0x257d01[_0xb0b5('0xa')](_0xb0b5('0xb'),attributes,{'tableName':_0xb0b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5367277..b032ab9 100644 --- a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js +++ b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x596e=['find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','include','model','map','ShowFreshdeskAccount'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x596e,0xb1));var _0xe596=function(_0x3a773d,_0x2b9205){_0x3a773d=_0x3a773d-0x0;var _0x5024f2=_0x596e[_0x3a773d];return _0x5024f2;};'use strict';var _=require(_0xe596('0x0'));var util=require(_0xe596('0x1'));var moment=require(_0xe596('0x2'));var BPromise=require(_0xe596('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe596('0x4'));var db=require(_0xe596('0x5'))['db'];var utils=require(_0xe596('0x6'));var logger=require(_0xe596('0x7'))('rpc');var config=require(_0xe596('0x8'));var jayson=require(_0xe596('0x9'));var client=jayson['client'][_0xe596('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f3d5c,_0x2ec0cb,_0x4d1b6a){return new BPromise(function(_0x43513c,_0x4806c2){return client[_0xe596('0xb')](_0x3f3d5c,_0x4d1b6a)[_0xe596('0xc')](function(_0x14d674){logger['info'](_0xe596('0xd'),_0x2ec0cb,_0xe596('0xe'));logger[_0xe596('0xf')](_0xe596('0x10'),_0x2ec0cb,_0xe596('0xe'),JSON[_0xe596('0x11')](_0x14d674));if(_0x14d674[_0xe596('0x12')]){if(_0x14d674[_0xe596('0x12')]['code']===0x1f4){logger[_0xe596('0x12')](_0xe596('0xd'),_0x2ec0cb,_0x14d674['error'][_0xe596('0x13')]);return _0x4806c2(_0x14d674[_0xe596('0x12')][_0xe596('0x13')]);}logger[_0xe596('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ec0cb,_0x14d674['error']['message']);return _0x43513c(_0x14d674[_0xe596('0x12')]['message']);}else{logger[_0xe596('0x14')](_0xe596('0xd'),_0x2ec0cb,_0xe596('0xe'));_0x43513c(_0x14d674[_0xe596('0x15')]['message']);}})[_0xe596('0x16')](function(_0x43075c){logger[_0xe596('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x2ec0cb,_0x43075c);_0x4806c2(_0x43075c);});});}exports[_0xe596('0x17')]=function(_0x11fed0){var _0x1e2aa6=this;return new Promise(function(_0x3efc55,_0x28c4a0){return db[_0xe596('0x18')][_0xe596('0x19')]({'raw':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1b')]===undefined?!![]:![]:!![],'where':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')]['where']||null:null,'attributes':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1c')]||null:null,'limit':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')]['limit']||null:null,'include':_0x11fed0[_0xe596('0x1a')]?_0x11fed0[_0xe596('0x1a')][_0xe596('0x1d')]?_['map'](_0x11fed0['options']['include'],function(_0xa3b10f){return{'model':db[_0xa3b10f[_0xe596('0x1e')]],'as':_0xa3b10f['as'],'attributes':_0xa3b10f['attributes'],'include':_0xa3b10f[_0xe596('0x1d')]?_[_0xe596('0x1f')](_0xa3b10f['include'],function(_0x341b79){return{'model':db[_0x341b79[_0xe596('0x1e')]],'as':_0x341b79['as'],'attributes':_0x341b79[_0xe596('0x1c')],'include':_0x341b79['include']?_[_0xe596('0x1f')](_0x341b79[_0xe596('0x1d')],function(_0x21d9e2){return{'model':db[_0x21d9e2[_0xe596('0x1e')]],'as':_0x21d9e2['as'],'attributes':_0x21d9e2[_0xe596('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe596('0xc')](function(_0x5ad5d7){logger[_0xe596('0x14')]('GetFreshdeskAccount',_0x11fed0);logger[_0xe596('0xf')]('GetFreshdeskAccount',_0x11fed0,JSON['stringify'](_0x5ad5d7));_0x3efc55(_0x5ad5d7);})[_0xe596('0x16')](function(_0x331c14){logger[_0xe596('0x12')](_0xe596('0x17'),_0x331c14[_0xe596('0x13')],_0x11fed0);_0x28c4a0(_0x1e2aa6[_0xe596('0x12')](0x1f4,_0x331c14[_0xe596('0x13')]));});});};exports[_0xe596('0x20')]=function(_0x5768ed){var _0x398c9f=this;return new Promise(function(_0x3b6d20,_0xed29a9){return db[_0xe596('0x18')][_0xe596('0x21')]({'raw':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')][_0xe596('0x1b')]===undefined?!![]:![]:!![],'where':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')][_0xe596('0x22')]||null:null,'attributes':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')]['attributes']||null:null,'include':_0x5768ed[_0xe596('0x1a')]?_0x5768ed[_0xe596('0x1a')]['include']?_[_0xe596('0x1f')](_0x5768ed['options'][_0xe596('0x1d')],function(_0x24ea88){return{'model':db[_0x24ea88[_0xe596('0x1e')]],'as':_0x24ea88['as'],'attributes':_0x24ea88[_0xe596('0x1c')],'include':_0x24ea88[_0xe596('0x1d')]?_[_0xe596('0x1f')](_0x24ea88[_0xe596('0x1d')],function(_0x263015){return{'model':db[_0x263015[_0xe596('0x1e')]],'as':_0x263015['as'],'attributes':_0x263015[_0xe596('0x1c')],'include':_0x263015['include']?_[_0xe596('0x1f')](_0x263015[_0xe596('0x1d')],function(_0x25b64d){return{'model':db[_0x25b64d[_0xe596('0x1e')]],'as':_0x25b64d['as'],'attributes':_0x25b64d[_0xe596('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe596('0xc')](function(_0x393ce2){logger[_0xe596('0x14')]('ShowFreshdeskAccount',_0x5768ed);logger[_0xe596('0xf')](_0xe596('0x20'),_0x5768ed,JSON[_0xe596('0x11')](_0x393ce2));_0x3b6d20(_0x393ce2);})[_0xe596('0x16')](function(_0x2687fc){logger[_0xe596('0x12')](_0xe596('0x20'),_0x2687fc[_0xe596('0x13')],_0x5768ed);_0xed29a9(_0x398c9f[_0xe596('0x12')](0x1f4,_0x2687fc['message']));});});}; \ No newline at end of file +var _0x2da2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','include','map','attributes','model','stringify','ShowFreshdeskAccount'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x2da2,0x108));var _0x22da=function(_0x3cc896,_0x43d65d){_0x3cc896=_0x3cc896-0x0;var _0x6efa52=_0x2da2[_0x3cc896];return _0x6efa52;};'use strict';var _=require('lodash');var util=require(_0x22da('0x0'));var moment=require(_0x22da('0x1'));var BPromise=require(_0x22da('0x2'));var rs=require(_0x22da('0x3'));var fs=require('fs');var Redis=require(_0x22da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22da('0x5'));var logger=require(_0x22da('0x6'))(_0x22da('0x7'));var config=require(_0x22da('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x22da('0x9')][_0x22da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5715b0,_0x5688ae,_0x164c13){return new BPromise(function(_0x575a6f,_0x3e2522){return client[_0x22da('0xb')](_0x5715b0,_0x164c13)[_0x22da('0xc')](function(_0x1391ac){logger[_0x22da('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x5688ae,_0x22da('0xe'));logger[_0x22da('0xf')](_0x22da('0x10'),_0x5688ae,'request\x20sent',JSON['stringify'](_0x1391ac));if(_0x1391ac[_0x22da('0x11')]){if(_0x1391ac[_0x22da('0x11')][_0x22da('0x12')]===0x1f4){logger[_0x22da('0x11')](_0x22da('0x13'),_0x5688ae,_0x1391ac[_0x22da('0x11')][_0x22da('0x14')]);return _0x3e2522(_0x1391ac[_0x22da('0x11')][_0x22da('0x14')]);}logger[_0x22da('0x11')](_0x22da('0x13'),_0x5688ae,_0x1391ac[_0x22da('0x11')][_0x22da('0x14')]);return _0x575a6f(_0x1391ac[_0x22da('0x11')][_0x22da('0x14')]);}else{logger[_0x22da('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x5688ae,_0x22da('0xe'));_0x575a6f(_0x1391ac['result']['message']);}})[_0x22da('0x15')](function(_0x4de639){logger[_0x22da('0x11')](_0x22da('0x13'),_0x5688ae,_0x4de639);_0x3e2522(_0x4de639);});});}exports[_0x22da('0x16')]=function(_0x14259c){var _0x4de055=this;return new Promise(function(_0x3f444,_0x18c855){return db[_0x22da('0x17')][_0x22da('0x18')]({'raw':_0x14259c[_0x22da('0x19')]?_0x14259c[_0x22da('0x19')][_0x22da('0x1a')]===undefined?!![]:![]:!![],'where':_0x14259c[_0x22da('0x19')]?_0x14259c['options']['where']||null:null,'attributes':_0x14259c[_0x22da('0x19')]?_0x14259c[_0x22da('0x19')]['attributes']||null:null,'limit':_0x14259c[_0x22da('0x19')]?_0x14259c[_0x22da('0x19')]['limit']||null:null,'include':_0x14259c['options']?_0x14259c[_0x22da('0x19')][_0x22da('0x1b')]?_[_0x22da('0x1c')](_0x14259c[_0x22da('0x19')][_0x22da('0x1b')],function(_0x4d11cb){return{'model':db[_0x4d11cb['model']],'as':_0x4d11cb['as'],'attributes':_0x4d11cb[_0x22da('0x1d')],'include':_0x4d11cb[_0x22da('0x1b')]?_[_0x22da('0x1c')](_0x4d11cb['include'],function(_0x100402){return{'model':db[_0x100402[_0x22da('0x1e')]],'as':_0x100402['as'],'attributes':_0x100402['attributes'],'include':_0x100402['include']?_[_0x22da('0x1c')](_0x100402[_0x22da('0x1b')],function(_0xcc20aa){return{'model':db[_0xcc20aa[_0x22da('0x1e')]],'as':_0xcc20aa['as'],'attributes':_0xcc20aa[_0x22da('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x22da('0xc')](function(_0x3ae435){logger['info']('GetFreshdeskAccount',_0x14259c);logger[_0x22da('0xf')]('GetFreshdeskAccount',_0x14259c,JSON[_0x22da('0x1f')](_0x3ae435));_0x3f444(_0x3ae435);})[_0x22da('0x15')](function(_0x80d9bc){logger[_0x22da('0x11')](_0x22da('0x16'),_0x80d9bc[_0x22da('0x14')],_0x14259c);_0x18c855(_0x4de055[_0x22da('0x11')](0x1f4,_0x80d9bc[_0x22da('0x14')]));});});};exports[_0x22da('0x20')]=function(_0x2854e2){var _0x4be91c=this;return new Promise(function(_0x2831a9,_0xaafe3f){return db[_0x22da('0x17')]['find']({'raw':_0x2854e2[_0x22da('0x19')]?_0x2854e2[_0x22da('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2854e2[_0x22da('0x19')]?_0x2854e2[_0x22da('0x19')]['where']||null:null,'attributes':_0x2854e2[_0x22da('0x19')]?_0x2854e2[_0x22da('0x19')][_0x22da('0x1d')]||null:null,'include':_0x2854e2[_0x22da('0x19')]?_0x2854e2[_0x22da('0x19')]['include']?_['map'](_0x2854e2[_0x22da('0x19')][_0x22da('0x1b')],function(_0xed8866){return{'model':db[_0xed8866['model']],'as':_0xed8866['as'],'attributes':_0xed8866['attributes'],'include':_0xed8866['include']?_['map'](_0xed8866['include'],function(_0x4f55e6){return{'model':db[_0x4f55e6[_0x22da('0x1e')]],'as':_0x4f55e6['as'],'attributes':_0x4f55e6[_0x22da('0x1d')],'include':_0x4f55e6[_0x22da('0x1b')]?_[_0x22da('0x1c')](_0x4f55e6[_0x22da('0x1b')],function(_0x47c36c){return{'model':db[_0x47c36c[_0x22da('0x1e')]],'as':_0x47c36c['as'],'attributes':_0x47c36c[_0x22da('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x22da('0xc')](function(_0xf35698){logger['info'](_0x22da('0x20'),_0x2854e2);logger['debug'](_0x22da('0x20'),_0x2854e2,JSON['stringify'](_0xf35698));_0x2831a9(_0xf35698);})[_0x22da('0x15')](function(_0x39be8e){logger[_0x22da('0x11')](_0x22da('0x20'),_0x39be8e[_0x22da('0x14')],_0x2854e2);_0xaafe3f(_0x4be91c[_0x22da('0x11')](0x1f4,_0x39be8e[_0x22da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 182a1b4..5d383b0 100644 --- a/server/api/intFreshdeskConfiguration/index.js +++ b/server/api/intFreshdeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43a6=['./intFreshdeskConfiguration.controller','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','get','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x508bef,_0x389b48){var _0x4dddef=function(_0x314122){while(--_0x314122){_0x508bef['push'](_0x508bef['shift']());}};_0x4dddef(++_0x389b48);}(_0x43a6,0x1d3));var _0x643a=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x43a6[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x643a('0x0'));var util=require('util');var path=require(_0x643a('0x1'));var timeout=require(_0x643a('0x2'));var express=require(_0x643a('0x3'));var router=express[_0x643a('0x4')]();var fs_extra=require(_0x643a('0x5'));var auth=require(_0x643a('0x6'));var interaction=require(_0x643a('0x7'));var config=require(_0x643a('0x8'));var controller=require(_0x643a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x643a('0xa')]);router['get'](_0x643a('0xb'),auth[_0x643a('0xc')](),controller[_0x643a('0xd')]);router['get'](_0x643a('0xe'),auth['isAuthenticated'](),controller[_0x643a('0xf')]);router['get'](_0x643a('0x10'),auth[_0x643a('0xc')](),controller[_0x643a('0x11')]);router[_0x643a('0x12')]('/:id/descriptions',auth[_0x643a('0xc')](),controller[_0x643a('0x13')]);router[_0x643a('0x12')](_0x643a('0x14'),auth[_0x643a('0xc')](),controller[_0x643a('0x15')]);router[_0x643a('0x16')]('/',auth[_0x643a('0xc')](),controller[_0x643a('0x17')]);router[_0x643a('0x16')]('/:id/tags',auth[_0x643a('0xc')](),controller[_0x643a('0x18')]);router['put'](_0x643a('0xb'),auth[_0x643a('0xc')](),controller[_0x643a('0x19')]);router[_0x643a('0x1a')]('/:id',auth[_0x643a('0xc')](),controller['destroy']);module[_0x643a('0x1b')]=router; \ No newline at end of file +var _0xd07e=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','destroy'];(function(_0x5c4c99,_0x123b5e){var _0x6827f=function(_0x39ebb3){while(--_0x39ebb3){_0x5c4c99['push'](_0x5c4c99['shift']());}};_0x6827f(++_0x123b5e);}(_0xd07e,0xe1));var _0xed07=function(_0x42e4f7,_0x1a7bc0){_0x42e4f7=_0x42e4f7-0x0;var _0x5dd299=_0xd07e[_0x42e4f7];return _0x5dd299;};'use strict';var multer=require(_0xed07('0x0'));var util=require(_0xed07('0x1'));var path=require(_0xed07('0x2'));var timeout=require(_0xed07('0x3'));var express=require(_0xed07('0x4'));var router=express[_0xed07('0x5')]();var fs_extra=require(_0xed07('0x6'));var auth=require(_0xed07('0x7'));var interaction=require(_0xed07('0x8'));var config=require(_0xed07('0x9'));var controller=require(_0xed07('0xa'));router[_0xed07('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xed07('0xb')](_0xed07('0xc'),auth['isAuthenticated'](),controller[_0xed07('0xd')]);router[_0xed07('0xb')](_0xed07('0xe'),auth[_0xed07('0xf')](),controller[_0xed07('0x10')]);router[_0xed07('0xb')](_0xed07('0x11'),auth[_0xed07('0xf')](),controller['getSubjects']);router[_0xed07('0xb')](_0xed07('0x12'),auth[_0xed07('0xf')](),controller[_0xed07('0x13')]);router[_0xed07('0xb')](_0xed07('0x14'),auth[_0xed07('0xf')](),controller[_0xed07('0x15')]);router[_0xed07('0x16')]('/',auth['isAuthenticated'](),controller[_0xed07('0x17')]);router[_0xed07('0x16')](_0xed07('0x14'),auth[_0xed07('0xf')](),controller[_0xed07('0x18')]);router[_0xed07('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xed07('0xc'),auth[_0xed07('0xf')](),controller[_0xed07('0x1a')]);module[_0xed07('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a688135..09de001 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x653b=['STRING'];(function(_0x20148c,_0x5a1b8e){var _0xf0edb8=function(_0xbbfdad){while(--_0xbbfdad){_0x20148c['push'](_0x20148c['shift']());}};_0xf0edb8(++_0x5a1b8e);}(_0x653b,0x165));var _0xb653=function(_0x377f32,_0x2b032c){_0x377f32=_0x377f32-0x0;var _0x43a1b0=_0x653b[_0x377f32];return _0x43a1b0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb653('0x0')]},'description':{'type':Sequelize[_0xb653('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 88e8c36..47e6384 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba79=['sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshdeskField','merge','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','bluebird','util','path'];(function(_0x4e7bb4,_0x42572c){var _0x456e48=function(_0x1b7248){while(--_0x1b7248){_0x4e7bb4['push'](_0x4e7bb4['shift']());}};_0x456e48(++_0x42572c);}(_0xba79,0xea));var _0x9ba7=function(_0x53b22e,_0x5e248f){_0x53b22e=_0x53b22e-0x0;var _0x14a0a4=_0xba79[_0x53b22e];return _0x14a0a4;};'use strict';var emlformat=require(_0x9ba7('0x0'));var rimraf=require(_0x9ba7('0x1'));var zipdir=require(_0x9ba7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9ba7('0x3'));var Mustache=require('mustache');var util=require(_0x9ba7('0x4'));var path=require(_0x9ba7('0x5'));var sox=require(_0x9ba7('0x6'));var csv=require(_0x9ba7('0x7'));var ejs=require(_0x9ba7('0x8'));var fs=require('fs');var fs_extra=require(_0x9ba7('0x9'));var _=require(_0x9ba7('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ba7('0xb'));var toCsv=require(_0x9ba7('0x7'));var querystring=require(_0x9ba7('0xc'));var Papa=require(_0x9ba7('0xd'));var Redis=require(_0x9ba7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9ba7('0xf'));var as=require(_0x9ba7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ba7('0x11'))('api');var utils=require(_0x9ba7('0x12'));var config=require(_0x9ba7('0x13'));var licenseUtil=require(_0x9ba7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb35fe,_0x4824bb){_0x4824bb=_0x4824bb||0xcc;return function(_0x2a6cb9){if(_0x2a6cb9){return _0xcb35fe[_0x9ba7('0x15')](_0x4824bb);}return _0xcb35fe[_0x9ba7('0x16')](_0x4824bb)['end']();};}function respondWithResult(_0x17b3ef,_0x57d380){_0x57d380=_0x57d380||0xc8;return function(_0x5a51aa){if(_0x5a51aa){return _0x17b3ef['status'](_0x57d380)[_0x9ba7('0x17')](_0x5a51aa);}};}function respondWithFilteredResult(_0x4888f1,_0x58f842){return function(_0xa03ef6){if(_0xa03ef6){var _0x319074=typeof _0x58f842[_0x9ba7('0x18')]===_0x9ba7('0x19')&&typeof _0x58f842[_0x9ba7('0x1a')]==='undefined';var _0x23876a=_0xa03ef6['count'];var _0x1b635e=_0x319074?0x0:_0x58f842[_0x9ba7('0x18')];var _0x31de33=_0x319074?_0xa03ef6[_0x9ba7('0x1b')]:_0x58f842['offset']+_0x58f842[_0x9ba7('0x1a')];var _0x1baa51;if(_0x31de33>=_0x23876a){_0x31de33=_0x23876a;_0x1baa51=0xc8;}else{_0x1baa51=0xce;}_0x4888f1[_0x9ba7('0x16')](_0x1baa51);return _0x4888f1[_0x9ba7('0x1c')](_0x9ba7('0x1d'),_0x1b635e+'-'+_0x31de33+'/'+_0x23876a)[_0x9ba7('0x17')](_0xa03ef6);}return null;};}function patchUpdates(_0x25acd0){return function(_0x2317dd){try{jsonpatch['apply'](_0x2317dd,_0x25acd0,!![]);}catch(_0x55a662){return BPromise[_0x9ba7('0x1e')](_0x55a662);}return _0x2317dd['save']();};}function saveUpdates(_0x5b860d,_0x1bde0a){return function(_0x32dcac){if(_0x32dcac){return _0x32dcac[_0x9ba7('0x1f')](_0x5b860d)[_0x9ba7('0x20')](function(_0x536cb3){return _0x536cb3;});}return null;};}function removeEntity(_0x3e0e12,_0x4b919e){return function(_0x2b5ed0){if(_0x2b5ed0){return _0x2b5ed0[_0x9ba7('0x21')]()[_0x9ba7('0x20')](function(){_0x3e0e12[_0x9ba7('0x16')](0xcc)[_0x9ba7('0x22')]();});}};}function handleEntityNotFound(_0x47641c,_0x20a9a4){return function(_0x41b1e9){if(!_0x41b1e9){_0x47641c['sendStatus'](0x194);}return _0x41b1e9;};}function handleError(_0x247f19,_0x12851f){_0x12851f=_0x12851f||0x1f4;return function(_0x1824c0){logger[_0x9ba7('0x23')](_0x1824c0[_0x9ba7('0x24')]);if(_0x1824c0[_0x9ba7('0x25')]){delete _0x1824c0['name'];}_0x247f19[_0x9ba7('0x16')](_0x12851f)['send'](_0x1824c0);};}exports['index']=function(_0x2a3c3e,_0xea4cab){var _0xfe67a9={},_0x3ca876={},_0x3ecf08={'count':0x0,'rows':[]};var _0x57384d=_['map'](db[_0x9ba7('0x26')][_0x9ba7('0x27')],function(_0x568dea){return{'name':_0x568dea['fieldName'],'type':_0x568dea[_0x9ba7('0x28')][_0x9ba7('0x29')]};});_0x3ca876[_0x9ba7('0x2a')]=_['map'](_0x57384d,_0x9ba7('0x25'));_0x3ca876[_0x9ba7('0x2b')]=_[_0x9ba7('0x2c')](_0x2a3c3e[_0x9ba7('0x2b')]);_0x3ca876[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x3ca876[_0x9ba7('0x2a')],_0x3ca876[_0x9ba7('0x2b')]);_0xfe67a9[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x3ca876[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0xfe67a9[_0x9ba7('0x2f')]=_0xfe67a9[_0x9ba7('0x2f')]['length']?_0xfe67a9[_0x9ba7('0x2f')]:_0x3ca876['model'];if(!_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0xfe67a9[_0x9ba7('0x1a')]=qs['limit'](_0x2a3c3e[_0x9ba7('0x2b')]['limit']);_0xfe67a9[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x2a3c3e[_0x9ba7('0x2b')]['offset']);}_0xfe67a9[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0xfe67a9[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_[_0x9ba7('0x36')](_0x2a3c3e[_0x9ba7('0x2b')],_0x3ca876['filters']),_0x57384d);if(_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0xfe67a9[_0x9ba7('0x35')]=_['merge'](_0xfe67a9['where'],{'$or':_[_0x9ba7('0x38')](_0x57384d,function(_0x1b6070){if(_0x1b6070[_0x9ba7('0x28')]!==_0x9ba7('0x39')){var _0x58bd48={};_0x58bd48[_0x1b6070[_0x9ba7('0x25')]]={'$like':'%'+_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0x58bd48;}})});}_0xfe67a9=_['merge']({},_0xfe67a9,_0x2a3c3e[_0x9ba7('0x3a')]);var _0x4ea46d={'where':_0xfe67a9[_0x9ba7('0x35')]};return db[_0x9ba7('0x26')][_0x9ba7('0x1b')](_0x4ea46d)[_0x9ba7('0x20')](function(_0x31c7b5){_0x3ecf08['count']=_0x31c7b5;if(_0x2a3c3e[_0x9ba7('0x2b')][_0x9ba7('0x3b')]){_0xfe67a9[_0x9ba7('0x3c')]=[{'all':!![]}];}return db[_0x9ba7('0x26')][_0x9ba7('0x3d')](_0xfe67a9);})[_0x9ba7('0x20')](function(_0x54c03b){_0x3ecf08[_0x9ba7('0x3e')]=_0x54c03b;return _0x3ecf08;})[_0x9ba7('0x20')](respondWithFilteredResult(_0xea4cab,_0xfe67a9))[_0x9ba7('0x3f')](handleError(_0xea4cab,null));};exports[_0x9ba7('0x40')]=function(_0x3ac8c4,_0x20abc4){var _0x1e2607={'raw':![],'where':{'id':_0x3ac8c4[_0x9ba7('0x41')]['id']}},_0x5f23bd={};_0x5f23bd[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x26')][_0x9ba7('0x27')]);_0x5f23bd['query']=_[_0x9ba7('0x2c')](_0x3ac8c4[_0x9ba7('0x2b')]);_0x5f23bd[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x5f23bd[_0x9ba7('0x2a')],_0x5f23bd[_0x9ba7('0x2b')]);_0x1e2607[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x5f23bd['model'],qs[_0x9ba7('0x30')](_0x3ac8c4[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0x1e2607[_0x9ba7('0x2f')]=_0x1e2607[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x1e2607[_0x9ba7('0x2f')]:_0x5f23bd['model'];if(_0x3ac8c4[_0x9ba7('0x2b')][_0x9ba7('0x3b')]){_0x1e2607['include']=[{'all':!![]}];}_0x1e2607=_['merge']({},_0x1e2607,_0x3ac8c4[_0x9ba7('0x3a')]);return db[_0x9ba7('0x26')][_0x9ba7('0x43')](_0x1e2607)['then'](handleEntityNotFound(_0x20abc4,null))[_0x9ba7('0x20')](respondWithResult(_0x20abc4,null))['catch'](handleError(_0x20abc4,null));};exports[_0x9ba7('0x44')]=function(_0x28a53c,_0x4dffef){return db['FreshdeskConfiguration'][_0x9ba7('0x44')](_0x28a53c[_0x9ba7('0x45')],{})['then'](respondWithResult(_0x4dffef,0xc9))['catch'](handleError(_0x4dffef,null));};exports[_0x9ba7('0x1f')]=function(_0x4abade,_0x166e25){if(_0x4abade[_0x9ba7('0x45')]['id']){delete _0x4abade[_0x9ba7('0x45')]['id'];}return db[_0x9ba7('0x26')][_0x9ba7('0x43')]({'where':{'id':_0x4abade[_0x9ba7('0x41')]['id']}})['then'](handleEntityNotFound(_0x166e25,null))[_0x9ba7('0x20')](saveUpdates(_0x4abade['body'],null))[_0x9ba7('0x20')](respondWithResult(_0x166e25,null))[_0x9ba7('0x3f')](handleError(_0x166e25,null));};exports['destroy']=function(_0x3dca52,_0x4046c5){return db['FreshdeskConfiguration'][_0x9ba7('0x43')]({'where':{'id':_0x3dca52[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4046c5,null))['then'](removeEntity(_0x4046c5,null))[_0x9ba7('0x3f')](handleError(_0x4046c5,null));};exports['getFields']=function(_0x42d8c9,_0x420150,_0x4e48e9){var _0x1b4ae6={};var _0x231870={};var _0x21cd6b;var _0x5d05f7;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x42d8c9[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x420150,null))[_0x9ba7('0x20')](function(_0x2a6b33){if(_0x2a6b33){_0x21cd6b=_0x2a6b33;_0x231870[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')][_0x9ba7('0x27')]);_0x231870[_0x9ba7('0x2b')]=_['keys'](_0x42d8c9['query']);_0x231870[_0x9ba7('0x2d')]=_['intersection'](_0x231870[_0x9ba7('0x2a')],_0x231870[_0x9ba7('0x2b')]);_0x1b4ae6['attributes']=_['intersection'](_0x231870[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x42d8c9['query']['fields']));_0x1b4ae6[_0x9ba7('0x2f')]=_0x1b4ae6[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x1b4ae6[_0x9ba7('0x2f')]:_0x231870[_0x9ba7('0x2a')];_0x1b4ae6[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x42d8c9[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x1b4ae6['where']=qs['filters'](_[_0x9ba7('0x36')](_0x42d8c9[_0x9ba7('0x2b')],_0x231870[_0x9ba7('0x2d')]));if(_0x42d8c9[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x1b4ae6['where']=_[_0x9ba7('0x48')](_0x1b4ae6[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0x1b4ae6['attributes'],function(_0xc9eeb){var _0x55c6b3={};_0x55c6b3[_0xc9eeb]={'$like':'%'+_0x42d8c9['query'][_0x9ba7('0x37')]+'%'};return _0x55c6b3;})});}_0x1b4ae6=_['merge']({},_0x1b4ae6,_0x42d8c9[_0x9ba7('0x3a')]);return _0x21cd6b[_0x9ba7('0x49')](_0x1b4ae6);}})[_0x9ba7('0x20')](function(_0x471227){if(_0x471227){_0x5d05f7=_0x471227[_0x9ba7('0x42')];if(!_0x42d8c9[_0x9ba7('0x2b')]['hasOwnProperty'](_0x9ba7('0x32'))){_0x1b4ae6[_0x9ba7('0x1a')]=qs['limit'](_0x42d8c9['query'][_0x9ba7('0x1a')]);_0x1b4ae6['offset']=qs[_0x9ba7('0x18')](_0x42d8c9[_0x9ba7('0x2b')]['offset']);}return _0x21cd6b[_0x9ba7('0x49')](_0x1b4ae6);}})[_0x9ba7('0x20')](function(_0x1a17ed){if(_0x1a17ed){return _0x1a17ed?{'count':_0x5d05f7,'rows':_0x1a17ed}:null;}})[_0x9ba7('0x20')](respondWithResult(_0x420150,null))[_0x9ba7('0x3f')](handleError(_0x420150,null));};exports[_0x9ba7('0x4a')]=function(_0x3cc1c2,_0x37093f,_0x305dbe){var _0xb696df={};var _0x39b1a3={};var _0x316272;var _0x302bd4;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x3cc1c2['params']['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x37093f,null))[_0x9ba7('0x20')](function(_0x104b30){if(_0x104b30){_0x316272=_0x104b30;_0x39b1a3[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')]['rawAttributes']);_0x39b1a3['query']=_[_0x9ba7('0x2c')](_0x3cc1c2[_0x9ba7('0x2b')]);_0x39b1a3[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x39b1a3[_0x9ba7('0x2a')],_0x39b1a3[_0x9ba7('0x2b')]);_0xb696df['attributes']=_[_0x9ba7('0x2e')](_0x39b1a3[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0xb696df[_0x9ba7('0x2f')]=_0xb696df[_0x9ba7('0x2f')]['length']?_0xb696df['attributes']:_0x39b1a3['model'];_0xb696df[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0xb696df[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_[_0x9ba7('0x36')](_0x3cc1c2[_0x9ba7('0x2b')],_0x39b1a3['filters']));if(_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0xb696df['where']=_['merge'](_0xb696df[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0xb696df[_0x9ba7('0x2f')],function(_0x4981fe){var _0x1eecb3={};_0x1eecb3[_0x4981fe]={'$like':'%'+_0x3cc1c2[_0x9ba7('0x2b')]['filter']+'%'};return _0x1eecb3;})});}_0xb696df=_['merge']({},_0xb696df,_0x3cc1c2['options']);return _0x316272['getSubjects'](_0xb696df);}})['then'](function(_0x23951a){if(_0x23951a){_0x302bd4=_0x23951a[_0x9ba7('0x42')];if(!_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0xb696df[_0x9ba7('0x1a')]=qs[_0x9ba7('0x1a')](_0x3cc1c2[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0xb696df[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x3cc1c2['query'][_0x9ba7('0x18')]);}return _0x316272[_0x9ba7('0x4a')](_0xb696df);}})[_0x9ba7('0x20')](function(_0x36e5d3){if(_0x36e5d3){return _0x36e5d3?{'count':_0x302bd4,'rows':_0x36e5d3}:null;}})['then'](respondWithResult(_0x37093f,null))[_0x9ba7('0x3f')](handleError(_0x37093f,null));};exports['getDescriptions']=function(_0x542f9b,_0x572582,_0x74d0b2){var _0x576499={};var _0x2ca222={};var _0x570d91;var _0x4a236b;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x542f9b['params']['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x572582,null))[_0x9ba7('0x20')](function(_0x432653){if(_0x432653){_0x570d91=_0x432653;_0x2ca222[_0x9ba7('0x2a')]=_[_0x9ba7('0x2c')](db[_0x9ba7('0x47')][_0x9ba7('0x27')]);_0x2ca222['query']=_[_0x9ba7('0x2c')](_0x542f9b[_0x9ba7('0x2b')]);_0x2ca222[_0x9ba7('0x2d')]=_[_0x9ba7('0x2e')](_0x2ca222[_0x9ba7('0x2a')],_0x2ca222[_0x9ba7('0x2b')]);_0x576499[_0x9ba7('0x2f')]=_[_0x9ba7('0x2e')](_0x2ca222['model'],qs[_0x9ba7('0x30')](_0x542f9b[_0x9ba7('0x2b')]['fields']));_0x576499[_0x9ba7('0x2f')]=_0x576499['attributes'][_0x9ba7('0x42')]?_0x576499[_0x9ba7('0x2f')]:_0x2ca222[_0x9ba7('0x2a')];_0x576499[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x576499[_0x9ba7('0x35')]=qs[_0x9ba7('0x2d')](_['pick'](_0x542f9b['query'],_0x2ca222[_0x9ba7('0x2d')]));if(_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x576499['where']=_[_0x9ba7('0x48')](_0x576499[_0x9ba7('0x35')],{'$or':_[_0x9ba7('0x38')](_0x576499[_0x9ba7('0x2f')],function(_0x4849b7){var _0xf27d0f={};_0xf27d0f[_0x4849b7]={'$like':'%'+_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0xf27d0f;})});}_0x576499=_[_0x9ba7('0x48')]({},_0x576499,_0x542f9b[_0x9ba7('0x3a')]);return _0x570d91[_0x9ba7('0x4b')](_0x576499);}})[_0x9ba7('0x20')](function(_0x39042b){if(_0x39042b){_0x4a236b=_0x39042b[_0x9ba7('0x42')];if(!_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0x576499[_0x9ba7('0x1a')]=qs['limit'](_0x542f9b[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0x576499['offset']=qs['offset'](_0x542f9b[_0x9ba7('0x2b')]['offset']);}return _0x570d91[_0x9ba7('0x4b')](_0x576499);}})[_0x9ba7('0x20')](function(_0x368e31){if(_0x368e31){return _0x368e31?{'count':_0x4a236b,'rows':_0x368e31}:null;}})['then'](respondWithResult(_0x572582,null))[_0x9ba7('0x3f')](handleError(_0x572582,null));};exports[_0x9ba7('0x4c')]=function(_0x4b2ef9,_0x4deab8,_0x218afb){var _0x232173={};var _0x2852ce={};var _0x2c5869;var _0x14ab01;return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x4b2ef9[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4deab8,null))[_0x9ba7('0x20')](function(_0x48598a){if(_0x48598a){_0x2c5869=_0x48598a;_0x2852ce['model']=_[_0x9ba7('0x2c')](db[_0x9ba7('0x4d')][_0x9ba7('0x27')]);_0x2852ce[_0x9ba7('0x2b')]=_[_0x9ba7('0x2c')](_0x4b2ef9[_0x9ba7('0x2b')]);_0x2852ce[_0x9ba7('0x2d')]=_['intersection'](_0x2852ce[_0x9ba7('0x2a')],_0x2852ce[_0x9ba7('0x2b')]);_0x232173[_0x9ba7('0x2f')]=_['intersection'](_0x2852ce[_0x9ba7('0x2a')],qs[_0x9ba7('0x30')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x30')]));_0x232173[_0x9ba7('0x2f')]=_0x232173[_0x9ba7('0x2f')][_0x9ba7('0x42')]?_0x232173['attributes']:_0x2852ce[_0x9ba7('0x2a')];_0x232173[_0x9ba7('0x33')]=qs[_0x9ba7('0x34')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x34')]);_0x232173['where']=qs['filters'](_[_0x9ba7('0x36')](_0x4b2ef9[_0x9ba7('0x2b')],_0x2852ce[_0x9ba7('0x2d')]));if(_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x37')]){_0x232173[_0x9ba7('0x35')]=_[_0x9ba7('0x48')](_0x232173[_0x9ba7('0x35')],{'$or':_['map'](_0x232173[_0x9ba7('0x2f')],function(_0x1248b6){var _0x550f91={};_0x550f91[_0x1248b6]={'$like':'%'+_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x37')]+'%'};return _0x550f91;})});}_0x232173=_[_0x9ba7('0x48')]({},_0x232173,_0x4b2ef9['options']);return _0x2c5869[_0x9ba7('0x4c')](_0x232173);}})[_0x9ba7('0x20')](function(_0x1009ff){if(_0x1009ff){_0x14ab01=_0x1009ff[_0x9ba7('0x42')];if(!_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x31')](_0x9ba7('0x32'))){_0x232173[_0x9ba7('0x1a')]=qs[_0x9ba7('0x1a')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x1a')]);_0x232173[_0x9ba7('0x18')]=qs[_0x9ba7('0x18')](_0x4b2ef9[_0x9ba7('0x2b')][_0x9ba7('0x18')]);}return _0x2c5869[_0x9ba7('0x4c')](_0x232173);}})['then'](function(_0x39c2ef){if(_0x39c2ef){return _0x39c2ef?{'count':_0x14ab01,'rows':_0x39c2ef}:null;}})['then'](respondWithResult(_0x4deab8,null))[_0x9ba7('0x3f')](handleError(_0x4deab8,null));};exports['setTags']=function(_0x28bf16,_0x4dfcad,_0x10bef1){if(_0x28bf16[_0x9ba7('0x45')]['id']){delete _0x28bf16['body']['id'];}return db[_0x9ba7('0x26')][_0x9ba7('0x46')]({'where':{'id':_0x28bf16[_0x9ba7('0x41')]['id']}})[_0x9ba7('0x20')](handleEntityNotFound(_0x4dfcad,null))[_0x9ba7('0x20')](function(_0x1484e8){if(_0x1484e8){return _0x1484e8[_0x9ba7('0x4e')](_0x28bf16[_0x9ba7('0x45')][_0x9ba7('0x4f')]||[]);}return null;})[_0x9ba7('0x20')](respondWithResult(_0x4dfcad,null))[_0x9ba7('0x3f')](handleError(_0x4dfcad,null));}; \ No newline at end of file +var _0x3131=['FreshdeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','show','params','keys','include','create','update','body','find','catch','findOne','map','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','destroy','then','end','error','name','send','index'];(function(_0x4e65f1,_0x2b3c75){var _0x1248b2=function(_0x101083){while(--_0x101083){_0x4e65f1['push'](_0x4e65f1['shift']());}};_0x1248b2(++_0x2b3c75);}(_0x3131,0xc6));var _0x1313=function(_0x9b1b6a,_0x29af25){_0x9b1b6a=_0x9b1b6a-0x0;var _0x43cf38=_0x3131[_0x9b1b6a];return _0x43cf38;};'use strict';var emlformat=require(_0x1313('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1313('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1313('0x2'));var moment=require(_0x1313('0x3'));var BPromise=require(_0x1313('0x4'));var Mustache=require(_0x1313('0x5'));var util=require(_0x1313('0x6'));var path=require('path');var sox=require(_0x1313('0x7'));var csv=require(_0x1313('0x8'));var ejs=require(_0x1313('0x9'));var fs=require('fs');var fs_extra=require(_0x1313('0xa'));var _=require(_0x1313('0xb'));var squel=require(_0x1313('0xc'));var crypto=require(_0x1313('0xd'));var jsforce=require(_0x1313('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1313('0xf'));var authService=require(_0x1313('0x10'));var qs=require(_0x1313('0x11'));var as=require(_0x1313('0x12'));var hardwareService=require(_0x1313('0x13'));var logger=require('../../config/logger')(_0x1313('0x14'));var utils=require(_0x1313('0x15'));var config=require(_0x1313('0x16'));var licenseUtil=require(_0x1313('0x17'));var db=require(_0x1313('0x18'))['db'];function respondWithStatusCode(_0x523b31,_0x410e1e){_0x410e1e=_0x410e1e||0xcc;return function(_0x278a05){if(_0x278a05){return _0x523b31[_0x1313('0x19')](_0x410e1e);}return _0x523b31['status'](_0x410e1e)['end']();};}function respondWithResult(_0x1da1ed,_0x435eba){_0x435eba=_0x435eba||0xc8;return function(_0x501429){if(_0x501429){return _0x1da1ed[_0x1313('0x1a')](_0x435eba)[_0x1313('0x1b')](_0x501429);}};}function respondWithFilteredResult(_0x51cc96,_0x33a68e){return function(_0x14012e){if(_0x14012e){var _0x4f1124=typeof _0x33a68e[_0x1313('0x1c')]===_0x1313('0x1d')&&typeof _0x33a68e[_0x1313('0x1e')]===_0x1313('0x1d');var _0x562205=_0x14012e[_0x1313('0x1f')];var _0x35c593=_0x4f1124?0x0:_0x33a68e[_0x1313('0x1c')];var _0x15f310=_0x4f1124?_0x14012e[_0x1313('0x1f')]:_0x33a68e[_0x1313('0x1c')]+_0x33a68e['limit'];var _0x290e8b;if(_0x15f310>=_0x562205){_0x15f310=_0x562205;_0x290e8b=0xc8;}else{_0x290e8b=0xce;}_0x51cc96[_0x1313('0x1a')](_0x290e8b);return _0x51cc96[_0x1313('0x20')]('Content-Range',_0x35c593+'-'+_0x15f310+'/'+_0x562205)[_0x1313('0x1b')](_0x14012e);}return null;};}function patchUpdates(_0x4f9521){return function(_0xb87d76){try{jsonpatch['apply'](_0xb87d76,_0x4f9521,!![]);}catch(_0x35123c){return BPromise[_0x1313('0x21')](_0x35123c);}return _0xb87d76[_0x1313('0x22')]();};}function saveUpdates(_0x848c89,_0xaa5bed){return function(_0x48f89d){if(_0x48f89d){return _0x48f89d['update'](_0x848c89)['then'](function(_0x269965){return _0x269965;});}return null;};}function removeEntity(_0x3f05a9,_0x4942e0){return function(_0x56055f){if(_0x56055f){return _0x56055f[_0x1313('0x23')]()[_0x1313('0x24')](function(){_0x3f05a9['status'](0xcc)[_0x1313('0x25')]();});}};}function handleEntityNotFound(_0x53b873,_0x31052e){return function(_0x338fd1){if(!_0x338fd1){_0x53b873[_0x1313('0x19')](0x194);}return _0x338fd1;};}function handleError(_0x4738de,_0x139074){_0x139074=_0x139074||0x1f4;return function(_0x50f0b7){logger[_0x1313('0x26')](_0x50f0b7['stack']);if(_0x50f0b7[_0x1313('0x27')]){delete _0x50f0b7[_0x1313('0x27')];}_0x4738de['status'](_0x139074)[_0x1313('0x28')](_0x50f0b7);};}exports[_0x1313('0x29')]=function(_0x42553a,_0x3b1905){var _0x4e51d6={},_0x322b0c={},_0x5c7fb0={'count':0x0,'rows':[]};var _0x1b5d15=_['map'](db[_0x1313('0x2a')][_0x1313('0x2b')],function(_0x4cac0b){return{'name':_0x4cac0b['fieldName'],'type':_0x4cac0b[_0x1313('0x2c')][_0x1313('0x2d')]};});_0x322b0c[_0x1313('0x2e')]=_['map'](_0x1b5d15,'name');_0x322b0c[_0x1313('0x2f')]=_['keys'](_0x42553a[_0x1313('0x2f')]);_0x322b0c[_0x1313('0x30')]=_[_0x1313('0x31')](_0x322b0c[_0x1313('0x2e')],_0x322b0c[_0x1313('0x2f')]);_0x4e51d6['attributes']=_[_0x1313('0x31')](_0x322b0c[_0x1313('0x2e')],qs[_0x1313('0x32')](_0x42553a[_0x1313('0x2f')][_0x1313('0x32')]));_0x4e51d6[_0x1313('0x33')]=_0x4e51d6[_0x1313('0x33')][_0x1313('0x34')]?_0x4e51d6[_0x1313('0x33')]:_0x322b0c[_0x1313('0x2e')];if(!_0x42553a['query'][_0x1313('0x35')](_0x1313('0x36'))){_0x4e51d6[_0x1313('0x1e')]=qs['limit'](_0x42553a['query']['limit']);_0x4e51d6[_0x1313('0x1c')]=qs[_0x1313('0x1c')](_0x42553a['query']['offset']);}_0x4e51d6[_0x1313('0x37')]=qs[_0x1313('0x38')](_0x42553a[_0x1313('0x2f')][_0x1313('0x38')]);_0x4e51d6['where']=qs[_0x1313('0x30')](_[_0x1313('0x39')](_0x42553a['query'],_0x322b0c[_0x1313('0x30')]),_0x1b5d15);if(_0x42553a[_0x1313('0x2f')][_0x1313('0x3a')]){_0x4e51d6[_0x1313('0x3b')]=_[_0x1313('0x3c')](_0x4e51d6[_0x1313('0x3b')],{'$or':_['map'](_0x1b5d15,function(_0x43ea86){if(_0x43ea86['type']!=='VIRTUAL'){var _0x247a4e={};_0x247a4e[_0x43ea86[_0x1313('0x27')]]={'$like':'%'+_0x42553a['query'][_0x1313('0x3a')]+'%'};return _0x247a4e;}})});}_0x4e51d6=_['merge']({},_0x4e51d6,_0x42553a[_0x1313('0x3d')]);var _0x5dff78={'where':_0x4e51d6['where']};return db[_0x1313('0x2a')][_0x1313('0x1f')](_0x5dff78)[_0x1313('0x24')](function(_0x5f1642){_0x5c7fb0['count']=_0x5f1642;if(_0x42553a[_0x1313('0x2f')][_0x1313('0x3e')]){_0x4e51d6['include']=[{'all':!![]}];}return db[_0x1313('0x2a')]['findAll'](_0x4e51d6);})[_0x1313('0x24')](function(_0x439424){_0x5c7fb0['rows']=_0x439424;return _0x5c7fb0;})['then'](respondWithFilteredResult(_0x3b1905,_0x4e51d6))['catch'](handleError(_0x3b1905,null));};exports[_0x1313('0x3f')]=function(_0x525dec,_0x3299b7){var _0x45c3e6={'raw':![],'where':{'id':_0x525dec[_0x1313('0x40')]['id']}},_0x24f09a={};_0x24f09a[_0x1313('0x2e')]=_[_0x1313('0x41')](db['FreshdeskConfiguration'][_0x1313('0x2b')]);_0x24f09a[_0x1313('0x2f')]=_[_0x1313('0x41')](_0x525dec['query']);_0x24f09a['filters']=_[_0x1313('0x31')](_0x24f09a['model'],_0x24f09a[_0x1313('0x2f')]);_0x45c3e6[_0x1313('0x33')]=_[_0x1313('0x31')](_0x24f09a[_0x1313('0x2e')],qs[_0x1313('0x32')](_0x525dec['query'][_0x1313('0x32')]));_0x45c3e6[_0x1313('0x33')]=_0x45c3e6['attributes'][_0x1313('0x34')]?_0x45c3e6[_0x1313('0x33')]:_0x24f09a[_0x1313('0x2e')];if(_0x525dec[_0x1313('0x2f')][_0x1313('0x3e')]){_0x45c3e6[_0x1313('0x42')]=[{'all':!![]}];}_0x45c3e6=_[_0x1313('0x3c')]({},_0x45c3e6,_0x525dec[_0x1313('0x3d')]);return db[_0x1313('0x2a')]['find'](_0x45c3e6)[_0x1313('0x24')](handleEntityNotFound(_0x3299b7,null))[_0x1313('0x24')](respondWithResult(_0x3299b7,null))['catch'](handleError(_0x3299b7,null));};exports[_0x1313('0x43')]=function(_0x2be03c,_0xcd9648){return db[_0x1313('0x2a')]['create'](_0x2be03c['body'],{})[_0x1313('0x24')](respondWithResult(_0xcd9648,0xc9))['catch'](handleError(_0xcd9648,null));};exports[_0x1313('0x44')]=function(_0xa6702f,_0x18cba0){if(_0xa6702f['body']['id']){delete _0xa6702f[_0x1313('0x45')]['id'];}return db['FreshdeskConfiguration'][_0x1313('0x46')]({'where':{'id':_0xa6702f[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x18cba0,null))['then'](saveUpdates(_0xa6702f['body'],null))[_0x1313('0x24')](respondWithResult(_0x18cba0,null))[_0x1313('0x47')](handleError(_0x18cba0,null));};exports[_0x1313('0x23')]=function(_0x296aa1,_0xf566a7){return db[_0x1313('0x2a')][_0x1313('0x46')]({'where':{'id':_0x296aa1[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0xf566a7,null))[_0x1313('0x24')](removeEntity(_0xf566a7,null))['catch'](handleError(_0xf566a7,null));};exports['getFields']=function(_0x1e5fdc,_0x44d361,_0x1b82e4){var _0x4e8a4a={};var _0x567d15={};var _0x129e59;var _0x1e84f8;return db[_0x1313('0x2a')][_0x1313('0x48')]({'where':{'id':_0x1e5fdc[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x44d361,null))['then'](function(_0x12ac35){if(_0x12ac35){_0x129e59=_0x12ac35;_0x567d15[_0x1313('0x2e')]=_[_0x1313('0x41')](db['FreshdeskField'][_0x1313('0x2b')]);_0x567d15[_0x1313('0x2f')]=_['keys'](_0x1e5fdc[_0x1313('0x2f')]);_0x567d15[_0x1313('0x30')]=_[_0x1313('0x31')](_0x567d15[_0x1313('0x2e')],_0x567d15['query']);_0x4e8a4a[_0x1313('0x33')]=_[_0x1313('0x31')](_0x567d15[_0x1313('0x2e')],qs[_0x1313('0x32')](_0x1e5fdc[_0x1313('0x2f')]['fields']));_0x4e8a4a[_0x1313('0x33')]=_0x4e8a4a[_0x1313('0x33')][_0x1313('0x34')]?_0x4e8a4a['attributes']:_0x567d15[_0x1313('0x2e')];_0x4e8a4a['order']=qs['sort'](_0x1e5fdc['query'][_0x1313('0x38')]);_0x4e8a4a['where']=qs[_0x1313('0x30')](_[_0x1313('0x39')](_0x1e5fdc['query'],_0x567d15['filters']));if(_0x1e5fdc['query']['filter']){_0x4e8a4a[_0x1313('0x3b')]=_[_0x1313('0x3c')](_0x4e8a4a[_0x1313('0x3b')],{'$or':_[_0x1313('0x49')](_0x4e8a4a[_0x1313('0x33')],function(_0x23d4c5){var _0x1ee0e6={};_0x1ee0e6[_0x23d4c5]={'$like':'%'+_0x1e5fdc[_0x1313('0x2f')][_0x1313('0x3a')]+'%'};return _0x1ee0e6;})});}_0x4e8a4a=_[_0x1313('0x3c')]({},_0x4e8a4a,_0x1e5fdc[_0x1313('0x3d')]);return _0x129e59['getFields'](_0x4e8a4a);}})[_0x1313('0x24')](function(_0x14377a){if(_0x14377a){_0x1e84f8=_0x14377a[_0x1313('0x34')];if(!_0x1e5fdc['query'][_0x1313('0x35')]('nolimit')){_0x4e8a4a[_0x1313('0x1e')]=qs[_0x1313('0x1e')](_0x1e5fdc[_0x1313('0x2f')][_0x1313('0x1e')]);_0x4e8a4a[_0x1313('0x1c')]=qs[_0x1313('0x1c')](_0x1e5fdc[_0x1313('0x2f')][_0x1313('0x1c')]);}return _0x129e59['getFields'](_0x4e8a4a);}})['then'](function(_0x4a05bb){if(_0x4a05bb){return _0x4a05bb?{'count':_0x1e84f8,'rows':_0x4a05bb}:null;}})[_0x1313('0x24')](respondWithResult(_0x44d361,null))[_0x1313('0x47')](handleError(_0x44d361,null));};exports[_0x1313('0x4a')]=function(_0x187ee0,_0x3d82ea,_0x2bccab){var _0x23e832={};var _0x395129={};var _0x3d2baf;var _0xbae152;return db[_0x1313('0x2a')][_0x1313('0x48')]({'where':{'id':_0x187ee0[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x3d82ea,null))[_0x1313('0x24')](function(_0x46c5f9){if(_0x46c5f9){_0x3d2baf=_0x46c5f9;_0x395129['model']=_[_0x1313('0x41')](db[_0x1313('0x4b')]['rawAttributes']);_0x395129['query']=_['keys'](_0x187ee0[_0x1313('0x2f')]);_0x395129[_0x1313('0x30')]=_['intersection'](_0x395129[_0x1313('0x2e')],_0x395129[_0x1313('0x2f')]);_0x23e832[_0x1313('0x33')]=_[_0x1313('0x31')](_0x395129[_0x1313('0x2e')],qs[_0x1313('0x32')](_0x187ee0[_0x1313('0x2f')][_0x1313('0x32')]));_0x23e832[_0x1313('0x33')]=_0x23e832[_0x1313('0x33')][_0x1313('0x34')]?_0x23e832[_0x1313('0x33')]:_0x395129[_0x1313('0x2e')];_0x23e832[_0x1313('0x37')]=qs[_0x1313('0x38')](_0x187ee0[_0x1313('0x2f')][_0x1313('0x38')]);_0x23e832[_0x1313('0x3b')]=qs[_0x1313('0x30')](_[_0x1313('0x39')](_0x187ee0[_0x1313('0x2f')],_0x395129[_0x1313('0x30')]));if(_0x187ee0[_0x1313('0x2f')][_0x1313('0x3a')]){_0x23e832[_0x1313('0x3b')]=_['merge'](_0x23e832['where'],{'$or':_[_0x1313('0x49')](_0x23e832[_0x1313('0x33')],function(_0x544f32){var _0x5dc2f1={};_0x5dc2f1[_0x544f32]={'$like':'%'+_0x187ee0['query'][_0x1313('0x3a')]+'%'};return _0x5dc2f1;})});}_0x23e832=_[_0x1313('0x3c')]({},_0x23e832,_0x187ee0[_0x1313('0x3d')]);return _0x3d2baf[_0x1313('0x4a')](_0x23e832);}})['then'](function(_0x4d9603){if(_0x4d9603){_0xbae152=_0x4d9603['length'];if(!_0x187ee0[_0x1313('0x2f')][_0x1313('0x35')]('nolimit')){_0x23e832[_0x1313('0x1e')]=qs[_0x1313('0x1e')](_0x187ee0['query'][_0x1313('0x1e')]);_0x23e832[_0x1313('0x1c')]=qs['offset'](_0x187ee0[_0x1313('0x2f')][_0x1313('0x1c')]);}return _0x3d2baf['getSubjects'](_0x23e832);}})[_0x1313('0x24')](function(_0x1b05c2){if(_0x1b05c2){return _0x1b05c2?{'count':_0xbae152,'rows':_0x1b05c2}:null;}})[_0x1313('0x24')](respondWithResult(_0x3d82ea,null))[_0x1313('0x47')](handleError(_0x3d82ea,null));};exports[_0x1313('0x4c')]=function(_0x3507b7,_0x31290c,_0x1661e2){var _0x3e66bd={};var _0x15c7bc={};var _0x3fadc5;var _0x364d21;return db[_0x1313('0x2a')][_0x1313('0x48')]({'where':{'id':_0x3507b7[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x31290c,null))[_0x1313('0x24')](function(_0x711090){if(_0x711090){_0x3fadc5=_0x711090;_0x15c7bc[_0x1313('0x2e')]=_[_0x1313('0x41')](db[_0x1313('0x4b')][_0x1313('0x2b')]);_0x15c7bc['query']=_[_0x1313('0x41')](_0x3507b7[_0x1313('0x2f')]);_0x15c7bc['filters']=_[_0x1313('0x31')](_0x15c7bc[_0x1313('0x2e')],_0x15c7bc['query']);_0x3e66bd[_0x1313('0x33')]=_[_0x1313('0x31')](_0x15c7bc['model'],qs['fields'](_0x3507b7['query']['fields']));_0x3e66bd[_0x1313('0x33')]=_0x3e66bd[_0x1313('0x33')][_0x1313('0x34')]?_0x3e66bd['attributes']:_0x15c7bc[_0x1313('0x2e')];_0x3e66bd[_0x1313('0x37')]=qs['sort'](_0x3507b7[_0x1313('0x2f')][_0x1313('0x38')]);_0x3e66bd[_0x1313('0x3b')]=qs['filters'](_['pick'](_0x3507b7['query'],_0x15c7bc['filters']));if(_0x3507b7[_0x1313('0x2f')][_0x1313('0x3a')]){_0x3e66bd[_0x1313('0x3b')]=_[_0x1313('0x3c')](_0x3e66bd[_0x1313('0x3b')],{'$or':_[_0x1313('0x49')](_0x3e66bd[_0x1313('0x33')],function(_0x17224c){var _0x5cab8e={};_0x5cab8e[_0x17224c]={'$like':'%'+_0x3507b7[_0x1313('0x2f')][_0x1313('0x3a')]+'%'};return _0x5cab8e;})});}_0x3e66bd=_[_0x1313('0x3c')]({},_0x3e66bd,_0x3507b7[_0x1313('0x3d')]);return _0x3fadc5[_0x1313('0x4c')](_0x3e66bd);}})[_0x1313('0x24')](function(_0x52447f){if(_0x52447f){_0x364d21=_0x52447f['length'];if(!_0x3507b7['query']['hasOwnProperty']('nolimit')){_0x3e66bd[_0x1313('0x1e')]=qs[_0x1313('0x1e')](_0x3507b7['query'][_0x1313('0x1e')]);_0x3e66bd[_0x1313('0x1c')]=qs[_0x1313('0x1c')](_0x3507b7[_0x1313('0x2f')][_0x1313('0x1c')]);}return _0x3fadc5[_0x1313('0x4c')](_0x3e66bd);}})[_0x1313('0x24')](function(_0x5b035b){if(_0x5b035b){return _0x5b035b?{'count':_0x364d21,'rows':_0x5b035b}:null;}})[_0x1313('0x24')](respondWithResult(_0x31290c,null))['catch'](handleError(_0x31290c,null));};exports[_0x1313('0x4d')]=function(_0x136eef,_0x5e4d6a,_0x3dfd98){var _0x3dfb39={};var _0x35dbc1={};var _0x493484;var _0x4d4bc5;return db[_0x1313('0x2a')][_0x1313('0x48')]({'where':{'id':_0x136eef['params']['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x5e4d6a,null))[_0x1313('0x24')](function(_0x15a2b9){if(_0x15a2b9){_0x493484=_0x15a2b9;_0x35dbc1[_0x1313('0x2e')]=_[_0x1313('0x41')](db['Tag'][_0x1313('0x2b')]);_0x35dbc1[_0x1313('0x2f')]=_['keys'](_0x136eef[_0x1313('0x2f')]);_0x35dbc1[_0x1313('0x30')]=_['intersection'](_0x35dbc1[_0x1313('0x2e')],_0x35dbc1[_0x1313('0x2f')]);_0x3dfb39[_0x1313('0x33')]=_['intersection'](_0x35dbc1['model'],qs[_0x1313('0x32')](_0x136eef['query'][_0x1313('0x32')]));_0x3dfb39[_0x1313('0x33')]=_0x3dfb39[_0x1313('0x33')][_0x1313('0x34')]?_0x3dfb39[_0x1313('0x33')]:_0x35dbc1[_0x1313('0x2e')];_0x3dfb39[_0x1313('0x37')]=qs[_0x1313('0x38')](_0x136eef[_0x1313('0x2f')][_0x1313('0x38')]);_0x3dfb39['where']=qs[_0x1313('0x30')](_[_0x1313('0x39')](_0x136eef[_0x1313('0x2f')],_0x35dbc1[_0x1313('0x30')]));if(_0x136eef[_0x1313('0x2f')][_0x1313('0x3a')]){_0x3dfb39['where']=_[_0x1313('0x3c')](_0x3dfb39['where'],{'$or':_[_0x1313('0x49')](_0x3dfb39[_0x1313('0x33')],function(_0x2f5f0f){var _0x15674d={};_0x15674d[_0x2f5f0f]={'$like':'%'+_0x136eef[_0x1313('0x2f')]['filter']+'%'};return _0x15674d;})});}_0x3dfb39=_[_0x1313('0x3c')]({},_0x3dfb39,_0x136eef['options']);return _0x493484[_0x1313('0x4d')](_0x3dfb39);}})['then'](function(_0x3a7979){if(_0x3a7979){_0x4d4bc5=_0x3a7979['length'];if(!_0x136eef[_0x1313('0x2f')][_0x1313('0x35')](_0x1313('0x36'))){_0x3dfb39[_0x1313('0x1e')]=qs[_0x1313('0x1e')](_0x136eef['query'][_0x1313('0x1e')]);_0x3dfb39[_0x1313('0x1c')]=qs[_0x1313('0x1c')](_0x136eef[_0x1313('0x2f')][_0x1313('0x1c')]);}return _0x493484[_0x1313('0x4d')](_0x3dfb39);}})[_0x1313('0x24')](function(_0x54ee75){if(_0x54ee75){return _0x54ee75?{'count':_0x4d4bc5,'rows':_0x54ee75}:null;}})[_0x1313('0x24')](respondWithResult(_0x5e4d6a,null))[_0x1313('0x47')](handleError(_0x5e4d6a,null));};exports[_0x1313('0x4e')]=function(_0xc59a69,_0x46fbbf,_0x433757){if(_0xc59a69['body']['id']){delete _0xc59a69[_0x1313('0x45')]['id'];}return db[_0x1313('0x2a')][_0x1313('0x48')]({'where':{'id':_0xc59a69[_0x1313('0x40')]['id']}})[_0x1313('0x24')](handleEntityNotFound(_0x46fbbf,null))[_0x1313('0x24')](function(_0x370a0d){if(_0x370a0d){return _0x370a0d[_0x1313('0x4e')](_0xc59a69[_0x1313('0x45')][_0x1313('0x4f')]||[]);}return null;})[_0x1313('0x24')](respondWithResult(_0x46fbbf,null))[_0x1313('0x47')](handleError(_0x46fbbf,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0124559..9f2e225 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d28=['../../config/environment','exports','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9102a0,_0x521732){var _0x124e68=function(_0x473038){while(--_0x473038){_0x9102a0['push'](_0x9102a0['shift']());}};_0x124e68(++_0x521732);}(_0x4d28,0x121));var _0x84d2=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0x4d28[_0x3ae34a];return _0x4c9edc;};'use strict';var _=require(_0x84d2('0x0'));var util=require('util');var logger=require(_0x84d2('0x1'))(_0x84d2('0x2'));var moment=require(_0x84d2('0x3'));var BPromise=require(_0x84d2('0x4'));var rp=require(_0x84d2('0x5'));var fs=require('fs');var path=require(_0x84d2('0x6'));var rimraf=require(_0x84d2('0x7'));var config=require(_0x84d2('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x84d2('0x9')]=function(_0x3cc298,_0x371805){return _0x3cc298['define'](_0x84d2('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dc1=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','./intFreshdeskConfiguration.attributes','exports'];(function(_0x2116ab,_0xc08484){var _0x208cd9=function(_0x1241db){while(--_0x1241db){_0x2116ab['push'](_0x2116ab['shift']());}};_0x208cd9(++_0xc08484);}(_0x3dc1,0x161));var _0x13dc=function(_0x3869ab,_0x292dc2){_0x3869ab=_0x3869ab-0x0;var _0x226009=_0x3dc1[_0x3869ab];return _0x226009;};'use strict';var _=require(_0x13dc('0x0'));var util=require('util');var logger=require(_0x13dc('0x1'))(_0x13dc('0x2'));var moment=require('moment');var BPromise=require(_0x13dc('0x3'));var rp=require(_0x13dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x13dc('0x5'));module[_0x13dc('0x6')]=function(_0xadceee,_0x3809ed){return _0xadceee[_0x13dc('0x7')](_0x13dc('0x8'),attributes,{'tableName':_0x13dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index f4d3fca..1eff457 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7205=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','bluebird','ioredis'];(function(_0x33f99e,_0x499209){var _0x19b1b4=function(_0x332461){while(--_0x332461){_0x33f99e['push'](_0x33f99e['shift']());}};_0x19b1b4(++_0x499209);}(_0x7205,0xed));var _0x5720=function(_0x348319,_0x8b6c89){_0x348319=_0x348319-0x0;var _0x47b9ed=_0x7205[_0x348319];return _0x47b9ed;};'use strict';var _=require('lodash');var util=require(_0x5720('0x0'));var moment=require('moment');var BPromise=require(_0x5720('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5720('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5720('0x3'));var logger=require('../../config/logger')(_0x5720('0x4'));var config=require(_0x5720('0x5'));var jayson=require(_0x5720('0x6'));var client=jayson[_0x5720('0x7')][_0x5720('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4dae9c,_0x3d429d,_0x1a908a){return new BPromise(function(_0x40c717,_0x729579){return client[_0x5720('0x9')](_0x4dae9c,_0x1a908a)[_0x5720('0xa')](function(_0x18ec65){logger[_0x5720('0xb')](_0x5720('0xc'),_0x3d429d,'request\x20sent');logger[_0x5720('0xd')](_0x5720('0xe'),_0x3d429d,_0x5720('0xf'),JSON[_0x5720('0x10')](_0x18ec65));if(_0x18ec65[_0x5720('0x11')]){if(_0x18ec65[_0x5720('0x11')]['code']===0x1f4){logger[_0x5720('0x11')](_0x5720('0xc'),_0x3d429d,_0x18ec65['error'][_0x5720('0x12')]);return _0x729579(_0x18ec65[_0x5720('0x11')]['message']);}logger[_0x5720('0x11')](_0x5720('0xc'),_0x3d429d,_0x18ec65[_0x5720('0x11')]['message']);return _0x40c717(_0x18ec65['error'][_0x5720('0x12')]);}else{logger[_0x5720('0xb')](_0x5720('0xc'),_0x3d429d,_0x5720('0xf'));_0x40c717(_0x18ec65[_0x5720('0x13')]['message']);}})['catch'](function(_0x2d71ed){logger['error'](_0x5720('0xc'),_0x3d429d,_0x2d71ed);_0x729579(_0x2d71ed);});});} \ No newline at end of file +var _0x2ea1=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2f998c,_0x12eb03){var _0x3ba03c=function(_0x1d4ed6){while(--_0x1d4ed6){_0x2f998c['push'](_0x2f998c['shift']());}};_0x3ba03c(++_0x12eb03);}(_0x2ea1,0x100));var _0x12ea=function(_0x2e59ac,_0x559144){_0x2e59ac=_0x2e59ac-0x0;var _0x40e9e6=_0x2ea1[_0x2e59ac];return _0x40e9e6;};'use strict';var _=require(_0x12ea('0x0'));var util=require(_0x12ea('0x1'));var moment=require(_0x12ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x12ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x12ea('0x4'))['db'];var utils=require(_0x12ea('0x5'));var logger=require(_0x12ea('0x6'))(_0x12ea('0x7'));var config=require(_0x12ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x12ea('0x9')][_0x12ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34f75c,_0x4a1518,_0x232b63){return new BPromise(function(_0x148e3a,_0x369485){return client['request'](_0x34f75c,_0x232b63)['then'](function(_0x15765e){logger[_0x12ea('0xb')](_0x12ea('0xc'),_0x4a1518,'request\x20sent');logger[_0x12ea('0xd')](_0x12ea('0xe'),_0x4a1518,_0x12ea('0xf'),JSON['stringify'](_0x15765e));if(_0x15765e[_0x12ea('0x10')]){if(_0x15765e['error'][_0x12ea('0x11')]===0x1f4){logger[_0x12ea('0x10')](_0x12ea('0xc'),_0x4a1518,_0x15765e['error'][_0x12ea('0x12')]);return _0x369485(_0x15765e['error'][_0x12ea('0x12')]);}logger[_0x12ea('0x10')](_0x12ea('0xc'),_0x4a1518,_0x15765e[_0x12ea('0x10')][_0x12ea('0x12')]);return _0x148e3a(_0x15765e['error'][_0x12ea('0x12')]);}else{logger[_0x12ea('0xb')](_0x12ea('0xc'),_0x4a1518,_0x12ea('0xf'));_0x148e3a(_0x15765e[_0x12ea('0x13')][_0x12ea('0x12')]);}})[_0x12ea('0x14')](function(_0x5860ae){logger[_0x12ea('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4a1518,_0x5860ae);_0x369485(_0x5860ae);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b0457d3..6b49d30 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x726d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x726d,0x11d));var _0xd726=function(_0x2f1f11,_0x2ebb8d){_0x2f1f11=_0x2f1f11-0x0;var _0xb0ccd5=_0x726d[_0x2f1f11];return _0xb0ccd5;};'use strict';var multer=require(_0xd726('0x0'));var util=require(_0xd726('0x1'));var path=require(_0xd726('0x2'));var timeout=require(_0xd726('0x3'));var express=require(_0xd726('0x4'));var router=express[_0xd726('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd726('0x6'));var interaction=require(_0xd726('0x7'));var config=require('../../config/environment');var controller=require(_0xd726('0x8'));router[_0xd726('0x9')]('/',auth[_0xd726('0xa')](),controller['index']);router[_0xd726('0x9')]('/:id',auth[_0xd726('0xa')](),controller[_0xd726('0xb')]);router[_0xd726('0xc')]('/',auth[_0xd726('0xa')](),controller['create']);router[_0xd726('0xd')](_0xd726('0xe'),auth[_0xd726('0xa')](),controller[_0xd726('0xf')]);router[_0xd726('0x10')](_0xd726('0xe'),auth[_0xd726('0xa')](),controller[_0xd726('0x11')]);module[_0xd726('0x12')]=router; \ No newline at end of file +var _0xfda0=['./intFreshdeskField.controller','isAuthenticated','index','get','show','post','put','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c8625,_0x294837){var _0xa5750b=function(_0x1aa1c4){while(--_0x1aa1c4){_0x2c8625['push'](_0x2c8625['shift']());}};_0xa5750b(++_0x294837);}(_0xfda0,0x1a1));var _0x0fda=function(_0x4af0cd,_0x12dba1){_0x4af0cd=_0x4af0cd-0x0;var _0x34c575=_0xfda0[_0x4af0cd];return _0x34c575;};'use strict';var multer=require(_0x0fda('0x0'));var util=require(_0x0fda('0x1'));var path=require('path');var timeout=require(_0x0fda('0x2'));var express=require(_0x0fda('0x3'));var router=express['Router']();var fs_extra=require(_0x0fda('0x4'));var auth=require(_0x0fda('0x5'));var interaction=require(_0x0fda('0x6'));var config=require(_0x0fda('0x7'));var controller=require(_0x0fda('0x8'));router['get']('/',auth[_0x0fda('0x9')](),controller[_0x0fda('0xa')]);router[_0x0fda('0xb')]('/:id',auth[_0x0fda('0x9')](),controller[_0x0fda('0xc')]);router[_0x0fda('0xd')]('/',auth[_0x0fda('0x9')](),controller['create']);router[_0x0fda('0xe')]('/:id',auth[_0x0fda('0x9')](),controller['update']);router['delete']('/:id',auth[_0x0fda('0x9')](),controller[_0x0fda('0xf')]);module[_0x0fda('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6493f2c..70b13a0 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.attributes.js +++ b/server/api/intFreshdeskField/intFreshdeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e1f=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue'];(function(_0x55fb72,_0x29973d){var _0x24b4d0=function(_0x8179f8){while(--_0x8179f8){_0x55fb72['push'](_0x55fb72['shift']());}};_0x24b4d0(++_0x29973d);}(_0x3e1f,0x163));var _0xf3e1=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x3e1f[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require(_0xf3e1('0x0'));module[_0xf3e1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xf3e1('0x2'),_0xf3e1('0x3'),_0xf3e1('0x4'),_0xf3e1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf3e1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf3e1('0x7')]('string','variable',_0xf3e1('0x3'))},'keyContent':{'type':Sequelize[_0xf3e1('0x6')]},'idField':{'type':Sequelize[_0xf3e1('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf3e1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd958=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xd958,0xc3));var _0x8d95=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd958[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x8d95('0x0'));module['exports']={'type':{'type':Sequelize[_0x8d95('0x1')](_0x8d95('0x2'),_0x8d95('0x3'),_0x8d95('0x4'),_0x8d95('0x5'),_0x8d95('0x6')),'defaultValue':_0x8d95('0x2')},'content':{'type':Sequelize[_0x8d95('0x7')]},'key':{'type':Sequelize[_0x8d95('0x7')]},'keyType':{'type':Sequelize[_0x8d95('0x1')](_0x8d95('0x2'),_0x8d95('0x3'),_0x8d95('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8d95('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8d95('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a595db9..584f514 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa25c=['map','FreshdeskField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index'];(function(_0x1bad8e,_0xa192b3){var _0xb75632=function(_0x254afc){while(--_0x254afc){_0x1bad8e['push'](_0x1bad8e['shift']());}};_0xb75632(++_0xa192b3);}(_0xa25c,0x13f));var _0xca25=function(_0x42749b,_0x16a7ba){_0x42749b=_0x42749b-0x0;var _0x19db46=_0xa25c[_0x42749b];return _0x19db46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca25('0x0'));var zipdir=require(_0xca25('0x1'));var jsonpatch=require(_0xca25('0x2'));var rp=require(_0xca25('0x3'));var moment=require(_0xca25('0x4'));var BPromise=require(_0xca25('0x5'));var Mustache=require(_0xca25('0x6'));var util=require(_0xca25('0x7'));var path=require('path');var sox=require(_0xca25('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xca25('0x9'));var _=require('lodash');var squel=require(_0xca25('0xa'));var crypto=require(_0xca25('0xb'));var jsforce=require(_0xca25('0xc'));var deskjs=require(_0xca25('0xd'));var toCsv=require(_0xca25('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xca25('0x10'));var as=require(_0xca25('0x11'));var hardwareService=require(_0xca25('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca25('0x13'));var licenseUtil=require(_0xca25('0x14'));var db=require(_0xca25('0x15'))['db'];function respondWithStatusCode(_0x5697aa,_0x534bca){_0x534bca=_0x534bca||0xcc;return function(_0x2a7a97){if(_0x2a7a97){return _0x5697aa['sendStatus'](_0x534bca);}return _0x5697aa[_0xca25('0x16')](_0x534bca)[_0xca25('0x17')]();};}function respondWithResult(_0x35093c,_0x1a3207){_0x1a3207=_0x1a3207||0xc8;return function(_0x307e9e){if(_0x307e9e){return _0x35093c[_0xca25('0x16')](_0x1a3207)[_0xca25('0x18')](_0x307e9e);}};}function respondWithFilteredResult(_0x33aa25,_0x2a1af3){return function(_0x42bc1e){if(_0x42bc1e){var _0x2b5cef=typeof _0x2a1af3['offset']===_0xca25('0x19')&&typeof _0x2a1af3[_0xca25('0x1a')]==='undefined';var _0x411230=_0x42bc1e[_0xca25('0x1b')];var _0x3705a0=_0x2b5cef?0x0:_0x2a1af3[_0xca25('0x1c')];var _0x155cf2=_0x2b5cef?_0x42bc1e['count']:_0x2a1af3[_0xca25('0x1c')]+_0x2a1af3[_0xca25('0x1a')];var _0x143243;if(_0x155cf2>=_0x411230){_0x155cf2=_0x411230;_0x143243=0xc8;}else{_0x143243=0xce;}_0x33aa25[_0xca25('0x16')](_0x143243);return _0x33aa25[_0xca25('0x1d')]('Content-Range',_0x3705a0+'-'+_0x155cf2+'/'+_0x411230)[_0xca25('0x18')](_0x42bc1e);}return null;};}function patchUpdates(_0x3598c7){return function(_0x235d92){try{jsonpatch[_0xca25('0x1e')](_0x235d92,_0x3598c7,!![]);}catch(_0x327719){return BPromise[_0xca25('0x1f')](_0x327719);}return _0x235d92[_0xca25('0x20')]();};}function saveUpdates(_0x54c91a,_0x48fdf5){return function(_0x23f69a){if(_0x23f69a){return _0x23f69a[_0xca25('0x21')](_0x54c91a)[_0xca25('0x22')](function(_0x1596dd){return _0x1596dd;});}return null;};}function removeEntity(_0x2615d4,_0x40e5e2){return function(_0x8cec43){if(_0x8cec43){return _0x8cec43[_0xca25('0x23')]()[_0xca25('0x22')](function(){_0x2615d4[_0xca25('0x16')](0xcc)[_0xca25('0x17')]();});}};}function handleEntityNotFound(_0x20dc6d,_0x4dffad){return function(_0x1aa848){if(!_0x1aa848){_0x20dc6d[_0xca25('0x24')](0x194);}return _0x1aa848;};}function handleError(_0x7ceacb,_0x374cde){_0x374cde=_0x374cde||0x1f4;return function(_0x220546){logger['error'](_0x220546[_0xca25('0x25')]);if(_0x220546[_0xca25('0x26')]){delete _0x220546[_0xca25('0x26')];}_0x7ceacb[_0xca25('0x16')](_0x374cde)[_0xca25('0x27')](_0x220546);};}exports[_0xca25('0x28')]=function(_0xfd888c,_0x1660a5){var _0x3e72cb={},_0x7b67f4={},_0x190f27={'count':0x0,'rows':[]};var _0x315f76=_[_0xca25('0x29')](db[_0xca25('0x2a')][_0xca25('0x2b')],function(_0x2433bb){return{'name':_0x2433bb[_0xca25('0x2c')],'type':_0x2433bb[_0xca25('0x2d')]['key']};});_0x7b67f4[_0xca25('0x2e')]=_[_0xca25('0x29')](_0x315f76,_0xca25('0x26'));_0x7b67f4['query']=_[_0xca25('0x2f')](_0xfd888c[_0xca25('0x30')]);_0x7b67f4[_0xca25('0x31')]=_[_0xca25('0x32')](_0x7b67f4[_0xca25('0x2e')],_0x7b67f4[_0xca25('0x30')]);_0x3e72cb['attributes']=_[_0xca25('0x32')](_0x7b67f4['model'],qs[_0xca25('0x33')](_0xfd888c[_0xca25('0x30')][_0xca25('0x33')]));_0x3e72cb['attributes']=_0x3e72cb[_0xca25('0x34')][_0xca25('0x35')]?_0x3e72cb[_0xca25('0x34')]:_0x7b67f4[_0xca25('0x2e')];if(!_0xfd888c[_0xca25('0x30')]['hasOwnProperty'](_0xca25('0x36'))){_0x3e72cb[_0xca25('0x1a')]=qs[_0xca25('0x1a')](_0xfd888c[_0xca25('0x30')][_0xca25('0x1a')]);_0x3e72cb[_0xca25('0x1c')]=qs[_0xca25('0x1c')](_0xfd888c['query']['offset']);}_0x3e72cb[_0xca25('0x37')]=qs[_0xca25('0x38')](_0xfd888c['query']['sort']);_0x3e72cb[_0xca25('0x39')]=qs[_0xca25('0x31')](_[_0xca25('0x3a')](_0xfd888c['query'],_0x7b67f4[_0xca25('0x31')]),_0x315f76);if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]){_0x3e72cb[_0xca25('0x39')]=_[_0xca25('0x3c')](_0x3e72cb[_0xca25('0x39')],{'$or':_['map'](_0x315f76,function(_0x290537){if(_0x290537['type']!==_0xca25('0x3d')){var _0x25880f={};_0x25880f[_0x290537[_0xca25('0x26')]]={'$like':'%'+_0xfd888c[_0xca25('0x30')][_0xca25('0x3b')]+'%'};return _0x25880f;}})});}_0x3e72cb=_[_0xca25('0x3c')]({},_0x3e72cb,_0xfd888c[_0xca25('0x3e')]);var _0x19984f={'where':_0x3e72cb[_0xca25('0x39')]};return db['FreshdeskField'][_0xca25('0x1b')](_0x19984f)['then'](function(_0x2d6f27){_0x190f27['count']=_0x2d6f27;if(_0xfd888c[_0xca25('0x30')][_0xca25('0x3f')]){_0x3e72cb[_0xca25('0x40')]=[{'all':!![]}];}return db[_0xca25('0x2a')]['findAll'](_0x3e72cb);})[_0xca25('0x22')](function(_0x5aafa5){_0x190f27[_0xca25('0x41')]=_0x5aafa5;return _0x190f27;})[_0xca25('0x22')](respondWithFilteredResult(_0x1660a5,_0x3e72cb))['catch'](handleError(_0x1660a5,null));};exports[_0xca25('0x42')]=function(_0x183135,_0x52799a){var _0x2ff9c2={'raw':!![],'where':{'id':_0x183135[_0xca25('0x43')]['id']}},_0x1068c9={};_0x1068c9[_0xca25('0x2e')]=_['keys'](db[_0xca25('0x2a')][_0xca25('0x2b')]);_0x1068c9['query']=_['keys'](_0x183135['query']);_0x1068c9['filters']=_[_0xca25('0x32')](_0x1068c9[_0xca25('0x2e')],_0x1068c9[_0xca25('0x30')]);_0x2ff9c2[_0xca25('0x34')]=_['intersection'](_0x1068c9[_0xca25('0x2e')],qs[_0xca25('0x33')](_0x183135[_0xca25('0x30')][_0xca25('0x33')]));_0x2ff9c2['attributes']=_0x2ff9c2[_0xca25('0x34')]['length']?_0x2ff9c2[_0xca25('0x34')]:_0x1068c9[_0xca25('0x2e')];if(_0x183135[_0xca25('0x30')][_0xca25('0x3f')]){_0x2ff9c2[_0xca25('0x40')]=[{'all':!![]}];}_0x2ff9c2=_[_0xca25('0x3c')]({},_0x2ff9c2,_0x183135['options']);return db[_0xca25('0x2a')][_0xca25('0x44')](_0x2ff9c2)[_0xca25('0x22')](handleEntityNotFound(_0x52799a,null))[_0xca25('0x22')](respondWithResult(_0x52799a,null))[_0xca25('0x45')](handleError(_0x52799a,null));};exports[_0xca25('0x46')]=function(_0x1ad2d0,_0x352a17){return db[_0xca25('0x2a')][_0xca25('0x46')](_0x1ad2d0[_0xca25('0x47')],{})[_0xca25('0x22')](respondWithResult(_0x352a17,0xc9))[_0xca25('0x45')](handleError(_0x352a17,null));};exports[_0xca25('0x21')]=function(_0x3279e0,_0x1fba32){if(_0x3279e0[_0xca25('0x47')]['id']){delete _0x3279e0[_0xca25('0x47')]['id'];}return db['FreshdeskField'][_0xca25('0x44')]({'where':{'id':_0x3279e0[_0xca25('0x43')]['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x1fba32,null))[_0xca25('0x22')](saveUpdates(_0x3279e0['body'],null))[_0xca25('0x22')](respondWithResult(_0x1fba32,null))[_0xca25('0x45')](handleError(_0x1fba32,null));};exports['destroy']=function(_0x2bc528,_0x10692f){return db[_0xca25('0x2a')][_0xca25('0x44')]({'where':{'id':_0x2bc528['params']['id']}})[_0xca25('0x22')](handleEntityNotFound(_0x10692f,null))['then'](removeEntity(_0x10692f,null))[_0xca25('0x45')](handleError(_0x10692f,null));}; \ No newline at end of file +var _0x3e5c=['options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','map','VIRTUAL','filter','FreshdeskField','includeAll','findAll','rows','params','include','merge'];(function(_0x32ccac,_0x440dcd){var _0x26c26f=function(_0x7f57f3){while(--_0x7f57f3){_0x32ccac['push'](_0x32ccac['shift']());}};_0x26c26f(++_0x440dcd);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x4bc5d9,_0x56062a){_0x4bc5d9=_0x4bc5d9-0x0;var _0x3ae474=_0x3e5c[_0x4bc5d9];return _0x3ae474;};'use strict';var emlformat=require(_0xc3e5('0x0'));var rimraf=require(_0xc3e5('0x1'));var zipdir=require(_0xc3e5('0x2'));var jsonpatch=require(_0xc3e5('0x3'));var rp=require('request-promise');var moment=require(_0xc3e5('0x4'));var BPromise=require(_0xc3e5('0x5'));var Mustache=require(_0xc3e5('0x6'));var util=require(_0xc3e5('0x7'));var path=require(_0xc3e5('0x8'));var sox=require(_0xc3e5('0x9'));var csv=require('to-csv');var ejs=require(_0xc3e5('0xa'));var fs=require('fs');var fs_extra=require(_0xc3e5('0xb'));var _=require(_0xc3e5('0xc'));var squel=require(_0xc3e5('0xd'));var crypto=require(_0xc3e5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3e5('0xf'));var toCsv=require(_0xc3e5('0x10'));var querystring=require(_0xc3e5('0x11'));var Papa=require(_0xc3e5('0x12'));var Redis=require(_0xc3e5('0x13'));var authService=require(_0xc3e5('0x14'));var qs=require(_0xc3e5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3e5('0x16'));var logger=require(_0xc3e5('0x17'))(_0xc3e5('0x18'));var utils=require(_0xc3e5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc3e5('0x1a'));var db=require(_0xc3e5('0x1b'))['db'];function respondWithStatusCode(_0x36193e,_0x3f0395){_0x3f0395=_0x3f0395||0xcc;return function(_0x3b7441){if(_0x3b7441){return _0x36193e[_0xc3e5('0x1c')](_0x3f0395);}return _0x36193e['status'](_0x3f0395)['end']();};}function respondWithResult(_0x52cca7,_0x27c226){_0x27c226=_0x27c226||0xc8;return function(_0x5a52f1){if(_0x5a52f1){return _0x52cca7[_0xc3e5('0x1d')](_0x27c226)[_0xc3e5('0x1e')](_0x5a52f1);}};}function respondWithFilteredResult(_0x4d1ad9,_0x353dc0){return function(_0x3e3eaa){if(_0x3e3eaa){var _0x2cc476=typeof _0x353dc0[_0xc3e5('0x1f')]===_0xc3e5('0x20')&&typeof _0x353dc0['limit']===_0xc3e5('0x20');var _0x277063=_0x3e3eaa[_0xc3e5('0x21')];var _0xa33d84=_0x2cc476?0x0:_0x353dc0[_0xc3e5('0x1f')];var _0x1e1eea=_0x2cc476?_0x3e3eaa['count']:_0x353dc0[_0xc3e5('0x1f')]+_0x353dc0[_0xc3e5('0x22')];var _0x4a1d86;if(_0x1e1eea>=_0x277063){_0x1e1eea=_0x277063;_0x4a1d86=0xc8;}else{_0x4a1d86=0xce;}_0x4d1ad9[_0xc3e5('0x1d')](_0x4a1d86);return _0x4d1ad9['set'](_0xc3e5('0x23'),_0xa33d84+'-'+_0x1e1eea+'/'+_0x277063)[_0xc3e5('0x1e')](_0x3e3eaa);}return null;};}function patchUpdates(_0x2d551b){return function(_0xebf6dc){try{jsonpatch[_0xc3e5('0x24')](_0xebf6dc,_0x2d551b,!![]);}catch(_0x4a7806){return BPromise[_0xc3e5('0x25')](_0x4a7806);}return _0xebf6dc[_0xc3e5('0x26')]();};}function saveUpdates(_0x2d8c6f,_0x3eb513){return function(_0x414ba9){if(_0x414ba9){return _0x414ba9[_0xc3e5('0x27')](_0x2d8c6f)[_0xc3e5('0x28')](function(_0x47f344){return _0x47f344;});}return null;};}function removeEntity(_0x3a2800,_0x430cb4){return function(_0x43d01e){if(_0x43d01e){return _0x43d01e[_0xc3e5('0x29')]()[_0xc3e5('0x28')](function(){_0x3a2800[_0xc3e5('0x1d')](0xcc)[_0xc3e5('0x2a')]();});}};}function handleEntityNotFound(_0x45556e,_0x564748){return function(_0x25d3a3){if(!_0x25d3a3){_0x45556e['sendStatus'](0x194);}return _0x25d3a3;};}function handleError(_0x4c0cf4,_0x8815af){_0x8815af=_0x8815af||0x1f4;return function(_0x12ad6e){logger[_0xc3e5('0x2b')](_0x12ad6e['stack']);if(_0x12ad6e[_0xc3e5('0x2c')]){delete _0x12ad6e[_0xc3e5('0x2c')];}_0x4c0cf4[_0xc3e5('0x1d')](_0x8815af)[_0xc3e5('0x2d')](_0x12ad6e);};}exports['index']=function(_0xa6766d,_0x497ecf){var _0x45ca6d={},_0xc0e6e7={},_0xc58f2b={'count':0x0,'rows':[]};var _0x5a2d41=_['map'](db['FreshdeskField'][_0xc3e5('0x2e')],function(_0x45cd9c){return{'name':_0x45cd9c[_0xc3e5('0x2f')],'type':_0x45cd9c[_0xc3e5('0x30')][_0xc3e5('0x31')]};});_0xc0e6e7[_0xc3e5('0x32')]=_['map'](_0x5a2d41,_0xc3e5('0x2c'));_0xc0e6e7[_0xc3e5('0x33')]=_[_0xc3e5('0x34')](_0xa6766d[_0xc3e5('0x33')]);_0xc0e6e7[_0xc3e5('0x35')]=_[_0xc3e5('0x36')](_0xc0e6e7[_0xc3e5('0x32')],_0xc0e6e7[_0xc3e5('0x33')]);_0x45ca6d[_0xc3e5('0x37')]=_[_0xc3e5('0x36')](_0xc0e6e7[_0xc3e5('0x32')],qs['fields'](_0xa6766d[_0xc3e5('0x33')]['fields']));_0x45ca6d[_0xc3e5('0x37')]=_0x45ca6d[_0xc3e5('0x37')][_0xc3e5('0x38')]?_0x45ca6d[_0xc3e5('0x37')]:_0xc0e6e7['model'];if(!_0xa6766d[_0xc3e5('0x33')]['hasOwnProperty']('nolimit')){_0x45ca6d[_0xc3e5('0x22')]=qs['limit'](_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x22')]);_0x45ca6d[_0xc3e5('0x1f')]=qs[_0xc3e5('0x1f')](_0xa6766d[_0xc3e5('0x33')]['offset']);}_0x45ca6d[_0xc3e5('0x39')]=qs[_0xc3e5('0x3a')](_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x3a')]);_0x45ca6d[_0xc3e5('0x3b')]=qs['filters'](_[_0xc3e5('0x3c')](_0xa6766d['query'],_0xc0e6e7[_0xc3e5('0x35')]),_0x5a2d41);if(_0xa6766d[_0xc3e5('0x33')]['filter']){_0x45ca6d[_0xc3e5('0x3b')]=_['merge'](_0x45ca6d[_0xc3e5('0x3b')],{'$or':_[_0xc3e5('0x3d')](_0x5a2d41,function(_0x3e7333){if(_0x3e7333['type']!==_0xc3e5('0x3e')){var _0x3c496f={};_0x3c496f[_0x3e7333[_0xc3e5('0x2c')]]={'$like':'%'+_0xa6766d[_0xc3e5('0x33')][_0xc3e5('0x3f')]+'%'};return _0x3c496f;}})});}_0x45ca6d=_['merge']({},_0x45ca6d,_0xa6766d['options']);var _0x5ebe00={'where':_0x45ca6d[_0xc3e5('0x3b')]};return db[_0xc3e5('0x40')]['count'](_0x5ebe00)[_0xc3e5('0x28')](function(_0x5b100d){_0xc58f2b[_0xc3e5('0x21')]=_0x5b100d;if(_0xa6766d['query'][_0xc3e5('0x41')]){_0x45ca6d['include']=[{'all':!![]}];}return db[_0xc3e5('0x40')][_0xc3e5('0x42')](_0x45ca6d);})[_0xc3e5('0x28')](function(_0x1c5177){_0xc58f2b[_0xc3e5('0x43')]=_0x1c5177;return _0xc58f2b;})[_0xc3e5('0x28')](respondWithFilteredResult(_0x497ecf,_0x45ca6d))['catch'](handleError(_0x497ecf,null));};exports['show']=function(_0x3213d3,_0x5f4328){var _0x3f0887={'raw':!![],'where':{'id':_0x3213d3[_0xc3e5('0x44')]['id']}},_0x27354c={};_0x27354c[_0xc3e5('0x32')]=_[_0xc3e5('0x34')](db[_0xc3e5('0x40')]['rawAttributes']);_0x27354c[_0xc3e5('0x33')]=_[_0xc3e5('0x34')](_0x3213d3[_0xc3e5('0x33')]);_0x27354c[_0xc3e5('0x35')]=_[_0xc3e5('0x36')](_0x27354c[_0xc3e5('0x32')],_0x27354c[_0xc3e5('0x33')]);_0x3f0887[_0xc3e5('0x37')]=_[_0xc3e5('0x36')](_0x27354c[_0xc3e5('0x32')],qs['fields'](_0x3213d3['query']['fields']));_0x3f0887[_0xc3e5('0x37')]=_0x3f0887['attributes'][_0xc3e5('0x38')]?_0x3f0887[_0xc3e5('0x37')]:_0x27354c[_0xc3e5('0x32')];if(_0x3213d3[_0xc3e5('0x33')]['includeAll']){_0x3f0887[_0xc3e5('0x45')]=[{'all':!![]}];}_0x3f0887=_[_0xc3e5('0x46')]({},_0x3f0887,_0x3213d3[_0xc3e5('0x47')]);return db[_0xc3e5('0x40')]['find'](_0x3f0887)['then'](handleEntityNotFound(_0x5f4328,null))[_0xc3e5('0x28')](respondWithResult(_0x5f4328,null))[_0xc3e5('0x48')](handleError(_0x5f4328,null));};exports['create']=function(_0x12cc80,_0x4c9b0b){return db[_0xc3e5('0x40')]['create'](_0x12cc80[_0xc3e5('0x49')],{})['then'](respondWithResult(_0x4c9b0b,0xc9))['catch'](handleError(_0x4c9b0b,null));};exports['update']=function(_0x87855d,_0x11da7e){if(_0x87855d[_0xc3e5('0x49')]['id']){delete _0x87855d['body']['id'];}return db['FreshdeskField'][_0xc3e5('0x4a')]({'where':{'id':_0x87855d['params']['id']}})[_0xc3e5('0x28')](handleEntityNotFound(_0x11da7e,null))[_0xc3e5('0x28')](saveUpdates(_0x87855d[_0xc3e5('0x49')],null))[_0xc3e5('0x28')](respondWithResult(_0x11da7e,null))[_0xc3e5('0x48')](handleError(_0x11da7e,null));};exports[_0xc3e5('0x29')]=function(_0x5cd31c,_0x27924f){return db['FreshdeskField']['find']({'where':{'id':_0x5cd31c[_0xc3e5('0x44')]['id']}})['then'](handleEntityNotFound(_0x27924f,null))[_0xc3e5('0x28')](removeEntity(_0x27924f,null))['catch'](handleError(_0x27924f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index cfa6e66..6b1fa73 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.model.js +++ b/server/api/intFreshdeskField/intFreshdeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4559=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x594f2e,_0x2023e4){var _0x2ea839=function(_0x3b7473){while(--_0x3b7473){_0x594f2e['push'](_0x594f2e['shift']());}};_0x2ea839(++_0x2023e4);}(_0x4559,0xfe));var _0x9455=function(_0x53b398,_0x39bfd8){_0x53b398=_0x53b398-0x0;var _0x32c9ed=_0x4559[_0x53b398];return _0x32c9ed;};'use strict';var _=require(_0x9455('0x0'));var util=require('util');var logger=require(_0x9455('0x1'))(_0x9455('0x2'));var moment=require(_0x9455('0x3'));var BPromise=require(_0x9455('0x4'));var rp=require(_0x9455('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9455('0x6'));var config=require(_0x9455('0x7'));var attributes=require(_0x9455('0x8'));module[_0x9455('0x9')]=function(_0x3efe24,_0x7f3018){return _0x3efe24[_0x9455('0xa')](_0x9455('0xb'),attributes,{'tableName':_0x9455('0xc'),'paranoid':![],'indexes':[{'name':_0x9455('0xd'),'fields':['idField',_0x9455('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe562=['../../config/logger','api','bluebird','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','FieldId','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe562,0x6b));var _0x2e56=function(_0x4af885,_0x4a9a9f){_0x4af885=_0x4af885-0x0;var _0x28e4ba=_0xe562[_0x4af885];return _0x28e4ba;};'use strict';var _=require(_0x2e56('0x0'));var util=require('util');var logger=require(_0x2e56('0x1'))(_0x2e56('0x2'));var moment=require('moment');var BPromise=require(_0x2e56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e56('0x4'));var rimraf=require(_0x2e56('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e56('0x6'));module[_0x2e56('0x7')]=function(_0x83d773,_0x5aa09c){return _0x83d773[_0x2e56('0x8')](_0x2e56('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2e56('0xa'),'fields':['idField',_0x2e56('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c907911..e434d54 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42fc=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0xbaf0a2,_0x535c10){var _0x3dbe0a=function(_0x16fb09){while(--_0x16fb09){_0xbaf0a2['push'](_0xbaf0a2['shift']());}};_0x3dbe0a(++_0x535c10);}(_0x42fc,0xa9));var _0xc42f=function(_0x405cac,_0x39f2d7){_0x405cac=_0x405cac-0x0;var _0x670644=_0x42fc[_0x405cac];return _0x670644;};'use strict';var _=require(_0xc42f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc42f('0x1'));var rs=require(_0xc42f('0x2'));var fs=require('fs');var Redis=require(_0xc42f('0x3'));var db=require(_0xc42f('0x4'))['db'];var utils=require(_0xc42f('0x5'));var logger=require(_0xc42f('0x6'))('rpc');var config=require(_0xc42f('0x7'));var jayson=require(_0xc42f('0x8'));var client=jayson[_0xc42f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc39c40,_0x2771e2,_0x43b419){return new BPromise(function(_0x5f1bcc,_0xd1819c){return client[_0xc42f('0xa')](_0xc39c40,_0x43b419)[_0xc42f('0xb')](function(_0x4ba56e){logger[_0xc42f('0xc')](_0xc42f('0xd'),_0x2771e2,'request\x20sent');logger['debug'](_0xc42f('0xe'),_0x2771e2,'request\x20sent',JSON[_0xc42f('0xf')](_0x4ba56e));if(_0x4ba56e['error']){if(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x11')]===0x1f4){logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x4ba56e['error'][_0xc42f('0x12')]);return _0xd1819c(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x12')]);}logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x4ba56e['error'][_0xc42f('0x12')]);return _0x5f1bcc(_0x4ba56e[_0xc42f('0x10')][_0xc42f('0x12')]);}else{logger[_0xc42f('0xc')](_0xc42f('0xd'),_0x2771e2,_0xc42f('0x13'));_0x5f1bcc(_0x4ba56e[_0xc42f('0x14')]['message']);}})['catch'](function(_0x280686){logger[_0xc42f('0x10')](_0xc42f('0xd'),_0x2771e2,_0x280686);_0xd1819c(_0x280686);});});} \ No newline at end of file +var _0x235a=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x235a,0xf8));var _0xa235=function(_0x5ca290,_0x2e6086){_0x5ca290=_0x5ca290-0x0;var _0xa525ec=_0x235a[_0x5ca290];return _0xa525ec;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require(_0xa235('0x3'));var rs=require(_0xa235('0x4'));var fs=require('fs');var Redis=require(_0xa235('0x5'));var db=require(_0xa235('0x6'))['db'];var utils=require(_0xa235('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa235('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa235('0x9')][_0xa235('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41c318,_0x4c2213,_0x1fc590){return new BPromise(function(_0xc1482f,_0x572b07){return client[_0xa235('0xb')](_0x41c318,_0x1fc590)[_0xa235('0xc')](function(_0x140865){logger[_0xa235('0xd')](_0xa235('0xe'),_0x4c2213,_0xa235('0xf'));logger['debug'](_0xa235('0x10'),_0x4c2213,_0xa235('0xf'),JSON[_0xa235('0x11')](_0x140865));if(_0x140865['error']){if(_0x140865[_0xa235('0x12')][_0xa235('0x13')]===0x1f4){logger[_0xa235('0x12')](_0xa235('0xe'),_0x4c2213,_0x140865[_0xa235('0x12')][_0xa235('0x14')]);return _0x572b07(_0x140865[_0xa235('0x12')][_0xa235('0x14')]);}logger[_0xa235('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4c2213,_0x140865[_0xa235('0x12')][_0xa235('0x14')]);return _0xc1482f(_0x140865[_0xa235('0x12')][_0xa235('0x14')]);}else{logger[_0xa235('0xd')](_0xa235('0xe'),_0x4c2213,_0xa235('0xf'));_0xc1482f(_0x140865[_0xa235('0x15')][_0xa235('0x14')]);}})[_0xa235('0x16')](function(_0x186ac4){logger[_0xa235('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x4c2213,_0x186ac4);_0x572b07(_0x186ac4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index d21c66c..5d00c26 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76dc=['../../components/interaction/service','get','isAuthenticated','index','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x4303fa,_0x5531b1){var _0x3e2780=function(_0x3c1db6){while(--_0x3c1db6){_0x4303fa['push'](_0x4303fa['shift']());}};_0x3e2780(++_0x5531b1);}(_0x76dc,0x1f2));var _0xc76d=function(_0x2b9dd3,_0x547a88){_0x2b9dd3=_0x2b9dd3-0x0;var _0x1036db=_0x76dc[_0x2b9dd3];return _0x1036db;};'use strict';var multer=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var path=require(_0xc76d('0x2'));var timeout=require(_0xc76d('0x3'));var express=require('express');var router=express[_0xc76d('0x4')]();var fs_extra=require(_0xc76d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc76d('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xc76d('0x7')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0x9')]);router['get']('/:id',auth[_0xc76d('0x8')](),controller[_0xc76d('0xa')]);router[_0xc76d('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc76d('0xb')]);router[_0xc76d('0x7')]('/:id/fields',auth[_0xc76d('0x8')](),controller['getFields']);router[_0xc76d('0xc')]('/',auth[_0xc76d('0x8')](),controller[_0xc76d('0xd')]);router[_0xc76d('0xc')](_0xc76d('0xe'),auth[_0xc76d('0x8')](),controller[_0xc76d('0xf')]);router[_0xc76d('0x10')](_0xc76d('0x11'),auth[_0xc76d('0x8')](),controller[_0xc76d('0x12')]);router[_0xc76d('0x13')](_0xc76d('0x11'),auth[_0xc76d('0x8')](),controller['destroy']);module[_0xc76d('0x14')]=router; \ No newline at end of file +var _0xab40=['../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xab40,0xcd));var _0x0ab4=function(_0x15927b,_0x14c98a){_0x15927b=_0x15927b-0x0;var _0x21155f=_0xab40[_0x15927b];return _0x21155f;};'use strict';var multer=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ab4('0x2')]();var fs_extra=require(_0x0ab4('0x3'));var auth=require(_0x0ab4('0x4'));var interaction=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x0ab4('0x7')](),controller['index']);router[_0x0ab4('0x8')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xa')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0ab4('0xb')]);router[_0x0ab4('0x8')](_0x0ab4('0xc'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xd')]);router[_0x0ab4('0xe')]('/',auth[_0x0ab4('0x7')](),controller[_0x0ab4('0xf')]);router['post']('/:id/configurations',auth[_0x0ab4('0x7')](),controller['addConfiguration']);router[_0x0ab4('0x10')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0x11')]);router[_0x0ab4('0x12')](_0x0ab4('0x9'),auth[_0x0ab4('0x7')](),controller[_0x0ab4('0x13')]);module[_0x0ab4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index fd08e39..48cfd57 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x17aa5b,_0x3cd9c3){var _0x28bd36=function(_0x3230d4){while(--_0x3230d4){_0x17aa5b['push'](_0x17aa5b['shift']());}};_0x28bd36(++_0x3cd9c3);}(_0x4213,0x77));var _0x3421=function(_0x30813a,_0x5bb99b){_0x30813a=_0x30813a-0x0;var _0x4e9370=_0x4213[_0x30813a];return _0x4e9370;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x4b17=['username','sequelize','STRING'];(function(_0x129602,_0x35ae9e){var _0x57ffaa=function(_0x7d1dc5){while(--_0x7d1dc5){_0x129602['push'](_0x129602['shift']());}};_0x57ffaa(++_0x35ae9e);}(_0x4b17,0x10f));var _0x74b1=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0x4b17[_0x2d126e];return _0xcb04d3;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a20b2f3..7c92ba1 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe588=['find','getConfigurations','findOne','FreshsalesConfiguration','order','Subjects','channel','Descriptions','getDescriptions','create','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','includeAll','body'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe588,0xe1));var _0x8e58=function(_0x2e1ced,_0xcaf2d1){_0x2e1ced=_0x2e1ced-0x0;var _0x56fbf1=_0xe588[_0x2e1ced];return _0x56fbf1;};'use strict';var emlformat=require(_0x8e58('0x0'));var rimraf=require(_0x8e58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8e58('0x2'));var moment=require(_0x8e58('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e58('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e58('0x5'));var fs=require('fs');var fs_extra=require(_0x8e58('0x6'));var _=require(_0x8e58('0x7'));var squel=require(_0x8e58('0x8'));var crypto=require(_0x8e58('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8e58('0xa'));var toCsv=require(_0x8e58('0xb'));var querystring=require(_0x8e58('0xc'));var Papa=require('papaparse');var Redis=require(_0x8e58('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8e58('0xe'));var as=require(_0x8e58('0xf'));var hardwareService=require(_0x8e58('0x10'));var logger=require('../../config/logger')(_0x8e58('0x11'));var utils=require(_0x8e58('0x12'));var config=require(_0x8e58('0x13'));var licenseUtil=require(_0x8e58('0x14'));var db=require(_0x8e58('0x15'))['db'];var integrations=require(_0x8e58('0x16'));function respondWithStatusCode(_0x320153,_0x3969d7){_0x3969d7=_0x3969d7||0xcc;return function(_0x3c9838){if(_0x3c9838){return _0x320153[_0x8e58('0x17')](_0x3969d7);}return _0x320153[_0x8e58('0x18')](_0x3969d7)[_0x8e58('0x19')]();};}function respondWithResult(_0x5b5628,_0x38b3f6){_0x38b3f6=_0x38b3f6||0xc8;return function(_0x317849){if(_0x317849){return _0x5b5628[_0x8e58('0x18')](_0x38b3f6)['json'](_0x317849);}};}function respondWithFilteredResult(_0x2b3a8b,_0x1d68a2){return function(_0x4acae4){if(_0x4acae4){var _0x518e12=typeof _0x1d68a2['offset']===_0x8e58('0x1a')&&typeof _0x1d68a2[_0x8e58('0x1b')]===_0x8e58('0x1a');var _0x12863a=_0x4acae4['count'];var _0x36daed=_0x518e12?0x0:_0x1d68a2['offset'];var _0xe5892b=_0x518e12?_0x4acae4[_0x8e58('0x1c')]:_0x1d68a2[_0x8e58('0x1d')]+_0x1d68a2[_0x8e58('0x1b')];var _0x599f5e;if(_0xe5892b>=_0x12863a){_0xe5892b=_0x12863a;_0x599f5e=0xc8;}else{_0x599f5e=0xce;}_0x2b3a8b[_0x8e58('0x18')](_0x599f5e);return _0x2b3a8b[_0x8e58('0x1e')](_0x8e58('0x1f'),_0x36daed+'-'+_0xe5892b+'/'+_0x12863a)[_0x8e58('0x20')](_0x4acae4);}return null;};}function patchUpdates(_0x922726){return function(_0x522294){try{jsonpatch[_0x8e58('0x21')](_0x522294,_0x922726,!![]);}catch(_0x162c31){return BPromise[_0x8e58('0x22')](_0x162c31);}return _0x522294[_0x8e58('0x23')]();};}function saveUpdates(_0xe243c3,_0x5318dc){return function(_0x408655){if(_0x408655){return _0x408655[_0x8e58('0x24')](_0xe243c3)[_0x8e58('0x25')](function(_0x17aa6f){return _0x17aa6f;});}return null;};}function removeEntity(_0x55707d,_0x24caec){return function(_0x31280e){if(_0x31280e){return _0x31280e[_0x8e58('0x26')]()[_0x8e58('0x25')](function(){_0x55707d['status'](0xcc)[_0x8e58('0x19')]();});}};}function handleEntityNotFound(_0x327c2b,_0x5113a6){return function(_0x544142){if(!_0x544142){_0x327c2b[_0x8e58('0x17')](0x194);}return _0x544142;};}function handleError(_0x5567c7,_0x5688f9){_0x5688f9=_0x5688f9||0x1f4;return function(_0x13d3e1){logger[_0x8e58('0x27')](_0x13d3e1['stack']);if(_0x13d3e1[_0x8e58('0x28')]){delete _0x13d3e1['name'];}_0x5567c7[_0x8e58('0x18')](_0x5688f9)[_0x8e58('0x29')](_0x13d3e1);};}exports[_0x8e58('0x2a')]=function(_0x3a9850,_0x1cec58){var _0x3d4259={},_0x4e051e={},_0x2eec31={'count':0x0,'rows':[]};var _0x33c458=_[_0x8e58('0x2b')](db[_0x8e58('0x2c')][_0x8e58('0x2d')],function(_0x4132c2){return{'name':_0x4132c2[_0x8e58('0x2e')],'type':_0x4132c2[_0x8e58('0x2f')][_0x8e58('0x30')]};});_0x4e051e[_0x8e58('0x31')]=_[_0x8e58('0x2b')](_0x33c458,_0x8e58('0x28'));_0x4e051e[_0x8e58('0x32')]=_[_0x8e58('0x33')](_0x3a9850['query']);_0x4e051e[_0x8e58('0x34')]=_[_0x8e58('0x35')](_0x4e051e['model'],_0x4e051e[_0x8e58('0x32')]);_0x3d4259['attributes']=_[_0x8e58('0x35')](_0x4e051e[_0x8e58('0x31')],qs[_0x8e58('0x36')](_0x3a9850[_0x8e58('0x32')]['fields']));_0x3d4259[_0x8e58('0x37')]=_0x3d4259[_0x8e58('0x37')][_0x8e58('0x38')]?_0x3d4259[_0x8e58('0x37')]:_0x4e051e['model'];if(!_0x3a9850[_0x8e58('0x32')][_0x8e58('0x39')](_0x8e58('0x3a'))){_0x3d4259['limit']=qs[_0x8e58('0x1b')](_0x3a9850[_0x8e58('0x32')][_0x8e58('0x1b')]);_0x3d4259['offset']=qs[_0x8e58('0x1d')](_0x3a9850[_0x8e58('0x32')]['offset']);}_0x3d4259['order']=qs[_0x8e58('0x3b')](_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3b')]);_0x3d4259['where']=qs[_0x8e58('0x34')](_['pick'](_0x3a9850[_0x8e58('0x32')],_0x4e051e[_0x8e58('0x34')]),_0x33c458);if(_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3c')]){_0x3d4259['where']=_[_0x8e58('0x3d')](_0x3d4259[_0x8e58('0x3e')],{'$or':_[_0x8e58('0x2b')](_0x33c458,function(_0x4cd652){if(_0x4cd652[_0x8e58('0x2f')]!==_0x8e58('0x3f')){var _0x302c83={};_0x302c83[_0x4cd652[_0x8e58('0x28')]]={'$like':'%'+_0x3a9850[_0x8e58('0x32')][_0x8e58('0x3c')]+'%'};return _0x302c83;}})});}_0x3d4259=_['merge']({},_0x3d4259,_0x3a9850[_0x8e58('0x40')]);var _0x37187f={'where':_0x3d4259[_0x8e58('0x3e')]};return db[_0x8e58('0x2c')][_0x8e58('0x1c')](_0x37187f)[_0x8e58('0x25')](function(_0x4847e9){_0x2eec31[_0x8e58('0x1c')]=_0x4847e9;if(_0x3a9850[_0x8e58('0x32')]['includeAll']){_0x3d4259[_0x8e58('0x41')]=[{'all':!![]}];}return db[_0x8e58('0x2c')]['findAll'](_0x3d4259);})[_0x8e58('0x25')](function(_0x4240da){_0x2eec31[_0x8e58('0x42')]=_0x4240da;return _0x2eec31;})[_0x8e58('0x25')](respondWithFilteredResult(_0x1cec58,_0x3d4259))[_0x8e58('0x43')](handleError(_0x1cec58,null));};exports[_0x8e58('0x44')]=function(_0x166453,_0x5ce2eb){var _0x721dc={'raw':![],'where':{'id':_0x166453[_0x8e58('0x45')]['id']}},_0x552a97={};_0x552a97[_0x8e58('0x31')]=_[_0x8e58('0x33')](db[_0x8e58('0x2c')]['rawAttributes']);_0x552a97['query']=_['keys'](_0x166453[_0x8e58('0x32')]);_0x552a97[_0x8e58('0x34')]=_[_0x8e58('0x35')](_0x552a97[_0x8e58('0x31')],_0x552a97['query']);_0x721dc['attributes']=_[_0x8e58('0x35')](_0x552a97[_0x8e58('0x31')],qs[_0x8e58('0x36')](_0x166453[_0x8e58('0x32')]['fields']));_0x721dc[_0x8e58('0x37')]=_0x721dc[_0x8e58('0x37')][_0x8e58('0x38')]?_0x721dc[_0x8e58('0x37')]:_0x552a97[_0x8e58('0x31')];if(_0x166453[_0x8e58('0x32')][_0x8e58('0x46')]){_0x721dc[_0x8e58('0x41')]=[{'all':!![]}];}_0x721dc=_[_0x8e58('0x3d')]({},_0x721dc,_0x166453[_0x8e58('0x40')]);return db[_0x8e58('0x2c')]['find'](_0x721dc)[_0x8e58('0x25')](handleEntityNotFound(_0x5ce2eb,null))[_0x8e58('0x25')](respondWithResult(_0x5ce2eb,null))[_0x8e58('0x43')](handleError(_0x5ce2eb,null));};exports['create']=function(_0x7b4a9a,_0x597f95){return db['FreshsalesAccount']['create'](_0x7b4a9a[_0x8e58('0x47')],{})[_0x8e58('0x25')](respondWithResult(_0x597f95,0xc9))['catch'](handleError(_0x597f95,null));};exports[_0x8e58('0x24')]=function(_0x1998a4,_0x16efca){if(_0x1998a4[_0x8e58('0x47')]['id']){delete _0x1998a4[_0x8e58('0x47')]['id'];}return db[_0x8e58('0x2c')][_0x8e58('0x48')]({'where':{'id':_0x1998a4['params']['id']}})[_0x8e58('0x25')](handleEntityNotFound(_0x16efca,null))[_0x8e58('0x25')](saveUpdates(_0x1998a4[_0x8e58('0x47')],null))[_0x8e58('0x25')](respondWithResult(_0x16efca,null))[_0x8e58('0x43')](handleError(_0x16efca,null));};exports[_0x8e58('0x26')]=function(_0x3884af,_0x4af1ec){return db[_0x8e58('0x2c')][_0x8e58('0x48')]({'where':{'id':_0x3884af['params']['id']}})[_0x8e58('0x25')](handleEntityNotFound(_0x4af1ec,null))[_0x8e58('0x25')](removeEntity(_0x4af1ec,null))[_0x8e58('0x43')](handleError(_0x4af1ec,null));};exports[_0x8e58('0x49')]=function(_0x431a2a,_0x174ba7,_0x2f7920){var _0x3eefa5={};var _0xee473a={};var _0xc14e81;var _0xa5c55b;return db[_0x8e58('0x2c')][_0x8e58('0x4a')]({'where':{'id':_0x431a2a[_0x8e58('0x45')]['id']}})['then'](handleEntityNotFound(_0x174ba7,null))[_0x8e58('0x25')](function(_0x2d4745){if(_0x2d4745){_0xc14e81=_0x2d4745;_0xee473a[_0x8e58('0x31')]=_[_0x8e58('0x33')](db[_0x8e58('0x4b')][_0x8e58('0x2d')]);_0xee473a['query']=_['keys'](_0x431a2a['query']);_0xee473a['filters']=_[_0x8e58('0x35')](_0xee473a[_0x8e58('0x31')],_0xee473a['query']);_0x3eefa5[_0x8e58('0x37')]=_['intersection'](_0xee473a[_0x8e58('0x31')],qs['fields'](_0x431a2a['query'][_0x8e58('0x36')]));_0x3eefa5[_0x8e58('0x37')]=_0x3eefa5[_0x8e58('0x37')]['length']?_0x3eefa5[_0x8e58('0x37')]:_0xee473a[_0x8e58('0x31')];_0x3eefa5[_0x8e58('0x4c')]=qs[_0x8e58('0x3b')](_0x431a2a[_0x8e58('0x32')][_0x8e58('0x3b')]);_0x3eefa5['where']=qs[_0x8e58('0x34')](_['pick'](_0x431a2a[_0x8e58('0x32')],_0xee473a[_0x8e58('0x34')]));if(_0x431a2a[_0x8e58('0x32')]['filter']){_0x3eefa5[_0x8e58('0x3e')]=_['merge'](_0x3eefa5[_0x8e58('0x3e')],{'$or':_['map'](_0x3eefa5[_0x8e58('0x37')],function(_0x15edd7){var _0xbc0a28={};_0xbc0a28[_0x15edd7]={'$like':'%'+_0x431a2a['query'][_0x8e58('0x3c')]+'%'};return _0xbc0a28;})});}_0x3eefa5=_['merge']({},_0x3eefa5,_0x431a2a['options']);return _0xc14e81[_0x8e58('0x49')](_0x3eefa5);}})['then'](function(_0x500bdc){if(_0x500bdc){_0xa5c55b=_0x500bdc['length'];if(!_0x431a2a['query'][_0x8e58('0x39')](_0x8e58('0x3a'))){_0x3eefa5['limit']=qs[_0x8e58('0x1b')](_0x431a2a['query'][_0x8e58('0x1b')]);_0x3eefa5[_0x8e58('0x1d')]=qs[_0x8e58('0x1d')](_0x431a2a[_0x8e58('0x32')][_0x8e58('0x1d')]);}return _0xc14e81['getConfigurations'](_0x3eefa5);}})[_0x8e58('0x25')](function(_0x145921){if(_0x145921){return _0x145921?{'count':_0xa5c55b,'rows':_0x145921}:null;}})[_0x8e58('0x25')](respondWithResult(_0x174ba7,null))['catch'](handleError(_0x174ba7,null));};exports['addConfiguration']=function(_0x4df736,_0x597a7b,_0x2c1e64){if(_0x4df736[_0x8e58('0x47')]['id']){delete _0x4df736[_0x8e58('0x47')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x4df736[_0x8e58('0x45')]['id']}})['then'](handleEntityNotFound(_0x597a7b,null))[_0x8e58('0x25')](function(_0x5d0454){if(_0x5d0454){_0x4df736[_0x8e58('0x47')]['AccountId']=_0x5d0454['id'];_0x4df736[_0x8e58('0x47')][_0x8e58('0x4d')]=integrations['getSubjects'](_0x4df736[_0x8e58('0x47')][_0x8e58('0x4e')],_0x4df736[_0x8e58('0x47')]['type']);_0x4df736['body'][_0x8e58('0x4f')]=integrations[_0x8e58('0x50')](_0x4df736[_0x8e58('0x47')][_0x8e58('0x4e')],_0x4df736[_0x8e58('0x47')][_0x8e58('0x2f')]);return db[_0x8e58('0x4b')][_0x8e58('0x51')](_0x4df736[_0x8e58('0x47')],{'include':[{'model':db[_0x8e58('0x52')],'as':_0x8e58('0x4d')},{'model':db[_0x8e58('0x52')],'as':_0x8e58('0x4f')}]});}return null;})[_0x8e58('0x25')](respondWithResult(_0x597a7b,null))[_0x8e58('0x43')](handleError(_0x597a7b,null));};exports[_0x8e58('0x53')]=function(_0x3bdde2,_0x127fb7,_0x4f3733){var _0xcfbc21='';var _0x6578='';return db[_0x8e58('0x2c')]['findOne']({'where':{'id':_0x3bdde2[_0x8e58('0x45')]['id']},'attributes':['id',_0x8e58('0x54'),_0x8e58('0x55'),_0x8e58('0x56')]})[_0x8e58('0x25')](handleEntityNotFound(_0x127fb7,null))[_0x8e58('0x25')](function(_0x267cb2){if(_0x267cb2){_0x6578=_0x267cb2['username'];_0xcfbc21=_0x267cb2[_0x8e58('0x55')];var _0x14f778=_0x267cb2[_0x8e58('0x55')][_0x8e58('0x57')](-0x1);if(_0x14f778==='/'){_0xcfbc21=_0xcfbc21[_0x8e58('0x58')](0x0,_0xcfbc21[_0x8e58('0x59')](_0x14f778));}return rp({'method':_0x8e58('0x5a'),'uri':util[_0x8e58('0x5b')]('%s%s',_0xcfbc21,_0x8e58('0x5c')),'headers':{'Authorization':_0x8e58('0x5d')+_0x267cb2[_0x8e58('0x56')]},'json':!![]});}})[_0x8e58('0x25')](function(_0x3c70f8){if(_0x3c70f8){var _0x1b97d1=_0x3c70f8['users'];var _0x1d1837=![];var _0x3b0f89=null;for(_0x3b0f89=0x0;_0x3b0f89<_0x1b97d1[_0x8e58('0x38')];_0x3b0f89++){if(_0x1b97d1[_0x3b0f89]['email']===_0x6578){_0x1d1837=!![];}}if(_0x1d1837){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8e58('0x25')](respondWithResult(_0x127fb7,null))['catch'](function(_0x3dd5c8){var _0x214661=_0x3bdde2[_0x8e58('0x32')][_0x8e58('0x5e')]?0x1f4:_0x3dd5c8[_0x8e58('0x5f')]||0x1f4;logger[_0x8e58('0x27')](_0x8e58('0x60'),_0x8e58('0x53'),_0x214661,JSON[_0x8e58('0x61')](_0x3dd5c8));delete _0x3dd5c8[_0x8e58('0x28')];if(_0x214661===0x191){_0x214661=0x190;}_0x127fb7[_0x8e58('0x18')](_0x214661)[_0x8e58('0x29')](_0x3bdde2[_0x8e58('0x32')][_0x8e58('0x5e')]?{'message':_0x8e58('0x62'),'statusCode':_0x3dd5c8[_0x8e58('0x5f')]}:_0x3dd5c8);});}; \ No newline at end of file +var _0x6bc8=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','lastIndexOf','format','/api/selector/owners','Token\x20token=','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0x6bc8,0x19d));var _0x86bc=function(_0x395bdc,_0x279e62){_0x395bdc=_0x395bdc-0x0;var _0x10d6a4=_0x6bc8[_0x395bdc];return _0x10d6a4;};'use strict';var emlformat=require(_0x86bc('0x0'));var rimraf=require(_0x86bc('0x1'));var zipdir=require(_0x86bc('0x2'));var jsonpatch=require(_0x86bc('0x3'));var rp=require(_0x86bc('0x4'));var moment=require(_0x86bc('0x5'));var BPromise=require(_0x86bc('0x6'));var Mustache=require(_0x86bc('0x7'));var util=require('util');var path=require('path');var sox=require(_0x86bc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86bc('0x9'));var _=require(_0x86bc('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x86bc('0xb'));var deskjs=require(_0x86bc('0xc'));var toCsv=require(_0x86bc('0xd'));var querystring=require(_0x86bc('0xe'));var Papa=require('papaparse');var Redis=require(_0x86bc('0xf'));var authService=require(_0x86bc('0x10'));var qs=require(_0x86bc('0x11'));var as=require(_0x86bc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86bc('0x13'))(_0x86bc('0x14'));var utils=require(_0x86bc('0x15'));var config=require(_0x86bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x86bc('0x17'))['db'];var integrations=require(_0x86bc('0x18'));function respondWithStatusCode(_0x273b67,_0x3c67a5){_0x3c67a5=_0x3c67a5||0xcc;return function(_0x179922){if(_0x179922){return _0x273b67[_0x86bc('0x19')](_0x3c67a5);}return _0x273b67[_0x86bc('0x1a')](_0x3c67a5)[_0x86bc('0x1b')]();};}function respondWithResult(_0x5df97c,_0x469c66){_0x469c66=_0x469c66||0xc8;return function(_0x400450){if(_0x400450){return _0x5df97c['status'](_0x469c66)[_0x86bc('0x1c')](_0x400450);}};}function respondWithFilteredResult(_0x59e241,_0x1670dd){return function(_0x32bf67){if(_0x32bf67){var _0x5958c5=typeof _0x1670dd[_0x86bc('0x1d')]===_0x86bc('0x1e')&&typeof _0x1670dd[_0x86bc('0x1f')]===_0x86bc('0x1e');var _0x379b18=_0x32bf67[_0x86bc('0x20')];var _0x4f27ca=_0x5958c5?0x0:_0x1670dd['offset'];var _0x52b9ad=_0x5958c5?_0x32bf67[_0x86bc('0x20')]:_0x1670dd['offset']+_0x1670dd[_0x86bc('0x1f')];var _0x32de05;if(_0x52b9ad>=_0x379b18){_0x52b9ad=_0x379b18;_0x32de05=0xc8;}else{_0x32de05=0xce;}_0x59e241[_0x86bc('0x1a')](_0x32de05);return _0x59e241[_0x86bc('0x21')]('Content-Range',_0x4f27ca+'-'+_0x52b9ad+'/'+_0x379b18)[_0x86bc('0x1c')](_0x32bf67);}return null;};}function patchUpdates(_0x479295){return function(_0x24cd1a){try{jsonpatch[_0x86bc('0x22')](_0x24cd1a,_0x479295,!![]);}catch(_0x58fb7e){return BPromise['reject'](_0x58fb7e);}return _0x24cd1a[_0x86bc('0x23')]();};}function saveUpdates(_0x58567c,_0x31b9e6){return function(_0x19f944){if(_0x19f944){return _0x19f944[_0x86bc('0x24')](_0x58567c)[_0x86bc('0x25')](function(_0x411bca){return _0x411bca;});}return null;};}function removeEntity(_0x62a8c1,_0x429af7){return function(_0x193c20){if(_0x193c20){return _0x193c20[_0x86bc('0x26')]()[_0x86bc('0x25')](function(){_0x62a8c1[_0x86bc('0x1a')](0xcc)[_0x86bc('0x1b')]();});}};}function handleEntityNotFound(_0x2d388a,_0x32ff75){return function(_0x231c56){if(!_0x231c56){_0x2d388a['sendStatus'](0x194);}return _0x231c56;};}function handleError(_0x4d969f,_0x116515){_0x116515=_0x116515||0x1f4;return function(_0xadfd71){logger[_0x86bc('0x27')](_0xadfd71[_0x86bc('0x28')]);if(_0xadfd71[_0x86bc('0x29')]){delete _0xadfd71[_0x86bc('0x29')];}_0x4d969f[_0x86bc('0x1a')](_0x116515)[_0x86bc('0x2a')](_0xadfd71);};}exports[_0x86bc('0x2b')]=function(_0xe68aef,_0x1e7309){var _0x296a33={},_0x2ba51c={},_0x394f71={'count':0x0,'rows':[]};var _0x3a907b=_[_0x86bc('0x2c')](db[_0x86bc('0x2d')][_0x86bc('0x2e')],function(_0x4782eb){return{'name':_0x4782eb[_0x86bc('0x2f')],'type':_0x4782eb['type'][_0x86bc('0x30')]};});_0x2ba51c[_0x86bc('0x31')]=_[_0x86bc('0x2c')](_0x3a907b,_0x86bc('0x29'));_0x2ba51c[_0x86bc('0x32')]=_[_0x86bc('0x33')](_0xe68aef[_0x86bc('0x32')]);_0x2ba51c[_0x86bc('0x34')]=_[_0x86bc('0x35')](_0x2ba51c[_0x86bc('0x31')],_0x2ba51c['query']);_0x296a33[_0x86bc('0x36')]=_[_0x86bc('0x35')](_0x2ba51c[_0x86bc('0x31')],qs[_0x86bc('0x37')](_0xe68aef[_0x86bc('0x32')][_0x86bc('0x37')]));_0x296a33[_0x86bc('0x36')]=_0x296a33[_0x86bc('0x36')][_0x86bc('0x38')]?_0x296a33['attributes']:_0x2ba51c['model'];if(!_0xe68aef[_0x86bc('0x32')][_0x86bc('0x39')](_0x86bc('0x3a'))){_0x296a33[_0x86bc('0x1f')]=qs['limit'](_0xe68aef[_0x86bc('0x32')]['limit']);_0x296a33[_0x86bc('0x1d')]=qs[_0x86bc('0x1d')](_0xe68aef[_0x86bc('0x32')][_0x86bc('0x1d')]);}_0x296a33[_0x86bc('0x3b')]=qs[_0x86bc('0x3c')](_0xe68aef['query']['sort']);_0x296a33[_0x86bc('0x3d')]=qs[_0x86bc('0x34')](_[_0x86bc('0x3e')](_0xe68aef[_0x86bc('0x32')],_0x2ba51c['filters']),_0x3a907b);if(_0xe68aef[_0x86bc('0x32')][_0x86bc('0x3f')]){_0x296a33[_0x86bc('0x3d')]=_[_0x86bc('0x40')](_0x296a33['where'],{'$or':_[_0x86bc('0x2c')](_0x3a907b,function(_0x2fff82){if(_0x2fff82[_0x86bc('0x41')]!==_0x86bc('0x42')){var _0xdbfe3e={};_0xdbfe3e[_0x2fff82['name']]={'$like':'%'+_0xe68aef[_0x86bc('0x32')][_0x86bc('0x3f')]+'%'};return _0xdbfe3e;}})});}_0x296a33=_['merge']({},_0x296a33,_0xe68aef[_0x86bc('0x43')]);var _0x5bc7ef={'where':_0x296a33[_0x86bc('0x3d')]};return db['FreshsalesAccount'][_0x86bc('0x20')](_0x5bc7ef)['then'](function(_0x9f96c2){_0x394f71[_0x86bc('0x20')]=_0x9f96c2;if(_0xe68aef[_0x86bc('0x32')][_0x86bc('0x44')]){_0x296a33[_0x86bc('0x45')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x86bc('0x46')](_0x296a33);})[_0x86bc('0x25')](function(_0x3600be){_0x394f71['rows']=_0x3600be;return _0x394f71;})['then'](respondWithFilteredResult(_0x1e7309,_0x296a33))[_0x86bc('0x47')](handleError(_0x1e7309,null));};exports[_0x86bc('0x48')]=function(_0x30ca5d,_0x58c7fc){var _0x106632={'raw':![],'where':{'id':_0x30ca5d[_0x86bc('0x49')]['id']}},_0x4c2c62={};_0x4c2c62[_0x86bc('0x31')]=_[_0x86bc('0x33')](db['FreshsalesAccount'][_0x86bc('0x2e')]);_0x4c2c62['query']=_[_0x86bc('0x33')](_0x30ca5d[_0x86bc('0x32')]);_0x4c2c62[_0x86bc('0x34')]=_[_0x86bc('0x35')](_0x4c2c62['model'],_0x4c2c62[_0x86bc('0x32')]);_0x106632['attributes']=_[_0x86bc('0x35')](_0x4c2c62[_0x86bc('0x31')],qs['fields'](_0x30ca5d[_0x86bc('0x32')][_0x86bc('0x37')]));_0x106632[_0x86bc('0x36')]=_0x106632[_0x86bc('0x36')]['length']?_0x106632[_0x86bc('0x36')]:_0x4c2c62['model'];if(_0x30ca5d['query'][_0x86bc('0x44')]){_0x106632[_0x86bc('0x45')]=[{'all':!![]}];}_0x106632=_[_0x86bc('0x40')]({},_0x106632,_0x30ca5d[_0x86bc('0x43')]);return db[_0x86bc('0x2d')][_0x86bc('0x4a')](_0x106632)[_0x86bc('0x25')](handleEntityNotFound(_0x58c7fc,null))['then'](respondWithResult(_0x58c7fc,null))['catch'](handleError(_0x58c7fc,null));};exports[_0x86bc('0x4b')]=function(_0x39e8f5,_0x34191e){return db['FreshsalesAccount'][_0x86bc('0x4b')](_0x39e8f5[_0x86bc('0x4c')],{})[_0x86bc('0x25')](respondWithResult(_0x34191e,0xc9))[_0x86bc('0x47')](handleError(_0x34191e,null));};exports[_0x86bc('0x24')]=function(_0x1cc3a6,_0x3797bf){if(_0x1cc3a6[_0x86bc('0x4c')]['id']){delete _0x1cc3a6[_0x86bc('0x4c')]['id'];}return db[_0x86bc('0x2d')][_0x86bc('0x4a')]({'where':{'id':_0x1cc3a6['params']['id']}})[_0x86bc('0x25')](handleEntityNotFound(_0x3797bf,null))['then'](saveUpdates(_0x1cc3a6[_0x86bc('0x4c')],null))[_0x86bc('0x25')](respondWithResult(_0x3797bf,null))[_0x86bc('0x47')](handleError(_0x3797bf,null));};exports[_0x86bc('0x26')]=function(_0x321dc2,_0xd2329a){return db[_0x86bc('0x2d')][_0x86bc('0x4a')]({'where':{'id':_0x321dc2[_0x86bc('0x49')]['id']}})[_0x86bc('0x25')](handleEntityNotFound(_0xd2329a,null))['then'](removeEntity(_0xd2329a,null))[_0x86bc('0x47')](handleError(_0xd2329a,null));};exports[_0x86bc('0x4d')]=function(_0x2e4413,_0x2d62ec,_0x33094b){var _0x8556c9={};var _0x1cc7f9={};var _0x5abbaa;var _0x20be39;return db[_0x86bc('0x2d')][_0x86bc('0x4e')]({'where':{'id':_0x2e4413['params']['id']}})[_0x86bc('0x25')](handleEntityNotFound(_0x2d62ec,null))[_0x86bc('0x25')](function(_0x1f2166){if(_0x1f2166){_0x5abbaa=_0x1f2166;_0x1cc7f9[_0x86bc('0x31')]=_[_0x86bc('0x33')](db[_0x86bc('0x4f')][_0x86bc('0x2e')]);_0x1cc7f9[_0x86bc('0x32')]=_[_0x86bc('0x33')](_0x2e4413[_0x86bc('0x32')]);_0x1cc7f9[_0x86bc('0x34')]=_[_0x86bc('0x35')](_0x1cc7f9[_0x86bc('0x31')],_0x1cc7f9[_0x86bc('0x32')]);_0x8556c9['attributes']=_[_0x86bc('0x35')](_0x1cc7f9[_0x86bc('0x31')],qs[_0x86bc('0x37')](_0x2e4413[_0x86bc('0x32')][_0x86bc('0x37')]));_0x8556c9[_0x86bc('0x36')]=_0x8556c9['attributes'][_0x86bc('0x38')]?_0x8556c9[_0x86bc('0x36')]:_0x1cc7f9['model'];_0x8556c9[_0x86bc('0x3b')]=qs[_0x86bc('0x3c')](_0x2e4413[_0x86bc('0x32')][_0x86bc('0x3c')]);_0x8556c9[_0x86bc('0x3d')]=qs['filters'](_[_0x86bc('0x3e')](_0x2e4413[_0x86bc('0x32')],_0x1cc7f9[_0x86bc('0x34')]));if(_0x2e4413[_0x86bc('0x32')][_0x86bc('0x3f')]){_0x8556c9[_0x86bc('0x3d')]=_[_0x86bc('0x40')](_0x8556c9[_0x86bc('0x3d')],{'$or':_['map'](_0x8556c9[_0x86bc('0x36')],function(_0x42be60){var _0x45cb8d={};_0x45cb8d[_0x42be60]={'$like':'%'+_0x2e4413['query'][_0x86bc('0x3f')]+'%'};return _0x45cb8d;})});}_0x8556c9=_[_0x86bc('0x40')]({},_0x8556c9,_0x2e4413[_0x86bc('0x43')]);return _0x5abbaa['getConfigurations'](_0x8556c9);}})[_0x86bc('0x25')](function(_0x26012c){if(_0x26012c){_0x20be39=_0x26012c['length'];if(!_0x2e4413['query'][_0x86bc('0x39')]('nolimit')){_0x8556c9[_0x86bc('0x1f')]=qs[_0x86bc('0x1f')](_0x2e4413[_0x86bc('0x32')][_0x86bc('0x1f')]);_0x8556c9['offset']=qs[_0x86bc('0x1d')](_0x2e4413['query'][_0x86bc('0x1d')]);}return _0x5abbaa['getConfigurations'](_0x8556c9);}})[_0x86bc('0x25')](function(_0x952f35){if(_0x952f35){return _0x952f35?{'count':_0x20be39,'rows':_0x952f35}:null;}})[_0x86bc('0x25')](respondWithResult(_0x2d62ec,null))[_0x86bc('0x47')](handleError(_0x2d62ec,null));};exports[_0x86bc('0x50')]=function(_0x2d2da3,_0x281705,_0x2ef233){if(_0x2d2da3[_0x86bc('0x4c')]['id']){delete _0x2d2da3['body']['id'];}return db[_0x86bc('0x2d')][_0x86bc('0x4e')]({'where':{'id':_0x2d2da3[_0x86bc('0x49')]['id']}})['then'](handleEntityNotFound(_0x281705,null))[_0x86bc('0x25')](function(_0x36753d){if(_0x36753d){_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x51')]=_0x36753d['id'];_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x52')]=integrations[_0x86bc('0x53')](_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x54')],_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x41')]);_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x55')]=integrations[_0x86bc('0x56')](_0x2d2da3[_0x86bc('0x4c')][_0x86bc('0x54')],_0x2d2da3[_0x86bc('0x4c')]['type']);return db[_0x86bc('0x4f')]['create'](_0x2d2da3[_0x86bc('0x4c')],{'include':[{'model':db[_0x86bc('0x57')],'as':_0x86bc('0x52')},{'model':db[_0x86bc('0x57')],'as':_0x86bc('0x55')}]});}return null;})[_0x86bc('0x25')](respondWithResult(_0x281705,null))[_0x86bc('0x47')](handleError(_0x281705,null));};exports['getFields']=function(_0x54276a,_0x4bb2b2,_0x3d5aee){var _0x3bbfa2='';var _0x5d616c='';return db[_0x86bc('0x2d')]['findOne']({'where':{'id':_0x54276a[_0x86bc('0x49')]['id']},'attributes':['id',_0x86bc('0x58'),_0x86bc('0x59'),_0x86bc('0x5a')]})[_0x86bc('0x25')](handleEntityNotFound(_0x4bb2b2,null))['then'](function(_0xfc3e20){if(_0xfc3e20){_0x5d616c=_0xfc3e20[_0x86bc('0x58')];_0x3bbfa2=_0xfc3e20[_0x86bc('0x59')];var _0x3485c1=_0xfc3e20['remoteUri'][_0x86bc('0x5b')](-0x1);if(_0x3485c1==='/'){_0x3bbfa2=_0x3bbfa2['substring'](0x0,_0x3bbfa2[_0x86bc('0x5c')](_0x3485c1));}return rp({'method':'GET','uri':util[_0x86bc('0x5d')]('%s%s',_0x3bbfa2,_0x86bc('0x5e')),'headers':{'Authorization':_0x86bc('0x5f')+_0xfc3e20[_0x86bc('0x5a')]},'json':!![]});}})['then'](function(_0x1213e7){if(_0x1213e7){var _0x3ff293=_0x1213e7[_0x86bc('0x60')];var _0xe6ee53=![];var _0x2fd1e8=null;for(_0x2fd1e8=0x0;_0x2fd1e8<_0x3ff293['length'];_0x2fd1e8++){if(_0x3ff293[_0x2fd1e8][_0x86bc('0x61')]===_0x5d616c){_0xe6ee53=!![];}}if(_0xe6ee53){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x86bc('0x25')](respondWithResult(_0x4bb2b2,null))[_0x86bc('0x47')](function(_0x48196e){var _0x5b6a8e=_0x54276a[_0x86bc('0x32')][_0x86bc('0x62')]?0x1f4:_0x48196e[_0x86bc('0x63')]||0x1f4;logger[_0x86bc('0x27')](_0x86bc('0x64'),_0x86bc('0x65'),_0x5b6a8e,JSON[_0x86bc('0x66')](_0x48196e));delete _0x48196e[_0x86bc('0x29')];if(_0x5b6a8e===0x191){_0x5b6a8e=0x190;}_0x4bb2b2[_0x86bc('0x1a')](_0x5b6a8e)[_0x86bc('0x2a')](_0x54276a[_0x86bc('0x32')]['test']?{'message':_0x86bc('0x67'),'statusCode':_0x48196e[_0x86bc('0x63')]}:_0x48196e);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index f86e9d4..cce7816 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x1fa81b,_0xf9b59d){var _0xa8fea7=function(_0x154cc9){while(--_0x154cc9){_0x1fa81b['push'](_0x1fa81b['shift']());}};_0xa8fea7(++_0xf9b59d);}(_0x2542,0x169));var _0x2254=function(_0x11c2c0,_0x52c4f2){_0x11c2c0=_0x11c2c0-0x0;var _0x3a1a58=_0x2542[_0x11c2c0];return _0x3a1a58;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));var integrations=require(_0x2254('0x9'));module['exports']=function(_0x19ad3c,_0xe8ca50){return _0x19ad3c[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x80495a,_0x315af9){var _0x23b077=function(_0x19d787){while(--_0x19d787){_0x80495a['push'](_0x80495a['shift']());}};_0x23b077(++_0x315af9);}(_0xe5af,0x9c));var _0xfe5a=function(_0x43f289,_0x5216a9){_0x43f289=_0x43f289-0x0;var _0x39f5d8=_0xe5af[_0x43f289];return _0x39f5d8;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xfe5a('0x6'));module[_0xfe5a('0x7')]=function(_0x4e418f,_0x5eea2e){return _0x4e418f[_0xfe5a('0x8')](_0xfe5a('0x9'),attributes,{'tableName':_0xfe5a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index d4405b7..939365c 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xb016,0x159));var _0x6b01=function(_0x3f3c63,_0x11d692){_0x3f3c63=_0x3f3c63-0x0;var _0xb9fb6f=_0xb016[_0x3f3c63];return _0xb9fb6f;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file +var _0x6343=['attributes','map','GetFreshsalesAccount','stringify','ShowFreshsalesAccount','find','where','debug','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','FreshsalesAccount','findAll','options','raw','limit','include','model'];(function(_0x406633,_0x5e086b){var _0x2327f4=function(_0x52f4d3){while(--_0x52f4d3){_0x406633['push'](_0x406633['shift']());}};_0x2327f4(++_0x5e086b);}(_0x6343,0x168));var _0x3634=function(_0x23aa7d,_0x58cbb0){_0x23aa7d=_0x23aa7d-0x0;var _0x483329=_0x6343[_0x23aa7d];return _0x483329;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('FreshsalesAccount,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});}exports['GetFreshsalesAccount']=function(_0x50350d){var _0x2aaac7=this;return new Promise(function(_0x4b2115,_0x2fac8b){return db[_0x3634('0x11')][_0x3634('0x12')]({'raw':_0x50350d['options']?_0x50350d[_0x3634('0x13')][_0x3634('0x14')]===undefined?!![]:![]:!![],'where':_0x50350d['options']?_0x50350d[_0x3634('0x13')]['where']||null:null,'attributes':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')]['attributes']||null:null,'limit':_0x50350d[_0x3634('0x13')]?_0x50350d[_0x3634('0x13')][_0x3634('0x15')]||null:null,'include':_0x50350d['options']?_0x50350d[_0x3634('0x13')][_0x3634('0x16')]?_['map'](_0x50350d[_0x3634('0x13')]['include'],function(_0x5e9188){return{'model':db[_0x5e9188[_0x3634('0x17')]],'as':_0x5e9188['as'],'attributes':_0x5e9188[_0x3634('0x18')],'include':_0x5e9188['include']?_[_0x3634('0x19')](_0x5e9188[_0x3634('0x16')],function(_0x17db44){return{'model':db[_0x17db44[_0x3634('0x17')]],'as':_0x17db44['as'],'attributes':_0x17db44[_0x3634('0x18')],'include':_0x17db44[_0x3634('0x16')]?_[_0x3634('0x19')](_0x17db44[_0x3634('0x16')],function(_0x22f1f1){return{'model':db[_0x22f1f1['model']],'as':_0x22f1f1['as'],'attributes':_0x22f1f1[_0x3634('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58841d){logger['info'](_0x3634('0x1a'),_0x50350d);logger['debug'](_0x3634('0x1a'),_0x50350d,JSON[_0x3634('0x1b')](_0x58841d));_0x4b2115(_0x58841d);})['catch'](function(_0x55a77f){logger[_0x3634('0xc')]('GetFreshsalesAccount',_0x55a77f[_0x3634('0xe')],_0x50350d);_0x2fac8b(_0x2aaac7['error'](0x1f4,_0x55a77f[_0x3634('0xe')]));});});};exports[_0x3634('0x1c')]=function(_0x1d88f7){var _0x17a0fd=this;return new Promise(function(_0x1f46d9,_0x20b062){return db[_0x3634('0x11')][_0x3634('0x1d')]({'raw':_0x1d88f7['options']?_0x1d88f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7['options'][_0x3634('0x1e')]||null:null,'attributes':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7[_0x3634('0x13')][_0x3634('0x18')]||null:null,'include':_0x1d88f7[_0x3634('0x13')]?_0x1d88f7[_0x3634('0x13')]['include']?_[_0x3634('0x19')](_0x1d88f7[_0x3634('0x13')][_0x3634('0x16')],function(_0x1b686c){return{'model':db[_0x1b686c[_0x3634('0x17')]],'as':_0x1b686c['as'],'attributes':_0x1b686c[_0x3634('0x18')],'include':_0x1b686c[_0x3634('0x16')]?_[_0x3634('0x19')](_0x1b686c[_0x3634('0x16')],function(_0x598c7e){return{'model':db[_0x598c7e[_0x3634('0x17')]],'as':_0x598c7e['as'],'attributes':_0x598c7e[_0x3634('0x18')],'include':_0x598c7e[_0x3634('0x16')]?_[_0x3634('0x19')](_0x598c7e['include'],function(_0x149840){return{'model':db[_0x149840[_0x3634('0x17')]],'as':_0x149840['as'],'attributes':_0x149840[_0x3634('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5efd00){logger['info'](_0x3634('0x1c'),_0x1d88f7);logger[_0x3634('0x1f')]('ShowFreshsalesAccount',_0x1d88f7,JSON[_0x3634('0x1b')](_0x5efd00));_0x1f46d9(_0x5efd00);})[_0x3634('0x10')](function(_0x105507){logger[_0x3634('0xc')](_0x3634('0x1c'),_0x105507[_0x3634('0xe')],_0x1d88f7);_0x20b062(_0x17a0fd[_0x3634('0xc')](0x1f4,_0x105507['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 835e25f..c063f41 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f55=['show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id'];(function(_0xbb19f6,_0xb5111){var _0x3d27eb=function(_0x154644){while(--_0x154644){_0xbb19f6['push'](_0xbb19f6['shift']());}};_0x3d27eb(++_0xb5111);}(_0x3f55,0x113));var _0x53f5=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0x3f55[_0x3c22e0];return _0x215811;};'use strict';var multer=require('multer');var util=require(_0x53f5('0x0'));var path=require(_0x53f5('0x1'));var timeout=require(_0x53f5('0x2'));var express=require('express');var router=express[_0x53f5('0x3')]();var fs_extra=require(_0x53f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x53f5('0x5'));var config=require('../../config/environment');var controller=require(_0x53f5('0x6'));router[_0x53f5('0x7')]('/',auth[_0x53f5('0x8')](),controller['index']);router[_0x53f5('0x7')](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller[_0x53f5('0xa')]);router['get'](_0x53f5('0xb'),auth[_0x53f5('0x8')](),controller['getSubjects']);router[_0x53f5('0x7')](_0x53f5('0xc'),auth['isAuthenticated'](),controller[_0x53f5('0xd')]);router[_0x53f5('0x7')](_0x53f5('0xe'),auth[_0x53f5('0x8')](),controller['getFields']);router[_0x53f5('0xf')]('/',auth['isAuthenticated'](),controller[_0x53f5('0x10')]);router[_0x53f5('0x11')](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller[_0x53f5('0x12')]);router['delete'](_0x53f5('0x9'),auth[_0x53f5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x36ac=['get','isAuthenticated','index','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4981da,_0x43c7a4){var _0x4aa51f=function(_0x430150){while(--_0x430150){_0x4981da['push'](_0x4981da['shift']());}};_0x4aa51f(++_0x43c7a4);}(_0x36ac,0x123));var _0xc36a=function(_0x21e7f3,_0x1538d5){_0x21e7f3=_0x21e7f3-0x0;var _0x3cb434=_0x36ac[_0x21e7f3];return _0x3cb434;};'use strict';var multer=require('multer');var util=require(_0xc36a('0x0'));var path=require('path');var timeout=require(_0xc36a('0x1'));var express=require(_0xc36a('0x2'));var router=express[_0xc36a('0x3')]();var fs_extra=require(_0xc36a('0x4'));var auth=require(_0xc36a('0x5'));var interaction=require(_0xc36a('0x6'));var config=require(_0xc36a('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xc36a('0x8')]('/',auth[_0xc36a('0x9')](),controller[_0xc36a('0xa')]);router['get'](_0xc36a('0xb'),auth[_0xc36a('0x9')](),controller[_0xc36a('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xc36a('0xd')]);router[_0xc36a('0x8')](_0xc36a('0xe'),auth['isAuthenticated'](),controller[_0xc36a('0xf')]);router['get'](_0xc36a('0x10'),auth[_0xc36a('0x9')](),controller[_0xc36a('0x11')]);router[_0xc36a('0x12')]('/',auth[_0xc36a('0x9')](),controller[_0xc36a('0x13')]);router[_0xc36a('0x14')](_0xc36a('0xb'),auth[_0xc36a('0x9')](),controller['update']);router['delete'](_0xc36a('0xb'),auth[_0xc36a('0x9')](),controller[_0xc36a('0x15')]);module[_0xc36a('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ba958b3..4deb5fc 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x533a=['exports','STRING','sequelize'];(function(_0x22a90a,_0x461cdd){var _0x511604=function(_0x273219){while(--_0x273219){_0x22a90a['push'](_0x22a90a['shift']());}};_0x511604(++_0x461cdd);}(_0x533a,0x19d));var _0xa533=function(_0x415346,_0x440efe){_0x415346=_0x415346-0x0;var _0x28661c=_0x533a[_0x415346];return _0x28661c;};'use strict';var Sequelize=require(_0xa533('0x0'));module[_0xa533('0x1')]={'name':{'type':Sequelize[_0xa533('0x2')]},'description':{'type':Sequelize[_0xa533('0x2')]}}; \ No newline at end of file +var _0x27d6=['STRING','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x27d6,0x1cc));var _0x627d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x27d6[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x627d('0x0'));module[_0x627d('0x1')]={'name':{'type':Sequelize[_0x627d('0x2')]},'description':{'type':Sequelize[_0x627d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f7dc8b3..b47df07 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa85e=['json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body','getSubjects','findOne','FreshsalesField','pick','hasOwnProperty','getFields','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa85e,0x123));var _0xea85=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0xa85e[_0x4a5494];return _0x57cbb5;};'use strict';var emlformat=require(_0xea85('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea85('0x1'));var jsonpatch=require(_0xea85('0x2'));var rp=require('request-promise');var moment=require(_0xea85('0x3'));var BPromise=require(_0xea85('0x4'));var Mustache=require(_0xea85('0x5'));var util=require(_0xea85('0x6'));var path=require(_0xea85('0x7'));var sox=require(_0xea85('0x8'));var csv=require(_0xea85('0x9'));var ejs=require(_0xea85('0xa'));var fs=require('fs');var fs_extra=require(_0xea85('0xb'));var _=require(_0xea85('0xc'));var squel=require(_0xea85('0xd'));var crypto=require(_0xea85('0xe'));var jsforce=require(_0xea85('0xf'));var deskjs=require(_0xea85('0x10'));var toCsv=require('to-csv');var querystring=require(_0xea85('0x11'));var Papa=require(_0xea85('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea85('0x13'));var hardwareService=require(_0xea85('0x14'));var logger=require(_0xea85('0x15'))(_0xea85('0x16'));var utils=require('../../config/utils');var config=require(_0xea85('0x17'));var licenseUtil=require(_0xea85('0x18'));var db=require(_0xea85('0x19'))['db'];function respondWithStatusCode(_0x5f52a5,_0x409f46){_0x409f46=_0x409f46||0xcc;return function(_0x219330){if(_0x219330){return _0x5f52a5[_0xea85('0x1a')](_0x409f46);}return _0x5f52a5[_0xea85('0x1b')](_0x409f46)[_0xea85('0x1c')]();};}function respondWithResult(_0x583ed8,_0x3a5e84){_0x3a5e84=_0x3a5e84||0xc8;return function(_0x41cc68){if(_0x41cc68){return _0x583ed8[_0xea85('0x1b')](_0x3a5e84)[_0xea85('0x1d')](_0x41cc68);}};}function respondWithFilteredResult(_0x541398,_0x489033){return function(_0xaaa9f){if(_0xaaa9f){var _0x2800ed=typeof _0x489033[_0xea85('0x1e')]==='undefined'&&typeof _0x489033[_0xea85('0x1f')]==='undefined';var _0x5ae23e=_0xaaa9f[_0xea85('0x20')];var _0x4ff135=_0x2800ed?0x0:_0x489033[_0xea85('0x1e')];var _0x575e32=_0x2800ed?_0xaaa9f['count']:_0x489033['offset']+_0x489033[_0xea85('0x1f')];var _0x2f7c3a;if(_0x575e32>=_0x5ae23e){_0x575e32=_0x5ae23e;_0x2f7c3a=0xc8;}else{_0x2f7c3a=0xce;}_0x541398[_0xea85('0x1b')](_0x2f7c3a);return _0x541398[_0xea85('0x21')](_0xea85('0x22'),_0x4ff135+'-'+_0x575e32+'/'+_0x5ae23e)[_0xea85('0x1d')](_0xaaa9f);}return null;};}function patchUpdates(_0x29e559){return function(_0x44388b){try{jsonpatch[_0xea85('0x23')](_0x44388b,_0x29e559,!![]);}catch(_0x18b4bf){return BPromise['reject'](_0x18b4bf);}return _0x44388b[_0xea85('0x24')]();};}function saveUpdates(_0x140374,_0x5d3bd2){return function(_0x5960ea){if(_0x5960ea){return _0x5960ea[_0xea85('0x25')](_0x140374)[_0xea85('0x26')](function(_0x487be8){return _0x487be8;});}return null;};}function removeEntity(_0x1f1dab,_0x690dbd){return function(_0xacba02){if(_0xacba02){return _0xacba02[_0xea85('0x27')]()[_0xea85('0x26')](function(){_0x1f1dab[_0xea85('0x1b')](0xcc)[_0xea85('0x1c')]();});}};}function handleEntityNotFound(_0x15240d,_0x168e7e){return function(_0x55a746){if(!_0x55a746){_0x15240d[_0xea85('0x1a')](0x194);}return _0x55a746;};}function handleError(_0x60ec35,_0x4ad5a7){_0x4ad5a7=_0x4ad5a7||0x1f4;return function(_0x5819f9){logger[_0xea85('0x28')](_0x5819f9[_0xea85('0x29')]);if(_0x5819f9[_0xea85('0x2a')]){delete _0x5819f9[_0xea85('0x2a')];}_0x60ec35[_0xea85('0x1b')](_0x4ad5a7)[_0xea85('0x2b')](_0x5819f9);};}exports[_0xea85('0x2c')]=function(_0x45b323,_0x583357){var _0x2f3016={},_0x2da581={},_0x11f54e={'count':0x0,'rows':[]};var _0x5421ee=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x90ab80){return{'name':_0x90ab80['fieldName'],'type':_0x90ab80[_0xea85('0x2d')]['key']};});_0x2da581[_0xea85('0x2e')]=_['map'](_0x5421ee,_0xea85('0x2a'));_0x2da581[_0xea85('0x2f')]=_['keys'](_0x45b323[_0xea85('0x2f')]);_0x2da581[_0xea85('0x30')]=_['intersection'](_0x2da581[_0xea85('0x2e')],_0x2da581[_0xea85('0x2f')]);_0x2f3016[_0xea85('0x31')]=_[_0xea85('0x32')](_0x2da581[_0xea85('0x2e')],qs[_0xea85('0x33')](_0x45b323['query'][_0xea85('0x33')]));_0x2f3016[_0xea85('0x31')]=_0x2f3016[_0xea85('0x31')][_0xea85('0x34')]?_0x2f3016['attributes']:_0x2da581[_0xea85('0x2e')];if(!_0x45b323[_0xea85('0x2f')]['hasOwnProperty'](_0xea85('0x35'))){_0x2f3016[_0xea85('0x1f')]=qs[_0xea85('0x1f')](_0x45b323['query'][_0xea85('0x1f')]);_0x2f3016[_0xea85('0x1e')]=qs['offset'](_0x45b323[_0xea85('0x2f')]['offset']);}_0x2f3016[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x45b323['query'][_0xea85('0x37')]);_0x2f3016[_0xea85('0x38')]=qs['filters'](_['pick'](_0x45b323[_0xea85('0x2f')],_0x2da581['filters']),_0x5421ee);if(_0x45b323['query'][_0xea85('0x39')]){_0x2f3016[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x2f3016['where'],{'$or':_[_0xea85('0x3b')](_0x5421ee,function(_0x51b4c3){if(_0x51b4c3[_0xea85('0x2d')]!==_0xea85('0x3c')){var _0xf4a688={};_0xf4a688[_0x51b4c3['name']]={'$like':'%'+_0x45b323[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0xf4a688;}})});}_0x2f3016=_['merge']({},_0x2f3016,_0x45b323['options']);var _0x12852c={'where':_0x2f3016[_0xea85('0x38')]};return db[_0xea85('0x3d')][_0xea85('0x20')](_0x12852c)[_0xea85('0x26')](function(_0x43fd89){_0x11f54e[_0xea85('0x20')]=_0x43fd89;if(_0x45b323[_0xea85('0x2f')][_0xea85('0x3e')]){_0x2f3016[_0xea85('0x3f')]=[{'all':!![]}];}return db[_0xea85('0x3d')][_0xea85('0x40')](_0x2f3016);})[_0xea85('0x26')](function(_0x47824c){_0x11f54e[_0xea85('0x41')]=_0x47824c;return _0x11f54e;})[_0xea85('0x26')](respondWithFilteredResult(_0x583357,_0x2f3016))[_0xea85('0x42')](handleError(_0x583357,null));};exports['show']=function(_0xe2addf,_0xb3e9f8){var _0x18b6ec={'raw':![],'where':{'id':_0xe2addf[_0xea85('0x43')]['id']}},_0x123f7a={};_0x123f7a[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x3d')][_0xea85('0x45')]);_0x123f7a[_0xea85('0x2f')]=_[_0xea85('0x44')](_0xe2addf['query']);_0x123f7a[_0xea85('0x30')]=_[_0xea85('0x32')](_0x123f7a[_0xea85('0x2e')],_0x123f7a['query']);_0x18b6ec[_0xea85('0x31')]=_[_0xea85('0x32')](_0x123f7a[_0xea85('0x2e')],qs[_0xea85('0x33')](_0xe2addf[_0xea85('0x2f')][_0xea85('0x33')]));_0x18b6ec['attributes']=_0x18b6ec[_0xea85('0x31')]['length']?_0x18b6ec[_0xea85('0x31')]:_0x123f7a[_0xea85('0x2e')];if(_0xe2addf[_0xea85('0x2f')][_0xea85('0x3e')]){_0x18b6ec['include']=[{'all':!![]}];}_0x18b6ec=_[_0xea85('0x3a')]({},_0x18b6ec,_0xe2addf[_0xea85('0x46')]);return db[_0xea85('0x3d')][_0xea85('0x47')](_0x18b6ec)[_0xea85('0x26')](handleEntityNotFound(_0xb3e9f8,null))[_0xea85('0x26')](respondWithResult(_0xb3e9f8,null))['catch'](handleError(_0xb3e9f8,null));};exports[_0xea85('0x48')]=function(_0xf1596b,_0x4442db){return db[_0xea85('0x3d')][_0xea85('0x48')](_0xf1596b[_0xea85('0x49')],{})[_0xea85('0x26')](respondWithResult(_0x4442db,0xc9))[_0xea85('0x42')](handleError(_0x4442db,null));};exports['update']=function(_0x402a75,_0x42e953){if(_0x402a75[_0xea85('0x49')]['id']){delete _0x402a75['body']['id'];}return db[_0xea85('0x3d')][_0xea85('0x47')]({'where':{'id':_0x402a75['params']['id']}})['then'](handleEntityNotFound(_0x42e953,null))[_0xea85('0x26')](saveUpdates(_0x402a75[_0xea85('0x49')],null))['then'](respondWithResult(_0x42e953,null))[_0xea85('0x42')](handleError(_0x42e953,null));};exports[_0xea85('0x27')]=function(_0x2fcaa0,_0x36a3bf){return db[_0xea85('0x3d')][_0xea85('0x47')]({'where':{'id':_0x2fcaa0['params']['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x36a3bf,null))[_0xea85('0x26')](removeEntity(_0x36a3bf,null))['catch'](handleError(_0x36a3bf,null));};exports[_0xea85('0x4a')]=function(_0x37f9af,_0x49a8d7,_0x37ae33){var _0x4f3776={};var _0x41d552={};var _0xbb6d5f;var _0x2c6e2d;return db[_0xea85('0x3d')][_0xea85('0x4b')]({'where':{'id':_0x37f9af[_0xea85('0x43')]['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x49a8d7,null))['then'](function(_0x56a16c){if(_0x56a16c){_0xbb6d5f=_0x56a16c;_0x41d552['model']=_[_0xea85('0x44')](db[_0xea85('0x4c')][_0xea85('0x45')]);_0x41d552[_0xea85('0x2f')]=_[_0xea85('0x44')](_0x37f9af['query']);_0x41d552[_0xea85('0x30')]=_[_0xea85('0x32')](_0x41d552[_0xea85('0x2e')],_0x41d552[_0xea85('0x2f')]);_0x4f3776[_0xea85('0x31')]=_['intersection'](_0x41d552[_0xea85('0x2e')],qs[_0xea85('0x33')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x33')]));_0x4f3776['attributes']=_0x4f3776[_0xea85('0x31')]['length']?_0x4f3776[_0xea85('0x31')]:_0x41d552[_0xea85('0x2e')];_0x4f3776[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x37')]);_0x4f3776['where']=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x37f9af[_0xea85('0x2f')],_0x41d552['filters']));if(_0x37f9af[_0xea85('0x2f')][_0xea85('0x39')]){_0x4f3776[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x4f3776[_0xea85('0x38')],{'$or':_[_0xea85('0x3b')](_0x4f3776['attributes'],function(_0xe1cc06){var _0x162c6b={};_0x162c6b[_0xe1cc06]={'$like':'%'+_0x37f9af[_0xea85('0x2f')]['filter']+'%'};return _0x162c6b;})});}_0x4f3776=_[_0xea85('0x3a')]({},_0x4f3776,_0x37f9af['options']);return _0xbb6d5f[_0xea85('0x4a')](_0x4f3776);}})['then'](function(_0x405e6e){if(_0x405e6e){_0x2c6e2d=_0x405e6e[_0xea85('0x34')];if(!_0x37f9af[_0xea85('0x2f')]['hasOwnProperty']('nolimit')){_0x4f3776[_0xea85('0x1f')]=qs[_0xea85('0x1f')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x1f')]);_0x4f3776[_0xea85('0x1e')]=qs[_0xea85('0x1e')](_0x37f9af[_0xea85('0x2f')][_0xea85('0x1e')]);}return _0xbb6d5f[_0xea85('0x4a')](_0x4f3776);}})[_0xea85('0x26')](function(_0x3098e1){if(_0x3098e1){return _0x3098e1?{'count':_0x2c6e2d,'rows':_0x3098e1}:null;}})['then'](respondWithResult(_0x49a8d7,null))[_0xea85('0x42')](handleError(_0x49a8d7,null));};exports['getDescriptions']=function(_0x466625,_0xae61a4,_0x556cc3){var _0x5955a0={};var _0x3f7a96={};var _0x329710;var _0xf5b214;return db[_0xea85('0x3d')][_0xea85('0x4b')]({'where':{'id':_0x466625['params']['id']}})[_0xea85('0x26')](handleEntityNotFound(_0xae61a4,null))['then'](function(_0xcce7de){if(_0xcce7de){_0x329710=_0xcce7de;_0x3f7a96[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x4c')][_0xea85('0x45')]);_0x3f7a96[_0xea85('0x2f')]=_['keys'](_0x466625[_0xea85('0x2f')]);_0x3f7a96[_0xea85('0x30')]=_[_0xea85('0x32')](_0x3f7a96[_0xea85('0x2e')],_0x3f7a96[_0xea85('0x2f')]);_0x5955a0[_0xea85('0x31')]=_[_0xea85('0x32')](_0x3f7a96[_0xea85('0x2e')],qs['fields'](_0x466625[_0xea85('0x2f')]['fields']));_0x5955a0['attributes']=_0x5955a0[_0xea85('0x31')][_0xea85('0x34')]?_0x5955a0[_0xea85('0x31')]:_0x3f7a96[_0xea85('0x2e')];_0x5955a0[_0xea85('0x36')]=qs['sort'](_0x466625[_0xea85('0x2f')][_0xea85('0x37')]);_0x5955a0[_0xea85('0x38')]=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x466625[_0xea85('0x2f')],_0x3f7a96[_0xea85('0x30')]));if(_0x466625['query'][_0xea85('0x39')]){_0x5955a0[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x5955a0[_0xea85('0x38')],{'$or':_[_0xea85('0x3b')](_0x5955a0[_0xea85('0x31')],function(_0x3188ba){var _0x2ea2a9={};_0x2ea2a9[_0x3188ba]={'$like':'%'+_0x466625[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0x2ea2a9;})});}_0x5955a0=_[_0xea85('0x3a')]({},_0x5955a0,_0x466625['options']);return _0x329710['getDescriptions'](_0x5955a0);}})[_0xea85('0x26')](function(_0x48c7e4){if(_0x48c7e4){_0xf5b214=_0x48c7e4[_0xea85('0x34')];if(!_0x466625[_0xea85('0x2f')][_0xea85('0x4e')](_0xea85('0x35'))){_0x5955a0[_0xea85('0x1f')]=qs['limit'](_0x466625[_0xea85('0x2f')][_0xea85('0x1f')]);_0x5955a0['offset']=qs[_0xea85('0x1e')](_0x466625[_0xea85('0x2f')][_0xea85('0x1e')]);}return _0x329710['getDescriptions'](_0x5955a0);}})[_0xea85('0x26')](function(_0x473c5e){if(_0x473c5e){return _0x473c5e?{'count':_0xf5b214,'rows':_0x473c5e}:null;}})[_0xea85('0x26')](respondWithResult(_0xae61a4,null))['catch'](handleError(_0xae61a4,null));};exports['getFields']=function(_0x59a71f,_0x52210c,_0x3d4ff5){var _0x4d0014={};var _0x5caca0={};var _0x5cd185;var _0x10aeec;return db[_0xea85('0x3d')]['findOne']({'where':{'id':_0x59a71f[_0xea85('0x43')]['id']}})[_0xea85('0x26')](handleEntityNotFound(_0x52210c,null))[_0xea85('0x26')](function(_0x2ca2d2){if(_0x2ca2d2){_0x5cd185=_0x2ca2d2;_0x5caca0[_0xea85('0x2e')]=_[_0xea85('0x44')](db[_0xea85('0x4c')]['rawAttributes']);_0x5caca0[_0xea85('0x2f')]=_[_0xea85('0x44')](_0x59a71f[_0xea85('0x2f')]);_0x5caca0['filters']=_[_0xea85('0x32')](_0x5caca0[_0xea85('0x2e')],_0x5caca0[_0xea85('0x2f')]);_0x4d0014[_0xea85('0x31')]=_[_0xea85('0x32')](_0x5caca0[_0xea85('0x2e')],qs['fields'](_0x59a71f[_0xea85('0x2f')][_0xea85('0x33')]));_0x4d0014[_0xea85('0x31')]=_0x4d0014[_0xea85('0x31')][_0xea85('0x34')]?_0x4d0014[_0xea85('0x31')]:_0x5caca0[_0xea85('0x2e')];_0x4d0014[_0xea85('0x36')]=qs[_0xea85('0x37')](_0x59a71f[_0xea85('0x2f')][_0xea85('0x37')]);_0x4d0014[_0xea85('0x38')]=qs[_0xea85('0x30')](_[_0xea85('0x4d')](_0x59a71f[_0xea85('0x2f')],_0x5caca0[_0xea85('0x30')]));if(_0x59a71f[_0xea85('0x2f')][_0xea85('0x39')]){_0x4d0014[_0xea85('0x38')]=_[_0xea85('0x3a')](_0x4d0014['where'],{'$or':_[_0xea85('0x3b')](_0x4d0014[_0xea85('0x31')],function(_0x3e32ce){var _0x5cea35={};_0x5cea35[_0x3e32ce]={'$like':'%'+_0x59a71f[_0xea85('0x2f')][_0xea85('0x39')]+'%'};return _0x5cea35;})});}_0x4d0014=_['merge']({},_0x4d0014,_0x59a71f['options']);return _0x5cd185['getFields'](_0x4d0014);}})[_0xea85('0x26')](function(_0x1393fd){if(_0x1393fd){_0x10aeec=_0x1393fd[_0xea85('0x34')];if(!_0x59a71f['query'][_0xea85('0x4e')](_0xea85('0x35'))){_0x4d0014['limit']=qs[_0xea85('0x1f')](_0x59a71f[_0xea85('0x2f')][_0xea85('0x1f')]);_0x4d0014[_0xea85('0x1e')]=qs[_0xea85('0x1e')](_0x59a71f[_0xea85('0x2f')]['offset']);}return _0x5cd185[_0xea85('0x4f')](_0x4d0014);}})[_0xea85('0x26')](function(_0xf25fe9){if(_0xf25fe9){return _0xf25fe9?{'count':_0x10aeec,'rows':_0xf25fe9}:null;}})[_0xea85('0x26')](respondWithResult(_0x52210c,null))[_0xea85('0x42')](handleError(_0x52210c,null));}; \ No newline at end of file +var _0x9bdb=['path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','findOne','getSubjects','hasOwnProperty','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x581a80,_0x57634a){var _0x540bdd=function(_0x26f977){while(--_0x26f977){_0x581a80['push'](_0x581a80['shift']());}};_0x540bdd(++_0x57634a);}(_0x9bdb,0x13c));var _0xb9bd=function(_0xe7145f,_0x3ff4eb){_0xe7145f=_0xe7145f-0x0;var _0x5bbcb8=_0x9bdb[_0xe7145f];return _0x5bbcb8;};'use strict';var emlformat=require(_0xb9bd('0x0'));var rimraf=require(_0xb9bd('0x1'));var zipdir=require(_0xb9bd('0x2'));var jsonpatch=require(_0xb9bd('0x3'));var rp=require('request-promise');var moment=require(_0xb9bd('0x4'));var BPromise=require(_0xb9bd('0x5'));var Mustache=require(_0xb9bd('0x6'));var util=require(_0xb9bd('0x7'));var path=require(_0xb9bd('0x8'));var sox=require(_0xb9bd('0x9'));var csv=require(_0xb9bd('0xa'));var ejs=require(_0xb9bd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9bd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9bd('0xd'));var deskjs=require(_0xb9bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb9bd('0xf'));var Papa=require(_0xb9bd('0x10'));var Redis=require(_0xb9bd('0x11'));var authService=require(_0xb9bd('0x12'));var qs=require(_0xb9bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9bd('0x14'))(_0xb9bd('0x15'));var utils=require(_0xb9bd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb9bd('0x17'))['db'];function respondWithStatusCode(_0x228594,_0x5c3823){_0x5c3823=_0x5c3823||0xcc;return function(_0x3e7455){if(_0x3e7455){return _0x228594[_0xb9bd('0x18')](_0x5c3823);}return _0x228594[_0xb9bd('0x19')](_0x5c3823)['end']();};}function respondWithResult(_0x2f5715,_0x8bc329){_0x8bc329=_0x8bc329||0xc8;return function(_0x2b951c){if(_0x2b951c){return _0x2f5715['status'](_0x8bc329)['json'](_0x2b951c);}};}function respondWithFilteredResult(_0x1f74da,_0x590f87){return function(_0x2bdeaf){if(_0x2bdeaf){var _0x507236=typeof _0x590f87[_0xb9bd('0x1a')]===_0xb9bd('0x1b')&&typeof _0x590f87[_0xb9bd('0x1c')]===_0xb9bd('0x1b');var _0x427640=_0x2bdeaf[_0xb9bd('0x1d')];var _0x2f6edc=_0x507236?0x0:_0x590f87[_0xb9bd('0x1a')];var _0x2c5bee=_0x507236?_0x2bdeaf[_0xb9bd('0x1d')]:_0x590f87[_0xb9bd('0x1a')]+_0x590f87['limit'];var _0x48e7a5;if(_0x2c5bee>=_0x427640){_0x2c5bee=_0x427640;_0x48e7a5=0xc8;}else{_0x48e7a5=0xce;}_0x1f74da[_0xb9bd('0x19')](_0x48e7a5);return _0x1f74da[_0xb9bd('0x1e')](_0xb9bd('0x1f'),_0x2f6edc+'-'+_0x2c5bee+'/'+_0x427640)[_0xb9bd('0x20')](_0x2bdeaf);}return null;};}function patchUpdates(_0x1f1ac6){return function(_0x5b2b4c){try{jsonpatch[_0xb9bd('0x21')](_0x5b2b4c,_0x1f1ac6,!![]);}catch(_0x3657b5){return BPromise[_0xb9bd('0x22')](_0x3657b5);}return _0x5b2b4c[_0xb9bd('0x23')]();};}function saveUpdates(_0x477435,_0x276d85){return function(_0x4657cb){if(_0x4657cb){return _0x4657cb[_0xb9bd('0x24')](_0x477435)[_0xb9bd('0x25')](function(_0x4d2307){return _0x4d2307;});}return null;};}function removeEntity(_0x2c8e16,_0x5668f3){return function(_0x52e526){if(_0x52e526){return _0x52e526['destroy']()['then'](function(){_0x2c8e16[_0xb9bd('0x19')](0xcc)[_0xb9bd('0x26')]();});}};}function handleEntityNotFound(_0x5eba05,_0x9f087d){return function(_0x18f4c1){if(!_0x18f4c1){_0x5eba05[_0xb9bd('0x18')](0x194);}return _0x18f4c1;};}function handleError(_0x2b7fad,_0x378b03){_0x378b03=_0x378b03||0x1f4;return function(_0x3a6cdb){logger[_0xb9bd('0x27')](_0x3a6cdb[_0xb9bd('0x28')]);if(_0x3a6cdb[_0xb9bd('0x29')]){delete _0x3a6cdb[_0xb9bd('0x29')];}_0x2b7fad[_0xb9bd('0x19')](_0x378b03)[_0xb9bd('0x2a')](_0x3a6cdb);};}exports['index']=function(_0x4f8248,_0x2b81c4){var _0x206e53={},_0x2eba92={},_0x3dba70={'count':0x0,'rows':[]};var _0x11b727=_[_0xb9bd('0x2b')](db[_0xb9bd('0x2c')][_0xb9bd('0x2d')],function(_0x28fd26){return{'name':_0x28fd26['fieldName'],'type':_0x28fd26[_0xb9bd('0x2e')][_0xb9bd('0x2f')]};});_0x2eba92[_0xb9bd('0x30')]=_[_0xb9bd('0x2b')](_0x11b727,'name');_0x2eba92[_0xb9bd('0x31')]=_['keys'](_0x4f8248[_0xb9bd('0x31')]);_0x2eba92[_0xb9bd('0x32')]=_[_0xb9bd('0x33')](_0x2eba92[_0xb9bd('0x30')],_0x2eba92[_0xb9bd('0x31')]);_0x206e53[_0xb9bd('0x34')]=_[_0xb9bd('0x33')](_0x2eba92[_0xb9bd('0x30')],qs[_0xb9bd('0x35')](_0x4f8248[_0xb9bd('0x31')][_0xb9bd('0x35')]));_0x206e53[_0xb9bd('0x34')]=_0x206e53[_0xb9bd('0x34')][_0xb9bd('0x36')]?_0x206e53['attributes']:_0x2eba92['model'];if(!_0x4f8248[_0xb9bd('0x31')]['hasOwnProperty']('nolimit')){_0x206e53[_0xb9bd('0x1c')]=qs[_0xb9bd('0x1c')](_0x4f8248[_0xb9bd('0x31')][_0xb9bd('0x1c')]);_0x206e53[_0xb9bd('0x1a')]=qs[_0xb9bd('0x1a')](_0x4f8248[_0xb9bd('0x31')][_0xb9bd('0x1a')]);}_0x206e53[_0xb9bd('0x37')]=qs[_0xb9bd('0x38')](_0x4f8248[_0xb9bd('0x31')]['sort']);_0x206e53[_0xb9bd('0x39')]=qs[_0xb9bd('0x32')](_[_0xb9bd('0x3a')](_0x4f8248[_0xb9bd('0x31')],_0x2eba92['filters']),_0x11b727);if(_0x4f8248['query'][_0xb9bd('0x3b')]){_0x206e53[_0xb9bd('0x39')]=_[_0xb9bd('0x3c')](_0x206e53['where'],{'$or':_[_0xb9bd('0x2b')](_0x11b727,function(_0x4f1e68){if(_0x4f1e68[_0xb9bd('0x2e')]!==_0xb9bd('0x3d')){var _0x22d51d={};_0x22d51d[_0x4f1e68[_0xb9bd('0x29')]]={'$like':'%'+_0x4f8248[_0xb9bd('0x31')][_0xb9bd('0x3b')]+'%'};return _0x22d51d;}})});}_0x206e53=_['merge']({},_0x206e53,_0x4f8248[_0xb9bd('0x3e')]);var _0x2e10b5={'where':_0x206e53[_0xb9bd('0x39')]};return db[_0xb9bd('0x2c')][_0xb9bd('0x1d')](_0x2e10b5)[_0xb9bd('0x25')](function(_0x358dd3){_0x3dba70[_0xb9bd('0x1d')]=_0x358dd3;if(_0x4f8248['query'][_0xb9bd('0x3f')]){_0x206e53[_0xb9bd('0x40')]=[{'all':!![]}];}return db[_0xb9bd('0x2c')]['findAll'](_0x206e53);})[_0xb9bd('0x25')](function(_0x5b96a4){_0x3dba70[_0xb9bd('0x41')]=_0x5b96a4;return _0x3dba70;})[_0xb9bd('0x25')](respondWithFilteredResult(_0x2b81c4,_0x206e53))[_0xb9bd('0x42')](handleError(_0x2b81c4,null));};exports[_0xb9bd('0x43')]=function(_0x5e07ca,_0x3b557a){var _0x35df48={'raw':![],'where':{'id':_0x5e07ca[_0xb9bd('0x44')]['id']}},_0x3c6b0f={};_0x3c6b0f['model']=_[_0xb9bd('0x45')](db['FreshsalesConfiguration'][_0xb9bd('0x2d')]);_0x3c6b0f[_0xb9bd('0x31')]=_[_0xb9bd('0x45')](_0x5e07ca[_0xb9bd('0x31')]);_0x3c6b0f['filters']=_[_0xb9bd('0x33')](_0x3c6b0f['model'],_0x3c6b0f['query']);_0x35df48[_0xb9bd('0x34')]=_['intersection'](_0x3c6b0f[_0xb9bd('0x30')],qs['fields'](_0x5e07ca[_0xb9bd('0x31')][_0xb9bd('0x35')]));_0x35df48['attributes']=_0x35df48[_0xb9bd('0x34')][_0xb9bd('0x36')]?_0x35df48[_0xb9bd('0x34')]:_0x3c6b0f[_0xb9bd('0x30')];if(_0x5e07ca['query'][_0xb9bd('0x3f')]){_0x35df48[_0xb9bd('0x40')]=[{'all':!![]}];}_0x35df48=_[_0xb9bd('0x3c')]({},_0x35df48,_0x5e07ca[_0xb9bd('0x3e')]);return db[_0xb9bd('0x2c')][_0xb9bd('0x46')](_0x35df48)['then'](handleEntityNotFound(_0x3b557a,null))[_0xb9bd('0x25')](respondWithResult(_0x3b557a,null))[_0xb9bd('0x42')](handleError(_0x3b557a,null));};exports[_0xb9bd('0x47')]=function(_0x31ef15,_0x4e1a1d){return db[_0xb9bd('0x2c')][_0xb9bd('0x47')](_0x31ef15[_0xb9bd('0x48')],{})[_0xb9bd('0x25')](respondWithResult(_0x4e1a1d,0xc9))[_0xb9bd('0x42')](handleError(_0x4e1a1d,null));};exports[_0xb9bd('0x24')]=function(_0x78d03a,_0x3dda81){if(_0x78d03a[_0xb9bd('0x48')]['id']){delete _0x78d03a[_0xb9bd('0x48')]['id'];}return db[_0xb9bd('0x2c')][_0xb9bd('0x46')]({'where':{'id':_0x78d03a[_0xb9bd('0x44')]['id']}})['then'](handleEntityNotFound(_0x3dda81,null))[_0xb9bd('0x25')](saveUpdates(_0x78d03a['body'],null))[_0xb9bd('0x25')](respondWithResult(_0x3dda81,null))['catch'](handleError(_0x3dda81,null));};exports[_0xb9bd('0x49')]=function(_0x2434aa,_0x2a0eea){return db['FreshsalesConfiguration'][_0xb9bd('0x46')]({'where':{'id':_0x2434aa['params']['id']}})[_0xb9bd('0x25')](handleEntityNotFound(_0x2a0eea,null))[_0xb9bd('0x25')](removeEntity(_0x2a0eea,null))['catch'](handleError(_0x2a0eea,null));};exports['getSubjects']=function(_0x4e673d,_0x12788c,_0x916d63){var _0x15bc7e={};var _0x26c2b2={};var _0x49ebc3;var _0x41d246;return db[_0xb9bd('0x2c')][_0xb9bd('0x4a')]({'where':{'id':_0x4e673d['params']['id']}})[_0xb9bd('0x25')](handleEntityNotFound(_0x12788c,null))[_0xb9bd('0x25')](function(_0x4f281f){if(_0x4f281f){_0x49ebc3=_0x4f281f;_0x26c2b2[_0xb9bd('0x30')]=_[_0xb9bd('0x45')](db['FreshsalesField']['rawAttributes']);_0x26c2b2['query']=_[_0xb9bd('0x45')](_0x4e673d[_0xb9bd('0x31')]);_0x26c2b2['filters']=_[_0xb9bd('0x33')](_0x26c2b2[_0xb9bd('0x30')],_0x26c2b2[_0xb9bd('0x31')]);_0x15bc7e[_0xb9bd('0x34')]=_[_0xb9bd('0x33')](_0x26c2b2['model'],qs['fields'](_0x4e673d[_0xb9bd('0x31')][_0xb9bd('0x35')]));_0x15bc7e[_0xb9bd('0x34')]=_0x15bc7e[_0xb9bd('0x34')]['length']?_0x15bc7e['attributes']:_0x26c2b2[_0xb9bd('0x30')];_0x15bc7e['order']=qs[_0xb9bd('0x38')](_0x4e673d[_0xb9bd('0x31')]['sort']);_0x15bc7e['where']=qs['filters'](_[_0xb9bd('0x3a')](_0x4e673d[_0xb9bd('0x31')],_0x26c2b2['filters']));if(_0x4e673d['query'][_0xb9bd('0x3b')]){_0x15bc7e[_0xb9bd('0x39')]=_[_0xb9bd('0x3c')](_0x15bc7e[_0xb9bd('0x39')],{'$or':_[_0xb9bd('0x2b')](_0x15bc7e['attributes'],function(_0x4a35e6){var _0x1d0fff={};_0x1d0fff[_0x4a35e6]={'$like':'%'+_0x4e673d['query'][_0xb9bd('0x3b')]+'%'};return _0x1d0fff;})});}_0x15bc7e=_[_0xb9bd('0x3c')]({},_0x15bc7e,_0x4e673d[_0xb9bd('0x3e')]);return _0x49ebc3[_0xb9bd('0x4b')](_0x15bc7e);}})['then'](function(_0x12f8f2){if(_0x12f8f2){_0x41d246=_0x12f8f2[_0xb9bd('0x36')];if(!_0x4e673d['query'][_0xb9bd('0x4c')](_0xb9bd('0x4d'))){_0x15bc7e[_0xb9bd('0x1c')]=qs[_0xb9bd('0x1c')](_0x4e673d[_0xb9bd('0x31')]['limit']);_0x15bc7e['offset']=qs[_0xb9bd('0x1a')](_0x4e673d[_0xb9bd('0x31')][_0xb9bd('0x1a')]);}return _0x49ebc3[_0xb9bd('0x4b')](_0x15bc7e);}})[_0xb9bd('0x25')](function(_0x4a0898){if(_0x4a0898){return _0x4a0898?{'count':_0x41d246,'rows':_0x4a0898}:null;}})[_0xb9bd('0x25')](respondWithResult(_0x12788c,null))['catch'](handleError(_0x12788c,null));};exports[_0xb9bd('0x4e')]=function(_0x519efd,_0xf39b92,_0x43a761){var _0x19cf7f={};var _0x1eab3a={};var _0x3dbb8f;var _0x225719;return db['FreshsalesConfiguration'][_0xb9bd('0x4a')]({'where':{'id':_0x519efd[_0xb9bd('0x44')]['id']}})[_0xb9bd('0x25')](handleEntityNotFound(_0xf39b92,null))[_0xb9bd('0x25')](function(_0x36d036){if(_0x36d036){_0x3dbb8f=_0x36d036;_0x1eab3a['model']=_[_0xb9bd('0x45')](db[_0xb9bd('0x4f')][_0xb9bd('0x2d')]);_0x1eab3a[_0xb9bd('0x31')]=_[_0xb9bd('0x45')](_0x519efd[_0xb9bd('0x31')]);_0x1eab3a['filters']=_[_0xb9bd('0x33')](_0x1eab3a[_0xb9bd('0x30')],_0x1eab3a[_0xb9bd('0x31')]);_0x19cf7f[_0xb9bd('0x34')]=_['intersection'](_0x1eab3a[_0xb9bd('0x30')],qs[_0xb9bd('0x35')](_0x519efd[_0xb9bd('0x31')][_0xb9bd('0x35')]));_0x19cf7f['attributes']=_0x19cf7f[_0xb9bd('0x34')][_0xb9bd('0x36')]?_0x19cf7f[_0xb9bd('0x34')]:_0x1eab3a[_0xb9bd('0x30')];_0x19cf7f['order']=qs['sort'](_0x519efd[_0xb9bd('0x31')][_0xb9bd('0x38')]);_0x19cf7f[_0xb9bd('0x39')]=qs[_0xb9bd('0x32')](_[_0xb9bd('0x3a')](_0x519efd['query'],_0x1eab3a[_0xb9bd('0x32')]));if(_0x519efd['query'][_0xb9bd('0x3b')]){_0x19cf7f[_0xb9bd('0x39')]=_[_0xb9bd('0x3c')](_0x19cf7f[_0xb9bd('0x39')],{'$or':_[_0xb9bd('0x2b')](_0x19cf7f['attributes'],function(_0x4c6d06){var _0xec8974={};_0xec8974[_0x4c6d06]={'$like':'%'+_0x519efd[_0xb9bd('0x31')][_0xb9bd('0x3b')]+'%'};return _0xec8974;})});}_0x19cf7f=_[_0xb9bd('0x3c')]({},_0x19cf7f,_0x519efd[_0xb9bd('0x3e')]);return _0x3dbb8f[_0xb9bd('0x4e')](_0x19cf7f);}})[_0xb9bd('0x25')](function(_0x3d70b1){if(_0x3d70b1){_0x225719=_0x3d70b1[_0xb9bd('0x36')];if(!_0x519efd['query'][_0xb9bd('0x4c')](_0xb9bd('0x4d'))){_0x19cf7f[_0xb9bd('0x1c')]=qs['limit'](_0x519efd[_0xb9bd('0x31')][_0xb9bd('0x1c')]);_0x19cf7f[_0xb9bd('0x1a')]=qs[_0xb9bd('0x1a')](_0x519efd[_0xb9bd('0x31')][_0xb9bd('0x1a')]);}return _0x3dbb8f['getDescriptions'](_0x19cf7f);}})[_0xb9bd('0x25')](function(_0xf3289a){if(_0xf3289a){return _0xf3289a?{'count':_0x225719,'rows':_0xf3289a}:null;}})['then'](respondWithResult(_0xf39b92,null))['catch'](handleError(_0xf39b92,null));};exports[_0xb9bd('0x50')]=function(_0x4ecb1a,_0x2264e1,_0x143824){var _0x2cc0aa={};var _0x1d3de4={};var _0x5eedf6;var _0x32bdb8;return db[_0xb9bd('0x2c')]['findOne']({'where':{'id':_0x4ecb1a['params']['id']}})[_0xb9bd('0x25')](handleEntityNotFound(_0x2264e1,null))[_0xb9bd('0x25')](function(_0x3632ab){if(_0x3632ab){_0x5eedf6=_0x3632ab;_0x1d3de4[_0xb9bd('0x30')]=_[_0xb9bd('0x45')](db[_0xb9bd('0x4f')][_0xb9bd('0x2d')]);_0x1d3de4[_0xb9bd('0x31')]=_[_0xb9bd('0x45')](_0x4ecb1a[_0xb9bd('0x31')]);_0x1d3de4['filters']=_[_0xb9bd('0x33')](_0x1d3de4[_0xb9bd('0x30')],_0x1d3de4[_0xb9bd('0x31')]);_0x2cc0aa[_0xb9bd('0x34')]=_['intersection'](_0x1d3de4[_0xb9bd('0x30')],qs[_0xb9bd('0x35')](_0x4ecb1a[_0xb9bd('0x31')][_0xb9bd('0x35')]));_0x2cc0aa[_0xb9bd('0x34')]=_0x2cc0aa['attributes'][_0xb9bd('0x36')]?_0x2cc0aa[_0xb9bd('0x34')]:_0x1d3de4['model'];_0x2cc0aa[_0xb9bd('0x37')]=qs[_0xb9bd('0x38')](_0x4ecb1a[_0xb9bd('0x31')][_0xb9bd('0x38')]);_0x2cc0aa['where']=qs['filters'](_[_0xb9bd('0x3a')](_0x4ecb1a[_0xb9bd('0x31')],_0x1d3de4[_0xb9bd('0x32')]));if(_0x4ecb1a['query'][_0xb9bd('0x3b')]){_0x2cc0aa[_0xb9bd('0x39')]=_[_0xb9bd('0x3c')](_0x2cc0aa[_0xb9bd('0x39')],{'$or':_[_0xb9bd('0x2b')](_0x2cc0aa['attributes'],function(_0x78cb8d){var _0x53f6d2={};_0x53f6d2[_0x78cb8d]={'$like':'%'+_0x4ecb1a[_0xb9bd('0x31')][_0xb9bd('0x3b')]+'%'};return _0x53f6d2;})});}_0x2cc0aa=_[_0xb9bd('0x3c')]({},_0x2cc0aa,_0x4ecb1a[_0xb9bd('0x3e')]);return _0x5eedf6[_0xb9bd('0x50')](_0x2cc0aa);}})[_0xb9bd('0x25')](function(_0x596770){if(_0x596770){_0x32bdb8=_0x596770[_0xb9bd('0x36')];if(!_0x4ecb1a['query']['hasOwnProperty'](_0xb9bd('0x4d'))){_0x2cc0aa['limit']=qs[_0xb9bd('0x1c')](_0x4ecb1a[_0xb9bd('0x31')]['limit']);_0x2cc0aa['offset']=qs[_0xb9bd('0x1a')](_0x4ecb1a['query'][_0xb9bd('0x1a')]);}return _0x5eedf6[_0xb9bd('0x50')](_0x2cc0aa);}})[_0xb9bd('0x25')](function(_0x49ba37){if(_0x49ba37){return _0x49ba37?{'count':_0x32bdb8,'rows':_0x49ba37}:null;}})[_0xb9bd('0x25')](respondWithResult(_0x2264e1,null))[_0xb9bd('0x42')](handleError(_0x2264e1,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index a124b57..078e990 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ac2=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x40042d,_0x3ce810){var _0x3889a1=function(_0x2fdcbb){while(--_0x2fdcbb){_0x40042d['push'](_0x40042d['shift']());}};_0x3889a1(++_0x3ce810);}(_0x7ac2,0x8e));var _0x27ac=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x7ac2[_0x21bfab];return _0x4db318;};'use strict';var _=require(_0x27ac('0x0'));var util=require(_0x27ac('0x1'));var logger=require(_0x27ac('0x2'))(_0x27ac('0x3'));var moment=require(_0x27ac('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x27ac('0x5'));var rimraf=require(_0x27ac('0x6'));var config=require(_0x27ac('0x7'));var attributes=require(_0x27ac('0x8'));module[_0x27ac('0x9')]=function(_0x685d5e,_0x259710){return _0x685d5e[_0x27ac('0xa')](_0x27ac('0xb'),attributes,{'tableName':_0x27ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92c8=['exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x45e521,_0x41e2c8){var _0x1586e5=function(_0x12e559){while(--_0x12e559){_0x45e521['push'](_0x45e521['shift']());}};_0x1586e5(++_0x41e2c8);}(_0x92c8,0xac));var _0x892c=function(_0x16b21a,_0xd59737){_0x16b21a=_0x16b21a-0x0;var _0x371a4b=_0x92c8[_0x16b21a];return _0x371a4b;};'use strict';var _=require(_0x892c('0x0'));var util=require(_0x892c('0x1'));var logger=require(_0x892c('0x2'))(_0x892c('0x3'));var moment=require('moment');var BPromise=require(_0x892c('0x4'));var rp=require(_0x892c('0x5'));var fs=require('fs');var path=require(_0x892c('0x6'));var rimraf=require(_0x892c('0x7'));var config=require(_0x892c('0x8'));var attributes=require(_0x892c('0x9'));module[_0x892c('0xa')]=function(_0x5ce83d,_0x2d5d00){return _0x5ce83d[_0x892c('0xb')](_0x892c('0xc'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index c983255..463dae5 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc080=['jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x5be4fa,_0x2436a8){var _0x10940c=function(_0x3df19e){while(--_0x3df19e){_0x5be4fa['push'](_0x5be4fa['shift']());}};_0x10940c(++_0x2436a8);}(_0xc080,0xe6));var _0x0c08=function(_0x29f562,_0x10d66c){_0x29f562=_0x29f562-0x0;var _0x2d4e21=_0xc080[_0x29f562];return _0x2d4e21;};'use strict';var _=require(_0x0c08('0x0'));var util=require(_0x0c08('0x1'));var moment=require(_0x0c08('0x2'));var BPromise=require(_0x0c08('0x3'));var rs=require(_0x0c08('0x4'));var fs=require('fs');var Redis=require(_0x0c08('0x5'));var db=require(_0x0c08('0x6'))['db'];var utils=require(_0x0c08('0x7'));var logger=require('../../config/logger')(_0x0c08('0x8'));var config=require(_0x0c08('0x9'));var jayson=require(_0x0c08('0xa'));var client=jayson[_0x0c08('0xb')][_0x0c08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21549b,_0x52f7cc,_0x434b7a){return new BPromise(function(_0x35dacd,_0x1493e2){return client[_0x0c08('0xd')](_0x21549b,_0x434b7a)[_0x0c08('0xe')](function(_0x1ab3ad){logger[_0x0c08('0xf')](_0x0c08('0x10'),_0x52f7cc,_0x0c08('0x11'));logger[_0x0c08('0x12')](_0x0c08('0x13'),_0x52f7cc,_0x0c08('0x11'),JSON[_0x0c08('0x14')](_0x1ab3ad));if(_0x1ab3ad[_0x0c08('0x15')]){if(_0x1ab3ad[_0x0c08('0x15')]['code']===0x1f4){logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x1ab3ad[_0x0c08('0x15')]['message']);return _0x1493e2(_0x1ab3ad['error'][_0x0c08('0x16')]);}logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x1ab3ad['error']['message']);return _0x35dacd(_0x1ab3ad[_0x0c08('0x15')][_0x0c08('0x16')]);}else{logger[_0x0c08('0xf')](_0x0c08('0x10'),_0x52f7cc,_0x0c08('0x11'));_0x35dacd(_0x1ab3ad[_0x0c08('0x17')]['message']);}})['catch'](function(_0x566773){logger[_0x0c08('0x15')](_0x0c08('0x10'),_0x52f7cc,_0x566773);_0x1493e2(_0x566773);});});} \ No newline at end of file +var _0x0ea2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash'];(function(_0x4d39a7,_0x16db64){var _0x30e04a=function(_0x4225ff){while(--_0x4225ff){_0x4d39a7['push'](_0x4d39a7['shift']());}};_0x30e04a(++_0x16db64);}(_0x0ea2,0x1b7));var _0x20ea=function(_0x323348,_0x4c0875){_0x323348=_0x323348-0x0;var _0x668fa0=_0x0ea2[_0x323348];return _0x668fa0;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var moment=require(_0x20ea('0x2'));var BPromise=require(_0x20ea('0x3'));var rs=require(_0x20ea('0x4'));var fs=require('fs');var Redis=require(_0x20ea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x20ea('0x6'));var logger=require(_0x20ea('0x7'))(_0x20ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x20ea('0x9'));var client=jayson[_0x20ea('0xa')][_0x20ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9fd3,_0x8ae4d8,_0x4f5a19){return new BPromise(function(_0x2f5923,_0x2107cb){return client[_0x20ea('0xc')](_0x1c9fd3,_0x4f5a19)['then'](function(_0x4e6bc2){logger['info'](_0x20ea('0xd'),_0x8ae4d8,_0x20ea('0xe'));logger[_0x20ea('0xf')](_0x20ea('0x10'),_0x8ae4d8,_0x20ea('0xe'),JSON['stringify'](_0x4e6bc2));if(_0x4e6bc2[_0x20ea('0x11')]){if(_0x4e6bc2[_0x20ea('0x11')][_0x20ea('0x12')]===0x1f4){logger['error'](_0x20ea('0xd'),_0x8ae4d8,_0x4e6bc2['error'][_0x20ea('0x13')]);return _0x2107cb(_0x4e6bc2[_0x20ea('0x11')][_0x20ea('0x13')]);}logger[_0x20ea('0x11')](_0x20ea('0xd'),_0x8ae4d8,_0x4e6bc2[_0x20ea('0x11')][_0x20ea('0x13')]);return _0x2f5923(_0x4e6bc2['error']['message']);}else{logger[_0x20ea('0x14')](_0x20ea('0xd'),_0x8ae4d8,'request\x20sent');_0x2f5923(_0x4e6bc2['result'][_0x20ea('0x13')]);}})[_0x20ea('0x15')](function(_0x12fc5f){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x8ae4d8,_0x12fc5f);_0x2107cb(_0x12fc5f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 554a01c..9756e03 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe630=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x2d57f5,_0x52973e){var _0x4a4198=function(_0x4db3c7){while(--_0x4db3c7){_0x2d57f5['push'](_0x2d57f5['shift']());}};_0x4a4198(++_0x52973e);}(_0xe630,0x149));var _0x0e63=function(_0x3a8b41,_0x122312){_0x3a8b41=_0x3a8b41-0x0;var _0x19cb35=_0xe630[_0x3a8b41];return _0x19cb35;};'use strict';var multer=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var timeout=require(_0x0e63('0x2'));var express=require(_0x0e63('0x3'));var router=express[_0x0e63('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e63('0x5'));var interaction=require(_0x0e63('0x6'));var config=require(_0x0e63('0x7'));var controller=require('./intFreshsalesField.controller');router[_0x0e63('0x8')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xa')]);router[_0x0e63('0x8')](_0x0e63('0xb'),auth['isAuthenticated'](),controller[_0x0e63('0xc')]);router[_0x0e63('0xd')]('/',auth[_0x0e63('0x9')](),controller[_0x0e63('0xe')]);router[_0x0e63('0xf')](_0x0e63('0xb'),auth[_0x0e63('0x9')](),controller[_0x0e63('0x10')]);router[_0x0e63('0x11')](_0x0e63('0xb'),auth[_0x0e63('0x9')](),controller['destroy']);module[_0x0e63('0x12')]=router; \ No newline at end of file +var _0x2060=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','/:id','post','create'];(function(_0xe4a998,_0x44beb3){var _0x18b4e8=function(_0x24a889){while(--_0x24a889){_0xe4a998['push'](_0xe4a998['shift']());}};_0x18b4e8(++_0x44beb3);}(_0x2060,0x1be));var _0x0206=function(_0x1bc2de,_0x5b963d){_0x1bc2de=_0x1bc2de-0x0;var _0x53e381=_0x2060[_0x1bc2de];return _0x53e381;};'use strict';var multer=require(_0x0206('0x0'));var util=require('util');var path=require(_0x0206('0x1'));var timeout=require(_0x0206('0x2'));var express=require(_0x0206('0x3'));var router=express[_0x0206('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0206('0x5'));var interaction=require(_0x0206('0x6'));var config=require('../../config/environment');var controller=require(_0x0206('0x7'));router['get']('/',auth[_0x0206('0x8')](),controller[_0x0206('0x9')]);router['get'](_0x0206('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0206('0xb')]('/',auth[_0x0206('0x8')](),controller[_0x0206('0xc')]);router[_0x0206('0xd')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0xe')]);router[_0x0206('0xf')](_0x0206('0xa'),auth[_0x0206('0x8')](),controller[_0x0206('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 20a01d8..0255989 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7a9=['ENUM','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x210549,_0x271b24){var _0x340067=function(_0x4591a5){while(--_0x4591a5){_0x210549['push'](_0x210549['shift']());}};_0x340067(++_0x271b24);}(_0xa7a9,0x1dd));var _0x9a7a=function(_0x314079,_0x49341a){_0x314079=_0x314079-0x0;var _0x2a18d3=_0xa7a9[_0x314079];return _0x2a18d3;};'use strict';var Sequelize=require('sequelize');module[_0x9a7a('0x0')]={'type':{'type':Sequelize['ENUM'](_0x9a7a('0x1'),_0x9a7a('0x2'),_0x9a7a('0x3'),_0x9a7a('0x4'),'picklist'),'defaultValue':_0x9a7a('0x1')},'content':{'type':Sequelize[_0x9a7a('0x5')]},'key':{'type':Sequelize[_0x9a7a('0x5')]},'keyType':{'type':Sequelize[_0x9a7a('0x6')](_0x9a7a('0x1'),_0x9a7a('0x2'),_0x9a7a('0x3'))},'keyContent':{'type':Sequelize[_0x9a7a('0x5')]},'idField':{'type':Sequelize[_0x9a7a('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a7a('0x5')]}}; \ No newline at end of file +var _0xc5f6=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x12ca5f,_0x223d98){var _0xfc3ae9=function(_0x1928fb){while(--_0x1928fb){_0x12ca5f['push'](_0x12ca5f['shift']());}};_0xfc3ae9(++_0x223d98);}(_0xc5f6,0x10f));var _0x6c5f=function(_0x2b2219,_0x3a23bd){_0x2b2219=_0x2b2219-0x0;var _0x467ba8=_0xc5f6[_0x2b2219];return _0x467ba8;};'use strict';var Sequelize=require(_0x6c5f('0x0'));module[_0x6c5f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6c5f('0x2'),_0x6c5f('0x3'),_0x6c5f('0x4'),_0x6c5f('0x5'),_0x6c5f('0x6')),'defaultValue':_0x6c5f('0x2')},'content':{'type':Sequelize[_0x6c5f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6c5f('0x2'),_0x6c5f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6c5f('0x7')]},'idField':{'type':Sequelize[_0x6c5f('0x7')]},'nameField':{'type':Sequelize[_0x6c5f('0x7')]},'customField':{'type':Sequelize[_0x6c5f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c5f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d6a45ef..40d617b 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1408=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','then','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','FreshsalesField','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2e3aef,_0x4202d2){var _0x1502d2=function(_0x28d5a2){while(--_0x28d5a2){_0x2e3aef['push'](_0x2e3aef['shift']());}};_0x1502d2(++_0x4202d2);}(_0x1408,0x114));var _0x8140=function(_0x4cf1d3,_0x48b8ce){_0x4cf1d3=_0x4cf1d3-0x0;var _0x5655d8=_0x1408[_0x4cf1d3];return _0x5655d8;};'use strict';var emlformat=require(_0x8140('0x0'));var rimraf=require(_0x8140('0x1'));var zipdir=require(_0x8140('0x2'));var jsonpatch=require(_0x8140('0x3'));var rp=require(_0x8140('0x4'));var moment=require('moment');var BPromise=require(_0x8140('0x5'));var Mustache=require(_0x8140('0x6'));var util=require(_0x8140('0x7'));var path=require(_0x8140('0x8'));var sox=require(_0x8140('0x9'));var csv=require(_0x8140('0xa'));var ejs=require(_0x8140('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8140('0xc'));var squel=require(_0x8140('0xd'));var crypto=require(_0x8140('0xe'));var jsforce=require(_0x8140('0xf'));var deskjs=require(_0x8140('0x10'));var toCsv=require(_0x8140('0xa'));var querystring=require(_0x8140('0x11'));var Papa=require(_0x8140('0x12'));var Redis=require(_0x8140('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8140('0x14'));var hardwareService=require(_0x8140('0x15'));var logger=require(_0x8140('0x16'))(_0x8140('0x17'));var utils=require(_0x8140('0x18'));var config=require(_0x8140('0x19'));var licenseUtil=require(_0x8140('0x1a'));var db=require(_0x8140('0x1b'))['db'];function respondWithStatusCode(_0xea4bac,_0x12435c){_0x12435c=_0x12435c||0xcc;return function(_0x4f62bd){if(_0x4f62bd){return _0xea4bac[_0x8140('0x1c')](_0x12435c);}return _0xea4bac[_0x8140('0x1d')](_0x12435c)['end']();};}function respondWithResult(_0x2660b5,_0x333774){_0x333774=_0x333774||0xc8;return function(_0xc9bce0){if(_0xc9bce0){return _0x2660b5[_0x8140('0x1d')](_0x333774)[_0x8140('0x1e')](_0xc9bce0);}};}function respondWithFilteredResult(_0x29b1fd,_0x32ea57){return function(_0x138152){if(_0x138152){var _0x45676a=typeof _0x32ea57['offset']===_0x8140('0x1f')&&typeof _0x32ea57[_0x8140('0x20')]==='undefined';var _0x353430=_0x138152['count'];var _0x5986eb=_0x45676a?0x0:_0x32ea57[_0x8140('0x21')];var _0x174760=_0x45676a?_0x138152[_0x8140('0x22')]:_0x32ea57[_0x8140('0x21')]+_0x32ea57[_0x8140('0x20')];var _0x1293f7;if(_0x174760>=_0x353430){_0x174760=_0x353430;_0x1293f7=0xc8;}else{_0x1293f7=0xce;}_0x29b1fd[_0x8140('0x1d')](_0x1293f7);return _0x29b1fd[_0x8140('0x23')](_0x8140('0x24'),_0x5986eb+'-'+_0x174760+'/'+_0x353430)[_0x8140('0x1e')](_0x138152);}return null;};}function patchUpdates(_0x10cb93){return function(_0x13f27c){try{jsonpatch['apply'](_0x13f27c,_0x10cb93,!![]);}catch(_0x34e6a9){return BPromise[_0x8140('0x25')](_0x34e6a9);}return _0x13f27c[_0x8140('0x26')]();};}function saveUpdates(_0x4665d1,_0x432aaf){return function(_0x2e3c85){if(_0x2e3c85){return _0x2e3c85[_0x8140('0x27')](_0x4665d1)['then'](function(_0x36b625){return _0x36b625;});}return null;};}function removeEntity(_0x357fef,_0x414405){return function(_0x478259){if(_0x478259){return _0x478259[_0x8140('0x28')]()[_0x8140('0x29')](function(){_0x357fef[_0x8140('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ef4f,_0x1e4030){return function(_0x23f9ae){if(!_0x23f9ae){_0x23ef4f[_0x8140('0x1c')](0x194);}return _0x23f9ae;};}function handleError(_0x574986,_0xa0a80c){_0xa0a80c=_0xa0a80c||0x1f4;return function(_0x57d682){logger['error'](_0x57d682[_0x8140('0x2a')]);if(_0x57d682[_0x8140('0x2b')]){delete _0x57d682[_0x8140('0x2b')];}_0x574986[_0x8140('0x1d')](_0xa0a80c)['send'](_0x57d682);};}exports[_0x8140('0x2c')]=function(_0x35120a,_0x6310d7){var _0xaa98e4={},_0x42ee58={},_0x959e2f={'count':0x0,'rows':[]};var _0x48568a=_['map'](db['FreshsalesField'][_0x8140('0x2d')],function(_0x1ed0fa){return{'name':_0x1ed0fa[_0x8140('0x2e')],'type':_0x1ed0fa[_0x8140('0x2f')][_0x8140('0x30')]};});_0x42ee58[_0x8140('0x31')]=_[_0x8140('0x32')](_0x48568a,_0x8140('0x2b'));_0x42ee58['query']=_[_0x8140('0x33')](_0x35120a[_0x8140('0x34')]);_0x42ee58[_0x8140('0x35')]=_[_0x8140('0x36')](_0x42ee58[_0x8140('0x31')],_0x42ee58[_0x8140('0x34')]);_0xaa98e4[_0x8140('0x37')]=_[_0x8140('0x36')](_0x42ee58['model'],qs[_0x8140('0x38')](_0x35120a[_0x8140('0x34')][_0x8140('0x38')]));_0xaa98e4[_0x8140('0x37')]=_0xaa98e4[_0x8140('0x37')][_0x8140('0x39')]?_0xaa98e4['attributes']:_0x42ee58[_0x8140('0x31')];if(!_0x35120a[_0x8140('0x34')][_0x8140('0x3a')]('nolimit')){_0xaa98e4[_0x8140('0x20')]=qs[_0x8140('0x20')](_0x35120a[_0x8140('0x34')]['limit']);_0xaa98e4[_0x8140('0x21')]=qs[_0x8140('0x21')](_0x35120a[_0x8140('0x34')][_0x8140('0x21')]);}_0xaa98e4['order']=qs[_0x8140('0x3b')](_0x35120a[_0x8140('0x34')][_0x8140('0x3b')]);_0xaa98e4[_0x8140('0x3c')]=qs['filters'](_['pick'](_0x35120a[_0x8140('0x34')],_0x42ee58[_0x8140('0x35')]),_0x48568a);if(_0x35120a[_0x8140('0x34')][_0x8140('0x3d')]){_0xaa98e4['where']=_[_0x8140('0x3e')](_0xaa98e4[_0x8140('0x3c')],{'$or':_[_0x8140('0x32')](_0x48568a,function(_0x2a8dd3){if(_0x2a8dd3[_0x8140('0x2f')]!==_0x8140('0x3f')){var _0x44d4f0={};_0x44d4f0[_0x2a8dd3[_0x8140('0x2b')]]={'$like':'%'+_0x35120a[_0x8140('0x34')]['filter']+'%'};return _0x44d4f0;}})});}_0xaa98e4=_[_0x8140('0x3e')]({},_0xaa98e4,_0x35120a['options']);var _0xb63107={'where':_0xaa98e4[_0x8140('0x3c')]};return db['FreshsalesField']['count'](_0xb63107)[_0x8140('0x29')](function(_0x356c9e){_0x959e2f['count']=_0x356c9e;if(_0x35120a[_0x8140('0x34')][_0x8140('0x40')]){_0xaa98e4[_0x8140('0x41')]=[{'all':!![]}];}return db[_0x8140('0x42')][_0x8140('0x43')](_0xaa98e4);})[_0x8140('0x29')](function(_0x120348){_0x959e2f['rows']=_0x120348;return _0x959e2f;})[_0x8140('0x29')](respondWithFilteredResult(_0x6310d7,_0xaa98e4))[_0x8140('0x44')](handleError(_0x6310d7,null));};exports[_0x8140('0x45')]=function(_0x4a3aaa,_0x42509a){var _0x54d23c={'raw':!![],'where':{'id':_0x4a3aaa[_0x8140('0x46')]['id']}},_0x5b9592={};_0x5b9592['model']=_[_0x8140('0x33')](db[_0x8140('0x42')][_0x8140('0x2d')]);_0x5b9592[_0x8140('0x34')]=_[_0x8140('0x33')](_0x4a3aaa[_0x8140('0x34')]);_0x5b9592['filters']=_[_0x8140('0x36')](_0x5b9592['model'],_0x5b9592[_0x8140('0x34')]);_0x54d23c[_0x8140('0x37')]=_[_0x8140('0x36')](_0x5b9592[_0x8140('0x31')],qs[_0x8140('0x38')](_0x4a3aaa['query'][_0x8140('0x38')]));_0x54d23c[_0x8140('0x37')]=_0x54d23c[_0x8140('0x37')]['length']?_0x54d23c[_0x8140('0x37')]:_0x5b9592[_0x8140('0x31')];if(_0x4a3aaa['query'][_0x8140('0x40')]){_0x54d23c['include']=[{'all':!![]}];}_0x54d23c=_[_0x8140('0x3e')]({},_0x54d23c,_0x4a3aaa['options']);return db[_0x8140('0x42')]['find'](_0x54d23c)['then'](handleEntityNotFound(_0x42509a,null))[_0x8140('0x29')](respondWithResult(_0x42509a,null))[_0x8140('0x44')](handleError(_0x42509a,null));};exports[_0x8140('0x47')]=function(_0x542af0,_0x2fe581){return db[_0x8140('0x42')][_0x8140('0x47')](_0x542af0[_0x8140('0x48')],{})[_0x8140('0x29')](respondWithResult(_0x2fe581,0xc9))[_0x8140('0x44')](handleError(_0x2fe581,null));};exports[_0x8140('0x27')]=function(_0x407324,_0x137ff1){if(_0x407324[_0x8140('0x48')]['id']){delete _0x407324[_0x8140('0x48')]['id'];}return db[_0x8140('0x42')][_0x8140('0x49')]({'where':{'id':_0x407324[_0x8140('0x46')]['id']}})[_0x8140('0x29')](handleEntityNotFound(_0x137ff1,null))['then'](saveUpdates(_0x407324[_0x8140('0x48')],null))['then'](respondWithResult(_0x137ff1,null))[_0x8140('0x44')](handleError(_0x137ff1,null));};exports[_0x8140('0x28')]=function(_0x1abb3e,_0x11e535){return db[_0x8140('0x42')][_0x8140('0x49')]({'where':{'id':_0x1abb3e[_0x8140('0x46')]['id']}})['then'](handleEntityNotFound(_0x11e535,null))['then'](removeEntity(_0x11e535,null))[_0x8140('0x44')](handleError(_0x11e535,null));}; \ No newline at end of file +var _0x635a=['util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x18d140,_0x3743a2){var _0xdcc5f3=function(_0x58fc89){while(--_0x58fc89){_0x18d140['push'](_0x18d140['shift']());}};_0xdcc5f3(++_0x3743a2);}(_0x635a,0x16b));var _0xa635=function(_0x3c56da,_0x1bae92){_0x3c56da=_0x3c56da-0x0;var _0x11e193=_0x635a[_0x3c56da];return _0x11e193;};'use strict';var emlformat=require(_0xa635('0x0'));var rimraf=require(_0xa635('0x1'));var zipdir=require(_0xa635('0x2'));var jsonpatch=require(_0xa635('0x3'));var rp=require(_0xa635('0x4'));var moment=require(_0xa635('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa635('0x6'));var util=require(_0xa635('0x7'));var path=require('path');var sox=require(_0xa635('0x8'));var csv=require('to-csv');var ejs=require(_0xa635('0x9'));var fs=require('fs');var fs_extra=require(_0xa635('0xa'));var _=require('lodash');var squel=require(_0xa635('0xb'));var crypto=require(_0xa635('0xc'));var jsforce=require(_0xa635('0xd'));var deskjs=require(_0xa635('0xe'));var toCsv=require(_0xa635('0xf'));var querystring=require(_0xa635('0x10'));var Papa=require('papaparse');var Redis=require(_0xa635('0x11'));var authService=require(_0xa635('0x12'));var qs=require(_0xa635('0x13'));var as=require(_0xa635('0x14'));var hardwareService=require(_0xa635('0x15'));var logger=require('../../config/logger')(_0xa635('0x16'));var utils=require('../../config/utils');var config=require(_0xa635('0x17'));var licenseUtil=require(_0xa635('0x18'));var db=require(_0xa635('0x19'))['db'];function respondWithStatusCode(_0x3dd6e0,_0x3db736){_0x3db736=_0x3db736||0xcc;return function(_0x1de907){if(_0x1de907){return _0x3dd6e0[_0xa635('0x1a')](_0x3db736);}return _0x3dd6e0[_0xa635('0x1b')](_0x3db736)[_0xa635('0x1c')]();};}function respondWithResult(_0x349ea2,_0x358dd1){_0x358dd1=_0x358dd1||0xc8;return function(_0x235b9f){if(_0x235b9f){return _0x349ea2[_0xa635('0x1b')](_0x358dd1)[_0xa635('0x1d')](_0x235b9f);}};}function respondWithFilteredResult(_0x3bce81,_0x56f50b){return function(_0x217626){if(_0x217626){var _0x246bca=typeof _0x56f50b[_0xa635('0x1e')]===_0xa635('0x1f')&&typeof _0x56f50b[_0xa635('0x20')]==='undefined';var _0x155436=_0x217626[_0xa635('0x21')];var _0x473a0f=_0x246bca?0x0:_0x56f50b['offset'];var _0x254bc1=_0x246bca?_0x217626[_0xa635('0x21')]:_0x56f50b[_0xa635('0x1e')]+_0x56f50b[_0xa635('0x20')];var _0x42f168;if(_0x254bc1>=_0x155436){_0x254bc1=_0x155436;_0x42f168=0xc8;}else{_0x42f168=0xce;}_0x3bce81[_0xa635('0x1b')](_0x42f168);return _0x3bce81[_0xa635('0x22')](_0xa635('0x23'),_0x473a0f+'-'+_0x254bc1+'/'+_0x155436)['json'](_0x217626);}return null;};}function patchUpdates(_0x2be0e0){return function(_0x550b79){try{jsonpatch[_0xa635('0x24')](_0x550b79,_0x2be0e0,!![]);}catch(_0x4a634f){return BPromise[_0xa635('0x25')](_0x4a634f);}return _0x550b79['save']();};}function saveUpdates(_0x4782a9,_0x8d8d06){return function(_0x314ebf){if(_0x314ebf){return _0x314ebf[_0xa635('0x26')](_0x4782a9)[_0xa635('0x27')](function(_0x166de7){return _0x166de7;});}return null;};}function removeEntity(_0x5e466c,_0x28a7df){return function(_0x3daff2){if(_0x3daff2){return _0x3daff2[_0xa635('0x28')]()['then'](function(){_0x5e466c[_0xa635('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd13d0e,_0x42dccf){return function(_0xb214e6){if(!_0xb214e6){_0xd13d0e[_0xa635('0x1a')](0x194);}return _0xb214e6;};}function handleError(_0x25ffe3,_0x39584f){_0x39584f=_0x39584f||0x1f4;return function(_0x3de255){logger['error'](_0x3de255[_0xa635('0x29')]);if(_0x3de255[_0xa635('0x2a')]){delete _0x3de255[_0xa635('0x2a')];}_0x25ffe3[_0xa635('0x1b')](_0x39584f)['send'](_0x3de255);};}exports[_0xa635('0x2b')]=function(_0x4259c0,_0x297be7){var _0x4032ef={},_0x34ed9a={},_0x27fa50={'count':0x0,'rows':[]};var _0x3843b6=_[_0xa635('0x2c')](db['FreshsalesField'][_0xa635('0x2d')],function(_0x3212a4){return{'name':_0x3212a4['fieldName'],'type':_0x3212a4[_0xa635('0x2e')][_0xa635('0x2f')]};});_0x34ed9a[_0xa635('0x30')]=_[_0xa635('0x2c')](_0x3843b6,_0xa635('0x2a'));_0x34ed9a[_0xa635('0x31')]=_[_0xa635('0x32')](_0x4259c0['query']);_0x34ed9a['filters']=_[_0xa635('0x33')](_0x34ed9a[_0xa635('0x30')],_0x34ed9a[_0xa635('0x31')]);_0x4032ef['attributes']=_[_0xa635('0x33')](_0x34ed9a[_0xa635('0x30')],qs[_0xa635('0x34')](_0x4259c0[_0xa635('0x31')][_0xa635('0x34')]));_0x4032ef[_0xa635('0x35')]=_0x4032ef[_0xa635('0x35')][_0xa635('0x36')]?_0x4032ef[_0xa635('0x35')]:_0x34ed9a[_0xa635('0x30')];if(!_0x4259c0['query'][_0xa635('0x37')](_0xa635('0x38'))){_0x4032ef['limit']=qs['limit'](_0x4259c0[_0xa635('0x31')][_0xa635('0x20')]);_0x4032ef[_0xa635('0x1e')]=qs[_0xa635('0x1e')](_0x4259c0[_0xa635('0x31')][_0xa635('0x1e')]);}_0x4032ef[_0xa635('0x39')]=qs['sort'](_0x4259c0[_0xa635('0x31')]['sort']);_0x4032ef[_0xa635('0x3a')]=qs[_0xa635('0x3b')](_[_0xa635('0x3c')](_0x4259c0['query'],_0x34ed9a[_0xa635('0x3b')]),_0x3843b6);if(_0x4259c0[_0xa635('0x31')][_0xa635('0x3d')]){_0x4032ef[_0xa635('0x3a')]=_[_0xa635('0x3e')](_0x4032ef['where'],{'$or':_[_0xa635('0x2c')](_0x3843b6,function(_0xcfeac){if(_0xcfeac[_0xa635('0x2e')]!=='VIRTUAL'){var _0x1c7a9a={};_0x1c7a9a[_0xcfeac[_0xa635('0x2a')]]={'$like':'%'+_0x4259c0[_0xa635('0x31')][_0xa635('0x3d')]+'%'};return _0x1c7a9a;}})});}_0x4032ef=_['merge']({},_0x4032ef,_0x4259c0[_0xa635('0x3f')]);var _0x1b3db4={'where':_0x4032ef['where']};return db[_0xa635('0x40')][_0xa635('0x21')](_0x1b3db4)[_0xa635('0x27')](function(_0x513354){_0x27fa50[_0xa635('0x21')]=_0x513354;if(_0x4259c0['query'][_0xa635('0x41')]){_0x4032ef[_0xa635('0x42')]=[{'all':!![]}];}return db[_0xa635('0x40')][_0xa635('0x43')](_0x4032ef);})[_0xa635('0x27')](function(_0x3e06fb){_0x27fa50['rows']=_0x3e06fb;return _0x27fa50;})[_0xa635('0x27')](respondWithFilteredResult(_0x297be7,_0x4032ef))[_0xa635('0x44')](handleError(_0x297be7,null));};exports[_0xa635('0x45')]=function(_0x42996a,_0x3241cb){var _0xa4cb97={'raw':!![],'where':{'id':_0x42996a[_0xa635('0x46')]['id']}},_0x5dd394={};_0x5dd394[_0xa635('0x30')]=_[_0xa635('0x32')](db['FreshsalesField']['rawAttributes']);_0x5dd394[_0xa635('0x31')]=_[_0xa635('0x32')](_0x42996a['query']);_0x5dd394[_0xa635('0x3b')]=_[_0xa635('0x33')](_0x5dd394[_0xa635('0x30')],_0x5dd394[_0xa635('0x31')]);_0xa4cb97[_0xa635('0x35')]=_[_0xa635('0x33')](_0x5dd394[_0xa635('0x30')],qs[_0xa635('0x34')](_0x42996a[_0xa635('0x31')][_0xa635('0x34')]));_0xa4cb97[_0xa635('0x35')]=_0xa4cb97[_0xa635('0x35')][_0xa635('0x36')]?_0xa4cb97[_0xa635('0x35')]:_0x5dd394[_0xa635('0x30')];if(_0x42996a[_0xa635('0x31')]['includeAll']){_0xa4cb97[_0xa635('0x42')]=[{'all':!![]}];}_0xa4cb97=_[_0xa635('0x3e')]({},_0xa4cb97,_0x42996a[_0xa635('0x3f')]);return db[_0xa635('0x40')]['find'](_0xa4cb97)[_0xa635('0x27')](handleEntityNotFound(_0x3241cb,null))[_0xa635('0x27')](respondWithResult(_0x3241cb,null))['catch'](handleError(_0x3241cb,null));};exports[_0xa635('0x47')]=function(_0x5eac71,_0x5209ac){return db[_0xa635('0x40')][_0xa635('0x47')](_0x5eac71[_0xa635('0x48')],{})[_0xa635('0x27')](respondWithResult(_0x5209ac,0xc9))[_0xa635('0x44')](handleError(_0x5209ac,null));};exports[_0xa635('0x26')]=function(_0x4233f5,_0x226fbe){if(_0x4233f5[_0xa635('0x48')]['id']){delete _0x4233f5['body']['id'];}return db['FreshsalesField'][_0xa635('0x49')]({'where':{'id':_0x4233f5[_0xa635('0x46')]['id']}})['then'](handleEntityNotFound(_0x226fbe,null))[_0xa635('0x27')](saveUpdates(_0x4233f5[_0xa635('0x48')],null))[_0xa635('0x27')](respondWithResult(_0x226fbe,null))[_0xa635('0x44')](handleError(_0x226fbe,null));};exports[_0xa635('0x28')]=function(_0x453893,_0x5e9396){return db[_0xa635('0x40')]['find']({'where':{'id':_0x453893[_0xa635('0x46')]['id']}})[_0xa635('0x27')](handleEntityNotFound(_0x5e9396,null))['then'](removeEntity(_0x5e9396,null))[_0xa635('0x44')](handleError(_0x5e9396,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0da221a..f89a3af 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a9a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util'];(function(_0x23be33,_0x2695e9){var _0x53202c=function(_0x566243){while(--_0x566243){_0x23be33['push'](_0x23be33['shift']());}};_0x53202c(++_0x2695e9);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x8a9a[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var logger=require(_0xa8a9('0x1'))(_0xa8a9('0x2'));var moment=require(_0xa8a9('0x3'));var BPromise=require(_0xa8a9('0x4'));var rp=require(_0xa8a9('0x5'));var fs=require('fs');var path=require(_0xa8a9('0x6'));var rimraf=require(_0xa8a9('0x7'));var config=require(_0xa8a9('0x8'));var attributes=require(_0xa8a9('0x9'));module[_0xa8a9('0xa')]=function(_0x1de1c6,_0x4ac303){return _0x1de1c6[_0xa8a9('0xb')]('FreshsalesField',attributes,{'tableName':_0xa8a9('0xc'),'paranoid':![],'indexes':[{'name':_0xa8a9('0xd'),'fields':[_0xa8a9('0xe'),_0xa8a9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2e=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','freshsales_unique_index','idField'];(function(_0x4a3a4b,_0x29dd38){var _0x301cc6=function(_0x1f2d8d){while(--_0x1f2d8d){_0x4a3a4b['push'](_0x4a3a4b['shift']());}};_0x301cc6(++_0x29dd38);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0x3f2e[_0x420282];return _0x535480;};'use strict';var _=require(_0xe3f2('0x0'));var util=require('util');var logger=require(_0xe3f2('0x1'))(_0xe3f2('0x2'));var moment=require(_0xe3f2('0x3'));var BPromise=require(_0xe3f2('0x4'));var rp=require(_0xe3f2('0x5'));var fs=require('fs');var path=require(_0xe3f2('0x6'));var rimraf=require(_0xe3f2('0x7'));var config=require('../../config/environment');var attributes=require(_0xe3f2('0x8'));module['exports']=function(_0x7cdd2e,_0x2d6460){return _0x7cdd2e['define']('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xe3f2('0x9'),'fields':[_0xe3f2('0xa'),_0xe3f2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 40c48dc..42fe59d 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c40ba,_0xca7576){var _0x3d3426=function(_0x3450a8){while(--_0x3450a8){_0x1c40ba['push'](_0x1c40ba['shift']());}};_0x3d3426(++_0xca7576);}(_0x1623,0xab));var _0x3162=function(_0x33a059,_0x34af2d){_0x33a059=_0x33a059-0x0;var _0x2a25bf=_0x1623[_0x33a059];return _0x2a25bf;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file +var _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x814b,0x1a2));var _0xb814=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0x814b[_0x5d31f3];return _0x1cc88c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 085ab23..54a95e7 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xdbd844,_0xc853d0){var _0x16ba40=function(_0x3714b0){while(--_0x3714b0){_0xdbd844['push'](_0xdbd844['shift']());}};_0x16ba40(++_0xc853d0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2d3179,_0x8b66bb){var _0x45ae9f=function(_0x3499cc){while(--_0x3499cc){_0x2d3179['push'](_0x2d3179['shift']());}};_0x45ae9f(++_0x8b66bb);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index c5986f3..05f447c 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf65d=['STRING','username','integrationTab','newTab','sequelize'];(function(_0x5b84ff,_0x47e637){var _0xf145d9=function(_0x554033){while(--_0x554033){_0x5b84ff['push'](_0x5b84ff['shift']());}};_0xf145d9(++_0x47e637);}(_0xf65d,0x9f));var _0xdf65=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xf65d[_0x5e9a69];return _0x5979c8;};'use strict';var Sequelize=require(_0xdf65('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf65('0x1')]},'description':{'type':Sequelize[_0xdf65('0x1')]},'username':{'type':Sequelize[_0xdf65('0x1')],'unique':_0xdf65('0x2')},'remoteUri':{'type':Sequelize[_0xdf65('0x1')]},'password':{'type':Sequelize[_0xdf65('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdf65('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xdf65('0x3'),_0xdf65('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5416=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0xca27f3,_0x1eb017){var _0x1a4173=function(_0x384fa4){while(--_0x384fa4){_0xca27f3['push'](_0xca27f3['shift']());}};_0x1a4173(++_0x1eb017);}(_0x5416,0x13d));var _0x6541=function(_0x593c03,_0x56dc77){_0x593c03=_0x593c03-0x0;var _0x798be3=_0x5416[_0x593c03];return _0x798be3;};'use strict';var Sequelize=require(_0x6541('0x0'));module[_0x6541('0x1')]={'name':{'type':Sequelize[_0x6541('0x2')]},'description':{'type':Sequelize[_0x6541('0x2')]},'username':{'type':Sequelize[_0x6541('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x6541('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6541('0x2')]},'clientSecret':{'type':Sequelize[_0x6541('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6541('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6541('0x3')](_0x6541('0x4'),_0x6541('0x5')),'defaultValue':_0x6541('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index f8dd978..fa75171 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe198=['ticketType','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','remove','includes','label','custom','picklistValues','true','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SalesforceAccount','includeAll','include','catch','params','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','clientId','clientSecret','securityToken','substring','lastIndexOf','login','password','concat'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe198,0x15d));var _0x8e19=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe198[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0x8e19('0x0'));var rimraf=require(_0x8e19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e19('0x2'));var rp=require('request-promise');var moment=require(_0x8e19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8e19('0x4'));var util=require(_0x8e19('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8e19('0x6'));var ejs=require(_0x8e19('0x7'));var fs=require('fs');var fs_extra=require(_0x8e19('0x8'));var _=require('lodash');var squel=require(_0x8e19('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e19('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8e19('0xb'));var Papa=require(_0x8e19('0xc'));var Redis=require(_0x8e19('0xd'));var authService=require(_0x8e19('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8e19('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e19('0x10'))('api');var utils=require(_0x8e19('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8e19('0x12'));var db=require(_0x8e19('0x13'))['db'];var integrations=require(_0x8e19('0x14'));function respondWithStatusCode(_0x31ce87,_0x19667c){_0x19667c=_0x19667c||0xcc;return function(_0x5b3c97){if(_0x5b3c97){return _0x31ce87[_0x8e19('0x15')](_0x19667c);}return _0x31ce87[_0x8e19('0x16')](_0x19667c)[_0x8e19('0x17')]();};}function respondWithResult(_0x3a7784,_0x280666){_0x280666=_0x280666||0xc8;return function(_0x3955bf){if(_0x3955bf){return _0x3a7784['status'](_0x280666)[_0x8e19('0x18')](_0x3955bf);}};}function respondWithFilteredResult(_0x2a520b,_0x5b859d){return function(_0x2edcfa){if(_0x2edcfa){var _0x334fc7=typeof _0x5b859d[_0x8e19('0x19')]==='undefined'&&typeof _0x5b859d[_0x8e19('0x1a')]===_0x8e19('0x1b');var _0x2277ae=_0x2edcfa[_0x8e19('0x1c')];var _0x44284b=_0x334fc7?0x0:_0x5b859d['offset'];var _0x1f8b91=_0x334fc7?_0x2edcfa['count']:_0x5b859d['offset']+_0x5b859d[_0x8e19('0x1a')];var _0x5dfe47;if(_0x1f8b91>=_0x2277ae){_0x1f8b91=_0x2277ae;_0x5dfe47=0xc8;}else{_0x5dfe47=0xce;}_0x2a520b[_0x8e19('0x16')](_0x5dfe47);return _0x2a520b[_0x8e19('0x1d')]('Content-Range',_0x44284b+'-'+_0x1f8b91+'/'+_0x2277ae)[_0x8e19('0x18')](_0x2edcfa);}return null;};}function patchUpdates(_0x339a2d){return function(_0x13cd71){try{jsonpatch[_0x8e19('0x1e')](_0x13cd71,_0x339a2d,!![]);}catch(_0x37955f){return BPromise[_0x8e19('0x1f')](_0x37955f);}return _0x13cd71['save']();};}function saveUpdates(_0x3bb838,_0x46efde){return function(_0xb16ea7){if(_0xb16ea7){return _0xb16ea7[_0x8e19('0x20')](_0x3bb838)[_0x8e19('0x21')](function(_0x31713d){return _0x31713d;});}return null;};}function removeEntity(_0x4eb00a,_0x41cdf7){return function(_0x5d1ac3){if(_0x5d1ac3){return _0x5d1ac3[_0x8e19('0x22')]()['then'](function(){_0x4eb00a[_0x8e19('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56be58,_0x26bce3){return function(_0x5928d8){if(!_0x5928d8){_0x56be58[_0x8e19('0x15')](0x194);}return _0x5928d8;};}function handleError(_0x135009,_0xe75cbb){_0xe75cbb=_0xe75cbb||0x1f4;return function(_0x32100a){logger[_0x8e19('0x23')](_0x32100a[_0x8e19('0x24')]);if(_0x32100a[_0x8e19('0x25')]){delete _0x32100a['name'];}_0x135009[_0x8e19('0x16')](_0xe75cbb)[_0x8e19('0x26')](_0x32100a);};}exports[_0x8e19('0x27')]=function(_0x580b54,_0xfd4bb7){var _0xea6733={},_0x457dda={},_0x2bf23e={'count':0x0,'rows':[]};var _0x2c4bc0=_['map'](db['SalesforceAccount'][_0x8e19('0x28')],function(_0x5957bd){return{'name':_0x5957bd['fieldName'],'type':_0x5957bd[_0x8e19('0x29')]['key']};});_0x457dda[_0x8e19('0x2a')]=_[_0x8e19('0x2b')](_0x2c4bc0,_0x8e19('0x25'));_0x457dda[_0x8e19('0x2c')]=_[_0x8e19('0x2d')](_0x580b54[_0x8e19('0x2c')]);_0x457dda[_0x8e19('0x2e')]=_['intersection'](_0x457dda[_0x8e19('0x2a')],_0x457dda[_0x8e19('0x2c')]);_0xea6733['attributes']=_[_0x8e19('0x2f')](_0x457dda[_0x8e19('0x2a')],qs['fields'](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x30')]));_0xea6733[_0x8e19('0x31')]=_0xea6733['attributes'][_0x8e19('0x32')]?_0xea6733[_0x8e19('0x31')]:_0x457dda[_0x8e19('0x2a')];if(!_0x580b54[_0x8e19('0x2c')]['hasOwnProperty'](_0x8e19('0x33'))){_0xea6733[_0x8e19('0x1a')]=qs[_0x8e19('0x1a')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x1a')]);_0xea6733['offset']=qs[_0x8e19('0x19')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x19')]);}_0xea6733[_0x8e19('0x34')]=qs[_0x8e19('0x35')](_0x580b54[_0x8e19('0x2c')][_0x8e19('0x35')]);_0xea6733[_0x8e19('0x36')]=qs[_0x8e19('0x2e')](_[_0x8e19('0x37')](_0x580b54[_0x8e19('0x2c')],_0x457dda['filters']),_0x2c4bc0);if(_0x580b54['query'][_0x8e19('0x38')]){_0xea6733['where']=_[_0x8e19('0x39')](_0xea6733[_0x8e19('0x36')],{'$or':_[_0x8e19('0x2b')](_0x2c4bc0,function(_0x2fa54a){if(_0x2fa54a[_0x8e19('0x29')]!==_0x8e19('0x3a')){var _0x41528b={};_0x41528b[_0x2fa54a[_0x8e19('0x25')]]={'$like':'%'+_0x580b54[_0x8e19('0x2c')][_0x8e19('0x38')]+'%'};return _0x41528b;}})});}_0xea6733=_[_0x8e19('0x39')]({},_0xea6733,_0x580b54['options']);var _0x587c94={'where':_0xea6733[_0x8e19('0x36')]};return db[_0x8e19('0x3b')][_0x8e19('0x1c')](_0x587c94)[_0x8e19('0x21')](function(_0x3bfb11){_0x2bf23e[_0x8e19('0x1c')]=_0x3bfb11;if(_0x580b54[_0x8e19('0x2c')][_0x8e19('0x3c')]){_0xea6733[_0x8e19('0x3d')]=[{'all':!![]}];}return db[_0x8e19('0x3b')]['findAll'](_0xea6733);})[_0x8e19('0x21')](function(_0x1b16e5){_0x2bf23e['rows']=_0x1b16e5;return _0x2bf23e;})['then'](respondWithFilteredResult(_0xfd4bb7,_0xea6733))[_0x8e19('0x3e')](handleError(_0xfd4bb7,null));};exports['show']=function(_0x587cb9,_0x30f7e4){var _0x35e8ed={'raw':![],'where':{'id':_0x587cb9[_0x8e19('0x3f')]['id']}},_0x405f7e={};_0x405f7e[_0x8e19('0x2a')]=_['keys'](db['SalesforceAccount'][_0x8e19('0x28')]);_0x405f7e[_0x8e19('0x2c')]=_[_0x8e19('0x2d')](_0x587cb9[_0x8e19('0x2c')]);_0x405f7e[_0x8e19('0x2e')]=_[_0x8e19('0x2f')](_0x405f7e[_0x8e19('0x2a')],_0x405f7e['query']);_0x35e8ed[_0x8e19('0x31')]=_[_0x8e19('0x2f')](_0x405f7e[_0x8e19('0x2a')],qs[_0x8e19('0x30')](_0x587cb9[_0x8e19('0x2c')][_0x8e19('0x30')]));_0x35e8ed[_0x8e19('0x31')]=_0x35e8ed['attributes'][_0x8e19('0x32')]?_0x35e8ed['attributes']:_0x405f7e[_0x8e19('0x2a')];if(_0x587cb9[_0x8e19('0x2c')]['includeAll']){_0x35e8ed[_0x8e19('0x3d')]=[{'all':!![]}];}_0x35e8ed=_[_0x8e19('0x39')]({},_0x35e8ed,_0x587cb9[_0x8e19('0x40')]);return db[_0x8e19('0x3b')][_0x8e19('0x41')](_0x35e8ed)[_0x8e19('0x21')](handleEntityNotFound(_0x30f7e4,null))[_0x8e19('0x21')](respondWithResult(_0x30f7e4,null))[_0x8e19('0x3e')](handleError(_0x30f7e4,null));};exports[_0x8e19('0x42')]=function(_0x49277c,_0x249f11){return db[_0x8e19('0x3b')]['create'](_0x49277c[_0x8e19('0x43')],{})[_0x8e19('0x21')](respondWithResult(_0x249f11,0xc9))[_0x8e19('0x3e')](handleError(_0x249f11,null));};exports[_0x8e19('0x20')]=function(_0xfeca16,_0x4d7592){if(_0xfeca16['body']['id']){delete _0xfeca16[_0x8e19('0x43')]['id'];}return db[_0x8e19('0x3b')][_0x8e19('0x41')]({'where':{'id':_0xfeca16['params']['id']}})[_0x8e19('0x21')](handleEntityNotFound(_0x4d7592,null))[_0x8e19('0x21')](saveUpdates(_0xfeca16[_0x8e19('0x43')],null))['then'](respondWithResult(_0x4d7592,null))['catch'](handleError(_0x4d7592,null));};exports[_0x8e19('0x22')]=function(_0x5808e0,_0x4e0211){return db[_0x8e19('0x3b')][_0x8e19('0x41')]({'where':{'id':_0x5808e0[_0x8e19('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e0211,null))[_0x8e19('0x21')](removeEntity(_0x4e0211,null))['catch'](handleError(_0x4e0211,null));};exports[_0x8e19('0x44')]=function(_0x33eb0c,_0x506083,_0x451127){var _0x52de01={};var _0x3c15d6={};var _0x5ef09a;var _0x344cc9;return db[_0x8e19('0x3b')][_0x8e19('0x45')]({'where':{'id':_0x33eb0c[_0x8e19('0x3f')]['id']}})['then'](handleEntityNotFound(_0x506083,null))[_0x8e19('0x21')](function(_0x329e08){if(_0x329e08){_0x5ef09a=_0x329e08;_0x3c15d6[_0x8e19('0x2a')]=_[_0x8e19('0x2d')](db[_0x8e19('0x46')]['rawAttributes']);_0x3c15d6['query']=_['keys'](_0x33eb0c[_0x8e19('0x2c')]);_0x3c15d6[_0x8e19('0x2e')]=_[_0x8e19('0x2f')](_0x3c15d6[_0x8e19('0x2a')],_0x3c15d6[_0x8e19('0x2c')]);_0x52de01['attributes']=_[_0x8e19('0x2f')](_0x3c15d6[_0x8e19('0x2a')],qs[_0x8e19('0x30')](_0x33eb0c[_0x8e19('0x2c')][_0x8e19('0x30')]));_0x52de01[_0x8e19('0x31')]=_0x52de01['attributes'][_0x8e19('0x32')]?_0x52de01[_0x8e19('0x31')]:_0x3c15d6[_0x8e19('0x2a')];_0x52de01[_0x8e19('0x34')]=qs[_0x8e19('0x35')](_0x33eb0c[_0x8e19('0x2c')]['sort']);_0x52de01[_0x8e19('0x36')]=qs[_0x8e19('0x2e')](_[_0x8e19('0x37')](_0x33eb0c['query'],_0x3c15d6[_0x8e19('0x2e')]));if(_0x33eb0c[_0x8e19('0x2c')]['filter']){_0x52de01[_0x8e19('0x36')]=_[_0x8e19('0x39')](_0x52de01[_0x8e19('0x36')],{'$or':_[_0x8e19('0x2b')](_0x52de01['attributes'],function(_0x5d19b2){var _0x9e9611={};_0x9e9611[_0x5d19b2]={'$like':'%'+_0x33eb0c[_0x8e19('0x2c')]['filter']+'%'};return _0x9e9611;})});}_0x52de01=_[_0x8e19('0x39')]({},_0x52de01,_0x33eb0c[_0x8e19('0x40')]);return _0x5ef09a['getConfigurations'](_0x52de01);}})[_0x8e19('0x21')](function(_0x117bb6){if(_0x117bb6){_0x344cc9=_0x117bb6[_0x8e19('0x32')];if(!_0x33eb0c[_0x8e19('0x2c')]['hasOwnProperty'](_0x8e19('0x33'))){_0x52de01[_0x8e19('0x1a')]=qs[_0x8e19('0x1a')](_0x33eb0c[_0x8e19('0x2c')][_0x8e19('0x1a')]);_0x52de01[_0x8e19('0x19')]=qs[_0x8e19('0x19')](_0x33eb0c['query'][_0x8e19('0x19')]);}return _0x5ef09a[_0x8e19('0x44')](_0x52de01);}})[_0x8e19('0x21')](function(_0x555883){if(_0x555883){return _0x555883?{'count':_0x344cc9,'rows':_0x555883}:null;}})[_0x8e19('0x21')](respondWithResult(_0x506083,null))[_0x8e19('0x3e')](handleError(_0x506083,null));};exports[_0x8e19('0x47')]=function(_0x515fec,_0x480d89,_0x4e1d77){if(_0x515fec[_0x8e19('0x43')]['id']){delete _0x515fec['body']['id'];}return db[_0x8e19('0x3b')][_0x8e19('0x45')]({'where':{'id':_0x515fec['params']['id']}})['then'](handleEntityNotFound(_0x480d89,null))['then'](function(_0x19125f){if(_0x19125f){_0x515fec[_0x8e19('0x43')][_0x8e19('0x48')]=_0x19125f['id'];_0x515fec[_0x8e19('0x43')][_0x8e19('0x49')]=integrations[_0x8e19('0x4a')](_0x515fec[_0x8e19('0x43')][_0x8e19('0x4b')],_0x515fec[_0x8e19('0x43')][_0x8e19('0x29')]);_0x515fec[_0x8e19('0x43')][_0x8e19('0x4c')]=integrations['getDescriptions'](_0x515fec['body'][_0x8e19('0x4b')],_0x515fec[_0x8e19('0x43')][_0x8e19('0x29')]);return db[_0x8e19('0x46')]['create'](_0x515fec[_0x8e19('0x43')],{'include':[{'model':db['SalesforceField'],'as':_0x8e19('0x49')},{'model':db['SalesforceField'],'as':_0x8e19('0x4c')}]});}return null;})['then'](respondWithResult(_0x480d89,null))['catch'](handleError(_0x480d89,null));};exports[_0x8e19('0x4d')]=function(_0x3fe1ca,_0x588819,_0x26aadb){var _0x412e6e;var _0x529cb9='';var _0x195e8d='Task';return db['SalesforceAccount'][_0x8e19('0x45')]({'where':{'id':_0x3fe1ca[_0x8e19('0x3f')]['id']},'attributes':['id',_0x8e19('0x4e'),_0x8e19('0x4f'),_0x8e19('0x50'),'username','password',_0x8e19('0x51')]})[_0x8e19('0x21')](handleEntityNotFound(_0x588819,null))[_0x8e19('0x21')](function(_0x77986d){if(_0x77986d){_0x529cb9=_0x77986d[_0x8e19('0x4e')];var _0x37bb83=_0x529cb9['slice'](-0x1);if(_0x37bb83==='/'){_0x529cb9=_0x529cb9[_0x8e19('0x52')](0x0,_0x529cb9[_0x8e19('0x53')](_0x37bb83));}_0x412e6e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x529cb9,'clientId':_0x77986d[_0x8e19('0x4f')],'clientSecret':_0x77986d[_0x8e19('0x50')]}});return _0x412e6e[_0x8e19('0x54')](_0x77986d['username'],_0x77986d[_0x8e19('0x55')][_0x8e19('0x56')](_0x77986d[_0x8e19('0x51')]));}})[_0x8e19('0x21')](function(_0x2c30c1){if(_0x2c30c1){if(!_['isNil'](_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x57')])){_0x195e8d=_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x57')];}return _0x412e6e['sobject'](_0x195e8d)[_0x8e19('0x58')]();}})[_0x8e19('0x21')](function(_0x2243b0){var _0x308e02=['OwnerId','ActivityDate',_0x8e19('0x59'),_0x8e19('0x5a'),_0x8e19('0x5b'),_0x8e19('0x5c')];var _0x27c469=[_0x8e19('0x5d'),_0x8e19('0x5e'),_0x8e19('0x5f'),'boolean',_0x8e19('0x60'),_0x8e19('0x61'),'phone'];if(_0x2243b0){_[_0x8e19('0x62')](_0x2243b0[_0x8e19('0x30')],function(_0x4231fc){return _0x308e02[_0x8e19('0x63')](_0x4231fc[_0x8e19('0x25')])||!_0x27c469['includes'](_0x4231fc[_0x8e19('0x29')]);});return{'count':_0x2243b0['fields'][_0x8e19('0x32')],'rows':_['map'](_0x2243b0[_0x8e19('0x30')],function(_0x1b2f1d){return{'id':_0x1b2f1d[_0x8e19('0x25')],'name':_0x1b2f1d[_0x8e19('0x64')],'custom':_0x1b2f1d[_0x8e19('0x65')],'options':_0x1b2f1d[_0x8e19('0x66')][_0x8e19('0x32')]>0x0?_[_0x8e19('0x2b')](_0x1b2f1d[_0x8e19('0x66')],function(_0x11a487){return{'name':_0x11a487[_0x8e19('0x64')],'value':_0x11a487['value']};}):_0x1b2f1d[_0x8e19('0x29')]=='boolean'?[{'name':'True','value':_0x8e19('0x67')},{'name':'False','value':'false'}]:[]};})};}})[_0x8e19('0x21')](respondWithResult(_0x588819,null))['catch'](function(_0x37cacd){var _0x134f49=_0x3fe1ca['query'][_0x8e19('0x68')]?0x1f4:_0x37cacd['statusCode']||0x1f4;logger['error'](_0x8e19('0x69'),'getFields',_0x134f49,JSON[_0x8e19('0x6a')](_0x37cacd));delete _0x37cacd[_0x8e19('0x25')];if(_0x134f49===0x191){_0x134f49=0x190;}_0x588819[_0x8e19('0x16')](_0x134f49)[_0x8e19('0x26')](_0x3fe1ca[_0x8e19('0x2c')][_0x8e19('0x68')]?{'message':_0x8e19('0x6b'),'statusCode':_0x37cacd[_0x8e19('0x6c')]}:_0x37cacd);});}; \ No newline at end of file +var _0x04b2=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','SalesforceAccount','includeAll','include','rows','catch','show','params','keys','options','create','body','find','getConfigurations','findOne','order','pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','Subjects','SalesforceField','getFields','clientId','clientSecret','username','password','remoteUri','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','Subject','string','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','lodash','crypto','jsforce','desk.js'];(function(_0x784831,_0x54cc17){var _0x3a34f2=function(_0x5e4656){while(--_0x5e4656){_0x784831['push'](_0x784831['shift']());}};_0x3a34f2(++_0x54cc17);}(_0x04b2,0xe9));var _0x204b=function(_0xc2ccad,_0x5506ca){_0xc2ccad=_0xc2ccad-0x0;var _0x14346b=_0x04b2[_0xc2ccad];return _0x14346b;};'use strict';var emlformat=require(_0x204b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x204b('0x1'));var jsonpatch=require(_0x204b('0x2'));var rp=require(_0x204b('0x3'));var moment=require('moment');var BPromise=require(_0x204b('0x4'));var Mustache=require('mustache');var util=require(_0x204b('0x5'));var path=require(_0x204b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x204b('0x7'));var squel=require('squel');var crypto=require(_0x204b('0x8'));var jsforce=require(_0x204b('0x9'));var deskjs=require(_0x204b('0xa'));var toCsv=require(_0x204b('0xb'));var querystring=require(_0x204b('0xc'));var Papa=require(_0x204b('0xd'));var Redis=require(_0x204b('0xe'));var authService=require(_0x204b('0xf'));var qs=require(_0x204b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x204b('0x11'));var utils=require('../../config/utils');var config=require(_0x204b('0x12'));var licenseUtil=require(_0x204b('0x13'));var db=require(_0x204b('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1b3a17,_0x1897e2){_0x1897e2=_0x1897e2||0xcc;return function(_0x17c8c6){if(_0x17c8c6){return _0x1b3a17[_0x204b('0x15')](_0x1897e2);}return _0x1b3a17[_0x204b('0x16')](_0x1897e2)['end']();};}function respondWithResult(_0xc1b2c7,_0x4af63d){_0x4af63d=_0x4af63d||0xc8;return function(_0x14fc6f){if(_0x14fc6f){return _0xc1b2c7[_0x204b('0x16')](_0x4af63d)[_0x204b('0x17')](_0x14fc6f);}};}function respondWithFilteredResult(_0x3c441a,_0xaf9a1b){return function(_0xb3ddd7){if(_0xb3ddd7){var _0x2ddeb0=typeof _0xaf9a1b[_0x204b('0x18')]==='undefined'&&typeof _0xaf9a1b[_0x204b('0x19')]===_0x204b('0x1a');var _0x424a9f=_0xb3ddd7[_0x204b('0x1b')];var _0x38d4b4=_0x2ddeb0?0x0:_0xaf9a1b[_0x204b('0x18')];var _0x52d0c9=_0x2ddeb0?_0xb3ddd7['count']:_0xaf9a1b[_0x204b('0x18')]+_0xaf9a1b[_0x204b('0x19')];var _0x30b43a;if(_0x52d0c9>=_0x424a9f){_0x52d0c9=_0x424a9f;_0x30b43a=0xc8;}else{_0x30b43a=0xce;}_0x3c441a[_0x204b('0x16')](_0x30b43a);return _0x3c441a['set'](_0x204b('0x1c'),_0x38d4b4+'-'+_0x52d0c9+'/'+_0x424a9f)['json'](_0xb3ddd7);}return null;};}function patchUpdates(_0x5b9357){return function(_0xccee7d){try{jsonpatch[_0x204b('0x1d')](_0xccee7d,_0x5b9357,!![]);}catch(_0x5c584c){return BPromise[_0x204b('0x1e')](_0x5c584c);}return _0xccee7d[_0x204b('0x1f')]();};}function saveUpdates(_0x150587,_0x3212dd){return function(_0x462fe5){if(_0x462fe5){return _0x462fe5[_0x204b('0x20')](_0x150587)[_0x204b('0x21')](function(_0x3d351e){return _0x3d351e;});}return null;};}function removeEntity(_0x17ae77,_0xf40973){return function(_0x5aa1c5){if(_0x5aa1c5){return _0x5aa1c5[_0x204b('0x22')]()[_0x204b('0x21')](function(){_0x17ae77['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f53eb,_0x3a8507){return function(_0x3fda5a){if(!_0x3fda5a){_0x4f53eb['sendStatus'](0x194);}return _0x3fda5a;};}function handleError(_0xbd864e,_0x33a53f){_0x33a53f=_0x33a53f||0x1f4;return function(_0x3b5afd){logger[_0x204b('0x23')](_0x3b5afd[_0x204b('0x24')]);if(_0x3b5afd[_0x204b('0x25')]){delete _0x3b5afd['name'];}_0xbd864e[_0x204b('0x16')](_0x33a53f)['send'](_0x3b5afd);};}exports['index']=function(_0x10ddbb,_0x42664d){var _0x4de293={},_0x53f445={},_0xc5fb20={'count':0x0,'rows':[]};var _0x5138ee=_['map'](db['SalesforceAccount'][_0x204b('0x26')],function(_0x297943){return{'name':_0x297943[_0x204b('0x27')],'type':_0x297943['type'][_0x204b('0x28')]};});_0x53f445[_0x204b('0x29')]=_[_0x204b('0x2a')](_0x5138ee,_0x204b('0x25'));_0x53f445[_0x204b('0x2b')]=_['keys'](_0x10ddbb[_0x204b('0x2b')]);_0x53f445['filters']=_[_0x204b('0x2c')](_0x53f445[_0x204b('0x29')],_0x53f445[_0x204b('0x2b')]);_0x4de293[_0x204b('0x2d')]=_[_0x204b('0x2c')](_0x53f445[_0x204b('0x29')],qs[_0x204b('0x2e')](_0x10ddbb[_0x204b('0x2b')][_0x204b('0x2e')]));_0x4de293[_0x204b('0x2d')]=_0x4de293[_0x204b('0x2d')][_0x204b('0x2f')]?_0x4de293[_0x204b('0x2d')]:_0x53f445[_0x204b('0x29')];if(!_0x10ddbb[_0x204b('0x2b')][_0x204b('0x30')](_0x204b('0x31'))){_0x4de293['limit']=qs[_0x204b('0x19')](_0x10ddbb['query'][_0x204b('0x19')]);_0x4de293[_0x204b('0x18')]=qs[_0x204b('0x18')](_0x10ddbb[_0x204b('0x2b')][_0x204b('0x18')]);}_0x4de293['order']=qs[_0x204b('0x32')](_0x10ddbb[_0x204b('0x2b')][_0x204b('0x32')]);_0x4de293[_0x204b('0x33')]=qs['filters'](_['pick'](_0x10ddbb[_0x204b('0x2b')],_0x53f445[_0x204b('0x34')]),_0x5138ee);if(_0x10ddbb[_0x204b('0x2b')][_0x204b('0x35')]){_0x4de293[_0x204b('0x33')]=_[_0x204b('0x36')](_0x4de293[_0x204b('0x33')],{'$or':_['map'](_0x5138ee,function(_0x53791e){if(_0x53791e[_0x204b('0x37')]!==_0x204b('0x38')){var _0x42190b={};_0x42190b[_0x53791e[_0x204b('0x25')]]={'$like':'%'+_0x10ddbb['query']['filter']+'%'};return _0x42190b;}})});}_0x4de293=_[_0x204b('0x36')]({},_0x4de293,_0x10ddbb['options']);var _0x213133={'where':_0x4de293[_0x204b('0x33')]};return db[_0x204b('0x39')][_0x204b('0x1b')](_0x213133)[_0x204b('0x21')](function(_0x92864e){_0xc5fb20[_0x204b('0x1b')]=_0x92864e;if(_0x10ddbb[_0x204b('0x2b')][_0x204b('0x3a')]){_0x4de293[_0x204b('0x3b')]=[{'all':!![]}];}return db[_0x204b('0x39')]['findAll'](_0x4de293);})[_0x204b('0x21')](function(_0xfdb452){_0xc5fb20[_0x204b('0x3c')]=_0xfdb452;return _0xc5fb20;})['then'](respondWithFilteredResult(_0x42664d,_0x4de293))[_0x204b('0x3d')](handleError(_0x42664d,null));};exports[_0x204b('0x3e')]=function(_0x1d8e25,_0x36322c){var _0x28f5e3={'raw':![],'where':{'id':_0x1d8e25[_0x204b('0x3f')]['id']}},_0x3be301={};_0x3be301[_0x204b('0x29')]=_[_0x204b('0x40')](db[_0x204b('0x39')][_0x204b('0x26')]);_0x3be301[_0x204b('0x2b')]=_[_0x204b('0x40')](_0x1d8e25['query']);_0x3be301[_0x204b('0x34')]=_['intersection'](_0x3be301['model'],_0x3be301[_0x204b('0x2b')]);_0x28f5e3[_0x204b('0x2d')]=_[_0x204b('0x2c')](_0x3be301[_0x204b('0x29')],qs[_0x204b('0x2e')](_0x1d8e25['query'][_0x204b('0x2e')]));_0x28f5e3[_0x204b('0x2d')]=_0x28f5e3['attributes']['length']?_0x28f5e3[_0x204b('0x2d')]:_0x3be301[_0x204b('0x29')];if(_0x1d8e25[_0x204b('0x2b')][_0x204b('0x3a')]){_0x28f5e3['include']=[{'all':!![]}];}_0x28f5e3=_[_0x204b('0x36')]({},_0x28f5e3,_0x1d8e25[_0x204b('0x41')]);return db[_0x204b('0x39')]['find'](_0x28f5e3)[_0x204b('0x21')](handleEntityNotFound(_0x36322c,null))['then'](respondWithResult(_0x36322c,null))[_0x204b('0x3d')](handleError(_0x36322c,null));};exports['create']=function(_0x41e4dc,_0xf6f2cf){return db[_0x204b('0x39')][_0x204b('0x42')](_0x41e4dc[_0x204b('0x43')],{})[_0x204b('0x21')](respondWithResult(_0xf6f2cf,0xc9))[_0x204b('0x3d')](handleError(_0xf6f2cf,null));};exports[_0x204b('0x20')]=function(_0x2440ea,_0x38b3b7){if(_0x2440ea[_0x204b('0x43')]['id']){delete _0x2440ea[_0x204b('0x43')]['id'];}return db[_0x204b('0x39')][_0x204b('0x44')]({'where':{'id':_0x2440ea[_0x204b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x38b3b7,null))[_0x204b('0x21')](saveUpdates(_0x2440ea[_0x204b('0x43')],null))[_0x204b('0x21')](respondWithResult(_0x38b3b7,null))[_0x204b('0x3d')](handleError(_0x38b3b7,null));};exports[_0x204b('0x22')]=function(_0x1f0176,_0x249995){return db[_0x204b('0x39')][_0x204b('0x44')]({'where':{'id':_0x1f0176['params']['id']}})[_0x204b('0x21')](handleEntityNotFound(_0x249995,null))[_0x204b('0x21')](removeEntity(_0x249995,null))[_0x204b('0x3d')](handleError(_0x249995,null));};exports[_0x204b('0x45')]=function(_0x2c880f,_0x53234c,_0x486d70){var _0x535f6f={};var _0x167eb4={};var _0x59d63c;var _0x4ab94d;return db[_0x204b('0x39')][_0x204b('0x46')]({'where':{'id':_0x2c880f['params']['id']}})[_0x204b('0x21')](handleEntityNotFound(_0x53234c,null))[_0x204b('0x21')](function(_0x1ecf14){if(_0x1ecf14){_0x59d63c=_0x1ecf14;_0x167eb4['model']=_[_0x204b('0x40')](db['SalesforceConfiguration'][_0x204b('0x26')]);_0x167eb4[_0x204b('0x2b')]=_[_0x204b('0x40')](_0x2c880f[_0x204b('0x2b')]);_0x167eb4['filters']=_['intersection'](_0x167eb4[_0x204b('0x29')],_0x167eb4[_0x204b('0x2b')]);_0x535f6f[_0x204b('0x2d')]=_[_0x204b('0x2c')](_0x167eb4[_0x204b('0x29')],qs[_0x204b('0x2e')](_0x2c880f[_0x204b('0x2b')]['fields']));_0x535f6f[_0x204b('0x2d')]=_0x535f6f[_0x204b('0x2d')][_0x204b('0x2f')]?_0x535f6f[_0x204b('0x2d')]:_0x167eb4[_0x204b('0x29')];_0x535f6f[_0x204b('0x47')]=qs[_0x204b('0x32')](_0x2c880f[_0x204b('0x2b')]['sort']);_0x535f6f[_0x204b('0x33')]=qs['filters'](_[_0x204b('0x48')](_0x2c880f[_0x204b('0x2b')],_0x167eb4['filters']));if(_0x2c880f['query'][_0x204b('0x35')]){_0x535f6f['where']=_['merge'](_0x535f6f['where'],{'$or':_[_0x204b('0x2a')](_0x535f6f[_0x204b('0x2d')],function(_0x28e707){var _0x348eab={};_0x348eab[_0x28e707]={'$like':'%'+_0x2c880f['query']['filter']+'%'};return _0x348eab;})});}_0x535f6f=_['merge']({},_0x535f6f,_0x2c880f['options']);return _0x59d63c[_0x204b('0x45')](_0x535f6f);}})[_0x204b('0x21')](function(_0x444b2f){if(_0x444b2f){_0x4ab94d=_0x444b2f[_0x204b('0x2f')];if(!_0x2c880f[_0x204b('0x2b')][_0x204b('0x30')](_0x204b('0x31'))){_0x535f6f[_0x204b('0x19')]=qs[_0x204b('0x19')](_0x2c880f[_0x204b('0x2b')]['limit']);_0x535f6f[_0x204b('0x18')]=qs[_0x204b('0x18')](_0x2c880f[_0x204b('0x2b')]['offset']);}return _0x59d63c[_0x204b('0x45')](_0x535f6f);}})[_0x204b('0x21')](function(_0x54cfce){if(_0x54cfce){return _0x54cfce?{'count':_0x4ab94d,'rows':_0x54cfce}:null;}})['then'](respondWithResult(_0x53234c,null))[_0x204b('0x3d')](handleError(_0x53234c,null));};exports[_0x204b('0x49')]=function(_0x569236,_0x923eab,_0x195506){if(_0x569236[_0x204b('0x43')]['id']){delete _0x569236[_0x204b('0x43')]['id'];}return db[_0x204b('0x39')][_0x204b('0x46')]({'where':{'id':_0x569236[_0x204b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x923eab,null))['then'](function(_0x165ce6){if(_0x165ce6){_0x569236['body'][_0x204b('0x4a')]=_0x165ce6['id'];_0x569236[_0x204b('0x43')]['Subjects']=integrations[_0x204b('0x4b')](_0x569236[_0x204b('0x43')][_0x204b('0x4c')],_0x569236[_0x204b('0x43')]['type']);_0x569236[_0x204b('0x43')][_0x204b('0x4d')]=integrations[_0x204b('0x4e')](_0x569236[_0x204b('0x43')][_0x204b('0x4c')],_0x569236['body'][_0x204b('0x37')]);return db[_0x204b('0x4f')][_0x204b('0x42')](_0x569236[_0x204b('0x43')],{'include':[{'model':db['SalesforceField'],'as':_0x204b('0x50')},{'model':db[_0x204b('0x51')],'as':'Descriptions'}]});}return null;})[_0x204b('0x21')](respondWithResult(_0x923eab,null))[_0x204b('0x3d')](handleError(_0x923eab,null));};exports[_0x204b('0x52')]=function(_0x8559b4,_0x423431,_0x2faa1e){var _0x26df3e;var _0x3a8166='';var _0xdcb134='Task';return db[_0x204b('0x39')][_0x204b('0x46')]({'where':{'id':_0x8559b4[_0x204b('0x3f')]['id']},'attributes':['id','remoteUri',_0x204b('0x53'),_0x204b('0x54'),_0x204b('0x55'),_0x204b('0x56'),'securityToken']})[_0x204b('0x21')](handleEntityNotFound(_0x423431,null))[_0x204b('0x21')](function(_0x295693){if(_0x295693){_0x3a8166=_0x295693[_0x204b('0x57')];var _0x497590=_0x3a8166[_0x204b('0x58')](-0x1);if(_0x497590==='/'){_0x3a8166=_0x3a8166[_0x204b('0x59')](0x0,_0x3a8166[_0x204b('0x5a')](_0x497590));}_0x26df3e=new jsforce[(_0x204b('0x5b'))]({'oauth2':{'loginUrl':_0x3a8166,'clientId':_0x295693['clientId'],'clientSecret':_0x295693[_0x204b('0x54')]}});return _0x26df3e[_0x204b('0x5c')](_0x295693[_0x204b('0x55')],_0x295693['password'][_0x204b('0x5d')](_0x295693['securityToken']));}})[_0x204b('0x21')](function(_0x5a31a9){if(_0x5a31a9){if(!_[_0x204b('0x5e')](_0x8559b4[_0x204b('0x2b')][_0x204b('0x5f')])){_0xdcb134=_0x8559b4[_0x204b('0x2b')]['ticketType'];}return _0x26df3e[_0x204b('0x60')](_0xdcb134)[_0x204b('0x61')]();}})[_0x204b('0x21')](function(_0x44ae32){var _0x173634=['OwnerId',_0x204b('0x62'),_0x204b('0x63'),'IsRecurrence',_0x204b('0x64'),'Description'];var _0x1e6b07=[_0x204b('0x65'),'int',_0x204b('0x66'),_0x204b('0x67'),_0x204b('0x68'),_0x204b('0x69'),_0x204b('0x6a')];if(_0x44ae32){_['remove'](_0x44ae32['fields'],function(_0x4534d9){return _0x173634[_0x204b('0x6b')](_0x4534d9[_0x204b('0x25')])||!_0x1e6b07[_0x204b('0x6b')](_0x4534d9[_0x204b('0x37')]);});return{'count':_0x44ae32[_0x204b('0x2e')]['length'],'rows':_['map'](_0x44ae32['fields'],function(_0x504b24){return{'id':_0x504b24[_0x204b('0x25')],'name':_0x504b24['label'],'custom':_0x504b24[_0x204b('0x6c')],'options':_0x504b24[_0x204b('0x6d')][_0x204b('0x2f')]>0x0?_['map'](_0x504b24[_0x204b('0x6d')],function(_0x147490){return{'name':_0x147490[_0x204b('0x6e')],'value':_0x147490[_0x204b('0x6f')]};}):_0x504b24[_0x204b('0x37')]==_0x204b('0x67')?[{'name':_0x204b('0x70'),'value':_0x204b('0x71')},{'name':_0x204b('0x72'),'value':_0x204b('0x73')}]:[]};})};}})['then'](respondWithResult(_0x423431,null))[_0x204b('0x3d')](function(_0x219938){var _0x4bbabc=_0x8559b4['query'][_0x204b('0x74')]?0x1f4:_0x219938['statusCode']||0x1f4;logger[_0x204b('0x23')](_0x204b('0x75'),_0x204b('0x52'),_0x4bbabc,JSON[_0x204b('0x76')](_0x219938));delete _0x219938[_0x204b('0x25')];if(_0x4bbabc===0x191){_0x4bbabc=0x190;}_0x423431[_0x204b('0x16')](_0x4bbabc)[_0x204b('0x77')](_0x8559b4[_0x204b('0x2b')][_0x204b('0x74')]?{'message':_0x204b('0x78'),'statusCode':_0x219938[_0x204b('0x79')]}:_0x219938);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c8bf5f5..2414a5a 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.model.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x634f=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x4a51e5,_0x9a2979){var _0x505d2f=function(_0x3b0daf){while(--_0x3b0daf){_0x4a51e5['push'](_0x4a51e5['shift']());}};_0x505d2f(++_0x9a2979);}(_0x634f,0xa2));var _0xf634=function(_0xcf38aa,_0x3c8af7){_0xcf38aa=_0xcf38aa-0x0;var _0x33ee4a=_0x634f[_0xcf38aa];return _0x33ee4a;};'use strict';var _=require('lodash');var util=require(_0xf634('0x0'));var logger=require(_0xf634('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf634('0x2'));var rp=require(_0xf634('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf634('0x4'));var config=require(_0xf634('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xf634('0x6'));module['exports']=function(_0x4cb85c,_0x55c5f8){return _0x4cb85c[_0xf634('0x7')](_0xf634('0x8'),attributes,{'tableName':_0xf634('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf149=['./intSalesforceAccount.attributes','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xf149,0xe1));var _0x9f14=function(_0x8343ba,_0x217a01){_0x8343ba=_0x8343ba-0x0;var _0x3b10ff=_0xf149[_0x8343ba];return _0x3b10ff;};'use strict';var _=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var logger=require(_0x9f14('0x2'))('api');var moment=require(_0x9f14('0x3'));var BPromise=require(_0x9f14('0x4'));var rp=require(_0x9f14('0x5'));var fs=require('fs');var path=require(_0x9f14('0x6'));var rimraf=require(_0x9f14('0x7'));var config=require(_0x9f14('0x8'));var attributes=require(_0x9f14('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x147133,_0x33bf35){return _0x147133[_0x9f14('0xa')](_0x9f14('0xb'),attributes,{'tableName':_0x9f14('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index b24da45..c0212f9 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe65b=['jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4df189,_0x4e3c0d){var _0x36b9d0=function(_0x113aed){while(--_0x113aed){_0x4df189['push'](_0x4df189['shift']());}};_0x36b9d0(++_0x4e3c0d);}(_0xe65b,0xf9));var _0xbe65=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe65b[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xbe65('0x0'));var util=require(_0xbe65('0x1'));var moment=require(_0xbe65('0x2'));var BPromise=require(_0xbe65('0x3'));var rs=require(_0xbe65('0x4'));var fs=require('fs');var Redis=require(_0xbe65('0x5'));var db=require(_0xbe65('0x6'))['db'];var utils=require(_0xbe65('0x7'));var logger=require(_0xbe65('0x8'))(_0xbe65('0x9'));var config=require('../../config/environment');var jayson=require(_0xbe65('0xa'));var client=jayson[_0xbe65('0xb')][_0xbe65('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b2343,_0x2959e4,_0x4f62e7){return new BPromise(function(_0x2a1f1a,_0x9d4133){return client['request'](_0x5b2343,_0x4f62e7)[_0xbe65('0xd')](function(_0x39ea56){logger['info'](_0xbe65('0xe'),_0x2959e4,_0xbe65('0xf'));logger[_0xbe65('0x10')](_0xbe65('0x11'),_0x2959e4,_0xbe65('0xf'),JSON[_0xbe65('0x12')](_0x39ea56));if(_0x39ea56[_0xbe65('0x13')]){if(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x14')]===0x1f4){logger['error'](_0xbe65('0xe'),_0x2959e4,_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);return _0x9d4133(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);}logger[_0xbe65('0x13')](_0xbe65('0xe'),_0x2959e4,_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);return _0x2a1f1a(_0x39ea56[_0xbe65('0x13')][_0xbe65('0x15')]);}else{logger[_0xbe65('0x16')]('SalesforceAccount,\x20%s,\x20%s',_0x2959e4,'request\x20sent');_0x2a1f1a(_0x39ea56[_0xbe65('0x17')][_0xbe65('0x15')]);}})[_0xbe65('0x18')](function(_0x57349c){logger[_0xbe65('0x13')](_0xbe65('0xe'),_0x2959e4,_0x57349c);_0x9d4133(_0x57349c);});});}exports[_0xbe65('0x19')]=function(_0xf91b21){var _0x32b5fc=this;return new Promise(function(_0x2bb0ee,_0x596404){return db[_0xbe65('0x1a')][_0xbe65('0x1b')]({'raw':_0xf91b21['options']?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x1d')]===undefined?!![]:![]:!![],'where':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21['options'][_0xbe65('0x1e')]||null:null,'attributes':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x1f')]||null:null,'limit':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21['options'][_0xbe65('0x20')]||null:null,'include':_0xf91b21[_0xbe65('0x1c')]?_0xf91b21[_0xbe65('0x1c')][_0xbe65('0x21')]?_[_0xbe65('0x22')](_0xf91b21[_0xbe65('0x1c')]['include'],function(_0x34c4ff){return{'model':db[_0x34c4ff[_0xbe65('0x23')]],'as':_0x34c4ff['as'],'attributes':_0x34c4ff[_0xbe65('0x1f')],'include':_0x34c4ff[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x34c4ff[_0xbe65('0x21')],function(_0x4a0773){return{'model':db[_0x4a0773[_0xbe65('0x23')]],'as':_0x4a0773['as'],'attributes':_0x4a0773[_0xbe65('0x1f')],'include':_0x4a0773['include']?_['map'](_0x4a0773[_0xbe65('0x21')],function(_0x12f233){return{'model':db[_0x12f233[_0xbe65('0x23')]],'as':_0x12f233['as'],'attributes':_0x12f233[_0xbe65('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f843b){logger[_0xbe65('0x16')](_0xbe65('0x19'),_0xf91b21);logger[_0xbe65('0x10')]('GetSalesforceAccount',_0xf91b21,JSON[_0xbe65('0x12')](_0x1f843b));_0x2bb0ee(_0x1f843b);})[_0xbe65('0x18')](function(_0xb0cebf){logger[_0xbe65('0x13')](_0xbe65('0x19'),_0xb0cebf[_0xbe65('0x15')],_0xf91b21);_0x596404(_0x32b5fc[_0xbe65('0x13')](0x1f4,_0xb0cebf[_0xbe65('0x15')]));});});};exports[_0xbe65('0x24')]=function(_0x5926d7){var _0x540a35=this;return new Promise(function(_0x5db38b,_0x10faf5){return db[_0xbe65('0x1a')]['find']({'raw':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x1d')]===undefined?!![]:![]:!![],'where':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7['options'][_0xbe65('0x1e')]||null:null,'attributes':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x1f')]||null:null,'include':_0x5926d7[_0xbe65('0x1c')]?_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x21')]?_['map'](_0x5926d7[_0xbe65('0x1c')][_0xbe65('0x21')],function(_0x270637){return{'model':db[_0x270637[_0xbe65('0x23')]],'as':_0x270637['as'],'attributes':_0x270637[_0xbe65('0x1f')],'include':_0x270637[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x270637['include'],function(_0x19bf28){return{'model':db[_0x19bf28[_0xbe65('0x23')]],'as':_0x19bf28['as'],'attributes':_0x19bf28[_0xbe65('0x1f')],'include':_0x19bf28[_0xbe65('0x21')]?_[_0xbe65('0x22')](_0x19bf28[_0xbe65('0x21')],function(_0x11363e){return{'model':db[_0x11363e['model']],'as':_0x11363e['as'],'attributes':_0x11363e[_0xbe65('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbe65('0xd')](function(_0x4940e1){logger[_0xbe65('0x16')](_0xbe65('0x24'),_0x5926d7);logger[_0xbe65('0x10')](_0xbe65('0x24'),_0x5926d7,JSON[_0xbe65('0x12')](_0x4940e1));_0x5db38b(_0x4940e1);})[_0xbe65('0x18')](function(_0x3be595){logger['error'](_0xbe65('0x24'),_0x3be595[_0xbe65('0x15')],_0x5926d7);_0x10faf5(_0x540a35[_0xbe65('0x13')](0x1f4,_0x3be595[_0xbe65('0x15')]));});});}; \ No newline at end of file +var _0x8b6c=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','then','debug','ShowSalesforceAccount','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','request','info'];(function(_0x49f42e,_0x4a370d){var _0xbb9128=function(_0x1375a4){while(--_0x1375a4){_0x49f42e['push'](_0x49f42e['shift']());}};_0xbb9128(++_0x4a370d);}(_0x8b6c,0x1b7));var _0xc8b6=function(_0x4c5698,_0x564ba6){_0x4c5698=_0x4c5698-0x0;var _0x175b13=_0x8b6c[_0x4c5698];return _0x175b13;};'use strict';var _=require(_0xc8b6('0x0'));var util=require(_0xc8b6('0x1'));var moment=require('moment');var BPromise=require(_0xc8b6('0x2'));var rs=require(_0xc8b6('0x3'));var fs=require('fs');var Redis=require(_0xc8b6('0x4'));var db=require(_0xc8b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc8b6('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0823,_0x3b455e,_0x4449b1){return new BPromise(function(_0x5a6dbc,_0x5015ff){return client[_0xc8b6('0x7')](_0x3a0823,_0x4449b1)['then'](function(_0x5d216a){logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x3b455e,_0xc8b6('0xa'));logger['debug'](_0xc8b6('0xb'),_0x3b455e,_0xc8b6('0xa'),JSON[_0xc8b6('0xc')](_0x5d216a));if(_0x5d216a[_0xc8b6('0xd')]){if(_0x5d216a[_0xc8b6('0xd')][_0xc8b6('0xe')]===0x1f4){logger[_0xc8b6('0xd')](_0xc8b6('0x9'),_0x3b455e,_0x5d216a[_0xc8b6('0xd')][_0xc8b6('0xf')]);return _0x5015ff(_0x5d216a[_0xc8b6('0xd')][_0xc8b6('0xf')]);}logger[_0xc8b6('0xd')](_0xc8b6('0x9'),_0x3b455e,_0x5d216a[_0xc8b6('0xd')][_0xc8b6('0xf')]);return _0x5a6dbc(_0x5d216a[_0xc8b6('0xd')][_0xc8b6('0xf')]);}else{logger[_0xc8b6('0x8')](_0xc8b6('0x9'),_0x3b455e,'request\x20sent');_0x5a6dbc(_0x5d216a[_0xc8b6('0x10')]['message']);}})[_0xc8b6('0x11')](function(_0xaf3c7b){logger[_0xc8b6('0xd')](_0xc8b6('0x9'),_0x3b455e,_0xaf3c7b);_0x5015ff(_0xaf3c7b);});});}exports[_0xc8b6('0x12')]=function(_0x423b52){var _0x35175b=this;return new Promise(function(_0x21d23b,_0x2c05d3){return db[_0xc8b6('0x13')][_0xc8b6('0x14')]({'raw':_0x423b52[_0xc8b6('0x15')]?_0x423b52[_0xc8b6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x423b52[_0xc8b6('0x15')]?_0x423b52[_0xc8b6('0x15')][_0xc8b6('0x16')]||null:null,'attributes':_0x423b52['options']?_0x423b52[_0xc8b6('0x15')][_0xc8b6('0x17')]||null:null,'limit':_0x423b52['options']?_0x423b52[_0xc8b6('0x15')][_0xc8b6('0x18')]||null:null,'include':_0x423b52['options']?_0x423b52['options'][_0xc8b6('0x19')]?_['map'](_0x423b52['options']['include'],function(_0x1af42c){return{'model':db[_0x1af42c['model']],'as':_0x1af42c['as'],'attributes':_0x1af42c[_0xc8b6('0x17')],'include':_0x1af42c[_0xc8b6('0x19')]?_[_0xc8b6('0x1a')](_0x1af42c['include'],function(_0x1daa11){return{'model':db[_0x1daa11[_0xc8b6('0x1b')]],'as':_0x1daa11['as'],'attributes':_0x1daa11[_0xc8b6('0x17')],'include':_0x1daa11[_0xc8b6('0x19')]?_[_0xc8b6('0x1a')](_0x1daa11['include'],function(_0x20ef2f){return{'model':db[_0x20ef2f[_0xc8b6('0x1b')]],'as':_0x20ef2f['as'],'attributes':_0x20ef2f[_0xc8b6('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc8b6('0x1c')](function(_0x3d1d2c){logger['info']('GetSalesforceAccount',_0x423b52);logger[_0xc8b6('0x1d')]('GetSalesforceAccount',_0x423b52,JSON[_0xc8b6('0xc')](_0x3d1d2c));_0x21d23b(_0x3d1d2c);})[_0xc8b6('0x11')](function(_0x55ab56){logger[_0xc8b6('0xd')]('GetSalesforceAccount',_0x55ab56[_0xc8b6('0xf')],_0x423b52);_0x2c05d3(_0x35175b[_0xc8b6('0xd')](0x1f4,_0x55ab56[_0xc8b6('0xf')]));});});};exports[_0xc8b6('0x1e')]=function(_0x2d7f53){var _0x213882=this;return new Promise(function(_0x4eda49,_0x51cb6a){return db[_0xc8b6('0x13')]['find']({'raw':_0x2d7f53[_0xc8b6('0x15')]?_0x2d7f53[_0xc8b6('0x15')][_0xc8b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d7f53['options']?_0x2d7f53['options'][_0xc8b6('0x16')]||null:null,'attributes':_0x2d7f53[_0xc8b6('0x15')]?_0x2d7f53[_0xc8b6('0x15')][_0xc8b6('0x17')]||null:null,'include':_0x2d7f53[_0xc8b6('0x15')]?_0x2d7f53['options'][_0xc8b6('0x19')]?_[_0xc8b6('0x1a')](_0x2d7f53[_0xc8b6('0x15')][_0xc8b6('0x19')],function(_0x32e61a){return{'model':db[_0x32e61a[_0xc8b6('0x1b')]],'as':_0x32e61a['as'],'attributes':_0x32e61a[_0xc8b6('0x17')],'include':_0x32e61a[_0xc8b6('0x19')]?_[_0xc8b6('0x1a')](_0x32e61a['include'],function(_0x70b6b4){return{'model':db[_0x70b6b4[_0xc8b6('0x1b')]],'as':_0x70b6b4['as'],'attributes':_0x70b6b4['attributes'],'include':_0x70b6b4[_0xc8b6('0x19')]?_['map'](_0x70b6b4[_0xc8b6('0x19')],function(_0x514f5c){return{'model':db[_0x514f5c[_0xc8b6('0x1b')]],'as':_0x514f5c['as'],'attributes':_0x514f5c[_0xc8b6('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc8b6('0x1c')](function(_0x4ae940){logger['info']('ShowSalesforceAccount',_0x2d7f53);logger[_0xc8b6('0x1d')](_0xc8b6('0x1e'),_0x2d7f53,JSON[_0xc8b6('0xc')](_0x4ae940));_0x4eda49(_0x4ae940);})[_0xc8b6('0x11')](function(_0x103076){logger[_0xc8b6('0xd')](_0xc8b6('0x1e'),_0x103076['message'],_0x2d7f53);_0x51cb6a(_0x213882[_0xc8b6('0xd')](0x1f4,_0x103076[_0xc8b6('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 398aad0..745c6d0 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x0b0e[_0x4b73a2];return _0x383c66;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +var _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x3b1ba0,_0x2cbb54){_0x3b1ba0=_0x3b1ba0-0x0;var _0x411524=_0x2032[_0x3b1ba0];return _0x411524;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0088e67..58640b4 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a85=['Case','contact_lead','lead','account_contact_lead','contact','account','sequelize','STRING','ENUM','Task'];(function(_0x599ef7,_0x244949){var _0x9ed478=function(_0x1f5008){while(--_0x1f5008){_0x599ef7['push'](_0x599ef7['shift']());}};_0x9ed478(++_0x244949);}(_0x7a85,0x16e));var _0x57a8=function(_0x5ca82c,_0x3b304b){_0x5ca82c=_0x5ca82c-0x0;var _0x46089b=_0x7a85[_0x5ca82c];return _0x46089b;};'use strict';var Sequelize=require(_0x57a8('0x0'));module['exports']={'name':{'type':Sequelize[_0x57a8('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x57a8('0x2')](_0x57a8('0x3'),_0x57a8('0x4')),'defaultValue':_0x57a8('0x3')},'moduleSearch':{'type':Sequelize[_0x57a8('0x2')](_0x57a8('0x5'),'contact',_0x57a8('0x6'),_0x57a8('0x7'),'account'),'defaultValue':_0x57a8('0x5')},'moduleCreate':{'type':Sequelize[_0x57a8('0x2')]('nothing',_0x57a8('0x8'),'lead',_0x57a8('0x9')),'defaultValue':_0x57a8('0x6')},'leadId':{'type':Sequelize[_0x57a8('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x57a8('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x57a8('0x1')]}}; \ No newline at end of file +var _0xac49=['Task','contact_lead','contact','lead','account','nothing','exports','STRING','ENUM'];(function(_0x1a93e7,_0x1bea39){var _0x276e09=function(_0x4f01ee){while(--_0x4f01ee){_0x1a93e7['push'](_0x1a93e7['shift']());}};_0x276e09(++_0x1bea39);}(_0xac49,0x126));var _0x9ac4=function(_0x1d8fb1,_0xe90355){_0x1d8fb1=_0x1d8fb1-0x0;var _0x53f9a7=_0xac49[_0x1d8fb1];return _0x53f9a7;};'use strict';var Sequelize=require('sequelize');module[_0x9ac4('0x0')]={'name':{'type':Sequelize[_0x9ac4('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x3'),'Case'),'defaultValue':_0x9ac4('0x3')},'moduleSearch':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x4'),_0x9ac4('0x5'),_0x9ac4('0x6'),'account_contact_lead',_0x9ac4('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9ac4('0x2')](_0x9ac4('0x8'),_0x9ac4('0x5'),'lead',_0x9ac4('0x7')),'defaultValue':_0x9ac4('0x6')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x9ac4('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x9ac4('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 47756aa..89e658c 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc254=['params','length','include','options','find','catch','create','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show'];(function(_0x2a3b44,_0x653ff3){var _0x4b45d2=function(_0x50a0f5){while(--_0x50a0f5){_0x2a3b44['push'](_0x2a3b44['shift']());}};_0x4b45d2(++_0x653ff3);}(_0xc254,0x1ed));var _0x4c25=function(_0x5216a5,_0x43fdf8){_0x5216a5=_0x5216a5-0x0;var _0x44d64b=_0xc254[_0x5216a5];return _0x44d64b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c25('0x0'));var jsonpatch=require(_0x4c25('0x1'));var rp=require(_0x4c25('0x2'));var moment=require(_0x4c25('0x3'));var BPromise=require(_0x4c25('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4c25('0x5'));var sox=require(_0x4c25('0x6'));var csv=require(_0x4c25('0x7'));var ejs=require(_0x4c25('0x8'));var fs=require('fs');var fs_extra=require(_0x4c25('0x9'));var _=require(_0x4c25('0xa'));var squel=require(_0x4c25('0xb'));var crypto=require('crypto');var jsforce=require(_0x4c25('0xc'));var deskjs=require(_0x4c25('0xd'));var toCsv=require(_0x4c25('0x7'));var querystring=require(_0x4c25('0xe'));var Papa=require(_0x4c25('0xf'));var Redis=require(_0x4c25('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c25('0x11'));var as=require(_0x4c25('0x12'));var hardwareService=require(_0x4c25('0x13'));var logger=require(_0x4c25('0x14'))(_0x4c25('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4c25('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c564,_0x2201be){_0x2201be=_0x2201be||0xcc;return function(_0x5b921d){if(_0x5b921d){return _0x28c564[_0x4c25('0x17')](_0x2201be);}return _0x28c564['status'](_0x2201be)[_0x4c25('0x18')]();};}function respondWithResult(_0x55fae2,_0x3c178f){_0x3c178f=_0x3c178f||0xc8;return function(_0x1bfdf7){if(_0x1bfdf7){return _0x55fae2[_0x4c25('0x19')](_0x3c178f)[_0x4c25('0x1a')](_0x1bfdf7);}};}function respondWithFilteredResult(_0x101cb3,_0x509b10){return function(_0x29d036){if(_0x29d036){var _0x29f526=typeof _0x509b10[_0x4c25('0x1b')]===_0x4c25('0x1c')&&typeof _0x509b10[_0x4c25('0x1d')]==='undefined';var _0x4ea7e1=_0x29d036[_0x4c25('0x1e')];var _0x9b96ca=_0x29f526?0x0:_0x509b10[_0x4c25('0x1b')];var _0x137143=_0x29f526?_0x29d036[_0x4c25('0x1e')]:_0x509b10[_0x4c25('0x1b')]+_0x509b10['limit'];var _0x58f99d;if(_0x137143>=_0x4ea7e1){_0x137143=_0x4ea7e1;_0x58f99d=0xc8;}else{_0x58f99d=0xce;}_0x101cb3[_0x4c25('0x19')](_0x58f99d);return _0x101cb3[_0x4c25('0x1f')]('Content-Range',_0x9b96ca+'-'+_0x137143+'/'+_0x4ea7e1)[_0x4c25('0x1a')](_0x29d036);}return null;};}function patchUpdates(_0x5fb8a2){return function(_0x24c8f3){try{jsonpatch[_0x4c25('0x20')](_0x24c8f3,_0x5fb8a2,!![]);}catch(_0x27a03b){return BPromise[_0x4c25('0x21')](_0x27a03b);}return _0x24c8f3['save']();};}function saveUpdates(_0x5e0d05,_0x3790d7){return function(_0x48ac93){if(_0x48ac93){return _0x48ac93[_0x4c25('0x22')](_0x5e0d05)[_0x4c25('0x23')](function(_0x535c52){return _0x535c52;});}return null;};}function removeEntity(_0x1fef83,_0x52bc21){return function(_0x52ef30){if(_0x52ef30){return _0x52ef30[_0x4c25('0x24')]()[_0x4c25('0x23')](function(){_0x1fef83[_0x4c25('0x19')](0xcc)[_0x4c25('0x18')]();});}};}function handleEntityNotFound(_0x807bf7,_0x531e80){return function(_0x278bd0){if(!_0x278bd0){_0x807bf7[_0x4c25('0x17')](0x194);}return _0x278bd0;};}function handleError(_0x489a6e,_0xbe8a38){_0xbe8a38=_0xbe8a38||0x1f4;return function(_0x42e8cb){logger[_0x4c25('0x25')](_0x42e8cb[_0x4c25('0x26')]);if(_0x42e8cb['name']){delete _0x42e8cb[_0x4c25('0x27')];}_0x489a6e[_0x4c25('0x19')](_0xbe8a38)['send'](_0x42e8cb);};}exports[_0x4c25('0x28')]=function(_0x8c51a6,_0x2f1f3d){var _0x1ca83b={},_0x1448f={},_0x4ce969={'count':0x0,'rows':[]};var _0xa5626a=_[_0x4c25('0x29')](db[_0x4c25('0x2a')][_0x4c25('0x2b')],function(_0x253b9e){return{'name':_0x253b9e[_0x4c25('0x2c')],'type':_0x253b9e[_0x4c25('0x2d')][_0x4c25('0x2e')]};});_0x1448f[_0x4c25('0x2f')]=_['map'](_0xa5626a,_0x4c25('0x27'));_0x1448f[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0x8c51a6[_0x4c25('0x30')]);_0x1448f[_0x4c25('0x32')]=_['intersection'](_0x1448f['model'],_0x1448f[_0x4c25('0x30')]);_0x1ca83b[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x1448f['model'],qs['fields'](_0x8c51a6['query'][_0x4c25('0x35')]));_0x1ca83b['attributes']=_0x1ca83b[_0x4c25('0x33')]['length']?_0x1ca83b[_0x4c25('0x33')]:_0x1448f[_0x4c25('0x2f')];if(!_0x8c51a6['query'][_0x4c25('0x36')](_0x4c25('0x37'))){_0x1ca83b['limit']=qs['limit'](_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x1ca83b[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0x8c51a6['query']['offset']);}_0x1ca83b[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0x8c51a6['query'][_0x4c25('0x39')]);_0x1ca83b[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0x8c51a6[_0x4c25('0x30')],_0x1448f[_0x4c25('0x32')]),_0xa5626a);if(_0x8c51a6['query'][_0x4c25('0x3c')]){_0x1ca83b[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x1ca83b[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0xa5626a,function(_0x7cf14c){if(_0x7cf14c[_0x4c25('0x2d')]!==_0x4c25('0x3e')){var _0x5ac09a={};_0x5ac09a[_0x7cf14c[_0x4c25('0x27')]]={'$like':'%'+_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x3c')]+'%'};return _0x5ac09a;}})});}_0x1ca83b=_[_0x4c25('0x3d')]({},_0x1ca83b,_0x8c51a6['options']);var _0x917ea1={'where':_0x1ca83b[_0x4c25('0x3a')]};return db[_0x4c25('0x2a')][_0x4c25('0x1e')](_0x917ea1)['then'](function(_0x5f47ba){_0x4ce969[_0x4c25('0x1e')]=_0x5f47ba;if(_0x8c51a6[_0x4c25('0x30')][_0x4c25('0x3f')]){_0x1ca83b['include']=[{'all':!![]}];}return db[_0x4c25('0x2a')][_0x4c25('0x40')](_0x1ca83b);})['then'](function(_0x408bdc){_0x4ce969[_0x4c25('0x41')]=_0x408bdc;return _0x4ce969;})[_0x4c25('0x23')](respondWithFilteredResult(_0x2f1f3d,_0x1ca83b))['catch'](handleError(_0x2f1f3d,null));};exports[_0x4c25('0x42')]=function(_0x59247b,_0x16dd5a){var _0x3aa69f={'raw':![],'where':{'id':_0x59247b[_0x4c25('0x43')]['id']}},_0x3ab6b6={};_0x3ab6b6[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db['SalesforceConfiguration'][_0x4c25('0x2b')]);_0x3ab6b6[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0x59247b[_0x4c25('0x30')]);_0x3ab6b6[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x3ab6b6[_0x4c25('0x2f')],_0x3ab6b6['query']);_0x3aa69f[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x3ab6b6[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0x59247b[_0x4c25('0x30')][_0x4c25('0x35')]));_0x3aa69f['attributes']=_0x3aa69f[_0x4c25('0x33')][_0x4c25('0x44')]?_0x3aa69f[_0x4c25('0x33')]:_0x3ab6b6[_0x4c25('0x2f')];if(_0x59247b[_0x4c25('0x30')][_0x4c25('0x3f')]){_0x3aa69f[_0x4c25('0x45')]=[{'all':!![]}];}_0x3aa69f=_['merge']({},_0x3aa69f,_0x59247b[_0x4c25('0x46')]);return db[_0x4c25('0x2a')][_0x4c25('0x47')](_0x3aa69f)[_0x4c25('0x23')](handleEntityNotFound(_0x16dd5a,null))[_0x4c25('0x23')](respondWithResult(_0x16dd5a,null))[_0x4c25('0x48')](handleError(_0x16dd5a,null));};exports[_0x4c25('0x49')]=function(_0xbc1ff7,_0x5d7146){return db[_0x4c25('0x2a')]['create'](_0xbc1ff7['body'],{})['then'](respondWithResult(_0x5d7146,0xc9))[_0x4c25('0x48')](handleError(_0x5d7146,null));};exports['update']=function(_0x3d987c,_0x5e981d){if(_0x3d987c[_0x4c25('0x4a')]['id']){delete _0x3d987c[_0x4c25('0x4a')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x3d987c[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x5e981d,null))['then'](saveUpdates(_0x3d987c['body'],null))[_0x4c25('0x23')](respondWithResult(_0x5e981d,null))[_0x4c25('0x48')](handleError(_0x5e981d,null));};exports[_0x4c25('0x24')]=function(_0x5be2a9,_0x346eb7){return db[_0x4c25('0x2a')][_0x4c25('0x47')]({'where':{'id':_0x5be2a9[_0x4c25('0x43')]['id']}})['then'](handleEntityNotFound(_0x346eb7,null))['then'](removeEntity(_0x346eb7,null))[_0x4c25('0x48')](handleError(_0x346eb7,null));};exports[_0x4c25('0x4b')]=function(_0xa4f5fd,_0x327e96,_0x5dc40f){var _0x238682={};var _0x3edae0={};var _0x43210f;var _0x19aadc;return db[_0x4c25('0x2a')][_0x4c25('0x4c')]({'where':{'id':_0xa4f5fd[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x327e96,null))[_0x4c25('0x23')](function(_0x489dca){if(_0x489dca){_0x43210f=_0x489dca;_0x3edae0[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db['SalesforceField'][_0x4c25('0x2b')]);_0x3edae0[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0xa4f5fd[_0x4c25('0x30')]);_0x3edae0[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x3edae0[_0x4c25('0x2f')],_0x3edae0['query']);_0x238682['attributes']=_['intersection'](_0x3edae0[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0xa4f5fd['query'][_0x4c25('0x35')]));_0x238682[_0x4c25('0x33')]=_0x238682[_0x4c25('0x33')]['length']?_0x238682[_0x4c25('0x33')]:_0x3edae0['model'];_0x238682[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0xa4f5fd['query']['sort']);_0x238682[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0xa4f5fd[_0x4c25('0x30')],_0x3edae0['filters']));if(_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x3c')]){_0x238682[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x238682[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0x238682[_0x4c25('0x33')],function(_0x1e6b90){var _0x2d8c2a={};_0x2d8c2a[_0x1e6b90]={'$like':'%'+_0xa4f5fd[_0x4c25('0x30')]['filter']+'%'};return _0x2d8c2a;})});}_0x238682=_[_0x4c25('0x3d')]({},_0x238682,_0xa4f5fd['options']);return _0x43210f[_0x4c25('0x4b')](_0x238682);}})['then'](function(_0x1e3d8b){if(_0x1e3d8b){_0x19aadc=_0x1e3d8b[_0x4c25('0x44')];if(!_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x36')](_0x4c25('0x37'))){_0x238682['limit']=qs[_0x4c25('0x1d')](_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x238682['offset']=qs[_0x4c25('0x1b')](_0xa4f5fd[_0x4c25('0x30')][_0x4c25('0x1b')]);}return _0x43210f[_0x4c25('0x4b')](_0x238682);}})[_0x4c25('0x23')](function(_0x226deb){if(_0x226deb){return _0x226deb?{'count':_0x19aadc,'rows':_0x226deb}:null;}})['then'](respondWithResult(_0x327e96,null))[_0x4c25('0x48')](handleError(_0x327e96,null));};exports[_0x4c25('0x4d')]=function(_0x216cfc,_0x3a2169,_0xaae38e){var _0x19b659={};var _0x375fba={};var _0x1bea76;var _0x4693f9;return db['SalesforceConfiguration'][_0x4c25('0x4c')]({'where':{'id':_0x216cfc[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x3a2169,null))[_0x4c25('0x23')](function(_0x5c6498){if(_0x5c6498){_0x1bea76=_0x5c6498;_0x375fba[_0x4c25('0x2f')]=_[_0x4c25('0x31')](db[_0x4c25('0x4e')][_0x4c25('0x2b')]);_0x375fba['query']=_[_0x4c25('0x31')](_0x216cfc[_0x4c25('0x30')]);_0x375fba[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0x375fba['model'],_0x375fba[_0x4c25('0x30')]);_0x19b659[_0x4c25('0x33')]=_[_0x4c25('0x34')](_0x375fba[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0x216cfc['query'][_0x4c25('0x35')]));_0x19b659[_0x4c25('0x33')]=_0x19b659[_0x4c25('0x33')][_0x4c25('0x44')]?_0x19b659[_0x4c25('0x33')]:_0x375fba[_0x4c25('0x2f')];_0x19b659[_0x4c25('0x38')]=qs['sort'](_0x216cfc[_0x4c25('0x30')][_0x4c25('0x39')]);_0x19b659[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0x216cfc['query'],_0x375fba[_0x4c25('0x32')]));if(_0x216cfc[_0x4c25('0x30')]['filter']){_0x19b659[_0x4c25('0x3a')]=_[_0x4c25('0x3d')](_0x19b659[_0x4c25('0x3a')],{'$or':_[_0x4c25('0x29')](_0x19b659['attributes'],function(_0x57e11a){var _0x11fc0a={};_0x11fc0a[_0x57e11a]={'$like':'%'+_0x216cfc[_0x4c25('0x30')][_0x4c25('0x3c')]+'%'};return _0x11fc0a;})});}_0x19b659=_[_0x4c25('0x3d')]({},_0x19b659,_0x216cfc[_0x4c25('0x46')]);return _0x1bea76[_0x4c25('0x4d')](_0x19b659);}})[_0x4c25('0x23')](function(_0x2e91c4){if(_0x2e91c4){_0x4693f9=_0x2e91c4['length'];if(!_0x216cfc[_0x4c25('0x30')][_0x4c25('0x36')](_0x4c25('0x37'))){_0x19b659[_0x4c25('0x1d')]=qs[_0x4c25('0x1d')](_0x216cfc[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x19b659[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0x216cfc[_0x4c25('0x30')]['offset']);}return _0x1bea76['getSubjects'](_0x19b659);}})[_0x4c25('0x23')](function(_0x12c153){if(_0x12c153){return _0x12c153?{'count':_0x4693f9,'rows':_0x12c153}:null;}})['then'](respondWithResult(_0x3a2169,null))[_0x4c25('0x48')](handleError(_0x3a2169,null));};exports[_0x4c25('0x4f')]=function(_0xf3d14d,_0x24aea0,_0x563402){var _0x17837d={};var _0xd6876f={};var _0x374202;var _0x3bdb6d;return db[_0x4c25('0x2a')][_0x4c25('0x4c')]({'where':{'id':_0xf3d14d[_0x4c25('0x43')]['id']}})[_0x4c25('0x23')](handleEntityNotFound(_0x24aea0,null))[_0x4c25('0x23')](function(_0x2b3af4){if(_0x2b3af4){_0x374202=_0x2b3af4;_0xd6876f[_0x4c25('0x2f')]=_['keys'](db[_0x4c25('0x4e')][_0x4c25('0x2b')]);_0xd6876f[_0x4c25('0x30')]=_[_0x4c25('0x31')](_0xf3d14d[_0x4c25('0x30')]);_0xd6876f[_0x4c25('0x32')]=_[_0x4c25('0x34')](_0xd6876f[_0x4c25('0x2f')],_0xd6876f[_0x4c25('0x30')]);_0x17837d['attributes']=_['intersection'](_0xd6876f[_0x4c25('0x2f')],qs[_0x4c25('0x35')](_0xf3d14d['query'][_0x4c25('0x35')]));_0x17837d['attributes']=_0x17837d['attributes'][_0x4c25('0x44')]?_0x17837d[_0x4c25('0x33')]:_0xd6876f[_0x4c25('0x2f')];_0x17837d[_0x4c25('0x38')]=qs[_0x4c25('0x39')](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x39')]);_0x17837d[_0x4c25('0x3a')]=qs[_0x4c25('0x32')](_[_0x4c25('0x3b')](_0xf3d14d[_0x4c25('0x30')],_0xd6876f[_0x4c25('0x32')]));if(_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x3c')]){_0x17837d['where']=_[_0x4c25('0x3d')](_0x17837d['where'],{'$or':_[_0x4c25('0x29')](_0x17837d[_0x4c25('0x33')],function(_0x39c6aa){var _0x47a0d5={};_0x47a0d5[_0x39c6aa]={'$like':'%'+_0xf3d14d['query']['filter']+'%'};return _0x47a0d5;})});}_0x17837d=_['merge']({},_0x17837d,_0xf3d14d[_0x4c25('0x46')]);return _0x374202[_0x4c25('0x4f')](_0x17837d);}})[_0x4c25('0x23')](function(_0x589e12){if(_0x589e12){_0x3bdb6d=_0x589e12['length'];if(!_0xf3d14d[_0x4c25('0x30')]['hasOwnProperty'](_0x4c25('0x37'))){_0x17837d[_0x4c25('0x1d')]=qs['limit'](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x1d')]);_0x17837d[_0x4c25('0x1b')]=qs[_0x4c25('0x1b')](_0xf3d14d[_0x4c25('0x30')][_0x4c25('0x1b')]);}return _0x374202[_0x4c25('0x4f')](_0x17837d);}})[_0x4c25('0x23')](function(_0xfb09d7){if(_0xfb09d7){return _0xfb09d7?{'count':_0x3bdb6d,'rows':_0xfb09d7}:null;}})['then'](respondWithResult(_0x24aea0,null))['catch'](handleError(_0x24aea0,null));}; \ No newline at end of file +var _0xf59f=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','body','getFields','findOne','SalesforceField','filter','getSubjects','pick','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','save','update','then','destroy','name','send','map','SalesforceConfiguration','rawAttributes','key'];(function(_0x450689,_0x3b857c){var _0x46ffb0=function(_0x5d3679){while(--_0x5d3679){_0x450689['push'](_0x450689['shift']());}};_0x46ffb0(++_0x3b857c);}(_0xf59f,0xb4));var _0xff59=function(_0x5f3874,_0x2f64f7){_0x5f3874=_0x5f3874-0x0;var _0x5e7b75=_0xf59f[_0x5f3874];return _0x5e7b75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff59('0x0'));var zipdir=require(_0xff59('0x1'));var jsonpatch=require(_0xff59('0x2'));var rp=require(_0xff59('0x3'));var moment=require('moment');var BPromise=require(_0xff59('0x4'));var Mustache=require(_0xff59('0x5'));var util=require(_0xff59('0x6'));var path=require(_0xff59('0x7'));var sox=require('sox');var csv=require(_0xff59('0x8'));var ejs=require(_0xff59('0x9'));var fs=require('fs');var fs_extra=require(_0xff59('0xa'));var _=require('lodash');var squel=require(_0xff59('0xb'));var crypto=require(_0xff59('0xc'));var jsforce=require(_0xff59('0xd'));var deskjs=require(_0xff59('0xe'));var toCsv=require(_0xff59('0x8'));var querystring=require('querystring');var Papa=require(_0xff59('0xf'));var Redis=require(_0xff59('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff59('0x11'));var hardwareService=require(_0xff59('0x12'));var logger=require('../../config/logger')(_0xff59('0x13'));var utils=require('../../config/utils');var config=require(_0xff59('0x14'));var licenseUtil=require(_0xff59('0x15'));var db=require(_0xff59('0x16'))['db'];function respondWithStatusCode(_0x4800f9,_0x2d1127){_0x2d1127=_0x2d1127||0xcc;return function(_0x4e1d20){if(_0x4e1d20){return _0x4800f9[_0xff59('0x17')](_0x2d1127);}return _0x4800f9['status'](_0x2d1127)[_0xff59('0x18')]();};}function respondWithResult(_0x284b65,_0x3a97e9){_0x3a97e9=_0x3a97e9||0xc8;return function(_0x362a81){if(_0x362a81){return _0x284b65[_0xff59('0x19')](_0x3a97e9)['json'](_0x362a81);}};}function respondWithFilteredResult(_0x543099,_0x330a8b){return function(_0x437a9a){if(_0x437a9a){var _0x3a64c2=typeof _0x330a8b[_0xff59('0x1a')]===_0xff59('0x1b')&&typeof _0x330a8b[_0xff59('0x1c')]===_0xff59('0x1b');var _0x26b5b1=_0x437a9a['count'];var _0x9c836b=_0x3a64c2?0x0:_0x330a8b[_0xff59('0x1a')];var _0x43e0a8=_0x3a64c2?_0x437a9a[_0xff59('0x1d')]:_0x330a8b[_0xff59('0x1a')]+_0x330a8b[_0xff59('0x1c')];var _0x3b9bc2;if(_0x43e0a8>=_0x26b5b1){_0x43e0a8=_0x26b5b1;_0x3b9bc2=0xc8;}else{_0x3b9bc2=0xce;}_0x543099[_0xff59('0x19')](_0x3b9bc2);return _0x543099[_0xff59('0x1e')]('Content-Range',_0x9c836b+'-'+_0x43e0a8+'/'+_0x26b5b1)[_0xff59('0x1f')](_0x437a9a);}return null;};}function patchUpdates(_0x50373c){return function(_0xa1acbc){try{jsonpatch['apply'](_0xa1acbc,_0x50373c,!![]);}catch(_0x341a29){return BPromise['reject'](_0x341a29);}return _0xa1acbc[_0xff59('0x20')]();};}function saveUpdates(_0x580206,_0x454b4b){return function(_0x5192df){if(_0x5192df){return _0x5192df[_0xff59('0x21')](_0x580206)[_0xff59('0x22')](function(_0x3a31a5){return _0x3a31a5;});}return null;};}function removeEntity(_0x4000d6,_0x4d9fef){return function(_0x2bd7e4){if(_0x2bd7e4){return _0x2bd7e4[_0xff59('0x23')]()['then'](function(){_0x4000d6['status'](0xcc)[_0xff59('0x18')]();});}};}function handleEntityNotFound(_0x2ea196,_0xf46f72){return function(_0x4d8be0){if(!_0x4d8be0){_0x2ea196[_0xff59('0x17')](0x194);}return _0x4d8be0;};}function handleError(_0x301e80,_0x1def9c){_0x1def9c=_0x1def9c||0x1f4;return function(_0x2b04eb){logger['error'](_0x2b04eb['stack']);if(_0x2b04eb[_0xff59('0x24')]){delete _0x2b04eb[_0xff59('0x24')];}_0x301e80[_0xff59('0x19')](_0x1def9c)[_0xff59('0x25')](_0x2b04eb);};}exports['index']=function(_0x49ab6a,_0x45911d){var _0x4ceea6={},_0xb5723b={},_0x2228e3={'count':0x0,'rows':[]};var _0x48b0ec=_[_0xff59('0x26')](db[_0xff59('0x27')][_0xff59('0x28')],function(_0x4d4fac){return{'name':_0x4d4fac['fieldName'],'type':_0x4d4fac['type'][_0xff59('0x29')]};});_0xb5723b['model']=_[_0xff59('0x26')](_0x48b0ec,'name');_0xb5723b[_0xff59('0x2a')]=_[_0xff59('0x2b')](_0x49ab6a[_0xff59('0x2a')]);_0xb5723b[_0xff59('0x2c')]=_[_0xff59('0x2d')](_0xb5723b[_0xff59('0x2e')],_0xb5723b['query']);_0x4ceea6[_0xff59('0x2f')]=_['intersection'](_0xb5723b['model'],qs['fields'](_0x49ab6a['query'][_0xff59('0x30')]));_0x4ceea6[_0xff59('0x2f')]=_0x4ceea6[_0xff59('0x2f')][_0xff59('0x31')]?_0x4ceea6[_0xff59('0x2f')]:_0xb5723b[_0xff59('0x2e')];if(!_0x49ab6a[_0xff59('0x2a')][_0xff59('0x32')](_0xff59('0x33'))){_0x4ceea6[_0xff59('0x1c')]=qs[_0xff59('0x1c')](_0x49ab6a[_0xff59('0x2a')][_0xff59('0x1c')]);_0x4ceea6['offset']=qs[_0xff59('0x1a')](_0x49ab6a[_0xff59('0x2a')][_0xff59('0x1a')]);}_0x4ceea6[_0xff59('0x34')]=qs[_0xff59('0x35')](_0x49ab6a[_0xff59('0x2a')][_0xff59('0x35')]);_0x4ceea6[_0xff59('0x36')]=qs[_0xff59('0x2c')](_['pick'](_0x49ab6a[_0xff59('0x2a')],_0xb5723b['filters']),_0x48b0ec);if(_0x49ab6a[_0xff59('0x2a')]['filter']){_0x4ceea6[_0xff59('0x36')]=_[_0xff59('0x37')](_0x4ceea6['where'],{'$or':_[_0xff59('0x26')](_0x48b0ec,function(_0x45627c){if(_0x45627c[_0xff59('0x38')]!==_0xff59('0x39')){var _0x487076={};_0x487076[_0x45627c[_0xff59('0x24')]]={'$like':'%'+_0x49ab6a[_0xff59('0x2a')]['filter']+'%'};return _0x487076;}})});}_0x4ceea6=_['merge']({},_0x4ceea6,_0x49ab6a['options']);var _0x29cada={'where':_0x4ceea6[_0xff59('0x36')]};return db[_0xff59('0x27')][_0xff59('0x1d')](_0x29cada)['then'](function(_0x4d847a){_0x2228e3['count']=_0x4d847a;if(_0x49ab6a[_0xff59('0x2a')][_0xff59('0x3a')]){_0x4ceea6[_0xff59('0x3b')]=[{'all':!![]}];}return db[_0xff59('0x27')][_0xff59('0x3c')](_0x4ceea6);})['then'](function(_0x3b70a0){_0x2228e3[_0xff59('0x3d')]=_0x3b70a0;return _0x2228e3;})[_0xff59('0x22')](respondWithFilteredResult(_0x45911d,_0x4ceea6))[_0xff59('0x3e')](handleError(_0x45911d,null));};exports['show']=function(_0x32d4ef,_0x2fd3aa){var _0xcc7e1={'raw':![],'where':{'id':_0x32d4ef[_0xff59('0x3f')]['id']}},_0x574cb1={};_0x574cb1[_0xff59('0x2e')]=_[_0xff59('0x2b')](db[_0xff59('0x27')][_0xff59('0x28')]);_0x574cb1['query']=_[_0xff59('0x2b')](_0x32d4ef[_0xff59('0x2a')]);_0x574cb1['filters']=_[_0xff59('0x2d')](_0x574cb1[_0xff59('0x2e')],_0x574cb1[_0xff59('0x2a')]);_0xcc7e1[_0xff59('0x2f')]=_[_0xff59('0x2d')](_0x574cb1[_0xff59('0x2e')],qs[_0xff59('0x30')](_0x32d4ef[_0xff59('0x2a')][_0xff59('0x30')]));_0xcc7e1['attributes']=_0xcc7e1[_0xff59('0x2f')][_0xff59('0x31')]?_0xcc7e1[_0xff59('0x2f')]:_0x574cb1['model'];if(_0x32d4ef[_0xff59('0x2a')][_0xff59('0x3a')]){_0xcc7e1[_0xff59('0x3b')]=[{'all':!![]}];}_0xcc7e1=_[_0xff59('0x37')]({},_0xcc7e1,_0x32d4ef[_0xff59('0x40')]);return db['SalesforceConfiguration'][_0xff59('0x41')](_0xcc7e1)[_0xff59('0x22')](handleEntityNotFound(_0x2fd3aa,null))['then'](respondWithResult(_0x2fd3aa,null))[_0xff59('0x3e')](handleError(_0x2fd3aa,null));};exports['create']=function(_0xa373ee,_0x1387b8){return db['SalesforceConfiguration']['create'](_0xa373ee[_0xff59('0x42')],{})[_0xff59('0x22')](respondWithResult(_0x1387b8,0xc9))[_0xff59('0x3e')](handleError(_0x1387b8,null));};exports[_0xff59('0x21')]=function(_0x15caa8,_0x3cd1e8){if(_0x15caa8[_0xff59('0x42')]['id']){delete _0x15caa8[_0xff59('0x42')]['id'];}return db[_0xff59('0x27')][_0xff59('0x41')]({'where':{'id':_0x15caa8[_0xff59('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3cd1e8,null))[_0xff59('0x22')](saveUpdates(_0x15caa8[_0xff59('0x42')],null))[_0xff59('0x22')](respondWithResult(_0x3cd1e8,null))[_0xff59('0x3e')](handleError(_0x3cd1e8,null));};exports[_0xff59('0x23')]=function(_0x49fbcd,_0x35c6ca){return db[_0xff59('0x27')][_0xff59('0x41')]({'where':{'id':_0x49fbcd['params']['id']}})['then'](handleEntityNotFound(_0x35c6ca,null))[_0xff59('0x22')](removeEntity(_0x35c6ca,null))[_0xff59('0x3e')](handleError(_0x35c6ca,null));};exports[_0xff59('0x43')]=function(_0x41ae25,_0x1d1a91,_0x13df6e){var _0x4befdf={};var _0x78984={};var _0x1eda59;var _0x29ea00;return db[_0xff59('0x27')][_0xff59('0x44')]({'where':{'id':_0x41ae25[_0xff59('0x3f')]['id']}})[_0xff59('0x22')](handleEntityNotFound(_0x1d1a91,null))[_0xff59('0x22')](function(_0x20e766){if(_0x20e766){_0x1eda59=_0x20e766;_0x78984[_0xff59('0x2e')]=_['keys'](db[_0xff59('0x45')]['rawAttributes']);_0x78984[_0xff59('0x2a')]=_[_0xff59('0x2b')](_0x41ae25[_0xff59('0x2a')]);_0x78984[_0xff59('0x2c')]=_[_0xff59('0x2d')](_0x78984['model'],_0x78984[_0xff59('0x2a')]);_0x4befdf[_0xff59('0x2f')]=_[_0xff59('0x2d')](_0x78984[_0xff59('0x2e')],qs[_0xff59('0x30')](_0x41ae25[_0xff59('0x2a')][_0xff59('0x30')]));_0x4befdf['attributes']=_0x4befdf['attributes'][_0xff59('0x31')]?_0x4befdf['attributes']:_0x78984[_0xff59('0x2e')];_0x4befdf[_0xff59('0x34')]=qs[_0xff59('0x35')](_0x41ae25[_0xff59('0x2a')]['sort']);_0x4befdf[_0xff59('0x36')]=qs[_0xff59('0x2c')](_['pick'](_0x41ae25['query'],_0x78984[_0xff59('0x2c')]));if(_0x41ae25[_0xff59('0x2a')][_0xff59('0x46')]){_0x4befdf[_0xff59('0x36')]=_['merge'](_0x4befdf['where'],{'$or':_['map'](_0x4befdf['attributes'],function(_0x590036){var _0x22c164={};_0x22c164[_0x590036]={'$like':'%'+_0x41ae25[_0xff59('0x2a')]['filter']+'%'};return _0x22c164;})});}_0x4befdf=_[_0xff59('0x37')]({},_0x4befdf,_0x41ae25[_0xff59('0x40')]);return _0x1eda59['getFields'](_0x4befdf);}})['then'](function(_0xd75ff8){if(_0xd75ff8){_0x29ea00=_0xd75ff8['length'];if(!_0x41ae25[_0xff59('0x2a')][_0xff59('0x32')](_0xff59('0x33'))){_0x4befdf[_0xff59('0x1c')]=qs['limit'](_0x41ae25[_0xff59('0x2a')][_0xff59('0x1c')]);_0x4befdf[_0xff59('0x1a')]=qs[_0xff59('0x1a')](_0x41ae25[_0xff59('0x2a')][_0xff59('0x1a')]);}return _0x1eda59[_0xff59('0x43')](_0x4befdf);}})[_0xff59('0x22')](function(_0x108c14){if(_0x108c14){return _0x108c14?{'count':_0x29ea00,'rows':_0x108c14}:null;}})[_0xff59('0x22')](respondWithResult(_0x1d1a91,null))[_0xff59('0x3e')](handleError(_0x1d1a91,null));};exports[_0xff59('0x47')]=function(_0x2e7664,_0x24bcfa,_0x1782b4){var _0x13ced3={};var _0x1a0cee={};var _0x12813f;var _0x36e04a;return db['SalesforceConfiguration'][_0xff59('0x44')]({'where':{'id':_0x2e7664[_0xff59('0x3f')]['id']}})[_0xff59('0x22')](handleEntityNotFound(_0x24bcfa,null))[_0xff59('0x22')](function(_0x1d20cb){if(_0x1d20cb){_0x12813f=_0x1d20cb;_0x1a0cee[_0xff59('0x2e')]=_['keys'](db[_0xff59('0x45')]['rawAttributes']);_0x1a0cee[_0xff59('0x2a')]=_[_0xff59('0x2b')](_0x2e7664[_0xff59('0x2a')]);_0x1a0cee[_0xff59('0x2c')]=_[_0xff59('0x2d')](_0x1a0cee[_0xff59('0x2e')],_0x1a0cee[_0xff59('0x2a')]);_0x13ced3['attributes']=_[_0xff59('0x2d')](_0x1a0cee[_0xff59('0x2e')],qs[_0xff59('0x30')](_0x2e7664[_0xff59('0x2a')][_0xff59('0x30')]));_0x13ced3[_0xff59('0x2f')]=_0x13ced3[_0xff59('0x2f')][_0xff59('0x31')]?_0x13ced3['attributes']:_0x1a0cee['model'];_0x13ced3[_0xff59('0x34')]=qs[_0xff59('0x35')](_0x2e7664[_0xff59('0x2a')][_0xff59('0x35')]);_0x13ced3['where']=qs['filters'](_[_0xff59('0x48')](_0x2e7664[_0xff59('0x2a')],_0x1a0cee['filters']));if(_0x2e7664[_0xff59('0x2a')]['filter']){_0x13ced3[_0xff59('0x36')]=_['merge'](_0x13ced3[_0xff59('0x36')],{'$or':_[_0xff59('0x26')](_0x13ced3['attributes'],function(_0x236500){var _0x15b874={};_0x15b874[_0x236500]={'$like':'%'+_0x2e7664['query'][_0xff59('0x46')]+'%'};return _0x15b874;})});}_0x13ced3=_[_0xff59('0x37')]({},_0x13ced3,_0x2e7664[_0xff59('0x40')]);return _0x12813f[_0xff59('0x47')](_0x13ced3);}})['then'](function(_0x2cb8b0){if(_0x2cb8b0){_0x36e04a=_0x2cb8b0[_0xff59('0x31')];if(!_0x2e7664[_0xff59('0x2a')][_0xff59('0x32')](_0xff59('0x33'))){_0x13ced3['limit']=qs[_0xff59('0x1c')](_0x2e7664[_0xff59('0x2a')][_0xff59('0x1c')]);_0x13ced3[_0xff59('0x1a')]=qs[_0xff59('0x1a')](_0x2e7664[_0xff59('0x2a')]['offset']);}return _0x12813f[_0xff59('0x47')](_0x13ced3);}})[_0xff59('0x22')](function(_0xaf75b1){if(_0xaf75b1){return _0xaf75b1?{'count':_0x36e04a,'rows':_0xaf75b1}:null;}})[_0xff59('0x22')](respondWithResult(_0x24bcfa,null))[_0xff59('0x3e')](handleError(_0x24bcfa,null));};exports[_0xff59('0x49')]=function(_0x290e54,_0x12287b,_0x3a714c){var _0x3254ce={};var _0x3f4646={};var _0x373f7d;var _0x251799;return db[_0xff59('0x27')]['findOne']({'where':{'id':_0x290e54['params']['id']}})['then'](handleEntityNotFound(_0x12287b,null))['then'](function(_0x2dd088){if(_0x2dd088){_0x373f7d=_0x2dd088;_0x3f4646[_0xff59('0x2e')]=_[_0xff59('0x2b')](db[_0xff59('0x45')][_0xff59('0x28')]);_0x3f4646[_0xff59('0x2a')]=_['keys'](_0x290e54[_0xff59('0x2a')]);_0x3f4646[_0xff59('0x2c')]=_[_0xff59('0x2d')](_0x3f4646[_0xff59('0x2e')],_0x3f4646[_0xff59('0x2a')]);_0x3254ce[_0xff59('0x2f')]=_[_0xff59('0x2d')](_0x3f4646['model'],qs[_0xff59('0x30')](_0x290e54[_0xff59('0x2a')][_0xff59('0x30')]));_0x3254ce[_0xff59('0x2f')]=_0x3254ce['attributes'][_0xff59('0x31')]?_0x3254ce[_0xff59('0x2f')]:_0x3f4646['model'];_0x3254ce[_0xff59('0x34')]=qs[_0xff59('0x35')](_0x290e54[_0xff59('0x2a')][_0xff59('0x35')]);_0x3254ce[_0xff59('0x36')]=qs['filters'](_[_0xff59('0x48')](_0x290e54[_0xff59('0x2a')],_0x3f4646[_0xff59('0x2c')]));if(_0x290e54[_0xff59('0x2a')][_0xff59('0x46')]){_0x3254ce[_0xff59('0x36')]=_[_0xff59('0x37')](_0x3254ce[_0xff59('0x36')],{'$or':_[_0xff59('0x26')](_0x3254ce[_0xff59('0x2f')],function(_0x159022){var _0xeb3af3={};_0xeb3af3[_0x159022]={'$like':'%'+_0x290e54[_0xff59('0x2a')]['filter']+'%'};return _0xeb3af3;})});}_0x3254ce=_['merge']({},_0x3254ce,_0x290e54[_0xff59('0x40')]);return _0x373f7d[_0xff59('0x49')](_0x3254ce);}})[_0xff59('0x22')](function(_0x18d60e){if(_0x18d60e){_0x251799=_0x18d60e[_0xff59('0x31')];if(!_0x290e54['query'][_0xff59('0x32')](_0xff59('0x33'))){_0x3254ce['limit']=qs[_0xff59('0x1c')](_0x290e54['query'][_0xff59('0x1c')]);_0x3254ce[_0xff59('0x1a')]=qs[_0xff59('0x1a')](_0x290e54['query'][_0xff59('0x1a')]);}return _0x373f7d[_0xff59('0x49')](_0x3254ce);}})['then'](function(_0x28528e){if(_0x28528e){return _0x28528e?{'count':_0x251799,'rows':_0x28528e}:null;}})[_0xff59('0x22')](respondWithResult(_0x12287b,null))['catch'](handleError(_0x12287b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 8605559..34e7b82 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa12e=['../../config/environment','exports','define','int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x53abfa,_0xd4ea1d){var _0x119d56=function(_0x2f33e5){while(--_0x2f33e5){_0x53abfa['push'](_0x53abfa['shift']());}};_0x119d56(++_0xd4ea1d);}(_0xa12e,0x1bc));var _0xea12=function(_0x3fd086,_0x4b6e5e){_0x3fd086=_0x3fd086-0x0;var _0x1147b8=_0xa12e[_0x3fd086];return _0x1147b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea12('0x0'))('api');var moment=require(_0xea12('0x1'));var BPromise=require(_0xea12('0x2'));var rp=require(_0xea12('0x3'));var fs=require('fs');var path=require(_0xea12('0x4'));var rimraf=require(_0xea12('0x5'));var config=require(_0xea12('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xea12('0x7')]=function(_0x3a4019,_0x57418b){return _0x3a4019[_0xea12('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xea12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf641=['int_salesforce_configurations','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf641,0xb1));var _0x1f64=function(_0x5db2e5,_0x5ade38){_0x5db2e5=_0x5db2e5-0x0;var _0x40953f=_0xf641[_0x5db2e5];return _0x40953f;};'use strict';var _=require(_0x1f64('0x0'));var util=require('util');var logger=require(_0x1f64('0x1'))(_0x1f64('0x2'));var moment=require(_0x1f64('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f64('0x4'));var fs=require('fs');var path=require(_0x1f64('0x5'));var rimraf=require('rimraf');var config=require(_0x1f64('0x6'));var attributes=require(_0x1f64('0x7'));module[_0x1f64('0x8')]=function(_0x30cf3e,_0x19fb4f){return _0x30cf3e[_0x1f64('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x1f64('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 324cd87..e08e31c 100644 --- a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js +++ b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x550a=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x550a,0x1d5));var _0xa550=function(_0x42336c,_0x53f761){_0x42336c=_0x42336c-0x0;var _0x8609de=_0x550a[_0x42336c];return _0x8609de;};'use strict';var _=require(_0xa550('0x0'));var util=require('util');var moment=require(_0xa550('0x1'));var BPromise=require(_0xa550('0x2'));var rs=require(_0xa550('0x3'));var fs=require('fs');var Redis=require(_0xa550('0x4'));var db=require(_0xa550('0x5'))['db'];var utils=require(_0xa550('0x6'));var logger=require(_0xa550('0x7'))(_0xa550('0x8'));var config=require('../../config/environment');var jayson=require(_0xa550('0x9'));var client=jayson[_0xa550('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3735be,_0x321a2c,_0x72a889){return new BPromise(function(_0x5392ee,_0x1ff6e3){return client[_0xa550('0xb')](_0x3735be,_0x72a889)[_0xa550('0xc')](function(_0x18282a){logger[_0xa550('0xd')](_0xa550('0xe'),_0x321a2c,_0xa550('0xf'));logger[_0xa550('0x10')](_0xa550('0x11'),_0x321a2c,_0xa550('0xf'),JSON[_0xa550('0x12')](_0x18282a));if(_0x18282a['error']){if(_0x18282a['error'][_0xa550('0x13')]===0x1f4){logger[_0xa550('0x14')](_0xa550('0xe'),_0x321a2c,_0x18282a[_0xa550('0x14')][_0xa550('0x15')]);return _0x1ff6e3(_0x18282a['error'][_0xa550('0x15')]);}logger[_0xa550('0x14')](_0xa550('0xe'),_0x321a2c,_0x18282a[_0xa550('0x14')]['message']);return _0x5392ee(_0x18282a[_0xa550('0x14')][_0xa550('0x15')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x321a2c,_0xa550('0xf'));_0x5392ee(_0x18282a[_0xa550('0x16')][_0xa550('0x15')]);}})[_0xa550('0x17')](function(_0x5a4235){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x321a2c,_0x5a4235);_0x1ff6e3(_0x5a4235);});});} \ No newline at end of file +var _0xc050=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5c97b0,_0x432d1d){var _0x4637e1=function(_0x1c71f7){while(--_0x1c71f7){_0x5c97b0['push'](_0x5c97b0['shift']());}};_0x4637e1(++_0x432d1d);}(_0xc050,0x7b));var _0x0c05=function(_0x45ce4e,_0x3a367c){_0x45ce4e=_0x45ce4e-0x0;var _0x4a105a=_0xc050[_0x45ce4e];return _0x4a105a;};'use strict';var _=require(_0x0c05('0x0'));var util=require(_0x0c05('0x1'));var moment=require(_0x0c05('0x2'));var BPromise=require('bluebird');var rs=require(_0x0c05('0x3'));var fs=require('fs');var Redis=require(_0x0c05('0x4'));var db=require(_0x0c05('0x5'))['db'];var utils=require(_0x0c05('0x6'));var logger=require(_0x0c05('0x7'))(_0x0c05('0x8'));var config=require(_0x0c05('0x9'));var jayson=require(_0x0c05('0xa'));var client=jayson['client'][_0x0c05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x507ac1,_0x8e8df0,_0x2b5d9f){return new BPromise(function(_0x1b69e0,_0x147897){return client['request'](_0x507ac1,_0x2b5d9f)[_0x0c05('0xc')](function(_0x2e2bbb){logger[_0x0c05('0xd')](_0x0c05('0xe'),_0x8e8df0,_0x0c05('0xf'));logger[_0x0c05('0x10')](_0x0c05('0x11'),_0x8e8df0,_0x0c05('0xf'),JSON[_0x0c05('0x12')](_0x2e2bbb));if(_0x2e2bbb[_0x0c05('0x13')]){if(_0x2e2bbb[_0x0c05('0x13')][_0x0c05('0x14')]===0x1f4){logger['error'](_0x0c05('0xe'),_0x8e8df0,_0x2e2bbb[_0x0c05('0x13')]['message']);return _0x147897(_0x2e2bbb[_0x0c05('0x13')][_0x0c05('0x15')]);}logger[_0x0c05('0x13')](_0x0c05('0xe'),_0x8e8df0,_0x2e2bbb[_0x0c05('0x13')][_0x0c05('0x15')]);return _0x1b69e0(_0x2e2bbb[_0x0c05('0x13')][_0x0c05('0x15')]);}else{logger[_0x0c05('0xd')](_0x0c05('0xe'),_0x8e8df0,_0x0c05('0xf'));_0x1b69e0(_0x2e2bbb[_0x0c05('0x16')][_0x0c05('0x15')]);}})[_0x0c05('0x17')](function(_0x5b52c0){logger[_0x0c05('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x8e8df0,_0x5b52c0);_0x147897(_0x5b52c0);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 52fce34..276d346 100644 --- a/server/api/intSalesforceField/index.js +++ b/server/api/intSalesforceField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x561c=['update','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x561c,0x1c2));var _0xc561=function(_0x4fced0,_0x3616c5){_0x4fced0=_0x4fced0-0x0;var _0x25686c=_0x561c[_0x4fced0];return _0x25686c;};'use strict';var multer=require(_0xc561('0x0'));var util=require(_0xc561('0x1'));var path=require('path');var timeout=require(_0xc561('0x2'));var express=require(_0xc561('0x3'));var router=express['Router']();var fs_extra=require(_0xc561('0x4'));var auth=require(_0xc561('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc561('0x6'));var controller=require('./intSalesforceField.controller');router[_0xc561('0x7')]('/',auth[_0xc561('0x8')](),controller[_0xc561('0x9')]);router[_0xc561('0x7')](_0xc561('0xa'),auth[_0xc561('0x8')](),controller['show']);router[_0xc561('0xb')]('/',auth[_0xc561('0x8')](),controller[_0xc561('0xc')]);router[_0xc561('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc561('0xe')]);router['delete'](_0xc561('0xa'),auth[_0xc561('0x8')](),controller[_0xc561('0xf')]);module['exports']=router; \ No newline at end of file +var _0x65b5=['index','post','put','/:id','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x15c5fe,_0x4b92d9){var _0xdab3=function(_0x5329e6){while(--_0x5329e6){_0x15c5fe['push'](_0x15c5fe['shift']());}};_0xdab3(++_0x4b92d9);}(_0x65b5,0x1d2));var _0x565b=function(_0x2a9e45,_0x1dbf81){_0x2a9e45=_0x2a9e45-0x0;var _0x56c024=_0x65b5[_0x2a9e45];return _0x56c024;};'use strict';var multer=require(_0x565b('0x0'));var util=require(_0x565b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x565b('0x2')]();var fs_extra=require(_0x565b('0x3'));var auth=require(_0x565b('0x4'));var interaction=require(_0x565b('0x5'));var config=require(_0x565b('0x6'));var controller=require(_0x565b('0x7'));router[_0x565b('0x8')]('/',auth[_0x565b('0x9')](),controller[_0x565b('0xa')]);router[_0x565b('0x8')]('/:id',auth[_0x565b('0x9')](),controller['show']);router[_0x565b('0xb')]('/',auth[_0x565b('0x9')](),controller['create']);router[_0x565b('0xc')](_0x565b('0xd'),auth[_0x565b('0x9')](),controller[_0x565b('0xe')]);router[_0x565b('0xf')](_0x565b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x565b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5d1557b..c0a363c 100644 --- a/server/api/intSalesforceField/intSalesforceField.attributes.js +++ b/server/api/intSalesforceField/intSalesforceField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ed8=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6ed8,0xe7));var _0x86ed=function(_0x153b12,_0x231224){_0x153b12=_0x153b12-0x0;var _0x3c8106=_0x6ed8[_0x153b12];return _0x3c8106;};'use strict';var Sequelize=require(_0x86ed('0x0'));module[_0x86ed('0x1')]={'type':{'type':Sequelize[_0x86ed('0x2')](_0x86ed('0x3'),'variable',_0x86ed('0x4'),_0x86ed('0x5'),_0x86ed('0x6')),'defaultValue':_0x86ed('0x3')},'content':{'type':Sequelize[_0x86ed('0x7')]},'key':{'type':Sequelize[_0x86ed('0x7')]},'keyType':{'type':Sequelize[_0x86ed('0x2')](_0x86ed('0x3'),_0x86ed('0x8'),_0x86ed('0x4'))},'keyContent':{'type':Sequelize[_0x86ed('0x7')]},'idField':{'type':Sequelize[_0x86ed('0x7')]},'variableName':{'type':Sequelize[_0x86ed('0x7')]}}; \ No newline at end of file +var _0xe547=['keyValue','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x539883,_0x133b86){var _0x4f95c3=function(_0x1a51f8){while(--_0x1a51f8){_0x539883['push'](_0x539883['shift']());}};_0x4f95c3(++_0x133b86);}(_0xe547,0xc3));var _0x7e54=function(_0x5d84f6,_0xa8498){_0x5d84f6=_0x5d84f6-0x0;var _0x1587e9=_0xe547[_0x5d84f6];return _0x1587e9;};'use strict';var Sequelize=require(_0x7e54('0x0'));module[_0x7e54('0x1')]={'type':{'type':Sequelize[_0x7e54('0x2')]('string',_0x7e54('0x3'),_0x7e54('0x4'),_0x7e54('0x5'),'picklist'),'defaultValue':_0x7e54('0x6')},'content':{'type':Sequelize[_0x7e54('0x7')]},'key':{'type':Sequelize[_0x7e54('0x7')]},'keyType':{'type':Sequelize[_0x7e54('0x2')](_0x7e54('0x6'),_0x7e54('0x3'),_0x7e54('0x4'))},'keyContent':{'type':Sequelize[_0x7e54('0x7')]},'idField':{'type':Sequelize[_0x7e54('0x7')]},'variableName':{'type':Sequelize[_0x7e54('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 928c05e..f93f8a5 100644 --- a/server/api/intSalesforceField/intSalesforceField.controller.js +++ b/server/api/intSalesforceField/intSalesforceField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaf6=['map','SalesforceField','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfaf6,0x193));var _0x6faf=function(_0x4f42db,_0x5d1f80){_0x4f42db=_0x4f42db-0x0;var _0xa64249=_0xfaf6[_0x4f42db];return _0xa64249;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6faf('0x0'));var zipdir=require(_0x6faf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6faf('0x2'));var moment=require(_0x6faf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6faf('0x4'));var util=require(_0x6faf('0x5'));var path=require(_0x6faf('0x6'));var sox=require(_0x6faf('0x7'));var csv=require(_0x6faf('0x8'));var ejs=require(_0x6faf('0x9'));var fs=require('fs');var fs_extra=require(_0x6faf('0xa'));var _=require(_0x6faf('0xb'));var squel=require(_0x6faf('0xc'));var crypto=require(_0x6faf('0xd'));var jsforce=require(_0x6faf('0xe'));var deskjs=require(_0x6faf('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6faf('0x10'));var Redis=require('ioredis');var authService=require(_0x6faf('0x11'));var qs=require(_0x6faf('0x12'));var as=require(_0x6faf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6faf('0x14'))(_0x6faf('0x15'));var utils=require(_0x6faf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d573a,_0x2ad56f){_0x2ad56f=_0x2ad56f||0xcc;return function(_0x2d7dfb){if(_0x2d7dfb){return _0x2d573a[_0x6faf('0x17')](_0x2ad56f);}return _0x2d573a[_0x6faf('0x18')](_0x2ad56f)['end']();};}function respondWithResult(_0x531031,_0x4ae5d1){_0x4ae5d1=_0x4ae5d1||0xc8;return function(_0x4ec156){if(_0x4ec156){return _0x531031[_0x6faf('0x18')](_0x4ae5d1)[_0x6faf('0x19')](_0x4ec156);}};}function respondWithFilteredResult(_0x2ee3df,_0x351e6c){return function(_0x230e76){if(_0x230e76){var _0x2b673e=typeof _0x351e6c[_0x6faf('0x1a')]===_0x6faf('0x1b')&&typeof _0x351e6c[_0x6faf('0x1c')]===_0x6faf('0x1b');var _0x4f0467=_0x230e76[_0x6faf('0x1d')];var _0x2bffb8=_0x2b673e?0x0:_0x351e6c[_0x6faf('0x1a')];var _0x24d422=_0x2b673e?_0x230e76[_0x6faf('0x1d')]:_0x351e6c[_0x6faf('0x1a')]+_0x351e6c[_0x6faf('0x1c')];var _0x3e480c;if(_0x24d422>=_0x4f0467){_0x24d422=_0x4f0467;_0x3e480c=0xc8;}else{_0x3e480c=0xce;}_0x2ee3df[_0x6faf('0x18')](_0x3e480c);return _0x2ee3df[_0x6faf('0x1e')]('Content-Range',_0x2bffb8+'-'+_0x24d422+'/'+_0x4f0467)[_0x6faf('0x19')](_0x230e76);}return null;};}function patchUpdates(_0x513947){return function(_0x230ff3){try{jsonpatch['apply'](_0x230ff3,_0x513947,!![]);}catch(_0x51870b){return BPromise[_0x6faf('0x1f')](_0x51870b);}return _0x230ff3[_0x6faf('0x20')]();};}function saveUpdates(_0x365acf,_0xaa1e68){return function(_0x40b4f1){if(_0x40b4f1){return _0x40b4f1[_0x6faf('0x21')](_0x365acf)[_0x6faf('0x22')](function(_0x3f0abc){return _0x3f0abc;});}return null;};}function removeEntity(_0x555355,_0x581322){return function(_0x33075d){if(_0x33075d){return _0x33075d[_0x6faf('0x23')]()[_0x6faf('0x22')](function(){_0x555355[_0x6faf('0x18')](0xcc)[_0x6faf('0x24')]();});}};}function handleEntityNotFound(_0x570d64,_0x5ed5fe){return function(_0x1b4289){if(!_0x1b4289){_0x570d64[_0x6faf('0x17')](0x194);}return _0x1b4289;};}function handleError(_0x4381e7,_0x4a64c0){_0x4a64c0=_0x4a64c0||0x1f4;return function(_0x426653){logger[_0x6faf('0x25')](_0x426653[_0x6faf('0x26')]);if(_0x426653[_0x6faf('0x27')]){delete _0x426653[_0x6faf('0x27')];}_0x4381e7[_0x6faf('0x18')](_0x4a64c0)[_0x6faf('0x28')](_0x426653);};}exports['index']=function(_0x3ad49a,_0x1c826b){var _0xea8ad2={},_0x2e4d52={},_0x415cb1={'count':0x0,'rows':[]};var _0x124379=_[_0x6faf('0x29')](db[_0x6faf('0x2a')][_0x6faf('0x2b')],function(_0xf1028e){return{'name':_0xf1028e[_0x6faf('0x2c')],'type':_0xf1028e['type'][_0x6faf('0x2d')]};});_0x2e4d52['model']=_[_0x6faf('0x29')](_0x124379,'name');_0x2e4d52[_0x6faf('0x2e')]=_[_0x6faf('0x2f')](_0x3ad49a[_0x6faf('0x2e')]);_0x2e4d52[_0x6faf('0x30')]=_[_0x6faf('0x31')](_0x2e4d52['model'],_0x2e4d52[_0x6faf('0x2e')]);_0xea8ad2[_0x6faf('0x32')]=_[_0x6faf('0x31')](_0x2e4d52[_0x6faf('0x33')],qs[_0x6faf('0x34')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x34')]));_0xea8ad2['attributes']=_0xea8ad2[_0x6faf('0x32')][_0x6faf('0x35')]?_0xea8ad2['attributes']:_0x2e4d52[_0x6faf('0x33')];if(!_0x3ad49a['query'][_0x6faf('0x36')](_0x6faf('0x37'))){_0xea8ad2[_0x6faf('0x1c')]=qs[_0x6faf('0x1c')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x1c')]);_0xea8ad2[_0x6faf('0x1a')]=qs[_0x6faf('0x1a')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x1a')]);}_0xea8ad2[_0x6faf('0x38')]=qs[_0x6faf('0x39')](_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x39')]);_0xea8ad2['where']=qs[_0x6faf('0x30')](_['pick'](_0x3ad49a[_0x6faf('0x2e')],_0x2e4d52['filters']),_0x124379);if(_0x3ad49a['query'][_0x6faf('0x3a')]){_0xea8ad2[_0x6faf('0x3b')]=_[_0x6faf('0x3c')](_0xea8ad2[_0x6faf('0x3b')],{'$or':_[_0x6faf('0x29')](_0x124379,function(_0x5ce5e8){if(_0x5ce5e8[_0x6faf('0x3d')]!==_0x6faf('0x3e')){var _0x39e4c1={};_0x39e4c1[_0x5ce5e8[_0x6faf('0x27')]]={'$like':'%'+_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x3a')]+'%'};return _0x39e4c1;}})});}_0xea8ad2=_[_0x6faf('0x3c')]({},_0xea8ad2,_0x3ad49a[_0x6faf('0x3f')]);var _0x210362={'where':_0xea8ad2[_0x6faf('0x3b')]};return db[_0x6faf('0x2a')][_0x6faf('0x1d')](_0x210362)[_0x6faf('0x22')](function(_0x333f5c){_0x415cb1[_0x6faf('0x1d')]=_0x333f5c;if(_0x3ad49a[_0x6faf('0x2e')][_0x6faf('0x40')]){_0xea8ad2[_0x6faf('0x41')]=[{'all':!![]}];}return db[_0x6faf('0x2a')][_0x6faf('0x42')](_0xea8ad2);})[_0x6faf('0x22')](function(_0x47c367){_0x415cb1[_0x6faf('0x43')]=_0x47c367;return _0x415cb1;})[_0x6faf('0x22')](respondWithFilteredResult(_0x1c826b,_0xea8ad2))[_0x6faf('0x44')](handleError(_0x1c826b,null));};exports[_0x6faf('0x45')]=function(_0x214827,_0x25f052){var _0x5e234c={'raw':!![],'where':{'id':_0x214827[_0x6faf('0x46')]['id']}},_0x6126ef={};_0x6126ef[_0x6faf('0x33')]=_[_0x6faf('0x2f')](db[_0x6faf('0x2a')][_0x6faf('0x2b')]);_0x6126ef[_0x6faf('0x2e')]=_[_0x6faf('0x2f')](_0x214827['query']);_0x6126ef[_0x6faf('0x30')]=_[_0x6faf('0x31')](_0x6126ef['model'],_0x6126ef[_0x6faf('0x2e')]);_0x5e234c[_0x6faf('0x32')]=_[_0x6faf('0x31')](_0x6126ef['model'],qs[_0x6faf('0x34')](_0x214827[_0x6faf('0x2e')]['fields']));_0x5e234c[_0x6faf('0x32')]=_0x5e234c[_0x6faf('0x32')][_0x6faf('0x35')]?_0x5e234c[_0x6faf('0x32')]:_0x6126ef[_0x6faf('0x33')];if(_0x214827[_0x6faf('0x2e')][_0x6faf('0x40')]){_0x5e234c['include']=[{'all':!![]}];}_0x5e234c=_[_0x6faf('0x3c')]({},_0x5e234c,_0x214827[_0x6faf('0x3f')]);return db[_0x6faf('0x2a')][_0x6faf('0x47')](_0x5e234c)['then'](handleEntityNotFound(_0x25f052,null))['then'](respondWithResult(_0x25f052,null))[_0x6faf('0x44')](handleError(_0x25f052,null));};exports[_0x6faf('0x48')]=function(_0x499618,_0x4bd2ea){return db[_0x6faf('0x2a')]['create'](_0x499618[_0x6faf('0x49')],{})[_0x6faf('0x22')](respondWithResult(_0x4bd2ea,0xc9))['catch'](handleError(_0x4bd2ea,null));};exports['update']=function(_0x37ad9e,_0x5e7126){if(_0x37ad9e[_0x6faf('0x49')]['id']){delete _0x37ad9e['body']['id'];}return db[_0x6faf('0x2a')][_0x6faf('0x47')]({'where':{'id':_0x37ad9e[_0x6faf('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e7126,null))[_0x6faf('0x22')](saveUpdates(_0x37ad9e[_0x6faf('0x49')],null))[_0x6faf('0x22')](respondWithResult(_0x5e7126,null))['catch'](handleError(_0x5e7126,null));};exports[_0x6faf('0x23')]=function(_0x46e45f,_0x2d9690){return db[_0x6faf('0x2a')][_0x6faf('0x47')]({'where':{'id':_0x46e45f[_0x6faf('0x46')]['id']}})[_0x6faf('0x22')](handleEntityNotFound(_0x2d9690,null))[_0x6faf('0x22')](removeEntity(_0x2d9690,null))[_0x6faf('0x44')](handleError(_0x2d9690,null));}; \ No newline at end of file +var _0x1409=['status','json','offset','limit','undefined','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','send','index','map','SalesforceField','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','merge','filter','include','findAll','show','params','fields','includeAll','options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0xcdc46b,_0x5007bf){var _0x4f46cb=function(_0xee0bfa){while(--_0xee0bfa){_0xcdc46b['push'](_0xcdc46b['shift']());}};_0x4f46cb(++_0x5007bf);}(_0x1409,0x79));var _0x9140=function(_0x6bcf61,_0x3f2839){_0x6bcf61=_0x6bcf61-0x0;var _0xe1f55=_0x1409[_0x6bcf61];return _0xe1f55;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9140('0x0'));var zipdir=require(_0x9140('0x1'));var jsonpatch=require(_0x9140('0x2'));var rp=require(_0x9140('0x3'));var moment=require(_0x9140('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9140('0x5'));var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require(_0x9140('0x8'));var csv=require(_0x9140('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require('squel');var crypto=require(_0x9140('0xc'));var jsforce=require(_0x9140('0xd'));var deskjs=require(_0x9140('0xe'));var toCsv=require(_0x9140('0x9'));var querystring=require('querystring');var Papa=require(_0x9140('0xf'));var Redis=require(_0x9140('0x10'));var authService=require(_0x9140('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9140('0x12'));var hardwareService=require(_0x9140('0x13'));var logger=require(_0x9140('0x14'))(_0x9140('0x15'));var utils=require(_0x9140('0x16'));var config=require(_0x9140('0x17'));var licenseUtil=require(_0x9140('0x18'));var db=require(_0x9140('0x19'))['db'];function respondWithStatusCode(_0x149bc3,_0x4a125c){_0x4a125c=_0x4a125c||0xcc;return function(_0x4d6996){if(_0x4d6996){return _0x149bc3['sendStatus'](_0x4a125c);}return _0x149bc3['status'](_0x4a125c)[_0x9140('0x1a')]();};}function respondWithResult(_0x371912,_0x4dcd3a){_0x4dcd3a=_0x4dcd3a||0xc8;return function(_0xe3e26){if(_0xe3e26){return _0x371912[_0x9140('0x1b')](_0x4dcd3a)[_0x9140('0x1c')](_0xe3e26);}};}function respondWithFilteredResult(_0x4746d9,_0x1d45c0){return function(_0x56bea4){if(_0x56bea4){var _0x56e5b2=typeof _0x1d45c0[_0x9140('0x1d')]==='undefined'&&typeof _0x1d45c0[_0x9140('0x1e')]===_0x9140('0x1f');var _0x21e9c2=_0x56bea4[_0x9140('0x20')];var _0x4102f5=_0x56e5b2?0x0:_0x1d45c0[_0x9140('0x1d')];var _0x628bc8=_0x56e5b2?_0x56bea4[_0x9140('0x20')]:_0x1d45c0['offset']+_0x1d45c0[_0x9140('0x1e')];var _0x54f915;if(_0x628bc8>=_0x21e9c2){_0x628bc8=_0x21e9c2;_0x54f915=0xc8;}else{_0x54f915=0xce;}_0x4746d9[_0x9140('0x1b')](_0x54f915);return _0x4746d9[_0x9140('0x21')](_0x9140('0x22'),_0x4102f5+'-'+_0x628bc8+'/'+_0x21e9c2)['json'](_0x56bea4);}return null;};}function patchUpdates(_0x2b6c76){return function(_0x1cdfb0){try{jsonpatch['apply'](_0x1cdfb0,_0x2b6c76,!![]);}catch(_0x4b5c03){return BPromise['reject'](_0x4b5c03);}return _0x1cdfb0[_0x9140('0x23')]();};}function saveUpdates(_0x10a815,_0x20ce47){return function(_0x2f36f3){if(_0x2f36f3){return _0x2f36f3[_0x9140('0x24')](_0x10a815)['then'](function(_0x3afc3b){return _0x3afc3b;});}return null;};}function removeEntity(_0x10dc94,_0x283e5c){return function(_0x436851){if(_0x436851){return _0x436851[_0x9140('0x25')]()[_0x9140('0x26')](function(){_0x10dc94[_0x9140('0x1b')](0xcc)[_0x9140('0x1a')]();});}};}function handleEntityNotFound(_0x5e7c5e,_0xc589fe){return function(_0x26d5b9){if(!_0x26d5b9){_0x5e7c5e[_0x9140('0x27')](0x194);}return _0x26d5b9;};}function handleError(_0x39ae5d,_0x39455a){_0x39455a=_0x39455a||0x1f4;return function(_0x3a0645){logger[_0x9140('0x28')](_0x3a0645[_0x9140('0x29')]);if(_0x3a0645['name']){delete _0x3a0645['name'];}_0x39ae5d[_0x9140('0x1b')](_0x39455a)[_0x9140('0x2a')](_0x3a0645);};}exports[_0x9140('0x2b')]=function(_0x312748,_0x58b483){var _0x2c255d={},_0xb3ea29={},_0x1cd721={'count':0x0,'rows':[]};var _0x271bd4=_[_0x9140('0x2c')](db[_0x9140('0x2d')][_0x9140('0x2e')],function(_0x425735){return{'name':_0x425735['fieldName'],'type':_0x425735[_0x9140('0x2f')][_0x9140('0x30')]};});_0xb3ea29['model']=_[_0x9140('0x2c')](_0x271bd4,_0x9140('0x31'));_0xb3ea29[_0x9140('0x32')]=_[_0x9140('0x33')](_0x312748['query']);_0xb3ea29[_0x9140('0x34')]=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],_0xb3ea29[_0x9140('0x32')]);_0x2c255d['attributes']=_[_0x9140('0x35')](_0xb3ea29[_0x9140('0x36')],qs['fields'](_0x312748['query']['fields']));_0x2c255d['attributes']=_0x2c255d[_0x9140('0x37')][_0x9140('0x38')]?_0x2c255d[_0x9140('0x37')]:_0xb3ea29[_0x9140('0x36')];if(!_0x312748[_0x9140('0x32')][_0x9140('0x39')](_0x9140('0x3a'))){_0x2c255d['limit']=qs[_0x9140('0x1e')](_0x312748[_0x9140('0x32')][_0x9140('0x1e')]);_0x2c255d['offset']=qs[_0x9140('0x1d')](_0x312748[_0x9140('0x32')][_0x9140('0x1d')]);}_0x2c255d['order']=qs[_0x9140('0x3b')](_0x312748[_0x9140('0x32')][_0x9140('0x3b')]);_0x2c255d[_0x9140('0x3c')]=qs[_0x9140('0x34')](_['pick'](_0x312748[_0x9140('0x32')],_0xb3ea29[_0x9140('0x34')]),_0x271bd4);if(_0x312748['query']['filter']){_0x2c255d[_0x9140('0x3c')]=_[_0x9140('0x3d')](_0x2c255d[_0x9140('0x3c')],{'$or':_[_0x9140('0x2c')](_0x271bd4,function(_0x598e4a){if(_0x598e4a[_0x9140('0x2f')]!=='VIRTUAL'){var _0x4bb777={};_0x4bb777[_0x598e4a[_0x9140('0x31')]]={'$like':'%'+_0x312748[_0x9140('0x32')][_0x9140('0x3e')]+'%'};return _0x4bb777;}})});}_0x2c255d=_['merge']({},_0x2c255d,_0x312748['options']);var _0x1f3a87={'where':_0x2c255d[_0x9140('0x3c')]};return db['SalesforceField']['count'](_0x1f3a87)['then'](function(_0x5f08b5){_0x1cd721[_0x9140('0x20')]=_0x5f08b5;if(_0x312748[_0x9140('0x32')]['includeAll']){_0x2c255d[_0x9140('0x3f')]=[{'all':!![]}];}return db[_0x9140('0x2d')][_0x9140('0x40')](_0x2c255d);})[_0x9140('0x26')](function(_0x292fd2){_0x1cd721['rows']=_0x292fd2;return _0x1cd721;})[_0x9140('0x26')](respondWithFilteredResult(_0x58b483,_0x2c255d))['catch'](handleError(_0x58b483,null));};exports[_0x9140('0x41')]=function(_0x2c7f31,_0x5e648b){var _0x572fcb={'raw':!![],'where':{'id':_0x2c7f31[_0x9140('0x42')]['id']}},_0xc13fad={};_0xc13fad[_0x9140('0x36')]=_[_0x9140('0x33')](db['SalesforceField'][_0x9140('0x2e')]);_0xc13fad['query']=_[_0x9140('0x33')](_0x2c7f31['query']);_0xc13fad[_0x9140('0x34')]=_[_0x9140('0x35')](_0xc13fad[_0x9140('0x36')],_0xc13fad[_0x9140('0x32')]);_0x572fcb[_0x9140('0x37')]=_['intersection'](_0xc13fad[_0x9140('0x36')],qs[_0x9140('0x43')](_0x2c7f31[_0x9140('0x32')][_0x9140('0x43')]));_0x572fcb['attributes']=_0x572fcb[_0x9140('0x37')][_0x9140('0x38')]?_0x572fcb[_0x9140('0x37')]:_0xc13fad[_0x9140('0x36')];if(_0x2c7f31[_0x9140('0x32')][_0x9140('0x44')]){_0x572fcb['include']=[{'all':!![]}];}_0x572fcb=_['merge']({},_0x572fcb,_0x2c7f31[_0x9140('0x45')]);return db[_0x9140('0x2d')][_0x9140('0x46')](_0x572fcb)[_0x9140('0x26')](handleEntityNotFound(_0x5e648b,null))[_0x9140('0x26')](respondWithResult(_0x5e648b,null))[_0x9140('0x47')](handleError(_0x5e648b,null));};exports['create']=function(_0x343b23,_0x5c116a){return db[_0x9140('0x2d')][_0x9140('0x48')](_0x343b23[_0x9140('0x49')],{})['then'](respondWithResult(_0x5c116a,0xc9))[_0x9140('0x47')](handleError(_0x5c116a,null));};exports[_0x9140('0x24')]=function(_0x32f6e8,_0x59ec8a){if(_0x32f6e8[_0x9140('0x49')]['id']){delete _0x32f6e8[_0x9140('0x49')]['id'];}return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x32f6e8['params']['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x59ec8a,null))[_0x9140('0x26')](saveUpdates(_0x32f6e8['body'],null))[_0x9140('0x26')](respondWithResult(_0x59ec8a,null))[_0x9140('0x47')](handleError(_0x59ec8a,null));};exports[_0x9140('0x25')]=function(_0x58793b,_0x334319){return db[_0x9140('0x2d')][_0x9140('0x46')]({'where':{'id':_0x58793b[_0x9140('0x42')]['id']}})[_0x9140('0x26')](handleEntityNotFound(_0x334319,null))[_0x9140('0x26')](removeEntity(_0x334319,null))[_0x9140('0x47')](handleError(_0x334319,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index e178d47..8587f52 100644 --- a/server/api/intSalesforceField/intSalesforceField.model.js +++ b/server/api/intSalesforceField/intSalesforceField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5f1=['rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','../../config/logger','request-promise'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc5f1,0x11d));var _0x1c5f=function(_0x275b89,_0x4ca760){_0x275b89=_0x275b89-0x0;var _0x254304=_0xc5f1[_0x275b89];return _0x254304;};'use strict';var _=require(_0x1c5f('0x0'));var util=require('util');var logger=require(_0x1c5f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c5f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c5f('0x3'));var config=require(_0x1c5f('0x4'));var attributes=require(_0x1c5f('0x5'));module[_0x1c5f('0x6')]=function(_0x34dd0f,_0x616b76){return _0x34dd0f[_0x1c5f('0x7')](_0x1c5f('0x8'),attributes,{'tableName':_0x1c5f('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1c5f('0xa'),_0x1c5f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd5=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceField.attributes','exports','SalesforceField','salesforce_unique_index','idField'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x9dd5,0xfd));var _0x59dd=function(_0x27375c,_0x1ca28b){_0x27375c=_0x27375c-0x0;var _0xcc628c=_0x9dd5[_0x27375c];return _0xcc628c;};'use strict';var _=require(_0x59dd('0x0'));var util=require('util');var logger=require(_0x59dd('0x1'))(_0x59dd('0x2'));var moment=require(_0x59dd('0x3'));var BPromise=require(_0x59dd('0x4'));var rp=require(_0x59dd('0x5'));var fs=require('fs');var path=require(_0x59dd('0x6'));var rimraf=require(_0x59dd('0x7'));var config=require('../../config/environment');var attributes=require(_0x59dd('0x8'));module[_0x59dd('0x9')]=function(_0x2758e5,_0x4b2bde){return _0x2758e5['define'](_0x59dd('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x59dd('0xb'),'fields':[_0x59dd('0xc'),_0x59dd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 130c0a3..36e841d 100644 --- a/server/api/intSalesforceField/intSalesforceField.rpc.js +++ b/server/api/intSalesforceField/intSalesforceField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d9f=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x50a463,_0x517a1a){var _0x2971df=function(_0x1f9cf1){while(--_0x1f9cf1){_0x50a463['push'](_0x50a463['shift']());}};_0x2971df(++_0x517a1a);}(_0x8d9f,0x16f));var _0xf8d9=function(_0x532577,_0x22e2fe){_0x532577=_0x532577-0x0;var _0x5fdc7e=_0x8d9f[_0x532577];return _0x5fdc7e;};'use strict';var _=require(_0xf8d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf8d9('0x1'));var fs=require('fs');var Redis=require(_0xf8d9('0x2'));var db=require(_0xf8d9('0x3'))['db'];var utils=require(_0xf8d9('0x4'));var logger=require(_0xf8d9('0x5'))(_0xf8d9('0x6'));var config=require('../../config/environment');var jayson=require(_0xf8d9('0x7'));var client=jayson[_0xf8d9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1565,_0xc9e3bc,_0x4bf38d){return new BPromise(function(_0x4c7171,_0x5d7043){return client['request'](_0x2d1565,_0x4bf38d)[_0xf8d9('0x9')](function(_0xaf4ce){logger[_0xf8d9('0xa')](_0xf8d9('0xb'),_0xc9e3bc,'request\x20sent');logger[_0xf8d9('0xc')](_0xf8d9('0xd'),_0xc9e3bc,_0xf8d9('0xe'),JSON[_0xf8d9('0xf')](_0xaf4ce));if(_0xaf4ce[_0xf8d9('0x10')]){if(_0xaf4ce[_0xf8d9('0x10')]['code']===0x1f4){logger[_0xf8d9('0x10')]('SalesforceField,\x20%s,\x20%s',_0xc9e3bc,_0xaf4ce['error'][_0xf8d9('0x11')]);return _0x5d7043(_0xaf4ce['error'][_0xf8d9('0x11')]);}logger[_0xf8d9('0x10')](_0xf8d9('0xb'),_0xc9e3bc,_0xaf4ce[_0xf8d9('0x10')][_0xf8d9('0x11')]);return _0x4c7171(_0xaf4ce[_0xf8d9('0x10')][_0xf8d9('0x11')]);}else{logger[_0xf8d9('0xa')](_0xf8d9('0xb'),_0xc9e3bc,_0xf8d9('0xe'));_0x4c7171(_0xaf4ce['result']['message']);}})[_0xf8d9('0x12')](function(_0x1ecfae){logger[_0xf8d9('0x10')](_0xf8d9('0xb'),_0xc9e3bc,_0x1ecfae);_0x5d7043(_0x1ecfae);});});} \ No newline at end of file +var _0xa22c=['request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0xcfea9,_0x29da8e){var _0x46e527=function(_0x362977){while(--_0x362977){_0xcfea9['push'](_0xcfea9['shift']());}};_0x46e527(++_0x29da8e);}(_0xa22c,0x6b));var _0xca22=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa22c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xca22('0x0'));var util=require(_0xca22('0x1'));var moment=require(_0xca22('0x2'));var BPromise=require('bluebird');var rs=require(_0xca22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca22('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xca22('0x5'));var config=require(_0xca22('0x6'));var jayson=require(_0xca22('0x7'));var client=jayson[_0xca22('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8016,_0x1947ba,_0x478a3a){return new BPromise(function(_0x4f2376,_0x817976){return client[_0xca22('0x9')](_0x2d8016,_0x478a3a)[_0xca22('0xa')](function(_0x10a5ce){logger[_0xca22('0xb')](_0xca22('0xc'),_0x1947ba,_0xca22('0xd'));logger['debug'](_0xca22('0xe'),_0x1947ba,_0xca22('0xd'),JSON[_0xca22('0xf')](_0x10a5ce));if(_0x10a5ce[_0xca22('0x10')]){if(_0x10a5ce[_0xca22('0x10')]['code']===0x1f4){logger['error'](_0xca22('0xc'),_0x1947ba,_0x10a5ce[_0xca22('0x10')][_0xca22('0x11')]);return _0x817976(_0x10a5ce[_0xca22('0x10')][_0xca22('0x11')]);}logger['error'](_0xca22('0xc'),_0x1947ba,_0x10a5ce[_0xca22('0x10')]['message']);return _0x4f2376(_0x10a5ce['error']['message']);}else{logger[_0xca22('0xb')](_0xca22('0xc'),_0x1947ba,_0xca22('0xd'));_0x4f2376(_0x10a5ce[_0xca22('0x12')][_0xca22('0x11')]);}})[_0xca22('0x13')](function(_0x311bcc){logger['error'](_0xca22('0xc'),_0x1947ba,_0x311bcc);_0x817976(_0x311bcc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1cabcf2..d69a26b 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a63=['express','fs-extra','./intServicenowAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','util','connect-timeout'];(function(_0xaced19,_0x4fa58f){var _0x352cda=function(_0x26e45f){while(--_0x26e45f){_0xaced19['push'](_0xaced19['shift']());}};_0x352cda(++_0x4fa58f);}(_0x7a63,0xfa));var _0x37a6=function(_0x5043e2,_0x9547b0){_0x5043e2=_0x5043e2-0x0;var _0xdd7961=_0x7a63[_0x5043e2];return _0xdd7961;};'use strict';var multer=require('multer');var util=require(_0x37a6('0x0'));var path=require('path');var timeout=require(_0x37a6('0x1'));var express=require(_0x37a6('0x2'));var router=express['Router']();var fs_extra=require(_0x37a6('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x37a6('0x4'));router['get']('/',auth[_0x37a6('0x5')](),controller['index']);router['get'](_0x37a6('0x6'),auth[_0x37a6('0x5')](),controller[_0x37a6('0x7')]);router[_0x37a6('0x8')](_0x37a6('0x9'),auth[_0x37a6('0x5')](),controller[_0x37a6('0xa')]);router[_0x37a6('0x8')](_0x37a6('0xb'),auth[_0x37a6('0x5')](),controller[_0x37a6('0xc')]);router[_0x37a6('0xd')]('/',auth[_0x37a6('0x5')](),controller[_0x37a6('0xe')]);router[_0x37a6('0xd')](_0x37a6('0x9'),auth[_0x37a6('0x5')](),controller['addConfiguration']);router[_0x37a6('0xf')](_0x37a6('0x6'),auth[_0x37a6('0x5')](),controller[_0x37a6('0x10')]);router[_0x37a6('0x11')]('/:id',auth[_0x37a6('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7510=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','isAuthenticated','create','addConfiguration','put'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x7510,0x18a));var _0x0751=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7510[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0751('0x0'));var path=require(_0x0751('0x1'));var timeout=require(_0x0751('0x2'));var express=require(_0x0751('0x3'));var router=express[_0x0751('0x4')]();var fs_extra=require(_0x0751('0x5'));var auth=require(_0x0751('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0751('0x7'));var controller=require(_0x0751('0x8'));router[_0x0751('0x9')]('/',auth['isAuthenticated'](),controller[_0x0751('0xa')]);router[_0x0751('0x9')](_0x0751('0xb'),auth['isAuthenticated'](),controller[_0x0751('0xc')]);router['get'](_0x0751('0xd'),auth['isAuthenticated'](),controller[_0x0751('0xe')]);router[_0x0751('0x9')](_0x0751('0xf'),auth['isAuthenticated'](),controller[_0x0751('0x10')]);router[_0x0751('0x11')]('/',auth[_0x0751('0x12')](),controller[_0x0751('0x13')]);router[_0x0751('0x11')](_0x0751('0xd'),auth['isAuthenticated'](),controller[_0x0751('0x14')]);router[_0x0751('0x15')](_0x0751('0xb'),auth[_0x0751('0x12')](),controller[_0x0751('0x16')]);router[_0x0751('0x17')](_0x0751('0xb'),auth[_0x0751('0x12')](),controller[_0x0751('0x18')]);module[_0x0751('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e02c48b..03e2a0f 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ba5=['username','sequelize','STRING'];(function(_0x309834,_0x22659a){var _0x528398=function(_0x2e0cbb){while(--_0x2e0cbb){_0x309834['push'](_0x309834['shift']());}};_0x528398(++_0x22659a);}(_0x1ba5,0xfd));var _0x51ba=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1ba5[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x51ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x51ba('0x1')]},'description':{'type':Sequelize[_0x51ba('0x1')]},'username':{'type':Sequelize[_0x51ba('0x1')],'unique':_0x51ba('0x2')},'password':{'type':Sequelize[_0x51ba('0x1')]},'email':{'type':Sequelize[_0x51ba('0x1')]},'remoteUri':{'type':Sequelize[_0x51ba('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x51ba('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x738f=['STRING','remoteUri','sequelize','exports'];(function(_0x43530c,_0x29adb4){var _0x6391b0=function(_0x182612){while(--_0x182612){_0x43530c['push'](_0x43530c['shift']());}};_0x6391b0(++_0x29adb4);}(_0x738f,0xfe));var _0xf738=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0x738f[_0x36cff7];return _0x21c697;};'use strict';var Sequelize=require(_0xf738('0x0'));module[_0xf738('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf738('0x2')]},'username':{'type':Sequelize[_0xf738('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xf738('0x2')]},'email':{'type':Sequelize[_0xf738('0x2')]},'remoteUri':{'type':Sequelize[_0xf738('0x2')],'unique':_0xf738('0x3')},'serverUrl':{'type':Sequelize[_0xf738('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 338b90d..dfcfdde 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec47=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','filter','merge','options','ServicenowAccount','includeAll','include','catch','show','params','length','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','business_duration','group_list','resolved_at','caller_id','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','includes','forEach','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','True','false','GET','inactive','value','eml-format','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26fec8,_0x7899c){var _0x2f05f3=function(_0x1c2fc1){while(--_0x1c2fc1){_0x26fec8['push'](_0x26fec8['shift']());}};_0x2f05f3(++_0x7899c);}(_0xec47,0x15d));var _0x7ec4=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xec47[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x7ec4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ec4('0x1'));var moment=require(_0x7ec4('0x2'));var BPromise=require(_0x7ec4('0x3'));var Mustache=require(_0x7ec4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x7ec4('0x5'));var csv=require(_0x7ec4('0x6'));var ejs=require(_0x7ec4('0x7'));var fs=require('fs');var fs_extra=require(_0x7ec4('0x8'));var _=require(_0x7ec4('0x9'));var squel=require(_0x7ec4('0xa'));var crypto=require(_0x7ec4('0xb'));var jsforce=require(_0x7ec4('0xc'));var deskjs=require(_0x7ec4('0xd'));var toCsv=require(_0x7ec4('0x6'));var querystring=require(_0x7ec4('0xe'));var Papa=require(_0x7ec4('0xf'));var Redis=require(_0x7ec4('0x10'));var authService=require(_0x7ec4('0x11'));var qs=require(_0x7ec4('0x12'));var as=require(_0x7ec4('0x13'));var hardwareService=require(_0x7ec4('0x14'));var logger=require('../../config/logger')(_0x7ec4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7ec4('0x16'))['db'];var integrations=require(_0x7ec4('0x17'));function respondWithStatusCode(_0x34e634,_0x380427){_0x380427=_0x380427||0xcc;return function(_0x5754be){if(_0x5754be){return _0x34e634[_0x7ec4('0x18')](_0x380427);}return _0x34e634[_0x7ec4('0x19')](_0x380427)[_0x7ec4('0x1a')]();};}function respondWithResult(_0x44de42,_0xe25be4){_0xe25be4=_0xe25be4||0xc8;return function(_0x527255){if(_0x527255){return _0x44de42[_0x7ec4('0x19')](_0xe25be4)[_0x7ec4('0x1b')](_0x527255);}};}function respondWithFilteredResult(_0xfdb7d3,_0x6d6bf8){return function(_0x46651c){if(_0x46651c){var _0xb90279=typeof _0x6d6bf8['offset']===_0x7ec4('0x1c')&&typeof _0x6d6bf8[_0x7ec4('0x1d')]==='undefined';var _0x3a3524=_0x46651c[_0x7ec4('0x1e')];var _0x2e60a7=_0xb90279?0x0:_0x6d6bf8[_0x7ec4('0x1f')];var _0x1d0094=_0xb90279?_0x46651c[_0x7ec4('0x1e')]:_0x6d6bf8[_0x7ec4('0x1f')]+_0x6d6bf8[_0x7ec4('0x1d')];var _0x5904f8;if(_0x1d0094>=_0x3a3524){_0x1d0094=_0x3a3524;_0x5904f8=0xc8;}else{_0x5904f8=0xce;}_0xfdb7d3[_0x7ec4('0x19')](_0x5904f8);return _0xfdb7d3[_0x7ec4('0x20')](_0x7ec4('0x21'),_0x2e60a7+'-'+_0x1d0094+'/'+_0x3a3524)[_0x7ec4('0x1b')](_0x46651c);}return null;};}function patchUpdates(_0x2b8420){return function(_0x5044c6){try{jsonpatch['apply'](_0x5044c6,_0x2b8420,!![]);}catch(_0x53b58a){return BPromise[_0x7ec4('0x22')](_0x53b58a);}return _0x5044c6[_0x7ec4('0x23')]();};}function saveUpdates(_0x52ff03,_0x1bc42d){return function(_0x4b5b1a){if(_0x4b5b1a){return _0x4b5b1a[_0x7ec4('0x24')](_0x52ff03)[_0x7ec4('0x25')](function(_0x82f025){return _0x82f025;});}return null;};}function removeEntity(_0x5f3e14,_0x2a4f58){return function(_0x5864e3){if(_0x5864e3){return _0x5864e3['destroy']()[_0x7ec4('0x25')](function(){_0x5f3e14['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e02e,_0x40b1e3){return function(_0x4d9eb8){if(!_0x4d9eb8){_0x14e02e[_0x7ec4('0x18')](0x194);}return _0x4d9eb8;};}function handleError(_0x124902,_0x338e1a){_0x338e1a=_0x338e1a||0x1f4;return function(_0x288c3a){logger[_0x7ec4('0x26')](_0x288c3a['stack']);if(_0x288c3a['name']){delete _0x288c3a[_0x7ec4('0x27')];}_0x124902[_0x7ec4('0x19')](_0x338e1a)[_0x7ec4('0x28')](_0x288c3a);};}exports['index']=function(_0xfcd3e2,_0x5cfae5){var _0x15afba={},_0x14a30a={},_0x37da23={'count':0x0,'rows':[]};var _0x8dea82=_[_0x7ec4('0x29')](db['ServicenowAccount'][_0x7ec4('0x2a')],function(_0x55c1d9){return{'name':_0x55c1d9[_0x7ec4('0x2b')],'type':_0x55c1d9[_0x7ec4('0x2c')][_0x7ec4('0x2d')]};});_0x14a30a[_0x7ec4('0x2e')]=_[_0x7ec4('0x29')](_0x8dea82,'name');_0x14a30a['query']=_[_0x7ec4('0x2f')](_0xfcd3e2['query']);_0x14a30a[_0x7ec4('0x30')]=_[_0x7ec4('0x31')](_0x14a30a[_0x7ec4('0x2e')],_0x14a30a[_0x7ec4('0x32')]);_0x15afba[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0x14a30a[_0x7ec4('0x2e')],qs[_0x7ec4('0x34')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x34')]));_0x15afba[_0x7ec4('0x33')]=_0x15afba[_0x7ec4('0x33')]['length']?_0x15afba[_0x7ec4('0x33')]:_0x14a30a[_0x7ec4('0x2e')];if(!_0xfcd3e2[_0x7ec4('0x32')]['hasOwnProperty'](_0x7ec4('0x35'))){_0x15afba[_0x7ec4('0x1d')]=qs[_0x7ec4('0x1d')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x1d')]);_0x15afba[_0x7ec4('0x1f')]=qs[_0x7ec4('0x1f')](_0xfcd3e2[_0x7ec4('0x32')]['offset']);}_0x15afba[_0x7ec4('0x36')]=qs[_0x7ec4('0x37')](_0xfcd3e2[_0x7ec4('0x32')][_0x7ec4('0x37')]);_0x15afba[_0x7ec4('0x38')]=qs['filters'](_['pick'](_0xfcd3e2[_0x7ec4('0x32')],_0x14a30a[_0x7ec4('0x30')]),_0x8dea82);if(_0xfcd3e2['query'][_0x7ec4('0x39')]){_0x15afba[_0x7ec4('0x38')]=_['merge'](_0x15afba[_0x7ec4('0x38')],{'$or':_[_0x7ec4('0x29')](_0x8dea82,function(_0x24937a){if(_0x24937a['type']!=='VIRTUAL'){var _0x591989={};_0x591989[_0x24937a[_0x7ec4('0x27')]]={'$like':'%'+_0xfcd3e2[_0x7ec4('0x32')]['filter']+'%'};return _0x591989;}})});}_0x15afba=_[_0x7ec4('0x3a')]({},_0x15afba,_0xfcd3e2[_0x7ec4('0x3b')]);var _0x4602b9={'where':_0x15afba[_0x7ec4('0x38')]};return db[_0x7ec4('0x3c')][_0x7ec4('0x1e')](_0x4602b9)[_0x7ec4('0x25')](function(_0x436010){_0x37da23['count']=_0x436010;if(_0xfcd3e2['query'][_0x7ec4('0x3d')]){_0x15afba[_0x7ec4('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x15afba);})['then'](function(_0x1ef2c8){_0x37da23['rows']=_0x1ef2c8;return _0x37da23;})[_0x7ec4('0x25')](respondWithFilteredResult(_0x5cfae5,_0x15afba))[_0x7ec4('0x3f')](handleError(_0x5cfae5,null));};exports[_0x7ec4('0x40')]=function(_0x551212,_0x578ae5){var _0xcb823f={'raw':![],'where':{'id':_0x551212[_0x7ec4('0x41')]['id']}},_0xa6cfc6={};_0xa6cfc6[_0x7ec4('0x2e')]=_[_0x7ec4('0x2f')](db[_0x7ec4('0x3c')]['rawAttributes']);_0xa6cfc6[_0x7ec4('0x32')]=_[_0x7ec4('0x2f')](_0x551212['query']);_0xa6cfc6['filters']=_[_0x7ec4('0x31')](_0xa6cfc6[_0x7ec4('0x2e')],_0xa6cfc6[_0x7ec4('0x32')]);_0xcb823f[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0xa6cfc6[_0x7ec4('0x2e')],qs[_0x7ec4('0x34')](_0x551212[_0x7ec4('0x32')]['fields']));_0xcb823f[_0x7ec4('0x33')]=_0xcb823f[_0x7ec4('0x33')][_0x7ec4('0x42')]?_0xcb823f[_0x7ec4('0x33')]:_0xa6cfc6['model'];if(_0x551212[_0x7ec4('0x32')]['includeAll']){_0xcb823f[_0x7ec4('0x3e')]=[{'all':!![]}];}_0xcb823f=_['merge']({},_0xcb823f,_0x551212[_0x7ec4('0x3b')]);return db[_0x7ec4('0x3c')][_0x7ec4('0x43')](_0xcb823f)[_0x7ec4('0x25')](handleEntityNotFound(_0x578ae5,null))[_0x7ec4('0x25')](respondWithResult(_0x578ae5,null))[_0x7ec4('0x3f')](handleError(_0x578ae5,null));};exports['create']=function(_0x53d30a,_0x4f9758){return db['ServicenowAccount'][_0x7ec4('0x44')](_0x53d30a[_0x7ec4('0x45')],{})[_0x7ec4('0x25')](respondWithResult(_0x4f9758,0xc9))[_0x7ec4('0x3f')](handleError(_0x4f9758,null));};exports[_0x7ec4('0x24')]=function(_0x598ef4,_0x3b36fb){if(_0x598ef4[_0x7ec4('0x45')]['id']){delete _0x598ef4[_0x7ec4('0x45')]['id'];}return db[_0x7ec4('0x3c')][_0x7ec4('0x43')]({'where':{'id':_0x598ef4[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x3b36fb,null))['then'](saveUpdates(_0x598ef4[_0x7ec4('0x45')],null))[_0x7ec4('0x25')](respondWithResult(_0x3b36fb,null))[_0x7ec4('0x3f')](handleError(_0x3b36fb,null));};exports[_0x7ec4('0x46')]=function(_0x31d6d5,_0x34fe9e){return db['ServicenowAccount']['find']({'where':{'id':_0x31d6d5['params']['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x34fe9e,null))[_0x7ec4('0x25')](removeEntity(_0x34fe9e,null))['catch'](handleError(_0x34fe9e,null));};exports[_0x7ec4('0x47')]=function(_0x1d9da0,_0x1a85b5,_0x7cec5c){var _0x2e046a={};var _0x5c89fa={};var _0x5bd4d3;var _0x543e16;return db[_0x7ec4('0x3c')][_0x7ec4('0x48')]({'where':{'id':_0x1d9da0[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x1a85b5,null))['then'](function(_0x595188){if(_0x595188){_0x5bd4d3=_0x595188;_0x5c89fa[_0x7ec4('0x2e')]=_[_0x7ec4('0x2f')](db[_0x7ec4('0x49')][_0x7ec4('0x2a')]);_0x5c89fa['query']=_[_0x7ec4('0x2f')](_0x1d9da0[_0x7ec4('0x32')]);_0x5c89fa['filters']=_[_0x7ec4('0x31')](_0x5c89fa[_0x7ec4('0x2e')],_0x5c89fa['query']);_0x2e046a[_0x7ec4('0x33')]=_[_0x7ec4('0x31')](_0x5c89fa['model'],qs[_0x7ec4('0x34')](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x34')]));_0x2e046a[_0x7ec4('0x33')]=_0x2e046a[_0x7ec4('0x33')]['length']?_0x2e046a[_0x7ec4('0x33')]:_0x5c89fa[_0x7ec4('0x2e')];_0x2e046a[_0x7ec4('0x36')]=qs['sort'](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x37')]);_0x2e046a[_0x7ec4('0x38')]=qs[_0x7ec4('0x30')](_[_0x7ec4('0x4a')](_0x1d9da0[_0x7ec4('0x32')],_0x5c89fa[_0x7ec4('0x30')]));if(_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x39')]){_0x2e046a[_0x7ec4('0x38')]=_[_0x7ec4('0x3a')](_0x2e046a[_0x7ec4('0x38')],{'$or':_[_0x7ec4('0x29')](_0x2e046a['attributes'],function(_0x461995){var _0x2c90a1={};_0x2c90a1[_0x461995]={'$like':'%'+_0x1d9da0['query'][_0x7ec4('0x39')]+'%'};return _0x2c90a1;})});}_0x2e046a=_[_0x7ec4('0x3a')]({},_0x2e046a,_0x1d9da0['options']);return _0x5bd4d3[_0x7ec4('0x47')](_0x2e046a);}})[_0x7ec4('0x25')](function(_0x154a9d){if(_0x154a9d){_0x543e16=_0x154a9d[_0x7ec4('0x42')];if(!_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x4b')](_0x7ec4('0x35'))){_0x2e046a[_0x7ec4('0x1d')]=qs['limit'](_0x1d9da0[_0x7ec4('0x32')]['limit']);_0x2e046a['offset']=qs[_0x7ec4('0x1f')](_0x1d9da0[_0x7ec4('0x32')][_0x7ec4('0x1f')]);}return _0x5bd4d3[_0x7ec4('0x47')](_0x2e046a);}})[_0x7ec4('0x25')](function(_0x3a60cd){if(_0x3a60cd){return _0x3a60cd?{'count':_0x543e16,'rows':_0x3a60cd}:null;}})[_0x7ec4('0x25')](respondWithResult(_0x1a85b5,null))['catch'](handleError(_0x1a85b5,null));};exports[_0x7ec4('0x4c')]=function(_0x3b6d1d,_0x4388ae,_0x6c22c5){if(_0x3b6d1d[_0x7ec4('0x45')]['id']){delete _0x3b6d1d['body']['id'];}return db[_0x7ec4('0x3c')]['findOne']({'where':{'id':_0x3b6d1d[_0x7ec4('0x41')]['id']}})[_0x7ec4('0x25')](handleEntityNotFound(_0x4388ae,null))[_0x7ec4('0x25')](function(_0x2da46e){if(_0x2da46e){_0x3b6d1d[_0x7ec4('0x45')]['AccountId']=_0x2da46e['id'];_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x4d')]=integrations[_0x7ec4('0x4e')](_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x4f')],_0x3b6d1d['body']['type']);_0x3b6d1d[_0x7ec4('0x45')][_0x7ec4('0x50')]=integrations[_0x7ec4('0x51')](_0x3b6d1d[_0x7ec4('0x45')]['channel'],_0x3b6d1d[_0x7ec4('0x45')]['type']);return db[_0x7ec4('0x49')]['create'](_0x3b6d1d[_0x7ec4('0x45')],{'include':[{'model':db[_0x7ec4('0x52')],'as':_0x7ec4('0x4d')},{'model':db[_0x7ec4('0x52')],'as':_0x7ec4('0x50')}]});}return null;})[_0x7ec4('0x25')](respondWithResult(_0x4388ae,null))[_0x7ec4('0x3f')](handleError(_0x4388ae,null));};exports['getFields']=function(_0x587604,_0x358f1c,_0x171fcc){var _0x45b1ee=[_0x7ec4('0x53'),_0x7ec4('0x54'),_0x7ec4('0x55'),'subcategory',_0x7ec4('0x56'),_0x7ec4('0x57'),'incident_state',_0x7ec4('0x58'),_0x7ec4('0x59')];var _0x575d26=['parent',_0x7ec4('0x53'),_0x7ec4('0x5a'),_0x7ec4('0x5b'),_0x7ec4('0x5c'),_0x7ec4('0x5d'),_0x7ec4('0x5e'),_0x7ec4('0x54'),_0x7ec4('0x5f'),_0x7ec4('0x60'),_0x7ec4('0x61'),_0x7ec4('0x62'),_0x7ec4('0x63'),'user_input',_0x7ec4('0x64'),_0x7ec4('0x65'),_0x7ec4('0x66'),_0x7ec4('0x67'),_0x7ec4('0x55'),'order',_0x7ec4('0x68'),_0x7ec4('0x69'),_0x7ec4('0x6a'),_0x7ec4('0x6b'),_0x7ec4('0x6c'),_0x7ec4('0x6d'),_0x7ec4('0x6e'),'business_service','priority',_0x7ec4('0x6f'),_0x7ec4('0x70'),_0x7ec4('0x71'),'expected_start','opened_at',_0x7ec4('0x72'),_0x7ec4('0x73'),'work_end','reopened_time',_0x7ec4('0x74'),_0x7ec4('0x75'),_0x7ec4('0x76'),'subcategory','work_notes',_0x7ec4('0x77'),'close_code',_0x7ec4('0x78'),_0x7ec4('0x79'),_0x7ec4('0x7a'),_0x7ec4('0x7b'),'business_stc','additional_assignee_list',_0x7ec4('0x7c'),_0x7ec4('0x7d'),_0x7ec4('0x57'),_0x7ec4('0x7e'),_0x7ec4('0x7f'),'closed_by',_0x7ec4('0x80'),_0x7ec4('0x81'),_0x7ec4('0x82'),_0x7ec4('0x83'),'reopened_by','incident_state',_0x7ec4('0x84'),_0x7ec4('0x85'),_0x7ec4('0x86'),_0x7ec4('0x87'),_0x7ec4('0x88'),_0x7ec4('0x89'),'severity',_0x7ec4('0x8a'),_0x7ec4('0x8b'),_0x7ec4('0x8c'),_0x7ec4('0x8d'),'due_date',_0x7ec4('0x8e'),_0x7ec4('0x8f'),_0x7ec4('0x90'),_0x7ec4('0x91'),_0x7ec4('0x92'),_0x7ec4('0x93'),_0x7ec4('0x94'),_0x7ec4('0x59')];var _0x264ffb='';var _0x2722be='';var _0x42bb99=[];var _0x5deeb9='';var _0x372c2d='';var _0x405fdb=[];var _0x442ba0='';var _0x40055a='';var _0x4b6805={};var _0x36366f='';return db[_0x7ec4('0x3c')]['findOne']({'where':{'id':_0x587604[_0x7ec4('0x41')]['id']},'attributes':['id',_0x7ec4('0x95'),'password',_0x7ec4('0x96'),'remoteUri',_0x7ec4('0x97')]})['then'](handleEntityNotFound(_0x358f1c,null))[_0x7ec4('0x25')](function(_0x53f7df){if(_0x53f7df){_0x36366f=_0x53f7df[_0x7ec4('0x98')];var _0x471f8f=_0x36366f[_0x7ec4('0x99')](-0x1);if(_0x471f8f==='/'){_0x36366f=_0x36366f[_0x7ec4('0x9a')](0x0,_0x36366f[_0x7ec4('0x9b')](_0x471f8f));}_0x40055a=util[_0x7ec4('0x9c')](_0x7ec4('0x9d'),_0x36366f);_0x442ba0=util[_0x7ec4('0x9c')](_0x7ec4('0x9e'),_0x36366f);_0x4b6805={'user':_0x53f7df[_0x7ec4('0x95')],'pass':_0x53f7df[_0x7ec4('0x9f')]};var _0x3e3b0a={'method':'GET','uri':_0x40055a+_0x7ec4('0xa0'),'auth':_0x4b6805,'json':!![]};return rp(_0x3e3b0a);}})['then'](function(_0x5cb4c0){if(_0x5cb4c0[_0x7ec4('0xa1')]['length']>0x0){_0x264ffb=_0x5cb4c0['result'];}console[_0x7ec4('0xa2')](_0x7ec4('0xa3'),_0x264ffb);_0x405fdb=[];_0x2722be=Object['assign']([],_0x264ffb);_['remove'](_0x2722be,function(_0x1624ab){return!_0x45b1ee[_0x7ec4('0xa4')](_0x1624ab[_0x7ec4('0x27')]);});_0x2722be[_0x7ec4('0xa5')](function(_0x269e40){var _0x4cc738=createFieldObject(_0x442ba0,_0x4b6805,_0x269e40['internalType'],_0x269e40[_0x7ec4('0x27')],_0x269e40[_0x7ec4('0xa6')],![]);_0x405fdb[_0x7ec4('0xa7')](_0x4cc738);});return Promise[_0x7ec4('0xa8')](_0x405fdb);})['then'](function(_0x324e93){_0x42bb99=_0x324e93;_0x5deeb9=Object[_0x7ec4('0xa9')]([],_0x264ffb);console['log'](_0x7ec4('0xaa'),_0x264ffb);_['remove'](_0x5deeb9,function(_0x44b8be){return _0x575d26[_0x7ec4('0xa4')](_0x44b8be[_0x7ec4('0x27')]);});console[_0x7ec4('0xa2')](_0x7ec4('0xab'),_0x5deeb9);_0x405fdb=[];_0x5deeb9[_0x7ec4('0xa5')](function(_0x5cc278){var _0x26e513=createFieldObject(_0x442ba0,_0x4b6805,_0x5cc278['internalType'],_0x5cc278['name'],_0x5cc278['label'],!![]);_0x405fdb[_0x7ec4('0xa7')](_0x26e513);});return Promise[_0x7ec4('0xa8')](_0x405fdb);})[_0x7ec4('0x25')](function(_0x757f4c){_0x372c2d=_0x757f4c;var _0x1fa6f0=_0x42bb99[_0x7ec4('0xac')](_0x372c2d);return{'count':_0x1fa6f0[_0x7ec4('0x42')],'rows':_0x1fa6f0};})['then'](respondWithResult(_0x358f1c,null))['catch'](function(_0x3ea4e6){console[_0x7ec4('0xa2')](_0x7ec4('0xad')+_0x3ea4e6);var _0x44b68a=_0x587604[_0x7ec4('0x32')][_0x7ec4('0xae')]?0x1f4:_0x3ea4e6[_0x7ec4('0xaf')]||0x1f4;logger['error'](_0x3ea4e6[_0x7ec4('0xb0')]);delete _0x3ea4e6[_0x7ec4('0x27')];if(_0x44b68a===0x191){_0x44b68a=0x190;}_0x358f1c['status'](_0x44b68a)[_0x7ec4('0x28')](_0x587604[_0x7ec4('0x32')][_0x7ec4('0xae')]?{'message':_0x7ec4('0xb1'),'statusCode':_0x3ea4e6[_0x7ec4('0xaf')]}:_0x3ea4e6);});};function createFieldObject(_0x381dd1,_0x4b18b2,_0x3ee873,_0x2bef6b,_0x4ea6f0,_0x1831c3){return new Promise(function(_0x3a911b,_0xed4c84){var _0x29d3e3={'id':_0x2bef6b,'name':_0x4ea6f0,'custom':_0x1831c3};if(_0x3ee873==='boolean'){_0x29d3e3['options']=[{'name':_0x7ec4('0xb2'),'value':'true'},{'name':'False','value':_0x7ec4('0xb3')}];_0x3a911b(_0x29d3e3);}else{var _0x1bf95e={'method':_0x7ec4('0xb4'),'uri':_0x381dd1+'sys_choice?sysparm_query=name=incident^element='+_0x2bef6b,'auth':_0x4b18b2,'json':!![]};return rp(_0x1bf95e)[_0x7ec4('0x25')](function(_0x568806){var _0xd5a229=[];if(_0x568806['result'][_0x7ec4('0x42')]>0x0){_0x568806['result'][_0x7ec4('0xa5')](function(_0x56857a){if(_0x56857a[_0x7ec4('0xb5')]===_0x7ec4('0xb3')){var _0x32f106={'name':_0x56857a[_0x7ec4('0xa6')],'value':_0x56857a[_0x7ec4('0xb6')]};_0xd5a229[_0x7ec4('0xa7')](_0x32f106);}});}_0x29d3e3[_0x7ec4('0x3b')]=_0xd5a229;if(_0x29d3e3[_0x7ec4('0x3b')]['length']>0x0){_0x3a911b(_0x29d3e3);}else{if(_0x1831c3==![]){_0x3a911b();}else{_0x3a911b(_0x29d3e3);}}});}});} \ No newline at end of file +var _0x69fc=['catch','show','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','sys_updated_by','opened_by','sys_domain','state','knowledge','order','calendar_stc','closed_at','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','correlation_display','work_start','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','company','reassignment_count','activity_due','assigned_to','sla_due','comments_and_work_notes','sys_mod_count','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x2be402,_0x52402c){var _0x198580=function(_0x1d9a93){while(--_0x1d9a93){_0x2be402['push'](_0x2be402['shift']());}};_0x198580(++_0x52402c);}(_0x69fc,0x1c7));var _0xc69f=function(_0x3f4770,_0xa5714e){_0x3f4770=_0x3f4770-0x0;var _0x373b9a=_0x69fc[_0x3f4770];return _0x373b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc69f('0x0'));var zipdir=require(_0xc69f('0x1'));var jsonpatch=require(_0xc69f('0x2'));var rp=require(_0xc69f('0x3'));var moment=require(_0xc69f('0x4'));var BPromise=require(_0xc69f('0x5'));var Mustache=require(_0xc69f('0x6'));var util=require(_0xc69f('0x7'));var path=require(_0xc69f('0x8'));var sox=require('sox');var csv=require(_0xc69f('0x9'));var ejs=require(_0xc69f('0xa'));var fs=require('fs');var fs_extra=require(_0xc69f('0xb'));var _=require(_0xc69f('0xc'));var squel=require(_0xc69f('0xd'));var crypto=require(_0xc69f('0xe'));var jsforce=require(_0xc69f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc69f('0x9'));var querystring=require(_0xc69f('0x10'));var Papa=require(_0xc69f('0x11'));var Redis=require(_0xc69f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc69f('0x13'));var as=require(_0xc69f('0x14'));var hardwareService=require(_0xc69f('0x15'));var logger=require(_0xc69f('0x16'))(_0xc69f('0x17'));var utils=require('../../config/utils');var config=require(_0xc69f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3b9367,_0x3b45df){_0x3b45df=_0x3b45df||0xcc;return function(_0x3315f2){if(_0x3315f2){return _0x3b9367[_0xc69f('0x19')](_0x3b45df);}return _0x3b9367[_0xc69f('0x1a')](_0x3b45df)['end']();};}function respondWithResult(_0x391620,_0x228509){_0x228509=_0x228509||0xc8;return function(_0x3b1b5b){if(_0x3b1b5b){return _0x391620[_0xc69f('0x1a')](_0x228509)[_0xc69f('0x1b')](_0x3b1b5b);}};}function respondWithFilteredResult(_0x4168b2,_0x5509a1){return function(_0x4bc5a7){if(_0x4bc5a7){var _0x4d930e=typeof _0x5509a1[_0xc69f('0x1c')]===_0xc69f('0x1d')&&typeof _0x5509a1[_0xc69f('0x1e')]===_0xc69f('0x1d');var _0x176c38=_0x4bc5a7['count'];var _0x564299=_0x4d930e?0x0:_0x5509a1[_0xc69f('0x1c')];var _0x2c57f1=_0x4d930e?_0x4bc5a7[_0xc69f('0x1f')]:_0x5509a1[_0xc69f('0x1c')]+_0x5509a1['limit'];var _0x3b7f62;if(_0x2c57f1>=_0x176c38){_0x2c57f1=_0x176c38;_0x3b7f62=0xc8;}else{_0x3b7f62=0xce;}_0x4168b2[_0xc69f('0x1a')](_0x3b7f62);return _0x4168b2[_0xc69f('0x20')]('Content-Range',_0x564299+'-'+_0x2c57f1+'/'+_0x176c38)[_0xc69f('0x1b')](_0x4bc5a7);}return null;};}function patchUpdates(_0x2a494b){return function(_0x470e67){try{jsonpatch[_0xc69f('0x21')](_0x470e67,_0x2a494b,!![]);}catch(_0x3fde88){return BPromise[_0xc69f('0x22')](_0x3fde88);}return _0x470e67['save']();};}function saveUpdates(_0x28a7aa,_0x403e8c){return function(_0x1936c2){if(_0x1936c2){return _0x1936c2[_0xc69f('0x23')](_0x28a7aa)[_0xc69f('0x24')](function(_0x40e482){return _0x40e482;});}return null;};}function removeEntity(_0x396aaa,_0x459270){return function(_0x4434ea){if(_0x4434ea){return _0x4434ea['destroy']()[_0xc69f('0x24')](function(){_0x396aaa[_0xc69f('0x1a')](0xcc)[_0xc69f('0x25')]();});}};}function handleEntityNotFound(_0x30968b,_0x18dd55){return function(_0x2b8a2f){if(!_0x2b8a2f){_0x30968b[_0xc69f('0x19')](0x194);}return _0x2b8a2f;};}function handleError(_0xb3a3ea,_0x19bdc6){_0x19bdc6=_0x19bdc6||0x1f4;return function(_0x1a271d){logger[_0xc69f('0x26')](_0x1a271d[_0xc69f('0x27')]);if(_0x1a271d[_0xc69f('0x28')]){delete _0x1a271d['name'];}_0xb3a3ea['status'](_0x19bdc6)[_0xc69f('0x29')](_0x1a271d);};}exports[_0xc69f('0x2a')]=function(_0x2e4f25,_0x2a9d8b){var _0x2da718={},_0x2b6061={},_0x15017b={'count':0x0,'rows':[]};var _0x381e82=_[_0xc69f('0x2b')](db[_0xc69f('0x2c')][_0xc69f('0x2d')],function(_0x56094b){return{'name':_0x56094b[_0xc69f('0x2e')],'type':_0x56094b[_0xc69f('0x2f')][_0xc69f('0x30')]};});_0x2b6061[_0xc69f('0x31')]=_[_0xc69f('0x2b')](_0x381e82,_0xc69f('0x28'));_0x2b6061[_0xc69f('0x32')]=_[_0xc69f('0x33')](_0x2e4f25[_0xc69f('0x32')]);_0x2b6061[_0xc69f('0x34')]=_['intersection'](_0x2b6061[_0xc69f('0x31')],_0x2b6061[_0xc69f('0x32')]);_0x2da718[_0xc69f('0x35')]=_[_0xc69f('0x36')](_0x2b6061[_0xc69f('0x31')],qs[_0xc69f('0x37')](_0x2e4f25['query'][_0xc69f('0x37')]));_0x2da718[_0xc69f('0x35')]=_0x2da718[_0xc69f('0x35')][_0xc69f('0x38')]?_0x2da718[_0xc69f('0x35')]:_0x2b6061[_0xc69f('0x31')];if(!_0x2e4f25[_0xc69f('0x32')][_0xc69f('0x39')](_0xc69f('0x3a'))){_0x2da718[_0xc69f('0x1e')]=qs[_0xc69f('0x1e')](_0x2e4f25[_0xc69f('0x32')][_0xc69f('0x1e')]);_0x2da718[_0xc69f('0x1c')]=qs[_0xc69f('0x1c')](_0x2e4f25[_0xc69f('0x32')]['offset']);}_0x2da718['order']=qs[_0xc69f('0x3b')](_0x2e4f25['query'][_0xc69f('0x3b')]);_0x2da718[_0xc69f('0x3c')]=qs[_0xc69f('0x34')](_[_0xc69f('0x3d')](_0x2e4f25[_0xc69f('0x32')],_0x2b6061[_0xc69f('0x34')]),_0x381e82);if(_0x2e4f25['query'][_0xc69f('0x3e')]){_0x2da718['where']=_['merge'](_0x2da718[_0xc69f('0x3c')],{'$or':_[_0xc69f('0x2b')](_0x381e82,function(_0x2171c6){if(_0x2171c6[_0xc69f('0x2f')]!=='VIRTUAL'){var _0x3eb5bb={};_0x3eb5bb[_0x2171c6[_0xc69f('0x28')]]={'$like':'%'+_0x2e4f25[_0xc69f('0x32')][_0xc69f('0x3e')]+'%'};return _0x3eb5bb;}})});}_0x2da718=_[_0xc69f('0x3f')]({},_0x2da718,_0x2e4f25[_0xc69f('0x40')]);var _0x36b083={'where':_0x2da718[_0xc69f('0x3c')]};return db[_0xc69f('0x2c')]['count'](_0x36b083)[_0xc69f('0x24')](function(_0x51bd90){_0x15017b['count']=_0x51bd90;if(_0x2e4f25['query'][_0xc69f('0x41')]){_0x2da718[_0xc69f('0x42')]=[{'all':!![]}];}return db[_0xc69f('0x2c')]['findAll'](_0x2da718);})[_0xc69f('0x24')](function(_0x115aa0){_0x15017b['rows']=_0x115aa0;return _0x15017b;})['then'](respondWithFilteredResult(_0x2a9d8b,_0x2da718))[_0xc69f('0x43')](handleError(_0x2a9d8b,null));};exports[_0xc69f('0x44')]=function(_0x215355,_0x42ea02){var _0xf225a7={'raw':![],'where':{'id':_0x215355[_0xc69f('0x45')]['id']}},_0x25ba2e={};_0x25ba2e['model']=_[_0xc69f('0x33')](db['ServicenowAccount']['rawAttributes']);_0x25ba2e[_0xc69f('0x32')]=_[_0xc69f('0x33')](_0x215355[_0xc69f('0x32')]);_0x25ba2e[_0xc69f('0x34')]=_[_0xc69f('0x36')](_0x25ba2e['model'],_0x25ba2e['query']);_0xf225a7[_0xc69f('0x35')]=_['intersection'](_0x25ba2e[_0xc69f('0x31')],qs[_0xc69f('0x37')](_0x215355[_0xc69f('0x32')][_0xc69f('0x37')]));_0xf225a7['attributes']=_0xf225a7[_0xc69f('0x35')][_0xc69f('0x38')]?_0xf225a7['attributes']:_0x25ba2e[_0xc69f('0x31')];if(_0x215355['query'][_0xc69f('0x41')]){_0xf225a7['include']=[{'all':!![]}];}_0xf225a7=_[_0xc69f('0x3f')]({},_0xf225a7,_0x215355['options']);return db[_0xc69f('0x2c')][_0xc69f('0x46')](_0xf225a7)[_0xc69f('0x24')](handleEntityNotFound(_0x42ea02,null))[_0xc69f('0x24')](respondWithResult(_0x42ea02,null))['catch'](handleError(_0x42ea02,null));};exports[_0xc69f('0x47')]=function(_0x3c7d92,_0x555685){return db[_0xc69f('0x2c')][_0xc69f('0x47')](_0x3c7d92[_0xc69f('0x48')],{})['then'](respondWithResult(_0x555685,0xc9))['catch'](handleError(_0x555685,null));};exports['update']=function(_0x2b4267,_0x2c1250){if(_0x2b4267[_0xc69f('0x48')]['id']){delete _0x2b4267[_0xc69f('0x48')]['id'];}return db[_0xc69f('0x2c')]['find']({'where':{'id':_0x2b4267[_0xc69f('0x45')]['id']}})[_0xc69f('0x24')](handleEntityNotFound(_0x2c1250,null))[_0xc69f('0x24')](saveUpdates(_0x2b4267[_0xc69f('0x48')],null))['then'](respondWithResult(_0x2c1250,null))[_0xc69f('0x43')](handleError(_0x2c1250,null));};exports[_0xc69f('0x49')]=function(_0x24542c,_0x52ddf9){return db[_0xc69f('0x2c')][_0xc69f('0x46')]({'where':{'id':_0x24542c[_0xc69f('0x45')]['id']}})[_0xc69f('0x24')](handleEntityNotFound(_0x52ddf9,null))[_0xc69f('0x24')](removeEntity(_0x52ddf9,null))[_0xc69f('0x43')](handleError(_0x52ddf9,null));};exports[_0xc69f('0x4a')]=function(_0x8eedb0,_0x32ea3d,_0x43a7e4){var _0x40f10f={};var _0x5eedba={};var _0x36719d;var _0x546de5;return db['ServicenowAccount'][_0xc69f('0x4b')]({'where':{'id':_0x8eedb0['params']['id']}})[_0xc69f('0x24')](handleEntityNotFound(_0x32ea3d,null))[_0xc69f('0x24')](function(_0x45834d){if(_0x45834d){_0x36719d=_0x45834d;_0x5eedba['model']=_[_0xc69f('0x33')](db[_0xc69f('0x4c')][_0xc69f('0x2d')]);_0x5eedba[_0xc69f('0x32')]=_[_0xc69f('0x33')](_0x8eedb0[_0xc69f('0x32')]);_0x5eedba[_0xc69f('0x34')]=_[_0xc69f('0x36')](_0x5eedba['model'],_0x5eedba[_0xc69f('0x32')]);_0x40f10f[_0xc69f('0x35')]=_['intersection'](_0x5eedba[_0xc69f('0x31')],qs[_0xc69f('0x37')](_0x8eedb0['query'][_0xc69f('0x37')]));_0x40f10f[_0xc69f('0x35')]=_0x40f10f[_0xc69f('0x35')][_0xc69f('0x38')]?_0x40f10f['attributes']:_0x5eedba[_0xc69f('0x31')];_0x40f10f['order']=qs[_0xc69f('0x3b')](_0x8eedb0[_0xc69f('0x32')][_0xc69f('0x3b')]);_0x40f10f[_0xc69f('0x3c')]=qs[_0xc69f('0x34')](_[_0xc69f('0x3d')](_0x8eedb0['query'],_0x5eedba[_0xc69f('0x34')]));if(_0x8eedb0[_0xc69f('0x32')][_0xc69f('0x3e')]){_0x40f10f[_0xc69f('0x3c')]=_[_0xc69f('0x3f')](_0x40f10f[_0xc69f('0x3c')],{'$or':_[_0xc69f('0x2b')](_0x40f10f['attributes'],function(_0xe667b8){var _0x46ae22={};_0x46ae22[_0xe667b8]={'$like':'%'+_0x8eedb0[_0xc69f('0x32')]['filter']+'%'};return _0x46ae22;})});}_0x40f10f=_[_0xc69f('0x3f')]({},_0x40f10f,_0x8eedb0[_0xc69f('0x40')]);return _0x36719d[_0xc69f('0x4a')](_0x40f10f);}})[_0xc69f('0x24')](function(_0x4e4dcc){if(_0x4e4dcc){_0x546de5=_0x4e4dcc[_0xc69f('0x38')];if(!_0x8eedb0[_0xc69f('0x32')][_0xc69f('0x39')](_0xc69f('0x3a'))){_0x40f10f['limit']=qs[_0xc69f('0x1e')](_0x8eedb0['query']['limit']);_0x40f10f[_0xc69f('0x1c')]=qs[_0xc69f('0x1c')](_0x8eedb0[_0xc69f('0x32')][_0xc69f('0x1c')]);}return _0x36719d[_0xc69f('0x4a')](_0x40f10f);}})[_0xc69f('0x24')](function(_0x4e27f0){if(_0x4e27f0){return _0x4e27f0?{'count':_0x546de5,'rows':_0x4e27f0}:null;}})[_0xc69f('0x24')](respondWithResult(_0x32ea3d,null))[_0xc69f('0x43')](handleError(_0x32ea3d,null));};exports[_0xc69f('0x4d')]=function(_0x145472,_0x7abdc3,_0x47e2b6){if(_0x145472[_0xc69f('0x48')]['id']){delete _0x145472[_0xc69f('0x48')]['id'];}return db['ServicenowAccount'][_0xc69f('0x4b')]({'where':{'id':_0x145472['params']['id']}})[_0xc69f('0x24')](handleEntityNotFound(_0x7abdc3,null))['then'](function(_0x2f5dbd){if(_0x2f5dbd){_0x145472[_0xc69f('0x48')][_0xc69f('0x4e')]=_0x2f5dbd['id'];_0x145472[_0xc69f('0x48')]['Subjects']=integrations['getSubjects'](_0x145472[_0xc69f('0x48')][_0xc69f('0x4f')],_0x145472[_0xc69f('0x48')][_0xc69f('0x2f')]);_0x145472[_0xc69f('0x48')][_0xc69f('0x50')]=integrations[_0xc69f('0x51')](_0x145472[_0xc69f('0x48')][_0xc69f('0x4f')],_0x145472[_0xc69f('0x48')][_0xc69f('0x2f')]);return db[_0xc69f('0x4c')][_0xc69f('0x47')](_0x145472[_0xc69f('0x48')],{'include':[{'model':db[_0xc69f('0x52')],'as':_0xc69f('0x53')},{'model':db['ServicenowField'],'as':_0xc69f('0x50')}]});}return null;})['then'](respondWithResult(_0x7abdc3,null))[_0xc69f('0x43')](handleError(_0x7abdc3,null));};exports[_0xc69f('0x54')]=function(_0x297663,_0x1dafd7,_0x5458a2){var _0x1c5227=[_0xc69f('0x55'),_0xc69f('0x56'),'knowledge',_0xc69f('0x57'),_0xc69f('0x58'),'notify',_0xc69f('0x59'),'severity',_0xc69f('0x5a')];var _0x3a02b9=[_0xc69f('0x5b'),_0xc69f('0x55'),_0xc69f('0x5c'),_0xc69f('0x5d'),_0xc69f('0x5e'),_0xc69f('0x5f'),_0xc69f('0x60'),_0xc69f('0x56'),_0xc69f('0x61'),'number','resolved_by',_0xc69f('0x62'),_0xc69f('0x63'),'user_input','sys_created_on',_0xc69f('0x64'),_0xc69f('0x65'),'sys_created_by',_0xc69f('0x66'),_0xc69f('0x67'),_0xc69f('0x68'),_0xc69f('0x69'),'cmdb_ci','delivery_plan','impact',_0xc69f('0x6a'),_0xc69f('0x6b'),_0xc69f('0x6c'),_0xc69f('0x6d'),'sys_domain_path',_0xc69f('0x6e'),_0xc69f('0x6f'),_0xc69f('0x70'),_0xc69f('0x71'),_0xc69f('0x72'),_0xc69f('0x73'),_0xc69f('0x74'),_0xc69f('0x75'),_0xc69f('0x76'),'caller_id','approval_set',_0xc69f('0x57'),_0xc69f('0x77'),'short_description',_0xc69f('0x58'),_0xc69f('0x78'),'delivery_task',_0xc69f('0x79'),'assignment_group','business_stc','additional_assignee_list',_0xc69f('0x7a'),'calendar_duration','notify',_0xc69f('0x7b'),_0xc69f('0x7c'),_0xc69f('0x7d'),_0xc69f('0x7e'),_0xc69f('0x7f'),_0xc69f('0x80'),_0xc69f('0x81'),_0xc69f('0x82'),'incident_state','urgency','problem_id',_0xc69f('0x83'),_0xc69f('0x84'),_0xc69f('0x85'),_0xc69f('0x86'),'severity','comments',_0xc69f('0x87'),'approval',_0xc69f('0x88'),'due_date',_0xc69f('0x89'),'reopen_count','sys_tags',_0xc69f('0x8a'),'upon_approval',_0xc69f('0x8b'),_0xc69f('0x8c'),'category'];var _0x2ee215='';var _0x4ebe30='';var _0x28f965=[];var _0xf4b96e='';var _0x20d481='';var _0xb6ab24=[];var _0x402493='';var _0x3778c4='';var _0x5513a5={};var _0x55a9d3='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x297663[_0xc69f('0x45')]['id']},'attributes':['id',_0xc69f('0x8d'),_0xc69f('0x8e'),_0xc69f('0x8f'),_0xc69f('0x90'),_0xc69f('0x91')]})[_0xc69f('0x24')](handleEntityNotFound(_0x1dafd7,null))[_0xc69f('0x24')](function(_0x5a75fb){if(_0x5a75fb){_0x55a9d3=_0x5a75fb[_0xc69f('0x90')];var _0x440d42=_0x55a9d3[_0xc69f('0x92')](-0x1);if(_0x440d42==='/'){_0x55a9d3=_0x55a9d3[_0xc69f('0x93')](0x0,_0x55a9d3['lastIndexOf'](_0x440d42));}_0x3778c4=util[_0xc69f('0x94')](_0xc69f('0x95'),_0x55a9d3);_0x402493=util[_0xc69f('0x94')]('%s/api/now/table/',_0x55a9d3);_0x5513a5={'user':_0x5a75fb[_0xc69f('0x8d')],'pass':_0x5a75fb[_0xc69f('0x8e')]};var _0x437f2b={'method':'GET','uri':_0x3778c4+_0xc69f('0x96'),'auth':_0x5513a5,'json':!![]};return rp(_0x437f2b);}})[_0xc69f('0x24')](function(_0x35ebaa){if(_0x35ebaa[_0xc69f('0x97')][_0xc69f('0x38')]>0x0){_0x2ee215=_0x35ebaa[_0xc69f('0x97')];}console[_0xc69f('0x98')](_0xc69f('0x99'),_0x2ee215);_0xb6ab24=[];_0x4ebe30=Object[_0xc69f('0x9a')]([],_0x2ee215);_[_0xc69f('0x9b')](_0x4ebe30,function(_0xa065cc){return!_0x1c5227[_0xc69f('0x9c')](_0xa065cc['name']);});_0x4ebe30[_0xc69f('0x9d')](function(_0x5f59cc){var _0x49d266=createFieldObject(_0x402493,_0x5513a5,_0x5f59cc[_0xc69f('0x9e')],_0x5f59cc[_0xc69f('0x28')],_0x5f59cc[_0xc69f('0x9f')],![]);_0xb6ab24[_0xc69f('0xa0')](_0x49d266);});return Promise[_0xc69f('0xa1')](_0xb6ab24);})[_0xc69f('0x24')](function(_0x4decb2){_0x28f965=_0x4decb2;_0xf4b96e=Object[_0xc69f('0x9a')]([],_0x2ee215);console[_0xc69f('0x98')]('TCL:\x20_object',_0x2ee215);_[_0xc69f('0x9b')](_0xf4b96e,function(_0x1ecd03){return _0x3a02b9[_0xc69f('0x9c')](_0x1ecd03['name']);});console['log'](_0xc69f('0xa2'),_0xf4b96e);_0xb6ab24=[];_0xf4b96e['forEach'](function(_0x1952bc){var _0x197375=createFieldObject(_0x402493,_0x5513a5,_0x1952bc[_0xc69f('0x9e')],_0x1952bc[_0xc69f('0x28')],_0x1952bc[_0xc69f('0x9f')],!![]);_0xb6ab24['push'](_0x197375);});return Promise[_0xc69f('0xa1')](_0xb6ab24);})[_0xc69f('0x24')](function(_0x2a56a6){_0x20d481=_0x2a56a6;var _0x3e3039=_0x28f965[_0xc69f('0xa3')](_0x20d481);return{'count':_0x3e3039[_0xc69f('0x38')],'rows':_0x3e3039};})['then'](respondWithResult(_0x1dafd7,null))['catch'](function(_0x12642f){console[_0xc69f('0x98')](_0xc69f('0xa4')+_0x12642f);var _0x3df4c2=_0x297663[_0xc69f('0x32')][_0xc69f('0xa5')]?0x1f4:_0x12642f['statusCode']||0x1f4;logger[_0xc69f('0x26')](_0x12642f[_0xc69f('0x27')]);delete _0x12642f['name'];if(_0x3df4c2===0x191){_0x3df4c2=0x190;}_0x1dafd7[_0xc69f('0x1a')](_0x3df4c2)[_0xc69f('0x29')](_0x297663['query']['test']?{'message':_0xc69f('0xa6'),'statusCode':_0x12642f['statusCode']}:_0x12642f);});};function createFieldObject(_0xafc2cf,_0x53ce95,_0x9d4e0c,_0x28a911,_0x3fdfbe,_0x3edd7b){return new Promise(function(_0x1a578f,_0x31b061){var _0x3c3256={'id':_0x28a911,'name':_0x3fdfbe,'custom':_0x3edd7b};if(_0x9d4e0c===_0xc69f('0xa7')){_0x3c3256[_0xc69f('0x40')]=[{'name':_0xc69f('0xa8'),'value':_0xc69f('0xa9')},{'name':_0xc69f('0xaa'),'value':_0xc69f('0xab')}];_0x1a578f(_0x3c3256);}else{var _0x15cf5b={'method':_0xc69f('0xac'),'uri':_0xafc2cf+_0xc69f('0xad')+_0x28a911,'auth':_0x53ce95,'json':!![]};return rp(_0x15cf5b)[_0xc69f('0x24')](function(_0x34d8ec){var _0x3cf732=[];if(_0x34d8ec[_0xc69f('0x97')][_0xc69f('0x38')]>0x0){_0x34d8ec[_0xc69f('0x97')]['forEach'](function(_0x3a9bdb){if(_0x3a9bdb['inactive']===_0xc69f('0xab')){var _0x5c0902={'name':_0x3a9bdb[_0xc69f('0x9f')],'value':_0x3a9bdb['value']};_0x3cf732[_0xc69f('0xa0')](_0x5c0902);}});}_0x3c3256['options']=_0x3cf732;if(_0x3c3256[_0xc69f('0x40')]['length']>0x0){_0x1a578f(_0x3c3256);}else{if(_0x3edd7b==![]){_0x1a578f();}else{_0x1a578f(_0x3c3256);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 361fc55..2284b01 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x2385a5,_0x4dec8b){var _0x1de46f=function(_0x2ae199){while(--_0x2ae199){_0x2385a5['push'](_0x2385a5['shift']());}};_0x1de46f(++_0x4dec8b);}(_0xa630,0xbe));var _0x0a63=function(_0x44bff2,_0x176a27){_0x44bff2=_0x44bff2-0x0;var _0x1a7248=_0xa630[_0x44bff2];return _0x1a7248;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['bluebird','path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment'];(function(_0x4bf80e,_0x252832){var _0x8c8002=function(_0x584e7b){while(--_0x584e7b){_0x4bf80e['push'](_0x4bf80e['shift']());}};_0x8c8002(++_0x252832);}(_0x46ed,0x168));var _0xd46e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46ed[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));var integrations=require(_0xd46e('0x8'));module[_0xd46e('0x9')]=function(_0x25cf78,_0x45e680){return _0x25cf78[_0xd46e('0xa')](_0xd46e('0xb'),attributes,{'tableName':_0xd46e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 0c2c701..3e65f5a 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee4b=['../../config/logger','../../config/environment','jayson/promise','http','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','GetServicenowAccount','find','model','then','ShowServicenowAccount','util','moment','bluebird','ioredis','../../config/utils'];(function(_0xec6119,_0x21d2dc){var _0x2ac416=function(_0x4caf78){while(--_0x4caf78){_0xec6119['push'](_0xec6119['shift']());}};_0x2ac416(++_0x21d2dc);}(_0xee4b,0x10b));var _0xbee4=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xee4b[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require('lodash');var util=require(_0xbee4('0x0'));var moment=require(_0xbee4('0x1'));var BPromise=require(_0xbee4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbee4('0x4'));var logger=require(_0xbee4('0x5'))('rpc');var config=require(_0xbee4('0x6'));var jayson=require(_0xbee4('0x7'));var client=jayson['client'][_0xbee4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1520ea,_0x1b492d,_0x4c4227){return new BPromise(function(_0x31b451,_0x441dfe){return client['request'](_0x1520ea,_0x4c4227)['then'](function(_0x4ae84a){logger['info'](_0xbee4('0x9'),_0x1b492d,'request\x20sent');logger[_0xbee4('0xa')](_0xbee4('0xb'),_0x1b492d,_0xbee4('0xc'),JSON[_0xbee4('0xd')](_0x4ae84a));if(_0x4ae84a[_0xbee4('0xe')]){if(_0x4ae84a[_0xbee4('0xe')][_0xbee4('0xf')]===0x1f4){logger['error'](_0xbee4('0x9'),_0x1b492d,_0x4ae84a[_0xbee4('0xe')][_0xbee4('0x10')]);return _0x441dfe(_0x4ae84a['error']['message']);}logger['error'](_0xbee4('0x9'),_0x1b492d,_0x4ae84a[_0xbee4('0xe')][_0xbee4('0x10')]);return _0x31b451(_0x4ae84a[_0xbee4('0xe')]['message']);}else{logger[_0xbee4('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x1b492d,_0xbee4('0xc'));_0x31b451(_0x4ae84a[_0xbee4('0x12')][_0xbee4('0x10')]);}})[_0xbee4('0x13')](function(_0x1e1808){logger[_0xbee4('0xe')](_0xbee4('0x9'),_0x1b492d,_0x1e1808);_0x441dfe(_0x1e1808);});});}exports['GetServicenowAccount']=function(_0x2c8d23){var _0x160731=this;return new Promise(function(_0x2c3584,_0x290966){return db[_0xbee4('0x14')][_0xbee4('0x15')]({'raw':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x17')]===undefined?!![]:![]:!![],'where':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x18')]||null:null,'attributes':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x19')]||null:null,'limit':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x1a')]||null:null,'include':_0x2c8d23[_0xbee4('0x16')]?_0x2c8d23[_0xbee4('0x16')][_0xbee4('0x1b')]?_[_0xbee4('0x1c')](_0x2c8d23['options'][_0xbee4('0x1b')],function(_0x559730){return{'model':db[_0x559730['model']],'as':_0x559730['as'],'attributes':_0x559730[_0xbee4('0x19')],'include':_0x559730['include']?_[_0xbee4('0x1c')](_0x559730[_0xbee4('0x1b')],function(_0x5655b9){return{'model':db[_0x5655b9['model']],'as':_0x5655b9['as'],'attributes':_0x5655b9[_0xbee4('0x19')],'include':_0x5655b9[_0xbee4('0x1b')]?_[_0xbee4('0x1c')](_0x5655b9[_0xbee4('0x1b')],function(_0x578921){return{'model':db[_0x578921['model']],'as':_0x578921['as'],'attributes':_0x578921[_0xbee4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e0ab1){logger[_0xbee4('0x11')]('GetServicenowAccount',_0x2c8d23);logger[_0xbee4('0xa')](_0xbee4('0x1d'),_0x2c8d23,JSON['stringify'](_0x3e0ab1));_0x2c3584(_0x3e0ab1);})['catch'](function(_0x4152b7){logger['error'](_0xbee4('0x1d'),_0x4152b7[_0xbee4('0x10')],_0x2c8d23);_0x290966(_0x160731[_0xbee4('0xe')](0x1f4,_0x4152b7['message']));});});};exports['ShowServicenowAccount']=function(_0x186c01){var _0x5e678a=this;return new Promise(function(_0x105785,_0x2f76b8){return db[_0xbee4('0x14')][_0xbee4('0x1e')]({'raw':_0x186c01[_0xbee4('0x16')]?_0x186c01[_0xbee4('0x16')][_0xbee4('0x17')]===undefined?!![]:![]:!![],'where':_0x186c01['options']?_0x186c01[_0xbee4('0x16')]['where']||null:null,'attributes':_0x186c01[_0xbee4('0x16')]?_0x186c01['options'][_0xbee4('0x19')]||null:null,'include':_0x186c01[_0xbee4('0x16')]?_0x186c01[_0xbee4('0x16')]['include']?_[_0xbee4('0x1c')](_0x186c01[_0xbee4('0x16')][_0xbee4('0x1b')],function(_0x310316){return{'model':db[_0x310316[_0xbee4('0x1f')]],'as':_0x310316['as'],'attributes':_0x310316[_0xbee4('0x19')],'include':_0x310316['include']?_[_0xbee4('0x1c')](_0x310316[_0xbee4('0x1b')],function(_0x490d69){return{'model':db[_0x490d69[_0xbee4('0x1f')]],'as':_0x490d69['as'],'attributes':_0x490d69[_0xbee4('0x19')],'include':_0x490d69['include']?_[_0xbee4('0x1c')](_0x490d69[_0xbee4('0x1b')],function(_0x427370){return{'model':db[_0x427370['model']],'as':_0x427370['as'],'attributes':_0x427370['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee4('0x20')](function(_0x128b9f){logger[_0xbee4('0x11')](_0xbee4('0x21'),_0x186c01);logger['debug'](_0xbee4('0x21'),_0x186c01,JSON[_0xbee4('0xd')](_0x128b9f));_0x105785(_0x128b9f);})['catch'](function(_0x430003){logger[_0xbee4('0xe')](_0xbee4('0x21'),_0x430003[_0xbee4('0x10')],_0x186c01);_0x2f76b8(_0x5e678a[_0xbee4('0xe')](0x1f4,_0x430003[_0xbee4('0x10')]));});});}; \ No newline at end of file +var _0x2d05=['findAll','options','attributes','limit','include','model','map','catch','ShowServicenowAccount','find','raw','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetServicenowAccount','ServicenowAccount'];(function(_0x41d8ce,_0x45a727){var _0x4701ed=function(_0x2ea2d9){while(--_0x2ea2d9){_0x41d8ce['push'](_0x41d8ce['shift']());}};_0x4701ed(++_0x45a727);}(_0x2d05,0x1ed));var _0x52d0=function(_0x2a35f1,_0x2e645b){_0x2a35f1=_0x2a35f1-0x0;var _0x58be1e=_0x2d05[_0x2a35f1];return _0x58be1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52d0('0x0'));var BPromise=require(_0x52d0('0x1'));var rs=require(_0x52d0('0x2'));var fs=require('fs');var Redis=require(_0x52d0('0x3'));var db=require(_0x52d0('0x4'))['db'];var utils=require(_0x52d0('0x5'));var logger=require(_0x52d0('0x6'))(_0x52d0('0x7'));var config=require(_0x52d0('0x8'));var jayson=require(_0x52d0('0x9'));var client=jayson[_0x52d0('0xa')][_0x52d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f19ce,_0x435ca5,_0x2f4965){return new BPromise(function(_0x3f4ebc,_0x9010aa){return client[_0x52d0('0xc')](_0x5f19ce,_0x2f4965)[_0x52d0('0xd')](function(_0x558765){logger[_0x52d0('0xe')](_0x52d0('0xf'),_0x435ca5,'request\x20sent');logger[_0x52d0('0x10')](_0x52d0('0x11'),_0x435ca5,_0x52d0('0x12'),JSON[_0x52d0('0x13')](_0x558765));if(_0x558765[_0x52d0('0x14')]){if(_0x558765[_0x52d0('0x14')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x435ca5,_0x558765[_0x52d0('0x14')][_0x52d0('0x15')]);return _0x9010aa(_0x558765[_0x52d0('0x14')][_0x52d0('0x15')]);}logger[_0x52d0('0x14')](_0x52d0('0xf'),_0x435ca5,_0x558765[_0x52d0('0x14')][_0x52d0('0x15')]);return _0x3f4ebc(_0x558765['error'][_0x52d0('0x15')]);}else{logger[_0x52d0('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x435ca5,_0x52d0('0x12'));_0x3f4ebc(_0x558765[_0x52d0('0x16')][_0x52d0('0x15')]);}})['catch'](function(_0x39d733){logger[_0x52d0('0x14')](_0x52d0('0xf'),_0x435ca5,_0x39d733);_0x9010aa(_0x39d733);});});}exports[_0x52d0('0x17')]=function(_0x1906a3){var _0x42f447=this;return new Promise(function(_0x6b0420,_0x11c3f0){return db[_0x52d0('0x18')][_0x52d0('0x19')]({'raw':_0x1906a3['options']?_0x1906a3[_0x52d0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1906a3[_0x52d0('0x1a')]?_0x1906a3['options']['where']||null:null,'attributes':_0x1906a3[_0x52d0('0x1a')]?_0x1906a3['options'][_0x52d0('0x1b')]||null:null,'limit':_0x1906a3[_0x52d0('0x1a')]?_0x1906a3[_0x52d0('0x1a')][_0x52d0('0x1c')]||null:null,'include':_0x1906a3[_0x52d0('0x1a')]?_0x1906a3[_0x52d0('0x1a')][_0x52d0('0x1d')]?_['map'](_0x1906a3['options'][_0x52d0('0x1d')],function(_0x3e9d33){return{'model':db[_0x3e9d33[_0x52d0('0x1e')]],'as':_0x3e9d33['as'],'attributes':_0x3e9d33[_0x52d0('0x1b')],'include':_0x3e9d33['include']?_[_0x52d0('0x1f')](_0x3e9d33[_0x52d0('0x1d')],function(_0x182232){return{'model':db[_0x182232['model']],'as':_0x182232['as'],'attributes':_0x182232['attributes'],'include':_0x182232[_0x52d0('0x1d')]?_[_0x52d0('0x1f')](_0x182232[_0x52d0('0x1d')],function(_0x33d3d5){return{'model':db[_0x33d3d5[_0x52d0('0x1e')]],'as':_0x33d3d5['as'],'attributes':_0x33d3d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x52d0('0xd')](function(_0x124eab){logger['info'](_0x52d0('0x17'),_0x1906a3);logger[_0x52d0('0x10')](_0x52d0('0x17'),_0x1906a3,JSON['stringify'](_0x124eab));_0x6b0420(_0x124eab);})[_0x52d0('0x20')](function(_0x35e992){logger['error'](_0x52d0('0x17'),_0x35e992[_0x52d0('0x15')],_0x1906a3);_0x11c3f0(_0x42f447[_0x52d0('0x14')](0x1f4,_0x35e992[_0x52d0('0x15')]));});});};exports[_0x52d0('0x21')]=function(_0x114b65){var _0x34ad4b=this;return new Promise(function(_0x5d7640,_0x5162bf){return db[_0x52d0('0x18')][_0x52d0('0x22')]({'raw':_0x114b65[_0x52d0('0x1a')]?_0x114b65[_0x52d0('0x1a')][_0x52d0('0x23')]===undefined?!![]:![]:!![],'where':_0x114b65[_0x52d0('0x1a')]?_0x114b65[_0x52d0('0x1a')][_0x52d0('0x24')]||null:null,'attributes':_0x114b65[_0x52d0('0x1a')]?_0x114b65[_0x52d0('0x1a')][_0x52d0('0x1b')]||null:null,'include':_0x114b65[_0x52d0('0x1a')]?_0x114b65[_0x52d0('0x1a')][_0x52d0('0x1d')]?_['map'](_0x114b65[_0x52d0('0x1a')][_0x52d0('0x1d')],function(_0x1d7f72){return{'model':db[_0x1d7f72[_0x52d0('0x1e')]],'as':_0x1d7f72['as'],'attributes':_0x1d7f72[_0x52d0('0x1b')],'include':_0x1d7f72[_0x52d0('0x1d')]?_[_0x52d0('0x1f')](_0x1d7f72[_0x52d0('0x1d')],function(_0x1a64ef){return{'model':db[_0x1a64ef[_0x52d0('0x1e')]],'as':_0x1a64ef['as'],'attributes':_0x1a64ef[_0x52d0('0x1b')],'include':_0x1a64ef[_0x52d0('0x1d')]?_[_0x52d0('0x1f')](_0x1a64ef['include'],function(_0xb7b8f7){return{'model':db[_0xb7b8f7[_0x52d0('0x1e')]],'as':_0xb7b8f7['as'],'attributes':_0xb7b8f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x52d0('0xd')](function(_0x1ccd99){logger[_0x52d0('0xe')](_0x52d0('0x21'),_0x114b65);logger[_0x52d0('0x10')](_0x52d0('0x21'),_0x114b65,JSON[_0x52d0('0x13')](_0x1ccd99));_0x5d7640(_0x1ccd99);})[_0x52d0('0x20')](function(_0x47e893){logger[_0x52d0('0x14')](_0x52d0('0x21'),_0x47e893[_0x52d0('0x15')],_0x114b65);_0x5162bf(_0x34ad4b[_0x52d0('0x14')](0x1f4,_0x47e893[_0x52d0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 90810ed..a7239a5 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4131=['isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','/:id','update','exports','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller'];(function(_0xabdeb2,_0x3e6fb5){var _0x1c785a=function(_0x4c44ce){while(--_0x4c44ce){_0xabdeb2['push'](_0xabdeb2['shift']());}};_0x1c785a(++_0x3e6fb5);}(_0x4131,0xcb));var _0x1413=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x4131[_0x29c3b2];return _0x4b3aa7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1413('0x0'));var express=require(_0x1413('0x1'));var router=express['Router']();var fs_extra=require(_0x1413('0x2'));var auth=require(_0x1413('0x3'));var interaction=require(_0x1413('0x4'));var config=require('../../config/environment');var controller=require(_0x1413('0x5'));router['get']('/',auth[_0x1413('0x6')](),controller[_0x1413('0x7')]);router[_0x1413('0x8')]('/:id',auth[_0x1413('0x6')](),controller[_0x1413('0x9')]);router[_0x1413('0x8')](_0x1413('0xa'),auth[_0x1413('0x6')](),controller[_0x1413('0xb')]);router[_0x1413('0x8')](_0x1413('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1413('0x8')]('/:id/descriptions',auth[_0x1413('0x6')](),controller[_0x1413('0xd')]);router[_0x1413('0xe')]('/',auth['isAuthenticated'](),controller[_0x1413('0xf')]);router['put'](_0x1413('0x10'),auth[_0x1413('0x6')](),controller[_0x1413('0x11')]);router['delete']('/:id',auth[_0x1413('0x6')](),controller['destroy']);module[_0x1413('0x12')]=router; \ No newline at end of file +var _0xc3d4=['/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x148f44,_0x4894ed){var _0x1502fb=function(_0x31ab4d){while(--_0x31ab4d){_0x148f44['push'](_0x148f44['shift']());}};_0x1502fb(++_0x4894ed);}(_0xc3d4,0x14c));var _0x4c3d=function(_0x3a290c,_0x5b4ef0){_0x3a290c=_0x3a290c-0x0;var _0x50227c=_0xc3d4[_0x3a290c];return _0x50227c;};'use strict';var multer=require(_0x4c3d('0x0'));var util=require(_0x4c3d('0x1'));var path=require(_0x4c3d('0x2'));var timeout=require(_0x4c3d('0x3'));var express=require('express');var router=express[_0x4c3d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4c3d('0x5'));var interaction=require(_0x4c3d('0x6'));var config=require('../../config/environment');var controller=require(_0x4c3d('0x7'));router[_0x4c3d('0x8')]('/',auth[_0x4c3d('0x9')](),controller[_0x4c3d('0xa')]);router[_0x4c3d('0x8')]('/:id',auth[_0x4c3d('0x9')](),controller[_0x4c3d('0xb')]);router[_0x4c3d('0x8')](_0x4c3d('0xc'),auth[_0x4c3d('0x9')](),controller['getFields']);router['get'](_0x4c3d('0xd'),auth[_0x4c3d('0x9')](),controller['getSubjects']);router[_0x4c3d('0x8')](_0x4c3d('0xe'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0xf')]);router[_0x4c3d('0x10')]('/',auth[_0x4c3d('0x9')](),controller[_0x4c3d('0x11')]);router[_0x4c3d('0x12')](_0x4c3d('0x13'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0x14')]);router[_0x4c3d('0x15')](_0x4c3d('0x13'),auth[_0x4c3d('0x9')](),controller[_0x4c3d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b915d0d..1606e23 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f1a=['exports','STRING'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x2f1a,0x1c8));var _0xa2f1=function(_0x5d2343,_0x3bb026){_0x5d2343=_0x5d2343-0x0;var _0x5633aa=_0x2f1a[_0x5d2343];return _0x5633aa;};'use strict';var Sequelize=require('sequelize');module[_0xa2f1('0x0')]={'name':{'type':Sequelize[_0xa2f1('0x1')]},'description':{'type':Sequelize[_0xa2f1('0x1')]}}; \ No newline at end of file +var _0x1f05=['exports','STRING','sequelize'];(function(_0x307046,_0x45e3a6){var _0x2183b2=function(_0x4f70ba){while(--_0x4f70ba){_0x307046['push'](_0x307046['shift']());}};_0x2183b2(++_0x45e3a6);}(_0x1f05,0xc8));var _0x51f0=function(_0xc8224,_0x4385c7){_0xc8224=_0xc8224-0x0;var _0x20ecc3=_0x1f05[_0xc8224];return _0x20ecc3;};'use strict';var Sequelize=require(_0x51f0('0x0'));module[_0x51f0('0x1')]={'name':{'type':Sequelize[_0x51f0('0x2')]},'description':{'type':Sequelize[_0x51f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 48a3ec4..0dae1e0 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56f2=['filters','model','attributes','length','hasOwnProperty','nolimit','pick','filter','where','merge','options','count','includeAll','include','catch','params','intersection','fields','find','create','body','getFields','findOne','ServicenowField','sort','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','status','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x56f2,0x189));var _0x256f=function(_0x8f0d61,_0x3175c7){_0x8f0d61=_0x8f0d61-0x0;var _0xa10bda=_0x56f2[_0x8f0d61];return _0xa10bda;};'use strict';var emlformat=require(_0x256f('0x0'));var rimraf=require(_0x256f('0x1'));var zipdir=require(_0x256f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x256f('0x3'));var moment=require(_0x256f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x256f('0x5'));var util=require('util');var path=require(_0x256f('0x6'));var sox=require(_0x256f('0x7'));var csv=require('to-csv');var ejs=require(_0x256f('0x8'));var fs=require('fs');var fs_extra=require(_0x256f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x256f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x256f('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x256f('0xc'));var qs=require(_0x256f('0xd'));var as=require(_0x256f('0xe'));var hardwareService=require(_0x256f('0xf'));var logger=require(_0x256f('0x10'))(_0x256f('0x11'));var utils=require(_0x256f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x256f('0x13'));var db=require(_0x256f('0x14'))['db'];function respondWithStatusCode(_0x252a06,_0x517b8b){_0x517b8b=_0x517b8b||0xcc;return function(_0x2611cb){if(_0x2611cb){return _0x252a06[_0x256f('0x15')](_0x517b8b);}return _0x252a06['status'](_0x517b8b)[_0x256f('0x16')]();};}function respondWithResult(_0xc0c4bc,_0xc61460){_0xc61460=_0xc61460||0xc8;return function(_0x31456){if(_0x31456){return _0xc0c4bc['status'](_0xc61460)['json'](_0x31456);}};}function respondWithFilteredResult(_0x5d0475,_0x8ce2ae){return function(_0x2466c2){if(_0x2466c2){var _0x455bab=typeof _0x8ce2ae[_0x256f('0x17')]===_0x256f('0x18')&&typeof _0x8ce2ae[_0x256f('0x19')]===_0x256f('0x18');var _0x48e574=_0x2466c2['count'];var _0x53a219=_0x455bab?0x0:_0x8ce2ae['offset'];var _0x544fe9=_0x455bab?_0x2466c2['count']:_0x8ce2ae['offset']+_0x8ce2ae['limit'];var _0x2f60ba;if(_0x544fe9>=_0x48e574){_0x544fe9=_0x48e574;_0x2f60ba=0xc8;}else{_0x2f60ba=0xce;}_0x5d0475['status'](_0x2f60ba);return _0x5d0475['set'](_0x256f('0x1a'),_0x53a219+'-'+_0x544fe9+'/'+_0x48e574)['json'](_0x2466c2);}return null;};}function patchUpdates(_0x4988eb){return function(_0x8b54c7){try{jsonpatch[_0x256f('0x1b')](_0x8b54c7,_0x4988eb,!![]);}catch(_0x23359a){return BPromise[_0x256f('0x1c')](_0x23359a);}return _0x8b54c7['save']();};}function saveUpdates(_0x4d046c,_0x1a9243){return function(_0x3926ea){if(_0x3926ea){return _0x3926ea[_0x256f('0x1d')](_0x4d046c)[_0x256f('0x1e')](function(_0x20833d){return _0x20833d;});}return null;};}function removeEntity(_0x1f9d7f,_0x3631db){return function(_0x156a44){if(_0x156a44){return _0x156a44[_0x256f('0x1f')]()[_0x256f('0x1e')](function(){_0x1f9d7f[_0x256f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255130,_0x3a749b){return function(_0xb3d3){if(!_0xb3d3){_0x255130['sendStatus'](0x194);}return _0xb3d3;};}function handleError(_0x2d1349,_0x4bcdb8){_0x4bcdb8=_0x4bcdb8||0x1f4;return function(_0x5d1703){logger['error'](_0x5d1703[_0x256f('0x21')]);if(_0x5d1703[_0x256f('0x22')]){delete _0x5d1703[_0x256f('0x22')];}_0x2d1349[_0x256f('0x20')](_0x4bcdb8)[_0x256f('0x23')](_0x5d1703);};}exports[_0x256f('0x24')]=function(_0x5cba83,_0x36d163){var _0x15fa1b={},_0x2c0604={},_0x2a572a={'count':0x0,'rows':[]};var _0x5b271d=_[_0x256f('0x25')](db[_0x256f('0x26')][_0x256f('0x27')],function(_0x1a1152){return{'name':_0x1a1152[_0x256f('0x28')],'type':_0x1a1152[_0x256f('0x29')][_0x256f('0x2a')]};});_0x2c0604['model']=_[_0x256f('0x25')](_0x5b271d,_0x256f('0x22'));_0x2c0604[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x5cba83[_0x256f('0x2b')]);_0x2c0604[_0x256f('0x2d')]=_['intersection'](_0x2c0604[_0x256f('0x2e')],_0x2c0604[_0x256f('0x2b')]);_0x15fa1b[_0x256f('0x2f')]=_['intersection'](_0x2c0604[_0x256f('0x2e')],qs['fields'](_0x5cba83['query']['fields']));_0x15fa1b[_0x256f('0x2f')]=_0x15fa1b[_0x256f('0x2f')][_0x256f('0x30')]?_0x15fa1b[_0x256f('0x2f')]:_0x2c0604[_0x256f('0x2e')];if(!_0x5cba83[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x15fa1b[_0x256f('0x19')]=qs['limit'](_0x5cba83[_0x256f('0x2b')][_0x256f('0x19')]);_0x15fa1b['offset']=qs[_0x256f('0x17')](_0x5cba83[_0x256f('0x2b')][_0x256f('0x17')]);}_0x15fa1b['order']=qs['sort'](_0x5cba83[_0x256f('0x2b')]['sort']);_0x15fa1b['where']=qs[_0x256f('0x2d')](_[_0x256f('0x33')](_0x5cba83[_0x256f('0x2b')],_0x2c0604['filters']),_0x5b271d);if(_0x5cba83['query'][_0x256f('0x34')]){_0x15fa1b[_0x256f('0x35')]=_[_0x256f('0x36')](_0x15fa1b['where'],{'$or':_['map'](_0x5b271d,function(_0x1c6cf1){if(_0x1c6cf1['type']!=='VIRTUAL'){var _0xf186b={};_0xf186b[_0x1c6cf1[_0x256f('0x22')]]={'$like':'%'+_0x5cba83['query']['filter']+'%'};return _0xf186b;}})});}_0x15fa1b=_['merge']({},_0x15fa1b,_0x5cba83[_0x256f('0x37')]);var _0x593563={'where':_0x15fa1b[_0x256f('0x35')]};return db[_0x256f('0x26')][_0x256f('0x38')](_0x593563)[_0x256f('0x1e')](function(_0x593d18){_0x2a572a['count']=_0x593d18;if(_0x5cba83['query'][_0x256f('0x39')]){_0x15fa1b[_0x256f('0x3a')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x15fa1b);})[_0x256f('0x1e')](function(_0x4d49e1){_0x2a572a['rows']=_0x4d49e1;return _0x2a572a;})[_0x256f('0x1e')](respondWithFilteredResult(_0x36d163,_0x15fa1b))[_0x256f('0x3b')](handleError(_0x36d163,null));};exports['show']=function(_0x3848eb,_0x12dabe){var _0x3a21d8={'raw':![],'where':{'id':_0x3848eb[_0x256f('0x3c')]['id']}},_0x5f07ca={};_0x5f07ca[_0x256f('0x2e')]=_[_0x256f('0x2c')](db['ServicenowConfiguration'][_0x256f('0x27')]);_0x5f07ca[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x3848eb[_0x256f('0x2b')]);_0x5f07ca[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x5f07ca[_0x256f('0x2e')],_0x5f07ca['query']);_0x3a21d8[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x5f07ca[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3848eb['query']['fields']));_0x3a21d8[_0x256f('0x2f')]=_0x3a21d8['attributes'][_0x256f('0x30')]?_0x3a21d8[_0x256f('0x2f')]:_0x5f07ca[_0x256f('0x2e')];if(_0x3848eb[_0x256f('0x2b')]['includeAll']){_0x3a21d8['include']=[{'all':!![]}];}_0x3a21d8=_[_0x256f('0x36')]({},_0x3a21d8,_0x3848eb[_0x256f('0x37')]);return db[_0x256f('0x26')][_0x256f('0x3f')](_0x3a21d8)['then'](handleEntityNotFound(_0x12dabe,null))[_0x256f('0x1e')](respondWithResult(_0x12dabe,null))[_0x256f('0x3b')](handleError(_0x12dabe,null));};exports[_0x256f('0x40')]=function(_0x162faf,_0x235cba){return db[_0x256f('0x26')]['create'](_0x162faf[_0x256f('0x41')],{})[_0x256f('0x1e')](respondWithResult(_0x235cba,0xc9))['catch'](handleError(_0x235cba,null));};exports[_0x256f('0x1d')]=function(_0x21ae1a,_0xf164f4){if(_0x21ae1a[_0x256f('0x41')]['id']){delete _0x21ae1a['body']['id'];}return db[_0x256f('0x26')][_0x256f('0x3f')]({'where':{'id':_0x21ae1a[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0xf164f4,null))[_0x256f('0x1e')](saveUpdates(_0x21ae1a[_0x256f('0x41')],null))[_0x256f('0x1e')](respondWithResult(_0xf164f4,null))[_0x256f('0x3b')](handleError(_0xf164f4,null));};exports[_0x256f('0x1f')]=function(_0x1ec81e,_0x44ab01){return db[_0x256f('0x26')]['find']({'where':{'id':_0x1ec81e[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x44ab01,null))[_0x256f('0x1e')](removeEntity(_0x44ab01,null))[_0x256f('0x3b')](handleError(_0x44ab01,null));};exports[_0x256f('0x42')]=function(_0x3943ba,_0x30cbc0,_0x161f70){var _0x101cb3={};var _0x23758b={};var _0x21ea85;var _0x2cd53b;return db[_0x256f('0x26')][_0x256f('0x43')]({'where':{'id':_0x3943ba[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x30cbc0,null))[_0x256f('0x1e')](function(_0x38171d){if(_0x38171d){_0x21ea85=_0x38171d;_0x23758b[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x23758b['query']=_['keys'](_0x3943ba[_0x256f('0x2b')]);_0x23758b[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x23758b[_0x256f('0x2e')],_0x23758b[_0x256f('0x2b')]);_0x101cb3['attributes']=_['intersection'](_0x23758b[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3943ba['query']['fields']));_0x101cb3[_0x256f('0x2f')]=_0x101cb3[_0x256f('0x2f')][_0x256f('0x30')]?_0x101cb3[_0x256f('0x2f')]:_0x23758b[_0x256f('0x2e')];_0x101cb3['order']=qs[_0x256f('0x45')](_0x3943ba[_0x256f('0x2b')][_0x256f('0x45')]);_0x101cb3['where']=qs[_0x256f('0x2d')](_[_0x256f('0x33')](_0x3943ba[_0x256f('0x2b')],_0x23758b[_0x256f('0x2d')]));if(_0x3943ba[_0x256f('0x2b')]['filter']){_0x101cb3[_0x256f('0x35')]=_['merge'](_0x101cb3['where'],{'$or':_[_0x256f('0x25')](_0x101cb3[_0x256f('0x2f')],function(_0x5f1636){var _0x547aee={};_0x547aee[_0x5f1636]={'$like':'%'+_0x3943ba[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x547aee;})});}_0x101cb3=_[_0x256f('0x36')]({},_0x101cb3,_0x3943ba['options']);return _0x21ea85[_0x256f('0x42')](_0x101cb3);}})['then'](function(_0x1deca8){if(_0x1deca8){_0x2cd53b=_0x1deca8[_0x256f('0x30')];if(!_0x3943ba[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x101cb3[_0x256f('0x19')]=qs[_0x256f('0x19')](_0x3943ba[_0x256f('0x2b')][_0x256f('0x19')]);_0x101cb3['offset']=qs['offset'](_0x3943ba[_0x256f('0x2b')][_0x256f('0x17')]);}return _0x21ea85[_0x256f('0x42')](_0x101cb3);}})['then'](function(_0x1539b2){if(_0x1539b2){return _0x1539b2?{'count':_0x2cd53b,'rows':_0x1539b2}:null;}})[_0x256f('0x1e')](respondWithResult(_0x30cbc0,null))[_0x256f('0x3b')](handleError(_0x30cbc0,null));};exports[_0x256f('0x46')]=function(_0x56169e,_0x3bc764,_0x1ff38b){var _0x4c8609={};var _0x2ec2f5={};var _0x1c7cf1;var _0x4cd401;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x56169e[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x3bc764,null))[_0x256f('0x1e')](function(_0x9cda94){if(_0x9cda94){_0x1c7cf1=_0x9cda94;_0x2ec2f5[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x2ec2f5['query']=_[_0x256f('0x2c')](_0x56169e[_0x256f('0x2b')]);_0x2ec2f5[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x2ec2f5[_0x256f('0x2e')],_0x2ec2f5[_0x256f('0x2b')]);_0x4c8609[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x2ec2f5[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x56169e[_0x256f('0x2b')][_0x256f('0x3e')]));_0x4c8609['attributes']=_0x4c8609[_0x256f('0x2f')]['length']?_0x4c8609[_0x256f('0x2f')]:_0x2ec2f5['model'];_0x4c8609[_0x256f('0x47')]=qs[_0x256f('0x45')](_0x56169e['query'][_0x256f('0x45')]);_0x4c8609['where']=qs[_0x256f('0x2d')](_['pick'](_0x56169e[_0x256f('0x2b')],_0x2ec2f5[_0x256f('0x2d')]));if(_0x56169e['query'][_0x256f('0x34')]){_0x4c8609[_0x256f('0x35')]=_[_0x256f('0x36')](_0x4c8609[_0x256f('0x35')],{'$or':_[_0x256f('0x25')](_0x4c8609[_0x256f('0x2f')],function(_0x2c1f44){var _0x40d394={};_0x40d394[_0x2c1f44]={'$like':'%'+_0x56169e[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x40d394;})});}_0x4c8609=_['merge']({},_0x4c8609,_0x56169e[_0x256f('0x37')]);return _0x1c7cf1[_0x256f('0x46')](_0x4c8609);}})[_0x256f('0x1e')](function(_0x42fde9){if(_0x42fde9){_0x4cd401=_0x42fde9[_0x256f('0x30')];if(!_0x56169e[_0x256f('0x2b')]['hasOwnProperty']('nolimit')){_0x4c8609[_0x256f('0x19')]=qs[_0x256f('0x19')](_0x56169e[_0x256f('0x2b')][_0x256f('0x19')]);_0x4c8609['offset']=qs[_0x256f('0x17')](_0x56169e[_0x256f('0x2b')][_0x256f('0x17')]);}return _0x1c7cf1[_0x256f('0x46')](_0x4c8609);}})['then'](function(_0x186be9){if(_0x186be9){return _0x186be9?{'count':_0x4cd401,'rows':_0x186be9}:null;}})[_0x256f('0x1e')](respondWithResult(_0x3bc764,null))[_0x256f('0x3b')](handleError(_0x3bc764,null));};exports[_0x256f('0x48')]=function(_0x3aa8f8,_0x2cad1d,_0x20445d){var _0x21f206={};var _0x55a2a5={};var _0x453800;var _0xd91849;return db['ServicenowConfiguration'][_0x256f('0x43')]({'where':{'id':_0x3aa8f8[_0x256f('0x3c')]['id']}})[_0x256f('0x1e')](handleEntityNotFound(_0x2cad1d,null))['then'](function(_0x1334ce){if(_0x1334ce){_0x453800=_0x1334ce;_0x55a2a5[_0x256f('0x2e')]=_[_0x256f('0x2c')](db[_0x256f('0x44')][_0x256f('0x27')]);_0x55a2a5[_0x256f('0x2b')]=_[_0x256f('0x2c')](_0x3aa8f8['query']);_0x55a2a5[_0x256f('0x2d')]=_[_0x256f('0x3d')](_0x55a2a5[_0x256f('0x2e')],_0x55a2a5[_0x256f('0x2b')]);_0x21f206[_0x256f('0x2f')]=_[_0x256f('0x3d')](_0x55a2a5[_0x256f('0x2e')],qs[_0x256f('0x3e')](_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x3e')]));_0x21f206[_0x256f('0x2f')]=_0x21f206[_0x256f('0x2f')]['length']?_0x21f206['attributes']:_0x55a2a5[_0x256f('0x2e')];_0x21f206[_0x256f('0x47')]=qs[_0x256f('0x45')](_0x3aa8f8['query'][_0x256f('0x45')]);_0x21f206[_0x256f('0x35')]=qs[_0x256f('0x2d')](_['pick'](_0x3aa8f8[_0x256f('0x2b')],_0x55a2a5[_0x256f('0x2d')]));if(_0x3aa8f8[_0x256f('0x2b')]['filter']){_0x21f206[_0x256f('0x35')]=_[_0x256f('0x36')](_0x21f206[_0x256f('0x35')],{'$or':_[_0x256f('0x25')](_0x21f206['attributes'],function(_0x232557){var _0x3715a2={};_0x3715a2[_0x232557]={'$like':'%'+_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x34')]+'%'};return _0x3715a2;})});}_0x21f206=_[_0x256f('0x36')]({},_0x21f206,_0x3aa8f8['options']);return _0x453800[_0x256f('0x48')](_0x21f206);}})[_0x256f('0x1e')](function(_0x3be6a1){if(_0x3be6a1){_0xd91849=_0x3be6a1[_0x256f('0x30')];if(!_0x3aa8f8[_0x256f('0x2b')][_0x256f('0x31')](_0x256f('0x32'))){_0x21f206[_0x256f('0x19')]=qs['limit'](_0x3aa8f8[_0x256f('0x2b')]['limit']);_0x21f206[_0x256f('0x17')]=qs[_0x256f('0x17')](_0x3aa8f8['query'][_0x256f('0x17')]);}return _0x453800[_0x256f('0x48')](_0x21f206);}})[_0x256f('0x1e')](function(_0x3dac6b){if(_0x3dac6b){return _0x3dac6b?{'count':_0xd91849,'rows':_0x3dac6b}:null;}})[_0x256f('0x1e')](respondWithResult(_0x2cad1d,null))[_0x256f('0x3b')](handleError(_0x2cad1d,null));}; \ No newline at end of file +var _0x5749=['fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','filters','find','create','body','getFields','findOne','pick','options','getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','ServicenowConfiguration','rawAttributes'];(function(_0x113cf9,_0x358825){var _0x5842ad=function(_0x1b55da){while(--_0x1b55da){_0x113cf9['push'](_0x113cf9['shift']());}};_0x5842ad(++_0x358825);}(_0x5749,0x77));var _0x9574=function(_0x2540cb,_0x5f4195){_0x2540cb=_0x2540cb-0x0;var _0x45cbeb=_0x5749[_0x2540cb];return _0x45cbeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9574('0x0'));var zipdir=require(_0x9574('0x1'));var jsonpatch=require(_0x9574('0x2'));var rp=require(_0x9574('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9574('0x4'));var util=require(_0x9574('0x5'));var path=require(_0x9574('0x6'));var sox=require(_0x9574('0x7'));var csv=require(_0x9574('0x8'));var ejs=require(_0x9574('0x9'));var fs=require('fs');var fs_extra=require(_0x9574('0xa'));var _=require(_0x9574('0xb'));var squel=require('squel');var crypto=require(_0x9574('0xc'));var jsforce=require(_0x9574('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9574('0x8'));var querystring=require(_0x9574('0xe'));var Papa=require(_0x9574('0xf'));var Redis=require(_0x9574('0x10'));var authService=require(_0x9574('0x11'));var qs=require(_0x9574('0x12'));var as=require(_0x9574('0x13'));var hardwareService=require(_0x9574('0x14'));var logger=require(_0x9574('0x15'))('api');var utils=require(_0x9574('0x16'));var config=require(_0x9574('0x17'));var licenseUtil=require(_0x9574('0x18'));var db=require(_0x9574('0x19'))['db'];function respondWithStatusCode(_0x4f7eda,_0x26de21){_0x26de21=_0x26de21||0xcc;return function(_0x6bfbf1){if(_0x6bfbf1){return _0x4f7eda['sendStatus'](_0x26de21);}return _0x4f7eda[_0x9574('0x1a')](_0x26de21)[_0x9574('0x1b')]();};}function respondWithResult(_0x542522,_0x43f42a){_0x43f42a=_0x43f42a||0xc8;return function(_0x3b6ac1){if(_0x3b6ac1){return _0x542522[_0x9574('0x1a')](_0x43f42a)[_0x9574('0x1c')](_0x3b6ac1);}};}function respondWithFilteredResult(_0x1dde4d,_0x49375e){return function(_0x3f08ef){if(_0x3f08ef){var _0x43ed05=typeof _0x49375e[_0x9574('0x1d')]===_0x9574('0x1e')&&typeof _0x49375e[_0x9574('0x1f')]==='undefined';var _0x5c7c07=_0x3f08ef['count'];var _0x5541c5=_0x43ed05?0x0:_0x49375e[_0x9574('0x1d')];var _0xbb7be=_0x43ed05?_0x3f08ef[_0x9574('0x20')]:_0x49375e[_0x9574('0x1d')]+_0x49375e[_0x9574('0x1f')];var _0xeb8a39;if(_0xbb7be>=_0x5c7c07){_0xbb7be=_0x5c7c07;_0xeb8a39=0xc8;}else{_0xeb8a39=0xce;}_0x1dde4d['status'](_0xeb8a39);return _0x1dde4d[_0x9574('0x21')](_0x9574('0x22'),_0x5541c5+'-'+_0xbb7be+'/'+_0x5c7c07)['json'](_0x3f08ef);}return null;};}function patchUpdates(_0x4c2c7f){return function(_0x1025e6){try{jsonpatch[_0x9574('0x23')](_0x1025e6,_0x4c2c7f,!![]);}catch(_0x41ce2e){return BPromise['reject'](_0x41ce2e);}return _0x1025e6[_0x9574('0x24')]();};}function saveUpdates(_0x3edc97,_0x543cf6){return function(_0x727885){if(_0x727885){return _0x727885[_0x9574('0x25')](_0x3edc97)[_0x9574('0x26')](function(_0xf9e208){return _0xf9e208;});}return null;};}function removeEntity(_0x136182,_0xe4f10b){return function(_0x20aab2){if(_0x20aab2){return _0x20aab2[_0x9574('0x27')]()[_0x9574('0x26')](function(){_0x136182[_0x9574('0x1a')](0xcc)[_0x9574('0x1b')]();});}};}function handleEntityNotFound(_0x382de9,_0x58ed05){return function(_0x1a0e45){if(!_0x1a0e45){_0x382de9[_0x9574('0x28')](0x194);}return _0x1a0e45;};}function handleError(_0x973f0a,_0x48b0d7){_0x48b0d7=_0x48b0d7||0x1f4;return function(_0x4f0484){logger[_0x9574('0x29')](_0x4f0484['stack']);if(_0x4f0484[_0x9574('0x2a')]){delete _0x4f0484[_0x9574('0x2a')];}_0x973f0a[_0x9574('0x1a')](_0x48b0d7)[_0x9574('0x2b')](_0x4f0484);};}exports[_0x9574('0x2c')]=function(_0xbb6d1a,_0xf2482f){var _0x4c962f={},_0x50a0e8={},_0x55afd3={'count':0x0,'rows':[]};var _0x5a5411=_['map'](db[_0x9574('0x2d')][_0x9574('0x2e')],function(_0x1893a0){return{'name':_0x1893a0[_0x9574('0x2f')],'type':_0x1893a0[_0x9574('0x30')]['key']};});_0x50a0e8[_0x9574('0x31')]=_['map'](_0x5a5411,_0x9574('0x2a'));_0x50a0e8['query']=_['keys'](_0xbb6d1a[_0x9574('0x32')]);_0x50a0e8['filters']=_[_0x9574('0x33')](_0x50a0e8[_0x9574('0x31')],_0x50a0e8[_0x9574('0x32')]);_0x4c962f['attributes']=_[_0x9574('0x33')](_0x50a0e8[_0x9574('0x31')],qs[_0x9574('0x34')](_0xbb6d1a[_0x9574('0x32')][_0x9574('0x34')]));_0x4c962f[_0x9574('0x35')]=_0x4c962f['attributes'][_0x9574('0x36')]?_0x4c962f[_0x9574('0x35')]:_0x50a0e8[_0x9574('0x31')];if(!_0xbb6d1a['query'][_0x9574('0x37')](_0x9574('0x38'))){_0x4c962f[_0x9574('0x1f')]=qs[_0x9574('0x1f')](_0xbb6d1a[_0x9574('0x32')][_0x9574('0x1f')]);_0x4c962f['offset']=qs[_0x9574('0x1d')](_0xbb6d1a['query'][_0x9574('0x1d')]);}_0x4c962f[_0x9574('0x39')]=qs[_0x9574('0x3a')](_0xbb6d1a['query']['sort']);_0x4c962f[_0x9574('0x3b')]=qs['filters'](_['pick'](_0xbb6d1a[_0x9574('0x32')],_0x50a0e8['filters']),_0x5a5411);if(_0xbb6d1a[_0x9574('0x32')][_0x9574('0x3c')]){_0x4c962f[_0x9574('0x3b')]=_[_0x9574('0x3d')](_0x4c962f[_0x9574('0x3b')],{'$or':_[_0x9574('0x3e')](_0x5a5411,function(_0x299951){if(_0x299951[_0x9574('0x30')]!==_0x9574('0x3f')){var _0x6837e1={};_0x6837e1[_0x299951[_0x9574('0x2a')]]={'$like':'%'+_0xbb6d1a[_0x9574('0x32')][_0x9574('0x3c')]+'%'};return _0x6837e1;}})});}_0x4c962f=_[_0x9574('0x3d')]({},_0x4c962f,_0xbb6d1a['options']);var _0x1556b4={'where':_0x4c962f[_0x9574('0x3b')]};return db['ServicenowConfiguration']['count'](_0x1556b4)[_0x9574('0x26')](function(_0x5bfd2e){_0x55afd3[_0x9574('0x20')]=_0x5bfd2e;if(_0xbb6d1a[_0x9574('0x32')][_0x9574('0x40')]){_0x4c962f[_0x9574('0x41')]=[{'all':!![]}];}return db[_0x9574('0x2d')][_0x9574('0x42')](_0x4c962f);})['then'](function(_0x21bc8f){_0x55afd3[_0x9574('0x43')]=_0x21bc8f;return _0x55afd3;})[_0x9574('0x26')](respondWithFilteredResult(_0xf2482f,_0x4c962f))[_0x9574('0x44')](handleError(_0xf2482f,null));};exports[_0x9574('0x45')]=function(_0x2c33f0,_0x5d4cc5){var _0x1276c1={'raw':![],'where':{'id':_0x2c33f0[_0x9574('0x46')]['id']}},_0x44157a={};_0x44157a[_0x9574('0x31')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x44157a[_0x9574('0x32')]=_[_0x9574('0x47')](_0x2c33f0['query']);_0x44157a[_0x9574('0x48')]=_['intersection'](_0x44157a[_0x9574('0x31')],_0x44157a[_0x9574('0x32')]);_0x1276c1[_0x9574('0x35')]=_[_0x9574('0x33')](_0x44157a[_0x9574('0x31')],qs[_0x9574('0x34')](_0x2c33f0[_0x9574('0x32')][_0x9574('0x34')]));_0x1276c1[_0x9574('0x35')]=_0x1276c1[_0x9574('0x35')]['length']?_0x1276c1[_0x9574('0x35')]:_0x44157a[_0x9574('0x31')];if(_0x2c33f0['query'][_0x9574('0x40')]){_0x1276c1[_0x9574('0x41')]=[{'all':!![]}];}_0x1276c1=_[_0x9574('0x3d')]({},_0x1276c1,_0x2c33f0['options']);return db[_0x9574('0x2d')][_0x9574('0x49')](_0x1276c1)[_0x9574('0x26')](handleEntityNotFound(_0x5d4cc5,null))[_0x9574('0x26')](respondWithResult(_0x5d4cc5,null))[_0x9574('0x44')](handleError(_0x5d4cc5,null));};exports[_0x9574('0x4a')]=function(_0x53913c,_0x2b1d63){return db['ServicenowConfiguration']['create'](_0x53913c[_0x9574('0x4b')],{})[_0x9574('0x26')](respondWithResult(_0x2b1d63,0xc9))[_0x9574('0x44')](handleError(_0x2b1d63,null));};exports[_0x9574('0x25')]=function(_0x58c65e,_0x50eea2){if(_0x58c65e[_0x9574('0x4b')]['id']){delete _0x58c65e[_0x9574('0x4b')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x58c65e[_0x9574('0x46')]['id']}})[_0x9574('0x26')](handleEntityNotFound(_0x50eea2,null))[_0x9574('0x26')](saveUpdates(_0x58c65e[_0x9574('0x4b')],null))[_0x9574('0x26')](respondWithResult(_0x50eea2,null))[_0x9574('0x44')](handleError(_0x50eea2,null));};exports[_0x9574('0x27')]=function(_0x15e496,_0x2b1e4c){return db[_0x9574('0x2d')][_0x9574('0x49')]({'where':{'id':_0x15e496[_0x9574('0x46')]['id']}})[_0x9574('0x26')](handleEntityNotFound(_0x2b1e4c,null))[_0x9574('0x26')](removeEntity(_0x2b1e4c,null))[_0x9574('0x44')](handleError(_0x2b1e4c,null));};exports[_0x9574('0x4c')]=function(_0x272954,_0x25eccb,_0x3f614b){var _0x33f29a={};var _0x27461f={};var _0x1e50b8;var _0x3e5208;return db[_0x9574('0x2d')][_0x9574('0x4d')]({'where':{'id':_0x272954[_0x9574('0x46')]['id']}})[_0x9574('0x26')](handleEntityNotFound(_0x25eccb,null))['then'](function(_0x14eba7){if(_0x14eba7){_0x1e50b8=_0x14eba7;_0x27461f['model']=_[_0x9574('0x47')](db['ServicenowField'][_0x9574('0x2e')]);_0x27461f[_0x9574('0x32')]=_['keys'](_0x272954['query']);_0x27461f['filters']=_[_0x9574('0x33')](_0x27461f[_0x9574('0x31')],_0x27461f[_0x9574('0x32')]);_0x33f29a[_0x9574('0x35')]=_[_0x9574('0x33')](_0x27461f[_0x9574('0x31')],qs[_0x9574('0x34')](_0x272954[_0x9574('0x32')][_0x9574('0x34')]));_0x33f29a[_0x9574('0x35')]=_0x33f29a[_0x9574('0x35')][_0x9574('0x36')]?_0x33f29a[_0x9574('0x35')]:_0x27461f[_0x9574('0x31')];_0x33f29a['order']=qs[_0x9574('0x3a')](_0x272954[_0x9574('0x32')][_0x9574('0x3a')]);_0x33f29a['where']=qs[_0x9574('0x48')](_[_0x9574('0x4e')](_0x272954[_0x9574('0x32')],_0x27461f[_0x9574('0x48')]));if(_0x272954[_0x9574('0x32')][_0x9574('0x3c')]){_0x33f29a['where']=_[_0x9574('0x3d')](_0x33f29a[_0x9574('0x3b')],{'$or':_[_0x9574('0x3e')](_0x33f29a[_0x9574('0x35')],function(_0x537315){var _0x213283={};_0x213283[_0x537315]={'$like':'%'+_0x272954[_0x9574('0x32')][_0x9574('0x3c')]+'%'};return _0x213283;})});}_0x33f29a=_[_0x9574('0x3d')]({},_0x33f29a,_0x272954[_0x9574('0x4f')]);return _0x1e50b8[_0x9574('0x4c')](_0x33f29a);}})[_0x9574('0x26')](function(_0x1223b1){if(_0x1223b1){_0x3e5208=_0x1223b1[_0x9574('0x36')];if(!_0x272954[_0x9574('0x32')][_0x9574('0x37')](_0x9574('0x38'))){_0x33f29a[_0x9574('0x1f')]=qs[_0x9574('0x1f')](_0x272954['query'][_0x9574('0x1f')]);_0x33f29a[_0x9574('0x1d')]=qs['offset'](_0x272954[_0x9574('0x32')][_0x9574('0x1d')]);}return _0x1e50b8['getFields'](_0x33f29a);}})[_0x9574('0x26')](function(_0x104ca3){if(_0x104ca3){return _0x104ca3?{'count':_0x3e5208,'rows':_0x104ca3}:null;}})[_0x9574('0x26')](respondWithResult(_0x25eccb,null))[_0x9574('0x44')](handleError(_0x25eccb,null));};exports[_0x9574('0x50')]=function(_0x3fa795,_0xbdbb73,_0x5c7c42){var _0x4bfd9a={};var _0x2ef084={};var _0x50e4e3;var _0x4046bf;return db[_0x9574('0x2d')][_0x9574('0x4d')]({'where':{'id':_0x3fa795[_0x9574('0x46')]['id']}})[_0x9574('0x26')](handleEntityNotFound(_0xbdbb73,null))[_0x9574('0x26')](function(_0x4db2dc){if(_0x4db2dc){_0x50e4e3=_0x4db2dc;_0x2ef084[_0x9574('0x31')]=_[_0x9574('0x47')](db[_0x9574('0x51')]['rawAttributes']);_0x2ef084['query']=_[_0x9574('0x47')](_0x3fa795[_0x9574('0x32')]);_0x2ef084['filters']=_[_0x9574('0x33')](_0x2ef084[_0x9574('0x31')],_0x2ef084[_0x9574('0x32')]);_0x4bfd9a[_0x9574('0x35')]=_[_0x9574('0x33')](_0x2ef084['model'],qs[_0x9574('0x34')](_0x3fa795['query'][_0x9574('0x34')]));_0x4bfd9a['attributes']=_0x4bfd9a[_0x9574('0x35')][_0x9574('0x36')]?_0x4bfd9a['attributes']:_0x2ef084[_0x9574('0x31')];_0x4bfd9a[_0x9574('0x39')]=qs[_0x9574('0x3a')](_0x3fa795['query']['sort']);_0x4bfd9a[_0x9574('0x3b')]=qs[_0x9574('0x48')](_[_0x9574('0x4e')](_0x3fa795[_0x9574('0x32')],_0x2ef084[_0x9574('0x48')]));if(_0x3fa795['query'][_0x9574('0x3c')]){_0x4bfd9a[_0x9574('0x3b')]=_[_0x9574('0x3d')](_0x4bfd9a[_0x9574('0x3b')],{'$or':_[_0x9574('0x3e')](_0x4bfd9a['attributes'],function(_0x4ca1b5){var _0x34270a={};_0x34270a[_0x4ca1b5]={'$like':'%'+_0x3fa795[_0x9574('0x32')][_0x9574('0x3c')]+'%'};return _0x34270a;})});}_0x4bfd9a=_[_0x9574('0x3d')]({},_0x4bfd9a,_0x3fa795['options']);return _0x50e4e3['getSubjects'](_0x4bfd9a);}})[_0x9574('0x26')](function(_0x26e8b9){if(_0x26e8b9){_0x4046bf=_0x26e8b9['length'];if(!_0x3fa795[_0x9574('0x32')][_0x9574('0x37')](_0x9574('0x38'))){_0x4bfd9a[_0x9574('0x1f')]=qs[_0x9574('0x1f')](_0x3fa795[_0x9574('0x32')][_0x9574('0x1f')]);_0x4bfd9a['offset']=qs['offset'](_0x3fa795[_0x9574('0x32')][_0x9574('0x1d')]);}return _0x50e4e3['getSubjects'](_0x4bfd9a);}})['then'](function(_0x50415f){if(_0x50415f){return _0x50415f?{'count':_0x4046bf,'rows':_0x50415f}:null;}})[_0x9574('0x26')](respondWithResult(_0xbdbb73,null))[_0x9574('0x44')](handleError(_0xbdbb73,null));};exports['getDescriptions']=function(_0x33a8c4,_0xe3c9e6,_0x3d6928){var _0x12c4eb={};var _0x274ce8={};var _0xa9c192;var _0x4fffb6;return db[_0x9574('0x2d')][_0x9574('0x4d')]({'where':{'id':_0x33a8c4[_0x9574('0x46')]['id']}})[_0x9574('0x26')](handleEntityNotFound(_0xe3c9e6,null))[_0x9574('0x26')](function(_0x289818){if(_0x289818){_0xa9c192=_0x289818;_0x274ce8['model']=_[_0x9574('0x47')](db['ServicenowField'][_0x9574('0x2e')]);_0x274ce8[_0x9574('0x32')]=_[_0x9574('0x47')](_0x33a8c4[_0x9574('0x32')]);_0x274ce8['filters']=_[_0x9574('0x33')](_0x274ce8[_0x9574('0x31')],_0x274ce8['query']);_0x12c4eb[_0x9574('0x35')]=_['intersection'](_0x274ce8[_0x9574('0x31')],qs['fields'](_0x33a8c4[_0x9574('0x32')]['fields']));_0x12c4eb[_0x9574('0x35')]=_0x12c4eb['attributes'][_0x9574('0x36')]?_0x12c4eb['attributes']:_0x274ce8[_0x9574('0x31')];_0x12c4eb[_0x9574('0x39')]=qs['sort'](_0x33a8c4['query'][_0x9574('0x3a')]);_0x12c4eb[_0x9574('0x3b')]=qs[_0x9574('0x48')](_[_0x9574('0x4e')](_0x33a8c4[_0x9574('0x32')],_0x274ce8[_0x9574('0x48')]));if(_0x33a8c4['query'][_0x9574('0x3c')]){_0x12c4eb[_0x9574('0x3b')]=_[_0x9574('0x3d')](_0x12c4eb['where'],{'$or':_[_0x9574('0x3e')](_0x12c4eb[_0x9574('0x35')],function(_0x280de3){var _0x2fd876={};_0x2fd876[_0x280de3]={'$like':'%'+_0x33a8c4[_0x9574('0x32')][_0x9574('0x3c')]+'%'};return _0x2fd876;})});}_0x12c4eb=_[_0x9574('0x3d')]({},_0x12c4eb,_0x33a8c4[_0x9574('0x4f')]);return _0xa9c192[_0x9574('0x52')](_0x12c4eb);}})['then'](function(_0xd5c1a){if(_0xd5c1a){_0x4fffb6=_0xd5c1a[_0x9574('0x36')];if(!_0x33a8c4[_0x9574('0x32')][_0x9574('0x37')](_0x9574('0x38'))){_0x12c4eb['limit']=qs[_0x9574('0x1f')](_0x33a8c4[_0x9574('0x32')]['limit']);_0x12c4eb['offset']=qs[_0x9574('0x1d')](_0x33a8c4[_0x9574('0x32')][_0x9574('0x1d')]);}return _0xa9c192[_0x9574('0x52')](_0x12c4eb);}})[_0x9574('0x26')](function(_0x3bdb60){if(_0x3bdb60){return _0x3bdb60?{'count':_0x4fffb6,'rows':_0x3bdb60}:null;}})[_0x9574('0x26')](respondWithResult(_0xe3c9e6,null))[_0x9574('0x44')](handleError(_0xe3c9e6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 64f3c66..efbb2f3 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f2f=['int_servicenow_configurations','lodash','util','bluebird','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x3fd108,_0x5d911f){var _0x4f943f=function(_0x12abdf){while(--_0x12abdf){_0x3fd108['push'](_0x3fd108['shift']());}};_0x4f943f(++_0x5d911f);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6f2f[_0x474bc0];return _0x4b24cf;};'use strict';var _=require(_0xf6f2('0x0'));var util=require(_0xf6f2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf6f2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x3'));var config=require(_0xf6f2('0x4'));var attributes=require(_0xf6f2('0x5'));module['exports']=function(_0x5c540a,_0x1123bb){return _0x5c540a[_0xf6f2('0x6')](_0xf6f2('0x7'),attributes,{'tableName':_0xf6f2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d6=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','bluebird','request-promise','path','./intServicenowConfiguration.attributes','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x30d6,0x1b0));var _0x630d=function(_0xf466fc,_0xe6b550){_0xf466fc=_0xf466fc-0x0;var _0x1e6330=_0x30d6[_0xf466fc];return _0x1e6330;};'use strict';var _=require(_0x630d('0x0'));var util=require(_0x630d('0x1'));var logger=require('../../config/logger')(_0x630d('0x2'));var moment=require('moment');var BPromise=require(_0x630d('0x3'));var rp=require(_0x630d('0x4'));var fs=require('fs');var path=require(_0x630d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x630d('0x6'));module[_0x630d('0x7')]=function(_0x83b614,_0x5217c8){return _0x83b614[_0x630d('0x8')](_0x630d('0x9'),attributes,{'tableName':_0x630d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 59d6883..6b868b5 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x544f=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x399505,_0x8b6f35){var _0x1ad2d0=function(_0x3de0){while(--_0x3de0){_0x399505['push'](_0x399505['shift']());}};_0x1ad2d0(++_0x8b6f35);}(_0x544f,0x104));var _0xf544=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x544f[_0x211632];return _0x5a1da1;};'use strict';var _=require('lodash');var util=require(_0xf544('0x0'));var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf544('0x4'));var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ef09f,_0x56bc50,_0x12824a){return new BPromise(function(_0x17dd2b,_0x13cbea){return client['request'](_0x5ef09f,_0x12824a)[_0xf544('0x9')](function(_0x1a5ac3){logger[_0xf544('0xa')](_0xf544('0xb'),_0x56bc50,_0xf544('0xc'));logger[_0xf544('0xd')](_0xf544('0xe'),_0x56bc50,_0xf544('0xc'),JSON[_0xf544('0xf')](_0x1a5ac3));if(_0x1a5ac3[_0xf544('0x10')]){if(_0x1a5ac3[_0xf544('0x10')][_0xf544('0x11')]===0x1f4){logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x1a5ac3[_0xf544('0x10')][_0xf544('0x12')]);return _0x13cbea(_0x1a5ac3[_0xf544('0x10')][_0xf544('0x12')]);}logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x1a5ac3[_0xf544('0x10')]['message']);return _0x17dd2b(_0x1a5ac3['error'][_0xf544('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x56bc50,_0xf544('0xc'));_0x17dd2b(_0x1a5ac3[_0xf544('0x13')]['message']);}})[_0xf544('0x14')](function(_0x438b93){logger[_0xf544('0x10')](_0xf544('0xb'),_0x56bc50,_0x438b93);_0x13cbea(_0x438b93);});});} \ No newline at end of file +var _0xa3ea=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x69eda2,_0x26d9fc){var _0x3f8ec9=function(_0x37068f){while(--_0x37068f){_0x69eda2['push'](_0x69eda2['shift']());}};_0x3f8ec9(++_0x26d9fc);}(_0xa3ea,0x77));var _0xaa3e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa3ea[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xaa3e('0x0'));var util=require(_0xaa3e('0x1'));var moment=require(_0xaa3e('0x2'));var BPromise=require(_0xaa3e('0x3'));var rs=require(_0xaa3e('0x4'));var fs=require('fs');var Redis=require(_0xaa3e('0x5'));var db=require(_0xaa3e('0x6'))['db'];var utils=require(_0xaa3e('0x7'));var logger=require(_0xaa3e('0x8'))(_0xaa3e('0x9'));var config=require('../../config/environment');var jayson=require(_0xaa3e('0xa'));var client=jayson[_0xaa3e('0xb')][_0xaa3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d5ee0,_0x2c0f5a,_0x307100){return new BPromise(function(_0x898c0c,_0x3d293d){return client[_0xaa3e('0xd')](_0x2d5ee0,_0x307100)['then'](function(_0x7074f9){logger[_0xaa3e('0xe')](_0xaa3e('0xf'),_0x2c0f5a,_0xaa3e('0x10'));logger[_0xaa3e('0x11')](_0xaa3e('0x12'),_0x2c0f5a,'request\x20sent',JSON[_0xaa3e('0x13')](_0x7074f9));if(_0x7074f9[_0xaa3e('0x14')]){if(_0x7074f9[_0xaa3e('0x14')][_0xaa3e('0x15')]===0x1f4){logger[_0xaa3e('0x14')](_0xaa3e('0xf'),_0x2c0f5a,_0x7074f9['error'][_0xaa3e('0x16')]);return _0x3d293d(_0x7074f9[_0xaa3e('0x14')][_0xaa3e('0x16')]);}logger[_0xaa3e('0x14')](_0xaa3e('0xf'),_0x2c0f5a,_0x7074f9[_0xaa3e('0x14')]['message']);return _0x898c0c(_0x7074f9[_0xaa3e('0x14')][_0xaa3e('0x16')]);}else{logger['info'](_0xaa3e('0xf'),_0x2c0f5a,_0xaa3e('0x10'));_0x898c0c(_0x7074f9[_0xaa3e('0x17')][_0xaa3e('0x16')]);}})['catch'](function(_0xeefecc){logger[_0xaa3e('0x14')](_0xaa3e('0xf'),_0x2c0f5a,_0xeefecc);_0x3d293d(_0xeefecc);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 33abd9f..6c67d52 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeac=['update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x414f67,_0x861aed){var _0x338537=function(_0x4696fd){while(--_0x4696fd){_0x414f67['push'](_0x414f67['shift']());}};_0x338537(++_0x861aed);}(_0xaeac,0x1dd));var _0xcaea=function(_0x3dbc61,_0x4129f4){_0x3dbc61=_0x3dbc61-0x0;var _0x5578fb=_0xaeac[_0x3dbc61];return _0x5578fb;};'use strict';var multer=require(_0xcaea('0x0'));var util=require('util');var path=require(_0xcaea('0x1'));var timeout=require(_0xcaea('0x2'));var express=require(_0xcaea('0x3'));var router=express[_0xcaea('0x4')]();var fs_extra=require(_0xcaea('0x5'));var auth=require(_0xcaea('0x6'));var interaction=require(_0xcaea('0x7'));var config=require('../../config/environment');var controller=require(_0xcaea('0x8'));router['get']('/',auth[_0xcaea('0x9')](),controller[_0xcaea('0xa')]);router[_0xcaea('0xb')](_0xcaea('0xc'),auth[_0xcaea('0x9')](),controller[_0xcaea('0xd')]);router[_0xcaea('0xe')]('/',auth[_0xcaea('0x9')](),controller[_0xcaea('0xf')]);router[_0xcaea('0x10')]('/:id',auth[_0xcaea('0x9')](),controller[_0xcaea('0x11')]);router['delete'](_0xcaea('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcaea('0x12')]=router; \ No newline at end of file +var _0xdae3=['show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated'];(function(_0x41b386,_0x371386){var _0x6fc2d0=function(_0x539465){while(--_0x539465){_0x41b386['push'](_0x41b386['shift']());}};_0x6fc2d0(++_0x371386);}(_0xdae3,0x67));var _0x3dae=function(_0xa20b30,_0xf6ec1a){_0xa20b30=_0xa20b30-0x0;var _0x2a10a6=_0xdae3[_0xa20b30];return _0x2a10a6;};'use strict';var multer=require('multer');var util=require(_0x3dae('0x0'));var path=require(_0x3dae('0x1'));var timeout=require(_0x3dae('0x2'));var express=require(_0x3dae('0x3'));var router=express[_0x3dae('0x4')]();var fs_extra=require(_0x3dae('0x5'));var auth=require(_0x3dae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3dae('0x7'));var controller=require(_0x3dae('0x8'));router[_0x3dae('0x9')]('/',auth[_0x3dae('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3dae('0xb')]);router[_0x3dae('0xc')]('/',auth[_0x3dae('0xa')](),controller[_0x3dae('0xd')]);router[_0x3dae('0xe')](_0x3dae('0xf'),auth['isAuthenticated'](),controller[_0x3dae('0x10')]);router['delete'](_0x3dae('0xf'),auth['isAuthenticated'](),controller[_0x3dae('0x11')]);module[_0x3dae('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 4d72b96..ea0bbd2 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2906=['picklist','string','STRING','variable','sequelize','exports','ENUM','keyValue'];(function(_0x367885,_0x33be20){var _0x426e30=function(_0x526d3b){while(--_0x526d3b){_0x367885['push'](_0x367885['shift']());}};_0x426e30(++_0x33be20);}(_0x2906,0x124));var _0x6290=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0x2906[_0x31282b];return _0x19c632;};'use strict';var Sequelize=require(_0x6290('0x0'));module[_0x6290('0x1')]={'type':{'type':Sequelize[_0x6290('0x2')]('string','variable','customVariable',_0x6290('0x3'),_0x6290('0x4')),'defaultValue':_0x6290('0x5')},'content':{'type':Sequelize[_0x6290('0x6')]},'key':{'type':Sequelize[_0x6290('0x6')]},'keyType':{'type':Sequelize[_0x6290('0x2')](_0x6290('0x5'),_0x6290('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x6290('0x6')]},'idField':{'type':Sequelize[_0x6290('0x6')]},'nameField':{'type':Sequelize[_0x6290('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6290('0x6')]}}; \ No newline at end of file +var _0xb2bc=['sequelize','exports','string','variable','keyValue','STRING','customVariable','BOOLEAN'];(function(_0x24643f,_0x1d4148){var _0x27cb40=function(_0x5943a3){while(--_0x5943a3){_0x24643f['push'](_0x24643f['shift']());}};_0x27cb40(++_0x1d4148);}(_0xb2bc,0x68));var _0xcb2b=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0xb2bc[_0x230bb8];return _0x16cb9a;};'use strict';var Sequelize=require(_0xcb2b('0x0'));module[_0xcb2b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xcb2b('0x2'),_0xcb2b('0x3'),'customVariable',_0xcb2b('0x4'),'picklist'),'defaultValue':_0xcb2b('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcb2b('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xcb2b('0x3'),_0xcb2b('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcb2b('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcb2b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb2b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 15d884e..83283c8 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aec=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','then','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','length','create','body','destroy','find'];(function(_0x13437b,_0x1d0b36){var _0x49336e=function(_0x2ff46c){while(--_0x2ff46c){_0x13437b['push'](_0x13437b['shift']());}};_0x49336e(++_0x1d0b36);}(_0x7aec,0x1bc));var _0xc7ae=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x7aec[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xc7ae('0x0'));var rimraf=require(_0xc7ae('0x1'));var zipdir=require(_0xc7ae('0x2'));var jsonpatch=require(_0xc7ae('0x3'));var rp=require(_0xc7ae('0x4'));var moment=require('moment');var BPromise=require(_0xc7ae('0x5'));var Mustache=require('mustache');var util=require(_0xc7ae('0x6'));var path=require(_0xc7ae('0x7'));var sox=require(_0xc7ae('0x8'));var csv=require(_0xc7ae('0x9'));var ejs=require(_0xc7ae('0xa'));var fs=require('fs');var fs_extra=require(_0xc7ae('0xb'));var _=require('lodash');var squel=require(_0xc7ae('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc7ae('0xd'));var toCsv=require(_0xc7ae('0x9'));var querystring=require(_0xc7ae('0xe'));var Papa=require('papaparse');var Redis=require(_0xc7ae('0xf'));var authService=require(_0xc7ae('0x10'));var qs=require(_0xc7ae('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc7ae('0x12'));var logger=require(_0xc7ae('0x13'))(_0xc7ae('0x14'));var utils=require(_0xc7ae('0x15'));var config=require(_0xc7ae('0x16'));var licenseUtil=require(_0xc7ae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fde94,_0x588a9b){_0x588a9b=_0x588a9b||0xcc;return function(_0x1d2fce){if(_0x1d2fce){return _0x2fde94[_0xc7ae('0x18')](_0x588a9b);}return _0x2fde94[_0xc7ae('0x19')](_0x588a9b)[_0xc7ae('0x1a')]();};}function respondWithResult(_0x3c91f5,_0x599e2f){_0x599e2f=_0x599e2f||0xc8;return function(_0x15b067){if(_0x15b067){return _0x3c91f5[_0xc7ae('0x19')](_0x599e2f)['json'](_0x15b067);}};}function respondWithFilteredResult(_0x183c01,_0x31a8bc){return function(_0x219c46){if(_0x219c46){var _0x36d871=typeof _0x31a8bc['offset']===_0xc7ae('0x1b')&&typeof _0x31a8bc[_0xc7ae('0x1c')]===_0xc7ae('0x1b');var _0x1be005=_0x219c46['count'];var _0x3926f2=_0x36d871?0x0:_0x31a8bc[_0xc7ae('0x1d')];var _0x2cf0de=_0x36d871?_0x219c46[_0xc7ae('0x1e')]:_0x31a8bc[_0xc7ae('0x1d')]+_0x31a8bc[_0xc7ae('0x1c')];var _0x508705;if(_0x2cf0de>=_0x1be005){_0x2cf0de=_0x1be005;_0x508705=0xc8;}else{_0x508705=0xce;}_0x183c01['status'](_0x508705);return _0x183c01['set'](_0xc7ae('0x1f'),_0x3926f2+'-'+_0x2cf0de+'/'+_0x1be005)[_0xc7ae('0x20')](_0x219c46);}return null;};}function patchUpdates(_0x5236a3){return function(_0x48a67a){try{jsonpatch[_0xc7ae('0x21')](_0x48a67a,_0x5236a3,!![]);}catch(_0xd5d598){return BPromise[_0xc7ae('0x22')](_0xd5d598);}return _0x48a67a[_0xc7ae('0x23')]();};}function saveUpdates(_0x4edfa6,_0x555f4a){return function(_0x1e09e0){if(_0x1e09e0){return _0x1e09e0[_0xc7ae('0x24')](_0x4edfa6)['then'](function(_0x6319be){return _0x6319be;});}return null;};}function removeEntity(_0x2bff8e,_0x22bbf9){return function(_0x301d73){if(_0x301d73){return _0x301d73['destroy']()[_0xc7ae('0x25')](function(){_0x2bff8e['status'](0xcc)[_0xc7ae('0x1a')]();});}};}function handleEntityNotFound(_0x2ff1c0,_0x204da0){return function(_0x148bc2){if(!_0x148bc2){_0x2ff1c0[_0xc7ae('0x18')](0x194);}return _0x148bc2;};}function handleError(_0x465937,_0x126696){_0x126696=_0x126696||0x1f4;return function(_0x5cbb90){logger['error'](_0x5cbb90['stack']);if(_0x5cbb90['name']){delete _0x5cbb90[_0xc7ae('0x26')];}_0x465937[_0xc7ae('0x19')](_0x126696)[_0xc7ae('0x27')](_0x5cbb90);};}exports[_0xc7ae('0x28')]=function(_0x5090b5,_0x1af74d){var _0x15caf2={},_0x2a5af6={},_0x1a4fa5={'count':0x0,'rows':[]};var _0xd06ece=_[_0xc7ae('0x29')](db[_0xc7ae('0x2a')][_0xc7ae('0x2b')],function(_0x17bce6){return{'name':_0x17bce6[_0xc7ae('0x2c')],'type':_0x17bce6[_0xc7ae('0x2d')][_0xc7ae('0x2e')]};});_0x2a5af6[_0xc7ae('0x2f')]=_[_0xc7ae('0x29')](_0xd06ece,_0xc7ae('0x26'));_0x2a5af6[_0xc7ae('0x30')]=_[_0xc7ae('0x31')](_0x5090b5['query']);_0x2a5af6[_0xc7ae('0x32')]=_['intersection'](_0x2a5af6[_0xc7ae('0x2f')],_0x2a5af6[_0xc7ae('0x30')]);_0x15caf2['attributes']=_['intersection'](_0x2a5af6['model'],qs[_0xc7ae('0x33')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x33')]));_0x15caf2[_0xc7ae('0x34')]=_0x15caf2[_0xc7ae('0x34')]['length']?_0x15caf2[_0xc7ae('0x34')]:_0x2a5af6[_0xc7ae('0x2f')];if(!_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x35')]('nolimit')){_0x15caf2[_0xc7ae('0x1c')]=qs[_0xc7ae('0x1c')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x1c')]);_0x15caf2[_0xc7ae('0x1d')]=qs[_0xc7ae('0x1d')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x1d')]);}_0x15caf2['order']=qs[_0xc7ae('0x36')](_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x36')]);_0x15caf2[_0xc7ae('0x37')]=qs['filters'](_[_0xc7ae('0x38')](_0x5090b5[_0xc7ae('0x30')],_0x2a5af6[_0xc7ae('0x32')]),_0xd06ece);if(_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x39')]){_0x15caf2[_0xc7ae('0x37')]=_['merge'](_0x15caf2[_0xc7ae('0x37')],{'$or':_[_0xc7ae('0x29')](_0xd06ece,function(_0x798003){if(_0x798003[_0xc7ae('0x2d')]!==_0xc7ae('0x3a')){var _0x5ae3e0={};_0x5ae3e0[_0x798003[_0xc7ae('0x26')]]={'$like':'%'+_0x5090b5['query'][_0xc7ae('0x39')]+'%'};return _0x5ae3e0;}})});}_0x15caf2=_[_0xc7ae('0x3b')]({},_0x15caf2,_0x5090b5[_0xc7ae('0x3c')]);var _0x57cf37={'where':_0x15caf2[_0xc7ae('0x37')]};return db['ServicenowField'][_0xc7ae('0x1e')](_0x57cf37)[_0xc7ae('0x25')](function(_0x137688){_0x1a4fa5[_0xc7ae('0x1e')]=_0x137688;if(_0x5090b5[_0xc7ae('0x30')][_0xc7ae('0x3d')]){_0x15caf2[_0xc7ae('0x3e')]=[{'all':!![]}];}return db[_0xc7ae('0x2a')][_0xc7ae('0x3f')](_0x15caf2);})[_0xc7ae('0x25')](function(_0xc016c0){_0x1a4fa5[_0xc7ae('0x40')]=_0xc016c0;return _0x1a4fa5;})['then'](respondWithFilteredResult(_0x1af74d,_0x15caf2))[_0xc7ae('0x41')](handleError(_0x1af74d,null));};exports[_0xc7ae('0x42')]=function(_0xebe2a9,_0x391734){var _0x4a328b={'raw':!![],'where':{'id':_0xebe2a9[_0xc7ae('0x43')]['id']}},_0x9ba3d5={};_0x9ba3d5['model']=_[_0xc7ae('0x31')](db[_0xc7ae('0x2a')][_0xc7ae('0x2b')]);_0x9ba3d5['query']=_['keys'](_0xebe2a9[_0xc7ae('0x30')]);_0x9ba3d5[_0xc7ae('0x32')]=_[_0xc7ae('0x44')](_0x9ba3d5[_0xc7ae('0x2f')],_0x9ba3d5[_0xc7ae('0x30')]);_0x4a328b['attributes']=_['intersection'](_0x9ba3d5[_0xc7ae('0x2f')],qs['fields'](_0xebe2a9[_0xc7ae('0x30')][_0xc7ae('0x33')]));_0x4a328b['attributes']=_0x4a328b[_0xc7ae('0x34')][_0xc7ae('0x45')]?_0x4a328b[_0xc7ae('0x34')]:_0x9ba3d5[_0xc7ae('0x2f')];if(_0xebe2a9[_0xc7ae('0x30')]['includeAll']){_0x4a328b[_0xc7ae('0x3e')]=[{'all':!![]}];}_0x4a328b=_[_0xc7ae('0x3b')]({},_0x4a328b,_0xebe2a9[_0xc7ae('0x3c')]);return db['ServicenowField']['find'](_0x4a328b)[_0xc7ae('0x25')](handleEntityNotFound(_0x391734,null))[_0xc7ae('0x25')](respondWithResult(_0x391734,null))[_0xc7ae('0x41')](handleError(_0x391734,null));};exports['create']=function(_0x4053b6,_0x1cf504){return db[_0xc7ae('0x2a')][_0xc7ae('0x46')](_0x4053b6[_0xc7ae('0x47')],{})[_0xc7ae('0x25')](respondWithResult(_0x1cf504,0xc9))[_0xc7ae('0x41')](handleError(_0x1cf504,null));};exports[_0xc7ae('0x24')]=function(_0x5dc4d9,_0x53ac85){if(_0x5dc4d9[_0xc7ae('0x47')]['id']){delete _0x5dc4d9[_0xc7ae('0x47')]['id'];}return db[_0xc7ae('0x2a')]['find']({'where':{'id':_0x5dc4d9['params']['id']}})[_0xc7ae('0x25')](handleEntityNotFound(_0x53ac85,null))[_0xc7ae('0x25')](saveUpdates(_0x5dc4d9[_0xc7ae('0x47')],null))[_0xc7ae('0x25')](respondWithResult(_0x53ac85,null))['catch'](handleError(_0x53ac85,null));};exports[_0xc7ae('0x48')]=function(_0x1ef5de,_0x34d4dc){return db['ServicenowField'][_0xc7ae('0x49')]({'where':{'id':_0x1ef5de['params']['id']}})[_0xc7ae('0x25')](handleEntityNotFound(_0x34d4dc,null))[_0xc7ae('0x25')](removeEntity(_0x34d4dc,null))[_0xc7ae('0x41')](handleError(_0x34d4dc,null));}; \ No newline at end of file +var _0xae6c=['length','find','create','body','update','destroy','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params'];(function(_0x482812,_0x4e76f2){var _0x2a1584=function(_0x479a3f){while(--_0x479a3f){_0x482812['push'](_0x482812['shift']());}};_0x2a1584(++_0x4e76f2);}(_0xae6c,0x173));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xcae6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcae6('0x1'));var jsonpatch=require(_0xcae6('0x2'));var rp=require('request-promise');var moment=require(_0xcae6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcae6('0x4'));var util=require(_0xcae6('0x5'));var path=require('path');var sox=require(_0xcae6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcae6('0x7'));var _=require(_0xcae6('0x8'));var squel=require(_0xcae6('0x9'));var crypto=require(_0xcae6('0xa'));var jsforce=require(_0xcae6('0xb'));var deskjs=require(_0xcae6('0xc'));var toCsv=require(_0xcae6('0xd'));var querystring=require('querystring');var Papa=require(_0xcae6('0xe'));var Redis=require(_0xcae6('0xf'));var authService=require(_0xcae6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcae6('0x11'));var utils=require('../../config/utils');var config=require(_0xcae6('0x12'));var licenseUtil=require(_0xcae6('0x13'));var db=require(_0xcae6('0x14'))['db'];function respondWithStatusCode(_0x43472c,_0x5ec832){_0x5ec832=_0x5ec832||0xcc;return function(_0x8e2a07){if(_0x8e2a07){return _0x43472c[_0xcae6('0x15')](_0x5ec832);}return _0x43472c['status'](_0x5ec832)[_0xcae6('0x16')]();};}function respondWithResult(_0x3aae23,_0x53b7bc){_0x53b7bc=_0x53b7bc||0xc8;return function(_0x159a08){if(_0x159a08){return _0x3aae23[_0xcae6('0x17')](_0x53b7bc)[_0xcae6('0x18')](_0x159a08);}};}function respondWithFilteredResult(_0x4c451a,_0xfd1759){return function(_0x1685ed){if(_0x1685ed){var _0x231b41=typeof _0xfd1759[_0xcae6('0x19')]===_0xcae6('0x1a')&&typeof _0xfd1759[_0xcae6('0x1b')]==='undefined';var _0x42df26=_0x1685ed['count'];var _0x1c512b=_0x231b41?0x0:_0xfd1759[_0xcae6('0x19')];var _0x3b784d=_0x231b41?_0x1685ed['count']:_0xfd1759[_0xcae6('0x19')]+_0xfd1759['limit'];var _0x5a8b19;if(_0x3b784d>=_0x42df26){_0x3b784d=_0x42df26;_0x5a8b19=0xc8;}else{_0x5a8b19=0xce;}_0x4c451a['status'](_0x5a8b19);return _0x4c451a[_0xcae6('0x1c')]('Content-Range',_0x1c512b+'-'+_0x3b784d+'/'+_0x42df26)['json'](_0x1685ed);}return null;};}function patchUpdates(_0x348f49){return function(_0x133c0e){try{jsonpatch[_0xcae6('0x1d')](_0x133c0e,_0x348f49,!![]);}catch(_0x28ceec){return BPromise[_0xcae6('0x1e')](_0x28ceec);}return _0x133c0e['save']();};}function saveUpdates(_0x579399,_0x4bf344){return function(_0x201a14){if(_0x201a14){return _0x201a14['update'](_0x579399)[_0xcae6('0x1f')](function(_0x4f92c6){return _0x4f92c6;});}return null;};}function removeEntity(_0x49292e,_0x466032){return function(_0x350d52){if(_0x350d52){return _0x350d52['destroy']()[_0xcae6('0x1f')](function(){_0x49292e[_0xcae6('0x17')](0xcc)[_0xcae6('0x16')]();});}};}function handleEntityNotFound(_0x340235,_0x87a87c){return function(_0x37f6da){if(!_0x37f6da){_0x340235[_0xcae6('0x15')](0x194);}return _0x37f6da;};}function handleError(_0x3e1341,_0x1a4bfc){_0x1a4bfc=_0x1a4bfc||0x1f4;return function(_0x3f5fd6){logger[_0xcae6('0x20')](_0x3f5fd6[_0xcae6('0x21')]);if(_0x3f5fd6[_0xcae6('0x22')]){delete _0x3f5fd6[_0xcae6('0x22')];}_0x3e1341[_0xcae6('0x17')](_0x1a4bfc)[_0xcae6('0x23')](_0x3f5fd6);};}exports[_0xcae6('0x24')]=function(_0x286b83,_0x4e3f4a){var _0x42f84c={},_0x3c84d3={},_0x50485d={'count':0x0,'rows':[]};var _0x5c31e8=_[_0xcae6('0x25')](db[_0xcae6('0x26')][_0xcae6('0x27')],function(_0x2a3189){return{'name':_0x2a3189['fieldName'],'type':_0x2a3189['type'][_0xcae6('0x28')]};});_0x3c84d3[_0xcae6('0x29')]=_[_0xcae6('0x25')](_0x5c31e8,'name');_0x3c84d3[_0xcae6('0x2a')]=_[_0xcae6('0x2b')](_0x286b83[_0xcae6('0x2a')]);_0x3c84d3[_0xcae6('0x2c')]=_[_0xcae6('0x2d')](_0x3c84d3[_0xcae6('0x29')],_0x3c84d3[_0xcae6('0x2a')]);_0x42f84c[_0xcae6('0x2e')]=_['intersection'](_0x3c84d3['model'],qs[_0xcae6('0x2f')](_0x286b83[_0xcae6('0x2a')]['fields']));_0x42f84c[_0xcae6('0x2e')]=_0x42f84c[_0xcae6('0x2e')]['length']?_0x42f84c['attributes']:_0x3c84d3[_0xcae6('0x29')];if(!_0x286b83[_0xcae6('0x2a')][_0xcae6('0x30')](_0xcae6('0x31'))){_0x42f84c[_0xcae6('0x1b')]=qs[_0xcae6('0x1b')](_0x286b83[_0xcae6('0x2a')][_0xcae6('0x1b')]);_0x42f84c[_0xcae6('0x19')]=qs[_0xcae6('0x19')](_0x286b83[_0xcae6('0x2a')][_0xcae6('0x19')]);}_0x42f84c[_0xcae6('0x32')]=qs[_0xcae6('0x33')](_0x286b83['query'][_0xcae6('0x33')]);_0x42f84c['where']=qs['filters'](_[_0xcae6('0x34')](_0x286b83[_0xcae6('0x2a')],_0x3c84d3[_0xcae6('0x2c')]),_0x5c31e8);if(_0x286b83[_0xcae6('0x2a')]['filter']){_0x42f84c[_0xcae6('0x35')]=_['merge'](_0x42f84c[_0xcae6('0x35')],{'$or':_[_0xcae6('0x25')](_0x5c31e8,function(_0x4401e5){if(_0x4401e5[_0xcae6('0x36')]!==_0xcae6('0x37')){var _0xc66334={};_0xc66334[_0x4401e5[_0xcae6('0x22')]]={'$like':'%'+_0x286b83[_0xcae6('0x2a')][_0xcae6('0x38')]+'%'};return _0xc66334;}})});}_0x42f84c=_[_0xcae6('0x39')]({},_0x42f84c,_0x286b83[_0xcae6('0x3a')]);var _0xc3b201={'where':_0x42f84c[_0xcae6('0x35')]};return db['ServicenowField'][_0xcae6('0x3b')](_0xc3b201)[_0xcae6('0x1f')](function(_0x5eabef){_0x50485d[_0xcae6('0x3b')]=_0x5eabef;if(_0x286b83[_0xcae6('0x2a')][_0xcae6('0x3c')]){_0x42f84c[_0xcae6('0x3d')]=[{'all':!![]}];}return db[_0xcae6('0x26')][_0xcae6('0x3e')](_0x42f84c);})[_0xcae6('0x1f')](function(_0x5b70fa){_0x50485d[_0xcae6('0x3f')]=_0x5b70fa;return _0x50485d;})[_0xcae6('0x1f')](respondWithFilteredResult(_0x4e3f4a,_0x42f84c))[_0xcae6('0x40')](handleError(_0x4e3f4a,null));};exports[_0xcae6('0x41')]=function(_0x3b679f,_0x2e9c8e){var _0x19436a={'raw':!![],'where':{'id':_0x3b679f[_0xcae6('0x42')]['id']}},_0x3f4ff4={};_0x3f4ff4[_0xcae6('0x29')]=_['keys'](db[_0xcae6('0x26')]['rawAttributes']);_0x3f4ff4[_0xcae6('0x2a')]=_[_0xcae6('0x2b')](_0x3b679f[_0xcae6('0x2a')]);_0x3f4ff4['filters']=_[_0xcae6('0x2d')](_0x3f4ff4[_0xcae6('0x29')],_0x3f4ff4['query']);_0x19436a[_0xcae6('0x2e')]=_[_0xcae6('0x2d')](_0x3f4ff4[_0xcae6('0x29')],qs['fields'](_0x3b679f[_0xcae6('0x2a')]['fields']));_0x19436a[_0xcae6('0x2e')]=_0x19436a['attributes'][_0xcae6('0x43')]?_0x19436a[_0xcae6('0x2e')]:_0x3f4ff4[_0xcae6('0x29')];if(_0x3b679f[_0xcae6('0x2a')][_0xcae6('0x3c')]){_0x19436a[_0xcae6('0x3d')]=[{'all':!![]}];}_0x19436a=_[_0xcae6('0x39')]({},_0x19436a,_0x3b679f['options']);return db['ServicenowField'][_0xcae6('0x44')](_0x19436a)[_0xcae6('0x1f')](handleEntityNotFound(_0x2e9c8e,null))['then'](respondWithResult(_0x2e9c8e,null))[_0xcae6('0x40')](handleError(_0x2e9c8e,null));};exports[_0xcae6('0x45')]=function(_0x35137d,_0x5e74c4){return db[_0xcae6('0x26')][_0xcae6('0x45')](_0x35137d[_0xcae6('0x46')],{})[_0xcae6('0x1f')](respondWithResult(_0x5e74c4,0xc9))[_0xcae6('0x40')](handleError(_0x5e74c4,null));};exports[_0xcae6('0x47')]=function(_0x2298cd,_0x2008d1){if(_0x2298cd[_0xcae6('0x46')]['id']){delete _0x2298cd[_0xcae6('0x46')]['id'];}return db[_0xcae6('0x26')][_0xcae6('0x44')]({'where':{'id':_0x2298cd[_0xcae6('0x42')]['id']}})[_0xcae6('0x1f')](handleEntityNotFound(_0x2008d1,null))[_0xcae6('0x1f')](saveUpdates(_0x2298cd[_0xcae6('0x46')],null))[_0xcae6('0x1f')](respondWithResult(_0x2008d1,null))[_0xcae6('0x40')](handleError(_0x2008d1,null));};exports[_0xcae6('0x48')]=function(_0x549cf9,_0x570f3a){return db['ServicenowField'][_0xcae6('0x44')]({'where':{'id':_0x549cf9['params']['id']}})[_0xcae6('0x1f')](handleEntityNotFound(_0x570f3a,null))[_0xcae6('0x1f')](removeEntity(_0x570f3a,null))[_0xcae6('0x40')](handleError(_0x570f3a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8c8e1f1..2990273 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2359=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x461c8b,_0xe50dc4){var _0x5e18e4=function(_0x343419){while(--_0x343419){_0x461c8b['push'](_0x461c8b['shift']());}};_0x5e18e4(++_0xe50dc4);}(_0x2359,0x1a2));var _0x9235=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2359[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x9235('0x0'));var logger=require(_0x9235('0x1'))(_0x9235('0x2'));var moment=require('moment');var BPromise=require(_0x9235('0x3'));var rp=require(_0x9235('0x4'));var fs=require('fs');var path=require(_0x9235('0x5'));var rimraf=require(_0x9235('0x6'));var config=require(_0x9235('0x7'));var attributes=require(_0x9235('0x8'));module[_0x9235('0x9')]=function(_0x3709d1,_0x54ebd5){return _0x3709d1[_0x9235('0xa')](_0x9235('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x9235('0xc'),'fields':[_0x9235('0xd'),_0x9235('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb754=['int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x5e1189,_0x474406){var _0x425a63=function(_0x53716d){while(--_0x53716d){_0x5e1189['push'](_0x5e1189['shift']());}};_0x425a63(++_0x474406);}(_0xb754,0x1f2));var _0x4b75=function(_0x2df74c,_0x42b9cb){_0x2df74c=_0x2df74c-0x0;var _0x219cc6=_0xb754[_0x2df74c];return _0x219cc6;};'use strict';var _=require(_0x4b75('0x0'));var util=require(_0x4b75('0x1'));var logger=require(_0x4b75('0x2'))(_0x4b75('0x3'));var moment=require('moment');var BPromise=require(_0x4b75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b75('0x5'));var rimraf=require(_0x4b75('0x6'));var config=require(_0x4b75('0x7'));var attributes=require(_0x4b75('0x8'));module[_0x4b75('0x9')]=function(_0x1bb745,_0x4a5d67){return _0x1bb745[_0x4b75('0xa')](_0x4b75('0xb'),attributes,{'tableName':_0x4b75('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4b75('0xd'),_0x4b75('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 0b9cfaa..bcc3a5f 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0xd6a357,_0x3830f6){var _0x4f1ecc=function(_0x22e3fa){while(--_0x22e3fa){_0xd6a357['push'](_0xd6a357['shift']());}};_0x4f1ecc(++_0x3830f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xcb91[_0x580971];return _0x16d873;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4fd35c,_0x4eea23){var _0x186548=function(_0x456be9){while(--_0x456be9){_0x4fd35c['push'](_0x4fd35c['shift']());}};_0x186548(++_0x4eea23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 83e178b..0e76403 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x53ff54,_0x110554){var _0x270f9a=function(_0x641425){while(--_0x641425){_0x53ff54['push'](_0x53ff54['shift']());}};_0x270f9a(++_0x110554);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3d5192,_0xd24bd4){var _0x3825a7=function(_0x524524){while(--_0x524524){_0x3d5192['push'](_0x3d5192['shift']());}};_0x3825a7(++_0xd24bd4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 1b4e91e..bbaa6a9 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0xf7dec8,_0x31721c){var _0xf08623=function(_0x50b931){while(--_0x50b931){_0xf7dec8['push'](_0xf7dec8['shift']());}};_0xf08623(++_0x31721c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1f19b8,_0x57d0f3){var _0x1e6cce=function(_0x2b1607){while(--_0x2b1607){_0x1f19b8['push'](_0x1f19b8['shift']());}};_0x1e6cce(++_0x57d0f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 36be0e5..45368ef 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b3d=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','addConfiguration','body','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x28b52c,_0x21888a){var _0x2ab877=function(_0xa5b7d0){while(--_0xa5b7d0){_0x28b52c['push'](_0x28b52c['shift']());}};_0x2ab877(++_0x21888a);}(_0x2b3d,0x1dd));var _0xd2b3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b3d[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0xd2b3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd2b3('0x1'));var jsonpatch=require(_0xd2b3('0x2'));var rp=require(_0xd2b3('0x3'));var moment=require(_0xd2b3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2b3('0x5'));var path=require(_0xd2b3('0x6'));var sox=require('sox');var csv=require(_0xd2b3('0x7'));var ejs=require(_0xd2b3('0x8'));var fs=require('fs');var fs_extra=require(_0xd2b3('0x9'));var _=require(_0xd2b3('0xa'));var squel=require('squel');var crypto=require(_0xd2b3('0xb'));var jsforce=require(_0xd2b3('0xc'));var deskjs=require(_0xd2b3('0xd'));var toCsv=require(_0xd2b3('0x7'));var querystring=require(_0xd2b3('0xe'));var Papa=require('papaparse');var Redis=require(_0xd2b3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd2b3('0x10'));var as=require(_0xd2b3('0x11'));var hardwareService=require(_0xd2b3('0x12'));var logger=require(_0xd2b3('0x13'))('api');var utils=require(_0xd2b3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xd2b3('0x15'));var db=require(_0xd2b3('0x16'))['db'];var integrations=require(_0xd2b3('0x17'));function respondWithStatusCode(_0x2aa6b1,_0x5d26f5){_0x5d26f5=_0x5d26f5||0xcc;return function(_0x294b2d){if(_0x294b2d){return _0x2aa6b1[_0xd2b3('0x18')](_0x5d26f5);}return _0x2aa6b1[_0xd2b3('0x19')](_0x5d26f5)[_0xd2b3('0x1a')]();};}function respondWithResult(_0x2aba57,_0x229b71){_0x229b71=_0x229b71||0xc8;return function(_0x5a339d){if(_0x5a339d){return _0x2aba57[_0xd2b3('0x19')](_0x229b71)[_0xd2b3('0x1b')](_0x5a339d);}};}function respondWithFilteredResult(_0x591b3e,_0x17f110){return function(_0x233810){if(_0x233810){var _0x45f76d=typeof _0x17f110[_0xd2b3('0x1c')]===_0xd2b3('0x1d')&&typeof _0x17f110[_0xd2b3('0x1e')]===_0xd2b3('0x1d');var _0x31073f=_0x233810[_0xd2b3('0x1f')];var _0x197696=_0x45f76d?0x0:_0x17f110[_0xd2b3('0x1c')];var _0x5a4535=_0x45f76d?_0x233810[_0xd2b3('0x1f')]:_0x17f110['offset']+_0x17f110[_0xd2b3('0x1e')];var _0xc7c9d1;if(_0x5a4535>=_0x31073f){_0x5a4535=_0x31073f;_0xc7c9d1=0xc8;}else{_0xc7c9d1=0xce;}_0x591b3e[_0xd2b3('0x19')](_0xc7c9d1);return _0x591b3e[_0xd2b3('0x20')](_0xd2b3('0x21'),_0x197696+'-'+_0x5a4535+'/'+_0x31073f)[_0xd2b3('0x1b')](_0x233810);}return null;};}function patchUpdates(_0x4798d8){return function(_0x276e63){try{jsonpatch[_0xd2b3('0x22')](_0x276e63,_0x4798d8,!![]);}catch(_0x5861e5){return BPromise[_0xd2b3('0x23')](_0x5861e5);}return _0x276e63[_0xd2b3('0x24')]();};}function saveUpdates(_0x21501e,_0x7e9b37){return function(_0x2c738e){if(_0x2c738e){return _0x2c738e[_0xd2b3('0x25')](_0x21501e)[_0xd2b3('0x26')](function(_0x920082){return _0x920082;});}return null;};}function removeEntity(_0x6ef951,_0x418c97){return function(_0x383853){if(_0x383853){return _0x383853['destroy']()[_0xd2b3('0x26')](function(){_0x6ef951[_0xd2b3('0x19')](0xcc)[_0xd2b3('0x1a')]();});}};}function handleEntityNotFound(_0x104bc0,_0x49de7d){return function(_0x15855b){if(!_0x15855b){_0x104bc0[_0xd2b3('0x18')](0x194);}return _0x15855b;};}function handleError(_0x2f505f,_0x505ffd){_0x505ffd=_0x505ffd||0x1f4;return function(_0x757d07){logger[_0xd2b3('0x27')](_0x757d07[_0xd2b3('0x28')]);if(_0x757d07[_0xd2b3('0x29')]){delete _0x757d07[_0xd2b3('0x29')];}_0x2f505f['status'](_0x505ffd)[_0xd2b3('0x2a')](_0x757d07);};}exports[_0xd2b3('0x2b')]=function(_0x57388b,_0x4bddb9){var _0x17414c={},_0x574707={},_0x2141f5={'count':0x0,'rows':[]};var _0x5925a1=_[_0xd2b3('0x2c')](db[_0xd2b3('0x2d')][_0xd2b3('0x2e')],function(_0x569abf){return{'name':_0x569abf[_0xd2b3('0x2f')],'type':_0x569abf[_0xd2b3('0x30')][_0xd2b3('0x31')]};});_0x574707[_0xd2b3('0x32')]=_['map'](_0x5925a1,_0xd2b3('0x29'));_0x574707[_0xd2b3('0x33')]=_['keys'](_0x57388b[_0xd2b3('0x33')]);_0x574707[_0xd2b3('0x34')]=_['intersection'](_0x574707['model'],_0x574707['query']);_0x17414c['attributes']=_[_0xd2b3('0x35')](_0x574707[_0xd2b3('0x32')],qs['fields'](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x36')]));_0x17414c[_0xd2b3('0x37')]=_0x17414c[_0xd2b3('0x37')][_0xd2b3('0x38')]?_0x17414c[_0xd2b3('0x37')]:_0x574707[_0xd2b3('0x32')];if(!_0x57388b['query']['hasOwnProperty'](_0xd2b3('0x39'))){_0x17414c[_0xd2b3('0x1e')]=qs[_0xd2b3('0x1e')](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x1e')]);_0x17414c[_0xd2b3('0x1c')]=qs[_0xd2b3('0x1c')](_0x57388b['query']['offset']);}_0x17414c[_0xd2b3('0x3a')]=qs[_0xd2b3('0x3b')](_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x3b')]);_0x17414c['where']=qs[_0xd2b3('0x34')](_[_0xd2b3('0x3c')](_0x57388b[_0xd2b3('0x33')],_0x574707[_0xd2b3('0x34')]),_0x5925a1);if(_0x57388b[_0xd2b3('0x33')]['filter']){_0x17414c[_0xd2b3('0x3d')]=_[_0xd2b3('0x3e')](_0x17414c[_0xd2b3('0x3d')],{'$or':_[_0xd2b3('0x2c')](_0x5925a1,function(_0x10a278){if(_0x10a278[_0xd2b3('0x30')]!==_0xd2b3('0x3f')){var _0x54faed={};_0x54faed[_0x10a278['name']]={'$like':'%'+_0x57388b[_0xd2b3('0x33')][_0xd2b3('0x40')]+'%'};return _0x54faed;}})});}_0x17414c=_['merge']({},_0x17414c,_0x57388b[_0xd2b3('0x41')]);var _0x2add58={'where':_0x17414c[_0xd2b3('0x3d')]};return db[_0xd2b3('0x2d')][_0xd2b3('0x1f')](_0x2add58)['then'](function(_0x442101){_0x2141f5[_0xd2b3('0x1f')]=_0x442101;if(_0x57388b['query'][_0xd2b3('0x42')]){_0x17414c[_0xd2b3('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xd2b3('0x44')](_0x17414c);})[_0xd2b3('0x26')](function(_0xee1728){_0x2141f5[_0xd2b3('0x45')]=_0xee1728;return _0x2141f5;})[_0xd2b3('0x26')](respondWithFilteredResult(_0x4bddb9,_0x17414c))['catch'](handleError(_0x4bddb9,null));};exports[_0xd2b3('0x46')]=function(_0x373ca6,_0x6dcfb4){var _0x51c8cb={'raw':![],'where':{'id':_0x373ca6[_0xd2b3('0x47')]['id']}},_0x25ce80={};_0x25ce80[_0xd2b3('0x32')]=_[_0xd2b3('0x48')](db[_0xd2b3('0x2d')][_0xd2b3('0x2e')]);_0x25ce80[_0xd2b3('0x33')]=_[_0xd2b3('0x48')](_0x373ca6[_0xd2b3('0x33')]);_0x25ce80['filters']=_['intersection'](_0x25ce80['model'],_0x25ce80[_0xd2b3('0x33')]);_0x51c8cb[_0xd2b3('0x37')]=_['intersection'](_0x25ce80[_0xd2b3('0x32')],qs['fields'](_0x373ca6[_0xd2b3('0x33')][_0xd2b3('0x36')]));_0x51c8cb[_0xd2b3('0x37')]=_0x51c8cb[_0xd2b3('0x37')][_0xd2b3('0x38')]?_0x51c8cb['attributes']:_0x25ce80[_0xd2b3('0x32')];if(_0x373ca6[_0xd2b3('0x33')][_0xd2b3('0x42')]){_0x51c8cb[_0xd2b3('0x43')]=[{'all':!![]}];}_0x51c8cb=_[_0xd2b3('0x3e')]({},_0x51c8cb,_0x373ca6[_0xd2b3('0x41')]);return db[_0xd2b3('0x2d')][_0xd2b3('0x49')](_0x51c8cb)['then'](handleEntityNotFound(_0x6dcfb4,null))[_0xd2b3('0x26')](respondWithResult(_0x6dcfb4,null))[_0xd2b3('0x4a')](handleError(_0x6dcfb4,null));};exports[_0xd2b3('0x4b')]=function(_0xa6d063,_0x491c0b){return db[_0xd2b3('0x2d')][_0xd2b3('0x4b')](_0xa6d063['body'],{})[_0xd2b3('0x26')](respondWithResult(_0x491c0b,0xc9))[_0xd2b3('0x4a')](handleError(_0x491c0b,null));};exports[_0xd2b3('0x25')]=function(_0x4d8057,_0x4b2cde){if(_0x4d8057['body']['id']){delete _0x4d8057['body']['id'];}return db[_0xd2b3('0x2d')][_0xd2b3('0x49')]({'where':{'id':_0x4d8057[_0xd2b3('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b2cde,null))[_0xd2b3('0x26')](saveUpdates(_0x4d8057['body'],null))['then'](respondWithResult(_0x4b2cde,null))[_0xd2b3('0x4a')](handleError(_0x4b2cde,null));};exports[_0xd2b3('0x4c')]=function(_0x1fbd74,_0x4d2496){return db['SugarcrmAccount'][_0xd2b3('0x49')]({'where':{'id':_0x1fbd74[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x4d2496,null))[_0xd2b3('0x26')](removeEntity(_0x4d2496,null))['catch'](handleError(_0x4d2496,null));};exports[_0xd2b3('0x4d')]=function(_0x486926,_0x511ebb,_0x36be81){var _0x16f2d7={};var _0x358d0d={};var _0xb4523a;var _0x3237e3;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x486926[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x511ebb,null))['then'](function(_0x28550e){if(_0x28550e){_0xb4523a=_0x28550e;_0x358d0d[_0xd2b3('0x32')]=_[_0xd2b3('0x48')](db[_0xd2b3('0x4e')][_0xd2b3('0x2e')]);_0x358d0d[_0xd2b3('0x33')]=_[_0xd2b3('0x48')](_0x486926[_0xd2b3('0x33')]);_0x358d0d['filters']=_[_0xd2b3('0x35')](_0x358d0d[_0xd2b3('0x32')],_0x358d0d[_0xd2b3('0x33')]);_0x16f2d7[_0xd2b3('0x37')]=_[_0xd2b3('0x35')](_0x358d0d[_0xd2b3('0x32')],qs[_0xd2b3('0x36')](_0x486926[_0xd2b3('0x33')]['fields']));_0x16f2d7[_0xd2b3('0x37')]=_0x16f2d7['attributes'][_0xd2b3('0x38')]?_0x16f2d7[_0xd2b3('0x37')]:_0x358d0d['model'];_0x16f2d7['order']=qs['sort'](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x3b')]);_0x16f2d7[_0xd2b3('0x3d')]=qs[_0xd2b3('0x34')](_[_0xd2b3('0x3c')](_0x486926[_0xd2b3('0x33')],_0x358d0d[_0xd2b3('0x34')]));if(_0x486926[_0xd2b3('0x33')][_0xd2b3('0x40')]){_0x16f2d7[_0xd2b3('0x3d')]=_[_0xd2b3('0x3e')](_0x16f2d7['where'],{'$or':_[_0xd2b3('0x2c')](_0x16f2d7[_0xd2b3('0x37')],function(_0x3bd748){var _0x56a2e4={};_0x56a2e4[_0x3bd748]={'$like':'%'+_0x486926[_0xd2b3('0x33')][_0xd2b3('0x40')]+'%'};return _0x56a2e4;})});}_0x16f2d7=_[_0xd2b3('0x3e')]({},_0x16f2d7,_0x486926['options']);return _0xb4523a[_0xd2b3('0x4d')](_0x16f2d7);}})['then'](function(_0x356d3b){if(_0x356d3b){_0x3237e3=_0x356d3b['length'];if(!_0x486926[_0xd2b3('0x33')][_0xd2b3('0x4f')](_0xd2b3('0x39'))){_0x16f2d7[_0xd2b3('0x1e')]=qs[_0xd2b3('0x1e')](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x1e')]);_0x16f2d7[_0xd2b3('0x1c')]=qs[_0xd2b3('0x1c')](_0x486926[_0xd2b3('0x33')][_0xd2b3('0x1c')]);}return _0xb4523a[_0xd2b3('0x4d')](_0x16f2d7);}})[_0xd2b3('0x26')](function(_0x7d145f){if(_0x7d145f){return _0x7d145f?{'count':_0x3237e3,'rows':_0x7d145f}:null;}})[_0xd2b3('0x26')](respondWithResult(_0x511ebb,null))[_0xd2b3('0x4a')](handleError(_0x511ebb,null));};exports[_0xd2b3('0x50')]=function(_0xb9c2ff,_0x7382ac,_0x36ae64){if(_0xb9c2ff[_0xd2b3('0x51')]['id']){delete _0xb9c2ff[_0xd2b3('0x51')]['id'];}return db[_0xd2b3('0x2d')][_0xd2b3('0x52')]({'where':{'id':_0xb9c2ff[_0xd2b3('0x47')]['id']}})[_0xd2b3('0x26')](handleEntityNotFound(_0x7382ac,null))['then'](function(_0xa7e270){if(_0xa7e270){_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x53')]=_0xa7e270['id'];_0xb9c2ff['body'][_0xd2b3('0x54')]=integrations[_0xd2b3('0x55')](_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x56')],_0xb9c2ff[_0xd2b3('0x51')]['type']);_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x57')]=integrations[_0xd2b3('0x58')](_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x56')],_0xb9c2ff[_0xd2b3('0x51')][_0xd2b3('0x30')]);return db[_0xd2b3('0x4e')][_0xd2b3('0x4b')](_0xb9c2ff['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xd2b3('0x54')},{'model':db[_0xd2b3('0x59')],'as':_0xd2b3('0x57')}]});}return null;})['then'](respondWithResult(_0x7382ac,null))[_0xd2b3('0x4a')](handleError(_0x7382ac,null));};exports['getFields']=function(_0x4169c9,_0x3b60ad,_0x1eb572){var _0x5a8ce7='';var _0x215d79=['id',_0xd2b3('0x29'),_0xd2b3('0x5a'),_0xd2b3('0x5b'),'description',_0xd2b3('0x5c'),_0xd2b3('0x5d'),'duration_minutes','parent_id',_0xd2b3('0x5e'),_0xd2b3('0x5f'),_0xd2b3('0x60')];return db[_0xd2b3('0x2d')][_0xd2b3('0x52')]({'where':{'id':_0x4169c9['params']['id']},'attributes':['id',_0xd2b3('0x61'),_0xd2b3('0x62'),_0xd2b3('0x63')]})[_0xd2b3('0x26')](handleEntityNotFound(_0x3b60ad,null))[_0xd2b3('0x26')](function(_0x1068d1){if(_0x1068d1){_0x5a8ce7=_0x1068d1['remoteUri'];var _0x5c5d66=_0x5a8ce7[_0xd2b3('0x64')](-0x1);if(_0x5c5d66==='/'){_0x5a8ce7=_0x5a8ce7[_0xd2b3('0x65')](0x0,_0x5a8ce7[_0xd2b3('0x66')](_0x5c5d66));}return rp({'method':_0xd2b3('0x67'),'uri':util[_0xd2b3('0x68')](_0xd2b3('0x69'),_0x5a8ce7,_0xd2b3('0x6a')),'json':!![],'form':{'method':_0xd2b3('0x6b'),'input_type':_0xd2b3('0x6c'),'response_type':_0xd2b3('0x6c'),'rest_data':JSON[_0xd2b3('0x6d')]({'user_auth':{'user_name':_0x1068d1[_0xd2b3('0x61')],'password':_0x1068d1[_0xd2b3('0x62')],'encryption':_0xd2b3('0x6e')},'application':_0xd2b3('0x6f')})}});}})[_0xd2b3('0x26')](function(_0xed2e3c){if(_0xed2e3c&&_0xed2e3c['name']!==_0xd2b3('0x70')&&_0xed2e3c[_0xd2b3('0x29')]!==_0xd2b3('0x71')){return rp({'method':_0xd2b3('0x67'),'uri':util[_0xd2b3('0x68')](_0xd2b3('0x69'),_0x5a8ce7,_0xd2b3('0x6a')),'json':!![],'form':{'method':_0xd2b3('0x72'),'input_type':_0xd2b3('0x6c'),'response_type':'JSON','rest_data':JSON[_0xd2b3('0x6d')]({'session':_0xed2e3c['id'],'module_name':_0xd2b3('0x73')})}})['then'](function(_0x141f7d){if(_0x141f7d){var _0x5af229=_[_0xd2b3('0x74')](_0x141f7d[_0xd2b3('0x75')]);_[_0xd2b3('0x76')](_0x5af229,function(_0x314bae){return _0x215d79[_0xd2b3('0x77')](_0x314bae['name']);});return{'count':_0x5af229[_0xd2b3('0x38')],'rows':_[_0xd2b3('0x2c')](_0x5af229,function(_0x42abe8){return{'id':_0x42abe8[_0xd2b3('0x29')],'name':_0x42abe8['label'],'custom':_[_0xd2b3('0x78')](_0x42abe8[_0xd2b3('0x29')],'_c')?!![]:![],'options':_0x42abe8[_0xd2b3('0x41')]?_[_0xd2b3('0x2c')](_['values'](_0x42abe8['options']),function(_0x410438){return{'name':_0x410438[_0xd2b3('0x79')],'value':_0x410438[_0xd2b3('0x29')]};}):[]};})};}})[_0xd2b3('0x26')](respondWithResult(_0x3b60ad,null))['catch'](function(_0x371d8e){var _0x2bcf6c=_0x4169c9['query'][_0xd2b3('0x7a')]?0x1f4:_0x371d8e['statusCode']||0x1f4;logger[_0xd2b3('0x27')](_0xd2b3('0x7b'),_0xd2b3('0x7c'),_0x2bcf6c,JSON['stringify'](_0x371d8e));delete _0x371d8e[_0xd2b3('0x29')];if(_0x2bcf6c===0x191){_0x2bcf6c=0x190;}_0x3b60ad[_0xd2b3('0x19')](_0x2bcf6c)[_0xd2b3('0x2a')](_0x4169c9[_0xd2b3('0x33')][_0xd2b3('0x7a')]?{'message':_0xd2b3('0x7d'),'statusCode':_0x371d8e['statusCode']}:_0x371d8e);});}else{var _0x5e2104=0x1f4;_0x3b60ad[_0xd2b3('0x19')](_0x5e2104)[_0xd2b3('0x2a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x88d5=['endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','sendStatus','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','update','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','pick','nolimit','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','POST','%s%s','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','label'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x88d5,0x83));var _0x588d=function(_0x277eb4,_0x3076f9){_0x277eb4=_0x277eb4-0x0;var _0x41dfb7=_0x88d5[_0x277eb4];return _0x41dfb7;};'use strict';var emlformat=require(_0x588d('0x0'));var rimraf=require(_0x588d('0x1'));var zipdir=require(_0x588d('0x2'));var jsonpatch=require(_0x588d('0x3'));var rp=require(_0x588d('0x4'));var moment=require(_0x588d('0x5'));var BPromise=require(_0x588d('0x6'));var Mustache=require(_0x588d('0x7'));var util=require(_0x588d('0x8'));var path=require(_0x588d('0x9'));var sox=require(_0x588d('0xa'));var csv=require(_0x588d('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x588d('0xc'));var _=require(_0x588d('0xd'));var squel=require('squel');var crypto=require(_0x588d('0xe'));var jsforce=require(_0x588d('0xf'));var deskjs=require(_0x588d('0x10'));var toCsv=require(_0x588d('0xb'));var querystring=require(_0x588d('0x11'));var Papa=require(_0x588d('0x12'));var Redis=require(_0x588d('0x13'));var authService=require(_0x588d('0x14'));var qs=require(_0x588d('0x15'));var as=require(_0x588d('0x16'));var hardwareService=require(_0x588d('0x17'));var logger=require(_0x588d('0x18'))(_0x588d('0x19'));var utils=require(_0x588d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x588d('0x1b'));var db=require(_0x588d('0x1c'))['db'];var integrations=require(_0x588d('0x1d'));function respondWithStatusCode(_0x4ff490,_0x34491e){_0x34491e=_0x34491e||0xcc;return function(_0x349601){if(_0x349601){return _0x4ff490['sendStatus'](_0x34491e);}return _0x4ff490[_0x588d('0x1e')](_0x34491e)[_0x588d('0x1f')]();};}function respondWithResult(_0x3949ba,_0x12869e){_0x12869e=_0x12869e||0xc8;return function(_0x4e66c8){if(_0x4e66c8){return _0x3949ba[_0x588d('0x1e')](_0x12869e)[_0x588d('0x20')](_0x4e66c8);}};}function respondWithFilteredResult(_0x2d01dd,_0x482c94){return function(_0x4401cc){if(_0x4401cc){var _0xcfe39=typeof _0x482c94[_0x588d('0x21')]===_0x588d('0x22')&&typeof _0x482c94[_0x588d('0x23')]===_0x588d('0x22');var _0x28d7d4=_0x4401cc[_0x588d('0x24')];var _0x4a205a=_0xcfe39?0x0:_0x482c94[_0x588d('0x21')];var _0xf49ccb=_0xcfe39?_0x4401cc[_0x588d('0x24')]:_0x482c94['offset']+_0x482c94[_0x588d('0x23')];var _0xd66c8a;if(_0xf49ccb>=_0x28d7d4){_0xf49ccb=_0x28d7d4;_0xd66c8a=0xc8;}else{_0xd66c8a=0xce;}_0x2d01dd[_0x588d('0x1e')](_0xd66c8a);return _0x2d01dd[_0x588d('0x25')](_0x588d('0x26'),_0x4a205a+'-'+_0xf49ccb+'/'+_0x28d7d4)[_0x588d('0x20')](_0x4401cc);}return null;};}function patchUpdates(_0x52a5f1){return function(_0x50cea7){try{jsonpatch[_0x588d('0x27')](_0x50cea7,_0x52a5f1,!![]);}catch(_0x2a981f){return BPromise[_0x588d('0x28')](_0x2a981f);}return _0x50cea7['save']();};}function saveUpdates(_0x2f4f8e,_0x5a24f5){return function(_0x2c379d){if(_0x2c379d){return _0x2c379d['update'](_0x2f4f8e)['then'](function(_0x458622){return _0x458622;});}return null;};}function removeEntity(_0x523db9,_0x480fc6){return function(_0xb89704){if(_0xb89704){return _0xb89704['destroy']()[_0x588d('0x29')](function(){_0x523db9['status'](0xcc)[_0x588d('0x1f')]();});}};}function handleEntityNotFound(_0x3d6734,_0xceb173){return function(_0x41d30e){if(!_0x41d30e){_0x3d6734[_0x588d('0x2a')](0x194);}return _0x41d30e;};}function handleError(_0x2c862f,_0x3badf7){_0x3badf7=_0x3badf7||0x1f4;return function(_0x104151){logger[_0x588d('0x2b')](_0x104151['stack']);if(_0x104151[_0x588d('0x2c')]){delete _0x104151['name'];}_0x2c862f['status'](_0x3badf7)[_0x588d('0x2d')](_0x104151);};}exports[_0x588d('0x2e')]=function(_0x43ba2c,_0x4e58a5){var _0x8e9a3a={},_0x346b64={},_0x57dad7={'count':0x0,'rows':[]};var _0x1cdb08=_[_0x588d('0x2f')](db[_0x588d('0x30')][_0x588d('0x31')],function(_0xa5983){return{'name':_0xa5983[_0x588d('0x32')],'type':_0xa5983['type'][_0x588d('0x33')]};});_0x346b64[_0x588d('0x34')]=_[_0x588d('0x2f')](_0x1cdb08,_0x588d('0x2c'));_0x346b64['query']=_[_0x588d('0x35')](_0x43ba2c[_0x588d('0x36')]);_0x346b64[_0x588d('0x37')]=_[_0x588d('0x38')](_0x346b64[_0x588d('0x34')],_0x346b64['query']);_0x8e9a3a[_0x588d('0x39')]=_[_0x588d('0x38')](_0x346b64[_0x588d('0x34')],qs[_0x588d('0x3a')](_0x43ba2c[_0x588d('0x36')][_0x588d('0x3a')]));_0x8e9a3a['attributes']=_0x8e9a3a[_0x588d('0x39')][_0x588d('0x3b')]?_0x8e9a3a[_0x588d('0x39')]:_0x346b64[_0x588d('0x34')];if(!_0x43ba2c[_0x588d('0x36')][_0x588d('0x3c')]('nolimit')){_0x8e9a3a[_0x588d('0x23')]=qs[_0x588d('0x23')](_0x43ba2c['query']['limit']);_0x8e9a3a[_0x588d('0x21')]=qs[_0x588d('0x21')](_0x43ba2c['query'][_0x588d('0x21')]);}_0x8e9a3a['order']=qs[_0x588d('0x3d')](_0x43ba2c[_0x588d('0x36')]['sort']);_0x8e9a3a[_0x588d('0x3e')]=qs[_0x588d('0x37')](_['pick'](_0x43ba2c['query'],_0x346b64[_0x588d('0x37')]),_0x1cdb08);if(_0x43ba2c[_0x588d('0x36')][_0x588d('0x3f')]){_0x8e9a3a[_0x588d('0x3e')]=_[_0x588d('0x40')](_0x8e9a3a['where'],{'$or':_[_0x588d('0x2f')](_0x1cdb08,function(_0x140f8e){if(_0x140f8e[_0x588d('0x41')]!==_0x588d('0x42')){var _0x5aacff={};_0x5aacff[_0x140f8e[_0x588d('0x2c')]]={'$like':'%'+_0x43ba2c['query']['filter']+'%'};return _0x5aacff;}})});}_0x8e9a3a=_['merge']({},_0x8e9a3a,_0x43ba2c[_0x588d('0x43')]);var _0x397802={'where':_0x8e9a3a[_0x588d('0x3e')]};return db['SugarcrmAccount'][_0x588d('0x24')](_0x397802)[_0x588d('0x29')](function(_0x22946d){_0x57dad7[_0x588d('0x24')]=_0x22946d;if(_0x43ba2c['query'][_0x588d('0x44')]){_0x8e9a3a[_0x588d('0x45')]=[{'all':!![]}];}return db[_0x588d('0x30')][_0x588d('0x46')](_0x8e9a3a);})[_0x588d('0x29')](function(_0x9a56f7){_0x57dad7['rows']=_0x9a56f7;return _0x57dad7;})['then'](respondWithFilteredResult(_0x4e58a5,_0x8e9a3a))[_0x588d('0x47')](handleError(_0x4e58a5,null));};exports[_0x588d('0x48')]=function(_0x210131,_0x50e21d){var _0x18a3a3={'raw':![],'where':{'id':_0x210131[_0x588d('0x49')]['id']}},_0x3589f3={};_0x3589f3['model']=_[_0x588d('0x35')](db[_0x588d('0x30')][_0x588d('0x31')]);_0x3589f3[_0x588d('0x36')]=_[_0x588d('0x35')](_0x210131[_0x588d('0x36')]);_0x3589f3['filters']=_['intersection'](_0x3589f3[_0x588d('0x34')],_0x3589f3[_0x588d('0x36')]);_0x18a3a3[_0x588d('0x39')]=_[_0x588d('0x38')](_0x3589f3[_0x588d('0x34')],qs[_0x588d('0x3a')](_0x210131[_0x588d('0x36')][_0x588d('0x3a')]));_0x18a3a3[_0x588d('0x39')]=_0x18a3a3[_0x588d('0x39')][_0x588d('0x3b')]?_0x18a3a3[_0x588d('0x39')]:_0x3589f3['model'];if(_0x210131['query'][_0x588d('0x44')]){_0x18a3a3[_0x588d('0x45')]=[{'all':!![]}];}_0x18a3a3=_[_0x588d('0x40')]({},_0x18a3a3,_0x210131['options']);return db[_0x588d('0x30')][_0x588d('0x4a')](_0x18a3a3)[_0x588d('0x29')](handleEntityNotFound(_0x50e21d,null))[_0x588d('0x29')](respondWithResult(_0x50e21d,null))[_0x588d('0x47')](handleError(_0x50e21d,null));};exports[_0x588d('0x4b')]=function(_0xb3a3f2,_0x57bce0){return db[_0x588d('0x30')][_0x588d('0x4b')](_0xb3a3f2['body'],{})[_0x588d('0x29')](respondWithResult(_0x57bce0,0xc9))[_0x588d('0x47')](handleError(_0x57bce0,null));};exports[_0x588d('0x4c')]=function(_0x596145,_0x347d14){if(_0x596145[_0x588d('0x4d')]['id']){delete _0x596145['body']['id'];}return db[_0x588d('0x30')][_0x588d('0x4a')]({'where':{'id':_0x596145['params']['id']}})[_0x588d('0x29')](handleEntityNotFound(_0x347d14,null))[_0x588d('0x29')](saveUpdates(_0x596145[_0x588d('0x4d')],null))[_0x588d('0x29')](respondWithResult(_0x347d14,null))[_0x588d('0x47')](handleError(_0x347d14,null));};exports[_0x588d('0x4e')]=function(_0x45883c,_0x41a481){return db[_0x588d('0x30')][_0x588d('0x4a')]({'where':{'id':_0x45883c[_0x588d('0x49')]['id']}})[_0x588d('0x29')](handleEntityNotFound(_0x41a481,null))[_0x588d('0x29')](removeEntity(_0x41a481,null))[_0x588d('0x47')](handleError(_0x41a481,null));};exports[_0x588d('0x4f')]=function(_0x1b80a4,_0x1bc85f,_0x12d3db){var _0x1849c6={};var _0xdd13da={};var _0x41a213;var _0x61a92c;return db[_0x588d('0x30')][_0x588d('0x50')]({'where':{'id':_0x1b80a4['params']['id']}})[_0x588d('0x29')](handleEntityNotFound(_0x1bc85f,null))[_0x588d('0x29')](function(_0x5ae736){if(_0x5ae736){_0x41a213=_0x5ae736;_0xdd13da['model']=_['keys'](db[_0x588d('0x51')][_0x588d('0x31')]);_0xdd13da[_0x588d('0x36')]=_['keys'](_0x1b80a4[_0x588d('0x36')]);_0xdd13da[_0x588d('0x37')]=_['intersection'](_0xdd13da[_0x588d('0x34')],_0xdd13da[_0x588d('0x36')]);_0x1849c6[_0x588d('0x39')]=_[_0x588d('0x38')](_0xdd13da['model'],qs[_0x588d('0x3a')](_0x1b80a4[_0x588d('0x36')][_0x588d('0x3a')]));_0x1849c6[_0x588d('0x39')]=_0x1849c6[_0x588d('0x39')][_0x588d('0x3b')]?_0x1849c6['attributes']:_0xdd13da[_0x588d('0x34')];_0x1849c6[_0x588d('0x52')]=qs[_0x588d('0x3d')](_0x1b80a4[_0x588d('0x36')][_0x588d('0x3d')]);_0x1849c6[_0x588d('0x3e')]=qs[_0x588d('0x37')](_[_0x588d('0x53')](_0x1b80a4[_0x588d('0x36')],_0xdd13da[_0x588d('0x37')]));if(_0x1b80a4[_0x588d('0x36')]['filter']){_0x1849c6['where']=_[_0x588d('0x40')](_0x1849c6['where'],{'$or':_[_0x588d('0x2f')](_0x1849c6[_0x588d('0x39')],function(_0x4f2f09){var _0x217c53={};_0x217c53[_0x4f2f09]={'$like':'%'+_0x1b80a4[_0x588d('0x36')][_0x588d('0x3f')]+'%'};return _0x217c53;})});}_0x1849c6=_[_0x588d('0x40')]({},_0x1849c6,_0x1b80a4[_0x588d('0x43')]);return _0x41a213[_0x588d('0x4f')](_0x1849c6);}})[_0x588d('0x29')](function(_0x1df5a0){if(_0x1df5a0){_0x61a92c=_0x1df5a0[_0x588d('0x3b')];if(!_0x1b80a4['query'][_0x588d('0x3c')](_0x588d('0x54'))){_0x1849c6[_0x588d('0x23')]=qs[_0x588d('0x23')](_0x1b80a4['query'][_0x588d('0x23')]);_0x1849c6[_0x588d('0x21')]=qs['offset'](_0x1b80a4[_0x588d('0x36')]['offset']);}return _0x41a213['getConfigurations'](_0x1849c6);}})[_0x588d('0x29')](function(_0x22488b){if(_0x22488b){return _0x22488b?{'count':_0x61a92c,'rows':_0x22488b}:null;}})[_0x588d('0x29')](respondWithResult(_0x1bc85f,null))[_0x588d('0x47')](handleError(_0x1bc85f,null));};exports[_0x588d('0x55')]=function(_0x443691,_0x16689f,_0x3889ef){if(_0x443691[_0x588d('0x4d')]['id']){delete _0x443691['body']['id'];}return db[_0x588d('0x30')][_0x588d('0x50')]({'where':{'id':_0x443691[_0x588d('0x49')]['id']}})['then'](handleEntityNotFound(_0x16689f,null))[_0x588d('0x29')](function(_0x13eb8a){if(_0x13eb8a){_0x443691['body']['AccountId']=_0x13eb8a['id'];_0x443691[_0x588d('0x4d')][_0x588d('0x56')]=integrations[_0x588d('0x57')](_0x443691[_0x588d('0x4d')]['channel'],_0x443691[_0x588d('0x4d')][_0x588d('0x41')]);_0x443691['body'][_0x588d('0x58')]=integrations[_0x588d('0x59')](_0x443691[_0x588d('0x4d')][_0x588d('0x5a')],_0x443691[_0x588d('0x4d')]['type']);return db['SugarcrmConfiguration'][_0x588d('0x4b')](_0x443691[_0x588d('0x4d')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x588d('0x58')}]});}return null;})[_0x588d('0x29')](respondWithResult(_0x16689f,null))[_0x588d('0x47')](handleError(_0x16689f,null));};exports[_0x588d('0x5b')]=function(_0x1c464f,_0x1d8c05,_0x192b2e){var _0x2aba50='';var _0x50a495=['id',_0x588d('0x2c'),_0x588d('0x5c'),'created_by',_0x588d('0x5d'),_0x588d('0x5e'),_0x588d('0x5f'),_0x588d('0x60'),_0x588d('0x61'),_0x588d('0x62'),'parent_name',_0x588d('0x63')];return db[_0x588d('0x30')]['findOne']({'where':{'id':_0x1c464f[_0x588d('0x49')]['id']},'attributes':['id',_0x588d('0x64'),_0x588d('0x65'),_0x588d('0x66')]})[_0x588d('0x29')](handleEntityNotFound(_0x1d8c05,null))['then'](function(_0xda4951){if(_0xda4951){_0x2aba50=_0xda4951[_0x588d('0x66')];var _0xe529a1=_0x2aba50[_0x588d('0x67')](-0x1);if(_0xe529a1==='/'){_0x2aba50=_0x2aba50[_0x588d('0x68')](0x0,_0x2aba50[_0x588d('0x69')](_0xe529a1));}return rp({'method':'POST','uri':util[_0x588d('0x6a')]('%s%s',_0x2aba50,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x588d('0x6b'),'input_type':_0x588d('0x6c'),'response_type':_0x588d('0x6c'),'rest_data':JSON[_0x588d('0x6d')]({'user_auth':{'user_name':_0xda4951[_0x588d('0x64')],'password':_0xda4951[_0x588d('0x65')],'encryption':_0x588d('0x6e')},'application':_0x588d('0x6f')})}});}})[_0x588d('0x29')](function(_0x589ed6){if(_0x589ed6&&_0x589ed6[_0x588d('0x2c')]!=='Invalid\x20Login'&&_0x589ed6['name']!==_0x588d('0x70')){return rp({'method':_0x588d('0x71'),'uri':util[_0x588d('0x6a')](_0x588d('0x72'),_0x2aba50,_0x588d('0x73')),'json':!![],'form':{'method':_0x588d('0x74'),'input_type':_0x588d('0x6c'),'response_type':_0x588d('0x6c'),'rest_data':JSON[_0x588d('0x6d')]({'session':_0x589ed6['id'],'module_name':'Calls'})}})[_0x588d('0x29')](function(_0x45cfbd){if(_0x45cfbd){var _0x1f234e=_[_0x588d('0x75')](_0x45cfbd[_0x588d('0x76')]);_[_0x588d('0x77')](_0x1f234e,function(_0x2b318d){return _0x50a495['includes'](_0x2b318d[_0x588d('0x2c')]);});return{'count':_0x1f234e[_0x588d('0x3b')],'rows':_[_0x588d('0x2f')](_0x1f234e,function(_0xaf29c8){return{'id':_0xaf29c8['name'],'name':_0xaf29c8[_0x588d('0x78')],'custom':_[_0x588d('0x79')](_0xaf29c8[_0x588d('0x2c')],'_c')?!![]:![],'options':_0xaf29c8[_0x588d('0x43')]?_[_0x588d('0x2f')](_[_0x588d('0x75')](_0xaf29c8[_0x588d('0x43')]),function(_0x30307f){return{'name':_0x30307f[_0x588d('0x7a')],'value':_0x30307f[_0x588d('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x1d8c05,null))[_0x588d('0x47')](function(_0x46fed6){var _0x1a5a94=_0x1c464f['query']['test']?0x1f4:_0x46fed6[_0x588d('0x7b')]||0x1f4;logger[_0x588d('0x2b')](_0x588d('0x7c'),_0x588d('0x5b'),_0x1a5a94,JSON['stringify'](_0x46fed6));delete _0x46fed6['name'];if(_0x1a5a94===0x191){_0x1a5a94=0x190;}_0x1d8c05[_0x588d('0x1e')](_0x1a5a94)[_0x588d('0x2d')](_0x1c464f['query']['test']?{'message':_0x588d('0x7d'),'statusCode':_0x46fed6[_0x588d('0x7b')]}:_0x46fed6);});}else{var _0x321aae=0x1f4;_0x1d8c05[_0x588d('0x1e')](_0x321aae)['send']({'message':_0x588d('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 9bea431..87954ad 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43c=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x2c8860,_0x2b953c){var _0x5cdd3a=function(_0xe8601c){while(--_0xe8601c){_0x2c8860['push'](_0x2c8860['shift']());}};_0x5cdd3a(++_0x2b953c);}(_0xb43c,0x1ea));var _0xcb43=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb43c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xcb43('0x0'));var util=require(_0xcb43('0x1'));var logger=require(_0xcb43('0x2'))(_0xcb43('0x3'));var moment=require(_0xcb43('0x4'));var BPromise=require(_0xcb43('0x5'));var rp=require(_0xcb43('0x6'));var fs=require('fs');var path=require(_0xcb43('0x7'));var rimraf=require(_0xcb43('0x8'));var config=require(_0xcb43('0x9'));var attributes=require(_0xcb43('0xa'));var integrations=require(_0xcb43('0xb'));module['exports']=function(_0x3a6dfe,_0x3d412d){return _0x3a6dfe[_0xcb43('0xc')](_0xcb43('0xd'),attributes,{'tableName':_0xcb43('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ea5=['../../config/logger','bluebird','request-promise','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','util'];(function(_0x49cb8c,_0x4f59c0){var _0x3fd998=function(_0x4857b8){while(--_0x4857b8){_0x49cb8c['push'](_0x49cb8c['shift']());}};_0x3fd998(++_0x4f59c0);}(_0x0ea5,0x179));var _0x50ea=function(_0x1a9d3a,_0x34fd79){_0x1a9d3a=_0x1a9d3a-0x0;var _0x330d73=_0x0ea5[_0x1a9d3a];return _0x330d73;};'use strict';var _=require('lodash');var util=require(_0x50ea('0x0'));var logger=require(_0x50ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0x50ea('0x2'));var rp=require(_0x50ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x50ea('0x4'));var integrations=require('../../components/integrations/configuration');module[_0x50ea('0x5')]=function(_0x416e5e,_0x50f0e6){return _0x416e5e[_0x50ea('0x6')](_0x50ea('0x7'),attributes,{'tableName':_0x50ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index a0dd22e..520407b 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa21e=['error','code','message','SugarcrmAccount','options','raw','attributes','limit','include','map','model','GetSugarcrmAccount','catch','ShowSugarcrmAccount','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xa21e,0x1cd));var _0xea21=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xa21e[_0x305b20];return _0x26d64a;};'use strict';var _=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var moment=require(_0xea21('0x2'));var BPromise=require(_0xea21('0x3'));var rs=require(_0xea21('0x4'));var fs=require('fs');var Redis=require(_0xea21('0x5'));var db=require(_0xea21('0x6'))['db'];var utils=require(_0xea21('0x7'));var logger=require(_0xea21('0x8'))(_0xea21('0x9'));var config=require(_0xea21('0xa'));var jayson=require(_0xea21('0xb'));var client=jayson['client'][_0xea21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37a7d0,_0x27555e,_0x585e38){return new BPromise(function(_0x2541fa,_0x41d8ff){return client[_0xea21('0xd')](_0x37a7d0,_0x585e38)['then'](function(_0x4cc675){logger[_0xea21('0xe')](_0xea21('0xf'),_0x27555e,_0xea21('0x10'));logger[_0xea21('0x11')](_0xea21('0x12'),_0x27555e,_0xea21('0x10'),JSON[_0xea21('0x13')](_0x4cc675));if(_0x4cc675[_0xea21('0x14')]){if(_0x4cc675[_0xea21('0x14')][_0xea21('0x15')]===0x1f4){logger[_0xea21('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x27555e,_0x4cc675[_0xea21('0x14')]['message']);return _0x41d8ff(_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);}logger[_0xea21('0x14')](_0xea21('0xf'),_0x27555e,_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);return _0x2541fa(_0x4cc675[_0xea21('0x14')][_0xea21('0x16')]);}else{logger[_0xea21('0xe')](_0xea21('0xf'),_0x27555e,_0xea21('0x10'));_0x2541fa(_0x4cc675['result']['message']);}})['catch'](function(_0x4fb655){logger[_0xea21('0x14')](_0xea21('0xf'),_0x27555e,_0x4fb655);_0x41d8ff(_0x4fb655);});});}exports['GetSugarcrmAccount']=function(_0x33a324){var _0x598653=this;return new Promise(function(_0x4b4e0c,_0xbfc678){return db[_0xea21('0x17')]['findAll']({'raw':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x19')]===undefined?!![]:![]:!![],'where':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')]['where']||null:null,'attributes':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1a')]||null:null,'limit':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1b')]||null:null,'include':_0x33a324[_0xea21('0x18')]?_0x33a324[_0xea21('0x18')][_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x33a324[_0xea21('0x18')][_0xea21('0x1c')],function(_0x5ac6d5){return{'model':db[_0x5ac6d5[_0xea21('0x1e')]],'as':_0x5ac6d5['as'],'attributes':_0x5ac6d5[_0xea21('0x1a')],'include':_0x5ac6d5[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x5ac6d5[_0xea21('0x1c')],function(_0x27df35){return{'model':db[_0x27df35[_0xea21('0x1e')]],'as':_0x27df35['as'],'attributes':_0x27df35[_0xea21('0x1a')],'include':_0x27df35[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x27df35[_0xea21('0x1c')],function(_0x1c25ca){return{'model':db[_0x1c25ca[_0xea21('0x1e')]],'as':_0x1c25ca['as'],'attributes':_0x1c25ca[_0xea21('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc9640c){logger[_0xea21('0xe')](_0xea21('0x1f'),_0x33a324);logger[_0xea21('0x11')]('GetSugarcrmAccount',_0x33a324,JSON[_0xea21('0x13')](_0xc9640c));_0x4b4e0c(_0xc9640c);})[_0xea21('0x20')](function(_0xfec518){logger[_0xea21('0x14')]('GetSugarcrmAccount',_0xfec518[_0xea21('0x16')],_0x33a324);_0xbfc678(_0x598653[_0xea21('0x14')](0x1f4,_0xfec518['message']));});});};exports[_0xea21('0x21')]=function(_0x2018a8){var _0x2b2ebc=this;return new Promise(function(_0x38a443,_0x4c78b6){return db['SugarcrmAccount'][_0xea21('0x22')]({'raw':_0x2018a8['options']?_0x2018a8['options'][_0xea21('0x19')]===undefined?!![]:![]:!![],'where':_0x2018a8[_0xea21('0x18')]?_0x2018a8['options'][_0xea21('0x23')]||null:null,'attributes':_0x2018a8[_0xea21('0x18')]?_0x2018a8[_0xea21('0x18')][_0xea21('0x1a')]||null:null,'include':_0x2018a8[_0xea21('0x18')]?_0x2018a8['options'][_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x2018a8[_0xea21('0x18')][_0xea21('0x1c')],function(_0xcbf0f7){return{'model':db[_0xcbf0f7[_0xea21('0x1e')]],'as':_0xcbf0f7['as'],'attributes':_0xcbf0f7[_0xea21('0x1a')],'include':_0xcbf0f7[_0xea21('0x1c')]?_['map'](_0xcbf0f7[_0xea21('0x1c')],function(_0x1218c1){return{'model':db[_0x1218c1['model']],'as':_0x1218c1['as'],'attributes':_0x1218c1[_0xea21('0x1a')],'include':_0x1218c1[_0xea21('0x1c')]?_[_0xea21('0x1d')](_0x1218c1[_0xea21('0x1c')],function(_0x4a997b){return{'model':db[_0x4a997b['model']],'as':_0x4a997b['as'],'attributes':_0x4a997b['attributes']};}):[]};}):[]};}):[]:[]})[_0xea21('0x24')](function(_0x2a18bd){logger[_0xea21('0xe')](_0xea21('0x21'),_0x2018a8);logger[_0xea21('0x11')](_0xea21('0x21'),_0x2018a8,JSON[_0xea21('0x13')](_0x2a18bd));_0x38a443(_0x2a18bd);})[_0xea21('0x20')](function(_0x53ddd4){logger['error'](_0xea21('0x21'),_0x53ddd4['message'],_0x2018a8);_0x4c78b6(_0x2b2ebc[_0xea21('0x14')](0x1f4,_0x53ddd4[_0xea21('0x16')]));});});}; \ No newline at end of file +var _0xf9e1=['map','attributes','GetSugarcrmAccount','debug','ShowSugarcrmAccount','find','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SugarcrmAccount','options','raw','where','include'];(function(_0x344073,_0x443928){var _0x22aa0d=function(_0x35b44f){while(--_0x35b44f){_0x344073['push'](_0x344073['shift']());}};_0x22aa0d(++_0x443928);}(_0xf9e1,0xf5));var _0x1f9e=function(_0x1d0639,_0x452cc3){_0x1d0639=_0x1d0639-0x0;var _0x572dbb=_0xf9e1[_0x1d0639];return _0x572dbb;};'use strict';var _=require(_0x1f9e('0x0'));var util=require(_0x1f9e('0x1'));var moment=require(_0x1f9e('0x2'));var BPromise=require(_0x1f9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1f9e('0x4'));var db=require(_0x1f9e('0x5'))['db'];var utils=require(_0x1f9e('0x6'));var logger=require(_0x1f9e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1f9e('0x8'));var client=jayson[_0x1f9e('0x9')][_0x1f9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16a6bd,_0x218217,_0x785a01){return new BPromise(function(_0x3b1b61,_0x388212){return client['request'](_0x16a6bd,_0x785a01)[_0x1f9e('0xb')](function(_0x34c48a){logger['info'](_0x1f9e('0xc'),_0x218217,_0x1f9e('0xd'));logger['debug'](_0x1f9e('0xe'),_0x218217,'request\x20sent',JSON[_0x1f9e('0xf')](_0x34c48a));if(_0x34c48a[_0x1f9e('0x10')]){if(_0x34c48a[_0x1f9e('0x10')][_0x1f9e('0x11')]===0x1f4){logger[_0x1f9e('0x10')](_0x1f9e('0xc'),_0x218217,_0x34c48a['error'][_0x1f9e('0x12')]);return _0x388212(_0x34c48a[_0x1f9e('0x10')][_0x1f9e('0x12')]);}logger[_0x1f9e('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x218217,_0x34c48a[_0x1f9e('0x10')]['message']);return _0x3b1b61(_0x34c48a[_0x1f9e('0x10')]['message']);}else{logger[_0x1f9e('0x13')](_0x1f9e('0xc'),_0x218217,_0x1f9e('0xd'));_0x3b1b61(_0x34c48a[_0x1f9e('0x14')]['message']);}})[_0x1f9e('0x15')](function(_0x2fa62e){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x218217,_0x2fa62e);_0x388212(_0x2fa62e);});});}exports['GetSugarcrmAccount']=function(_0x3d0d6a){var _0x5255d5=this;return new Promise(function(_0x27b838,_0xd6574b){return db[_0x1f9e('0x16')]['findAll']({'raw':_0x3d0d6a[_0x1f9e('0x17')]?_0x3d0d6a[_0x1f9e('0x17')][_0x1f9e('0x18')]===undefined?!![]:![]:!![],'where':_0x3d0d6a['options']?_0x3d0d6a[_0x1f9e('0x17')][_0x1f9e('0x19')]||null:null,'attributes':_0x3d0d6a[_0x1f9e('0x17')]?_0x3d0d6a[_0x1f9e('0x17')]['attributes']||null:null,'limit':_0x3d0d6a[_0x1f9e('0x17')]?_0x3d0d6a['options']['limit']||null:null,'include':_0x3d0d6a[_0x1f9e('0x17')]?_0x3d0d6a[_0x1f9e('0x17')][_0x1f9e('0x1a')]?_[_0x1f9e('0x1b')](_0x3d0d6a[_0x1f9e('0x17')][_0x1f9e('0x1a')],function(_0x3d17b5){return{'model':db[_0x3d17b5['model']],'as':_0x3d17b5['as'],'attributes':_0x3d17b5[_0x1f9e('0x1c')],'include':_0x3d17b5[_0x1f9e('0x1a')]?_[_0x1f9e('0x1b')](_0x3d17b5[_0x1f9e('0x1a')],function(_0x4602b0){return{'model':db[_0x4602b0['model']],'as':_0x4602b0['as'],'attributes':_0x4602b0[_0x1f9e('0x1c')],'include':_0x4602b0[_0x1f9e('0x1a')]?_[_0x1f9e('0x1b')](_0x4602b0[_0x1f9e('0x1a')],function(_0x1e678d){return{'model':db[_0x1e678d['model']],'as':_0x1e678d['as'],'attributes':_0x1e678d[_0x1f9e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28e4b2){logger[_0x1f9e('0x13')](_0x1f9e('0x1d'),_0x3d0d6a);logger[_0x1f9e('0x1e')](_0x1f9e('0x1d'),_0x3d0d6a,JSON['stringify'](_0x28e4b2));_0x27b838(_0x28e4b2);})[_0x1f9e('0x15')](function(_0x481de1){logger[_0x1f9e('0x10')](_0x1f9e('0x1d'),_0x481de1[_0x1f9e('0x12')],_0x3d0d6a);_0xd6574b(_0x5255d5['error'](0x1f4,_0x481de1[_0x1f9e('0x12')]));});});};exports[_0x1f9e('0x1f')]=function(_0x577272){var _0x4a83d9=this;return new Promise(function(_0x1e8a17,_0x2c7e92){return db[_0x1f9e('0x16')][_0x1f9e('0x20')]({'raw':_0x577272[_0x1f9e('0x17')]?_0x577272['options'][_0x1f9e('0x18')]===undefined?!![]:![]:!![],'where':_0x577272[_0x1f9e('0x17')]?_0x577272[_0x1f9e('0x17')][_0x1f9e('0x19')]||null:null,'attributes':_0x577272['options']?_0x577272['options'][_0x1f9e('0x1c')]||null:null,'include':_0x577272['options']?_0x577272[_0x1f9e('0x17')][_0x1f9e('0x1a')]?_[_0x1f9e('0x1b')](_0x577272[_0x1f9e('0x17')]['include'],function(_0x249cad){return{'model':db[_0x249cad[_0x1f9e('0x21')]],'as':_0x249cad['as'],'attributes':_0x249cad[_0x1f9e('0x1c')],'include':_0x249cad[_0x1f9e('0x1a')]?_['map'](_0x249cad[_0x1f9e('0x1a')],function(_0x1ab0ff){return{'model':db[_0x1ab0ff[_0x1f9e('0x21')]],'as':_0x1ab0ff['as'],'attributes':_0x1ab0ff[_0x1f9e('0x1c')],'include':_0x1ab0ff[_0x1f9e('0x1a')]?_[_0x1f9e('0x1b')](_0x1ab0ff['include'],function(_0x4bd50e){return{'model':db[_0x4bd50e[_0x1f9e('0x21')]],'as':_0x4bd50e['as'],'attributes':_0x4bd50e[_0x1f9e('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x475dcc){logger[_0x1f9e('0x13')]('ShowSugarcrmAccount',_0x577272);logger[_0x1f9e('0x1e')](_0x1f9e('0x1f'),_0x577272,JSON['stringify'](_0x475dcc));_0x1e8a17(_0x475dcc);})[_0x1f9e('0x15')](function(_0x124f1b){logger[_0x1f9e('0x10')](_0x1f9e('0x1f'),_0x124f1b[_0x1f9e('0x12')],_0x577272);_0x2c7e92(_0x4a83d9[_0x1f9e('0x10')](0x1f4,_0x124f1b[_0x1f9e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index ee5b3c1..3ad3d58 100644 --- a/server/api/intSugarcrmConfiguration/index.js +++ b/server/api/intSugarcrmConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9536=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy'];(function(_0x36fec2,_0x567797){var _0x21741c=function(_0x4fe689){while(--_0x4fe689){_0x36fec2['push'](_0x36fec2['shift']());}};_0x21741c(++_0x567797);}(_0x9536,0x109));var _0x6953=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x9536[_0x3b7b8a];return _0x441206;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require('connect-timeout');var express=require(_0x6953('0x3'));var router=express['Router']();var fs_extra=require(_0x6953('0x4'));var auth=require(_0x6953('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller[_0x6953('0xa')]);router[_0x6953('0x8')](_0x6953('0xb'),auth[_0x6953('0x9')](),controller[_0x6953('0xc')]);router[_0x6953('0x8')]('/:id/fields',auth[_0x6953('0x9')](),controller[_0x6953('0xd')]);router[_0x6953('0x8')](_0x6953('0xe'),auth[_0x6953('0x9')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);router['post']('/',auth[_0x6953('0x9')](),controller[_0x6953('0x12')]);router[_0x6953('0x13')](_0x6953('0xb'),auth[_0x6953('0x9')](),controller[_0x6953('0x14')]);router[_0x6953('0x15')](_0x6953('0xb'),auth['isAuthenticated'](),controller[_0x6953('0x16')]);module[_0x6953('0x17')]=router; \ No newline at end of file +var _0x2a97=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update'];(function(_0x6bba4b,_0x559ed0){var _0x57959d=function(_0x2ed84c){while(--_0x2ed84c){_0x6bba4b['push'](_0x6bba4b['shift']());}};_0x57959d(++_0x559ed0);}(_0x2a97,0x182));var _0x72a9=function(_0x319f92,_0x1b2296){_0x319f92=_0x319f92-0x0;var _0x36dd0d=_0x2a97[_0x319f92];return _0x36dd0d;};'use strict';var multer=require(_0x72a9('0x0'));var util=require('util');var path=require(_0x72a9('0x1'));var timeout=require(_0x72a9('0x2'));var express=require(_0x72a9('0x3'));var router=express[_0x72a9('0x4')]();var fs_extra=require(_0x72a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x72a9('0x6'));var config=require(_0x72a9('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x72a9('0x8')](),controller[_0x72a9('0x9')]);router['get'](_0x72a9('0xa'),auth[_0x72a9('0x8')](),controller[_0x72a9('0xb')]);router[_0x72a9('0xc')](_0x72a9('0xd'),auth[_0x72a9('0x8')](),controller[_0x72a9('0xe')]);router[_0x72a9('0xc')](_0x72a9('0xf'),auth['isAuthenticated'](),controller[_0x72a9('0x10')]);router['get'](_0x72a9('0x11'),auth[_0x72a9('0x8')](),controller['getDescriptions']);router[_0x72a9('0x12')]('/',auth[_0x72a9('0x8')](),controller[_0x72a9('0x13')]);router[_0x72a9('0x14')]('/:id',auth[_0x72a9('0x8')](),controller[_0x72a9('0x15')]);router['delete']('/:id',auth[_0x72a9('0x8')](),controller[_0x72a9('0x16')]);module[_0x72a9('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3a3f506..56f705c 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbe0=['sequelize','exports','STRING'];(function(_0x38c2f7,_0x4f190f){var _0x426ab9=function(_0x5dc07a){while(--_0x5dc07a){_0x38c2f7['push'](_0x38c2f7['shift']());}};_0x426ab9(++_0x4f190f);}(_0xdbe0,0x168));var _0x0dbe=function(_0x36ee5c,_0x2700c7){_0x36ee5c=_0x36ee5c-0x0;var _0x3002be=_0xdbe0[_0x36ee5c];return _0x3002be;};'use strict';var Sequelize=require(_0x0dbe('0x0'));module[_0x0dbe('0x1')]={'name':{'type':Sequelize[_0x0dbe('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6d0=['STRING','exports'];(function(_0x43c23b,_0x136f62){var _0x3c1613=function(_0x36ed27){while(--_0x36ed27){_0x43c23b['push'](_0x43c23b['shift']());}};_0x3c1613(++_0x136f62);}(_0xd6d0,0x16f));var _0x0d6d=function(_0x27469f,_0x2516ff){_0x27469f=_0x27469f-0x0;var _0x55781a=_0xd6d0[_0x27469f];return _0x55781a;};'use strict';var Sequelize=require('sequelize');module[_0x0d6d('0x0')]={'name':{'type':Sequelize[_0x0d6d('0x1')]},'description':{'type':Sequelize[_0x0d6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2f17af9..4b66999 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41bb=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','name','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne','SugarcrmField','getSubjects','keys','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x4ded63,_0x3bb556){var _0x5deae9=function(_0x54800c){while(--_0x54800c){_0x4ded63['push'](_0x4ded63['shift']());}};_0x5deae9(++_0x3bb556);}(_0x41bb,0x8d));var _0xb41b=function(_0x1239ad,_0x3a66a0){_0x1239ad=_0x1239ad-0x0;var _0x173b03=_0x41bb[_0x1239ad];return _0x173b03;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb41b('0x0'));var jsonpatch=require(_0xb41b('0x1'));var rp=require(_0xb41b('0x2'));var moment=require(_0xb41b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb41b('0x4'));var path=require('path');var sox=require(_0xb41b('0x5'));var csv=require(_0xb41b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0x7'));var jsforce=require(_0xb41b('0x8'));var deskjs=require(_0xb41b('0x9'));var toCsv=require(_0xb41b('0x6'));var querystring=require(_0xb41b('0xa'));var Papa=require(_0xb41b('0xb'));var Redis=require(_0xb41b('0xc'));var authService=require(_0xb41b('0xd'));var qs=require(_0xb41b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb41b('0xf'));var logger=require(_0xb41b('0x10'))(_0xb41b('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb41b('0x12'));var db=require(_0xb41b('0x13'))['db'];function respondWithStatusCode(_0x118953,_0x3db83b){_0x3db83b=_0x3db83b||0xcc;return function(_0x155e69){if(_0x155e69){return _0x118953[_0xb41b('0x14')](_0x3db83b);}return _0x118953[_0xb41b('0x15')](_0x3db83b)[_0xb41b('0x16')]();};}function respondWithResult(_0x4be730,_0x402157){_0x402157=_0x402157||0xc8;return function(_0x67159a){if(_0x67159a){return _0x4be730[_0xb41b('0x15')](_0x402157)[_0xb41b('0x17')](_0x67159a);}};}function respondWithFilteredResult(_0x50d5ea,_0x568416){return function(_0x488185){if(_0x488185){var _0x5af704=typeof _0x568416[_0xb41b('0x18')]===_0xb41b('0x19')&&typeof _0x568416[_0xb41b('0x1a')]===_0xb41b('0x19');var _0x4f5315=_0x488185[_0xb41b('0x1b')];var _0x133056=_0x5af704?0x0:_0x568416['offset'];var _0x322e57=_0x5af704?_0x488185[_0xb41b('0x1b')]:_0x568416['offset']+_0x568416[_0xb41b('0x1a')];var _0x5f28aa;if(_0x322e57>=_0x4f5315){_0x322e57=_0x4f5315;_0x5f28aa=0xc8;}else{_0x5f28aa=0xce;}_0x50d5ea[_0xb41b('0x15')](_0x5f28aa);return _0x50d5ea[_0xb41b('0x1c')](_0xb41b('0x1d'),_0x133056+'-'+_0x322e57+'/'+_0x4f5315)[_0xb41b('0x17')](_0x488185);}return null;};}function patchUpdates(_0x3ee518){return function(_0x29e6b4){try{jsonpatch[_0xb41b('0x1e')](_0x29e6b4,_0x3ee518,!![]);}catch(_0x165867){return BPromise['reject'](_0x165867);}return _0x29e6b4['save']();};}function saveUpdates(_0x3abbd9,_0x1c4ffb){return function(_0x3b2913){if(_0x3b2913){return _0x3b2913[_0xb41b('0x1f')](_0x3abbd9)[_0xb41b('0x20')](function(_0x55204f){return _0x55204f;});}return null;};}function removeEntity(_0x5a869b,_0x4a1a79){return function(_0x43eef4){if(_0x43eef4){return _0x43eef4[_0xb41b('0x21')]()[_0xb41b('0x20')](function(){_0x5a869b['status'](0xcc)[_0xb41b('0x16')]();});}};}function handleEntityNotFound(_0x2f613b,_0x329a3f){return function(_0x50dbb6){if(!_0x50dbb6){_0x2f613b[_0xb41b('0x14')](0x194);}return _0x50dbb6;};}function handleError(_0x1d3215,_0x1feb75){_0x1feb75=_0x1feb75||0x1f4;return function(_0x5e2535){logger[_0xb41b('0x22')](_0x5e2535[_0xb41b('0x23')]);if(_0x5e2535['name']){delete _0x5e2535['name'];}_0x1d3215[_0xb41b('0x15')](_0x1feb75)[_0xb41b('0x24')](_0x5e2535);};}exports[_0xb41b('0x25')]=function(_0x3bcb04,_0x44d06c){var _0x56f7d3={},_0x135e46={},_0x446309={'count':0x0,'rows':[]};var _0x3a0bba=_[_0xb41b('0x26')](db[_0xb41b('0x27')][_0xb41b('0x28')],function(_0x396d50){return{'name':_0x396d50[_0xb41b('0x29')],'type':_0x396d50['type'][_0xb41b('0x2a')]};});_0x135e46['model']=_[_0xb41b('0x26')](_0x3a0bba,_0xb41b('0x2b'));_0x135e46['query']=_['keys'](_0x3bcb04[_0xb41b('0x2c')]);_0x135e46['filters']=_[_0xb41b('0x2d')](_0x135e46[_0xb41b('0x2e')],_0x135e46[_0xb41b('0x2c')]);_0x56f7d3[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x135e46[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x3bcb04['query'][_0xb41b('0x30')]));_0x56f7d3['attributes']=_0x56f7d3[_0xb41b('0x2f')]['length']?_0x56f7d3[_0xb41b('0x2f')]:_0x135e46[_0xb41b('0x2e')];if(!_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x31')](_0xb41b('0x32'))){_0x56f7d3[_0xb41b('0x1a')]=qs['limit'](_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x56f7d3[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x3bcb04[_0xb41b('0x2c')]['offset']);}_0x56f7d3[_0xb41b('0x33')]=qs['sort'](_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x56f7d3[_0xb41b('0x35')]=qs['filters'](_[_0xb41b('0x36')](_0x3bcb04[_0xb41b('0x2c')],_0x135e46[_0xb41b('0x37')]),_0x3a0bba);if(_0x3bcb04[_0xb41b('0x2c')]['filter']){_0x56f7d3[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x56f7d3[_0xb41b('0x35')],{'$or':_[_0xb41b('0x26')](_0x3a0bba,function(_0x1ad12c){if(_0x1ad12c['type']!==_0xb41b('0x39')){var _0x179607={};_0x179607[_0x1ad12c[_0xb41b('0x2b')]]={'$like':'%'+_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x3a')]+'%'};return _0x179607;}})});}_0x56f7d3=_[_0xb41b('0x38')]({},_0x56f7d3,_0x3bcb04[_0xb41b('0x3b')]);var _0x2cda9a={'where':_0x56f7d3[_0xb41b('0x35')]};return db['SugarcrmConfiguration'][_0xb41b('0x1b')](_0x2cda9a)[_0xb41b('0x20')](function(_0x34c50f){_0x446309[_0xb41b('0x1b')]=_0x34c50f;if(_0x3bcb04[_0xb41b('0x2c')][_0xb41b('0x3c')]){_0x56f7d3['include']=[{'all':!![]}];}return db[_0xb41b('0x27')][_0xb41b('0x3d')](_0x56f7d3);})['then'](function(_0x261d23){_0x446309[_0xb41b('0x3e')]=_0x261d23;return _0x446309;})[_0xb41b('0x20')](respondWithFilteredResult(_0x44d06c,_0x56f7d3))[_0xb41b('0x3f')](handleError(_0x44d06c,null));};exports[_0xb41b('0x40')]=function(_0x4cf9a1,_0x5ef350){var _0xe82b4c={'raw':![],'where':{'id':_0x4cf9a1[_0xb41b('0x41')]['id']}},_0x423a1e={};_0x423a1e[_0xb41b('0x2e')]=_['keys'](db[_0xb41b('0x27')][_0xb41b('0x28')]);_0x423a1e[_0xb41b('0x2c')]=_['keys'](_0x4cf9a1['query']);_0x423a1e[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x423a1e[_0xb41b('0x2e')],_0x423a1e[_0xb41b('0x2c')]);_0xe82b4c[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x423a1e['model'],qs[_0xb41b('0x30')](_0x4cf9a1[_0xb41b('0x2c')][_0xb41b('0x30')]));_0xe82b4c[_0xb41b('0x2f')]=_0xe82b4c[_0xb41b('0x2f')][_0xb41b('0x42')]?_0xe82b4c[_0xb41b('0x2f')]:_0x423a1e[_0xb41b('0x2e')];if(_0x4cf9a1[_0xb41b('0x2c')][_0xb41b('0x3c')]){_0xe82b4c[_0xb41b('0x43')]=[{'all':!![]}];}_0xe82b4c=_[_0xb41b('0x38')]({},_0xe82b4c,_0x4cf9a1['options']);return db[_0xb41b('0x27')][_0xb41b('0x44')](_0xe82b4c)[_0xb41b('0x20')](handleEntityNotFound(_0x5ef350,null))[_0xb41b('0x20')](respondWithResult(_0x5ef350,null))[_0xb41b('0x3f')](handleError(_0x5ef350,null));};exports['create']=function(_0x4b6e34,_0x2b1139){return db[_0xb41b('0x27')][_0xb41b('0x45')](_0x4b6e34['body'],{})[_0xb41b('0x20')](respondWithResult(_0x2b1139,0xc9))[_0xb41b('0x3f')](handleError(_0x2b1139,null));};exports[_0xb41b('0x1f')]=function(_0x16761f,_0x398fe5){if(_0x16761f['body']['id']){delete _0x16761f[_0xb41b('0x46')]['id'];}return db['SugarcrmConfiguration'][_0xb41b('0x44')]({'where':{'id':_0x16761f[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x398fe5,null))['then'](saveUpdates(_0x16761f[_0xb41b('0x46')],null))[_0xb41b('0x20')](respondWithResult(_0x398fe5,null))[_0xb41b('0x3f')](handleError(_0x398fe5,null));};exports[_0xb41b('0x21')]=function(_0x3fa402,_0x540861){return db[_0xb41b('0x27')][_0xb41b('0x44')]({'where':{'id':_0x3fa402[_0xb41b('0x41')]['id']}})['then'](handleEntityNotFound(_0x540861,null))[_0xb41b('0x20')](removeEntity(_0x540861,null))['catch'](handleError(_0x540861,null));};exports[_0xb41b('0x47')]=function(_0x2b5957,_0x23a18b,_0x16de8e){var _0x323b2c={};var _0x3d91ce={};var _0x29862d;var _0x3de8b2;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x2b5957[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x23a18b,null))['then'](function(_0x11b369){if(_0x11b369){_0x29862d=_0x11b369;_0x3d91ce[_0xb41b('0x2e')]=_['keys'](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x3d91ce[_0xb41b('0x2c')]=_['keys'](_0x2b5957[_0xb41b('0x2c')]);_0x3d91ce[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x3d91ce['model'],_0x3d91ce[_0xb41b('0x2c')]);_0x323b2c[_0xb41b('0x2f')]=_['intersection'](_0x3d91ce[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x323b2c['attributes']=_0x323b2c[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x323b2c['attributes']:_0x3d91ce[_0xb41b('0x2e')];_0x323b2c[_0xb41b('0x33')]=qs[_0xb41b('0x34')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x323b2c[_0xb41b('0x35')]=qs[_0xb41b('0x37')](_['pick'](_0x2b5957[_0xb41b('0x2c')],_0x3d91ce[_0xb41b('0x37')]));if(_0x2b5957['query'][_0xb41b('0x3a')]){_0x323b2c[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x323b2c[_0xb41b('0x35')],{'$or':_[_0xb41b('0x26')](_0x323b2c[_0xb41b('0x2f')],function(_0x21bff7){var _0xac836c={};_0xac836c[_0x21bff7]={'$like':'%'+_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x3a')]+'%'};return _0xac836c;})});}_0x323b2c=_['merge']({},_0x323b2c,_0x2b5957[_0xb41b('0x3b')]);return _0x29862d['getFields'](_0x323b2c);}})[_0xb41b('0x20')](function(_0xd89aa8){if(_0xd89aa8){_0x3de8b2=_0xd89aa8['length'];if(!_0x2b5957[_0xb41b('0x2c')]['hasOwnProperty']('nolimit')){_0x323b2c[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x323b2c[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x2b5957[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x29862d[_0xb41b('0x47')](_0x323b2c);}})[_0xb41b('0x20')](function(_0x5c0840){if(_0x5c0840){return _0x5c0840?{'count':_0x3de8b2,'rows':_0x5c0840}:null;}})['then'](respondWithResult(_0x23a18b,null))[_0xb41b('0x3f')](handleError(_0x23a18b,null));};exports[_0xb41b('0x4a')]=function(_0x190353,_0x5adb82,_0x934a00){var _0x22642b={};var _0x2b44a2={};var _0x712461;var _0xb00776;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x190353[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x5adb82,null))['then'](function(_0x8ce739){if(_0x8ce739){_0x712461=_0x8ce739;_0x2b44a2['model']=_[_0xb41b('0x4b')](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x2b44a2[_0xb41b('0x2c')]=_[_0xb41b('0x4b')](_0x190353[_0xb41b('0x2c')]);_0x2b44a2[_0xb41b('0x37')]=_['intersection'](_0x2b44a2[_0xb41b('0x2e')],_0x2b44a2['query']);_0x22642b[_0xb41b('0x2f')]=_[_0xb41b('0x2d')](_0x2b44a2[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x190353[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x22642b['attributes']=_0x22642b[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x22642b[_0xb41b('0x2f')]:_0x2b44a2[_0xb41b('0x2e')];_0x22642b['order']=qs['sort'](_0x190353['query']['sort']);_0x22642b[_0xb41b('0x35')]=qs['filters'](_[_0xb41b('0x36')](_0x190353[_0xb41b('0x2c')],_0x2b44a2['filters']));if(_0x190353[_0xb41b('0x2c')][_0xb41b('0x3a')]){_0x22642b[_0xb41b('0x35')]=_[_0xb41b('0x38')](_0x22642b[_0xb41b('0x35')],{'$or':_['map'](_0x22642b['attributes'],function(_0x26ec9f){var _0x15a640={};_0x15a640[_0x26ec9f]={'$like':'%'+_0x190353['query'][_0xb41b('0x3a')]+'%'};return _0x15a640;})});}_0x22642b=_['merge']({},_0x22642b,_0x190353[_0xb41b('0x3b')]);return _0x712461[_0xb41b('0x4a')](_0x22642b);}})['then'](function(_0xbdaa8a){if(_0xbdaa8a){_0xb00776=_0xbdaa8a[_0xb41b('0x42')];if(!_0x190353['query'][_0xb41b('0x31')]('nolimit')){_0x22642b[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x190353[_0xb41b('0x2c')][_0xb41b('0x1a')]);_0x22642b[_0xb41b('0x18')]=qs['offset'](_0x190353[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x712461['getSubjects'](_0x22642b);}})['then'](function(_0x4f10ef){if(_0x4f10ef){return _0x4f10ef?{'count':_0xb00776,'rows':_0x4f10ef}:null;}})[_0xb41b('0x20')](respondWithResult(_0x5adb82,null))[_0xb41b('0x3f')](handleError(_0x5adb82,null));};exports['getDescriptions']=function(_0x5286b4,_0x26ab5f,_0x30d200){var _0x4b8830={};var _0x22b7a9={};var _0x2c114c;var _0x951592;return db[_0xb41b('0x27')][_0xb41b('0x48')]({'where':{'id':_0x5286b4[_0xb41b('0x41')]['id']}})[_0xb41b('0x20')](handleEntityNotFound(_0x26ab5f,null))[_0xb41b('0x20')](function(_0x539bba){if(_0x539bba){_0x2c114c=_0x539bba;_0x22b7a9[_0xb41b('0x2e')]=_[_0xb41b('0x4b')](db[_0xb41b('0x49')][_0xb41b('0x28')]);_0x22b7a9[_0xb41b('0x2c')]=_[_0xb41b('0x4b')](_0x5286b4[_0xb41b('0x2c')]);_0x22b7a9[_0xb41b('0x37')]=_[_0xb41b('0x2d')](_0x22b7a9[_0xb41b('0x2e')],_0x22b7a9[_0xb41b('0x2c')]);_0x4b8830[_0xb41b('0x2f')]=_['intersection'](_0x22b7a9[_0xb41b('0x2e')],qs[_0xb41b('0x30')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x30')]));_0x4b8830[_0xb41b('0x2f')]=_0x4b8830[_0xb41b('0x2f')][_0xb41b('0x42')]?_0x4b8830[_0xb41b('0x2f')]:_0x22b7a9[_0xb41b('0x2e')];_0x4b8830[_0xb41b('0x33')]=qs[_0xb41b('0x34')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x34')]);_0x4b8830[_0xb41b('0x35')]=qs[_0xb41b('0x37')](_['pick'](_0x5286b4['query'],_0x22b7a9['filters']));if(_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x3a')]){_0x4b8830['where']=_[_0xb41b('0x38')](_0x4b8830['where'],{'$or':_[_0xb41b('0x26')](_0x4b8830[_0xb41b('0x2f')],function(_0x2746bb){var _0x574c26={};_0x574c26[_0x2746bb]={'$like':'%'+_0x5286b4['query'][_0xb41b('0x3a')]+'%'};return _0x574c26;})});}_0x4b8830=_['merge']({},_0x4b8830,_0x5286b4[_0xb41b('0x3b')]);return _0x2c114c[_0xb41b('0x4c')](_0x4b8830);}})['then'](function(_0xe01fbd){if(_0xe01fbd){_0x951592=_0xe01fbd['length'];if(!_0x5286b4[_0xb41b('0x2c')]['hasOwnProperty'](_0xb41b('0x32'))){_0x4b8830[_0xb41b('0x1a')]=qs[_0xb41b('0x1a')](_0x5286b4['query'][_0xb41b('0x1a')]);_0x4b8830[_0xb41b('0x18')]=qs[_0xb41b('0x18')](_0x5286b4[_0xb41b('0x2c')][_0xb41b('0x18')]);}return _0x2c114c[_0xb41b('0x4c')](_0x4b8830);}})[_0xb41b('0x20')](function(_0x10ab8e){if(_0x10ab8e){return _0x10ab8e?{'count':_0x951592,'rows':_0x10ab8e}:null;}})[_0xb41b('0x20')](respondWithResult(_0x26ab5f,null))[_0xb41b('0x3f')](handleError(_0x26ab5f,null));}; \ No newline at end of file +var _0x9b38=['model','query','filters','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','create','body','find','getFields','findOne','SugarcrmField','rawAttributes','hasOwnProperty','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SugarcrmConfiguration'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9b38,0x73));var _0x89b3=function(_0x522d05,_0x350cda){_0x522d05=_0x522d05-0x0;var _0xedc4f7=_0x9b38[_0x522d05];return _0xedc4f7;};'use strict';var emlformat=require(_0x89b3('0x0'));var rimraf=require(_0x89b3('0x1'));var zipdir=require(_0x89b3('0x2'));var jsonpatch=require(_0x89b3('0x3'));var rp=require(_0x89b3('0x4'));var moment=require(_0x89b3('0x5'));var BPromise=require(_0x89b3('0x6'));var Mustache=require('mustache');var util=require(_0x89b3('0x7'));var path=require(_0x89b3('0x8'));var sox=require('sox');var csv=require(_0x89b3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89b3('0xa'));var _=require(_0x89b3('0xb'));var squel=require('squel');var crypto=require(_0x89b3('0xc'));var jsforce=require(_0x89b3('0xd'));var deskjs=require(_0x89b3('0xe'));var toCsv=require(_0x89b3('0x9'));var querystring=require('querystring');var Papa=require(_0x89b3('0xf'));var Redis=require(_0x89b3('0x10'));var authService=require(_0x89b3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x89b3('0x12'));var hardwareService=require(_0x89b3('0x13'));var logger=require(_0x89b3('0x14'))(_0x89b3('0x15'));var utils=require(_0x89b3('0x16'));var config=require(_0x89b3('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x181aa5,_0x12c449){_0x12c449=_0x12c449||0xcc;return function(_0x1b1ca9){if(_0x1b1ca9){return _0x181aa5[_0x89b3('0x18')](_0x12c449);}return _0x181aa5['status'](_0x12c449)[_0x89b3('0x19')]();};}function respondWithResult(_0x3e4708,_0x544473){_0x544473=_0x544473||0xc8;return function(_0xb8e00b){if(_0xb8e00b){return _0x3e4708[_0x89b3('0x1a')](_0x544473)[_0x89b3('0x1b')](_0xb8e00b);}};}function respondWithFilteredResult(_0x21a9e6,_0x5b3c26){return function(_0x4d3158){if(_0x4d3158){var _0x153650=typeof _0x5b3c26['offset']===_0x89b3('0x1c')&&typeof _0x5b3c26[_0x89b3('0x1d')]===_0x89b3('0x1c');var _0x1e4db0=_0x4d3158[_0x89b3('0x1e')];var _0x5b7623=_0x153650?0x0:_0x5b3c26[_0x89b3('0x1f')];var _0x1396ab=_0x153650?_0x4d3158[_0x89b3('0x1e')]:_0x5b3c26[_0x89b3('0x1f')]+_0x5b3c26[_0x89b3('0x1d')];var _0x1362dd;if(_0x1396ab>=_0x1e4db0){_0x1396ab=_0x1e4db0;_0x1362dd=0xc8;}else{_0x1362dd=0xce;}_0x21a9e6[_0x89b3('0x1a')](_0x1362dd);return _0x21a9e6['set'](_0x89b3('0x20'),_0x5b7623+'-'+_0x1396ab+'/'+_0x1e4db0)[_0x89b3('0x1b')](_0x4d3158);}return null;};}function patchUpdates(_0x4367eb){return function(_0x1800bd){try{jsonpatch[_0x89b3('0x21')](_0x1800bd,_0x4367eb,!![]);}catch(_0x247c32){return BPromise[_0x89b3('0x22')](_0x247c32);}return _0x1800bd[_0x89b3('0x23')]();};}function saveUpdates(_0x103353,_0x1bd43a){return function(_0x19c1d5){if(_0x19c1d5){return _0x19c1d5[_0x89b3('0x24')](_0x103353)[_0x89b3('0x25')](function(_0x2cec1d){return _0x2cec1d;});}return null;};}function removeEntity(_0x28e91e,_0x19970f){return function(_0x579412){if(_0x579412){return _0x579412[_0x89b3('0x26')]()[_0x89b3('0x25')](function(){_0x28e91e[_0x89b3('0x1a')](0xcc)[_0x89b3('0x19')]();});}};}function handleEntityNotFound(_0x2571a1,_0xfbc23a){return function(_0x4c1e40){if(!_0x4c1e40){_0x2571a1[_0x89b3('0x18')](0x194);}return _0x4c1e40;};}function handleError(_0x12ce3b,_0x546821){_0x546821=_0x546821||0x1f4;return function(_0x2d3ba5){logger[_0x89b3('0x27')](_0x2d3ba5[_0x89b3('0x28')]);if(_0x2d3ba5[_0x89b3('0x29')]){delete _0x2d3ba5[_0x89b3('0x29')];}_0x12ce3b[_0x89b3('0x1a')](_0x546821)[_0x89b3('0x2a')](_0x2d3ba5);};}exports['index']=function(_0x1abb2e,_0x4128f3){var _0x31fdf8={},_0x598e70={},_0x53c1e0={'count':0x0,'rows':[]};var _0x4504d0=_[_0x89b3('0x2b')](db[_0x89b3('0x2c')]['rawAttributes'],function(_0x69e73f){return{'name':_0x69e73f['fieldName'],'type':_0x69e73f['type']['key']};});_0x598e70[_0x89b3('0x2d')]=_[_0x89b3('0x2b')](_0x4504d0,'name');_0x598e70[_0x89b3('0x2e')]=_['keys'](_0x1abb2e[_0x89b3('0x2e')]);_0x598e70[_0x89b3('0x2f')]=_['intersection'](_0x598e70[_0x89b3('0x2d')],_0x598e70[_0x89b3('0x2e')]);_0x31fdf8[_0x89b3('0x30')]=_['intersection'](_0x598e70[_0x89b3('0x2d')],qs[_0x89b3('0x31')](_0x1abb2e[_0x89b3('0x2e')]['fields']));_0x31fdf8[_0x89b3('0x30')]=_0x31fdf8[_0x89b3('0x30')][_0x89b3('0x32')]?_0x31fdf8[_0x89b3('0x30')]:_0x598e70[_0x89b3('0x2d')];if(!_0x1abb2e[_0x89b3('0x2e')]['hasOwnProperty'](_0x89b3('0x33'))){_0x31fdf8['limit']=qs['limit'](_0x1abb2e['query'][_0x89b3('0x1d')]);_0x31fdf8[_0x89b3('0x1f')]=qs[_0x89b3('0x1f')](_0x1abb2e[_0x89b3('0x2e')][_0x89b3('0x1f')]);}_0x31fdf8['order']=qs[_0x89b3('0x34')](_0x1abb2e['query']['sort']);_0x31fdf8[_0x89b3('0x35')]=qs[_0x89b3('0x2f')](_[_0x89b3('0x36')](_0x1abb2e['query'],_0x598e70[_0x89b3('0x2f')]),_0x4504d0);if(_0x1abb2e[_0x89b3('0x2e')]['filter']){_0x31fdf8[_0x89b3('0x35')]=_[_0x89b3('0x37')](_0x31fdf8[_0x89b3('0x35')],{'$or':_[_0x89b3('0x2b')](_0x4504d0,function(_0x47c881){if(_0x47c881[_0x89b3('0x38')]!==_0x89b3('0x39')){var _0x3a6807={};_0x3a6807[_0x47c881['name']]={'$like':'%'+_0x1abb2e[_0x89b3('0x2e')][_0x89b3('0x3a')]+'%'};return _0x3a6807;}})});}_0x31fdf8=_['merge']({},_0x31fdf8,_0x1abb2e['options']);var _0x502f42={'where':_0x31fdf8[_0x89b3('0x35')]};return db['SugarcrmConfiguration'][_0x89b3('0x1e')](_0x502f42)[_0x89b3('0x25')](function(_0x1a4796){_0x53c1e0[_0x89b3('0x1e')]=_0x1a4796;if(_0x1abb2e['query'][_0x89b3('0x3b')]){_0x31fdf8[_0x89b3('0x3c')]=[{'all':!![]}];}return db[_0x89b3('0x2c')][_0x89b3('0x3d')](_0x31fdf8);})[_0x89b3('0x25')](function(_0x30dc67){_0x53c1e0[_0x89b3('0x3e')]=_0x30dc67;return _0x53c1e0;})[_0x89b3('0x25')](respondWithFilteredResult(_0x4128f3,_0x31fdf8))[_0x89b3('0x3f')](handleError(_0x4128f3,null));};exports[_0x89b3('0x40')]=function(_0x243a6d,_0x332a3a){var _0x2a11f2={'raw':![],'where':{'id':_0x243a6d[_0x89b3('0x41')]['id']}},_0x10f80c={};_0x10f80c[_0x89b3('0x2d')]=_[_0x89b3('0x42')](db[_0x89b3('0x2c')]['rawAttributes']);_0x10f80c[_0x89b3('0x2e')]=_['keys'](_0x243a6d[_0x89b3('0x2e')]);_0x10f80c[_0x89b3('0x2f')]=_[_0x89b3('0x43')](_0x10f80c[_0x89b3('0x2d')],_0x10f80c['query']);_0x2a11f2[_0x89b3('0x30')]=_['intersection'](_0x10f80c[_0x89b3('0x2d')],qs[_0x89b3('0x31')](_0x243a6d[_0x89b3('0x2e')][_0x89b3('0x31')]));_0x2a11f2['attributes']=_0x2a11f2[_0x89b3('0x30')][_0x89b3('0x32')]?_0x2a11f2['attributes']:_0x10f80c[_0x89b3('0x2d')];if(_0x243a6d[_0x89b3('0x2e')]['includeAll']){_0x2a11f2[_0x89b3('0x3c')]=[{'all':!![]}];}_0x2a11f2=_['merge']({},_0x2a11f2,_0x243a6d[_0x89b3('0x44')]);return db['SugarcrmConfiguration']['find'](_0x2a11f2)[_0x89b3('0x25')](handleEntityNotFound(_0x332a3a,null))['then'](respondWithResult(_0x332a3a,null))[_0x89b3('0x3f')](handleError(_0x332a3a,null));};exports[_0x89b3('0x45')]=function(_0x4d58da,_0x36ec15){return db[_0x89b3('0x2c')]['create'](_0x4d58da[_0x89b3('0x46')],{})[_0x89b3('0x25')](respondWithResult(_0x36ec15,0xc9))[_0x89b3('0x3f')](handleError(_0x36ec15,null));};exports[_0x89b3('0x24')]=function(_0x5e79b4,_0x1bf3e2){if(_0x5e79b4[_0x89b3('0x46')]['id']){delete _0x5e79b4[_0x89b3('0x46')]['id'];}return db[_0x89b3('0x2c')][_0x89b3('0x47')]({'where':{'id':_0x5e79b4[_0x89b3('0x41')]['id']}})[_0x89b3('0x25')](handleEntityNotFound(_0x1bf3e2,null))[_0x89b3('0x25')](saveUpdates(_0x5e79b4[_0x89b3('0x46')],null))[_0x89b3('0x25')](respondWithResult(_0x1bf3e2,null))[_0x89b3('0x3f')](handleError(_0x1bf3e2,null));};exports[_0x89b3('0x26')]=function(_0x3dff68,_0x5a5d50){return db['SugarcrmConfiguration'][_0x89b3('0x47')]({'where':{'id':_0x3dff68[_0x89b3('0x41')]['id']}})[_0x89b3('0x25')](handleEntityNotFound(_0x5a5d50,null))[_0x89b3('0x25')](removeEntity(_0x5a5d50,null))[_0x89b3('0x3f')](handleError(_0x5a5d50,null));};exports[_0x89b3('0x48')]=function(_0x1edcd5,_0x599e9f,_0x3a07d0){var _0x351bc2={};var _0x4a49c8={};var _0x548af;var _0xace6d8;return db[_0x89b3('0x2c')][_0x89b3('0x49')]({'where':{'id':_0x1edcd5['params']['id']}})['then'](handleEntityNotFound(_0x599e9f,null))[_0x89b3('0x25')](function(_0x6830de){if(_0x6830de){_0x548af=_0x6830de;_0x4a49c8['model']=_[_0x89b3('0x42')](db[_0x89b3('0x4a')][_0x89b3('0x4b')]);_0x4a49c8[_0x89b3('0x2e')]=_[_0x89b3('0x42')](_0x1edcd5[_0x89b3('0x2e')]);_0x4a49c8[_0x89b3('0x2f')]=_[_0x89b3('0x43')](_0x4a49c8['model'],_0x4a49c8[_0x89b3('0x2e')]);_0x351bc2['attributes']=_[_0x89b3('0x43')](_0x4a49c8[_0x89b3('0x2d')],qs['fields'](_0x1edcd5[_0x89b3('0x2e')][_0x89b3('0x31')]));_0x351bc2[_0x89b3('0x30')]=_0x351bc2['attributes']['length']?_0x351bc2['attributes']:_0x4a49c8[_0x89b3('0x2d')];_0x351bc2['order']=qs[_0x89b3('0x34')](_0x1edcd5['query'][_0x89b3('0x34')]);_0x351bc2[_0x89b3('0x35')]=qs[_0x89b3('0x2f')](_[_0x89b3('0x36')](_0x1edcd5[_0x89b3('0x2e')],_0x4a49c8[_0x89b3('0x2f')]));if(_0x1edcd5['query'][_0x89b3('0x3a')]){_0x351bc2[_0x89b3('0x35')]=_[_0x89b3('0x37')](_0x351bc2[_0x89b3('0x35')],{'$or':_[_0x89b3('0x2b')](_0x351bc2['attributes'],function(_0x2f08d1){var _0x1ee204={};_0x1ee204[_0x2f08d1]={'$like':'%'+_0x1edcd5[_0x89b3('0x2e')]['filter']+'%'};return _0x1ee204;})});}_0x351bc2=_[_0x89b3('0x37')]({},_0x351bc2,_0x1edcd5[_0x89b3('0x44')]);return _0x548af[_0x89b3('0x48')](_0x351bc2);}})[_0x89b3('0x25')](function(_0x5dbee5){if(_0x5dbee5){_0xace6d8=_0x5dbee5['length'];if(!_0x1edcd5[_0x89b3('0x2e')][_0x89b3('0x4c')](_0x89b3('0x33'))){_0x351bc2[_0x89b3('0x1d')]=qs[_0x89b3('0x1d')](_0x1edcd5[_0x89b3('0x2e')]['limit']);_0x351bc2['offset']=qs[_0x89b3('0x1f')](_0x1edcd5[_0x89b3('0x2e')]['offset']);}return _0x548af[_0x89b3('0x48')](_0x351bc2);}})[_0x89b3('0x25')](function(_0x1e8d40){if(_0x1e8d40){return _0x1e8d40?{'count':_0xace6d8,'rows':_0x1e8d40}:null;}})['then'](respondWithResult(_0x599e9f,null))[_0x89b3('0x3f')](handleError(_0x599e9f,null));};exports['getSubjects']=function(_0x484ae8,_0x545fe5,_0x5387fb){var _0x20bac2={};var _0x46315c={};var _0x49578c;var _0x371493;return db[_0x89b3('0x2c')]['findOne']({'where':{'id':_0x484ae8['params']['id']}})[_0x89b3('0x25')](handleEntityNotFound(_0x545fe5,null))['then'](function(_0x44617c){if(_0x44617c){_0x49578c=_0x44617c;_0x46315c[_0x89b3('0x2d')]=_[_0x89b3('0x42')](db[_0x89b3('0x4a')]['rawAttributes']);_0x46315c[_0x89b3('0x2e')]=_['keys'](_0x484ae8[_0x89b3('0x2e')]);_0x46315c[_0x89b3('0x2f')]=_['intersection'](_0x46315c[_0x89b3('0x2d')],_0x46315c[_0x89b3('0x2e')]);_0x20bac2[_0x89b3('0x30')]=_[_0x89b3('0x43')](_0x46315c['model'],qs['fields'](_0x484ae8[_0x89b3('0x2e')]['fields']));_0x20bac2[_0x89b3('0x30')]=_0x20bac2['attributes']['length']?_0x20bac2[_0x89b3('0x30')]:_0x46315c['model'];_0x20bac2[_0x89b3('0x4d')]=qs[_0x89b3('0x34')](_0x484ae8[_0x89b3('0x2e')][_0x89b3('0x34')]);_0x20bac2[_0x89b3('0x35')]=qs[_0x89b3('0x2f')](_[_0x89b3('0x36')](_0x484ae8[_0x89b3('0x2e')],_0x46315c['filters']));if(_0x484ae8[_0x89b3('0x2e')][_0x89b3('0x3a')]){_0x20bac2[_0x89b3('0x35')]=_['merge'](_0x20bac2['where'],{'$or':_['map'](_0x20bac2[_0x89b3('0x30')],function(_0x7dd24f){var _0x2b2763={};_0x2b2763[_0x7dd24f]={'$like':'%'+_0x484ae8[_0x89b3('0x2e')][_0x89b3('0x3a')]+'%'};return _0x2b2763;})});}_0x20bac2=_[_0x89b3('0x37')]({},_0x20bac2,_0x484ae8['options']);return _0x49578c['getSubjects'](_0x20bac2);}})['then'](function(_0x367fe8){if(_0x367fe8){_0x371493=_0x367fe8[_0x89b3('0x32')];if(!_0x484ae8[_0x89b3('0x2e')][_0x89b3('0x4c')]('nolimit')){_0x20bac2['limit']=qs['limit'](_0x484ae8[_0x89b3('0x2e')][_0x89b3('0x1d')]);_0x20bac2[_0x89b3('0x1f')]=qs['offset'](_0x484ae8[_0x89b3('0x2e')]['offset']);}return _0x49578c[_0x89b3('0x4e')](_0x20bac2);}})[_0x89b3('0x25')](function(_0x84c8de){if(_0x84c8de){return _0x84c8de?{'count':_0x371493,'rows':_0x84c8de}:null;}})[_0x89b3('0x25')](respondWithResult(_0x545fe5,null))[_0x89b3('0x3f')](handleError(_0x545fe5,null));};exports[_0x89b3('0x4f')]=function(_0x3c6e32,_0xc7ed03,_0xa3f0b3){var _0x30f68a={};var _0xbb7d72={};var _0x17b9de;var _0x74eaeb;return db[_0x89b3('0x2c')][_0x89b3('0x49')]({'where':{'id':_0x3c6e32[_0x89b3('0x41')]['id']}})[_0x89b3('0x25')](handleEntityNotFound(_0xc7ed03,null))[_0x89b3('0x25')](function(_0x5d4247){if(_0x5d4247){_0x17b9de=_0x5d4247;_0xbb7d72[_0x89b3('0x2d')]=_[_0x89b3('0x42')](db['SugarcrmField'][_0x89b3('0x4b')]);_0xbb7d72[_0x89b3('0x2e')]=_['keys'](_0x3c6e32[_0x89b3('0x2e')]);_0xbb7d72[_0x89b3('0x2f')]=_[_0x89b3('0x43')](_0xbb7d72[_0x89b3('0x2d')],_0xbb7d72['query']);_0x30f68a[_0x89b3('0x30')]=_[_0x89b3('0x43')](_0xbb7d72[_0x89b3('0x2d')],qs[_0x89b3('0x31')](_0x3c6e32['query'][_0x89b3('0x31')]));_0x30f68a[_0x89b3('0x30')]=_0x30f68a[_0x89b3('0x30')]['length']?_0x30f68a['attributes']:_0xbb7d72['model'];_0x30f68a[_0x89b3('0x4d')]=qs[_0x89b3('0x34')](_0x3c6e32['query'][_0x89b3('0x34')]);_0x30f68a[_0x89b3('0x35')]=qs[_0x89b3('0x2f')](_['pick'](_0x3c6e32[_0x89b3('0x2e')],_0xbb7d72[_0x89b3('0x2f')]));if(_0x3c6e32[_0x89b3('0x2e')][_0x89b3('0x3a')]){_0x30f68a['where']=_[_0x89b3('0x37')](_0x30f68a[_0x89b3('0x35')],{'$or':_['map'](_0x30f68a[_0x89b3('0x30')],function(_0x35af31){var _0x2aa12b={};_0x2aa12b[_0x35af31]={'$like':'%'+_0x3c6e32[_0x89b3('0x2e')]['filter']+'%'};return _0x2aa12b;})});}_0x30f68a=_['merge']({},_0x30f68a,_0x3c6e32[_0x89b3('0x44')]);return _0x17b9de[_0x89b3('0x4f')](_0x30f68a);}})[_0x89b3('0x25')](function(_0x557640){if(_0x557640){_0x74eaeb=_0x557640[_0x89b3('0x32')];if(!_0x3c6e32[_0x89b3('0x2e')][_0x89b3('0x4c')]('nolimit')){_0x30f68a[_0x89b3('0x1d')]=qs[_0x89b3('0x1d')](_0x3c6e32[_0x89b3('0x2e')]['limit']);_0x30f68a['offset']=qs[_0x89b3('0x1f')](_0x3c6e32[_0x89b3('0x2e')][_0x89b3('0x1f')]);}return _0x17b9de[_0x89b3('0x4f')](_0x30f68a);}})['then'](function(_0x308dd0){if(_0x308dd0){return _0x308dd0?{'count':_0x74eaeb,'rows':_0x308dd0}:null;}})[_0x89b3('0x25')](respondWithResult(_0xc7ed03,null))[_0x89b3('0x3f')](handleError(_0xc7ed03,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e0a3ddb..026d8b6 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a0a=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','util'];(function(_0xa1126d,_0x2bcf58){var _0x224cbd=function(_0x3f0a24){while(--_0x3f0a24){_0xa1126d['push'](_0xa1126d['shift']());}};_0x224cbd(++_0x2bcf58);}(_0x6a0a,0x7d));var _0xa6a0=function(_0x4bb32f,_0x2217e){_0x4bb32f=_0x4bb32f-0x0;var _0x2dd6e6=_0x6a0a[_0x4bb32f];return _0x2dd6e6;};'use strict';var _=require('lodash');var util=require(_0xa6a0('0x0'));var logger=require('../../config/logger')(_0xa6a0('0x1'));var moment=require(_0xa6a0('0x2'));var BPromise=require('bluebird');var rp=require(_0xa6a0('0x3'));var fs=require('fs');var path=require(_0xa6a0('0x4'));var rimraf=require(_0xa6a0('0x5'));var config=require(_0xa6a0('0x6'));var attributes=require(_0xa6a0('0x7'));module['exports']=function(_0x500c27,_0x2a21a4){return _0x500c27[_0xa6a0('0x8')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ab=['int_sugarcrm_configurations','../../config/logger','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xb3ab,0x17b));var _0xbb3a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb3ab[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb3a('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb3a('0x1'));var fs=require('fs');var path=require(_0xbb3a('0x2'));var rimraf=require('rimraf');var config=require(_0xbb3a('0x3'));var attributes=require(_0xbb3a('0x4'));module[_0xbb3a('0x5')]=function(_0x4dd66b,_0x4dadf1){return _0x4dd66b['define']('SugarcrmConfiguration',attributes,{'tableName':_0xbb3a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 7e6b14a..8429b27 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf158=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5a0cb1,_0x29729c){var _0x419d9c=function(_0x594f0b){while(--_0x594f0b){_0x5a0cb1['push'](_0x5a0cb1['shift']());}};_0x419d9c(++_0x29729c);}(_0xf158,0x11c));var _0x8f15=function(_0xd9ac69,_0x28c02c){_0xd9ac69=_0xd9ac69-0x0;var _0x411264=_0xf158[_0xd9ac69];return _0x411264;};'use strict';var _=require(_0x8f15('0x0'));var util=require(_0x8f15('0x1'));var moment=require('moment');var BPromise=require(_0x8f15('0x2'));var rs=require(_0x8f15('0x3'));var fs=require('fs');var Redis=require(_0x8f15('0x4'));var db=require(_0x8f15('0x5'))['db'];var utils=require(_0x8f15('0x6'));var logger=require(_0x8f15('0x7'))(_0x8f15('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f15('0x9'));var client=jayson[_0x8f15('0xa')][_0x8f15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52b45e,_0x163b08,_0x4e405c){return new BPromise(function(_0x29f8cd,_0x433e4e){return client[_0x8f15('0xc')](_0x52b45e,_0x4e405c)['then'](function(_0x45924c){logger['info'](_0x8f15('0xd'),_0x163b08,_0x8f15('0xe'));logger['debug'](_0x8f15('0xf'),_0x163b08,_0x8f15('0xe'),JSON[_0x8f15('0x10')](_0x45924c));if(_0x45924c[_0x8f15('0x11')]){if(_0x45924c[_0x8f15('0x11')][_0x8f15('0x12')]===0x1f4){logger[_0x8f15('0x11')](_0x8f15('0xd'),_0x163b08,_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);return _0x433e4e(_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);}logger[_0x8f15('0x11')](_0x8f15('0xd'),_0x163b08,_0x45924c[_0x8f15('0x11')][_0x8f15('0x13')]);return _0x29f8cd(_0x45924c[_0x8f15('0x11')]['message']);}else{logger[_0x8f15('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x163b08,'request\x20sent');_0x29f8cd(_0x45924c['result'][_0x8f15('0x13')]);}})[_0x8f15('0x15')](function(_0x14fe00){logger['error'](_0x8f15('0xd'),_0x163b08,_0x14fe00);_0x433e4e(_0x14fe00);});});} \ No newline at end of file +var _0xd45b=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x1eff7c,_0x357ad0){var _0x304854=function(_0x27f760){while(--_0x27f760){_0x1eff7c['push'](_0x1eff7c['shift']());}};_0x304854(++_0x357ad0);}(_0xd45b,0xf3));var _0xbd45=function(_0x439298,_0x179bab){_0x439298=_0x439298-0x0;var _0x291dfb=_0xd45b[_0x439298];return _0x291dfb;};'use strict';var _=require(_0xbd45('0x0'));var util=require(_0xbd45('0x1'));var moment=require(_0xbd45('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd45('0x3'));var fs=require('fs');var Redis=require(_0xbd45('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd45('0x5'));var logger=require(_0xbd45('0x6'))('rpc');var config=require(_0xbd45('0x7'));var jayson=require(_0xbd45('0x8'));var client=jayson[_0xbd45('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39758d,_0x50ac35,_0x16474d){return new BPromise(function(_0x457dd0,_0x4b1f32){return client['request'](_0x39758d,_0x16474d)[_0xbd45('0xa')](function(_0x13d5ec){logger[_0xbd45('0xb')](_0xbd45('0xc'),_0x50ac35,_0xbd45('0xd'));logger[_0xbd45('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x50ac35,_0xbd45('0xd'),JSON['stringify'](_0x13d5ec));if(_0x13d5ec[_0xbd45('0xf')]){if(_0x13d5ec[_0xbd45('0xf')][_0xbd45('0x10')]===0x1f4){logger[_0xbd45('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x50ac35,_0x13d5ec[_0xbd45('0xf')]['message']);return _0x4b1f32(_0x13d5ec[_0xbd45('0xf')][_0xbd45('0x11')]);}logger[_0xbd45('0xf')](_0xbd45('0xc'),_0x50ac35,_0x13d5ec[_0xbd45('0xf')][_0xbd45('0x11')]);return _0x457dd0(_0x13d5ec[_0xbd45('0xf')][_0xbd45('0x11')]);}else{logger[_0xbd45('0xb')](_0xbd45('0xc'),_0x50ac35,_0xbd45('0xd'));_0x457dd0(_0x13d5ec[_0xbd45('0x12')]['message']);}})[_0xbd45('0x13')](function(_0x51a0ff){logger[_0xbd45('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x50ac35,_0x51a0ff);_0x4b1f32(_0x51a0ff);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 983c3d6..3859741 100644 --- a/server/api/intSugarcrmField/index.js +++ b/server/api/intSugarcrmField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf287=['Router','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','util','path','connect-timeout','express'];(function(_0xcd9559,_0xa22f6a){var _0x35de0b=function(_0x54d465){while(--_0x54d465){_0xcd9559['push'](_0xcd9559['shift']());}};_0x35de0b(++_0xa22f6a);}(_0xf287,0x9c));var _0x7f28=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xf287[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0x7f28('0x0'));var path=require(_0x7f28('0x1'));var timeout=require(_0x7f28('0x2'));var express=require(_0x7f28('0x3'));var router=express[_0x7f28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f28('0x5'));var config=require('../../config/environment');var controller=require(_0x7f28('0x6'));router[_0x7f28('0x7')]('/',auth[_0x7f28('0x8')](),controller[_0x7f28('0x9')]);router[_0x7f28('0x7')](_0x7f28('0xa'),auth[_0x7f28('0x8')](),controller[_0x7f28('0xb')]);router['post']('/',auth[_0x7f28('0x8')](),controller[_0x7f28('0xc')]);router[_0x7f28('0xd')]('/:id',auth[_0x7f28('0x8')](),controller[_0x7f28('0xe')]);router['delete']('/:id',auth[_0x7f28('0x8')](),controller['destroy']);module[_0x7f28('0xf')]=router; \ No newline at end of file +var _0x6564=['show','post','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated'];(function(_0x1f6747,_0x1422c0){var _0xd9644a=function(_0x5f0055){while(--_0x5f0055){_0x1f6747['push'](_0x1f6747['shift']());}};_0xd9644a(++_0x1422c0);}(_0x6564,0x6c));var _0x4656=function(_0x2e496c,_0x1df1bd){_0x2e496c=_0x2e496c-0x0;var _0x3f9895=_0x6564[_0x2e496c];return _0x3f9895;};'use strict';var multer=require(_0x4656('0x0'));var util=require(_0x4656('0x1'));var path=require(_0x4656('0x2'));var timeout=require('connect-timeout');var express=require(_0x4656('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4656('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4656('0x5'));var controller=require(_0x4656('0x6'));router[_0x4656('0x7')]('/',auth['isAuthenticated'](),controller[_0x4656('0x8')]);router[_0x4656('0x7')](_0x4656('0x9'),auth[_0x4656('0xa')](),controller[_0x4656('0xb')]);router[_0x4656('0xc')]('/',auth[_0x4656('0xa')](),controller['create']);router[_0x4656('0xd')]('/:id',auth[_0x4656('0xa')](),controller[_0x4656('0xe')]);router['delete'](_0x4656('0x9'),auth[_0x4656('0xa')](),controller[_0x4656('0xf')]);module[_0x4656('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d5d1ff6..426bd6a 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.attributes.js +++ b/server/api/intSugarcrmField/intSugarcrmField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf853=['variable','BOOLEAN','sequelize','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf853,0x12b));var _0x3f85=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xf853[_0x25a42a];return _0x1129b1;};'use strict';var Sequelize=require(_0x3f85('0x0'));module['exports']={'type':{'type':Sequelize[_0x3f85('0x1')](_0x3f85('0x2'),'variable',_0x3f85('0x3'),_0x3f85('0x4'),_0x3f85('0x5')),'defaultValue':_0x3f85('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3f85('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x3f85('0x7'),_0x3f85('0x3'))},'keyContent':{'type':Sequelize[_0x3f85('0x6')]},'idField':{'type':Sequelize[_0x3f85('0x6')]},'nameField':{'type':Sequelize[_0x3f85('0x6')]},'customField':{'type':Sequelize[_0x3f85('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3f85('0x6')]}}; \ No newline at end of file +var _0xa3db=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x1e69f4,_0x2055d8){var _0x362771=function(_0x6422e7){while(--_0x6422e7){_0x1e69f4['push'](_0x1e69f4['shift']());}};_0x362771(++_0x2055d8);}(_0xa3db,0x7c));var _0xba3d=function(_0x2e57f9,_0x3ef15c){_0x2e57f9=_0x2e57f9-0x0;var _0xd23db7=_0xa3db[_0x2e57f9];return _0xd23db7;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xba3d('0x2'),_0xba3d('0x3'),'customVariable','keyValue',_0xba3d('0x4')),'defaultValue':_0xba3d('0x2')},'content':{'type':Sequelize[_0xba3d('0x5')]},'key':{'type':Sequelize[_0xba3d('0x5')]},'keyType':{'type':Sequelize[_0xba3d('0x6')](_0xba3d('0x2'),_0xba3d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xba3d('0x5')]},'idField':{'type':Sequelize[_0xba3d('0x5')]},'nameField':{'type':Sequelize[_0xba3d('0x5')]},'customField':{'type':Sequelize[_0xba3d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba3d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1f5cd40..6b13960 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.controller.js +++ b/server/api/intSugarcrmField/intSugarcrmField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b4=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','then','show','params','rawAttributes','includeAll','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','error','stack','name','send','index','SugarcrmField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3ad9ae,_0x438393){var _0x3dc8c2=function(_0x4b6186){while(--_0x4b6186){_0x3ad9ae['push'](_0x3ad9ae['shift']());}};_0x3dc8c2(++_0x438393);}(_0x60b4,0x19b));var _0x460b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60b4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x460b('0x0'));var zipdir=require(_0x460b('0x1'));var jsonpatch=require(_0x460b('0x2'));var rp=require(_0x460b('0x3'));var moment=require(_0x460b('0x4'));var BPromise=require(_0x460b('0x5'));var Mustache=require(_0x460b('0x6'));var util=require(_0x460b('0x7'));var path=require(_0x460b('0x8'));var sox=require('sox');var csv=require(_0x460b('0x9'));var ejs=require(_0x460b('0xa'));var fs=require('fs');var fs_extra=require(_0x460b('0xb'));var _=require(_0x460b('0xc'));var squel=require(_0x460b('0xd'));var crypto=require(_0x460b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x460b('0xf'));var toCsv=require(_0x460b('0x9'));var querystring=require(_0x460b('0x10'));var Papa=require('papaparse');var Redis=require(_0x460b('0x11'));var authService=require(_0x460b('0x12'));var qs=require(_0x460b('0x13'));var as=require(_0x460b('0x14'));var hardwareService=require(_0x460b('0x15'));var logger=require(_0x460b('0x16'))(_0x460b('0x17'));var utils=require('../../config/utils');var config=require(_0x460b('0x18'));var licenseUtil=require(_0x460b('0x19'));var db=require(_0x460b('0x1a'))['db'];function respondWithStatusCode(_0x3737b7,_0x49fd8f){_0x49fd8f=_0x49fd8f||0xcc;return function(_0x21f083){if(_0x21f083){return _0x3737b7[_0x460b('0x1b')](_0x49fd8f);}return _0x3737b7[_0x460b('0x1c')](_0x49fd8f)[_0x460b('0x1d')]();};}function respondWithResult(_0x412d91,_0x336824){_0x336824=_0x336824||0xc8;return function(_0x25691d){if(_0x25691d){return _0x412d91[_0x460b('0x1c')](_0x336824)[_0x460b('0x1e')](_0x25691d);}};}function respondWithFilteredResult(_0x388caf,_0x381823){return function(_0x36c46f){if(_0x36c46f){var _0x295633=typeof _0x381823[_0x460b('0x1f')]===_0x460b('0x20')&&typeof _0x381823[_0x460b('0x21')]===_0x460b('0x20');var _0x37aadc=_0x36c46f[_0x460b('0x22')];var _0x13b77a=_0x295633?0x0:_0x381823[_0x460b('0x1f')];var _0x3cf274=_0x295633?_0x36c46f[_0x460b('0x22')]:_0x381823[_0x460b('0x1f')]+_0x381823[_0x460b('0x21')];var _0x5c3574;if(_0x3cf274>=_0x37aadc){_0x3cf274=_0x37aadc;_0x5c3574=0xc8;}else{_0x5c3574=0xce;}_0x388caf[_0x460b('0x1c')](_0x5c3574);return _0x388caf['set']('Content-Range',_0x13b77a+'-'+_0x3cf274+'/'+_0x37aadc)[_0x460b('0x1e')](_0x36c46f);}return null;};}function patchUpdates(_0x419c19){return function(_0x5da555){try{jsonpatch[_0x460b('0x23')](_0x5da555,_0x419c19,!![]);}catch(_0x454272){return BPromise['reject'](_0x454272);}return _0x5da555['save']();};}function saveUpdates(_0x4ce7b4,_0x1cfb9c){return function(_0x468ce4){if(_0x468ce4){return _0x468ce4[_0x460b('0x24')](_0x4ce7b4)['then'](function(_0x357967){return _0x357967;});}return null;};}function removeEntity(_0xdf6253,_0x3a5855){return function(_0x3511de){if(_0x3511de){return _0x3511de['destroy']()['then'](function(){_0xdf6253[_0x460b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x272a56,_0x2579bd){return function(_0x4074f1){if(!_0x4074f1){_0x272a56[_0x460b('0x1b')](0x194);}return _0x4074f1;};}function handleError(_0x142bcb,_0x405af3){_0x405af3=_0x405af3||0x1f4;return function(_0x4c1101){logger[_0x460b('0x25')](_0x4c1101[_0x460b('0x26')]);if(_0x4c1101['name']){delete _0x4c1101[_0x460b('0x27')];}_0x142bcb[_0x460b('0x1c')](_0x405af3)[_0x460b('0x28')](_0x4c1101);};}exports[_0x460b('0x29')]=function(_0x2e760b,_0x34311d){var _0x14ebbd={},_0x5b6619={},_0xeacf0e={'count':0x0,'rows':[]};var _0x18abfe=_['map'](db[_0x460b('0x2a')]['rawAttributes'],function(_0x34e1ec){return{'name':_0x34e1ec[_0x460b('0x2b')],'type':_0x34e1ec[_0x460b('0x2c')][_0x460b('0x2d')]};});_0x5b6619[_0x460b('0x2e')]=_[_0x460b('0x2f')](_0x18abfe,_0x460b('0x27'));_0x5b6619[_0x460b('0x30')]=_[_0x460b('0x31')](_0x2e760b[_0x460b('0x30')]);_0x5b6619[_0x460b('0x32')]=_[_0x460b('0x33')](_0x5b6619[_0x460b('0x2e')],_0x5b6619[_0x460b('0x30')]);_0x14ebbd[_0x460b('0x34')]=_[_0x460b('0x33')](_0x5b6619[_0x460b('0x2e')],qs[_0x460b('0x35')](_0x2e760b[_0x460b('0x30')][_0x460b('0x35')]));_0x14ebbd[_0x460b('0x34')]=_0x14ebbd['attributes'][_0x460b('0x36')]?_0x14ebbd['attributes']:_0x5b6619[_0x460b('0x2e')];if(!_0x2e760b[_0x460b('0x30')][_0x460b('0x37')](_0x460b('0x38'))){_0x14ebbd[_0x460b('0x21')]=qs[_0x460b('0x21')](_0x2e760b[_0x460b('0x30')]['limit']);_0x14ebbd[_0x460b('0x1f')]=qs[_0x460b('0x1f')](_0x2e760b['query']['offset']);}_0x14ebbd[_0x460b('0x39')]=qs[_0x460b('0x3a')](_0x2e760b[_0x460b('0x30')]['sort']);_0x14ebbd[_0x460b('0x3b')]=qs[_0x460b('0x32')](_[_0x460b('0x3c')](_0x2e760b[_0x460b('0x30')],_0x5b6619[_0x460b('0x32')]),_0x18abfe);if(_0x2e760b[_0x460b('0x30')][_0x460b('0x3d')]){_0x14ebbd[_0x460b('0x3b')]=_[_0x460b('0x3e')](_0x14ebbd[_0x460b('0x3b')],{'$or':_[_0x460b('0x2f')](_0x18abfe,function(_0x49edc7){if(_0x49edc7['type']!==_0x460b('0x3f')){var _0x3af237={};_0x3af237[_0x49edc7['name']]={'$like':'%'+_0x2e760b[_0x460b('0x30')][_0x460b('0x3d')]+'%'};return _0x3af237;}})});}_0x14ebbd=_[_0x460b('0x3e')]({},_0x14ebbd,_0x2e760b[_0x460b('0x40')]);var _0x23365b={'where':_0x14ebbd[_0x460b('0x3b')]};return db[_0x460b('0x2a')][_0x460b('0x22')](_0x23365b)['then'](function(_0x3e3a41){_0xeacf0e['count']=_0x3e3a41;if(_0x2e760b[_0x460b('0x30')]['includeAll']){_0x14ebbd[_0x460b('0x41')]=[{'all':!![]}];}return db[_0x460b('0x2a')][_0x460b('0x42')](_0x14ebbd);})['then'](function(_0x2f7633){_0xeacf0e[_0x460b('0x43')]=_0x2f7633;return _0xeacf0e;})[_0x460b('0x44')](respondWithFilteredResult(_0x34311d,_0x14ebbd))['catch'](handleError(_0x34311d,null));};exports[_0x460b('0x45')]=function(_0x205f3f,_0x27dee7){var _0x3640ed={'raw':!![],'where':{'id':_0x205f3f[_0x460b('0x46')]['id']}},_0x3cde41={};_0x3cde41[_0x460b('0x2e')]=_[_0x460b('0x31')](db['SugarcrmField'][_0x460b('0x47')]);_0x3cde41[_0x460b('0x30')]=_[_0x460b('0x31')](_0x205f3f[_0x460b('0x30')]);_0x3cde41[_0x460b('0x32')]=_['intersection'](_0x3cde41[_0x460b('0x2e')],_0x3cde41[_0x460b('0x30')]);_0x3640ed[_0x460b('0x34')]=_[_0x460b('0x33')](_0x3cde41['model'],qs[_0x460b('0x35')](_0x205f3f['query'][_0x460b('0x35')]));_0x3640ed['attributes']=_0x3640ed['attributes'][_0x460b('0x36')]?_0x3640ed[_0x460b('0x34')]:_0x3cde41[_0x460b('0x2e')];if(_0x205f3f[_0x460b('0x30')][_0x460b('0x48')]){_0x3640ed[_0x460b('0x41')]=[{'all':!![]}];}_0x3640ed=_['merge']({},_0x3640ed,_0x205f3f[_0x460b('0x40')]);return db[_0x460b('0x2a')][_0x460b('0x49')](_0x3640ed)['then'](handleEntityNotFound(_0x27dee7,null))['then'](respondWithResult(_0x27dee7,null))[_0x460b('0x4a')](handleError(_0x27dee7,null));};exports[_0x460b('0x4b')]=function(_0x209f78,_0x18fd5e){return db[_0x460b('0x2a')][_0x460b('0x4b')](_0x209f78[_0x460b('0x4c')],{})[_0x460b('0x44')](respondWithResult(_0x18fd5e,0xc9))[_0x460b('0x4a')](handleError(_0x18fd5e,null));};exports[_0x460b('0x24')]=function(_0x21e055,_0x106683){if(_0x21e055[_0x460b('0x4c')]['id']){delete _0x21e055['body']['id'];}return db[_0x460b('0x2a')][_0x460b('0x49')]({'where':{'id':_0x21e055[_0x460b('0x46')]['id']}})['then'](handleEntityNotFound(_0x106683,null))[_0x460b('0x44')](saveUpdates(_0x21e055[_0x460b('0x4c')],null))['then'](respondWithResult(_0x106683,null))[_0x460b('0x4a')](handleError(_0x106683,null));};exports[_0x460b('0x4d')]=function(_0x29f440,_0xc9383e){return db[_0x460b('0x2a')][_0x460b('0x49')]({'where':{'id':_0x29f440[_0x460b('0x46')]['id']}})[_0x460b('0x44')](handleEntityNotFound(_0xc9383e,null))[_0x460b('0x44')](removeEntity(_0xc9383e,null))['catch'](handleError(_0xc9383e,null));}; \ No newline at end of file +var _0x8dfc=['nolimit','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x8dfc,0x184));var _0xc8df=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0x8dfc[_0x54b396];return _0x532e6d;};'use strict';var emlformat=require(_0xc8df('0x0'));var rimraf=require(_0xc8df('0x1'));var zipdir=require(_0xc8df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8df('0x3'));var moment=require('moment');var BPromise=require(_0xc8df('0x4'));var Mustache=require(_0xc8df('0x5'));var util=require(_0xc8df('0x6'));var path=require(_0xc8df('0x7'));var sox=require(_0xc8df('0x8'));var csv=require(_0xc8df('0x9'));var ejs=require(_0xc8df('0xa'));var fs=require('fs');var fs_extra=require(_0xc8df('0xb'));var _=require(_0xc8df('0xc'));var squel=require(_0xc8df('0xd'));var crypto=require(_0xc8df('0xe'));var jsforce=require(_0xc8df('0xf'));var deskjs=require(_0xc8df('0x10'));var toCsv=require(_0xc8df('0x9'));var querystring=require('querystring');var Papa=require(_0xc8df('0x11'));var Redis=require(_0xc8df('0x12'));var authService=require(_0xc8df('0x13'));var qs=require(_0xc8df('0x14'));var as=require(_0xc8df('0x15'));var hardwareService=require(_0xc8df('0x16'));var logger=require(_0xc8df('0x17'))('api');var utils=require(_0xc8df('0x18'));var config=require(_0xc8df('0x19'));var licenseUtil=require(_0xc8df('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117b89,_0x5ea6e5){_0x5ea6e5=_0x5ea6e5||0xcc;return function(_0x165825){if(_0x165825){return _0x117b89['sendStatus'](_0x5ea6e5);}return _0x117b89[_0xc8df('0x1b')](_0x5ea6e5)[_0xc8df('0x1c')]();};}function respondWithResult(_0x72c210,_0x4be32b){_0x4be32b=_0x4be32b||0xc8;return function(_0x430354){if(_0x430354){return _0x72c210['status'](_0x4be32b)[_0xc8df('0x1d')](_0x430354);}};}function respondWithFilteredResult(_0x383f9a,_0xc9e8de){return function(_0x3ca381){if(_0x3ca381){var _0x55bd83=typeof _0xc9e8de[_0xc8df('0x1e')]===_0xc8df('0x1f')&&typeof _0xc9e8de[_0xc8df('0x20')]===_0xc8df('0x1f');var _0x75f04e=_0x3ca381[_0xc8df('0x21')];var _0x2d11f1=_0x55bd83?0x0:_0xc9e8de[_0xc8df('0x1e')];var _0x33ac8d=_0x55bd83?_0x3ca381['count']:_0xc9e8de[_0xc8df('0x1e')]+_0xc9e8de[_0xc8df('0x20')];var _0x3b47b6;if(_0x33ac8d>=_0x75f04e){_0x33ac8d=_0x75f04e;_0x3b47b6=0xc8;}else{_0x3b47b6=0xce;}_0x383f9a[_0xc8df('0x1b')](_0x3b47b6);return _0x383f9a[_0xc8df('0x22')]('Content-Range',_0x2d11f1+'-'+_0x33ac8d+'/'+_0x75f04e)['json'](_0x3ca381);}return null;};}function patchUpdates(_0x95f9fd){return function(_0x164d36){try{jsonpatch[_0xc8df('0x23')](_0x164d36,_0x95f9fd,!![]);}catch(_0x1e50d3){return BPromise['reject'](_0x1e50d3);}return _0x164d36[_0xc8df('0x24')]();};}function saveUpdates(_0x2e240a,_0x4f0190){return function(_0x774a63){if(_0x774a63){return _0x774a63[_0xc8df('0x25')](_0x2e240a)[_0xc8df('0x26')](function(_0x122270){return _0x122270;});}return null;};}function removeEntity(_0x507d0f,_0x544465){return function(_0x20145f){if(_0x20145f){return _0x20145f[_0xc8df('0x27')]()[_0xc8df('0x26')](function(){_0x507d0f['status'](0xcc)[_0xc8df('0x1c')]();});}};}function handleEntityNotFound(_0x4eae69,_0x4bc786){return function(_0x486775){if(!_0x486775){_0x4eae69[_0xc8df('0x28')](0x194);}return _0x486775;};}function handleError(_0x30cd54,_0x361fd5){_0x361fd5=_0x361fd5||0x1f4;return function(_0x12a196){logger[_0xc8df('0x29')](_0x12a196[_0xc8df('0x2a')]);if(_0x12a196[_0xc8df('0x2b')]){delete _0x12a196['name'];}_0x30cd54[_0xc8df('0x1b')](_0x361fd5)[_0xc8df('0x2c')](_0x12a196);};}exports['index']=function(_0xab3ced,_0x5bfff9){var _0x1f5908={},_0x46c625={},_0x226deb={'count':0x0,'rows':[]};var _0xa828e4=_[_0xc8df('0x2d')](db[_0xc8df('0x2e')][_0xc8df('0x2f')],function(_0xb40a3c){return{'name':_0xb40a3c[_0xc8df('0x30')],'type':_0xb40a3c['type']['key']};});_0x46c625[_0xc8df('0x31')]=_['map'](_0xa828e4,_0xc8df('0x2b'));_0x46c625[_0xc8df('0x32')]=_['keys'](_0xab3ced[_0xc8df('0x32')]);_0x46c625[_0xc8df('0x33')]=_[_0xc8df('0x34')](_0x46c625['model'],_0x46c625[_0xc8df('0x32')]);_0x1f5908[_0xc8df('0x35')]=_[_0xc8df('0x34')](_0x46c625[_0xc8df('0x31')],qs['fields'](_0xab3ced[_0xc8df('0x32')][_0xc8df('0x36')]));_0x1f5908[_0xc8df('0x35')]=_0x1f5908[_0xc8df('0x35')][_0xc8df('0x37')]?_0x1f5908[_0xc8df('0x35')]:_0x46c625[_0xc8df('0x31')];if(!_0xab3ced[_0xc8df('0x32')]['hasOwnProperty'](_0xc8df('0x38'))){_0x1f5908[_0xc8df('0x20')]=qs[_0xc8df('0x20')](_0xab3ced[_0xc8df('0x32')][_0xc8df('0x20')]);_0x1f5908[_0xc8df('0x1e')]=qs[_0xc8df('0x1e')](_0xab3ced[_0xc8df('0x32')]['offset']);}_0x1f5908['order']=qs[_0xc8df('0x39')](_0xab3ced[_0xc8df('0x32')][_0xc8df('0x39')]);_0x1f5908[_0xc8df('0x3a')]=qs[_0xc8df('0x33')](_['pick'](_0xab3ced[_0xc8df('0x32')],_0x46c625['filters']),_0xa828e4);if(_0xab3ced[_0xc8df('0x32')][_0xc8df('0x3b')]){_0x1f5908[_0xc8df('0x3a')]=_['merge'](_0x1f5908[_0xc8df('0x3a')],{'$or':_[_0xc8df('0x2d')](_0xa828e4,function(_0x52ac34){if(_0x52ac34[_0xc8df('0x3c')]!==_0xc8df('0x3d')){var _0x7d2cf8={};_0x7d2cf8[_0x52ac34[_0xc8df('0x2b')]]={'$like':'%'+_0xab3ced[_0xc8df('0x32')][_0xc8df('0x3b')]+'%'};return _0x7d2cf8;}})});}_0x1f5908=_[_0xc8df('0x3e')]({},_0x1f5908,_0xab3ced[_0xc8df('0x3f')]);var _0x253906={'where':_0x1f5908[_0xc8df('0x3a')]};return db['SugarcrmField']['count'](_0x253906)[_0xc8df('0x26')](function(_0x2c8f42){_0x226deb[_0xc8df('0x21')]=_0x2c8f42;if(_0xab3ced['query']['includeAll']){_0x1f5908[_0xc8df('0x40')]=[{'all':!![]}];}return db[_0xc8df('0x2e')][_0xc8df('0x41')](_0x1f5908);})[_0xc8df('0x26')](function(_0x33fd4f){_0x226deb[_0xc8df('0x42')]=_0x33fd4f;return _0x226deb;})[_0xc8df('0x26')](respondWithFilteredResult(_0x5bfff9,_0x1f5908))['catch'](handleError(_0x5bfff9,null));};exports[_0xc8df('0x43')]=function(_0xace3a7,_0xc0236a){var _0x28a999={'raw':!![],'where':{'id':_0xace3a7[_0xc8df('0x44')]['id']}},_0x304e27={};_0x304e27[_0xc8df('0x31')]=_['keys'](db[_0xc8df('0x2e')][_0xc8df('0x2f')]);_0x304e27['query']=_[_0xc8df('0x45')](_0xace3a7[_0xc8df('0x32')]);_0x304e27[_0xc8df('0x33')]=_['intersection'](_0x304e27['model'],_0x304e27[_0xc8df('0x32')]);_0x28a999['attributes']=_[_0xc8df('0x34')](_0x304e27[_0xc8df('0x31')],qs[_0xc8df('0x36')](_0xace3a7[_0xc8df('0x32')][_0xc8df('0x36')]));_0x28a999[_0xc8df('0x35')]=_0x28a999[_0xc8df('0x35')][_0xc8df('0x37')]?_0x28a999['attributes']:_0x304e27[_0xc8df('0x31')];if(_0xace3a7[_0xc8df('0x32')]['includeAll']){_0x28a999['include']=[{'all':!![]}];}_0x28a999=_[_0xc8df('0x3e')]({},_0x28a999,_0xace3a7[_0xc8df('0x3f')]);return db[_0xc8df('0x2e')][_0xc8df('0x46')](_0x28a999)[_0xc8df('0x26')](handleEntityNotFound(_0xc0236a,null))[_0xc8df('0x26')](respondWithResult(_0xc0236a,null))[_0xc8df('0x47')](handleError(_0xc0236a,null));};exports[_0xc8df('0x48')]=function(_0x228c7a,_0x214947){return db[_0xc8df('0x2e')][_0xc8df('0x48')](_0x228c7a[_0xc8df('0x49')],{})[_0xc8df('0x26')](respondWithResult(_0x214947,0xc9))[_0xc8df('0x47')](handleError(_0x214947,null));};exports[_0xc8df('0x25')]=function(_0x465ec8,_0x3a1238){if(_0x465ec8[_0xc8df('0x49')]['id']){delete _0x465ec8[_0xc8df('0x49')]['id'];}return db[_0xc8df('0x2e')]['find']({'where':{'id':_0x465ec8[_0xc8df('0x44')]['id']}})[_0xc8df('0x26')](handleEntityNotFound(_0x3a1238,null))['then'](saveUpdates(_0x465ec8[_0xc8df('0x49')],null))[_0xc8df('0x26')](respondWithResult(_0x3a1238,null))[_0xc8df('0x47')](handleError(_0x3a1238,null));};exports[_0xc8df('0x27')]=function(_0x1ba3ea,_0x111b50){return db['SugarcrmField'][_0xc8df('0x46')]({'where':{'id':_0x1ba3ea[_0xc8df('0x44')]['id']}})['then'](handleEntityNotFound(_0x111b50,null))[_0xc8df('0x26')](removeEntity(_0x111b50,null))[_0xc8df('0x47')](handleError(_0x111b50,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8b32a4b..3423b33 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.model.js +++ b/server/api/intSugarcrmField/intSugarcrmField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6173=['../../config/logger','api','moment','bluebird','request-promise','rimraf','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x3ed98f,_0x56e4){var _0x420125=function(_0x1bd919){while(--_0x1bd919){_0x3ed98f['push'](_0x3ed98f['shift']());}};_0x420125(++_0x56e4);}(_0x6173,0x81));var _0x3617=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6173[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x3617('0x0'));var util=require('util');var logger=require(_0x3617('0x1'))(_0x3617('0x2'));var moment=require(_0x3617('0x3'));var BPromise=require(_0x3617('0x4'));var rp=require(_0x3617('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3617('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x2e2607,_0x7846c0){return _0x2e2607[_0x3617('0x7')](_0x3617('0x8'),attributes,{'tableName':_0x3617('0x9'),'paranoid':![],'indexes':[{'name':_0x3617('0xa'),'fields':[_0x3617('0xb'),_0x3617('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x39c2=['api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0xb871de,_0x26d0ef){var _0x1d6b88=function(_0x45b457){while(--_0x45b457){_0xb871de['push'](_0xb871de['shift']());}};_0x1d6b88(++_0x26d0ef);}(_0x39c2,0x187));var _0x239c=function(_0x581e85,_0x5327ea){_0x581e85=_0x581e85-0x0;var _0x23817b=_0x39c2[_0x581e85];return _0x23817b;};'use strict';var _=require(_0x239c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x239c('0x1'));var moment=require(_0x239c('0x2'));var BPromise=require('bluebird');var rp=require(_0x239c('0x3'));var fs=require('fs');var path=require(_0x239c('0x4'));var rimraf=require(_0x239c('0x5'));var config=require(_0x239c('0x6'));var attributes=require(_0x239c('0x7'));module[_0x239c('0x8')]=function(_0x3f9ca8,_0x2a670e){return _0x3f9ca8[_0x239c('0x9')]('SugarcrmField',attributes,{'tableName':_0x239c('0xa'),'paranoid':![],'indexes':[{'name':_0x239c('0xb'),'fields':[_0x239c('0xc'),_0x239c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ea38d9b..7e88f6c 100644 --- a/server/api/intSugarcrmField/intSugarcrmField.rpc.js +++ b/server/api/intSugarcrmField/intSugarcrmField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfde=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x4d6bb9,_0x5b2248){var _0x3d4596=function(_0x230f0f){while(--_0x230f0f){_0x4d6bb9['push'](_0x4d6bb9['shift']());}};_0x3d4596(++_0x5b2248);}(_0xbfde,0xd4));var _0xebfd=function(_0x45bd5d,_0x22d27c){_0x45bd5d=_0x45bd5d-0x0;var _0x5c7636=_0xbfde[_0x45bd5d];return _0x5c7636;};'use strict';var _=require(_0xebfd('0x0'));var util=require(_0xebfd('0x1'));var moment=require(_0xebfd('0x2'));var BPromise=require(_0xebfd('0x3'));var rs=require(_0xebfd('0x4'));var fs=require('fs');var Redis=require(_0xebfd('0x5'));var db=require(_0xebfd('0x6'))['db'];var utils=require(_0xebfd('0x7'));var logger=require(_0xebfd('0x8'))(_0xebfd('0x9'));var config=require(_0xebfd('0xa'));var jayson=require(_0xebfd('0xb'));var client=jayson['client'][_0xebfd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549dd2,_0x26733e,_0x194cb1){return new BPromise(function(_0x22b187,_0x2aaf8e){return client[_0xebfd('0xd')](_0x549dd2,_0x194cb1)[_0xebfd('0xe')](function(_0x3583ca){logger[_0xebfd('0xf')](_0xebfd('0x10'),_0x26733e,_0xebfd('0x11'));logger[_0xebfd('0x12')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x26733e,'request\x20sent',JSON[_0xebfd('0x13')](_0x3583ca));if(_0x3583ca[_0xebfd('0x14')]){if(_0x3583ca[_0xebfd('0x14')][_0xebfd('0x15')]===0x1f4){logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x3583ca[_0xebfd('0x14')][_0xebfd('0x16')]);return _0x2aaf8e(_0x3583ca[_0xebfd('0x14')]['message']);}logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x3583ca[_0xebfd('0x14')][_0xebfd('0x16')]);return _0x22b187(_0x3583ca['error'][_0xebfd('0x16')]);}else{logger[_0xebfd('0xf')](_0xebfd('0x10'),_0x26733e,_0xebfd('0x11'));_0x22b187(_0x3583ca[_0xebfd('0x17')][_0xebfd('0x16')]);}})['catch'](function(_0x10a0f6){logger[_0xebfd('0x14')](_0xebfd('0x10'),_0x26733e,_0x10a0f6);_0x2aaf8e(_0x10a0f6);});});} \ No newline at end of file +var _0x75b0=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x302b5e,_0x564a8e){var _0x523ab7=function(_0x6aec8f){while(--_0x6aec8f){_0x302b5e['push'](_0x302b5e['shift']());}};_0x523ab7(++_0x564a8e);}(_0x75b0,0x180));var _0x075b=function(_0x500b1f,_0x4e49b9){_0x500b1f=_0x500b1f-0x0;var _0x49f3e1=_0x75b0[_0x500b1f];return _0x49f3e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x075b('0x0'));var BPromise=require(_0x075b('0x1'));var rs=require(_0x075b('0x2'));var fs=require('fs');var Redis=require(_0x075b('0x3'));var db=require(_0x075b('0x4'))['db'];var utils=require(_0x075b('0x5'));var logger=require(_0x075b('0x6'))('rpc');var config=require(_0x075b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x075b('0x8')][_0x075b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dd3a4,_0x4e8993,_0x46a63c){return new BPromise(function(_0xc4f391,_0x5ed92c){return client[_0x075b('0xa')](_0x3dd3a4,_0x46a63c)[_0x075b('0xb')](function(_0x5315ec){logger[_0x075b('0xc')](_0x075b('0xd'),_0x4e8993,'request\x20sent');logger[_0x075b('0xe')](_0x075b('0xf'),_0x4e8993,'request\x20sent',JSON[_0x075b('0x10')](_0x5315ec));if(_0x5315ec[_0x075b('0x11')]){if(_0x5315ec['error'][_0x075b('0x12')]===0x1f4){logger['error'](_0x075b('0xd'),_0x4e8993,_0x5315ec[_0x075b('0x11')][_0x075b('0x13')]);return _0x5ed92c(_0x5315ec['error'][_0x075b('0x13')]);}logger[_0x075b('0x11')](_0x075b('0xd'),_0x4e8993,_0x5315ec[_0x075b('0x11')][_0x075b('0x13')]);return _0xc4f391(_0x5315ec[_0x075b('0x11')][_0x075b('0x13')]);}else{logger[_0x075b('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x4e8993,_0x075b('0x14'));_0xc4f391(_0x5315ec['result'][_0x075b('0x13')]);}})['catch'](function(_0x58173e){logger['error'](_0x075b('0xd'),_0x4e8993,_0x58173e);_0x5ed92c(_0x58173e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 54d3464..c356aec 100644 --- a/server/api/intVtigerAccount/index.js +++ b/server/api/intVtigerAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda65=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put'];(function(_0x3fb31f,_0x465f4a){var _0x263d6e=function(_0x1a765d){while(--_0x1a765d){_0x3fb31f['push'](_0x3fb31f['shift']());}};_0x263d6e(++_0x465f4a);}(_0xda65,0x1d0));var _0x5da6=function(_0x3e2cc4,_0x2f5b0a){_0x3e2cc4=_0x3e2cc4-0x0;var _0x2ceff6=_0xda65[_0x3e2cc4];return _0x2ceff6;};'use strict';var multer=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var path=require(_0x5da6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5da6('0x3'));var router=express[_0x5da6('0x4')]();var fs_extra=require(_0x5da6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5da6('0x6'));var controller=require(_0x5da6('0x7'));router[_0x5da6('0x8')]('/',auth[_0x5da6('0x9')](),controller[_0x5da6('0xa')]);router['get'](_0x5da6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5da6('0x8')]('/:id/configurations',auth[_0x5da6('0x9')](),controller[_0x5da6('0xc')]);router[_0x5da6('0x8')](_0x5da6('0xd'),auth[_0x5da6('0x9')](),controller[_0x5da6('0xe')]);router[_0x5da6('0xf')]('/',auth[_0x5da6('0x9')](),controller['create']);router[_0x5da6('0xf')](_0x5da6('0x10'),auth[_0x5da6('0x9')](),controller[_0x5da6('0x11')]);router[_0x5da6('0x12')](_0x5da6('0xb'),auth[_0x5da6('0x9')](),controller[_0x5da6('0x13')]);router[_0x5da6('0x14')]('/:id',auth[_0x5da6('0x9')](),controller[_0x5da6('0x15')]);module[_0x5da6('0x16')]=router; \ No newline at end of file +var _0x355e=['isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerAccount.controller','get'];(function(_0x16467a,_0x154462){var _0x35dae3=function(_0xb0c4ab){while(--_0xb0c4ab){_0x16467a['push'](_0x16467a['shift']());}};_0x35dae3(++_0x154462);}(_0x355e,0xa7));var _0xe355=function(_0x3c4595,_0x2c56da){_0x3c4595=_0x3c4595-0x0;var _0x48ce63=_0x355e[_0x3c4595];return _0x48ce63;};'use strict';var multer=require(_0xe355('0x0'));var util=require(_0xe355('0x1'));var path=require('path');var timeout=require(_0xe355('0x2'));var express=require(_0xe355('0x3'));var router=express[_0xe355('0x4')]();var fs_extra=require(_0xe355('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe355('0x6'));var controller=require(_0xe355('0x7'));router[_0xe355('0x8')]('/',auth[_0xe355('0x9')](),controller[_0xe355('0xa')]);router[_0xe355('0x8')](_0xe355('0xb'),auth[_0xe355('0x9')](),controller['show']);router[_0xe355('0x8')](_0xe355('0xc'),auth[_0xe355('0x9')](),controller['getConfigurations']);router['get'](_0xe355('0xd'),auth[_0xe355('0x9')](),controller['getFields']);router[_0xe355('0xe')]('/',auth[_0xe355('0x9')](),controller[_0xe355('0xf')]);router['post'](_0xe355('0xc'),auth[_0xe355('0x9')](),controller[_0xe355('0x10')]);router[_0xe355('0x11')](_0xe355('0xb'),auth[_0xe355('0x9')](),controller[_0xe355('0x12')]);router[_0xe355('0x13')](_0xe355('0xb'),auth['isAuthenticated'](),controller[_0xe355('0x14')]);module[_0xe355('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 7867338..92b747f 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.attributes.js +++ b/server/api/intVtigerAccount/intVtigerAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e46=['STRING','HelpDesk','sequelize','exports'];(function(_0xa72cf,_0x24a05c){var _0x263735=function(_0x21b2ae){while(--_0x21b2ae){_0xa72cf['push'](_0xa72cf['shift']());}};_0x263735(++_0x24a05c);}(_0x3e46,0x10e));var _0x63e4=function(_0x10a27f,_0x5885c2){_0x10a27f=_0x10a27f-0x0;var _0x228a1a=_0x3e46[_0x10a27f];return _0x228a1a;};'use strict';var Sequelize=require(_0x63e4('0x0'));module[_0x63e4('0x1')]={'name':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![],'defaultValue':_0x63e4('0x3')},'remoteUri':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x63e4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb571=['sequelize','exports','STRING','HelpDesk'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0xb571,0x168));var _0x1b57=function(_0x1b1e4f,_0xbf3bea){_0x1b1e4f=_0x1b1e4f-0x0;var _0x26f535=_0xb571[_0x1b1e4f];return _0x26f535;};'use strict';var Sequelize=require(_0x1b57('0x0'));module[_0x1b57('0x1')]={'name':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![],'defaultValue':_0x1b57('0x3')},'remoteUri':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1b57('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 9eb9399..a95e2f2 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.controller.js +++ b/server/api/intVtigerAccount/intVtigerAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea77=['getDescriptions','channel','md5','getFields','username','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','reference','owner','remove','includes','editable','label','startsWith','picklist','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','end','name','send','index','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','catch','show','params','rawAttributes','length','includeAll','find','create','body','destroy','getConfigurations','VtigerConfiguration','map','addConfiguration','findOne','AccountId','Subjects','Descriptions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xea77,0x120));var _0x7ea7=function(_0x11b812,_0x5d1820){_0x11b812=_0x11b812-0x0;var _0x430554=_0xea77[_0x11b812];return _0x430554;};'use strict';var emlformat=require(_0x7ea7('0x0'));var rimraf=require(_0x7ea7('0x1'));var zipdir=require(_0x7ea7('0x2'));var jsonpatch=require(_0x7ea7('0x3'));var rp=require(_0x7ea7('0x4'));var moment=require(_0x7ea7('0x5'));var BPromise=require(_0x7ea7('0x6'));var Mustache=require(_0x7ea7('0x7'));var util=require(_0x7ea7('0x8'));var path=require(_0x7ea7('0x9'));var sox=require(_0x7ea7('0xa'));var csv=require(_0x7ea7('0xb'));var ejs=require(_0x7ea7('0xc'));var fs=require('fs');var fs_extra=require(_0x7ea7('0xd'));var _=require(_0x7ea7('0xe'));var squel=require(_0x7ea7('0xf'));var crypto=require(_0x7ea7('0x10'));var jsforce=require(_0x7ea7('0x11'));var deskjs=require(_0x7ea7('0x12'));var toCsv=require('to-csv');var querystring=require(_0x7ea7('0x13'));var Papa=require(_0x7ea7('0x14'));var Redis=require(_0x7ea7('0x15'));var authService=require(_0x7ea7('0x16'));var qs=require(_0x7ea7('0x17'));var as=require(_0x7ea7('0x18'));var hardwareService=require(_0x7ea7('0x19'));var logger=require(_0x7ea7('0x1a'))(_0x7ea7('0x1b'));var utils=require('../../config/utils');var config=require(_0x7ea7('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ea7('0x1d'))['db'];var integrations=require(_0x7ea7('0x1e'));function respondWithStatusCode(_0xf9fb31,_0x5b7837){_0x5b7837=_0x5b7837||0xcc;return function(_0x2eceae){if(_0x2eceae){return _0xf9fb31[_0x7ea7('0x1f')](_0x5b7837);}return _0xf9fb31[_0x7ea7('0x20')](_0x5b7837)['end']();};}function respondWithResult(_0x23f020,_0x55f90d){_0x55f90d=_0x55f90d||0xc8;return function(_0xa78ccd){if(_0xa78ccd){return _0x23f020[_0x7ea7('0x20')](_0x55f90d)['json'](_0xa78ccd);}};}function respondWithFilteredResult(_0x24c23d,_0x4b01b9){return function(_0x31336c){if(_0x31336c){var _0x5cc7d5=typeof _0x4b01b9[_0x7ea7('0x21')]===_0x7ea7('0x22')&&typeof _0x4b01b9['limit']===_0x7ea7('0x22');var _0x29f9c3=_0x31336c['count'];var _0x22c9c9=_0x5cc7d5?0x0:_0x4b01b9[_0x7ea7('0x21')];var _0x1b99a9=_0x5cc7d5?_0x31336c['count']:_0x4b01b9[_0x7ea7('0x21')]+_0x4b01b9[_0x7ea7('0x23')];var _0xfe13eb;if(_0x1b99a9>=_0x29f9c3){_0x1b99a9=_0x29f9c3;_0xfe13eb=0xc8;}else{_0xfe13eb=0xce;}_0x24c23d['status'](_0xfe13eb);return _0x24c23d[_0x7ea7('0x24')](_0x7ea7('0x25'),_0x22c9c9+'-'+_0x1b99a9+'/'+_0x29f9c3)[_0x7ea7('0x26')](_0x31336c);}return null;};}function patchUpdates(_0xcea3ce){return function(_0x4885c5){try{jsonpatch[_0x7ea7('0x27')](_0x4885c5,_0xcea3ce,!![]);}catch(_0x5f30ee){return BPromise[_0x7ea7('0x28')](_0x5f30ee);}return _0x4885c5[_0x7ea7('0x29')]();};}function saveUpdates(_0x1d8fb9,_0x3b61bf){return function(_0x2515f7){if(_0x2515f7){return _0x2515f7[_0x7ea7('0x2a')](_0x1d8fb9)[_0x7ea7('0x2b')](function(_0x460f12){return _0x460f12;});}return null;};}function removeEntity(_0x50a225,_0xa73f06){return function(_0x35d776){if(_0x35d776){return _0x35d776['destroy']()[_0x7ea7('0x2b')](function(){_0x50a225[_0x7ea7('0x20')](0xcc)[_0x7ea7('0x2c')]();});}};}function handleEntityNotFound(_0x3c020a,_0x3c074c){return function(_0x11297f){if(!_0x11297f){_0x3c020a[_0x7ea7('0x1f')](0x194);}return _0x11297f;};}function handleError(_0x4819cc,_0x1b43c3){_0x1b43c3=_0x1b43c3||0x1f4;return function(_0x18a911){logger['error'](_0x18a911['stack']);if(_0x18a911[_0x7ea7('0x2d')]){delete _0x18a911['name'];}_0x4819cc[_0x7ea7('0x20')](_0x1b43c3)[_0x7ea7('0x2e')](_0x18a911);};}exports[_0x7ea7('0x2f')]=function(_0x15d932,_0x26e816){var _0xcb0c4b={},_0x12176c={},_0x5d9fa0={'count':0x0,'rows':[]};var _0x2c7584=_['map'](db[_0x7ea7('0x30')]['rawAttributes'],function(_0x39bf00){return{'name':_0x39bf00[_0x7ea7('0x31')],'type':_0x39bf00[_0x7ea7('0x32')][_0x7ea7('0x33')]};});_0x12176c[_0x7ea7('0x34')]=_['map'](_0x2c7584,_0x7ea7('0x2d'));_0x12176c[_0x7ea7('0x35')]=_[_0x7ea7('0x36')](_0x15d932[_0x7ea7('0x35')]);_0x12176c[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x12176c[_0x7ea7('0x34')],_0x12176c[_0x7ea7('0x35')]);_0xcb0c4b[_0x7ea7('0x39')]=_[_0x7ea7('0x38')](_0x12176c[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x15d932['query'][_0x7ea7('0x3a')]));_0xcb0c4b['attributes']=_0xcb0c4b[_0x7ea7('0x39')]['length']?_0xcb0c4b[_0x7ea7('0x39')]:_0x12176c[_0x7ea7('0x34')];if(!_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x3b')](_0x7ea7('0x3c'))){_0xcb0c4b['limit']=qs['limit'](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x23')]);_0xcb0c4b[_0x7ea7('0x21')]=qs[_0x7ea7('0x21')](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x21')]);}_0xcb0c4b[_0x7ea7('0x3d')]=qs['sort'](_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x3e')]);_0xcb0c4b[_0x7ea7('0x3f')]=qs[_0x7ea7('0x37')](_[_0x7ea7('0x40')](_0x15d932['query'],_0x12176c[_0x7ea7('0x37')]),_0x2c7584);if(_0x15d932[_0x7ea7('0x35')][_0x7ea7('0x41')]){_0xcb0c4b[_0x7ea7('0x3f')]=_['merge'](_0xcb0c4b[_0x7ea7('0x3f')],{'$or':_['map'](_0x2c7584,function(_0x306627){if(_0x306627[_0x7ea7('0x32')]!==_0x7ea7('0x42')){var _0x297a44={};_0x297a44[_0x306627[_0x7ea7('0x2d')]]={'$like':'%'+_0x15d932[_0x7ea7('0x35')]['filter']+'%'};return _0x297a44;}})});}_0xcb0c4b=_[_0x7ea7('0x43')]({},_0xcb0c4b,_0x15d932[_0x7ea7('0x44')]);var _0xeb00e4={'where':_0xcb0c4b[_0x7ea7('0x3f')]};return db[_0x7ea7('0x30')][_0x7ea7('0x45')](_0xeb00e4)['then'](function(_0xf4c0f9){_0x5d9fa0['count']=_0xf4c0f9;if(_0x15d932[_0x7ea7('0x35')]['includeAll']){_0xcb0c4b[_0x7ea7('0x46')]=[{'all':!![]}];}return db[_0x7ea7('0x30')][_0x7ea7('0x47')](_0xcb0c4b);})[_0x7ea7('0x2b')](function(_0xa67e1b){_0x5d9fa0['rows']=_0xa67e1b;return _0x5d9fa0;})['then'](respondWithFilteredResult(_0x26e816,_0xcb0c4b))[_0x7ea7('0x48')](handleError(_0x26e816,null));};exports[_0x7ea7('0x49')]=function(_0x38c973,_0x169b93){var _0x4e61df={'raw':![],'where':{'id':_0x38c973[_0x7ea7('0x4a')]['id']}},_0x1fdb48={};_0x1fdb48[_0x7ea7('0x34')]=_['keys'](db[_0x7ea7('0x30')][_0x7ea7('0x4b')]);_0x1fdb48['query']=_['keys'](_0x38c973[_0x7ea7('0x35')]);_0x1fdb48[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x1fdb48[_0x7ea7('0x34')],_0x1fdb48[_0x7ea7('0x35')]);_0x4e61df[_0x7ea7('0x39')]=_[_0x7ea7('0x38')](_0x1fdb48[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x38c973[_0x7ea7('0x35')]['fields']));_0x4e61df['attributes']=_0x4e61df[_0x7ea7('0x39')][_0x7ea7('0x4c')]?_0x4e61df[_0x7ea7('0x39')]:_0x1fdb48[_0x7ea7('0x34')];if(_0x38c973[_0x7ea7('0x35')][_0x7ea7('0x4d')]){_0x4e61df[_0x7ea7('0x46')]=[{'all':!![]}];}_0x4e61df=_[_0x7ea7('0x43')]({},_0x4e61df,_0x38c973[_0x7ea7('0x44')]);return db[_0x7ea7('0x30')][_0x7ea7('0x4e')](_0x4e61df)[_0x7ea7('0x2b')](handleEntityNotFound(_0x169b93,null))[_0x7ea7('0x2b')](respondWithResult(_0x169b93,null))['catch'](handleError(_0x169b93,null));};exports[_0x7ea7('0x4f')]=function(_0x1b47b3,_0x4b80b3){return db[_0x7ea7('0x30')][_0x7ea7('0x4f')](_0x1b47b3[_0x7ea7('0x50')],{})[_0x7ea7('0x2b')](respondWithResult(_0x4b80b3,0xc9))[_0x7ea7('0x48')](handleError(_0x4b80b3,null));};exports['update']=function(_0x2e3294,_0x511e50){if(_0x2e3294[_0x7ea7('0x50')]['id']){delete _0x2e3294[_0x7ea7('0x50')]['id'];}return db[_0x7ea7('0x30')]['find']({'where':{'id':_0x2e3294['params']['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0x511e50,null))['then'](saveUpdates(_0x2e3294[_0x7ea7('0x50')],null))[_0x7ea7('0x2b')](respondWithResult(_0x511e50,null))[_0x7ea7('0x48')](handleError(_0x511e50,null));};exports[_0x7ea7('0x51')]=function(_0x42d8de,_0xad1fda){return db[_0x7ea7('0x30')][_0x7ea7('0x4e')]({'where':{'id':_0x42d8de[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0xad1fda,null))['then'](removeEntity(_0xad1fda,null))[_0x7ea7('0x48')](handleError(_0xad1fda,null));};exports[_0x7ea7('0x52')]=function(_0x33caf1,_0x3080a2,_0x2b4ed8){var _0x4d8936={};var _0x14f2b6={};var _0x16a6be;var _0x386fa5;return db['VtigerAccount']['findOne']({'where':{'id':_0x33caf1[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0x3080a2,null))[_0x7ea7('0x2b')](function(_0x4cb276){if(_0x4cb276){_0x16a6be=_0x4cb276;_0x14f2b6[_0x7ea7('0x34')]=_[_0x7ea7('0x36')](db[_0x7ea7('0x53')]['rawAttributes']);_0x14f2b6[_0x7ea7('0x35')]=_[_0x7ea7('0x36')](_0x33caf1[_0x7ea7('0x35')]);_0x14f2b6[_0x7ea7('0x37')]=_[_0x7ea7('0x38')](_0x14f2b6[_0x7ea7('0x34')],_0x14f2b6[_0x7ea7('0x35')]);_0x4d8936['attributes']=_[_0x7ea7('0x38')](_0x14f2b6[_0x7ea7('0x34')],qs[_0x7ea7('0x3a')](_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x3a')]));_0x4d8936['attributes']=_0x4d8936[_0x7ea7('0x39')]['length']?_0x4d8936[_0x7ea7('0x39')]:_0x14f2b6[_0x7ea7('0x34')];_0x4d8936[_0x7ea7('0x3d')]=qs['sort'](_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x3e')]);_0x4d8936[_0x7ea7('0x3f')]=qs[_0x7ea7('0x37')](_[_0x7ea7('0x40')](_0x33caf1[_0x7ea7('0x35')],_0x14f2b6['filters']));if(_0x33caf1[_0x7ea7('0x35')][_0x7ea7('0x41')]){_0x4d8936['where']=_[_0x7ea7('0x43')](_0x4d8936[_0x7ea7('0x3f')],{'$or':_[_0x7ea7('0x54')](_0x4d8936['attributes'],function(_0x5f1cf2){var _0x38d467={};_0x38d467[_0x5f1cf2]={'$like':'%'+_0x33caf1['query'][_0x7ea7('0x41')]+'%'};return _0x38d467;})});}_0x4d8936=_[_0x7ea7('0x43')]({},_0x4d8936,_0x33caf1['options']);return _0x16a6be[_0x7ea7('0x52')](_0x4d8936);}})[_0x7ea7('0x2b')](function(_0x3e2a56){if(_0x3e2a56){_0x386fa5=_0x3e2a56[_0x7ea7('0x4c')];if(!_0x33caf1['query'][_0x7ea7('0x3b')]('nolimit')){_0x4d8936['limit']=qs[_0x7ea7('0x23')](_0x33caf1[_0x7ea7('0x35')]['limit']);_0x4d8936[_0x7ea7('0x21')]=qs[_0x7ea7('0x21')](_0x33caf1['query'][_0x7ea7('0x21')]);}return _0x16a6be[_0x7ea7('0x52')](_0x4d8936);}})[_0x7ea7('0x2b')](function(_0x1d46fa){if(_0x1d46fa){return _0x1d46fa?{'count':_0x386fa5,'rows':_0x1d46fa}:null;}})['then'](respondWithResult(_0x3080a2,null))[_0x7ea7('0x48')](handleError(_0x3080a2,null));};exports[_0x7ea7('0x55')]=function(_0x19271f,_0xb85a89,_0x2ba441){if(_0x19271f[_0x7ea7('0x50')]['id']){delete _0x19271f['body']['id'];}return db['VtigerAccount'][_0x7ea7('0x56')]({'where':{'id':_0x19271f[_0x7ea7('0x4a')]['id']}})[_0x7ea7('0x2b')](handleEntityNotFound(_0xb85a89,null))['then'](function(_0x2aa8f3){if(_0x2aa8f3){_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x57')]=_0x2aa8f3['id'];_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x58')]=integrations['getSubjects'](_0x19271f[_0x7ea7('0x50')]['channel'],_0x19271f[_0x7ea7('0x50')]['type']);_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x59')]=integrations[_0x7ea7('0x5a')](_0x19271f[_0x7ea7('0x50')][_0x7ea7('0x5b')],_0x19271f['body'][_0x7ea7('0x32')]);return db[_0x7ea7('0x53')][_0x7ea7('0x4f')](_0x19271f[_0x7ea7('0x50')],{'include':[{'model':db['VtigerField'],'as':_0x7ea7('0x58')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x7ea7('0x2b')](respondWithResult(_0xb85a89,null))[_0x7ea7('0x48')](handleError(_0xb85a89,null));};var md5=require(_0x7ea7('0x5c'));exports[_0x7ea7('0x5d')]=function(_0x3a8508,_0x410412,_0x3398bb){var _0x57bde9=null;var _0x2dba95=null;var _0x33823c=null;var _0x2caad2=null;var _0x422f38='';return db['VtigerAccount'][_0x7ea7('0x56')]({'where':{'id':_0x3a8508['params']['id']},'attributes':['id',_0x7ea7('0x2d'),_0x7ea7('0x5e'),'description','moduleName',_0x7ea7('0x5f'),_0x7ea7('0x60'),_0x7ea7('0x61')]})['then'](handleEntityNotFound(_0x410412,null))[_0x7ea7('0x2b')](function(_0x1083d5){if(_0x1083d5){_0x57bde9=_0x1083d5[_0x7ea7('0x5e')];_0x2dba95=_0x1083d5[_0x7ea7('0x61')];_0x33823c=_0x1083d5['moduleName'];_0x422f38=_0x1083d5[_0x7ea7('0x5f')];var _0x1573b7=_0x422f38[_0x7ea7('0x62')](-0x1);if(_0x1573b7==='/'){_0x422f38=_0x422f38[_0x7ea7('0x63')](0x0,_0x422f38[_0x7ea7('0x64')](_0x1573b7));}_0x2caad2=util[_0x7ea7('0x65')](_0x7ea7('0x66'),_0x422f38);var _0xa56793={'method':'GET','uri':_0x2caad2,'qs':{'operation':_0x7ea7('0x67'),'username':_0x1083d5[_0x7ea7('0x5e')]},'json':!![]};return rp(_0xa56793);}})[_0x7ea7('0x2b')](function(_0x9b6532){if(_0x9b6532[_0x7ea7('0x68')]){var _0x30ff9b={'method':_0x7ea7('0x69'),'uri':_0x2caad2,'form':{'operation':_0x7ea7('0x6a'),'username':_0x57bde9,'accessKey':md5(_0x9b6532[_0x7ea7('0x6b')][_0x7ea7('0x6c')]+_0x2dba95)},'json':!![]};return rp(_0x30ff9b);}})[_0x7ea7('0x2b')](function(_0x2c4041){if(_0x2c4041[_0x7ea7('0x68')]){var _0x2c679c={'method':_0x7ea7('0x6d'),'uri':_0x2caad2,'qs':{'operation':_0x7ea7('0x6e'),'username':_0x57bde9,'sessionName':_0x2c4041[_0x7ea7('0x6b')][_0x7ea7('0x6f')],'elementType':_0x33823c},'json':!![]};return rp(_0x2c679c);}})[_0x7ea7('0x2b')](function(_0x4aef0b){if(_0x4aef0b[_0x7ea7('0x68')]){var _0x31f59f=['autogenerated',_0x7ea7('0x70'),_0x7ea7('0x71')];_[_0x7ea7('0x72')](_0x4aef0b[_0x7ea7('0x6b')][_0x7ea7('0x3a')],function(_0x3612a0){return _0x31f59f[_0x7ea7('0x73')](_0x3612a0[_0x7ea7('0x32')][_0x7ea7('0x2d')]);});_['remove'](_0x4aef0b['result'][_0x7ea7('0x3a')],function(_0x243983){return _0x243983[_0x7ea7('0x74')]==='false';});return{'count':_0x4aef0b[_0x7ea7('0x6b')]['fields']['length'],'rows':_[_0x7ea7('0x54')](_0x4aef0b[_0x7ea7('0x6b')]['fields'],function(_0xe9164a){return{'id':_0xe9164a[_0x7ea7('0x2d')],'name':_0xe9164a[_0x7ea7('0x75')],'custom':_[_0x7ea7('0x76')](_0xe9164a['name'],'cf_')?!![]:![],'options':_0xe9164a['type']['name']===_0x7ea7('0x77')&&_0xe9164a[_0x7ea7('0x32')]['picklistValues'][_0x7ea7('0x4c')]>0x0?_[_0x7ea7('0x54')](_0xe9164a[_0x7ea7('0x32')]['picklistValues'],function(_0x1bdf9b){return{'name':_0x1bdf9b['label'],'value':_0x1bdf9b['value']};}):[]};})};}})[_0x7ea7('0x2b')](respondWithResult(_0x410412,null))[_0x7ea7('0x48')](function(_0x2f3687){console['log'](_0x7ea7('0x78')+_0x2f3687);var _0x4bbd9b=_0x3a8508[_0x7ea7('0x35')][_0x7ea7('0x79')]?0x1f4:_0x2f3687[_0x7ea7('0x7a')]||0x1f4;logger[_0x7ea7('0x7b')](_0x7ea7('0x7c'),'getFields',_0x4bbd9b,JSON['stringify'](_0x2f3687));delete _0x2f3687[_0x7ea7('0x2d')];if(_0x4bbd9b===0x191){_0x4bbd9b=0x190;}_0x410412[_0x7ea7('0x20')](_0x4bbd9b)[_0x7ea7('0x2e')](_0x3a8508[_0x7ea7('0x35')][_0x7ea7('0x79')]?{'message':_0x7ea7('0x7d'),'statusCode':_0x2f3687[_0x7ea7('0x7a')]}:_0x2f3687);});}; \ No newline at end of file +var _0x3113=['getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VtigerAccount','include','findAll','catch','params','create','update','body','destroy','getConfigurations','VtigerConfiguration','order','pick','addConfiguration','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','getFields','description','moduleName','accessKey','username','slice','substring','lastIndexOf','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode'];(function(_0x4d71a2,_0x135ff5){var _0x4f0d27=function(_0x52b169){while(--_0x52b169){_0x4d71a2['push'](_0x4d71a2['shift']());}};_0x4f0d27(++_0x135ff5);}(_0x3113,0x1d8));var _0x3311=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3113[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3311('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3311('0x1'));var jsonpatch=require(_0x3311('0x2'));var rp=require(_0x3311('0x3'));var moment=require(_0x3311('0x4'));var BPromise=require(_0x3311('0x5'));var Mustache=require(_0x3311('0x6'));var util=require(_0x3311('0x7'));var path=require(_0x3311('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3311('0x9'));var fs=require('fs');var fs_extra=require(_0x3311('0xa'));var _=require(_0x3311('0xb'));var squel=require(_0x3311('0xc'));var crypto=require(_0x3311('0xd'));var jsforce=require(_0x3311('0xe'));var deskjs=require(_0x3311('0xf'));var toCsv=require(_0x3311('0x10'));var querystring=require(_0x3311('0x11'));var Papa=require(_0x3311('0x12'));var Redis=require('ioredis');var authService=require(_0x3311('0x13'));var qs=require(_0x3311('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3311('0x15'));var logger=require(_0x3311('0x16'))(_0x3311('0x17'));var utils=require('../../config/utils');var config=require(_0x3311('0x18'));var licenseUtil=require(_0x3311('0x19'));var db=require(_0x3311('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4aad3f,_0x4db7b0){_0x4db7b0=_0x4db7b0||0xcc;return function(_0x1863a4){if(_0x1863a4){return _0x4aad3f[_0x3311('0x1b')](_0x4db7b0);}return _0x4aad3f[_0x3311('0x1c')](_0x4db7b0)[_0x3311('0x1d')]();};}function respondWithResult(_0x157e39,_0x3dd678){_0x3dd678=_0x3dd678||0xc8;return function(_0x3cece2){if(_0x3cece2){return _0x157e39[_0x3311('0x1c')](_0x3dd678)['json'](_0x3cece2);}};}function respondWithFilteredResult(_0x40455d,_0x2ee03c){return function(_0x361832){if(_0x361832){var _0x248138=typeof _0x2ee03c[_0x3311('0x1e')]===_0x3311('0x1f')&&typeof _0x2ee03c[_0x3311('0x20')]===_0x3311('0x1f');var _0xf25a78=_0x361832[_0x3311('0x21')];var _0x25f0fb=_0x248138?0x0:_0x2ee03c[_0x3311('0x1e')];var _0x28c305=_0x248138?_0x361832[_0x3311('0x21')]:_0x2ee03c['offset']+_0x2ee03c['limit'];var _0x20d717;if(_0x28c305>=_0xf25a78){_0x28c305=_0xf25a78;_0x20d717=0xc8;}else{_0x20d717=0xce;}_0x40455d[_0x3311('0x1c')](_0x20d717);return _0x40455d['set'](_0x3311('0x22'),_0x25f0fb+'-'+_0x28c305+'/'+_0xf25a78)['json'](_0x361832);}return null;};}function patchUpdates(_0x17dc4d){return function(_0x435cc2){try{jsonpatch['apply'](_0x435cc2,_0x17dc4d,!![]);}catch(_0xe06de8){return BPromise[_0x3311('0x23')](_0xe06de8);}return _0x435cc2['save']();};}function saveUpdates(_0x1386f1,_0x3305eb){return function(_0xd395d8){if(_0xd395d8){return _0xd395d8['update'](_0x1386f1)[_0x3311('0x24')](function(_0x381e8c){return _0x381e8c;});}return null;};}function removeEntity(_0x5832b7,_0xa9e5ae){return function(_0x5a6bd1){if(_0x5a6bd1){return _0x5a6bd1['destroy']()['then'](function(){_0x5832b7[_0x3311('0x1c')](0xcc)[_0x3311('0x1d')]();});}};}function handleEntityNotFound(_0x49d27e,_0x842432){return function(_0x5b7a34){if(!_0x5b7a34){_0x49d27e[_0x3311('0x1b')](0x194);}return _0x5b7a34;};}function handleError(_0x5a03e8,_0x248343){_0x248343=_0x248343||0x1f4;return function(_0x591cfc){logger[_0x3311('0x25')](_0x591cfc[_0x3311('0x26')]);if(_0x591cfc[_0x3311('0x27')]){delete _0x591cfc['name'];}_0x5a03e8[_0x3311('0x1c')](_0x248343)[_0x3311('0x28')](_0x591cfc);};}exports[_0x3311('0x29')]=function(_0x3820d6,_0x5b8926){var _0x3d5022={},_0xb9e42a={},_0x4e43c5={'count':0x0,'rows':[]};var _0x5c391c=_[_0x3311('0x2a')](db['VtigerAccount'][_0x3311('0x2b')],function(_0x294a32){return{'name':_0x294a32['fieldName'],'type':_0x294a32[_0x3311('0x2c')][_0x3311('0x2d')]};});_0xb9e42a[_0x3311('0x2e')]=_['map'](_0x5c391c,'name');_0xb9e42a[_0x3311('0x2f')]=_[_0x3311('0x30')](_0x3820d6[_0x3311('0x2f')]);_0xb9e42a[_0x3311('0x31')]=_[_0x3311('0x32')](_0xb9e42a[_0x3311('0x2e')],_0xb9e42a[_0x3311('0x2f')]);_0x3d5022[_0x3311('0x33')]=_['intersection'](_0xb9e42a[_0x3311('0x2e')],qs[_0x3311('0x34')](_0x3820d6['query'][_0x3311('0x34')]));_0x3d5022[_0x3311('0x33')]=_0x3d5022[_0x3311('0x33')][_0x3311('0x35')]?_0x3d5022[_0x3311('0x33')]:_0xb9e42a['model'];if(!_0x3820d6['query'][_0x3311('0x36')](_0x3311('0x37'))){_0x3d5022[_0x3311('0x20')]=qs[_0x3311('0x20')](_0x3820d6[_0x3311('0x2f')][_0x3311('0x20')]);_0x3d5022[_0x3311('0x1e')]=qs[_0x3311('0x1e')](_0x3820d6['query'][_0x3311('0x1e')]);}_0x3d5022['order']=qs[_0x3311('0x38')](_0x3820d6[_0x3311('0x2f')]['sort']);_0x3d5022[_0x3311('0x39')]=qs[_0x3311('0x31')](_['pick'](_0x3820d6[_0x3311('0x2f')],_0xb9e42a[_0x3311('0x31')]),_0x5c391c);if(_0x3820d6[_0x3311('0x2f')][_0x3311('0x3a')]){_0x3d5022[_0x3311('0x39')]=_[_0x3311('0x3b')](_0x3d5022[_0x3311('0x39')],{'$or':_[_0x3311('0x2a')](_0x5c391c,function(_0x642b29){if(_0x642b29[_0x3311('0x2c')]!=='VIRTUAL'){var _0x1e6a20={};_0x1e6a20[_0x642b29[_0x3311('0x27')]]={'$like':'%'+_0x3820d6['query'][_0x3311('0x3a')]+'%'};return _0x1e6a20;}})});}_0x3d5022=_[_0x3311('0x3b')]({},_0x3d5022,_0x3820d6[_0x3311('0x3c')]);var _0x94093b={'where':_0x3d5022[_0x3311('0x39')]};return db[_0x3311('0x3d')][_0x3311('0x21')](_0x94093b)[_0x3311('0x24')](function(_0xd4d6bc){_0x4e43c5[_0x3311('0x21')]=_0xd4d6bc;if(_0x3820d6[_0x3311('0x2f')]['includeAll']){_0x3d5022[_0x3311('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3311('0x3f')](_0x3d5022);})[_0x3311('0x24')](function(_0x50a064){_0x4e43c5['rows']=_0x50a064;return _0x4e43c5;})[_0x3311('0x24')](respondWithFilteredResult(_0x5b8926,_0x3d5022))[_0x3311('0x40')](handleError(_0x5b8926,null));};exports['show']=function(_0x1d36c7,_0x31d30a){var _0x5cac4d={'raw':![],'where':{'id':_0x1d36c7[_0x3311('0x41')]['id']}},_0x1052f6={};_0x1052f6[_0x3311('0x2e')]=_['keys'](db['VtigerAccount'][_0x3311('0x2b')]);_0x1052f6[_0x3311('0x2f')]=_[_0x3311('0x30')](_0x1d36c7[_0x3311('0x2f')]);_0x1052f6[_0x3311('0x31')]=_[_0x3311('0x32')](_0x1052f6[_0x3311('0x2e')],_0x1052f6['query']);_0x5cac4d[_0x3311('0x33')]=_[_0x3311('0x32')](_0x1052f6[_0x3311('0x2e')],qs[_0x3311('0x34')](_0x1d36c7['query'][_0x3311('0x34')]));_0x5cac4d[_0x3311('0x33')]=_0x5cac4d['attributes'][_0x3311('0x35')]?_0x5cac4d[_0x3311('0x33')]:_0x1052f6['model'];if(_0x1d36c7[_0x3311('0x2f')]['includeAll']){_0x5cac4d[_0x3311('0x3e')]=[{'all':!![]}];}_0x5cac4d=_[_0x3311('0x3b')]({},_0x5cac4d,_0x1d36c7[_0x3311('0x3c')]);return db[_0x3311('0x3d')]['find'](_0x5cac4d)['then'](handleEntityNotFound(_0x31d30a,null))[_0x3311('0x24')](respondWithResult(_0x31d30a,null))[_0x3311('0x40')](handleError(_0x31d30a,null));};exports['create']=function(_0x434f3f,_0x5cdb24){return db[_0x3311('0x3d')][_0x3311('0x42')](_0x434f3f['body'],{})[_0x3311('0x24')](respondWithResult(_0x5cdb24,0xc9))['catch'](handleError(_0x5cdb24,null));};exports[_0x3311('0x43')]=function(_0x52cc09,_0x34a2d9){if(_0x52cc09['body']['id']){delete _0x52cc09[_0x3311('0x44')]['id'];}return db[_0x3311('0x3d')]['find']({'where':{'id':_0x52cc09['params']['id']}})[_0x3311('0x24')](handleEntityNotFound(_0x34a2d9,null))[_0x3311('0x24')](saveUpdates(_0x52cc09[_0x3311('0x44')],null))[_0x3311('0x24')](respondWithResult(_0x34a2d9,null))[_0x3311('0x40')](handleError(_0x34a2d9,null));};exports[_0x3311('0x45')]=function(_0x19a9dd,_0x40042d){return db[_0x3311('0x3d')]['find']({'where':{'id':_0x19a9dd[_0x3311('0x41')]['id']}})['then'](handleEntityNotFound(_0x40042d,null))[_0x3311('0x24')](removeEntity(_0x40042d,null))[_0x3311('0x40')](handleError(_0x40042d,null));};exports[_0x3311('0x46')]=function(_0x63f2ac,_0x316b47,_0x31a415){var _0x259275={};var _0x31803e={};var _0x24eb9d;var _0x26a069;return db['VtigerAccount']['findOne']({'where':{'id':_0x63f2ac[_0x3311('0x41')]['id']}})['then'](handleEntityNotFound(_0x316b47,null))[_0x3311('0x24')](function(_0xf40913){if(_0xf40913){_0x24eb9d=_0xf40913;_0x31803e['model']=_['keys'](db[_0x3311('0x47')][_0x3311('0x2b')]);_0x31803e['query']=_[_0x3311('0x30')](_0x63f2ac[_0x3311('0x2f')]);_0x31803e[_0x3311('0x31')]=_[_0x3311('0x32')](_0x31803e['model'],_0x31803e[_0x3311('0x2f')]);_0x259275[_0x3311('0x33')]=_[_0x3311('0x32')](_0x31803e[_0x3311('0x2e')],qs[_0x3311('0x34')](_0x63f2ac[_0x3311('0x2f')]['fields']));_0x259275['attributes']=_0x259275['attributes']['length']?_0x259275[_0x3311('0x33')]:_0x31803e[_0x3311('0x2e')];_0x259275[_0x3311('0x48')]=qs[_0x3311('0x38')](_0x63f2ac[_0x3311('0x2f')][_0x3311('0x38')]);_0x259275['where']=qs[_0x3311('0x31')](_[_0x3311('0x49')](_0x63f2ac['query'],_0x31803e[_0x3311('0x31')]));if(_0x63f2ac[_0x3311('0x2f')][_0x3311('0x3a')]){_0x259275['where']=_[_0x3311('0x3b')](_0x259275[_0x3311('0x39')],{'$or':_[_0x3311('0x2a')](_0x259275['attributes'],function(_0x2491a5){var _0x2d6186={};_0x2d6186[_0x2491a5]={'$like':'%'+_0x63f2ac[_0x3311('0x2f')]['filter']+'%'};return _0x2d6186;})});}_0x259275=_['merge']({},_0x259275,_0x63f2ac['options']);return _0x24eb9d[_0x3311('0x46')](_0x259275);}})['then'](function(_0x530db1){if(_0x530db1){_0x26a069=_0x530db1[_0x3311('0x35')];if(!_0x63f2ac[_0x3311('0x2f')]['hasOwnProperty'](_0x3311('0x37'))){_0x259275[_0x3311('0x20')]=qs[_0x3311('0x20')](_0x63f2ac[_0x3311('0x2f')][_0x3311('0x20')]);_0x259275['offset']=qs[_0x3311('0x1e')](_0x63f2ac[_0x3311('0x2f')][_0x3311('0x1e')]);}return _0x24eb9d[_0x3311('0x46')](_0x259275);}})[_0x3311('0x24')](function(_0x531322){if(_0x531322){return _0x531322?{'count':_0x26a069,'rows':_0x531322}:null;}})['then'](respondWithResult(_0x316b47,null))[_0x3311('0x40')](handleError(_0x316b47,null));};exports[_0x3311('0x4a')]=function(_0x1ea592,_0x1b3076,_0x2bdffc){if(_0x1ea592[_0x3311('0x44')]['id']){delete _0x1ea592[_0x3311('0x44')]['id'];}return db[_0x3311('0x3d')]['findOne']({'where':{'id':_0x1ea592[_0x3311('0x41')]['id']}})[_0x3311('0x24')](handleEntityNotFound(_0x1b3076,null))[_0x3311('0x24')](function(_0x172f85){if(_0x172f85){_0x1ea592['body']['AccountId']=_0x172f85['id'];_0x1ea592[_0x3311('0x44')][_0x3311('0x4b')]=integrations[_0x3311('0x4c')](_0x1ea592['body'][_0x3311('0x4d')],_0x1ea592['body'][_0x3311('0x2c')]);_0x1ea592[_0x3311('0x44')]['Descriptions']=integrations[_0x3311('0x4e')](_0x1ea592[_0x3311('0x44')][_0x3311('0x4d')],_0x1ea592['body'][_0x3311('0x2c')]);return db['VtigerConfiguration'][_0x3311('0x42')](_0x1ea592[_0x3311('0x44')],{'include':[{'model':db[_0x3311('0x4f')],'as':_0x3311('0x4b')},{'model':db[_0x3311('0x4f')],'as':_0x3311('0x50')}]});}return null;})[_0x3311('0x24')](respondWithResult(_0x1b3076,null))[_0x3311('0x40')](handleError(_0x1b3076,null));};var md5=require('md5');exports[_0x3311('0x51')]=function(_0x226387,_0x522285,_0x1e16e1){var _0x1e4d19=null;var _0x1d751b=null;var _0x969e1a=null;var _0x557c32=null;var _0x5dd212='';return db[_0x3311('0x3d')]['findOne']({'where':{'id':_0x226387[_0x3311('0x41')]['id']},'attributes':['id',_0x3311('0x27'),'username',_0x3311('0x52'),_0x3311('0x53'),'remoteUri','serverUrl',_0x3311('0x54')]})['then'](handleEntityNotFound(_0x522285,null))[_0x3311('0x24')](function(_0x59635f){if(_0x59635f){_0x1e4d19=_0x59635f[_0x3311('0x55')];_0x1d751b=_0x59635f['accessKey'];_0x969e1a=_0x59635f[_0x3311('0x53')];_0x5dd212=_0x59635f['remoteUri'];var _0x6a4a8=_0x5dd212[_0x3311('0x56')](-0x1);if(_0x6a4a8==='/'){_0x5dd212=_0x5dd212[_0x3311('0x57')](0x0,_0x5dd212[_0x3311('0x58')](_0x6a4a8));}_0x557c32=util['format']('%s/webservice.php',_0x5dd212);var _0x337a0b={'method':_0x3311('0x59'),'uri':_0x557c32,'qs':{'operation':'getchallenge','username':_0x59635f['username']},'json':!![]};return rp(_0x337a0b);}})[_0x3311('0x24')](function(_0x5018a7){if(_0x5018a7[_0x3311('0x5a')]){var _0x5b47ff={'method':_0x3311('0x5b'),'uri':_0x557c32,'form':{'operation':_0x3311('0x5c'),'username':_0x1e4d19,'accessKey':md5(_0x5018a7[_0x3311('0x5d')][_0x3311('0x5e')]+_0x1d751b)},'json':!![]};return rp(_0x5b47ff);}})[_0x3311('0x24')](function(_0x5883e7){if(_0x5883e7[_0x3311('0x5a')]){var _0x4feef2={'method':_0x3311('0x59'),'uri':_0x557c32,'qs':{'operation':_0x3311('0x5f'),'username':_0x1e4d19,'sessionName':_0x5883e7[_0x3311('0x5d')][_0x3311('0x60')],'elementType':_0x969e1a},'json':!![]};return rp(_0x4feef2);}})[_0x3311('0x24')](function(_0xa780d5){if(_0xa780d5[_0x3311('0x5a')]){var _0x1b0c38=[_0x3311('0x61'),_0x3311('0x62'),_0x3311('0x63')];_[_0x3311('0x64')](_0xa780d5[_0x3311('0x5d')][_0x3311('0x34')],function(_0x1faafa){return _0x1b0c38[_0x3311('0x65')](_0x1faafa[_0x3311('0x2c')][_0x3311('0x27')]);});_[_0x3311('0x64')](_0xa780d5[_0x3311('0x5d')][_0x3311('0x34')],function(_0x267f19){return _0x267f19[_0x3311('0x66')]===_0x3311('0x67');});return{'count':_0xa780d5[_0x3311('0x5d')][_0x3311('0x34')]['length'],'rows':_[_0x3311('0x2a')](_0xa780d5['result'][_0x3311('0x34')],function(_0x598084){return{'id':_0x598084[_0x3311('0x27')],'name':_0x598084[_0x3311('0x68')],'custom':_[_0x3311('0x69')](_0x598084[_0x3311('0x27')],_0x3311('0x6a'))?!![]:![],'options':_0x598084[_0x3311('0x2c')][_0x3311('0x27')]===_0x3311('0x6b')&&_0x598084[_0x3311('0x2c')][_0x3311('0x6c')]['length']>0x0?_[_0x3311('0x2a')](_0x598084[_0x3311('0x2c')][_0x3311('0x6c')],function(_0x3891fa){return{'name':_0x3891fa['label'],'value':_0x3891fa[_0x3311('0x6d')]};}):[]};})};}})[_0x3311('0x24')](respondWithResult(_0x522285,null))['catch'](function(_0x281e88){console[_0x3311('0x6e')](_0x3311('0x6f')+_0x281e88);var _0x38e02d=_0x226387['query']['test']?0x1f4:_0x281e88[_0x3311('0x70')]||0x1f4;logger[_0x3311('0x25')](_0x3311('0x71'),'getFields',_0x38e02d,JSON[_0x3311('0x72')](_0x281e88));delete _0x281e88['name'];if(_0x38e02d===0x191){_0x38e02d=0x190;}_0x522285[_0x3311('0x1c')](_0x38e02d)[_0x3311('0x28')](_0x226387[_0x3311('0x2f')][_0x3311('0x73')]?{'message':_0x3311('0x74'),'statusCode':_0x281e88[_0x3311('0x70')]}:_0x281e88);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f43394f..3158fc6 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.model.js +++ b/server/api/intVtigerAccount/intVtigerAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x876e=['api','moment','bluebird','request-promise','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x876e,0x11c));var _0xe876=function(_0x165c23,_0x38cfc6){_0x165c23=_0x165c23-0x0;var _0x8e4bfc=_0x876e[_0x165c23];return _0x8e4bfc;};'use strict';var _=require(_0xe876('0x0'));var util=require('util');var logger=require(_0xe876('0x1'))(_0xe876('0x2'));var moment=require(_0xe876('0x3'));var BPromise=require(_0xe876('0x4'));var rp=require(_0xe876('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xe876('0x6'));module[_0xe876('0x7')]=function(_0x145e2d,_0x33aff2){return _0x145e2d[_0xe876('0x8')](_0xe876('0x9'),attributes,{'tableName':_0xe876('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc8a=['int_vtiger_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc8a,0x9b));var _0xafc8=function(_0x461c9e,_0x9a67cd){_0x461c9e=_0x461c9e-0x0;var _0x144e35=_0xfc8a[_0x461c9e];return _0x144e35;};'use strict';var _=require(_0xafc8('0x0'));var util=require('util');var logger=require(_0xafc8('0x1'))(_0xafc8('0x2'));var moment=require('moment');var BPromise=require(_0xafc8('0x3'));var rp=require(_0xafc8('0x4'));var fs=require('fs');var path=require(_0xafc8('0x5'));var rimraf=require(_0xafc8('0x6'));var config=require(_0xafc8('0x7'));var attributes=require(_0xafc8('0x8'));var integrations=require(_0xafc8('0x9'));module[_0xafc8('0xa')]=function(_0x1c607b,_0xf0f630){return _0x1c607b[_0xafc8('0xb')](_0xafc8('0xc'),attributes,{'tableName':_0xafc8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 110f7a0..5b01e3c 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fd9=['../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0x0fd9[_0x1aa3fe];return _0x163cee;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var moment=require(_0x90fd('0x1'));var BPromise=require(_0x90fd('0x2'));var rs=require(_0x90fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x90fd('0x4'));var logger=require(_0x90fd('0x5'))(_0x90fd('0x6'));var config=require(_0x90fd('0x7'));var jayson=require(_0x90fd('0x8'));var client=jayson[_0x90fd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ff2d4,_0x128c17,_0x50c778){return new BPromise(function(_0x5a604a,_0x2acef7){return client[_0x90fd('0xa')](_0x4ff2d4,_0x50c778)['then'](function(_0x234ba9){logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));logger[_0x90fd('0xe')](_0x90fd('0xf'),_0x128c17,_0x90fd('0xd'),JSON[_0x90fd('0x10')](_0x234ba9));if(_0x234ba9[_0x90fd('0x11')]){if(_0x234ba9['error'][_0x90fd('0x12')]===0x1f4){logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x2acef7(_0x234ba9[_0x90fd('0x11')]['message']);}logger[_0x90fd('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x128c17,_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);return _0x5a604a(_0x234ba9[_0x90fd('0x11')][_0x90fd('0x13')]);}else{logger[_0x90fd('0xb')](_0x90fd('0xc'),_0x128c17,_0x90fd('0xd'));_0x5a604a(_0x234ba9['result']['message']);}})[_0x90fd('0x14')](function(_0x43d804){logger['error'](_0x90fd('0xc'),_0x128c17,_0x43d804);_0x2acef7(_0x43d804);});});}exports[_0x90fd('0x15')]=function(_0x1fcc87){var _0x4d8f3b=this;return new Promise(function(_0x3f9c76,_0x16e9e3){return db[_0x90fd('0x16')][_0x90fd('0x17')]({'raw':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'limit':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')]['limit']||null:null,'include':_0x1fcc87[_0x90fd('0x18')]?_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x1fcc87[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x30f67e){return{'model':db[_0x30f67e[_0x90fd('0x1e')]],'as':_0x30f67e['as'],'attributes':_0x30f67e['attributes'],'include':_0x30f67e[_0x90fd('0x1c')]?_['map'](_0x30f67e[_0x90fd('0x1c')],function(_0x18d5b3){return{'model':db[_0x18d5b3[_0x90fd('0x1e')]],'as':_0x18d5b3['as'],'attributes':_0x18d5b3[_0x90fd('0x1b')],'include':_0x18d5b3[_0x90fd('0x1c')]?_['map'](_0x18d5b3[_0x90fd('0x1c')],function(_0xe333f0){return{'model':db[_0xe333f0[_0x90fd('0x1e')]],'as':_0xe333f0['as'],'attributes':_0xe333f0[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x428bc2){logger['info']('GetVtigerAccount',_0x1fcc87);logger[_0x90fd('0xe')](_0x90fd('0x15'),_0x1fcc87,JSON[_0x90fd('0x10')](_0x428bc2));_0x3f9c76(_0x428bc2);})[_0x90fd('0x14')](function(_0x397aaf){logger['error']('GetVtigerAccount',_0x397aaf[_0x90fd('0x13')],_0x1fcc87);_0x16e9e3(_0x4d8f3b[_0x90fd('0x11')](0x1f4,_0x397aaf[_0x90fd('0x13')]));});});};exports[_0x90fd('0x20')]=function(_0x4a3ae4){var _0x59aede=this;return new Promise(function(_0x12dea4,_0x21a9cf){return db[_0x90fd('0x16')][_0x90fd('0x21')]({'raw':_0x4a3ae4['options']?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x19')]===undefined?!![]:![]:!![],'where':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1a')]||null:null,'attributes':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1b')]||null:null,'include':_0x4a3ae4[_0x90fd('0x18')]?_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x4a3ae4[_0x90fd('0x18')][_0x90fd('0x1c')],function(_0x209e5c){return{'model':db[_0x209e5c[_0x90fd('0x1e')]],'as':_0x209e5c['as'],'attributes':_0x209e5c['attributes'],'include':_0x209e5c[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x209e5c[_0x90fd('0x1c')],function(_0x3aee5){return{'model':db[_0x3aee5[_0x90fd('0x1e')]],'as':_0x3aee5['as'],'attributes':_0x3aee5[_0x90fd('0x1b')],'include':_0x3aee5[_0x90fd('0x1c')]?_[_0x90fd('0x1d')](_0x3aee5[_0x90fd('0x1c')],function(_0x186f4f){return{'model':db[_0x186f4f[_0x90fd('0x1e')]],'as':_0x186f4f['as'],'attributes':_0x186f4f[_0x90fd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x90fd('0x1f')](function(_0x4c20b0){logger[_0x90fd('0xb')](_0x90fd('0x20'),_0x4a3ae4);logger[_0x90fd('0xe')](_0x90fd('0x20'),_0x4a3ae4,JSON['stringify'](_0x4c20b0));_0x12dea4(_0x4c20b0);})[_0x90fd('0x14')](function(_0x2c4f37){logger[_0x90fd('0x11')]('ShowVtigerAccount',_0x2c4f37['message'],_0x4a3ae4);_0x21a9cf(_0x59aede[_0x90fd('0x11')](0x1f4,_0x2c4f37[_0x90fd('0x13')]));});});}; \ No newline at end of file +var _0xa902=['include','map','model','ShowVtigerAccount','VtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa902,0x8d));var _0x2a90=function(_0x570a37,_0x5398a9){_0x570a37=_0x570a37-0x0;var _0x47fb13=_0xa902[_0x570a37];return _0x47fb13;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});}exports[_0x2a90('0x17')]=function(_0x5c3e4b){var _0x162f0b=this;return new Promise(function(_0x1d9a28,_0x4190ff){return db['VtigerAccount'][_0x2a90('0x18')]({'raw':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1c')]||null:null,'limit':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')]['limit']||null:null,'include':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x5c3e4b['options'][_0x2a90('0x1d')],function(_0xd033d){return{'model':db[_0xd033d['model']],'as':_0xd033d['as'],'attributes':_0xd033d[_0x2a90('0x1c')],'include':_0xd033d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0xd033d[_0x2a90('0x1d')],function(_0x2a212c){return{'model':db[_0x2a212c[_0x2a90('0x1f')]],'as':_0x2a212c['as'],'attributes':_0x2a212c[_0x2a90('0x1c')],'include':_0x2a212c[_0x2a90('0x1d')]?_['map'](_0x2a212c[_0x2a90('0x1d')],function(_0x17f978){return{'model':db[_0x17f978[_0x2a90('0x1f')]],'as':_0x17f978['as'],'attributes':_0x17f978[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x5208d8){logger['info'](_0x2a90('0x17'),_0x5c3e4b);logger['debug']('GetVtigerAccount',_0x5c3e4b,JSON['stringify'](_0x5208d8));_0x1d9a28(_0x5208d8);})[_0x2a90('0x16')](function(_0x3c78f5){logger['error']('GetVtigerAccount',_0x3c78f5[_0x2a90('0x14')],_0x5c3e4b);_0x4190ff(_0x162f0b['error'](0x1f4,_0x3c78f5[_0x2a90('0x14')]));});});};exports[_0x2a90('0x20')]=function(_0x3b580f){var _0x27b6b6=this;return new Promise(function(_0xf18d11,_0x11586c){return db[_0x2a90('0x21')]['find']({'raw':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b580f['options']?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')]['attributes']||null:null,'include':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')],function(_0x4d4149){return{'model':db[_0x4d4149[_0x2a90('0x1f')]],'as':_0x4d4149['as'],'attributes':_0x4d4149[_0x2a90('0x1c')],'include':_0x4d4149[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x4d4149['include'],function(_0x1bab1d){return{'model':db[_0x1bab1d[_0x2a90('0x1f')]],'as':_0x1bab1d['as'],'attributes':_0x1bab1d['attributes'],'include':_0x1bab1d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x1bab1d['include'],function(_0x5073a4){return{'model':db[_0x5073a4[_0x2a90('0x1f')]],'as':_0x5073a4['as'],'attributes':_0x5073a4[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x4cd36c){logger[_0x2a90('0xd')]('ShowVtigerAccount',_0x3b580f);logger[_0x2a90('0xf')]('ShowVtigerAccount',_0x3b580f,JSON[_0x2a90('0x12')](_0x4cd36c));_0xf18d11(_0x4cd36c);})['catch'](function(_0x5322dc){logger[_0x2a90('0x13')]('ShowVtigerAccount',_0x5322dc[_0x2a90('0x14')],_0x3b580f);_0x11586c(_0x27b6b6[_0x2a90('0x13')](0x1f4,_0x5322dc[_0x2a90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c4556fc..c9728ff 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x462c=['getSubjects','getDescriptions','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/fields','isAuthenticated','getFields'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x462c,0x167));var _0xc462=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x462c[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0xc462('0x0'));var path=require(_0xc462('0x1'));var timeout=require(_0xc462('0x2'));var express=require(_0xc462('0x3'));var router=express[_0xc462('0x4')]();var fs_extra=require(_0xc462('0x5'));var auth=require(_0xc462('0x6'));var interaction=require(_0xc462('0x7'));var config=require(_0xc462('0x8'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc462('0x9')](_0xc462('0xa'),auth['isAuthenticated'](),controller[_0xc462('0xb')]);router['get'](_0xc462('0xc'),auth[_0xc462('0xd')](),controller[_0xc462('0xe')]);router[_0xc462('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xc462('0xf')]);router[_0xc462('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xc462('0x10')]);router['post']('/',auth[_0xc462('0xd')](),controller[_0xc462('0x11')]);router[_0xc462('0x12')](_0xc462('0xa'),auth[_0xc462('0xd')](),controller[_0xc462('0x13')]);router[_0xc462('0x14')](_0xc462('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc462('0x15')]=router; \ No newline at end of file +var _0x9041=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','getDescriptions','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x24d79a,_0x5d602d){var _0x5ecb30=function(_0x5a6e24){while(--_0x5a6e24){_0x24d79a['push'](_0x24d79a['shift']());}};_0x5ecb30(++_0x5d602d);}(_0x9041,0xd9));var _0x1904=function(_0x438979,_0x2f75b5){_0x438979=_0x438979-0x0;var _0x1cd370=_0x9041[_0x438979];return _0x1cd370;};'use strict';var multer=require(_0x1904('0x0'));var util=require(_0x1904('0x1'));var path=require(_0x1904('0x2'));var timeout=require('connect-timeout');var express=require(_0x1904('0x3'));var router=express['Router']();var fs_extra=require(_0x1904('0x4'));var auth=require(_0x1904('0x5'));var interaction=require(_0x1904('0x6'));var config=require(_0x1904('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0x1904('0x8')]('/',auth['isAuthenticated'](),controller[_0x1904('0x9')]);router['get'](_0x1904('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1904('0x8')](_0x1904('0xb'),auth['isAuthenticated'](),controller[_0x1904('0xc')]);router[_0x1904('0x8')](_0x1904('0xd'),auth[_0x1904('0xe')](),controller['getSubjects']);router[_0x1904('0x8')]('/:id/descriptions',auth[_0x1904('0xe')](),controller[_0x1904('0xf')]);router[_0x1904('0x10')]('/',auth[_0x1904('0xe')](),controller[_0x1904('0x11')]);router[_0x1904('0x12')](_0x1904('0xa'),auth[_0x1904('0xe')](),controller[_0x1904('0x13')]);router[_0x1904('0x14')](_0x1904('0xa'),auth[_0x1904('0xe')](),controller[_0x1904('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ef1ee66..e6daac2 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x058c=['STRING','sequelize','exports'];(function(_0x15ca34,_0x286541){var _0x44b8be=function(_0x143f29){while(--_0x143f29){_0x15ca34['push'](_0x15ca34['shift']());}};_0x44b8be(++_0x286541);}(_0x058c,0x166));var _0xc058=function(_0x487f2a,_0xd5690){_0x487f2a=_0x487f2a-0x0;var _0x418e46=_0x058c[_0x487f2a];return _0x418e46;};'use strict';var Sequelize=require(_0xc058('0x0'));module[_0xc058('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc058('0x2')]}}; \ No newline at end of file +var _0x1e36=['STRING','sequelize','exports'];(function(_0x3576c9,_0x5b211b){var _0x1b2d2d=function(_0x827a05){while(--_0x827a05){_0x3576c9['push'](_0x3576c9['shift']());}};_0x1b2d2d(++_0x5b211b);}(_0x1e36,0x115));var _0x61e3=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x1e36[_0x507403];return _0x1327c;};'use strict';var Sequelize=require(_0x61e3('0x0'));module[_0x61e3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x61e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 844e201..24e1b00 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2313=['mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','merge','options','includeAll','include','VtigerConfiguration','rows','catch','show','params','length','create','body','find','findOne','sort','filter','nolimit','getFields','getSubjects','getDescriptions','VtigerField','eml-format','fast-json-patch','moment','bluebird'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2313,0x191));var _0x3231=function(_0x27ef87,_0x9d9c1f){_0x27ef87=_0x27ef87-0x0;var _0x39a887=_0x2313[_0x27ef87];return _0x39a887;};'use strict';var emlformat=require(_0x3231('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3231('0x1'));var rp=require('request-promise');var moment=require(_0x3231('0x2'));var BPromise=require(_0x3231('0x3'));var Mustache=require(_0x3231('0x4'));var util=require('util');var path=require(_0x3231('0x5'));var sox=require('sox');var csv=require(_0x3231('0x6'));var ejs=require(_0x3231('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3231('0x8'));var squel=require(_0x3231('0x9'));var crypto=require(_0x3231('0xa'));var jsforce=require(_0x3231('0xb'));var deskjs=require(_0x3231('0xc'));var toCsv=require(_0x3231('0x6'));var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require(_0x3231('0x10'));var qs=require(_0x3231('0x11'));var as=require(_0x3231('0x12'));var hardwareService=require(_0x3231('0x13'));var logger=require(_0x3231('0x14'))(_0x3231('0x15'));var utils=require(_0x3231('0x16'));var config=require(_0x3231('0x17'));var licenseUtil=require(_0x3231('0x18'));var db=require(_0x3231('0x19'))['db'];function respondWithStatusCode(_0x143d6c,_0x4cd784){_0x4cd784=_0x4cd784||0xcc;return function(_0x30f4e5){if(_0x30f4e5){return _0x143d6c[_0x3231('0x1a')](_0x4cd784);}return _0x143d6c['status'](_0x4cd784)['end']();};}function respondWithResult(_0x32f0bf,_0x5c1e28){_0x5c1e28=_0x5c1e28||0xc8;return function(_0x27de1d){if(_0x27de1d){return _0x32f0bf[_0x3231('0x1b')](_0x5c1e28)[_0x3231('0x1c')](_0x27de1d);}};}function respondWithFilteredResult(_0x378015,_0x538db9){return function(_0x58f108){if(_0x58f108){var _0x41eaa2=typeof _0x538db9[_0x3231('0x1d')]===_0x3231('0x1e')&&typeof _0x538db9[_0x3231('0x1f')]===_0x3231('0x1e');var _0x275292=_0x58f108[_0x3231('0x20')];var _0x560050=_0x41eaa2?0x0:_0x538db9[_0x3231('0x1d')];var _0x42123b=_0x41eaa2?_0x58f108[_0x3231('0x20')]:_0x538db9[_0x3231('0x1d')]+_0x538db9['limit'];var _0x488c62;if(_0x42123b>=_0x275292){_0x42123b=_0x275292;_0x488c62=0xc8;}else{_0x488c62=0xce;}_0x378015['status'](_0x488c62);return _0x378015[_0x3231('0x21')](_0x3231('0x22'),_0x560050+'-'+_0x42123b+'/'+_0x275292)['json'](_0x58f108);}return null;};}function patchUpdates(_0x4c0f7c){return function(_0x5cb4d3){try{jsonpatch[_0x3231('0x23')](_0x5cb4d3,_0x4c0f7c,!![]);}catch(_0x1285cc){return BPromise['reject'](_0x1285cc);}return _0x5cb4d3[_0x3231('0x24')]();};}function saveUpdates(_0x1e80f1,_0x446eba){return function(_0x132823){if(_0x132823){return _0x132823[_0x3231('0x25')](_0x1e80f1)[_0x3231('0x26')](function(_0x23c5d5){return _0x23c5d5;});}return null;};}function removeEntity(_0x1e4eb4,_0x2332f1){return function(_0x13a616){if(_0x13a616){return _0x13a616[_0x3231('0x27')]()[_0x3231('0x26')](function(){_0x1e4eb4[_0x3231('0x1b')](0xcc)[_0x3231('0x28')]();});}};}function handleEntityNotFound(_0x4078f2,_0x2dbda3){return function(_0x16c223){if(!_0x16c223){_0x4078f2['sendStatus'](0x194);}return _0x16c223;};}function handleError(_0x95ee3,_0x380315){_0x380315=_0x380315||0x1f4;return function(_0x3fdf50){logger[_0x3231('0x29')](_0x3fdf50[_0x3231('0x2a')]);if(_0x3fdf50[_0x3231('0x2b')]){delete _0x3fdf50[_0x3231('0x2b')];}_0x95ee3[_0x3231('0x1b')](_0x380315)[_0x3231('0x2c')](_0x3fdf50);};}exports['index']=function(_0x1156c8,_0x1d4839){var _0x146707={},_0x3caa93={},_0x1a2118={'count':0x0,'rows':[]};var _0x26b63d=_[_0x3231('0x2d')](db['VtigerConfiguration'][_0x3231('0x2e')],function(_0x9ac9cd){return{'name':_0x9ac9cd['fieldName'],'type':_0x9ac9cd[_0x3231('0x2f')][_0x3231('0x30')]};});_0x3caa93[_0x3231('0x31')]=_['map'](_0x26b63d,_0x3231('0x2b'));_0x3caa93[_0x3231('0x32')]=_[_0x3231('0x33')](_0x1156c8[_0x3231('0x32')]);_0x3caa93[_0x3231('0x34')]=_[_0x3231('0x35')](_0x3caa93[_0x3231('0x31')],_0x3caa93[_0x3231('0x32')]);_0x146707[_0x3231('0x36')]=_['intersection'](_0x3caa93[_0x3231('0x31')],qs[_0x3231('0x37')](_0x1156c8['query'][_0x3231('0x37')]));_0x146707[_0x3231('0x36')]=_0x146707[_0x3231('0x36')]['length']?_0x146707[_0x3231('0x36')]:_0x3caa93['model'];if(!_0x1156c8[_0x3231('0x32')][_0x3231('0x38')]('nolimit')){_0x146707[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x1156c8[_0x3231('0x32')][_0x3231('0x1f')]);_0x146707['offset']=qs[_0x3231('0x1d')](_0x1156c8[_0x3231('0x32')]['offset']);}_0x146707[_0x3231('0x39')]=qs['sort'](_0x1156c8['query']['sort']);_0x146707[_0x3231('0x3a')]=qs['filters'](_[_0x3231('0x3b')](_0x1156c8[_0x3231('0x32')],_0x3caa93[_0x3231('0x34')]),_0x26b63d);if(_0x1156c8[_0x3231('0x32')]['filter']){_0x146707[_0x3231('0x3a')]=_['merge'](_0x146707[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x26b63d,function(_0x190e8d){if(_0x190e8d[_0x3231('0x2f')]!=='VIRTUAL'){var _0x56daca={};_0x56daca[_0x190e8d[_0x3231('0x2b')]]={'$like':'%'+_0x1156c8[_0x3231('0x32')]['filter']+'%'};return _0x56daca;}})});}_0x146707=_[_0x3231('0x3c')]({},_0x146707,_0x1156c8[_0x3231('0x3d')]);var _0x3e23e9={'where':_0x146707['where']};return db['VtigerConfiguration'][_0x3231('0x20')](_0x3e23e9)[_0x3231('0x26')](function(_0xc44132){_0x1a2118[_0x3231('0x20')]=_0xc44132;if(_0x1156c8[_0x3231('0x32')][_0x3231('0x3e')]){_0x146707[_0x3231('0x3f')]=[{'all':!![]}];}return db[_0x3231('0x40')]['findAll'](_0x146707);})[_0x3231('0x26')](function(_0x2a20b5){_0x1a2118[_0x3231('0x41')]=_0x2a20b5;return _0x1a2118;})[_0x3231('0x26')](respondWithFilteredResult(_0x1d4839,_0x146707))[_0x3231('0x42')](handleError(_0x1d4839,null));};exports[_0x3231('0x43')]=function(_0xc939b,_0xdb3d92){var _0x1c7bb1={'raw':![],'where':{'id':_0xc939b[_0x3231('0x44')]['id']}},_0x2fc150={};_0x2fc150[_0x3231('0x31')]=_['keys'](db[_0x3231('0x40')][_0x3231('0x2e')]);_0x2fc150[_0x3231('0x32')]=_[_0x3231('0x33')](_0xc939b[_0x3231('0x32')]);_0x2fc150[_0x3231('0x34')]=_['intersection'](_0x2fc150[_0x3231('0x31')],_0x2fc150['query']);_0x1c7bb1[_0x3231('0x36')]=_[_0x3231('0x35')](_0x2fc150[_0x3231('0x31')],qs[_0x3231('0x37')](_0xc939b[_0x3231('0x32')][_0x3231('0x37')]));_0x1c7bb1[_0x3231('0x36')]=_0x1c7bb1[_0x3231('0x36')][_0x3231('0x45')]?_0x1c7bb1[_0x3231('0x36')]:_0x2fc150[_0x3231('0x31')];if(_0xc939b['query'][_0x3231('0x3e')]){_0x1c7bb1[_0x3231('0x3f')]=[{'all':!![]}];}_0x1c7bb1=_['merge']({},_0x1c7bb1,_0xc939b[_0x3231('0x3d')]);return db[_0x3231('0x40')]['find'](_0x1c7bb1)[_0x3231('0x26')](handleEntityNotFound(_0xdb3d92,null))[_0x3231('0x26')](respondWithResult(_0xdb3d92,null))[_0x3231('0x42')](handleError(_0xdb3d92,null));};exports[_0x3231('0x46')]=function(_0x4b521e,_0x3a78b7){return db[_0x3231('0x40')]['create'](_0x4b521e[_0x3231('0x47')],{})[_0x3231('0x26')](respondWithResult(_0x3a78b7,0xc9))[_0x3231('0x42')](handleError(_0x3a78b7,null));};exports[_0x3231('0x25')]=function(_0x2742e7,_0x2033c3){if(_0x2742e7[_0x3231('0x47')]['id']){delete _0x2742e7[_0x3231('0x47')]['id'];}return db[_0x3231('0x40')][_0x3231('0x48')]({'where':{'id':_0x2742e7[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x2033c3,null))[_0x3231('0x26')](saveUpdates(_0x2742e7[_0x3231('0x47')],null))[_0x3231('0x26')](respondWithResult(_0x2033c3,null))[_0x3231('0x42')](handleError(_0x2033c3,null));};exports[_0x3231('0x27')]=function(_0x3d7f29,_0x386bcd){return db['VtigerConfiguration'][_0x3231('0x48')]({'where':{'id':_0x3d7f29[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x386bcd,null))['then'](removeEntity(_0x386bcd,null))[_0x3231('0x42')](handleError(_0x386bcd,null));};exports['getFields']=function(_0x1a8d3b,_0x28be02,_0xc85958){var _0x344f42={};var _0xb13705={};var _0x1ee3a4;var _0x2a8590;return db[_0x3231('0x40')][_0x3231('0x49')]({'where':{'id':_0x1a8d3b[_0x3231('0x44')]['id']}})['then'](handleEntityNotFound(_0x28be02,null))['then'](function(_0x558f56){if(_0x558f56){_0x1ee3a4=_0x558f56;_0xb13705[_0x3231('0x31')]=_[_0x3231('0x33')](db['VtigerField'][_0x3231('0x2e')]);_0xb13705[_0x3231('0x32')]=_[_0x3231('0x33')](_0x1a8d3b[_0x3231('0x32')]);_0xb13705['filters']=_[_0x3231('0x35')](_0xb13705[_0x3231('0x31')],_0xb13705['query']);_0x344f42[_0x3231('0x36')]=_['intersection'](_0xb13705[_0x3231('0x31')],qs[_0x3231('0x37')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x37')]));_0x344f42[_0x3231('0x36')]=_0x344f42[_0x3231('0x36')][_0x3231('0x45')]?_0x344f42[_0x3231('0x36')]:_0xb13705[_0x3231('0x31')];_0x344f42[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x4a')]);_0x344f42[_0x3231('0x3a')]=qs['filters'](_['pick'](_0x1a8d3b['query'],_0xb13705['filters']));if(_0x1a8d3b['query'][_0x3231('0x4b')]){_0x344f42[_0x3231('0x3a')]=_[_0x3231('0x3c')](_0x344f42[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x344f42[_0x3231('0x36')],function(_0x46f3ec){var _0x408167={};_0x408167[_0x46f3ec]={'$like':'%'+_0x1a8d3b[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x408167;})});}_0x344f42=_[_0x3231('0x3c')]({},_0x344f42,_0x1a8d3b[_0x3231('0x3d')]);return _0x1ee3a4['getFields'](_0x344f42);}})[_0x3231('0x26')](function(_0xb77df5){if(_0xb77df5){_0x2a8590=_0xb77df5[_0x3231('0x45')];if(!_0x1a8d3b[_0x3231('0x32')]['hasOwnProperty'](_0x3231('0x4c'))){_0x344f42[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x1f')]);_0x344f42[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x1a8d3b[_0x3231('0x32')][_0x3231('0x1d')]);}return _0x1ee3a4[_0x3231('0x4d')](_0x344f42);}})[_0x3231('0x26')](function(_0xc06a83){if(_0xc06a83){return _0xc06a83?{'count':_0x2a8590,'rows':_0xc06a83}:null;}})['then'](respondWithResult(_0x28be02,null))[_0x3231('0x42')](handleError(_0x28be02,null));};exports[_0x3231('0x4e')]=function(_0x281527,_0x2eb8a2,_0x1df559){var _0xb37162={};var _0x45f7cc={};var _0x470b32;var _0x1a06b2;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x281527[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x2eb8a2,null))['then'](function(_0xf8afd7){if(_0xf8afd7){_0x470b32=_0xf8afd7;_0x45f7cc[_0x3231('0x31')]=_['keys'](db['VtigerField'][_0x3231('0x2e')]);_0x45f7cc[_0x3231('0x32')]=_[_0x3231('0x33')](_0x281527['query']);_0x45f7cc[_0x3231('0x34')]=_[_0x3231('0x35')](_0x45f7cc[_0x3231('0x31')],_0x45f7cc[_0x3231('0x32')]);_0xb37162[_0x3231('0x36')]=_['intersection'](_0x45f7cc[_0x3231('0x31')],qs[_0x3231('0x37')](_0x281527[_0x3231('0x32')][_0x3231('0x37')]));_0xb37162[_0x3231('0x36')]=_0xb37162[_0x3231('0x36')][_0x3231('0x45')]?_0xb37162[_0x3231('0x36')]:_0x45f7cc[_0x3231('0x31')];_0xb37162[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x281527['query'][_0x3231('0x4a')]);_0xb37162['where']=qs[_0x3231('0x34')](_[_0x3231('0x3b')](_0x281527[_0x3231('0x32')],_0x45f7cc[_0x3231('0x34')]));if(_0x281527[_0x3231('0x32')]['filter']){_0xb37162[_0x3231('0x3a')]=_['merge'](_0xb37162[_0x3231('0x3a')],{'$or':_['map'](_0xb37162[_0x3231('0x36')],function(_0x4e9719){var _0x26c8c1={};_0x26c8c1[_0x4e9719]={'$like':'%'+_0x281527[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x26c8c1;})});}_0xb37162=_[_0x3231('0x3c')]({},_0xb37162,_0x281527[_0x3231('0x3d')]);return _0x470b32[_0x3231('0x4e')](_0xb37162);}})['then'](function(_0x447a84){if(_0x447a84){_0x1a06b2=_0x447a84['length'];if(!_0x281527[_0x3231('0x32')][_0x3231('0x38')](_0x3231('0x4c'))){_0xb37162[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x281527[_0x3231('0x32')][_0x3231('0x1f')]);_0xb37162[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x281527['query'][_0x3231('0x1d')]);}return _0x470b32[_0x3231('0x4e')](_0xb37162);}})[_0x3231('0x26')](function(_0x362df6){if(_0x362df6){return _0x362df6?{'count':_0x1a06b2,'rows':_0x362df6}:null;}})['then'](respondWithResult(_0x2eb8a2,null))[_0x3231('0x42')](handleError(_0x2eb8a2,null));};exports[_0x3231('0x4f')]=function(_0x3b69d6,_0x56a944,_0x1f83b9){var _0x35f464={};var _0x19034f={};var _0x302ea8;var _0x2aa2e7;return db[_0x3231('0x40')][_0x3231('0x49')]({'where':{'id':_0x3b69d6[_0x3231('0x44')]['id']}})[_0x3231('0x26')](handleEntityNotFound(_0x56a944,null))['then'](function(_0x161304){if(_0x161304){_0x302ea8=_0x161304;_0x19034f[_0x3231('0x31')]=_['keys'](db[_0x3231('0x50')][_0x3231('0x2e')]);_0x19034f[_0x3231('0x32')]=_[_0x3231('0x33')](_0x3b69d6['query']);_0x19034f[_0x3231('0x34')]=_[_0x3231('0x35')](_0x19034f[_0x3231('0x31')],_0x19034f['query']);_0x35f464[_0x3231('0x36')]=_['intersection'](_0x19034f[_0x3231('0x31')],qs['fields'](_0x3b69d6[_0x3231('0x32')][_0x3231('0x37')]));_0x35f464[_0x3231('0x36')]=_0x35f464[_0x3231('0x36')][_0x3231('0x45')]?_0x35f464[_0x3231('0x36')]:_0x19034f[_0x3231('0x31')];_0x35f464[_0x3231('0x39')]=qs[_0x3231('0x4a')](_0x3b69d6['query'][_0x3231('0x4a')]);_0x35f464['where']=qs['filters'](_[_0x3231('0x3b')](_0x3b69d6[_0x3231('0x32')],_0x19034f[_0x3231('0x34')]));if(_0x3b69d6[_0x3231('0x32')]['filter']){_0x35f464[_0x3231('0x3a')]=_[_0x3231('0x3c')](_0x35f464[_0x3231('0x3a')],{'$or':_[_0x3231('0x2d')](_0x35f464['attributes'],function(_0x5267ea){var _0x440a03={};_0x440a03[_0x5267ea]={'$like':'%'+_0x3b69d6[_0x3231('0x32')][_0x3231('0x4b')]+'%'};return _0x440a03;})});}_0x35f464=_[_0x3231('0x3c')]({},_0x35f464,_0x3b69d6['options']);return _0x302ea8['getDescriptions'](_0x35f464);}})['then'](function(_0x2105ef){if(_0x2105ef){_0x2aa2e7=_0x2105ef['length'];if(!_0x3b69d6[_0x3231('0x32')][_0x3231('0x38')]('nolimit')){_0x35f464[_0x3231('0x1f')]=qs[_0x3231('0x1f')](_0x3b69d6[_0x3231('0x32')][_0x3231('0x1f')]);_0x35f464[_0x3231('0x1d')]=qs[_0x3231('0x1d')](_0x3b69d6['query']['offset']);}return _0x302ea8['getDescriptions'](_0x35f464);}})[_0x3231('0x26')](function(_0x34d74d){if(_0x34d74d){return _0x34d74d?{'count':_0x2aa2e7,'rows':_0x34d74d}:null;}})[_0x3231('0x26')](respondWithResult(_0x56a944,null))[_0x3231('0x42')](handleError(_0x56a944,null));}; \ No newline at end of file +var _0xd71e=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','include','findAll','catch','show','includeAll','options','find','create','body','params','getFields','findOne','VtigerField','pick','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','sendStatus','error','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd71e,0x6c));var _0xed71=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xd71e[_0x2601b4];return _0x3e3661;};'use strict';var emlformat=require(_0xed71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed71('0x1'));var rp=require(_0xed71('0x2'));var moment=require(_0xed71('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed71('0x4'));var util=require(_0xed71('0x5'));var path=require(_0xed71('0x6'));var sox=require(_0xed71('0x7'));var csv=require(_0xed71('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed71('0x9'));var crypto=require(_0xed71('0xa'));var jsforce=require(_0xed71('0xb'));var deskjs=require(_0xed71('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed71('0xd'));var Papa=require(_0xed71('0xe'));var Redis=require(_0xed71('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed71('0x10'));var hardwareService=require(_0xed71('0x11'));var logger=require(_0xed71('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xed71('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b399e,_0x112467){_0x112467=_0x112467||0xcc;return function(_0x3c872c){if(_0x3c872c){return _0x1b399e['sendStatus'](_0x112467);}return _0x1b399e[_0xed71('0x14')](_0x112467)['end']();};}function respondWithResult(_0x1ee48c,_0x1abfb5){_0x1abfb5=_0x1abfb5||0xc8;return function(_0x368fdd){if(_0x368fdd){return _0x1ee48c['status'](_0x1abfb5)[_0xed71('0x15')](_0x368fdd);}};}function respondWithFilteredResult(_0x12dcc5,_0x34a407){return function(_0x1f6820){if(_0x1f6820){var _0x24dbd8=typeof _0x34a407[_0xed71('0x16')]===_0xed71('0x17')&&typeof _0x34a407['limit']===_0xed71('0x17');var _0xeb35a7=_0x1f6820[_0xed71('0x18')];var _0x3735a4=_0x24dbd8?0x0:_0x34a407[_0xed71('0x16')];var _0x5a5530=_0x24dbd8?_0x1f6820[_0xed71('0x18')]:_0x34a407['offset']+_0x34a407['limit'];var _0xa7594a;if(_0x5a5530>=_0xeb35a7){_0x5a5530=_0xeb35a7;_0xa7594a=0xc8;}else{_0xa7594a=0xce;}_0x12dcc5[_0xed71('0x14')](_0xa7594a);return _0x12dcc5[_0xed71('0x19')](_0xed71('0x1a'),_0x3735a4+'-'+_0x5a5530+'/'+_0xeb35a7)[_0xed71('0x15')](_0x1f6820);}return null;};}function patchUpdates(_0x172fba){return function(_0x46e1f3){try{jsonpatch['apply'](_0x46e1f3,_0x172fba,!![]);}catch(_0x1115d1){return BPromise['reject'](_0x1115d1);}return _0x46e1f3[_0xed71('0x1b')]();};}function saveUpdates(_0x5a1d7e,_0x4b75ba){return function(_0x594018){if(_0x594018){return _0x594018[_0xed71('0x1c')](_0x5a1d7e)[_0xed71('0x1d')](function(_0x959efd){return _0x959efd;});}return null;};}function removeEntity(_0x35c432,_0x59bf57){return function(_0x4923f8){if(_0x4923f8){return _0x4923f8[_0xed71('0x1e')]()[_0xed71('0x1d')](function(){_0x35c432[_0xed71('0x14')](0xcc)[_0xed71('0x1f')]();});}};}function handleEntityNotFound(_0x538ee2,_0x430c07){return function(_0x7fd3ed){if(!_0x7fd3ed){_0x538ee2[_0xed71('0x20')](0x194);}return _0x7fd3ed;};}function handleError(_0x2104f9,_0x465d3d){_0x465d3d=_0x465d3d||0x1f4;return function(_0x1013a3){logger[_0xed71('0x21')](_0x1013a3['stack']);if(_0x1013a3[_0xed71('0x22')]){delete _0x1013a3[_0xed71('0x22')];}_0x2104f9[_0xed71('0x14')](_0x465d3d)[_0xed71('0x23')](_0x1013a3);};}exports[_0xed71('0x24')]=function(_0x4a60c0,_0x321706){var _0x2912d1={},_0x17cd9f={},_0x10af70={'count':0x0,'rows':[]};var _0x2dbaad=_['map'](db[_0xed71('0x25')][_0xed71('0x26')],function(_0x490bc6){return{'name':_0x490bc6[_0xed71('0x27')],'type':_0x490bc6[_0xed71('0x28')][_0xed71('0x29')]};});_0x17cd9f[_0xed71('0x2a')]=_[_0xed71('0x2b')](_0x2dbaad,_0xed71('0x22'));_0x17cd9f[_0xed71('0x2c')]=_[_0xed71('0x2d')](_0x4a60c0[_0xed71('0x2c')]);_0x17cd9f[_0xed71('0x2e')]=_[_0xed71('0x2f')](_0x17cd9f[_0xed71('0x2a')],_0x17cd9f['query']);_0x2912d1['attributes']=_[_0xed71('0x2f')](_0x17cd9f[_0xed71('0x2a')],qs[_0xed71('0x30')](_0x4a60c0['query'][_0xed71('0x30')]));_0x2912d1[_0xed71('0x31')]=_0x2912d1[_0xed71('0x31')][_0xed71('0x32')]?_0x2912d1[_0xed71('0x31')]:_0x17cd9f[_0xed71('0x2a')];if(!_0x4a60c0['query'][_0xed71('0x33')](_0xed71('0x34'))){_0x2912d1[_0xed71('0x35')]=qs['limit'](_0x4a60c0[_0xed71('0x2c')]['limit']);_0x2912d1[_0xed71('0x16')]=qs[_0xed71('0x16')](_0x4a60c0[_0xed71('0x2c')]['offset']);}_0x2912d1[_0xed71('0x36')]=qs['sort'](_0x4a60c0[_0xed71('0x2c')][_0xed71('0x37')]);_0x2912d1[_0xed71('0x38')]=qs['filters'](_['pick'](_0x4a60c0[_0xed71('0x2c')],_0x17cd9f[_0xed71('0x2e')]),_0x2dbaad);if(_0x4a60c0['query']['filter']){_0x2912d1[_0xed71('0x38')]=_[_0xed71('0x39')](_0x2912d1[_0xed71('0x38')],{'$or':_['map'](_0x2dbaad,function(_0x131aba){if(_0x131aba[_0xed71('0x28')]!==_0xed71('0x3a')){var _0x2a02f0={};_0x2a02f0[_0x131aba[_0xed71('0x22')]]={'$like':'%'+_0x4a60c0[_0xed71('0x2c')][_0xed71('0x3b')]+'%'};return _0x2a02f0;}})});}_0x2912d1=_['merge']({},_0x2912d1,_0x4a60c0['options']);var _0x2c3ce1={'where':_0x2912d1[_0xed71('0x38')]};return db[_0xed71('0x25')][_0xed71('0x18')](_0x2c3ce1)['then'](function(_0x259675){_0x10af70['count']=_0x259675;if(_0x4a60c0[_0xed71('0x2c')]['includeAll']){_0x2912d1[_0xed71('0x3c')]=[{'all':!![]}];}return db[_0xed71('0x25')][_0xed71('0x3d')](_0x2912d1);})[_0xed71('0x1d')](function(_0x362fe0){_0x10af70['rows']=_0x362fe0;return _0x10af70;})['then'](respondWithFilteredResult(_0x321706,_0x2912d1))[_0xed71('0x3e')](handleError(_0x321706,null));};exports[_0xed71('0x3f')]=function(_0x19a76e,_0x520c9c){var _0xbe4021={'raw':![],'where':{'id':_0x19a76e['params']['id']}},_0x296b6e={};_0x296b6e[_0xed71('0x2a')]=_[_0xed71('0x2d')](db[_0xed71('0x25')][_0xed71('0x26')]);_0x296b6e[_0xed71('0x2c')]=_[_0xed71('0x2d')](_0x19a76e['query']);_0x296b6e[_0xed71('0x2e')]=_[_0xed71('0x2f')](_0x296b6e[_0xed71('0x2a')],_0x296b6e[_0xed71('0x2c')]);_0xbe4021[_0xed71('0x31')]=_[_0xed71('0x2f')](_0x296b6e[_0xed71('0x2a')],qs[_0xed71('0x30')](_0x19a76e[_0xed71('0x2c')]['fields']));_0xbe4021[_0xed71('0x31')]=_0xbe4021[_0xed71('0x31')][_0xed71('0x32')]?_0xbe4021[_0xed71('0x31')]:_0x296b6e['model'];if(_0x19a76e[_0xed71('0x2c')][_0xed71('0x40')]){_0xbe4021[_0xed71('0x3c')]=[{'all':!![]}];}_0xbe4021=_[_0xed71('0x39')]({},_0xbe4021,_0x19a76e[_0xed71('0x41')]);return db[_0xed71('0x25')][_0xed71('0x42')](_0xbe4021)[_0xed71('0x1d')](handleEntityNotFound(_0x520c9c,null))['then'](respondWithResult(_0x520c9c,null))[_0xed71('0x3e')](handleError(_0x520c9c,null));};exports[_0xed71('0x43')]=function(_0x183878,_0x5455b1){return db[_0xed71('0x25')][_0xed71('0x43')](_0x183878['body'],{})['then'](respondWithResult(_0x5455b1,0xc9))[_0xed71('0x3e')](handleError(_0x5455b1,null));};exports[_0xed71('0x1c')]=function(_0x4e2771,_0x16cbf3){if(_0x4e2771[_0xed71('0x44')]['id']){delete _0x4e2771[_0xed71('0x44')]['id'];}return db[_0xed71('0x25')][_0xed71('0x42')]({'where':{'id':_0x4e2771[_0xed71('0x45')]['id']}})[_0xed71('0x1d')](handleEntityNotFound(_0x16cbf3,null))['then'](saveUpdates(_0x4e2771['body'],null))['then'](respondWithResult(_0x16cbf3,null))[_0xed71('0x3e')](handleError(_0x16cbf3,null));};exports[_0xed71('0x1e')]=function(_0x314ef7,_0x1d331c){return db[_0xed71('0x25')][_0xed71('0x42')]({'where':{'id':_0x314ef7['params']['id']}})[_0xed71('0x1d')](handleEntityNotFound(_0x1d331c,null))[_0xed71('0x1d')](removeEntity(_0x1d331c,null))[_0xed71('0x3e')](handleError(_0x1d331c,null));};exports[_0xed71('0x46')]=function(_0x5ce638,_0xac15c3,_0x5a6aca){var _0x5a8ff1={};var _0x4d7d56={};var _0x4433d4;var _0x1b0c5c;return db[_0xed71('0x25')][_0xed71('0x47')]({'where':{'id':_0x5ce638[_0xed71('0x45')]['id']}})[_0xed71('0x1d')](handleEntityNotFound(_0xac15c3,null))[_0xed71('0x1d')](function(_0x12ceae){if(_0x12ceae){_0x4433d4=_0x12ceae;_0x4d7d56[_0xed71('0x2a')]=_[_0xed71('0x2d')](db[_0xed71('0x48')]['rawAttributes']);_0x4d7d56[_0xed71('0x2c')]=_[_0xed71('0x2d')](_0x5ce638[_0xed71('0x2c')]);_0x4d7d56[_0xed71('0x2e')]=_[_0xed71('0x2f')](_0x4d7d56[_0xed71('0x2a')],_0x4d7d56['query']);_0x5a8ff1[_0xed71('0x31')]=_[_0xed71('0x2f')](_0x4d7d56[_0xed71('0x2a')],qs[_0xed71('0x30')](_0x5ce638[_0xed71('0x2c')]['fields']));_0x5a8ff1[_0xed71('0x31')]=_0x5a8ff1[_0xed71('0x31')][_0xed71('0x32')]?_0x5a8ff1[_0xed71('0x31')]:_0x4d7d56[_0xed71('0x2a')];_0x5a8ff1[_0xed71('0x36')]=qs[_0xed71('0x37')](_0x5ce638[_0xed71('0x2c')]['sort']);_0x5a8ff1[_0xed71('0x38')]=qs[_0xed71('0x2e')](_[_0xed71('0x49')](_0x5ce638[_0xed71('0x2c')],_0x4d7d56[_0xed71('0x2e')]));if(_0x5ce638[_0xed71('0x2c')][_0xed71('0x3b')]){_0x5a8ff1[_0xed71('0x38')]=_[_0xed71('0x39')](_0x5a8ff1[_0xed71('0x38')],{'$or':_[_0xed71('0x2b')](_0x5a8ff1[_0xed71('0x31')],function(_0x334b12){var _0x347d5c={};_0x347d5c[_0x334b12]={'$like':'%'+_0x5ce638[_0xed71('0x2c')]['filter']+'%'};return _0x347d5c;})});}_0x5a8ff1=_[_0xed71('0x39')]({},_0x5a8ff1,_0x5ce638[_0xed71('0x41')]);return _0x4433d4[_0xed71('0x46')](_0x5a8ff1);}})[_0xed71('0x1d')](function(_0x1c4e8f){if(_0x1c4e8f){_0x1b0c5c=_0x1c4e8f['length'];if(!_0x5ce638['query'][_0xed71('0x33')]('nolimit')){_0x5a8ff1[_0xed71('0x35')]=qs[_0xed71('0x35')](_0x5ce638[_0xed71('0x2c')][_0xed71('0x35')]);_0x5a8ff1['offset']=qs[_0xed71('0x16')](_0x5ce638[_0xed71('0x2c')][_0xed71('0x16')]);}return _0x4433d4['getFields'](_0x5a8ff1);}})[_0xed71('0x1d')](function(_0x4d465d){if(_0x4d465d){return _0x4d465d?{'count':_0x1b0c5c,'rows':_0x4d465d}:null;}})['then'](respondWithResult(_0xac15c3,null))['catch'](handleError(_0xac15c3,null));};exports[_0xed71('0x4a')]=function(_0x5e1c0b,_0x5dee54,_0x2e9e66){var _0x41622a={};var _0xb8ad30={};var _0x7f1706;var _0x37d444;return db[_0xed71('0x25')][_0xed71('0x47')]({'where':{'id':_0x5e1c0b['params']['id']}})[_0xed71('0x1d')](handleEntityNotFound(_0x5dee54,null))[_0xed71('0x1d')](function(_0xaeb310){if(_0xaeb310){_0x7f1706=_0xaeb310;_0xb8ad30[_0xed71('0x2a')]=_[_0xed71('0x2d')](db['VtigerField'][_0xed71('0x26')]);_0xb8ad30['query']=_[_0xed71('0x2d')](_0x5e1c0b['query']);_0xb8ad30['filters']=_[_0xed71('0x2f')](_0xb8ad30[_0xed71('0x2a')],_0xb8ad30[_0xed71('0x2c')]);_0x41622a['attributes']=_['intersection'](_0xb8ad30[_0xed71('0x2a')],qs[_0xed71('0x30')](_0x5e1c0b[_0xed71('0x2c')][_0xed71('0x30')]));_0x41622a[_0xed71('0x31')]=_0x41622a['attributes']['length']?_0x41622a['attributes']:_0xb8ad30[_0xed71('0x2a')];_0x41622a[_0xed71('0x36')]=qs['sort'](_0x5e1c0b[_0xed71('0x2c')][_0xed71('0x37')]);_0x41622a[_0xed71('0x38')]=qs[_0xed71('0x2e')](_[_0xed71('0x49')](_0x5e1c0b[_0xed71('0x2c')],_0xb8ad30[_0xed71('0x2e')]));if(_0x5e1c0b[_0xed71('0x2c')][_0xed71('0x3b')]){_0x41622a[_0xed71('0x38')]=_[_0xed71('0x39')](_0x41622a['where'],{'$or':_[_0xed71('0x2b')](_0x41622a['attributes'],function(_0x210ea7){var _0x3bbcc2={};_0x3bbcc2[_0x210ea7]={'$like':'%'+_0x5e1c0b['query'][_0xed71('0x3b')]+'%'};return _0x3bbcc2;})});}_0x41622a=_[_0xed71('0x39')]({},_0x41622a,_0x5e1c0b[_0xed71('0x41')]);return _0x7f1706['getSubjects'](_0x41622a);}})[_0xed71('0x1d')](function(_0x50f7ae){if(_0x50f7ae){_0x37d444=_0x50f7ae[_0xed71('0x32')];if(!_0x5e1c0b[_0xed71('0x2c')][_0xed71('0x33')]('nolimit')){_0x41622a[_0xed71('0x35')]=qs[_0xed71('0x35')](_0x5e1c0b[_0xed71('0x2c')][_0xed71('0x35')]);_0x41622a[_0xed71('0x16')]=qs['offset'](_0x5e1c0b['query']['offset']);}return _0x7f1706[_0xed71('0x4a')](_0x41622a);}})[_0xed71('0x1d')](function(_0x3a64b8){if(_0x3a64b8){return _0x3a64b8?{'count':_0x37d444,'rows':_0x3a64b8}:null;}})[_0xed71('0x1d')](respondWithResult(_0x5dee54,null))[_0xed71('0x3e')](handleError(_0x5dee54,null));};exports[_0xed71('0x4b')]=function(_0xffdf86,_0x1ab88b,_0x322fe5){var _0x231e82={};var _0xb20090={};var _0x566a3f;var _0x38ae18;return db[_0xed71('0x25')][_0xed71('0x47')]({'where':{'id':_0xffdf86['params']['id']}})['then'](handleEntityNotFound(_0x1ab88b,null))[_0xed71('0x1d')](function(_0x3ac85d){if(_0x3ac85d){_0x566a3f=_0x3ac85d;_0xb20090['model']=_['keys'](db['VtigerField'][_0xed71('0x26')]);_0xb20090[_0xed71('0x2c')]=_[_0xed71('0x2d')](_0xffdf86[_0xed71('0x2c')]);_0xb20090['filters']=_[_0xed71('0x2f')](_0xb20090[_0xed71('0x2a')],_0xb20090[_0xed71('0x2c')]);_0x231e82[_0xed71('0x31')]=_[_0xed71('0x2f')](_0xb20090['model'],qs[_0xed71('0x30')](_0xffdf86['query'][_0xed71('0x30')]));_0x231e82[_0xed71('0x31')]=_0x231e82[_0xed71('0x31')][_0xed71('0x32')]?_0x231e82[_0xed71('0x31')]:_0xb20090[_0xed71('0x2a')];_0x231e82[_0xed71('0x36')]=qs[_0xed71('0x37')](_0xffdf86[_0xed71('0x2c')][_0xed71('0x37')]);_0x231e82[_0xed71('0x38')]=qs[_0xed71('0x2e')](_['pick'](_0xffdf86[_0xed71('0x2c')],_0xb20090[_0xed71('0x2e')]));if(_0xffdf86[_0xed71('0x2c')][_0xed71('0x3b')]){_0x231e82['where']=_[_0xed71('0x39')](_0x231e82[_0xed71('0x38')],{'$or':_[_0xed71('0x2b')](_0x231e82[_0xed71('0x31')],function(_0x553b0b){var _0x7f0401={};_0x7f0401[_0x553b0b]={'$like':'%'+_0xffdf86[_0xed71('0x2c')]['filter']+'%'};return _0x7f0401;})});}_0x231e82=_[_0xed71('0x39')]({},_0x231e82,_0xffdf86[_0xed71('0x41')]);return _0x566a3f[_0xed71('0x4b')](_0x231e82);}})[_0xed71('0x1d')](function(_0x2dad2f){if(_0x2dad2f){_0x38ae18=_0x2dad2f[_0xed71('0x32')];if(!_0xffdf86[_0xed71('0x2c')][_0xed71('0x33')](_0xed71('0x34'))){_0x231e82[_0xed71('0x35')]=qs[_0xed71('0x35')](_0xffdf86[_0xed71('0x2c')][_0xed71('0x35')]);_0x231e82[_0xed71('0x16')]=qs[_0xed71('0x16')](_0xffdf86[_0xed71('0x2c')]['offset']);}return _0x566a3f['getDescriptions'](_0x231e82);}})[_0xed71('0x1d')](function(_0x2ba155){if(_0x2ba155){return _0x2ba155?{'count':_0x38ae18,'rows':_0x2ba155}:null;}})[_0xed71('0x1d')](respondWithResult(_0x1ab88b,null))[_0xed71('0x3e')](handleError(_0x1ab88b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 7ae4870..e48c8dd 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ad8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','util','../../config/logger','api'];(function(_0x4ecf10,_0x1f6ea7){var _0x2e737b=function(_0x35dc90){while(--_0x35dc90){_0x4ecf10['push'](_0x4ecf10['shift']());}};_0x2e737b(++_0x1f6ea7);}(_0x9ad8,0x16e));var _0x89ad=function(_0x36e4dc,_0x4cc695){_0x36e4dc=_0x36e4dc-0x0;var _0x303297=_0x9ad8[_0x36e4dc];return _0x303297;};'use strict';var _=require('lodash');var util=require(_0x89ad('0x0'));var logger=require(_0x89ad('0x1'))(_0x89ad('0x2'));var moment=require(_0x89ad('0x3'));var BPromise=require(_0x89ad('0x4'));var rp=require(_0x89ad('0x5'));var fs=require('fs');var path=require(_0x89ad('0x6'));var rimraf=require(_0x89ad('0x7'));var config=require(_0x89ad('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x4839eb,_0x2862bd){return _0x4839eb['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8774=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c27d,_0x2b98f9){var _0x404a7d=function(_0x4b3f19){while(--_0x4b3f19){_0x2c27d['push'](_0x2c27d['shift']());}};_0x404a7d(++_0x2b98f9);}(_0x8774,0x94));var _0x4877=function(_0x359517,_0x27928d){_0x359517=_0x359517-0x0;var _0x5ed466=_0x8774[_0x359517];return _0x5ed466;};'use strict';var _=require(_0x4877('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4877('0x1'));var moment=require(_0x4877('0x2'));var BPromise=require(_0x4877('0x3'));var rp=require(_0x4877('0x4'));var fs=require('fs');var path=require(_0x4877('0x5'));var rimraf=require(_0x4877('0x6'));var config=require(_0x4877('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x4877('0x8')]=function(_0x238a07,_0x8bffd9){return _0x238a07[_0x4877('0x9')](_0x4877('0xa'),attributes,{'tableName':_0x4877('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 7d99140..9a5f14d 100644 --- a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js +++ b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f2f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerConfiguration,\x20%s,\x20%s','info','result','catch','util','moment'];(function(_0x37bc10,_0x528f6f){var _0x10fff1=function(_0x295057){while(--_0x295057){_0x37bc10['push'](_0x37bc10['shift']());}};_0x10fff1(++_0x528f6f);}(_0x2f2f,0x1a0));var _0xf2f2=function(_0xdc5855,_0x356a7f){_0xdc5855=_0xdc5855-0x0;var _0x4996fd=_0x2f2f[_0xdc5855];return _0x4996fd;};'use strict';var _=require('lodash');var util=require(_0xf2f2('0x0'));var moment=require(_0xf2f2('0x1'));var BPromise=require(_0xf2f2('0x2'));var rs=require(_0xf2f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2f2('0x4'))['db'];var utils=require(_0xf2f2('0x5'));var logger=require(_0xf2f2('0x6'))(_0xf2f2('0x7'));var config=require(_0xf2f2('0x8'));var jayson=require(_0xf2f2('0x9'));var client=jayson[_0xf2f2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2194c6,_0xf143f8,_0x3efc71){return new BPromise(function(_0x25edaa,_0x43668a){return client['request'](_0x2194c6,_0x3efc71)[_0xf2f2('0xb')](function(_0x12796a){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0xf143f8,_0xf2f2('0xc'));logger[_0xf2f2('0xd')](_0xf2f2('0xe'),_0xf143f8,'request\x20sent',JSON[_0xf2f2('0xf')](_0x12796a));if(_0x12796a[_0xf2f2('0x10')]){if(_0x12796a[_0xf2f2('0x10')]['code']===0x1f4){logger[_0xf2f2('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0xf143f8,_0x12796a['error']['message']);return _0x43668a(_0x12796a['error'][_0xf2f2('0x11')]);}logger[_0xf2f2('0x10')](_0xf2f2('0x12'),_0xf143f8,_0x12796a[_0xf2f2('0x10')][_0xf2f2('0x11')]);return _0x25edaa(_0x12796a[_0xf2f2('0x10')][_0xf2f2('0x11')]);}else{logger[_0xf2f2('0x13')](_0xf2f2('0x12'),_0xf143f8,_0xf2f2('0xc'));_0x25edaa(_0x12796a[_0xf2f2('0x14')]['message']);}})[_0xf2f2('0x15')](function(_0xd44aa){logger[_0xf2f2('0x10')](_0xf2f2('0x12'),_0xf143f8,_0xd44aa);_0x43668a(_0xd44aa);});});} \ No newline at end of file +var _0x57c8=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x3a5f7d,_0xb88c50){var _0x176b5a=function(_0xda6a1b){while(--_0xda6a1b){_0x3a5f7d['push'](_0x3a5f7d['shift']());}};_0x176b5a(++_0xb88c50);}(_0x57c8,0x170));var _0x857c=function(_0x230e55,_0x599ffc){_0x230e55=_0x230e55-0x0;var _0x5d8d24=_0x57c8[_0x230e55];return _0x5d8d24;};'use strict';var _=require(_0x857c('0x0'));var util=require('util');var moment=require(_0x857c('0x1'));var BPromise=require(_0x857c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x857c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x857c('0x4'));var logger=require(_0x857c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x857c('0x6'));var client=jayson[_0x857c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257507,_0x127ce2,_0x48956c){return new BPromise(function(_0x4ab396,_0x5cb246){return client[_0x857c('0x8')](_0x257507,_0x48956c)[_0x857c('0x9')](function(_0x5639d8){logger[_0x857c('0xa')](_0x857c('0xb'),_0x127ce2,'request\x20sent');logger['debug'](_0x857c('0xc'),_0x127ce2,_0x857c('0xd'),JSON[_0x857c('0xe')](_0x5639d8));if(_0x5639d8[_0x857c('0xf')]){if(_0x5639d8[_0x857c('0xf')]['code']===0x1f4){logger[_0x857c('0xf')](_0x857c('0xb'),_0x127ce2,_0x5639d8[_0x857c('0xf')][_0x857c('0x10')]);return _0x5cb246(_0x5639d8[_0x857c('0xf')][_0x857c('0x10')]);}logger[_0x857c('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x127ce2,_0x5639d8[_0x857c('0xf')][_0x857c('0x10')]);return _0x4ab396(_0x5639d8['error']['message']);}else{logger[_0x857c('0xa')](_0x857c('0xb'),_0x127ce2,_0x857c('0xd'));_0x4ab396(_0x5639d8[_0x857c('0x11')][_0x857c('0x10')]);}})[_0x857c('0x12')](function(_0x500ac8){logger['error'](_0x857c('0xb'),_0x127ce2,_0x500ac8);_0x5cb246(_0x500ac8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6a9f301..4bd4974 100644 --- a/server/api/intVtigerField/index.js +++ b/server/api/intVtigerField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1758=['update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','post','create','put'];(function(_0x464f02,_0x42ceb3){var _0x1491be=function(_0x3159fe){while(--_0x3159fe){_0x464f02['push'](_0x464f02['shift']());}};_0x1491be(++_0x42ceb3);}(_0x1758,0x10f));var _0x8175=function(_0x438051,_0x40d9cd){_0x438051=_0x438051-0x0;var _0x4e0f75=_0x1758[_0x438051];return _0x4e0f75;};'use strict';var multer=require(_0x8175('0x0'));var util=require(_0x8175('0x1'));var path=require(_0x8175('0x2'));var timeout=require('connect-timeout');var express=require(_0x8175('0x3'));var router=express[_0x8175('0x4')]();var fs_extra=require(_0x8175('0x5'));var auth=require(_0x8175('0x6'));var interaction=require(_0x8175('0x7'));var config=require(_0x8175('0x8'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x8175('0x9')](),controller['index']);router['get']('/:id',auth[_0x8175('0x9')](),controller[_0x8175('0xa')]);router[_0x8175('0xb')]('/',auth[_0x8175('0x9')](),controller[_0x8175('0xc')]);router[_0x8175('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8175('0xe')]);router[_0x8175('0xf')](_0x8175('0x10'),auth[_0x8175('0x9')](),controller[_0x8175('0x11')]);module[_0x8175('0x12')]=router; \ No newline at end of file +var _0x05f2=['/:id','show','post','create','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get'];(function(_0x454312,_0x4f82d4){var _0x2a291a=function(_0x330368){while(--_0x330368){_0x454312['push'](_0x454312['shift']());}};_0x2a291a(++_0x4f82d4);}(_0x05f2,0x1a6));var _0x205f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x05f2[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x205f('0x0'));var util=require(_0x205f('0x1'));var path=require(_0x205f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x205f('0x3')]();var fs_extra=require(_0x205f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x205f('0x5'));var config=require(_0x205f('0x6'));var controller=require(_0x205f('0x7'));router['get']('/',auth[_0x205f('0x8')](),controller['index']);router[_0x205f('0x9')](_0x205f('0xa'),auth[_0x205f('0x8')](),controller[_0x205f('0xb')]);router[_0x205f('0xc')]('/',auth['isAuthenticated'](),controller[_0x205f('0xd')]);router[_0x205f('0xe')](_0x205f('0xa'),auth[_0x205f('0x8')](),controller[_0x205f('0xf')]);router[_0x205f('0x10')]('/:id',auth[_0x205f('0x8')](),controller['destroy']);module[_0x205f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d917f9e..a4d96cb 100644 --- a/server/api/intVtigerField/intVtigerField.attributes.js +++ b/server/api/intVtigerField/intVtigerField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5427=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','exports'];(function(_0x360ec3,_0x2d9166){var _0x2db7d1=function(_0x5817c8){while(--_0x5817c8){_0x360ec3['push'](_0x360ec3['shift']());}};_0x2db7d1(++_0x2d9166);}(_0x5427,0x1b7));var _0x7542=function(_0x4e43f8,_0x353fef){_0x4e43f8=_0x4e43f8-0x0;var _0xebaebd=_0x5427[_0x4e43f8];return _0xebaebd;};'use strict';var Sequelize=require('sequelize');module[_0x7542('0x0')]={'type':{'type':Sequelize[_0x7542('0x1')](_0x7542('0x2'),_0x7542('0x3'),_0x7542('0x4'),'keyValue',_0x7542('0x5')),'defaultValue':_0x7542('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7542('0x1')](_0x7542('0x2'),_0x7542('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x7542('0x6')]},'idField':{'type':Sequelize[_0x7542('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7542('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3498=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3ff84c,_0x74d220){var _0x237da8=function(_0x40c2be){while(--_0x40c2be){_0x3ff84c['push'](_0x3ff84c['shift']());}};_0x237da8(++_0x74d220);}(_0x3498,0x121));var _0x8349=function(_0x57fca6,_0x497213){_0x57fca6=_0x57fca6-0x0;var _0x1f2800=_0x3498[_0x57fca6];return _0x1f2800;};'use strict';var Sequelize=require(_0x8349('0x0'));module[_0x8349('0x1')]={'type':{'type':Sequelize[_0x8349('0x2')](_0x8349('0x3'),_0x8349('0x4'),_0x8349('0x5'),_0x8349('0x6'),'picklist'),'defaultValue':_0x8349('0x3')},'content':{'type':Sequelize[_0x8349('0x7')]},'key':{'type':Sequelize[_0x8349('0x7')]},'keyType':{'type':Sequelize[_0x8349('0x2')](_0x8349('0x3'),_0x8349('0x4'),_0x8349('0x5'))},'keyContent':{'type':Sequelize[_0x8349('0x7')]},'idField':{'type':Sequelize[_0x8349('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8349('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8349('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 47e1e26..1f3f33a 100644 --- a/server/api/intVtigerField/intVtigerField.controller.js +++ b/server/api/intVtigerField/intVtigerField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ac3=['set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','findAll','show','params','includeAll','options','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count'];(function(_0x1c3205,_0x264f4c){var _0x1abf87=function(_0x151e8d){while(--_0x151e8d){_0x1c3205['push'](_0x1c3205['shift']());}};_0x1abf87(++_0x264f4c);}(_0x3ac3,0x155));var _0x33ac=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x3ac3[_0x174ef5];return _0x1cc379;};'use strict';var emlformat=require(_0x33ac('0x0'));var rimraf=require(_0x33ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33ac('0x2'));var rp=require(_0x33ac('0x3'));var moment=require(_0x33ac('0x4'));var BPromise=require(_0x33ac('0x5'));var Mustache=require('mustache');var util=require(_0x33ac('0x6'));var path=require(_0x33ac('0x7'));var sox=require('sox');var csv=require(_0x33ac('0x8'));var ejs=require(_0x33ac('0x9'));var fs=require('fs');var fs_extra=require(_0x33ac('0xa'));var _=require('lodash');var squel=require(_0x33ac('0xb'));var crypto=require('crypto');var jsforce=require(_0x33ac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33ac('0x8'));var querystring=require(_0x33ac('0xd'));var Papa=require(_0x33ac('0xe'));var Redis=require(_0x33ac('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33ac('0x10'));var as=require(_0x33ac('0x11'));var hardwareService=require(_0x33ac('0x12'));var logger=require(_0x33ac('0x13'))(_0x33ac('0x14'));var utils=require(_0x33ac('0x15'));var config=require(_0x33ac('0x16'));var licenseUtil=require(_0x33ac('0x17'));var db=require(_0x33ac('0x18'))['db'];function respondWithStatusCode(_0x2976fb,_0x1814c4){_0x1814c4=_0x1814c4||0xcc;return function(_0x290551){if(_0x290551){return _0x2976fb[_0x33ac('0x19')](_0x1814c4);}return _0x2976fb[_0x33ac('0x1a')](_0x1814c4)['end']();};}function respondWithResult(_0x53a94f,_0x2cd1f4){_0x2cd1f4=_0x2cd1f4||0xc8;return function(_0x46a5cb){if(_0x46a5cb){return _0x53a94f[_0x33ac('0x1a')](_0x2cd1f4)['json'](_0x46a5cb);}};}function respondWithFilteredResult(_0x3a31ef,_0x1b58b3){return function(_0x462a8){if(_0x462a8){var _0x1ea475=typeof _0x1b58b3[_0x33ac('0x1b')]==='undefined'&&typeof _0x1b58b3['limit']==='undefined';var _0x372170=_0x462a8[_0x33ac('0x1c')];var _0x3a435d=_0x1ea475?0x0:_0x1b58b3[_0x33ac('0x1b')];var _0x6e1f7b=_0x1ea475?_0x462a8[_0x33ac('0x1c')]:_0x1b58b3[_0x33ac('0x1b')]+_0x1b58b3['limit'];var _0x2e4b29;if(_0x6e1f7b>=_0x372170){_0x6e1f7b=_0x372170;_0x2e4b29=0xc8;}else{_0x2e4b29=0xce;}_0x3a31ef[_0x33ac('0x1a')](_0x2e4b29);return _0x3a31ef[_0x33ac('0x1d')]('Content-Range',_0x3a435d+'-'+_0x6e1f7b+'/'+_0x372170)[_0x33ac('0x1e')](_0x462a8);}return null;};}function patchUpdates(_0x533519){return function(_0x309785){try{jsonpatch[_0x33ac('0x1f')](_0x309785,_0x533519,!![]);}catch(_0x16c3a2){return BPromise[_0x33ac('0x20')](_0x16c3a2);}return _0x309785[_0x33ac('0x21')]();};}function saveUpdates(_0x303568,_0xab919){return function(_0x381d4d){if(_0x381d4d){return _0x381d4d[_0x33ac('0x22')](_0x303568)[_0x33ac('0x23')](function(_0x2e7da9){return _0x2e7da9;});}return null;};}function removeEntity(_0x2a97ff,_0x2ff36c){return function(_0x33b83e){if(_0x33b83e){return _0x33b83e['destroy']()[_0x33ac('0x23')](function(){_0x2a97ff['status'](0xcc)[_0x33ac('0x24')]();});}};}function handleEntityNotFound(_0x29aad1,_0x24855f){return function(_0x4ed4fd){if(!_0x4ed4fd){_0x29aad1[_0x33ac('0x19')](0x194);}return _0x4ed4fd;};}function handleError(_0x5d4c0a,_0x34114a){_0x34114a=_0x34114a||0x1f4;return function(_0x16087d){logger[_0x33ac('0x25')](_0x16087d[_0x33ac('0x26')]);if(_0x16087d[_0x33ac('0x27')]){delete _0x16087d['name'];}_0x5d4c0a[_0x33ac('0x1a')](_0x34114a)[_0x33ac('0x28')](_0x16087d);};}exports[_0x33ac('0x29')]=function(_0x204684,_0x1fe80d){var _0x179649={},_0xd45e6b={},_0x552a1d={'count':0x0,'rows':[]};var _0x42e971=_[_0x33ac('0x2a')](db[_0x33ac('0x2b')][_0x33ac('0x2c')],function(_0x151f17){return{'name':_0x151f17[_0x33ac('0x2d')],'type':_0x151f17['type'][_0x33ac('0x2e')]};});_0xd45e6b['model']=_[_0x33ac('0x2a')](_0x42e971,'name');_0xd45e6b[_0x33ac('0x2f')]=_[_0x33ac('0x30')](_0x204684['query']);_0xd45e6b['filters']=_[_0x33ac('0x31')](_0xd45e6b[_0x33ac('0x32')],_0xd45e6b['query']);_0x179649[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0xd45e6b[_0x33ac('0x32')],qs[_0x33ac('0x34')](_0x204684['query'][_0x33ac('0x34')]));_0x179649['attributes']=_0x179649[_0x33ac('0x33')][_0x33ac('0x35')]?_0x179649[_0x33ac('0x33')]:_0xd45e6b[_0x33ac('0x32')];if(!_0x204684['query'][_0x33ac('0x36')]('nolimit')){_0x179649[_0x33ac('0x37')]=qs[_0x33ac('0x37')](_0x204684['query'][_0x33ac('0x37')]);_0x179649[_0x33ac('0x1b')]=qs[_0x33ac('0x1b')](_0x204684[_0x33ac('0x2f')][_0x33ac('0x1b')]);}_0x179649[_0x33ac('0x38')]=qs[_0x33ac('0x39')](_0x204684['query'][_0x33ac('0x39')]);_0x179649[_0x33ac('0x3a')]=qs[_0x33ac('0x3b')](_['pick'](_0x204684['query'],_0xd45e6b[_0x33ac('0x3b')]),_0x42e971);if(_0x204684['query'][_0x33ac('0x3c')]){_0x179649[_0x33ac('0x3a')]=_[_0x33ac('0x3d')](_0x179649['where'],{'$or':_['map'](_0x42e971,function(_0x37284a){if(_0x37284a[_0x33ac('0x3e')]!==_0x33ac('0x3f')){var _0x40a0ef={};_0x40a0ef[_0x37284a['name']]={'$like':'%'+_0x204684['query']['filter']+'%'};return _0x40a0ef;}})});}_0x179649=_[_0x33ac('0x3d')]({},_0x179649,_0x204684['options']);var _0x219385={'where':_0x179649[_0x33ac('0x3a')]};return db['VtigerField'][_0x33ac('0x1c')](_0x219385)[_0x33ac('0x23')](function(_0x102d85){_0x552a1d[_0x33ac('0x1c')]=_0x102d85;if(_0x204684[_0x33ac('0x2f')]['includeAll']){_0x179649['include']=[{'all':!![]}];}return db[_0x33ac('0x2b')][_0x33ac('0x40')](_0x179649);})[_0x33ac('0x23')](function(_0x3cb77e){_0x552a1d['rows']=_0x3cb77e;return _0x552a1d;})['then'](respondWithFilteredResult(_0x1fe80d,_0x179649))['catch'](handleError(_0x1fe80d,null));};exports[_0x33ac('0x41')]=function(_0x55aa74,_0x2dd4a2){var _0x1aebf3={'raw':!![],'where':{'id':_0x55aa74[_0x33ac('0x42')]['id']}},_0x178a17={};_0x178a17['model']=_[_0x33ac('0x30')](db['VtigerField'][_0x33ac('0x2c')]);_0x178a17[_0x33ac('0x2f')]=_[_0x33ac('0x30')](_0x55aa74['query']);_0x178a17[_0x33ac('0x3b')]=_['intersection'](_0x178a17[_0x33ac('0x32')],_0x178a17[_0x33ac('0x2f')]);_0x1aebf3[_0x33ac('0x33')]=_[_0x33ac('0x31')](_0x178a17['model'],qs[_0x33ac('0x34')](_0x55aa74[_0x33ac('0x2f')][_0x33ac('0x34')]));_0x1aebf3['attributes']=_0x1aebf3[_0x33ac('0x33')][_0x33ac('0x35')]?_0x1aebf3[_0x33ac('0x33')]:_0x178a17[_0x33ac('0x32')];if(_0x55aa74['query'][_0x33ac('0x43')]){_0x1aebf3['include']=[{'all':!![]}];}_0x1aebf3=_[_0x33ac('0x3d')]({},_0x1aebf3,_0x55aa74[_0x33ac('0x44')]);return db[_0x33ac('0x2b')][_0x33ac('0x45')](_0x1aebf3)[_0x33ac('0x23')](handleEntityNotFound(_0x2dd4a2,null))['then'](respondWithResult(_0x2dd4a2,null))[_0x33ac('0x46')](handleError(_0x2dd4a2,null));};exports[_0x33ac('0x47')]=function(_0x19d5e1,_0x555130){return db['VtigerField'][_0x33ac('0x47')](_0x19d5e1[_0x33ac('0x48')],{})['then'](respondWithResult(_0x555130,0xc9))[_0x33ac('0x46')](handleError(_0x555130,null));};exports[_0x33ac('0x22')]=function(_0xc0b6a2,_0x3ea7c3){if(_0xc0b6a2[_0x33ac('0x48')]['id']){delete _0xc0b6a2['body']['id'];}return db[_0x33ac('0x2b')][_0x33ac('0x45')]({'where':{'id':_0xc0b6a2[_0x33ac('0x42')]['id']}})[_0x33ac('0x23')](handleEntityNotFound(_0x3ea7c3,null))['then'](saveUpdates(_0xc0b6a2[_0x33ac('0x48')],null))[_0x33ac('0x23')](respondWithResult(_0x3ea7c3,null))['catch'](handleError(_0x3ea7c3,null));};exports[_0x33ac('0x49')]=function(_0x58da03,_0xc3b001){return db['VtigerField'][_0x33ac('0x45')]({'where':{'id':_0x58da03['params']['id']}})['then'](handleEntityNotFound(_0xc3b001,null))['then'](removeEntity(_0xc3b001,null))[_0x33ac('0x46')](handleError(_0xc3b001,null));}; \ No newline at end of file +var _0x92bb=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','save','update','then','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x8ea9a2,_0x5d541d){var _0x2b2237=function(_0x134e4e){while(--_0x134e4e){_0x8ea9a2['push'](_0x8ea9a2['shift']());}};_0x2b2237(++_0x5d541d);}(_0x92bb,0x1cd));var _0xb92b=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x92bb[_0x2678d6];return _0x475503;};'use strict';var emlformat=require(_0xb92b('0x0'));var rimraf=require(_0xb92b('0x1'));var zipdir=require(_0xb92b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb92b('0x3'));var util=require(_0xb92b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb92b('0x5'));var ejs=require(_0xb92b('0x6'));var fs=require('fs');var fs_extra=require(_0xb92b('0x7'));var _=require('lodash');var squel=require(_0xb92b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb92b('0x9'));var toCsv=require(_0xb92b('0x5'));var querystring=require(_0xb92b('0xa'));var Papa=require(_0xb92b('0xb'));var Redis=require(_0xb92b('0xc'));var authService=require(_0xb92b('0xd'));var qs=require(_0xb92b('0xe'));var as=require(_0xb92b('0xf'));var hardwareService=require(_0xb92b('0x10'));var logger=require(_0xb92b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb92b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb92b('0x13'))['db'];function respondWithStatusCode(_0x3a216c,_0x3b5679){_0x3b5679=_0x3b5679||0xcc;return function(_0x253dc3){if(_0x253dc3){return _0x3a216c[_0xb92b('0x14')](_0x3b5679);}return _0x3a216c[_0xb92b('0x15')](_0x3b5679)[_0xb92b('0x16')]();};}function respondWithResult(_0xaa12e2,_0x2ca7c6){_0x2ca7c6=_0x2ca7c6||0xc8;return function(_0x11b13e){if(_0x11b13e){return _0xaa12e2[_0xb92b('0x15')](_0x2ca7c6)['json'](_0x11b13e);}};}function respondWithFilteredResult(_0x39ffbf,_0x3f195f){return function(_0x204056){if(_0x204056){var _0x7aa7bc=typeof _0x3f195f[_0xb92b('0x17')]==='undefined'&&typeof _0x3f195f[_0xb92b('0x18')]===_0xb92b('0x19');var _0x4d2543=_0x204056['count'];var _0x53e7f0=_0x7aa7bc?0x0:_0x3f195f[_0xb92b('0x17')];var _0x50f583=_0x7aa7bc?_0x204056[_0xb92b('0x1a')]:_0x3f195f['offset']+_0x3f195f['limit'];var _0x14f4b1;if(_0x50f583>=_0x4d2543){_0x50f583=_0x4d2543;_0x14f4b1=0xc8;}else{_0x14f4b1=0xce;}_0x39ffbf[_0xb92b('0x15')](_0x14f4b1);return _0x39ffbf[_0xb92b('0x1b')]('Content-Range',_0x53e7f0+'-'+_0x50f583+'/'+_0x4d2543)[_0xb92b('0x1c')](_0x204056);}return null;};}function patchUpdates(_0xdf8b10){return function(_0xe2d126){try{jsonpatch[_0xb92b('0x1d')](_0xe2d126,_0xdf8b10,!![]);}catch(_0x57f804){return BPromise['reject'](_0x57f804);}return _0xe2d126[_0xb92b('0x1e')]();};}function saveUpdates(_0xe8d15f,_0x1d70f5){return function(_0x2235aa){if(_0x2235aa){return _0x2235aa[_0xb92b('0x1f')](_0xe8d15f)['then'](function(_0x2153ed){return _0x2153ed;});}return null;};}function removeEntity(_0x4a6f22,_0x3652fa){return function(_0xc26e93){if(_0xc26e93){return _0xc26e93['destroy']()[_0xb92b('0x20')](function(){_0x4a6f22[_0xb92b('0x15')](0xcc)[_0xb92b('0x16')]();});}};}function handleEntityNotFound(_0x23a1ad,_0x391632){return function(_0x5cfd68){if(!_0x5cfd68){_0x23a1ad[_0xb92b('0x14')](0x194);}return _0x5cfd68;};}function handleError(_0x4d4397,_0x46a732){_0x46a732=_0x46a732||0x1f4;return function(_0x223939){logger[_0xb92b('0x21')](_0x223939[_0xb92b('0x22')]);if(_0x223939[_0xb92b('0x23')]){delete _0x223939['name'];}_0x4d4397['status'](_0x46a732)[_0xb92b('0x24')](_0x223939);};}exports[_0xb92b('0x25')]=function(_0xc2cf37,_0x3de6cd){var _0x7b3f45={},_0x372f12={},_0x412b1f={'count':0x0,'rows':[]};var _0x285ba3=_[_0xb92b('0x26')](db[_0xb92b('0x27')][_0xb92b('0x28')],function(_0x2072c8){return{'name':_0x2072c8['fieldName'],'type':_0x2072c8[_0xb92b('0x29')][_0xb92b('0x2a')]};});_0x372f12[_0xb92b('0x2b')]=_[_0xb92b('0x26')](_0x285ba3,_0xb92b('0x23'));_0x372f12[_0xb92b('0x2c')]=_[_0xb92b('0x2d')](_0xc2cf37[_0xb92b('0x2c')]);_0x372f12['filters']=_[_0xb92b('0x2e')](_0x372f12[_0xb92b('0x2b')],_0x372f12[_0xb92b('0x2c')]);_0x7b3f45['attributes']=_[_0xb92b('0x2e')](_0x372f12['model'],qs['fields'](_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x2f')]));_0x7b3f45[_0xb92b('0x30')]=_0x7b3f45['attributes'][_0xb92b('0x31')]?_0x7b3f45['attributes']:_0x372f12[_0xb92b('0x2b')];if(!_0xc2cf37[_0xb92b('0x2c')]['hasOwnProperty'](_0xb92b('0x32'))){_0x7b3f45[_0xb92b('0x18')]=qs[_0xb92b('0x18')](_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x18')]);_0x7b3f45[_0xb92b('0x17')]=qs[_0xb92b('0x17')](_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x17')]);}_0x7b3f45['order']=qs[_0xb92b('0x33')](_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x33')]);_0x7b3f45[_0xb92b('0x34')]=qs[_0xb92b('0x35')](_[_0xb92b('0x36')](_0xc2cf37[_0xb92b('0x2c')],_0x372f12['filters']),_0x285ba3);if(_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x37')]){_0x7b3f45[_0xb92b('0x34')]=_[_0xb92b('0x38')](_0x7b3f45['where'],{'$or':_[_0xb92b('0x26')](_0x285ba3,function(_0x16ace6){if(_0x16ace6[_0xb92b('0x29')]!=='VIRTUAL'){var _0x3ef473={};_0x3ef473[_0x16ace6[_0xb92b('0x23')]]={'$like':'%'+_0xc2cf37[_0xb92b('0x2c')]['filter']+'%'};return _0x3ef473;}})});}_0x7b3f45=_[_0xb92b('0x38')]({},_0x7b3f45,_0xc2cf37[_0xb92b('0x39')]);var _0x494280={'where':_0x7b3f45['where']};return db[_0xb92b('0x27')][_0xb92b('0x1a')](_0x494280)['then'](function(_0x3a8b6a){_0x412b1f['count']=_0x3a8b6a;if(_0xc2cf37[_0xb92b('0x2c')][_0xb92b('0x3a')]){_0x7b3f45[_0xb92b('0x3b')]=[{'all':!![]}];}return db['VtigerField'][_0xb92b('0x3c')](_0x7b3f45);})[_0xb92b('0x20')](function(_0x1a2df7){_0x412b1f[_0xb92b('0x3d')]=_0x1a2df7;return _0x412b1f;})[_0xb92b('0x20')](respondWithFilteredResult(_0x3de6cd,_0x7b3f45))[_0xb92b('0x3e')](handleError(_0x3de6cd,null));};exports['show']=function(_0xa9b33b,_0x12b1b5){var _0x3893d5={'raw':!![],'where':{'id':_0xa9b33b['params']['id']}},_0x6e9bc5={};_0x6e9bc5[_0xb92b('0x2b')]=_['keys'](db[_0xb92b('0x27')][_0xb92b('0x28')]);_0x6e9bc5[_0xb92b('0x2c')]=_[_0xb92b('0x2d')](_0xa9b33b[_0xb92b('0x2c')]);_0x6e9bc5[_0xb92b('0x35')]=_[_0xb92b('0x2e')](_0x6e9bc5['model'],_0x6e9bc5['query']);_0x3893d5[_0xb92b('0x30')]=_[_0xb92b('0x2e')](_0x6e9bc5[_0xb92b('0x2b')],qs[_0xb92b('0x2f')](_0xa9b33b[_0xb92b('0x2c')][_0xb92b('0x2f')]));_0x3893d5[_0xb92b('0x30')]=_0x3893d5[_0xb92b('0x30')][_0xb92b('0x31')]?_0x3893d5[_0xb92b('0x30')]:_0x6e9bc5[_0xb92b('0x2b')];if(_0xa9b33b[_0xb92b('0x2c')]['includeAll']){_0x3893d5[_0xb92b('0x3b')]=[{'all':!![]}];}_0x3893d5=_['merge']({},_0x3893d5,_0xa9b33b[_0xb92b('0x39')]);return db[_0xb92b('0x27')][_0xb92b('0x3f')](_0x3893d5)[_0xb92b('0x20')](handleEntityNotFound(_0x12b1b5,null))[_0xb92b('0x20')](respondWithResult(_0x12b1b5,null))[_0xb92b('0x3e')](handleError(_0x12b1b5,null));};exports[_0xb92b('0x40')]=function(_0x1fd524,_0x111367){return db[_0xb92b('0x27')][_0xb92b('0x40')](_0x1fd524[_0xb92b('0x41')],{})[_0xb92b('0x20')](respondWithResult(_0x111367,0xc9))['catch'](handleError(_0x111367,null));};exports[_0xb92b('0x1f')]=function(_0x5290df,_0x5da08e){if(_0x5290df[_0xb92b('0x41')]['id']){delete _0x5290df[_0xb92b('0x41')]['id'];}return db[_0xb92b('0x27')][_0xb92b('0x3f')]({'where':{'id':_0x5290df[_0xb92b('0x42')]['id']}})[_0xb92b('0x20')](handleEntityNotFound(_0x5da08e,null))[_0xb92b('0x20')](saveUpdates(_0x5290df[_0xb92b('0x41')],null))[_0xb92b('0x20')](respondWithResult(_0x5da08e,null))[_0xb92b('0x3e')](handleError(_0x5da08e,null));};exports[_0xb92b('0x43')]=function(_0x2e8c00,_0x264ca3){return db['VtigerField'][_0xb92b('0x3f')]({'where':{'id':_0x2e8c00[_0xb92b('0x42')]['id']}})[_0xb92b('0x20')](handleEntityNotFound(_0x264ca3,null))['then'](removeEntity(_0x264ca3,null))[_0xb92b('0x3e')](handleError(_0x264ca3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7c11e89..a589527 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0672=['rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x0672,0x78));var _0x2067=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0x0672[_0x529abc];return _0x453afa;};'use strict';var _=require(_0x2067('0x0'));var util=require(_0x2067('0x1'));var logger=require(_0x2067('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2067('0x3'));var rp=require(_0x2067('0x4'));var fs=require('fs');var path=require(_0x2067('0x5'));var rimraf=require(_0x2067('0x6'));var config=require(_0x2067('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x2067('0x8')]=function(_0x2412cd,_0x4964ba){return _0x2412cd[_0x2067('0x9')](_0x2067('0xa'),attributes,{'tableName':_0x2067('0xb'),'paranoid':![],'indexes':[{'name':_0x2067('0xc'),'fields':['idField',_0x2067('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x573b=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x573b,0x81));var _0xb573=function(_0x59f14a,_0x5c28ac){_0x59f14a=_0x59f14a-0x0;var _0x2593b7=_0x573b[_0x59f14a];return _0x2593b7;};'use strict';var _=require(_0xb573('0x0'));var util=require(_0xb573('0x1'));var logger=require('../../config/logger')(_0xb573('0x2'));var moment=require(_0xb573('0x3'));var BPromise=require(_0xb573('0x4'));var rp=require(_0xb573('0x5'));var fs=require('fs');var path=require(_0xb573('0x6'));var rimraf=require(_0xb573('0x7'));var config=require(_0xb573('0x8'));var attributes=require(_0xb573('0x9'));module[_0xb573('0xa')]=function(_0x1f9dbb,_0x798048){return _0x1f9dbb[_0xb573('0xb')]('VtigerField',attributes,{'tableName':_0xb573('0xc'),'paranoid':![],'indexes':[{'name':_0xb573('0xd'),'fields':[_0xb573('0xe'),_0xb573('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 48ed98f..5b00ce7 100644 --- a/server/api/intVtigerField/intVtigerField.rpc.js +++ b/server/api/intVtigerField/intVtigerField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x824d=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','VtigerField,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x10a1b1,_0x2be66e){var _0x57fada=function(_0x112aa0){while(--_0x112aa0){_0x10a1b1['push'](_0x10a1b1['shift']());}};_0x57fada(++_0x2be66e);}(_0x824d,0x141));var _0xd824=function(_0x27b10e,_0x2f0b91){_0x27b10e=_0x27b10e-0x0;var _0x2a5eb9=_0x824d[_0x27b10e];return _0x2a5eb9;};'use strict';var _=require(_0xd824('0x0'));var util=require(_0xd824('0x1'));var moment=require(_0xd824('0x2'));var BPromise=require(_0xd824('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd824('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd824('0x5'));var logger=require(_0xd824('0x6'))('rpc');var config=require(_0xd824('0x7'));var jayson=require(_0xd824('0x8'));var client=jayson[_0xd824('0x9')][_0xd824('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227877,_0xbbadc,_0x4f5f94){return new BPromise(function(_0x2739cb,_0x4e90ed){return client[_0xd824('0xb')](_0x227877,_0x4f5f94)[_0xd824('0xc')](function(_0x4e653b){logger[_0xd824('0xd')]('VtigerField,\x20%s,\x20%s',_0xbbadc,_0xd824('0xe'));logger['debug'](_0xd824('0xf'),_0xbbadc,_0xd824('0xe'),JSON[_0xd824('0x10')](_0x4e653b));if(_0x4e653b[_0xd824('0x11')]){if(_0x4e653b[_0xd824('0x11')]['code']===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0xbbadc,_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);return _0x4e90ed(_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);}logger[_0xd824('0x11')](_0xd824('0x13'),_0xbbadc,_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);return _0x2739cb(_0x4e653b[_0xd824('0x11')][_0xd824('0x12')]);}else{logger[_0xd824('0xd')](_0xd824('0x13'),_0xbbadc,_0xd824('0xe'));_0x2739cb(_0x4e653b['result'][_0xd824('0x12')]);}})[_0xd824('0x14')](function(_0x35873e){logger[_0xd824('0x11')](_0xd824('0x13'),_0xbbadc,_0x35873e);_0x4e90ed(_0x35873e);});});} \ No newline at end of file +var _0x045f=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','code','error','message','info','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x20bb98,_0x30d3ce){var _0x1df69f=function(_0x140898){while(--_0x140898){_0x20bb98['push'](_0x20bb98['shift']());}};_0x1df69f(++_0x30d3ce);}(_0x045f,0xce));var _0xf045=function(_0x2c9f51,_0x2eec01){_0x2c9f51=_0x2c9f51-0x0;var _0x12abf9=_0x045f[_0x2c9f51];return _0x12abf9;};'use strict';var _=require('lodash');var util=require(_0xf045('0x0'));var moment=require('moment');var BPromise=require(_0xf045('0x1'));var rs=require(_0xf045('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf045('0x3'))['db'];var utils=require(_0xf045('0x4'));var logger=require(_0xf045('0x5'))(_0xf045('0x6'));var config=require(_0xf045('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32210c,_0x2ce174,_0x40eade){return new BPromise(function(_0x41c120,_0x576e86){return client[_0xf045('0x8')](_0x32210c,_0x40eade)[_0xf045('0x9')](function(_0x335a49){logger['info'](_0xf045('0xa'),_0x2ce174,_0xf045('0xb'));logger[_0xf045('0xc')](_0xf045('0xd'),_0x2ce174,_0xf045('0xb'),JSON['stringify'](_0x335a49));if(_0x335a49['error']){if(_0x335a49['error'][_0xf045('0xe')]===0x1f4){logger[_0xf045('0xf')](_0xf045('0xa'),_0x2ce174,_0x335a49['error'][_0xf045('0x10')]);return _0x576e86(_0x335a49[_0xf045('0xf')][_0xf045('0x10')]);}logger[_0xf045('0xf')]('VtigerField,\x20%s,\x20%s',_0x2ce174,_0x335a49[_0xf045('0xf')][_0xf045('0x10')]);return _0x41c120(_0x335a49[_0xf045('0xf')]['message']);}else{logger[_0xf045('0x11')](_0xf045('0xa'),_0x2ce174,_0xf045('0xb'));_0x41c120(_0x335a49['result'][_0xf045('0x10')]);}})['catch'](function(_0x4963fa){logger['error'](_0xf045('0xa'),_0x2ce174,_0x4963fa);_0x576e86(_0x4963fa);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index c766ac1..9b91fed 100644 --- a/server/api/intZendeskAccount/index.js +++ b/server/api/intZendeskAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb03=['post','create','/:id/configurations','addConfiguration','/:id','destroy','exports','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0x442691,_0x274600){var _0x10d16f=function(_0x5b22d8){while(--_0x5b22d8){_0x442691['push'](_0x442691['shift']());}};_0x10d16f(++_0x274600);}(_0xcb03,0x19f));var _0x3cb0=function(_0x5cdc8a,_0x1633cc){_0x5cdc8a=_0x5cdc8a-0x0;var _0x3f66a0=_0xcb03[_0x5cdc8a];return _0x3f66a0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3cb0('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cb0('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb0('0x2'));var controller=require('./intZendeskAccount.controller');router[_0x3cb0('0x3')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x5')]);router[_0x3cb0('0x3')]('/:id',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x6')]);router[_0x3cb0('0x3')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3cb0('0x7')]);router[_0x3cb0('0x3')](_0x3cb0('0x8'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x9')]);router[_0x3cb0('0xa')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xb')]);router[_0x3cb0('0xa')](_0x3cb0('0xc'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xd')]);router['put']('/:id',auth[_0x3cb0('0x4')](),controller['update']);router['delete'](_0x3cb0('0xe'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xf')]);module[_0x3cb0('0x10')]=router; \ No newline at end of file +var _0xb0ac=['/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','get','show'];(function(_0xa4ccd8,_0x5d4136){var _0x276358=function(_0x476a1d){while(--_0x476a1d){_0xa4ccd8['push'](_0xa4ccd8['shift']());}};_0x276358(++_0x5d4136);}(_0xb0ac,0x110));var _0xcb0a=function(_0x294516,_0x465d21){_0x294516=_0x294516-0x0;var _0x290c27=_0xb0ac[_0x294516];return _0x290c27;};'use strict';var multer=require(_0xcb0a('0x0'));var util=require(_0xcb0a('0x1'));var path=require('path');var timeout=require(_0xcb0a('0x2'));var express=require('express');var router=express[_0xcb0a('0x3')]();var fs_extra=require(_0xcb0a('0x4'));var auth=require(_0xcb0a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcb0a('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xcb0a('0x7')]);router[_0xcb0a('0x6')](_0xcb0a('0x8'),auth['isAuthenticated'](),controller[_0xcb0a('0x9')]);router['get'](_0xcb0a('0xa'),auth[_0xcb0a('0xb')](),controller[_0xcb0a('0xc')]);router[_0xcb0a('0xd')]('/',auth['isAuthenticated'](),controller[_0xcb0a('0xe')]);router['post'](_0xcb0a('0x8'),auth[_0xcb0a('0xb')](),controller['addConfiguration']);router[_0xcb0a('0xf')](_0xcb0a('0x10'),auth[_0xcb0a('0xb')](),controller[_0xcb0a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xcb0a('0x12')]);module[_0xcb0a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4145eb9..8795e7b 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.attributes.js +++ b/server/api/intZendeskAccount/intZendeskAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf71=['username','remoteUri','ENUM','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x2d6f90,_0x3c43d4){var _0x529147=function(_0x20c241){while(--_0x20c241){_0x2d6f90['push'](_0x2d6f90['shift']());}};_0x529147(++_0x3c43d4);}(_0xcf71,0xba));var _0x1cf7=function(_0x4f4ca5,_0x4c02b8){_0x4f4ca5=_0x4f4ca5-0x0;var _0x4a2021=_0xcf71[_0x4f4ca5];return _0x4a2021;};'use strict';var Sequelize=require(_0x1cf7('0x0'));module[_0x1cf7('0x1')]={'name':{'type':Sequelize[_0x1cf7('0x2')]},'description':{'type':Sequelize[_0x1cf7('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1cf7('0x3')},'password':{'type':Sequelize[_0x1cf7('0x2')]},'token':{'type':Sequelize[_0x1cf7('0x2')]},'remoteUri':{'type':Sequelize[_0x1cf7('0x2')],'unique':_0x1cf7('0x4')},'authType':{'type':Sequelize[_0x1cf7('0x5')](_0x1cf7('0x6'),_0x1cf7('0x7')),'defaultValue':_0x1cf7('0x6')},'serverUrl':{'type':Sequelize[_0x1cf7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1cf7('0x5')](_0x1cf7('0x8'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x9e6d=['integrationTab','newTab','sequelize','STRING','remoteUri','password','token','ENUM'];(function(_0x5941f8,_0x4aee3e){var _0xb94b96=function(_0x16ae07){while(--_0x16ae07){_0x5941f8['push'](_0x5941f8['shift']());}};_0xb94b96(++_0x4aee3e);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x39ec48,_0x241030){_0x39ec48=_0x39ec48-0x0;var _0x571a01=_0x9e6d[_0x39ec48];return _0x571a01;};'use strict';var Sequelize=require(_0xd9e6('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9e6('0x1')]},'description':{'type':Sequelize[_0xd9e6('0x1')]},'username':{'type':Sequelize[_0xd9e6('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd9e6('0x1')]},'token':{'type':Sequelize[_0xd9e6('0x1')]},'remoteUri':{'type':Sequelize[_0xd9e6('0x1')],'unique':_0xd9e6('0x2')},'authType':{'type':Sequelize['ENUM'](_0xd9e6('0x3'),_0xd9e6('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd9e6('0x5')](_0xd9e6('0x6'),_0xd9e6('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 718f256..7fdf287 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7af2=['pick','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','find','getConfigurations','findOne','ZendeskConfiguration','length','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters'];(function(_0x34d8b0,_0x4fb629){var _0x2708bc=function(_0x2bca7d){while(--_0x2bca7d){_0x34d8b0['push'](_0x34d8b0['shift']());}};_0x2708bc(++_0x4fb629);}(_0x7af2,0x119));var _0x27af=function(_0x1acb07,_0x44fa67){_0x1acb07=_0x1acb07-0x0;var _0x4df84e=_0x7af2[_0x1acb07];return _0x4df84e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27af('0x0'));var zipdir=require(_0x27af('0x1'));var jsonpatch=require(_0x27af('0x2'));var rp=require(_0x27af('0x3'));var moment=require('moment');var BPromise=require(_0x27af('0x4'));var Mustache=require(_0x27af('0x5'));var util=require(_0x27af('0x6'));var path=require(_0x27af('0x7'));var sox=require(_0x27af('0x8'));var csv=require(_0x27af('0x9'));var ejs=require(_0x27af('0xa'));var fs=require('fs');var fs_extra=require(_0x27af('0xb'));var _=require(_0x27af('0xc'));var squel=require('squel');var crypto=require(_0x27af('0xd'));var jsforce=require(_0x27af('0xe'));var deskjs=require(_0x27af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27af('0x10'));var Papa=require(_0x27af('0x11'));var Redis=require(_0x27af('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x27af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x27af('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x27af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x27af('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x406340,_0x203501){_0x203501=_0x203501||0xcc;return function(_0x1fd964){if(_0x1fd964){return _0x406340[_0x27af('0x17')](_0x203501);}return _0x406340[_0x27af('0x18')](_0x203501)[_0x27af('0x19')]();};}function respondWithResult(_0x234825,_0x3da435){_0x3da435=_0x3da435||0xc8;return function(_0x423222){if(_0x423222){return _0x234825[_0x27af('0x18')](_0x3da435)[_0x27af('0x1a')](_0x423222);}};}function respondWithFilteredResult(_0x9c2d4b,_0x2d7800){return function(_0x3102c4){if(_0x3102c4){var _0x2bfc9=typeof _0x2d7800[_0x27af('0x1b')]===_0x27af('0x1c')&&typeof _0x2d7800[_0x27af('0x1d')]==='undefined';var _0x315661=_0x3102c4[_0x27af('0x1e')];var _0x5997ae=_0x2bfc9?0x0:_0x2d7800['offset'];var _0x20a6d7=_0x2bfc9?_0x3102c4[_0x27af('0x1e')]:_0x2d7800[_0x27af('0x1b')]+_0x2d7800[_0x27af('0x1d')];var _0xec699a;if(_0x20a6d7>=_0x315661){_0x20a6d7=_0x315661;_0xec699a=0xc8;}else{_0xec699a=0xce;}_0x9c2d4b['status'](_0xec699a);return _0x9c2d4b[_0x27af('0x1f')](_0x27af('0x20'),_0x5997ae+'-'+_0x20a6d7+'/'+_0x315661)[_0x27af('0x1a')](_0x3102c4);}return null;};}function patchUpdates(_0x5e7c19){return function(_0x19afb1){try{jsonpatch[_0x27af('0x21')](_0x19afb1,_0x5e7c19,!![]);}catch(_0x2ae47e){return BPromise['reject'](_0x2ae47e);}return _0x19afb1[_0x27af('0x22')]();};}function saveUpdates(_0x2460f4,_0x30720b){return function(_0x2af76d){if(_0x2af76d){return _0x2af76d[_0x27af('0x23')](_0x2460f4)[_0x27af('0x24')](function(_0x43dd9e){return _0x43dd9e;});}return null;};}function removeEntity(_0x35b36d,_0x2e1bb0){return function(_0x49780b){if(_0x49780b){return _0x49780b['destroy']()['then'](function(){_0x35b36d[_0x27af('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12625c,_0x396326){return function(_0x4ba49f){if(!_0x4ba49f){_0x12625c[_0x27af('0x17')](0x194);}return _0x4ba49f;};}function handleError(_0x1d9341,_0x463e36){_0x463e36=_0x463e36||0x1f4;return function(_0x424490){logger[_0x27af('0x25')](_0x424490[_0x27af('0x26')]);if(_0x424490[_0x27af('0x27')]){delete _0x424490['name'];}_0x1d9341[_0x27af('0x18')](_0x463e36)[_0x27af('0x28')](_0x424490);};}exports[_0x27af('0x29')]=function(_0xe009a,_0x25d65a){var _0xa08dd9={},_0x42a5b7={},_0x2b26ac={'count':0x0,'rows':[]};var _0x4406e2=_[_0x27af('0x2a')](db[_0x27af('0x2b')]['rawAttributes'],function(_0x15e867){return{'name':_0x15e867[_0x27af('0x2c')],'type':_0x15e867[_0x27af('0x2d')][_0x27af('0x2e')]};});_0x42a5b7[_0x27af('0x2f')]=_[_0x27af('0x2a')](_0x4406e2,'name');_0x42a5b7['query']=_[_0x27af('0x30')](_0xe009a[_0x27af('0x31')]);_0x42a5b7['filters']=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],_0x42a5b7[_0x27af('0x31')]);_0xa08dd9[_0x27af('0x33')]=_[_0x27af('0x32')](_0x42a5b7[_0x27af('0x2f')],qs[_0x27af('0x34')](_0xe009a[_0x27af('0x31')][_0x27af('0x34')]));_0xa08dd9[_0x27af('0x33')]=_0xa08dd9[_0x27af('0x33')]['length']?_0xa08dd9['attributes']:_0x42a5b7[_0x27af('0x2f')];if(!_0xe009a[_0x27af('0x31')]['hasOwnProperty'](_0x27af('0x35'))){_0xa08dd9[_0x27af('0x1d')]=qs['limit'](_0xe009a[_0x27af('0x31')][_0x27af('0x1d')]);_0xa08dd9[_0x27af('0x1b')]=qs[_0x27af('0x1b')](_0xe009a[_0x27af('0x31')]['offset']);}_0xa08dd9[_0x27af('0x36')]=qs[_0x27af('0x37')](_0xe009a['query']['sort']);_0xa08dd9[_0x27af('0x38')]=qs[_0x27af('0x39')](_[_0x27af('0x3a')](_0xe009a[_0x27af('0x31')],_0x42a5b7[_0x27af('0x39')]),_0x4406e2);if(_0xe009a[_0x27af('0x31')]['filter']){_0xa08dd9[_0x27af('0x38')]=_['merge'](_0xa08dd9[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x4406e2,function(_0x2a6b14){if(_0x2a6b14[_0x27af('0x2d')]!==_0x27af('0x3b')){var _0x5f5504={};_0x5f5504[_0x2a6b14[_0x27af('0x27')]]={'$like':'%'+_0xe009a[_0x27af('0x31')][_0x27af('0x3c')]+'%'};return _0x5f5504;}})});}_0xa08dd9=_[_0x27af('0x3d')]({},_0xa08dd9,_0xe009a[_0x27af('0x3e')]);var _0x32b558={'where':_0xa08dd9[_0x27af('0x38')]};return db[_0x27af('0x2b')][_0x27af('0x1e')](_0x32b558)[_0x27af('0x24')](function(_0xda424e){_0x2b26ac[_0x27af('0x1e')]=_0xda424e;if(_0xe009a[_0x27af('0x31')][_0x27af('0x3f')]){_0xa08dd9['include']=[{'all':!![]}];}return db[_0x27af('0x2b')][_0x27af('0x40')](_0xa08dd9);})[_0x27af('0x24')](function(_0x373c05){_0x2b26ac['rows']=_0x373c05;return _0x2b26ac;})[_0x27af('0x24')](respondWithFilteredResult(_0x25d65a,_0xa08dd9))['catch'](handleError(_0x25d65a,null));};exports['show']=function(_0x2425dd,_0x3c9c81){var _0x279f99={'raw':![],'where':{'id':_0x2425dd[_0x27af('0x41')]['id']}},_0x17efd6={};_0x17efd6[_0x27af('0x2f')]=_[_0x27af('0x30')](db[_0x27af('0x2b')][_0x27af('0x42')]);_0x17efd6[_0x27af('0x31')]=_[_0x27af('0x30')](_0x2425dd[_0x27af('0x31')]);_0x17efd6['filters']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],_0x17efd6['query']);_0x279f99['attributes']=_[_0x27af('0x32')](_0x17efd6[_0x27af('0x2f')],qs[_0x27af('0x34')](_0x2425dd[_0x27af('0x31')][_0x27af('0x34')]));_0x279f99['attributes']=_0x279f99[_0x27af('0x33')]['length']?_0x279f99[_0x27af('0x33')]:_0x17efd6[_0x27af('0x2f')];if(_0x2425dd[_0x27af('0x31')][_0x27af('0x3f')]){_0x279f99[_0x27af('0x43')]=[{'all':!![]}];}_0x279f99=_[_0x27af('0x3d')]({},_0x279f99,_0x2425dd[_0x27af('0x3e')]);return db['ZendeskAccount']['find'](_0x279f99)[_0x27af('0x24')](handleEntityNotFound(_0x3c9c81,null))['then'](respondWithResult(_0x3c9c81,null))[_0x27af('0x44')](handleError(_0x3c9c81,null));};exports[_0x27af('0x45')]=function(_0x226025,_0x389962){return db[_0x27af('0x2b')][_0x27af('0x45')](_0x226025[_0x27af('0x46')],{})['then'](respondWithResult(_0x389962,0xc9))[_0x27af('0x44')](handleError(_0x389962,null));};exports[_0x27af('0x23')]=function(_0x20e180,_0x3fdc0e){if(_0x20e180[_0x27af('0x46')]['id']){delete _0x20e180['body']['id'];}return db[_0x27af('0x2b')][_0x27af('0x47')]({'where':{'id':_0x20e180[_0x27af('0x41')]['id']}})['then'](handleEntityNotFound(_0x3fdc0e,null))['then'](saveUpdates(_0x20e180[_0x27af('0x46')],null))[_0x27af('0x24')](respondWithResult(_0x3fdc0e,null))[_0x27af('0x44')](handleError(_0x3fdc0e,null));};exports['destroy']=function(_0x495794,_0x2fad23){return db['ZendeskAccount'][_0x27af('0x47')]({'where':{'id':_0x495794[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2fad23,null))[_0x27af('0x24')](removeEntity(_0x2fad23,null))[_0x27af('0x44')](handleError(_0x2fad23,null));};exports[_0x27af('0x48')]=function(_0x123533,_0x374794,_0x1b6d94){var _0x24d8bf={};var _0x23369a={};var _0x5c02c1;var _0x76ed78;return db[_0x27af('0x2b')][_0x27af('0x49')]({'where':{'id':_0x123533[_0x27af('0x41')]['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x374794,null))[_0x27af('0x24')](function(_0x20c155){if(_0x20c155){_0x5c02c1=_0x20c155;_0x23369a[_0x27af('0x2f')]=_['keys'](db[_0x27af('0x4a')]['rawAttributes']);_0x23369a[_0x27af('0x31')]=_[_0x27af('0x30')](_0x123533[_0x27af('0x31')]);_0x23369a['filters']=_[_0x27af('0x32')](_0x23369a['model'],_0x23369a[_0x27af('0x31')]);_0x24d8bf[_0x27af('0x33')]=_[_0x27af('0x32')](_0x23369a['model'],qs[_0x27af('0x34')](_0x123533['query'][_0x27af('0x34')]));_0x24d8bf['attributes']=_0x24d8bf[_0x27af('0x33')][_0x27af('0x4b')]?_0x24d8bf[_0x27af('0x33')]:_0x23369a['model'];_0x24d8bf['order']=qs[_0x27af('0x37')](_0x123533[_0x27af('0x31')][_0x27af('0x37')]);_0x24d8bf[_0x27af('0x38')]=qs['filters'](_[_0x27af('0x3a')](_0x123533[_0x27af('0x31')],_0x23369a[_0x27af('0x39')]));if(_0x123533[_0x27af('0x31')][_0x27af('0x3c')]){_0x24d8bf[_0x27af('0x38')]=_['merge'](_0x24d8bf[_0x27af('0x38')],{'$or':_[_0x27af('0x2a')](_0x24d8bf[_0x27af('0x33')],function(_0x2401c7){var _0x49eb46={};_0x49eb46[_0x2401c7]={'$like':'%'+_0x123533[_0x27af('0x31')]['filter']+'%'};return _0x49eb46;})});}_0x24d8bf=_[_0x27af('0x3d')]({},_0x24d8bf,_0x123533[_0x27af('0x3e')]);return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x13a5a8){if(_0x13a5a8){_0x76ed78=_0x13a5a8['length'];if(!_0x123533['query'][_0x27af('0x4c')](_0x27af('0x35'))){_0x24d8bf[_0x27af('0x1d')]=qs['limit'](_0x123533[_0x27af('0x31')][_0x27af('0x1d')]);_0x24d8bf['offset']=qs[_0x27af('0x1b')](_0x123533[_0x27af('0x31')]['offset']);}return _0x5c02c1['getConfigurations'](_0x24d8bf);}})[_0x27af('0x24')](function(_0x1fa50b){if(_0x1fa50b){return _0x1fa50b?{'count':_0x76ed78,'rows':_0x1fa50b}:null;}})['then'](respondWithResult(_0x374794,null))['catch'](handleError(_0x374794,null));};exports[_0x27af('0x4d')]=function(_0xf97695,_0x2a8534,_0x266220){if(_0xf97695[_0x27af('0x46')]['id']){delete _0xf97695[_0x27af('0x46')]['id'];}return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0xf97695['params']['id']}})[_0x27af('0x24')](handleEntityNotFound(_0x2a8534,null))[_0x27af('0x24')](function(_0xa692f6){if(_0xa692f6){_0xf97695[_0x27af('0x46')][_0x27af('0x4e')]=_0xa692f6['id'];_0xf97695[_0x27af('0x46')][_0x27af('0x4f')]=integrations[_0x27af('0x50')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695[_0x27af('0x46')][_0x27af('0x2d')]);_0xf97695[_0x27af('0x46')][_0x27af('0x52')]=integrations[_0x27af('0x53')](_0xf97695[_0x27af('0x46')][_0x27af('0x51')],_0xf97695['body'][_0x27af('0x2d')]);return db[_0x27af('0x4a')]['create'](_0xf97695[_0x27af('0x46')],{'include':[{'model':db[_0x27af('0x54')],'as':_0x27af('0x4f')},{'model':db[_0x27af('0x54')],'as':_0x27af('0x52')}]});}return null;})[_0x27af('0x24')](respondWithResult(_0x2a8534,null))['catch'](handleError(_0x2a8534,null));};exports[_0x27af('0x55')]=function(_0x31a595,_0x3a2958,_0x4ab463){var _0x5d7af4='';return db[_0x27af('0x2b')]['findOne']({'where':{'id':_0x31a595[_0x27af('0x41')]['id']},'attributes':['id',_0x27af('0x56'),_0x27af('0x57'),_0x27af('0x58'),_0x27af('0x59'),'remoteUri']})[_0x27af('0x24')](handleEntityNotFound(_0x3a2958,null))[_0x27af('0x24')](function(_0x4ac2a3){if(_0x4ac2a3){_0x5d7af4=_0x4ac2a3[_0x27af('0x5a')];var _0xc0a98c=_0x5d7af4['slice'](-0x1);if(_0xc0a98c==='/'){_0x5d7af4=_0x5d7af4['substring'](0x0,_0x5d7af4[_0x27af('0x5b')](_0xc0a98c));}var _0x287f7c={'method':_0x27af('0x5c'),'uri':util[_0x27af('0x5d')](_0x27af('0x5e'),_0x5d7af4,_0x27af('0x5f')),'json':!![]};switch(_0x4ac2a3[_0x27af('0x59')]){case'password':_0x287f7c[_0x27af('0x60')]={'Authorization':util[_0x27af('0x5d')](_0x27af('0x61'),new Buffer(util[_0x27af('0x5d')]('%s:%s',_0x4ac2a3['username'],_0x4ac2a3[_0x27af('0x57')]))[_0x27af('0x62')](_0x27af('0x63')))};break;case _0x27af('0x58'):_0x287f7c['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x27af('0x5d')](_0x27af('0x64'),_0x4ac2a3[_0x27af('0x56')],_0x4ac2a3[_0x27af('0x58')]))[_0x27af('0x62')](_0x27af('0x63')))};break;default:throw new db['Sequelize']['ValidationError'](_0x27af('0x65'));}return rp(_0x287f7c);}})[_0x27af('0x24')](function(_0x55637f){if(_0x55637f){var _0x2c3d30=['subject','description',_0x27af('0x66'),_0x27af('0x67')];_[_0x27af('0x68')](_0x55637f[_0x27af('0x5f')],function(_0x2b7e18){return _0x2c3d30[_0x27af('0x69')](_0x2b7e18[_0x27af('0x2d')]);});return{'count':_0x55637f[_0x27af('0x5f')][_0x27af('0x4b')],'rows':_[_0x27af('0x2a')](_0x55637f[_0x27af('0x5f')],function(_0x4dd124){return{'id':_0x4dd124['id'],'name':_0x4dd124[_0x27af('0x6a')]>0x7?_0x4dd124[_0x27af('0x6b')]:_0x4dd124[_0x27af('0x2d')],'custom':_0x4dd124['position']>0x7?!![]:![],'options':_0x4dd124[_0x27af('0x6c')]?_0x4dd124[_0x27af('0x6c')]:_0x4dd124[_0x27af('0x6d')]?_0x4dd124['custom_field_options']:[]};})};}})[_0x27af('0x24')](respondWithResult(_0x3a2958,null))['catch'](function(_0x118d06){var _0x9350fa=_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?0x1f4:_0x118d06[_0x27af('0x6f')]||0x1f4;logger[_0x27af('0x25')](_0x27af('0x70'),_0x27af('0x55'),_0x9350fa,JSON['stringify'](_0x118d06));delete _0x118d06[_0x27af('0x27')];if(_0x9350fa===0x191){_0x9350fa=0x190;}_0x3a2958['status'](_0x9350fa)[_0x27af('0x28')](_0x31a595[_0x27af('0x31')][_0x27af('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x118d06['statusCode']}:_0x118d06);});}; \ No newline at end of file +var _0x39cb=['count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','ZendeskConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','token','authType','remoteUri','slice','substring','format','%s/%s','headers','Basic\x20%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x122820,_0x541524){var _0x8c6063=function(_0x500426){while(--_0x500426){_0x122820['push'](_0x122820['shift']());}};_0x8c6063(++_0x541524);}(_0x39cb,0x1bd));var _0xb39c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x39cb[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];var integrations=require(_0xb39c('0x17'));function respondWithStatusCode(_0x51ff24,_0x31e07e){_0x31e07e=_0x31e07e||0xcc;return function(_0x468995){if(_0x468995){return _0x51ff24[_0xb39c('0x18')](_0x31e07e);}return _0x51ff24['status'](_0x31e07e)[_0xb39c('0x19')]();};}function respondWithResult(_0x40a6d3,_0x42a203){_0x42a203=_0x42a203||0xc8;return function(_0x386c80){if(_0x386c80){return _0x40a6d3[_0xb39c('0x1a')](_0x42a203)[_0xb39c('0x1b')](_0x386c80);}};}function respondWithFilteredResult(_0x8e9181,_0x5277ce){return function(_0x316c9b){if(_0x316c9b){var _0x3223f6=typeof _0x5277ce[_0xb39c('0x1c')]===_0xb39c('0x1d')&&typeof _0x5277ce[_0xb39c('0x1e')]===_0xb39c('0x1d');var _0x1a2f48=_0x316c9b[_0xb39c('0x1f')];var _0x35dade=_0x3223f6?0x0:_0x5277ce[_0xb39c('0x1c')];var _0x559ad6=_0x3223f6?_0x316c9b[_0xb39c('0x1f')]:_0x5277ce[_0xb39c('0x1c')]+_0x5277ce[_0xb39c('0x1e')];var _0x447352;if(_0x559ad6>=_0x1a2f48){_0x559ad6=_0x1a2f48;_0x447352=0xc8;}else{_0x447352=0xce;}_0x8e9181['status'](_0x447352);return _0x8e9181[_0xb39c('0x20')](_0xb39c('0x21'),_0x35dade+'-'+_0x559ad6+'/'+_0x1a2f48)['json'](_0x316c9b);}return null;};}function patchUpdates(_0x2d8e93){return function(_0x363e52){try{jsonpatch[_0xb39c('0x22')](_0x363e52,_0x2d8e93,!![]);}catch(_0x4ebfca){return BPromise['reject'](_0x4ebfca);}return _0x363e52[_0xb39c('0x23')]();};}function saveUpdates(_0x1a5b9d,_0x3c8dfd){return function(_0x5719e2){if(_0x5719e2){return _0x5719e2[_0xb39c('0x24')](_0x1a5b9d)[_0xb39c('0x25')](function(_0x1bb895){return _0x1bb895;});}return null;};}function removeEntity(_0x16f3b0,_0x3b03ed){return function(_0x4a32f6){if(_0x4a32f6){return _0x4a32f6[_0xb39c('0x26')]()[_0xb39c('0x25')](function(){_0x16f3b0['status'](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x4492a4,_0x39116b){return function(_0x12be70){if(!_0x12be70){_0x4492a4[_0xb39c('0x18')](0x194);}return _0x12be70;};}function handleError(_0x5453a6,_0x23a2f1){_0x23a2f1=_0x23a2f1||0x1f4;return function(_0x299c27){logger[_0xb39c('0x27')](_0x299c27['stack']);if(_0x299c27[_0xb39c('0x28')]){delete _0x299c27[_0xb39c('0x28')];}_0x5453a6['status'](_0x23a2f1)[_0xb39c('0x29')](_0x299c27);};}exports[_0xb39c('0x2a')]=function(_0x328db1,_0x4e9672){var _0x714d20={},_0x45fed4={},_0x59172f={'count':0x0,'rows':[]};var _0x2bc742=_['map'](db[_0xb39c('0x2b')][_0xb39c('0x2c')],function(_0x309697){return{'name':_0x309697[_0xb39c('0x2d')],'type':_0x309697[_0xb39c('0x2e')]['key']};});_0x45fed4[_0xb39c('0x2f')]=_['map'](_0x2bc742,_0xb39c('0x28'));_0x45fed4['query']=_[_0xb39c('0x30')](_0x328db1[_0xb39c('0x31')]);_0x45fed4[_0xb39c('0x32')]=_[_0xb39c('0x33')](_0x45fed4['model'],_0x45fed4['query']);_0x714d20[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x45fed4['model'],qs[_0xb39c('0x35')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x35')]));_0x714d20[_0xb39c('0x34')]=_0x714d20[_0xb39c('0x34')][_0xb39c('0x36')]?_0x714d20[_0xb39c('0x34')]:_0x45fed4[_0xb39c('0x2f')];if(!_0x328db1[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x714d20[_0xb39c('0x1e')]=qs[_0xb39c('0x1e')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x714d20[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1c')]);}_0x714d20['order']=qs[_0xb39c('0x39')](_0x328db1[_0xb39c('0x31')]['sort']);_0x714d20['where']=qs['filters'](_[_0xb39c('0x3a')](_0x328db1[_0xb39c('0x31')],_0x45fed4[_0xb39c('0x32')]),_0x2bc742);if(_0x328db1['query'][_0xb39c('0x3b')]){_0x714d20[_0xb39c('0x3c')]=_[_0xb39c('0x3d')](_0x714d20[_0xb39c('0x3c')],{'$or':_[_0xb39c('0x3e')](_0x2bc742,function(_0x4b51ac){if(_0x4b51ac[_0xb39c('0x2e')]!==_0xb39c('0x3f')){var _0x51b489={};_0x51b489[_0x4b51ac[_0xb39c('0x28')]]={'$like':'%'+_0x328db1['query'][_0xb39c('0x3b')]+'%'};return _0x51b489;}})});}_0x714d20=_[_0xb39c('0x3d')]({},_0x714d20,_0x328db1[_0xb39c('0x40')]);var _0x4c043a={'where':_0x714d20[_0xb39c('0x3c')]};return db[_0xb39c('0x2b')][_0xb39c('0x1f')](_0x4c043a)[_0xb39c('0x25')](function(_0x10b87b){_0x59172f[_0xb39c('0x1f')]=_0x10b87b;if(_0x328db1[_0xb39c('0x31')][_0xb39c('0x41')]){_0x714d20[_0xb39c('0x42')]=[{'all':!![]}];}return db[_0xb39c('0x2b')][_0xb39c('0x43')](_0x714d20);})[_0xb39c('0x25')](function(_0x53347e){_0x59172f[_0xb39c('0x44')]=_0x53347e;return _0x59172f;})[_0xb39c('0x25')](respondWithFilteredResult(_0x4e9672,_0x714d20))[_0xb39c('0x45')](handleError(_0x4e9672,null));};exports[_0xb39c('0x46')]=function(_0x3d301e,_0x390cd7){var _0x1db549={'raw':![],'where':{'id':_0x3d301e[_0xb39c('0x47')]['id']}},_0x8cb33a={};_0x8cb33a['model']=_['keys'](db[_0xb39c('0x2b')][_0xb39c('0x2c')]);_0x8cb33a['query']=_['keys'](_0x3d301e[_0xb39c('0x31')]);_0x8cb33a['filters']=_[_0xb39c('0x33')](_0x8cb33a[_0xb39c('0x2f')],_0x8cb33a[_0xb39c('0x31')]);_0x1db549[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x8cb33a['model'],qs[_0xb39c('0x35')](_0x3d301e[_0xb39c('0x31')]['fields']));_0x1db549['attributes']=_0x1db549[_0xb39c('0x34')]['length']?_0x1db549['attributes']:_0x8cb33a[_0xb39c('0x2f')];if(_0x3d301e[_0xb39c('0x31')][_0xb39c('0x41')]){_0x1db549[_0xb39c('0x42')]=[{'all':!![]}];}_0x1db549=_[_0xb39c('0x3d')]({},_0x1db549,_0x3d301e[_0xb39c('0x40')]);return db[_0xb39c('0x2b')][_0xb39c('0x48')](_0x1db549)[_0xb39c('0x25')](handleEntityNotFound(_0x390cd7,null))[_0xb39c('0x25')](respondWithResult(_0x390cd7,null))['catch'](handleError(_0x390cd7,null));};exports[_0xb39c('0x49')]=function(_0x7e9750,_0xe329bf){return db[_0xb39c('0x2b')][_0xb39c('0x49')](_0x7e9750[_0xb39c('0x4a')],{})[_0xb39c('0x25')](respondWithResult(_0xe329bf,0xc9))[_0xb39c('0x45')](handleError(_0xe329bf,null));};exports[_0xb39c('0x24')]=function(_0x1ae2cb,_0x2150aa){if(_0x1ae2cb[_0xb39c('0x4a')]['id']){delete _0x1ae2cb[_0xb39c('0x4a')]['id'];}return db[_0xb39c('0x2b')][_0xb39c('0x48')]({'where':{'id':_0x1ae2cb[_0xb39c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2150aa,null))[_0xb39c('0x25')](saveUpdates(_0x1ae2cb[_0xb39c('0x4a')],null))[_0xb39c('0x25')](respondWithResult(_0x2150aa,null))[_0xb39c('0x45')](handleError(_0x2150aa,null));};exports[_0xb39c('0x26')]=function(_0x18db8f,_0xd4f368){return db[_0xb39c('0x2b')]['find']({'where':{'id':_0x18db8f['params']['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0xd4f368,null))[_0xb39c('0x25')](removeEntity(_0xd4f368,null))['catch'](handleError(_0xd4f368,null));};exports['getConfigurations']=function(_0x226f60,_0x1d1abf,_0x538258){var _0x2a55db={};var _0x55b6b1={};var _0x5e367e;var _0x2d88dd;return db['ZendeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x226f60[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x1d1abf,null))[_0xb39c('0x25')](function(_0x2f2944){if(_0x2f2944){_0x5e367e=_0x2f2944;_0x55b6b1[_0xb39c('0x2f')]=_['keys'](db[_0xb39c('0x4c')][_0xb39c('0x2c')]);_0x55b6b1[_0xb39c('0x31')]=_[_0xb39c('0x30')](_0x226f60[_0xb39c('0x31')]);_0x55b6b1['filters']=_[_0xb39c('0x33')](_0x55b6b1['model'],_0x55b6b1[_0xb39c('0x31')]);_0x2a55db[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x55b6b1[_0xb39c('0x2f')],qs[_0xb39c('0x35')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x35')]));_0x2a55db[_0xb39c('0x34')]=_0x2a55db[_0xb39c('0x34')][_0xb39c('0x36')]?_0x2a55db[_0xb39c('0x34')]:_0x55b6b1[_0xb39c('0x2f')];_0x2a55db[_0xb39c('0x4d')]=qs[_0xb39c('0x39')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x39')]);_0x2a55db[_0xb39c('0x3c')]=qs[_0xb39c('0x32')](_[_0xb39c('0x3a')](_0x226f60['query'],_0x55b6b1['filters']));if(_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]){_0x2a55db['where']=_[_0xb39c('0x3d')](_0x2a55db[_0xb39c('0x3c')],{'$or':_['map'](_0x2a55db[_0xb39c('0x34')],function(_0x121545){var _0x129d1f={};_0x129d1f[_0x121545]={'$like':'%'+_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]+'%'};return _0x129d1f;})});}_0x2a55db=_[_0xb39c('0x3d')]({},_0x2a55db,_0x226f60['options']);return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x1c16c5){if(_0x1c16c5){_0x2d88dd=_0x1c16c5[_0xb39c('0x36')];if(!_0x226f60[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x2a55db['limit']=qs[_0xb39c('0x1e')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x2a55db[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x226f60['query']['offset']);}return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x26b55f){if(_0x26b55f){return _0x26b55f?{'count':_0x2d88dd,'rows':_0x26b55f}:null;}})['then'](respondWithResult(_0x1d1abf,null))[_0xb39c('0x45')](handleError(_0x1d1abf,null));};exports['addConfiguration']=function(_0x2f3c24,_0x5ce5fb,_0x1abe57){if(_0x2f3c24[_0xb39c('0x4a')]['id']){delete _0x2f3c24[_0xb39c('0x4a')]['id'];}return db['ZendeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x2f3c24[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x5ce5fb,null))[_0xb39c('0x25')](function(_0x3e8783){if(_0x3e8783){_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x4f')]=_0x3e8783['id'];_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x50')]=integrations[_0xb39c('0x51')](_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x53')]=integrations[_0xb39c('0x54')](_0x2f3c24['body'][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);return db['ZendeskConfiguration'][_0xb39c('0x49')](_0x2f3c24['body'],{'include':[{'model':db['ZendeskField'],'as':_0xb39c('0x50')},{'model':db[_0xb39c('0x55')],'as':_0xb39c('0x53')}]});}return null;})[_0xb39c('0x25')](respondWithResult(_0x5ce5fb,null))[_0xb39c('0x45')](handleError(_0x5ce5fb,null));};exports['getFields']=function(_0x5de073,_0x26d08c,_0x27723c){var _0x5cfd2a='';return db[_0xb39c('0x2b')][_0xb39c('0x4b')]({'where':{'id':_0x5de073[_0xb39c('0x47')]['id']},'attributes':['id',_0xb39c('0x56'),_0xb39c('0x57'),_0xb39c('0x58'),_0xb39c('0x59'),_0xb39c('0x5a')]})[_0xb39c('0x25')](handleEntityNotFound(_0x26d08c,null))[_0xb39c('0x25')](function(_0xb5e7fb){if(_0xb5e7fb){_0x5cfd2a=_0xb5e7fb[_0xb39c('0x5a')];var _0x29b793=_0x5cfd2a[_0xb39c('0x5b')](-0x1);if(_0x29b793==='/'){_0x5cfd2a=_0x5cfd2a[_0xb39c('0x5c')](0x0,_0x5cfd2a['lastIndexOf'](_0x29b793));}var _0x2bba77={'method':'GET','uri':util[_0xb39c('0x5d')](_0xb39c('0x5e'),_0x5cfd2a,'ticket_fields'),'json':!![]};switch(_0xb5e7fb[_0xb39c('0x59')]){case _0xb39c('0x57'):_0x2bba77[_0xb39c('0x5f')]={'Authorization':util[_0xb39c('0x5d')](_0xb39c('0x60'),new Buffer(util[_0xb39c('0x5d')]('%s:%s',_0xb5e7fb[_0xb39c('0x56')],_0xb5e7fb[_0xb39c('0x57')]))[_0xb39c('0x61')](_0xb39c('0x62')))};break;case _0xb39c('0x58'):_0x2bba77[_0xb39c('0x5f')]={'Authorization':util[_0xb39c('0x5d')](_0xb39c('0x60'),new Buffer(util[_0xb39c('0x5d')]('%s/token:%s',_0xb5e7fb[_0xb39c('0x56')],_0xb5e7fb[_0xb39c('0x58')]))[_0xb39c('0x61')](_0xb39c('0x62')))};break;default:throw new db[(_0xb39c('0x63'))][(_0xb39c('0x64'))](_0xb39c('0x65'));}return rp(_0x2bba77);}})['then'](function(_0x29b32c){if(_0x29b32c){var _0xe23f8=[_0xb39c('0x66'),_0xb39c('0x67'),_0xb39c('0x68'),_0xb39c('0x69')];_[_0xb39c('0x6a')](_0x29b32c[_0xb39c('0x6b')],function(_0x483be1){return _0xe23f8[_0xb39c('0x6c')](_0x483be1['type']);});return{'count':_0x29b32c[_0xb39c('0x6b')][_0xb39c('0x36')],'rows':_[_0xb39c('0x3e')](_0x29b32c[_0xb39c('0x6b')],function(_0x37f395){return{'id':_0x37f395['id'],'name':_0x37f395[_0xb39c('0x6d')]>0x7?_0x37f395[_0xb39c('0x6e')]:_0x37f395[_0xb39c('0x2e')],'custom':_0x37f395['position']>0x7?!![]:![],'options':_0x37f395[_0xb39c('0x6f')]?_0x37f395[_0xb39c('0x6f')]:_0x37f395[_0xb39c('0x70')]?_0x37f395[_0xb39c('0x70')]:[]};})};}})[_0xb39c('0x25')](respondWithResult(_0x26d08c,null))[_0xb39c('0x45')](function(_0x26f2a0){var _0x46dcef=_0x5de073[_0xb39c('0x31')][_0xb39c('0x71')]?0x1f4:_0x26f2a0[_0xb39c('0x72')]||0x1f4;logger[_0xb39c('0x27')](_0xb39c('0x73'),_0xb39c('0x74'),_0x46dcef,JSON[_0xb39c('0x75')](_0x26f2a0));delete _0x26f2a0[_0xb39c('0x28')];if(_0x46dcef===0x191){_0x46dcef=0x190;}_0x26d08c['status'](_0x46dcef)['send'](_0x5de073[_0xb39c('0x31')][_0xb39c('0x71')]?{'message':_0xb39c('0x76'),'statusCode':_0x26f2a0['statusCode']}:_0x26f2a0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 135502c..a77ea2d 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.model.js +++ b/server/api/intZendeskAccount/intZendeskAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x070b=['define','int_zendesk_accounts','lodash','util','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x4421a0,_0x1525bc){var _0x5626d0=function(_0x56d43e){while(--_0x56d43e){_0x4421a0['push'](_0x4421a0['shift']());}};_0x5626d0(++_0x1525bc);}(_0x070b,0x124));var _0xb070=function(_0x1a5046,_0x563002){_0x1a5046=_0x1a5046-0x0;var _0x5a14c2=_0x070b[_0x1a5046];return _0x5a14c2;};'use strict';var _=require(_0xb070('0x0'));var util=require(_0xb070('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb070('0x2'));var rp=require(_0xb070('0x3'));var fs=require('fs');var path=require(_0xb070('0x4'));var rimraf=require('rimraf');var config=require(_0xb070('0x5'));var attributes=require(_0xb070('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xb070('0x7')]=function(_0x2c7589,_0x4a1d57){return _0x2c7589[_0xb070('0x8')]('ZendeskAccount',attributes,{'tableName':_0xb070('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc605=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x1140e8,_0x3a8078){var _0x2d57b2=function(_0x336eb4){while(--_0x336eb4){_0x1140e8['push'](_0x1140e8['shift']());}};_0x2d57b2(++_0x3a8078);}(_0xc605,0x7c));var _0x5c60=function(_0x3c870e,_0x399ed4){_0x3c870e=_0x3c870e-0x0;var _0xf193ba=_0xc605[_0x3c870e];return _0xf193ba;};'use strict';var _=require(_0x5c60('0x0'));var util=require(_0x5c60('0x1'));var logger=require(_0x5c60('0x2'))(_0x5c60('0x3'));var moment=require(_0x5c60('0x4'));var BPromise=require(_0x5c60('0x5'));var rp=require(_0x5c60('0x6'));var fs=require('fs');var path=require(_0x5c60('0x7'));var rimraf=require(_0x5c60('0x8'));var config=require(_0x5c60('0x9'));var attributes=require(_0x5c60('0xa'));var integrations=require(_0x5c60('0xb'));module[_0x5c60('0xc')]=function(_0x340f6c,_0x25b5b8){return _0x340f6c[_0x5c60('0xd')](_0x5c60('0xe'),attributes,{'tableName':_0x5c60('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 3b16640..6a8d99b 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aeb=['attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8aeb,0x1ce));var _0xb8ae=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x8aeb[_0x3fcc20];return _0x15d3ce;};'use strict';var _=require(_0xb8ae('0x0'));var util=require(_0xb8ae('0x1'));var moment=require(_0xb8ae('0x2'));var BPromise=require(_0xb8ae('0x3'));var rs=require(_0xb8ae('0x4'));var fs=require('fs');var Redis=require(_0xb8ae('0x5'));var db=require(_0xb8ae('0x6'))['db'];var utils=require(_0xb8ae('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb8ae('0x8'));var jayson=require(_0xb8ae('0x9'));var client=jayson['client'][_0xb8ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f380b,_0x1e3124,_0x883a53){return new BPromise(function(_0x49c3e8,_0x463594){return client['request'](_0x5f380b,_0x883a53)[_0xb8ae('0xb')](function(_0x57fe79){logger[_0xb8ae('0xc')](_0xb8ae('0xd'),_0x1e3124,_0xb8ae('0xe'));logger[_0xb8ae('0xf')](_0xb8ae('0x10'),_0x1e3124,_0xb8ae('0xe'),JSON[_0xb8ae('0x11')](_0x57fe79));if(_0x57fe79[_0xb8ae('0x12')]){if(_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x13')]===0x1f4){logger[_0xb8ae('0x12')](_0xb8ae('0xd'),_0x1e3124,_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x14')]);return _0x463594(_0x57fe79[_0xb8ae('0x12')][_0xb8ae('0x14')]);}logger['error'](_0xb8ae('0xd'),_0x1e3124,_0x57fe79['error'][_0xb8ae('0x14')]);return _0x49c3e8(_0x57fe79[_0xb8ae('0x12')]['message']);}else{logger[_0xb8ae('0xc')](_0xb8ae('0xd'),_0x1e3124,_0xb8ae('0xe'));_0x49c3e8(_0x57fe79[_0xb8ae('0x15')][_0xb8ae('0x14')]);}})[_0xb8ae('0x16')](function(_0x27a53c){logger[_0xb8ae('0x12')](_0xb8ae('0xd'),_0x1e3124,_0x27a53c);_0x463594(_0x27a53c);});});}exports[_0xb8ae('0x17')]=function(_0x1a6544){var _0xb2f222=this;return new Promise(function(_0x47b19c,_0x181d92){return db[_0xb8ae('0x18')][_0xb8ae('0x19')]({'raw':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a6544['options']?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1b')]||null:null,'attributes':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1c')]||null:null,'limit':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1d')]||null:null,'include':_0x1a6544[_0xb8ae('0x1a')]?_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1e')]?_['map'](_0x1a6544[_0xb8ae('0x1a')][_0xb8ae('0x1e')],function(_0x1638e4){return{'model':db[_0x1638e4[_0xb8ae('0x1f')]],'as':_0x1638e4['as'],'attributes':_0x1638e4['attributes'],'include':_0x1638e4[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x1638e4[_0xb8ae('0x1e')],function(_0x5a6667){return{'model':db[_0x5a6667[_0xb8ae('0x1f')]],'as':_0x5a6667['as'],'attributes':_0x5a6667[_0xb8ae('0x1c')],'include':_0x5a6667[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x5a6667[_0xb8ae('0x1e')],function(_0xb81a8){return{'model':db[_0xb81a8[_0xb8ae('0x1f')]],'as':_0xb81a8['as'],'attributes':_0xb81a8[_0xb8ae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb8ae('0xb')](function(_0x5dde6c){logger['info'](_0xb8ae('0x17'),_0x1a6544);logger[_0xb8ae('0xf')](_0xb8ae('0x17'),_0x1a6544,JSON['stringify'](_0x5dde6c));_0x47b19c(_0x5dde6c);})[_0xb8ae('0x16')](function(_0x2866e5){logger[_0xb8ae('0x12')]('GetZendeskAccount',_0x2866e5['message'],_0x1a6544);_0x181d92(_0xb2f222[_0xb8ae('0x12')](0x1f4,_0x2866e5[_0xb8ae('0x14')]));});});};exports[_0xb8ae('0x21')]=function(_0x242f02){var _0x1a23e0=this;return new Promise(function(_0x46d595,_0x2a6650){return db[_0xb8ae('0x18')][_0xb8ae('0x22')]({'raw':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')][_0xb8ae('0x1b')]||null:null,'attributes':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')]['attributes']||null:null,'include':_0x242f02[_0xb8ae('0x1a')]?_0x242f02[_0xb8ae('0x1a')][_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x242f02[_0xb8ae('0x1a')]['include'],function(_0x104dea){return{'model':db[_0x104dea[_0xb8ae('0x1f')]],'as':_0x104dea['as'],'attributes':_0x104dea[_0xb8ae('0x1c')],'include':_0x104dea[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x104dea[_0xb8ae('0x1e')],function(_0x576ba3){return{'model':db[_0x576ba3[_0xb8ae('0x1f')]],'as':_0x576ba3['as'],'attributes':_0x576ba3[_0xb8ae('0x1c')],'include':_0x576ba3[_0xb8ae('0x1e')]?_[_0xb8ae('0x20')](_0x576ba3[_0xb8ae('0x1e')],function(_0x5d0142){return{'model':db[_0x5d0142[_0xb8ae('0x1f')]],'as':_0x5d0142['as'],'attributes':_0x5d0142[_0xb8ae('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb8ae('0xb')](function(_0x25c5be){logger[_0xb8ae('0xc')](_0xb8ae('0x21'),_0x242f02);logger['debug'](_0xb8ae('0x21'),_0x242f02,JSON[_0xb8ae('0x11')](_0x25c5be));_0x46d595(_0x25c5be);})[_0xb8ae('0x16')](function(_0x114fe2){logger[_0xb8ae('0x12')]('ShowZendeskAccount',_0x114fe2['message'],_0x242f02);_0x2a6650(_0x1a23e0[_0xb8ae('0x12')](0x1f4,_0x114fe2[_0xb8ae('0x14')]));});});}; \ No newline at end of file +var _0x058f=['map','model','GetZendeskAccount','stringify','catch','ShowZendeskAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','ZendeskAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x51d3ac,_0x2cdcfc){var _0x29b333=function(_0xd4e32){while(--_0xd4e32){_0x51d3ac['push'](_0x51d3ac['shift']());}};_0x29b333(++_0x2cdcfc);}(_0x058f,0x166));var _0xf058=function(_0x640d19,_0x4de398){_0x640d19=_0x640d19-0x0;var _0x235bcf=_0x058f[_0x640d19];return _0x235bcf;};'use strict';var _=require('lodash');var util=require(_0xf058('0x0'));var moment=require(_0xf058('0x1'));var BPromise=require('bluebird');var rs=require(_0xf058('0x2'));var fs=require('fs');var Redis=require(_0xf058('0x3'));var db=require(_0xf058('0x4'))['db'];var utils=require(_0xf058('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf058('0x6'));var jayson=require(_0xf058('0x7'));var client=jayson[_0xf058('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13ffdf,_0x5a165a,_0xb4c2b1){return new BPromise(function(_0x2af855,_0x479b7c){return client[_0xf058('0x9')](_0x13ffdf,_0xb4c2b1)[_0xf058('0xa')](function(_0x55e167){logger['info'](_0xf058('0xb'),_0x5a165a,_0xf058('0xc'));logger[_0xf058('0xd')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5a165a,_0xf058('0xc'),JSON['stringify'](_0x55e167));if(_0x55e167[_0xf058('0xe')]){if(_0x55e167[_0xf058('0xe')][_0xf058('0xf')]===0x1f4){logger[_0xf058('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x5a165a,_0x55e167['error']['message']);return _0x479b7c(_0x55e167[_0xf058('0xe')][_0xf058('0x10')]);}logger['error'](_0xf058('0xb'),_0x5a165a,_0x55e167[_0xf058('0xe')]['message']);return _0x2af855(_0x55e167[_0xf058('0xe')]['message']);}else{logger[_0xf058('0x11')](_0xf058('0xb'),_0x5a165a,'request\x20sent');_0x2af855(_0x55e167['result'][_0xf058('0x10')]);}})['catch'](function(_0x1af492){logger[_0xf058('0xe')](_0xf058('0xb'),_0x5a165a,_0x1af492);_0x479b7c(_0x1af492);});});}exports['GetZendeskAccount']=function(_0xaccaf){var _0x49c759=this;return new Promise(function(_0x5e1240,_0x3a86d3){return db[_0xf058('0x12')][_0xf058('0x13')]({'raw':_0xaccaf[_0xf058('0x14')]?_0xaccaf['options'][_0xf058('0x15')]===undefined?!![]:![]:!![],'where':_0xaccaf[_0xf058('0x14')]?_0xaccaf[_0xf058('0x14')][_0xf058('0x16')]||null:null,'attributes':_0xaccaf['options']?_0xaccaf[_0xf058('0x14')][_0xf058('0x17')]||null:null,'limit':_0xaccaf[_0xf058('0x14')]?_0xaccaf[_0xf058('0x14')][_0xf058('0x18')]||null:null,'include':_0xaccaf[_0xf058('0x14')]?_0xaccaf['options'][_0xf058('0x19')]?_[_0xf058('0x1a')](_0xaccaf[_0xf058('0x14')][_0xf058('0x19')],function(_0x189081){return{'model':db[_0x189081[_0xf058('0x1b')]],'as':_0x189081['as'],'attributes':_0x189081[_0xf058('0x17')],'include':_0x189081[_0xf058('0x19')]?_['map'](_0x189081[_0xf058('0x19')],function(_0x495688){return{'model':db[_0x495688[_0xf058('0x1b')]],'as':_0x495688['as'],'attributes':_0x495688[_0xf058('0x17')],'include':_0x495688[_0xf058('0x19')]?_[_0xf058('0x1a')](_0x495688[_0xf058('0x19')],function(_0x419023){return{'model':db[_0x419023['model']],'as':_0x419023['as'],'attributes':_0x419023['attributes']};}):[]};}):[]};}):[]:[]})[_0xf058('0xa')](function(_0x20c7ed){logger[_0xf058('0x11')](_0xf058('0x1c'),_0xaccaf);logger['debug'](_0xf058('0x1c'),_0xaccaf,JSON[_0xf058('0x1d')](_0x20c7ed));_0x5e1240(_0x20c7ed);})[_0xf058('0x1e')](function(_0x412590){logger[_0xf058('0xe')]('GetZendeskAccount',_0x412590[_0xf058('0x10')],_0xaccaf);_0x3a86d3(_0x49c759[_0xf058('0xe')](0x1f4,_0x412590[_0xf058('0x10')]));});});};exports[_0xf058('0x1f')]=function(_0x595427){var _0x1cbc2b=this;return new Promise(function(_0xa47689,_0x326590){return db['ZendeskAccount']['find']({'raw':_0x595427['options']?_0x595427[_0xf058('0x14')][_0xf058('0x15')]===undefined?!![]:![]:!![],'where':_0x595427[_0xf058('0x14')]?_0x595427[_0xf058('0x14')][_0xf058('0x16')]||null:null,'attributes':_0x595427[_0xf058('0x14')]?_0x595427[_0xf058('0x14')][_0xf058('0x17')]||null:null,'include':_0x595427[_0xf058('0x14')]?_0x595427[_0xf058('0x14')][_0xf058('0x19')]?_[_0xf058('0x1a')](_0x595427[_0xf058('0x14')][_0xf058('0x19')],function(_0x275748){return{'model':db[_0x275748[_0xf058('0x1b')]],'as':_0x275748['as'],'attributes':_0x275748[_0xf058('0x17')],'include':_0x275748[_0xf058('0x19')]?_[_0xf058('0x1a')](_0x275748[_0xf058('0x19')],function(_0x58a67c){return{'model':db[_0x58a67c['model']],'as':_0x58a67c['as'],'attributes':_0x58a67c[_0xf058('0x17')],'include':_0x58a67c[_0xf058('0x19')]?_[_0xf058('0x1a')](_0x58a67c[_0xf058('0x19')],function(_0x51741f){return{'model':db[_0x51741f[_0xf058('0x1b')]],'as':_0x51741f['as'],'attributes':_0x51741f[_0xf058('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf058('0xa')](function(_0x30690d){logger[_0xf058('0x11')](_0xf058('0x1f'),_0x595427);logger[_0xf058('0xd')]('ShowZendeskAccount',_0x595427,JSON[_0xf058('0x1d')](_0x30690d));_0xa47689(_0x30690d);})[_0xf058('0x1e')](function(_0x5d876d){logger[_0xf058('0xe')](_0xf058('0x1f'),_0x5d876d[_0xf058('0x10')],_0x595427);_0x326590(_0x1cbc2b[_0xf058('0xe')](0x1f4,_0x5d876d[_0xf058('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index cd2c614..b873254 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x40425a,_0x1c483b){var _0x178913=function(_0x5ea1d8){while(--_0x5ea1d8){_0x40425a['push'](_0x40425a['shift']());}};_0x178913(++_0x1c483b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1bda6c,_0x5440b1){_0x1bda6c=_0x1bda6c-0x0;var _0x501a86=_0x5eb8[_0x1bda6c];return _0x501a86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0xb688,0xcf));var _0x8b68=function(_0x4b02cb,_0x21a8de){_0x4b02cb=_0x4b02cb-0x0;var _0x1bb99e=_0xb688[_0x4b02cb];return _0x1bb99e;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4fba652..5e7a1db 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8956=['exports','sequelize'];(function(_0x4802d3,_0x249890){var _0x22b852=function(_0x45588c){while(--_0x45588c){_0x4802d3['push'](_0x4802d3['shift']());}};_0x22b852(++_0x249890);}(_0x8956,0xed));var _0x6895=function(_0x2ecfc4,_0x14585d){_0x2ecfc4=_0x2ecfc4-0x0;var _0x536372=_0x8956[_0x2ecfc4];return _0x536372;};'use strict';var Sequelize=require(_0x6895('0x0'));module[_0x6895('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6e6=['STRING'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0xd6e6,0x17f));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d6e('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d7e2e5b..dc1f0e3 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3c9=['keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','find','findOne','ZendeskField','merge','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query'];(function(_0xe37cad,_0x9fcbdd){var _0x24593e=function(_0x4170bb){while(--_0x4170bb){_0xe37cad['push'](_0xe37cad['shift']());}};_0x24593e(++_0x9fcbdd);}(_0xe3c9,0x1dd));var _0x9e3c=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xe3c9[_0x209941];return _0x1e8729;};'use strict';var emlformat=require(_0x9e3c('0x0'));var rimraf=require(_0x9e3c('0x1'));var zipdir=require(_0x9e3c('0x2'));var jsonpatch=require(_0x9e3c('0x3'));var rp=require(_0x9e3c('0x4'));var moment=require(_0x9e3c('0x5'));var BPromise=require(_0x9e3c('0x6'));var Mustache=require('mustache');var util=require(_0x9e3c('0x7'));var path=require(_0x9e3c('0x8'));var sox=require(_0x9e3c('0x9'));var csv=require('to-csv');var ejs=require(_0x9e3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9e3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x9e3c('0xc'));var deskjs=require(_0x9e3c('0xd'));var toCsv=require(_0x9e3c('0xe'));var querystring=require(_0x9e3c('0xf'));var Papa=require(_0x9e3c('0x10'));var Redis=require(_0x9e3c('0x11'));var authService=require(_0x9e3c('0x12'));var qs=require(_0x9e3c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e3c('0x14'));var logger=require('../../config/logger')(_0x9e3c('0x15'));var utils=require(_0x9e3c('0x16'));var config=require(_0x9e3c('0x17'));var licenseUtil=require(_0x9e3c('0x18'));var db=require(_0x9e3c('0x19'))['db'];function respondWithStatusCode(_0xf73e6,_0x550c22){_0x550c22=_0x550c22||0xcc;return function(_0x2228b9){if(_0x2228b9){return _0xf73e6['sendStatus'](_0x550c22);}return _0xf73e6['status'](_0x550c22)[_0x9e3c('0x1a')]();};}function respondWithResult(_0x38b9dd,_0x427d80){_0x427d80=_0x427d80||0xc8;return function(_0x5d03d2){if(_0x5d03d2){return _0x38b9dd[_0x9e3c('0x1b')](_0x427d80)[_0x9e3c('0x1c')](_0x5d03d2);}};}function respondWithFilteredResult(_0x2631bd,_0x1fac25){return function(_0x496f3b){if(_0x496f3b){var _0x4720b4=typeof _0x1fac25[_0x9e3c('0x1d')]===_0x9e3c('0x1e')&&typeof _0x1fac25[_0x9e3c('0x1f')]===_0x9e3c('0x1e');var _0xe4f966=_0x496f3b[_0x9e3c('0x20')];var _0x288f4c=_0x4720b4?0x0:_0x1fac25['offset'];var _0x3eee29=_0x4720b4?_0x496f3b['count']:_0x1fac25[_0x9e3c('0x1d')]+_0x1fac25['limit'];var _0x44722e;if(_0x3eee29>=_0xe4f966){_0x3eee29=_0xe4f966;_0x44722e=0xc8;}else{_0x44722e=0xce;}_0x2631bd[_0x9e3c('0x1b')](_0x44722e);return _0x2631bd[_0x9e3c('0x21')](_0x9e3c('0x22'),_0x288f4c+'-'+_0x3eee29+'/'+_0xe4f966)[_0x9e3c('0x1c')](_0x496f3b);}return null;};}function patchUpdates(_0x5dabfa){return function(_0x57096b){try{jsonpatch[_0x9e3c('0x23')](_0x57096b,_0x5dabfa,!![]);}catch(_0x14ffbc){return BPromise[_0x9e3c('0x24')](_0x14ffbc);}return _0x57096b['save']();};}function saveUpdates(_0x9c3411,_0x56202a){return function(_0x3becd1){if(_0x3becd1){return _0x3becd1['update'](_0x9c3411)[_0x9e3c('0x25')](function(_0x1f8dc1){return _0x1f8dc1;});}return null;};}function removeEntity(_0x474ef2,_0x51d9e0){return function(_0x106692){if(_0x106692){return _0x106692['destroy']()[_0x9e3c('0x25')](function(){_0x474ef2[_0x9e3c('0x1b')](0xcc)[_0x9e3c('0x1a')]();});}};}function handleEntityNotFound(_0x5e6e56,_0xc9cd40){return function(_0x1f94c3){if(!_0x1f94c3){_0x5e6e56[_0x9e3c('0x26')](0x194);}return _0x1f94c3;};}function handleError(_0x3af2b8,_0x422324){_0x422324=_0x422324||0x1f4;return function(_0x164588){logger[_0x9e3c('0x27')](_0x164588[_0x9e3c('0x28')]);if(_0x164588['name']){delete _0x164588[_0x9e3c('0x29')];}_0x3af2b8[_0x9e3c('0x1b')](_0x422324)['send'](_0x164588);};}exports[_0x9e3c('0x2a')]=function(_0xe4b4c8,_0x2af732){var _0x529777={},_0x2003c7={},_0x2744bb={'count':0x0,'rows':[]};var _0x401609=_[_0x9e3c('0x2b')](db[_0x9e3c('0x2c')][_0x9e3c('0x2d')],function(_0x194668){return{'name':_0x194668[_0x9e3c('0x2e')],'type':_0x194668[_0x9e3c('0x2f')][_0x9e3c('0x30')]};});_0x2003c7[_0x9e3c('0x31')]=_[_0x9e3c('0x2b')](_0x401609,_0x9e3c('0x29'));_0x2003c7[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0xe4b4c8['query']);_0x2003c7[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2003c7[_0x9e3c('0x31')],_0x2003c7[_0x9e3c('0x32')]);_0x529777[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x2003c7['model'],qs[_0x9e3c('0x37')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x529777[_0x9e3c('0x36')]=_0x529777[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x529777[_0x9e3c('0x36')]:_0x2003c7['model'];if(!_0xe4b4c8[_0x9e3c('0x32')]['hasOwnProperty'](_0x9e3c('0x39'))){_0x529777[_0x9e3c('0x1f')]=qs[_0x9e3c('0x1f')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x529777[_0x9e3c('0x1d')]=qs[_0x9e3c('0x1d')](_0xe4b4c8[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}_0x529777[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0xe4b4c8['query'][_0x9e3c('0x3b')]);_0x529777['where']=qs['filters'](_[_0x9e3c('0x3c')](_0xe4b4c8[_0x9e3c('0x32')],_0x2003c7[_0x9e3c('0x34')]),_0x401609);if(_0xe4b4c8['query'][_0x9e3c('0x3d')]){_0x529777[_0x9e3c('0x3e')]=_['merge'](_0x529777[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0x401609,function(_0x3bfe96){if(_0x3bfe96[_0x9e3c('0x2f')]!==_0x9e3c('0x3f')){var _0x45db4d={};_0x45db4d[_0x3bfe96[_0x9e3c('0x29')]]={'$like':'%'+_0xe4b4c8['query'][_0x9e3c('0x3d')]+'%'};return _0x45db4d;}})});}_0x529777=_['merge']({},_0x529777,_0xe4b4c8[_0x9e3c('0x40')]);var _0x448c62={'where':_0x529777[_0x9e3c('0x3e')]};return db[_0x9e3c('0x2c')][_0x9e3c('0x20')](_0x448c62)[_0x9e3c('0x25')](function(_0x5b56c0){_0x2744bb[_0x9e3c('0x20')]=_0x5b56c0;if(_0xe4b4c8['query'][_0x9e3c('0x41')]){_0x529777[_0x9e3c('0x42')]=[{'all':!![]}];}return db[_0x9e3c('0x2c')][_0x9e3c('0x43')](_0x529777);})[_0x9e3c('0x25')](function(_0x234bf2){_0x2744bb[_0x9e3c('0x44')]=_0x234bf2;return _0x2744bb;})['then'](respondWithFilteredResult(_0x2af732,_0x529777))[_0x9e3c('0x45')](handleError(_0x2af732,null));};exports[_0x9e3c('0x46')]=function(_0x30e426,_0x27e435){var _0x4713d4={'raw':![],'where':{'id':_0x30e426[_0x9e3c('0x47')]['id']}},_0x53d2f8={};_0x53d2f8[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x2c')]['rawAttributes']);_0x53d2f8[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x30e426['query']);_0x53d2f8['filters']=_[_0x9e3c('0x35')](_0x53d2f8['model'],_0x53d2f8['query']);_0x4713d4[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x53d2f8[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x30e426[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x4713d4[_0x9e3c('0x36')]=_0x4713d4[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x4713d4[_0x9e3c('0x36')]:_0x53d2f8[_0x9e3c('0x31')];if(_0x30e426['query'][_0x9e3c('0x41')]){_0x4713d4[_0x9e3c('0x42')]=[{'all':!![]}];}_0x4713d4=_['merge']({},_0x4713d4,_0x30e426['options']);return db['ZendeskConfiguration']['find'](_0x4713d4)[_0x9e3c('0x25')](handleEntityNotFound(_0x27e435,null))['then'](respondWithResult(_0x27e435,null))[_0x9e3c('0x45')](handleError(_0x27e435,null));};exports['create']=function(_0x4294b4,_0x39c8f6){return db[_0x9e3c('0x2c')][_0x9e3c('0x48')](_0x4294b4[_0x9e3c('0x49')],{})[_0x9e3c('0x25')](respondWithResult(_0x39c8f6,0xc9))['catch'](handleError(_0x39c8f6,null));};exports[_0x9e3c('0x4a')]=function(_0x31e2ec,_0x4c07b2){if(_0x31e2ec[_0x9e3c('0x49')]['id']){delete _0x31e2ec[_0x9e3c('0x49')]['id'];}return db[_0x9e3c('0x2c')]['find']({'where':{'id':_0x31e2ec[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x4c07b2,null))[_0x9e3c('0x25')](saveUpdates(_0x31e2ec[_0x9e3c('0x49')],null))[_0x9e3c('0x25')](respondWithResult(_0x4c07b2,null))['catch'](handleError(_0x4c07b2,null));};exports[_0x9e3c('0x4b')]=function(_0x4db292,_0x386610){return db[_0x9e3c('0x2c')][_0x9e3c('0x4c')]({'where':{'id':_0x4db292['params']['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x386610,null))[_0x9e3c('0x25')](removeEntity(_0x386610,null))[_0x9e3c('0x45')](handleError(_0x386610,null));};exports['getFields']=function(_0x40566a,_0x37cad6,_0x201e07){var _0x20e963={};var _0x2935db={};var _0x4ff1c1;var _0x5f594e;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x40566a['params']['id']}})['then'](handleEntityNotFound(_0x37cad6,null))[_0x9e3c('0x25')](function(_0x3601c1){if(_0x3601c1){_0x4ff1c1=_0x3601c1;_0x2935db[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x4e')][_0x9e3c('0x2d')]);_0x2935db[_0x9e3c('0x32')]=_['keys'](_0x40566a[_0x9e3c('0x32')]);_0x2935db[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2935db[_0x9e3c('0x31')],_0x2935db['query']);_0x20e963[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x2935db[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x20e963[_0x9e3c('0x36')]=_0x20e963['attributes'][_0x9e3c('0x38')]?_0x20e963[_0x9e3c('0x36')]:_0x2935db[_0x9e3c('0x31')];_0x20e963[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x40566a['query']['sort']);_0x20e963[_0x9e3c('0x3e')]=qs['filters'](_[_0x9e3c('0x3c')](_0x40566a[_0x9e3c('0x32')],_0x2935db[_0x9e3c('0x34')]));if(_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x3d')]){_0x20e963[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x20e963['where'],{'$or':_['map'](_0x20e963[_0x9e3c('0x36')],function(_0xefeff2){var _0x55fd2e={};_0x55fd2e[_0xefeff2]={'$like':'%'+_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x55fd2e;})});}_0x20e963=_[_0x9e3c('0x4f')]({},_0x20e963,_0x40566a[_0x9e3c('0x40')]);return _0x4ff1c1[_0x9e3c('0x50')](_0x20e963);}})[_0x9e3c('0x25')](function(_0x186d89){if(_0x186d89){_0x5f594e=_0x186d89[_0x9e3c('0x38')];if(!_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x51')](_0x9e3c('0x39'))){_0x20e963['limit']=qs[_0x9e3c('0x1f')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x20e963['offset']=qs[_0x9e3c('0x1d')](_0x40566a[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x4ff1c1[_0x9e3c('0x50')](_0x20e963);}})[_0x9e3c('0x25')](function(_0x4e6b1b){if(_0x4e6b1b){return _0x4e6b1b?{'count':_0x5f594e,'rows':_0x4e6b1b}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x37cad6,null))[_0x9e3c('0x45')](handleError(_0x37cad6,null));};exports[_0x9e3c('0x52')]=function(_0x3ce7e2,_0x2f0231,_0x1951d5){var _0xa3ef60={};var _0x126119={};var _0x4af277;var _0x397cb4;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x3ce7e2[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x2f0231,null))['then'](function(_0xa98204){if(_0xa98204){_0x4af277=_0xa98204;_0x126119['model']=_['keys'](db['ZendeskField'][_0x9e3c('0x2d')]);_0x126119[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x3ce7e2['query']);_0x126119[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x126119[_0x9e3c('0x31')],_0x126119['query']);_0xa3ef60[_0x9e3c('0x36')]=_[_0x9e3c('0x35')](_0x126119[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0xa3ef60[_0x9e3c('0x36')]=_0xa3ef60['attributes']['length']?_0xa3ef60[_0x9e3c('0x36')]:_0x126119[_0x9e3c('0x31')];_0xa3ef60[_0x9e3c('0x3a')]=qs['sort'](_0x3ce7e2['query'][_0x9e3c('0x3b')]);_0xa3ef60[_0x9e3c('0x3e')]=qs[_0x9e3c('0x34')](_[_0x9e3c('0x3c')](_0x3ce7e2['query'],_0x126119[_0x9e3c('0x34')]));if(_0x3ce7e2['query'][_0x9e3c('0x3d')]){_0xa3ef60[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0xa3ef60[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0xa3ef60[_0x9e3c('0x36')],function(_0x58cca7){var _0x464dd5={};_0x464dd5[_0x58cca7]={'$like':'%'+_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x464dd5;})});}_0xa3ef60=_[_0x9e3c('0x4f')]({},_0xa3ef60,_0x3ce7e2[_0x9e3c('0x40')]);return _0x4af277[_0x9e3c('0x52')](_0xa3ef60);}})['then'](function(_0x579463){if(_0x579463){_0x397cb4=_0x579463['length'];if(!_0x3ce7e2['query']['hasOwnProperty'](_0x9e3c('0x39'))){_0xa3ef60['limit']=qs[_0x9e3c('0x1f')](_0x3ce7e2['query']['limit']);_0xa3ef60['offset']=qs['offset'](_0x3ce7e2[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x4af277['getSubjects'](_0xa3ef60);}})['then'](function(_0xb1d4cf){if(_0xb1d4cf){return _0xb1d4cf?{'count':_0x397cb4,'rows':_0xb1d4cf}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x2f0231,null))[_0x9e3c('0x45')](handleError(_0x2f0231,null));};exports['getDescriptions']=function(_0x124d16,_0x38e6b2,_0x1af391){var _0x50b8e0={};var _0x2e9374={};var _0x36da1e;var _0x3e1ad2;return db[_0x9e3c('0x2c')]['findOne']({'where':{'id':_0x124d16[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x38e6b2,null))['then'](function(_0x1eec65){if(_0x1eec65){_0x36da1e=_0x1eec65;_0x2e9374[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x4e')][_0x9e3c('0x2d')]);_0x2e9374['query']=_[_0x9e3c('0x33')](_0x124d16['query']);_0x2e9374[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x2e9374[_0x9e3c('0x31')],_0x2e9374[_0x9e3c('0x32')]);_0x50b8e0['attributes']=_[_0x9e3c('0x35')](_0x2e9374['model'],qs['fields'](_0x124d16[_0x9e3c('0x32')]['fields']));_0x50b8e0[_0x9e3c('0x36')]=_0x50b8e0[_0x9e3c('0x36')][_0x9e3c('0x38')]?_0x50b8e0[_0x9e3c('0x36')]:_0x2e9374[_0x9e3c('0x31')];_0x50b8e0[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x3b')]);_0x50b8e0[_0x9e3c('0x3e')]=qs[_0x9e3c('0x34')](_[_0x9e3c('0x3c')](_0x124d16[_0x9e3c('0x32')],_0x2e9374['filters']));if(_0x124d16[_0x9e3c('0x32')]['filter']){_0x50b8e0[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x50b8e0[_0x9e3c('0x3e')],{'$or':_[_0x9e3c('0x2b')](_0x50b8e0[_0x9e3c('0x36')],function(_0x17b255){var _0x4932be={};_0x4932be[_0x17b255]={'$like':'%'+_0x124d16['query']['filter']+'%'};return _0x4932be;})});}_0x50b8e0=_[_0x9e3c('0x4f')]({},_0x50b8e0,_0x124d16[_0x9e3c('0x40')]);return _0x36da1e[_0x9e3c('0x53')](_0x50b8e0);}})['then'](function(_0x1f7398){if(_0x1f7398){_0x3e1ad2=_0x1f7398[_0x9e3c('0x38')];if(!_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x51')]('nolimit')){_0x50b8e0['limit']=qs[_0x9e3c('0x1f')](_0x124d16[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x50b8e0['offset']=qs['offset'](_0x124d16[_0x9e3c('0x32')]['offset']);}return _0x36da1e['getDescriptions'](_0x50b8e0);}})[_0x9e3c('0x25')](function(_0x3eba18){if(_0x3eba18){return _0x3eba18?{'count':_0x3e1ad2,'rows':_0x3eba18}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x38e6b2,null))[_0x9e3c('0x45')](handleError(_0x38e6b2,null));};exports[_0x9e3c('0x54')]=function(_0x463359,_0x483fe6,_0x58d64e){var _0x2ab1fc={};var _0x123e89={};var _0x2ff7e5;var _0x4084a0;return db[_0x9e3c('0x2c')][_0x9e3c('0x4d')]({'where':{'id':_0x463359[_0x9e3c('0x47')]['id']}})[_0x9e3c('0x25')](handleEntityNotFound(_0x483fe6,null))[_0x9e3c('0x25')](function(_0x534623){if(_0x534623){_0x2ff7e5=_0x534623;_0x123e89[_0x9e3c('0x31')]=_[_0x9e3c('0x33')](db[_0x9e3c('0x55')][_0x9e3c('0x2d')]);_0x123e89[_0x9e3c('0x32')]=_[_0x9e3c('0x33')](_0x463359[_0x9e3c('0x32')]);_0x123e89[_0x9e3c('0x34')]=_[_0x9e3c('0x35')](_0x123e89[_0x9e3c('0x31')],_0x123e89[_0x9e3c('0x32')]);_0x2ab1fc['attributes']=_[_0x9e3c('0x35')](_0x123e89[_0x9e3c('0x31')],qs[_0x9e3c('0x37')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x37')]));_0x2ab1fc['attributes']=_0x2ab1fc['attributes']['length']?_0x2ab1fc[_0x9e3c('0x36')]:_0x123e89[_0x9e3c('0x31')];_0x2ab1fc[_0x9e3c('0x3a')]=qs[_0x9e3c('0x3b')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3b')]);_0x2ab1fc[_0x9e3c('0x3e')]=qs['filters'](_[_0x9e3c('0x3c')](_0x463359[_0x9e3c('0x32')],_0x123e89[_0x9e3c('0x34')]));if(_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3d')]){_0x2ab1fc[_0x9e3c('0x3e')]=_[_0x9e3c('0x4f')](_0x2ab1fc['where'],{'$or':_[_0x9e3c('0x2b')](_0x2ab1fc[_0x9e3c('0x36')],function(_0x17031a){var _0x7859a1={};_0x7859a1[_0x17031a]={'$like':'%'+_0x463359[_0x9e3c('0x32')][_0x9e3c('0x3d')]+'%'};return _0x7859a1;})});}_0x2ab1fc=_['merge']({},_0x2ab1fc,_0x463359[_0x9e3c('0x40')]);return _0x2ff7e5['getTags'](_0x2ab1fc);}})[_0x9e3c('0x25')](function(_0xb5cb92){if(_0xb5cb92){_0x4084a0=_0xb5cb92[_0x9e3c('0x38')];if(!_0x463359[_0x9e3c('0x32')][_0x9e3c('0x51')](_0x9e3c('0x39'))){_0x2ab1fc[_0x9e3c('0x1f')]=qs[_0x9e3c('0x1f')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x1f')]);_0x2ab1fc[_0x9e3c('0x1d')]=qs[_0x9e3c('0x1d')](_0x463359[_0x9e3c('0x32')][_0x9e3c('0x1d')]);}return _0x2ff7e5[_0x9e3c('0x54')](_0x2ab1fc);}})['then'](function(_0x1c14b0){if(_0x1c14b0){return _0x1c14b0?{'count':_0x4084a0,'rows':_0x1c14b0}:null;}})[_0x9e3c('0x25')](respondWithResult(_0x483fe6,null))[_0x9e3c('0x45')](handleError(_0x483fe6,null));};exports[_0x9e3c('0x56')]=function(_0x1db1e7,_0x4d4736,_0x577af7){if(_0x1db1e7[_0x9e3c('0x49')]['id']){delete _0x1db1e7['body']['id'];}return db['ZendeskConfiguration'][_0x9e3c('0x4d')]({'where':{'id':_0x1db1e7[_0x9e3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d4736,null))[_0x9e3c('0x25')](function(_0x43d25d){if(_0x43d25d){return _0x43d25d[_0x9e3c('0x56')](_0x1db1e7[_0x9e3c('0x49')][_0x9e3c('0x57')]||[]);}return null;})[_0x9e3c('0x25')](respondWithResult(_0x4d4736,null))[_0x9e3c('0x45')](handleError(_0x4d4736,null));}; \ No newline at end of file +var _0xaaca=['then','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','params','find','create','body','catch','getFields','findOne','ZendeskField','order','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy'];(function(_0x235545,_0x1b0943){var _0x348442=function(_0x6a7d91){while(--_0x6a7d91){_0x235545['push'](_0x235545['shift']());}};_0x348442(++_0x1b0943);}(_0xaaca,0xc0));var _0xaaac=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0xaaca[_0xb301d4];return _0x3b5bde;};'use strict';var emlformat=require(_0xaaac('0x0'));var rimraf=require(_0xaaac('0x1'));var zipdir=require(_0xaaac('0x2'));var jsonpatch=require(_0xaaac('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaaac('0x4'));var Mustache=require(_0xaaac('0x5'));var util=require('util');var path=require('path');var sox=require(_0xaaac('0x6'));var csv=require(_0xaaac('0x7'));var ejs=require(_0xaaac('0x8'));var fs=require('fs');var fs_extra=require(_0xaaac('0x9'));var _=require(_0xaaac('0xa'));var squel=require(_0xaaac('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaaac('0xc'));var toCsv=require(_0xaaac('0x7'));var querystring=require(_0xaaac('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaaac('0xe'));var qs=require(_0xaaac('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaaac('0x10'))('api');var utils=require(_0xaaac('0x11'));var config=require(_0xaaac('0x12'));var licenseUtil=require(_0xaaac('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2105ce,_0x250eb3){_0x250eb3=_0x250eb3||0xcc;return function(_0x352b9){if(_0x352b9){return _0x2105ce[_0xaaac('0x14')](_0x250eb3);}return _0x2105ce[_0xaaac('0x15')](_0x250eb3)[_0xaaac('0x16')]();};}function respondWithResult(_0x21e404,_0x4223f8){_0x4223f8=_0x4223f8||0xc8;return function(_0x35c6ab){if(_0x35c6ab){return _0x21e404['status'](_0x4223f8)[_0xaaac('0x17')](_0x35c6ab);}};}function respondWithFilteredResult(_0x5b7c90,_0x100008){return function(_0x3940f6){if(_0x3940f6){var _0x30a08e=typeof _0x100008[_0xaaac('0x18')]===_0xaaac('0x19')&&typeof _0x100008[_0xaaac('0x1a')]===_0xaaac('0x19');var _0x5af024=_0x3940f6[_0xaaac('0x1b')];var _0x78f562=_0x30a08e?0x0:_0x100008[_0xaaac('0x18')];var _0x1927fe=_0x30a08e?_0x3940f6['count']:_0x100008[_0xaaac('0x18')]+_0x100008['limit'];var _0x2e4bd4;if(_0x1927fe>=_0x5af024){_0x1927fe=_0x5af024;_0x2e4bd4=0xc8;}else{_0x2e4bd4=0xce;}_0x5b7c90['status'](_0x2e4bd4);return _0x5b7c90[_0xaaac('0x1c')]('Content-Range',_0x78f562+'-'+_0x1927fe+'/'+_0x5af024)[_0xaaac('0x17')](_0x3940f6);}return null;};}function patchUpdates(_0xdae2ad){return function(_0x3eac87){try{jsonpatch[_0xaaac('0x1d')](_0x3eac87,_0xdae2ad,!![]);}catch(_0x293ade){return BPromise['reject'](_0x293ade);}return _0x3eac87[_0xaaac('0x1e')]();};}function saveUpdates(_0x36a2e4,_0x4af39a){return function(_0x260835){if(_0x260835){return _0x260835[_0xaaac('0x1f')](_0x36a2e4)['then'](function(_0x40a0ef){return _0x40a0ef;});}return null;};}function removeEntity(_0x34922c,_0x5c1bee){return function(_0x5b357){if(_0x5b357){return _0x5b357[_0xaaac('0x20')]()[_0xaaac('0x21')](function(){_0x34922c[_0xaaac('0x15')](0xcc)[_0xaaac('0x16')]();});}};}function handleEntityNotFound(_0x1da5f8,_0x39cb3b){return function(_0x29c722){if(!_0x29c722){_0x1da5f8[_0xaaac('0x14')](0x194);}return _0x29c722;};}function handleError(_0x5ed28f,_0x2bc542){_0x2bc542=_0x2bc542||0x1f4;return function(_0x2459d5){logger['error'](_0x2459d5[_0xaaac('0x22')]);if(_0x2459d5[_0xaaac('0x23')]){delete _0x2459d5['name'];}_0x5ed28f['status'](_0x2bc542)[_0xaaac('0x24')](_0x2459d5);};}exports['index']=function(_0x5211e5,_0x40df5d){var _0x453983={},_0x403c6f={},_0x439325={'count':0x0,'rows':[]};var _0x41dba3=_[_0xaaac('0x25')](db[_0xaaac('0x26')][_0xaaac('0x27')],function(_0x1010da){return{'name':_0x1010da[_0xaaac('0x28')],'type':_0x1010da[_0xaaac('0x29')][_0xaaac('0x2a')]};});_0x403c6f[_0xaaac('0x2b')]=_['map'](_0x41dba3,_0xaaac('0x23'));_0x403c6f[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x5211e5[_0xaaac('0x2c')]);_0x403c6f[_0xaaac('0x2e')]=_[_0xaaac('0x2f')](_0x403c6f[_0xaaac('0x2b')],_0x403c6f['query']);_0x453983[_0xaaac('0x30')]=_['intersection'](_0x403c6f[_0xaaac('0x2b')],qs[_0xaaac('0x31')](_0x5211e5[_0xaaac('0x2c')][_0xaaac('0x31')]));_0x453983[_0xaaac('0x30')]=_0x453983[_0xaaac('0x30')][_0xaaac('0x32')]?_0x453983['attributes']:_0x403c6f['model'];if(!_0x5211e5[_0xaaac('0x2c')]['hasOwnProperty']('nolimit')){_0x453983['limit']=qs['limit'](_0x5211e5['query']['limit']);_0x453983[_0xaaac('0x18')]=qs[_0xaaac('0x18')](_0x5211e5[_0xaaac('0x2c')][_0xaaac('0x18')]);}_0x453983['order']=qs[_0xaaac('0x33')](_0x5211e5[_0xaaac('0x2c')][_0xaaac('0x33')]);_0x453983[_0xaaac('0x34')]=qs[_0xaaac('0x2e')](_[_0xaaac('0x35')](_0x5211e5[_0xaaac('0x2c')],_0x403c6f[_0xaaac('0x2e')]),_0x41dba3);if(_0x5211e5[_0xaaac('0x2c')]['filter']){_0x453983[_0xaaac('0x34')]=_[_0xaaac('0x36')](_0x453983[_0xaaac('0x34')],{'$or':_[_0xaaac('0x25')](_0x41dba3,function(_0x3683a3){if(_0x3683a3[_0xaaac('0x29')]!==_0xaaac('0x37')){var _0x1598b2={};_0x1598b2[_0x3683a3[_0xaaac('0x23')]]={'$like':'%'+_0x5211e5['query'][_0xaaac('0x38')]+'%'};return _0x1598b2;}})});}_0x453983=_[_0xaaac('0x36')]({},_0x453983,_0x5211e5[_0xaaac('0x39')]);var _0x104909={'where':_0x453983[_0xaaac('0x34')]};return db[_0xaaac('0x26')][_0xaaac('0x1b')](_0x104909)[_0xaaac('0x21')](function(_0xf787e9){_0x439325['count']=_0xf787e9;if(_0x5211e5[_0xaaac('0x2c')][_0xaaac('0x3a')]){_0x453983[_0xaaac('0x3b')]=[{'all':!![]}];}return db[_0xaaac('0x26')]['findAll'](_0x453983);})[_0xaaac('0x21')](function(_0x45f33){_0x439325['rows']=_0x45f33;return _0x439325;})['then'](respondWithFilteredResult(_0x40df5d,_0x453983))['catch'](handleError(_0x40df5d,null));};exports['show']=function(_0x4fa12a,_0x52d1b0){var _0x4694b3={'raw':![],'where':{'id':_0x4fa12a[_0xaaac('0x3c')]['id']}},_0x1c6156={};_0x1c6156['model']=_[_0xaaac('0x2d')](db[_0xaaac('0x26')][_0xaaac('0x27')]);_0x1c6156[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x4fa12a[_0xaaac('0x2c')]);_0x1c6156[_0xaaac('0x2e')]=_['intersection'](_0x1c6156['model'],_0x1c6156[_0xaaac('0x2c')]);_0x4694b3[_0xaaac('0x30')]=_['intersection'](_0x1c6156['model'],qs[_0xaaac('0x31')](_0x4fa12a['query'][_0xaaac('0x31')]));_0x4694b3[_0xaaac('0x30')]=_0x4694b3[_0xaaac('0x30')][_0xaaac('0x32')]?_0x4694b3[_0xaaac('0x30')]:_0x1c6156[_0xaaac('0x2b')];if(_0x4fa12a[_0xaaac('0x2c')]['includeAll']){_0x4694b3[_0xaaac('0x3b')]=[{'all':!![]}];}_0x4694b3=_[_0xaaac('0x36')]({},_0x4694b3,_0x4fa12a[_0xaaac('0x39')]);return db[_0xaaac('0x26')][_0xaaac('0x3d')](_0x4694b3)[_0xaaac('0x21')](handleEntityNotFound(_0x52d1b0,null))[_0xaaac('0x21')](respondWithResult(_0x52d1b0,null))['catch'](handleError(_0x52d1b0,null));};exports[_0xaaac('0x3e')]=function(_0x1d17fa,_0x3a92bc){return db[_0xaaac('0x26')][_0xaaac('0x3e')](_0x1d17fa[_0xaaac('0x3f')],{})[_0xaaac('0x21')](respondWithResult(_0x3a92bc,0xc9))[_0xaaac('0x40')](handleError(_0x3a92bc,null));};exports[_0xaaac('0x1f')]=function(_0x1bcbe5,_0x2ca996){if(_0x1bcbe5[_0xaaac('0x3f')]['id']){delete _0x1bcbe5[_0xaaac('0x3f')]['id'];}return db[_0xaaac('0x26')]['find']({'where':{'id':_0x1bcbe5['params']['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x2ca996,null))['then'](saveUpdates(_0x1bcbe5[_0xaaac('0x3f')],null))[_0xaaac('0x21')](respondWithResult(_0x2ca996,null))[_0xaaac('0x40')](handleError(_0x2ca996,null));};exports[_0xaaac('0x20')]=function(_0x106b61,_0x56d828){return db[_0xaaac('0x26')][_0xaaac('0x3d')]({'where':{'id':_0x106b61[_0xaaac('0x3c')]['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x56d828,null))[_0xaaac('0x21')](removeEntity(_0x56d828,null))[_0xaaac('0x40')](handleError(_0x56d828,null));};exports[_0xaaac('0x41')]=function(_0x51e494,_0x108a0c,_0x263124){var _0x120e7e={};var _0x2ac63c={};var _0x87143e;var _0x534273;return db[_0xaaac('0x26')][_0xaaac('0x42')]({'where':{'id':_0x51e494['params']['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x108a0c,null))[_0xaaac('0x21')](function(_0x42d7c9){if(_0x42d7c9){_0x87143e=_0x42d7c9;_0x2ac63c[_0xaaac('0x2b')]=_[_0xaaac('0x2d')](db[_0xaaac('0x43')][_0xaaac('0x27')]);_0x2ac63c[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x51e494['query']);_0x2ac63c[_0xaaac('0x2e')]=_[_0xaaac('0x2f')](_0x2ac63c['model'],_0x2ac63c[_0xaaac('0x2c')]);_0x120e7e['attributes']=_[_0xaaac('0x2f')](_0x2ac63c[_0xaaac('0x2b')],qs[_0xaaac('0x31')](_0x51e494['query'][_0xaaac('0x31')]));_0x120e7e[_0xaaac('0x30')]=_0x120e7e[_0xaaac('0x30')][_0xaaac('0x32')]?_0x120e7e[_0xaaac('0x30')]:_0x2ac63c[_0xaaac('0x2b')];_0x120e7e[_0xaaac('0x44')]=qs['sort'](_0x51e494[_0xaaac('0x2c')][_0xaaac('0x33')]);_0x120e7e[_0xaaac('0x34')]=qs[_0xaaac('0x2e')](_[_0xaaac('0x35')](_0x51e494[_0xaaac('0x2c')],_0x2ac63c[_0xaaac('0x2e')]));if(_0x51e494[_0xaaac('0x2c')][_0xaaac('0x38')]){_0x120e7e[_0xaaac('0x34')]=_[_0xaaac('0x36')](_0x120e7e[_0xaaac('0x34')],{'$or':_['map'](_0x120e7e[_0xaaac('0x30')],function(_0xc66726){var _0x5dd25b={};_0x5dd25b[_0xc66726]={'$like':'%'+_0x51e494[_0xaaac('0x2c')][_0xaaac('0x38')]+'%'};return _0x5dd25b;})});}_0x120e7e=_[_0xaaac('0x36')]({},_0x120e7e,_0x51e494['options']);return _0x87143e[_0xaaac('0x41')](_0x120e7e);}})[_0xaaac('0x21')](function(_0x1695bf){if(_0x1695bf){_0x534273=_0x1695bf[_0xaaac('0x32')];if(!_0x51e494[_0xaaac('0x2c')][_0xaaac('0x45')](_0xaaac('0x46'))){_0x120e7e[_0xaaac('0x1a')]=qs['limit'](_0x51e494[_0xaaac('0x2c')][_0xaaac('0x1a')]);_0x120e7e[_0xaaac('0x18')]=qs[_0xaaac('0x18')](_0x51e494[_0xaaac('0x2c')]['offset']);}return _0x87143e[_0xaaac('0x41')](_0x120e7e);}})[_0xaaac('0x21')](function(_0x3116a3){if(_0x3116a3){return _0x3116a3?{'count':_0x534273,'rows':_0x3116a3}:null;}})['then'](respondWithResult(_0x108a0c,null))[_0xaaac('0x40')](handleError(_0x108a0c,null));};exports[_0xaaac('0x47')]=function(_0x2ff224,_0x35abc3,_0x63a914){var _0x80ab86={};var _0x15ae65={};var _0x3033fb;var _0x372d54;return db['ZendeskConfiguration'][_0xaaac('0x42')]({'where':{'id':_0x2ff224[_0xaaac('0x3c')]['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x35abc3,null))[_0xaaac('0x21')](function(_0x2bbba1){if(_0x2bbba1){_0x3033fb=_0x2bbba1;_0x15ae65[_0xaaac('0x2b')]=_[_0xaaac('0x2d')](db[_0xaaac('0x43')]['rawAttributes']);_0x15ae65[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x2ff224[_0xaaac('0x2c')]);_0x15ae65['filters']=_[_0xaaac('0x2f')](_0x15ae65[_0xaaac('0x2b')],_0x15ae65['query']);_0x80ab86[_0xaaac('0x30')]=_[_0xaaac('0x2f')](_0x15ae65[_0xaaac('0x2b')],qs[_0xaaac('0x31')](_0x2ff224[_0xaaac('0x2c')][_0xaaac('0x31')]));_0x80ab86[_0xaaac('0x30')]=_0x80ab86[_0xaaac('0x30')][_0xaaac('0x32')]?_0x80ab86[_0xaaac('0x30')]:_0x15ae65[_0xaaac('0x2b')];_0x80ab86[_0xaaac('0x44')]=qs[_0xaaac('0x33')](_0x2ff224['query'][_0xaaac('0x33')]);_0x80ab86[_0xaaac('0x34')]=qs['filters'](_[_0xaaac('0x35')](_0x2ff224[_0xaaac('0x2c')],_0x15ae65[_0xaaac('0x2e')]));if(_0x2ff224[_0xaaac('0x2c')]['filter']){_0x80ab86[_0xaaac('0x34')]=_['merge'](_0x80ab86[_0xaaac('0x34')],{'$or':_[_0xaaac('0x25')](_0x80ab86[_0xaaac('0x30')],function(_0x1a5696){var _0x8d068b={};_0x8d068b[_0x1a5696]={'$like':'%'+_0x2ff224[_0xaaac('0x2c')][_0xaaac('0x38')]+'%'};return _0x8d068b;})});}_0x80ab86=_[_0xaaac('0x36')]({},_0x80ab86,_0x2ff224[_0xaaac('0x39')]);return _0x3033fb[_0xaaac('0x47')](_0x80ab86);}})['then'](function(_0x5a25c5){if(_0x5a25c5){_0x372d54=_0x5a25c5[_0xaaac('0x32')];if(!_0x2ff224['query']['hasOwnProperty'](_0xaaac('0x46'))){_0x80ab86[_0xaaac('0x1a')]=qs[_0xaaac('0x1a')](_0x2ff224['query']['limit']);_0x80ab86['offset']=qs[_0xaaac('0x18')](_0x2ff224[_0xaaac('0x2c')][_0xaaac('0x18')]);}return _0x3033fb[_0xaaac('0x47')](_0x80ab86);}})['then'](function(_0x520f87){if(_0x520f87){return _0x520f87?{'count':_0x372d54,'rows':_0x520f87}:null;}})['then'](respondWithResult(_0x35abc3,null))['catch'](handleError(_0x35abc3,null));};exports[_0xaaac('0x48')]=function(_0x54b5a9,_0x390ba8,_0x28bf60){var _0xcb4218={};var _0x418169={};var _0xd3ec14;var _0x303d07;return db[_0xaaac('0x26')][_0xaaac('0x42')]({'where':{'id':_0x54b5a9[_0xaaac('0x3c')]['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x390ba8,null))[_0xaaac('0x21')](function(_0x5d2302){if(_0x5d2302){_0xd3ec14=_0x5d2302;_0x418169['model']=_['keys'](db[_0xaaac('0x43')][_0xaaac('0x27')]);_0x418169[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x54b5a9[_0xaaac('0x2c')]);_0x418169[_0xaaac('0x2e')]=_[_0xaaac('0x2f')](_0x418169[_0xaaac('0x2b')],_0x418169[_0xaaac('0x2c')]);_0xcb4218['attributes']=_[_0xaaac('0x2f')](_0x418169[_0xaaac('0x2b')],qs['fields'](_0x54b5a9[_0xaaac('0x2c')][_0xaaac('0x31')]));_0xcb4218[_0xaaac('0x30')]=_0xcb4218[_0xaaac('0x30')][_0xaaac('0x32')]?_0xcb4218['attributes']:_0x418169[_0xaaac('0x2b')];_0xcb4218[_0xaaac('0x44')]=qs[_0xaaac('0x33')](_0x54b5a9['query'][_0xaaac('0x33')]);_0xcb4218[_0xaaac('0x34')]=qs['filters'](_[_0xaaac('0x35')](_0x54b5a9[_0xaaac('0x2c')],_0x418169['filters']));if(_0x54b5a9[_0xaaac('0x2c')]['filter']){_0xcb4218[_0xaaac('0x34')]=_[_0xaaac('0x36')](_0xcb4218[_0xaaac('0x34')],{'$or':_[_0xaaac('0x25')](_0xcb4218[_0xaaac('0x30')],function(_0x481311){var _0xe20e64={};_0xe20e64[_0x481311]={'$like':'%'+_0x54b5a9[_0xaaac('0x2c')][_0xaaac('0x38')]+'%'};return _0xe20e64;})});}_0xcb4218=_[_0xaaac('0x36')]({},_0xcb4218,_0x54b5a9[_0xaaac('0x39')]);return _0xd3ec14['getDescriptions'](_0xcb4218);}})[_0xaaac('0x21')](function(_0x49eaf6){if(_0x49eaf6){_0x303d07=_0x49eaf6[_0xaaac('0x32')];if(!_0x54b5a9['query'][_0xaaac('0x45')](_0xaaac('0x46'))){_0xcb4218[_0xaaac('0x1a')]=qs[_0xaaac('0x1a')](_0x54b5a9[_0xaaac('0x2c')][_0xaaac('0x1a')]);_0xcb4218['offset']=qs[_0xaaac('0x18')](_0x54b5a9[_0xaaac('0x2c')][_0xaaac('0x18')]);}return _0xd3ec14[_0xaaac('0x48')](_0xcb4218);}})['then'](function(_0x4870d3){if(_0x4870d3){return _0x4870d3?{'count':_0x303d07,'rows':_0x4870d3}:null;}})[_0xaaac('0x21')](respondWithResult(_0x390ba8,null))['catch'](handleError(_0x390ba8,null));};exports['getTags']=function(_0x5860c5,_0x3e0066,_0x22dc94){var _0x16369a={};var _0x1206fb={};var _0x59d840;var _0x57576a;return db['ZendeskConfiguration'][_0xaaac('0x42')]({'where':{'id':_0x5860c5[_0xaaac('0x3c')]['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x3e0066,null))[_0xaaac('0x21')](function(_0x2f8739){if(_0x2f8739){_0x59d840=_0x2f8739;_0x1206fb[_0xaaac('0x2b')]=_[_0xaaac('0x2d')](db['Tag'][_0xaaac('0x27')]);_0x1206fb[_0xaaac('0x2c')]=_[_0xaaac('0x2d')](_0x5860c5[_0xaaac('0x2c')]);_0x1206fb[_0xaaac('0x2e')]=_[_0xaaac('0x2f')](_0x1206fb[_0xaaac('0x2b')],_0x1206fb[_0xaaac('0x2c')]);_0x16369a[_0xaaac('0x30')]=_['intersection'](_0x1206fb[_0xaaac('0x2b')],qs['fields'](_0x5860c5[_0xaaac('0x2c')][_0xaaac('0x31')]));_0x16369a['attributes']=_0x16369a['attributes'][_0xaaac('0x32')]?_0x16369a[_0xaaac('0x30')]:_0x1206fb[_0xaaac('0x2b')];_0x16369a[_0xaaac('0x44')]=qs[_0xaaac('0x33')](_0x5860c5[_0xaaac('0x2c')][_0xaaac('0x33')]);_0x16369a[_0xaaac('0x34')]=qs[_0xaaac('0x2e')](_[_0xaaac('0x35')](_0x5860c5['query'],_0x1206fb[_0xaaac('0x2e')]));if(_0x5860c5[_0xaaac('0x2c')][_0xaaac('0x38')]){_0x16369a['where']=_[_0xaaac('0x36')](_0x16369a[_0xaaac('0x34')],{'$or':_[_0xaaac('0x25')](_0x16369a[_0xaaac('0x30')],function(_0x20f178){var _0x198a52={};_0x198a52[_0x20f178]={'$like':'%'+_0x5860c5[_0xaaac('0x2c')][_0xaaac('0x38')]+'%'};return _0x198a52;})});}_0x16369a=_['merge']({},_0x16369a,_0x5860c5[_0xaaac('0x39')]);return _0x59d840[_0xaaac('0x49')](_0x16369a);}})[_0xaaac('0x21')](function(_0x3ce9aa){if(_0x3ce9aa){_0x57576a=_0x3ce9aa[_0xaaac('0x32')];if(!_0x5860c5[_0xaaac('0x2c')][_0xaaac('0x45')](_0xaaac('0x46'))){_0x16369a['limit']=qs[_0xaaac('0x1a')](_0x5860c5[_0xaaac('0x2c')]['limit']);_0x16369a[_0xaaac('0x18')]=qs[_0xaaac('0x18')](_0x5860c5['query'][_0xaaac('0x18')]);}return _0x59d840['getTags'](_0x16369a);}})[_0xaaac('0x21')](function(_0x38a01d){if(_0x38a01d){return _0x38a01d?{'count':_0x57576a,'rows':_0x38a01d}:null;}})['then'](respondWithResult(_0x3e0066,null))[_0xaaac('0x40')](handleError(_0x3e0066,null));};exports[_0xaaac('0x4a')]=function(_0x22cb90,_0x7d2eb5,_0x249394){if(_0x22cb90['body']['id']){delete _0x22cb90[_0xaaac('0x3f')]['id'];}return db[_0xaaac('0x26')]['findOne']({'where':{'id':_0x22cb90[_0xaaac('0x3c')]['id']}})[_0xaaac('0x21')](handleEntityNotFound(_0x7d2eb5,null))[_0xaaac('0x21')](function(_0x1d0461){if(_0x1d0461){return _0x1d0461[_0xaaac('0x4a')](_0x22cb90['body']['ids']||[]);}return null;})[_0xaaac('0x21')](respondWithResult(_0x7d2eb5,null))[_0xaaac('0x40')](handleError(_0x7d2eb5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 08b3939..e7d37e5 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x21cb67,_0x2efea6){var _0x5e7493=function(_0x516c6b){while(--_0x516c6b){_0x21cb67['push'](_0x21cb67['shift']());}};_0x5e7493(++_0x2efea6);}(_0x9348,0x10d));var _0x8934=function(_0x4db861,_0x128af7){_0x4db861=_0x4db861-0x0;var _0x42ffcb=_0x9348[_0x4db861];return _0x42ffcb;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0x8934('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x473268,_0x4a5e1f){var _0x1940c7=function(_0x541c31){while(--_0x541c31){_0x473268['push'](_0x473268['shift']());}};_0x1940c7(++_0x4a5e1f);}(_0x5423,0xe3));var _0x3542=function(_0x306865,_0x317090){_0x306865=_0x306865-0x0;var _0xeaae5b=_0x5423[_0x306865];return _0xeaae5b;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 7818b84..b7e156d 100644 --- a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js +++ b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccad=['message','result','catch','ZendeskConfiguration,\x20%s,\x20%s','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x48f7cc,_0x462000){var _0x162c86=function(_0x3c1d85){while(--_0x3c1d85){_0x48f7cc['push'](_0x48f7cc['shift']());}};_0x162c86(++_0x462000);}(_0xccad,0x1e4));var _0xdcca=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xccad[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0xdcca('0x0'));var util=require('util');var moment=require(_0xdcca('0x1'));var BPromise=require(_0xdcca('0x2'));var rs=require(_0xdcca('0x3'));var fs=require('fs');var Redis=require(_0xdcca('0x4'));var db=require(_0xdcca('0x5'))['db'];var utils=require(_0xdcca('0x6'));var logger=require(_0xdcca('0x7'))(_0xdcca('0x8'));var config=require(_0xdcca('0x9'));var jayson=require(_0xdcca('0xa'));var client=jayson[_0xdcca('0xb')][_0xdcca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x521548,_0x174788,_0x142ba0){return new BPromise(function(_0x2a358d,_0x15c3d9){return client['request'](_0x521548,_0x142ba0)[_0xdcca('0xd')](function(_0x5e804e){logger[_0xdcca('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0xdcca('0xf'));logger[_0xdcca('0x10')](_0xdcca('0x11'),_0x174788,'request\x20sent',JSON[_0xdcca('0x12')](_0x5e804e));if(_0x5e804e[_0xdcca('0x13')]){if(_0x5e804e[_0xdcca('0x13')]['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);return _0x15c3d9(_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);}logger[_0xdcca('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0x5e804e[_0xdcca('0x13')][_0xdcca('0x14')]);return _0x2a358d(_0x5e804e['error']['message']);}else{logger[_0xdcca('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x174788,_0xdcca('0xf'));_0x2a358d(_0x5e804e[_0xdcca('0x15')][_0xdcca('0x14')]);}})[_0xdcca('0x16')](function(_0x3dc667){logger[_0xdcca('0x13')](_0xdcca('0x17'),_0x174788,_0x3dc667);_0x15c3d9(_0x3dc667);});});} \ No newline at end of file +var _0xa8fe=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa8fe,0xfd));var _0xea8f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa8fe[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xea8f('0x0'));var moment=require(_0xea8f('0x1'));var BPromise=require(_0xea8f('0x2'));var rs=require(_0xea8f('0x3'));var fs=require('fs');var Redis=require(_0xea8f('0x4'));var db=require(_0xea8f('0x5'))['db'];var utils=require(_0xea8f('0x6'));var logger=require(_0xea8f('0x7'))('rpc');var config=require(_0xea8f('0x8'));var jayson=require(_0xea8f('0x9'));var client=jayson[_0xea8f('0xa')][_0xea8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe0b,_0x19ec82,_0x5a0c53){return new BPromise(function(_0x1fd702,_0x1b44bc){return client[_0xea8f('0xc')](_0x2bbe0b,_0x5a0c53)[_0xea8f('0xd')](function(_0x38b249){logger[_0xea8f('0xe')](_0xea8f('0xf'),_0x19ec82,_0xea8f('0x10'));logger[_0xea8f('0x11')](_0xea8f('0x12'),_0x19ec82,_0xea8f('0x10'),JSON[_0xea8f('0x13')](_0x38b249));if(_0x38b249['error']){if(_0x38b249[_0xea8f('0x14')][_0xea8f('0x15')]===0x1f4){logger[_0xea8f('0x14')](_0xea8f('0xf'),_0x19ec82,_0x38b249[_0xea8f('0x14')]['message']);return _0x1b44bc(_0x38b249[_0xea8f('0x14')][_0xea8f('0x16')]);}logger[_0xea8f('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x19ec82,_0x38b249[_0xea8f('0x14')][_0xea8f('0x16')]);return _0x1fd702(_0x38b249[_0xea8f('0x14')][_0xea8f('0x16')]);}else{logger[_0xea8f('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x19ec82,_0xea8f('0x10'));_0x1fd702(_0x38b249[_0xea8f('0x17')][_0xea8f('0x16')]);}})[_0xea8f('0x18')](function(_0x1c194d){logger[_0xea8f('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x19ec82,_0x1c194d);_0x1b44bc(_0x1c194d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 81a7cf7..77bd2aa 100644 --- a/server/api/intZendeskField/index.js +++ b/server/api/intZendeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3de=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update'];(function(_0x269b00,_0xc5ac96){var _0x52b4d0=function(_0x5a5b7e){while(--_0x5a5b7e){_0x269b00['push'](_0x269b00['shift']());}};_0x52b4d0(++_0xc5ac96);}(_0xe3de,0xc8));var _0xee3d=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe3de[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xee3d('0x0'));var path=require('path');var timeout=require(_0xee3d('0x1'));var express=require(_0xee3d('0x2'));var router=express[_0xee3d('0x3')]();var fs_extra=require(_0xee3d('0x4'));var auth=require(_0xee3d('0x5'));var interaction=require(_0xee3d('0x6'));var config=require(_0xee3d('0x7'));var controller=require('./intZendeskField.controller');router[_0xee3d('0x8')]('/',auth[_0xee3d('0x9')](),controller[_0xee3d('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xee3d('0xb')]('/',auth[_0xee3d('0x9')](),controller[_0xee3d('0xc')]);router[_0xee3d('0xd')](_0xee3d('0xe'),auth[_0xee3d('0x9')](),controller[_0xee3d('0xf')]);router['delete'](_0xee3d('0xe'),auth[_0xee3d('0x9')](),controller[_0xee3d('0x10')]);module[_0xee3d('0x11')]=router; \ No newline at end of file +var _0x2470=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','index','/:id','show','post','put','isAuthenticated','update'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x2470,0xa5));var _0x0247=function(_0x5cf422,_0x461dde){_0x5cf422=_0x5cf422-0x0;var _0x2cb6ea=_0x2470[_0x5cf422];return _0x2cb6ea;};'use strict';var multer=require('multer');var util=require(_0x0247('0x0'));var path=require(_0x0247('0x1'));var timeout=require(_0x0247('0x2'));var express=require(_0x0247('0x3'));var router=express[_0x0247('0x4')]();var fs_extra=require(_0x0247('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0247('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x0247('0x7')]('/',auth['isAuthenticated'](),controller[_0x0247('0x8')]);router[_0x0247('0x7')](_0x0247('0x9'),auth['isAuthenticated'](),controller[_0x0247('0xa')]);router[_0x0247('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0247('0xc')](_0x0247('0x9'),auth[_0x0247('0xd')](),controller[_0x0247('0xe')]);router[_0x0247('0xf')](_0x0247('0x9'),auth['isAuthenticated'](),controller[_0x0247('0x10')]);module[_0x0247('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a963796..f62f1bd 100644 --- a/server/api/intZendeskField/intZendeskField.attributes.js +++ b/server/api/intZendeskField/intZendeskField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x823b=['STRING','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x48b454,_0xafeae){var _0x521cb4=function(_0x497e62){while(--_0x497e62){_0x48b454['push'](_0x48b454['shift']());}};_0x521cb4(++_0xafeae);}(_0x823b,0xfd));var _0xb823=function(_0x50a6ee,_0x31a00c){_0x50a6ee=_0x50a6ee-0x0;var _0x5e4627=_0x823b[_0x50a6ee];return _0x5e4627;};'use strict';var Sequelize=require('sequelize');module[_0xb823('0x0')]={'type':{'type':Sequelize[_0xb823('0x1')](_0xb823('0x2'),_0xb823('0x3'),_0xb823('0x4'),'keyValue',_0xb823('0x5')),'defaultValue':_0xb823('0x2')},'content':{'type':Sequelize[_0xb823('0x6')]},'key':{'type':Sequelize[_0xb823('0x6')]},'keyType':{'type':Sequelize[_0xb823('0x1')](_0xb823('0x2'),_0xb823('0x3'),_0xb823('0x4'))},'keyContent':{'type':Sequelize[_0xb823('0x6')]},'idField':{'type':Sequelize[_0xb823('0x6')]},'nameField':{'type':Sequelize[_0xb823('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb823('0x6')]}}; \ No newline at end of file +var _0xfad7=['string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfad7,0xff));var _0x7fad=function(_0x51b24b,_0xdf3625){_0x51b24b=_0x51b24b-0x0;var _0x141067=_0xfad7[_0x51b24b];return _0x141067;};'use strict';var Sequelize=require('sequelize');module[_0x7fad('0x0')]={'type':{'type':Sequelize['ENUM'](_0x7fad('0x1'),_0x7fad('0x2'),_0x7fad('0x3'),'keyValue',_0x7fad('0x4')),'defaultValue':_0x7fad('0x1')},'content':{'type':Sequelize[_0x7fad('0x5')]},'key':{'type':Sequelize[_0x7fad('0x5')]},'keyType':{'type':Sequelize[_0x7fad('0x6')](_0x7fad('0x1'),_0x7fad('0x2'),_0x7fad('0x3'))},'keyContent':{'type':Sequelize[_0x7fad('0x5')]},'idField':{'type':Sequelize[_0x7fad('0x5')]},'nameField':{'type':Sequelize[_0x7fad('0x5')]},'customField':{'type':Sequelize[_0x7fad('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7fad('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2ffad4e..2091b95 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe559=['util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','length','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x24289d,_0x9c3c26){var _0x17fdab=function(_0x5c5d69){while(--_0x5c5d69){_0x24289d['push'](_0x24289d['shift']());}};_0x17fdab(++_0x9c3c26);}(_0xe559,0x176));var _0x9e55=function(_0x16eb02,_0x418683){_0x16eb02=_0x16eb02-0x0;var _0x163928=_0xe559[_0x16eb02];return _0x163928;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e55('0x0'));var zipdir=require(_0x9e55('0x1'));var jsonpatch=require(_0x9e55('0x2'));var rp=require(_0x9e55('0x3'));var moment=require(_0x9e55('0x4'));var BPromise=require(_0x9e55('0x5'));var Mustache=require('mustache');var util=require(_0x9e55('0x6'));var path=require(_0x9e55('0x7'));var sox=require(_0x9e55('0x8'));var csv=require('to-csv');var ejs=require(_0x9e55('0x9'));var fs=require('fs');var fs_extra=require(_0x9e55('0xa'));var _=require(_0x9e55('0xb'));var squel=require(_0x9e55('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e55('0xd'));var toCsv=require(_0x9e55('0xe'));var querystring=require('querystring');var Papa=require(_0x9e55('0xf'));var Redis=require(_0x9e55('0x10'));var authService=require(_0x9e55('0x11'));var qs=require(_0x9e55('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e55('0x13'));var logger=require(_0x9e55('0x14'))(_0x9e55('0x15'));var utils=require('../../config/utils');var config=require(_0x9e55('0x16'));var licenseUtil=require(_0x9e55('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22ad92,_0x28d924){_0x28d924=_0x28d924||0xcc;return function(_0x232911){if(_0x232911){return _0x22ad92[_0x9e55('0x18')](_0x28d924);}return _0x22ad92['status'](_0x28d924)['end']();};}function respondWithResult(_0x371720,_0x4d84e1){_0x4d84e1=_0x4d84e1||0xc8;return function(_0x1b6a3a){if(_0x1b6a3a){return _0x371720['status'](_0x4d84e1)[_0x9e55('0x19')](_0x1b6a3a);}};}function respondWithFilteredResult(_0x1d8e8a,_0x2de722){return function(_0x10d055){if(_0x10d055){var _0x199035=typeof _0x2de722[_0x9e55('0x1a')]===_0x9e55('0x1b')&&typeof _0x2de722[_0x9e55('0x1c')]===_0x9e55('0x1b');var _0x535aeb=_0x10d055[_0x9e55('0x1d')];var _0x1d49fd=_0x199035?0x0:_0x2de722['offset'];var _0x34f0a3=_0x199035?_0x10d055['count']:_0x2de722[_0x9e55('0x1a')]+_0x2de722[_0x9e55('0x1c')];var _0x4f5daf;if(_0x34f0a3>=_0x535aeb){_0x34f0a3=_0x535aeb;_0x4f5daf=0xc8;}else{_0x4f5daf=0xce;}_0x1d8e8a[_0x9e55('0x1e')](_0x4f5daf);return _0x1d8e8a[_0x9e55('0x1f')]('Content-Range',_0x1d49fd+'-'+_0x34f0a3+'/'+_0x535aeb)[_0x9e55('0x19')](_0x10d055);}return null;};}function patchUpdates(_0xd4fb8a){return function(_0x3f672e){try{jsonpatch[_0x9e55('0x20')](_0x3f672e,_0xd4fb8a,!![]);}catch(_0x372d45){return BPromise[_0x9e55('0x21')](_0x372d45);}return _0x3f672e[_0x9e55('0x22')]();};}function saveUpdates(_0x123a15,_0x3b382b){return function(_0x16d9ed){if(_0x16d9ed){return _0x16d9ed[_0x9e55('0x23')](_0x123a15)[_0x9e55('0x24')](function(_0x4a7075){return _0x4a7075;});}return null;};}function removeEntity(_0x44de13,_0x5aba8e){return function(_0x1420b2){if(_0x1420b2){return _0x1420b2['destroy']()[_0x9e55('0x24')](function(){_0x44de13[_0x9e55('0x1e')](0xcc)[_0x9e55('0x25')]();});}};}function handleEntityNotFound(_0x173d27,_0xfb6415){return function(_0x3dfde0){if(!_0x3dfde0){_0x173d27[_0x9e55('0x18')](0x194);}return _0x3dfde0;};}function handleError(_0x31fbdf,_0x14ea8d){_0x14ea8d=_0x14ea8d||0x1f4;return function(_0xce28cd){logger[_0x9e55('0x26')](_0xce28cd[_0x9e55('0x27')]);if(_0xce28cd[_0x9e55('0x28')]){delete _0xce28cd[_0x9e55('0x28')];}_0x31fbdf[_0x9e55('0x1e')](_0x14ea8d)[_0x9e55('0x29')](_0xce28cd);};}exports[_0x9e55('0x2a')]=function(_0x1451fc,_0x4a0b62){var _0x1e5b32={},_0x117e8d={},_0x155e15={'count':0x0,'rows':[]};var _0x6f16fa=_[_0x9e55('0x2b')](db[_0x9e55('0x2c')][_0x9e55('0x2d')],function(_0x2e9dbf){return{'name':_0x2e9dbf[_0x9e55('0x2e')],'type':_0x2e9dbf[_0x9e55('0x2f')][_0x9e55('0x30')]};});_0x117e8d[_0x9e55('0x31')]=_[_0x9e55('0x2b')](_0x6f16fa,_0x9e55('0x28'));_0x117e8d[_0x9e55('0x32')]=_[_0x9e55('0x33')](_0x1451fc[_0x9e55('0x32')]);_0x117e8d['filters']=_[_0x9e55('0x34')](_0x117e8d[_0x9e55('0x31')],_0x117e8d[_0x9e55('0x32')]);_0x1e5b32['attributes']=_['intersection'](_0x117e8d[_0x9e55('0x31')],qs[_0x9e55('0x35')](_0x1451fc[_0x9e55('0x32')][_0x9e55('0x35')]));_0x1e5b32[_0x9e55('0x36')]=_0x1e5b32['attributes']['length']?_0x1e5b32['attributes']:_0x117e8d[_0x9e55('0x31')];if(!_0x1451fc[_0x9e55('0x32')][_0x9e55('0x37')](_0x9e55('0x38'))){_0x1e5b32[_0x9e55('0x1c')]=qs[_0x9e55('0x1c')](_0x1451fc['query'][_0x9e55('0x1c')]);_0x1e5b32[_0x9e55('0x1a')]=qs[_0x9e55('0x1a')](_0x1451fc[_0x9e55('0x32')][_0x9e55('0x1a')]);}_0x1e5b32[_0x9e55('0x39')]=qs[_0x9e55('0x3a')](_0x1451fc[_0x9e55('0x32')]['sort']);_0x1e5b32[_0x9e55('0x3b')]=qs[_0x9e55('0x3c')](_[_0x9e55('0x3d')](_0x1451fc[_0x9e55('0x32')],_0x117e8d['filters']),_0x6f16fa);if(_0x1451fc[_0x9e55('0x32')][_0x9e55('0x3e')]){_0x1e5b32[_0x9e55('0x3b')]=_[_0x9e55('0x3f')](_0x1e5b32[_0x9e55('0x3b')],{'$or':_['map'](_0x6f16fa,function(_0x4943de){if(_0x4943de[_0x9e55('0x2f')]!==_0x9e55('0x40')){var _0x350e8e={};_0x350e8e[_0x4943de[_0x9e55('0x28')]]={'$like':'%'+_0x1451fc['query'][_0x9e55('0x3e')]+'%'};return _0x350e8e;}})});}_0x1e5b32=_['merge']({},_0x1e5b32,_0x1451fc[_0x9e55('0x41')]);var _0x341bbd={'where':_0x1e5b32[_0x9e55('0x3b')]};return db[_0x9e55('0x2c')][_0x9e55('0x1d')](_0x341bbd)[_0x9e55('0x24')](function(_0x44b791){_0x155e15['count']=_0x44b791;if(_0x1451fc[_0x9e55('0x32')][_0x9e55('0x42')]){_0x1e5b32[_0x9e55('0x43')]=[{'all':!![]}];}return db[_0x9e55('0x2c')]['findAll'](_0x1e5b32);})[_0x9e55('0x24')](function(_0x4d9e8d){_0x155e15[_0x9e55('0x44')]=_0x4d9e8d;return _0x155e15;})[_0x9e55('0x24')](respondWithFilteredResult(_0x4a0b62,_0x1e5b32))[_0x9e55('0x45')](handleError(_0x4a0b62,null));};exports['show']=function(_0x12a4e3,_0xba8b74){var _0x12e467={'raw':!![],'where':{'id':_0x12a4e3['params']['id']}},_0x307217={};_0x307217['model']=_[_0x9e55('0x33')](db['ZendeskField'][_0x9e55('0x2d')]);_0x307217[_0x9e55('0x32')]=_[_0x9e55('0x33')](_0x12a4e3[_0x9e55('0x32')]);_0x307217[_0x9e55('0x3c')]=_[_0x9e55('0x34')](_0x307217['model'],_0x307217[_0x9e55('0x32')]);_0x12e467[_0x9e55('0x36')]=_[_0x9e55('0x34')](_0x307217[_0x9e55('0x31')],qs[_0x9e55('0x35')](_0x12a4e3[_0x9e55('0x32')]['fields']));_0x12e467[_0x9e55('0x36')]=_0x12e467[_0x9e55('0x36')][_0x9e55('0x46')]?_0x12e467[_0x9e55('0x36')]:_0x307217['model'];if(_0x12a4e3[_0x9e55('0x32')][_0x9e55('0x42')]){_0x12e467[_0x9e55('0x43')]=[{'all':!![]}];}_0x12e467=_['merge']({},_0x12e467,_0x12a4e3[_0x9e55('0x41')]);return db[_0x9e55('0x2c')][_0x9e55('0x47')](_0x12e467)[_0x9e55('0x24')](handleEntityNotFound(_0xba8b74,null))[_0x9e55('0x24')](respondWithResult(_0xba8b74,null))[_0x9e55('0x45')](handleError(_0xba8b74,null));};exports[_0x9e55('0x48')]=function(_0x18dae1,_0x5bff75){return db[_0x9e55('0x2c')][_0x9e55('0x48')](_0x18dae1[_0x9e55('0x49')],{})[_0x9e55('0x24')](respondWithResult(_0x5bff75,0xc9))[_0x9e55('0x45')](handleError(_0x5bff75,null));};exports['update']=function(_0x9e9e5b,_0x110a28){if(_0x9e9e5b[_0x9e55('0x49')]['id']){delete _0x9e9e5b['body']['id'];}return db['ZendeskField'][_0x9e55('0x47')]({'where':{'id':_0x9e9e5b[_0x9e55('0x4a')]['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x110a28,null))[_0x9e55('0x24')](saveUpdates(_0x9e9e5b[_0x9e55('0x49')],null))[_0x9e55('0x24')](respondWithResult(_0x110a28,null))[_0x9e55('0x45')](handleError(_0x110a28,null));};exports[_0x9e55('0x4b')]=function(_0x49eb66,_0x1a8f7c){return db[_0x9e55('0x2c')][_0x9e55('0x47')]({'where':{'id':_0x49eb66['params']['id']}})[_0x9e55('0x24')](handleEntityNotFound(_0x1a8f7c,null))[_0x9e55('0x24')](removeEntity(_0x1a8f7c,null))[_0x9e55('0x45')](handleError(_0x1a8f7c,null));}; \ No newline at end of file +var _0xe37a=['update','then','error','stack','name','send','map','rawAttributes','fieldName','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','ZendeskField','include','rows','catch','show','params','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save'];(function(_0x470f4e,_0x2d8125){var _0x5b2643=function(_0x209c5c){while(--_0x209c5c){_0x470f4e['push'](_0x470f4e['shift']());}};_0x5b2643(++_0x2d8125);}(_0xe37a,0x14d));var _0xae37=function(_0x10623d,_0x23aef5){_0x10623d=_0x10623d-0x0;var _0x7c64b3=_0xe37a[_0x10623d];return _0x7c64b3;};'use strict';var emlformat=require(_0xae37('0x0'));var rimraf=require(_0xae37('0x1'));var zipdir=require(_0xae37('0x2'));var jsonpatch=require(_0xae37('0x3'));var rp=require(_0xae37('0x4'));var moment=require(_0xae37('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae37('0x6'));var path=require('path');var sox=require(_0xae37('0x7'));var csv=require(_0xae37('0x8'));var ejs=require(_0xae37('0x9'));var fs=require('fs');var fs_extra=require(_0xae37('0xa'));var _=require('lodash');var squel=require(_0xae37('0xb'));var crypto=require(_0xae37('0xc'));var jsforce=require(_0xae37('0xd'));var deskjs=require(_0xae37('0xe'));var toCsv=require(_0xae37('0x8'));var querystring=require('querystring');var Papa=require(_0xae37('0xf'));var Redis=require(_0xae37('0x10'));var authService=require(_0xae37('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xae37('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae37('0x13'))(_0xae37('0x14'));var utils=require(_0xae37('0x15'));var config=require(_0xae37('0x16'));var licenseUtil=require(_0xae37('0x17'));var db=require(_0xae37('0x18'))['db'];function respondWithStatusCode(_0x25ea59,_0x2879f6){_0x2879f6=_0x2879f6||0xcc;return function(_0x198da5){if(_0x198da5){return _0x25ea59['sendStatus'](_0x2879f6);}return _0x25ea59[_0xae37('0x19')](_0x2879f6)[_0xae37('0x1a')]();};}function respondWithResult(_0x37f52f,_0x5a0eff){_0x5a0eff=_0x5a0eff||0xc8;return function(_0x1409f7){if(_0x1409f7){return _0x37f52f[_0xae37('0x19')](_0x5a0eff)['json'](_0x1409f7);}};}function respondWithFilteredResult(_0x4793fe,_0x573cfe){return function(_0x493f8b){if(_0x493f8b){var _0x2dff6d=typeof _0x573cfe[_0xae37('0x1b')]===_0xae37('0x1c')&&typeof _0x573cfe[_0xae37('0x1d')]===_0xae37('0x1c');var _0x5c4bb1=_0x493f8b[_0xae37('0x1e')];var _0x287352=_0x2dff6d?0x0:_0x573cfe[_0xae37('0x1b')];var _0xd87f8b=_0x2dff6d?_0x493f8b[_0xae37('0x1e')]:_0x573cfe['offset']+_0x573cfe['limit'];var _0x3524dd;if(_0xd87f8b>=_0x5c4bb1){_0xd87f8b=_0x5c4bb1;_0x3524dd=0xc8;}else{_0x3524dd=0xce;}_0x4793fe[_0xae37('0x19')](_0x3524dd);return _0x4793fe[_0xae37('0x1f')](_0xae37('0x20'),_0x287352+'-'+_0xd87f8b+'/'+_0x5c4bb1)[_0xae37('0x21')](_0x493f8b);}return null;};}function patchUpdates(_0x143414){return function(_0x5276fd){try{jsonpatch[_0xae37('0x22')](_0x5276fd,_0x143414,!![]);}catch(_0x4b8c9d){return BPromise[_0xae37('0x23')](_0x4b8c9d);}return _0x5276fd[_0xae37('0x24')]();};}function saveUpdates(_0x263165,_0x4c5ef4){return function(_0x4f901b){if(_0x4f901b){return _0x4f901b[_0xae37('0x25')](_0x263165)['then'](function(_0x482ec8){return _0x482ec8;});}return null;};}function removeEntity(_0x84f94d,_0x44b1d8){return function(_0x64b8c9){if(_0x64b8c9){return _0x64b8c9['destroy']()[_0xae37('0x26')](function(){_0x84f94d['status'](0xcc)[_0xae37('0x1a')]();});}};}function handleEntityNotFound(_0x3df570,_0x212c01){return function(_0x5e476b){if(!_0x5e476b){_0x3df570['sendStatus'](0x194);}return _0x5e476b;};}function handleError(_0x37b490,_0x349563){_0x349563=_0x349563||0x1f4;return function(_0x333a51){logger[_0xae37('0x27')](_0x333a51[_0xae37('0x28')]);if(_0x333a51[_0xae37('0x29')]){delete _0x333a51['name'];}_0x37b490[_0xae37('0x19')](_0x349563)[_0xae37('0x2a')](_0x333a51);};}exports['index']=function(_0x171f95,_0x7cbf8f){var _0x2b6fe5={},_0x36b418={},_0x82e523={'count':0x0,'rows':[]};var _0x5671b1=_[_0xae37('0x2b')](db['ZendeskField'][_0xae37('0x2c')],function(_0x5691eb){return{'name':_0x5691eb[_0xae37('0x2d')],'type':_0x5691eb['type']['key']};});_0x36b418[_0xae37('0x2e')]=_['map'](_0x5671b1,_0xae37('0x29'));_0x36b418['query']=_[_0xae37('0x2f')](_0x171f95[_0xae37('0x30')]);_0x36b418[_0xae37('0x31')]=_['intersection'](_0x36b418[_0xae37('0x2e')],_0x36b418[_0xae37('0x30')]);_0x2b6fe5[_0xae37('0x32')]=_['intersection'](_0x36b418[_0xae37('0x2e')],qs[_0xae37('0x33')](_0x171f95[_0xae37('0x30')][_0xae37('0x33')]));_0x2b6fe5[_0xae37('0x32')]=_0x2b6fe5[_0xae37('0x32')][_0xae37('0x34')]?_0x2b6fe5[_0xae37('0x32')]:_0x36b418['model'];if(!_0x171f95[_0xae37('0x30')][_0xae37('0x35')](_0xae37('0x36'))){_0x2b6fe5[_0xae37('0x1d')]=qs[_0xae37('0x1d')](_0x171f95[_0xae37('0x30')][_0xae37('0x1d')]);_0x2b6fe5[_0xae37('0x1b')]=qs['offset'](_0x171f95[_0xae37('0x30')][_0xae37('0x1b')]);}_0x2b6fe5[_0xae37('0x37')]=qs[_0xae37('0x38')](_0x171f95[_0xae37('0x30')][_0xae37('0x38')]);_0x2b6fe5[_0xae37('0x39')]=qs[_0xae37('0x31')](_[_0xae37('0x3a')](_0x171f95[_0xae37('0x30')],_0x36b418[_0xae37('0x31')]),_0x5671b1);if(_0x171f95[_0xae37('0x30')][_0xae37('0x3b')]){_0x2b6fe5[_0xae37('0x39')]=_[_0xae37('0x3c')](_0x2b6fe5['where'],{'$or':_[_0xae37('0x2b')](_0x5671b1,function(_0xc7bfe6){if(_0xc7bfe6[_0xae37('0x3d')]!=='VIRTUAL'){var _0x488ee5={};_0x488ee5[_0xc7bfe6[_0xae37('0x29')]]={'$like':'%'+_0x171f95['query'][_0xae37('0x3b')]+'%'};return _0x488ee5;}})});}_0x2b6fe5=_[_0xae37('0x3c')]({},_0x2b6fe5,_0x171f95[_0xae37('0x3e')]);var _0x5cd8e5={'where':_0x2b6fe5[_0xae37('0x39')]};return db[_0xae37('0x3f')]['count'](_0x5cd8e5)['then'](function(_0x46d2a1){_0x82e523[_0xae37('0x1e')]=_0x46d2a1;if(_0x171f95[_0xae37('0x30')]['includeAll']){_0x2b6fe5[_0xae37('0x40')]=[{'all':!![]}];}return db[_0xae37('0x3f')]['findAll'](_0x2b6fe5);})['then'](function(_0x57c936){_0x82e523[_0xae37('0x41')]=_0x57c936;return _0x82e523;})[_0xae37('0x26')](respondWithFilteredResult(_0x7cbf8f,_0x2b6fe5))[_0xae37('0x42')](handleError(_0x7cbf8f,null));};exports[_0xae37('0x43')]=function(_0x3f56cc,_0x30003a){var _0x5afc48={'raw':!![],'where':{'id':_0x3f56cc[_0xae37('0x44')]['id']}},_0x33210a={};_0x33210a['model']=_[_0xae37('0x2f')](db['ZendeskField'][_0xae37('0x2c')]);_0x33210a[_0xae37('0x30')]=_[_0xae37('0x2f')](_0x3f56cc[_0xae37('0x30')]);_0x33210a[_0xae37('0x31')]=_[_0xae37('0x45')](_0x33210a[_0xae37('0x2e')],_0x33210a['query']);_0x5afc48[_0xae37('0x32')]=_[_0xae37('0x45')](_0x33210a[_0xae37('0x2e')],qs[_0xae37('0x33')](_0x3f56cc[_0xae37('0x30')][_0xae37('0x33')]));_0x5afc48[_0xae37('0x32')]=_0x5afc48[_0xae37('0x32')]['length']?_0x5afc48[_0xae37('0x32')]:_0x33210a[_0xae37('0x2e')];if(_0x3f56cc['query']['includeAll']){_0x5afc48['include']=[{'all':!![]}];}_0x5afc48=_['merge']({},_0x5afc48,_0x3f56cc[_0xae37('0x3e')]);return db[_0xae37('0x3f')][_0xae37('0x46')](_0x5afc48)[_0xae37('0x26')](handleEntityNotFound(_0x30003a,null))['then'](respondWithResult(_0x30003a,null))[_0xae37('0x42')](handleError(_0x30003a,null));};exports[_0xae37('0x47')]=function(_0x121ed6,_0xd711d3){return db['ZendeskField'][_0xae37('0x47')](_0x121ed6[_0xae37('0x48')],{})[_0xae37('0x26')](respondWithResult(_0xd711d3,0xc9))[_0xae37('0x42')](handleError(_0xd711d3,null));};exports['update']=function(_0x46f6cf,_0x4c4d90){if(_0x46f6cf[_0xae37('0x48')]['id']){delete _0x46f6cf[_0xae37('0x48')]['id'];}return db[_0xae37('0x3f')][_0xae37('0x46')]({'where':{'id':_0x46f6cf[_0xae37('0x44')]['id']}})[_0xae37('0x26')](handleEntityNotFound(_0x4c4d90,null))[_0xae37('0x26')](saveUpdates(_0x46f6cf[_0xae37('0x48')],null))[_0xae37('0x26')](respondWithResult(_0x4c4d90,null))['catch'](handleError(_0x4c4d90,null));};exports[_0xae37('0x49')]=function(_0x4ebb20,_0x32b099){return db[_0xae37('0x3f')][_0xae37('0x46')]({'where':{'id':_0x4ebb20['params']['id']}})[_0xae37('0x26')](handleEntityNotFound(_0x32b099,null))[_0xae37('0x26')](removeEntity(_0x32b099,null))['catch'](handleError(_0x32b099,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c92b304..0c521ab 100644 --- a/server/api/intZendeskField/intZendeskField.model.js +++ b/server/api/intZendeskField/intZendeskField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe481=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xaf5cee,_0x33c89e){var _0x45f1fc=function(_0xac16f9){while(--_0xac16f9){_0xaf5cee['push'](_0xaf5cee['shift']());}};_0x45f1fc(++_0x33c89e);}(_0xe481,0x65));var _0x1e48=function(_0x1abcb6,_0x1ef8b0){_0x1abcb6=_0x1abcb6-0x0;var _0x40a2e9=_0xe481[_0x1abcb6];return _0x40a2e9;};'use strict';var _=require(_0x1e48('0x0'));var util=require(_0x1e48('0x1'));var logger=require(_0x1e48('0x2'))(_0x1e48('0x3'));var moment=require(_0x1e48('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e48('0x5'));var fs=require('fs');var path=require(_0x1e48('0x6'));var rimraf=require(_0x1e48('0x7'));var config=require(_0x1e48('0x8'));var attributes=require(_0x1e48('0x9'));module[_0x1e48('0xa')]=function(_0x5e2bee,_0x50f780){return _0x5e2bee['define'](_0x1e48('0xb'),attributes,{'tableName':_0x1e48('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1e48('0xd'),_0x1e48('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf836=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','ZendeskField','int_zendesk_fields','FieldId'];(function(_0x4c96fb,_0x34fdec){var _0x618e8a=function(_0x580003){while(--_0x580003){_0x4c96fb['push'](_0x4c96fb['shift']());}};_0x618e8a(++_0x34fdec);}(_0xf836,0xc0));var _0x6f83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf836[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6f83('0x0'));var util=require(_0x6f83('0x1'));var logger=require(_0x6f83('0x2'))(_0x6f83('0x3'));var moment=require(_0x6f83('0x4'));var BPromise=require(_0x6f83('0x5'));var rp=require(_0x6f83('0x6'));var fs=require('fs');var path=require(_0x6f83('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x6f83('0x8')]=function(_0x315efd,_0xb96c14){return _0x315efd['define'](_0x6f83('0x9'),attributes,{'tableName':_0x6f83('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x6f83('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 87e3bd4..d285d92 100644 --- a/server/api/intZendeskField/intZendeskField.rpc.js +++ b/server/api/intZendeskField/intZendeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fe7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x6c52d4,_0x49f51b){var _0x22e61e=function(_0x91dca0){while(--_0x91dca0){_0x6c52d4['push'](_0x6c52d4['shift']());}};_0x22e61e(++_0x49f51b);}(_0x4fe7,0x1e0));var _0x74fe=function(_0x198a9d,_0x4780fe){_0x198a9d=_0x198a9d-0x0;var _0x73f65e=_0x4fe7[_0x198a9d];return _0x73f65e;};'use strict';var _=require(_0x74fe('0x0'));var util=require(_0x74fe('0x1'));var moment=require(_0x74fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x74fe('0x3'));var fs=require('fs');var Redis=require(_0x74fe('0x4'));var db=require(_0x74fe('0x5'))['db'];var utils=require(_0x74fe('0x6'));var logger=require(_0x74fe('0x7'))(_0x74fe('0x8'));var config=require(_0x74fe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19fe78,_0x569fd0,_0x31f3b8){return new BPromise(function(_0x29645e,_0x50963a){return client[_0x74fe('0xb')](_0x19fe78,_0x31f3b8)['then'](function(_0xe00273){logger[_0x74fe('0xc')](_0x74fe('0xd'),_0x569fd0,_0x74fe('0xe'));logger[_0x74fe('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x569fd0,_0x74fe('0xe'),JSON[_0x74fe('0x10')](_0xe00273));if(_0xe00273[_0x74fe('0x11')]){if(_0xe00273[_0x74fe('0x11')][_0x74fe('0x12')]===0x1f4){logger[_0x74fe('0x11')](_0x74fe('0xd'),_0x569fd0,_0xe00273[_0x74fe('0x11')][_0x74fe('0x13')]);return _0x50963a(_0xe00273[_0x74fe('0x11')]['message']);}logger['error'](_0x74fe('0xd'),_0x569fd0,_0xe00273['error'][_0x74fe('0x13')]);return _0x29645e(_0xe00273[_0x74fe('0x11')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x569fd0,_0x74fe('0xe'));_0x29645e(_0xe00273[_0x74fe('0x14')][_0x74fe('0x13')]);}})[_0x74fe('0x15')](function(_0x2c1dbf){logger[_0x74fe('0x11')](_0x74fe('0xd'),_0x569fd0,_0x2c1dbf);_0x50963a(_0x2c1dbf);});});} \ No newline at end of file +var _0xbd37=['request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x1d9e71,_0x11babd){var _0x3fa7e6=function(_0x15bf9d){while(--_0x15bf9d){_0x1d9e71['push'](_0x1d9e71['shift']());}};_0x3fa7e6(++_0x11babd);}(_0xbd37,0xfd));var _0x7bd3=function(_0x2160b9,_0x182473){_0x2160b9=_0x2160b9-0x0;var _0x4fdd91=_0xbd37[_0x2160b9];return _0x4fdd91;};'use strict';var _=require(_0x7bd3('0x0'));var util=require('util');var moment=require(_0x7bd3('0x1'));var BPromise=require(_0x7bd3('0x2'));var rs=require(_0x7bd3('0x3'));var fs=require('fs');var Redis=require(_0x7bd3('0x4'));var db=require(_0x7bd3('0x5'))['db'];var utils=require(_0x7bd3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7bd3('0x7'));var jayson=require(_0x7bd3('0x8'));var client=jayson[_0x7bd3('0x9')][_0x7bd3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6e78f3,_0x43c601,_0x47e33e){return new BPromise(function(_0x43cf48,_0x5e757d){return client[_0x7bd3('0xb')](_0x6e78f3,_0x47e33e)['then'](function(_0x599d27){logger[_0x7bd3('0xc')](_0x7bd3('0xd'),_0x43c601,'request\x20sent');logger[_0x7bd3('0xe')](_0x7bd3('0xf'),_0x43c601,_0x7bd3('0x10'),JSON[_0x7bd3('0x11')](_0x599d27));if(_0x599d27[_0x7bd3('0x12')]){if(_0x599d27[_0x7bd3('0x12')]['code']===0x1f4){logger[_0x7bd3('0x12')](_0x7bd3('0xd'),_0x43c601,_0x599d27[_0x7bd3('0x12')]['message']);return _0x5e757d(_0x599d27[_0x7bd3('0x12')][_0x7bd3('0x13')]);}logger[_0x7bd3('0x12')](_0x7bd3('0xd'),_0x43c601,_0x599d27['error']['message']);return _0x43cf48(_0x599d27['error']['message']);}else{logger['info'](_0x7bd3('0xd'),_0x43c601,_0x7bd3('0x10'));_0x43cf48(_0x599d27[_0x7bd3('0x14')][_0x7bd3('0x13')]);}})[_0x7bd3('0x15')](function(_0x2cda14){logger['error']('ZendeskField,\x20%s,\x20%s',_0x43c601,_0x2cda14);_0x5e757d(_0x2cda14);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 934a24b..4b81f1d 100644 --- a/server/api/intZohoAccount/index.js +++ b/server/api/intZohoAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe21=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration'];(function(_0x275bb8,_0x3c09e0){var _0x26aed3=function(_0x51e1e5){while(--_0x51e1e5){_0x275bb8['push'](_0x275bb8['shift']());}};_0x26aed3(++_0x3c09e0);}(_0xfe21,0x1e4));var _0x1fe2=function(_0x346de2,_0x14793c){_0x346de2=_0x346de2-0x0;var _0x385877=_0xfe21[_0x346de2];return _0x385877;};'use strict';var multer=require(_0x1fe2('0x0'));var util=require(_0x1fe2('0x1'));var path=require(_0x1fe2('0x2'));var timeout=require(_0x1fe2('0x3'));var express=require(_0x1fe2('0x4'));var router=express['Router']();var fs_extra=require(_0x1fe2('0x5'));var auth=require(_0x1fe2('0x6'));var interaction=require(_0x1fe2('0x7'));var config=require(_0x1fe2('0x8'));var controller=require(_0x1fe2('0x9'));router['get']('/',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xb')]);router[_0x1fe2('0xc')]('/:id',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xd')]);router[_0x1fe2('0xc')](_0x1fe2('0xe'),auth[_0x1fe2('0xa')](),controller[_0x1fe2('0xf')]);router[_0x1fe2('0xc')](_0x1fe2('0x10'),auth[_0x1fe2('0xa')](),controller['getFields']);router[_0x1fe2('0x11')]('/',auth[_0x1fe2('0xa')](),controller[_0x1fe2('0x12')]);router[_0x1fe2('0x11')](_0x1fe2('0xe'),auth['isAuthenticated'](),controller[_0x1fe2('0x13')]);router['put'](_0x1fe2('0x14'),auth[_0x1fe2('0xa')](),controller[_0x1fe2('0x15')]);router[_0x1fe2('0x16')](_0x1fe2('0x14'),auth[_0x1fe2('0xa')](),controller['destroy']);module[_0x1fe2('0x17')]=router; \ No newline at end of file +var _0xcab0=['./intZohoAccount.controller','get','isAuthenticated','/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcab0,0x1ab));var _0x0cab=function(_0xb19bf8,_0xd3c70f){_0xb19bf8=_0xb19bf8-0x0;var _0x564630=_0xcab0[_0xb19bf8];return _0x564630;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0cab('0x0'));var timeout=require(_0x0cab('0x1'));var express=require('express');var router=express[_0x0cab('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0cab('0x3'));var interaction=require(_0x0cab('0x4'));var config=require('../../config/environment');var controller=require(_0x0cab('0x5'));router[_0x0cab('0x6')]('/',auth[_0x0cab('0x7')](),controller['index']);router[_0x0cab('0x6')](_0x0cab('0x8'),auth[_0x0cab('0x7')](),controller['show']);router[_0x0cab('0x6')]('/:id/configurations',auth[_0x0cab('0x7')](),controller[_0x0cab('0x9')]);router[_0x0cab('0x6')]('/:id/fields',auth[_0x0cab('0x7')](),controller[_0x0cab('0xa')]);router[_0x0cab('0xb')]('/',auth[_0x0cab('0x7')](),controller[_0x0cab('0xc')]);router[_0x0cab('0xb')](_0x0cab('0xd'),auth[_0x0cab('0x7')](),controller[_0x0cab('0xe')]);router[_0x0cab('0xf')](_0x0cab('0x8'),auth[_0x0cab('0x7')](),controller['update']);router['delete'](_0x0cab('0x8'),auth[_0x0cab('0x7')](),controller[_0x0cab('0x10')]);module[_0x0cab('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index aa69343..18d342e 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e6=['sequelize','STRING'];(function(_0x222a14,_0x378764){var _0x3f074a=function(_0x514cc4){while(--_0x514cc4){_0x222a14['push'](_0x222a14['shift']());}};_0x3f074a(++_0x378764);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xb4e6[_0x23e7c1];return _0x1add43;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file +var _0xe5b3=['STRING','exports'];(function(_0x412dab,_0x11b734){var _0x3a3945=function(_0x277286){while(--_0x277286){_0x412dab['push'](_0x412dab['shift']());}};_0x3a3945(++_0x11b734);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3ad029,_0x1e7222){_0x3ad029=_0x3ad029-0x0;var _0x14c19d=_0xe5b3[_0x3ad029];return _0x14c19d;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9e6fa2f..f11c40d 100644 --- a/server/api/intZohoAccount/intZohoAccount.controller.js +++ b/server/api/intZohoAccount/intZohoAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c4c=['clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','ZohoAccount','type','model','name','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','getConfigurations','ZohoConfiguration','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken'];(function(_0x3f2fbb,_0xa096c2){var _0x3a080e=function(_0x11c418){while(--_0x11c418){_0x3f2fbb['push'](_0x3f2fbb['shift']());}};_0x3a080e(++_0xa096c2);}(_0x5c4c,0x11c));var _0xc5c4=function(_0x188b0b,_0x90fbaf){_0x188b0b=_0x188b0b-0x0;var _0x1b7d87=_0x5c4c[_0x188b0b];return _0x1b7d87;};'use strict';var emlformat=require(_0xc5c4('0x0'));var rimraf=require(_0xc5c4('0x1'));var zipdir=require(_0xc5c4('0x2'));var jsonpatch=require(_0xc5c4('0x3'));var rp=require('request-promise');var moment=require(_0xc5c4('0x4'));var BPromise=require(_0xc5c4('0x5'));var Mustache=require(_0xc5c4('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc5c4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5c4('0x8'));var _=require(_0xc5c4('0x9'));var squel=require('squel');var crypto=require(_0xc5c4('0xa'));var jsforce=require(_0xc5c4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc5c4('0x7'));var querystring=require('querystring');var Papa=require(_0xc5c4('0xc'));var Redis=require(_0xc5c4('0xd'));var authService=require(_0xc5c4('0xe'));var qs=require(_0xc5c4('0xf'));var as=require(_0xc5c4('0x10'));var hardwareService=require(_0xc5c4('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc5c4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc5c4('0x13'));var db=require(_0xc5c4('0x14'))['db'];var integrations=require(_0xc5c4('0x15'));function respondWithStatusCode(_0x290ed0,_0x35bc6f){_0x35bc6f=_0x35bc6f||0xcc;return function(_0x4fa56c){if(_0x4fa56c){return _0x290ed0[_0xc5c4('0x16')](_0x35bc6f);}return _0x290ed0[_0xc5c4('0x17')](_0x35bc6f)[_0xc5c4('0x18')]();};}function respondWithResult(_0x1acb2f,_0x242897){_0x242897=_0x242897||0xc8;return function(_0xe1244){if(_0xe1244){return _0x1acb2f[_0xc5c4('0x17')](_0x242897)[_0xc5c4('0x19')](_0xe1244);}};}function respondWithFilteredResult(_0x25b637,_0x3ddbc7){return function(_0x4b1c45){if(_0x4b1c45){var _0x4277be=typeof _0x3ddbc7[_0xc5c4('0x1a')]==='undefined'&&typeof _0x3ddbc7[_0xc5c4('0x1b')]==='undefined';var _0x24ce5d=_0x4b1c45[_0xc5c4('0x1c')];var _0x565465=_0x4277be?0x0:_0x3ddbc7['offset'];var _0x3389ec=_0x4277be?_0x4b1c45[_0xc5c4('0x1c')]:_0x3ddbc7[_0xc5c4('0x1a')]+_0x3ddbc7[_0xc5c4('0x1b')];var _0x3f07f0;if(_0x3389ec>=_0x24ce5d){_0x3389ec=_0x24ce5d;_0x3f07f0=0xc8;}else{_0x3f07f0=0xce;}_0x25b637[_0xc5c4('0x17')](_0x3f07f0);return _0x25b637[_0xc5c4('0x1d')](_0xc5c4('0x1e'),_0x565465+'-'+_0x3389ec+'/'+_0x24ce5d)[_0xc5c4('0x19')](_0x4b1c45);}return null;};}function patchUpdates(_0x1fd511){return function(_0x1db53e){try{jsonpatch[_0xc5c4('0x1f')](_0x1db53e,_0x1fd511,!![]);}catch(_0x5b1956){return BPromise[_0xc5c4('0x20')](_0x5b1956);}return _0x1db53e['save']();};}function saveUpdates(_0x1aca81,_0x54ebbc){return function(_0x43ec8c){if(_0x43ec8c){return _0x43ec8c[_0xc5c4('0x21')](_0x1aca81)[_0xc5c4('0x22')](function(_0x2cfc61){return _0x2cfc61;});}return null;};}function removeEntity(_0x325df1,_0x5a5561){return function(_0x508dbc){if(_0x508dbc){return _0x508dbc[_0xc5c4('0x23')]()[_0xc5c4('0x22')](function(){_0x325df1[_0xc5c4('0x17')](0xcc)[_0xc5c4('0x18')]();});}};}function handleEntityNotFound(_0x420b6b,_0x4f18dc){return function(_0x45e6b0){if(!_0x45e6b0){_0x420b6b[_0xc5c4('0x16')](0x194);}return _0x45e6b0;};}function handleError(_0x74dbce,_0x1c160d){_0x1c160d=_0x1c160d||0x1f4;return function(_0x2efd0f){logger[_0xc5c4('0x24')](_0x2efd0f[_0xc5c4('0x25')]);if(_0x2efd0f['name']){delete _0x2efd0f['name'];}_0x74dbce[_0xc5c4('0x17')](_0x1c160d)[_0xc5c4('0x26')](_0x2efd0f);};}exports[_0xc5c4('0x27')]=function(_0x3ffb50,_0x49348e){var _0x1539d3={},_0x424d99={},_0x2afcd1={'count':0x0,'rows':[]};var _0x3975b8=_[_0xc5c4('0x28')](db[_0xc5c4('0x29')]['rawAttributes'],function(_0x5b5f51){return{'name':_0x5b5f51['fieldName'],'type':_0x5b5f51[_0xc5c4('0x2a')]['key']};});_0x424d99[_0xc5c4('0x2b')]=_['map'](_0x3975b8,_0xc5c4('0x2c'));_0x424d99['query']=_['keys'](_0x3ffb50['query']);_0x424d99['filters']=_['intersection'](_0x424d99[_0xc5c4('0x2b')],_0x424d99[_0xc5c4('0x2d')]);_0x1539d3[_0xc5c4('0x2e')]=_[_0xc5c4('0x2f')](_0x424d99[_0xc5c4('0x2b')],qs[_0xc5c4('0x30')](_0x3ffb50['query'][_0xc5c4('0x30')]));_0x1539d3[_0xc5c4('0x2e')]=_0x1539d3['attributes'][_0xc5c4('0x31')]?_0x1539d3[_0xc5c4('0x2e')]:_0x424d99[_0xc5c4('0x2b')];if(!_0x3ffb50['query'][_0xc5c4('0x32')](_0xc5c4('0x33'))){_0x1539d3[_0xc5c4('0x1b')]=qs[_0xc5c4('0x1b')](_0x3ffb50['query'][_0xc5c4('0x1b')]);_0x1539d3['offset']=qs[_0xc5c4('0x1a')](_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x1a')]);}_0x1539d3[_0xc5c4('0x34')]=qs[_0xc5c4('0x35')](_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x35')]);_0x1539d3['where']=qs[_0xc5c4('0x36')](_['pick'](_0x3ffb50[_0xc5c4('0x2d')],_0x424d99[_0xc5c4('0x36')]),_0x3975b8);if(_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x37')]){_0x1539d3['where']=_[_0xc5c4('0x38')](_0x1539d3[_0xc5c4('0x39')],{'$or':_[_0xc5c4('0x28')](_0x3975b8,function(_0x5be3d2){if(_0x5be3d2[_0xc5c4('0x2a')]!==_0xc5c4('0x3a')){var _0x3db6ad={};_0x3db6ad[_0x5be3d2[_0xc5c4('0x2c')]]={'$like':'%'+_0x3ffb50[_0xc5c4('0x2d')][_0xc5c4('0x37')]+'%'};return _0x3db6ad;}})});}_0x1539d3=_[_0xc5c4('0x38')]({},_0x1539d3,_0x3ffb50[_0xc5c4('0x3b')]);var _0x5d1b9c={'where':_0x1539d3[_0xc5c4('0x39')]};return db[_0xc5c4('0x29')]['count'](_0x5d1b9c)[_0xc5c4('0x22')](function(_0xb18cc2){_0x2afcd1[_0xc5c4('0x1c')]=_0xb18cc2;if(_0x3ffb50[_0xc5c4('0x2d')]['includeAll']){_0x1539d3['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xc5c4('0x3c')](_0x1539d3);})[_0xc5c4('0x22')](function(_0x248557){_0x2afcd1[_0xc5c4('0x3d')]=_0x248557;return _0x2afcd1;})[_0xc5c4('0x22')](respondWithFilteredResult(_0x49348e,_0x1539d3))[_0xc5c4('0x3e')](handleError(_0x49348e,null));};exports[_0xc5c4('0x3f')]=function(_0x3579ea,_0x100680){var _0x34a79b={'raw':![],'where':{'id':_0x3579ea[_0xc5c4('0x40')]['id']}},_0x218926={};_0x218926[_0xc5c4('0x2b')]=_[_0xc5c4('0x41')](db[_0xc5c4('0x29')][_0xc5c4('0x42')]);_0x218926['query']=_[_0xc5c4('0x41')](_0x3579ea[_0xc5c4('0x2d')]);_0x218926['filters']=_['intersection'](_0x218926[_0xc5c4('0x2b')],_0x218926[_0xc5c4('0x2d')]);_0x34a79b[_0xc5c4('0x2e')]=_['intersection'](_0x218926[_0xc5c4('0x2b')],qs['fields'](_0x3579ea[_0xc5c4('0x2d')]['fields']));_0x34a79b['attributes']=_0x34a79b['attributes']['length']?_0x34a79b[_0xc5c4('0x2e')]:_0x218926[_0xc5c4('0x2b')];if(_0x3579ea[_0xc5c4('0x2d')]['includeAll']){_0x34a79b[_0xc5c4('0x43')]=[{'all':!![]}];}_0x34a79b=_['merge']({},_0x34a79b,_0x3579ea[_0xc5c4('0x3b')]);return db['ZohoAccount'][_0xc5c4('0x44')](_0x34a79b)[_0xc5c4('0x22')](handleEntityNotFound(_0x100680,null))[_0xc5c4('0x22')](respondWithResult(_0x100680,null))['catch'](handleError(_0x100680,null));};exports[_0xc5c4('0x45')]=function(_0x3c71fc,_0x1b859b){return db[_0xc5c4('0x29')][_0xc5c4('0x45')](_0x3c71fc[_0xc5c4('0x46')],{})[_0xc5c4('0x22')](respondWithResult(_0x1b859b,0xc9))[_0xc5c4('0x3e')](handleError(_0x1b859b,null));};exports[_0xc5c4('0x21')]=function(_0x3f2b21,_0x402f8f){if(_0x3f2b21[_0xc5c4('0x46')]['id']){delete _0x3f2b21[_0xc5c4('0x46')]['id'];}return db[_0xc5c4('0x29')][_0xc5c4('0x44')]({'where':{'id':_0x3f2b21[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x402f8f,null))['then'](saveUpdates(_0x3f2b21[_0xc5c4('0x46')],null))[_0xc5c4('0x22')](respondWithResult(_0x402f8f,null))[_0xc5c4('0x3e')](handleError(_0x402f8f,null));};exports[_0xc5c4('0x23')]=function(_0x38686e,_0x620a0d){return db[_0xc5c4('0x29')][_0xc5c4('0x44')]({'where':{'id':_0x38686e[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x620a0d,null))[_0xc5c4('0x22')](removeEntity(_0x620a0d,null))['catch'](handleError(_0x620a0d,null));};exports[_0xc5c4('0x47')]=function(_0x891087,_0x3cd80f,_0x418d92){var _0x215d1d={};var _0x520a8d={};var _0x565180;var _0x12005b;return db['ZohoAccount']['findOne']({'where':{'id':_0x891087['params']['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0x3cd80f,null))[_0xc5c4('0x22')](function(_0x1df7df){if(_0x1df7df){_0x565180=_0x1df7df;_0x520a8d[_0xc5c4('0x2b')]=_[_0xc5c4('0x41')](db[_0xc5c4('0x48')]['rawAttributes']);_0x520a8d[_0xc5c4('0x2d')]=_[_0xc5c4('0x41')](_0x891087[_0xc5c4('0x2d')]);_0x520a8d[_0xc5c4('0x36')]=_['intersection'](_0x520a8d[_0xc5c4('0x2b')],_0x520a8d[_0xc5c4('0x2d')]);_0x215d1d[_0xc5c4('0x2e')]=_[_0xc5c4('0x2f')](_0x520a8d['model'],qs[_0xc5c4('0x30')](_0x891087[_0xc5c4('0x2d')][_0xc5c4('0x30')]));_0x215d1d[_0xc5c4('0x2e')]=_0x215d1d[_0xc5c4('0x2e')][_0xc5c4('0x31')]?_0x215d1d[_0xc5c4('0x2e')]:_0x520a8d[_0xc5c4('0x2b')];_0x215d1d[_0xc5c4('0x34')]=qs[_0xc5c4('0x35')](_0x891087[_0xc5c4('0x2d')]['sort']);_0x215d1d[_0xc5c4('0x39')]=qs[_0xc5c4('0x36')](_['pick'](_0x891087[_0xc5c4('0x2d')],_0x520a8d['filters']));if(_0x891087['query'][_0xc5c4('0x37')]){_0x215d1d['where']=_[_0xc5c4('0x38')](_0x215d1d[_0xc5c4('0x39')],{'$or':_[_0xc5c4('0x28')](_0x215d1d['attributes'],function(_0x170234){var _0x321a49={};_0x321a49[_0x170234]={'$like':'%'+_0x891087['query'][_0xc5c4('0x37')]+'%'};return _0x321a49;})});}_0x215d1d=_[_0xc5c4('0x38')]({},_0x215d1d,_0x891087[_0xc5c4('0x3b')]);return _0x565180[_0xc5c4('0x47')](_0x215d1d);}})[_0xc5c4('0x22')](function(_0x57440d){if(_0x57440d){_0x12005b=_0x57440d[_0xc5c4('0x31')];if(!_0x891087[_0xc5c4('0x2d')][_0xc5c4('0x32')]('nolimit')){_0x215d1d[_0xc5c4('0x1b')]=qs[_0xc5c4('0x1b')](_0x891087['query'][_0xc5c4('0x1b')]);_0x215d1d[_0xc5c4('0x1a')]=qs['offset'](_0x891087['query'][_0xc5c4('0x1a')]);}return _0x565180['getConfigurations'](_0x215d1d);}})['then'](function(_0x307aff){if(_0x307aff){return _0x307aff?{'count':_0x12005b,'rows':_0x307aff}:null;}})[_0xc5c4('0x22')](respondWithResult(_0x3cd80f,null))[_0xc5c4('0x3e')](handleError(_0x3cd80f,null));};exports[_0xc5c4('0x49')]=function(_0x4eb0ca,_0xfd765b,_0x352541){if(_0x4eb0ca['body']['id']){delete _0x4eb0ca[_0xc5c4('0x46')]['id'];}return db[_0xc5c4('0x29')][_0xc5c4('0x4a')]({'where':{'id':_0x4eb0ca[_0xc5c4('0x40')]['id']}})[_0xc5c4('0x22')](handleEntityNotFound(_0xfd765b,null))['then'](function(_0x1d425e){if(_0x1d425e){_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x4b')]=_0x1d425e['id'];_0x4eb0ca[_0xc5c4('0x46')]['Subjects']=integrations[_0xc5c4('0x4c')](_0x4eb0ca[_0xc5c4('0x46')]['channel'],_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x2a')]);_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x4d')]=integrations[_0xc5c4('0x4e')](_0x4eb0ca[_0xc5c4('0x46')]['channel'],_0x4eb0ca[_0xc5c4('0x46')][_0xc5c4('0x2a')]);return db['ZohoConfiguration'][_0xc5c4('0x45')](_0x4eb0ca[_0xc5c4('0x46')],{'include':[{'model':db[_0xc5c4('0x4f')],'as':_0xc5c4('0x50')},{'model':db[_0xc5c4('0x4f')],'as':'Descriptions'}]});}return null;})[_0xc5c4('0x22')](respondWithResult(_0xfd765b,null))[_0xc5c4('0x3e')](handleError(_0xfd765b,null));};function getAccessToken(_0x18be03){return new Promise(function(_0x292b1a,_0x568c83){var _0x5082c0;switch(_0x18be03[_0xc5c4('0x51')]){case'US':_0x5082c0=_0xc5c4('0x52');break;case'AU':_0x5082c0=_0xc5c4('0x53');break;case'EU':_0x5082c0=_0xc5c4('0x54');break;case'IN':_0x5082c0='https://accounts.zoho.in';break;case'CN':_0x5082c0=_0xc5c4('0x55');break;default:_0x5082c0='https://accounts.zoho.eu';break;}var _0x56cc96={'method':'POST','uri':_0x5082c0+_0xc5c4('0x56'),'qs':{'refresh_token':_0x18be03[_0xc5c4('0x57')],'client_id':_0x18be03['clientId'],'client_secret':_0x18be03[_0xc5c4('0x58')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x56cc96)['then'](function(_0x71ae5f){if(_0x71ae5f[_0xc5c4('0x59')]){_0x292b1a(_0x71ae5f['access_token']);}else{_0x568c83(_0xc5c4('0x5a'));}})[_0xc5c4('0x3e')](function(_0x1a1319){_0x568c83(_0x1a1319);});});}exports[_0xc5c4('0x5b')]=function(_0x5ccb54,_0x28ccdc,_0x2d0c4b){var _0x5c51ad,_0x31eda5,_0xce511c,_0x5483b1,_0x52b4a9;return db['ZohoAccount']['findOne']({'where':{'id':_0x5ccb54[_0xc5c4('0x40')]['id']},'attributes':['id',_0xc5c4('0x5c'),'zone',_0xc5c4('0x5d'),_0xc5c4('0x58'),'serverUrl',_0xc5c4('0x5e'),'refreshToken']})[_0xc5c4('0x22')](handleEntityNotFound(_0x28ccdc,null))[_0xc5c4('0x22')](function(_0x150eb0){_0x52b4a9=_0x150eb0;_0x5c51ad=_0x52b4a9[_0xc5c4('0x5c')];_0x31eda5=_0x5c51ad===_0xc5c4('0x5f')?'eu':'com';_0xce511c=_0x52b4a9['serverUrl'];var _0x1d011b=_0xce511c[_0xc5c4('0x60')](-0x1);if(_0x1d011b==='/'||_0x1d011b==='\x5c'||_0x1d011b===':'){_0xce511c=_0xce511c[_0xc5c4('0x61')](0x0,_0xce511c[_0xc5c4('0x62')](_0x1d011b));}if(!_0x52b4a9[_0xc5c4('0x57')]){throw new Error(_0xc5c4('0x63'));}return getAccessToken(_0x52b4a9);})[_0xc5c4('0x22')](function(_0x52ec9c){if(_0x52ec9c){return rp({'method':'GET','uri':util[_0xc5c4('0x64')](_0xc5c4('0x65'),_0x31eda5),'qs':{'module':_0xc5c4('0x66')},'headers':{'Authorization':_0xc5c4('0x67')+_0x52ec9c},'json':!![]});}})[_0xc5c4('0x22')](function(_0x257418){if(_0x257418){if(_0x257418[_0xc5c4('0x68')]&&_0x257418[_0xc5c4('0x68')][_0xc5c4('0x24')]){throw new Error(_0x257418[_0xc5c4('0x68')][_0xc5c4('0x24')][_0xc5c4('0x69')]);}var _0x13293b=[];var _0x448c5b=[];var _0x5ec318=['Owner',_0xc5c4('0x6a'),_0xc5c4('0x6b'),_0xc5c4('0x6c'),_0xc5c4('0x6d'),_0xc5c4('0x6e'),_0xc5c4('0x6f'),_0xc5c4('0x70')];_0x448c5b=_[_0xc5c4('0x71')](_0x257418[_0xc5c4('0x30')],function(_0x30027f){return _0x5ec318[_0xc5c4('0x72')](_0x30027f[_0xc5c4('0x73')]);});for(var _0x3367ba=0x0;_0x3367ba<_0x448c5b[_0xc5c4('0x31')];_0x3367ba++){if(_0x448c5b[_0x3367ba]['system_mandatory']===![]){_0x13293b[_0xc5c4('0x74')]({'id':_0x448c5b[_0x3367ba]['id'],'name':_0x448c5b[_0x3367ba][_0xc5c4('0x75')],'custom':_0x448c5b[_0x3367ba][_0xc5c4('0x76')],'options':_0x448c5b[_0x3367ba]['data_type']===_0xc5c4('0x77')&&_0x448c5b[_0x3367ba][_0xc5c4('0x78')][_0xc5c4('0x31')]>-0x1?_[_0xc5c4('0x28')](_0x448c5b[_0x3367ba][_0xc5c4('0x78')],function(_0x5c4afb){return{'name':_0x5c4afb,'value':_0x5c4afb};}):[]});}}return{'count':_0x13293b[_0xc5c4('0x31')],'rows':_0x13293b};}else{return{'count':0x0,'rows':[]};}})[_0xc5c4('0x22')](respondWithResult(_0x28ccdc,null))[_0xc5c4('0x3e')](function(_0x4c0a53){var _0x1407c6=_0x5ccb54[_0xc5c4('0x2d')][_0xc5c4('0x79')]?0x1f4:_0x4c0a53[_0xc5c4('0x7a')]||0x1f4;logger[_0xc5c4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xc5c4('0x5b'),_0x1407c6,JSON['stringify'](_0x4c0a53));delete _0x4c0a53[_0xc5c4('0x2c')];if(_0x1407c6===0x191){_0x1407c6=0x190;}_0x28ccdc['status'](_0x1407c6)[_0xc5c4('0x26')](_0x5ccb54[_0xc5c4('0x2d')][_0xc5c4('0x79')]?{'message':_0xc5c4('0x7b'),'statusCode':_0x4c0a53[_0xc5c4('0x7a')]}:_0x4c0a53);});}; \ No newline at end of file +var _0xe2b7=['slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','api_name','push','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','include','find','create','update','body','getConfigurations','findOne','ZohoConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','clientSecret','serverUrl','code','zoho.eu','com'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xe2b7,0x118));var _0x7e2b=function(_0xece3fb,_0x23e5ec){_0xece3fb=_0xece3fb-0x0;var _0x2b08ce=_0xe2b7[_0xece3fb];return _0x2b08ce;};'use strict';var emlformat=require(_0x7e2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e2b('0x1'));var jsonpatch=require(_0x7e2b('0x2'));var rp=require(_0x7e2b('0x3'));var moment=require(_0x7e2b('0x4'));var BPromise=require(_0x7e2b('0x5'));var Mustache=require(_0x7e2b('0x6'));var util=require(_0x7e2b('0x7'));var path=require(_0x7e2b('0x8'));var sox=require(_0x7e2b('0x9'));var csv=require('to-csv');var ejs=require(_0x7e2b('0xa'));var fs=require('fs');var fs_extra=require(_0x7e2b('0xb'));var _=require(_0x7e2b('0xc'));var squel=require(_0x7e2b('0xd'));var crypto=require(_0x7e2b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7e2b('0xf'));var toCsv=require(_0x7e2b('0x10'));var querystring=require(_0x7e2b('0x11'));var Papa=require(_0x7e2b('0x12'));var Redis=require(_0x7e2b('0x13'));var authService=require(_0x7e2b('0x14'));var qs=require(_0x7e2b('0x15'));var as=require(_0x7e2b('0x16'));var hardwareService=require(_0x7e2b('0x17'));var logger=require(_0x7e2b('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e2b('0x19'));var db=require(_0x7e2b('0x1a'))['db'];var integrations=require(_0x7e2b('0x1b'));function respondWithStatusCode(_0x38d34e,_0x576091){_0x576091=_0x576091||0xcc;return function(_0xabf713){if(_0xabf713){return _0x38d34e[_0x7e2b('0x1c')](_0x576091);}return _0x38d34e[_0x7e2b('0x1d')](_0x576091)[_0x7e2b('0x1e')]();};}function respondWithResult(_0x3f6b44,_0x58d83f){_0x58d83f=_0x58d83f||0xc8;return function(_0x44f8b8){if(_0x44f8b8){return _0x3f6b44[_0x7e2b('0x1d')](_0x58d83f)['json'](_0x44f8b8);}};}function respondWithFilteredResult(_0x5e63a8,_0x22bd93){return function(_0x40497d){if(_0x40497d){var _0x1db3be=typeof _0x22bd93[_0x7e2b('0x1f')]===_0x7e2b('0x20')&&typeof _0x22bd93[_0x7e2b('0x21')]==='undefined';var _0x30cb31=_0x40497d['count'];var _0x319568=_0x1db3be?0x0:_0x22bd93['offset'];var _0x5b9619=_0x1db3be?_0x40497d[_0x7e2b('0x22')]:_0x22bd93[_0x7e2b('0x1f')]+_0x22bd93[_0x7e2b('0x21')];var _0x98018c;if(_0x5b9619>=_0x30cb31){_0x5b9619=_0x30cb31;_0x98018c=0xc8;}else{_0x98018c=0xce;}_0x5e63a8[_0x7e2b('0x1d')](_0x98018c);return _0x5e63a8['set'](_0x7e2b('0x23'),_0x319568+'-'+_0x5b9619+'/'+_0x30cb31)[_0x7e2b('0x24')](_0x40497d);}return null;};}function patchUpdates(_0x239b46){return function(_0x2729f7){try{jsonpatch['apply'](_0x2729f7,_0x239b46,!![]);}catch(_0x1c154a){return BPromise[_0x7e2b('0x25')](_0x1c154a);}return _0x2729f7[_0x7e2b('0x26')]();};}function saveUpdates(_0x4ae32b,_0x4c352d){return function(_0x55cfe2){if(_0x55cfe2){return _0x55cfe2['update'](_0x4ae32b)[_0x7e2b('0x27')](function(_0x3e6837){return _0x3e6837;});}return null;};}function removeEntity(_0x482d41,_0x50de3f){return function(_0x4af3c6){if(_0x4af3c6){return _0x4af3c6[_0x7e2b('0x28')]()['then'](function(){_0x482d41[_0x7e2b('0x1d')](0xcc)[_0x7e2b('0x1e')]();});}};}function handleEntityNotFound(_0x328b49,_0x2bd906){return function(_0x1a7cdb){if(!_0x1a7cdb){_0x328b49[_0x7e2b('0x1c')](0x194);}return _0x1a7cdb;};}function handleError(_0x229da0,_0xcbf59e){_0xcbf59e=_0xcbf59e||0x1f4;return function(_0x503b10){logger[_0x7e2b('0x29')](_0x503b10[_0x7e2b('0x2a')]);if(_0x503b10[_0x7e2b('0x2b')]){delete _0x503b10['name'];}_0x229da0[_0x7e2b('0x1d')](_0xcbf59e)[_0x7e2b('0x2c')](_0x503b10);};}exports[_0x7e2b('0x2d')]=function(_0x92836a,_0x44b080){var _0x539275={},_0x3c9afa={},_0x1e5a25={'count':0x0,'rows':[]};var _0x40723a=_['map'](db[_0x7e2b('0x2e')][_0x7e2b('0x2f')],function(_0x3c31fd){return{'name':_0x3c31fd[_0x7e2b('0x30')],'type':_0x3c31fd[_0x7e2b('0x31')][_0x7e2b('0x32')]};});_0x3c9afa[_0x7e2b('0x33')]=_[_0x7e2b('0x34')](_0x40723a,_0x7e2b('0x2b'));_0x3c9afa[_0x7e2b('0x35')]=_[_0x7e2b('0x36')](_0x92836a[_0x7e2b('0x35')]);_0x3c9afa[_0x7e2b('0x37')]=_['intersection'](_0x3c9afa['model'],_0x3c9afa[_0x7e2b('0x35')]);_0x539275[_0x7e2b('0x38')]=_['intersection'](_0x3c9afa[_0x7e2b('0x33')],qs[_0x7e2b('0x39')](_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x39')]));_0x539275[_0x7e2b('0x38')]=_0x539275['attributes']['length']?_0x539275[_0x7e2b('0x38')]:_0x3c9afa['model'];if(!_0x92836a[_0x7e2b('0x35')]['hasOwnProperty'](_0x7e2b('0x3a'))){_0x539275[_0x7e2b('0x21')]=qs[_0x7e2b('0x21')](_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x21')]);_0x539275['offset']=qs['offset'](_0x92836a['query'][_0x7e2b('0x1f')]);}_0x539275['order']=qs['sort'](_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x3b')]);_0x539275[_0x7e2b('0x3c')]=qs[_0x7e2b('0x37')](_[_0x7e2b('0x3d')](_0x92836a[_0x7e2b('0x35')],_0x3c9afa[_0x7e2b('0x37')]),_0x40723a);if(_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x3e')]){_0x539275[_0x7e2b('0x3c')]=_[_0x7e2b('0x3f')](_0x539275[_0x7e2b('0x3c')],{'$or':_[_0x7e2b('0x34')](_0x40723a,function(_0x185af7){if(_0x185af7[_0x7e2b('0x31')]!==_0x7e2b('0x40')){var _0x3edad3={};_0x3edad3[_0x185af7[_0x7e2b('0x2b')]]={'$like':'%'+_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x3e')]+'%'};return _0x3edad3;}})});}_0x539275=_['merge']({},_0x539275,_0x92836a[_0x7e2b('0x41')]);var _0x5736c4={'where':_0x539275[_0x7e2b('0x3c')]};return db[_0x7e2b('0x2e')][_0x7e2b('0x22')](_0x5736c4)['then'](function(_0x5c1f36){_0x1e5a25['count']=_0x5c1f36;if(_0x92836a[_0x7e2b('0x35')][_0x7e2b('0x42')]){_0x539275['include']=[{'all':!![]}];}return db[_0x7e2b('0x2e')][_0x7e2b('0x43')](_0x539275);})[_0x7e2b('0x27')](function(_0x5220ac){_0x1e5a25[_0x7e2b('0x44')]=_0x5220ac;return _0x1e5a25;})['then'](respondWithFilteredResult(_0x44b080,_0x539275))[_0x7e2b('0x45')](handleError(_0x44b080,null));};exports[_0x7e2b('0x46')]=function(_0x502cb6,_0x2cf773){var _0x4a6a99={'raw':![],'where':{'id':_0x502cb6[_0x7e2b('0x47')]['id']}},_0x340a9c={};_0x340a9c[_0x7e2b('0x33')]=_['keys'](db[_0x7e2b('0x2e')]['rawAttributes']);_0x340a9c['query']=_[_0x7e2b('0x36')](_0x502cb6[_0x7e2b('0x35')]);_0x340a9c[_0x7e2b('0x37')]=_[_0x7e2b('0x48')](_0x340a9c[_0x7e2b('0x33')],_0x340a9c[_0x7e2b('0x35')]);_0x4a6a99['attributes']=_[_0x7e2b('0x48')](_0x340a9c['model'],qs['fields'](_0x502cb6[_0x7e2b('0x35')][_0x7e2b('0x39')]));_0x4a6a99[_0x7e2b('0x38')]=_0x4a6a99[_0x7e2b('0x38')][_0x7e2b('0x49')]?_0x4a6a99[_0x7e2b('0x38')]:_0x340a9c[_0x7e2b('0x33')];if(_0x502cb6[_0x7e2b('0x35')][_0x7e2b('0x42')]){_0x4a6a99[_0x7e2b('0x4a')]=[{'all':!![]}];}_0x4a6a99=_['merge']({},_0x4a6a99,_0x502cb6['options']);return db[_0x7e2b('0x2e')][_0x7e2b('0x4b')](_0x4a6a99)[_0x7e2b('0x27')](handleEntityNotFound(_0x2cf773,null))[_0x7e2b('0x27')](respondWithResult(_0x2cf773,null))[_0x7e2b('0x45')](handleError(_0x2cf773,null));};exports[_0x7e2b('0x4c')]=function(_0x49daeb,_0x59caf2){return db['ZohoAccount'][_0x7e2b('0x4c')](_0x49daeb['body'],{})['then'](respondWithResult(_0x59caf2,0xc9))['catch'](handleError(_0x59caf2,null));};exports[_0x7e2b('0x4d')]=function(_0x1838bc,_0x42d566){if(_0x1838bc[_0x7e2b('0x4e')]['id']){delete _0x1838bc['body']['id'];}return db[_0x7e2b('0x2e')][_0x7e2b('0x4b')]({'where':{'id':_0x1838bc['params']['id']}})[_0x7e2b('0x27')](handleEntityNotFound(_0x42d566,null))['then'](saveUpdates(_0x1838bc['body'],null))[_0x7e2b('0x27')](respondWithResult(_0x42d566,null))[_0x7e2b('0x45')](handleError(_0x42d566,null));};exports[_0x7e2b('0x28')]=function(_0x48aa19,_0x298b69){return db[_0x7e2b('0x2e')][_0x7e2b('0x4b')]({'where':{'id':_0x48aa19['params']['id']}})[_0x7e2b('0x27')](handleEntityNotFound(_0x298b69,null))[_0x7e2b('0x27')](removeEntity(_0x298b69,null))['catch'](handleError(_0x298b69,null));};exports[_0x7e2b('0x4f')]=function(_0x30d4ae,_0x53d4e9,_0x427480){var _0x16c658={};var _0x18f163={};var _0x1c49c9;var _0x53429e;return db[_0x7e2b('0x2e')][_0x7e2b('0x50')]({'where':{'id':_0x30d4ae[_0x7e2b('0x47')]['id']}})[_0x7e2b('0x27')](handleEntityNotFound(_0x53d4e9,null))[_0x7e2b('0x27')](function(_0x291873){if(_0x291873){_0x1c49c9=_0x291873;_0x18f163[_0x7e2b('0x33')]=_[_0x7e2b('0x36')](db[_0x7e2b('0x51')][_0x7e2b('0x2f')]);_0x18f163[_0x7e2b('0x35')]=_[_0x7e2b('0x36')](_0x30d4ae['query']);_0x18f163[_0x7e2b('0x37')]=_[_0x7e2b('0x48')](_0x18f163[_0x7e2b('0x33')],_0x18f163['query']);_0x16c658[_0x7e2b('0x38')]=_[_0x7e2b('0x48')](_0x18f163[_0x7e2b('0x33')],qs[_0x7e2b('0x39')](_0x30d4ae['query'][_0x7e2b('0x39')]));_0x16c658[_0x7e2b('0x38')]=_0x16c658[_0x7e2b('0x38')][_0x7e2b('0x49')]?_0x16c658['attributes']:_0x18f163[_0x7e2b('0x33')];_0x16c658[_0x7e2b('0x52')]=qs[_0x7e2b('0x3b')](_0x30d4ae[_0x7e2b('0x35')][_0x7e2b('0x3b')]);_0x16c658['where']=qs['filters'](_['pick'](_0x30d4ae['query'],_0x18f163[_0x7e2b('0x37')]));if(_0x30d4ae[_0x7e2b('0x35')]['filter']){_0x16c658['where']=_[_0x7e2b('0x3f')](_0x16c658[_0x7e2b('0x3c')],{'$or':_['map'](_0x16c658['attributes'],function(_0x3eed10){var _0x3dc1e9={};_0x3dc1e9[_0x3eed10]={'$like':'%'+_0x30d4ae[_0x7e2b('0x35')]['filter']+'%'};return _0x3dc1e9;})});}_0x16c658=_[_0x7e2b('0x3f')]({},_0x16c658,_0x30d4ae[_0x7e2b('0x41')]);return _0x1c49c9[_0x7e2b('0x4f')](_0x16c658);}})[_0x7e2b('0x27')](function(_0xfb41ed){if(_0xfb41ed){_0x53429e=_0xfb41ed[_0x7e2b('0x49')];if(!_0x30d4ae[_0x7e2b('0x35')][_0x7e2b('0x53')]('nolimit')){_0x16c658[_0x7e2b('0x21')]=qs['limit'](_0x30d4ae[_0x7e2b('0x35')][_0x7e2b('0x21')]);_0x16c658['offset']=qs[_0x7e2b('0x1f')](_0x30d4ae[_0x7e2b('0x35')][_0x7e2b('0x1f')]);}return _0x1c49c9[_0x7e2b('0x4f')](_0x16c658);}})['then'](function(_0xa140b4){if(_0xa140b4){return _0xa140b4?{'count':_0x53429e,'rows':_0xa140b4}:null;}})[_0x7e2b('0x27')](respondWithResult(_0x53d4e9,null))[_0x7e2b('0x45')](handleError(_0x53d4e9,null));};exports[_0x7e2b('0x54')]=function(_0x14ebb9,_0x48ebc8,_0x3af25a){if(_0x14ebb9[_0x7e2b('0x4e')]['id']){delete _0x14ebb9[_0x7e2b('0x4e')]['id'];}return db['ZohoAccount'][_0x7e2b('0x50')]({'where':{'id':_0x14ebb9[_0x7e2b('0x47')]['id']}})[_0x7e2b('0x27')](handleEntityNotFound(_0x48ebc8,null))[_0x7e2b('0x27')](function(_0x430392){if(_0x430392){_0x14ebb9['body'][_0x7e2b('0x55')]=_0x430392['id'];_0x14ebb9['body'][_0x7e2b('0x56')]=integrations[_0x7e2b('0x57')](_0x14ebb9[_0x7e2b('0x4e')][_0x7e2b('0x58')],_0x14ebb9[_0x7e2b('0x4e')][_0x7e2b('0x31')]);_0x14ebb9[_0x7e2b('0x4e')][_0x7e2b('0x59')]=integrations[_0x7e2b('0x5a')](_0x14ebb9[_0x7e2b('0x4e')][_0x7e2b('0x58')],_0x14ebb9[_0x7e2b('0x4e')]['type']);return db[_0x7e2b('0x51')][_0x7e2b('0x4c')](_0x14ebb9[_0x7e2b('0x4e')],{'include':[{'model':db['ZohoField'],'as':_0x7e2b('0x56')},{'model':db[_0x7e2b('0x5b')],'as':'Descriptions'}]});}return null;})[_0x7e2b('0x27')](respondWithResult(_0x48ebc8,null))[_0x7e2b('0x45')](handleError(_0x48ebc8,null));};function getAccessToken(_0x37d2ee){return new Promise(function(_0x56d1e8,_0x3c9b90){var _0x353318;switch(_0x37d2ee[_0x7e2b('0x5c')]){case'US':_0x353318=_0x7e2b('0x5d');break;case'AU':_0x353318=_0x7e2b('0x5e');break;case'EU':_0x353318=_0x7e2b('0x5f');break;case'IN':_0x353318=_0x7e2b('0x60');break;case'CN':_0x353318='https://accounts.zoho.com.cn';break;default:_0x353318=_0x7e2b('0x5f');break;}var _0x5d4a57={'method':'POST','uri':_0x353318+_0x7e2b('0x61'),'qs':{'refresh_token':_0x37d2ee[_0x7e2b('0x62')],'client_id':_0x37d2ee['clientId'],'client_secret':_0x37d2ee['clientSecret'],'grant_type':_0x7e2b('0x63')},'json':!![]};return rp(_0x5d4a57)[_0x7e2b('0x27')](function(_0x24f55a){if(_0x24f55a[_0x7e2b('0x64')]){_0x56d1e8(_0x24f55a[_0x7e2b('0x64')]);}else{_0x3c9b90(_0x7e2b('0x65'));}})['catch'](function(_0xef810c){_0x3c9b90(_0xef810c);});});}exports[_0x7e2b('0x66')]=function(_0x558497,_0x3b5108,_0xb115f4){var _0x30e669,_0x275d8e,_0x4c3995,_0x5744e6,_0x1a356b;return db[_0x7e2b('0x2e')][_0x7e2b('0x50')]({'where':{'id':_0x558497[_0x7e2b('0x47')]['id']},'attributes':['id',_0x7e2b('0x67'),'zone',_0x7e2b('0x68'),_0x7e2b('0x69'),_0x7e2b('0x6a'),_0x7e2b('0x6b'),_0x7e2b('0x62')]})[_0x7e2b('0x27')](handleEntityNotFound(_0x3b5108,null))['then'](function(_0x4fc5e1){_0x1a356b=_0x4fc5e1;_0x30e669=_0x1a356b[_0x7e2b('0x67')];_0x275d8e=_0x30e669===_0x7e2b('0x6c')?'eu':_0x7e2b('0x6d');_0x4c3995=_0x1a356b[_0x7e2b('0x6a')];var _0x5332f4=_0x4c3995[_0x7e2b('0x6e')](-0x1);if(_0x5332f4==='/'||_0x5332f4==='\x5c'||_0x5332f4===':'){_0x4c3995=_0x4c3995['substring'](0x0,_0x4c3995[_0x7e2b('0x6f')](_0x5332f4));}if(!_0x1a356b['refreshToken']){throw new Error(_0x7e2b('0x70'));}return getAccessToken(_0x1a356b);})[_0x7e2b('0x27')](function(_0x47bf2c){if(_0x47bf2c){return rp({'method':_0x7e2b('0x71'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x275d8e),'qs':{'module':_0x7e2b('0x72')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47bf2c},'json':!![]});}})[_0x7e2b('0x27')](function(_0xed1faf){if(_0xed1faf){if(_0xed1faf[_0x7e2b('0x73')]&&_0xed1faf[_0x7e2b('0x73')][_0x7e2b('0x29')]){throw new Error(_0xed1faf[_0x7e2b('0x73')][_0x7e2b('0x29')]['message']);}var _0x2ac1fa=[];var _0x127040=[];var _0x5984f3=[_0x7e2b('0x74'),_0x7e2b('0x75'),_0x7e2b('0x76'),_0x7e2b('0x77'),_0x7e2b('0x78'),'Call_Result',_0x7e2b('0x79'),'Call_Type'];_0x127040=_['remove'](_0xed1faf[_0x7e2b('0x39')],function(_0x1fca22){return _0x5984f3['includes'](_0x1fca22[_0x7e2b('0x7a')]);});for(var _0x440750=0x0;_0x440750<_0x127040['length'];_0x440750++){if(_0x127040[_0x440750]['system_mandatory']===![]){_0x2ac1fa[_0x7e2b('0x7b')]({'id':_0x127040[_0x440750]['id'],'name':_0x127040[_0x440750]['display_label'],'custom':_0x127040[_0x440750]['custom_field'],'options':_0x127040[_0x440750][_0x7e2b('0x7c')]===_0x7e2b('0x7d')&&_0x127040[_0x440750][_0x7e2b('0x7e')][_0x7e2b('0x49')]>-0x1?_[_0x7e2b('0x34')](_0x127040[_0x440750][_0x7e2b('0x7e')],function(_0x3af79c){return{'name':_0x3af79c,'value':_0x3af79c};}):[]});}}return{'count':_0x2ac1fa[_0x7e2b('0x49')],'rows':_0x2ac1fa};}else{return{'count':0x0,'rows':[]};}})[_0x7e2b('0x27')](respondWithResult(_0x3b5108,null))[_0x7e2b('0x45')](function(_0x36a8d4){var _0x3d6fce=_0x558497[_0x7e2b('0x35')][_0x7e2b('0x7f')]?0x1f4:_0x36a8d4['statusCode']||0x1f4;logger[_0x7e2b('0x29')](_0x7e2b('0x80'),_0x7e2b('0x66'),_0x3d6fce,JSON[_0x7e2b('0x81')](_0x36a8d4));delete _0x36a8d4[_0x7e2b('0x2b')];if(_0x3d6fce===0x191){_0x3d6fce=0x190;}_0x3b5108[_0x7e2b('0x1d')](_0x3d6fce)[_0x7e2b('0x2c')](_0x558497['query'][_0x7e2b('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x36a8d4['statusCode']}:_0x36a8d4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 71a76ec..a113e7e 100644 --- a/server/api/intZohoAccount/intZohoAccount.model.js +++ b/server/api/intZohoAccount/intZohoAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec98=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','zone','substring','https://accounts.zoho.com.cn','application/x-www-form-urlencoded','lodash','util','../../config/logger','api','moment','path','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','code','host','slice'];(function(_0x320e94,_0x4140b1){var _0x1002be=function(_0x3244e2){while(--_0x3244e2){_0x320e94['push'](_0x320e94['shift']());}};_0x1002be(++_0x4140b1);}(_0xec98,0x11b));var _0x8ec9=function(_0x149c17,_0x1be90f){_0x149c17=_0x149c17-0x0;var _0x38ff55=_0xec98[_0x149c17];return _0x38ff55;};'use strict';var _=require(_0x8ec9('0x0'));var util=require(_0x8ec9('0x1'));var logger=require(_0x8ec9('0x2'))(_0x8ec9('0x3'));var moment=require(_0x8ec9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ec9('0x5'));var rimraf=require('rimraf');var config=require(_0x8ec9('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8ec9('0x7'));module[_0x8ec9('0x8')]=function(_0x4ebf84,_0x46ccb9){return _0x4ebf84[_0x8ec9('0x9')](_0x8ec9('0xa'),attributes,{'tableName':_0x8ec9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x315afe,_0x2dd136,_0x212b36){if(_0x315afe[_0x8ec9('0xc')]('zone')||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0xd'))||_0x315afe['changed'](_0x8ec9('0xe'))||_0x315afe[_0x8ec9('0xc')]('clientSecret')||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0xf'))||_0x315afe[_0x8ec9('0xc')](_0x8ec9('0x10'))){var _0x38900a,_0x4f76b6;_0x38900a=_0x315afe[_0x8ec9('0xd')];var _0x1927bf=_0x38900a[_0x8ec9('0x11')](-0x1);if(_0x1927bf==='/'||_0x1927bf==='\x5c'||_0x1927bf===':'){_0x38900a=_0x38900a['substring'](0x0,_0x38900a[_0x8ec9('0x12')](_0x1927bf));}switch(_0x315afe['zone']){case'US':_0x4f76b6=_0x8ec9('0x13');break;case'AU':_0x4f76b6=_0x8ec9('0x14');break;case'IN':_0x4f76b6=_0x8ec9('0x15');break;case'CN':_0x4f76b6='https://accounts.zoho.com.cn';break;default:_0x4f76b6=_0x8ec9('0x16');break;}var _0x2e5472={'method':_0x8ec9('0x17'),'uri':_0x4f76b6+_0x8ec9('0x18'),'form':{'grant_type':_0x8ec9('0x19'),'client_id':_0x315afe[_0x8ec9('0xe')],'client_secret':_0x315afe[_0x8ec9('0x1a')],'redirect_uri':_0x315afe[_0x8ec9('0xd')],'code':_0x315afe[_0x8ec9('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2e5472)[_0x8ec9('0x1b')](function(_0xa03ba1){var _0x29ee75=JSON[_0x8ec9('0x1c')](_0xa03ba1);if(_0x29ee75['refresh_token']){_0x315afe[_0x8ec9('0x1d')]=_0x29ee75[_0x8ec9('0x1e')];logger[_0x8ec9('0x1f')](util[_0x8ec9('0x20')](_0x8ec9('0x21'),_0x315afe[_0x8ec9('0x22')],_0x315afe['id']));}else{logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x315afe[_0x8ec9('0x22')],_0x315afe['id']),util[_0x8ec9('0x24')](_0x29ee75,{'showHidden':![],'depth':null}));}return _0x212b36(null,_0x2dd136);})[_0x8ec9('0x25')](function(_0x258aea){logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')](_0x8ec9('0x26'),_0x315afe['name'],_0x315afe['id']),util[_0x8ec9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x212b36(_0x258aea);});}else{return _0x212b36(null,_0x2dd136);}},'beforeUpdate':function(_0x1f1b22,_0x3910f7,_0x5b735a){if(_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0x27'))||_0x1f1b22['changed'](_0x8ec9('0xd'))||_0x1f1b22['changed'](_0x8ec9('0xe'))||_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0x1a'))||_0x1f1b22[_0x8ec9('0xc')](_0x8ec9('0xf'))||_0x1f1b22[_0x8ec9('0xc')]('host')){var _0x2ae1b5,_0x5f41f9;_0x2ae1b5=_0x1f1b22['serverUrl'];var _0x40da85=_0x2ae1b5['slice'](-0x1);if(_0x40da85==='/'||_0x40da85==='\x5c'||_0x40da85===':'){_0x2ae1b5=_0x2ae1b5[_0x8ec9('0x28')](0x0,_0x2ae1b5[_0x8ec9('0x12')](_0x40da85));}switch(_0x1f1b22['zone']){case'US':_0x5f41f9=_0x8ec9('0x13');break;case'AU':_0x5f41f9=_0x8ec9('0x14');break;case'IN':_0x5f41f9=_0x8ec9('0x15');break;case'CN':_0x5f41f9=_0x8ec9('0x29');break;default:_0x5f41f9='https://accounts.zoho.eu';break;}var _0xa2903c={'method':_0x8ec9('0x17'),'uri':_0x5f41f9+_0x8ec9('0x18'),'form':{'grant_type':_0x8ec9('0x19'),'client_id':_0x1f1b22[_0x8ec9('0xe')],'client_secret':_0x1f1b22[_0x8ec9('0x1a')],'redirect_uri':_0x1f1b22[_0x8ec9('0xd')],'code':_0x1f1b22[_0x8ec9('0xf')]},'headers':{'Content-Type':_0x8ec9('0x2a')}};return rp(_0xa2903c)['then'](function(_0x1e3a05){var _0x2534db=JSON['parse'](_0x1e3a05);if(_0x2534db[_0x8ec9('0x1e')]){_0x1f1b22[_0x8ec9('0x1d')]=_0x2534db[_0x8ec9('0x1e')];logger['info'](util[_0x8ec9('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']),util['inspect'](_0x2534db,{'showHidden':![],'depth':null}));}return _0x5b735a(null,_0x3910f7);})[_0x8ec9('0x25')](function(_0x2a5346){logger[_0x8ec9('0x23')](util[_0x8ec9('0x20')](_0x8ec9('0x26'),_0x1f1b22[_0x8ec9('0x22')],_0x1f1b22['id']),util[_0x8ec9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b735a(_0x2a5346);});}else{return _0x5b735a(null,_0x3910f7);}}}});}; \ No newline at end of file +var _0xc257=['https://accounts.zoho.in','POST','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','https://accounts.zoho.com'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xc257,0x173));var _0x7c25=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xc257[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7c25('0x0'));var util=require('util');var logger=require(_0x7c25('0x1'))('api');var moment=require(_0x7c25('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c25('0x3'));var fs=require('fs');var path=require(_0x7c25('0x4'));var rimraf=require(_0x7c25('0x5'));var config=require(_0x7c25('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x7c25('0x7')]=function(_0x316bfa,_0x40b823){return _0x316bfa[_0x7c25('0x8')](_0x7c25('0x9'),attributes,{'tableName':_0x7c25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x38ef3e,_0x36097c,_0x1488ae){if(_0x38ef3e[_0x7c25('0xb')](_0x7c25('0xc'))||_0x38ef3e[_0x7c25('0xb')](_0x7c25('0xd'))||_0x38ef3e[_0x7c25('0xb')](_0x7c25('0xe'))||_0x38ef3e['changed'](_0x7c25('0xf'))||_0x38ef3e[_0x7c25('0xb')](_0x7c25('0x10'))||_0x38ef3e[_0x7c25('0xb')]('host')){var _0x148b65,_0x4281d0;_0x148b65=_0x38ef3e['serverUrl'];var _0x44c861=_0x148b65[_0x7c25('0x11')](-0x1);if(_0x44c861==='/'||_0x44c861==='\x5c'||_0x44c861===':'){_0x148b65=_0x148b65[_0x7c25('0x12')](0x0,_0x148b65[_0x7c25('0x13')](_0x44c861));}switch(_0x38ef3e[_0x7c25('0xc')]){case'US':_0x4281d0='https://accounts.zoho.com';break;case'AU':_0x4281d0=_0x7c25('0x14');break;case'IN':_0x4281d0='https://accounts.zoho.in';break;case'CN':_0x4281d0=_0x7c25('0x15');break;default:_0x4281d0=_0x7c25('0x16');break;}var _0x409912={'method':'POST','uri':_0x4281d0+_0x7c25('0x17'),'form':{'grant_type':_0x7c25('0x18'),'client_id':_0x38ef3e['clientId'],'client_secret':_0x38ef3e[_0x7c25('0xf')],'redirect_uri':_0x38ef3e[_0x7c25('0xd')],'code':_0x38ef3e['code']},'headers':{'Content-Type':_0x7c25('0x19')}};return rp(_0x409912)['then'](function(_0x3fe01a){var _0x5a90f8=JSON[_0x7c25('0x1a')](_0x3fe01a);if(_0x5a90f8[_0x7c25('0x1b')]){_0x38ef3e[_0x7c25('0x1c')]=_0x5a90f8[_0x7c25('0x1b')];logger[_0x7c25('0x1d')](util[_0x7c25('0x1e')](_0x7c25('0x1f'),_0x38ef3e[_0x7c25('0x20')],_0x38ef3e['id']));}else{logger[_0x7c25('0x21')](util['format'](_0x7c25('0x22'),_0x38ef3e[_0x7c25('0x20')],_0x38ef3e['id']),util[_0x7c25('0x23')](_0x5a90f8,{'showHidden':![],'depth':null}));}return _0x1488ae(null,_0x36097c);})[_0x7c25('0x24')](function(_0x5dff08){logger[_0x7c25('0x21')](util['format'](_0x7c25('0x22'),_0x38ef3e[_0x7c25('0x20')],_0x38ef3e['id']),util[_0x7c25('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1488ae(_0x5dff08);});}else{return _0x1488ae(null,_0x36097c);}},'beforeUpdate':function(_0x4bd593,_0x3e53b3,_0x53e19b){if(_0x4bd593['changed']('zone')||_0x4bd593[_0x7c25('0xb')](_0x7c25('0xd'))||_0x4bd593[_0x7c25('0xb')](_0x7c25('0xe'))||_0x4bd593[_0x7c25('0xb')](_0x7c25('0xf'))||_0x4bd593[_0x7c25('0xb')](_0x7c25('0x10'))||_0x4bd593[_0x7c25('0xb')](_0x7c25('0x25'))){var _0x3487fb,_0x4e9678;_0x3487fb=_0x4bd593[_0x7c25('0xd')];var _0x45c768=_0x3487fb['slice'](-0x1);if(_0x45c768==='/'||_0x45c768==='\x5c'||_0x45c768===':'){_0x3487fb=_0x3487fb[_0x7c25('0x12')](0x0,_0x3487fb['lastIndexOf'](_0x45c768));}switch(_0x4bd593[_0x7c25('0xc')]){case'US':_0x4e9678=_0x7c25('0x26');break;case'AU':_0x4e9678='https://accounts.zoho.com.au';break;case'IN':_0x4e9678=_0x7c25('0x27');break;case'CN':_0x4e9678=_0x7c25('0x15');break;default:_0x4e9678=_0x7c25('0x16');break;}var _0x4a6599={'method':_0x7c25('0x28'),'uri':_0x4e9678+_0x7c25('0x17'),'form':{'grant_type':_0x7c25('0x18'),'client_id':_0x4bd593[_0x7c25('0xe')],'client_secret':_0x4bd593[_0x7c25('0xf')],'redirect_uri':_0x4bd593[_0x7c25('0xd')],'code':_0x4bd593['code']},'headers':{'Content-Type':_0x7c25('0x19')}};return rp(_0x4a6599)['then'](function(_0x2deae2){var _0x3ecbb6=JSON[_0x7c25('0x1a')](_0x2deae2);if(_0x3ecbb6[_0x7c25('0x1b')]){_0x4bd593['refreshToken']=_0x3ecbb6[_0x7c25('0x1b')];logger['info'](util[_0x7c25('0x1e')](_0x7c25('0x1f'),_0x4bd593[_0x7c25('0x20')],_0x4bd593['id']));}else{logger[_0x7c25('0x21')](util[_0x7c25('0x1e')](_0x7c25('0x22'),_0x4bd593[_0x7c25('0x20')],_0x4bd593['id']),util[_0x7c25('0x23')](_0x3ecbb6,{'showHidden':![],'depth':null}));}return _0x53e19b(null,_0x3e53b3);})[_0x7c25('0x24')](function(_0x14309a){logger[_0x7c25('0x21')](util[_0x7c25('0x1e')](_0x7c25('0x22'),_0x4bd593[_0x7c25('0x20')],_0x4bd593['id']),util[_0x7c25('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x53e19b(_0x14309a);});}else{return _0x53e19b(null,_0x3e53b3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index a0cb64f..3257efb 100644 --- a/server/api/intZohoAccount/intZohoAccount.rpc.js +++ b/server/api/intZohoAccount/intZohoAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4849=['ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZohoAccount','find','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4849,0xf8));var _0x9484=function(_0x50760b,_0x11a4e1){_0x50760b=_0x50760b-0x0;var _0x18b3ce=_0x4849[_0x50760b];return _0x18b3ce;};'use strict';var _=require(_0x9484('0x0'));var util=require(_0x9484('0x1'));var moment=require(_0x9484('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9484('0x3'));var db=require(_0x9484('0x4'))['db'];var utils=require(_0x9484('0x5'));var logger=require(_0x9484('0x6'))(_0x9484('0x7'));var config=require(_0x9484('0x8'));var jayson=require(_0x9484('0x9'));var client=jayson[_0x9484('0xa')][_0x9484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x536b43,_0x4a8a70,_0x11f2a1){return new BPromise(function(_0x583079,_0x3929b9){return client[_0x9484('0xc')](_0x536b43,_0x11f2a1)[_0x9484('0xd')](function(_0xe8b216){logger[_0x9484('0xe')](_0x9484('0xf'),_0x4a8a70,_0x9484('0x10'));logger[_0x9484('0x11')](_0x9484('0x12'),_0x4a8a70,_0x9484('0x10'),JSON[_0x9484('0x13')](_0xe8b216));if(_0xe8b216[_0x9484('0x14')]){if(_0xe8b216[_0x9484('0x14')][_0x9484('0x15')]===0x1f4){logger[_0x9484('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x4a8a70,_0xe8b216[_0x9484('0x14')]['message']);return _0x3929b9(_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);}logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0xe8b216[_0x9484('0x14')][_0x9484('0x16')]);return _0x583079(_0xe8b216['error'][_0x9484('0x16')]);}else{logger[_0x9484('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x4a8a70,'request\x20sent');_0x583079(_0xe8b216[_0x9484('0x17')]['message']);}})[_0x9484('0x18')](function(_0x4e974f){logger[_0x9484('0x14')](_0x9484('0xf'),_0x4a8a70,_0x4e974f);_0x3929b9(_0x4e974f);});});}exports[_0x9484('0x19')]=function(_0xa279e2){var _0x26ec8b=this;return new Promise(function(_0x232694,_0x4b900f){return db[_0x9484('0x1a')][_0x9484('0x1b')]({'raw':_0xa279e2['options']?_0xa279e2[_0x9484('0x1c')][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0xa279e2['options']?_0xa279e2[_0x9484('0x1c')]['where']||null:null,'attributes':_0xa279e2[_0x9484('0x1c')]?_0xa279e2['options'][_0x9484('0x1e')]||null:null,'limit':_0xa279e2[_0x9484('0x1c')]?_0xa279e2[_0x9484('0x1c')][_0x9484('0x1f')]||null:null,'include':_0xa279e2['options']?_0xa279e2['options'][_0x9484('0x20')]?_['map'](_0xa279e2[_0x9484('0x1c')]['include'],function(_0x1ca809){return{'model':db[_0x1ca809[_0x9484('0x21')]],'as':_0x1ca809['as'],'attributes':_0x1ca809[_0x9484('0x1e')],'include':_0x1ca809['include']?_[_0x9484('0x22')](_0x1ca809[_0x9484('0x20')],function(_0x2e158e){return{'model':db[_0x2e158e['model']],'as':_0x2e158e['as'],'attributes':_0x2e158e['attributes'],'include':_0x2e158e['include']?_[_0x9484('0x22')](_0x2e158e[_0x9484('0x20')],function(_0x4f76f5){return{'model':db[_0x4f76f5[_0x9484('0x21')]],'as':_0x4f76f5['as'],'attributes':_0x4f76f5[_0x9484('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xd')](function(_0x5ecf12){logger[_0x9484('0xe')]('GetZohoAccount',_0xa279e2);logger[_0x9484('0x11')](_0x9484('0x19'),_0xa279e2,JSON[_0x9484('0x13')](_0x5ecf12));_0x232694(_0x5ecf12);})[_0x9484('0x18')](function(_0x48c6e1){logger['error'](_0x9484('0x19'),_0x48c6e1[_0x9484('0x16')],_0xa279e2);_0x4b900f(_0x26ec8b['error'](0x1f4,_0x48c6e1[_0x9484('0x16')]));});});};exports[_0x9484('0x23')]=function(_0x2d3e4c){var _0x19a849=this;return new Promise(function(_0x20a080,_0x4b6a24){return db[_0x9484('0x1a')][_0x9484('0x24')]({'raw':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x1d')]===undefined?!![]:![]:!![],'where':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x25')]||null:null,'attributes':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c['options'][_0x9484('0x1e')]||null:null,'include':_0x2d3e4c[_0x9484('0x1c')]?_0x2d3e4c[_0x9484('0x1c')][_0x9484('0x20')]?_[_0x9484('0x22')](_0x2d3e4c['options'][_0x9484('0x20')],function(_0x33b765){return{'model':db[_0x33b765['model']],'as':_0x33b765['as'],'attributes':_0x33b765[_0x9484('0x1e')],'include':_0x33b765['include']?_[_0x9484('0x22')](_0x33b765[_0x9484('0x20')],function(_0x2f8195){return{'model':db[_0x2f8195['model']],'as':_0x2f8195['as'],'attributes':_0x2f8195[_0x9484('0x1e')],'include':_0x2f8195[_0x9484('0x20')]?_['map'](_0x2f8195[_0x9484('0x20')],function(_0x5392ee){return{'model':db[_0x5392ee[_0x9484('0x21')]],'as':_0x5392ee['as'],'attributes':_0x5392ee[_0x9484('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9484('0xd')](function(_0x299321){logger[_0x9484('0xe')]('ShowZohoAccount',_0x2d3e4c);logger['debug'](_0x9484('0x23'),_0x2d3e4c,JSON[_0x9484('0x13')](_0x299321));_0x20a080(_0x299321);})['catch'](function(_0xb0b77e){logger['error'](_0x9484('0x23'),_0xb0b77e['message'],_0x2d3e4c);_0x4b6a24(_0x19a849[_0x9484('0x14')](0x1f4,_0xb0b77e['message']));});});}; \ No newline at end of file +var _0x4329=['ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ZohoAccount','options','raw','where','attributes','include','map','model','GetZohoAccount','stringify','catch','ShowZohoAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x70c1b1,_0x25091e){var _0x539ffb=function(_0x4b246e){while(--_0x4b246e){_0x70c1b1['push'](_0x70c1b1['shift']());}};_0x539ffb(++_0x25091e);}(_0x4329,0x13b));var _0x9432=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x4329[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var BPromise=require(_0x9432('0x3'));var rs=require(_0x9432('0x4'));var fs=require('fs');var Redis=require(_0x9432('0x5'));var db=require(_0x9432('0x6'))['db'];var utils=require(_0x9432('0x7'));var logger=require(_0x9432('0x8'))(_0x9432('0x9'));var config=require(_0x9432('0xa'));var jayson=require(_0x9432('0xb'));var client=jayson[_0x9432('0xc')][_0x9432('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5568ad,_0x376967,_0x5346c3){return new BPromise(function(_0x10509f,_0x4563c4){return client['request'](_0x5568ad,_0x5346c3)[_0x9432('0xe')](function(_0x2b06c7){logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,_0x9432('0x11'));logger['debug'](_0x9432('0x12'),_0x376967,_0x9432('0x11'),JSON['stringify'](_0x2b06c7));if(_0x2b06c7['error']){if(_0x2b06c7[_0x9432('0x13')][_0x9432('0x14')]===0x1f4){logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x4563c4(_0x2b06c7[_0x9432('0x13')][_0x9432('0x15')]);}logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x10509f(_0x2b06c7[_0x9432('0x13')]['message']);}else{logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,'request\x20sent');_0x10509f(_0x2b06c7[_0x9432('0x16')][_0x9432('0x15')]);}})['catch'](function(_0x5c4360){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x376967,_0x5c4360);_0x4563c4(_0x5c4360);});});}exports['GetZohoAccount']=function(_0x2eabe3){var _0x18f944=this;return new Promise(function(_0xac7dce,_0x486cd6){return db[_0x9432('0x17')]['findAll']({'raw':_0x2eabe3[_0x9432('0x18')]?_0x2eabe3[_0x9432('0x18')][_0x9432('0x19')]===undefined?!![]:![]:!![],'where':_0x2eabe3['options']?_0x2eabe3[_0x9432('0x18')][_0x9432('0x1a')]||null:null,'attributes':_0x2eabe3[_0x9432('0x18')]?_0x2eabe3[_0x9432('0x18')][_0x9432('0x1b')]||null:null,'limit':_0x2eabe3[_0x9432('0x18')]?_0x2eabe3[_0x9432('0x18')]['limit']||null:null,'include':_0x2eabe3['options']?_0x2eabe3['options'][_0x9432('0x1c')]?_[_0x9432('0x1d')](_0x2eabe3[_0x9432('0x18')][_0x9432('0x1c')],function(_0x4a9895){return{'model':db[_0x4a9895[_0x9432('0x1e')]],'as':_0x4a9895['as'],'attributes':_0x4a9895['attributes'],'include':_0x4a9895[_0x9432('0x1c')]?_[_0x9432('0x1d')](_0x4a9895[_0x9432('0x1c')],function(_0x1dfee6){return{'model':db[_0x1dfee6[_0x9432('0x1e')]],'as':_0x1dfee6['as'],'attributes':_0x1dfee6[_0x9432('0x1b')],'include':_0x1dfee6[_0x9432('0x1c')]?_[_0x9432('0x1d')](_0x1dfee6[_0x9432('0x1c')],function(_0x14627b){return{'model':db[_0x14627b['model']],'as':_0x14627b['as'],'attributes':_0x14627b['attributes']};}):[]};}):[]};}):[]:[]})[_0x9432('0xe')](function(_0x4ba316){logger['info'](_0x9432('0x1f'),_0x2eabe3);logger['debug']('GetZohoAccount',_0x2eabe3,JSON[_0x9432('0x20')](_0x4ba316));_0xac7dce(_0x4ba316);})[_0x9432('0x21')](function(_0x146a06){logger[_0x9432('0x13')]('GetZohoAccount',_0x146a06['message'],_0x2eabe3);_0x486cd6(_0x18f944[_0x9432('0x13')](0x1f4,_0x146a06[_0x9432('0x15')]));});});};exports[_0x9432('0x22')]=function(_0x32e991){var _0x120c04=this;return new Promise(function(_0x35d955,_0x2241d9){return db[_0x9432('0x17')][_0x9432('0x23')]({'raw':_0x32e991['options']?_0x32e991['options']['raw']===undefined?!![]:![]:!![],'where':_0x32e991[_0x9432('0x18')]?_0x32e991[_0x9432('0x18')]['where']||null:null,'attributes':_0x32e991['options']?_0x32e991[_0x9432('0x18')][_0x9432('0x1b')]||null:null,'include':_0x32e991[_0x9432('0x18')]?_0x32e991['options'][_0x9432('0x1c')]?_[_0x9432('0x1d')](_0x32e991[_0x9432('0x18')]['include'],function(_0x31d9b9){return{'model':db[_0x31d9b9['model']],'as':_0x31d9b9['as'],'attributes':_0x31d9b9[_0x9432('0x1b')],'include':_0x31d9b9[_0x9432('0x1c')]?_['map'](_0x31d9b9[_0x9432('0x1c')],function(_0x216ebf){return{'model':db[_0x216ebf[_0x9432('0x1e')]],'as':_0x216ebf['as'],'attributes':_0x216ebf[_0x9432('0x1b')],'include':_0x216ebf[_0x9432('0x1c')]?_[_0x9432('0x1d')](_0x216ebf[_0x9432('0x1c')],function(_0x223984){return{'model':db[_0x223984[_0x9432('0x1e')]],'as':_0x223984['as'],'attributes':_0x223984[_0x9432('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b0e58){logger[_0x9432('0xf')](_0x9432('0x22'),_0x32e991);logger[_0x9432('0x24')](_0x9432('0x22'),_0x32e991,JSON[_0x9432('0x20')](_0x5b0e58));_0x35d955(_0x5b0e58);})[_0x9432('0x21')](function(_0x19b364){logger[_0x9432('0x13')]('ShowZohoAccount',_0x19b364[_0x9432('0x15')],_0x32e991);_0x2241d9(_0x120c04[_0x9432('0x13')](0x1f4,_0x19b364[_0x9432('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4a6d90a..88fee04 100644 --- a/server/api/intZohoConfiguration/index.js +++ b/server/api/intZohoConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dfe=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x7450d2,_0x46afc8){var _0x5987aa=function(_0x5cd719){while(--_0x5cd719){_0x7450d2['push'](_0x7450d2['shift']());}};_0x5987aa(++_0x46afc8);}(_0x3dfe,0x1aa));var _0xe3df=function(_0x56c78b,_0x37063f){_0x56c78b=_0x56c78b-0x0;var _0xb63210=_0x3dfe[_0x56c78b];return _0xb63210;};'use strict';var multer=require('multer');var util=require(_0xe3df('0x0'));var path=require(_0xe3df('0x1'));var timeout=require(_0xe3df('0x2'));var express=require(_0xe3df('0x3'));var router=express[_0xe3df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe3df('0x5'));var interaction=require(_0xe3df('0x6'));var config=require(_0xe3df('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0xe3df('0x8')]('/',auth[_0xe3df('0x9')](),controller[_0xe3df('0xa')]);router[_0xe3df('0x8')](_0xe3df('0xb'),auth[_0xe3df('0x9')](),controller['show']);router[_0xe3df('0x8')](_0xe3df('0xc'),auth[_0xe3df('0x9')](),controller[_0xe3df('0xd')]);router[_0xe3df('0x8')]('/:id/subjects',auth[_0xe3df('0x9')](),controller[_0xe3df('0xe')]);router[_0xe3df('0x8')](_0xe3df('0xf'),auth[_0xe3df('0x9')](),controller[_0xe3df('0x10')]);router[_0xe3df('0x11')]('/',auth[_0xe3df('0x9')](),controller[_0xe3df('0x12')]);router[_0xe3df('0x13')](_0xe3df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xe3df('0x14')](_0xe3df('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe3df('0x15')]=router; \ No newline at end of file +var _0x3b11=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x6622a2,_0x401a17){var _0x52252e=function(_0x339759){while(--_0x339759){_0x6622a2['push'](_0x6622a2['shift']());}};_0x52252e(++_0x401a17);}(_0x3b11,0x1c1));var _0x13b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b11[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x13b1('0x0'));var util=require(_0x13b1('0x1'));var path=require('path');var timeout=require(_0x13b1('0x2'));var express=require(_0x13b1('0x3'));var router=express[_0x13b1('0x4')]();var fs_extra=require(_0x13b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x13b1('0x6'));var config=require(_0x13b1('0x7'));var controller=require(_0x13b1('0x8'));router[_0x13b1('0x9')]('/',auth[_0x13b1('0xa')](),controller[_0x13b1('0xb')]);router[_0x13b1('0x9')](_0x13b1('0xc'),auth['isAuthenticated'](),controller[_0x13b1('0xd')]);router[_0x13b1('0x9')](_0x13b1('0xe'),auth[_0x13b1('0xa')](),controller[_0x13b1('0xf')]);router[_0x13b1('0x9')]('/:id/subjects',auth[_0x13b1('0xa')](),controller['getSubjects']);router[_0x13b1('0x9')]('/:id/descriptions',auth[_0x13b1('0xa')](),controller[_0x13b1('0x10')]);router[_0x13b1('0x11')]('/',auth[_0x13b1('0xa')](),controller[_0x13b1('0x12')]);router[_0x13b1('0x13')]('/:id',auth[_0x13b1('0xa')](),controller[_0x13b1('0x14')]);router[_0x13b1('0x15')](_0x13b1('0xc'),auth['isAuthenticated'](),controller[_0x13b1('0x16')]);module[_0x13b1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6132587..f508f20 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa562=['exports','STRING','ENUM','nothing','lead','contact','contact_lead','sequelize'];(function(_0x4ca50f,_0x351493){var _0x45182e=function(_0x1a97b7){while(--_0x1a97b7){_0x4ca50f['push'](_0x4ca50f['shift']());}};_0x45182e(++_0x351493);}(_0xa562,0xef));var _0x2a56=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa562[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x2a56('0x0'));module[_0x2a56('0x1')]={'name':{'type':Sequelize[_0x2a56('0x2')]},'moduleCreate':{'type':Sequelize[_0x2a56('0x3')]('lead','contact',_0x2a56('0x4')),'defaultValue':_0x2a56('0x5')},'moduleSearch':{'type':Sequelize[_0x2a56('0x3')]('contact_lead',_0x2a56('0x6'),_0x2a56('0x5')),'defaultValue':_0x2a56('0x7')},'description':{'type':Sequelize[_0x2a56('0x2')]}}; \ No newline at end of file +var _0x358f=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x5d4319,_0x5bc2f5){var _0x2bd97d=function(_0x5aafc3){while(--_0x5aafc3){_0x5d4319['push'](_0x5d4319['shift']());}};_0x2bd97d(++_0x5bc2f5);}(_0x358f,0x198));var _0xf358=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0x358f[_0x2336ea];return _0x216bf9;};'use strict';var Sequelize=require(_0xf358('0x0'));module[_0xf358('0x1')]={'name':{'type':Sequelize[_0xf358('0x2')]},'moduleCreate':{'type':Sequelize[_0xf358('0x3')](_0xf358('0x4'),_0xf358('0x5'),_0xf358('0x6')),'defaultValue':_0xf358('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xf358('0x7'),_0xf358('0x5'),_0xf358('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xf358('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9ef44d3..ef40c42 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3bd=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','getFields','findOne','getSubjects','ZohoField','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0x555d2d,_0x2509b4){var _0x2697a9=function(_0x361d1e){while(--_0x361d1e){_0x555d2d['push'](_0x555d2d['shift']());}};_0x2697a9(++_0x2509b4);}(_0xa3bd,0x85));var _0xda3b=function(_0x6ce75e,_0x232e49){_0x6ce75e=_0x6ce75e-0x0;var _0x5f06db=_0xa3bd[_0x6ce75e];return _0x5f06db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda3b('0x1'));var rp=require('request-promise');var moment=require(_0xda3b('0x2'));var BPromise=require(_0xda3b('0x3'));var Mustache=require(_0xda3b('0x4'));var util=require(_0xda3b('0x5'));var path=require(_0xda3b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda3b('0x7'));var fs=require('fs');var fs_extra=require(_0xda3b('0x8'));var _=require('lodash');var squel=require(_0xda3b('0x9'));var crypto=require(_0xda3b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xda3b('0xb'));var toCsv=require(_0xda3b('0xc'));var querystring=require(_0xda3b('0xd'));var Papa=require(_0xda3b('0xe'));var Redis=require(_0xda3b('0xf'));var authService=require(_0xda3b('0x10'));var qs=require(_0xda3b('0x11'));var as=require(_0xda3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda3b('0x13'))(_0xda3b('0x14'));var utils=require(_0xda3b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xda3b('0x16'));var db=require(_0xda3b('0x17'))['db'];function respondWithStatusCode(_0x130abc,_0x5b5dc1){_0x5b5dc1=_0x5b5dc1||0xcc;return function(_0x51b348){if(_0x51b348){return _0x130abc[_0xda3b('0x18')](_0x5b5dc1);}return _0x130abc[_0xda3b('0x19')](_0x5b5dc1)[_0xda3b('0x1a')]();};}function respondWithResult(_0x17e3af,_0x20f235){_0x20f235=_0x20f235||0xc8;return function(_0x20bdd1){if(_0x20bdd1){return _0x17e3af[_0xda3b('0x19')](_0x20f235)[_0xda3b('0x1b')](_0x20bdd1);}};}function respondWithFilteredResult(_0x3a5da7,_0x25bbaf){return function(_0x1dfc83){if(_0x1dfc83){var _0x4473b0=typeof _0x25bbaf[_0xda3b('0x1c')]===_0xda3b('0x1d')&&typeof _0x25bbaf['limit']==='undefined';var _0x2d04a5=_0x1dfc83[_0xda3b('0x1e')];var _0x239b91=_0x4473b0?0x0:_0x25bbaf[_0xda3b('0x1c')];var _0x4e8b6a=_0x4473b0?_0x1dfc83[_0xda3b('0x1e')]:_0x25bbaf[_0xda3b('0x1c')]+_0x25bbaf[_0xda3b('0x1f')];var _0x458033;if(_0x4e8b6a>=_0x2d04a5){_0x4e8b6a=_0x2d04a5;_0x458033=0xc8;}else{_0x458033=0xce;}_0x3a5da7[_0xda3b('0x19')](_0x458033);return _0x3a5da7[_0xda3b('0x20')](_0xda3b('0x21'),_0x239b91+'-'+_0x4e8b6a+'/'+_0x2d04a5)[_0xda3b('0x1b')](_0x1dfc83);}return null;};}function patchUpdates(_0x2c7bd9){return function(_0x5115ce){try{jsonpatch[_0xda3b('0x22')](_0x5115ce,_0x2c7bd9,!![]);}catch(_0xdc99d1){return BPromise[_0xda3b('0x23')](_0xdc99d1);}return _0x5115ce[_0xda3b('0x24')]();};}function saveUpdates(_0x4a554f,_0x4e7f39){return function(_0x15afe5){if(_0x15afe5){return _0x15afe5[_0xda3b('0x25')](_0x4a554f)[_0xda3b('0x26')](function(_0x131d19){return _0x131d19;});}return null;};}function removeEntity(_0x4bd10e,_0x2ff35c){return function(_0x54038c){if(_0x54038c){return _0x54038c[_0xda3b('0x27')]()['then'](function(){_0x4bd10e[_0xda3b('0x19')](0xcc)[_0xda3b('0x1a')]();});}};}function handleEntityNotFound(_0x33f822,_0x2bfa38){return function(_0x4aecfc){if(!_0x4aecfc){_0x33f822[_0xda3b('0x18')](0x194);}return _0x4aecfc;};}function handleError(_0x239c38,_0x32763e){_0x32763e=_0x32763e||0x1f4;return function(_0x19e152){logger[_0xda3b('0x28')](_0x19e152[_0xda3b('0x29')]);if(_0x19e152[_0xda3b('0x2a')]){delete _0x19e152['name'];}_0x239c38['status'](_0x32763e)[_0xda3b('0x2b')](_0x19e152);};}exports[_0xda3b('0x2c')]=function(_0x5e0fae,_0x4e922f){var _0x42832e={},_0x3516ea={},_0x47727c={'count':0x0,'rows':[]};var _0x42a88f=_[_0xda3b('0x2d')](db[_0xda3b('0x2e')]['rawAttributes'],function(_0x2afcf8){return{'name':_0x2afcf8['fieldName'],'type':_0x2afcf8['type'][_0xda3b('0x2f')]};});_0x3516ea['model']=_[_0xda3b('0x2d')](_0x42a88f,_0xda3b('0x2a'));_0x3516ea['query']=_[_0xda3b('0x30')](_0x5e0fae[_0xda3b('0x31')]);_0x3516ea[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x3516ea[_0xda3b('0x34')],_0x3516ea[_0xda3b('0x31')]);_0x42832e[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x3516ea[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x36')]));_0x42832e[_0xda3b('0x35')]=_0x42832e[_0xda3b('0x35')][_0xda3b('0x37')]?_0x42832e[_0xda3b('0x35')]:_0x3516ea[_0xda3b('0x34')];if(!_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x42832e['limit']=qs[_0xda3b('0x1f')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x1f')]);_0x42832e[_0xda3b('0x1c')]=qs[_0xda3b('0x1c')](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x1c')]);}_0x42832e[_0xda3b('0x3a')]=qs['sort'](_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x42832e[_0xda3b('0x3c')]=qs['filters'](_[_0xda3b('0x3d')](_0x5e0fae[_0xda3b('0x31')],_0x3516ea[_0xda3b('0x32')]),_0x42a88f);if(_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3e')]){_0x42832e['where']=_[_0xda3b('0x3f')](_0x42832e[_0xda3b('0x3c')],{'$or':_['map'](_0x42a88f,function(_0x1a6f03){if(_0x1a6f03[_0xda3b('0x40')]!==_0xda3b('0x41')){var _0x37a8c6={};_0x37a8c6[_0x1a6f03['name']]={'$like':'%'+_0x5e0fae[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0x37a8c6;}})});}_0x42832e=_[_0xda3b('0x3f')]({},_0x42832e,_0x5e0fae[_0xda3b('0x42')]);var _0x1d2b08={'where':_0x42832e[_0xda3b('0x3c')]};return db[_0xda3b('0x2e')][_0xda3b('0x1e')](_0x1d2b08)[_0xda3b('0x26')](function(_0x4563f1){_0x47727c[_0xda3b('0x1e')]=_0x4563f1;if(_0x5e0fae[_0xda3b('0x31')]['includeAll']){_0x42832e[_0xda3b('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xda3b('0x44')](_0x42832e);})[_0xda3b('0x26')](function(_0x34cdc7){_0x47727c[_0xda3b('0x45')]=_0x34cdc7;return _0x47727c;})['then'](respondWithFilteredResult(_0x4e922f,_0x42832e))[_0xda3b('0x46')](handleError(_0x4e922f,null));};exports[_0xda3b('0x47')]=function(_0x407e0e,_0x272b64){var _0x386ead={'raw':![],'where':{'id':_0x407e0e[_0xda3b('0x48')]['id']}},_0x427ee0={};_0x427ee0[_0xda3b('0x34')]=_['keys'](db[_0xda3b('0x2e')][_0xda3b('0x49')]);_0x427ee0[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x407e0e[_0xda3b('0x31')]);_0x427ee0[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x427ee0[_0xda3b('0x34')],_0x427ee0[_0xda3b('0x31')]);_0x386ead[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x427ee0[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x407e0e['query'][_0xda3b('0x36')]));_0x386ead[_0xda3b('0x35')]=_0x386ead[_0xda3b('0x35')][_0xda3b('0x37')]?_0x386ead[_0xda3b('0x35')]:_0x427ee0[_0xda3b('0x34')];if(_0x407e0e[_0xda3b('0x31')][_0xda3b('0x4a')]){_0x386ead['include']=[{'all':!![]}];}_0x386ead=_[_0xda3b('0x3f')]({},_0x386ead,_0x407e0e['options']);return db[_0xda3b('0x2e')][_0xda3b('0x4b')](_0x386ead)[_0xda3b('0x26')](handleEntityNotFound(_0x272b64,null))[_0xda3b('0x26')](respondWithResult(_0x272b64,null))[_0xda3b('0x46')](handleError(_0x272b64,null));};exports['create']=function(_0x33c290,_0x5decbb){return db[_0xda3b('0x2e')]['create'](_0x33c290[_0xda3b('0x4c')],{})['then'](respondWithResult(_0x5decbb,0xc9))[_0xda3b('0x46')](handleError(_0x5decbb,null));};exports[_0xda3b('0x25')]=function(_0x3c2fb2,_0xc33f){if(_0x3c2fb2[_0xda3b('0x4c')]['id']){delete _0x3c2fb2[_0xda3b('0x4c')]['id'];}return db['ZohoConfiguration'][_0xda3b('0x4b')]({'where':{'id':_0x3c2fb2[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0xc33f,null))[_0xda3b('0x26')](saveUpdates(_0x3c2fb2[_0xda3b('0x4c')],null))[_0xda3b('0x26')](respondWithResult(_0xc33f,null))[_0xda3b('0x46')](handleError(_0xc33f,null));};exports[_0xda3b('0x27')]=function(_0x3eca1,_0x350811){return db[_0xda3b('0x2e')][_0xda3b('0x4b')]({'where':{'id':_0x3eca1[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x350811,null))[_0xda3b('0x26')](removeEntity(_0x350811,null))['catch'](handleError(_0x350811,null));};exports[_0xda3b('0x4d')]=function(_0x4bcaec,_0x280052,_0x2dad23){var _0x8ea05e={};var _0x59ede3={};var _0x3da91c;var _0x1f589f;return db[_0xda3b('0x2e')][_0xda3b('0x4e')]({'where':{'id':_0x4bcaec['params']['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x280052,null))[_0xda3b('0x26')](function(_0x39d2a5){if(_0x39d2a5){_0x3da91c=_0x39d2a5;_0x59ede3[_0xda3b('0x34')]=_[_0xda3b('0x30')](db['ZohoField'][_0xda3b('0x49')]);_0x59ede3[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x4bcaec['query']);_0x59ede3[_0xda3b('0x32')]=_[_0xda3b('0x33')](_0x59ede3[_0xda3b('0x34')],_0x59ede3[_0xda3b('0x31')]);_0x8ea05e[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x59ede3[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x36')]));_0x8ea05e[_0xda3b('0x35')]=_0x8ea05e[_0xda3b('0x35')][_0xda3b('0x37')]?_0x8ea05e[_0xda3b('0x35')]:_0x59ede3[_0xda3b('0x34')];_0x8ea05e[_0xda3b('0x3a')]=qs[_0xda3b('0x3b')](_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x8ea05e[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_[_0xda3b('0x3d')](_0x4bcaec[_0xda3b('0x31')],_0x59ede3[_0xda3b('0x32')]));if(_0x4bcaec['query'][_0xda3b('0x3e')]){_0x8ea05e[_0xda3b('0x3c')]=_[_0xda3b('0x3f')](_0x8ea05e['where'],{'$or':_[_0xda3b('0x2d')](_0x8ea05e['attributes'],function(_0x24fa0e){var _0xb00c51={};_0xb00c51[_0x24fa0e]={'$like':'%'+_0x4bcaec[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0xb00c51;})});}_0x8ea05e=_[_0xda3b('0x3f')]({},_0x8ea05e,_0x4bcaec['options']);return _0x3da91c[_0xda3b('0x4d')](_0x8ea05e);}})['then'](function(_0xe11722){if(_0xe11722){_0x1f589f=_0xe11722['length'];if(!_0x4bcaec['query'][_0xda3b('0x38')](_0xda3b('0x39'))){_0x8ea05e[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x4bcaec['query'][_0xda3b('0x1f')]);_0x8ea05e['offset']=qs['offset'](_0x4bcaec['query'][_0xda3b('0x1c')]);}return _0x3da91c[_0xda3b('0x4d')](_0x8ea05e);}})['then'](function(_0x3052fd){if(_0x3052fd){return _0x3052fd?{'count':_0x1f589f,'rows':_0x3052fd}:null;}})[_0xda3b('0x26')](respondWithResult(_0x280052,null))[_0xda3b('0x46')](handleError(_0x280052,null));};exports[_0xda3b('0x4f')]=function(_0x3e2fcc,_0x5eceed,_0x2c3f34){var _0x24a87f={};var _0x8986f1={};var _0x41e04d;var _0x3d68a6;return db[_0xda3b('0x2e')][_0xda3b('0x4e')]({'where':{'id':_0x3e2fcc[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x5eceed,null))[_0xda3b('0x26')](function(_0x3df680){if(_0x3df680){_0x41e04d=_0x3df680;_0x8986f1[_0xda3b('0x34')]=_[_0xda3b('0x30')](db[_0xda3b('0x50')][_0xda3b('0x49')]);_0x8986f1[_0xda3b('0x31')]=_[_0xda3b('0x30')](_0x3e2fcc[_0xda3b('0x31')]);_0x8986f1[_0xda3b('0x32')]=_['intersection'](_0x8986f1['model'],_0x8986f1[_0xda3b('0x31')]);_0x24a87f[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x8986f1[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x3e2fcc[_0xda3b('0x31')]['fields']));_0x24a87f[_0xda3b('0x35')]=_0x24a87f['attributes'][_0xda3b('0x37')]?_0x24a87f[_0xda3b('0x35')]:_0x8986f1[_0xda3b('0x34')];_0x24a87f[_0xda3b('0x3a')]=qs[_0xda3b('0x3b')](_0x3e2fcc['query'][_0xda3b('0x3b')]);_0x24a87f[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_['pick'](_0x3e2fcc[_0xda3b('0x31')],_0x8986f1[_0xda3b('0x32')]));if(_0x3e2fcc['query'][_0xda3b('0x3e')]){_0x24a87f['where']=_['merge'](_0x24a87f['where'],{'$or':_[_0xda3b('0x2d')](_0x24a87f[_0xda3b('0x35')],function(_0x1ca31e){var _0x503eb6={};_0x503eb6[_0x1ca31e]={'$like':'%'+_0x3e2fcc[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0x503eb6;})});}_0x24a87f=_[_0xda3b('0x3f')]({},_0x24a87f,_0x3e2fcc[_0xda3b('0x42')]);return _0x41e04d['getSubjects'](_0x24a87f);}})['then'](function(_0xe9d53){if(_0xe9d53){_0x3d68a6=_0xe9d53['length'];if(!_0x3e2fcc[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x24a87f[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x3e2fcc[_0xda3b('0x31')]['limit']);_0x24a87f[_0xda3b('0x1c')]=qs[_0xda3b('0x1c')](_0x3e2fcc['query'][_0xda3b('0x1c')]);}return _0x41e04d['getSubjects'](_0x24a87f);}})['then'](function(_0x54428a){if(_0x54428a){return _0x54428a?{'count':_0x3d68a6,'rows':_0x54428a}:null;}})[_0xda3b('0x26')](respondWithResult(_0x5eceed,null))['catch'](handleError(_0x5eceed,null));};exports['getDescriptions']=function(_0x35ecf4,_0x365466,_0x19cb7a){var _0x2831ee={};var _0x56681d={};var _0x17d021;var _0x3b930f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x35ecf4[_0xda3b('0x48')]['id']}})[_0xda3b('0x26')](handleEntityNotFound(_0x365466,null))[_0xda3b('0x26')](function(_0x3efded){if(_0x3efded){_0x17d021=_0x3efded;_0x56681d[_0xda3b('0x34')]=_['keys'](db[_0xda3b('0x50')]['rawAttributes']);_0x56681d[_0xda3b('0x31')]=_['keys'](_0x35ecf4['query']);_0x56681d[_0xda3b('0x32')]=_['intersection'](_0x56681d[_0xda3b('0x34')],_0x56681d[_0xda3b('0x31')]);_0x2831ee[_0xda3b('0x35')]=_[_0xda3b('0x33')](_0x56681d[_0xda3b('0x34')],qs[_0xda3b('0x36')](_0x35ecf4[_0xda3b('0x31')]['fields']));_0x2831ee['attributes']=_0x2831ee['attributes'][_0xda3b('0x37')]?_0x2831ee[_0xda3b('0x35')]:_0x56681d[_0xda3b('0x34')];_0x2831ee['order']=qs[_0xda3b('0x3b')](_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3b')]);_0x2831ee[_0xda3b('0x3c')]=qs[_0xda3b('0x32')](_[_0xda3b('0x3d')](_0x35ecf4[_0xda3b('0x31')],_0x56681d[_0xda3b('0x32')]));if(_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3e')]){_0x2831ee[_0xda3b('0x3c')]=_['merge'](_0x2831ee[_0xda3b('0x3c')],{'$or':_[_0xda3b('0x2d')](_0x2831ee[_0xda3b('0x35')],function(_0x4bcdd2){var _0xd3a0da={};_0xd3a0da[_0x4bcdd2]={'$like':'%'+_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x3e')]+'%'};return _0xd3a0da;})});}_0x2831ee=_['merge']({},_0x2831ee,_0x35ecf4[_0xda3b('0x42')]);return _0x17d021[_0xda3b('0x51')](_0x2831ee);}})[_0xda3b('0x26')](function(_0x4d4e63){if(_0x4d4e63){_0x3b930f=_0x4d4e63[_0xda3b('0x37')];if(!_0x35ecf4[_0xda3b('0x31')][_0xda3b('0x38')](_0xda3b('0x39'))){_0x2831ee[_0xda3b('0x1f')]=qs[_0xda3b('0x1f')](_0x35ecf4[_0xda3b('0x31')]['limit']);_0x2831ee['offset']=qs[_0xda3b('0x1c')](_0x35ecf4['query'][_0xda3b('0x1c')]);}return _0x17d021[_0xda3b('0x51')](_0x2831ee);}})['then'](function(_0x63ea0e){if(_0x63ea0e){return _0x63ea0e?{'count':_0x3b930f,'rows':_0x63ea0e}:null;}})[_0xda3b('0x26')](respondWithResult(_0x365466,null))[_0xda3b('0x46')](handleError(_0x365466,null));}; \ No newline at end of file +var _0x8774=['jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','rows','show','length','create','body','catch','find','params','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x8774,0x18c));var _0x4877=function(_0x2169d2,_0x3d1b9c){_0x2169d2=_0x2169d2-0x0;var _0x5cbe8d=_0x8774[_0x2169d2];return _0x5cbe8d;};'use strict';var emlformat=require(_0x4877('0x0'));var rimraf=require(_0x4877('0x1'));var zipdir=require(_0x4877('0x2'));var jsonpatch=require(_0x4877('0x3'));var rp=require('request-promise');var moment=require(_0x4877('0x4'));var BPromise=require(_0x4877('0x5'));var Mustache=require(_0x4877('0x6'));var util=require(_0x4877('0x7'));var path=require(_0x4877('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4877('0x9'));var fs=require('fs');var fs_extra=require(_0x4877('0xa'));var _=require(_0x4877('0xb'));var squel=require(_0x4877('0xc'));var crypto=require(_0x4877('0xd'));var jsforce=require(_0x4877('0xe'));var deskjs=require(_0x4877('0xf'));var toCsv=require(_0x4877('0x10'));var querystring=require(_0x4877('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4877('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4877('0x13'));var hardwareService=require(_0x4877('0x14'));var logger=require(_0x4877('0x15'))(_0x4877('0x16'));var utils=require('../../config/utils');var config=require(_0x4877('0x17'));var licenseUtil=require(_0x4877('0x18'));var db=require(_0x4877('0x19'))['db'];function respondWithStatusCode(_0x10953b,_0x12d517){_0x12d517=_0x12d517||0xcc;return function(_0xdc251a){if(_0xdc251a){return _0x10953b[_0x4877('0x1a')](_0x12d517);}return _0x10953b[_0x4877('0x1b')](_0x12d517)[_0x4877('0x1c')]();};}function respondWithResult(_0x5b186c,_0x590924){_0x590924=_0x590924||0xc8;return function(_0x53cff4){if(_0x53cff4){return _0x5b186c[_0x4877('0x1b')](_0x590924)['json'](_0x53cff4);}};}function respondWithFilteredResult(_0x2fe909,_0x2adacf){return function(_0x155616){if(_0x155616){var _0x1d3a15=typeof _0x2adacf[_0x4877('0x1d')]===_0x4877('0x1e')&&typeof _0x2adacf['limit']===_0x4877('0x1e');var _0x9fa91b=_0x155616[_0x4877('0x1f')];var _0x549096=_0x1d3a15?0x0:_0x2adacf[_0x4877('0x1d')];var _0x10f2ca=_0x1d3a15?_0x155616[_0x4877('0x1f')]:_0x2adacf[_0x4877('0x1d')]+_0x2adacf[_0x4877('0x20')];var _0x52630e;if(_0x10f2ca>=_0x9fa91b){_0x10f2ca=_0x9fa91b;_0x52630e=0xc8;}else{_0x52630e=0xce;}_0x2fe909[_0x4877('0x1b')](_0x52630e);return _0x2fe909[_0x4877('0x21')](_0x4877('0x22'),_0x549096+'-'+_0x10f2ca+'/'+_0x9fa91b)[_0x4877('0x23')](_0x155616);}return null;};}function patchUpdates(_0x501ac2){return function(_0x497822){try{jsonpatch[_0x4877('0x24')](_0x497822,_0x501ac2,!![]);}catch(_0x29b8b8){return BPromise[_0x4877('0x25')](_0x29b8b8);}return _0x497822['save']();};}function saveUpdates(_0x53c409,_0x31700f){return function(_0x524fd6){if(_0x524fd6){return _0x524fd6[_0x4877('0x26')](_0x53c409)['then'](function(_0x6d4adb){return _0x6d4adb;});}return null;};}function removeEntity(_0x860601,_0x259cc6){return function(_0x5df09f){if(_0x5df09f){return _0x5df09f[_0x4877('0x27')]()[_0x4877('0x28')](function(){_0x860601['status'](0xcc)[_0x4877('0x1c')]();});}};}function handleEntityNotFound(_0x5077b6,_0x510377){return function(_0x35280d){if(!_0x35280d){_0x5077b6[_0x4877('0x1a')](0x194);}return _0x35280d;};}function handleError(_0xd68ed2,_0x4b3b3d){_0x4b3b3d=_0x4b3b3d||0x1f4;return function(_0xb08abd){logger[_0x4877('0x29')](_0xb08abd[_0x4877('0x2a')]);if(_0xb08abd[_0x4877('0x2b')]){delete _0xb08abd['name'];}_0xd68ed2[_0x4877('0x1b')](_0x4b3b3d)[_0x4877('0x2c')](_0xb08abd);};}exports[_0x4877('0x2d')]=function(_0x1fff45,_0x4aa47c){var _0xa4ffc4={},_0x4446b5={},_0x2bc6ee={'count':0x0,'rows':[]};var _0x3d3072=_[_0x4877('0x2e')](db['ZohoConfiguration'][_0x4877('0x2f')],function(_0x40f4f7){return{'name':_0x40f4f7['fieldName'],'type':_0x40f4f7[_0x4877('0x30')]['key']};});_0x4446b5[_0x4877('0x31')]=_['map'](_0x3d3072,'name');_0x4446b5[_0x4877('0x32')]=_[_0x4877('0x33')](_0x1fff45[_0x4877('0x32')]);_0x4446b5[_0x4877('0x34')]=_[_0x4877('0x35')](_0x4446b5[_0x4877('0x31')],_0x4446b5['query']);_0xa4ffc4[_0x4877('0x36')]=_[_0x4877('0x35')](_0x4446b5[_0x4877('0x31')],qs[_0x4877('0x37')](_0x1fff45[_0x4877('0x32')][_0x4877('0x37')]));_0xa4ffc4[_0x4877('0x36')]=_0xa4ffc4['attributes']['length']?_0xa4ffc4[_0x4877('0x36')]:_0x4446b5[_0x4877('0x31')];if(!_0x1fff45['query']['hasOwnProperty'](_0x4877('0x38'))){_0xa4ffc4[_0x4877('0x20')]=qs[_0x4877('0x20')](_0x1fff45[_0x4877('0x32')][_0x4877('0x20')]);_0xa4ffc4[_0x4877('0x1d')]=qs[_0x4877('0x1d')](_0x1fff45[_0x4877('0x32')][_0x4877('0x1d')]);}_0xa4ffc4[_0x4877('0x39')]=qs[_0x4877('0x3a')](_0x1fff45[_0x4877('0x32')][_0x4877('0x3a')]);_0xa4ffc4[_0x4877('0x3b')]=qs[_0x4877('0x34')](_[_0x4877('0x3c')](_0x1fff45[_0x4877('0x32')],_0x4446b5[_0x4877('0x34')]),_0x3d3072);if(_0x1fff45[_0x4877('0x32')][_0x4877('0x3d')]){_0xa4ffc4[_0x4877('0x3b')]=_[_0x4877('0x3e')](_0xa4ffc4[_0x4877('0x3b')],{'$or':_[_0x4877('0x2e')](_0x3d3072,function(_0x5306a5){if(_0x5306a5[_0x4877('0x30')]!==_0x4877('0x3f')){var _0x200e03={};_0x200e03[_0x5306a5[_0x4877('0x2b')]]={'$like':'%'+_0x1fff45[_0x4877('0x32')][_0x4877('0x3d')]+'%'};return _0x200e03;}})});}_0xa4ffc4=_[_0x4877('0x3e')]({},_0xa4ffc4,_0x1fff45[_0x4877('0x40')]);var _0x145417={'where':_0xa4ffc4['where']};return db[_0x4877('0x41')][_0x4877('0x1f')](_0x145417)['then'](function(_0x319d81){_0x2bc6ee[_0x4877('0x1f')]=_0x319d81;if(_0x1fff45[_0x4877('0x32')][_0x4877('0x42')]){_0xa4ffc4[_0x4877('0x43')]=[{'all':!![]}];}return db[_0x4877('0x41')]['findAll'](_0xa4ffc4);})[_0x4877('0x28')](function(_0x138859){_0x2bc6ee[_0x4877('0x44')]=_0x138859;return _0x2bc6ee;})[_0x4877('0x28')](respondWithFilteredResult(_0x4aa47c,_0xa4ffc4))['catch'](handleError(_0x4aa47c,null));};exports[_0x4877('0x45')]=function(_0x3b3d3f,_0xa53f65){var _0x5adfad={'raw':![],'where':{'id':_0x3b3d3f['params']['id']}},_0x122818={};_0x122818[_0x4877('0x31')]=_['keys'](db[_0x4877('0x41')]['rawAttributes']);_0x122818[_0x4877('0x32')]=_[_0x4877('0x33')](_0x3b3d3f[_0x4877('0x32')]);_0x122818[_0x4877('0x34')]=_[_0x4877('0x35')](_0x122818[_0x4877('0x31')],_0x122818[_0x4877('0x32')]);_0x5adfad[_0x4877('0x36')]=_[_0x4877('0x35')](_0x122818[_0x4877('0x31')],qs[_0x4877('0x37')](_0x3b3d3f[_0x4877('0x32')][_0x4877('0x37')]));_0x5adfad[_0x4877('0x36')]=_0x5adfad[_0x4877('0x36')][_0x4877('0x46')]?_0x5adfad[_0x4877('0x36')]:_0x122818[_0x4877('0x31')];if(_0x3b3d3f[_0x4877('0x32')][_0x4877('0x42')]){_0x5adfad['include']=[{'all':!![]}];}_0x5adfad=_[_0x4877('0x3e')]({},_0x5adfad,_0x3b3d3f[_0x4877('0x40')]);return db['ZohoConfiguration']['find'](_0x5adfad)[_0x4877('0x28')](handleEntityNotFound(_0xa53f65,null))[_0x4877('0x28')](respondWithResult(_0xa53f65,null))['catch'](handleError(_0xa53f65,null));};exports[_0x4877('0x47')]=function(_0xdde125,_0xb820ea){return db[_0x4877('0x41')]['create'](_0xdde125[_0x4877('0x48')],{})[_0x4877('0x28')](respondWithResult(_0xb820ea,0xc9))[_0x4877('0x49')](handleError(_0xb820ea,null));};exports['update']=function(_0x21b6a1,_0x1244ee){if(_0x21b6a1[_0x4877('0x48')]['id']){delete _0x21b6a1[_0x4877('0x48')]['id'];}return db[_0x4877('0x41')][_0x4877('0x4a')]({'where':{'id':_0x21b6a1[_0x4877('0x4b')]['id']}})[_0x4877('0x28')](handleEntityNotFound(_0x1244ee,null))[_0x4877('0x28')](saveUpdates(_0x21b6a1[_0x4877('0x48')],null))[_0x4877('0x28')](respondWithResult(_0x1244ee,null))[_0x4877('0x49')](handleError(_0x1244ee,null));};exports[_0x4877('0x27')]=function(_0x44b383,_0x29d78c){return db['ZohoConfiguration']['find']({'where':{'id':_0x44b383[_0x4877('0x4b')]['id']}})['then'](handleEntityNotFound(_0x29d78c,null))[_0x4877('0x28')](removeEntity(_0x29d78c,null))[_0x4877('0x49')](handleError(_0x29d78c,null));};exports[_0x4877('0x4c')]=function(_0x50156d,_0x18aa7e,_0x4659c2){var _0x3bfeaa={};var _0x2d1911={};var _0x16256f;var _0x4f3086;return db[_0x4877('0x41')][_0x4877('0x4d')]({'where':{'id':_0x50156d['params']['id']}})['then'](handleEntityNotFound(_0x18aa7e,null))[_0x4877('0x28')](function(_0x5bcb0e){if(_0x5bcb0e){_0x16256f=_0x5bcb0e;_0x2d1911['model']=_[_0x4877('0x33')](db[_0x4877('0x4e')][_0x4877('0x2f')]);_0x2d1911[_0x4877('0x32')]=_[_0x4877('0x33')](_0x50156d[_0x4877('0x32')]);_0x2d1911[_0x4877('0x34')]=_[_0x4877('0x35')](_0x2d1911[_0x4877('0x31')],_0x2d1911[_0x4877('0x32')]);_0x3bfeaa['attributes']=_[_0x4877('0x35')](_0x2d1911[_0x4877('0x31')],qs[_0x4877('0x37')](_0x50156d[_0x4877('0x32')][_0x4877('0x37')]));_0x3bfeaa[_0x4877('0x36')]=_0x3bfeaa[_0x4877('0x36')]['length']?_0x3bfeaa[_0x4877('0x36')]:_0x2d1911[_0x4877('0x31')];_0x3bfeaa['order']=qs[_0x4877('0x3a')](_0x50156d[_0x4877('0x32')][_0x4877('0x3a')]);_0x3bfeaa['where']=qs[_0x4877('0x34')](_[_0x4877('0x3c')](_0x50156d[_0x4877('0x32')],_0x2d1911[_0x4877('0x34')]));if(_0x50156d[_0x4877('0x32')]['filter']){_0x3bfeaa[_0x4877('0x3b')]=_[_0x4877('0x3e')](_0x3bfeaa['where'],{'$or':_[_0x4877('0x2e')](_0x3bfeaa[_0x4877('0x36')],function(_0x3e5c34){var _0x1dc74a={};_0x1dc74a[_0x3e5c34]={'$like':'%'+_0x50156d[_0x4877('0x32')][_0x4877('0x3d')]+'%'};return _0x1dc74a;})});}_0x3bfeaa=_[_0x4877('0x3e')]({},_0x3bfeaa,_0x50156d[_0x4877('0x40')]);return _0x16256f[_0x4877('0x4c')](_0x3bfeaa);}})[_0x4877('0x28')](function(_0x225318){if(_0x225318){_0x4f3086=_0x225318[_0x4877('0x46')];if(!_0x50156d[_0x4877('0x32')][_0x4877('0x4f')](_0x4877('0x38'))){_0x3bfeaa[_0x4877('0x20')]=qs[_0x4877('0x20')](_0x50156d['query'][_0x4877('0x20')]);_0x3bfeaa[_0x4877('0x1d')]=qs[_0x4877('0x1d')](_0x50156d[_0x4877('0x32')][_0x4877('0x1d')]);}return _0x16256f['getFields'](_0x3bfeaa);}})[_0x4877('0x28')](function(_0x13ceeb){if(_0x13ceeb){return _0x13ceeb?{'count':_0x4f3086,'rows':_0x13ceeb}:null;}})[_0x4877('0x28')](respondWithResult(_0x18aa7e,null))[_0x4877('0x49')](handleError(_0x18aa7e,null));};exports['getSubjects']=function(_0x12f6a6,_0x527f24,_0x306cd8){var _0x2d69f5={};var _0x3e3d93={};var _0x4f5a50;var _0x2ae4cb;return db[_0x4877('0x41')][_0x4877('0x4d')]({'where':{'id':_0x12f6a6[_0x4877('0x4b')]['id']}})[_0x4877('0x28')](handleEntityNotFound(_0x527f24,null))[_0x4877('0x28')](function(_0x31bbed){if(_0x31bbed){_0x4f5a50=_0x31bbed;_0x3e3d93[_0x4877('0x31')]=_['keys'](db['ZohoField'][_0x4877('0x2f')]);_0x3e3d93[_0x4877('0x32')]=_[_0x4877('0x33')](_0x12f6a6[_0x4877('0x32')]);_0x3e3d93[_0x4877('0x34')]=_[_0x4877('0x35')](_0x3e3d93[_0x4877('0x31')],_0x3e3d93[_0x4877('0x32')]);_0x2d69f5[_0x4877('0x36')]=_['intersection'](_0x3e3d93[_0x4877('0x31')],qs[_0x4877('0x37')](_0x12f6a6[_0x4877('0x32')]['fields']));_0x2d69f5['attributes']=_0x2d69f5[_0x4877('0x36')][_0x4877('0x46')]?_0x2d69f5[_0x4877('0x36')]:_0x3e3d93['model'];_0x2d69f5[_0x4877('0x39')]=qs['sort'](_0x12f6a6[_0x4877('0x32')][_0x4877('0x3a')]);_0x2d69f5[_0x4877('0x3b')]=qs[_0x4877('0x34')](_[_0x4877('0x3c')](_0x12f6a6[_0x4877('0x32')],_0x3e3d93[_0x4877('0x34')]));if(_0x12f6a6[_0x4877('0x32')]['filter']){_0x2d69f5[_0x4877('0x3b')]=_[_0x4877('0x3e')](_0x2d69f5[_0x4877('0x3b')],{'$or':_[_0x4877('0x2e')](_0x2d69f5[_0x4877('0x36')],function(_0x1de17c){var _0x4874d5={};_0x4874d5[_0x1de17c]={'$like':'%'+_0x12f6a6[_0x4877('0x32')][_0x4877('0x3d')]+'%'};return _0x4874d5;})});}_0x2d69f5=_[_0x4877('0x3e')]({},_0x2d69f5,_0x12f6a6[_0x4877('0x40')]);return _0x4f5a50[_0x4877('0x50')](_0x2d69f5);}})[_0x4877('0x28')](function(_0x5e6536){if(_0x5e6536){_0x2ae4cb=_0x5e6536[_0x4877('0x46')];if(!_0x12f6a6[_0x4877('0x32')][_0x4877('0x4f')]('nolimit')){_0x2d69f5[_0x4877('0x20')]=qs[_0x4877('0x20')](_0x12f6a6[_0x4877('0x32')][_0x4877('0x20')]);_0x2d69f5['offset']=qs['offset'](_0x12f6a6[_0x4877('0x32')][_0x4877('0x1d')]);}return _0x4f5a50[_0x4877('0x50')](_0x2d69f5);}})[_0x4877('0x28')](function(_0x4b7d6e){if(_0x4b7d6e){return _0x4b7d6e?{'count':_0x2ae4cb,'rows':_0x4b7d6e}:null;}})[_0x4877('0x28')](respondWithResult(_0x527f24,null))[_0x4877('0x49')](handleError(_0x527f24,null));};exports[_0x4877('0x51')]=function(_0x352425,_0x5db105,_0xffae42){var _0x32bebb={};var _0x228254={};var _0x6de39a;var _0x43da21;return db[_0x4877('0x41')][_0x4877('0x4d')]({'where':{'id':_0x352425[_0x4877('0x4b')]['id']}})[_0x4877('0x28')](handleEntityNotFound(_0x5db105,null))[_0x4877('0x28')](function(_0xda6c82){if(_0xda6c82){_0x6de39a=_0xda6c82;_0x228254[_0x4877('0x31')]=_[_0x4877('0x33')](db['ZohoField'][_0x4877('0x2f')]);_0x228254['query']=_[_0x4877('0x33')](_0x352425[_0x4877('0x32')]);_0x228254[_0x4877('0x34')]=_[_0x4877('0x35')](_0x228254[_0x4877('0x31')],_0x228254['query']);_0x32bebb[_0x4877('0x36')]=_[_0x4877('0x35')](_0x228254[_0x4877('0x31')],qs[_0x4877('0x37')](_0x352425[_0x4877('0x32')][_0x4877('0x37')]));_0x32bebb[_0x4877('0x36')]=_0x32bebb[_0x4877('0x36')][_0x4877('0x46')]?_0x32bebb['attributes']:_0x228254[_0x4877('0x31')];_0x32bebb[_0x4877('0x39')]=qs['sort'](_0x352425['query'][_0x4877('0x3a')]);_0x32bebb[_0x4877('0x3b')]=qs[_0x4877('0x34')](_[_0x4877('0x3c')](_0x352425[_0x4877('0x32')],_0x228254['filters']));if(_0x352425['query'][_0x4877('0x3d')]){_0x32bebb[_0x4877('0x3b')]=_[_0x4877('0x3e')](_0x32bebb[_0x4877('0x3b')],{'$or':_[_0x4877('0x2e')](_0x32bebb['attributes'],function(_0x5170a4){var _0x138ccc={};_0x138ccc[_0x5170a4]={'$like':'%'+_0x352425[_0x4877('0x32')][_0x4877('0x3d')]+'%'};return _0x138ccc;})});}_0x32bebb=_[_0x4877('0x3e')]({},_0x32bebb,_0x352425[_0x4877('0x40')]);return _0x6de39a[_0x4877('0x51')](_0x32bebb);}})[_0x4877('0x28')](function(_0x38ecd2){if(_0x38ecd2){_0x43da21=_0x38ecd2[_0x4877('0x46')];if(!_0x352425[_0x4877('0x32')][_0x4877('0x4f')](_0x4877('0x38'))){_0x32bebb['limit']=qs[_0x4877('0x20')](_0x352425[_0x4877('0x32')][_0x4877('0x20')]);_0x32bebb[_0x4877('0x1d')]=qs['offset'](_0x352425['query'][_0x4877('0x1d')]);}return _0x6de39a[_0x4877('0x51')](_0x32bebb);}})[_0x4877('0x28')](function(_0x50ca8a){if(_0x50ca8a){return _0x50ca8a?{'count':_0x43da21,'rows':_0x50ca8a}:null;}})[_0x4877('0x28')](respondWithResult(_0x5db105,null))[_0x4877('0x49')](handleError(_0x5db105,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 0b23995..8e755f1 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.model.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d6e=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','api','moment'];(function(_0x1d27a8,_0x2f5d59){var _0x37adc5=function(_0x354a20){while(--_0x354a20){_0x1d27a8['push'](_0x1d27a8['shift']());}};_0x37adc5(++_0x2f5d59);}(_0x8d6e,0x14e));var _0xe8d6=function(_0x513e7d,_0x37015c){_0x513e7d=_0x513e7d-0x0;var _0x61215d=_0x8d6e[_0x513e7d];return _0x61215d;};'use strict';var _=require(_0xe8d6('0x0'));var util=require(_0xe8d6('0x1'));var logger=require('../../config/logger')(_0xe8d6('0x2'));var moment=require(_0xe8d6('0x3'));var BPromise=require(_0xe8d6('0x4'));var rp=require(_0xe8d6('0x5'));var fs=require('fs');var path=require(_0xe8d6('0x6'));var rimraf=require(_0xe8d6('0x7'));var config=require(_0xe8d6('0x8'));var attributes=require(_0xe8d6('0x9'));module[_0xe8d6('0xa')]=function(_0x34f221,_0x1eb69b){return _0x34f221[_0xe8d6('0xb')](_0xe8d6('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a38=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a38,0x1de));var _0x81a3=function(_0xf2662b,_0x4d8f41){_0xf2662b=_0xf2662b-0x0;var _0x257dc7=_0x1a38[_0xf2662b];return _0x257dc7;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var logger=require(_0x81a3('0x2'))(_0x81a3('0x3'));var moment=require('moment');var BPromise=require(_0x81a3('0x4'));var rp=require(_0x81a3('0x5'));var fs=require('fs');var path=require(_0x81a3('0x6'));var rimraf=require(_0x81a3('0x7'));var config=require(_0x81a3('0x8'));var attributes=require(_0x81a3('0x9'));module[_0x81a3('0xa')]=function(_0x56d526,_0x3dfe01){return _0x56d526['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f25927c..234567c 100644 --- a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js +++ b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x543e=['error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x15ce76,_0x302986){var _0x5ed7ef=function(_0x1d296c){while(--_0x1d296c){_0x15ce76['push'](_0x15ce76['shift']());}};_0x5ed7ef(++_0x302986);}(_0x543e,0x1e9));var _0xe543=function(_0x3da2f5,_0x423ce2){_0x3da2f5=_0x3da2f5-0x0;var _0x6c3805=_0x543e[_0x3da2f5];return _0x6c3805;};'use strict';var _=require('lodash');var util=require(_0xe543('0x0'));var moment=require(_0xe543('0x1'));var BPromise=require(_0xe543('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe543('0x3'));var db=require(_0xe543('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe543('0x5'))(_0xe543('0x6'));var config=require('../../config/environment');var jayson=require(_0xe543('0x7'));var client=jayson[_0xe543('0x8')][_0xe543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a693b,_0x26804c,_0x172fc7){return new BPromise(function(_0x58a7bf,_0x11d641){return client[_0xe543('0xa')](_0x1a693b,_0x172fc7)[_0xe543('0xb')](function(_0x3cab75){logger['info'](_0xe543('0xc'),_0x26804c,_0xe543('0xd'));logger[_0xe543('0xe')](_0xe543('0xf'),_0x26804c,_0xe543('0xd'),JSON[_0xe543('0x10')](_0x3cab75));if(_0x3cab75[_0xe543('0x11')]){if(_0x3cab75['error'][_0xe543('0x12')]===0x1f4){logger[_0xe543('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x26804c,_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);return _0x11d641(_0x3cab75['error']['message']);}logger[_0xe543('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x26804c,_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);return _0x58a7bf(_0x3cab75[_0xe543('0x11')][_0xe543('0x13')]);}else{logger[_0xe543('0x14')](_0xe543('0xc'),_0x26804c,_0xe543('0xd'));_0x58a7bf(_0x3cab75[_0xe543('0x15')][_0xe543('0x13')]);}})['catch'](function(_0x3bab9d){logger[_0xe543('0x11')](_0xe543('0xc'),_0x26804c,_0x3bab9d);_0x11d641(_0x3bab9d);});});} \ No newline at end of file +var _0xb38b=['code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xb38b,0x18e));var _0xbb38=function(_0x24d475,_0x48476b){_0x24d475=_0x24d475-0x0;var _0x5a36f2=_0xb38b[_0x24d475];return _0x5a36f2;};'use strict';var _=require(_0xbb38('0x0'));var util=require(_0xbb38('0x1'));var moment=require(_0xbb38('0x2'));var BPromise=require(_0xbb38('0x3'));var rs=require(_0xbb38('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb38('0x5'))['db'];var utils=require(_0xbb38('0x6'));var logger=require(_0xbb38('0x7'))(_0xbb38('0x8'));var config=require(_0xbb38('0x9'));var jayson=require(_0xbb38('0xa'));var client=jayson['client'][_0xbb38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c6d08,_0x4e2363,_0x145e81){return new BPromise(function(_0x2bf45f,_0x2c519c){return client[_0xbb38('0xc')](_0x6c6d08,_0x145e81)['then'](function(_0x5c4ade){logger[_0xbb38('0xd')](_0xbb38('0xe'),_0x4e2363,_0xbb38('0xf'));logger[_0xbb38('0x10')](_0xbb38('0x11'),_0x4e2363,_0xbb38('0xf'),JSON[_0xbb38('0x12')](_0x5c4ade));if(_0x5c4ade[_0xbb38('0x13')]){if(_0x5c4ade[_0xbb38('0x13')][_0xbb38('0x14')]===0x1f4){logger[_0xbb38('0x13')](_0xbb38('0xe'),_0x4e2363,_0x5c4ade[_0xbb38('0x13')]['message']);return _0x2c519c(_0x5c4ade[_0xbb38('0x13')][_0xbb38('0x15')]);}logger[_0xbb38('0x13')](_0xbb38('0xe'),_0x4e2363,_0x5c4ade[_0xbb38('0x13')][_0xbb38('0x15')]);return _0x2bf45f(_0x5c4ade[_0xbb38('0x13')][_0xbb38('0x15')]);}else{logger[_0xbb38('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x4e2363,_0xbb38('0xf'));_0x2bf45f(_0x5c4ade['result'][_0xbb38('0x15')]);}})['catch'](function(_0x5f02e7){logger[_0xbb38('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x4e2363,_0x5f02e7);_0x2c519c(_0x5f02e7);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 929b8d8..92cf65b 100644 --- a/server/api/intZohoField/index.js +++ b/server/api/intZohoField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3dd=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x3ba1bc,_0x236e7c){var _0x2d3e1e=function(_0x34312a){while(--_0x34312a){_0x3ba1bc['push'](_0x3ba1bc['shift']());}};_0x2d3e1e(++_0x236e7c);}(_0xb3dd,0xce));var _0xdb3d=function(_0x1c0fda,_0x3e99f0){_0x1c0fda=_0x1c0fda-0x0;var _0x3f8fda=_0xb3dd[_0x1c0fda];return _0x3f8fda;};'use strict';var multer=require(_0xdb3d('0x0'));var util=require(_0xdb3d('0x1'));var path=require('path');var timeout=require(_0xdb3d('0x2'));var express=require(_0xdb3d('0x3'));var router=express[_0xdb3d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdb3d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb3d('0x6'));var controller=require('./intZohoField.controller');router[_0xdb3d('0x7')]('/',auth['isAuthenticated'](),controller[_0xdb3d('0x8')]);router[_0xdb3d('0x7')]('/:id',auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xa')]);router[_0xdb3d('0xb')]('/',auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xc')]);router[_0xdb3d('0xd')](_0xdb3d('0xe'),auth[_0xdb3d('0x9')](),controller['update']);router['delete'](_0xdb3d('0xe'),auth[_0xdb3d('0x9')](),controller[_0xdb3d('0xf')]);module[_0xdb3d('0x10')]=router; \ No newline at end of file +var _0x2ae2=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','post','isAuthenticated','create','put','update','delete','/:id','destroy'];(function(_0x6b8f2d,_0x1f3e18){var _0x1376db=function(_0x318420){while(--_0x318420){_0x6b8f2d['push'](_0x6b8f2d['shift']());}};_0x1376db(++_0x1f3e18);}(_0x2ae2,0x94));var _0x22ae=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0x2ae2[_0x1eb5da];return _0x579a2f;};'use strict';var multer=require(_0x22ae('0x0'));var util=require(_0x22ae('0x1'));var path=require(_0x22ae('0x2'));var timeout=require(_0x22ae('0x3'));var express=require(_0x22ae('0x4'));var router=express['Router']();var fs_extra=require(_0x22ae('0x5'));var auth=require(_0x22ae('0x6'));var interaction=require(_0x22ae('0x7'));var config=require(_0x22ae('0x8'));var controller=require(_0x22ae('0x9'));router[_0x22ae('0xa')]('/',auth['isAuthenticated'](),controller[_0x22ae('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x22ae('0xc')]('/',auth[_0x22ae('0xd')](),controller[_0x22ae('0xe')]);router[_0x22ae('0xf')]('/:id',auth[_0x22ae('0xd')](),controller[_0x22ae('0x10')]);router[_0x22ae('0x11')](_0x22ae('0x12'),auth[_0x22ae('0xd')](),controller[_0x22ae('0x13')]);module[_0x22ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 7d7812d..bfb3156 100644 --- a/server/api/intZohoField/intZohoField.attributes.js +++ b/server/api/intZohoField/intZohoField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe86=['customVariable','keyValue','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x4799ef,_0x25cf0f){var _0x5a68f1=function(_0x2bef5b){while(--_0x2bef5b){_0x4799ef['push'](_0x4799ef['shift']());}};_0x5a68f1(++_0x25cf0f);}(_0xbe86,0xd4));var _0x6be8=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xbe86[_0x1589dd];return _0x1bddd1;};'use strict';var Sequelize=require(_0x6be8('0x0'));module[_0x6be8('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6be8('0x2'),_0x6be8('0x3'),_0x6be8('0x4'),_0x6be8('0x5'),_0x6be8('0x6')),'defaultValue':_0x6be8('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6be8('0x7')]},'keyType':{'type':Sequelize[_0x6be8('0x8')](_0x6be8('0x2'),'variable',_0x6be8('0x4'))},'keyContent':{'type':Sequelize[_0x6be8('0x7')]},'idField':{'type':Sequelize[_0x6be8('0x7')]},'nameField':{'type':Sequelize[_0x6be8('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6be8('0x7')]}}; \ No newline at end of file +var _0x2f49=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x20b55c,_0x19a43b){var _0x3330c7=function(_0x1c8978){while(--_0x1c8978){_0x20b55c['push'](_0x20b55c['shift']());}};_0x3330c7(++_0x19a43b);}(_0x2f49,0xdf));var _0x92f4=function(_0x2f7f1f,_0x55c48a){_0x2f7f1f=_0x2f7f1f-0x0;var _0x17c66d=_0x2f49[_0x2f7f1f];return _0x17c66d;};'use strict';var Sequelize=require(_0x92f4('0x0'));module[_0x92f4('0x1')]={'type':{'type':Sequelize[_0x92f4('0x2')](_0x92f4('0x3'),_0x92f4('0x4'),_0x92f4('0x5'),_0x92f4('0x6'),_0x92f4('0x7')),'defaultValue':_0x92f4('0x3')},'content':{'type':Sequelize[_0x92f4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x92f4('0x2')](_0x92f4('0x3'),_0x92f4('0x4'),_0x92f4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x92f4('0x8')]},'nameField':{'type':Sequelize[_0x92f4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ea0b527..d5b8471 100644 --- a/server/api/intZohoField/intZohoField.controller.js +++ b/server/api/intZohoField/intZohoField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf3c=['request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir'];(function(_0xf9cc12,_0x8a5a90){var _0x1827fa=function(_0x2a2e66){while(--_0x2a2e66){_0xf9cc12['push'](_0xf9cc12['shift']());}};_0x1827fa(++_0x8a5a90);}(_0xaf3c,0x16f));var _0xcaf3=function(_0x3b9f02,_0x4eed0c){_0x3b9f02=_0x3b9f02-0x0;var _0x31f7eb=_0xaf3c[_0x3b9f02];return _0x31f7eb;};'use strict';var emlformat=require(_0xcaf3('0x0'));var rimraf=require(_0xcaf3('0x1'));var zipdir=require(_0xcaf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcaf3('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcaf3('0x5'));var ejs=require(_0xcaf3('0x6'));var fs=require('fs');var fs_extra=require(_0xcaf3('0x7'));var _=require(_0xcaf3('0x8'));var squel=require(_0xcaf3('0x9'));var crypto=require(_0xcaf3('0xa'));var jsforce=require(_0xcaf3('0xb'));var deskjs=require(_0xcaf3('0xc'));var toCsv=require(_0xcaf3('0x5'));var querystring=require(_0xcaf3('0xd'));var Papa=require(_0xcaf3('0xe'));var Redis=require(_0xcaf3('0xf'));var authService=require(_0xcaf3('0x10'));var qs=require(_0xcaf3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaf3('0x12'));var logger=require(_0xcaf3('0x13'))('api');var utils=require(_0xcaf3('0x14'));var config=require(_0xcaf3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34d6c6,_0x394349){_0x394349=_0x394349||0xcc;return function(_0x1f14d2){if(_0x1f14d2){return _0x34d6c6[_0xcaf3('0x16')](_0x394349);}return _0x34d6c6['status'](_0x394349)[_0xcaf3('0x17')]();};}function respondWithResult(_0x34c589,_0x5194a6){_0x5194a6=_0x5194a6||0xc8;return function(_0x1a1c4a){if(_0x1a1c4a){return _0x34c589[_0xcaf3('0x18')](_0x5194a6)[_0xcaf3('0x19')](_0x1a1c4a);}};}function respondWithFilteredResult(_0x3681e0,_0x355349){return function(_0x2e9eb7){if(_0x2e9eb7){var _0x5d3d14=typeof _0x355349[_0xcaf3('0x1a')]===_0xcaf3('0x1b')&&typeof _0x355349[_0xcaf3('0x1c')]===_0xcaf3('0x1b');var _0x234e27=_0x2e9eb7['count'];var _0x436c27=_0x5d3d14?0x0:_0x355349[_0xcaf3('0x1a')];var _0x2ef9d2=_0x5d3d14?_0x2e9eb7[_0xcaf3('0x1d')]:_0x355349[_0xcaf3('0x1a')]+_0x355349[_0xcaf3('0x1c')];var _0x56f25a;if(_0x2ef9d2>=_0x234e27){_0x2ef9d2=_0x234e27;_0x56f25a=0xc8;}else{_0x56f25a=0xce;}_0x3681e0[_0xcaf3('0x18')](_0x56f25a);return _0x3681e0[_0xcaf3('0x1e')](_0xcaf3('0x1f'),_0x436c27+'-'+_0x2ef9d2+'/'+_0x234e27)[_0xcaf3('0x19')](_0x2e9eb7);}return null;};}function patchUpdates(_0x593244){return function(_0x4ae5c1){try{jsonpatch[_0xcaf3('0x20')](_0x4ae5c1,_0x593244,!![]);}catch(_0x1c2c3){return BPromise[_0xcaf3('0x21')](_0x1c2c3);}return _0x4ae5c1[_0xcaf3('0x22')]();};}function saveUpdates(_0x4b1f44,_0x45f8e3){return function(_0x47dcdc){if(_0x47dcdc){return _0x47dcdc[_0xcaf3('0x23')](_0x4b1f44)[_0xcaf3('0x24')](function(_0x1b20d8){return _0x1b20d8;});}return null;};}function removeEntity(_0x1656f2,_0x2b6342){return function(_0x324cf1){if(_0x324cf1){return _0x324cf1[_0xcaf3('0x25')]()[_0xcaf3('0x24')](function(){_0x1656f2[_0xcaf3('0x18')](0xcc)[_0xcaf3('0x17')]();});}};}function handleEntityNotFound(_0x1d46ed,_0x51ab0b){return function(_0x3f562d){if(!_0x3f562d){_0x1d46ed[_0xcaf3('0x16')](0x194);}return _0x3f562d;};}function handleError(_0x4608f,_0x11c9c7){_0x11c9c7=_0x11c9c7||0x1f4;return function(_0x56dd8a){logger['error'](_0x56dd8a[_0xcaf3('0x26')]);if(_0x56dd8a[_0xcaf3('0x27')]){delete _0x56dd8a[_0xcaf3('0x27')];}_0x4608f[_0xcaf3('0x18')](_0x11c9c7)[_0xcaf3('0x28')](_0x56dd8a);};}exports[_0xcaf3('0x29')]=function(_0x46176d,_0x3aa500){var _0x579afc={},_0x1fd3ce={},_0x282032={'count':0x0,'rows':[]};var _0x5293b0=_['map'](db['ZohoField'][_0xcaf3('0x2a')],function(_0x2f7811){return{'name':_0x2f7811[_0xcaf3('0x2b')],'type':_0x2f7811['type'][_0xcaf3('0x2c')]};});_0x1fd3ce[_0xcaf3('0x2d')]=_[_0xcaf3('0x2e')](_0x5293b0,_0xcaf3('0x27'));_0x1fd3ce['query']=_[_0xcaf3('0x2f')](_0x46176d[_0xcaf3('0x30')]);_0x1fd3ce[_0xcaf3('0x31')]=_[_0xcaf3('0x32')](_0x1fd3ce[_0xcaf3('0x2d')],_0x1fd3ce[_0xcaf3('0x30')]);_0x579afc[_0xcaf3('0x33')]=_[_0xcaf3('0x32')](_0x1fd3ce[_0xcaf3('0x2d')],qs[_0xcaf3('0x34')](_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x34')]));_0x579afc[_0xcaf3('0x33')]=_0x579afc[_0xcaf3('0x33')][_0xcaf3('0x35')]?_0x579afc[_0xcaf3('0x33')]:_0x1fd3ce[_0xcaf3('0x2d')];if(!_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x36')](_0xcaf3('0x37'))){_0x579afc[_0xcaf3('0x1c')]=qs[_0xcaf3('0x1c')](_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x1c')]);_0x579afc[_0xcaf3('0x1a')]=qs[_0xcaf3('0x1a')](_0x46176d['query'][_0xcaf3('0x1a')]);}_0x579afc[_0xcaf3('0x38')]=qs['sort'](_0x46176d['query']['sort']);_0x579afc[_0xcaf3('0x39')]=qs[_0xcaf3('0x31')](_[_0xcaf3('0x3a')](_0x46176d['query'],_0x1fd3ce['filters']),_0x5293b0);if(_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x3b')]){_0x579afc['where']=_[_0xcaf3('0x3c')](_0x579afc[_0xcaf3('0x39')],{'$or':_[_0xcaf3('0x2e')](_0x5293b0,function(_0x11ba19){if(_0x11ba19['type']!==_0xcaf3('0x3d')){var _0x3d4786={};_0x3d4786[_0x11ba19['name']]={'$like':'%'+_0x46176d[_0xcaf3('0x30')]['filter']+'%'};return _0x3d4786;}})});}_0x579afc=_[_0xcaf3('0x3c')]({},_0x579afc,_0x46176d[_0xcaf3('0x3e')]);var _0x3cf7d9={'where':_0x579afc[_0xcaf3('0x39')]};return db[_0xcaf3('0x3f')][_0xcaf3('0x1d')](_0x3cf7d9)[_0xcaf3('0x24')](function(_0x3d29f6){_0x282032['count']=_0x3d29f6;if(_0x46176d[_0xcaf3('0x30')][_0xcaf3('0x40')]){_0x579afc[_0xcaf3('0x41')]=[{'all':!![]}];}return db[_0xcaf3('0x3f')][_0xcaf3('0x42')](_0x579afc);})['then'](function(_0x35e758){_0x282032[_0xcaf3('0x43')]=_0x35e758;return _0x282032;})['then'](respondWithFilteredResult(_0x3aa500,_0x579afc))[_0xcaf3('0x44')](handleError(_0x3aa500,null));};exports[_0xcaf3('0x45')]=function(_0xff9336,_0x1f2d42){var _0x388430={'raw':!![],'where':{'id':_0xff9336[_0xcaf3('0x46')]['id']}},_0xa6bf43={};_0xa6bf43[_0xcaf3('0x2d')]=_[_0xcaf3('0x2f')](db[_0xcaf3('0x3f')]['rawAttributes']);_0xa6bf43[_0xcaf3('0x30')]=_[_0xcaf3('0x2f')](_0xff9336['query']);_0xa6bf43[_0xcaf3('0x31')]=_[_0xcaf3('0x32')](_0xa6bf43[_0xcaf3('0x2d')],_0xa6bf43[_0xcaf3('0x30')]);_0x388430['attributes']=_[_0xcaf3('0x32')](_0xa6bf43[_0xcaf3('0x2d')],qs['fields'](_0xff9336[_0xcaf3('0x30')]['fields']));_0x388430[_0xcaf3('0x33')]=_0x388430[_0xcaf3('0x33')][_0xcaf3('0x35')]?_0x388430[_0xcaf3('0x33')]:_0xa6bf43[_0xcaf3('0x2d')];if(_0xff9336[_0xcaf3('0x30')][_0xcaf3('0x40')]){_0x388430[_0xcaf3('0x41')]=[{'all':!![]}];}_0x388430=_['merge']({},_0x388430,_0xff9336[_0xcaf3('0x3e')]);return db[_0xcaf3('0x3f')][_0xcaf3('0x47')](_0x388430)[_0xcaf3('0x24')](handleEntityNotFound(_0x1f2d42,null))['then'](respondWithResult(_0x1f2d42,null))[_0xcaf3('0x44')](handleError(_0x1f2d42,null));};exports['create']=function(_0x3371e5,_0x487b15){return db[_0xcaf3('0x3f')][_0xcaf3('0x48')](_0x3371e5[_0xcaf3('0x49')],{})[_0xcaf3('0x24')](respondWithResult(_0x487b15,0xc9))[_0xcaf3('0x44')](handleError(_0x487b15,null));};exports[_0xcaf3('0x23')]=function(_0x3077a8,_0x3a7b49){if(_0x3077a8[_0xcaf3('0x49')]['id']){delete _0x3077a8[_0xcaf3('0x49')]['id'];}return db[_0xcaf3('0x3f')]['find']({'where':{'id':_0x3077a8['params']['id']}})[_0xcaf3('0x24')](handleEntityNotFound(_0x3a7b49,null))[_0xcaf3('0x24')](saveUpdates(_0x3077a8['body'],null))[_0xcaf3('0x24')](respondWithResult(_0x3a7b49,null))[_0xcaf3('0x44')](handleError(_0x3a7b49,null));};exports[_0xcaf3('0x25')]=function(_0x28e25c,_0x19471c){return db[_0xcaf3('0x3f')][_0xcaf3('0x47')]({'where':{'id':_0x28e25c['params']['id']}})[_0xcaf3('0x24')](handleEntityNotFound(_0x19471c,null))[_0xcaf3('0x24')](removeEntity(_0x19471c,null))[_0xcaf3('0x44')](handleError(_0x19471c,null));}; \ No newline at end of file +var _0x30f7=['then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','find','create','update','body','params','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save'];(function(_0x169d5c,_0x21b078){var _0x1677eb=function(_0x4257b6){while(--_0x4257b6){_0x169d5c['push'](_0x169d5c['shift']());}};_0x1677eb(++_0x21b078);}(_0x30f7,0x1cf));var _0x730f=function(_0x1daa11,_0x5ad89f){_0x1daa11=_0x1daa11-0x0;var _0x42a37b=_0x30f7[_0x1daa11];return _0x42a37b;};'use strict';var emlformat=require(_0x730f('0x0'));var rimraf=require(_0x730f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x730f('0x2'));var rp=require('request-promise');var moment=require(_0x730f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x730f('0x4'));var util=require(_0x730f('0x5'));var path=require(_0x730f('0x6'));var sox=require(_0x730f('0x7'));var csv=require(_0x730f('0x8'));var ejs=require(_0x730f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x730f('0xa'));var squel=require(_0x730f('0xb'));var crypto=require(_0x730f('0xc'));var jsforce=require(_0x730f('0xd'));var deskjs=require(_0x730f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x730f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x730f('0x10'));var qs=require(_0x730f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x730f('0x12'));var logger=require(_0x730f('0x13'))(_0x730f('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x730f('0x15'));var db=require(_0x730f('0x16'))['db'];function respondWithStatusCode(_0x454260,_0x436aae){_0x436aae=_0x436aae||0xcc;return function(_0x21ba4a){if(_0x21ba4a){return _0x454260[_0x730f('0x17')](_0x436aae);}return _0x454260[_0x730f('0x18')](_0x436aae)[_0x730f('0x19')]();};}function respondWithResult(_0x286557,_0x491ad5){_0x491ad5=_0x491ad5||0xc8;return function(_0x579f4f){if(_0x579f4f){return _0x286557[_0x730f('0x18')](_0x491ad5)[_0x730f('0x1a')](_0x579f4f);}};}function respondWithFilteredResult(_0x3a7918,_0x5715cb){return function(_0x2261c1){if(_0x2261c1){var _0x2b92d5=typeof _0x5715cb[_0x730f('0x1b')]===_0x730f('0x1c')&&typeof _0x5715cb[_0x730f('0x1d')]===_0x730f('0x1c');var _0x4851d7=_0x2261c1['count'];var _0x2dd1cb=_0x2b92d5?0x0:_0x5715cb[_0x730f('0x1b')];var _0x5d8c1b=_0x2b92d5?_0x2261c1['count']:_0x5715cb[_0x730f('0x1b')]+_0x5715cb[_0x730f('0x1d')];var _0x4279a2;if(_0x5d8c1b>=_0x4851d7){_0x5d8c1b=_0x4851d7;_0x4279a2=0xc8;}else{_0x4279a2=0xce;}_0x3a7918[_0x730f('0x18')](_0x4279a2);return _0x3a7918['set'](_0x730f('0x1e'),_0x2dd1cb+'-'+_0x5d8c1b+'/'+_0x4851d7)[_0x730f('0x1a')](_0x2261c1);}return null;};}function patchUpdates(_0x17d25c){return function(_0x20bbf6){try{jsonpatch[_0x730f('0x1f')](_0x20bbf6,_0x17d25c,!![]);}catch(_0x1f09dc){return BPromise[_0x730f('0x20')](_0x1f09dc);}return _0x20bbf6[_0x730f('0x21')]();};}function saveUpdates(_0x729ca9,_0x30545f){return function(_0x15451d){if(_0x15451d){return _0x15451d['update'](_0x729ca9)[_0x730f('0x22')](function(_0x7c4b2e){return _0x7c4b2e;});}return null;};}function removeEntity(_0x3959bd,_0x2c649a){return function(_0xdff0d7){if(_0xdff0d7){return _0xdff0d7[_0x730f('0x23')]()[_0x730f('0x22')](function(){_0x3959bd[_0x730f('0x18')](0xcc)[_0x730f('0x19')]();});}};}function handleEntityNotFound(_0x214c45,_0x209668){return function(_0x1f0bd7){if(!_0x1f0bd7){_0x214c45[_0x730f('0x17')](0x194);}return _0x1f0bd7;};}function handleError(_0x23150,_0x218381){_0x218381=_0x218381||0x1f4;return function(_0xfdb152){logger[_0x730f('0x24')](_0xfdb152[_0x730f('0x25')]);if(_0xfdb152[_0x730f('0x26')]){delete _0xfdb152[_0x730f('0x26')];}_0x23150['status'](_0x218381)[_0x730f('0x27')](_0xfdb152);};}exports[_0x730f('0x28')]=function(_0x30e04f,_0x3646b5){var _0x28b688={},_0x33e41d={},_0x511411={'count':0x0,'rows':[]};var _0x639cad=_[_0x730f('0x29')](db[_0x730f('0x2a')][_0x730f('0x2b')],function(_0x46932f){return{'name':_0x46932f['fieldName'],'type':_0x46932f['type'][_0x730f('0x2c')]};});_0x33e41d[_0x730f('0x2d')]=_[_0x730f('0x29')](_0x639cad,_0x730f('0x26'));_0x33e41d[_0x730f('0x2e')]=_['keys'](_0x30e04f[_0x730f('0x2e')]);_0x33e41d[_0x730f('0x2f')]=_[_0x730f('0x30')](_0x33e41d[_0x730f('0x2d')],_0x33e41d['query']);_0x28b688[_0x730f('0x31')]=_['intersection'](_0x33e41d[_0x730f('0x2d')],qs[_0x730f('0x32')](_0x30e04f[_0x730f('0x2e')][_0x730f('0x32')]));_0x28b688[_0x730f('0x31')]=_0x28b688['attributes']['length']?_0x28b688[_0x730f('0x31')]:_0x33e41d[_0x730f('0x2d')];if(!_0x30e04f[_0x730f('0x2e')]['hasOwnProperty'](_0x730f('0x33'))){_0x28b688[_0x730f('0x1d')]=qs['limit'](_0x30e04f[_0x730f('0x2e')][_0x730f('0x1d')]);_0x28b688[_0x730f('0x1b')]=qs[_0x730f('0x1b')](_0x30e04f[_0x730f('0x2e')][_0x730f('0x1b')]);}_0x28b688['order']=qs[_0x730f('0x34')](_0x30e04f['query'][_0x730f('0x34')]);_0x28b688[_0x730f('0x35')]=qs['filters'](_[_0x730f('0x36')](_0x30e04f[_0x730f('0x2e')],_0x33e41d[_0x730f('0x2f')]),_0x639cad);if(_0x30e04f['query'][_0x730f('0x37')]){_0x28b688[_0x730f('0x35')]=_[_0x730f('0x38')](_0x28b688['where'],{'$or':_[_0x730f('0x29')](_0x639cad,function(_0x55e0ca){if(_0x55e0ca['type']!==_0x730f('0x39')){var _0x4ca94d={};_0x4ca94d[_0x55e0ca[_0x730f('0x26')]]={'$like':'%'+_0x30e04f[_0x730f('0x2e')][_0x730f('0x37')]+'%'};return _0x4ca94d;}})});}_0x28b688=_[_0x730f('0x38')]({},_0x28b688,_0x30e04f[_0x730f('0x3a')]);var _0x3930ea={'where':_0x28b688['where']};return db[_0x730f('0x2a')][_0x730f('0x3b')](_0x3930ea)['then'](function(_0x1ce49c){_0x511411['count']=_0x1ce49c;if(_0x30e04f[_0x730f('0x2e')][_0x730f('0x3c')]){_0x28b688[_0x730f('0x3d')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x28b688);})[_0x730f('0x22')](function(_0x39c9ec){_0x511411[_0x730f('0x3e')]=_0x39c9ec;return _0x511411;})['then'](respondWithFilteredResult(_0x3646b5,_0x28b688))[_0x730f('0x3f')](handleError(_0x3646b5,null));};exports[_0x730f('0x40')]=function(_0x3a9f00,_0x333be0){var _0x309c16={'raw':!![],'where':{'id':_0x3a9f00['params']['id']}},_0xadc0f2={};_0xadc0f2[_0x730f('0x2d')]=_[_0x730f('0x41')](db[_0x730f('0x2a')][_0x730f('0x2b')]);_0xadc0f2[_0x730f('0x2e')]=_[_0x730f('0x41')](_0x3a9f00[_0x730f('0x2e')]);_0xadc0f2[_0x730f('0x2f')]=_[_0x730f('0x30')](_0xadc0f2[_0x730f('0x2d')],_0xadc0f2[_0x730f('0x2e')]);_0x309c16[_0x730f('0x31')]=_[_0x730f('0x30')](_0xadc0f2[_0x730f('0x2d')],qs[_0x730f('0x32')](_0x3a9f00[_0x730f('0x2e')][_0x730f('0x32')]));_0x309c16[_0x730f('0x31')]=_0x309c16[_0x730f('0x31')]['length']?_0x309c16[_0x730f('0x31')]:_0xadc0f2[_0x730f('0x2d')];if(_0x3a9f00[_0x730f('0x2e')][_0x730f('0x3c')]){_0x309c16[_0x730f('0x3d')]=[{'all':!![]}];}_0x309c16=_[_0x730f('0x38')]({},_0x309c16,_0x3a9f00[_0x730f('0x3a')]);return db[_0x730f('0x2a')][_0x730f('0x42')](_0x309c16)[_0x730f('0x22')](handleEntityNotFound(_0x333be0,null))[_0x730f('0x22')](respondWithResult(_0x333be0,null))[_0x730f('0x3f')](handleError(_0x333be0,null));};exports['create']=function(_0x5d3d51,_0x23ea7e){return db[_0x730f('0x2a')][_0x730f('0x43')](_0x5d3d51['body'],{})[_0x730f('0x22')](respondWithResult(_0x23ea7e,0xc9))[_0x730f('0x3f')](handleError(_0x23ea7e,null));};exports[_0x730f('0x44')]=function(_0x111960,_0x1b42af){if(_0x111960[_0x730f('0x45')]['id']){delete _0x111960[_0x730f('0x45')]['id'];}return db['ZohoField'][_0x730f('0x42')]({'where':{'id':_0x111960['params']['id']}})['then'](handleEntityNotFound(_0x1b42af,null))[_0x730f('0x22')](saveUpdates(_0x111960[_0x730f('0x45')],null))[_0x730f('0x22')](respondWithResult(_0x1b42af,null))[_0x730f('0x3f')](handleError(_0x1b42af,null));};exports[_0x730f('0x23')]=function(_0x1d557c,_0x53970e){return db['ZohoField'][_0x730f('0x42')]({'where':{'id':_0x1d557c[_0x730f('0x46')]['id']}})['then'](handleEntityNotFound(_0x53970e,null))['then'](removeEntity(_0x53970e,null))[_0x730f('0x3f')](handleError(_0x53970e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ffc2246..9fd5c66 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['bluebird','request-promise','path','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','../../config/logger','moment'];(function(_0xc22125,_0x4fa41a){var _0x1407ba=function(_0x1a3da6){while(--_0x1a3da6){_0xc22125['push'](_0xc22125['shift']());}};_0x1407ba(++_0x4fa41a);}(_0xafc4,0x69));var _0x4afc=function(_0x598968,_0x5a0e2a){_0x598968=_0x598968-0x0;var _0x4ef678=_0xafc4[_0x598968];return _0x4ef678;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x4afc('0xa'),_0x4afc('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index f4adffd..896cf18 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbee3=['../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis'];(function(_0x216ae6,_0x38cdd5){var _0x4205c9=function(_0x342254){while(--_0x342254){_0x216ae6['push'](_0x216ae6['shift']());}};_0x4205c9(++_0x38cdd5);}(_0xbee3,0xc3));var _0x3bee=function(_0xa9673c,_0x1b34fc){_0xa9673c=_0xa9673c-0x0;var _0x473f56=_0xbee3[_0xa9673c];return _0x473f56;};'use strict';var _=require(_0x3bee('0x0'));var util=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x3bee('0x3'));var fs=require('fs');var Redis=require(_0x3bee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bee('0x5'));var logger=require(_0x3bee('0x6'))(_0x3bee('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3bee('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x532791,_0x410f0f,_0x327cfe){return new BPromise(function(_0x525248,_0x187f51){return client[_0x3bee('0x9')](_0x532791,_0x327cfe)[_0x3bee('0xa')](function(_0x387a22){logger[_0x3bee('0xb')](_0x3bee('0xc'),_0x410f0f,_0x3bee('0xd'));logger[_0x3bee('0xe')](_0x3bee('0xf'),_0x410f0f,'request\x20sent',JSON[_0x3bee('0x10')](_0x387a22));if(_0x387a22[_0x3bee('0x11')]){if(_0x387a22[_0x3bee('0x11')][_0x3bee('0x12')]===0x1f4){logger['error'](_0x3bee('0xc'),_0x410f0f,_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);return _0x187f51(_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);}logger[_0x3bee('0x11')](_0x3bee('0xc'),_0x410f0f,_0x387a22[_0x3bee('0x11')][_0x3bee('0x13')]);return _0x525248(_0x387a22[_0x3bee('0x11')]['message']);}else{logger[_0x3bee('0xb')]('ZohoField,\x20%s,\x20%s',_0x410f0f,_0x3bee('0xd'));_0x525248(_0x387a22['result']['message']);}})['catch'](function(_0x4f92db){logger['error'](_0x3bee('0xc'),_0x410f0f,_0x4f92db);_0x187f51(_0x4f92db);});});} \ No newline at end of file +var _0xebf3=['error','code','message','result','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4e3d6d,_0xc159be){var _0x32d7d1=function(_0x29909e){while(--_0x29909e){_0x4e3d6d['push'](_0x4e3d6d['shift']());}};_0x32d7d1(++_0xc159be);}(_0xebf3,0x112));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3ebf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ebf('0x1'));var fs=require('fs');var Redis=require(_0x3ebf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ebf('0x3'));var logger=require('../../config/logger')(_0x3ebf('0x4'));var config=require(_0x3ebf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3ebf('0x6')][_0x3ebf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x422024,_0x56a06f,_0x575a45){return new BPromise(function(_0x49c2b8,_0x52e345){return client[_0x3ebf('0x8')](_0x422024,_0x575a45)[_0x3ebf('0x9')](function(_0x5170f0){logger[_0x3ebf('0xa')](_0x3ebf('0xb'),_0x56a06f,_0x3ebf('0xc'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x56a06f,_0x3ebf('0xc'),JSON[_0x3ebf('0xd')](_0x5170f0));if(_0x5170f0[_0x3ebf('0xe')]){if(_0x5170f0['error'][_0x3ebf('0xf')]===0x1f4){logger['error'](_0x3ebf('0xb'),_0x56a06f,_0x5170f0[_0x3ebf('0xe')][_0x3ebf('0x10')]);return _0x52e345(_0x5170f0[_0x3ebf('0xe')]['message']);}logger[_0x3ebf('0xe')](_0x3ebf('0xb'),_0x56a06f,_0x5170f0[_0x3ebf('0xe')][_0x3ebf('0x10')]);return _0x49c2b8(_0x5170f0['error']['message']);}else{logger['info'](_0x3ebf('0xb'),_0x56a06f,_0x3ebf('0xc'));_0x49c2b8(_0x5170f0[_0x3ebf('0x11')][_0x3ebf('0x10')]);}})['catch'](function(_0x1112fe){logger[_0x3ebf('0xe')](_0x3ebf('0xb'),_0x56a06f,_0x1112fe);_0x52e345(_0x1112fe);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fdde43f..fe5168c 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1eced4,_0xc5070f){var _0x1a91e5=function(_0xcc3a6c){while(--_0xcc3a6c){_0x1eced4['push'](_0x1eced4['shift']());}};_0x1a91e5(++_0xc5070f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index befc62c..9a647b2 100644 --- a/server/api/integration/integration.attributes.js +++ b/server/api/integration/integration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cea=['STRING','unique_name_and_version','app.js','state','sequelize','exports'];(function(_0x2f9f09,_0x1b9685){var _0x4dd5f2=function(_0x24b512){while(--_0x24b512){_0x2f9f09['push'](_0x2f9f09['shift']());}};_0x4dd5f2(++_0x1b9685);}(_0x1cea,0x142));var _0xa1ce=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x1cea[_0x31c19c];return _0x1a87f7;};'use strict';var Sequelize=require(_0xa1ce('0x0'));module[_0xa1ce('0x1')]={'name':{'type':Sequelize[_0xa1ce('0x2')],'allowNull':![],'unique':_0xa1ce('0x3')},'version':{'type':Sequelize[_0xa1ce('0x2')],'allowNull':![],'unique':_0xa1ce('0x3')},'main':{'type':Sequelize[_0xa1ce('0x2')],'defaultValue':_0xa1ce('0x4')},'filename':{'type':Sequelize[_0xa1ce('0x2')]},'path':{'type':Sequelize[_0xa1ce('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xa1ce('0x2')]},'logo':{'type':Sequelize[_0xa1ce('0x2')]},'state':{'type':Sequelize[_0xa1ce('0x2')],'unique':_0xa1ce('0x5')},'description':{'type':Sequelize[_0xa1ce('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa1ce('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9b03=['BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER'];(function(_0x190a93,_0x7bf3b5){var _0x3c762a=function(_0x22b01b){while(--_0x22b01b){_0x190a93['push'](_0x190a93['shift']());}};_0x3c762a(++_0x7bf3b5);}(_0x9b03,0x102));var _0x39b0=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9b03[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0x39b0('0x0'));module[_0x39b0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x39b0('0x2')},'version':{'type':Sequelize[_0x39b0('0x3')],'allowNull':![],'unique':_0x39b0('0x2')},'main':{'type':Sequelize[_0x39b0('0x3')],'defaultValue':_0x39b0('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x39b0('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x39b0('0x5')]},'active':{'type':Sequelize[_0x39b0('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x39b0('0x3')]},'logo':{'type':Sequelize[_0x39b0('0x3')]},'state':{'type':Sequelize[_0x39b0('0x3')],'unique':_0x39b0('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x39b0('0x3')]},'remoteUri':{'type':Sequelize[_0x39b0('0x3')]},'link':{'type':Sequelize[_0x39b0('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index dd33cfc..7212524 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','Integration','then','rows','catch','show','params','keys','includeAll','include','create','body','find','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length'];(function(_0x1527c8,_0x10cdcf){var _0x5880c7=function(_0x5b9e9e){while(--_0x5b9e9e){_0x1527c8['push'](_0x1527c8['shift']());}};_0x5880c7(++_0x10cdcf);}(_0x6343,0x168));var _0x3634=function(_0x509c00,_0x2208ef){_0x509c00=_0x509c00-0x0;var _0x509ccc=_0x6343[_0x509c00];return _0x509ccc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['Integration'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));}; \ No newline at end of file +var _0x1623=['model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','Integration','findAll','rows','catch','show','params','length','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1623,0xab));var _0x3162=function(_0x24a401,_0x55d021){_0x24a401=_0x24a401-0x0;var _0x3a7a88=_0x1623[_0x24a401];return _0x3a7a88;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['Integration'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')](_0x3d2958[_0x3162('0x48')],{})['then'](respondWithResult(_0x28865c,0xc9))[_0x3162('0x42')](handleError(_0x28865c,null));};exports['update']=function(_0x4f1dde,_0x12d791){if(_0x4f1dde[_0x3162('0x48')]['id']){delete _0x4f1dde[_0x3162('0x48')]['id'];}return db[_0x3162('0x3f')]['find']({'where':{'id':_0x4f1dde[_0x3162('0x44')]['id']}})['then'](handleEntityNotFound(_0x12d791,null))[_0x3162('0x24')](saveUpdates(_0x4f1dde[_0x3162('0x48')],null))['then'](respondWithResult(_0x12d791,null))[_0x3162('0x42')](handleError(_0x12d791,null));};exports['destroy']=function(_0x516599,_0x13e7c4){return db[_0x3162('0x3f')][_0x3162('0x46')]({'where':{'id':_0x516599[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x13e7c4,null))[_0x3162('0x24')](removeEntity(_0x13e7c4,null))[_0x3162('0x42')](handleError(_0x13e7c4,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index e893eef..708078b 100644 --- a/server/api/integration/integration.model.js +++ b/server/api/integration/integration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e3e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','api'];(function(_0x17fb0a,_0x5cb5ff){var _0x1b93c7=function(_0x3a3b87){while(--_0x3a3b87){_0x17fb0a['push'](_0x17fb0a['shift']());}};_0x1b93c7(++_0x5cb5ff);}(_0x9e3e,0x8e));var _0xe9e3=function(_0x2da61b,_0xd52a4c){_0x2da61b=_0x2da61b-0x0;var _0x3e01fc=_0x9e3e[_0x2da61b];return _0x3e01fc;};'use strict';var _=require(_0xe9e3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9e3('0x1'));var moment=require(_0xe9e3('0x2'));var BPromise=require(_0xe9e3('0x3'));var rp=require(_0xe9e3('0x4'));var fs=require('fs');var path=require(_0xe9e3('0x5'));var rimraf=require(_0xe9e3('0x6'));var config=require(_0xe9e3('0x7'));var attributes=require(_0xe9e3('0x8'));module[_0xe9e3('0x9')]=function(_0x14aacc,_0x51f92c){return _0x14aacc['define'](_0xe9e3('0xa'),attributes,{'tableName':_0xe9e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf9f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','lodash'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0xbf9f,0xa7));var _0xfbf9=function(_0x476108,_0x156db9){_0x476108=_0x476108-0x0;var _0x14bee7=_0xbf9f[_0x476108];return _0x14bee7;};'use strict';var _=require(_0xfbf9('0x0'));var util=require(_0xfbf9('0x1'));var logger=require(_0xfbf9('0x2'))('api');var moment=require(_0xfbf9('0x3'));var BPromise=require(_0xfbf9('0x4'));var rp=require(_0xfbf9('0x5'));var fs=require('fs');var path=require(_0xfbf9('0x6'));var rimraf=require(_0xfbf9('0x7'));var config=require(_0xfbf9('0x8'));var attributes=require(_0xfbf9('0x9'));module['exports']=function(_0x520605,_0x39f429){return _0x520605[_0xfbf9('0xa')](_0xfbf9('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 144fb99..244ad51 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4b735d,_0x3417f3){var _0xf1844d=function(_0x17d01b){while(--_0x17d01b){_0x4b735d['push'](_0x4b735d['shift']());}};_0xf1844d(++_0x3417f3);}(_0x6d38,0x1ef));var _0x86d3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6d38[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4b6c36,_0x30c5db){var _0x474aeb=function(_0x425c06){while(--_0x425c06){_0x4b6c36['push'](_0x4b6c36['shift']());}};_0x474aeb(++_0x30c5db);}(_0xef0f,0x168));var _0xfef0=function(_0x3475c4,_0x4f9f56){_0x3475c4=_0x3475c4-0x0;var _0x5c0069=_0xef0f[_0x3475c4];return _0x5c0069;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index cef0d9a..5cea411 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0295,0x1f0));var _0x5029=function(_0x1da5f4,_0x44bca7){_0x1da5f4=_0x1da5f4-0x0;var _0x58e944=_0x0295[_0x1da5f4];return _0x58e944;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0xe69888,_0x3a3bd1){var _0x3d9aff=function(_0x4f70ed){while(--_0x4f70ed){_0xe69888['push'](_0xe69888['shift']());}};_0x3d9aff(++_0x3a3bd1);}(_0xba34,0x119));var _0x4ba3=function(_0x9b67ca,_0x26b9b8){_0x9b67ca=_0x9b67ca-0x0;var _0x3ea09f=_0xba34[_0x9b67ca];return _0x3ea09f;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 23dbf31..c393e72 100644 --- a/server/api/integrationReport/integrationReport.attributes.js +++ b/server/api/integrationReport/integrationReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1292=['TEXT','ENUM','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0x1292,0x16c));var _0x2129=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x1292[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0x2129('0x0'));module[_0x2129('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2129('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x2129('0x2')]},'integrationId':{'type':Sequelize[_0x2129('0x3')]},'contacts':{'type':Sequelize[_0x2129('0x2')]},'uniqueid':{'type':Sequelize[_0x2129('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2129('0x2')]},'queue':{'type':Sequelize[_0x2129('0x2')]},'interface':{'type':Sequelize[_0x2129('0x2')]},'membername':{'type':Sequelize[_0x2129('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2129('0x4')]},'agentconnectAt':{'type':Sequelize[_0x2129('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2129('0x4')]},'talktime':{'type':Sequelize[_0x2129('0x3')]},'agentacw':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2129('0x3')]},'reason':{'type':Sequelize[_0x2129('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2129('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2129('0x4')]},'lastevent':{'type':Sequelize[_0x2129('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2129('0x3')]},'channelstatedesc':{'type':Sequelize[_0x2129('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2129('0x2')]},'accountcode':{'type':Sequelize[_0x2129('0x2')]},'context':{'type':Sequelize[_0x2129('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x2129('0x2')]},'destchannelstate':{'type':Sequelize[_0x2129('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x2129('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2129('0x2')]},'destcalleridname':{'type':Sequelize[_0x2129('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2129('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x2129('0x2')]},'destaccountcode':{'type':Sequelize[_0x2129('0x2')]},'destcontext':{'type':Sequelize[_0x2129('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2129('0x2')]},'destuniqueid':{'type':Sequelize[_0x2129('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x2129('0x2')]},'subject':{'type':Sequelize[_0x2129('0x2')]},'from':{'type':Sequelize[_0x2129('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2129('0x2')]},'attachment':{'type':Sequelize[_0x2129('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x2129('0x7')]('SENT','SENDING',_0x2129('0x8'),_0x2129('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x2129('0x3')]}}; \ No newline at end of file +var _0xdcbc=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','INTEGER'];(function(_0x5320f0,_0x3d0190){var _0xe494e4=function(_0x18dc2f){while(--_0x18dc2f){_0x5320f0['push'](_0x5320f0['shift']());}};_0xe494e4(++_0x3d0190);}(_0xdcbc,0x80));var _0xcdcb=function(_0x4500c8,_0x8a292a){_0x4500c8=_0x4500c8-0x0;var _0x47ca47=_0xdcbc[_0x4500c8];return _0x47ca47;};'use strict';var Sequelize=require(_0xcdcb('0x0'));module[_0xcdcb('0x1')]={'integration':{'type':Sequelize[_0xcdcb('0x2')]},'eventChannel':{'type':Sequelize[_0xcdcb('0x2')]},'exitStatus':{'type':Sequelize[_0xcdcb('0x2')]},'ticketId':{'type':Sequelize[_0xcdcb('0x2')]},'integrationId':{'type':Sequelize[_0xcdcb('0x3')]},'contacts':{'type':Sequelize[_0xcdcb('0x2')]},'uniqueid':{'type':Sequelize[_0xcdcb('0x2')]},'calleridnum':{'type':Sequelize[_0xcdcb('0x2')]},'calleridname':{'type':Sequelize[_0xcdcb('0x2')]},'queue':{'type':Sequelize[_0xcdcb('0x2')]},'interface':{'type':Sequelize[_0xcdcb('0x2')]},'membername':{'type':Sequelize[_0xcdcb('0x2')]},'agentcalledAt':{'type':Sequelize[_0xcdcb('0x4')]},'agentconnectAt':{'type':Sequelize[_0xcdcb('0x4')]},'holdtime':{'type':Sequelize[_0xcdcb('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xcdcb('0x4')]},'talktime':{'type':Sequelize[_0xcdcb('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xcdcb('0x3')]},'reason':{'type':Sequelize[_0xcdcb('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xcdcb('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xcdcb('0x4')]},'agentdump':{'type':Sequelize[_0xcdcb('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xcdcb('0x4')]},'lastevent':{'type':Sequelize[_0xcdcb('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xcdcb('0x2')]},'connectedlinenum':{'type':Sequelize[_0xcdcb('0x2')]},'connectedlinename':{'type':Sequelize[_0xcdcb('0x2')]},'language':{'type':Sequelize[_0xcdcb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xcdcb('0x2')]},'exten':{'type':Sequelize[_0xcdcb('0x2')]},'priority':{'type':Sequelize[_0xcdcb('0x2')]},'destchannel':{'type':Sequelize[_0xcdcb('0x2')]},'destchannelstate':{'type':Sequelize[_0xcdcb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xcdcb('0x2')]},'destcalleridnum':{'type':Sequelize[_0xcdcb('0x2')]},'destcalleridname':{'type':Sequelize[_0xcdcb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xcdcb('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xcdcb('0x2')]},'destcontext':{'type':Sequelize[_0xcdcb('0x2')]},'destexten':{'type':Sequelize[_0xcdcb('0x2')]},'destpriority':{'type':Sequelize[_0xcdcb('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xcdcb('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xcdcb('0x2')]},'to':{'type':Sequelize[_0xcdcb('0x2')]},'cc':{'type':Sequelize[_0xcdcb('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xcdcb('0x6')]},'status':{'type':Sequelize[_0xcdcb('0x7')](_0xcdcb('0x8'),_0xcdcb('0x9'),_0xcdcb('0xa'),'FAILED')},'url':{'type':Sequelize[_0xcdcb('0x2')]},'app':{'type':Sequelize[_0xcdcb('0x2')]},'appdata':{'type':Sequelize[_0xcdcb('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index fe0f223..08a1611 100644 --- a/server/api/integrationReport/integrationReport.controller.js +++ b/server/api/integrationReport/integrationReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba44=['attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','keys','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','end','error','name','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x86c6cb,_0x30bb53){var _0x1b1592=function(_0x19e1c9){while(--_0x19e1c9){_0x86c6cb['push'](_0x86c6cb['shift']());}};_0x1b1592(++_0x30bb53);}(_0xba44,0xb4));var _0x4ba4=function(_0x15ef66,_0x5cdaf9){_0x15ef66=_0x15ef66-0x0;var _0x5bd16b=_0xba44[_0x15ef66];return _0x5bd16b;};'use strict';var emlformat=require(_0x4ba4('0x0'));var rimraf=require(_0x4ba4('0x1'));var zipdir=require(_0x4ba4('0x2'));var jsonpatch=require(_0x4ba4('0x3'));var rp=require('request-promise');var moment=require(_0x4ba4('0x4'));var BPromise=require(_0x4ba4('0x5'));var Mustache=require('mustache');var util=require(_0x4ba4('0x6'));var path=require(_0x4ba4('0x7'));var sox=require(_0x4ba4('0x8'));var csv=require(_0x4ba4('0x9'));var ejs=require(_0x4ba4('0xa'));var fs=require('fs');var fs_extra=require(_0x4ba4('0xb'));var _=require(_0x4ba4('0xc'));var squel=require(_0x4ba4('0xd'));var crypto=require(_0x4ba4('0xe'));var jsforce=require(_0x4ba4('0xf'));var deskjs=require(_0x4ba4('0x10'));var toCsv=require(_0x4ba4('0x9'));var querystring=require(_0x4ba4('0x11'));var Papa=require(_0x4ba4('0x12'));var Redis=require(_0x4ba4('0x13'));var authService=require(_0x4ba4('0x14'));var qs=require(_0x4ba4('0x15'));var as=require(_0x4ba4('0x16'));var hardwareService=require(_0x4ba4('0x17'));var logger=require(_0x4ba4('0x18'))(_0x4ba4('0x19'));var utils=require(_0x4ba4('0x1a'));var config=require(_0x4ba4('0x1b'));var licenseUtil=require(_0x4ba4('0x1c'));var db=require(_0x4ba4('0x1d'))['db'];function respondWithStatusCode(_0x24e9f7,_0x144077){_0x144077=_0x144077||0xcc;return function(_0x13b74c){if(_0x13b74c){return _0x24e9f7[_0x4ba4('0x1e')](_0x144077);}return _0x24e9f7[_0x4ba4('0x1f')](_0x144077)['end']();};}function respondWithResult(_0x3b451c,_0x274824){_0x274824=_0x274824||0xc8;return function(_0x24703a){if(_0x24703a){return _0x3b451c[_0x4ba4('0x1f')](_0x274824)[_0x4ba4('0x20')](_0x24703a);}};}function respondWithFilteredResult(_0x30db32,_0x1df5e2){return function(_0x4275b2){if(_0x4275b2){var _0x38c215=typeof _0x1df5e2[_0x4ba4('0x21')]==='undefined'&&typeof _0x1df5e2[_0x4ba4('0x22')]==='undefined';var _0x2bac5b=_0x4275b2[_0x4ba4('0x23')];var _0x24bbcf=_0x38c215?0x0:_0x1df5e2['offset'];var _0x501068=_0x38c215?_0x4275b2[_0x4ba4('0x23')]:_0x1df5e2[_0x4ba4('0x21')]+_0x1df5e2[_0x4ba4('0x22')];var _0x175014;if(_0x501068>=_0x2bac5b){_0x501068=_0x2bac5b;_0x175014=0xc8;}else{_0x175014=0xce;}_0x30db32[_0x4ba4('0x1f')](_0x175014);return _0x30db32[_0x4ba4('0x24')](_0x4ba4('0x25'),_0x24bbcf+'-'+_0x501068+'/'+_0x2bac5b)[_0x4ba4('0x20')](_0x4275b2);}return null;};}function patchUpdates(_0x2e8c89){return function(_0xc68c78){try{jsonpatch['apply'](_0xc68c78,_0x2e8c89,!![]);}catch(_0x5d7889){return BPromise[_0x4ba4('0x26')](_0x5d7889);}return _0xc68c78[_0x4ba4('0x27')]();};}function saveUpdates(_0x278f57,_0x1f07df){return function(_0x35dd86){if(_0x35dd86){return _0x35dd86['update'](_0x278f57)[_0x4ba4('0x28')](function(_0x43bdb1){return _0x43bdb1;});}return null;};}function removeEntity(_0x540b1a,_0x384889){return function(_0x34e8c0){if(_0x34e8c0){return _0x34e8c0[_0x4ba4('0x29')]()[_0x4ba4('0x28')](function(){_0x540b1a[_0x4ba4('0x1f')](0xcc)[_0x4ba4('0x2a')]();});}};}function handleEntityNotFound(_0x28c608,_0xf1c891){return function(_0x2d7b10){if(!_0x2d7b10){_0x28c608[_0x4ba4('0x1e')](0x194);}return _0x2d7b10;};}function handleError(_0x2f6385,_0x28e9e2){_0x28e9e2=_0x28e9e2||0x1f4;return function(_0x4f17c1){logger[_0x4ba4('0x2b')](_0x4f17c1['stack']);if(_0x4f17c1[_0x4ba4('0x2c')]){delete _0x4f17c1[_0x4ba4('0x2c')];}_0x2f6385['status'](_0x28e9e2)['send'](_0x4f17c1);};}exports[_0x4ba4('0x2d')]=function(_0x2c2ee3,_0x39589d){var _0x382401={},_0x7f7756={},_0x205fb3={'count':0x0,'rows':[]};var _0x17438c=_[_0x4ba4('0x2e')](db[_0x4ba4('0x2f')][_0x4ba4('0x30')],function(_0x42a791){return{'name':_0x42a791[_0x4ba4('0x31')],'type':_0x42a791[_0x4ba4('0x32')][_0x4ba4('0x33')]};});_0x7f7756[_0x4ba4('0x34')]=_['map'](_0x17438c,_0x4ba4('0x2c'));_0x7f7756[_0x4ba4('0x35')]=_['keys'](_0x2c2ee3[_0x4ba4('0x35')]);_0x7f7756[_0x4ba4('0x36')]=_[_0x4ba4('0x37')](_0x7f7756[_0x4ba4('0x34')],_0x7f7756[_0x4ba4('0x35')]);_0x382401['attributes']=_[_0x4ba4('0x37')](_0x7f7756[_0x4ba4('0x34')],qs[_0x4ba4('0x38')](_0x2c2ee3[_0x4ba4('0x35')]['fields']));_0x382401[_0x4ba4('0x39')]=_0x382401[_0x4ba4('0x39')]['length']?_0x382401['attributes']:_0x7f7756[_0x4ba4('0x34')];if(!_0x2c2ee3['query'][_0x4ba4('0x3a')](_0x4ba4('0x3b'))){_0x382401['limit']=qs[_0x4ba4('0x22')](_0x2c2ee3[_0x4ba4('0x35')]['limit']);_0x382401[_0x4ba4('0x21')]=qs[_0x4ba4('0x21')](_0x2c2ee3[_0x4ba4('0x35')]['offset']);}_0x382401[_0x4ba4('0x3c')]=qs[_0x4ba4('0x3d')](_0x2c2ee3[_0x4ba4('0x35')]['sort']);_0x382401['where']=qs[_0x4ba4('0x36')](_['pick'](_0x2c2ee3[_0x4ba4('0x35')],_0x7f7756['filters']),_0x17438c);if(_0x2c2ee3['query'][_0x4ba4('0x3e')]){_0x382401[_0x4ba4('0x3f')]=_[_0x4ba4('0x40')](_0x382401[_0x4ba4('0x3f')],{'$or':_['map'](_0x17438c,function(_0x5658f9){if(_0x5658f9[_0x4ba4('0x32')]!==_0x4ba4('0x41')){var _0x324ccd={};_0x324ccd[_0x5658f9[_0x4ba4('0x2c')]]={'$like':'%'+_0x2c2ee3[_0x4ba4('0x35')][_0x4ba4('0x3e')]+'%'};return _0x324ccd;}})});}_0x382401=_[_0x4ba4('0x40')]({},_0x382401,_0x2c2ee3[_0x4ba4('0x42')]);var _0x5f55df={'where':_0x382401[_0x4ba4('0x3f')]};return db[_0x4ba4('0x2f')][_0x4ba4('0x23')](_0x5f55df)[_0x4ba4('0x28')](function(_0x19daae){_0x205fb3[_0x4ba4('0x23')]=_0x19daae;if(_0x2c2ee3[_0x4ba4('0x35')]['includeAll']){_0x382401[_0x4ba4('0x43')]=[{'all':!![]}];}return db[_0x4ba4('0x2f')]['findAll'](_0x382401);})['then'](function(_0x164d20){_0x205fb3[_0x4ba4('0x44')]=_0x164d20;return _0x205fb3;})[_0x4ba4('0x28')](respondWithFilteredResult(_0x39589d,_0x382401))[_0x4ba4('0x45')](handleError(_0x39589d,null));};exports[_0x4ba4('0x46')]=function(_0x7d0f5b,_0x4f0bf8){var _0x2a42a6={'raw':![],'where':{'id':_0x7d0f5b['params']['id']}},_0x343083={};_0x343083[_0x4ba4('0x34')]=_['keys'](db[_0x4ba4('0x2f')][_0x4ba4('0x30')]);_0x343083[_0x4ba4('0x35')]=_[_0x4ba4('0x47')](_0x7d0f5b[_0x4ba4('0x35')]);_0x343083[_0x4ba4('0x36')]=_['intersection'](_0x343083[_0x4ba4('0x34')],_0x343083[_0x4ba4('0x35')]);_0x2a42a6['attributes']=_[_0x4ba4('0x37')](_0x343083['model'],qs[_0x4ba4('0x38')](_0x7d0f5b[_0x4ba4('0x35')][_0x4ba4('0x38')]));_0x2a42a6[_0x4ba4('0x39')]=_0x2a42a6[_0x4ba4('0x39')][_0x4ba4('0x48')]?_0x2a42a6[_0x4ba4('0x39')]:_0x343083[_0x4ba4('0x34')];if(_0x7d0f5b['query']['includeAll']){_0x2a42a6[_0x4ba4('0x43')]=[{'all':!![]}];}_0x2a42a6=_['merge']({},_0x2a42a6,_0x7d0f5b[_0x4ba4('0x42')]);return db[_0x4ba4('0x2f')][_0x4ba4('0x49')](_0x2a42a6)[_0x4ba4('0x28')](handleEntityNotFound(_0x4f0bf8,null))[_0x4ba4('0x28')](respondWithResult(_0x4f0bf8,null))['catch'](handleError(_0x4f0bf8,null));};exports[_0x4ba4('0x4a')]=function(_0x329ea9,_0x44889f){return db[_0x4ba4('0x2f')]['create'](_0x329ea9[_0x4ba4('0x4b')],{})[_0x4ba4('0x28')](respondWithResult(_0x44889f,0xc9))['catch'](handleError(_0x44889f,null));};exports[_0x4ba4('0x4c')]=function(_0x5b5773,_0x5c58ca){if(_0x5b5773['body']['id']){delete _0x5b5773[_0x4ba4('0x4b')]['id'];}return db['IntegrationReport'][_0x4ba4('0x49')]({'where':{'id':_0x5b5773[_0x4ba4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c58ca,null))[_0x4ba4('0x28')](saveUpdates(_0x5b5773[_0x4ba4('0x4b')],null))['then'](respondWithResult(_0x5c58ca,null))[_0x4ba4('0x45')](handleError(_0x5c58ca,null));};exports[_0x4ba4('0x29')]=function(_0x1af9e3,_0x59b8a6){return db[_0x4ba4('0x2f')]['find']({'where':{'id':_0x1af9e3[_0x4ba4('0x4d')]['id']}})[_0x4ba4('0x28')](handleEntityNotFound(_0x59b8a6,null))[_0x4ba4('0x28')](removeEntity(_0x59b8a6,null))[_0x4ba4('0x45')](handleError(_0x59b8a6,null));};exports[_0x4ba4('0x4e')]=function(_0x281c9a,_0x44ab1b){return db['IntegrationReport'][_0x4ba4('0x4e')]()[_0x4ba4('0x28')](respondWithResult(_0x44ab1b,null))[_0x4ba4('0x45')](handleError(_0x44ab1b,null));}; \ No newline at end of file +var _0xc343=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','IntegrationReport','rows','show','params','options','find','catch','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xc343,0x6c));var _0x3c34=function(_0x133442,_0x2b4edc){_0x133442=_0x133442-0x0;var _0x32d037=_0xc343[_0x133442];return _0x32d037;};'use strict';var emlformat=require(_0x3c34('0x0'));var rimraf=require(_0x3c34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3c34('0x2'));var moment=require(_0x3c34('0x3'));var BPromise=require(_0x3c34('0x4'));var Mustache=require(_0x3c34('0x5'));var util=require(_0x3c34('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3c34('0x7'));var ejs=require(_0x3c34('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c34('0x9'));var squel=require(_0x3c34('0xa'));var crypto=require(_0x3c34('0xb'));var jsforce=require(_0x3c34('0xc'));var deskjs=require(_0x3c34('0xd'));var toCsv=require(_0x3c34('0x7'));var querystring=require(_0x3c34('0xe'));var Papa=require(_0x3c34('0xf'));var Redis=require(_0x3c34('0x10'));var authService=require(_0x3c34('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3c34('0x12'));var hardwareService=require(_0x3c34('0x13'));var logger=require(_0x3c34('0x14'))(_0x3c34('0x15'));var utils=require(_0x3c34('0x16'));var config=require(_0x3c34('0x17'));var licenseUtil=require(_0x3c34('0x18'));var db=require(_0x3c34('0x19'))['db'];function respondWithStatusCode(_0x311711,_0x2205f6){_0x2205f6=_0x2205f6||0xcc;return function(_0x14679f){if(_0x14679f){return _0x311711[_0x3c34('0x1a')](_0x2205f6);}return _0x311711[_0x3c34('0x1b')](_0x2205f6)[_0x3c34('0x1c')]();};}function respondWithResult(_0x5811c4,_0x4bebc0){_0x4bebc0=_0x4bebc0||0xc8;return function(_0x217d2c){if(_0x217d2c){return _0x5811c4['status'](_0x4bebc0)[_0x3c34('0x1d')](_0x217d2c);}};}function respondWithFilteredResult(_0x20b354,_0x3933b3){return function(_0x2b2c37){if(_0x2b2c37){var _0x57779d=typeof _0x3933b3[_0x3c34('0x1e')]===_0x3c34('0x1f')&&typeof _0x3933b3[_0x3c34('0x20')]==='undefined';var _0x273c14=_0x2b2c37[_0x3c34('0x21')];var _0x1ef1d9=_0x57779d?0x0:_0x3933b3['offset'];var _0x161c0d=_0x57779d?_0x2b2c37[_0x3c34('0x21')]:_0x3933b3[_0x3c34('0x1e')]+_0x3933b3[_0x3c34('0x20')];var _0x317422;if(_0x161c0d>=_0x273c14){_0x161c0d=_0x273c14;_0x317422=0xc8;}else{_0x317422=0xce;}_0x20b354[_0x3c34('0x1b')](_0x317422);return _0x20b354[_0x3c34('0x22')](_0x3c34('0x23'),_0x1ef1d9+'-'+_0x161c0d+'/'+_0x273c14)[_0x3c34('0x1d')](_0x2b2c37);}return null;};}function patchUpdates(_0x5dc0c6){return function(_0x28789a){try{jsonpatch[_0x3c34('0x24')](_0x28789a,_0x5dc0c6,!![]);}catch(_0x2b234e){return BPromise[_0x3c34('0x25')](_0x2b234e);}return _0x28789a[_0x3c34('0x26')]();};}function saveUpdates(_0x3f330e,_0x101a51){return function(_0x1b67f1){if(_0x1b67f1){return _0x1b67f1[_0x3c34('0x27')](_0x3f330e)['then'](function(_0x4dcb0e){return _0x4dcb0e;});}return null;};}function removeEntity(_0xcc477c,_0x4e8804){return function(_0x49e78a){if(_0x49e78a){return _0x49e78a['destroy']()[_0x3c34('0x28')](function(){_0xcc477c[_0x3c34('0x1b')](0xcc)[_0x3c34('0x1c')]();});}};}function handleEntityNotFound(_0x5ef960,_0x2245af){return function(_0x1905f4){if(!_0x1905f4){_0x5ef960['sendStatus'](0x194);}return _0x1905f4;};}function handleError(_0x51f18a,_0x3ca6f4){_0x3ca6f4=_0x3ca6f4||0x1f4;return function(_0x5d7ad9){logger['error'](_0x5d7ad9[_0x3c34('0x29')]);if(_0x5d7ad9['name']){delete _0x5d7ad9[_0x3c34('0x2a')];}_0x51f18a[_0x3c34('0x1b')](_0x3ca6f4)[_0x3c34('0x2b')](_0x5d7ad9);};}exports[_0x3c34('0x2c')]=function(_0xcb6654,_0x318de4){var _0x57c64a={},_0x4e71b3={},_0x371d60={'count':0x0,'rows':[]};var _0x33d950=_['map'](db['IntegrationReport'][_0x3c34('0x2d')],function(_0x128d86){return{'name':_0x128d86[_0x3c34('0x2e')],'type':_0x128d86[_0x3c34('0x2f')]['key']};});_0x4e71b3[_0x3c34('0x30')]=_[_0x3c34('0x31')](_0x33d950,_0x3c34('0x2a'));_0x4e71b3[_0x3c34('0x32')]=_[_0x3c34('0x33')](_0xcb6654['query']);_0x4e71b3[_0x3c34('0x34')]=_[_0x3c34('0x35')](_0x4e71b3[_0x3c34('0x30')],_0x4e71b3['query']);_0x57c64a[_0x3c34('0x36')]=_[_0x3c34('0x35')](_0x4e71b3[_0x3c34('0x30')],qs[_0x3c34('0x37')](_0xcb6654[_0x3c34('0x32')]['fields']));_0x57c64a['attributes']=_0x57c64a[_0x3c34('0x36')][_0x3c34('0x38')]?_0x57c64a[_0x3c34('0x36')]:_0x4e71b3[_0x3c34('0x30')];if(!_0xcb6654[_0x3c34('0x32')]['hasOwnProperty'](_0x3c34('0x39'))){_0x57c64a[_0x3c34('0x20')]=qs['limit'](_0xcb6654[_0x3c34('0x32')][_0x3c34('0x20')]);_0x57c64a['offset']=qs[_0x3c34('0x1e')](_0xcb6654['query'][_0x3c34('0x1e')]);}_0x57c64a[_0x3c34('0x3a')]=qs['sort'](_0xcb6654['query'][_0x3c34('0x3b')]);_0x57c64a[_0x3c34('0x3c')]=qs[_0x3c34('0x34')](_[_0x3c34('0x3d')](_0xcb6654[_0x3c34('0x32')],_0x4e71b3['filters']),_0x33d950);if(_0xcb6654['query'][_0x3c34('0x3e')]){_0x57c64a[_0x3c34('0x3c')]=_[_0x3c34('0x3f')](_0x57c64a[_0x3c34('0x3c')],{'$or':_[_0x3c34('0x31')](_0x33d950,function(_0x4a9b99){if(_0x4a9b99[_0x3c34('0x2f')]!=='VIRTUAL'){var _0x2b646c={};_0x2b646c[_0x4a9b99[_0x3c34('0x2a')]]={'$like':'%'+_0xcb6654[_0x3c34('0x32')]['filter']+'%'};return _0x2b646c;}})});}_0x57c64a=_[_0x3c34('0x3f')]({},_0x57c64a,_0xcb6654['options']);var _0x3b19e2={'where':_0x57c64a[_0x3c34('0x3c')]};return db['IntegrationReport'][_0x3c34('0x21')](_0x3b19e2)[_0x3c34('0x28')](function(_0x2e3850){_0x371d60[_0x3c34('0x21')]=_0x2e3850;if(_0xcb6654[_0x3c34('0x32')][_0x3c34('0x40')]){_0x57c64a[_0x3c34('0x41')]=[{'all':!![]}];}return db[_0x3c34('0x42')]['findAll'](_0x57c64a);})[_0x3c34('0x28')](function(_0x3cce73){_0x371d60[_0x3c34('0x43')]=_0x3cce73;return _0x371d60;})[_0x3c34('0x28')](respondWithFilteredResult(_0x318de4,_0x57c64a))['catch'](handleError(_0x318de4,null));};exports[_0x3c34('0x44')]=function(_0x196d4b,_0x145ab1){var _0x45e78a={'raw':![],'where':{'id':_0x196d4b[_0x3c34('0x45')]['id']}},_0x1b29d0={};_0x1b29d0[_0x3c34('0x30')]=_[_0x3c34('0x33')](db[_0x3c34('0x42')][_0x3c34('0x2d')]);_0x1b29d0[_0x3c34('0x32')]=_[_0x3c34('0x33')](_0x196d4b['query']);_0x1b29d0[_0x3c34('0x34')]=_[_0x3c34('0x35')](_0x1b29d0[_0x3c34('0x30')],_0x1b29d0[_0x3c34('0x32')]);_0x45e78a[_0x3c34('0x36')]=_[_0x3c34('0x35')](_0x1b29d0[_0x3c34('0x30')],qs[_0x3c34('0x37')](_0x196d4b['query'][_0x3c34('0x37')]));_0x45e78a[_0x3c34('0x36')]=_0x45e78a['attributes'][_0x3c34('0x38')]?_0x45e78a['attributes']:_0x1b29d0[_0x3c34('0x30')];if(_0x196d4b[_0x3c34('0x32')][_0x3c34('0x40')]){_0x45e78a['include']=[{'all':!![]}];}_0x45e78a=_[_0x3c34('0x3f')]({},_0x45e78a,_0x196d4b[_0x3c34('0x46')]);return db[_0x3c34('0x42')][_0x3c34('0x47')](_0x45e78a)['then'](handleEntityNotFound(_0x145ab1,null))[_0x3c34('0x28')](respondWithResult(_0x145ab1,null))[_0x3c34('0x48')](handleError(_0x145ab1,null));};exports[_0x3c34('0x49')]=function(_0x427233,_0x16fa00){return db[_0x3c34('0x42')][_0x3c34('0x49')](_0x427233[_0x3c34('0x4a')],{})[_0x3c34('0x28')](respondWithResult(_0x16fa00,0xc9))[_0x3c34('0x48')](handleError(_0x16fa00,null));};exports[_0x3c34('0x27')]=function(_0x194b7d,_0x2e9e49){if(_0x194b7d[_0x3c34('0x4a')]['id']){delete _0x194b7d[_0x3c34('0x4a')]['id'];}return db['IntegrationReport'][_0x3c34('0x47')]({'where':{'id':_0x194b7d[_0x3c34('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e9e49,null))['then'](saveUpdates(_0x194b7d['body'],null))['then'](respondWithResult(_0x2e9e49,null))[_0x3c34('0x48')](handleError(_0x2e9e49,null));};exports[_0x3c34('0x4b')]=function(_0x534e72,_0x23af77){return db[_0x3c34('0x42')][_0x3c34('0x47')]({'where':{'id':_0x534e72['params']['id']}})['then'](handleEntityNotFound(_0x23af77,null))[_0x3c34('0x28')](removeEntity(_0x23af77,null))[_0x3c34('0x48')](handleError(_0x23af77,null));};exports['describe']=function(_0xd10f9a,_0x5458bc){return db['IntegrationReport'][_0x3c34('0x4c')]()[_0x3c34('0x28')](respondWithResult(_0x5458bc,null))['catch'](handleError(_0x5458bc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2baa296..6d5e9e3 100644 --- a/server/api/integrationReport/integrationReport.model.js +++ b/server/api/integrationReport/integrationReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5943=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0x5af949,_0x1829db){var _0x4eecb8=function(_0x55e642){while(--_0x55e642){_0x5af949['push'](_0x5af949['shift']());}};_0x4eecb8(++_0x1829db);}(_0x5943,0x16c));var _0x3594=function(_0xbd18a3,_0x1baf74){_0xbd18a3=_0xbd18a3-0x0;var _0x16207e=_0x5943[_0xbd18a3];return _0x16207e;};'use strict';var _=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var logger=require(_0x3594('0x2'))(_0x3594('0x3'));var moment=require(_0x3594('0x4'));var BPromise=require(_0x3594('0x5'));var rp=require(_0x3594('0x6'));var fs=require('fs');var path=require(_0x3594('0x7'));var rimraf=require(_0x3594('0x8'));var config=require(_0x3594('0x9'));var attributes=require(_0x3594('0xa'));module[_0x3594('0xb')]=function(_0x4fdd40,_0xf3b897){return _0x4fdd40[_0x3594('0xc')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe524=['api','moment','bluebird','rimraf','../../config/environment','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger'];(function(_0x40c842,_0x3f06ae){var _0x2b146d=function(_0x4ed15b){while(--_0x4ed15b){_0x40c842['push'](_0x40c842['shift']());}};_0x2b146d(++_0x3f06ae);}(_0xe524,0x189));var _0x4e52=function(_0x1f9a74,_0x47dace){_0x1f9a74=_0x1f9a74-0x0;var _0xef9dc8=_0xe524[_0x1f9a74];return _0xef9dc8;};'use strict';var _=require(_0x4e52('0x0'));var util=require(_0x4e52('0x1'));var logger=require(_0x4e52('0x2'))(_0x4e52('0x3'));var moment=require(_0x4e52('0x4'));var BPromise=require(_0x4e52('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e52('0x6'));var config=require(_0x4e52('0x7'));var attributes=require(_0x4e52('0x8'));module[_0x4e52('0x9')]=function(_0x9edebf,_0x55dbb4){return _0x9edebf[_0x4e52('0xa')]('IntegrationReport',attributes,{'tableName':_0x4e52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 29f7e3c..f430ab0 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x687b,0x14a));var _0xb687=function(_0x480957,_0x2632b7){_0x480957=_0x480957-0x0;var _0x5101d3=_0x687b[_0x480957];return _0x5101d3;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x5fab,0x177));var _0xb5fa=function(_0x216e58,_0x497adc){_0x216e58=_0x216e58-0x0;var _0x5adcad=_0x5fab[_0x216e58];return _0x5adcad;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 966ffa9..827718d 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x848e=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete'];(function(_0x221493,_0x522e03){var _0x359a1b=function(_0x485b74){while(--_0x485b74){_0x221493['push'](_0x221493['shift']());}};_0x359a1b(++_0x522e03);}(_0x848e,0x1e2));var _0xe848=function(_0x542b23,_0x5c7613){_0x542b23=_0x542b23-0x0;var _0x148946=_0x848e[_0x542b23];return _0x148946;};'use strict';var multer=require(_0xe848('0x0'));var util=require('util');var path=require(_0xe848('0x1'));var timeout=require(_0xe848('0x2'));var express=require('express');var router=express[_0xe848('0x3')]();var fs_extra=require(_0xe848('0x4'));var auth=require(_0xe848('0x5'));var interaction=require(_0xe848('0x6'));var config=require(_0xe848('0x7'));var controller=require(_0xe848('0x8'));router[_0xe848('0x9')]('/',auth[_0xe848('0xa')](),controller['index']);router[_0xe848('0x9')](_0xe848('0xb'),auth[_0xe848('0xa')](),controller['show']);router['get'](_0xe848('0xc'),auth[_0xe848('0xa')](),controller[_0xe848('0xd')]);router[_0xe848('0xe')]('/',auth['isAuthenticated'](),controller[_0xe848('0xf')]);router[_0xe848('0xe')]('/:id/sub_intervals',auth[_0xe848('0xa')](),controller[_0xe848('0x10')]);router[_0xe848('0xe')](_0xe848('0x11'),auth[_0xe848('0xa')](),controller[_0xe848('0x12')]);router[_0xe848('0x13')](_0xe848('0xb'),auth['isAuthenticated'](),controller[_0xe848('0x14')]);router[_0xe848('0x15')](_0xe848('0xb'),auth[_0xe848('0xa')](),controller[_0xe848('0x16')]);module[_0xe848('0x17')]=router; \ No newline at end of file +var _0x0d91=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','destroy','exports','multer','util'];(function(_0x2dad7,_0x4b72e9){var _0x5945e6=function(_0x593df7){while(--_0x593df7){_0x2dad7['push'](_0x2dad7['shift']());}};_0x5945e6(++_0x4b72e9);}(_0x0d91,0x76));var _0x10d9=function(_0x5e0d3c,_0x531c47){_0x5e0d3c=_0x5e0d3c-0x0;var _0x19a397=_0x0d91[_0x5e0d3c];return _0x19a397;};'use strict';var multer=require(_0x10d9('0x0'));var util=require(_0x10d9('0x1'));var path=require(_0x10d9('0x2'));var timeout=require(_0x10d9('0x3'));var express=require('express');var router=express[_0x10d9('0x4')]();var fs_extra=require(_0x10d9('0x5'));var auth=require(_0x10d9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x10d9('0x7'));var controller=require(_0x10d9('0x8'));router[_0x10d9('0x9')]('/',auth['isAuthenticated'](),controller[_0x10d9('0xa')]);router[_0x10d9('0x9')](_0x10d9('0xb'),auth[_0x10d9('0xc')](),controller[_0x10d9('0xd')]);router[_0x10d9('0x9')](_0x10d9('0xe'),auth[_0x10d9('0xc')](),controller[_0x10d9('0xf')]);router[_0x10d9('0x10')]('/',auth[_0x10d9('0xc')](),controller[_0x10d9('0x11')]);router[_0x10d9('0x10')](_0x10d9('0xe'),auth[_0x10d9('0xc')](),controller[_0x10d9('0x12')]);router[_0x10d9('0x10')]('/:id/sub_intervals/create_many',auth[_0x10d9('0xc')](),controller[_0x10d9('0x13')]);router[_0x10d9('0x14')](_0x10d9('0xb'),auth[_0x10d9('0xc')](),controller['update']);router[_0x10d9('0x15')]('/:id',auth[_0x10d9('0xc')](),controller[_0x10d9('0x16')]);module[_0x10d9('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 1f4a1ee..60eda08 100644 --- a/server/api/interval/interval.attributes.js +++ b/server/api/interval/interval.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dca=['STRING','sequelize','exports'];(function(_0x2aaa12,_0x2c36df){var _0xeb48ff=function(_0x3a2640){while(--_0x3a2640){_0x2aaa12['push'](_0x2aaa12['shift']());}};_0xeb48ff(++_0x2c36df);}(_0x9dca,0x17e));var _0xa9dc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9dca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa9dc('0x0'));module[_0xa9dc('0x1')]={'name':{'type':Sequelize[_0xa9dc('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa9dc('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x8404=['STRING','sequelize','exports'];(function(_0x1d14a4,_0x3d0375){var _0x5cae92=function(_0x332f16){while(--_0x332f16){_0x1d14a4['push'](_0x1d14a4['shift']());}};_0x5cae92(++_0x3d0375);}(_0x8404,0x184));var _0x4840=function(_0x11e7a6,_0x3927a1){_0x11e7a6=_0x11e7a6-0x0;var _0x108376=_0x8404[_0x11e7a6];return _0x108376;};'use strict';var Sequelize=require(_0x4840('0x0'));module[_0x4840('0x1')]={'name':{'type':Sequelize[_0x4840('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4840('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7398b14..fe3891e 100644 --- a/server/api/interval/interval.controller.js +++ b/server/api/interval/interval.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc43=['IntervalId','getIntervals','findOne','pick','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','error','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','catch','params','find','create','body','user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','destroy','addInterval'];(function(_0x3eb9d6,_0x1995b8){var _0x1329eb=function(_0x2d3287){while(--_0x2d3287){_0x3eb9d6['push'](_0x3eb9d6['shift']());}};_0x1329eb(++_0x1995b8);}(_0xcc43,0x16a));var _0x3cc4=function(_0x517a2d,_0x21e839){_0x517a2d=_0x517a2d-0x0;var _0x42498c=_0xcc43[_0x517a2d];return _0x42498c;};'use strict';var emlformat=require(_0x3cc4('0x0'));var rimraf=require(_0x3cc4('0x1'));var zipdir=require(_0x3cc4('0x2'));var jsonpatch=require(_0x3cc4('0x3'));var rp=require(_0x3cc4('0x4'));var moment=require(_0x3cc4('0x5'));var BPromise=require(_0x3cc4('0x6'));var Mustache=require(_0x3cc4('0x7'));var util=require(_0x3cc4('0x8'));var path=require(_0x3cc4('0x9'));var sox=require(_0x3cc4('0xa'));var csv=require(_0x3cc4('0xb'));var ejs=require(_0x3cc4('0xc'));var fs=require('fs');var fs_extra=require(_0x3cc4('0xd'));var _=require(_0x3cc4('0xe'));var squel=require(_0x3cc4('0xf'));var crypto=require('crypto');var jsforce=require(_0x3cc4('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3cc4('0x11'));var Papa=require(_0x3cc4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3cc4('0x13'));var as=require(_0x3cc4('0x14'));var hardwareService=require(_0x3cc4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x3cc4('0x16'));var config=require(_0x3cc4('0x17'));var licenseUtil=require(_0x3cc4('0x18'));var db=require(_0x3cc4('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2a942c,_0x3708c5){_0x3708c5=_0x3708c5||0xcc;return function(_0x11c230){if(_0x11c230){return _0x2a942c[_0x3cc4('0x1a')](_0x3708c5);}return _0x2a942c[_0x3cc4('0x1b')](_0x3708c5)[_0x3cc4('0x1c')]();};}function respondWithResult(_0x32bd57,_0x34b9db){_0x34b9db=_0x34b9db||0xc8;return function(_0x369543){if(_0x369543){return _0x32bd57[_0x3cc4('0x1b')](_0x34b9db)['json'](_0x369543);}};}function respondWithFilteredResult(_0x1f24ca,_0x16e0f5){return function(_0x23ce97){if(_0x23ce97){var _0xed928=typeof _0x16e0f5[_0x3cc4('0x1d')]==='undefined'&&typeof _0x16e0f5['limit']===_0x3cc4('0x1e');var _0x12b247=_0x23ce97[_0x3cc4('0x1f')];var _0x40aa01=_0xed928?0x0:_0x16e0f5[_0x3cc4('0x1d')];var _0x3cfba2=_0xed928?_0x23ce97[_0x3cc4('0x1f')]:_0x16e0f5[_0x3cc4('0x1d')]+_0x16e0f5[_0x3cc4('0x20')];var _0x13cae4;if(_0x3cfba2>=_0x12b247){_0x3cfba2=_0x12b247;_0x13cae4=0xc8;}else{_0x13cae4=0xce;}_0x1f24ca[_0x3cc4('0x1b')](_0x13cae4);return _0x1f24ca['set'](_0x3cc4('0x21'),_0x40aa01+'-'+_0x3cfba2+'/'+_0x12b247)[_0x3cc4('0x22')](_0x23ce97);}return null;};}function patchUpdates(_0xdedc6e){return function(_0x10a729){try{jsonpatch[_0x3cc4('0x23')](_0x10a729,_0xdedc6e,!![]);}catch(_0x5a6148){return BPromise[_0x3cc4('0x24')](_0x5a6148);}return _0x10a729[_0x3cc4('0x25')]();};}function saveUpdates(_0x2c9456,_0x52c868){return function(_0x30b67c){if(_0x30b67c){return _0x30b67c[_0x3cc4('0x26')](_0x2c9456)[_0x3cc4('0x27')](function(_0x36f699){return _0x36f699;});}return null;};}function removeEntity(_0x38f4fd,_0x1cd39a){return function(_0x364c9b){if(_0x364c9b){return _0x364c9b['destroy']()['then'](function(){var _0x558e37=_0x364c9b[_0x3cc4('0x28')]({'plain':!![]});var _0x211861='Intervals';return db[_0x3cc4('0x29')]['destroy']({'where':{'type':_0x211861,'resourceId':_0x558e37['id']}})['then'](function(){return _0x364c9b;});})[_0x3cc4('0x27')](function(){_0x38f4fd[_0x3cc4('0x1b')](0xcc)[_0x3cc4('0x1c')]();});}};}function handleEntityNotFound(_0x16d6b4,_0x26a8e0){return function(_0x16fbfc){if(!_0x16fbfc){_0x16d6b4['sendStatus'](0x194);}return _0x16fbfc;};}function handleError(_0x24af94,_0x47111d){_0x47111d=_0x47111d||0x1f4;return function(_0x4da71f){logger[_0x3cc4('0x2a')](_0x4da71f['stack']);if(_0x4da71f[_0x3cc4('0x2b')]){delete _0x4da71f[_0x3cc4('0x2b')];}_0x24af94[_0x3cc4('0x1b')](_0x47111d)['send'](_0x4da71f);};}exports[_0x3cc4('0x2c')]=function(_0x220acb,_0x3fd21d){var _0x24ca02={},_0x141635={},_0x43e3c0={'count':0x0,'rows':[]};var _0x191eab=_[_0x3cc4('0x2d')](db[_0x3cc4('0x2e')][_0x3cc4('0x2f')],function(_0x180ff3){return{'name':_0x180ff3[_0x3cc4('0x30')],'type':_0x180ff3[_0x3cc4('0x31')][_0x3cc4('0x32')]};});_0x141635[_0x3cc4('0x33')]=_[_0x3cc4('0x2d')](_0x191eab,_0x3cc4('0x2b'));_0x141635[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0x220acb[_0x3cc4('0x34')]);_0x141635['filters']=_[_0x3cc4('0x36')](_0x141635['model'],_0x141635[_0x3cc4('0x34')]);_0x24ca02[_0x3cc4('0x37')]=_[_0x3cc4('0x36')](_0x141635[_0x3cc4('0x33')],qs[_0x3cc4('0x38')](_0x220acb['query']['fields']));_0x24ca02[_0x3cc4('0x37')]=_0x24ca02['attributes'][_0x3cc4('0x39')]?_0x24ca02[_0x3cc4('0x37')]:_0x141635[_0x3cc4('0x33')];if(!_0x220acb['query'][_0x3cc4('0x3a')](_0x3cc4('0x3b'))){_0x24ca02[_0x3cc4('0x20')]=qs[_0x3cc4('0x20')](_0x220acb['query'][_0x3cc4('0x20')]);_0x24ca02[_0x3cc4('0x1d')]=qs[_0x3cc4('0x1d')](_0x220acb[_0x3cc4('0x34')][_0x3cc4('0x1d')]);}_0x24ca02[_0x3cc4('0x3c')]=qs['sort'](_0x220acb[_0x3cc4('0x34')][_0x3cc4('0x3d')]);_0x24ca02[_0x3cc4('0x3e')]=qs[_0x3cc4('0x3f')](_['pick'](_0x220acb[_0x3cc4('0x34')],_0x141635[_0x3cc4('0x3f')]),_0x191eab);if(_0x220acb[_0x3cc4('0x34')]['filter']){_0x24ca02[_0x3cc4('0x3e')]=_[_0x3cc4('0x40')](_0x24ca02[_0x3cc4('0x3e')],{'$or':_[_0x3cc4('0x2d')](_0x191eab,function(_0x57136b){if(_0x57136b['type']!=='VIRTUAL'){var _0xa7c750={};_0xa7c750[_0x57136b[_0x3cc4('0x2b')]]={'$like':'%'+_0x220acb['query'][_0x3cc4('0x41')]+'%'};return _0xa7c750;}})});}_0x24ca02=_['merge']({},_0x24ca02,_0x220acb[_0x3cc4('0x42')]);var _0x3612c1={'where':_0x24ca02[_0x3cc4('0x3e')]};return db[_0x3cc4('0x2e')]['count'](_0x3612c1)[_0x3cc4('0x27')](function(_0x3ade4e){_0x43e3c0[_0x3cc4('0x1f')]=_0x3ade4e;if(_0x220acb['query'][_0x3cc4('0x43')]){_0x24ca02[_0x3cc4('0x44')]=[{'all':!![]}];}return db[_0x3cc4('0x2e')][_0x3cc4('0x45')](_0x24ca02);})[_0x3cc4('0x27')](function(_0x506e91){_0x43e3c0['rows']=_0x506e91;return _0x43e3c0;})[_0x3cc4('0x27')](respondWithFilteredResult(_0x3fd21d,_0x24ca02))[_0x3cc4('0x46')](handleError(_0x3fd21d,null));};exports['show']=function(_0xcfecd3,_0x1e0780){var _0x128e18={'raw':!![],'where':{'id':_0xcfecd3[_0x3cc4('0x47')]['id']}},_0x2246b8={};_0x2246b8[_0x3cc4('0x33')]=_['keys'](db[_0x3cc4('0x2e')]['rawAttributes']);_0x2246b8[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0xcfecd3[_0x3cc4('0x34')]);_0x2246b8[_0x3cc4('0x3f')]=_['intersection'](_0x2246b8[_0x3cc4('0x33')],_0x2246b8[_0x3cc4('0x34')]);_0x128e18['attributes']=_[_0x3cc4('0x36')](_0x2246b8[_0x3cc4('0x33')],qs['fields'](_0xcfecd3[_0x3cc4('0x34')][_0x3cc4('0x38')]));_0x128e18[_0x3cc4('0x37')]=_0x128e18[_0x3cc4('0x37')][_0x3cc4('0x39')]?_0x128e18[_0x3cc4('0x37')]:_0x2246b8[_0x3cc4('0x33')];if(_0xcfecd3[_0x3cc4('0x34')]['includeAll']){_0x128e18[_0x3cc4('0x44')]=[{'all':!![]}];}_0x128e18=_[_0x3cc4('0x40')]({},_0x128e18,_0xcfecd3[_0x3cc4('0x42')]);return db[_0x3cc4('0x2e')][_0x3cc4('0x48')](_0x128e18)[_0x3cc4('0x27')](handleEntityNotFound(_0x1e0780,null))[_0x3cc4('0x27')](respondWithResult(_0x1e0780,null))[_0x3cc4('0x46')](handleError(_0x1e0780,null));};exports['create']=function(_0x464bbb,_0xa89b45){return db[_0x3cc4('0x2e')][_0x3cc4('0x49')](_0x464bbb[_0x3cc4('0x4a')],{})[_0x3cc4('0x27')](function(_0x5163ce){var _0x3f7058=_0x464bbb[_0x3cc4('0x4b')][_0x3cc4('0x28')]({'plain':!![]});if(!_0x3f7058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f7058[_0x3cc4('0x4c')]===_0x3cc4('0x4b')){var _0x5d4f9d=_0x5163ce[_0x3cc4('0x28')]({'plain':!![]});var _0x4e743e=_0x3cc4('0x4d');return db[_0x3cc4('0x4e')]['find']({'where':{'name':_0x4e743e,'userProfileId':_0x3f7058[_0x3cc4('0x4f')]},'raw':!![]})[_0x3cc4('0x27')](function(_0x21b1c2){if(_0x21b1c2&&_0x21b1c2[_0x3cc4('0x50')]===0x0){return db[_0x3cc4('0x29')][_0x3cc4('0x49')]({'name':_0x5d4f9d['name'],'resourceId':_0x5d4f9d['id'],'type':_0x21b1c2[_0x3cc4('0x2b')],'sectionId':_0x21b1c2['id']},{})[_0x3cc4('0x27')](function(){return _0x5163ce;});}else{return _0x5163ce;}})[_0x3cc4('0x46')](function(_0x5660e8){logger[_0x3cc4('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5660e8);throw _0x5660e8;});}return _0x5163ce;})[_0x3cc4('0x27')](respondWithResult(_0xa89b45,0xc9))[_0x3cc4('0x46')](handleError(_0xa89b45,null));};exports['update']=function(_0x445848,_0x31e2fd){if(_0x445848['body']['id']){delete _0x445848[_0x3cc4('0x4a')]['id'];}return db['Interval'][_0x3cc4('0x48')]({'where':{'id':_0x445848[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x31e2fd,null))['then'](saveUpdates(_0x445848[_0x3cc4('0x4a')],null))[_0x3cc4('0x27')](respondWithResult(_0x31e2fd,null))[_0x3cc4('0x46')](handleError(_0x31e2fd,null));};exports[_0x3cc4('0x51')]=function(_0x20f7db,_0x68bcb6){return db['Interval'][_0x3cc4('0x48')]({'where':{'id':_0x20f7db['params']['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x68bcb6,null))[_0x3cc4('0x27')](removeEntity(_0x68bcb6,null))[_0x3cc4('0x46')](handleError(_0x68bcb6,null));};exports[_0x3cc4('0x52')]=function(_0x6c08ac,_0x678ce3,_0x3bff60){if(_0x6c08ac['body']['id']){delete _0x6c08ac[_0x3cc4('0x4a')]['id'];}return db[_0x3cc4('0x2e')][_0x3cc4('0x48')]({'where':{'id':_0x6c08ac[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x678ce3,null))['then'](function(_0x30ab97){if(_0x30ab97){_0x6c08ac[_0x3cc4('0x4a')][_0x3cc4('0x53')]=_0x30ab97['id'];return db[_0x3cc4('0x2e')]['create'](_0x6c08ac[_0x3cc4('0x4a')]);}})[_0x3cc4('0x27')](respondWithResult(_0x678ce3,null))[_0x3cc4('0x46')](handleError(_0x678ce3,null));};exports[_0x3cc4('0x54')]=function(_0x568745,_0x3c83c7,_0x548290){var _0x107263={};var _0x287818={};var _0x5e60a0;var _0x5daaf2;return db['Interval'][_0x3cc4('0x55')]({'where':{'id':_0x568745[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x3c83c7,null))[_0x3cc4('0x27')](function(_0x4bff00){if(_0x4bff00){_0x5e60a0=_0x4bff00;_0x287818[_0x3cc4('0x33')]=_[_0x3cc4('0x35')](db[_0x3cc4('0x2e')][_0x3cc4('0x2f')]);_0x287818[_0x3cc4('0x34')]=_[_0x3cc4('0x35')](_0x568745[_0x3cc4('0x34')]);_0x287818['filters']=_[_0x3cc4('0x36')](_0x287818['model'],_0x287818[_0x3cc4('0x34')]);_0x107263[_0x3cc4('0x37')]=_[_0x3cc4('0x36')](_0x287818[_0x3cc4('0x33')],qs[_0x3cc4('0x38')](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x38')]));_0x107263['attributes']=_0x107263[_0x3cc4('0x37')][_0x3cc4('0x39')]?_0x107263[_0x3cc4('0x37')]:_0x287818['model'];_0x107263[_0x3cc4('0x3c')]=qs[_0x3cc4('0x3d')](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x3d')]);_0x107263['where']=qs[_0x3cc4('0x3f')](_[_0x3cc4('0x56')](_0x568745[_0x3cc4('0x34')],_0x287818['filters']));if(_0x568745[_0x3cc4('0x34')][_0x3cc4('0x41')]){_0x107263[_0x3cc4('0x3e')]=_[_0x3cc4('0x40')](_0x107263['where'],{'$or':_[_0x3cc4('0x2d')](_0x107263[_0x3cc4('0x37')],function(_0x125363){var _0x1fe824={};_0x1fe824[_0x125363]={'$like':'%'+_0x568745[_0x3cc4('0x34')][_0x3cc4('0x41')]+'%'};return _0x1fe824;})});}_0x107263=_[_0x3cc4('0x40')]({},_0x107263,_0x568745[_0x3cc4('0x42')]);return _0x5e60a0[_0x3cc4('0x54')](_0x107263);}})[_0x3cc4('0x27')](function(_0x4f1db4){if(_0x4f1db4){_0x5daaf2=_0x4f1db4[_0x3cc4('0x39')];if(!_0x568745[_0x3cc4('0x34')][_0x3cc4('0x3a')](_0x3cc4('0x3b'))){_0x107263[_0x3cc4('0x20')]=qs[_0x3cc4('0x20')](_0x568745['query']['limit']);_0x107263[_0x3cc4('0x1d')]=qs['offset'](_0x568745[_0x3cc4('0x34')][_0x3cc4('0x1d')]);}return _0x5e60a0[_0x3cc4('0x54')](_0x107263);}})[_0x3cc4('0x27')](function(_0x378828){if(_0x378828){return _0x378828?{'count':_0x5daaf2,'rows':_0x378828}:null;}})['then'](respondWithResult(_0x3c83c7,null))['catch'](handleError(_0x3c83c7,null));};exports[_0x3cc4('0x57')]=function(_0x201d1d,_0x3b0388,_0x37b9f1){return db[_0x3cc4('0x2e')][_0x3cc4('0x55')]({'where':{'id':_0x201d1d[_0x3cc4('0x47')]['id']}})[_0x3cc4('0x27')](handleEntityNotFound(_0x3b0388,null))[_0x3cc4('0x27')](function(_0x4a14f8){if(_0x4a14f8){return db['sequelize'][_0x3cc4('0x58')](function(_0x2d6e5f){return db[_0x3cc4('0x2e')][_0x3cc4('0x51')]({'where':{'IntervalId':_0x201d1d[_0x3cc4('0x47')]['id']},'transaction':_0x2d6e5f})[_0x3cc4('0x27')](function(_0x756fa7){var _0x5146e8=_['map'](_0x201d1d[_0x3cc4('0x4a')],function(_0x90730a){delete _0x90730a['id'];_0x90730a[_0x3cc4('0x53')]=_0x201d1d['params']['id'];return _0x90730a;});return db[_0x3cc4('0x2e')]['bulkCreate'](_0x5146e8,{'transaction':_0x2d6e5f});});})[_0x3cc4('0x27')](function(){return db[_0x3cc4('0x2e')][_0x3cc4('0x45')]({'where':{'IntervalId':_0x201d1d[_0x3cc4('0x47')]['id']}});});}})[_0x3cc4('0x27')](respondWithResult(_0x3b0388,null))[_0x3cc4('0x46')](handleError(_0x3b0388,null));}; \ No newline at end of file +var _0xe4ff=['update','body','getIntervals','findOne','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','Intervals','UserProfileResource','destroy','error','stack','name','send','map','Interval','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0xc48539,_0x4f5a61){var _0x17314a=function(_0x1c1832){while(--_0x1c1832){_0xc48539['push'](_0xc48539['shift']());}};_0x17314a(++_0x4f5a61);}(_0xe4ff,0x65));var _0xfe4f=function(_0x535596,_0x15c174){_0x535596=_0x535596-0x0;var _0x5751dd=_0xe4ff[_0x535596];return _0x5751dd;};'use strict';var emlformat=require(_0xfe4f('0x0'));var rimraf=require(_0xfe4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe4f('0x2'));var rp=require(_0xfe4f('0x3'));var moment=require('moment');var BPromise=require(_0xfe4f('0x4'));var Mustache=require(_0xfe4f('0x5'));var util=require(_0xfe4f('0x6'));var path=require(_0xfe4f('0x7'));var sox=require(_0xfe4f('0x8'));var csv=require(_0xfe4f('0x9'));var ejs=require(_0xfe4f('0xa'));var fs=require('fs');var fs_extra=require(_0xfe4f('0xb'));var _=require(_0xfe4f('0xc'));var squel=require(_0xfe4f('0xd'));var crypto=require(_0xfe4f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe4f('0x9'));var querystring=require('querystring');var Papa=require(_0xfe4f('0xf'));var Redis=require(_0xfe4f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfe4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe4f('0x12'));var logger=require(_0xfe4f('0x13'))('api');var utils=require(_0xfe4f('0x14'));var config=require(_0xfe4f('0x15'));var licenseUtil=require(_0xfe4f('0x16'));var db=require(_0xfe4f('0x17'))['db'];var extensions=require(_0xfe4f('0x18'));function respondWithStatusCode(_0x5ddd6b,_0x3b0431){_0x3b0431=_0x3b0431||0xcc;return function(_0x55dba5){if(_0x55dba5){return _0x5ddd6b[_0xfe4f('0x19')](_0x3b0431);}return _0x5ddd6b[_0xfe4f('0x1a')](_0x3b0431)[_0xfe4f('0x1b')]();};}function respondWithResult(_0x55a9ea,_0x97672a){_0x97672a=_0x97672a||0xc8;return function(_0x5a4c01){if(_0x5a4c01){return _0x55a9ea[_0xfe4f('0x1a')](_0x97672a)['json'](_0x5a4c01);}};}function respondWithFilteredResult(_0x12fe6c,_0x169957){return function(_0x82fd42){if(_0x82fd42){var _0x388552=typeof _0x169957[_0xfe4f('0x1c')]===_0xfe4f('0x1d')&&typeof _0x169957[_0xfe4f('0x1e')]===_0xfe4f('0x1d');var _0x7c32e5=_0x82fd42[_0xfe4f('0x1f')];var _0x1e333b=_0x388552?0x0:_0x169957[_0xfe4f('0x1c')];var _0x7fd02d=_0x388552?_0x82fd42[_0xfe4f('0x1f')]:_0x169957[_0xfe4f('0x1c')]+_0x169957[_0xfe4f('0x1e')];var _0x357e4d;if(_0x7fd02d>=_0x7c32e5){_0x7fd02d=_0x7c32e5;_0x357e4d=0xc8;}else{_0x357e4d=0xce;}_0x12fe6c[_0xfe4f('0x1a')](_0x357e4d);return _0x12fe6c[_0xfe4f('0x20')](_0xfe4f('0x21'),_0x1e333b+'-'+_0x7fd02d+'/'+_0x7c32e5)['json'](_0x82fd42);}return null;};}function patchUpdates(_0x5f5cbb){return function(_0x1b61c9){try{jsonpatch[_0xfe4f('0x22')](_0x1b61c9,_0x5f5cbb,!![]);}catch(_0x39771b){return BPromise[_0xfe4f('0x23')](_0x39771b);}return _0x1b61c9[_0xfe4f('0x24')]();};}function saveUpdates(_0x40a7b7,_0x1bf702){return function(_0x1a202d){if(_0x1a202d){return _0x1a202d['update'](_0x40a7b7)[_0xfe4f('0x25')](function(_0x326681){return _0x326681;});}return null;};}function removeEntity(_0x50531b,_0x4ad7b2){return function(_0x4a953b){if(_0x4a953b){return _0x4a953b['destroy']()[_0xfe4f('0x25')](function(){var _0x4429cd=_0x4a953b[_0xfe4f('0x26')]({'plain':!![]});var _0x58c68a=_0xfe4f('0x27');return db[_0xfe4f('0x28')][_0xfe4f('0x29')]({'where':{'type':_0x58c68a,'resourceId':_0x4429cd['id']}})[_0xfe4f('0x25')](function(){return _0x4a953b;});})[_0xfe4f('0x25')](function(){_0x50531b[_0xfe4f('0x1a')](0xcc)[_0xfe4f('0x1b')]();});}};}function handleEntityNotFound(_0x2db017,_0x22c22a){return function(_0x2c4604){if(!_0x2c4604){_0x2db017[_0xfe4f('0x19')](0x194);}return _0x2c4604;};}function handleError(_0x4b6cc8,_0x4ee50a){_0x4ee50a=_0x4ee50a||0x1f4;return function(_0x285dd7){logger[_0xfe4f('0x2a')](_0x285dd7[_0xfe4f('0x2b')]);if(_0x285dd7[_0xfe4f('0x2c')]){delete _0x285dd7['name'];}_0x4b6cc8[_0xfe4f('0x1a')](_0x4ee50a)[_0xfe4f('0x2d')](_0x285dd7);};}exports['index']=function(_0x5b118c,_0x4408ab){var _0x2290c2={},_0x261360={},_0x5c042b={'count':0x0,'rows':[]};var _0x30bb94=_[_0xfe4f('0x2e')](db[_0xfe4f('0x2f')]['rawAttributes'],function(_0x1cdbd4){return{'name':_0x1cdbd4[_0xfe4f('0x30')],'type':_0x1cdbd4[_0xfe4f('0x31')]['key']};});_0x261360['model']=_['map'](_0x30bb94,_0xfe4f('0x2c'));_0x261360['query']=_[_0xfe4f('0x32')](_0x5b118c[_0xfe4f('0x33')]);_0x261360[_0xfe4f('0x34')]=_[_0xfe4f('0x35')](_0x261360[_0xfe4f('0x36')],_0x261360['query']);_0x2290c2['attributes']=_[_0xfe4f('0x35')](_0x261360[_0xfe4f('0x36')],qs[_0xfe4f('0x37')](_0x5b118c['query'][_0xfe4f('0x37')]));_0x2290c2[_0xfe4f('0x38')]=_0x2290c2[_0xfe4f('0x38')][_0xfe4f('0x39')]?_0x2290c2[_0xfe4f('0x38')]:_0x261360[_0xfe4f('0x36')];if(!_0x5b118c[_0xfe4f('0x33')][_0xfe4f('0x3a')](_0xfe4f('0x3b'))){_0x2290c2[_0xfe4f('0x1e')]=qs[_0xfe4f('0x1e')](_0x5b118c['query']['limit']);_0x2290c2['offset']=qs[_0xfe4f('0x1c')](_0x5b118c[_0xfe4f('0x33')][_0xfe4f('0x1c')]);}_0x2290c2[_0xfe4f('0x3c')]=qs['sort'](_0x5b118c['query'][_0xfe4f('0x3d')]);_0x2290c2[_0xfe4f('0x3e')]=qs[_0xfe4f('0x34')](_[_0xfe4f('0x3f')](_0x5b118c['query'],_0x261360[_0xfe4f('0x34')]),_0x30bb94);if(_0x5b118c[_0xfe4f('0x33')]['filter']){_0x2290c2[_0xfe4f('0x3e')]=_[_0xfe4f('0x40')](_0x2290c2[_0xfe4f('0x3e')],{'$or':_['map'](_0x30bb94,function(_0x3b2814){if(_0x3b2814[_0xfe4f('0x31')]!==_0xfe4f('0x41')){var _0x3dce16={};_0x3dce16[_0x3b2814[_0xfe4f('0x2c')]]={'$like':'%'+_0x5b118c['query'][_0xfe4f('0x42')]+'%'};return _0x3dce16;}})});}_0x2290c2=_[_0xfe4f('0x40')]({},_0x2290c2,_0x5b118c[_0xfe4f('0x43')]);var _0x4a838f={'where':_0x2290c2[_0xfe4f('0x3e')]};return db[_0xfe4f('0x2f')][_0xfe4f('0x1f')](_0x4a838f)[_0xfe4f('0x25')](function(_0x197633){_0x5c042b[_0xfe4f('0x1f')]=_0x197633;if(_0x5b118c['query']['includeAll']){_0x2290c2['include']=[{'all':!![]}];}return db[_0xfe4f('0x2f')][_0xfe4f('0x44')](_0x2290c2);})[_0xfe4f('0x25')](function(_0x54504a){_0x5c042b['rows']=_0x54504a;return _0x5c042b;})[_0xfe4f('0x25')](respondWithFilteredResult(_0x4408ab,_0x2290c2))[_0xfe4f('0x45')](handleError(_0x4408ab,null));};exports[_0xfe4f('0x46')]=function(_0x20e2ca,_0x2fdd09){var _0x866215={'raw':!![],'where':{'id':_0x20e2ca[_0xfe4f('0x47')]['id']}},_0x5b37ac={};_0x5b37ac[_0xfe4f('0x36')]=_[_0xfe4f('0x32')](db['Interval'][_0xfe4f('0x48')]);_0x5b37ac[_0xfe4f('0x33')]=_[_0xfe4f('0x32')](_0x20e2ca[_0xfe4f('0x33')]);_0x5b37ac[_0xfe4f('0x34')]=_['intersection'](_0x5b37ac[_0xfe4f('0x36')],_0x5b37ac[_0xfe4f('0x33')]);_0x866215[_0xfe4f('0x38')]=_[_0xfe4f('0x35')](_0x5b37ac['model'],qs[_0xfe4f('0x37')](_0x20e2ca[_0xfe4f('0x33')][_0xfe4f('0x37')]));_0x866215[_0xfe4f('0x38')]=_0x866215[_0xfe4f('0x38')][_0xfe4f('0x39')]?_0x866215['attributes']:_0x5b37ac['model'];if(_0x20e2ca[_0xfe4f('0x33')][_0xfe4f('0x49')]){_0x866215[_0xfe4f('0x4a')]=[{'all':!![]}];}_0x866215=_[_0xfe4f('0x40')]({},_0x866215,_0x20e2ca['options']);return db['Interval'][_0xfe4f('0x4b')](_0x866215)[_0xfe4f('0x25')](handleEntityNotFound(_0x2fdd09,null))[_0xfe4f('0x25')](respondWithResult(_0x2fdd09,null))[_0xfe4f('0x45')](handleError(_0x2fdd09,null));};exports['create']=function(_0x15d7e1,_0x2c3595){return db[_0xfe4f('0x2f')][_0xfe4f('0x4c')](_0x15d7e1['body'],{})['then'](function(_0x5a1726){var _0x3c25b4=_0x15d7e1[_0xfe4f('0x4d')]['get']({'plain':!![]});if(!_0x3c25b4)throw new Error(_0xfe4f('0x4e'));if(_0x3c25b4[_0xfe4f('0x4f')]===_0xfe4f('0x4d')){var _0x1f9346=_0x5a1726[_0xfe4f('0x26')]({'plain':!![]});var _0x26fdab='Intervals';return db[_0xfe4f('0x50')]['find']({'where':{'name':_0x26fdab,'userProfileId':_0x3c25b4[_0xfe4f('0x51')]},'raw':!![]})[_0xfe4f('0x25')](function(_0x3e71fe){if(_0x3e71fe&&_0x3e71fe[_0xfe4f('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f9346[_0xfe4f('0x2c')],'resourceId':_0x1f9346['id'],'type':_0x3e71fe[_0xfe4f('0x2c')],'sectionId':_0x3e71fe['id']},{})[_0xfe4f('0x25')](function(){return _0x5a1726;});}else{return _0x5a1726;}})[_0xfe4f('0x45')](function(_0x1f588a){logger[_0xfe4f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f588a);throw _0x1f588a;});}return _0x5a1726;})[_0xfe4f('0x25')](respondWithResult(_0x2c3595,0xc9))[_0xfe4f('0x45')](handleError(_0x2c3595,null));};exports[_0xfe4f('0x53')]=function(_0x4cb654,_0x16c542){if(_0x4cb654[_0xfe4f('0x54')]['id']){delete _0x4cb654['body']['id'];}return db[_0xfe4f('0x2f')][_0xfe4f('0x4b')]({'where':{'id':_0x4cb654[_0xfe4f('0x47')]['id']}})[_0xfe4f('0x25')](handleEntityNotFound(_0x16c542,null))[_0xfe4f('0x25')](saveUpdates(_0x4cb654[_0xfe4f('0x54')],null))[_0xfe4f('0x25')](respondWithResult(_0x16c542,null))[_0xfe4f('0x45')](handleError(_0x16c542,null));};exports[_0xfe4f('0x29')]=function(_0x4621a9,_0x46968a){return db[_0xfe4f('0x2f')][_0xfe4f('0x4b')]({'where':{'id':_0x4621a9[_0xfe4f('0x47')]['id']}})['then'](handleEntityNotFound(_0x46968a,null))[_0xfe4f('0x25')](removeEntity(_0x46968a,null))[_0xfe4f('0x45')](handleError(_0x46968a,null));};exports['addInterval']=function(_0x561ac2,_0x38fbbc,_0xfeddd){if(_0x561ac2[_0xfe4f('0x54')]['id']){delete _0x561ac2[_0xfe4f('0x54')]['id'];}return db[_0xfe4f('0x2f')][_0xfe4f('0x4b')]({'where':{'id':_0x561ac2[_0xfe4f('0x47')]['id']}})[_0xfe4f('0x25')](handleEntityNotFound(_0x38fbbc,null))[_0xfe4f('0x25')](function(_0xa19a4d){if(_0xa19a4d){_0x561ac2[_0xfe4f('0x54')]['IntervalId']=_0xa19a4d['id'];return db[_0xfe4f('0x2f')]['create'](_0x561ac2['body']);}})['then'](respondWithResult(_0x38fbbc,null))[_0xfe4f('0x45')](handleError(_0x38fbbc,null));};exports[_0xfe4f('0x55')]=function(_0xda35ca,_0x350bed,_0x4a11c6){var _0x2fbf87={};var _0x3bb605={};var _0x4cd01c;var _0x183680;return db[_0xfe4f('0x2f')][_0xfe4f('0x56')]({'where':{'id':_0xda35ca[_0xfe4f('0x47')]['id']}})['then'](handleEntityNotFound(_0x350bed,null))[_0xfe4f('0x25')](function(_0x24c5fb){if(_0x24c5fb){_0x4cd01c=_0x24c5fb;_0x3bb605['model']=_[_0xfe4f('0x32')](db[_0xfe4f('0x2f')][_0xfe4f('0x48')]);_0x3bb605['query']=_[_0xfe4f('0x32')](_0xda35ca[_0xfe4f('0x33')]);_0x3bb605['filters']=_[_0xfe4f('0x35')](_0x3bb605[_0xfe4f('0x36')],_0x3bb605['query']);_0x2fbf87[_0xfe4f('0x38')]=_['intersection'](_0x3bb605[_0xfe4f('0x36')],qs[_0xfe4f('0x37')](_0xda35ca[_0xfe4f('0x33')][_0xfe4f('0x37')]));_0x2fbf87[_0xfe4f('0x38')]=_0x2fbf87[_0xfe4f('0x38')]['length']?_0x2fbf87[_0xfe4f('0x38')]:_0x3bb605[_0xfe4f('0x36')];_0x2fbf87[_0xfe4f('0x3c')]=qs[_0xfe4f('0x3d')](_0xda35ca[_0xfe4f('0x33')]['sort']);_0x2fbf87['where']=qs[_0xfe4f('0x34')](_[_0xfe4f('0x3f')](_0xda35ca[_0xfe4f('0x33')],_0x3bb605[_0xfe4f('0x34')]));if(_0xda35ca[_0xfe4f('0x33')][_0xfe4f('0x42')]){_0x2fbf87[_0xfe4f('0x3e')]=_['merge'](_0x2fbf87[_0xfe4f('0x3e')],{'$or':_['map'](_0x2fbf87[_0xfe4f('0x38')],function(_0x2f2bdd){var _0x1bcb7c={};_0x1bcb7c[_0x2f2bdd]={'$like':'%'+_0xda35ca[_0xfe4f('0x33')]['filter']+'%'};return _0x1bcb7c;})});}_0x2fbf87=_[_0xfe4f('0x40')]({},_0x2fbf87,_0xda35ca[_0xfe4f('0x43')]);return _0x4cd01c[_0xfe4f('0x55')](_0x2fbf87);}})['then'](function(_0xc4acec){if(_0xc4acec){_0x183680=_0xc4acec['length'];if(!_0xda35ca['query'][_0xfe4f('0x3a')]('nolimit')){_0x2fbf87[_0xfe4f('0x1e')]=qs[_0xfe4f('0x1e')](_0xda35ca[_0xfe4f('0x33')][_0xfe4f('0x1e')]);_0x2fbf87['offset']=qs[_0xfe4f('0x1c')](_0xda35ca[_0xfe4f('0x33')]['offset']);}return _0x4cd01c['getIntervals'](_0x2fbf87);}})['then'](function(_0x6ba4e4){if(_0x6ba4e4){return _0x6ba4e4?{'count':_0x183680,'rows':_0x6ba4e4}:null;}})[_0xfe4f('0x25')](respondWithResult(_0x350bed,null))['catch'](handleError(_0x350bed,null));};exports[_0xfe4f('0x57')]=function(_0x3ed884,_0x3da50b,_0x52c06b){return db[_0xfe4f('0x2f')][_0xfe4f('0x56')]({'where':{'id':_0x3ed884['params']['id']}})[_0xfe4f('0x25')](handleEntityNotFound(_0x3da50b,null))[_0xfe4f('0x25')](function(_0x53beef){if(_0x53beef){return db[_0xfe4f('0x58')][_0xfe4f('0x59')](function(_0x175620){return db['Interval']['destroy']({'where':{'IntervalId':_0x3ed884[_0xfe4f('0x47')]['id']},'transaction':_0x175620})['then'](function(_0x6966db){var _0x302709=_['map'](_0x3ed884[_0xfe4f('0x54')],function(_0x1d90e1){delete _0x1d90e1['id'];_0x1d90e1[_0xfe4f('0x5a')]=_0x3ed884['params']['id'];return _0x1d90e1;});return db[_0xfe4f('0x2f')][_0xfe4f('0x5b')](_0x302709,{'transaction':_0x175620});});})[_0xfe4f('0x25')](function(){return db['Interval'][_0xfe4f('0x44')]({'where':{'IntervalId':_0x3ed884[_0xfe4f('0x47')]['id']}});});}})[_0xfe4f('0x25')](respondWithResult(_0x3da50b,null))[_0xfe4f('0x45')](handleError(_0x3da50b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3e4d142..279b2bf 100644 --- a/server/api/interval/interval.model.js +++ b/server/api/interval/interval.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dd2=['define','Interval','tools_intervals','rewrite','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x233b27,_0x112d95){var _0x173764=function(_0x1a42ae){while(--_0x1a42ae){_0x233b27['push'](_0x233b27['shift']());}};_0x173764(++_0x112d95);}(_0x3dd2,0x93));var _0x23dd=function(_0x3fa308,_0x1816e5){_0x3fa308=_0x3fa308-0x0;var _0x4eba5c=_0x3dd2[_0x3fa308];return _0x4eba5c;};'use strict';var _=require(_0x23dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x23dd('0x1'));var moment=require(_0x23dd('0x2'));var BPromise=require(_0x23dd('0x3'));var rp=require(_0x23dd('0x4'));var fs=require('fs');var path=require(_0x23dd('0x5'));var rimraf=require('rimraf');var config=require(_0x23dd('0x6'));var attributes=require(_0x23dd('0x7'));var extensions=require(_0x23dd('0x8'));module['exports']=function(_0x5bbd4c,_0x5d7d3d){return _0x5bbd4c[_0x23dd('0x9')](_0x23dd('0xa'),attributes,{'tableName':_0x23dd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x62bcb3,_0x30dbd2){extensions['rewrite'](_0x5bbd4c,_0x62bcb3);},'afterBulkCreate':function(_0x4cb83b,_0x5438e1,_0x319e61){_0x319e61();extensions[_0x23dd('0xc')](_0x5bbd4c,_0x4cb83b[0x0]);},'afterUpdate':function(_0x412406,_0x5aeedf){extensions[_0x23dd('0xc')](_0x5bbd4c,_0x412406);},'afterDestroy':function(_0x6a3231,_0x468ccb){extensions[_0x23dd('0xc')](_0x5bbd4c,_0x6a3231);}}});}; \ No newline at end of file +var _0x266a=['tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','request-promise','path','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x5d1da3,_0x5953af){var _0x36e415=function(_0x9b7280){while(--_0x9b7280){_0x5d1da3['push'](_0x5d1da3['shift']());}};_0x36e415(++_0x5953af);}(_0x266a,0x144));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require(_0xa266('0x2'))(_0xa266('0x3'));var moment=require(_0xa266('0x4'));var BPromise=require('bluebird');var rp=require(_0xa266('0x5'));var fs=require('fs');var path=require(_0xa266('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa266('0x7'));var extensions=require(_0xa266('0x8'));module[_0xa266('0x9')]=function(_0x377bd2,_0x68009e){return _0x377bd2[_0xa266('0xa')](_0xa266('0xb'),attributes,{'tableName':_0xa266('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x38347a,_0x8b49b9){extensions[_0xa266('0xd')](_0x377bd2,_0x38347a);},'afterBulkCreate':function(_0x3620ea,_0x32d3a3,_0x1955f8){_0x1955f8();extensions[_0xa266('0xd')](_0x377bd2,_0x3620ea[0x0]);},'afterUpdate':function(_0x55e473,_0x581c52){extensions[_0xa266('0xd')](_0x377bd2,_0x55e473);},'afterDestroy':function(_0x31786d,_0x1295f5){extensions[_0xa266('0xd')](_0x377bd2,_0x31786d);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c77af56..41f20a0 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 08c96ce..4fe3d38 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x2f4f88,_0x38a3d0){var _0x4dff32=function(_0x181e5e){while(--_0x181e5e){_0x2f4f88['push'](_0x2f4f88['shift']());}};_0x4dff32(++_0x38a3d0);}(_0x2032,0xd9));var _0x2203=function(_0x3a4091,_0x17ccf0){_0x3a4091=_0x3a4091-0x0;var _0x281514=_0x2032[_0x3a4091];return _0x281514;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b6fb4fa..2a4376d 100644 --- a/server/api/jira/jira.controller.js +++ b/server/api/jira/jira.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8a5=['email','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','Basic\x20','toString','utf8','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','fields','customfield_11500'];(function(_0x700fbe,_0x14e29d){var _0x3c54a6=function(_0x3c3eb4){while(--_0x3c3eb4){_0x700fbe['push'](_0x700fbe['shift']());}};_0x3c54a6(++_0x14e29d);}(_0xe8a5,0x1ee));var _0x5e8a=function(_0x28d4cc,_0x4a6868){_0x28d4cc=_0x28d4cc-0x0;var _0x32a33c=_0xe8a5[_0x28d4cc];return _0x32a33c;};'use strict';var BPromise=require(_0x5e8a('0x0'));var https=require(_0x5e8a('0x1'));var logger=require(_0x5e8a('0x2'))('api');var USERNAME=_0x5e8a('0x3');var PASSWORD=_0x5e8a('0x4');function openIssue(_0x4c5d45,_0x1774c8){var _0x3afc89={'fields':{'project':{'key':_0x4c5d45[_0x5e8a('0x5')]||_0x5e8a('0x6')},'summary':(_0x4c5d45['summary']||_0x5e8a('0x7'))+_0x5e8a('0x8')+_0x4c5d45['ip'],'description':_0x4c5d45[_0x5e8a('0x9')]||JSON[_0x5e8a('0xa')](_0x4c5d45),'issuetype':{'name':_0x4c5d45['issuetype']||'Bug'}}};_0x3afc89[_0x5e8a('0xb')][_0x5e8a('0xc')]=_0x4c5d45[_0x5e8a('0xd')];_0x3afc89[_0x5e8a('0xb')]['customfield_11501']=_0x4c5d45['oldToken'];_0x3afc89[_0x5e8a('0xb')]['customfield_11502']=_0x4c5d45[_0x5e8a('0xe')];_0x3afc89[_0x5e8a('0xb')]['customfield_11503']=_0x4c5d45[_0x5e8a('0xf')];_0x3afc89['fields'][_0x5e8a('0x10')]=_0x4c5d45[_0x5e8a('0x11')];_0x3afc89[_0x5e8a('0xb')][_0x5e8a('0x12')]=_0x4c5d45['ip'];var _0x28c51b={'host':_0x5e8a('0x13'),'port':0x1bb,'path':_0x5e8a('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x5e8a('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x5e8a('0x16')]('base64')}};var _0x4aec11=JSON[_0x5e8a('0xa')](_0x3afc89);var _0x524847=https['request'](_0x28c51b,function(_0x539252){_0x539252['setEncoding'](_0x5e8a('0x17'));var _0xed07ea='';_0x539252['on'](_0x5e8a('0x18'),function(_0x1cf7c3){_0xed07ea+=_0x1cf7c3;});_0x539252['on']('end',function(){if(_0x1774c8){return _0x1774c8[_0x5e8a('0x19')](_0x539252[_0x5e8a('0x1a')])[_0x5e8a('0x1b')](JSON['parse'](_0xed07ea));}});});_0x524847['on'](_0x5e8a('0x1c'),function(_0x269419){if(_0x1774c8){return _0x1774c8['status'](0x1f4)[_0x5e8a('0x1b')]({'errors':[{'message':_0x5e8a('0x1d'),'type':'api.jira'}]});}});_0x524847[_0x5e8a('0x1e')](_0x4aec11);_0x524847[_0x5e8a('0x1f')]();}exports[_0x5e8a('0x20')]=openIssue;exports[_0x5e8a('0x21')]=function(_0x1d6e06,_0x255c4f){_0x1d6e06[_0x5e8a('0x22')]['ip']=_0x1d6e06['headers'][_0x5e8a('0x23')]||_0x1d6e06['connection'][_0x5e8a('0x24')]||_0x1d6e06[_0x5e8a('0x25')][_0x5e8a('0x24')]||_0x1d6e06[_0x5e8a('0x26')]['socket'][_0x5e8a('0x24')];return openIssue(_0x1d6e06[_0x5e8a('0x22')],_0x255c4f);}; \ No newline at end of file +var _0x60c9=['../../config/logger','api','3eAmWpBVP0','key','summary','Report','\x20from\x20','stringify','issuetype','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','utf8','data','end','status','json','parse','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https'];(function(_0x56e798,_0x578c28){var _0x3a34ad=function(_0x5b5c4e){while(--_0x5b5c4e){_0x56e798['push'](_0x56e798['shift']());}};_0x3a34ad(++_0x578c28);}(_0x60c9,0x13f));var _0x960c=function(_0x237917,_0x25ebbf){_0x237917=_0x237917-0x0;var _0x24c4f8=_0x60c9[_0x237917];return _0x24c4f8;};'use strict';var BPromise=require('bluebird');var https=require(_0x960c('0x0'));var logger=require(_0x960c('0x1'))(_0x960c('0x2'));var USERNAME='support';var PASSWORD=_0x960c('0x3');function openIssue(_0x32e37e,_0x470bfc){var _0x2c85ea={'fields':{'project':{'key':_0x32e37e[_0x960c('0x4')]||'MOTGUI'},'summary':(_0x32e37e[_0x960c('0x5')]||_0x960c('0x6'))+_0x960c('0x7')+_0x32e37e['ip'],'description':_0x32e37e['description']||JSON[_0x960c('0x8')](_0x32e37e),'issuetype':{'name':_0x32e37e[_0x960c('0x9')]||'Bug'}}};_0x2c85ea[_0x960c('0xa')]['customfield_11500']=_0x32e37e['email'];_0x2c85ea[_0x960c('0xa')]['customfield_11501']=_0x32e37e['oldToken'];_0x2c85ea['fields'][_0x960c('0xb')]=_0x32e37e[_0x960c('0xc')];_0x2c85ea['fields'][_0x960c('0xd')]=_0x32e37e[_0x960c('0xe')];_0x2c85ea[_0x960c('0xa')][_0x960c('0xf')]=_0x32e37e[_0x960c('0x10')];_0x2c85ea[_0x960c('0xa')][_0x960c('0x11')]=_0x32e37e['ip'];var _0x1f6608={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x960c('0x12'),'method':_0x960c('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x960c('0x14'),'Authorization':_0x960c('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x960c('0x16')]('base64')}};var _0x594766=JSON[_0x960c('0x8')](_0x2c85ea);var _0x16a7e0=https[_0x960c('0x17')](_0x1f6608,function(_0x5add7f){_0x5add7f['setEncoding'](_0x960c('0x18'));var _0x210c8e='';_0x5add7f['on'](_0x960c('0x19'),function(_0x3ed508){_0x210c8e+=_0x3ed508;});_0x5add7f['on'](_0x960c('0x1a'),function(){if(_0x470bfc){return _0x470bfc[_0x960c('0x1b')](_0x5add7f['statusCode'])[_0x960c('0x1c')](JSON[_0x960c('0x1d')](_0x210c8e));}});});_0x16a7e0['on']('error',function(_0x453e15){if(_0x470bfc){return _0x470bfc[_0x960c('0x1b')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x960c('0x1e')}]});}});_0x16a7e0[_0x960c('0x1f')](_0x594766);_0x16a7e0[_0x960c('0x1a')]();}exports[_0x960c('0x20')]=openIssue;exports[_0x960c('0x21')]=function(_0x2ad86c,_0x390664){_0x2ad86c[_0x960c('0x22')]['ip']=_0x2ad86c[_0x960c('0x23')][_0x960c('0x24')]||_0x2ad86c[_0x960c('0x25')][_0x960c('0x26')]||_0x2ad86c[_0x960c('0x27')]['remoteAddress']||_0x2ad86c[_0x960c('0x25')][_0x960c('0x27')][_0x960c('0x26')];return openIssue(_0x2ad86c[_0x960c('0x22')],_0x390664);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index f33a12e..3e91023 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x502643,_0x2a2900){var _0xd6c2ad=function(_0x8dd690){while(--_0x8dd690){_0x502643['push'](_0x502643['shift']());}};_0xd6c2ad(++_0x2a2900);}(_0xa74f,0x9a));var _0xfa74=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xa74f[_0x3511d3];return _0x5d6321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file +var _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x354a37,_0x3d63f2){var _0x5219c6=function(_0x49aaaa){while(--_0x49aaaa){_0x354a37['push'](_0x354a37['shift']());}};_0x5219c6(++_0x3d63f2);}(_0xa74f,0x9a));var _0xfa74=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xa74f[_0x3a8dc1];return _0x4b3595;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index eb48225..a8ff5b3 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x326523,_0x462305){_0x326523=_0x326523-0x0;var _0x5497eb=_0x7a54[_0x326523];return _0x5497eb;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x7a54,0x106));var _0x47a5=function(_0x3b25c5,_0x2c26f0){_0x3b25c5=_0x3b25c5-0x0;var _0x41b6c2=_0x7a54[_0x3b25c5];return _0x41b6c2;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index ce87448..336139a 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','stack','name','send','index','map','JscriptyAnswerReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x31f0,0xb7));var _0x031f=function(_0x2b963b,_0x55f37e){_0x2b963b=_0x2b963b-0x0;var _0x525a7e=_0x31f0[_0x2b963b];return _0x525a7e;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];function respondWithStatusCode(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xcc;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0x18')](_0x3819bb);}return _0x351052['status'](_0x3819bb)[_0x031f('0x19')]();};}function respondWithResult(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0xc8;return function(_0x2e3dfe){if(_0x2e3dfe){return _0x23b40c[_0x031f('0x1a')](_0x17a699)['json'](_0x2e3dfe);}};}function respondWithFilteredResult(_0x4b7011,_0x1f08db){return function(_0x3a10aa){if(_0x3a10aa){var _0xe4fc1d=typeof _0x1f08db[_0x031f('0x1b')]==='undefined'&&typeof _0x1f08db[_0x031f('0x1c')]===_0x031f('0x1d');var _0x5d0c70=_0x3a10aa[_0x031f('0x1e')];var _0x535e70=_0xe4fc1d?0x0:_0x1f08db[_0x031f('0x1b')];var _0x5f2199=_0xe4fc1d?_0x3a10aa[_0x031f('0x1e')]:_0x1f08db[_0x031f('0x1b')]+_0x1f08db[_0x031f('0x1c')];var _0x26cb5e;if(_0x5f2199>=_0x5d0c70){_0x5f2199=_0x5d0c70;_0x26cb5e=0xc8;}else{_0x26cb5e=0xce;}_0x4b7011[_0x031f('0x1a')](_0x26cb5e);return _0x4b7011[_0x031f('0x1f')](_0x031f('0x20'),_0x535e70+'-'+_0x5f2199+'/'+_0x5d0c70)[_0x031f('0x21')](_0x3a10aa);}return null;};}function patchUpdates(_0x29dd6e){return function(_0x48a76e){try{jsonpatch[_0x031f('0x22')](_0x48a76e,_0x29dd6e,!![]);}catch(_0x33926c){return BPromise[_0x031f('0x23')](_0x33926c);}return _0x48a76e['save']();};}function saveUpdates(_0x5c4184,_0xa11a2b){return function(_0x4d0f92){if(_0x4d0f92){return _0x4d0f92[_0x031f('0x24')](_0x5c4184)['then'](function(_0x54d054){return _0x54d054;});}return null;};}function removeEntity(_0x47d639,_0x971691){return function(_0x12c406){if(_0x12c406){return _0x12c406[_0x031f('0x25')]()[_0x031f('0x26')](function(){_0x47d639['status'](0xcc)[_0x031f('0x19')]();});}};}function handleEntityNotFound(_0x5a64c0,_0x40cb1c){return function(_0x1f5a14){if(!_0x1f5a14){_0x5a64c0[_0x031f('0x18')](0x194);}return _0x1f5a14;};}function handleError(_0x567666,_0x35af16){_0x35af16=_0x35af16||0x1f4;return function(_0x3b2a51){logger['error'](_0x3b2a51[_0x031f('0x27')]);if(_0x3b2a51[_0x031f('0x28')]){delete _0x3b2a51[_0x031f('0x28')];}_0x567666['status'](_0x35af16)[_0x031f('0x29')](_0x3b2a51);};}exports[_0x031f('0x2a')]=function(_0xb6ed6c,_0xaf5bea){var _0xfaa36={},_0x301bd2={},_0x52b544={'count':0x0,'rows':[]};var _0x1f62eb=_[_0x031f('0x2b')](db[_0x031f('0x2c')][_0x031f('0x2d')],function(_0x428ec4){return{'name':_0x428ec4[_0x031f('0x2e')],'type':_0x428ec4[_0x031f('0x2f')][_0x031f('0x30')]};});_0x301bd2[_0x031f('0x31')]=_[_0x031f('0x2b')](_0x1f62eb,_0x031f('0x28'));_0x301bd2['query']=_[_0x031f('0x32')](_0xb6ed6c[_0x031f('0x33')]);_0x301bd2[_0x031f('0x34')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],_0x301bd2[_0x031f('0x33')]);_0xfaa36[_0x031f('0x36')]=_[_0x031f('0x35')](_0x301bd2[_0x031f('0x31')],qs[_0x031f('0x37')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x37')]));_0xfaa36[_0x031f('0x36')]=_0xfaa36['attributes'][_0x031f('0x38')]?_0xfaa36[_0x031f('0x36')]:_0x301bd2['model'];if(!_0xb6ed6c[_0x031f('0x33')][_0x031f('0x39')]('nolimit')){_0xfaa36[_0x031f('0x1c')]=qs[_0x031f('0x1c')](_0xb6ed6c[_0x031f('0x33')][_0x031f('0x1c')]);_0xfaa36['offset']=qs['offset'](_0xb6ed6c[_0x031f('0x33')]['offset']);}_0xfaa36[_0x031f('0x3a')]=qs[_0x031f('0x3b')](_0xb6ed6c[_0x031f('0x33')]['sort']);_0xfaa36['where']=qs[_0x031f('0x34')](_['pick'](_0xb6ed6c['query'],_0x301bd2[_0x031f('0x34')]),_0x1f62eb);if(_0xb6ed6c[_0x031f('0x33')][_0x031f('0x3c')]){_0xfaa36[_0x031f('0x3d')]=_[_0x031f('0x3e')](_0xfaa36[_0x031f('0x3d')],{'$or':_[_0x031f('0x2b')](_0x1f62eb,function(_0x55c85f){if(_0x55c85f[_0x031f('0x2f')]!==_0x031f('0x3f')){var _0xb3b188={};_0xb3b188[_0x55c85f[_0x031f('0x28')]]={'$like':'%'+_0xb6ed6c['query'][_0x031f('0x3c')]+'%'};return _0xb3b188;}})});}_0xfaa36=_[_0x031f('0x3e')]({},_0xfaa36,_0xb6ed6c[_0x031f('0x40')]);var _0x5895f6={'where':_0xfaa36[_0x031f('0x3d')]};return db[_0x031f('0x2c')]['count'](_0x5895f6)[_0x031f('0x26')](function(_0x268dc7){_0x52b544['count']=_0x268dc7;if(_0xb6ed6c['query'][_0x031f('0x41')]){_0xfaa36[_0x031f('0x42')]=[{'all':!![]}];}return db[_0x031f('0x2c')][_0x031f('0x43')](_0xfaa36);})[_0x031f('0x26')](function(_0xf0fb95){_0x52b544[_0x031f('0x44')]=_0xf0fb95;return _0x52b544;})['then'](respondWithFilteredResult(_0xaf5bea,_0xfaa36))[_0x031f('0x45')](handleError(_0xaf5bea,null));};exports[_0x031f('0x46')]=function(_0x4d701e,_0x12279a){var _0x505e93={'raw':!![],'where':{'id':_0x4d701e[_0x031f('0x47')]['id']}},_0x456a98={};_0x456a98['model']=_[_0x031f('0x32')](db[_0x031f('0x2c')][_0x031f('0x2d')]);_0x456a98['query']=_[_0x031f('0x32')](_0x4d701e[_0x031f('0x33')]);_0x456a98[_0x031f('0x34')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],_0x456a98[_0x031f('0x33')]);_0x505e93[_0x031f('0x36')]=_[_0x031f('0x35')](_0x456a98[_0x031f('0x31')],qs['fields'](_0x4d701e[_0x031f('0x33')][_0x031f('0x37')]));_0x505e93[_0x031f('0x36')]=_0x505e93[_0x031f('0x36')][_0x031f('0x38')]?_0x505e93[_0x031f('0x36')]:_0x456a98[_0x031f('0x31')];if(_0x4d701e[_0x031f('0x33')][_0x031f('0x41')]){_0x505e93['include']=[{'all':!![]}];}_0x505e93=_[_0x031f('0x3e')]({},_0x505e93,_0x4d701e['options']);return db['JscriptyAnswerReport'][_0x031f('0x48')](_0x505e93)[_0x031f('0x26')](handleEntityNotFound(_0x12279a,null))[_0x031f('0x26')](respondWithResult(_0x12279a,null))[_0x031f('0x45')](handleError(_0x12279a,null));};exports[_0x031f('0x49')]=function(_0x553f01,_0x309642){return db[_0x031f('0x2c')][_0x031f('0x49')](_0x553f01['body'],{})[_0x031f('0x26')](respondWithResult(_0x309642,0xc9))[_0x031f('0x45')](handleError(_0x309642,null));};exports[_0x031f('0x24')]=function(_0x318829,_0x2c93ea){if(_0x318829[_0x031f('0x4a')]['id']){delete _0x318829['body']['id'];}return db['JscriptyAnswerReport'][_0x031f('0x48')]({'where':{'id':_0x318829['params']['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x2c93ea,null))[_0x031f('0x26')](saveUpdates(_0x318829['body'],null))[_0x031f('0x26')](respondWithResult(_0x2c93ea,null))['catch'](handleError(_0x2c93ea,null));};exports['destroy']=function(_0x35a949,_0x48ca85){return db[_0x031f('0x2c')]['find']({'where':{'id':_0x35a949[_0x031f('0x47')]['id']}})[_0x031f('0x26')](handleEntityNotFound(_0x48ca85,null))['then'](removeEntity(_0x48ca85,null))[_0x031f('0x45')](handleError(_0x48ca85,null));};exports[_0x031f('0x4b')]=function(_0x57e32d,_0x46471a){return db['JscriptyAnswerReport'][_0x031f('0x4b')]()['then'](respondWithResult(_0x46471a,null))[_0x031f('0x45')](handleError(_0x46471a,null));}; \ No newline at end of file +var _0xf52f=['offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xf52f,0x113));var _0xff52=function(_0x263e6d,_0x585ebb){_0x263e6d=_0x263e6d-0x0;var _0xc8d72=_0xf52f[_0x263e6d];return _0xc8d72;};'use strict';var emlformat=require(_0xff52('0x0'));var rimraf=require(_0xff52('0x1'));var zipdir=require(_0xff52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff52('0x3'));var moment=require(_0xff52('0x4'));var BPromise=require(_0xff52('0x5'));var Mustache=require('mustache');var util=require(_0xff52('0x6'));var path=require(_0xff52('0x7'));var sox=require('sox');var csv=require(_0xff52('0x8'));var ejs=require(_0xff52('0x9'));var fs=require('fs');var fs_extra=require(_0xff52('0xa'));var _=require(_0xff52('0xb'));var squel=require(_0xff52('0xc'));var crypto=require(_0xff52('0xd'));var jsforce=require(_0xff52('0xe'));var deskjs=require(_0xff52('0xf'));var toCsv=require(_0xff52('0x8'));var querystring=require(_0xff52('0x10'));var Papa=require(_0xff52('0x11'));var Redis=require(_0xff52('0x12'));var authService=require(_0xff52('0x13'));var qs=require(_0xff52('0x14'));var as=require(_0xff52('0x15'));var hardwareService=require(_0xff52('0x16'));var logger=require(_0xff52('0x17'))(_0xff52('0x18'));var utils=require(_0xff52('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff52('0x1a'))['db'];function respondWithStatusCode(_0x53f40b,_0x2cd3ca){_0x2cd3ca=_0x2cd3ca||0xcc;return function(_0x1c0f10){if(_0x1c0f10){return _0x53f40b[_0xff52('0x1b')](_0x2cd3ca);}return _0x53f40b[_0xff52('0x1c')](_0x2cd3ca)['end']();};}function respondWithResult(_0x54eccf,_0x5bc4dd){_0x5bc4dd=_0x5bc4dd||0xc8;return function(_0x32f7e5){if(_0x32f7e5){return _0x54eccf['status'](_0x5bc4dd)['json'](_0x32f7e5);}};}function respondWithFilteredResult(_0x219294,_0x1e1818){return function(_0x3fc985){if(_0x3fc985){var _0x440701=typeof _0x1e1818[_0xff52('0x1d')]==='undefined'&&typeof _0x1e1818[_0xff52('0x1e')]==='undefined';var _0xc8d493=_0x3fc985['count'];var _0x568cad=_0x440701?0x0:_0x1e1818[_0xff52('0x1d')];var _0x28601f=_0x440701?_0x3fc985[_0xff52('0x1f')]:_0x1e1818['offset']+_0x1e1818['limit'];var _0x163326;if(_0x28601f>=_0xc8d493){_0x28601f=_0xc8d493;_0x163326=0xc8;}else{_0x163326=0xce;}_0x219294[_0xff52('0x1c')](_0x163326);return _0x219294[_0xff52('0x20')](_0xff52('0x21'),_0x568cad+'-'+_0x28601f+'/'+_0xc8d493)['json'](_0x3fc985);}return null;};}function patchUpdates(_0x147db2){return function(_0x45fe57){try{jsonpatch[_0xff52('0x22')](_0x45fe57,_0x147db2,!![]);}catch(_0x434a9f){return BPromise[_0xff52('0x23')](_0x434a9f);}return _0x45fe57[_0xff52('0x24')]();};}function saveUpdates(_0x78d437,_0x176c10){return function(_0x5eb3f9){if(_0x5eb3f9){return _0x5eb3f9[_0xff52('0x25')](_0x78d437)[_0xff52('0x26')](function(_0x517eb4){return _0x517eb4;});}return null;};}function removeEntity(_0x313ee0,_0x3cf849){return function(_0x4b8157){if(_0x4b8157){return _0x4b8157[_0xff52('0x27')]()['then'](function(){_0x313ee0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x363857,_0x234516){return function(_0x16b121){if(!_0x16b121){_0x363857[_0xff52('0x1b')](0x194);}return _0x16b121;};}function handleError(_0x18a08e,_0x1fe1cc){_0x1fe1cc=_0x1fe1cc||0x1f4;return function(_0x25225b){logger[_0xff52('0x28')](_0x25225b[_0xff52('0x29')]);if(_0x25225b[_0xff52('0x2a')]){delete _0x25225b['name'];}_0x18a08e[_0xff52('0x1c')](_0x1fe1cc)[_0xff52('0x2b')](_0x25225b);};}exports['index']=function(_0x2822c0,_0x32df90){var _0x208753={},_0x1cb50f={},_0x30fd72={'count':0x0,'rows':[]};var _0x51d708=_[_0xff52('0x2c')](db['JscriptyAnswerReport'][_0xff52('0x2d')],function(_0x35aaf7){return{'name':_0x35aaf7[_0xff52('0x2e')],'type':_0x35aaf7[_0xff52('0x2f')][_0xff52('0x30')]};});_0x1cb50f['model']=_['map'](_0x51d708,_0xff52('0x2a'));_0x1cb50f[_0xff52('0x31')]=_[_0xff52('0x32')](_0x2822c0['query']);_0x1cb50f[_0xff52('0x33')]=_['intersection'](_0x1cb50f[_0xff52('0x34')],_0x1cb50f[_0xff52('0x31')]);_0x208753['attributes']=_[_0xff52('0x35')](_0x1cb50f[_0xff52('0x34')],qs[_0xff52('0x36')](_0x2822c0[_0xff52('0x31')][_0xff52('0x36')]));_0x208753[_0xff52('0x37')]=_0x208753[_0xff52('0x37')][_0xff52('0x38')]?_0x208753[_0xff52('0x37')]:_0x1cb50f[_0xff52('0x34')];if(!_0x2822c0[_0xff52('0x31')]['hasOwnProperty'](_0xff52('0x39'))){_0x208753[_0xff52('0x1e')]=qs['limit'](_0x2822c0[_0xff52('0x31')][_0xff52('0x1e')]);_0x208753[_0xff52('0x1d')]=qs[_0xff52('0x1d')](_0x2822c0[_0xff52('0x31')][_0xff52('0x1d')]);}_0x208753[_0xff52('0x3a')]=qs['sort'](_0x2822c0[_0xff52('0x31')]['sort']);_0x208753['where']=qs[_0xff52('0x33')](_[_0xff52('0x3b')](_0x2822c0['query'],_0x1cb50f[_0xff52('0x33')]),_0x51d708);if(_0x2822c0[_0xff52('0x31')][_0xff52('0x3c')]){_0x208753[_0xff52('0x3d')]=_[_0xff52('0x3e')](_0x208753[_0xff52('0x3d')],{'$or':_[_0xff52('0x2c')](_0x51d708,function(_0xcb2a24){if(_0xcb2a24[_0xff52('0x2f')]!==_0xff52('0x3f')){var _0x5c48fa={};_0x5c48fa[_0xcb2a24[_0xff52('0x2a')]]={'$like':'%'+_0x2822c0[_0xff52('0x31')][_0xff52('0x3c')]+'%'};return _0x5c48fa;}})});}_0x208753=_[_0xff52('0x3e')]({},_0x208753,_0x2822c0[_0xff52('0x40')]);var _0x388613={'where':_0x208753[_0xff52('0x3d')]};return db[_0xff52('0x41')]['count'](_0x388613)[_0xff52('0x26')](function(_0x5937da){_0x30fd72[_0xff52('0x1f')]=_0x5937da;if(_0x2822c0['query'][_0xff52('0x42')]){_0x208753[_0xff52('0x43')]=[{'all':!![]}];}return db[_0xff52('0x41')][_0xff52('0x44')](_0x208753);})[_0xff52('0x26')](function(_0x1d3fc8){_0x30fd72['rows']=_0x1d3fc8;return _0x30fd72;})[_0xff52('0x26')](respondWithFilteredResult(_0x32df90,_0x208753))[_0xff52('0x45')](handleError(_0x32df90,null));};exports[_0xff52('0x46')]=function(_0x194e32,_0x16c2e4){var _0x56f535={'raw':!![],'where':{'id':_0x194e32['params']['id']}},_0x236d4f={};_0x236d4f[_0xff52('0x34')]=_[_0xff52('0x32')](db[_0xff52('0x41')][_0xff52('0x2d')]);_0x236d4f['query']=_[_0xff52('0x32')](_0x194e32[_0xff52('0x31')]);_0x236d4f[_0xff52('0x33')]=_[_0xff52('0x35')](_0x236d4f[_0xff52('0x34')],_0x236d4f[_0xff52('0x31')]);_0x56f535[_0xff52('0x37')]=_[_0xff52('0x35')](_0x236d4f[_0xff52('0x34')],qs[_0xff52('0x36')](_0x194e32[_0xff52('0x31')]['fields']));_0x56f535[_0xff52('0x37')]=_0x56f535[_0xff52('0x37')][_0xff52('0x38')]?_0x56f535['attributes']:_0x236d4f[_0xff52('0x34')];if(_0x194e32[_0xff52('0x31')][_0xff52('0x42')]){_0x56f535[_0xff52('0x43')]=[{'all':!![]}];}_0x56f535=_[_0xff52('0x3e')]({},_0x56f535,_0x194e32['options']);return db['JscriptyAnswerReport'][_0xff52('0x47')](_0x56f535)[_0xff52('0x26')](handleEntityNotFound(_0x16c2e4,null))[_0xff52('0x26')](respondWithResult(_0x16c2e4,null))['catch'](handleError(_0x16c2e4,null));};exports[_0xff52('0x48')]=function(_0x3dfb1a,_0x397a60){return db[_0xff52('0x41')][_0xff52('0x48')](_0x3dfb1a[_0xff52('0x49')],{})['then'](respondWithResult(_0x397a60,0xc9))[_0xff52('0x45')](handleError(_0x397a60,null));};exports[_0xff52('0x25')]=function(_0x314ed0,_0x2874f1){if(_0x314ed0['body']['id']){delete _0x314ed0[_0xff52('0x49')]['id'];}return db[_0xff52('0x41')][_0xff52('0x47')]({'where':{'id':_0x314ed0[_0xff52('0x4a')]['id']}})[_0xff52('0x26')](handleEntityNotFound(_0x2874f1,null))[_0xff52('0x26')](saveUpdates(_0x314ed0[_0xff52('0x49')],null))[_0xff52('0x26')](respondWithResult(_0x2874f1,null))[_0xff52('0x45')](handleError(_0x2874f1,null));};exports[_0xff52('0x27')]=function(_0x208b92,_0x12b43d){return db['JscriptyAnswerReport'][_0xff52('0x47')]({'where':{'id':_0x208b92[_0xff52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12b43d,null))[_0xff52('0x26')](removeEntity(_0x12b43d,null))[_0xff52('0x45')](handleError(_0x12b43d,null));};exports[_0xff52('0x4b')]=function(_0x11001a,_0x45c3fb){return db[_0xff52('0x41')][_0xff52('0x4b')]()['then'](respondWithResult(_0x45c3fb,null))[_0xff52('0x45')](handleError(_0x45c3fb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 49c369e..e6e4f14 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x230e=['report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x230e,0x18d));var _0xe230=function(_0x2f0977,_0x2e8eef){_0x2f0977=_0x2f0977-0x0;var _0xcab959=_0x230e[_0x2f0977];return _0xcab959;};'use strict';var _=require(_0xe230('0x0'));var util=require('util');var logger=require(_0xe230('0x1'))('api');var moment=require(_0xe230('0x2'));var BPromise=require(_0xe230('0x3'));var rp=require(_0xe230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe230('0x5'));var config=require(_0xe230('0x6'));var attributes=require(_0xe230('0x7'));module[_0xe230('0x8')]=function(_0x310e49,_0x596c43){return _0x310e49['define'](_0xe230('0x9'),attributes,{'tableName':_0xe230('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x577f=['bluebird','request-promise','path','rimraf','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x577f,0x182));var _0xf577=function(_0x2d4ccc,_0x49b784){_0x2d4ccc=_0x2d4ccc-0x0;var _0x283c08=_0x577f[_0x2d4ccc];return _0x283c08;};'use strict';var _=require(_0xf577('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf577('0x1'));var rp=require(_0xf577('0x2'));var fs=require('fs');var path=require(_0xf577('0x3'));var rimraf=require(_0xf577('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xf577('0x5')]=function(_0x513c04,_0x23b2d7){return _0x513c04[_0xf577('0x6')](_0xf577('0x7'),attributes,{'tableName':_0xf577('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3e2fd19..b3dc194 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c1d=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4c1d,0x123));var _0xd4c1=function(_0x66c3a2,_0x25c17a){_0x66c3a2=_0x66c3a2-0x0;var _0x2a6940=_0x4c1d[_0x66c3a2];return _0x2a6940;};'use strict';var _=require(_0xd4c1('0x0'));var util=require(_0xd4c1('0x1'));var moment=require('moment');var BPromise=require(_0xd4c1('0x2'));var rs=require(_0xd4c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4c1('0x4'))['db'];var utils=require(_0xd4c1('0x5'));var logger=require(_0xd4c1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd4c1('0x7'));var client=jayson[_0xd4c1('0x8')][_0xd4c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e2fd0,_0x19717d,_0x50f2bc){return new BPromise(function(_0x4e325e,_0xb87c6){return client[_0xd4c1('0xa')](_0x5e2fd0,_0x50f2bc)[_0xd4c1('0xb')](function(_0x1d011a){logger[_0xd4c1('0xc')](_0xd4c1('0xd'),_0x19717d,_0xd4c1('0xe'));logger['debug'](_0xd4c1('0xf'),_0x19717d,'request\x20sent',JSON[_0xd4c1('0x10')](_0x1d011a));if(_0x1d011a[_0xd4c1('0x11')]){if(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x12')]===0x1f4){logger['error'](_0xd4c1('0xd'),_0x19717d,_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);return _0xb87c6(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);}logger[_0xd4c1('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x19717d,_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);return _0x4e325e(_0x1d011a[_0xd4c1('0x11')][_0xd4c1('0x13')]);}else{logger[_0xd4c1('0xc')](_0xd4c1('0xd'),_0x19717d,_0xd4c1('0xe'));_0x4e325e(_0x1d011a[_0xd4c1('0x14')]['message']);}})[_0xd4c1('0x15')](function(_0x550c05){logger[_0xd4c1('0x11')](_0xd4c1('0xd'),_0x19717d,_0x550c05);_0xb87c6(_0x550c05);});});} \ No newline at end of file +var _0xa5ed=['http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f16e5,_0x2e75e0){var _0x5d082a=function(_0x13873b){while(--_0x13873b){_0x2f16e5['push'](_0x2f16e5['shift']());}};_0x5d082a(++_0x2e75e0);}(_0xa5ed,0x1c3));var _0xda5e=function(_0x43ee51,_0x1b8891){_0x43ee51=_0x43ee51-0x0;var _0x59d2e4=_0xa5ed[_0x43ee51];return _0x59d2e4;};'use strict';var _=require(_0xda5e('0x0'));var util=require('util');var moment=require(_0xda5e('0x1'));var BPromise=require('bluebird');var rs=require(_0xda5e('0x2'));var fs=require('fs');var Redis=require(_0xda5e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xda5e('0x4'))(_0xda5e('0x5'));var config=require(_0xda5e('0x6'));var jayson=require(_0xda5e('0x7'));var client=jayson[_0xda5e('0x8')][_0xda5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c06b3,_0x2244d5,_0x4db03f){return new BPromise(function(_0x22a970,_0x465e25){return client['request'](_0x4c06b3,_0x4db03f)[_0xda5e('0xa')](function(_0x5618c0){logger[_0xda5e('0xb')](_0xda5e('0xc'),_0x2244d5,_0xda5e('0xd'));logger[_0xda5e('0xe')](_0xda5e('0xf'),_0x2244d5,_0xda5e('0xd'),JSON['stringify'](_0x5618c0));if(_0x5618c0['error']){if(_0x5618c0[_0xda5e('0x10')]['code']===0x1f4){logger['error'](_0xda5e('0xc'),_0x2244d5,_0x5618c0[_0xda5e('0x10')]['message']);return _0x465e25(_0x5618c0[_0xda5e('0x10')][_0xda5e('0x11')]);}logger['error'](_0xda5e('0xc'),_0x2244d5,_0x5618c0['error'][_0xda5e('0x11')]);return _0x22a970(_0x5618c0[_0xda5e('0x10')][_0xda5e('0x11')]);}else{logger[_0xda5e('0xb')](_0xda5e('0xc'),_0x2244d5,'request\x20sent');_0x22a970(_0x5618c0[_0xda5e('0x12')][_0xda5e('0x11')]);}})[_0xda5e('0x13')](function(_0x2b33d5){logger[_0xda5e('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2244d5,_0x2b33d5);_0x465e25(_0x2b33d5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 4e755e8..f8cea1a 100644 --- a/server/api/jscriptyProject/index.js +++ b/server/api/jscriptyProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53a3=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller'];(function(_0x3b773e,_0x48bd3b){var _0x595937=function(_0x4ee38f){while(--_0x4ee38f){_0x3b773e['push'](_0x3b773e['shift']());}};_0x595937(++_0x48bd3b);}(_0x53a3,0xe0));var _0x353a=function(_0x7460d8,_0x2fc1a1){_0x7460d8=_0x7460d8-0x0;var _0x338f82=_0x53a3[_0x7460d8];return _0x338f82;};'use strict';var multer=require('multer');var util=require(_0x353a('0x0'));var path=require('path');var timeout=require(_0x353a('0x1'));var express=require('express');var router=express[_0x353a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x353a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x353a('0x4'));var controller=require(_0x353a('0x5'));router[_0x353a('0x6')]('/',auth[_0x353a('0x7')](),controller[_0x353a('0x8')]);router['get'](_0x353a('0x9'),auth[_0x353a('0x7')](),controller[_0x353a('0xa')]);router['get'](_0x353a('0xb'),auth[_0x353a('0x7')](),controller[_0x353a('0xc')]);router[_0x353a('0x6')]('/:id/answers',auth[_0x353a('0x7')](),controller['getAnswers']);router[_0x353a('0x6')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0x353a('0xd')]);router[_0x353a('0xe')]('/',auth[_0x353a('0x7')](),controller[_0x353a('0xf')]);router['post'](_0x353a('0x10'),auth[_0x353a('0x7')](),controller[_0x353a('0x11')]);router[_0x353a('0x12')]('/:id',auth[_0x353a('0x7')](),controller[_0x353a('0x13')]);router[_0x353a('0x14')](_0x353a('0x9'),auth['isAuthenticated'](),controller[_0x353a('0x15')]);module[_0x353a('0x16')]=router; \ No newline at end of file +var _0x7819=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions'];(function(_0x183f14,_0x2557e5){var _0x4b543b=function(_0x21218b){while(--_0x21218b){_0x183f14['push'](_0x183f14['shift']());}};_0x4b543b(++_0x2557e5);}(_0x7819,0x95));var _0x9781=function(_0x50cd8c,_0x2c3adb){_0x50cd8c=_0x50cd8c-0x0;var _0x44803b=_0x7819[_0x50cd8c];return _0x44803b;};'use strict';var multer=require(_0x9781('0x0'));var util=require(_0x9781('0x1'));var path=require(_0x9781('0x2'));var timeout=require(_0x9781('0x3'));var express=require('express');var router=express[_0x9781('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9781('0x5'));var config=require(_0x9781('0x6'));var controller=require(_0x9781('0x7'));router[_0x9781('0x8')]('/',auth[_0x9781('0x9')](),controller[_0x9781('0xa')]);router[_0x9781('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9781('0xb')]);router[_0x9781('0x8')](_0x9781('0xc'),auth[_0x9781('0x9')](),controller['getSessions']);router['get'](_0x9781('0xd'),auth[_0x9781('0x9')](),controller[_0x9781('0xe')]);router[_0x9781('0x8')](_0x9781('0xf'),auth[_0x9781('0x9')](),timeout(_0x9781('0x10')),controller[_0x9781('0x11')]);router['post']('/',auth[_0x9781('0x9')](),controller['create']);router[_0x9781('0x12')](_0x9781('0x13'),auth[_0x9781('0x9')](),controller[_0x9781('0x14')]);router[_0x9781('0x15')](_0x9781('0x16'),auth[_0x9781('0x9')](),controller[_0x9781('0x17')]);router[_0x9781('0x18')](_0x9781('0x16'),auth['isAuthenticated'](),controller[_0x9781('0x19')]);module[_0x9781('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 32e51a1..e30bd32 100644 --- a/server/api/jscriptyProject/jscriptyProject.attributes.js +++ b/server/api/jscriptyProject/jscriptyProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc431=['description','BOOLEAN','sequelize','util','STRING','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x24c55d,_0x35e9f0){var _0x3776ba=function(_0x45c5e0){while(--_0x45c5e0){_0x24c55d['push'](_0x24c55d['shift']());}};_0x3776ba(++_0x35e9f0);}(_0xc431,0x179));var _0x1c43=function(_0x259633,_0x59586b){_0x259633=_0x259633-0x0;var _0x2b9761=_0xc431[_0x259633];return _0x2b9761;};'use strict';var Sequelize=require(_0x1c43('0x0'));var _=require('lodash');var util=require(_0x1c43('0x1'));module['exports']={'name':{'type':Sequelize[_0x1c43('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x1c43('0x2')]},'formData':{'type':Sequelize[_0x1c43('0x3')](_0x1c43('0x4')),'set':function(_0x3b5058){if(_[_0x1c43('0x5')](_0x3b5058)){this[_0x1c43('0x6')]('formData',JSON[_0x1c43('0x7')](_0x3b5058));}else if(_[_0x1c43('0x8')](_0x3b5058)){this['setDataValue'](_0x1c43('0x9'),_0x3b5058);}else{this['setDataValue'](_0x1c43('0x9'),util['format'](_0x1c43('0xa'),this[_0x1c43('0xb')](_0x1c43('0xc'))||'',this['getDataValue'](_0x1c43('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1c43('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1c43('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xfaa7=['exports','name','STRING','long','isObjectLike','setDataValue','formData','stringify','format','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x1b0181,_0x58de82){var _0xb47682=function(_0x3a2419){while(--_0x3a2419){_0x1b0181['push'](_0x1b0181['shift']());}};_0xb47682(++_0x58de82);}(_0xfaa7,0x177));var _0x7faa=function(_0x206919,_0x411081){_0x206919=_0x206919-0x0;var _0x1f85f3=_0xfaa7[_0x206919];return _0x1f85f3;};'use strict';var Sequelize=require(_0x7faa('0x0'));var _=require(_0x7faa('0x1'));var util=require(_0x7faa('0x2'));module[_0x7faa('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x7faa('0x4')},'description':{'type':Sequelize[_0x7faa('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x7faa('0x6')),'set':function(_0x54f48b){if(_[_0x7faa('0x7')](_0x54f48b)){this[_0x7faa('0x8')](_0x7faa('0x9'),JSON[_0x7faa('0xa')](_0x54f48b));}else if(_['isString'](_0x54f48b)){this[_0x7faa('0x8')](_0x7faa('0x9'),_0x54f48b);}else{this[_0x7faa('0x8')](_0x7faa('0x9'),util[_0x7faa('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x7faa('0xc')](_0x7faa('0x4'))||'',this[_0x7faa('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7faa('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7faa('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a133819..8cf0792 100644 --- a/server/api/jscriptyProject/jscriptyProject.controller.js +++ b/server/api/jscriptyProject/jscriptyProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf457=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','catch','show','params','keys','length','includeAll','create','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','user','role','Projects','getSessions','JscriptySessionReport','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse'];(function(_0x47e981,_0x5e46b5){var _0xe8d12d=function(_0xb539c2){while(--_0xb539c2){_0x47e981['push'](_0x47e981['shift']());}};_0xe8d12d(++_0x5e46b5);}(_0xf457,0x1c8));var _0x7f45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf457[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7f45('0x0'));var rimraf=require(_0x7f45('0x1'));var zipdir=require(_0x7f45('0x2'));var jsonpatch=require(_0x7f45('0x3'));var rp=require('request-promise');var moment=require(_0x7f45('0x4'));var BPromise=require(_0x7f45('0x5'));var Mustache=require(_0x7f45('0x6'));var util=require('util');var path=require(_0x7f45('0x7'));var sox=require(_0x7f45('0x8'));var csv=require(_0x7f45('0x9'));var ejs=require(_0x7f45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7f45('0xb'));var crypto=require(_0x7f45('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7f45('0xd'));var toCsv=require(_0x7f45('0x9'));var querystring=require(_0x7f45('0xe'));var Papa=require(_0x7f45('0xf'));var Redis=require(_0x7f45('0x10'));var authService=require(_0x7f45('0x11'));var qs=require(_0x7f45('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f45('0x13'));var logger=require('../../config/logger')(_0x7f45('0x14'));var utils=require(_0x7f45('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f45('0x16'));var db=require(_0x7f45('0x17'))['db'];function respondWithStatusCode(_0x4ad96a,_0x17410f){_0x17410f=_0x17410f||0xcc;return function(_0x4394df){if(_0x4394df){return _0x4ad96a['sendStatus'](_0x17410f);}return _0x4ad96a[_0x7f45('0x18')](_0x17410f)[_0x7f45('0x19')]();};}function respondWithResult(_0x95ccd6,_0x580310){_0x580310=_0x580310||0xc8;return function(_0x15b1b7){if(_0x15b1b7){return _0x95ccd6[_0x7f45('0x18')](_0x580310)[_0x7f45('0x1a')](_0x15b1b7);}};}function respondWithFilteredResult(_0x330353,_0x1218b4){return function(_0x454d17){if(_0x454d17){var _0x45bee8=typeof _0x1218b4['offset']===_0x7f45('0x1b')&&typeof _0x1218b4['limit']==='undefined';var _0x120d31=_0x454d17[_0x7f45('0x1c')];var _0x133cee=_0x45bee8?0x0:_0x1218b4[_0x7f45('0x1d')];var _0x4852cc=_0x45bee8?_0x454d17[_0x7f45('0x1c')]:_0x1218b4[_0x7f45('0x1d')]+_0x1218b4[_0x7f45('0x1e')];var _0x2390c4;if(_0x4852cc>=_0x120d31){_0x4852cc=_0x120d31;_0x2390c4=0xc8;}else{_0x2390c4=0xce;}_0x330353['status'](_0x2390c4);return _0x330353[_0x7f45('0x1f')](_0x7f45('0x20'),_0x133cee+'-'+_0x4852cc+'/'+_0x120d31)[_0x7f45('0x1a')](_0x454d17);}return null;};}function patchUpdates(_0x5d67dd){return function(_0x2fd236){try{jsonpatch[_0x7f45('0x21')](_0x2fd236,_0x5d67dd,!![]);}catch(_0x5d4af2){return BPromise[_0x7f45('0x22')](_0x5d4af2);}return _0x2fd236[_0x7f45('0x23')]();};}function saveUpdates(_0x50a9d6,_0x28388b){return function(_0x3dae9c){if(_0x3dae9c){return _0x3dae9c[_0x7f45('0x24')](_0x50a9d6)[_0x7f45('0x25')](function(_0x1d0b7a){return _0x1d0b7a;});}return null;};}function removeEntity(_0x3917b3,_0x5438ad){return function(_0x5d8561){if(_0x5d8561){return _0x5d8561[_0x7f45('0x26')]()['then'](function(){var _0x272c46=_0x5d8561[_0x7f45('0x27')]({'plain':!![]});var _0x3c5ed7='Projects';return db[_0x7f45('0x28')][_0x7f45('0x26')]({'where':{'type':_0x3c5ed7,'resourceId':_0x272c46['id']}})['then'](function(){return _0x5d8561;});})['then'](function(){_0x3917b3[_0x7f45('0x18')](0xcc)[_0x7f45('0x19')]();});}};}function handleEntityNotFound(_0x9ca8d5,_0x3b522b){return function(_0x126c32){if(!_0x126c32){_0x9ca8d5[_0x7f45('0x29')](0x194);}return _0x126c32;};}function handleError(_0x58f494,_0x5c01a5){_0x5c01a5=_0x5c01a5||0x1f4;return function(_0x583244){logger[_0x7f45('0x2a')](_0x583244[_0x7f45('0x2b')]);if(_0x583244[_0x7f45('0x2c')]){delete _0x583244[_0x7f45('0x2c')];}_0x58f494[_0x7f45('0x18')](_0x5c01a5)[_0x7f45('0x2d')](_0x583244);};}exports[_0x7f45('0x2e')]=function(_0x15a0b4,_0x29c6e1){var _0x317bb4={},_0x2f9169={},_0x3c1be7={'count':0x0,'rows':[]};var _0x2c08db=_[_0x7f45('0x2f')](db['JscriptyProject'][_0x7f45('0x30')],function(_0x570ce8){return{'name':_0x570ce8[_0x7f45('0x31')],'type':_0x570ce8[_0x7f45('0x32')][_0x7f45('0x33')]};});_0x2f9169[_0x7f45('0x34')]=_[_0x7f45('0x2f')](_0x2c08db,_0x7f45('0x2c'));_0x2f9169[_0x7f45('0x35')]=_['keys'](_0x15a0b4[_0x7f45('0x35')]);_0x2f9169[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x2f9169[_0x7f45('0x34')],_0x2f9169['query']);_0x317bb4[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x2f9169['model'],qs[_0x7f45('0x39')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x39')]));_0x317bb4['attributes']=_0x317bb4[_0x7f45('0x38')]['length']?_0x317bb4['attributes']:_0x2f9169[_0x7f45('0x34')];if(!_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3a')](_0x7f45('0x3b'))){_0x317bb4[_0x7f45('0x1e')]=qs[_0x7f45('0x1e')](_0x15a0b4[_0x7f45('0x35')]['limit']);_0x317bb4['offset']=qs[_0x7f45('0x1d')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x1d')]);}_0x317bb4[_0x7f45('0x3c')]=qs[_0x7f45('0x3d')](_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3d')]);_0x317bb4[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_['pick'](_0x15a0b4[_0x7f45('0x35')],_0x2f9169[_0x7f45('0x36')]),_0x2c08db);if(_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3f')]){_0x317bb4['where']=_[_0x7f45('0x40')](_0x317bb4[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0x2c08db,function(_0x2d3e1d){if(_0x2d3e1d[_0x7f45('0x32')]!==_0x7f45('0x41')){var _0x4881d2={};_0x4881d2[_0x2d3e1d[_0x7f45('0x2c')]]={'$like':'%'+_0x15a0b4[_0x7f45('0x35')][_0x7f45('0x3f')]+'%'};return _0x4881d2;}})});}_0x317bb4=_[_0x7f45('0x40')]({},_0x317bb4,_0x15a0b4[_0x7f45('0x42')]);var _0x30f488={'where':_0x317bb4['where']};return db[_0x7f45('0x43')][_0x7f45('0x1c')](_0x30f488)[_0x7f45('0x25')](function(_0x407e01){_0x3c1be7['count']=_0x407e01;if(_0x15a0b4[_0x7f45('0x35')]['includeAll']){_0x317bb4[_0x7f45('0x44')]=[{'all':!![]}];}return db[_0x7f45('0x43')][_0x7f45('0x45')](_0x317bb4);})[_0x7f45('0x25')](function(_0x447dec){_0x3c1be7['rows']=_0x447dec;return _0x3c1be7;})[_0x7f45('0x25')](respondWithFilteredResult(_0x29c6e1,_0x317bb4))[_0x7f45('0x46')](handleError(_0x29c6e1,null));};exports[_0x7f45('0x47')]=function(_0x16e11d,_0x55f86c){var _0x42ce83={'raw':![],'where':{'id':_0x16e11d[_0x7f45('0x48')]['id']}},_0x451892={};_0x451892['model']=_[_0x7f45('0x49')](db[_0x7f45('0x43')][_0x7f45('0x30')]);_0x451892['query']=_[_0x7f45('0x49')](_0x16e11d['query']);_0x451892[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x451892[_0x7f45('0x34')],_0x451892[_0x7f45('0x35')]);_0x42ce83[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x451892['model'],qs[_0x7f45('0x39')](_0x16e11d[_0x7f45('0x35')][_0x7f45('0x39')]));_0x42ce83['attributes']=_0x42ce83[_0x7f45('0x38')][_0x7f45('0x4a')]?_0x42ce83[_0x7f45('0x38')]:_0x451892['model'];if(_0x16e11d[_0x7f45('0x35')][_0x7f45('0x4b')]){_0x42ce83['include']=[{'all':!![]}];}_0x42ce83=_[_0x7f45('0x40')]({},_0x42ce83,_0x16e11d['options']);return db['JscriptyProject']['find'](_0x42ce83)[_0x7f45('0x25')](handleEntityNotFound(_0x55f86c,null))['then'](respondWithResult(_0x55f86c,null))['catch'](handleError(_0x55f86c,null));};exports['create']=function(_0x58d14d,_0x2a1300){return db[_0x7f45('0x43')][_0x7f45('0x4c')](_0x58d14d['body'],{})['then'](function(_0x427f66){var _0xec196f=_0x58d14d['user'][_0x7f45('0x27')]({'plain':!![]});if(!_0xec196f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec196f['role']==='user'){var _0x3ade33=_0x427f66[_0x7f45('0x27')]({'plain':!![]});var _0x4b273f='Projects';return db[_0x7f45('0x4d')][_0x7f45('0x4e')]({'where':{'name':_0x4b273f,'userProfileId':_0xec196f['userProfileId']},'raw':!![]})[_0x7f45('0x25')](function(_0x481a57){if(_0x481a57&&_0x481a57[_0x7f45('0x4f')]===0x0){return db[_0x7f45('0x28')][_0x7f45('0x4c')]({'name':_0x3ade33[_0x7f45('0x2c')],'resourceId':_0x3ade33['id'],'type':_0x481a57[_0x7f45('0x2c')],'sectionId':_0x481a57['id']},{})[_0x7f45('0x25')](function(){return _0x427f66;});}else{return _0x427f66;}})[_0x7f45('0x46')](function(_0xb443ce){logger[_0x7f45('0x2a')](_0x7f45('0x50'),_0xb443ce);throw _0xb443ce;});}return _0x427f66;})[_0x7f45('0x25')](respondWithResult(_0x2a1300,0xc9))[_0x7f45('0x46')](handleError(_0x2a1300,null));};exports[_0x7f45('0x51')]=function(_0x20ea6b,_0x33ba70){var _0x5467f1={'where':{'id':_0x20ea6b['params']['id']}},_0x28cbd0={};_0x28cbd0[_0x7f45('0x34')]=_[_0x7f45('0x49')](db[_0x7f45('0x43')][_0x7f45('0x30')]);_0x5467f1[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x28cbd0[_0x7f45('0x34')],qs[_0x7f45('0x39')](_0x20ea6b[_0x7f45('0x35')][_0x7f45('0x39')]));_0x5467f1[_0x7f45('0x38')]=_0x5467f1['attributes']['length']?_0x5467f1[_0x7f45('0x38')]:_0x28cbd0[_0x7f45('0x34')];if(_0x20ea6b[_0x7f45('0x35')][_0x7f45('0x4b')]){_0x5467f1[_0x7f45('0x44')]=[{'all':!![]}];}_0x5467f1=_[_0x7f45('0x40')]({},_0x5467f1,_0x20ea6b[_0x7f45('0x42')]);return db[_0x7f45('0x43')]['find'](_0x5467f1)[_0x7f45('0x25')](handleEntityNotFound(_0x33ba70,null))['then'](function(_0xda86bc){if(_0xda86bc){var _0xd30932=_0xda86bc[_0x7f45('0x27')]({'plain':!![]});_0xd30932=qs[_0x7f45('0x52')](_0xd30932,['id','createdAt',_0x7f45('0x53')]);_0x20ea6b[_0x7f45('0x54')]=_['omit'](_0x20ea6b[_0x7f45('0x54')],['id',_0x7f45('0x55'),_0x7f45('0x53')]);return db[_0x7f45('0x43')][_0x7f45('0x4c')](_[_0x7f45('0x40')](_0xd30932,_0x20ea6b[_0x7f45('0x54')]),{'include':_0x20ea6b[_0x7f45('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x7f45('0x25')](function(_0xfdf3ae){var _0x10a000=_0x20ea6b[_0x7f45('0x56')]['get']({'plain':!![]});if(!_0x10a000)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10a000[_0x7f45('0x57')]===_0x7f45('0x56')){var _0x2cb361=_0xfdf3ae[_0x7f45('0x27')]({'plain':!![]});var _0x1b9af3=_0x7f45('0x58');return db[_0x7f45('0x4d')][_0x7f45('0x4e')]({'where':{'name':_0x1b9af3,'userProfileId':_0x10a000['userProfileId']},'raw':!![]})[_0x7f45('0x25')](function(_0x5ebf21){if(_0x5ebf21&&_0x5ebf21[_0x7f45('0x4f')]===0x0){return db[_0x7f45('0x28')][_0x7f45('0x4c')]({'name':_0x2cb361[_0x7f45('0x2c')],'resourceId':_0x2cb361['id'],'type':_0x5ebf21[_0x7f45('0x2c')],'sectionId':_0x5ebf21['id']},{})[_0x7f45('0x25')](function(){return _0xfdf3ae;});}else{return _0xfdf3ae;}})['catch'](function(_0x1a969b){logger[_0x7f45('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a969b);throw _0x1a969b;});}return _0xfdf3ae;});}})[_0x7f45('0x25')](respondWithResult(_0x33ba70,0xc9))[_0x7f45('0x46')](handleError(_0x33ba70,null));};exports[_0x7f45('0x24')]=function(_0x5a5b2b,_0x1239db){if(_0x5a5b2b[_0x7f45('0x54')]['id']){delete _0x5a5b2b[_0x7f45('0x54')]['id'];}return db[_0x7f45('0x43')][_0x7f45('0x4e')]({'where':{'id':_0x5a5b2b[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x1239db,null))[_0x7f45('0x25')](saveUpdates(_0x5a5b2b[_0x7f45('0x54')],null))[_0x7f45('0x25')](respondWithResult(_0x1239db,null))['catch'](handleError(_0x1239db,null));};exports[_0x7f45('0x26')]=function(_0x1035d6,_0x232a0d){return db[_0x7f45('0x43')]['find']({'where':{'id':_0x1035d6[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x232a0d,null))[_0x7f45('0x25')](removeEntity(_0x232a0d,null))['catch'](handleError(_0x232a0d,null));};exports[_0x7f45('0x59')]=function(_0x1f883c,_0x32c266,_0x58684f){var _0x4ffe61={'raw':!![],'where':{}};var _0x3f58b8={};var _0x415374={'count':0x0,'rows':[]};return db[_0x7f45('0x43')]['findOne']({'where':{'id':_0x1f883c[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x32c266,null))['then'](function(_0x1de280){if(_0x1de280){_0x3f58b8['model']=_[_0x7f45('0x49')](db[_0x7f45('0x5a')][_0x7f45('0x30')]);_0x3f58b8[_0x7f45('0x35')]=_[_0x7f45('0x49')](_0x1f883c[_0x7f45('0x35')]);_0x3f58b8[_0x7f45('0x36')]=_[_0x7f45('0x37')](_0x3f58b8['model'],_0x3f58b8[_0x7f45('0x35')]);_0x4ffe61[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x3f58b8['model'],qs[_0x7f45('0x39')](_0x1f883c[_0x7f45('0x35')][_0x7f45('0x39')]));_0x4ffe61[_0x7f45('0x38')]=_0x4ffe61[_0x7f45('0x38')][_0x7f45('0x4a')]?_0x4ffe61[_0x7f45('0x38')]:_0x3f58b8[_0x7f45('0x34')];if(!_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3a')](_0x7f45('0x3b'))){_0x4ffe61['limit']=qs[_0x7f45('0x1e')](_0x1f883c['query']['limit']);_0x4ffe61[_0x7f45('0x1d')]=qs[_0x7f45('0x1d')](_0x1f883c[_0x7f45('0x35')][_0x7f45('0x1d')]);}_0x4ffe61[_0x7f45('0x3c')]=qs['sort'](_0x1f883c['query']['sort']);_0x4ffe61[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_[_0x7f45('0x5b')](_0x1f883c['query'],_0x3f58b8[_0x7f45('0x36')]));_0x4ffe61[_0x7f45('0x3e')][_0x7f45('0x5c')]=_0x1de280['id'];if(_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3f')]){_0x4ffe61[_0x7f45('0x3e')]=_[_0x7f45('0x40')](_0x4ffe61[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0x4ffe61[_0x7f45('0x38')],function(_0x343de7){var _0x3ce8cf={};_0x3ce8cf[_0x343de7]={'$like':'%'+_0x1f883c[_0x7f45('0x35')][_0x7f45('0x3f')]+'%'};return _0x3ce8cf;})});}_0x4ffe61=_[_0x7f45('0x40')]({},_0x4ffe61,_0x1f883c[_0x7f45('0x42')]);return db['JscriptySessionReport'][_0x7f45('0x1c')]({'where':_0x4ffe61['where']})[_0x7f45('0x25')](function(_0x586384){_0x415374[_0x7f45('0x1c')]=_0x586384;if(_0x1f883c[_0x7f45('0x35')]['includeAll']){_0x4ffe61['include']=[{'all':!![]}];}return db[_0x7f45('0x5a')]['findAll'](_0x4ffe61);})[_0x7f45('0x25')](function(_0x5e240f){_0x415374[_0x7f45('0x5d')]=_0x5e240f;return _0x415374;});}})[_0x7f45('0x25')](respondWithFilteredResult(_0x32c266,_0x4ffe61))[_0x7f45('0x46')](handleError(_0x32c266,null));};exports[_0x7f45('0x5e')]=function(_0x48e4a9,_0x318844,_0x271c91){var _0xaf4fa7={'raw':!![],'where':{}};var _0x4c7bd6={};var _0x4d4beb={'count':0x0,'rows':[]};return db[_0x7f45('0x43')]['findOne']({'where':{'id':_0x48e4a9[_0x7f45('0x48')]['id']}})[_0x7f45('0x25')](handleEntityNotFound(_0x318844,null))[_0x7f45('0x25')](function(_0x4b1e4a){if(_0x4b1e4a){_0x4c7bd6['model']=_[_0x7f45('0x49')](db[_0x7f45('0x5f')]['rawAttributes']);_0x4c7bd6[_0x7f45('0x35')]=_[_0x7f45('0x49')](_0x48e4a9[_0x7f45('0x35')]);_0x4c7bd6['filters']=_['intersection'](_0x4c7bd6[_0x7f45('0x34')],_0x4c7bd6[_0x7f45('0x35')]);_0xaf4fa7[_0x7f45('0x38')]=_[_0x7f45('0x37')](_0x4c7bd6[_0x7f45('0x34')],qs['fields'](_0x48e4a9['query'][_0x7f45('0x39')]));_0xaf4fa7['attributes']=_0xaf4fa7['attributes']['length']?_0xaf4fa7[_0x7f45('0x38')]:_0x4c7bd6[_0x7f45('0x34')];if(!_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x3a')]('nolimit')){_0xaf4fa7['limit']=qs[_0x7f45('0x1e')](_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x1e')]);_0xaf4fa7[_0x7f45('0x1d')]=qs[_0x7f45('0x1d')](_0x48e4a9['query'][_0x7f45('0x1d')]);}_0xaf4fa7[_0x7f45('0x3c')]=qs[_0x7f45('0x3d')](_0x48e4a9[_0x7f45('0x35')]['sort']);_0xaf4fa7[_0x7f45('0x3e')]=qs[_0x7f45('0x36')](_[_0x7f45('0x5b')](_0x48e4a9[_0x7f45('0x35')],_0x4c7bd6['filters']));_0xaf4fa7[_0x7f45('0x3e')][_0x7f45('0x5c')]=_0x4b1e4a['id'];if(_0x48e4a9['query']['filter']){_0xaf4fa7[_0x7f45('0x3e')]=_[_0x7f45('0x40')](_0xaf4fa7[_0x7f45('0x3e')],{'$or':_[_0x7f45('0x2f')](_0xaf4fa7['attributes'],function(_0x567da6){var _0x48c023={};_0x48c023[_0x567da6]={'$like':'%'+_0x48e4a9['query']['filter']+'%'};return _0x48c023;})});}_0xaf4fa7=_['merge']({},_0xaf4fa7,_0x48e4a9[_0x7f45('0x42')]);return db['JscriptyAnswerReport'][_0x7f45('0x1c')]({'where':_0xaf4fa7[_0x7f45('0x3e')]})[_0x7f45('0x25')](function(_0x570c32){_0x4d4beb['count']=_0x570c32;if(_0x48e4a9[_0x7f45('0x35')][_0x7f45('0x4b')]){_0xaf4fa7[_0x7f45('0x44')]=[{'all':!![]}];}return db[_0x7f45('0x5f')]['findAll'](_0xaf4fa7);})[_0x7f45('0x25')](function(_0x1c896){_0x4d4beb[_0x7f45('0x5d')]=_0x1c896;return _0x4d4beb;});}})[_0x7f45('0x25')](respondWithFilteredResult(_0x318844,_0xaf4fa7))[_0x7f45('0x46')](handleError(_0x318844,null));};function char(_0x8eb800){return _0x7f45('0x60')===typeof _0x8eb800?String['fromCharCode'][_0x7f45('0x21')](null,arguments):_0x8eb800;}function needsEncapsulation(_0x42acba){return!!_0x42acba&&(_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0xd))>=0x0||_0x42acba['toString']()[_0x7f45('0x62')](char(0xa))>=0x0||_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0x2c))>=0x0||_0x42acba[_0x7f45('0x61')]()[_0x7f45('0x62')](char(0x22))>=0x0);}function encapsulate(_0x52b732){var _0x569394=char(0x22),_0x3d1371='\x5c'+char(0x22),_0x1d6833=_0x52b732[_0x7f45('0x61')]()[_0x7f45('0x63')](new RegExp(_0x569394,'g'),_0x3d1371);return _0x569394+_0x1d6833+_0x569394;}exports['getSummary']=function(_0x111d92,_0x177bab,_0x203f87){var _0x1830b1,_0x282542;var _0x4fb7f9={'where':{'ProjectId':_0x111d92['params']['id']}};if(_0x111d92['query'][_0x7f45('0x64')]){_0x4fb7f9[_0x7f45('0x3e')][_0x7f45('0x65')]=JSON[_0x7f45('0x66')](_0x111d92[_0x7f45('0x35')][_0x7f45('0x64')]);}return db[_0x7f45('0x5a')][_0x7f45('0x45')](_0x4fb7f9)[_0x7f45('0x25')](handleEntityNotFound(_0x177bab,null))['then'](function(_0x4f40e3){if(_0x4f40e3){_0x1830b1=_0x4f40e3;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x7f45('0x2f')](_0x1830b1,'id')},'ProjectId':_0x111d92[_0x7f45('0x48')]['id']},'order':_0x7f45('0x67')});}})[_0x7f45('0x25')](handleEntityNotFound(_0x177bab,null))[_0x7f45('0x25')](function(_0x57858e){if(_0x57858e){_0x282542=_0x57858e;var _0x4b1765={};for(var _0x4b8b3f=0x0,_0x18fdff=_0x282542[_0x7f45('0x4a')];_0x4b8b3f<_0x18fdff;_0x4b8b3f++){if(!_0x4b1765[_0x7f45('0x3a')](_0x282542[_0x4b8b3f][_0x7f45('0x68')])){_0x4b1765[_0x282542[_0x4b8b3f]['questionId']]=needsEncapsulation(_0x282542[_0x4b8b3f]['question'])?encapsulate(_0x282542[_0x4b8b3f][_0x7f45('0x69')]):_0x282542[_0x4b8b3f][_0x7f45('0x69')];}}var _0x5c49a1=[],_0x37a445={};for(var _0x313409=0x0,_0x3bfe68=_0x1830b1[_0x7f45('0x4a')];_0x313409<_0x3bfe68;_0x313409++){_0x37a445={'ProjectId':_0x111d92[_0x7f45('0x48')]['id'],'SessionId':_0x1830b1[_0x313409]['id'],'StartTime':moment(_0x1830b1[_0x313409][_0x7f45('0x65')])[_0x7f45('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1b97ad=0x0,_0x1b9010=_0x282542[_0x7f45('0x4a')];_0x1b97ad<_0x1b9010;_0x1b97ad++){if(_0x282542[_0x1b97ad][_0x7f45('0x6b')]==_0x1830b1[_0x313409]['id']&&_0x4b1765[_0x7f45('0x3a')](_0x282542[_0x1b97ad][_0x7f45('0x68')])){_0x37a445[_0x4b1765[_0x282542[_0x1b97ad][_0x7f45('0x68')]]]=_0x282542[_0x1b97ad][_0x7f45('0x6c')];}}for(var _0x30f369 in _0x4b1765){if(!_0x37a445[_0x7f45('0x3a')](_0x4b1765[_0x30f369])){_0x37a445[_0x4b1765[_0x30f369]]=null;}}_0x5c49a1['push'](_0x37a445);}return _0x5c49a1;}})[_0x7f45('0x25')](function(_0x1a2db9){if(!_[_0x7f45('0x6d')](_0x1a2db9)){var _0x564678=toCsv(_0x1a2db9);var _0x2b8377=Date[_0x7f45('0x6e')]();fs[_0x7f45('0x6f')](util[_0x7f45('0x6a')](_0x7f45('0x70'),_0x111d92['params']['id'],_0x2b8377),_0x564678);_0x177bab['setHeader']('Content-disposition',_0x7f45('0x71')+util[_0x7f45('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x111d92['params']['id'],_0x2b8377));_0x177bab[_0x7f45('0x72')](_0x7f45('0x73'),_0x7f45('0x74'));return _0x177bab[_0x7f45('0x75')](util[_0x7f45('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x111d92['params']['id'],_0x2b8377));}else{return _0x177bab[_0x7f45('0x29')](0xcc);}})[_0x7f45('0x46')](handleError(_0x177bab,null));}; \ No newline at end of file +var _0xa1c4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','options','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','userProfileId','autoAssociation','findOne','JscriptySessionReport','hasOwnProperty','nolimit','pick','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21e48b,_0x276138){var _0x446cbd=function(_0x327dd3){while(--_0x327dd3){_0x21e48b['push'](_0x21e48b['shift']());}};_0x446cbd(++_0x276138);}(_0xa1c4,0xdf));var _0x4a1c=function(_0x5d75ff,_0x5bc7ac){_0x5d75ff=_0x5d75ff-0x0;var _0x1c1894=_0xa1c4[_0x5d75ff];return _0x1c1894;};'use strict';var emlformat=require(_0x4a1c('0x0'));var rimraf=require(_0x4a1c('0x1'));var zipdir=require(_0x4a1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a1c('0x3'));var BPromise=require(_0x4a1c('0x4'));var Mustache=require(_0x4a1c('0x5'));var util=require(_0x4a1c('0x6'));var path=require(_0x4a1c('0x7'));var sox=require(_0x4a1c('0x8'));var csv=require(_0x4a1c('0x9'));var ejs=require(_0x4a1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a1c('0xb'));var squel=require(_0x4a1c('0xc'));var crypto=require(_0x4a1c('0xd'));var jsforce=require(_0x4a1c('0xe'));var deskjs=require(_0x4a1c('0xf'));var toCsv=require(_0x4a1c('0x9'));var querystring=require(_0x4a1c('0x10'));var Papa=require(_0x4a1c('0x11'));var Redis=require(_0x4a1c('0x12'));var authService=require(_0x4a1c('0x13'));var qs=require(_0x4a1c('0x14'));var as=require(_0x4a1c('0x15'));var hardwareService=require(_0x4a1c('0x16'));var logger=require(_0x4a1c('0x17'))(_0x4a1c('0x18'));var utils=require(_0x4a1c('0x19'));var config=require(_0x4a1c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e280a,_0x5d2c2d){_0x5d2c2d=_0x5d2c2d||0xcc;return function(_0x16b675){if(_0x16b675){return _0x1e280a[_0x4a1c('0x1b')](_0x5d2c2d);}return _0x1e280a[_0x4a1c('0x1c')](_0x5d2c2d)[_0x4a1c('0x1d')]();};}function respondWithResult(_0x1cccc7,_0x35cb05){_0x35cb05=_0x35cb05||0xc8;return function(_0x17ab65){if(_0x17ab65){return _0x1cccc7['status'](_0x35cb05)[_0x4a1c('0x1e')](_0x17ab65);}};}function respondWithFilteredResult(_0x32ed8b,_0x4f10be){return function(_0x48134d){if(_0x48134d){var _0x4d6437=typeof _0x4f10be[_0x4a1c('0x1f')]===_0x4a1c('0x20')&&typeof _0x4f10be['limit']==='undefined';var _0x470e99=_0x48134d[_0x4a1c('0x21')];var _0xc269a4=_0x4d6437?0x0:_0x4f10be[_0x4a1c('0x1f')];var _0x328efc=_0x4d6437?_0x48134d[_0x4a1c('0x21')]:_0x4f10be[_0x4a1c('0x1f')]+_0x4f10be[_0x4a1c('0x22')];var _0x2d4c39;if(_0x328efc>=_0x470e99){_0x328efc=_0x470e99;_0x2d4c39=0xc8;}else{_0x2d4c39=0xce;}_0x32ed8b['status'](_0x2d4c39);return _0x32ed8b[_0x4a1c('0x23')]('Content-Range',_0xc269a4+'-'+_0x328efc+'/'+_0x470e99)[_0x4a1c('0x1e')](_0x48134d);}return null;};}function patchUpdates(_0x23bfb2){return function(_0x7c8579){try{jsonpatch[_0x4a1c('0x24')](_0x7c8579,_0x23bfb2,!![]);}catch(_0x290b71){return BPromise[_0x4a1c('0x25')](_0x290b71);}return _0x7c8579[_0x4a1c('0x26')]();};}function saveUpdates(_0xac9f4e,_0x295d2f){return function(_0x52bece){if(_0x52bece){return _0x52bece[_0x4a1c('0x27')](_0xac9f4e)[_0x4a1c('0x28')](function(_0x29e7fa){return _0x29e7fa;});}return null;};}function removeEntity(_0x14c517,_0x419f3c){return function(_0x18d6b1){if(_0x18d6b1){return _0x18d6b1[_0x4a1c('0x29')]()[_0x4a1c('0x28')](function(){var _0x1c4d4f=_0x18d6b1[_0x4a1c('0x2a')]({'plain':!![]});var _0x3a0796='Projects';return db['UserProfileResource']['destroy']({'where':{'type':_0x3a0796,'resourceId':_0x1c4d4f['id']}})['then'](function(){return _0x18d6b1;});})[_0x4a1c('0x28')](function(){_0x14c517[_0x4a1c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4595e6,_0x404120){return function(_0x1f9475){if(!_0x1f9475){_0x4595e6[_0x4a1c('0x1b')](0x194);}return _0x1f9475;};}function handleError(_0x304268,_0x3cc8ea){_0x3cc8ea=_0x3cc8ea||0x1f4;return function(_0x45353a){logger[_0x4a1c('0x2b')](_0x45353a['stack']);if(_0x45353a['name']){delete _0x45353a[_0x4a1c('0x2c')];}_0x304268['status'](_0x3cc8ea)[_0x4a1c('0x2d')](_0x45353a);};}exports[_0x4a1c('0x2e')]=function(_0x5b7379,_0x2c567d){var _0x307c85={},_0x2dcf74={},_0x365c65={'count':0x0,'rows':[]};var _0x42da23=_[_0x4a1c('0x2f')](db[_0x4a1c('0x30')][_0x4a1c('0x31')],function(_0x184dba){return{'name':_0x184dba[_0x4a1c('0x32')],'type':_0x184dba['type'][_0x4a1c('0x33')]};});_0x2dcf74[_0x4a1c('0x34')]=_[_0x4a1c('0x2f')](_0x42da23,'name');_0x2dcf74[_0x4a1c('0x35')]=_[_0x4a1c('0x36')](_0x5b7379[_0x4a1c('0x35')]);_0x2dcf74['filters']=_[_0x4a1c('0x37')](_0x2dcf74[_0x4a1c('0x34')],_0x2dcf74[_0x4a1c('0x35')]);_0x307c85[_0x4a1c('0x38')]=_['intersection'](_0x2dcf74['model'],qs[_0x4a1c('0x39')](_0x5b7379[_0x4a1c('0x35')][_0x4a1c('0x39')]));_0x307c85['attributes']=_0x307c85[_0x4a1c('0x38')][_0x4a1c('0x3a')]?_0x307c85[_0x4a1c('0x38')]:_0x2dcf74[_0x4a1c('0x34')];if(!_0x5b7379['query']['hasOwnProperty']('nolimit')){_0x307c85[_0x4a1c('0x22')]=qs[_0x4a1c('0x22')](_0x5b7379[_0x4a1c('0x35')]['limit']);_0x307c85[_0x4a1c('0x1f')]=qs['offset'](_0x5b7379[_0x4a1c('0x35')][_0x4a1c('0x1f')]);}_0x307c85[_0x4a1c('0x3b')]=qs[_0x4a1c('0x3c')](_0x5b7379[_0x4a1c('0x35')][_0x4a1c('0x3c')]);_0x307c85[_0x4a1c('0x3d')]=qs[_0x4a1c('0x3e')](_['pick'](_0x5b7379[_0x4a1c('0x35')],_0x2dcf74[_0x4a1c('0x3e')]),_0x42da23);if(_0x5b7379['query'][_0x4a1c('0x3f')]){_0x307c85[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](_0x307c85[_0x4a1c('0x3d')],{'$or':_['map'](_0x42da23,function(_0x4a314c){if(_0x4a314c['type']!=='VIRTUAL'){var _0xf87d1e={};_0xf87d1e[_0x4a314c[_0x4a1c('0x2c')]]={'$like':'%'+_0x5b7379[_0x4a1c('0x35')]['filter']+'%'};return _0xf87d1e;}})});}_0x307c85=_[_0x4a1c('0x40')]({},_0x307c85,_0x5b7379[_0x4a1c('0x41')]);var _0x5653c1={'where':_0x307c85[_0x4a1c('0x3d')]};return db[_0x4a1c('0x30')][_0x4a1c('0x21')](_0x5653c1)[_0x4a1c('0x28')](function(_0x5fba68){_0x365c65['count']=_0x5fba68;if(_0x5b7379['query']['includeAll']){_0x307c85[_0x4a1c('0x42')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x307c85);})[_0x4a1c('0x28')](function(_0x4e799c){_0x365c65[_0x4a1c('0x43')]=_0x4e799c;return _0x365c65;})[_0x4a1c('0x28')](respondWithFilteredResult(_0x2c567d,_0x307c85))[_0x4a1c('0x44')](handleError(_0x2c567d,null));};exports[_0x4a1c('0x45')]=function(_0xfea559,_0x4c9226){var _0x1ea13c={'raw':![],'where':{'id':_0xfea559[_0x4a1c('0x46')]['id']}},_0x810f2e={};_0x810f2e['model']=_[_0x4a1c('0x36')](db[_0x4a1c('0x30')]['rawAttributes']);_0x810f2e[_0x4a1c('0x35')]=_[_0x4a1c('0x36')](_0xfea559[_0x4a1c('0x35')]);_0x810f2e[_0x4a1c('0x3e')]=_['intersection'](_0x810f2e[_0x4a1c('0x34')],_0x810f2e[_0x4a1c('0x35')]);_0x1ea13c[_0x4a1c('0x38')]=_[_0x4a1c('0x37')](_0x810f2e[_0x4a1c('0x34')],qs[_0x4a1c('0x39')](_0xfea559[_0x4a1c('0x35')][_0x4a1c('0x39')]));_0x1ea13c[_0x4a1c('0x38')]=_0x1ea13c[_0x4a1c('0x38')]['length']?_0x1ea13c['attributes']:_0x810f2e[_0x4a1c('0x34')];if(_0xfea559[_0x4a1c('0x35')]['includeAll']){_0x1ea13c[_0x4a1c('0x42')]=[{'all':!![]}];}_0x1ea13c=_[_0x4a1c('0x40')]({},_0x1ea13c,_0xfea559[_0x4a1c('0x41')]);return db[_0x4a1c('0x30')][_0x4a1c('0x47')](_0x1ea13c)[_0x4a1c('0x28')](handleEntityNotFound(_0x4c9226,null))['then'](respondWithResult(_0x4c9226,null))[_0x4a1c('0x44')](handleError(_0x4c9226,null));};exports['create']=function(_0x286896,_0x384c1d){return db[_0x4a1c('0x30')][_0x4a1c('0x48')](_0x286896[_0x4a1c('0x49')],{})[_0x4a1c('0x28')](function(_0x399efe){var _0x3126cd=_0x286896[_0x4a1c('0x4a')]['get']({'plain':!![]});if(!_0x3126cd)throw new Error(_0x4a1c('0x4b'));if(_0x3126cd[_0x4a1c('0x4c')]==='user'){var _0x11d28a=_0x399efe['get']({'plain':!![]});var _0x37eded=_0x4a1c('0x4d');return db[_0x4a1c('0x4e')][_0x4a1c('0x47')]({'where':{'name':_0x37eded,'userProfileId':_0x3126cd['userProfileId']},'raw':!![]})[_0x4a1c('0x28')](function(_0x110cdf){if(_0x110cdf&&_0x110cdf['autoAssociation']===0x0){return db[_0x4a1c('0x4f')][_0x4a1c('0x48')]({'name':_0x11d28a[_0x4a1c('0x2c')],'resourceId':_0x11d28a['id'],'type':_0x110cdf[_0x4a1c('0x2c')],'sectionId':_0x110cdf['id']},{})['then'](function(){return _0x399efe;});}else{return _0x399efe;}})['catch'](function(_0x54060c){logger['error'](_0x4a1c('0x50'),_0x54060c);throw _0x54060c;});}return _0x399efe;})[_0x4a1c('0x28')](respondWithResult(_0x384c1d,0xc9))[_0x4a1c('0x44')](handleError(_0x384c1d,null));};exports[_0x4a1c('0x51')]=function(_0x4b02f6,_0x5095b9){var _0x4dc7e0={'where':{'id':_0x4b02f6['params']['id']}},_0x494890={};_0x494890[_0x4a1c('0x34')]=_[_0x4a1c('0x36')](db[_0x4a1c('0x30')]['rawAttributes']);_0x4dc7e0['attributes']=_[_0x4a1c('0x37')](_0x494890['model'],qs['fields'](_0x4b02f6[_0x4a1c('0x35')][_0x4a1c('0x39')]));_0x4dc7e0[_0x4a1c('0x38')]=_0x4dc7e0[_0x4a1c('0x38')][_0x4a1c('0x3a')]?_0x4dc7e0[_0x4a1c('0x38')]:_0x494890['model'];if(_0x4b02f6[_0x4a1c('0x35')][_0x4a1c('0x52')]){_0x4dc7e0[_0x4a1c('0x42')]=[{'all':!![]}];}_0x4dc7e0=_[_0x4a1c('0x40')]({},_0x4dc7e0,_0x4b02f6[_0x4a1c('0x41')]);return db['JscriptyProject']['find'](_0x4dc7e0)[_0x4a1c('0x28')](handleEntityNotFound(_0x5095b9,null))[_0x4a1c('0x28')](function(_0x55e68f){if(_0x55e68f){var _0x37548e=_0x55e68f['get']({'plain':!![]});_0x37548e=qs[_0x4a1c('0x53')](_0x37548e,['id',_0x4a1c('0x54'),_0x4a1c('0x55')]);_0x4b02f6[_0x4a1c('0x49')]=_[_0x4a1c('0x53')](_0x4b02f6[_0x4a1c('0x49')],['id',_0x4a1c('0x54'),_0x4a1c('0x55')]);return db['JscriptyProject']['create'](_[_0x4a1c('0x40')](_0x37548e,_0x4b02f6[_0x4a1c('0x49')]),{'include':_0x4b02f6['query'][_0x4a1c('0x52')]?[{'all':!![]}]:undefined})[_0x4a1c('0x28')](function(_0x29955b){var _0x19dbc8=_0x4b02f6[_0x4a1c('0x4a')][_0x4a1c('0x2a')]({'plain':!![]});if(!_0x19dbc8)throw new Error(_0x4a1c('0x4b'));if(_0x19dbc8[_0x4a1c('0x4c')]==='user'){var _0x3c85b1=_0x29955b['get']({'plain':!![]});var _0x33a3ea=_0x4a1c('0x4d');return db[_0x4a1c('0x4e')][_0x4a1c('0x47')]({'where':{'name':_0x33a3ea,'userProfileId':_0x19dbc8[_0x4a1c('0x56')]},'raw':!![]})['then'](function(_0x5cc7c3){if(_0x5cc7c3&&_0x5cc7c3[_0x4a1c('0x57')]===0x0){return db['UserProfileResource'][_0x4a1c('0x48')]({'name':_0x3c85b1[_0x4a1c('0x2c')],'resourceId':_0x3c85b1['id'],'type':_0x5cc7c3[_0x4a1c('0x2c')],'sectionId':_0x5cc7c3['id']},{})[_0x4a1c('0x28')](function(){return _0x29955b;});}else{return _0x29955b;}})[_0x4a1c('0x44')](function(_0x410d0b){logger[_0x4a1c('0x2b')](_0x4a1c('0x50'),_0x410d0b);throw _0x410d0b;});}return _0x29955b;});}})[_0x4a1c('0x28')](respondWithResult(_0x5095b9,0xc9))[_0x4a1c('0x44')](handleError(_0x5095b9,null));};exports[_0x4a1c('0x27')]=function(_0x3b9555,_0x1f7805){if(_0x3b9555[_0x4a1c('0x49')]['id']){delete _0x3b9555[_0x4a1c('0x49')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x3b9555[_0x4a1c('0x46')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x1f7805,null))['then'](saveUpdates(_0x3b9555[_0x4a1c('0x49')],null))[_0x4a1c('0x28')](respondWithResult(_0x1f7805,null))[_0x4a1c('0x44')](handleError(_0x1f7805,null));};exports['destroy']=function(_0x4928dd,_0xd0430d){return db[_0x4a1c('0x30')]['find']({'where':{'id':_0x4928dd[_0x4a1c('0x46')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0xd0430d,null))[_0x4a1c('0x28')](removeEntity(_0xd0430d,null))[_0x4a1c('0x44')](handleError(_0xd0430d,null));};exports['getSessions']=function(_0x1357ed,_0x54fe91,_0x3776b5){var _0x55fc1c={'raw':!![],'where':{}};var _0x3824d2={};var _0x72e203={'count':0x0,'rows':[]};return db[_0x4a1c('0x30')][_0x4a1c('0x58')]({'where':{'id':_0x1357ed[_0x4a1c('0x46')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x54fe91,null))[_0x4a1c('0x28')](function(_0x384b0a){if(_0x384b0a){_0x3824d2[_0x4a1c('0x34')]=_['keys'](db[_0x4a1c('0x59')]['rawAttributes']);_0x3824d2[_0x4a1c('0x35')]=_[_0x4a1c('0x36')](_0x1357ed['query']);_0x3824d2['filters']=_[_0x4a1c('0x37')](_0x3824d2[_0x4a1c('0x34')],_0x3824d2[_0x4a1c('0x35')]);_0x55fc1c[_0x4a1c('0x38')]=_[_0x4a1c('0x37')](_0x3824d2[_0x4a1c('0x34')],qs[_0x4a1c('0x39')](_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x39')]));_0x55fc1c[_0x4a1c('0x38')]=_0x55fc1c[_0x4a1c('0x38')]['length']?_0x55fc1c[_0x4a1c('0x38')]:_0x3824d2[_0x4a1c('0x34')];if(!_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x5a')](_0x4a1c('0x5b'))){_0x55fc1c[_0x4a1c('0x22')]=qs[_0x4a1c('0x22')](_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x22')]);_0x55fc1c['offset']=qs['offset'](_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x1f')]);}_0x55fc1c['order']=qs[_0x4a1c('0x3c')](_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x3c')]);_0x55fc1c[_0x4a1c('0x3d')]=qs[_0x4a1c('0x3e')](_[_0x4a1c('0x5c')](_0x1357ed[_0x4a1c('0x35')],_0x3824d2[_0x4a1c('0x3e')]));_0x55fc1c[_0x4a1c('0x3d')][_0x4a1c('0x5d')]=_0x384b0a['id'];if(_0x1357ed[_0x4a1c('0x35')]['filter']){_0x55fc1c[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](_0x55fc1c[_0x4a1c('0x3d')],{'$or':_['map'](_0x55fc1c[_0x4a1c('0x38')],function(_0x253693){var _0x427e3e={};_0x427e3e[_0x253693]={'$like':'%'+_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x3f')]+'%'};return _0x427e3e;})});}_0x55fc1c=_[_0x4a1c('0x40')]({},_0x55fc1c,_0x1357ed[_0x4a1c('0x41')]);return db['JscriptySessionReport'][_0x4a1c('0x21')]({'where':_0x55fc1c[_0x4a1c('0x3d')]})['then'](function(_0x57fda8){_0x72e203['count']=_0x57fda8;if(_0x1357ed[_0x4a1c('0x35')][_0x4a1c('0x52')]){_0x55fc1c[_0x4a1c('0x42')]=[{'all':!![]}];}return db[_0x4a1c('0x59')][_0x4a1c('0x5e')](_0x55fc1c);})[_0x4a1c('0x28')](function(_0x169d58){_0x72e203[_0x4a1c('0x43')]=_0x169d58;return _0x72e203;});}})[_0x4a1c('0x28')](respondWithFilteredResult(_0x54fe91,_0x55fc1c))[_0x4a1c('0x44')](handleError(_0x54fe91,null));};exports[_0x4a1c('0x5f')]=function(_0x5cd374,_0x714112,_0x1ca9d4){var _0x2e9e73={'raw':!![],'where':{}};var _0x21cb2d={};var _0x1151a7={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x5cd374[_0x4a1c('0x46')]['id']}})[_0x4a1c('0x28')](handleEntityNotFound(_0x714112,null))[_0x4a1c('0x28')](function(_0x5ef61a){if(_0x5ef61a){_0x21cb2d[_0x4a1c('0x34')]=_[_0x4a1c('0x36')](db[_0x4a1c('0x60')][_0x4a1c('0x31')]);_0x21cb2d[_0x4a1c('0x35')]=_['keys'](_0x5cd374['query']);_0x21cb2d[_0x4a1c('0x3e')]=_[_0x4a1c('0x37')](_0x21cb2d[_0x4a1c('0x34')],_0x21cb2d[_0x4a1c('0x35')]);_0x2e9e73[_0x4a1c('0x38')]=_['intersection'](_0x21cb2d[_0x4a1c('0x34')],qs['fields'](_0x5cd374[_0x4a1c('0x35')][_0x4a1c('0x39')]));_0x2e9e73[_0x4a1c('0x38')]=_0x2e9e73[_0x4a1c('0x38')][_0x4a1c('0x3a')]?_0x2e9e73[_0x4a1c('0x38')]:_0x21cb2d[_0x4a1c('0x34')];if(!_0x5cd374['query']['hasOwnProperty'](_0x4a1c('0x5b'))){_0x2e9e73[_0x4a1c('0x22')]=qs['limit'](_0x5cd374[_0x4a1c('0x35')]['limit']);_0x2e9e73[_0x4a1c('0x1f')]=qs[_0x4a1c('0x1f')](_0x5cd374[_0x4a1c('0x35')][_0x4a1c('0x1f')]);}_0x2e9e73[_0x4a1c('0x3b')]=qs[_0x4a1c('0x3c')](_0x5cd374[_0x4a1c('0x35')][_0x4a1c('0x3c')]);_0x2e9e73[_0x4a1c('0x3d')]=qs['filters'](_[_0x4a1c('0x5c')](_0x5cd374[_0x4a1c('0x35')],_0x21cb2d[_0x4a1c('0x3e')]));_0x2e9e73[_0x4a1c('0x3d')]['ProjectId']=_0x5ef61a['id'];if(_0x5cd374['query']['filter']){_0x2e9e73[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](_0x2e9e73['where'],{'$or':_[_0x4a1c('0x2f')](_0x2e9e73[_0x4a1c('0x38')],function(_0x2d1550){var _0x10b318={};_0x10b318[_0x2d1550]={'$like':'%'+_0x5cd374[_0x4a1c('0x35')][_0x4a1c('0x3f')]+'%'};return _0x10b318;})});}_0x2e9e73=_[_0x4a1c('0x40')]({},_0x2e9e73,_0x5cd374[_0x4a1c('0x41')]);return db[_0x4a1c('0x60')]['count']({'where':_0x2e9e73[_0x4a1c('0x3d')]})['then'](function(_0x4bae14){_0x1151a7[_0x4a1c('0x21')]=_0x4bae14;if(_0x5cd374[_0x4a1c('0x35')][_0x4a1c('0x52')]){_0x2e9e73[_0x4a1c('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4a1c('0x5e')](_0x2e9e73);})[_0x4a1c('0x28')](function(_0x427c56){_0x1151a7['rows']=_0x427c56;return _0x1151a7;});}})['then'](respondWithFilteredResult(_0x714112,_0x2e9e73))['catch'](handleError(_0x714112,null));};function char(_0x12f873){return _0x4a1c('0x61')===typeof _0x12f873?String[_0x4a1c('0x62')][_0x4a1c('0x24')](null,arguments):_0x12f873;}function needsEncapsulation(_0x39caa0){return!!_0x39caa0&&(_0x39caa0[_0x4a1c('0x63')]()[_0x4a1c('0x64')](char(0xd))>=0x0||_0x39caa0[_0x4a1c('0x63')]()[_0x4a1c('0x64')](char(0xa))>=0x0||_0x39caa0[_0x4a1c('0x63')]()[_0x4a1c('0x64')](char(0x2c))>=0x0||_0x39caa0[_0x4a1c('0x63')]()[_0x4a1c('0x64')](char(0x22))>=0x0);}function encapsulate(_0x1028e2){var _0x1538f7=char(0x22),_0x2cf40b='\x5c'+char(0x22),_0x53455b=_0x1028e2[_0x4a1c('0x63')]()[_0x4a1c('0x65')](new RegExp(_0x1538f7,'g'),_0x2cf40b);return _0x1538f7+_0x53455b+_0x1538f7;}exports[_0x4a1c('0x66')]=function(_0x115f30,_0x29fe23,_0x4298a1){var _0xa20694,_0x3a93f0;var _0x4dbf60={'where':{'ProjectId':_0x115f30['params']['id']}};if(_0x115f30[_0x4a1c('0x35')][_0x4a1c('0x67')]){_0x4dbf60['where'][_0x4a1c('0x68')]=JSON[_0x4a1c('0x69')](_0x115f30[_0x4a1c('0x35')][_0x4a1c('0x67')]);}return db['JscriptySessionReport']['findAll'](_0x4dbf60)[_0x4a1c('0x28')](handleEntityNotFound(_0x29fe23,null))[_0x4a1c('0x28')](function(_0x5b8d1a){if(_0x5b8d1a){_0xa20694=_0x5b8d1a;return db[_0x4a1c('0x6a')][_0x4a1c('0x5e')]({'where':{'SessionId':{'$in':_[_0x4a1c('0x2f')](_0xa20694,'id')},'ProjectId':_0x115f30[_0x4a1c('0x46')]['id']},'order':_0x4a1c('0x6b')});}})[_0x4a1c('0x28')](handleEntityNotFound(_0x29fe23,null))[_0x4a1c('0x28')](function(_0x192e04){if(_0x192e04){_0x3a93f0=_0x192e04;var _0x7c9d67={};for(var _0x370bfc=0x0,_0x9e362=_0x3a93f0['length'];_0x370bfc<_0x9e362;_0x370bfc++){if(!_0x7c9d67[_0x4a1c('0x5a')](_0x3a93f0[_0x370bfc]['questionId'])){_0x7c9d67[_0x3a93f0[_0x370bfc][_0x4a1c('0x6c')]]=needsEncapsulation(_0x3a93f0[_0x370bfc]['question'])?encapsulate(_0x3a93f0[_0x370bfc][_0x4a1c('0x6d')]):_0x3a93f0[_0x370bfc]['question'];}}var _0x42b4ad=[],_0x22b228={};for(var _0x4611bf=0x0,_0x58340d=_0xa20694[_0x4a1c('0x3a')];_0x4611bf<_0x58340d;_0x4611bf++){_0x22b228={'ProjectId':_0x115f30[_0x4a1c('0x46')]['id'],'SessionId':_0xa20694[_0x4611bf]['id'],'StartTime':moment(_0xa20694[_0x4611bf]['starttime'])[_0x4a1c('0x6e')](_0x4a1c('0x6f'))};for(var _0x89f753=0x0,_0x18f796=_0x3a93f0[_0x4a1c('0x3a')];_0x89f753<_0x18f796;_0x89f753++){if(_0x3a93f0[_0x89f753][_0x4a1c('0x70')]==_0xa20694[_0x4611bf]['id']&&_0x7c9d67[_0x4a1c('0x5a')](_0x3a93f0[_0x89f753][_0x4a1c('0x6c')])){_0x22b228[_0x7c9d67[_0x3a93f0[_0x89f753]['questionId']]]=_0x3a93f0[_0x89f753][_0x4a1c('0x71')];}}for(var _0xaf0491 in _0x7c9d67){if(!_0x22b228['hasOwnProperty'](_0x7c9d67[_0xaf0491])){_0x22b228[_0x7c9d67[_0xaf0491]]=null;}}_0x42b4ad[_0x4a1c('0x72')](_0x22b228);}return _0x42b4ad;}})[_0x4a1c('0x28')](function(_0x2b49ea){if(!_['isEmpty'](_0x2b49ea)){var _0x447f7d=toCsv(_0x2b49ea);var _0x3047c7=Date['now']();fs[_0x4a1c('0x73')](util[_0x4a1c('0x6e')](_0x4a1c('0x74'),_0x115f30[_0x4a1c('0x46')]['id'],_0x3047c7),_0x447f7d);_0x29fe23[_0x4a1c('0x75')]('Content-disposition',_0x4a1c('0x76')+util['format'](_0x4a1c('0x77'),_0x115f30[_0x4a1c('0x46')]['id'],_0x3047c7));_0x29fe23[_0x4a1c('0x75')]('Content-type',_0x4a1c('0x78'));return _0x29fe23[_0x4a1c('0x79')](util[_0x4a1c('0x6e')](_0x4a1c('0x74'),_0x115f30[_0x4a1c('0x46')]['id'],_0x3047c7));}else{return _0x29fe23[_0x4a1c('0x1b')](0xcc);}})[_0x4a1c('0x44')](handleError(_0x29fe23,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7236cd3..705f14e 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefbf=['./jscriptyProject.attributes','define','JscriptyProject','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x281aa8,_0x4f7f8b){var _0x3f0d74=function(_0x456fe7){while(--_0x456fe7){_0x281aa8['push'](_0x281aa8['shift']());}};_0x3f0d74(++_0x4f7f8b);}(_0xefbf,0xa3));var _0xfefb=function(_0x517581,_0x343a77){_0x517581=_0x517581-0x0;var _0xe3061d=_0xefbf[_0x517581];return _0xe3061d;};'use strict';var _=require(_0xfefb('0x0'));var util=require(_0xfefb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfefb('0x2'));var rp=require(_0xfefb('0x3'));var fs=require('fs');var path=require(_0xfefb('0x4'));var rimraf=require(_0xfefb('0x5'));var config=require(_0xfefb('0x6'));var attributes=require(_0xfefb('0x7'));module['exports']=function(_0xaac208,_0x58c767){return _0xaac208[_0xfefb('0x8')](_0xfefb('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x432b=['define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','rimraf','./jscriptyProject.attributes'];(function(_0x500458,_0xdfa875){var _0x1b221a=function(_0x54728c){while(--_0x54728c){_0x500458['push'](_0x500458['shift']());}};_0x1b221a(++_0xdfa875);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3415cd6..3011f3e 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x114c9d,_0xf0f16e){var _0x4f6252=function(_0x470ae3){while(--_0x470ae3){_0x114c9d['push'](_0x114c9d['shift']());}};_0x4f6252(++_0xf0f16e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0xda3f,0xec));var _0xfda3=function(_0x4a138e,_0x133c88){_0x4a138e=_0x4a138e-0x0;var _0x59a8ef=_0xda3f[_0x4a138e];return _0x59a8ef;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 37504da..b6f16ff 100644 --- a/server/api/jscriptyQuestionReport/index.js +++ b/server/api/jscriptyQuestionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b25=['../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5339e8,_0x5c56a7){var _0x4a2c58=function(_0x25fd57){while(--_0x25fd57){_0x5339e8['push'](_0x5339e8['shift']());}};_0x4a2c58(++_0x5c56a7);}(_0x0b25,0x105));var _0x50b2=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x0b25[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x50b2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50b2('0x1'));var router=express[_0x50b2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x50b2('0x3'));var interaction=require(_0x50b2('0x4'));var config=require(_0x50b2('0x5'));var controller=require(_0x50b2('0x6'));router['get']('/',auth[_0x50b2('0x7')](),controller[_0x50b2('0x8')]);router[_0x50b2('0x9')](_0x50b2('0xa'),auth['isAuthenticated'](),controller[_0x50b2('0xb')]);router[_0x50b2('0x9')](_0x50b2('0xc'),auth[_0x50b2('0x7')](),controller[_0x50b2('0xd')]);router[_0x50b2('0xe')]('/',auth[_0x50b2('0x7')](),controller[_0x50b2('0xf')]);router[_0x50b2('0x10')](_0x50b2('0xc'),auth[_0x50b2('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x50b2('0x11')]);module[_0x50b2('0x12')]=router; \ No newline at end of file +var _0x9747=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x8aa192,_0xa4eedf){var _0x412018=function(_0x484011){while(--_0x484011){_0x8aa192['push'](_0x8aa192['shift']());}};_0x412018(++_0xa4eedf);}(_0x9747,0x192));var _0x7974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9747[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7974('0x0'));var util=require(_0x7974('0x1'));var path=require(_0x7974('0x2'));var timeout=require(_0x7974('0x3'));var express=require(_0x7974('0x4'));var router=express[_0x7974('0x5')]();var fs_extra=require(_0x7974('0x6'));var auth=require(_0x7974('0x7'));var interaction=require(_0x7974('0x8'));var config=require(_0x7974('0x9'));var controller=require(_0x7974('0xa'));router[_0x7974('0xb')]('/',auth[_0x7974('0xc')](),controller[_0x7974('0xd')]);router['get'](_0x7974('0xe'),auth[_0x7974('0xc')](),controller[_0x7974('0xf')]);router[_0x7974('0xb')]('/:id',auth[_0x7974('0xc')](),controller[_0x7974('0x10')]);router[_0x7974('0x11')]('/',auth[_0x7974('0xc')](),controller[_0x7974('0x12')]);router[_0x7974('0x13')](_0x7974('0x14'),auth[_0x7974('0xc')](),controller[_0x7974('0x15')]);router[_0x7974('0x16')](_0x7974('0x14'),auth['isAuthenticated'](),controller[_0x7974('0x17')]);module[_0x7974('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index bdfc7de..0788b46 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0xec412e,_0x49a148){_0xec412e=_0xec412e-0x0;var _0x411522=_0x7a54[_0xec412e];return _0x411522;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0xdc6394,_0x102019){_0xdc6394=_0xdc6394-0x0;var _0x41c029=_0x7a54[_0xdc6394];return _0x41c029;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 5f0a610..65941a3 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd890=['merge','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','JscriptyQuestionReport','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter'];(function(_0x3637be,_0x4ec4f4){var _0x179a58=function(_0x44ea58){while(--_0x44ea58){_0x3637be['push'](_0x3637be['shift']());}};_0x179a58(++_0x4ec4f4);}(_0xd890,0x190));var _0x0d89=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xd890[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0x0d89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d89('0x1'));var jsonpatch=require(_0x0d89('0x2'));var rp=require('request-promise');var moment=require(_0x0d89('0x3'));var BPromise=require(_0x0d89('0x4'));var Mustache=require(_0x0d89('0x5'));var util=require(_0x0d89('0x6'));var path=require('path');var sox=require(_0x0d89('0x7'));var csv=require(_0x0d89('0x8'));var ejs=require(_0x0d89('0x9'));var fs=require('fs');var fs_extra=require(_0x0d89('0xa'));var _=require(_0x0d89('0xb'));var squel=require(_0x0d89('0xc'));var crypto=require(_0x0d89('0xd'));var jsforce=require(_0x0d89('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d89('0xf'));var Papa=require(_0x0d89('0x10'));var Redis=require(_0x0d89('0x11'));var authService=require(_0x0d89('0x12'));var qs=require(_0x0d89('0x13'));var as=require(_0x0d89('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d89('0x15'))(_0x0d89('0x16'));var utils=require(_0x0d89('0x17'));var config=require(_0x0d89('0x18'));var licenseUtil=require(_0x0d89('0x19'));var db=require(_0x0d89('0x1a'))['db'];function respondWithStatusCode(_0x5e97c5,_0x5aa59e){_0x5aa59e=_0x5aa59e||0xcc;return function(_0xcddba1){if(_0xcddba1){return _0x5e97c5[_0x0d89('0x1b')](_0x5aa59e);}return _0x5e97c5['status'](_0x5aa59e)[_0x0d89('0x1c')]();};}function respondWithResult(_0x40fa15,_0x5d67fa){_0x5d67fa=_0x5d67fa||0xc8;return function(_0x5647d1){if(_0x5647d1){return _0x40fa15[_0x0d89('0x1d')](_0x5d67fa)[_0x0d89('0x1e')](_0x5647d1);}};}function respondWithFilteredResult(_0x49f43c,_0x5153fd){return function(_0x25576d){if(_0x25576d){var _0x14d374=typeof _0x5153fd[_0x0d89('0x1f')]===_0x0d89('0x20')&&typeof _0x5153fd[_0x0d89('0x21')]===_0x0d89('0x20');var _0x10327e=_0x25576d[_0x0d89('0x22')];var _0xf003f9=_0x14d374?0x0:_0x5153fd[_0x0d89('0x1f')];var _0x2a3e44=_0x14d374?_0x25576d['count']:_0x5153fd[_0x0d89('0x1f')]+_0x5153fd[_0x0d89('0x21')];var _0x25ee42;if(_0x2a3e44>=_0x10327e){_0x2a3e44=_0x10327e;_0x25ee42=0xc8;}else{_0x25ee42=0xce;}_0x49f43c[_0x0d89('0x1d')](_0x25ee42);return _0x49f43c[_0x0d89('0x23')]('Content-Range',_0xf003f9+'-'+_0x2a3e44+'/'+_0x10327e)[_0x0d89('0x1e')](_0x25576d);}return null;};}function patchUpdates(_0x5e3d5f){return function(_0x3bcf1b){try{jsonpatch['apply'](_0x3bcf1b,_0x5e3d5f,!![]);}catch(_0x162643){return BPromise[_0x0d89('0x24')](_0x162643);}return _0x3bcf1b[_0x0d89('0x25')]();};}function saveUpdates(_0xf592cf,_0x348148){return function(_0x5d2429){if(_0x5d2429){return _0x5d2429[_0x0d89('0x26')](_0xf592cf)['then'](function(_0x7ff62f){return _0x7ff62f;});}return null;};}function removeEntity(_0x3bd269,_0x58490d){return function(_0x5bc7cf){if(_0x5bc7cf){return _0x5bc7cf[_0x0d89('0x27')]()[_0x0d89('0x28')](function(){_0x3bd269['status'](0xcc)[_0x0d89('0x1c')]();});}};}function handleEntityNotFound(_0x20d6cc,_0x991ea9){return function(_0x53da36){if(!_0x53da36){_0x20d6cc[_0x0d89('0x1b')](0x194);}return _0x53da36;};}function handleError(_0x52a119,_0x59255a){_0x59255a=_0x59255a||0x1f4;return function(_0x1d9b67){logger[_0x0d89('0x29')](_0x1d9b67[_0x0d89('0x2a')]);if(_0x1d9b67[_0x0d89('0x2b')]){delete _0x1d9b67[_0x0d89('0x2b')];}_0x52a119[_0x0d89('0x1d')](_0x59255a)[_0x0d89('0x2c')](_0x1d9b67);};}exports[_0x0d89('0x2d')]=function(_0xb7a96e,_0x160f49){var _0x17c8d2={},_0x32508e={},_0x154e1e={'count':0x0,'rows':[]};var _0x136c65=_[_0x0d89('0x2e')](db[_0x0d89('0x2f')]['rawAttributes'],function(_0x131d74){return{'name':_0x131d74[_0x0d89('0x30')],'type':_0x131d74[_0x0d89('0x31')]['key']};});_0x32508e[_0x0d89('0x32')]=_[_0x0d89('0x2e')](_0x136c65,_0x0d89('0x2b'));_0x32508e[_0x0d89('0x33')]=_['keys'](_0xb7a96e[_0x0d89('0x33')]);_0x32508e['filters']=_[_0x0d89('0x34')](_0x32508e[_0x0d89('0x32')],_0x32508e[_0x0d89('0x33')]);_0x17c8d2[_0x0d89('0x35')]=_[_0x0d89('0x34')](_0x32508e[_0x0d89('0x32')],qs['fields'](_0xb7a96e[_0x0d89('0x33')][_0x0d89('0x36')]));_0x17c8d2[_0x0d89('0x35')]=_0x17c8d2['attributes'][_0x0d89('0x37')]?_0x17c8d2[_0x0d89('0x35')]:_0x32508e[_0x0d89('0x32')];if(!_0xb7a96e[_0x0d89('0x33')]['hasOwnProperty'](_0x0d89('0x38'))){_0x17c8d2[_0x0d89('0x21')]=qs[_0x0d89('0x21')](_0xb7a96e['query']['limit']);_0x17c8d2['offset']=qs[_0x0d89('0x1f')](_0xb7a96e[_0x0d89('0x33')][_0x0d89('0x1f')]);}_0x17c8d2['order']=qs[_0x0d89('0x39')](_0xb7a96e['query']['sort']);_0x17c8d2[_0x0d89('0x3a')]=qs[_0x0d89('0x3b')](_[_0x0d89('0x3c')](_0xb7a96e['query'],_0x32508e[_0x0d89('0x3b')]),_0x136c65);if(_0xb7a96e['query'][_0x0d89('0x3d')]){_0x17c8d2[_0x0d89('0x3a')]=_[_0x0d89('0x3e')](_0x17c8d2[_0x0d89('0x3a')],{'$or':_[_0x0d89('0x2e')](_0x136c65,function(_0x5a2d9b){if(_0x5a2d9b[_0x0d89('0x31')]!=='VIRTUAL'){var _0x370e22={};_0x370e22[_0x5a2d9b[_0x0d89('0x2b')]]={'$like':'%'+_0xb7a96e['query'][_0x0d89('0x3d')]+'%'};return _0x370e22;}})});}_0x17c8d2=_['merge']({},_0x17c8d2,_0xb7a96e[_0x0d89('0x3f')]);var _0x13ee17={'where':_0x17c8d2[_0x0d89('0x3a')]};return db[_0x0d89('0x2f')]['count'](_0x13ee17)[_0x0d89('0x28')](function(_0x4d02f6){_0x154e1e[_0x0d89('0x22')]=_0x4d02f6;if(_0xb7a96e[_0x0d89('0x33')]['includeAll']){_0x17c8d2[_0x0d89('0x40')]=[{'all':!![]}];}return db[_0x0d89('0x2f')][_0x0d89('0x41')](_0x17c8d2);})[_0x0d89('0x28')](function(_0x125297){_0x154e1e[_0x0d89('0x42')]=_0x125297;return _0x154e1e;})[_0x0d89('0x28')](respondWithFilteredResult(_0x160f49,_0x17c8d2))[_0x0d89('0x43')](handleError(_0x160f49,null));};exports[_0x0d89('0x44')]=function(_0x2b6ff2,_0xdcf69e){var _0x33ad60={'raw':!![],'where':{'id':_0x2b6ff2[_0x0d89('0x45')]['id']}},_0x29e9d5={};_0x29e9d5['model']=_[_0x0d89('0x46')](db[_0x0d89('0x2f')][_0x0d89('0x47')]);_0x29e9d5[_0x0d89('0x33')]=_['keys'](_0x2b6ff2[_0x0d89('0x33')]);_0x29e9d5[_0x0d89('0x3b')]=_[_0x0d89('0x34')](_0x29e9d5[_0x0d89('0x32')],_0x29e9d5[_0x0d89('0x33')]);_0x33ad60['attributes']=_[_0x0d89('0x34')](_0x29e9d5[_0x0d89('0x32')],qs[_0x0d89('0x36')](_0x2b6ff2[_0x0d89('0x33')]['fields']));_0x33ad60[_0x0d89('0x35')]=_0x33ad60[_0x0d89('0x35')][_0x0d89('0x37')]?_0x33ad60[_0x0d89('0x35')]:_0x29e9d5[_0x0d89('0x32')];if(_0x2b6ff2[_0x0d89('0x33')][_0x0d89('0x48')]){_0x33ad60[_0x0d89('0x40')]=[{'all':!![]}];}_0x33ad60=_['merge']({},_0x33ad60,_0x2b6ff2[_0x0d89('0x3f')]);return db[_0x0d89('0x2f')][_0x0d89('0x49')](_0x33ad60)[_0x0d89('0x28')](handleEntityNotFound(_0xdcf69e,null))[_0x0d89('0x28')](respondWithResult(_0xdcf69e,null))[_0x0d89('0x43')](handleError(_0xdcf69e,null));};exports[_0x0d89('0x4a')]=function(_0x5cec76,_0x5f408c){return db['JscriptyQuestionReport'][_0x0d89('0x4a')](_0x5cec76[_0x0d89('0x4b')],{})[_0x0d89('0x28')](respondWithResult(_0x5f408c,0xc9))[_0x0d89('0x43')](handleError(_0x5f408c,null));};exports[_0x0d89('0x26')]=function(_0x2f60b6,_0x4a20e6){if(_0x2f60b6['body']['id']){delete _0x2f60b6['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x2f60b6[_0x0d89('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a20e6,null))['then'](saveUpdates(_0x2f60b6[_0x0d89('0x4b')],null))[_0x0d89('0x28')](respondWithResult(_0x4a20e6,null))[_0x0d89('0x43')](handleError(_0x4a20e6,null));};exports[_0x0d89('0x27')]=function(_0x2ba292,_0x5064a2){return db['JscriptyQuestionReport'][_0x0d89('0x49')]({'where':{'id':_0x2ba292[_0x0d89('0x45')]['id']}})[_0x0d89('0x28')](handleEntityNotFound(_0x5064a2,null))[_0x0d89('0x28')](removeEntity(_0x5064a2,null))[_0x0d89('0x43')](handleError(_0x5064a2,null));};exports[_0x0d89('0x4c')]=function(_0x4c3b88,_0x57d513){return db[_0x0d89('0x2f')]['describe']()[_0x0d89('0x28')](respondWithResult(_0x57d513,null))[_0x0d89('0x43')](handleError(_0x57d513,null));}; \ No newline at end of file +var _0x34bb=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys'];(function(_0x55470c,_0x4251bb){var _0x281b42=function(_0x2cbbc5){while(--_0x2cbbc5){_0x55470c['push'](_0x55470c['shift']());}};_0x281b42(++_0x4251bb);}(_0x34bb,0x144));var _0xb34b=function(_0x1d486f,_0x5cb59d){_0x1d486f=_0x1d486f-0x0;var _0x69ccf9=_0x34bb[_0x1d486f];return _0x69ccf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb34b('0x0'));var zipdir=require(_0xb34b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb34b('0x2'));var BPromise=require(_0xb34b('0x3'));var Mustache=require(_0xb34b('0x4'));var util=require('util');var path=require(_0xb34b('0x5'));var sox=require(_0xb34b('0x6'));var csv=require(_0xb34b('0x7'));var ejs=require(_0xb34b('0x8'));var fs=require('fs');var fs_extra=require(_0xb34b('0x9'));var _=require(_0xb34b('0xa'));var squel=require('squel');var crypto=require(_0xb34b('0xb'));var jsforce=require(_0xb34b('0xc'));var deskjs=require(_0xb34b('0xd'));var toCsv=require(_0xb34b('0x7'));var querystring=require(_0xb34b('0xe'));var Papa=require(_0xb34b('0xf'));var Redis=require('ioredis');var authService=require(_0xb34b('0x10'));var qs=require(_0xb34b('0x11'));var as=require(_0xb34b('0x12'));var hardwareService=require(_0xb34b('0x13'));var logger=require(_0xb34b('0x14'))(_0xb34b('0x15'));var utils=require(_0xb34b('0x16'));var config=require(_0xb34b('0x17'));var licenseUtil=require(_0xb34b('0x18'));var db=require(_0xb34b('0x19'))['db'];function respondWithStatusCode(_0x8fcdc,_0x1855eb){_0x1855eb=_0x1855eb||0xcc;return function(_0x19cec7){if(_0x19cec7){return _0x8fcdc[_0xb34b('0x1a')](_0x1855eb);}return _0x8fcdc['status'](_0x1855eb)[_0xb34b('0x1b')]();};}function respondWithResult(_0x1b5cd5,_0x45fbf9){_0x45fbf9=_0x45fbf9||0xc8;return function(_0x2d066a){if(_0x2d066a){return _0x1b5cd5[_0xb34b('0x1c')](_0x45fbf9)[_0xb34b('0x1d')](_0x2d066a);}};}function respondWithFilteredResult(_0x4a8c19,_0x5bd7ca){return function(_0x1e64c4){if(_0x1e64c4){var _0x3fcfb5=typeof _0x5bd7ca[_0xb34b('0x1e')]===_0xb34b('0x1f')&&typeof _0x5bd7ca[_0xb34b('0x20')]===_0xb34b('0x1f');var _0x37ed31=_0x1e64c4[_0xb34b('0x21')];var _0x5dd2a9=_0x3fcfb5?0x0:_0x5bd7ca[_0xb34b('0x1e')];var _0x28512c=_0x3fcfb5?_0x1e64c4['count']:_0x5bd7ca['offset']+_0x5bd7ca['limit'];var _0x5c1fa5;if(_0x28512c>=_0x37ed31){_0x28512c=_0x37ed31;_0x5c1fa5=0xc8;}else{_0x5c1fa5=0xce;}_0x4a8c19[_0xb34b('0x1c')](_0x5c1fa5);return _0x4a8c19[_0xb34b('0x22')](_0xb34b('0x23'),_0x5dd2a9+'-'+_0x28512c+'/'+_0x37ed31)[_0xb34b('0x1d')](_0x1e64c4);}return null;};}function patchUpdates(_0xf8aa4f){return function(_0x5d2ee4){try{jsonpatch[_0xb34b('0x24')](_0x5d2ee4,_0xf8aa4f,!![]);}catch(_0xe6122){return BPromise['reject'](_0xe6122);}return _0x5d2ee4[_0xb34b('0x25')]();};}function saveUpdates(_0x807f1,_0x48c010){return function(_0x33ee65){if(_0x33ee65){return _0x33ee65[_0xb34b('0x26')](_0x807f1)[_0xb34b('0x27')](function(_0x9aa3d7){return _0x9aa3d7;});}return null;};}function removeEntity(_0x37c950,_0x28fabb){return function(_0x2e1f1e){if(_0x2e1f1e){return _0x2e1f1e[_0xb34b('0x28')]()[_0xb34b('0x27')](function(){_0x37c950['status'](0xcc)[_0xb34b('0x1b')]();});}};}function handleEntityNotFound(_0x65e877,_0x237aae){return function(_0x55a906){if(!_0x55a906){_0x65e877['sendStatus'](0x194);}return _0x55a906;};}function handleError(_0x5b4249,_0x27e0d2){_0x27e0d2=_0x27e0d2||0x1f4;return function(_0x3730be){logger[_0xb34b('0x29')](_0x3730be['stack']);if(_0x3730be[_0xb34b('0x2a')]){delete _0x3730be[_0xb34b('0x2a')];}_0x5b4249[_0xb34b('0x1c')](_0x27e0d2)[_0xb34b('0x2b')](_0x3730be);};}exports['index']=function(_0x61427c,_0x3e8ae2){var _0x2edf35={},_0x55c0d0={},_0x4a6837={'count':0x0,'rows':[]};var _0x1458ef=_[_0xb34b('0x2c')](db[_0xb34b('0x2d')][_0xb34b('0x2e')],function(_0x118d6e){return{'name':_0x118d6e['fieldName'],'type':_0x118d6e['type'][_0xb34b('0x2f')]};});_0x55c0d0[_0xb34b('0x30')]=_[_0xb34b('0x2c')](_0x1458ef,_0xb34b('0x2a'));_0x55c0d0[_0xb34b('0x31')]=_[_0xb34b('0x32')](_0x61427c['query']);_0x55c0d0[_0xb34b('0x33')]=_['intersection'](_0x55c0d0[_0xb34b('0x30')],_0x55c0d0['query']);_0x2edf35[_0xb34b('0x34')]=_[_0xb34b('0x35')](_0x55c0d0[_0xb34b('0x30')],qs[_0xb34b('0x36')](_0x61427c[_0xb34b('0x31')]['fields']));_0x2edf35[_0xb34b('0x34')]=_0x2edf35['attributes'][_0xb34b('0x37')]?_0x2edf35[_0xb34b('0x34')]:_0x55c0d0[_0xb34b('0x30')];if(!_0x61427c[_0xb34b('0x31')][_0xb34b('0x38')](_0xb34b('0x39'))){_0x2edf35[_0xb34b('0x20')]=qs[_0xb34b('0x20')](_0x61427c[_0xb34b('0x31')][_0xb34b('0x20')]);_0x2edf35[_0xb34b('0x1e')]=qs[_0xb34b('0x1e')](_0x61427c['query']['offset']);}_0x2edf35['order']=qs[_0xb34b('0x3a')](_0x61427c[_0xb34b('0x31')][_0xb34b('0x3a')]);_0x2edf35[_0xb34b('0x3b')]=qs[_0xb34b('0x33')](_[_0xb34b('0x3c')](_0x61427c[_0xb34b('0x31')],_0x55c0d0[_0xb34b('0x33')]),_0x1458ef);if(_0x61427c['query'][_0xb34b('0x3d')]){_0x2edf35['where']=_[_0xb34b('0x3e')](_0x2edf35['where'],{'$or':_['map'](_0x1458ef,function(_0xc9fb94){if(_0xc9fb94['type']!==_0xb34b('0x3f')){var _0x45d5e8={};_0x45d5e8[_0xc9fb94[_0xb34b('0x2a')]]={'$like':'%'+_0x61427c[_0xb34b('0x31')][_0xb34b('0x3d')]+'%'};return _0x45d5e8;}})});}_0x2edf35=_[_0xb34b('0x3e')]({},_0x2edf35,_0x61427c[_0xb34b('0x40')]);var _0x5742a0={'where':_0x2edf35[_0xb34b('0x3b')]};return db['JscriptyQuestionReport'][_0xb34b('0x21')](_0x5742a0)[_0xb34b('0x27')](function(_0x533683){_0x4a6837[_0xb34b('0x21')]=_0x533683;if(_0x61427c[_0xb34b('0x31')][_0xb34b('0x41')]){_0x2edf35[_0xb34b('0x42')]=[{'all':!![]}];}return db[_0xb34b('0x2d')][_0xb34b('0x43')](_0x2edf35);})[_0xb34b('0x27')](function(_0x3b79a5){_0x4a6837['rows']=_0x3b79a5;return _0x4a6837;})['then'](respondWithFilteredResult(_0x3e8ae2,_0x2edf35))['catch'](handleError(_0x3e8ae2,null));};exports[_0xb34b('0x44')]=function(_0x5f0006,_0x452983){var _0x3f8244={'raw':!![],'where':{'id':_0x5f0006[_0xb34b('0x45')]['id']}},_0x27a2ad={};_0x27a2ad[_0xb34b('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0xb34b('0x2e')]);_0x27a2ad[_0xb34b('0x31')]=_[_0xb34b('0x32')](_0x5f0006[_0xb34b('0x31')]);_0x27a2ad[_0xb34b('0x33')]=_[_0xb34b('0x35')](_0x27a2ad[_0xb34b('0x30')],_0x27a2ad[_0xb34b('0x31')]);_0x3f8244[_0xb34b('0x34')]=_[_0xb34b('0x35')](_0x27a2ad[_0xb34b('0x30')],qs['fields'](_0x5f0006['query'][_0xb34b('0x36')]));_0x3f8244[_0xb34b('0x34')]=_0x3f8244[_0xb34b('0x34')][_0xb34b('0x37')]?_0x3f8244['attributes']:_0x27a2ad['model'];if(_0x5f0006['query'][_0xb34b('0x41')]){_0x3f8244['include']=[{'all':!![]}];}_0x3f8244=_[_0xb34b('0x3e')]({},_0x3f8244,_0x5f0006[_0xb34b('0x40')]);return db[_0xb34b('0x2d')][_0xb34b('0x46')](_0x3f8244)[_0xb34b('0x27')](handleEntityNotFound(_0x452983,null))[_0xb34b('0x27')](respondWithResult(_0x452983,null))[_0xb34b('0x47')](handleError(_0x452983,null));};exports[_0xb34b('0x48')]=function(_0x24c046,_0x235dfd){return db['JscriptyQuestionReport'][_0xb34b('0x48')](_0x24c046[_0xb34b('0x49')],{})['then'](respondWithResult(_0x235dfd,0xc9))[_0xb34b('0x47')](handleError(_0x235dfd,null));};exports[_0xb34b('0x26')]=function(_0x10496b,_0x1ee70){if(_0x10496b[_0xb34b('0x49')]['id']){delete _0x10496b['body']['id'];}return db[_0xb34b('0x2d')][_0xb34b('0x46')]({'where':{'id':_0x10496b[_0xb34b('0x45')]['id']}})[_0xb34b('0x27')](handleEntityNotFound(_0x1ee70,null))['then'](saveUpdates(_0x10496b[_0xb34b('0x49')],null))[_0xb34b('0x27')](respondWithResult(_0x1ee70,null))[_0xb34b('0x47')](handleError(_0x1ee70,null));};exports[_0xb34b('0x28')]=function(_0x4c5dae,_0x229c2e){return db[_0xb34b('0x2d')][_0xb34b('0x46')]({'where':{'id':_0x4c5dae[_0xb34b('0x45')]['id']}})[_0xb34b('0x27')](handleEntityNotFound(_0x229c2e,null))['then'](removeEntity(_0x229c2e,null))[_0xb34b('0x47')](handleError(_0x229c2e,null));};exports['describe']=function(_0x11eb0a,_0x41aca6){return db[_0xb34b('0x2d')][_0xb34b('0x4a')]()[_0xb34b('0x27')](respondWithResult(_0x41aca6,null))[_0xb34b('0x47')](handleError(_0x41aca6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c7a9b0e..cd8215a 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf563=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x196ecc,_0x3d69ba){var _0x21f1d7=function(_0x2bfa48){while(--_0x2bfa48){_0x196ecc['push'](_0x196ecc['shift']());}};_0x21f1d7(++_0x3d69ba);}(_0xf563,0xc6));var _0x3f56=function(_0x5af7b8,_0x5a409f){_0x5af7b8=_0x5af7b8-0x0;var _0x318884=_0xf563[_0x5af7b8];return _0x318884;};'use strict';var _=require(_0x3f56('0x0'));var util=require(_0x3f56('0x1'));var logger=require(_0x3f56('0x2'))(_0x3f56('0x3'));var moment=require(_0x3f56('0x4'));var BPromise=require(_0x3f56('0x5'));var rp=require(_0x3f56('0x6'));var fs=require('fs');var path=require(_0x3f56('0x7'));var rimraf=require(_0x3f56('0x8'));var config=require(_0x3f56('0x9'));var attributes=require(_0x3f56('0xa'));module[_0x3f56('0xb')]=function(_0x27d73e,_0x5844e){return _0x27d73e[_0x3f56('0xc')](_0x3f56('0xd'),attributes,{'tableName':_0x3f56('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b95=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b95,0xe9));var _0x54b9=function(_0x3254a8,_0x1401c9){_0x3254a8=_0x3254a8-0x0;var _0x42ebf3=_0x4b95[_0x3254a8];return _0x42ebf3;};'use strict';var _=require(_0x54b9('0x0'));var util=require(_0x54b9('0x1'));var logger=require(_0x54b9('0x2'))(_0x54b9('0x3'));var moment=require(_0x54b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x54b9('0x5'));var fs=require('fs');var path=require(_0x54b9('0x6'));var rimraf=require(_0x54b9('0x7'));var config=require(_0x54b9('0x8'));var attributes=require(_0x54b9('0x9'));module['exports']=function(_0x49481a,_0x5b4c2e){return _0x49481a[_0x54b9('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0x54b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index a8c7efb..ad29698 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x468f=['stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','request\x20sent','result','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x25deb7,_0xe5537f){var _0x37fd18=function(_0x45e59d){while(--_0x45e59d){_0x25deb7['push'](_0x25deb7['shift']());}};_0x37fd18(++_0xe5537f);}(_0x468f,0x66));var _0xf468=function(_0x440237,_0x403080){_0x440237=_0x440237-0x0;var _0x59c5b8=_0x468f[_0x440237];return _0x59c5b8;};'use strict';var _=require('lodash');var util=require(_0xf468('0x0'));var moment=require(_0xf468('0x1'));var BPromise=require(_0xf468('0x2'));var rs=require(_0xf468('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf468('0x4'));var logger=require('../../config/logger')(_0xf468('0x5'));var config=require(_0xf468('0x6'));var jayson=require(_0xf468('0x7'));var client=jayson[_0xf468('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2950f7,_0x47aa16,_0x378a10){return new BPromise(function(_0x59b949,_0x4cb817){return client[_0xf468('0x9')](_0x2950f7,_0x378a10)['then'](function(_0x1cb659){logger[_0xf468('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47aa16,'request\x20sent');logger['debug'](_0xf468('0xb'),_0x47aa16,'request\x20sent',JSON[_0xf468('0xc')](_0x1cb659));if(_0x1cb659['error']){if(_0x1cb659[_0xf468('0xd')][_0xf468('0xe')]===0x1f4){logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1cb659[_0xf468('0xd')][_0xf468('0x10')]);return _0x4cb817(_0x1cb659[_0xf468('0xd')][_0xf468('0x10')]);}logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1cb659['error'][_0xf468('0x10')]);return _0x59b949(_0x1cb659['error'][_0xf468('0x10')]);}else{logger[_0xf468('0xa')](_0xf468('0xf'),_0x47aa16,_0xf468('0x11'));_0x59b949(_0x1cb659[_0xf468('0x12')][_0xf468('0x10')]);}})['catch'](function(_0x1f7507){logger[_0xf468('0xd')](_0xf468('0xf'),_0x47aa16,_0x1f7507);_0x4cb817(_0x1f7507);});});} \ No newline at end of file +var _0x9fe4=['message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x54769a,_0x469045){var _0x3a4a8f=function(_0x3e2a16){while(--_0x3e2a16){_0x54769a['push'](_0x54769a['shift']());}};_0x3a4a8f(++_0x469045);}(_0x9fe4,0x129));var _0x49fe=function(_0x418567,_0xe686d0){_0x418567=_0x418567-0x0;var _0xa894bb=_0x9fe4[_0x418567];return _0xa894bb;};'use strict';var _=require(_0x49fe('0x0'));var util=require(_0x49fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x49fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49fe('0x3'))['db'];var utils=require(_0x49fe('0x4'));var logger=require('../../config/logger')(_0x49fe('0x5'));var config=require(_0x49fe('0x6'));var jayson=require(_0x49fe('0x7'));var client=jayson[_0x49fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c52e2,_0x36c499,_0x2fd480){return new BPromise(function(_0x49acca,_0x3d2727){return client[_0x49fe('0x9')](_0x1c52e2,_0x2fd480)[_0x49fe('0xa')](function(_0x965308){logger[_0x49fe('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x36c499,_0x49fe('0xc'));logger['debug'](_0x49fe('0xd'),_0x36c499,_0x49fe('0xc'),JSON[_0x49fe('0xe')](_0x965308));if(_0x965308['error']){if(_0x965308[_0x49fe('0xf')][_0x49fe('0x10')]===0x1f4){logger[_0x49fe('0xf')](_0x49fe('0x11'),_0x36c499,_0x965308[_0x49fe('0xf')]['message']);return _0x3d2727(_0x965308[_0x49fe('0xf')][_0x49fe('0x12')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x36c499,_0x965308[_0x49fe('0xf')][_0x49fe('0x12')]);return _0x49acca(_0x965308['error']['message']);}else{logger[_0x49fe('0xb')](_0x49fe('0x11'),_0x36c499,'request\x20sent');_0x49acca(_0x965308[_0x49fe('0x13')][_0x49fe('0x12')]);}})[_0x49fe('0x14')](function(_0x4561b1){logger[_0x49fe('0xf')](_0x49fe('0x11'),_0x36c499,_0x4561b1);_0x3d2727(_0x4561b1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d06513b..32605f4 100644 --- a/server/api/jscriptySessionReport/index.js +++ b/server/api/jscriptySessionReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['create','put','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0xd5));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require('path');var timeout=require(_0x901d('0x2'));var express=require('express');var router=express[_0x901d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x901d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x901d('0x5'));var controller=require(_0x901d('0x6'));router[_0x901d('0x7')]('/',auth[_0x901d('0x8')](),controller[_0x901d('0x9')]);router[_0x901d('0x7')](_0x901d('0xa'),auth[_0x901d('0x8')](),controller[_0x901d('0xb')]);router['get'](_0x901d('0xc'),auth[_0x901d('0x8')](),controller[_0x901d('0xd')]);router[_0x901d('0x7')](_0x901d('0xe'),auth[_0x901d('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x901d('0x8')](),controller[_0x901d('0xf')]);router[_0x901d('0x10')](_0x901d('0xc'),auth[_0x901d('0x8')](),controller[_0x901d('0x11')]);router['delete'](_0x901d('0xc'),auth['isAuthenticated'](),controller[_0x901d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1cc9=['./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/questions','post','create','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcdfc4f,_0x8a111a){var _0x3f70d1=function(_0xc0f333){while(--_0xc0f333){_0xcdfc4f['push'](_0xcdfc4f['shift']());}};_0x3f70d1(++_0x8a111a);}(_0x1cc9,0x1c6));var _0x91cc=function(_0x216972,_0x25bc73){_0x216972=_0x216972-0x0;var _0x24e239=_0x1cc9[_0x216972];return _0x24e239;};'use strict';var multer=require('multer');var util=require(_0x91cc('0x0'));var path=require(_0x91cc('0x1'));var timeout=require(_0x91cc('0x2'));var express=require('express');var router=express[_0x91cc('0x3')]();var fs_extra=require(_0x91cc('0x4'));var auth=require(_0x91cc('0x5'));var interaction=require(_0x91cc('0x6'));var config=require(_0x91cc('0x7'));var controller=require(_0x91cc('0x8'));router['get']('/',auth[_0x91cc('0x9')](),controller[_0x91cc('0xa')]);router[_0x91cc('0xb')](_0x91cc('0xc'),auth[_0x91cc('0x9')](),controller[_0x91cc('0xd')]);router[_0x91cc('0xb')](_0x91cc('0xe'),auth[_0x91cc('0x9')](),controller['show']);router['get'](_0x91cc('0xf'),auth[_0x91cc('0x9')](),controller['getQuestions']);router[_0x91cc('0x10')]('/',auth[_0x91cc('0x9')](),controller[_0x91cc('0x11')]);router[_0x91cc('0x12')](_0x91cc('0xe'),auth[_0x91cc('0x9')](),controller[_0x91cc('0x13')]);router['delete'](_0x91cc('0xe'),auth[_0x91cc('0x9')](),controller['destroy']);module[_0x91cc('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ac0fcdc..98d2bc6 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa533=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa533,0x1c6));var _0x3a53=function(_0xa76db3,_0xf8fd0){_0xa76db3=_0xa76db3-0x0;var _0x47338e=_0xa533[_0xa76db3];return _0x47338e;};'use strict';var moment=require(_0x3a53('0x0'));var Sequelize=require(_0x3a53('0x1'));module[_0x3a53('0x2')]={'starttime':{'type':Sequelize[_0x3a53('0x3')],'set':function(_0x335246){this[_0x3a53('0x4')]('starttime',_0x335246);this[_0x3a53('0x4')](_0x3a53('0x5'),moment()[_0x3a53('0x6')](_0x3a53('0x7')));}},'endtime':{'type':Sequelize[_0x3a53('0x3')]},'membername':{'type':Sequelize[_0x3a53('0x8')]},'projectname':{'type':Sequelize[_0x3a53('0x8')]},'queue':{'type':Sequelize[_0x3a53('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a53('0x8')]},'completed':{'type':Sequelize[_0x3a53('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xf1c6=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x25dfa0,_0x27650b){var _0x2eee81=function(_0x4891ec){while(--_0x4891ec){_0x25dfa0['push'](_0x25dfa0['shift']());}};_0x2eee81(++_0x27650b);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xcfdf8b,_0x54cbbf){_0xcfdf8b=_0xcfdf8b-0x0;var _0xda3aba=_0xf1c6[_0xcfdf8b];return _0xda3aba;};'use strict';var moment=require(_0x6f1c('0x0'));var Sequelize=require(_0x6f1c('0x1'));module[_0x6f1c('0x2')]={'starttime':{'type':Sequelize[_0x6f1c('0x3')],'set':function(_0x381044){this[_0x6f1c('0x4')](_0x6f1c('0x5'),_0x381044);this['setDataValue'](_0x6f1c('0x6'),moment()[_0x6f1c('0x7')](_0x6f1c('0x8')));}},'endtime':{'type':Sequelize[_0x6f1c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6f1c('0x9')]},'uniqueid':{'type':Sequelize[_0x6f1c('0x9')]},'calleridname':{'type':Sequelize[_0x6f1c('0x9')]},'calleridnum':{'type':Sequelize[_0x6f1c('0x9')]},'completed':{'type':Sequelize[_0x6f1c('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 52909d0..664f8c7 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1eaf=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','JscriptySessionReport','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','findOne','JscriptyQuestionReport','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x1eaf,0x97));var _0xf1ea=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1eaf[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xf1ea('0x0'));var rimraf=require(_0xf1ea('0x1'));var zipdir=require(_0xf1ea('0x2'));var jsonpatch=require(_0xf1ea('0x3'));var rp=require(_0xf1ea('0x4'));var moment=require('moment');var BPromise=require(_0xf1ea('0x5'));var Mustache=require(_0xf1ea('0x6'));var util=require(_0xf1ea('0x7'));var path=require(_0xf1ea('0x8'));var sox=require(_0xf1ea('0x9'));var csv=require(_0xf1ea('0xa'));var ejs=require(_0xf1ea('0xb'));var fs=require('fs');var fs_extra=require(_0xf1ea('0xc'));var _=require(_0xf1ea('0xd'));var squel=require(_0xf1ea('0xe'));var crypto=require(_0xf1ea('0xf'));var jsforce=require(_0xf1ea('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf1ea('0xa'));var querystring=require(_0xf1ea('0x11'));var Papa=require(_0xf1ea('0x12'));var Redis=require(_0xf1ea('0x13'));var authService=require(_0xf1ea('0x14'));var qs=require(_0xf1ea('0x15'));var as=require(_0xf1ea('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf1ea('0x17'))(_0xf1ea('0x18'));var utils=require(_0xf1ea('0x19'));var config=require(_0xf1ea('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2269b9,_0x2dbeef){_0x2dbeef=_0x2dbeef||0xcc;return function(_0x41f2ab){if(_0x41f2ab){return _0x2269b9['sendStatus'](_0x2dbeef);}return _0x2269b9[_0xf1ea('0x1b')](_0x2dbeef)['end']();};}function respondWithResult(_0x53bf84,_0x5855dc){_0x5855dc=_0x5855dc||0xc8;return function(_0x1e041e){if(_0x1e041e){return _0x53bf84[_0xf1ea('0x1b')](_0x5855dc)[_0xf1ea('0x1c')](_0x1e041e);}};}function respondWithFilteredResult(_0x1d9649,_0x198fed){return function(_0x275b44){if(_0x275b44){var _0xcf5b01=typeof _0x198fed[_0xf1ea('0x1d')]===_0xf1ea('0x1e')&&typeof _0x198fed[_0xf1ea('0x1f')]===_0xf1ea('0x1e');var _0x5e017a=_0x275b44[_0xf1ea('0x20')];var _0x18671d=_0xcf5b01?0x0:_0x198fed[_0xf1ea('0x1d')];var _0x5db9a2=_0xcf5b01?_0x275b44[_0xf1ea('0x20')]:_0x198fed[_0xf1ea('0x1d')]+_0x198fed[_0xf1ea('0x1f')];var _0x46e940;if(_0x5db9a2>=_0x5e017a){_0x5db9a2=_0x5e017a;_0x46e940=0xc8;}else{_0x46e940=0xce;}_0x1d9649[_0xf1ea('0x1b')](_0x46e940);return _0x1d9649[_0xf1ea('0x21')](_0xf1ea('0x22'),_0x18671d+'-'+_0x5db9a2+'/'+_0x5e017a)[_0xf1ea('0x1c')](_0x275b44);}return null;};}function patchUpdates(_0x3da0da){return function(_0x46d21c){try{jsonpatch[_0xf1ea('0x23')](_0x46d21c,_0x3da0da,!![]);}catch(_0x40b4e4){return BPromise['reject'](_0x40b4e4);}return _0x46d21c['save']();};}function saveUpdates(_0x207de0,_0x450753){return function(_0x4f3cb3){if(_0x4f3cb3){return _0x4f3cb3[_0xf1ea('0x24')](_0x207de0)[_0xf1ea('0x25')](function(_0x3baeb8){return _0x3baeb8;});}return null;};}function removeEntity(_0x324c9e,_0x4239db){return function(_0x25a7e3){if(_0x25a7e3){return _0x25a7e3[_0xf1ea('0x26')]()[_0xf1ea('0x25')](function(){_0x324c9e[_0xf1ea('0x1b')](0xcc)[_0xf1ea('0x27')]();});}};}function handleEntityNotFound(_0x2d500b,_0x4935ea){return function(_0x40bc49){if(!_0x40bc49){_0x2d500b['sendStatus'](0x194);}return _0x40bc49;};}function handleError(_0x561687,_0x7cc6db){_0x7cc6db=_0x7cc6db||0x1f4;return function(_0x4f293f){logger[_0xf1ea('0x28')](_0x4f293f['stack']);if(_0x4f293f[_0xf1ea('0x29')]){delete _0x4f293f[_0xf1ea('0x29')];}_0x561687[_0xf1ea('0x1b')](_0x7cc6db)[_0xf1ea('0x2a')](_0x4f293f);};}exports[_0xf1ea('0x2b')]=function(_0x9a5701,_0xb8d88f){var _0x4a32bc={},_0x4a2cdc={},_0x172e2a={'count':0x0,'rows':[]};var _0x45f8be=_[_0xf1ea('0x2c')](db['JscriptySessionReport']['rawAttributes'],function(_0x3c044e){return{'name':_0x3c044e['fieldName'],'type':_0x3c044e[_0xf1ea('0x2d')]['key']};});_0x4a2cdc[_0xf1ea('0x2e')]=_['map'](_0x45f8be,'name');_0x4a2cdc['query']=_[_0xf1ea('0x2f')](_0x9a5701['query']);_0x4a2cdc[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x4a2cdc[_0xf1ea('0x2e')],_0x4a2cdc[_0xf1ea('0x32')]);_0x4a32bc[_0xf1ea('0x33')]=_[_0xf1ea('0x31')](_0x4a2cdc[_0xf1ea('0x2e')],qs[_0xf1ea('0x34')](_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x34')]));_0x4a32bc[_0xf1ea('0x33')]=_0x4a32bc[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x4a32bc[_0xf1ea('0x33')]:_0x4a2cdc[_0xf1ea('0x2e')];if(!_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x36')](_0xf1ea('0x37'))){_0x4a32bc['limit']=qs['limit'](_0x9a5701['query'][_0xf1ea('0x1f')]);_0x4a32bc['offset']=qs['offset'](_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x1d')]);}_0x4a32bc[_0xf1ea('0x38')]=qs[_0xf1ea('0x39')](_0x9a5701['query']['sort']);_0x4a32bc['where']=qs[_0xf1ea('0x30')](_[_0xf1ea('0x3a')](_0x9a5701[_0xf1ea('0x32')],_0x4a2cdc[_0xf1ea('0x30')]),_0x45f8be);if(_0x9a5701[_0xf1ea('0x32')][_0xf1ea('0x3b')]){_0x4a32bc['where']=_[_0xf1ea('0x3c')](_0x4a32bc['where'],{'$or':_[_0xf1ea('0x2c')](_0x45f8be,function(_0x35096a){if(_0x35096a[_0xf1ea('0x2d')]!==_0xf1ea('0x3d')){var _0x180df7={};_0x180df7[_0x35096a[_0xf1ea('0x29')]]={'$like':'%'+_0x9a5701['query'][_0xf1ea('0x3b')]+'%'};return _0x180df7;}})});}_0x4a32bc=_[_0xf1ea('0x3c')]({},_0x4a32bc,_0x9a5701[_0xf1ea('0x3e')]);var _0x458b49={'where':_0x4a32bc[_0xf1ea('0x3f')]};return db[_0xf1ea('0x40')][_0xf1ea('0x20')](_0x458b49)['then'](function(_0x49cb62){_0x172e2a[_0xf1ea('0x20')]=_0x49cb62;if(_0x9a5701[_0xf1ea('0x32')]['includeAll']){_0x4a32bc[_0xf1ea('0x41')]=[{'all':!![]}];}return db[_0xf1ea('0x40')][_0xf1ea('0x42')](_0x4a32bc);})[_0xf1ea('0x25')](function(_0x18d390){_0x172e2a['rows']=_0x18d390;return _0x172e2a;})[_0xf1ea('0x25')](respondWithFilteredResult(_0xb8d88f,_0x4a32bc))[_0xf1ea('0x43')](handleError(_0xb8d88f,null));};exports['show']=function(_0x36e21e,_0x113997){var _0x2f0ff6={'raw':!![],'where':{'id':_0x36e21e[_0xf1ea('0x44')]['id']}},_0x5eea38={};_0x5eea38[_0xf1ea('0x2e')]=_['keys'](db['JscriptySessionReport'][_0xf1ea('0x45')]);_0x5eea38[_0xf1ea('0x32')]=_[_0xf1ea('0x2f')](_0x36e21e[_0xf1ea('0x32')]);_0x5eea38[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x5eea38['model'],_0x5eea38[_0xf1ea('0x32')]);_0x2f0ff6[_0xf1ea('0x33')]=_['intersection'](_0x5eea38[_0xf1ea('0x2e')],qs[_0xf1ea('0x34')](_0x36e21e[_0xf1ea('0x32')][_0xf1ea('0x34')]));_0x2f0ff6[_0xf1ea('0x33')]=_0x2f0ff6[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x2f0ff6[_0xf1ea('0x33')]:_0x5eea38[_0xf1ea('0x2e')];if(_0x36e21e['query'][_0xf1ea('0x46')]){_0x2f0ff6[_0xf1ea('0x41')]=[{'all':!![]}];}_0x2f0ff6=_[_0xf1ea('0x3c')]({},_0x2f0ff6,_0x36e21e[_0xf1ea('0x3e')]);return db[_0xf1ea('0x40')][_0xf1ea('0x47')](_0x2f0ff6)[_0xf1ea('0x25')](handleEntityNotFound(_0x113997,null))['then'](respondWithResult(_0x113997,null))['catch'](handleError(_0x113997,null));};exports[_0xf1ea('0x48')]=function(_0x18700d,_0x475032){return db['JscriptySessionReport'][_0xf1ea('0x48')](_0x18700d[_0xf1ea('0x49')],{})[_0xf1ea('0x25')](respondWithResult(_0x475032,0xc9))[_0xf1ea('0x43')](handleError(_0x475032,null));};exports[_0xf1ea('0x24')]=function(_0x4cba34,_0x254c90){if(_0x4cba34[_0xf1ea('0x49')]['id']){delete _0x4cba34['body']['id'];}return db[_0xf1ea('0x40')]['find']({'where':{'id':_0x4cba34[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x254c90,null))[_0xf1ea('0x25')](saveUpdates(_0x4cba34[_0xf1ea('0x49')],null))[_0xf1ea('0x25')](respondWithResult(_0x254c90,null))['catch'](handleError(_0x254c90,null));};exports[_0xf1ea('0x26')]=function(_0x1af318,_0x3f81b0){return db[_0xf1ea('0x40')][_0xf1ea('0x47')]({'where':{'id':_0x1af318[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f81b0,null))[_0xf1ea('0x25')](removeEntity(_0x3f81b0,null))[_0xf1ea('0x43')](handleError(_0x3f81b0,null));};exports['describe']=function(_0x51c65b,_0x210967){return db['JscriptySessionReport'][_0xf1ea('0x4a')]()['then'](respondWithResult(_0x210967,null))[_0xf1ea('0x43')](handleError(_0x210967,null));};exports['getQuestions']=function(_0x5d5d74,_0x1d264f,_0x2bee6e){var _0x4efe46={'raw':!![],'where':{}};var _0x1fc9a7={};var _0x3405bd={'count':0x0,'rows':[]};return db[_0xf1ea('0x40')][_0xf1ea('0x4b')]({'where':{'id':_0x5d5d74[_0xf1ea('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d264f,null))[_0xf1ea('0x25')](function(_0x38c25d){if(_0x38c25d){_0x1fc9a7[_0xf1ea('0x2e')]=_[_0xf1ea('0x2f')](db[_0xf1ea('0x4c')][_0xf1ea('0x45')]);_0x1fc9a7[_0xf1ea('0x32')]=_[_0xf1ea('0x2f')](_0x5d5d74[_0xf1ea('0x32')]);_0x1fc9a7[_0xf1ea('0x30')]=_[_0xf1ea('0x31')](_0x1fc9a7[_0xf1ea('0x2e')],_0x1fc9a7[_0xf1ea('0x32')]);_0x4efe46[_0xf1ea('0x33')]=_['intersection'](_0x1fc9a7[_0xf1ea('0x2e')],qs['fields'](_0x5d5d74['query'][_0xf1ea('0x34')]));_0x4efe46[_0xf1ea('0x33')]=_0x4efe46[_0xf1ea('0x33')][_0xf1ea('0x35')]?_0x4efe46[_0xf1ea('0x33')]:_0x1fc9a7[_0xf1ea('0x2e')];if(!_0x5d5d74['query'][_0xf1ea('0x36')](_0xf1ea('0x37'))){_0x4efe46[_0xf1ea('0x1f')]=qs['limit'](_0x5d5d74[_0xf1ea('0x32')]['limit']);_0x4efe46['offset']=qs[_0xf1ea('0x1d')](_0x5d5d74[_0xf1ea('0x32')][_0xf1ea('0x1d')]);}_0x4efe46[_0xf1ea('0x38')]=qs[_0xf1ea('0x39')](_0x5d5d74['query'][_0xf1ea('0x39')]);_0x4efe46['where']=qs[_0xf1ea('0x30')](_[_0xf1ea('0x3a')](_0x5d5d74[_0xf1ea('0x32')],_0x1fc9a7['filters']));_0x4efe46[_0xf1ea('0x3f')]['SessionId']=_0x38c25d['id'];if(_0x5d5d74[_0xf1ea('0x32')]['filter']){_0x4efe46[_0xf1ea('0x3f')]=_['merge'](_0x4efe46[_0xf1ea('0x3f')],{'$or':_[_0xf1ea('0x2c')](_0x4efe46[_0xf1ea('0x33')],function(_0x33a640){var _0x327c22={};_0x327c22[_0x33a640]={'$like':'%'+_0x5d5d74['query']['filter']+'%'};return _0x327c22;})});}_0x4efe46=_[_0xf1ea('0x3c')]({},_0x4efe46,_0x5d5d74[_0xf1ea('0x3e')]);return db['JscriptyQuestionReport'][_0xf1ea('0x20')]({'where':_0x4efe46[_0xf1ea('0x3f')]})['then'](function(_0x6f186b){_0x3405bd[_0xf1ea('0x20')]=_0x6f186b;if(_0x5d5d74[_0xf1ea('0x32')][_0xf1ea('0x46')]){_0x4efe46[_0xf1ea('0x41')]=[{'all':!![]}];}return db[_0xf1ea('0x4c')][_0xf1ea('0x42')](_0x4efe46);})[_0xf1ea('0x25')](function(_0x408164){_0x3405bd[_0xf1ea('0x4d')]=_0x408164;return _0x3405bd;});}})['then'](respondWithFilteredResult(_0x1d264f,_0x4efe46))[_0xf1ea('0x43')](handleError(_0x1d264f,null));}; \ No newline at end of file +var _0x9a9b=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','then','rows','catch','show','keys','find','create','body','update','params','describe','getQuestions','JscriptyQuestionReport','rawAttributes','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x3dbf2b,_0x6a98aa){var _0x110945=function(_0x440f8d){while(--_0x440f8d){_0x3dbf2b['push'](_0x3dbf2b['shift']());}};_0x110945(++_0x6a98aa);}(_0x9a9b,0xee));var _0xb9a9=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x9a9b[_0x2cf2e9];return _0xd3670d;};'use strict';var emlformat=require(_0xb9a9('0x0'));var rimraf=require(_0xb9a9('0x1'));var zipdir=require(_0xb9a9('0x2'));var jsonpatch=require(_0xb9a9('0x3'));var rp=require(_0xb9a9('0x4'));var moment=require(_0xb9a9('0x5'));var BPromise=require(_0xb9a9('0x6'));var Mustache=require(_0xb9a9('0x7'));var util=require(_0xb9a9('0x8'));var path=require('path');var sox=require(_0xb9a9('0x9'));var csv=require(_0xb9a9('0xa'));var ejs=require(_0xb9a9('0xb'));var fs=require('fs');var fs_extra=require(_0xb9a9('0xc'));var _=require(_0xb9a9('0xd'));var squel=require(_0xb9a9('0xe'));var crypto=require(_0xb9a9('0xf'));var jsforce=require(_0xb9a9('0x10'));var deskjs=require(_0xb9a9('0x11'));var toCsv=require(_0xb9a9('0xa'));var querystring=require(_0xb9a9('0x12'));var Papa=require('papaparse');var Redis=require(_0xb9a9('0x13'));var authService=require(_0xb9a9('0x14'));var qs=require(_0xb9a9('0x15'));var as=require(_0xb9a9('0x16'));var hardwareService=require(_0xb9a9('0x17'));var logger=require(_0xb9a9('0x18'))(_0xb9a9('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb9a9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x283346,_0x512099){_0x512099=_0x512099||0xcc;return function(_0x29e8a7){if(_0x29e8a7){return _0x283346[_0xb9a9('0x1b')](_0x512099);}return _0x283346[_0xb9a9('0x1c')](_0x512099)[_0xb9a9('0x1d')]();};}function respondWithResult(_0x9003cd,_0x3af53b){_0x3af53b=_0x3af53b||0xc8;return function(_0x4f1ea5){if(_0x4f1ea5){return _0x9003cd[_0xb9a9('0x1c')](_0x3af53b)[_0xb9a9('0x1e')](_0x4f1ea5);}};}function respondWithFilteredResult(_0x2a0fcb,_0x3c5b04){return function(_0x35e76e){if(_0x35e76e){var _0x366209=typeof _0x3c5b04['offset']==='undefined'&&typeof _0x3c5b04[_0xb9a9('0x1f')]===_0xb9a9('0x20');var _0x23ce69=_0x35e76e[_0xb9a9('0x21')];var _0xb5242b=_0x366209?0x0:_0x3c5b04[_0xb9a9('0x22')];var _0x30acc3=_0x366209?_0x35e76e[_0xb9a9('0x21')]:_0x3c5b04[_0xb9a9('0x22')]+_0x3c5b04[_0xb9a9('0x1f')];var _0x274028;if(_0x30acc3>=_0x23ce69){_0x30acc3=_0x23ce69;_0x274028=0xc8;}else{_0x274028=0xce;}_0x2a0fcb[_0xb9a9('0x1c')](_0x274028);return _0x2a0fcb[_0xb9a9('0x23')]('Content-Range',_0xb5242b+'-'+_0x30acc3+'/'+_0x23ce69)[_0xb9a9('0x1e')](_0x35e76e);}return null;};}function patchUpdates(_0x2a9f28){return function(_0x259168){try{jsonpatch[_0xb9a9('0x24')](_0x259168,_0x2a9f28,!![]);}catch(_0x40bb8c){return BPromise[_0xb9a9('0x25')](_0x40bb8c);}return _0x259168['save']();};}function saveUpdates(_0x262d4d,_0x34ca06){return function(_0x54312d){if(_0x54312d){return _0x54312d['update'](_0x262d4d)['then'](function(_0x2503d9){return _0x2503d9;});}return null;};}function removeEntity(_0x29daaa,_0x4aa1ef){return function(_0x474186){if(_0x474186){return _0x474186[_0xb9a9('0x26')]()['then'](function(){_0x29daaa['status'](0xcc)[_0xb9a9('0x1d')]();});}};}function handleEntityNotFound(_0x52e7e7,_0x2fa65b){return function(_0x3911cd){if(!_0x3911cd){_0x52e7e7[_0xb9a9('0x1b')](0x194);}return _0x3911cd;};}function handleError(_0x589393,_0xb7baf8){_0xb7baf8=_0xb7baf8||0x1f4;return function(_0x2ee57d){logger[_0xb9a9('0x27')](_0x2ee57d[_0xb9a9('0x28')]);if(_0x2ee57d[_0xb9a9('0x29')]){delete _0x2ee57d[_0xb9a9('0x29')];}_0x589393[_0xb9a9('0x1c')](_0xb7baf8)[_0xb9a9('0x2a')](_0x2ee57d);};}exports[_0xb9a9('0x2b')]=function(_0x1945b1,_0x11f0d7){var _0x1fb15a={},_0x2d4790={},_0xbec75f={'count':0x0,'rows':[]};var _0xc0f74=_[_0xb9a9('0x2c')](db['JscriptySessionReport']['rawAttributes'],function(_0x2f44d4){return{'name':_0x2f44d4[_0xb9a9('0x2d')],'type':_0x2f44d4[_0xb9a9('0x2e')][_0xb9a9('0x2f')]};});_0x2d4790[_0xb9a9('0x30')]=_['map'](_0xc0f74,'name');_0x2d4790['query']=_['keys'](_0x1945b1[_0xb9a9('0x31')]);_0x2d4790['filters']=_['intersection'](_0x2d4790['model'],_0x2d4790['query']);_0x1fb15a[_0xb9a9('0x32')]=_[_0xb9a9('0x33')](_0x2d4790['model'],qs[_0xb9a9('0x34')](_0x1945b1[_0xb9a9('0x31')][_0xb9a9('0x34')]));_0x1fb15a['attributes']=_0x1fb15a[_0xb9a9('0x32')][_0xb9a9('0x35')]?_0x1fb15a[_0xb9a9('0x32')]:_0x2d4790[_0xb9a9('0x30')];if(!_0x1945b1['query']['hasOwnProperty'](_0xb9a9('0x36'))){_0x1fb15a[_0xb9a9('0x1f')]=qs['limit'](_0x1945b1[_0xb9a9('0x31')][_0xb9a9('0x1f')]);_0x1fb15a[_0xb9a9('0x22')]=qs['offset'](_0x1945b1[_0xb9a9('0x31')][_0xb9a9('0x22')]);}_0x1fb15a[_0xb9a9('0x37')]=qs[_0xb9a9('0x38')](_0x1945b1[_0xb9a9('0x31')]['sort']);_0x1fb15a[_0xb9a9('0x39')]=qs[_0xb9a9('0x3a')](_[_0xb9a9('0x3b')](_0x1945b1[_0xb9a9('0x31')],_0x2d4790[_0xb9a9('0x3a')]),_0xc0f74);if(_0x1945b1[_0xb9a9('0x31')][_0xb9a9('0x3c')]){_0x1fb15a[_0xb9a9('0x39')]=_[_0xb9a9('0x3d')](_0x1fb15a[_0xb9a9('0x39')],{'$or':_[_0xb9a9('0x2c')](_0xc0f74,function(_0x2ac671){if(_0x2ac671['type']!==_0xb9a9('0x3e')){var _0x2a0912={};_0x2a0912[_0x2ac671['name']]={'$like':'%'+_0x1945b1[_0xb9a9('0x31')]['filter']+'%'};return _0x2a0912;}})});}_0x1fb15a=_[_0xb9a9('0x3d')]({},_0x1fb15a,_0x1945b1[_0xb9a9('0x3f')]);var _0xb2815e={'where':_0x1fb15a['where']};return db[_0xb9a9('0x40')]['count'](_0xb2815e)['then'](function(_0xedca89){_0xbec75f['count']=_0xedca89;if(_0x1945b1[_0xb9a9('0x31')][_0xb9a9('0x41')]){_0x1fb15a[_0xb9a9('0x42')]=[{'all':!![]}];}return db[_0xb9a9('0x40')][_0xb9a9('0x43')](_0x1fb15a);})[_0xb9a9('0x44')](function(_0x379abb){_0xbec75f[_0xb9a9('0x45')]=_0x379abb;return _0xbec75f;})[_0xb9a9('0x44')](respondWithFilteredResult(_0x11f0d7,_0x1fb15a))[_0xb9a9('0x46')](handleError(_0x11f0d7,null));};exports[_0xb9a9('0x47')]=function(_0x18c4ca,_0x287d86){var _0x560bdc={'raw':!![],'where':{'id':_0x18c4ca['params']['id']}},_0x4679b3={};_0x4679b3[_0xb9a9('0x30')]=_[_0xb9a9('0x48')](db[_0xb9a9('0x40')]['rawAttributes']);_0x4679b3[_0xb9a9('0x31')]=_[_0xb9a9('0x48')](_0x18c4ca[_0xb9a9('0x31')]);_0x4679b3[_0xb9a9('0x3a')]=_['intersection'](_0x4679b3[_0xb9a9('0x30')],_0x4679b3[_0xb9a9('0x31')]);_0x560bdc[_0xb9a9('0x32')]=_[_0xb9a9('0x33')](_0x4679b3[_0xb9a9('0x30')],qs['fields'](_0x18c4ca[_0xb9a9('0x31')][_0xb9a9('0x34')]));_0x560bdc[_0xb9a9('0x32')]=_0x560bdc['attributes'][_0xb9a9('0x35')]?_0x560bdc[_0xb9a9('0x32')]:_0x4679b3['model'];if(_0x18c4ca[_0xb9a9('0x31')]['includeAll']){_0x560bdc['include']=[{'all':!![]}];}_0x560bdc=_[_0xb9a9('0x3d')]({},_0x560bdc,_0x18c4ca[_0xb9a9('0x3f')]);return db[_0xb9a9('0x40')][_0xb9a9('0x49')](_0x560bdc)[_0xb9a9('0x44')](handleEntityNotFound(_0x287d86,null))[_0xb9a9('0x44')](respondWithResult(_0x287d86,null))['catch'](handleError(_0x287d86,null));};exports[_0xb9a9('0x4a')]=function(_0x172d85,_0x4a0f9b){return db[_0xb9a9('0x40')][_0xb9a9('0x4a')](_0x172d85[_0xb9a9('0x4b')],{})[_0xb9a9('0x44')](respondWithResult(_0x4a0f9b,0xc9))[_0xb9a9('0x46')](handleError(_0x4a0f9b,null));};exports[_0xb9a9('0x4c')]=function(_0x2cbc86,_0x2c2c91){if(_0x2cbc86[_0xb9a9('0x4b')]['id']){delete _0x2cbc86[_0xb9a9('0x4b')]['id'];}return db[_0xb9a9('0x40')][_0xb9a9('0x49')]({'where':{'id':_0x2cbc86[_0xb9a9('0x4d')]['id']}})[_0xb9a9('0x44')](handleEntityNotFound(_0x2c2c91,null))[_0xb9a9('0x44')](saveUpdates(_0x2cbc86[_0xb9a9('0x4b')],null))[_0xb9a9('0x44')](respondWithResult(_0x2c2c91,null))['catch'](handleError(_0x2c2c91,null));};exports[_0xb9a9('0x26')]=function(_0x28a7cc,_0x143222){return db[_0xb9a9('0x40')][_0xb9a9('0x49')]({'where':{'id':_0x28a7cc[_0xb9a9('0x4d')]['id']}})[_0xb9a9('0x44')](handleEntityNotFound(_0x143222,null))[_0xb9a9('0x44')](removeEntity(_0x143222,null))[_0xb9a9('0x46')](handleError(_0x143222,null));};exports[_0xb9a9('0x4e')]=function(_0x29fa95,_0x167560){return db['JscriptySessionReport'][_0xb9a9('0x4e')]()[_0xb9a9('0x44')](respondWithResult(_0x167560,null))[_0xb9a9('0x46')](handleError(_0x167560,null));};exports[_0xb9a9('0x4f')]=function(_0x40e3e3,_0x38c7b8,_0x2da3e4){var _0x5af8ca={'raw':!![],'where':{}};var _0x3a3eee={};var _0x3a0d63={'count':0x0,'rows':[]};return db[_0xb9a9('0x40')]['findOne']({'where':{'id':_0x40e3e3['params']['id']}})[_0xb9a9('0x44')](handleEntityNotFound(_0x38c7b8,null))[_0xb9a9('0x44')](function(_0x572f22){if(_0x572f22){_0x3a3eee[_0xb9a9('0x30')]=_[_0xb9a9('0x48')](db[_0xb9a9('0x50')][_0xb9a9('0x51')]);_0x3a3eee[_0xb9a9('0x31')]=_['keys'](_0x40e3e3[_0xb9a9('0x31')]);_0x3a3eee[_0xb9a9('0x3a')]=_[_0xb9a9('0x33')](_0x3a3eee[_0xb9a9('0x30')],_0x3a3eee[_0xb9a9('0x31')]);_0x5af8ca[_0xb9a9('0x32')]=_['intersection'](_0x3a3eee[_0xb9a9('0x30')],qs[_0xb9a9('0x34')](_0x40e3e3[_0xb9a9('0x31')][_0xb9a9('0x34')]));_0x5af8ca[_0xb9a9('0x32')]=_0x5af8ca[_0xb9a9('0x32')][_0xb9a9('0x35')]?_0x5af8ca[_0xb9a9('0x32')]:_0x3a3eee['model'];if(!_0x40e3e3[_0xb9a9('0x31')]['hasOwnProperty'](_0xb9a9('0x36'))){_0x5af8ca[_0xb9a9('0x1f')]=qs[_0xb9a9('0x1f')](_0x40e3e3['query']['limit']);_0x5af8ca[_0xb9a9('0x22')]=qs[_0xb9a9('0x22')](_0x40e3e3[_0xb9a9('0x31')][_0xb9a9('0x22')]);}_0x5af8ca['order']=qs[_0xb9a9('0x38')](_0x40e3e3[_0xb9a9('0x31')][_0xb9a9('0x38')]);_0x5af8ca[_0xb9a9('0x39')]=qs[_0xb9a9('0x3a')](_[_0xb9a9('0x3b')](_0x40e3e3[_0xb9a9('0x31')],_0x3a3eee['filters']));_0x5af8ca['where'][_0xb9a9('0x52')]=_0x572f22['id'];if(_0x40e3e3['query'][_0xb9a9('0x3c')]){_0x5af8ca['where']=_['merge'](_0x5af8ca[_0xb9a9('0x39')],{'$or':_[_0xb9a9('0x2c')](_0x5af8ca[_0xb9a9('0x32')],function(_0x92cdd6){var _0x1ce77b={};_0x1ce77b[_0x92cdd6]={'$like':'%'+_0x40e3e3[_0xb9a9('0x31')][_0xb9a9('0x3c')]+'%'};return _0x1ce77b;})});}_0x5af8ca=_[_0xb9a9('0x3d')]({},_0x5af8ca,_0x40e3e3[_0xb9a9('0x3f')]);return db[_0xb9a9('0x50')]['count']({'where':_0x5af8ca['where']})[_0xb9a9('0x44')](function(_0x2e217d){_0x3a0d63[_0xb9a9('0x21')]=_0x2e217d;if(_0x40e3e3['query'][_0xb9a9('0x41')]){_0x5af8ca[_0xb9a9('0x42')]=[{'all':!![]}];}return db[_0xb9a9('0x50')][_0xb9a9('0x43')](_0x5af8ca);})[_0xb9a9('0x44')](function(_0x584849){_0x3a0d63['rows']=_0x584849;return _0x3a0d63;});}})['then'](respondWithFilteredResult(_0x38c7b8,_0x5af8ca))['catch'](handleError(_0x38c7b8,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index bc96090..0b26bdd 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.model.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5bf180,_0x4e2320){_0x5bf180=_0x5bf180-0x0;var _0x85d290=_0x3baf[_0x5bf180];return _0x85d290;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x17ba5f,_0x2f5ed9){_0x17ba5f=_0x17ba5f-0x0;var _0x52f550=_0xb4c7[_0x17ba5f];return _0x52f550;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 3ed4783..f6575da 100644 --- a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js +++ b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0adf=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x55c97d,_0x228ffc){var _0x1d5112=function(_0x2ab908){while(--_0x2ab908){_0x55c97d['push'](_0x55c97d['shift']());}};_0x1d5112(++_0x228ffc);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x3d3542,_0x52bbd9){_0x3d3542=_0x3d3542-0x0;var _0xc436ff=_0x0adf[_0x3d3542];return _0xc436ff;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});} \ No newline at end of file +var _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34aa50,_0x5bc13b){var _0x463100=function(_0x3680f8){while(--_0x3680f8){_0x34aa50['push'](_0x34aa50['shift']());}};_0x463100(++_0x5bc13b);}(_0x68b3,0x1d8));var _0x368b=function(_0x564001,_0x37d39d){_0x564001=_0x564001-0x0;var _0x211eb4=_0x68b3[_0x564001];return _0x211eb4;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e45ad91..2d07170 100644 --- a/server/api/license/index.js +++ b/server/api/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x194f=['index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x1e0729,_0x329471){var _0x418fe0=function(_0x3b7614){while(--_0x3b7614){_0x1e0729['push'](_0x1e0729['shift']());}};_0x418fe0(++_0x329471);}(_0x194f,0x197));var _0xf194=function(_0x3770d8,_0x25ccb1){_0x3770d8=_0x3770d8-0x0;var _0x9a6ba3=_0x194f[_0x3770d8];return _0x9a6ba3;};'use strict';var multer=require(_0xf194('0x0'));var util=require(_0xf194('0x1'));var path=require(_0xf194('0x2'));var timeout=require(_0xf194('0x3'));var express=require(_0xf194('0x4'));var router=express[_0xf194('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf194('0x6'));var interaction=require(_0xf194('0x7'));var config=require(_0xf194('0x8'));var controller=require(_0xf194('0x9'));router[_0xf194('0xa')]('/',controller[_0xf194('0xb')]);router[_0xf194('0xc')](_0xf194('0xd'),auth['isAuthenticated'](),controller[_0xf194('0xe')]);router[_0xf194('0xa')](_0xf194('0xf'),auth[_0xf194('0x10')](),controller[_0xf194('0x11')]);module[_0xf194('0x12')]=router; \ No newline at end of file +var _0x997b=['/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./license.controller','get','index'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x997b,0x11b));var _0xb997=function(_0x134c95,_0x49ed19){_0x134c95=_0x134c95-0x0;var _0x5ac841=_0x997b[_0x134c95];return _0x5ac841;};'use strict';var multer=require(_0xb997('0x0'));var util=require(_0xb997('0x1'));var path=require(_0xb997('0x2'));var timeout=require(_0xb997('0x3'));var express=require(_0xb997('0x4'));var router=express[_0xb997('0x5')]();var fs_extra=require(_0xb997('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb997('0x7'));var config=require('../../config/environment');var controller=require(_0xb997('0x8'));router[_0xb997('0x9')]('/',controller[_0xb997('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb997('0x9')](_0xb997('0xb'),auth['isAuthenticated'](),controller[_0xb997('0xc')]);module[_0xb997('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2191c76..ad6fe59 100644 --- a/server/api/license/license.attributes.js +++ b/server/api/license/license.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ed4=['INTEGER','sequelize','TEXT','STRING'];(function(_0x4cf7ed,_0x447bf8){var _0x34d716=function(_0x22a177){while(--_0x22a177){_0x4cf7ed['push'](_0x4cf7ed['shift']());}};_0x34d716(++_0x447bf8);}(_0x4ed4,0x13d));var _0x44ed=function(_0x1e46b1,_0x1dbaba){_0x1e46b1=_0x1e46b1-0x0;var _0x3629cf=_0x4ed4[_0x1e46b1];return _0x3629cf;};'use strict';var Sequelize=require(_0x44ed('0x0'));module['exports']={'license':{'type':Sequelize[_0x44ed('0x1')]},'data1':{'type':Sequelize[_0x44ed('0x2')]},'data2':{'type':Sequelize[_0x44ed('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x44ed('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc23=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x525a1a,_0x5f1ef9){var _0xbaa3e1=function(_0xef1ec8){while(--_0xef1ec8){_0x525a1a['push'](_0x525a1a['shift']());}};_0xbaa3e1(++_0x5f1ef9);}(_0xdc23,0x92));var _0x3dc2=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xdc23[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x3dc2('0x0'));module[_0x3dc2('0x1')]={'license':{'type':Sequelize[_0x3dc2('0x2')]},'data1':{'type':Sequelize[_0x3dc2('0x3')]},'data2':{'type':Sequelize[_0x3dc2('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x3dc2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index e110d7d..4934750 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb751=['key','catch','downloadLogFile','license-info.log','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','download','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','keys','License','query','intersection','model','attributes','length','options','update','body','find'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0xb751,0x8d));var _0x1b75=function(_0x1d037b,_0x2c2e7b){_0x1d037b=_0x1d037b-0x0;var _0x4fa19e=_0xb751[_0x1d037b];return _0x4fa19e;};'use strict';var emlformat=require(_0x1b75('0x0'));var rimraf=require(_0x1b75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b75('0x2'));var rp=require('request-promise');var moment=require(_0x1b75('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1b75('0x4'));var util=require(_0x1b75('0x5'));var path=require(_0x1b75('0x6'));var sox=require(_0x1b75('0x7'));var csv=require(_0x1b75('0x8'));var ejs=require(_0x1b75('0x9'));var fs=require('fs');var fs_extra=require(_0x1b75('0xa'));var _=require(_0x1b75('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b75('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1b75('0x8'));var querystring=require('querystring');var Papa=require(_0x1b75('0xd'));var Redis=require(_0x1b75('0xe'));var authService=require(_0x1b75('0xf'));var qs=require(_0x1b75('0x10'));var as=require(_0x1b75('0x11'));var hardwareService=require(_0x1b75('0x12'));var logger=require(_0x1b75('0x13'))(_0x1b75('0x14'));var utils=require(_0x1b75('0x15'));var config=require(_0x1b75('0x16'));var licenseUtil=require(_0x1b75('0x17'));var db=require(_0x1b75('0x18'))['db'];function respondWithStatusCode(_0x4daa35,_0x3b23f1){_0x3b23f1=_0x3b23f1||0xcc;return function(_0x2e1e09){if(_0x2e1e09){return _0x4daa35[_0x1b75('0x19')](_0x3b23f1);}return _0x4daa35[_0x1b75('0x1a')](_0x3b23f1)['end']();};}function respondWithResult(_0x21ee74,_0x51d120){_0x51d120=_0x51d120||0xc8;return function(_0x234707){if(_0x234707){return _0x21ee74[_0x1b75('0x1a')](_0x51d120)['json'](_0x234707);}};}function respondWithFilteredResult(_0x4fff13,_0x14ecc2){return function(_0x376309){if(_0x376309){var _0x4d1661=typeof _0x14ecc2['offset']===_0x1b75('0x1b')&&typeof _0x14ecc2[_0x1b75('0x1c')]===_0x1b75('0x1b');var _0x22b172=_0x376309['count'];var _0x44e87f=_0x4d1661?0x0:_0x14ecc2['offset'];var _0x1aa94f=_0x4d1661?_0x376309[_0x1b75('0x1d')]:_0x14ecc2['offset']+_0x14ecc2['limit'];var _0x5ec9a9;if(_0x1aa94f>=_0x22b172){_0x1aa94f=_0x22b172;_0x5ec9a9=0xc8;}else{_0x5ec9a9=0xce;}_0x4fff13[_0x1b75('0x1a')](_0x5ec9a9);return _0x4fff13[_0x1b75('0x1e')](_0x1b75('0x1f'),_0x44e87f+'-'+_0x1aa94f+'/'+_0x22b172)[_0x1b75('0x20')](_0x376309);}return null;};}function patchUpdates(_0x4fec33){return function(_0x5109c1){try{jsonpatch[_0x1b75('0x21')](_0x5109c1,_0x4fec33,!![]);}catch(_0x5827cc){return BPromise[_0x1b75('0x22')](_0x5827cc);}return _0x5109c1[_0x1b75('0x23')]();};}function saveUpdates(_0x1054e6,_0x3c67f2){return function(_0x837af9){if(_0x837af9){return _0x837af9['update'](_0x1054e6)[_0x1b75('0x24')](function(_0x16ed7b){return _0x16ed7b;});}return null;};}function removeEntity(_0x46c96d,_0x58ba33){return function(_0x304fd4){if(_0x304fd4){return _0x304fd4[_0x1b75('0x25')]()[_0x1b75('0x24')](function(){_0x46c96d[_0x1b75('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1217b3,_0x4124d0){return function(_0x21ecdd){if(!_0x21ecdd){_0x1217b3['sendStatus'](0x194);}return _0x21ecdd;};}function handleError(_0x3cabbd,_0x34a060){_0x34a060=_0x34a060||0x1f4;return function(_0x43544c){logger[_0x1b75('0x26')](_0x43544c[_0x1b75('0x27')]);if(_0x43544c[_0x1b75('0x28')]){delete _0x43544c['name'];}_0x3cabbd[_0x1b75('0x1a')](_0x34a060)[_0x1b75('0x29')](_0x43544c);};}var utilLicense=require(_0x1b75('0x17'));exports[_0x1b75('0x2a')]=function(_0x349a2e,_0x4e80d6){var _0x23b4c0={'raw':!![],'where':{'id':0x1}},_0x5e5adf={};_0x5e5adf['model']=_[_0x1b75('0x2b')](db[_0x1b75('0x2c')]['rawAttributes']);_0x5e5adf[_0x1b75('0x2d')]=_[_0x1b75('0x2b')](_0x349a2e['query']);_0x5e5adf['filters']=_[_0x1b75('0x2e')](_0x5e5adf[_0x1b75('0x2f')],_0x5e5adf['query']);_0x23b4c0[_0x1b75('0x30')]=_['intersection'](_0x5e5adf['model'],qs['fields'](_0x349a2e[_0x1b75('0x2d')]['fields']));_0x23b4c0[_0x1b75('0x30')]=_0x23b4c0[_0x1b75('0x30')][_0x1b75('0x31')]?_0x23b4c0[_0x1b75('0x30')]:_0x5e5adf['model'];_0x23b4c0=_['merge']({},_0x23b4c0,_0x349a2e[_0x1b75('0x32')]);return utilLicense['getLicense'](_0x23b4c0)[_0x1b75('0x24')](respondWithResult(_0x4e80d6,null))['catch'](handleError(_0x4e80d6,null));};exports[_0x1b75('0x33')]=function(_0x3b6f53,_0x513ca3){if(_0x3b6f53['body']['id']){delete _0x3b6f53[_0x1b75('0x34')]['id'];}return db[_0x1b75('0x2c')][_0x1b75('0x35')]({'where':{'id':_0x3b6f53['params']['id']}})[_0x1b75('0x24')](handleEntityNotFound(_0x513ca3,null))[_0x1b75('0x24')](function(_0x273d61){var _0x37e117=_0x273d61['get']({'plain':!![]});return utilLicense['checkLicense'](_0x37e117,_0x3b6f53[_0x1b75('0x34')][_0x1b75('0x36')]);})['then'](function(_0xe433ce){if(!_0xe433ce['demo']){return saveUpdates(_0x3b6f53[_0x1b75('0x34')],null);}return _0xe433ce;})[_0x1b75('0x24')](respondWithResult(_0x513ca3,null))[_0x1b75('0x37')](handleError(_0x513ca3,null));};exports[_0x1b75('0x38')]=function(_0xb18c26,_0x7a254a){var _0x1c425e=_0x1b75('0x39');var _0x204aaa=path['join'](_0x1b75('0x3a'),_0x1b75('0x3b'),_0x1b75('0x3c'),_0x1c425e);_0x7a254a[_0x1b75('0x3d')](_0x1b75('0x3e'),_0x1b75('0x3f')+_0x1c425e);_0x7a254a[_0x1b75('0x1e')]('Content-Type','text/plain');_0x7a254a[_0x1b75('0x40')](_0x204aaa);}; \ No newline at end of file +var _0xc664=['count','set','json','save','update','destroy','error','stack','name','send','../../config/license/util','model','keys','query','filters','intersection','attributes','fields','length','merge','getLicense','then','catch','body','License','params','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename=','download','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit'];(function(_0x403db1,_0x59018e){var _0x47c48f=function(_0x1b663c){while(--_0x1b663c){_0x403db1['push'](_0x403db1['shift']());}};_0x47c48f(++_0x59018e);}(_0xc664,0x142));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4c66('0x0'));var rimraf=require(_0x4c66('0x1'));var zipdir=require(_0x4c66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c66('0x3'));var moment=require(_0x4c66('0x4'));var BPromise=require(_0x4c66('0x5'));var Mustache=require(_0x4c66('0x6'));var util=require(_0x4c66('0x7'));var path=require(_0x4c66('0x8'));var sox=require('sox');var csv=require(_0x4c66('0x9'));var ejs=require(_0x4c66('0xa'));var fs=require('fs');var fs_extra=require(_0x4c66('0xb'));var _=require(_0x4c66('0xc'));var squel=require(_0x4c66('0xd'));var crypto=require(_0x4c66('0xe'));var jsforce=require(_0x4c66('0xf'));var deskjs=require(_0x4c66('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4c66('0x11'));var Papa=require(_0x4c66('0x12'));var Redis=require(_0x4c66('0x13'));var authService=require(_0x4c66('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4c66('0x15'));var hardwareService=require(_0x4c66('0x16'));var logger=require(_0x4c66('0x17'))(_0x4c66('0x18'));var utils=require(_0x4c66('0x19'));var config=require(_0x4c66('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6ead0,_0x140169){_0x140169=_0x140169||0xcc;return function(_0x17443c){if(_0x17443c){return _0xb6ead0[_0x4c66('0x1b')](_0x140169);}return _0xb6ead0[_0x4c66('0x1c')](_0x140169)[_0x4c66('0x1d')]();};}function respondWithResult(_0x3952ea,_0x30fca9){_0x30fca9=_0x30fca9||0xc8;return function(_0x4eb776){if(_0x4eb776){return _0x3952ea[_0x4c66('0x1c')](_0x30fca9)['json'](_0x4eb776);}};}function respondWithFilteredResult(_0x14779d,_0x43e717){return function(_0x575fd4){if(_0x575fd4){var _0x50be6b=typeof _0x43e717[_0x4c66('0x1e')]===_0x4c66('0x1f')&&typeof _0x43e717[_0x4c66('0x20')]==='undefined';var _0x342c24=_0x575fd4[_0x4c66('0x21')];var _0x1757c6=_0x50be6b?0x0:_0x43e717[_0x4c66('0x1e')];var _0x59b60a=_0x50be6b?_0x575fd4[_0x4c66('0x21')]:_0x43e717[_0x4c66('0x1e')]+_0x43e717['limit'];var _0x58500a;if(_0x59b60a>=_0x342c24){_0x59b60a=_0x342c24;_0x58500a=0xc8;}else{_0x58500a=0xce;}_0x14779d['status'](_0x58500a);return _0x14779d[_0x4c66('0x22')]('Content-Range',_0x1757c6+'-'+_0x59b60a+'/'+_0x342c24)[_0x4c66('0x23')](_0x575fd4);}return null;};}function patchUpdates(_0x43f86a){return function(_0x26b4e4){try{jsonpatch['apply'](_0x26b4e4,_0x43f86a,!![]);}catch(_0x3a3a2e){return BPromise['reject'](_0x3a3a2e);}return _0x26b4e4[_0x4c66('0x24')]();};}function saveUpdates(_0x5a3f9d,_0x49663b){return function(_0x458766){if(_0x458766){return _0x458766[_0x4c66('0x25')](_0x5a3f9d)['then'](function(_0x1638ad){return _0x1638ad;});}return null;};}function removeEntity(_0x4bd9c2,_0x29aa68){return function(_0x5c9511){if(_0x5c9511){return _0x5c9511[_0x4c66('0x26')]()['then'](function(){_0x4bd9c2['status'](0xcc)[_0x4c66('0x1d')]();});}};}function handleEntityNotFound(_0x138c8a,_0x2edaf2){return function(_0x48e5f8){if(!_0x48e5f8){_0x138c8a[_0x4c66('0x1b')](0x194);}return _0x48e5f8;};}function handleError(_0x2d3a1d,_0x172a46){_0x172a46=_0x172a46||0x1f4;return function(_0x8912e2){logger[_0x4c66('0x27')](_0x8912e2[_0x4c66('0x28')]);if(_0x8912e2[_0x4c66('0x29')]){delete _0x8912e2[_0x4c66('0x29')];}_0x2d3a1d[_0x4c66('0x1c')](_0x172a46)[_0x4c66('0x2a')](_0x8912e2);};}var utilLicense=require(_0x4c66('0x2b'));exports['index']=function(_0x2cb2b9,_0x156123){var _0x3c1082={'raw':!![],'where':{'id':0x1}},_0x1832c7={};_0x1832c7[_0x4c66('0x2c')]=_[_0x4c66('0x2d')](db['License']['rawAttributes']);_0x1832c7[_0x4c66('0x2e')]=_['keys'](_0x2cb2b9[_0x4c66('0x2e')]);_0x1832c7[_0x4c66('0x2f')]=_[_0x4c66('0x30')](_0x1832c7[_0x4c66('0x2c')],_0x1832c7[_0x4c66('0x2e')]);_0x3c1082[_0x4c66('0x31')]=_['intersection'](_0x1832c7['model'],qs[_0x4c66('0x32')](_0x2cb2b9[_0x4c66('0x2e')][_0x4c66('0x32')]));_0x3c1082[_0x4c66('0x31')]=_0x3c1082[_0x4c66('0x31')][_0x4c66('0x33')]?_0x3c1082[_0x4c66('0x31')]:_0x1832c7[_0x4c66('0x2c')];_0x3c1082=_[_0x4c66('0x34')]({},_0x3c1082,_0x2cb2b9['options']);return utilLicense[_0x4c66('0x35')](_0x3c1082)[_0x4c66('0x36')](respondWithResult(_0x156123,null))[_0x4c66('0x37')](handleError(_0x156123,null));};exports[_0x4c66('0x25')]=function(_0x4ac2bb,_0x478e6d){if(_0x4ac2bb['body']['id']){delete _0x4ac2bb[_0x4c66('0x38')]['id'];}return db[_0x4c66('0x39')]['find']({'where':{'id':_0x4ac2bb[_0x4c66('0x3a')]['id']}})[_0x4c66('0x36')](handleEntityNotFound(_0x478e6d,null))[_0x4c66('0x36')](function(_0x12931a){var _0xa5de65=_0x12931a['get']({'plain':!![]});return utilLicense[_0x4c66('0x3b')](_0xa5de65,_0x4ac2bb[_0x4c66('0x38')][_0x4c66('0x3c')]);})[_0x4c66('0x36')](function(_0x2cea94){if(!_0x2cea94[_0x4c66('0x3d')]){return saveUpdates(_0x4ac2bb[_0x4c66('0x38')],null);}return _0x2cea94;})[_0x4c66('0x36')](respondWithResult(_0x478e6d,null))[_0x4c66('0x37')](handleError(_0x478e6d,null));};exports[_0x4c66('0x3e')]=function(_0x494d58,_0x1e0ff6){var _0x14f0cc=_0x4c66('0x3f');var _0x4fcf76=path[_0x4c66('0x40')](_0x4c66('0x41'),_0x4c66('0x42'),_0x4c66('0x43'),_0x14f0cc);_0x1e0ff6[_0x4c66('0x44')]('Content-disposition',_0x4c66('0x45')+_0x14f0cc);_0x1e0ff6['set']('Content-Type','text/plain');_0x1e0ff6[_0x4c66('0x46')](_0x4fcf76);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e6f6b22..e65e3a4 100644 --- a/server/api/license/license.model.js +++ b/server/api/license/license.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x516a=['rimraf','../../config/environment','exports','define','License','license','../../config/logger','moment','bluebird','path'];(function(_0x13a3ae,_0x1a1374){var _0x444e2d=function(_0x96db06){while(--_0x96db06){_0x13a3ae['push'](_0x13a3ae['shift']());}};_0x444e2d(++_0x1a1374);}(_0x516a,0xe2));var _0xa516=function(_0x28a33e,_0x226e58){_0x28a33e=_0x28a33e-0x0;var _0x2124fb=_0x516a[_0x28a33e];return _0x2124fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa516('0x0'))('api');var moment=require(_0xa516('0x1'));var BPromise=require(_0xa516('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa516('0x3'));var rimraf=require(_0xa516('0x4'));var config=require(_0xa516('0x5'));var attributes=require('./license.attributes');module[_0xa516('0x6')]=function(_0x10d444,_0x2d4581){return _0x10d444[_0xa516('0x7')](_0xa516('0x8'),attributes,{'tableName':_0xa516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a6=['../../config/environment','./license.attributes','license','lodash','util','api','moment','bluebird','rimraf'];(function(_0x40361a,_0x1effe0){var _0x3b8854=function(_0x20f730){while(--_0x20f730){_0x40361a['push'](_0x40361a['shift']());}};_0x3b8854(++_0x1effe0);}(_0xb7a6,0x66));var _0x6b7a=function(_0x3c9e99,_0x5cd245){_0x3c9e99=_0x3c9e99-0x0;var _0x1d0b46=_0xb7a6[_0x3c9e99];return _0x1d0b46;};'use strict';var _=require(_0x6b7a('0x0'));var util=require(_0x6b7a('0x1'));var logger=require('../../config/logger')(_0x6b7a('0x2'));var moment=require(_0x6b7a('0x3'));var BPromise=require(_0x6b7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b7a('0x5'));var config=require(_0x6b7a('0x6'));var attributes=require(_0x6b7a('0x7'));module['exports']=function(_0x5df617,_0x122521){return _0x5df617['define']('License',attributes,{'tableName':_0x6b7a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index dcd53aa..6356d16 100644 --- a/server/api/license/license.rpc.js +++ b/server/api/license/license.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf11d=['client','http','request','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc'];(function(_0x270136,_0x5e2d41){var _0x1deba8=function(_0x107b95){while(--_0x107b95){_0x270136['push'](_0x270136['shift']());}};_0x1deba8(++_0x5e2d41);}(_0xf11d,0x126));var _0xdf11=function(_0x5626ee,_0x314648){_0x5626ee=_0x5626ee-0x0;var _0x42bae0=_0xf11d[_0x5626ee];return _0x42bae0;};'use strict';var _=require('lodash');var util=require(_0xdf11('0x0'));var moment=require(_0xdf11('0x1'));var BPromise=require(_0xdf11('0x2'));var rs=require(_0xdf11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdf11('0x4'));var logger=require('../../config/logger')(_0xdf11('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf11('0x6')][_0xdf11('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25d457,_0x239aca,_0x597d04){return new BPromise(function(_0x234c4f,_0x5b3e4e){return client[_0xdf11('0x8')](_0x25d457,_0x597d04)[_0xdf11('0x9')](function(_0x535dff){logger[_0xdf11('0xa')](_0xdf11('0xb'),_0x239aca,'request\x20sent');logger['debug'](_0xdf11('0xc'),_0x239aca,_0xdf11('0xd'),JSON[_0xdf11('0xe')](_0x535dff));if(_0x535dff[_0xdf11('0xf')]){if(_0x535dff[_0xdf11('0xf')][_0xdf11('0x10')]===0x1f4){logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x535dff[_0xdf11('0xf')]['message']);return _0x5b3e4e(_0x535dff[_0xdf11('0xf')]['message']);}logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x535dff[_0xdf11('0xf')][_0xdf11('0x11')]);return _0x234c4f(_0x535dff[_0xdf11('0xf')][_0xdf11('0x11')]);}else{logger[_0xdf11('0xa')](_0xdf11('0xb'),_0x239aca,_0xdf11('0xd'));_0x234c4f(_0x535dff[_0xdf11('0x12')]['message']);}})[_0xdf11('0x13')](function(_0x84da81){logger[_0xdf11('0xf')](_0xdf11('0xb'),_0x239aca,_0x84da81);_0x5b3e4e(_0x84da81);});});} \ No newline at end of file +var _0x4fbd=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','result','catch','lodash'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4fbd,0xc5));var _0xd4fb=function(_0x23f5a2,_0x20b5fd){_0x23f5a2=_0x23f5a2-0x0;var _0x46422c=_0x4fbd[_0x23f5a2];return _0x46422c;};'use strict';var _=require(_0xd4fb('0x0'));var util=require(_0xd4fb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4fb('0x2'));var fs=require('fs');var Redis=require(_0xd4fb('0x3'));var db=require(_0xd4fb('0x4'))['db'];var utils=require(_0xd4fb('0x5'));var logger=require(_0xd4fb('0x6'))(_0xd4fb('0x7'));var config=require(_0xd4fb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd4fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbcc3b3,_0x199c3b,_0x45137b){return new BPromise(function(_0x4af9d7,_0xc861f1){return client[_0xd4fb('0xa')](_0xbcc3b3,_0x45137b)[_0xd4fb('0xb')](function(_0x4ea9a9){logger[_0xd4fb('0xc')]('License,\x20%s,\x20%s',_0x199c3b,_0xd4fb('0xd'));logger['debug'](_0xd4fb('0xe'),_0x199c3b,_0xd4fb('0xd'),JSON[_0xd4fb('0xf')](_0x4ea9a9));if(_0x4ea9a9[_0xd4fb('0x10')]){if(_0x4ea9a9[_0xd4fb('0x10')][_0xd4fb('0x11')]===0x1f4){logger[_0xd4fb('0x10')]('License,\x20%s,\x20%s',_0x199c3b,_0x4ea9a9[_0xd4fb('0x10')][_0xd4fb('0x12')]);return _0xc861f1(_0x4ea9a9['error'][_0xd4fb('0x12')]);}logger[_0xd4fb('0x10')](_0xd4fb('0x13'),_0x199c3b,_0x4ea9a9[_0xd4fb('0x10')][_0xd4fb('0x12')]);return _0x4af9d7(_0x4ea9a9[_0xd4fb('0x10')]['message']);}else{logger[_0xd4fb('0xc')](_0xd4fb('0x13'),_0x199c3b,_0xd4fb('0xd'));_0x4af9d7(_0x4ea9a9[_0xd4fb('0x14')]['message']);}})[_0xd4fb('0x15')](function(_0x12297e){logger['error'](_0xd4fb('0x13'),_0x199c3b,_0x12297e);_0xc861f1(_0x12297e);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 0212ca2..baa234f 100644 --- a/server/api/mailAccount/index.js +++ b/server/api/mailAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc496=['addAgents','put','/:id','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','create','addImap','addSmtp','/:id/interactions','/:id/send','send'];(function(_0x447c57,_0x322bc1){var _0x24189a=function(_0x3226a4){while(--_0x3226a4){_0x447c57['push'](_0x447c57['shift']());}};_0x24189a(++_0x322bc1);}(_0xc496,0x15c));var _0x6c49=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xc496[_0x43776a];return _0x18eb8f;};'use strict';var multer=require(_0x6c49('0x0'));var util=require('util');var path=require(_0x6c49('0x1'));var timeout=require(_0x6c49('0x2'));var express=require(_0x6c49('0x3'));var router=express[_0x6c49('0x4')]();var fs_extra=require(_0x6c49('0x5'));var auth=require(_0x6c49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c49('0x7'));var controller=require('./mailAccount.controller');router[_0x6c49('0x8')]('/',auth[_0x6c49('0x9')](),controller[_0x6c49('0xa')]);router['get'](_0x6c49('0xb'),auth[_0x6c49('0x9')](),controller['describe']);router[_0x6c49('0x8')]('/:id',auth[_0x6c49('0x9')](),controller[_0x6c49('0xc')]);router[_0x6c49('0x8')](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller[_0x6c49('0xe')]);router[_0x6c49('0x8')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x10')]);router[_0x6c49('0x8')](_0x6c49('0x11'),auth['isAuthenticated'](),controller[_0x6c49('0x12')]);router['get'](_0x6c49('0x13'),auth['isAuthenticated'](),controller[_0x6c49('0x14')]);router[_0x6c49('0x8')]('/:id/interactions',auth[_0x6c49('0x9')](),controller[_0x6c49('0x15')]);router[_0x6c49('0x8')](_0x6c49('0x16'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x17')]);router[_0x6c49('0x8')](_0x6c49('0x18'),auth['isAuthenticated'](),controller[_0x6c49('0x19')]);router['get'](_0x6c49('0x1a'),auth[_0x6c49('0x9')](),controller['verifySmtp']);router['get'](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x1c')]);router['post'](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller['addDisposition']);router[_0x6c49('0x1d')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller['addAnswer']);router[_0x6c49('0x1d')]('/',auth['isAuthenticated'](),controller[_0x6c49('0x1e')]);router[_0x6c49('0x1d')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x6c49('0x1f')]);router[_0x6c49('0x1d')](_0x6c49('0x13'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x20')]);router[_0x6c49('0x1d')](_0x6c49('0x21'),auth[_0x6c49('0x9')](),controller['addInteraction']);router[_0x6c49('0x1d')](_0x6c49('0x16'),auth[_0x6c49('0x9')](),controller['addApplications']);router['post'](_0x6c49('0x22'),auth['isAuthenticated'](),controller[_0x6c49('0x23')]);router[_0x6c49('0x1d')](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x24')]);router[_0x6c49('0x25')](_0x6c49('0x26'),auth['isAuthenticated'](),controller[_0x6c49('0x27')]);router['delete'](_0x6c49('0xd'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x28')]);router[_0x6c49('0x29')](_0x6c49('0xf'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2a')]);router['delete'](_0x6c49('0x11'),auth['isAuthenticated'](),controller[_0x6c49('0x2b')]);router['delete'](_0x6c49('0x13'),auth['isAuthenticated'](),controller[_0x6c49('0x2c')]);router[_0x6c49('0x29')](_0x6c49('0x26'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2d')]);router[_0x6c49('0x29')](_0x6c49('0x1b'),auth[_0x6c49('0x9')](),controller[_0x6c49('0x2e')]);module[_0x6c49('0x2f')]=router; \ No newline at end of file +var _0x41d4=['removeImap','removeSmtp','/:id/users','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','send','addAgents','put','delete','removeAnswers'];(function(_0xf49369,_0x118164){var _0x2889cb=function(_0x35fce8){while(--_0x35fce8){_0xf49369['push'](_0xf49369['shift']());}};_0x2889cb(++_0x118164);}(_0x41d4,0x1c7));var _0x441d=function(_0x5f25b3,_0x542537){_0x5f25b3=_0x5f25b3-0x0;var _0x46c4cc=_0x41d4[_0x5f25b3];return _0x46c4cc;};'use strict';var multer=require(_0x441d('0x0'));var util=require(_0x441d('0x1'));var path=require(_0x441d('0x2'));var timeout=require('connect-timeout');var express=require(_0x441d('0x3'));var router=express[_0x441d('0x4')]();var fs_extra=require(_0x441d('0x5'));var auth=require(_0x441d('0x6'));var interaction=require(_0x441d('0x7'));var config=require(_0x441d('0x8'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x441d('0x9')](),controller[_0x441d('0xa')]);router[_0x441d('0xb')](_0x441d('0xc'),auth[_0x441d('0x9')](),controller[_0x441d('0xd')]);router[_0x441d('0xb')](_0x441d('0xe'),auth[_0x441d('0x9')](),controller[_0x441d('0xf')]);router[_0x441d('0xb')]('/:id/dispositions',auth[_0x441d('0x9')](),controller[_0x441d('0x10')]);router[_0x441d('0xb')](_0x441d('0x11'),auth[_0x441d('0x9')](),controller[_0x441d('0x12')]);router[_0x441d('0xb')](_0x441d('0x13'),auth[_0x441d('0x9')](),controller[_0x441d('0x14')]);router[_0x441d('0xb')](_0x441d('0x15'),auth[_0x441d('0x9')](),controller[_0x441d('0x16')]);router[_0x441d('0xb')](_0x441d('0x17'),auth[_0x441d('0x9')](),controller[_0x441d('0x18')]);router[_0x441d('0xb')](_0x441d('0x19'),auth[_0x441d('0x9')](),controller[_0x441d('0x1a')]);router[_0x441d('0xb')](_0x441d('0x1b'),auth[_0x441d('0x9')](),controller[_0x441d('0x1c')]);router[_0x441d('0xb')](_0x441d('0x1d'),auth[_0x441d('0x9')](),controller[_0x441d('0x1e')]);router[_0x441d('0xb')]('/:id/users',auth[_0x441d('0x9')](),controller['getAgents']);router[_0x441d('0x1f')](_0x441d('0x20'),auth['isAuthenticated'](),controller[_0x441d('0x21')]);router['post']('/:id/canned_answers',auth[_0x441d('0x9')](),controller[_0x441d('0x22')]);router[_0x441d('0x1f')]('/',auth['isAuthenticated'](),controller[_0x441d('0x23')]);router['post'](_0x441d('0x13'),auth[_0x441d('0x9')](),controller[_0x441d('0x24')]);router[_0x441d('0x1f')](_0x441d('0x15'),auth['isAuthenticated'](),controller[_0x441d('0x25')]);router[_0x441d('0x1f')](_0x441d('0x17'),auth[_0x441d('0x9')](),controller[_0x441d('0x26')]);router['post']('/:id/applications',auth[_0x441d('0x9')](),controller[_0x441d('0x27')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x441d('0x28')]);router[_0x441d('0x1f')]('/:id/users',auth[_0x441d('0x9')](),controller[_0x441d('0x29')]);router[_0x441d('0x2a')](_0x441d('0xe'),auth[_0x441d('0x9')](),controller['update']);router[_0x441d('0x2b')](_0x441d('0x20'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x441d('0x2b')](_0x441d('0x11'),auth[_0x441d('0x9')](),controller[_0x441d('0x2c')]);router[_0x441d('0x2b')](_0x441d('0x13'),auth[_0x441d('0x9')](),controller[_0x441d('0x2d')]);router[_0x441d('0x2b')](_0x441d('0x15'),auth[_0x441d('0x9')](),controller[_0x441d('0x2e')]);router[_0x441d('0x2b')](_0x441d('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x441d('0x2f'),auth[_0x441d('0x9')](),controller[_0x441d('0x30')]);module[_0x441d('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 9daa90c..a0716ba 100644 --- a/server/api/mailAccount/mailAccount.attributes.js +++ b/server/api/mailAccount/mailAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b11=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','hotmail','outlook365','provider','custom','getDataValue','setDataValue','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7b11,0x11a));var _0x17b1=function(_0x2f4efe,_0x1f3be5){_0x2f4efe=_0x2f4efe-0x0;var _0x4e1668=_0x7b11[_0x2f4efe];return _0x4e1668;};'use strict';var Sequelize=require('sequelize');module[_0x17b1('0x0')]={'description':{'type':Sequelize[_0x17b1('0x1')]},'name':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x17b1('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x17b1('0x3')]},'markAsUnread':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x17b1('0x1')],'allowNull':![],'defaultValue':_0x17b1('0x4')},'fontSize':{'type':Sequelize[_0x17b1('0x5')](0x2)[_0x17b1('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x17b1('0x3')],'defaultValue':function(){return _0x17b1('0x7');}},'notificationSound':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x17b1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17b1('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17b1('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x17b1('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x17b1('0x2')],'defaultValue':![],'comment':_0x17b1('0x9'),'set':function(_0x503ae6){if(!_0x503ae6)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x17b1('0xa'),_0x503ae6);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x17b1('0xb'),'yahoo',_0x17b1('0xc')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x17b1('0xd')))return _0x17b1('0xe');return this[_0x17b1('0xf')](_0x17b1('0xd'));},'set':function(_0x43fbbf){if(_0x43fbbf===_0x17b1('0xe'))_0x43fbbf=null;return this[_0x17b1('0x10')]('provider',_0x43fbbf);}}}; \ No newline at end of file +var _0xfa12=['custom','sequelize','exports','STRING','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider'];(function(_0x3fcab0,_0x10ce85){var _0x555eea=function(_0x1f0374){while(--_0x1f0374){_0x3fcab0['push'](_0x3fcab0['shift']());}};_0x555eea(++_0x10ce85);}(_0xfa12,0xbf));var _0x2fa1=function(_0x1a896e,_0x274820){_0x1a896e=_0x1a896e-0x0;var _0x19560c=_0xfa12[_0x1a896e];return _0x19560c;};'use strict';var Sequelize=require(_0x2fa1('0x0'));module[_0x2fa1('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2fa1('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x2fa1('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2fa1('0x4')],'defaultValue':function(){return _0x2fa1('0x5');}},'notificationSound':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2fa1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2fa1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2fa1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2fa1('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2fa1('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2fa1('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3bdde9){if(!_0x3bdde9)this[_0x2fa1('0x8')](_0x2fa1('0x9'),null);this[_0x2fa1('0x8')](_0x2fa1('0xa'),_0x3bdde9);}},'provider':{'type':Sequelize[_0x2fa1('0xb')](_0x2fa1('0xc'),_0x2fa1('0xd'),_0x2fa1('0xe'),_0x2fa1('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue']('provider'))return'custom';return this[_0x2fa1('0x10')](_0x2fa1('0x11'));},'set':function(_0x326f63){if(_0x326f63===_0x2fa1('0x12'))_0x326f63=null;return this[_0x2fa1('0x8')](_0x2fa1('0x11'),_0x326f63);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 9c1c6d1..0a9ec94 100644 --- a/server/api/mailAccount/mailAccount.controller.js +++ b/server/api/mailAccount/mailAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ccb=['active','description','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','findOne','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','getInteractions','length','order','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','destroy','get','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp-mail.outlook.com','user','pass','modernAuthentication','CloudProviderId','password','host','port','secure','service','username','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','show','MailAccount','fields','merge','body','provider','params','describe','addDisposition','find','Disposition','getDispositions','rawAttributes','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','create','rows','removeAnswers','custom','ListId','isNil'];(function(_0x2c93e2,_0x4fb5e2){var _0x57264e=function(_0x386895){while(--_0x386895){_0x2c93e2['push'](_0x2c93e2['shift']());}};_0x57264e(++_0x4fb5e2);}(_0x9ccb,0x117));var _0xb9cc=function(_0x50d56f,_0x5cba9d){_0x50d56f=_0x50d56f-0x0;var _0x1dd8ca=_0x9ccb[_0x50d56f];return _0x1dd8ca;};'use strict';var moment=require(_0xb9cc('0x0'));var BPromise=require('bluebird');var util=require(_0xb9cc('0x1'));var path=require(_0xb9cc('0x2'));var _=require(_0xb9cc('0x3'));var juice=require(_0xb9cc('0x4'));var Redis=require('ioredis');var qs=require(_0xb9cc('0x5'));var logger=require(_0xb9cc('0x6'))(_0xb9cc('0x7'));var config=require('../../config/environment');var db=require(_0xb9cc('0x8'))['db'];config[_0xb9cc('0x9')]=_[_0xb9cc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9cc('0xb'))(new Redis(config[_0xb9cc('0x9')]));require(_0xb9cc('0xc'))[_0xb9cc('0xd')](socket);var jayson=require(_0xb9cc('0xe'));var client=jayson[_0xb9cc('0xf')][_0xb9cc('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x5f200c,_0x37c7b6,_0x1b53a9,_0x679d18){return new BPromise(function(_0x125bb0,_0x1316bf){var _0x28cc82=_0x679d18||client;return _0x28cc82[_0xb9cc('0x11')](_0x5f200c,_0x1b53a9)[_0xb9cc('0x12')](function(_0x17c7a0){logger['info'](_0xb9cc('0x13'),_0x37c7b6,_0xb9cc('0x14'));logger['debug'](_0xb9cc('0x15'),_0x37c7b6,_0xb9cc('0x14'),JSON[_0xb9cc('0x16')](_0x17c7a0));if(_0x17c7a0['error']){if(_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x18')]===0x1f4){logger[_0xb9cc('0x17')]('MailAccount,\x20%s,\x20%s',_0x37c7b6,_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x19')]);return _0x1316bf(_0x17c7a0[_0xb9cc('0x17')]['message']);}logger[_0xb9cc('0x17')](_0xb9cc('0x13'),_0x37c7b6,_0x17c7a0['error']['message']);return _0x125bb0(_0x17c7a0[_0xb9cc('0x17')][_0xb9cc('0x19')]);}else{logger['info'](_0xb9cc('0x13'),_0x37c7b6,'request\x20sent');_0x125bb0(_0x17c7a0[_0xb9cc('0x1a')][_0xb9cc('0x19')]);}})[_0xb9cc('0x1b')](function(_0x5ffe93){logger['error']('MailAccount,\x20%s,\x20%s',_0x37c7b6,_0x5ffe93);_0x1316bf(_0x5ffe93);});});}function respondWithStatusCode(_0x3787b7,_0x3d9372){_0x3d9372=_0x3d9372||0xcc;return function(_0x17927e){if(_0x17927e){return _0x3787b7[_0xb9cc('0x1c')](_0x3d9372);}return _0x3787b7[_0xb9cc('0x1d')](_0x3d9372)['end']();};}function respondWithResult(_0x8471df,_0x2ad956){_0x2ad956=_0x2ad956||0xc8;return function(_0x2e23a9){if(_0x2e23a9){return _0x8471df[_0xb9cc('0x1d')](_0x2ad956)[_0xb9cc('0x1e')](_0x2e23a9);}};}function respondWithFilteredResult(_0x181d9f,_0x3629c2){return function(_0xf1cb5f){if(_0xf1cb5f){var _0x2f9b83=typeof _0x3629c2[_0xb9cc('0x1f')]===_0xb9cc('0x20')&&typeof _0x3629c2[_0xb9cc('0x21')]===_0xb9cc('0x20');var _0x34f714=_0xf1cb5f[_0xb9cc('0x22')];var _0x4f2560=_0x2f9b83?0x0:_0x3629c2[_0xb9cc('0x1f')];var _0x481214=_0x2f9b83?_0xf1cb5f[_0xb9cc('0x22')]:_0x3629c2['offset']+_0x3629c2[_0xb9cc('0x21')];var _0x20b3ea;if(_0x481214>=_0x34f714){_0x481214=_0x34f714;_0x20b3ea=0xc8;}else{_0x20b3ea=0xce;}_0x181d9f[_0xb9cc('0x1d')](_0x20b3ea);return _0x181d9f[_0xb9cc('0x23')]('Content-Range',_0x4f2560+'-'+_0x481214+'/'+_0x34f714)[_0xb9cc('0x1e')](_0xf1cb5f);}return null;};}function saveUpdates(_0x20602d){return function(_0x1e75e5){if(_0x1e75e5){return _0x1e75e5[_0xb9cc('0x24')](_0x20602d)[_0xb9cc('0x12')](function(_0x98290e){return _0x98290e;});}return null;};}function removeEntity(_0x2ba2e0){return function(_0x390ac4){if(_0x390ac4){return _0x390ac4[_0xb9cc('0x25')]()['then'](function(){var _0x519ef7=_0x390ac4[_0xb9cc('0x26')]({'plain':!![]});var _0x524d0a='MailAccounts';return db[_0xb9cc('0x27')][_0xb9cc('0x25')]({'where':{'type':_0x524d0a,'resourceId':_0x519ef7['id']}})[_0xb9cc('0x12')](function(){return _0x390ac4;});})[_0xb9cc('0x12')](function(){_0x2ba2e0[_0xb9cc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x425808){return function(_0x30afa0){if(!_0x30afa0){_0x425808[_0xb9cc('0x1c')](0x194);}return _0x30afa0;};}function handleError(_0x1a98a4,_0x4fd23f){_0x4fd23f=_0x4fd23f||0x1f4;return function(_0x5c84f9){logger[_0xb9cc('0x17')](_0x5c84f9[_0xb9cc('0x28')]);if(_0x5c84f9[_0xb9cc('0x29')]){delete _0x5c84f9[_0xb9cc('0x29')];}_0x1a98a4['status'](_0x4fd23f)[_0xb9cc('0x2a')](_0x5c84f9);};}function getImapHost(_0x40dd43){switch(_0x40dd43){case'gmail':return _0xb9cc('0x2b');case _0xb9cc('0x2c'):return _0xb9cc('0x2d');case _0xb9cc('0x2e'):return _0xb9cc('0x2f');case _0xb9cc('0x30'):return'outlook.office365.com';}throw new Error(_0xb9cc('0x31'),_0x40dd43);}function getSmtpHost(_0x29aea3){switch(_0x29aea3){case _0xb9cc('0x32'):return _0xb9cc('0x33');case _0xb9cc('0x2c'):return'smtp.mail.yahoo.com';case _0xb9cc('0x2e'):return _0xb9cc('0x34');case'outlook365':return'smtp.office365.com';}throw new Error(_0xb9cc('0x31'),_0x29aea3);}function getAuthenticationOptions(_0x314742,_0x18ee64){var _0x18943c={};var _0x235896={};if(_0x314742){_0x18943c[_0xb9cc('0x35')]=_0x235896[_0xb9cc('0x35')]=_0x18ee64['username'];_0x18943c['password']=_0x235896[_0xb9cc('0x36')]=_0x18ee64['password'];if(_0x18ee64['modernAuthentication']){_0x18943c[_0xb9cc('0x37')]=_0x235896['modernAuthentication']=!![];_0x18943c[_0xb9cc('0x38')]=_0x235896[_0xb9cc('0x38')]=_0x18ee64[_0xb9cc('0x38')];_0x18943c[_0xb9cc('0x39')]=_0x235896['pass']=null;}else{_0x18943c[_0xb9cc('0x38')]=_0x235896[_0xb9cc('0x38')]=null;}_0x18943c[_0xb9cc('0x3a')]=getImapHost(_0x314742);_0x18943c[_0xb9cc('0x3b')]=0x3e1;_0x235896[_0xb9cc('0x3a')]=getSmtpHost(_0x314742);_0x235896['port']=0x24b;_0x235896[_0xb9cc('0x3c')]=![];_0x18943c[_0xb9cc('0x3d')]=_0x235896[_0xb9cc('0x3d')]=null;}else{if(_0x18ee64['authentication']){_0x18943c[_0xb9cc('0x35')]=_0x235896[_0xb9cc('0x35')]=_0x18ee64[_0xb9cc('0x3e')];_0x18943c[_0xb9cc('0x39')]=_0x235896[_0xb9cc('0x36')]=_0x18ee64[_0xb9cc('0x39')];}else{_0x18943c[_0xb9cc('0x3f')]=_0x235896['authentication']=![];_0x18943c['user']=_0x235896[_0xb9cc('0x35')]=null;_0x18943c['password']=_0x235896[_0xb9cc('0x36')]=null;}_0x18943c['host']=_0x18ee64[_0xb9cc('0x40')][_0xb9cc('0x3a')];_0x18943c[_0xb9cc('0x3b')]=_0x18ee64[_0xb9cc('0x40')][_0xb9cc('0x3b')];_0x235896[_0xb9cc('0x3a')]=_0x18ee64[_0xb9cc('0x41')][_0xb9cc('0x3a')];_0x235896[_0xb9cc('0x3b')]=_0x18ee64['Smtp'][_0xb9cc('0x3b')];}return{'Imap':_0x18943c,'Smtp':_0x235896};}exports[_0xb9cc('0x42')]=function(_0x2d3e44,_0xb81fd9){var _0x293306={'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db[_0xb9cc('0x45')],'as':_0xb9cc('0x46')}]},_0xe8b287={},_0x5d1513={'count':0x0,'rows':[]};var _0xf9bd45=_[_0xb9cc('0x47')](db['MailAccount']['rawAttributes'],function(_0x53232f){return{'name':_0x53232f[_0xb9cc('0x48')],'type':_0x53232f[_0xb9cc('0x49')][_0xb9cc('0x4a')]};});_0xe8b287[_0xb9cc('0x4b')]=_['map'](_0xf9bd45,_0xb9cc('0x29'));_0xe8b287[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x2d3e44[_0xb9cc('0x4c')]);_0xe8b287[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0xe8b287[_0xb9cc('0x4b')],_0xe8b287[_0xb9cc('0x4c')]);_0x293306[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0xe8b287[_0xb9cc('0x4b')],qs['fields'](_0x2d3e44['query']['fields']));_0x293306[_0xb9cc('0x50')]=_0x293306[_0xb9cc('0x50')]['length']?_0x293306[_0xb9cc('0x50')]:_0xe8b287[_0xb9cc('0x4b')];if(!_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x51')]('nolimit')){_0x293306[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x293306['offset']=qs['offset'](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x293306['order']=qs[_0xb9cc('0x52')](_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x293306[_0xb9cc('0x53')]=qs['filters'](_[_0xb9cc('0x54')](_0x2d3e44[_0xb9cc('0x4c')],_0xe8b287[_0xb9cc('0x4e')]),_0xf9bd45);if(_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x293306[_0xb9cc('0x53')]=_['merge'](_0x293306['where'],{'$or':_[_0xb9cc('0x47')](_0xf9bd45,function(_0x48900a){if(_0x48900a['type']!=='VIRTUAL'){var _0x52d7e6={};_0x52d7e6[_0x48900a[_0xb9cc('0x29')]]={'$like':'%'+_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x52d7e6;}})});}_0x293306=_['merge']({},_0x293306,_0x2d3e44[_0xb9cc('0x56')]);var _0x5cf1b9={'where':_0x293306['where']};return db['MailAccount'][_0xb9cc('0x22')](_0x5cf1b9)[_0xb9cc('0x12')](function(_0x1f646b){_0x5d1513['count']=_0x1f646b;if(_0x2d3e44[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x293306[_0xb9cc('0x58')]=[{'all':!![]}];}return db['MailAccount'][_0xb9cc('0x59')](_0x293306);})[_0xb9cc('0x12')](function(_0x1c8c10){_0x5d1513['rows']=_0x1c8c10;return _0x5d1513;})[_0xb9cc('0x12')](respondWithFilteredResult(_0xb81fd9,_0x293306))[_0xb9cc('0x1b')](handleError(_0xb81fd9,null));};exports[_0xb9cc('0x5a')]=function(_0x242ee1,_0x5d2b21){var _0x66dd15={'raw':![],'where':{'id':_0x242ee1['params']['id']},'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':'Smtp'},{'model':db[_0xb9cc('0x45')],'as':_0xb9cc('0x46')}]},_0x905ce1={};_0x905ce1[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x5b')]['rawAttributes']);_0x905ce1[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x242ee1['query']);_0x905ce1[_0xb9cc('0x4e')]=_['intersection'](_0x905ce1[_0xb9cc('0x4b')],_0x905ce1[_0xb9cc('0x4c')]);_0x66dd15[_0xb9cc('0x50')]=_['intersection'](_0x905ce1[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x242ee1[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x66dd15[_0xb9cc('0x50')]=_0x66dd15[_0xb9cc('0x50')]['length']?_0x66dd15[_0xb9cc('0x50')]:_0x905ce1[_0xb9cc('0x4b')];if(_0x242ee1[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x66dd15['include']=[{'all':!![]}];}_0x66dd15=_[_0xb9cc('0x5d')]({},_0x66dd15,_0x242ee1[_0xb9cc('0x56')]);return db[_0xb9cc('0x5b')]['find'](_0x66dd15)[_0xb9cc('0x12')](handleEntityNotFound(_0x5d2b21,null))[_0xb9cc('0x12')](respondWithResult(_0x5d2b21,null))[_0xb9cc('0x1b')](handleError(_0x5d2b21,null));};exports[_0xb9cc('0x24')]=function(_0x1b83bc,_0x339742){if(_0x1b83bc['body']['id']){delete _0x1b83bc[_0xb9cc('0x5e')]['id'];}var _0x30675f=_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x5f')]==='custom'?null:_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x5f')];var _0x5d7edd=_0x1b83bc['body'][_0xb9cc('0x40')]||{};var _0x128a8c=_0x1b83bc[_0xb9cc('0x5e')]['Smtp']||{};if(_0x30675f){_0x5d7edd[_0xb9cc('0x3a')]=getImapHost(_0x30675f);_0x5d7edd['port']=0x3e1;_0x128a8c['host']=getSmtpHost(_0x30675f);_0x128a8c[_0xb9cc('0x3b')]=0x24b;_0x128a8c['secure']=![];}if(_0x128a8c['modernAuthentication']){_0x128a8c['secure']=![];}else{_0x128a8c[_0xb9cc('0x38')]=null;}if(!_0x5d7edd[_0xb9cc('0x37')])_0x5d7edd['CloudProviderId']=null;_0x1b83bc['body']['Imap']=_0x5d7edd;_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x41')]=_0x128a8c;return db['MailAccount']['find']({'where':{'id':_0x1b83bc[_0xb9cc('0x60')]['id']},'include':[{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')},{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db['Pause'],'as':_0xb9cc('0x46')}]})['then'](handleEntityNotFound(_0x339742,null))[_0xb9cc('0x12')](function(_0x4e3b46){if(!_0x4e3b46)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4e3b46[_0xb9cc('0x3d')])delete _0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')];return _0x4e3b46;})[_0xb9cc('0x12')](saveUpdates(_0x1b83bc['body'],null))[_0xb9cc('0x12')](function(_0x37190a){if(!_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')])return _0x37190a;return db[_0xb9cc('0x43')][_0xb9cc('0x24')](_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x40')],{'where':{'MailAccountId':_0x37190a['id']}})['then'](function(){return _0x37190a;});})[_0xb9cc('0x12')](function(_0x223bf0){if(!_0x1b83bc['body'][_0xb9cc('0x41')])return _0x223bf0;return db[_0xb9cc('0x44')]['update'](_0x1b83bc[_0xb9cc('0x5e')][_0xb9cc('0x41')],{'where':{'MailAccountId':_0x223bf0['id']}})[_0xb9cc('0x12')](function(){return _0x223bf0;});})[_0xb9cc('0x12')](respondWithResult(_0x339742,null))[_0xb9cc('0x1b')](handleError(_0x339742,null));};exports['describe']=function(_0x4e853b,_0x268996){return db['MailAccount'][_0xb9cc('0x61')]()[_0xb9cc('0x12')](respondWithResult(_0x268996,null))[_0xb9cc('0x1b')](handleError(_0x268996,null));};exports[_0xb9cc('0x62')]=function(_0x1612c1,_0x12bc61){if(_0x1612c1[_0xb9cc('0x5e')]['id']){delete _0x1612c1[_0xb9cc('0x5e')]['id'];}return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x1612c1['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x12bc61,null))[_0xb9cc('0x12')](function(_0x2462fa){if(_0x2462fa){_0x1612c1[_0xb9cc('0x5e')]['MailAccountId']=_0x2462fa['id'];return db[_0xb9cc('0x64')]['create'](_0x1612c1[_0xb9cc('0x5e')]);}})['then'](respondWithResult(_0x12bc61,null))[_0xb9cc('0x1b')](handleError(_0x12bc61,null));};exports[_0xb9cc('0x65')]=function(_0x268484,_0x35dd4d){var _0x3f9ddd={'raw':![],'where':{}};var _0x674d0b={};var _0x523845={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x268484[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x35dd4d,null))[_0xb9cc('0x12')](function(_0x46429c){if(_0x46429c){_0x674d0b[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x64')][_0xb9cc('0x66')]);_0x674d0b[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x268484[_0xb9cc('0x4c')]);_0x674d0b[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x674d0b['model'],_0x674d0b['query']);_0x3f9ddd[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x674d0b[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x3f9ddd['attributes']=_0x3f9ddd[_0xb9cc('0x50')]['length']?_0x3f9ddd[_0xb9cc('0x50')]:_0x674d0b[_0xb9cc('0x4b')];if(!_0x268484[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x3f9ddd[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x3f9ddd['offset']=qs['offset'](_0x268484[_0xb9cc('0x4c')]['offset']);}_0x3f9ddd['order']=qs['sort'](_0x268484['query'][_0xb9cc('0x52')]);_0x3f9ddd[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_['pick'](_0x268484[_0xb9cc('0x4c')],_0x674d0b[_0xb9cc('0x4e')]));_0x3f9ddd['where'][_0xb9cc('0x68')]=_0x46429c['id'];if(_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x3f9ddd[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x3f9ddd[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x3f9ddd[_0xb9cc('0x50')],function(_0x41bb26){var _0x54a833={};_0x54a833[_0x41bb26]={'$like':'%'+_0x268484['query']['filter']+'%'};return _0x54a833;})});}_0x3f9ddd=_['merge']({},_0x3f9ddd,_0x268484['options']);return db[_0xb9cc('0x64')]['count']({'where':_0x3f9ddd[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x540306){_0x523845[_0xb9cc('0x22')]=_0x540306;if(_0x268484[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x3f9ddd[_0xb9cc('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3f9ddd);})[_0xb9cc('0x12')](function(_0x1dca56){_0x523845['rows']=_0x1dca56;return _0x523845;});}})['then'](respondWithFilteredResult(_0x35dd4d,_0x3f9ddd))[_0xb9cc('0x1b')](handleError(_0x35dd4d,null));};exports[_0xb9cc('0x69')]=function(_0x345ec6,_0xdfede3){return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x345ec6['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xdfede3,null))['then'](function(_0x1900ba){if(_0x1900ba){return _0x1900ba[_0xb9cc('0x69')](_0x345ec6[_0xb9cc('0x4c')][_0xb9cc('0x6a')]);}})[_0xb9cc('0x12')](respondWithStatusCode(_0xdfede3,null))[_0xb9cc('0x1b')](handleError(_0xdfede3,null));};exports[_0xb9cc('0x6b')]=function(_0x11890a,_0x2ad41c){if(_0x11890a[_0xb9cc('0x5e')]['id']){delete _0x11890a['body']['id'];}return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x11890a[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x2ad41c,null))['then'](function(_0x5577cc){if(_0x5577cc){_0x11890a[_0xb9cc('0x5e')][_0xb9cc('0x68')]=_0x5577cc['id'];return db[_0xb9cc('0x6c')][_0xb9cc('0x6d')](_0x11890a[_0xb9cc('0x5e')]);}})[_0xb9cc('0x12')](respondWithResult(_0x2ad41c,null))['catch'](handleError(_0x2ad41c,null));};exports['getAnswers']=function(_0x3df75b,_0x23fa7d){var _0x19bfe4={'raw':![],'where':{}};var _0x1658c8={};var _0x3aec42={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x3df75b[_0xb9cc('0x60')]['id']}})['then'](handleEntityNotFound(_0x23fa7d,null))['then'](function(_0x5787de){if(_0x5787de){_0x1658c8[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x6c')]['rawAttributes']);_0x1658c8[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x3df75b[_0xb9cc('0x4c')]);_0x1658c8['filters']=_[_0xb9cc('0x4f')](_0x1658c8[_0xb9cc('0x4b')],_0x1658c8['query']);_0x19bfe4['attributes']=_[_0xb9cc('0x4f')](_0x1658c8['model'],qs[_0xb9cc('0x5c')](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x19bfe4[_0xb9cc('0x50')]=_0x19bfe4['attributes']['length']?_0x19bfe4[_0xb9cc('0x50')]:_0x1658c8['model'];if(!_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x51')](_0xb9cc('0x67'))){_0x19bfe4[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x3df75b[_0xb9cc('0x4c')]['limit']);_0x19bfe4[_0xb9cc('0x1f')]=qs['offset'](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x19bfe4['order']=qs['sort'](_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x19bfe4['where']=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x3df75b[_0xb9cc('0x4c')],_0x1658c8[_0xb9cc('0x4e')]));_0x19bfe4[_0xb9cc('0x53')][_0xb9cc('0x68')]=_0x5787de['id'];if(_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x19bfe4[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x19bfe4['where'],{'$or':_[_0xb9cc('0x47')](_0x19bfe4[_0xb9cc('0x50')],function(_0xec7450){var _0x43fef7={};_0x43fef7[_0xec7450]={'$like':'%'+_0x3df75b[_0xb9cc('0x4c')]['filter']+'%'};return _0x43fef7;})});}_0x19bfe4=_['merge']({},_0x19bfe4,_0x3df75b[_0xb9cc('0x56')]);return db[_0xb9cc('0x6c')][_0xb9cc('0x22')]({'where':_0x19bfe4[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x563f25){_0x3aec42[_0xb9cc('0x22')]=_0x563f25;if(_0x3df75b[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x19bfe4[_0xb9cc('0x58')]=[{'all':!![]}];}return db[_0xb9cc('0x6c')][_0xb9cc('0x59')](_0x19bfe4);})[_0xb9cc('0x12')](function(_0x535544){_0x3aec42[_0xb9cc('0x6e')]=_0x535544;return _0x3aec42;});}})[_0xb9cc('0x12')](respondWithFilteredResult(_0x23fa7d,_0x19bfe4))['catch'](handleError(_0x23fa7d,null));};exports[_0xb9cc('0x6f')]=function(_0x4ebffe,_0xef9db3){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x4ebffe[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xef9db3,null))[_0xb9cc('0x12')](function(_0x2d9d54){if(_0x2d9d54){return _0x2d9d54['removeAnswers'](_0x4ebffe[_0xb9cc('0x4c')]['ids']);}})[_0xb9cc('0x12')](respondWithStatusCode(_0xef9db3,null))['catch'](handleError(_0xef9db3,null));};exports[_0xb9cc('0x6d')]=function(_0x1a7783,_0xef5d79){var _0x1b2237={'name':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x29')],'key':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x4a')],'provider':_0x1a7783['body'][_0xb9cc('0x5f')]===_0xb9cc('0x70')?null:_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x5f')],'email':_0x1a7783['body']['email'],'ListId':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x71')],'active':!_[_0xb9cc('0x72')](_0x1a7783['body'][_0xb9cc('0x73')])?_0x1a7783['body'][_0xb9cc('0x73')]:!![],'description':_0x1a7783[_0xb9cc('0x5e')][_0xb9cc('0x74')]||null};var _0x5304ed=getAuthenticationOptions(_0x1b2237[_0xb9cc('0x5f')],_0x1a7783[_0xb9cc('0x5e')]);_0x1b2237[_0xb9cc('0x40')]=_0x5304ed[_0xb9cc('0x40')];_0x1b2237[_0xb9cc('0x41')]=_0x5304ed[_0xb9cc('0x41')];return db['MailAccount']['create'](_0x1b2237,{'include':[{'model':db[_0xb9cc('0x44')],'as':_0xb9cc('0x41')},{'model':db[_0xb9cc('0x43')],'as':_0xb9cc('0x40')}]})[_0xb9cc('0x12')](function(_0x5d47c0){var _0x4e7a02=_0x1a7783[_0xb9cc('0x35')][_0xb9cc('0x26')]({'plain':!![]});if(!_0x4e7a02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e7a02[_0xb9cc('0x75')]===_0xb9cc('0x35')){var _0x2f4ccc=_0x5d47c0[_0xb9cc('0x26')]({'plain':!![]});return db[_0xb9cc('0x76')][_0xb9cc('0x63')]({'where':{'name':_0xb9cc('0x77'),'userProfileId':_0x4e7a02[_0xb9cc('0x78')]},'raw':!![]})['then'](function(_0x4a684c){if(_0x4a684c&&_0x4a684c[_0xb9cc('0x79')]===0x0){return db[_0xb9cc('0x27')][_0xb9cc('0x6d')]({'name':_0x2f4ccc[_0xb9cc('0x29')],'resourceId':_0x2f4ccc['id'],'type':_0x4a684c[_0xb9cc('0x29')],'sectionId':_0x4a684c['id']},{})[_0xb9cc('0x12')](function(){return _0x5d47c0;});}else{return _0x5d47c0;}})[_0xb9cc('0x1b')](function(_0x69a530){logger[_0xb9cc('0x17')](_0xb9cc('0x7a'),_0x69a530);throw _0x69a530;});}return _0x5d47c0;})['then'](respondWithResult(_0xef5d79,0xc9))[_0xb9cc('0x1b')](handleError(_0xef5d79,null));};exports['getImap']=function(_0x264c32,_0x4af19c){return db[_0xb9cc('0x5b')]['findOne']({'where':{'id':_0x264c32[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x4af19c,null))[_0xb9cc('0x12')](function(_0x1444e2){if(_0x1444e2){return _0x1444e2[_0xb9cc('0x7b')]();}return null;})['then'](respondWithResult(_0x4af19c,null))[_0xb9cc('0x1b')](handleError(_0x4af19c,null));};exports[_0xb9cc('0x7c')]=function(_0x26d7a2,_0x1e66fc){if(_0x26d7a2[_0xb9cc('0x5e')]['id']){delete _0x26d7a2[_0xb9cc('0x5e')]['id'];}return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x26d7a2['params']['id']}})['then'](handleEntityNotFound(_0x1e66fc,null))[_0xb9cc('0x12')](function(_0x2fa3f5){if(_0x2fa3f5){_0x26d7a2[_0xb9cc('0x5e')]['MailAccountId']=_0x2fa3f5['id'];return db[_0xb9cc('0x43')][_0xb9cc('0x6d')](_0x26d7a2[_0xb9cc('0x5e')]);}})[_0xb9cc('0x12')](respondWithResult(_0x1e66fc,null))[_0xb9cc('0x1b')](handleError(_0x1e66fc,null));};exports[_0xb9cc('0x7d')]=function(_0x1a56f0,_0x2f251b){return db['MailAccount'][_0xb9cc('0x7e')]({'where':{'id':_0x1a56f0[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x2f251b,null))[_0xb9cc('0x12')](function(_0x29d701){if(_0x29d701){return _0x29d701[_0xb9cc('0x7f')](null);}return null;})[_0xb9cc('0x12')](respondWithStatusCode(_0x2f251b,null))[_0xb9cc('0x1b')](handleError(_0x2f251b,null));};exports['getSmtp']=function(_0x40eca0,_0xb6c91e){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x40eca0[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xb6c91e,null))['then'](function(_0x49c594){if(_0x49c594){return _0x49c594[_0xb9cc('0x80')]();}return null;})[_0xb9cc('0x12')](respondWithResult(_0xb6c91e,null))[_0xb9cc('0x1b')](handleError(_0xb6c91e,null));};exports[_0xb9cc('0x81')]=function(_0xf95f2e,_0x33f378){if(_0xf95f2e[_0xb9cc('0x5e')]['id']){delete _0xf95f2e[_0xb9cc('0x5e')]['id'];}return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0xf95f2e[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x33f378,null))[_0xb9cc('0x12')](function(_0x2ed6e2){if(_0x2ed6e2){_0xf95f2e[_0xb9cc('0x5e')][_0xb9cc('0x68')]=_0x2ed6e2['id'];return db[_0xb9cc('0x44')][_0xb9cc('0x6d')](_0xf95f2e['body']);}})[_0xb9cc('0x12')](respondWithResult(_0x33f378,null))[_0xb9cc('0x1b')](handleError(_0x33f378,null));};exports[_0xb9cc('0x82')]=function(_0x45d4f4,_0x4a4310){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x45d4f4[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x4a4310,null))[_0xb9cc('0x12')](function(_0x4d7546){if(_0x4d7546){return _0x4d7546[_0xb9cc('0x83')](null);}return null;})[_0xb9cc('0x12')](respondWithStatusCode(_0x4a4310,null))[_0xb9cc('0x1b')](handleError(_0x4a4310,null));};exports['addInteraction']=function(_0xe67ead,_0x5cf43f){return db[_0xb9cc('0x84')][_0xb9cc('0x63')]({'where':{'id':_0xe67ead[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x5cf43f,null))[_0xb9cc('0x12')](function(_0x4d1650){if(_0x4d1650){return _0x4d1650['addInteraction'](_0xe67ead[_0xb9cc('0x5e')]['ids'],_[_0xb9cc('0x85')](_0xe67ead[_0xb9cc('0x5e')],[_0xb9cc('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x5cf43f,null))[_0xb9cc('0x1b')](handleError(_0x5cf43f,null));};exports[_0xb9cc('0x86')]=function(_0x48efb5,_0x1ed91f){var _0x489781={'raw':![],'where':{}};var _0x1e13ae={};var _0x50099b={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x48efb5[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x1ed91f,null))[_0xb9cc('0x12')](function(_0x3ff6d7){if(_0x3ff6d7){_0x1e13ae['model']=_[_0xb9cc('0x4d')](db[_0xb9cc('0x84')][_0xb9cc('0x66')]);_0x1e13ae[_0xb9cc('0x4c')]=_['keys'](_0x48efb5['query']);_0x1e13ae[_0xb9cc('0x4e')]=_['intersection'](_0x1e13ae[_0xb9cc('0x4b')],_0x1e13ae[_0xb9cc('0x4c')]);_0x489781[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x1e13ae['model'],qs[_0xb9cc('0x5c')](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x489781[_0xb9cc('0x50')]=_0x489781[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x489781[_0xb9cc('0x50')]:_0x1e13ae[_0xb9cc('0x4b')];if(!_0x48efb5[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x489781[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x489781[_0xb9cc('0x1f')]=qs['offset'](_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}_0x489781[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x48efb5['query'][_0xb9cc('0x52')]);_0x489781[_0xb9cc('0x53')]=qs['filters'](_[_0xb9cc('0x54')](_0x48efb5[_0xb9cc('0x4c')],_0x1e13ae[_0xb9cc('0x4e')]));_0x489781['where'][_0xb9cc('0x68')]=_0x3ff6d7['id'];if(_0x48efb5['query'][_0xb9cc('0x55')]){_0x489781[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x489781[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x489781[_0xb9cc('0x50')],function(_0x2809c6){var _0x1c4b37={};_0x1c4b37[_0x2809c6]={'$like':'%'+_0x48efb5[_0xb9cc('0x4c')]['filter']+'%'};return _0x1c4b37;})});}_0x489781=_[_0xb9cc('0x5d')]({},_0x489781,_0x48efb5[_0xb9cc('0x56')]);return db[_0xb9cc('0x84')][_0xb9cc('0x22')]({'where':_0x489781[_0xb9cc('0x53')]})['then'](function(_0x35160a){_0x50099b['count']=_0x35160a;if(_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x489781['include']=[{'model':db[_0xb9cc('0x89')],'as':_0xb9cc('0x8a'),'required':![]},{'model':db[_0xb9cc('0x8b')],'as':_0xb9cc('0x8c'),'attributes':[_0xb9cc('0x29'),_0xb9cc('0x8d'),_0xb9cc('0x8e')],'required':![]},{'model':db[_0xb9cc('0x8f')],'as':_0xb9cc('0x90'),'attributes':['id',_0xb9cc('0x29'),_0xb9cc('0x91')],'where':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]?{'id':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]}:undefined,'required':_0x48efb5[_0xb9cc('0x4c')][_0xb9cc('0x92')]?!![]:![]}];}return db[_0xb9cc('0x84')][_0xb9cc('0x59')](_0x489781);})[_0xb9cc('0x12')](function(_0x2bba94){_0x50099b['rows']=_0x2bba94;return _0x50099b;});}})[_0xb9cc('0x12')](respondWithFilteredResult(_0x1ed91f,_0x489781))['catch'](handleError(_0x1ed91f,null));};exports['addApplications']=function addApplications(_0x53bfe1,_0x393c26){var _0x1137b2=_0x53bfe1[_0xb9cc('0x60')]['id'];var _0x5bf1d9=_0x53bfe1[_0xb9cc('0x5e')];var _0x359e3e=0xc8;var _0x31e796=null;return db[_0xb9cc('0x93')][_0xb9cc('0x94')]({'isolationLevel':db['sequelize'][_0xb9cc('0x95')][_0xb9cc('0x96')][_0xb9cc('0x97')]},function(_0x268a7d){return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x1137b2},'transaction':_0x268a7d})['then'](function(_0x465e03){if(_0x465e03){return db[_0xb9cc('0x98')][_0xb9cc('0x25')]({'where':{'MailAccountId':_0x1137b2},'transaction':_0x268a7d})[_0xb9cc('0x12')](function(){var _0x5f524a=_[_0xb9cc('0x47')](_0x5bf1d9,function(_0x456706){_0x456706[_0xb9cc('0x68')]=_0x1137b2;return _0x456706;});return db[_0xb9cc('0x98')][_0xb9cc('0x99')](_0x5f524a,{'transaction':_0x268a7d});});}else{_0x359e3e=0x194;_0x31e796=[];}});})['then'](function(){if(_0x359e3e!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x1137b2},'order':_0xb9cc('0x9a')})['then'](function(_0x19b550){_0x31e796=_0x19b550;});}})[_0xb9cc('0x1b')](function(_0x224cb2){_0x359e3e=0x1f4;logger['error'](_0x224cb2[_0xb9cc('0x28')]);if(_0x224cb2[_0xb9cc('0x29')]){delete _0x224cb2[_0xb9cc('0x29')];}_0x31e796=_0x224cb2;})[_0xb9cc('0x9b')](function(){if(_0x31e796===null){_0x393c26[_0xb9cc('0x1c')](_0x359e3e);}else{if(_0x359e3e===0x1f4){_0x393c26[_0xb9cc('0x1d')](_0x359e3e)[_0xb9cc('0x2a')](_0x31e796);}else{_0x393c26[_0xb9cc('0x1d')](_0x359e3e)[_0xb9cc('0x1e')](_0x31e796);}}});};exports[_0xb9cc('0x9c')]=function(_0x233a35,_0xe47b6a){var _0x44cce6={};var _0x1eb526={};var _0x7ee24b;var _0x2d610d;return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x233a35[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0xe47b6a,null))[_0xb9cc('0x12')](function(_0x467d1f){if(_0x467d1f){_0x7ee24b=_0x467d1f;_0x1eb526[_0xb9cc('0x4b')]=_['keys'](db['MailApplication'][_0xb9cc('0x66')]);_0x1eb526['query']=_['keys'](_0x233a35[_0xb9cc('0x4c')]);_0x1eb526['filters']=_[_0xb9cc('0x4f')](_0x1eb526['model'],_0x1eb526[_0xb9cc('0x4c')]);_0x44cce6[_0xb9cc('0x50')]=_[_0xb9cc('0x4f')](_0x1eb526[_0xb9cc('0x4b')],qs['fields'](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x44cce6[_0xb9cc('0x50')]=_0x44cce6[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x44cce6[_0xb9cc('0x50')]:_0x1eb526['model'];_0x44cce6[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x44cce6['where']=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x233a35[_0xb9cc('0x4c')],_0x1eb526[_0xb9cc('0x4e')]));if(_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x44cce6['where']=_[_0xb9cc('0x5d')](_0x44cce6[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x44cce6[_0xb9cc('0x50')],function(_0x5688b5){var _0x377165={};_0x377165[_0x5688b5]={'$like':'%'+_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x377165;})});}_0x44cce6=_[_0xb9cc('0x5d')]({},_0x44cce6,_0x233a35[_0xb9cc('0x56')]);return _0x7ee24b['getApplications'](_0x44cce6);}})[_0xb9cc('0x12')](function(_0x782b9b){if(_0x782b9b){_0x2d610d=_0x782b9b[_0xb9cc('0x87')];if(!_0x233a35[_0xb9cc('0x4c')]['hasOwnProperty'](_0xb9cc('0x67'))){_0x44cce6[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x233a35[_0xb9cc('0x4c')]['limit']);_0x44cce6['offset']=qs[_0xb9cc('0x1f')](_0x233a35[_0xb9cc('0x4c')][_0xb9cc('0x1f')]);}return _0x7ee24b[_0xb9cc('0x9c')](_0x44cce6);}})[_0xb9cc('0x12')](function(_0x15806f){if(_0x15806f){return _0x15806f?{'count':_0x2d610d,'rows':_0x15806f}:null;}})['then'](respondWithResult(_0xe47b6a,null))[_0xb9cc('0x1b')](handleError(_0xe47b6a,null));};exports['getMessages']=function(_0x16eb67,_0x266431){var _0x7b552={'raw':!![],'where':{}};var _0x173336={};var _0x5d66e9={'count':0x0,'rows':[]};return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x16eb67['params']['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x266431,null))[_0xb9cc('0x12')](function(_0x4ae893){if(_0x4ae893){_0x173336[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db[_0xb9cc('0x9d')][_0xb9cc('0x66')]);_0x173336[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x16eb67[_0xb9cc('0x4c')]);_0x173336[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x173336[_0xb9cc('0x4b')],_0x173336[_0xb9cc('0x4c')]);_0x7b552[_0xb9cc('0x50')]=_['intersection'](_0x173336[_0xb9cc('0x4b')],qs[_0xb9cc('0x5c')](_0x16eb67['query'][_0xb9cc('0x5c')]));_0x7b552[_0xb9cc('0x50')]=_0x7b552[_0xb9cc('0x50')]['length']?_0x7b552[_0xb9cc('0x50')]:_0x173336[_0xb9cc('0x4b')];if(!_0x16eb67[_0xb9cc('0x4c')]['hasOwnProperty']('nolimit')){_0x7b552[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x16eb67[_0xb9cc('0x4c')]['limit']);_0x7b552[_0xb9cc('0x1f')]=qs[_0xb9cc('0x1f')](_0x16eb67['query']['offset']);}_0x7b552[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x16eb67['query'][_0xb9cc('0x52')]);_0x7b552[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_['pick'](_0x16eb67[_0xb9cc('0x4c')],_0x173336[_0xb9cc('0x4e')]));_0x7b552[_0xb9cc('0x53')][_0xb9cc('0x68')]=_0x4ae893['id'];if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x7b552[_0xb9cc('0x53')]=_[_0xb9cc('0x5d')](_0x7b552[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x7b552[_0xb9cc('0x50')],function(_0x1a050c){var _0x5859ff={};_0x5859ff[_0x1a050c]={'$like':'%'+_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x5859ff;})});}if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x9e')]){var _0xbd25b7=_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x9e')][_0xb9cc('0x9f')](',');var _0x4ed48b={};_0x4ed48b[_0xbd25b7[0x0]]={'$gte':moment(_0xbd25b7[0x1])[_0xb9cc('0xa0')](_0xb9cc('0xa1'))};_0x7b552['where']=_[_0xb9cc('0x5d')](_0x7b552[_0xb9cc('0x53')],_0x4ed48b);}_0x7b552=_[_0xb9cc('0x5d')]({},_0x7b552,_0x16eb67[_0xb9cc('0x56')]);return db[_0xb9cc('0x9d')][_0xb9cc('0x22')]({'where':_0x7b552[_0xb9cc('0x53')]})[_0xb9cc('0x12')](function(_0x1aee24){_0x5d66e9[_0xb9cc('0x22')]=_0x1aee24;if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0x57')]){_0x7b552['include']=[{'all':!![]}];}return db[_0xb9cc('0x9d')]['findAll'](_0x7b552);})[_0xb9cc('0x12')](function(_0x4b9cea){if(_0x16eb67[_0xb9cc('0x4c')][_0xb9cc('0xa2')]===_0xb9cc('0xa3')){for(var _0xabf51f=0x0;_0xabf51f<_0x4b9cea[_0xb9cc('0x87')];_0xabf51f++){_0x4b9cea[_0xabf51f][_0xb9cc('0x5e')]=juice(_0x4b9cea[_0xabf51f][_0xb9cc('0x5e')]);}}_0x5d66e9[_0xb9cc('0x6e')]=_0x4b9cea;return _0x5d66e9;});}})['then'](respondWithFilteredResult(_0x266431,_0x7b552))['catch'](handleError(_0x266431,null));};exports[_0xb9cc('0x2a')]=function(_0x1c43e7,_0x39e4c3){var _0x306620,_0x66fa8f={},_0x292430;if(_0x1c43e7[_0xb9cc('0x5e')]['to']){_0x292430=_0x1c43e7['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0xb9cc('0x63')]({'where':{'id':_0x1c43e7[_0xb9cc('0x60')]['id']},'include':[{'model':db[_0xb9cc('0xa4')],'as':_0xb9cc('0xa5'),'include':[{'model':db[_0xb9cc('0x89')],'as':_0xb9cc('0xa6'),'where':{'email':_0x292430},'limit':0x1,'order':[[_0xb9cc('0xa7'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xb9cc('0x41'),'raw':!![],'include':[{'model':db[_0xb9cc('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0xb9cc('0x12')](handleEntityNotFound(_0x39e4c3,null))['then'](function(_0x48e068){if(!_0x48e068)return;_0x306620=_0x48e068;if(!_0x48e068[_0xb9cc('0x41')])throw new Error(_0xb9cc('0xa9'));if(_[_0xb9cc('0x72')](_0x1c43e7[_0xb9cc('0x5e')]['from'])){_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xaa')]=util['format'](_0xb9cc('0xab'),_0x48e068[_0xb9cc('0x29')],_0x48e068[_0xb9cc('0xac')]||_0x48e068['Smtp'][_0xb9cc('0x35')]);}if(_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xad')]&&_0x1c43e7[_0xb9cc('0x5e')]['attachments']['length']){for(var _0x5b59ff=0x0;_0x5b59ff<_0x1c43e7['body'][_0xb9cc('0xad')]['length'];_0x5b59ff+=0x1){_0x1c43e7[_0xb9cc('0x5e')]['attachments'][_0x5b59ff]={'filename':_0x1c43e7['body'][_0xb9cc('0xad')][_0x5b59ff]['name'],'path':path['join'](config[_0xb9cc('0xae')],_0xb9cc('0xaf'),_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xad')][_0x5b59ff][_0xb9cc('0xb0')])};}}var _0x3447ce=_0x48e068[_0xb9cc('0xb1')]();return respondWithRpcPromise(_0xb9cc('0xb2'),_0xb9cc('0xb3'),{'account':_0x3447ce,'message':_0x1c43e7['body']});})[_0xb9cc('0x12')](function(_0x58de57){if(!_0x58de57)return;_0x66fa8f=_0x58de57;if(!_0x306620[_0xb9cc('0xa5')])throw new Error(_0xb9cc('0xb4'));if(_0x306620['List'][_0xb9cc('0xa6')]['length'])return _0x306620['List'][_0xb9cc('0xa6')][0x0];return db['CmContact']['create'](_[_0xb9cc('0xa')](_0x1c43e7[_0xb9cc('0x5e')],{'firstName':_0x1c43e7[_0xb9cc('0x5e')]['to'],'email':_0x1c43e7[_0xb9cc('0x5e')]['to'],'phone':_0x1c43e7['body']['to'],'ListId':_0x306620[_0xb9cc('0x71')]}));})[_0xb9cc('0x12')](function(_0x1ad57c){if(!_0x1ad57c)return;var _0x5a6262={'UserId':_0x1c43e7[_0xb9cc('0x35')]['id'],'ContactId':_0x1ad57c['id'],'MailAccountId':_0x306620['id'],'inReplyTo':_0x66fa8f[_0xb9cc('0xb5')],'to':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xaa')],'cc':_0x1c43e7['body']['cc'],'subject':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb6')],'attach':_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb7')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb9cc('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_['merge'](_0x1c43e7[_0xb9cc('0x5e')],{'messageId':_0x66fa8f['messageId'],'sentAt':moment()['format'](_0xb9cc('0xa1')),'read':!![],'MailAccountId':_0x306620['id'],'UserId':_0x1c43e7['user']['id'],'ContactId':_0x1ad57c['id']})]};if(_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb8')]){_0x5a6262=_[_0xb9cc('0x5d')](_0x5a6262,_0x1c43e7[_0xb9cc('0x5e')][_0xb9cc('0xb8')]);}return db[_0xb9cc('0x84')][_0xb9cc('0x6d')](_0x5a6262,{'include':[{'model':db[_0xb9cc('0x9d')],'as':_0xb9cc('0xb9')}]});})[_0xb9cc('0x12')](respondWithResult(_0x39e4c3,null))[_0xb9cc('0x1b')](handleError(_0x39e4c3,null));};exports['verifySmtp']=function(_0x4b7f8a,_0x5f1193){return db[_0xb9cc('0x5b')]['find']({'where':{'id':_0x4b7f8a[_0xb9cc('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xb9cc('0x41'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xb9cc('0xa8'),'raw':!![]}]}]})[_0xb9cc('0x12')](handleEntityNotFound(_0x5f1193,null))[_0xb9cc('0x12')](function(_0x1279bd){if(!_0x1279bd[_0xb9cc('0x41')])return;var _0x28a39d=_0x1279bd['getSmtpOptions']();return respondWithRpcPromise(_0xb9cc('0xba'),_0xb9cc('0xbb'),{'account':_0x28a39d});})[_0xb9cc('0x12')](respondWithResult(_0x5f1193,null))[_0xb9cc('0x1b')](handleError(_0x5f1193,null));};exports['destroy']=function(_0xd907be,_0x515f3e){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0xd907be[_0xb9cc('0x60')]['id']}})['then'](handleEntityNotFound(_0x515f3e,null))[_0xb9cc('0x12')](function(_0x341826){if(_0x341826&&_0x341826['service']){throw new db[(_0xb9cc('0xbc'))]['ValidationError'](_0xb9cc('0xbd'));}return _0x341826;})['then'](removeEntity(_0x515f3e,null))[_0xb9cc('0x1b')](handleError(_0x515f3e,null));};exports[_0xb9cc('0xbe')]=function(_0x185f18,_0x52215a){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x185f18[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x52215a,null))[_0xb9cc('0x12')](function(_0x419780){if(_0x419780){return _0x419780[_0xb9cc('0xbe')](_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')],_[_0xb9cc('0x85')](_0x185f18['body'],['ids','id'])||{})[_0xb9cc('0xbf')](function(_0x4e461a){for(var _0x315fe0=0x0;_0x315fe0<_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')][_0xb9cc('0x87')];_0x315fe0+=0x1){socket[_0xb9cc('0xc0')]('userMailAccount:save',{'UserId':Number(_0x185f18[_0xb9cc('0x5e')][_0xb9cc('0x6a')][_0x315fe0]),'MailAccountId':Number(_0x185f18[_0xb9cc('0x60')]['id'])});}return _0x4e461a;});}})['then'](respondWithResult(_0x52215a,null))[_0xb9cc('0x1b')](handleError(_0x52215a,null));};exports[_0xb9cc('0xc1')]=function(_0x27c62a,_0x1aa46a){return db[_0xb9cc('0x5b')][_0xb9cc('0x63')]({'where':{'id':_0x27c62a[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x1aa46a,null))[_0xb9cc('0x12')](function(_0x3ac027){if(_0x3ac027){return _0x3ac027[_0xb9cc('0xc1')](_0x27c62a[_0xb9cc('0x4c')][_0xb9cc('0x6a')])[_0xb9cc('0x12')](function(){if(_[_0xb9cc('0xc2')](_0x27c62a[_0xb9cc('0x4c')][_0xb9cc('0x6a')])){for(var _0x54dc81=0x0;_0x54dc81<_0x27c62a[_0xb9cc('0x4c')]['ids'][_0xb9cc('0x87')];_0x54dc81+=0x1){socket['emit'](_0xb9cc('0xc3'),{'UserId':Number(_0x27c62a['query']['ids'][_0x54dc81]),'MailAccountId':Number(_0x27c62a['params']['id'])});}}else{socket['emit'](_0xb9cc('0xc3'),{'UserId':Number(_0x27c62a['query'][_0xb9cc('0x6a')]),'MailAccountId':Number(_0x27c62a[_0xb9cc('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x1aa46a,null))[_0xb9cc('0x1b')](handleError(_0x1aa46a,null));};exports[_0xb9cc('0xc4')]=function(_0x43281e,_0x45f5fb){var _0x269632={};var _0x2f2221={};var _0x316038;var _0x47c668;return db[_0xb9cc('0x5b')][_0xb9cc('0x7e')]({'where':{'id':_0x43281e[_0xb9cc('0x60')]['id']}})[_0xb9cc('0x12')](handleEntityNotFound(_0x45f5fb,null))[_0xb9cc('0x12')](function(_0x21fde2){if(_0x21fde2){_0x316038=_0x21fde2;_0x2f2221[_0xb9cc('0x4b')]=_[_0xb9cc('0x4d')](db['User'][_0xb9cc('0x66')]);_0x2f2221[_0xb9cc('0x4c')]=_[_0xb9cc('0x4d')](_0x43281e[_0xb9cc('0x4c')]);_0x2f2221[_0xb9cc('0x4e')]=_[_0xb9cc('0x4f')](_0x2f2221[_0xb9cc('0x4b')],_0x2f2221[_0xb9cc('0x4c')]);_0x269632['attributes']=_[_0xb9cc('0x4f')](_0x2f2221[_0xb9cc('0x4b')],qs['fields'](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x5c')]));_0x269632['attributes']=_0x269632[_0xb9cc('0x50')][_0xb9cc('0x87')]?_0x269632[_0xb9cc('0x50')]:_0x2f2221[_0xb9cc('0x4b')];_0x269632[_0xb9cc('0x88')]=qs[_0xb9cc('0x52')](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x52')]);_0x269632[_0xb9cc('0x53')]=qs[_0xb9cc('0x4e')](_[_0xb9cc('0x54')](_0x43281e[_0xb9cc('0x4c')],_0x2f2221[_0xb9cc('0x4e')]));if(_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x55')]){_0x269632['where']=_[_0xb9cc('0x5d')](_0x269632[_0xb9cc('0x53')],{'$or':_[_0xb9cc('0x47')](_0x269632[_0xb9cc('0x50')],function(_0x4df4ba){var _0x19215b={};_0x19215b[_0x4df4ba]={'$like':'%'+_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x55')]+'%'};return _0x19215b;})});}_0x269632=_[_0xb9cc('0x5d')]({},_0x269632,_0x43281e[_0xb9cc('0x56')]);return _0x316038[_0xb9cc('0xc4')](_0x269632);}})[_0xb9cc('0x12')](function(_0x25c983){if(_0x25c983){_0x47c668=_0x25c983[_0xb9cc('0x87')];if(!_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x51')](_0xb9cc('0x67'))){_0x269632[_0xb9cc('0x21')]=qs[_0xb9cc('0x21')](_0x43281e[_0xb9cc('0x4c')][_0xb9cc('0x21')]);_0x269632[_0xb9cc('0x1f')]=qs[_0xb9cc('0x1f')](_0x43281e[_0xb9cc('0x4c')]['offset']);}return _0x316038['getAgents'](_0x269632);}})[_0xb9cc('0x12')](function(_0x5ee882){if(_0x5ee882){return _0x5ee882?{'count':_0x47c668,'rows':_0x5ee882}:null;}})[_0xb9cc('0x12')](respondWithResult(_0x45f5fb,null))[_0xb9cc('0x1b')](handleError(_0x45f5fb,null));}; \ No newline at end of file +var _0xe8b1=['hasOwnProperty','CmContact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','Contacts','updatedAt','DESC','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','CloudProvider','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','UserProfileResource','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','mandatoryDispositionPause','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','length','order','sort','where','pick','filter','map','type','merge','options','includeAll','include','MailAccount','findAll','rows','show','MailServerOut','Pause','keys','fields','catch','update','body','provider','custom','find','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions'];(function(_0x528627,_0x3b91c0){var _0x29824b=function(_0x5575ce){while(--_0x5575ce){_0x528627['push'](_0x528627['shift']());}};_0x29824b(++_0x3b91c0);}(_0xe8b1,0x1cb));var _0x1e8b=function(_0x3ff78f,_0x4bfafd){_0x3ff78f=_0x3ff78f-0x0;var _0x5abe3c=_0xe8b1[_0x3ff78f];return _0x5abe3c;};'use strict';var moment=require(_0x1e8b('0x0'));var BPromise=require(_0x1e8b('0x1'));var util=require(_0x1e8b('0x2'));var path=require('path');var _=require(_0x1e8b('0x3'));var juice=require(_0x1e8b('0x4'));var Redis=require(_0x1e8b('0x5'));var qs=require(_0x1e8b('0x6'));var logger=require(_0x1e8b('0x7'))(_0x1e8b('0x8'));var config=require(_0x1e8b('0x9'));var db=require('../../mysqldb')['db'];config[_0x1e8b('0xa')]=_[_0x1e8b('0xb')](config[_0x1e8b('0xa')],{'host':_0x1e8b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e8b('0xa')]));require(_0x1e8b('0xd'))[_0x1e8b('0xe')](socket);var jayson=require(_0x1e8b('0xf'));var client=jayson[_0x1e8b('0x10')]['http']({'port':0x232b});function respondWithRpcPromise(_0x259963,_0x7a7243,_0x359244,_0x93a8c5){return new BPromise(function(_0x2d15dd,_0x3d7cb5){var _0x22e1f7=_0x93a8c5||client;return _0x22e1f7[_0x1e8b('0x11')](_0x259963,_0x359244)[_0x1e8b('0x12')](function(_0x3fc425){logger[_0x1e8b('0x13')]('MailAccount,\x20%s,\x20%s',_0x7a7243,_0x1e8b('0x14'));logger[_0x1e8b('0x15')](_0x1e8b('0x16'),_0x7a7243,'request\x20sent',JSON[_0x1e8b('0x17')](_0x3fc425));if(_0x3fc425[_0x1e8b('0x18')]){if(_0x3fc425[_0x1e8b('0x18')][_0x1e8b('0x19')]===0x1f4){logger[_0x1e8b('0x18')]('MailAccount,\x20%s,\x20%s',_0x7a7243,_0x3fc425[_0x1e8b('0x18')][_0x1e8b('0x1a')]);return _0x3d7cb5(_0x3fc425[_0x1e8b('0x18')][_0x1e8b('0x1a')]);}logger[_0x1e8b('0x18')]('MailAccount,\x20%s,\x20%s',_0x7a7243,_0x3fc425[_0x1e8b('0x18')][_0x1e8b('0x1a')]);return _0x2d15dd(_0x3fc425[_0x1e8b('0x18')]['message']);}else{logger['info'](_0x1e8b('0x1b'),_0x7a7243,'request\x20sent');_0x2d15dd(_0x3fc425[_0x1e8b('0x1c')]['message']);}})['catch'](function(_0x3e59e2){logger['error'](_0x1e8b('0x1b'),_0x7a7243,_0x3e59e2);_0x3d7cb5(_0x3e59e2);});});}function respondWithStatusCode(_0x4585de,_0x1cb764){_0x1cb764=_0x1cb764||0xcc;return function(_0x43b7e1){if(_0x43b7e1){return _0x4585de[_0x1e8b('0x1d')](_0x1cb764);}return _0x4585de[_0x1e8b('0x1e')](_0x1cb764)[_0x1e8b('0x1f')]();};}function respondWithResult(_0xe5acb1,_0xeb4feb){_0xeb4feb=_0xeb4feb||0xc8;return function(_0x486e39){if(_0x486e39){return _0xe5acb1[_0x1e8b('0x1e')](_0xeb4feb)[_0x1e8b('0x20')](_0x486e39);}};}function respondWithFilteredResult(_0x5cdd83,_0x5b2e66){return function(_0xef45f8){if(_0xef45f8){var _0x2c4d69=typeof _0x5b2e66[_0x1e8b('0x21')]===_0x1e8b('0x22')&&typeof _0x5b2e66[_0x1e8b('0x23')]===_0x1e8b('0x22');var _0x5d669a=_0xef45f8[_0x1e8b('0x24')];var _0x4fe799=_0x2c4d69?0x0:_0x5b2e66[_0x1e8b('0x21')];var _0x53af35=_0x2c4d69?_0xef45f8[_0x1e8b('0x24')]:_0x5b2e66[_0x1e8b('0x21')]+_0x5b2e66[_0x1e8b('0x23')];var _0x28d476;if(_0x53af35>=_0x5d669a){_0x53af35=_0x5d669a;_0x28d476=0xc8;}else{_0x28d476=0xce;}_0x5cdd83['status'](_0x28d476);return _0x5cdd83[_0x1e8b('0x25')](_0x1e8b('0x26'),_0x4fe799+'-'+_0x53af35+'/'+_0x5d669a)[_0x1e8b('0x20')](_0xef45f8);}return null;};}function saveUpdates(_0x2da131){return function(_0x1d6814){if(_0x1d6814){return _0x1d6814['update'](_0x2da131)[_0x1e8b('0x12')](function(_0x3c5629){return _0x3c5629;});}return null;};}function removeEntity(_0x1ddda8){return function(_0x115757){if(_0x115757){return _0x115757[_0x1e8b('0x27')]()[_0x1e8b('0x12')](function(){var _0x1f3bcb=_0x115757[_0x1e8b('0x28')]({'plain':!![]});var _0x32c3c8=_0x1e8b('0x29');return db[_0x1e8b('0x2a')]['destroy']({'where':{'type':_0x32c3c8,'resourceId':_0x1f3bcb['id']}})['then'](function(){return _0x115757;});})[_0x1e8b('0x12')](function(){_0x1ddda8['status'](0xcc)[_0x1e8b('0x1f')]();});}};}function handleEntityNotFound(_0x14c361){return function(_0x400b77){if(!_0x400b77){_0x14c361[_0x1e8b('0x1d')](0x194);}return _0x400b77;};}function handleError(_0x2b10f0,_0x152970){_0x152970=_0x152970||0x1f4;return function(_0x4013dc){logger[_0x1e8b('0x18')](_0x4013dc['stack']);if(_0x4013dc['name']){delete _0x4013dc[_0x1e8b('0x2b')];}_0x2b10f0[_0x1e8b('0x1e')](_0x152970)[_0x1e8b('0x2c')](_0x4013dc);};}function getImapHost(_0x23b7c7){switch(_0x23b7c7){case'gmail':return _0x1e8b('0x2d');case _0x1e8b('0x2e'):return _0x1e8b('0x2f');case _0x1e8b('0x30'):return _0x1e8b('0x31');case _0x1e8b('0x32'):return'outlook.office365.com';}throw new Error(_0x1e8b('0x33'),_0x23b7c7);}function getSmtpHost(_0x5a2eeb){switch(_0x5a2eeb){case _0x1e8b('0x34'):return _0x1e8b('0x35');case'yahoo':return _0x1e8b('0x36');case'hotmail':return _0x1e8b('0x37');case'outlook365':return'smtp.office365.com';}throw new Error(_0x1e8b('0x33'),_0x5a2eeb);}function getAuthenticationOptions(_0x431e13,_0x55f93a){var _0x49e373={};var _0x1e0942={};if(_0x431e13){_0x49e373[_0x1e8b('0x38')]=_0x1e0942[_0x1e8b('0x38')]=_0x55f93a[_0x1e8b('0x39')];_0x49e373[_0x1e8b('0x3a')]=_0x1e0942[_0x1e8b('0x3b')]=_0x55f93a[_0x1e8b('0x3a')];if(_0x55f93a['modernAuthentication']){_0x49e373[_0x1e8b('0x3c')]=_0x1e0942[_0x1e8b('0x3c')]=!![];_0x49e373[_0x1e8b('0x3d')]=_0x1e0942[_0x1e8b('0x3d')]=_0x55f93a[_0x1e8b('0x3d')];_0x49e373[_0x1e8b('0x3a')]=_0x1e0942[_0x1e8b('0x3b')]=null;}else{_0x49e373[_0x1e8b('0x3d')]=_0x1e0942[_0x1e8b('0x3d')]=null;}_0x49e373['host']=getImapHost(_0x431e13);_0x49e373[_0x1e8b('0x3e')]=0x3e1;_0x1e0942[_0x1e8b('0x3f')]=getSmtpHost(_0x431e13);_0x1e0942[_0x1e8b('0x3e')]=0x24b;_0x1e0942[_0x1e8b('0x40')]=![];_0x49e373[_0x1e8b('0x41')]=_0x1e0942[_0x1e8b('0x41')]=null;}else{if(_0x55f93a['authentication']){_0x49e373[_0x1e8b('0x38')]=_0x1e0942[_0x1e8b('0x38')]=_0x55f93a[_0x1e8b('0x39')];_0x49e373['password']=_0x1e0942[_0x1e8b('0x3b')]=_0x55f93a[_0x1e8b('0x3a')];}else{_0x49e373[_0x1e8b('0x42')]=_0x1e0942[_0x1e8b('0x42')]=![];_0x49e373['user']=_0x1e0942[_0x1e8b('0x38')]=null;_0x49e373[_0x1e8b('0x3a')]=_0x1e0942[_0x1e8b('0x3b')]=null;}_0x49e373[_0x1e8b('0x3f')]=_0x55f93a[_0x1e8b('0x43')]['host'];_0x49e373[_0x1e8b('0x3e')]=_0x55f93a[_0x1e8b('0x43')][_0x1e8b('0x3e')];_0x1e0942[_0x1e8b('0x3f')]=_0x55f93a['Smtp'][_0x1e8b('0x3f')];_0x1e0942[_0x1e8b('0x3e')]=_0x55f93a[_0x1e8b('0x44')][_0x1e8b('0x3e')];}return{'Imap':_0x49e373,'Smtp':_0x1e0942};}exports[_0x1e8b('0x45')]=function(_0x5e05ce,_0x1f4dba){var _0x43db91={'include':[{'model':db[_0x1e8b('0x46')],'as':_0x1e8b('0x43')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x1e8b('0x47')}]},_0x5769ba={},_0x13c9dd={'count':0x0,'rows':[]};var _0xd2a5a8=_['map'](db['MailAccount'][_0x1e8b('0x48')],function(_0x557cb3){return{'name':_0x557cb3[_0x1e8b('0x49')],'type':_0x557cb3['type'][_0x1e8b('0x4a')]};});_0x5769ba['model']=_['map'](_0xd2a5a8,_0x1e8b('0x2b'));_0x5769ba[_0x1e8b('0x4b')]=_['keys'](_0x5e05ce[_0x1e8b('0x4b')]);_0x5769ba[_0x1e8b('0x4c')]=_['intersection'](_0x5769ba[_0x1e8b('0x4d')],_0x5769ba['query']);_0x43db91[_0x1e8b('0x4e')]=_[_0x1e8b('0x4f')](_0x5769ba[_0x1e8b('0x4d')],qs['fields'](_0x5e05ce[_0x1e8b('0x4b')]['fields']));_0x43db91[_0x1e8b('0x4e')]=_0x43db91[_0x1e8b('0x4e')][_0x1e8b('0x50')]?_0x43db91[_0x1e8b('0x4e')]:_0x5769ba[_0x1e8b('0x4d')];if(!_0x5e05ce[_0x1e8b('0x4b')]['hasOwnProperty']('nolimit')){_0x43db91[_0x1e8b('0x23')]=qs['limit'](_0x5e05ce['query'][_0x1e8b('0x23')]);_0x43db91['offset']=qs[_0x1e8b('0x21')](_0x5e05ce['query'][_0x1e8b('0x21')]);}_0x43db91[_0x1e8b('0x51')]=qs[_0x1e8b('0x52')](_0x5e05ce[_0x1e8b('0x4b')][_0x1e8b('0x52')]);_0x43db91[_0x1e8b('0x53')]=qs[_0x1e8b('0x4c')](_[_0x1e8b('0x54')](_0x5e05ce[_0x1e8b('0x4b')],_0x5769ba[_0x1e8b('0x4c')]),_0xd2a5a8);if(_0x5e05ce[_0x1e8b('0x4b')][_0x1e8b('0x55')]){_0x43db91[_0x1e8b('0x53')]=_['merge'](_0x43db91[_0x1e8b('0x53')],{'$or':_[_0x1e8b('0x56')](_0xd2a5a8,function(_0x4a6828){if(_0x4a6828[_0x1e8b('0x57')]!=='VIRTUAL'){var _0x24c707={};_0x24c707[_0x4a6828['name']]={'$like':'%'+_0x5e05ce[_0x1e8b('0x4b')][_0x1e8b('0x55')]+'%'};return _0x24c707;}})});}_0x43db91=_[_0x1e8b('0x58')]({},_0x43db91,_0x5e05ce[_0x1e8b('0x59')]);var _0x181800={'where':_0x43db91[_0x1e8b('0x53')]};return db['MailAccount'][_0x1e8b('0x24')](_0x181800)[_0x1e8b('0x12')](function(_0x1f4248){_0x13c9dd[_0x1e8b('0x24')]=_0x1f4248;if(_0x5e05ce['query'][_0x1e8b('0x5a')]){_0x43db91[_0x1e8b('0x5b')]=[{'all':!![]}];}return db[_0x1e8b('0x5c')][_0x1e8b('0x5d')](_0x43db91);})[_0x1e8b('0x12')](function(_0x1afa6e){_0x13c9dd[_0x1e8b('0x5e')]=_0x1afa6e;return _0x13c9dd;})['then'](respondWithFilteredResult(_0x1f4dba,_0x43db91))['catch'](handleError(_0x1f4dba,null));};exports[_0x1e8b('0x5f')]=function(_0x1b4b3a,_0x151419){var _0x569a06={'raw':![],'where':{'id':_0x1b4b3a['params']['id']},'include':[{'model':db[_0x1e8b('0x46')],'as':_0x1e8b('0x43')},{'model':db[_0x1e8b('0x60')],'as':_0x1e8b('0x44')},{'model':db[_0x1e8b('0x61')],'as':'mandatoryDispositionPause'}]},_0x5a9eb1={};_0x5a9eb1['model']=_[_0x1e8b('0x62')](db['MailAccount'][_0x1e8b('0x48')]);_0x5a9eb1['query']=_['keys'](_0x1b4b3a[_0x1e8b('0x4b')]);_0x5a9eb1[_0x1e8b('0x4c')]=_[_0x1e8b('0x4f')](_0x5a9eb1[_0x1e8b('0x4d')],_0x5a9eb1['query']);_0x569a06[_0x1e8b('0x4e')]=_['intersection'](_0x5a9eb1[_0x1e8b('0x4d')],qs[_0x1e8b('0x63')](_0x1b4b3a[_0x1e8b('0x4b')][_0x1e8b('0x63')]));_0x569a06[_0x1e8b('0x4e')]=_0x569a06[_0x1e8b('0x4e')][_0x1e8b('0x50')]?_0x569a06[_0x1e8b('0x4e')]:_0x5a9eb1[_0x1e8b('0x4d')];if(_0x1b4b3a['query'][_0x1e8b('0x5a')]){_0x569a06[_0x1e8b('0x5b')]=[{'all':!![]}];}_0x569a06=_[_0x1e8b('0x58')]({},_0x569a06,_0x1b4b3a['options']);return db['MailAccount']['find'](_0x569a06)[_0x1e8b('0x12')](handleEntityNotFound(_0x151419,null))[_0x1e8b('0x12')](respondWithResult(_0x151419,null))[_0x1e8b('0x64')](handleError(_0x151419,null));};exports[_0x1e8b('0x65')]=function(_0x54f864,_0x29eeb3){if(_0x54f864[_0x1e8b('0x66')]['id']){delete _0x54f864[_0x1e8b('0x66')]['id'];}var _0x4a9470=_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x67')]===_0x1e8b('0x68')?null:_0x54f864['body']['provider'];var _0x3c2c31=_0x54f864[_0x1e8b('0x66')]['Imap']||{};var _0x325d58=_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x44')]||{};if(_0x4a9470){_0x3c2c31[_0x1e8b('0x3f')]=getImapHost(_0x4a9470);_0x3c2c31[_0x1e8b('0x3e')]=0x3e1;_0x325d58[_0x1e8b('0x3f')]=getSmtpHost(_0x4a9470);_0x325d58[_0x1e8b('0x3e')]=0x24b;_0x325d58['secure']=![];}if(_0x325d58['modernAuthentication']){_0x325d58[_0x1e8b('0x40')]=![];}else{_0x325d58[_0x1e8b('0x3d')]=null;}if(!_0x3c2c31[_0x1e8b('0x3c')])_0x3c2c31[_0x1e8b('0x3d')]=null;_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x43')]=_0x3c2c31;_0x54f864[_0x1e8b('0x66')]['Smtp']=_0x325d58;return db['MailAccount'][_0x1e8b('0x69')]({'where':{'id':_0x54f864[_0x1e8b('0x6a')]['id']},'include':[{'model':db[_0x1e8b('0x46')],'as':_0x1e8b('0x43')},{'model':db[_0x1e8b('0x60')],'as':_0x1e8b('0x44')},{'model':db[_0x1e8b('0x61')],'as':_0x1e8b('0x47')}]})[_0x1e8b('0x12')](handleEntityNotFound(_0x29eeb3,null))['then'](function(_0x843d06){if(!_0x843d06)throw new Error(_0x1e8b('0x6b'));if(_0x843d06[_0x1e8b('0x41')])delete _0x54f864[_0x1e8b('0x66')][_0x1e8b('0x43')];return _0x843d06;})[_0x1e8b('0x12')](saveUpdates(_0x54f864[_0x1e8b('0x66')],null))[_0x1e8b('0x12')](function(_0x3effa7){if(!_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x43')])return _0x3effa7;return db['MailServerIn'][_0x1e8b('0x65')](_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x43')],{'where':{'MailAccountId':_0x3effa7['id']}})['then'](function(){return _0x3effa7;});})[_0x1e8b('0x12')](function(_0x26f99c){if(!_0x54f864['body'][_0x1e8b('0x44')])return _0x26f99c;return db[_0x1e8b('0x60')]['update'](_0x54f864[_0x1e8b('0x66')][_0x1e8b('0x44')],{'where':{'MailAccountId':_0x26f99c['id']}})[_0x1e8b('0x12')](function(){return _0x26f99c;});})[_0x1e8b('0x12')](respondWithResult(_0x29eeb3,null))[_0x1e8b('0x64')](handleError(_0x29eeb3,null));};exports[_0x1e8b('0x6c')]=function(_0x1688d4,_0x1d7e7a){return db[_0x1e8b('0x5c')][_0x1e8b('0x6c')]()[_0x1e8b('0x12')](respondWithResult(_0x1d7e7a,null))[_0x1e8b('0x64')](handleError(_0x1d7e7a,null));};exports['addDisposition']=function(_0x5ed4bc,_0x152a5a){if(_0x5ed4bc[_0x1e8b('0x66')]['id']){delete _0x5ed4bc['body']['id'];}return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x5ed4bc['params']['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x152a5a,null))[_0x1e8b('0x12')](function(_0x36d011){if(_0x36d011){_0x5ed4bc[_0x1e8b('0x66')][_0x1e8b('0x6d')]=_0x36d011['id'];return db[_0x1e8b('0x6e')][_0x1e8b('0x6f')](_0x5ed4bc[_0x1e8b('0x66')]);}})[_0x1e8b('0x12')](respondWithResult(_0x152a5a,null))['catch'](handleError(_0x152a5a,null));};exports['getDispositions']=function(_0x3a36f8,_0x11fe29){var _0x3b16fe={'raw':![],'where':{}};var _0x3415e7={};var _0x1a6c6a={'count':0x0,'rows':[]};return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x3a36f8[_0x1e8b('0x6a')]['id']}})['then'](handleEntityNotFound(_0x11fe29,null))['then'](function(_0x1f24a7){if(_0x1f24a7){_0x3415e7[_0x1e8b('0x4d')]=_[_0x1e8b('0x62')](db[_0x1e8b('0x6e')][_0x1e8b('0x48')]);_0x3415e7[_0x1e8b('0x4b')]=_[_0x1e8b('0x62')](_0x3a36f8[_0x1e8b('0x4b')]);_0x3415e7[_0x1e8b('0x4c')]=_[_0x1e8b('0x4f')](_0x3415e7[_0x1e8b('0x4d')],_0x3415e7[_0x1e8b('0x4b')]);_0x3b16fe[_0x1e8b('0x4e')]=_['intersection'](_0x3415e7[_0x1e8b('0x4d')],qs[_0x1e8b('0x63')](_0x3a36f8[_0x1e8b('0x4b')][_0x1e8b('0x63')]));_0x3b16fe['attributes']=_0x3b16fe['attributes'][_0x1e8b('0x50')]?_0x3b16fe[_0x1e8b('0x4e')]:_0x3415e7[_0x1e8b('0x4d')];if(!_0x3a36f8[_0x1e8b('0x4b')]['hasOwnProperty'](_0x1e8b('0x71'))){_0x3b16fe['limit']=qs[_0x1e8b('0x23')](_0x3a36f8[_0x1e8b('0x4b')][_0x1e8b('0x23')]);_0x3b16fe[_0x1e8b('0x21')]=qs['offset'](_0x3a36f8['query'][_0x1e8b('0x21')]);}_0x3b16fe[_0x1e8b('0x51')]=qs[_0x1e8b('0x52')](_0x3a36f8['query'][_0x1e8b('0x52')]);_0x3b16fe[_0x1e8b('0x53')]=qs['filters'](_[_0x1e8b('0x54')](_0x3a36f8[_0x1e8b('0x4b')],_0x3415e7[_0x1e8b('0x4c')]));_0x3b16fe['where'][_0x1e8b('0x6d')]=_0x1f24a7['id'];if(_0x3a36f8[_0x1e8b('0x4b')][_0x1e8b('0x55')]){_0x3b16fe[_0x1e8b('0x53')]=_['merge'](_0x3b16fe[_0x1e8b('0x53')],{'$or':_['map'](_0x3b16fe[_0x1e8b('0x4e')],function(_0x10aaa6){var _0x4e6c9b={};_0x4e6c9b[_0x10aaa6]={'$like':'%'+_0x3a36f8[_0x1e8b('0x4b')][_0x1e8b('0x55')]+'%'};return _0x4e6c9b;})});}_0x3b16fe=_[_0x1e8b('0x58')]({},_0x3b16fe,_0x3a36f8[_0x1e8b('0x59')]);return db[_0x1e8b('0x6e')][_0x1e8b('0x24')]({'where':_0x3b16fe['where']})['then'](function(_0x483ca9){_0x1a6c6a[_0x1e8b('0x24')]=_0x483ca9;if(_0x3a36f8['query']['includeAll']){_0x3b16fe[_0x1e8b('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3b16fe);})['then'](function(_0x6c2c26){_0x1a6c6a['rows']=_0x6c2c26;return _0x1a6c6a;});}})[_0x1e8b('0x12')](respondWithFilteredResult(_0x11fe29,_0x3b16fe))[_0x1e8b('0x64')](handleError(_0x11fe29,null));};exports[_0x1e8b('0x72')]=function(_0x1068ed,_0x4de40d){return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x1068ed[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x4de40d,null))[_0x1e8b('0x12')](function(_0x2270b9){if(_0x2270b9){return _0x2270b9['removeDispositions'](_0x1068ed[_0x1e8b('0x4b')][_0x1e8b('0x73')]);}})[_0x1e8b('0x12')](respondWithStatusCode(_0x4de40d,null))[_0x1e8b('0x64')](handleError(_0x4de40d,null));};exports[_0x1e8b('0x74')]=function(_0x595403,_0x156cf8){if(_0x595403[_0x1e8b('0x66')]['id']){delete _0x595403[_0x1e8b('0x66')]['id'];}return db['MailAccount'][_0x1e8b('0x69')]({'where':{'id':_0x595403['params']['id']}})['then'](handleEntityNotFound(_0x156cf8,null))['then'](function(_0x178f47){if(_0x178f47){_0x595403['body'][_0x1e8b('0x6d')]=_0x178f47['id'];return db[_0x1e8b('0x75')][_0x1e8b('0x6f')](_0x595403['body']);}})[_0x1e8b('0x12')](respondWithResult(_0x156cf8,null))[_0x1e8b('0x64')](handleError(_0x156cf8,null));};exports[_0x1e8b('0x76')]=function(_0x1f3d29,_0x2d1399){var _0x30bc19={'raw':![],'where':{}};var _0x2f7118={};var _0x4b8158={'count':0x0,'rows':[]};return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x1f3d29[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x2d1399,null))[_0x1e8b('0x12')](function(_0x817143){if(_0x817143){_0x2f7118[_0x1e8b('0x4d')]=_[_0x1e8b('0x62')](db[_0x1e8b('0x75')]['rawAttributes']);_0x2f7118[_0x1e8b('0x4b')]=_[_0x1e8b('0x62')](_0x1f3d29[_0x1e8b('0x4b')]);_0x2f7118['filters']=_[_0x1e8b('0x4f')](_0x2f7118[_0x1e8b('0x4d')],_0x2f7118[_0x1e8b('0x4b')]);_0x30bc19['attributes']=_[_0x1e8b('0x4f')](_0x2f7118['model'],qs[_0x1e8b('0x63')](_0x1f3d29[_0x1e8b('0x4b')]['fields']));_0x30bc19[_0x1e8b('0x4e')]=_0x30bc19[_0x1e8b('0x4e')][_0x1e8b('0x50')]?_0x30bc19[_0x1e8b('0x4e')]:_0x2f7118[_0x1e8b('0x4d')];if(!_0x1f3d29[_0x1e8b('0x4b')]['hasOwnProperty'](_0x1e8b('0x71'))){_0x30bc19[_0x1e8b('0x23')]=qs[_0x1e8b('0x23')](_0x1f3d29[_0x1e8b('0x4b')]['limit']);_0x30bc19['offset']=qs[_0x1e8b('0x21')](_0x1f3d29[_0x1e8b('0x4b')][_0x1e8b('0x21')]);}_0x30bc19[_0x1e8b('0x51')]=qs['sort'](_0x1f3d29[_0x1e8b('0x4b')][_0x1e8b('0x52')]);_0x30bc19[_0x1e8b('0x53')]=qs[_0x1e8b('0x4c')](_[_0x1e8b('0x54')](_0x1f3d29[_0x1e8b('0x4b')],_0x2f7118[_0x1e8b('0x4c')]));_0x30bc19['where']['MailAccountId']=_0x817143['id'];if(_0x1f3d29[_0x1e8b('0x4b')][_0x1e8b('0x55')]){_0x30bc19['where']=_['merge'](_0x30bc19[_0x1e8b('0x53')],{'$or':_[_0x1e8b('0x56')](_0x30bc19[_0x1e8b('0x4e')],function(_0x907c6e){var _0x475c90={};_0x475c90[_0x907c6e]={'$like':'%'+_0x1f3d29[_0x1e8b('0x4b')][_0x1e8b('0x55')]+'%'};return _0x475c90;})});}_0x30bc19=_['merge']({},_0x30bc19,_0x1f3d29[_0x1e8b('0x59')]);return db[_0x1e8b('0x75')][_0x1e8b('0x24')]({'where':_0x30bc19['where']})[_0x1e8b('0x12')](function(_0x43eab7){_0x4b8158[_0x1e8b('0x24')]=_0x43eab7;if(_0x1f3d29['query'][_0x1e8b('0x5a')]){_0x30bc19[_0x1e8b('0x5b')]=[{'all':!![]}];}return db[_0x1e8b('0x75')]['findAll'](_0x30bc19);})[_0x1e8b('0x12')](function(_0x80e7c2){_0x4b8158['rows']=_0x80e7c2;return _0x4b8158;});}})[_0x1e8b('0x12')](respondWithFilteredResult(_0x2d1399,_0x30bc19))[_0x1e8b('0x64')](handleError(_0x2d1399,null));};exports[_0x1e8b('0x77')]=function(_0x520c9c,_0x5f01d0){return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x520c9c[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x5f01d0,null))[_0x1e8b('0x12')](function(_0x51fc3f){if(_0x51fc3f){return _0x51fc3f[_0x1e8b('0x77')](_0x520c9c[_0x1e8b('0x4b')][_0x1e8b('0x73')]);}})[_0x1e8b('0x12')](respondWithStatusCode(_0x5f01d0,null))[_0x1e8b('0x64')](handleError(_0x5f01d0,null));};exports[_0x1e8b('0x6f')]=function(_0xabad58,_0x741979){var _0x115e3d={'name':_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x2b')],'key':_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x4a')],'provider':_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x67')]===_0x1e8b('0x68')?null:_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x67')],'email':_0xabad58[_0x1e8b('0x66')]['email'],'ListId':_0xabad58['body'][_0x1e8b('0x78')],'active':!_[_0x1e8b('0x79')](_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x7a')])?_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x7a')]:!![],'description':_0xabad58[_0x1e8b('0x66')][_0x1e8b('0x7b')]||null};var _0x18fa74=getAuthenticationOptions(_0x115e3d['provider'],_0xabad58[_0x1e8b('0x66')]);_0x115e3d['Imap']=_0x18fa74[_0x1e8b('0x43')];_0x115e3d[_0x1e8b('0x44')]=_0x18fa74[_0x1e8b('0x44')];return db[_0x1e8b('0x5c')][_0x1e8b('0x6f')](_0x115e3d,{'include':[{'model':db['MailServerOut'],'as':_0x1e8b('0x44')},{'model':db['MailServerIn'],'as':_0x1e8b('0x43')}]})['then'](function(_0x3eba17){var _0x19fc59=_0xabad58[_0x1e8b('0x38')][_0x1e8b('0x28')]({'plain':!![]});if(!_0x19fc59)throw new Error(_0x1e8b('0x7c'));if(_0x19fc59[_0x1e8b('0x7d')]===_0x1e8b('0x38')){var _0xf9c4eb=_0x3eba17['get']({'plain':!![]});return db[_0x1e8b('0x7e')]['find']({'where':{'name':_0x1e8b('0x29'),'userProfileId':_0x19fc59[_0x1e8b('0x7f')]},'raw':!![]})[_0x1e8b('0x12')](function(_0x2a1d55){if(_0x2a1d55&&_0x2a1d55[_0x1e8b('0x80')]===0x0){return db[_0x1e8b('0x2a')][_0x1e8b('0x6f')]({'name':_0xf9c4eb[_0x1e8b('0x2b')],'resourceId':_0xf9c4eb['id'],'type':_0x2a1d55[_0x1e8b('0x2b')],'sectionId':_0x2a1d55['id']},{})['then'](function(){return _0x3eba17;});}else{return _0x3eba17;}})[_0x1e8b('0x64')](function(_0x1f7d32){logger['error'](_0x1e8b('0x81'),_0x1f7d32);throw _0x1f7d32;});}return _0x3eba17;})[_0x1e8b('0x12')](respondWithResult(_0x741979,0xc9))[_0x1e8b('0x64')](handleError(_0x741979,null));};exports[_0x1e8b('0x82')]=function(_0xb9a6ca,_0x368535){return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0xb9a6ca['params']['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x368535,null))[_0x1e8b('0x12')](function(_0xc64765){if(_0xc64765){return _0xc64765[_0x1e8b('0x82')]();}return null;})[_0x1e8b('0x12')](respondWithResult(_0x368535,null))[_0x1e8b('0x64')](handleError(_0x368535,null));};exports[_0x1e8b('0x83')]=function(_0x38eae6,_0x52f38a){if(_0x38eae6[_0x1e8b('0x66')]['id']){delete _0x38eae6['body']['id'];}return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x38eae6[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x52f38a,null))[_0x1e8b('0x12')](function(_0x2ebfde){if(_0x2ebfde){_0x38eae6[_0x1e8b('0x66')]['MailAccountId']=_0x2ebfde['id'];return db[_0x1e8b('0x46')][_0x1e8b('0x6f')](_0x38eae6[_0x1e8b('0x66')]);}})[_0x1e8b('0x12')](respondWithResult(_0x52f38a,null))[_0x1e8b('0x64')](handleError(_0x52f38a,null));};exports[_0x1e8b('0x84')]=function(_0x28a610,_0x406dcd){return db['MailAccount']['findOne']({'where':{'id':_0x28a610[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x406dcd,null))[_0x1e8b('0x12')](function(_0x129046){if(_0x129046){return _0x129046[_0x1e8b('0x85')](null);}return null;})[_0x1e8b('0x12')](respondWithStatusCode(_0x406dcd,null))[_0x1e8b('0x64')](handleError(_0x406dcd,null));};exports[_0x1e8b('0x86')]=function(_0x570f61,_0x4fe212){return db['MailAccount'][_0x1e8b('0x70')]({'where':{'id':_0x570f61[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x4fe212,null))[_0x1e8b('0x12')](function(_0x166ff9){if(_0x166ff9){return _0x166ff9[_0x1e8b('0x86')]();}return null;})[_0x1e8b('0x12')](respondWithResult(_0x4fe212,null))[_0x1e8b('0x64')](handleError(_0x4fe212,null));};exports[_0x1e8b('0x87')]=function(_0x56c458,_0x12cf63){if(_0x56c458[_0x1e8b('0x66')]['id']){delete _0x56c458[_0x1e8b('0x66')]['id'];}return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x56c458[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x12cf63,null))[_0x1e8b('0x12')](function(_0x24b6cd){if(_0x24b6cd){_0x56c458[_0x1e8b('0x66')][_0x1e8b('0x6d')]=_0x24b6cd['id'];return db[_0x1e8b('0x60')][_0x1e8b('0x6f')](_0x56c458[_0x1e8b('0x66')]);}})['then'](respondWithResult(_0x12cf63,null))['catch'](handleError(_0x12cf63,null));};exports['removeSmtp']=function(_0x188d38,_0xce9628){return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x188d38[_0x1e8b('0x6a')]['id']}})['then'](handleEntityNotFound(_0xce9628,null))[_0x1e8b('0x12')](function(_0x42f075){if(_0x42f075){return _0x42f075[_0x1e8b('0x88')](null);}return null;})[_0x1e8b('0x12')](respondWithStatusCode(_0xce9628,null))[_0x1e8b('0x64')](handleError(_0xce9628,null));};exports['addInteraction']=function(_0x239190,_0x34cbbc){return db[_0x1e8b('0x89')]['find']({'where':{'id':_0x239190[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x34cbbc,null))[_0x1e8b('0x12')](function(_0x33d006){if(_0x33d006){return _0x33d006[_0x1e8b('0x8a')](_0x239190[_0x1e8b('0x66')][_0x1e8b('0x73')],_[_0x1e8b('0x8b')](_0x239190[_0x1e8b('0x66')],[_0x1e8b('0x73'),'id'])||{});}})[_0x1e8b('0x12')](respondWithResult(_0x34cbbc,null))[_0x1e8b('0x64')](handleError(_0x34cbbc,null));};exports[_0x1e8b('0x8c')]=function(_0x4989a1,_0x2ecb80){var _0xa48da8={'raw':![],'where':{}};var _0x4b9158={};var _0x5a0e3={'count':0x0,'rows':[]};return db[_0x1e8b('0x5c')]['findOne']({'where':{'id':_0x4989a1['params']['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x2ecb80,null))['then'](function(_0xabffbb){if(_0xabffbb){_0x4b9158['model']=_['keys'](db[_0x1e8b('0x89')][_0x1e8b('0x48')]);_0x4b9158[_0x1e8b('0x4b')]=_['keys'](_0x4989a1[_0x1e8b('0x4b')]);_0x4b9158[_0x1e8b('0x4c')]=_[_0x1e8b('0x4f')](_0x4b9158[_0x1e8b('0x4d')],_0x4b9158[_0x1e8b('0x4b')]);_0xa48da8[_0x1e8b('0x4e')]=_[_0x1e8b('0x4f')](_0x4b9158[_0x1e8b('0x4d')],qs[_0x1e8b('0x63')](_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x63')]));_0xa48da8[_0x1e8b('0x4e')]=_0xa48da8[_0x1e8b('0x4e')][_0x1e8b('0x50')]?_0xa48da8[_0x1e8b('0x4e')]:_0x4b9158[_0x1e8b('0x4d')];if(!_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x8d')]('nolimit')){_0xa48da8[_0x1e8b('0x23')]=qs[_0x1e8b('0x23')](_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x23')]);_0xa48da8[_0x1e8b('0x21')]=qs[_0x1e8b('0x21')](_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x21')]);}_0xa48da8[_0x1e8b('0x51')]=qs[_0x1e8b('0x52')](_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x52')]);_0xa48da8[_0x1e8b('0x53')]=qs['filters'](_[_0x1e8b('0x54')](_0x4989a1[_0x1e8b('0x4b')],_0x4b9158[_0x1e8b('0x4c')]));_0xa48da8[_0x1e8b('0x53')][_0x1e8b('0x6d')]=_0xabffbb['id'];if(_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x55')]){_0xa48da8['where']=_[_0x1e8b('0x58')](_0xa48da8['where'],{'$or':_[_0x1e8b('0x56')](_0xa48da8[_0x1e8b('0x4e')],function(_0x47e22b){var _0x328585={};_0x328585[_0x47e22b]={'$like':'%'+_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x55')]+'%'};return _0x328585;})});}_0xa48da8=_[_0x1e8b('0x58')]({},_0xa48da8,_0x4989a1['options']);return db[_0x1e8b('0x89')]['count']({'where':_0xa48da8[_0x1e8b('0x53')]})[_0x1e8b('0x12')](function(_0x9a33d4){_0x5a0e3['count']=_0x9a33d4;if(_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x5a')]){_0xa48da8[_0x1e8b('0x5b')]=[{'model':db[_0x1e8b('0x8e')],'as':'Contact','required':![]},{'model':db[_0x1e8b('0x8f')],'as':_0x1e8b('0x90'),'attributes':[_0x1e8b('0x2b'),_0x1e8b('0x91'),'internal'],'required':![]},{'model':db[_0x1e8b('0x92')],'as':_0x1e8b('0x93'),'attributes':['id',_0x1e8b('0x2b'),'color'],'where':_0x4989a1[_0x1e8b('0x4b')]['tag']?{'id':_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x94')]}:undefined,'required':_0x4989a1[_0x1e8b('0x4b')][_0x1e8b('0x94')]?!![]:![]}];}return db[_0x1e8b('0x89')]['findAll'](_0xa48da8);})[_0x1e8b('0x12')](function(_0x3ff676){_0x5a0e3[_0x1e8b('0x5e')]=_0x3ff676;return _0x5a0e3;});}})[_0x1e8b('0x12')](respondWithFilteredResult(_0x2ecb80,_0xa48da8))['catch'](handleError(_0x2ecb80,null));};exports[_0x1e8b('0x95')]=function addApplications(_0x8a149f,_0x609648){var _0x4c1a9b=_0x8a149f[_0x1e8b('0x6a')]['id'];var _0x5184ca=_0x8a149f[_0x1e8b('0x66')];var _0x54de35=0xc8;var _0x1a98ac=null;return db[_0x1e8b('0x96')]['transaction']({'isolationLevel':db[_0x1e8b('0x96')][_0x1e8b('0x97')][_0x1e8b('0x98')]['READ_COMMITTED']},function(_0x421755){return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x4c1a9b},'transaction':_0x421755})[_0x1e8b('0x12')](function(_0x4c0978){if(_0x4c0978){return db[_0x1e8b('0x99')][_0x1e8b('0x27')]({'where':{'MailAccountId':_0x4c1a9b},'transaction':_0x421755})['then'](function(){var _0x8d9b4f=_[_0x1e8b('0x56')](_0x5184ca,function(_0x12e386){_0x12e386['MailAccountId']=_0x4c1a9b;return _0x12e386;});return db['MailApplication'][_0x1e8b('0x9a')](_0x8d9b4f,{'transaction':_0x421755});});}else{_0x54de35=0x194;_0x1a98ac=[];}});})[_0x1e8b('0x12')](function(){if(_0x54de35!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x4c1a9b},'order':'priority'})[_0x1e8b('0x12')](function(_0x1c94a0){_0x1a98ac=_0x1c94a0;});}})[_0x1e8b('0x64')](function(_0x33248e){_0x54de35=0x1f4;logger[_0x1e8b('0x18')](_0x33248e['stack']);if(_0x33248e[_0x1e8b('0x2b')]){delete _0x33248e['name'];}_0x1a98ac=_0x33248e;})[_0x1e8b('0x9b')](function(){if(_0x1a98ac===null){_0x609648[_0x1e8b('0x1d')](_0x54de35);}else{if(_0x54de35===0x1f4){_0x609648[_0x1e8b('0x1e')](_0x54de35)[_0x1e8b('0x2c')](_0x1a98ac);}else{_0x609648['status'](_0x54de35)[_0x1e8b('0x20')](_0x1a98ac);}}});};exports[_0x1e8b('0x9c')]=function(_0x5d3501,_0x55d8c7){var _0x55c68f={};var _0x382329={};var _0x5c6906;var _0x16a7e6;return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x5d3501[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x55d8c7,null))[_0x1e8b('0x12')](function(_0x3d4d2e){if(_0x3d4d2e){_0x5c6906=_0x3d4d2e;_0x382329[_0x1e8b('0x4d')]=_[_0x1e8b('0x62')](db[_0x1e8b('0x99')][_0x1e8b('0x48')]);_0x382329[_0x1e8b('0x4b')]=_['keys'](_0x5d3501['query']);_0x382329['filters']=_[_0x1e8b('0x4f')](_0x382329[_0x1e8b('0x4d')],_0x382329[_0x1e8b('0x4b')]);_0x55c68f[_0x1e8b('0x4e')]=_[_0x1e8b('0x4f')](_0x382329['model'],qs[_0x1e8b('0x63')](_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x63')]));_0x55c68f[_0x1e8b('0x4e')]=_0x55c68f[_0x1e8b('0x4e')]['length']?_0x55c68f[_0x1e8b('0x4e')]:_0x382329[_0x1e8b('0x4d')];_0x55c68f[_0x1e8b('0x51')]=qs[_0x1e8b('0x52')](_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x52')]);_0x55c68f[_0x1e8b('0x53')]=qs['filters'](_['pick'](_0x5d3501[_0x1e8b('0x4b')],_0x382329[_0x1e8b('0x4c')]));if(_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x55')]){_0x55c68f[_0x1e8b('0x53')]=_['merge'](_0x55c68f[_0x1e8b('0x53')],{'$or':_[_0x1e8b('0x56')](_0x55c68f[_0x1e8b('0x4e')],function(_0x200d48){var _0x44f237={};_0x44f237[_0x200d48]={'$like':'%'+_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x55')]+'%'};return _0x44f237;})});}_0x55c68f=_[_0x1e8b('0x58')]({},_0x55c68f,_0x5d3501['options']);return _0x5c6906[_0x1e8b('0x9c')](_0x55c68f);}})[_0x1e8b('0x12')](function(_0x599e06){if(_0x599e06){_0x16a7e6=_0x599e06[_0x1e8b('0x50')];if(!_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x8d')](_0x1e8b('0x71'))){_0x55c68f[_0x1e8b('0x23')]=qs['limit'](_0x5d3501[_0x1e8b('0x4b')][_0x1e8b('0x23')]);_0x55c68f[_0x1e8b('0x21')]=qs['offset'](_0x5d3501['query']['offset']);}return _0x5c6906[_0x1e8b('0x9c')](_0x55c68f);}})[_0x1e8b('0x12')](function(_0x32d2e8){if(_0x32d2e8){return _0x32d2e8?{'count':_0x16a7e6,'rows':_0x32d2e8}:null;}})[_0x1e8b('0x12')](respondWithResult(_0x55d8c7,null))['catch'](handleError(_0x55d8c7,null));};exports[_0x1e8b('0x9d')]=function(_0x2a4787,_0xbc62dd){var _0x2bda5b={'raw':!![],'where':{}};var _0x368eed={};var _0x5b8df9={'count':0x0,'rows':[]};return db[_0x1e8b('0x5c')]['findOne']({'where':{'id':_0x2a4787[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0xbc62dd,null))[_0x1e8b('0x12')](function(_0x30c60e){if(_0x30c60e){_0x368eed[_0x1e8b('0x4d')]=_[_0x1e8b('0x62')](db[_0x1e8b('0x9e')][_0x1e8b('0x48')]);_0x368eed['query']=_[_0x1e8b('0x62')](_0x2a4787[_0x1e8b('0x4b')]);_0x368eed[_0x1e8b('0x4c')]=_['intersection'](_0x368eed[_0x1e8b('0x4d')],_0x368eed['query']);_0x2bda5b[_0x1e8b('0x4e')]=_['intersection'](_0x368eed[_0x1e8b('0x4d')],qs['fields'](_0x2a4787[_0x1e8b('0x4b')][_0x1e8b('0x63')]));_0x2bda5b['attributes']=_0x2bda5b[_0x1e8b('0x4e')]['length']?_0x2bda5b['attributes']:_0x368eed[_0x1e8b('0x4d')];if(!_0x2a4787[_0x1e8b('0x4b')][_0x1e8b('0x8d')]('nolimit')){_0x2bda5b[_0x1e8b('0x23')]=qs[_0x1e8b('0x23')](_0x2a4787[_0x1e8b('0x4b')][_0x1e8b('0x23')]);_0x2bda5b['offset']=qs[_0x1e8b('0x21')](_0x2a4787[_0x1e8b('0x4b')]['offset']);}_0x2bda5b['order']=qs[_0x1e8b('0x52')](_0x2a4787['query'][_0x1e8b('0x52')]);_0x2bda5b[_0x1e8b('0x53')]=qs[_0x1e8b('0x4c')](_[_0x1e8b('0x54')](_0x2a4787[_0x1e8b('0x4b')],_0x368eed[_0x1e8b('0x4c')]));_0x2bda5b['where']['MailAccountId']=_0x30c60e['id'];if(_0x2a4787['query']['filter']){_0x2bda5b[_0x1e8b('0x53')]=_[_0x1e8b('0x58')](_0x2bda5b[_0x1e8b('0x53')],{'$or':_[_0x1e8b('0x56')](_0x2bda5b[_0x1e8b('0x4e')],function(_0x9dc011){var _0xd6e99a={};_0xd6e99a[_0x9dc011]={'$like':'%'+_0x2a4787[_0x1e8b('0x4b')]['filter']+'%'};return _0xd6e99a;})});}if(_0x2a4787['query'][_0x1e8b('0x9f')]){var _0x9985b5=_0x2a4787[_0x1e8b('0x4b')]['$gte'][_0x1e8b('0xa0')](',');var _0x122046={};_0x122046[_0x9985b5[0x0]]={'$gte':moment(_0x9985b5[0x1])[_0x1e8b('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2bda5b[_0x1e8b('0x53')]=_[_0x1e8b('0x58')](_0x2bda5b[_0x1e8b('0x53')],_0x122046);}_0x2bda5b=_[_0x1e8b('0x58')]({},_0x2bda5b,_0x2a4787[_0x1e8b('0x59')]);return db[_0x1e8b('0x9e')][_0x1e8b('0x24')]({'where':_0x2bda5b[_0x1e8b('0x53')]})[_0x1e8b('0x12')](function(_0x35bdf1){_0x5b8df9['count']=_0x35bdf1;if(_0x2a4787[_0x1e8b('0x4b')][_0x1e8b('0x5a')]){_0x2bda5b['include']=[{'all':!![]}];}return db['MailMessage'][_0x1e8b('0x5d')](_0x2bda5b);})[_0x1e8b('0x12')](function(_0x4a8139){if(_0x2a4787['query'][_0x1e8b('0xa2')]===_0x1e8b('0xa3')){for(var _0x3a08c8=0x0;_0x3a08c8<_0x4a8139[_0x1e8b('0x50')];_0x3a08c8++){_0x4a8139[_0x3a08c8][_0x1e8b('0x66')]=juice(_0x4a8139[_0x3a08c8][_0x1e8b('0x66')]);}}_0x5b8df9[_0x1e8b('0x5e')]=_0x4a8139;return _0x5b8df9;});}})[_0x1e8b('0x12')](respondWithFilteredResult(_0xbc62dd,_0x2bda5b))[_0x1e8b('0x64')](handleError(_0xbc62dd,null));};exports[_0x1e8b('0x2c')]=function(_0x4a7dcf,_0x17ac61){var _0xad6837,_0x5b64bf={},_0x15068e;if(_0x4a7dcf[_0x1e8b('0x66')]['to']){_0x15068e=_0x4a7dcf[_0x1e8b('0x66')]['to'][_0x1e8b('0xa0')](',')[0x0];}return db[_0x1e8b('0x5c')]['find']({'where':{'id':_0x4a7dcf[_0x1e8b('0x6a')]['id']},'include':[{'model':db[_0x1e8b('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1e8b('0xa5'),'where':{'email':_0x15068e},'limit':0x1,'order':[[_0x1e8b('0xa6'),_0x1e8b('0xa7')]]}]},{'model':db[_0x1e8b('0x60')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x1e8b('0x12')](handleEntityNotFound(_0x17ac61,null))[_0x1e8b('0x12')](function(_0x489e28){if(!_0x489e28)return;_0xad6837=_0x489e28;if(!_0x489e28[_0x1e8b('0x44')])throw new Error(_0x1e8b('0xa8'));if(_[_0x1e8b('0x79')](_0x4a7dcf['body'][_0x1e8b('0xa9')])){_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xa9')]=util[_0x1e8b('0xa1')](_0x1e8b('0xaa'),_0x489e28['name'],_0x489e28[_0x1e8b('0xab')]||_0x489e28[_0x1e8b('0x44')][_0x1e8b('0x38')]);}if(_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')]&&_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')][_0x1e8b('0x50')]){for(var _0x169053=0x0;_0x169053<_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')]['length'];_0x169053+=0x1){_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')][_0x169053]={'filename':_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')][_0x169053][_0x1e8b('0x2b')],'path':path[_0x1e8b('0xad')](config[_0x1e8b('0xae')],_0x1e8b('0xaf'),_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xac')][_0x169053][_0x1e8b('0xb0')])};}}var _0x24fcc6=_0x489e28[_0x1e8b('0xb1')]();return respondWithRpcPromise(_0x1e8b('0xb2'),_0x1e8b('0xb3'),{'account':_0x24fcc6,'message':_0x4a7dcf[_0x1e8b('0x66')]});})['then'](function(_0x1d0a0c){if(!_0x1d0a0c)return;_0x5b64bf=_0x1d0a0c;if(!_0xad6837[_0x1e8b('0xb4')])throw new Error(_0x1e8b('0xb5'));if(_0xad6837[_0x1e8b('0xb4')][_0x1e8b('0xa5')][_0x1e8b('0x50')])return _0xad6837[_0x1e8b('0xb4')][_0x1e8b('0xa5')][0x0];return db[_0x1e8b('0x8e')]['create'](_[_0x1e8b('0xb')](_0x4a7dcf[_0x1e8b('0x66')],{'firstName':_0x4a7dcf[_0x1e8b('0x66')]['to'],'email':_0x4a7dcf[_0x1e8b('0x66')]['to'],'phone':_0x4a7dcf[_0x1e8b('0x66')]['to'],'ListId':_0xad6837['ListId']}));})['then'](function(_0x20d6c9){if(!_0x20d6c9)return;var _0xf77c10={'UserId':_0x4a7dcf['user']['id'],'ContactId':_0x20d6c9['id'],'MailAccountId':_0xad6837['id'],'inReplyTo':_0x5b64bf[_0x1e8b('0xb6')],'to':_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xa9')],'cc':_0x4a7dcf['body']['cc'],'subject':_0x4a7dcf[_0x1e8b('0x66')][_0x1e8b('0xb7')],'attach':_0x4a7dcf['body'][_0x1e8b('0xb8')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x1e8b('0xb9')),'lastMsgDirection':_0x1e8b('0xba'),'Messages':[_[_0x1e8b('0x58')](_0x4a7dcf[_0x1e8b('0x66')],{'messageId':_0x5b64bf[_0x1e8b('0xb6')],'sentAt':moment()['format'](_0x1e8b('0xb9')),'read':!![],'MailAccountId':_0xad6837['id'],'UserId':_0x4a7dcf[_0x1e8b('0x38')]['id'],'ContactId':_0x20d6c9['id']})]};if(_0x4a7dcf['body'][_0x1e8b('0xbb')]){_0xf77c10=_['merge'](_0xf77c10,_0x4a7dcf['body'][_0x1e8b('0xbb')]);}return db[_0x1e8b('0x89')]['create'](_0xf77c10,{'include':[{'model':db[_0x1e8b('0x9e')],'as':'Messages'}]});})['then'](respondWithResult(_0x17ac61,null))[_0x1e8b('0x64')](handleError(_0x17ac61,null));};exports['verifySmtp']=function(_0x6c398,_0x340804){return db['MailAccount'][_0x1e8b('0x69')]({'where':{'id':_0x6c398['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x1e8b('0x44'),'raw':!![],'include':[{'model':db[_0x1e8b('0xbc')],'as':_0x1e8b('0xbc'),'raw':!![]}]}]})[_0x1e8b('0x12')](handleEntityNotFound(_0x340804,null))[_0x1e8b('0x12')](function(_0x1fb699){if(!_0x1fb699[_0x1e8b('0x44')])return;var _0x1a43d1=_0x1fb699[_0x1e8b('0xb1')]();return respondWithRpcPromise(_0x1e8b('0xbd'),_0x1e8b('0xbe'),{'account':_0x1a43d1});})[_0x1e8b('0x12')](respondWithResult(_0x340804,null))['catch'](handleError(_0x340804,null));};exports['destroy']=function(_0x26d149,_0x1f4f73){return db['MailAccount'][_0x1e8b('0x69')]({'where':{'id':_0x26d149[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x1f4f73,null))[_0x1e8b('0x12')](function(_0x5a2ae3){if(_0x5a2ae3&&_0x5a2ae3[_0x1e8b('0x41')]){throw new db['Sequelize'][(_0x1e8b('0xbf'))](_0x1e8b('0xc0'));}return _0x5a2ae3;})[_0x1e8b('0x12')](removeEntity(_0x1f4f73,null))[_0x1e8b('0x64')](handleError(_0x1f4f73,null));};exports[_0x1e8b('0xc1')]=function(_0x2d7bf1,_0x116dc9){return db[_0x1e8b('0x5c')]['find']({'where':{'id':_0x2d7bf1['params']['id']}})['then'](handleEntityNotFound(_0x116dc9,null))[_0x1e8b('0x12')](function(_0x54f646){if(_0x54f646){return _0x54f646[_0x1e8b('0xc1')](_0x2d7bf1[_0x1e8b('0x66')][_0x1e8b('0x73')],_['omit'](_0x2d7bf1[_0x1e8b('0x66')],[_0x1e8b('0x73'),'id'])||{})[_0x1e8b('0xc2')](function(_0x44d908){for(var _0x444dde=0x0;_0x444dde<_0x2d7bf1['body'][_0x1e8b('0x73')][_0x1e8b('0x50')];_0x444dde+=0x1){socket[_0x1e8b('0xc3')](_0x1e8b('0xc4'),{'UserId':Number(_0x2d7bf1[_0x1e8b('0x66')][_0x1e8b('0x73')][_0x444dde]),'MailAccountId':Number(_0x2d7bf1['params']['id'])});}return _0x44d908;});}})['then'](respondWithResult(_0x116dc9,null))['catch'](handleError(_0x116dc9,null));};exports[_0x1e8b('0xc5')]=function(_0x24a84a,_0x4cbe1f){return db[_0x1e8b('0x5c')][_0x1e8b('0x69')]({'where':{'id':_0x24a84a[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x4cbe1f,null))[_0x1e8b('0x12')](function(_0x43af63){if(_0x43af63){return _0x43af63[_0x1e8b('0xc5')](_0x24a84a[_0x1e8b('0x4b')][_0x1e8b('0x73')])[_0x1e8b('0x12')](function(){if(_['isArray'](_0x24a84a[_0x1e8b('0x4b')][_0x1e8b('0x73')])){for(var _0x1e691c=0x0;_0x1e691c<_0x24a84a[_0x1e8b('0x4b')]['ids']['length'];_0x1e691c+=0x1){socket[_0x1e8b('0xc3')](_0x1e8b('0xc6'),{'UserId':Number(_0x24a84a[_0x1e8b('0x4b')][_0x1e8b('0x73')][_0x1e691c]),'MailAccountId':Number(_0x24a84a['params']['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x24a84a['query']['ids']),'MailAccountId':Number(_0x24a84a[_0x1e8b('0x6a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4cbe1f,null))['catch'](handleError(_0x4cbe1f,null));};exports['getAgents']=function(_0x43adcb,_0x5ad91e){var _0x4a0778={};var _0x408b1d={};var _0x1773d9;var _0x4314c5;return db[_0x1e8b('0x5c')][_0x1e8b('0x70')]({'where':{'id':_0x43adcb[_0x1e8b('0x6a')]['id']}})[_0x1e8b('0x12')](handleEntityNotFound(_0x5ad91e,null))[_0x1e8b('0x12')](function(_0x263107){if(_0x263107){_0x1773d9=_0x263107;_0x408b1d[_0x1e8b('0x4d')]=_[_0x1e8b('0x62')](db[_0x1e8b('0x8f')]['rawAttributes']);_0x408b1d[_0x1e8b('0x4b')]=_[_0x1e8b('0x62')](_0x43adcb['query']);_0x408b1d[_0x1e8b('0x4c')]=_['intersection'](_0x408b1d['model'],_0x408b1d[_0x1e8b('0x4b')]);_0x4a0778[_0x1e8b('0x4e')]=_[_0x1e8b('0x4f')](_0x408b1d[_0x1e8b('0x4d')],qs[_0x1e8b('0x63')](_0x43adcb['query'][_0x1e8b('0x63')]));_0x4a0778[_0x1e8b('0x4e')]=_0x4a0778[_0x1e8b('0x4e')]['length']?_0x4a0778[_0x1e8b('0x4e')]:_0x408b1d[_0x1e8b('0x4d')];_0x4a0778[_0x1e8b('0x51')]=qs[_0x1e8b('0x52')](_0x43adcb[_0x1e8b('0x4b')][_0x1e8b('0x52')]);_0x4a0778[_0x1e8b('0x53')]=qs['filters'](_[_0x1e8b('0x54')](_0x43adcb['query'],_0x408b1d[_0x1e8b('0x4c')]));if(_0x43adcb[_0x1e8b('0x4b')]['filter']){_0x4a0778[_0x1e8b('0x53')]=_[_0x1e8b('0x58')](_0x4a0778[_0x1e8b('0x53')],{'$or':_[_0x1e8b('0x56')](_0x4a0778[_0x1e8b('0x4e')],function(_0x48578c){var _0x4f1fdd={};_0x4f1fdd[_0x48578c]={'$like':'%'+_0x43adcb['query'][_0x1e8b('0x55')]+'%'};return _0x4f1fdd;})});}_0x4a0778=_[_0x1e8b('0x58')]({},_0x4a0778,_0x43adcb[_0x1e8b('0x59')]);return _0x1773d9[_0x1e8b('0xc7')](_0x4a0778);}})[_0x1e8b('0x12')](function(_0x3e20a3){if(_0x3e20a3){_0x4314c5=_0x3e20a3[_0x1e8b('0x50')];if(!_0x43adcb['query'][_0x1e8b('0x8d')](_0x1e8b('0x71'))){_0x4a0778['limit']=qs['limit'](_0x43adcb[_0x1e8b('0x4b')][_0x1e8b('0x23')]);_0x4a0778[_0x1e8b('0x21')]=qs[_0x1e8b('0x21')](_0x43adcb[_0x1e8b('0x4b')][_0x1e8b('0x21')]);}return _0x1773d9[_0x1e8b('0xc7')](_0x4a0778);}})[_0x1e8b('0x12')](function(_0x53f173){if(_0x53f173){return _0x53f173?{'count':_0x4314c5,'rows':_0x53f173}:null;}})[_0x1e8b('0x12')](respondWithResult(_0x5ad91e,null))[_0x1e8b('0x64')](handleError(_0x5ad91e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a3b4c57..f559c65 100644 --- a/server/api/mailAccount/mailAccount.events.js +++ b/server/api/mailAccount/mailAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ccb=['MailAccount','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x570e73,_0x538538){var _0x13134b=function(_0x2b95e9){while(--_0x2b95e9){_0x570e73['push'](_0x570e73['shift']());}};_0x13134b(++_0x538538);}(_0x4ccb,0x196));var _0xb4cc=function(_0x11da30,_0x4e5673){_0x11da30=_0x11da30-0x0;var _0x212ae1=_0x4ccb[_0x11da30];return _0x212ae1;};'use strict';var EventEmitter=require(_0xb4cc('0x0'));var MailAccount=require(_0xb4cc('0x1'))['db'][_0xb4cc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb4cc('0x3'),'afterUpdate':_0xb4cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2cdc0c){return function(_0x2ae5e6,_0x23c968,_0x4cad3f){MailAccountEvents[_0xb4cc('0x5')](_0x2cdc0c+':'+_0x2ae5e6['id'],_0x2ae5e6);MailAccountEvents[_0xb4cc('0x5')](_0x2cdc0c,_0x2ae5e6);_0x4cad3f(null);};}for(var e in events){if(events[_0xb4cc('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb4cc('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xaf0d=['hasOwnProperty','../../mysqldb','MailAccount','emit'];(function(_0x36ce6e,_0x361b57){var _0x3da6ba=function(_0x55f91b){while(--_0x55f91b){_0x36ce6e['push'](_0x36ce6e['shift']());}};_0x3da6ba(++_0x361b57);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x31d2a1,_0x380c73){_0x31d2a1=_0x31d2a1-0x0;var _0x16c737=_0xaf0d[_0x31d2a1];return _0x16c737;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xdaf0('0x0'))['db'][_0xdaf0('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c0ebc){return function(_0x1b6f35,_0x21a3fa,_0xe9d8f4){MailAccountEvents['emit'](_0x5c0ebc+':'+_0x1b6f35['id'],_0x1b6f35);MailAccountEvents[_0xdaf0('0x2')](_0x5c0ebc,_0x1b6f35);_0xe9d8f4(null);};}for(var e in events){if(events[_0xdaf0('0x3')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1650a06..08a28ad 100644 --- a/server/api/mailAccount/mailAccount.model.js +++ b/server/api/mailAccount/mailAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3003=['provider','custom','service','host','Smtp','port','secure','authentication','CloudProvider','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts'];(function(_0x9b1e58,_0x275770){var _0x50d9d4=function(_0x392e6e){while(--_0x392e6e){_0x9b1e58['push'](_0x9b1e58['shift']());}};_0x50d9d4(++_0x275770);}(_0x3003,0xb0));var _0x3300=function(_0x37cc1c,_0x5635ab){_0x37cc1c=_0x37cc1c-0x0;var _0x1131a4=_0x3003[_0x37cc1c];return _0x1131a4;};'use strict';var attributes=require(_0x3300('0x0'));module[_0x3300('0x1')]=function(_0x4b6618){return _0x4b6618['define'](_0x3300('0x2'),attributes,{'tableName':_0x3300('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x186bf7=this;var _0xb178b5={'id':_0x186bf7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x186bf7[_0x3300('0x4')]!==_0x3300('0x5')){_0xb178b5[_0x3300('0x6')]=_0x186bf7[_0x3300('0x4')];}else{_0xb178b5[_0x3300('0x7')]=_0x186bf7[_0x3300('0x8')][_0x3300('0x7')];_0xb178b5[_0x3300('0x9')]=_0x186bf7[_0x3300('0x8')]['port'];_0xb178b5[_0x3300('0xa')]=_0x186bf7['Smtp'][_0x3300('0xa')];}if(_0x186bf7[_0x3300('0x8')][_0x3300('0xb')]){if(_0x186bf7[_0x3300('0x8')]['modernAuthentication']){if(!_0x186bf7[_0x3300('0x8')][_0x3300('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xb178b5[_0x3300('0xd')]={'type':_0x3300('0xe'),'user':_0x186bf7[_0x3300('0x8')][_0x3300('0xf')],'accessToken':_0x186bf7['Smtp']['CloudProvider'][_0x3300('0x10')]};}else{_0xb178b5['auth']={'user':_0x186bf7[_0x3300('0x8')]['user'],'pass':_0x186bf7[_0x3300('0x8')][_0x3300('0x11')]};}}return _0xb178b5;}}});}; \ No newline at end of file +var _0x83c0=['port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','./mailAccount.attributes','exports','define','mail_accounts','custom','service','provider','Smtp','host'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x83c0,0x114));var _0x083c=function(_0xc9810f,_0x5882db){_0xc9810f=_0xc9810f-0x0;var _0x5c768c=_0x83c0[_0xc9810f];return _0x5c768c;};'use strict';var attributes=require(_0x083c('0x0'));module[_0x083c('0x1')]=function(_0x321992){return _0x321992[_0x083c('0x2')]('MailAccount',attributes,{'tableName':_0x083c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x155121=this;var _0x2716d3={'id':_0x155121['id'],'tls':{'rejectUnauthorized':![]}};if(_0x155121['provider']!==_0x083c('0x4')){_0x2716d3[_0x083c('0x5')]=_0x155121[_0x083c('0x6')];}else{_0x2716d3['host']=_0x155121[_0x083c('0x7')][_0x083c('0x8')];_0x2716d3[_0x083c('0x9')]=_0x155121[_0x083c('0x7')]['port'];_0x2716d3[_0x083c('0xa')]=_0x155121[_0x083c('0x7')][_0x083c('0xa')];}if(_0x155121[_0x083c('0x7')][_0x083c('0xb')]){if(_0x155121['Smtp'][_0x083c('0xc')]){if(!_0x155121[_0x083c('0x7')][_0x083c('0xd')])throw new Error(_0x083c('0xe'));_0x2716d3[_0x083c('0xf')]={'type':_0x083c('0x10'),'user':_0x155121[_0x083c('0x7')][_0x083c('0x11')],'accessToken':_0x155121[_0x083c('0x7')]['CloudProvider'][_0x083c('0x12')]};}else{_0x2716d3[_0x083c('0xf')]={'user':_0x155121[_0x083c('0x7')][_0x083c('0x11')],'pass':_0x155121[_0x083c('0x7')]['pass']};}}return _0x2716d3;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e378a70..6c7ba33 100644 --- a/server/api/mailAccount/mailAccount.rpc.js +++ b/server/api/mailAccount/mailAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x564a18,_0x446536){var _0x410f47=function(_0x23fd0c){while(--_0x23fd0c){_0x564a18['push'](_0x564a18['shift']());}};_0x410f47(++_0x446536);}(_0x2ef3,0xba));var _0x32ef=function(_0x4f31a4,_0xa825e){_0x4f31a4=_0x4f31a4-0x0;var _0x491d26=_0x2ef3[_0x4f31a4];return _0x491d26;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0x4975=['MailMessage','Messages','create','Contact\x20not\x20found','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','User','UserId','agent','name','waitForTheAssignedAgent','startRouting','Start','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','then','info','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailAccount,\x20%s,\x20%s','message','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','Applications','list','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x4975,0x86));var _0x5497=function(_0x104c81,_0x19466e){_0x104c81=_0x104c81-0x0;var _0x4937fe=_0x4975[_0x104c81];return _0x4937fe;};'use strict';var _=require(_0x5497('0x0'));var moment=require('moment');var BPromise=require(_0x5497('0x1'));var rs=require(_0x5497('0x2'));var Redis=require(_0x5497('0x3'));var db=require(_0x5497('0x4'))['db'];var logger=require(_0x5497('0x5'))(_0x5497('0x6'));var config=require(_0x5497('0x7'));var jayson=require(_0x5497('0x8'));var client=jayson[_0x5497('0x9')][_0x5497('0xa')]({'port':0x232c});config['redis']=_[_0x5497('0xb')](config['redis'],{'host':_0x5497('0xc'),'port':0x18eb});var socket=require(_0x5497('0xd'))(new Redis(config[_0x5497('0xe')]));require('./mailAccount.socket')[_0x5497('0xf')](socket);function respondWithRpcPromise(_0x49d94b,_0x1f63d8,_0x29c93f){return new BPromise(function(_0x2ec5a4,_0x32a8a2){return client[_0x5497('0x10')](_0x49d94b,_0x29c93f)[_0x5497('0x11')](function(_0x3e7886){logger[_0x5497('0x12')]('MailAccount,\x20%s,\x20%s',_0x1f63d8,'request\x20sent');logger['debug'](_0x5497('0x13'),_0x1f63d8,_0x5497('0x14'),JSON[_0x5497('0x15')](_0x3e7886));if(_0x3e7886[_0x5497('0x16')]){if(_0x3e7886[_0x5497('0x16')][_0x5497('0x17')]===0x1f4){logger[_0x5497('0x16')](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x32a8a2(_0x3e7886['error'][_0x5497('0x19')]);}logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);return _0x2ec5a4(_0x3e7886[_0x5497('0x16')][_0x5497('0x19')]);}else{logger[_0x5497('0x12')](_0x5497('0x18'),_0x1f63d8,'request\x20sent');_0x2ec5a4(_0x3e7886['result'][_0x5497('0x19')]);}})[_0x5497('0x1a')](function(_0x3a47fd){logger['error'](_0x5497('0x18'),_0x1f63d8,_0x3a47fd);_0x32a8a2(_0x3a47fd);});});}exports[_0x5497('0x1b')]=function(_0x18e8a8){var _0x43da2c=this;return new Promise(function(_0x1b1b43,_0x1f6f18){return db[_0x5497('0x1c')][_0x5497('0x1d')]({'raw':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x18e8a8['options']?_0x18e8a8[_0x5497('0x1e')]['where']||null:null,'attributes':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'limit':_0x18e8a8[_0x5497('0x1e')]?_0x18e8a8[_0x5497('0x1e')][_0x5497('0x21')]||null:null,'include':_0x18e8a8['options']?_0x18e8a8['options'][_0x5497('0x22')]?_[_0x5497('0x23')](_0x18e8a8[_0x5497('0x1e')][_0x5497('0x22')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x24')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x22')]?_[_0x5497('0x23')](_0x5223b5[_0x5497('0x22')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x24')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x20')],'include':_0x34a1a5['include']?_[_0x5497('0x23')](_0x34a1a5['include'],function(_0x583d06){return{'model':db[_0x583d06['model']],'as':_0x583d06['as'],'attributes':_0x583d06[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e9356){logger[_0x5497('0x12')](_0x5497('0x1b'),_0x18e8a8);logger[_0x5497('0x25')]('GetMailAccount',_0x18e8a8,JSON['stringify'](_0x5e9356));_0x1b1b43(_0x5e9356);})['catch'](function(_0x371874){logger[_0x5497('0x16')](_0x5497('0x1b'),_0x371874['message'],_0x18e8a8);_0x1f6f18(_0x43da2c['error'](0x1f4,_0x371874['message']));});});};exports[_0x5497('0x26')]=function(_0x572460){var _0x438ee4=this;return new Promise(function(_0x258c2d,_0x77c575){return db['MailAccount'][_0x5497('0x27')]({'raw':_0x572460[_0x5497('0x1e')]?_0x572460['options'][_0x5497('0x1f')]===undefined?!![]:![]:!![],'where':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['where']||null:null,'attributes':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')][_0x5497('0x20')]||null:null,'include':_0x572460[_0x5497('0x1e')]?_0x572460[_0x5497('0x1e')]['include']?_[_0x5497('0x23')](_0x572460[_0x5497('0x1e')]['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x24')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x20')],'include':_0x1ffc9b[_0x5497('0x22')]?_[_0x5497('0x23')](_0x1ffc9b[_0x5497('0x22')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x24')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes'],'include':_0x580e86[_0x5497('0x22')]?_[_0x5497('0x23')](_0x580e86[_0x5497('0x22')],function(_0x5ab18c){return{'model':db[_0x5ab18c['model']],'as':_0x5ab18c['as'],'attributes':_0x5ab18c[_0x5497('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5497('0x11')](function(_0x326d48){if(_0x572460[_0x5497('0x1e')][_0x5497('0x28')]===!![])_0x326d48[_0x5497('0x29')]('smtpOptions',_0x326d48[_0x5497('0x2a')]());logger[_0x5497('0x12')](_0x5497('0x26'),_0x572460);logger[_0x5497('0x25')](_0x5497('0x26'),_0x572460,JSON[_0x5497('0x15')](_0x326d48));_0x258c2d(_0x326d48);})[_0x5497('0x1a')](function(_0x179635){logger[_0x5497('0x16')]('ShowMailAccount',_0x179635[_0x5497('0x19')],_0x572460);_0x77c575(_0x438ee4[_0x5497('0x16')](0x1f4,_0x179635[_0x5497('0x19')]));});});};exports[_0x5497('0x2b')]=function(_0x15029d){var _0xa5ebe6=this;return new Promise(function(_0x4299be,_0x59ed13){var _0x3e5f7d={'body':_0x15029d[_0x5497('0x2c')],'channel':_0x5497('0x2d')};var _0x35993c=_[_0x5497('0x2e')](_[_0x5497('0x2f')](db[_0x5497('0x30')]['rawAttributes']),[_0x5497('0x31'),_0x5497('0x32'),_0x5497('0x33'),_0x5497('0x34')]);var _0x20e947=![];if(_0x15029d[_0x5497('0x2c')]['id']){delete _0x15029d[_0x5497('0x2c')]['id'];}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')][_0x5497('0x36')])){return _0x59ed13(_0xa5ebe6['error'](0x1f4,_0x5497('0x37')));}if(_['isNil'](_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')])||_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')]===''){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x5497('0x35')](_0x15029d[_0x5497('0x2c')]['mapKey'])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x35993c));}if(!_[_0x5497('0x38')](_0x35993c,_0x15029d['body'][_0x5497('0x39')])){return _0x59ed13(_0xa5ebe6[_0x5497('0x16')](0x1f4,_0x5497('0x3a')+_0x35993c));}var _0x3a852a={};_0x3a852a[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body']['from'];return db['MailAccount'][_0x5497('0x27')]({'where':{'id':_0x15029d[_0x5497('0x3b')]['id']},'include':[{'model':db[_0x5497('0x3c')],'as':_0x5497('0x3d'),'include':[{'model':db[_0x5497('0x30')],'as':_0x5497('0x3e'),'where':_0x3a852a,'limit':0x1,'order':[[_0x5497('0x32'),_0x5497('0x3f')]]}]},{'model':db[_0x5497('0x40')],'as':'Applications'},{'model':db[_0x5497('0x41')],'as':_0x5497('0x42'),'include':[{'model':db[_0x5497('0x43')],'as':'CloudProvider'}]}]})[_0x5497('0x11')](function(_0x530475){if(_0x530475&&_0x530475[_0x5497('0x3d')]){var _0x31f1ba=_0x530475[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d['account']=_[_0x5497('0x45')](_0x31f1ba,[_0x5497('0x46'),'List']);_0x3e5f7d[_0x5497('0x3b')]['smtpOptions']=_0x530475[_0x5497('0x2a')]();_0x3e5f7d['applications']=_0x31f1ba[_0x5497('0x46')];_0x3e5f7d[_0x5497('0x47')]=_0x31f1ba[_0x5497('0x3d')];_0x3e5f7d[_0x5497('0x48')]=_[_0x5497('0x49')](_0x3e5f7d[_0x5497('0x48')],[_0x5497('0x4a')],[_0x5497('0x4b')]);if(_0x3e5f7d['account']&&_0x3e5f7d[_0x5497('0x3b')]['autoclose']){_0x3e5f7d['applications'][_0x5497('0x4c')]({'id':0x0,'priority':_0x3e5f7d[_0x5497('0x48')]['length']+0x1,'app':_0x5497('0x4d'),'appdata':_0x5497('0x4e'),'interval':_0x5497('0x4f')});}if(_0x3e5f7d[_0x5497('0x3b')]['Applications']){delete _0x3e5f7d[_0x5497('0x3b')]['Applications'];}if(_0x3e5f7d['account'][_0x5497('0x3d')]){delete _0x3e5f7d[_0x5497('0x3b')][_0x5497('0x3d')];}if(_0x31f1ba['List']['Contacts'][_0x5497('0x50')]){return _0x31f1ba['List'][_0x5497('0x3e')][0x0];}var _0x530431=_[_0x5497('0xb')](_0x15029d['body'],{'firstName':_0x15029d[_0x5497('0x2c')][_0x5497('0x36')],'ListId':_0x31f1ba['ListId']});_0x530431[_0x15029d[_0x5497('0x2c')]['mapKey']]=_0x15029d['body'][_0x5497('0x36')];return db[_0x5497('0x30')]['create'](_0x530431);}else{throw new Error(_0x5497('0x51'));}})[_0x5497('0x11')](function(_0x1dbab2){_0x3e5f7d[_0x5497('0x52')]=_0x1dbab2;if(_0x1dbab2){if(!_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId']){_0x15029d[_0x5497('0x2c')]['message']['messageId']=rs['generate']()+'\x20'+_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')];}var _0x544085={'ContactId':_0x1dbab2['id'],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'inReplyTo':_0x15029d['body']['message'][_0x5497('0x53')],'to':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['attach'],'lastMsgAt':moment()[_0x5497('0x55')](_0x5497('0x56')),'lastMsgDirection':'in'};return db[_0x5497('0x57')][_0x5497('0x27')]({'where':{'closed':![],'MailAccountId':_0x15029d['account']['id']},'include':[{'model':db[_0x5497('0x58')],'as':_0x5497('0x59'),'attributes':[_0x5497('0x53')],'where':{'messageId':_0x15029d['body'][_0x5497('0x19')]['inReplyTo']}}]})['then'](function(_0x53e050){if(_0x53e050){return[_0x53e050,![]];}return db[_0x5497('0x57')][_0x5497('0x5a')](_0x544085)[_0x5497('0x11')](function(_0x4e7d4c){return[_0x4e7d4c,!![]];});});}else{throw new Error(_0x5497('0x5b'));}})[_0x5497('0x5c')](function(_0x3cfebc,_0x35e75a){if(_0x3cfebc){_0x20e947=_0x35e75a;if(!_0x35e75a){return _0x3cfebc['update']({'inReplyTo':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x53')],'to':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x36')],'cc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x54')],'attach':_0x3cfebc['attach']?_0x3cfebc[_0x5497('0x5d')]:_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x5497('0x56')),'lastMsgDirection':'in'});}else{return _0x3cfebc;}}})[_0x5497('0x11')](function(_0x179bbc){_0x3e5f7d['interaction']=_0x179bbc[_0x5497('0x44')]({'plain':!![]});_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x5f')]=_0x20e947;return db[_0x5497('0x58')][_0x5497('0x5a')]({'body':_0x15029d[_0x5497('0x2c')][_0x5497('0x2c')],'MailAccountId':_0x15029d[_0x5497('0x3b')]['id'],'MailInteractionId':_0x179bbc['id'],'direction':'in','ContactId':_0x3e5f7d[_0x5497('0x52')]['id'],'messageId':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['messageId'],'from':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x36')],'to':_0x15029d['body'][_0x5497('0x19')]['to'],'cc':_0x15029d['body'][_0x5497('0x19')]['cc'],'subject':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x54')],'attach':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x5d')],'Attachments':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x60')],'originTo':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x61')],'originCc':_0x15029d[_0x5497('0x2c')]['message'][_0x5497('0x62')],'bcc':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')]['bcc'],'ChatWebsiteId':_0x15029d['body'][_0x5497('0x19')][_0x5497('0x63')]||null,'originChannel':_0x15029d[_0x5497('0x2c')][_0x5497('0x19')][_0x5497('0x64')]||_0x5497('0x65'),'ChatOfflineMessageId':_0x15029d[_0x5497('0x2c')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x5497('0x66')],'as':_0x5497('0x67')}]});})['then'](function(_0x15ca59){_0x3e5f7d[_0x5497('0x19')]=_0x15ca59;if(_0x3e5f7d[_0x5497('0x5e')]['UserId']){return db[_0x5497('0x68')][_0x5497('0x27')]({'attributes':['id','name'],'where':{'id':_0x3e5f7d[_0x5497('0x5e')][_0x5497('0x69')]}})[_0x5497('0x11')](function(_0x42d745){if(_0x42d745){_0x3e5f7d[_0x5497('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5497('0x6a'),'appdata':_0x42d745[_0x5497('0x6b')]+','+(_0x3e5f7d[_0x5497('0x3b')][_0x5497('0x6c')]||0xa),'interval':_0x5497('0x4f')});}return respondWithRpcPromise('Start',_0x5497('0x6d'),_0x3e5f7d);});}return respondWithRpcPromise(_0x5497('0x6e'),_0x5497('0x6d'),_0x3e5f7d);})[_0x5497('0x11')](function(_0x521d74){_0x4299be(_0x521d74);})[_0x5497('0x1a')](function(_0x21fc4e){_0x59ed13(_0xa5ebe6['error'](0x1f4,_0x21fc4e[_0x5497('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 85016c7..8bc9e12 100644 --- a/server/api/mailAccount/mailAccount.socket.js +++ b/server/api/mailAccount/mailAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8eba=['save','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0xb63c5b,_0x2d4a23){var _0x15479f=function(_0x33eb05){while(--_0x33eb05){_0xb63c5b['push'](_0xb63c5b['shift']());}};_0x15479f(++_0x2d4a23);}(_0x8eba,0xc3));var _0xa8eb=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x8eba[_0x46efd7];return _0x5637e4;};'use strict';var MailAccountEvents=require(_0xa8eb('0x0'));var events=[_0xa8eb('0x1'),'remove','update'];function createListener(_0x4b3a3e,_0x3894f8){return function(_0x322799){_0x3894f8[_0xa8eb('0x2')](_0x4b3a3e,_0x322799);};}function removeListener(_0x2cdf40,_0x52533a){return function(){MailAccountEvents[_0xa8eb('0x3')](_0x2cdf40,_0x52533a);};}exports[_0xa8eb('0x4')]=function(_0x5abab9){for(var _0x321f2f=0x0,_0x5ece80=events[_0xa8eb('0x5')];_0x321f2f<_0x5ece80;_0x321f2f++){var _0x225307=events[_0x321f2f];var _0x509b54=createListener(_0xa8eb('0x6')+_0x225307,_0x5abab9);MailAccountEvents['on'](_0x225307,_0x509b54);}}; \ No newline at end of file +var _0xaada=['emit','register','mailAccount:','./mailAccount.events','remove','update'];(function(_0x364504,_0x408a9a){var _0x2bd1cb=function(_0x4991f4){while(--_0x4991f4){_0x364504['push'](_0x364504['shift']());}};_0x2bd1cb(++_0x408a9a);}(_0xaada,0x1d7));var _0xaaad=function(_0x3524b4,_0x144e7b){_0x3524b4=_0x3524b4-0x0;var _0x15c122=_0xaada[_0x3524b4];return _0x15c122;};'use strict';var MailAccountEvents=require(_0xaaad('0x0'));var events=['save',_0xaaad('0x1'),_0xaaad('0x2')];function createListener(_0x3cd189,_0x2193e4){return function(_0x372b7c){_0x2193e4[_0xaaad('0x3')](_0x3cd189,_0x372b7c);};}function removeListener(_0x4e1847,_0x143fe9){return function(){MailAccountEvents['removeListener'](_0x4e1847,_0x143fe9);};}exports[_0xaaad('0x4')]=function(_0x1d2c2c){for(var _0x5b46f9=0x0,_0x228ed7=events['length'];_0x5b46f9<_0x228ed7;_0x5b46f9++){var _0x2712fd=events[_0x5b46f9];var _0x49e817=createListener(_0xaaad('0x5')+_0x2712fd,_0x1d2c2c);MailAccountEvents['on'](_0x2712fd,_0x49e817);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fc46560..825da82 100644 --- a/server/api/mailApplication/index.js +++ b/server/api/mailApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc35b=['put','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','show'];(function(_0x111c6c,_0x5ac573){var _0x2e983a=function(_0x2c0d8f){while(--_0x2c0d8f){_0x111c6c['push'](_0x111c6c['shift']());}};_0x2e983a(++_0x5ac573);}(_0xc35b,0xb9));var _0xbc35=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xc35b[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0xbc35('0x0'));var util=require(_0xbc35('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc35('0x2'));var router=express[_0xbc35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbc35('0x4'));var interaction=require(_0xbc35('0x5'));var config=require('../../config/environment');var controller=require(_0xbc35('0x6'));router[_0xbc35('0x7')]('/:id',auth[_0xbc35('0x8')](),controller[_0xbc35('0x9')]);router[_0xbc35('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xbc35('0xb')](_0xbc35('0xc'),auth['isAuthenticated'](),controller[_0xbc35('0xd')]);module[_0xbc35('0xe')]=router; \ No newline at end of file +var _0x3b32=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3b32,0x153));var _0x23b3=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x3b32[_0x2aec52];return _0x3b8835;};'use strict';var multer=require(_0x23b3('0x0'));var util=require(_0x23b3('0x1'));var path=require('path');var timeout=require(_0x23b3('0x2'));var express=require(_0x23b3('0x3'));var router=express[_0x23b3('0x4')]();var fs_extra=require(_0x23b3('0x5'));var auth=require(_0x23b3('0x6'));var interaction=require(_0x23b3('0x7'));var config=require(_0x23b3('0x8'));var controller=require(_0x23b3('0x9'));router[_0x23b3('0xa')]('/:id',auth[_0x23b3('0xb')](),controller[_0x23b3('0xc')]);router[_0x23b3('0xd')]('/:id',auth[_0x23b3('0xb')](),controller[_0x23b3('0xe')]);router[_0x23b3('0xf')](_0x23b3('0x10'),auth[_0x23b3('0xb')](),controller[_0x23b3('0x11')]);module[_0x23b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 38b45e6..3ae6bfc 100644 --- a/server/api/mailApplication/mailApplication.attributes.js +++ b/server/api/mailApplication/mailApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e16=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e16,0x1b5));var _0x67e1=function(_0x400525,_0x3cde57){_0x400525=_0x400525-0x0;var _0x1cc5e5=_0x7e16[_0x400525];return _0x1cc5e5;};'use strict';var Sequelize=require(_0x67e1('0x0'));module['exports']={'priority':{'type':Sequelize[_0x67e1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x67e1('0x2')],'allowNull':![],'defaultValue':_0x67e1('0x3')},'appdata':{'type':Sequelize[_0x67e1('0x4')]()},'description':{'type':Sequelize[_0x67e1('0x2')]},'interval':{'type':Sequelize[_0x67e1('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x20dd=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0xbc0a15,_0x2a0f29){var _0x4bcfed=function(_0x8a4ccf){while(--_0x8a4ccf){_0xbc0a15['push'](_0xbc0a15['shift']());}};_0x4bcfed(++_0x2a0f29);}(_0x20dd,0xc8));var _0xd20d=function(_0x46a236,_0x1384e4){_0x46a236=_0x46a236-0x0;var _0x1f42b4=_0x20dd[_0x46a236];return _0x1f42b4;};'use strict';var Sequelize=require(_0xd20d('0x0'));module[_0xd20d('0x1')]={'priority':{'type':Sequelize[_0xd20d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd20d('0x3')],'allowNull':![],'defaultValue':_0xd20d('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd20d('0x3')]},'interval':{'type':Sequelize[_0xd20d('0x3')],'defaultValue':_0xd20d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e2cd3af..dff8c28 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x309879,_0x29f94a){var _0x480e63=function(_0x8ec1b0){while(--_0x8ec1b0){_0x309879['push'](_0x309879['shift']());}};_0x480e63(++_0x29f94a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x38e9aa,_0x2a8545){_0x38e9aa=_0x38e9aa-0x0;var _0x30122e=_0x9bde[_0x38e9aa];return _0x30122e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x3a4203,_0xa6ff2e){var _0x1a5661=function(_0x584f45){while(--_0x584f45){_0x3a4203['push'](_0x3a4203['shift']());}};_0x1a5661(++_0xa6ff2e);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9c8e81b..58c51f1 100644 --- a/server/api/mailApplication/mailApplication.model.js +++ b/server/api/mailApplication/mailApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7cd=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x461930,_0x329a2a){var _0x382394=function(_0x58a6c5){while(--_0x58a6c5){_0x461930['push'](_0x461930['shift']());}};_0x382394(++_0x329a2a);}(_0xd7cd,0x188));var _0xdd7c=function(_0x225084,_0x51508b){_0x225084=_0x225084-0x0;var _0x5d3376=_0xd7cd[_0x225084];return _0x5d3376;};'use strict';var _=require(_0xdd7c('0x0'));var util=require('util');var logger=require(_0xdd7c('0x1'))(_0xdd7c('0x2'));var moment=require('moment');var BPromise=require(_0xdd7c('0x3'));var rp=require(_0xdd7c('0x4'));var fs=require('fs');var path=require(_0xdd7c('0x5'));var rimraf=require(_0xdd7c('0x6'));var config=require(_0xdd7c('0x7'));var attributes=require(_0xdd7c('0x8'));module[_0xdd7c('0x9')]=function(_0x3576d3,_0x143ed9){return _0x3576d3[_0xdd7c('0xa')](_0xdd7c('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd7c('0xc'),'collate':_0xdd7c('0xd')});}; \ No newline at end of file +var _0xb343=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise'];(function(_0x54d864,_0x1cbc4e){var _0x434e38=function(_0x2da2e2){while(--_0x2da2e2){_0x54d864['push'](_0x54d864['shift']());}};_0x434e38(++_0x1cbc4e);}(_0xb343,0x80));var _0x3b34=function(_0xf863e2,_0x4c6171){_0xf863e2=_0xf863e2-0x0;var _0x3f252d=_0xb343[_0xf863e2];return _0x3f252d;};'use strict';var _=require(_0x3b34('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3b34('0x1'));var BPromise=require(_0x3b34('0x2'));var rp=require(_0x3b34('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b34('0x4'));var attributes=require(_0x3b34('0x5'));module[_0x3b34('0x6')]=function(_0x21ee8f,_0x5ae3a9){return _0x21ee8f[_0x3b34('0x7')](_0x3b34('0x8'),attributes,{'tableName':_0x3b34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3b34('0xa'),'collate':_0x3b34('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 50f9d62..b60426b 100644 --- a/server/api/mailApplication/mailApplication.rpc.js +++ b/server/api/mailApplication/mailApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea42=['result','catch','MailApplication','update','body','options','where','attributes','limit','then','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','MailApplication,\x20%s,\x20%s','message'];(function(_0x55d1cc,_0x2e82a4){var _0x2d9901=function(_0x1de8fa){while(--_0x1de8fa){_0x55d1cc['push'](_0x55d1cc['shift']());}};_0x2d9901(++_0x2e82a4);}(_0xea42,0xc5));var _0x2ea4=function(_0xdd286a,_0x1a45aa){_0xdd286a=_0xdd286a-0x0;var _0x4f65c4=_0xea42[_0xdd286a];return _0x4f65c4;};'use strict';var _=require(_0x2ea4('0x0'));var util=require('util');var moment=require(_0x2ea4('0x1'));var BPromise=require(_0x2ea4('0x2'));var rs=require(_0x2ea4('0x3'));var fs=require('fs');var Redis=require(_0x2ea4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ea4('0x5'));var logger=require(_0x2ea4('0x6'))('rpc');var config=require(_0x2ea4('0x7'));var jayson=require(_0x2ea4('0x8'));var client=jayson[_0x2ea4('0x9')][_0x2ea4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c1b33,_0x5cd71e,_0x1669fc){return new BPromise(function(_0x6ca376,_0x27c673){return client[_0x2ea4('0xb')](_0x3c1b33,_0x1669fc)['then'](function(_0x28d402){logger[_0x2ea4('0xc')]('MailApplication,\x20%s,\x20%s',_0x5cd71e,_0x2ea4('0xd'));logger[_0x2ea4('0xe')](_0x2ea4('0xf'),_0x5cd71e,_0x2ea4('0xd'),JSON[_0x2ea4('0x10')](_0x28d402));if(_0x28d402[_0x2ea4('0x11')]){if(_0x28d402[_0x2ea4('0x11')]['code']===0x1f4){logger['error'](_0x2ea4('0x12'),_0x5cd71e,_0x28d402[_0x2ea4('0x11')][_0x2ea4('0x13')]);return _0x27c673(_0x28d402[_0x2ea4('0x11')]['message']);}logger[_0x2ea4('0x11')](_0x2ea4('0x12'),_0x5cd71e,_0x28d402[_0x2ea4('0x11')]['message']);return _0x6ca376(_0x28d402['error']['message']);}else{logger[_0x2ea4('0xc')]('MailApplication,\x20%s,\x20%s',_0x5cd71e,_0x2ea4('0xd'));_0x6ca376(_0x28d402[_0x2ea4('0x14')][_0x2ea4('0x13')]);}})[_0x2ea4('0x15')](function(_0x580418){logger[_0x2ea4('0x11')](_0x2ea4('0x12'),_0x5cd71e,_0x580418);_0x27c673(_0x580418);});});}exports['UpdateMailApplication']=function(_0x144276){var _0x3ca675=this;return new Promise(function(_0x56ae1c,_0x49a126){return db[_0x2ea4('0x16')][_0x2ea4('0x17')](_0x144276[_0x2ea4('0x18')],{'raw':_0x144276['options']?_0x144276['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144276[_0x2ea4('0x19')]?_0x144276['options'][_0x2ea4('0x1a')]||null:null,'attributes':_0x144276['options']?_0x144276[_0x2ea4('0x19')][_0x2ea4('0x1b')]||null:null,'limit':_0x144276[_0x2ea4('0x19')]?_0x144276[_0x2ea4('0x19')][_0x2ea4('0x1c')]||null:null})[_0x2ea4('0x1d')](function(_0x31ee59){logger[_0x2ea4('0xc')]('UpdateMailApplication',_0x144276);logger[_0x2ea4('0xe')](_0x2ea4('0x1e'),_0x144276,JSON[_0x2ea4('0x10')](_0x31ee59));_0x56ae1c(_0x31ee59);})[_0x2ea4('0x15')](function(_0x2428f8){logger[_0x2ea4('0x11')](_0x2ea4('0x1e'),_0x2428f8[_0x2ea4('0x13')],_0x144276);_0x49a126(_0x3ca675[_0x2ea4('0x11')](0x1f4,_0x2428f8[_0x2ea4('0x13')]));});});}; \ No newline at end of file +var _0x26e8=['result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','then','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2b12f7,_0x4033ac){var _0x8cb277=function(_0x713b37){while(--_0x713b37){_0x2b12f7['push'](_0x2b12f7['shift']());}};_0x8cb277(++_0x4033ac);}(_0x26e8,0xdd));var _0x826e=function(_0x1f38c6,_0x428650){_0x1f38c6=_0x1f38c6-0x0;var _0x259367=_0x26e8[_0x1f38c6];return _0x259367;};'use strict';var _=require('lodash');var util=require(_0x826e('0x0'));var moment=require('moment');var BPromise=require(_0x826e('0x1'));var rs=require(_0x826e('0x2'));var fs=require('fs');var Redis=require(_0x826e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x826e('0x4'));var logger=require(_0x826e('0x5'))(_0x826e('0x6'));var config=require(_0x826e('0x7'));var jayson=require(_0x826e('0x8'));var client=jayson[_0x826e('0x9')][_0x826e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d0dc,_0x3e854f,_0x1117ad){return new BPromise(function(_0x48fba5,_0x35b086){return client[_0x826e('0xb')](_0x31d0dc,_0x1117ad)['then'](function(_0x495544){logger[_0x826e('0xc')](_0x826e('0xd'),_0x3e854f,_0x826e('0xe'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x3e854f,_0x826e('0xe'),JSON[_0x826e('0xf')](_0x495544));if(_0x495544[_0x826e('0x10')]){if(_0x495544[_0x826e('0x10')][_0x826e('0x11')]===0x1f4){logger['error'](_0x826e('0xd'),_0x3e854f,_0x495544['error'][_0x826e('0x12')]);return _0x35b086(_0x495544['error'][_0x826e('0x12')]);}logger[_0x826e('0x10')](_0x826e('0xd'),_0x3e854f,_0x495544[_0x826e('0x10')][_0x826e('0x12')]);return _0x48fba5(_0x495544['error']['message']);}else{logger[_0x826e('0xc')]('MailApplication,\x20%s,\x20%s',_0x3e854f,'request\x20sent');_0x48fba5(_0x495544[_0x826e('0x13')]['message']);}})[_0x826e('0x14')](function(_0x251cf1){logger['error'](_0x826e('0xd'),_0x3e854f,_0x251cf1);_0x35b086(_0x251cf1);});});}exports[_0x826e('0x15')]=function(_0x47f5cd){var _0x3940c2=this;return new Promise(function(_0x4695a6,_0x349aaf){return db[_0x826e('0x16')][_0x826e('0x17')](_0x47f5cd[_0x826e('0x18')],{'raw':_0x47f5cd[_0x826e('0x19')]?_0x47f5cd[_0x826e('0x19')][_0x826e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47f5cd[_0x826e('0x19')]?_0x47f5cd['options'][_0x826e('0x1b')]||null:null,'attributes':_0x47f5cd['options']?_0x47f5cd[_0x826e('0x19')][_0x826e('0x1c')]||null:null,'limit':_0x47f5cd[_0x826e('0x19')]?_0x47f5cd[_0x826e('0x19')]['limit']||null:null})[_0x826e('0x1d')](function(_0x314e73){logger[_0x826e('0xc')](_0x826e('0x15'),_0x47f5cd);logger['debug'](_0x826e('0x15'),_0x47f5cd,JSON['stringify'](_0x314e73));_0x4695a6(_0x314e73);})['catch'](function(_0x2735fe){logger[_0x826e('0x10')](_0x826e('0x15'),_0x2735fe[_0x826e('0x12')],_0x47f5cd);_0x349aaf(_0x3940c2[_0x826e('0x10')](0x1f4,_0x2735fe[_0x826e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4de91e7..4d3652a 100644 --- a/server/api/mailInteraction/index.js +++ b/server/api/mailInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd270=['express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','destroy','delete','removeTags','exports'];(function(_0x3ab3bf,_0x19b76c){var _0x47c5d2=function(_0x272062){while(--_0x272062){_0x3ab3bf['push'](_0x3ab3bf['shift']());}};_0x47c5d2(++_0x19b76c);}(_0xd270,0xa8));var _0x0d27=function(_0x3aed72,_0x46eb13){_0x3aed72=_0x3aed72-0x0;var _0x1a84dc=_0xd270[_0x3aed72];return _0x1a84dc;};'use strict';var express=require(_0x0d27('0x0'));var router=express[_0x0d27('0x1')]();var auth=require(_0x0d27('0x2'));var interaction=require(_0x0d27('0x3'));var controller=require(_0x0d27('0x4'));router[_0x0d27('0x5')]('/',auth['isAuthenticated'](),controller[_0x0d27('0x6')]);router[_0x0d27('0x5')](_0x0d27('0x7'),auth[_0x0d27('0x8')](),controller['describe']);router[_0x0d27('0x5')](_0x0d27('0x9'),auth[_0x0d27('0x8')](),controller[_0x0d27('0xa')]);router[_0x0d27('0x5')](_0x0d27('0xb'),auth['isAuthenticated'](),controller[_0x0d27('0xc')]);router[_0x0d27('0x5')]('/:id/download',auth[_0x0d27('0x8')](),controller['download']);router[_0x0d27('0xd')]('/',auth[_0x0d27('0x8')](),controller[_0x0d27('0xe')]);router[_0x0d27('0xd')](_0x0d27('0xb'),auth['isAuthenticated'](),controller[_0x0d27('0xf')]);router['post'](_0x0d27('0x10'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')](_0x0d27('0x12'),_0x0d27('0x13')),controller[_0x0d27('0x14')]);router[_0x0d27('0x15')](_0x0d27('0x9'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')](_0x0d27('0x12'),_0x0d27('0x16')),controller[_0x0d27('0x17')]);router['delete'](_0x0d27('0x9'),auth[_0x0d27('0x8')](),interaction[_0x0d27('0x11')]('mail','mailinteraction:destroy'),controller[_0x0d27('0x18')]);router[_0x0d27('0x19')]('/:id/tags',auth[_0x0d27('0x8')](),controller[_0x0d27('0x1a')]);module[_0x0d27('0x1b')]=router; \ No newline at end of file +var _0x6499=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:destroy','destroy','delete','exports','express'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x6499,0x15d));var _0x9649=function(_0x29027b,_0x454356){_0x29027b=_0x29027b-0x0;var _0x10fe96=_0x6499[_0x29027b];return _0x10fe96;};'use strict';var express=require(_0x9649('0x0'));var router=express[_0x9649('0x1')]();var auth=require(_0x9649('0x2'));var interaction=require(_0x9649('0x3'));var controller=require('./mailInteraction.controller');router[_0x9649('0x4')]('/',auth[_0x9649('0x5')](),controller[_0x9649('0x6')]);router[_0x9649('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x9649('0x7')]);router[_0x9649('0x4')](_0x9649('0x8'),auth[_0x9649('0x5')](),controller['show']);router[_0x9649('0x4')](_0x9649('0x9'),auth['isAuthenticated'](),controller[_0x9649('0xa')]);router[_0x9649('0x4')](_0x9649('0xb'),auth[_0x9649('0x5')](),controller[_0x9649('0xc')]);router[_0x9649('0xd')]('/',auth[_0x9649('0x5')](),controller[_0x9649('0xe')]);router['post']('/:id/messages',auth[_0x9649('0x5')](),controller[_0x9649('0xf')]);router[_0x9649('0xd')](_0x9649('0x10'),auth[_0x9649('0x5')](),interaction[_0x9649('0x11')](_0x9649('0x12'),_0x9649('0x13')),controller[_0x9649('0x14')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x9649('0x11')](_0x9649('0x12'),'mailinteraction:update'),controller['update']);router['delete'](_0x9649('0x8'),auth[_0x9649('0x5')](),interaction[_0x9649('0x11')](_0x9649('0x12'),_0x9649('0x15')),controller[_0x9649('0x16')]);router[_0x9649('0x17')](_0x9649('0x10'),auth[_0x9649('0x5')](),controller['removeTags']);module[_0x9649('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index de3ec9c..51daa91 100644 --- a/server/api/mailInteraction/mailInteraction.attributes.js +++ b/server/api/mailInteraction/mailInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb06c=['BOOLEAN','out','ENUM','iconv','exports','DATE','STRING','TEXT'];(function(_0x4b90b3,_0x164fb2){var _0x45472e=function(_0x4580d3){while(--_0x4580d3){_0x4b90b3['push'](_0x4b90b3['shift']());}};_0x45472e(++_0x164fb2);}(_0xb06c,0x123));var _0xcb06=function(_0x5ecba7,_0x1c881d){_0x5ecba7=_0x5ecba7-0x0;var _0x4a0c4d=_0xb06c[_0x5ecba7];return _0x4a0c4d;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xcb06('0x0'));module[_0xcb06('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcb06('0x2')]},'disposition':{'type':Sequelize[_0xcb06('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xcb06('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xcb06('0x3')](0x1fe)},'to':{'type':Sequelize[_0xcb06('0x3')]},'cc':{'type':Sequelize[_0xcb06('0x4')]('long')},'subject':{'type':Sequelize[_0xcb06('0x4')]()},'attach':{'type':Sequelize[_0xcb06('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcb06('0x2')]},'substatus':{'type':Sequelize[_0xcb06('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xcb06('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xcb06('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xcb06('0x7')]('in',_0xcb06('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xcb06('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x783c=['TEXT','ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x54f606,_0x4b0368){var _0x28a56c=function(_0x151981){while(--_0x151981){_0x54f606['push'](_0x54f606['shift']());}};_0x28a56c(++_0x4b0368);}(_0x783c,0xa5));var _0xc783=function(_0x6f2d52,_0x5cad83){_0x6f2d52=_0x6f2d52-0x0;var _0x4f7ac8=_0x783c[_0x6f2d52];return _0x4f7ac8;};'use strict';var Sequelize=require(_0xc783('0x0'));var iconv=require(_0xc783('0x1'));module[_0xc783('0x2')]={'closed':{'type':Sequelize[_0xc783('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc783('0x4')]},'disposition':{'type':Sequelize[_0xc783('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc783('0x5')]},'note':{'type':Sequelize[_0xc783('0x5')]},'inReplyTo':{'type':Sequelize[_0xc783('0x5')](0x1fe)},'to':{'type':Sequelize[_0xc783('0x5')]},'cc':{'type':Sequelize[_0xc783('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc783('0x4')]},'substatus':{'type':Sequelize[_0xc783('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xc783('0x7')]('in',_0xc783('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc783('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xc783('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ac0fe66..052e82e 100644 --- a/server/api/mailInteraction/mailInteraction.controller.js +++ b/server/api/mailInteraction/mailInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd285=['Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','rows','show','rawAttributes','includeAll','create','body','params','destroy','describe','addMessage','ids','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','inlineCss','true','addTags','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','MailMessage','plainBody','lastMsgText','trimStart','catch','waiting','answered','closed','UserId','talking','unmanaged','total','index','MailInteraction','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','select','field','color','tools_tags','u.id','ui.MailInteractionId','from','mail_interactions','cm_contacts','left_join','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','user','agent','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName'];(function(_0x136492,_0x701cf4){var _0x1f0083=function(_0x3e7b6e){while(--_0x3e7b6e){_0x136492['push'](_0x136492['shift']());}};_0x1f0083(++_0x701cf4);}(_0xd285,0x132));var _0x5d28=function(_0x149a9b,_0x5bb275){_0x149a9b=_0x149a9b-0x0;var _0x2c2bf6=_0xd285[_0x149a9b];return _0x2c2bf6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d28('0x0'));var zipdir=require(_0x5d28('0x1'));var moment=require('moment');var BPromise=require(_0x5d28('0x2'));var util=require(_0x5d28('0x3'));var path=require(_0x5d28('0x4'));var fs=require('fs');var _=require(_0x5d28('0x5'));var squel=require(_0x5d28('0x6'));var juice=require(_0x5d28('0x7'));var Redis=require(_0x5d28('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0x5d28('0x9'));var logger=require(_0x5d28('0xa'))(_0x5d28('0xb'));var config=require(_0x5d28('0xc'));var db=require(_0x5d28('0xd'))['db'];var htmlEntities=require(_0x5d28('0xe'));config[_0x5d28('0xf')]=_[_0x5d28('0x10')](config['redis'],{'host':_0x5d28('0x11'),'port':0x18eb});var socket=require(_0x5d28('0x12'))(new Redis(config[_0x5d28('0xf')]));require('./mailInteraction.socket')[_0x5d28('0x13')](socket);function respondWithStatusCode(_0x2b3578,_0x200917){_0x200917=_0x200917||0xcc;return function(_0x8bd756){if(_0x8bd756){return _0x2b3578[_0x5d28('0x14')](_0x200917);}return _0x2b3578[_0x5d28('0x15')](_0x200917)['end']();};}function respondWithResult(_0x39edde,_0x2975a1){_0x2975a1=_0x2975a1||0xc8;return function(_0x3261e7){if(_0x3261e7){return _0x39edde[_0x5d28('0x15')](_0x2975a1)[_0x5d28('0x16')](_0x3261e7);}};}function respondWithFilteredResult(_0xf11686,_0x40df45){return function(_0x542c2f){if(_0x542c2f){var _0x391275=typeof _0x40df45[_0x5d28('0x17')]===_0x5d28('0x18')&&typeof _0x40df45['limit']==='undefined';var _0x25b027=_0x542c2f[_0x5d28('0x19')];var _0x36c340=_0x391275?0x0:_0x40df45[_0x5d28('0x17')];var _0x5de764=_0x391275?_0x542c2f[_0x5d28('0x19')]:_0x40df45[_0x5d28('0x17')]+_0x40df45['limit'];var _0x1004c0;if(_0x5de764>=_0x25b027){_0x5de764=_0x25b027;_0x1004c0=0xc8;}else{_0x1004c0=0xce;}_0xf11686[_0x5d28('0x15')](_0x1004c0);return _0xf11686[_0x5d28('0x1a')](_0x5d28('0x1b'),_0x36c340+'-'+_0x5de764+'/'+_0x25b027)[_0x5d28('0x16')](_0x542c2f);}return null;};}function saveUpdates(_0x4da5b4){return function(_0x204bcc){if(_0x204bcc){return _0x204bcc[_0x5d28('0x1c')](_0x4da5b4)[_0x5d28('0x1d')](function(_0x140aee){return _0x140aee;});}return null;};}function removeEntity(_0x44d8c9){return function(_0x12e0f0){if(_0x12e0f0){return _0x12e0f0['destroy']()[_0x5d28('0x1d')](function(){_0x44d8c9[_0x5d28('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bcefd){return function(_0x7041c7){if(!_0x7041c7){_0x1bcefd[_0x5d28('0x14')](0x194);}return _0x7041c7;};}function handleError(_0x5cad4c,_0x1d800b){_0x1d800b=_0x1d800b||0x1f4;return function(_0x283684){logger[_0x5d28('0x1e')](_0x283684[_0x5d28('0x1f')]);if(_0x283684[_0x5d28('0x20')]){delete _0x283684[_0x5d28('0x20')];}_0x5cad4c[_0x5d28('0x15')](_0x1d800b)['send'](_0x283684);};}function getInteractionUsers(_0x5ca889,_0x4edd6d){return new BPromise(function(_0x45f839,_0x2f0688){try{if(_0x4edd6d[_0x5ca889['id']]){_0x5ca889[_0x5d28('0x21')]=_[_0x5d28('0x22')](_0x4edd6d[_0x5ca889['id']],function(_0x274304){return{'id':_0x274304['id'],'fullname':_0x274304['fullname']};});}}catch(_0x210205){_0x2f0688(_0x210205);}_0x45f839(_0x5ca889);});}function getInteractionTags(_0x5ee390,_0x24a085){return new BPromise(function(_0x6db7ce,_0x3cd318){try{if(_0x5ee390[_0x5d28('0x23')]){_0x5ee390[_0x5d28('0x24')]=[];_0x5ee390[_0x5d28('0x23')][_0x5d28('0x25')](',')[_0x5d28('0x26')](function(_0x1ccc81){_0x5ee390['Tags'][_0x5d28('0x27')](_0x24a085[_0x1ccc81]);});}delete _0x5ee390[_0x5d28('0x23')];}catch(_0xfc5c98){_0x3cd318(_0xfc5c98);}_0x6db7ce(_0x5ee390);});}function getLastMessageText(_0x47a877){return new BPromise(function(_0x561570,_0x5ad123){return db[_0x5d28('0x28')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x47a877['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})['then'](function(_0x48347a){if(_0x48347a&&_0x48347a[_0x5d28('0x29')]){_0x47a877[_0x5d28('0x2a')]=_[_0x5d28('0x2b')](_0x48347a['plainBody']);}_0x561570(_0x47a877);})[_0x5d28('0x2c')](function(_0x81bfdb){_0x5ad123(_0x81bfdb);});});}function updateMailInteraction(_0x51d2b1,_0x49eef3,_0x144c61,_0x553189){return new BPromise(function(_0x322e90,_0x2f119d){return getInteractionUsers(_0x51d2b1,_0x144c61)['then'](function(_0x21e939){return getInteractionTags(_0x21e939,_0x49eef3);})[_0x5d28('0x1d')](function(_0x1a0db9){return getStateInteraction(_0x1a0db9);})[_0x5d28('0x1d')](function(_0x5cb06a){if(_0x553189){_0x322e90(getLastMessageText(_0x5cb06a));}else{_0x322e90(_0x5cb06a);}})[_0x5d28('0x2c')](function(_0x1302d5){_0x2f119d(_0x1302d5);});});}function getStateInteraction(_0x49ba54){return new BPromise(function(_0x23bdd2){_0x49ba54[_0x5d28('0x2d')]=0x0;_0x49ba54['talking']=0x0;_0x49ba54[_0x5d28('0x2e')]=0x0;_0x49ba54['unmanaged']=0x0;_0x49ba54['total']=0x0;if(!_0x49ba54[_0x5d28('0x2f')]&&!_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x2d')]+=0x1;}if(!_0x49ba54[_0x5d28('0x2f')]&&_0x49ba54[_0x5d28('0x30')]){_0x49ba54['talking']+=0x1;if(_0x49ba54[_0x5d28('0x2d')]){_0x49ba54['waiting']-=0x1;}}if(_0x49ba54[_0x5d28('0x2f')]&&_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x2e')]+=0x1;if(_0x49ba54[_0x5d28('0x31')]){_0x49ba54[_0x5d28('0x31')]-=0x1;}}if(_0x49ba54[_0x5d28('0x2f')]&&!_0x49ba54[_0x5d28('0x30')]){_0x49ba54[_0x5d28('0x32')]+=0x1;if(_0x49ba54[_0x5d28('0x2d')]){_0x49ba54['waiting']-=0x1;}}_0x49ba54[_0x5d28('0x33')]+=0x1;_0x23bdd2(_0x49ba54);});}exports[_0x5d28('0x34')]=function(_0x5a3eba,_0x2051e3){var _0x111bf5={},_0xddbcfd={},_0x84d11e={'count':0x0,'rows':[]};var _0x1f35a3=_[_0x5d28('0x22')](db[_0x5d28('0x35')]['rawAttributes'],function(_0x22a16f){return{'name':_0x22a16f[_0x5d28('0x36')],'type':_0x22a16f['type'][_0x5d28('0x37')]};});_0xddbcfd['model']=_['map'](_0x1f35a3,'name');_0xddbcfd[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x5a3eba[_0x5d28('0x38')]);_0xddbcfd['filters']=_[_0x5d28('0x3a')](_0xddbcfd[_0x5d28('0x3b')],_0xddbcfd[_0x5d28('0x38')]);_0x111bf5[_0x5d28('0x3c')]=_[_0x5d28('0x3a')](_0xddbcfd[_0x5d28('0x3b')],qs['fields'](_0x5a3eba['query'][_0x5d28('0x3d')]));_0x111bf5[_0x5d28('0x3c')]=_0x111bf5[_0x5d28('0x3c')][_0x5d28('0x3e')]?_0x111bf5[_0x5d28('0x3c')]:_0xddbcfd['model'];if(!_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x3f')]('nolimit')){_0x111bf5[_0x5d28('0x40')]=qs[_0x5d28('0x40')](_0x5a3eba['query'][_0x5d28('0x40')]);_0x111bf5[_0x5d28('0x17')]=qs[_0x5d28('0x17')](_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x17')]);}_0x111bf5[_0x5d28('0x41')]=qs[_0x5d28('0x42')](_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x42')]);_0x111bf5[_0x5d28('0x43')]=qs[_0x5d28('0x44')](_[_0x5d28('0x45')](_0x5a3eba['query'],_0xddbcfd[_0x5d28('0x44')]),_0x1f35a3);var _0x731d1f=[];var _0x550b02=squel[_0x5d28('0x46')]()[_0x5d28('0x47')]('id')[_0x5d28('0x47')](_0x5d28('0x20'))[_0x5d28('0x47')](_0x5d28('0x48'))['from'](_0x5d28('0x49'));var _0x20e808=squel[_0x5d28('0x46')]()['field'](_0x5d28('0x4a'))[_0x5d28('0x47')]('u.fullname')[_0x5d28('0x47')](_0x5d28('0x4b'))[_0x5d28('0x4c')]('user_has_mail_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x21f3d4=squel[_0x5d28('0x46')]()[_0x5d28('0x4c')](_0x5d28('0x4d'),'i')['left_join'](_0x5d28('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5d28('0x4f')]('users','o','o.id\x20=\x20i.UserId')[_0x5d28('0x4f')]('mail_accounts','a',_0x5d28('0x50'))[_0x5d28('0x4f')]('mail_messages','me',_0x5d28('0x51'))['left_join'](_0x5d28('0x52'),'it','it.MailInteractionId\x20=\x20i.id')[_0x5d28('0x4f')](_0x5d28('0x49'),'t',_0x5d28('0x53'));var _0x173674=squel[_0x5d28('0x54')]();var _0x50262b=[];var _0x517dbf=squel['expr']();var _0x210c6d;if(_0x5a3eba['query'][_0x5d28('0x55')]){_0x210c6d=as[_0x5d28('0x56')](_0x5a3eba[_0x5d28('0x38')]['search']);var _0x2eca73=_0x210c6d[_0x5d28('0x57')];for(var _0x3c48e2=0x0;_0x3c48e2<_0x210c6d[_0x5d28('0x58')][_0x5d28('0x3e')];_0x3c48e2++){var _0x3bacc3=_0x210c6d[_0x5d28('0x58')][_0x3c48e2];var _0x1f1267='i';var _0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,[_0x5d28('0x20'),_0x3bacc3['field']]);if(!_0x246d8f){switch(_0x3bacc3[_0x5d28('0x47')]){case _0x5d28('0x5a'):if(_0x3bacc3['value']==0x1){_0x21f3d4[_0x5d28('0x5b')]('`'+_0x3bacc3['field']+'`\x20=\x200');}else{_0x21f3d4[_0x5d28('0x5b')]('`'+_0x3bacc3[_0x5d28('0x47')]+_0x5d28('0x5c'));}break;case'Contact':if(_0x3bacc3[_0x5d28('0x5d')]===_0x5d28('0x5e')){if(_0x3bacc3[_0x5d28('0x5f')][_0x5d28('0x25')]('\x20')[_0x5d28('0x3e')]>0x1){_0x173674[_0x2eca73](_0x5d28('0x60'),qs[_0x5d28('0x61')](_0x3bacc3[_0x5d28('0x5f')]),null);}else{var _0x38511e='%'+_0x3bacc3[_0x5d28('0x5f')]+'%';_0x173674[_0x2eca73](_0x5d28('0x62'),_0x38511e,_0x38511e,_0x38511e);}}else{_0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,[_0x5d28('0x20'),_0x5d28('0x63')]);_0x3bacc3['field']=_0x5d28('0x63');_0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f[_0x5d28('0x65')],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7[_0x5d28('0x66')],_0x37a3e7['value'][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);}break;case _0x5d28('0x69'):var _0x3232f9=_0x3bacc3['value']['split'](',')[_0x5d28('0x22')](function(_0x124117){return Number(_0x124117);});_0x3232f9[_0x5d28('0x26')](function(_0x51b374){_0x517dbf['or'](_0x5d28('0x6a'),'%,'+_0x51b374+',%');});_0x50262b=_[_0x5d28('0x6b')](_0x50262b,_0x3232f9);break;case'User':if(_0x3bacc3[_0x5d28('0x5d')]==='$substring'){_0x173674[_0x2eca73]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3bacc3[_0x5d28('0x5f')]+'%',null);}else{_0x246d8f=_[_0x5d28('0x59')](_0x1f35a3,['name',_0x5d28('0x30')]);_0x3bacc3[_0x5d28('0x47')]=_0x5d28('0x30');_0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f['type'],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7[_0x5d28('0x66')],_0x37a3e7['value'][_0x5d28('0x67')],_0x37a3e7['value'][_0x5d28('0x68')]);}break;case _0x5d28('0x29'):_0x37a3e7=as[_0x5d28('0x64')]('me',null,_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7['text'],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);break;}}else{var _0x37a3e7=as[_0x5d28('0x64')](_0x1f1267,_0x246d8f['type'],_0x3bacc3);_0x173674[_0x2eca73](_0x37a3e7['text'],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x67')],_0x37a3e7[_0x5d28('0x5f')][_0x5d28('0x68')]);}}}else{var _0x503ce1=_(_0x5a3eba[_0x5d28('0x38')])['keys']()[_0x5d28('0x22')](function(_0x5ac919){return _['some'](_0x1f35a3,['name',_0x5ac919])?_0x5ac919:undefined;})[_0x5d28('0x6c')]()[_0x5d28('0x5f')]();if(!_[_0x5d28('0x6d')](_0x503ce1)){_0x503ce1[_0x5d28('0x26')](function(_0x390706){if(_0x390706===_0x5d28('0x6e')){_0x21f3d4[_0x5d28('0x43')](_0x5d28('0x6f'),[][_0x5d28('0x70')](_0x5a3eba[_0x5d28('0x38')][_0x390706]));}else if(_0x390706===_0x5d28('0x71')){var _0x2fbfe6=JSON[_0x5d28('0x72')](_0x5a3eba[_0x5d28('0x38')][_0x390706])['$gte'];var _0x77d415=JSON[_0x5d28('0x72')](_0x5a3eba[_0x5d28('0x38')][_0x390706])[_0x5d28('0x73')];_0x21f3d4['where'](_0x5d28('0x74'),_0x2fbfe6,_0x77d415);}else{if(_0x5a3eba[_0x5d28('0x38')][_0x390706]==='null'){_0x21f3d4[_0x5d28('0x43')]('i.'+_0x390706+'\x20IS\x20NULL');}else{_0x21f3d4['where']('i.'+_0x390706+'\x20=\x20?',_0x5a3eba[_0x5d28('0x38')][_0x390706]);}}});}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x75')]){if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x75')]==0x1){_0x21f3d4['having'](_0x5d28('0x76'));}else{_0x21f3d4[_0x5d28('0x5b')](_0x5d28('0x77'));}}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x78')]){_0x50262b=_[_0x5d28('0x79')](_0x5a3eba['query'][_0x5d28('0x78')])?_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x78')]:new Array(_0x5a3eba[_0x5d28('0x38')]['tag']);_0x50262b[_0x5d28('0x26')](function(_0x552301){_0x517dbf['or'](_0x5d28('0x6a'),'%,'+_0x552301+',%');});}if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x7a')]){var _0x31bda3=_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x7a')][_0x5d28('0x7b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5d28('0x7c')](_0x31bda3)){_0x173674['or'](_0x5d28('0x7d'),_0x31bda3+'%');}else if(qs[_0x5d28('0x7e')](_0x31bda3)){_0x173674['or'](_0x5d28('0x7f'),_0x31bda3+'%');}else{_0x173674['or'](_0x5d28('0x80'),qs['getFullTextValue'](_0x31bda3))['or'](_0x5d28('0x81'),qs[_0x5d28('0x61')](_0x31bda3));}}}_0x21f3d4[_0x5d28('0x43')](_0x173674);_0x21f3d4[_0x5d28('0x82')](_0x5d28('0x83'));var _0x377e1d={'type':db[_0x5d28('0x84')][_0x5d28('0x85')][_0x5d28('0x86')],'raw':!![]};var _0x354729=_0x21f3d4[_0x5d28('0x87')]();_0x354729[_0x5d28('0x47')](_0x5d28('0x83'));_0x354729[_0x5d28('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5d28('0x5a'));if(_0x111bf5[_0x5d28('0x41')]){_0x111bf5[_0x5d28('0x41')][_0x5d28('0x26')](function(_0x47aa4d){var _0x320ed2=_0x47aa4d[0x0]==='contactName'?_0x47aa4d[0x0]:'i.'+_0x47aa4d[0x0];_0x21f3d4[_0x5d28('0x41')](_0x320ed2,_0x47aa4d[0x1]===_0x5d28('0x88')?![]:!![]);});}if(!_[_0x5d28('0x6d')](_0x50262b)){_0x21f3d4['having'](_0x517dbf);_0x354729['where'](_0x5d28('0x89'),_0x50262b);}BPromise[_0x5d28('0x8a')]()['then'](function(){if(!_0x210c6d){if(_0x5a3eba['query'][_0x5d28('0x6e')])return;_0x354729[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x21f3d4[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5a3eba[_0x5d28('0x8b')]['role']!==_0x5d28('0x8c'))return;return _0x5a3eba['user']['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x5d28('0x1d')](function(_0x13a8ac){if(_[_0x5d28('0x6d')](_0x13a8ac)){_0x354729[_0x5d28('0x43')](_0x5d28('0x8d'));_0x21f3d4[_0x5d28('0x43')]('i.MailAccountId\x20IS\x20NULL');}else{_0x354729['where'](_0x5d28('0x6f'),_[_0x5d28('0x22')](_0x13a8ac,'id'));_0x21f3d4[_0x5d28('0x43')](_0x5d28('0x6f'),_['map'](_0x13a8ac,'id'));}});})[_0x5d28('0x1d')](function(){if(_0x5a3eba[_0x5d28('0x8b')][_0x5d28('0x8e')]==='agent'&&!_0x210c6d&&!_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x6e')])return[];return db[_0x5d28('0x8f')]['query'](_0x354729[_0x5d28('0x90')](),_0x377e1d);})[_0x5d28('0x1d')](function(_0x33adba){_0x84d11e['count']=_0x33adba[_0x5d28('0x3e')];if(_0x84d11e['count']===0x0)return[];return db['sequelize'][_0x5d28('0x38')](_0x550b02[_0x5d28('0x90')](),_0x377e1d)[_0x5d28('0x1d')](function(_0x146b34){_0x731d1f=_[_0x5d28('0x91')](_0x146b34,'id');_0x377e1d=_[_0x5d28('0x92')](_0x377e1d,{'model':db[_0x5d28('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a3eba[_0x5d28('0x38')][_0x5d28('0x3d')]){_0x111bf5[_0x5d28('0x3c')][_0x5d28('0x26')](function(_0x1761f6){_0x21f3d4['field']('i.'+_0x1761f6);});}else{_0x21f3d4['field'](_0x5d28('0x93'),_0x5d28('0x5a'));_0x21f3d4['field'](_0x5d28('0x94'),'Account.key');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x95'),_0x5d28('0x96'));_0x21f3d4['field'](_0x5d28('0x97'),_0x5d28('0x98'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x99'),_0x5d28('0x9a'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x83'));_0x21f3d4['field'](_0x5d28('0x9b'));_0x21f3d4[_0x5d28('0x47')]('i.updatedAt');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9c'));_0x21f3d4[_0x5d28('0x47')]('i.closedAt');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9d'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9e'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0x9f'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa0'));_0x21f3d4['field']('i.disposition');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa1'));_0x21f3d4['field'](_0x5d28('0xa2'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa3'));_0x21f3d4['field']('i.to');_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa4'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa5'));_0x21f3d4['field'](_0x5d28('0xa6'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa7'),_0x5d28('0xa8'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xa9'),_0x5d28('0xaa'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xab'),_0x5d28('0xac'));_0x21f3d4['field'](_0x5d28('0xad'),_0x5d28('0xae'));_0x21f3d4['field']('c.mobile',_0x5d28('0xaf'));_0x21f3d4[_0x5d28('0x47')]('c.fax',_0x5d28('0xb0'));_0x21f3d4[_0x5d28('0x47')]('o.fullname',_0x5d28('0xb1'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xb2'),_0x5d28('0xb3'));_0x21f3d4[_0x5d28('0x47')](_0x5d28('0xb4'),'TagIds');}if(_0x111bf5[_0x5d28('0x40')])_0x21f3d4[_0x5d28('0x40')](_0x111bf5[_0x5d28('0x40')]);if(_0x111bf5[_0x5d28('0x17')])_0x21f3d4[_0x5d28('0x17')](_0x111bf5[_0x5d28('0x17')]);return db['sequelize'][_0x5d28('0x38')](_0x21f3d4[_0x5d28('0x90')](),_0x377e1d);})[_0x5d28('0x1d')](function(_0x4937a6){if(_0x4937a6[_0x5d28('0x3e')]>0x0)_0x20e808[_0x5d28('0x43')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x4937a6,'id'));return db['sequelize'][_0x5d28('0x38')](_0x20e808['toString'](),_0x377e1d)['then'](function(_0x423d0c){var _0x550c3b=_[_0x5d28('0xb5')](_0x423d0c,_0x5d28('0xb6'));var _0x20114d=[];return db[_0x5d28('0xb7')][_0x5d28('0xb8')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x5d28('0x1d')](function(_0xb568b8){var _0x284c3e=_0xb568b8[_0x5d28('0xb9')];_0x4937a6['forEach'](function(_0x21a233){_0x20114d[_0x5d28('0x27')](updateMailInteraction(_0x21a233,_0x731d1f,_0x550c3b,_0x284c3e));});return BPromise[_0x5d28('0xba')](_0x20114d);});});});})[_0x5d28('0x1d')](function(_0x4de2e3){_0x84d11e[_0x5d28('0xbb')]=_0x4de2e3;return _0x84d11e;})[_0x5d28('0x1d')](respondWithFilteredResult(_0x2051e3,_0x111bf5))['catch'](handleError(_0x2051e3,null));};exports[_0x5d28('0xbc')]=function(_0x594885,_0x40699f){var _0x76653c={'raw':![],'where':{'id':_0x594885['params']['id']}},_0xb22651={};_0xb22651[_0x5d28('0x3b')]=_[_0x5d28('0x39')](db[_0x5d28('0x35')][_0x5d28('0xbd')]);_0xb22651[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x594885[_0x5d28('0x38')]);_0xb22651[_0x5d28('0x44')]=_[_0x5d28('0x3a')](_0xb22651[_0x5d28('0x3b')],_0xb22651[_0x5d28('0x38')]);_0x76653c[_0x5d28('0x3c')]=_['intersection'](_0xb22651[_0x5d28('0x3b')],qs[_0x5d28('0x3d')](_0x594885[_0x5d28('0x38')]['fields']));_0x76653c[_0x5d28('0x3c')]=_0x76653c['attributes'][_0x5d28('0x3e')]?_0x76653c[_0x5d28('0x3c')]:_0xb22651[_0x5d28('0x3b')];if(_0x594885[_0x5d28('0x38')][_0x5d28('0xbe')]){_0x76653c['include']=[{'all':!![]}];}_0x76653c=_['merge']({},_0x76653c,_0x594885['options']);return db[_0x5d28('0x35')][_0x5d28('0x59')](_0x76653c)['then'](handleEntityNotFound(_0x40699f,null))['then'](respondWithResult(_0x40699f,null))['catch'](handleError(_0x40699f,null));};exports['create']=function(_0xc8cd90,_0x456312){return db[_0x5d28('0x35')][_0x5d28('0xbf')](_0xc8cd90[_0x5d28('0xc0')],{})[_0x5d28('0x1d')](respondWithResult(_0x456312,0xc9))['catch'](handleError(_0x456312,null));};exports['update']=function(_0x23de44,_0x51c88f){if(_0x23de44['body']['id']){delete _0x23de44[_0x5d28('0xc0')]['id'];}return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x23de44[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x51c88f,null))['then'](saveUpdates(_0x23de44[_0x5d28('0xc0')],null))['then'](respondWithResult(_0x51c88f,null))[_0x5d28('0x2c')](handleError(_0x51c88f,null));};exports[_0x5d28('0xc2')]=function(_0x4726b1,_0x34e473){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x4726b1[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x34e473,null))[_0x5d28('0x1d')](removeEntity(_0x34e473,null))[_0x5d28('0x2c')](handleError(_0x34e473,null));};exports[_0x5d28('0xc3')]=function(_0x3e1f59,_0x2a68c9){return db[_0x5d28('0x35')][_0x5d28('0xc3')]()[_0x5d28('0x1d')](respondWithResult(_0x2a68c9,null))[_0x5d28('0x2c')](handleError(_0x2a68c9,null));};exports[_0x5d28('0xc4')]=function(_0x4f55fd,_0x496e83){return db['MailMessage'][_0x5d28('0x59')]({'where':{'id':_0x4f55fd[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x496e83,null))[_0x5d28('0x1d')](function(_0x503814){if(_0x503814){return _0x503814[_0x5d28('0xc4')](_0x4f55fd[_0x5d28('0xc0')][_0x5d28('0xc5')],_['omit'](_0x4f55fd[_0x5d28('0xc0')],[_0x5d28('0xc5'),'id'])||{});}})[_0x5d28('0x1d')](respondWithResult(_0x496e83,null))[_0x5d28('0x2c')](handleError(_0x496e83,null));};exports['getMessages']=function(_0x350a0a,_0x451063){var _0x34316c={'raw':![],'where':{}};var _0x1b0575={};var _0x468fa6={'count':0x0,'rows':[]};return db[_0x5d28('0x35')][_0x5d28('0xb8')]({'where':{'id':_0x350a0a[_0x5d28('0xc1')]['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x451063,null))[_0x5d28('0x1d')](function(_0x1608f5){if(_0x1608f5){_0x1b0575[_0x5d28('0x3b')]=_[_0x5d28('0x39')](db['MailMessage']['rawAttributes']);_0x1b0575[_0x5d28('0x38')]=_[_0x5d28('0x39')](_0x350a0a[_0x5d28('0x38')]);_0x1b0575['filters']=_[_0x5d28('0x3a')](_0x1b0575[_0x5d28('0x3b')],_0x1b0575[_0x5d28('0x38')]);_0x34316c[_0x5d28('0x3c')]=_[_0x5d28('0x3a')](_0x1b0575['model'],qs[_0x5d28('0x3d')](_0x350a0a['query']['fields']));_0x34316c[_0x5d28('0x3c')]=_0x34316c[_0x5d28('0x3c')][_0x5d28('0x3e')]?_0x34316c[_0x5d28('0x3c')]:_0x1b0575[_0x5d28('0x3b')];if(!_0x350a0a[_0x5d28('0x38')][_0x5d28('0x3f')](_0x5d28('0xc6'))){_0x34316c[_0x5d28('0x40')]=qs[_0x5d28('0x40')](_0x350a0a[_0x5d28('0x38')]['limit']);_0x34316c['offset']=qs[_0x5d28('0x17')](_0x350a0a[_0x5d28('0x38')][_0x5d28('0x17')]);}_0x34316c[_0x5d28('0x41')]=qs[_0x5d28('0x42')](_0x350a0a['query'][_0x5d28('0x42')]);_0x34316c[_0x5d28('0x43')]=qs[_0x5d28('0x44')](_[_0x5d28('0x45')](_0x350a0a[_0x5d28('0x38')],_0x1b0575[_0x5d28('0x44')]));_0x34316c[_0x5d28('0x43')][_0x5d28('0xb6')]=_0x1608f5['id'];if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0x7a')]){_0x34316c['where']=_['merge'](_0x34316c[_0x5d28('0x43')],{'$or':_[_0x5d28('0x22')](_0x34316c[_0x5d28('0x3c')],function(_0x186101){var _0x455b14={};_0x455b14[_0x186101]={'$like':'%'+_0x350a0a[_0x5d28('0x38')][_0x5d28('0x7a')]+'%'};return _0x455b14;})});}if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xc7')]){var _0x316c81=_0x350a0a['query'][_0x5d28('0xc7')][_0x5d28('0x25')](',');var _0x246b41={};_0x246b41[_0x316c81[0x0]]={'$gte':moment(_0x316c81[0x1])['format'](_0x5d28('0xc8'))};_0x34316c[_0x5d28('0x43')]=_[_0x5d28('0x92')](_0x34316c['where'],_0x246b41);}_0x34316c=_['merge']({},_0x34316c,_0x350a0a[_0x5d28('0xc9')]);return db[_0x5d28('0x28')][_0x5d28('0x19')]({'where':_0x34316c[_0x5d28('0x43')]})[_0x5d28('0x1d')](function(_0x21f2cd){_0x468fa6[_0x5d28('0x19')]=_0x21f2cd;if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xbe')]){_0x34316c[_0x5d28('0xca')]=[{'all':!![]}];}return db[_0x5d28('0x28')]['findAll'](_0x34316c);})[_0x5d28('0x1d')](function(_0x73229d){if(_0x350a0a[_0x5d28('0x38')][_0x5d28('0xcb')]===_0x5d28('0xcc')){for(var _0x11ad05=0x0;_0x11ad05<_0x73229d[_0x5d28('0x3e')];_0x11ad05++){_0x73229d[_0x11ad05]['body']=juice(_0x73229d[_0x11ad05][_0x5d28('0xc0')]);}}_0x468fa6[_0x5d28('0xbb')]=_0x73229d;return _0x468fa6;});}})['then'](respondWithFilteredResult(_0x451063,_0x34316c))[_0x5d28('0x2c')](handleError(_0x451063,null));};exports[_0x5d28('0xcd')]=function(_0x13a23b,_0x55a64b){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x13a23b['params']['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x55a64b,null))[_0x5d28('0x1d')](function(_0x1af2bc){if(_0x1af2bc){return _0x1af2bc[_0x5d28('0xce')](_0x13a23b[_0x5d28('0xc0')][_0x5d28('0xc5')],_[_0x5d28('0xcf')](_0x13a23b[_0x5d28('0xc0')],[_0x5d28('0xc5'),'id'])||{})[_0x5d28('0xd0')](function(){return db[_0x5d28('0x69')]['findAll']({'attributes':['id',_0x5d28('0x20'),'color'],'where':{'id':_0x13a23b[_0x5d28('0xc0')][_0x5d28('0xc5')]}});})[_0x5d28('0x1d')](function(_0x28bef8){socket[_0x5d28('0xd1')](_0x5d28('0xd2'),{'id':Number(_0x13a23b[_0x5d28('0xc1')]['id']),'tags':_0x28bef8||[]});return{'id':Number(_0x13a23b[_0x5d28('0xc1')]['id']),'tags':_0x28bef8||[]};});}})['then'](respondWithResult(_0x55a64b,null))['catch'](handleError(_0x55a64b,null));};exports[_0x5d28('0xd3')]=function(_0x43a304,_0x50cd44){return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x43a304['params']['id']}})[_0x5d28('0x1d')](handleEntityNotFound(_0x50cd44,null))[_0x5d28('0x1d')](function(_0x5e7fa6){if(_0x5e7fa6){return _0x5e7fa6['removeTags'](_0x43a304['query']['ids']);}})['then'](respondWithStatusCode(_0x50cd44,null))[_0x5d28('0x2c')](handleError(_0x50cd44,null));};exports[_0x5d28('0xd4')]=function(_0x577df2,_0x28f1a5){var _0x4cd2d9=moment()[_0x5d28('0xd5')]()[_0x5d28('0x90')]();var _0x412309=path[_0x5d28('0xd6')](config[_0x5d28('0xd7')],_0x5d28('0xd8'),_0x5d28('0xd9'),_0x5d28('0xda'));var _0x31d843=path['join'](config['root'],'server',_0x5d28('0xd9'),_0x5d28('0xdb'));var _0x37808b=path[_0x5d28('0xd6')](_0x412309,_0x4cd2d9);var _0x1b161b=util[_0x5d28('0xdc')](_0x5d28('0xdd'),_0x577df2[_0x5d28('0xc1')]['id'],_0x4cd2d9);var _0x3ad413=path[_0x5d28('0xd6')](_0x412309,_0x1b161b);var _0x549ce0=[];if(_0x577df2[_0x5d28('0x38')][_0x5d28('0xdb')]){_0x549ce0[_0x5d28('0x27')]({'model':db['Attachment'],'as':_0x5d28('0xde'),'raw':!![]});}var _0x94a664=[{'model':db[_0x5d28('0x28')],'as':_0x5d28('0xdf'),'attributes':['id',_0x5d28('0xc0'),_0x5d28('0x4c'),'to','cc',_0x5d28('0xe0'),_0x5d28('0xe1'),_0x5d28('0x71')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x549ce0}];return db[_0x5d28('0x35')][_0x5d28('0x59')]({'where':{'id':_0x577df2[_0x5d28('0xc1')]['id']},'include':_0x94a664})[_0x5d28('0x1d')](handleEntityNotFound(_0x28f1a5,null))[_0x5d28('0x1d')](function(_0x335b11){if(_0x335b11&&_0x335b11[_0x5d28('0xdf')]){var _0x54c7c8=_0x335b11[_0x5d28('0xe2')]({'plain':!![]});fs[_0x5d28('0xe3')](_0x37808b);return BPromise[_0x5d28('0xe4')](_0x54c7c8[_0x5d28('0xdf')],function(_0x4f79ea,_0x371a22){var _0x5cb08a={'from':_0x4f79ea[_0x5d28('0x4c')],'to':_0x4f79ea['to'],'subject':_0x4f79ea['subject'],'html':htmlEntities[_0x5d28('0xe5')](_0x4f79ea[_0x5d28('0xc0')]),'headers':{'Date':moment(_0x4f79ea[_0x5d28('0x71')])['format'](_0x5d28('0xe6'))},'attachments':[]};if(_0x4f79ea['cc']){_0x5cb08a[_0x5d28('0xe7')]['Cc']=_0x4f79ea['cc'];}if(_0x4f79ea[_0x5d28('0xe0')]){_0x5cb08a['headers']['Bcc']=_0x4f79ea[_0x5d28('0xe0')];}return new BPromise(function(_0x69ddbc,_0x40a08e){if(_0x4f79ea[_0x5d28('0xde')]){for(var _0x16bb3e=0x0;_0x16bb3e<_0x4f79ea[_0x5d28('0xde')][_0x5d28('0x3e')];_0x16bb3e++){var _0x468fa9=_0x4f79ea['Attachments'][_0x16bb3e];var _0x8057c=path[_0x5d28('0xd6')](_0x31d843,_0x468fa9[_0x5d28('0xe8')]);if(fs[_0x5d28('0xe9')](_0x8057c)){_0x5cb08a[_0x5d28('0xdb')]['push']({'name':_0x468fa9[_0x5d28('0x20')],'contentType':_0x468fa9['type'],'data':fs[_0x5d28('0xea')](_0x8057c)});}}}emlformat[_0x5d28('0xeb')](_0x5cb08a,function(_0x14b3fc,_0x516ee0){if(_0x14b3fc)return _0x40a08e(_0x14b3fc);fs['writeFileSync'](path[_0x5d28('0xd6')](_0x37808b,util[_0x5d28('0xdc')]('message%d.eml',_0x371a22)),_0x516ee0);return _0x69ddbc(_0x516ee0);});});})[_0x5d28('0x1d')](function(){return new BPromise(function(_0x1d6b0c,_0x1e9979){zipdir(_0x37808b,{'saveTo':_0x3ad413},function(_0x2bc581,_0x2c4d8b){if(_0x2bc581)return _0x1e9979(_0x2bc581);return _0x1d6b0c(_0x2c4d8b);});})[_0x5d28('0x1d')](function(){return new BPromise(function(_0x50e19d,_0xa78fe2){rimraf(_0x37808b,function(_0x4e4b8d){if(_0x4e4b8d)_0xa78fe2(_0x4e4b8d);return _0x50e19d();});});})['then'](function(){return _0x28f1a5['download'](_0x3ad413,_0x1b161b,function(_0x5068c4){if(!_0x5068c4)fs[_0x5d28('0xec')](_0x3ad413);});});});}else{return _0x28f1a5[_0x5d28('0x14')](0xc8);}})[_0x5d28('0x2c')](handleError(_0x28f1a5,null));}; \ No newline at end of file +var _0x374a=['c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','findOne','enableEmailPreview','params','keys','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','inlineCss','rows','addTags','setTags','spread','color','emit','mailInteractionTags:save','removeTags','download','join','root','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','bluebird','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','error','name','send','fullname','Tags','TagIds','split','forEach','push','MailMessage','out','plainBody','-id','trimStart','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','user','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.secondDisposition','i.thirdDisposition','i.substatus','c.firstName','Contact.firstName'];(function(_0x4618a9,_0xc808ec){var _0x8213cf=function(_0x3e4643){while(--_0x3e4643){_0x4618a9['push'](_0x4618a9['shift']());}};_0x8213cf(++_0xc808ec);}(_0x374a,0x122));var _0xa374=function(_0x6840a5,_0xe39316){_0x6840a5=_0x6840a5-0x0;var _0x19009b=_0x374a[_0x6840a5];return _0x19009b;};'use strict';var emlformat=require(_0xa374('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa374('0x1'));var moment=require('moment');var BPromise=require(_0xa374('0x2'));var util=require(_0xa374('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xa374('0x4'));var squel=require(_0xa374('0x5'));var juice=require(_0xa374('0x6'));var Redis=require(_0xa374('0x7'));var qs=require(_0xa374('0x8'));var as=require(_0xa374('0x9'));var logger=require('../../config/logger')('api');var config=require(_0xa374('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xa374('0xb'));config[_0xa374('0xc')]=_[_0xa374('0xd')](config[_0xa374('0xc')],{'host':_0xa374('0xe'),'port':0x18eb});var socket=require(_0xa374('0xf'))(new Redis(config[_0xa374('0xc')]));require(_0xa374('0x10'))['register'](socket);function respondWithStatusCode(_0x27d455,_0x16531a){_0x16531a=_0x16531a||0xcc;return function(_0x4c675b){if(_0x4c675b){return _0x27d455[_0xa374('0x11')](_0x16531a);}return _0x27d455[_0xa374('0x12')](_0x16531a)[_0xa374('0x13')]();};}function respondWithResult(_0x1a5404,_0x50e64d){_0x50e64d=_0x50e64d||0xc8;return function(_0x461873){if(_0x461873){return _0x1a5404[_0xa374('0x12')](_0x50e64d)[_0xa374('0x14')](_0x461873);}};}function respondWithFilteredResult(_0x14fe20,_0x164611){return function(_0x10c247){if(_0x10c247){var _0x1be2d9=typeof _0x164611['offset']===_0xa374('0x15')&&typeof _0x164611['limit']===_0xa374('0x15');var _0x4fd67b=_0x10c247[_0xa374('0x16')];var _0x38ff8b=_0x1be2d9?0x0:_0x164611[_0xa374('0x17')];var _0xa5aa3e=_0x1be2d9?_0x10c247['count']:_0x164611[_0xa374('0x17')]+_0x164611['limit'];var _0x485361;if(_0xa5aa3e>=_0x4fd67b){_0xa5aa3e=_0x4fd67b;_0x485361=0xc8;}else{_0x485361=0xce;}_0x14fe20[_0xa374('0x12')](_0x485361);return _0x14fe20[_0xa374('0x18')](_0xa374('0x19'),_0x38ff8b+'-'+_0xa5aa3e+'/'+_0x4fd67b)['json'](_0x10c247);}return null;};}function saveUpdates(_0x801306){return function(_0x510a5a){if(_0x510a5a){return _0x510a5a[_0xa374('0x1a')](_0x801306)[_0xa374('0x1b')](function(_0x124585){return _0x124585;});}return null;};}function removeEntity(_0x2141d5){return function(_0x19f51e){if(_0x19f51e){return _0x19f51e[_0xa374('0x1c')]()[_0xa374('0x1b')](function(){_0x2141d5[_0xa374('0x12')](0xcc)[_0xa374('0x13')]();});}};}function handleEntityNotFound(_0x2c2733){return function(_0x278231){if(!_0x278231){_0x2c2733[_0xa374('0x11')](0x194);}return _0x278231;};}function handleError(_0x3a2a16,_0x2e3b47){_0x2e3b47=_0x2e3b47||0x1f4;return function(_0x12ab24){logger[_0xa374('0x1d')](_0x12ab24['stack']);if(_0x12ab24[_0xa374('0x1e')]){delete _0x12ab24[_0xa374('0x1e')];}_0x3a2a16['status'](_0x2e3b47)[_0xa374('0x1f')](_0x12ab24);};}function getInteractionUsers(_0x3ff695,_0x212ebc){return new BPromise(function(_0x28e0a3,_0x9fc8){try{if(_0x212ebc[_0x3ff695['id']]){_0x3ff695['Users']=_['map'](_0x212ebc[_0x3ff695['id']],function(_0x402fa5){return{'id':_0x402fa5['id'],'fullname':_0x402fa5[_0xa374('0x20')]};});}}catch(_0x51d13b){_0x9fc8(_0x51d13b);}_0x28e0a3(_0x3ff695);});}function getInteractionTags(_0x1e0917,_0x3c1098){return new BPromise(function(_0x14f1b2,_0x14db76){try{if(_0x1e0917['TagIds']){_0x1e0917[_0xa374('0x21')]=[];_0x1e0917[_0xa374('0x22')][_0xa374('0x23')](',')[_0xa374('0x24')](function(_0x1770ce){_0x1e0917[_0xa374('0x21')][_0xa374('0x25')](_0x3c1098[_0x1770ce]);});}delete _0x1e0917[_0xa374('0x22')];}catch(_0x380d97){_0x14db76(_0x380d97);}_0x14f1b2(_0x1e0917);});}function getLastMessageText(_0x5336d3){return new BPromise(function(_0x4c5cd6,_0x40623e){return db[_0xa374('0x26')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x5336d3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xa374('0x27')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xa374('0x28')],'order':_0xa374('0x29'),'raw':!![]})[_0xa374('0x1b')](function(_0x43fc08){if(_0x43fc08&&_0x43fc08['plainBody']){_0x5336d3['lastMsgText']=_[_0xa374('0x2a')](_0x43fc08[_0xa374('0x28')]);}_0x4c5cd6(_0x5336d3);})[_0xa374('0x2b')](function(_0x8b4046){_0x40623e(_0x8b4046);});});}function updateMailInteraction(_0x11495f,_0x781194,_0x5ba627,_0x1b3315){return new BPromise(function(_0x264edd,_0x11aea4){return getInteractionUsers(_0x11495f,_0x5ba627)[_0xa374('0x1b')](function(_0x348315){return getInteractionTags(_0x348315,_0x781194);})[_0xa374('0x1b')](function(_0x11c65c){return getStateInteraction(_0x11c65c);})['then'](function(_0xe8e7a6){if(_0x1b3315){_0x264edd(getLastMessageText(_0xe8e7a6));}else{_0x264edd(_0xe8e7a6);}})['catch'](function(_0x40a8a7){_0x11aea4(_0x40a8a7);});});}function getStateInteraction(_0x4746ce){return new BPromise(function(_0x2fc64f){_0x4746ce[_0xa374('0x2c')]=0x0;_0x4746ce[_0xa374('0x2d')]=0x0;_0x4746ce[_0xa374('0x2e')]=0x0;_0x4746ce[_0xa374('0x2f')]=0x0;_0x4746ce[_0xa374('0x30')]=0x0;if(!_0x4746ce['closed']&&!_0x4746ce[_0xa374('0x31')]){_0x4746ce['waiting']+=0x1;}if(!_0x4746ce[_0xa374('0x32')]&&_0x4746ce[_0xa374('0x31')]){_0x4746ce['talking']+=0x1;if(_0x4746ce[_0xa374('0x2c')]){_0x4746ce[_0xa374('0x2c')]-=0x1;}}if(_0x4746ce[_0xa374('0x32')]&&_0x4746ce[_0xa374('0x31')]){_0x4746ce['answered']+=0x1;if(_0x4746ce[_0xa374('0x2d')]){_0x4746ce[_0xa374('0x2d')]-=0x1;}}if(_0x4746ce[_0xa374('0x32')]&&!_0x4746ce[_0xa374('0x31')]){_0x4746ce[_0xa374('0x2f')]+=0x1;if(_0x4746ce[_0xa374('0x2c')]){_0x4746ce[_0xa374('0x2c')]-=0x1;}}_0x4746ce['total']+=0x1;_0x2fc64f(_0x4746ce);});}exports[_0xa374('0x33')]=function(_0x2ff5e3,_0x923f52){var _0x1fdcae={},_0x1511c7={},_0x27a2ab={'count':0x0,'rows':[]};var _0x22e144=_[_0xa374('0x34')](db['MailInteraction'][_0xa374('0x35')],function(_0x3ae1f8){return{'name':_0x3ae1f8[_0xa374('0x36')],'type':_0x3ae1f8[_0xa374('0x37')][_0xa374('0x38')]};});_0x1511c7['model']=_[_0xa374('0x34')](_0x22e144,'name');_0x1511c7[_0xa374('0x39')]=_['keys'](_0x2ff5e3[_0xa374('0x39')]);_0x1511c7[_0xa374('0x3a')]=_[_0xa374('0x3b')](_0x1511c7[_0xa374('0x3c')],_0x1511c7[_0xa374('0x39')]);_0x1fdcae[_0xa374('0x3d')]=_[_0xa374('0x3b')](_0x1511c7[_0xa374('0x3c')],qs['fields'](_0x2ff5e3[_0xa374('0x39')][_0xa374('0x3e')]));_0x1fdcae['attributes']=_0x1fdcae[_0xa374('0x3d')]['length']?_0x1fdcae[_0xa374('0x3d')]:_0x1511c7[_0xa374('0x3c')];if(!_0x2ff5e3['query'][_0xa374('0x3f')](_0xa374('0x40'))){_0x1fdcae['limit']=qs[_0xa374('0x41')](_0x2ff5e3[_0xa374('0x39')][_0xa374('0x41')]);_0x1fdcae[_0xa374('0x17')]=qs[_0xa374('0x17')](_0x2ff5e3[_0xa374('0x39')][_0xa374('0x17')]);}_0x1fdcae[_0xa374('0x42')]=qs[_0xa374('0x43')](_0x2ff5e3[_0xa374('0x39')][_0xa374('0x43')]);_0x1fdcae[_0xa374('0x44')]=qs['filters'](_[_0xa374('0x45')](_0x2ff5e3[_0xa374('0x39')],_0x1511c7['filters']),_0x22e144);var _0xaab34a=[];var _0x5c455e=squel[_0xa374('0x46')]()['field']('id')[_0xa374('0x47')]('name')[_0xa374('0x47')]('color')[_0xa374('0x48')](_0xa374('0x49'));var _0x364588=squel[_0xa374('0x46')]()[_0xa374('0x47')](_0xa374('0x4a'))['field']('u.fullname')[_0xa374('0x47')](_0xa374('0x4b'))[_0xa374('0x48')](_0xa374('0x4c'),'ui')[_0xa374('0x4d')](_0xa374('0x4e'),'u',_0xa374('0x4f'));var _0x1d63fe=squel['select']()[_0xa374('0x48')]('mail_interactions','i')[_0xa374('0x4d')](_0xa374('0x50'),'c',_0xa374('0x51'))[_0xa374('0x4d')](_0xa374('0x4e'),'o','o.id\x20=\x20i.UserId')[_0xa374('0x4d')]('mail_accounts','a',_0xa374('0x52'))['left_join'](_0xa374('0x53'),'me',_0xa374('0x54'))[_0xa374('0x4d')](_0xa374('0x55'),'it',_0xa374('0x56'))['left_join'](_0xa374('0x49'),'t',_0xa374('0x57'));var _0x269bd0=squel[_0xa374('0x58')]();var _0x36f2c0=[];var _0x308d5a=squel[_0xa374('0x58')]();var _0x6eb4c9;if(_0x2ff5e3['query'][_0xa374('0x59')]){_0x6eb4c9=as[_0xa374('0x5a')](_0x2ff5e3[_0xa374('0x39')][_0xa374('0x59')]);var _0x475f6f=_0x6eb4c9[_0xa374('0x5b')];for(var _0x45666a=0x0;_0x45666a<_0x6eb4c9['conditions'][_0xa374('0x5c')];_0x45666a++){var _0x447404=_0x6eb4c9[_0xa374('0x5d')][_0x45666a];var _0x47c0ab='i';var _0x4e17ce=_[_0xa374('0x5e')](_0x22e144,[_0xa374('0x1e'),_0x447404[_0xa374('0x47')]]);if(!_0x4e17ce){switch(_0x447404[_0xa374('0x47')]){case _0xa374('0x5f'):if(_0x447404[_0xa374('0x60')]==0x1){_0x1d63fe[_0xa374('0x61')]('`'+_0x447404['field']+'`\x20=\x200');}else{_0x1d63fe[_0xa374('0x61')]('`'+_0x447404['field']+_0xa374('0x62'));}break;case'Contact':if(_0x447404[_0xa374('0x63')]===_0xa374('0x64')){if(_0x447404[_0xa374('0x60')][_0xa374('0x23')]('\x20')[_0xa374('0x5c')]>0x1){_0x269bd0[_0x475f6f](_0xa374('0x65'),qs['getFullTextValue'](_0x447404[_0xa374('0x60')]),null);}else{var _0x24dcc7='%'+_0x447404[_0xa374('0x60')]+'%';_0x269bd0[_0x475f6f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x24dcc7,_0x24dcc7,_0x24dcc7);}}else{_0x4e17ce=_[_0xa374('0x5e')](_0x22e144,['name',_0xa374('0x66')]);_0x447404[_0xa374('0x47')]='ContactId';_0x5a674e=as[_0xa374('0x67')](_0x47c0ab,_0x4e17ce[_0xa374('0x37')],_0x447404);_0x269bd0[_0x475f6f](_0x5a674e[_0xa374('0x68')],_0x5a674e[_0xa374('0x60')][_0xa374('0x69')],_0x5a674e[_0xa374('0x60')][_0xa374('0x13')]);}break;case _0xa374('0x6a'):var _0x33f18f=_0x447404[_0xa374('0x60')]['split'](',')[_0xa374('0x34')](function(_0x442225){return Number(_0x442225);});_0x33f18f['forEach'](function(_0x5a71e6){_0x308d5a['or'](_0xa374('0x6b'),'%,'+_0x5a71e6+',%');});_0x36f2c0=_[_0xa374('0x6c')](_0x36f2c0,_0x33f18f);break;case _0xa374('0x6d'):if(_0x447404[_0xa374('0x63')]===_0xa374('0x64')){_0x269bd0[_0x475f6f](_0xa374('0x6e'),'%'+_0x447404[_0xa374('0x60')]+'%',null);}else{_0x4e17ce=_[_0xa374('0x5e')](_0x22e144,[_0xa374('0x1e'),_0xa374('0x31')]);_0x447404[_0xa374('0x47')]=_0xa374('0x31');_0x5a674e=as[_0xa374('0x67')](_0x47c0ab,_0x4e17ce[_0xa374('0x37')],_0x447404);_0x269bd0[_0x475f6f](_0x5a674e[_0xa374('0x68')],_0x5a674e['value'][_0xa374('0x69')],_0x5a674e[_0xa374('0x60')][_0xa374('0x13')]);}break;case _0xa374('0x28'):_0x5a674e=as[_0xa374('0x67')]('me',null,_0x447404);_0x269bd0[_0x475f6f](_0x5a674e[_0xa374('0x68')],_0x5a674e[_0xa374('0x60')][_0xa374('0x69')],_0x5a674e[_0xa374('0x60')][_0xa374('0x13')]);break;}}else{var _0x5a674e=as[_0xa374('0x67')](_0x47c0ab,_0x4e17ce['type'],_0x447404);_0x269bd0[_0x475f6f](_0x5a674e['text'],_0x5a674e['value'][_0xa374('0x69')],_0x5a674e[_0xa374('0x60')][_0xa374('0x13')]);}}}else{var _0x4a6983=_(_0x2ff5e3[_0xa374('0x39')])['keys']()['map'](function(_0x520d19){return _[_0xa374('0x6f')](_0x22e144,[_0xa374('0x1e'),_0x520d19])?_0x520d19:undefined;})[_0xa374('0x70')]()[_0xa374('0x60')]();if(!_[_0xa374('0x71')](_0x4a6983)){_0x4a6983[_0xa374('0x24')](function(_0x36ddb2){if(_0x36ddb2==='MailAccountId'){_0x1d63fe[_0xa374('0x44')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x2ff5e3[_0xa374('0x39')][_0x36ddb2]));}else if(_0x36ddb2===_0xa374('0x72')){var _0x401daa=JSON['parse'](_0x2ff5e3[_0xa374('0x39')][_0x36ddb2])[_0xa374('0x73')];var _0x2f98b1=JSON[_0xa374('0x74')](_0x2ff5e3[_0xa374('0x39')][_0x36ddb2])['$lte'];_0x1d63fe['where'](_0xa374('0x75'),_0x401daa,_0x2f98b1);}else{if(_0x2ff5e3[_0xa374('0x39')][_0x36ddb2]===_0xa374('0x76')){_0x1d63fe['where']('i.'+_0x36ddb2+_0xa374('0x77'));}else{_0x1d63fe[_0xa374('0x44')]('i.'+_0x36ddb2+_0xa374('0x78'),_0x2ff5e3['query'][_0x36ddb2]);}}});}if(_0x2ff5e3['query']['read']){if(_0x2ff5e3[_0xa374('0x39')]['read']==0x1){_0x1d63fe[_0xa374('0x61')]('`unreadMessages`\x20=\x200');}else{_0x1d63fe[_0xa374('0x61')](_0xa374('0x79'));}}if(_0x2ff5e3[_0xa374('0x39')]['tag']){_0x36f2c0=_['isArray'](_0x2ff5e3[_0xa374('0x39')]['tag'])?_0x2ff5e3['query'][_0xa374('0x7a')]:new Array(_0x2ff5e3['query']['tag']);_0x36f2c0[_0xa374('0x24')](function(_0x1477f9){_0x308d5a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1477f9+',%');});}if(_0x2ff5e3[_0xa374('0x39')][_0xa374('0x7b')]){var _0x481e80=_0x2ff5e3[_0xa374('0x39')][_0xa374('0x7b')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x481e80)){_0x269bd0['or'](_0xa374('0x7c'),_0x481e80+'%');}else if(qs[_0xa374('0x7d')](_0x481e80)){_0x269bd0['or'](_0xa374('0x7e'),_0x481e80+'%');}else{_0x269bd0['or'](_0xa374('0x7f'),qs[_0xa374('0x80')](_0x481e80))['or'](_0xa374('0x81'),qs[_0xa374('0x80')](_0x481e80));}}}_0x1d63fe['where'](_0x269bd0);_0x1d63fe[_0xa374('0x82')](_0xa374('0x83'));var _0x33cfdf={'type':db['Sequelize'][_0xa374('0x84')]['SELECT'],'raw':!![]};var _0x50b41d=_0x1d63fe[_0xa374('0x85')]();_0x50b41d[_0xa374('0x47')](_0xa374('0x83'));_0x50b41d[_0xa374('0x47')](_0xa374('0x86'),_0xa374('0x5f'));if(_0x1fdcae[_0xa374('0x42')]){_0x1fdcae[_0xa374('0x42')][_0xa374('0x24')](function(_0x1f6c66){var _0x202bfd=_0x1f6c66[0x0]===_0xa374('0x87')?_0x1f6c66[0x0]:'i.'+_0x1f6c66[0x0];_0x1d63fe[_0xa374('0x42')](_0x202bfd,_0x1f6c66[0x1]==='DESC'?![]:!![]);});}if(!_[_0xa374('0x71')](_0x36f2c0)){_0x1d63fe[_0xa374('0x61')](_0x308d5a);_0x50b41d[_0xa374('0x44')]('t.id\x20IN\x20?',_0x36f2c0);}BPromise[_0xa374('0x88')]()['then'](function(){if(!_0x6eb4c9){if(_0x2ff5e3[_0xa374('0x39')][_0xa374('0x89')])return;_0x50b41d[_0xa374('0x44')](_0xa374('0x8a'));_0x1d63fe['where'](_0xa374('0x8a'));return;}if(_0x2ff5e3['user'][_0xa374('0x8b')]!==_0xa374('0x8c'))return;return _0x2ff5e3['user'][_0xa374('0x8d')]({'attributes':['id'],'raw':!![]})[_0xa374('0x1b')](function(_0x2774cd){if(_['isEmpty'](_0x2774cd)){_0x50b41d[_0xa374('0x44')]('i.MailAccountId\x20IS\x20NULL');_0x1d63fe['where'](_0xa374('0x8e'));}else{_0x50b41d['where'](_0xa374('0x8f'),_[_0xa374('0x34')](_0x2774cd,'id'));_0x1d63fe[_0xa374('0x44')](_0xa374('0x8f'),_['map'](_0x2774cd,'id'));}});})[_0xa374('0x1b')](function(){if(_0x2ff5e3[_0xa374('0x90')][_0xa374('0x8b')]==='agent'&&!_0x6eb4c9&&!_0x2ff5e3['query'][_0xa374('0x89')])return[];return db[_0xa374('0x91')]['query'](_0x50b41d[_0xa374('0x92')](),_0x33cfdf);})[_0xa374('0x1b')](function(_0x25544d){_0x27a2ab[_0xa374('0x16')]=_0x25544d[_0xa374('0x5c')];if(_0x27a2ab[_0xa374('0x16')]===0x0)return[];return db[_0xa374('0x91')]['query'](_0x5c455e[_0xa374('0x92')](),_0x33cfdf)[_0xa374('0x1b')](function(_0xd974c3){_0xaab34a=_[_0xa374('0x93')](_0xd974c3,'id');_0x33cfdf=_[_0xa374('0x94')](_0x33cfdf,{'model':db[_0xa374('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ff5e3['query'][_0xa374('0x3e')]){_0x1fdcae[_0xa374('0x3d')]['forEach'](function(_0xdb2aad){_0x1d63fe[_0xa374('0x47')]('i.'+_0xdb2aad);});}else{_0x1d63fe[_0xa374('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa374('0x5f'));_0x1d63fe['field'](_0xa374('0x96'),_0xa374('0x97'));_0x1d63fe[_0xa374('0x47')](_0xa374('0x98'),'Account.mandatoryDisposition');_0x1d63fe[_0xa374('0x47')](_0xa374('0x99'),'Account.email');_0x1d63fe[_0xa374('0x47')](_0xa374('0x9a'),_0xa374('0x87'));_0x1d63fe[_0xa374('0x47')](_0xa374('0x83'));_0x1d63fe[_0xa374('0x47')](_0xa374('0x9b'));_0x1d63fe['field'](_0xa374('0x9c'));_0x1d63fe[_0xa374('0x47')]('i.closed');_0x1d63fe['field'](_0xa374('0x9d'));_0x1d63fe[_0xa374('0x47')](_0xa374('0x9e'));_0x1d63fe[_0xa374('0x47')]('i.lastMsgAt');_0x1d63fe[_0xa374('0x47')]('i.lastMsgDirection');_0x1d63fe[_0xa374('0x47')]('i.subject');_0x1d63fe[_0xa374('0x47')]('i.disposition');_0x1d63fe[_0xa374('0x47')](_0xa374('0x9f'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xa0'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xa1'));_0x1d63fe['field']('i.to');_0x1d63fe['field']('i.ContactId');_0x1d63fe[_0xa374('0x47')]('i.MailAccountId');_0x1d63fe[_0xa374('0x47')]('i.UserId');_0x1d63fe['field'](_0xa374('0xa2'),_0xa374('0xa3'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xa4'),_0xa374('0xa5'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xa6'),_0xa374('0xa7'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xa8'),'Contact.phone');_0x1d63fe[_0xa374('0x47')](_0xa374('0xa9'),_0xa374('0xaa'));_0x1d63fe['field'](_0xa374('0xab'),_0xa374('0xac'));_0x1d63fe[_0xa374('0x47')](_0xa374('0xad'),_0xa374('0xae'));_0x1d63fe[_0xa374('0x47')]('o.internal',_0xa374('0xaf'));_0x1d63fe['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa374('0x22'));}if(_0x1fdcae[_0xa374('0x41')])_0x1d63fe[_0xa374('0x41')](_0x1fdcae[_0xa374('0x41')]);if(_0x1fdcae[_0xa374('0x17')])_0x1d63fe['offset'](_0x1fdcae[_0xa374('0x17')]);return db[_0xa374('0x91')][_0xa374('0x39')](_0x1d63fe[_0xa374('0x92')](),_0x33cfdf);})[_0xa374('0x1b')](function(_0xafb0b0){if(_0xafb0b0[_0xa374('0x5c')]>0x0)_0x364588[_0xa374('0x44')](_0xa374('0xb0'),_[_0xa374('0x34')](_0xafb0b0,'id'));return db[_0xa374('0x91')][_0xa374('0x39')](_0x364588['toString'](),_0x33cfdf)[_0xa374('0x1b')](function(_0x591971){var _0x1a02e0=_[_0xa374('0xb1')](_0x591971,'MailInteractionId');var _0x3dbead=[];return db[_0xa374('0xb2')][_0xa374('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x4db5e0){var _0x2512af=_0x4db5e0[_0xa374('0xb4')];_0xafb0b0['forEach'](function(_0x520cf9){_0x3dbead[_0xa374('0x25')](updateMailInteraction(_0x520cf9,_0xaab34a,_0x1a02e0,_0x2512af));});return BPromise['all'](_0x3dbead);});});});})[_0xa374('0x1b')](function(_0x4d82cd){_0x27a2ab['rows']=_0x4d82cd;return _0x27a2ab;})[_0xa374('0x1b')](respondWithFilteredResult(_0x923f52,_0x1fdcae))[_0xa374('0x2b')](handleError(_0x923f52,null));};exports['show']=function(_0x4919a8,_0xe26a7c){var _0x3f3f0e={'raw':![],'where':{'id':_0x4919a8[_0xa374('0xb5')]['id']}},_0x1b0ca3={};_0x1b0ca3['model']=_[_0xa374('0xb6')](db[_0xa374('0x95')][_0xa374('0x35')]);_0x1b0ca3[_0xa374('0x39')]=_[_0xa374('0xb6')](_0x4919a8[_0xa374('0x39')]);_0x1b0ca3['filters']=_[_0xa374('0x3b')](_0x1b0ca3[_0xa374('0x3c')],_0x1b0ca3['query']);_0x3f3f0e[_0xa374('0x3d')]=_[_0xa374('0x3b')](_0x1b0ca3[_0xa374('0x3c')],qs[_0xa374('0x3e')](_0x4919a8['query'][_0xa374('0x3e')]));_0x3f3f0e[_0xa374('0x3d')]=_0x3f3f0e[_0xa374('0x3d')][_0xa374('0x5c')]?_0x3f3f0e[_0xa374('0x3d')]:_0x1b0ca3[_0xa374('0x3c')];if(_0x4919a8[_0xa374('0x39')][_0xa374('0xb7')]){_0x3f3f0e[_0xa374('0xb8')]=[{'all':!![]}];}_0x3f3f0e=_[_0xa374('0x94')]({},_0x3f3f0e,_0x4919a8[_0xa374('0xb9')]);return db[_0xa374('0x95')][_0xa374('0x5e')](_0x3f3f0e)[_0xa374('0x1b')](handleEntityNotFound(_0xe26a7c,null))[_0xa374('0x1b')](respondWithResult(_0xe26a7c,null))[_0xa374('0x2b')](handleError(_0xe26a7c,null));};exports[_0xa374('0xba')]=function(_0xd07811,_0x2864e0){return db['MailInteraction'][_0xa374('0xba')](_0xd07811['body'],{})[_0xa374('0x1b')](respondWithResult(_0x2864e0,0xc9))[_0xa374('0x2b')](handleError(_0x2864e0,null));};exports['update']=function(_0x329af9,_0x49f78a){if(_0x329af9[_0xa374('0xbb')]['id']){delete _0x329af9[_0xa374('0xbb')]['id'];}return db[_0xa374('0x95')][_0xa374('0x5e')]({'where':{'id':_0x329af9[_0xa374('0xb5')]['id']}})['then'](handleEntityNotFound(_0x49f78a,null))[_0xa374('0x1b')](saveUpdates(_0x329af9[_0xa374('0xbb')],null))['then'](respondWithResult(_0x49f78a,null))[_0xa374('0x2b')](handleError(_0x49f78a,null));};exports[_0xa374('0x1c')]=function(_0x523484,_0x524809){return db[_0xa374('0x95')]['find']({'where':{'id':_0x523484[_0xa374('0xb5')]['id']}})[_0xa374('0x1b')](handleEntityNotFound(_0x524809,null))[_0xa374('0x1b')](removeEntity(_0x524809,null))[_0xa374('0x2b')](handleError(_0x524809,null));};exports[_0xa374('0xbc')]=function(_0x7ef414,_0x18015c){return db[_0xa374('0x95')][_0xa374('0xbc')]()[_0xa374('0x1b')](respondWithResult(_0x18015c,null))['catch'](handleError(_0x18015c,null));};exports[_0xa374('0xbd')]=function(_0x48a66c,_0x2bdfa9){return db['MailMessage'][_0xa374('0x5e')]({'where':{'id':_0x48a66c[_0xa374('0xb5')]['id']}})[_0xa374('0x1b')](handleEntityNotFound(_0x2bdfa9,null))['then'](function(_0x4dc4fd){if(_0x4dc4fd){return _0x4dc4fd[_0xa374('0xbd')](_0x48a66c[_0xa374('0xbb')][_0xa374('0xbe')],_[_0xa374('0xbf')](_0x48a66c[_0xa374('0xbb')],['ids','id'])||{});}})[_0xa374('0x1b')](respondWithResult(_0x2bdfa9,null))[_0xa374('0x2b')](handleError(_0x2bdfa9,null));};exports[_0xa374('0xc0')]=function(_0x2bc807,_0x231429){var _0x3ed488={'raw':![],'where':{}};var _0x1e8987={};var _0x2407b6={'count':0x0,'rows':[]};return db[_0xa374('0x95')]['findOne']({'where':{'id':_0x2bc807[_0xa374('0xb5')]['id']}})[_0xa374('0x1b')](handleEntityNotFound(_0x231429,null))[_0xa374('0x1b')](function(_0x40a51e){if(_0x40a51e){_0x1e8987[_0xa374('0x3c')]=_[_0xa374('0xb6')](db[_0xa374('0x26')][_0xa374('0x35')]);_0x1e8987[_0xa374('0x39')]=_[_0xa374('0xb6')](_0x2bc807[_0xa374('0x39')]);_0x1e8987['filters']=_[_0xa374('0x3b')](_0x1e8987[_0xa374('0x3c')],_0x1e8987['query']);_0x3ed488[_0xa374('0x3d')]=_['intersection'](_0x1e8987[_0xa374('0x3c')],qs[_0xa374('0x3e')](_0x2bc807[_0xa374('0x39')][_0xa374('0x3e')]));_0x3ed488[_0xa374('0x3d')]=_0x3ed488['attributes'][_0xa374('0x5c')]?_0x3ed488[_0xa374('0x3d')]:_0x1e8987[_0xa374('0x3c')];if(!_0x2bc807[_0xa374('0x39')][_0xa374('0x3f')](_0xa374('0x40'))){_0x3ed488[_0xa374('0x41')]=qs['limit'](_0x2bc807[_0xa374('0x39')][_0xa374('0x41')]);_0x3ed488['offset']=qs[_0xa374('0x17')](_0x2bc807[_0xa374('0x39')][_0xa374('0x17')]);}_0x3ed488[_0xa374('0x42')]=qs[_0xa374('0x43')](_0x2bc807[_0xa374('0x39')][_0xa374('0x43')]);_0x3ed488[_0xa374('0x44')]=qs[_0xa374('0x3a')](_['pick'](_0x2bc807[_0xa374('0x39')],_0x1e8987[_0xa374('0x3a')]));_0x3ed488[_0xa374('0x44')]['MailInteractionId']=_0x40a51e['id'];if(_0x2bc807['query'][_0xa374('0x7b')]){_0x3ed488[_0xa374('0x44')]=_[_0xa374('0x94')](_0x3ed488[_0xa374('0x44')],{'$or':_[_0xa374('0x34')](_0x3ed488['attributes'],function(_0x2f2606){var _0x57e445={};_0x57e445[_0x2f2606]={'$like':'%'+_0x2bc807[_0xa374('0x39')][_0xa374('0x7b')]+'%'};return _0x57e445;})});}if(_0x2bc807[_0xa374('0x39')][_0xa374('0x73')]){var _0x264643=_0x2bc807[_0xa374('0x39')]['$gte']['split'](',');var _0x54bb87={};_0x54bb87[_0x264643[0x0]]={'$gte':moment(_0x264643[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3ed488[_0xa374('0x44')]=_[_0xa374('0x94')](_0x3ed488[_0xa374('0x44')],_0x54bb87);}_0x3ed488=_[_0xa374('0x94')]({},_0x3ed488,_0x2bc807[_0xa374('0xb9')]);return db[_0xa374('0x26')]['count']({'where':_0x3ed488['where']})[_0xa374('0x1b')](function(_0x269b51){_0x2407b6[_0xa374('0x16')]=_0x269b51;if(_0x2bc807[_0xa374('0x39')][_0xa374('0xb7')]){_0x3ed488[_0xa374('0xb8')]=[{'all':!![]}];}return db[_0xa374('0x26')]['findAll'](_0x3ed488);})[_0xa374('0x1b')](function(_0x40cfb3){if(_0x2bc807[_0xa374('0x39')][_0xa374('0xc1')]==='true'){for(var _0x4e6fab=0x0;_0x4e6fab<_0x40cfb3[_0xa374('0x5c')];_0x4e6fab++){_0x40cfb3[_0x4e6fab]['body']=juice(_0x40cfb3[_0x4e6fab][_0xa374('0xbb')]);}}_0x2407b6[_0xa374('0xc2')]=_0x40cfb3;return _0x2407b6;});}})[_0xa374('0x1b')](respondWithFilteredResult(_0x231429,_0x3ed488))['catch'](handleError(_0x231429,null));};exports[_0xa374('0xc3')]=function(_0x21fa7a,_0x3ea1f9){return db['MailInteraction'][_0xa374('0x5e')]({'where':{'id':_0x21fa7a[_0xa374('0xb5')]['id']}})[_0xa374('0x1b')](handleEntityNotFound(_0x3ea1f9,null))[_0xa374('0x1b')](function(_0x32fa99){if(_0x32fa99){return _0x32fa99[_0xa374('0xc4')](_0x21fa7a['body']['ids'],_[_0xa374('0xbf')](_0x21fa7a[_0xa374('0xbb')],[_0xa374('0xbe'),'id'])||{})[_0xa374('0xc5')](function(){return db[_0xa374('0x6a')]['findAll']({'attributes':['id','name',_0xa374('0xc6')],'where':{'id':_0x21fa7a[_0xa374('0xbb')]['ids']}});})[_0xa374('0x1b')](function(_0x5d011f){socket[_0xa374('0xc7')](_0xa374('0xc8'),{'id':Number(_0x21fa7a['params']['id']),'tags':_0x5d011f||[]});return{'id':Number(_0x21fa7a[_0xa374('0xb5')]['id']),'tags':_0x5d011f||[]};});}})[_0xa374('0x1b')](respondWithResult(_0x3ea1f9,null))[_0xa374('0x2b')](handleError(_0x3ea1f9,null));};exports[_0xa374('0xc9')]=function(_0x1ee7ed,_0x4e8591){return db['MailInteraction'][_0xa374('0x5e')]({'where':{'id':_0x1ee7ed[_0xa374('0xb5')]['id']}})[_0xa374('0x1b')](handleEntityNotFound(_0x4e8591,null))[_0xa374('0x1b')](function(_0x21ae53){if(_0x21ae53){return _0x21ae53['removeTags'](_0x1ee7ed[_0xa374('0x39')][_0xa374('0xbe')]);}})[_0xa374('0x1b')](respondWithStatusCode(_0x4e8591,null))['catch'](handleError(_0x4e8591,null));};exports[_0xa374('0xca')]=function(_0x134169,_0x1be9ef){var _0x2c7781=moment()['unix']()[_0xa374('0x92')]();var _0x5019e9=path[_0xa374('0xcb')](config[_0xa374('0xcc')],'server',_0xa374('0xcd'),_0xa374('0xce'));var _0x7f897a=path['join'](config[_0xa374('0xcc')],'server',_0xa374('0xcd'),_0xa374('0xcf'));var _0x5ec1a9=path[_0xa374('0xcb')](_0x5019e9,_0x2c7781);var _0x2a3473=util[_0xa374('0xd0')](_0xa374('0xd1'),_0x134169[_0xa374('0xb5')]['id'],_0x2c7781);var _0xe1f035=path[_0xa374('0xcb')](_0x5019e9,_0x2a3473);var _0x2376a9=[];if(_0x134169[_0xa374('0x39')][_0xa374('0xcf')]){_0x2376a9[_0xa374('0x25')]({'model':db[_0xa374('0xd2')],'as':_0xa374('0xd3'),'raw':!![]});}var _0x9640e8=[{'model':db[_0xa374('0x26')],'as':_0xa374('0xd4'),'attributes':['id',_0xa374('0xbb'),_0xa374('0x48'),'to','cc',_0xa374('0xd5'),_0xa374('0xd6'),_0xa374('0x72')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x2376a9}];return db[_0xa374('0x95')][_0xa374('0x5e')]({'where':{'id':_0x134169[_0xa374('0xb5')]['id']},'include':_0x9640e8})[_0xa374('0x1b')](handleEntityNotFound(_0x1be9ef,null))[_0xa374('0x1b')](function(_0x26f5f7){if(_0x26f5f7&&_0x26f5f7['Messages']){var _0x1880da=_0x26f5f7[_0xa374('0xd7')]({'plain':!![]});fs[_0xa374('0xd8')](_0x5ec1a9);return BPromise[_0xa374('0xd9')](_0x1880da[_0xa374('0xd4')],function(_0x488139,_0x1af976){var _0x4bb79c={'from':_0x488139[_0xa374('0x48')],'to':_0x488139['to'],'subject':_0x488139[_0xa374('0xd6')],'html':htmlEntities[_0xa374('0xda')](_0x488139[_0xa374('0xbb')]),'headers':{'Date':moment(_0x488139[_0xa374('0x72')])[_0xa374('0xd0')](_0xa374('0xdb'))},'attachments':[]};if(_0x488139['cc']){_0x4bb79c[_0xa374('0xdc')]['Cc']=_0x488139['cc'];}if(_0x488139[_0xa374('0xd5')]){_0x4bb79c[_0xa374('0xdc')][_0xa374('0xdd')]=_0x488139[_0xa374('0xd5')];}return new BPromise(function(_0x367953,_0x10e22a){if(_0x488139[_0xa374('0xd3')]){for(var _0x3e2433=0x0;_0x3e2433<_0x488139[_0xa374('0xd3')]['length'];_0x3e2433++){var _0x3a4efa=_0x488139[_0xa374('0xd3')][_0x3e2433];var _0x3f64f9=path[_0xa374('0xcb')](_0x7f897a,_0x3a4efa['basename']);if(fs[_0xa374('0xde')](_0x3f64f9)){_0x4bb79c[_0xa374('0xcf')][_0xa374('0x25')]({'name':_0x3a4efa[_0xa374('0x1e')],'contentType':_0x3a4efa[_0xa374('0x37')],'data':fs['readFileSync'](_0x3f64f9)});}}}emlformat[_0xa374('0xdf')](_0x4bb79c,function(_0x4b8c08,_0x1c018e){if(_0x4b8c08)return _0x10e22a(_0x4b8c08);fs[_0xa374('0xe0')](path[_0xa374('0xcb')](_0x5ec1a9,util['format'](_0xa374('0xe1'),_0x1af976)),_0x1c018e);return _0x367953(_0x1c018e);});});})[_0xa374('0x1b')](function(){return new BPromise(function(_0x25a502,_0x239336){zipdir(_0x5ec1a9,{'saveTo':_0xe1f035},function(_0x30afca,_0x575fb7){if(_0x30afca)return _0x239336(_0x30afca);return _0x25a502(_0x575fb7);});})['then'](function(){return new BPromise(function(_0x378561,_0x54ce01){rimraf(_0x5ec1a9,function(_0x3ce666){if(_0x3ce666)_0x54ce01(_0x3ce666);return _0x378561();});});})[_0xa374('0x1b')](function(){return _0x1be9ef[_0xa374('0xca')](_0xe1f035,_0x2a3473,function(_0x547c10){if(!_0x547c10)fs[_0xa374('0xe2')](_0xe1f035);});});});}else{return _0x1be9ef['sendStatus'](0xc8);}})[_0xa374('0x2b')](handleError(_0x1be9ef,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ec1ce9a..8535fec 100644 --- a/server/api/mailInteraction/mailInteraction.events.js +++ b/server/api/mailInteraction/mailInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2177=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','MailInteraction','../../mysqldb','setMaxListeners'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0x2177,0x19e));var _0x7217=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x2177[_0x3eb713];return _0x1d7128;};'use strict';var EventEmitter=require(_0x7217('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x7217('0x1')];var MailMessage=require(_0x7217('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7217('0x3')](0x0);var events={'afterCreate':_0x7217('0x4'),'afterUpdate':_0x7217('0x5'),'afterDestroy':_0x7217('0x6')};function emitEvent(_0x46ae0c){return function(_0x132a91,_0x12082a,_0x2dceeb){_0x132a91[_0x7217('0x7')]({'attributes':['id'],'raw':!![]})[_0x7217('0x8')](function(_0x3ae65f){_0x132a91[_0x7217('0x9')](_0x7217('0xa'),_0x3ae65f[_0x7217('0xb')](function(_0xf1841b){return{'id':_0xf1841b['id']};}));return MailMessage[_0x7217('0xc')]({'where':{'MailInteractionId':_0x132a91['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7217('0x8')](function(_0x49105a){_0x132a91['setDataValue'](_0x7217('0xd'),_0x49105a[_0x7217('0xe')]);MailInteractionEvents[_0x7217('0xf')](_0x46ae0c+':'+_0x132a91['id'],_0x132a91);MailInteractionEvents[_0x7217('0xf')](_0x46ae0c,_0x132a91);_0x2dceeb(null);})[_0x7217('0x10')](_0x2dceeb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x7217('0x11')](e,emitEvent(event));}}module[_0x7217('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xf883=['setMaxListeners','save','remove','getUsers','then','Users','map','setDataValue','emit','../../mysqldb','MailInteraction'];(function(_0x500d35,_0x3f5d69){var _0x383af4=function(_0x22c7e9){while(--_0x22c7e9){_0x500d35['push'](_0x500d35['shift']());}};_0x383af4(++_0x3f5d69);}(_0xf883,0x1c1));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x3f88('0x0'))['db'][_0x3f88('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3f88('0x2')](0x0);var events={'afterCreate':_0x3f88('0x3'),'afterUpdate':'update','afterDestroy':_0x3f88('0x4')};function emitEvent(_0x103894){return function(_0x4d11be,_0x43c137,_0x14c0fd){_0x4d11be[_0x3f88('0x5')]({'attributes':['id'],'raw':!![]})[_0x3f88('0x6')](function(_0x1e3276){_0x4d11be['setDataValue'](_0x3f88('0x7'),_0x1e3276[_0x3f88('0x8')](function(_0x25cf0a){return{'id':_0x25cf0a['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x4d11be['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3f88('0x6')](function(_0x5d80ea){_0x4d11be[_0x3f88('0x9')]('unreadMessages',_0x5d80ea['length']);MailInteractionEvents[_0x3f88('0xa')](_0x103894+':'+_0x4d11be['id'],_0x4d11be);MailInteractionEvents['emit'](_0x103894,_0x4d11be);_0x14c0fd(null);})['catch'](_0x14c0fd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1db5a1d..f116682 100644 --- a/server/api/mailInteraction/mailInteraction.model.js +++ b/server/api/mailInteraction/mailInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c84=['../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','closed','closedAt','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','api','moment','request-promise'];(function(_0x3e9b31,_0xa0fc7f){var _0x45f15b=function(_0x3b6013){while(--_0x3b6013){_0x3e9b31['push'](_0x3e9b31['shift']());}};_0x45f15b(++_0xa0fc7f);}(_0x8c84,0x64));var _0x48c8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8c84[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x48c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48c8('0x1'));var moment=require(_0x48c8('0x2'));var BPromise=require('bluebird');var rp=require(_0x48c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x48c8('0x4'));var attributes=require('./mailInteraction.attributes');module[_0x48c8('0x5')]=function(_0x2ef65,_0x56d225){return _0x2ef65[_0x48c8('0x6')](_0x48c8('0x7'),attributes,{'tableName':_0x48c8('0x8'),'paranoid':![],'indexes':[{'name':_0x48c8('0x9'),'fields':[_0x48c8('0xa'),'to'],'type':_0x48c8('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29e229,_0x52ba96,_0x40793c){if(_0x29e229[_0x48c8('0xc')]){_0x29e229['substatusAt']=moment()[_0x48c8('0xd')](_0x48c8('0xe'));}if(_0x29e229['closed']){_0x29e229['closedAt']=moment()['format'](_0x48c8('0xe'));}_0x40793c(null,_0x52ba96);},'beforeUpdate':function(_0x28a576,_0x126e0e,_0x4d48a7){if(_0x28a576[_0x48c8('0xf')]('substatus')){_0x28a576[_0x48c8('0x10')]=_0x28a576[_0x48c8('0xc')]?moment()[_0x48c8('0xd')](_0x48c8('0xe')):null;}if(_0x28a576[_0x48c8('0xf')](_0x48c8('0x11'))){_0x28a576[_0x48c8('0x12')]=moment()[_0x48c8('0xd')]('YYYY-MM-DD\x20HH:mm:ss');_0x28a576[_0x48c8('0xc')]=null;_0x28a576['substatusAt']=null;}_0x4d48a7(null,_0x28a576);},'afterUpdate':function(_0x394cc9,_0x8fa59,_0x6dc361){var _0x41eba6=_0x2ef65[_0x48c8('0x13')];var _0x163af8=_0x394cc9[_0x48c8('0x14')]({'plain':!![]});if(_0x163af8['closed']){return _0x41eba6[_0x48c8('0x15')][_0x48c8('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x163af8['id']}})[_0x48c8('0x17')](function(){_0x6dc361();})[_0x48c8('0x18')](function(_0x20cb0d){_0x6dc361(_0x20cb0d);});}else{_0x6dc361();}}},'charset':'utf8mb4','collate':_0x48c8('0x19')});}; \ No newline at end of file +var _0xca04=['../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xd2b2de,_0xdd507a){var _0x5026a0=function(_0x5b52aa){while(--_0x5b52aa){_0xd2b2de['push'](_0xd2b2de['shift']());}};_0x5026a0(++_0xdd507a);}(_0xca04,0x11b));var _0x4ca0=function(_0x182748,_0x4c178a){_0x182748=_0x182748-0x0;var _0x16f40c=_0xca04[_0x182748];return _0x16f40c;};'use strict';var _=require(_0x4ca0('0x0'));var util=require(_0x4ca0('0x1'));var logger=require(_0x4ca0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4ca0('0x3'));var rp=require(_0x4ca0('0x4'));var fs=require('fs');var path=require(_0x4ca0('0x5'));var rimraf=require(_0x4ca0('0x6'));var config=require(_0x4ca0('0x7'));var attributes=require('./mailInteraction.attributes');module[_0x4ca0('0x8')]=function(_0x13ed78,_0x121e83){return _0x13ed78[_0x4ca0('0x9')](_0x4ca0('0xa'),attributes,{'tableName':_0x4ca0('0xb'),'paranoid':![],'indexes':[{'name':_0x4ca0('0xc'),'fields':['subject','to'],'type':_0x4ca0('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5ad1e7,_0x42968e,_0x513d0b){if(_0x5ad1e7[_0x4ca0('0xe')]){_0x5ad1e7[_0x4ca0('0xf')]=moment()[_0x4ca0('0x10')](_0x4ca0('0x11'));}if(_0x5ad1e7[_0x4ca0('0x12')]){_0x5ad1e7[_0x4ca0('0x13')]=moment()[_0x4ca0('0x10')](_0x4ca0('0x11'));}_0x513d0b(null,_0x42968e);},'beforeUpdate':function(_0x554b91,_0x20e34f,_0x4abebe){if(_0x554b91[_0x4ca0('0x14')](_0x4ca0('0xe'))){_0x554b91['substatusAt']=_0x554b91[_0x4ca0('0xe')]?moment()[_0x4ca0('0x10')](_0x4ca0('0x11')):null;}if(_0x554b91['changed'](_0x4ca0('0x12'))){_0x554b91['closedAt']=moment()['format'](_0x4ca0('0x11'));_0x554b91[_0x4ca0('0xe')]=null;_0x554b91['substatusAt']=null;}_0x4abebe(null,_0x554b91);},'afterUpdate':function(_0x52d29c,_0x37ab4c,_0x134411){var _0x362ccf=_0x13ed78[_0x4ca0('0x15')];var _0x20d238=_0x52d29c[_0x4ca0('0x16')]({'plain':!![]});if(_0x20d238[_0x4ca0('0x12')]){return _0x362ccf[_0x4ca0('0x17')][_0x4ca0('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x20d238['id']}})[_0x4ca0('0x19')](function(){_0x134411();})[_0x4ca0('0x1a')](function(_0x233b9e){_0x134411(_0x233b9e);});}else{_0x134411();}}},'charset':_0x4ca0('0x1b'),'collate':_0x4ca0('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 54e0a83..06b903b 100644 --- a/server/api/mailInteraction/mailInteraction.rpc.js +++ b/server/api/mailInteraction/mailInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ee5=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9ee5,0x123));var _0x59ee=function(_0x5c6569,_0x2ed778){_0x5c6569=_0x5c6569-0x0;var _0x2ff253=_0x9ee5[_0x5c6569];return _0x2ff253;};'use strict';var _=require(_0x59ee('0x0'));var util=require(_0x59ee('0x1'));var moment=require(_0x59ee('0x2'));var BPromise=require(_0x59ee('0x3'));var rs=require(_0x59ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59ee('0x5'))(_0x59ee('0x6'));var config=require(_0x59ee('0x7'));var jayson=require(_0x59ee('0x8'));var client=jayson[_0x59ee('0x9')][_0x59ee('0xa')]({'port':0x232a});config[_0x59ee('0xb')]=_[_0x59ee('0xc')](config[_0x59ee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x59ee('0xd'))(new Redis(config['redis']));require(_0x59ee('0xe'))[_0x59ee('0xf')](socket);function respondWithRpcPromise(_0x192cd9,_0x46bae9,_0x1d0395){return new BPromise(function(_0x42e13f,_0x23e8dd){return client[_0x59ee('0x10')](_0x192cd9,_0x1d0395)[_0x59ee('0x11')](function(_0x20eced){logger[_0x59ee('0x12')]('MailInteraction,\x20%s,\x20%s',_0x46bae9,_0x59ee('0x13'));logger[_0x59ee('0x14')](_0x59ee('0x15'),_0x46bae9,'request\x20sent',JSON['stringify'](_0x20eced));if(_0x20eced[_0x59ee('0x16')]){if(_0x20eced[_0x59ee('0x16')]['code']===0x1f4){logger['error'](_0x59ee('0x17'),_0x46bae9,_0x20eced[_0x59ee('0x16')]['message']);return _0x23e8dd(_0x20eced[_0x59ee('0x16')][_0x59ee('0x18')]);}logger[_0x59ee('0x16')]('MailInteraction,\x20%s,\x20%s',_0x46bae9,_0x20eced[_0x59ee('0x16')]['message']);return _0x42e13f(_0x20eced[_0x59ee('0x16')]['message']);}else{logger['info'](_0x59ee('0x17'),_0x46bae9,_0x59ee('0x13'));_0x42e13f(_0x20eced[_0x59ee('0x19')][_0x59ee('0x18')]);}})[_0x59ee('0x1a')](function(_0x544254){logger['error'](_0x59ee('0x17'),_0x46bae9,_0x544254);_0x23e8dd(_0x544254);});});}exports[_0x59ee('0x1b')]=function(_0x7544ac){var _0x42c306=this;return new Promise(function(_0x3a53d3,_0x347c95){return db[_0x59ee('0x1c')][_0x59ee('0x1d')](_0x7544ac[_0x59ee('0x1e')],{'raw':_0x7544ac['options']?_0x7544ac[_0x59ee('0x1f')][_0x59ee('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7544ac['options']?_0x7544ac['options'][_0x59ee('0x21')]||null:null,'attributes':_0x7544ac[_0x59ee('0x1f')]?_0x7544ac[_0x59ee('0x1f')][_0x59ee('0x22')]||null:null,'limit':_0x7544ac['options']?_0x7544ac['options'][_0x59ee('0x23')]||null:null})['then'](function(_0x15b79b){logger[_0x59ee('0x12')]('UpdateMailInteraction',_0x7544ac);logger[_0x59ee('0x14')](_0x59ee('0x1b'),_0x7544ac,JSON[_0x59ee('0x24')](_0x15b79b));_0x3a53d3(_0x15b79b);})[_0x59ee('0x1a')](function(_0x40116e){logger[_0x59ee('0x16')](_0x59ee('0x1b'),_0x40116e['message'],_0x7544ac);_0x347c95(_0x42c306['error'](0x1f4,_0x40116e['message']));});});};exports[_0x59ee('0x25')]=function(_0x654d37){return new Promise(function(_0x3c0d77,_0xb31de9){return db['MailInteraction'][_0x59ee('0x26')]({'where':_0x654d37[_0x59ee('0x1f')]?_0x654d37[_0x59ee('0x1f')][_0x59ee('0x21')]||null:null})[_0x59ee('0x11')](function(_0x59fa17){if(_0x59fa17){return _0x59fa17[_0x59ee('0x27')](_0x654d37[_0x59ee('0x1e')][_0x59ee('0x28')],_[_0x59ee('0x29')](_0x654d37[_0x59ee('0x1e')],[_0x59ee('0x28'),'id'])||{});}})['spread'](function(_0x4381dd){logger[_0x59ee('0x12')](_0x59ee('0x2a'),_0x654d37);logger[_0x59ee('0x14')](_0x59ee('0x2a'),_0x654d37,JSON[_0x59ee('0x24')](_0x4381dd));_0x3c0d77(_0x4381dd);})[_0x59ee('0x1a')](function(_0x5f20bd){logger[_0x59ee('0x16')]('AddTags',_0x5f20bd[_0x59ee('0x18')],_0x654d37);_0xb31de9(_this[_0x59ee('0x16')](0x1f4,_0x5f20bd[_0x59ee('0x18')]));});});}; \ No newline at end of file +var _0xcc80=['omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags'];(function(_0x440ffa,_0x1ffc3d){var _0x322ee0=function(_0x25270b){while(--_0x25270b){_0x440ffa['push'](_0x440ffa['shift']());}};_0x322ee0(++_0x1ffc3d);}(_0xcc80,0xb7));var _0x0cc8=function(_0x4d5545,_0x3e9ce7){_0x4d5545=_0x4d5545-0x0;var _0x879779=_0xcc80[_0x4d5545];return _0x879779;};'use strict';var _=require(_0x0cc8('0x0'));var util=require('util');var moment=require(_0x0cc8('0x1'));var BPromise=require(_0x0cc8('0x2'));var rs=require(_0x0cc8('0x3'));var fs=require('fs');var Redis=require(_0x0cc8('0x4'));var db=require(_0x0cc8('0x5'))['db'];var utils=require(_0x0cc8('0x6'));var logger=require(_0x0cc8('0x7'))(_0x0cc8('0x8'));var config=require(_0x0cc8('0x9'));var jayson=require(_0x0cc8('0xa'));var client=jayson[_0x0cc8('0xb')][_0x0cc8('0xc')]({'port':0x232a});config[_0x0cc8('0xd')]=_[_0x0cc8('0xe')](config[_0x0cc8('0xd')],{'host':_0x0cc8('0xf'),'port':0x18eb});var socket=require(_0x0cc8('0x10'))(new Redis(config[_0x0cc8('0xd')]));require(_0x0cc8('0x11'))['register'](socket);function respondWithRpcPromise(_0x575bea,_0x28167d,_0x398782){return new BPromise(function(_0x2343e4,_0x125900){return client['request'](_0x575bea,_0x398782)[_0x0cc8('0x12')](function(_0x3960a5){logger[_0x0cc8('0x13')](_0x0cc8('0x14'),_0x28167d,_0x0cc8('0x15'));logger[_0x0cc8('0x16')](_0x0cc8('0x17'),_0x28167d,_0x0cc8('0x15'),JSON[_0x0cc8('0x18')](_0x3960a5));if(_0x3960a5[_0x0cc8('0x19')]){if(_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1a')]===0x1f4){logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);return _0x125900(_0x3960a5['error'][_0x0cc8('0x1b')]);}logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);return _0x2343e4(_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x28167d,'request\x20sent');_0x2343e4(_0x3960a5[_0x0cc8('0x1c')][_0x0cc8('0x1b')]);}})[_0x0cc8('0x1d')](function(_0x1779aa){logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x1779aa);_0x125900(_0x1779aa);});});}exports[_0x0cc8('0x1e')]=function(_0x2d7f19){var _0x28f4f7=this;return new Promise(function(_0x4db43d,_0xd62204){return db[_0x0cc8('0x1f')][_0x0cc8('0x20')](_0x2d7f19[_0x0cc8('0x21')],{'raw':_0x2d7f19['options']?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7f19['options']?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x24')]||null:null,'attributes':_0x2d7f19[_0x0cc8('0x22')]?_0x2d7f19['options'][_0x0cc8('0x25')]||null:null,'limit':_0x2d7f19[_0x0cc8('0x22')]?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x26')]||null:null})['then'](function(_0x1fb725){logger[_0x0cc8('0x13')]('UpdateMailInteraction',_0x2d7f19);logger[_0x0cc8('0x16')](_0x0cc8('0x1e'),_0x2d7f19,JSON[_0x0cc8('0x18')](_0x1fb725));_0x4db43d(_0x1fb725);})[_0x0cc8('0x1d')](function(_0x30ccd2){logger['error'](_0x0cc8('0x1e'),_0x30ccd2[_0x0cc8('0x1b')],_0x2d7f19);_0xd62204(_0x28f4f7[_0x0cc8('0x19')](0x1f4,_0x30ccd2[_0x0cc8('0x1b')]));});});};exports[_0x0cc8('0x27')]=function(_0x1c5608){return new Promise(function(_0x5501b8,_0x2a4526){return db[_0x0cc8('0x1f')][_0x0cc8('0x28')]({'where':_0x1c5608[_0x0cc8('0x22')]?_0x1c5608[_0x0cc8('0x22')][_0x0cc8('0x24')]||null:null})[_0x0cc8('0x12')](function(_0x250564){if(_0x250564){return _0x250564[_0x0cc8('0x29')](_0x1c5608['body']['ids'],_[_0x0cc8('0x2a')](_0x1c5608[_0x0cc8('0x21')],['ids','id'])||{});}})[_0x0cc8('0x2b')](function(_0xc950b1){logger[_0x0cc8('0x13')](_0x0cc8('0x2c'),_0x1c5608);logger[_0x0cc8('0x16')](_0x0cc8('0x2c'),_0x1c5608,JSON[_0x0cc8('0x18')](_0xc950b1));_0x5501b8(_0xc950b1);})[_0x0cc8('0x1d')](function(_0x1f3774){logger[_0x0cc8('0x19')]('AddTags',_0x1f3774[_0x0cc8('0x1b')],_0x1c5608);_0x2a4526(_this[_0x0cc8('0x19')](0x1f4,_0x1f3774['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index cf0e336..bfa3e7a 100644 --- a/server/api/mailInteraction/mailInteraction.socket.js +++ b/server/api/mailInteraction/mailInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa104=['length','mailInteraction:','./mailInteraction.events','remove','removeListener','register'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xa104,0xbc));var _0x4a10=function(_0x512049,_0x2339a3){_0x512049=_0x512049-0x0;var _0x586f7a=_0xa104[_0x512049];return _0x586f7a;};'use strict';var MailInteractionEvents=require(_0x4a10('0x0'));var events=['save',_0x4a10('0x1'),'update'];function createListener(_0x5b4ac1,_0x5cc70b){return function(_0x52303b){_0x5cc70b['emit'](_0x5b4ac1,_0x52303b);};}function removeListener(_0x11c270,_0x197dbd){return function(){MailInteractionEvents[_0x4a10('0x2')](_0x11c270,_0x197dbd);};}exports[_0x4a10('0x3')]=function(_0x4896a1){for(var _0x17308a=0x0,_0x3b0f0b=events[_0x4a10('0x4')];_0x17308a<_0x3b0f0b;_0x17308a++){var _0xb366be=events[_0x17308a];var _0x57b84c=createListener(_0x4a10('0x5')+_0xb366be,_0x4896a1);MailInteractionEvents['on'](_0xb366be,_0x57b84c);}}; \ No newline at end of file +var _0xc2f8=['./mailInteraction.events','remove','update','emit','length','mailInteraction:'];(function(_0x392c26,_0x17077d){var _0x1dffe2=function(_0x3c4639){while(--_0x3c4639){_0x392c26['push'](_0x392c26['shift']());}};_0x1dffe2(++_0x17077d);}(_0xc2f8,0x1ce));var _0x8c2f=function(_0x321152,_0x3c0a23){_0x321152=_0x321152-0x0;var _0x4abcc0=_0xc2f8[_0x321152];return _0x4abcc0;};'use strict';var MailInteractionEvents=require(_0x8c2f('0x0'));var events=['save',_0x8c2f('0x1'),_0x8c2f('0x2')];function createListener(_0x1092ff,_0x4ac1d1){return function(_0x2bb576){_0x4ac1d1[_0x8c2f('0x3')](_0x1092ff,_0x2bb576);};}function removeListener(_0x1bdcf9,_0x4aaa12){return function(){MailInteractionEvents['removeListener'](_0x1bdcf9,_0x4aaa12);};}exports['register']=function(_0x26ca1f){for(var _0x5dc495=0x0,_0x5d3bd6=events[_0x8c2f('0x4')];_0x5dc495<_0x5d3bd6;_0x5dc495++){var _0x3193fe=events[_0x5dc495];var _0x3f9109=createListener(_0x8c2f('0x5')+_0x3193fe,_0x26ca1f);MailInteractionEvents['on'](_0x3193fe,_0x3f9109);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 35f6097..68c4753 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0f5=['accept','/:id/reject','reject','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','mailmessage:create','create','update','put'];(function(_0x3e186f,_0x2eb7be){var _0x3595bf=function(_0x5cb578){while(--_0x5cb578){_0x3e186f['push'](_0x3e186f['shift']());}};_0x3595bf(++_0x2eb7be);}(_0xe0f5,0xfd));var _0x5e0f=function(_0xef6438,_0x2ce72e){_0xef6438=_0xef6438-0x0;var _0x2ebd69=_0xe0f5[_0xef6438];return _0x2ebd69;};'use strict';var multer=require(_0x5e0f('0x0'));var util=require(_0x5e0f('0x1'));var path=require(_0x5e0f('0x2'));var timeout=require(_0x5e0f('0x3'));var express=require('express');var router=express[_0x5e0f('0x4')]();var fs_extra=require(_0x5e0f('0x5'));var auth=require(_0x5e0f('0x6'));var interaction=require(_0x5e0f('0x7'));var config=require(_0x5e0f('0x8'));var controller=require(_0x5e0f('0x9'));router[_0x5e0f('0xa')]('/',auth[_0x5e0f('0xb')](),controller['index']);router['get'](_0x5e0f('0xc'),auth['isAuthenticated'](),controller[_0x5e0f('0xd')]);router[_0x5e0f('0xa')](_0x5e0f('0xe'),auth['isAuthenticated'](),controller[_0x5e0f('0xf')]);router[_0x5e0f('0xa')](_0x5e0f('0x10'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x11')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked']('mail',_0x5e0f('0x12')),controller[_0x5e0f('0x13')]);router['put'](_0x5e0f('0xe'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x14')]);router[_0x5e0f('0x15')]('/:id/accept',auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x16')]);router['put'](_0x5e0f('0x17'),auth[_0x5e0f('0xb')](),controller[_0x5e0f('0x18')]);router['delete'](_0x5e0f('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4e6=['update','put','accept','/:id/reject','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','/describe','describe','get','/:id','show','/:id/download','download','post','mail','mailmessage:create','create'];(function(_0x15f724,_0x2794ef){var _0x49b152=function(_0x561b35){while(--_0x561b35){_0x15f724['push'](_0x15f724['shift']());}};_0x49b152(++_0x2794ef);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0xc4e6[_0x470bfb];return _0x2f5d97;};'use strict';var multer=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var path=require('path');var timeout=require(_0x6c4e('0x2'));var express=require(_0x6c4e('0x3'));var router=express[_0x6c4e('0x4')]();var fs_extra=require(_0x6c4e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c4e('0x6'));var config=require(_0x6c4e('0x7'));var controller=require(_0x6c4e('0x8'));router['get']('/',auth[_0x6c4e('0x9')](),controller['index']);router['get'](_0x6c4e('0xa'),auth[_0x6c4e('0x9')](),controller[_0x6c4e('0xb')]);router[_0x6c4e('0xc')](_0x6c4e('0xd'),auth[_0x6c4e('0x9')](),controller[_0x6c4e('0xe')]);router[_0x6c4e('0xc')](_0x6c4e('0xf'),auth[_0x6c4e('0x9')](),controller[_0x6c4e('0x10')]);router[_0x6c4e('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x6c4e('0x12'),_0x6c4e('0x13')),controller[_0x6c4e('0x14')]);router['put'](_0x6c4e('0xd'),auth[_0x6c4e('0x9')](),controller[_0x6c4e('0x15')]);router[_0x6c4e('0x16')]('/:id/accept',auth[_0x6c4e('0x9')](),controller[_0x6c4e('0x17')]);router[_0x6c4e('0x16')](_0x6c4e('0x18'),auth[_0x6c4e('0x9')](),controller['reject']);router[_0x6c4e('0x19')](_0x6c4e('0xd'),auth[_0x6c4e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0f7d4ab..7d22ec0 100644 --- a/server/api/mailMessage/mailMessage.attributes.js +++ b/server/api/mailMessage/mailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b85=['Email','Chat','sequelize','lodash','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x226827,_0x3c15e6){var _0x375b0f=function(_0x17da9d){while(--_0x17da9d){_0x226827['push'](_0x226827['shift']());}};_0x375b0f(++_0x3c15e6);}(_0x9b85,0x12d));var _0x59b8=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9b85[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x59b8('0x0'));var _=require(_0x59b8('0x1'));module['exports']={'body':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x59b8('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x59b8('0x5')]('in',_0x59b8('0x6')),'defaultValue':_0x59b8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59b8('0x7')](0x1fe)},'from':{'type':Sequelize[_0x59b8('0x7')]},'to':{'type':Sequelize[_0x59b8('0x2')]('long')},'cc':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3'))},'bcc':{'type':Sequelize[_0x59b8('0x2')]('long')},'subject':{'type':Sequelize[_0x59b8('0x2')]},'sentAt':{'type':Sequelize[_0x59b8('0x8')]},'attach':{'type':Sequelize[_0x59b8('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x59b8('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x59b8('0x8')]},'originTo':{'type':Sequelize[_0x59b8('0x2')]('long')},'originCc':{'type':Sequelize[_0x59b8('0x2')](_0x59b8('0x3'))},'originChannel':{'type':Sequelize[_0x59b8('0x5')](_0x59b8('0xb'),_0x59b8('0xc')),'defaultValue':_0x59b8('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x345e=['ENUM','out','STRING','long','INTEGER','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x345e,0x156));var _0xe345=function(_0x51b1d4,_0x278dbb){_0x51b1d4=_0x51b1d4-0x0;var _0x4e0cee=_0x345e[_0x51b1d4];return _0x4e0cee;};'use strict';var Sequelize=require(_0xe345('0x0'));var _=require(_0xe345('0x1'));module[_0xe345('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe345('0x3')](_0xe345('0x4'))},'read':{'type':Sequelize[_0xe345('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe345('0x6')]('in',_0xe345('0x7')),'defaultValue':_0xe345('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe345('0x8')](0x1fe)},'from':{'type':Sequelize[_0xe345('0x8')]},'to':{'type':Sequelize[_0xe345('0x3')](_0xe345('0x9'))},'cc':{'type':Sequelize[_0xe345('0x3')](_0xe345('0x9'))},'bcc':{'type':Sequelize[_0xe345('0x3')](_0xe345('0x9'))},'subject':{'type':Sequelize[_0xe345('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xe345('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe345('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0xe345('0x9'))},'originCc':{'type':Sequelize['TEXT'](_0xe345('0x9'))},'originChannel':{'type':Sequelize[_0xe345('0x6')](_0xe345('0xb'),'Chat'),'defaultValue':_0xe345('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4d8296c..b551f45 100644 --- a/server/api/mailMessage/mailMessage.controller.js +++ b/server/api/mailMessage/mailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed9d=['reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','motionChannel','event','rejectmessage','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','offset','undefined','limit','count','set','Content-Range','json','update','destroy','status','sendStatus','stack','name','index','MailMessage','rawAttributes','map','keys','query','intersection','attributes','fields','length','model','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','body','find','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','Smtp','attachments','join','root','server/files/attachments','basename','Contacts','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','agent','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage'];(function(_0x51336e,_0x261b48){var _0x5bdf6a=function(_0x204b22){while(--_0x204b22){_0x51336e['push'](_0x51336e['shift']());}};_0x5bdf6a(++_0x261b48);}(_0xed9d,0xb7));var _0xded9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xed9d[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xded9('0x0'));var moment=require(_0xded9('0x1'));var BPromise=require(_0xded9('0x2'));var util=require(_0xded9('0x3'));var path=require(_0xded9('0x4'));var fs=require('fs');var _=require(_0xded9('0x5'));var Redis=require('ioredis');var htmlToText=require(_0xded9('0x6'));var qs=require(_0xded9('0x7'));var logger=require(_0xded9('0x8'))('api');var interaction_log=require(_0xded9('0x8'))(_0xded9('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xded9('0xa')](config['redis'],{'host':_0xded9('0xb'),'port':0x18eb});var socket=require(_0xded9('0xc'))(new Redis(config[_0xded9('0xd')]));var htmlEntities=require('html-entities');require(_0xded9('0xe'))[_0xded9('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xded9('0x10')]['http']({'port':0x232c});var client9003=jayson[_0xded9('0x10')][_0xded9('0x11')]({'port':0x232b});var client9002=jayson[_0xded9('0x10')][_0xded9('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x267dec,_0x203801,_0x5cc1bb,_0x52eae5){return new BPromise(function(_0x3bd3af,_0x3789c2){var _0xe36743=_0x52eae5||client;return _0xe36743[_0xded9('0x12')](_0x267dec,_0x5cc1bb)[_0xded9('0x13')](function(_0x42aec7){logger[_0xded9('0x14')]('MailMessage,\x20%s,\x20%s',_0x203801,_0xded9('0x15'));logger[_0xded9('0x16')](_0xded9('0x17'),_0x203801,_0xded9('0x15'),JSON[_0xded9('0x18')](_0x42aec7));if(_0x42aec7[_0xded9('0x19')]){if(_0x42aec7[_0xded9('0x19')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x203801,_0x42aec7[_0xded9('0x19')][_0xded9('0x1a')]);return _0x3789c2(_0x42aec7[_0xded9('0x19')]['message']);}logger['error'](_0xded9('0x1b'),_0x203801,_0x42aec7[_0xded9('0x19')][_0xded9('0x1a')]);return _0x3bd3af(_0x42aec7['error'][_0xded9('0x1a')]);}else{logger['info'](_0xded9('0x1b'),_0x203801,_0xded9('0x15'));_0x3bd3af(_0x42aec7[_0xded9('0x1c')][_0xded9('0x1a')]);}})[_0xded9('0x1d')](function(_0x49541b){logger[_0xded9('0x19')](_0xded9('0x1b'),_0x203801,_0x49541b);_0x3789c2(_0x49541b);});});}function respondWithResult(_0x44ab1a,_0x2243fe){_0x2243fe=_0x2243fe||0xc8;return function(_0x13f24d){if(_0x13f24d){return _0x44ab1a['status'](_0x2243fe)['json'](_0x13f24d);}};}function respondWithFilteredResult(_0x1c682c,_0x177d81){return function(_0xbd52f7){if(_0xbd52f7){var _0x42e72f=typeof _0x177d81[_0xded9('0x1e')]===_0xded9('0x1f')&&typeof _0x177d81[_0xded9('0x20')]===_0xded9('0x1f');var _0x398fa6=_0xbd52f7[_0xded9('0x21')];var _0x38a8d2=_0x42e72f?0x0:_0x177d81[_0xded9('0x1e')];var _0x23975b=_0x42e72f?_0xbd52f7[_0xded9('0x21')]:_0x177d81[_0xded9('0x1e')]+_0x177d81[_0xded9('0x20')];var _0x4f2a0c;if(_0x23975b>=_0x398fa6){_0x23975b=_0x398fa6;_0x4f2a0c=0xc8;}else{_0x4f2a0c=0xce;}_0x1c682c['status'](_0x4f2a0c);return _0x1c682c[_0xded9('0x22')](_0xded9('0x23'),_0x38a8d2+'-'+_0x23975b+'/'+_0x398fa6)[_0xded9('0x24')](_0xbd52f7);}return null;};}function saveUpdates(_0x2eafe2){return function(_0x9178b0){if(_0x9178b0){return _0x9178b0[_0xded9('0x25')](_0x2eafe2)[_0xded9('0x13')](function(_0x4ae00a){return _0x4ae00a;});}return null;};}function removeEntity(_0x59ccea){return function(_0x4d83e4){if(_0x4d83e4){return _0x4d83e4[_0xded9('0x26')]()[_0xded9('0x13')](function(){_0x59ccea[_0xded9('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x610826){return function(_0x397909){if(!_0x397909){_0x610826[_0xded9('0x28')](0x194);}return _0x397909;};}function handleError(_0x149c9c,_0x1f61a0){_0x1f61a0=_0x1f61a0||0x1f4;return function(_0xd969ba){logger[_0xded9('0x19')](_0xd969ba[_0xded9('0x29')]);if(_0xd969ba[_0xded9('0x2a')]){delete _0xd969ba[_0xded9('0x2a')];}_0x149c9c[_0xded9('0x27')](_0x1f61a0)['send'](_0xd969ba);};}exports[_0xded9('0x2b')]=function(_0x665de7,_0x2302aa){var _0x52d94f={},_0x5e10d2={},_0x1680e8={'count':0x0,'rows':[]};var _0x46ec24=_['map'](db[_0xded9('0x2c')][_0xded9('0x2d')],function(_0x3cf15c){return{'name':_0x3cf15c['fieldName'],'type':_0x3cf15c['type']['key']};});_0x5e10d2['model']=_[_0xded9('0x2e')](_0x46ec24,_0xded9('0x2a'));_0x5e10d2['query']=_[_0xded9('0x2f')](_0x665de7[_0xded9('0x30')]);_0x5e10d2['filters']=_[_0xded9('0x31')](_0x5e10d2['model'],_0x5e10d2[_0xded9('0x30')]);_0x52d94f[_0xded9('0x32')]=_[_0xded9('0x31')](_0x5e10d2['model'],qs[_0xded9('0x33')](_0x665de7['query'][_0xded9('0x33')]));_0x52d94f[_0xded9('0x32')]=_0x52d94f[_0xded9('0x32')][_0xded9('0x34')]?_0x52d94f[_0xded9('0x32')]:_0x5e10d2[_0xded9('0x35')];if(!_0x665de7[_0xded9('0x30')]['hasOwnProperty'](_0xded9('0x36'))){_0x52d94f[_0xded9('0x20')]=qs[_0xded9('0x20')](_0x665de7[_0xded9('0x30')][_0xded9('0x20')]);_0x52d94f['offset']=qs[_0xded9('0x1e')](_0x665de7['query'][_0xded9('0x1e')]);}_0x52d94f[_0xded9('0x37')]=qs[_0xded9('0x38')](_0x665de7[_0xded9('0x30')]['sort']);_0x52d94f[_0xded9('0x39')]=qs[_0xded9('0x3a')](_[_0xded9('0x3b')](_0x665de7[_0xded9('0x30')],_0x5e10d2['filters']),_0x46ec24);if(_0x665de7[_0xded9('0x30')][_0xded9('0x3c')]){_0x52d94f[_0xded9('0x39')]=_[_0xded9('0x3d')](_0x52d94f[_0xded9('0x39')],{'$or':_[_0xded9('0x2e')](_0x46ec24,function(_0x315382){if(_0x315382[_0xded9('0x3e')]!==_0xded9('0x3f')){var _0x319483={};_0x319483[_0x315382['name']]={'$like':'%'+_0x665de7[_0xded9('0x30')][_0xded9('0x3c')]+'%'};return _0x319483;}})});}_0x52d94f=_['merge']({},_0x52d94f,_0x665de7[_0xded9('0x40')]);var _0x2f6dee={'where':_0x52d94f['where']};return db[_0xded9('0x2c')][_0xded9('0x21')](_0x2f6dee)[_0xded9('0x13')](function(_0x57c381){_0x1680e8[_0xded9('0x21')]=_0x57c381;if(_0x665de7['query']['includeAll']){_0x52d94f[_0xded9('0x41')]=[{'all':!![]}];}return db[_0xded9('0x2c')][_0xded9('0x42')](_0x52d94f);})[_0xded9('0x13')](function(_0x1e4458){_0x1680e8[_0xded9('0x43')]=_0x1e4458;return _0x1680e8;})[_0xded9('0x13')](respondWithFilteredResult(_0x2302aa,_0x52d94f))[_0xded9('0x1d')](handleError(_0x2302aa,null));};exports[_0xded9('0x44')]=function(_0x15eba8,_0xfb19ab){var _0x1ca1e1={'raw':!![],'where':{'id':_0x15eba8[_0xded9('0x45')]['id']}},_0x9660fa={};_0x9660fa[_0xded9('0x35')]=_['keys'](db['MailMessage'][_0xded9('0x2d')]);_0x9660fa[_0xded9('0x30')]=_['keys'](_0x15eba8[_0xded9('0x30')]);_0x9660fa[_0xded9('0x3a')]=_[_0xded9('0x31')](_0x9660fa[_0xded9('0x35')],_0x9660fa[_0xded9('0x30')]);_0x1ca1e1[_0xded9('0x32')]=_['intersection'](_0x9660fa[_0xded9('0x35')],qs[_0xded9('0x33')](_0x15eba8['query'][_0xded9('0x33')]));_0x1ca1e1[_0xded9('0x32')]=_0x1ca1e1[_0xded9('0x32')][_0xded9('0x34')]?_0x1ca1e1[_0xded9('0x32')]:_0x9660fa[_0xded9('0x35')];if(_0x15eba8['query'][_0xded9('0x46')]){_0x1ca1e1[_0xded9('0x41')]=[{'all':!![]}];}_0x1ca1e1=_[_0xded9('0x3d')]({},_0x1ca1e1,_0x15eba8[_0xded9('0x40')]);return db[_0xded9('0x2c')]['find'](_0x1ca1e1)[_0xded9('0x13')](handleEntityNotFound(_0xfb19ab,null))['then'](respondWithResult(_0xfb19ab,null))['catch'](handleError(_0xfb19ab,null));};exports[_0xded9('0x25')]=function(_0x20aa6c,_0x2508bd){if(_0x20aa6c[_0xded9('0x47')]['id']){delete _0x20aa6c[_0xded9('0x47')]['id'];}return db[_0xded9('0x2c')]['find']({'where':{'id':_0x20aa6c[_0xded9('0x45')]['id']}})[_0xded9('0x13')](handleEntityNotFound(_0x2508bd,null))['then'](saveUpdates(_0x20aa6c[_0xded9('0x47')],null))['then'](respondWithResult(_0x2508bd,null))[_0xded9('0x1d')](handleError(_0x2508bd,null));};exports[_0xded9('0x26')]=function(_0x16a4a5,_0x496620){return db['MailMessage'][_0xded9('0x48')]({'where':{'id':_0x16a4a5[_0xded9('0x45')]['id']}})[_0xded9('0x13')](handleEntityNotFound(_0x496620,null))[_0xded9('0x13')](removeEntity(_0x496620,null))[_0xded9('0x1d')](handleError(_0x496620,null));};exports[_0xded9('0x49')]=function(_0x11ab91,_0x42519e){return db[_0xded9('0x2c')][_0xded9('0x49')]()[_0xded9('0x13')](respondWithResult(_0x42519e,null))['catch'](handleError(_0x42519e,null));};exports[_0xded9('0x4a')]=function(_0xff8be2,_0x3a08d8){return db[_0xded9('0x2c')]['create'](_0xff8be2[_0xded9('0x47')])['then'](function(_0x218b39){if(_0x218b39){if(_0x218b39['direction']===_0xded9('0x4b')&&!_0x218b39[_0xded9('0x4c')]){var _0x3d8e68,_0x5dfe6e,_0xb21327;if(_0xff8be2[_0xded9('0x47')]['to']){_0x5dfe6e=_0xff8be2[_0xded9('0x47')]['to'][_0xded9('0x4d')](',')[0x0];}return db[_0xded9('0x4e')][_0xded9('0x4f')]({'where':{'id':_0x218b39[_0xded9('0x50')]},'include':[{'model':db[_0xded9('0x51')],'as':_0xded9('0x52'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x5dfe6e},'limit':0x1,'order':[[_0xded9('0x53'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x38c2ed){_0x3d8e68=_0x38c2ed;if(!_0x3d8e68||!_0x3d8e68[_0xded9('0x54')])return;var _0x295455=_0x3d8e68['getSmtpOptions']();if(_0xff8be2[_0xded9('0x47')][_0xded9('0x55')]&&_0xff8be2[_0xded9('0x47')][_0xded9('0x55')]['length']){for(var _0x1b089b=0x0;_0x1b089b<_0xff8be2[_0xded9('0x47')]['attachments'][_0xded9('0x34')];_0x1b089b+=0x1){_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b]={'filename':_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b]['name'],'path':path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x58'),_0xff8be2[_0xded9('0x47')][_0xded9('0x55')][_0x1b089b][_0xded9('0x59')])};}}_0xb21327={'account':_0x295455,'message':_0xff8be2[_0xded9('0x47')]};return;})[_0xded9('0x13')](function(){if(_0x3d8e68[_0xded9('0x52')]){if(_0x3d8e68[_0xded9('0x52')]['Contacts']['length']){return _0x3d8e68[_0xded9('0x52')][_0xded9('0x5a')][0x0];}else{return db[_0xded9('0x5b')][_0xded9('0x4a')](_[_0xded9('0xa')](_0xff8be2[_0xded9('0x47')],{'firstName':_0xff8be2[_0xded9('0x47')]['to'],'email':_0xff8be2['body']['to'],'phone':_0xff8be2[_0xded9('0x47')]['to'],'ListId':_0x3d8e68[_0xded9('0x5c')]}));}}else{throw new Error(_0xded9('0x5d'));}})[_0xded9('0x13')](function(){if(_0xb21327){return respondWithRpcPromise(_0xded9('0x5e'),_0xded9('0x5f'),_0xb21327,client9003)[_0xded9('0x13')](function(_0x24a0ba){return _0x218b39[_0xded9('0x25')]({'read':!![],'messageId':_0x24a0ba['messageId'],'sentAt':moment()[_0xded9('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xded9('0x1d')](function(_0x4178ff){logger[_0xded9('0x19')]('%s',JSON['stringify'](_0x4178ff));return _0x218b39;});}return _0x218b39;});}return _0x218b39;}})[_0xded9('0x13')](respondWithResult(_0x3a08d8,0xc9))[_0xded9('0x1d')](handleError(_0x3a08d8,null));};exports[_0xded9('0x61')]=function(_0xc2498,_0x3b3e16){var _0x29170e={'agent':{},'channel':_0xded9('0x62')};if(_0xc2498[_0xded9('0x47')]['id']){delete _0xc2498[_0xded9('0x47')]['id'];}_0xc2498[_0xded9('0x47')][_0xded9('0x63')]=!![];_0xc2498['body'][_0xded9('0x64')]=moment()[_0xded9('0x60')](_0xded9('0x65'));_0xc2498['body']['UserId']=_0xc2498[_0xded9('0x47')][_0xded9('0x66')]||_0xc2498[_0xded9('0x67')]['id'];_0x29170e['agent']['id']=_0xc2498[_0xded9('0x47')]['UserId'];return db['MailMessage'][_0xded9('0x48')]({'where':{'id':_0xc2498['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b3e16,null))[_0xded9('0x13')](saveUpdates(_0xc2498[_0xded9('0x47')],null))[_0xded9('0x13')](function(_0x55607c){if(_0x55607c){_0x29170e[_0xded9('0x1a')]=_0x55607c['get']({'plain':!![]});return db[_0xded9('0x68')][_0xded9('0x48')]({'where':{'id':_0x55607c[_0xded9('0x69')]}});}return null;})[_0xded9('0x13')](handleEntityNotFound(_0x3b3e16,null))[_0xded9('0x13')](function(_0x23af91){if(_0x23af91){return _0x23af91[_0xded9('0x25')]({'UserId':_0xc2498['body'][_0xded9('0x66')],'read1stAt':_['isNil'](_0x23af91[_0xded9('0x6a')])?moment()[_0xded9('0x60')](_0xded9('0x65')):undefined});}return null;})[_0xded9('0x13')](function(_0x2c5c88){if(_0x2c5c88){_0x29170e[_0xded9('0x6b')]=_0x2c5c88[_0xded9('0x6c')]({'plain':!![]});interaction_log[_0xded9('0x14')](_0xded9('0x6d'),_0xc2498[_0xded9('0x67')]['id'],_0xc2498[_0xded9('0x67')]['name'],_0xc2498[_0xded9('0x67')][_0xded9('0x6e')],_0x29170e[_0xded9('0x6b')]['id'],_0xc2498[_0xded9('0x47')]?JSON[_0xded9('0x18')](_0xc2498[_0xded9('0x47')]):_0xded9('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xded9('0x70'),_0x29170e);}return null;})[_0xded9('0x13')](function(_0x599061){var _0x48cb42='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x599061[_0xded9('0x1a')][_0xded9('0x71')];return db[_0xded9('0x72')]['query'](_0x48cb42,{'type':db[_0xded9('0x73')]['QueryTypes'][_0xded9('0x74')],'raw':!![]})['then'](function(_0x1f3c08){return _0x1f3c08;});})['then'](function(_0xebce82){if(_0xebce82){_0x29170e[_0xded9('0x1a')][_0xded9('0x75')]=_0xebce82[0x0];if(!_0xc2498[_0xded9('0x47')][_0xded9('0x66')])return;return db[_0xded9('0x76')][_0xded9('0x48')]({'where':{'id':_0xc2498['body'][_0xded9('0x66')],'role':'agent'},'attributes':['id',_0xded9('0x2a'),_0xded9('0x77'),'email',_0xded9('0x78')],'raw':!![]});}return null;})['then'](function(_0x3444a0){if(!_0x3444a0)return null;_0x29170e['message'][_0xded9('0x79')]=_0x3444a0;return _0x29170e;})[_0xded9('0x13')](function(_0x2b46b1){if(_0x2b46b1){if(_0xc2498[_0xded9('0x47')][_0xded9('0x7a')]){_0x29170e[_0xded9('0x1a')][_0xded9('0x7b')]=util['format'](_0xded9('0x7c'),_0xc2498[_0xded9('0x67')][_0xded9('0x2a')]);_0x29170e['message'][_0xded9('0x7d')]=_0x29170e[_0xded9('0x7d')];_0x29170e[_0xded9('0x1a')]['motionChannel']=_0x29170e['channel'];_0x29170e[_0xded9('0x1a')]['event']=_0xded9('0x61');_0x29170e[_0xded9('0x1a')][_0xded9('0x47')]=htmlToText[_0xded9('0x7e')](_0x29170e[_0xded9('0x1a')][_0xded9('0x47')]);return respondWithRpcPromise(_0xded9('0x7f'),_0xded9('0x7f'),{'event':_0xded9('0x80'),'message':_0x29170e['message']},client9002)[_0xded9('0x13')](function(){return _0x29170e;});}return _0x29170e;}return null;})[_0xded9('0x13')](respondWithResult(_0x3b3e16,null))[_0xded9('0x1d')](handleError(_0x3b3e16,null));};exports[_0xded9('0x81')]=function(_0x2773e4,_0x222ab0){var _0x5caa5f={'agent':{},'channel':_0xded9('0x62')};if(_0x2773e4[_0xded9('0x47')]['id']){delete _0x2773e4[_0xded9('0x47')]['id'];}_0x2773e4[_0xded9('0x47')][_0xded9('0x66')]=_0x2773e4[_0xded9('0x47')][_0xded9('0x66')]||_0x2773e4[_0xded9('0x67')]['id'];_0x5caa5f[_0xded9('0x79')]['id']=_0x2773e4[_0xded9('0x47')][_0xded9('0x66')];return db[_0xded9('0x2c')]['find']({'where':{'id':_0x2773e4[_0xded9('0x45')]['id'],'UserId':null}})[_0xded9('0x13')](handleEntityNotFound(_0x222ab0,null))['then'](function(_0x2f6069){if(_0x2f6069){_0x5caa5f['message']=_0x2f6069['get']({'plain':!![]});return db[_0xded9('0x68')][_0xded9('0x48')]({'where':{'id':_0x2f6069['MailInteractionId']}});}return null;})[_0xded9('0x13')](handleEntityNotFound(_0x222ab0,null))[_0xded9('0x13')](function(_0x4035c4){if(_0x4035c4){_0x5caa5f[_0xded9('0x6b')]=_0x4035c4[_0xded9('0x6c')]({'plain':!![]});interaction_log[_0xded9('0x14')](_0xded9('0x82'),_0x2773e4[_0xded9('0x67')]['id'],_0x2773e4[_0xded9('0x67')][_0xded9('0x2a')],_0x2773e4[_0xded9('0x67')][_0xded9('0x6e')],_0x5caa5f[_0xded9('0x6b')]['id'],_0x2773e4['body']?JSON[_0xded9('0x18')](_0x2773e4['body']):_0xded9('0x6f'));return respondWithRpcPromise(_0xded9('0x83'),_0xded9('0x84'),_0x5caa5f);}return null;})[_0xded9('0x13')](function(_0x5dbe8b){var _0x36f442=_0xded9('0x85')+_0x5dbe8b[_0xded9('0x1a')][_0xded9('0x71')];return db[_0xded9('0x72')]['query'](_0x36f442,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xded9('0x13')](function(_0x4e0c12){return _0x4e0c12;});})[_0xded9('0x13')](function(_0x51ed6b){if(_0x51ed6b){_0x5caa5f[_0xded9('0x1a')]['contact']=_0x51ed6b[0x0];if(!_0x2773e4['body'][_0xded9('0x66')])return;return db[_0xded9('0x76')][_0xded9('0x48')]({'where':{'id':_0x2773e4['body'][_0xded9('0x66')],'role':_0xded9('0x79')},'attributes':['id',_0xded9('0x2a'),_0xded9('0x77'),_0xded9('0x86'),_0xded9('0x78')],'raw':!![]});}return null;})[_0xded9('0x13')](function(_0x539bdf){if(!_0x539bdf)return null;_0x5caa5f[_0xded9('0x1a')]['agent']=_0x539bdf;return _0x5caa5f;})['then'](function(_0x41b47b){if(_0x41b47b){_0x41b47b[_0xded9('0x1a')][_0xded9('0x7b')]=util[_0xded9('0x60')](_0xded9('0x7c'),_0x2773e4[_0xded9('0x67')][_0xded9('0x2a')]);_0x41b47b[_0xded9('0x1a')][_0xded9('0x7d')]=_0x5caa5f['channel'];_0x41b47b['message'][_0xded9('0x87')]=_0x5caa5f[_0xded9('0x7d')];_0x41b47b['message'][_0xded9('0x88')]=_0xded9('0x81');_0x41b47b[_0xded9('0x1a')][_0xded9('0x47')]=htmlToText[_0xded9('0x7e')](_0x5caa5f[_0xded9('0x1a')]['body']);respondWithRpcPromise(_0xded9('0x7f'),_0xded9('0x7f'),{'event':_0xded9('0x89'),'message':_0x41b47b[_0xded9('0x1a')]},client9002);return _0x5caa5f;}return null;})[_0xded9('0x13')](respondWithResult(_0x222ab0,null))['catch'](handleError(_0x222ab0,null));};exports['download']=function(_0x252a54,_0x4f87e8){var _0x385c36=moment()['unix']()['toString']();var _0x65c1db=path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x8a'),'files',_0xded9('0x8b'));var _0x248df3=path[_0xded9('0x56')](config[_0xded9('0x57')],_0xded9('0x8a'),_0xded9('0x8c'),_0xded9('0x55'));var _0x42f14a=util[_0xded9('0x60')](_0xded9('0x8d'),_0x385c36);return db[_0xded9('0x2c')]['find']({'where':{'id':_0x252a54[_0xded9('0x45')]['id']},'attributes':['id',_0xded9('0x47'),_0xded9('0x8e'),'to','cc',_0xded9('0x8f'),'subject',_0xded9('0x90')],'include':_0x252a54[_0xded9('0x30')][_0xded9('0x55')]?[{'model':db['Attachment'],'as':_0xded9('0x91')}]:undefined})[_0xded9('0x13')](handleEntityNotFound(_0x4f87e8,null))[_0xded9('0x13')](function(_0x1c38e9){if(_0x1c38e9){var _0x464a2c=_0x1c38e9;var _0x1c1db2={'from':_0x464a2c[_0xded9('0x8e')],'to':_0x464a2c['to'],'subject':_0x464a2c[_0xded9('0x92')],'html':htmlEntities[_0xded9('0x93')](_0x464a2c[_0xded9('0x47')]),'headers':{'Date':moment(_0x464a2c[_0xded9('0x90')])['format'](_0xded9('0x94'))},'attachments':[]};if(_0x1c38e9['cc']){_0x1c1db2[_0xded9('0x95')]['Cc']=_0x1c38e9['cc'];}if(_0x1c38e9['bcc']){_0x1c1db2[_0xded9('0x95')][_0xded9('0x96')]=_0x1c38e9[_0xded9('0x8f')];}return new BPromise(function(_0x310b47,_0x151fb1){if(_0x1c38e9[_0xded9('0x91')]){for(var _0xfb1c11=0x0;_0xfb1c11<_0x1c38e9['Attachments'][_0xded9('0x34')];_0xfb1c11++){var _0x52f93e=_0x1c38e9[_0xded9('0x91')][_0xfb1c11];var _0x4185d1=path[_0xded9('0x56')](_0x248df3,_0x52f93e[_0xded9('0x59')]);if(fs[_0xded9('0x97')](_0x4185d1)){_0x1c1db2['attachments'][_0xded9('0x98')]({'name':_0x52f93e[_0xded9('0x2a')],'contentType':_0x52f93e[_0xded9('0x3e')],'data':fs[_0xded9('0x99')](_0x4185d1)});}}}emlformat[_0xded9('0x9a')](_0x1c1db2,function(_0x35e541,_0x10e453){if(_0x35e541)return _0x151fb1(_0x35e541);fs[_0xded9('0x9b')](path[_0xded9('0x56')](_0x65c1db,_0x42f14a),_0x10e453);return _0x310b47(_0x10e453);});});}})[_0xded9('0x13')](function(_0x359c82){if(_0x359c82){return _0x4f87e8['download'](path['join'](_0x65c1db,_0x42f14a),_0x42f14a,function(_0x4f7b0d){if(!_0x4f7b0d)fs['unlinkSync'](path[_0xded9('0x56')](_0x65c1db,_0x42f14a));});}})[_0xded9('0x1d')](handleError(_0x4f87e8,null));}; \ No newline at end of file +var _0x69a9=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','body','describe','create','out','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','defaults','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','read','readAt','user','agent','UserId','MailInteraction','isNil','read1stAt','format','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','event','reject','fromString','download','unix','toString','root','files','tmp','server','message-%s.eml','from','createdAt','Attachment','decode','headers','Bcc','bcc','Attachments','basename','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x69a9,0x1a5));var _0x969a=function(_0x3f53f7,_0x17573f){_0x3f53f7=_0x3f53f7-0x0;var _0x4220ea=_0x69a9[_0x3f53f7];return _0x4220ea;};'use strict';var emlformat=require(_0x969a('0x0'));var moment=require(_0x969a('0x1'));var BPromise=require(_0x969a('0x2'));var util=require(_0x969a('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x969a('0x4'));var Redis=require(_0x969a('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x969a('0x6'));var logger=require(_0x969a('0x7'))('api');var interaction_log=require(_0x969a('0x7'))(_0x969a('0x8'));var config=require(_0x969a('0x9'));var db=require(_0x969a('0xa'))['db'];config[_0x969a('0xb')]=_['defaults'](config[_0x969a('0xb')],{'host':_0x969a('0xc'),'port':0x18eb});var socket=require(_0x969a('0xd'))(new Redis(config[_0x969a('0xb')]));var htmlEntities=require(_0x969a('0xe'));require('./mailMessage.socket')[_0x969a('0xf')](socket);var jayson=require(_0x969a('0x10'));var client=jayson[_0x969a('0x11')][_0x969a('0x12')]({'port':0x232c});var client9003=jayson[_0x969a('0x11')][_0x969a('0x12')]({'port':0x232b});var client9002=jayson[_0x969a('0x11')][_0x969a('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x52486c,_0x486fab,_0x5ed722,_0x67df91){return new BPromise(function(_0x42fd63,_0xd4a611){var _0x315834=_0x67df91||client;return _0x315834[_0x969a('0x13')](_0x52486c,_0x5ed722)[_0x969a('0x14')](function(_0xff9be0){logger['info'](_0x969a('0x15'),_0x486fab,_0x969a('0x16'));logger['debug'](_0x969a('0x17'),_0x486fab,_0x969a('0x16'),JSON[_0x969a('0x18')](_0xff9be0));if(_0xff9be0['error']){if(_0xff9be0[_0x969a('0x19')][_0x969a('0x1a')]===0x1f4){logger[_0x969a('0x19')]('MailMessage,\x20%s,\x20%s',_0x486fab,_0xff9be0[_0x969a('0x19')][_0x969a('0x1b')]);return _0xd4a611(_0xff9be0[_0x969a('0x19')]['message']);}logger[_0x969a('0x19')](_0x969a('0x15'),_0x486fab,_0xff9be0[_0x969a('0x19')][_0x969a('0x1b')]);return _0x42fd63(_0xff9be0[_0x969a('0x19')]['message']);}else{logger[_0x969a('0x1c')]('MailMessage,\x20%s,\x20%s',_0x486fab,'request\x20sent');_0x42fd63(_0xff9be0[_0x969a('0x1d')][_0x969a('0x1b')]);}})[_0x969a('0x1e')](function(_0x532dc4){logger['error']('MailMessage,\x20%s,\x20%s',_0x486fab,_0x532dc4);_0xd4a611(_0x532dc4);});});}function respondWithResult(_0xf3a870,_0x701d4){_0x701d4=_0x701d4||0xc8;return function(_0x213075){if(_0x213075){return _0xf3a870[_0x969a('0x1f')](_0x701d4)['json'](_0x213075);}};}function respondWithFilteredResult(_0x598bc4,_0x3d3a46){return function(_0x16f579){if(_0x16f579){var _0x4f3fed=typeof _0x3d3a46[_0x969a('0x20')]===_0x969a('0x21')&&typeof _0x3d3a46[_0x969a('0x22')]===_0x969a('0x21');var _0x1c2de9=_0x16f579[_0x969a('0x23')];var _0x538e0d=_0x4f3fed?0x0:_0x3d3a46[_0x969a('0x20')];var _0x5d4bf5=_0x4f3fed?_0x16f579[_0x969a('0x23')]:_0x3d3a46[_0x969a('0x20')]+_0x3d3a46[_0x969a('0x22')];var _0x57c04a;if(_0x5d4bf5>=_0x1c2de9){_0x5d4bf5=_0x1c2de9;_0x57c04a=0xc8;}else{_0x57c04a=0xce;}_0x598bc4[_0x969a('0x1f')](_0x57c04a);return _0x598bc4[_0x969a('0x24')](_0x969a('0x25'),_0x538e0d+'-'+_0x5d4bf5+'/'+_0x1c2de9)['json'](_0x16f579);}return null;};}function saveUpdates(_0x123751){return function(_0x30c2c1){if(_0x30c2c1){return _0x30c2c1[_0x969a('0x26')](_0x123751)['then'](function(_0x103dd2){return _0x103dd2;});}return null;};}function removeEntity(_0x22a74c){return function(_0x54264c){if(_0x54264c){return _0x54264c[_0x969a('0x27')]()[_0x969a('0x14')](function(){_0x22a74c[_0x969a('0x1f')](0xcc)[_0x969a('0x28')]();});}};}function handleEntityNotFound(_0xfb097f){return function(_0x22f14d){if(!_0x22f14d){_0xfb097f[_0x969a('0x29')](0x194);}return _0x22f14d;};}function handleError(_0x45748f,_0x10e8ac){_0x10e8ac=_0x10e8ac||0x1f4;return function(_0x549550){logger[_0x969a('0x19')](_0x549550[_0x969a('0x2a')]);if(_0x549550[_0x969a('0x2b')]){delete _0x549550[_0x969a('0x2b')];}_0x45748f[_0x969a('0x1f')](_0x10e8ac)[_0x969a('0x2c')](_0x549550);};}exports[_0x969a('0x2d')]=function(_0x50d762,_0x5a4170){var _0x2955c8={},_0x87e99b={},_0x4158c5={'count':0x0,'rows':[]};var _0x29d87b=_[_0x969a('0x2e')](db[_0x969a('0x2f')]['rawAttributes'],function(_0x8a542b){return{'name':_0x8a542b[_0x969a('0x30')],'type':_0x8a542b[_0x969a('0x31')]['key']};});_0x87e99b['model']=_['map'](_0x29d87b,_0x969a('0x2b'));_0x87e99b[_0x969a('0x32')]=_['keys'](_0x50d762['query']);_0x87e99b[_0x969a('0x33')]=_[_0x969a('0x34')](_0x87e99b[_0x969a('0x35')],_0x87e99b['query']);_0x2955c8[_0x969a('0x36')]=_[_0x969a('0x34')](_0x87e99b[_0x969a('0x35')],qs['fields'](_0x50d762[_0x969a('0x32')][_0x969a('0x37')]));_0x2955c8['attributes']=_0x2955c8[_0x969a('0x36')][_0x969a('0x38')]?_0x2955c8[_0x969a('0x36')]:_0x87e99b[_0x969a('0x35')];if(!_0x50d762[_0x969a('0x32')][_0x969a('0x39')](_0x969a('0x3a'))){_0x2955c8['limit']=qs[_0x969a('0x22')](_0x50d762[_0x969a('0x32')]['limit']);_0x2955c8[_0x969a('0x20')]=qs[_0x969a('0x20')](_0x50d762['query'][_0x969a('0x20')]);}_0x2955c8[_0x969a('0x3b')]=qs[_0x969a('0x3c')](_0x50d762[_0x969a('0x32')]['sort']);_0x2955c8[_0x969a('0x3d')]=qs[_0x969a('0x33')](_['pick'](_0x50d762[_0x969a('0x32')],_0x87e99b[_0x969a('0x33')]),_0x29d87b);if(_0x50d762['query'][_0x969a('0x3e')]){_0x2955c8[_0x969a('0x3d')]=_[_0x969a('0x3f')](_0x2955c8[_0x969a('0x3d')],{'$or':_['map'](_0x29d87b,function(_0x362d40){if(_0x362d40[_0x969a('0x31')]!==_0x969a('0x40')){var _0x709d60={};_0x709d60[_0x362d40[_0x969a('0x2b')]]={'$like':'%'+_0x50d762['query'][_0x969a('0x3e')]+'%'};return _0x709d60;}})});}_0x2955c8=_['merge']({},_0x2955c8,_0x50d762[_0x969a('0x41')]);var _0xb861d5={'where':_0x2955c8[_0x969a('0x3d')]};return db['MailMessage'][_0x969a('0x23')](_0xb861d5)['then'](function(_0x261d10){_0x4158c5[_0x969a('0x23')]=_0x261d10;if(_0x50d762[_0x969a('0x32')][_0x969a('0x42')]){_0x2955c8[_0x969a('0x43')]=[{'all':!![]}];}return db[_0x969a('0x2f')][_0x969a('0x44')](_0x2955c8);})[_0x969a('0x14')](function(_0x562252){_0x4158c5[_0x969a('0x45')]=_0x562252;return _0x4158c5;})[_0x969a('0x14')](respondWithFilteredResult(_0x5a4170,_0x2955c8))[_0x969a('0x1e')](handleError(_0x5a4170,null));};exports[_0x969a('0x46')]=function(_0x2722dc,_0x14d006){var _0x125d85={'raw':!![],'where':{'id':_0x2722dc[_0x969a('0x47')]['id']}},_0x33bfcb={};_0x33bfcb[_0x969a('0x35')]=_[_0x969a('0x48')](db['MailMessage'][_0x969a('0x49')]);_0x33bfcb['query']=_[_0x969a('0x48')](_0x2722dc[_0x969a('0x32')]);_0x33bfcb[_0x969a('0x33')]=_[_0x969a('0x34')](_0x33bfcb[_0x969a('0x35')],_0x33bfcb[_0x969a('0x32')]);_0x125d85['attributes']=_[_0x969a('0x34')](_0x33bfcb[_0x969a('0x35')],qs[_0x969a('0x37')](_0x2722dc['query'][_0x969a('0x37')]));_0x125d85[_0x969a('0x36')]=_0x125d85[_0x969a('0x36')]['length']?_0x125d85['attributes']:_0x33bfcb[_0x969a('0x35')];if(_0x2722dc[_0x969a('0x32')]['includeAll']){_0x125d85[_0x969a('0x43')]=[{'all':!![]}];}_0x125d85=_['merge']({},_0x125d85,_0x2722dc[_0x969a('0x41')]);return db[_0x969a('0x2f')][_0x969a('0x4a')](_0x125d85)['then'](handleEntityNotFound(_0x14d006,null))[_0x969a('0x14')](respondWithResult(_0x14d006,null))[_0x969a('0x1e')](handleError(_0x14d006,null));};exports['update']=function(_0x1f000b,_0x1f5aaa){if(_0x1f000b[_0x969a('0x4b')]['id']){delete _0x1f000b['body']['id'];}return db[_0x969a('0x2f')][_0x969a('0x4a')]({'where':{'id':_0x1f000b[_0x969a('0x47')]['id']}})[_0x969a('0x14')](handleEntityNotFound(_0x1f5aaa,null))[_0x969a('0x14')](saveUpdates(_0x1f000b['body'],null))['then'](respondWithResult(_0x1f5aaa,null))['catch'](handleError(_0x1f5aaa,null));};exports[_0x969a('0x27')]=function(_0xfa8a11,_0x2065f6){return db['MailMessage']['find']({'where':{'id':_0xfa8a11[_0x969a('0x47')]['id']}})[_0x969a('0x14')](handleEntityNotFound(_0x2065f6,null))['then'](removeEntity(_0x2065f6,null))[_0x969a('0x1e')](handleError(_0x2065f6,null));};exports[_0x969a('0x4c')]=function(_0x5eb42c,_0xed0bc8){return db[_0x969a('0x2f')][_0x969a('0x4c')]()['then'](respondWithResult(_0xed0bc8,null))[_0x969a('0x1e')](handleError(_0xed0bc8,null));};exports[_0x969a('0x4d')]=function(_0x111389,_0x1f0efc){return db[_0x969a('0x2f')][_0x969a('0x4d')](_0x111389[_0x969a('0x4b')])[_0x969a('0x14')](function(_0x3325d5){if(_0x3325d5){if(_0x3325d5['direction']===_0x969a('0x4e')&&!_0x3325d5[_0x969a('0x4f')]){var _0x539c67,_0x5e8993,_0x2bf7c7;if(_0x111389[_0x969a('0x4b')]['to']){_0x5e8993=_0x111389[_0x969a('0x4b')]['to']['split'](',')[0x0];}return db[_0x969a('0x50')][_0x969a('0x51')]({'where':{'id':_0x3325d5[_0x969a('0x52')]},'include':[{'model':db[_0x969a('0x53')],'as':_0x969a('0x54'),'include':[{'model':db[_0x969a('0x55')],'as':_0x969a('0x56'),'where':{'email':_0x5e8993},'limit':0x1,'order':[['updatedAt',_0x969a('0x57')]]}]},{'model':db[_0x969a('0x58')],'as':_0x969a('0x59'),'raw':!![],'include':[{'model':db[_0x969a('0x5a')],'as':_0x969a('0x5a'),'raw':!![]}]}]})[_0x969a('0x14')](function(_0x31fafa){_0x539c67=_0x31fafa;if(!_0x539c67||!_0x539c67['Smtp'])return;var _0x5e54cc=_0x539c67[_0x969a('0x5b')]();if(_0x111389['body'][_0x969a('0x5c')]&&_0x111389[_0x969a('0x4b')][_0x969a('0x5c')]['length']){for(var _0x3ba968=0x0;_0x3ba968<_0x111389[_0x969a('0x4b')][_0x969a('0x5c')][_0x969a('0x38')];_0x3ba968+=0x1){_0x111389[_0x969a('0x4b')]['attachments'][_0x3ba968]={'filename':_0x111389[_0x969a('0x4b')][_0x969a('0x5c')][_0x3ba968][_0x969a('0x2b')],'path':path[_0x969a('0x5d')](config['root'],_0x969a('0x5e'),_0x111389[_0x969a('0x4b')][_0x969a('0x5c')][_0x3ba968]['basename'])};}}_0x2bf7c7={'account':_0x5e54cc,'message':_0x111389[_0x969a('0x4b')]};return;})[_0x969a('0x14')](function(){if(_0x539c67['List']){if(_0x539c67[_0x969a('0x54')][_0x969a('0x56')]['length']){return _0x539c67['List'][_0x969a('0x56')][0x0];}else{return db[_0x969a('0x55')][_0x969a('0x4d')](_[_0x969a('0x5f')](_0x111389[_0x969a('0x4b')],{'firstName':_0x111389[_0x969a('0x4b')]['to'],'email':_0x111389[_0x969a('0x4b')]['to'],'phone':_0x111389[_0x969a('0x4b')]['to'],'ListId':_0x539c67['ListId']}));}}else{throw new Error(_0x969a('0x60'));}})['then'](function(){if(_0x2bf7c7){return respondWithRpcPromise(_0x969a('0x61'),_0x969a('0x62'),_0x2bf7c7,client9003)[_0x969a('0x14')](function(_0x27e72b){return _0x3325d5[_0x969a('0x26')]({'read':!![],'messageId':_0x27e72b[_0x969a('0x63')],'sentAt':moment()['format'](_0x969a('0x64'))});})[_0x969a('0x1e')](function(_0x216152){logger[_0x969a('0x19')]('%s',JSON[_0x969a('0x18')](_0x216152));return _0x3325d5;});}return _0x3325d5;});}return _0x3325d5;}})[_0x969a('0x14')](respondWithResult(_0x1f0efc,0xc9))[_0x969a('0x1e')](handleError(_0x1f0efc,null));};exports['accept']=function(_0x430ea8,_0x5236c3){var _0x4e6d42={'agent':{},'channel':_0x969a('0x65')};if(_0x430ea8[_0x969a('0x4b')]['id']){delete _0x430ea8[_0x969a('0x4b')]['id'];}_0x430ea8[_0x969a('0x4b')][_0x969a('0x66')]=!![];_0x430ea8[_0x969a('0x4b')][_0x969a('0x67')]=moment()['format'](_0x969a('0x64'));_0x430ea8[_0x969a('0x4b')]['UserId']=_0x430ea8[_0x969a('0x4b')]['UserId']||_0x430ea8[_0x969a('0x68')]['id'];_0x4e6d42[_0x969a('0x69')]['id']=_0x430ea8[_0x969a('0x4b')][_0x969a('0x6a')];return db['MailMessage'][_0x969a('0x4a')]({'where':{'id':_0x430ea8['params']['id'],'UserId':null}})[_0x969a('0x14')](handleEntityNotFound(_0x5236c3,null))[_0x969a('0x14')](saveUpdates(_0x430ea8[_0x969a('0x4b')],null))[_0x969a('0x14')](function(_0x12670d){if(_0x12670d){_0x4e6d42[_0x969a('0x1b')]=_0x12670d['get']({'plain':!![]});return db[_0x969a('0x6b')][_0x969a('0x4a')]({'where':{'id':_0x12670d['MailInteractionId']}});}return null;})[_0x969a('0x14')](handleEntityNotFound(_0x5236c3,null))[_0x969a('0x14')](function(_0x5d17c0){if(_0x5d17c0){return _0x5d17c0[_0x969a('0x26')]({'UserId':_0x430ea8['body'][_0x969a('0x6a')],'read1stAt':_[_0x969a('0x6c')](_0x5d17c0[_0x969a('0x6d')])?moment()[_0x969a('0x6e')](_0x969a('0x64')):undefined});}return null;})['then'](function(_0x151939){if(_0x151939){_0x4e6d42[_0x969a('0x6f')]=_0x151939[_0x969a('0x70')]({'plain':!![]});interaction_log[_0x969a('0x1c')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x430ea8[_0x969a('0x68')]['id'],_0x430ea8[_0x969a('0x68')][_0x969a('0x2b')],_0x430ea8[_0x969a('0x68')][_0x969a('0x71')],_0x4e6d42['interaction']['id'],_0x430ea8[_0x969a('0x4b')]?JSON[_0x969a('0x18')](_0x430ea8[_0x969a('0x4b')]):_0x969a('0x72'));return respondWithRpcPromise(_0x969a('0x73'),_0x969a('0x74'),_0x4e6d42);}return null;})[_0x969a('0x14')](function(_0x2d5c33){var _0x277a7c=_0x969a('0x75')+_0x2d5c33[_0x969a('0x1b')][_0x969a('0x76')];return db[_0x969a('0x77')][_0x969a('0x32')](_0x277a7c,{'type':db[_0x969a('0x78')][_0x969a('0x79')][_0x969a('0x7a')],'raw':!![]})[_0x969a('0x14')](function(_0x445340){return _0x445340;});})['then'](function(_0x8fb426){if(_0x8fb426){_0x4e6d42[_0x969a('0x1b')]['contact']=_0x8fb426[0x0];if(!_0x430ea8[_0x969a('0x4b')]['UserId'])return;return db['User']['find']({'where':{'id':_0x430ea8[_0x969a('0x4b')][_0x969a('0x6a')],'role':_0x969a('0x69')},'attributes':['id',_0x969a('0x2b'),'fullname',_0x969a('0x7b'),_0x969a('0x7c')],'raw':!![]});}return null;})[_0x969a('0x14')](function(_0x689faf){if(!_0x689faf)return null;_0x4e6d42[_0x969a('0x1b')][_0x969a('0x69')]=_0x689faf;return _0x4e6d42;})[_0x969a('0x14')](function(_0x2d1526){if(_0x2d1526){if(_0x430ea8['body']['manual']){_0x4e6d42[_0x969a('0x1b')]['interface']=util[_0x969a('0x6e')](_0x969a('0x7d'),_0x430ea8[_0x969a('0x68')][_0x969a('0x2b')]);_0x4e6d42[_0x969a('0x1b')]['channel']=_0x4e6d42[_0x969a('0x7e')];_0x4e6d42[_0x969a('0x1b')][_0x969a('0x7f')]=_0x4e6d42[_0x969a('0x7e')];_0x4e6d42[_0x969a('0x1b')]['event']=_0x969a('0x80');_0x4e6d42['message']['body']=htmlToText['fromString'](_0x4e6d42[_0x969a('0x1b')]['body']);return respondWithRpcPromise(_0x969a('0x81'),_0x969a('0x81'),{'event':_0x969a('0x82'),'message':_0x4e6d42[_0x969a('0x1b')]},client9002)[_0x969a('0x14')](function(){return _0x4e6d42;});}return _0x4e6d42;}return null;})[_0x969a('0x14')](respondWithResult(_0x5236c3,null))['catch'](handleError(_0x5236c3,null));};exports['reject']=function(_0x482b56,_0x5d8dbf){var _0x562b30={'agent':{},'channel':_0x969a('0x65')};if(_0x482b56['body']['id']){delete _0x482b56['body']['id'];}_0x482b56[_0x969a('0x4b')][_0x969a('0x6a')]=_0x482b56[_0x969a('0x4b')]['UserId']||_0x482b56['user']['id'];_0x562b30['agent']['id']=_0x482b56[_0x969a('0x4b')][_0x969a('0x6a')];return db[_0x969a('0x2f')]['find']({'where':{'id':_0x482b56['params']['id'],'UserId':null}})[_0x969a('0x14')](handleEntityNotFound(_0x5d8dbf,null))['then'](function(_0x2441db){if(_0x2441db){_0x562b30[_0x969a('0x1b')]=_0x2441db[_0x969a('0x70')]({'plain':!![]});return db['MailInteraction'][_0x969a('0x4a')]({'where':{'id':_0x2441db[_0x969a('0x83')]}});}return null;})[_0x969a('0x14')](handleEntityNotFound(_0x5d8dbf,null))['then'](function(_0x2af623){if(_0x2af623){_0x562b30[_0x969a('0x6f')]=_0x2af623[_0x969a('0x70')]({'plain':!![]});interaction_log['info'](_0x969a('0x84'),_0x482b56['user']['id'],_0x482b56['user']['name'],_0x482b56['user']['role'],_0x562b30[_0x969a('0x6f')]['id'],_0x482b56[_0x969a('0x4b')]?JSON['stringify'](_0x482b56[_0x969a('0x4b')]):'null');return respondWithRpcPromise('RejectMessage',_0x969a('0x85'),_0x562b30);}return null;})['then'](function(_0x494c63){var _0x3aa78e=_0x969a('0x75')+_0x494c63[_0x969a('0x1b')][_0x969a('0x76')];return db[_0x969a('0x77')][_0x969a('0x32')](_0x3aa78e,{'type':db['Sequelize'][_0x969a('0x79')][_0x969a('0x7a')],'raw':!![]})['then'](function(_0x4d43ca){return _0x4d43ca;});})['then'](function(_0x279bc4){if(_0x279bc4){_0x562b30[_0x969a('0x1b')]['contact']=_0x279bc4[0x0];if(!_0x482b56[_0x969a('0x4b')][_0x969a('0x6a')])return;return db['User']['find']({'where':{'id':_0x482b56[_0x969a('0x4b')]['UserId'],'role':'agent'},'attributes':['id','name','fullname','email',_0x969a('0x7c')],'raw':!![]});}return null;})[_0x969a('0x14')](function(_0x2916a5){if(!_0x2916a5)return null;_0x562b30[_0x969a('0x1b')]['agent']=_0x2916a5;return _0x562b30;})[_0x969a('0x14')](function(_0x3c2cef){if(_0x3c2cef){_0x3c2cef['message'][_0x969a('0x86')]=util[_0x969a('0x6e')]('SIP/%s',_0x482b56['user'][_0x969a('0x2b')]);_0x3c2cef[_0x969a('0x1b')][_0x969a('0x7e')]=_0x562b30[_0x969a('0x7e')];_0x3c2cef[_0x969a('0x1b')][_0x969a('0x7f')]=_0x562b30[_0x969a('0x7e')];_0x3c2cef[_0x969a('0x1b')][_0x969a('0x87')]=_0x969a('0x88');_0x3c2cef[_0x969a('0x1b')][_0x969a('0x4b')]=htmlToText[_0x969a('0x89')](_0x562b30[_0x969a('0x1b')]['body']);respondWithRpcPromise(_0x969a('0x81'),_0x969a('0x81'),{'event':'rejectmessage','message':_0x3c2cef[_0x969a('0x1b')]},client9002);return _0x562b30;}return null;})['then'](respondWithResult(_0x5d8dbf,null))[_0x969a('0x1e')](handleError(_0x5d8dbf,null));};exports[_0x969a('0x8a')]=function(_0x2946d0,_0x93ce1d){var _0x3520d8=moment()[_0x969a('0x8b')]()[_0x969a('0x8c')]();var _0x10f321=path[_0x969a('0x5d')](config[_0x969a('0x8d')],'server',_0x969a('0x8e'),_0x969a('0x8f'));var _0x3f2268=path[_0x969a('0x5d')](config[_0x969a('0x8d')],_0x969a('0x90'),_0x969a('0x8e'),_0x969a('0x5c'));var _0x54f42d=util[_0x969a('0x6e')](_0x969a('0x91'),_0x3520d8);return db['MailMessage']['find']({'where':{'id':_0x2946d0[_0x969a('0x47')]['id']},'attributes':['id',_0x969a('0x4b'),_0x969a('0x92'),'to','cc','bcc','subject',_0x969a('0x93')],'include':_0x2946d0[_0x969a('0x32')]['attachments']?[{'model':db[_0x969a('0x94')],'as':'Attachments'}]:undefined})[_0x969a('0x14')](handleEntityNotFound(_0x93ce1d,null))['then'](function(_0x3e46a1){if(_0x3e46a1){var _0x33404e=_0x3e46a1;var _0x341042={'from':_0x33404e['from'],'to':_0x33404e['to'],'subject':_0x33404e['subject'],'html':htmlEntities[_0x969a('0x95')](_0x33404e[_0x969a('0x4b')]),'headers':{'Date':moment(_0x33404e[_0x969a('0x93')])[_0x969a('0x6e')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3e46a1['cc']){_0x341042[_0x969a('0x96')]['Cc']=_0x3e46a1['cc'];}if(_0x3e46a1['bcc']){_0x341042[_0x969a('0x96')][_0x969a('0x97')]=_0x3e46a1[_0x969a('0x98')];}return new BPromise(function(_0x46bd1a,_0xbbc6bc){if(_0x3e46a1[_0x969a('0x99')]){for(var _0x1030ce=0x0;_0x1030ce<_0x3e46a1[_0x969a('0x99')][_0x969a('0x38')];_0x1030ce++){var _0x133453=_0x3e46a1[_0x969a('0x99')][_0x1030ce];var _0x572455=path[_0x969a('0x5d')](_0x3f2268,_0x133453[_0x969a('0x9a')]);if(fs[_0x969a('0x9b')](_0x572455)){_0x341042[_0x969a('0x5c')][_0x969a('0x9c')]({'name':_0x133453['name'],'contentType':_0x133453['type'],'data':fs[_0x969a('0x9d')](_0x572455)});}}}emlformat['build'](_0x341042,function(_0x1780a6,_0x3f0418){if(_0x1780a6)return _0xbbc6bc(_0x1780a6);fs[_0x969a('0x9e')](path[_0x969a('0x5d')](_0x10f321,_0x54f42d),_0x3f0418);return _0x46bd1a(_0x3f0418);});});}})[_0x969a('0x14')](function(_0x381bf8){if(_0x381bf8){return _0x93ce1d['download'](path[_0x969a('0x5d')](_0x10f321,_0x54f42d),_0x54f42d,function(_0x1b3f4f){if(!_0x1b3f4f)fs[_0x969a('0x9f')](path[_0x969a('0x5d')](_0x10f321,_0x54f42d));});}})[_0x969a('0x1e')](handleError(_0x93ce1d,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4ac91e7..88441fe 100644 --- a/server/api/mailMessage/mailMessage.events.js +++ b/server/api/mailMessage/mailMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b67=['events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x2d1f1d,_0x41c1e5){var _0x5c9bfd=function(_0x232253){while(--_0x232253){_0x2d1f1d['push'](_0x2d1f1d['shift']());}};_0x5c9bfd(++_0x41c1e5);}(_0x2b67,0x10e));var _0x72b6=function(_0x2d7cfd,_0x2e4ea4){_0x2d7cfd=_0x2d7cfd-0x0;var _0x57bec7=_0x2b67[_0x2d7cfd];return _0x57bec7;};'use strict';var EventEmitter=require(_0x72b6('0x0'));var MailMessage=require(_0x72b6('0x1'))['db'][_0x72b6('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x72b6('0x3')](0x0);var events={'afterCreate':_0x72b6('0x4'),'afterUpdate':_0x72b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3d2dd8){return function(_0x537083,_0x1edf77,_0x4e9327){MailMessageEvents[_0x72b6('0x6')](_0x3d2dd8+':'+_0x537083['id'],_0x537083);MailMessageEvents['emit'](_0x3d2dd8,_0x537083);_0x4e9327(null);};}for(var e in events){if(events[_0x72b6('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x72b6('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xbb7e=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xf6987,_0x2bb48d){var _0x209d06=function(_0x11cd0b){while(--_0x11cd0b){_0xf6987['push'](_0xf6987['shift']());}};_0x209d06(++_0x2bb48d);}(_0xbb7e,0x1db));var _0xebb7=function(_0xfc9d,_0xfde488){_0xfc9d=_0xfc9d-0x0;var _0x2797aa=_0xbb7e[_0xfc9d];return _0x2797aa;};'use strict';var EventEmitter=require(_0xebb7('0x0'));var MailMessage=require(_0xebb7('0x1'))['db'][_0xebb7('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xebb7('0x3')](0x0);var events={'afterCreate':_0xebb7('0x4'),'afterUpdate':_0xebb7('0x5'),'afterDestroy':_0xebb7('0x6')};function emitEvent(_0x266cd3){return function(_0x321beb,_0x19b070,_0x3955fb){MailMessageEvents['emit'](_0x266cd3+':'+_0x321beb['id'],_0x321beb);MailMessageEvents[_0xebb7('0x7')](_0x266cd3,_0x321beb);_0x3955fb(null);};}for(var e in events){if(events[_0xebb7('0x8')](e)){var event=events[e];MailMessage[_0xebb7('0x9')](e,emitEvent(event));}}module[_0xebb7('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 1a09df1..ad827ac 100644 --- a/server/api/mailMessage/mailMessage.model.js +++ b/server/api/mailMessage/mailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebe6=['define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','catch','error','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','./mailMessage.attributes','exports'];(function(_0x388ad8,_0x54c8e5){var _0x437eaf=function(_0x49f7d5){while(--_0x49f7d5){_0x388ad8['push'](_0x388ad8['shift']());}};_0x437eaf(++_0x54c8e5);}(_0xebe6,0x1b7));var _0x6ebe=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0xebe6[_0x2d344f];return _0x2e796b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6ebe('0x0'))('api');var moment=require(_0x6ebe('0x1'));var BPromise=require(_0x6ebe('0x2'));var rp=require(_0x6ebe('0x3'));var htmlToText=require(_0x6ebe('0x4'));var fs=require('fs');var path=require(_0x6ebe('0x5'));var rimraf=require(_0x6ebe('0x6'));var config=require('../../config/environment');var attributes=require(_0x6ebe('0x7'));module[_0x6ebe('0x8')]=function(_0x64da0d,_0x5e48b4){return _0x64da0d[_0x6ebe('0x9')](_0x6ebe('0xa'),attributes,{'tableName':_0x6ebe('0xb'),'paranoid':![],'indexes':[{'name':_0x6ebe('0xc'),'fields':['messageId']},{'name':_0x6ebe('0xd'),'fields':['plainBody',_0x6ebe('0xe')],'type':_0x6ebe('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15407d,_0x1ad2cd,_0x11720f){if(_0x15407d[_0x6ebe('0x10')]){_0x15407d['plainBody']=htmlToText[_0x6ebe('0x11')](_0x15407d[_0x6ebe('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x11720f(null,_0x1ad2cd);},'afterCreate':function(_0x94b60c,_0x25e1b9,_0x3aec00){var _0x4278f8=_0x64da0d[_0x6ebe('0x12')];var _0xa004b9=_0x94b60c['get']({'plain':!![]});if(_0xa004b9[_0x6ebe('0x13')][_0x6ebe('0x14')]()==='in'||_0xa004b9[_0x6ebe('0x13')]['toLowerCase']()==='out'&&!_0xa004b9[_0x6ebe('0x15')]&&!_[_0x6ebe('0x16')](_0xa004b9[_0x6ebe('0x17')])){_0x4278f8[_0x6ebe('0x18')][_0x6ebe('0x19')]({'where':{'id':_0xa004b9[_0x6ebe('0x1a')]}})['then'](function(_0x114947){if(_0x114947){_0x114947[_0x6ebe('0x1b')]({'lastMsgAt':_0xa004b9[_0x6ebe('0x1c')],'lastMsgDirection':_0xa004b9[_0x6ebe('0x13')]['toLowerCase']()});}})[_0x6ebe('0x1d')](function(_0x9a13eb){console[_0x6ebe('0x1e')](_0x9a13eb);});}_0x3aec00();}},'charset':'utf8mb4','collate':_0x6ebe('0x1f')});}; \ No newline at end of file +var _0x380b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2ca37d,_0x3a542d){var _0x10ee6e=function(_0x3c9174){while(--_0x3c9174){_0x2ca37d['push'](_0x2ca37d['shift']());}};_0x10ee6e(++_0x3a542d);}(_0x380b,0xdd));var _0xb380=function(_0xca03d4,_0x116829){_0xca03d4=_0xca03d4-0x0;var _0x173f57=_0x380b[_0xca03d4];return _0x173f57;};'use strict';var _=require(_0xb380('0x0'));var util=require(_0xb380('0x1'));var logger=require(_0xb380('0x2'))(_0xb380('0x3'));var moment=require(_0xb380('0x4'));var BPromise=require(_0xb380('0x5'));var rp=require(_0xb380('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xb380('0x7'));var config=require('../../config/environment');var attributes=require(_0xb380('0x8'));module[_0xb380('0x9')]=function(_0x56c826,_0x35a342){return _0x56c826[_0xb380('0xa')](_0xb380('0xb'),attributes,{'tableName':_0xb380('0xc'),'paranoid':![],'indexes':[{'name':_0xb380('0xd'),'fields':[_0xb380('0xd')]},{'name':_0xb380('0xe'),'fields':[_0xb380('0xf'),_0xb380('0x10')],'type':_0xb380('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e006f,_0x181123,_0x557546){if(_0x3e006f[_0xb380('0x12')]){_0x3e006f['plainBody']=htmlToText[_0xb380('0x13')](_0x3e006f[_0xb380('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x557546(null,_0x181123);},'afterCreate':function(_0x4fafcd,_0x397835,_0x49c941){var _0x5f3bcc=_0x56c826[_0xb380('0x14')];var _0xae9274=_0x4fafcd[_0xb380('0x15')]({'plain':!![]});if(_0xae9274[_0xb380('0x16')][_0xb380('0x17')]()==='in'||_0xae9274[_0xb380('0x16')]['toLowerCase']()===_0xb380('0x18')&&!_0xae9274[_0xb380('0x19')]&&!_[_0xb380('0x1a')](_0xae9274[_0xb380('0x1b')])){_0x5f3bcc[_0xb380('0x1c')][_0xb380('0x1d')]({'where':{'id':_0xae9274[_0xb380('0x1e')]}})[_0xb380('0x1f')](function(_0x596ea2){if(_0x596ea2){_0x596ea2[_0xb380('0x20')]({'lastMsgAt':_0xae9274[_0xb380('0x21')],'lastMsgDirection':_0xae9274['direction'][_0xb380('0x17')]()});}})['catch'](function(_0x2de227){console[_0xb380('0x22')](_0x2de227);});}_0x49c941();}},'charset':_0xb380('0x23'),'collate':_0xb380('0x24')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 7032778..cfd740f 100644 --- a/server/api/mailMessage/mailMessage.rpc.js +++ b/server/api/mailMessage/mailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7708=['info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options','raw','catch','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7708,0x188));var _0x8770=function(_0x297eea,_0x5060be){_0x297eea=_0x297eea-0x0;var _0x1c42d2=_0x7708[_0x297eea];return _0x1c42d2;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var moment=require('moment');var BPromise=require(_0x8770('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8770('0x3'))(_0x8770('0x4'));var config=require('../../config/environment');var jayson=require(_0x8770('0x5'));var client=jayson['client'][_0x8770('0x6')]({'port':0x232a});config[_0x8770('0x7')]=_[_0x8770('0x8')](config[_0x8770('0x7')],{'host':_0x8770('0x9'),'port':0x18eb});var socket=require(_0x8770('0xa'))(new Redis(config[_0x8770('0x7')]));require('./mailMessage.socket')[_0x8770('0xb')](socket);function respondWithRpcPromise(_0x2ca830,_0x3f357a,_0x4e4551){return new BPromise(function(_0x390af0,_0x10e4a3){return client[_0x8770('0xc')](_0x2ca830,_0x4e4551)[_0x8770('0xd')](function(_0x4a0ca1){logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));logger['debug'](_0x8770('0x11'),_0x3f357a,_0x8770('0x10'),JSON[_0x8770('0x12')](_0x4a0ca1));if(_0x4a0ca1[_0x8770('0x13')]){if(_0x4a0ca1[_0x8770('0x13')][_0x8770('0x14')]===0x1f4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x4a0ca1['error'][_0x8770('0x15')]);return _0x10e4a3(_0x4a0ca1[_0x8770('0x13')]['message']);}logger[_0x8770('0x13')]('MailMessage,\x20%s,\x20%s',_0x3f357a,_0x4a0ca1[_0x8770('0x13')]['message']);return _0x390af0(_0x4a0ca1['error']['message']);}else{logger[_0x8770('0xe')](_0x8770('0xf'),_0x3f357a,_0x8770('0x10'));_0x390af0(_0x4a0ca1[_0x8770('0x16')]['message']);}})['catch'](function(_0x349bd4){logger[_0x8770('0x13')](_0x8770('0xf'),_0x3f357a,_0x349bd4);_0x10e4a3(_0x349bd4);});});}exports[_0x8770('0x17')]=function(_0x4d2c7e){var _0x4e1fa6=this;return new Promise(function(_0x3e1fe7,_0x1234dd){return db[_0x8770('0x18')][_0x8770('0x19')](_0x4d2c7e['body'],{'raw':_0x4d2c7e['options']?_0x4d2c7e[_0x8770('0x1a')][_0x8770('0x1b')]===undefined?!![]:![]:!![]})[_0x8770('0xd')](function(_0x2918a7){logger[_0x8770('0xe')](_0x8770('0x17'),_0x4d2c7e);logger['debug'](_0x8770('0x17'),_0x4d2c7e,JSON[_0x8770('0x12')](_0x2918a7));_0x3e1fe7(_0x2918a7);})[_0x8770('0x1c')](function(_0x2515c5){logger['error'](_0x8770('0x17'),_0x2515c5['message'],_0x4d2c7e);_0x1234dd(_0x4e1fa6[_0x8770('0x13')](0x1f4,_0x2515c5[_0x8770('0x15')]));});});}; \ No newline at end of file +var _0x4991=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','result','MailMessage','create','body','options','raw','CreateMailMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2991da,_0x365558){var _0x3546a2=function(_0x175653){while(--_0x175653){_0x2991da['push'](_0x2991da['shift']());}};_0x3546a2(++_0x365558);}(_0x4991,0xf7));var _0x1499=function(_0x38bc98,_0x54ebff){_0x38bc98=_0x38bc98-0x0;var _0xf962d2=_0x4991[_0x38bc98];return _0xf962d2;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});config[_0x1499('0xb')]=_[_0x1499('0xc')](config[_0x1499('0xb')],{'host':_0x1499('0xd'),'port':0x18eb});var socket=require(_0x1499('0xe'))(new Redis(config[_0x1499('0xb')]));require(_0x1499('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e8ad,_0x36a053,_0x575251){return new BPromise(function(_0x2a4816,_0x352180){return client['request'](_0x16e8ad,_0x575251)[_0x1499('0x10')](function(_0x2867b1){logger['info']('MailMessage,\x20%s,\x20%s',_0x36a053,'request\x20sent');logger[_0x1499('0x11')](_0x1499('0x12'),_0x36a053,_0x1499('0x13'),JSON[_0x1499('0x14')](_0x2867b1));if(_0x2867b1[_0x1499('0x15')]){if(_0x2867b1['error']['code']===0x1f4){logger[_0x1499('0x15')]('MailMessage,\x20%s,\x20%s',_0x36a053,_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);return _0x352180(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}logger['error'](_0x1499('0x17'),_0x36a053,_0x2867b1[_0x1499('0x15')]['message']);return _0x2a4816(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}else{logger[_0x1499('0x18')](_0x1499('0x17'),_0x36a053,_0x1499('0x13'));_0x2a4816(_0x2867b1[_0x1499('0x19')]['message']);}})['catch'](function(_0x5bcb5f){logger[_0x1499('0x15')](_0x1499('0x17'),_0x36a053,_0x5bcb5f);_0x352180(_0x5bcb5f);});});}exports['CreateMailMessage']=function(_0x351da9){var _0x3c13a1=this;return new Promise(function(_0x28dff3,_0x18e4a6){return db[_0x1499('0x1a')][_0x1499('0x1b')](_0x351da9[_0x1499('0x1c')],{'raw':_0x351da9[_0x1499('0x1d')]?_0x351da9[_0x1499('0x1d')][_0x1499('0x1e')]===undefined?!![]:![]:!![]})[_0x1499('0x10')](function(_0x836081){logger[_0x1499('0x18')](_0x1499('0x1f'),_0x351da9);logger[_0x1499('0x11')](_0x1499('0x1f'),_0x351da9,JSON[_0x1499('0x14')](_0x836081));_0x28dff3(_0x836081);})['catch'](function(_0x258e9c){logger[_0x1499('0x15')](_0x1499('0x1f'),_0x258e9c[_0x1499('0x16')],_0x351da9);_0x18e4a6(_0x3c13a1[_0x1499('0x15')](0x1f4,_0x258e9c[_0x1499('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 99d2102..aa9d945 100644 --- a/server/api/mailMessage/mailMessage.socket.js +++ b/server/api/mailMessage/mailMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef3a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','remove'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xef3a,0xa6));var _0xaef3=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0xef3a[_0x41bdd4];return _0x5c03a6;};'use strict';var MailMessageEvents=require(_0xaef3('0x0'));var events=['save',_0xaef3('0x1'),'update'];function createListener(_0x340989,_0x5b293e){return function(_0x3d541f){_0x5b293e[_0xaef3('0x2')](_0x340989,_0x3d541f);};}function removeListener(_0x428c2a,_0x12fcc7){return function(){MailMessageEvents[_0xaef3('0x3')](_0x428c2a,_0x12fcc7);};}exports[_0xaef3('0x4')]=function(_0x2f8a0e){for(var _0x29f36b=0x0,_0x1fef7c=events[_0xaef3('0x5')];_0x29f36b<_0x1fef7c;_0x29f36b++){var _0x33cdaa=events[_0x29f36b];var _0x46cf4d=createListener(_0xaef3('0x6')+_0x33cdaa,_0x2f8a0e);MailMessageEvents['on'](_0x33cdaa,_0x46cf4d);}}; \ No newline at end of file +var _0xa404=['register','length','./mailMessage.events','save','remove','emit','removeListener'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0xa404,0x159));var _0x4a40=function(_0x1d1e94,_0x53acd0){_0x1d1e94=_0x1d1e94-0x0;var _0x543ede=_0xa404[_0x1d1e94];return _0x543ede;};'use strict';var MailMessageEvents=require(_0x4a40('0x0'));var events=[_0x4a40('0x1'),_0x4a40('0x2'),'update'];function createListener(_0x465161,_0x506783){return function(_0x58ae0b){_0x506783[_0x4a40('0x3')](_0x465161,_0x58ae0b);};}function removeListener(_0x4443ec,_0x5b6a14){return function(){MailMessageEvents[_0x4a40('0x4')](_0x4443ec,_0x5b6a14);};}exports[_0x4a40('0x5')]=function(_0x3ad5e6){for(var _0x44fcae=0x0,_0x1be9d0=events[_0x4a40('0x6')];_0x44fcae<_0x1be9d0;_0x44fcae++){var _0x2eb044=events[_0x44fcae];var _0x100a8a=createListener('mailMessage:'+_0x2eb044,_0x3ad5e6);MailMessageEvents['on'](_0x2eb044,_0x100a8a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 788af9c..ddcb29f 100644 --- a/server/api/mailQueue/index.js +++ b/server/api/mailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x309d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','get','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x2f7e46,_0x1bbb24){var _0x2840a2=function(_0xbd3899){while(--_0xbd3899){_0x2f7e46['push'](_0x2f7e46['shift']());}};_0x2840a2(++_0x1bbb24);}(_0x309d,0x166));var _0xd309=function(_0x59f063,_0x6c3dbb){_0x59f063=_0x59f063-0x0;var _0x21bdce=_0x309d[_0x59f063];return _0x21bdce;};'use strict';var multer=require(_0xd309('0x0'));var util=require(_0xd309('0x1'));var path=require(_0xd309('0x2'));var timeout=require(_0xd309('0x3'));var express=require(_0xd309('0x4'));var router=express[_0xd309('0x5')]();var fs_extra=require(_0xd309('0x6'));var auth=require(_0xd309('0x7'));var interaction=require(_0xd309('0x8'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xd309('0x9')](),controller['index']);router['get'](_0xd309('0xa'),auth[_0xd309('0x9')](),controller['describe']);router[_0xd309('0xb')]('/:id',auth[_0xd309('0x9')](),controller[_0xd309('0xc')]);router[_0xd309('0xb')](_0xd309('0xd'),auth[_0xd309('0x9')](),controller[_0xd309('0xe')]);router[_0xd309('0xb')](_0xd309('0xf'),auth['isAuthenticated'](),controller[_0xd309('0x10')]);router[_0xd309('0xb')](_0xd309('0x11'),auth[_0xd309('0x9')](),controller[_0xd309('0x12')]);router[_0xd309('0x13')]('/',auth['isAuthenticated'](),controller[_0xd309('0x14')]);router[_0xd309('0x13')](_0xd309('0xf'),auth[_0xd309('0x9')](),controller[_0xd309('0x15')]);router[_0xd309('0x13')](_0xd309('0x11'),auth['isAuthenticated'](),controller[_0xd309('0x16')]);router[_0xd309('0x17')](_0xd309('0x18'),auth[_0xd309('0x9')](),controller[_0xd309('0x19')]);router['delete']('/:id',auth[_0xd309('0x9')](),controller['destroy']);router[_0xd309('0x1a')](_0xd309('0xf'),auth['isAuthenticated'](),controller[_0xd309('0x1b')]);router[_0xd309('0x1a')](_0xd309('0x11'),auth[_0xd309('0x9')](),controller[_0xd309('0x1c')]);module[_0xd309('0x1d')]=router; \ No newline at end of file +var _0xdf71=['describe','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','put','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x4b5cd5,_0x924fac){var _0x338724=function(_0x160f59){while(--_0x160f59){_0x4b5cd5['push'](_0x4b5cd5['shift']());}};_0x338724(++_0x924fac);}(_0xdf71,0xde));var _0x1df7=function(_0x509f97,_0x442414){_0x509f97=_0x509f97-0x0;var _0x18bbef=_0xdf71[_0x509f97];return _0x18bbef;};'use strict';var multer=require(_0x1df7('0x0'));var util=require(_0x1df7('0x1'));var path=require(_0x1df7('0x2'));var timeout=require(_0x1df7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1df7('0x4'));var auth=require(_0x1df7('0x5'));var interaction=require(_0x1df7('0x6'));var config=require(_0x1df7('0x7'));var controller=require('./mailQueue.controller');router[_0x1df7('0x8')]('/',auth['isAuthenticated'](),controller[_0x1df7('0x9')]);router[_0x1df7('0x8')](_0x1df7('0xa'),auth[_0x1df7('0xb')](),controller[_0x1df7('0xc')]);router[_0x1df7('0x8')]('/:id',auth[_0x1df7('0xb')](),controller['show']);router[_0x1df7('0x8')]('/:id/members',auth[_0x1df7('0xb')](),controller['getMembers']);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x1df7('0xd')]);router[_0x1df7('0x8')]('/:id/users',auth[_0x1df7('0xb')](),controller[_0x1df7('0xe')]);router[_0x1df7('0xf')]('/',auth['isAuthenticated'](),controller[_0x1df7('0x10')]);router['post'](_0x1df7('0x11'),auth[_0x1df7('0xb')](),controller[_0x1df7('0x12')]);router['post'](_0x1df7('0x13'),auth[_0x1df7('0xb')](),controller['addAgents']);router[_0x1df7('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1df7('0x15')](_0x1df7('0x16'),auth[_0x1df7('0xb')](),controller[_0x1df7('0x17')]);router[_0x1df7('0x15')](_0x1df7('0x11'),auth[_0x1df7('0xb')](),controller['removeTeams']);router[_0x1df7('0x15')](_0x1df7('0x13'),auth[_0x1df7('0xb')](),controller[_0x1df7('0x18')]);module[_0x1df7('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e27f559..79d4da3 100644 --- a/server/api/mailQueue/mailQueue.attributes.js +++ b/server/api/mailQueue/mailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7eb=['sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3db34a,_0x51bb10){var _0x27323b=function(_0x4b4323){while(--_0x4b4323){_0x3db34a['push'](_0x3db34a['shift']());}};_0x27323b(++_0x51bb10);}(_0xa7eb,0xdc));var _0xba7e=function(_0x599db5,_0x22eb92){_0x599db5=_0x599db5-0x0;var _0x399d87=_0xa7eb[_0x599db5];return _0x399d87;};'use strict';var Sequelize=require(_0xba7e('0x0'));module[_0xba7e('0x1')]={'name':{'type':Sequelize[_0xba7e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xba7e('0x2')]},'timeout':{'type':Sequelize[_0xba7e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba7e('0x4')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file +var _0x5ca4=['beepall','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x1dcd24,_0x46d810){var _0x3c4680=function(_0x58bef8){while(--_0x58bef8){_0x1dcd24['push'](_0x1dcd24['shift']());}};_0x3c4680(++_0x46d810);}(_0x5ca4,0x173));var _0x45ca=function(_0x1e8edc,_0x4d3bba){_0x1e8edc=_0x1e8edc-0x0;var _0x23787f=_0x5ca4[_0x1e8edc];return _0x23787f;};'use strict';var Sequelize=require(_0x45ca('0x0'));module[_0x45ca('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x45ca('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x45ca('0x3')]},'timeout':{'type':Sequelize[_0x45ca('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x45ca('0x5')](_0x45ca('0x6'),_0x45ca('0x7'),_0x45ca('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5efb57d..15eb5ac 100644 --- a/server/api/mailQueue/mailQueue.controller.js +++ b/server/api/mailQueue/mailQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab55=['all','union','compact','value','transaction','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','isArray','pick','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','each','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','TeamId','includes'];(function(_0x21024f,_0x35e650){var _0x26e8f8=function(_0x3894f2){while(--_0x3894f2){_0x21024f['push'](_0x21024f['shift']());}};_0x26e8f8(++_0x35e650);}(_0xab55,0x139));var _0x5ab5=function(_0x23d493,_0x203293){_0x23d493=_0x23d493-0x0;var _0x36e50a=_0xab55[_0x23d493];return _0x36e50a;};'use strict';var emlformat=require(_0x5ab5('0x0'));var rimraf=require(_0x5ab5('0x1'));var zipdir=require(_0x5ab5('0x2'));var jsonpatch=require(_0x5ab5('0x3'));var rp=require('request-promise');var moment=require(_0x5ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ab5('0x5'));var util=require(_0x5ab5('0x6'));var path=require(_0x5ab5('0x7'));var sox=require(_0x5ab5('0x8'));var csv=require(_0x5ab5('0x9'));var ejs=require(_0x5ab5('0xa'));var fs=require('fs');var fs_extra=require(_0x5ab5('0xb'));var _=require(_0x5ab5('0xc'));var squel=require(_0x5ab5('0xd'));var crypto=require(_0x5ab5('0xe'));var jsforce=require(_0x5ab5('0xf'));var deskjs=require(_0x5ab5('0x10'));var toCsv=require(_0x5ab5('0x9'));var querystring=require(_0x5ab5('0x11'));var Papa=require(_0x5ab5('0x12'));var Redis=require(_0x5ab5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5ab5('0x14'));var as=require(_0x5ab5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ab5('0x16'))(_0x5ab5('0x17'));var utils=require(_0x5ab5('0x18'));var config=require(_0x5ab5('0x19'));var licenseUtil=require(_0x5ab5('0x1a'));var db=require(_0x5ab5('0x1b'))['db'];config[_0x5ab5('0x1c')]=_[_0x5ab5('0x1d')](config['redis'],{'host':_0x5ab5('0x1e'),'port':0x18eb});var socket=require(_0x5ab5('0x1f'))(new Redis(config[_0x5ab5('0x1c')]));require(_0x5ab5('0x20'))['register'](socket);function respondWithStatusCode(_0x3da8ea,_0x5f2885){_0x5f2885=_0x5f2885||0xcc;return function(_0x2b1204){if(_0x2b1204){return _0x3da8ea[_0x5ab5('0x21')](_0x5f2885);}return _0x3da8ea[_0x5ab5('0x22')](_0x5f2885)[_0x5ab5('0x23')]();};}function respondWithResult(_0x338aa4,_0x46f7a1){_0x46f7a1=_0x46f7a1||0xc8;return function(_0x473a94){if(_0x473a94){return _0x338aa4[_0x5ab5('0x22')](_0x46f7a1)[_0x5ab5('0x24')](_0x473a94);}};}function respondWithFilteredResult(_0x196c0d,_0x456de0){return function(_0x1fd4f0){if(_0x1fd4f0){var _0x401355=typeof _0x456de0['offset']===_0x5ab5('0x25')&&typeof _0x456de0[_0x5ab5('0x26')]===_0x5ab5('0x25');var _0x2dac5b=_0x1fd4f0[_0x5ab5('0x27')];var _0x20acab=_0x401355?0x0:_0x456de0['offset'];var _0x11ef62=_0x401355?_0x1fd4f0[_0x5ab5('0x27')]:_0x456de0[_0x5ab5('0x28')]+_0x456de0[_0x5ab5('0x26')];var _0x1830b5;if(_0x11ef62>=_0x2dac5b){_0x11ef62=_0x2dac5b;_0x1830b5=0xc8;}else{_0x1830b5=0xce;}_0x196c0d[_0x5ab5('0x22')](_0x1830b5);return _0x196c0d[_0x5ab5('0x29')](_0x5ab5('0x2a'),_0x20acab+'-'+_0x11ef62+'/'+_0x2dac5b)[_0x5ab5('0x24')](_0x1fd4f0);}return null;};}function patchUpdates(_0x4216e2){return function(_0x397348){try{jsonpatch[_0x5ab5('0x2b')](_0x397348,_0x4216e2,!![]);}catch(_0x334d9e){return BPromise['reject'](_0x334d9e);}return _0x397348[_0x5ab5('0x2c')]();};}function saveUpdates(_0x3ae1d4,_0x1f681f){return function(_0x36dcb9){if(_0x36dcb9){return _0x36dcb9['update'](_0x3ae1d4)[_0x5ab5('0x2d')](function(_0x53e702){return _0x53e702;});}return null;};}function removeEntity(_0x3565d7,_0x1ecf1c){return function(_0x2eb156){if(_0x2eb156){return _0x2eb156['destroy']()[_0x5ab5('0x2d')](function(){var _0x2e9e0b=_0x2eb156[_0x5ab5('0x2e')]({'plain':!![]});var _0x31cabd=_0x5ab5('0x2f');return db['UserProfileResource']['destroy']({'where':{'type':_0x31cabd,'resourceId':_0x2e9e0b['id']}})[_0x5ab5('0x2d')](function(){return _0x2eb156;});})[_0x5ab5('0x2d')](function(){_0x3565d7['status'](0xcc)[_0x5ab5('0x23')]();});}};}function handleEntityNotFound(_0x57ee88,_0x448f42){return function(_0x15ab94){if(!_0x15ab94){_0x57ee88[_0x5ab5('0x21')](0x194);}return _0x15ab94;};}function handleError(_0x3ae77c,_0x56b014){_0x56b014=_0x56b014||0x1f4;return function(_0x17b07f){logger[_0x5ab5('0x30')](_0x17b07f[_0x5ab5('0x31')]);if(_0x17b07f[_0x5ab5('0x32')]){delete _0x17b07f[_0x5ab5('0x32')];}_0x3ae77c[_0x5ab5('0x22')](_0x56b014)[_0x5ab5('0x33')](_0x17b07f);};}exports[_0x5ab5('0x34')]=function(_0x55a97f,_0x42619e){var _0x1bc6d3={},_0x2b0fa3={},_0x2383f6={'count':0x0,'rows':[]};var _0x3558b1=_[_0x5ab5('0x35')](db[_0x5ab5('0x36')][_0x5ab5('0x37')],function(_0x34d482){return{'name':_0x34d482[_0x5ab5('0x38')],'type':_0x34d482['type'][_0x5ab5('0x39')]};});_0x2b0fa3['model']=_[_0x5ab5('0x35')](_0x3558b1,_0x5ab5('0x32'));_0x2b0fa3[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x55a97f['query']);_0x2b0fa3[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x2b0fa3[_0x5ab5('0x3e')],_0x2b0fa3['query']);_0x1bc6d3[_0x5ab5('0x3f')]=_['intersection'](_0x2b0fa3['model'],qs['fields'](_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x40')]));_0x1bc6d3[_0x5ab5('0x3f')]=_0x1bc6d3[_0x5ab5('0x3f')][_0x5ab5('0x41')]?_0x1bc6d3[_0x5ab5('0x3f')]:_0x2b0fa3[_0x5ab5('0x3e')];if(!_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x42')]('nolimit')){_0x1bc6d3['limit']=qs[_0x5ab5('0x26')](_0x55a97f[_0x5ab5('0x3a')]['limit']);_0x1bc6d3['offset']=qs[_0x5ab5('0x28')](_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x28')]);}_0x1bc6d3[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x55a97f['query'][_0x5ab5('0x44')]);_0x1bc6d3[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x55a97f['query'],_0x2b0fa3[_0x5ab5('0x3c')]),_0x3558b1);if(_0x55a97f[_0x5ab5('0x3a')][_0x5ab5('0x46')]){_0x1bc6d3[_0x5ab5('0x45')]=_[_0x5ab5('0x47')](_0x1bc6d3[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x3558b1,function(_0x2b7caa){if(_0x2b7caa[_0x5ab5('0x48')]!==_0x5ab5('0x49')){var _0x267f7a={};_0x267f7a[_0x2b7caa['name']]={'$like':'%'+_0x55a97f['query'][_0x5ab5('0x46')]+'%'};return _0x267f7a;}})});}_0x1bc6d3=_[_0x5ab5('0x47')]({},_0x1bc6d3,_0x55a97f[_0x5ab5('0x4a')]);var _0x6a6cb7={'where':_0x1bc6d3['where']};return db[_0x5ab5('0x36')]['count'](_0x6a6cb7)['then'](function(_0x131006){_0x2383f6[_0x5ab5('0x27')]=_0x131006;if(_0x55a97f[_0x5ab5('0x3a')]['includeAll']){_0x1bc6d3[_0x5ab5('0x4b')]=[{'all':!![]}];}return db[_0x5ab5('0x36')][_0x5ab5('0x4c')](_0x1bc6d3);})['then'](function(_0x5c01b1){_0x2383f6[_0x5ab5('0x4d')]=_0x5c01b1;return _0x2383f6;})[_0x5ab5('0x2d')](respondWithFilteredResult(_0x42619e,_0x1bc6d3))[_0x5ab5('0x4e')](handleError(_0x42619e,null));};exports['show']=function(_0x5c14fc,_0x3a133b){var _0x27954c={'raw':!![],'where':{'id':_0x5c14fc[_0x5ab5('0x4f')]['id']}},_0xd6838d={};_0xd6838d[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db[_0x5ab5('0x36')]['rawAttributes']);_0xd6838d[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x5c14fc[_0x5ab5('0x3a')]);_0xd6838d[_0x5ab5('0x3c')]=_['intersection'](_0xd6838d[_0x5ab5('0x3e')],_0xd6838d[_0x5ab5('0x3a')]);_0x27954c['attributes']=_[_0x5ab5('0x3d')](_0xd6838d[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x5c14fc[_0x5ab5('0x3a')]['fields']));_0x27954c[_0x5ab5('0x3f')]=_0x27954c[_0x5ab5('0x3f')][_0x5ab5('0x41')]?_0x27954c[_0x5ab5('0x3f')]:_0xd6838d[_0x5ab5('0x3e')];if(_0x5c14fc[_0x5ab5('0x3a')][_0x5ab5('0x50')]){_0x27954c['include']=[{'all':!![]}];}_0x27954c=_[_0x5ab5('0x47')]({},_0x27954c,_0x5c14fc[_0x5ab5('0x4a')]);return db[_0x5ab5('0x36')]['find'](_0x27954c)['then'](handleEntityNotFound(_0x3a133b,null))[_0x5ab5('0x2d')](respondWithResult(_0x3a133b,null))[_0x5ab5('0x4e')](handleError(_0x3a133b,null));};exports[_0x5ab5('0x51')]=function(_0x4d1885,_0x5647b9){return db[_0x5ab5('0x36')]['create'](_0x4d1885[_0x5ab5('0x52')],{})['then'](function(_0x490e46){var _0x306715=_0x4d1885[_0x5ab5('0x53')][_0x5ab5('0x2e')]({'plain':!![]});if(!_0x306715)throw new Error(_0x5ab5('0x54'));if(_0x306715[_0x5ab5('0x55')]==='user'){var _0x5e765e=_0x490e46[_0x5ab5('0x2e')]({'plain':!![]});var _0x39d1a6=_0x5ab5('0x2f');return db[_0x5ab5('0x56')][_0x5ab5('0x57')]({'where':{'name':_0x39d1a6,'userProfileId':_0x306715[_0x5ab5('0x58')]},'raw':!![]})[_0x5ab5('0x2d')](function(_0x5b6975){if(_0x5b6975&&_0x5b6975[_0x5ab5('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x5e765e[_0x5ab5('0x32')],'resourceId':_0x5e765e['id'],'type':_0x5b6975['name'],'sectionId':_0x5b6975['id']},{})[_0x5ab5('0x2d')](function(){return _0x490e46;});}else{return _0x490e46;}})[_0x5ab5('0x4e')](function(_0x58bdc1){logger[_0x5ab5('0x30')](_0x5ab5('0x5a'),_0x58bdc1);throw _0x58bdc1;});}return _0x490e46;})['then'](respondWithResult(_0x5647b9,0xc9))[_0x5ab5('0x4e')](handleError(_0x5647b9,null));};exports[_0x5ab5('0x5b')]=function(_0x290b92,_0x1f756a){if(_0x290b92[_0x5ab5('0x52')]['id']){delete _0x290b92[_0x5ab5('0x52')]['id'];}return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x290b92[_0x5ab5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1f756a,null))['then'](saveUpdates(_0x290b92[_0x5ab5('0x52')],null))['then'](respondWithResult(_0x1f756a,null))[_0x5ab5('0x4e')](handleError(_0x1f756a,null));};exports[_0x5ab5('0x5c')]=function(_0x5e99be,_0x5a3248){return db[_0x5ab5('0x36')]['find']({'where':{'id':_0x5e99be['params']['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x5a3248,null))['then'](removeEntity(_0x5a3248,null))['catch'](handleError(_0x5a3248,null));};exports[_0x5ab5('0x5d')]=function(_0x11779b,_0x136fef){return db[_0x5ab5('0x36')][_0x5ab5('0x5d')]()[_0x5ab5('0x2d')](respondWithResult(_0x136fef,null))[_0x5ab5('0x4e')](handleError(_0x136fef,null));};exports[_0x5ab5('0x5e')]=function(_0x5dfc3d,_0x3e2ac7,_0x21a85c){var _0x271e65={'raw':!![],'where':{}},_0x47012f={},_0x476564;return db[_0x5ab5('0x36')][_0x5ab5('0x5f')]({'where':{'id':_0x5dfc3d['params']['id']}})['then'](handleEntityNotFound(_0x3e2ac7,null))[_0x5ab5('0x2d')](function(_0x4c01d4){if(_0x4c01d4){_0x476564=_0x4c01d4['get']({'plain':!![]});_0x47012f['model']=_['keys'](db[_0x5ab5('0x60')][_0x5ab5('0x37')]);_0x47012f[_0x5ab5('0x3a')]=_['keys'](_0x5dfc3d[_0x5ab5('0x3a')]);_0x47012f[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x47012f[_0x5ab5('0x3e')],_0x47012f[_0x5ab5('0x3a')]);_0x271e65[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x47012f[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x5dfc3d['query'][_0x5ab5('0x40')]));_0x271e65[_0x5ab5('0x3f')]=_0x271e65[_0x5ab5('0x3f')]['length']?_0x271e65[_0x5ab5('0x3f')]:_0x47012f['model'];if(!_0x5dfc3d[_0x5ab5('0x3a')]['hasOwnProperty'](_0x5ab5('0x61'))){_0x271e65[_0x5ab5('0x26')]=qs[_0x5ab5('0x26')](_0x5dfc3d[_0x5ab5('0x3a')]['limit']);_0x271e65['offset']=qs[_0x5ab5('0x28')](_0x5dfc3d[_0x5ab5('0x3a')]['offset']);}_0x271e65[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x5dfc3d[_0x5ab5('0x3a')]['sort']);_0x271e65[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x5dfc3d[_0x5ab5('0x3a')],_0x47012f[_0x5ab5('0x3c')]));_0x271e65[_0x5ab5('0x45')][_0x5ab5('0x62')]=_0x4c01d4['id'];if(_0x5dfc3d[_0x5ab5('0x3a')][_0x5ab5('0x46')]){_0x271e65[_0x5ab5('0x45')]=_[_0x5ab5('0x47')](_0x271e65[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x271e65[_0x5ab5('0x3f')],function(_0x32567f){var _0x563fb4={};_0x563fb4[_0x32567f]={'$like':'%'+_0x5dfc3d[_0x5ab5('0x3a')]['filter']+'%'};return _0x563fb4;})});}_0x271e65=_[_0x5ab5('0x47')]({},_0x271e65,_0x5dfc3d[_0x5ab5('0x4a')]);return db[_0x5ab5('0x60')][_0x5ab5('0x4c')](_0x271e65);}})[_0x5ab5('0x2d')](function(_0x44baad){if(_0x44baad){return db[_0x5ab5('0x63')][_0x5ab5('0x64')]({'where':{'id':_[_0x5ab5('0x35')](_0x44baad,_0x5ab5('0x65')),'role':_0x5ab5('0x66')},'attributes':['id',_0x5ab5('0x32'),_0x5ab5('0x67'),_0x5ab5('0x68'),_0x5ab5('0x69')]});}})[_0x5ab5('0x2d')](function(_0x131cfa){if(_0x131cfa){return{'count':_0x131cfa[_0x5ab5('0x27')],'rows':_[_0x5ab5('0x35')](_0x131cfa['rows'],function(_0xee0e43){return{'membername':_0xee0e43[_0x5ab5('0x32')],'UserId':_0xee0e43['id'],'queue_name':_0x476564[_0x5ab5('0x32')],'MailQueueId':_0x476564['id'],'interface':util[_0x5ab5('0x6a')](_0x5ab5('0x6b'),_0x5ab5('0x6c'),_0xee0e43['name']),'penalty':0x0,'paused':_0xee0e43[_0x5ab5('0x67')],'createdAt':_0xee0e43[_0x5ab5('0x69')],'updatedAt':_0xee0e43[_0x5ab5('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3e2ac7,_0x271e65))[_0x5ab5('0x4e')](handleError(_0x3e2ac7,null));};exports[_0x5ab5('0x6d')]=function(_0x286ab2,_0x34e08d,_0x15a4e7){var _0x15b488={};var _0x4a24a9={};var _0x8d1c15;var _0x5c0b30;return db[_0x5ab5('0x36')][_0x5ab5('0x5f')]({'where':{'id':_0x286ab2['params']['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x34e08d,null))['then'](function(_0xa23f13){if(_0xa23f13){_0x8d1c15=_0xa23f13;_0x4a24a9[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db['Team'][_0x5ab5('0x37')]);_0x4a24a9[_0x5ab5('0x3a')]=_[_0x5ab5('0x3b')](_0x286ab2[_0x5ab5('0x3a')]);_0x4a24a9['filters']=_['intersection'](_0x4a24a9[_0x5ab5('0x3e')],_0x4a24a9['query']);_0x15b488[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x4a24a9[_0x5ab5('0x3e')],qs['fields'](_0x286ab2[_0x5ab5('0x3a')]['fields']));_0x15b488[_0x5ab5('0x3f')]=_0x15b488['attributes'][_0x5ab5('0x41')]?_0x15b488['attributes']:_0x4a24a9['model'];_0x15b488[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x286ab2[_0x5ab5('0x3a')][_0x5ab5('0x44')]);_0x15b488[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_['pick'](_0x286ab2[_0x5ab5('0x3a')],_0x4a24a9[_0x5ab5('0x3c')]));if(_0x286ab2['query'][_0x5ab5('0x46')]){_0x15b488['where']=_[_0x5ab5('0x47')](_0x15b488['where'],{'$or':_[_0x5ab5('0x35')](_0x15b488['attributes'],function(_0x10213d){var _0x350e62={};_0x350e62[_0x10213d]={'$like':'%'+_0x286ab2['query']['filter']+'%'};return _0x350e62;})});}_0x15b488=_[_0x5ab5('0x47')]({},_0x15b488,_0x286ab2[_0x5ab5('0x4a')]);return _0x8d1c15[_0x5ab5('0x6d')](_0x15b488);}})[_0x5ab5('0x2d')](function(_0x2489cf){if(_0x2489cf){_0x5c0b30=_0x2489cf['length'];if(!_0x286ab2['query'][_0x5ab5('0x42')]('nolimit')){_0x15b488['limit']=qs[_0x5ab5('0x26')](_0x286ab2[_0x5ab5('0x3a')][_0x5ab5('0x26')]);_0x15b488[_0x5ab5('0x28')]=qs[_0x5ab5('0x28')](_0x286ab2['query'][_0x5ab5('0x28')]);}return _0x8d1c15['getTeams'](_0x15b488);}})[_0x5ab5('0x2d')](function(_0x10a1fd){if(_0x10a1fd){return _0x10a1fd?{'count':_0x5c0b30,'rows':_0x10a1fd}:null;}})['then'](respondWithResult(_0x34e08d,null))[_0x5ab5('0x4e')](handleError(_0x34e08d,null));};exports[_0x5ab5('0x6e')]=function(_0x4df8ef,_0x2e8c77,_0xb8eceb){var _0x4f6754=_0x4df8ef[_0x5ab5('0x52')][_0x5ab5('0x6f')];return db[_0x5ab5('0x70')][_0x5ab5('0x4c')]({'where':{'id':_0x4f6754},'attributes':['id'],'include':[{'model':db[_0x5ab5('0x63')],'as':_0x5ab5('0x71'),'attributes':['id',_0x5ab5('0x32'),_0x5ab5('0x72'),_0x5ab5('0x73'),_0x5ab5('0x74')],'raw':!![]}]})[_0x5ab5('0x2d')](function(_0x621746){if(_0x621746){var _0x22ae56=_['flatMap'](_0x621746,function(_0x24dbe3){var _0x40370c=_0x24dbe3[_0x5ab5('0x2e')]({'plain':!![]});return _0x40370c[_0x5ab5('0x71')];});return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x4df8ef[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](function(_0x4fc0ee){return db[_0x5ab5('0x75')]['transaction'](function(_0x1537cc){return _0x4fc0ee[_0x5ab5('0x6e')](_0x4f6754,{'transaction':_0x1537cc})[_0x5ab5('0x2d')](function(){return BPromise[_0x5ab5('0x76')](_0x22ae56,function(_0x309c64){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x309c64['id'],'MailQueueId':_0x4df8ef[_0x5ab5('0x4f')]['id']},'transaction':_0x1537cc});});})[_0x5ab5('0x2d')](function(){_0x22ae56[_0x5ab5('0x77')](function(_0xaf3d1){socket['emit'](_0x5ab5('0x78'),{'UserId':_0xaf3d1['id'],'MailQueueId':_0x4fc0ee['id']});});});});});}})[_0x5ab5('0x2d')](respondWithStatusCode(_0x2e8c77,null))[_0x5ab5('0x4e')](handleError(_0x2e8c77,null));};exports[_0x5ab5('0x79')]=function(_0x35c4f3,_0x186877,_0x462220){return db[_0x5ab5('0x70')][_0x5ab5('0x4c')]({'where':{'id':_0x35c4f3[_0x5ab5('0x3a')][_0x5ab5('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5ab5('0x2d')](handleEntityNotFound(_0x186877,null))[_0x5ab5('0x2d')](function(_0x1653dd){var _0x86045=_[_0x5ab5('0x35')](_0x1653dd,'id');var _0x2e06d4=[];var _0x4c8970=[];var _0x41a0e9=squel[_0x5ab5('0x7a')]();_0x41a0e9['field'](_0x5ab5('0x7b'))['from'](_0x5ab5('0x7c'),'tq')[_0x5ab5('0x7d')](_0x5ab5('0x7e'),'ut',_0x5ab5('0x7f'))[_0x5ab5('0x45')](_0x5ab5('0x80'),_0x35c4f3['params']['id']);for(var _0x40f1ba=0x0;_0x40f1ba<_0x1653dd['length'];_0x40f1ba+=0x1){let _0x1d3857=_0x1653dd[_0x40f1ba];for(var _0x26f217=0x0;_0x26f217<_0x1d3857[_0x5ab5('0x71')][_0x5ab5('0x41')];_0x26f217+=0x1){let _0x5e1e08=_0x1d3857[_0x5ab5('0x71')][_0x26f217];var _0x4cafbd=_0x41a0e9['clone']();_0x4cafbd[_0x5ab5('0x45')]('ut.UserId\x20=\x20?',_0x5e1e08['id']);_0x4c8970[_0x5ab5('0x81')](db[_0x5ab5('0x75')][_0x5ab5('0x3a')](_0x4cafbd[_0x5ab5('0x82')](),{'type':db[_0x5ab5('0x75')][_0x5ab5('0x83')]['SELECT']})[_0x5ab5('0x2d')](function(_0x5f1499){if(_0x5f1499[_0x5ab5('0x41')]===0x1){return _0x5e1e08['id'];}else{var _0x2f96b5=_['every'](_['map'](_0x5f1499,_0x5ab5('0x84')),function(_0x1e9045){return _[_0x5ab5('0x85')](_0x86045,_0x1e9045);});if(_0x2f96b5){return _0x5e1e08['id'];}}}));}}return BPromise[_0x5ab5('0x86')](_0x4c8970)[_0x5ab5('0x2d')](function(_0x36c575){_0x2e06d4=_(_0x2e06d4)[_0x5ab5('0x87')](_0x36c575)[_0x5ab5('0x88')]()[_0x5ab5('0x89')]();return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x35c4f3[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](function(_0x21da96){return db[_0x5ab5('0x75')][_0x5ab5('0x8a')](function(_0x49c401){return _0x21da96[_0x5ab5('0x79')](_0x35c4f3[_0x5ab5('0x3a')][_0x5ab5('0x6f')],{'transaction':_0x49c401})['then'](function(){if(!_[_0x5ab5('0x8b')](_0x2e06d4)){return _0x21da96[_0x5ab5('0x8c')](_0x2e06d4,{'transaction':_0x49c401});}})['then'](function(){_0x2e06d4[_0x5ab5('0x77')](function(_0x3511a9){socket[_0x5ab5('0x8d')](_0x5ab5('0x8e'),{'UserId':_0x3511a9,'MailQueueId':_0x21da96['id']});});});});});});})[_0x5ab5('0x2d')](respondWithStatusCode(_0x186877,null))[_0x5ab5('0x4e')](handleError(_0x186877,null));};exports[_0x5ab5('0x8f')]=function(_0x295620,_0x13bbea,_0x2c0587){return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x295620[_0x5ab5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13bbea,null))[_0x5ab5('0x2d')](function(_0x48af1b){if(_0x48af1b){return _0x48af1b[_0x5ab5('0x8f')](_0x295620[_0x5ab5('0x52')][_0x5ab5('0x6f')],_[_0x5ab5('0x90')](_0x295620[_0x5ab5('0x52')],[_0x5ab5('0x6f'),'id'])||{})[_0x5ab5('0x91')](function(_0x5603d5){for(var _0x5573b5=0x0;_0x5573b5<_0x295620[_0x5ab5('0x52')][_0x5ab5('0x6f')]['length'];_0x5573b5+=0x1){socket[_0x5ab5('0x8d')](_0x5ab5('0x78'),{'UserId':Number(_0x295620['body'][_0x5ab5('0x6f')][_0x5573b5]),'MailQueueId':Number(_0x295620[_0x5ab5('0x4f')]['id'])});}return _0x5603d5;});}})['then'](respondWithResult(_0x13bbea,null))[_0x5ab5('0x4e')](handleError(_0x13bbea,null));};exports[_0x5ab5('0x8c')]=function(_0x3a53ec,_0x3b0f37,_0x226000){return db[_0x5ab5('0x36')][_0x5ab5('0x57')]({'where':{'id':_0x3a53ec[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x3b0f37,null))[_0x5ab5('0x2d')](function(_0x5788de){if(_0x5788de){return _0x5788de[_0x5ab5('0x8c')](_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')])[_0x5ab5('0x2d')](function(){if(_[_0x5ab5('0x92')](_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')])){for(var _0x400508=0x0;_0x400508<_0x3a53ec[_0x5ab5('0x3a')][_0x5ab5('0x6f')][_0x5ab5('0x41')];_0x400508+=0x1){socket[_0x5ab5('0x8d')](_0x5ab5('0x8e'),{'UserId':Number(_0x3a53ec[_0x5ab5('0x3a')]['ids'][_0x400508]),'MailQueueId':Number(_0x3a53ec[_0x5ab5('0x4f')]['id'])});}}else{socket['emit'](_0x5ab5('0x8e'),{'UserId':Number(_0x3a53ec[_0x5ab5('0x3a')]['ids']),'MailQueueId':Number(_0x3a53ec['params']['id'])});}});}})[_0x5ab5('0x2d')](respondWithStatusCode(_0x3b0f37,null))[_0x5ab5('0x4e')](handleError(_0x3b0f37,null));};exports['getAgents']=function(_0x3f6389,_0x57a1ff,_0x3f8950){var _0x5744fc={};var _0x561cb8={};var _0x2f4693;var _0x392656;return db['MailQueue']['findOne']({'where':{'id':_0x3f6389[_0x5ab5('0x4f')]['id']}})[_0x5ab5('0x2d')](handleEntityNotFound(_0x57a1ff,null))[_0x5ab5('0x2d')](function(_0x2f5e46){if(_0x2f5e46){_0x2f4693=_0x2f5e46;_0x561cb8[_0x5ab5('0x3e')]=_[_0x5ab5('0x3b')](db[_0x5ab5('0x63')][_0x5ab5('0x37')]);_0x561cb8['query']=_[_0x5ab5('0x3b')](_0x3f6389['query']);_0x561cb8[_0x5ab5('0x3c')]=_[_0x5ab5('0x3d')](_0x561cb8[_0x5ab5('0x3e')],_0x561cb8['query']);_0x5744fc[_0x5ab5('0x3f')]=_[_0x5ab5('0x3d')](_0x561cb8[_0x5ab5('0x3e')],qs[_0x5ab5('0x40')](_0x3f6389['query']['fields']));_0x5744fc[_0x5ab5('0x3f')]=_0x5744fc['attributes']['length']?_0x5744fc[_0x5ab5('0x3f')]:_0x561cb8['model'];_0x5744fc[_0x5ab5('0x43')]=qs[_0x5ab5('0x44')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x44')]);_0x5744fc[_0x5ab5('0x45')]=qs[_0x5ab5('0x3c')](_[_0x5ab5('0x93')](_0x3f6389[_0x5ab5('0x3a')],_0x561cb8['filters']));if(_0x3f6389['query'][_0x5ab5('0x46')]){_0x5744fc['where']=_[_0x5ab5('0x47')](_0x5744fc[_0x5ab5('0x45')],{'$or':_[_0x5ab5('0x35')](_0x5744fc[_0x5ab5('0x3f')],function(_0x1bdb7c){var _0x47dfd2={};_0x47dfd2[_0x1bdb7c]={'$like':'%'+_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x46')]+'%'};return _0x47dfd2;})});}_0x5744fc=_[_0x5ab5('0x47')]({},_0x5744fc,_0x3f6389[_0x5ab5('0x4a')]);return _0x2f4693[_0x5ab5('0x94')](_0x5744fc);}})['then'](function(_0x4fce1a){if(_0x4fce1a){_0x392656=_0x4fce1a[_0x5ab5('0x41')];if(!_0x3f6389['query'][_0x5ab5('0x42')](_0x5ab5('0x61'))){_0x5744fc[_0x5ab5('0x26')]=qs[_0x5ab5('0x26')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x26')]);_0x5744fc[_0x5ab5('0x28')]=qs[_0x5ab5('0x28')](_0x3f6389[_0x5ab5('0x3a')][_0x5ab5('0x28')]);}return _0x2f4693[_0x5ab5('0x94')](_0x5744fc);}})[_0x5ab5('0x2d')](function(_0x208e6b){if(_0x208e6b){return _0x208e6b?{'count':_0x392656,'rows':_0x208e6b}:null;}})['then'](respondWithResult(_0x57a1ff,null))[_0x5ab5('0x4e')](handleError(_0x57a1ff,null));}; \ No newline at end of file +var _0xf46a=['tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','MailQueues','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','hasOwnProperty','order','MailQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','SIP','mailPause','getTeams','Team','addTeams','Agents','voicePause','flatMap','sequelize','forEach','emit','userMailQueue:save','ids'];(function(_0xa5149a,_0x220e87){var _0x1c43a2=function(_0x583a73){while(--_0x583a73){_0xa5149a['push'](_0xa5149a['shift']());}};_0x1c43a2(++_0x220e87);}(_0xf46a,0xa4));var _0xaf46=function(_0x40c4b0,_0x3d0b8c){_0x40c4b0=_0x40c4b0-0x0;var _0x48b443=_0xf46a[_0x40c4b0];return _0x48b443;};'use strict';var emlformat=require(_0xaf46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf46('0x1'));var jsonpatch=require(_0xaf46('0x2'));var rp=require('request-promise');var moment=require(_0xaf46('0x3'));var BPromise=require(_0xaf46('0x4'));var Mustache=require(_0xaf46('0x5'));var util=require(_0xaf46('0x6'));var path=require(_0xaf46('0x7'));var sox=require(_0xaf46('0x8'));var csv=require(_0xaf46('0x9'));var ejs=require(_0xaf46('0xa'));var fs=require('fs');var fs_extra=require(_0xaf46('0xb'));var _=require(_0xaf46('0xc'));var squel=require(_0xaf46('0xd'));var crypto=require(_0xaf46('0xe'));var jsforce=require(_0xaf46('0xf'));var deskjs=require(_0xaf46('0x10'));var toCsv=require('to-csv');var querystring=require(_0xaf46('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf46('0x12'));var as=require(_0xaf46('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf46('0x14'))(_0xaf46('0x15'));var utils=require(_0xaf46('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xaf46('0x17'));var db=require('../../mysqldb')['db'];config[_0xaf46('0x18')]=_['defaults'](config[_0xaf46('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf46('0x19'))(new Redis(config[_0xaf46('0x18')]));require(_0xaf46('0x1a'))[_0xaf46('0x1b')](socket);function respondWithStatusCode(_0x453a9a,_0x38e6c8){_0x38e6c8=_0x38e6c8||0xcc;return function(_0x370941){if(_0x370941){return _0x453a9a[_0xaf46('0x1c')](_0x38e6c8);}return _0x453a9a['status'](_0x38e6c8)['end']();};}function respondWithResult(_0x5819e3,_0x1693e4){_0x1693e4=_0x1693e4||0xc8;return function(_0x5bccdf){if(_0x5bccdf){return _0x5819e3['status'](_0x1693e4)[_0xaf46('0x1d')](_0x5bccdf);}};}function respondWithFilteredResult(_0x34b107,_0x51014f){return function(_0x128ad8){if(_0x128ad8){var _0x3a26f1=typeof _0x51014f[_0xaf46('0x1e')]===_0xaf46('0x1f')&&typeof _0x51014f[_0xaf46('0x20')]===_0xaf46('0x1f');var _0x52e5c8=_0x128ad8[_0xaf46('0x21')];var _0x110d51=_0x3a26f1?0x0:_0x51014f['offset'];var _0x166c8d=_0x3a26f1?_0x128ad8[_0xaf46('0x21')]:_0x51014f['offset']+_0x51014f['limit'];var _0x535ef1;if(_0x166c8d>=_0x52e5c8){_0x166c8d=_0x52e5c8;_0x535ef1=0xc8;}else{_0x535ef1=0xce;}_0x34b107[_0xaf46('0x22')](_0x535ef1);return _0x34b107[_0xaf46('0x23')]('Content-Range',_0x110d51+'-'+_0x166c8d+'/'+_0x52e5c8)[_0xaf46('0x1d')](_0x128ad8);}return null;};}function patchUpdates(_0x539489){return function(_0x2baa52){try{jsonpatch[_0xaf46('0x24')](_0x2baa52,_0x539489,!![]);}catch(_0x4759bb){return BPromise[_0xaf46('0x25')](_0x4759bb);}return _0x2baa52[_0xaf46('0x26')]();};}function saveUpdates(_0x39946c,_0x166a0e){return function(_0x119a98){if(_0x119a98){return _0x119a98[_0xaf46('0x27')](_0x39946c)[_0xaf46('0x28')](function(_0x4fa802){return _0x4fa802;});}return null;};}function removeEntity(_0x52354d,_0x31b5e7){return function(_0x288777){if(_0x288777){return _0x288777[_0xaf46('0x29')]()[_0xaf46('0x28')](function(){var _0x102c92=_0x288777[_0xaf46('0x2a')]({'plain':!![]});var _0x2b4c69=_0xaf46('0x2b');return db['UserProfileResource'][_0xaf46('0x29')]({'where':{'type':_0x2b4c69,'resourceId':_0x102c92['id']}})[_0xaf46('0x28')](function(){return _0x288777;});})['then'](function(){_0x52354d[_0xaf46('0x22')](0xcc)[_0xaf46('0x2c')]();});}};}function handleEntityNotFound(_0x1f1349,_0x9bc6ef){return function(_0x3b04d6){if(!_0x3b04d6){_0x1f1349[_0xaf46('0x1c')](0x194);}return _0x3b04d6;};}function handleError(_0x57246b,_0x707155){_0x707155=_0x707155||0x1f4;return function(_0x15cba5){logger['error'](_0x15cba5[_0xaf46('0x2d')]);if(_0x15cba5[_0xaf46('0x2e')]){delete _0x15cba5[_0xaf46('0x2e')];}_0x57246b[_0xaf46('0x22')](_0x707155)[_0xaf46('0x2f')](_0x15cba5);};}exports[_0xaf46('0x30')]=function(_0x1dfa19,_0x27b76f){var _0x955b4b={},_0x8ebbb8={},_0x3b8e8c={'count':0x0,'rows':[]};var _0x5ec8e7=_[_0xaf46('0x31')](db['MailQueue'][_0xaf46('0x32')],function(_0x613d68){return{'name':_0x613d68[_0xaf46('0x33')],'type':_0x613d68[_0xaf46('0x34')]['key']};});_0x8ebbb8[_0xaf46('0x35')]=_[_0xaf46('0x31')](_0x5ec8e7,_0xaf46('0x2e'));_0x8ebbb8[_0xaf46('0x36')]=_['keys'](_0x1dfa19['query']);_0x8ebbb8[_0xaf46('0x37')]=_[_0xaf46('0x38')](_0x8ebbb8[_0xaf46('0x35')],_0x8ebbb8[_0xaf46('0x36')]);_0x955b4b['attributes']=_[_0xaf46('0x38')](_0x8ebbb8[_0xaf46('0x35')],qs[_0xaf46('0x39')](_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x39')]));_0x955b4b[_0xaf46('0x3a')]=_0x955b4b['attributes'][_0xaf46('0x3b')]?_0x955b4b['attributes']:_0x8ebbb8[_0xaf46('0x35')];if(!_0x1dfa19[_0xaf46('0x36')]['hasOwnProperty'](_0xaf46('0x3c'))){_0x955b4b[_0xaf46('0x20')]=qs[_0xaf46('0x20')](_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x20')]);_0x955b4b['offset']=qs[_0xaf46('0x1e')](_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x1e')]);}_0x955b4b['order']=qs[_0xaf46('0x3d')](_0x1dfa19['query'][_0xaf46('0x3d')]);_0x955b4b[_0xaf46('0x3e')]=qs['filters'](_[_0xaf46('0x3f')](_0x1dfa19[_0xaf46('0x36')],_0x8ebbb8[_0xaf46('0x37')]),_0x5ec8e7);if(_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x40')]){_0x955b4b[_0xaf46('0x3e')]=_[_0xaf46('0x41')](_0x955b4b[_0xaf46('0x3e')],{'$or':_[_0xaf46('0x31')](_0x5ec8e7,function(_0x464b11){if(_0x464b11[_0xaf46('0x34')]!==_0xaf46('0x42')){var _0x46250d={};_0x46250d[_0x464b11[_0xaf46('0x2e')]]={'$like':'%'+_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x40')]+'%'};return _0x46250d;}})});}_0x955b4b=_[_0xaf46('0x41')]({},_0x955b4b,_0x1dfa19[_0xaf46('0x43')]);var _0xb34cc0={'where':_0x955b4b[_0xaf46('0x3e')]};return db[_0xaf46('0x44')][_0xaf46('0x21')](_0xb34cc0)['then'](function(_0x3e601e){_0x3b8e8c['count']=_0x3e601e;if(_0x1dfa19[_0xaf46('0x36')][_0xaf46('0x45')]){_0x955b4b[_0xaf46('0x46')]=[{'all':!![]}];}return db[_0xaf46('0x44')][_0xaf46('0x47')](_0x955b4b);})[_0xaf46('0x28')](function(_0x463ad7){_0x3b8e8c[_0xaf46('0x48')]=_0x463ad7;return _0x3b8e8c;})[_0xaf46('0x28')](respondWithFilteredResult(_0x27b76f,_0x955b4b))['catch'](handleError(_0x27b76f,null));};exports['show']=function(_0x504c4a,_0x427251){var _0x159365={'raw':!![],'where':{'id':_0x504c4a[_0xaf46('0x49')]['id']}},_0x4a810a={};_0x4a810a[_0xaf46('0x35')]=_[_0xaf46('0x4a')](db['MailQueue'][_0xaf46('0x32')]);_0x4a810a[_0xaf46('0x36')]=_[_0xaf46('0x4a')](_0x504c4a[_0xaf46('0x36')]);_0x4a810a[_0xaf46('0x37')]=_['intersection'](_0x4a810a[_0xaf46('0x35')],_0x4a810a[_0xaf46('0x36')]);_0x159365[_0xaf46('0x3a')]=_[_0xaf46('0x38')](_0x4a810a['model'],qs[_0xaf46('0x39')](_0x504c4a[_0xaf46('0x36')]['fields']));_0x159365[_0xaf46('0x3a')]=_0x159365[_0xaf46('0x3a')][_0xaf46('0x3b')]?_0x159365['attributes']:_0x4a810a[_0xaf46('0x35')];if(_0x504c4a[_0xaf46('0x36')][_0xaf46('0x45')]){_0x159365[_0xaf46('0x46')]=[{'all':!![]}];}_0x159365=_[_0xaf46('0x41')]({},_0x159365,_0x504c4a['options']);return db[_0xaf46('0x44')][_0xaf46('0x4b')](_0x159365)['then'](handleEntityNotFound(_0x427251,null))[_0xaf46('0x28')](respondWithResult(_0x427251,null))[_0xaf46('0x4c')](handleError(_0x427251,null));};exports[_0xaf46('0x4d')]=function(_0x527f52,_0x1286a2){return db[_0xaf46('0x44')][_0xaf46('0x4d')](_0x527f52[_0xaf46('0x4e')],{})[_0xaf46('0x28')](function(_0x22338f){var _0x30d1d2=_0x527f52[_0xaf46('0x4f')][_0xaf46('0x2a')]({'plain':!![]});if(!_0x30d1d2)throw new Error(_0xaf46('0x50'));if(_0x30d1d2[_0xaf46('0x51')]===_0xaf46('0x4f')){var _0x58b631=_0x22338f[_0xaf46('0x2a')]({'plain':!![]});var _0x176300='MailQueues';return db['UserProfileSection'][_0xaf46('0x4b')]({'where':{'name':_0x176300,'userProfileId':_0x30d1d2[_0xaf46('0x52')]},'raw':!![]})[_0xaf46('0x28')](function(_0x5a819e){if(_0x5a819e&&_0x5a819e[_0xaf46('0x53')]===0x0){return db[_0xaf46('0x54')][_0xaf46('0x4d')]({'name':_0x58b631['name'],'resourceId':_0x58b631['id'],'type':_0x5a819e[_0xaf46('0x2e')],'sectionId':_0x5a819e['id']},{})[_0xaf46('0x28')](function(){return _0x22338f;});}else{return _0x22338f;}})[_0xaf46('0x4c')](function(_0x3b266b){logger['error'](_0xaf46('0x55'),_0x3b266b);throw _0x3b266b;});}return _0x22338f;})[_0xaf46('0x28')](respondWithResult(_0x1286a2,0xc9))[_0xaf46('0x4c')](handleError(_0x1286a2,null));};exports[_0xaf46('0x27')]=function(_0x3802ce,_0x13ed2b){if(_0x3802ce['body']['id']){delete _0x3802ce[_0xaf46('0x4e')]['id'];}return db[_0xaf46('0x44')][_0xaf46('0x4b')]({'where':{'id':_0x3802ce[_0xaf46('0x49')]['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x13ed2b,null))['then'](saveUpdates(_0x3802ce[_0xaf46('0x4e')],null))[_0xaf46('0x28')](respondWithResult(_0x13ed2b,null))[_0xaf46('0x4c')](handleError(_0x13ed2b,null));};exports[_0xaf46('0x29')]=function(_0x1f3932,_0x48eb87){return db['MailQueue'][_0xaf46('0x4b')]({'where':{'id':_0x1f3932[_0xaf46('0x49')]['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x48eb87,null))[_0xaf46('0x28')](removeEntity(_0x48eb87,null))['catch'](handleError(_0x48eb87,null));};exports[_0xaf46('0x56')]=function(_0x5d8a51,_0x4ee0b0){return db[_0xaf46('0x44')]['describe']()[_0xaf46('0x28')](respondWithResult(_0x4ee0b0,null))['catch'](handleError(_0x4ee0b0,null));};exports['getMembers']=function(_0x43e4ab,_0x280d12,_0x2b90ea){var _0x554525={'raw':!![],'where':{}},_0x498175={},_0x22c7fa;return db[_0xaf46('0x44')]['findOne']({'where':{'id':_0x43e4ab['params']['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x280d12,null))['then'](function(_0x3d0ce5){if(_0x3d0ce5){_0x22c7fa=_0x3d0ce5['get']({'plain':!![]});_0x498175['model']=_['keys'](db[_0xaf46('0x57')][_0xaf46('0x32')]);_0x498175['query']=_[_0xaf46('0x4a')](_0x43e4ab[_0xaf46('0x36')]);_0x498175[_0xaf46('0x37')]=_[_0xaf46('0x38')](_0x498175[_0xaf46('0x35')],_0x498175[_0xaf46('0x36')]);_0x554525[_0xaf46('0x3a')]=_[_0xaf46('0x38')](_0x498175[_0xaf46('0x35')],qs[_0xaf46('0x39')](_0x43e4ab[_0xaf46('0x36')][_0xaf46('0x39')]));_0x554525['attributes']=_0x554525[_0xaf46('0x3a')][_0xaf46('0x3b')]?_0x554525['attributes']:_0x498175['model'];if(!_0x43e4ab[_0xaf46('0x36')][_0xaf46('0x58')](_0xaf46('0x3c'))){_0x554525[_0xaf46('0x20')]=qs[_0xaf46('0x20')](_0x43e4ab['query'][_0xaf46('0x20')]);_0x554525['offset']=qs[_0xaf46('0x1e')](_0x43e4ab[_0xaf46('0x36')][_0xaf46('0x1e')]);}_0x554525[_0xaf46('0x59')]=qs[_0xaf46('0x3d')](_0x43e4ab[_0xaf46('0x36')][_0xaf46('0x3d')]);_0x554525[_0xaf46('0x3e')]=qs['filters'](_['pick'](_0x43e4ab['query'],_0x498175['filters']));_0x554525[_0xaf46('0x3e')][_0xaf46('0x5a')]=_0x3d0ce5['id'];if(_0x43e4ab['query']['filter']){_0x554525[_0xaf46('0x3e')]=_[_0xaf46('0x41')](_0x554525[_0xaf46('0x3e')],{'$or':_[_0xaf46('0x31')](_0x554525[_0xaf46('0x3a')],function(_0x2e90d){var _0x36c058={};_0x36c058[_0x2e90d]={'$like':'%'+_0x43e4ab[_0xaf46('0x36')][_0xaf46('0x40')]+'%'};return _0x36c058;})});}_0x554525=_[_0xaf46('0x41')]({},_0x554525,_0x43e4ab[_0xaf46('0x43')]);return db['UserMailQueue'][_0xaf46('0x47')](_0x554525);}})['then'](function(_0x519ed7){if(_0x519ed7){return db[_0xaf46('0x5b')][_0xaf46('0x5c')]({'where':{'id':_[_0xaf46('0x31')](_0x519ed7,_0xaf46('0x5d')),'role':'agent'},'attributes':['id','name','mailPause',_0xaf46('0x5e'),_0xaf46('0x5f')]});}})[_0xaf46('0x28')](function(_0x3ca165){if(_0x3ca165){return{'count':_0x3ca165[_0xaf46('0x21')],'rows':_[_0xaf46('0x31')](_0x3ca165[_0xaf46('0x48')],function(_0x408c97){return{'membername':_0x408c97['name'],'UserId':_0x408c97['id'],'queue_name':_0x22c7fa[_0xaf46('0x2e')],'MailQueueId':_0x22c7fa['id'],'interface':util[_0xaf46('0x60')]('%s/%s',_0xaf46('0x61'),_0x408c97[_0xaf46('0x2e')]),'penalty':0x0,'paused':_0x408c97[_0xaf46('0x62')],'createdAt':_0x408c97[_0xaf46('0x5f')],'updatedAt':_0x408c97[_0xaf46('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf46('0x28')](respondWithFilteredResult(_0x280d12,_0x554525))[_0xaf46('0x4c')](handleError(_0x280d12,null));};exports[_0xaf46('0x63')]=function(_0x40642b,_0x135da8,_0x2173bf){var _0x5ba44c={};var _0x5099d8={};var _0xe428ad;var _0x485a12;return db[_0xaf46('0x44')]['findOne']({'where':{'id':_0x40642b[_0xaf46('0x49')]['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x135da8,null))[_0xaf46('0x28')](function(_0x34d259){if(_0x34d259){_0xe428ad=_0x34d259;_0x5099d8[_0xaf46('0x35')]=_[_0xaf46('0x4a')](db[_0xaf46('0x64')][_0xaf46('0x32')]);_0x5099d8['query']=_[_0xaf46('0x4a')](_0x40642b[_0xaf46('0x36')]);_0x5099d8[_0xaf46('0x37')]=_['intersection'](_0x5099d8[_0xaf46('0x35')],_0x5099d8[_0xaf46('0x36')]);_0x5ba44c[_0xaf46('0x3a')]=_[_0xaf46('0x38')](_0x5099d8[_0xaf46('0x35')],qs[_0xaf46('0x39')](_0x40642b[_0xaf46('0x36')]['fields']));_0x5ba44c[_0xaf46('0x3a')]=_0x5ba44c[_0xaf46('0x3a')][_0xaf46('0x3b')]?_0x5ba44c[_0xaf46('0x3a')]:_0x5099d8['model'];_0x5ba44c[_0xaf46('0x59')]=qs['sort'](_0x40642b[_0xaf46('0x36')][_0xaf46('0x3d')]);_0x5ba44c[_0xaf46('0x3e')]=qs['filters'](_[_0xaf46('0x3f')](_0x40642b['query'],_0x5099d8[_0xaf46('0x37')]));if(_0x40642b[_0xaf46('0x36')][_0xaf46('0x40')]){_0x5ba44c[_0xaf46('0x3e')]=_[_0xaf46('0x41')](_0x5ba44c[_0xaf46('0x3e')],{'$or':_[_0xaf46('0x31')](_0x5ba44c[_0xaf46('0x3a')],function(_0x4db6b9){var _0x2fad40={};_0x2fad40[_0x4db6b9]={'$like':'%'+_0x40642b[_0xaf46('0x36')]['filter']+'%'};return _0x2fad40;})});}_0x5ba44c=_[_0xaf46('0x41')]({},_0x5ba44c,_0x40642b[_0xaf46('0x43')]);return _0xe428ad[_0xaf46('0x63')](_0x5ba44c);}})['then'](function(_0xd625b3){if(_0xd625b3){_0x485a12=_0xd625b3[_0xaf46('0x3b')];if(!_0x40642b[_0xaf46('0x36')]['hasOwnProperty']('nolimit')){_0x5ba44c[_0xaf46('0x20')]=qs[_0xaf46('0x20')](_0x40642b[_0xaf46('0x36')][_0xaf46('0x20')]);_0x5ba44c[_0xaf46('0x1e')]=qs[_0xaf46('0x1e')](_0x40642b['query'][_0xaf46('0x1e')]);}return _0xe428ad[_0xaf46('0x63')](_0x5ba44c);}})[_0xaf46('0x28')](function(_0x45bf4a){if(_0x45bf4a){return _0x45bf4a?{'count':_0x485a12,'rows':_0x45bf4a}:null;}})['then'](respondWithResult(_0x135da8,null))['catch'](handleError(_0x135da8,null));};exports[_0xaf46('0x65')]=function(_0xe910bf,_0x995acc,_0x54caa1){var _0x121f97=_0xe910bf['body']['ids'];return db[_0xaf46('0x64')][_0xaf46('0x47')]({'where':{'id':_0x121f97},'attributes':['id'],'include':[{'model':db[_0xaf46('0x5b')],'as':_0xaf46('0x66'),'attributes':['id','name','online',_0xaf46('0x67'),'interface'],'raw':!![]}]})[_0xaf46('0x28')](function(_0x3e8b6f){if(_0x3e8b6f){var _0x2aae6b=_[_0xaf46('0x68')](_0x3e8b6f,function(_0x39052b){var _0x5cd4aa=_0x39052b[_0xaf46('0x2a')]({'plain':!![]});return _0x5cd4aa[_0xaf46('0x66')];});return db[_0xaf46('0x44')][_0xaf46('0x4b')]({'where':{'id':_0xe910bf[_0xaf46('0x49')]['id']}})[_0xaf46('0x28')](function(_0x100d9e){return db[_0xaf46('0x69')]['transaction'](function(_0x24ff7c){return _0x100d9e['addTeams'](_0x121f97,{'transaction':_0x24ff7c})[_0xaf46('0x28')](function(){return BPromise['each'](_0x2aae6b,function(_0x4a0cae){return db[_0xaf46('0x57')]['findOrCreate']({'where':{'UserId':_0x4a0cae['id'],'MailQueueId':_0xe910bf[_0xaf46('0x49')]['id']},'transaction':_0x24ff7c});});})[_0xaf46('0x28')](function(){_0x2aae6b[_0xaf46('0x6a')](function(_0x22773a){socket[_0xaf46('0x6b')](_0xaf46('0x6c'),{'UserId':_0x22773a['id'],'MailQueueId':_0x100d9e['id']});});});});});}})[_0xaf46('0x28')](respondWithStatusCode(_0x995acc,null))['catch'](handleError(_0x995acc,null));};exports['removeTeams']=function(_0x5931e1,_0x3b1a24,_0x443a3e){return db[_0xaf46('0x64')][_0xaf46('0x47')]({'where':{'id':_0x5931e1[_0xaf46('0x36')][_0xaf46('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xaf46('0x5b')],'as':_0xaf46('0x66'),'attributes':['id'],'raw':!![]}]})[_0xaf46('0x28')](handleEntityNotFound(_0x3b1a24,null))[_0xaf46('0x28')](function(_0x3ce1a4){var _0x4a6c23=_['map'](_0x3ce1a4,'id');var _0x51c995=[];var _0x17306b=[];var _0x224807=squel['select']();_0x224807['field'](_0xaf46('0x6e'))[_0xaf46('0x6f')](_0xaf46('0x70'),'tq')[_0xaf46('0x71')]('user_has_teams','ut',_0xaf46('0x72'))['where'](_0xaf46('0x73'),_0x5931e1[_0xaf46('0x49')]['id']);for(var _0x32c711=0x0;_0x32c711<_0x3ce1a4[_0xaf46('0x3b')];_0x32c711+=0x1){let _0x10f65f=_0x3ce1a4[_0x32c711];for(var _0x39abeb=0x0;_0x39abeb<_0x10f65f['Agents'][_0xaf46('0x3b')];_0x39abeb+=0x1){let _0x2cb00e=_0x10f65f[_0xaf46('0x66')][_0x39abeb];var _0x219a80=_0x224807[_0xaf46('0x74')]();_0x219a80[_0xaf46('0x3e')](_0xaf46('0x75'),_0x2cb00e['id']);_0x17306b[_0xaf46('0x76')](db[_0xaf46('0x69')][_0xaf46('0x36')](_0x219a80[_0xaf46('0x77')](),{'type':db[_0xaf46('0x69')][_0xaf46('0x78')][_0xaf46('0x79')]})[_0xaf46('0x28')](function(_0x3d39d7){if(_0x3d39d7['length']===0x1){return _0x2cb00e['id'];}else{var _0x2e83e5=_[_0xaf46('0x7a')](_[_0xaf46('0x31')](_0x3d39d7,_0xaf46('0x7b')),function(_0x242732){return _[_0xaf46('0x7c')](_0x4a6c23,_0x242732);});if(_0x2e83e5){return _0x2cb00e['id'];}}}));}}return BPromise['all'](_0x17306b)['then'](function(_0x55a2b3){_0x51c995=_(_0x51c995)[_0xaf46('0x7d')](_0x55a2b3)[_0xaf46('0x7e')]()['value']();return db[_0xaf46('0x44')][_0xaf46('0x4b')]({'where':{'id':_0x5931e1[_0xaf46('0x49')]['id']}})['then'](function(_0x2cdb55){return db['sequelize'][_0xaf46('0x7f')](function(_0x36d60d){return _0x2cdb55[_0xaf46('0x80')](_0x5931e1[_0xaf46('0x36')][_0xaf46('0x6d')],{'transaction':_0x36d60d})['then'](function(){if(!_[_0xaf46('0x81')](_0x51c995)){return _0x2cdb55[_0xaf46('0x82')](_0x51c995,{'transaction':_0x36d60d});}})[_0xaf46('0x28')](function(){_0x51c995['forEach'](function(_0x3b122f){socket[_0xaf46('0x6b')](_0xaf46('0x83'),{'UserId':_0x3b122f,'MailQueueId':_0x2cdb55['id']});});});});});});})['then'](respondWithStatusCode(_0x3b1a24,null))[_0xaf46('0x4c')](handleError(_0x3b1a24,null));};exports[_0xaf46('0x84')]=function(_0x3633a7,_0x5e2570,_0x49e8d5){return db[_0xaf46('0x44')]['find']({'where':{'id':_0x3633a7['params']['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x5e2570,null))[_0xaf46('0x28')](function(_0x526fd4){if(_0x526fd4){return _0x526fd4[_0xaf46('0x84')](_0x3633a7['body'][_0xaf46('0x6d')],_[_0xaf46('0x85')](_0x3633a7['body'],['ids','id'])||{})[_0xaf46('0x86')](function(_0x30e181){for(var _0x51793f=0x0;_0x51793f<_0x3633a7['body'][_0xaf46('0x6d')][_0xaf46('0x3b')];_0x51793f+=0x1){socket[_0xaf46('0x6b')]('userMailQueue:save',{'UserId':Number(_0x3633a7[_0xaf46('0x4e')]['ids'][_0x51793f]),'MailQueueId':Number(_0x3633a7[_0xaf46('0x49')]['id'])});}return _0x30e181;});}})[_0xaf46('0x28')](respondWithResult(_0x5e2570,null))[_0xaf46('0x4c')](handleError(_0x5e2570,null));};exports[_0xaf46('0x82')]=function(_0x26c4b7,_0x1d2ecf,_0x5b4132){return db[_0xaf46('0x44')][_0xaf46('0x4b')]({'where':{'id':_0x26c4b7[_0xaf46('0x49')]['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x1d2ecf,null))[_0xaf46('0x28')](function(_0x2d2c94){if(_0x2d2c94){return _0x2d2c94[_0xaf46('0x82')](_0x26c4b7[_0xaf46('0x36')][_0xaf46('0x6d')])[_0xaf46('0x28')](function(){if(_[_0xaf46('0x87')](_0x26c4b7[_0xaf46('0x36')]['ids'])){for(var _0x4e0034=0x0;_0x4e0034<_0x26c4b7['query'][_0xaf46('0x6d')]['length'];_0x4e0034+=0x1){socket[_0xaf46('0x6b')](_0xaf46('0x83'),{'UserId':Number(_0x26c4b7['query'][_0xaf46('0x6d')][_0x4e0034]),'MailQueueId':Number(_0x26c4b7['params']['id'])});}}else{socket['emit'](_0xaf46('0x83'),{'UserId':Number(_0x26c4b7[_0xaf46('0x36')]['ids']),'MailQueueId':Number(_0x26c4b7['params']['id'])});}});}})[_0xaf46('0x28')](respondWithStatusCode(_0x1d2ecf,null))['catch'](handleError(_0x1d2ecf,null));};exports['getAgents']=function(_0x3a7e2f,_0x32bad6,_0xe5abfc){var _0x3fc945={};var _0x2902a5={};var _0x8d07fa;var _0x39f81d;return db[_0xaf46('0x44')]['findOne']({'where':{'id':_0x3a7e2f['params']['id']}})[_0xaf46('0x28')](handleEntityNotFound(_0x32bad6,null))[_0xaf46('0x28')](function(_0x5b40f9){if(_0x5b40f9){_0x8d07fa=_0x5b40f9;_0x2902a5[_0xaf46('0x35')]=_[_0xaf46('0x4a')](db[_0xaf46('0x5b')][_0xaf46('0x32')]);_0x2902a5[_0xaf46('0x36')]=_[_0xaf46('0x4a')](_0x3a7e2f['query']);_0x2902a5[_0xaf46('0x37')]=_[_0xaf46('0x38')](_0x2902a5['model'],_0x2902a5[_0xaf46('0x36')]);_0x3fc945[_0xaf46('0x3a')]=_[_0xaf46('0x38')](_0x2902a5['model'],qs[_0xaf46('0x39')](_0x3a7e2f[_0xaf46('0x36')]['fields']));_0x3fc945[_0xaf46('0x3a')]=_0x3fc945['attributes']['length']?_0x3fc945[_0xaf46('0x3a')]:_0x2902a5[_0xaf46('0x35')];_0x3fc945[_0xaf46('0x59')]=qs[_0xaf46('0x3d')](_0x3a7e2f[_0xaf46('0x36')]['sort']);_0x3fc945[_0xaf46('0x3e')]=qs[_0xaf46('0x37')](_[_0xaf46('0x3f')](_0x3a7e2f[_0xaf46('0x36')],_0x2902a5[_0xaf46('0x37')]));if(_0x3a7e2f[_0xaf46('0x36')][_0xaf46('0x40')]){_0x3fc945[_0xaf46('0x3e')]=_['merge'](_0x3fc945[_0xaf46('0x3e')],{'$or':_[_0xaf46('0x31')](_0x3fc945['attributes'],function(_0x2205a3){var _0x4ff8e8={};_0x4ff8e8[_0x2205a3]={'$like':'%'+_0x3a7e2f[_0xaf46('0x36')][_0xaf46('0x40')]+'%'};return _0x4ff8e8;})});}_0x3fc945=_[_0xaf46('0x41')]({},_0x3fc945,_0x3a7e2f[_0xaf46('0x43')]);return _0x8d07fa[_0xaf46('0x88')](_0x3fc945);}})[_0xaf46('0x28')](function(_0x11819c){if(_0x11819c){_0x39f81d=_0x11819c[_0xaf46('0x3b')];if(!_0x3a7e2f['query'][_0xaf46('0x58')]('nolimit')){_0x3fc945[_0xaf46('0x20')]=qs[_0xaf46('0x20')](_0x3a7e2f['query']['limit']);_0x3fc945[_0xaf46('0x1e')]=qs[_0xaf46('0x1e')](_0x3a7e2f[_0xaf46('0x36')][_0xaf46('0x1e')]);}return _0x8d07fa['getAgents'](_0x3fc945);}})[_0xaf46('0x28')](function(_0x51bb79){if(_0x51bb79){return _0x51bb79?{'count':_0x39f81d,'rows':_0x51bb79}:null;}})[_0xaf46('0x28')](respondWithResult(_0x32bad6,null))['catch'](handleError(_0x32bad6,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ac6da78..249ba1c 100644 --- a/server/api/mailQueue/mailQueue.events.js +++ b/server/api/mailQueue/mailQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f64=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x4cbef1,_0x589655){var _0x11a05e=function(_0xa8cbef){while(--_0xa8cbef){_0x4cbef1['push'](_0x4cbef1['shift']());}};_0x11a05e(++_0x589655);}(_0x9f64,0x1dc));var _0x49f6=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x9f64[_0x1b70e3];return _0x1452ab;};'use strict';var EventEmitter=require(_0x49f6('0x0'));var MailQueue=require(_0x49f6('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x49f6('0x2'),'afterUpdate':_0x49f6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5acce7){return function(_0x499de6,_0x3ed4a0,_0x2850e1){MailQueueEvents[_0x49f6('0x4')](_0x5acce7+':'+_0x499de6['id'],_0x499de6);MailQueueEvents[_0x49f6('0x4')](_0x5acce7,_0x499de6);_0x2850e1(null);};}for(var e in events){if(events[_0x49f6('0x5')](e)){var event=events[e];MailQueue[_0x49f6('0x6')](e,emitEvent(event));}}module[_0x49f6('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x92b2=['remove','emit','hasOwnProperty','../../mysqldb','MailQueue','save','update'];(function(_0x33ca70,_0x4c27a7){var _0x52592e=function(_0x456025){while(--_0x456025){_0x33ca70['push'](_0x33ca70['shift']());}};_0x52592e(++_0x4c27a7);}(_0x92b2,0xf1));var _0x292b=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x92b2[_0x3a4f18];return _0x4c20fc;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x292b('0x0'))['db'][_0x292b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x292b('0x2'),'afterUpdate':_0x292b('0x3'),'afterDestroy':_0x292b('0x4')};function emitEvent(_0x264690){return function(_0xab1250,_0xb3bab8,_0x450f52){MailQueueEvents[_0x292b('0x5')](_0x264690+':'+_0xab1250['id'],_0xab1250);MailQueueEvents[_0x292b('0x5')](_0x264690,_0xab1250);_0x450f52(null);};}for(var e in events){if(events[_0x292b('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c371c48..6441164 100644 --- a/server/api/mailQueue/mailQueue.model.js +++ b/server/api/mailQueue/mailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0dd=['mail_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x401997,_0x1d36b5){var _0x47048f=function(_0xc0c9cd){while(--_0xc0c9cd){_0x401997['push'](_0x401997['shift']());}};_0x47048f(++_0x1d36b5);}(_0xf0dd,0xb5));var _0xdf0d=function(_0x1abdba,_0x442f96){_0x1abdba=_0x1abdba-0x0;var _0xb618d4=_0xf0dd[_0x1abdba];return _0xb618d4;};'use strict';var _=require('lodash');var util=require(_0xdf0d('0x0'));var logger=require(_0xdf0d('0x1'))('api');var moment=require(_0xdf0d('0x2'));var BPromise=require(_0xdf0d('0x3'));var rp=require(_0xdf0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf0d('0x5'));var config=require(_0xdf0d('0x6'));var attributes=require(_0xdf0d('0x7'));module[_0xdf0d('0x8')]=function(_0x29be03,_0x239ba5){return _0x29be03[_0xdf0d('0x9')](_0xdf0d('0xa'),attributes,{'tableName':_0xdf0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc64=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues'];(function(_0x1438ea,_0x14fa30){var _0x5c0fec=function(_0x2c70aa){while(--_0x2c70aa){_0x1438ea['push'](_0x1438ea['shift']());}};_0x5c0fec(++_0x14fa30);}(_0xdc64,0x10e));var _0x4dc6=function(_0x143076,_0x40c028){_0x143076=_0x143076-0x0;var _0x426d87=_0xdc64[_0x143076];return _0x426d87;};'use strict';var _=require(_0x4dc6('0x0'));var util=require(_0x4dc6('0x1'));var logger=require(_0x4dc6('0x2'))(_0x4dc6('0x3'));var moment=require(_0x4dc6('0x4'));var BPromise=require(_0x4dc6('0x5'));var rp=require(_0x4dc6('0x6'));var fs=require('fs');var path=require(_0x4dc6('0x7'));var rimraf=require(_0x4dc6('0x8'));var config=require(_0x4dc6('0x9'));var attributes=require(_0x4dc6('0xa'));module[_0x4dc6('0xb')]=function(_0x489e2c,_0x1ad818){return _0x489e2c[_0x4dc6('0xc')](_0x4dc6('0xd'),attributes,{'tableName':_0x4dc6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 598bb83..115c94d 100644 --- a/server/api/mailQueue/mailQueue.rpc.js +++ b/server/api/mailQueue/mailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','raw','options','where','limit','include','map','model','attributes','ShowMailQueue','find','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xda3f,0x18b));var _0xfda3=function(_0x4eb94f,_0x3e6f1e){_0x4eb94f=_0x4eb94f-0x0;var _0x1188d0=_0xda3f[_0x4eb94f];return _0x1188d0;};'use strict';var _=require(_0xfda3('0x0'));var util=require(_0xfda3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfda3('0x2'));var fs=require('fs');var Redis=require(_0xfda3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x4'))('rpc');var config=require(_0xfda3('0x5'));var jayson=require(_0xfda3('0x6'));var client=jayson[_0xfda3('0x7')]['http']({'port':0x232a});config[_0xfda3('0x8')]=_['defaults'](config[_0xfda3('0x8')],{'host':_0xfda3('0x9'),'port':0x18eb});var socket=require(_0xfda3('0xa'))(new Redis(config[_0xfda3('0x8')]));require('./mailQueue.socket')[_0xfda3('0xb')](socket);function respondWithRpcPromise(_0x3d50d2,_0x62f20c,_0x3bf6b5){return new BPromise(function(_0x22e825,_0x37a670){return client[_0xfda3('0xc')](_0x3d50d2,_0x3bf6b5)[_0xfda3('0xd')](function(_0x2ab7ad){logger[_0xfda3('0xe')](_0xfda3('0xf'),_0x62f20c,_0xfda3('0x10'));logger[_0xfda3('0x11')](_0xfda3('0x12'),_0x62f20c,_0xfda3('0x10'),JSON[_0xfda3('0x13')](_0x2ab7ad));if(_0x2ab7ad[_0xfda3('0x14')]){if(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x15')]===0x1f4){logger['error'](_0xfda3('0xf'),_0x62f20c,_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);return _0x37a670(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);}logger[_0xfda3('0x14')](_0xfda3('0xf'),_0x62f20c,_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);return _0x22e825(_0x2ab7ad[_0xfda3('0x14')][_0xfda3('0x16')]);}else{logger[_0xfda3('0xe')](_0xfda3('0xf'),_0x62f20c,_0xfda3('0x10'));_0x22e825(_0x2ab7ad[_0xfda3('0x17')][_0xfda3('0x16')]);}})[_0xfda3('0x18')](function(_0x21ca04){logger[_0xfda3('0x14')](_0xfda3('0xf'),_0x62f20c,_0x21ca04);_0x37a670(_0x21ca04);});});}exports[_0xfda3('0x19')]=function(_0x597822){var _0x214952=this;return new Promise(function(_0x2fdfde,_0x25cbc4){return db['MailQueue'][_0xfda3('0x1a')]({'raw':_0x597822['options']?_0x597822['options'][_0xfda3('0x1b')]===undefined?!![]:![]:!![],'where':_0x597822['options']?_0x597822[_0xfda3('0x1c')][_0xfda3('0x1d')]||null:null,'attributes':_0x597822[_0xfda3('0x1c')]?_0x597822[_0xfda3('0x1c')]['attributes']||null:null,'limit':_0x597822[_0xfda3('0x1c')]?_0x597822['options'][_0xfda3('0x1e')]||null:null,'include':_0x597822[_0xfda3('0x1c')]?_0x597822[_0xfda3('0x1c')][_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x597822[_0xfda3('0x1c')][_0xfda3('0x1f')],function(_0x107ce0){return{'model':db[_0x107ce0[_0xfda3('0x21')]],'as':_0x107ce0['as'],'attributes':_0x107ce0[_0xfda3('0x22')],'include':_0x107ce0[_0xfda3('0x1f')]?_['map'](_0x107ce0[_0xfda3('0x1f')],function(_0x3c849c){return{'model':db[_0x3c849c[_0xfda3('0x21')]],'as':_0x3c849c['as'],'attributes':_0x3c849c[_0xfda3('0x22')],'include':_0x3c849c[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x3c849c['include'],function(_0x55ca72){return{'model':db[_0x55ca72[_0xfda3('0x21')]],'as':_0x55ca72['as'],'attributes':_0x55ca72[_0xfda3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfda3('0xd')](function(_0x18ace4){logger[_0xfda3('0xe')](_0xfda3('0x19'),_0x597822);logger[_0xfda3('0x11')]('GetMailQueue',_0x597822,JSON[_0xfda3('0x13')](_0x18ace4));_0x2fdfde(_0x18ace4);})['catch'](function(_0x290086){logger['error'](_0xfda3('0x19'),_0x290086['message'],_0x597822);_0x25cbc4(_0x214952[_0xfda3('0x14')](0x1f4,_0x290086['message']));});});};exports[_0xfda3('0x23')]=function(_0x9a06ad){var _0x22fe08=this;return new Promise(function(_0x349ca9,_0x37931f){return db['MailQueue'][_0xfda3('0x24')]({'raw':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x1d')]||null:null,'attributes':_0x9a06ad['options']?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x22')]||null:null,'include':_0x9a06ad[_0xfda3('0x1c')]?_0x9a06ad[_0xfda3('0x1c')][_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x9a06ad[_0xfda3('0x1c')]['include'],function(_0x3a7679){return{'model':db[_0x3a7679[_0xfda3('0x21')]],'as':_0x3a7679['as'],'attributes':_0x3a7679[_0xfda3('0x22')],'include':_0x3a7679[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x3a7679[_0xfda3('0x1f')],function(_0x271b1c){return{'model':db[_0x271b1c[_0xfda3('0x21')]],'as':_0x271b1c['as'],'attributes':_0x271b1c[_0xfda3('0x22')],'include':_0x271b1c[_0xfda3('0x1f')]?_[_0xfda3('0x20')](_0x271b1c[_0xfda3('0x1f')],function(_0x4fabea){return{'model':db[_0x4fabea[_0xfda3('0x21')]],'as':_0x4fabea['as'],'attributes':_0x4fabea[_0xfda3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfda3('0xd')](function(_0x5349da){logger[_0xfda3('0xe')]('ShowMailQueue',_0x9a06ad);logger[_0xfda3('0x11')](_0xfda3('0x23'),_0x9a06ad,JSON[_0xfda3('0x13')](_0x5349da));_0x349ca9(_0x5349da);})['catch'](function(_0x3c21b3){logger[_0xfda3('0x14')](_0xfda3('0x23'),_0x3c21b3[_0xfda3('0x16')],_0x9a06ad);_0x37931f(_0x22fe08['error'](0x1f4,_0x3c21b3['message']));});});}; \ No newline at end of file +var _0x4d23=['findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowMailQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue'];(function(_0x35e716,_0x21f686){var _0x1eda80=function(_0x5e2061){while(--_0x5e2061){_0x35e716['push'](_0x35e716['shift']());}};_0x1eda80(++_0x21f686);}(_0x4d23,0x12c));var _0x34d2=function(_0x49271e,_0x1eb19f){_0x49271e=_0x49271e-0x0;var _0x44ad03=_0x4d23[_0x49271e];return _0x44ad03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x34d2('0x0'));var BPromise=require(_0x34d2('0x1'));var rs=require(_0x34d2('0x2'));var fs=require('fs');var Redis=require(_0x34d2('0x3'));var db=require(_0x34d2('0x4'))['db'];var utils=require(_0x34d2('0x5'));var logger=require(_0x34d2('0x6'))(_0x34d2('0x7'));var config=require(_0x34d2('0x8'));var jayson=require(_0x34d2('0x9'));var client=jayson[_0x34d2('0xa')]['http']({'port':0x232a});config[_0x34d2('0xb')]=_[_0x34d2('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34d2('0xb')]));require(_0x34d2('0xd'))[_0x34d2('0xe')](socket);function respondWithRpcPromise(_0x1c91f1,_0x351ecf,_0x16f996){return new BPromise(function(_0x4ee996,_0x56f83f){return client[_0x34d2('0xf')](_0x1c91f1,_0x16f996)[_0x34d2('0x10')](function(_0x18a62d){logger[_0x34d2('0x11')]('MailQueue,\x20%s,\x20%s',_0x351ecf,_0x34d2('0x12'));logger['debug'](_0x34d2('0x13'),_0x351ecf,'request\x20sent',JSON['stringify'](_0x18a62d));if(_0x18a62d[_0x34d2('0x14')]){if(_0x18a62d[_0x34d2('0x14')][_0x34d2('0x15')]===0x1f4){logger[_0x34d2('0x14')](_0x34d2('0x16'),_0x351ecf,_0x18a62d[_0x34d2('0x14')][_0x34d2('0x17')]);return _0x56f83f(_0x18a62d['error'][_0x34d2('0x17')]);}logger[_0x34d2('0x14')](_0x34d2('0x16'),_0x351ecf,_0x18a62d[_0x34d2('0x14')][_0x34d2('0x17')]);return _0x4ee996(_0x18a62d['error'][_0x34d2('0x17')]);}else{logger[_0x34d2('0x11')](_0x34d2('0x16'),_0x351ecf,_0x34d2('0x12'));_0x4ee996(_0x18a62d[_0x34d2('0x18')][_0x34d2('0x17')]);}})[_0x34d2('0x19')](function(_0x210475){logger['error'](_0x34d2('0x16'),_0x351ecf,_0x210475);_0x56f83f(_0x210475);});});}exports[_0x34d2('0x1a')]=function(_0x1e7dcf){var _0x531a0b=this;return new Promise(function(_0x542b87,_0x18b250){return db[_0x34d2('0x1b')][_0x34d2('0x1c')]({'raw':_0x1e7dcf[_0x34d2('0x1d')]?_0x1e7dcf['options'][_0x34d2('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e7dcf[_0x34d2('0x1d')]?_0x1e7dcf[_0x34d2('0x1d')][_0x34d2('0x1f')]||null:null,'attributes':_0x1e7dcf[_0x34d2('0x1d')]?_0x1e7dcf[_0x34d2('0x1d')][_0x34d2('0x20')]||null:null,'limit':_0x1e7dcf[_0x34d2('0x1d')]?_0x1e7dcf[_0x34d2('0x1d')][_0x34d2('0x21')]||null:null,'include':_0x1e7dcf['options']?_0x1e7dcf[_0x34d2('0x1d')]['include']?_['map'](_0x1e7dcf[_0x34d2('0x1d')][_0x34d2('0x22')],function(_0x59ce7c){return{'model':db[_0x59ce7c['model']],'as':_0x59ce7c['as'],'attributes':_0x59ce7c['attributes'],'include':_0x59ce7c[_0x34d2('0x22')]?_[_0x34d2('0x23')](_0x59ce7c[_0x34d2('0x22')],function(_0x518d95){return{'model':db[_0x518d95['model']],'as':_0x518d95['as'],'attributes':_0x518d95[_0x34d2('0x20')],'include':_0x518d95[_0x34d2('0x22')]?_['map'](_0x518d95[_0x34d2('0x22')],function(_0x47a00b){return{'model':db[_0x47a00b[_0x34d2('0x24')]],'as':_0x47a00b['as'],'attributes':_0x47a00b[_0x34d2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x34d2('0x10')](function(_0x41d5d3){logger[_0x34d2('0x11')](_0x34d2('0x1a'),_0x1e7dcf);logger[_0x34d2('0x25')]('GetMailQueue',_0x1e7dcf,JSON[_0x34d2('0x26')](_0x41d5d3));_0x542b87(_0x41d5d3);})[_0x34d2('0x19')](function(_0x1d5aca){logger[_0x34d2('0x14')]('GetMailQueue',_0x1d5aca[_0x34d2('0x17')],_0x1e7dcf);_0x18b250(_0x531a0b[_0x34d2('0x14')](0x1f4,_0x1d5aca[_0x34d2('0x17')]));});});};exports[_0x34d2('0x27')]=function(_0x1c1df2){var _0x24a9fb=this;return new Promise(function(_0x46749f,_0x36d8ff){return db[_0x34d2('0x1b')][_0x34d2('0x28')]({'raw':_0x1c1df2[_0x34d2('0x1d')]?_0x1c1df2[_0x34d2('0x1d')][_0x34d2('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c1df2[_0x34d2('0x1d')]?_0x1c1df2[_0x34d2('0x1d')][_0x34d2('0x1f')]||null:null,'attributes':_0x1c1df2[_0x34d2('0x1d')]?_0x1c1df2[_0x34d2('0x1d')][_0x34d2('0x20')]||null:null,'include':_0x1c1df2[_0x34d2('0x1d')]?_0x1c1df2[_0x34d2('0x1d')][_0x34d2('0x22')]?_[_0x34d2('0x23')](_0x1c1df2[_0x34d2('0x1d')]['include'],function(_0xe50c1a){return{'model':db[_0xe50c1a[_0x34d2('0x24')]],'as':_0xe50c1a['as'],'attributes':_0xe50c1a[_0x34d2('0x20')],'include':_0xe50c1a['include']?_[_0x34d2('0x23')](_0xe50c1a[_0x34d2('0x22')],function(_0x1295dc){return{'model':db[_0x1295dc[_0x34d2('0x24')]],'as':_0x1295dc['as'],'attributes':_0x1295dc[_0x34d2('0x20')],'include':_0x1295dc[_0x34d2('0x22')]?_[_0x34d2('0x23')](_0x1295dc[_0x34d2('0x22')],function(_0x55a3a0){return{'model':db[_0x55a3a0[_0x34d2('0x24')]],'as':_0x55a3a0['as'],'attributes':_0x55a3a0[_0x34d2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x34d2('0x10')](function(_0x3476c2){logger[_0x34d2('0x11')](_0x34d2('0x27'),_0x1c1df2);logger['debug'](_0x34d2('0x27'),_0x1c1df2,JSON[_0x34d2('0x26')](_0x3476c2));_0x46749f(_0x3476c2);})[_0x34d2('0x19')](function(_0x1cf0ae){logger[_0x34d2('0x14')](_0x34d2('0x27'),_0x1cf0ae[_0x34d2('0x17')],_0x1c1df2);_0x36d8ff(_0x24a9fb['error'](0x1f4,_0x1cf0ae[_0x34d2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3a6d66c..2ba78b1 100644 --- a/server/api/mailQueue/mailQueue.socket.js +++ b/server/api/mailQueue/mailQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc35d=['remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x76d320,_0xfc1f53){var _0x477978=function(_0x1c3365){while(--_0x1c3365){_0x76d320['push'](_0x76d320['shift']());}};_0x477978(++_0xfc1f53);}(_0xc35d,0x12e));var _0xdc35=function(_0x49596e,_0x3c9d9b){_0x49596e=_0x49596e-0x0;var _0x6eca7c=_0xc35d[_0x49596e];return _0x6eca7c;};'use strict';var MailQueueEvents=require(_0xdc35('0x0'));var events=[_0xdc35('0x1'),_0xdc35('0x2'),'update'];function createListener(_0x1f9658,_0x5b1dae){return function(_0x313600){_0x5b1dae[_0xdc35('0x3')](_0x1f9658,_0x313600);};}function removeListener(_0x5bdf91,_0x1daab0){return function(){MailQueueEvents[_0xdc35('0x4')](_0x5bdf91,_0x1daab0);};}exports[_0xdc35('0x5')]=function(_0x492294){for(var _0x33be37=0x0,_0x23cdff=events[_0xdc35('0x6')];_0x33be37<_0x23cdff;_0x33be37++){var _0x56583c=events[_0x33be37];var _0xe4b441=createListener(_0xdc35('0x7')+_0x56583c,_0x492294);MailQueueEvents['on'](_0x56583c,_0xe4b441);}}; \ No newline at end of file +var _0x9536=['./mailQueue.events','save','update','mailQueue:'];(function(_0x1e2473,_0x4260be){var _0x4c8b53=function(_0x1d5eb2){while(--_0x1d5eb2){_0x1e2473['push'](_0x1e2473['shift']());}};_0x4c8b53(++_0x4260be);}(_0x9536,0x188));var _0x6953=function(_0x23a79e,_0x235f89){_0x23a79e=_0x23a79e-0x0;var _0x3dab57=_0x9536[_0x23a79e];return _0x3dab57;};'use strict';var MailQueueEvents=require(_0x6953('0x0'));var events=[_0x6953('0x1'),'remove',_0x6953('0x2')];function createListener(_0x1bd3af,_0x4f269f){return function(_0x24106a){_0x4f269f['emit'](_0x1bd3af,_0x24106a);};}function removeListener(_0x1ec6d4,_0x2bbade){return function(){MailQueueEvents['removeListener'](_0x1ec6d4,_0x2bbade);};}exports['register']=function(_0x5e9215){for(var _0x4599fe=0x0,_0x54522f=events['length'];_0x4599fe<_0x54522f;_0x4599fe++){var _0x3a8c50=events[_0x4599fe];var _0xd7c6a=createListener(_0x6953('0x3')+_0x3a8c50,_0x5e9215);MailQueueEvents['on'](_0x3a8c50,_0xd7c6a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 834e063..ff42949 100644 --- a/server/api/mailQueueReport/index.js +++ b/server/api/mailQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ed7=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy'];(function(_0x26e6ec,_0x17de5d){var _0x1988d7=function(_0x270524){while(--_0x270524){_0x26e6ec['push'](_0x26e6ec['shift']());}};_0x1988d7(++_0x17de5d);}(_0x7ed7,0x1c3));var _0x77ed=function(_0x4c3ee2,_0x2221fa){_0x4c3ee2=_0x4c3ee2-0x0;var _0x5a5184=_0x7ed7[_0x4c3ee2];return _0x5a5184;};'use strict';var multer=require(_0x77ed('0x0'));var util=require('util');var path=require(_0x77ed('0x1'));var timeout=require(_0x77ed('0x2'));var express=require(_0x77ed('0x3'));var router=express[_0x77ed('0x4')]();var fs_extra=require(_0x77ed('0x5'));var auth=require(_0x77ed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x77ed('0x7'));var controller=require(_0x77ed('0x8'));router[_0x77ed('0x9')]('/',auth[_0x77ed('0xa')](),controller[_0x77ed('0xb')]);router[_0x77ed('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x77ed('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x77ed('0xa')](),controller[_0x77ed('0xd')]);router['put']('/:id',auth[_0x77ed('0xa')](),controller[_0x77ed('0xe')]);router[_0x77ed('0xf')](_0x77ed('0xc'),auth[_0x77ed('0xa')](),controller[_0x77ed('0x10')]);module[_0x77ed('0x11')]=router; \ No newline at end of file +var _0x0ae6=['show','post','create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','/:id'];(function(_0x8b884f,_0x2bcfcf){var _0x3d0805=function(_0x4e58f7){while(--_0x4e58f7){_0x8b884f['push'](_0x8b884f['shift']());}};_0x3d0805(++_0x2bcfcf);}(_0x0ae6,0x184));var _0x60ae=function(_0x48c984,_0xe09227){_0x48c984=_0x48c984-0x0;var _0x5d4d7a=_0x0ae6[_0x48c984];return _0x5d4d7a;};'use strict';var multer=require(_0x60ae('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x60ae('0x1'));var router=express[_0x60ae('0x2')]();var fs_extra=require(_0x60ae('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x60ae('0x4'));var config=require('../../config/environment');var controller=require(_0x60ae('0x5'));router['get']('/',auth[_0x60ae('0x6')](),controller[_0x60ae('0x7')]);router[_0x60ae('0x8')](_0x60ae('0x9'),auth[_0x60ae('0x6')](),controller['describe']);router[_0x60ae('0x8')](_0x60ae('0xa'),auth[_0x60ae('0x6')](),controller[_0x60ae('0xb')]);router[_0x60ae('0xc')]('/',auth[_0x60ae('0x6')](),controller[_0x60ae('0xd')]);router[_0x60ae('0xe')]('/:id',auth[_0x60ae('0x6')](),controller[_0x60ae('0xf')]);router[_0x60ae('0x10')](_0x60ae('0xa'),auth[_0x60ae('0x6')](),controller[_0x60ae('0x11')]);module[_0x60ae('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 0cd7a52..33ef8b0 100644 --- a/server/api/mailQueueReport/mailQueueReport.attributes.js +++ b/server/api/mailQueueReport/mailQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf8f=['moment','sequelize','exports','STRING','DATE'];(function(_0x1a8bb0,_0xc523d4){var _0x146e92=function(_0x59e2ce){while(--_0x59e2ce){_0x1a8bb0['push'](_0x1a8bb0['shift']());}};_0x146e92(++_0xc523d4);}(_0xaf8f,0xcd));var _0xfaf8=function(_0x3e75a1,_0x47051b){_0x3e75a1=_0x3e75a1-0x0;var _0x456c32=_0xaf8f[_0x3e75a1];return _0x456c32;};'use strict';var moment=require(_0xfaf8('0x0'));var Sequelize=require(_0xfaf8('0x1'));module[_0xfaf8('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xfaf8('0x3')]},'joinAt':{'type':Sequelize[_0xfaf8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfaf8('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xfaf8('0x3')]}}; \ No newline at end of file +var _0x6c4c=['DATE','moment','STRING'];(function(_0x470212,_0x1387de){var _0x5083cb=function(_0x3bec27){while(--_0x3bec27){_0x470212['push'](_0x470212['shift']());}};_0x5083cb(++_0x1387de);}(_0x6c4c,0xd9));var _0xc6c4=function(_0x4bced,_0x3a6792){_0x4bced=_0x4bced-0x0;var _0x1891b3=_0x6c4c[_0x4bced];return _0x1891b3;};'use strict';var moment=require(_0xc6c4('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc6c4('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xc6c4('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc6c4('0x2')]},'acceptAt':{'type':Sequelize[_0xc6c4('0x2')]},'exitAt':{'type':Sequelize[_0xc6c4('0x2')]},'reason':{'type':Sequelize[_0xc6c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index b835f23..218682c 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x41f4b3,_0x4c535c){var _0x3a4866=function(_0x518e3b){while(--_0x518e3b){_0x41f4b3['push'](_0x41f4b3['shift']());}};_0x3a4866(++_0x4c535c);}(_0x2542,0x169));var _0x2254=function(_0x5084e4,_0xe1e310){_0x5084e4=_0x5084e4-0x0;var _0x485679=_0x2542[_0x5084e4];return _0x485679;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':!![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['MailQueueReport'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file +var _0xed1c=['rows','catch','show','MailQueueReport','create','body','params','find','describe','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x544756,_0x2d5df3){var _0x4ea375=function(_0x356013){while(--_0x356013){_0x544756['push'](_0x544756['shift']());}};_0x4ea375(++_0x2d5df3);}(_0xed1c,0xe4));var _0xced1=function(_0x188a1d,_0x2249fc){_0x188a1d=_0x188a1d-0x0;var _0x43d0db=_0xed1c[_0x188a1d];return _0x43d0db;};'use strict';var emlformat=require(_0xced1('0x0'));var rimraf=require(_0xced1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xced1('0x2'));var Mustache=require(_0xced1('0x3'));var util=require(_0xced1('0x4'));var path=require('path');var sox=require(_0xced1('0x5'));var csv=require(_0xced1('0x6'));var ejs=require(_0xced1('0x7'));var fs=require('fs');var fs_extra=require(_0xced1('0x8'));var _=require('lodash');var squel=require(_0xced1('0x9'));var crypto=require(_0xced1('0xa'));var jsforce=require(_0xced1('0xb'));var deskjs=require(_0xced1('0xc'));var toCsv=require(_0xced1('0x6'));var querystring=require(_0xced1('0xd'));var Papa=require(_0xced1('0xe'));var Redis=require(_0xced1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xced1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xced1('0x11'));var logger=require(_0xced1('0x12'))(_0xced1('0x13'));var utils=require(_0xced1('0x14'));var config=require(_0xced1('0x15'));var licenseUtil=require(_0xced1('0x16'));var db=require(_0xced1('0x17'))['db'];function respondWithStatusCode(_0x5e5637,_0x118f69){_0x118f69=_0x118f69||0xcc;return function(_0x2a5cd6){if(_0x2a5cd6){return _0x5e5637[_0xced1('0x18')](_0x118f69);}return _0x5e5637[_0xced1('0x19')](_0x118f69)['end']();};}function respondWithResult(_0xdaaea7,_0x31a32c){_0x31a32c=_0x31a32c||0xc8;return function(_0x54cba9){if(_0x54cba9){return _0xdaaea7[_0xced1('0x19')](_0x31a32c)[_0xced1('0x1a')](_0x54cba9);}};}function respondWithFilteredResult(_0x3708b1,_0x32100b){return function(_0x47baec){if(_0x47baec){var _0x5560af=typeof _0x32100b[_0xced1('0x1b')]===_0xced1('0x1c')&&typeof _0x32100b[_0xced1('0x1d')]===_0xced1('0x1c');var _0x3e53bd=_0x47baec[_0xced1('0x1e')];var _0x5a563a=_0x5560af?0x0:_0x32100b['offset'];var _0x2a92c8=_0x5560af?_0x47baec[_0xced1('0x1e')]:_0x32100b[_0xced1('0x1b')]+_0x32100b['limit'];var _0x1eac14;if(_0x2a92c8>=_0x3e53bd){_0x2a92c8=_0x3e53bd;_0x1eac14=0xc8;}else{_0x1eac14=0xce;}_0x3708b1[_0xced1('0x19')](_0x1eac14);return _0x3708b1[_0xced1('0x1f')]('Content-Range',_0x5a563a+'-'+_0x2a92c8+'/'+_0x3e53bd)[_0xced1('0x1a')](_0x47baec);}return null;};}function patchUpdates(_0x42b146){return function(_0x23ded4){try{jsonpatch['apply'](_0x23ded4,_0x42b146,!![]);}catch(_0x138c8b){return BPromise[_0xced1('0x20')](_0x138c8b);}return _0x23ded4[_0xced1('0x21')]();};}function saveUpdates(_0x5f1474,_0x4dab56){return function(_0x1d3884){if(_0x1d3884){return _0x1d3884[_0xced1('0x22')](_0x5f1474)[_0xced1('0x23')](function(_0x20dcb4){return _0x20dcb4;});}return null;};}function removeEntity(_0x210d7e,_0x49c8b9){return function(_0x14f47e){if(_0x14f47e){return _0x14f47e[_0xced1('0x24')]()['then'](function(){_0x210d7e['status'](0xcc)[_0xced1('0x25')]();});}};}function handleEntityNotFound(_0x258c9a,_0x3af9c0){return function(_0x3912fe){if(!_0x3912fe){_0x258c9a[_0xced1('0x18')](0x194);}return _0x3912fe;};}function handleError(_0x25b6e7,_0x50c543){_0x50c543=_0x50c543||0x1f4;return function(_0x181f6e){logger[_0xced1('0x26')](_0x181f6e[_0xced1('0x27')]);if(_0x181f6e[_0xced1('0x28')]){delete _0x181f6e[_0xced1('0x28')];}_0x25b6e7[_0xced1('0x19')](_0x50c543)[_0xced1('0x29')](_0x181f6e);};}exports['index']=function(_0x15c4f4,_0x4ef64e){var _0x45cb03={},_0x2c2269={},_0x6dc558={'count':0x0,'rows':[]};var _0x176215=_['map'](db['MailQueueReport'][_0xced1('0x2a')],function(_0x15117b){return{'name':_0x15117b[_0xced1('0x2b')],'type':_0x15117b['type']['key']};});_0x2c2269['model']=_[_0xced1('0x2c')](_0x176215,_0xced1('0x28'));_0x2c2269[_0xced1('0x2d')]=_[_0xced1('0x2e')](_0x15c4f4['query']);_0x2c2269[_0xced1('0x2f')]=_[_0xced1('0x30')](_0x2c2269[_0xced1('0x31')],_0x2c2269[_0xced1('0x2d')]);_0x45cb03[_0xced1('0x32')]=_[_0xced1('0x30')](_0x2c2269[_0xced1('0x31')],qs['fields'](_0x15c4f4['query'][_0xced1('0x33')]));_0x45cb03[_0xced1('0x32')]=_0x45cb03[_0xced1('0x32')][_0xced1('0x34')]?_0x45cb03[_0xced1('0x32')]:_0x2c2269[_0xced1('0x31')];if(!_0x15c4f4['query']['hasOwnProperty']('nolimit')){_0x45cb03['limit']=qs[_0xced1('0x1d')](_0x15c4f4[_0xced1('0x2d')][_0xced1('0x1d')]);_0x45cb03[_0xced1('0x1b')]=qs[_0xced1('0x1b')](_0x15c4f4[_0xced1('0x2d')][_0xced1('0x1b')]);}_0x45cb03[_0xced1('0x35')]=qs[_0xced1('0x36')](_0x15c4f4[_0xced1('0x2d')][_0xced1('0x36')]);_0x45cb03[_0xced1('0x37')]=qs[_0xced1('0x2f')](_['pick'](_0x15c4f4[_0xced1('0x2d')],_0x2c2269[_0xced1('0x2f')]),_0x176215);if(_0x15c4f4[_0xced1('0x2d')][_0xced1('0x38')]){_0x45cb03[_0xced1('0x37')]=_[_0xced1('0x39')](_0x45cb03['where'],{'$or':_[_0xced1('0x2c')](_0x176215,function(_0x3f3632){if(_0x3f3632[_0xced1('0x3a')]!==_0xced1('0x3b')){var _0x282361={};_0x282361[_0x3f3632[_0xced1('0x28')]]={'$like':'%'+_0x15c4f4[_0xced1('0x2d')][_0xced1('0x38')]+'%'};return _0x282361;}})});}_0x45cb03=_[_0xced1('0x39')]({},_0x45cb03,_0x15c4f4[_0xced1('0x3c')]);var _0x1e119c={'where':_0x45cb03['where']};return db['MailQueueReport'][_0xced1('0x1e')](_0x1e119c)[_0xced1('0x23')](function(_0x1887a3){_0x6dc558['count']=_0x1887a3;if(_0x15c4f4[_0xced1('0x2d')][_0xced1('0x3d')]){_0x45cb03[_0xced1('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0xced1('0x3f')](_0x45cb03);})[_0xced1('0x23')](function(_0x5a01f6){_0x6dc558[_0xced1('0x40')]=_0x5a01f6;return _0x6dc558;})['then'](respondWithFilteredResult(_0x4ef64e,_0x45cb03))[_0xced1('0x41')](handleError(_0x4ef64e,null));};exports[_0xced1('0x42')]=function(_0x4f99df,_0x1ddaea){var _0x172a7e={'raw':!![],'where':{'id':_0x4f99df['params']['id']}},_0xdb8e8e={};_0xdb8e8e[_0xced1('0x31')]=_[_0xced1('0x2e')](db['MailQueueReport'][_0xced1('0x2a')]);_0xdb8e8e['query']=_['keys'](_0x4f99df[_0xced1('0x2d')]);_0xdb8e8e['filters']=_[_0xced1('0x30')](_0xdb8e8e[_0xced1('0x31')],_0xdb8e8e[_0xced1('0x2d')]);_0x172a7e['attributes']=_[_0xced1('0x30')](_0xdb8e8e['model'],qs[_0xced1('0x33')](_0x4f99df[_0xced1('0x2d')][_0xced1('0x33')]));_0x172a7e[_0xced1('0x32')]=_0x172a7e['attributes'][_0xced1('0x34')]?_0x172a7e[_0xced1('0x32')]:_0xdb8e8e['model'];if(_0x4f99df[_0xced1('0x2d')][_0xced1('0x3d')]){_0x172a7e['include']=[{'all':!![]}];}_0x172a7e=_[_0xced1('0x39')]({},_0x172a7e,_0x4f99df[_0xced1('0x3c')]);return db[_0xced1('0x43')]['find'](_0x172a7e)[_0xced1('0x23')](handleEntityNotFound(_0x1ddaea,null))[_0xced1('0x23')](respondWithResult(_0x1ddaea,null))[_0xced1('0x41')](handleError(_0x1ddaea,null));};exports[_0xced1('0x44')]=function(_0x376619,_0x528cd5){return db[_0xced1('0x43')]['create'](_0x376619[_0xced1('0x45')],{})[_0xced1('0x23')](respondWithResult(_0x528cd5,0xc9))[_0xced1('0x41')](handleError(_0x528cd5,null));};exports[_0xced1('0x22')]=function(_0x412693,_0x38aa3b){if(_0x412693['body']['id']){delete _0x412693[_0xced1('0x45')]['id'];}return db[_0xced1('0x43')]['find']({'where':{'id':_0x412693[_0xced1('0x46')]['id']}})['then'](handleEntityNotFound(_0x38aa3b,null))['then'](saveUpdates(_0x412693[_0xced1('0x45')],null))[_0xced1('0x23')](respondWithResult(_0x38aa3b,null))[_0xced1('0x41')](handleError(_0x38aa3b,null));};exports[_0xced1('0x24')]=function(_0x4f0183,_0x1090bc){return db[_0xced1('0x43')][_0xced1('0x47')]({'where':{'id':_0x4f0183['params']['id']}})['then'](handleEntityNotFound(_0x1090bc,null))[_0xced1('0x23')](removeEntity(_0x1090bc,null))[_0xced1('0x41')](handleError(_0x1090bc,null));};exports[_0xced1('0x48')]=function(_0x226b3e,_0x4b460e){return db['MailQueueReport']['describe']()[_0xced1('0x23')](respondWithResult(_0x4b460e,null))[_0xced1('0x41')](handleError(_0x4b460e,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 1530f27..80bf91c 100644 --- a/server/api/mailQueueReport/mailQueueReport.model.js +++ b/server/api/mailQueueReport/mailQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bfb=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x31e0af,_0x18ad3e){var _0x128d84=function(_0x150bec){while(--_0x150bec){_0x31e0af['push'](_0x31e0af['shift']());}};_0x128d84(++_0x18ad3e);}(_0x6bfb,0x8f));var _0xb6bf=function(_0xd506b6,_0x2617ad){_0xd506b6=_0xd506b6-0x0;var _0x4a89db=_0x6bfb[_0xd506b6];return _0x4a89db;};'use strict';var _=require('lodash');var util=require(_0xb6bf('0x0'));var logger=require(_0xb6bf('0x1'))(_0xb6bf('0x2'));var moment=require(_0xb6bf('0x3'));var BPromise=require(_0xb6bf('0x4'));var rp=require(_0xb6bf('0x5'));var fs=require('fs');var path=require(_0xb6bf('0x6'));var rimraf=require(_0xb6bf('0x7'));var config=require(_0xb6bf('0x8'));var attributes=require(_0xb6bf('0x9'));module[_0xb6bf('0xa')]=function(_0x2044a2,_0x3f588f){return _0x2044a2[_0xb6bf('0xb')](_0xb6bf('0xc'),attributes,{'tableName':_0xb6bf('0xd'),'paranoid':![],'indexes':[{'name':_0xb6bf('0xe'),'fields':[_0xb6bf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb957=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x2d49d9,_0x1443e5){var _0x10af12=function(_0x3794f4){while(--_0x3794f4){_0x2d49d9['push'](_0x2d49d9['shift']());}};_0x10af12(++_0x1443e5);}(_0xb957,0x1e6));var _0x7b95=function(_0x5b87cb,_0x43b70b){_0x5b87cb=_0x5b87cb-0x0;var _0x5d0f42=_0xb957[_0x5b87cb];return _0x5d0f42;};'use strict';var _=require('lodash');var util=require(_0x7b95('0x0'));var logger=require(_0x7b95('0x1'))('api');var moment=require(_0x7b95('0x2'));var BPromise=require(_0x7b95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b95('0x4'));var attributes=require(_0x7b95('0x5'));module[_0x7b95('0x6')]=function(_0xc40cea,_0x49c0e8){return _0xc40cea[_0x7b95('0x7')](_0x7b95('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x7b95('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 10787a2..ab10384 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d781e,_0x41a443){var _0x4d4afa=function(_0x2e51e7){while(--_0x2e51e7){_0x2d781e['push'](_0x2d781e['shift']());}};_0x4d4afa(++_0x41a443);}(_0x326f,0xd1));var _0xf326=function(_0x2b4302,_0x10742c){_0x2b4302=_0x2b4302-0x0;var _0x284f84=_0x326f[_0x2b4302];return _0x284f84;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e1d84,_0x311149){var _0x188369=function(_0x2e2480){while(--_0x2e2480){_0x1e1d84['push'](_0x1e1d84['shift']());}};_0x188369(++_0x311149);}(_0x1261,0x144));var _0x1126=function(_0x1b62b8,_0x3e78d9){_0x1b62b8=_0x1b62b8-0x0;var _0x47a5a0=_0x1261[_0x1b62b8];return _0x47a5a0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 13e3243..3a9a110 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xc5c125,_0x50162d){var _0x4a8421=function(_0x4dce40){while(--_0x4dce40){_0xc5c125['push'](_0xc5c125['shift']());}};_0x4a8421(++_0x50162d);}(_0x70e0,0x17b));var _0x070e=function(_0xdb6b4e,_0x36e00e){_0xdb6b4e=_0xdb6b4e-0x0;var _0xf44d72=_0x70e0[_0xdb6b4e];return _0xf44d72;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x28e28b,_0x340c0f){var _0x40a4e1=function(_0x4c1acf){while(--_0x4c1acf){_0x28e28b['push'](_0x28e28b['shift']());}};_0x40a4e1(++_0x340c0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 770873c..207a0a3 100644 --- a/server/api/mailServerIn/mailServerIn.attributes.js +++ b/server/api/mailServerIn/mailServerIn.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe019=['sequelize','exports','STRING','INTEGER','BOOLEAN','INBOX'];(function(_0x497788,_0x2005aa){var _0x960178=function(_0x2dc0fe){while(--_0x2dc0fe){_0x497788['push'](_0x497788['shift']());}};_0x960178(++_0x2005aa);}(_0xe019,0x1b0));var _0x9e01=function(_0x2ebb95,_0x527878){_0x2ebb95=_0x2ebb95-0x0;var _0x16031a=_0xe019[_0x2ebb95];return _0x16031a;};'use strict';var Sequelize=require(_0x9e01('0x0'));module[_0x9e01('0x1')]={'description':{'type':Sequelize[_0x9e01('0x2')]},'host':{'type':Sequelize[_0x9e01('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x9e01('0x2')]},'password':{'type':Sequelize[_0x9e01('0x2')]},'port':{'type':Sequelize[_0x9e01('0x3')]},'tls':{'type':Sequelize[_0x9e01('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9e01('0x2')],'defaultValue':_0x9e01('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x9e01('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa971=['STRING','INTEGER','BOOLEAN','INBOX','sequelize','exports'];(function(_0x399849,_0x3b630d){var _0xfbb04=function(_0x4fea04){while(--_0x4fea04){_0x399849['push'](_0x399849['shift']());}};_0xfbb04(++_0x3b630d);}(_0xa971,0x9a));var _0x1a97=function(_0xa74133,_0x2c05d7){_0xa74133=_0xa74133-0x0;var _0x4a6efd=_0xa971[_0xa74133];return _0x4a6efd;};'use strict';var Sequelize=require(_0x1a97('0x0'));module[_0x1a97('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1a97('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1a97('0x3')]},'tls':{'type':Sequelize[_0x1a97('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x1a97('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1a97('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1a97('0x2')]},'modernAuthentication':{'type':Sequelize[_0x1a97('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 99e3152..59226d9 100644 --- a/server/api/mailServerIn/mailServerIn.model.js +++ b/server/api/mailServerIn/mailServerIn.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e2a=['../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util'];(function(_0x16fd61,_0x481acd){var _0x131d3f=function(_0x13cd91){while(--_0x13cd91){_0x16fd61['push'](_0x16fd61['shift']());}};_0x131d3f(++_0x481acd);}(_0x4e2a,0x1a3));var _0xa4e2=function(_0x191e35,_0x172ffa){_0x191e35=_0x191e35-0x0;var _0x4f8ccc=_0x4e2a[_0x191e35];return _0x4f8ccc;};'use strict';var _=require('lodash');var util=require(_0xa4e2('0x0'));var logger=require(_0xa4e2('0x1'))(_0xa4e2('0x2'));var moment=require(_0xa4e2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4e2('0x4'));var fs=require('fs');var path=require(_0xa4e2('0x5'));var rimraf=require(_0xa4e2('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4e2('0x7'));module[_0xa4e2('0x8')]=function(_0x4ce7e0,_0x2e6d8e){return _0x4ce7e0[_0xa4e2('0x9')](_0xa4e2('0xa'),attributes,{'tableName':_0xa4e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa398=['./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x33fdd5,_0x3eb346){var _0x269431=function(_0x44fee7){while(--_0x44fee7){_0x33fdd5['push'](_0x33fdd5['shift']());}};_0x269431(++_0x3eb346);}(_0xa398,0xc4));var _0x8a39=function(_0x4bd813,_0x1f043a){_0x4bd813=_0x4bd813-0x0;var _0x556f6f=_0xa398[_0x4bd813];return _0x556f6f;};'use strict';var _=require(_0x8a39('0x0'));var util=require(_0x8a39('0x1'));var logger=require(_0x8a39('0x2'))(_0x8a39('0x3'));var moment=require('moment');var BPromise=require(_0x8a39('0x4'));var rp=require(_0x8a39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a39('0x6'));var config=require(_0x8a39('0x7'));var attributes=require(_0x8a39('0x8'));module['exports']=function(_0x384439,_0x46396a){return _0x384439[_0x8a39('0x9')](_0x8a39('0xa'),attributes,{'tableName':_0x8a39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9184949..665a600 100644 --- a/server/api/mailServerIn/mailServerIn.rpc.js +++ b/server/api/mailServerIn/mailServerIn.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4201=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s'];(function(_0xeb350,_0x1accac){var _0x32323f=function(_0x27c637){while(--_0x27c637){_0xeb350['push'](_0xeb350['shift']());}};_0x32323f(++_0x1accac);}(_0x4201,0x102));var _0x1420=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0x4201[_0x287a47];return _0x3fb726;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var moment=require(_0x1420('0x2'));var BPromise=require('bluebird');var rs=require(_0x1420('0x3'));var fs=require('fs');var Redis=require(_0x1420('0x4'));var db=require(_0x1420('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1420('0x6'));var config=require(_0x1420('0x7'));var jayson=require(_0x1420('0x8'));var client=jayson[_0x1420('0x9')][_0x1420('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dae38,_0x174ccf,_0x272e97){return new BPromise(function(_0x5c6211,_0xf9d2f6){return client[_0x1420('0xb')](_0x2dae38,_0x272e97)['then'](function(_0x4cc945){logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));logger[_0x1420('0xf')](_0x1420('0x10'),_0x174ccf,'request\x20sent',JSON['stringify'](_0x4cc945));if(_0x4cc945[_0x1420('0x11')]){if(_0x4cc945[_0x1420('0x11')]['code']===0x1f4){logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0xf9d2f6(_0x4cc945['error'][_0x1420('0x12')]);}logger[_0x1420('0x11')](_0x1420('0xd'),_0x174ccf,_0x4cc945[_0x1420('0x11')][_0x1420('0x12')]);return _0x5c6211(_0x4cc945['error'][_0x1420('0x12')]);}else{logger[_0x1420('0xc')](_0x1420('0xd'),_0x174ccf,_0x1420('0xe'));_0x5c6211(_0x4cc945[_0x1420('0x13')]['message']);}})[_0x1420('0x14')](function(_0x901a0a){logger['error'](_0x1420('0xd'),_0x174ccf,_0x901a0a);_0xf9d2f6(_0x901a0a);});});}exports[_0x1420('0x15')]=function(_0x3f85cb){var _0x3ff1b7=this;return new Promise(function(_0x5634ab,_0x41701e){return db[_0x1420('0x16')][_0x1420('0x17')]({'raw':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x19')]===undefined?!![]:![]:!![],'where':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x1a')]||null:null,'attributes':_0x3f85cb['options']?_0x3f85cb['options'][_0x1420('0x1b')]||null:null,'limit':_0x3f85cb[_0x1420('0x18')]?_0x3f85cb[_0x1420('0x18')][_0x1420('0x1c')]||null:null,'include':_0x3f85cb['options']?_0x3f85cb['options'][_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x3f85cb[_0x1420('0x18')][_0x1420('0x1d')],function(_0x56aced){return{'model':db[_0x56aced[_0x1420('0x1f')]],'as':_0x56aced['as'],'attributes':_0x56aced[_0x1420('0x1b')],'include':_0x56aced[_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x56aced[_0x1420('0x1d')],function(_0x4cd68a){return{'model':db[_0x4cd68a['model']],'as':_0x4cd68a['as'],'attributes':_0x4cd68a[_0x1420('0x1b')],'include':_0x4cd68a[_0x1420('0x1d')]?_[_0x1420('0x1e')](_0x4cd68a[_0x1420('0x1d')],function(_0x46a04e){return{'model':db[_0x46a04e[_0x1420('0x1f')]],'as':_0x46a04e['as'],'attributes':_0x46a04e[_0x1420('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1420('0x20')](function(_0x210391){logger['info'](_0x1420('0x15'),_0x3f85cb);logger[_0x1420('0xf')](_0x1420('0x15'),_0x3f85cb,JSON[_0x1420('0x21')](_0x210391));_0x5634ab(_0x210391);})[_0x1420('0x14')](function(_0x4d2542){logger['error'](_0x1420('0x15'),_0x4d2542[_0x1420('0x12')],_0x3f85cb);_0x41701e(_0x3ff1b7[_0x1420('0x11')](0x1f4,_0x4d2542[_0x1420('0x12')]));});});}; \ No newline at end of file +var _0x0b96=['raw','where','attributes','limit','include','map','model','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s','error','message','result','catch','GetMailServerIn','findAll','options'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b96,0xc2));var _0x60b9=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x0b96[_0x3358ba];return _0x296e73;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x60b9('0x0'));var BPromise=require(_0x60b9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b9('0x2'));var db=require(_0x60b9('0x3'))['db'];var utils=require(_0x60b9('0x4'));var logger=require(_0x60b9('0x5'))('rpc');var config=require(_0x60b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x60b9('0x7')][_0x60b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122342,_0x57e464,_0x5e71f0){return new BPromise(function(_0x51d50a,_0x3162cc){return client[_0x60b9('0x9')](_0x122342,_0x5e71f0)[_0x60b9('0xa')](function(_0x54ef39){logger[_0x60b9('0xb')]('MailServerIn,\x20%s,\x20%s',_0x57e464,'request\x20sent');logger[_0x60b9('0xc')](_0x60b9('0xd'),_0x57e464,_0x60b9('0xe'),JSON['stringify'](_0x54ef39));if(_0x54ef39['error']){if(_0x54ef39['error']['code']===0x1f4){logger['error'](_0x60b9('0xf'),_0x57e464,_0x54ef39['error']['message']);return _0x3162cc(_0x54ef39['error']['message']);}logger[_0x60b9('0x10')]('MailServerIn,\x20%s,\x20%s',_0x57e464,_0x54ef39['error']['message']);return _0x51d50a(_0x54ef39[_0x60b9('0x10')][_0x60b9('0x11')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x57e464,_0x60b9('0xe'));_0x51d50a(_0x54ef39[_0x60b9('0x12')][_0x60b9('0x11')]);}})[_0x60b9('0x13')](function(_0x341e49){logger[_0x60b9('0x10')](_0x60b9('0xf'),_0x57e464,_0x341e49);_0x3162cc(_0x341e49);});});}exports[_0x60b9('0x14')]=function(_0x767b4f){var _0x16a7c7=this;return new Promise(function(_0xe62516,_0x51e84b){return db['MailServerIn'][_0x60b9('0x15')]({'raw':_0x767b4f[_0x60b9('0x16')]?_0x767b4f[_0x60b9('0x16')][_0x60b9('0x17')]===undefined?!![]:![]:!![],'where':_0x767b4f[_0x60b9('0x16')]?_0x767b4f[_0x60b9('0x16')][_0x60b9('0x18')]||null:null,'attributes':_0x767b4f['options']?_0x767b4f[_0x60b9('0x16')][_0x60b9('0x19')]||null:null,'limit':_0x767b4f['options']?_0x767b4f[_0x60b9('0x16')][_0x60b9('0x1a')]||null:null,'include':_0x767b4f[_0x60b9('0x16')]?_0x767b4f['options'][_0x60b9('0x1b')]?_[_0x60b9('0x1c')](_0x767b4f[_0x60b9('0x16')][_0x60b9('0x1b')],function(_0x204be5){return{'model':db[_0x204be5[_0x60b9('0x1d')]],'as':_0x204be5['as'],'attributes':_0x204be5[_0x60b9('0x19')],'include':_0x204be5[_0x60b9('0x1b')]?_['map'](_0x204be5[_0x60b9('0x1b')],function(_0x42f927){return{'model':db[_0x42f927['model']],'as':_0x42f927['as'],'attributes':_0x42f927['attributes'],'include':_0x42f927['include']?_[_0x60b9('0x1c')](_0x42f927[_0x60b9('0x1b')],function(_0x458924){return{'model':db[_0x458924['model']],'as':_0x458924['as'],'attributes':_0x458924[_0x60b9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x60b9('0xa')](function(_0x3c305d){logger[_0x60b9('0xb')]('GetMailServerIn',_0x767b4f);logger[_0x60b9('0xc')](_0x60b9('0x14'),_0x767b4f,JSON[_0x60b9('0x1e')](_0x3c305d));_0xe62516(_0x3c305d);})[_0x60b9('0x13')](function(_0x3b489b){logger[_0x60b9('0x10')]('GetMailServerIn',_0x3b489b['message'],_0x767b4f);_0x51e84b(_0x16a7c7[_0x60b9('0x10')](0x1f4,_0x3b489b[_0x60b9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9a66352..cac6a1b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x7a54,0x106));var _0x47a5=function(_0xb64b7f,_0x4abf03){_0xb64b7f=_0xb64b7f-0x0;var _0x52f5e0=_0x7a54[_0xb64b7f];return _0x52f5e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0x31321c,_0x4df806){_0x31321c=_0x31321c-0x0;var _0x17ffaa=_0x7a54[_0x31321c];return _0x17ffaa;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0662ff2..5ac9187 100644 --- a/server/api/mailServerOut/mailServerOut.attributes.js +++ b/server/api/mailServerOut/mailServerOut.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x3c81,0x102));var _0x13c8=function(_0x29a704,_0x4129dc){_0x29a704=_0x29a704-0x0;var _0x2fdeba=_0x3c81[_0x29a704];return _0x2fdeba;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7072=['exports','STRING','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7072,0x138));var _0x2707=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7072[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'description':{'type':Sequelize[_0x2707('0x1')]},'host':{'type':Sequelize[_0x2707('0x1')]},'user':{'type':Sequelize[_0x2707('0x1')]},'pass':{'type':Sequelize[_0x2707('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x2707('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x2707('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f0be4e4..ef19c43 100644 --- a/server/api/mailServerOut/mailServerOut.controller.js +++ b/server/api/mailServerOut/mailServerOut.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x941d=['apply','reject','save','update','then','error','name','index','map','MailServerOut','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','keys','rawAttributes','include','catch','create','body','find','destroy','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x128e88,_0x3311b5){var _0x52bb01=function(_0x69ac93){while(--_0x69ac93){_0x128e88['push'](_0x128e88['shift']());}};_0x52bb01(++_0x3311b5);}(_0x941d,0x18b));var _0xd941=function(_0x185832,_0x53aeea){_0x185832=_0x185832-0x0;var _0x253dda=_0x941d[_0x185832];return _0x253dda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd941('0x0'));var zipdir=require(_0xd941('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd941('0x2'));var moment=require(_0xd941('0x3'));var BPromise=require(_0xd941('0x4'));var Mustache=require('mustache');var util=require(_0xd941('0x5'));var path=require(_0xd941('0x6'));var sox=require(_0xd941('0x7'));var csv=require(_0xd941('0x8'));var ejs=require(_0xd941('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd941('0xa'));var crypto=require(_0xd941('0xb'));var jsforce=require(_0xd941('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd941('0xd'));var Papa=require(_0xd941('0xe'));var Redis=require(_0xd941('0xf'));var authService=require(_0xd941('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd941('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd941('0x12'))('api');var utils=require(_0xd941('0x13'));var config=require(_0xd941('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd941('0x15'))['db'];function respondWithStatusCode(_0x515d98,_0x5e5910){_0x5e5910=_0x5e5910||0xcc;return function(_0x422299){if(_0x422299){return _0x515d98['sendStatus'](_0x5e5910);}return _0x515d98[_0xd941('0x16')](_0x5e5910)[_0xd941('0x17')]();};}function respondWithResult(_0x295070,_0x19df41){_0x19df41=_0x19df41||0xc8;return function(_0x1a3d1e){if(_0x1a3d1e){return _0x295070[_0xd941('0x16')](_0x19df41)[_0xd941('0x18')](_0x1a3d1e);}};}function respondWithFilteredResult(_0x44039d,_0x2b01a9){return function(_0x5cf230){if(_0x5cf230){var _0x1c02d9=typeof _0x2b01a9[_0xd941('0x19')]===_0xd941('0x1a')&&typeof _0x2b01a9[_0xd941('0x1b')]===_0xd941('0x1a');var _0x3f47b2=_0x5cf230[_0xd941('0x1c')];var _0x296e05=_0x1c02d9?0x0:_0x2b01a9[_0xd941('0x19')];var _0x45f181=_0x1c02d9?_0x5cf230['count']:_0x2b01a9[_0xd941('0x19')]+_0x2b01a9[_0xd941('0x1b')];var _0x3f281f;if(_0x45f181>=_0x3f47b2){_0x45f181=_0x3f47b2;_0x3f281f=0xc8;}else{_0x3f281f=0xce;}_0x44039d[_0xd941('0x16')](_0x3f281f);return _0x44039d[_0xd941('0x1d')](_0xd941('0x1e'),_0x296e05+'-'+_0x45f181+'/'+_0x3f47b2)[_0xd941('0x18')](_0x5cf230);}return null;};}function patchUpdates(_0x161785){return function(_0x36dd0d){try{jsonpatch[_0xd941('0x1f')](_0x36dd0d,_0x161785,!![]);}catch(_0x2395fd){return BPromise[_0xd941('0x20')](_0x2395fd);}return _0x36dd0d[_0xd941('0x21')]();};}function saveUpdates(_0x2e7dd9,_0x12e2e9){return function(_0x33d959){if(_0x33d959){return _0x33d959[_0xd941('0x22')](_0x2e7dd9)[_0xd941('0x23')](function(_0x3db344){return _0x3db344;});}return null;};}function removeEntity(_0x3de41e,_0x56128b){return function(_0x269cdc){if(_0x269cdc){return _0x269cdc['destroy']()[_0xd941('0x23')](function(){_0x3de41e[_0xd941('0x16')](0xcc)[_0xd941('0x17')]();});}};}function handleEntityNotFound(_0x3be7ce,_0x5f4159){return function(_0x427581){if(!_0x427581){_0x3be7ce['sendStatus'](0x194);}return _0x427581;};}function handleError(_0x5574fa,_0x1ae0fc){_0x1ae0fc=_0x1ae0fc||0x1f4;return function(_0x341f52){logger[_0xd941('0x24')](_0x341f52['stack']);if(_0x341f52[_0xd941('0x25')]){delete _0x341f52[_0xd941('0x25')];}_0x5574fa[_0xd941('0x16')](_0x1ae0fc)['send'](_0x341f52);};}exports[_0xd941('0x26')]=function(_0x9f1b0f,_0x3676fe){var _0x3022be={},_0x519c0d={},_0x193bce={'count':0x0,'rows':[]};var _0x235e6e=_[_0xd941('0x27')](db[_0xd941('0x28')]['rawAttributes'],function(_0x4b8cd2){return{'name':_0x4b8cd2['fieldName'],'type':_0x4b8cd2[_0xd941('0x29')][_0xd941('0x2a')]};});_0x519c0d[_0xd941('0x2b')]=_[_0xd941('0x27')](_0x235e6e,_0xd941('0x25'));_0x519c0d[_0xd941('0x2c')]=_['keys'](_0x9f1b0f[_0xd941('0x2c')]);_0x519c0d[_0xd941('0x2d')]=_[_0xd941('0x2e')](_0x519c0d[_0xd941('0x2b')],_0x519c0d[_0xd941('0x2c')]);_0x3022be[_0xd941('0x2f')]=_[_0xd941('0x2e')](_0x519c0d[_0xd941('0x2b')],qs['fields'](_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x30')]));_0x3022be[_0xd941('0x2f')]=_0x3022be['attributes'][_0xd941('0x31')]?_0x3022be[_0xd941('0x2f')]:_0x519c0d[_0xd941('0x2b')];if(!_0x9f1b0f['query'][_0xd941('0x32')](_0xd941('0x33'))){_0x3022be[_0xd941('0x1b')]=qs[_0xd941('0x1b')](_0x9f1b0f['query']['limit']);_0x3022be[_0xd941('0x19')]=qs['offset'](_0x9f1b0f['query']['offset']);}_0x3022be['order']=qs[_0xd941('0x34')](_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x34')]);_0x3022be['where']=qs[_0xd941('0x2d')](_[_0xd941('0x35')](_0x9f1b0f[_0xd941('0x2c')],_0x519c0d['filters']),_0x235e6e);if(_0x9f1b0f['query']['filter']){_0x3022be[_0xd941('0x36')]=_[_0xd941('0x37')](_0x3022be[_0xd941('0x36')],{'$or':_[_0xd941('0x27')](_0x235e6e,function(_0x8e59b){if(_0x8e59b['type']!==_0xd941('0x38')){var _0x2d9894={};_0x2d9894[_0x8e59b[_0xd941('0x25')]]={'$like':'%'+_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x39')]+'%'};return _0x2d9894;}})});}_0x3022be=_[_0xd941('0x37')]({},_0x3022be,_0x9f1b0f[_0xd941('0x3a')]);var _0x139816={'where':_0x3022be[_0xd941('0x36')]};return db[_0xd941('0x28')][_0xd941('0x1c')](_0x139816)[_0xd941('0x23')](function(_0x3ae975){_0x193bce['count']=_0x3ae975;if(_0x9f1b0f[_0xd941('0x2c')][_0xd941('0x3b')]){_0x3022be['include']=[{'all':!![]}];}return db[_0xd941('0x28')][_0xd941('0x3c')](_0x3022be);})[_0xd941('0x23')](function(_0x300acf){_0x193bce[_0xd941('0x3d')]=_0x300acf;return _0x193bce;})[_0xd941('0x23')](respondWithFilteredResult(_0x3676fe,_0x3022be))['catch'](handleError(_0x3676fe,null));};exports['show']=function(_0x3b6fec,_0xca5ccb){var _0x26b20f={'raw':!![],'where':{'id':_0x3b6fec[_0xd941('0x3e')]['id']}},_0x2cc118={};_0x2cc118[_0xd941('0x2b')]=_[_0xd941('0x3f')](db[_0xd941('0x28')][_0xd941('0x40')]);_0x2cc118[_0xd941('0x2c')]=_[_0xd941('0x3f')](_0x3b6fec['query']);_0x2cc118[_0xd941('0x2d')]=_[_0xd941('0x2e')](_0x2cc118['model'],_0x2cc118['query']);_0x26b20f[_0xd941('0x2f')]=_[_0xd941('0x2e')](_0x2cc118['model'],qs['fields'](_0x3b6fec['query'][_0xd941('0x30')]));_0x26b20f[_0xd941('0x2f')]=_0x26b20f[_0xd941('0x2f')]['length']?_0x26b20f[_0xd941('0x2f')]:_0x2cc118['model'];if(_0x3b6fec['query'][_0xd941('0x3b')]){_0x26b20f[_0xd941('0x41')]=[{'all':!![]}];}_0x26b20f=_[_0xd941('0x37')]({},_0x26b20f,_0x3b6fec[_0xd941('0x3a')]);return db['MailServerOut']['find'](_0x26b20f)[_0xd941('0x23')](handleEntityNotFound(_0xca5ccb,null))[_0xd941('0x23')](respondWithResult(_0xca5ccb,null))[_0xd941('0x42')](handleError(_0xca5ccb,null));};exports[_0xd941('0x43')]=function(_0x5b70b9,_0xbb5671){return db[_0xd941('0x28')]['create'](_0x5b70b9[_0xd941('0x44')],{})[_0xd941('0x23')](respondWithResult(_0xbb5671,0xc9))['catch'](handleError(_0xbb5671,null));};exports['update']=function(_0x9bd3f6,_0x4c7967){if(_0x9bd3f6[_0xd941('0x44')]['id']){delete _0x9bd3f6[_0xd941('0x44')]['id'];}return db[_0xd941('0x28')][_0xd941('0x45')]({'where':{'id':_0x9bd3f6['params']['id']}})[_0xd941('0x23')](handleEntityNotFound(_0x4c7967,null))[_0xd941('0x23')](saveUpdates(_0x9bd3f6[_0xd941('0x44')],null))[_0xd941('0x23')](respondWithResult(_0x4c7967,null))['catch'](handleError(_0x4c7967,null));};exports[_0xd941('0x46')]=function(_0x1bca43,_0xf0a228){return db[_0xd941('0x28')][_0xd941('0x45')]({'where':{'id':_0x1bca43[_0xd941('0x3e')]['id']}})[_0xd941('0x23')](handleEntityNotFound(_0xf0a228,null))[_0xd941('0x23')](removeEntity(_0xf0a228,null))[_0xd941('0x42')](handleError(_0xf0a228,null));}; \ No newline at end of file +var _0x2c58=['destroy','error','stack','name','send','index','MailServerOut','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','update','then'];(function(_0x2b94e6,_0x384b7b){var _0xb4103=function(_0x328ff6){while(--_0x328ff6){_0x2b94e6['push'](_0x2b94e6['shift']());}};_0xb4103(++_0x384b7b);}(_0x2c58,0x71));var _0x82c5=function(_0x302323,_0x5afc9a){_0x302323=_0x302323-0x0;var _0x21d598=_0x2c58[_0x302323];return _0x21d598;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82c5('0x0'));var zipdir=require(_0x82c5('0x1'));var jsonpatch=require(_0x82c5('0x2'));var rp=require(_0x82c5('0x3'));var moment=require(_0x82c5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82c5('0x5'));var util=require(_0x82c5('0x6'));var path=require(_0x82c5('0x7'));var sox=require(_0x82c5('0x8'));var csv=require('to-csv');var ejs=require(_0x82c5('0x9'));var fs=require('fs');var fs_extra=require(_0x82c5('0xa'));var _=require(_0x82c5('0xb'));var squel=require('squel');var crypto=require(_0x82c5('0xc'));var jsforce=require(_0x82c5('0xd'));var deskjs=require(_0x82c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x82c5('0xf'));var Papa=require(_0x82c5('0x10'));var Redis=require(_0x82c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x82c5('0x12'));var as=require(_0x82c5('0x13'));var hardwareService=require(_0x82c5('0x14'));var logger=require(_0x82c5('0x15'))(_0x82c5('0x16'));var utils=require('../../config/utils');var config=require(_0x82c5('0x17'));var licenseUtil=require(_0x82c5('0x18'));var db=require(_0x82c5('0x19'))['db'];function respondWithStatusCode(_0x12a782,_0x4314d9){_0x4314d9=_0x4314d9||0xcc;return function(_0x3b6d5c){if(_0x3b6d5c){return _0x12a782[_0x82c5('0x1a')](_0x4314d9);}return _0x12a782[_0x82c5('0x1b')](_0x4314d9)[_0x82c5('0x1c')]();};}function respondWithResult(_0x4c611e,_0xad2192){_0xad2192=_0xad2192||0xc8;return function(_0x31758c){if(_0x31758c){return _0x4c611e[_0x82c5('0x1b')](_0xad2192)['json'](_0x31758c);}};}function respondWithFilteredResult(_0x3ad9b7,_0x1e5bf8){return function(_0xceb5e){if(_0xceb5e){var _0x39c7be=typeof _0x1e5bf8[_0x82c5('0x1d')]===_0x82c5('0x1e')&&typeof _0x1e5bf8[_0x82c5('0x1f')]===_0x82c5('0x1e');var _0x258162=_0xceb5e['count'];var _0x1cceda=_0x39c7be?0x0:_0x1e5bf8['offset'];var _0x147b16=_0x39c7be?_0xceb5e['count']:_0x1e5bf8[_0x82c5('0x1d')]+_0x1e5bf8[_0x82c5('0x1f')];var _0x13b842;if(_0x147b16>=_0x258162){_0x147b16=_0x258162;_0x13b842=0xc8;}else{_0x13b842=0xce;}_0x3ad9b7['status'](_0x13b842);return _0x3ad9b7[_0x82c5('0x20')]('Content-Range',_0x1cceda+'-'+_0x147b16+'/'+_0x258162)[_0x82c5('0x21')](_0xceb5e);}return null;};}function patchUpdates(_0x14c4c0){return function(_0x17face){try{jsonpatch['apply'](_0x17face,_0x14c4c0,!![]);}catch(_0x5c6722){return BPromise[_0x82c5('0x22')](_0x5c6722);}return _0x17face['save']();};}function saveUpdates(_0x975f15,_0x5af387){return function(_0x23d7a9){if(_0x23d7a9){return _0x23d7a9[_0x82c5('0x23')](_0x975f15)[_0x82c5('0x24')](function(_0x2eb530){return _0x2eb530;});}return null;};}function removeEntity(_0x31c5af,_0x166f59){return function(_0x3e4ded){if(_0x3e4ded){return _0x3e4ded[_0x82c5('0x25')]()[_0x82c5('0x24')](function(){_0x31c5af[_0x82c5('0x1b')](0xcc)[_0x82c5('0x1c')]();});}};}function handleEntityNotFound(_0x41ff32,_0x1528d4){return function(_0x82783){if(!_0x82783){_0x41ff32[_0x82c5('0x1a')](0x194);}return _0x82783;};}function handleError(_0x320dd6,_0x231839){_0x231839=_0x231839||0x1f4;return function(_0x5cd712){logger[_0x82c5('0x26')](_0x5cd712[_0x82c5('0x27')]);if(_0x5cd712[_0x82c5('0x28')]){delete _0x5cd712[_0x82c5('0x28')];}_0x320dd6[_0x82c5('0x1b')](_0x231839)[_0x82c5('0x29')](_0x5cd712);};}exports[_0x82c5('0x2a')]=function(_0x2be5cb,_0x162ff6){var _0x6acf36={},_0x3a0aa4={},_0x5b75e3={'count':0x0,'rows':[]};var _0x211089=_['map'](db[_0x82c5('0x2b')]['rawAttributes'],function(_0x4962f5){return{'name':_0x4962f5[_0x82c5('0x2c')],'type':_0x4962f5[_0x82c5('0x2d')][_0x82c5('0x2e')]};});_0x3a0aa4[_0x82c5('0x2f')]=_[_0x82c5('0x30')](_0x211089,_0x82c5('0x28'));_0x3a0aa4[_0x82c5('0x31')]=_[_0x82c5('0x32')](_0x2be5cb[_0x82c5('0x31')]);_0x3a0aa4['filters']=_['intersection'](_0x3a0aa4[_0x82c5('0x2f')],_0x3a0aa4[_0x82c5('0x31')]);_0x6acf36[_0x82c5('0x33')]=_[_0x82c5('0x34')](_0x3a0aa4[_0x82c5('0x2f')],qs[_0x82c5('0x35')](_0x2be5cb[_0x82c5('0x31')][_0x82c5('0x35')]));_0x6acf36[_0x82c5('0x33')]=_0x6acf36[_0x82c5('0x33')]['length']?_0x6acf36[_0x82c5('0x33')]:_0x3a0aa4[_0x82c5('0x2f')];if(!_0x2be5cb['query'][_0x82c5('0x36')](_0x82c5('0x37'))){_0x6acf36[_0x82c5('0x1f')]=qs[_0x82c5('0x1f')](_0x2be5cb['query'][_0x82c5('0x1f')]);_0x6acf36[_0x82c5('0x1d')]=qs[_0x82c5('0x1d')](_0x2be5cb[_0x82c5('0x31')][_0x82c5('0x1d')]);}_0x6acf36[_0x82c5('0x38')]=qs[_0x82c5('0x39')](_0x2be5cb[_0x82c5('0x31')]['sort']);_0x6acf36[_0x82c5('0x3a')]=qs[_0x82c5('0x3b')](_[_0x82c5('0x3c')](_0x2be5cb['query'],_0x3a0aa4['filters']),_0x211089);if(_0x2be5cb[_0x82c5('0x31')][_0x82c5('0x3d')]){_0x6acf36[_0x82c5('0x3a')]=_[_0x82c5('0x3e')](_0x6acf36[_0x82c5('0x3a')],{'$or':_[_0x82c5('0x30')](_0x211089,function(_0x507bf0){if(_0x507bf0[_0x82c5('0x2d')]!==_0x82c5('0x3f')){var _0x376e18={};_0x376e18[_0x507bf0[_0x82c5('0x28')]]={'$like':'%'+_0x2be5cb[_0x82c5('0x31')][_0x82c5('0x3d')]+'%'};return _0x376e18;}})});}_0x6acf36=_['merge']({},_0x6acf36,_0x2be5cb[_0x82c5('0x40')]);var _0x3902d1={'where':_0x6acf36[_0x82c5('0x3a')]};return db[_0x82c5('0x2b')]['count'](_0x3902d1)[_0x82c5('0x24')](function(_0x3bf425){_0x5b75e3['count']=_0x3bf425;if(_0x2be5cb[_0x82c5('0x31')][_0x82c5('0x41')]){_0x6acf36[_0x82c5('0x42')]=[{'all':!![]}];}return db[_0x82c5('0x2b')][_0x82c5('0x43')](_0x6acf36);})['then'](function(_0xcfa49b){_0x5b75e3['rows']=_0xcfa49b;return _0x5b75e3;})[_0x82c5('0x24')](respondWithFilteredResult(_0x162ff6,_0x6acf36))[_0x82c5('0x44')](handleError(_0x162ff6,null));};exports[_0x82c5('0x45')]=function(_0xefbf80,_0x1a966c){var _0xd9725={'raw':!![],'where':{'id':_0xefbf80[_0x82c5('0x46')]['id']}},_0x1a8341={};_0x1a8341[_0x82c5('0x2f')]=_[_0x82c5('0x32')](db[_0x82c5('0x2b')][_0x82c5('0x47')]);_0x1a8341[_0x82c5('0x31')]=_['keys'](_0xefbf80[_0x82c5('0x31')]);_0x1a8341[_0x82c5('0x3b')]=_[_0x82c5('0x34')](_0x1a8341[_0x82c5('0x2f')],_0x1a8341[_0x82c5('0x31')]);_0xd9725['attributes']=_['intersection'](_0x1a8341[_0x82c5('0x2f')],qs[_0x82c5('0x35')](_0xefbf80[_0x82c5('0x31')][_0x82c5('0x35')]));_0xd9725[_0x82c5('0x33')]=_0xd9725['attributes'][_0x82c5('0x48')]?_0xd9725[_0x82c5('0x33')]:_0x1a8341[_0x82c5('0x2f')];if(_0xefbf80['query'][_0x82c5('0x41')]){_0xd9725[_0x82c5('0x42')]=[{'all':!![]}];}_0xd9725=_['merge']({},_0xd9725,_0xefbf80['options']);return db[_0x82c5('0x2b')][_0x82c5('0x49')](_0xd9725)[_0x82c5('0x24')](handleEntityNotFound(_0x1a966c,null))[_0x82c5('0x24')](respondWithResult(_0x1a966c,null))['catch'](handleError(_0x1a966c,null));};exports['create']=function(_0x8391b6,_0x4fe728){return db['MailServerOut']['create'](_0x8391b6[_0x82c5('0x4a')],{})['then'](respondWithResult(_0x4fe728,0xc9))[_0x82c5('0x44')](handleError(_0x4fe728,null));};exports['update']=function(_0x123999,_0x4adb5e){if(_0x123999[_0x82c5('0x4a')]['id']){delete _0x123999[_0x82c5('0x4a')]['id'];}return db[_0x82c5('0x2b')][_0x82c5('0x49')]({'where':{'id':_0x123999[_0x82c5('0x46')]['id']}})[_0x82c5('0x24')](handleEntityNotFound(_0x4adb5e,null))[_0x82c5('0x24')](saveUpdates(_0x123999['body'],null))[_0x82c5('0x24')](respondWithResult(_0x4adb5e,null))['catch'](handleError(_0x4adb5e,null));};exports[_0x82c5('0x25')]=function(_0x2d5b89,_0x40a224){return db['MailServerOut']['find']({'where':{'id':_0x2d5b89[_0x82c5('0x46')]['id']}})[_0x82c5('0x24')](handleEntityNotFound(_0x40a224,null))[_0x82c5('0x24')](removeEntity(_0x40a224,null))[_0x82c5('0x44')](handleError(_0x40a224,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 65dad7e..e20d353 100644 --- a/server/api/mailServerOut/mailServerOut.model.js +++ b/server/api/mailServerOut/mailServerOut.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc583=['lodash','../../config/logger','api','moment','bluebird','request-promise','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x558b07,_0x264477){var _0x25cea3=function(_0x478bf1){while(--_0x478bf1){_0x558b07['push'](_0x558b07['shift']());}};_0x25cea3(++_0x264477);}(_0xc583,0x108));var _0x3c58=function(_0x5185a9,_0x1c4718){_0x5185a9=_0x5185a9-0x0;var _0x54b17b=_0xc583[_0x5185a9];return _0x54b17b;};'use strict';var _=require(_0x3c58('0x0'));var util=require('util');var logger=require(_0x3c58('0x1'))(_0x3c58('0x2'));var moment=require(_0x3c58('0x3'));var BPromise=require(_0x3c58('0x4'));var rp=require(_0x3c58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c58('0x6'));module[_0x3c58('0x7')]=function(_0x3a9f7a,_0x1f9b36){return _0x3a9f7a[_0x3c58('0x8')](_0x3c58('0x9'),attributes,{'tableName':_0x3c58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbafe=['bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x692275,_0x636b8e){var _0x2149e5=function(_0x590657){while(--_0x590657){_0x692275['push'](_0x692275['shift']());}};_0x2149e5(++_0x636b8e);}(_0xbafe,0x73));var _0xebaf=function(_0x3301dd,_0x34cc84){_0x3301dd=_0x3301dd-0x0;var _0x537d9e=_0xbafe[_0x3301dd];return _0x537d9e;};'use strict';var _=require(_0xebaf('0x0'));var util=require(_0xebaf('0x1'));var logger=require(_0xebaf('0x2'))(_0xebaf('0x3'));var moment=require(_0xebaf('0x4'));var BPromise=require(_0xebaf('0x5'));var rp=require(_0xebaf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebaf('0x7'));var config=require(_0xebaf('0x8'));var attributes=require(_0xebaf('0x9'));module['exports']=function(_0x10e366,_0x2a4d28){return _0x10e366[_0xebaf('0xa')]('MailServerOut',attributes,{'tableName':_0xebaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 1fe91bf..d61d3cc 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1bdb82,_0x50e7a5){var _0x11a52b=function(_0x5f2d02){while(--_0x5f2d02){_0x1bdb82['push'](_0x1bdb82['shift']());}};_0x11a52b(++_0x50e7a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x2ed33a,_0x1d51ee){_0x2ed33a=_0x2ed33a-0x0;var _0x3ef242=_0x2ef3[_0x2ed33a];return _0x3ef242;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x57284b,_0x511dd7){_0x57284b=_0x57284b-0x0;var _0x51cfcb=_0x7a54[_0x57284b];return _0x51cfcb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 7427a31..1fca07d 100644 --- a/server/api/mailSubstatus/index.js +++ b/server/api/mailSubstatus/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8bef=['create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x8bef,0x1a8));var _0xf8be=function(_0x2b950c,_0x57cc37){_0x2b950c=_0x2b950c-0x0;var _0x592648=_0x8bef[_0x2b950c];return _0x592648;};'use strict';var multer=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var path=require(_0xf8be('0x2'));var timeout=require(_0xf8be('0x3'));var express=require(_0xf8be('0x4'));var router=express[_0xf8be('0x5')]();var fs_extra=require(_0xf8be('0x6'));var auth=require(_0xf8be('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xf8be('0x8')]('/',auth[_0xf8be('0x9')](),controller[_0xf8be('0xa')]);router['get'](_0xf8be('0xb'),auth['isAuthenticated'](),controller[_0xf8be('0xc')]);router['get'](_0xf8be('0xd'),auth[_0xf8be('0x9')](),controller[_0xf8be('0xe')]);router[_0xf8be('0xf')]('/',auth[_0xf8be('0x9')](),controller[_0xf8be('0x10')]);router['put'](_0xf8be('0xd'),auth[_0xf8be('0x9')](),controller[_0xf8be('0x11')]);router['delete']('/:id',auth[_0xf8be('0x9')](),controller[_0xf8be('0x12')]);module[_0xf8be('0x13')]=router; \ No newline at end of file +var _0x7f01=['isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/describe'];(function(_0x545254,_0x567a7b){var _0x5c7976=function(_0x9701bc){while(--_0x9701bc){_0x545254['push'](_0x545254['shift']());}};_0x5c7976(++_0x567a7b);}(_0x7f01,0x74));var _0x17f0=function(_0xf2046f,_0x21da7e){_0xf2046f=_0xf2046f-0x0;var _0x19aea8=_0x7f01[_0xf2046f];return _0x19aea8;};'use strict';var multer=require(_0x17f0('0x0'));var util=require(_0x17f0('0x1'));var path=require(_0x17f0('0x2'));var timeout=require(_0x17f0('0x3'));var express=require(_0x17f0('0x4'));var router=express[_0x17f0('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x17f0('0x6'));var config=require(_0x17f0('0x7'));var controller=require('./mailSubstatus.controller');router[_0x17f0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x17f0('0x8')](_0x17f0('0x9'),auth[_0x17f0('0xa')](),controller['describe']);router[_0x17f0('0x8')](_0x17f0('0xb'),auth['isAuthenticated'](),controller[_0x17f0('0xc')]);router['post']('/',auth[_0x17f0('0xa')](),controller['create']);router[_0x17f0('0xd')]('/:id',auth[_0x17f0('0xa')](),controller[_0x17f0('0xe')]);router[_0x17f0('0xf')](_0x17f0('0xb'),auth['isAuthenticated'](),controller[_0x17f0('0x10')]);module[_0x17f0('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1da8066..be12b7f 100644 --- a/server/api/mailSubstatus/mailSubstatus.attributes.js +++ b/server/api/mailSubstatus/mailSubstatus.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf40b=['STRING','name','exports'];(function(_0x3de4af,_0x3a27cf){var _0x4f7a6b=function(_0x5bace0){while(--_0x5bace0){_0x3de4af['push'](_0x3de4af['shift']());}};_0x4f7a6b(++_0x3a27cf);}(_0xf40b,0xb0));var _0xbf40=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xf40b[_0x350182];return _0x4a0892;};'use strict';var Sequelize=require('sequelize');module[_0xbf40('0x0')]={'name':{'type':Sequelize[_0xbf40('0x1')],'unique':_0xbf40('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf40('0x1')]}}; \ No newline at end of file +var _0x814b=['STRING','name','sequelize','exports'];(function(_0x1f8156,_0x4781c0){var _0x1ec6cb=function(_0x203a7e){while(--_0x203a7e){_0x1f8156['push'](_0x1f8156['shift']());}};_0x1ec6cb(++_0x4781c0);}(_0x814b,0x1a2));var _0xb814=function(_0x31061a,_0x5ab647){_0x31061a=_0x31061a-0x0;var _0x48d92a=_0x814b[_0x31061a];return _0x48d92a;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'unique':_0xb814('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb814('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7b88bf1..4709494 100644 --- a/server/api/mailSubstatus/mailSubstatus.controller.js +++ b/server/api/mailSubstatus/mailSubstatus.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c9b=['includeAll','include','rows','catch','show','params','keys','intersection','length','find','create','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','MailSubstatus','rawAttributes','fieldName','key','map','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x45521d,_0x169dfe){var _0x24f9ed=function(_0x54a0e4){while(--_0x54a0e4){_0x45521d['push'](_0x45521d['shift']());}};_0x24f9ed(++_0x169dfe);}(_0x2c9b,0x12d));var _0xb2c9=function(_0x316a77,_0x345d09){_0x316a77=_0x316a77-0x0;var _0x3fb444=_0x2c9b[_0x316a77];return _0x3fb444;};'use strict';var emlformat=require(_0xb2c9('0x0'));var rimraf=require(_0xb2c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2c9('0x2'));var BPromise=require(_0xb2c9('0x3'));var Mustache=require(_0xb2c9('0x4'));var util=require(_0xb2c9('0x5'));var path=require(_0xb2c9('0x6'));var sox=require(_0xb2c9('0x7'));var csv=require('to-csv');var ejs=require(_0xb2c9('0x8'));var fs=require('fs');var fs_extra=require(_0xb2c9('0x9'));var _=require(_0xb2c9('0xa'));var squel=require(_0xb2c9('0xb'));var crypto=require(_0xb2c9('0xc'));var jsforce=require(_0xb2c9('0xd'));var deskjs=require(_0xb2c9('0xe'));var toCsv=require(_0xb2c9('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb2c9('0x10'));var authService=require(_0xb2c9('0x11'));var qs=require(_0xb2c9('0x12'));var as=require(_0xb2c9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb2c9('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb2c9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2c9('0x16'))['db'];function respondWithStatusCode(_0x1e5a47,_0x3c0f30){_0x3c0f30=_0x3c0f30||0xcc;return function(_0x3d8af2){if(_0x3d8af2){return _0x1e5a47[_0xb2c9('0x17')](_0x3c0f30);}return _0x1e5a47[_0xb2c9('0x18')](_0x3c0f30)[_0xb2c9('0x19')]();};}function respondWithResult(_0x283f73,_0x5a2dec){_0x5a2dec=_0x5a2dec||0xc8;return function(_0x55a0c9){if(_0x55a0c9){return _0x283f73[_0xb2c9('0x18')](_0x5a2dec)[_0xb2c9('0x1a')](_0x55a0c9);}};}function respondWithFilteredResult(_0x5e049f,_0x3ddd){return function(_0x2c120b){if(_0x2c120b){var _0x110f7a=typeof _0x3ddd[_0xb2c9('0x1b')]===_0xb2c9('0x1c')&&typeof _0x3ddd[_0xb2c9('0x1d')]==='undefined';var _0x3b5f57=_0x2c120b[_0xb2c9('0x1e')];var _0x4e6715=_0x110f7a?0x0:_0x3ddd[_0xb2c9('0x1b')];var _0x34a911=_0x110f7a?_0x2c120b[_0xb2c9('0x1e')]:_0x3ddd[_0xb2c9('0x1b')]+_0x3ddd[_0xb2c9('0x1d')];var _0x29e4d3;if(_0x34a911>=_0x3b5f57){_0x34a911=_0x3b5f57;_0x29e4d3=0xc8;}else{_0x29e4d3=0xce;}_0x5e049f['status'](_0x29e4d3);return _0x5e049f[_0xb2c9('0x1f')](_0xb2c9('0x20'),_0x4e6715+'-'+_0x34a911+'/'+_0x3b5f57)[_0xb2c9('0x1a')](_0x2c120b);}return null;};}function patchUpdates(_0x63ff34){return function(_0x21b5d4){try{jsonpatch['apply'](_0x21b5d4,_0x63ff34,!![]);}catch(_0x298756){return BPromise['reject'](_0x298756);}return _0x21b5d4['save']();};}function saveUpdates(_0xf287c,_0x1f8a97){return function(_0x29330d){if(_0x29330d){return _0x29330d[_0xb2c9('0x21')](_0xf287c)[_0xb2c9('0x22')](function(_0x551b42){return _0x551b42;});}return null;};}function removeEntity(_0x35414b,_0x50e356){return function(_0x50193a){if(_0x50193a){return _0x50193a[_0xb2c9('0x23')]()[_0xb2c9('0x22')](function(){_0x35414b[_0xb2c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3967ff,_0x467576){return function(_0x111c4c){if(!_0x111c4c){_0x3967ff['sendStatus'](0x194);}return _0x111c4c;};}function handleError(_0x43f6bd,_0x348917){_0x348917=_0x348917||0x1f4;return function(_0x213d3e){logger[_0xb2c9('0x24')](_0x213d3e[_0xb2c9('0x25')]);if(_0x213d3e[_0xb2c9('0x26')]){delete _0x213d3e[_0xb2c9('0x26')];}_0x43f6bd[_0xb2c9('0x18')](_0x348917)['send'](_0x213d3e);};}exports[_0xb2c9('0x27')]=function(_0x541842,_0x4a2ff2){var _0x5ecbc1={},_0x205660={},_0x4f68db={'count':0x0,'rows':[]};var _0x569690=_['map'](db[_0xb2c9('0x28')][_0xb2c9('0x29')],function(_0x468531){return{'name':_0x468531[_0xb2c9('0x2a')],'type':_0x468531['type'][_0xb2c9('0x2b')]};});_0x205660['model']=_[_0xb2c9('0x2c')](_0x569690,_0xb2c9('0x26'));_0x205660[_0xb2c9('0x2d')]=_['keys'](_0x541842['query']);_0x205660[_0xb2c9('0x2e')]=_['intersection'](_0x205660[_0xb2c9('0x2f')],_0x205660['query']);_0x5ecbc1[_0xb2c9('0x30')]=_['intersection'](_0x205660['model'],qs['fields'](_0x541842['query'][_0xb2c9('0x31')]));_0x5ecbc1[_0xb2c9('0x30')]=_0x5ecbc1[_0xb2c9('0x30')]['length']?_0x5ecbc1[_0xb2c9('0x30')]:_0x205660[_0xb2c9('0x2f')];if(!_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x32')](_0xb2c9('0x33'))){_0x5ecbc1[_0xb2c9('0x1d')]=qs[_0xb2c9('0x1d')](_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x1d')]);_0x5ecbc1[_0xb2c9('0x1b')]=qs[_0xb2c9('0x1b')](_0x541842['query']['offset']);}_0x5ecbc1[_0xb2c9('0x34')]=qs[_0xb2c9('0x35')](_0x541842['query'][_0xb2c9('0x35')]);_0x5ecbc1[_0xb2c9('0x36')]=qs['filters'](_[_0xb2c9('0x37')](_0x541842[_0xb2c9('0x2d')],_0x205660[_0xb2c9('0x2e')]),_0x569690);if(_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x38')]){_0x5ecbc1['where']=_[_0xb2c9('0x39')](_0x5ecbc1[_0xb2c9('0x36')],{'$or':_[_0xb2c9('0x2c')](_0x569690,function(_0x325c8d){if(_0x325c8d['type']!=='VIRTUAL'){var _0x15e6d5={};_0x15e6d5[_0x325c8d[_0xb2c9('0x26')]]={'$like':'%'+_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x38')]+'%'};return _0x15e6d5;}})});}_0x5ecbc1=_[_0xb2c9('0x39')]({},_0x5ecbc1,_0x541842[_0xb2c9('0x3a')]);var _0x1e207a={'where':_0x5ecbc1[_0xb2c9('0x36')]};return db[_0xb2c9('0x28')][_0xb2c9('0x1e')](_0x1e207a)[_0xb2c9('0x22')](function(_0x544652){_0x4f68db[_0xb2c9('0x1e')]=_0x544652;if(_0x541842[_0xb2c9('0x2d')][_0xb2c9('0x3b')]){_0x5ecbc1[_0xb2c9('0x3c')]=[{'all':!![]}];}return db[_0xb2c9('0x28')]['findAll'](_0x5ecbc1);})[_0xb2c9('0x22')](function(_0x45c76d){_0x4f68db[_0xb2c9('0x3d')]=_0x45c76d;return _0x4f68db;})[_0xb2c9('0x22')](respondWithFilteredResult(_0x4a2ff2,_0x5ecbc1))[_0xb2c9('0x3e')](handleError(_0x4a2ff2,null));};exports[_0xb2c9('0x3f')]=function(_0x271dd6,_0x40c1f6){var _0x29b485={'raw':!![],'where':{'id':_0x271dd6[_0xb2c9('0x40')]['id']}},_0x12d26e={};_0x12d26e['model']=_[_0xb2c9('0x41')](db[_0xb2c9('0x28')]['rawAttributes']);_0x12d26e['query']=_[_0xb2c9('0x41')](_0x271dd6[_0xb2c9('0x2d')]);_0x12d26e['filters']=_['intersection'](_0x12d26e[_0xb2c9('0x2f')],_0x12d26e['query']);_0x29b485[_0xb2c9('0x30')]=_[_0xb2c9('0x42')](_0x12d26e[_0xb2c9('0x2f')],qs[_0xb2c9('0x31')](_0x271dd6['query']['fields']));_0x29b485['attributes']=_0x29b485['attributes'][_0xb2c9('0x43')]?_0x29b485[_0xb2c9('0x30')]:_0x12d26e[_0xb2c9('0x2f')];if(_0x271dd6[_0xb2c9('0x2d')][_0xb2c9('0x3b')]){_0x29b485['include']=[{'all':!![]}];}_0x29b485=_['merge']({},_0x29b485,_0x271dd6[_0xb2c9('0x3a')]);return db['MailSubstatus'][_0xb2c9('0x44')](_0x29b485)[_0xb2c9('0x22')](handleEntityNotFound(_0x40c1f6,null))[_0xb2c9('0x22')](respondWithResult(_0x40c1f6,null))[_0xb2c9('0x3e')](handleError(_0x40c1f6,null));};exports[_0xb2c9('0x45')]=function(_0x4130a9,_0x221abd){return db[_0xb2c9('0x28')][_0xb2c9('0x45')](_0x4130a9[_0xb2c9('0x46')],{})[_0xb2c9('0x22')](respondWithResult(_0x221abd,0xc9))[_0xb2c9('0x3e')](handleError(_0x221abd,null));};exports[_0xb2c9('0x21')]=function(_0x4211cd,_0x3f160c){if(_0x4211cd[_0xb2c9('0x46')]['id']){delete _0x4211cd['body']['id'];}return db[_0xb2c9('0x28')][_0xb2c9('0x44')]({'where':{'id':_0x4211cd[_0xb2c9('0x40')]['id']}})[_0xb2c9('0x22')](handleEntityNotFound(_0x3f160c,null))[_0xb2c9('0x22')](saveUpdates(_0x4211cd['body'],null))[_0xb2c9('0x22')](respondWithResult(_0x3f160c,null))[_0xb2c9('0x3e')](handleError(_0x3f160c,null));};exports[_0xb2c9('0x23')]=function(_0x25c748,_0x3100d9){return db['MailSubstatus'][_0xb2c9('0x44')]({'where':{'id':_0x25c748[_0xb2c9('0x40')]['id']}})[_0xb2c9('0x22')](handleEntityNotFound(_0x3100d9,null))['then'](removeEntity(_0x3100d9,null))['catch'](handleError(_0x3100d9,null));};exports[_0xb2c9('0x47')]=function(_0x11baec,_0x354026){return db[_0xb2c9('0x28')][_0xb2c9('0x47')]()[_0xb2c9('0x22')](respondWithResult(_0x354026,null))[_0xb2c9('0x3e')](handleError(_0x354026,null));}; \ No newline at end of file +var _0x87e1=['body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','then','error','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','create'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x87e1,0x127));var _0x187e=function(_0x2b51c2,_0x401991){_0x2b51c2=_0x2b51c2-0x0;var _0x234ecd=_0x87e1[_0x2b51c2];return _0x234ecd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x187e('0x0'));var zipdir=require(_0x187e('0x1'));var jsonpatch=require(_0x187e('0x2'));var rp=require(_0x187e('0x3'));var moment=require(_0x187e('0x4'));var BPromise=require(_0x187e('0x5'));var Mustache=require(_0x187e('0x6'));var util=require(_0x187e('0x7'));var path=require('path');var sox=require(_0x187e('0x8'));var csv=require(_0x187e('0x9'));var ejs=require(_0x187e('0xa'));var fs=require('fs');var fs_extra=require(_0x187e('0xb'));var _=require(_0x187e('0xc'));var squel=require(_0x187e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x187e('0xe'));var toCsv=require(_0x187e('0x9'));var querystring=require('querystring');var Papa=require(_0x187e('0xf'));var Redis=require(_0x187e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x187e('0x11'));var as=require(_0x187e('0x12'));var hardwareService=require(_0x187e('0x13'));var logger=require(_0x187e('0x14'))(_0x187e('0x15'));var utils=require(_0x187e('0x16'));var config=require(_0x187e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x187e('0x18'))['db'];function respondWithStatusCode(_0x386437,_0x235a48){_0x235a48=_0x235a48||0xcc;return function(_0x4d3a0a){if(_0x4d3a0a){return _0x386437[_0x187e('0x19')](_0x235a48);}return _0x386437[_0x187e('0x1a')](_0x235a48)[_0x187e('0x1b')]();};}function respondWithResult(_0x135719,_0x3c09bd){_0x3c09bd=_0x3c09bd||0xc8;return function(_0x39990d){if(_0x39990d){return _0x135719[_0x187e('0x1a')](_0x3c09bd)[_0x187e('0x1c')](_0x39990d);}};}function respondWithFilteredResult(_0x4ceeeb,_0x167853){return function(_0xd7cd93){if(_0xd7cd93){var _0x3eb53c=typeof _0x167853[_0x187e('0x1d')]===_0x187e('0x1e')&&typeof _0x167853[_0x187e('0x1f')]===_0x187e('0x1e');var _0x19eeaf=_0xd7cd93[_0x187e('0x20')];var _0x2e8dc6=_0x3eb53c?0x0:_0x167853['offset'];var _0x581113=_0x3eb53c?_0xd7cd93[_0x187e('0x20')]:_0x167853[_0x187e('0x1d')]+_0x167853['limit'];var _0x1a742c;if(_0x581113>=_0x19eeaf){_0x581113=_0x19eeaf;_0x1a742c=0xc8;}else{_0x1a742c=0xce;}_0x4ceeeb['status'](_0x1a742c);return _0x4ceeeb[_0x187e('0x21')]('Content-Range',_0x2e8dc6+'-'+_0x581113+'/'+_0x19eeaf)[_0x187e('0x1c')](_0xd7cd93);}return null;};}function patchUpdates(_0x5144c8){return function(_0x344f5a){try{jsonpatch['apply'](_0x344f5a,_0x5144c8,!![]);}catch(_0x4dc684){return BPromise[_0x187e('0x22')](_0x4dc684);}return _0x344f5a[_0x187e('0x23')]();};}function saveUpdates(_0x3d88e4,_0x298e4e){return function(_0x34ec92){if(_0x34ec92){return _0x34ec92['update'](_0x3d88e4)['then'](function(_0x1faadb){return _0x1faadb;});}return null;};}function removeEntity(_0x59c77a,_0xfe4020){return function(_0x2a9731){if(_0x2a9731){return _0x2a9731[_0x187e('0x24')]()[_0x187e('0x25')](function(){_0x59c77a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b60f,_0x1dce80){return function(_0x53ead0){if(!_0x53ead0){_0x19b60f[_0x187e('0x19')](0x194);}return _0x53ead0;};}function handleError(_0x5db879,_0x1737d4){_0x1737d4=_0x1737d4||0x1f4;return function(_0x3e87e9){logger[_0x187e('0x26')](_0x3e87e9['stack']);if(_0x3e87e9[_0x187e('0x27')]){delete _0x3e87e9['name'];}_0x5db879[_0x187e('0x1a')](_0x1737d4)[_0x187e('0x28')](_0x3e87e9);};}exports[_0x187e('0x29')]=function(_0x5a90f0,_0x5e1e80){var _0xb72419={},_0x1ca616={},_0x5b65e7={'count':0x0,'rows':[]};var _0x145fb7=_[_0x187e('0x2a')](db[_0x187e('0x2b')]['rawAttributes'],function(_0x179830){return{'name':_0x179830[_0x187e('0x2c')],'type':_0x179830[_0x187e('0x2d')][_0x187e('0x2e')]};});_0x1ca616[_0x187e('0x2f')]=_[_0x187e('0x2a')](_0x145fb7,_0x187e('0x27'));_0x1ca616[_0x187e('0x30')]=_['keys'](_0x5a90f0[_0x187e('0x30')]);_0x1ca616[_0x187e('0x31')]=_['intersection'](_0x1ca616[_0x187e('0x2f')],_0x1ca616[_0x187e('0x30')]);_0xb72419[_0x187e('0x32')]=_[_0x187e('0x33')](_0x1ca616['model'],qs[_0x187e('0x34')](_0x5a90f0[_0x187e('0x30')][_0x187e('0x34')]));_0xb72419[_0x187e('0x32')]=_0xb72419['attributes']['length']?_0xb72419['attributes']:_0x1ca616['model'];if(!_0x5a90f0[_0x187e('0x30')][_0x187e('0x35')](_0x187e('0x36'))){_0xb72419[_0x187e('0x1f')]=qs[_0x187e('0x1f')](_0x5a90f0[_0x187e('0x30')][_0x187e('0x1f')]);_0xb72419[_0x187e('0x1d')]=qs[_0x187e('0x1d')](_0x5a90f0[_0x187e('0x30')][_0x187e('0x1d')]);}_0xb72419[_0x187e('0x37')]=qs[_0x187e('0x38')](_0x5a90f0[_0x187e('0x30')][_0x187e('0x38')]);_0xb72419[_0x187e('0x39')]=qs['filters'](_['pick'](_0x5a90f0[_0x187e('0x30')],_0x1ca616[_0x187e('0x31')]),_0x145fb7);if(_0x5a90f0['query']['filter']){_0xb72419['where']=_[_0x187e('0x3a')](_0xb72419['where'],{'$or':_[_0x187e('0x2a')](_0x145fb7,function(_0xf0fa8e){if(_0xf0fa8e['type']!==_0x187e('0x3b')){var _0x5232fb={};_0x5232fb[_0xf0fa8e[_0x187e('0x27')]]={'$like':'%'+_0x5a90f0[_0x187e('0x30')]['filter']+'%'};return _0x5232fb;}})});}_0xb72419=_[_0x187e('0x3a')]({},_0xb72419,_0x5a90f0[_0x187e('0x3c')]);var _0x37d137={'where':_0xb72419[_0x187e('0x39')]};return db[_0x187e('0x2b')][_0x187e('0x20')](_0x37d137)[_0x187e('0x25')](function(_0x249e8c){_0x5b65e7[_0x187e('0x20')]=_0x249e8c;if(_0x5a90f0['query'][_0x187e('0x3d')]){_0xb72419[_0x187e('0x3e')]=[{'all':!![]}];}return db['MailSubstatus'][_0x187e('0x3f')](_0xb72419);})[_0x187e('0x25')](function(_0x3a142e){_0x5b65e7['rows']=_0x3a142e;return _0x5b65e7;})['then'](respondWithFilteredResult(_0x5e1e80,_0xb72419))[_0x187e('0x40')](handleError(_0x5e1e80,null));};exports[_0x187e('0x41')]=function(_0x168898,_0x3cce14){var _0x32ff57={'raw':!![],'where':{'id':_0x168898[_0x187e('0x42')]['id']}},_0x5e439e={};_0x5e439e[_0x187e('0x2f')]=_['keys'](db[_0x187e('0x2b')][_0x187e('0x43')]);_0x5e439e['query']=_['keys'](_0x168898[_0x187e('0x30')]);_0x5e439e[_0x187e('0x31')]=_[_0x187e('0x33')](_0x5e439e[_0x187e('0x2f')],_0x5e439e['query']);_0x32ff57[_0x187e('0x32')]=_[_0x187e('0x33')](_0x5e439e['model'],qs[_0x187e('0x34')](_0x168898[_0x187e('0x30')][_0x187e('0x34')]));_0x32ff57[_0x187e('0x32')]=_0x32ff57[_0x187e('0x32')][_0x187e('0x44')]?_0x32ff57[_0x187e('0x32')]:_0x5e439e[_0x187e('0x2f')];if(_0x168898['query'][_0x187e('0x3d')]){_0x32ff57['include']=[{'all':!![]}];}_0x32ff57=_[_0x187e('0x3a')]({},_0x32ff57,_0x168898[_0x187e('0x3c')]);return db['MailSubstatus']['find'](_0x32ff57)['then'](handleEntityNotFound(_0x3cce14,null))[_0x187e('0x25')](respondWithResult(_0x3cce14,null))['catch'](handleError(_0x3cce14,null));};exports[_0x187e('0x45')]=function(_0x2ecab9,_0x5e76c7){return db['MailSubstatus']['create'](_0x2ecab9[_0x187e('0x46')],{})[_0x187e('0x25')](respondWithResult(_0x5e76c7,0xc9))[_0x187e('0x40')](handleError(_0x5e76c7,null));};exports[_0x187e('0x47')]=function(_0x307cd5,_0x27fff2){if(_0x307cd5['body']['id']){delete _0x307cd5[_0x187e('0x46')]['id'];}return db['MailSubstatus'][_0x187e('0x48')]({'where':{'id':_0x307cd5[_0x187e('0x42')]['id']}})[_0x187e('0x25')](handleEntityNotFound(_0x27fff2,null))['then'](saveUpdates(_0x307cd5['body'],null))['then'](respondWithResult(_0x27fff2,null))[_0x187e('0x40')](handleError(_0x27fff2,null));};exports[_0x187e('0x24')]=function(_0x5f0848,_0x89a877){return db[_0x187e('0x2b')]['find']({'where':{'id':_0x5f0848[_0x187e('0x42')]['id']}})[_0x187e('0x25')](handleEntityNotFound(_0x89a877,null))[_0x187e('0x25')](removeEntity(_0x89a877,null))[_0x187e('0x40')](handleError(_0x89a877,null));};exports['describe']=function(_0x4fd1a1,_0x63991d){return db['MailSubstatus']['describe']()[_0x187e('0x25')](respondWithResult(_0x63991d,null))['catch'](handleError(_0x63991d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 1e0ea93..abd54fa 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ed8=['hook','exports','../../mysqldb','MailSubstatus','setMaxListeners','emit'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x2ed8,0xce));var _0x82ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ed8[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x82ed('0x0'))['db'][_0x82ed('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x82ed('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4dadf8){return function(_0x1f64fb,_0x2a7ed1,_0x56ebbc){MailSubstatusEvents[_0x82ed('0x3')](_0x4dadf8+':'+_0x1f64fb['id'],_0x1f64fb);MailSubstatusEvents['emit'](_0x4dadf8,_0x1f64fb);_0x56ebbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x82ed('0x4')](e,emitEvent(event));}}module[_0x82ed('0x5')]=MailSubstatusEvents; \ No newline at end of file +var _0xeb7e=['hasOwnProperty','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x730085,_0x115abb){var _0x1c2564=function(_0x45c204){while(--_0x45c204){_0x730085['push'](_0x730085['shift']());}};_0x1c2564(++_0x115abb);}(_0xeb7e,0x17a));var _0xeeb7=function(_0x14b1a8,_0x297da6){_0x14b1a8=_0x14b1a8-0x0;var _0x448563=_0xeb7e[_0x14b1a8];return _0x448563;};'use strict';var EventEmitter=require(_0xeeb7('0x0'));var MailSubstatus=require(_0xeeb7('0x1'))['db'][_0xeeb7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xeeb7('0x3')](0x0);var events={'afterUpdate':_0xeeb7('0x4')};function emitEvent(_0x324e73){return function(_0x32f35e,_0xed4c16,_0x6357e7){MailSubstatusEvents[_0xeeb7('0x5')](_0x324e73+':'+_0x32f35e['id'],_0x32f35e);MailSubstatusEvents[_0xeeb7('0x5')](_0x324e73,_0x32f35e);_0x6357e7(null);};}for(var e in events){if(events[_0xeeb7('0x6')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xeeb7('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 87ba322..d7fa7fb 100644 --- a/server/api/mailSubstatus/mailSubstatus.model.js +++ b/server/api/mailSubstatus/mailSubstatus.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fdc=['define','mail_substatuses','Condition','update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','models'];(function(_0x2dfcff,_0x3025d6){var _0x48eacd=function(_0x4f93ba){while(--_0x4f93ba){_0x2dfcff['push'](_0x2dfcff['shift']());}};_0x48eacd(++_0x3025d6);}(_0x0fdc,0x18d));var _0xc0fd=function(_0x2655de,_0x281ede){_0x2655de=_0x2655de-0x0;var _0x2d62cd=_0x0fdc[_0x2655de];return _0x2d62cd;};'use strict';var attributes=require(_0xc0fd('0x0'));module[_0xc0fd('0x1')]=function(_0x37ae50){var _0x1e475f=_0x37ae50[_0xc0fd('0x2')];return _0x37ae50[_0xc0fd('0x3')]('MailSubstatus',attributes,{'tableName':_0xc0fd('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x30062e,_0x17588b,_0x40f73d){return _0x1e475f[_0xc0fd('0x5')][_0xc0fd('0x6')]({'value':_0x30062e[_0xc0fd('0x7')]},{'where':{'field':_0xc0fd('0x8'),'value':_0x30062e['_previousDataValues'][_0xc0fd('0x7')]}})['then'](function(){_0x40f73d();})[_0xc0fd('0x9')](function(_0x43eb03){_0x40f73d(_0x43eb03);});}}});}; \ No newline at end of file +var _0x65a8=['then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues'];(function(_0x3c01e0,_0x4cf500){var _0x353239=function(_0x50b188){while(--_0x50b188){_0x3c01e0['push'](_0x3c01e0['shift']());}};_0x353239(++_0x4cf500);}(_0x65a8,0xfe));var _0x865a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x65a8[_0x1cc8fe];return _0x230054;};'use strict';var attributes=require(_0x865a('0x0'));module[_0x865a('0x1')]=function(_0x171a6d){var _0x13f9f9=_0x171a6d[_0x865a('0x2')];return _0x171a6d[_0x865a('0x3')](_0x865a('0x4'),attributes,{'tableName':_0x865a('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x226557,_0x3f8320,_0x1ec675){return _0x13f9f9[_0x865a('0x6')][_0x865a('0x7')]({'value':_0x226557['name']},{'where':{'field':_0x865a('0x8'),'value':_0x226557[_0x865a('0x9')]['name']}})[_0x865a('0xa')](function(){_0x1ec675();})[_0x865a('0xb')](function(_0x1ce8db){_0x1ec675(_0x1ce8db);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index f1889b7..214ece2 100644 --- a/server/api/mailSubstatus/mailSubstatus.rpc.js +++ b/server/api/mailSubstatus/mailSubstatus.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba0=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x555434,_0x95d8fb){_0x555434=_0x555434-0x0;var _0x21c04f=_0x8ba0[_0x555434];return _0x21c04f;};'use strict';var _=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var moment=require(_0x08ba('0x2'));var BPromise=require(_0x08ba('0x3'));var rs=require(_0x08ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08ba('0x5'));var logger=require(_0x08ba('0x6'))(_0x08ba('0x7'));var config=require(_0x08ba('0x8'));var jayson=require(_0x08ba('0x9'));var client=jayson[_0x08ba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235354,_0x11f6a1,_0x37bcdf){return new BPromise(function(_0x451f15,_0x1f6051){return client['request'](_0x235354,_0x37bcdf)[_0x08ba('0xb')](function(_0x5eb94f){logger[_0x08ba('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x11f6a1,_0x08ba('0xd'));logger[_0x08ba('0xe')](_0x08ba('0xf'),_0x11f6a1,_0x08ba('0xd'),JSON[_0x08ba('0x10')](_0x5eb94f));if(_0x5eb94f[_0x08ba('0x11')]){if(_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x12')]===0x1f4){logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x1f6051(_0x5eb94f['error'][_0x08ba('0x14')]);}logger[_0x08ba('0x11')](_0x08ba('0x13'),_0x11f6a1,_0x5eb94f[_0x08ba('0x11')][_0x08ba('0x14')]);return _0x451f15(_0x5eb94f[_0x08ba('0x11')]['message']);}else{logger[_0x08ba('0xc')](_0x08ba('0x13'),_0x11f6a1,_0x08ba('0xd'));_0x451f15(_0x5eb94f[_0x08ba('0x15')][_0x08ba('0x14')]);}})['catch'](function(_0x4b5a04){logger[_0x08ba('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x11f6a1,_0x4b5a04);_0x1f6051(_0x4b5a04);});});} \ No newline at end of file +var _0x0ae1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0x0ae1,0xac));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var moment=require(_0x10ae('0x2'));var BPromise=require(_0x10ae('0x3'));var rs=require(_0x10ae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10ae('0x5'))['db'];var utils=require(_0x10ae('0x6'));var logger=require(_0x10ae('0x7'))('rpc');var config=require(_0x10ae('0x8'));var jayson=require(_0x10ae('0x9'));var client=jayson[_0x10ae('0xa')][_0x10ae('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5a0c3,_0x117f72,_0x3b4f0d){return new BPromise(function(_0x21affb,_0xc336b6){return client[_0x10ae('0xc')](_0xe5a0c3,_0x3b4f0d)[_0x10ae('0xd')](function(_0x15c0b2){logger[_0x10ae('0xe')](_0x10ae('0xf'),_0x117f72,_0x10ae('0x10'));logger[_0x10ae('0x11')](_0x10ae('0x12'),_0x117f72,_0x10ae('0x10'),JSON[_0x10ae('0x13')](_0x15c0b2));if(_0x15c0b2['error']){if(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x15')]===0x1f4){logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);return _0xc336b6(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);}logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);return _0x21affb(_0x15c0b2[_0x10ae('0x14')][_0x10ae('0x16')]);}else{logger['info'](_0x10ae('0xf'),_0x117f72,_0x10ae('0x10'));_0x21affb(_0x15c0b2[_0x10ae('0x17')][_0x10ae('0x16')]);}})[_0x10ae('0x18')](function(_0x3ff545){logger[_0x10ae('0x14')](_0x10ae('0xf'),_0x117f72,_0x3ff545);_0xc336b6(_0x3ff545);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 8e25613..965e139 100644 --- a/server/api/mailTransferReport/index.js +++ b/server/api/mailTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe06a=['/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','create','update'];(function(_0x3e1be4,_0x3961d9){var _0x33eafc=function(_0x5572d5){while(--_0x5572d5){_0x3e1be4['push'](_0x3e1be4['shift']());}};_0x33eafc(++_0x3961d9);}(_0xe06a,0x11f));var _0xae06=function(_0x3c7adb,_0x7d489d){_0x3c7adb=_0x3c7adb-0x0;var _0x1b45f6=_0xe06a[_0x3c7adb];return _0x1b45f6;};'use strict';var multer=require(_0xae06('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xae06('0x1'));var express=require(_0xae06('0x2'));var router=express[_0xae06('0x3')]();var fs_extra=require(_0xae06('0x4'));var auth=require(_0xae06('0x5'));var interaction=require(_0xae06('0x6'));var config=require(_0xae06('0x7'));var controller=require(_0xae06('0x8'));router[_0xae06('0x9')]('/',auth['isAuthenticated'](),controller[_0xae06('0xa')]);router[_0xae06('0x9')](_0xae06('0xb'),auth[_0xae06('0xc')](),controller[_0xae06('0xd')]);router['get']('/:id',auth[_0xae06('0xc')](),controller[_0xae06('0xe')]);router['post']('/',auth[_0xae06('0xc')](),controller[_0xae06('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xae06('0x10')]);router['delete'](_0xae06('0x11'),auth[_0xae06('0xc')](),controller[_0xae06('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8473=['index','/describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0xd439d,_0x49a829){var _0x2635d4=function(_0x457d37){while(--_0x457d37){_0xd439d['push'](_0xd439d['shift']());}};_0x2635d4(++_0x49a829);}(_0x8473,0x127));var _0x3847=function(_0x34a1d9,_0x3b5db4){_0x34a1d9=_0x34a1d9-0x0;var _0xe793af=_0x8473[_0x34a1d9];return _0xe793af;};'use strict';var multer=require(_0x3847('0x0'));var util=require(_0x3847('0x1'));var path=require(_0x3847('0x2'));var timeout=require('connect-timeout');var express=require(_0x3847('0x3'));var router=express['Router']();var fs_extra=require(_0x3847('0x4'));var auth=require(_0x3847('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3847('0x6'));var controller=require('./mailTransferReport.controller');router[_0x3847('0x7')]('/',auth[_0x3847('0x8')](),controller[_0x3847('0x9')]);router['get'](_0x3847('0xa'),auth[_0x3847('0x8')](),controller['describe']);router[_0x3847('0x7')]('/:id',auth[_0x3847('0x8')](),controller['show']);router[_0x3847('0xb')]('/',auth[_0x3847('0x8')](),controller[_0x3847('0xc')]);router[_0x3847('0xd')](_0x3847('0xe'),auth[_0x3847('0x8')](),controller[_0x3847('0xf')]);router[_0x3847('0x10')](_0x3847('0xe'),auth[_0x3847('0x8')](),controller[_0x3847('0x11')]);module[_0x3847('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 5fa8fa2..90e7305 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xb43b,0x1b2));var _0xbb43=function(_0x29475f,_0x39e8e9){_0x29475f=_0x29475f-0x0;var _0x5411cb=_0xb43b[_0x29475f];return _0x5411cb;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x489be2,_0x7e8134){var _0x3f3711=function(_0x29c6e7){while(--_0x29c6e7){_0x489be2['push'](_0x489be2['shift']());}};_0x3f3711(++_0x7e8134);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x00bb[_0x5b644e];return _0x49c6bf;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8014a2b..081c4be 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf76=['eml-format','zip-dir','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','where','VIRTUAL','merge','options','MailTransferReport','includeAll','include','findAll','rows','params','find','catch','create','body','describe'];(function(_0x1a723e,_0x25b9af){var _0x3958d6=function(_0x344f1a){while(--_0x344f1a){_0x1a723e['push'](_0x1a723e['shift']());}};_0x3958d6(++_0x25b9af);}(_0xcf76,0xd8));var _0x6cf7=function(_0x163864,_0x5e48ef){_0x163864=_0x163864-0x0;var _0x3e1c19=_0xcf76[_0x163864];return _0x3e1c19;};'use strict';var emlformat=require(_0x6cf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cf7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6cf7('0x2'));var BPromise=require(_0x6cf7('0x3'));var Mustache=require('mustache');var util=require(_0x6cf7('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cf7('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cf7('0x6'));var squel=require(_0x6cf7('0x7'));var crypto=require(_0x6cf7('0x8'));var jsforce=require(_0x6cf7('0x9'));var deskjs=require(_0x6cf7('0xa'));var toCsv=require(_0x6cf7('0xb'));var querystring=require(_0x6cf7('0xc'));var Papa=require('papaparse');var Redis=require(_0x6cf7('0xd'));var authService=require(_0x6cf7('0xe'));var qs=require(_0x6cf7('0xf'));var as=require(_0x6cf7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6cf7('0x11'))(_0x6cf7('0x12'));var utils=require(_0x6cf7('0x13'));var config=require(_0x6cf7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cf7('0x15'))['db'];function respondWithStatusCode(_0x97dbde,_0x5841a2){_0x5841a2=_0x5841a2||0xcc;return function(_0xa7d2a2){if(_0xa7d2a2){return _0x97dbde[_0x6cf7('0x16')](_0x5841a2);}return _0x97dbde['status'](_0x5841a2)[_0x6cf7('0x17')]();};}function respondWithResult(_0x50b98a,_0x49e699){_0x49e699=_0x49e699||0xc8;return function(_0x570fda){if(_0x570fda){return _0x50b98a['status'](_0x49e699)[_0x6cf7('0x18')](_0x570fda);}};}function respondWithFilteredResult(_0x486794,_0x207dc5){return function(_0x27a37d){if(_0x27a37d){var _0xa9ee72=typeof _0x207dc5[_0x6cf7('0x19')]===_0x6cf7('0x1a')&&typeof _0x207dc5[_0x6cf7('0x1b')]===_0x6cf7('0x1a');var _0x1ec936=_0x27a37d[_0x6cf7('0x1c')];var _0x5a91ae=_0xa9ee72?0x0:_0x207dc5[_0x6cf7('0x19')];var _0x3f73ce=_0xa9ee72?_0x27a37d[_0x6cf7('0x1c')]:_0x207dc5[_0x6cf7('0x19')]+_0x207dc5[_0x6cf7('0x1b')];var _0x22b70a;if(_0x3f73ce>=_0x1ec936){_0x3f73ce=_0x1ec936;_0x22b70a=0xc8;}else{_0x22b70a=0xce;}_0x486794['status'](_0x22b70a);return _0x486794[_0x6cf7('0x1d')](_0x6cf7('0x1e'),_0x5a91ae+'-'+_0x3f73ce+'/'+_0x1ec936)['json'](_0x27a37d);}return null;};}function patchUpdates(_0x190cf8){return function(_0x379b0c){try{jsonpatch[_0x6cf7('0x1f')](_0x379b0c,_0x190cf8,!![]);}catch(_0x33667f){return BPromise[_0x6cf7('0x20')](_0x33667f);}return _0x379b0c[_0x6cf7('0x21')]();};}function saveUpdates(_0x1e533b,_0x361201){return function(_0x88c5c7){if(_0x88c5c7){return _0x88c5c7[_0x6cf7('0x22')](_0x1e533b)[_0x6cf7('0x23')](function(_0x13d603){return _0x13d603;});}return null;};}function removeEntity(_0x30f97c,_0x1c2da0){return function(_0x2c4c85){if(_0x2c4c85){return _0x2c4c85[_0x6cf7('0x24')]()[_0x6cf7('0x23')](function(){_0x30f97c[_0x6cf7('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3623ce,_0x5c07db){return function(_0x3ac266){if(!_0x3ac266){_0x3623ce['sendStatus'](0x194);}return _0x3ac266;};}function handleError(_0x259fd9,_0x2c1346){_0x2c1346=_0x2c1346||0x1f4;return function(_0x9f5151){logger['error'](_0x9f5151[_0x6cf7('0x26')]);if(_0x9f5151[_0x6cf7('0x27')]){delete _0x9f5151[_0x6cf7('0x27')];}_0x259fd9[_0x6cf7('0x25')](_0x2c1346)[_0x6cf7('0x28')](_0x9f5151);};}exports[_0x6cf7('0x29')]=function(_0x87d2d,_0x4dcf00){var _0x201071={},_0x334b7e={},_0x51ba47={'count':0x0,'rows':[]};var _0x560ebb=_[_0x6cf7('0x2a')](db['MailTransferReport'][_0x6cf7('0x2b')],function(_0x449847){return{'name':_0x449847['fieldName'],'type':_0x449847[_0x6cf7('0x2c')]['key']};});_0x334b7e[_0x6cf7('0x2d')]=_[_0x6cf7('0x2a')](_0x560ebb,'name');_0x334b7e[_0x6cf7('0x2e')]=_[_0x6cf7('0x2f')](_0x87d2d[_0x6cf7('0x2e')]);_0x334b7e[_0x6cf7('0x30')]=_[_0x6cf7('0x31')](_0x334b7e[_0x6cf7('0x2d')],_0x334b7e[_0x6cf7('0x2e')]);_0x201071['attributes']=_['intersection'](_0x334b7e[_0x6cf7('0x2d')],qs[_0x6cf7('0x32')](_0x87d2d['query'][_0x6cf7('0x32')]));_0x201071[_0x6cf7('0x33')]=_0x201071['attributes'][_0x6cf7('0x34')]?_0x201071[_0x6cf7('0x33')]:_0x334b7e[_0x6cf7('0x2d')];if(!_0x87d2d[_0x6cf7('0x2e')][_0x6cf7('0x35')](_0x6cf7('0x36'))){_0x201071[_0x6cf7('0x1b')]=qs[_0x6cf7('0x1b')](_0x87d2d['query'][_0x6cf7('0x1b')]);_0x201071[_0x6cf7('0x19')]=qs['offset'](_0x87d2d['query'][_0x6cf7('0x19')]);}_0x201071['order']=qs['sort'](_0x87d2d[_0x6cf7('0x2e')]['sort']);_0x201071['where']=qs['filters'](_[_0x6cf7('0x37')](_0x87d2d['query'],_0x334b7e[_0x6cf7('0x30')]),_0x560ebb);if(_0x87d2d['query'][_0x6cf7('0x38')]){_0x201071[_0x6cf7('0x39')]=_['merge'](_0x201071[_0x6cf7('0x39')],{'$or':_['map'](_0x560ebb,function(_0x3a4088){if(_0x3a4088[_0x6cf7('0x2c')]!==_0x6cf7('0x3a')){var _0xcc25ef={};_0xcc25ef[_0x3a4088[_0x6cf7('0x27')]]={'$like':'%'+_0x87d2d[_0x6cf7('0x2e')][_0x6cf7('0x38')]+'%'};return _0xcc25ef;}})});}_0x201071=_[_0x6cf7('0x3b')]({},_0x201071,_0x87d2d[_0x6cf7('0x3c')]);var _0x469f0a={'where':_0x201071[_0x6cf7('0x39')]};return db[_0x6cf7('0x3d')]['count'](_0x469f0a)[_0x6cf7('0x23')](function(_0x58c4b9){_0x51ba47[_0x6cf7('0x1c')]=_0x58c4b9;if(_0x87d2d['query'][_0x6cf7('0x3e')]){_0x201071[_0x6cf7('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0x6cf7('0x40')](_0x201071);})[_0x6cf7('0x23')](function(_0x4a6623){_0x51ba47[_0x6cf7('0x41')]=_0x4a6623;return _0x51ba47;})[_0x6cf7('0x23')](respondWithFilteredResult(_0x4dcf00,_0x201071))['catch'](handleError(_0x4dcf00,null));};exports['show']=function(_0x5ad5fd,_0x23c7e5){var _0x4cd8f9={'raw':!![],'where':{'id':_0x5ad5fd[_0x6cf7('0x42')]['id']}},_0x329767={};_0x329767[_0x6cf7('0x2d')]=_[_0x6cf7('0x2f')](db[_0x6cf7('0x3d')][_0x6cf7('0x2b')]);_0x329767['query']=_[_0x6cf7('0x2f')](_0x5ad5fd[_0x6cf7('0x2e')]);_0x329767['filters']=_[_0x6cf7('0x31')](_0x329767[_0x6cf7('0x2d')],_0x329767['query']);_0x4cd8f9[_0x6cf7('0x33')]=_[_0x6cf7('0x31')](_0x329767['model'],qs[_0x6cf7('0x32')](_0x5ad5fd[_0x6cf7('0x2e')][_0x6cf7('0x32')]));_0x4cd8f9['attributes']=_0x4cd8f9[_0x6cf7('0x33')][_0x6cf7('0x34')]?_0x4cd8f9['attributes']:_0x329767[_0x6cf7('0x2d')];if(_0x5ad5fd[_0x6cf7('0x2e')][_0x6cf7('0x3e')]){_0x4cd8f9[_0x6cf7('0x3f')]=[{'all':!![]}];}_0x4cd8f9=_[_0x6cf7('0x3b')]({},_0x4cd8f9,_0x5ad5fd['options']);return db[_0x6cf7('0x3d')][_0x6cf7('0x43')](_0x4cd8f9)[_0x6cf7('0x23')](handleEntityNotFound(_0x23c7e5,null))[_0x6cf7('0x23')](respondWithResult(_0x23c7e5,null))[_0x6cf7('0x44')](handleError(_0x23c7e5,null));};exports[_0x6cf7('0x45')]=function(_0x6b403b,_0x4cb82b){return db[_0x6cf7('0x3d')]['create'](_0x6b403b[_0x6cf7('0x46')],{})[_0x6cf7('0x23')](respondWithResult(_0x4cb82b,0xc9))['catch'](handleError(_0x4cb82b,null));};exports[_0x6cf7('0x22')]=function(_0x12e8cd,_0x34986b){if(_0x12e8cd['body']['id']){delete _0x12e8cd[_0x6cf7('0x46')]['id'];}return db['MailTransferReport'][_0x6cf7('0x43')]({'where':{'id':_0x12e8cd[_0x6cf7('0x42')]['id']}})['then'](handleEntityNotFound(_0x34986b,null))[_0x6cf7('0x23')](saveUpdates(_0x12e8cd[_0x6cf7('0x46')],null))[_0x6cf7('0x23')](respondWithResult(_0x34986b,null))[_0x6cf7('0x44')](handleError(_0x34986b,null));};exports[_0x6cf7('0x24')]=function(_0x4ac66f,_0x164295){return db[_0x6cf7('0x3d')][_0x6cf7('0x43')]({'where':{'id':_0x4ac66f[_0x6cf7('0x42')]['id']}})[_0x6cf7('0x23')](handleEntityNotFound(_0x164295,null))[_0x6cf7('0x23')](removeEntity(_0x164295,null))['catch'](handleError(_0x164295,null));};exports[_0x6cf7('0x47')]=function(_0x4234a6,_0x2cf71a){return db[_0x6cf7('0x3d')][_0x6cf7('0x47')]()['then'](respondWithResult(_0x2cf71a,null))[_0x6cf7('0x44')](handleError(_0x2cf71a,null));}; \ No newline at end of file +var _0xf329=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash'];(function(_0x4fa2e5,_0x549665){var _0x2f45e5=function(_0x3683ea){while(--_0x3683ea){_0x4fa2e5['push'](_0x4fa2e5['shift']());}};_0x2f45e5(++_0x549665);}(_0xf329,0xe7));var _0x9f32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf329[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f32('0x0'));var rimraf=require(_0x9f32('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f32('0x2'));var rp=require('request-promise');var moment=require(_0x9f32('0x3'));var BPromise=require(_0x9f32('0x4'));var Mustache=require(_0x9f32('0x5'));var util=require(_0x9f32('0x6'));var path=require(_0x9f32('0x7'));var sox=require(_0x9f32('0x8'));var csv=require('to-csv');var ejs=require(_0x9f32('0x9'));var fs=require('fs');var fs_extra=require(_0x9f32('0xa'));var _=require(_0x9f32('0xb'));var squel=require(_0x9f32('0xc'));var crypto=require(_0x9f32('0xd'));var jsforce=require(_0x9f32('0xe'));var deskjs=require(_0x9f32('0xf'));var toCsv=require(_0x9f32('0x10'));var querystring=require(_0x9f32('0x11'));var Papa=require('papaparse');var Redis=require(_0x9f32('0x12'));var authService=require(_0x9f32('0x13'));var qs=require(_0x9f32('0x14'));var as=require(_0x9f32('0x15'));var hardwareService=require(_0x9f32('0x16'));var logger=require(_0x9f32('0x17'))(_0x9f32('0x18'));var utils=require(_0x9f32('0x19'));var config=require(_0x9f32('0x1a'));var licenseUtil=require(_0x9f32('0x1b'));var db=require(_0x9f32('0x1c'))['db'];function respondWithStatusCode(_0x1bf9e2,_0x42bcfe){_0x42bcfe=_0x42bcfe||0xcc;return function(_0x5adb44){if(_0x5adb44){return _0x1bf9e2[_0x9f32('0x1d')](_0x42bcfe);}return _0x1bf9e2[_0x9f32('0x1e')](_0x42bcfe)['end']();};}function respondWithResult(_0x5e99ed,_0x14b93c){_0x14b93c=_0x14b93c||0xc8;return function(_0x3e06f2){if(_0x3e06f2){return _0x5e99ed['status'](_0x14b93c)[_0x9f32('0x1f')](_0x3e06f2);}};}function respondWithFilteredResult(_0x310ee8,_0xe049e){return function(_0xc5d59d){if(_0xc5d59d){var _0x47ce35=typeof _0xe049e['offset']===_0x9f32('0x20')&&typeof _0xe049e[_0x9f32('0x21')]==='undefined';var _0x545725=_0xc5d59d[_0x9f32('0x22')];var _0x3162dd=_0x47ce35?0x0:_0xe049e[_0x9f32('0x23')];var _0xf013d=_0x47ce35?_0xc5d59d['count']:_0xe049e[_0x9f32('0x23')]+_0xe049e[_0x9f32('0x21')];var _0x3564df;if(_0xf013d>=_0x545725){_0xf013d=_0x545725;_0x3564df=0xc8;}else{_0x3564df=0xce;}_0x310ee8[_0x9f32('0x1e')](_0x3564df);return _0x310ee8[_0x9f32('0x24')](_0x9f32('0x25'),_0x3162dd+'-'+_0xf013d+'/'+_0x545725)[_0x9f32('0x1f')](_0xc5d59d);}return null;};}function patchUpdates(_0x4cf154){return function(_0x1532ef){try{jsonpatch['apply'](_0x1532ef,_0x4cf154,!![]);}catch(_0x10118f){return BPromise[_0x9f32('0x26')](_0x10118f);}return _0x1532ef[_0x9f32('0x27')]();};}function saveUpdates(_0x39a2aa,_0x1975f1){return function(_0x158a57){if(_0x158a57){return _0x158a57[_0x9f32('0x28')](_0x39a2aa)[_0x9f32('0x29')](function(_0x5e0d7b){return _0x5e0d7b;});}return null;};}function removeEntity(_0x161ca0,_0x339663){return function(_0x12ecc5){if(_0x12ecc5){return _0x12ecc5['destroy']()[_0x9f32('0x29')](function(){_0x161ca0[_0x9f32('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x68c130,_0x317521){return function(_0xb95238){if(!_0xb95238){_0x68c130['sendStatus'](0x194);}return _0xb95238;};}function handleError(_0x5064d1,_0x3dcf82){_0x3dcf82=_0x3dcf82||0x1f4;return function(_0x3c9aba){logger[_0x9f32('0x2a')](_0x3c9aba[_0x9f32('0x2b')]);if(_0x3c9aba[_0x9f32('0x2c')]){delete _0x3c9aba[_0x9f32('0x2c')];}_0x5064d1['status'](_0x3dcf82)[_0x9f32('0x2d')](_0x3c9aba);};}exports[_0x9f32('0x2e')]=function(_0x108839,_0x1ebf3e){var _0xb06e1f={},_0x5d806a={},_0x232648={'count':0x0,'rows':[]};var _0x46549a=_[_0x9f32('0x2f')](db[_0x9f32('0x30')][_0x9f32('0x31')],function(_0xa98cbe){return{'name':_0xa98cbe['fieldName'],'type':_0xa98cbe[_0x9f32('0x32')][_0x9f32('0x33')]};});_0x5d806a[_0x9f32('0x34')]=_[_0x9f32('0x2f')](_0x46549a,_0x9f32('0x2c'));_0x5d806a[_0x9f32('0x35')]=_[_0x9f32('0x36')](_0x108839[_0x9f32('0x35')]);_0x5d806a[_0x9f32('0x37')]=_[_0x9f32('0x38')](_0x5d806a[_0x9f32('0x34')],_0x5d806a[_0x9f32('0x35')]);_0xb06e1f['attributes']=_[_0x9f32('0x38')](_0x5d806a[_0x9f32('0x34')],qs[_0x9f32('0x39')](_0x108839[_0x9f32('0x35')][_0x9f32('0x39')]));_0xb06e1f[_0x9f32('0x3a')]=_0xb06e1f[_0x9f32('0x3a')][_0x9f32('0x3b')]?_0xb06e1f[_0x9f32('0x3a')]:_0x5d806a['model'];if(!_0x108839[_0x9f32('0x35')][_0x9f32('0x3c')](_0x9f32('0x3d'))){_0xb06e1f[_0x9f32('0x21')]=qs[_0x9f32('0x21')](_0x108839['query'][_0x9f32('0x21')]);_0xb06e1f['offset']=qs[_0x9f32('0x23')](_0x108839[_0x9f32('0x35')][_0x9f32('0x23')]);}_0xb06e1f['order']=qs[_0x9f32('0x3e')](_0x108839['query'][_0x9f32('0x3e')]);_0xb06e1f[_0x9f32('0x3f')]=qs[_0x9f32('0x37')](_[_0x9f32('0x40')](_0x108839[_0x9f32('0x35')],_0x5d806a['filters']),_0x46549a);if(_0x108839['query'][_0x9f32('0x41')]){_0xb06e1f[_0x9f32('0x3f')]=_[_0x9f32('0x42')](_0xb06e1f[_0x9f32('0x3f')],{'$or':_[_0x9f32('0x2f')](_0x46549a,function(_0x264e55){if(_0x264e55[_0x9f32('0x32')]!==_0x9f32('0x43')){var _0x2bd2c4={};_0x2bd2c4[_0x264e55['name']]={'$like':'%'+_0x108839[_0x9f32('0x35')][_0x9f32('0x41')]+'%'};return _0x2bd2c4;}})});}_0xb06e1f=_['merge']({},_0xb06e1f,_0x108839[_0x9f32('0x44')]);var _0x2e77ca={'where':_0xb06e1f[_0x9f32('0x3f')]};return db[_0x9f32('0x30')]['count'](_0x2e77ca)[_0x9f32('0x29')](function(_0x183ddb){_0x232648['count']=_0x183ddb;if(_0x108839[_0x9f32('0x35')][_0x9f32('0x45')]){_0xb06e1f[_0x9f32('0x46')]=[{'all':!![]}];}return db[_0x9f32('0x30')][_0x9f32('0x47')](_0xb06e1f);})[_0x9f32('0x29')](function(_0x1d5f17){_0x232648[_0x9f32('0x48')]=_0x1d5f17;return _0x232648;})[_0x9f32('0x29')](respondWithFilteredResult(_0x1ebf3e,_0xb06e1f))[_0x9f32('0x49')](handleError(_0x1ebf3e,null));};exports[_0x9f32('0x4a')]=function(_0x56824a,_0x473049){var _0x284bcd={'raw':!![],'where':{'id':_0x56824a[_0x9f32('0x4b')]['id']}},_0x38830c={};_0x38830c[_0x9f32('0x34')]=_[_0x9f32('0x36')](db[_0x9f32('0x30')][_0x9f32('0x31')]);_0x38830c[_0x9f32('0x35')]=_[_0x9f32('0x36')](_0x56824a[_0x9f32('0x35')]);_0x38830c[_0x9f32('0x37')]=_[_0x9f32('0x38')](_0x38830c['model'],_0x38830c['query']);_0x284bcd['attributes']=_[_0x9f32('0x38')](_0x38830c['model'],qs[_0x9f32('0x39')](_0x56824a[_0x9f32('0x35')]['fields']));_0x284bcd[_0x9f32('0x3a')]=_0x284bcd[_0x9f32('0x3a')][_0x9f32('0x3b')]?_0x284bcd['attributes']:_0x38830c[_0x9f32('0x34')];if(_0x56824a[_0x9f32('0x35')]['includeAll']){_0x284bcd['include']=[{'all':!![]}];}_0x284bcd=_[_0x9f32('0x42')]({},_0x284bcd,_0x56824a[_0x9f32('0x44')]);return db[_0x9f32('0x30')][_0x9f32('0x4c')](_0x284bcd)[_0x9f32('0x29')](handleEntityNotFound(_0x473049,null))[_0x9f32('0x29')](respondWithResult(_0x473049,null))[_0x9f32('0x49')](handleError(_0x473049,null));};exports[_0x9f32('0x4d')]=function(_0x4270c1,_0xd63fcf){return db[_0x9f32('0x30')][_0x9f32('0x4d')](_0x4270c1[_0x9f32('0x4e')],{})[_0x9f32('0x29')](respondWithResult(_0xd63fcf,0xc9))[_0x9f32('0x49')](handleError(_0xd63fcf,null));};exports[_0x9f32('0x28')]=function(_0x56d566,_0x1c2a7d){if(_0x56d566['body']['id']){delete _0x56d566[_0x9f32('0x4e')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x56d566[_0x9f32('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1c2a7d,null))[_0x9f32('0x29')](saveUpdates(_0x56d566[_0x9f32('0x4e')],null))[_0x9f32('0x29')](respondWithResult(_0x1c2a7d,null))[_0x9f32('0x49')](handleError(_0x1c2a7d,null));};exports[_0x9f32('0x4f')]=function(_0x55b9db,_0x3a94ea){return db[_0x9f32('0x30')]['find']({'where':{'id':_0x55b9db[_0x9f32('0x4b')]['id']}})[_0x9f32('0x29')](handleEntityNotFound(_0x3a94ea,null))[_0x9f32('0x29')](removeEntity(_0x3a94ea,null))[_0x9f32('0x49')](handleError(_0x3a94ea,null));};exports[_0x9f32('0x50')]=function(_0x1001ef,_0x4a14d7){return db['MailTransferReport'][_0x9f32('0x50')]()[_0x9f32('0x29')](respondWithResult(_0x4a14d7,null))[_0x9f32('0x49')](handleError(_0x4a14d7,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 21c5cd7..3799d14 100644 --- a/server/api/mailTransferReport/mailTransferReport.model.js +++ b/server/api/mailTransferReport/mailTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc569=['moment','bluebird','path','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc569,0x159));var _0x9c56=function(_0x4ea0ee,_0xd1b8df){_0x4ea0ee=_0x4ea0ee-0x0;var _0x1c8195=_0xc569[_0x4ea0ee];return _0x1c8195;};'use strict';var _=require(_0x9c56('0x0'));var util=require(_0x9c56('0x1'));var logger=require(_0x9c56('0x2'))('api');var moment=require(_0x9c56('0x3'));var BPromise=require(_0x9c56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c56('0x5'));var rimraf=require(_0x9c56('0x6'));var config=require(_0x9c56('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x9c56('0x8')]=function(_0x2e2421,_0xe6ba11){return _0x2e2421[_0x9c56('0x9')]('MailTransferReport',attributes,{'tableName':_0x9c56('0xa'),'paranoid':![],'indexes':[{'name':_0x9c56('0xb'),'fields':[_0x9c56('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb258=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb258,0x12b));var _0x8b25=function(_0x1b6492,_0x210b03){_0x1b6492=_0x1b6492-0x0;var _0x3bae73=_0xb258[_0x1b6492];return _0x3bae73;};'use strict';var _=require(_0x8b25('0x0'));var util=require('util');var logger=require(_0x8b25('0x1'))(_0x8b25('0x2'));var moment=require('moment');var BPromise=require(_0x8b25('0x3'));var rp=require(_0x8b25('0x4'));var fs=require('fs');var path=require(_0x8b25('0x5'));var rimraf=require(_0x8b25('0x6'));var config=require(_0x8b25('0x7'));var attributes=require(_0x8b25('0x8'));module['exports']=function(_0x40d293,_0x3e10a5){return _0x40d293[_0x8b25('0x9')](_0x8b25('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x8b25('0xb'),'fields':[_0x8b25('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a4a7505..ccd67f1 100644 --- a/server/api/mailTransferReport/mailTransferReport.rpc.js +++ b/server/api/mailTransferReport/mailTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0f2=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x187290,_0x45491f){var _0x4b8f25=function(_0x5a81d6){while(--_0x5a81d6){_0x187290['push'](_0x187290['shift']());}};_0x4b8f25(++_0x45491f);}(_0xa0f2,0xfd));var _0x2a0f=function(_0x39a2b5,_0x243fc2){_0x39a2b5=_0x39a2b5-0x0;var _0x2f2b26=_0xa0f2[_0x39a2b5];return _0x2f2b26;};'use strict';var _=require(_0x2a0f('0x0'));var util=require(_0x2a0f('0x1'));var moment=require(_0x2a0f('0x2'));var BPromise=require(_0x2a0f('0x3'));var rs=require(_0x2a0f('0x4'));var fs=require('fs');var Redis=require(_0x2a0f('0x5'));var db=require(_0x2a0f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2a0f('0x7'));var jayson=require(_0x2a0f('0x8'));var client=jayson[_0x2a0f('0x9')][_0x2a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a8c4c,_0x291d31,_0x406c23){return new BPromise(function(_0x2a2f01,_0x11d619){return client[_0x2a0f('0xb')](_0x3a8c4c,_0x406c23)[_0x2a0f('0xc')](function(_0x46936d){logger[_0x2a0f('0xd')](_0x2a0f('0xe'),_0x291d31,_0x2a0f('0xf'));logger[_0x2a0f('0x10')](_0x2a0f('0x11'),_0x291d31,_0x2a0f('0xf'),JSON[_0x2a0f('0x12')](_0x46936d));if(_0x46936d[_0x2a0f('0x13')]){if(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x14')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x46936d['error'][_0x2a0f('0x15')]);return _0x11d619(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x15')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x46936d['error']['message']);return _0x2a2f01(_0x46936d[_0x2a0f('0x13')][_0x2a0f('0x15')]);}else{logger[_0x2a0f('0xd')](_0x2a0f('0xe'),_0x291d31,_0x2a0f('0xf'));_0x2a2f01(_0x46936d[_0x2a0f('0x16')][_0x2a0f('0x15')]);}})[_0x2a0f('0x17')](function(_0x1a6267){logger[_0x2a0f('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x291d31,_0x1a6267);_0x11d619(_0x1a6267);});});} \ No newline at end of file +var _0xb5ea=['jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x30f79c,_0x247675){var _0x60b781=function(_0x5057af){while(--_0x5057af){_0x30f79c['push'](_0x30f79c['shift']());}};_0x60b781(++_0x247675);}(_0xb5ea,0x1aa));var _0xab5e=function(_0xe4c0bd,_0x36e708){_0xe4c0bd=_0xe4c0bd-0x0;var _0x169243=_0xb5ea[_0xe4c0bd];return _0x169243;};'use strict';var _=require(_0xab5e('0x0'));var util=require(_0xab5e('0x1'));var moment=require(_0xab5e('0x2'));var BPromise=require(_0xab5e('0x3'));var rs=require(_0xab5e('0x4'));var fs=require('fs');var Redis=require(_0xab5e('0x5'));var db=require(_0xab5e('0x6'))['db'];var utils=require(_0xab5e('0x7'));var logger=require(_0xab5e('0x8'))(_0xab5e('0x9'));var config=require(_0xab5e('0xa'));var jayson=require(_0xab5e('0xb'));var client=jayson['client'][_0xab5e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x388b21,_0xf71a22,_0xbc521b){return new BPromise(function(_0x5d5c41,_0x26910d){return client['request'](_0x388b21,_0xbc521b)[_0xab5e('0xd')](function(_0x2ac6a9){logger[_0xab5e('0xe')](_0xab5e('0xf'),_0xf71a22,_0xab5e('0x10'));logger[_0xab5e('0x11')](_0xab5e('0x12'),_0xf71a22,'request\x20sent',JSON['stringify'](_0x2ac6a9));if(_0x2ac6a9['error']){if(_0x2ac6a9[_0xab5e('0x13')]['code']===0x1f4){logger[_0xab5e('0x13')](_0xab5e('0xf'),_0xf71a22,_0x2ac6a9[_0xab5e('0x13')][_0xab5e('0x14')]);return _0x26910d(_0x2ac6a9[_0xab5e('0x13')][_0xab5e('0x14')]);}logger[_0xab5e('0x13')](_0xab5e('0xf'),_0xf71a22,_0x2ac6a9[_0xab5e('0x13')][_0xab5e('0x14')]);return _0x5d5c41(_0x2ac6a9[_0xab5e('0x13')][_0xab5e('0x14')]);}else{logger[_0xab5e('0xe')](_0xab5e('0xf'),_0xf71a22,_0xab5e('0x10'));_0x5d5c41(_0x2ac6a9[_0xab5e('0x15')][_0xab5e('0x14')]);}})[_0xab5e('0x16')](function(_0x16a079){logger['error'](_0xab5e('0xf'),_0xf71a22,_0x16a079);_0x26910d(_0x16a079);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 04a2666..7ed04d1 100644 --- a/server/api/memberReport/index.js +++ b/server/api/memberReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe88a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','show','post','create','put','/:id','update','delete','exports','multer','path'];(function(_0x235f7f,_0x4cc112){var _0x3bf31e=function(_0x618236){while(--_0x618236){_0x235f7f['push'](_0x235f7f['shift']());}};_0x3bf31e(++_0x4cc112);}(_0xe88a,0xb2));var _0xae88=function(_0x46f3a9,_0x21030c){_0x46f3a9=_0x46f3a9-0x0;var _0x46126d=_0xe88a[_0x46f3a9];return _0x46126d;};'use strict';var multer=require(_0xae88('0x0'));var util=require('util');var path=require(_0xae88('0x1'));var timeout=require(_0xae88('0x2'));var express=require('express');var router=express[_0xae88('0x3')]();var fs_extra=require(_0xae88('0x4'));var auth=require(_0xae88('0x5'));var interaction=require(_0xae88('0x6'));var config=require(_0xae88('0x7'));var controller=require(_0xae88('0x8'));router[_0xae88('0x9')]('/',auth[_0xae88('0xa')](),controller['index']);router[_0xae88('0x9')](_0xae88('0xb'),auth[_0xae88('0xa')](),controller['describe']);router['get']('/:id',auth[_0xae88('0xa')](),controller[_0xae88('0xc')]);router[_0xae88('0xd')]('/',auth['isAuthenticated'](),controller[_0xae88('0xe')]);router[_0xae88('0xf')](_0xae88('0x10'),auth[_0xae88('0xa')](),controller[_0xae88('0x11')]);router[_0xae88('0x12')]('/:id',auth[_0xae88('0xa')](),controller['destroy']);module[_0xae88('0x13')]=router; \ No newline at end of file +var _0x5aff=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x5aff,0xc2));var _0xf5af=function(_0x234784,_0x8f1d8f){_0x234784=_0x234784-0x0;var _0x3969e4=_0x5aff[_0x234784];return _0x3969e4;};'use strict';var multer=require(_0xf5af('0x0'));var util=require(_0xf5af('0x1'));var path=require(_0xf5af('0x2'));var timeout=require(_0xf5af('0x3'));var express=require(_0xf5af('0x4'));var router=express['Router']();var fs_extra=require(_0xf5af('0x5'));var auth=require(_0xf5af('0x6'));var interaction=require(_0xf5af('0x7'));var config=require(_0xf5af('0x8'));var controller=require(_0xf5af('0x9'));router[_0xf5af('0xa')]('/',auth[_0xf5af('0xb')](),controller[_0xf5af('0xc')]);router[_0xf5af('0xa')](_0xf5af('0xd'),auth['isAuthenticated'](),controller[_0xf5af('0xe')]);router[_0xf5af('0xa')](_0xf5af('0xf'),auth[_0xf5af('0xb')](),controller['show']);router['post']('/',auth[_0xf5af('0xb')](),controller[_0xf5af('0x10')]);router[_0xf5af('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf5af('0x12')](_0xf5af('0xf'),auth[_0xf5af('0xb')](),controller[_0xf5af('0x13')]);module[_0xf5af('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index f153d8e..94cf1f5 100644 --- a/server/api/memberReport/memberReport.attributes.js +++ b/server/api/memberReport/memberReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1298=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0x1298,0xb6));var _0x8129=function(_0x17e2c3,_0x34c7e8){_0x17e2c3=_0x17e2c3-0x0;var _0xe89998=_0x1298[_0x17e2c3];return _0xe89998;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x8129('0x0')]},'membername':{'type':Sequelize[_0x8129('0x0')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8129('0x0')],'defaultValue':_0x8129('0x1'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x8129('0x2')]},'enterAt':{'type':Sequelize[_0x8129('0x3')]},'exitAt':{'type':Sequelize[_0x8129('0x3')],'set':function(_0x43725a){var _0x88593d=moment(_0x43725a);var _0x3e81da=moment(this[_0x8129('0x4')](_0x8129('0x5')));var _0x17a578=_0x88593d[_0x8129('0x6')](_0x3e81da,'seconds');this[_0x8129('0x7')](_0x8129('0x8'),_0x43725a);this[_0x8129('0x7')]('duration',_0x17a578>=0x0?_0x17a578:null);}},'data1':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0x9')},'data2':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xa')},'data3':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xb')},'data4':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xc')},'data5':{'type':Sequelize[_0x8129('0x0')],'comment':_0x8129('0xd')},'role':{'type':Sequelize[_0x8129('0x0')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8129('0x0')]}}; \ No newline at end of file +var _0x0d5b=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x0d5b,0x172));var _0xb0d5=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x0d5b[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require(_0xb0d5('0x0'));var moment=require(_0xb0d5('0x1'));module[_0xb0d5('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb0d5('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb0d5('0x3')],'defaultValue':_0xb0d5('0x4'),'comment':_0xb0d5('0x5')},'duration':{'type':Sequelize[_0xb0d5('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb0d5('0x7')],'set':function(_0x5e4592){var _0x1c0056=moment(_0x5e4592);var _0x100189=moment(this[_0xb0d5('0x8')](_0xb0d5('0x9')));var _0x760d50=_0x1c0056['diff'](_0x100189,_0xb0d5('0xa'));this[_0xb0d5('0xb')](_0xb0d5('0xc'),_0x5e4592);this[_0xb0d5('0xb')]('duration',_0x760d50>=0x0?_0x760d50:null);}},'data1':{'type':Sequelize[_0xb0d5('0x3')],'comment':_0xb0d5('0xd')},'data2':{'type':Sequelize[_0xb0d5('0x3')],'comment':_0xb0d5('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0xb0d5('0xf')},'data4':{'type':Sequelize[_0xb0d5('0x3')],'comment':_0xb0d5('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xb0d5('0x6')]},'uniqueid':{'type':Sequelize[_0xb0d5('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c29904a..78bdc51 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4702ce,_0x576524){_0x4702ce=_0x4702ce-0x0;var _0x3d1f4c=_0xedd9[_0x4702ce];return _0x3d1f4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x34e8,0x12c));var _0x834e=function(_0x4b51da,_0x3bd78d){_0x4b51da=_0x4b51da-0x0;var _0x5cf588=_0x34e8[_0x4b51da];return _0x5cf588;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 69592f5..844bd56 100644 --- a/server/api/memberReport/memberReport.model.js +++ b/server/api/memberReport/memberReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc754=['interface','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','MemberReport','membername'];(function(_0x5591a2,_0x5a0810){var _0x3a1472=function(_0x3ae0c2){while(--_0x3ae0c2){_0x5591a2['push'](_0x5591a2['shift']());}};_0x3a1472(++_0x5a0810);}(_0xc754,0x1e2));var _0x4c75=function(_0x262500,_0x521df7){_0x262500=_0x262500-0x0;var _0xcb154f=_0xc754[_0x262500];return _0xcb154f;};'use strict';var _=require(_0x4c75('0x0'));var util=require(_0x4c75('0x1'));var logger=require(_0x4c75('0x2'))(_0x4c75('0x3'));var moment=require(_0x4c75('0x4'));var BPromise=require(_0x4c75('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4c75('0x6'));var config=require(_0x4c75('0x7'));var attributes=require('./memberReport.attributes');module[_0x4c75('0x8')]=function(_0x526a85,_0x190111){return _0x526a85[_0x4c75('0x9')](_0x4c75('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x4c75('0xb'),_0x4c75('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeac9=['./memberReport.attributes','exports','MemberReport','membername_interface','interface','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x4e1908,_0x19ff78){var _0x34e746=function(_0x524ec1){while(--_0x524ec1){_0x4e1908['push'](_0x4e1908['shift']());}};_0x34e746(++_0x19ff78);}(_0xeac9,0xae));var _0x9eac=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xeac9[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x9eac('0x0'));var util=require(_0x9eac('0x1'));var logger=require(_0x9eac('0x2'))(_0x9eac('0x3'));var moment=require(_0x9eac('0x4'));var BPromise=require(_0x9eac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eac('0x6'));var rimraf=require('rimraf');var config=require(_0x9eac('0x7'));var attributes=require(_0x9eac('0x8'));module[_0x9eac('0x9')]=function(_0x55f912,_0x1397bc){return _0x55f912['define'](_0x9eac('0xa'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x9eac('0xb'),'fields':['membername',_0x9eac('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 2e0c2d9..2ce2b09 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29af=['code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','update','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x9033ca,_0x12aaec){var _0x13edb6=function(_0x2f7f9d){while(--_0x2f7f9d){_0x9033ca['push'](_0x9033ca['shift']());}};_0x13edb6(++_0x12aaec);}(_0x29af,0x134));var _0xf29a=function(_0x44d116,_0x4932bc){_0x44d116=_0x44d116-0x0;var _0x142e09=_0x29af[_0x44d116];return _0x142e09;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var moment=require(_0xf29a('0x2'));var BPromise=require('bluebird');var rs=require(_0xf29a('0x3'));var fs=require('fs');var Redis=require(_0xf29a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29a('0x5'));var logger=require('../../config/logger')(_0xf29a('0x6'));var config=require(_0xf29a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf29a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c111b,_0x47749d,_0x33a308){return new BPromise(function(_0x347d76,_0x4393dc){return client['request'](_0x2c111b,_0x33a308)[_0xf29a('0x9')](function(_0x145dbb){logger[_0xf29a('0xa')]('MemberReport,\x20%s,\x20%s',_0x47749d,'request\x20sent');logger[_0xf29a('0xb')](_0xf29a('0xc'),_0x47749d,_0xf29a('0xd'),JSON[_0xf29a('0xe')](_0x145dbb));if(_0x145dbb[_0xf29a('0xf')]){if(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x10')]===0x1f4){logger['error'](_0xf29a('0x11'),_0x47749d,_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);return _0x4393dc(_0x145dbb[_0xf29a('0xf')][_0xf29a('0x12')]);}logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x145dbb['error']['message']);return _0x347d76(_0x145dbb['error'][_0xf29a('0x12')]);}else{logger[_0xf29a('0xa')](_0xf29a('0x11'),_0x47749d,_0xf29a('0xd'));_0x347d76(_0x145dbb[_0xf29a('0x13')]['message']);}})[_0xf29a('0x14')](function(_0x42567e){logger[_0xf29a('0xf')](_0xf29a('0x11'),_0x47749d,_0x42567e);_0x4393dc(_0x42567e);});});}exports[_0xf29a('0x15')]=function(_0xd4ca39){var _0x19e886=this;return new Promise(function(_0x296829,_0x3f9da8){return db[_0xf29a('0x16')]['findAll']({'raw':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x18')]||null:null,'attributes':_0xd4ca39['options']?_0xd4ca39[_0xf29a('0x17')]['attributes']||null:null,'limit':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x19')]||null:null,'include':_0xd4ca39[_0xf29a('0x17')]?_0xd4ca39['options'][_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0xd4ca39[_0xf29a('0x17')][_0xf29a('0x1a')],function(_0x35af39){return{'model':db[_0x35af39[_0xf29a('0x1c')]],'as':_0x35af39['as'],'attributes':_0x35af39[_0xf29a('0x1d')],'include':_0x35af39['include']?_['map'](_0x35af39['include'],function(_0x262a5f){return{'model':db[_0x262a5f['model']],'as':_0x262a5f['as'],'attributes':_0x262a5f[_0xf29a('0x1d')],'include':_0x262a5f[_0xf29a('0x1a')]?_[_0xf29a('0x1b')](_0x262a5f['include'],function(_0x181c3a){return{'model':db[_0x181c3a[_0xf29a('0x1c')]],'as':_0x181c3a['as'],'attributes':_0x181c3a[_0xf29a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf29a('0x9')](function(_0x11d1a6){logger[_0xf29a('0xa')]('GetMemberReport',_0xd4ca39);logger[_0xf29a('0xb')](_0xf29a('0x15'),_0xd4ca39,JSON['stringify'](_0x11d1a6));_0x296829(_0x11d1a6);})['catch'](function(_0x4fdd1b){logger[_0xf29a('0xf')](_0xf29a('0x15'),_0x4fdd1b[_0xf29a('0x12')],_0xd4ca39);_0x3f9da8(_0x19e886[_0xf29a('0xf')](0x1f4,_0x4fdd1b[_0xf29a('0x12')]));});});};exports[_0xf29a('0x1e')]=function(_0x694c05){var _0x50b221=this;return new Promise(function(_0x2b10d1,_0x3e31c3){return db[_0xf29a('0x16')][_0xf29a('0x1f')](_0x694c05[_0xf29a('0x20')],{'raw':_0x694c05[_0xf29a('0x17')]?_0x694c05[_0xf29a('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xf29a('0x9')](function(_0x566b1d){logger[_0xf29a('0xa')](_0xf29a('0x1e'),_0x694c05);logger[_0xf29a('0xb')](_0xf29a('0x1e'),_0x694c05,JSON[_0xf29a('0xe')](_0x566b1d));_0x2b10d1(_0x566b1d);})['catch'](function(_0x12110d){logger['error'](_0xf29a('0x1e'),_0x12110d[_0xf29a('0x12')],_0x694c05);_0x3e31c3(_0x50b221['error'](0x1f4,_0x12110d[_0xf29a('0x12')]));});});};exports[_0xf29a('0x21')]=function(_0x5b1834){var _0x13b011=this;return new Promise(function(_0x399698,_0x422cd8){return db[_0xf29a('0x16')][_0xf29a('0x22')](_0x5b1834[_0xf29a('0x20')],{'raw':_0x5b1834['options']?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b1834[_0xf29a('0x17')]?_0x5b1834['options'][_0xf29a('0x18')]||null:null,'attributes':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x1d')]||null:null,'limit':_0x5b1834[_0xf29a('0x17')]?_0x5b1834[_0xf29a('0x17')][_0xf29a('0x19')]||null:null})[_0xf29a('0x9')](function(_0x1fde1e){logger[_0xf29a('0xa')](_0xf29a('0x21'),_0x5b1834);logger[_0xf29a('0xb')]('UpdateMemberReport',_0x5b1834,JSON['stringify'](_0x1fde1e));_0x399698(_0x1fde1e);})[_0xf29a('0x14')](function(_0x1650a7){logger[_0xf29a('0xf')]('UpdateMemberReport',_0x1650a7[_0xf29a('0x12')],_0x5b1834);_0x422cd8(_0x13b011[_0xf29a('0xf')](0x1f4,_0x1650a7[_0xf29a('0x12')]));});});}; \ No newline at end of file +var _0xb3d8=['message','result','catch','GetMemberReport','findAll','options','attributes','limit','include','map','model','stringify','CreateMemberReport','MemberReport','create','body','raw','UpdateMemberReport','update','where','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xb3d8,0xdc));var _0x8b3d=function(_0x3b6fc9,_0x2cf890){_0x3b6fc9=_0x3b6fc9-0x0;var _0x45377e=_0xb3d8[_0x3b6fc9];return _0x45377e;};'use strict';var _=require('lodash');var util=require(_0x8b3d('0x0'));var moment=require(_0x8b3d('0x1'));var BPromise=require(_0x8b3d('0x2'));var rs=require(_0x8b3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8b3d('0x4'));var logger=require(_0x8b3d('0x5'))(_0x8b3d('0x6'));var config=require(_0x8b3d('0x7'));var jayson=require(_0x8b3d('0x8'));var client=jayson[_0x8b3d('0x9')][_0x8b3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4447a2,_0x7ddf10,_0x5d3aeb){return new BPromise(function(_0x278a75,_0x2fef94){return client[_0x8b3d('0xb')](_0x4447a2,_0x5d3aeb)[_0x8b3d('0xc')](function(_0x375fa7){logger[_0x8b3d('0xd')](_0x8b3d('0xe'),_0x7ddf10,_0x8b3d('0xf'));logger[_0x8b3d('0x10')](_0x8b3d('0x11'),_0x7ddf10,'request\x20sent',JSON['stringify'](_0x375fa7));if(_0x375fa7[_0x8b3d('0x12')]){if(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x13')]===0x1f4){logger[_0x8b3d('0x12')](_0x8b3d('0xe'),_0x7ddf10,_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);return _0x2fef94(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);}logger[_0x8b3d('0x12')](_0x8b3d('0xe'),_0x7ddf10,_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);return _0x278a75(_0x375fa7[_0x8b3d('0x12')][_0x8b3d('0x14')]);}else{logger[_0x8b3d('0xd')]('MemberReport,\x20%s,\x20%s',_0x7ddf10,_0x8b3d('0xf'));_0x278a75(_0x375fa7[_0x8b3d('0x15')]['message']);}})[_0x8b3d('0x16')](function(_0x1652e7){logger['error'](_0x8b3d('0xe'),_0x7ddf10,_0x1652e7);_0x2fef94(_0x1652e7);});});}exports[_0x8b3d('0x17')]=function(_0xcc9b46){var _0x3d733e=this;return new Promise(function(_0x1d96ae,_0x5bff55){return db['MemberReport'][_0x8b3d('0x18')]({'raw':_0xcc9b46['options']?_0xcc9b46['options']['raw']===undefined?!![]:![]:!![],'where':_0xcc9b46[_0x8b3d('0x19')]?_0xcc9b46[_0x8b3d('0x19')]['where']||null:null,'attributes':_0xcc9b46[_0x8b3d('0x19')]?_0xcc9b46[_0x8b3d('0x19')][_0x8b3d('0x1a')]||null:null,'limit':_0xcc9b46[_0x8b3d('0x19')]?_0xcc9b46[_0x8b3d('0x19')][_0x8b3d('0x1b')]||null:null,'include':_0xcc9b46[_0x8b3d('0x19')]?_0xcc9b46[_0x8b3d('0x19')][_0x8b3d('0x1c')]?_[_0x8b3d('0x1d')](_0xcc9b46[_0x8b3d('0x19')]['include'],function(_0x37c98e){return{'model':db[_0x37c98e['model']],'as':_0x37c98e['as'],'attributes':_0x37c98e[_0x8b3d('0x1a')],'include':_0x37c98e[_0x8b3d('0x1c')]?_[_0x8b3d('0x1d')](_0x37c98e[_0x8b3d('0x1c')],function(_0x57fe10){return{'model':db[_0x57fe10[_0x8b3d('0x1e')]],'as':_0x57fe10['as'],'attributes':_0x57fe10['attributes'],'include':_0x57fe10['include']?_[_0x8b3d('0x1d')](_0x57fe10['include'],function(_0x4eefbf){return{'model':db[_0x4eefbf[_0x8b3d('0x1e')]],'as':_0x4eefbf['as'],'attributes':_0x4eefbf[_0x8b3d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5901f4){logger[_0x8b3d('0xd')](_0x8b3d('0x17'),_0xcc9b46);logger[_0x8b3d('0x10')](_0x8b3d('0x17'),_0xcc9b46,JSON[_0x8b3d('0x1f')](_0x5901f4));_0x1d96ae(_0x5901f4);})['catch'](function(_0x261070){logger[_0x8b3d('0x12')](_0x8b3d('0x17'),_0x261070[_0x8b3d('0x14')],_0xcc9b46);_0x5bff55(_0x3d733e[_0x8b3d('0x12')](0x1f4,_0x261070['message']));});});};exports[_0x8b3d('0x20')]=function(_0x3dae7e){var _0x20bc19=this;return new Promise(function(_0x36a125,_0x5cd208){return db[_0x8b3d('0x21')][_0x8b3d('0x22')](_0x3dae7e[_0x8b3d('0x23')],{'raw':_0x3dae7e['options']?_0x3dae7e[_0x8b3d('0x19')][_0x8b3d('0x24')]===undefined?!![]:![]:!![]})[_0x8b3d('0xc')](function(_0x56d27e){logger['info'](_0x8b3d('0x20'),_0x3dae7e);logger[_0x8b3d('0x10')](_0x8b3d('0x20'),_0x3dae7e,JSON[_0x8b3d('0x1f')](_0x56d27e));_0x36a125(_0x56d27e);})[_0x8b3d('0x16')](function(_0x35b1de){logger[_0x8b3d('0x12')]('CreateMemberReport',_0x35b1de[_0x8b3d('0x14')],_0x3dae7e);_0x5cd208(_0x20bc19[_0x8b3d('0x12')](0x1f4,_0x35b1de[_0x8b3d('0x14')]));});});};exports[_0x8b3d('0x25')]=function(_0x17d789){var _0x2846b6=this;return new Promise(function(_0x1dfce0,_0x69dc23){return db[_0x8b3d('0x21')][_0x8b3d('0x26')](_0x17d789[_0x8b3d('0x23')],{'raw':_0x17d789[_0x8b3d('0x19')]?_0x17d789[_0x8b3d('0x19')][_0x8b3d('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17d789[_0x8b3d('0x19')]?_0x17d789[_0x8b3d('0x19')][_0x8b3d('0x27')]||null:null,'attributes':_0x17d789['options']?_0x17d789['options'][_0x8b3d('0x1a')]||null:null,'limit':_0x17d789['options']?_0x17d789[_0x8b3d('0x19')][_0x8b3d('0x1b')]||null:null})[_0x8b3d('0xc')](function(_0x5e4a08){logger['info'](_0x8b3d('0x25'),_0x17d789);logger[_0x8b3d('0x10')](_0x8b3d('0x25'),_0x17d789,JSON['stringify'](_0x5e4a08));_0x1dfce0(_0x5e4a08);})['catch'](function(_0x514375){logger[_0x8b3d('0x12')](_0x8b3d('0x25'),_0x514375['message'],_0x17d789);_0x69dc23(_0x2846b6['error'](0x1f4,_0x514375['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2a7f07b..63a35ea 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c24=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x7c24,0x186));var _0x47c2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7c24[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var path=require(_0x47c2('0x2'));var timeout=require(_0x47c2('0x3'));var express=require('express');var router=express[_0x47c2('0x4')]();var fs_extra=require(_0x47c2('0x5'));var auth=require(_0x47c2('0x6'));var interaction=require(_0x47c2('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x47c2('0x8')]('/',controller[_0x47c2('0x9')]);module['exports']=router; \ No newline at end of file +var _0xedc1=['express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path','connect-timeout'];(function(_0x37b6fc,_0x85253){var _0x20c989=function(_0x50bcbd){while(--_0x50bcbd){_0x37b6fc['push'](_0x37b6fc['shift']());}};_0x20c989(++_0x85253);}(_0xedc1,0x158));var _0x1edc=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xedc1[_0x22431e];return _0xd978e9;};'use strict';var multer=require(_0x1edc('0x0'));var util=require(_0x1edc('0x1'));var path=require(_0x1edc('0x2'));var timeout=require(_0x1edc('0x3'));var express=require(_0x1edc('0x4'));var router=express[_0x1edc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1edc('0x6'));var interaction=require(_0x1edc('0x7'));var config=require('../../config/environment');var controller=require(_0x1edc('0x8'));router[_0x1edc('0x9')]('/',controller[_0x1edc('0xa')]);module[_0x1edc('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 6c38901..987c7d5 100644 --- a/server/api/migration/migration.attributes.js +++ b/server/api/migration/migration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c6a=['version','exports','STRING'];(function(_0x32328d,_0x290434){var _0x317092=function(_0x2ec2d5){while(--_0x2ec2d5){_0x32328d['push'](_0x32328d['shift']());}};_0x317092(++_0x290434);}(_0x1c6a,0x154));var _0xa1c6=function(_0x5e24d7,_0x11218f){_0x5e24d7=_0x5e24d7-0x0;var _0x10063d=_0x1c6a[_0x5e24d7];return _0x10063d;};'use strict';var Sequelize=require('sequelize');module[_0xa1c6('0x0')]={'version':{'type':Sequelize[_0xa1c6('0x1')],'unique':_0xa1c6('0x2')}}; \ No newline at end of file +var _0xbc9a=['version','sequelize','exports'];(function(_0x292da1,_0x9ee590){var _0x471053=function(_0x5d65d1){while(--_0x5d65d1){_0x292da1['push'](_0x292da1['shift']());}};_0x471053(++_0x9ee590);}(_0xbc9a,0x1e4));var _0xabc9=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0xbc9a[_0x21ba7d];return _0x1445b6;};'use strict';var Sequelize=require(_0xabc9('0x0'));module[_0xabc9('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xabc9('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8856692..27ebcde 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc7=['eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','Migration','rawAttributes','type','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch'];(function(_0x52cbb2,_0x53c30c){var _0x11ec1e=function(_0x56d57e){while(--_0x56d57e){_0x52cbb2['push'](_0x52cbb2['shift']());}};_0x11ec1e(++_0x53c30c);}(_0x4bc7,0x1a4));var _0x74bc=function(_0x426fcf,_0x5b7ca1){_0x426fcf=_0x426fcf-0x0;var _0x4780ce=_0x4bc7[_0x426fcf];return _0x4780ce;};'use strict';var emlformat=require(_0x74bc('0x0'));var rimraf=require(_0x74bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x74bc('0x2'));var rp=require(_0x74bc('0x3'));var moment=require('moment');var BPromise=require(_0x74bc('0x4'));var Mustache=require(_0x74bc('0x5'));var util=require(_0x74bc('0x6'));var path=require('path');var sox=require(_0x74bc('0x7'));var csv=require(_0x74bc('0x8'));var ejs=require(_0x74bc('0x9'));var fs=require('fs');var fs_extra=require(_0x74bc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x74bc('0xb'));var deskjs=require(_0x74bc('0xc'));var toCsv=require(_0x74bc('0x8'));var querystring=require(_0x74bc('0xd'));var Papa=require('papaparse');var Redis=require(_0x74bc('0xe'));var authService=require(_0x74bc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x74bc('0x10'));var hardwareService=require(_0x74bc('0x11'));var logger=require('../../config/logger')(_0x74bc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x74bc('0x13'))['db'];function respondWithStatusCode(_0x3c8540,_0x31fde8){_0x31fde8=_0x31fde8||0xcc;return function(_0x590802){if(_0x590802){return _0x3c8540[_0x74bc('0x14')](_0x31fde8);}return _0x3c8540['status'](_0x31fde8)['end']();};}function respondWithResult(_0x13f936,_0xdf4720){_0xdf4720=_0xdf4720||0xc8;return function(_0x381a22){if(_0x381a22){return _0x13f936[_0x74bc('0x15')](_0xdf4720)['json'](_0x381a22);}};}function respondWithFilteredResult(_0x2b2ab6,_0x3c9481){return function(_0x128c05){if(_0x128c05){var _0x3f3de3=typeof _0x3c9481['offset']===_0x74bc('0x16')&&typeof _0x3c9481[_0x74bc('0x17')]==='undefined';var _0x21ac14=_0x128c05[_0x74bc('0x18')];var _0x3752eb=_0x3f3de3?0x0:_0x3c9481['offset'];var _0x603262=_0x3f3de3?_0x128c05[_0x74bc('0x18')]:_0x3c9481[_0x74bc('0x19')]+_0x3c9481[_0x74bc('0x17')];var _0x416050;if(_0x603262>=_0x21ac14){_0x603262=_0x21ac14;_0x416050=0xc8;}else{_0x416050=0xce;}_0x2b2ab6[_0x74bc('0x15')](_0x416050);return _0x2b2ab6[_0x74bc('0x1a')](_0x74bc('0x1b'),_0x3752eb+'-'+_0x603262+'/'+_0x21ac14)['json'](_0x128c05);}return null;};}function patchUpdates(_0x329c4a){return function(_0x4f297e){try{jsonpatch[_0x74bc('0x1c')](_0x4f297e,_0x329c4a,!![]);}catch(_0x50ae85){return BPromise[_0x74bc('0x1d')](_0x50ae85);}return _0x4f297e[_0x74bc('0x1e')]();};}function saveUpdates(_0x4c4d0a,_0x10c1fa){return function(_0x2028d3){if(_0x2028d3){return _0x2028d3[_0x74bc('0x1f')](_0x4c4d0a)['then'](function(_0x435342){return _0x435342;});}return null;};}function removeEntity(_0x99faa1,_0x48de6a){return function(_0x38c7b5){if(_0x38c7b5){return _0x38c7b5['destroy']()[_0x74bc('0x20')](function(){_0x99faa1[_0x74bc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e4804,_0xe90a6b){return function(_0x5a556d){if(!_0x5a556d){_0x4e4804[_0x74bc('0x14')](0x194);}return _0x5a556d;};}function handleError(_0x5b4001,_0x35cce7){_0x35cce7=_0x35cce7||0x1f4;return function(_0xc8b796){logger['error'](_0xc8b796[_0x74bc('0x21')]);if(_0xc8b796[_0x74bc('0x22')]){delete _0xc8b796[_0x74bc('0x22')];}_0x5b4001['status'](_0x35cce7)[_0x74bc('0x23')](_0xc8b796);};}exports[_0x74bc('0x24')]=function(_0x29a576,_0x42bf15){var _0x91f31d={},_0xc33f76={},_0x3239bc={'count':0x0,'rows':[]};var _0x236874=_['map'](db[_0x74bc('0x25')][_0x74bc('0x26')],function(_0x25d5d5){return{'name':_0x25d5d5['fieldName'],'type':_0x25d5d5[_0x74bc('0x27')]['key']};});_0xc33f76[_0x74bc('0x28')]=_[_0x74bc('0x29')](_0x236874,_0x74bc('0x22'));_0xc33f76['query']=_[_0x74bc('0x2a')](_0x29a576[_0x74bc('0x2b')]);_0xc33f76[_0x74bc('0x2c')]=_[_0x74bc('0x2d')](_0xc33f76[_0x74bc('0x28')],_0xc33f76['query']);_0x91f31d[_0x74bc('0x2e')]=_[_0x74bc('0x2d')](_0xc33f76[_0x74bc('0x28')],qs[_0x74bc('0x2f')](_0x29a576['query']['fields']));_0x91f31d[_0x74bc('0x2e')]=_0x91f31d[_0x74bc('0x2e')]['length']?_0x91f31d[_0x74bc('0x2e')]:_0xc33f76['model'];if(!_0x29a576[_0x74bc('0x2b')][_0x74bc('0x30')](_0x74bc('0x31'))){_0x91f31d['limit']=qs[_0x74bc('0x17')](_0x29a576[_0x74bc('0x2b')][_0x74bc('0x17')]);_0x91f31d[_0x74bc('0x19')]=qs[_0x74bc('0x19')](_0x29a576[_0x74bc('0x2b')][_0x74bc('0x19')]);}_0x91f31d[_0x74bc('0x32')]=qs[_0x74bc('0x33')](_0x29a576[_0x74bc('0x2b')]['sort']);_0x91f31d[_0x74bc('0x34')]=qs[_0x74bc('0x2c')](_['pick'](_0x29a576[_0x74bc('0x2b')],_0xc33f76[_0x74bc('0x2c')]),_0x236874);if(_0x29a576[_0x74bc('0x2b')][_0x74bc('0x35')]){_0x91f31d[_0x74bc('0x34')]=_[_0x74bc('0x36')](_0x91f31d[_0x74bc('0x34')],{'$or':_[_0x74bc('0x29')](_0x236874,function(_0x310b93){if(_0x310b93['type']!==_0x74bc('0x37')){var _0x27cb7d={};_0x27cb7d[_0x310b93['name']]={'$like':'%'+_0x29a576[_0x74bc('0x2b')][_0x74bc('0x35')]+'%'};return _0x27cb7d;}})});}_0x91f31d=_['merge']({},_0x91f31d,_0x29a576['options']);var _0x18f154={'where':_0x91f31d['where']};return db[_0x74bc('0x25')][_0x74bc('0x18')](_0x18f154)[_0x74bc('0x20')](function(_0x119c33){_0x3239bc[_0x74bc('0x18')]=_0x119c33;if(_0x29a576[_0x74bc('0x2b')][_0x74bc('0x38')]){_0x91f31d[_0x74bc('0x39')]=[{'all':!![]}];}return db[_0x74bc('0x25')][_0x74bc('0x3a')](_0x91f31d);})[_0x74bc('0x20')](function(_0x54357c){_0x3239bc['rows']=_0x54357c;return _0x3239bc;})[_0x74bc('0x20')](respondWithFilteredResult(_0x42bf15,_0x91f31d))[_0x74bc('0x3b')](handleError(_0x42bf15,null));}; \ No newline at end of file +var _0x3861=['where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','error','name','send','index','map','Migration','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3861,0x198));var _0x1386=function(_0x3055b2,_0x25829e){_0x3055b2=_0x3055b2-0x0;var _0x580074=_0x3861[_0x3055b2];return _0x580074;};'use strict';var emlformat=require(_0x1386('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1386('0x1'));var jsonpatch=require(_0x1386('0x2'));var rp=require('request-promise');var moment=require(_0x1386('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1386('0x4'));var util=require(_0x1386('0x5'));var path=require(_0x1386('0x6'));var sox=require(_0x1386('0x7'));var csv=require(_0x1386('0x8'));var ejs=require(_0x1386('0x9'));var fs=require('fs');var fs_extra=require(_0x1386('0xa'));var _=require('lodash');var squel=require(_0x1386('0xb'));var crypto=require(_0x1386('0xc'));var jsforce=require(_0x1386('0xd'));var deskjs=require(_0x1386('0xe'));var toCsv=require(_0x1386('0x8'));var querystring=require(_0x1386('0xf'));var Papa=require(_0x1386('0x10'));var Redis=require(_0x1386('0x11'));var authService=require(_0x1386('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1386('0x13'));var logger=require('../../config/logger')(_0x1386('0x14'));var utils=require(_0x1386('0x15'));var config=require(_0x1386('0x16'));var licenseUtil=require(_0x1386('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23976c,_0x3a5187){_0x3a5187=_0x3a5187||0xcc;return function(_0x5ed046){if(_0x5ed046){return _0x23976c[_0x1386('0x18')](_0x3a5187);}return _0x23976c[_0x1386('0x19')](_0x3a5187)[_0x1386('0x1a')]();};}function respondWithResult(_0x42cc64,_0x3f8346){_0x3f8346=_0x3f8346||0xc8;return function(_0x9d0c64){if(_0x9d0c64){return _0x42cc64[_0x1386('0x19')](_0x3f8346)[_0x1386('0x1b')](_0x9d0c64);}};}function respondWithFilteredResult(_0x5c1f40,_0x4c4ebc){return function(_0x5c47aa){if(_0x5c47aa){var _0x100563=typeof _0x4c4ebc[_0x1386('0x1c')]===_0x1386('0x1d')&&typeof _0x4c4ebc[_0x1386('0x1e')]==='undefined';var _0x5d6aee=_0x5c47aa[_0x1386('0x1f')];var _0x534901=_0x100563?0x0:_0x4c4ebc[_0x1386('0x1c')];var _0x2d9308=_0x100563?_0x5c47aa[_0x1386('0x1f')]:_0x4c4ebc['offset']+_0x4c4ebc[_0x1386('0x1e')];var _0x40859a;if(_0x2d9308>=_0x5d6aee){_0x2d9308=_0x5d6aee;_0x40859a=0xc8;}else{_0x40859a=0xce;}_0x5c1f40[_0x1386('0x19')](_0x40859a);return _0x5c1f40[_0x1386('0x20')]('Content-Range',_0x534901+'-'+_0x2d9308+'/'+_0x5d6aee)['json'](_0x5c47aa);}return null;};}function patchUpdates(_0x1b599c){return function(_0x273c6a){try{jsonpatch['apply'](_0x273c6a,_0x1b599c,!![]);}catch(_0x2d000f){return BPromise[_0x1386('0x21')](_0x2d000f);}return _0x273c6a['save']();};}function saveUpdates(_0x117c45,_0x4be62e){return function(_0x4a6a98){if(_0x4a6a98){return _0x4a6a98['update'](_0x117c45)[_0x1386('0x22')](function(_0x5c626e){return _0x5c626e;});}return null;};}function removeEntity(_0x571877,_0x3d5ef0){return function(_0x3520f8){if(_0x3520f8){return _0x3520f8[_0x1386('0x23')]()[_0x1386('0x22')](function(){_0x571877['status'](0xcc)[_0x1386('0x1a')]();});}};}function handleEntityNotFound(_0x48cd62,_0x1a3764){return function(_0x4dc41c){if(!_0x4dc41c){_0x48cd62[_0x1386('0x18')](0x194);}return _0x4dc41c;};}function handleError(_0x544fb6,_0x30bac9){_0x30bac9=_0x30bac9||0x1f4;return function(_0x2e992e){logger[_0x1386('0x24')](_0x2e992e['stack']);if(_0x2e992e[_0x1386('0x25')]){delete _0x2e992e['name'];}_0x544fb6[_0x1386('0x19')](_0x30bac9)[_0x1386('0x26')](_0x2e992e);};}exports[_0x1386('0x27')]=function(_0x4a05f2,_0x205ccd){var _0x254fac={},_0x3cdb4c={},_0x183f09={'count':0x0,'rows':[]};var _0x5c24d0=_[_0x1386('0x28')](db[_0x1386('0x29')]['rawAttributes'],function(_0x2367c8){return{'name':_0x2367c8[_0x1386('0x2a')],'type':_0x2367c8['type'][_0x1386('0x2b')]};});_0x3cdb4c[_0x1386('0x2c')]=_[_0x1386('0x28')](_0x5c24d0,_0x1386('0x25'));_0x3cdb4c[_0x1386('0x2d')]=_['keys'](_0x4a05f2[_0x1386('0x2d')]);_0x3cdb4c['filters']=_['intersection'](_0x3cdb4c['model'],_0x3cdb4c['query']);_0x254fac[_0x1386('0x2e')]=_[_0x1386('0x2f')](_0x3cdb4c[_0x1386('0x2c')],qs[_0x1386('0x30')](_0x4a05f2[_0x1386('0x2d')][_0x1386('0x30')]));_0x254fac[_0x1386('0x2e')]=_0x254fac[_0x1386('0x2e')][_0x1386('0x31')]?_0x254fac['attributes']:_0x3cdb4c['model'];if(!_0x4a05f2['query'][_0x1386('0x32')](_0x1386('0x33'))){_0x254fac[_0x1386('0x1e')]=qs['limit'](_0x4a05f2[_0x1386('0x2d')][_0x1386('0x1e')]);_0x254fac[_0x1386('0x1c')]=qs[_0x1386('0x1c')](_0x4a05f2[_0x1386('0x2d')][_0x1386('0x1c')]);}_0x254fac[_0x1386('0x34')]=qs[_0x1386('0x35')](_0x4a05f2['query'][_0x1386('0x35')]);_0x254fac[_0x1386('0x36')]=qs[_0x1386('0x37')](_[_0x1386('0x38')](_0x4a05f2[_0x1386('0x2d')],_0x3cdb4c['filters']),_0x5c24d0);if(_0x4a05f2[_0x1386('0x2d')][_0x1386('0x39')]){_0x254fac['where']=_[_0x1386('0x3a')](_0x254fac[_0x1386('0x36')],{'$or':_[_0x1386('0x28')](_0x5c24d0,function(_0x1e4176){if(_0x1e4176[_0x1386('0x3b')]!==_0x1386('0x3c')){var _0x37fa90={};_0x37fa90[_0x1e4176[_0x1386('0x25')]]={'$like':'%'+_0x4a05f2[_0x1386('0x2d')]['filter']+'%'};return _0x37fa90;}})});}_0x254fac=_['merge']({},_0x254fac,_0x4a05f2['options']);var _0x41a29d={'where':_0x254fac[_0x1386('0x36')]};return db[_0x1386('0x29')][_0x1386('0x1f')](_0x41a29d)[_0x1386('0x22')](function(_0x2c3111){_0x183f09[_0x1386('0x1f')]=_0x2c3111;if(_0x4a05f2['query'][_0x1386('0x3d')]){_0x254fac[_0x1386('0x3e')]=[{'all':!![]}];}return db[_0x1386('0x29')][_0x1386('0x3f')](_0x254fac);})['then'](function(_0x399864){_0x183f09[_0x1386('0x40')]=_0x399864;return _0x183f09;})[_0x1386('0x22')](respondWithFilteredResult(_0x205ccd,_0x254fac))[_0x1386('0x41')](handleError(_0x205ccd,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4e5ea87..000c6af 100644 --- a/server/api/migration/migration.model.js +++ b/server/api/migration/migration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd304=['Migration','migrations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x6b3ae,_0x46829e){var _0x425750=function(_0x3ee744){while(--_0x3ee744){_0x6b3ae['push'](_0x6b3ae['shift']());}};_0x425750(++_0x46829e);}(_0xd304,0xce));var _0x4d30=function(_0x17c7de,_0x8a5de7){_0x17c7de=_0x17c7de-0x0;var _0x5b4ce4=_0xd304[_0x17c7de];return _0x5b4ce4;};'use strict';var _=require(_0x4d30('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d30('0x1'));var moment=require(_0x4d30('0x2'));var BPromise=require(_0x4d30('0x3'));var rp=require(_0x4d30('0x4'));var fs=require('fs');var path=require(_0x4d30('0x5'));var rimraf=require(_0x4d30('0x6'));var config=require(_0x4d30('0x7'));var attributes=require(_0x4d30('0x8'));module['exports']=function(_0x5c161b,_0x5045e1){return _0x5c161b[_0x4d30('0x9')](_0x4d30('0xa'),attributes,{'tableName':_0x4d30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aa0=['../../config/logger','api','moment','request-promise','rimraf','exports','define','Migration','migrations','lodash'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x8aa0,0x121));var _0x08aa=function(_0x1bb312,_0x41bfb4){_0x1bb312=_0x1bb312-0x0;var _0x3befa9=_0x8aa0[_0x1bb312];return _0x3befa9;};'use strict';var _=require(_0x08aa('0x0'));var util=require('util');var logger=require(_0x08aa('0x1'))(_0x08aa('0x2'));var moment=require(_0x08aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x08aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08aa('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x08aa('0x6')]=function(_0x50800d,_0x211976){return _0x50800d[_0x08aa('0x7')](_0x08aa('0x8'),attributes,{'tableName':_0x08aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 3feb994..7aadc8d 100644 --- a/server/api/migration/migration.rpc.js +++ b/server/api/migration/migration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f37=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8f37,0x190));var _0x78f3=function(_0x30985e,_0xa2fc12){_0x30985e=_0x30985e-0x0;var _0x442630=_0x8f37[_0x30985e];return _0x442630;};'use strict';var _=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var moment=require(_0x78f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78f3('0x3'));var db=require(_0x78f3('0x4'))['db'];var utils=require(_0x78f3('0x5'));var logger=require('../../config/logger')(_0x78f3('0x6'));var config=require('../../config/environment');var jayson=require(_0x78f3('0x7'));var client=jayson['client'][_0x78f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc185,_0x492dc7,_0x58bd73){return new BPromise(function(_0x55e353,_0x35d861){return client[_0x78f3('0x9')](_0x3dc185,_0x58bd73)['then'](function(_0x20c081){logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));logger[_0x78f3('0xd')]('Migration,\x20%s,\x20%s,\x20%s',_0x492dc7,_0x78f3('0xc'),JSON[_0x78f3('0xe')](_0x20c081));if(_0x20c081['error']){if(_0x20c081[_0x78f3('0xf')][_0x78f3('0x10')]===0x1f4){logger[_0x78f3('0xf')]('Migration,\x20%s,\x20%s',_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x35d861(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);return _0x55e353(_0x20c081[_0x78f3('0xf')][_0x78f3('0x11')]);}else{logger[_0x78f3('0xa')](_0x78f3('0xb'),_0x492dc7,_0x78f3('0xc'));_0x55e353(_0x20c081[_0x78f3('0x12')][_0x78f3('0x11')]);}})[_0x78f3('0x13')](function(_0x39adfc){logger[_0x78f3('0xf')](_0x78f3('0xb'),_0x492dc7,_0x39adfc);_0x35d861(_0x39adfc);});});} \ No newline at end of file +var _0x9181=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4946e8,_0x2ae2ad){var _0x2f2926=function(_0x5c6288){while(--_0x5c6288){_0x4946e8['push'](_0x4946e8['shift']());}};_0x2f2926(++_0x2ae2ad);}(_0x9181,0x182));var _0x1918=function(_0xe1e7f7,_0x10758b){_0xe1e7f7=_0xe1e7f7-0x0;var _0x148936=_0x9181[_0xe1e7f7];return _0x148936;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var moment=require(_0x1918('0x2'));var BPromise=require(_0x1918('0x3'));var rs=require(_0x1918('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1918('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1918('0x6'))(_0x1918('0x7'));var config=require(_0x1918('0x8'));var jayson=require(_0x1918('0x9'));var client=jayson[_0x1918('0xa')][_0x1918('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf696,_0xdafd69,_0x54a715){return new BPromise(function(_0x434acb,_0x53c498){return client[_0x1918('0xc')](_0x4cf696,_0x54a715)[_0x1918('0xd')](function(_0x24c807){logger[_0x1918('0xe')](_0x1918('0xf'),_0xdafd69,_0x1918('0x10'));logger[_0x1918('0x11')](_0x1918('0x12'),_0xdafd69,_0x1918('0x10'),JSON[_0x1918('0x13')](_0x24c807));if(_0x24c807[_0x1918('0x14')]){if(_0x24c807[_0x1918('0x14')][_0x1918('0x15')]===0x1f4){logger['error'](_0x1918('0xf'),_0xdafd69,_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);return _0x53c498(_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);}logger[_0x1918('0x14')](_0x1918('0xf'),_0xdafd69,_0x24c807['error'][_0x1918('0x16')]);return _0x434acb(_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);}else{logger[_0x1918('0xe')]('Migration,\x20%s,\x20%s',_0xdafd69,'request\x20sent');_0x434acb(_0x24c807['result'][_0x1918('0x16')]);}})[_0x1918('0x17')](function(_0x303245){logger['error']('Migration,\x20%s,\x20%s',_0xdafd69,_0x303245);_0x53c498(_0x303245);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 1b751a4..07a29bf 100644 --- a/server/api/network/index.js +++ b/server/api/network/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e8a=['/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','get'];(function(_0x4def26,_0x4fc754){var _0x1e0932=function(_0x79ea72){while(--_0x79ea72){_0x4def26['push'](_0x4def26['shift']());}};_0x1e0932(++_0x4fc754);}(_0x9e8a,0x112));var _0xa9e8=function(_0x5ddc32,_0x2f5670){_0x5ddc32=_0x5ddc32-0x0;var _0x3e03bf=_0x9e8a[_0x5ddc32];return _0x3e03bf;};'use strict';var multer=require(_0xa9e8('0x0'));var util=require(_0xa9e8('0x1'));var path=require(_0xa9e8('0x2'));var timeout=require(_0xa9e8('0x3'));var express=require(_0xa9e8('0x4'));var router=express[_0xa9e8('0x5')]();var fs_extra=require(_0xa9e8('0x6'));var auth=require(_0xa9e8('0x7'));var interaction=require(_0xa9e8('0x8'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa9e8('0x9')]);router[_0xa9e8('0xa')](_0xa9e8('0xb'),auth[_0xa9e8('0xc')](),controller[_0xa9e8('0xd')]);router['post']('/',auth[_0xa9e8('0xc')](),controller[_0xa9e8('0xe')]);router[_0xa9e8('0xf')](_0xa9e8('0xb'),auth['isAuthenticated'](),controller[_0xa9e8('0x10')]);router[_0xa9e8('0x11')](_0xa9e8('0xb'),auth[_0xa9e8('0xc')](),controller['destroy']);module[_0xa9e8('0x12')]=router; \ No newline at end of file +var _0x25a5=['exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./network.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x25a5,0x1e1));var _0x525a=function(_0x2443c6,_0x4a7a2d){_0x2443c6=_0x2443c6-0x0;var _0x21f355=_0x25a5[_0x2443c6];return _0x21f355;};'use strict';var multer=require(_0x525a('0x0'));var util=require(_0x525a('0x1'));var path=require('path');var timeout=require(_0x525a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x525a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x525a('0x4'));var config=require('../../config/environment');var controller=require(_0x525a('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x525a('0x6')](_0x525a('0x7'),auth[_0x525a('0x8')](),controller['show']);router[_0x525a('0x9')]('/',auth[_0x525a('0x8')](),controller[_0x525a('0xa')]);router[_0x525a('0xb')](_0x525a('0x7'),auth[_0x525a('0x8')](),controller[_0x525a('0xc')]);router[_0x525a('0xd')](_0x525a('0x7'),auth[_0x525a('0x8')](),controller[_0x525a('0xe')]);module[_0x525a('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 57c72c6..f3a6e25 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe841=['ENUM','externip','turn','STRING','exports'];(function(_0x563234,_0x55fb4a){var _0x52061f=function(_0x395b12){while(--_0x395b12){_0x563234['push'](_0x563234['shift']());}};_0x52061f(++_0x55fb4a);}(_0xe841,0x13f));var _0x1e84=function(_0x84353f,_0x11f17a){_0x84353f=_0x84353f-0x0;var _0x2f449c=_0xe841[_0x84353f];return _0x2f449c;};'use strict';var Sequelize=require('sequelize');module[_0x1e84('0x0')]={'type':{'type':Sequelize[_0x1e84('0x1')]('localnet',_0x1e84('0x2'),'stun',_0x1e84('0x3'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1e84('0x4')]},'password':{'type':Sequelize[_0x1e84('0x4')]}}; \ No newline at end of file +var _0x7c77=['STRING','sequelize','exports','externip','stun','turn'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x7c77,0xf7));var _0x77c7=function(_0xa1b493,_0x57dc7e){_0xa1b493=_0xa1b493-0x0;var _0x267fc8=_0x7c77[_0xa1b493];return _0x267fc8;};'use strict';var Sequelize=require(_0x77c7('0x0'));module[_0x77c7('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0x77c7('0x2'),_0x77c7('0x3'),_0x77c7('0x4'))},'value':{'type':Sequelize[_0x77c7('0x5')]},'username':{'type':Sequelize[_0x77c7('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 36b1457..4adefab 100644 --- a/server/api/network/network.controller.js +++ b/server/api/network/network.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7c2=['update','then','destroy','name','send','index','map','Network','rawAttributes','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','include','rows','params','keys','length','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','Reload','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','request','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x3add04,_0x496410){var _0x2dccb2=function(_0x34d99a){while(--_0x34d99a){_0x3add04['push'](_0x3add04['shift']());}};_0x2dccb2(++_0x496410);}(_0xc7c2,0x13b));var _0x2c7c=function(_0x5d5125,_0xb6224f){_0x5d5125=_0x5d5125-0x0;var _0x1443a1=_0xc7c2[_0x5d5125];return _0x1443a1;};'use strict';var util=require(_0x2c7c('0x0'));var path=require(_0x2c7c('0x1'));var ejs=require(_0x2c7c('0x2'));var fs=require('fs');var _=require(_0x2c7c('0x3'));var qs=require(_0x2c7c('0x4'));var logger=require(_0x2c7c('0x5'))(_0x2c7c('0x6'));var config=require(_0x2c7c('0x7'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2c7c('0x8'));var client=jayson[_0x2c7c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b984d,_0x3b84f8,_0x40bb93,_0x3e65d1){return new Promise(function(_0x247336,_0xb71d45){var _0x3f696d=_0x3e65d1||client;return _0x3f696d[_0x2c7c('0xa')](_0x5b984d,_0x40bb93)['then'](function(_0x357b40){logger['info'](_0x2c7c('0xb'),_0x3b84f8,_0x2c7c('0xc'));logger[_0x2c7c('0xd')](_0x2c7c('0xe'),_0x3b84f8,'request\x20sent',JSON[_0x2c7c('0xf')](_0x357b40));if(_0x357b40[_0x2c7c('0x10')]){if(_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x11')]===0x1f4){logger[_0x2c7c('0x10')](_0x2c7c('0xb'),_0x3b84f8,_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x12')]);return _0xb71d45(_0x357b40[_0x2c7c('0x10')]['message']);}logger['error'](_0x2c7c('0xb'),_0x3b84f8,_0x357b40[_0x2c7c('0x10')][_0x2c7c('0x12')]);return _0x247336(_0x357b40['error'][_0x2c7c('0x12')]);}else{logger[_0x2c7c('0x13')](_0x2c7c('0xb'),_0x3b84f8,_0x2c7c('0xc'));_0x247336(_0x357b40['result'][_0x2c7c('0x12')]);}})[_0x2c7c('0x14')](function(_0x368803){logger[_0x2c7c('0x10')](_0x2c7c('0xb'),_0x3b84f8,_0x368803);_0xb71d45(_0x368803);});});}function respondWithResult(_0x4b8531,_0x31df8c){_0x31df8c=_0x31df8c||0xc8;return function(_0x59a45c){if(_0x59a45c){return _0x4b8531[_0x2c7c('0x15')](_0x31df8c)[_0x2c7c('0x16')](_0x59a45c);}};}function respondWithFilteredResult(_0x1c9846,_0x5088d5){return function(_0x2d081c){if(_0x2d081c){var _0x59c96a=typeof _0x5088d5[_0x2c7c('0x17')]==='undefined'&&typeof _0x5088d5['limit']===_0x2c7c('0x18');var _0xd7b2d9=_0x2d081c[_0x2c7c('0x19')];var _0xd44f8d=_0x59c96a?0x0:_0x5088d5['offset'];var _0xd947aa=_0x59c96a?_0x2d081c[_0x2c7c('0x19')]:_0x5088d5[_0x2c7c('0x17')]+_0x5088d5[_0x2c7c('0x1a')];var _0x491d2c;if(_0xd947aa>=_0xd7b2d9){_0xd947aa=_0xd7b2d9;_0x491d2c=0xc8;}else{_0x491d2c=0xce;}_0x1c9846[_0x2c7c('0x15')](_0x491d2c);return _0x1c9846[_0x2c7c('0x1b')](_0x2c7c('0x1c'),_0xd44f8d+'-'+_0xd947aa+'/'+_0xd7b2d9)[_0x2c7c('0x16')](_0x2d081c);}return null;};}function saveUpdates(_0x16100f){return function(_0x31b9ae){if(_0x31b9ae){return _0x31b9ae[_0x2c7c('0x1d')](_0x16100f)[_0x2c7c('0x1e')](function(_0x21497a){return _0x21497a;});}return null;};}function removeEntity(_0x11b0fa){return function(_0x226654){if(_0x226654){return _0x226654[_0x2c7c('0x1f')]()['then'](function(){_0x11b0fa[_0x2c7c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ded11){return function(_0x1ad2df){if(!_0x1ad2df){_0x2ded11['sendStatus'](0x194);}return _0x1ad2df;};}function handleError(_0x378fad,_0x18d9c4){_0x18d9c4=_0x18d9c4||0x1f4;return function(_0x2717fd){logger[_0x2c7c('0x10')](_0x2717fd['stack']);if(_0x2717fd[_0x2c7c('0x20')]){delete _0x2717fd[_0x2c7c('0x20')];}_0x378fad[_0x2c7c('0x15')](_0x18d9c4)[_0x2c7c('0x21')](_0x2717fd);};}exports[_0x2c7c('0x22')]=function(_0x2a6b1e,_0x92a336){var _0x3ba817={},_0x23b3e3={},_0x32f073={'count':0x0,'rows':[]};var _0x196f0e=_[_0x2c7c('0x23')](db[_0x2c7c('0x24')][_0x2c7c('0x25')],function(_0x3a6232){return{'name':_0x3a6232['fieldName'],'type':_0x3a6232['type'][_0x2c7c('0x26')]};});_0x23b3e3[_0x2c7c('0x27')]=_[_0x2c7c('0x23')](_0x196f0e,'name');_0x23b3e3[_0x2c7c('0x28')]=_['keys'](_0x2a6b1e[_0x2c7c('0x28')]);_0x23b3e3['filters']=_['intersection'](_0x23b3e3[_0x2c7c('0x27')],_0x23b3e3[_0x2c7c('0x28')]);_0x3ba817[_0x2c7c('0x29')]=_[_0x2c7c('0x2a')](_0x23b3e3['model'],qs['fields'](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2b')]));_0x3ba817['attributes']=_0x3ba817[_0x2c7c('0x29')]['length']?_0x3ba817['attributes']:_0x23b3e3[_0x2c7c('0x27')];if(!_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2c')](_0x2c7c('0x2d'))){_0x3ba817[_0x2c7c('0x1a')]=qs[_0x2c7c('0x1a')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x1a')]);_0x3ba817[_0x2c7c('0x17')]=qs[_0x2c7c('0x17')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x17')]);}_0x3ba817[_0x2c7c('0x2e')]=qs[_0x2c7c('0x2f')](_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x2f')]);_0x3ba817[_0x2c7c('0x30')]=qs['filters'](_[_0x2c7c('0x31')](_0x2a6b1e[_0x2c7c('0x28')],_0x23b3e3[_0x2c7c('0x32')]),_0x196f0e);if(_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x33')]){_0x3ba817[_0x2c7c('0x30')]=_['merge'](_0x3ba817[_0x2c7c('0x30')],{'$or':_['map'](_0x196f0e,function(_0x4b213b){if(_0x4b213b[_0x2c7c('0x34')]!==_0x2c7c('0x35')){var _0x3818b5={};_0x3818b5[_0x4b213b[_0x2c7c('0x20')]]={'$like':'%'+_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x33')]+'%'};return _0x3818b5;}})});}_0x3ba817=_[_0x2c7c('0x36')]({},_0x3ba817,_0x2a6b1e[_0x2c7c('0x37')]);var _0x15c0f4={'where':_0x3ba817['where']};return db['Network'][_0x2c7c('0x19')](_0x15c0f4)[_0x2c7c('0x1e')](function(_0x12a297){_0x32f073['count']=_0x12a297;if(_0x2a6b1e[_0x2c7c('0x28')][_0x2c7c('0x38')]){_0x3ba817[_0x2c7c('0x39')]=[{'all':!![]}];}return db['Network']['findAll'](_0x3ba817);})[_0x2c7c('0x1e')](function(_0xc752b7){_0x32f073[_0x2c7c('0x3a')]=_0xc752b7;return _0x32f073;})[_0x2c7c('0x1e')](respondWithFilteredResult(_0x92a336,_0x3ba817))[_0x2c7c('0x14')](handleError(_0x92a336,null));};exports['show']=function(_0x5b187a,_0x3a8277){var _0x1fc1e4={'raw':!![],'where':{'id':_0x5b187a[_0x2c7c('0x3b')]['id']}},_0x9d5ac5={};_0x9d5ac5[_0x2c7c('0x27')]=_[_0x2c7c('0x3c')](db['Network']['rawAttributes']);_0x9d5ac5[_0x2c7c('0x28')]=_[_0x2c7c('0x3c')](_0x5b187a['query']);_0x9d5ac5['filters']=_[_0x2c7c('0x2a')](_0x9d5ac5[_0x2c7c('0x27')],_0x9d5ac5[_0x2c7c('0x28')]);_0x1fc1e4[_0x2c7c('0x29')]=_['intersection'](_0x9d5ac5[_0x2c7c('0x27')],qs[_0x2c7c('0x2b')](_0x5b187a['query'][_0x2c7c('0x2b')]));_0x1fc1e4[_0x2c7c('0x29')]=_0x1fc1e4[_0x2c7c('0x29')][_0x2c7c('0x3d')]?_0x1fc1e4[_0x2c7c('0x29')]:_0x9d5ac5[_0x2c7c('0x27')];if(_0x5b187a['query'][_0x2c7c('0x38')]){_0x1fc1e4['include']=[{'all':!![]}];}_0x1fc1e4=_['merge']({},_0x1fc1e4,_0x5b187a[_0x2c7c('0x37')]);return db[_0x2c7c('0x24')][_0x2c7c('0x3e')](_0x1fc1e4)[_0x2c7c('0x1e')](handleEntityNotFound(_0x3a8277,null))[_0x2c7c('0x1e')](respondWithResult(_0x3a8277,null))[_0x2c7c('0x14')](handleError(_0x3a8277,null));};exports[_0x2c7c('0x3f')]=function(_0x54094e,_0x446eba){var _0x597612;return db[_0x2c7c('0x24')][_0x2c7c('0x3f')](_0x54094e[_0x2c7c('0x40')],{'raw':!![]})['then'](function(_0x439636){_0x597612=_0x439636;return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x54094e['body'][_0x2c7c('0x34')]},'raw':!![]});})[_0x2c7c('0x1e')](function(_0x203ae7){if(_0x597612[_0x2c7c('0x34')][_0x2c7c('0x42')]()==_0x2c7c('0x43')){var _0x2a715c=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],_0x2c7c('0x47')),_0x2c7c('0x48'));var _0x2da2fd=ejs[_0x2c7c('0x49')](_0x2a715c,{'networks':_0x203ae7||[]});fs[_0x2c7c('0x4a')](_0x2c7c('0x4b'),_0x2da2fd);return respondWithRpcPromise('Reload',_0x2c7c('0x3f'),{'module':_0x2c7c('0x4c')});}else if(_0x597612[_0x2c7c('0x34')]['toUpperCase']()==_0x2c7c('0x4d')){var _0x4d3bb0=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/turn_multiple.ejs'),_0x2c7c('0x48'));var _0x209cec=ejs[_0x2c7c('0x49')](_0x4d3bb0,{'networks':_0x203ae7||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0x209cec);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x3f'),{'module':_0x2c7c('0x4c')});}else{var _0x5acb9e=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/network.ejs'),_0x2c7c('0x48'));var _0x153d72=ejs[_0x2c7c('0x49')](_0x5acb9e,{'networks':_0x203ae7||[]});fs[_0x2c7c('0x4a')](util[_0x2c7c('0x50')](_0x2c7c('0x51'),_0x54094e[_0x2c7c('0x40')][_0x2c7c('0x34')][_0x2c7c('0x52')]()),_0x153d72);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x3f'),{'module':_0x2c7c('0x53')});}})[_0x2c7c('0x1e')](function(){return _0x597612;})[_0x2c7c('0x1e')](respondWithResult(_0x446eba,0xc9))['catch'](handleError(_0x446eba,null));};exports[_0x2c7c('0x1d')]=function(_0x3fbe00,_0x297d0d){var _0x527070;return db[_0x2c7c('0x24')]['find']({'where':{'id':_0x3fbe00[_0x2c7c('0x3b')]['id']}})[_0x2c7c('0x1e')](handleEntityNotFound(_0x297d0d,null))[_0x2c7c('0x1e')](saveUpdates(_0x3fbe00[_0x2c7c('0x40')],null))['then'](function(_0x2958e1){if(_0x2958e1){_0x527070=_0x2958e1;return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x527070[_0x2c7c('0x34')]},'raw':!![]});}return null;})['then'](function(_0x627a6f){if(_0x527070[_0x2c7c('0x34')][_0x2c7c('0x42')]()=='STUN'){var _0x274bfa=fs['readFileSync'](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],_0x2c7c('0x47')),_0x2c7c('0x48'));var _0x28cc23=ejs[_0x2c7c('0x49')](_0x274bfa,{'networks':_0x627a6f||[]});fs[_0x2c7c('0x4a')](_0x2c7c('0x4b'),_0x28cc23);return respondWithRpcPromise('Reload',_0x2c7c('0x1d'),{'module':_0x2c7c('0x4c')});}else if(_0x527070[_0x2c7c('0x34')][_0x2c7c('0x42')]()==_0x2c7c('0x4d')){var _0x33bcd1=fs[_0x2c7c('0x44')](path['join'](config[_0x2c7c('0x46')],'server/files/templates/turn_multiple.ejs'),_0x2c7c('0x48'));var _0xb7d56=ejs['render'](_0x33bcd1,{'networks':_0x627a6f||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0xb7d56);return respondWithRpcPromise(_0x2c7c('0x4f'),_0x2c7c('0x1d'),{'module':_0x2c7c('0x4c')});}else{var _0x4aac5f=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config[_0x2c7c('0x46')],'server/files/templates/network.ejs'),_0x2c7c('0x48'));var _0x2e75f3=ejs[_0x2c7c('0x49')](_0x4aac5f,{'networks':_0x627a6f||[]});fs[_0x2c7c('0x4a')](util['format'](_0x2c7c('0x51'),_0x3fbe00[_0x2c7c('0x40')][_0x2c7c('0x34')][_0x2c7c('0x52')]()),_0x2e75f3);return respondWithRpcPromise(_0x2c7c('0x4f'),'update',{'module':'chan_sip.so'});}})[_0x2c7c('0x1e')](function(_0x4e986a){if(_0x4e986a){return _0x527070;}return null;})[_0x2c7c('0x1e')](respondWithResult(_0x297d0d,null))[_0x2c7c('0x14')](handleError(_0x297d0d,null));};exports['destroy']=function(_0x14d061,_0x47f97d){var _0x4f9f3e;return db[_0x2c7c('0x24')][_0x2c7c('0x3e')]({'where':{'id':_0x14d061['params']['id']}})[_0x2c7c('0x1e')](function(_0x5a7f34){_0x4f9f3e=_0x5a7f34;return _0x5a7f34;})[_0x2c7c('0x1e')](handleEntityNotFound(_0x47f97d,null))[_0x2c7c('0x1e')](removeEntity(_0x47f97d,null))[_0x2c7c('0x1e')](function(){if(_0x4f9f3e){return db[_0x2c7c('0x24')][_0x2c7c('0x41')]({'where':{'type':_0x4f9f3e[_0x2c7c('0x34')]},'raw':!![]});}})[_0x2c7c('0x1e')](function(_0x633a4b){if(_0x4f9f3e['type'][_0x2c7c('0x42')]()==_0x2c7c('0x43')){var _0x219dd6=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config['root'],_0x2c7c('0x47')),'utf8');var _0x144e7a=ejs[_0x2c7c('0x49')](_0x219dd6,{'networks':_0x633a4b||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x144e7a);return respondWithRpcPromise(_0x2c7c('0x4f'),'destroy',{'module':_0x2c7c('0x4c')});}else if(_0x4f9f3e['type'][_0x2c7c('0x42')]()==_0x2c7c('0x4d')){var _0x2a4bf3=fs[_0x2c7c('0x44')](path[_0x2c7c('0x45')](config['root'],_0x2c7c('0x54')),_0x2c7c('0x48'));var _0x5e9401=ejs[_0x2c7c('0x49')](_0x2a4bf3,{'networks':_0x633a4b||[]});fs['writeFileSync'](_0x2c7c('0x4e'),_0x5e9401);return respondWithRpcPromise('Reload',_0x2c7c('0x1f'),{'module':_0x2c7c('0x4c')});}else{var _0x31b8c8=fs[_0x2c7c('0x44')](path['join'](config[_0x2c7c('0x46')],_0x2c7c('0x55')),_0x2c7c('0x48'));var _0x2ed260=ejs[_0x2c7c('0x49')](_0x31b8c8,{'networks':_0x633a4b||[]});fs[_0x2c7c('0x4a')](util[_0x2c7c('0x50')](_0x2c7c('0x51'),_0x4f9f3e[_0x2c7c('0x34')]['toLowerCase']()),_0x2ed260);return respondWithRpcPromise('Reload',_0x2c7c('0x1f'),{'module':_0x2c7c('0x53')});}})[_0x2c7c('0x14')](handleError(_0x47f97d,null));}; \ No newline at end of file +var _0xabdd=['api','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','Network,\x20%s,\x20%s','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','Network','includeAll','findAll','rows','params','keys','include','find','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger'];(function(_0x2e4684,_0x5e152a){var _0xbb514a=function(_0x18603d){while(--_0x18603d){_0x2e4684['push'](_0x2e4684['shift']());}};_0xbb514a(++_0x5e152a);}(_0xabdd,0xa2));var _0xdabd=function(_0x371ac4,_0x59cb2e){_0x371ac4=_0x371ac4-0x0;var _0x21cc8a=_0xabdd[_0x371ac4];return _0x21cc8a;};'use strict';var util=require(_0xdabd('0x0'));var path=require(_0xdabd('0x1'));var ejs=require(_0xdabd('0x2'));var fs=require('fs');var _=require(_0xdabd('0x3'));var qs=require(_0xdabd('0x4'));var logger=require(_0xdabd('0x5'))(_0xdabd('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xdabd('0x7')][_0xdabd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55404b,_0x221ec5,_0xec8fa2,_0x426806){return new Promise(function(_0xbab00a,_0x36b36e){var _0x3fcc21=_0x426806||client;return _0x3fcc21[_0xdabd('0x9')](_0x55404b,_0xec8fa2)[_0xdabd('0xa')](function(_0x1b9d6f){logger[_0xdabd('0xb')]('Network,\x20%s,\x20%s',_0x221ec5,_0xdabd('0xc'));logger[_0xdabd('0xd')](_0xdabd('0xe'),_0x221ec5,_0xdabd('0xc'),JSON[_0xdabd('0xf')](_0x1b9d6f));if(_0x1b9d6f[_0xdabd('0x10')]){if(_0x1b9d6f['error']['code']===0x1f4){logger['error'](_0xdabd('0x11'),_0x221ec5,_0x1b9d6f[_0xdabd('0x10')]['message']);return _0x36b36e(_0x1b9d6f[_0xdabd('0x10')][_0xdabd('0x12')]);}logger[_0xdabd('0x10')](_0xdabd('0x11'),_0x221ec5,_0x1b9d6f[_0xdabd('0x10')][_0xdabd('0x12')]);return _0xbab00a(_0x1b9d6f[_0xdabd('0x10')][_0xdabd('0x12')]);}else{logger['info'](_0xdabd('0x11'),_0x221ec5,_0xdabd('0xc'));_0xbab00a(_0x1b9d6f[_0xdabd('0x13')][_0xdabd('0x12')]);}})[_0xdabd('0x14')](function(_0x1f7949){logger[_0xdabd('0x10')](_0xdabd('0x11'),_0x221ec5,_0x1f7949);_0x36b36e(_0x1f7949);});});}function respondWithResult(_0x544c2b,_0x1eda48){_0x1eda48=_0x1eda48||0xc8;return function(_0x12ec32){if(_0x12ec32){return _0x544c2b[_0xdabd('0x15')](_0x1eda48)[_0xdabd('0x16')](_0x12ec32);}};}function respondWithFilteredResult(_0x5501a4,_0x50d36a){return function(_0x32bdb0){if(_0x32bdb0){var _0x1f4885=typeof _0x50d36a['offset']==='undefined'&&typeof _0x50d36a['limit']===_0xdabd('0x17');var _0x19b858=_0x32bdb0[_0xdabd('0x18')];var _0x2ec914=_0x1f4885?0x0:_0x50d36a[_0xdabd('0x19')];var _0x4499a7=_0x1f4885?_0x32bdb0[_0xdabd('0x18')]:_0x50d36a[_0xdabd('0x19')]+_0x50d36a[_0xdabd('0x1a')];var _0x2e1008;if(_0x4499a7>=_0x19b858){_0x4499a7=_0x19b858;_0x2e1008=0xc8;}else{_0x2e1008=0xce;}_0x5501a4['status'](_0x2e1008);return _0x5501a4[_0xdabd('0x1b')](_0xdabd('0x1c'),_0x2ec914+'-'+_0x4499a7+'/'+_0x19b858)[_0xdabd('0x16')](_0x32bdb0);}return null;};}function saveUpdates(_0x12a15a){return function(_0x3a71e3){if(_0x3a71e3){return _0x3a71e3[_0xdabd('0x1d')](_0x12a15a)['then'](function(_0x372daf){return _0x372daf;});}return null;};}function removeEntity(_0x2ba798){return function(_0x48b0ad){if(_0x48b0ad){return _0x48b0ad[_0xdabd('0x1e')]()[_0xdabd('0xa')](function(){_0x2ba798['status'](0xcc)[_0xdabd('0x1f')]();});}};}function handleEntityNotFound(_0x4bbc4a){return function(_0x1ff927){if(!_0x1ff927){_0x4bbc4a['sendStatus'](0x194);}return _0x1ff927;};}function handleError(_0x83acaa,_0x1123ab){_0x1123ab=_0x1123ab||0x1f4;return function(_0x3cfb0c){logger[_0xdabd('0x10')](_0x3cfb0c[_0xdabd('0x20')]);if(_0x3cfb0c[_0xdabd('0x21')]){delete _0x3cfb0c[_0xdabd('0x21')];}_0x83acaa['status'](_0x1123ab)[_0xdabd('0x22')](_0x3cfb0c);};}exports[_0xdabd('0x23')]=function(_0x51081b,_0x16562a){var _0x1d9f3c={},_0x192911={},_0x4799bf={'count':0x0,'rows':[]};var _0x2e25e7=_['map'](db['Network'][_0xdabd('0x24')],function(_0x1d91ca){return{'name':_0x1d91ca[_0xdabd('0x25')],'type':_0x1d91ca[_0xdabd('0x26')]['key']};});_0x192911[_0xdabd('0x27')]=_[_0xdabd('0x28')](_0x2e25e7,_0xdabd('0x21'));_0x192911[_0xdabd('0x29')]=_['keys'](_0x51081b[_0xdabd('0x29')]);_0x192911[_0xdabd('0x2a')]=_[_0xdabd('0x2b')](_0x192911['model'],_0x192911[_0xdabd('0x29')]);_0x1d9f3c[_0xdabd('0x2c')]=_['intersection'](_0x192911[_0xdabd('0x27')],qs['fields'](_0x51081b[_0xdabd('0x29')][_0xdabd('0x2d')]));_0x1d9f3c[_0xdabd('0x2c')]=_0x1d9f3c[_0xdabd('0x2c')][_0xdabd('0x2e')]?_0x1d9f3c[_0xdabd('0x2c')]:_0x192911['model'];if(!_0x51081b[_0xdabd('0x29')]['hasOwnProperty'](_0xdabd('0x2f'))){_0x1d9f3c['limit']=qs['limit'](_0x51081b[_0xdabd('0x29')][_0xdabd('0x1a')]);_0x1d9f3c[_0xdabd('0x19')]=qs[_0xdabd('0x19')](_0x51081b[_0xdabd('0x29')]['offset']);}_0x1d9f3c[_0xdabd('0x30')]=qs[_0xdabd('0x31')](_0x51081b[_0xdabd('0x29')][_0xdabd('0x31')]);_0x1d9f3c[_0xdabd('0x32')]=qs['filters'](_['pick'](_0x51081b[_0xdabd('0x29')],_0x192911[_0xdabd('0x2a')]),_0x2e25e7);if(_0x51081b['query'][_0xdabd('0x33')]){_0x1d9f3c['where']=_[_0xdabd('0x34')](_0x1d9f3c[_0xdabd('0x32')],{'$or':_[_0xdabd('0x28')](_0x2e25e7,function(_0x280e44){if(_0x280e44[_0xdabd('0x26')]!=='VIRTUAL'){var _0x4b7402={};_0x4b7402[_0x280e44[_0xdabd('0x21')]]={'$like':'%'+_0x51081b[_0xdabd('0x29')]['filter']+'%'};return _0x4b7402;}})});}_0x1d9f3c=_[_0xdabd('0x34')]({},_0x1d9f3c,_0x51081b[_0xdabd('0x35')]);var _0x6e7774={'where':_0x1d9f3c[_0xdabd('0x32')]};return db[_0xdabd('0x36')][_0xdabd('0x18')](_0x6e7774)[_0xdabd('0xa')](function(_0x1e32e3){_0x4799bf[_0xdabd('0x18')]=_0x1e32e3;if(_0x51081b['query'][_0xdabd('0x37')]){_0x1d9f3c['include']=[{'all':!![]}];}return db[_0xdabd('0x36')][_0xdabd('0x38')](_0x1d9f3c);})[_0xdabd('0xa')](function(_0x4ac2e6){_0x4799bf[_0xdabd('0x39')]=_0x4ac2e6;return _0x4799bf;})[_0xdabd('0xa')](respondWithFilteredResult(_0x16562a,_0x1d9f3c))[_0xdabd('0x14')](handleError(_0x16562a,null));};exports['show']=function(_0x4e8efd,_0x435eb2){var _0x35654e={'raw':!![],'where':{'id':_0x4e8efd[_0xdabd('0x3a')]['id']}},_0x41b74a={};_0x41b74a['model']=_[_0xdabd('0x3b')](db[_0xdabd('0x36')][_0xdabd('0x24')]);_0x41b74a[_0xdabd('0x29')]=_['keys'](_0x4e8efd['query']);_0x41b74a[_0xdabd('0x2a')]=_[_0xdabd('0x2b')](_0x41b74a[_0xdabd('0x27')],_0x41b74a['query']);_0x35654e['attributes']=_[_0xdabd('0x2b')](_0x41b74a[_0xdabd('0x27')],qs[_0xdabd('0x2d')](_0x4e8efd[_0xdabd('0x29')][_0xdabd('0x2d')]));_0x35654e['attributes']=_0x35654e[_0xdabd('0x2c')][_0xdabd('0x2e')]?_0x35654e['attributes']:_0x41b74a[_0xdabd('0x27')];if(_0x4e8efd['query'][_0xdabd('0x37')]){_0x35654e[_0xdabd('0x3c')]=[{'all':!![]}];}_0x35654e=_[_0xdabd('0x34')]({},_0x35654e,_0x4e8efd[_0xdabd('0x35')]);return db[_0xdabd('0x36')][_0xdabd('0x3d')](_0x35654e)['then'](handleEntityNotFound(_0x435eb2,null))[_0xdabd('0xa')](respondWithResult(_0x435eb2,null))['catch'](handleError(_0x435eb2,null));};exports[_0xdabd('0x3e')]=function(_0x356bc4,_0xb5a93b){var _0xb6cead;return db[_0xdabd('0x36')][_0xdabd('0x3e')](_0x356bc4[_0xdabd('0x3f')],{'raw':!![]})['then'](function(_0x26f2fc){_0xb6cead=_0x26f2fc;return db['Network']['findAll']({'where':{'type':_0x356bc4[_0xdabd('0x3f')]['type']},'raw':!![]});})[_0xdabd('0xa')](function(_0x1facda){if(_0xb6cead[_0xdabd('0x26')]['toUpperCase']()==_0xdabd('0x40')){var _0x25e580=fs['readFileSync'](path[_0xdabd('0x41')](config[_0xdabd('0x42')],_0xdabd('0x43')),_0xdabd('0x44'));var _0x1f14f4=ejs[_0xdabd('0x45')](_0x25e580,{'networks':_0x1facda||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1f14f4);return respondWithRpcPromise(_0xdabd('0x46'),_0xdabd('0x3e'),{'module':_0xdabd('0x47')});}else if(_0xb6cead[_0xdabd('0x26')][_0xdabd('0x48')]()==_0xdabd('0x49')){var _0x19f7ca=fs['readFileSync'](path[_0xdabd('0x41')](config[_0xdabd('0x42')],_0xdabd('0x4a')),'utf8');var _0x20f11b=ejs[_0xdabd('0x45')](_0x19f7ca,{'networks':_0x1facda||[]});fs[_0xdabd('0x4b')](_0xdabd('0x4c'),_0x20f11b);return respondWithRpcPromise('Reload',_0xdabd('0x3e'),{'module':_0xdabd('0x47')});}else{var _0xb5b5a5=fs[_0xdabd('0x4d')](path['join'](config[_0xdabd('0x42')],_0xdabd('0x4e')),_0xdabd('0x44'));var _0x363dfc=ejs[_0xdabd('0x45')](_0xb5b5a5,{'networks':_0x1facda||[]});fs[_0xdabd('0x4b')](util[_0xdabd('0x4f')](_0xdabd('0x50'),_0x356bc4[_0xdabd('0x3f')][_0xdabd('0x26')]['toLowerCase']()),_0x363dfc);return respondWithRpcPromise(_0xdabd('0x46'),_0xdabd('0x3e'),{'module':_0xdabd('0x51')});}})[_0xdabd('0xa')](function(){return _0xb6cead;})[_0xdabd('0xa')](respondWithResult(_0xb5a93b,0xc9))[_0xdabd('0x14')](handleError(_0xb5a93b,null));};exports[_0xdabd('0x1d')]=function(_0x5ac1e9,_0x14ac2c){var _0x3f95ce;return db[_0xdabd('0x36')][_0xdabd('0x3d')]({'where':{'id':_0x5ac1e9[_0xdabd('0x3a')]['id']}})[_0xdabd('0xa')](handleEntityNotFound(_0x14ac2c,null))[_0xdabd('0xa')](saveUpdates(_0x5ac1e9[_0xdabd('0x3f')],null))[_0xdabd('0xa')](function(_0x4a47df){if(_0x4a47df){_0x3f95ce=_0x4a47df;return db[_0xdabd('0x36')][_0xdabd('0x38')]({'where':{'type':_0x3f95ce[_0xdabd('0x26')]},'raw':!![]});}return null;})[_0xdabd('0xa')](function(_0x8c4956){if(_0x3f95ce[_0xdabd('0x26')][_0xdabd('0x48')]()=='STUN'){var _0x463f46=fs[_0xdabd('0x4d')](path['join'](config[_0xdabd('0x42')],_0xdabd('0x43')),_0xdabd('0x44'));var _0x3e6684=ejs[_0xdabd('0x45')](_0x463f46,{'networks':_0x8c4956||[]});fs[_0xdabd('0x4b')]('/etc/asterisk/stun_xcally.conf',_0x3e6684);return respondWithRpcPromise(_0xdabd('0x46'),'update',{'module':_0xdabd('0x47')});}else if(_0x3f95ce[_0xdabd('0x26')]['toUpperCase']()==_0xdabd('0x49')){var _0x5962e4=fs['readFileSync'](path[_0xdabd('0x41')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xdabd('0x44'));var _0x557594=ejs['render'](_0x5962e4,{'networks':_0x8c4956||[]});fs['writeFileSync'](_0xdabd('0x4c'),_0x557594);return respondWithRpcPromise(_0xdabd('0x46'),_0xdabd('0x1d'),{'module':_0xdabd('0x47')});}else{var _0x22f41f=fs['readFileSync'](path[_0xdabd('0x41')](config[_0xdabd('0x42')],_0xdabd('0x4e')),'utf8');var _0x15a094=ejs[_0xdabd('0x45')](_0x22f41f,{'networks':_0x8c4956||[]});fs[_0xdabd('0x4b')](util[_0xdabd('0x4f')](_0xdabd('0x50'),_0x5ac1e9[_0xdabd('0x3f')][_0xdabd('0x26')]['toLowerCase']()),_0x15a094);return respondWithRpcPromise(_0xdabd('0x46'),_0xdabd('0x1d'),{'module':_0xdabd('0x51')});}})[_0xdabd('0xa')](function(_0x1bb50b){if(_0x1bb50b){return _0x3f95ce;}return null;})['then'](respondWithResult(_0x14ac2c,null))[_0xdabd('0x14')](handleError(_0x14ac2c,null));};exports['destroy']=function(_0x561586,_0x24a33f){var _0x1be890;return db['Network']['find']({'where':{'id':_0x561586['params']['id']}})[_0xdabd('0xa')](function(_0x5d0932){_0x1be890=_0x5d0932;return _0x5d0932;})['then'](handleEntityNotFound(_0x24a33f,null))['then'](removeEntity(_0x24a33f,null))[_0xdabd('0xa')](function(){if(_0x1be890){return db[_0xdabd('0x36')][_0xdabd('0x38')]({'where':{'type':_0x1be890[_0xdabd('0x26')]},'raw':!![]});}})['then'](function(_0x24a53e){if(_0x1be890[_0xdabd('0x26')][_0xdabd('0x48')]()==_0xdabd('0x40')){var _0x4672bb=fs[_0xdabd('0x4d')](path['join'](config['root'],_0xdabd('0x43')),_0xdabd('0x44'));var _0xe149e3=ejs[_0xdabd('0x45')](_0x4672bb,{'networks':_0x24a53e||[]});fs[_0xdabd('0x4b')](_0xdabd('0x52'),_0xe149e3);return respondWithRpcPromise(_0xdabd('0x46'),_0xdabd('0x1e'),{'module':_0xdabd('0x47')});}else if(_0x1be890['type'][_0xdabd('0x48')]()==_0xdabd('0x49')){var _0x1ca27b=fs[_0xdabd('0x4d')](path[_0xdabd('0x41')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xdabd('0x44'));var _0x46ccb2=ejs['render'](_0x1ca27b,{'networks':_0x24a53e||[]});fs[_0xdabd('0x4b')](_0xdabd('0x4c'),_0x46ccb2);return respondWithRpcPromise('Reload','destroy',{'module':_0xdabd('0x47')});}else{var _0x2dc6c6=fs[_0xdabd('0x4d')](path[_0xdabd('0x41')](config[_0xdabd('0x42')],_0xdabd('0x4e')),'utf8');var _0x56c6f4=ejs[_0xdabd('0x45')](_0x2dc6c6,{'networks':_0x24a53e||[]});fs[_0xdabd('0x4b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1be890[_0xdabd('0x26')][_0xdabd('0x53')]()),_0x56c6f4);return respondWithRpcPromise(_0xdabd('0x46'),'destroy',{'module':'chan_sip.so'});}})[_0xdabd('0x14')](handleError(_0x24a33f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e501db3..8b8fdfa 100644 --- a/server/api/network/network.model.js +++ b/server/api/network/network.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x235a=['exports','Network','network','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x18ae4b,_0x3fccea){var _0x409b8b=function(_0x2d611c){while(--_0x2d611c){_0x18ae4b['push'](_0x18ae4b['shift']());}};_0x409b8b(++_0x3fccea);}(_0x235a,0x1ef));var _0xa235=function(_0x28aeb8,_0x219a45){_0x28aeb8=_0x28aeb8-0x0;var _0x54d600=_0x235a[_0x28aeb8];return _0x54d600;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))('api');var moment=require(_0xa235('0x3'));var BPromise=require('bluebird');var rp=require(_0xa235('0x4'));var fs=require('fs');var path=require(_0xa235('0x5'));var rimraf=require(_0xa235('0x6'));var config=require(_0xa235('0x7'));var attributes=require(_0xa235('0x8'));module[_0xa235('0x9')]=function(_0x2961c8,_0x1707fc){return _0x2961c8['define'](_0xa235('0xa'),attributes,{'tableName':_0xa235('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80df=['../../config/environment','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x80df,0x17e));var _0xf80d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x80df[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf80d('0x0'));var util=require(_0xf80d('0x1'));var logger=require(_0xf80d('0x2'))(_0xf80d('0x3'));var moment=require('moment');var BPromise=require(_0xf80d('0x4'));var rp=require(_0xf80d('0x5'));var fs=require('fs');var path=require(_0xf80d('0x6'));var rimraf=require(_0xf80d('0x7'));var config=require(_0xf80d('0x8'));var attributes=require(_0xf80d('0x9'));module[_0xf80d('0xa')]=function(_0xeffeb7,_0x1c9b19){return _0xeffeb7[_0xf80d('0xb')]('Network',attributes,{'tableName':_0xf80d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 9030ed7..9cca89f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x334652,_0x30114e){_0x334652=_0x334652-0x0;var _0x192aaf=_0x7a54[_0x334652];return _0x192aaf;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x12855d,_0x356626){_0x12855d=_0x12855d-0x0;var _0x47cfc3=_0x7a54[_0x12855d];return _0x47cfc3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index afea93d..7bbe066 100644 --- a/server/api/openchannelAccount/index.js +++ b/server/api/openchannelAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa457=['addAnswer','/:id/notify','notify','/:id/users','addAgents','send','put','/:id','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','post','create','addDisposition'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0xa457,0x1d4));var _0x7a45=function(_0x396134,_0x553aeb){_0x396134=_0x396134-0x0;var _0x463cd1=_0xa457[_0x396134];return _0x463cd1;};'use strict';var multer=require(_0x7a45('0x0'));var util=require(_0x7a45('0x1'));var path=require(_0x7a45('0x2'));var timeout=require('connect-timeout');var express=require(_0x7a45('0x3'));var router=express[_0x7a45('0x4')]();var fs_extra=require(_0x7a45('0x5'));var auth=require(_0x7a45('0x6'));var interaction=require(_0x7a45('0x7'));var config=require('../../config/environment');var controller=require(_0x7a45('0x8'));router[_0x7a45('0x9')]('/',auth[_0x7a45('0xa')](),controller['index']);router[_0x7a45('0x9')](_0x7a45('0xb'),auth[_0x7a45('0xa')](),controller[_0x7a45('0xc')]);router[_0x7a45('0x9')]('/:id',auth[_0x7a45('0xa')](),controller['show']);router[_0x7a45('0x9')](_0x7a45('0xd'),auth['isAuthenticated'](),controller[_0x7a45('0xe')]);router[_0x7a45('0x9')](_0x7a45('0xf'),auth[_0x7a45('0xa')](),controller['getAnswers']);router[_0x7a45('0x9')](_0x7a45('0x10'),auth['isAuthenticated'](),controller[_0x7a45('0x11')]);router[_0x7a45('0x9')](_0x7a45('0x12'),auth[_0x7a45('0xa')](),controller['getInteractions']);router['get']('/:id/users',auth[_0x7a45('0xa')](),controller['getAgents']);router[_0x7a45('0x13')]('/',auth[_0x7a45('0xa')](),controller[_0x7a45('0x14')]);router[_0x7a45('0x13')]('/:id/dispositions',auth[_0x7a45('0xa')](),controller[_0x7a45('0x15')]);router[_0x7a45('0x13')](_0x7a45('0xf'),auth['isAuthenticated'](),controller[_0x7a45('0x16')]);router['post'](_0x7a45('0x17'),controller[_0x7a45('0x18')]);router[_0x7a45('0x13')](_0x7a45('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x7a45('0x13')](_0x7a45('0x19'),auth['isAuthenticated'](),controller[_0x7a45('0x1a')]);router[_0x7a45('0x13')]('/:id/send',auth[_0x7a45('0xa')](),controller[_0x7a45('0x1b')]);router[_0x7a45('0x1c')](_0x7a45('0x1d'),auth[_0x7a45('0xa')](),controller[_0x7a45('0x1e')]);router[_0x7a45('0x1f')]('/:id',auth[_0x7a45('0xa')](),controller[_0x7a45('0x20')]);router[_0x7a45('0x1f')](_0x7a45('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7a45('0x1f')](_0x7a45('0xf'),auth[_0x7a45('0xa')](),controller['removeAnswers']);router[_0x7a45('0x1f')]('/:id/users',auth[_0x7a45('0xa')](),controller[_0x7a45('0x21')]);module[_0x7a45('0x22')]=router; \ No newline at end of file +var _0xd9d8=['removeDispositions','removeAnswers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','/:id/applications','addAgents','/:id/send','send','destroy','delete'];(function(_0x1ac862,_0xb70bc){var _0x1aab58=function(_0xc1aba5){while(--_0xc1aba5){_0x1ac862['push'](_0x1ac862['shift']());}};_0x1aab58(++_0xb70bc);}(_0xd9d8,0x161));var _0x8d9d=function(_0xe3f360,_0x203484){_0xe3f360=_0xe3f360-0x0;var _0x4b6d3d=_0xd9d8[_0xe3f360];return _0x4b6d3d;};'use strict';var multer=require(_0x8d9d('0x0'));var util=require(_0x8d9d('0x1'));var path=require(_0x8d9d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d9d('0x3'));var interaction=require(_0x8d9d('0x4'));var config=require(_0x8d9d('0x5'));var controller=require(_0x8d9d('0x6'));router[_0x8d9d('0x7')]('/',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x9')]);router['get'](_0x8d9d('0xa'),auth[_0x8d9d('0x8')](),controller['describe']);router[_0x8d9d('0x7')](_0x8d9d('0xb'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0xc')]);router[_0x8d9d('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8d9d('0xd')]);router[_0x8d9d('0x7')](_0x8d9d('0xe'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0xf')]);router[_0x8d9d('0x7')]('/:id/applications',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x10')]);router['get'](_0x8d9d('0x11'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x12')]);router[_0x8d9d('0x7')](_0x8d9d('0x13'),auth[_0x8d9d('0x8')](),controller['getAgents']);router[_0x8d9d('0x14')]('/',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x15')]);router[_0x8d9d('0x14')](_0x8d9d('0x16'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x17')]);router[_0x8d9d('0x14')](_0x8d9d('0xe'),auth[_0x8d9d('0x8')](),controller['addAnswer']);router[_0x8d9d('0x14')](_0x8d9d('0x18'),controller[_0x8d9d('0x19')]);router['post'](_0x8d9d('0x1a'),auth[_0x8d9d('0x8')](),controller['addApplications']);router['post']('/:id/users',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x1b')]);router[_0x8d9d('0x14')](_0x8d9d('0x1c'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x1d')]);router['put'](_0x8d9d('0xb'),auth[_0x8d9d('0x8')](),controller['update']);router['delete']('/:id',auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x1e')]);router[_0x8d9d('0x1f')](_0x8d9d('0x16'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x20')]);router[_0x8d9d('0x1f')](_0x8d9d('0xe'),auth[_0x8d9d('0x8')](),controller[_0x8d9d('0x21')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x8d9d('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index beb1304..d0ff426 100644 --- a/server/api/openchannelAccount/openchannelAccount.attributes.js +++ b/server/api/openchannelAccount/openchannelAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36e5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4841b0,_0x12ba5d){var _0xc8064c=function(_0x29d943){while(--_0x29d943){_0x4841b0['push'](_0x4841b0['shift']());}};_0xc8064c(++_0x12ba5d);}(_0x36e5,0xbd));var _0x536e=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x36e5[_0xe1441d];return _0x2ef242;};'use strict';var Sequelize=require(_0x536e('0x0'));var rs=require('randomstring');module[_0x536e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x536e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x536e('0x3')]},'token':{'type':Sequelize[_0x536e('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x536e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x536e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x536e('0x4')],'defaultValue':function(){return _0x536e('0x5');}},'notificationSound':{'type':Sequelize[_0x536e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x536e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x536e('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x536e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x536e('0x6')],'defaultValue':![],'comment':_0x536e('0x9'),'set':function(_0x1997b){if(!_0x1997b)this[_0x536e('0xa')](_0x536e('0xb'),null);this[_0x536e('0xa')](_0x536e('0xc'),_0x1997b);}}}; \ No newline at end of file +var _0xc566=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc566,0x189));var _0x6c56=function(_0x306268,_0x5a0cf8){_0x306268=_0x306268-0x0;var _0x374ae4=_0xc566[_0x306268];return _0x374ae4;};'use strict';var Sequelize=require(_0x6c56('0x0'));var rs=require(_0x6c56('0x1'));module[_0x6c56('0x2')]={'name':{'type':Sequelize[_0x6c56('0x3')],'unique':_0x6c56('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x6c56('0x3')]},'token':{'type':Sequelize[_0x6c56('0x3')],'defaultValue':function(){return rs[_0x6c56('0x5')]();}},'replyUri':{'type':Sequelize[_0x6c56('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6c56('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6c56('0x6')],'defaultValue':function(){return _0x6c56('0x7');}},'notificationSound':{'type':Sequelize[_0x6c56('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c56('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c56('0x3')]},'queueTransfer':{'type':Sequelize[_0x6c56('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c56('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c56('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0x6c56('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6c56('0xb'),'set':function(_0x43885b){if(!_0x43885b)this[_0x6c56('0xc')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x43885b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b8847c3..f45c125 100644 --- a/server/api/openchannelAccount/openchannelAccount.controller.js +++ b/server/api/openchannelAccount/openchannelAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8137=['client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','OpenchannelAccount','findAll','rows','catch','show','keys','include','options','create','body','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','Sequelize','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','eml-format','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise'];(function(_0x3673f3,_0x1c9cb5){var _0x327920=function(_0x53e432){while(--_0x53e432){_0x3673f3['push'](_0x3673f3['shift']());}};_0x327920(++_0x1c9cb5);}(_0x8137,0x16b));var _0x7813=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x8137[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x7813('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7813('0x1'));var BPromise=require(_0x7813('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7813('0x3'));var ejs=require(_0x7813('0x4'));var fs=require('fs');var fs_extra=require(_0x7813('0x5'));var _=require(_0x7813('0x6'));var squel=require(_0x7813('0x7'));var crypto=require(_0x7813('0x8'));var jsforce=require(_0x7813('0x9'));var deskjs=require(_0x7813('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7813('0xb'));var authService=require(_0x7813('0xc'));var qs=require(_0x7813('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7813('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7813('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x7813('0x10'))['db'];config[_0x7813('0x11')]=_[_0x7813('0x12')](config[_0x7813('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x7813('0x13'))(new Redis(config[_0x7813('0x11')]));require(_0x7813('0x14'))[_0x7813('0x15')](socket);var jayson=require(_0x7813('0x16'));var client=jayson[_0x7813('0x17')][_0x7813('0x18')]({'port':0x232c});var client9002=jayson[_0x7813('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24284b,_0x854b52,_0xbe5f29,_0x2e7e32){return new BPromise(function(_0x50dde1,_0x297349){var _0x2235a2=_0x2e7e32||client;return _0x2235a2[_0x7813('0x19')](_0x24284b,_0xbe5f29)['then'](function(_0x2cdb30){logger['info'](_0x7813('0x1a'),_0x854b52,_0x7813('0x1b'));logger[_0x7813('0x1c')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x854b52,'request\x20sent',JSON[_0x7813('0x1d')](_0x2cdb30));if(_0x2cdb30[_0x7813('0x1e')]){if(_0x2cdb30[_0x7813('0x1e')][_0x7813('0x1f')]===0x1f4){logger[_0x7813('0x1e')](_0x7813('0x1a'),_0x854b52,_0x2cdb30[_0x7813('0x1e')][_0x7813('0x20')]);return _0x297349(_0x2cdb30[_0x7813('0x1e')]['message']);}logger[_0x7813('0x1e')](_0x7813('0x1a'),_0x854b52,_0x2cdb30[_0x7813('0x1e')][_0x7813('0x20')]);return _0x50dde1(_0x2cdb30[_0x7813('0x1e')]['message']);}else{logger['info'](_0x7813('0x1a'),_0x854b52,'request\x20sent');_0x50dde1(_0x2cdb30[_0x7813('0x21')][_0x7813('0x20')]);}})['catch'](function(_0x988ea6){logger[_0x7813('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x854b52,_0x988ea6);_0x297349(_0x988ea6);});});}function respondWithStatusCode(_0x27d212,_0x28e03f){_0x28e03f=_0x28e03f||0xcc;return function(_0xc6b7b6){if(_0xc6b7b6){return _0x27d212[_0x7813('0x22')](_0x28e03f);}return _0x27d212[_0x7813('0x23')](_0x28e03f)[_0x7813('0x24')]();};}function respondWithResult(_0x592538,_0x1051f4){_0x1051f4=_0x1051f4||0xc8;return function(_0x1e8460){if(_0x1e8460){return _0x592538[_0x7813('0x23')](_0x1051f4)[_0x7813('0x25')](_0x1e8460);}};}function respondWithFilteredResult(_0x1ea7f9,_0x8d3b87){return function(_0x507c54){if(_0x507c54){var _0x2ac976=typeof _0x8d3b87['offset']===_0x7813('0x26')&&typeof _0x8d3b87[_0x7813('0x27')]===_0x7813('0x26');var _0x392635=_0x507c54[_0x7813('0x28')];var _0x3ef104=_0x2ac976?0x0:_0x8d3b87['offset'];var _0x21e954=_0x2ac976?_0x507c54[_0x7813('0x28')]:_0x8d3b87[_0x7813('0x29')]+_0x8d3b87['limit'];var _0x492420;if(_0x21e954>=_0x392635){_0x21e954=_0x392635;_0x492420=0xc8;}else{_0x492420=0xce;}_0x1ea7f9[_0x7813('0x23')](_0x492420);return _0x1ea7f9[_0x7813('0x2a')](_0x7813('0x2b'),_0x3ef104+'-'+_0x21e954+'/'+_0x392635)[_0x7813('0x25')](_0x507c54);}return null;};}function patchUpdates(_0x50d351){return function(_0x141662){try{jsonpatch[_0x7813('0x2c')](_0x141662,_0x50d351,!![]);}catch(_0x1d4b27){return BPromise[_0x7813('0x2d')](_0x1d4b27);}return _0x141662[_0x7813('0x2e')]();};}function saveUpdates(_0x5233c5,_0xb87dde){return function(_0x47dfe0){if(_0x47dfe0){return _0x47dfe0[_0x7813('0x2f')](_0x5233c5)[_0x7813('0x30')](function(_0x170990){return _0x170990;});}return null;};}function removeEntity(_0x15fce2,_0x1ec053){return function(_0x412540){if(_0x412540){return _0x412540[_0x7813('0x31')]()[_0x7813('0x30')](function(){var _0x10c0ee=_0x412540[_0x7813('0x32')]({'plain':!![]});var _0x19bd33=_0x7813('0x33');return db[_0x7813('0x34')][_0x7813('0x31')]({'where':{'type':_0x19bd33,'resourceId':_0x10c0ee['id']}})[_0x7813('0x30')](function(){return _0x412540;});})[_0x7813('0x30')](function(){_0x15fce2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7697,_0x4b4a6f){return function(_0x598ae1){if(!_0x598ae1){_0x4c7697[_0x7813('0x22')](0x194);}return _0x598ae1;};}function handleError(_0x475068,_0xf0972b){_0xf0972b=_0xf0972b||0x1f4;return function(_0x16e9b5){logger['error'](_0x16e9b5[_0x7813('0x35')]);if(_0x16e9b5['name']){delete _0x16e9b5['name'];}_0x475068[_0x7813('0x23')](_0xf0972b)['send'](_0x16e9b5);};}exports[_0x7813('0x36')]=function(_0x5aebe4,_0x2a6e3c){var _0x1bd93e={'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]},_0x47b4ef={},_0x43c164={'count':0x0,'rows':[]};var _0x25efeb=_[_0x7813('0x39')](db['OpenchannelAccount'][_0x7813('0x3a')],function(_0x3dd99f){return{'name':_0x3dd99f[_0x7813('0x3b')],'type':_0x3dd99f[_0x7813('0x3c')][_0x7813('0x3d')]};});_0x47b4ef[_0x7813('0x3e')]=_[_0x7813('0x39')](_0x25efeb,_0x7813('0x3f'));_0x47b4ef[_0x7813('0x40')]=_['keys'](_0x5aebe4[_0x7813('0x40')]);_0x47b4ef[_0x7813('0x41')]=_[_0x7813('0x42')](_0x47b4ef[_0x7813('0x3e')],_0x47b4ef[_0x7813('0x40')]);_0x1bd93e[_0x7813('0x43')]=_[_0x7813('0x42')](_0x47b4ef[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x44')]));_0x1bd93e[_0x7813('0x43')]=_0x1bd93e[_0x7813('0x43')][_0x7813('0x45')]?_0x1bd93e['attributes']:_0x47b4ef['model'];if(!_0x5aebe4[_0x7813('0x40')]['hasOwnProperty']('nolimit')){_0x1bd93e[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x27')]);_0x1bd93e['offset']=qs[_0x7813('0x29')](_0x5aebe4[_0x7813('0x40')]['offset']);}_0x1bd93e[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x5aebe4[_0x7813('0x40')][_0x7813('0x47')]);_0x1bd93e[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x5aebe4[_0x7813('0x40')],_0x47b4ef[_0x7813('0x41')]),_0x25efeb);if(_0x5aebe4[_0x7813('0x40')][_0x7813('0x4a')]){_0x1bd93e[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x1bd93e[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x25efeb,function(_0x10d4b0){if(_0x10d4b0[_0x7813('0x3c')]!==_0x7813('0x4c')){var _0x2d7ba8={};_0x2d7ba8[_0x10d4b0[_0x7813('0x3f')]]={'$like':'%'+_0x5aebe4['query'][_0x7813('0x4a')]+'%'};return _0x2d7ba8;}})});}_0x1bd93e=_[_0x7813('0x4b')]({},_0x1bd93e,_0x5aebe4['options']);var _0x51e67c={'where':_0x1bd93e[_0x7813('0x48')]};return db['OpenchannelAccount'][_0x7813('0x28')](_0x51e67c)[_0x7813('0x30')](function(_0x4a69e1){_0x43c164[_0x7813('0x28')]=_0x4a69e1;if(_0x5aebe4['query'][_0x7813('0x4d')]){_0x1bd93e['include']=[{'all':!![]}];}return db[_0x7813('0x4e')][_0x7813('0x4f')](_0x1bd93e);})[_0x7813('0x30')](function(_0x547675){_0x43c164[_0x7813('0x50')]=_0x547675;return _0x43c164;})['then'](respondWithFilteredResult(_0x2a6e3c,_0x1bd93e))[_0x7813('0x51')](handleError(_0x2a6e3c,null));};exports[_0x7813('0x52')]=function(_0x34e5c7,_0x32153e){var _0x3939cc={'raw':![],'where':{'id':_0x34e5c7['params']['id']},'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]},_0x1c4dc7={};_0x1c4dc7[_0x7813('0x3e')]=_['keys'](db[_0x7813('0x4e')][_0x7813('0x3a')]);_0x1c4dc7[_0x7813('0x40')]=_[_0x7813('0x53')](_0x34e5c7['query']);_0x1c4dc7['filters']=_[_0x7813('0x42')](_0x1c4dc7[_0x7813('0x3e')],_0x1c4dc7['query']);_0x3939cc[_0x7813('0x43')]=_['intersection'](_0x1c4dc7['model'],qs[_0x7813('0x44')](_0x34e5c7['query'][_0x7813('0x44')]));_0x3939cc[_0x7813('0x43')]=_0x3939cc[_0x7813('0x43')][_0x7813('0x45')]?_0x3939cc[_0x7813('0x43')]:_0x1c4dc7[_0x7813('0x3e')];if(_0x34e5c7['query'][_0x7813('0x4d')]){_0x3939cc[_0x7813('0x54')]=[{'all':!![]}];}_0x3939cc=_['merge']({},_0x3939cc,_0x34e5c7[_0x7813('0x55')]);return db['OpenchannelAccount']['find'](_0x3939cc)['then'](handleEntityNotFound(_0x32153e,null))[_0x7813('0x30')](respondWithResult(_0x32153e,null))[_0x7813('0x51')](handleError(_0x32153e,null));};exports[_0x7813('0x56')]=function(_0x48cfb0,_0x20f788){return db[_0x7813('0x4e')][_0x7813('0x56')](_0x48cfb0[_0x7813('0x57')],{})[_0x7813('0x30')](function(_0x25e2e9){var _0x451fbd=_0x48cfb0[_0x7813('0x58')][_0x7813('0x32')]({'plain':!![]});if(!_0x451fbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x451fbd[_0x7813('0x59')]===_0x7813('0x58')){var _0x4c1d21=_0x25e2e9[_0x7813('0x32')]({'plain':!![]});var _0x4d93b8=_0x7813('0x33');return db['UserProfileSection'][_0x7813('0x5a')]({'where':{'name':_0x4d93b8,'userProfileId':_0x451fbd['userProfileId']},'raw':!![]})[_0x7813('0x30')](function(_0x299ca1){if(_0x299ca1&&_0x299ca1[_0x7813('0x5b')]===0x0){return db['UserProfileResource'][_0x7813('0x56')]({'name':_0x4c1d21[_0x7813('0x3f')],'resourceId':_0x4c1d21['id'],'type':_0x299ca1[_0x7813('0x3f')],'sectionId':_0x299ca1['id']},{})[_0x7813('0x30')](function(){return _0x25e2e9;});}else{return _0x25e2e9;}})[_0x7813('0x51')](function(_0x575d92){logger[_0x7813('0x1e')](_0x7813('0x5c'),_0x575d92);throw _0x575d92;});}return _0x25e2e9;})['then'](respondWithResult(_0x20f788,0xc9))[_0x7813('0x51')](handleError(_0x20f788,null));};exports[_0x7813('0x2f')]=function(_0x38c5cc,_0x1a2d19){if(_0x38c5cc[_0x7813('0x57')]['id']){delete _0x38c5cc[_0x7813('0x57')]['id'];}return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x38c5cc[_0x7813('0x5d')]['id']},'include':[{'model':db[_0x7813('0x37')],'as':_0x7813('0x38')}]})['then'](handleEntityNotFound(_0x1a2d19,null))[_0x7813('0x30')](saveUpdates(_0x38c5cc[_0x7813('0x57')],null))[_0x7813('0x30')](respondWithResult(_0x1a2d19,null))['catch'](handleError(_0x1a2d19,null));};exports[_0x7813('0x31')]=function(_0xe190d9,_0xe8fa8f){return db[_0x7813('0x4e')]['find']({'where':{'id':_0xe190d9[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xe8fa8f,null))['then'](removeEntity(_0xe8fa8f,null))[_0x7813('0x51')](handleError(_0xe8fa8f,null));};exports[_0x7813('0x5e')]=function(_0x1f377a,_0x2bc40e){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0x2bc40e,null))['catch'](handleError(_0x2bc40e,null));};exports[_0x7813('0x5f')]=function(_0x3d0169,_0x4132d3,_0x22aa8b){if(_0x3d0169[_0x7813('0x57')]['id']){delete _0x3d0169[_0x7813('0x57')]['id'];}return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x3d0169['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x4132d3,null))['then'](function(_0x427b5e){if(_0x427b5e){_0x3d0169['body'][_0x7813('0x60')]=_0x427b5e['id'];return db[_0x7813('0x61')][_0x7813('0x56')](_0x3d0169[_0x7813('0x57')]);}})[_0x7813('0x30')](respondWithResult(_0x4132d3,null))['catch'](handleError(_0x4132d3,null));};exports[_0x7813('0x62')]=function(_0x1ffed4,_0xb69913,_0xb37ccf){var _0x15d22d={'raw':![],'where':{}};var _0x351b58={};var _0x56474e={'count':0x0,'rows':[]};return db[_0x7813('0x4e')]['findOne']({'where':{'id':_0x1ffed4['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xb69913,null))[_0x7813('0x30')](function(_0x51d19f){if(_0x51d19f){_0x351b58[_0x7813('0x3e')]=_[_0x7813('0x53')](db['Disposition'][_0x7813('0x3a')]);_0x351b58[_0x7813('0x40')]=_[_0x7813('0x53')](_0x1ffed4['query']);_0x351b58[_0x7813('0x41')]=_['intersection'](_0x351b58['model'],_0x351b58[_0x7813('0x40')]);_0x15d22d[_0x7813('0x43')]=_['intersection'](_0x351b58[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x1ffed4[_0x7813('0x40')][_0x7813('0x44')]));_0x15d22d[_0x7813('0x43')]=_0x15d22d['attributes']['length']?_0x15d22d[_0x7813('0x43')]:_0x351b58[_0x7813('0x3e')];if(!_0x1ffed4[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x15d22d['limit']=qs['limit'](_0x1ffed4[_0x7813('0x40')]['limit']);_0x15d22d[_0x7813('0x29')]=qs['offset'](_0x1ffed4[_0x7813('0x40')]['offset']);}_0x15d22d[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x1ffed4[_0x7813('0x40')][_0x7813('0x47')]);_0x15d22d['where']=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x1ffed4[_0x7813('0x40')],_0x351b58[_0x7813('0x41')]));_0x15d22d[_0x7813('0x48')]['OpenchannelAccountId']=_0x51d19f['id'];if(_0x1ffed4['query'][_0x7813('0x4a')]){_0x15d22d[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x15d22d[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x15d22d[_0x7813('0x43')],function(_0x5527ca){var _0x21a270={};_0x21a270[_0x5527ca]={'$like':'%'+_0x1ffed4[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x21a270;})});}_0x15d22d=_['merge']({},_0x15d22d,_0x1ffed4[_0x7813('0x55')]);return db[_0x7813('0x61')]['count']({'where':_0x15d22d[_0x7813('0x48')]})['then'](function(_0x2efea9){_0x56474e[_0x7813('0x28')]=_0x2efea9;if(_0x1ffed4[_0x7813('0x40')]['includeAll']){_0x15d22d['include']=[{'all':!![]}];}return db[_0x7813('0x61')][_0x7813('0x4f')](_0x15d22d);})[_0x7813('0x30')](function(_0x114ab2){_0x56474e['rows']=_0x114ab2;return _0x56474e;});}})[_0x7813('0x30')](respondWithFilteredResult(_0xb69913,_0x15d22d))[_0x7813('0x51')](handleError(_0xb69913,null));};exports['removeDispositions']=function(_0x1acef3,_0x1af10f,_0x4e325d){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x1acef3['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x1af10f,null))[_0x7813('0x30')](function(_0x3fd2b4){if(_0x3fd2b4){return _0x3fd2b4[_0x7813('0x65')](_0x1acef3['query'][_0x7813('0x66')]);}})[_0x7813('0x30')](respondWithStatusCode(_0x1af10f,null))['catch'](handleError(_0x1af10f,null));};exports[_0x7813('0x67')]=function(_0x4d0c77,_0x367ed6,_0xe427cb){if(_0x4d0c77['body']['id']){delete _0x4d0c77[_0x7813('0x57')]['id'];}return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x4d0c77[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x367ed6,null))[_0x7813('0x30')](function(_0x133733){if(_0x133733){_0x4d0c77['body'][_0x7813('0x60')]=_0x133733['id'];return db[_0x7813('0x68')][_0x7813('0x56')](_0x4d0c77[_0x7813('0x57')]);}})[_0x7813('0x30')](respondWithResult(_0x367ed6,null))[_0x7813('0x51')](handleError(_0x367ed6,null));};exports[_0x7813('0x69')]=function(_0x136b18,_0x5bed72,_0x547b4b){var _0x41703b={'raw':![],'where':{}};var _0x2293fe={};var _0x448258={'count':0x0,'rows':[]};return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x136b18[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x5bed72,null))[_0x7813('0x30')](function(_0x1b987b){if(_0x1b987b){_0x2293fe[_0x7813('0x3e')]=_[_0x7813('0x53')](db[_0x7813('0x68')][_0x7813('0x3a')]);_0x2293fe[_0x7813('0x40')]=_[_0x7813('0x53')](_0x136b18['query']);_0x2293fe['filters']=_['intersection'](_0x2293fe[_0x7813('0x3e')],_0x2293fe[_0x7813('0x40')]);_0x41703b[_0x7813('0x43')]=_[_0x7813('0x42')](_0x2293fe[_0x7813('0x3e')],qs['fields'](_0x136b18[_0x7813('0x40')][_0x7813('0x44')]));_0x41703b['attributes']=_0x41703b[_0x7813('0x43')][_0x7813('0x45')]?_0x41703b['attributes']:_0x2293fe[_0x7813('0x3e')];if(!_0x136b18[_0x7813('0x40')]['hasOwnProperty'](_0x7813('0x64'))){_0x41703b['limit']=qs['limit'](_0x136b18[_0x7813('0x40')][_0x7813('0x27')]);_0x41703b[_0x7813('0x29')]=qs[_0x7813('0x29')](_0x136b18['query'][_0x7813('0x29')]);}_0x41703b[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x136b18[_0x7813('0x40')][_0x7813('0x47')]);_0x41703b[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x136b18[_0x7813('0x40')],_0x2293fe[_0x7813('0x41')]));_0x41703b[_0x7813('0x48')][_0x7813('0x60')]=_0x1b987b['id'];if(_0x136b18['query']['filter']){_0x41703b[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x41703b[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x41703b[_0x7813('0x43')],function(_0x27d2f9){var _0x9cdd95={};_0x9cdd95[_0x27d2f9]={'$like':'%'+_0x136b18[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x9cdd95;})});}_0x41703b=_[_0x7813('0x4b')]({},_0x41703b,_0x136b18[_0x7813('0x55')]);return db[_0x7813('0x68')][_0x7813('0x28')]({'where':_0x41703b[_0x7813('0x48')]})[_0x7813('0x30')](function(_0x25c473){_0x448258[_0x7813('0x28')]=_0x25c473;if(_0x136b18[_0x7813('0x40')][_0x7813('0x4d')]){_0x41703b['include']=[{'all':!![]}];}return db[_0x7813('0x68')]['findAll'](_0x41703b);})[_0x7813('0x30')](function(_0x3b85dd){_0x448258['rows']=_0x3b85dd;return _0x448258;});}})[_0x7813('0x30')](respondWithFilteredResult(_0x5bed72,_0x41703b))[_0x7813('0x51')](handleError(_0x5bed72,null));};exports[_0x7813('0x6b')]=function(_0xa6a253,_0x54717a,_0x12416b){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0xa6a253[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x54717a,null))[_0x7813('0x30')](function(_0x20a69f){if(_0x20a69f){return _0x20a69f[_0x7813('0x6b')](_0xa6a253[_0x7813('0x40')][_0x7813('0x66')]);}})[_0x7813('0x30')](respondWithStatusCode(_0x54717a,null))['catch'](handleError(_0x54717a,null));};exports[_0x7813('0x6c')]=function(_0x5b8c5f,_0x366e7c,_0x5d0a6b){var _0x48da6e={'body':_0x5b8c5f[_0x7813('0x57')],'channel':_0x7813('0x6d')};var _0x3c773f=[];var _0x17843c=[];var _0x388b3a={};var _0x3840a7=![];return db['CmContact'][_0x7813('0x5e')]()[_0x7813('0x30')](function(_0xc3c03f){if(!_0xc3c03f){throw new db[(_0x7813('0x6e'))]['ValidationError']('no\x20available\x20attributes');}_0x3c773f=_['difference'](_[_0x7813('0x53')](_0xc3c03f),[_0x7813('0x6f'),_0x7813('0x70')]);_0x17843c=_[_0x7813('0x71')](_['keys'](_0xc3c03f),[_0x7813('0x6f'),_0x7813('0x70'),_0x7813('0x72'),_0x7813('0x73')]);if(_0x5b8c5f[_0x7813('0x57')]['id']){delete _0x5b8c5f[_0x7813('0x57')]['id'];}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')])){throw new db[(_0x7813('0x6e'))]['ValidationError'](_0x7813('0x76'));}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x57')])||_0x5b8c5f['body'][_0x7813('0x57')]===''){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7813('0x74')](_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')])){throw new db['Sequelize'][(_0x7813('0x77'))](_0x7813('0x79')+_0x17843c);}if(!_[_0x7813('0x7a')](_0x17843c,_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')])){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))](_0x7813('0x7b')+_0x17843c);}_0x388b3a[_0x5b8c5f[_0x7813('0x57')][_0x7813('0x78')]]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')];})[_0x7813('0x30')](function(){return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x5b8c5f[_0x7813('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0x7813('0x7c'),'include':[{'model':db[_0x7813('0x7d')],'as':_0x7813('0x7e'),'where':_0x388b3a,'limit':0x1,'order':[[_0x7813('0x70'),_0x7813('0x7f')]]}]},{'model':db[_0x7813('0x80')],'as':_0x7813('0x81')}]});})['then'](handleEntityNotFound(_0x366e7c,null))[_0x7813('0x30')](function(_0x20b2e5){if(_0x20b2e5&&_0x20b2e5[_0x7813('0x7c')]){_0x48da6e[_0x7813('0x82')]=_0x20b2e5;_0x48da6e[_0x7813('0x83')]=_0x20b2e5[_0x7813('0x81')];_0x48da6e['list']=_0x20b2e5[_0x7813('0x7c')];_0x48da6e['applications']=_[_0x7813('0x84')](_0x48da6e['applications'],['priority'],[_0x7813('0x85')]);if(_0x48da6e['account'][_0x7813('0x81')]){delete _0x48da6e[_0x7813('0x82')][_0x7813('0x81')];}if(_0x48da6e[_0x7813('0x82')][_0x7813('0x7c')]&&_0x48da6e[_0x7813('0x82')][_0x7813('0x7c')][_0x7813('0x7e')][_0x7813('0x45')]){return _0x48da6e[_0x7813('0x82')][_0x7813('0x7c')]['Contacts'][0x0];}var _0x199932=_[_0x7813('0x12')](_0x5b8c5f[_0x7813('0x57')],{'firstName':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')],'ListId':_0x20b2e5[_0x7813('0x73')]});_0x199932[_0x5b8c5f[_0x7813('0x57')]['mapKey']]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x75')];return db[_0x7813('0x7d')][_0x7813('0x56')](_0x199932,{'fields':_0x3c773f,'raw':!![]});}})[_0x7813('0x30')](handleEntityNotFound(_0x366e7c,null))[_0x7813('0x30')](function(_0x1cae9d){_0x48da6e[_0x7813('0x86')]=_0x1cae9d;if(_0x1cae9d){var _0x22c824={'ContactId':_0x1cae9d['id'],'OpenchannelAccountId':_0x5b8c5f['params']['id'],'from':(_0x1cae9d[_0x7813('0x87')]||'')+'\x20'+(_0x1cae9d[_0x7813('0x88')]||'')};var _0x599f59={'OpenchannelAccountId':_0x5b8c5f[_0x7813('0x5d')]['id'],'closed':![]};if(_0x5b8c5f['body'][_0x7813('0x89')]){_0x599f59[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x89')];return db[_0x7813('0x8a')]['find']({'where':_0x599f59})['then'](function(_0x160a6f){if(_0x160a6f){return[_0x160a6f,![]];}_0x22c824[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')]['threadId'];_0x22c824[_0x7813('0x8b')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x8b')];return db['OpenchannelInteraction'][_0x7813('0x56')](_0x22c824)[_0x7813('0x30')](function(_0x5ec0f1){return[_0x5ec0f1,!![]];});});}else{_0x599f59[_0x7813('0x89')]=null;}_0x599f59[_0x7813('0x8c')]=_0x1cae9d['id'];return db[_0x7813('0x8a')][_0x7813('0x5a')]({'where':_0x599f59})[_0x7813('0x30')](function(_0xdce55){if(_0xdce55){return[_0xdce55,![]];}return db['OpenchannelInteraction'][_0x7813('0x56')](_0x22c824)['then'](function(_0x1176f8){return[_0x1176f8,!![]];});});}})['spread'](function(_0xb2a637,_0x30f2cc){if(_0xb2a637){_0x3840a7=_0x30f2cc;if(!_0x30f2cc){var _0x3bcf24={'from':(_0x48da6e['contact'][_0x7813('0x87')]||'')+'\x20'+(_0x48da6e['contact'][_0x7813('0x88')]||'')};if(_0x5b8c5f['body'][_0x7813('0x89')]&&_0x5b8c5f['body']['messageId']&&_0x5b8c5f[_0x7813('0x57')][_0x7813('0x89')]!=_0x5b8c5f[_0x7813('0x57')]['messageId']){_0x3bcf24[_0x7813('0x89')]=_0x5b8c5f[_0x7813('0x57')][_0x7813('0x8d')];}return _0xb2a637['update'](_0x3bcf24);}else{return _0xb2a637;}}})[_0x7813('0x30')](function(_0x2b8882){_0x48da6e[_0x7813('0x8e')]=_0x2b8882['get']({'plain':!![]});_0x48da6e['interaction'][_0x7813('0x8f')]=_0x3840a7;if(_0x48da6e[_0x7813('0x8e')]['created']){if(_0x48da6e[_0x7813('0x82')][_0x7813('0x90')]){_0x48da6e[_0x7813('0x83')][_0x7813('0x91')]({'id':0x0,'priority':_0x48da6e[_0x7813('0x83')]['length']+0x1,'app':'close','appdata':_0x7813('0x92'),'interval':'*,*,*,*'});}}return db[_0x7813('0x93')][_0x7813('0x56')]({'body':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x57')],'OpenchannelAccountId':_0x5b8c5f[_0x7813('0x5d')]['id'],'OpenchannelInteractionId':_0x2b8882['id'],'direction':'in','ContactId':_0x48da6e['contact']['id'],'AttachmentId':_0x5b8c5f[_0x7813('0x57')][_0x7813('0x94')]});})[_0x7813('0x30')](function(_0x1c7bb1){_0x48da6e[_0x7813('0x20')]=_0x1c7bb1;if(_0x48da6e[_0x7813('0x8e')]['UserId']){return db[_0x7813('0x95')][_0x7813('0x5a')]({'attributes':['id','name'],'where':{'id':_0x48da6e['interaction'][_0x7813('0x96')]}})['then'](function(_0x5b2231){if(_0x5b2231){_0x48da6e[_0x7813('0x83')][_0x7813('0x97')]({'id':0x0,'priority':0x0,'app':_0x7813('0x98'),'appdata':_0x5b2231['name']+','+(_0x48da6e['account'][_0x7813('0x99')]||0xa),'interval':_0x7813('0x9a')});_0x48da6e[_0x7813('0x9b')]=![];}return respondWithRpcPromise(_0x7813('0x9c'),_0x7813('0x9d'),_0x48da6e);});}return respondWithRpcPromise(_0x7813('0x9c'),_0x7813('0x9d'),_0x48da6e);})['then'](function(_0x52b491){respondWithRpcPromise(_0x7813('0x9e'),_0x7813('0x9e'),{'event':_0x7813('0x6c'),'message':_0x52b491},client9002);return _0x52b491;})['then'](respondWithResult(_0x366e7c,null))[_0x7813('0x51')](handleError(_0x366e7c,null));};exports[_0x7813('0x9f')]=function(_0x22c9df,_0x22abc2){var _0x28f4ca=_0x22c9df['params']['id'];var _0x50bc92=_0x22c9df[_0x7813('0x57')];var _0x67fc48=0xc8;var _0x1beb92=null;return db[_0x7813('0xa0')][_0x7813('0xa1')]({'isolationLevel':db[_0x7813('0xa0')][_0x7813('0xa2')][_0x7813('0xa3')][_0x7813('0xa4')]},function(_0x136286){return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x28f4ca},'transaction':_0x136286})['then'](function(_0x58661f){if(_0x58661f){return db[_0x7813('0x80')]['destroy']({'where':{'OpenchannelAccountId':_0x28f4ca},'transaction':_0x136286})[_0x7813('0x30')](function(){var _0x3fb04f=_['map'](_0x50bc92,function(_0x35e94d){_0x35e94d[_0x7813('0x60')]=_0x28f4ca;return _0x35e94d;});return db[_0x7813('0x80')][_0x7813('0xa5')](_0x3fb04f,{'transaction':_0x136286});});}else{_0x67fc48=0x194;_0x1beb92=[];}});})[_0x7813('0x30')](function(){if(_0x67fc48!==0x194){return db[_0x7813('0x80')][_0x7813('0xa6')]({'where':{'OpenchannelAccountId':_0x28f4ca},'order':'priority'})['then'](function(_0xfdc4e2){_0x1beb92=_0xfdc4e2;});}})['catch'](function(_0x2b51cb){_0x67fc48=0x1f4;logger[_0x7813('0x1e')](_0x2b51cb['stack']);if(_0x2b51cb[_0x7813('0x3f')]){delete _0x2b51cb[_0x7813('0x3f')];}_0x1beb92=_0x2b51cb;})[_0x7813('0xa7')](function(){if(_0x1beb92===null){_0x22abc2[_0x7813('0x22')](_0x67fc48);}else{if(_0x67fc48===0x1f4){_0x22abc2[_0x7813('0x23')](_0x67fc48)[_0x7813('0xa8')](_0x1beb92);}else{_0x22abc2[_0x7813('0x23')](_0x67fc48)[_0x7813('0x25')](_0x1beb92);}}});};exports[_0x7813('0xa9')]=function(_0x54f289,_0x14b1d7,_0x1baaee){var _0x287b24={};var _0x53d16a={};var _0x41259f;var _0xbfc605;return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x54f289[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x14b1d7,null))['then'](function(_0x2eb98c){if(_0x2eb98c){_0x41259f=_0x2eb98c;_0x53d16a[_0x7813('0x3e')]=_[_0x7813('0x53')](db['OpenchannelApplication'][_0x7813('0x3a')]);_0x53d16a[_0x7813('0x40')]=_['keys'](_0x54f289[_0x7813('0x40')]);_0x53d16a[_0x7813('0x41')]=_[_0x7813('0x42')](_0x53d16a[_0x7813('0x3e')],_0x53d16a[_0x7813('0x40')]);_0x287b24[_0x7813('0x43')]=_[_0x7813('0x42')](_0x53d16a['model'],qs[_0x7813('0x44')](_0x54f289[_0x7813('0x40')]['fields']));_0x287b24['attributes']=_0x287b24['attributes'][_0x7813('0x45')]?_0x287b24['attributes']:_0x53d16a[_0x7813('0x3e')];_0x287b24[_0x7813('0x46')]=qs['sort'](_0x54f289[_0x7813('0x40')][_0x7813('0x47')]);_0x287b24[_0x7813('0x48')]=qs['filters'](_['pick'](_0x54f289[_0x7813('0x40')],_0x53d16a[_0x7813('0x41')]));if(_0x54f289[_0x7813('0x40')]['filter']){_0x287b24[_0x7813('0x48')]=_[_0x7813('0x4b')](_0x287b24['where'],{'$or':_[_0x7813('0x39')](_0x287b24[_0x7813('0x43')],function(_0x291b9c){var _0x48caf9={};_0x48caf9[_0x291b9c]={'$like':'%'+_0x54f289[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x48caf9;})});}_0x287b24=_[_0x7813('0x4b')]({},_0x287b24,_0x54f289['options']);return _0x41259f['getApplications'](_0x287b24);}})['then'](function(_0x1fcb2b){if(_0x1fcb2b){_0xbfc605=_0x1fcb2b[_0x7813('0x45')];if(!_0x54f289[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x287b24[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x54f289[_0x7813('0x40')][_0x7813('0x27')]);_0x287b24['offset']=qs[_0x7813('0x29')](_0x54f289[_0x7813('0x40')]['offset']);}return _0x41259f[_0x7813('0xa9')](_0x287b24);}})[_0x7813('0x30')](function(_0x2620bc){if(_0x2620bc){return _0x2620bc?{'count':_0xbfc605,'rows':_0x2620bc}:null;}})['then'](respondWithResult(_0x14b1d7,null))['catch'](handleError(_0x14b1d7,null));};exports[_0x7813('0xaa')]=function(_0x3ba701,_0x4a9c39,_0x2f4fb7){var _0x22f8a8={'raw':![],'where':{}};var _0x152d0e={};var _0x5b618a={'count':0x0,'rows':[]};return db[_0x7813('0x4e')][_0x7813('0x6a')]({'where':{'id':_0x3ba701['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x4a9c39,null))[_0x7813('0x30')](function(_0x305a45){if(_0x305a45){_0x152d0e[_0x7813('0x3e')]=_[_0x7813('0x53')](db['OpenchannelInteraction']['rawAttributes']);_0x152d0e['query']=_['keys'](_0x3ba701['query']);_0x152d0e[_0x7813('0x41')]=_['intersection'](_0x152d0e['model'],_0x152d0e[_0x7813('0x40')]);_0x22f8a8[_0x7813('0x43')]=_[_0x7813('0x42')](_0x152d0e['model'],qs[_0x7813('0x44')](_0x3ba701[_0x7813('0x40')]['fields']));_0x22f8a8[_0x7813('0x43')]=_0x22f8a8[_0x7813('0x43')][_0x7813('0x45')]?_0x22f8a8['attributes']:_0x152d0e['model'];if(!_0x3ba701[_0x7813('0x40')][_0x7813('0x63')](_0x7813('0x64'))){_0x22f8a8[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x3ba701['query']['limit']);_0x22f8a8[_0x7813('0x29')]=qs[_0x7813('0x29')](_0x3ba701[_0x7813('0x40')][_0x7813('0x29')]);}_0x22f8a8['order']=qs['sort'](_0x3ba701['query']['sort']);_0x22f8a8[_0x7813('0x48')]=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x3ba701['query'],_0x152d0e[_0x7813('0x41')]));_0x22f8a8[_0x7813('0x48')][_0x7813('0x60')]=_0x305a45['id'];if(_0x3ba701[_0x7813('0x40')][_0x7813('0x4a')]){_0x22f8a8['where']=_['merge'](_0x22f8a8[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x22f8a8['attributes'],function(_0x58a33e){var _0xd5abc5={};_0xd5abc5[_0x58a33e]={'$like':'%'+_0x3ba701['query'][_0x7813('0x4a')]+'%'};return _0xd5abc5;})});}_0x22f8a8=_[_0x7813('0x4b')]({},_0x22f8a8,_0x3ba701[_0x7813('0x55')]);return db[_0x7813('0x8a')]['count']({'where':_0x22f8a8[_0x7813('0x48')]})[_0x7813('0x30')](function(_0x5d60a7){_0x5b618a['count']=_0x5d60a7;if(_0x3ba701[_0x7813('0x40')][_0x7813('0x4d')]){_0x22f8a8[_0x7813('0x54')]=[{'model':db[_0x7813('0x7d')],'as':_0x7813('0xab'),'required':![]},{'model':db[_0x7813('0x95')],'as':_0x7813('0xac'),'attributes':[_0x7813('0x3f'),_0x7813('0xad'),_0x7813('0xae')],'required':![]},{'model':db[_0x7813('0xaf')],'as':_0x7813('0xb0'),'attributes':['id',_0x7813('0x3f'),_0x7813('0xb1')],'where':_0x3ba701['query'][_0x7813('0xb2')]?{'id':_0x3ba701[_0x7813('0x40')][_0x7813('0xb2')]}:undefined,'required':_0x3ba701[_0x7813('0x40')][_0x7813('0xb2')]?!![]:![]}];}return db[_0x7813('0x8a')][_0x7813('0x4f')](_0x22f8a8);})[_0x7813('0x30')](function(_0x2d9dfc){_0x5b618a[_0x7813('0x50')]=_0x2d9dfc;return _0x5b618a;});}})[_0x7813('0x30')](respondWithFilteredResult(_0x4a9c39,_0x22f8a8))[_0x7813('0x51')](handleError(_0x4a9c39,null));};exports[_0x7813('0xb3')]=function(_0x178aab,_0x128eba,_0x12eb1f){return db['OpenchannelAccount']['find']({'where':{'id':_0x178aab[_0x7813('0x5d')]['id']}})['then'](handleEntityNotFound(_0x128eba,null))['then'](function(_0x511a13){if(_0x511a13){return _0x511a13[_0x7813('0xb3')](_0x178aab['body'][_0x7813('0x66')],_[_0x7813('0xb4')](_0x178aab[_0x7813('0x57')],[_0x7813('0x66'),'id'])||{})[_0x7813('0xb5')](function(_0x52fb59){for(var _0x3b6941=0x0;_0x3b6941<_0x178aab[_0x7813('0x57')]['ids'][_0x7813('0x45')];_0x3b6941+=0x1){socket[_0x7813('0xb6')](_0x7813('0xb7'),{'UserId':Number(_0x178aab['body'][_0x7813('0x66')][_0x3b6941]),'OpenchannelAccountId':Number(_0x178aab['params']['id'])});}return _0x52fb59;});}})[_0x7813('0x30')](respondWithResult(_0x128eba,null))[_0x7813('0x51')](handleError(_0x128eba,null));};exports[_0x7813('0xb8')]=function(_0x287994,_0x231150,_0x5f03db){return db['OpenchannelAccount'][_0x7813('0x5a')]({'where':{'id':_0x287994['params']['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x231150,null))[_0x7813('0x30')](function(_0x1cfd81){if(_0x1cfd81){return _0x1cfd81[_0x7813('0xb8')](_0x287994[_0x7813('0x40')]['ids'])[_0x7813('0x30')](function(){if(_[_0x7813('0xb9')](_0x287994[_0x7813('0x40')][_0x7813('0x66')])){for(var _0xa8c413=0x0;_0xa8c413<_0x287994[_0x7813('0x40')][_0x7813('0x66')][_0x7813('0x45')];_0xa8c413+=0x1){socket[_0x7813('0xb6')](_0x7813('0xba'),{'UserId':Number(_0x287994[_0x7813('0x40')][_0x7813('0x66')][_0xa8c413]),'OpenchannelAccountId':Number(_0x287994[_0x7813('0x5d')]['id'])});}}else{socket[_0x7813('0xb6')](_0x7813('0xba'),{'UserId':Number(_0x287994[_0x7813('0x40')][_0x7813('0x66')]),'OpenchannelAccountId':Number(_0x287994[_0x7813('0x5d')]['id'])});}});}})[_0x7813('0x30')](respondWithStatusCode(_0x231150,null))[_0x7813('0x51')](handleError(_0x231150,null));};exports[_0x7813('0xbb')]=function(_0x1e75c9,_0x1d51f3,_0x2e30da){var _0x39a44a={};var _0x2db0be={};var _0x122fd8;var _0x3c6556;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1e75c9[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0x1d51f3,null))[_0x7813('0x30')](function(_0x3d68eb){if(_0x3d68eb){_0x122fd8=_0x3d68eb;_0x2db0be[_0x7813('0x3e')]=_[_0x7813('0x53')](db[_0x7813('0x95')][_0x7813('0x3a')]);_0x2db0be[_0x7813('0x40')]=_['keys'](_0x1e75c9[_0x7813('0x40')]);_0x2db0be[_0x7813('0x41')]=_['intersection'](_0x2db0be[_0x7813('0x3e')],_0x2db0be[_0x7813('0x40')]);_0x39a44a['attributes']=_[_0x7813('0x42')](_0x2db0be[_0x7813('0x3e')],qs[_0x7813('0x44')](_0x1e75c9['query'][_0x7813('0x44')]));_0x39a44a['attributes']=_0x39a44a[_0x7813('0x43')][_0x7813('0x45')]?_0x39a44a[_0x7813('0x43')]:_0x2db0be[_0x7813('0x3e')];_0x39a44a[_0x7813('0x46')]=qs[_0x7813('0x47')](_0x1e75c9[_0x7813('0x40')][_0x7813('0x47')]);_0x39a44a['where']=qs[_0x7813('0x41')](_[_0x7813('0x49')](_0x1e75c9[_0x7813('0x40')],_0x2db0be[_0x7813('0x41')]));if(_0x1e75c9[_0x7813('0x40')][_0x7813('0x4a')]){_0x39a44a[_0x7813('0x48')]=_['merge'](_0x39a44a[_0x7813('0x48')],{'$or':_[_0x7813('0x39')](_0x39a44a[_0x7813('0x43')],function(_0x38962b){var _0x15bfec={};_0x15bfec[_0x38962b]={'$like':'%'+_0x1e75c9[_0x7813('0x40')][_0x7813('0x4a')]+'%'};return _0x15bfec;})});}_0x39a44a=_[_0x7813('0x4b')]({},_0x39a44a,_0x1e75c9[_0x7813('0x55')]);return _0x122fd8[_0x7813('0xbb')](_0x39a44a);}})[_0x7813('0x30')](function(_0x35a04b){if(_0x35a04b){_0x3c6556=_0x35a04b[_0x7813('0x45')];if(!_0x1e75c9[_0x7813('0x40')][_0x7813('0x63')]('nolimit')){_0x39a44a[_0x7813('0x27')]=qs[_0x7813('0x27')](_0x1e75c9['query'][_0x7813('0x27')]);_0x39a44a[_0x7813('0x29')]=qs['offset'](_0x1e75c9[_0x7813('0x40')][_0x7813('0x29')]);}return _0x122fd8[_0x7813('0xbb')](_0x39a44a);}})[_0x7813('0x30')](function(_0x29c223){if(_0x29c223){return _0x29c223?{'count':_0x3c6556,'rows':_0x29c223}:null;}})[_0x7813('0x30')](respondWithResult(_0x1d51f3,null))[_0x7813('0x51')](handleError(_0x1d51f3,null));};exports['send']=function(_0x3f93c3,_0xc69a37,_0x47b645){var _0x3ea0f9,_0x2c6654,_0x107776;if(_[_0x7813('0x74')](_0x3f93c3[_0x7813('0x57')]['body'])||_0x3f93c3[_0x7813('0x57')][_0x7813('0x57')]===''){throw new db[(_0x7813('0x6e'))][(_0x7813('0x77'))](_0x7813('0xbc'));}if(_[_0x7813('0x74')](_0x3f93c3[_0x7813('0x57')]['to'])){}_0x3ea0f9=_0x3f93c3[_0x7813('0x57')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3f93c3[_0x7813('0x5d')]['id']}})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))[_0x7813('0x30')](function(_0x61c346){if(_0x61c346){return db[_0x7813('0x4e')][_0x7813('0x5a')]({'where':{'id':_0x61c346['id']},'include':[{'model':db[_0x7813('0xbd')],'as':_0x7813('0x7c'),'include':[{'model':db['CmContact'],'as':_0x7813('0x7e'),'where':{[_0x61c346[_0x7813('0x78')]]:_0x3ea0f9},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))[_0x7813('0x30')](function(_0x5d59fa){if(_0x5d59fa&&_0x5d59fa[_0x7813('0x7c')]){_0x2c6654=_0x5d59fa['get']({'plain':!![]});if(_0x2c6654[_0x7813('0x7c')]&&_0x2c6654[_0x7813('0x7c')]['Contacts'][_0x7813('0x45')]){return _0x2c6654[_0x7813('0x7c')]['Contacts'][0x0];}return db[_0x7813('0x7d')][_0x7813('0x56')](_[_0x7813('0x12')](_0x3f93c3[_0x7813('0x57')],{'firstName':_0x3ea0f9,[_0x5d59fa[_0x7813('0x78')]]:_0x3ea0f9,'phone':_0x3ea0f9,'ListId':_0x2c6654[_0x7813('0x73')]}));}})[_0x7813('0x30')](handleEntityNotFound(_0xc69a37,null))['then'](function(_0x1d1925){if(_0x1d1925){_0x107776=_0x1d1925;return db[_0x7813('0x8a')][_0x7813('0x5a')]({'where':{'ContactId':_0x107776['id'],'closed':![],'OpenchannelAccountId':_0x2c6654['id']}})[_0x7813('0x30')](function(_0x5ab444){if(_0x5ab444){return[_0x5ab444,![]];}return db[_0x7813('0x8a')]['create']({'UserId':_0x3f93c3['user']['id'],'ContactId':_0x107776['id'],'OpenchannelAccountId':_0x2c6654['id'],'lastMsgDirection':_0x7813('0xbe'),'firstMsgDirection':_0x7813('0xbe'),'Messages':[_[_0x7813('0x4b')](_0x3f93c3['body'],{'read':![],'body':_0x3f93c3['body'][_0x7813('0x57')],'OpenchannelAccountId':_0x2c6654['id'],'UserId':_0x3f93c3[_0x7813('0x58')]['id'],'ContactId':_0x107776['id']})]},{'include':[{'model':db[_0x7813('0x93')],'as':_0x7813('0xbf')}]})[_0x7813('0x30')](function(_0x60b623){return[_0x60b623,!![]];});});}})[_0x7813('0xb5')](function(_0x4630ee,_0x30e9c4){if(_0x30e9c4){return _0x4630ee;}return db[_0x7813('0x93')][_0x7813('0x56')](_[_0x7813('0x4b')](_0x3f93c3[_0x7813('0x57')],{'read':![],'body':_0x3f93c3[_0x7813('0x57')]['body'],'OpenchannelAccountId':_0x2c6654['id'],'OpenchannelInteractionId':_0x4630ee['id'],'UserId':_0x3f93c3[_0x7813('0x58')]['id'],'ContactId':_0x107776['id']}))[_0x7813('0x30')](function(_0x5c4ed4){_0x4630ee['dataValues']['Messages']=[];_0x4630ee['dataValues'][_0x7813('0xbf')][_0x7813('0x91')](_0x5c4ed4[_0x7813('0xc0')]);return _0x4630ee;});});}})[_0x7813('0x30')](respondWithResult(_0xc69a37,null))['catch'](handleError(_0xc69a37,null));}; \ No newline at end of file +var _0xa22a=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','OpenchannelAccount','length','includeAll','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','OpenchannelAccountId','Disposition','getDispositions','rawAttributes','pick','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','created','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','waitForTheAssignedAgent','Start','startRouting','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','send','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa22a,0x153));var _0xaa22=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa22a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xaa22('0x0'));var rimraf=require(_0xaa22('0x1'));var zipdir=require(_0xaa22('0x2'));var jsonpatch=require(_0xaa22('0x3'));var rp=require(_0xaa22('0x4'));var moment=require('moment');var BPromise=require(_0xaa22('0x5'));var Mustache=require(_0xaa22('0x6'));var util=require(_0xaa22('0x7'));var path=require(_0xaa22('0x8'));var sox=require(_0xaa22('0x9'));var csv=require(_0xaa22('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa22('0xb'));var _=require('lodash');var squel=require(_0xaa22('0xc'));var crypto=require(_0xaa22('0xd'));var jsforce=require(_0xaa22('0xe'));var deskjs=require(_0xaa22('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaa22('0x10'));var Papa=require('papaparse');var Redis=require(_0xaa22('0x11'));var authService=require(_0xaa22('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaa22('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa22('0x14'));var utils=require('../../config/utils');var config=require(_0xaa22('0x15'));var licenseUtil=require(_0xaa22('0x16'));var db=require(_0xaa22('0x17'))['db'];config[_0xaa22('0x18')]=_[_0xaa22('0x19')](config[_0xaa22('0x18')],{'host':_0xaa22('0x1a'),'port':0x18eb});var socket=require(_0xaa22('0x1b'))(new Redis(config[_0xaa22('0x18')]));require(_0xaa22('0x1c'))['register'](socket);var jayson=require(_0xaa22('0x1d'));var client=jayson[_0xaa22('0x1e')][_0xaa22('0x1f')]({'port':0x232c});var client9002=jayson[_0xaa22('0x1e')][_0xaa22('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x38e896,_0x4e126e,_0x5501d9,_0x1f1c69){return new BPromise(function(_0x378e7e,_0x12378d){var _0x2781e5=_0x1f1c69||client;return _0x2781e5[_0xaa22('0x20')](_0x38e896,_0x5501d9)[_0xaa22('0x21')](function(_0x5b480a){logger['info'](_0xaa22('0x22'),_0x4e126e,_0xaa22('0x23'));logger[_0xaa22('0x24')](_0xaa22('0x25'),_0x4e126e,_0xaa22('0x23'),JSON[_0xaa22('0x26')](_0x5b480a));if(_0x5b480a[_0xaa22('0x27')]){if(_0x5b480a[_0xaa22('0x27')][_0xaa22('0x28')]===0x1f4){logger[_0xaa22('0x27')](_0xaa22('0x22'),_0x4e126e,_0x5b480a[_0xaa22('0x27')][_0xaa22('0x29')]);return _0x12378d(_0x5b480a[_0xaa22('0x27')][_0xaa22('0x29')]);}logger['error'](_0xaa22('0x22'),_0x4e126e,_0x5b480a[_0xaa22('0x27')][_0xaa22('0x29')]);return _0x378e7e(_0x5b480a[_0xaa22('0x27')][_0xaa22('0x29')]);}else{logger[_0xaa22('0x2a')](_0xaa22('0x22'),_0x4e126e,_0xaa22('0x23'));_0x378e7e(_0x5b480a[_0xaa22('0x2b')][_0xaa22('0x29')]);}})[_0xaa22('0x2c')](function(_0x14944f){logger[_0xaa22('0x27')](_0xaa22('0x22'),_0x4e126e,_0x14944f);_0x12378d(_0x14944f);});});}function respondWithStatusCode(_0x4ae75b,_0x3e8608){_0x3e8608=_0x3e8608||0xcc;return function(_0x4375ac){if(_0x4375ac){return _0x4ae75b['sendStatus'](_0x3e8608);}return _0x4ae75b[_0xaa22('0x2d')](_0x3e8608)[_0xaa22('0x2e')]();};}function respondWithResult(_0x5132d4,_0xcfaffa){_0xcfaffa=_0xcfaffa||0xc8;return function(_0x4bf9b2){if(_0x4bf9b2){return _0x5132d4['status'](_0xcfaffa)['json'](_0x4bf9b2);}};}function respondWithFilteredResult(_0x97edb4,_0x5b5104){return function(_0x1ed9c6){if(_0x1ed9c6){var _0x4be89a=typeof _0x5b5104['offset']===_0xaa22('0x2f')&&typeof _0x5b5104['limit']==='undefined';var _0x1e9bb4=_0x1ed9c6['count'];var _0x564bb0=_0x4be89a?0x0:_0x5b5104['offset'];var _0x2bf7e2=_0x4be89a?_0x1ed9c6[_0xaa22('0x30')]:_0x5b5104['offset']+_0x5b5104[_0xaa22('0x31')];var _0x4b165c;if(_0x2bf7e2>=_0x1e9bb4){_0x2bf7e2=_0x1e9bb4;_0x4b165c=0xc8;}else{_0x4b165c=0xce;}_0x97edb4['status'](_0x4b165c);return _0x97edb4[_0xaa22('0x32')](_0xaa22('0x33'),_0x564bb0+'-'+_0x2bf7e2+'/'+_0x1e9bb4)[_0xaa22('0x34')](_0x1ed9c6);}return null;};}function patchUpdates(_0x2c3699){return function(_0x14794f){try{jsonpatch[_0xaa22('0x35')](_0x14794f,_0x2c3699,!![]);}catch(_0x487ad2){return BPromise[_0xaa22('0x36')](_0x487ad2);}return _0x14794f[_0xaa22('0x37')]();};}function saveUpdates(_0x192b15,_0x448a07){return function(_0xea965c){if(_0xea965c){return _0xea965c[_0xaa22('0x38')](_0x192b15)[_0xaa22('0x21')](function(_0x402650){return _0x402650;});}return null;};}function removeEntity(_0x5da826,_0x5ad05a){return function(_0x11e59a){if(_0x11e59a){return _0x11e59a['destroy']()[_0xaa22('0x21')](function(){var _0x10f3ed=_0x11e59a[_0xaa22('0x39')]({'plain':!![]});var _0x1c11ff=_0xaa22('0x3a');return db[_0xaa22('0x3b')][_0xaa22('0x3c')]({'where':{'type':_0x1c11ff,'resourceId':_0x10f3ed['id']}})[_0xaa22('0x21')](function(){return _0x11e59a;});})[_0xaa22('0x21')](function(){_0x5da826[_0xaa22('0x2d')](0xcc)[_0xaa22('0x2e')]();});}};}function handleEntityNotFound(_0x4e69de,_0x3094a0){return function(_0x435dcb){if(!_0x435dcb){_0x4e69de[_0xaa22('0x3d')](0x194);}return _0x435dcb;};}function handleError(_0xa314b3,_0x414cdb){_0x414cdb=_0x414cdb||0x1f4;return function(_0x38cc94){logger[_0xaa22('0x27')](_0x38cc94[_0xaa22('0x3e')]);if(_0x38cc94[_0xaa22('0x3f')]){delete _0x38cc94['name'];}_0xa314b3[_0xaa22('0x2d')](_0x414cdb)['send'](_0x38cc94);};}exports[_0xaa22('0x40')]=function(_0x1f96e4,_0x4baa82){var _0x530e43={'include':[{'model':db[_0xaa22('0x41')],'as':_0xaa22('0x42')}]},_0x38a18a={},_0x38ee7e={'count':0x0,'rows':[]};var _0x2fec9e=_[_0xaa22('0x43')](db['OpenchannelAccount']['rawAttributes'],function(_0x2395ab){return{'name':_0x2395ab['fieldName'],'type':_0x2395ab[_0xaa22('0x44')][_0xaa22('0x45')]};});_0x38a18a[_0xaa22('0x46')]=_['map'](_0x2fec9e,'name');_0x38a18a[_0xaa22('0x47')]=_[_0xaa22('0x48')](_0x1f96e4[_0xaa22('0x47')]);_0x38a18a[_0xaa22('0x49')]=_[_0xaa22('0x4a')](_0x38a18a[_0xaa22('0x46')],_0x38a18a[_0xaa22('0x47')]);_0x530e43['attributes']=_[_0xaa22('0x4a')](_0x38a18a['model'],qs[_0xaa22('0x4b')](_0x1f96e4['query'][_0xaa22('0x4b')]));_0x530e43[_0xaa22('0x4c')]=_0x530e43[_0xaa22('0x4c')]['length']?_0x530e43[_0xaa22('0x4c')]:_0x38a18a['model'];if(!_0x1f96e4[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x530e43[_0xaa22('0x31')]=qs['limit'](_0x1f96e4[_0xaa22('0x47')][_0xaa22('0x31')]);_0x530e43[_0xaa22('0x4f')]=qs['offset'](_0x1f96e4[_0xaa22('0x47')][_0xaa22('0x4f')]);}_0x530e43[_0xaa22('0x50')]=qs[_0xaa22('0x51')](_0x1f96e4[_0xaa22('0x47')]['sort']);_0x530e43[_0xaa22('0x52')]=qs['filters'](_['pick'](_0x1f96e4[_0xaa22('0x47')],_0x38a18a[_0xaa22('0x49')]),_0x2fec9e);if(_0x1f96e4['query'][_0xaa22('0x53')]){_0x530e43[_0xaa22('0x52')]=_[_0xaa22('0x54')](_0x530e43['where'],{'$or':_[_0xaa22('0x43')](_0x2fec9e,function(_0x9ab8a9){if(_0x9ab8a9[_0xaa22('0x44')]!==_0xaa22('0x55')){var _0x49395c={};_0x49395c[_0x9ab8a9['name']]={'$like':'%'+_0x1f96e4[_0xaa22('0x47')][_0xaa22('0x53')]+'%'};return _0x49395c;}})});}_0x530e43=_[_0xaa22('0x54')]({},_0x530e43,_0x1f96e4['options']);var _0x226c5d={'where':_0x530e43[_0xaa22('0x52')]};return db['OpenchannelAccount'][_0xaa22('0x30')](_0x226c5d)[_0xaa22('0x21')](function(_0x3d1e60){_0x38ee7e[_0xaa22('0x30')]=_0x3d1e60;if(_0x1f96e4[_0xaa22('0x47')]['includeAll']){_0x530e43[_0xaa22('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xaa22('0x57')](_0x530e43);})[_0xaa22('0x21')](function(_0x33df9b){_0x38ee7e[_0xaa22('0x58')]=_0x33df9b;return _0x38ee7e;})['then'](respondWithFilteredResult(_0x4baa82,_0x530e43))[_0xaa22('0x2c')](handleError(_0x4baa82,null));};exports[_0xaa22('0x59')]=function(_0x4151f9,_0x23a5b8){var _0x1ecd1e={'raw':![],'where':{'id':_0x4151f9['params']['id']},'include':[{'model':db[_0xaa22('0x41')],'as':'mandatoryDispositionPause'}]},_0xa38dd7={};_0xa38dd7[_0xaa22('0x46')]=_[_0xaa22('0x48')](db[_0xaa22('0x5a')]['rawAttributes']);_0xa38dd7[_0xaa22('0x47')]=_[_0xaa22('0x48')](_0x4151f9[_0xaa22('0x47')]);_0xa38dd7['filters']=_[_0xaa22('0x4a')](_0xa38dd7[_0xaa22('0x46')],_0xa38dd7['query']);_0x1ecd1e[_0xaa22('0x4c')]=_[_0xaa22('0x4a')](_0xa38dd7[_0xaa22('0x46')],qs[_0xaa22('0x4b')](_0x4151f9[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x1ecd1e['attributes']=_0x1ecd1e[_0xaa22('0x4c')][_0xaa22('0x5b')]?_0x1ecd1e['attributes']:_0xa38dd7[_0xaa22('0x46')];if(_0x4151f9['query'][_0xaa22('0x5c')]){_0x1ecd1e[_0xaa22('0x56')]=[{'all':!![]}];}_0x1ecd1e=_[_0xaa22('0x54')]({},_0x1ecd1e,_0x4151f9[_0xaa22('0x5d')]);return db[_0xaa22('0x5a')][_0xaa22('0x5e')](_0x1ecd1e)[_0xaa22('0x21')](handleEntityNotFound(_0x23a5b8,null))['then'](respondWithResult(_0x23a5b8,null))[_0xaa22('0x2c')](handleError(_0x23a5b8,null));};exports['create']=function(_0x1fbe8c,_0x3b55bf){return db[_0xaa22('0x5a')][_0xaa22('0x5f')](_0x1fbe8c[_0xaa22('0x60')],{})[_0xaa22('0x21')](function(_0x536517){var _0x30eeed=_0x1fbe8c['user'][_0xaa22('0x39')]({'plain':!![]});if(!_0x30eeed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30eeed[_0xaa22('0x61')]===_0xaa22('0x62')){var _0x31d9f2=_0x536517[_0xaa22('0x39')]({'plain':!![]});var _0x3fb7df=_0xaa22('0x3a');return db[_0xaa22('0x63')][_0xaa22('0x5e')]({'where':{'name':_0x3fb7df,'userProfileId':_0x30eeed[_0xaa22('0x64')]},'raw':!![]})[_0xaa22('0x21')](function(_0x1c6713){if(_0x1c6713&&_0x1c6713[_0xaa22('0x65')]===0x0){return db[_0xaa22('0x3b')]['create']({'name':_0x31d9f2[_0xaa22('0x3f')],'resourceId':_0x31d9f2['id'],'type':_0x1c6713[_0xaa22('0x3f')],'sectionId':_0x1c6713['id']},{})[_0xaa22('0x21')](function(){return _0x536517;});}else{return _0x536517;}})[_0xaa22('0x2c')](function(_0x528d1b){logger['error'](_0xaa22('0x66'),_0x528d1b);throw _0x528d1b;});}return _0x536517;})[_0xaa22('0x21')](respondWithResult(_0x3b55bf,0xc9))[_0xaa22('0x2c')](handleError(_0x3b55bf,null));};exports[_0xaa22('0x38')]=function(_0x40d23f,_0x254d3b){if(_0x40d23f[_0xaa22('0x60')]['id']){delete _0x40d23f[_0xaa22('0x60')]['id'];}return db[_0xaa22('0x5a')][_0xaa22('0x5e')]({'where':{'id':_0x40d23f[_0xaa22('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0xaa22('0x42')}]})[_0xaa22('0x21')](handleEntityNotFound(_0x254d3b,null))[_0xaa22('0x21')](saveUpdates(_0x40d23f[_0xaa22('0x60')],null))[_0xaa22('0x21')](respondWithResult(_0x254d3b,null))['catch'](handleError(_0x254d3b,null));};exports[_0xaa22('0x3c')]=function(_0x2963e5,_0x5b7fc4){return db['OpenchannelAccount']['find']({'where':{'id':_0x2963e5[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x5b7fc4,null))[_0xaa22('0x21')](removeEntity(_0x5b7fc4,null))[_0xaa22('0x2c')](handleError(_0x5b7fc4,null));};exports['describe']=function(_0x2c94f0,_0x4ac18e){return db[_0xaa22('0x5a')]['describe']()[_0xaa22('0x21')](respondWithResult(_0x4ac18e,null))[_0xaa22('0x2c')](handleError(_0x4ac18e,null));};exports[_0xaa22('0x68')]=function(_0x450d87,_0x39e8c3,_0x4c0f92){if(_0x450d87[_0xaa22('0x60')]['id']){delete _0x450d87[_0xaa22('0x60')]['id'];}return db[_0xaa22('0x5a')][_0xaa22('0x5e')]({'where':{'id':_0x450d87[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x39e8c3,null))[_0xaa22('0x21')](function(_0x26d86d){if(_0x26d86d){_0x450d87['body'][_0xaa22('0x69')]=_0x26d86d['id'];return db[_0xaa22('0x6a')][_0xaa22('0x5f')](_0x450d87[_0xaa22('0x60')]);}})['then'](respondWithResult(_0x39e8c3,null))[_0xaa22('0x2c')](handleError(_0x39e8c3,null));};exports[_0xaa22('0x6b')]=function(_0x5f2292,_0x3bb334,_0x3ad2a9){var _0x438742={'raw':![],'where':{}};var _0x5085d9={};var _0x2e7bdb={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5f2292[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x3bb334,null))['then'](function(_0x5d1307){if(_0x5d1307){_0x5085d9['model']=_[_0xaa22('0x48')](db[_0xaa22('0x6a')][_0xaa22('0x6c')]);_0x5085d9['query']=_[_0xaa22('0x48')](_0x5f2292[_0xaa22('0x47')]);_0x5085d9[_0xaa22('0x49')]=_['intersection'](_0x5085d9[_0xaa22('0x46')],_0x5085d9[_0xaa22('0x47')]);_0x438742[_0xaa22('0x4c')]=_[_0xaa22('0x4a')](_0x5085d9['model'],qs[_0xaa22('0x4b')](_0x5f2292[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x438742['attributes']=_0x438742[_0xaa22('0x4c')]['length']?_0x438742[_0xaa22('0x4c')]:_0x5085d9['model'];if(!_0x5f2292[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x438742[_0xaa22('0x31')]=qs['limit'](_0x5f2292['query']['limit']);_0x438742[_0xaa22('0x4f')]=qs[_0xaa22('0x4f')](_0x5f2292[_0xaa22('0x47')][_0xaa22('0x4f')]);}_0x438742[_0xaa22('0x50')]=qs[_0xaa22('0x51')](_0x5f2292[_0xaa22('0x47')]['sort']);_0x438742[_0xaa22('0x52')]=qs['filters'](_[_0xaa22('0x6d')](_0x5f2292[_0xaa22('0x47')],_0x5085d9[_0xaa22('0x49')]));_0x438742[_0xaa22('0x52')]['OpenchannelAccountId']=_0x5d1307['id'];if(_0x5f2292[_0xaa22('0x47')][_0xaa22('0x53')]){_0x438742['where']=_[_0xaa22('0x54')](_0x438742['where'],{'$or':_[_0xaa22('0x43')](_0x438742[_0xaa22('0x4c')],function(_0x5b88fa){var _0xef6146={};_0xef6146[_0x5b88fa]={'$like':'%'+_0x5f2292['query'][_0xaa22('0x53')]+'%'};return _0xef6146;})});}_0x438742=_[_0xaa22('0x54')]({},_0x438742,_0x5f2292[_0xaa22('0x5d')]);return db['Disposition']['count']({'where':_0x438742[_0xaa22('0x52')]})[_0xaa22('0x21')](function(_0xf71364){_0x2e7bdb[_0xaa22('0x30')]=_0xf71364;if(_0x5f2292[_0xaa22('0x47')][_0xaa22('0x5c')]){_0x438742[_0xaa22('0x56')]=[{'all':!![]}];}return db[_0xaa22('0x6a')][_0xaa22('0x57')](_0x438742);})['then'](function(_0x58561b){_0x2e7bdb[_0xaa22('0x58')]=_0x58561b;return _0x2e7bdb;});}})[_0xaa22('0x21')](respondWithFilteredResult(_0x3bb334,_0x438742))[_0xaa22('0x2c')](handleError(_0x3bb334,null));};exports['removeDispositions']=function(_0x505a62,_0x5b7825,_0x3d4246){return db[_0xaa22('0x5a')][_0xaa22('0x5e')]({'where':{'id':_0x505a62['params']['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x5b7825,null))[_0xaa22('0x21')](function(_0x49a256){if(_0x49a256){return _0x49a256[_0xaa22('0x6e')](_0x505a62[_0xaa22('0x47')]['ids']);}})[_0xaa22('0x21')](respondWithStatusCode(_0x5b7825,null))[_0xaa22('0x2c')](handleError(_0x5b7825,null));};exports['addAnswer']=function(_0x381996,_0x2670d0,_0x4378db){if(_0x381996['body']['id']){delete _0x381996['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x381996[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x2670d0,null))[_0xaa22('0x21')](function(_0x305dbd){if(_0x305dbd){_0x381996[_0xaa22('0x60')][_0xaa22('0x69')]=_0x305dbd['id'];return db[_0xaa22('0x6f')][_0xaa22('0x5f')](_0x381996[_0xaa22('0x60')]);}})[_0xaa22('0x21')](respondWithResult(_0x2670d0,null))[_0xaa22('0x2c')](handleError(_0x2670d0,null));};exports[_0xaa22('0x70')]=function(_0x39f301,_0x288386,_0x5ddff0){var _0x4541b5={'raw':![],'where':{}};var _0x18c42e={};var _0x196a4f={'count':0x0,'rows':[]};return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0x39f301[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x288386,null))['then'](function(_0x4e5ea7){if(_0x4e5ea7){_0x18c42e[_0xaa22('0x46')]=_[_0xaa22('0x48')](db[_0xaa22('0x6f')]['rawAttributes']);_0x18c42e[_0xaa22('0x47')]=_[_0xaa22('0x48')](_0x39f301[_0xaa22('0x47')]);_0x18c42e[_0xaa22('0x49')]=_[_0xaa22('0x4a')](_0x18c42e[_0xaa22('0x46')],_0x18c42e[_0xaa22('0x47')]);_0x4541b5[_0xaa22('0x4c')]=_[_0xaa22('0x4a')](_0x18c42e['model'],qs['fields'](_0x39f301[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x4541b5[_0xaa22('0x4c')]=_0x4541b5[_0xaa22('0x4c')][_0xaa22('0x5b')]?_0x4541b5[_0xaa22('0x4c')]:_0x18c42e[_0xaa22('0x46')];if(!_0x39f301[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x4541b5[_0xaa22('0x31')]=qs[_0xaa22('0x31')](_0x39f301[_0xaa22('0x47')][_0xaa22('0x31')]);_0x4541b5[_0xaa22('0x4f')]=qs[_0xaa22('0x4f')](_0x39f301[_0xaa22('0x47')][_0xaa22('0x4f')]);}_0x4541b5['order']=qs[_0xaa22('0x51')](_0x39f301[_0xaa22('0x47')][_0xaa22('0x51')]);_0x4541b5[_0xaa22('0x52')]=qs[_0xaa22('0x49')](_['pick'](_0x39f301[_0xaa22('0x47')],_0x18c42e[_0xaa22('0x49')]));_0x4541b5[_0xaa22('0x52')][_0xaa22('0x69')]=_0x4e5ea7['id'];if(_0x39f301[_0xaa22('0x47')][_0xaa22('0x53')]){_0x4541b5[_0xaa22('0x52')]=_[_0xaa22('0x54')](_0x4541b5[_0xaa22('0x52')],{'$or':_['map'](_0x4541b5['attributes'],function(_0x221edb){var _0x242d7b={};_0x242d7b[_0x221edb]={'$like':'%'+_0x39f301[_0xaa22('0x47')]['filter']+'%'};return _0x242d7b;})});}_0x4541b5=_[_0xaa22('0x54')]({},_0x4541b5,_0x39f301['options']);return db[_0xaa22('0x6f')][_0xaa22('0x30')]({'where':_0x4541b5['where']})['then'](function(_0x558fd2){_0x196a4f[_0xaa22('0x30')]=_0x558fd2;if(_0x39f301['query'][_0xaa22('0x5c')]){_0x4541b5[_0xaa22('0x56')]=[{'all':!![]}];}return db[_0xaa22('0x6f')][_0xaa22('0x57')](_0x4541b5);})['then'](function(_0x1b3c92){_0x196a4f[_0xaa22('0x58')]=_0x1b3c92;return _0x196a4f;});}})[_0xaa22('0x21')](respondWithFilteredResult(_0x288386,_0x4541b5))[_0xaa22('0x2c')](handleError(_0x288386,null));};exports[_0xaa22('0x72')]=function(_0x49ea68,_0x2c00b3,_0x3bda2d){return db['OpenchannelAccount'][_0xaa22('0x5e')]({'where':{'id':_0x49ea68['params']['id']}})['then'](handleEntityNotFound(_0x2c00b3,null))[_0xaa22('0x21')](function(_0x80f2be){if(_0x80f2be){return _0x80f2be[_0xaa22('0x72')](_0x49ea68[_0xaa22('0x47')][_0xaa22('0x73')]);}})[_0xaa22('0x21')](respondWithStatusCode(_0x2c00b3,null))['catch'](handleError(_0x2c00b3,null));};exports[_0xaa22('0x74')]=function(_0x4cc753,_0x52f995,_0x558e68){var _0x560384={'body':_0x4cc753[_0xaa22('0x60')],'channel':'openchannel'};var _0x1d959b=[];var _0x2d406b=[];var _0x5dc883={};var _0x5116d3=![];return db[_0xaa22('0x75')]['describe']()[_0xaa22('0x21')](function(_0x9b261e){if(!_0x9b261e){throw new db[(_0xaa22('0x76'))]['ValidationError'](_0xaa22('0x77'));}_0x1d959b=_[_0xaa22('0x78')](_[_0xaa22('0x48')](_0x9b261e),[_0xaa22('0x79'),_0xaa22('0x7a')]);_0x2d406b=_[_0xaa22('0x78')](_['keys'](_0x9b261e),[_0xaa22('0x79'),_0xaa22('0x7a'),_0xaa22('0x7b'),_0xaa22('0x7c')]);if(_0x4cc753[_0xaa22('0x60')]['id']){delete _0x4cc753['body']['id'];}if(_[_0xaa22('0x7d')](_0x4cc753[_0xaa22('0x60')][_0xaa22('0x7e')])){throw new db[(_0xaa22('0x76'))]['ValidationError'](_0xaa22('0x7f'));}if(_[_0xaa22('0x7d')](_0x4cc753[_0xaa22('0x60')][_0xaa22('0x60')])||_0x4cc753[_0xaa22('0x60')][_0xaa22('0x60')]===''){throw new db[(_0xaa22('0x76'))][(_0xaa22('0x80'))](_0xaa22('0x81'));}if(_[_0xaa22('0x7d')](_0x4cc753['body'][_0xaa22('0x82')])){throw new db['Sequelize'][(_0xaa22('0x80'))](_0xaa22('0x83')+_0x2d406b);}if(!_[_0xaa22('0x84')](_0x2d406b,_0x4cc753[_0xaa22('0x60')][_0xaa22('0x82')])){throw new db['Sequelize'][(_0xaa22('0x80'))](_0xaa22('0x85')+_0x2d406b);}_0x5dc883[_0x4cc753['body']['mapKey']]=_0x4cc753[_0xaa22('0x60')][_0xaa22('0x7e')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x4cc753['params']['id']},'include':[{'model':db['CmList'],'as':_0xaa22('0x86'),'include':[{'model':db[_0xaa22('0x75')],'as':_0xaa22('0x87'),'where':_0x5dc883,'limit':0x1,'order':[['updatedAt',_0xaa22('0x88')]]}]},{'model':db[_0xaa22('0x89')],'as':_0xaa22('0x8a')}]});})[_0xaa22('0x21')](handleEntityNotFound(_0x52f995,null))[_0xaa22('0x21')](function(_0x2c5e42){if(_0x2c5e42&&_0x2c5e42[_0xaa22('0x86')]){_0x560384[_0xaa22('0x8b')]=_0x2c5e42;_0x560384['applications']=_0x2c5e42[_0xaa22('0x8a')];_0x560384['list']=_0x2c5e42['List'];_0x560384[_0xaa22('0x8c')]=_[_0xaa22('0x8d')](_0x560384[_0xaa22('0x8c')],[_0xaa22('0x8e')],[_0xaa22('0x8f')]);if(_0x560384[_0xaa22('0x8b')]['Applications']){delete _0x560384['account'][_0xaa22('0x8a')];}if(_0x560384[_0xaa22('0x8b')][_0xaa22('0x86')]&&_0x560384['account'][_0xaa22('0x86')][_0xaa22('0x87')][_0xaa22('0x5b')]){return _0x560384[_0xaa22('0x8b')]['List']['Contacts'][0x0];}var _0x56e5a0=_[_0xaa22('0x19')](_0x4cc753[_0xaa22('0x60')],{'firstName':_0x4cc753[_0xaa22('0x60')][_0xaa22('0x7e')],'ListId':_0x2c5e42[_0xaa22('0x7c')]});_0x56e5a0[_0x4cc753[_0xaa22('0x60')][_0xaa22('0x82')]]=_0x4cc753['body'][_0xaa22('0x7e')];return db['CmContact']['create'](_0x56e5a0,{'fields':_0x1d959b,'raw':!![]});}})[_0xaa22('0x21')](handleEntityNotFound(_0x52f995,null))[_0xaa22('0x21')](function(_0x4f286e){_0x560384['contact']=_0x4f286e;if(_0x4f286e){var _0x3f862d={'ContactId':_0x4f286e['id'],'OpenchannelAccountId':_0x4cc753[_0xaa22('0x67')]['id'],'from':(_0x4f286e[_0xaa22('0x90')]||'')+'\x20'+(_0x4f286e[_0xaa22('0x91')]||'')};var _0x29a151={'OpenchannelAccountId':_0x4cc753[_0xaa22('0x67')]['id'],'closed':![]};if(_0x4cc753[_0xaa22('0x60')][_0xaa22('0x92')]){_0x29a151[_0xaa22('0x92')]=_0x4cc753['body'][_0xaa22('0x92')];return db['OpenchannelInteraction'][_0xaa22('0x5e')]({'where':_0x29a151})['then'](function(_0x121594){if(_0x121594){return[_0x121594,![]];}_0x3f862d[_0xaa22('0x92')]=_0x4cc753[_0xaa22('0x60')][_0xaa22('0x92')];_0x3f862d[_0xaa22('0x93')]=_0x4cc753[_0xaa22('0x60')]['externalUrl'];return db[_0xaa22('0x94')][_0xaa22('0x5f')](_0x3f862d)['then'](function(_0x4b20b1){return[_0x4b20b1,!![]];});});}else{_0x29a151[_0xaa22('0x92')]=null;}_0x29a151['ContactId']=_0x4f286e['id'];return db[_0xaa22('0x94')][_0xaa22('0x5e')]({'where':_0x29a151})[_0xaa22('0x21')](function(_0x5557c0){if(_0x5557c0){return[_0x5557c0,![]];}return db[_0xaa22('0x94')][_0xaa22('0x5f')](_0x3f862d)[_0xaa22('0x21')](function(_0x5eb499){return[_0x5eb499,!![]];});});}})[_0xaa22('0x95')](function(_0x13137c,_0x156568){if(_0x13137c){_0x5116d3=_0x156568;if(!_0x156568){var _0x4a81e0={'from':(_0x560384[_0xaa22('0x96')][_0xaa22('0x90')]||'')+'\x20'+(_0x560384[_0xaa22('0x96')]['lastName']||'')};if(_0x4cc753[_0xaa22('0x60')]['threadId']&&_0x4cc753[_0xaa22('0x60')][_0xaa22('0x97')]&&_0x4cc753[_0xaa22('0x60')]['threadId']!=_0x4cc753['body']['messageId']){_0x4a81e0[_0xaa22('0x92')]=_0x4cc753[_0xaa22('0x60')]['messageId'];}return _0x13137c[_0xaa22('0x38')](_0x4a81e0);}else{return _0x13137c;}}})['then'](function(_0x3300f0){_0x560384[_0xaa22('0x98')]=_0x3300f0[_0xaa22('0x39')]({'plain':!![]});_0x560384['interaction'][_0xaa22('0x99')]=_0x5116d3;if(_0x560384['interaction'][_0xaa22('0x99')]){if(_0x560384[_0xaa22('0x8b')]['autoclose']){_0x560384[_0xaa22('0x8c')]['push']({'id':0x0,'priority':_0x560384[_0xaa22('0x8c')][_0xaa22('0x5b')]+0x1,'app':'close','appdata':_0xaa22('0x9a'),'interval':_0xaa22('0x9b')});}}return db[_0xaa22('0x9c')]['create']({'body':_0x4cc753[_0xaa22('0x60')][_0xaa22('0x60')],'OpenchannelAccountId':_0x4cc753[_0xaa22('0x67')]['id'],'OpenchannelInteractionId':_0x3300f0['id'],'direction':'in','ContactId':_0x560384['contact']['id'],'AttachmentId':_0x4cc753[_0xaa22('0x60')]['AttachmentId']});})[_0xaa22('0x21')](function(_0x3153f5){_0x560384[_0xaa22('0x29')]=_0x3153f5;if(_0x560384[_0xaa22('0x98')][_0xaa22('0x9d')]){return db[_0xaa22('0x9e')]['find']({'attributes':['id',_0xaa22('0x3f')],'where':{'id':_0x560384['interaction'][_0xaa22('0x9d')]}})[_0xaa22('0x21')](function(_0x8bb1d5){if(_0x8bb1d5){_0x560384[_0xaa22('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x8bb1d5[_0xaa22('0x3f')]+','+(_0x560384[_0xaa22('0x8b')][_0xaa22('0x9f')]||0xa),'interval':_0xaa22('0x9b')});_0x560384['forcedOwnership']=![];}return respondWithRpcPromise(_0xaa22('0xa0'),_0xaa22('0xa1'),_0x560384);});}return respondWithRpcPromise('Start',_0xaa22('0xa1'),_0x560384);})[_0xaa22('0x21')](function(_0x483ed5){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x483ed5},client9002);return _0x483ed5;})['then'](respondWithResult(_0x52f995,null))[_0xaa22('0x2c')](handleError(_0x52f995,null));};exports[_0xaa22('0xa2')]=function(_0x3175c8,_0x37a28){var _0xbcefca=_0x3175c8['params']['id'];var _0x39c4fd=_0x3175c8['body'];var _0x5b1781=0xc8;var _0x1ea847=null;return db['sequelize'][_0xaa22('0xa3')]({'isolationLevel':db['sequelize']['Transaction'][_0xaa22('0xa4')][_0xaa22('0xa5')]},function(_0x5bcd9a){return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0xbcefca},'transaction':_0x5bcd9a})[_0xaa22('0x21')](function(_0x29e94a){if(_0x29e94a){return db[_0xaa22('0x89')][_0xaa22('0x3c')]({'where':{'OpenchannelAccountId':_0xbcefca},'transaction':_0x5bcd9a})['then'](function(){var _0x12d32d=_[_0xaa22('0x43')](_0x39c4fd,function(_0x16cb53){_0x16cb53[_0xaa22('0x69')]=_0xbcefca;return _0x16cb53;});return db[_0xaa22('0x89')][_0xaa22('0xa6')](_0x12d32d,{'transaction':_0x5bcd9a});});}else{_0x5b1781=0x194;_0x1ea847=[];}});})[_0xaa22('0x21')](function(){if(_0x5b1781!==0x194){return db[_0xaa22('0x89')][_0xaa22('0xa7')]({'where':{'OpenchannelAccountId':_0xbcefca},'order':'priority'})['then'](function(_0xf5554a){_0x1ea847=_0xf5554a;});}})['catch'](function(_0x4f0bae){_0x5b1781=0x1f4;logger[_0xaa22('0x27')](_0x4f0bae['stack']);if(_0x4f0bae['name']){delete _0x4f0bae[_0xaa22('0x3f')];}_0x1ea847=_0x4f0bae;})['finally'](function(){if(_0x1ea847===null){_0x37a28[_0xaa22('0x3d')](_0x5b1781);}else{if(_0x5b1781===0x1f4){_0x37a28[_0xaa22('0x2d')](_0x5b1781)[_0xaa22('0xa8')](_0x1ea847);}else{_0x37a28[_0xaa22('0x2d')](_0x5b1781)['json'](_0x1ea847);}}});};exports['getApplications']=function(_0x48582e,_0x395144,_0x15202a){var _0x15ed97={};var _0x2dfd7a={};var _0x130c22;var _0x4289b5;return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0x48582e[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x395144,null))['then'](function(_0x50a4f4){if(_0x50a4f4){_0x130c22=_0x50a4f4;_0x2dfd7a[_0xaa22('0x46')]=_[_0xaa22('0x48')](db[_0xaa22('0x89')]['rawAttributes']);_0x2dfd7a[_0xaa22('0x47')]=_[_0xaa22('0x48')](_0x48582e[_0xaa22('0x47')]);_0x2dfd7a[_0xaa22('0x49')]=_[_0xaa22('0x4a')](_0x2dfd7a[_0xaa22('0x46')],_0x2dfd7a['query']);_0x15ed97[_0xaa22('0x4c')]=_[_0xaa22('0x4a')](_0x2dfd7a['model'],qs[_0xaa22('0x4b')](_0x48582e[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x15ed97['attributes']=_0x15ed97[_0xaa22('0x4c')][_0xaa22('0x5b')]?_0x15ed97[_0xaa22('0x4c')]:_0x2dfd7a[_0xaa22('0x46')];_0x15ed97['order']=qs[_0xaa22('0x51')](_0x48582e[_0xaa22('0x47')][_0xaa22('0x51')]);_0x15ed97['where']=qs[_0xaa22('0x49')](_[_0xaa22('0x6d')](_0x48582e[_0xaa22('0x47')],_0x2dfd7a[_0xaa22('0x49')]));if(_0x48582e['query'][_0xaa22('0x53')]){_0x15ed97['where']=_[_0xaa22('0x54')](_0x15ed97[_0xaa22('0x52')],{'$or':_[_0xaa22('0x43')](_0x15ed97[_0xaa22('0x4c')],function(_0x24a521){var _0x44e2fc={};_0x44e2fc[_0x24a521]={'$like':'%'+_0x48582e[_0xaa22('0x47')][_0xaa22('0x53')]+'%'};return _0x44e2fc;})});}_0x15ed97=_[_0xaa22('0x54')]({},_0x15ed97,_0x48582e['options']);return _0x130c22[_0xaa22('0xa9')](_0x15ed97);}})[_0xaa22('0x21')](function(_0x401287){if(_0x401287){_0x4289b5=_0x401287[_0xaa22('0x5b')];if(!_0x48582e[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x15ed97['limit']=qs[_0xaa22('0x31')](_0x48582e[_0xaa22('0x47')]['limit']);_0x15ed97[_0xaa22('0x4f')]=qs[_0xaa22('0x4f')](_0x48582e[_0xaa22('0x47')][_0xaa22('0x4f')]);}return _0x130c22['getApplications'](_0x15ed97);}})[_0xaa22('0x21')](function(_0x40e7d2){if(_0x40e7d2){return _0x40e7d2?{'count':_0x4289b5,'rows':_0x40e7d2}:null;}})[_0xaa22('0x21')](respondWithResult(_0x395144,null))['catch'](handleError(_0x395144,null));};exports['getInteractions']=function(_0x55fbca,_0x548e19,_0x2b42c5){var _0x2c3b70={'raw':![],'where':{}};var _0x3e064c={};var _0x59a957={'count':0x0,'rows':[]};return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0x55fbca['params']['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x548e19,null))[_0xaa22('0x21')](function(_0x1f7ac){if(_0x1f7ac){_0x3e064c[_0xaa22('0x46')]=_[_0xaa22('0x48')](db['OpenchannelInteraction'][_0xaa22('0x6c')]);_0x3e064c[_0xaa22('0x47')]=_['keys'](_0x55fbca[_0xaa22('0x47')]);_0x3e064c[_0xaa22('0x49')]=_[_0xaa22('0x4a')](_0x3e064c[_0xaa22('0x46')],_0x3e064c[_0xaa22('0x47')]);_0x2c3b70['attributes']=_[_0xaa22('0x4a')](_0x3e064c['model'],qs['fields'](_0x55fbca[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x2c3b70['attributes']=_0x2c3b70[_0xaa22('0x4c')][_0xaa22('0x5b')]?_0x2c3b70[_0xaa22('0x4c')]:_0x3e064c[_0xaa22('0x46')];if(!_0x55fbca[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x2c3b70[_0xaa22('0x31')]=qs[_0xaa22('0x31')](_0x55fbca['query'][_0xaa22('0x31')]);_0x2c3b70[_0xaa22('0x4f')]=qs[_0xaa22('0x4f')](_0x55fbca['query']['offset']);}_0x2c3b70['order']=qs['sort'](_0x55fbca[_0xaa22('0x47')]['sort']);_0x2c3b70[_0xaa22('0x52')]=qs[_0xaa22('0x49')](_[_0xaa22('0x6d')](_0x55fbca[_0xaa22('0x47')],_0x3e064c[_0xaa22('0x49')]));_0x2c3b70[_0xaa22('0x52')][_0xaa22('0x69')]=_0x1f7ac['id'];if(_0x55fbca['query'][_0xaa22('0x53')]){_0x2c3b70[_0xaa22('0x52')]=_['merge'](_0x2c3b70['where'],{'$or':_[_0xaa22('0x43')](_0x2c3b70[_0xaa22('0x4c')],function(_0x4b3b39){var _0x412133={};_0x412133[_0x4b3b39]={'$like':'%'+_0x55fbca[_0xaa22('0x47')]['filter']+'%'};return _0x412133;})});}_0x2c3b70=_[_0xaa22('0x54')]({},_0x2c3b70,_0x55fbca[_0xaa22('0x5d')]);return db[_0xaa22('0x94')][_0xaa22('0x30')]({'where':_0x2c3b70[_0xaa22('0x52')]})['then'](function(_0x9bbadc){_0x59a957['count']=_0x9bbadc;if(_0x55fbca[_0xaa22('0x47')][_0xaa22('0x5c')]){_0x2c3b70[_0xaa22('0x56')]=[{'model':db[_0xaa22('0x75')],'as':_0xaa22('0xaa'),'required':![]},{'model':db[_0xaa22('0x9e')],'as':_0xaa22('0xab'),'attributes':[_0xaa22('0x3f'),_0xaa22('0xac'),_0xaa22('0xad')],'required':![]},{'model':db['Tag'],'as':_0xaa22('0xae'),'attributes':['id','name',_0xaa22('0xaf')],'where':_0x55fbca[_0xaa22('0x47')][_0xaa22('0xb0')]?{'id':_0x55fbca[_0xaa22('0x47')][_0xaa22('0xb0')]}:undefined,'required':_0x55fbca['query'][_0xaa22('0xb0')]?!![]:![]}];}return db[_0xaa22('0x94')]['findAll'](_0x2c3b70);})[_0xaa22('0x21')](function(_0x4b8bdb){_0x59a957[_0xaa22('0x58')]=_0x4b8bdb;return _0x59a957;});}})[_0xaa22('0x21')](respondWithFilteredResult(_0x548e19,_0x2c3b70))[_0xaa22('0x2c')](handleError(_0x548e19,null));};exports[_0xaa22('0xb1')]=function(_0x21502e,_0x1a888b,_0x4dd435){return db['OpenchannelAccount'][_0xaa22('0x5e')]({'where':{'id':_0x21502e['params']['id']}})['then'](handleEntityNotFound(_0x1a888b,null))[_0xaa22('0x21')](function(_0x4f44e3){if(_0x4f44e3){return _0x4f44e3['addAgents'](_0x21502e[_0xaa22('0x60')][_0xaa22('0x73')],_['omit'](_0x21502e[_0xaa22('0x60')],[_0xaa22('0x73'),'id'])||{})['spread'](function(_0x3188b4){for(var _0x376149=0x0;_0x376149<_0x21502e['body'][_0xaa22('0x73')][_0xaa22('0x5b')];_0x376149+=0x1){socket[_0xaa22('0xb2')](_0xaa22('0xb3'),{'UserId':Number(_0x21502e[_0xaa22('0x60')][_0xaa22('0x73')][_0x376149]),'OpenchannelAccountId':Number(_0x21502e[_0xaa22('0x67')]['id'])});}return _0x3188b4;});}})[_0xaa22('0x21')](respondWithResult(_0x1a888b,null))['catch'](handleError(_0x1a888b,null));};exports[_0xaa22('0xb4')]=function(_0xcaed70,_0x2fbd95,_0x59e5a4){return db[_0xaa22('0x5a')]['find']({'where':{'id':_0xcaed70[_0xaa22('0x67')]['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x2fbd95,null))['then'](function(_0x497980){if(_0x497980){return _0x497980[_0xaa22('0xb4')](_0xcaed70[_0xaa22('0x47')]['ids'])[_0xaa22('0x21')](function(){if(_['isArray'](_0xcaed70[_0xaa22('0x47')][_0xaa22('0x73')])){for(var _0x1ad9ed=0x0;_0x1ad9ed<_0xcaed70[_0xaa22('0x47')]['ids'][_0xaa22('0x5b')];_0x1ad9ed+=0x1){socket[_0xaa22('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0xcaed70[_0xaa22('0x47')][_0xaa22('0x73')][_0x1ad9ed]),'OpenchannelAccountId':Number(_0xcaed70[_0xaa22('0x67')]['id'])});}}else{socket['emit'](_0xaa22('0xb5'),{'UserId':Number(_0xcaed70[_0xaa22('0x47')][_0xaa22('0x73')]),'OpenchannelAccountId':Number(_0xcaed70[_0xaa22('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fbd95,null))['catch'](handleError(_0x2fbd95,null));};exports[_0xaa22('0xb6')]=function(_0x2dd7eb,_0x20481f,_0x19fb7d){var _0x577293={};var _0x5c2a56={};var _0x47f1a4;var _0x1c5b4f;return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0x2dd7eb['params']['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x20481f,null))[_0xaa22('0x21')](function(_0x25e238){if(_0x25e238){_0x47f1a4=_0x25e238;_0x5c2a56[_0xaa22('0x46')]=_[_0xaa22('0x48')](db[_0xaa22('0x9e')][_0xaa22('0x6c')]);_0x5c2a56[_0xaa22('0x47')]=_['keys'](_0x2dd7eb[_0xaa22('0x47')]);_0x5c2a56[_0xaa22('0x49')]=_[_0xaa22('0x4a')](_0x5c2a56['model'],_0x5c2a56['query']);_0x577293[_0xaa22('0x4c')]=_[_0xaa22('0x4a')](_0x5c2a56['model'],qs[_0xaa22('0x4b')](_0x2dd7eb[_0xaa22('0x47')][_0xaa22('0x4b')]));_0x577293['attributes']=_0x577293[_0xaa22('0x4c')][_0xaa22('0x5b')]?_0x577293[_0xaa22('0x4c')]:_0x5c2a56[_0xaa22('0x46')];_0x577293['order']=qs[_0xaa22('0x51')](_0x2dd7eb[_0xaa22('0x47')][_0xaa22('0x51')]);_0x577293[_0xaa22('0x52')]=qs[_0xaa22('0x49')](_[_0xaa22('0x6d')](_0x2dd7eb['query'],_0x5c2a56[_0xaa22('0x49')]));if(_0x2dd7eb[_0xaa22('0x47')]['filter']){_0x577293[_0xaa22('0x52')]=_[_0xaa22('0x54')](_0x577293[_0xaa22('0x52')],{'$or':_[_0xaa22('0x43')](_0x577293[_0xaa22('0x4c')],function(_0x1cb534){var _0x4e79e2={};_0x4e79e2[_0x1cb534]={'$like':'%'+_0x2dd7eb[_0xaa22('0x47')][_0xaa22('0x53')]+'%'};return _0x4e79e2;})});}_0x577293=_[_0xaa22('0x54')]({},_0x577293,_0x2dd7eb[_0xaa22('0x5d')]);return _0x47f1a4[_0xaa22('0xb6')](_0x577293);}})[_0xaa22('0x21')](function(_0x7ad362){if(_0x7ad362){_0x1c5b4f=_0x7ad362[_0xaa22('0x5b')];if(!_0x2dd7eb[_0xaa22('0x47')][_0xaa22('0x4d')](_0xaa22('0x4e'))){_0x577293[_0xaa22('0x31')]=qs[_0xaa22('0x31')](_0x2dd7eb[_0xaa22('0x47')]['limit']);_0x577293[_0xaa22('0x4f')]=qs[_0xaa22('0x4f')](_0x2dd7eb['query'][_0xaa22('0x4f')]);}return _0x47f1a4[_0xaa22('0xb6')](_0x577293);}})[_0xaa22('0x21')](function(_0x2d9c86){if(_0x2d9c86){return _0x2d9c86?{'count':_0x1c5b4f,'rows':_0x2d9c86}:null;}})[_0xaa22('0x21')](respondWithResult(_0x20481f,null))[_0xaa22('0x2c')](handleError(_0x20481f,null));};exports[_0xaa22('0xa8')]=function(_0x35753b,_0x1bc395,_0x517255){var _0x220fbd,_0x412384,_0x5aedfe;if(_[_0xaa22('0x7d')](_0x35753b['body'][_0xaa22('0x60')])||_0x35753b[_0xaa22('0x60')][_0xaa22('0x60')]===''){throw new db[(_0xaa22('0x76'))][(_0xaa22('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x35753b[_0xaa22('0x60')]['to'])){}_0x220fbd=_0x35753b[_0xaa22('0x60')]['to'];return db[_0xaa22('0x5a')][_0xaa22('0x71')]({'where':{'id':_0x35753b['params']['id']}})[_0xaa22('0x21')](handleEntityNotFound(_0x1bc395,null))[_0xaa22('0x21')](function(_0x58f356){if(_0x58f356){return db['OpenchannelAccount'][_0xaa22('0x5e')]({'where':{'id':_0x58f356['id']},'include':[{'model':db['CmList'],'as':_0xaa22('0x86'),'include':[{'model':db['CmContact'],'as':_0xaa22('0x87'),'where':{[_0x58f356[_0xaa22('0x82')]]:_0x220fbd},'limit':0x1,'order':[[_0xaa22('0x7a'),_0xaa22('0x88')]]}]}]})['then'](handleEntityNotFound(_0x1bc395,null))[_0xaa22('0x21')](function(_0x2e8d57){if(_0x2e8d57&&_0x2e8d57[_0xaa22('0x86')]){_0x412384=_0x2e8d57['get']({'plain':!![]});if(_0x412384[_0xaa22('0x86')]&&_0x412384[_0xaa22('0x86')][_0xaa22('0x87')]['length']){return _0x412384[_0xaa22('0x86')][_0xaa22('0x87')][0x0];}return db[_0xaa22('0x75')][_0xaa22('0x5f')](_[_0xaa22('0x19')](_0x35753b['body'],{'firstName':_0x220fbd,[_0x2e8d57[_0xaa22('0x82')]]:_0x220fbd,'phone':_0x220fbd,'ListId':_0x412384[_0xaa22('0x7c')]}));}})[_0xaa22('0x21')](handleEntityNotFound(_0x1bc395,null))[_0xaa22('0x21')](function(_0x4472d){if(_0x4472d){_0x5aedfe=_0x4472d;return db[_0xaa22('0x94')][_0xaa22('0x5e')]({'where':{'ContactId':_0x5aedfe['id'],'closed':![],'OpenchannelAccountId':_0x412384['id']}})[_0xaa22('0x21')](function(_0x363e8e){if(_0x363e8e){return[_0x363e8e,![]];}return db[_0xaa22('0x94')][_0xaa22('0x5f')]({'UserId':_0x35753b[_0xaa22('0x62')]['id'],'ContactId':_0x5aedfe['id'],'OpenchannelAccountId':_0x412384['id'],'lastMsgDirection':'out','firstMsgDirection':_0xaa22('0xb7'),'Messages':[_['merge'](_0x35753b['body'],{'read':![],'body':_0x35753b[_0xaa22('0x60')][_0xaa22('0x60')],'OpenchannelAccountId':_0x412384['id'],'UserId':_0x35753b[_0xaa22('0x62')]['id'],'ContactId':_0x5aedfe['id']})]},{'include':[{'model':db[_0xaa22('0x9c')],'as':_0xaa22('0xb8')}]})[_0xaa22('0x21')](function(_0x52803d){return[_0x52803d,!![]];});});}})[_0xaa22('0x95')](function(_0x549531,_0x58c4f4){if(_0x58c4f4){return _0x549531;}return db['OpenchannelMessage'][_0xaa22('0x5f')](_[_0xaa22('0x54')](_0x35753b['body'],{'read':![],'body':_0x35753b[_0xaa22('0x60')]['body'],'OpenchannelAccountId':_0x412384['id'],'OpenchannelInteractionId':_0x549531['id'],'UserId':_0x35753b[_0xaa22('0x62')]['id'],'ContactId':_0x5aedfe['id']}))['then'](function(_0x569777){_0x549531[_0xaa22('0xb9')][_0xaa22('0xb8')]=[];_0x549531[_0xaa22('0xb9')][_0xaa22('0xb8')][_0xaa22('0xba')](_0x569777[_0xaa22('0xb9')]);return _0x549531;});});}})[_0xaa22('0x21')](respondWithResult(_0x1bc395,null))[_0xaa22('0x2c')](handleError(_0x1bc395,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 64154fc..304a469 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x1a431c,_0x1728db){var _0x4f64af=function(_0x33193f){while(--_0x33193f){_0x1a431c['push'](_0x1a431c['shift']());}};_0x4f64af(++_0x1728db);}(_0xb58b,0x1f1));var _0xbb58=function(_0x1a86ed,_0xf98741){_0x1a86ed=_0x1a86ed-0x0;var _0xba6025=_0xb58b[_0x1a86ed];return _0xba6025;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xbb58('0x0'))['db'][_0xbb58('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb58('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbb58('0x3'),'afterDestroy':_0xbb58('0x4')};function emitEvent(_0x5c9ec5){return function(_0x226363,_0x546510,_0x2edb10){OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5+':'+_0x226363['id'],_0x226363);OpenchannelAccountEvents[_0xbb58('0x5')](_0x5c9ec5,_0x226363);_0x2edb10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xbb58('0x6')](e,emitEvent(event));}}module[_0xbb58('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x22fb=['hook','exports','OpenchannelAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x22fb,0x192));var _0xb22f=function(_0x93a380,_0x2b7826){_0x93a380=_0x93a380-0x0;var _0x44b40f=_0x22fb[_0x93a380];return _0x44b40f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb22f('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb22f('0x1'),'afterUpdate':_0xb22f('0x2'),'afterDestroy':_0xb22f('0x3')};function emitEvent(_0x10d2c4){return function(_0x201512,_0x50cdab,_0x44717d){OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4+':'+_0x201512['id'],_0x201512);OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4,_0x201512);_0x44717d(null);};}for(var e in events){if(events[_0xb22f('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb22f('0x6')](e,emitEvent(event));}}module[_0xb22f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e93c9de..e100bd7 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x389976,_0x4bde4d){var _0xfbc2a=function(_0x39223b){while(--_0x39223b){_0x389976['push'](_0x389976['shift']());}};_0xfbc2a(++_0x4bde4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x58079b,_0x1b0e27){var _0x44754a=function(_0x5bf17f){while(--_0x5bf17f){_0x58079b['push'](_0x58079b['shift']());}};_0x44754a(++_0x1b0e27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 8d019c4..8e06ba1 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7af2=['register','request','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket'];(function(_0x3ecdd8,_0xb82b0d){var _0x3d23c9=function(_0x2712cb){while(--_0x2712cb){_0x3ecdd8['push'](_0x3ecdd8['shift']());}};_0x3d23c9(++_0xb82b0d);}(_0x7af2,0x119));var _0x27af=function(_0x8fad8c,_0xf1573b){_0x8fad8c=_0x8fad8c-0x0;var _0xae3eb6=_0x7af2[_0x8fad8c];return _0xae3eb6;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});config[_0x27af('0xc')]=_['defaults'](config[_0x27af('0xc')],{'host':_0x27af('0xd'),'port':0x18eb});var socket=require(_0x27af('0xe'))(new Redis(config['redis']));require(_0x27af('0xf'))[_0x27af('0x10')](socket);function respondWithRpcPromise(_0x5841aa,_0x4e27bf,_0x1617c0){return new BPromise(function(_0x582a9e,_0x4d4729){return client[_0x27af('0x11')](_0x5841aa,_0x1617c0)['then'](function(_0x50fe01){logger[_0x27af('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e27bf,_0x27af('0x13'));logger['debug'](_0x27af('0x14'),_0x4e27bf,_0x27af('0x13'),JSON[_0x27af('0x15')](_0x50fe01));if(_0x50fe01[_0x27af('0x16')]){if(_0x50fe01[_0x27af('0x16')][_0x27af('0x17')]===0x1f4){logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);return _0x4d4729(_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);}logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);return _0x582a9e(_0x50fe01[_0x27af('0x16')][_0x27af('0x19')]);}else{logger['info'](_0x27af('0x18'),_0x4e27bf,_0x27af('0x13'));_0x582a9e(_0x50fe01['result']['message']);}})[_0x27af('0x1a')](function(_0x478572){logger[_0x27af('0x16')](_0x27af('0x18'),_0x4e27bf,_0x478572);_0x4d4729(_0x478572);});});} \ No newline at end of file +var _0xe130=['then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe130,0x127));var _0x0e13=function(_0x17fc76,_0x4ad8ef){_0x17fc76=_0x17fc76-0x0;var _0x59765c=_0xe130[_0x17fc76];return _0x59765c;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});config[_0x0e13('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e13('0xc'))(new Redis(config[_0x0e13('0xb')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2906e9,_0x124e0d,_0x3aad73){return new BPromise(function(_0x2e385d,_0x53f9a9){return client['request'](_0x2906e9,_0x3aad73)[_0x0e13('0xd')](function(_0x37a04e){logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');logger[_0x0e13('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x124e0d,_0x0e13('0x11'),JSON[_0x0e13('0x12')](_0x37a04e));if(_0x37a04e[_0x0e13('0x13')]){if(_0x37a04e[_0x0e13('0x13')][_0x0e13('0x14')]===0x1f4){logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x53f9a9(_0x37a04e['error'][_0x0e13('0x15')]);}logger[_0x0e13('0x13')](_0x0e13('0xf'),_0x124e0d,_0x37a04e[_0x0e13('0x13')][_0x0e13('0x15')]);return _0x2e385d(_0x37a04e[_0x0e13('0x13')]['message']);}else{logger[_0x0e13('0xe')](_0x0e13('0xf'),_0x124e0d,'request\x20sent');_0x2e385d(_0x37a04e['result'][_0x0e13('0x15')]);}})['catch'](function(_0x2063ca){logger['error'](_0x0e13('0xf'),_0x124e0d,_0x2063ca);_0x53f9a9(_0x2063ca);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ba79b83..71773a5 100644 --- a/server/api/openchannelAccount/openchannelAccount.socket.js +++ b/server/api/openchannelAccount/openchannelAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe189=['update','removeListener','register','length','./openchannelAccount.events'];(function(_0x471905,_0x23a91d){var _0x37bb7a=function(_0x99c55e){while(--_0x99c55e){_0x471905['push'](_0x471905['shift']());}};_0x37bb7a(++_0x23a91d);}(_0xe189,0x194));var _0x9e18=function(_0x439b73,_0x26944e){_0x439b73=_0x439b73-0x0;var _0xa8d3c=_0xe189[_0x439b73];return _0xa8d3c;};'use strict';var OpenchannelAccountEvents=require(_0x9e18('0x0'));var events=['save','remove',_0x9e18('0x1')];function createListener(_0x2bc037,_0x22eac1){return function(_0x30a009){_0x22eac1['emit'](_0x2bc037,_0x30a009);};}function removeListener(_0x49b0f7,_0x1c652d){return function(){OpenchannelAccountEvents[_0x9e18('0x2')](_0x49b0f7,_0x1c652d);};}exports[_0x9e18('0x3')]=function(_0x53d7c9){for(var _0x3e6881=0x0,_0x5e6097=events[_0x9e18('0x4')];_0x3e6881<_0x5e6097;_0x3e6881++){var _0x2e4691=events[_0x3e6881];var _0x4656a4=createListener('openchannelAccount:'+_0x2e4691,_0x53d7c9);OpenchannelAccountEvents['on'](_0x2e4691,_0x4656a4);}}; \ No newline at end of file +var _0x6898=['register','length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','removeListener'];(function(_0xdbc245,_0x2ff571){var _0xa69590=function(_0x29f586){while(--_0x29f586){_0xdbc245['push'](_0xdbc245['shift']());}};_0xa69590(++_0x2ff571);}(_0x6898,0x11b));var _0x8689=function(_0x54b8ca,_0x29e801){_0x54b8ca=_0x54b8ca-0x0;var _0x5defac=_0x6898[_0x54b8ca];return _0x5defac;};'use strict';var OpenchannelAccountEvents=require(_0x8689('0x0'));var events=['save',_0x8689('0x1'),_0x8689('0x2')];function createListener(_0x472b9d,_0x13fbdb){return function(_0x3ae917){_0x13fbdb[_0x8689('0x3')](_0x472b9d,_0x3ae917);};}function removeListener(_0x524f81,_0x5038aa){return function(){OpenchannelAccountEvents[_0x8689('0x4')](_0x524f81,_0x5038aa);};}exports[_0x8689('0x5')]=function(_0x2c723e){for(var _0x4e776d=0x0,_0xbc1b52=events[_0x8689('0x6')];_0x4e776d<_0xbc1b52;_0x4e776d++){var _0x9ab197=events[_0x4e776d];var _0x4e5261=createListener(_0x8689('0x7')+_0x9ab197,_0x2c723e);OpenchannelAccountEvents['on'](_0x9ab197,_0x4e5261);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 745497d..6b96588 100644 --- a/server/api/openchannelApplication/index.js +++ b/server/api/openchannelApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bf4=['show','post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x4aba2e,_0x4ea482){var _0x232149=function(_0x23eefa){while(--_0x23eefa){_0x4aba2e['push'](_0x4aba2e['shift']());}};_0x232149(++_0x4ea482);}(_0x3bf4,0x197));var _0x43bf=function(_0x389242,_0x34461e){_0x389242=_0x389242-0x0;var _0x3b47b3=_0x3bf4[_0x389242];return _0x3b47b3;};'use strict';var multer=require('multer');var util=require(_0x43bf('0x0'));var path=require(_0x43bf('0x1'));var timeout=require(_0x43bf('0x2'));var express=require('express');var router=express[_0x43bf('0x3')]();var fs_extra=require(_0x43bf('0x4'));var auth=require(_0x43bf('0x5'));var interaction=require(_0x43bf('0x6'));var config=require(_0x43bf('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x43bf('0x8')](),controller[_0x43bf('0x9')]);router[_0x43bf('0xa')]('/:id',auth[_0x43bf('0x8')](),controller[_0x43bf('0xb')]);router[_0x43bf('0xc')]('/',auth[_0x43bf('0x8')](),controller[_0x43bf('0xd')]);router['put']('/:id',auth[_0x43bf('0x8')](),controller[_0x43bf('0xe')]);router[_0x43bf('0xf')](_0x43bf('0x10'),auth['isAuthenticated'](),controller[_0x43bf('0x11')]);module[_0x43bf('0x12')]=router; \ No newline at end of file +var _0x7324=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7324,0x13d));var _0x4732=function(_0x1101d8,_0x255423){_0x1101d8=_0x1101d8-0x0;var _0x1351e6=_0x7324[_0x1101d8];return _0x1351e6;};'use strict';var multer=require(_0x4732('0x0'));var util=require(_0x4732('0x1'));var path=require(_0x4732('0x2'));var timeout=require(_0x4732('0x3'));var express=require(_0x4732('0x4'));var router=express[_0x4732('0x5')]();var fs_extra=require(_0x4732('0x6'));var auth=require(_0x4732('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4732('0x8'));var controller=require('./openchannelApplication.controller');router['get']('/',auth[_0x4732('0x9')](),controller[_0x4732('0xa')]);router[_0x4732('0xb')](_0x4732('0xc'),auth[_0x4732('0x9')](),controller[_0x4732('0xd')]);router[_0x4732('0xe')]('/',auth[_0x4732('0x9')](),controller[_0x4732('0xf')]);router['put'](_0x4732('0xc'),auth[_0x4732('0x9')](),controller[_0x4732('0x10')]);router[_0x4732('0x11')](_0x4732('0xc'),auth[_0x4732('0x9')](),controller[_0x4732('0x12')]);module[_0x4732('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 4085a26..89ace90 100644 --- a/server/api/openchannelApplication/openchannelApplication.attributes.js +++ b/server/api/openchannelApplication/openchannelApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b6f=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0x0b6f,0x134));var _0xf0b6=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x0b6f[_0x14476b];return _0x24e2e8;};'use strict';var Sequelize=require(_0xf0b6('0x0'));module[_0xf0b6('0x1')]={'priority':{'type':Sequelize[_0xf0b6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf0b6('0x3')],'allowNull':![],'defaultValue':_0xf0b6('0x4')},'appdata':{'type':Sequelize[_0xf0b6('0x5')]()},'description':{'type':Sequelize[_0xf0b6('0x3')]},'interval':{'type':Sequelize[_0xf0b6('0x3')],'defaultValue':_0xf0b6('0x6')}}; \ No newline at end of file +var _0xb861=['exports','STRING','noop','TEXT','sequelize'];(function(_0x26b674,_0x317289){var _0x1d458a=function(_0xc767e1){while(--_0xc767e1){_0x26b674['push'](_0x26b674['shift']());}};_0x1d458a(++_0x317289);}(_0xb861,0xf9));var _0x1b86=function(_0x11314c,_0x2ca8d7){_0x11314c=_0x11314c-0x0;var _0x12cb4a=_0xb861[_0x11314c];return _0x12cb4a;};'use strict';var Sequelize=require(_0x1b86('0x0'));module[_0x1b86('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1b86('0x2')],'allowNull':![],'defaultValue':_0x1b86('0x3')},'appdata':{'type':Sequelize[_0x1b86('0x4')]()},'description':{'type':Sequelize[_0x1b86('0x2')]},'interval':{'type':Sequelize[_0x1b86('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 7288714..bc57aa3 100644 --- a/server/api/openchannelApplication/openchannelApplication.controller.js +++ b/server/api/openchannelApplication/openchannelApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c8c=['OpenchannelApplication','include','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x382759,_0x3af145){var _0x5b087c=function(_0x2ec4a2){while(--_0x2ec4a2){_0x382759['push'](_0x382759['shift']());}};_0x5b087c(++_0x3af145);}(_0x3c8c,0xa2));var _0xc3c8=function(_0x34cc16,_0x54ef8a){_0x34cc16=_0x34cc16-0x0;var _0x4551e6=_0x3c8c[_0x34cc16];return _0x4551e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3c8('0x0'));var zipdir=require(_0xc3c8('0x1'));var jsonpatch=require(_0xc3c8('0x2'));var rp=require(_0xc3c8('0x3'));var moment=require(_0xc3c8('0x4'));var BPromise=require(_0xc3c8('0x5'));var Mustache=require(_0xc3c8('0x6'));var util=require('util');var path=require(_0xc3c8('0x7'));var sox=require('sox');var csv=require(_0xc3c8('0x8'));var ejs=require(_0xc3c8('0x9'));var fs=require('fs');var fs_extra=require(_0xc3c8('0xa'));var _=require('lodash');var squel=require(_0xc3c8('0xb'));var crypto=require(_0xc3c8('0xc'));var jsforce=require(_0xc3c8('0xd'));var deskjs=require(_0xc3c8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc3c8('0xf'));var Papa=require(_0xc3c8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3c8('0x11'));var as=require(_0xc3c8('0x12'));var hardwareService=require(_0xc3c8('0x13'));var logger=require(_0xc3c8('0x14'))('api');var utils=require(_0xc3c8('0x15'));var config=require(_0xc3c8('0x16'));var licenseUtil=require(_0xc3c8('0x17'));var db=require(_0xc3c8('0x18'))['db'];function respondWithStatusCode(_0x45d8e2,_0x271687){_0x271687=_0x271687||0xcc;return function(_0x497a22){if(_0x497a22){return _0x45d8e2[_0xc3c8('0x19')](_0x271687);}return _0x45d8e2['status'](_0x271687)['end']();};}function respondWithResult(_0xecd136,_0xda0d9c){_0xda0d9c=_0xda0d9c||0xc8;return function(_0x583d6d){if(_0x583d6d){return _0xecd136[_0xc3c8('0x1a')](_0xda0d9c)[_0xc3c8('0x1b')](_0x583d6d);}};}function respondWithFilteredResult(_0x554544,_0x1dd192){return function(_0x1c4086){if(_0x1c4086){var _0x488677=typeof _0x1dd192[_0xc3c8('0x1c')]==='undefined'&&typeof _0x1dd192[_0xc3c8('0x1d')]===_0xc3c8('0x1e');var _0x1a662a=_0x1c4086[_0xc3c8('0x1f')];var _0xeddf0c=_0x488677?0x0:_0x1dd192[_0xc3c8('0x1c')];var _0x958e1d=_0x488677?_0x1c4086['count']:_0x1dd192['offset']+_0x1dd192['limit'];var _0xc55e42;if(_0x958e1d>=_0x1a662a){_0x958e1d=_0x1a662a;_0xc55e42=0xc8;}else{_0xc55e42=0xce;}_0x554544['status'](_0xc55e42);return _0x554544[_0xc3c8('0x20')]('Content-Range',_0xeddf0c+'-'+_0x958e1d+'/'+_0x1a662a)[_0xc3c8('0x1b')](_0x1c4086);}return null;};}function patchUpdates(_0x4bdcd4){return function(_0x3e193b){try{jsonpatch[_0xc3c8('0x21')](_0x3e193b,_0x4bdcd4,!![]);}catch(_0x2e3b3d){return BPromise[_0xc3c8('0x22')](_0x2e3b3d);}return _0x3e193b[_0xc3c8('0x23')]();};}function saveUpdates(_0x435d29,_0x40fd1b){return function(_0x3cddc1){if(_0x3cddc1){return _0x3cddc1[_0xc3c8('0x24')](_0x435d29)[_0xc3c8('0x25')](function(_0x1f1a79){return _0x1f1a79;});}return null;};}function removeEntity(_0x2459ad,_0x310a41){return function(_0xdbe626){if(_0xdbe626){return _0xdbe626[_0xc3c8('0x26')]()[_0xc3c8('0x25')](function(){_0x2459ad[_0xc3c8('0x1a')](0xcc)[_0xc3c8('0x27')]();});}};}function handleEntityNotFound(_0x922442,_0x1f8a2b){return function(_0x5377d5){if(!_0x5377d5){_0x922442['sendStatus'](0x194);}return _0x5377d5;};}function handleError(_0x3ff084,_0x17c456){_0x17c456=_0x17c456||0x1f4;return function(_0x3d907d){logger['error'](_0x3d907d[_0xc3c8('0x28')]);if(_0x3d907d[_0xc3c8('0x29')]){delete _0x3d907d[_0xc3c8('0x29')];}_0x3ff084[_0xc3c8('0x1a')](_0x17c456)[_0xc3c8('0x2a')](_0x3d907d);};}exports[_0xc3c8('0x2b')]=function(_0x2e4a8a,_0x4f3151){var _0x4441a5={},_0x558ab5={},_0x5443a2={'count':0x0,'rows':[]};var _0xa3a00a=_['map'](db['OpenchannelApplication'][_0xc3c8('0x2c')],function(_0x5903b6){return{'name':_0x5903b6[_0xc3c8('0x2d')],'type':_0x5903b6[_0xc3c8('0x2e')][_0xc3c8('0x2f')]};});_0x558ab5[_0xc3c8('0x30')]=_[_0xc3c8('0x31')](_0xa3a00a,_0xc3c8('0x29'));_0x558ab5[_0xc3c8('0x32')]=_[_0xc3c8('0x33')](_0x2e4a8a[_0xc3c8('0x32')]);_0x558ab5[_0xc3c8('0x34')]=_[_0xc3c8('0x35')](_0x558ab5[_0xc3c8('0x30')],_0x558ab5[_0xc3c8('0x32')]);_0x4441a5['attributes']=_['intersection'](_0x558ab5[_0xc3c8('0x30')],qs[_0xc3c8('0x36')](_0x2e4a8a[_0xc3c8('0x32')]['fields']));_0x4441a5['attributes']=_0x4441a5[_0xc3c8('0x37')][_0xc3c8('0x38')]?_0x4441a5[_0xc3c8('0x37')]:_0x558ab5[_0xc3c8('0x30')];if(!_0x2e4a8a[_0xc3c8('0x32')]['hasOwnProperty'](_0xc3c8('0x39'))){_0x4441a5[_0xc3c8('0x1d')]=qs[_0xc3c8('0x1d')](_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x1d')]);_0x4441a5[_0xc3c8('0x1c')]=qs[_0xc3c8('0x1c')](_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x1c')]);}_0x4441a5[_0xc3c8('0x3a')]=qs[_0xc3c8('0x3b')](_0x2e4a8a['query'][_0xc3c8('0x3b')]);_0x4441a5[_0xc3c8('0x3c')]=qs['filters'](_[_0xc3c8('0x3d')](_0x2e4a8a[_0xc3c8('0x32')],_0x558ab5[_0xc3c8('0x34')]),_0xa3a00a);if(_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x3e')]){_0x4441a5['where']=_[_0xc3c8('0x3f')](_0x4441a5[_0xc3c8('0x3c')],{'$or':_[_0xc3c8('0x31')](_0xa3a00a,function(_0x40054f){if(_0x40054f['type']!==_0xc3c8('0x40')){var _0x54d995={};_0x54d995[_0x40054f[_0xc3c8('0x29')]]={'$like':'%'+_0x2e4a8a[_0xc3c8('0x32')][_0xc3c8('0x3e')]+'%'};return _0x54d995;}})});}_0x4441a5=_['merge']({},_0x4441a5,_0x2e4a8a[_0xc3c8('0x41')]);var _0x2510a0={'where':_0x4441a5[_0xc3c8('0x3c')]};return db[_0xc3c8('0x42')][_0xc3c8('0x1f')](_0x2510a0)[_0xc3c8('0x25')](function(_0x4f35b2){_0x5443a2[_0xc3c8('0x1f')]=_0x4f35b2;if(_0x2e4a8a[_0xc3c8('0x32')]['includeAll']){_0x4441a5[_0xc3c8('0x43')]=[{'all':!![]}];}return db[_0xc3c8('0x42')]['findAll'](_0x4441a5);})['then'](function(_0x3bd32d){_0x5443a2[_0xc3c8('0x44')]=_0x3bd32d;return _0x5443a2;})['then'](respondWithFilteredResult(_0x4f3151,_0x4441a5))[_0xc3c8('0x45')](handleError(_0x4f3151,null));};exports[_0xc3c8('0x46')]=function(_0x18dda1,_0x1b264b){var _0x457b57={'raw':!![],'where':{'id':_0x18dda1[_0xc3c8('0x47')]['id']}},_0x2df914={};_0x2df914[_0xc3c8('0x30')]=_['keys'](db[_0xc3c8('0x42')]['rawAttributes']);_0x2df914[_0xc3c8('0x32')]=_[_0xc3c8('0x33')](_0x18dda1[_0xc3c8('0x32')]);_0x2df914[_0xc3c8('0x34')]=_['intersection'](_0x2df914[_0xc3c8('0x30')],_0x2df914[_0xc3c8('0x32')]);_0x457b57[_0xc3c8('0x37')]=_['intersection'](_0x2df914[_0xc3c8('0x30')],qs[_0xc3c8('0x36')](_0x18dda1[_0xc3c8('0x32')][_0xc3c8('0x36')]));_0x457b57[_0xc3c8('0x37')]=_0x457b57['attributes'][_0xc3c8('0x38')]?_0x457b57['attributes']:_0x2df914[_0xc3c8('0x30')];if(_0x18dda1[_0xc3c8('0x32')][_0xc3c8('0x48')]){_0x457b57[_0xc3c8('0x43')]=[{'all':!![]}];}_0x457b57=_[_0xc3c8('0x3f')]({},_0x457b57,_0x18dda1[_0xc3c8('0x41')]);return db[_0xc3c8('0x42')]['find'](_0x457b57)['then'](handleEntityNotFound(_0x1b264b,null))[_0xc3c8('0x25')](respondWithResult(_0x1b264b,null))[_0xc3c8('0x45')](handleError(_0x1b264b,null));};exports[_0xc3c8('0x49')]=function(_0x14301f,_0xb27734){return db[_0xc3c8('0x42')][_0xc3c8('0x49')](_0x14301f[_0xc3c8('0x4a')],{})['then'](respondWithResult(_0xb27734,0xc9))[_0xc3c8('0x45')](handleError(_0xb27734,null));};exports[_0xc3c8('0x24')]=function(_0x387114,_0x2c0f58){if(_0x387114[_0xc3c8('0x4a')]['id']){delete _0x387114[_0xc3c8('0x4a')]['id'];}return db['OpenchannelApplication'][_0xc3c8('0x4b')]({'where':{'id':_0x387114['params']['id']}})['then'](handleEntityNotFound(_0x2c0f58,null))[_0xc3c8('0x25')](saveUpdates(_0x387114[_0xc3c8('0x4a')],null))[_0xc3c8('0x25')](respondWithResult(_0x2c0f58,null))[_0xc3c8('0x45')](handleError(_0x2c0f58,null));};exports[_0xc3c8('0x26')]=function(_0xb86d81,_0x4ba374){return db[_0xc3c8('0x42')][_0xc3c8('0x4b')]({'where':{'id':_0xb86d81[_0xc3c8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ba374,null))[_0xc3c8('0x25')](removeEntity(_0x4ba374,null))['catch'](handleError(_0x4ba374,null));}; \ No newline at end of file +var _0x6022=['show','params','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','then','destroy','error','name','send','map','OpenchannelApplication','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','includeAll','include','rows'];(function(_0x2c18ed,_0x78dc63){var _0x564111=function(_0x519099){while(--_0x519099){_0x2c18ed['push'](_0x2c18ed['shift']());}};_0x564111(++_0x78dc63);}(_0x6022,0xa0));var _0x2602=function(_0x51096c,_0x57b948){_0x51096c=_0x51096c-0x0;var _0x504d9e=_0x6022[_0x51096c];return _0x504d9e;};'use strict';var emlformat=require(_0x2602('0x0'));var rimraf=require(_0x2602('0x1'));var zipdir=require(_0x2602('0x2'));var jsonpatch=require(_0x2602('0x3'));var rp=require(_0x2602('0x4'));var moment=require(_0x2602('0x5'));var BPromise=require(_0x2602('0x6'));var Mustache=require('mustache');var util=require(_0x2602('0x7'));var path=require(_0x2602('0x8'));var sox=require(_0x2602('0x9'));var csv=require(_0x2602('0xa'));var ejs=require(_0x2602('0xb'));var fs=require('fs');var fs_extra=require(_0x2602('0xc'));var _=require(_0x2602('0xd'));var squel=require(_0x2602('0xe'));var crypto=require(_0x2602('0xf'));var jsforce=require(_0x2602('0x10'));var deskjs=require(_0x2602('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2602('0x12'));var Papa=require(_0x2602('0x13'));var Redis=require(_0x2602('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2602('0x15'));var hardwareService=require(_0x2602('0x16'));var logger=require(_0x2602('0x17'))(_0x2602('0x18'));var utils=require(_0x2602('0x19'));var config=require(_0x2602('0x1a'));var licenseUtil=require(_0x2602('0x1b'));var db=require(_0x2602('0x1c'))['db'];function respondWithStatusCode(_0x27a737,_0x5d6acc){_0x5d6acc=_0x5d6acc||0xcc;return function(_0x743801){if(_0x743801){return _0x27a737[_0x2602('0x1d')](_0x5d6acc);}return _0x27a737['status'](_0x5d6acc)[_0x2602('0x1e')]();};}function respondWithResult(_0x36136b,_0x3b4721){_0x3b4721=_0x3b4721||0xc8;return function(_0x8c4e9e){if(_0x8c4e9e){return _0x36136b[_0x2602('0x1f')](_0x3b4721)[_0x2602('0x20')](_0x8c4e9e);}};}function respondWithFilteredResult(_0x34a666,_0x147cfc){return function(_0x2b026d){if(_0x2b026d){var _0x317660=typeof _0x147cfc['offset']===_0x2602('0x21')&&typeof _0x147cfc[_0x2602('0x22')]===_0x2602('0x21');var _0x14c408=_0x2b026d['count'];var _0x2f5e9d=_0x317660?0x0:_0x147cfc[_0x2602('0x23')];var _0x2af9d4=_0x317660?_0x2b026d[_0x2602('0x24')]:_0x147cfc[_0x2602('0x23')]+_0x147cfc['limit'];var _0x260abf;if(_0x2af9d4>=_0x14c408){_0x2af9d4=_0x14c408;_0x260abf=0xc8;}else{_0x260abf=0xce;}_0x34a666['status'](_0x260abf);return _0x34a666[_0x2602('0x25')](_0x2602('0x26'),_0x2f5e9d+'-'+_0x2af9d4+'/'+_0x14c408)['json'](_0x2b026d);}return null;};}function patchUpdates(_0x4511e6){return function(_0x82932e){try{jsonpatch['apply'](_0x82932e,_0x4511e6,!![]);}catch(_0x59fa61){return BPromise[_0x2602('0x27')](_0x59fa61);}return _0x82932e['save']();};}function saveUpdates(_0x215e32,_0x5c2a7e){return function(_0x173def){if(_0x173def){return _0x173def['update'](_0x215e32)[_0x2602('0x28')](function(_0x2fd635){return _0x2fd635;});}return null;};}function removeEntity(_0x2e8578,_0x1749f0){return function(_0x33c596){if(_0x33c596){return _0x33c596[_0x2602('0x29')]()[_0x2602('0x28')](function(){_0x2e8578[_0x2602('0x1f')](0xcc)[_0x2602('0x1e')]();});}};}function handleEntityNotFound(_0x28a3cc,_0x21f5b5){return function(_0xa330ab){if(!_0xa330ab){_0x28a3cc[_0x2602('0x1d')](0x194);}return _0xa330ab;};}function handleError(_0x379b90,_0x436ce9){_0x436ce9=_0x436ce9||0x1f4;return function(_0x13f762){logger[_0x2602('0x2a')](_0x13f762['stack']);if(_0x13f762[_0x2602('0x2b')]){delete _0x13f762[_0x2602('0x2b')];}_0x379b90['status'](_0x436ce9)[_0x2602('0x2c')](_0x13f762);};}exports['index']=function(_0x8c755c,_0x4d43e6){var _0x4de31f={},_0x32e972={},_0x4a7f6f={'count':0x0,'rows':[]};var _0x10745c=_[_0x2602('0x2d')](db[_0x2602('0x2e')][_0x2602('0x2f')],function(_0xa59665){return{'name':_0xa59665[_0x2602('0x30')],'type':_0xa59665['type']['key']};});_0x32e972['model']=_[_0x2602('0x2d')](_0x10745c,'name');_0x32e972[_0x2602('0x31')]=_[_0x2602('0x32')](_0x8c755c[_0x2602('0x31')]);_0x32e972[_0x2602('0x33')]=_[_0x2602('0x34')](_0x32e972[_0x2602('0x35')],_0x32e972[_0x2602('0x31')]);_0x4de31f[_0x2602('0x36')]=_[_0x2602('0x34')](_0x32e972[_0x2602('0x35')],qs[_0x2602('0x37')](_0x8c755c['query'][_0x2602('0x37')]));_0x4de31f['attributes']=_0x4de31f[_0x2602('0x36')][_0x2602('0x38')]?_0x4de31f[_0x2602('0x36')]:_0x32e972[_0x2602('0x35')];if(!_0x8c755c['query'][_0x2602('0x39')](_0x2602('0x3a'))){_0x4de31f[_0x2602('0x22')]=qs[_0x2602('0x22')](_0x8c755c[_0x2602('0x31')][_0x2602('0x22')]);_0x4de31f['offset']=qs[_0x2602('0x23')](_0x8c755c[_0x2602('0x31')][_0x2602('0x23')]);}_0x4de31f['order']=qs[_0x2602('0x3b')](_0x8c755c[_0x2602('0x31')]['sort']);_0x4de31f['where']=qs['filters'](_[_0x2602('0x3c')](_0x8c755c['query'],_0x32e972[_0x2602('0x33')]),_0x10745c);if(_0x8c755c[_0x2602('0x31')][_0x2602('0x3d')]){_0x4de31f[_0x2602('0x3e')]=_['merge'](_0x4de31f[_0x2602('0x3e')],{'$or':_['map'](_0x10745c,function(_0xe02f71){if(_0xe02f71[_0x2602('0x3f')]!=='VIRTUAL'){var _0x34b765={};_0x34b765[_0xe02f71['name']]={'$like':'%'+_0x8c755c[_0x2602('0x31')][_0x2602('0x3d')]+'%'};return _0x34b765;}})});}_0x4de31f=_[_0x2602('0x40')]({},_0x4de31f,_0x8c755c['options']);var _0x30f8de={'where':_0x4de31f[_0x2602('0x3e')]};return db[_0x2602('0x2e')][_0x2602('0x24')](_0x30f8de)[_0x2602('0x28')](function(_0x5c697f){_0x4a7f6f[_0x2602('0x24')]=_0x5c697f;if(_0x8c755c[_0x2602('0x31')][_0x2602('0x41')]){_0x4de31f[_0x2602('0x42')]=[{'all':!![]}];}return db[_0x2602('0x2e')]['findAll'](_0x4de31f);})[_0x2602('0x28')](function(_0x589006){_0x4a7f6f[_0x2602('0x43')]=_0x589006;return _0x4a7f6f;})[_0x2602('0x28')](respondWithFilteredResult(_0x4d43e6,_0x4de31f))['catch'](handleError(_0x4d43e6,null));};exports[_0x2602('0x44')]=function(_0x3cd8a9,_0x4fa619){var _0x519b22={'raw':!![],'where':{'id':_0x3cd8a9[_0x2602('0x45')]['id']}},_0x2f1698={};_0x2f1698[_0x2602('0x35')]=_['keys'](db[_0x2602('0x2e')][_0x2602('0x2f')]);_0x2f1698[_0x2602('0x31')]=_[_0x2602('0x32')](_0x3cd8a9[_0x2602('0x31')]);_0x2f1698[_0x2602('0x33')]=_[_0x2602('0x34')](_0x2f1698[_0x2602('0x35')],_0x2f1698[_0x2602('0x31')]);_0x519b22[_0x2602('0x36')]=_[_0x2602('0x34')](_0x2f1698[_0x2602('0x35')],qs[_0x2602('0x37')](_0x3cd8a9[_0x2602('0x31')][_0x2602('0x37')]));_0x519b22[_0x2602('0x36')]=_0x519b22[_0x2602('0x36')][_0x2602('0x38')]?_0x519b22[_0x2602('0x36')]:_0x2f1698[_0x2602('0x35')];if(_0x3cd8a9[_0x2602('0x31')]['includeAll']){_0x519b22[_0x2602('0x42')]=[{'all':!![]}];}_0x519b22=_['merge']({},_0x519b22,_0x3cd8a9[_0x2602('0x46')]);return db[_0x2602('0x2e')]['find'](_0x519b22)[_0x2602('0x28')](handleEntityNotFound(_0x4fa619,null))['then'](respondWithResult(_0x4fa619,null))[_0x2602('0x47')](handleError(_0x4fa619,null));};exports[_0x2602('0x48')]=function(_0x3e25e8,_0x4d81fa){return db[_0x2602('0x2e')][_0x2602('0x48')](_0x3e25e8[_0x2602('0x49')],{})[_0x2602('0x28')](respondWithResult(_0x4d81fa,0xc9))[_0x2602('0x47')](handleError(_0x4d81fa,null));};exports[_0x2602('0x4a')]=function(_0x15ebea,_0x21d953){if(_0x15ebea[_0x2602('0x49')]['id']){delete _0x15ebea[_0x2602('0x49')]['id'];}return db[_0x2602('0x2e')][_0x2602('0x4b')]({'where':{'id':_0x15ebea['params']['id']}})[_0x2602('0x28')](handleEntityNotFound(_0x21d953,null))[_0x2602('0x28')](saveUpdates(_0x15ebea['body'],null))['then'](respondWithResult(_0x21d953,null))[_0x2602('0x47')](handleError(_0x21d953,null));};exports[_0x2602('0x29')]=function(_0x41276a,_0x2eb0f6){return db[_0x2602('0x2e')][_0x2602('0x4b')]({'where':{'id':_0x41276a[_0x2602('0x45')]['id']}})[_0x2602('0x28')](handleEntityNotFound(_0x2eb0f6,null))['then'](removeEntity(_0x2eb0f6,null))['catch'](handleError(_0x2eb0f6,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 25a089c..5baf2fd 100644 --- a/server/api/openchannelApplication/openchannelApplication.model.js +++ b/server/api/openchannelApplication/openchannelApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3422=['define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelApplication.attributes'];(function(_0x1986ee,_0x166c6c){var _0x5a6022=function(_0x40c75b){while(--_0x40c75b){_0x1986ee['push'](_0x1986ee['shift']());}};_0x5a6022(++_0x166c6c);}(_0x3422,0x11c));var _0x2342=function(_0x7ff20,_0x4342ba){_0x7ff20=_0x7ff20-0x0;var _0x1e7d3c=_0x3422[_0x7ff20];return _0x1e7d3c;};'use strict';var _=require(_0x2342('0x0'));var util=require(_0x2342('0x1'));var logger=require(_0x2342('0x2'))(_0x2342('0x3'));var moment=require(_0x2342('0x4'));var BPromise=require(_0x2342('0x5'));var rp=require(_0x2342('0x6'));var fs=require('fs');var path=require(_0x2342('0x7'));var rimraf=require('rimraf');var config=require(_0x2342('0x8'));var attributes=require(_0x2342('0x9'));module['exports']=function(_0x31b7b7,_0x43eb68){return _0x31b7b7[_0x2342('0xa')](_0x2342('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2342('0xc'),'collate':_0x2342('0xd')});}; \ No newline at end of file +var _0xa1af=['request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x315860,_0x142502){var _0x4a60f4=function(_0x158648){while(--_0x158648){_0x315860['push'](_0x315860['shift']());}};_0x4a60f4(++_0x142502);}(_0xa1af,0x1ba));var _0xfa1a=function(_0x3976c3,_0x572de9){_0x3976c3=_0x3976c3-0x0;var _0x203d7e=_0xa1af[_0x3976c3];return _0x203d7e;};'use strict';var _=require(_0xfa1a('0x0'));var util=require(_0xfa1a('0x1'));var logger=require(_0xfa1a('0x2'))(_0xfa1a('0x3'));var moment=require(_0xfa1a('0x4'));var BPromise=require(_0xfa1a('0x5'));var rp=require(_0xfa1a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa1a('0x7'));var config=require(_0xfa1a('0x8'));var attributes=require(_0xfa1a('0x9'));module[_0xfa1a('0xa')]=function(_0x3e6b2d,_0x5c0467){return _0x3e6b2d['define']('OpenchannelApplication',attributes,{'tableName':_0xfa1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfa1a('0xc'),'collate':_0xfa1a('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 249137a..7a4ffd3 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x088f=['options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','OpenchannelApplication','body'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x088f,0xc0));var _0xf088=function(_0x27a51c,_0x4cb759){_0x27a51c=_0x27a51c-0x0;var _0x398c13=_0x088f[_0x27a51c];return _0x398c13;};'use strict';var _=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var moment=require('moment');var BPromise=require(_0xf088('0x2'));var rs=require(_0xf088('0x3'));var fs=require('fs');var Redis=require(_0xf088('0x4'));var db=require(_0xf088('0x5'))['db'];var utils=require(_0xf088('0x6'));var logger=require(_0xf088('0x7'))(_0xf088('0x8'));var config=require(_0xf088('0x9'));var jayson=require(_0xf088('0xa'));var client=jayson['client'][_0xf088('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4269cf,_0x2eaa47,_0x468b62){return new BPromise(function(_0x4da1cd,_0x44ba9b){return client[_0xf088('0xc')](_0x4269cf,_0x468b62)[_0xf088('0xd')](function(_0x3a71ed){logger[_0xf088('0xe')](_0xf088('0xf'),_0x2eaa47,_0xf088('0x10'));logger[_0xf088('0x11')](_0xf088('0x12'),_0x2eaa47,'request\x20sent',JSON[_0xf088('0x13')](_0x3a71ed));if(_0x3a71ed['error']){if(_0x3a71ed[_0xf088('0x14')]['code']===0x1f4){logger[_0xf088('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x2eaa47,_0x3a71ed[_0xf088('0x14')]['message']);return _0x44ba9b(_0x3a71ed['error'][_0xf088('0x15')]);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x2eaa47,_0x3a71ed['error'][_0xf088('0x15')]);return _0x4da1cd(_0x3a71ed[_0xf088('0x14')][_0xf088('0x15')]);}else{logger[_0xf088('0xe')](_0xf088('0xf'),_0x2eaa47,'request\x20sent');_0x4da1cd(_0x3a71ed[_0xf088('0x16')][_0xf088('0x15')]);}})['catch'](function(_0x3ff24c){logger[_0xf088('0x14')](_0xf088('0xf'),_0x2eaa47,_0x3ff24c);_0x44ba9b(_0x3ff24c);});});}exports['UpdateOpenchannelApplication']=function(_0x4c4fdf){var _0x981a1a=this;return new Promise(function(_0x5bb3b0,_0x4ce460){return db[_0xf088('0x17')]['update'](_0x4c4fdf[_0xf088('0x18')],{'raw':_0x4c4fdf['options']?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf['options'][_0xf088('0x1b')]||null:null,'attributes':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1c')]||null:null,'limit':_0x4c4fdf[_0xf088('0x19')]?_0x4c4fdf[_0xf088('0x19')][_0xf088('0x1d')]||null:null})['then'](function(_0x5f5f52){logger[_0xf088('0xe')](_0xf088('0x1e'),_0x4c4fdf);logger[_0xf088('0x11')]('UpdateOpenchannelApplication',_0x4c4fdf,JSON[_0xf088('0x13')](_0x5f5f52));_0x5bb3b0(_0x5f5f52);})['catch'](function(_0x1af110){logger[_0xf088('0x14')]('UpdateOpenchannelApplication',_0x1af110[_0xf088('0x15')],_0x4c4fdf);_0x4ce460(_0x981a1a[_0xf088('0x14')](0x1f4,_0x1af110[_0xf088('0x15')]));});});}; \ No newline at end of file +var _0xa937=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x1f1c5b,_0x41077f){var _0x11b181=function(_0x59a9d3){while(--_0x59a9d3){_0x1f1c5b['push'](_0x1f1c5b['shift']());}};_0x11b181(++_0x41077f);}(_0xa937,0x14e));var _0x7a93=function(_0x4d7307,_0x32f2bf){_0x4d7307=_0x4d7307-0x0;var _0x95b60b=_0xa937[_0x4d7307];return _0x95b60b;};'use strict';var _=require(_0x7a93('0x0'));var util=require(_0x7a93('0x1'));var moment=require(_0x7a93('0x2'));var BPromise=require(_0x7a93('0x3'));var rs=require(_0x7a93('0x4'));var fs=require('fs');var Redis=require(_0x7a93('0x5'));var db=require(_0x7a93('0x6'))['db'];var utils=require(_0x7a93('0x7'));var logger=require(_0x7a93('0x8'))('rpc');var config=require(_0x7a93('0x9'));var jayson=require(_0x7a93('0xa'));var client=jayson[_0x7a93('0xb')][_0x7a93('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc9fd77,_0x4a615f,_0x88a239){return new BPromise(function(_0x235996,_0x3d838c){return client[_0x7a93('0xd')](_0xc9fd77,_0x88a239)[_0x7a93('0xe')](function(_0x1cbb43){logger[_0x7a93('0xf')](_0x7a93('0x10'),_0x4a615f,_0x7a93('0x11'));logger[_0x7a93('0x12')](_0x7a93('0x13'),_0x4a615f,_0x7a93('0x11'),JSON[_0x7a93('0x14')](_0x1cbb43));if(_0x1cbb43[_0x7a93('0x15')]){if(_0x1cbb43['error']['code']===0x1f4){logger[_0x7a93('0x15')](_0x7a93('0x10'),_0x4a615f,_0x1cbb43['error'][_0x7a93('0x16')]);return _0x3d838c(_0x1cbb43[_0x7a93('0x15')]['message']);}logger[_0x7a93('0x15')](_0x7a93('0x10'),_0x4a615f,_0x1cbb43[_0x7a93('0x15')][_0x7a93('0x16')]);return _0x235996(_0x1cbb43[_0x7a93('0x15')][_0x7a93('0x16')]);}else{logger[_0x7a93('0xf')](_0x7a93('0x10'),_0x4a615f,_0x7a93('0x11'));_0x235996(_0x1cbb43[_0x7a93('0x17')][_0x7a93('0x16')]);}})[_0x7a93('0x18')](function(_0x2525aa){logger[_0x7a93('0x15')](_0x7a93('0x10'),_0x4a615f,_0x2525aa);_0x3d838c(_0x2525aa);});});}exports[_0x7a93('0x19')]=function(_0x3a7c62){var _0x37be2b=this;return new Promise(function(_0x37931b,_0x29e0bf){return db[_0x7a93('0x1a')][_0x7a93('0x1b')](_0x3a7c62['body'],{'raw':_0x3a7c62[_0x7a93('0x1c')]?_0x3a7c62[_0x7a93('0x1c')][_0x7a93('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a7c62[_0x7a93('0x1c')]?_0x3a7c62[_0x7a93('0x1c')]['where']||null:null,'attributes':_0x3a7c62[_0x7a93('0x1c')]?_0x3a7c62['options'][_0x7a93('0x1e')]||null:null,'limit':_0x3a7c62[_0x7a93('0x1c')]?_0x3a7c62[_0x7a93('0x1c')][_0x7a93('0x1f')]||null:null})[_0x7a93('0xe')](function(_0x1823fe){logger[_0x7a93('0xf')](_0x7a93('0x19'),_0x3a7c62);logger['debug'](_0x7a93('0x19'),_0x3a7c62,JSON[_0x7a93('0x14')](_0x1823fe));_0x37931b(_0x1823fe);})[_0x7a93('0x18')](function(_0xfe4abf){logger[_0x7a93('0x15')](_0x7a93('0x19'),_0xfe4abf[_0x7a93('0x16')],_0x3a7c62);_0x29e0bf(_0x37be2b[_0x7a93('0x15')](0x1f4,_0xfe4abf[_0x7a93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4a0a964..03fc918 100644 --- a/server/api/openchannelInteraction/index.js +++ b/server/api/openchannelInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x274d=['download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','removeTags','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x3dd3ef,_0x215b18){var _0x1bae52=function(_0x51d737){while(--_0x51d737){_0x3dd3ef['push'](_0x3dd3ef['shift']());}};_0x1bae52(++_0x215b18);}(_0x274d,0x1a1));var _0xd274=function(_0x5c4f2c,_0x577691){_0x5c4f2c=_0x5c4f2c-0x0;var _0x37d8c3=_0x274d[_0x5c4f2c];return _0x37d8c3;};'use strict';var multer=require(_0xd274('0x0'));var util=require(_0xd274('0x1'));var path=require('path');var timeout=require(_0xd274('0x2'));var express=require('express');var router=express[_0xd274('0x3')]();var fs_extra=require(_0xd274('0x4'));var auth=require(_0xd274('0x5'));var interaction=require(_0xd274('0x6'));var config=require('../../config/environment');var controller=require(_0xd274('0x7'));router[_0xd274('0x8')]('/',auth[_0xd274('0x9')](),controller[_0xd274('0xa')]);router[_0xd274('0x8')](_0xd274('0xb'),auth[_0xd274('0x9')](),controller[_0xd274('0xc')]);router['get'](_0xd274('0xd'),auth['isAuthenticated'](),controller[_0xd274('0xe')]);router[_0xd274('0x8')](_0xd274('0xf'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xd274('0x10'),auth[_0xd274('0x9')](),controller[_0xd274('0x11')]);router[_0xd274('0x12')]('/',auth[_0xd274('0x9')](),controller[_0xd274('0x13')]);router[_0xd274('0x12')]('/:id/messages',auth[_0xd274('0x9')](),controller[_0xd274('0x14')]);router['post'](_0xd274('0x15'),auth[_0xd274('0x9')](),interaction[_0xd274('0x16')](_0xd274('0x17'),_0xd274('0x18')),controller[_0xd274('0x19')]);router[_0xd274('0x1a')](_0xd274('0xd'),auth[_0xd274('0x9')](),interaction[_0xd274('0x16')](_0xd274('0x17'),'openchannelinteraction:update'),controller[_0xd274('0x1b')]);router[_0xd274('0x1c')](_0xd274('0xd'),auth['isAuthenticated'](),interaction[_0xd274('0x16')](_0xd274('0x17'),_0xd274('0x1d')),controller['destroy']);router[_0xd274('0x1c')](_0xd274('0x15'),auth[_0xd274('0x9')](),controller[_0xd274('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xebe5=['util','path','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','addTags','/:id','openchannel','update','destroy','delete'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xebe5,0xe1));var _0x5ebe=function(_0x4b54da,_0x308983){_0x4b54da=_0x4b54da-0x0;var _0x26970e=_0xebe5[_0x4b54da];return _0x26970e;};'use strict';var multer=require('multer');var util=require(_0x5ebe('0x0'));var path=require(_0x5ebe('0x1'));var timeout=require('connect-timeout');var express=require(_0x5ebe('0x2'));var router=express[_0x5ebe('0x3')]();var fs_extra=require(_0x5ebe('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ebe('0x5'));var controller=require(_0x5ebe('0x6'));router['get']('/',auth[_0x5ebe('0x7')](),controller[_0x5ebe('0x8')]);router[_0x5ebe('0x9')](_0x5ebe('0xa'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xb')]);router[_0x5ebe('0x9')]('/:id',auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xc')]);router[_0x5ebe('0x9')](_0x5ebe('0xd'),auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xe')]);router['get']('/:id/download',auth[_0x5ebe('0x7')](),controller[_0x5ebe('0xf')]);router[_0x5ebe('0x10')]('/',auth[_0x5ebe('0x7')](),controller['create']);router[_0x5ebe('0x10')]('/:id/messages',auth[_0x5ebe('0x7')](),controller[_0x5ebe('0x11')]);router[_0x5ebe('0x10')](_0x5ebe('0x12'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller[_0x5ebe('0x13')]);router['put'](_0x5ebe('0x14'),auth[_0x5ebe('0x7')](),interaction['tracked'](_0x5ebe('0x15'),'openchannelinteraction:update'),controller[_0x5ebe('0x16')]);router['delete'](_0x5ebe('0x14'),auth['isAuthenticated'](),interaction['tracked']('openchannel','openchannelinteraction:destroy'),controller[_0x5ebe('0x17')]);router[_0x5ebe('0x18')](_0x5ebe('0x12'),auth[_0x5ebe('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e9b38c4..2a04e82 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.attributes.js +++ b/server/api/openchannelInteraction/openchannelInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e69=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x57450d,_0x1fae74){var _0x6d1f3d=function(_0x40b7d1){while(--_0x40b7d1){_0x57450d['push'](_0x57450d['shift']());}};_0x6d1f3d(++_0x1fae74);}(_0x1e69,0x85));var _0x91e6=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0x1e69[_0x34e46d];return _0x1cc6aa;};'use strict';var Sequelize=require('sequelize');module[_0x91e6('0x0')]={'closed':{'type':Sequelize[_0x91e6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x91e6('0x2')]},'disposition':{'type':Sequelize[_0x91e6('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x91e6('0x3')]},'read1stAt':{'type':Sequelize[_0x91e6('0x2')]},'threadId':{'type':Sequelize[_0x91e6('0x3')]},'externalUrl':{'type':Sequelize[_0x91e6('0x3')]},'lastMsgAt':{'type':Sequelize[_0x91e6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x91e6('0x4')]('in',_0x91e6('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x91e6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x91e6('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0d4e=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0d4e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe0d4('0x0'));module[_0xe0d4('0x1')]={'closed':{'type':Sequelize[_0xe0d4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe0d4('0x3')]},'disposition':{'type':Sequelize[_0xe0d4('0x4')]},'secondDisposition':{'type':Sequelize[_0xe0d4('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe0d4('0x4')]},'note':{'type':Sequelize[_0xe0d4('0x4')]},'read1stAt':{'type':Sequelize[_0xe0d4('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe0d4('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe0d4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe0d4('0x5')]('in',_0xe0d4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe0d4('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe0d4('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 9c5ace7..b92752d 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.controller.js +++ b/server/api/openchannelInteraction/openchannelInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf276=['openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','isEmpty','OpenchannelAccountId','where','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','OpenchannelInteraction','includeAll','include','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','N.A.','threadId','basename','createReadStream','pipe','createWriteStream','direction','out','System','firstName','transcript-','.pdf','Openchannel','log','err','unlinkSync','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','Users','map','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','field','color','from','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId'];(function(_0x17ce87,_0x1974d0){var _0x2c094e=function(_0x3e679c){while(--_0x3e679c){_0x17ce87['push'](_0x17ce87['shift']());}};_0x2c094e(++_0x1974d0);}(_0xf276,0x9c));var _0x6f27=function(_0x2c2eba,_0x3434d8){_0x2c2eba=_0x2c2eba-0x0;var _0x257ca8=_0xf276[_0x2c2eba];return _0x257ca8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6f27('0x0'));var rp=require(_0x6f27('0x1'));var moment=require(_0x6f27('0x2'));var BPromise=require(_0x6f27('0x3'));var Mustache=require(_0x6f27('0x4'));var util=require(_0x6f27('0x5'));var path=require('path');var sox=require(_0x6f27('0x6'));var csv=require('to-csv');var ejs=require(_0x6f27('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f27('0x8'));var squel=require('squel');var crypto=require(_0x6f27('0x9'));var jsforce=require(_0x6f27('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6f27('0xb'));var querystring=require(_0x6f27('0xc'));var Papa=require(_0x6f27('0xd'));var Redis=require('ioredis');var authService=require(_0x6f27('0xe'));var qs=require(_0x6f27('0xf'));var as=require(_0x6f27('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x6f27('0x11'));var logger=require(_0x6f27('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6f27('0x13'));var licenseUtil=require(_0x6f27('0x14'));var db=require(_0x6f27('0x15'))['db'];config[_0x6f27('0x16')]=_['defaults'](config[_0x6f27('0x16')],{'host':_0x6f27('0x17'),'port':0x18eb});var socket=require(_0x6f27('0x18'))(new Redis(config[_0x6f27('0x16')]));require(_0x6f27('0x19'))[_0x6f27('0x1a')](socket);function respondWithStatusCode(_0x1f7911,_0x343350){_0x343350=_0x343350||0xcc;return function(_0x458551){if(_0x458551){return _0x1f7911[_0x6f27('0x1b')](_0x343350);}return _0x1f7911[_0x6f27('0x1c')](_0x343350)[_0x6f27('0x1d')]();};}function respondWithResult(_0x5b988f,_0x40d8b5){_0x40d8b5=_0x40d8b5||0xc8;return function(_0x10d54c){if(_0x10d54c){return _0x5b988f[_0x6f27('0x1c')](_0x40d8b5)['json'](_0x10d54c);}};}function respondWithFilteredResult(_0x58b2cf,_0x4ec72a){return function(_0x368b0a){if(_0x368b0a){var _0x201ffd=typeof _0x4ec72a[_0x6f27('0x1e')]===_0x6f27('0x1f')&&typeof _0x4ec72a[_0x6f27('0x20')]==='undefined';var _0x1428a5=_0x368b0a[_0x6f27('0x21')];var _0x436dfd=_0x201ffd?0x0:_0x4ec72a['offset'];var _0x57d449=_0x201ffd?_0x368b0a[_0x6f27('0x21')]:_0x4ec72a[_0x6f27('0x1e')]+_0x4ec72a[_0x6f27('0x20')];var _0x268e93;if(_0x57d449>=_0x1428a5){_0x57d449=_0x1428a5;_0x268e93=0xc8;}else{_0x268e93=0xce;}_0x58b2cf[_0x6f27('0x1c')](_0x268e93);return _0x58b2cf[_0x6f27('0x22')]('Content-Range',_0x436dfd+'-'+_0x57d449+'/'+_0x1428a5)['json'](_0x368b0a);}return null;};}function patchUpdates(_0x24ec5a){return function(_0x3b355e){try{jsonpatch[_0x6f27('0x23')](_0x3b355e,_0x24ec5a,!![]);}catch(_0x3ee86b){return BPromise[_0x6f27('0x24')](_0x3ee86b);}return _0x3b355e[_0x6f27('0x25')]();};}function saveUpdates(_0x20e011,_0x1110d0){return function(_0x243404){if(_0x243404){return _0x243404[_0x6f27('0x26')](_0x20e011)[_0x6f27('0x27')](function(_0x96a5fc){return _0x96a5fc;});}return null;};}function removeEntity(_0x24851b,_0x32f088){return function(_0x50df23){if(_0x50df23){return _0x50df23[_0x6f27('0x28')]()[_0x6f27('0x27')](function(){_0x24851b[_0x6f27('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e9b95,_0x24750a){return function(_0xc8d25){if(!_0xc8d25){_0x3e9b95[_0x6f27('0x1b')](0x194);}return _0xc8d25;};}function handleError(_0x4468f1,_0x4761d5){_0x4761d5=_0x4761d5||0x1f4;return function(_0x5f2c84){logger['error'](_0x5f2c84[_0x6f27('0x29')]);if(_0x5f2c84[_0x6f27('0x2a')]){delete _0x5f2c84[_0x6f27('0x2a')];}_0x4468f1['status'](_0x4761d5)[_0x6f27('0x2b')](_0x5f2c84);};}function getInteractionUsers(_0x51e5a1,_0x2eee82){return new BPromise(function(_0x4e8bab,_0x5bc958){try{if(_0x2eee82[_0x51e5a1['id']]){_0x51e5a1[_0x6f27('0x2c')]=_[_0x6f27('0x2d')](_0x2eee82[_0x51e5a1['id']],function(_0x21376b){return{'id':_0x21376b['id'],'fullname':_0x21376b['fullname']};});}}catch(_0x5db769){_0x5bc958(_0x5db769);}_0x4e8bab(_0x51e5a1);});}function getInteractionTags(_0x290d5c,_0xf2100){return new BPromise(function(_0xc213a9,_0x50fe5c){try{if(_0x290d5c['TagIds']){_0x290d5c[_0x6f27('0x2e')]=[];_0x290d5c['TagIds'][_0x6f27('0x2f')](',')[_0x6f27('0x30')](function(_0x275a75){_0x290d5c[_0x6f27('0x2e')][_0x6f27('0x31')](_0xf2100[_0x275a75]);});}delete _0x290d5c['TagIds'];}catch(_0x2268c3){_0x50fe5c(_0x2268c3);}_0xc213a9(_0x290d5c);});}function updateOpenchannelInteraction(_0x4a6258,_0x2ded2,_0xfefe07){return new BPromise(function(_0x36c991,_0x15f4e0){return getInteractionUsers(_0x4a6258,_0xfefe07)[_0x6f27('0x27')](function(_0x10897c){return getInteractionTags(_0x10897c,_0x2ded2);})[_0x6f27('0x27')](function(_0x3dfc0f){return getStateInteraction(_0x3dfc0f);})[_0x6f27('0x27')](function(_0x558148){_0x36c991(_0x558148);})[_0x6f27('0x32')](function(_0x391177){_0x15f4e0(_0x391177);});});}function getStateInteraction(_0x1a9054){return new BPromise(function(_0x55360f){_0x1a9054[_0x6f27('0x33')]=0x0;_0x1a9054[_0x6f27('0x34')]=0x0;_0x1a9054[_0x6f27('0x35')]=0x0;_0x1a9054[_0x6f27('0x36')]=0x0;_0x1a9054[_0x6f27('0x37')]=0x0;if(!_0x1a9054[_0x6f27('0x38')]&&!_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x33')]+=0x1;}if(!_0x1a9054[_0x6f27('0x38')]&&_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x34')]+=0x1;if(_0x1a9054[_0x6f27('0x33')]){_0x1a9054[_0x6f27('0x33')]-=0x1;}}if(_0x1a9054[_0x6f27('0x38')]&&_0x1a9054['UserId']){_0x1a9054[_0x6f27('0x35')]+=0x1;if(_0x1a9054[_0x6f27('0x34')]){_0x1a9054[_0x6f27('0x34')]-=0x1;}}if(_0x1a9054['closed']&&!_0x1a9054[_0x6f27('0x39')]){_0x1a9054[_0x6f27('0x36')]+=0x1;if(_0x1a9054[_0x6f27('0x33')]){_0x1a9054[_0x6f27('0x33')]-=0x1;}}_0x1a9054[_0x6f27('0x37')]+=0x1;_0x55360f(_0x1a9054);});}exports['index']=function(_0x2eb9ef,_0x382d92){var _0x34cdc9={},_0x1ba4eb={},_0x461de6={'count':0x0,'rows':[]};var _0x2aa765=_[_0x6f27('0x2d')](db['OpenchannelInteraction'][_0x6f27('0x3a')],function(_0x219eb4){return{'name':_0x219eb4[_0x6f27('0x3b')],'type':_0x219eb4[_0x6f27('0x3c')][_0x6f27('0x3d')]};});_0x1ba4eb[_0x6f27('0x3e')]=_['map'](_0x2aa765,_0x6f27('0x2a'));_0x1ba4eb[_0x6f27('0x3f')]=_[_0x6f27('0x40')](_0x2eb9ef[_0x6f27('0x3f')]);_0x1ba4eb[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x1ba4eb['model'],_0x1ba4eb[_0x6f27('0x3f')]);_0x34cdc9[_0x6f27('0x43')]=_['intersection'](_0x1ba4eb[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x2eb9ef['query']['fields']));_0x34cdc9[_0x6f27('0x43')]=_0x34cdc9['attributes'][_0x6f27('0x45')]?_0x34cdc9[_0x6f27('0x43')]:_0x1ba4eb['model'];if(!_0x2eb9ef[_0x6f27('0x3f')]['hasOwnProperty'](_0x6f27('0x46'))){_0x34cdc9[_0x6f27('0x20')]=qs[_0x6f27('0x20')](_0x2eb9ef[_0x6f27('0x3f')]['limit']);_0x34cdc9[_0x6f27('0x1e')]=qs[_0x6f27('0x1e')](_0x2eb9ef[_0x6f27('0x3f')]['offset']);}_0x34cdc9[_0x6f27('0x47')]=qs[_0x6f27('0x48')](_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x48')]);_0x34cdc9['where']=qs[_0x6f27('0x41')](_['pick'](_0x2eb9ef[_0x6f27('0x3f')],_0x1ba4eb[_0x6f27('0x41')]),_0x2aa765);var _0x2924f2=[];var _0x4749ab=squel['select']()['field']('id')[_0x6f27('0x49')](_0x6f27('0x2a'))[_0x6f27('0x49')](_0x6f27('0x4a'))[_0x6f27('0x4b')]('tools_tags');var _0x166681=squel[_0x6f27('0x4c')]()[_0x6f27('0x49')](_0x6f27('0x4d'))[_0x6f27('0x49')](_0x6f27('0x4e'))[_0x6f27('0x49')]('ui.OpenchannelInteractionId')['from'](_0x6f27('0x4f'),'ui')[_0x6f27('0x50')](_0x6f27('0x51'),'u',_0x6f27('0x52'));var _0x41c1dd=squel['select']()[_0x6f27('0x4b')](_0x6f27('0x53'),'i')[_0x6f27('0x50')](_0x6f27('0x54'),'c',_0x6f27('0x55'))[_0x6f27('0x50')](_0x6f27('0x51'),'o',_0x6f27('0x56'))[_0x6f27('0x50')]('openchannel_accounts','a',_0x6f27('0x57'))[_0x6f27('0x50')](_0x6f27('0x58'),'me',_0x6f27('0x59'))[_0x6f27('0x50')](_0x6f27('0x5a'),'it',_0x6f27('0x5b'))[_0x6f27('0x50')](_0x6f27('0x5c'),'t','t.id\x20=\x20it.TagId');var _0x21180b=squel[_0x6f27('0x5d')]();var _0x51ec37=[];var _0x41eeea=squel[_0x6f27('0x5d')]();var _0x588114;if(_0x2eb9ef['query'][_0x6f27('0x5e')]){_0x588114=as[_0x6f27('0x5f')](_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x5e')]);var _0x42c359=_0x588114[_0x6f27('0x60')];for(var _0x3328e0=0x0;_0x3328e0<_0x588114[_0x6f27('0x61')][_0x6f27('0x45')];_0x3328e0++){var _0x1b63f8=_0x588114[_0x6f27('0x61')][_0x3328e0];var _0x25a6ae='i';var _0x39736e=_[_0x6f27('0x62')](_0x2aa765,[_0x6f27('0x2a'),_0x1b63f8[_0x6f27('0x49')]]);if(!_0x39736e){switch(_0x1b63f8['field']){case'unreadMessages':if(_0x1b63f8[_0x6f27('0x63')]==0x1){_0x41c1dd[_0x6f27('0x64')]('`'+_0x1b63f8['field']+_0x6f27('0x65'));}else{_0x41c1dd['having']('`'+_0x1b63f8[_0x6f27('0x49')]+_0x6f27('0x66'));}break;case _0x6f27('0x67'):if(_0x1b63f8[_0x6f27('0x68')]===_0x6f27('0x69')){if(_0x1b63f8['value'][_0x6f27('0x2f')]('\x20')[_0x6f27('0x45')]>0x1){_0x21180b[_0x42c359](_0x6f27('0x6a'),qs['getFullTextValue'](_0x1b63f8[_0x6f27('0x63')]),null);}else{var _0x35d4d8='%'+_0x1b63f8['value']+'%';_0x21180b[_0x42c359](_0x6f27('0x6b'),_0x35d4d8,_0x35d4d8,_0x35d4d8);}}else{_0x39736e=_[_0x6f27('0x62')](_0x2aa765,['name','ContactId']);_0x1b63f8[_0x6f27('0x49')]=_0x6f27('0x6c');_0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e['type'],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5[_0x6f27('0x6e')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5['value'][_0x6f27('0x1d')]);}break;case _0x6f27('0x70'):var _0x5a811d=_0x1b63f8[_0x6f27('0x63')]['split'](',')[_0x6f27('0x2d')](function(_0x6d893a){return Number(_0x6d893a);});_0x5a811d[_0x6f27('0x30')](function(_0x267a01){_0x41eeea['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x267a01+',%');});_0x51ec37=_['union'](_0x51ec37,_0x5a811d);break;case'User':if(_0x1b63f8['operator']===_0x6f27('0x69')){_0x21180b[_0x42c359](_0x6f27('0x71'),'%'+_0x1b63f8['value']+'%',null);}else{_0x39736e=_[_0x6f27('0x62')](_0x2aa765,[_0x6f27('0x2a'),'UserId']);_0x1b63f8[_0x6f27('0x49')]='UserId';_0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e[_0x6f27('0x3c')],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5[_0x6f27('0x6e')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')]['end']);}break;case _0x6f27('0x72'):_0x41a1a5=as['buildExpression']('me',null,_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5['text'],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x1d')]);break;}}else{var _0x41a1a5=as[_0x6f27('0x6d')](_0x25a6ae,_0x39736e['type'],_0x1b63f8);_0x21180b[_0x42c359](_0x41a1a5['text'],_0x41a1a5['value'][_0x6f27('0x6f')],_0x41a1a5[_0x6f27('0x63')][_0x6f27('0x1d')]);}}}else{var _0x21afaf=_(_0x2eb9ef['query'])['keys']()[_0x6f27('0x2d')](function(_0xb2e83d){return _[_0x6f27('0x73')](_0x2aa765,[_0x6f27('0x2a'),_0xb2e83d])?_0xb2e83d:undefined;})['compact']()[_0x6f27('0x63')]();if(!_[_0x6f27('0x74')](_0x21afaf)){_0x21afaf[_0x6f27('0x30')](function(_0x2c828a){if(_0x2c828a===_0x6f27('0x75')){_0x41c1dd[_0x6f27('0x76')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x6f27('0x77')](_0x2eb9ef['query'][_0x2c828a]));}else if(_0x2c828a===_0x6f27('0x78')){var _0x244daa=JSON['parse'](_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a])[_0x6f27('0x79')];var _0x1bdfb0=JSON[_0x6f27('0x7a')](_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a])[_0x6f27('0x7b')];_0x41c1dd[_0x6f27('0x76')](_0x6f27('0x7c'),_0x244daa,_0x1bdfb0);}else{if(_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a]===_0x6f27('0x7d')){_0x41c1dd['where']('i.'+_0x2c828a+_0x6f27('0x7e'));}else{_0x41c1dd['where']('i.'+_0x2c828a+_0x6f27('0x7f'),_0x2eb9ef[_0x6f27('0x3f')][_0x2c828a]);}}});}if(_0x2eb9ef[_0x6f27('0x3f')]['read']){if(_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x80')]==0x1){_0x41c1dd[_0x6f27('0x64')](_0x6f27('0x81'));}else{_0x41c1dd[_0x6f27('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x2eb9ef['query'][_0x6f27('0x82')]){_0x51ec37=_[_0x6f27('0x83')](_0x2eb9ef[_0x6f27('0x3f')]['tag'])?_0x2eb9ef[_0x6f27('0x3f')]['tag']:new Array(_0x2eb9ef['query'][_0x6f27('0x82')]);_0x51ec37[_0x6f27('0x30')](function(_0x180e4e){_0x41eeea['or'](_0x6f27('0x84'),'%,'+_0x180e4e+',%');});}if(_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x85')]){var _0x44527b=_0x2eb9ef[_0x6f27('0x3f')][_0x6f27('0x85')][_0x6f27('0x86')]('\x5c','\x5c\x5c')[_0x6f27('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44527b)){_0x21180b['or'](_0x6f27('0x87'),_0x44527b+'%');}else{_0x21180b['or'](_0x6f27('0x88'),qs['getFullTextValue'](_0x44527b))['or'](_0x6f27('0x89'),_0x44527b+'%')['or'](_0x6f27('0x8a'),_0x44527b+'%');}}}_0x41c1dd['where'](_0x21180b);_0x41c1dd[_0x6f27('0x8b')](_0x6f27('0x8c'));var _0x5dc9cb={'type':db[_0x6f27('0x8d')][_0x6f27('0x8e')]['SELECT'],'raw':!![]};var _0x31b684=_0x41c1dd[_0x6f27('0x8f')]();_0x31b684[_0x6f27('0x49')]('i.id');_0x31b684[_0x6f27('0x49')](_0x6f27('0x90'),'unreadMessages');if(_0x34cdc9[_0x6f27('0x47')]){_0x34cdc9[_0x6f27('0x47')][_0x6f27('0x30')](function(_0x3eb928){var _0xa410b4=_0x3eb928[0x0]===_0x6f27('0x91')?_0x3eb928[0x0]:'i.'+_0x3eb928[0x0];_0x41c1dd[_0x6f27('0x47')](_0xa410b4,_0x3eb928[0x1]==='DESC'?![]:!![]);});}if(!_[_0x6f27('0x74')](_0x51ec37)){_0x41c1dd[_0x6f27('0x64')](_0x41eeea);_0x31b684[_0x6f27('0x76')](_0x6f27('0x92'),_0x51ec37);}BPromise[_0x6f27('0x93')]()['then'](function(){if(!_0x588114){if(_0x2eb9ef['query'][_0x6f27('0x75')])return;_0x31b684[_0x6f27('0x76')](_0x6f27('0x94'));_0x41c1dd[_0x6f27('0x76')](_0x6f27('0x94'));return;}if(_0x2eb9ef['user'][_0x6f27('0x95')]!==_0x6f27('0x96'))return;return _0x2eb9ef['user']['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x6f27('0x27')](function(_0x36a98f){if(_['isEmpty'](_0x36a98f)){_0x31b684[_0x6f27('0x76')](_0x6f27('0x97'));_0x41c1dd[_0x6f27('0x76')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x31b684['where'](_0x6f27('0x98'),_[_0x6f27('0x2d')](_0x36a98f,'id'));_0x41c1dd['where'](_0x6f27('0x98'),_[_0x6f27('0x2d')](_0x36a98f,'id'));}});})[_0x6f27('0x27')](function(){if(_0x2eb9ef['user']['role']===_0x6f27('0x96')&&!_0x588114&&!_0x2eb9ef['query'][_0x6f27('0x75')])return[];return db['sequelize'][_0x6f27('0x3f')](_0x31b684[_0x6f27('0x99')](),_0x5dc9cb);})['then'](function(_0xefa3ef){_0x461de6['count']=_0xefa3ef[_0x6f27('0x45')];if(_0x461de6['count']===0x0)return[];return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x4749ab[_0x6f27('0x99')](),_0x5dc9cb)[_0x6f27('0x27')](function(_0x4488c8){_0x2924f2=_[_0x6f27('0x9b')](_0x4488c8,'id');_0x5dc9cb=_[_0x6f27('0x9c')](_0x5dc9cb,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eb9ef[_0x6f27('0x3f')]['fields']){_0x34cdc9[_0x6f27('0x43')]['forEach'](function(_0x1777d2){_0x41c1dd[_0x6f27('0x49')]('i.'+_0x1777d2);});}else{_0x41c1dd['field'](_0x6f27('0x90'),_0x6f27('0x9d'));_0x41c1dd['field'](_0x6f27('0x9e'),_0x6f27('0x9f'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa0'),_0x6f27('0xa1'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa2'),'contactName');_0x41c1dd['field'](_0x6f27('0xa3'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa4'),_0x6f27('0xa5'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa6'),_0x6f27('0xa7'));_0x41c1dd[_0x6f27('0x49')]('c.email',_0x6f27('0xa8'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xa9'),_0x6f27('0xaa'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xab'),_0x6f27('0xac'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xad'),_0x6f27('0xae'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xaf'),_0x6f27('0xb0'));_0x41c1dd[_0x6f27('0x49')](_0x6f27('0xb1'),_0x6f27('0xb2'));_0x41c1dd['field'](_0x6f27('0xb3'),_0x6f27('0xb4'));}if(_0x34cdc9[_0x6f27('0x20')])_0x41c1dd['limit'](_0x34cdc9[_0x6f27('0x20')]);if(_0x34cdc9[_0x6f27('0x1e')])_0x41c1dd['offset'](_0x34cdc9['offset']);return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x41c1dd[_0x6f27('0x99')](),_0x5dc9cb);})[_0x6f27('0x27')](function(_0x3f45e2){if(_0x3f45e2[_0x6f27('0x45')]>0x0)_0x166681['where'](_0x6f27('0xb5'),_[_0x6f27('0x2d')](_0x3f45e2,'id'));return db[_0x6f27('0x9a')][_0x6f27('0x3f')](_0x166681[_0x6f27('0x99')](),_0x5dc9cb)['then'](function(_0x565c30){var _0x4e8b84=_[_0x6f27('0xb6')](_0x565c30,_0x6f27('0xb7'));var _0x1e02be=[];_0x3f45e2[_0x6f27('0x30')](function(_0x26c8f6){_0x1e02be[_0x6f27('0x31')](updateOpenchannelInteraction(_0x26c8f6,_0x2924f2,_0x4e8b84));});return BPromise[_0x6f27('0xb8')](_0x1e02be);});});})['then'](function(_0x5eff89){_0x461de6[_0x6f27('0xb9')]=_0x5eff89;return _0x461de6;})[_0x6f27('0x27')](respondWithFilteredResult(_0x382d92,_0x34cdc9))[_0x6f27('0x32')](handleError(_0x382d92,null));};exports[_0x6f27('0xba')]=function(_0x275441,_0xf1d608){var _0x30b2ca={};if(_0x275441[_0x6f27('0x3f')][_0x6f27('0x3c')]&&_0x275441[_0x6f27('0x3f')][_0x6f27('0x3c')]==='from'){_0x30b2ca[_0x6f27('0x4b')]=_0x275441[_0x6f27('0xbb')]['id'];}else{_0x30b2ca['id']=_0x275441[_0x6f27('0xbb')]['id'];}var _0x5bff92={'raw':![],'where':_0x30b2ca},_0x4b10c0={};_0x4b10c0[_0x6f27('0x3e')]=_[_0x6f27('0x40')](db[_0x6f27('0xbc')][_0x6f27('0x3a')]);_0x4b10c0['query']=_[_0x6f27('0x40')](_0x275441[_0x6f27('0x3f')]);_0x4b10c0[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x4b10c0[_0x6f27('0x3e')],_0x4b10c0['query']);_0x5bff92['attributes']=_[_0x6f27('0x42')](_0x4b10c0[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x275441[_0x6f27('0x3f')][_0x6f27('0x44')]));_0x5bff92['attributes']=_0x5bff92['attributes'][_0x6f27('0x45')]?_0x5bff92[_0x6f27('0x43')]:_0x4b10c0[_0x6f27('0x3e')];if(_0x275441[_0x6f27('0x3f')][_0x6f27('0xbd')]){_0x5bff92[_0x6f27('0xbe')]=[{'all':!![]}];}_0x5bff92=_[_0x6f27('0x9c')]({},_0x5bff92,_0x275441['options']);return db[_0x6f27('0xbc')][_0x6f27('0x62')](_0x5bff92)[_0x6f27('0x27')](handleEntityNotFound(_0xf1d608,null))[_0x6f27('0x27')](respondWithResult(_0xf1d608,null))[_0x6f27('0x32')](handleError(_0xf1d608,null));};exports[_0x6f27('0xbf')]=function(_0x2cd90c,_0x4e649a){return db[_0x6f27('0xbc')][_0x6f27('0xbf')](_0x2cd90c[_0x6f27('0x72')],{})[_0x6f27('0x27')](respondWithResult(_0x4e649a,0xc9))[_0x6f27('0x32')](handleError(_0x4e649a,null));};exports[_0x6f27('0x26')]=function(_0x532b18,_0x4ad0c1){if(_0x532b18['body']['id']){delete _0x532b18[_0x6f27('0x72')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x532b18['params']['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x4ad0c1,null))[_0x6f27('0x27')](saveUpdates(_0x532b18[_0x6f27('0x72')],null))['then'](respondWithResult(_0x4ad0c1,null))[_0x6f27('0x32')](handleError(_0x4ad0c1,null));};exports['destroy']=function(_0x377879,_0x411bab){return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x377879[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x411bab,null))['then'](removeEntity(_0x411bab,null))[_0x6f27('0x32')](handleError(_0x411bab,null));};exports[_0x6f27('0xc0')]=function(_0x3e8ad6,_0x42b79f){return db[_0x6f27('0xbc')][_0x6f27('0xc0')]()[_0x6f27('0x27')](respondWithResult(_0x42b79f,null))['catch'](handleError(_0x42b79f,null));};exports[_0x6f27('0xc1')]=function(_0x2dd1d7,_0xfe23e0,_0x240d8d){return db[_0x6f27('0xc2')][_0x6f27('0x62')]({'where':{'id':_0x2dd1d7[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0xfe23e0,null))[_0x6f27('0x27')](function(_0x2cdce6){if(_0x2cdce6){return _0x2cdce6['addMessage'](_0x2dd1d7[_0x6f27('0x72')][_0x6f27('0xc3')],_[_0x6f27('0xc4')](_0x2dd1d7[_0x6f27('0x72')],[_0x6f27('0xc3'),'id'])||{});}})['then'](respondWithResult(_0xfe23e0,null))['catch'](handleError(_0xfe23e0,null));};exports['getMessages']=function(_0x34f88b,_0x21c15c,_0x5e3017){var _0x436788={'raw':![],'where':{}};var _0x5769bf={};var _0x1cff55={'count':0x0,'rows':[]};return db[_0x6f27('0xbc')][_0x6f27('0xc5')]({'where':{'id':_0x34f88b[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x21c15c,null))[_0x6f27('0x27')](function(_0x2e83a9){if(_0x2e83a9){_0x5769bf[_0x6f27('0x3e')]=_['keys'](db[_0x6f27('0xc2')][_0x6f27('0x3a')]);_0x5769bf[_0x6f27('0x3f')]=_['keys'](_0x34f88b['query']);_0x5769bf[_0x6f27('0x41')]=_[_0x6f27('0x42')](_0x5769bf[_0x6f27('0x3e')],_0x5769bf['query']);_0x436788['attributes']=_[_0x6f27('0x42')](_0x5769bf[_0x6f27('0x3e')],qs[_0x6f27('0x44')](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x44')]));_0x436788[_0x6f27('0x43')]=_0x436788[_0x6f27('0x43')][_0x6f27('0x45')]?_0x436788[_0x6f27('0x43')]:_0x5769bf[_0x6f27('0x3e')];if(!_0x34f88b['query'][_0x6f27('0xc6')](_0x6f27('0x46'))){_0x436788[_0x6f27('0x20')]=qs[_0x6f27('0x20')](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x20')]);_0x436788[_0x6f27('0x1e')]=qs[_0x6f27('0x1e')](_0x34f88b[_0x6f27('0x3f')]['offset']);}_0x436788[_0x6f27('0x47')]=qs['sort'](_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x48')]);_0x436788[_0x6f27('0x76')]=qs[_0x6f27('0x41')](_[_0x6f27('0xc7')](_0x34f88b[_0x6f27('0x3f')],_0x5769bf[_0x6f27('0x41')]));_0x436788['where'][_0x6f27('0xb7')]=_0x2e83a9['id'];if(_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x85')]){_0x436788[_0x6f27('0x76')]=_['merge'](_0x436788[_0x6f27('0x76')],{'$or':_['map'](_0x436788[_0x6f27('0x43')],function(_0x1869b1){var _0x15c51a={};_0x15c51a[_0x1869b1]={'$like':'%'+_0x34f88b[_0x6f27('0x3f')]['filter']+'%'};return _0x15c51a;})});}if(_0x34f88b['query'][_0x6f27('0x79')]){var _0x3394e5=_0x34f88b[_0x6f27('0x3f')][_0x6f27('0x79')][_0x6f27('0x2f')](',');var _0x2b168a={};_0x2b168a[_0x3394e5[0x0]]={'$gte':moment(_0x3394e5[0x1])[_0x6f27('0xc8')](_0x6f27('0xc9'))};_0x436788[_0x6f27('0x76')]=_[_0x6f27('0x9c')](_0x436788[_0x6f27('0x76')],_0x2b168a);}_0x436788=_[_0x6f27('0x9c')]({},_0x436788,_0x34f88b[_0x6f27('0xca')]);return db['OpenchannelMessage'][_0x6f27('0x21')]({'where':_0x436788[_0x6f27('0x76')]})['then'](function(_0x53956b){_0x1cff55['count']=_0x53956b;if(_0x34f88b[_0x6f27('0x3f')][_0x6f27('0xbd')]){_0x436788[_0x6f27('0xbe')]=[{'all':!![]}];}return db[_0x6f27('0xc2')][_0x6f27('0xcb')](_0x436788);})[_0x6f27('0x27')](function(_0x2335eb){_0x1cff55[_0x6f27('0xb9')]=_0x2335eb;return _0x1cff55;});}})[_0x6f27('0x27')](respondWithFilteredResult(_0x21c15c,_0x436788))[_0x6f27('0x32')](handleError(_0x21c15c,null));};exports[_0x6f27('0xcc')]=function(_0x170fcf,_0x39931f,_0x3044eb){return db['OpenchannelInteraction'][_0x6f27('0x62')]({'where':{'id':_0x170fcf['params']['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x39931f,null))[_0x6f27('0x27')](function(_0x3f8bbd){if(_0x3f8bbd){return _0x3f8bbd['setTags'](_0x170fcf[_0x6f27('0x72')][_0x6f27('0xc3')],_[_0x6f27('0xc4')](_0x170fcf['body'],[_0x6f27('0xc3'),'id'])||{})[_0x6f27('0xcd')](function(){return db[_0x6f27('0x70')]['findAll']({'attributes':['id',_0x6f27('0x2a'),_0x6f27('0x4a')],'where':{'id':_0x170fcf[_0x6f27('0x72')][_0x6f27('0xc3')]}});})['then'](function(_0x2c6f13){socket[_0x6f27('0xce')](_0x6f27('0xcf'),{'id':Number(_0x170fcf[_0x6f27('0xbb')]['id']),'tags':_0x2c6f13||[]});return{'id':Number(_0x170fcf[_0x6f27('0xbb')]['id']),'tags':_0x2c6f13||[]};});}})[_0x6f27('0x27')](respondWithResult(_0x39931f,null))['catch'](handleError(_0x39931f,null));};exports['removeTags']=function(_0x4353bb,_0x4852d0,_0x53419e){return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x4353bb[_0x6f27('0xbb')]['id']}})[_0x6f27('0x27')](handleEntityNotFound(_0x4852d0,null))[_0x6f27('0x27')](function(_0x157200){if(_0x157200){return _0x157200[_0x6f27('0xd0')](_0x4353bb[_0x6f27('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x4852d0,null))[_0x6f27('0x32')](handleError(_0x4852d0,null));};exports[_0x6f27('0xd1')]=function(_0x323afa,_0x3f195c){var _0x1b97fe=moment()[_0x6f27('0xd2')]()[_0x6f27('0x99')]();var _0xd7bebe=path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),_0x6f27('0xd5'),'tmp');var _0x157e27=path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),_0x6f27('0xd5'),_0x6f27('0xd6'));var _0x1f1313=path[_0x6f27('0xd3')](_0xd7bebe,_0x1b97fe);var _0x2b1b8f=util[_0x6f27('0xc8')](_0x6f27('0xd7'),_0x323afa[_0x6f27('0xbb')]['id'],_0x1b97fe);var _0xa07d86=path[_0x6f27('0xd3')](_0xd7bebe,_0x2b1b8f);var _0x450bd6=[];_0x450bd6['push']({'model':db[_0x6f27('0xd8')],'as':_0x6f27('0xd8'),'attributes':['id','fullname'],'raw':!![]});_0x450bd6['push']({'model':db[_0x6f27('0xd9')],'as':'Contact','attributes':['id','firstName',_0x6f27('0xda')],'raw':!![]});if(_0x323afa[_0x6f27('0x3f')][_0x6f27('0xd6')]){_0x450bd6[_0x6f27('0x31')]({'model':db[_0x6f27('0xdb')],'as':_0x6f27('0xdb'),'raw':!![]});}var _0x2627c9=[{'model':db[_0x6f27('0xc2')],'as':_0x6f27('0xdc'),'attributes':['id',_0x6f27('0x72'),'createdAt','direction',_0x6f27('0xdd'),_0x6f27('0x80')],'include':_0x450bd6}];_0x2627c9[_0x6f27('0x31')]({'model':db[_0x6f27('0xde')],'as':_0x6f27('0xdf'),'attributes':['id',_0x6f27('0x2a')]});_0x2627c9['push']({'model':db[_0x6f27('0xd8')],'as':_0x6f27('0xe0'),'attributes':['id',_0x6f27('0xe1')]});return db[_0x6f27('0xbc')][_0x6f27('0x62')]({'where':{'id':_0x323afa[_0x6f27('0xbb')]['id']},'include':_0x2627c9})[_0x6f27('0x27')](handleEntityNotFound(_0x3f195c,null))[_0x6f27('0x27')](function(_0x46e06f){if(_0x46e06f){var _0x50ecbf=_0x46e06f[_0x6f27('0xe2')]({'plain':!![]});fs[_0x6f27('0xe3')](_0x1f1313);var _0x55e48a={'channel':'Openchannel','account':_0x50ecbf[_0x6f27('0xdf')][_0x6f27('0x2a')],'agent':_0x50ecbf[_0x6f27('0xe0')]?_0x50ecbf[_0x6f27('0xe0')][_0x6f27('0xe1')]:_0x6f27('0xe4'),'createdAt':moment(_0x50ecbf[_0x6f27('0x78')])[_0x6f27('0xc8')](_0x6f27('0xc9'))[_0x6f27('0x99')](),'closedAt':_0x50ecbf[_0x6f27('0x38')]?moment(_0x50ecbf['closedAt'])[_0x6f27('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f27('0x99')]():'','disposition':_0x50ecbf['disposition'],'visibility':_0x50ecbf[_0x6f27('0xe5')]?'Public':'Private','messages':_(_0x50ecbf['Messages'])[_0x6f27('0x85')]({'secret':![]})[_0x6f27('0x2d')](function(_0x1a509a){if(_0x1a509a['Attachment']){var _0x5b82ba=path['join'](_0x157e27,_0x1a509a[_0x6f27('0xdb')][_0x6f27('0xe6')]);if(fs['existsSync'](_0x5b82ba)){fs[_0x6f27('0xe7')](_0x5b82ba)[_0x6f27('0xe8')](fs[_0x6f27('0xe9')](path[_0x6f27('0xd3')](_0x1f1313,_0x1a509a[_0x6f27('0xdb')][_0x6f27('0xe6')])));}}return{'date':moment(_0x1a509a['createdAt'])[_0x6f27('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6f27('0x99')](),'sender':_0x1a509a[_0x6f27('0xea')]===_0x6f27('0xeb')?_0x1a509a[_0x6f27('0xd8')]?_0x1a509a['User']['fullname']:_0x6f27('0xec'):_0x1a509a[_0x6f27('0x67')][_0x6f27('0xed')]+(_0x1a509a[_0x6f27('0x67')][_0x6f27('0xda')]?'\x20'+_0x1a509a['Contact'][_0x6f27('0xda')]:''),'body':_0x1a509a['Attachment']?_0x1a509a[_0x6f27('0xdb')]['basename']:_0x1a509a['body'],'direction':_0x1a509a[_0x6f27('0xea')]===_0x6f27('0xeb')?'A':'C','secret':_0x1a509a['secret'],'read':_0x1a509a[_0x6f27('0x80')],'attachment':_0x1a509a[_0x6f27('0xdb')]};})[_0x6f27('0x63')]()};return ejs['renderFile'](path[_0x6f27('0xd3')](config['root'],_0x6f27('0xd4'),'views','downloadInteraction.ejs'),{'interaction':_0x55e48a})['then'](function(_0x47697e){var _0x6b9097=path[_0x6f27('0xd3')](_0x1f1313,_0x6f27('0xee')+_0x50ecbf['id']+'-'+_0x1b97fe+_0x6f27('0xef'));var _0x855878={'path':_0x6b9097,'channel':_0x6f27('0xf0'),'interactionId':_0x50ecbf['id']};return pdf['createPdfFromHTML'](_0x47697e,_0x855878);})[_0x6f27('0x27')](function(){return new BPromise(function(_0x34aa26,_0x5c1812){zipdir(_0x1f1313,{'saveTo':_0xa07d86},function(_0x5cbba9,_0x30615f){if(_0x5cbba9)return _0x5c1812(_0x5cbba9);return _0x34aa26(_0x30615f);});})[_0x6f27('0x27')](function(){return new BPromise(function(_0x2791ef,_0x3e0e86){rimraf(_0x1f1313,function(_0x43b3b0){if(_0x43b3b0)_0x3e0e86(_0x43b3b0);return _0x2791ef();});});})['then'](function(){return _0x3f195c[_0x6f27('0xd1')](_0xa07d86,_0x2b1b8f,function(_0x42a0e5){if(_0x42a0e5){console[_0x6f27('0xf1')](_0x6f27('0xf2'),_0x42a0e5);}else{fs[_0x6f27('0xf3')](_0xa07d86);}});});});}else{return _0x3f195c[_0x6f27('0x1b')](0xc8);}})[_0x6f27('0x32')](handleError(_0x3f195c,null));}; \ No newline at end of file +var _0xd8aa=['UserId','total','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','tools_tags','u.fullname','user_has_openchannel_interactions','left_join','users','from','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','keys','some','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','params','OpenchannelInteraction','rawAttributes','includeAll','create','describe','OpenchannelMessage','addMessage','ids','pick','format','options','include','findAll','addTags','setTags','omit','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','tmp','join','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','Messages','direction','secret','Account','get','mkdirSync','Openchannel','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','Public','Private','existsSync','createReadStream','basename','System','lastName','out','renderFile','views','downloadInteraction.ejs','.pdf','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','error','name','map','fullname','Tags','TagIds','split','forEach','then','catch','waiting','talking','answered','unmanaged','closed'];(function(_0x12b453,_0x49636e){var _0x1fa557=function(_0x2aeef6){while(--_0x2aeef6){_0x12b453['push'](_0x12b453['shift']());}};_0x1fa557(++_0x49636e);}(_0xd8aa,0xb4));var _0xad8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8aa[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xad8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad8a('0x1'));var jsonpatch=require(_0xad8a('0x2'));var rp=require(_0xad8a('0x3'));var moment=require(_0xad8a('0x4'));var BPromise=require(_0xad8a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xad8a('0x6'));var csv=require(_0xad8a('0x7'));var ejs=require(_0xad8a('0x8'));var fs=require('fs');var fs_extra=require(_0xad8a('0x9'));var _=require(_0xad8a('0xa'));var squel=require(_0xad8a('0xb'));var crypto=require(_0xad8a('0xc'));var jsforce=require(_0xad8a('0xd'));var deskjs=require(_0xad8a('0xe'));var toCsv=require(_0xad8a('0x7'));var querystring=require(_0xad8a('0xf'));var Papa=require(_0xad8a('0x10'));var Redis=require(_0xad8a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xad8a('0x12'));var as=require(_0xad8a('0x13'));var pdf=require(_0xad8a('0x14'));var hardwareService=require(_0xad8a('0x15'));var logger=require('../../config/logger')(_0xad8a('0x16'));var utils=require(_0xad8a('0x17'));var config=require(_0xad8a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xad8a('0x19'))['db'];config['redis']=_[_0xad8a('0x1a')](config[_0xad8a('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xad8a('0x1c'))(new Redis(config[_0xad8a('0x1b')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x367508,_0x268878){_0x268878=_0x268878||0xcc;return function(_0x5c175f){if(_0x5c175f){return _0x367508[_0xad8a('0x1d')](_0x268878);}return _0x367508[_0xad8a('0x1e')](_0x268878)[_0xad8a('0x1f')]();};}function respondWithResult(_0xd148e7,_0x4f61a5){_0x4f61a5=_0x4f61a5||0xc8;return function(_0x2b3429){if(_0x2b3429){return _0xd148e7[_0xad8a('0x1e')](_0x4f61a5)[_0xad8a('0x20')](_0x2b3429);}};}function respondWithFilteredResult(_0x3e36cf,_0x469bac){return function(_0x127902){if(_0x127902){var _0x1ea6eb=typeof _0x469bac[_0xad8a('0x21')]===_0xad8a('0x22')&&typeof _0x469bac[_0xad8a('0x23')]===_0xad8a('0x22');var _0x456059=_0x127902[_0xad8a('0x24')];var _0x1b55bd=_0x1ea6eb?0x0:_0x469bac[_0xad8a('0x21')];var _0x75d29f=_0x1ea6eb?_0x127902[_0xad8a('0x24')]:_0x469bac[_0xad8a('0x21')]+_0x469bac[_0xad8a('0x23')];var _0x242fa8;if(_0x75d29f>=_0x456059){_0x75d29f=_0x456059;_0x242fa8=0xc8;}else{_0x242fa8=0xce;}_0x3e36cf[_0xad8a('0x1e')](_0x242fa8);return _0x3e36cf['set']('Content-Range',_0x1b55bd+'-'+_0x75d29f+'/'+_0x456059)[_0xad8a('0x20')](_0x127902);}return null;};}function patchUpdates(_0x541e1a){return function(_0x41a4a5){try{jsonpatch[_0xad8a('0x25')](_0x41a4a5,_0x541e1a,!![]);}catch(_0x9e53f9){return BPromise[_0xad8a('0x26')](_0x9e53f9);}return _0x41a4a5[_0xad8a('0x27')]();};}function saveUpdates(_0x2c7e46,_0x5bcb2a){return function(_0x41bf47){if(_0x41bf47){return _0x41bf47[_0xad8a('0x28')](_0x2c7e46)['then'](function(_0x319b19){return _0x319b19;});}return null;};}function removeEntity(_0x334180,_0x3733e2){return function(_0x2ffefe){if(_0x2ffefe){return _0x2ffefe[_0xad8a('0x29')]()['then'](function(){_0x334180[_0xad8a('0x1e')](0xcc)[_0xad8a('0x1f')]();});}};}function handleEntityNotFound(_0x17feaa,_0x2445ed){return function(_0x146d1d){if(!_0x146d1d){_0x17feaa[_0xad8a('0x1d')](0x194);}return _0x146d1d;};}function handleError(_0xd70104,_0x52cce3){_0x52cce3=_0x52cce3||0x1f4;return function(_0x463ac9){logger[_0xad8a('0x2a')](_0x463ac9['stack']);if(_0x463ac9[_0xad8a('0x2b')]){delete _0x463ac9[_0xad8a('0x2b')];}_0xd70104[_0xad8a('0x1e')](_0x52cce3)['send'](_0x463ac9);};}function getInteractionUsers(_0x3f6a9d,_0x48dbec){return new BPromise(function(_0x21bc47,_0x2568dd){try{if(_0x48dbec[_0x3f6a9d['id']]){_0x3f6a9d['Users']=_[_0xad8a('0x2c')](_0x48dbec[_0x3f6a9d['id']],function(_0x1df5d5){return{'id':_0x1df5d5['id'],'fullname':_0x1df5d5[_0xad8a('0x2d')]};});}}catch(_0x1a2844){_0x2568dd(_0x1a2844);}_0x21bc47(_0x3f6a9d);});}function getInteractionTags(_0x37d0c5,_0x30bea5){return new BPromise(function(_0x408511,_0x593067){try{if(_0x37d0c5['TagIds']){_0x37d0c5[_0xad8a('0x2e')]=[];_0x37d0c5[_0xad8a('0x2f')][_0xad8a('0x30')](',')[_0xad8a('0x31')](function(_0x4265ba){_0x37d0c5[_0xad8a('0x2e')]['push'](_0x30bea5[_0x4265ba]);});}delete _0x37d0c5[_0xad8a('0x2f')];}catch(_0x258c3c){_0x593067(_0x258c3c);}_0x408511(_0x37d0c5);});}function updateOpenchannelInteraction(_0x52e4c3,_0x45355c,_0x13812b){return new BPromise(function(_0x578293,_0x3b5e05){return getInteractionUsers(_0x52e4c3,_0x13812b)[_0xad8a('0x32')](function(_0x24dece){return getInteractionTags(_0x24dece,_0x45355c);})[_0xad8a('0x32')](function(_0x32f78d){return getStateInteraction(_0x32f78d);})['then'](function(_0x14e694){_0x578293(_0x14e694);})[_0xad8a('0x33')](function(_0x2e9dd5){_0x3b5e05(_0x2e9dd5);});});}function getStateInteraction(_0x40d3c2){return new BPromise(function(_0xf9255){_0x40d3c2[_0xad8a('0x34')]=0x0;_0x40d3c2[_0xad8a('0x35')]=0x0;_0x40d3c2[_0xad8a('0x36')]=0x0;_0x40d3c2[_0xad8a('0x37')]=0x0;_0x40d3c2['total']=0x0;if(!_0x40d3c2[_0xad8a('0x38')]&&!_0x40d3c2[_0xad8a('0x39')]){_0x40d3c2[_0xad8a('0x34')]+=0x1;}if(!_0x40d3c2[_0xad8a('0x38')]&&_0x40d3c2[_0xad8a('0x39')]){_0x40d3c2[_0xad8a('0x35')]+=0x1;if(_0x40d3c2[_0xad8a('0x34')]){_0x40d3c2[_0xad8a('0x34')]-=0x1;}}if(_0x40d3c2['closed']&&_0x40d3c2['UserId']){_0x40d3c2[_0xad8a('0x36')]+=0x1;if(_0x40d3c2['talking']){_0x40d3c2['talking']-=0x1;}}if(_0x40d3c2['closed']&&!_0x40d3c2[_0xad8a('0x39')]){_0x40d3c2[_0xad8a('0x37')]+=0x1;if(_0x40d3c2['waiting']){_0x40d3c2[_0xad8a('0x34')]-=0x1;}}_0x40d3c2[_0xad8a('0x3a')]+=0x1;_0xf9255(_0x40d3c2);});}exports['index']=function(_0x9ef9b1,_0x4ff53c){var _0x292a58={},_0x26a853={},_0x36827e={'count':0x0,'rows':[]};var _0x14f592=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x54c927){return{'name':_0x54c927[_0xad8a('0x3b')],'type':_0x54c927[_0xad8a('0x3c')][_0xad8a('0x3d')]};});_0x26a853[_0xad8a('0x3e')]=_['map'](_0x14f592,_0xad8a('0x2b'));_0x26a853['query']=_['keys'](_0x9ef9b1[_0xad8a('0x3f')]);_0x26a853['filters']=_[_0xad8a('0x40')](_0x26a853['model'],_0x26a853['query']);_0x292a58['attributes']=_[_0xad8a('0x40')](_0x26a853[_0xad8a('0x3e')],qs['fields'](_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x41')]));_0x292a58[_0xad8a('0x42')]=_0x292a58[_0xad8a('0x42')]['length']?_0x292a58[_0xad8a('0x42')]:_0x26a853[_0xad8a('0x3e')];if(!_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x43')](_0xad8a('0x44'))){_0x292a58[_0xad8a('0x23')]=qs[_0xad8a('0x23')](_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x23')]);_0x292a58['offset']=qs[_0xad8a('0x21')](_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x21')]);}_0x292a58[_0xad8a('0x45')]=qs[_0xad8a('0x46')](_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x46')]);_0x292a58[_0xad8a('0x47')]=qs['filters'](_['pick'](_0x9ef9b1['query'],_0x26a853[_0xad8a('0x48')]),_0x14f592);var _0x3ddb29=[];var _0x2b660b=squel[_0xad8a('0x49')]()[_0xad8a('0x4a')]('id')[_0xad8a('0x4a')](_0xad8a('0x2b'))[_0xad8a('0x4a')](_0xad8a('0x4b'))['from'](_0xad8a('0x4c'));var _0x798c57=squel[_0xad8a('0x49')]()[_0xad8a('0x4a')]('u.id')[_0xad8a('0x4a')](_0xad8a('0x4d'))['field']('ui.OpenchannelInteractionId')['from'](_0xad8a('0x4e'),'ui')[_0xad8a('0x4f')](_0xad8a('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x1f2a53=squel[_0xad8a('0x49')]()[_0xad8a('0x51')](_0xad8a('0x52'),'i')['left_join'](_0xad8a('0x53'),'c',_0xad8a('0x54'))['left_join'](_0xad8a('0x50'),'o',_0xad8a('0x55'))['left_join'](_0xad8a('0x56'),'a',_0xad8a('0x57'))[_0xad8a('0x4f')](_0xad8a('0x58'),'me',_0xad8a('0x59'))[_0xad8a('0x4f')](_0xad8a('0x5a'),'it',_0xad8a('0x5b'))[_0xad8a('0x4f')](_0xad8a('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x2f5a1d=squel['expr']();var _0x2c03a3=[];var _0x5c096f=squel[_0xad8a('0x5c')]();var _0x263689;if(_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x5d')]){_0x263689=as[_0xad8a('0x5e')](_0x9ef9b1[_0xad8a('0x3f')]['search']);var _0x400d53=_0x263689[_0xad8a('0x5f')];for(var _0x25892d=0x0;_0x25892d<_0x263689[_0xad8a('0x60')][_0xad8a('0x61')];_0x25892d++){var _0x416744=_0x263689[_0xad8a('0x60')][_0x25892d];var _0x143810='i';var _0x5abb88=_['find'](_0x14f592,[_0xad8a('0x2b'),_0x416744['field']]);if(!_0x5abb88){switch(_0x416744['field']){case _0xad8a('0x62'):if(_0x416744[_0xad8a('0x63')]==0x1){_0x1f2a53[_0xad8a('0x64')]('`'+_0x416744['field']+'`\x20=\x200');}else{_0x1f2a53[_0xad8a('0x64')]('`'+_0x416744[_0xad8a('0x4a')]+_0xad8a('0x65'));}break;case'Contact':if(_0x416744[_0xad8a('0x66')]===_0xad8a('0x67')){if(_0x416744[_0xad8a('0x63')][_0xad8a('0x30')]('\x20')['length']>0x1){_0x2f5a1d[_0x400d53](_0xad8a('0x68'),qs[_0xad8a('0x69')](_0x416744['value']),null);}else{var _0x129ad3='%'+_0x416744['value']+'%';_0x2f5a1d[_0x400d53](_0xad8a('0x6a'),_0x129ad3,_0x129ad3,_0x129ad3);}}else{_0x5abb88=_[_0xad8a('0x6b')](_0x14f592,['name',_0xad8a('0x6c')]);_0x416744[_0xad8a('0x4a')]=_0xad8a('0x6c');_0x4ceb17=as[_0xad8a('0x6d')](_0x143810,_0x5abb88[_0xad8a('0x3c')],_0x416744);_0x2f5a1d[_0x400d53](_0x4ceb17['text'],_0x4ceb17[_0xad8a('0x63')][_0xad8a('0x6e')],_0x4ceb17[_0xad8a('0x63')][_0xad8a('0x1f')]);}break;case _0xad8a('0x6f'):var _0x4f324e=_0x416744[_0xad8a('0x63')][_0xad8a('0x30')](',')[_0xad8a('0x2c')](function(_0x231ad9){return Number(_0x231ad9);});_0x4f324e['forEach'](function(_0x1ca533){_0x5c096f['or'](_0xad8a('0x70'),'%,'+_0x1ca533+',%');});_0x2c03a3=_[_0xad8a('0x71')](_0x2c03a3,_0x4f324e);break;case _0xad8a('0x72'):if(_0x416744[_0xad8a('0x66')]===_0xad8a('0x67')){_0x2f5a1d[_0x400d53](_0xad8a('0x73'),'%'+_0x416744[_0xad8a('0x63')]+'%',null);}else{_0x5abb88=_['find'](_0x14f592,[_0xad8a('0x2b'),'UserId']);_0x416744[_0xad8a('0x4a')]=_0xad8a('0x39');_0x4ceb17=as['buildExpression'](_0x143810,_0x5abb88[_0xad8a('0x3c')],_0x416744);_0x2f5a1d[_0x400d53](_0x4ceb17[_0xad8a('0x74')],_0x4ceb17['value'][_0xad8a('0x6e')],_0x4ceb17[_0xad8a('0x63')][_0xad8a('0x1f')]);}break;case _0xad8a('0x75'):_0x4ceb17=as[_0xad8a('0x6d')]('me',null,_0x416744);_0x2f5a1d[_0x400d53](_0x4ceb17['text'],_0x4ceb17[_0xad8a('0x63')]['start'],_0x4ceb17[_0xad8a('0x63')][_0xad8a('0x1f')]);break;}}else{var _0x4ceb17=as['buildExpression'](_0x143810,_0x5abb88[_0xad8a('0x3c')],_0x416744);_0x2f5a1d[_0x400d53](_0x4ceb17['text'],_0x4ceb17[_0xad8a('0x63')]['start'],_0x4ceb17[_0xad8a('0x63')][_0xad8a('0x1f')]);}}}else{var _0x1db855=_(_0x9ef9b1['query'])[_0xad8a('0x76')]()[_0xad8a('0x2c')](function(_0x2a1c91){return _[_0xad8a('0x77')](_0x14f592,[_0xad8a('0x2b'),_0x2a1c91])?_0x2a1c91:undefined;})[_0xad8a('0x78')]()[_0xad8a('0x63')]();if(!_[_0xad8a('0x79')](_0x1db855)){_0x1db855['forEach'](function(_0x4ab605){if(_0x4ab605===_0xad8a('0x7a')){_0x1f2a53['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xad8a('0x7b')](_0x9ef9b1['query'][_0x4ab605]));}else if(_0x4ab605===_0xad8a('0x7c')){var _0x34b6e1=JSON[_0xad8a('0x7d')](_0x9ef9b1['query'][_0x4ab605])[_0xad8a('0x7e')];var _0x6591da=JSON[_0xad8a('0x7d')](_0x9ef9b1['query'][_0x4ab605])[_0xad8a('0x7f')];_0x1f2a53[_0xad8a('0x47')](_0xad8a('0x80'),_0x34b6e1,_0x6591da);}else{if(_0x9ef9b1[_0xad8a('0x3f')][_0x4ab605]==='null'){_0x1f2a53[_0xad8a('0x47')]('i.'+_0x4ab605+_0xad8a('0x81'));}else{_0x1f2a53[_0xad8a('0x47')]('i.'+_0x4ab605+_0xad8a('0x82'),_0x9ef9b1[_0xad8a('0x3f')][_0x4ab605]);}}});}if(_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x83')]){if(_0x9ef9b1['query'][_0xad8a('0x83')]==0x1){_0x1f2a53['having']('`unreadMessages`\x20=\x200');}else{_0x1f2a53[_0xad8a('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x84')]){_0x2c03a3=_[_0xad8a('0x85')](_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x84')])?_0x9ef9b1['query'][_0xad8a('0x84')]:new Array(_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x84')]);_0x2c03a3[_0xad8a('0x31')](function(_0xecaa4d){_0x5c096f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xecaa4d+',%');});}if(_0x9ef9b1['query'][_0xad8a('0x86')]){var _0x4c010e=_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x86')][_0xad8a('0x87')]('\x5c','\x5c\x5c')[_0xad8a('0x87')](/'/g,'\x27\x27');if(qs[_0xad8a('0x88')](_0x4c010e)){_0x2f5a1d['or'](_0xad8a('0x89'),_0x4c010e+'%');}else{_0x2f5a1d['or'](_0xad8a('0x8a'),qs[_0xad8a('0x69')](_0x4c010e))['or'](_0xad8a('0x8b'),_0x4c010e+'%')['or'](_0xad8a('0x8c'),_0x4c010e+'%');}}}_0x1f2a53['where'](_0x2f5a1d);_0x1f2a53[_0xad8a('0x8d')](_0xad8a('0x8e'));var _0x67fbf4={'type':db[_0xad8a('0x8f')]['QueryTypes'][_0xad8a('0x90')],'raw':!![]};var _0x22dc45=_0x1f2a53[_0xad8a('0x91')]();_0x22dc45[_0xad8a('0x4a')](_0xad8a('0x8e'));_0x22dc45[_0xad8a('0x4a')](_0xad8a('0x92'),_0xad8a('0x62'));if(_0x292a58[_0xad8a('0x45')]){_0x292a58[_0xad8a('0x45')][_0xad8a('0x31')](function(_0x448f79){var _0x46ffa2=_0x448f79[0x0]===_0xad8a('0x93')?_0x448f79[0x0]:'i.'+_0x448f79[0x0];_0x1f2a53[_0xad8a('0x45')](_0x46ffa2,_0x448f79[0x1]===_0xad8a('0x94')?![]:!![]);});}if(!_[_0xad8a('0x79')](_0x2c03a3)){_0x1f2a53[_0xad8a('0x64')](_0x5c096f);_0x22dc45['where'](_0xad8a('0x95'),_0x2c03a3);}BPromise['resolve']()[_0xad8a('0x32')](function(){if(!_0x263689){if(_0x9ef9b1[_0xad8a('0x3f')][_0xad8a('0x7a')])return;_0x22dc45[_0xad8a('0x47')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1f2a53[_0xad8a('0x47')](_0xad8a('0x96'));return;}if(_0x9ef9b1[_0xad8a('0x97')][_0xad8a('0x98')]!==_0xad8a('0x99'))return;return _0x9ef9b1[_0xad8a('0x97')][_0xad8a('0x9a')]({'attributes':['id'],'raw':!![]})[_0xad8a('0x32')](function(_0x26f400){if(_[_0xad8a('0x79')](_0x26f400)){_0x22dc45[_0xad8a('0x47')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x1f2a53[_0xad8a('0x47')](_0xad8a('0x9b'));}else{_0x22dc45[_0xad8a('0x47')](_0xad8a('0x9c'),_[_0xad8a('0x2c')](_0x26f400,'id'));_0x1f2a53['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xad8a('0x2c')](_0x26f400,'id'));}});})[_0xad8a('0x32')](function(){if(_0x9ef9b1[_0xad8a('0x97')][_0xad8a('0x98')]===_0xad8a('0x99')&&!_0x263689&&!_0x9ef9b1['query']['OpenchannelAccountId'])return[];return db['sequelize'][_0xad8a('0x3f')](_0x22dc45['toString'](),_0x67fbf4);})[_0xad8a('0x32')](function(_0x3118f7){_0x36827e['count']=_0x3118f7[_0xad8a('0x61')];if(_0x36827e[_0xad8a('0x24')]===0x0)return[];return db[_0xad8a('0x9d')]['query'](_0x2b660b[_0xad8a('0x9e')](),_0x67fbf4)[_0xad8a('0x32')](function(_0x1387aa){_0x3ddb29=_[_0xad8a('0x9f')](_0x1387aa,'id');_0x67fbf4=_[_0xad8a('0xa0')](_0x67fbf4,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9ef9b1[_0xad8a('0x3f')]['fields']){_0x292a58['attributes']['forEach'](function(_0x1786a0){_0x1f2a53[_0xad8a('0x4a')]('i.'+_0x1786a0);});}else{_0x1f2a53[_0xad8a('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xad8a('0x62'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa1'),_0xad8a('0xa2'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa3'),_0xad8a('0xa4'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa5'),'contactName');_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa6'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa7'),_0xad8a('0xa8'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xa9'),_0xad8a('0xaa'));_0x1f2a53[_0xad8a('0x4a')]('c.email',_0xad8a('0xab'));_0x1f2a53[_0xad8a('0x4a')]('c.phone','Contact.phone');_0x1f2a53['field'](_0xad8a('0xac'),_0xad8a('0xad'));_0x1f2a53['field']('c.fax','Contact.fax');_0x1f2a53[_0xad8a('0x4a')]('o.fullname',_0xad8a('0xae'));_0x1f2a53[_0xad8a('0x4a')](_0xad8a('0xaf'),_0xad8a('0xb0'));_0x1f2a53[_0xad8a('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xad8a('0x2f'));}if(_0x292a58[_0xad8a('0x23')])_0x1f2a53[_0xad8a('0x23')](_0x292a58[_0xad8a('0x23')]);if(_0x292a58['offset'])_0x1f2a53[_0xad8a('0x21')](_0x292a58[_0xad8a('0x21')]);return db[_0xad8a('0x9d')]['query'](_0x1f2a53[_0xad8a('0x9e')](),_0x67fbf4);})[_0xad8a('0x32')](function(_0x345e53){if(_0x345e53[_0xad8a('0x61')]>0x0)_0x798c57[_0xad8a('0x47')](_0xad8a('0xb1'),_[_0xad8a('0x2c')](_0x345e53,'id'));return db[_0xad8a('0x9d')][_0xad8a('0x3f')](_0x798c57[_0xad8a('0x9e')](),_0x67fbf4)[_0xad8a('0x32')](function(_0x3441e1){var _0x2c9013=_[_0xad8a('0xb2')](_0x3441e1,_0xad8a('0xb3'));var _0x8230a=[];_0x345e53[_0xad8a('0x31')](function(_0x196019){_0x8230a[_0xad8a('0xb4')](updateOpenchannelInteraction(_0x196019,_0x3ddb29,_0x2c9013));});return BPromise['all'](_0x8230a);});});})[_0xad8a('0x32')](function(_0x1dc473){_0x36827e['rows']=_0x1dc473;return _0x36827e;})[_0xad8a('0x32')](respondWithFilteredResult(_0x4ff53c,_0x292a58))[_0xad8a('0x33')](handleError(_0x4ff53c,null));};exports['show']=function(_0x196e39,_0x5db4f4){var _0x37690e={};if(_0x196e39[_0xad8a('0x3f')][_0xad8a('0x3c')]&&_0x196e39['query'][_0xad8a('0x3c')]===_0xad8a('0x51')){_0x37690e[_0xad8a('0x51')]=_0x196e39[_0xad8a('0xb5')]['id'];}else{_0x37690e['id']=_0x196e39[_0xad8a('0xb5')]['id'];}var _0x2813d3={'raw':![],'where':_0x37690e},_0x50b3d0={};_0x50b3d0[_0xad8a('0x3e')]=_['keys'](db[_0xad8a('0xb6')][_0xad8a('0xb7')]);_0x50b3d0[_0xad8a('0x3f')]=_[_0xad8a('0x76')](_0x196e39['query']);_0x50b3d0['filters']=_[_0xad8a('0x40')](_0x50b3d0[_0xad8a('0x3e')],_0x50b3d0['query']);_0x2813d3[_0xad8a('0x42')]=_[_0xad8a('0x40')](_0x50b3d0[_0xad8a('0x3e')],qs[_0xad8a('0x41')](_0x196e39['query'][_0xad8a('0x41')]));_0x2813d3[_0xad8a('0x42')]=_0x2813d3[_0xad8a('0x42')][_0xad8a('0x61')]?_0x2813d3[_0xad8a('0x42')]:_0x50b3d0[_0xad8a('0x3e')];if(_0x196e39[_0xad8a('0x3f')][_0xad8a('0xb8')]){_0x2813d3['include']=[{'all':!![]}];}_0x2813d3=_[_0xad8a('0xa0')]({},_0x2813d3,_0x196e39['options']);return db[_0xad8a('0xb6')][_0xad8a('0x6b')](_0x2813d3)['then'](handleEntityNotFound(_0x5db4f4,null))[_0xad8a('0x32')](respondWithResult(_0x5db4f4,null))['catch'](handleError(_0x5db4f4,null));};exports[_0xad8a('0xb9')]=function(_0x952692,_0x2f71bd){return db[_0xad8a('0xb6')][_0xad8a('0xb9')](_0x952692['body'],{})[_0xad8a('0x32')](respondWithResult(_0x2f71bd,0xc9))['catch'](handleError(_0x2f71bd,null));};exports[_0xad8a('0x28')]=function(_0x50dc13,_0x468e15){if(_0x50dc13[_0xad8a('0x75')]['id']){delete _0x50dc13['body']['id'];}return db[_0xad8a('0xb6')][_0xad8a('0x6b')]({'where':{'id':_0x50dc13['params']['id']}})[_0xad8a('0x32')](handleEntityNotFound(_0x468e15,null))[_0xad8a('0x32')](saveUpdates(_0x50dc13['body'],null))[_0xad8a('0x32')](respondWithResult(_0x468e15,null))[_0xad8a('0x33')](handleError(_0x468e15,null));};exports['destroy']=function(_0x2bab80,_0x433e01){return db['OpenchannelInteraction'][_0xad8a('0x6b')]({'where':{'id':_0x2bab80[_0xad8a('0xb5')]['id']}})['then'](handleEntityNotFound(_0x433e01,null))['then'](removeEntity(_0x433e01,null))[_0xad8a('0x33')](handleError(_0x433e01,null));};exports[_0xad8a('0xba')]=function(_0x2e26a4,_0x5ecc04){return db[_0xad8a('0xb6')][_0xad8a('0xba')]()[_0xad8a('0x32')](respondWithResult(_0x5ecc04,null))[_0xad8a('0x33')](handleError(_0x5ecc04,null));};exports['addMessage']=function(_0x56360f,_0x175067,_0x3f5da5){return db[_0xad8a('0xbb')][_0xad8a('0x6b')]({'where':{'id':_0x56360f[_0xad8a('0xb5')]['id']}})[_0xad8a('0x32')](handleEntityNotFound(_0x175067,null))[_0xad8a('0x32')](function(_0x4c1878){if(_0x4c1878){return _0x4c1878[_0xad8a('0xbc')](_0x56360f[_0xad8a('0x75')][_0xad8a('0xbd')],_['omit'](_0x56360f[_0xad8a('0x75')],[_0xad8a('0xbd'),'id'])||{});}})[_0xad8a('0x32')](respondWithResult(_0x175067,null))[_0xad8a('0x33')](handleError(_0x175067,null));};exports['getMessages']=function(_0x13a296,_0x1c4448,_0x2629e7){var _0x1ae9af={'raw':![],'where':{}};var _0x29be6b={};var _0x3e811f={'count':0x0,'rows':[]};return db[_0xad8a('0xb6')]['findOne']({'where':{'id':_0x13a296['params']['id']}})[_0xad8a('0x32')](handleEntityNotFound(_0x1c4448,null))['then'](function(_0x14500a){if(_0x14500a){_0x29be6b[_0xad8a('0x3e')]=_['keys'](db[_0xad8a('0xbb')][_0xad8a('0xb7')]);_0x29be6b[_0xad8a('0x3f')]=_[_0xad8a('0x76')](_0x13a296[_0xad8a('0x3f')]);_0x29be6b['filters']=_[_0xad8a('0x40')](_0x29be6b[_0xad8a('0x3e')],_0x29be6b[_0xad8a('0x3f')]);_0x1ae9af[_0xad8a('0x42')]=_[_0xad8a('0x40')](_0x29be6b[_0xad8a('0x3e')],qs[_0xad8a('0x41')](_0x13a296['query'][_0xad8a('0x41')]));_0x1ae9af[_0xad8a('0x42')]=_0x1ae9af[_0xad8a('0x42')][_0xad8a('0x61')]?_0x1ae9af['attributes']:_0x29be6b[_0xad8a('0x3e')];if(!_0x13a296['query'][_0xad8a('0x43')](_0xad8a('0x44'))){_0x1ae9af['limit']=qs[_0xad8a('0x23')](_0x13a296[_0xad8a('0x3f')][_0xad8a('0x23')]);_0x1ae9af['offset']=qs[_0xad8a('0x21')](_0x13a296['query'][_0xad8a('0x21')]);}_0x1ae9af[_0xad8a('0x45')]=qs[_0xad8a('0x46')](_0x13a296['query'][_0xad8a('0x46')]);_0x1ae9af['where']=qs['filters'](_[_0xad8a('0xbe')](_0x13a296[_0xad8a('0x3f')],_0x29be6b[_0xad8a('0x48')]));_0x1ae9af['where'][_0xad8a('0xb3')]=_0x14500a['id'];if(_0x13a296[_0xad8a('0x3f')][_0xad8a('0x86')]){_0x1ae9af[_0xad8a('0x47')]=_[_0xad8a('0xa0')](_0x1ae9af['where'],{'$or':_[_0xad8a('0x2c')](_0x1ae9af[_0xad8a('0x42')],function(_0x6355e5){var _0x3079b4={};_0x3079b4[_0x6355e5]={'$like':'%'+_0x13a296[_0xad8a('0x3f')][_0xad8a('0x86')]+'%'};return _0x3079b4;})});}if(_0x13a296['query'][_0xad8a('0x7e')]){var _0x281ad9=_0x13a296[_0xad8a('0x3f')][_0xad8a('0x7e')][_0xad8a('0x30')](',');var _0x92e202={};_0x92e202[_0x281ad9[0x0]]={'$gte':moment(_0x281ad9[0x1])[_0xad8a('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ae9af['where']=_[_0xad8a('0xa0')](_0x1ae9af[_0xad8a('0x47')],_0x92e202);}_0x1ae9af=_['merge']({},_0x1ae9af,_0x13a296[_0xad8a('0xc0')]);return db[_0xad8a('0xbb')]['count']({'where':_0x1ae9af['where']})['then'](function(_0xea8099){_0x3e811f[_0xad8a('0x24')]=_0xea8099;if(_0x13a296[_0xad8a('0x3f')][_0xad8a('0xb8')]){_0x1ae9af[_0xad8a('0xc1')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xad8a('0xc2')](_0x1ae9af);})[_0xad8a('0x32')](function(_0x44f838){_0x3e811f['rows']=_0x44f838;return _0x3e811f;});}})[_0xad8a('0x32')](respondWithFilteredResult(_0x1c4448,_0x1ae9af))['catch'](handleError(_0x1c4448,null));};exports[_0xad8a('0xc3')]=function(_0x52cf75,_0x4627d6,_0x2b9879){return db['OpenchannelInteraction'][_0xad8a('0x6b')]({'where':{'id':_0x52cf75['params']['id']}})[_0xad8a('0x32')](handleEntityNotFound(_0x4627d6,null))[_0xad8a('0x32')](function(_0x344d3f){if(_0x344d3f){return _0x344d3f[_0xad8a('0xc4')](_0x52cf75[_0xad8a('0x75')]['ids'],_[_0xad8a('0xc5')](_0x52cf75[_0xad8a('0x75')],['ids','id'])||{})['spread'](function(){return db[_0xad8a('0x6f')][_0xad8a('0xc2')]({'attributes':['id',_0xad8a('0x2b'),_0xad8a('0x4b')],'where':{'id':_0x52cf75[_0xad8a('0x75')]['ids']}});})[_0xad8a('0x32')](function(_0x4d18fb){socket[_0xad8a('0xc6')](_0xad8a('0xc7'),{'id':Number(_0x52cf75[_0xad8a('0xb5')]['id']),'tags':_0x4d18fb||[]});return{'id':Number(_0x52cf75[_0xad8a('0xb5')]['id']),'tags':_0x4d18fb||[]};});}})[_0xad8a('0x32')](respondWithResult(_0x4627d6,null))['catch'](handleError(_0x4627d6,null));};exports[_0xad8a('0xc8')]=function(_0x51941f,_0x56c881,_0x38662e){return db[_0xad8a('0xb6')][_0xad8a('0x6b')]({'where':{'id':_0x51941f['params']['id']}})['then'](handleEntityNotFound(_0x56c881,null))[_0xad8a('0x32')](function(_0x4fe8f1){if(_0x4fe8f1){return _0x4fe8f1[_0xad8a('0xc8')](_0x51941f[_0xad8a('0x3f')][_0xad8a('0xbd')]);}})[_0xad8a('0x32')](respondWithStatusCode(_0x56c881,null))[_0xad8a('0x33')](handleError(_0x56c881,null));};exports[_0xad8a('0xc9')]=function(_0x5779d2,_0x3f1313){var _0x345973=moment()[_0xad8a('0xca')]()[_0xad8a('0x9e')]();var _0xd1325d=path['join'](config[_0xad8a('0xcb')],_0xad8a('0xcc'),'files',_0xad8a('0xcd'));var _0x1af039=path[_0xad8a('0xce')](config[_0xad8a('0xcb')],_0xad8a('0xcc'),'files',_0xad8a('0xcf'));var _0x4b4962=path[_0xad8a('0xce')](_0xd1325d,_0x345973);var _0x39a068=util[_0xad8a('0xbf')](_0xad8a('0xd0'),_0x5779d2[_0xad8a('0xb5')]['id'],_0x345973);var _0x5c74ad=path[_0xad8a('0xce')](_0xd1325d,_0x39a068);var _0x138dd7=[];_0x138dd7['push']({'model':db[_0xad8a('0x72')],'as':'User','attributes':['id',_0xad8a('0x2d')],'raw':!![]});_0x138dd7['push']({'model':db[_0xad8a('0xd1')],'as':_0xad8a('0xd2'),'attributes':['id',_0xad8a('0xd3'),'lastName'],'raw':!![]});if(_0x5779d2['query'][_0xad8a('0xcf')]){_0x138dd7['push']({'model':db[_0xad8a('0xd4')],'as':_0xad8a('0xd4'),'raw':!![]});}var _0x2503a1=[{'model':db[_0xad8a('0xbb')],'as':_0xad8a('0xd5'),'attributes':['id',_0xad8a('0x75'),_0xad8a('0x7c'),_0xad8a('0xd6'),_0xad8a('0xd7'),_0xad8a('0x83')],'include':_0x138dd7}];_0x2503a1[_0xad8a('0xb4')]({'model':db['OpenchannelAccount'],'as':_0xad8a('0xd8'),'attributes':['id',_0xad8a('0x2b')]});_0x2503a1[_0xad8a('0xb4')]({'model':db[_0xad8a('0x72')],'as':'Owner','attributes':['id',_0xad8a('0x2d')]});return db[_0xad8a('0xb6')][_0xad8a('0x6b')]({'where':{'id':_0x5779d2[_0xad8a('0xb5')]['id']},'include':_0x2503a1})[_0xad8a('0x32')](handleEntityNotFound(_0x3f1313,null))[_0xad8a('0x32')](function(_0x2cfde0){if(_0x2cfde0){var _0x39bca4=_0x2cfde0[_0xad8a('0xd9')]({'plain':!![]});fs[_0xad8a('0xda')](_0x4b4962);var _0x2eaddf={'channel':_0xad8a('0xdb'),'account':_0x39bca4[_0xad8a('0xd8')][_0xad8a('0x2b')],'agent':_0x39bca4[_0xad8a('0xdc')]?_0x39bca4[_0xad8a('0xdc')][_0xad8a('0x2d')]:_0xad8a('0xdd'),'createdAt':moment(_0x39bca4[_0xad8a('0x7c')])[_0xad8a('0xbf')](_0xad8a('0xde'))[_0xad8a('0x9e')](),'closedAt':_0x39bca4[_0xad8a('0x38')]?moment(_0x39bca4[_0xad8a('0xdf')])[_0xad8a('0xbf')](_0xad8a('0xde'))[_0xad8a('0x9e')]():'','disposition':_0x39bca4['disposition'],'visibility':_0x39bca4['threadId']?_0xad8a('0xe0'):_0xad8a('0xe1'),'messages':_(_0x39bca4['Messages'])[_0xad8a('0x86')]({'secret':![]})[_0xad8a('0x2c')](function(_0x426949){if(_0x426949['Attachment']){var _0x52299f=path['join'](_0x1af039,_0x426949['Attachment']['basename']);if(fs[_0xad8a('0xe2')](_0x52299f)){fs[_0xad8a('0xe3')](_0x52299f)['pipe'](fs['createWriteStream'](path['join'](_0x4b4962,_0x426949['Attachment'][_0xad8a('0xe4')])));}}return{'date':moment(_0x426949[_0xad8a('0x7c')])[_0xad8a('0xbf')](_0xad8a('0xde'))['toString'](),'sender':_0x426949['direction']==='out'?_0x426949[_0xad8a('0x72')]?_0x426949[_0xad8a('0x72')][_0xad8a('0x2d')]:_0xad8a('0xe5'):_0x426949[_0xad8a('0xd2')][_0xad8a('0xd3')]+(_0x426949[_0xad8a('0xd2')][_0xad8a('0xe6')]?'\x20'+_0x426949[_0xad8a('0xd2')][_0xad8a('0xe6')]:''),'body':_0x426949[_0xad8a('0xd4')]?_0x426949[_0xad8a('0xd4')][_0xad8a('0xe4')]:_0x426949[_0xad8a('0x75')],'direction':_0x426949[_0xad8a('0xd6')]===_0xad8a('0xe7')?'A':'C','secret':_0x426949[_0xad8a('0xd7')],'read':_0x426949[_0xad8a('0x83')],'attachment':_0x426949['Attachment']};})[_0xad8a('0x63')]()};return ejs[_0xad8a('0xe8')](path['join'](config['root'],_0xad8a('0xcc'),_0xad8a('0xe9'),_0xad8a('0xea')),{'interaction':_0x2eaddf})[_0xad8a('0x32')](function(_0x7ec121){var _0x382174=path['join'](_0x4b4962,'transcript-'+_0x39bca4['id']+'-'+_0x345973+_0xad8a('0xeb'));var _0x4ab305={'path':_0x382174,'channel':_0xad8a('0xdb'),'interactionId':_0x39bca4['id']};return pdf['createPdfFromHTML'](_0x7ec121,_0x4ab305);})['then'](function(){return new BPromise(function(_0x3fa770,_0x2107c9){zipdir(_0x4b4962,{'saveTo':_0x5c74ad},function(_0xecef23,_0x395429){if(_0xecef23)return _0x2107c9(_0xecef23);return _0x3fa770(_0x395429);});})[_0xad8a('0x32')](function(){return new BPromise(function(_0x3a05a5,_0x1f8b50){rimraf(_0x4b4962,function(_0x1a79a8){if(_0x1a79a8)_0x1f8b50(_0x1a79a8);return _0x3a05a5();});});})[_0xad8a('0x32')](function(){return _0x3f1313['download'](_0x5c74ad,_0x39a068,function(_0x132276){if(_0x132276){console['log']('err',_0x132276);}else{fs[_0xad8a('0xec')](_0x5c74ad);}});});});}else{return _0x3f1313[_0xad8a('0x1d')](0xc8);}})['catch'](handleError(_0x3f1313,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3c59077..7197c05 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.events.js +++ b/server/api/openchannelInteraction/openchannelInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d5f=['map','emit','catch','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','save','update','then','setDataValue','Users'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0x6d5f,0xad));var _0xf6d5=function(_0x2f3c85,_0x5498e8){_0x2f3c85=_0x2f3c85-0x0;var _0x4d2ce3=_0x6d5f[_0x2f3c85];return _0x4d2ce3;};'use strict';var EventEmitter=require(_0xf6d5('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xf6d5('0x1')];var OpenchannelMessage=require(_0xf6d5('0x2'))['db'][_0xf6d5('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf6d5('0x4'),'afterUpdate':_0xf6d5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x393f52){return function(_0x11d989,_0x44ae60,_0x28e7ce){_0x11d989['getUsers']({'attributes':['id'],'raw':!![]})[_0xf6d5('0x6')](function(_0x1b7810){_0x11d989[_0xf6d5('0x7')](_0xf6d5('0x8'),_0x1b7810[_0xf6d5('0x9')](function(_0x1e34a7){return{'id':_0x1e34a7['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x11d989['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcfeddf){_0x11d989['setDataValue']('unreadMessages',_0xcfeddf['length']);OpenchannelInteractionEvents[_0xf6d5('0xa')](_0x393f52+':'+_0x11d989['id'],_0x11d989);OpenchannelInteractionEvents[_0xf6d5('0xa')](_0x393f52,_0x11d989);_0x28e7ce(null);})[_0xf6d5('0xb')](_0x28e7ce(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xf6d5('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x79cb=['hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','then','setDataValue','Users','map','emit','hasOwnProperty'];(function(_0x52d0ba,_0x291c8a){var _0x17457f=function(_0xf44343){while(--_0xf44343){_0x52d0ba['push'](_0x52d0ba['shift']());}};_0x17457f(++_0x291c8a);}(_0x79cb,0x6b));var _0xb79c=function(_0x3ce2de,_0x2db45b){_0x3ce2de=_0x3ce2de-0x0;var _0x2fd7ed=_0x79cb[_0x3ce2de];return _0x2fd7ed;};'use strict';var EventEmitter=require(_0xb79c('0x0'));var OpenchannelInteraction=require(_0xb79c('0x1'))['db'][_0xb79c('0x2')];var OpenchannelMessage=require(_0xb79c('0x1'))['db'][_0xb79c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb79c('0x4')](0x0);var events={'afterCreate':_0xb79c('0x5'),'afterUpdate':_0xb79c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x50b43d){return function(_0x3127c9,_0x14305e,_0x5c72af){_0x3127c9['getUsers']({'attributes':['id'],'raw':!![]})[_0xb79c('0x7')](function(_0x34a072){_0x3127c9[_0xb79c('0x8')](_0xb79c('0x9'),_0x34a072[_0xb79c('0xa')](function(_0x300e61){return{'id':_0x300e61['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3127c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb79c('0x7')](function(_0x2ab6ae){_0x3127c9['setDataValue']('unreadMessages',_0x2ab6ae['length']);OpenchannelInteractionEvents[_0xb79c('0xb')](_0x50b43d+':'+_0x3127c9['id'],_0x3127c9);OpenchannelInteractionEvents[_0xb79c('0xb')](_0x50b43d,_0x3127c9);_0x5c72af(null);})['catch'](_0x5c72af(null));};}for(var e in events){if(events[_0xb79c('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xb79c('0xd')](e,emitEvent(event));}}module[_0xb79c('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index a1fd1a1..85f78fb 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.model.js +++ b/server/api/openchannelInteraction/openchannelInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3128=['moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','format','lodash','util'];(function(_0x8f088a,_0x1a74b5){var _0x115ecb=function(_0xad0519){while(--_0xad0519){_0x8f088a['push'](_0x8f088a['shift']());}};_0x115ecb(++_0x1a74b5);}(_0x3128,0xd0));var _0x8312=function(_0x2c0830,_0x1df98b){_0x2c0830=_0x2c0830-0x0;var _0x3df376=_0x3128[_0x2c0830];return _0x3df376;};'use strict';var _=require(_0x8312('0x0'));var util=require(_0x8312('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8312('0x2'));var BPromise=require(_0x8312('0x3'));var rp=require(_0x8312('0x4'));var fs=require('fs');var path=require(_0x8312('0x5'));var rimraf=require(_0x8312('0x6'));var config=require('../../config/environment');var attributes=require(_0x8312('0x7'));module[_0x8312('0x8')]=function(_0x4d547d,_0x54a636){return _0x4d547d[_0x8312('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x8312('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8312('0xb'),'hooks':{'beforeUpdate':function(_0x477b64,_0xc609ae,_0x1be5c7){if(_0x477b64[_0x8312('0xc')](_0x8312('0xd'))){_0x477b64['closedAt']=moment()[_0x8312('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1be5c7(null,_0x477b64);}}});}; \ No newline at end of file +var _0x8af3=['lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x836465,_0x5442ae){var _0x2150ea=function(_0x4f4bc2){while(--_0x4f4bc2){_0x836465['push'](_0x836465['shift']());}};_0x2150ea(++_0x5442ae);}(_0x8af3,0x140));var _0x38af=function(_0x1be316,_0x1dc7f1){_0x1be316=_0x1be316-0x0;var _0x227761=_0x8af3[_0x1be316];return _0x227761;};'use strict';var _=require(_0x38af('0x0'));var util=require(_0x38af('0x1'));var logger=require('../../config/logger')(_0x38af('0x2'));var moment=require(_0x38af('0x3'));var BPromise=require(_0x38af('0x4'));var rp=require(_0x38af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x38af('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x38af('0x7')]=function(_0x2bb11e,_0x37702d){return _0x2bb11e[_0x38af('0x8')](_0x38af('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x38af('0xa'),'collate':_0x38af('0xb'),'hooks':{'beforeUpdate':function(_0x4d2984,_0x39af0c,_0x34e880){if(_0x4d2984[_0x38af('0xc')](_0x38af('0xd'))){_0x4d2984[_0x38af('0xe')]=moment()['format'](_0x38af('0xf'));}_0x34e880(null,_0x4d2984);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 735ac4a..846b599 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.rpc.js +++ b/server/api/openchannelInteraction/openchannelInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb268=['ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','find','addTags'];(function(_0x59360e,_0x2d96fc){var _0x2163e6=function(_0x268c55){while(--_0x268c55){_0x59360e['push'](_0x59360e['shift']());}};_0x2163e6(++_0x2d96fc);}(_0xb268,0x16b));var _0x8b26=function(_0x40b24e,_0x38e559){_0x40b24e=_0x40b24e-0x0;var _0x458673=_0xb268[_0x40b24e];return _0x458673;};'use strict';var _=require(_0x8b26('0x0'));var util=require(_0x8b26('0x1'));var moment=require(_0x8b26('0x2'));var BPromise=require(_0x8b26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b26('0x4'));var db=require(_0x8b26('0x5'))['db'];var utils=require(_0x8b26('0x6'));var logger=require(_0x8b26('0x7'))(_0x8b26('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8b26('0x9')][_0x8b26('0xa')]({'port':0x232a});config[_0x8b26('0xb')]=_['defaults'](config[_0x8b26('0xb')],{'host':_0x8b26('0xc'),'port':0x18eb});var socket=require(_0x8b26('0xd'))(new Redis(config['redis']));require(_0x8b26('0xe'))['register'](socket);function respondWithRpcPromise(_0x16fff7,_0x57639f,_0x17dcac){return new BPromise(function(_0x1f640a,_0x393d72){return client[_0x8b26('0xf')](_0x16fff7,_0x17dcac)[_0x8b26('0x10')](function(_0x21664f){logger[_0x8b26('0x11')](_0x8b26('0x12'),_0x57639f,_0x8b26('0x13'));logger[_0x8b26('0x14')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x57639f,_0x8b26('0x13'),JSON[_0x8b26('0x15')](_0x21664f));if(_0x21664f['error']){if(_0x21664f[_0x8b26('0x16')][_0x8b26('0x17')]===0x1f4){logger[_0x8b26('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x57639f,_0x21664f[_0x8b26('0x16')][_0x8b26('0x18')]);return _0x393d72(_0x21664f[_0x8b26('0x16')][_0x8b26('0x18')]);}logger[_0x8b26('0x16')](_0x8b26('0x12'),_0x57639f,_0x21664f[_0x8b26('0x16')]['message']);return _0x1f640a(_0x21664f['error']['message']);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x57639f,_0x8b26('0x13'));_0x1f640a(_0x21664f[_0x8b26('0x19')][_0x8b26('0x18')]);}})[_0x8b26('0x1a')](function(_0x589ea8){logger[_0x8b26('0x16')](_0x8b26('0x12'),_0x57639f,_0x589ea8);_0x393d72(_0x589ea8);});});}exports[_0x8b26('0x1b')]=function(_0x5df1e1){var _0xdc3b22=this;return new Promise(function(_0xe6c2da,_0x484e1d){return db[_0x8b26('0x1c')]['update'](_0x5df1e1[_0x8b26('0x1d')],{'raw':_0x5df1e1['options']?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df1e1['options']?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x20')]||null:null,'attributes':_0x5df1e1[_0x8b26('0x1e')]?_0x5df1e1[_0x8b26('0x1e')][_0x8b26('0x21')]||null:null,'limit':_0x5df1e1[_0x8b26('0x1e')]?_0x5df1e1[_0x8b26('0x1e')]['limit']||null:null})[_0x8b26('0x10')](function(_0x4515af){logger[_0x8b26('0x11')](_0x8b26('0x1b'),_0x5df1e1);logger['debug'](_0x8b26('0x1b'),_0x5df1e1,JSON['stringify'](_0x4515af));_0xe6c2da(_0x4515af);})[_0x8b26('0x1a')](function(_0x389a1c){logger['error'](_0x8b26('0x1b'),_0x389a1c['message'],_0x5df1e1);_0x484e1d(_0xdc3b22[_0x8b26('0x16')](0x1f4,_0x389a1c[_0x8b26('0x18')]));});});};exports[_0x8b26('0x22')]=function(_0x3bf23b){return new Promise(function(_0x314cbf,_0x1f3662){return db[_0x8b26('0x1c')][_0x8b26('0x23')]({'where':_0x3bf23b[_0x8b26('0x1e')]?_0x3bf23b[_0x8b26('0x1e')][_0x8b26('0x20')]||null:null})['then'](function(_0x5d2728){if(_0x5d2728){return _0x5d2728[_0x8b26('0x24')](_0x3bf23b[_0x8b26('0x1d')]['ids'],_['omit'](_0x3bf23b[_0x8b26('0x1d')],[_0x8b26('0x25'),'id'])||{});}})[_0x8b26('0x26')](function(_0x1b983b){logger['info']('AddTags',_0x3bf23b);logger[_0x8b26('0x14')](_0x8b26('0x27'),_0x3bf23b,JSON[_0x8b26('0x15')](_0x1b983b));_0x314cbf(_0x1b983b);})['catch'](function(_0x505fed){logger[_0x8b26('0x16')](_0x8b26('0x27'),_0x505fed[_0x8b26('0x18')],_0x3bf23b);_0x1f3662(_this[_0x8b26('0x16')](0x1f4,_0x505fed[_0x8b26('0x18')]));});});}; \ No newline at end of file +var _0xac5f=['code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','OpenchannelInteraction','update','options','raw','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','where','body','ids','omit','spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5f,0x132));var _0xfac5=function(_0x45679b,_0x1c7b7d){_0x45679b=_0x45679b-0x0;var _0x3ed4cc=_0xac5f[_0x45679b];return _0x3ed4cc;};'use strict';var _=require(_0xfac5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfac5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfac5('0x2'));var db=require(_0xfac5('0x3'))['db'];var utils=require(_0xfac5('0x4'));var logger=require(_0xfac5('0x5'))('rpc');var config=require(_0xfac5('0x6'));var jayson=require(_0xfac5('0x7'));var client=jayson[_0xfac5('0x8')][_0xfac5('0x9')]({'port':0x232a});config[_0xfac5('0xa')]=_[_0xfac5('0xb')](config['redis'],{'host':_0xfac5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfac5('0xa')]));require(_0xfac5('0xd'))['register'](socket);function respondWithRpcPromise(_0x5806d1,_0x4524c7,_0x126c13){return new BPromise(function(_0x47984e,_0x890a0){return client[_0xfac5('0xe')](_0x5806d1,_0x126c13)[_0xfac5('0xf')](function(_0x598e3d){logger[_0xfac5('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4524c7,'request\x20sent');logger[_0xfac5('0x11')](_0xfac5('0x12'),_0x4524c7,_0xfac5('0x13'),JSON[_0xfac5('0x14')](_0x598e3d));if(_0x598e3d[_0xfac5('0x15')]){if(_0x598e3d['error'][_0xfac5('0x16')]===0x1f4){logger[_0xfac5('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4524c7,_0x598e3d[_0xfac5('0x15')][_0xfac5('0x17')]);return _0x890a0(_0x598e3d[_0xfac5('0x15')][_0xfac5('0x17')]);}logger['error'](_0xfac5('0x18'),_0x4524c7,_0x598e3d['error']['message']);return _0x47984e(_0x598e3d['error']['message']);}else{logger['info'](_0xfac5('0x18'),_0x4524c7,_0xfac5('0x13'));_0x47984e(_0x598e3d['result']['message']);}})[_0xfac5('0x19')](function(_0x33bfd0){logger['error'](_0xfac5('0x18'),_0x4524c7,_0x33bfd0);_0x890a0(_0x33bfd0);});});}exports['UpdateOpenchannelInteraction']=function(_0x1ce3da){var _0x10db56=this;return new Promise(function(_0x3dd1b2,_0x51decf){return db[_0xfac5('0x1a')][_0xfac5('0x1b')](_0x1ce3da['body'],{'raw':_0x1ce3da['options']?_0x1ce3da[_0xfac5('0x1c')][_0xfac5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce3da[_0xfac5('0x1c')]?_0x1ce3da[_0xfac5('0x1c')]['where']||null:null,'attributes':_0x1ce3da['options']?_0x1ce3da['options'][_0xfac5('0x1e')]||null:null,'limit':_0x1ce3da[_0xfac5('0x1c')]?_0x1ce3da[_0xfac5('0x1c')][_0xfac5('0x1f')]||null:null})[_0xfac5('0xf')](function(_0x15f3f9){logger[_0xfac5('0x10')](_0xfac5('0x20'),_0x1ce3da);logger['debug'](_0xfac5('0x20'),_0x1ce3da,JSON[_0xfac5('0x14')](_0x15f3f9));_0x3dd1b2(_0x15f3f9);})[_0xfac5('0x19')](function(_0x25a92d){logger[_0xfac5('0x15')](_0xfac5('0x20'),_0x25a92d[_0xfac5('0x17')],_0x1ce3da);_0x51decf(_0x10db56[_0xfac5('0x15')](0x1f4,_0x25a92d['message']));});});};exports[_0xfac5('0x21')]=function(_0x3d8667){return new Promise(function(_0x47aceb,_0x5aa715){return db[_0xfac5('0x1a')][_0xfac5('0x22')]({'where':_0x3d8667[_0xfac5('0x1c')]?_0x3d8667[_0xfac5('0x1c')][_0xfac5('0x23')]||null:null})[_0xfac5('0xf')](function(_0x28c5ba){if(_0x28c5ba){return _0x28c5ba['addTags'](_0x3d8667[_0xfac5('0x24')][_0xfac5('0x25')],_[_0xfac5('0x26')](_0x3d8667['body'],[_0xfac5('0x25'),'id'])||{});}})[_0xfac5('0x27')](function(_0x1fc1ac){logger[_0xfac5('0x10')]('AddTags',_0x3d8667);logger[_0xfac5('0x11')](_0xfac5('0x28'),_0x3d8667,JSON['stringify'](_0x1fc1ac));_0x47aceb(_0x1fc1ac);})[_0xfac5('0x19')](function(_0x2186a7){logger[_0xfac5('0x15')](_0xfac5('0x28'),_0x2186a7['message'],_0x3d8667);_0x5aa715(_this['error'](0x1f4,_0x2186a7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index a386154..be4e7b3 100644 --- a/server/api/openchannelInteraction/openchannelInteraction.socket.js +++ b/server/api/openchannelInteraction/openchannelInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x573a=['register','./openchannelInteraction.events','save','remove','update'];(function(_0x542a26,_0x4ad587){var _0x19b9fd=function(_0x4ed263){while(--_0x4ed263){_0x542a26['push'](_0x542a26['shift']());}};_0x19b9fd(++_0x4ad587);}(_0x573a,0x114));var _0xa573=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x573a[_0x155c64];return _0x1f154a;};'use strict';var OpenchannelInteractionEvents=require(_0xa573('0x0'));var events=[_0xa573('0x1'),_0xa573('0x2'),_0xa573('0x3')];function createListener(_0x2b0c73,_0x4b0553){return function(_0x8bfc7){_0x4b0553['emit'](_0x2b0c73,_0x8bfc7);};}function removeListener(_0x33bba8,_0x46b0c1){return function(){OpenchannelInteractionEvents['removeListener'](_0x33bba8,_0x46b0c1);};}exports[_0xa573('0x4')]=function(_0x35e579){for(var _0x37344a=0x0,_0x44946d=events['length'];_0x37344a<_0x44946d;_0x37344a++){var _0x262750=events[_0x37344a];var _0xa22b7b=createListener('openchannelInteraction:'+_0x262750,_0x35e579);OpenchannelInteractionEvents['on'](_0x262750,_0xa22b7b);}}; \ No newline at end of file +var _0xea71=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x27d934,_0x14b482){var _0x48e233=function(_0x5904b3){while(--_0x5904b3){_0x27d934['push'](_0x27d934['shift']());}};_0x48e233(++_0x14b482);}(_0xea71,0xe3));var _0x1ea7=function(_0x280156,_0x379c57){_0x280156=_0x280156-0x0;var _0x1b1af9=_0xea71[_0x280156];return _0x1b1af9;};'use strict';var OpenchannelInteractionEvents=require(_0x1ea7('0x0'));var events=[_0x1ea7('0x1'),_0x1ea7('0x2'),_0x1ea7('0x3')];function createListener(_0x39ef0a,_0xe2930e){return function(_0x5b6618){_0xe2930e[_0x1ea7('0x4')](_0x39ef0a,_0x5b6618);};}function removeListener(_0x57f35d,_0x469ac1){return function(){OpenchannelInteractionEvents[_0x1ea7('0x5')](_0x57f35d,_0x469ac1);};}exports[_0x1ea7('0x6')]=function(_0x8ceac5){for(var _0x167250=0x0,_0x448ba8=events[_0x1ea7('0x7')];_0x167250<_0x448ba8;_0x167250++){var _0x2c83c8=events[_0x167250];var _0x1b9a15=createListener(_0x1ea7('0x8')+_0x2c83c8,_0x8ceac5);OpenchannelInteractionEvents['on'](_0x2c83c8,_0x1b9a15);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 870456d..f5674d0 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x568ccb,_0x449b5a){var _0x3bb5a7=function(_0x257e9c){while(--_0x257e9c){_0x568ccb['push'](_0x568ccb['shift']());}};_0x3bb5a7(++_0x449b5a);}(_0xe706,0xa3));var _0x6e70=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0xe706[_0x42ca15];return _0x1c6ded;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x25f63c,_0xe09e9f){var _0x1bbcd0=function(_0x587e40){while(--_0x587e40){_0x25f63c['push'](_0x25f63c['shift']());}};_0x1bbcd0(++_0xe09e9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 3d375a9..3e6324e 100644 --- a/server/api/openchannelMessage/openchannelMessage.attributes.js +++ b/server/api/openchannelMessage/openchannelMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','TEXT','medium'];(function(_0x4bc6b0,_0x26a100){var _0x54a4b8=function(_0x5391c7){while(--_0x5391c7){_0x4bc6b0['push'](_0x4bc6b0['shift']());}};_0x54a4b8(++_0x26a100);}(_0x236c,0x155));var _0xc236=function(_0x10644e,_0x2c86c0){_0x10644e=_0x10644e-0x0;var _0x2b4f97=_0x236c[_0x10644e];return _0x2b4f97;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'body':{'type':Sequelize[_0xc236('0x1')](_0xc236('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc236('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc236('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc236('0x4')]('in','out'),'defaultValue':_0xc236('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc236('0x6')]},'providerName':{'type':Sequelize[_0xc236('0x7')]},'providerResponse':{'type':Sequelize[_0xc236('0x1')]}}; \ No newline at end of file +var _0x09df=['DATE','STRING','sequelize','exports','medium','ENUM'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x09df,0x164));var _0xf09d=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0x09df[_0x5a60ce];return _0x393e5e;};'use strict';var Sequelize=require(_0xf09d('0x0'));module[_0xf09d('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf09d('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf09d('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf09d('0x4')]},'providerName':{'type':Sequelize[_0xf09d('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 198d1da..ee5f367 100644 --- a/server/api/openchannelMessage/openchannelMessage.controller.js +++ b/server/api/openchannelMessage/openchannelMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceae=['OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','event','rejectmessage','eml-format','rimraf','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','stack','name','send','index','OpenchannelMessage','type','map','query','keys','filters','model','attributes','intersection','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','fields','length','find','create','body','update','destroy','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get'];(function(_0x3e0cde,_0x270c1b){var _0x1bc19c=function(_0x36100c){while(--_0x36100c){_0x3e0cde['push'](_0x3e0cde['shift']());}};_0x1bc19c(++_0x270c1b);}(_0xceae,0x122));var _0xecea=function(_0x420746,_0x26dd66){_0x420746=_0x420746-0x0;var _0x1c6de2=_0xceae[_0x420746];return _0x1c6de2;};'use strict';var emlformat=require(_0xecea('0x0'));var rimraf=require(_0xecea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xecea('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xecea('0x3'));var path=require(_0xecea('0x4'));var sox=require(_0xecea('0x5'));var csv=require(_0xecea('0x6'));var ejs=require(_0xecea('0x7'));var fs=require('fs');var fs_extra=require(_0xecea('0x8'));var _=require(_0xecea('0x9'));var squel=require(_0xecea('0xa'));var crypto=require(_0xecea('0xb'));var jsforce=require(_0xecea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecea('0x6'));var querystring=require('querystring');var Papa=require(_0xecea('0xd'));var Redis=require(_0xecea('0xe'));var authService=require(_0xecea('0xf'));var qs=require(_0xecea('0x10'));var as=require(_0xecea('0x11'));var hardwareService=require(_0xecea('0x12'));var logger=require(_0xecea('0x13'))(_0xecea('0x14'));var utils=require(_0xecea('0x15'));var config=require(_0xecea('0x16'));var licenseUtil=require(_0xecea('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xecea('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xecea('0x19'))(new Redis(config[_0xecea('0x18')]));require(_0xecea('0x1a'))[_0xecea('0x1b')](socket);var jayson=require(_0xecea('0x1c'));var client=jayson[_0xecea('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xecea('0x1d')][_0xecea('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x675f0f,_0x5db7f0,_0x39ae1c,_0x57f727){return new BPromise(function(_0x308efc,_0x56de8e){var _0x2d3aa6=_0x57f727||client;return _0x2d3aa6[_0xecea('0x1f')](_0x675f0f,_0x39ae1c)[_0xecea('0x20')](function(_0x2ea358){logger[_0xecea('0x21')](_0xecea('0x22'),_0x5db7f0,_0xecea('0x23'));logger[_0xecea('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5db7f0,_0xecea('0x23'),JSON[_0xecea('0x25')](_0x2ea358));if(_0x2ea358['error']){if(_0x2ea358[_0xecea('0x26')]['code']===0x1f4){logger[_0xecea('0x26')](_0xecea('0x22'),_0x5db7f0,_0x2ea358['error']['message']);return _0x56de8e(_0x2ea358[_0xecea('0x26')][_0xecea('0x27')]);}logger['error'](_0xecea('0x22'),_0x5db7f0,_0x2ea358[_0xecea('0x26')][_0xecea('0x27')]);return _0x308efc(_0x2ea358['error']['message']);}else{logger[_0xecea('0x21')](_0xecea('0x22'),_0x5db7f0,_0xecea('0x23'));_0x308efc(_0x2ea358[_0xecea('0x28')]['message']);}})[_0xecea('0x29')](function(_0x1b4063){logger[_0xecea('0x26')](_0xecea('0x22'),_0x5db7f0,_0x1b4063);_0x56de8e(_0x1b4063);});});}function respondWithStatusCode(_0x24473d,_0x3c74a6){_0x3c74a6=_0x3c74a6||0xcc;return function(_0x13b3b3){if(_0x13b3b3){return _0x24473d[_0xecea('0x2a')](_0x3c74a6);}return _0x24473d[_0xecea('0x2b')](_0x3c74a6)[_0xecea('0x2c')]();};}function respondWithResult(_0x4cf723,_0x89f9c8){_0x89f9c8=_0x89f9c8||0xc8;return function(_0x4112e6){if(_0x4112e6){return _0x4cf723[_0xecea('0x2b')](_0x89f9c8)['json'](_0x4112e6);}};}function respondWithFilteredResult(_0x14827d,_0x13cd59){return function(_0x536d8a){if(_0x536d8a){var _0x19df1d=typeof _0x13cd59['offset']===_0xecea('0x2d')&&typeof _0x13cd59[_0xecea('0x2e')]===_0xecea('0x2d');var _0x9b92e4=_0x536d8a[_0xecea('0x2f')];var _0x4791c1=_0x19df1d?0x0:_0x13cd59[_0xecea('0x30')];var _0x4b22a2=_0x19df1d?_0x536d8a[_0xecea('0x2f')]:_0x13cd59[_0xecea('0x30')]+_0x13cd59[_0xecea('0x2e')];var _0x56d5e4;if(_0x4b22a2>=_0x9b92e4){_0x4b22a2=_0x9b92e4;_0x56d5e4=0xc8;}else{_0x56d5e4=0xce;}_0x14827d[_0xecea('0x2b')](_0x56d5e4);return _0x14827d[_0xecea('0x31')]('Content-Range',_0x4791c1+'-'+_0x4b22a2+'/'+_0x9b92e4)[_0xecea('0x32')](_0x536d8a);}return null;};}function patchUpdates(_0x483bca){return function(_0x44ac6e){try{jsonpatch[_0xecea('0x33')](_0x44ac6e,_0x483bca,!![]);}catch(_0x9c5bf6){return BPromise[_0xecea('0x34')](_0x9c5bf6);}return _0x44ac6e[_0xecea('0x35')]();};}function saveUpdates(_0x4bd1fe,_0x3c9518){return function(_0x448b04){if(_0x448b04){return _0x448b04['update'](_0x4bd1fe)[_0xecea('0x20')](function(_0x330593){return _0x330593;});}return null;};}function removeEntity(_0x39440b,_0x223642){return function(_0x2f28c0){if(_0x2f28c0){return _0x2f28c0['destroy']()['then'](function(){_0x39440b[_0xecea('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fe6b,_0x4037aa){return function(_0x3a79e5){if(!_0x3a79e5){_0x33fe6b[_0xecea('0x2a')](0x194);}return _0x3a79e5;};}function handleError(_0x10cb6e,_0x16e927){_0x16e927=_0x16e927||0x1f4;return function(_0x349000){logger['error'](_0x349000[_0xecea('0x36')]);if(_0x349000[_0xecea('0x37')]){delete _0x349000[_0xecea('0x37')];}_0x10cb6e[_0xecea('0x2b')](_0x16e927)[_0xecea('0x38')](_0x349000);};}exports[_0xecea('0x39')]=function(_0x14dc9a,_0x207240){var _0x23ad32={},_0x4c8237={},_0x5d4b5b={'count':0x0,'rows':[]};var _0x53e184=_['map'](db[_0xecea('0x3a')]['rawAttributes'],function(_0x234fd8){return{'name':_0x234fd8['fieldName'],'type':_0x234fd8[_0xecea('0x3b')]['key']};});_0x4c8237['model']=_[_0xecea('0x3c')](_0x53e184,'name');_0x4c8237[_0xecea('0x3d')]=_[_0xecea('0x3e')](_0x14dc9a[_0xecea('0x3d')]);_0x4c8237[_0xecea('0x3f')]=_['intersection'](_0x4c8237[_0xecea('0x40')],_0x4c8237[_0xecea('0x3d')]);_0x23ad32[_0xecea('0x41')]=_[_0xecea('0x42')](_0x4c8237['model'],qs['fields'](_0x14dc9a[_0xecea('0x3d')]['fields']));_0x23ad32[_0xecea('0x41')]=_0x23ad32['attributes']['length']?_0x23ad32[_0xecea('0x41')]:_0x4c8237[_0xecea('0x40')];if(!_0x14dc9a['query'][_0xecea('0x43')]('nolimit')){_0x23ad32[_0xecea('0x2e')]=qs[_0xecea('0x2e')](_0x14dc9a[_0xecea('0x3d')][_0xecea('0x2e')]);_0x23ad32[_0xecea('0x30')]=qs['offset'](_0x14dc9a[_0xecea('0x3d')]['offset']);}_0x23ad32['order']=qs[_0xecea('0x44')](_0x14dc9a[_0xecea('0x3d')][_0xecea('0x44')]);_0x23ad32[_0xecea('0x45')]=qs[_0xecea('0x3f')](_[_0xecea('0x46')](_0x14dc9a[_0xecea('0x3d')],_0x4c8237[_0xecea('0x3f')]),_0x53e184);if(_0x14dc9a[_0xecea('0x3d')][_0xecea('0x47')]){_0x23ad32[_0xecea('0x45')]=_[_0xecea('0x48')](_0x23ad32['where'],{'$or':_[_0xecea('0x3c')](_0x53e184,function(_0x9adec){if(_0x9adec[_0xecea('0x3b')]!==_0xecea('0x49')){var _0x5bffc5={};_0x5bffc5[_0x9adec[_0xecea('0x37')]]={'$like':'%'+_0x14dc9a[_0xecea('0x3d')]['filter']+'%'};return _0x5bffc5;}})});}_0x23ad32=_[_0xecea('0x48')]({},_0x23ad32,_0x14dc9a[_0xecea('0x4a')]);var _0x5cd149={'where':_0x23ad32[_0xecea('0x45')]};return db[_0xecea('0x3a')][_0xecea('0x2f')](_0x5cd149)['then'](function(_0x5e1ac1){_0x5d4b5b[_0xecea('0x2f')]=_0x5e1ac1;if(_0x14dc9a[_0xecea('0x3d')][_0xecea('0x4b')]){_0x23ad32['include']=[{'all':!![]}];}return db[_0xecea('0x3a')][_0xecea('0x4c')](_0x23ad32);})[_0xecea('0x20')](function(_0x29d655){_0x5d4b5b['rows']=_0x29d655;return _0x5d4b5b;})[_0xecea('0x20')](respondWithFilteredResult(_0x207240,_0x23ad32))[_0xecea('0x29')](handleError(_0x207240,null));};exports[_0xecea('0x4d')]=function(_0x31a5fa,_0x5f310f){var _0x460de1={'raw':!![],'where':{'id':_0x31a5fa[_0xecea('0x4e')]['id']}},_0x50b56c={};_0x50b56c[_0xecea('0x40')]=_['keys'](db['OpenchannelMessage'][_0xecea('0x4f')]);_0x50b56c['query']=_[_0xecea('0x3e')](_0x31a5fa[_0xecea('0x3d')]);_0x50b56c[_0xecea('0x3f')]=_[_0xecea('0x42')](_0x50b56c['model'],_0x50b56c[_0xecea('0x3d')]);_0x460de1[_0xecea('0x41')]=_[_0xecea('0x42')](_0x50b56c[_0xecea('0x40')],qs[_0xecea('0x50')](_0x31a5fa['query'][_0xecea('0x50')]));_0x460de1[_0xecea('0x41')]=_0x460de1['attributes'][_0xecea('0x51')]?_0x460de1['attributes']:_0x50b56c[_0xecea('0x40')];if(_0x31a5fa['query']['includeAll']){_0x460de1['include']=[{'all':!![]}];}_0x460de1=_[_0xecea('0x48')]({},_0x460de1,_0x31a5fa['options']);return db[_0xecea('0x3a')][_0xecea('0x52')](_0x460de1)[_0xecea('0x20')](handleEntityNotFound(_0x5f310f,null))[_0xecea('0x20')](respondWithResult(_0x5f310f,null))[_0xecea('0x29')](handleError(_0x5f310f,null));};exports[_0xecea('0x53')]=function(_0x48dd35,_0x5cf171){return db[_0xecea('0x3a')][_0xecea('0x53')](_0x48dd35[_0xecea('0x54')],{})[_0xecea('0x20')](respondWithResult(_0x5cf171,0xc9))[_0xecea('0x29')](handleError(_0x5cf171,null));};exports[_0xecea('0x55')]=function(_0x4a9f00,_0x5b2304){if(_0x4a9f00[_0xecea('0x54')]['id']){delete _0x4a9f00[_0xecea('0x54')]['id'];}return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x4a9f00[_0xecea('0x4e')]['id']}})[_0xecea('0x20')](handleEntityNotFound(_0x5b2304,null))[_0xecea('0x20')](saveUpdates(_0x4a9f00[_0xecea('0x54')],null))[_0xecea('0x20')](respondWithResult(_0x5b2304,null))[_0xecea('0x29')](handleError(_0x5b2304,null));};exports[_0xecea('0x56')]=function(_0x58c75a,_0x3a004c){return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x58c75a[_0xecea('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a004c,null))['then'](removeEntity(_0x3a004c,null))[_0xecea('0x29')](handleError(_0x3a004c,null));};exports[_0xecea('0x57')]=function(_0x3b0c12,_0x12820d){return db[_0xecea('0x3a')][_0xecea('0x57')]()[_0xecea('0x20')](respondWithResult(_0x12820d,null))[_0xecea('0x29')](handleError(_0x12820d,null));};var interaction_log=require(_0xecea('0x13'))(_0xecea('0x58'));exports[_0xecea('0x59')]=function(_0x455f8a,_0x530a35,_0x21069c){var _0xaf55d6={'agent':{},'channel':_0xecea('0x5a')};if(_0x455f8a['body']['id']){delete _0x455f8a[_0xecea('0x54')]['id'];}_0x455f8a[_0xecea('0x54')][_0xecea('0x5b')]=!![];_0x455f8a[_0xecea('0x54')]['readAt']=moment()[_0xecea('0x5c')](_0xecea('0x5d'));_0x455f8a['body'][_0xecea('0x5e')]=_0x455f8a[_0xecea('0x54')][_0xecea('0x5e')]||_0x455f8a['user']['id'];_0xaf55d6[_0xecea('0x5f')]['id']=_0x455f8a['body']['UserId'];return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x455f8a[_0xecea('0x4e')]['id'],'UserId':null}})[_0xecea('0x20')](handleEntityNotFound(_0x530a35,null))[_0xecea('0x20')](saveUpdates(_0x455f8a[_0xecea('0x54')],null))[_0xecea('0x20')](function(_0x4751de){if(_0x4751de){_0xaf55d6[_0xecea('0x27')]=_0x4751de[_0xecea('0x60')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x4751de[_0xecea('0x61')]}});}return null;})[_0xecea('0x20')](handleEntityNotFound(_0x530a35,null))[_0xecea('0x20')](function(_0x1fdf50){if(_0x1fdf50){return _0x1fdf50[_0xecea('0x55')]({'UserId':_0x455f8a['body']['UserId'],'read1stAt':_[_0xecea('0x62')](_0x1fdf50[_0xecea('0x63')])?moment()[_0xecea('0x5c')](_0xecea('0x5d')):undefined});}return null;})['then'](function(_0x46b0fe){if(_0x46b0fe){_0xaf55d6[_0xecea('0x64')]=_0x46b0fe[_0xecea('0x60')]({'plain':!![]});interaction_log[_0xecea('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x455f8a[_0xecea('0x65')]['id'],_0x455f8a[_0xecea('0x65')][_0xecea('0x37')],_0x455f8a['user'][_0xecea('0x66')],_0xaf55d6['interaction']['id'],_0x455f8a[_0xecea('0x54')]?JSON[_0xecea('0x25')](_0x455f8a[_0xecea('0x54')]):_0xecea('0x67'));return respondWithRpcPromise('AcceptMessage',_0xecea('0x68'),_0xaf55d6);}return null;})[_0xecea('0x20')](function(_0x1215cb){var _0xf4da6f=_0xecea('0x69')+_0x1215cb[_0xecea('0x27')]['ContactId'];return db[_0xecea('0x6a')][_0xecea('0x3d')](_0xf4da6f,{'type':db[_0xecea('0x6b')][_0xecea('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x5917af){return _0x5917af;});})[_0xecea('0x20')](function(_0x462361){if(_0x462361){_0xaf55d6[_0xecea('0x27')][_0xecea('0x6d')]=_0x462361[0x0];if(!_0x455f8a[_0xecea('0x54')][_0xecea('0x5e')])return;return db[_0xecea('0x6e')][_0xecea('0x52')]({'where':{'id':_0x455f8a['body'][_0xecea('0x5e')],'role':_0xecea('0x5f')},'attributes':['id',_0xecea('0x37'),_0xecea('0x6f'),_0xecea('0x70'),_0xecea('0x71')],'raw':!![]});}return null;})['then'](function(_0x2ecea7){if(!_0x2ecea7)return null;_0xaf55d6[_0xecea('0x27')][_0xecea('0x5f')]=_0x2ecea7;return _0xaf55d6;})[_0xecea('0x20')](function(_0x4168a0){if(_0x4168a0){if(_0x455f8a['body'][_0xecea('0x72')]){_0xaf55d6[_0xecea('0x27')][_0xecea('0x73')]=util[_0xecea('0x5c')](_0xecea('0x74'),_0x455f8a[_0xecea('0x65')]['name']);_0xaf55d6[_0xecea('0x27')][_0xecea('0x75')]=_0xaf55d6[_0xecea('0x75')];_0xaf55d6[_0xecea('0x27')][_0xecea('0x76')]=_0xaf55d6['channel'];_0xaf55d6[_0xecea('0x27')]['event']='accept';return respondWithRpcPromise(_0xecea('0x77'),'EventManager',{'event':_0xecea('0x78'),'message':_0xaf55d6['message']},client9002)['then'](function(){return _0xaf55d6;});}return _0xaf55d6;}return null;})[_0xecea('0x20')](respondWithResult(_0x530a35,null))[_0xecea('0x29')](handleError(_0x530a35,null));};var interaction_log=require(_0xecea('0x13'))('openchannel-interactions');exports[_0xecea('0x34')]=function(_0x30b7c6,_0x1ed688,_0x65eeb5){var _0x333d74={'agent':{},'channel':_0xecea('0x5a')};if(_0x30b7c6[_0xecea('0x54')]['id']){delete _0x30b7c6[_0xecea('0x54')]['id'];}_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')]=_0x30b7c6['body'][_0xecea('0x5e')]||_0x30b7c6[_0xecea('0x65')]['id'];_0x333d74[_0xecea('0x5f')]['id']=_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')];return db[_0xecea('0x3a')][_0xecea('0x52')]({'where':{'id':_0x30b7c6[_0xecea('0x4e')]['id'],'UserId':null}})[_0xecea('0x20')](handleEntityNotFound(_0x1ed688,null))[_0xecea('0x20')](function(_0x2f1946){if(_0x2f1946){_0x333d74['message']=_0x2f1946[_0xecea('0x60')]({'plain':!![]});return db[_0xecea('0x79')][_0xecea('0x52')]({'where':{'id':_0x2f1946[_0xecea('0x61')]}});}return null;})[_0xecea('0x20')](handleEntityNotFound(_0x1ed688,null))[_0xecea('0x20')](function(_0x4a85ee){if(_0x4a85ee){_0x333d74[_0xecea('0x64')]=_0x4a85ee[_0xecea('0x60')]({'plain':!![]});interaction_log[_0xecea('0x21')](_0xecea('0x7a'),_0x30b7c6[_0xecea('0x65')]['id'],_0x30b7c6[_0xecea('0x65')]['name'],_0x30b7c6[_0xecea('0x65')][_0xecea('0x66')],_0x333d74[_0xecea('0x64')]['id'],_0x30b7c6[_0xecea('0x54')]?JSON[_0xecea('0x25')](_0x30b7c6['body']):'null');return respondWithRpcPromise(_0xecea('0x7b'),_0xecea('0x7c'),_0x333d74);}return null;})[_0xecea('0x20')](function(_0x3b3f35){var _0x5d82e9=_0xecea('0x69')+_0x3b3f35[_0xecea('0x27')][_0xecea('0x7d')];return db[_0xecea('0x6a')][_0xecea('0x3d')](_0x5d82e9,{'type':db[_0xecea('0x6b')][_0xecea('0x6c')][_0xecea('0x7e')],'raw':!![]})['then'](function(_0x3dcb61){return _0x3dcb61;});})[_0xecea('0x20')](function(_0x33661c){if(_0x33661c){_0x333d74[_0xecea('0x27')][_0xecea('0x6d')]=_0x33661c[0x0];if(!_0x30b7c6[_0xecea('0x54')][_0xecea('0x5e')])return;return db[_0xecea('0x6e')][_0xecea('0x52')]({'where':{'id':_0x30b7c6[_0xecea('0x54')]['UserId'],'role':'agent'},'attributes':['id','name',_0xecea('0x6f'),'email',_0xecea('0x71')],'raw':!![]});}return null;})[_0xecea('0x20')](function(_0x3659c2){if(!_0x3659c2)return null;_0x333d74['message'][_0xecea('0x5f')]=_0x3659c2;return _0x333d74;})[_0xecea('0x20')](function(_0x88a2b4){if(_0x88a2b4){_0x88a2b4[_0xecea('0x27')]['interface']=util[_0xecea('0x5c')](_0xecea('0x74'),_0x30b7c6[_0xecea('0x65')][_0xecea('0x37')]);_0x88a2b4[_0xecea('0x27')][_0xecea('0x75')]=_0x333d74[_0xecea('0x75')];_0x88a2b4[_0xecea('0x27')][_0xecea('0x76')]=_0x333d74[_0xecea('0x75')];_0x88a2b4[_0xecea('0x27')][_0xecea('0x7f')]=_0xecea('0x34');respondWithRpcPromise(_0xecea('0x77'),'EventManager',{'event':_0xecea('0x80'),'message':_0x88a2b4[_0xecea('0x27')]},client9002);return _0x333d74;}return null;})[_0xecea('0x20')](respondWithResult(_0x1ed688,null))[_0xecea('0x29')](handleError(_0x1ed688,null));}; \ No newline at end of file +var _0x711c=['querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x711c,0xf7));var _0xc711=function(_0x2faf51,_0x18f035){_0x2faf51=_0x2faf51-0x0;var _0xcf96c5=_0x711c[_0x2faf51];return _0xcf96c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc711('0x0'));var zipdir=require(_0xc711('0x1'));var jsonpatch=require(_0xc711('0x2'));var rp=require(_0xc711('0x3'));var moment=require(_0xc711('0x4'));var BPromise=require(_0xc711('0x5'));var Mustache=require(_0xc711('0x6'));var util=require('util');var path=require(_0xc711('0x7'));var sox=require(_0xc711('0x8'));var csv=require(_0xc711('0x9'));var ejs=require(_0xc711('0xa'));var fs=require('fs');var fs_extra=require(_0xc711('0xb'));var _=require(_0xc711('0xc'));var squel=require(_0xc711('0xd'));var crypto=require(_0xc711('0xe'));var jsforce=require(_0xc711('0xf'));var deskjs=require(_0xc711('0x10'));var toCsv=require(_0xc711('0x9'));var querystring=require(_0xc711('0x11'));var Papa=require('papaparse');var Redis=require(_0xc711('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc711('0x13'));var logger=require(_0xc711('0x14'))('api');var utils=require(_0xc711('0x15'));var config=require(_0xc711('0x16'));var licenseUtil=require(_0xc711('0x17'));var db=require(_0xc711('0x18'))['db'];config[_0xc711('0x19')]=_['defaults'](config['redis'],{'host':_0xc711('0x1a'),'port':0x18eb});var socket=require(_0xc711('0x1b'))(new Redis(config[_0xc711('0x19')]));require(_0xc711('0x1c'))[_0xc711('0x1d')](socket);var jayson=require(_0xc711('0x1e'));var client=jayson['client'][_0xc711('0x1f')]({'port':0x232c});var client9002=jayson[_0xc711('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236408,_0x15cc7c,_0xd06251,_0x50e393){return new BPromise(function(_0xaed46e,_0x400fe2){var _0x10c6bd=_0x50e393||client;return _0x10c6bd[_0xc711('0x21')](_0x236408,_0xd06251)[_0xc711('0x22')](function(_0x18a61d){logger[_0xc711('0x23')](_0xc711('0x24'),_0x15cc7c,_0xc711('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x15cc7c,_0xc711('0x25'),JSON[_0xc711('0x26')](_0x18a61d));if(_0x18a61d[_0xc711('0x27')]){if(_0x18a61d[_0xc711('0x27')][_0xc711('0x28')]===0x1f4){logger[_0xc711('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x15cc7c,_0x18a61d[_0xc711('0x27')]['message']);return _0x400fe2(_0x18a61d[_0xc711('0x27')][_0xc711('0x29')]);}logger['error'](_0xc711('0x24'),_0x15cc7c,_0x18a61d[_0xc711('0x27')]['message']);return _0xaed46e(_0x18a61d['error']['message']);}else{logger[_0xc711('0x23')](_0xc711('0x24'),_0x15cc7c,_0xc711('0x25'));_0xaed46e(_0x18a61d['result'][_0xc711('0x29')]);}})[_0xc711('0x2a')](function(_0x320335){logger[_0xc711('0x27')](_0xc711('0x24'),_0x15cc7c,_0x320335);_0x400fe2(_0x320335);});});}function respondWithStatusCode(_0x383ae4,_0x2e09a3){_0x2e09a3=_0x2e09a3||0xcc;return function(_0x287330){if(_0x287330){return _0x383ae4[_0xc711('0x2b')](_0x2e09a3);}return _0x383ae4[_0xc711('0x2c')](_0x2e09a3)[_0xc711('0x2d')]();};}function respondWithResult(_0x4773b9,_0x6315b){_0x6315b=_0x6315b||0xc8;return function(_0x106e39){if(_0x106e39){return _0x4773b9['status'](_0x6315b)[_0xc711('0x2e')](_0x106e39);}};}function respondWithFilteredResult(_0x3c3faf,_0x568680){return function(_0x4fe47d){if(_0x4fe47d){var _0x606321=typeof _0x568680[_0xc711('0x2f')]===_0xc711('0x30')&&typeof _0x568680[_0xc711('0x31')]===_0xc711('0x30');var _0x426d90=_0x4fe47d[_0xc711('0x32')];var _0x50613a=_0x606321?0x0:_0x568680[_0xc711('0x2f')];var _0x5b90b4=_0x606321?_0x4fe47d[_0xc711('0x32')]:_0x568680['offset']+_0x568680['limit'];var _0x391eab;if(_0x5b90b4>=_0x426d90){_0x5b90b4=_0x426d90;_0x391eab=0xc8;}else{_0x391eab=0xce;}_0x3c3faf[_0xc711('0x2c')](_0x391eab);return _0x3c3faf[_0xc711('0x33')]('Content-Range',_0x50613a+'-'+_0x5b90b4+'/'+_0x426d90)[_0xc711('0x2e')](_0x4fe47d);}return null;};}function patchUpdates(_0x1be537){return function(_0x4e6d1b){try{jsonpatch[_0xc711('0x34')](_0x4e6d1b,_0x1be537,!![]);}catch(_0x4b81da){return BPromise[_0xc711('0x35')](_0x4b81da);}return _0x4e6d1b[_0xc711('0x36')]();};}function saveUpdates(_0x4d0a36,_0x3d2239){return function(_0x58e111){if(_0x58e111){return _0x58e111['update'](_0x4d0a36)[_0xc711('0x22')](function(_0x5c8808){return _0x5c8808;});}return null;};}function removeEntity(_0x2f6941,_0x4aae4e){return function(_0xffbbea){if(_0xffbbea){return _0xffbbea[_0xc711('0x37')]()[_0xc711('0x22')](function(){_0x2f6941[_0xc711('0x2c')](0xcc)[_0xc711('0x2d')]();});}};}function handleEntityNotFound(_0x16421c,_0x2f1f82){return function(_0x25c521){if(!_0x25c521){_0x16421c[_0xc711('0x2b')](0x194);}return _0x25c521;};}function handleError(_0x2863e2,_0x1250db){_0x1250db=_0x1250db||0x1f4;return function(_0x1762b1){logger[_0xc711('0x27')](_0x1762b1[_0xc711('0x38')]);if(_0x1762b1[_0xc711('0x39')]){delete _0x1762b1[_0xc711('0x39')];}_0x2863e2['status'](_0x1250db)[_0xc711('0x3a')](_0x1762b1);};}exports[_0xc711('0x3b')]=function(_0x11b100,_0x521b49){var _0x1546c8={},_0x5b0997={},_0x39cdd0={'count':0x0,'rows':[]};var _0x225570=_[_0xc711('0x3c')](db[_0xc711('0x3d')][_0xc711('0x3e')],function(_0x4d96c9){return{'name':_0x4d96c9[_0xc711('0x3f')],'type':_0x4d96c9[_0xc711('0x40')]['key']};});_0x5b0997[_0xc711('0x41')]=_['map'](_0x225570,_0xc711('0x39'));_0x5b0997[_0xc711('0x42')]=_['keys'](_0x11b100[_0xc711('0x42')]);_0x5b0997[_0xc711('0x43')]=_[_0xc711('0x44')](_0x5b0997[_0xc711('0x41')],_0x5b0997['query']);_0x1546c8['attributes']=_[_0xc711('0x44')](_0x5b0997[_0xc711('0x41')],qs[_0xc711('0x45')](_0x11b100[_0xc711('0x42')][_0xc711('0x45')]));_0x1546c8[_0xc711('0x46')]=_0x1546c8[_0xc711('0x46')]['length']?_0x1546c8['attributes']:_0x5b0997[_0xc711('0x41')];if(!_0x11b100[_0xc711('0x42')][_0xc711('0x47')](_0xc711('0x48'))){_0x1546c8['limit']=qs['limit'](_0x11b100[_0xc711('0x42')]['limit']);_0x1546c8[_0xc711('0x2f')]=qs[_0xc711('0x2f')](_0x11b100[_0xc711('0x42')]['offset']);}_0x1546c8[_0xc711('0x49')]=qs[_0xc711('0x4a')](_0x11b100[_0xc711('0x42')][_0xc711('0x4a')]);_0x1546c8['where']=qs[_0xc711('0x43')](_[_0xc711('0x4b')](_0x11b100['query'],_0x5b0997[_0xc711('0x43')]),_0x225570);if(_0x11b100[_0xc711('0x42')][_0xc711('0x4c')]){_0x1546c8[_0xc711('0x4d')]=_['merge'](_0x1546c8['where'],{'$or':_['map'](_0x225570,function(_0x7e14e2){if(_0x7e14e2[_0xc711('0x40')]!==_0xc711('0x4e')){var _0x3c698a={};_0x3c698a[_0x7e14e2[_0xc711('0x39')]]={'$like':'%'+_0x11b100['query'][_0xc711('0x4c')]+'%'};return _0x3c698a;}})});}_0x1546c8=_[_0xc711('0x4f')]({},_0x1546c8,_0x11b100[_0xc711('0x50')]);var _0x3e4bbc={'where':_0x1546c8['where']};return db[_0xc711('0x3d')][_0xc711('0x32')](_0x3e4bbc)[_0xc711('0x22')](function(_0x5b1db5){_0x39cdd0[_0xc711('0x32')]=_0x5b1db5;if(_0x11b100[_0xc711('0x42')][_0xc711('0x51')]){_0x1546c8[_0xc711('0x52')]=[{'all':!![]}];}return db[_0xc711('0x3d')][_0xc711('0x53')](_0x1546c8);})[_0xc711('0x22')](function(_0x53ce84){_0x39cdd0[_0xc711('0x54')]=_0x53ce84;return _0x39cdd0;})[_0xc711('0x22')](respondWithFilteredResult(_0x521b49,_0x1546c8))[_0xc711('0x2a')](handleError(_0x521b49,null));};exports[_0xc711('0x55')]=function(_0x52571c,_0x781d6f){var _0x4e39cc={'raw':!![],'where':{'id':_0x52571c[_0xc711('0x56')]['id']}},_0x18990e={};_0x18990e[_0xc711('0x41')]=_['keys'](db[_0xc711('0x3d')][_0xc711('0x3e')]);_0x18990e[_0xc711('0x42')]=_[_0xc711('0x57')](_0x52571c['query']);_0x18990e[_0xc711('0x43')]=_[_0xc711('0x44')](_0x18990e[_0xc711('0x41')],_0x18990e[_0xc711('0x42')]);_0x4e39cc[_0xc711('0x46')]=_['intersection'](_0x18990e[_0xc711('0x41')],qs['fields'](_0x52571c[_0xc711('0x42')][_0xc711('0x45')]));_0x4e39cc['attributes']=_0x4e39cc[_0xc711('0x46')]['length']?_0x4e39cc[_0xc711('0x46')]:_0x18990e['model'];if(_0x52571c[_0xc711('0x42')][_0xc711('0x51')]){_0x4e39cc[_0xc711('0x52')]=[{'all':!![]}];}_0x4e39cc=_[_0xc711('0x4f')]({},_0x4e39cc,_0x52571c[_0xc711('0x50')]);return db[_0xc711('0x3d')][_0xc711('0x58')](_0x4e39cc)[_0xc711('0x22')](handleEntityNotFound(_0x781d6f,null))[_0xc711('0x22')](respondWithResult(_0x781d6f,null))[_0xc711('0x2a')](handleError(_0x781d6f,null));};exports[_0xc711('0x59')]=function(_0x5a0691,_0x1b63ec){return db['OpenchannelMessage'][_0xc711('0x59')](_0x5a0691[_0xc711('0x5a')],{})['then'](respondWithResult(_0x1b63ec,0xc9))[_0xc711('0x2a')](handleError(_0x1b63ec,null));};exports[_0xc711('0x5b')]=function(_0x356c76,_0x469b4a){if(_0x356c76[_0xc711('0x5a')]['id']){delete _0x356c76[_0xc711('0x5a')]['id'];}return db[_0xc711('0x3d')][_0xc711('0x58')]({'where':{'id':_0x356c76[_0xc711('0x56')]['id']}})['then'](handleEntityNotFound(_0x469b4a,null))['then'](saveUpdates(_0x356c76[_0xc711('0x5a')],null))[_0xc711('0x22')](respondWithResult(_0x469b4a,null))[_0xc711('0x2a')](handleError(_0x469b4a,null));};exports[_0xc711('0x37')]=function(_0x14ed3f,_0x41c80b){return db[_0xc711('0x3d')][_0xc711('0x58')]({'where':{'id':_0x14ed3f[_0xc711('0x56')]['id']}})['then'](handleEntityNotFound(_0x41c80b,null))[_0xc711('0x22')](removeEntity(_0x41c80b,null))[_0xc711('0x2a')](handleError(_0x41c80b,null));};exports[_0xc711('0x5c')]=function(_0x419b83,_0x47ea84){return db[_0xc711('0x3d')][_0xc711('0x5c')]()[_0xc711('0x22')](respondWithResult(_0x47ea84,null))[_0xc711('0x2a')](handleError(_0x47ea84,null));};var interaction_log=require('../../config/logger')(_0xc711('0x5d'));exports[_0xc711('0x5e')]=function(_0x566ce5,_0x3815ad,_0x3bc012){var _0x357a76={'agent':{},'channel':_0xc711('0x5f')};if(_0x566ce5[_0xc711('0x5a')]['id']){delete _0x566ce5[_0xc711('0x5a')]['id'];}_0x566ce5[_0xc711('0x5a')][_0xc711('0x60')]=!![];_0x566ce5['body'][_0xc711('0x61')]=moment()[_0xc711('0x62')](_0xc711('0x63'));_0x566ce5['body'][_0xc711('0x64')]=_0x566ce5[_0xc711('0x5a')][_0xc711('0x64')]||_0x566ce5[_0xc711('0x65')]['id'];_0x357a76['agent']['id']=_0x566ce5[_0xc711('0x5a')][_0xc711('0x64')];return db[_0xc711('0x3d')][_0xc711('0x58')]({'where':{'id':_0x566ce5[_0xc711('0x56')]['id'],'UserId':null}})[_0xc711('0x22')](handleEntityNotFound(_0x3815ad,null))[_0xc711('0x22')](saveUpdates(_0x566ce5[_0xc711('0x5a')],null))[_0xc711('0x22')](function(_0x1e6b15){if(_0x1e6b15){_0x357a76[_0xc711('0x29')]=_0x1e6b15[_0xc711('0x66')]({'plain':!![]});return db[_0xc711('0x67')]['find']({'where':{'id':_0x1e6b15[_0xc711('0x68')]}});}return null;})[_0xc711('0x22')](handleEntityNotFound(_0x3815ad,null))[_0xc711('0x22')](function(_0x1ac42a){if(_0x1ac42a){return _0x1ac42a[_0xc711('0x5b')]({'UserId':_0x566ce5['body'][_0xc711('0x64')],'read1stAt':_[_0xc711('0x69')](_0x1ac42a[_0xc711('0x6a')])?moment()[_0xc711('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x31b72a){if(_0x31b72a){_0x357a76[_0xc711('0x6b')]=_0x31b72a[_0xc711('0x66')]({'plain':!![]});interaction_log[_0xc711('0x23')](_0xc711('0x6c'),_0x566ce5[_0xc711('0x65')]['id'],_0x566ce5['user'][_0xc711('0x39')],_0x566ce5[_0xc711('0x65')]['role'],_0x357a76[_0xc711('0x6b')]['id'],_0x566ce5[_0xc711('0x5a')]?JSON[_0xc711('0x26')](_0x566ce5[_0xc711('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xc711('0x6d'),_0x357a76);}return null;})[_0xc711('0x22')](function(_0x1ae32c){var _0x5d3d75='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ae32c['message'][_0xc711('0x6e')];return db[_0xc711('0x6f')][_0xc711('0x42')](_0x5d3d75,{'type':db[_0xc711('0x70')]['QueryTypes'][_0xc711('0x71')],'raw':!![]})[_0xc711('0x22')](function(_0x8b30cf){return _0x8b30cf;});})[_0xc711('0x22')](function(_0x6b1111){if(_0x6b1111){_0x357a76[_0xc711('0x29')][_0xc711('0x72')]=_0x6b1111[0x0];if(!_0x566ce5['body'][_0xc711('0x64')])return;return db[_0xc711('0x73')][_0xc711('0x58')]({'where':{'id':_0x566ce5[_0xc711('0x5a')][_0xc711('0x64')],'role':_0xc711('0x74')},'attributes':['id','name',_0xc711('0x75'),_0xc711('0x76'),_0xc711('0x77')],'raw':!![]});}return null;})['then'](function(_0x50e9a4){if(!_0x50e9a4)return null;_0x357a76[_0xc711('0x29')][_0xc711('0x74')]=_0x50e9a4;return _0x357a76;})['then'](function(_0x5b846e){if(_0x5b846e){if(_0x566ce5[_0xc711('0x5a')][_0xc711('0x78')]){_0x357a76[_0xc711('0x29')][_0xc711('0x79')]=util['format'](_0xc711('0x7a'),_0x566ce5[_0xc711('0x65')]['name']);_0x357a76[_0xc711('0x29')]['channel']=_0x357a76[_0xc711('0x7b')];_0x357a76[_0xc711('0x29')]['motionChannel']=_0x357a76[_0xc711('0x7b')];_0x357a76['message']['event']=_0xc711('0x5e');return respondWithRpcPromise(_0xc711('0x7c'),_0xc711('0x7c'),{'event':_0xc711('0x7d'),'message':_0x357a76[_0xc711('0x29')]},client9002)[_0xc711('0x22')](function(){return _0x357a76;});}return _0x357a76;}return null;})[_0xc711('0x22')](respondWithResult(_0x3815ad,null))['catch'](handleError(_0x3815ad,null));};var interaction_log=require(_0xc711('0x14'))(_0xc711('0x5d'));exports[_0xc711('0x35')]=function(_0x4f3422,_0x4ddc14,_0x2bbc0b){var _0x373d4c={'agent':{},'channel':'openchannel'};if(_0x4f3422[_0xc711('0x5a')]['id']){delete _0x4f3422[_0xc711('0x5a')]['id'];}_0x4f3422[_0xc711('0x5a')]['UserId']=_0x4f3422[_0xc711('0x5a')][_0xc711('0x64')]||_0x4f3422[_0xc711('0x65')]['id'];_0x373d4c['agent']['id']=_0x4f3422['body']['UserId'];return db[_0xc711('0x3d')][_0xc711('0x58')]({'where':{'id':_0x4f3422[_0xc711('0x56')]['id'],'UserId':null}})[_0xc711('0x22')](handleEntityNotFound(_0x4ddc14,null))[_0xc711('0x22')](function(_0xf92bb6){if(_0xf92bb6){_0x373d4c['message']=_0xf92bb6[_0xc711('0x66')]({'plain':!![]});return db[_0xc711('0x67')][_0xc711('0x58')]({'where':{'id':_0xf92bb6['OpenchannelInteractionId']}});}return null;})[_0xc711('0x22')](handleEntityNotFound(_0x4ddc14,null))[_0xc711('0x22')](function(_0x42a94c){if(_0x42a94c){_0x373d4c[_0xc711('0x6b')]=_0x42a94c['get']({'plain':!![]});interaction_log[_0xc711('0x23')](_0xc711('0x7e'),_0x4f3422[_0xc711('0x65')]['id'],_0x4f3422[_0xc711('0x65')][_0xc711('0x39')],_0x4f3422['user']['role'],_0x373d4c[_0xc711('0x6b')]['id'],_0x4f3422[_0xc711('0x5a')]?JSON[_0xc711('0x26')](_0x4f3422[_0xc711('0x5a')]):_0xc711('0x7f'));return respondWithRpcPromise(_0xc711('0x80'),_0xc711('0x81'),_0x373d4c);}return null;})[_0xc711('0x22')](function(_0x2635f0){var _0x74a453=_0xc711('0x82')+_0x2635f0[_0xc711('0x29')][_0xc711('0x6e')];return db[_0xc711('0x6f')][_0xc711('0x42')](_0x74a453,{'type':db[_0xc711('0x70')]['QueryTypes'][_0xc711('0x71')],'raw':!![]})[_0xc711('0x22')](function(_0x331e82){return _0x331e82;});})[_0xc711('0x22')](function(_0x339b6a){if(_0x339b6a){_0x373d4c[_0xc711('0x29')][_0xc711('0x72')]=_0x339b6a[0x0];if(!_0x4f3422[_0xc711('0x5a')][_0xc711('0x64')])return;return db['User'][_0xc711('0x58')]({'where':{'id':_0x4f3422['body'][_0xc711('0x64')],'role':'agent'},'attributes':['id',_0xc711('0x39'),'fullname','email',_0xc711('0x77')],'raw':!![]});}return null;})['then'](function(_0x2dc51c){if(!_0x2dc51c)return null;_0x373d4c[_0xc711('0x29')][_0xc711('0x74')]=_0x2dc51c;return _0x373d4c;})[_0xc711('0x22')](function(_0x145de3){if(_0x145de3){_0x145de3[_0xc711('0x29')]['interface']=util['format'](_0xc711('0x7a'),_0x4f3422[_0xc711('0x65')][_0xc711('0x39')]);_0x145de3[_0xc711('0x29')][_0xc711('0x7b')]=_0x373d4c[_0xc711('0x7b')];_0x145de3[_0xc711('0x29')][_0xc711('0x83')]=_0x373d4c[_0xc711('0x7b')];_0x145de3[_0xc711('0x29')]['event']=_0xc711('0x35');respondWithRpcPromise(_0xc711('0x7c'),_0xc711('0x7c'),{'event':'rejectmessage','message':_0x145de3['message']},client9002);return _0x373d4c;}return null;})[_0xc711('0x22')](respondWithResult(_0x4ddc14,null))[_0xc711('0x2a')](handleError(_0x4ddc14,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 3558cc0..4efad53 100644 --- a/server/api/openchannelMessage/openchannelMessage.events.js +++ b/server/api/openchannelMessage/openchannelMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba2=['save','remove','emit','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x30ccf6,_0xa32e16){var _0x3ded66=function(_0x58e12d){while(--_0x58e12d){_0x30ccf6['push'](_0x30ccf6['shift']());}};_0x3ded66(++_0xa32e16);}(_0x8ba2,0xac));var _0x28ba=function(_0x4a3b5f,_0x2bb9e4){_0x4a3b5f=_0x4a3b5f-0x0;var _0x257228=_0x8ba2[_0x4a3b5f];return _0x257228;};'use strict';var EventEmitter=require(_0x28ba('0x0'));var OpenchannelMessage=require(_0x28ba('0x1'))['db'][_0x28ba('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x28ba('0x3')](0x0);var events={'afterCreate':_0x28ba('0x4'),'afterUpdate':'update','afterDestroy':_0x28ba('0x5')};function emitEvent(_0x299ff3){return function(_0x18026c,_0x5519d,_0x5e69da){OpenchannelMessageEvents['emit'](_0x299ff3+':'+_0x18026c['id'],_0x18026c);OpenchannelMessageEvents[_0x28ba('0x6')](_0x299ff3,_0x18026c);_0x5e69da(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x28ba('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x4bb4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save'];(function(_0x529e61,_0x371533){var _0x3c2456=function(_0x109ae4){while(--_0x109ae4){_0x529e61['push'](_0x529e61['shift']());}};_0x3c2456(++_0x371533);}(_0x4bb4,0x17f));var _0x44bb=function(_0x1290dc,_0x1e4bcf){_0x1290dc=_0x1290dc-0x0;var _0x3a2338=_0x4bb4[_0x1290dc];return _0x3a2338;};'use strict';var EventEmitter=require(_0x44bb('0x0'));var OpenchannelMessage=require(_0x44bb('0x1'))['db'][_0x44bb('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44bb('0x3'),'afterUpdate':'update','afterDestroy':_0x44bb('0x4')};function emitEvent(_0x25433e){return function(_0x14e216,_0x5b609f,_0x32ce40){OpenchannelMessageEvents['emit'](_0x25433e+':'+_0x14e216['id'],_0x14e216);OpenchannelMessageEvents[_0x44bb('0x5')](_0x25433e,_0x14e216);_0x32ce40(null);};}for(var e in events){if(events[_0x44bb('0x6')](e)){var event=events[e];OpenchannelMessage[_0x44bb('0x7')](e,emitEvent(event));}}module[_0x44bb('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 5f3dd48..eac76c7 100644 --- a/server/api/openchannelMessage/openchannelMessage.model.js +++ b/server/api/openchannelMessage/openchannelMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bcb=['update','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction'];(function(_0x15fd13,_0x46d10f){var _0x48a2ea=function(_0x367be1){while(--_0x367be1){_0x15fd13['push'](_0x15fd13['shift']());}};_0x48a2ea(++_0x46d10f);}(_0x3bcb,0xc7));var _0xb3bc=function(_0x2a4c80,_0x3280b9){_0x2a4c80=_0x2a4c80-0x0;var _0x3b781d=_0x3bcb[_0x2a4c80];return _0x3b781d;};'use strict';var _=require(_0xb3bc('0x0'));var util=require(_0xb3bc('0x1'));var logger=require(_0xb3bc('0x2'))('api');var moment=require(_0xb3bc('0x3'));var BPromise=require(_0xb3bc('0x4'));var rp=require(_0xb3bc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3bc('0x6'));var config=require(_0xb3bc('0x7'));var attributes=require(_0xb3bc('0x8'));module['exports']=function(_0x4af6b8,_0x745c58){return _0x4af6b8['define'](_0xb3bc('0x9'),attributes,{'tableName':_0xb3bc('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xb3bc('0xb')],'type':_0xb3bc('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e0094,_0x132736,_0x238597){var _0x59f867=_0x4af6b8[_0xb3bc('0xd')];var _0x52f224=_0x4e0094['get']({'plain':!![]});if(_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()==='in'||_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()===_0xb3bc('0x10')&&!_0x52f224['secret']&&!_['isNil'](_0x52f224[_0xb3bc('0x11')])){_0x59f867[_0xb3bc('0x12')][_0xb3bc('0x13')]({'where':{'id':_0x52f224['OpenchannelInteractionId']}})[_0xb3bc('0x14')](function(_0xbca52c){if(_0xbca52c){_0xbca52c['update']({'lastMsgAt':_0x52f224[_0xb3bc('0x15')],'lastMsgDirection':_0x52f224[_0xb3bc('0xe')][_0xb3bc('0xf')]()});}})[_0xb3bc('0x16')](function(_0x39755c){console[_0xb3bc('0x17')](_0x39755c);});}if(_0x52f224[_0xb3bc('0xe')]===_0xb3bc('0x10')&&!_0x52f224['secret']){var _0x133ac6;_0x59f867[_0xb3bc('0x18')]['describe']()[_0xb3bc('0x14')](function(_0x1df3ff){return _0x59f867[_0xb3bc('0x19')][_0xb3bc('0x1a')]({'where':{'id':_0x52f224[_0xb3bc('0x1b')]},'include':[{'model':_0x59f867[_0xb3bc('0x12')],'as':_0xb3bc('0x1c'),'where':{'id':_0x52f224[_0xb3bc('0x1d')]},'limit':0x1,'include':[{'model':_0x59f867[_0xb3bc('0x18')],'as':_0xb3bc('0x1e'),'attributes':_[_0xb3bc('0x1f')](_0x1df3ff)}]}]});})[_0xb3bc('0x14')](function(_0x47c34b){_0x133ac6=_0x47c34b[_0xb3bc('0x20')]({'plain':!![]});if(_0x133ac6&&_0x133ac6[_0xb3bc('0x21')]){logger[_0xb3bc('0x22')](_0xb3bc('0x23'),_0xb3bc('0x24'),util[_0xb3bc('0x25')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x52f224['id'],_0x133ac6[_0xb3bc('0x21')]));if(_0x133ac6['Interactions']&&_0x133ac6[_0xb3bc('0x1c')][_0xb3bc('0x26')]){_0x52f224['Interaction']=_[_0xb3bc('0x27')](_0x133ac6[_0xb3bc('0x1c')][0x0],'Contact');_0x52f224[_0xb3bc('0x1e')]=_0x133ac6[_0xb3bc('0x1c')][0x0][_0xb3bc('0x1e')];}var _0x132736={'method':_0xb3bc('0x28'),'uri':encodeURI(_0x133ac6[_0xb3bc('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x132736[_0xb3bc('0x29')]){case _0xb3bc('0x2a'):_0x132736['qs']=_0x52f224;break;case _0xb3bc('0x28'):_0x132736[_0xb3bc('0xb')]=_0x52f224;break;}return rp(_0x132736)[_0xb3bc('0x14')](function(_0x5101e3){logger['info'](_0xb3bc('0x23'),'afterCreate',util['format'](_0xb3bc('0x2b'),_0x52f224['id'],_0x133ac6[_0xb3bc('0x21')]));if(_0x5101e3[_0xb3bc('0xb')][_0xb3bc('0x2c')]&&_0x5101e3['body'][_0xb3bc('0x2c')]!=_0x52f224[_0xb3bc('0x2d')]['threadId']){return _0x59f867[_0xb3bc('0x12')]['update']({'threadId':_0x5101e3['body'][_0xb3bc('0x2c')]},{'where':{'id':_0x52f224[_0xb3bc('0x2d')]['id']}});}else{return;}})[_0xb3bc('0x14')](function(){return _0x4e0094[_0xb3bc('0x2e')]({'read':!![]});})[_0xb3bc('0x16')](function(_0x4c889c){logger['error'](_0xb3bc('0x23'),_0xb3bc('0x24'),util[_0xb3bc('0x2f')](_0x4c889c,{'showHidden':![],'depth':null}));_0x238597();});}else{_0x238597();}})['finally'](function(){_0x238597();});}else{_0x238597();}}},'charset':'utf8mb4','collate':_0xb3bc('0x30')});}; \ No newline at end of file +var _0x50b4=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','isNil','UserId','findOne','OpenchannelInteractionId','then','update','direction','catch','error','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4'];(function(_0x1a40ed,_0x5e42f7){var _0x1e1b48=function(_0x4b018e){while(--_0x4b018e){_0x1a40ed['push'](_0x1a40ed['shift']());}};_0x1e1b48(++_0x5e42f7);}(_0x50b4,0x132));var _0x450b=function(_0x49bb08,_0x428a7a){_0x49bb08=_0x49bb08-0x0;var _0x50c01e=_0x50b4[_0x49bb08];return _0x50c01e;};'use strict';var _=require(_0x450b('0x0'));var util=require('util');var logger=require(_0x450b('0x1'))(_0x450b('0x2'));var moment=require(_0x450b('0x3'));var BPromise=require(_0x450b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x450b('0x5'));var rimraf=require(_0x450b('0x6'));var config=require('../../config/environment');var attributes=require(_0x450b('0x7'));module[_0x450b('0x8')]=function(_0x401d40,_0x54c7a7){return _0x401d40['define'](_0x450b('0x9'),attributes,{'tableName':_0x450b('0xa'),'paranoid':![],'indexes':[{'name':_0x450b('0xb'),'fields':[_0x450b('0xc')],'type':_0x450b('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d66a6,_0x2bfb93,_0x58753f){var _0x71708d=_0x401d40[_0x450b('0xe')];var _0x22fb6f=_0x4d66a6[_0x450b('0xf')]({'plain':!![]});if(_0x22fb6f['direction'][_0x450b('0x10')]()==='in'||_0x22fb6f['direction'][_0x450b('0x10')]()==='out'&&!_0x22fb6f['secret']&&!_[_0x450b('0x11')](_0x22fb6f[_0x450b('0x12')])){_0x71708d['OpenchannelInteraction'][_0x450b('0x13')]({'where':{'id':_0x22fb6f[_0x450b('0x14')]}})[_0x450b('0x15')](function(_0x41c095){if(_0x41c095){_0x41c095[_0x450b('0x16')]({'lastMsgAt':_0x22fb6f['createdAt'],'lastMsgDirection':_0x22fb6f[_0x450b('0x17')][_0x450b('0x10')]()});}})[_0x450b('0x18')](function(_0x538ed8){console[_0x450b('0x19')](_0x538ed8);});}if(_0x22fb6f[_0x450b('0x17')]==='out'&&!_0x22fb6f[_0x450b('0x1a')]){var _0x2b71bc;_0x71708d[_0x450b('0x1b')][_0x450b('0x1c')]()['then'](function(_0x5614ef){return _0x71708d[_0x450b('0x1d')][_0x450b('0x1e')]({'where':{'id':_0x22fb6f[_0x450b('0x1f')]},'include':[{'model':_0x71708d['OpenchannelInteraction'],'as':_0x450b('0x20'),'where':{'id':_0x22fb6f[_0x450b('0x14')]},'limit':0x1,'include':[{'model':_0x71708d[_0x450b('0x1b')],'as':_0x450b('0x21'),'attributes':_[_0x450b('0x22')](_0x5614ef)}]}]});})[_0x450b('0x15')](function(_0x367176){_0x2b71bc=_0x367176['get']({'plain':!![]});if(_0x2b71bc&&_0x2b71bc[_0x450b('0x23')]){logger[_0x450b('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x450b('0x25'),util[_0x450b('0x26')](_0x450b('0x27'),_0x22fb6f['id'],_0x2b71bc['replyUri']));if(_0x2b71bc['Interactions']&&_0x2b71bc[_0x450b('0x20')][_0x450b('0x28')]){_0x22fb6f[_0x450b('0x29')]=_[_0x450b('0x2a')](_0x2b71bc['Interactions'][0x0],_0x450b('0x21'));_0x22fb6f[_0x450b('0x21')]=_0x2b71bc[_0x450b('0x20')][0x0]['Contact'];}var _0x2bfb93={'method':'POST','uri':encodeURI(_0x2b71bc[_0x450b('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2bfb93['method']){case _0x450b('0x2b'):_0x2bfb93['qs']=_0x22fb6f;break;case _0x450b('0x2c'):_0x2bfb93['body']=_0x22fb6f;break;}return rp(_0x2bfb93)[_0x450b('0x15')](function(_0x261df2){logger[_0x450b('0x24')](_0x450b('0x2d'),_0x450b('0x25'),util[_0x450b('0x26')](_0x450b('0x2e'),_0x22fb6f['id'],_0x2b71bc[_0x450b('0x23')]));if(_0x261df2[_0x450b('0xc')][_0x450b('0x2f')]&&_0x261df2[_0x450b('0xc')][_0x450b('0x2f')]!=_0x22fb6f['Interaction'][_0x450b('0x2f')]){return _0x71708d['OpenchannelInteraction'][_0x450b('0x16')]({'threadId':_0x261df2['body'][_0x450b('0x2f')]},{'where':{'id':_0x22fb6f[_0x450b('0x29')]['id']}});}else{return;}})[_0x450b('0x15')](function(){return _0x4d66a6[_0x450b('0x16')]({'read':!![]});})[_0x450b('0x18')](function(_0x2b3726){logger[_0x450b('0x19')](_0x450b('0x2d'),_0x450b('0x25'),util[_0x450b('0x30')](_0x2b3726,{'showHidden':![],'depth':null}));_0x58753f();});}else{_0x58753f();}})[_0x450b('0x31')](function(){_0x58753f();});}else{_0x58753f();}}},'charset':_0x450b('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 48a6169..55ff608 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x3a73be,_0x31d42e){var _0x4c2683=function(_0x47e79c){while(--_0x47e79c){_0x3a73be['push'](_0x3a73be['shift']());}};_0x4c2683(++_0x31d42e);}(_0x2ef3,0xba));var _0x32ef=function(_0x58bf9f,_0x2874c8){_0x58bf9f=_0x58bf9f-0x0;var _0x46fd11=_0x2ef3[_0x58bf9f];return _0x46fd11;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22dd52,_0x4c3ec9){var _0x1bbfd8=function(_0x1746a7){while(--_0x1746a7){_0x22dd52['push'](_0x22dd52['shift']());}};_0x1bbfd8(++_0x4c3ec9);}(_0x1261,0x144));var _0x1126=function(_0x3a924d,_0x1f0870){_0x3a924d=_0x3a924d-0x0;var _0x2f9f0b=_0x1261[_0x3a924d];return _0x2f9f0b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index e6872a7..fec7fe8 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9208=['update','emit','register','length','openchannelMessage:','./openchannelMessage.events','save'];(function(_0x532e50,_0x593264){var _0x3c2a6c=function(_0x467557){while(--_0x467557){_0x532e50['push'](_0x532e50['shift']());}};_0x3c2a6c(++_0x593264);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var OpenchannelMessageEvents=require(_0x8920('0x0'));var events=[_0x8920('0x1'),'remove',_0x8920('0x2')];function createListener(_0x4efd40,_0x5b3c92){return function(_0x338547){_0x5b3c92[_0x8920('0x3')](_0x4efd40,_0x338547);};}function removeListener(_0x14ee6c,_0x3b2573){return function(){OpenchannelMessageEvents['removeListener'](_0x14ee6c,_0x3b2573);};}exports[_0x8920('0x4')]=function(_0x126772){for(var _0x194026=0x0,_0x54eb58=events[_0x8920('0x5')];_0x194026<_0x54eb58;_0x194026++){var _0x185860=events[_0x194026];var _0x24f425=createListener(_0x8920('0x6')+_0x185860,_0x126772);OpenchannelMessageEvents['on'](_0x185860,_0x24f425);}}; \ No newline at end of file +var _0xb6af=['./openchannelMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x2662f1,_0x3fb95a){var _0x856021=function(_0x54f0d2){while(--_0x54f0d2){_0x2662f1['push'](_0x2662f1['shift']());}};_0x856021(++_0x3fb95a);}(_0xb6af,0x1ce));var _0xfb6a=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xb6af[_0x207811];return _0x170d56;};'use strict';var OpenchannelMessageEvents=require(_0xfb6a('0x0'));var events=[_0xfb6a('0x1'),_0xfb6a('0x2'),'update'];function createListener(_0x5c136e,_0x1b620b){return function(_0x26b5aa){_0x1b620b[_0xfb6a('0x3')](_0x5c136e,_0x26b5aa);};}function removeListener(_0x2dc5da,_0xf8239d){return function(){OpenchannelMessageEvents[_0xfb6a('0x4')](_0x2dc5da,_0xf8239d);};}exports[_0xfb6a('0x5')]=function(_0x3ba683){for(var _0x584fbd=0x0,_0x4de798=events[_0xfb6a('0x6')];_0x584fbd<_0x4de798;_0x584fbd++){var _0xca80cd=events[_0x584fbd];var _0x181e90=createListener('openchannelMessage:'+_0xca80cd,_0x3ba683);OpenchannelMessageEvents['on'](_0xca80cd,_0x181e90);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ed8788b..1a52af4 100644 --- a/server/api/openchannelQueue/index.js +++ b/server/api/openchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdd6=['addAgents','/:id','delete','destroy','removeTeams','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x74445f,_0xcb007c){var _0x4d4ff3=function(_0x4e92df){while(--_0x4e92df){_0x74445f['push'](_0x74445f['shift']());}};_0x4d4ff3(++_0xcb007c);}(_0xfdd6,0x6d));var _0x6fdd=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xfdd6[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x6fdd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6fdd('0x1'));var express=require(_0x6fdd('0x2'));var router=express[_0x6fdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6fdd('0x4'));var interaction=require(_0x6fdd('0x5'));var config=require(_0x6fdd('0x6'));var controller=require('./openchannelQueue.controller');router[_0x6fdd('0x7')]('/',auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x9')]);router['get'](_0x6fdd('0xa'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xb')]);router[_0x6fdd('0x7')]('/:id',auth[_0x6fdd('0x8')](),controller['show']);router['get'](_0x6fdd('0xc'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xd')]);router[_0x6fdd('0x7')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0xf')]);router[_0x6fdd('0x7')](_0x6fdd('0x10'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x11')]);router[_0x6fdd('0x12')]('/',auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x13')]);router[_0x6fdd('0x12')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x14')]);router[_0x6fdd('0x12')](_0x6fdd('0x10'),auth['isAuthenticated'](),controller[_0x6fdd('0x15')]);router['put'](_0x6fdd('0x16'),auth[_0x6fdd('0x8')](),controller['update']);router[_0x6fdd('0x17')](_0x6fdd('0x16'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x18')]);router[_0x6fdd('0x17')](_0x6fdd('0xe'),auth[_0x6fdd('0x8')](),controller[_0x6fdd('0x19')]);router[_0x6fdd('0x17')]('/:id/users',auth[_0x6fdd('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf9cd=['/:id/users','addAgents','put','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams'];(function(_0x7ad661,_0x1e4efa){var _0x363e14=function(_0x507439){while(--_0x507439){_0x7ad661['push'](_0x7ad661['shift']());}};_0x363e14(++_0x1e4efa);}(_0xf9cd,0x151));var _0xdf9c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xf9cd[_0x35da42];return _0x370035;};'use strict';var multer=require(_0xdf9c('0x0'));var util=require('util');var path=require(_0xdf9c('0x1'));var timeout=require(_0xdf9c('0x2'));var express=require(_0xdf9c('0x3'));var router=express[_0xdf9c('0x4')]();var fs_extra=require(_0xdf9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdf9c('0x6'));var config=require(_0xdf9c('0x7'));var controller=require(_0xdf9c('0x8'));router['get']('/',auth[_0xdf9c('0x9')](),controller[_0xdf9c('0xa')]);router[_0xdf9c('0xb')](_0xdf9c('0xc'),auth[_0xdf9c('0x9')](),controller[_0xdf9c('0xd')]);router[_0xdf9c('0xb')](_0xdf9c('0xe'),auth[_0xdf9c('0x9')](),controller[_0xdf9c('0xf')]);router[_0xdf9c('0xb')](_0xdf9c('0x10'),auth['isAuthenticated'](),controller[_0xdf9c('0x11')]);router[_0xdf9c('0xb')]('/:id/teams',auth[_0xdf9c('0x9')](),controller[_0xdf9c('0x12')]);router[_0xdf9c('0xb')]('/:id/users',auth[_0xdf9c('0x9')](),controller[_0xdf9c('0x13')]);router[_0xdf9c('0x14')]('/',auth[_0xdf9c('0x9')](),controller['create']);router[_0xdf9c('0x14')](_0xdf9c('0x15'),auth['isAuthenticated'](),controller[_0xdf9c('0x16')]);router[_0xdf9c('0x14')](_0xdf9c('0x17'),auth['isAuthenticated'](),controller[_0xdf9c('0x18')]);router[_0xdf9c('0x19')](_0xdf9c('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xdf9c('0xe'),auth[_0xdf9c('0x9')](),controller[_0xdf9c('0x1a')]);router['delete'](_0xdf9c('0x15'),auth[_0xdf9c('0x9')](),controller[_0xdf9c('0x1b')]);router['delete'](_0xdf9c('0x17'),auth[_0xdf9c('0x9')](),controller[_0xdf9c('0x1c')]);module[_0xdf9c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5683166..9e991d0 100644 --- a/server/api/openchannelQueue/openchannelQueue.attributes.js +++ b/server/api/openchannelQueue/openchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac16=['ENUM','rrmemory','beepall','exports','STRING','INTEGER'];(function(_0x114da0,_0x19188f){var _0x5f1d8a=function(_0x154c3d){while(--_0x154c3d){_0x114da0['push'](_0x114da0['shift']());}};_0x5f1d8a(++_0x19188f);}(_0xac16,0xff));var _0x6ac1=function(_0x2b2405,_0x4860d9){_0x2b2405=_0x2b2405-0x0;var _0x3e69ac=_0xac16[_0x2b2405];return _0x3e69ac;};'use strict';var Sequelize=require('sequelize');module[_0x6ac1('0x0')]={'name':{'type':Sequelize[_0x6ac1('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6ac1('0x1')]},'timeout':{'type':Sequelize[_0x6ac1('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ac1('0x3')](_0x6ac1('0x4'),_0x6ac1('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x85e9=['STRING','name','INTEGER','rrmemory','beepall'];(function(_0x3cc700,_0x542e5d){var _0x4902e4=function(_0xb2215f){while(--_0xb2215f){_0x3cc700['push'](_0x3cc700['shift']());}};_0x4902e4(++_0x542e5d);}(_0x85e9,0x8c));var _0x985e=function(_0x48a21a,_0xbb6a8e){_0x48a21a=_0x48a21a-0x0;var _0x43c031=_0x85e9[_0x48a21a];return _0x43c031;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x985e('0x0')],'unique':_0x985e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x985e('0x0')]},'timeout':{'type':Sequelize[_0x985e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x985e('0x3'),_0x985e('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4fdb5e6..c986f22 100644 --- a/server/api/openchannelQueue/openchannelQueue.controller.js +++ b/server/api/openchannelQueue/openchannelQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe215=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','UserOpenchannelQueue','rawAttributes','hasOwnProperty','nolimit','User','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','removeTeams','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox'];(function(_0x2279c4,_0x592acb){var _0x2f6fe9=function(_0xb2fb0a){while(--_0xb2fb0a){_0x2279c4['push'](_0x2279c4['shift']());}};_0x2f6fe9(++_0x592acb);}(_0xe215,0x7e));var _0x5e21=function(_0x37ea74,_0x2a330c){_0x37ea74=_0x37ea74-0x0;var _0x5bc73e=_0xe215[_0x37ea74];return _0x5bc73e;};'use strict';var emlformat=require(_0x5e21('0x0'));var rimraf=require(_0x5e21('0x1'));var zipdir=require(_0x5e21('0x2'));var jsonpatch=require(_0x5e21('0x3'));var rp=require(_0x5e21('0x4'));var moment=require(_0x5e21('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e21('0x6'));var path=require(_0x5e21('0x7'));var sox=require(_0x5e21('0x8'));var csv=require(_0x5e21('0x9'));var ejs=require(_0x5e21('0xa'));var fs=require('fs');var fs_extra=require(_0x5e21('0xb'));var _=require('lodash');var squel=require(_0x5e21('0xc'));var crypto=require(_0x5e21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5e21('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5e21('0xf'));var Papa=require('papaparse');var Redis=require(_0x5e21('0x10'));var authService=require(_0x5e21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5e21('0x12'));var hardwareService=require(_0x5e21('0x13'));var logger=require(_0x5e21('0x14'))('api');var utils=require(_0x5e21('0x15'));var config=require(_0x5e21('0x16'));var licenseUtil=require(_0x5e21('0x17'));var db=require(_0x5e21('0x18'))['db'];config[_0x5e21('0x19')]=_[_0x5e21('0x1a')](config[_0x5e21('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e21('0x1b'))(new Redis(config[_0x5e21('0x19')]));require(_0x5e21('0x1c'))[_0x5e21('0x1d')](socket);function respondWithStatusCode(_0x28fb3f,_0x303862){_0x303862=_0x303862||0xcc;return function(_0x2b34a5){if(_0x2b34a5){return _0x28fb3f[_0x5e21('0x1e')](_0x303862);}return _0x28fb3f[_0x5e21('0x1f')](_0x303862)[_0x5e21('0x20')]();};}function respondWithResult(_0x1a12de,_0x4ce711){_0x4ce711=_0x4ce711||0xc8;return function(_0x10669f){if(_0x10669f){return _0x1a12de[_0x5e21('0x1f')](_0x4ce711)[_0x5e21('0x21')](_0x10669f);}};}function respondWithFilteredResult(_0x5a5eb6,_0x3260ad){return function(_0x33e97b){if(_0x33e97b){var _0x4a368f=typeof _0x3260ad[_0x5e21('0x22')]===_0x5e21('0x23')&&typeof _0x3260ad[_0x5e21('0x24')]===_0x5e21('0x23');var _0x33e900=_0x33e97b['count'];var _0x5ae50a=_0x4a368f?0x0:_0x3260ad[_0x5e21('0x22')];var _0x4e1fad=_0x4a368f?_0x33e97b[_0x5e21('0x25')]:_0x3260ad['offset']+_0x3260ad[_0x5e21('0x24')];var _0x47d1b6;if(_0x4e1fad>=_0x33e900){_0x4e1fad=_0x33e900;_0x47d1b6=0xc8;}else{_0x47d1b6=0xce;}_0x5a5eb6[_0x5e21('0x1f')](_0x47d1b6);return _0x5a5eb6[_0x5e21('0x26')](_0x5e21('0x27'),_0x5ae50a+'-'+_0x4e1fad+'/'+_0x33e900)[_0x5e21('0x21')](_0x33e97b);}return null;};}function patchUpdates(_0x1684de){return function(_0x25705b){try{jsonpatch[_0x5e21('0x28')](_0x25705b,_0x1684de,!![]);}catch(_0x3dd501){return BPromise[_0x5e21('0x29')](_0x3dd501);}return _0x25705b[_0x5e21('0x2a')]();};}function saveUpdates(_0x17e038,_0x15db3a){return function(_0x4ed106){if(_0x4ed106){return _0x4ed106[_0x5e21('0x2b')](_0x17e038)[_0x5e21('0x2c')](function(_0x47f3f9){return _0x47f3f9;});}return null;};}function removeEntity(_0x383c34,_0x328f02){return function(_0x495d81){if(_0x495d81){return _0x495d81[_0x5e21('0x2d')]()[_0x5e21('0x2c')](function(){var _0x2c5bef=_0x495d81[_0x5e21('0x2e')]({'plain':!![]});var _0x2d77e8='OpenchannelQueues';return db[_0x5e21('0x2f')][_0x5e21('0x2d')]({'where':{'type':_0x2d77e8,'resourceId':_0x2c5bef['id']}})['then'](function(){return _0x495d81;});})[_0x5e21('0x2c')](function(){_0x383c34[_0x5e21('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14474a,_0x5b14cc){return function(_0x9af34d){if(!_0x9af34d){_0x14474a['sendStatus'](0x194);}return _0x9af34d;};}function handleError(_0x49f0e4,_0x3fb730){_0x3fb730=_0x3fb730||0x1f4;return function(_0x505ad0){logger[_0x5e21('0x30')](_0x505ad0[_0x5e21('0x31')]);if(_0x505ad0['name']){delete _0x505ad0[_0x5e21('0x32')];}_0x49f0e4[_0x5e21('0x1f')](_0x3fb730)[_0x5e21('0x33')](_0x505ad0);};}exports[_0x5e21('0x34')]=function(_0x4ef5ed,_0x2baf34){var _0x4ccfc4={},_0x31faff={},_0x2bec37={'count':0x0,'rows':[]};var _0x2e3b36=_[_0x5e21('0x35')](db[_0x5e21('0x36')]['rawAttributes'],function(_0x3b4fbf){return{'name':_0x3b4fbf[_0x5e21('0x37')],'type':_0x3b4fbf['type']['key']};});_0x31faff[_0x5e21('0x38')]=_[_0x5e21('0x35')](_0x2e3b36,_0x5e21('0x32'));_0x31faff['query']=_[_0x5e21('0x39')](_0x4ef5ed[_0x5e21('0x3a')]);_0x31faff[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x31faff[_0x5e21('0x38')],_0x31faff[_0x5e21('0x3a')]);_0x4ccfc4[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x31faff['model'],qs[_0x5e21('0x3e')](_0x4ef5ed[_0x5e21('0x3a')]['fields']));_0x4ccfc4['attributes']=_0x4ccfc4['attributes'][_0x5e21('0x3f')]?_0x4ccfc4[_0x5e21('0x3d')]:_0x31faff[_0x5e21('0x38')];if(!_0x4ef5ed['query']['hasOwnProperty']('nolimit')){_0x4ccfc4[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x4ccfc4[_0x5e21('0x22')]=qs['offset'](_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x22')]);}_0x4ccfc4[_0x5e21('0x40')]=qs[_0x5e21('0x41')](_0x4ef5ed['query']['sort']);_0x4ccfc4[_0x5e21('0x42')]=qs['filters'](_[_0x5e21('0x43')](_0x4ef5ed[_0x5e21('0x3a')],_0x31faff[_0x5e21('0x3b')]),_0x2e3b36);if(_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x44')]){_0x4ccfc4[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x4ccfc4[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0x2e3b36,function(_0x12fa75){if(_0x12fa75['type']!==_0x5e21('0x46')){var _0x223b48={};_0x223b48[_0x12fa75['name']]={'$like':'%'+_0x4ef5ed[_0x5e21('0x3a')]['filter']+'%'};return _0x223b48;}})});}_0x4ccfc4=_[_0x5e21('0x45')]({},_0x4ccfc4,_0x4ef5ed[_0x5e21('0x47')]);var _0x4e8298={'where':_0x4ccfc4[_0x5e21('0x42')]};return db[_0x5e21('0x36')][_0x5e21('0x25')](_0x4e8298)[_0x5e21('0x2c')](function(_0x252629){_0x2bec37[_0x5e21('0x25')]=_0x252629;if(_0x4ef5ed[_0x5e21('0x3a')][_0x5e21('0x48')]){_0x4ccfc4[_0x5e21('0x49')]=[{'all':!![]}];}return db[_0x5e21('0x36')][_0x5e21('0x4a')](_0x4ccfc4);})[_0x5e21('0x2c')](function(_0x14d1cc){_0x2bec37[_0x5e21('0x4b')]=_0x14d1cc;return _0x2bec37;})[_0x5e21('0x2c')](respondWithFilteredResult(_0x2baf34,_0x4ccfc4))['catch'](handleError(_0x2baf34,null));};exports['show']=function(_0x3c4fb5,_0x4700ee){var _0x3da03b={'raw':!![],'where':{'id':_0x3c4fb5[_0x5e21('0x4c')]['id']}},_0x49aeed={};_0x49aeed[_0x5e21('0x38')]=_[_0x5e21('0x39')](db[_0x5e21('0x36')]['rawAttributes']);_0x49aeed[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x3c4fb5['query']);_0x49aeed[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x49aeed[_0x5e21('0x38')],_0x49aeed['query']);_0x3da03b[_0x5e21('0x3d')]=_['intersection'](_0x49aeed[_0x5e21('0x38')],qs['fields'](_0x3c4fb5['query'][_0x5e21('0x3e')]));_0x3da03b[_0x5e21('0x3d')]=_0x3da03b['attributes']['length']?_0x3da03b['attributes']:_0x49aeed[_0x5e21('0x38')];if(_0x3c4fb5['query'][_0x5e21('0x48')]){_0x3da03b['include']=[{'all':!![]}];}_0x3da03b=_['merge']({},_0x3da03b,_0x3c4fb5[_0x5e21('0x47')]);return db[_0x5e21('0x36')][_0x5e21('0x4d')](_0x3da03b)[_0x5e21('0x2c')](handleEntityNotFound(_0x4700ee,null))[_0x5e21('0x2c')](respondWithResult(_0x4700ee,null))[_0x5e21('0x4e')](handleError(_0x4700ee,null));};exports['create']=function(_0x33a35e,_0xfd3faa){return db['OpenchannelQueue'][_0x5e21('0x4f')](_0x33a35e[_0x5e21('0x50')],{})[_0x5e21('0x2c')](function(_0x3d9245){var _0xd05877=_0x33a35e[_0x5e21('0x51')][_0x5e21('0x2e')]({'plain':!![]});if(!_0xd05877)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd05877[_0x5e21('0x52')]===_0x5e21('0x51')){var _0x3babfb=_0x3d9245[_0x5e21('0x2e')]({'plain':!![]});var _0x5e5083='OpenchannelQueues';return db[_0x5e21('0x53')]['find']({'where':{'name':_0x5e5083,'userProfileId':_0xd05877[_0x5e21('0x54')]},'raw':!![]})[_0x5e21('0x2c')](function(_0x834652){if(_0x834652&&_0x834652[_0x5e21('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x3babfb[_0x5e21('0x32')],'resourceId':_0x3babfb['id'],'type':_0x834652['name'],'sectionId':_0x834652['id']},{})['then'](function(){return _0x3d9245;});}else{return _0x3d9245;}})[_0x5e21('0x4e')](function(_0x15a15a){logger[_0x5e21('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15a15a);throw _0x15a15a;});}return _0x3d9245;})['then'](respondWithResult(_0xfd3faa,0xc9))['catch'](handleError(_0xfd3faa,null));};exports[_0x5e21('0x2b')]=function(_0x1aa998,_0x238cb0){if(_0x1aa998[_0x5e21('0x50')]['id']){delete _0x1aa998[_0x5e21('0x50')]['id'];}return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x1aa998[_0x5e21('0x4c')]['id']}})['then'](handleEntityNotFound(_0x238cb0,null))[_0x5e21('0x2c')](saveUpdates(_0x1aa998[_0x5e21('0x50')],null))[_0x5e21('0x2c')](respondWithResult(_0x238cb0,null))['catch'](handleError(_0x238cb0,null));};exports[_0x5e21('0x2d')]=function(_0x19e70e,_0x399ac4){return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x19e70e[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x399ac4,null))[_0x5e21('0x2c')](removeEntity(_0x399ac4,null))[_0x5e21('0x4e')](handleError(_0x399ac4,null));};exports[_0x5e21('0x56')]=function(_0x1892b0,_0x4bfb88){return db['OpenchannelQueue']['describe']()[_0x5e21('0x2c')](respondWithResult(_0x4bfb88,null))['catch'](handleError(_0x4bfb88,null));};exports[_0x5e21('0x57')]=function(_0x4c4ad4,_0x214645,_0x8c023b){var _0xc4e6dd={'raw':!![],'where':{}},_0x4c0c89={},_0x5b96aa;return db[_0x5e21('0x36')]['findOne']({'where':{'id':_0x4c4ad4[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x214645,null))['then'](function(_0x4b1ffa){if(_0x4b1ffa){_0x5b96aa=_0x4b1ffa[_0x5e21('0x2e')]({'plain':!![]});_0x4c0c89['model']=_['keys'](db[_0x5e21('0x58')][_0x5e21('0x59')]);_0x4c0c89[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x4c4ad4[_0x5e21('0x3a')]);_0x4c0c89[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x4c0c89[_0x5e21('0x38')],_0x4c0c89['query']);_0xc4e6dd[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x4c0c89['model'],qs[_0x5e21('0x3e')](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x3e')]));_0xc4e6dd['attributes']=_0xc4e6dd['attributes'][_0x5e21('0x3f')]?_0xc4e6dd[_0x5e21('0x3d')]:_0x4c0c89['model'];if(!_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x5a')](_0x5e21('0x5b'))){_0xc4e6dd[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x24')]);_0xc4e6dd[_0x5e21('0x22')]=qs['offset'](_0x4c4ad4[_0x5e21('0x3a')]['offset']);}_0xc4e6dd[_0x5e21('0x40')]=qs['sort'](_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x41')]);_0xc4e6dd['where']=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x4c4ad4[_0x5e21('0x3a')],_0x4c0c89[_0x5e21('0x3b')]));_0xc4e6dd[_0x5e21('0x42')]['OpenchannelQueueId']=_0x4b1ffa['id'];if(_0x4c4ad4[_0x5e21('0x3a')][_0x5e21('0x44')]){_0xc4e6dd[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0xc4e6dd[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0xc4e6dd[_0x5e21('0x3d')],function(_0x22a505){var _0x166250={};_0x166250[_0x22a505]={'$like':'%'+_0x4c4ad4['query'][_0x5e21('0x44')]+'%'};return _0x166250;})});}_0xc4e6dd=_[_0x5e21('0x45')]({},_0xc4e6dd,_0x4c4ad4[_0x5e21('0x47')]);return db[_0x5e21('0x58')]['findAll'](_0xc4e6dd);}})[_0x5e21('0x2c')](function(_0x4f0ab0){if(_0x4f0ab0){return db[_0x5e21('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x4f0ab0,'UserId'),'role':'agent'},'attributes':['id',_0x5e21('0x32'),'openchannelPause',_0x5e21('0x5d'),_0x5e21('0x5e')]});}})[_0x5e21('0x2c')](function(_0x13548a){if(_0x13548a){return{'count':_0x13548a[_0x5e21('0x25')],'rows':_[_0x5e21('0x35')](_0x13548a[_0x5e21('0x4b')],function(_0x3fa2ed){return{'membername':_0x3fa2ed[_0x5e21('0x32')],'UserId':_0x3fa2ed['id'],'queue_name':_0x5b96aa[_0x5e21('0x32')],'OpenchannelQueueId':_0x5b96aa['id'],'interface':util['format'](_0x5e21('0x5f'),_0x5e21('0x60'),_0x3fa2ed['name']),'penalty':0x0,'paused':_0x3fa2ed[_0x5e21('0x61')],'createdAt':_0x3fa2ed[_0x5e21('0x5e')],'updatedAt':_0x3fa2ed[_0x5e21('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5e21('0x2c')](respondWithFilteredResult(_0x214645,_0xc4e6dd))['catch'](handleError(_0x214645,null));};exports[_0x5e21('0x62')]=function(_0x114a4f,_0x296687,_0x4635a2){var _0x37b669={};var _0x274882={};var _0x1a39a1;var _0x591ef3;return db[_0x5e21('0x36')][_0x5e21('0x63')]({'where':{'id':_0x114a4f['params']['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x296687,null))[_0x5e21('0x2c')](function(_0x4e742e){if(_0x4e742e){_0x1a39a1=_0x4e742e;_0x274882[_0x5e21('0x38')]=_['keys'](db[_0x5e21('0x64')]['rawAttributes']);_0x274882[_0x5e21('0x3a')]=_[_0x5e21('0x39')](_0x114a4f['query']);_0x274882[_0x5e21('0x3b')]=_[_0x5e21('0x3c')](_0x274882[_0x5e21('0x38')],_0x274882[_0x5e21('0x3a')]);_0x37b669['attributes']=_[_0x5e21('0x3c')](_0x274882[_0x5e21('0x38')],qs[_0x5e21('0x3e')](_0x114a4f[_0x5e21('0x3a')]['fields']));_0x37b669['attributes']=_0x37b669['attributes']['length']?_0x37b669[_0x5e21('0x3d')]:_0x274882['model'];_0x37b669[_0x5e21('0x40')]=qs[_0x5e21('0x41')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x41')]);_0x37b669[_0x5e21('0x42')]=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x114a4f[_0x5e21('0x3a')],_0x274882[_0x5e21('0x3b')]));if(_0x114a4f['query'][_0x5e21('0x44')]){_0x37b669[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x37b669[_0x5e21('0x42')],{'$or':_[_0x5e21('0x35')](_0x37b669[_0x5e21('0x3d')],function(_0x27bf3f){var _0x3a9149={};_0x3a9149[_0x27bf3f]={'$like':'%'+_0x114a4f['query'][_0x5e21('0x44')]+'%'};return _0x3a9149;})});}_0x37b669=_[_0x5e21('0x45')]({},_0x37b669,_0x114a4f[_0x5e21('0x47')]);return _0x1a39a1[_0x5e21('0x62')](_0x37b669);}})[_0x5e21('0x2c')](function(_0x463441){if(_0x463441){_0x591ef3=_0x463441['length'];if(!_0x114a4f[_0x5e21('0x3a')]['hasOwnProperty'](_0x5e21('0x5b'))){_0x37b669[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x37b669['offset']=qs[_0x5e21('0x22')](_0x114a4f[_0x5e21('0x3a')][_0x5e21('0x22')]);}return _0x1a39a1['getTeams'](_0x37b669);}})['then'](function(_0x10494b){if(_0x10494b){return _0x10494b?{'count':_0x591ef3,'rows':_0x10494b}:null;}})[_0x5e21('0x2c')](respondWithResult(_0x296687,null))[_0x5e21('0x4e')](handleError(_0x296687,null));};exports[_0x5e21('0x65')]=function(_0x2a2819,_0x29c891,_0x1ba420){var _0x3c9df7=_0x2a2819[_0x5e21('0x50')][_0x5e21('0x66')];return db[_0x5e21('0x64')][_0x5e21('0x4a')]({'where':{'id':_0x3c9df7},'attributes':['id'],'include':[{'model':db[_0x5e21('0x5c')],'as':_0x5e21('0x67'),'attributes':['id',_0x5e21('0x32'),_0x5e21('0x68'),_0x5e21('0x69'),_0x5e21('0x6a')],'raw':!![]}]})[_0x5e21('0x2c')](function(_0xd41d94){if(_0xd41d94){var _0x2770a6=_['flatMap'](_0xd41d94,function(_0x37d604){var _0x56c602=_0x37d604[_0x5e21('0x2e')]({'plain':!![]});return _0x56c602['Agents'];});return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x2a2819[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](function(_0x43ac5c){return db[_0x5e21('0x6b')]['transaction'](function(_0x1c062a){return _0x43ac5c[_0x5e21('0x65')](_0x3c9df7,{'transaction':_0x1c062a})[_0x5e21('0x2c')](function(){return BPromise[_0x5e21('0x6c')](_0x2770a6,function(_0x45e608){return db[_0x5e21('0x58')][_0x5e21('0x6d')]({'where':{'UserId':_0x45e608['id'],'OpenchannelQueueId':_0x2a2819['params']['id']},'transaction':_0x1c062a});});})[_0x5e21('0x2c')](function(){_0x2770a6['forEach'](function(_0x211aac){socket[_0x5e21('0x6e')]('userOpenchannelQueue:save',{'UserId':_0x211aac['id'],'OpenchannelQueueId':_0x43ac5c['id']});});});});});}})[_0x5e21('0x2c')](respondWithStatusCode(_0x29c891,null))['catch'](handleError(_0x29c891,null));};exports[_0x5e21('0x6f')]=function(_0x29a2c2,_0x1ab0ad,_0x54594e){return db[_0x5e21('0x64')][_0x5e21('0x4a')]({'where':{'id':_0x29a2c2[_0x5e21('0x3a')][_0x5e21('0x66')]},'attributes':['id'],'include':[{'model':db[_0x5e21('0x5c')],'as':_0x5e21('0x67'),'attributes':['id'],'raw':!![]}]})[_0x5e21('0x2c')](handleEntityNotFound(_0x1ab0ad,null))[_0x5e21('0x2c')](function(_0x517a8f){var _0x453918=_[_0x5e21('0x35')](_0x517a8f,'id');var _0x47e2dc=[];var _0x1152ee=[];var _0x459291=squel['select']();_0x459291['field'](_0x5e21('0x70'))['from']('team_has_openchannel_queues','tq')['join'](_0x5e21('0x71'),'ut',_0x5e21('0x72'))[_0x5e21('0x42')](_0x5e21('0x73'),_0x29a2c2[_0x5e21('0x4c')]['id']);for(var _0x2bfec5=0x0;_0x2bfec5<_0x517a8f[_0x5e21('0x3f')];_0x2bfec5+=0x1){let _0x241a3d=_0x517a8f[_0x2bfec5];for(var _0x561ff2=0x0;_0x561ff2<_0x241a3d[_0x5e21('0x67')][_0x5e21('0x3f')];_0x561ff2+=0x1){let _0x298d60=_0x241a3d[_0x5e21('0x67')][_0x561ff2];var _0x59e705=_0x459291['clone']();_0x59e705[_0x5e21('0x42')](_0x5e21('0x74'),_0x298d60['id']);_0x1152ee['push'](db[_0x5e21('0x6b')]['query'](_0x59e705['toString'](),{'type':db[_0x5e21('0x6b')][_0x5e21('0x75')][_0x5e21('0x76')]})[_0x5e21('0x2c')](function(_0x52e4fe){if(_0x52e4fe[_0x5e21('0x3f')]===0x1){return _0x298d60['id'];}else{var _0x231209=_[_0x5e21('0x77')](_['map'](_0x52e4fe,_0x5e21('0x78')),function(_0x1541c9){return _['includes'](_0x453918,_0x1541c9);});if(_0x231209){return _0x298d60['id'];}}}));}}return BPromise[_0x5e21('0x79')](_0x1152ee)['then'](function(_0x58eaa5){_0x47e2dc=_(_0x47e2dc)[_0x5e21('0x7a')](_0x58eaa5)[_0x5e21('0x7b')]()[_0x5e21('0x7c')]();return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0x29a2c2[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](function(_0x3ce8f3){return db[_0x5e21('0x6b')]['transaction'](function(_0x1020b8){return _0x3ce8f3[_0x5e21('0x6f')](_0x29a2c2[_0x5e21('0x3a')][_0x5e21('0x66')],{'transaction':_0x1020b8})[_0x5e21('0x2c')](function(){if(!_[_0x5e21('0x7d')](_0x47e2dc)){return _0x3ce8f3['removeAgents'](_0x47e2dc,{'transaction':_0x1020b8});}})[_0x5e21('0x2c')](function(){_0x47e2dc[_0x5e21('0x7e')](function(_0x216585){socket['emit'](_0x5e21('0x7f'),{'UserId':_0x216585,'OpenchannelQueueId':_0x3ce8f3['id']});});});});});});})[_0x5e21('0x2c')](respondWithStatusCode(_0x1ab0ad,null))[_0x5e21('0x4e')](handleError(_0x1ab0ad,null));};exports[_0x5e21('0x80')]=function(_0x5c0db8,_0x356f9c,_0x54f890){return db['OpenchannelQueue'][_0x5e21('0x4d')]({'where':{'id':_0x5c0db8[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x356f9c,null))[_0x5e21('0x2c')](function(_0x1042c8){if(_0x1042c8){return _0x1042c8[_0x5e21('0x80')](_0x5c0db8['body'][_0x5e21('0x66')],_[_0x5e21('0x81')](_0x5c0db8[_0x5e21('0x50')],['ids','id'])||{})[_0x5e21('0x82')](function(_0x107aae){for(var _0x827664=0x0;_0x827664<_0x5c0db8[_0x5e21('0x50')][_0x5e21('0x66')][_0x5e21('0x3f')];_0x827664+=0x1){socket[_0x5e21('0x6e')](_0x5e21('0x83'),{'UserId':Number(_0x5c0db8['body'][_0x5e21('0x66')][_0x827664]),'OpenchannelQueueId':Number(_0x5c0db8['params']['id'])});}return _0x107aae;});}})[_0x5e21('0x2c')](respondWithResult(_0x356f9c,null))[_0x5e21('0x4e')](handleError(_0x356f9c,null));};exports[_0x5e21('0x84')]=function(_0xb45059,_0x327cbb,_0x22ab17){return db[_0x5e21('0x36')][_0x5e21('0x4d')]({'where':{'id':_0xb45059[_0x5e21('0x4c')]['id']}})['then'](handleEntityNotFound(_0x327cbb,null))[_0x5e21('0x2c')](function(_0x51ff29){if(_0x51ff29){return _0x51ff29['removeAgents'](_0xb45059['query'][_0x5e21('0x66')])[_0x5e21('0x2c')](function(){if(_[_0x5e21('0x85')](_0xb45059[_0x5e21('0x3a')]['ids'])){for(var _0x4075b8=0x0;_0x4075b8<_0xb45059['query'][_0x5e21('0x66')]['length'];_0x4075b8+=0x1){socket[_0x5e21('0x6e')](_0x5e21('0x7f'),{'UserId':Number(_0xb45059[_0x5e21('0x3a')]['ids'][_0x4075b8]),'OpenchannelQueueId':Number(_0xb45059[_0x5e21('0x4c')]['id'])});}}else{socket[_0x5e21('0x6e')](_0x5e21('0x7f'),{'UserId':Number(_0xb45059[_0x5e21('0x3a')][_0x5e21('0x66')]),'OpenchannelQueueId':Number(_0xb45059[_0x5e21('0x4c')]['id'])});}});}})[_0x5e21('0x2c')](respondWithStatusCode(_0x327cbb,null))[_0x5e21('0x4e')](handleError(_0x327cbb,null));};exports[_0x5e21('0x86')]=function(_0x42f095,_0x2af006,_0x26db8b){var _0x133d39={};var _0x5dcb4a={};var _0x2cb5a4;var _0x16a772;return db[_0x5e21('0x36')]['findOne']({'where':{'id':_0x42f095[_0x5e21('0x4c')]['id']}})[_0x5e21('0x2c')](handleEntityNotFound(_0x2af006,null))[_0x5e21('0x2c')](function(_0x477f22){if(_0x477f22){_0x2cb5a4=_0x477f22;_0x5dcb4a[_0x5e21('0x38')]=_[_0x5e21('0x39')](db[_0x5e21('0x5c')][_0x5e21('0x59')]);_0x5dcb4a[_0x5e21('0x3a')]=_['keys'](_0x42f095['query']);_0x5dcb4a['filters']=_[_0x5e21('0x3c')](_0x5dcb4a[_0x5e21('0x38')],_0x5dcb4a['query']);_0x133d39[_0x5e21('0x3d')]=_[_0x5e21('0x3c')](_0x5dcb4a[_0x5e21('0x38')],qs[_0x5e21('0x3e')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x3e')]));_0x133d39[_0x5e21('0x3d')]=_0x133d39[_0x5e21('0x3d')][_0x5e21('0x3f')]?_0x133d39[_0x5e21('0x3d')]:_0x5dcb4a[_0x5e21('0x38')];_0x133d39['order']=qs[_0x5e21('0x41')](_0x42f095['query'][_0x5e21('0x41')]);_0x133d39['where']=qs[_0x5e21('0x3b')](_[_0x5e21('0x43')](_0x42f095[_0x5e21('0x3a')],_0x5dcb4a[_0x5e21('0x3b')]));if(_0x42f095[_0x5e21('0x3a')][_0x5e21('0x44')]){_0x133d39[_0x5e21('0x42')]=_[_0x5e21('0x45')](_0x133d39['where'],{'$or':_[_0x5e21('0x35')](_0x133d39[_0x5e21('0x3d')],function(_0x146e8a){var _0x3b44f4={};_0x3b44f4[_0x146e8a]={'$like':'%'+_0x42f095['query'][_0x5e21('0x44')]+'%'};return _0x3b44f4;})});}_0x133d39=_[_0x5e21('0x45')]({},_0x133d39,_0x42f095[_0x5e21('0x47')]);return _0x2cb5a4[_0x5e21('0x86')](_0x133d39);}})[_0x5e21('0x2c')](function(_0x4a12dc){if(_0x4a12dc){_0x16a772=_0x4a12dc['length'];if(!_0x42f095['query'][_0x5e21('0x5a')](_0x5e21('0x5b'))){_0x133d39[_0x5e21('0x24')]=qs[_0x5e21('0x24')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x24')]);_0x133d39['offset']=qs[_0x5e21('0x22')](_0x42f095[_0x5e21('0x3a')][_0x5e21('0x22')]);}return _0x2cb5a4[_0x5e21('0x86')](_0x133d39);}})[_0x5e21('0x2c')](function(_0x342ed8){if(_0x342ed8){return _0x342ed8?{'count':_0x16a772,'rows':_0x342ed8}:null;}})['then'](respondWithResult(_0x2af006,null))[_0x5e21('0x4e')](handleError(_0x2af006,null));}; \ No newline at end of file +var _0x57f6=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','online','interface','flatMap','Agents','sequelize','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','includes','compact','transaction','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','get','OpenchannelQueues','destroy','error','stack','name','map','OpenchannelQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x4be138,_0x27b964){var _0x47f3f8=function(_0x494fa3){while(--_0x494fa3){_0x4be138['push'](_0x4be138['shift']());}};_0x47f3f8(++_0x27b964);}(_0x57f6,0xd0));var _0x657f=function(_0x339d45,_0x5b91d4){_0x339d45=_0x339d45-0x0;var _0x5e4a60=_0x57f6[_0x339d45];return _0x5e4a60;};'use strict';var emlformat=require(_0x657f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x657f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x657f('0x2'));var moment=require(_0x657f('0x3'));var BPromise=require(_0x657f('0x4'));var Mustache=require(_0x657f('0x5'));var util=require(_0x657f('0x6'));var path=require(_0x657f('0x7'));var sox=require(_0x657f('0x8'));var csv=require('to-csv');var ejs=require(_0x657f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x657f('0xa'));var squel=require(_0x657f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x657f('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x657f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x657f('0xe'));var hardwareService=require(_0x657f('0xf'));var logger=require(_0x657f('0x10'))('api');var utils=require(_0x657f('0x11'));var config=require(_0x657f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x657f('0x13'))['db'];config[_0x657f('0x14')]=_['defaults'](config[_0x657f('0x14')],{'host':_0x657f('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x657f('0x14')]));require(_0x657f('0x16'))[_0x657f('0x17')](socket);function respondWithStatusCode(_0x532d8c,_0x3499ec){_0x3499ec=_0x3499ec||0xcc;return function(_0x49877b){if(_0x49877b){return _0x532d8c[_0x657f('0x18')](_0x3499ec);}return _0x532d8c[_0x657f('0x19')](_0x3499ec)[_0x657f('0x1a')]();};}function respondWithResult(_0x39fdb9,_0x28ec07){_0x28ec07=_0x28ec07||0xc8;return function(_0xb1d520){if(_0xb1d520){return _0x39fdb9['status'](_0x28ec07)[_0x657f('0x1b')](_0xb1d520);}};}function respondWithFilteredResult(_0x59258b,_0x146e18){return function(_0x2385c4){if(_0x2385c4){var _0xa15035=typeof _0x146e18['offset']==='undefined'&&typeof _0x146e18['limit']===_0x657f('0x1c');var _0x5217e3=_0x2385c4[_0x657f('0x1d')];var _0x2a2b32=_0xa15035?0x0:_0x146e18[_0x657f('0x1e')];var _0x98dcf5=_0xa15035?_0x2385c4['count']:_0x146e18[_0x657f('0x1e')]+_0x146e18[_0x657f('0x1f')];var _0x2e0b26;if(_0x98dcf5>=_0x5217e3){_0x98dcf5=_0x5217e3;_0x2e0b26=0xc8;}else{_0x2e0b26=0xce;}_0x59258b['status'](_0x2e0b26);return _0x59258b[_0x657f('0x20')](_0x657f('0x21'),_0x2a2b32+'-'+_0x98dcf5+'/'+_0x5217e3)[_0x657f('0x1b')](_0x2385c4);}return null;};}function patchUpdates(_0x55905f){return function(_0x110b8b){try{jsonpatch[_0x657f('0x22')](_0x110b8b,_0x55905f,!![]);}catch(_0x2076b7){return BPromise[_0x657f('0x23')](_0x2076b7);}return _0x110b8b['save']();};}function saveUpdates(_0x351bad,_0x4ff7c8){return function(_0x1e077a){if(_0x1e077a){return _0x1e077a['update'](_0x351bad)[_0x657f('0x24')](function(_0x526cbd){return _0x526cbd;});}return null;};}function removeEntity(_0xdb02fd,_0x527c2a){return function(_0x3c331f){if(_0x3c331f){return _0x3c331f['destroy']()[_0x657f('0x24')](function(){var _0xbe08a5=_0x3c331f[_0x657f('0x25')]({'plain':!![]});var _0x403781=_0x657f('0x26');return db['UserProfileResource'][_0x657f('0x27')]({'where':{'type':_0x403781,'resourceId':_0xbe08a5['id']}})[_0x657f('0x24')](function(){return _0x3c331f;});})[_0x657f('0x24')](function(){_0xdb02fd[_0x657f('0x19')](0xcc)[_0x657f('0x1a')]();});}};}function handleEntityNotFound(_0x59d1da,_0xca7dd5){return function(_0x32d248){if(!_0x32d248){_0x59d1da[_0x657f('0x18')](0x194);}return _0x32d248;};}function handleError(_0x4b29bb,_0x199d61){_0x199d61=_0x199d61||0x1f4;return function(_0x40dc23){logger[_0x657f('0x28')](_0x40dc23[_0x657f('0x29')]);if(_0x40dc23[_0x657f('0x2a')]){delete _0x40dc23[_0x657f('0x2a')];}_0x4b29bb[_0x657f('0x19')](_0x199d61)['send'](_0x40dc23);};}exports['index']=function(_0x574d4c,_0x4758e4){var _0x4300b4={},_0x2ab297={},_0x4aee48={'count':0x0,'rows':[]};var _0x192d99=_[_0x657f('0x2b')](db[_0x657f('0x2c')][_0x657f('0x2d')],function(_0x372ae6){return{'name':_0x372ae6['fieldName'],'type':_0x372ae6[_0x657f('0x2e')][_0x657f('0x2f')]};});_0x2ab297[_0x657f('0x30')]=_['map'](_0x192d99,_0x657f('0x2a'));_0x2ab297[_0x657f('0x31')]=_['keys'](_0x574d4c[_0x657f('0x31')]);_0x2ab297[_0x657f('0x32')]=_[_0x657f('0x33')](_0x2ab297['model'],_0x2ab297['query']);_0x4300b4[_0x657f('0x34')]=_[_0x657f('0x33')](_0x2ab297[_0x657f('0x30')],qs[_0x657f('0x35')](_0x574d4c[_0x657f('0x31')][_0x657f('0x35')]));_0x4300b4['attributes']=_0x4300b4[_0x657f('0x34')]['length']?_0x4300b4['attributes']:_0x2ab297[_0x657f('0x30')];if(!_0x574d4c[_0x657f('0x31')][_0x657f('0x36')](_0x657f('0x37'))){_0x4300b4[_0x657f('0x1f')]=qs[_0x657f('0x1f')](_0x574d4c[_0x657f('0x31')][_0x657f('0x1f')]);_0x4300b4[_0x657f('0x1e')]=qs[_0x657f('0x1e')](_0x574d4c['query'][_0x657f('0x1e')]);}_0x4300b4['order']=qs[_0x657f('0x38')](_0x574d4c[_0x657f('0x31')][_0x657f('0x38')]);_0x4300b4[_0x657f('0x39')]=qs['filters'](_[_0x657f('0x3a')](_0x574d4c[_0x657f('0x31')],_0x2ab297[_0x657f('0x32')]),_0x192d99);if(_0x574d4c[_0x657f('0x31')][_0x657f('0x3b')]){_0x4300b4[_0x657f('0x39')]=_[_0x657f('0x3c')](_0x4300b4[_0x657f('0x39')],{'$or':_[_0x657f('0x2b')](_0x192d99,function(_0x14dbc9){if(_0x14dbc9[_0x657f('0x2e')]!==_0x657f('0x3d')){var _0x3548f3={};_0x3548f3[_0x14dbc9[_0x657f('0x2a')]]={'$like':'%'+_0x574d4c[_0x657f('0x31')][_0x657f('0x3b')]+'%'};return _0x3548f3;}})});}_0x4300b4=_['merge']({},_0x4300b4,_0x574d4c[_0x657f('0x3e')]);var _0x24f18a={'where':_0x4300b4['where']};return db[_0x657f('0x2c')][_0x657f('0x1d')](_0x24f18a)[_0x657f('0x24')](function(_0x347309){_0x4aee48[_0x657f('0x1d')]=_0x347309;if(_0x574d4c['query'][_0x657f('0x3f')]){_0x4300b4[_0x657f('0x40')]=[{'all':!![]}];}return db[_0x657f('0x2c')][_0x657f('0x41')](_0x4300b4);})[_0x657f('0x24')](function(_0x2c110b){_0x4aee48['rows']=_0x2c110b;return _0x4aee48;})[_0x657f('0x24')](respondWithFilteredResult(_0x4758e4,_0x4300b4))[_0x657f('0x42')](handleError(_0x4758e4,null));};exports[_0x657f('0x43')]=function(_0x26efa8,_0x1561c1){var _0x43afa0={'raw':!![],'where':{'id':_0x26efa8[_0x657f('0x44')]['id']}},_0x193fdf={};_0x193fdf[_0x657f('0x30')]=_[_0x657f('0x45')](db[_0x657f('0x2c')]['rawAttributes']);_0x193fdf['query']=_[_0x657f('0x45')](_0x26efa8['query']);_0x193fdf['filters']=_[_0x657f('0x33')](_0x193fdf[_0x657f('0x30')],_0x193fdf[_0x657f('0x31')]);_0x43afa0[_0x657f('0x34')]=_[_0x657f('0x33')](_0x193fdf[_0x657f('0x30')],qs[_0x657f('0x35')](_0x26efa8[_0x657f('0x31')]['fields']));_0x43afa0[_0x657f('0x34')]=_0x43afa0[_0x657f('0x34')][_0x657f('0x46')]?_0x43afa0[_0x657f('0x34')]:_0x193fdf[_0x657f('0x30')];if(_0x26efa8['query'][_0x657f('0x3f')]){_0x43afa0[_0x657f('0x40')]=[{'all':!![]}];}_0x43afa0=_[_0x657f('0x3c')]({},_0x43afa0,_0x26efa8[_0x657f('0x3e')]);return db['OpenchannelQueue'][_0x657f('0x47')](_0x43afa0)[_0x657f('0x24')](handleEntityNotFound(_0x1561c1,null))[_0x657f('0x24')](respondWithResult(_0x1561c1,null))[_0x657f('0x42')](handleError(_0x1561c1,null));};exports[_0x657f('0x48')]=function(_0x539dc7,_0x677e4c){return db['OpenchannelQueue'][_0x657f('0x48')](_0x539dc7[_0x657f('0x49')],{})[_0x657f('0x24')](function(_0x264b7f){var _0x15e9b4=_0x539dc7[_0x657f('0x4a')][_0x657f('0x25')]({'plain':!![]});if(!_0x15e9b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15e9b4[_0x657f('0x4b')]===_0x657f('0x4a')){var _0x5cb580=_0x264b7f['get']({'plain':!![]});var _0x2869b3=_0x657f('0x26');return db[_0x657f('0x4c')][_0x657f('0x47')]({'where':{'name':_0x2869b3,'userProfileId':_0x15e9b4[_0x657f('0x4d')]},'raw':!![]})[_0x657f('0x24')](function(_0x1120f3){if(_0x1120f3&&_0x1120f3[_0x657f('0x4e')]===0x0){return db[_0x657f('0x4f')][_0x657f('0x48')]({'name':_0x5cb580[_0x657f('0x2a')],'resourceId':_0x5cb580['id'],'type':_0x1120f3[_0x657f('0x2a')],'sectionId':_0x1120f3['id']},{})[_0x657f('0x24')](function(){return _0x264b7f;});}else{return _0x264b7f;}})[_0x657f('0x42')](function(_0x5cd0b7){logger['error'](_0x657f('0x50'),_0x5cd0b7);throw _0x5cd0b7;});}return _0x264b7f;})[_0x657f('0x24')](respondWithResult(_0x677e4c,0xc9))['catch'](handleError(_0x677e4c,null));};exports['update']=function(_0xadf037,_0xa6f466){if(_0xadf037['body']['id']){delete _0xadf037['body']['id'];}return db[_0x657f('0x2c')][_0x657f('0x47')]({'where':{'id':_0xadf037[_0x657f('0x44')]['id']}})[_0x657f('0x24')](handleEntityNotFound(_0xa6f466,null))[_0x657f('0x24')](saveUpdates(_0xadf037[_0x657f('0x49')],null))[_0x657f('0x24')](respondWithResult(_0xa6f466,null))[_0x657f('0x42')](handleError(_0xa6f466,null));};exports['destroy']=function(_0x1ded90,_0x33a6f1){return db[_0x657f('0x2c')][_0x657f('0x47')]({'where':{'id':_0x1ded90['params']['id']}})[_0x657f('0x24')](handleEntityNotFound(_0x33a6f1,null))['then'](removeEntity(_0x33a6f1,null))[_0x657f('0x42')](handleError(_0x33a6f1,null));};exports['describe']=function(_0x1d7d2a,_0x315083){return db[_0x657f('0x2c')][_0x657f('0x51')]()[_0x657f('0x24')](respondWithResult(_0x315083,null))['catch'](handleError(_0x315083,null));};exports[_0x657f('0x52')]=function(_0x33317f,_0x161cef,_0x977836){var _0x1f0917={'raw':!![],'where':{}},_0x1a3179={},_0x1703ef;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x33317f[_0x657f('0x44')]['id']}})[_0x657f('0x24')](handleEntityNotFound(_0x161cef,null))[_0x657f('0x24')](function(_0x5a2471){if(_0x5a2471){_0x1703ef=_0x5a2471[_0x657f('0x25')]({'plain':!![]});_0x1a3179[_0x657f('0x30')]=_[_0x657f('0x45')](db[_0x657f('0x53')][_0x657f('0x2d')]);_0x1a3179[_0x657f('0x31')]=_['keys'](_0x33317f[_0x657f('0x31')]);_0x1a3179[_0x657f('0x32')]=_[_0x657f('0x33')](_0x1a3179[_0x657f('0x30')],_0x1a3179[_0x657f('0x31')]);_0x1f0917[_0x657f('0x34')]=_[_0x657f('0x33')](_0x1a3179['model'],qs['fields'](_0x33317f[_0x657f('0x31')][_0x657f('0x35')]));_0x1f0917[_0x657f('0x34')]=_0x1f0917[_0x657f('0x34')]['length']?_0x1f0917[_0x657f('0x34')]:_0x1a3179[_0x657f('0x30')];if(!_0x33317f[_0x657f('0x31')][_0x657f('0x36')]('nolimit')){_0x1f0917['limit']=qs['limit'](_0x33317f[_0x657f('0x31')][_0x657f('0x1f')]);_0x1f0917[_0x657f('0x1e')]=qs[_0x657f('0x1e')](_0x33317f[_0x657f('0x31')][_0x657f('0x1e')]);}_0x1f0917[_0x657f('0x54')]=qs['sort'](_0x33317f[_0x657f('0x31')][_0x657f('0x38')]);_0x1f0917['where']=qs[_0x657f('0x32')](_['pick'](_0x33317f['query'],_0x1a3179[_0x657f('0x32')]));_0x1f0917[_0x657f('0x39')][_0x657f('0x55')]=_0x5a2471['id'];if(_0x33317f[_0x657f('0x31')]['filter']){_0x1f0917[_0x657f('0x39')]=_[_0x657f('0x3c')](_0x1f0917[_0x657f('0x39')],{'$or':_[_0x657f('0x2b')](_0x1f0917[_0x657f('0x34')],function(_0x2a2fa6){var _0x2e0219={};_0x2e0219[_0x2a2fa6]={'$like':'%'+_0x33317f[_0x657f('0x31')]['filter']+'%'};return _0x2e0219;})});}_0x1f0917=_[_0x657f('0x3c')]({},_0x1f0917,_0x33317f[_0x657f('0x3e')]);return db[_0x657f('0x53')]['findAll'](_0x1f0917);}})['then'](function(_0x1162fe){if(_0x1162fe){return db[_0x657f('0x56')][_0x657f('0x57')]({'where':{'id':_[_0x657f('0x2b')](_0x1162fe,_0x657f('0x58')),'role':_0x657f('0x59')},'attributes':['id',_0x657f('0x2a'),_0x657f('0x5a'),'updatedAt',_0x657f('0x5b')]});}})[_0x657f('0x24')](function(_0x5d705c){if(_0x5d705c){return{'count':_0x5d705c['count'],'rows':_[_0x657f('0x2b')](_0x5d705c['rows'],function(_0x3ac1fe){return{'membername':_0x3ac1fe[_0x657f('0x2a')],'UserId':_0x3ac1fe['id'],'queue_name':_0x1703ef[_0x657f('0x2a')],'OpenchannelQueueId':_0x1703ef['id'],'interface':util[_0x657f('0x5c')](_0x657f('0x5d'),_0x657f('0x5e'),_0x3ac1fe[_0x657f('0x2a')]),'penalty':0x0,'paused':_0x3ac1fe[_0x657f('0x5a')],'createdAt':_0x3ac1fe['createdAt'],'updatedAt':_0x3ac1fe[_0x657f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x657f('0x24')](respondWithFilteredResult(_0x161cef,_0x1f0917))[_0x657f('0x42')](handleError(_0x161cef,null));};exports[_0x657f('0x60')]=function(_0x33000b,_0x42b9d8,_0x4ace57){var _0x54a7d8={};var _0x19c436={};var _0x16b02f;var _0x3ca6fc;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x33000b['params']['id']}})[_0x657f('0x24')](handleEntityNotFound(_0x42b9d8,null))[_0x657f('0x24')](function(_0x219dac){if(_0x219dac){_0x16b02f=_0x219dac;_0x19c436[_0x657f('0x30')]=_[_0x657f('0x45')](db[_0x657f('0x61')][_0x657f('0x2d')]);_0x19c436[_0x657f('0x31')]=_['keys'](_0x33000b[_0x657f('0x31')]);_0x19c436[_0x657f('0x32')]=_[_0x657f('0x33')](_0x19c436[_0x657f('0x30')],_0x19c436[_0x657f('0x31')]);_0x54a7d8[_0x657f('0x34')]=_['intersection'](_0x19c436['model'],qs[_0x657f('0x35')](_0x33000b[_0x657f('0x31')][_0x657f('0x35')]));_0x54a7d8[_0x657f('0x34')]=_0x54a7d8[_0x657f('0x34')][_0x657f('0x46')]?_0x54a7d8[_0x657f('0x34')]:_0x19c436[_0x657f('0x30')];_0x54a7d8[_0x657f('0x54')]=qs['sort'](_0x33000b[_0x657f('0x31')][_0x657f('0x38')]);_0x54a7d8[_0x657f('0x39')]=qs[_0x657f('0x32')](_[_0x657f('0x3a')](_0x33000b[_0x657f('0x31')],_0x19c436[_0x657f('0x32')]));if(_0x33000b[_0x657f('0x31')][_0x657f('0x3b')]){_0x54a7d8[_0x657f('0x39')]=_['merge'](_0x54a7d8['where'],{'$or':_[_0x657f('0x2b')](_0x54a7d8['attributes'],function(_0x5edabb){var _0x5e1bb6={};_0x5e1bb6[_0x5edabb]={'$like':'%'+_0x33000b[_0x657f('0x31')]['filter']+'%'};return _0x5e1bb6;})});}_0x54a7d8=_['merge']({},_0x54a7d8,_0x33000b[_0x657f('0x3e')]);return _0x16b02f['getTeams'](_0x54a7d8);}})['then'](function(_0x6733d){if(_0x6733d){_0x3ca6fc=_0x6733d['length'];if(!_0x33000b[_0x657f('0x31')][_0x657f('0x36')](_0x657f('0x37'))){_0x54a7d8[_0x657f('0x1f')]=qs['limit'](_0x33000b[_0x657f('0x31')][_0x657f('0x1f')]);_0x54a7d8[_0x657f('0x1e')]=qs[_0x657f('0x1e')](_0x33000b[_0x657f('0x31')][_0x657f('0x1e')]);}return _0x16b02f[_0x657f('0x60')](_0x54a7d8);}})[_0x657f('0x24')](function(_0x2cbbc6){if(_0x2cbbc6){return _0x2cbbc6?{'count':_0x3ca6fc,'rows':_0x2cbbc6}:null;}})[_0x657f('0x24')](respondWithResult(_0x42b9d8,null))['catch'](handleError(_0x42b9d8,null));};exports[_0x657f('0x62')]=function(_0x34a988,_0x57027c,_0x148d04){var _0x39e8fe=_0x34a988[_0x657f('0x49')]['ids'];return db[_0x657f('0x61')]['findAll']({'where':{'id':_0x39e8fe},'attributes':['id'],'include':[{'model':db[_0x657f('0x56')],'as':'Agents','attributes':['id','name',_0x657f('0x63'),'voicePause',_0x657f('0x64')],'raw':!![]}]})[_0x657f('0x24')](function(_0x4beb2e){if(_0x4beb2e){var _0x4ccd8b=_[_0x657f('0x65')](_0x4beb2e,function(_0x687e74){var _0x36e1c4=_0x687e74[_0x657f('0x25')]({'plain':!![]});return _0x36e1c4[_0x657f('0x66')];});return db['OpenchannelQueue'][_0x657f('0x47')]({'where':{'id':_0x34a988[_0x657f('0x44')]['id']}})[_0x657f('0x24')](function(_0x1d62aa){return db[_0x657f('0x67')]['transaction'](function(_0x5d5b15){return _0x1d62aa[_0x657f('0x62')](_0x39e8fe,{'transaction':_0x5d5b15})[_0x657f('0x24')](function(){return BPromise['each'](_0x4ccd8b,function(_0x574a3b){return db[_0x657f('0x53')][_0x657f('0x68')]({'where':{'UserId':_0x574a3b['id'],'OpenchannelQueueId':_0x34a988['params']['id']},'transaction':_0x5d5b15});});})[_0x657f('0x24')](function(){_0x4ccd8b[_0x657f('0x69')](function(_0x4721e4){socket[_0x657f('0x6a')]('userOpenchannelQueue:save',{'UserId':_0x4721e4['id'],'OpenchannelQueueId':_0x1d62aa['id']});});});});});}})['then'](respondWithStatusCode(_0x57027c,null))['catch'](handleError(_0x57027c,null));};exports[_0x657f('0x6b')]=function(_0x1ffb47,_0x2a10ff,_0x4c26ab){return db[_0x657f('0x61')][_0x657f('0x41')]({'where':{'id':_0x1ffb47['query'][_0x657f('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a10ff,null))['then'](function(_0x5b9c4a){var _0x539946=_[_0x657f('0x2b')](_0x5b9c4a,'id');var _0x19ef28=[];var _0x24022e=[];var _0xf06354=squel[_0x657f('0x6d')]();_0xf06354[_0x657f('0x6e')](_0x657f('0x6f'))[_0x657f('0x70')](_0x657f('0x71'),'tq')[_0x657f('0x72')](_0x657f('0x73'),'ut',_0x657f('0x74'))[_0x657f('0x39')]('OpenchannelQueueId\x20=\x20?',_0x1ffb47[_0x657f('0x44')]['id']);for(var _0x1c0838=0x0;_0x1c0838<_0x5b9c4a[_0x657f('0x46')];_0x1c0838+=0x1){let _0x174532=_0x5b9c4a[_0x1c0838];for(var _0x5d43f8=0x0;_0x5d43f8<_0x174532[_0x657f('0x66')][_0x657f('0x46')];_0x5d43f8+=0x1){let _0x64614d=_0x174532['Agents'][_0x5d43f8];var _0x208f37=_0xf06354[_0x657f('0x75')]();_0x208f37[_0x657f('0x39')]('ut.UserId\x20=\x20?',_0x64614d['id']);_0x24022e[_0x657f('0x76')](db[_0x657f('0x67')]['query'](_0x208f37['toString'](),{'type':db[_0x657f('0x67')][_0x657f('0x77')][_0x657f('0x78')]})['then'](function(_0x2d3a3d){if(_0x2d3a3d['length']===0x1){return _0x64614d['id'];}else{var _0x55d1b9=_['every'](_['map'](_0x2d3a3d,'TeamId'),function(_0x2284ca){return _[_0x657f('0x79')](_0x539946,_0x2284ca);});if(_0x55d1b9){return _0x64614d['id'];}}}));}}return BPromise['all'](_0x24022e)[_0x657f('0x24')](function(_0x4045d6){_0x19ef28=_(_0x19ef28)['union'](_0x4045d6)[_0x657f('0x7a')]()['value']();return db[_0x657f('0x2c')]['find']({'where':{'id':_0x1ffb47['params']['id']}})['then'](function(_0x1614b1){return db[_0x657f('0x67')][_0x657f('0x7b')](function(_0xfab5ce){return _0x1614b1[_0x657f('0x6b')](_0x1ffb47[_0x657f('0x31')][_0x657f('0x6c')],{'transaction':_0xfab5ce})[_0x657f('0x24')](function(){if(!_['isEmpty'](_0x19ef28)){return _0x1614b1['removeAgents'](_0x19ef28,{'transaction':_0xfab5ce});}})[_0x657f('0x24')](function(){_0x19ef28[_0x657f('0x69')](function(_0x1cbda8){socket[_0x657f('0x6a')](_0x657f('0x7c'),{'UserId':_0x1cbda8,'OpenchannelQueueId':_0x1614b1['id']});});});});});});})[_0x657f('0x24')](respondWithStatusCode(_0x2a10ff,null))[_0x657f('0x42')](handleError(_0x2a10ff,null));};exports['addAgents']=function(_0x2ea1aa,_0x36cb13,_0x829786){return db['OpenchannelQueue'][_0x657f('0x47')]({'where':{'id':_0x2ea1aa[_0x657f('0x44')]['id']}})[_0x657f('0x24')](handleEntityNotFound(_0x36cb13,null))['then'](function(_0x3e8a58){if(_0x3e8a58){return _0x3e8a58[_0x657f('0x7d')](_0x2ea1aa[_0x657f('0x49')]['ids'],_[_0x657f('0x7e')](_0x2ea1aa['body'],[_0x657f('0x6c'),'id'])||{})[_0x657f('0x7f')](function(_0x2d67a8){for(var _0x59bff8=0x0;_0x59bff8<_0x2ea1aa['body'][_0x657f('0x6c')][_0x657f('0x46')];_0x59bff8+=0x1){socket['emit'](_0x657f('0x80'),{'UserId':Number(_0x2ea1aa[_0x657f('0x49')]['ids'][_0x59bff8]),'OpenchannelQueueId':Number(_0x2ea1aa[_0x657f('0x44')]['id'])});}return _0x2d67a8;});}})[_0x657f('0x24')](respondWithResult(_0x36cb13,null))[_0x657f('0x42')](handleError(_0x36cb13,null));};exports['removeAgents']=function(_0xebb1bf,_0x3d67fc,_0x1b2f24){return db[_0x657f('0x2c')][_0x657f('0x47')]({'where':{'id':_0xebb1bf['params']['id']}})['then'](handleEntityNotFound(_0x3d67fc,null))[_0x657f('0x24')](function(_0x489e76){if(_0x489e76){return _0x489e76['removeAgents'](_0xebb1bf[_0x657f('0x31')][_0x657f('0x6c')])[_0x657f('0x24')](function(){if(_[_0x657f('0x81')](_0xebb1bf[_0x657f('0x31')]['ids'])){for(var _0x163290=0x0;_0x163290<_0xebb1bf[_0x657f('0x31')]['ids']['length'];_0x163290+=0x1){socket['emit'](_0x657f('0x7c'),{'UserId':Number(_0xebb1bf['query'][_0x657f('0x6c')][_0x163290]),'OpenchannelQueueId':Number(_0xebb1bf[_0x657f('0x44')]['id'])});}}else{socket['emit'](_0x657f('0x7c'),{'UserId':Number(_0xebb1bf[_0x657f('0x31')][_0x657f('0x6c')]),'OpenchannelQueueId':Number(_0xebb1bf[_0x657f('0x44')]['id'])});}});}})[_0x657f('0x24')](respondWithStatusCode(_0x3d67fc,null))[_0x657f('0x42')](handleError(_0x3d67fc,null));};exports[_0x657f('0x82')]=function(_0x395057,_0x3449eb,_0x168543){var _0x239c65={};var _0x2f11e8={};var _0x2f8973;var _0x9999b4;return db[_0x657f('0x2c')][_0x657f('0x83')]({'where':{'id':_0x395057[_0x657f('0x44')]['id']}})[_0x657f('0x24')](handleEntityNotFound(_0x3449eb,null))['then'](function(_0x4afe86){if(_0x4afe86){_0x2f8973=_0x4afe86;_0x2f11e8[_0x657f('0x30')]=_['keys'](db[_0x657f('0x56')]['rawAttributes']);_0x2f11e8['query']=_['keys'](_0x395057['query']);_0x2f11e8['filters']=_[_0x657f('0x33')](_0x2f11e8[_0x657f('0x30')],_0x2f11e8[_0x657f('0x31')]);_0x239c65['attributes']=_[_0x657f('0x33')](_0x2f11e8[_0x657f('0x30')],qs['fields'](_0x395057[_0x657f('0x31')][_0x657f('0x35')]));_0x239c65['attributes']=_0x239c65[_0x657f('0x34')][_0x657f('0x46')]?_0x239c65[_0x657f('0x34')]:_0x2f11e8[_0x657f('0x30')];_0x239c65['order']=qs[_0x657f('0x38')](_0x395057[_0x657f('0x31')][_0x657f('0x38')]);_0x239c65['where']=qs[_0x657f('0x32')](_['pick'](_0x395057[_0x657f('0x31')],_0x2f11e8[_0x657f('0x32')]));if(_0x395057['query']['filter']){_0x239c65[_0x657f('0x39')]=_[_0x657f('0x3c')](_0x239c65[_0x657f('0x39')],{'$or':_[_0x657f('0x2b')](_0x239c65['attributes'],function(_0x4d67bd){var _0x53e2a2={};_0x53e2a2[_0x4d67bd]={'$like':'%'+_0x395057[_0x657f('0x31')][_0x657f('0x3b')]+'%'};return _0x53e2a2;})});}_0x239c65=_['merge']({},_0x239c65,_0x395057[_0x657f('0x3e')]);return _0x2f8973[_0x657f('0x82')](_0x239c65);}})['then'](function(_0x14a243){if(_0x14a243){_0x9999b4=_0x14a243[_0x657f('0x46')];if(!_0x395057[_0x657f('0x31')][_0x657f('0x36')](_0x657f('0x37'))){_0x239c65[_0x657f('0x1f')]=qs['limit'](_0x395057['query'][_0x657f('0x1f')]);_0x239c65[_0x657f('0x1e')]=qs['offset'](_0x395057[_0x657f('0x31')][_0x657f('0x1e')]);}return _0x2f8973[_0x657f('0x82')](_0x239c65);}})[_0x657f('0x24')](function(_0x5b0c8b){if(_0x5b0c8b){return _0x5b0c8b?{'count':_0x9999b4,'rows':_0x5b0c8b}:null;}})[_0x657f('0x24')](respondWithResult(_0x3449eb,null))[_0x657f('0x42')](handleError(_0x3449eb,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 66eec1c..873fcbb 100644 --- a/server/api/openchannelQueue/openchannelQueue.events.js +++ b/server/api/openchannelQueue/openchannelQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6824=['update','remove','emit','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x258175,_0x55aac3){var _0x2a02fd=function(_0x61bace){while(--_0x61bace){_0x258175['push'](_0x258175['shift']());}};_0x2a02fd(++_0x55aac3);}(_0x6824,0x1ed));var _0x4682=function(_0x14696a,_0x469311){_0x14696a=_0x14696a-0x0;var _0x2cfd9d=_0x6824[_0x14696a];return _0x2cfd9d;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x4682('0x0'))['db'][_0x4682('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x4682('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4682('0x3'),'afterDestroy':_0x4682('0x4')};function emitEvent(_0x2554bd){return function(_0xf082eb,_0x1fbb5e,_0x261acb){OpenchannelQueueEvents['emit'](_0x2554bd+':'+_0xf082eb['id'],_0xf082eb);OpenchannelQueueEvents[_0x4682('0x5')](_0x2554bd,_0xf082eb);_0x261acb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x4682('0x6')](e,emitEvent(event));}}module[_0x4682('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x86b9=['setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x86b9,0x8d));var _0x986b=function(_0x105fff,_0x431893){_0x105fff=_0x105fff-0x0;var _0x279418=_0x86b9[_0x105fff];return _0x279418;};'use strict';var EventEmitter=require(_0x986b('0x0'));var OpenchannelQueue=require(_0x986b('0x1'))['db'][_0x986b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x986b('0x3')](0x0);var events={'afterCreate':_0x986b('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18d26e){return function(_0x375fb0,_0x5b8248,_0x4e795a){OpenchannelQueueEvents[_0x986b('0x5')](_0x18d26e+':'+_0x375fb0['id'],_0x375fb0);OpenchannelQueueEvents[_0x986b('0x5')](_0x18d26e,_0x375fb0);_0x4e795a(null);};}for(var e in events){if(events[_0x986b('0x6')](e)){var event=events[e];OpenchannelQueue[_0x986b('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d9f8e33..29c8e76 100644 --- a/server/api/openchannelQueue/openchannelQueue.model.js +++ b/server/api/openchannelQueue/openchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4a0=['bluebird','request-promise','rimraf','../../config/environment','exports','define','util','api'];(function(_0x55e87b,_0x4a3f46){var _0x3ab3e0=function(_0x81f4b6){while(--_0x81f4b6){_0x55e87b['push'](_0x55e87b['shift']());}};_0x3ab3e0(++_0x4a3f46);}(_0xe4a0,0x1be));var _0x0e4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe4a0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x0e4a('0x0'));var logger=require('../../config/logger')(_0x0e4a('0x1'));var moment=require('moment');var BPromise=require(_0x0e4a('0x2'));var rp=require(_0x0e4a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e4a('0x4'));var config=require(_0x0e4a('0x5'));var attributes=require('./openchannelQueue.attributes');module[_0x0e4a('0x6')]=function(_0x5331d6,_0x3ae0bb){return _0x5331d6[_0x0e4a('0x7')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0af6=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x0af6,0x1ae));var _0x60af=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x0af6[_0x4991d6];return _0x50faf7;};'use strict';var _=require(_0x60af('0x0'));var util=require(_0x60af('0x1'));var logger=require(_0x60af('0x2'))(_0x60af('0x3'));var moment=require(_0x60af('0x4'));var BPromise=require(_0x60af('0x5'));var rp=require(_0x60af('0x6'));var fs=require('fs');var path=require(_0x60af('0x7'));var rimraf=require(_0x60af('0x8'));var config=require(_0x60af('0x9'));var attributes=require(_0x60af('0xa'));module[_0x60af('0xb')]=function(_0x394730,_0x5676cc){return _0x394730[_0x60af('0xc')](_0x60af('0xd'),attributes,{'tableName':_0x60af('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6c1d835..7f37319 100644 --- a/server/api/openchannelQueue/openchannelQueue.rpc.js +++ b/server/api/openchannelQueue/openchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a23=['OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue'];(function(_0x46bd02,_0x3c73cc){var _0x2b0f33=function(_0x1e9b88){while(--_0x1e9b88){_0x46bd02['push'](_0x46bd02['shift']());}};_0x2b0f33(++_0x3c73cc);}(_0x4a23,0xda));var _0x34a2=function(_0xdbe3c0,_0x18d4b3){_0xdbe3c0=_0xdbe3c0-0x0;var _0x162603=_0x4a23[_0xdbe3c0];return _0x162603;};'use strict';var _=require(_0x34a2('0x0'));var util=require(_0x34a2('0x1'));var moment=require('moment');var BPromise=require(_0x34a2('0x2'));var rs=require(_0x34a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34a2('0x5'));var config=require(_0x34a2('0x6'));var jayson=require(_0x34a2('0x7'));var client=jayson[_0x34a2('0x8')][_0x34a2('0x9')]({'port':0x232a});config[_0x34a2('0xa')]=_[_0x34a2('0xb')](config[_0x34a2('0xa')],{'host':_0x34a2('0xc'),'port':0x18eb});var socket=require(_0x34a2('0xd'))(new Redis(config[_0x34a2('0xa')]));require(_0x34a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x4e3309,_0x552669,_0xb0748){return new BPromise(function(_0x3af308,_0x24cb77){return client[_0x34a2('0xf')](_0x4e3309,_0xb0748)[_0x34a2('0x10')](function(_0x296878){logger[_0x34a2('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x552669,_0x34a2('0x12'));logger[_0x34a2('0x13')](_0x34a2('0x14'),_0x552669,'request\x20sent',JSON['stringify'](_0x296878));if(_0x296878[_0x34a2('0x15')]){if(_0x296878[_0x34a2('0x15')][_0x34a2('0x16')]===0x1f4){logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x296878['error']['message']);return _0x24cb77(_0x296878[_0x34a2('0x15')][_0x34a2('0x18')]);}logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x296878[_0x34a2('0x15')][_0x34a2('0x18')]);return _0x3af308(_0x296878[_0x34a2('0x15')]['message']);}else{logger[_0x34a2('0x11')](_0x34a2('0x17'),_0x552669,_0x34a2('0x12'));_0x3af308(_0x296878[_0x34a2('0x19')][_0x34a2('0x18')]);}})[_0x34a2('0x1a')](function(_0x2bffd6){logger[_0x34a2('0x15')](_0x34a2('0x17'),_0x552669,_0x2bffd6);_0x24cb77(_0x2bffd6);});});}exports[_0x34a2('0x1b')]=function(_0x16edb7){var _0x993e3f=this;return new Promise(function(_0x1cbecc,_0x59447e){return db[_0x34a2('0x1c')][_0x34a2('0x1d')]({'raw':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7['options'][_0x34a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x16edb7['options']?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x20')]||null:null,'attributes':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7['options'][_0x34a2('0x21')]||null:null,'limit':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x22')]||null:null,'include':_0x16edb7[_0x34a2('0x1e')]?_0x16edb7[_0x34a2('0x1e')][_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x16edb7['options']['include'],function(_0x35f0c2){return{'model':db[_0x35f0c2[_0x34a2('0x25')]],'as':_0x35f0c2['as'],'attributes':_0x35f0c2[_0x34a2('0x21')],'include':_0x35f0c2[_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x35f0c2[_0x34a2('0x23')],function(_0x152970){return{'model':db[_0x152970[_0x34a2('0x25')]],'as':_0x152970['as'],'attributes':_0x152970[_0x34a2('0x21')],'include':_0x152970[_0x34a2('0x23')]?_[_0x34a2('0x24')](_0x152970[_0x34a2('0x23')],function(_0x288b77){return{'model':db[_0x288b77[_0x34a2('0x25')]],'as':_0x288b77['as'],'attributes':_0x288b77[_0x34a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x34a2('0x10')](function(_0x546d60){logger[_0x34a2('0x11')](_0x34a2('0x1b'),_0x16edb7);logger[_0x34a2('0x13')]('GetOpenchannelQueue',_0x16edb7,JSON[_0x34a2('0x26')](_0x546d60));_0x1cbecc(_0x546d60);})[_0x34a2('0x1a')](function(_0x239e6a){logger[_0x34a2('0x15')](_0x34a2('0x1b'),_0x239e6a[_0x34a2('0x18')],_0x16edb7);_0x59447e(_0x993e3f[_0x34a2('0x15')](0x1f4,_0x239e6a[_0x34a2('0x18')]));});});};exports[_0x34a2('0x27')]=function(_0x23dd5c){var _0x58a761=this;return new Promise(function(_0x1e8c15,_0x393d70){return db[_0x34a2('0x1c')][_0x34a2('0x28')]({'raw':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c['options'][_0x34a2('0x20')]||null:null,'attributes':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')][_0x34a2('0x21')]||null:null,'include':_0x23dd5c[_0x34a2('0x1e')]?_0x23dd5c[_0x34a2('0x1e')][_0x34a2('0x23')]?_['map'](_0x23dd5c['options'][_0x34a2('0x23')],function(_0x488e20){return{'model':db[_0x488e20[_0x34a2('0x25')]],'as':_0x488e20['as'],'attributes':_0x488e20['attributes'],'include':_0x488e20['include']?_[_0x34a2('0x24')](_0x488e20[_0x34a2('0x23')],function(_0x3d4c8b){return{'model':db[_0x3d4c8b[_0x34a2('0x25')]],'as':_0x3d4c8b['as'],'attributes':_0x3d4c8b[_0x34a2('0x21')],'include':_0x3d4c8b['include']?_['map'](_0x3d4c8b[_0x34a2('0x23')],function(_0x9a14b5){return{'model':db[_0x9a14b5[_0x34a2('0x25')]],'as':_0x9a14b5['as'],'attributes':_0x9a14b5[_0x34a2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x34a2('0x10')](function(_0x68cbe9){logger[_0x34a2('0x11')](_0x34a2('0x27'),_0x23dd5c);logger[_0x34a2('0x13')](_0x34a2('0x27'),_0x23dd5c,JSON[_0x34a2('0x26')](_0x68cbe9));_0x1e8c15(_0x68cbe9);})[_0x34a2('0x1a')](function(_0xcfae2d){logger[_0x34a2('0x15')]('ShowOpenchannelQueue',_0xcfae2d['message'],_0x23dd5c);_0x393d70(_0x58a761['error'](0x1f4,_0xcfae2d[_0x34a2('0x18')]));});});}; \ No newline at end of file +var _0x2435=['catch','findAll','options','where','limit','include','map','model','attributes','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x23082a,_0x445d35){var _0x4be541=function(_0xb3f462){while(--_0xb3f462){_0x23082a['push'](_0x23082a['shift']());}};_0x4be541(++_0x445d35);}(_0x2435,0x1ef));var _0x5243=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x2435[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x5243('0x0'));var util=require('util');var moment=require(_0x5243('0x1'));var BPromise=require('bluebird');var rs=require(_0x5243('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5243('0x3'))['db'];var utils=require(_0x5243('0x4'));var logger=require(_0x5243('0x5'))(_0x5243('0x6'));var config=require(_0x5243('0x7'));var jayson=require(_0x5243('0x8'));var client=jayson[_0x5243('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5243('0xa')]));require(_0x5243('0xb'))['register'](socket);function respondWithRpcPromise(_0x53b901,_0x379425,_0x589b8d){return new BPromise(function(_0x1bfd52,_0x5de979){return client[_0x5243('0xc')](_0x53b901,_0x589b8d)[_0x5243('0xd')](function(_0x11a1f5){logger['info'](_0x5243('0xe'),_0x379425,_0x5243('0xf'));logger[_0x5243('0x10')](_0x5243('0x11'),_0x379425,'request\x20sent',JSON[_0x5243('0x12')](_0x11a1f5));if(_0x11a1f5[_0x5243('0x13')]){if(_0x11a1f5[_0x5243('0x13')][_0x5243('0x14')]===0x1f4){logger[_0x5243('0x13')](_0x5243('0xe'),_0x379425,_0x11a1f5['error'][_0x5243('0x15')]);return _0x5de979(_0x11a1f5[_0x5243('0x13')][_0x5243('0x15')]);}logger['error'](_0x5243('0xe'),_0x379425,_0x11a1f5[_0x5243('0x13')][_0x5243('0x15')]);return _0x1bfd52(_0x11a1f5[_0x5243('0x13')][_0x5243('0x15')]);}else{logger['info'](_0x5243('0xe'),_0x379425,_0x5243('0xf'));_0x1bfd52(_0x11a1f5[_0x5243('0x16')][_0x5243('0x15')]);}})[_0x5243('0x17')](function(_0x15f276){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x379425,_0x15f276);_0x5de979(_0x15f276);});});}exports['GetOpenchannelQueue']=function(_0x51a0e3){var _0x5794c5=this;return new Promise(function(_0x24b02a,_0x411d52){return db['OpenchannelQueue'][_0x5243('0x18')]({'raw':_0x51a0e3['options']?_0x51a0e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x51a0e3[_0x5243('0x19')]?_0x51a0e3[_0x5243('0x19')][_0x5243('0x1a')]||null:null,'attributes':_0x51a0e3[_0x5243('0x19')]?_0x51a0e3['options']['attributes']||null:null,'limit':_0x51a0e3[_0x5243('0x19')]?_0x51a0e3[_0x5243('0x19')][_0x5243('0x1b')]||null:null,'include':_0x51a0e3[_0x5243('0x19')]?_0x51a0e3[_0x5243('0x19')][_0x5243('0x1c')]?_[_0x5243('0x1d')](_0x51a0e3[_0x5243('0x19')][_0x5243('0x1c')],function(_0x19762d){return{'model':db[_0x19762d['model']],'as':_0x19762d['as'],'attributes':_0x19762d['attributes'],'include':_0x19762d['include']?_['map'](_0x19762d['include'],function(_0x392689){return{'model':db[_0x392689[_0x5243('0x1e')]],'as':_0x392689['as'],'attributes':_0x392689['attributes'],'include':_0x392689[_0x5243('0x1c')]?_[_0x5243('0x1d')](_0x392689[_0x5243('0x1c')],function(_0x2675f4){return{'model':db[_0x2675f4[_0x5243('0x1e')]],'as':_0x2675f4['as'],'attributes':_0x2675f4[_0x5243('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xaccbc4){logger['info'](_0x5243('0x20'),_0x51a0e3);logger[_0x5243('0x10')](_0x5243('0x20'),_0x51a0e3,JSON[_0x5243('0x12')](_0xaccbc4));_0x24b02a(_0xaccbc4);})[_0x5243('0x17')](function(_0x444c4a){logger['error']('GetOpenchannelQueue',_0x444c4a[_0x5243('0x15')],_0x51a0e3);_0x411d52(_0x5794c5[_0x5243('0x13')](0x1f4,_0x444c4a[_0x5243('0x15')]));});});};exports[_0x5243('0x21')]=function(_0x3dcafd){var _0x567fbf=this;return new Promise(function(_0x12ebea,_0xb3aed2){return db[_0x5243('0x22')][_0x5243('0x23')]({'raw':_0x3dcafd[_0x5243('0x19')]?_0x3dcafd[_0x5243('0x19')][_0x5243('0x24')]===undefined?!![]:![]:!![],'where':_0x3dcafd[_0x5243('0x19')]?_0x3dcafd[_0x5243('0x19')][_0x5243('0x1a')]||null:null,'attributes':_0x3dcafd[_0x5243('0x19')]?_0x3dcafd['options'][_0x5243('0x1f')]||null:null,'include':_0x3dcafd[_0x5243('0x19')]?_0x3dcafd[_0x5243('0x19')]['include']?_[_0x5243('0x1d')](_0x3dcafd[_0x5243('0x19')][_0x5243('0x1c')],function(_0x115a18){return{'model':db[_0x115a18[_0x5243('0x1e')]],'as':_0x115a18['as'],'attributes':_0x115a18[_0x5243('0x1f')],'include':_0x115a18[_0x5243('0x1c')]?_[_0x5243('0x1d')](_0x115a18[_0x5243('0x1c')],function(_0x373186){return{'model':db[_0x373186['model']],'as':_0x373186['as'],'attributes':_0x373186['attributes'],'include':_0x373186['include']?_[_0x5243('0x1d')](_0x373186[_0x5243('0x1c')],function(_0x5bac5b){return{'model':db[_0x5bac5b[_0x5243('0x1e')]],'as':_0x5bac5b['as'],'attributes':_0x5bac5b[_0x5243('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5243('0xd')](function(_0x5ab199){logger['info'](_0x5243('0x21'),_0x3dcafd);logger['debug'](_0x5243('0x21'),_0x3dcafd,JSON[_0x5243('0x12')](_0x5ab199));_0x12ebea(_0x5ab199);})[_0x5243('0x17')](function(_0x2591f9){logger[_0x5243('0x13')](_0x5243('0x21'),_0x2591f9['message'],_0x3dcafd);_0xb3aed2(_0x567fbf[_0x5243('0x13')](0x1f4,_0x2591f9['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 19ba33d..6b5bb32 100644 --- a/server/api/openchannelQueue/openchannelQueue.socket.js +++ b/server/api/openchannelQueue/openchannelQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7b9=['update','removeListener','register','length','./openchannelQueue.events','save','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc7b9,0x6d));var _0x9c7b=function(_0xdd8cd6,_0x56b6b8){_0xdd8cd6=_0xdd8cd6-0x0;var _0x3bf99d=_0xc7b9[_0xdd8cd6];return _0x3bf99d;};'use strict';var OpenchannelQueueEvents=require(_0x9c7b('0x0'));var events=[_0x9c7b('0x1'),_0x9c7b('0x2'),_0x9c7b('0x3')];function createListener(_0x5ce65e,_0x3f8cf9){return function(_0x498823){_0x3f8cf9['emit'](_0x5ce65e,_0x498823);};}function removeListener(_0x16aff6,_0x56a9b0){return function(){OpenchannelQueueEvents[_0x9c7b('0x4')](_0x16aff6,_0x56a9b0);};}exports[_0x9c7b('0x5')]=function(_0x44332d){for(var _0x24b170=0x0,_0xf4a381=events[_0x9c7b('0x6')];_0x24b170<_0xf4a381;_0x24b170++){var _0x464b69=events[_0x24b170];var _0x507aa2=createListener('openchannelQueue:'+_0x464b69,_0x44332d);OpenchannelQueueEvents['on'](_0x464b69,_0x507aa2);}}; \ No newline at end of file +var _0xca17=['openchannelQueue:','./openchannelQueue.events','save','emit','removeListener','register'];(function(_0x340bb6,_0x533f63){var _0x1f2c27=function(_0xd85e9b){while(--_0xd85e9b){_0x340bb6['push'](_0x340bb6['shift']());}};_0x1f2c27(++_0x533f63);}(_0xca17,0x145));var _0x7ca1=function(_0x2dd615,_0x18099c){_0x2dd615=_0x2dd615-0x0;var _0x5255a4=_0xca17[_0x2dd615];return _0x5255a4;};'use strict';var OpenchannelQueueEvents=require(_0x7ca1('0x0'));var events=[_0x7ca1('0x1'),'remove','update'];function createListener(_0x2e9281,_0x2bf8e3){return function(_0x3cd5bb){_0x2bf8e3[_0x7ca1('0x2')](_0x2e9281,_0x3cd5bb);};}function removeListener(_0x3e5ee7,_0x533c46){return function(){OpenchannelQueueEvents[_0x7ca1('0x3')](_0x3e5ee7,_0x533c46);};}exports[_0x7ca1('0x4')]=function(_0x4e89ca){for(var _0x256953=0x0,_0xcdaa30=events['length'];_0x256953<_0xcdaa30;_0x256953++){var _0x4eb6be=events[_0x256953];var _0x41e28a=createListener(_0x7ca1('0x5')+_0x4eb6be,_0x4e89ca);OpenchannelQueueEvents['on'](_0x4eb6be,_0x41e28a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 526ff1f..6b57f62 100644 --- a/server/api/openchannelQueueReport/index.js +++ b/server/api/openchannelQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c10=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x2d5f36,_0xb24d71){var _0x910218=function(_0x1c71ba){while(--_0x1c71ba){_0x2d5f36['push'](_0x2d5f36['shift']());}};_0x910218(++_0xb24d71);}(_0x0c10,0x152));var _0x00c1=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0x0c10[_0x2ac4af];return _0x3a36df;};'use strict';var multer=require(_0x00c1('0x0'));var util=require(_0x00c1('0x1'));var path=require(_0x00c1('0x2'));var timeout=require(_0x00c1('0x3'));var express=require('express');var router=express[_0x00c1('0x4')]();var fs_extra=require(_0x00c1('0x5'));var auth=require(_0x00c1('0x6'));var interaction=require(_0x00c1('0x7'));var config=require(_0x00c1('0x8'));var controller=require(_0x00c1('0x9'));router[_0x00c1('0xa')]('/',auth[_0x00c1('0xb')](),controller[_0x00c1('0xc')]);router[_0x00c1('0xa')](_0x00c1('0xd'),auth[_0x00c1('0xb')](),controller[_0x00c1('0xe')]);router[_0x00c1('0xa')](_0x00c1('0xf'),auth['isAuthenticated'](),controller[_0x00c1('0x10')]);router['post']('/',auth[_0x00c1('0xb')](),controller[_0x00c1('0x11')]);router[_0x00c1('0x12')](_0x00c1('0xf'),auth[_0x00c1('0xb')](),controller['update']);router[_0x00c1('0x13')](_0x00c1('0xf'),auth[_0x00c1('0xb')](),controller['destroy']);module[_0x00c1('0x14')]=router; \ No newline at end of file +var _0xace5=['put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','/:id','post','create'];(function(_0x1ba28b,_0x1decb9){var _0x5a04ba=function(_0x2b9a65){while(--_0x2b9a65){_0x1ba28b['push'](_0x1ba28b['shift']());}};_0x5a04ba(++_0x1decb9);}(_0xace5,0x9b));var _0x5ace=function(_0x2158ee,_0x11a6cb){_0x2158ee=_0x2158ee-0x0;var _0x504e18=_0xace5[_0x2158ee];return _0x504e18;};'use strict';var multer=require(_0x5ace('0x0'));var util=require(_0x5ace('0x1'));var path=require(_0x5ace('0x2'));var timeout=require(_0x5ace('0x3'));var express=require(_0x5ace('0x4'));var router=express[_0x5ace('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5ace('0x6'));var config=require(_0x5ace('0x7'));var controller=require(_0x5ace('0x8'));router[_0x5ace('0x9')]('/',auth['isAuthenticated'](),controller[_0x5ace('0xa')]);router[_0x5ace('0x9')](_0x5ace('0xb'),auth[_0x5ace('0xc')](),controller['describe']);router['get'](_0x5ace('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5ace('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ace('0xf')]);router[_0x5ace('0x10')](_0x5ace('0xd'),auth[_0x5ace('0xc')](),controller[_0x5ace('0x11')]);router['delete'](_0x5ace('0xd'),auth[_0x5ace('0xc')](),controller['destroy']);module[_0x5ace('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 61f7865..64f4e7a 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a0b=['exports','STRING','DATE'];(function(_0x3fb1b9,_0x5ba4dd){var _0x2ae401=function(_0x5bd3a8){while(--_0x5bd3a8){_0x3fb1b9['push'](_0x3fb1b9['shift']());}};_0x2ae401(++_0x5ba4dd);}(_0x9a0b,0xff));var _0xb9a0=function(_0x120538,_0x3a2cbc){_0x120538=_0x120538-0x0;var _0x3186c0=_0x9a0b[_0x120538];return _0x3186c0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb9a0('0x0')]={'uniqueid':{'type':Sequelize[_0xb9a0('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb9a0('0x2')]},'leaveAt':{'type':Sequelize[_0xb9a0('0x2')]},'acceptAt':{'type':Sequelize[_0xb9a0('0x2')]},'exitAt':{'type':Sequelize[_0xb9a0('0x2')]},'reason':{'type':Sequelize[_0xb9a0('0x1')]}}; \ No newline at end of file +var _0x30ea=['STRING','DATE','exports'];(function(_0x5dca11,_0x3ab9d3){var _0x1addbe=function(_0x4e664f){while(--_0x4e664f){_0x5dca11['push'](_0x5dca11['shift']());}};_0x1addbe(++_0x3ab9d3);}(_0x30ea,0x13a));var _0xa30e=function(_0x134e04,_0x189e0d){_0x134e04=_0x134e04-0x0;var _0x4b74a2=_0x30ea[_0x134e04];return _0x4b74a2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xa30e('0x0')]={'uniqueid':{'type':Sequelize[_0xa30e('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa30e('0x2')]},'leaveAt':{'type':Sequelize[_0xa30e('0x2')]},'acceptAt':{'type':Sequelize[_0xa30e('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa30e('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 3c35dc4..769f9f6 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08d8=['apply','save','update','destroy','then','error','stack','name','index','map','OpenchannelQueueReport','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08d8,0x10d));var _0x808d=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0x08d8[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0x808d('0x0'));var rimraf=require(_0x808d('0x1'));var zipdir=require(_0x808d('0x2'));var jsonpatch=require(_0x808d('0x3'));var rp=require(_0x808d('0x4'));var moment=require(_0x808d('0x5'));var BPromise=require(_0x808d('0x6'));var Mustache=require(_0x808d('0x7'));var util=require(_0x808d('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x808d('0x9'));var ejs=require(_0x808d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x808d('0xb'));var crypto=require(_0x808d('0xc'));var jsforce=require(_0x808d('0xd'));var deskjs=require(_0x808d('0xe'));var toCsv=require(_0x808d('0x9'));var querystring=require(_0x808d('0xf'));var Papa=require(_0x808d('0x10'));var Redis=require(_0x808d('0x11'));var authService=require(_0x808d('0x12'));var qs=require(_0x808d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x808d('0x14'));var logger=require(_0x808d('0x15'))(_0x808d('0x16'));var utils=require('../../config/utils');var config=require(_0x808d('0x17'));var licenseUtil=require(_0x808d('0x18'));var db=require(_0x808d('0x19'))['db'];function respondWithStatusCode(_0x45db11,_0x345c55){_0x345c55=_0x345c55||0xcc;return function(_0x5ba3e5){if(_0x5ba3e5){return _0x45db11[_0x808d('0x1a')](_0x345c55);}return _0x45db11[_0x808d('0x1b')](_0x345c55)[_0x808d('0x1c')]();};}function respondWithResult(_0x567a3c,_0x56eab1){_0x56eab1=_0x56eab1||0xc8;return function(_0x3c97f2){if(_0x3c97f2){return _0x567a3c[_0x808d('0x1b')](_0x56eab1)[_0x808d('0x1d')](_0x3c97f2);}};}function respondWithFilteredResult(_0x3899f9,_0x5908f8){return function(_0x4b9b4c){if(_0x4b9b4c){var _0x28f3a4=typeof _0x5908f8[_0x808d('0x1e')]===_0x808d('0x1f')&&typeof _0x5908f8[_0x808d('0x20')]===_0x808d('0x1f');var _0x3888ba=_0x4b9b4c[_0x808d('0x21')];var _0x1604fc=_0x28f3a4?0x0:_0x5908f8[_0x808d('0x1e')];var _0x232297=_0x28f3a4?_0x4b9b4c[_0x808d('0x21')]:_0x5908f8[_0x808d('0x1e')]+_0x5908f8[_0x808d('0x20')];var _0x14247d;if(_0x232297>=_0x3888ba){_0x232297=_0x3888ba;_0x14247d=0xc8;}else{_0x14247d=0xce;}_0x3899f9['status'](_0x14247d);return _0x3899f9['set'](_0x808d('0x22'),_0x1604fc+'-'+_0x232297+'/'+_0x3888ba)[_0x808d('0x1d')](_0x4b9b4c);}return null;};}function patchUpdates(_0x4c7648){return function(_0x559188){try{jsonpatch[_0x808d('0x23')](_0x559188,_0x4c7648,!![]);}catch(_0x519a22){return BPromise['reject'](_0x519a22);}return _0x559188[_0x808d('0x24')]();};}function saveUpdates(_0x40757d,_0x221056){return function(_0x16f3cc){if(_0x16f3cc){return _0x16f3cc[_0x808d('0x25')](_0x40757d)['then'](function(_0x5a4aa6){return _0x5a4aa6;});}return null;};}function removeEntity(_0x57a183,_0x41dc47){return function(_0x3391cb){if(_0x3391cb){return _0x3391cb[_0x808d('0x26')]()[_0x808d('0x27')](function(){_0x57a183[_0x808d('0x1b')](0xcc)[_0x808d('0x1c')]();});}};}function handleEntityNotFound(_0x14883e,_0x492446){return function(_0x18537f){if(!_0x18537f){_0x14883e[_0x808d('0x1a')](0x194);}return _0x18537f;};}function handleError(_0xc54eaa,_0x3ab4f1){_0x3ab4f1=_0x3ab4f1||0x1f4;return function(_0x3d2e67){logger[_0x808d('0x28')](_0x3d2e67[_0x808d('0x29')]);if(_0x3d2e67[_0x808d('0x2a')]){delete _0x3d2e67['name'];}_0xc54eaa['status'](_0x3ab4f1)['send'](_0x3d2e67);};}exports[_0x808d('0x2b')]=function(_0x44262a,_0x2adb7a){var _0x16ab8f={},_0x1f26b3={},_0x48fa0a={'count':0x0,'rows':[]};var _0x3eb6d1=_[_0x808d('0x2c')](db[_0x808d('0x2d')]['rawAttributes'],function(_0x3a6a9e){return{'name':_0x3a6a9e[_0x808d('0x2e')],'type':_0x3a6a9e['type']['key']};});_0x1f26b3['model']=_[_0x808d('0x2c')](_0x3eb6d1,_0x808d('0x2a'));_0x1f26b3[_0x808d('0x2f')]=_[_0x808d('0x30')](_0x44262a[_0x808d('0x2f')]);_0x1f26b3[_0x808d('0x31')]=_[_0x808d('0x32')](_0x1f26b3[_0x808d('0x33')],_0x1f26b3[_0x808d('0x2f')]);_0x16ab8f[_0x808d('0x34')]=_[_0x808d('0x32')](_0x1f26b3['model'],qs['fields'](_0x44262a[_0x808d('0x2f')][_0x808d('0x35')]));_0x16ab8f['attributes']=_0x16ab8f[_0x808d('0x34')][_0x808d('0x36')]?_0x16ab8f[_0x808d('0x34')]:_0x1f26b3[_0x808d('0x33')];if(!_0x44262a[_0x808d('0x2f')][_0x808d('0x37')](_0x808d('0x38'))){_0x16ab8f[_0x808d('0x20')]=qs[_0x808d('0x20')](_0x44262a[_0x808d('0x2f')][_0x808d('0x20')]);_0x16ab8f[_0x808d('0x1e')]=qs[_0x808d('0x1e')](_0x44262a[_0x808d('0x2f')][_0x808d('0x1e')]);}_0x16ab8f['order']=qs[_0x808d('0x39')](_0x44262a[_0x808d('0x2f')]['sort']);_0x16ab8f['where']=qs[_0x808d('0x31')](_[_0x808d('0x3a')](_0x44262a[_0x808d('0x2f')],_0x1f26b3[_0x808d('0x31')]),_0x3eb6d1);if(_0x44262a[_0x808d('0x2f')]['filter']){_0x16ab8f[_0x808d('0x3b')]=_[_0x808d('0x3c')](_0x16ab8f[_0x808d('0x3b')],{'$or':_['map'](_0x3eb6d1,function(_0x439b88){if(_0x439b88[_0x808d('0x3d')]!=='VIRTUAL'){var _0x5aa651={};_0x5aa651[_0x439b88[_0x808d('0x2a')]]={'$like':'%'+_0x44262a['query'][_0x808d('0x3e')]+'%'};return _0x5aa651;}})});}_0x16ab8f=_[_0x808d('0x3c')]({},_0x16ab8f,_0x44262a[_0x808d('0x3f')]);var _0x1c5ccf={'where':_0x16ab8f[_0x808d('0x3b')]};return db[_0x808d('0x2d')][_0x808d('0x21')](_0x1c5ccf)[_0x808d('0x27')](function(_0x51ceb8){_0x48fa0a[_0x808d('0x21')]=_0x51ceb8;if(_0x44262a['query']['includeAll']){_0x16ab8f[_0x808d('0x40')]=[{'all':!![]}];}return db[_0x808d('0x2d')][_0x808d('0x41')](_0x16ab8f);})[_0x808d('0x27')](function(_0x2f05bf){_0x48fa0a[_0x808d('0x42')]=_0x2f05bf;return _0x48fa0a;})[_0x808d('0x27')](respondWithFilteredResult(_0x2adb7a,_0x16ab8f))[_0x808d('0x43')](handleError(_0x2adb7a,null));};exports[_0x808d('0x44')]=function(_0x5c6e4f,_0x5d9802){var _0x1bcc49={'raw':!![],'where':{'id':_0x5c6e4f[_0x808d('0x45')]['id']}},_0x3e95a9={};_0x3e95a9[_0x808d('0x33')]=_['keys'](db[_0x808d('0x2d')][_0x808d('0x46')]);_0x3e95a9[_0x808d('0x2f')]=_[_0x808d('0x30')](_0x5c6e4f[_0x808d('0x2f')]);_0x3e95a9['filters']=_[_0x808d('0x32')](_0x3e95a9[_0x808d('0x33')],_0x3e95a9['query']);_0x1bcc49[_0x808d('0x34')]=_[_0x808d('0x32')](_0x3e95a9[_0x808d('0x33')],qs['fields'](_0x5c6e4f[_0x808d('0x2f')]['fields']));_0x1bcc49[_0x808d('0x34')]=_0x1bcc49[_0x808d('0x34')][_0x808d('0x36')]?_0x1bcc49['attributes']:_0x3e95a9[_0x808d('0x33')];if(_0x5c6e4f[_0x808d('0x2f')][_0x808d('0x47')]){_0x1bcc49[_0x808d('0x40')]=[{'all':!![]}];}_0x1bcc49=_[_0x808d('0x3c')]({},_0x1bcc49,_0x5c6e4f[_0x808d('0x3f')]);return db[_0x808d('0x2d')][_0x808d('0x48')](_0x1bcc49)['then'](handleEntityNotFound(_0x5d9802,null))[_0x808d('0x27')](respondWithResult(_0x5d9802,null))[_0x808d('0x43')](handleError(_0x5d9802,null));};exports[_0x808d('0x49')]=function(_0x1b216b,_0x180cb3){return db[_0x808d('0x2d')][_0x808d('0x49')](_0x1b216b[_0x808d('0x4a')],{})[_0x808d('0x27')](respondWithResult(_0x180cb3,0xc9))[_0x808d('0x43')](handleError(_0x180cb3,null));};exports[_0x808d('0x25')]=function(_0x3bbfdd,_0x10d7fc){if(_0x3bbfdd[_0x808d('0x4a')]['id']){delete _0x3bbfdd[_0x808d('0x4a')]['id'];}return db[_0x808d('0x2d')][_0x808d('0x48')]({'where':{'id':_0x3bbfdd[_0x808d('0x45')]['id']}})['then'](handleEntityNotFound(_0x10d7fc,null))[_0x808d('0x27')](saveUpdates(_0x3bbfdd[_0x808d('0x4a')],null))[_0x808d('0x27')](respondWithResult(_0x10d7fc,null))[_0x808d('0x43')](handleError(_0x10d7fc,null));};exports[_0x808d('0x26')]=function(_0x258a35,_0x2b636d){return db[_0x808d('0x2d')][_0x808d('0x48')]({'where':{'id':_0x258a35[_0x808d('0x45')]['id']}})[_0x808d('0x27')](handleEntityNotFound(_0x2b636d,null))[_0x808d('0x27')](removeEntity(_0x2b636d,null))[_0x808d('0x43')](handleError(_0x2b636d,null));};exports[_0x808d('0x4b')]=function(_0x590b3d,_0x2897cf){return db[_0x808d('0x2d')][_0x808d('0x4b')]()[_0x808d('0x27')](respondWithResult(_0x2897cf,null))[_0x808d('0x43')](handleError(_0x2897cf,null));}; \ No newline at end of file +var _0x067a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','end','stack','name','send','OpenchannelQueueReport','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','params','describe','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xc861f6,_0x3a9d8b){var _0xd3f991=function(_0x136021){while(--_0x136021){_0xc861f6['push'](_0xc861f6['shift']());}};_0xd3f991(++_0x3a9d8b);}(_0x067a,0x152));var _0xa067=function(_0x20fb59,_0x2eb020){_0x20fb59=_0x20fb59-0x0;var _0x49c881=_0x067a[_0x20fb59];return _0x49c881;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa067('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xa067('0x1'));var util=require(_0xa067('0x2'));var path=require(_0xa067('0x3'));var sox=require(_0xa067('0x4'));var csv=require(_0xa067('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa067('0x6'));var _=require('lodash');var squel=require(_0xa067('0x7'));var crypto=require(_0xa067('0x8'));var jsforce=require(_0xa067('0x9'));var deskjs=require(_0xa067('0xa'));var toCsv=require(_0xa067('0x5'));var querystring=require('querystring');var Papa=require(_0xa067('0xb'));var Redis=require(_0xa067('0xc'));var authService=require(_0xa067('0xd'));var qs=require(_0xa067('0xe'));var as=require(_0xa067('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa067('0x10'))(_0xa067('0x11'));var utils=require(_0xa067('0x12'));var config=require(_0xa067('0x13'));var licenseUtil=require(_0xa067('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda1f6e,_0x11325b){_0x11325b=_0x11325b||0xcc;return function(_0x1a45d3){if(_0x1a45d3){return _0xda1f6e[_0xa067('0x15')](_0x11325b);}return _0xda1f6e[_0xa067('0x16')](_0x11325b)['end']();};}function respondWithResult(_0x124ecf,_0x24cd98){_0x24cd98=_0x24cd98||0xc8;return function(_0x528251){if(_0x528251){return _0x124ecf[_0xa067('0x16')](_0x24cd98)['json'](_0x528251);}};}function respondWithFilteredResult(_0x141dca,_0x4d06d4){return function(_0x3791a0){if(_0x3791a0){var _0x1e8cce=typeof _0x4d06d4[_0xa067('0x17')]===_0xa067('0x18')&&typeof _0x4d06d4[_0xa067('0x19')]===_0xa067('0x18');var _0x2f5810=_0x3791a0[_0xa067('0x1a')];var _0x164a14=_0x1e8cce?0x0:_0x4d06d4[_0xa067('0x17')];var _0x848e65=_0x1e8cce?_0x3791a0['count']:_0x4d06d4[_0xa067('0x17')]+_0x4d06d4[_0xa067('0x19')];var _0x114e15;if(_0x848e65>=_0x2f5810){_0x848e65=_0x2f5810;_0x114e15=0xc8;}else{_0x114e15=0xce;}_0x141dca[_0xa067('0x16')](_0x114e15);return _0x141dca[_0xa067('0x1b')](_0xa067('0x1c'),_0x164a14+'-'+_0x848e65+'/'+_0x2f5810)[_0xa067('0x1d')](_0x3791a0);}return null;};}function patchUpdates(_0xccf45e){return function(_0x34a963){try{jsonpatch['apply'](_0x34a963,_0xccf45e,!![]);}catch(_0x332d2d){return BPromise[_0xa067('0x1e')](_0x332d2d);}return _0x34a963['save']();};}function saveUpdates(_0x27d3c6,_0x4eaeeb){return function(_0x223f9d){if(_0x223f9d){return _0x223f9d[_0xa067('0x1f')](_0x27d3c6)['then'](function(_0x276369){return _0x276369;});}return null;};}function removeEntity(_0x581f83,_0x3b58bb){return function(_0x5261c3){if(_0x5261c3){return _0x5261c3[_0xa067('0x20')]()[_0xa067('0x21')](function(){_0x581f83[_0xa067('0x16')](0xcc)[_0xa067('0x22')]();});}};}function handleEntityNotFound(_0x4e5e70,_0x5f4569){return function(_0x5eb1a9){if(!_0x5eb1a9){_0x4e5e70['sendStatus'](0x194);}return _0x5eb1a9;};}function handleError(_0x50c89e,_0x879540){_0x879540=_0x879540||0x1f4;return function(_0x478b7b){logger['error'](_0x478b7b[_0xa067('0x23')]);if(_0x478b7b[_0xa067('0x24')]){delete _0x478b7b[_0xa067('0x24')];}_0x50c89e[_0xa067('0x16')](_0x879540)[_0xa067('0x25')](_0x478b7b);};}exports['index']=function(_0x50fc7e,_0x3b593){var _0x14a9c8={},_0x3bfeac={},_0x496ffe={'count':0x0,'rows':[]};var _0x4b44c1=_['map'](db[_0xa067('0x26')]['rawAttributes'],function(_0x3cb434){return{'name':_0x3cb434[_0xa067('0x27')],'type':_0x3cb434[_0xa067('0x28')][_0xa067('0x29')]};});_0x3bfeac[_0xa067('0x2a')]=_[_0xa067('0x2b')](_0x4b44c1,_0xa067('0x24'));_0x3bfeac[_0xa067('0x2c')]=_['keys'](_0x50fc7e[_0xa067('0x2c')]);_0x3bfeac[_0xa067('0x2d')]=_['intersection'](_0x3bfeac[_0xa067('0x2a')],_0x3bfeac[_0xa067('0x2c')]);_0x14a9c8[_0xa067('0x2e')]=_[_0xa067('0x2f')](_0x3bfeac['model'],qs[_0xa067('0x30')](_0x50fc7e[_0xa067('0x2c')][_0xa067('0x30')]));_0x14a9c8[_0xa067('0x2e')]=_0x14a9c8[_0xa067('0x2e')][_0xa067('0x31')]?_0x14a9c8[_0xa067('0x2e')]:_0x3bfeac[_0xa067('0x2a')];if(!_0x50fc7e[_0xa067('0x2c')][_0xa067('0x32')]('nolimit')){_0x14a9c8[_0xa067('0x19')]=qs[_0xa067('0x19')](_0x50fc7e[_0xa067('0x2c')]['limit']);_0x14a9c8[_0xa067('0x17')]=qs[_0xa067('0x17')](_0x50fc7e[_0xa067('0x2c')][_0xa067('0x17')]);}_0x14a9c8[_0xa067('0x33')]=qs[_0xa067('0x34')](_0x50fc7e[_0xa067('0x2c')][_0xa067('0x34')]);_0x14a9c8[_0xa067('0x35')]=qs[_0xa067('0x2d')](_[_0xa067('0x36')](_0x50fc7e[_0xa067('0x2c')],_0x3bfeac[_0xa067('0x2d')]),_0x4b44c1);if(_0x50fc7e[_0xa067('0x2c')][_0xa067('0x37')]){_0x14a9c8['where']=_['merge'](_0x14a9c8['where'],{'$or':_['map'](_0x4b44c1,function(_0x2aa9da){if(_0x2aa9da['type']!=='VIRTUAL'){var _0x5db3fc={};_0x5db3fc[_0x2aa9da['name']]={'$like':'%'+_0x50fc7e[_0xa067('0x2c')]['filter']+'%'};return _0x5db3fc;}})});}_0x14a9c8=_[_0xa067('0x38')]({},_0x14a9c8,_0x50fc7e[_0xa067('0x39')]);var _0x3f1c96={'where':_0x14a9c8['where']};return db[_0xa067('0x26')][_0xa067('0x1a')](_0x3f1c96)[_0xa067('0x21')](function(_0x18828c){_0x496ffe['count']=_0x18828c;if(_0x50fc7e[_0xa067('0x2c')][_0xa067('0x3a')]){_0x14a9c8[_0xa067('0x3b')]=[{'all':!![]}];}return db[_0xa067('0x26')][_0xa067('0x3c')](_0x14a9c8);})[_0xa067('0x21')](function(_0x18e256){_0x496ffe[_0xa067('0x3d')]=_0x18e256;return _0x496ffe;})[_0xa067('0x21')](respondWithFilteredResult(_0x3b593,_0x14a9c8))[_0xa067('0x3e')](handleError(_0x3b593,null));};exports['show']=function(_0x1d39ab,_0x491a25){var _0x281ed1={'raw':!![],'where':{'id':_0x1d39ab['params']['id']}},_0x41ad1c={};_0x41ad1c[_0xa067('0x2a')]=_[_0xa067('0x3f')](db[_0xa067('0x26')][_0xa067('0x40')]);_0x41ad1c[_0xa067('0x2c')]=_['keys'](_0x1d39ab[_0xa067('0x2c')]);_0x41ad1c['filters']=_['intersection'](_0x41ad1c[_0xa067('0x2a')],_0x41ad1c[_0xa067('0x2c')]);_0x281ed1[_0xa067('0x2e')]=_[_0xa067('0x2f')](_0x41ad1c[_0xa067('0x2a')],qs[_0xa067('0x30')](_0x1d39ab['query'][_0xa067('0x30')]));_0x281ed1[_0xa067('0x2e')]=_0x281ed1[_0xa067('0x2e')][_0xa067('0x31')]?_0x281ed1[_0xa067('0x2e')]:_0x41ad1c[_0xa067('0x2a')];if(_0x1d39ab[_0xa067('0x2c')][_0xa067('0x3a')]){_0x281ed1[_0xa067('0x3b')]=[{'all':!![]}];}_0x281ed1=_[_0xa067('0x38')]({},_0x281ed1,_0x1d39ab[_0xa067('0x39')]);return db['OpenchannelQueueReport'][_0xa067('0x41')](_0x281ed1)[_0xa067('0x21')](handleEntityNotFound(_0x491a25,null))[_0xa067('0x21')](respondWithResult(_0x491a25,null))[_0xa067('0x3e')](handleError(_0x491a25,null));};exports['create']=function(_0x36d6fc,_0x25c4a5){return db[_0xa067('0x26')][_0xa067('0x42')](_0x36d6fc[_0xa067('0x43')],{})[_0xa067('0x21')](respondWithResult(_0x25c4a5,0xc9))[_0xa067('0x3e')](handleError(_0x25c4a5,null));};exports[_0xa067('0x1f')]=function(_0x24c774,_0x448379){if(_0x24c774[_0xa067('0x43')]['id']){delete _0x24c774[_0xa067('0x43')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x24c774[_0xa067('0x44')]['id']}})[_0xa067('0x21')](handleEntityNotFound(_0x448379,null))[_0xa067('0x21')](saveUpdates(_0x24c774[_0xa067('0x43')],null))[_0xa067('0x21')](respondWithResult(_0x448379,null))[_0xa067('0x3e')](handleError(_0x448379,null));};exports[_0xa067('0x20')]=function(_0x55c2c0,_0xd40afb){return db[_0xa067('0x26')][_0xa067('0x41')]({'where':{'id':_0x55c2c0['params']['id']}})['then'](handleEntityNotFound(_0xd40afb,null))['then'](removeEntity(_0xd40afb,null))[_0xa067('0x3e')](handleError(_0xd40afb,null));};exports['describe']=function(_0x564f94,_0x2dbec6){return db[_0xa067('0x26')][_0xa067('0x45')]()[_0xa067('0x21')](respondWithResult(_0x2dbec6,null))[_0xa067('0x3e')](handleError(_0x2dbec6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index eb3c5a9..7cdcf4c 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x363511,_0x209b25){var _0x404c72=function(_0x368f80){while(--_0x368f80){_0x363511['push'](_0x363511['shift']());}};_0x404c72(++_0x209b25);}(_0x1261,0x144));var _0x1126=function(_0x27a5bb,_0x3f4cfb){_0x27a5bb=_0x27a5bb-0x0;var _0x2e17ea=_0x1261[_0x27a5bb];return _0x2e17ea;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x2b118d,_0x40e9e9){var _0x31d80b=function(_0x2c1071){while(--_0x2c1071){_0x2b118d['push'](_0x2b118d['shift']());}};_0x31d80b(++_0x40e9e9);}(_0xe14b,0x93));var _0xbe14=function(_0x4a4ee9,_0x207195){_0x4a4ee9=_0x4a4ee9-0x0;var _0x3923c2=_0xe14b[_0x4a4ee9];return _0x3923c2;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index a1658ac..006e75f 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfff0=['../../config/environment','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','update','where','attributes','limit','info','UpdateOpenchannelQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1ce859,_0x46401e){var _0x2150f5=function(_0x51b6cf){while(--_0x51b6cf){_0x1ce859['push'](_0x1ce859['shift']());}};_0x2150f5(++_0x46401e);}(_0xfff0,0x139));var _0x0fff=function(_0x114b2b,_0x6b7d2f){_0x114b2b=_0x114b2b-0x0;var _0x36db44=_0xfff0[_0x114b2b];return _0x36db44;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f1d2b,_0x586dc5,_0x24cfb0){return new BPromise(function(_0x5e9672,_0x1f2658){return client['request'](_0x2f1d2b,_0x24cfb0)[_0x0fff('0xa')](function(_0x3db6f6){logger['info'](_0x0fff('0xb'),_0x586dc5,_0x0fff('0xc'));logger[_0x0fff('0xd')](_0x0fff('0xe'),_0x586dc5,_0x0fff('0xc'),JSON[_0x0fff('0xf')](_0x3db6f6));if(_0x3db6f6[_0x0fff('0x10')]){if(_0x3db6f6[_0x0fff('0x10')][_0x0fff('0x11')]===0x1f4){logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6['error'][_0x0fff('0x12')]);return _0x1f2658(_0x3db6f6['error'][_0x0fff('0x12')]);}logger[_0x0fff('0x10')](_0x0fff('0xb'),_0x586dc5,_0x3db6f6[_0x0fff('0x10')]['message']);return _0x5e9672(_0x3db6f6['error'][_0x0fff('0x12')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,'request\x20sent');_0x5e9672(_0x3db6f6[_0x0fff('0x13')][_0x0fff('0x12')]);}})['catch'](function(_0x431b33){logger[_0x0fff('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x586dc5,_0x431b33);_0x1f2658(_0x431b33);});});}exports['CreateOpenchannelQueueReport']=function(_0x48f36d){var _0x2337f=this;return new Promise(function(_0x606792,_0x46a02d){return db[_0x0fff('0x14')][_0x0fff('0x15')](_0x48f36d[_0x0fff('0x16')],{'raw':_0x48f36d['options']?_0x48f36d[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![]})[_0x0fff('0xa')](function(_0x49d211){logger['info'](_0x0fff('0x19'),_0x48f36d);logger[_0x0fff('0xd')](_0x0fff('0x19'),_0x48f36d,JSON[_0x0fff('0xf')](_0x49d211));_0x606792(_0x49d211);})['catch'](function(_0x155132){logger[_0x0fff('0x10')](_0x0fff('0x19'),_0x155132[_0x0fff('0x12')],_0x48f36d);_0x46a02d(_0x2337f[_0x0fff('0x10')](0x1f4,_0x155132[_0x0fff('0x12')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x6a116c){var _0x29f702=this;return new Promise(function(_0x37e090,_0x24cd18){return db[_0x0fff('0x14')][_0x0fff('0x1a')](_0x6a116c['body'],{'raw':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1b')]||null:null,'attributes':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1c')]||null:null,'limit':_0x6a116c[_0x0fff('0x17')]?_0x6a116c[_0x0fff('0x17')][_0x0fff('0x1d')]||null:null})['then'](function(_0x7046a3){logger[_0x0fff('0x1e')](_0x0fff('0x1f'),_0x6a116c);logger[_0x0fff('0xd')](_0x0fff('0x1f'),_0x6a116c,JSON[_0x0fff('0xf')](_0x7046a3));_0x37e090(_0x7046a3);})['catch'](function(_0x31f9a4){logger[_0x0fff('0x10')](_0x0fff('0x1f'),_0x31f9a4['message'],_0x6a116c);_0x24cd18(_0x29f702[_0x0fff('0x10')](0x1f4,_0x31f9a4[_0x0fff('0x12')]));});});}; \ No newline at end of file +var _0x777d=['CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','UpdateOpenchannelQueueReport','body','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x5b21cf,_0x5bc714){var _0x619c9b=function(_0x2e3bec){while(--_0x2e3bec){_0x5b21cf['push'](_0x5b21cf['shift']());}};_0x619c9b(++_0x5bc714);}(_0x777d,0xe9));var _0xd777=function(_0xefb4e,_0xe56689){_0xefb4e=_0xefb4e-0x0;var _0x36c78c=_0x777d[_0xefb4e];return _0x36c78c;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd777('0x3'));var db=require(_0xd777('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd777('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd777('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7c954,_0x5d1a5f,_0x57d67f){return new BPromise(function(_0x49d55d,_0x197296){return client[_0xd777('0x7')](_0xc7c954,_0x57d67f)[_0xd777('0x8')](function(_0x25450d){logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));logger[_0xd777('0xc')](_0xd777('0xd'),_0x5d1a5f,_0xd777('0xb'),JSON[_0xd777('0xe')](_0x25450d));if(_0x25450d[_0xd777('0xf')]){if(_0x25450d[_0xd777('0xf')]['code']===0x1f4){logger['error'](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x197296(_0x25450d[_0xd777('0xf')][_0xd777('0x10')]);}logger[_0xd777('0xf')](_0xd777('0xa'),_0x5d1a5f,_0x25450d['error'][_0xd777('0x10')]);return _0x49d55d(_0x25450d['error'][_0xd777('0x10')]);}else{logger[_0xd777('0x9')](_0xd777('0xa'),_0x5d1a5f,_0xd777('0xb'));_0x49d55d(_0x25450d[_0xd777('0x11')]['message']);}})[_0xd777('0x12')](function(_0x4b3d52){logger[_0xd777('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5d1a5f,_0x4b3d52);_0x197296(_0x4b3d52);});});}exports[_0xd777('0x13')]=function(_0x386f1a){var _0x2dd8ec=this;return new Promise(function(_0x13b63b,_0x2c6114){return db[_0xd777('0x14')]['create'](_0x386f1a['body'],{'raw':_0x386f1a[_0xd777('0x15')]?_0x386f1a['options'][_0xd777('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x58a079){logger['info'](_0xd777('0x13'),_0x386f1a);logger['debug']('CreateOpenchannelQueueReport',_0x386f1a,JSON['stringify'](_0x58a079));_0x13b63b(_0x58a079);})['catch'](function(_0x55b975){logger[_0xd777('0xf')](_0xd777('0x13'),_0x55b975[_0xd777('0x10')],_0x386f1a);_0x2c6114(_0x2dd8ec[_0xd777('0xf')](0x1f4,_0x55b975[_0xd777('0x10')]));});});};exports[_0xd777('0x17')]=function(_0x2ff8d3){var _0x87b828=this;return new Promise(function(_0x188a3a,_0x3e637a){return db[_0xd777('0x14')]['update'](_0x2ff8d3[_0xd777('0x18')],{'raw':_0x2ff8d3[_0xd777('0x15')]?_0x2ff8d3[_0xd777('0x15')][_0xd777('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff8d3[_0xd777('0x15')]?_0x2ff8d3['options'][_0xd777('0x19')]||null:null,'attributes':_0x2ff8d3['options']?_0x2ff8d3['options'][_0xd777('0x1a')]||null:null,'limit':_0x2ff8d3[_0xd777('0x15')]?_0x2ff8d3[_0xd777('0x15')][_0xd777('0x1b')]||null:null})['then'](function(_0x453b45){logger[_0xd777('0x9')](_0xd777('0x17'),_0x2ff8d3);logger[_0xd777('0xc')](_0xd777('0x17'),_0x2ff8d3,JSON[_0xd777('0xe')](_0x453b45));_0x188a3a(_0x453b45);})[_0xd777('0x12')](function(_0x3ebb94){logger['error'](_0xd777('0x17'),_0x3ebb94['message'],_0x2ff8d3);_0x3e637a(_0x87b828['error'](0x1f4,_0x3ebb94[_0xd777('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cab7262..8b8683c 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd180=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd180,0x18e));var _0x0d18=function(_0x4faf96,_0x1db35c){_0x4faf96=_0x4faf96-0x0;var _0x28ff12=_0xd180[_0x4faf96];return _0x28ff12;};'use strict';var multer=require('multer');var util=require(_0x0d18('0x0'));var path=require(_0x0d18('0x1'));var timeout=require(_0x0d18('0x2'));var express=require(_0x0d18('0x3'));var router=express[_0x0d18('0x4')]();var fs_extra=require(_0x0d18('0x5'));var auth=require(_0x0d18('0x6'));var interaction=require(_0x0d18('0x7'));var config=require(_0x0d18('0x8'));var controller=require(_0x0d18('0x9'));router[_0x0d18('0xa')]('/',auth[_0x0d18('0xb')](),controller[_0x0d18('0xc')]);router[_0x0d18('0xa')](_0x0d18('0xd'),auth[_0x0d18('0xb')](),controller[_0x0d18('0xe')]);router['get']('/:id',auth[_0x0d18('0xb')](),controller[_0x0d18('0xf')]);router[_0x0d18('0x10')]('/',auth['isAuthenticated'](),controller[_0x0d18('0x11')]);router[_0x0d18('0x12')](_0x0d18('0x13'),auth[_0x0d18('0xb')](),controller[_0x0d18('0x14')]);router[_0x0d18('0x15')](_0x0d18('0x13'),auth[_0x0d18('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc8ff=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8ff,0xa4));var _0xfc8f=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xc8ff[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xfc8f('0x0'));var util=require(_0xfc8f('0x1'));var path=require(_0xfc8f('0x2'));var timeout=require(_0xfc8f('0x3'));var express=require(_0xfc8f('0x4'));var router=express['Router']();var fs_extra=require(_0xfc8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfc8f('0x6'));var config=require(_0xfc8f('0x7'));var controller=require(_0xfc8f('0x8'));router[_0xfc8f('0x9')]('/',auth[_0xfc8f('0xa')](),controller[_0xfc8f('0xb')]);router[_0xfc8f('0x9')]('/describe',auth[_0xfc8f('0xa')](),controller[_0xfc8f('0xc')]);router[_0xfc8f('0x9')]('/:id',auth[_0xfc8f('0xa')](),controller[_0xfc8f('0xd')]);router[_0xfc8f('0xe')]('/',auth[_0xfc8f('0xa')](),controller[_0xfc8f('0xf')]);router[_0xfc8f('0x10')](_0xfc8f('0x11'),auth[_0xfc8f('0xa')](),controller[_0xfc8f('0x12')]);router[_0xfc8f('0x13')](_0xfc8f('0x11'),auth[_0xfc8f('0xa')](),controller[_0xfc8f('0x14')]);module[_0xfc8f('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index a12210d..31ccc61 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x401ec9,_0x77c73f){var _0x8ef3a1=function(_0x171c3c){while(--_0x171c3c){_0x401ec9['push'](_0x401ec9['shift']());}};_0x8ef3a1(++_0x77c73f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x4b84[_0x5d0609];return _0xaa3fd1;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x21b57f,_0x9ba5fb){var _0x3dac6f=function(_0x449042){while(--_0x449042){_0x21b57f['push'](_0x21b57f['shift']());}};_0x3dac6f(++_0x9ba5fb);}(_0x008c,0x188));var _0xc008=function(_0x2c2a81,_0x1d63e5){_0x2c2a81=_0x2c2a81-0x0;var _0x4e337c=_0x008c[_0x2c2a81];return _0x4e337c;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index cfe305e..37e1484 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9164=['to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js'];(function(_0x1d0024,_0x3bcd79){var _0x26e247=function(_0x4ad9ad){while(--_0x4ad9ad){_0x1d0024['push'](_0x1d0024['shift']());}};_0x26e247(++_0x3bcd79);}(_0x9164,0x150));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4916('0x0'));var rimraf=require(_0x4916('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4916('0x2'));var rp=require(_0x4916('0x3'));var moment=require(_0x4916('0x4'));var BPromise=require(_0x4916('0x5'));var Mustache=require(_0x4916('0x6'));var util=require(_0x4916('0x7'));var path=require(_0x4916('0x8'));var sox=require(_0x4916('0x9'));var csv=require('to-csv');var ejs=require(_0x4916('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4916('0xb'));var squel=require(_0x4916('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4916('0xd'));var toCsv=require(_0x4916('0xe'));var querystring=require(_0x4916('0xf'));var Papa=require(_0x4916('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4916('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4916('0x12'))(_0x4916('0x13'));var utils=require(_0x4916('0x14'));var config=require(_0x4916('0x15'));var licenseUtil=require(_0x4916('0x16'));var db=require(_0x4916('0x17'))['db'];function respondWithStatusCode(_0x18af76,_0x3db3c6){_0x3db3c6=_0x3db3c6||0xcc;return function(_0x8d0394){if(_0x8d0394){return _0x18af76['sendStatus'](_0x3db3c6);}return _0x18af76['status'](_0x3db3c6)[_0x4916('0x18')]();};}function respondWithResult(_0x2946fb,_0x324225){_0x324225=_0x324225||0xc8;return function(_0x375aea){if(_0x375aea){return _0x2946fb[_0x4916('0x19')](_0x324225)[_0x4916('0x1a')](_0x375aea);}};}function respondWithFilteredResult(_0x1a4357,_0x559486){return function(_0x16fb22){if(_0x16fb22){var _0x558d32=typeof _0x559486[_0x4916('0x1b')]===_0x4916('0x1c')&&typeof _0x559486['limit']==='undefined';var _0x3b9861=_0x16fb22[_0x4916('0x1d')];var _0x306f14=_0x558d32?0x0:_0x559486['offset'];var _0x22e222=_0x558d32?_0x16fb22[_0x4916('0x1d')]:_0x559486['offset']+_0x559486[_0x4916('0x1e')];var _0x3fae47;if(_0x22e222>=_0x3b9861){_0x22e222=_0x3b9861;_0x3fae47=0xc8;}else{_0x3fae47=0xce;}_0x1a4357[_0x4916('0x19')](_0x3fae47);return _0x1a4357['set']('Content-Range',_0x306f14+'-'+_0x22e222+'/'+_0x3b9861)[_0x4916('0x1a')](_0x16fb22);}return null;};}function patchUpdates(_0x55b7e6){return function(_0x4c40e8){try{jsonpatch[_0x4916('0x1f')](_0x4c40e8,_0x55b7e6,!![]);}catch(_0x4acb18){return BPromise['reject'](_0x4acb18);}return _0x4c40e8[_0x4916('0x20')]();};}function saveUpdates(_0x466493,_0x3371a5){return function(_0x5a3851){if(_0x5a3851){return _0x5a3851[_0x4916('0x21')](_0x466493)[_0x4916('0x22')](function(_0x290434){return _0x290434;});}return null;};}function removeEntity(_0x3adb10,_0x575c60){return function(_0xd3250b){if(_0xd3250b){return _0xd3250b[_0x4916('0x23')]()[_0x4916('0x22')](function(){_0x3adb10[_0x4916('0x19')](0xcc)[_0x4916('0x18')]();});}};}function handleEntityNotFound(_0x107f2d,_0x2bda02){return function(_0x3cde2e){if(!_0x3cde2e){_0x107f2d[_0x4916('0x24')](0x194);}return _0x3cde2e;};}function handleError(_0x46f19d,_0x342116){_0x342116=_0x342116||0x1f4;return function(_0x320dd2){logger[_0x4916('0x25')](_0x320dd2['stack']);if(_0x320dd2[_0x4916('0x26')]){delete _0x320dd2['name'];}_0x46f19d[_0x4916('0x19')](_0x342116)[_0x4916('0x27')](_0x320dd2);};}exports[_0x4916('0x28')]=function(_0x116597,_0x3db3e0){var _0x5c8ecd={},_0x41562d={},_0x46e358={'count':0x0,'rows':[]};var _0x4b3937=_[_0x4916('0x29')](db[_0x4916('0x2a')][_0x4916('0x2b')],function(_0x7aeb1){return{'name':_0x7aeb1[_0x4916('0x2c')],'type':_0x7aeb1[_0x4916('0x2d')]['key']};});_0x41562d[_0x4916('0x2e')]=_['map'](_0x4b3937,_0x4916('0x26'));_0x41562d[_0x4916('0x2f')]=_[_0x4916('0x30')](_0x116597[_0x4916('0x2f')]);_0x41562d[_0x4916('0x31')]=_['intersection'](_0x41562d[_0x4916('0x2e')],_0x41562d[_0x4916('0x2f')]);_0x5c8ecd[_0x4916('0x32')]=_[_0x4916('0x33')](_0x41562d['model'],qs[_0x4916('0x34')](_0x116597[_0x4916('0x2f')][_0x4916('0x34')]));_0x5c8ecd[_0x4916('0x32')]=_0x5c8ecd[_0x4916('0x32')]['length']?_0x5c8ecd['attributes']:_0x41562d[_0x4916('0x2e')];if(!_0x116597[_0x4916('0x2f')]['hasOwnProperty']('nolimit')){_0x5c8ecd['limit']=qs['limit'](_0x116597[_0x4916('0x2f')][_0x4916('0x1e')]);_0x5c8ecd[_0x4916('0x1b')]=qs[_0x4916('0x1b')](_0x116597[_0x4916('0x2f')][_0x4916('0x1b')]);}_0x5c8ecd[_0x4916('0x35')]=qs[_0x4916('0x36')](_0x116597[_0x4916('0x2f')][_0x4916('0x36')]);_0x5c8ecd['where']=qs['filters'](_[_0x4916('0x37')](_0x116597[_0x4916('0x2f')],_0x41562d[_0x4916('0x31')]),_0x4b3937);if(_0x116597[_0x4916('0x2f')][_0x4916('0x38')]){_0x5c8ecd['where']=_[_0x4916('0x39')](_0x5c8ecd['where'],{'$or':_[_0x4916('0x29')](_0x4b3937,function(_0x288052){if(_0x288052[_0x4916('0x2d')]!==_0x4916('0x3a')){var _0x4e21cd={};_0x4e21cd[_0x288052[_0x4916('0x26')]]={'$like':'%'+_0x116597['query']['filter']+'%'};return _0x4e21cd;}})});}_0x5c8ecd=_[_0x4916('0x39')]({},_0x5c8ecd,_0x116597['options']);var _0x287b4e={'where':_0x5c8ecd[_0x4916('0x3b')]};return db[_0x4916('0x2a')][_0x4916('0x1d')](_0x287b4e)['then'](function(_0x9c97e2){_0x46e358[_0x4916('0x1d')]=_0x9c97e2;if(_0x116597[_0x4916('0x2f')][_0x4916('0x3c')]){_0x5c8ecd['include']=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x5c8ecd);})[_0x4916('0x22')](function(_0x514425){_0x46e358['rows']=_0x514425;return _0x46e358;})[_0x4916('0x22')](respondWithFilteredResult(_0x3db3e0,_0x5c8ecd))[_0x4916('0x3d')](handleError(_0x3db3e0,null));};exports[_0x4916('0x3e')]=function(_0x137d4f,_0x168282){var _0x1738ba={'raw':!![],'where':{'id':_0x137d4f[_0x4916('0x3f')]['id']}},_0x490e45={};_0x490e45[_0x4916('0x2e')]=_[_0x4916('0x30')](db[_0x4916('0x2a')]['rawAttributes']);_0x490e45[_0x4916('0x2f')]=_['keys'](_0x137d4f[_0x4916('0x2f')]);_0x490e45['filters']=_[_0x4916('0x33')](_0x490e45['model'],_0x490e45[_0x4916('0x2f')]);_0x1738ba[_0x4916('0x32')]=_[_0x4916('0x33')](_0x490e45[_0x4916('0x2e')],qs['fields'](_0x137d4f[_0x4916('0x2f')][_0x4916('0x34')]));_0x1738ba[_0x4916('0x32')]=_0x1738ba[_0x4916('0x32')][_0x4916('0x40')]?_0x1738ba[_0x4916('0x32')]:_0x490e45[_0x4916('0x2e')];if(_0x137d4f[_0x4916('0x2f')][_0x4916('0x3c')]){_0x1738ba['include']=[{'all':!![]}];}_0x1738ba=_[_0x4916('0x39')]({},_0x1738ba,_0x137d4f[_0x4916('0x41')]);return db['OpenchannelTransferReport'][_0x4916('0x42')](_0x1738ba)[_0x4916('0x22')](handleEntityNotFound(_0x168282,null))[_0x4916('0x22')](respondWithResult(_0x168282,null))[_0x4916('0x3d')](handleError(_0x168282,null));};exports[_0x4916('0x43')]=function(_0x2214b9,_0x308e0e){return db[_0x4916('0x2a')][_0x4916('0x43')](_0x2214b9[_0x4916('0x44')],{})[_0x4916('0x22')](respondWithResult(_0x308e0e,0xc9))[_0x4916('0x3d')](handleError(_0x308e0e,null));};exports[_0x4916('0x21')]=function(_0x6af2b,_0x408e57){if(_0x6af2b['body']['id']){delete _0x6af2b[_0x4916('0x44')]['id'];}return db[_0x4916('0x2a')][_0x4916('0x42')]({'where':{'id':_0x6af2b['params']['id']}})['then'](handleEntityNotFound(_0x408e57,null))['then'](saveUpdates(_0x6af2b['body'],null))[_0x4916('0x22')](respondWithResult(_0x408e57,null))['catch'](handleError(_0x408e57,null));};exports['destroy']=function(_0x42fca7,_0x9016ea){return db[_0x4916('0x2a')][_0x4916('0x42')]({'where':{'id':_0x42fca7[_0x4916('0x3f')]['id']}})[_0x4916('0x22')](handleEntityNotFound(_0x9016ea,null))['then'](removeEntity(_0x9016ea,null))[_0x4916('0x3d')](handleError(_0x9016ea,null));};exports[_0x4916('0x45')]=function(_0x4710fd,_0x41e4a2){return db[_0x4916('0x2a')][_0x4916('0x45')]()['then'](respondWithResult(_0x41e4a2,null))[_0x4916('0x3d')](handleError(_0x41e4a2,null));}; \ No newline at end of file +var _0x6f58=['end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xbb704e,_0x143f3e){var _0x2263bd=function(_0x3eca21){while(--_0x3eca21){_0xbb704e['push'](_0xbb704e['shift']());}};_0x2263bd(++_0x143f3e);}(_0x6f58,0x160));var _0x86f5=function(_0x58ff16,_0x1c6213){_0x58ff16=_0x58ff16-0x0;var _0x48515b=_0x6f58[_0x58ff16];return _0x48515b;};'use strict';var emlformat=require(_0x86f5('0x0'));var rimraf=require(_0x86f5('0x1'));var zipdir=require(_0x86f5('0x2'));var jsonpatch=require(_0x86f5('0x3'));var rp=require(_0x86f5('0x4'));var moment=require('moment');var BPromise=require(_0x86f5('0x5'));var Mustache=require(_0x86f5('0x6'));var util=require(_0x86f5('0x7'));var path=require(_0x86f5('0x8'));var sox=require(_0x86f5('0x9'));var csv=require(_0x86f5('0xa'));var ejs=require(_0x86f5('0xb'));var fs=require('fs');var fs_extra=require(_0x86f5('0xc'));var _=require(_0x86f5('0xd'));var squel=require(_0x86f5('0xe'));var crypto=require(_0x86f5('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x86f5('0xa'));var querystring=require(_0x86f5('0x10'));var Papa=require(_0x86f5('0x11'));var Redis=require(_0x86f5('0x12'));var authService=require(_0x86f5('0x13'));var qs=require(_0x86f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x86f5('0x15'));var utils=require(_0x86f5('0x16'));var config=require(_0x86f5('0x17'));var licenseUtil=require(_0x86f5('0x18'));var db=require(_0x86f5('0x19'))['db'];function respondWithStatusCode(_0x1fc7c5,_0x1f80ca){_0x1f80ca=_0x1f80ca||0xcc;return function(_0x4d6ac0){if(_0x4d6ac0){return _0x1fc7c5[_0x86f5('0x1a')](_0x1f80ca);}return _0x1fc7c5[_0x86f5('0x1b')](_0x1f80ca)[_0x86f5('0x1c')]();};}function respondWithResult(_0x5cc81c,_0x3c9dd5){_0x3c9dd5=_0x3c9dd5||0xc8;return function(_0x4427cc){if(_0x4427cc){return _0x5cc81c[_0x86f5('0x1b')](_0x3c9dd5)['json'](_0x4427cc);}};}function respondWithFilteredResult(_0xbea4b,_0xb0a9ea){return function(_0x54f775){if(_0x54f775){var _0x4586cd=typeof _0xb0a9ea[_0x86f5('0x1d')]===_0x86f5('0x1e')&&typeof _0xb0a9ea[_0x86f5('0x1f')]===_0x86f5('0x1e');var _0x308681=_0x54f775['count'];var _0x150144=_0x4586cd?0x0:_0xb0a9ea[_0x86f5('0x1d')];var _0x76b55=_0x4586cd?_0x54f775[_0x86f5('0x20')]:_0xb0a9ea[_0x86f5('0x1d')]+_0xb0a9ea[_0x86f5('0x1f')];var _0x5bff3c;if(_0x76b55>=_0x308681){_0x76b55=_0x308681;_0x5bff3c=0xc8;}else{_0x5bff3c=0xce;}_0xbea4b[_0x86f5('0x1b')](_0x5bff3c);return _0xbea4b[_0x86f5('0x21')]('Content-Range',_0x150144+'-'+_0x76b55+'/'+_0x308681)[_0x86f5('0x22')](_0x54f775);}return null;};}function patchUpdates(_0x3e58f5){return function(_0xb95b55){try{jsonpatch[_0x86f5('0x23')](_0xb95b55,_0x3e58f5,!![]);}catch(_0x3364ff){return BPromise[_0x86f5('0x24')](_0x3364ff);}return _0xb95b55['save']();};}function saveUpdates(_0x16eb09,_0x297a2c){return function(_0x2a7581){if(_0x2a7581){return _0x2a7581[_0x86f5('0x25')](_0x16eb09)[_0x86f5('0x26')](function(_0x1e7858){return _0x1e7858;});}return null;};}function removeEntity(_0x2f8983,_0x358c8d){return function(_0x3c8a02){if(_0x3c8a02){return _0x3c8a02[_0x86f5('0x27')]()['then'](function(){_0x2f8983[_0x86f5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d65f7,_0x9b27c4){return function(_0x2971ad){if(!_0x2971ad){_0x2d65f7['sendStatus'](0x194);}return _0x2971ad;};}function handleError(_0xae4bb1,_0x4c712a){_0x4c712a=_0x4c712a||0x1f4;return function(_0x5344c7){logger[_0x86f5('0x28')](_0x5344c7[_0x86f5('0x29')]);if(_0x5344c7[_0x86f5('0x2a')]){delete _0x5344c7['name'];}_0xae4bb1[_0x86f5('0x1b')](_0x4c712a)[_0x86f5('0x2b')](_0x5344c7);};}exports[_0x86f5('0x2c')]=function(_0x49db09,_0x21e74f){var _0x120d1f={},_0xe84c94={},_0x5b44a9={'count':0x0,'rows':[]};var _0x57c93d=_[_0x86f5('0x2d')](db[_0x86f5('0x2e')][_0x86f5('0x2f')],function(_0x25c98d){return{'name':_0x25c98d[_0x86f5('0x30')],'type':_0x25c98d['type']['key']};});_0xe84c94['model']=_['map'](_0x57c93d,_0x86f5('0x2a'));_0xe84c94[_0x86f5('0x31')]=_['keys'](_0x49db09[_0x86f5('0x31')]);_0xe84c94[_0x86f5('0x32')]=_['intersection'](_0xe84c94[_0x86f5('0x33')],_0xe84c94[_0x86f5('0x31')]);_0x120d1f[_0x86f5('0x34')]=_[_0x86f5('0x35')](_0xe84c94[_0x86f5('0x33')],qs[_0x86f5('0x36')](_0x49db09[_0x86f5('0x31')][_0x86f5('0x36')]));_0x120d1f['attributes']=_0x120d1f[_0x86f5('0x34')][_0x86f5('0x37')]?_0x120d1f[_0x86f5('0x34')]:_0xe84c94[_0x86f5('0x33')];if(!_0x49db09[_0x86f5('0x31')]['hasOwnProperty']('nolimit')){_0x120d1f['limit']=qs[_0x86f5('0x1f')](_0x49db09[_0x86f5('0x31')][_0x86f5('0x1f')]);_0x120d1f[_0x86f5('0x1d')]=qs[_0x86f5('0x1d')](_0x49db09['query']['offset']);}_0x120d1f[_0x86f5('0x38')]=qs['sort'](_0x49db09[_0x86f5('0x31')][_0x86f5('0x39')]);_0x120d1f[_0x86f5('0x3a')]=qs[_0x86f5('0x32')](_[_0x86f5('0x3b')](_0x49db09[_0x86f5('0x31')],_0xe84c94[_0x86f5('0x32')]),_0x57c93d);if(_0x49db09['query']['filter']){_0x120d1f[_0x86f5('0x3a')]=_[_0x86f5('0x3c')](_0x120d1f[_0x86f5('0x3a')],{'$or':_[_0x86f5('0x2d')](_0x57c93d,function(_0x524342){if(_0x524342[_0x86f5('0x3d')]!=='VIRTUAL'){var _0x18fca8={};_0x18fca8[_0x524342[_0x86f5('0x2a')]]={'$like':'%'+_0x49db09['query'][_0x86f5('0x3e')]+'%'};return _0x18fca8;}})});}_0x120d1f=_[_0x86f5('0x3c')]({},_0x120d1f,_0x49db09[_0x86f5('0x3f')]);var _0x5b292b={'where':_0x120d1f[_0x86f5('0x3a')]};return db[_0x86f5('0x2e')][_0x86f5('0x20')](_0x5b292b)[_0x86f5('0x26')](function(_0x30f279){_0x5b44a9[_0x86f5('0x20')]=_0x30f279;if(_0x49db09[_0x86f5('0x31')][_0x86f5('0x40')]){_0x120d1f[_0x86f5('0x41')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x86f5('0x42')](_0x120d1f);})[_0x86f5('0x26')](function(_0x3fb758){_0x5b44a9[_0x86f5('0x43')]=_0x3fb758;return _0x5b44a9;})[_0x86f5('0x26')](respondWithFilteredResult(_0x21e74f,_0x120d1f))[_0x86f5('0x44')](handleError(_0x21e74f,null));};exports[_0x86f5('0x45')]=function(_0x4d0c3d,_0x20091f){var _0x3e3c99={'raw':!![],'where':{'id':_0x4d0c3d[_0x86f5('0x46')]['id']}},_0x428bfa={};_0x428bfa[_0x86f5('0x33')]=_['keys'](db[_0x86f5('0x2e')]['rawAttributes']);_0x428bfa[_0x86f5('0x31')]=_[_0x86f5('0x47')](_0x4d0c3d[_0x86f5('0x31')]);_0x428bfa[_0x86f5('0x32')]=_[_0x86f5('0x35')](_0x428bfa['model'],_0x428bfa[_0x86f5('0x31')]);_0x3e3c99[_0x86f5('0x34')]=_['intersection'](_0x428bfa[_0x86f5('0x33')],qs[_0x86f5('0x36')](_0x4d0c3d[_0x86f5('0x31')]['fields']));_0x3e3c99[_0x86f5('0x34')]=_0x3e3c99[_0x86f5('0x34')][_0x86f5('0x37')]?_0x3e3c99[_0x86f5('0x34')]:_0x428bfa[_0x86f5('0x33')];if(_0x4d0c3d[_0x86f5('0x31')][_0x86f5('0x40')]){_0x3e3c99[_0x86f5('0x41')]=[{'all':!![]}];}_0x3e3c99=_['merge']({},_0x3e3c99,_0x4d0c3d['options']);return db[_0x86f5('0x2e')][_0x86f5('0x48')](_0x3e3c99)['then'](handleEntityNotFound(_0x20091f,null))[_0x86f5('0x26')](respondWithResult(_0x20091f,null))[_0x86f5('0x44')](handleError(_0x20091f,null));};exports[_0x86f5('0x49')]=function(_0x25d995,_0x4cbe51){return db[_0x86f5('0x2e')][_0x86f5('0x49')](_0x25d995[_0x86f5('0x4a')],{})[_0x86f5('0x26')](respondWithResult(_0x4cbe51,0xc9))[_0x86f5('0x44')](handleError(_0x4cbe51,null));};exports['update']=function(_0x4c1c06,_0x5ccced){if(_0x4c1c06[_0x86f5('0x4a')]['id']){delete _0x4c1c06[_0x86f5('0x4a')]['id'];}return db[_0x86f5('0x2e')][_0x86f5('0x48')]({'where':{'id':_0x4c1c06[_0x86f5('0x46')]['id']}})[_0x86f5('0x26')](handleEntityNotFound(_0x5ccced,null))[_0x86f5('0x26')](saveUpdates(_0x4c1c06[_0x86f5('0x4a')],null))[_0x86f5('0x26')](respondWithResult(_0x5ccced,null))[_0x86f5('0x44')](handleError(_0x5ccced,null));};exports['destroy']=function(_0x44063b,_0x1d2f2e){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x44063b[_0x86f5('0x46')]['id']}})[_0x86f5('0x26')](handleEntityNotFound(_0x1d2f2e,null))['then'](removeEntity(_0x1d2f2e,null))[_0x86f5('0x44')](handleError(_0x1d2f2e,null));};exports[_0x86f5('0x4b')]=function(_0x2d0a0e,_0x5dbed3){return db[_0x86f5('0x2e')][_0x86f5('0x4b')]()[_0x86f5('0x26')](respondWithResult(_0x5dbed3,null))[_0x86f5('0x44')](handleError(_0x5dbed3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d2c98c8..bf5fe34 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.model.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07ce=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid'];(function(_0x2ddc1f,_0x36a583){var _0xa912ca=function(_0x5a80c8){while(--_0x5a80c8){_0x2ddc1f['push'](_0x2ddc1f['shift']());}};_0xa912ca(++_0x36a583);}(_0x07ce,0x138));var _0xe07c=function(_0x22a3b3,_0x1fe930){_0x22a3b3=_0x22a3b3-0x0;var _0x3b9ffa=_0x07ce[_0x22a3b3];return _0x3b9ffa;};'use strict';var _=require('lodash');var util=require(_0xe07c('0x0'));var logger=require(_0xe07c('0x1'))(_0xe07c('0x2'));var moment=require('moment');var BPromise=require(_0xe07c('0x3'));var rp=require(_0xe07c('0x4'));var fs=require('fs');var path=require(_0xe07c('0x5'));var rimraf=require('rimraf');var config=require(_0xe07c('0x6'));var attributes=require(_0xe07c('0x7'));module[_0xe07c('0x8')]=function(_0x41514b,_0x43531f){return _0x41514b[_0xe07c('0x9')](_0xe07c('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xe07c('0xb'),'fields':[_0xe07c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa2bc=['define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xa2bc,0x162));var _0xca2b=function(_0x35142b,_0x326f02){_0x35142b=_0x35142b-0x0;var _0x1e2777=_0xa2bc[_0x35142b];return _0x1e2777;};'use strict';var _=require(_0xca2b('0x0'));var util=require(_0xca2b('0x1'));var logger=require(_0xca2b('0x2'))(_0xca2b('0x3'));var moment=require(_0xca2b('0x4'));var BPromise=require(_0xca2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xca2b('0x6'));var config=require(_0xca2b('0x7'));var attributes=require(_0xca2b('0x8'));module[_0xca2b('0x9')]=function(_0xa7c78a,_0x54905e){return _0xa7c78a[_0xca2b('0xa')](_0xca2b('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xca2b('0xc'),'fields':[_0xca2b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8156a3e..1da7707 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43fd=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x541ea6,_0x51cab6){var _0x3c3e84=function(_0xc06bed){while(--_0xc06bed){_0x541ea6['push'](_0x541ea6['shift']());}};_0x3c3e84(++_0x51cab6);}(_0x43fd,0x1ec));var _0xd43f=function(_0x5cd5a0,_0x43d0c5){_0x5cd5a0=_0x5cd5a0-0x0;var _0x566bb7=_0x43fd[_0x5cd5a0];return _0x566bb7;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file +var _0x0f89=['info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','OpenchannelTransferReport,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x24465b,_0x1ef032){var _0x5585da=function(_0x5bc52e){while(--_0x5bc52e){_0x24465b['push'](_0x24465b['shift']());}};_0x5585da(++_0x1ef032);}(_0x0f89,0x111));var _0x90f8=function(_0x576abb,_0xf86689){_0x576abb=_0x576abb-0x0;var _0xa4b48d=_0x0f89[_0x576abb];return _0xa4b48d;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var moment=require(_0x90f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x90f8('0x3'));var fs=require('fs');var Redis=require(_0x90f8('0x4'));var db=require(_0x90f8('0x5'))['db'];var utils=require(_0x90f8('0x6'));var logger=require('../../config/logger')(_0x90f8('0x7'));var config=require(_0x90f8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90f8('0x9')][_0x90f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4457fb,_0x192b06,_0x240086){return new BPromise(function(_0x4424d1,_0x6dabde){return client[_0x90f8('0xb')](_0x4457fb,_0x240086)[_0x90f8('0xc')](function(_0x3cebe0){logger[_0x90f8('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,'request\x20sent');logger[_0x90f8('0xe')](_0x90f8('0xf'),_0x192b06,_0x90f8('0x10'),JSON[_0x90f8('0x11')](_0x3cebe0));if(_0x3cebe0[_0x90f8('0x12')]){if(_0x3cebe0[_0x90f8('0x12')]['code']===0x1f4){logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x3cebe0['error'][_0x90f8('0x13')]);return _0x6dabde(_0x3cebe0[_0x90f8('0x12')]['message']);}logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);return _0x4424d1(_0x3cebe0[_0x90f8('0x12')][_0x90f8('0x13')]);}else{logger['info'](_0x90f8('0x14'),_0x192b06,_0x90f8('0x10'));_0x4424d1(_0x3cebe0[_0x90f8('0x15')][_0x90f8('0x13')]);}})['catch'](function(_0x2fa060){logger[_0x90f8('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x192b06,_0x2fa060);_0x6dabde(_0x2fa060);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d84ed73..65e2ea1 100644 --- a/server/api/pause/index.js +++ b/server/api/pause/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf313=['get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1a105a,_0x1ad733){var _0x3fa8f0=function(_0x1fec29){while(--_0x1fec29){_0x1a105a['push'](_0x1a105a['shift']());}};_0x3fa8f0(++_0x1ad733);}(_0xf313,0x12b));var _0x3f31=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf313[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x3f31('0x0'));var util=require('util');var path=require(_0x3f31('0x1'));var timeout=require(_0x3f31('0x2'));var express=require('express');var router=express[_0x3f31('0x3')]();var fs_extra=require(_0x3f31('0x4'));var auth=require(_0x3f31('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3f31('0x6'));var controller=require('./pause.controller');router[_0x3f31('0x7')]('/',auth['isAuthenticated'](),controller[_0x3f31('0x8')]);router[_0x3f31('0x7')](_0x3f31('0x9'),auth['isAuthenticated'](),controller[_0x3f31('0xa')]);router['post']('/',auth[_0x3f31('0xb')](),controller[_0x3f31('0xc')]);router[_0x3f31('0xd')](_0x3f31('0x9'),auth[_0x3f31('0xb')](),controller[_0x3f31('0xe')]);router[_0x3f31('0xf')](_0x3f31('0x9'),auth[_0x3f31('0xb')](),controller[_0x3f31('0x10')]);module[_0x3f31('0x11')]=router; \ No newline at end of file +var _0x5ac2=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x4ccfd4,_0x1818b2){var _0x354106=function(_0x2a0ce1){while(--_0x2a0ce1){_0x4ccfd4['push'](_0x4ccfd4['shift']());}};_0x354106(++_0x1818b2);}(_0x5ac2,0x1b5));var _0x25ac=function(_0x3ecb7,_0x182e09){_0x3ecb7=_0x3ecb7-0x0;var _0x5e143d=_0x5ac2[_0x3ecb7];return _0x5e143d;};'use strict';var multer=require(_0x25ac('0x0'));var util=require(_0x25ac('0x1'));var path=require(_0x25ac('0x2'));var timeout=require(_0x25ac('0x3'));var express=require(_0x25ac('0x4'));var router=express[_0x25ac('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x25ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x25ac('0x7'));var controller=require(_0x25ac('0x8'));router[_0x25ac('0x9')]('/',auth[_0x25ac('0xa')](),controller['index']);router[_0x25ac('0x9')](_0x25ac('0xb'),auth[_0x25ac('0xa')](),controller[_0x25ac('0xc')]);router[_0x25ac('0xd')]('/',auth[_0x25ac('0xa')](),controller[_0x25ac('0xe')]);router[_0x25ac('0xf')](_0x25ac('0xb'),auth[_0x25ac('0xa')](),controller[_0x25ac('0x10')]);router[_0x25ac('0x11')](_0x25ac('0xb'),auth[_0x25ac('0xa')](),controller[_0x25ac('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 75ec7ba..7897136 100644 --- a/server/api/pause/pause.attributes.js +++ b/server/api/pause/pause.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc498=['exports','STRING','sequelize'];(function(_0x11c6b2,_0x163c3f){var _0x490197=function(_0x25c356){while(--_0x25c356){_0x11c6b2['push'](_0x11c6b2['shift']());}};_0x490197(++_0x163c3f);}(_0xc498,0x1ca));var _0x8c49=function(_0x21989a,_0x2ae349){_0x21989a=_0x21989a-0x0;var _0x39154d=_0xc498[_0x21989a];return _0x39154d;};'use strict';var Sequelize=require(_0x8c49('0x0'));module[_0x8c49('0x1')]={'name':{'type':Sequelize[_0x8c49('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x8c49('0x2')]}}; \ No newline at end of file +var _0xacf8=['exports','STRING','name'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0xacf8,0x105));var _0x8acf=function(_0x561d9f,_0x447dea){_0x561d9f=_0x561d9f-0x0;var _0x4ecca0=_0xacf8[_0x561d9f];return _0x4ecca0;};'use strict';var Sequelize=require('sequelize');module[_0x8acf('0x0')]={'name':{'type':Sequelize[_0x8acf('0x1')],'unique':_0x8acf('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8acf('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 94d1930..6f79694 100644 --- a/server/api/pause/pause.controller.js +++ b/server/api/pause/pause.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcb4=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','then','get','Pauses','status','end','error','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcb4,0x132));var _0x4fcb=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xfcb4[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x4fcb('0x0'));var rimraf=require(_0x4fcb('0x1'));var zipdir=require(_0x4fcb('0x2'));var jsonpatch=require(_0x4fcb('0x3'));var rp=require('request-promise');var moment=require(_0x4fcb('0x4'));var BPromise=require(_0x4fcb('0x5'));var Mustache=require(_0x4fcb('0x6'));var util=require(_0x4fcb('0x7'));var path=require(_0x4fcb('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4fcb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fcb('0xa'));var squel=require(_0x4fcb('0xb'));var crypto=require(_0x4fcb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4fcb('0xd'));var Papa=require('papaparse');var Redis=require(_0x4fcb('0xe'));var authService=require(_0x4fcb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fcb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fcb('0x11'));var utils=require(_0x4fcb('0x12'));var config=require(_0x4fcb('0x13'));var licenseUtil=require(_0x4fcb('0x14'));var db=require(_0x4fcb('0x15'))['db'];function respondWithStatusCode(_0x37296b,_0x3f59c5){_0x3f59c5=_0x3f59c5||0xcc;return function(_0x4cbf4f){if(_0x4cbf4f){return _0x37296b[_0x4fcb('0x16')](_0x3f59c5);}return _0x37296b['status'](_0x3f59c5)['end']();};}function respondWithResult(_0x5813ed,_0x485af5){_0x485af5=_0x485af5||0xc8;return function(_0x97d4fb){if(_0x97d4fb){return _0x5813ed['status'](_0x485af5)[_0x4fcb('0x17')](_0x97d4fb);}};}function respondWithFilteredResult(_0x38ef21,_0x823e94){return function(_0x2e703e){if(_0x2e703e){var _0x121ace=typeof _0x823e94[_0x4fcb('0x18')]===_0x4fcb('0x19')&&typeof _0x823e94[_0x4fcb('0x1a')]===_0x4fcb('0x19');var _0x5d1e7a=_0x2e703e['count'];var _0xf198a2=_0x121ace?0x0:_0x823e94[_0x4fcb('0x18')];var _0x178e7c=_0x121ace?_0x2e703e['count']:_0x823e94[_0x4fcb('0x18')]+_0x823e94['limit'];var _0x185df1;if(_0x178e7c>=_0x5d1e7a){_0x178e7c=_0x5d1e7a;_0x185df1=0xc8;}else{_0x185df1=0xce;}_0x38ef21['status'](_0x185df1);return _0x38ef21[_0x4fcb('0x1b')](_0x4fcb('0x1c'),_0xf198a2+'-'+_0x178e7c+'/'+_0x5d1e7a)[_0x4fcb('0x17')](_0x2e703e);}return null;};}function patchUpdates(_0x6e501){return function(_0x5c01f0){try{jsonpatch[_0x4fcb('0x1d')](_0x5c01f0,_0x6e501,!![]);}catch(_0x497f5a){return BPromise[_0x4fcb('0x1e')](_0x497f5a);}return _0x5c01f0['save']();};}function saveUpdates(_0x1c6a84,_0x196e84){return function(_0x522185){if(_0x522185){return _0x522185[_0x4fcb('0x1f')](_0x1c6a84)['then'](function(_0x523437){return _0x523437;});}return null;};}function removeEntity(_0x33c289,_0x3a735d){return function(_0x2fc7ff){if(_0x2fc7ff){return _0x2fc7ff[_0x4fcb('0x20')]()[_0x4fcb('0x21')](function(){var _0x4bab8c=_0x2fc7ff[_0x4fcb('0x22')]({'plain':!![]});var _0xd30f69=_0x4fcb('0x23');return db['UserProfileResource'][_0x4fcb('0x20')]({'where':{'type':_0xd30f69,'resourceId':_0x4bab8c['id']}})['then'](function(){return _0x2fc7ff;});})['then'](function(){_0x33c289[_0x4fcb('0x24')](0xcc)[_0x4fcb('0x25')]();});}};}function handleEntityNotFound(_0x22f34f,_0x513500){return function(_0x102ba4){if(!_0x102ba4){_0x22f34f[_0x4fcb('0x16')](0x194);}return _0x102ba4;};}function handleError(_0x2f4b2f,_0x5ea34f){_0x5ea34f=_0x5ea34f||0x1f4;return function(_0x27ef5d){logger[_0x4fcb('0x26')](_0x27ef5d['stack']);if(_0x27ef5d[_0x4fcb('0x27')]){delete _0x27ef5d[_0x4fcb('0x27')];}_0x2f4b2f[_0x4fcb('0x24')](_0x5ea34f)[_0x4fcb('0x28')](_0x27ef5d);};}exports['index']=function(_0x25925c,_0x192b0c){var _0x24f764={},_0x1d36db={},_0x84dd0a={'count':0x0,'rows':[]};var _0x2c474a=_[_0x4fcb('0x29')](db[_0x4fcb('0x2a')][_0x4fcb('0x2b')],function(_0x44a328){return{'name':_0x44a328[_0x4fcb('0x2c')],'type':_0x44a328[_0x4fcb('0x2d')][_0x4fcb('0x2e')]};});_0x1d36db[_0x4fcb('0x2f')]=_[_0x4fcb('0x29')](_0x2c474a,_0x4fcb('0x27'));_0x1d36db[_0x4fcb('0x30')]=_[_0x4fcb('0x31')](_0x25925c[_0x4fcb('0x30')]);_0x1d36db[_0x4fcb('0x32')]=_['intersection'](_0x1d36db[_0x4fcb('0x2f')],_0x1d36db[_0x4fcb('0x30')]);_0x24f764[_0x4fcb('0x33')]=_[_0x4fcb('0x34')](_0x1d36db[_0x4fcb('0x2f')],qs[_0x4fcb('0x35')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x35')]));_0x24f764['attributes']=_0x24f764[_0x4fcb('0x33')][_0x4fcb('0x36')]?_0x24f764[_0x4fcb('0x33')]:_0x1d36db[_0x4fcb('0x2f')];if(!_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x37')](_0x4fcb('0x38'))){_0x24f764[_0x4fcb('0x1a')]=qs[_0x4fcb('0x1a')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x1a')]);_0x24f764[_0x4fcb('0x18')]=qs[_0x4fcb('0x18')](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x18')]);}_0x24f764['order']=qs['sort'](_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x39')]);_0x24f764[_0x4fcb('0x3a')]=qs['filters'](_['pick'](_0x25925c[_0x4fcb('0x30')],_0x1d36db[_0x4fcb('0x32')]),_0x2c474a);if(_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x3b')]){_0x24f764[_0x4fcb('0x3a')]=_[_0x4fcb('0x3c')](_0x24f764[_0x4fcb('0x3a')],{'$or':_[_0x4fcb('0x29')](_0x2c474a,function(_0x5daee){if(_0x5daee[_0x4fcb('0x2d')]!==_0x4fcb('0x3d')){var _0x195aa5={};_0x195aa5[_0x5daee[_0x4fcb('0x27')]]={'$like':'%'+_0x25925c[_0x4fcb('0x30')][_0x4fcb('0x3b')]+'%'};return _0x195aa5;}})});}_0x24f764=_[_0x4fcb('0x3c')]({},_0x24f764,_0x25925c['options']);var _0x340021={'where':_0x24f764['where']};return db[_0x4fcb('0x2a')]['count'](_0x340021)[_0x4fcb('0x21')](function(_0x23229f){_0x84dd0a[_0x4fcb('0x3e')]=_0x23229f;if(_0x25925c['query'][_0x4fcb('0x3f')]){_0x24f764[_0x4fcb('0x40')]=[{'all':!![]}];}return db[_0x4fcb('0x2a')][_0x4fcb('0x41')](_0x24f764);})[_0x4fcb('0x21')](function(_0x486bcc){_0x84dd0a['rows']=_0x486bcc;return _0x84dd0a;})['then'](respondWithFilteredResult(_0x192b0c,_0x24f764))[_0x4fcb('0x42')](handleError(_0x192b0c,null));};exports[_0x4fcb('0x43')]=function(_0x96f486,_0x5edba0){var _0x2c3da8={'raw':!![],'where':{'id':_0x96f486[_0x4fcb('0x44')]['id']}},_0x2a68cb={};_0x2a68cb[_0x4fcb('0x2f')]=_[_0x4fcb('0x31')](db[_0x4fcb('0x2a')]['rawAttributes']);_0x2a68cb[_0x4fcb('0x30')]=_['keys'](_0x96f486[_0x4fcb('0x30')]);_0x2a68cb['filters']=_[_0x4fcb('0x34')](_0x2a68cb[_0x4fcb('0x2f')],_0x2a68cb[_0x4fcb('0x30')]);_0x2c3da8['attributes']=_[_0x4fcb('0x34')](_0x2a68cb[_0x4fcb('0x2f')],qs[_0x4fcb('0x35')](_0x96f486['query']['fields']));_0x2c3da8['attributes']=_0x2c3da8['attributes'][_0x4fcb('0x36')]?_0x2c3da8[_0x4fcb('0x33')]:_0x2a68cb[_0x4fcb('0x2f')];if(_0x96f486[_0x4fcb('0x30')][_0x4fcb('0x3f')]){_0x2c3da8['include']=[{'all':!![]}];}_0x2c3da8=_[_0x4fcb('0x3c')]({},_0x2c3da8,_0x96f486['options']);return db['Pause']['find'](_0x2c3da8)[_0x4fcb('0x21')](handleEntityNotFound(_0x5edba0,null))['then'](respondWithResult(_0x5edba0,null))['catch'](handleError(_0x5edba0,null));};exports[_0x4fcb('0x45')]=function(_0x21d698,_0x4dade2){return db[_0x4fcb('0x2a')][_0x4fcb('0x45')](_0x21d698[_0x4fcb('0x46')],{})['then'](function(_0x1ab671){var _0x570e9f=_0x21d698[_0x4fcb('0x47')][_0x4fcb('0x22')]({'plain':!![]});if(!_0x570e9f)throw new Error(_0x4fcb('0x48'));if(_0x570e9f[_0x4fcb('0x49')]===_0x4fcb('0x47')){var _0xf52789=_0x1ab671[_0x4fcb('0x22')]({'plain':!![]});var _0x4d93c6=_0x4fcb('0x23');return db[_0x4fcb('0x4a')]['find']({'where':{'name':_0x4d93c6,'userProfileId':_0x570e9f[_0x4fcb('0x4b')]},'raw':!![]})[_0x4fcb('0x21')](function(_0x2aae81){if(_0x2aae81&&_0x2aae81[_0x4fcb('0x4c')]===0x0){return db[_0x4fcb('0x4d')]['create']({'name':_0xf52789[_0x4fcb('0x27')],'resourceId':_0xf52789['id'],'type':_0x2aae81[_0x4fcb('0x27')],'sectionId':_0x2aae81['id']},{})[_0x4fcb('0x21')](function(){return _0x1ab671;});}else{return _0x1ab671;}})[_0x4fcb('0x42')](function(_0x3b4d26){logger[_0x4fcb('0x26')](_0x4fcb('0x4e'),_0x3b4d26);throw _0x3b4d26;});}return _0x1ab671;})[_0x4fcb('0x21')](respondWithResult(_0x4dade2,0xc9))[_0x4fcb('0x42')](handleError(_0x4dade2,null));};exports[_0x4fcb('0x1f')]=function(_0x5556fd,_0x422279){if(_0x5556fd[_0x4fcb('0x46')]['id']){delete _0x5556fd[_0x4fcb('0x46')]['id'];}return db[_0x4fcb('0x2a')][_0x4fcb('0x4f')]({'where':{'id':_0x5556fd[_0x4fcb('0x44')]['id']}})[_0x4fcb('0x21')](handleEntityNotFound(_0x422279,null))[_0x4fcb('0x21')](saveUpdates(_0x5556fd[_0x4fcb('0x46')],null))[_0x4fcb('0x21')](respondWithResult(_0x422279,null))[_0x4fcb('0x42')](handleError(_0x422279,null));};exports[_0x4fcb('0x20')]=function(_0x9b03,_0xc5891c){return db[_0x4fcb('0x2a')]['find']({'where':{'id':_0x9b03[_0x4fcb('0x44')]['id']}})['then'](handleEntityNotFound(_0xc5891c,null))[_0x4fcb('0x21')](removeEntity(_0xc5891c,null))[_0x4fcb('0x42')](handleError(_0xc5891c,null));}; \ No newline at end of file +var _0x4073=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','Pause','include','findAll','show','params','includeAll','catch','create','body','user','get','Pauses','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x54cf73,_0x507f3d){var _0x2bdec0=function(_0x2cabb3){while(--_0x2cabb3){_0x54cf73['push'](_0x54cf73['shift']());}};_0x2bdec0(++_0x507f3d);}(_0x4073,0x1cc));var _0x3407=function(_0x2a10e6,_0x292864){_0x2a10e6=_0x2a10e6-0x0;var _0x338ec3=_0x4073[_0x2a10e6];return _0x338ec3;};'use strict';var emlformat=require(_0x3407('0x0'));var rimraf=require(_0x3407('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3407('0x2'));var rp=require(_0x3407('0x3'));var moment=require(_0x3407('0x4'));var BPromise=require(_0x3407('0x5'));var Mustache=require(_0x3407('0x6'));var util=require(_0x3407('0x7'));var path=require(_0x3407('0x8'));var sox=require(_0x3407('0x9'));var csv=require('to-csv');var ejs=require(_0x3407('0xa'));var fs=require('fs');var fs_extra=require(_0x3407('0xb'));var _=require(_0x3407('0xc'));var squel=require(_0x3407('0xd'));var crypto=require('crypto');var jsforce=require(_0x3407('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3407('0xf'));var querystring=require(_0x3407('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3407('0x11'));var qs=require(_0x3407('0x12'));var as=require(_0x3407('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3407('0x14'));var config=require(_0x3407('0x15'));var licenseUtil=require(_0x3407('0x16'));var db=require(_0x3407('0x17'))['db'];function respondWithStatusCode(_0x2c3e1d,_0x227566){_0x227566=_0x227566||0xcc;return function(_0x5b4b7a){if(_0x5b4b7a){return _0x2c3e1d[_0x3407('0x18')](_0x227566);}return _0x2c3e1d['status'](_0x227566)['end']();};}function respondWithResult(_0x49da45,_0x449ea1){_0x449ea1=_0x449ea1||0xc8;return function(_0x59e743){if(_0x59e743){return _0x49da45[_0x3407('0x19')](_0x449ea1)[_0x3407('0x1a')](_0x59e743);}};}function respondWithFilteredResult(_0x1ebefe,_0x102f68){return function(_0x1a298b){if(_0x1a298b){var _0x24674a=typeof _0x102f68[_0x3407('0x1b')]==='undefined'&&typeof _0x102f68[_0x3407('0x1c')]===_0x3407('0x1d');var _0x22accc=_0x1a298b[_0x3407('0x1e')];var _0xd40305=_0x24674a?0x0:_0x102f68['offset'];var _0x126d0b=_0x24674a?_0x1a298b[_0x3407('0x1e')]:_0x102f68['offset']+_0x102f68[_0x3407('0x1c')];var _0x214eaf;if(_0x126d0b>=_0x22accc){_0x126d0b=_0x22accc;_0x214eaf=0xc8;}else{_0x214eaf=0xce;}_0x1ebefe[_0x3407('0x19')](_0x214eaf);return _0x1ebefe[_0x3407('0x1f')](_0x3407('0x20'),_0xd40305+'-'+_0x126d0b+'/'+_0x22accc)[_0x3407('0x1a')](_0x1a298b);}return null;};}function patchUpdates(_0x39d28a){return function(_0x37aeed){try{jsonpatch[_0x3407('0x21')](_0x37aeed,_0x39d28a,!![]);}catch(_0x487bef){return BPromise['reject'](_0x487bef);}return _0x37aeed[_0x3407('0x22')]();};}function saveUpdates(_0x5d513e,_0x55f79f){return function(_0x2347d9){if(_0x2347d9){return _0x2347d9['update'](_0x5d513e)[_0x3407('0x23')](function(_0x518f48){return _0x518f48;});}return null;};}function removeEntity(_0x39cc74,_0x2f1a63){return function(_0x166880){if(_0x166880){return _0x166880[_0x3407('0x24')]()[_0x3407('0x23')](function(){var _0x21e1e9=_0x166880['get']({'plain':!![]});var _0x56fa47='Pauses';return db['UserProfileResource'][_0x3407('0x24')]({'where':{'type':_0x56fa47,'resourceId':_0x21e1e9['id']}})['then'](function(){return _0x166880;});})[_0x3407('0x23')](function(){_0x39cc74[_0x3407('0x19')](0xcc)[_0x3407('0x25')]();});}};}function handleEntityNotFound(_0x581235,_0x57c2a2){return function(_0x272334){if(!_0x272334){_0x581235[_0x3407('0x18')](0x194);}return _0x272334;};}function handleError(_0x1175ac,_0x3cebaa){_0x3cebaa=_0x3cebaa||0x1f4;return function(_0x564269){logger['error'](_0x564269[_0x3407('0x26')]);if(_0x564269['name']){delete _0x564269[_0x3407('0x27')];}_0x1175ac[_0x3407('0x19')](_0x3cebaa)[_0x3407('0x28')](_0x564269);};}exports[_0x3407('0x29')]=function(_0x1300ab,_0x7a18a9){var _0x520848={},_0x114f95={},_0x5d450d={'count':0x0,'rows':[]};var _0x1b300f=_[_0x3407('0x2a')](db['Pause'][_0x3407('0x2b')],function(_0x2bd8e8){return{'name':_0x2bd8e8['fieldName'],'type':_0x2bd8e8[_0x3407('0x2c')][_0x3407('0x2d')]};});_0x114f95[_0x3407('0x2e')]=_[_0x3407('0x2a')](_0x1b300f,_0x3407('0x27'));_0x114f95['query']=_[_0x3407('0x2f')](_0x1300ab[_0x3407('0x30')]);_0x114f95[_0x3407('0x31')]=_[_0x3407('0x32')](_0x114f95[_0x3407('0x2e')],_0x114f95['query']);_0x520848[_0x3407('0x33')]=_[_0x3407('0x32')](_0x114f95[_0x3407('0x2e')],qs[_0x3407('0x34')](_0x1300ab[_0x3407('0x30')][_0x3407('0x34')]));_0x520848[_0x3407('0x33')]=_0x520848[_0x3407('0x33')][_0x3407('0x35')]?_0x520848['attributes']:_0x114f95[_0x3407('0x2e')];if(!_0x1300ab[_0x3407('0x30')]['hasOwnProperty']('nolimit')){_0x520848['limit']=qs[_0x3407('0x1c')](_0x1300ab[_0x3407('0x30')]['limit']);_0x520848[_0x3407('0x1b')]=qs[_0x3407('0x1b')](_0x1300ab['query'][_0x3407('0x1b')]);}_0x520848[_0x3407('0x36')]=qs[_0x3407('0x37')](_0x1300ab[_0x3407('0x30')][_0x3407('0x37')]);_0x520848[_0x3407('0x38')]=qs[_0x3407('0x31')](_[_0x3407('0x39')](_0x1300ab[_0x3407('0x30')],_0x114f95[_0x3407('0x31')]),_0x1b300f);if(_0x1300ab[_0x3407('0x30')][_0x3407('0x3a')]){_0x520848[_0x3407('0x38')]=_['merge'](_0x520848[_0x3407('0x38')],{'$or':_[_0x3407('0x2a')](_0x1b300f,function(_0x4c9514){if(_0x4c9514[_0x3407('0x2c')]!==_0x3407('0x3b')){var _0x2b4456={};_0x2b4456[_0x4c9514[_0x3407('0x27')]]={'$like':'%'+_0x1300ab[_0x3407('0x30')][_0x3407('0x3a')]+'%'};return _0x2b4456;}})});}_0x520848=_[_0x3407('0x3c')]({},_0x520848,_0x1300ab['options']);var _0x12bd5b={'where':_0x520848['where']};return db[_0x3407('0x3d')]['count'](_0x12bd5b)[_0x3407('0x23')](function(_0x17d1f7){_0x5d450d[_0x3407('0x1e')]=_0x17d1f7;if(_0x1300ab['query']['includeAll']){_0x520848[_0x3407('0x3e')]=[{'all':!![]}];}return db['Pause'][_0x3407('0x3f')](_0x520848);})[_0x3407('0x23')](function(_0x411636){_0x5d450d['rows']=_0x411636;return _0x5d450d;})[_0x3407('0x23')](respondWithFilteredResult(_0x7a18a9,_0x520848))['catch'](handleError(_0x7a18a9,null));};exports[_0x3407('0x40')]=function(_0x1481fe,_0x1d2ac4){var _0x249630={'raw':!![],'where':{'id':_0x1481fe[_0x3407('0x41')]['id']}},_0x5e60b7={};_0x5e60b7[_0x3407('0x2e')]=_['keys'](db[_0x3407('0x3d')][_0x3407('0x2b')]);_0x5e60b7[_0x3407('0x30')]=_[_0x3407('0x2f')](_0x1481fe[_0x3407('0x30')]);_0x5e60b7['filters']=_[_0x3407('0x32')](_0x5e60b7[_0x3407('0x2e')],_0x5e60b7['query']);_0x249630['attributes']=_['intersection'](_0x5e60b7[_0x3407('0x2e')],qs[_0x3407('0x34')](_0x1481fe[_0x3407('0x30')][_0x3407('0x34')]));_0x249630[_0x3407('0x33')]=_0x249630['attributes']['length']?_0x249630['attributes']:_0x5e60b7[_0x3407('0x2e')];if(_0x1481fe[_0x3407('0x30')][_0x3407('0x42')]){_0x249630[_0x3407('0x3e')]=[{'all':!![]}];}_0x249630=_[_0x3407('0x3c')]({},_0x249630,_0x1481fe['options']);return db[_0x3407('0x3d')]['find'](_0x249630)[_0x3407('0x23')](handleEntityNotFound(_0x1d2ac4,null))['then'](respondWithResult(_0x1d2ac4,null))[_0x3407('0x43')](handleError(_0x1d2ac4,null));};exports[_0x3407('0x44')]=function(_0x4e8482,_0x53ef4d){return db['Pause'][_0x3407('0x44')](_0x4e8482[_0x3407('0x45')],{})['then'](function(_0x1abc67){var _0x1f29f0=_0x4e8482[_0x3407('0x46')][_0x3407('0x47')]({'plain':!![]});if(!_0x1f29f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f29f0['role']===_0x3407('0x46')){var _0x42a685=_0x1abc67[_0x3407('0x47')]({'plain':!![]});var _0x1ad25c=_0x3407('0x48');return db[_0x3407('0x49')][_0x3407('0x4a')]({'where':{'name':_0x1ad25c,'userProfileId':_0x1f29f0[_0x3407('0x4b')]},'raw':!![]})[_0x3407('0x23')](function(_0x4605de){if(_0x4605de&&_0x4605de[_0x3407('0x4c')]===0x0){return db['UserProfileResource'][_0x3407('0x44')]({'name':_0x42a685['name'],'resourceId':_0x42a685['id'],'type':_0x4605de[_0x3407('0x27')],'sectionId':_0x4605de['id']},{})['then'](function(){return _0x1abc67;});}else{return _0x1abc67;}})['catch'](function(_0x5a5a0c){logger[_0x3407('0x4d')](_0x3407('0x4e'),_0x5a5a0c);throw _0x5a5a0c;});}return _0x1abc67;})[_0x3407('0x23')](respondWithResult(_0x53ef4d,0xc9))['catch'](handleError(_0x53ef4d,null));};exports[_0x3407('0x4f')]=function(_0x5be581,_0x144154){if(_0x5be581['body']['id']){delete _0x5be581[_0x3407('0x45')]['id'];}return db[_0x3407('0x3d')][_0x3407('0x4a')]({'where':{'id':_0x5be581[_0x3407('0x41')]['id']}})[_0x3407('0x23')](handleEntityNotFound(_0x144154,null))['then'](saveUpdates(_0x5be581[_0x3407('0x45')],null))[_0x3407('0x23')](respondWithResult(_0x144154,null))[_0x3407('0x43')](handleError(_0x144154,null));};exports[_0x3407('0x24')]=function(_0x436d04,_0x3d5ec2){return db[_0x3407('0x3d')][_0x3407('0x4a')]({'where':{'id':_0x436d04['params']['id']}})['then'](handleEntityNotFound(_0x3d5ec2,null))['then'](removeEntity(_0x3d5ec2,null))['catch'](handleError(_0x3d5ec2,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 73c02e9..93c991c 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x2d393f,_0x39ecd2){var _0x40f8da=function(_0x34f20b){while(--_0x34f20b){_0x2d393f['push'](_0x2d393f['shift']());}};_0x40f8da(++_0x39ecd2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x5fc3[_0x495e9f];return _0xb249d2;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x524b13,_0x4c48a3){var _0x6bf6c3=function(_0x46686d){while(--_0x46686d){_0x524b13['push'](_0x524b13['shift']());}};_0x6bf6c3(++_0x4c48a3);}(_0xabce,0x103));var _0xeabc=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xabce[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e1cb57a..13d378c 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2472d3,_0x393ee9){var _0x4b3c72=function(_0x20e96e){while(--_0x20e96e){_0x2472d3['push'](_0x2472d3['shift']());}};_0x4b3c72(++_0x393ee9);}(_0xb10b,0x12a));var _0xbb10=function(_0x6afa2d,_0x8c0e0f){_0x6afa2d=_0x6afa2d-0x0;var _0x1698ee=_0xb10b[_0x6afa2d];return _0x1698ee;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x48c659,_0x4b0bec){var _0xdeb3a7=function(_0x441d89){while(--_0x441d89){_0x48c659['push'](_0x48c659['shift']());}};_0xdeb3a7(++_0x4b0bec);}(_0xb10b,0x12a));var _0xbb10=function(_0x6f041d,_0x4029b4){_0x6f041d=_0x6f041d-0x0;var _0x4609b8=_0xb10b[_0x6f041d];return _0x4609b8;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 8512441..19e17be 100644 --- a/server/api/plugin/index.js +++ b/server/api/plugin/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['now','file','upload','/webhook','webhookPost','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','extname'];(function(_0x26277b,_0x447ca9){var _0x612880=function(_0x2bfb08){while(--_0x2bfb08){_0x26277b['push'](_0x26277b['shift']());}};_0x612880(++_0x447ca9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x19c485,_0x2392ce){_0x19c485=_0x19c485-0x0;var _0x1104b6=_0xe5b3[_0x19c485];return _0x1104b6;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/webhook',controller[_0x3e5b('0xc')]);router[_0x3e5b('0xa')](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['show']);router['get'](_0x3e5b('0xf'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x10')]);var upload=multer({'storage':multer[_0x3e5b('0x11')]({'destination':function(_0xeeaabc,_0x522e9e,_0x3be027){_0x3be027(null,path['join'](config[_0x3e5b('0x12')],_0x3e5b('0x13')));},'filename':function(_0x4d69dd,_0x374068,_0x20b97b){_0x374068[_0x3e5b('0x14')]=_0x374068[_0x3e5b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20b97b(null,util[_0x3e5b('0x15')]('%s-%s%s',path['basename'](_0x374068['originalname'],path[_0x3e5b('0x16')](_0x374068[_0x3e5b('0x14')])),Date[_0x3e5b('0x17')](),path['extname'](_0x374068[_0x3e5b('0x14')])));}})});router['post']('/',upload['single'](_0x3e5b('0x18')),controller[_0x3e5b('0x19')]);router['post'](_0x3e5b('0x1a'),controller[_0x3e5b('0x1b')]);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['update']);router['delete'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x1c')]);module[_0x3e5b('0x1d')]=router; \ No newline at end of file +var _0xcb99=['originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','join'];(function(_0x487624,_0x1174a2){var _0x13bbeb=function(_0x36b740){while(--_0x36b740){_0x487624['push'](_0x487624['shift']());}};_0x13bbeb(++_0x1174a2);}(_0xcb99,0x8b));var _0x9cb9=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xcb99[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require(_0x9cb9('0x0'));var util=require('util');var path=require(_0x9cb9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cb9('0x2')]();var fs_extra=require(_0x9cb9('0x3'));var auth=require(_0x9cb9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9cb9('0x5'));var controller=require(_0x9cb9('0x6'));router['get']('/',auth[_0x9cb9('0x7')](),controller['index']);router[_0x9cb9('0x8')](_0x9cb9('0x9'),controller[_0x9cb9('0xa')]);router[_0x9cb9('0x8')](_0x9cb9('0xb'),auth[_0x9cb9('0x7')](),controller[_0x9cb9('0xc')]);router[_0x9cb9('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x9cb9('0xd')]);var upload=multer({'storage':multer[_0x9cb9('0xe')]({'destination':function(_0x1b4fa6,_0x5a0ac7,_0x3be02c){_0x3be02c(null,path[_0x9cb9('0xf')](config['root'],'server/files/plugins'));},'filename':function(_0x227d49,_0x2e687e,_0x3382c8){_0x2e687e[_0x9cb9('0x10')]=_0x2e687e['originalname'][_0x9cb9('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3382c8(null,util[_0x9cb9('0x12')](_0x9cb9('0x13'),path[_0x9cb9('0x14')](_0x2e687e[_0x9cb9('0x10')],path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])),Date[_0x9cb9('0x16')](),path[_0x9cb9('0x15')](_0x2e687e[_0x9cb9('0x10')])));}})});router[_0x9cb9('0x17')]('/',upload[_0x9cb9('0x18')](_0x9cb9('0x19')),controller[_0x9cb9('0x1a')]);router[_0x9cb9('0x17')](_0x9cb9('0x9'),controller[_0x9cb9('0x1b')]);router[_0x9cb9('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9cb9('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 245dde0..d37ca07 100644 --- a/server/api/plugin/plugin.attributes.js +++ b/server/api/plugin/plugin.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11e0=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x2a4fe2,_0x3ec53a){var _0x225c4a=function(_0x1eccfa){while(--_0x1eccfa){_0x2a4fe2['push'](_0x2a4fe2['shift']());}};_0x225c4a(++_0x3ec53a);}(_0x11e0,0xc3));var _0x011e=function(_0x3a8f9b,_0xa6a7ca){_0x3a8f9b=_0x3a8f9b-0x0;var _0x30ae2b=_0x11e0[_0x3a8f9b];return _0x30ae2b;};'use strict';var Sequelize=require(_0x011e('0x0'));module[_0x011e('0x1')]={'name':{'type':Sequelize[_0x011e('0x2')]},'type':{'type':Sequelize[_0x011e('0x3')](_0x011e('0x4'),_0x011e('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x011e('0x6')]},'path':{'type':Sequelize[_0x011e('0x2')],'comment':_0x011e('0x7')},'active':{'type':Sequelize[_0x011e('0x8')],'defaultValue':0x0,'comment':_0x011e('0x9')},'sidebar':{'type':Sequelize[_0x011e('0x3')]('adminOnly','agentOnly','always','never'),'defaultValue':_0x011e('0xa'),'comment':_0x011e('0xb')},'icon':{'type':Sequelize[_0x011e('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x011e('0x2')]},'scriptName':{'type':Sequelize[_0x011e('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x724d=['script','TEXT','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','html'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x724d,0x13d));var _0xd724=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0x724d[_0x83af7f];return _0x32d85c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd724('0x0')]},'type':{'type':Sequelize[_0xd724('0x1')](_0xd724('0x2'),_0xd724('0x3'))},'description':{'type':Sequelize[_0xd724('0x4')]},'version':{'type':Sequelize[_0xd724('0x4')]},'path':{'type':Sequelize[_0xd724('0x0')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xd724('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xd724('0x6'),_0xd724('0x7'),_0xd724('0x8'),'never'),'defaultValue':'always','comment':_0xd724('0x9')},'icon':{'type':Sequelize[_0xd724('0x0')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xd724('0x0')]},'scriptName':{'type':Sequelize[_0xd724('0x0')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 2580f0f..21e4d0f 100644 --- a/server/api/plugin/plugin.controller.js +++ b/server/api/plugin/plugin.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc929=['Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','update','delete','find','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','squel','jsforce','querystring','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./plugin.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','reject','save','then','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','findAll','rows','catch','params','includeAll','include','options','download','path','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info'];(function(_0x3fd6ae,_0x332c75){var _0x204d55=function(_0xe316f3){while(--_0xe316f3){_0x3fd6ae['push'](_0x3fd6ae['shift']());}};_0x204d55(++_0x332c75);}(_0xc929,0xee));var _0x9c92=function(_0x4a1f95,_0x579846){_0x4a1f95=_0x4a1f95-0x0;var _0x2bed91=_0xc929[_0x4a1f95];return _0x2bed91;};'use strict';var emlformat=require(_0x9c92('0x0'));var rimraf=require(_0x9c92('0x1'));var zipdir=require(_0x9c92('0x2'));var jsonpatch=require(_0x9c92('0x3'));var rp=require(_0x9c92('0x4'));var moment=require(_0x9c92('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c92('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9c92('0x7'));var ejs=require(_0x9c92('0x8'));var fs=require('fs');var fs_extra=require(_0x9c92('0x9'));var _=require('lodash');var squel=require(_0x9c92('0xa'));var crypto=require('crypto');var jsforce=require(_0x9c92('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9c92('0x7'));var querystring=require(_0x9c92('0xc'));var Papa=require('papaparse');var extract=require(_0x9c92('0xd'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x9c92('0xe'));var authService=require(_0x9c92('0xf'));var qs=require(_0x9c92('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c92('0x11'))('api');var utils=require(_0x9c92('0x12'));var config=require(_0x9c92('0x13'));var licenseUtil=require(_0x9c92('0x14'));var db=require(_0x9c92('0x15'))['db'];config[_0x9c92('0x16')]=_[_0x9c92('0x17')](config[_0x9c92('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c92('0x16')]));require(_0x9c92('0x18'))[_0x9c92('0x19')](socket);function respondWithStatusCode(_0x1381a0,_0x2dc170){_0x2dc170=_0x2dc170||0xcc;return function(_0x33f6d0){if(_0x33f6d0){return _0x1381a0[_0x9c92('0x1a')](_0x2dc170);}return _0x1381a0['status'](_0x2dc170)[_0x9c92('0x1b')]();};}function respondWithResult(_0x4e589a,_0x195f4c){_0x195f4c=_0x195f4c||0xc8;return function(_0x3a7afe){if(_0x3a7afe){return _0x4e589a[_0x9c92('0x1c')](_0x195f4c)[_0x9c92('0x1d')](_0x3a7afe);}};}function respondWithFilteredResult(_0xc34fde,_0x2db3b3){return function(_0x197267){if(_0x197267){var _0x1d9ed1=typeof _0x2db3b3['offset']===_0x9c92('0x1e')&&typeof _0x2db3b3[_0x9c92('0x1f')]===_0x9c92('0x1e');var _0x48fea2=_0x197267[_0x9c92('0x20')];var _0x28944e=_0x1d9ed1?0x0:_0x2db3b3[_0x9c92('0x21')];var _0x5cef78=_0x1d9ed1?_0x197267['count']:_0x2db3b3[_0x9c92('0x21')]+_0x2db3b3[_0x9c92('0x1f')];var _0x2aeddc;if(_0x5cef78>=_0x48fea2){_0x5cef78=_0x48fea2;_0x2aeddc=0xc8;}else{_0x2aeddc=0xce;}_0xc34fde['status'](_0x2aeddc);return _0xc34fde[_0x9c92('0x22')]('Content-Range',_0x28944e+'-'+_0x5cef78+'/'+_0x48fea2)[_0x9c92('0x1d')](_0x197267);}return null;};}function patchUpdates(_0x38df88){return function(_0x2ef159){try{jsonpatch['apply'](_0x2ef159,_0x38df88,!![]);}catch(_0xb9962){return BPromise[_0x9c92('0x23')](_0xb9962);}return _0x2ef159[_0x9c92('0x24')]();};}function saveUpdates(_0x5646cd,_0x2a41a0){return function(_0x512041){if(_0x512041){return _0x512041['update'](_0x5646cd)[_0x9c92('0x25')](function(_0x108a5f){return _0x108a5f;});}return null;};}function removeEntity(_0x4d694c,_0x5ea3c2){return function(_0x4db889){if(_0x4db889){return _0x4db889['destroy']()[_0x9c92('0x25')](function(){var _0xcafdb6=_0x4db889[_0x9c92('0x26')]({'plain':!![]});var _0x4867dd='Plugins';return db[_0x9c92('0x27')]['destroy']({'where':{'type':_0x4867dd,'resourceId':_0xcafdb6['id']}})[_0x9c92('0x25')](function(){return _0x4db889;});})['then'](function(){_0x4d694c[_0x9c92('0x1c')](0xcc)[_0x9c92('0x1b')]();});}};}function handleEntityNotFound(_0x4d5c31,_0x1b6fb1){return function(_0x2aeb59){if(!_0x2aeb59){_0x4d5c31[_0x9c92('0x1a')](0x194);}return _0x2aeb59;};}function handleError(_0x4361cd,_0x5ddbb7){_0x5ddbb7=_0x5ddbb7||0x1f4;return function(_0x471571){logger[_0x9c92('0x28')](_0x471571[_0x9c92('0x29')]);if(_0x471571[_0x9c92('0x2a')]){delete _0x471571['name'];}_0x4361cd[_0x9c92('0x1c')](_0x5ddbb7)[_0x9c92('0x2b')](_0x471571);};}exports[_0x9c92('0x2c')]=function(_0x57d96f,_0x33db62){var _0x208a33={},_0x3900e8={},_0x59ed90={'count':0x0,'rows':[]};var _0x368691=_[_0x9c92('0x2d')](db[_0x9c92('0x2e')][_0x9c92('0x2f')],function(_0x11ab6a){return{'name':_0x11ab6a[_0x9c92('0x30')],'type':_0x11ab6a[_0x9c92('0x31')][_0x9c92('0x32')]};});_0x3900e8[_0x9c92('0x33')]=_['map'](_0x368691,'name');_0x3900e8[_0x9c92('0x34')]=_[_0x9c92('0x35')](_0x57d96f[_0x9c92('0x34')]);_0x3900e8[_0x9c92('0x36')]=_[_0x9c92('0x37')](_0x3900e8[_0x9c92('0x33')],_0x3900e8[_0x9c92('0x34')]);_0x208a33[_0x9c92('0x38')]=_[_0x9c92('0x37')](_0x3900e8[_0x9c92('0x33')],qs['fields'](_0x57d96f['query'][_0x9c92('0x39')]));_0x208a33[_0x9c92('0x38')]=_0x208a33[_0x9c92('0x38')][_0x9c92('0x3a')]?_0x208a33['attributes']:_0x3900e8['model'];if(!_0x57d96f[_0x9c92('0x34')][_0x9c92('0x3b')]('nolimit')){_0x208a33['limit']=qs[_0x9c92('0x1f')](_0x57d96f[_0x9c92('0x34')][_0x9c92('0x1f')]);_0x208a33['offset']=qs['offset'](_0x57d96f[_0x9c92('0x34')]['offset']);}_0x208a33[_0x9c92('0x3c')]=qs['sort'](_0x57d96f['query'][_0x9c92('0x3d')]);_0x208a33['where']=qs[_0x9c92('0x36')](_['pick'](_0x57d96f[_0x9c92('0x34')],_0x3900e8[_0x9c92('0x36')]),_0x368691);if(_0x57d96f[_0x9c92('0x34')][_0x9c92('0x3e')]){_0x208a33[_0x9c92('0x3f')]=_[_0x9c92('0x40')](_0x208a33[_0x9c92('0x3f')],{'$or':_[_0x9c92('0x2d')](_0x368691,function(_0x584697){if(_0x584697['type']!==_0x9c92('0x41')){var _0x23c12e={};_0x23c12e[_0x584697[_0x9c92('0x2a')]]={'$like':'%'+_0x57d96f['query'][_0x9c92('0x3e')]+'%'};return _0x23c12e;}})});}_0x208a33=_[_0x9c92('0x40')]({},_0x208a33,_0x57d96f['options']);var _0x4ce582={'where':_0x208a33['where']};return db[_0x9c92('0x2e')][_0x9c92('0x20')](_0x4ce582)[_0x9c92('0x25')](function(_0x5524f6){_0x59ed90[_0x9c92('0x20')]=_0x5524f6;if(_0x57d96f[_0x9c92('0x34')]['includeAll']){_0x208a33['include']=[{'all':!![]}];}return db['Plugin'][_0x9c92('0x42')](_0x208a33);})[_0x9c92('0x25')](function(_0x2db52b){_0x59ed90[_0x9c92('0x43')]=_0x2db52b;return _0x59ed90;})['then'](respondWithFilteredResult(_0x33db62,_0x208a33))[_0x9c92('0x44')](handleError(_0x33db62,null));};exports['show']=function(_0x2cf015,_0x6003c9){var _0x272459={'raw':!![],'where':{'id':_0x2cf015[_0x9c92('0x45')]['id']}},_0x479d9c={};_0x479d9c[_0x9c92('0x33')]=_[_0x9c92('0x35')](db[_0x9c92('0x2e')][_0x9c92('0x2f')]);_0x479d9c['query']=_[_0x9c92('0x35')](_0x2cf015[_0x9c92('0x34')]);_0x479d9c[_0x9c92('0x36')]=_[_0x9c92('0x37')](_0x479d9c[_0x9c92('0x33')],_0x479d9c['query']);_0x272459['attributes']=_['intersection'](_0x479d9c[_0x9c92('0x33')],qs[_0x9c92('0x39')](_0x2cf015[_0x9c92('0x34')][_0x9c92('0x39')]));_0x272459[_0x9c92('0x38')]=_0x272459['attributes'][_0x9c92('0x3a')]?_0x272459[_0x9c92('0x38')]:_0x479d9c[_0x9c92('0x33')];if(_0x2cf015[_0x9c92('0x34')][_0x9c92('0x46')]){_0x272459[_0x9c92('0x47')]=[{'all':!![]}];}_0x272459=_[_0x9c92('0x40')]({},_0x272459,_0x2cf015[_0x9c92('0x48')]);return db[_0x9c92('0x2e')]['find'](_0x272459)[_0x9c92('0x25')](handleEntityNotFound(_0x6003c9,null))[_0x9c92('0x25')](respondWithResult(_0x6003c9,null))[_0x9c92('0x44')](handleError(_0x6003c9,null));};exports[_0x9c92('0x49')]=function(_0x4dcba7,_0x58d811,_0xd1ca06){return db[_0x9c92('0x2e')]['find']({'where':{'id':_0x4dcba7[_0x9c92('0x45')]['id']},'attributes':['name',_0x9c92('0x4a')],'raw':!![]})[_0x9c92('0x25')](handleEntityNotFound(_0x58d811,null))[_0x9c92('0x25')](function(_0x558460){if(_0x558460){var _0x5ead9d=path[_0x9c92('0x4b')](config['root'],_0x9c92('0x4c'),util[_0x9c92('0x4d')](_0x9c92('0x4e'),path[_0x9c92('0x4f')](_0x558460['path'])));var _0x34f254=fs[_0x9c92('0x50')](_0x5ead9d);var _0x54a0be=archiver(_0x9c92('0x51'),{'zlib':{'level':0x9}});_0x54a0be['on']('warning',function(_0x476a9a){if(_0x476a9a[_0x9c92('0x52')]===_0x9c92('0x53')){logger[_0x9c92('0x28')](_0x476a9a);}else{throw new db[(_0x9c92('0x54'))][(_0x9c92('0x55'))](_0x9c92('0x56'));}});_0x54a0be['on'](_0x9c92('0x28'),function(_0x5526ae){throw new db[(_0x9c92('0x54'))]['Error'](_0x9c92('0x56'));});_0x54a0be[_0x9c92('0x57')](_0x34f254);_0x54a0be[_0x9c92('0x58')](_0x9c92('0x59'),{'cwd':path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],_0x9c92('0x4c'),path['dirname'](_0x558460[_0x9c92('0x4a')])),'ignore':[path['join'](path['basename'](_0x558460[_0x9c92('0x4a')]),'node_modules/**/*'),path[_0x9c92('0x4b')](path[_0x9c92('0x4f')](_0x558460[_0x9c92('0x4a')]),_0x9c92('0x5b'))],'nodir':!![]})[_0x9c92('0x5c')]();_0x34f254['on'](_0x9c92('0x5d'),function(){if(!fs[_0x9c92('0x5e')](_0x5ead9d)){throw new db[(_0x9c92('0x54'))][(_0x9c92('0x55'))]('Plugin\x20not\x20found');}return _0x58d811[_0x9c92('0x49')](_0x5ead9d,util[_0x9c92('0x4d')](_0x9c92('0x4e'),path[_0x9c92('0x4f')](_0x558460[_0x9c92('0x4a')])),function(_0x2e928a){if(_0x2e928a){throw new db[(_0x9c92('0x54'))]['Error'](_0x9c92('0x5f'));}fs[_0x9c92('0x60')](_0x5ead9d);logger[_0x9c92('0x61')](_0x9c92('0x62'));logger[_0x9c92('0x61')](_0x9c92('0x63'));});});}return null;})[_0x9c92('0x44')](handleError(_0x58d811,null));};exports[_0x9c92('0x64')]=function(_0x1e0744,_0x453580,_0x20c947){var _0x3d2cb5=path[_0x9c92('0x4f')](_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')],path['extname'](_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')]));var _0x4d2c64=path[_0x9c92('0x4b')](config['root'],'server/files/plugins',_0x1e0744[_0x9c92('0x65')][_0x9c92('0x66')]);var _0x49d9c4=path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],_0x9c92('0x4c'),_0x3d2cb5);logger[_0x9c92('0x61')](_0x9c92('0x67'),_0x4d2c64);logger[_0x9c92('0x61')](_0x9c92('0x68'),_0x49d9c4);try{fs[_0x9c92('0x69')](_0x4d2c64,parseInt(_0x9c92('0x6a'),0x8));extract(_0x4d2c64,{'dir':_0x49d9c4},function(_0x38cbfe){if(_0x38cbfe){logger[_0x9c92('0x28')](_0x38cbfe);handleError(_0x38cbfe,!![]);};var _0x2051a9=fs[_0x9c92('0x6b')](_0x49d9c4);if(_0x2051a9['length']>0x1){removeReferences(_0x4d2c64,_0x49d9c4);logger['error'](_0x9c92('0x6c'));return _0x20c947(new Error('Invalid\x20plugin\x20structure'));}var _0x57f54d=fs['lstatSync'](path['join'](_0x49d9c4,_0x2051a9[0x0]));if(_0x57f54d[_0x9c92('0x6d')]()){removeReferences(_0x4d2c64,_0x49d9c4);logger[_0x9c92('0x28')](_0x9c92('0x6c'));return _0x20c947(new Error(_0x9c92('0x6c')));}if(_0x57f54d[_0x9c92('0x6e')]()){var _0x14cd89=fs[_0x9c92('0x6b')](path[_0x9c92('0x4b')](_0x49d9c4,_0x2051a9[0x0]));if(_0x14cd89[_0x9c92('0x3a')]===0x0){removeReferences(_0x4d2c64,_0x49d9c4);logger[_0x9c92('0x28')](_0x9c92('0x6c'));return _0x20c947(new Error(_0x9c92('0x6c')));}var _0x25c645=_0x14cd89[_0x9c92('0x6f')](function(_0x3c280e){return _0x3c280e===_0x9c92('0x70');});if(!_0x25c645){return _0x20c947(new Error(_0x9c92('0x71')));}var _0x188f59=fs[_0x9c92('0x72')](path['join'](_0x49d9c4,_0x2051a9[0x0],'manifest.json'));var _0x3ef626=JSON[_0x9c92('0x73')](_0x188f59);if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x2a')]){return _0x20c947(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x31')]){return _0x20c947(new Error(_0x9c92('0x74')));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x75')]){return _0x20c947(new Error(_0x9c92('0x76')));}if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')]){return _0x20c947(new Error(_0x9c92('0x78')));}if(_0x3ef626[_0x9c92('0x31')]===_0x9c92('0x79')){if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]){return _0x20c947(new Error(_0x9c92('0x7b')));}if(_0x9c92('0x1e')==typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x7c')]&&_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]['agent']){return _0x20c947(new Error(_0x9c92('0x7d')));}}else if(_0x3ef626[_0x9c92('0x31')]===_0x9c92('0x7e')){if(_0x9c92('0x1e')==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7f')]){return _0x20c947(new Error(_0x9c92('0x80')));}if('undefined'==typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x81')]){return _0x20c947(new Error(_0x9c92('0x82')));}}else{return _0x20c947(new Error(_0x9c92('0x83')));}var _0x17c90f=_0x3ef626['name'];var _0x3fa001=_0x3ef626[_0x9c92('0x84')];var _0x27aca1=_0x3ef626[_0x9c92('0x31')];var _0x10a6a4=_0x3ef626[_0x9c92('0x85')]?_0x3ef626[_0x9c92('0x85')]:_0x9c92('0x86');var _0xc0505=_0x3ef626[_0x9c92('0x87')]?_0x3ef626[_0x9c92('0x87')]:_0x9c92('0x88');var _0x4b6b04='';var _0x4017b3='';var _0x17d6e5='';var _0x4c5df3='';var _0x48dd94=_0x3ef626[_0x9c92('0x75')];if(_0x27aca1==='html'){if(_0x9c92('0x1e')!=typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]['admin']){var _0x497d4a=_0x3ef626['parameters']['views'][_0x9c92('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x497d4a)){_0x4b6b04=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x497d4a);}else{_0x4b6b04=_0x497d4a;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x9c92('0x1e')!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x8b')]){var _0x2c7af9=_0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')][_0x9c92('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x2c7af9)){_0x4017b3=path[_0x9c92('0x4b')]('plugins',_0x3d2cb5,_0x2051a9[0x0],_0x2c7af9);}else{_0x4017b3=_0x2c7af9;}}else{logger[_0x9c92('0x61')](_0x9c92('0x8c'));}}else if(_0x27aca1===_0x9c92('0x7e')){_0x17d6e5=_0x3ef626['parameters'][_0x9c92('0x7f')];_0x4c5df3=_0x3ef626[_0x9c92('0x77')][_0x9c92('0x81')];if(_0x9c92('0x1e')!=typeof _0x3ef626[_0x9c92('0x77')][_0x9c92('0x7a')]){if('undefined'!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x7c')]){var _0x497d4a=_0x3ef626['parameters']['views'][_0x9c92('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x497d4a)){_0x4b6b04=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x497d4a);}else{_0x4b6b04=_0x497d4a;}}if(_0x9c92('0x1e')!=typeof _0x3ef626['parameters'][_0x9c92('0x7a')][_0x9c92('0x8b')]){var _0x2c7af9=_0x3ef626['parameters'][_0x9c92('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9c92('0x89')](_0x2c7af9)){_0x4017b3=path[_0x9c92('0x4b')](_0x9c92('0x8a'),_0x3d2cb5,_0x2051a9[0x0],_0x2c7af9);}else{_0x4017b3=_0x2c7af9;}}}}var _0x216258={'name':_0x17c90f,'description':_0x3fa001,'path':path[_0x9c92('0x4b')](_0x3d2cb5,_0x2051a9[0x0]),'type':_0x27aca1,'sidebar':_0x10a6a4,'icon':_0xc0505,'adminUrl':_0x4b6b04,'agentUrl':_0x4017b3,'scriptName':_0x17d6e5,'scriptPath':_0x4c5df3,'version':_0x48dd94};removeReferences(_0x4d2c64,null);return db[_0x9c92('0x2e')][_0x9c92('0x8d')](_0x216258)[_0x9c92('0x25')](function(_0x180fa6){var _0x2f886={'role':_0x1e0744['body'][_0x9c92('0x8e')],'userProfileId':_0x1e0744[_0x9c92('0x8f')][_0x9c92('0x90')]};if(!_0x2f886)throw new Error(_0x9c92('0x91'));if(_0x2f886[_0x9c92('0x8e')]===_0x9c92('0x92')){var _0x242d47=_0x180fa6[_0x9c92('0x26')]({'plain':!![]});return db[_0x9c92('0x93')]['find']({'where':{'name':'Plugins','userProfileId':_0x2f886[_0x9c92('0x90')]},'raw':!![]})[_0x9c92('0x25')](function(_0x11157d){if(_0x11157d&&_0x11157d[_0x9c92('0x94')]===0x0){return db[_0x9c92('0x27')][_0x9c92('0x8d')]({'name':_0x242d47[_0x9c92('0x2a')],'resourceId':_0x242d47['id'],'type':_0x11157d['name'],'sectionId':_0x11157d['id']},{})[_0x9c92('0x25')](function(){return _0x180fa6;});}else{return _0x180fa6;}})[_0x9c92('0x44')](function(_0x3b87c0){logger[_0x9c92('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b87c0);throw _0x3b87c0;});}return _0x180fa6;})[_0x9c92('0x25')](respondWithResult(_0x453580,null))[_0x9c92('0x44')](handleError(_0x453580,null));}});}catch(_0x1b4628){_0x453580[_0x9c92('0x1c')](0x1f4)[_0x9c92('0x2b')](_0x1b4628);}};function removeReferences(_0x662c33,_0x40e2c1){try{if(_0x662c33){fs[_0x9c92('0x60')](_0x662c33);logger[_0x9c92('0x61')](_0x9c92('0x95'));}if(_0x40e2c1){rimraf(_0x40e2c1,function(){});logger[_0x9c92('0x61')]('Extracted\x20folder\x20removed');}}catch(_0x40d324){logger[_0x9c92('0x28')](_0x40d324);}}exports[_0x9c92('0x96')]=function(_0x15b753,_0x4c68a5,_0x2ed5ff){return db[_0x9c92('0x2e')]['find']({'where':{'id':_0x15b753[_0x9c92('0x45')]['id']}})['then'](handleEntityNotFound(_0x4c68a5,null))[_0x9c92('0x25')](saveUpdates(_0x15b753[_0x9c92('0x8f')],null))['then'](respondWithResult(_0x4c68a5,null))[_0x9c92('0x44')](handleError(_0x4c68a5,null));};exports[_0x9c92('0x97')]=function(_0x1ec30e,_0x3b339e,_0x547a66){return db[_0x9c92('0x2e')][_0x9c92('0x98')]({'where':{'id':_0x1ec30e[_0x9c92('0x45')]['id']}})['then'](function(_0x141f27){if(_0x141f27){return _0x141f27['destroy']();}})[_0x9c92('0x25')](function(_0x88a69b){rimraf(path[_0x9c92('0x4b')](config[_0x9c92('0x5a')],'server/files/plugins',path['dirname'](_0x88a69b['path'])),function(){});return _0x88a69b;})[_0x9c92('0x25')](handleEntityNotFound(_0x3b339e,null))[_0x9c92('0x25')](respondWithStatusCode(_0x3b339e,null))[_0x9c92('0x44')](handleError(_0x3b339e,null));};exports['webhookGet']=function(_0x36ed5e,_0x87cd9d,_0xa0f221){return BPromise[_0x9c92('0x99')]()[_0x9c92('0x25')](function(){if(!_0x36ed5e['query'][_0x9c92('0x4a')]){throw new Error(_0x9c92('0x9a'));}if(!_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')]){throw new Error(_0x9c92('0x9c'));}var _0x361bf9=_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9d')]?_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9d')]+':'+_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')]:_0x9c92('0x9e')+_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9b')];var _0x2df32a=_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x1d')]?_0x36ed5e['query'][_0x9c92('0x1d')]:!![];var _0x3aa6f4=_0x36ed5e[_0x9c92('0x34')]['encoding']?_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x9f')]:null;var _0x3de6a9={'method':_0x36ed5e[_0x9c92('0xa0')],'uri':util['format'](_0x9c92('0xa1'),_0x361bf9,_0x36ed5e[_0x9c92('0x34')]['path']),'json':_0x2df32a,'resolveWithFullResponse':!![],'encoding':_0x3aa6f4,'qs':_0x36ed5e[_0x9c92('0x34')]};if(_0x36ed5e[_0x9c92('0xa2')]){_0x3de6a9[_0x9c92('0xa2')]=_0x36ed5e[_0x9c92('0xa2')];if(_0x3de6a9['headers'][_0x9c92('0xa3')]){delete _0x3de6a9[_0x9c92('0xa2')][_0x9c92('0xa3')];}}if(_0x3de6a9[_0x9c92('0xa2')]['content-type']){delete _0x3de6a9[_0x9c92('0xa2')][_0x9c92('0xa4')];}return rp(_0x3de6a9);})['then'](function(_0x28fe87){if(_0x28fe87){_0x87cd9d[_0x9c92('0x22')](_0x28fe87[_0x9c92('0xa2')]);logger[_0x9c92('0x61')](_0x28fe87[_0x9c92('0x8f')]);if(_[_0x9c92('0xa5')](_0x36ed5e[_0x9c92('0x34')][_0x9c92('0x4a')],_0x9c92('0x49'))&&_0x28fe87[_0x9c92('0xa6')]==0x1f4){return _0x87cd9d[_0x9c92('0x1a')](_0x28fe87[_0x9c92('0xa6')]);}else{return _0x87cd9d[_0x9c92('0x1c')](_0x28fe87[_0x9c92('0xa6')])[_0x9c92('0x2b')](_0x28fe87[_0x9c92('0x8f')]);}}else{return _0x87cd9d[_0x9c92('0x1a')](0xc8);}})[_0x9c92('0x44')](handleError(_0x87cd9d,null));};exports[_0x9c92('0xa7')]=function(_0x1cb25c,_0x45d231,_0x75d66){return BPromise[_0x9c92('0x99')]()[_0x9c92('0x25')](function(){if(!_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x4a')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9b')]){throw new Error(_0x9c92('0x9c'));}var _0x4dc9a4=_0x1cb25c['query'][_0x9c92('0x9d')]?_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9d')]+':'+_0x1cb25c['query'][_0x9c92('0x9b')]:_0x9c92('0x9e')+_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x9b')];var _0xfadbb6=_0x1cb25c['query'][_0x9c92('0x1d')]?_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x1d')]:!![];var _0x1c7136=_0x1cb25c['query'][_0x9c92('0x9f')]?_0x1cb25c['query'][_0x9c92('0x9f')]:null;var _0x52a2b6={'method':_0x1cb25c[_0x9c92('0xa0')],'uri':util[_0x9c92('0x4d')](_0x9c92('0xa1'),_0x4dc9a4,_0x1cb25c[_0x9c92('0x34')][_0x9c92('0x4a')]),'json':_0xfadbb6,'resolveWithFullResponse':!![],'encoding':_0x1c7136,'body':_0x1cb25c['body']};if(_0x1cb25c[_0x9c92('0xa2')]){_0x52a2b6[_0x9c92('0xa2')]=_0x1cb25c['headers'];if(_0x52a2b6[_0x9c92('0xa2')]['content-length']){delete _0x52a2b6['headers'][_0x9c92('0xa3')];}}if(_0x52a2b6[_0x9c92('0xa2')][_0x9c92('0xa4')]){delete _0x52a2b6[_0x9c92('0xa2')][_0x9c92('0xa4')];}return rp(_0x52a2b6);})[_0x9c92('0x25')](function(_0x1f0d60){if(_0x1f0d60){_0x45d231[_0x9c92('0x22')](_0x1f0d60[_0x9c92('0xa2')]);logger[_0x9c92('0x61')](_0x1f0d60[_0x9c92('0x8f')]);return _0x45d231[_0x9c92('0x1c')](_0x1f0d60[_0x9c92('0xa6')])[_0x9c92('0x2b')](_0x1f0d60[_0x9c92('0x8f')]);}else{return _0x45d231[_0x9c92('0x1a')](0xc8);}})['catch'](handleError(_0x45d231,null));}; \ No newline at end of file +var _0x2912=['util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','localhost','redis','./plugin.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','length','include','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','parameters','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','headers','content-length','content-type','endsWith','statusCode','sendStatus','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','%s%s','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x1c2fd7,_0x595cf1){var _0x369e9d=function(_0x12d274){while(--_0x12d274){_0x1c2fd7['push'](_0x1c2fd7['shift']());}};_0x369e9d(++_0x595cf1);}(_0x2912,0x143));var _0x2291=function(_0x2500e2,_0x2a42a2){_0x2500e2=_0x2500e2-0x0;var _0x4e0324=_0x2912[_0x2500e2];return _0x4e0324;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2291('0x0'));var zipdir=require(_0x2291('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2291('0x2'));var BPromise=require(_0x2291('0x3'));var Mustache=require(_0x2291('0x4'));var util=require(_0x2291('0x5'));var path=require(_0x2291('0x6'));var sox=require('sox');var csv=require(_0x2291('0x7'));var ejs=require(_0x2291('0x8'));var fs=require('fs');var fs_extra=require(_0x2291('0x9'));var _=require(_0x2291('0xa'));var squel=require('squel');var crypto=require(_0x2291('0xb'));var jsforce=require(_0x2291('0xc'));var deskjs=require(_0x2291('0xd'));var toCsv=require(_0x2291('0x7'));var querystring=require(_0x2291('0xe'));var Papa=require(_0x2291('0xf'));var extract=require('extract-zip');var rimraf=require(_0x2291('0x0'));var archiver=require('archiver');var Redis=require(_0x2291('0x10'));var authService=require(_0x2291('0x11'));var qs=require(_0x2291('0x12'));var as=require(_0x2291('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2291('0x14'))(_0x2291('0x15'));var utils=require(_0x2291('0x16'));var config=require(_0x2291('0x17'));var licenseUtil=require(_0x2291('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2291('0x19')](config['redis'],{'host':_0x2291('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2291('0x1b')]));require(_0x2291('0x1c'))[_0x2291('0x1d')](socket);function respondWithStatusCode(_0x40ddd2,_0x594003){_0x594003=_0x594003||0xcc;return function(_0x2931db){if(_0x2931db){return _0x40ddd2['sendStatus'](_0x594003);}return _0x40ddd2[_0x2291('0x1e')](_0x594003)['end']();};}function respondWithResult(_0x4aa34f,_0x4e849c){_0x4e849c=_0x4e849c||0xc8;return function(_0x55af35){if(_0x55af35){return _0x4aa34f[_0x2291('0x1e')](_0x4e849c)[_0x2291('0x1f')](_0x55af35);}};}function respondWithFilteredResult(_0x142541,_0x501860){return function(_0x36cbab){if(_0x36cbab){var _0x5ad0cf=typeof _0x501860[_0x2291('0x20')]===_0x2291('0x21')&&typeof _0x501860['limit']===_0x2291('0x21');var _0x12923f=_0x36cbab[_0x2291('0x22')];var _0x175c83=_0x5ad0cf?0x0:_0x501860[_0x2291('0x20')];var _0x42803d=_0x5ad0cf?_0x36cbab[_0x2291('0x22')]:_0x501860[_0x2291('0x20')]+_0x501860[_0x2291('0x23')];var _0x54dbfd;if(_0x42803d>=_0x12923f){_0x42803d=_0x12923f;_0x54dbfd=0xc8;}else{_0x54dbfd=0xce;}_0x142541[_0x2291('0x1e')](_0x54dbfd);return _0x142541[_0x2291('0x24')](_0x2291('0x25'),_0x175c83+'-'+_0x42803d+'/'+_0x12923f)[_0x2291('0x1f')](_0x36cbab);}return null;};}function patchUpdates(_0x24ea06){return function(_0x182ca3){try{jsonpatch[_0x2291('0x26')](_0x182ca3,_0x24ea06,!![]);}catch(_0x1682df){return BPromise['reject'](_0x1682df);}return _0x182ca3['save']();};}function saveUpdates(_0x53da96,_0x3af1a8){return function(_0x3b88b7){if(_0x3b88b7){return _0x3b88b7[_0x2291('0x27')](_0x53da96)[_0x2291('0x28')](function(_0x368630){return _0x368630;});}return null;};}function removeEntity(_0x10a4ce,_0x550a81){return function(_0x44d4ae){if(_0x44d4ae){return _0x44d4ae[_0x2291('0x29')]()[_0x2291('0x28')](function(){var _0x187574=_0x44d4ae[_0x2291('0x2a')]({'plain':!![]});var _0x129a28=_0x2291('0x2b');return db['UserProfileResource'][_0x2291('0x29')]({'where':{'type':_0x129a28,'resourceId':_0x187574['id']}})[_0x2291('0x28')](function(){return _0x44d4ae;});})[_0x2291('0x28')](function(){_0x10a4ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da2bd,_0x355a50){return function(_0xacf694){if(!_0xacf694){_0x3da2bd['sendStatus'](0x194);}return _0xacf694;};}function handleError(_0x3c62c7,_0x17a96a){_0x17a96a=_0x17a96a||0x1f4;return function(_0x10164f){logger[_0x2291('0x2c')](_0x10164f[_0x2291('0x2d')]);if(_0x10164f[_0x2291('0x2e')]){delete _0x10164f[_0x2291('0x2e')];}_0x3c62c7[_0x2291('0x1e')](_0x17a96a)[_0x2291('0x2f')](_0x10164f);};}exports[_0x2291('0x30')]=function(_0x62b2e1,_0x5b3d80){var _0x4b706b={},_0x2df368={},_0x4c2c65={'count':0x0,'rows':[]};var _0x390c22=_[_0x2291('0x31')](db[_0x2291('0x32')]['rawAttributes'],function(_0x209b82){return{'name':_0x209b82[_0x2291('0x33')],'type':_0x209b82[_0x2291('0x34')][_0x2291('0x35')]};});_0x2df368[_0x2291('0x36')]=_[_0x2291('0x31')](_0x390c22,_0x2291('0x2e'));_0x2df368['query']=_[_0x2291('0x37')](_0x62b2e1[_0x2291('0x38')]);_0x2df368['filters']=_['intersection'](_0x2df368[_0x2291('0x36')],_0x2df368[_0x2291('0x38')]);_0x4b706b[_0x2291('0x39')]=_[_0x2291('0x3a')](_0x2df368['model'],qs[_0x2291('0x3b')](_0x62b2e1[_0x2291('0x38')][_0x2291('0x3b')]));_0x4b706b['attributes']=_0x4b706b[_0x2291('0x39')]['length']?_0x4b706b['attributes']:_0x2df368[_0x2291('0x36')];if(!_0x62b2e1[_0x2291('0x38')][_0x2291('0x3c')](_0x2291('0x3d'))){_0x4b706b[_0x2291('0x23')]=qs[_0x2291('0x23')](_0x62b2e1[_0x2291('0x38')][_0x2291('0x23')]);_0x4b706b[_0x2291('0x20')]=qs[_0x2291('0x20')](_0x62b2e1['query'][_0x2291('0x20')]);}_0x4b706b[_0x2291('0x3e')]=qs[_0x2291('0x3f')](_0x62b2e1[_0x2291('0x38')][_0x2291('0x3f')]);_0x4b706b[_0x2291('0x40')]=qs[_0x2291('0x41')](_[_0x2291('0x42')](_0x62b2e1[_0x2291('0x38')],_0x2df368[_0x2291('0x41')]),_0x390c22);if(_0x62b2e1[_0x2291('0x38')]['filter']){_0x4b706b[_0x2291('0x40')]=_[_0x2291('0x43')](_0x4b706b[_0x2291('0x40')],{'$or':_[_0x2291('0x31')](_0x390c22,function(_0x40b2ac){if(_0x40b2ac[_0x2291('0x34')]!==_0x2291('0x44')){var _0xd879f9={};_0xd879f9[_0x40b2ac[_0x2291('0x2e')]]={'$like':'%'+_0x62b2e1[_0x2291('0x38')]['filter']+'%'};return _0xd879f9;}})});}_0x4b706b=_[_0x2291('0x43')]({},_0x4b706b,_0x62b2e1[_0x2291('0x45')]);var _0x4f4f63={'where':_0x4b706b['where']};return db[_0x2291('0x32')][_0x2291('0x22')](_0x4f4f63)['then'](function(_0x193f4d){_0x4c2c65[_0x2291('0x22')]=_0x193f4d;if(_0x62b2e1[_0x2291('0x38')]['includeAll']){_0x4b706b['include']=[{'all':!![]}];}return db[_0x2291('0x32')][_0x2291('0x46')](_0x4b706b);})['then'](function(_0x527176){_0x4c2c65[_0x2291('0x47')]=_0x527176;return _0x4c2c65;})[_0x2291('0x28')](respondWithFilteredResult(_0x5b3d80,_0x4b706b))[_0x2291('0x48')](handleError(_0x5b3d80,null));};exports[_0x2291('0x49')]=function(_0x2b498e,_0x5f4175){var _0x28c3af={'raw':!![],'where':{'id':_0x2b498e['params']['id']}},_0x2e0a10={};_0x2e0a10[_0x2291('0x36')]=_[_0x2291('0x37')](db[_0x2291('0x32')][_0x2291('0x4a')]);_0x2e0a10[_0x2291('0x38')]=_[_0x2291('0x37')](_0x2b498e[_0x2291('0x38')]);_0x2e0a10[_0x2291('0x41')]=_[_0x2291('0x3a')](_0x2e0a10['model'],_0x2e0a10[_0x2291('0x38')]);_0x28c3af[_0x2291('0x39')]=_[_0x2291('0x3a')](_0x2e0a10[_0x2291('0x36')],qs[_0x2291('0x3b')](_0x2b498e[_0x2291('0x38')][_0x2291('0x3b')]));_0x28c3af[_0x2291('0x39')]=_0x28c3af[_0x2291('0x39')][_0x2291('0x4b')]?_0x28c3af[_0x2291('0x39')]:_0x2e0a10[_0x2291('0x36')];if(_0x2b498e['query']['includeAll']){_0x28c3af[_0x2291('0x4c')]=[{'all':!![]}];}_0x28c3af=_[_0x2291('0x43')]({},_0x28c3af,_0x2b498e['options']);return db[_0x2291('0x32')][_0x2291('0x4d')](_0x28c3af)[_0x2291('0x28')](handleEntityNotFound(_0x5f4175,null))['then'](respondWithResult(_0x5f4175,null))[_0x2291('0x48')](handleError(_0x5f4175,null));};exports[_0x2291('0x4e')]=function(_0x2d9aad,_0x1532f3,_0x6715e){return db[_0x2291('0x32')][_0x2291('0x4d')]({'where':{'id':_0x2d9aad[_0x2291('0x4f')]['id']},'attributes':[_0x2291('0x2e'),_0x2291('0x6')],'raw':!![]})['then'](handleEntityNotFound(_0x1532f3,null))[_0x2291('0x28')](function(_0x4cd37f){if(_0x4cd37f){var _0x43cbcc=path[_0x2291('0x50')](config[_0x2291('0x51')],_0x2291('0x52'),util[_0x2291('0x53')](_0x2291('0x54'),path[_0x2291('0x55')](_0x4cd37f[_0x2291('0x6')])));var _0x161354=fs[_0x2291('0x56')](_0x43cbcc);var _0x7e679c=archiver(_0x2291('0x57'),{'zlib':{'level':0x9}});_0x7e679c['on']('warning',function(_0x2bc6b3){if(_0x2bc6b3[_0x2291('0x58')]===_0x2291('0x59')){logger['error'](_0x2bc6b3);}else{throw new db[(_0x2291('0x5a'))][(_0x2291('0x5b'))](_0x2291('0x5c'));}});_0x7e679c['on'](_0x2291('0x2c'),function(_0x51c15d){throw new db['Sequelize'][(_0x2291('0x5b'))](_0x2291('0x5c'));});_0x7e679c[_0x2291('0x5d')](_0x161354);_0x7e679c[_0x2291('0x5e')]('**/*',{'cwd':path[_0x2291('0x50')](config[_0x2291('0x51')],_0x2291('0x52'),path['dirname'](_0x4cd37f[_0x2291('0x6')])),'ignore':[path[_0x2291('0x50')](path[_0x2291('0x55')](_0x4cd37f[_0x2291('0x6')]),'node_modules/**/*'),path[_0x2291('0x50')](path[_0x2291('0x55')](_0x4cd37f['path']),'attachments/**/*')],'nodir':!![]})[_0x2291('0x5f')]();_0x161354['on'](_0x2291('0x60'),function(){if(!fs[_0x2291('0x61')](_0x43cbcc)){throw new db[(_0x2291('0x5a'))][(_0x2291('0x5b'))]('Plugin\x20not\x20found');}return _0x1532f3[_0x2291('0x4e')](_0x43cbcc,util['format'](_0x2291('0x54'),path['basename'](_0x4cd37f[_0x2291('0x6')])),function(_0x589182){if(_0x589182){throw new db[(_0x2291('0x5a'))][(_0x2291('0x5b'))](_0x2291('0x62'));}fs[_0x2291('0x63')](_0x43cbcc);logger[_0x2291('0x64')](_0x2291('0x65'));logger['info'](_0x2291('0x66'));});});}return null;})[_0x2291('0x48')](handleError(_0x1532f3,null));};exports['upload']=function(_0x4c648c,_0x719c0e,_0x1f1462){var _0x4606cf=path[_0x2291('0x55')](_0x4c648c[_0x2291('0x67')]['filename'],path['extname'](_0x4c648c['file'][_0x2291('0x68')]));var _0x248d87=path[_0x2291('0x50')](config['root'],_0x2291('0x52'),_0x4c648c[_0x2291('0x67')][_0x2291('0x68')]);var _0x46b702=path['join'](config['root'],'server/files/plugins',_0x4606cf);logger[_0x2291('0x64')](_0x2291('0x69'),_0x248d87);logger[_0x2291('0x64')](_0x2291('0x6a'),_0x46b702);try{fs[_0x2291('0x6b')](_0x248d87,parseInt(_0x2291('0x6c'),0x8));extract(_0x248d87,{'dir':_0x46b702},function(_0x1dc063){if(_0x1dc063){logger[_0x2291('0x2c')](_0x1dc063);handleError(_0x1dc063,!![]);};var _0x193eb9=fs['readdirSync'](_0x46b702);if(_0x193eb9[_0x2291('0x4b')]>0x1){removeReferences(_0x248d87,_0x46b702);logger[_0x2291('0x2c')](_0x2291('0x6d'));return _0x1f1462(new Error(_0x2291('0x6d')));}var _0x560696=fs[_0x2291('0x6e')](path[_0x2291('0x50')](_0x46b702,_0x193eb9[0x0]));if(_0x560696['isFile']()){removeReferences(_0x248d87,_0x46b702);logger['error']('Invalid\x20plugin\x20structure');return _0x1f1462(new Error(_0x2291('0x6d')));}if(_0x560696[_0x2291('0x6f')]()){var _0x1213ec=fs[_0x2291('0x70')](path[_0x2291('0x50')](_0x46b702,_0x193eb9[0x0]));if(_0x1213ec[_0x2291('0x4b')]===0x0){removeReferences(_0x248d87,_0x46b702);logger[_0x2291('0x2c')](_0x2291('0x6d'));return _0x1f1462(new Error('Invalid\x20plugin\x20structure'));}var _0x47470a=_0x1213ec[_0x2291('0x71')](function(_0x36b93e){return _0x36b93e==='manifest.json';});if(!_0x47470a){return _0x1f1462(new Error(_0x2291('0x72')));}var _0x1f6d24=fs[_0x2291('0x73')](path[_0x2291('0x50')](_0x46b702,_0x193eb9[0x0],'manifest.json'));var _0x432ce1=JSON[_0x2291('0x74')](_0x1f6d24);if(_0x2291('0x21')==typeof _0x432ce1['name']){return _0x1f1462(new Error(_0x2291('0x75')));}if(_0x2291('0x21')==typeof _0x432ce1[_0x2291('0x34')]){return _0x1f1462(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x2291('0x21')==typeof _0x432ce1['version']){return _0x1f1462(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x432ce1['parameters']){return _0x1f1462(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x432ce1[_0x2291('0x34')]==='html'){if('undefined'==typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')]){return _0x1f1462(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x2291('0x21')==typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x78')]&&_0x2291('0x21')==typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')]['agent']){return _0x1f1462(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x432ce1[_0x2291('0x34')]===_0x2291('0x79')){if(_0x2291('0x21')==typeof _0x432ce1['parameters'][_0x2291('0x7a')]){return _0x1f1462(new Error(_0x2291('0x7b')));}if(_0x2291('0x21')==typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x7c')]){return _0x1f1462(new Error(_0x2291('0x7d')));}}else{return _0x1f1462(new Error(_0x2291('0x7e')));}var _0x4b4014=_0x432ce1[_0x2291('0x2e')];var _0x2f0996=_0x432ce1['description'];var _0x3183e7=_0x432ce1[_0x2291('0x34')];var _0x346e06=_0x432ce1['sidebar']?_0x432ce1[_0x2291('0x7f')]:_0x2291('0x80');var _0x572115=_0x432ce1[_0x2291('0x81')]?_0x432ce1[_0x2291('0x81')]:_0x2291('0x82');var _0x3828c2='';var _0x173575='';var _0xc94efe='';var _0x5b2f49='';var _0x4ee327=_0x432ce1[_0x2291('0x83')];if(_0x3183e7==='html'){if(_0x2291('0x21')!=typeof _0x432ce1['parameters']['views'][_0x2291('0x78')]){var _0x3bc303=_0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x2291('0x84')](_0x3bc303)){_0x3828c2=path['join']('plugins',_0x4606cf,_0x193eb9[0x0],_0x3bc303);}else{_0x3828c2=_0x3bc303;}}else{logger[_0x2291('0x64')](_0x2291('0x85'));}if(_0x2291('0x21')!=typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x86')]){var _0x4c6d46=_0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x2291('0x84')](_0x4c6d46)){_0x173575=path['join'](_0x2291('0x87'),_0x4606cf,_0x193eb9[0x0],_0x4c6d46);}else{_0x173575=_0x4c6d46;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x3183e7===_0x2291('0x79')){_0xc94efe=_0x432ce1['parameters'][_0x2291('0x7a')];_0x5b2f49=_0x432ce1[_0x2291('0x76')][_0x2291('0x7c')];if(_0x2291('0x21')!=typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')]){if(_0x2291('0x21')!=typeof _0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x78')]){var _0x3bc303=_0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x78')];if(!/^(f|ht)tps?:\/\//i[_0x2291('0x84')](_0x3bc303)){_0x3828c2=path['join'](_0x2291('0x87'),_0x4606cf,_0x193eb9[0x0],_0x3bc303);}else{_0x3828c2=_0x3bc303;}}if(_0x2291('0x21')!=typeof _0x432ce1['parameters'][_0x2291('0x77')][_0x2291('0x86')]){var _0x4c6d46=_0x432ce1[_0x2291('0x76')][_0x2291('0x77')][_0x2291('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x2291('0x84')](_0x4c6d46)){_0x173575=path[_0x2291('0x50')](_0x2291('0x87'),_0x4606cf,_0x193eb9[0x0],_0x4c6d46);}else{_0x173575=_0x4c6d46;}}}}var _0x293deb={'name':_0x4b4014,'description':_0x2f0996,'path':path[_0x2291('0x50')](_0x4606cf,_0x193eb9[0x0]),'type':_0x3183e7,'sidebar':_0x346e06,'icon':_0x572115,'adminUrl':_0x3828c2,'agentUrl':_0x173575,'scriptName':_0xc94efe,'scriptPath':_0x5b2f49,'version':_0x4ee327};removeReferences(_0x248d87,null);return db[_0x2291('0x32')]['create'](_0x293deb)[_0x2291('0x28')](function(_0x152b9b){var _0x296883={'role':_0x4c648c[_0x2291('0x88')]['role'],'userProfileId':_0x4c648c[_0x2291('0x88')][_0x2291('0x89')]};if(!_0x296883)throw new Error(_0x2291('0x8a'));if(_0x296883[_0x2291('0x8b')]===_0x2291('0x8c')){var _0x47cead=_0x152b9b[_0x2291('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x2291('0x4d')]({'where':{'name':_0x2291('0x2b'),'userProfileId':_0x296883[_0x2291('0x89')]},'raw':!![]})[_0x2291('0x28')](function(_0x421404){if(_0x421404&&_0x421404[_0x2291('0x8d')]===0x0){return db[_0x2291('0x8e')][_0x2291('0x8f')]({'name':_0x47cead[_0x2291('0x2e')],'resourceId':_0x47cead['id'],'type':_0x421404[_0x2291('0x2e')],'sectionId':_0x421404['id']},{})['then'](function(){return _0x152b9b;});}else{return _0x152b9b;}})[_0x2291('0x48')](function(_0x1f3b84){logger[_0x2291('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f3b84);throw _0x1f3b84;});}return _0x152b9b;})[_0x2291('0x28')](respondWithResult(_0x719c0e,null))['catch'](handleError(_0x719c0e,null));}});}catch(_0x286e2a){_0x719c0e['status'](0x1f4)[_0x2291('0x2f')](_0x286e2a);}};function removeReferences(_0x1adc17,_0xb29950){try{if(_0x1adc17){fs[_0x2291('0x63')](_0x1adc17);logger[_0x2291('0x64')](_0x2291('0x90'));}if(_0xb29950){rimraf(_0xb29950,function(){});logger[_0x2291('0x64')](_0x2291('0x91'));}}catch(_0x1d082d){logger[_0x2291('0x2c')](_0x1d082d);}}exports[_0x2291('0x27')]=function(_0x192ea3,_0x278118,_0x592981){return db['Plugin'][_0x2291('0x4d')]({'where':{'id':_0x192ea3[_0x2291('0x4f')]['id']}})[_0x2291('0x28')](handleEntityNotFound(_0x278118,null))[_0x2291('0x28')](saveUpdates(_0x192ea3['body'],null))[_0x2291('0x28')](respondWithResult(_0x278118,null))[_0x2291('0x48')](handleError(_0x278118,null));};exports[_0x2291('0x92')]=function(_0x37acf4,_0x365f8c,_0x3d6276){return db[_0x2291('0x32')][_0x2291('0x4d')]({'where':{'id':_0x37acf4[_0x2291('0x4f')]['id']}})['then'](function(_0x1eaa0e){if(_0x1eaa0e){return _0x1eaa0e[_0x2291('0x29')]();}})[_0x2291('0x28')](function(_0x55b547){rimraf(path[_0x2291('0x50')](config['root'],_0x2291('0x52'),path[_0x2291('0x93')](_0x55b547[_0x2291('0x6')])),function(){});return _0x55b547;})['then'](handleEntityNotFound(_0x365f8c,null))[_0x2291('0x28')](respondWithStatusCode(_0x365f8c,null))[_0x2291('0x48')](handleError(_0x365f8c,null));};exports[_0x2291('0x94')]=function(_0x5b185d,_0x5b0d4c,_0x3844ef){return BPromise[_0x2291('0x95')]()['then'](function(){if(!_0x5b185d[_0x2291('0x38')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x5b185d[_0x2291('0x38')][_0x2291('0x96')]){throw new Error(_0x2291('0x97'));}var _0x44ec93=_0x5b185d[_0x2291('0x38')][_0x2291('0x98')]?_0x5b185d[_0x2291('0x38')][_0x2291('0x98')]+':'+_0x5b185d[_0x2291('0x38')][_0x2291('0x96')]:_0x2291('0x99')+_0x5b185d['query'][_0x2291('0x96')];var _0x3136c4=_0x5b185d[_0x2291('0x38')][_0x2291('0x1f')]?_0x5b185d[_0x2291('0x38')]['json']:!![];var _0x32603a=_0x5b185d[_0x2291('0x38')]['encoding']?_0x5b185d['query']['encoding']:null;var _0x1cc293={'method':_0x5b185d[_0x2291('0x9a')],'uri':util[_0x2291('0x53')]('%s%s',_0x44ec93,_0x5b185d[_0x2291('0x38')]['path']),'json':_0x3136c4,'resolveWithFullResponse':!![],'encoding':_0x32603a,'qs':_0x5b185d[_0x2291('0x38')]};if(_0x5b185d[_0x2291('0x9b')]){_0x1cc293['headers']=_0x5b185d[_0x2291('0x9b')];if(_0x1cc293[_0x2291('0x9b')][_0x2291('0x9c')]){delete _0x1cc293['headers'][_0x2291('0x9c')];}}if(_0x1cc293[_0x2291('0x9b')]['content-type']){delete _0x1cc293[_0x2291('0x9b')][_0x2291('0x9d')];}return rp(_0x1cc293);})[_0x2291('0x28')](function(_0x2ff2a8){if(_0x2ff2a8){_0x5b0d4c[_0x2291('0x24')](_0x2ff2a8['headers']);logger[_0x2291('0x64')](_0x2ff2a8[_0x2291('0x88')]);if(_[_0x2291('0x9e')](_0x5b185d['query'][_0x2291('0x6')],_0x2291('0x4e'))&&_0x2ff2a8[_0x2291('0x9f')]==0x1f4){return _0x5b0d4c['sendStatus'](_0x2ff2a8[_0x2291('0x9f')]);}else{return _0x5b0d4c[_0x2291('0x1e')](_0x2ff2a8[_0x2291('0x9f')])['send'](_0x2ff2a8[_0x2291('0x88')]);}}else{return _0x5b0d4c[_0x2291('0xa0')](0xc8);}})['catch'](handleError(_0x5b0d4c,null));};exports['webhookPost']=function(_0x571949,_0x5452fb,_0x39cded){return BPromise[_0x2291('0x95')]()[_0x2291('0x28')](function(){if(!_0x571949[_0x2291('0x38')][_0x2291('0x6')]){throw new Error(_0x2291('0xa1'));}if(!_0x571949[_0x2291('0x38')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x17b374=_0x571949[_0x2291('0x38')]['hostname']?_0x571949[_0x2291('0x38')][_0x2291('0x98')]+':'+_0x571949[_0x2291('0x38')][_0x2291('0x96')]:'http://localhost:'+_0x571949['query'][_0x2291('0x96')];var _0x1e806e=_0x571949['query'][_0x2291('0x1f')]?_0x571949[_0x2291('0x38')]['json']:!![];var _0x5af8d5=_0x571949[_0x2291('0x38')][_0x2291('0xa2')]?_0x571949['query']['encoding']:null;var _0x350314={'method':_0x571949[_0x2291('0x9a')],'uri':util[_0x2291('0x53')](_0x2291('0xa3'),_0x17b374,_0x571949['query'][_0x2291('0x6')]),'json':_0x1e806e,'resolveWithFullResponse':!![],'encoding':_0x5af8d5,'body':_0x571949[_0x2291('0x88')]};if(_0x571949[_0x2291('0x9b')]){_0x350314[_0x2291('0x9b')]=_0x571949[_0x2291('0x9b')];if(_0x350314[_0x2291('0x9b')]['content-length']){delete _0x350314[_0x2291('0x9b')][_0x2291('0x9c')];}}if(_0x350314[_0x2291('0x9b')]['content-type']){delete _0x350314[_0x2291('0x9b')][_0x2291('0x9d')];}return rp(_0x350314);})[_0x2291('0x28')](function(_0x330fce){if(_0x330fce){_0x5452fb[_0x2291('0x24')](_0x330fce[_0x2291('0x9b')]);logger[_0x2291('0x64')](_0x330fce[_0x2291('0x88')]);return _0x5452fb[_0x2291('0x1e')](_0x330fce['statusCode'])['send'](_0x330fce[_0x2291('0x88')]);}else{return _0x5452fb[_0x2291('0xa0')](0xc8);}})[_0x2291('0x48')](handleError(_0x5452fb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e663e75..173dcfa 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86b8=['save','remove','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86b8,0x15d));var _0x886b=function(_0x1912c2,_0x3557b6){_0x1912c2=_0x1912c2-0x0;var _0x316758=_0x86b8[_0x1912c2];return _0x316758;};'use strict';var EventEmitter=require(_0x886b('0x0'));var Plugin=require(_0x886b('0x1'))['db'][_0x886b('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x886b('0x3'),'afterUpdate':'update','afterDestroy':_0x886b('0x4')};function emitEvent(_0x8d89c9){return function(_0x4191fb,_0x4d3769,_0xc815){PluginEvents['emit'](_0x8d89c9+':'+_0x4191fb['id'],_0x4191fb);PluginEvents['emit'](_0x8d89c9,_0x4191fb);_0xc815(null);};}for(var e in events){if(events[_0x886b('0x5')](e)){var event=events[e];Plugin[_0x886b('0x6')](e,emitEvent(event));}}module[_0x886b('0x7')]=PluginEvents; \ No newline at end of file +var _0xbeea=['emit','exports','events','Plugin','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeea,0xb1));var _0xabee=function(_0x4f4e77,_0x55d8cf){_0x4f4e77=_0x4f4e77-0x0;var _0x4e864e=_0xbeea[_0x4f4e77];return _0x4e864e;};'use strict';var EventEmitter=require(_0xabee('0x0'));var Plugin=require('../../mysqldb')['db'][_0xabee('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xabee('0x2')](0x0);var events={'afterCreate':_0xabee('0x3'),'afterUpdate':'update','afterDestroy':_0xabee('0x4')};function emitEvent(_0x59e264){return function(_0x58afa7,_0x33571e,_0x2fb6d9){PluginEvents[_0xabee('0x5')](_0x59e264+':'+_0x58afa7['id'],_0x58afa7);PluginEvents[_0xabee('0x5')](_0x59e264,_0x58afa7);_0x2fb6d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xabee('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 04946d6..e00acd1 100644 --- a/server/api/plugin/plugin.model.js +++ b/server/api/plugin/plugin.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c21=['exports','define','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x28555c,_0x13b4fa){var _0x39fd51=function(_0x5c489f){while(--_0x5c489f){_0x28555c['push'](_0x28555c['shift']());}};_0x39fd51(++_0x13b4fa);}(_0x9c21,0x100));var _0x19c2=function(_0x431e8e,_0x482fd7){_0x431e8e=_0x431e8e-0x0;var _0x53396c=_0x9c21[_0x431e8e];return _0x53396c;};'use strict';var _=require(_0x19c2('0x0'));var util=require(_0x19c2('0x1'));var logger=require(_0x19c2('0x2'))(_0x19c2('0x3'));var moment=require('moment');var BPromise=require(_0x19c2('0x4'));var rp=require(_0x19c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19c2('0x6'));var attributes=require(_0x19c2('0x7'));module[_0x19c2('0x8')]=function(_0x50a979,_0x4b513e){return _0x50a979[_0x19c2('0x9')]('Plugin',attributes,{'tableName':_0x19c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5994=['request-promise','path','rimraf','./plugin.attributes','Plugin','plugins','lodash','api','moment','bluebird'];(function(_0x4178d2,_0x152f22){var _0x253b0a=function(_0x391385){while(--_0x391385){_0x4178d2['push'](_0x4178d2['shift']());}};_0x253b0a(++_0x152f22);}(_0x5994,0xa6));var _0x4599=function(_0x210387,_0x466130){_0x210387=_0x210387-0x0;var _0x4f0224=_0x5994[_0x210387];return _0x4f0224;};'use strict';var _=require(_0x4599('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4599('0x1'));var moment=require(_0x4599('0x2'));var BPromise=require(_0x4599('0x3'));var rp=require(_0x4599('0x4'));var fs=require('fs');var path=require(_0x4599('0x5'));var rimraf=require(_0x4599('0x6'));var config=require('../../config/environment');var attributes=require(_0x4599('0x7'));module['exports']=function(_0x162c4a,_0x3aff19){return _0x162c4a['define'](_0x4599('0x8'),attributes,{'tableName':_0x4599('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index a95577e..45c7442 100644 --- a/server/api/plugin/plugin.rpc.js +++ b/server/api/plugin/plugin.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22c4=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','create','body','raw','randomstring','ioredis','../../mysqldb'];(function(_0x1aa8e5,_0x432789){var _0x51f4cf=function(_0xbfe90f){while(--_0xbfe90f){_0x1aa8e5['push'](_0x1aa8e5['shift']());}};_0x51f4cf(++_0x432789);}(_0x22c4,0x169));var _0x422c=function(_0x1293fa,_0x446d6b){_0x1293fa=_0x1293fa-0x0;var _0x1dd054=_0x22c4[_0x1293fa];return _0x1dd054;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x422c('0x0'));var fs=require('fs');var Redis=require(_0x422c('0x1'));var db=require(_0x422c('0x2'))['db'];var utils=require(_0x422c('0x3'));var logger=require(_0x422c('0x4'))('rpc');var config=require(_0x422c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x422c('0x6')][_0x422c('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x422c('0x8')],{'host':_0x422c('0x9'),'port':0x18eb});var socket=require(_0x422c('0xa'))(new Redis(config['redis']));require(_0x422c('0xb'))['register'](socket);function respondWithRpcPromise(_0x1d7f3d,_0x16150e,_0x3e384d){return new BPromise(function(_0x56574c,_0x3b069e){return client[_0x422c('0xc')](_0x1d7f3d,_0x3e384d)[_0x422c('0xd')](function(_0x2f3d6d){logger[_0x422c('0xe')]('Plugin,\x20%s,\x20%s',_0x16150e,_0x422c('0xf'));logger[_0x422c('0x10')](_0x422c('0x11'),_0x16150e,_0x422c('0xf'),JSON[_0x422c('0x12')](_0x2f3d6d));if(_0x2f3d6d[_0x422c('0x13')]){if(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x14')]===0x1f4){logger[_0x422c('0x13')](_0x422c('0x15'),_0x16150e,_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);return _0x3b069e(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);}logger['error'](_0x422c('0x15'),_0x16150e,_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);return _0x56574c(_0x2f3d6d[_0x422c('0x13')][_0x422c('0x16')]);}else{logger[_0x422c('0xe')](_0x422c('0x15'),_0x16150e,'request\x20sent');_0x56574c(_0x2f3d6d['result']['message']);}})[_0x422c('0x17')](function(_0x2d89a4){logger['error'](_0x422c('0x15'),_0x16150e,_0x2d89a4);_0x3b069e(_0x2d89a4);});});}exports[_0x422c('0x18')]=function(_0x44b6d7){var _0x3ae2a2=this;return new Promise(function(_0x37af38,_0x541462){return db['Plugin'][_0x422c('0x19')](_0x44b6d7[_0x422c('0x1a')],{'raw':_0x44b6d7['options']?_0x44b6d7['options'][_0x422c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x258d66){logger[_0x422c('0xe')](_0x422c('0x18'),_0x44b6d7);logger[_0x422c('0x10')](_0x422c('0x18'),_0x44b6d7,JSON[_0x422c('0x12')](_0x258d66));_0x37af38(_0x258d66);})[_0x422c('0x17')](function(_0x320cb4){logger['error'](_0x422c('0x18'),_0x320cb4[_0x422c('0x16')],_0x44b6d7);_0x541462(_0x3ae2a2['error'](0x1f4,_0x320cb4['message']));});});}; \ No newline at end of file +var _0x6c1e=['error','code','message','info','result','catch','CreatePlugin','create','body','options','raw','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','register','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x159902,_0x2f808c){var _0x128878=function(_0x5ee91e){while(--_0x5ee91e){_0x159902['push'](_0x159902['shift']());}};_0x128878(++_0x2f808c);}(_0x6c1e,0x1bf));var _0xe6c1=function(_0x10bb32,_0x3970a2){_0x10bb32=_0x10bb32-0x0;var _0x2fd0eb=_0x6c1e[_0x10bb32];return _0x2fd0eb;};'use strict';var _=require(_0xe6c1('0x0'));var util=require(_0xe6c1('0x1'));var moment=require('moment');var BPromise=require(_0xe6c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6c1('0x3'));var db=require(_0xe6c1('0x4'))['db'];var utils=require(_0xe6c1('0x5'));var logger=require('../../config/logger')(_0xe6c1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe6c1('0x7')][_0xe6c1('0x8')]({'port':0x232a});config[_0xe6c1('0x9')]=_[_0xe6c1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6c1('0x9')]));require('./plugin.socket')[_0xe6c1('0xb')](socket);function respondWithRpcPromise(_0x4a4a10,_0x15b78c,_0x41f90c){return new BPromise(function(_0x2c4de4,_0x1a1aa2){return client['request'](_0x4a4a10,_0x41f90c)[_0xe6c1('0xc')](function(_0x1d7a11){logger['info'](_0xe6c1('0xd'),_0x15b78c,_0xe6c1('0xe'));logger['debug'](_0xe6c1('0xf'),_0x15b78c,_0xe6c1('0xe'),JSON[_0xe6c1('0x10')](_0x1d7a11));if(_0x1d7a11['error']){if(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x12')]===0x1f4){logger[_0xe6c1('0x11')](_0xe6c1('0xd'),_0x15b78c,_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);return _0x1a1aa2(_0x1d7a11[_0xe6c1('0x11')][_0xe6c1('0x13')]);}logger[_0xe6c1('0x11')]('Plugin,\x20%s,\x20%s',_0x15b78c,_0x1d7a11['error'][_0xe6c1('0x13')]);return _0x2c4de4(_0x1d7a11['error'][_0xe6c1('0x13')]);}else{logger[_0xe6c1('0x14')](_0xe6c1('0xd'),_0x15b78c,'request\x20sent');_0x2c4de4(_0x1d7a11[_0xe6c1('0x15')]['message']);}})[_0xe6c1('0x16')](function(_0x20723a){logger[_0xe6c1('0x11')]('Plugin,\x20%s,\x20%s',_0x15b78c,_0x20723a);_0x1a1aa2(_0x20723a);});});}exports[_0xe6c1('0x17')]=function(_0x128f78){var _0x2772b0=this;return new Promise(function(_0x59bc9b,_0xe87a7d){return db['Plugin'][_0xe6c1('0x18')](_0x128f78[_0xe6c1('0x19')],{'raw':_0x128f78[_0xe6c1('0x1a')]?_0x128f78[_0xe6c1('0x1a')][_0xe6c1('0x1b')]===undefined?!![]:![]:!![]})[_0xe6c1('0xc')](function(_0x4a3adc){logger[_0xe6c1('0x14')]('CreatePlugin',_0x128f78);logger[_0xe6c1('0x1c')]('CreatePlugin',_0x128f78,JSON[_0xe6c1('0x10')](_0x4a3adc));_0x59bc9b(_0x4a3adc);})[_0xe6c1('0x16')](function(_0x4f9a9a){logger[_0xe6c1('0x11')](_0xe6c1('0x17'),_0x4f9a9a[_0xe6c1('0x13')],_0x128f78);_0xe87a7d(_0x2772b0[_0xe6c1('0x11')](0x1f4,_0x4f9a9a['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 11ef486..17eabcb 100644 --- a/server/api/plugin/plugin.socket.js +++ b/server/api/plugin/plugin.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa67=['./plugin.events','save','remove','plugin:'];(function(_0x3928f9,_0x55401e){var _0x56d3a4=function(_0x5e4a84){while(--_0x5e4a84){_0x3928f9['push'](_0x3928f9['shift']());}};_0x56d3a4(++_0x55401e);}(_0xaa67,0x114));var _0x7aa6=function(_0x3f21ba,_0x244d2a){_0x3f21ba=_0x3f21ba-0x0;var _0x16eb8c=_0xaa67[_0x3f21ba];return _0x16eb8c;};'use strict';var PluginEvents=require(_0x7aa6('0x0'));var events=[_0x7aa6('0x1'),_0x7aa6('0x2'),'update'];function createListener(_0x14867f,_0x4b05bf){return function(_0x3cd711){_0x4b05bf['emit'](_0x14867f,_0x3cd711);};}function removeListener(_0xc620fa,_0x2afb1c){return function(){PluginEvents['removeListener'](_0xc620fa,_0x2afb1c);};}exports['register']=function(_0x104174){for(var _0x286d15=0x0,_0x15b3ba=events['length'];_0x286d15<_0x15b3ba;_0x286d15++){var _0x313546=events[_0x286d15];var _0x1612d6=createListener(_0x7aa6('0x3')+_0x313546,_0x104174);PluginEvents['on'](_0x313546,_0x1612d6);}}; \ No newline at end of file +var _0xdc09=['length','plugin:','save','remove','update','emit','removeListener'];(function(_0x1b26ac,_0x5ea577){var _0x2d88ec=function(_0x4d6110){while(--_0x4d6110){_0x1b26ac['push'](_0x1b26ac['shift']());}};_0x2d88ec(++_0x5ea577);}(_0xdc09,0x79));var _0x9dc0=function(_0x27f5de,_0x577080){_0x27f5de=_0x27f5de-0x0;var _0x484149=_0xdc09[_0x27f5de];return _0x484149;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x9dc0('0x0'),_0x9dc0('0x1'),_0x9dc0('0x2')];function createListener(_0x51c538,_0x408205){return function(_0x1a834f){_0x408205[_0x9dc0('0x3')](_0x51c538,_0x1a834f);};}function removeListener(_0x534785,_0x58dcf6){return function(){PluginEvents[_0x9dc0('0x4')](_0x534785,_0x58dcf6);};}exports['register']=function(_0x5da59e){for(var _0x1a201b=0x0,_0x1f3769=events[_0x9dc0('0x5')];_0x1a201b<_0x1f3769;_0x1a201b++){var _0x2ad542=events[_0x1a201b];var _0x3ad358=createListener(_0x9dc0('0x6')+_0x2ad542,_0x5da59e);PluginEvents['on'](_0x2ad542,_0x3ad358);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index df2dbf5..8f3ac5e 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2ff5a5,_0x1486bd){var _0x404527=function(_0x50cfae){while(--_0x50cfae){_0x2ff5a5['push'](_0x2ff5a5['shift']());}};_0x404527(++_0x1486bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x19f3b4,_0x209209){var _0x125ae7=function(_0x36fc2d){while(--_0x36fc2d){_0x19f3b4['push'](_0x19f3b4['shift']());}};_0x125ae7(++_0x209209);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 93c1333..def24e4 100644 --- a/server/api/pm2/pm2.controller.js +++ b/server/api/pm2/pm2.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['path','exec','bluebird','sendStatus','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','express','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/logger','api'];(function(_0x136e6f,_0x3ad8bb){var _0x292f67=function(_0x54c4a8){while(--_0x54c4a8){_0x136e6f['push'](_0x136e6f['shift']());}};_0x292f67(++_0x3ad8bb);}(_0xdace,0xc5));var _0xedac=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xdace[_0x8dc04d];return _0x2f5f28;};'use strict';var _=require(_0xedac('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var path=require(_0xedac('0x3'));var exec=require('child_process')[_0xedac('0x4')];var BPromise=require(_0xedac('0x5'));function handleEntityNotFound(_0x15d3bd,_0xefb142){return function(_0x5a97c0){if(!_0x5a97c0){_0x15d3bd[_0xedac('0x6')](0x194);;}return _0x5a97c0;};}function respondWithResult(_0x1cba89,_0x39328a){_0x39328a=_0x39328a||0xc8;return function(_0x5ecbd3){if(_0x5ecbd3){return _0x1cba89[_0xedac('0x7')](_0x39328a)[_0xedac('0x8')](_0x5ecbd3);}return null;};}function handleError(_0x162eea,_0x53fa43){_0x53fa43=_0x53fa43||0x1f4;return function(_0x27243f){logger[_0xedac('0x9')](_0x27243f[_0xedac('0xa')]);if(_0x27243f['name']){delete _0x27243f['name'];}_0x162eea[_0xedac('0x7')](_0x53fa43)[_0xedac('0xb')](_0x27243f);};}function execChildProcess(){return new BPromise(function(_0x57e1bf,_0x4d6a29){exec(_0xedac('0xc'),function(_0x25395d,_0x57f637,_0x261401){logger['info'](_0x57f637);logger[_0xedac('0xd')](_0x261401);if(_0x25395d){logger[_0xedac('0x9')](_0x25395d);return _0x4d6a29(_0x25395d);}return _0x57e1bf(_0x57f637);});});}exports[_0xedac('0xe')]=function(_0x342186,_0x9a79a0){return pm2[_0xedac('0xf')]()[_0xedac('0x10')](function(_0x11f0b0){if(_0x11f0b0){var _0x593030=_[_0xedac('0x11')](_0x11f0b0,function(_0x4651d4){return _0x4651d4[_0xedac('0x12')]===_0xedac('0x13')||_0x4651d4[_0xedac('0x12')]==='motion2';});return{'rows':_0x593030,'count':_0x593030[_0xedac('0x14')]};}return null;})['then'](respondWithResult(_0x9a79a0,null))[_0xedac('0x15')](handleError(_0x9a79a0,null));};exports[_0xedac('0x16')]=function(_0xdad128,_0xba0c93){return pm2['describe'](_0xdad128['params']['id'])[_0xedac('0x10')](respondWithResult(_0xba0c93,null))[_0xedac('0x10')](handleEntityNotFound(_0xba0c93,null))[_0xedac('0x15')](handleError(_0xba0c93,null));};exports[_0xedac('0x17')]=function(_0x5a5438,_0x4a699b){if(_0x5a5438[_0xedac('0x18')][_0xedac('0x12')]&&_0x5a5438[_0xedac('0x18')][_0xedac('0x19')]){var _0x2f5eee=path[_0xedac('0x1a')](__dirname,_0xedac('0x1b'),_0x5a5438[_0xedac('0x18')]['script']);var _0x4593e8=process['cwd']();process[_0xedac('0x1c')](path[_0xedac('0x1d')](_0x2f5eee));return execChildProcess()['then'](function(_0x46e09d){process[_0xedac('0x1c')](_0x4593e8);return pm2[_0xedac('0x1e')]({'name':_0x5a5438[_0xedac('0x18')][_0xedac('0x12')],'script':_0x2f5eee});})[_0xedac('0x10')](function(_0x5d7c31){pm2[_0xedac('0x1f')]();return _0x5d7c31[0x0];})[_0xedac('0x10')](respondWithResult(_0x4a699b,0xc9))[_0xedac('0x15')](handleError(_0x4a699b,null));}else{return _0x4a699b[_0xedac('0x7')](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x20')});}};exports[_0xedac('0x21')]=function(_0x26c6f7,_0x409825){if(_0x26c6f7[_0xedac('0x18')]['id']){delete _0x26c6f7['body']['id'];}var _0x25d7f5={'online':_0xedac('0x22'),'stopped':_0xedac('0x23')};if(_0x25d7f5['hasOwnProperty'](_0x26c6f7[_0xedac('0x18')]['status'])){return pm2[_0x25d7f5[_0x26c6f7['body'][_0xedac('0x7')]]](_0x26c6f7[_0xedac('0x24')]['id'])[_0xedac('0x10')](respondWithResult(_0x409825,0xc8))[_0xedac('0x15')](handleError(_0x409825,null));}else{return _0x409825['status'](0x1f4)['send']({'message':_0xedac('0x25')});}};exports[_0xedac('0x26')]=function(_0x24b182,_0x2ee8d7){if(_0x24b182[_0xedac('0x18')]['id']){delete _0x24b182[_0xedac('0x18')]['id'];}if(_0x24b182[_0xedac('0x24')]['id']){return pm2['delete'](_0x24b182[_0xedac('0x24')]['id'])[_0xedac('0x10')](function(_0x2cbe33){pm2['dump']();return _0x2cbe33[0x0];})[_0xedac('0x10')](respondWithResult(_0x2ee8d7,null))[_0xedac('0x15')](handleError(_0x2ee8d7,null));}else{return _0x2ee8d7['status'](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x27')});}}; \ No newline at end of file +var _0xe205=['cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','reject','express','length','then','catch','show','describe','params','body','script'];(function(_0x35b4c1,_0x5df37a){var _0xbeeb09=function(_0x481dcf){while(--_0x481dcf){_0x35b4c1['push'](_0x35b4c1['shift']());}};_0xbeeb09(++_0x5df37a);}(_0xe205,0xa7));var _0x5e20=function(_0x291858,_0x1301c5){_0x291858=_0x291858-0x0;var _0x32cb6d=_0xe205[_0x291858];return _0x32cb6d;};'use strict';var _=require(_0x5e20('0x0'));var pm2=require(_0x5e20('0x1'));var logger=require(_0x5e20('0x2'))(_0x5e20('0x3'));var path=require(_0x5e20('0x4'));var exec=require(_0x5e20('0x5'))[_0x5e20('0x6')];var BPromise=require(_0x5e20('0x7'));function handleEntityNotFound(_0x37c5e9,_0x4ac934){return function(_0x1a6198){if(!_0x1a6198){_0x37c5e9[_0x5e20('0x8')](0x194);;}return _0x1a6198;};}function respondWithResult(_0x44dbb3,_0x3c4203){_0x3c4203=_0x3c4203||0xc8;return function(_0x5eca5c){if(_0x5eca5c){return _0x44dbb3['status'](_0x3c4203)[_0x5e20('0x9')](_0x5eca5c);}return null;};}function handleError(_0x4c9332,_0x533e18){_0x533e18=_0x533e18||0x1f4;return function(_0x30b757){logger[_0x5e20('0xa')](_0x30b757['stack']);if(_0x30b757[_0x5e20('0xb')]){delete _0x30b757[_0x5e20('0xb')];}_0x4c9332[_0x5e20('0xc')](_0x533e18)[_0x5e20('0xd')](_0x30b757);};}function execChildProcess(){return new BPromise(function(_0x5cb51d,_0x349613){exec(_0x5e20('0xe'),function(_0x270689,_0x27f1f9,_0x165824){logger[_0x5e20('0xf')](_0x27f1f9);logger['info'](_0x165824);if(_0x270689){logger[_0x5e20('0xa')](_0x270689);return _0x349613(_0x270689);}return _0x5cb51d(_0x27f1f9);});});}exports[_0x5e20('0x10')]=function(_0x22540d,_0x5868c0){return pm2[_0x5e20('0x11')]()['then'](function(_0x1f47f3){if(_0x1f47f3){var _0x5ba833=_[_0x5e20('0x12')](_0x1f47f3,function(_0x330cdf){return _0x330cdf[_0x5e20('0xb')]===_0x5e20('0x13')||_0x330cdf[_0x5e20('0xb')]==='motion2';});return{'rows':_0x5ba833,'count':_0x5ba833[_0x5e20('0x14')]};}return null;})[_0x5e20('0x15')](respondWithResult(_0x5868c0,null))[_0x5e20('0x16')](handleError(_0x5868c0,null));};exports[_0x5e20('0x17')]=function(_0x2f194b,_0x3b353f){return pm2[_0x5e20('0x18')](_0x2f194b[_0x5e20('0x19')]['id'])['then'](respondWithResult(_0x3b353f,null))[_0x5e20('0x15')](handleEntityNotFound(_0x3b353f,null))[_0x5e20('0x16')](handleError(_0x3b353f,null));};exports['create']=function(_0x295eb3,_0x1b1457){if(_0x295eb3[_0x5e20('0x1a')][_0x5e20('0xb')]&&_0x295eb3['body'][_0x5e20('0x1b')]){var _0x50f222=path['join'](__dirname,'../../files/plugins',_0x295eb3['body'][_0x5e20('0x1b')]);var _0x5cca90=process[_0x5e20('0x1c')]();process[_0x5e20('0x1d')](path[_0x5e20('0x1e')](_0x50f222));return execChildProcess()[_0x5e20('0x15')](function(_0x3ef7fa){process[_0x5e20('0x1d')](_0x5cca90);return pm2['start']({'name':_0x295eb3[_0x5e20('0x1a')]['name'],'script':_0x50f222});})['then'](function(_0x33993a){pm2[_0x5e20('0x1f')]();return _0x33993a[0x0];})[_0x5e20('0x15')](respondWithResult(_0x1b1457,0xc9))[_0x5e20('0x16')](handleError(_0x1b1457,null));}else{return _0x1b1457[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x20')});}};exports['update']=function(_0x3bf4f4,_0x420f63){if(_0x3bf4f4[_0x5e20('0x1a')]['id']){delete _0x3bf4f4[_0x5e20('0x1a')]['id'];}var _0x4c799d={'online':_0x5e20('0x21'),'stopped':_0x5e20('0x22')};if(_0x4c799d[_0x5e20('0x23')](_0x3bf4f4[_0x5e20('0x1a')][_0x5e20('0xc')])){return pm2[_0x4c799d[_0x3bf4f4[_0x5e20('0x1a')]['status']]](_0x3bf4f4[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](respondWithResult(_0x420f63,0xc8))['catch'](handleError(_0x420f63,null));}else{return _0x420f63[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':_0x5e20('0x24')});}};exports[_0x5e20('0x25')]=function(_0x1548c8,_0x395a27){if(_0x1548c8['body']['id']){delete _0x1548c8[_0x5e20('0x1a')]['id'];}if(_0x1548c8[_0x5e20('0x19')]['id']){return pm2[_0x5e20('0x26')](_0x1548c8[_0x5e20('0x19')]['id'])[_0x5e20('0x15')](function(_0x1ac162){pm2[_0x5e20('0x1f')]();return _0x1ac162[0x0];})[_0x5e20('0x15')](respondWithResult(_0x395a27,null))[_0x5e20('0x16')](handleError(_0x395a27,null));}else{return _0x395a27[_0x5e20('0xc')](0x1f4)[_0x5e20('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index ebcf0ae..e810517 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb76e=['get','/agents','getAgents','/queues','isAuthenticated','getQueues','exports','express','../../components/auth/service','./realtime.controller'];(function(_0x23e1b0,_0x3908e3){var _0x5f365b=function(_0x2d96ee){while(--_0x2d96ee){_0x23e1b0['push'](_0x23e1b0['shift']());}};_0x5f365b(++_0x3908e3);}(_0xb76e,0xe3));var _0xeb76=function(_0x125b17,_0x225947){_0x125b17=_0x125b17-0x0;var _0x2701de=_0xb76e[_0x125b17];return _0x2701de;};'use strict';var express=require(_0xeb76('0x0'));var router=express['Router']();var auth=require(_0xeb76('0x1'));var controller=require(_0xeb76('0x2'));router[_0xeb76('0x3')](_0xeb76('0x4'),auth['isAuthenticated'](),controller[_0xeb76('0x5')]);router[_0xeb76('0x3')](_0xeb76('0x6'),auth[_0xeb76('0x7')](),controller[_0xeb76('0x8')]);module[_0xeb76('0x9')]=router; \ No newline at end of file +var _0x07e2=['Router','../../components/auth/service','get','/agents','isAuthenticated','exports','express'];(function(_0x37678b,_0x3d0b6f){var _0x36e532=function(_0x341a1c){while(--_0x341a1c){_0x37678b['push'](_0x37678b['shift']());}};_0x36e532(++_0x3d0b6f);}(_0x07e2,0x16b));var _0x207e=function(_0x353cdd,_0x5f56ba){_0x353cdd=_0x353cdd-0x0;var _0x500afa=_0x07e2[_0x353cdd];return _0x500afa;};'use strict';var express=require(_0x207e('0x0'));var router=express[_0x207e('0x1')]();var auth=require(_0x207e('0x2'));var controller=require('./realtime.controller');router[_0x207e('0x3')](_0x207e('0x4'),auth[_0x207e('0x5')](),controller['getAgents']);router['get']('/queues',auth[_0x207e('0x5')](),controller['getQueues']);module[_0x207e('0x6')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2a796b4..f2fed28 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa28e=['voiceStatus','paused','agents','User','Queue','findAll','QueueId','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','idle','voicePause','pause','chatStatus','faxStatus','mailStatus','smsStatus','unknown','*pause','mail','chat','sms','openchannel','whatsapp','includes','toLowerCase','isArray','map','getAgents','value','split','globalStatus','order','startsWith','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','query','channel','sort','fields','join','globalQueueFilter','rawAttributes','fieldName','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','globalStatusFilter','getQueues','resolve','type','QueueCampaigns','Queues','all','util','lodash','jayson/promise','../../components/parsers/qs','../../mysqldb','client','http','offset','undefined','limit','count','status','Content-Range','json','error','stack','name','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','waiting','talking','outbound','push','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','get','loggedIn','busy','pTalking','merge','pick','filter','queue','some','internal','toString','getMembers','length','find','UserId','accountcode','online'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0xa28e,0xff));var _0xea28=function(_0x2bced3,_0x59c962){_0x2bced3=_0x2bced3-0x0;var _0x5d9a81=_0xa28e[_0x2bced3];return _0x5d9a81;};'use strict';var util=require(_0xea28('0x0'));var _=require(_0xea28('0x1'));var jayson=require(_0xea28('0x2'));var qs=require(_0xea28('0x3'));var logger=require('../../config/logger')('api');var db=require(_0xea28('0x4'))['db'];var amiClient=jayson[_0xea28('0x5')][_0xea28('0x6')]({'port':0x232a});var routingClient=jayson[_0xea28('0x5')][_0xea28('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3a9299,_0x535df4){return function(_0x49284b){if(_0x49284b){var _0x4e78ea=typeof _0x535df4[_0xea28('0x7')]===_0xea28('0x8')&&typeof _0x535df4[_0xea28('0x9')]===_0xea28('0x8');var _0xc23b1d=_0x49284b[_0xea28('0xa')];var _0x1b1501=_0x4e78ea?0x0:_0x535df4['offset'];var _0x1c50d4=_0x4e78ea?_0x49284b[_0xea28('0xa')]:_0x535df4['offset']+_0x535df4[_0xea28('0x9')];var _0x321935;if(_0x1c50d4>=_0xc23b1d){_0x1c50d4=_0xc23b1d;_0x321935=0xc8;}else{_0x321935=0xce;}_0x3a9299[_0xea28('0xb')](_0x321935);return _0x3a9299['set'](_0xea28('0xc'),_0x1b1501+'-'+_0x1c50d4+'/'+_0xc23b1d)[_0xea28('0xd')](_0x49284b);}return null;};}function handleError(_0x174cca,_0x3bd115){_0x3bd115=_0x3bd115||0x1f4;return function(_0x32a04c){logger[_0xea28('0xe')](_0x32a04c[_0xea28('0xf')]);if(_0x32a04c[_0xea28('0x10')]){delete _0x32a04c[_0xea28('0x10')];}_0x174cca[_0xea28('0xb')](_0x3bd115)[_0xea28('0x11')](_0x32a04c);};}function getRealtimeAgents(){return new Promise(function(_0xd88f0,_0x5278f3){return amiClient[_0xea28('0x12')]('Agents',{})[_0xea28('0x13')](function(_0x27b898){if(_0x27b898[_0xea28('0xe')])throw new Error(_0xea28('0x14'));var _0x482a39=_0x27b898[_0xea28('0x15')];return routingClient[_0xea28('0x12')](_0xea28('0x16'),{})['then'](function(_0x5d7a16){if(_0x5d7a16[_0xea28('0xe')])throw new Error(_0xea28('0x17'));var _0x5714f7=_0x5d7a16['result'];return _0xd88f0(_['merge']({},_0x482a39,_0x5714f7));});})[_0xea28('0x18')](function(_0x2e525e){_0x5278f3(_0x2e525e);});});}function getRealtimeQueues(_0x3df771,_0x418f38){return new Promise(function(_0x255959,_0x5a8ddd){var _0x1cf6f0=_0x418f38===_0xea28('0x19')?amiClient:routingClient;return _0x1cf6f0[_0xea28('0x12')](_[_0xea28('0x1a')](_0x418f38)+'Queues',_0x3df771)[_0xea28('0x13')](function(_0x1099ff){if(_0x1099ff[_0xea28('0xe')])throw new Error(util[_0xea28('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x418f38));return _0x255959(_0x1099ff['result']);})[_0xea28('0x18')](function(_0x21ce07){_0x5a8ddd(_0x21ce07);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2b7ecf,_0x12ef3d){return amiClient['request'](_0xea28('0x1c'),{})[_0xea28('0x13')](function(_0x116ad2){if(_0x116ad2[_0xea28('0xe')])throw new Error(_0xea28('0x1d'));return _0x2b7ecf(_0x116ad2['result']);})[_0xea28('0x18')](function(_0x13d020){_0x12ef3d(_0x13d020);});});}function initializeQueues(_0x1f8b5d,_0x34f0f6,_0x900f44,_0x172ec7){var _0x30cd31=['loggedIn',_0xea28('0x1e'),_0xea28('0x1f'),_0xea28('0x20'),'paused'];if(_0x900f44==='voice'&&_0x172ec7===_0xea28('0x21')){_0x30cd31[_0xea28('0x22')]('pTalking',_0xea28('0x23'),'message',_0xea28('0x24'),_0xea28('0x25'),_0xea28('0x26'),_0xea28('0x27'),_0xea28('0x28'),_0xea28('0x29'),_0xea28('0x2a'),_0xea28('0x2b'),_0xea28('0x2c'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0xea28('0x2d'),_0xea28('0x2e'),'predictiveIntervalTotalCalls',_0xea28('0x2f'),_0xea28('0x30'),_0xea28('0x31'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x1f8b5d['map'](function(_0x1c1bee){var _0x43625b=_0x1c1bee[_0xea28('0x32')]({'plain':!![]});_0x43625b['agents']=[];_0x43625b['paused']=0x0;_0x43625b['loggedInDb']=0x0;_0x43625b[_0xea28('0x33')]=0x0;_0x43625b[_0xea28('0x1e')]=0x0;_0x43625b['waiting']=0x0;if(_0x900f44==='voice'){_0x43625b[_0xea28('0x20')]=0x0;_0x43625b[_0xea28('0x34')]=0x0;if(_0x172ec7===_0xea28('0x21')){_0x43625b[_0xea28('0x35')]=0x0;_0x43625b[_0xea28('0x23')]=0x0;}}var _0x5b56d1=_['find'](_0x34f0f6,['id',_0x43625b['id']]);if(_0x5b56d1)_[_0xea28('0x36')](_0x43625b,_[_0xea28('0x37')](_0x5b56d1,_0x30cd31));return _0x43625b;});}function updateAgentVoiceStatus(_0x46979f,_0x391503,_0x33eae6){var _0x238bd0=_[_0xea28('0x38')](_0x33eae6,[_0xea28('0x39'),_0x391503['name']]);if(_0x238bd0['length']===0x0)return _0x46979f[_0xea28('0x34')]=!![];if(_[_0xea28('0x3a')](_0x238bd0,['connectedlinenum',_0x46979f[_0xea28('0x3b')][_0xea28('0x3c')]()]))return _0x46979f[_0xea28('0x20')]=!![];if(!_0x46979f[_0xea28('0x20')])return _0x46979f[_0xea28('0x34')]=!![];}function getVoiceQueueAgents(_0x745409,_0x1e60f9,_0x3c3448,_0x37131a){var _0x2f2bf2=_['find'](_0x1e60f9,['id',_0x745409['id']]);if(!_0x2f2bf2)return _0x745409;return _0x2f2bf2[_0xea28('0x3d')]({'raw':!![]})[_0xea28('0x13')](function(_0x39ae0d){for(var _0x1218bd=0x0;_0x1218bd<_0x39ae0d[_0xea28('0x3e')];_0x1218bd++){var _0x3d22c8=_[_0xea28('0x3f')](_0x3c3448,['id',_0x39ae0d[_0x1218bd][_0xea28('0x40')]]);if(!_0x3d22c8){_0x3d22c8={'id':_0x39ae0d[_0x1218bd][_0xea28('0x40')],'name':_0x39ae0d[_0x1218bd][_0xea28('0x40')],'accountcode':'','online':![]};}var _0x608949={'id':_0x3d22c8['id'],'name':_0x3d22c8['name'],'internal':_0x3d22c8[_0xea28('0x41')],'online':Boolean(_0x3d22c8[_0xea28('0x42')]),'paused':Boolean(_0x39ae0d[_0x1218bd]['paused'])};if(_0x3d22c8[_0xea28('0x43')]===_0xea28('0x20'))updateAgentVoiceStatus(_0x608949,_0x745409,_0x37131a);if(_0x608949[_0xea28('0x42')])_0x745409['loggedInDb']++;if(_0x608949[_0xea28('0x34')])_0x745409[_0xea28('0x34')]++;if(_0x608949[_0xea28('0x44')]&&!_0x608949[_0xea28('0x34')]&&!_0x608949[_0xea28('0x20')])_0x745409[_0xea28('0x44')]++;_0x745409[_0xea28('0x45')]['push'](_0x608949);}return _0x745409;});}function getQueueAgents(_0x316075,_0x2cb4dc,_0x2d33e8){var _0x4921be=_0xea28('0x46')+_[_0xea28('0x1a')](_0x2d33e8)+_0xea28('0x47');var _0xf2584a=_0x2d33e8+'Pause';return db[_0x4921be][_0xea28('0x48')]({'where':{[_[_0xea28('0x1a')](_0x2d33e8)+_0xea28('0x49')]:_0x316075['id']},'raw':!![]})[_0xea28('0x13')](function(_0x3a29e0){for(var _0xfbbc35=0x0;_0xfbbc35<_0x3a29e0[_0xea28('0x3e')];_0xfbbc35++){var _0x1b353e=_['find'](_0x2cb4dc,['id',_0x3a29e0[_0xfbbc35][_0xea28('0x40')]]);if(!_0x1b353e){_0x1b353e={'id':_0x3a29e0[_0xfbbc35][_0xea28('0x40')],'name':_0x3a29e0[_0xfbbc35][_0xea28('0x40')],'online':![],['pauseField']:![]};}var _0x354748={'id':_0x1b353e['id'],'name':_0x1b353e['name'],'online':Boolean(_0x1b353e['online']),'paused':Boolean(_0x1b353e[_0xf2584a])};if(_0x354748[_0xea28('0x42')])_0x316075['loggedInDb']++;_0x316075[_0xea28('0x45')][_0xea28('0x22')](_0x354748);}return _0x316075;});}function isIdle(_0x14e340){return _0x14e340==='idle'||_0x14e340==='unknown'||_0x14e340==='unavailable'||_0x14e340===_0xea28('0x4a')||_[_0xea28('0x4b')](_0x14e340);}function isAgentPaused(_0x3508a0,_0x27df23){var _0x2e9bbd=[_0x3508a0[_0xea28('0x4c')],_0x3508a0[_0xea28('0x4d')],_0x3508a0[_0xea28('0x4e')],_0x3508a0[_0xea28('0x4f')],_0x3508a0[_0xea28('0x50')],_0x3508a0['voicePause'],_0x3508a0[_0xea28('0x51')]];if(!_0x27df23)return _[_0xea28('0x52')](_0x2e9bbd);var _0x3d6d94=_['filter'](_0x2e9bbd);return _0x3d6d94[_0xea28('0x3e')]>0x0&&_0x3d6d94[_0xea28('0x3e')]<_0x2e9bbd[_0xea28('0x3e')]?!![]:![];}function isAgentIdle(_0x402382){if(_0x402382[_0xea28('0x43')]!==_0xea28('0x53')&&_0x402382[_0xea28('0x54')]){_0x402382[_0xea28('0x43')]=_0xea28('0x55');return![];}return _[_0xea28('0x52')]([_0x402382[_0xea28('0x56')],_0x402382[_0xea28('0x57')],_0x402382[_0xea28('0x58')],_0x402382['openchannelStatus'],_0x402382[_0xea28('0x59')],_0x402382[_0xea28('0x43')],_0x402382['whatsappStatus']],isIdle);}function getAgentStatus(_0x41b0e2){var _0x385432=_0xea28('0x5a');if(isAgentPaused(_0x41b0e2))_0x385432=_0xea28('0x55');else if(isAgentPaused(_0x41b0e2,!![]))_0x385432=_0xea28('0x5b');else if(isAgentIdle(_0x41b0e2))_0x385432=_0xea28('0x53');else _0x385432='busy';return _0x385432;}function validateChannel(_0x4d70f4){var _0x519b26=[_0xea28('0x5c'),_0xea28('0x5d'),_0xea28('0x5e'),_0xea28('0x5f'),'fax',_0xea28('0x60'),_0xea28('0x19')];if(!_[_0xea28('0x61')](_0x519b26,_0x4d70f4['toLowerCase']()))throw new Error('Invalid\x20channel');return _0x4d70f4[_0xea28('0x62')]();}function getFilteredAgentIds(_0x30b9cd,_0x2efaa9){var _0x4ef814=_[_0xea28('0x63')](_0x30b9cd)?_0x30b9cd:[_0x30b9cd];var _0x29c94e=_[_0xea28('0x64')](_0x4ef814,function(_0x267d46){return db[_0x2efaa9]['findOne']({'where':{'name':_0x267d46}})[_0xea28('0x13')](function(_0xbb3259){if(!_0xbb3259)return[];return _0xbb3259[_0xea28('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x29c94e)[_0xea28('0x13')](function(_0x4f3735){var _0xd437e2=_(_0x4f3735)['flatten']()['map']('id')['uniq']()[_0xea28('0x66')]();return _0xd437e2;});}function getUpdatedSortOptions(_0x158c71){var _0x4ce696={'fields':[],'order':null};var _0x5574ba=_0x158c71[_0xea28('0x67')](',');_0x4ce696['fields']=_['filter'](_0x5574ba,function(_0x31e2d5){if(!_0x31e2d5[_0xea28('0x61')](_0xea28('0x68')))return!![];_0x4ce696[_0xea28('0x69')]=_[_0xea28('0x6a')](_0x31e2d5,'-')?_0xea28('0x6b'):'ASC';return![];});return _0x4ce696;}function orderAgentsByStatus(_0x49b2f3,_0x43cf67){return _0x49b2f3['sort'](function(_0x498fd7,_0x32787a){if(_0x498fd7[_0xea28('0x68')]===_0x32787a[_0xea28('0x68')]&&_0x498fd7[_0xea28('0x68')]===_0xea28('0x55')){if(_0x43cf67===_0xea28('0x6b'))return(_0x498fd7['pauseType']||'')<(_0x32787a['pauseType']||'')?0x1:-0x1;return _0x498fd7[_0xea28('0x6c')]<_0x32787a[_0xea28('0x6c')]?-0x1:0x1;}else{if(_0x43cf67===_0xea28('0x6b'))return _0x498fd7[_0xea28('0x68')]<_0x32787a[_0xea28('0x68')]?0x1:-0x1;return _0x498fd7['globalStatus']<_0x32787a['globalStatus']?-0x1:0x1;}});}exports['getAgents']=function(_0x34b534,_0x2bffbe){var _0x27ef7d={'count':0x0,'rows':[]},_0x42b40a={},_0x20de15,_0x436c3b,_0xfac5e1,_0x5c85e5,_0x23b63b=[_0xea28('0x6d'),_0xea28('0x42'),_0xea28('0x6e'),_0xea28('0x6f'),_0xea28('0x6c'),_0xea28('0x6f'),_0xea28('0x3b'),'address',_0xea28('0x4c'),_0xea28('0x4f'),_0xea28('0x4e'),_0xea28('0x50'),_0xea28('0x51'),_0xea28('0x4d'),_0xea28('0x54'),_0xea28('0x70'),_0xea28('0x71'),_0xea28('0x72'),'smsCapacity',_0xea28('0x73'),_0xea28('0x74'),'chatCurrentCapacity',_0xea28('0x75'),_0xea28('0x76'),_0xea28('0x77'),_0xea28('0x78'),_0xea28('0x79'),_0xea28('0x56'),_0xea28('0x7a'),_0xea28('0x58'),'smsStatus',_0xea28('0x7b'),_0xea28('0x57'),_0xea28('0x43'),_0xea28('0x7c'),_0xea28('0x7d'),'mailStatusTime',_0xea28('0x7e'),_0xea28('0x7f'),'faxStatusTime','voiceStatusTime',_0xea28('0x39'),_0xea28('0x80'),'screenrecording',_0xea28('0x81'),_0xea28('0x82'),_0xea28('0x83')],_0x481018=['chatPause',_0xea28('0x4f'),_0xea28('0x4e'),_0xea28('0x50'),'whatsappPause',_0xea28('0x4d'),_0xea28('0x54'),'online'];Promise['resolve']()[_0xea28('0x13')](function(){if(_0x34b534[_0xea28('0x84')][_0xea28('0x85')])_0x20de15=validateChannel(_0x34b534[_0xea28('0x84')]['channel']);if(!_0x34b534[_0xea28('0x84')][_0xea28('0x86')]||!_0x34b534[_0xea28('0x84')][_0xea28('0x86')][_0xea28('0x61')](_0xea28('0x68')))return;var _0x430dab=getUpdatedSortOptions(_0x34b534[_0xea28('0x84')]['sort']);_0x34b534[_0xea28('0x84')][_0xea28('0x86')]=_0x430dab[_0xea28('0x87')][_0xea28('0x88')](',');_0x436c3b=_0x430dab['order'];})[_0xea28('0x13')](function(){if(!_0x34b534[_0xea28('0x84')][_0xea28('0x89')])return[];var _0x3cac48=_[_0xea28('0x1a')](_0x20de15)+_0xea28('0x47');return getFilteredAgentIds(_0x34b534[_0xea28('0x84')][_0xea28('0x89')],_0x3cac48);})['then'](function(_0x2f48d1){var _0x1aa5d6=_[_0xea28('0x64')](db['User'][_0xea28('0x8a')],function(_0x4b6b4c){return{'name':_0x4b6b4c[_0xea28('0x8b')],'type':_0x4b6b4c['type'][_0xea28('0x8c')]};});_0x34b534[_0xea28('0x84')][_0xea28('0x8d')]=_0xea28('0x8e');_0x34b534[_0xea28('0x84')]['online']=!![];_0x42b40a=qs[_0xea28('0x8f')](_0x1aa5d6,_0x34b534);_0x42b40a[_0xea28('0x90')]=!![];if(!_[_0xea28('0x91')](_0x2f48d1)){_0x42b40a['where']=_['merge'](_0x42b40a[_0xea28('0x92')],{'$and':[{'id':{'$in':_0x2f48d1}}]});}else if(!_[_0xea28('0x91')](_0x34b534[_0xea28('0x84')]['globalQueueFilter'])){return _0x27ef7d;}if(_0x34b534[_0xea28('0x93')][_0xea28('0x8d')]===_0xea28('0x93')){var _0x3b3511={'params':{'id':_0x34b534[_0xea28('0x93')][_0xea28('0x94')]},'query':{'section':_0xea28('0x16'),'role':'agent','online':!![],'nolimit':_0x34b534[_0xea28('0x84')][_0xea28('0x95')],'sort':_0x34b534[_0xea28('0x84')][_0xea28('0x86')],'filter':_0x34b534[_0xea28('0x84')][_0xea28('0x38')],'raw':!![],'ids':_0x2f48d1}};return db[_0xea28('0x96')][_0xea28('0x97')](_0x3b3511);}return db[_0xea28('0x46')][_0xea28('0x98')](_0x42b40a);})['then'](function(_0x20ff14){_0x27ef7d[_0xea28('0xa')]=_0x20ff14[_0xea28('0xa')];_0xfac5e1=_0x20ff14[_0xea28('0x99')];return getRealtimeAgents();})[_0xea28('0x13')](function(_0x5da90c){_0x5c85e5=_0x5da90c[_0xea28('0x99')];return _0xfac5e1[_0xea28('0x64')](function(_0x723f10){var _0x40bf63=_[_0xea28('0x3f')](_0x5c85e5,['id',_0x723f10['id']]);if(_0x40bf63)_['merge'](_0x723f10,_[_0xea28('0x37')](_['omit'](_0x40bf63,_0x481018),_0x23b63b));_0x723f10['globalStatus']=getAgentStatus(_0x723f10);return _0x723f10;});})[_0xea28('0x13')](function(_0x340dec){var _0xa4b167;if(_0x34b534[_0xea28('0x84')][_0xea28('0x9a')]){_0xa4b167=_[_0xea28('0x38')](_0x340dec,[_0xea28('0x68'),_0x34b534[_0xea28('0x84')][_0xea28('0x9a')]]);if(_0x34b534[_0xea28('0x84')]['pauseTypeFilter']){_0xa4b167=_['filter'](_0xa4b167,[_0xea28('0x6c'),_0x34b534[_0xea28('0x84')]['pauseTypeFilter']]);}}if(_0xa4b167)_0x340dec=_0xa4b167;if(!_0x436c3b)return _0x340dec;return orderAgentsByStatus(_0x340dec,_0x436c3b);})[_0xea28('0x13')](function(_0x5cebba){_0x27ef7d[_0xea28('0x99')]=_0x5cebba;return _0x27ef7d;})[_0xea28('0x13')](respondWithFilteredResult(_0x2bffbe,_0x42b40a))['catch'](handleError(_0x2bffbe,null));};exports[_0xea28('0x9b')]=function(_0x25bb64,_0x287a1d){var _0x3e9f08={'count':0x0,'rows':[]},_0xea0e35={},_0x5e3ff8,_0x481fff,_0x5bba7d,_0x2653c0,_0x2477b9;Promise[_0xea28('0x9c')]()[_0xea28('0x13')](function(){if(_0x25bb64[_0xea28('0x84')]['channel'])_0x5e3ff8=validateChannel(_0x25bb64['query'][_0xea28('0x85')]);var _0x368790=_[_0xea28('0x1a')](_0x5e3ff8)+_0xea28('0x47');var _0x451588=_[_0xea28('0x64')](db[_0x368790][_0xea28('0x8a')],function(_0x444ec2){return{'name':_0x444ec2[_0xea28('0x8b')],'type':_0x444ec2[_0xea28('0x9d')][_0xea28('0x8c')]};});_0xea0e35=qs[_0xea28('0x8f')](_0x451588,_0x25bb64);if(_0x25bb64['user']['role']===_0xea28('0x93')){var _0x2a8fce={'params':{'id':_0x25bb64[_0xea28('0x93')][_0xea28('0x94')]},'query':{'section':_0x5e3ff8===_0xea28('0x19')&&_0x25bb64['query'][_0xea28('0x9d')]==='outbound'?_0xea28('0x9e'):_[_0xea28('0x1a')](_0x5e3ff8)+_0xea28('0x9f'),'type':_0x25bb64[_0xea28('0x84')]['type'],'nolimit':!![],'sort':_0xea28('0x10'),'filter':_0x25bb64[_0xea28('0x84')][_0xea28('0x38')]}};return db[_0xea28('0x96')][_0xea28('0x97')](_0x2a8fce);}return db[_0x368790][_0xea28('0x98')](_0xea0e35);})['then'](function(_0x435435){_0x3e9f08[_0xea28('0xa')]=_0x435435[_0xea28('0xa')];_0x481fff=_0x435435[_0xea28('0x99')];return getRealtimeQueues(_0x25bb64,_0x5e3ff8);})[_0xea28('0x13')](function(_0x3c035a){_0x2653c0=_0x3c035a['rows'];return getRealtimeAgents();})[_0xea28('0x13')](function(_0x5a8ee0){_0x5bba7d=_0x5a8ee0[_0xea28('0x99')];if(_0x5e3ff8!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xea28('0x13')](function(_0x50210b){_0x2477b9=_0x50210b?_0x50210b[_0xea28('0x99')]:[];return initializeQueues(_0x481fff,_0x2653c0,_0x5e3ff8,_0x25bb64[_0xea28('0x84')][_0xea28('0x9d')]);})['then'](function(_0x1b9386){var _0x25aa34=_0x1b9386['map'](function(_0x1cf17f){if(_0x5e3ff8===_0xea28('0x19'))return getVoiceQueueAgents(_0x1cf17f,_0x481fff,_0x5bba7d,_0x2477b9);else return getQueueAgents(_0x1cf17f,_0x5bba7d,_0x5e3ff8);});return Promise[_0xea28('0xa0')](_0x25aa34);})[_0xea28('0x13')](function(_0x4e72fe){_0x3e9f08['rows']=_0x4e72fe;return _0x3e9f08;})[_0xea28('0x13')](respondWithFilteredResult(_0x287a1d,_0xea0e35))[_0xea28('0x18')](handleError(_0x287a1d,null));}; \ No newline at end of file +var _0x4964=['all','flatten','uniq','fields','order','startsWith','DESC','ASC','sort','globalStatus','pauseType','userpic','lastLoginAt','lastPauseAt','openchannelPause','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','query','channel','join','globalQueueFilter','Queue','fieldName','agent','getOptions','where','isEmpty','user','nolimit','UserProfile','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','rawAttributes','type','key','role','userProfileId','QueueCampaigns','Queues','getResources','findAndCountAll','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','set','json','error','stack','status','send','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','voice','startCase','format','catch','VoiceQueuesChannels','loggedIn','available','talking','outbound','push','pTalking','originated','message','dialActive','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','agents','waiting','busy','find','pick','filter','name','length','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','paused','User','Pause','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','mailPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','whatsappStatus','*pause','mail','chat','sms','fax','includes','toLowerCase','isArray','map','findOne','getAgents'];(function(_0x386eb0,_0x2689aa){var _0x19ab3e=function(_0x1968bb){while(--_0x1968bb){_0x386eb0['push'](_0x386eb0['shift']());}};_0x19ab3e(++_0x2689aa);}(_0x4964,0xe5));var _0x4496=function(_0x5c2ad9,_0x123912){_0x5c2ad9=_0x5c2ad9-0x0;var _0xc42b40=_0x4964[_0x5c2ad9];return _0xc42b40;};'use strict';var util=require('util');var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0x4496('0x0'));var logger=require(_0x4496('0x1'))(_0x4496('0x2'));var db=require(_0x4496('0x3'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x4496('0x4')][_0x4496('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x253136,_0x27f86f){return function(_0x2ec6fa){if(_0x2ec6fa){var _0x1ccda6=typeof _0x27f86f[_0x4496('0x6')]===_0x4496('0x7')&&typeof _0x27f86f[_0x4496('0x8')]==='undefined';var _0x1045e7=_0x2ec6fa[_0x4496('0x9')];var _0x2988c9=_0x1ccda6?0x0:_0x27f86f['offset'];var _0x554ee3=_0x1ccda6?_0x2ec6fa[_0x4496('0x9')]:_0x27f86f['offset']+_0x27f86f[_0x4496('0x8')];var _0x45b439;if(_0x554ee3>=_0x1045e7){_0x554ee3=_0x1045e7;_0x45b439=0xc8;}else{_0x45b439=0xce;}_0x253136['status'](_0x45b439);return _0x253136[_0x4496('0xa')]('Content-Range',_0x2988c9+'-'+_0x554ee3+'/'+_0x1045e7)[_0x4496('0xb')](_0x2ec6fa);}return null;};}function handleError(_0x584ab5,_0x5ca212){_0x5ca212=_0x5ca212||0x1f4;return function(_0x48562b){logger[_0x4496('0xc')](_0x48562b[_0x4496('0xd')]);if(_0x48562b['name']){delete _0x48562b['name'];}_0x584ab5[_0x4496('0xe')](_0x5ca212)[_0x4496('0xf')](_0x48562b);};}function getRealtimeAgents(){return new Promise(function(_0x303985,_0x817c10){return amiClient[_0x4496('0x10')]('Agents',{})[_0x4496('0x11')](function(_0x4e6664){if(_0x4e6664['error'])throw new Error(_0x4496('0x12'));var _0x22426b=_0x4e6664['result'];return routingClient['request'](_0x4496('0x13'),{})[_0x4496('0x11')](function(_0x259d56){if(_0x259d56[_0x4496('0xc')])throw new Error(_0x4496('0x14'));var _0x535447=_0x259d56[_0x4496('0x15')];return _0x303985(_[_0x4496('0x16')]({},_0x22426b,_0x535447));});})['catch'](function(_0x4a60ca){_0x817c10(_0x4a60ca);});});}function getRealtimeQueues(_0x55dd7a,_0x2a649f){return new Promise(function(_0x5d6889,_0x181364){var _0x49bafc=_0x2a649f===_0x4496('0x17')?amiClient:routingClient;return _0x49bafc[_0x4496('0x10')](_[_0x4496('0x18')](_0x2a649f)+'Queues',_0x55dd7a)[_0x4496('0x11')](function(_0x8ba3f){if(_0x8ba3f['error'])throw new Error(util[_0x4496('0x19')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x2a649f));return _0x5d6889(_0x8ba3f[_0x4496('0x15')]);})[_0x4496('0x1a')](function(_0x6a74f7){_0x181364(_0x6a74f7);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x740bb2,_0xca237c){return amiClient[_0x4496('0x10')](_0x4496('0x1b'),{})[_0x4496('0x11')](function(_0x14a05b){if(_0x14a05b[_0x4496('0xc')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x740bb2(_0x14a05b['result']);})[_0x4496('0x1a')](function(_0x505c4e){_0xca237c(_0x505c4e);});});}function initializeQueues(_0x354856,_0x4d0125,_0x48b2d7,_0x2133c0){var _0x17c3fb=[_0x4496('0x1c'),_0x4496('0x1d'),'waiting',_0x4496('0x1e'),'paused'];if(_0x48b2d7===_0x4496('0x17')&&_0x2133c0===_0x4496('0x1f')){_0x17c3fb[_0x4496('0x20')](_0x4496('0x21'),_0x4496('0x22'),_0x4496('0x23'),_0x4496('0x24'),'dialMethod','Trunk',_0x4496('0x25'),_0x4496('0x26'),_0x4496('0x27'),_0x4496('0x28'),'erlangAbandonmentRate',_0x4496('0x29'),_0x4496('0x2a'),'dialPredictiveIntervalMaxThreshold',_0x4496('0x2b'),_0x4496('0x2c'),_0x4496('0x2d'),_0x4496('0x2e'),_0x4496('0x2f'),'predictiveIntervalDroppedCallsCallersExit',_0x4496('0x30'),'predictiveIntervalAvgTalktime');}return _0x354856['map'](function(_0x1fe770){var _0x211169=_0x1fe770['get']({'plain':!![]});_0x211169[_0x4496('0x31')]=[];_0x211169['paused']=0x0;_0x211169['loggedInDb']=0x0;_0x211169[_0x4496('0x1c')]=0x0;_0x211169[_0x4496('0x1d')]=0x0;_0x211169[_0x4496('0x32')]=0x0;if(_0x48b2d7===_0x4496('0x17')){_0x211169['talking']=0x0;_0x211169[_0x4496('0x33')]=0x0;if(_0x2133c0===_0x4496('0x1f')){_0x211169[_0x4496('0x21')]=0x0;_0x211169[_0x4496('0x22')]=0x0;}}var _0x6513cb=_[_0x4496('0x34')](_0x4d0125,['id',_0x211169['id']]);if(_0x6513cb)_[_0x4496('0x16')](_0x211169,_[_0x4496('0x35')](_0x6513cb,_0x17c3fb));return _0x211169;});}function updateAgentVoiceStatus(_0x1bae3b,_0x5eff6f,_0x5495a2){var _0x36df9c=_[_0x4496('0x36')](_0x5495a2,['queue',_0x5eff6f[_0x4496('0x37')]]);if(_0x36df9c[_0x4496('0x38')]===0x0)return _0x1bae3b[_0x4496('0x33')]=!![];if(_['some'](_0x36df9c,[_0x4496('0x39'),_0x1bae3b[_0x4496('0x3a')][_0x4496('0x3b')]()]))return _0x1bae3b[_0x4496('0x1e')]=!![];if(!_0x1bae3b['talking'])return _0x1bae3b[_0x4496('0x33')]=!![];}function getVoiceQueueAgents(_0x793268,_0x3f19ce,_0x86f41d,_0x4beb1b){var _0x180df4=_['find'](_0x3f19ce,['id',_0x793268['id']]);if(!_0x180df4)return _0x793268;return _0x180df4[_0x4496('0x3c')]({'raw':!![]})['then'](function(_0x55ae1d){for(var _0x25966a=0x0;_0x25966a<_0x55ae1d[_0x4496('0x38')];_0x25966a++){var _0x4d98b7=_[_0x4496('0x34')](_0x86f41d,['id',_0x55ae1d[_0x25966a][_0x4496('0x3d')]]);if(!_0x4d98b7){_0x4d98b7={'id':_0x55ae1d[_0x25966a][_0x4496('0x3d')],'name':_0x55ae1d[_0x25966a][_0x4496('0x3d')],'accountcode':'','online':![]};}var _0x2a6ca3={'id':_0x4d98b7['id'],'name':_0x4d98b7[_0x4496('0x37')],'internal':_0x4d98b7[_0x4496('0x3e')],'online':Boolean(_0x4d98b7[_0x4496('0x3f')]),'paused':Boolean(_0x55ae1d[_0x25966a]['paused'])};if(_0x4d98b7[_0x4496('0x40')]===_0x4496('0x1e'))updateAgentVoiceStatus(_0x2a6ca3,_0x793268,_0x4beb1b);if(_0x2a6ca3[_0x4496('0x3f')])_0x793268[_0x4496('0x41')]++;if(_0x2a6ca3[_0x4496('0x33')])_0x793268['busy']++;if(_0x2a6ca3['paused']&&!_0x2a6ca3[_0x4496('0x33')]&&!_0x2a6ca3[_0x4496('0x1e')])_0x793268[_0x4496('0x42')]++;_0x793268[_0x4496('0x31')]['push'](_0x2a6ca3);}return _0x793268;});}function getQueueAgents(_0x2ca6b0,_0x471109,_0x5ce198){var _0xd6556a=_0x4496('0x43')+_[_0x4496('0x18')](_0x5ce198)+'Queue';var _0x159b19=_0x5ce198+_0x4496('0x44');return db[_0xd6556a]['findAll']({'where':{[_[_0x4496('0x18')](_0x5ce198)+_0x4496('0x45')]:_0x2ca6b0['id']},'raw':!![]})['then'](function(_0x5e6638){for(var _0xf34369=0x0;_0xf34369<_0x5e6638[_0x4496('0x38')];_0xf34369++){var _0x766afc=_[_0x4496('0x34')](_0x471109,['id',_0x5e6638[_0xf34369][_0x4496('0x3d')]]);if(!_0x766afc){_0x766afc={'id':_0x5e6638[_0xf34369]['UserId'],'name':_0x5e6638[_0xf34369][_0x4496('0x3d')],'online':![],['pauseField']:![]};}var _0x4b049a={'id':_0x766afc['id'],'name':_0x766afc['name'],'online':Boolean(_0x766afc['online']),'paused':Boolean(_0x766afc[_0x159b19])};if(_0x4b049a['online'])_0x2ca6b0[_0x4496('0x41')]++;_0x2ca6b0[_0x4496('0x31')]['push'](_0x4b049a);}return _0x2ca6b0;});}function isIdle(_0x71727e){return _0x71727e===_0x4496('0x46')||_0x71727e===_0x4496('0x47')||_0x71727e===_0x4496('0x48')||_0x71727e===_0x4496('0x49')||_[_0x4496('0x4a')](_0x71727e);}function isAgentPaused(_0x34b26a,_0x52e7a0){var _0x15ad1f=[_0x34b26a[_0x4496('0x4b')],_0x34b26a['faxPause'],_0x34b26a[_0x4496('0x4c')],_0x34b26a['openchannelPause'],_0x34b26a['smsPause'],_0x34b26a[_0x4496('0x4d')],_0x34b26a[_0x4496('0x4e')]];if(!_0x52e7a0)return _[_0x4496('0x4f')](_0x15ad1f);var _0xa014c6=_[_0x4496('0x36')](_0x15ad1f);return _0xa014c6[_0x4496('0x38')]>0x0&&_0xa014c6['length']<_0x15ad1f[_0x4496('0x38')]?!![]:![];}function isAgentIdle(_0x1aa378){if(_0x1aa378[_0x4496('0x40')]!==_0x4496('0x46')&&_0x1aa378[_0x4496('0x4d')]){_0x1aa378['voiceStatus']=_0x4496('0x50');return![];}return _[_0x4496('0x4f')]([_0x1aa378[_0x4496('0x51')],_0x1aa378[_0x4496('0x52')],_0x1aa378[_0x4496('0x53')],_0x1aa378[_0x4496('0x54')],_0x1aa378['smsStatus'],_0x1aa378[_0x4496('0x40')],_0x1aa378[_0x4496('0x55')]],isIdle);}function getAgentStatus(_0x55186b){var _0x22f34f=_0x4496('0x47');if(isAgentPaused(_0x55186b))_0x22f34f='pause';else if(isAgentPaused(_0x55186b,!![]))_0x22f34f=_0x4496('0x56');else if(isAgentIdle(_0x55186b))_0x22f34f='idle';else _0x22f34f=_0x4496('0x33');return _0x22f34f;}function validateChannel(_0x26f164){var _0x55756c=[_0x4496('0x57'),_0x4496('0x58'),_0x4496('0x59'),'openchannel',_0x4496('0x5a'),'whatsapp',_0x4496('0x17')];if(!_[_0x4496('0x5b')](_0x55756c,_0x26f164[_0x4496('0x5c')]()))throw new Error('Invalid\x20channel');return _0x26f164['toLowerCase']();}function getFilteredAgentIds(_0x2a9eb9,_0x1b50f7){var _0x351cd2=_[_0x4496('0x5d')](_0x2a9eb9)?_0x2a9eb9:[_0x2a9eb9];var _0x5b5eba=_[_0x4496('0x5e')](_0x351cd2,function(_0x523193){return db[_0x1b50f7][_0x4496('0x5f')]({'where':{'name':_0x523193}})[_0x4496('0x11')](function(_0x4aa4ec){if(!_0x4aa4ec)return[];return _0x4aa4ec[_0x4496('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x4496('0x61')](_0x5b5eba)[_0x4496('0x11')](function(_0x29c7be){var _0x5da726=_(_0x29c7be)[_0x4496('0x62')]()[_0x4496('0x5e')]('id')[_0x4496('0x63')]()['value']();return _0x5da726;});}function getUpdatedSortOptions(_0x116fe5){var _0xbf528d={'fields':[],'order':null};var _0x21f3b6=_0x116fe5['split'](',');_0xbf528d[_0x4496('0x64')]=_[_0x4496('0x36')](_0x21f3b6,function(_0x1bd921){if(!_0x1bd921[_0x4496('0x5b')]('globalStatus'))return!![];_0xbf528d[_0x4496('0x65')]=_[_0x4496('0x66')](_0x1bd921,'-')?_0x4496('0x67'):_0x4496('0x68');return![];});return _0xbf528d;}function orderAgentsByStatus(_0xb2bac2,_0x5b246f){return _0xb2bac2[_0x4496('0x69')](function(_0x46441d,_0x146372){if(_0x46441d[_0x4496('0x6a')]===_0x146372['globalStatus']&&_0x46441d[_0x4496('0x6a')]===_0x4496('0x50')){if(_0x5b246f===_0x4496('0x67'))return(_0x46441d[_0x4496('0x6b')]||'')<(_0x146372[_0x4496('0x6b')]||'')?0x1:-0x1;return _0x46441d[_0x4496('0x6b')]<_0x146372['pauseType']?-0x1:0x1;}else{if(_0x5b246f===_0x4496('0x67'))return _0x46441d[_0x4496('0x6a')]<_0x146372[_0x4496('0x6a')]?0x1:-0x1;return _0x46441d[_0x4496('0x6a')]<_0x146372[_0x4496('0x6a')]?-0x1:0x1;}});}exports[_0x4496('0x60')]=function(_0x321518,_0x172adc){var _0x4421ed={'count':0x0,'rows':[]},_0xead859={},_0x18c419,_0x443989,_0x4b3763,_0x181640,_0x3a6bae=[_0x4496('0x6c'),_0x4496('0x3f'),_0x4496('0x6d'),'lastPauseAt',_0x4496('0x6b'),_0x4496('0x6e'),'internal','address','chatPause',_0x4496('0x6f'),_0x4496('0x4c'),'smsPause',_0x4496('0x4e'),_0x4496('0x70'),_0x4496('0x4d'),_0x4496('0x71'),_0x4496('0x72'),_0x4496('0x73'),_0x4496('0x74'),_0x4496('0x75'),'faxCapacity',_0x4496('0x76'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x4496('0x77'),_0x4496('0x78'),_0x4496('0x79'),_0x4496('0x51'),_0x4496('0x54'),_0x4496('0x53'),_0x4496('0x7a'),_0x4496('0x55'),_0x4496('0x52'),_0x4496('0x40'),_0x4496('0x7b'),_0x4496('0x7c'),_0x4496('0x7d'),_0x4496('0x7e'),_0x4496('0x7f'),_0x4496('0x80'),'voiceStatusTime',_0x4496('0x81'),'destconnectedlinenum',_0x4496('0x82'),_0x4496('0x83'),_0x4496('0x84'),_0x4496('0x85')],_0x2efb8e=[_0x4496('0x4b'),_0x4496('0x6f'),_0x4496('0x4c'),_0x4496('0x86'),_0x4496('0x4e'),_0x4496('0x70'),'voicePause',_0x4496('0x3f')];Promise[_0x4496('0x87')]()[_0x4496('0x11')](function(){if(_0x321518[_0x4496('0x88')][_0x4496('0x89')])_0x18c419=validateChannel(_0x321518[_0x4496('0x88')][_0x4496('0x89')]);if(!_0x321518[_0x4496('0x88')]['sort']||!_0x321518[_0x4496('0x88')][_0x4496('0x69')]['includes'](_0x4496('0x6a')))return;var _0x24faed=getUpdatedSortOptions(_0x321518[_0x4496('0x88')]['sort']);_0x321518[_0x4496('0x88')][_0x4496('0x69')]=_0x24faed[_0x4496('0x64')][_0x4496('0x8a')](',');_0x443989=_0x24faed['order'];})[_0x4496('0x11')](function(){if(!_0x321518[_0x4496('0x88')][_0x4496('0x8b')])return[];var _0x2c5425=_[_0x4496('0x18')](_0x18c419)+_0x4496('0x8c');return getFilteredAgentIds(_0x321518[_0x4496('0x88')][_0x4496('0x8b')],_0x2c5425);})[_0x4496('0x11')](function(_0xbc19f1){var _0x201e8e=_[_0x4496('0x5e')](db[_0x4496('0x43')]['rawAttributes'],function(_0x406746){return{'name':_0x406746[_0x4496('0x8d')],'type':_0x406746['type']['key']};});_0x321518[_0x4496('0x88')]['role']=_0x4496('0x8e');_0x321518[_0x4496('0x88')][_0x4496('0x3f')]=!![];_0xead859=qs[_0x4496('0x8f')](_0x201e8e,_0x321518);_0xead859['raw']=!![];if(!_['isEmpty'](_0xbc19f1)){_0xead859[_0x4496('0x90')]=_[_0x4496('0x16')](_0xead859[_0x4496('0x90')],{'$and':[{'id':{'$in':_0xbc19f1}}]});}else if(!_[_0x4496('0x91')](_0x321518['query'][_0x4496('0x8b')])){return _0x4421ed;}if(_0x321518[_0x4496('0x92')]['role']===_0x4496('0x92')){var _0x400375={'params':{'id':_0x321518['user']['userProfileId']},'query':{'section':'Agents','role':_0x4496('0x8e'),'online':!![],'nolimit':_0x321518[_0x4496('0x88')][_0x4496('0x93')],'sort':_0x321518[_0x4496('0x88')][_0x4496('0x69')],'filter':_0x321518[_0x4496('0x88')][_0x4496('0x36')],'raw':!![],'ids':_0xbc19f1}};return db[_0x4496('0x94')]['getResources'](_0x400375);}return db[_0x4496('0x43')]['findAndCountAll'](_0xead859);})[_0x4496('0x11')](function(_0x3b2730){_0x4421ed[_0x4496('0x9')]=_0x3b2730[_0x4496('0x9')];_0x4b3763=_0x3b2730[_0x4496('0x95')];return getRealtimeAgents();})[_0x4496('0x11')](function(_0x3e8e85){_0x181640=_0x3e8e85[_0x4496('0x95')];return _0x4b3763['map'](function(_0x16abb4){var _0x4b51ff=_['find'](_0x181640,['id',_0x16abb4['id']]);if(_0x4b51ff)_[_0x4496('0x16')](_0x16abb4,_['pick'](_[_0x4496('0x96')](_0x4b51ff,_0x2efb8e),_0x3a6bae));_0x16abb4[_0x4496('0x6a')]=getAgentStatus(_0x16abb4);return _0x16abb4;});})[_0x4496('0x11')](function(_0x542e20){var _0x3b51d3;if(_0x321518[_0x4496('0x88')][_0x4496('0x97')]){_0x3b51d3=_['filter'](_0x542e20,[_0x4496('0x6a'),_0x321518['query'][_0x4496('0x97')]]);if(_0x321518['query'][_0x4496('0x98')]){_0x3b51d3=_['filter'](_0x3b51d3,[_0x4496('0x6b'),_0x321518['query']['pauseTypeFilter']]);}}if(_0x3b51d3)_0x542e20=_0x3b51d3;if(!_0x443989)return _0x542e20;return orderAgentsByStatus(_0x542e20,_0x443989);})[_0x4496('0x11')](function(_0x29fbea){_0x4421ed[_0x4496('0x95')]=_0x29fbea;return _0x4421ed;})[_0x4496('0x11')](respondWithFilteredResult(_0x172adc,_0xead859))[_0x4496('0x1a')](handleError(_0x172adc,null));};exports[_0x4496('0x99')]=function(_0x52070d,_0xcede91){var _0x3fe787={'count':0x0,'rows':[]},_0x1317a8={},_0x43bf6f,_0x3caaac,_0x44dcfe,_0x4e84a7,_0xd512dc;Promise[_0x4496('0x87')]()['then'](function(){if(_0x52070d[_0x4496('0x88')][_0x4496('0x89')])_0x43bf6f=validateChannel(_0x52070d['query']['channel']);var _0x2660de=_['startCase'](_0x43bf6f)+_0x4496('0x8c');var _0x2ed790=_[_0x4496('0x5e')](db[_0x2660de][_0x4496('0x9a')],function(_0x5a6a6f){return{'name':_0x5a6a6f[_0x4496('0x8d')],'type':_0x5a6a6f[_0x4496('0x9b')][_0x4496('0x9c')]};});_0x1317a8=qs['getOptions'](_0x2ed790,_0x52070d);if(_0x52070d['user'][_0x4496('0x9d')]===_0x4496('0x92')){var _0xc7872b={'params':{'id':_0x52070d[_0x4496('0x92')][_0x4496('0x9e')]},'query':{'section':_0x43bf6f===_0x4496('0x17')&&_0x52070d['query'][_0x4496('0x9b')]===_0x4496('0x1f')?_0x4496('0x9f'):_[_0x4496('0x18')](_0x43bf6f)+_0x4496('0xa0'),'type':_0x52070d[_0x4496('0x88')]['type'],'nolimit':!![],'sort':_0x4496('0x37'),'filter':_0x52070d[_0x4496('0x88')][_0x4496('0x36')]}};return db[_0x4496('0x94')][_0x4496('0xa1')](_0xc7872b);}return db[_0x2660de][_0x4496('0xa2')](_0x1317a8);})[_0x4496('0x11')](function(_0x11a2dc){_0x3fe787[_0x4496('0x9')]=_0x11a2dc['count'];_0x3caaac=_0x11a2dc[_0x4496('0x95')];return getRealtimeQueues(_0x52070d,_0x43bf6f);})[_0x4496('0x11')](function(_0x442798){_0x4e84a7=_0x442798[_0x4496('0x95')];return getRealtimeAgents();})[_0x4496('0x11')](function(_0x5da898){_0x44dcfe=_0x5da898[_0x4496('0x95')];if(_0x43bf6f!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x4496('0x11')](function(_0x55f26b){_0xd512dc=_0x55f26b?_0x55f26b[_0x4496('0x95')]:[];return initializeQueues(_0x3caaac,_0x4e84a7,_0x43bf6f,_0x52070d[_0x4496('0x88')]['type']);})[_0x4496('0x11')](function(_0x4c6384){var _0x3ce583=_0x4c6384[_0x4496('0x5e')](function(_0x4cb7ea){if(_0x43bf6f==='voice')return getVoiceQueueAgents(_0x4cb7ea,_0x3caaac,_0x44dcfe,_0xd512dc);else return getQueueAgents(_0x4cb7ea,_0x44dcfe,_0x43bf6f);});return Promise['all'](_0x3ce583);})[_0x4496('0x11')](function(_0x20a754){_0x3fe787['rows']=_0x20a754;return _0x3fe787;})['then'](respondWithFilteredResult(_0xcede91,_0x1317a8))['catch'](handleError(_0xcede91,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f70d77a..c58f74d 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x45995c,_0x2f14a3){var _0x5ba272=function(_0x3837e4){while(--_0x3837e4){_0x45995c['push'](_0x45995c['shift']());}};_0x5ba272(++_0x2f14a3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xdfb29a,_0x3443b5){var _0x52f21e=function(_0x56598e){while(--_0x56598e){_0xdfb29a['push'](_0xdfb29a['shift']());}};_0x52f21e(++_0x3443b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index cb33db0..d9fd3ab 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.attributes.js +++ b/server/api/reportAgentPreview/reportAgentPreview.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x78e0=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x20534c,_0x372ab1){var _0x362700=function(_0x311ccf){while(--_0x311ccf){_0x20534c['push'](_0x20534c['shift']());}};_0x362700(++_0x372ab1);}(_0x78e0,0x13e));var _0x078e=function(_0xf34895,_0x21fb70){_0xf34895=_0xf34895-0x0;var _0x143f44=_0x78e0[_0xf34895];return _0x143f44;};'use strict';var Sequelize=require(_0x078e('0x0'));module[_0x078e('0x1')]={'state':{'type':Sequelize[_0x078e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x078e('0x3')]},'scheduledat':{'type':Sequelize[_0x078e('0x4')]},'uniqueid':{'type':Sequelize[_0x078e('0x3')]},'starttime':{'type':Sequelize[_0x078e('0x4')]},'responsetime':{'type':Sequelize[_0x078e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x078e('0x3')]},'membername':{'type':Sequelize[_0x078e('0x3')]}}; \ No newline at end of file +var _0x3c6c=['INTEGER','STRING','DATE','sequelize'];(function(_0x23a9a3,_0x2f04cc){var _0x4cc29b=function(_0x1f6a3b){while(--_0x1f6a3b){_0x23a9a3['push'](_0x23a9a3['shift']());}};_0x4cc29b(++_0x2f04cc);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x31ccda,_0x538dc8){_0x31ccda=_0x31ccda-0x0;var _0x3cfc6b=_0x3c6c[_0x31ccda];return _0x3cfc6b;};'use strict';var Sequelize=require(_0xc3c6('0x0'));module['exports']={'state':{'type':Sequelize[_0xc3c6('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc3c6('0x2')]},'scheduledat':{'type':Sequelize[_0xc3c6('0x3')]},'uniqueid':{'type':Sequelize[_0xc3c6('0x2')]},'starttime':{'type':Sequelize[_0xc3c6('0x3')]},'responsetime':{'type':Sequelize[_0xc3c6('0x3')]},'ringtime':{'type':Sequelize[_0xc3c6('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc3c6('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc3c6('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a058763..c6f9e9d 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.model.js +++ b/server/api/reportAgentPreview/reportAgentPreview.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x65c7=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x1a212a,_0x64496b){var _0x22d075=function(_0x1b745a){while(--_0x1b745a){_0x1a212a['push'](_0x1a212a['shift']());}};_0x22d075(++_0x64496b);}(_0x65c7,0xe1));var _0x765c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x65c7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x765c('0x0'));var util=require('util');var logger=require(_0x765c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x765c('0x2'));var rimraf=require(_0x765c('0x3'));var config=require(_0x765c('0x4'));var attributes=require(_0x765c('0x5'));module[_0x765c('0x6')]=function(_0x9d7d93,_0x28e2b9){return _0x9d7d93[_0x765c('0x7')](_0x765c('0x8'),attributes,{'tableName':_0x765c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x695f=['ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','path','rimraf','./reportAgentPreview.attributes'];(function(_0x2eb6c6,_0x563e09){var _0x577963=function(_0x2235c4){while(--_0x2235c4){_0x2eb6c6['push'](_0x2eb6c6['shift']());}};_0x577963(++_0x563e09);}(_0x695f,0xa4));var _0xf695=function(_0x156e27,_0x44d3e8){_0x156e27=_0x156e27-0x0;var _0x503ea0=_0x695f[_0x156e27];return _0x503ea0;};'use strict';var _=require('lodash');var util=require(_0xf695('0x0'));var logger=require(_0xf695('0x1'))(_0xf695('0x2'));var moment=require(_0xf695('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf695('0x4'));var rimraf=require(_0xf695('0x5'));var config=require('../../config/environment');var attributes=require(_0xf695('0x6'));module['exports']=function(_0x194e7c,_0x16981a){return _0x194e7c['define'](_0xf695('0x7'),attributes,{'tableName':_0xf695('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 807acf4..50e7014 100644 --- a/server/api/reportAgentPreview/reportAgentPreview.rpc.js +++ b/server/api/reportAgentPreview/reportAgentPreview.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e41=['body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','create'];(function(_0x2d6be0,_0x27a2e4){var _0x376401=function(_0x5cd71b){while(--_0x5cd71b){_0x2d6be0['push'](_0x2d6be0['shift']());}};_0x376401(++_0x27a2e4);}(_0x8e41,0x112));var _0x18e4=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x8e41[_0x338338];return _0x3cf852;};'use strict';var _=require(_0x18e4('0x0'));var util=require(_0x18e4('0x1'));var moment=require(_0x18e4('0x2'));var BPromise=require(_0x18e4('0x3'));var rs=require(_0x18e4('0x4'));var fs=require('fs');var Redis=require(_0x18e4('0x5'));var db=require(_0x18e4('0x6'))['db'];var utils=require(_0x18e4('0x7'));var logger=require(_0x18e4('0x8'))(_0x18e4('0x9'));var config=require(_0x18e4('0xa'));var jayson=require(_0x18e4('0xb'));var client=jayson[_0x18e4('0xc')][_0x18e4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1cd14e,_0x3b896f,_0x5d9fb8){return new BPromise(function(_0x556441,_0x1a0cda){return client['request'](_0x1cd14e,_0x5d9fb8)['then'](function(_0x1febd7){logger[_0x18e4('0xe')](_0x18e4('0xf'),_0x3b896f,_0x18e4('0x10'));logger['debug'](_0x18e4('0x11'),_0x3b896f,_0x18e4('0x10'),JSON[_0x18e4('0x12')](_0x1febd7));if(_0x1febd7[_0x18e4('0x13')]){if(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x14')]===0x1f4){logger[_0x18e4('0x13')](_0x18e4('0xf'),_0x3b896f,_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);return _0x1a0cda(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);}logger['error'](_0x18e4('0xf'),_0x3b896f,_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);return _0x556441(_0x1febd7[_0x18e4('0x13')][_0x18e4('0x15')]);}else{logger[_0x18e4('0xe')](_0x18e4('0xf'),_0x3b896f,_0x18e4('0x10'));_0x556441(_0x1febd7[_0x18e4('0x16')]['message']);}})[_0x18e4('0x17')](function(_0x34eaef){logger[_0x18e4('0x13')](_0x18e4('0xf'),_0x3b896f,_0x34eaef);_0x1a0cda(_0x34eaef);});});}exports['CreateReportAgentPreview']=function(_0xf8b316){var _0x319ab2=this;return new Promise(function(_0x28d24a,_0x36e549){return db[_0x18e4('0x18')][_0x18e4('0x19')](_0xf8b316[_0x18e4('0x1a')],{'raw':_0xf8b316['options']?_0xf8b316[_0x18e4('0x1b')][_0x18e4('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x17adb5){logger[_0x18e4('0xe')](_0x18e4('0x1d'),_0xf8b316);logger['debug'](_0x18e4('0x1d'),_0xf8b316,JSON[_0x18e4('0x12')](_0x17adb5));_0x28d24a(_0x17adb5);})[_0x18e4('0x17')](function(_0x12d36d){logger['error'](_0x18e4('0x1d'),_0x12d36d['message'],_0xf8b316);_0x36e549(_0x319ab2['error'](0x1f4,_0x12d36d['message']));});});}; \ No newline at end of file +var _0x2ada=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','catch','ReportAgentPreview','create','body','options','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3705c8,_0x5650e2){var _0x66f36c=function(_0x3aa701){while(--_0x3aa701){_0x3705c8['push'](_0x3705c8['shift']());}};_0x66f36c(++_0x5650e2);}(_0x2ada,0x18e));var _0xa2ad=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0x2ada[_0x53056c];return _0x5cec88;};'use strict';var _=require(_0xa2ad('0x0'));var util=require(_0xa2ad('0x1'));var moment=require(_0xa2ad('0x2'));var BPromise=require(_0xa2ad('0x3'));var rs=require(_0xa2ad('0x4'));var fs=require('fs');var Redis=require(_0xa2ad('0x5'));var db=require(_0xa2ad('0x6'))['db'];var utils=require(_0xa2ad('0x7'));var logger=require(_0xa2ad('0x8'))(_0xa2ad('0x9'));var config=require(_0xa2ad('0xa'));var jayson=require(_0xa2ad('0xb'));var client=jayson['client'][_0xa2ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x266944,_0x33e37b,_0x45d878){return new BPromise(function(_0x3f3c54,_0x2f701f){return client[_0xa2ad('0xd')](_0x266944,_0x45d878)[_0xa2ad('0xe')](function(_0x53c31f){logger[_0xa2ad('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x33e37b,_0xa2ad('0x10'));logger[_0xa2ad('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x33e37b,'request\x20sent',JSON['stringify'](_0x53c31f));if(_0x53c31f[_0xa2ad('0x12')]){if(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x13')]===0x1f4){logger[_0xa2ad('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x33e37b,_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);return _0x2f701f(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x33e37b,_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);return _0x3f3c54(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);}else{logger['info'](_0xa2ad('0x15'),_0x33e37b,_0xa2ad('0x10'));_0x3f3c54(_0x53c31f[_0xa2ad('0x16')][_0xa2ad('0x14')]);}})[_0xa2ad('0x17')](function(_0x477617){logger['error'](_0xa2ad('0x15'),_0x33e37b,_0x477617);_0x2f701f(_0x477617);});});}exports['CreateReportAgentPreview']=function(_0x4a4865){var _0xbdccf4=this;return new Promise(function(_0x32c087,_0x20391a){return db[_0xa2ad('0x18')][_0xa2ad('0x19')](_0x4a4865[_0xa2ad('0x1a')],{'raw':_0x4a4865['options']?_0x4a4865[_0xa2ad('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa2ad('0xe')](function(_0x1efd55){logger[_0xa2ad('0xf')](_0xa2ad('0x1c'),_0x4a4865);logger[_0xa2ad('0x11')]('CreateReportAgentPreview',_0x4a4865,JSON['stringify'](_0x1efd55));_0x32c087(_0x1efd55);})[_0xa2ad('0x17')](function(_0x5971b0){logger['error']('CreateReportAgentPreview',_0x5971b0[_0xa2ad('0x14')],_0x4a4865);_0x20391a(_0xbdccf4[_0xa2ad('0x12')](0x1f4,_0x5971b0[_0xa2ad('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a3bd674..3e1f910 100644 --- a/server/api/rpc/index.js +++ b/server/api/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2f=['faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x7a2f,0x108));var _0xf7a2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a2f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xf7a2('0x0'));var util=require(_0xf7a2('0x1'));var path=require(_0xf7a2('0x2'));var express=require('express');var router=express[_0xf7a2('0x3')]();var auth=require(_0xf7a2('0x4'));var controller=require(_0xf7a2('0x5'));router[_0xf7a2('0x6')](_0xf7a2('0x7'),auth[_0xf7a2('0x8')](),controller['voiceChannels']);router[_0xf7a2('0x6')](_0xf7a2('0x9'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xa')]);router[_0xf7a2('0x6')](_0xf7a2('0xb'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xc')]);router['get'](_0xf7a2('0xd'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0xe')]);router[_0xf7a2('0x6')](_0xf7a2('0xf'),auth[_0xf7a2('0x8')](),controller['chatQueues']);router['get'](_0xf7a2('0x10'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x11')]);router[_0xf7a2('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xf7a2('0x12')]);router['get'](_0xf7a2('0x13'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x14')]);router['get']('/sms/queues',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x15')]);router[_0xf7a2('0x6')]('/whatsapp/queues',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x16')]);router['get'](_0xf7a2('0x17'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x18')]);router[_0xf7a2('0x6')](_0xf7a2('0x19'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1a')]);router[_0xf7a2('0x6')](_0xf7a2('0x1b'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1c')]);router[_0xf7a2('0x6')](_0xf7a2('0x1d'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x1e')]);router[_0xf7a2('0x6')](_0xf7a2('0x1f'),auth[_0xf7a2('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xf7a2('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x20')]);router[_0xf7a2('0x6')]('/voice/queues/:id',auth[_0xf7a2('0x8')](),controller['showVoiceQueues']);router[_0xf7a2('0x21')]('/voice/queues/:id',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x22')]);router[_0xf7a2('0x6')](_0xf7a2('0x23'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x24')]);router[_0xf7a2('0x6')](_0xf7a2('0x25'),auth[_0xf7a2('0x8')](),controller['outboundChannels']);router[_0xf7a2('0x6')]('/agents',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x26')]);router[_0xf7a2('0x21')](_0xf7a2('0x27'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x28')]);router['get'](_0xf7a2('0x29'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2a')]);router[_0xf7a2('0x6')](_0xf7a2('0x2b'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2c')]);router[_0xf7a2('0x6')]('/campaigns',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x2d')]);router[_0xf7a2('0x6')](_0xf7a2('0x2e'),auth['isAuthenticated'](),controller[_0xf7a2('0x2f')]);router[_0xf7a2('0x6')](_0xf7a2('0x30'),auth[_0xf7a2('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xf7a2('0x6')]('/mail/queues/waitinginteractions',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x31')]);router[_0xf7a2('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf7a2('0x32')]);router[_0xf7a2('0x6')](_0xf7a2('0x33'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x34')]);router['get'](_0xf7a2('0x35'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x36')]);router[_0xf7a2('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x37')]);router[_0xf7a2('0x6')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xf7a2('0x38')]);router['post'](_0xf7a2('0x39'),auth['isAuthenticated'](),controller[_0xf7a2('0x3a')](_0xf7a2('0x3b')));router[_0xf7a2('0x6')](_0xf7a2('0x3c'),auth[_0xf7a2('0x8')](),controller['showMailQueues']);router[_0xf7a2('0x3d')](_0xf7a2('0x3e'),auth[_0xf7a2('0x8')](),controller['queueNotify'](_0xf7a2('0x3f')));router['get'](_0xf7a2('0x40'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x41')]);router['post']('/fax/queues/:id/notify',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x3a')](_0xf7a2('0x42')));router[_0xf7a2('0x6')](_0xf7a2('0x43'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x44')]);router[_0xf7a2('0x3d')]('/openchannel/queues/:id/notify',auth[_0xf7a2('0x8')](),controller['queueNotify'](_0xf7a2('0x45')));router['get'](_0xf7a2('0x46'),auth['isAuthenticated'](),controller[_0xf7a2('0x47')]);router[_0xf7a2('0x3d')](_0xf7a2('0x48'),auth['isAuthenticated'](),controller[_0xf7a2('0x3a')](_0xf7a2('0x49')));router['post']('/whatsapp/queues/:id/notify',auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x3a')]('whatsapp'));router[_0xf7a2('0x6')](_0xf7a2('0x4a'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x4b')]);router[_0xf7a2('0x6')](_0xf7a2('0x4c'),auth[_0xf7a2('0x8')](),controller[_0xf7a2('0x4d')]);router[_0xf7a2('0x3d')](_0xf7a2('0x4e'),auth['isAuthenticated'](),controller[_0xf7a2('0x4f')]);module['exports']=router; \ No newline at end of file +var _0x48c7=['/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents'];(function(_0x287ec0,_0x335651){var _0x694034=function(_0x45b8b9){while(--_0x45b8b9){_0x287ec0['push'](_0x287ec0['shift']());}};_0x694034(++_0x335651);}(_0x48c7,0x1f1));var _0x748c=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x48c7[_0x2d8f6c];return _0x3a00f6;};'use strict';var multer=require(_0x748c('0x0'));var util=require(_0x748c('0x1'));var path=require('path');var express=require(_0x748c('0x2'));var router=express[_0x748c('0x3')]();var auth=require(_0x748c('0x4'));var controller=require(_0x748c('0x5'));router[_0x748c('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x748c('0x7')]);router['get'](_0x748c('0x8'),auth[_0x748c('0x9')](),controller[_0x748c('0xa')]);router[_0x748c('0x6')](_0x748c('0xb'),auth['isAuthenticated'](),controller[_0x748c('0xc')]);router[_0x748c('0x6')](_0x748c('0xd'),auth['isAuthenticated'](),controller[_0x748c('0xe')]);router[_0x748c('0x6')](_0x748c('0xf'),auth['isAuthenticated'](),controller[_0x748c('0x10')]);router['get']('/mail/queues',auth['isAuthenticated'](),controller[_0x748c('0x11')]);router[_0x748c('0x6')](_0x748c('0x12'),auth[_0x748c('0x9')](),controller[_0x748c('0x13')]);router[_0x748c('0x6')](_0x748c('0x14'),auth[_0x748c('0x9')](),controller[_0x748c('0x15')]);router[_0x748c('0x6')](_0x748c('0x16'),auth[_0x748c('0x9')](),controller[_0x748c('0x17')]);router['get']('/whatsapp/queues',auth[_0x748c('0x9')](),controller[_0x748c('0x18')]);router[_0x748c('0x6')](_0x748c('0x19'),auth['isAuthenticated'](),controller[_0x748c('0x1a')]);router[_0x748c('0x6')]('/voice/queues/preview/:id',auth[_0x748c('0x9')](),controller['voiceQueuesPreview']);router[_0x748c('0x6')](_0x748c('0x1b'),auth[_0x748c('0x9')](),controller[_0x748c('0x1c')]);router['get'](_0x748c('0x1d'),auth[_0x748c('0x9')](),controller[_0x748c('0x1e')]);router[_0x748c('0x6')](_0x748c('0x1f'),auth[_0x748c('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x748c('0x6')](_0x748c('0x20'),auth[_0x748c('0x9')](),controller[_0x748c('0x21')]);router[_0x748c('0x6')]('/voice/queues/:id',auth[_0x748c('0x9')](),controller['showVoiceQueues']);router[_0x748c('0x22')](_0x748c('0x23'),auth[_0x748c('0x9')](),controller[_0x748c('0x24')]);router['get'](_0x748c('0x25'),auth[_0x748c('0x9')](),controller['outbound']);router[_0x748c('0x6')](_0x748c('0x26'),auth['isAuthenticated'](),controller[_0x748c('0x27')]);router[_0x748c('0x6')](_0x748c('0x28'),auth[_0x748c('0x9')](),controller[_0x748c('0x29')]);router['put'](_0x748c('0x2a'),auth[_0x748c('0x9')](),controller['agentCapacity']);router[_0x748c('0x6')](_0x748c('0x2b'),auth[_0x748c('0x9')](),controller['telephones']);router[_0x748c('0x6')](_0x748c('0x2c'),auth[_0x748c('0x9')](),controller[_0x748c('0x2d')]);router['get'](_0x748c('0x2e'),auth[_0x748c('0x9')](),controller['campaigns']);router[_0x748c('0x6')](_0x748c('0x2f'),auth['isAuthenticated'](),controller[_0x748c('0x30')]);router[_0x748c('0x6')](_0x748c('0x31'),auth['isAuthenticated'](),controller[_0x748c('0x32')]);router[_0x748c('0x6')](_0x748c('0x33'),auth[_0x748c('0x9')](),controller[_0x748c('0x34')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0x748c('0x9')](),controller['openchannelQueuesWaitingInteractions']);router[_0x748c('0x6')](_0x748c('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x748c('0x6')](_0x748c('0x36'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x748c('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x748c('0x9')](),controller[_0x748c('0x37')]);router[_0x748c('0x6')]('/fax/queues/waitinginteractions',auth[_0x748c('0x9')](),controller[_0x748c('0x38')]);router['post'](_0x748c('0x39'),auth[_0x748c('0x9')](),controller[_0x748c('0x3a')](_0x748c('0x3b')));router[_0x748c('0x6')]('/mail/queues/:id',auth[_0x748c('0x9')](),controller[_0x748c('0x3c')]);router[_0x748c('0x3d')](_0x748c('0x3e'),auth['isAuthenticated'](),controller[_0x748c('0x3a')](_0x748c('0x3f')));router['get'](_0x748c('0x40'),auth[_0x748c('0x9')](),controller[_0x748c('0x41')]);router[_0x748c('0x3d')]('/fax/queues/:id/notify',auth[_0x748c('0x9')](),controller[_0x748c('0x3a')]('fax'));router[_0x748c('0x6')](_0x748c('0x42'),auth[_0x748c('0x9')](),controller[_0x748c('0x43')]);router[_0x748c('0x3d')](_0x748c('0x44'),auth[_0x748c('0x9')](),controller['queueNotify']('openchannel'));router['get']('/openchannel/queues/:id',auth[_0x748c('0x9')](),controller[_0x748c('0x45')]);router[_0x748c('0x3d')]('/sms/queues/:id/notify',auth[_0x748c('0x9')](),controller[_0x748c('0x3a')](_0x748c('0x46')));router['post'](_0x748c('0x47'),auth[_0x748c('0x9')](),controller[_0x748c('0x3a')](_0x748c('0x48')));router[_0x748c('0x6')](_0x748c('0x49'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x748c('0x6')](_0x748c('0x4a'),auth[_0x748c('0x9')](),controller['showWhatsappQueues']);router[_0x748c('0x3d')]('/agents/:id/notify',auth[_0x748c('0x9')](),controller[_0x748c('0x4b')]);module[_0x748c('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9e645f5..a112126 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dfd=['interface','format','SIP/%s','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','filter','indexOf','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','findOne','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x3fd7c0,_0x1acce2){var _0x1310cc=function(_0x5827af){while(--_0x5827af){_0x3fd7c0['push'](_0x3fd7c0['shift']());}};_0x1310cc(++_0x1acce2);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd7df('0x0'));var moment=require(_0xd7df('0x1'));var _=require(_0xd7df('0x2'));var util=require(_0xd7df('0x3'));var db=require(_0xd7df('0x4'))['db'];var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));var jayson=require(_0xd7df('0x7'));var amiClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232a});var mailClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232b});var routingClient=jayson[_0xd7df('0x8')][_0xd7df('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){var _0xb3557a=_0x2c48a4?_0x2c48a4:amiClient;return _0xb3557a[_0xd7df('0xa')](_0x354ea7,_0x16e50)[_0xd7df('0xb')](function(_0x5e59c3){if(_0x5e59c3[_0xd7df('0xc')]){if(_0x5e59c3['error'][_0xd7df('0xd')]===0x1f4){return _0xab6742(_0x5e59c3['error'][_0xd7df('0xe')]);}return _0x5c220a(_0x5e59c3[_0xd7df('0xc')][_0xd7df('0xe')]);}else{_0x5c220a(_0x5e59c3[_0xd7df('0xf')]);}})[_0xd7df('0x10')](function(_0x174c88){_0xab6742(_0x174c88);});});}function respondWithResult(_0x2e8187,_0x3da618){_0x3da618=_0x3da618||0xc8;return function(_0x7ba3c){if(_0x7ba3c){return _0x2e8187[_0xd7df('0x11')](_0x3da618)[_0xd7df('0x12')](_0x7ba3c);}return _0x2e8187[_0xd7df('0x13')](0x194);};}function handleError(_0xe1595f,_0x196632){_0x196632=_0x196632||0x1f4;return function(_0x3b2559){logger[_0xd7df('0xc')](_0x3b2559[_0xd7df('0x14')]);if(_0x3b2559['name']){delete _0x3b2559[_0xd7df('0x15')];}_0xe1595f[_0xd7df('0x11')](_0x196632)['send'](_0x3b2559);};}function findById(_0x18d38f){return function(_0xbe1c5e){if(!_['isNil'](_0x18d38f)&&!_[_0xd7df('0x16')](_0xbe1c5e)&&!_[_0xd7df('0x16')](_0xbe1c5e[_0xd7df('0x17')])){return _['find'](_0xbe1c5e[_0xd7df('0x17')],function(_0x471621){return _0x471621['id']==_0x18d38f;});}return null;};}exports[_0xd7df('0x18')]=function(_0x5ba653,_0x96d86e){return respondWithRpcPromise(_0xd7df('0x19'),_0x5ba653[_0xd7df('0x1a')])['then'](respondWithResult(_0x96d86e,null))[_0xd7df('0x10')](handleError(_0x96d86e,null));};exports['voiceChannelMixMonitor']=function(_0x225e33,_0x5ab737){return respondWithRpcPromise(_0xd7df('0x1b'),_[_0xd7df('0x1c')](_0x225e33[_0xd7df('0x1a')],_0x225e33['params']))[_0xd7df('0xb')](respondWithResult(_0x5ab737,null))['catch'](handleError(_0x5ab737,null));};exports[_0xd7df('0x1d')]=function(_0x379e4a,_0x40e7af){return respondWithRpcPromise(_0xd7df('0x1e'),_[_0xd7df('0x1c')](_0x379e4a[_0xd7df('0x1a')],_0x379e4a[_0xd7df('0x1f')]))['then'](respondWithResult(_0x40e7af,null))['catch'](handleError(_0x40e7af,null));};exports[_0xd7df('0x20')]=function(_0x38db14,_0x26047f){return respondWithRpcPromise(_0xd7df('0x21'),_0x38db14[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x26047f,null))[_0xd7df('0x10')](handleError(_0x26047f,null));};exports[_0xd7df('0x22')]=function(_0x163904,_0x5c4d17){return respondWithRpcPromise(_0xd7df('0x21'),_0x163904[_0xd7df('0x1a')])[_0xd7df('0xb')](findById(_0x163904[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x5c4d17,null))[_0xd7df('0x10')](handleError(_0x5c4d17,null));};exports[_0xd7df('0x23')]=function(_0x36de76,_0x5195cf){return respondWithRpcPromise('UpdateVoiceQueue',_['merge'](_0x36de76['body'],_0x36de76['params']))[_0xd7df('0xb')](respondWithResult(_0x5195cf,null))['catch'](handleError(_0x5195cf,null));};exports[_0xd7df('0x24')]=function(_0x156612,_0x503a90){return respondWithRpcPromise(_0xd7df('0x25'),_[_0xd7df('0x1c')](_0x156612['query'],_0x156612[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x503a90,null))[_0xd7df('0x10')](handleError(_0x503a90,null));};exports[_0xd7df('0x26')]=function(_0x40f965,_0x3304c4){return respondWithRpcPromise('VoiceQueuesChannels',_0x40f965[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x3304c4,null))[_0xd7df('0x10')](handleError(_0x3304c4,null));};exports[_0xd7df('0x27')]=function(_0x363f2d,_0x4cecf2){return respondWithRpcPromise(_0xd7df('0x28'),_[_0xd7df('0x1c')](_0x363f2d[_0xd7df('0x1a')],_0x363f2d[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x4cecf2,null))['catch'](handleError(_0x4cecf2,null));};exports['voiceQueuesChannelHangup']=function(_0x4051fb,_0x564562){return respondWithRpcPromise(_0xd7df('0x29'),_[_0xd7df('0x1c')](_0x4051fb[_0xd7df('0x1a')],_0x4051fb[_0xd7df('0x1f')]))['then'](respondWithResult(_0x564562,null))['catch'](handleError(_0x564562,null));};exports['voiceQueuesChannelRedirect']=function(_0x2a96e3,_0x15e682){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xd7df('0x1c')](_0x2a96e3[_0xd7df('0x1a')],_0x2a96e3[_0xd7df('0x1f')]))[_0xd7df('0xb')](respondWithResult(_0x15e682,null))['catch'](handleError(_0x15e682,null));};exports[_0xd7df('0x2a')]=function(_0x45642c,_0x5f0a6d){return respondWithRpcPromise(_0xd7df('0x2b'),_0x45642c['query'])[_0xd7df('0xb')](respondWithResult(_0x5f0a6d,null))[_0xd7df('0x10')](handleError(_0x5f0a6d,null));};exports[_0xd7df('0x2c')]=function(_0x59c755,_0x138391){return respondWithRpcPromise(_0xd7df('0x2d'),_0x59c755[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x138391,null))['catch'](handleError(_0x138391,null));};exports[_0xd7df('0x2e')]=function(_0x230857,_0x2314e6){var _0x4f6286;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')])[_0xd7df('0xb')](function(_0x517824){_0x4f6286=_0x517824;return respondWithRpcPromise(_0xd7df('0x2f'),_0x230857[_0xd7df('0x1a')],routingClient);})['then'](function(_0x4b2561){return _[_0xd7df('0x1c')]({},_0x4b2561,_0x4f6286);})[_0xd7df('0xb')](respondWithResult(_0x2314e6,null))[_0xd7df('0x10')](handleError(_0x2314e6,null));};exports['agentCapacity']=function(_0x5e8cd0,_0x2c149e){if(_0x5e8cd0['body']&&_0x5e8cd0[_0xd7df('0x30')]['interaction']&&_0x5e8cd0['user']&&_0x5e8cd0[_0xd7df('0x31')]['name']){for(var _0x18ef10 in _0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')]){if(_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0xd7df('0x33')](_0x18ef10)){db[_0xd7df('0x34')][_0xd7df('0x35')]({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')]['name'],'type':_0xd7df('0x36'),'exitAt':null,'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10]&&_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0xd7df('0x37')]?{'$notIn':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10]}:{'$ne':null}}})[_0xd7df('0xb')](function(_0x38056b){var _0x3a3c1a=moment()['format'](_0xd7df('0x38'));for(var _0x563f90=0x0,_0x49085b=_0x38056b['length'];_0x563f90<_0x49085b;_0x563f90+=0x1){_0x38056b[_0x563f90][_0xd7df('0x39')]({'exitAt':_0x3a3c1a});}});for(var _0x162900=0x0;_0x162900<_0x5e8cd0[_0xd7df('0x30')]['interaction'][_0x18ef10]['length'];_0x162900+=0x1){db[_0xd7df('0x34')]['findOrCreate']({'where':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'type':_0xd7df('0x36'),'uniqueid':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x32')][_0x18ef10][_0x162900],'exitAt':null},'defaults':{'channel':_0x18ef10,'membername':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x15')],'interface':_[_0xd7df('0x16')](_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')])?util[_0xd7df('0x3b')](_0xd7df('0x3c'),_0x5e8cd0['user'][_0xd7df('0x15')]):_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3a')],'type':_0xd7df('0x36'),'enterAt':moment()[_0xd7df('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd7df('0x3d'),'internal':_0x5e8cd0[_0xd7df('0x31')][_0xd7df('0x3e')],'uniqueid':_0x5e8cd0['body'][_0xd7df('0x32')][_0x18ef10][_0x162900]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x5e8cd0[_0xd7df('0x1f')]['id'],'capacity':_0x5e8cd0[_0xd7df('0x30')][_0xd7df('0x3f')]},routingClient)[_0xd7df('0xb')](respondWithResult(_0x2c149e,null))[_0xd7df('0x10')](handleError(_0x2c149e,null));};exports['telephones']=function(_0x4abe81,_0x53ec02){return respondWithRpcPromise(_0xd7df('0x40'),_0x4abe81['query'])[_0xd7df('0xb')](respondWithResult(_0x53ec02,null))[_0xd7df('0x10')](handleError(_0x53ec02,null));};exports[_0xd7df('0x41')]=function(_0xdf3046,_0x275af9){return respondWithRpcPromise(_0xd7df('0x42'),_0xdf3046[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x275af9,null))[_0xd7df('0x10')](handleError(_0x275af9,null));};exports[_0xd7df('0x43')]=function(_0x382d11,_0x327365){return respondWithRpcPromise(_0xd7df('0x44'),_0x382d11[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x327365,null))[_0xd7df('0x10')](handleError(_0x327365,null));};exports['chatQueues']=function(_0x332db5,_0x28c9b7){return respondWithRpcPromise('ChatQueues',_0x332db5['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x28c9b7,null))['catch'](handleError(_0x28c9b7,null));};exports[_0xd7df('0x45')]=function(_0x4fb55a,_0x1f34c2){return respondWithRpcPromise(_0xd7df('0x46'),_0x4fb55a[_0xd7df('0x1a')],routingClient)['then'](findById(_0x4fb55a['params']['id']))['then'](respondWithResult(_0x1f34c2,null))[_0xd7df('0x10')](handleError(_0x1f34c2,null));};exports[_0xd7df('0x47')]=function(_0x19c387,_0x527b6f){return respondWithRpcPromise(_0xd7df('0x48'),_0x19c387[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x527b6f,null))[_0xd7df('0x10')](handleError(_0x527b6f,null));};exports[_0xd7df('0x49')]=function(_0x35204f,_0x25d187){return respondWithRpcPromise(_0xd7df('0x48'),_0x35204f[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x35204f[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x25d187,null))[_0xd7df('0x10')](handleError(_0x25d187,null));};exports[_0xd7df('0x4a')]=function(_0x398e43,_0x3dba78){return respondWithRpcPromise(_0xd7df('0x4b'),_0x398e43[_0xd7df('0x1a')],mailClient)[_0xd7df('0xb')](respondWithResult(_0x3dba78,null))[_0xd7df('0x10')](handleError(_0x3dba78,null));};exports[_0xd7df('0x4c')]=function(_0x3f2775,_0x1e6277){return respondWithRpcPromise(_0xd7df('0x4d'),_0x3f2775[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x1e6277,null))[_0xd7df('0x10')](handleError(_0x1e6277,null));};exports[_0xd7df('0x4e')]=function(_0x3912d6,_0x51ae2b){return respondWithRpcPromise('OpenchannelQueues',_0x3912d6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3912d6[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x51ae2b,null))[_0xd7df('0x10')](handleError(_0x51ae2b,null));};exports[_0xd7df('0x4f')]=function(_0x1e87aa,_0x2786a6){return respondWithRpcPromise('SmsQueues',_0x1e87aa[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2786a6,null))[_0xd7df('0x10')](handleError(_0x2786a6,null));};exports[_0xd7df('0x50')]=function(_0x19a25b,_0x2fbc53){return respondWithRpcPromise(_0xd7df('0x51'),_0x19a25b[_0xd7df('0x1a')],routingClient)['then'](findById(_0x19a25b[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x2fbc53,null))['catch'](handleError(_0x2fbc53,null));};exports['whatsappQueues']=function(_0x481fa5,_0x264c5b){return respondWithRpcPromise(_0xd7df('0x52'),_0x481fa5[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x264c5b,null))['catch'](handleError(_0x264c5b,null));};exports[_0xd7df('0x53')]=function(_0x3d45cf,_0x19df03){return respondWithRpcPromise(_0xd7df('0x52'),_0x3d45cf[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](findById(_0x3d45cf[_0xd7df('0x1f')]['id']))['then'](respondWithResult(_0x19df03,null))['catch'](handleError(_0x19df03,null));};exports[_0xd7df('0x54')]=function(_0x5c1e68,_0x588537){return respondWithRpcPromise(_0xd7df('0x55'),_0x5c1e68[_0xd7df('0x1a')],routingClient)['then'](respondWithResult(_0x588537,null))['catch'](handleError(_0x588537,null));};exports[_0xd7df('0x56')]=function(_0x44d824,_0x49bf7e){return respondWithRpcPromise(_0xd7df('0x55'),_0x44d824[_0xd7df('0x1a')],routingClient)['then'](findById(_0x44d824[_0xd7df('0x1f')]['id']))[_0xd7df('0xb')](respondWithResult(_0x49bf7e,null))['catch'](handleError(_0x49bf7e,null));};exports[_0xd7df('0x57')]=function(_0x519f72,_0x56f55d){return respondWithRpcPromise(_0xd7df('0x58'),_0x519f72[_0xd7df('0x1a')])[_0xd7df('0xb')](respondWithResult(_0x56f55d,null))[_0xd7df('0x10')](handleError(_0x56f55d,null));};exports[_0xd7df('0x59')]=function(_0x40b2a1,_0x5831c1){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x40b2a1[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x5831c1,null))[_0xd7df('0x10')](handleError(_0x5831c1,null));};exports[_0xd7df('0x5a')]=function(_0x19b0e6,_0x31f681){return respondWithRpcPromise(_0xd7df('0x5b'),_0x19b0e6[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x31f681,null))['catch'](handleError(_0x31f681,null));};exports[_0xd7df('0x5c')]=function(_0x1682ca,_0x4e9806){return respondWithRpcPromise(_0xd7df('0x5d'),_0x1682ca[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4e9806,null))[_0xd7df('0x10')](handleError(_0x4e9806,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4e5363,_0x5628ed){return respondWithRpcPromise(_0xd7df('0x5d'),_0x4e5363['query'],routingClient)[_0xd7df('0xb')](function(_0x2b1b30){if(_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')]!==undefined){var _0x2d8a31=_(_0x2b1b30[_0xd7df('0x17')])['filter']([_0x4e5363[_0xd7df('0x1a')][_0xd7df('0x5e')],_0x4e5363[_0xd7df('0x1f')]['id']])['map'](_0xd7df('0x5f'))[_0xd7df('0x60')]()['value']();return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x157290){return _0x2d8a31[_0xd7df('0x62')](_0x157290[_0xd7df('0x5f')])>-0x1;});}else{return _0x2b1b30[_0xd7df('0x17')][_0xd7df('0x61')](function(_0x5e93cc){return _0x5e93cc[_0xd7df('0x5f')]===parseInt(_0x4e5363[_0xd7df('0x1f')]['id']);});}})[_0xd7df('0xb')](respondWithResult(_0x5628ed,null))[_0xd7df('0x10')](handleError(_0x5628ed,null));};exports['smsQueuesWaitingInteractions']=function(_0x531a07,_0x2e1e96){return respondWithRpcPromise(_0xd7df('0x63'),_0x531a07[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x2e1e96,null))[_0xd7df('0x10')](handleError(_0x2e1e96,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2329ce,_0x4f739b){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2329ce[_0xd7df('0x1a')],routingClient)[_0xd7df('0xb')](respondWithResult(_0x4f739b,null))[_0xd7df('0x10')](handleError(_0x4f739b,null));};exports[_0xd7df('0x64')]=function(_0x30c401,_0x3ece24){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x30c401['query'],routingClient)[_0xd7df('0xb')](respondWithResult(_0x3ece24,null))[_0xd7df('0x10')](handleError(_0x3ece24,null));};exports[_0xd7df('0x65')]=function(_0x175a36){return function(_0x5cb2b0,_0xac3b73){var _0x5df36d,_0x158bd9;var _0x5b73e5=_[_0xd7df('0x66')](_0x175a36);var _0x1ed032=_0x175a36===_0xd7df('0x67')?_0xd7df('0x68'):_0xd7df('0x69');return db[_0x5b73e5+_0xd7df('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5cb2b0[_0xd7df('0x1f')]['id']}})['then'](function(_0x1e2355){if(_[_0xd7df('0x16')](_0x1e2355)){throw new Error(_0x5b73e5+_0xd7df('0x6b'));}_0x5df36d=_0x1e2355;return db[_0x5b73e5+_0xd7df('0x6c')]['findOne']({'where':{'id':_0x5cb2b0[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x5b73e5+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x5b73e5+_0x1ed032],'as':_0xd7df('0x69')}]});})[_0xd7df('0xb')](function(_0x40a665){if(_[_0xd7df('0x16')](_0x40a665)){throw new Error(_0x5b73e5+_0xd7df('0x6f'));}_0x158bd9=_0x40a665;return _0x40a665[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0x15bd27={'uniqueid':_0x175a36+'.'+_0x158bd9['id']+'.'+_0x158bd9['Interaction']['id'],'FromUserId':_0x5cb2b0[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71')};_0x15bd27[_0x5b73e5+_0xd7df('0x72')]=_0x158bd9['id'];_0x15bd27[_0x5b73e5+'InteractionId']=_0x158bd9['Interaction']['id'];_0x15bd27[_0xd7df('0x73')+_0x5b73e5+_0x1ed032+'Id']=_0x158bd9[_0xd7df('0x69')]['id'];_0x15bd27['To'+_0x5b73e5+_0xd7df('0x74')]=_0x5df36d['id'];return db[_0x5b73e5+_0xd7df('0x75')][_0xd7df('0x76')](_0x15bd27);})[_0xd7df('0xb')](function(){return respondWithRpcPromise(_0xd7df('0x77'),{'channel':_0x175a36,'interaction':_0x158bd9[_0xd7df('0x6e')],'message':_0x158bd9,'account':_0x158bd9[_0xd7df('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x71'),'appdata':_0x5df36d['name']+','+(_0x158bd9[_0xd7df('0x69')][_0xd7df('0x78')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0xac3b73,null))[_0xd7df('0x10')](handleError(_0xac3b73,null));};};exports[_0xd7df('0x7a')]=function(_0x50c5b9,_0x518092){var _0xa3ae43,_0x31b159;if(_[_0xd7df('0x16')](_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x1a888c=_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x7b')];var _0x3d9fba=_[_0xd7df('0x66')](_0x1a888c);var _0x2861e3=_0x1a888c===_0xd7df('0x67')?'Website':_0xd7df('0x69');return db['User']['findOne']({'raw':!![],'where':{'id':_0x50c5b9[_0xd7df('0x1f')]['id'],'role':_0xd7df('0x3d')}})[_0xd7df('0xb')](function(_0x5092d2){if(_[_0xd7df('0x16')](_0x5092d2)){throw new Error('Agent\x20not\x20found');}_0xa3ae43=_0x5092d2;return db[_0x3d9fba+'Message'][_0xd7df('0x7c')]({'where':{'id':_0x50c5b9[_0xd7df('0x30')][_0xd7df('0x6d')]},'include':[{'model':db[_0x3d9fba+_0xd7df('0x6e')],'as':_0xd7df('0x6e')},{'model':db[_0x3d9fba+_0x2861e3],'as':'Account'}]});})['then'](function(_0x3f2ecd){if(_[_0xd7df('0x16')](_0x3f2ecd)){throw new Error(_0x3d9fba+_0xd7df('0x6f'));}_0x31b159=_0x3f2ecd;return _0x3f2ecd[_0xd7df('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd7df('0xb')](function(){var _0xc447e8={'uniqueid':_0x1a888c+'.'+_0x31b159['id']+'.'+_0x31b159[_0xd7df('0x6e')]['id'],'FromUserId':_0x50c5b9[_0xd7df('0x31')]['id'],'type':_0xd7df('0x71'),'ToUserId':_0xa3ae43['id']};_0xc447e8[_0x3d9fba+_0xd7df('0x72')]=_0x31b159['id'];_0xc447e8[_0x3d9fba+_0xd7df('0x7d')]=_0x31b159[_0xd7df('0x6e')]['id'];_0xc447e8[_0xd7df('0x73')+_0x3d9fba+_0x2861e3+'Id']=_0x31b159['Account']['id'];return db[_0x3d9fba+_0xd7df('0x75')][_0xd7df('0x76')](_0xc447e8);})[_0xd7df('0xb')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a888c,'interaction':_0x31b159[_0xd7df('0x6e')],'message':_0x31b159,'account':_0x31b159['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd7df('0x3d'),'appdata':_0xa3ae43[_0xd7df('0x15')]+','+(_0x31b159['Account'][_0xd7df('0x7e')]||0x12c),'interval':_0xd7df('0x79')}]},routingClient);})[_0xd7df('0xb')](respondWithResult(_0x518092,null))[_0xd7df('0x10')](handleError(_0x518092,null));}; \ No newline at end of file +var _0xf494=['WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','MessageId','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','messageId','update','InteractionId','From','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','message','status','json','sendStatus','stack','name','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','catch','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xf494,0x1c6));var _0x4f49=function(_0x144ddc,_0x288c7d){_0x144ddc=_0x144ddc-0x0;var _0x23af54=_0xf494[_0x144ddc];return _0x23af54;};'use strict';var BPromise=require(_0x4f49('0x0'));var moment=require(_0x4f49('0x1'));var _=require(_0x4f49('0x2'));var util=require('util');var db=require(_0x4f49('0x3'))['db'];var logger=require(_0x4f49('0x4'))(_0x4f49('0x5'));var jayson=require(_0x4f49('0x6'));var amiClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232a});var mailClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232b});var routingClient=jayson[_0x4f49('0x7')][_0x4f49('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){var _0x31a725=_0x58e9a0?_0x58e9a0:amiClient;return _0x31a725[_0x4f49('0x9')](_0x42b0e8,_0x5eb186)[_0x4f49('0xa')](function(_0x174d0d){if(_0x174d0d[_0x4f49('0xb')]){if(_0x174d0d[_0x4f49('0xb')]['code']===0x1f4){return _0x327bd5(_0x174d0d[_0x4f49('0xb')][_0x4f49('0xc')]);}return _0x169c95(_0x174d0d['error'][_0x4f49('0xc')]);}else{_0x169c95(_0x174d0d['result']);}})['catch'](function(_0x4b9cd3){_0x327bd5(_0x4b9cd3);});});}function respondWithResult(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xc8;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0xd')](_0x4bf89f)[_0x4f49('0xe')](_0x1e1c37);}return _0x12527d[_0x4f49('0xf')](0x194);};}function handleError(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0x1f4;return function(_0xfdb477){logger['error'](_0xfdb477[_0x4f49('0x10')]);if(_0xfdb477[_0x4f49('0x11')]){delete _0xfdb477[_0x4f49('0x11')];}_0x1a0f1e['status'](_0x2f0131)['send'](_0xfdb477);};}function findById(_0x2f0a0d){return function(_0x2ecaaa){if(!_[_0x4f49('0x12')](_0x2f0a0d)&&!_['isNil'](_0x2ecaaa)&&!_[_0x4f49('0x12')](_0x2ecaaa[_0x4f49('0x13')])){return _[_0x4f49('0x14')](_0x2ecaaa['rows'],function(_0x5bb23b){return _0x5bb23b['id']==_0x2f0a0d;});}return null;};}exports['voiceChannels']=function(_0x47f1e8,_0xb2081a){return respondWithRpcPromise(_0x4f49('0x15'),_0x47f1e8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0xb2081a,null))['catch'](handleError(_0xb2081a,null));};exports[_0x4f49('0x17')]=function(_0x2aed27,_0x197a49){return respondWithRpcPromise(_0x4f49('0x18'),_[_0x4f49('0x19')](_0x2aed27['query'],_0x2aed27[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x197a49,null))[_0x4f49('0x1b')](handleError(_0x197a49,null));};exports['voiceChannelStopMixMonitor']=function(_0x40755e,_0x1d70a7){return respondWithRpcPromise(_0x4f49('0x1c'),_[_0x4f49('0x19')](_0x40755e[_0x4f49('0x16')],_0x40755e[_0x4f49('0x1a')]))['then'](respondWithResult(_0x1d70a7,null))['catch'](handleError(_0x1d70a7,null));};exports[_0x4f49('0x1d')]=function(_0x429de7,_0x4fedbb){return respondWithRpcPromise(_0x4f49('0x1e'),_0x429de7[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x4fedbb,null))['catch'](handleError(_0x4fedbb,null));};exports[_0x4f49('0x1f')]=function(_0x2eed1c,_0x298785){return respondWithRpcPromise(_0x4f49('0x1e'),_0x2eed1c[_0x4f49('0x16')])[_0x4f49('0xa')](findById(_0x2eed1c['params']['id']))['then'](respondWithResult(_0x298785,null))[_0x4f49('0x1b')](handleError(_0x298785,null));};exports[_0x4f49('0x20')]=function(_0x605c91,_0x560050){return respondWithRpcPromise(_0x4f49('0x21'),_[_0x4f49('0x19')](_0x605c91[_0x4f49('0x22')],_0x605c91['params']))['then'](respondWithResult(_0x560050,null))[_0x4f49('0x1b')](handleError(_0x560050,null));};exports[_0x4f49('0x23')]=function(_0x7a6ea0,_0x5e7076){return respondWithRpcPromise(_0x4f49('0x24'),_[_0x4f49('0x19')](_0x7a6ea0[_0x4f49('0x16')],_0x7a6ea0[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x5e7076,null))[_0x4f49('0x1b')](handleError(_0x5e7076,null));};exports[_0x4f49('0x25')]=function(_0x45ae19,_0x1f38d3){return respondWithRpcPromise(_0x4f49('0x26'),_0x45ae19[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f38d3,null))[_0x4f49('0x1b')](handleError(_0x1f38d3,null));};exports[_0x4f49('0x27')]=function(_0x135d17,_0x97ef98){return respondWithRpcPromise(_0x4f49('0x28'),_[_0x4f49('0x19')](_0x135d17[_0x4f49('0x16')],_0x135d17['params']))[_0x4f49('0xa')](respondWithResult(_0x97ef98,null))[_0x4f49('0x1b')](handleError(_0x97ef98,null));};exports[_0x4f49('0x29')]=function(_0x1cb3cc,_0x1c3af8){return respondWithRpcPromise(_0x4f49('0x2a'),_[_0x4f49('0x19')](_0x1cb3cc[_0x4f49('0x16')],_0x1cb3cc[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x1c3af8,null))[_0x4f49('0x1b')](handleError(_0x1c3af8,null));};exports[_0x4f49('0x2b')]=function(_0x3ec6c4,_0x4d2d57){return respondWithRpcPromise(_0x4f49('0x2c'),_[_0x4f49('0x19')](_0x3ec6c4[_0x4f49('0x16')],_0x3ec6c4[_0x4f49('0x1a')]))[_0x4f49('0xa')](respondWithResult(_0x4d2d57,null))[_0x4f49('0x1b')](handleError(_0x4d2d57,null));};exports[_0x4f49('0x2d')]=function(_0x25fdf8,_0x10bfc4){return respondWithRpcPromise(_0x4f49('0x2e'),_0x25fdf8[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x10bfc4,null))[_0x4f49('0x1b')](handleError(_0x10bfc4,null));};exports[_0x4f49('0x2f')]=function(_0x4e3f72,_0x802f20){return respondWithRpcPromise(_0x4f49('0x30'),_0x4e3f72['query'])[_0x4f49('0xa')](respondWithResult(_0x802f20,null))[_0x4f49('0x1b')](handleError(_0x802f20,null));};exports['agents']=function(_0x29e762,_0x1dd1a6){var _0x2548ad;return respondWithRpcPromise(_0x4f49('0x31'),_0x29e762[_0x4f49('0x16')])[_0x4f49('0xa')](function(_0x29e910){_0x2548ad=_0x29e910;return respondWithRpcPromise('Agents',_0x29e762['query'],routingClient);})['then'](function(_0x15e4b3){return _[_0x4f49('0x19')]({},_0x15e4b3,_0x2548ad);})[_0x4f49('0xa')](respondWithResult(_0x1dd1a6,null))[_0x4f49('0x1b')](handleError(_0x1dd1a6,null));};exports[_0x4f49('0x32')]=function(_0x1ecf6c,_0x38aff8){if(_0x1ecf6c[_0x4f49('0x22')]&&_0x1ecf6c[_0x4f49('0x22')]['interaction']&&_0x1ecf6c['user']&&_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]){for(var _0x159642 in _0x1ecf6c['body'][_0x4f49('0x34')]){if(_0x1ecf6c['body']['interaction'][_0x4f49('0x35')](_0x159642)){db[_0x4f49('0x36')][_0x4f49('0x37')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'exitAt':null,'uniqueid':_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642]&&_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')]?{'$notIn':_0x1ecf6c[_0x4f49('0x22')]['interaction'][_0x159642]}:{'$ne':null}}})[_0x4f49('0xa')](function(_0x1e5f0b){var _0x33bb04=moment()[_0x4f49('0x3a')](_0x4f49('0x3b'));for(var _0x1c41e4=0x0,_0xe66867=_0x1e5f0b[_0x4f49('0x39')];_0x1c41e4<_0xe66867;_0x1c41e4+=0x1){_0x1e5f0b[_0x1c41e4][_0x4f49('0x3c')]({'exitAt':_0x33bb04});}});for(var _0x157a55=0x0;_0x157a55<_0x1ecf6c['body'][_0x4f49('0x34')][_0x159642][_0x4f49('0x39')];_0x157a55+=0x1){db['MemberReport'][_0x4f49('0x3d')]({'where':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'type':_0x4f49('0x38'),'uniqueid':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x34')][_0x159642][_0x157a55],'exitAt':null},'defaults':{'channel':_0x159642,'membername':_0x1ecf6c['user'][_0x4f49('0x11')],'interface':_[_0x4f49('0x12')](_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')])?util[_0x4f49('0x3a')](_0x4f49('0x3f'),_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x11')]):_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x3e')],'type':_0x4f49('0x38'),'enterAt':moment()[_0x4f49('0x3a')](_0x4f49('0x3b')),'role':_0x4f49('0x40'),'internal':_0x1ecf6c[_0x4f49('0x33')][_0x4f49('0x41')],'uniqueid':_0x1ecf6c['body']['interaction'][_0x159642][_0x157a55]}});}}}}return respondWithRpcPromise(_0x4f49('0x42'),{'id':_0x1ecf6c[_0x4f49('0x1a')]['id'],'capacity':_0x1ecf6c[_0x4f49('0x22')][_0x4f49('0x43')]},routingClient)[_0x4f49('0xa')](respondWithResult(_0x38aff8,null))[_0x4f49('0x1b')](handleError(_0x38aff8,null));};exports[_0x4f49('0x44')]=function(_0x51c756,_0x6637f4){return respondWithRpcPromise('Telephones',_0x51c756[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x6637f4,null))[_0x4f49('0x1b')](handleError(_0x6637f4,null));};exports[_0x4f49('0x45')]=function(_0x586095,_0x342980){return respondWithRpcPromise('Trunks',_0x586095['query'])[_0x4f49('0xa')](respondWithResult(_0x342980,null))[_0x4f49('0x1b')](handleError(_0x342980,null));};exports[_0x4f49('0x46')]=function(_0x26ae33,_0x56375a){return respondWithRpcPromise('Campaigns',_0x26ae33[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x56375a,null))['catch'](handleError(_0x56375a,null));};exports[_0x4f49('0x47')]=function(_0x5b50bc,_0x5a929a){return respondWithRpcPromise(_0x4f49('0x48'),_0x5b50bc['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5a929a,null))['catch'](handleError(_0x5a929a,null));};exports[_0x4f49('0x49')]=function(_0x38a640,_0x2472c9){return respondWithRpcPromise(_0x4f49('0x48'),_0x38a640[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x38a640[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x2472c9,null))['catch'](handleError(_0x2472c9,null));};exports[_0x4f49('0x4a')]=function(_0x51f57e,_0x213608){return respondWithRpcPromise(_0x4f49('0x4b'),_0x51f57e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x213608,null))[_0x4f49('0x1b')](handleError(_0x213608,null));};exports[_0x4f49('0x4c')]=function(_0x553981,_0x426c50){return respondWithRpcPromise(_0x4f49('0x4b'),_0x553981['query'],routingClient)['then'](findById(_0x553981[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x426c50,null))[_0x4f49('0x1b')](handleError(_0x426c50,null));};exports[_0x4f49('0x4d')]=function(_0x19a788,_0x4af08d){return respondWithRpcPromise(_0x4f49('0x4e'),_0x19a788['query'],mailClient)[_0x4f49('0xa')](respondWithResult(_0x4af08d,null))[_0x4f49('0x1b')](handleError(_0x4af08d,null));};exports[_0x4f49('0x4f')]=function(_0x4aae7c,_0x1dade6){return respondWithRpcPromise(_0x4f49('0x50'),_0x4aae7c[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x1dade6,null))['catch'](handleError(_0x1dade6,null));};exports[_0x4f49('0x51')]=function(_0x269564,_0x5e6898){return respondWithRpcPromise(_0x4f49('0x50'),_0x269564[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x269564[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x5e6898,null))[_0x4f49('0x1b')](handleError(_0x5e6898,null));};exports[_0x4f49('0x52')]=function(_0x30fc21,_0x519721){return respondWithRpcPromise(_0x4f49('0x53'),_0x30fc21[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x519721,null))[_0x4f49('0x1b')](handleError(_0x519721,null));};exports[_0x4f49('0x54')]=function(_0x26b022,_0x335875){return respondWithRpcPromise('SmsQueues',_0x26b022[_0x4f49('0x16')],routingClient)['then'](findById(_0x26b022[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x335875,null))[_0x4f49('0x1b')](handleError(_0x335875,null));};exports[_0x4f49('0x55')]=function(_0xc7743e,_0x3f2f3f){return respondWithRpcPromise(_0x4f49('0x56'),_0xc7743e[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x3f2f3f,null))[_0x4f49('0x1b')](handleError(_0x3f2f3f,null));};exports['showWhatsappQueues']=function(_0x2f9f2e,_0x141554){return respondWithRpcPromise(_0x4f49('0x56'),_0x2f9f2e[_0x4f49('0x16')],routingClient)['then'](findById(_0x2f9f2e['params']['id']))[_0x4f49('0xa')](respondWithResult(_0x141554,null))['catch'](handleError(_0x141554,null));};exports[_0x4f49('0x57')]=function(_0x287705,_0x43bdde){return respondWithRpcPromise(_0x4f49('0x58'),_0x287705[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x43bdde,null))[_0x4f49('0x1b')](handleError(_0x43bdde,null));};exports[_0x4f49('0x59')]=function(_0x3823f0,_0x3e9b47){return respondWithRpcPromise(_0x4f49('0x58'),_0x3823f0[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](findById(_0x3823f0[_0x4f49('0x1a')]['id']))[_0x4f49('0xa')](respondWithResult(_0x3e9b47,null))[_0x4f49('0x1b')](handleError(_0x3e9b47,null));};exports[_0x4f49('0x5a')]=function(_0x753863,_0x1f9161){return respondWithRpcPromise(_0x4f49('0x5b'),_0x753863[_0x4f49('0x16')])[_0x4f49('0xa')](respondWithResult(_0x1f9161,null))[_0x4f49('0x1b')](handleError(_0x1f9161,null));};exports[_0x4f49('0x5c')]=function(_0x2d0990,_0x49a79d){return respondWithRpcPromise(_0x4f49('0x5d'),_0x2d0990['query'],routingClient)[_0x4f49('0xa')](respondWithResult(_0x49a79d,null))[_0x4f49('0x1b')](handleError(_0x49a79d,null));};exports[_0x4f49('0x5e')]=function(_0x3c0f69,_0x26de18){return respondWithRpcPromise(_0x4f49('0x5f'),_0x3c0f69[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x26de18,null))[_0x4f49('0x1b')](handleError(_0x26de18,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x4b6ef4,_0x539e21){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4b6ef4[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x539e21,null))[_0x4f49('0x1b')](handleError(_0x539e21,null));};exports[_0x4f49('0x60')]=function(_0x1fc88a,_0x5a8b1c){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fc88a[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](function(_0x4bdd1b){if(_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')]!==undefined){var _0x5c824f=_(_0x4bdd1b[_0x4f49('0x13')])['filter']([_0x1fc88a[_0x4f49('0x16')][_0x4f49('0x61')],_0x1fc88a['params']['id']])[_0x4f49('0x62')](_0x4f49('0x63'))[_0x4f49('0x64')]()[_0x4f49('0x65')]();return _0x4bdd1b[_0x4f49('0x13')][_0x4f49('0x66')](function(_0x5f0dbf){return _0x5c824f[_0x4f49('0x67')](_0x5f0dbf['queue_id'])>-0x1;});}else{return _0x4bdd1b[_0x4f49('0x13')]['filter'](function(_0x50c06e){return _0x50c06e['queue_id']===parseInt(_0x1fc88a[_0x4f49('0x1a')]['id']);});}})[_0x4f49('0xa')](respondWithResult(_0x5a8b1c,null))[_0x4f49('0x1b')](handleError(_0x5a8b1c,null));};exports[_0x4f49('0x68')]=function(_0x47af99,_0x39024d){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x47af99[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x39024d,null))[_0x4f49('0x1b')](handleError(_0x39024d,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x4938a6,_0x329a49){return respondWithRpcPromise(_0x4f49('0x69'),_0x4938a6[_0x4f49('0x16')],routingClient)['then'](respondWithResult(_0x329a49,null))[_0x4f49('0x1b')](handleError(_0x329a49,null));};exports[_0x4f49('0x6a')]=function(_0x5c33c9,_0x5d52ae){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x5c33c9[_0x4f49('0x16')],routingClient)[_0x4f49('0xa')](respondWithResult(_0x5d52ae,null))[_0x4f49('0x1b')](handleError(_0x5d52ae,null));};exports[_0x4f49('0x6b')]=function(_0x1643fc){return function(_0x517144,_0x15b7e4){var _0x1b922e,_0x29de92;var _0x58d07e=_[_0x4f49('0x6c')](_0x1643fc);var _0x34843a=_0x1643fc===_0x4f49('0x6d')?_0x4f49('0x6e'):'Account';return db[_0x58d07e+_0x4f49('0x6f')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x517144[_0x4f49('0x1a')]['id']}})[_0x4f49('0xa')](function(_0x389679){if(_['isNil'](_0x389679)){throw new Error(_0x58d07e+_0x4f49('0x71'));}_0x1b922e=_0x389679;return db[_0x58d07e+_0x4f49('0x72')]['findOne']({'where':{'id':_0x517144[_0x4f49('0x22')]['messageId']},'include':[{'model':db[_0x58d07e+_0x4f49('0x73')],'as':'Interaction'},{'model':db[_0x58d07e+_0x34843a],'as':_0x4f49('0x74')}]});})[_0x4f49('0xa')](function(_0x2ef19e){if(_[_0x4f49('0x12')](_0x2ef19e)){throw new Error(_0x58d07e+_0x4f49('0x75'));}_0x29de92=_0x2ef19e;return _0x2ef19e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4f49('0xa')](function(){var _0x1f3556={'uniqueid':_0x1643fc+'.'+_0x29de92['id']+'.'+_0x29de92[_0x4f49('0x73')]['id'],'FromUserId':_0x517144[_0x4f49('0x33')]['id'],'type':'queue'};_0x1f3556[_0x58d07e+_0x4f49('0x76')]=_0x29de92['id'];_0x1f3556[_0x58d07e+'InteractionId']=_0x29de92[_0x4f49('0x73')]['id'];_0x1f3556['From'+_0x58d07e+_0x34843a+'Id']=_0x29de92[_0x4f49('0x74')]['id'];_0x1f3556['To'+_0x58d07e+_0x4f49('0x77')]=_0x1b922e['id'];return db[_0x58d07e+_0x4f49('0x78')][_0x4f49('0x79')](_0x1f3556);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x1643fc,'interaction':_0x29de92[_0x4f49('0x73')],'message':_0x29de92,'account':_0x29de92[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4f49('0x7b'),'appdata':_0x1b922e[_0x4f49('0x11')]+','+(_0x29de92['Account'][_0x4f49('0x7c')]||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x15b7e4,null))[_0x4f49('0x1b')](handleError(_0x15b7e4,null));};};exports[_0x4f49('0x7e')]=function(_0x24b033,_0x55b28b){var _0x2ec42b,_0x20a0d4;if(_[_0x4f49('0x12')](_0x24b033[_0x4f49('0x22')]['channel'])){throw new Error(_0x4f49('0x7f'));}var _0x57567a=_0x24b033[_0x4f49('0x22')][_0x4f49('0x80')];var _0x5c5d2=_[_0x4f49('0x6c')](_0x57567a);var _0x4cfb48=_0x57567a===_0x4f49('0x6d')?_0x4f49('0x6e'):_0x4f49('0x74');return db[_0x4f49('0x81')][_0x4f49('0x70')]({'raw':!![],'where':{'id':_0x24b033[_0x4f49('0x1a')]['id'],'role':_0x4f49('0x40')}})[_0x4f49('0xa')](function(_0x355787){if(_[_0x4f49('0x12')](_0x355787)){throw new Error(_0x4f49('0x82'));}_0x2ec42b=_0x355787;return db[_0x5c5d2+_0x4f49('0x72')][_0x4f49('0x70')]({'where':{'id':_0x24b033[_0x4f49('0x22')][_0x4f49('0x83')]},'include':[{'model':db[_0x5c5d2+_0x4f49('0x73')],'as':_0x4f49('0x73')},{'model':db[_0x5c5d2+_0x4cfb48],'as':_0x4f49('0x74')}]});})['then'](function(_0x1979ef){if(_[_0x4f49('0x12')](_0x1979ef)){throw new Error(_0x5c5d2+_0x4f49('0x75'));}_0x20a0d4=_0x1979ef;return _0x1979ef[_0x4f49('0x84')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x225e63={'uniqueid':_0x57567a+'.'+_0x20a0d4['id']+'.'+_0x20a0d4[_0x4f49('0x73')]['id'],'FromUserId':_0x24b033['user']['id'],'type':_0x4f49('0x7b'),'ToUserId':_0x2ec42b['id']};_0x225e63[_0x5c5d2+'MessageId']=_0x20a0d4['id'];_0x225e63[_0x5c5d2+_0x4f49('0x85')]=_0x20a0d4[_0x4f49('0x73')]['id'];_0x225e63[_0x4f49('0x86')+_0x5c5d2+_0x4cfb48+'Id']=_0x20a0d4[_0x4f49('0x74')]['id'];return db[_0x5c5d2+_0x4f49('0x78')][_0x4f49('0x79')](_0x225e63);})[_0x4f49('0xa')](function(){return respondWithRpcPromise(_0x4f49('0x7a'),{'channel':_0x57567a,'interaction':_0x20a0d4[_0x4f49('0x73')],'message':_0x20a0d4,'account':_0x20a0d4[_0x4f49('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2ec42b['name']+','+(_0x20a0d4[_0x4f49('0x74')]['agentTransferTimeout']||0x12c),'interval':_0x4f49('0x7d')}]},routingClient);})[_0x4f49('0xa')](respondWithResult(_0x55b28b,null))['catch'](handleError(_0x55b28b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 4b834e8..39322b4 100644 --- a/server/api/schedule/index.js +++ b/server/api/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6f2=['../../components/auth/service','../../config/environment','./schedule.controller','get','/:id','show','/:id/run','isAuthenticated','run','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xd6f2,0x18a));var _0x2d6f=function(_0xd14bb1,_0x1ed15b){_0xd14bb1=_0xd14bb1-0x0;var _0x11c5b6=_0xd6f2[_0xd14bb1];return _0x11c5b6;};'use strict';var multer=require(_0x2d6f('0x0'));var util=require(_0x2d6f('0x1'));var path=require(_0x2d6f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d6f('0x3'));var router=express[_0x2d6f('0x4')]();var fs_extra=require(_0x2d6f('0x5'));var auth=require(_0x2d6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d6f('0x7'));var controller=require(_0x2d6f('0x8'));router[_0x2d6f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2d6f('0xa'),auth['isAuthenticated'](),controller[_0x2d6f('0xb')]);router[_0x2d6f('0x9')](_0x2d6f('0xc'),auth[_0x2d6f('0xd')](),controller[_0x2d6f('0xe')]);router[_0x2d6f('0xf')]('/',auth[_0x2d6f('0xd')](),controller[_0x2d6f('0x10')]);router[_0x2d6f('0x11')](_0x2d6f('0xa'),auth[_0x2d6f('0xd')](),controller['update']);router['delete'](_0x2d6f('0xa'),auth[_0x2d6f('0xd')](),controller[_0x2d6f('0x12')]);module[_0x2d6f('0x13')]=router; \ No newline at end of file +var _0xa8d0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','fs-extra'];(function(_0x3cd19b,_0xa47050){var _0x46a9b0=function(_0xf7749){while(--_0xf7749){_0x3cd19b['push'](_0x3cd19b['shift']());}};_0x46a9b0(++_0xa47050);}(_0xa8d0,0x18c));var _0x0a8d=function(_0xb2c8c6,_0x3a23bb){_0xb2c8c6=_0xb2c8c6-0x0;var _0x456594=_0xa8d0[_0xb2c8c6];return _0x456594;};'use strict';var multer=require(_0x0a8d('0x0'));var util=require(_0x0a8d('0x1'));var path=require(_0x0a8d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a8d('0x3'));var auth=require(_0x0a8d('0x4'));var interaction=require(_0x0a8d('0x5'));var config=require(_0x0a8d('0x6'));var controller=require(_0x0a8d('0x7'));router[_0x0a8d('0x8')]('/',auth[_0x0a8d('0x9')](),controller['index']);router['get']('/:id',auth[_0x0a8d('0x9')](),controller['show']);router[_0x0a8d('0x8')](_0x0a8d('0xa'),auth[_0x0a8d('0x9')](),controller[_0x0a8d('0xb')]);router[_0x0a8d('0xc')]('/',auth['isAuthenticated'](),controller[_0x0a8d('0xd')]);router[_0x0a8d('0xe')](_0x0a8d('0xf'),auth['isAuthenticated'](),controller[_0x0a8d('0x10')]);router[_0x0a8d('0x11')]('/:id',auth[_0x0a8d('0x9')](),controller[_0x0a8d('0x12')]);module[_0x0a8d('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index af34068..8bac8be 100644 --- a/server/api/schedule/schedule.attributes.js +++ b/server/api/schedule/schedule.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa594=['BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x531ee7,_0x2b1aa7){var _0xf1439d=function(_0x3a6c45){while(--_0x3a6c45){_0x531ee7['push'](_0x531ee7['shift']());}};_0xf1439d(++_0x2b1aa7);}(_0xa594,0x13d));var _0x4a59=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xa594[_0x50e593];return _0x3821d0;};'use strict';var Sequelize=require(_0x4a59('0x0'));module[_0x4a59('0x1')]={'name':{'type':Sequelize[_0x4a59('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4a59('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4a59('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4a59('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4a59('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4a59('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0x7'),_0x4a59('0x8'),_0x4a59('0x9'),_0x4a59('0xa'),'days',_0x4a59('0xb'),_0x4a59('0xc')),'allowNull':![],'defaultValue':_0x4a59('0xd')},'output':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0xe'),_0x4a59('0xf'),_0x4a59('0x10')),'allowNull':![],'defaultValue':_0x4a59('0xe')},'type':{'type':Sequelize[_0x4a59('0x6')](_0x4a59('0x11'),_0x4a59('0x12')),'allowNull':![],'defaultValue':_0x4a59('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x4a59('0x2')]},'cc':{'type':Sequelize[_0x4a59('0x13')]},'bcc':{'type':Sequelize[_0x4a59('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9a81=['pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','weeks','hours','minutes','days','ENUM','csv'];(function(_0x56d5ea,_0x530395){var _0x3080c=function(_0xa87a3a){while(--_0xa87a3a){_0x56d5ea['push'](_0x56d5ea['shift']());}};_0x3080c(++_0x530395);}(_0x9a81,0x17b));var _0x19a8=function(_0xd4e8b0,_0x9a018){_0xd4e8b0=_0xd4e8b0-0x0;var _0x1a5ed1=_0x9a81[_0xd4e8b0];return _0x1a5ed1;};'use strict';var Sequelize=require('sequelize');module[_0x19a8('0x0')]={'name':{'type':Sequelize[_0x19a8('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x19a8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x19a8('0x1')],'allowNull':![],'defaultValue':_0x19a8('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x19a8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x19a8('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters','months',_0x19a8('0x6'),'days',_0x19a8('0x7'),_0x19a8('0x8')),'allowNull':![],'defaultValue':_0x19a8('0x9')},'output':{'type':Sequelize[_0x19a8('0xa')](_0x19a8('0xb'),_0x19a8('0xc'),_0x19a8('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x19a8('0xa')](_0x19a8('0xe'),_0x19a8('0xf')),'allowNull':![],'defaultValue':_0x19a8('0xe')},'sendMail':{'type':Sequelize[_0x19a8('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x19a8('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x19a8('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3b41a48..48acbfd 100644 --- a/server/api/schedule/schedule.controller.js +++ b/server/api/schedule/schedule.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaa3=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','pick','filter','where','merge','VIRTUAL','options','Schedule','includeAll','include','findAll','catch','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xaaa3,0x145));var _0x3aaa=function(_0x379557,_0x5ab49){_0x379557=_0x379557-0x0;var _0x441372=_0xaaa3[_0x379557];return _0x441372;};'use strict';var emlformat=require(_0x3aaa('0x0'));var rimraf=require(_0x3aaa('0x1'));var zipdir=require(_0x3aaa('0x2'));var jsonpatch=require(_0x3aaa('0x3'));var rp=require(_0x3aaa('0x4'));var moment=require(_0x3aaa('0x5'));var BPromise=require(_0x3aaa('0x6'));var Mustache=require(_0x3aaa('0x7'));var util=require(_0x3aaa('0x8'));var path=require(_0x3aaa('0x9'));var sox=require(_0x3aaa('0xa'));var csv=require(_0x3aaa('0xb'));var ejs=require(_0x3aaa('0xc'));var fs=require('fs');var fs_extra=require(_0x3aaa('0xd'));var _=require(_0x3aaa('0xe'));var squel=require('squel');var crypto=require(_0x3aaa('0xf'));var jsforce=require(_0x3aaa('0x10'));var deskjs=require(_0x3aaa('0x11'));var toCsv=require(_0x3aaa('0xb'));var querystring=require('querystring');var Papa=require(_0x3aaa('0x12'));var Redis=require(_0x3aaa('0x13'));var authService=require(_0x3aaa('0x14'));var qs=require(_0x3aaa('0x15'));var as=require(_0x3aaa('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3aaa('0x17'));var config=require(_0x3aaa('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x426940,_0x40704e){_0x40704e=_0x40704e||0xcc;return function(_0x10c17d){if(_0x10c17d){return _0x426940[_0x3aaa('0x19')](_0x40704e);}return _0x426940[_0x3aaa('0x1a')](_0x40704e)[_0x3aaa('0x1b')]();};}function respondWithResult(_0x3582ab,_0x2eaaa5){_0x2eaaa5=_0x2eaaa5||0xc8;return function(_0x471d23){if(_0x471d23){return _0x3582ab[_0x3aaa('0x1a')](_0x2eaaa5)[_0x3aaa('0x1c')](_0x471d23);}};}function respondWithFilteredResult(_0x579b88,_0x284129){return function(_0x3dca1a){if(_0x3dca1a){var _0x547dc7=typeof _0x284129[_0x3aaa('0x1d')]===_0x3aaa('0x1e')&&typeof _0x284129[_0x3aaa('0x1f')]===_0x3aaa('0x1e');var _0x58e285=_0x3dca1a[_0x3aaa('0x20')];var _0x375dc0=_0x547dc7?0x0:_0x284129[_0x3aaa('0x1d')];var _0x3c8117=_0x547dc7?_0x3dca1a[_0x3aaa('0x20')]:_0x284129[_0x3aaa('0x1d')]+_0x284129[_0x3aaa('0x1f')];var _0x5b344d;if(_0x3c8117>=_0x58e285){_0x3c8117=_0x58e285;_0x5b344d=0xc8;}else{_0x5b344d=0xce;}_0x579b88['status'](_0x5b344d);return _0x579b88[_0x3aaa('0x21')](_0x3aaa('0x22'),_0x375dc0+'-'+_0x3c8117+'/'+_0x58e285)['json'](_0x3dca1a);}return null;};}function patchUpdates(_0x2a6cdd){return function(_0x3ee229){try{jsonpatch[_0x3aaa('0x23')](_0x3ee229,_0x2a6cdd,!![]);}catch(_0x449390){return BPromise[_0x3aaa('0x24')](_0x449390);}return _0x3ee229['save']();};}function saveUpdates(_0x231c7d,_0x1a8ee1){return function(_0x23154e){if(_0x23154e){return _0x23154e[_0x3aaa('0x25')](_0x231c7d)[_0x3aaa('0x26')](function(_0x2be360){return _0x2be360;});}return null;};}function removeEntity(_0xec7fb9,_0x17a4b9){return function(_0x5d6685){if(_0x5d6685){return _0x5d6685[_0x3aaa('0x27')]()['then'](function(){var _0x212794=_0x5d6685[_0x3aaa('0x28')]({'plain':!![]});var _0x17f9a6=_0x3aaa('0x29');return db['UserProfileResource'][_0x3aaa('0x27')]({'where':{'type':_0x17f9a6,'resourceId':_0x212794['id']}})[_0x3aaa('0x26')](function(){return _0x5d6685;});})[_0x3aaa('0x26')](function(){_0xec7fb9[_0x3aaa('0x1a')](0xcc)[_0x3aaa('0x1b')]();});}};}function handleEntityNotFound(_0x46a304,_0x2dbb2a){return function(_0x220696){if(!_0x220696){_0x46a304[_0x3aaa('0x19')](0x194);}return _0x220696;};}function handleError(_0x38d18b,_0x3b0bd1){_0x3b0bd1=_0x3b0bd1||0x1f4;return function(_0x14376b){logger['error'](_0x14376b[_0x3aaa('0x2a')]);if(_0x14376b[_0x3aaa('0x2b')]){delete _0x14376b['name'];}_0x38d18b['status'](_0x3b0bd1)['send'](_0x14376b);};}exports[_0x3aaa('0x2c')]=function(_0x120727,_0x161571){var _0x3ab0dd={},_0x1f73d4={},_0x587453={'count':0x0,'rows':[]};var _0x412678=_[_0x3aaa('0x2d')](db['Schedule']['rawAttributes'],function(_0xd2ffad){return{'name':_0xd2ffad[_0x3aaa('0x2e')],'type':_0xd2ffad[_0x3aaa('0x2f')][_0x3aaa('0x30')]};});_0x1f73d4[_0x3aaa('0x31')]=_[_0x3aaa('0x2d')](_0x412678,'name');_0x1f73d4[_0x3aaa('0x32')]=_[_0x3aaa('0x33')](_0x120727[_0x3aaa('0x32')]);_0x1f73d4[_0x3aaa('0x34')]=_['intersection'](_0x1f73d4['model'],_0x1f73d4[_0x3aaa('0x32')]);_0x3ab0dd[_0x3aaa('0x35')]=_[_0x3aaa('0x36')](_0x1f73d4[_0x3aaa('0x31')],qs[_0x3aaa('0x37')](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x37')]));_0x3ab0dd[_0x3aaa('0x35')]=_0x3ab0dd[_0x3aaa('0x35')]['length']?_0x3ab0dd[_0x3aaa('0x35')]:_0x1f73d4[_0x3aaa('0x31')];if(!_0x120727[_0x3aaa('0x32')][_0x3aaa('0x38')]('nolimit')){_0x3ab0dd[_0x3aaa('0x1f')]=qs[_0x3aaa('0x1f')](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x1f')]);_0x3ab0dd[_0x3aaa('0x1d')]=qs['offset'](_0x120727[_0x3aaa('0x32')][_0x3aaa('0x1d')]);}_0x3ab0dd['order']=qs['sort'](_0x120727[_0x3aaa('0x32')]['sort']);_0x3ab0dd['where']=qs[_0x3aaa('0x34')](_[_0x3aaa('0x39')](_0x120727['query'],_0x1f73d4[_0x3aaa('0x34')]),_0x412678);if(_0x120727[_0x3aaa('0x32')][_0x3aaa('0x3a')]){_0x3ab0dd[_0x3aaa('0x3b')]=_[_0x3aaa('0x3c')](_0x3ab0dd['where'],{'$or':_[_0x3aaa('0x2d')](_0x412678,function(_0x3d39f0){if(_0x3d39f0[_0x3aaa('0x2f')]!==_0x3aaa('0x3d')){var _0x5dd61c={};_0x5dd61c[_0x3d39f0[_0x3aaa('0x2b')]]={'$like':'%'+_0x120727[_0x3aaa('0x32')]['filter']+'%'};return _0x5dd61c;}})});}_0x3ab0dd=_[_0x3aaa('0x3c')]({},_0x3ab0dd,_0x120727[_0x3aaa('0x3e')]);var _0x33abc0={'where':_0x3ab0dd['where']};return db[_0x3aaa('0x3f')][_0x3aaa('0x20')](_0x33abc0)[_0x3aaa('0x26')](function(_0x5b0352){_0x587453[_0x3aaa('0x20')]=_0x5b0352;if(_0x120727[_0x3aaa('0x32')][_0x3aaa('0x40')]){_0x3ab0dd[_0x3aaa('0x41')]=[{'all':!![]}];}return db['Schedule'][_0x3aaa('0x42')](_0x3ab0dd);})['then'](function(_0x10749a){_0x587453['rows']=_0x10749a;return _0x587453;})[_0x3aaa('0x26')](respondWithFilteredResult(_0x161571,_0x3ab0dd))[_0x3aaa('0x43')](handleError(_0x161571,null));};exports['show']=function(_0x309ab0,_0x3786ce){var _0x70912a={'raw':![],'where':{'id':_0x309ab0['params']['id']}},_0x5ccc8b={};_0x5ccc8b['model']=_[_0x3aaa('0x33')](db[_0x3aaa('0x3f')]['rawAttributes']);_0x5ccc8b['query']=_[_0x3aaa('0x33')](_0x309ab0['query']);_0x5ccc8b[_0x3aaa('0x34')]=_[_0x3aaa('0x36')](_0x5ccc8b['model'],_0x5ccc8b[_0x3aaa('0x32')]);_0x70912a[_0x3aaa('0x35')]=_[_0x3aaa('0x36')](_0x5ccc8b[_0x3aaa('0x31')],qs[_0x3aaa('0x37')](_0x309ab0[_0x3aaa('0x32')][_0x3aaa('0x37')]));_0x70912a[_0x3aaa('0x35')]=_0x70912a[_0x3aaa('0x35')][_0x3aaa('0x44')]?_0x70912a[_0x3aaa('0x35')]:_0x5ccc8b['model'];if(_0x309ab0[_0x3aaa('0x32')][_0x3aaa('0x40')]){_0x70912a[_0x3aaa('0x41')]=[{'all':!![]}];}_0x70912a=_[_0x3aaa('0x3c')]({},_0x70912a,_0x309ab0['options']);return db[_0x3aaa('0x3f')]['find'](_0x70912a)['then'](handleEntityNotFound(_0x3786ce,null))[_0x3aaa('0x26')](respondWithResult(_0x3786ce,null))[_0x3aaa('0x43')](handleError(_0x3786ce,null));};exports[_0x3aaa('0x45')]=function(_0x536ba4,_0x3f5642){return db[_0x3aaa('0x3f')][_0x3aaa('0x45')](_0x536ba4[_0x3aaa('0x46')],{})[_0x3aaa('0x26')](function(_0x3f13ec){var _0x267081=_0x536ba4[_0x3aaa('0x47')][_0x3aaa('0x28')]({'plain':!![]});if(!_0x267081)throw new Error(_0x3aaa('0x48'));if(_0x267081[_0x3aaa('0x49')]===_0x3aaa('0x47')){var _0x34429f=_0x3f13ec[_0x3aaa('0x28')]({'plain':!![]});var _0x35dedf=_0x3aaa('0x29');return db['UserProfileSection'][_0x3aaa('0x4a')]({'where':{'name':_0x35dedf,'userProfileId':_0x267081[_0x3aaa('0x4b')]},'raw':!![]})[_0x3aaa('0x26')](function(_0xbe266d){if(_0xbe266d&&_0xbe266d[_0x3aaa('0x4c')]===0x0){return db[_0x3aaa('0x4d')][_0x3aaa('0x45')]({'name':_0x34429f[_0x3aaa('0x2b')],'resourceId':_0x34429f['id'],'type':_0xbe266d[_0x3aaa('0x2b')],'sectionId':_0xbe266d['id']},{})[_0x3aaa('0x26')](function(){return _0x3f13ec;});}else{return _0x3f13ec;}})[_0x3aaa('0x43')](function(_0x475d60){logger[_0x3aaa('0x4e')](_0x3aaa('0x4f'),_0x475d60);throw _0x475d60;});}return _0x3f13ec;})[_0x3aaa('0x26')](respondWithResult(_0x3f5642,0xc9))[_0x3aaa('0x43')](handleError(_0x3f5642,null));};exports[_0x3aaa('0x25')]=function(_0x560112,_0x5263ff){if(_0x560112[_0x3aaa('0x46')]['id']){delete _0x560112['body']['id'];}return db[_0x3aaa('0x3f')][_0x3aaa('0x4a')]({'where':{'id':_0x560112[_0x3aaa('0x50')]['id']}})[_0x3aaa('0x26')](handleEntityNotFound(_0x5263ff,null))['then'](saveUpdates(_0x560112['body'],null))['then'](respondWithResult(_0x5263ff,null))['catch'](handleError(_0x5263ff,null));};exports['destroy']=function(_0x28d826,_0x33a3ce){return db['Schedule'][_0x3aaa('0x4a')]({'where':{'id':_0x28d826[_0x3aaa('0x50')]['id']}})['then'](handleEntityNotFound(_0x33a3ce,null))[_0x3aaa('0x26')](removeEntity(_0x33a3ce,null))['catch'](handleError(_0x33a3ce,null));};exports[_0x3aaa('0x51')]=function(_0x92caf8,_0x1e99aa,_0x562c6c){var _0x92b024=require(_0x3aaa('0x52'));return db[_0x3aaa('0x3f')][_0x3aaa('0x4a')]({'where':{'id':_0x92caf8[_0x3aaa('0x50')]['id']},'raw':!![]})[_0x3aaa('0x26')](handleEntityNotFound(_0x1e99aa,null))[_0x3aaa('0x26')](function(){_0x92b024[_0x3aaa('0x51')](_0x92caf8['params']['id']);})[_0x3aaa('0x26')](respondWithStatusCode(_0x1e99aa,null))[_0x3aaa('0x43')](handleError(_0x1e99aa,null));}; \ No newline at end of file +var _0x3002=['sort','pick','where','merge','type','filter','options','Schedule','includeAll','include','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','status','send','index','map','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3002,0xc6));var _0x2300=function(_0x9ed7e1,_0x5885e0){_0x9ed7e1=_0x9ed7e1-0x0;var _0x20cfb9=_0x3002[_0x9ed7e1];return _0x20cfb9;};'use strict';var emlformat=require(_0x2300('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2300('0x1'));var rp=require('request-promise');var moment=require(_0x2300('0x2'));var BPromise=require(_0x2300('0x3'));var Mustache=require(_0x2300('0x4'));var util=require(_0x2300('0x5'));var path=require(_0x2300('0x6'));var sox=require(_0x2300('0x7'));var csv=require('to-csv');var ejs=require(_0x2300('0x8'));var fs=require('fs');var fs_extra=require(_0x2300('0x9'));var _=require(_0x2300('0xa'));var squel=require(_0x2300('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2300('0xc'));var toCsv=require(_0x2300('0xd'));var querystring=require('querystring');var Papa=require(_0x2300('0xe'));var Redis=require(_0x2300('0xf'));var authService=require(_0x2300('0x10'));var qs=require(_0x2300('0x11'));var as=require(_0x2300('0x12'));var hardwareService=require(_0x2300('0x13'));var logger=require('../../config/logger')(_0x2300('0x14'));var utils=require(_0x2300('0x15'));var config=require(_0x2300('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2300('0x17'))['db'];function respondWithStatusCode(_0x42da00,_0x34c8f6){_0x34c8f6=_0x34c8f6||0xcc;return function(_0x14380b){if(_0x14380b){return _0x42da00[_0x2300('0x18')](_0x34c8f6);}return _0x42da00['status'](_0x34c8f6)[_0x2300('0x19')]();};}function respondWithResult(_0x48eb0b,_0x5ba225){_0x5ba225=_0x5ba225||0xc8;return function(_0x1786a7){if(_0x1786a7){return _0x48eb0b['status'](_0x5ba225)[_0x2300('0x1a')](_0x1786a7);}};}function respondWithFilteredResult(_0x122a3b,_0x2186a5){return function(_0x3a6e87){if(_0x3a6e87){var _0x163f18=typeof _0x2186a5[_0x2300('0x1b')]===_0x2300('0x1c')&&typeof _0x2186a5[_0x2300('0x1d')]===_0x2300('0x1c');var _0x1c3fcc=_0x3a6e87[_0x2300('0x1e')];var _0x4ee15c=_0x163f18?0x0:_0x2186a5[_0x2300('0x1b')];var _0x4ca2c3=_0x163f18?_0x3a6e87[_0x2300('0x1e')]:_0x2186a5['offset']+_0x2186a5[_0x2300('0x1d')];var _0x35ba7d;if(_0x4ca2c3>=_0x1c3fcc){_0x4ca2c3=_0x1c3fcc;_0x35ba7d=0xc8;}else{_0x35ba7d=0xce;}_0x122a3b['status'](_0x35ba7d);return _0x122a3b[_0x2300('0x1f')](_0x2300('0x20'),_0x4ee15c+'-'+_0x4ca2c3+'/'+_0x1c3fcc)[_0x2300('0x1a')](_0x3a6e87);}return null;};}function patchUpdates(_0x56d325){return function(_0x20109a){try{jsonpatch[_0x2300('0x21')](_0x20109a,_0x56d325,!![]);}catch(_0x4f6e3a){return BPromise[_0x2300('0x22')](_0x4f6e3a);}return _0x20109a[_0x2300('0x23')]();};}function saveUpdates(_0x551bdd,_0x4560a1){return function(_0x1277bd){if(_0x1277bd){return _0x1277bd['update'](_0x551bdd)['then'](function(_0x3d1063){return _0x3d1063;});}return null;};}function removeEntity(_0xd1726,_0x2b2fc0){return function(_0xdf716c){if(_0xdf716c){return _0xdf716c[_0x2300('0x24')]()[_0x2300('0x25')](function(){var _0x5591ea=_0xdf716c[_0x2300('0x26')]({'plain':!![]});var _0x2f694a=_0x2300('0x27');return db[_0x2300('0x28')][_0x2300('0x24')]({'where':{'type':_0x2f694a,'resourceId':_0x5591ea['id']}})['then'](function(){return _0xdf716c;});})[_0x2300('0x25')](function(){_0xd1726['status'](0xcc)[_0x2300('0x19')]();});}};}function handleEntityNotFound(_0x19ab38,_0x119dd4){return function(_0x27e074){if(!_0x27e074){_0x19ab38[_0x2300('0x18')](0x194);}return _0x27e074;};}function handleError(_0xa74e82,_0x197218){_0x197218=_0x197218||0x1f4;return function(_0x46c146){logger[_0x2300('0x29')](_0x46c146[_0x2300('0x2a')]);if(_0x46c146[_0x2300('0x2b')]){delete _0x46c146['name'];}_0xa74e82[_0x2300('0x2c')](_0x197218)[_0x2300('0x2d')](_0x46c146);};}exports[_0x2300('0x2e')]=function(_0x589b7c,_0x5ea368){var _0x476ce4={},_0x59e378={},_0x8a45b4={'count':0x0,'rows':[]};var _0x362aca=_[_0x2300('0x2f')](db['Schedule']['rawAttributes'],function(_0x4555f7){return{'name':_0x4555f7[_0x2300('0x30')],'type':_0x4555f7['type'][_0x2300('0x31')]};});_0x59e378['model']=_[_0x2300('0x2f')](_0x362aca,_0x2300('0x2b'));_0x59e378[_0x2300('0x32')]=_[_0x2300('0x33')](_0x589b7c[_0x2300('0x32')]);_0x59e378[_0x2300('0x34')]=_[_0x2300('0x35')](_0x59e378['model'],_0x59e378[_0x2300('0x32')]);_0x476ce4[_0x2300('0x36')]=_[_0x2300('0x35')](_0x59e378[_0x2300('0x37')],qs[_0x2300('0x38')](_0x589b7c[_0x2300('0x32')][_0x2300('0x38')]));_0x476ce4[_0x2300('0x36')]=_0x476ce4['attributes'][_0x2300('0x39')]?_0x476ce4[_0x2300('0x36')]:_0x59e378[_0x2300('0x37')];if(!_0x589b7c[_0x2300('0x32')]['hasOwnProperty'](_0x2300('0x3a'))){_0x476ce4[_0x2300('0x1d')]=qs[_0x2300('0x1d')](_0x589b7c[_0x2300('0x32')][_0x2300('0x1d')]);_0x476ce4[_0x2300('0x1b')]=qs[_0x2300('0x1b')](_0x589b7c[_0x2300('0x32')][_0x2300('0x1b')]);}_0x476ce4[_0x2300('0x3b')]=qs[_0x2300('0x3c')](_0x589b7c['query'][_0x2300('0x3c')]);_0x476ce4['where']=qs[_0x2300('0x34')](_[_0x2300('0x3d')](_0x589b7c['query'],_0x59e378[_0x2300('0x34')]),_0x362aca);if(_0x589b7c[_0x2300('0x32')]['filter']){_0x476ce4[_0x2300('0x3e')]=_[_0x2300('0x3f')](_0x476ce4['where'],{'$or':_[_0x2300('0x2f')](_0x362aca,function(_0x16a1fc){if(_0x16a1fc[_0x2300('0x40')]!=='VIRTUAL'){var _0x97b9d={};_0x97b9d[_0x16a1fc['name']]={'$like':'%'+_0x589b7c[_0x2300('0x32')][_0x2300('0x41')]+'%'};return _0x97b9d;}})});}_0x476ce4=_[_0x2300('0x3f')]({},_0x476ce4,_0x589b7c[_0x2300('0x42')]);var _0x1bf350={'where':_0x476ce4[_0x2300('0x3e')]};return db[_0x2300('0x43')]['count'](_0x1bf350)['then'](function(_0x176d79){_0x8a45b4[_0x2300('0x1e')]=_0x176d79;if(_0x589b7c[_0x2300('0x32')][_0x2300('0x44')]){_0x476ce4[_0x2300('0x45')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x476ce4);})['then'](function(_0x10e91d){_0x8a45b4['rows']=_0x10e91d;return _0x8a45b4;})[_0x2300('0x25')](respondWithFilteredResult(_0x5ea368,_0x476ce4))[_0x2300('0x46')](handleError(_0x5ea368,null));};exports[_0x2300('0x47')]=function(_0xfd5d56,_0xbd7c2f){var _0x27ab63={'raw':![],'where':{'id':_0xfd5d56[_0x2300('0x48')]['id']}},_0x50d892={};_0x50d892[_0x2300('0x37')]=_[_0x2300('0x33')](db[_0x2300('0x43')]['rawAttributes']);_0x50d892[_0x2300('0x32')]=_['keys'](_0xfd5d56['query']);_0x50d892[_0x2300('0x34')]=_[_0x2300('0x35')](_0x50d892['model'],_0x50d892[_0x2300('0x32')]);_0x27ab63[_0x2300('0x36')]=_[_0x2300('0x35')](_0x50d892['model'],qs[_0x2300('0x38')](_0xfd5d56[_0x2300('0x32')][_0x2300('0x38')]));_0x27ab63['attributes']=_0x27ab63[_0x2300('0x36')][_0x2300('0x39')]?_0x27ab63['attributes']:_0x50d892[_0x2300('0x37')];if(_0xfd5d56[_0x2300('0x32')][_0x2300('0x44')]){_0x27ab63[_0x2300('0x45')]=[{'all':!![]}];}_0x27ab63=_[_0x2300('0x3f')]({},_0x27ab63,_0xfd5d56[_0x2300('0x42')]);return db['Schedule']['find'](_0x27ab63)[_0x2300('0x25')](handleEntityNotFound(_0xbd7c2f,null))['then'](respondWithResult(_0xbd7c2f,null))[_0x2300('0x46')](handleError(_0xbd7c2f,null));};exports[_0x2300('0x49')]=function(_0x457477,_0x383c87){return db[_0x2300('0x43')][_0x2300('0x49')](_0x457477[_0x2300('0x4a')],{})[_0x2300('0x25')](function(_0x360907){var _0x26c712=_0x457477[_0x2300('0x4b')][_0x2300('0x26')]({'plain':!![]});if(!_0x26c712)throw new Error(_0x2300('0x4c'));if(_0x26c712[_0x2300('0x4d')]===_0x2300('0x4b')){var _0x14cee5=_0x360907[_0x2300('0x26')]({'plain':!![]});var _0x4c9387=_0x2300('0x27');return db[_0x2300('0x4e')][_0x2300('0x4f')]({'where':{'name':_0x4c9387,'userProfileId':_0x26c712[_0x2300('0x50')]},'raw':!![]})['then'](function(_0x55b3c1){if(_0x55b3c1&&_0x55b3c1[_0x2300('0x51')]===0x0){return db[_0x2300('0x28')]['create']({'name':_0x14cee5[_0x2300('0x2b')],'resourceId':_0x14cee5['id'],'type':_0x55b3c1['name'],'sectionId':_0x55b3c1['id']},{})[_0x2300('0x25')](function(){return _0x360907;});}else{return _0x360907;}})[_0x2300('0x46')](function(_0x3cccbd){logger[_0x2300('0x29')](_0x2300('0x52'),_0x3cccbd);throw _0x3cccbd;});}return _0x360907;})[_0x2300('0x25')](respondWithResult(_0x383c87,0xc9))[_0x2300('0x46')](handleError(_0x383c87,null));};exports[_0x2300('0x53')]=function(_0x258cdf,_0x1eb7e5){if(_0x258cdf[_0x2300('0x4a')]['id']){delete _0x258cdf[_0x2300('0x4a')]['id'];}return db['Schedule'][_0x2300('0x4f')]({'where':{'id':_0x258cdf[_0x2300('0x48')]['id']}})[_0x2300('0x25')](handleEntityNotFound(_0x1eb7e5,null))[_0x2300('0x25')](saveUpdates(_0x258cdf[_0x2300('0x4a')],null))[_0x2300('0x25')](respondWithResult(_0x1eb7e5,null))[_0x2300('0x46')](handleError(_0x1eb7e5,null));};exports[_0x2300('0x24')]=function(_0x270770,_0x12f86e){return db[_0x2300('0x43')][_0x2300('0x4f')]({'where':{'id':_0x270770[_0x2300('0x48')]['id']}})[_0x2300('0x25')](handleEntityNotFound(_0x12f86e,null))[_0x2300('0x25')](removeEntity(_0x12f86e,null))[_0x2300('0x46')](handleError(_0x12f86e,null));};exports[_0x2300('0x54')]=function(_0x97db71,_0x3f86dc,_0x15fe69){var _0x3cf0d6=require(_0x2300('0x55'));return db['Schedule'][_0x2300('0x4f')]({'where':{'id':_0x97db71[_0x2300('0x48')]['id']},'raw':!![]})[_0x2300('0x25')](handleEntityNotFound(_0x3f86dc,null))[_0x2300('0x25')](function(){_0x3cf0d6['run'](_0x97db71['params']['id']);})[_0x2300('0x25')](respondWithStatusCode(_0x3f86dc,null))['catch'](handleError(_0x3f86dc,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8c7d319..fa2701f 100644 --- a/server/api/schedule/schedule.model.js +++ b/server/api/schedule/schedule.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf4b=['moment','bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash','../../config/logger','api'];(function(_0x5251dd,_0xc0f589){var _0x4d8295=function(_0x3d51df){while(--_0x3d51df){_0x5251dd['push'](_0x5251dd['shift']());}};_0x4d8295(++_0xc0f589);}(_0xbf4b,0x17e));var _0xbbf4=function(_0x348fec,_0x486f87){_0x348fec=_0x348fec-0x0;var _0x5914c7=_0xbf4b[_0x348fec];return _0x5914c7;};'use strict';var _=require(_0xbbf4('0x0'));var util=require('util');var logger=require(_0xbbf4('0x1'))(_0xbbf4('0x2'));var moment=require(_0xbbf4('0x3'));var BPromise=require(_0xbbf4('0x4'));var rp=require(_0xbbf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbf4('0x6'));var config=require(_0xbbf4('0x7'));var attributes=require(_0xbbf4('0x8'));module[_0xbbf4('0x9')]=function(_0x572df9,_0x1c6913){return _0x572df9['define']('Schedule',attributes,{'tableName':_0xbbf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3db4=['path','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x24c564,_0x49afff){var _0x3a5538=function(_0x3cbaa1){while(--_0x3cbaa1){_0x24c564['push'](_0x24c564['shift']());}};_0x3a5538(++_0x49afff);}(_0x3db4,0x1b3));var _0x43db=function(_0x3619e1,_0x51670f){_0x3619e1=_0x3619e1-0x0;var _0x301c5a=_0x3db4[_0x3619e1];return _0x301c5a;};'use strict';var _=require(_0x43db('0x0'));var util=require(_0x43db('0x1'));var logger=require(_0x43db('0x2'))('api');var moment=require('moment');var BPromise=require(_0x43db('0x3'));var rp=require(_0x43db('0x4'));var fs=require('fs');var path=require(_0x43db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43db('0x6'));module[_0x43db('0x7')]=function(_0x3ad6ee,_0x550f7a){return _0x3ad6ee[_0x43db('0x8')](_0x43db('0x9'),attributes,{'tableName':_0x43db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index b0939b2..7dbe0bf 100644 --- a/server/api/schedule/schedule.rpc.js +++ b/server/api/schedule/schedule.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe08b=['message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e0d64,_0x130b92){var _0x3dab88=function(_0x161dd1){while(--_0x161dd1){_0x1e0d64['push'](_0x1e0d64['shift']());}};_0x3dab88(++_0x130b92);}(_0xe08b,0xab));var _0xbe08=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xe08b[_0x12a2a6];return _0x1754ae;};'use strict';var _=require('lodash');var util=require(_0xbe08('0x0'));var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require(_0xbe08('0x3'));var fs=require('fs');var Redis=require(_0xbe08('0x4'));var db=require(_0xbe08('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe08('0x6'))(_0xbe08('0x7'));var config=require(_0xbe08('0x8'));var jayson=require(_0xbe08('0x9'));var client=jayson[_0xbe08('0xa')][_0xbe08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c55dc,_0x466910,_0x2ce9a5){return new BPromise(function(_0xe141b3,_0x42e1b1){return client[_0xbe08('0xc')](_0x2c55dc,_0x2ce9a5)[_0xbe08('0xd')](function(_0x3822eb){logger['info'](_0xbe08('0xe'),_0x466910,_0xbe08('0xf'));logger[_0xbe08('0x10')](_0xbe08('0x11'),_0x466910,_0xbe08('0xf'),JSON[_0xbe08('0x12')](_0x3822eb));if(_0x3822eb['error']){if(_0x3822eb[_0xbe08('0x13')][_0xbe08('0x14')]===0x1f4){logger[_0xbe08('0x13')](_0xbe08('0xe'),_0x466910,_0x3822eb[_0xbe08('0x13')][_0xbe08('0x15')]);return _0x42e1b1(_0x3822eb[_0xbe08('0x13')][_0xbe08('0x15')]);}logger[_0xbe08('0x13')]('Schedule,\x20%s,\x20%s',_0x466910,_0x3822eb[_0xbe08('0x13')]['message']);return _0xe141b3(_0x3822eb['error']['message']);}else{logger[_0xbe08('0x16')]('Schedule,\x20%s,\x20%s',_0x466910,'request\x20sent');_0xe141b3(_0x3822eb['result'][_0xbe08('0x15')]);}})[_0xbe08('0x17')](function(_0x394555){logger[_0xbe08('0x13')](_0xbe08('0xe'),_0x466910,_0x394555);_0x42e1b1(_0x394555);});});} \ No newline at end of file +var _0xc202=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','result','catch','moment','bluebird'];(function(_0x1c144f,_0x3c5ff3){var _0x42c8be=function(_0x3045c8){while(--_0x3045c8){_0x1c144f['push'](_0x1c144f['shift']());}};_0x42c8be(++_0x3c5ff3);}(_0xc202,0x132));var _0x2c20=function(_0x57a9e5,_0x5009df){_0x57a9e5=_0x57a9e5-0x0;var _0x36d39e=_0xc202[_0x57a9e5];return _0x36d39e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c20('0x0'));var BPromise=require(_0x2c20('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c20('0x2'));var db=require(_0x2c20('0x3'))['db'];var utils=require(_0x2c20('0x4'));var logger=require(_0x2c20('0x5'))(_0x2c20('0x6'));var config=require('../../config/environment');var jayson=require(_0x2c20('0x7'));var client=jayson[_0x2c20('0x8')][_0x2c20('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cd58d,_0x1384ee,_0x65072b){return new BPromise(function(_0x5273bf,_0x3ff328){return client[_0x2c20('0xa')](_0x5cd58d,_0x65072b)[_0x2c20('0xb')](function(_0x596027){logger[_0x2c20('0xc')]('Schedule,\x20%s,\x20%s',_0x1384ee,_0x2c20('0xd'));logger[_0x2c20('0xe')](_0x2c20('0xf'),_0x1384ee,_0x2c20('0xd'),JSON['stringify'](_0x596027));if(_0x596027[_0x2c20('0x10')]){if(_0x596027[_0x2c20('0x10')][_0x2c20('0x11')]===0x1f4){logger[_0x2c20('0x10')](_0x2c20('0x12'),_0x1384ee,_0x596027[_0x2c20('0x10')][_0x2c20('0x13')]);return _0x3ff328(_0x596027[_0x2c20('0x10')][_0x2c20('0x13')]);}logger[_0x2c20('0x10')]('Schedule,\x20%s,\x20%s',_0x1384ee,_0x596027[_0x2c20('0x10')]['message']);return _0x5273bf(_0x596027['error'][_0x2c20('0x13')]);}else{logger[_0x2c20('0xc')](_0x2c20('0x12'),_0x1384ee,_0x2c20('0xd'));_0x5273bf(_0x596027[_0x2c20('0x14')]['message']);}})[_0x2c20('0x15')](function(_0x5e0ffb){logger['error'](_0x2c20('0x12'),_0x1384ee,_0x5e0ffb);_0x3ff328(_0x5e0ffb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0d3b3e7..f861a06 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb879=['../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xaf2173,_0x54fa84){var _0x3c1d14=function(_0x5dbefe){while(--_0x5dbefe){_0xaf2173['push'](_0xaf2173['shift']());}};_0x3c1d14(++_0x54fa84);}(_0xb879,0x158));var _0x9b87=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb879[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x9b87('0x0'));var util=require(_0x9b87('0x1'));var path=require(_0x9b87('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b87('0x3'));var router=express[_0x9b87('0x4')]();var fs_extra=require(_0x9b87('0x5'));var auth=require(_0x9b87('0x6'));var interaction=require(_0x9b87('0x7'));var config=require(_0x9b87('0x8'));var controller=require('./screenRecording.controller');router[_0x9b87('0x9')]('/',auth[_0x9b87('0xa')](),controller['index']);router[_0x9b87('0x9')]('/describe',auth[_0x9b87('0xa')](),controller[_0x9b87('0xb')]);router[_0x9b87('0x9')](_0x9b87('0xc'),auth['isAuthenticated'](),controller[_0x9b87('0xd')]);router[_0x9b87('0x9')](_0x9b87('0xe'),auth[_0x9b87('0xa')](),controller[_0x9b87('0xf')]);router['post']('/',auth[_0x9b87('0xa')](),controller[_0x9b87('0x10')]);router[_0x9b87('0x11')](_0x9b87('0xc'),auth[_0x9b87('0xa')](),controller[_0x9b87('0x12')]);router[_0x9b87('0x13')](_0x9b87('0xc'),auth[_0x9b87('0xa')](),controller[_0x9b87('0x14')]);module[_0x9b87('0x15')]=router; \ No newline at end of file +var _0x1648=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create','update','destroy','exports','multer'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1648,0xa7));var _0x8164=function(_0x4c8681,_0x16a6ab){_0x4c8681=_0x4c8681-0x0;var _0x5553f7=_0x1648[_0x4c8681];return _0x5553f7;};'use strict';var multer=require(_0x8164('0x0'));var util=require(_0x8164('0x1'));var path=require(_0x8164('0x2'));var timeout=require(_0x8164('0x3'));var express=require(_0x8164('0x4'));var router=express[_0x8164('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8164('0x6'));var interaction=require(_0x8164('0x7'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x8164('0x8')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0xa')]);router[_0x8164('0x8')]('/describe',auth[_0x8164('0x9')](),controller[_0x8164('0xb')]);router[_0x8164('0x8')](_0x8164('0xc'),auth[_0x8164('0x9')](),controller[_0x8164('0xd')]);router['get'](_0x8164('0xe'),auth[_0x8164('0x9')](),controller[_0x8164('0xf')]);router[_0x8164('0x10')]('/',auth[_0x8164('0x9')](),controller[_0x8164('0x11')]);router['put'](_0x8164('0xc'),auth[_0x8164('0x9')](),controller[_0x8164('0x12')]);router['delete']('/:id',auth[_0x8164('0x9')](),controller[_0x8164('0x13')]);module[_0x8164('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3f8b1a4..32dc60b 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8861=['subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue'];(function(_0x2448d0,_0x31838c){var _0x555642=function(_0x154717){while(--_0x154717){_0x2448d0['push'](_0x2448d0['shift']());}};_0x555642(++_0x31838c);}(_0x8861,0x6d));var _0x1886=function(_0xaaf822,_0x2c26a7){_0xaaf822=_0xaaf822-0x0;var _0x508570=_0x8861[_0xaaf822];return _0x508570;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x1886('0x0'));var config=require(_0x1886('0x1'));module[_0x1886('0x2')]={'format':{'type':Sequelize[_0x1886('0x3')],'get':function(){return this[_0x1886('0x4')](_0x1886('0x5'))?path[_0x1886('0x6')](this[_0x1886('0x4')](_0x1886('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x1886('0x7')]},'channel':{'type':Sequelize[_0x1886('0x7')]},'value':{'type':Sequelize[_0x1886('0x7')],'set':function(_0x39e8fd){var _0x43e483=_0x39e8fd[_0x1886('0x8')](/\\/g,'/');this['setDataValue'](_0x1886('0x5'),_0x43e483);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x1886('0x9')],'set':function(_0x489fed){this[_0x1886('0xa')]('startedAt',moment()[_0x1886('0xb')](_0x489fed,'ms'));this[_0x1886('0xa')](_0x1886('0xc'),moment());this[_0x1886('0xa')](_0x1886('0xd'),_0x489fed);}},'startedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this['getDataValue'](_0x1886('0xf')))[_0x1886('0x10')](_0x1886('0x11'))[_0x1886('0x12')]();}},'closedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this[_0x1886('0x4')]('closedAt'))['format'](_0x1886('0x11'))[_0x1886('0x12')]();}},'createdAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this['getDataValue'](_0x1886('0x13')))[_0x1886('0x10')](_0x1886('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x1886('0xe')],'get':function(){return moment(this[_0x1886('0x4')]('updatedAt'))[_0x1886('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x1886('0x12')]();}}}; \ No newline at end of file +var _0x4329=['STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x298b27,_0x47ab26){var _0x2074bb=function(_0x33dcbd){while(--_0x33dcbd){_0x298b27['push'](_0x298b27['shift']());}};_0x2074bb(++_0x47ab26);}(_0x4329,0x13b));var _0x9432=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4329[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x9432('0x0'));var moment=require(_0x9432('0x1'));var path=require(_0x9432('0x2'));var config=require(_0x9432('0x3'));module[_0x9432('0x4')]={'format':{'type':Sequelize[_0x9432('0x5')],'get':function(){return this[_0x9432('0x6')](_0x9432('0x7'))?path[_0x9432('0x8')](this[_0x9432('0x6')](_0x9432('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x9432('0x9')]},'channel':{'type':Sequelize[_0x9432('0x9')]},'value':{'type':Sequelize[_0x9432('0x9')],'set':function(_0x5568ad){var _0x376967=_0x5568ad['replace'](/\\/g,'/');this[_0x9432('0xa')](_0x9432('0x7'),_0x376967);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x9432('0xb')],'set':function(_0x2b06c7){this[_0x9432('0xa')](_0x9432('0xc'),moment()[_0x9432('0xd')](_0x2b06c7,'ms'));this['setDataValue'](_0x9432('0xe'),moment());this[_0x9432('0xa')]('duration',_0x2b06c7);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9432('0x6')](_0x9432('0xc')))[_0x9432('0xf')](_0x9432('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x9432('0x11')],'get':function(){return moment(this[_0x9432('0x6')](_0x9432('0xe')))[_0x9432('0xf')](_0x9432('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x9432('0x11')],'get':function(){return moment(this[_0x9432('0x6')]('createdAt'))[_0x9432('0xf')](_0x9432('0x10'))['toString']();}},'updatedAt':{'type':Sequelize[_0x9432('0x11')],'get':function(){return moment(this[_0x9432('0x6')]('updatedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7aa931f..914053b 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xa630,0xbe));var _0x0a63=function(_0x373b36,_0x3bc444){_0x373b36=_0x373b36-0x0;var _0x3f8649=_0xa630[_0x373b36];return _0x3f8649;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file +var _0x7fbe=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','stack','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','find','catch','create','body','duration','createdAt','closedAt','params','describe','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2edc39,_0x41b27f){var _0x337772=function(_0x26431a){while(--_0x26431a){_0x2edc39['push'](_0x2edc39['shift']());}};_0x337772(++_0x41b27f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x19dd32,_0x5b5417){_0x19dd32=_0x19dd32-0x0;var _0x501852=_0x7fbe[_0x19dd32];return _0x501852;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['differenceBy'](_[_0xe7fb('0x2c')](_0x219554,'name'),[_0xe7fb('0x32')]);_0xd3fffe[_0xe7fb('0x33')]=_[_0xe7fb('0x34')](_0x4fd290[_0xe7fb('0x33')]);_0xd3fffe['filters']=_[_0xe7fb('0x35')](_0xd3fffe[_0xe7fb('0x36')],_0xd3fffe[_0xe7fb('0x33')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xd3fffe['model'],qs[_0xe7fb('0x38')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x39')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x36')];if(!_0x4fd290[_0xe7fb('0x33')]['hasOwnProperty'](_0xe7fb('0x3a'))){_0x251807[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x4fd290['query'][_0xe7fb('0x20')]);_0x251807[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3b')]=qs[_0xe7fb('0x3c')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x3c')]);_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_[_0xe7fb('0x3f')](_0x4fd290[_0xe7fb('0x33')],_0xd3fffe[_0xe7fb('0x3e')]),_0x219554);if(_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]){_0x251807[_0xe7fb('0x3d')]=_[_0xe7fb('0x41')](_0x251807[_0xe7fb('0x3d')],{'$or':_['map'](_0x219554,function(_0x261ec5){if(_0x261ec5[_0xe7fb('0x30')]!==_0xe7fb('0x42')){var _0x444f98={};_0x444f98[_0x261ec5['name']]={'$like':'%'+_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]+'%'};return _0x444f98;}})});}_0x251807=_[_0xe7fb('0x41')]({},_0x251807,_0x4fd290[_0xe7fb('0x43')]);var _0x49fe9d={'where':_0x251807[_0xe7fb('0x3d')]};return db[_0xe7fb('0x2d')][_0xe7fb('0x21')](_0x49fe9d)[_0xe7fb('0x26')](function(_0x468d16){_0x5f265f[_0xe7fb('0x21')]=_0x468d16;if(_0x4fd290['query'][_0xe7fb('0x44')]){_0x251807[_0xe7fb('0x45')]=[{'all':!![]}];}return db[_0xe7fb('0x2d')]['findAll'](_0x251807);})[_0xe7fb('0x26')](function(_0x3a8c52){_0x5f265f['rows']=_0x3a8c52;return _0x5f265f;})['then'](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5e0153,_0x900d67){var _0x957ca3={'raw':![],'where':{'id':_0x5e0153['params']['id']}},_0xed62e9={};_0xed62e9[_0xe7fb('0x36')]=_['keys'](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')]);_0xed62e9['query']=_[_0xe7fb('0x34')](_0x5e0153[_0xe7fb('0x33')]);_0xed62e9[_0xe7fb('0x3e')]=_[_0xe7fb('0x35')](_0xed62e9['model'],_0xed62e9[_0xe7fb('0x33')]);_0x957ca3[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xed62e9['model'],qs[_0xe7fb('0x38')](_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x957ca3[_0xe7fb('0x37')]=_0x957ca3[_0xe7fb('0x37')]['length']?_0x957ca3[_0xe7fb('0x37')]:_0xed62e9['model'];if(_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x44')]){_0x957ca3[_0xe7fb('0x45')]=[{'all':!![]}];}_0x957ca3=_[_0xe7fb('0x41')]({},_0x957ca3,_0x5e0153[_0xe7fb('0x43')]);return db['ScreenRecording'][_0xe7fb('0x46')](_0x957ca3)['then'](handleEntityNotFound(_0x900d67,null))['then'](respondWithResult(_0x900d67,null))[_0xe7fb('0x47')](handleError(_0x900d67,null));};exports[_0xe7fb('0x48')]=function(_0x16327f,_0x589555){return db[_0xe7fb('0x2d')][_0xe7fb('0x48')](_0x16327f['body'],{})['then'](respondWithResult(_0x589555,0xc9))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x1cbf34,_0x3dd6bf){if(_0x1cbf34[_0xe7fb('0x49')]['id']){delete _0x1cbf34[_0xe7fb('0x49')]['id'];}delete _0x1cbf34[_0xe7fb('0x49')][_0xe7fb('0x4a')];delete _0x1cbf34['body'][_0xe7fb('0x4b')];delete _0x1cbf34['body'][_0xe7fb('0x4c')];delete _0x1cbf34[_0xe7fb('0x49')]['value'];return db[_0xe7fb('0x2d')]['find']({'where':{'id':_0x1cbf34[_0xe7fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3dd6bf,null))[_0xe7fb('0x26')](saveUpdates(_0x1cbf34['body'],null))[_0xe7fb('0x26')](respondWithResult(_0x3dd6bf,null))['catch'](handleError(_0x3dd6bf,null));};exports[_0xe7fb('0x4e')]=function(_0x1b6442,_0x41fcfb){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x41fcfb,null))[_0xe7fb('0x47')](handleError(_0x41fcfb,null));};exports['download']=function(_0x5d20dc,_0x20aa55,_0x4948a7){var _0x4f4240=require('../../components/encryptor');var _0x50b8df=![];var _0x539252={};if(_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]&&_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]==='uniqueid'){_0x539252[_0xe7fb('0x4f')]=_0x5d20dc[_0xe7fb('0x4d')]['id'];}else{_0x539252['id']=_0x5d20dc[_0xe7fb('0x4d')]['id'];}return db['ScreenRecording']['find']({'where':_0x539252,'attributes':['id',_0xe7fb('0x50')],'raw':!![]})[_0xe7fb('0x26')](handleEntityNotFound(_0x20aa55,null))[_0xe7fb('0x26')](function(_0x4f4ba3){if(_0x4f4ba3){var _0x27f860=path[_0xe7fb('0x51')](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x4f4ba3['value']);var _0x4b35f9=util[_0xe7fb('0x32')](_0xe7fb('0x54'),_0x27f860);if(fs[_0xe7fb('0x55')](_0x4b35f9)){_0x50b8df=!![];return _0x4f4240[_0xe7fb('0x56')](_0x4b35f9,_0x27f860,config[_0xe7fb('0x57')]['recording'])[_0xe7fb('0x26')](function(){return _0x4f4ba3;});}return _0x4f4ba3;}})[_0xe7fb('0x26')](function(_0x23755b){if(_0x23755b){var _0x590d7a=path['join'](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x23755b[_0xe7fb('0x50')]);if(!fs[_0xe7fb('0x55')](_0x590d7a)){throw new db[(_0xe7fb('0x58'))][(_0xe7fb('0x59'))]('ScreenRecording\x20not\x20found');}if(_0x23755b[_0xe7fb('0x5a')]){return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,_0x23755b[_0xe7fb('0x5a')]+path[_0xe7fb('0x5c')](_0x590d7a),function(){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}else{return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,function(_0x554092){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}}})['catch'](function(_0x1eda1d){if(_0x1eda1d[_0xe7fb('0x5e')]===_0xe7fb('0x5f')){_0x20aa55[_0xe7fb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x20aa55,null);}});};exports[_0xe7fb('0x60')]=function(_0x11e15a,_0x25aeb2){return db[_0xe7fb('0x2d')][_0xe7fb('0x46')]({'where':{'id':_0x11e15a['params']['id']}})[_0xe7fb('0x26')](function(_0x58d4ec){if(_[_0xe7fb('0x61')](_0x58d4ec)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d4ec;})['then'](function(_0xc13fac){var _0x203da3=path[_0xe7fb('0x51')](config['root'],_0xe7fb('0x53'),_0xc13fac[_0xe7fb('0x50')]);logger[_0xe7fb('0x62')](_0xe7fb('0x63'),_0x203da3);if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')]('File:\x20\x22'+_0x203da3+_0xe7fb('0x64'));fs[_0xe7fb('0x65')](_0x203da3);}_0x203da3=_0x203da3+'.cypher';if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')](_0xe7fb('0x66')+_0x203da3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7fb('0x65')](_0x203da3);}return _0xc13fac;})[_0xe7fb('0x26')](function(_0x2c558a){if(!_0x2c558a)throw new InternalError();return _0x2c558a[_0xe7fb('0x60')]();})[_0xe7fb('0x26')](function(){_0x25aeb2[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();})[_0xe7fb('0x47')](handleError(_0x25aeb2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index bbfa173..64d29de 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8899=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x4a99a6,_0x5a7dad){var _0x5b1a07=function(_0x7ab9e7){while(--_0x7ab9e7){_0x4a99a6['push'](_0x4a99a6['shift']());}};_0x5b1a07(++_0x5a7dad);}(_0x8899,0x1a8));var _0x9889=function(_0x5dd347,_0x49ef2c){_0x5dd347=_0x5dd347-0x0;var _0xf097e5=_0x8899[_0x5dd347];return _0xf097e5;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require(_0x9889('0x2'))(_0x9889('0x3'));var moment=require(_0x9889('0x4'));var BPromise=require(_0x9889('0x5'));var rp=require(_0x9889('0x6'));var fs=require('fs');var path=require(_0x9889('0x7'));var rimraf=require(_0x9889('0x8'));var config=require('../../config/environment');var attributes=require(_0x9889('0x9'));module[_0x9889('0xa')]=function(_0x1613f3,_0x8babf9){return _0x1613f3['define']('ScreenRecording',attributes,{'tableName':_0x9889('0xb'),'paranoid':![],'indexes':[{'name':_0x9889('0xc'),'fields':[_0x9889('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8c6=['interactionid','lodash','util','../../config/logger','api','request-promise','path','./screenRecording.attributes','define','ScreenRecording','screen_recordings'];(function(_0x2f2113,_0x2d1e75){var _0x590f05=function(_0x534332){while(--_0x534332){_0x2f2113['push'](_0x2f2113['shift']());}};_0x590f05(++_0x2d1e75);}(_0xb8c6,0x6f));var _0x6b8c=function(_0x43c837,_0x468b0e){_0x43c837=_0x43c837-0x0;var _0x59e8b9=_0xb8c6[_0x43c837];return _0x59e8b9;};'use strict';var _=require(_0x6b8c('0x0'));var util=require(_0x6b8c('0x1'));var logger=require(_0x6b8c('0x2'))(_0x6b8c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b8c('0x4'));var fs=require('fs');var path=require(_0x6b8c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b8c('0x6'));module['exports']=function(_0x6fc5b,_0x3786fa){return _0x6fc5b[_0x6b8c('0x7')](_0x6b8c('0x8'),attributes,{'tableName':_0x6b8c('0x9'),'paranoid':![],'indexes':[{'name':_0x6b8c('0xa'),'fields':[_0x6b8c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d892731..b3e0ced 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3528=['jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x321553,_0x5c0cb5){var _0x2c770b=function(_0x12e998){while(--_0x12e998){_0x321553['push'](_0x321553['shift']());}};_0x2c770b(++_0x5c0cb5);}(_0x3528,0x143));var _0x8352=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3528[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x8352('0x0'));var moment=require(_0x8352('0x1'));var BPromise=require(_0x8352('0x2'));var rs=require(_0x8352('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8352('0x4'))['db'];var utils=require(_0x8352('0x5'));var logger=require('../../config/logger')(_0x8352('0x6'));var config=require('../../config/environment');var jayson=require(_0x8352('0x7'));var client=jayson[_0x8352('0x8')][_0x8352('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x484e51,_0x201b15,_0x28b87b){return new BPromise(function(_0x1817a1,_0x31b6ff){return client[_0x8352('0xa')](_0x484e51,_0x28b87b)[_0x8352('0xb')](function(_0x37bb03){logger[_0x8352('0xc')](_0x8352('0xd'),_0x201b15,_0x8352('0xe'));logger[_0x8352('0xf')](_0x8352('0x10'),_0x201b15,_0x8352('0xe'),JSON[_0x8352('0x11')](_0x37bb03));if(_0x37bb03[_0x8352('0x12')]){if(_0x37bb03[_0x8352('0x12')][_0x8352('0x13')]===0x1f4){logger['error'](_0x8352('0xd'),_0x201b15,_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);return _0x31b6ff(_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);}logger[_0x8352('0x12')](_0x8352('0xd'),_0x201b15,_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);return _0x1817a1(_0x37bb03[_0x8352('0x12')][_0x8352('0x14')]);}else{logger[_0x8352('0xc')](_0x8352('0xd'),_0x201b15,_0x8352('0xe'));_0x1817a1(_0x37bb03['result'][_0x8352('0x14')]);}})[_0x8352('0x15')](function(_0x3a253f){logger[_0x8352('0x12')](_0x8352('0xd'),_0x201b15,_0x3a253f);_0x31b6ff(_0x3a253f);});});} \ No newline at end of file +var _0x5d8b=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x14a516,_0x5dee29){var _0x51a308=function(_0x326394){while(--_0x326394){_0x14a516['push'](_0x14a516['shift']());}};_0x51a308(++_0x5dee29);}(_0x5d8b,0x18d));var _0xb5d8=function(_0x3a671c,_0x38f7f6){_0x3a671c=_0x3a671c-0x0;var _0x1efc1e=_0x5d8b[_0x3a671c];return _0x1efc1e;};'use strict';var _=require('lodash');var util=require(_0xb5d8('0x0'));var moment=require(_0xb5d8('0x1'));var BPromise=require(_0xb5d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5d8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5d8('0x4'));var logger=require(_0xb5d8('0x5'))(_0xb5d8('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5d8('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x301248,_0x52c70f,_0x5f5866){return new BPromise(function(_0x41bec6,_0x42d23e){return client[_0xb5d8('0x8')](_0x301248,_0x5f5866)[_0xb5d8('0x9')](function(_0x2d4a62){logger[_0xb5d8('0xa')](_0xb5d8('0xb'),_0x52c70f,'request\x20sent');logger[_0xb5d8('0xc')](_0xb5d8('0xd'),_0x52c70f,_0xb5d8('0xe'),JSON[_0xb5d8('0xf')](_0x2d4a62));if(_0x2d4a62[_0xb5d8('0x10')]){if(_0x2d4a62['error'][_0xb5d8('0x11')]===0x1f4){logger['error'](_0xb5d8('0xb'),_0x52c70f,_0x2d4a62[_0xb5d8('0x10')][_0xb5d8('0x12')]);return _0x42d23e(_0x2d4a62[_0xb5d8('0x10')][_0xb5d8('0x12')]);}logger[_0xb5d8('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x52c70f,_0x2d4a62[_0xb5d8('0x10')]['message']);return _0x41bec6(_0x2d4a62['error'][_0xb5d8('0x12')]);}else{logger[_0xb5d8('0xa')]('ScreenRecording,\x20%s,\x20%s',_0x52c70f,_0xb5d8('0xe'));_0x41bec6(_0x2d4a62['result'][_0xb5d8('0x12')]);}})[_0xb5d8('0x13')](function(_0x4cdadd){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x52c70f,_0x4cdadd);_0x42d23e(_0x4cdadd);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a2e4125..444557e 100644 --- a/server/api/setting/index.js +++ b/server/api/setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5316=['index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','post','single','file','addLogo','logologin','originalname','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated'];(function(_0x5e64bb,_0x1abf81){var _0x32cd6c=function(_0x22e596){while(--_0x22e596){_0x5e64bb['push'](_0x5e64bb['shift']());}};_0x32cd6c(++_0x1abf81);}(_0x5316,0xe6));var _0x6531=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0x5316[_0xb65ffb];return _0x58f55c;};'use strict';var multer=require(_0x6531('0x0'));var util=require('util');var path=require(_0x6531('0x1'));var timeout=require(_0x6531('0x2'));var express=require(_0x6531('0x3'));var router=express['Router']();var fs_extra=require(_0x6531('0x4'));var auth=require(_0x6531('0x5'));var interaction=require(_0x6531('0x6'));var config=require('../../config/environment');var controller=require(_0x6531('0x7'));router[_0x6531('0x8')]('/',auth[_0x6531('0x9')](),controller[_0x6531('0xa')]);router[_0x6531('0x8')](_0x6531('0xb'),controller['getDate']);router['get'](_0x6531('0xc'),controller[_0x6531('0xd')]);router[_0x6531('0x8')](_0x6531('0xe'),controller['getLogo']);router[_0x6531('0x8')](_0x6531('0xf'),controller[_0x6531('0x10')]);router['get'](_0x6531('0x11'),controller['gdpr']);router[_0x6531('0x8')](_0x6531('0x12'),controller['getPreferred']);router[_0x6531('0x8')]('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x6531('0x13')]({'destination':function(_0x116176,_0x304926,_0x678263){_0x678263(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x2a8f6f,_0x54718a,_0x5d3dc3){_0x5d3dc3(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x19'),path[_0x6531('0x1a')](_0x54718a['originalname'])));}})});router[_0x6531('0x1b')]('/:id/logo',upload[_0x6531('0x1c')](_0x6531('0x1d')),controller[_0x6531('0x1e')]);var upload=multer({'storage':multer[_0x6531('0x13')]({'destination':function(_0x153c6f,_0x37d5d8,_0x3cc3ae){_0x3cc3ae(null,path[_0x6531('0x14')](config['root'],_0x6531('0x16')));},'filename':function(_0x52ae54,_0x3f6cb9,_0x35cd0d){_0x35cd0d(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x1f'),path[_0x6531('0x1a')](_0x3f6cb9[_0x6531('0x20')])));}})});router['post'](_0x6531('0xf'),upload[_0x6531('0x1c')](_0x6531('0x1d')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ac636,_0x2a3121,_0x22c16b){_0x22c16b(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x3e305a,_0x3caa35,_0x2d641f){_0x2d641f(null,util[_0x6531('0x17')](_0x6531('0x18'),'preferred',path['extname'](_0x3caa35['originalname'])));}})});router[_0x6531('0x1b')](_0x6531('0x12'),upload[_0x6531('0x1c')](_0x6531('0x1d')),controller[_0x6531('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34a1ef,_0x5b205c,_0xda3eaa){_0xda3eaa(null,path[_0x6531('0x14')](config[_0x6531('0x15')],_0x6531('0x16')));},'filename':function(_0x2252d2,_0x2dc71f,_0x50c96b){_0x50c96b(null,util[_0x6531('0x17')](_0x6531('0x18'),_0x6531('0x22'),path[_0x6531('0x1a')](_0x2dc71f['originalname'])));}})});router[_0x6531('0x1b')](_0x6531('0x23'),upload['single']('file'),controller[_0x6531('0x24')]);router[_0x6531('0x25')](_0x6531('0xc'),auth[_0x6531('0x9')](),controller[_0x6531('0x26')]);module[_0x6531('0x27')]=router; \ No newline at end of file +var _0x757d=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','single','file','diskStorage','format','logologin','addLogoLogin','preferred','addPreferred','favicon','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/now','/:id'];(function(_0x36af2c,_0x4b61a7){var _0x5b485a=function(_0x12d0ba){while(--_0x12d0ba){_0x36af2c['push'](_0x36af2c['shift']());}};_0x5b485a(++_0x4b61a7);}(_0x757d,0x1c2));var _0xd757=function(_0x416a38,_0x5004e0){_0x416a38=_0x416a38-0x0;var _0xec6c28=_0x757d[_0x416a38];return _0xec6c28;};'use strict';var multer=require(_0xd757('0x0'));var util=require(_0xd757('0x1'));var path=require(_0xd757('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd757('0x3')]();var fs_extra=require(_0xd757('0x4'));var auth=require(_0xd757('0x5'));var interaction=require(_0xd757('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0xd757('0x7')]('/',auth[_0xd757('0x8')](),controller[_0xd757('0x9')]);router[_0xd757('0x7')](_0xd757('0xa'),controller['getDate']);router['get'](_0xd757('0xb'),controller['show']);router[_0xd757('0x7')](_0xd757('0xc'),controller[_0xd757('0xd')]);router[_0xd757('0x7')](_0xd757('0xe'),controller[_0xd757('0xf')]);router['get'](_0xd757('0x10'),controller[_0xd757('0x11')]);router['get'](_0xd757('0x12'),controller[_0xd757('0x13')]);router[_0xd757('0x7')](_0xd757('0x14'),controller[_0xd757('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d2874,_0x4b62aa,_0x33fabe){_0x33fabe(null,path[_0xd757('0x16')](config[_0xd757('0x17')],_0xd757('0x18')));},'filename':function(_0x22e882,_0x5ce640,_0x2a0699){_0x2a0699(null,util['format'](_0xd757('0x19'),_0xd757('0x1a'),path[_0xd757('0x1b')](_0x5ce640[_0xd757('0x1c')])));}})});router[_0xd757('0x1d')](_0xd757('0xc'),upload[_0xd757('0x1e')](_0xd757('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0xd757('0x20')]({'destination':function(_0x10f368,_0x776fe6,_0x328b7d){_0x328b7d(null,path[_0xd757('0x16')](config[_0xd757('0x17')],_0xd757('0x18')));},'filename':function(_0x4a66d2,_0x38b243,_0x536368){_0x536368(null,util[_0xd757('0x21')](_0xd757('0x19'),_0xd757('0x22'),path[_0xd757('0x1b')](_0x38b243[_0xd757('0x1c')])));}})});router[_0xd757('0x1d')](_0xd757('0xe'),upload['single'](_0xd757('0x1f')),controller[_0xd757('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12fd90,_0x12d265,_0x2dbd37){_0x2dbd37(null,path[_0xd757('0x16')](config['root'],_0xd757('0x18')));},'filename':function(_0x25dc59,_0x4695e7,_0x391be9){_0x391be9(null,util[_0xd757('0x21')](_0xd757('0x19'),_0xd757('0x24'),path['extname'](_0x4695e7['originalname'])));}})});router[_0xd757('0x1d')](_0xd757('0x12'),upload[_0xd757('0x1e')]('file'),controller[_0xd757('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfad463,_0x2a698b,_0xc2bc67){_0xc2bc67(null,path[_0xd757('0x16')](config[_0xd757('0x17')],_0xd757('0x18')));},'filename':function(_0x497ea2,_0x25690d,_0x5a1104){_0x5a1104(null,util[_0xd757('0x21')](_0xd757('0x19'),_0xd757('0x26'),path[_0xd757('0x1b')](_0x25690d[_0xd757('0x1c')])));}})});router['post'](_0xd757('0x14'),upload['single']('file'),controller['addFavicon']);router[_0xd757('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xd757('0x28')]);module[_0xd757('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 365ef81..29029e8 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x26bee6,_0x53e09e){var _0x4f2896=function(_0x16ebff){while(--_0x16ebff){_0x26bee6['push'](_0x26bee6['shift']());}};_0x4f2896(++_0x53e09e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x25391a,_0x2361e4){var _0x3f2d85=function(_0x36fc61){while(--_0x36fc61){_0x25391a['push'](_0x25391a['shift']());}};_0x3f2d85(++_0x2361e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8d09f5c..596e363 100644 --- a/server/api/setting/setting.controller.js +++ b/server/api/setting/setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8828=['addPreferred','getPreferred','default_preferred.png','addFavicon','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','sendStatus','name','send','map','Setting','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','body','find','catch','file','filename','loginLogo','../../config/license/util','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','\x20not\x20found'];(function(_0x3a4dd9,_0x1cbc1a){var _0x2be3ec=function(_0x2c326e){while(--_0x2c326e){_0x3a4dd9['push'](_0x3a4dd9['shift']());}};_0x2be3ec(++_0x1cbc1a);}(_0x8828,0x1d1));var _0x8882=function(_0x85674a,_0x5ca49f){_0x85674a=_0x85674a-0x0;var _0x172a3b=_0x8828[_0x85674a];return _0x172a3b;};'use strict';var emlformat=require(_0x8882('0x0'));var rimraf=require(_0x8882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8882('0x2'));var moment=require(_0x8882('0x3'));var BPromise=require(_0x8882('0x4'));var Mustache=require(_0x8882('0x5'));var util=require(_0x8882('0x6'));var path=require('path');var sox=require(_0x8882('0x7'));var csv=require(_0x8882('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8882('0x9'));var _=require('lodash');var squel=require(_0x8882('0xa'));var crypto=require('crypto');var jsforce=require(_0x8882('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8882('0xc'));var Papa=require(_0x8882('0xd'));var Redis=require(_0x8882('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8882('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8882('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8882('0x11'))['db'];var jayson=require(_0x8882('0x12'));var client=jayson[_0x8882('0x13')][_0x8882('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1a8e46,_0xf9faf5,_0x58c675,_0x5f1107){return new BPromise(function(_0x45d479,_0x25f920){var _0x52488d=_0x5f1107||client;return _0x52488d[_0x8882('0x15')](_0x1a8e46,_0x58c675)[_0x8882('0x16')](function(_0x3cfdd2){logger[_0x8882('0x17')]('Setting,\x20%s,\x20%s',_0xf9faf5,'request\x20sent');logger[_0x8882('0x18')]('Setting,\x20%s,\x20%s,\x20%s',_0xf9faf5,_0x8882('0x19'),JSON[_0x8882('0x1a')](_0x3cfdd2));if(_0x3cfdd2[_0x8882('0x1b')]){if(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1c')]===0x1f4){logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);return _0x25f920(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);}logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3cfdd2['error'][_0x8882('0x1e')]);return _0x45d479(_0x3cfdd2[_0x8882('0x1b')][_0x8882('0x1e')]);}else{logger[_0x8882('0x17')](_0x8882('0x1d'),_0xf9faf5,'request\x20sent');_0x45d479(_0x3cfdd2[_0x8882('0x1f')]['message']);}})['catch'](function(_0x3e295a){logger[_0x8882('0x1b')](_0x8882('0x1d'),_0xf9faf5,_0x3e295a);_0x25f920(_0x3e295a);});});}function respondWithStatusCode(_0x57d33a,_0x5f4ddc){_0x5f4ddc=_0x5f4ddc||0xcc;return function(_0x45314d){if(_0x45314d){return _0x57d33a['sendStatus'](_0x5f4ddc);}return _0x57d33a[_0x8882('0x20')](_0x5f4ddc)['end']();};}function respondWithResult(_0x4a4aed,_0x44c95e){_0x44c95e=_0x44c95e||0xc8;return function(_0x552de8){if(_0x552de8){return _0x4a4aed[_0x8882('0x20')](_0x44c95e)[_0x8882('0x21')](_0x552de8);}};}function respondWithFilteredResult(_0x3a8e04,_0x1e68d8){return function(_0x1f9d20){if(_0x1f9d20){var _0x4e09d4=typeof _0x1e68d8[_0x8882('0x22')]===_0x8882('0x23')&&typeof _0x1e68d8[_0x8882('0x24')]===_0x8882('0x23');var _0x237bfd=_0x1f9d20[_0x8882('0x25')];var _0x1eef4f=_0x4e09d4?0x0:_0x1e68d8[_0x8882('0x22')];var _0x5cedd3=_0x4e09d4?_0x1f9d20[_0x8882('0x25')]:_0x1e68d8[_0x8882('0x22')]+_0x1e68d8[_0x8882('0x24')];var _0x3551e7;if(_0x5cedd3>=_0x237bfd){_0x5cedd3=_0x237bfd;_0x3551e7=0xc8;}else{_0x3551e7=0xce;}_0x3a8e04[_0x8882('0x20')](_0x3551e7);return _0x3a8e04[_0x8882('0x26')](_0x8882('0x27'),_0x1eef4f+'-'+_0x5cedd3+'/'+_0x237bfd)[_0x8882('0x21')](_0x1f9d20);}return null;};}function patchUpdates(_0x3f8153){return function(_0x384060){try{jsonpatch[_0x8882('0x28')](_0x384060,_0x3f8153,!![]);}catch(_0x495303){return BPromise['reject'](_0x495303);}return _0x384060[_0x8882('0x29')]();};}function saveUpdates(_0x4717fe,_0x16406c){return function(_0x371be3){if(_0x371be3){return _0x371be3[_0x8882('0x2a')](_0x4717fe)[_0x8882('0x16')](function(_0x508669){return _0x508669;});}return null;};}function removeEntity(_0x318c17,_0x1d68b7){return function(_0x14aee1){if(_0x14aee1){return _0x14aee1[_0x8882('0x2b')]()['then'](function(){_0x318c17['status'](0xcc)[_0x8882('0x2c')]();});}};}function handleEntityNotFound(_0x1c570e,_0x46f1b6){return function(_0x4926d6){if(!_0x4926d6){_0x1c570e[_0x8882('0x2d')](0x194);}return _0x4926d6;};}function handleError(_0xdc9841,_0x1ac946){_0x1ac946=_0x1ac946||0x1f4;return function(_0x159b6f){logger['error'](_0x159b6f['stack']);if(_0x159b6f[_0x8882('0x2e')]){delete _0x159b6f[_0x8882('0x2e')];}_0xdc9841[_0x8882('0x20')](_0x1ac946)[_0x8882('0x2f')](_0x159b6f);};}exports['index']=function(_0x256c28,_0x35daf0){var _0x109eff={},_0x3b027f={},_0x1c5745={'count':0x0,'rows':[]};var _0x24b18d=_[_0x8882('0x30')](db[_0x8882('0x31')][_0x8882('0x32')],function(_0x4a8456){return{'name':_0x4a8456[_0x8882('0x33')],'type':_0x4a8456[_0x8882('0x34')]['key']};});_0x3b027f[_0x8882('0x35')]=_['map'](_0x24b18d,_0x8882('0x2e'));_0x3b027f[_0x8882('0x36')]=_[_0x8882('0x37')](_0x256c28['query']);_0x3b027f['filters']=_['intersection'](_0x3b027f['model'],_0x3b027f[_0x8882('0x36')]);_0x109eff[_0x8882('0x38')]=_[_0x8882('0x39')](_0x3b027f[_0x8882('0x35')],qs[_0x8882('0x3a')](_0x256c28[_0x8882('0x36')]['fields']));_0x109eff['attributes']=_0x109eff['attributes']['length']?_0x109eff[_0x8882('0x38')]:_0x3b027f[_0x8882('0x35')];if(!_0x256c28[_0x8882('0x36')][_0x8882('0x3b')](_0x8882('0x3c'))){_0x109eff[_0x8882('0x24')]=qs['limit'](_0x256c28[_0x8882('0x36')][_0x8882('0x24')]);_0x109eff[_0x8882('0x22')]=qs[_0x8882('0x22')](_0x256c28[_0x8882('0x36')][_0x8882('0x22')]);}_0x109eff['order']=qs['sort'](_0x256c28[_0x8882('0x36')][_0x8882('0x3d')]);_0x109eff[_0x8882('0x3e')]=qs['filters'](_[_0x8882('0x3f')](_0x256c28[_0x8882('0x36')],_0x3b027f[_0x8882('0x40')]),_0x24b18d);if(_0x256c28[_0x8882('0x36')][_0x8882('0x41')]){_0x109eff[_0x8882('0x3e')]=_[_0x8882('0x42')](_0x109eff[_0x8882('0x3e')],{'$or':_[_0x8882('0x30')](_0x24b18d,function(_0x5591f6){if(_0x5591f6[_0x8882('0x34')]!==_0x8882('0x43')){var _0x4383e7={};_0x4383e7[_0x5591f6['name']]={'$like':'%'+_0x256c28[_0x8882('0x36')][_0x8882('0x41')]+'%'};return _0x4383e7;}})});}_0x109eff=_[_0x8882('0x42')]({},_0x109eff,_0x256c28['options']);var _0x5c7ce5={'where':_0x109eff[_0x8882('0x3e')]};return db[_0x8882('0x31')][_0x8882('0x25')](_0x5c7ce5)[_0x8882('0x16')](function(_0x9c8dc){_0x1c5745[_0x8882('0x25')]=_0x9c8dc;if(_0x256c28[_0x8882('0x36')][_0x8882('0x44')]){_0x109eff[_0x8882('0x45')]=[{'all':!![]}];}return db[_0x8882('0x31')][_0x8882('0x46')](_0x109eff);})[_0x8882('0x16')](function(_0x3df3e1){_0x1c5745[_0x8882('0x47')]=_0x3df3e1;return _0x1c5745;})[_0x8882('0x16')](respondWithFilteredResult(_0x35daf0,_0x109eff))['catch'](handleError(_0x35daf0,null));};exports[_0x8882('0x48')]=function(_0x1882ef,_0x346d07){var _0x18011c={'raw':![],'where':{'id':_0x1882ef[_0x8882('0x49')]['id']}},_0x1bbd7d={};_0x1bbd7d[_0x8882('0x35')]=_[_0x8882('0x37')](db['Setting'][_0x8882('0x32')]);_0x1bbd7d['query']=_[_0x8882('0x37')](_0x1882ef[_0x8882('0x36')]);_0x1bbd7d['filters']=_[_0x8882('0x39')](_0x1bbd7d[_0x8882('0x35')],_0x1bbd7d[_0x8882('0x36')]);_0x18011c['attributes']=_[_0x8882('0x39')](_0x1bbd7d[_0x8882('0x35')],qs[_0x8882('0x3a')](_0x1882ef[_0x8882('0x36')][_0x8882('0x3a')]));_0x18011c['attributes']=_0x18011c[_0x8882('0x38')]['length']?_0x18011c[_0x8882('0x38')]:_0x1bbd7d[_0x8882('0x35')];if(_0x1882ef[_0x8882('0x36')][_0x8882('0x44')]){_0x18011c['include']=[{'all':!![]}];}_0x18011c=_[_0x8882('0x42')]({},_0x18011c,_0x1882ef[_0x8882('0x4a')]);return db[_0x8882('0x31')]['find'](_0x18011c)['then'](handleEntityNotFound(_0x346d07,null))[_0x8882('0x16')](respondWithResult(_0x346d07,null))['catch'](handleError(_0x346d07,null));};exports[_0x8882('0x2a')]=function(_0x389e93,_0x19cb8b){if(_0x389e93['body']['id']){delete _0x389e93[_0x8882('0x4b')]['id'];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x389e93['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x19cb8b,null))[_0x8882('0x16')](saveUpdates(_0x389e93[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0x19cb8b,null))[_0x8882('0x4d')](handleError(_0x19cb8b,null));};exports['addLogo']=function(_0x23eac9,_0x5d940d,_0x52ec2f){if(_0x23eac9['file']&&_0x23eac9[_0x8882('0x4e')][_0x8882('0x4f')]){_0x23eac9['body']['logo']=_0x23eac9[_0x8882('0x4e')][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x23eac9['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x5d940d,null))[_0x8882('0x16')](saveUpdates(_0x23eac9[_0x8882('0x4b')],null))['then'](respondWithResult(_0x5d940d,null))[_0x8882('0x4d')](handleError(_0x5d940d,null));};exports['addLogoLogin']=function(_0x458763,_0x35cecd,_0x5c298a){if(_0x458763[_0x8882('0x4e')]&&_0x458763[_0x8882('0x4e')][_0x8882('0x4f')]){_0x458763['body'][_0x8882('0x50')]=_0x458763['file'][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x458763['params']['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x35cecd,null))[_0x8882('0x16')](saveUpdates(_0x458763[_0x8882('0x4b')],null))['then'](respondWithResult(_0x35cecd,null))[_0x8882('0x4d')](handleError(_0x35cecd,null));};var utilLicense=require(_0x8882('0x51'));exports['getLogo']=function(_0x4734b3,_0x51b879,_0x3c430d){var _0x160688=_0x8882('0x52');var _0x4b1c68={'custom':![]};return utilLicense[_0x8882('0x53')]()[_0x8882('0x16')](function(_0x18eea8){if(_0x18eea8){_0x4b1c68=_0x18eea8;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4734b3[_0x8882('0x49')]['id']},'attributes':[_0x8882('0x54'),_0x8882('0x50'),_0x8882('0x55'),_0x8882('0x56'),_0x8882('0x57'),_0x8882('0x58'),'defaultPreferred',_0x8882('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0x51b879,null))[_0x8882('0x16')](function(_0x15659a){if(_0x15659a){var _0x44877d=_0x15659a['logo']&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x160688,_[_0x8882('0x5d')](_0x15659a['logo'])))?path[_0x8882('0x5b')](config['root'],_0x160688,_[_0x8882('0x5d')](_0x15659a[_0x8882('0x54')])):path[_0x8882('0x5b')](config['root'],_0x160688,_['toLower'](_0x8882('0x5e')));var _0x1e2192=_0x8882('0x5f')+_[_0x8882('0x60')]('logo');if(_0x15659a[_0x1e2192]||!_0x4b1c68[_0x8882('0x61')]){_0x44877d=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x160688,_[_0x8882('0x5d')](_0x8882('0x5e')));}if(!fs[_0x8882('0x5a')](_0x44877d)){throw new db[(_0x8882('0x62'))][(_0x8882('0x63'))](_[_0x8882('0x60')](_0x8882('0x54'))+'\x20not\x20found');}return _0x51b879[_0x8882('0x64')](_0x44877d);}})[_0x8882('0x4d')](handleError(_0x51b879,null));};var utilLicense=require(_0x8882('0x51'));exports[_0x8882('0x65')]=function(_0x3676ac,_0x36e675,_0x241b27){var _0x5dfb78=_0x8882('0x52');var _0x3a8010={'custom':![]};return utilLicense[_0x8882('0x53')]()['then'](function(_0x36a119){if(_0x36a119){_0x3a8010=_0x36a119;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x3676ac[_0x8882('0x49')]['id']},'attributes':[_0x8882('0x54'),_0x8882('0x50'),_0x8882('0x55'),_0x8882('0x56'),'defaultLogo',_0x8882('0x58'),_0x8882('0x66'),_0x8882('0x59')],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x36e675,null))[_0x8882('0x16')](function(_0x18c047){if(_0x18c047){var _0x31cdf1=_0x18c047[_0x8882('0x50')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5dfb78,_[_0x8882('0x5d')](_0x18c047[_0x8882('0x50')])))?path['join'](config['root'],_0x5dfb78,_[_0x8882('0x5d')](_0x18c047[_0x8882('0x50')])):path[_0x8882('0x5b')](config['root'],_0x5dfb78,_['toLower'](_0x8882('0x67')));var _0x39d8ad='default'+_[_0x8882('0x60')](_0x8882('0x50'));if(_0x18c047[_0x39d8ad]||!_0x3a8010[_0x8882('0x61')]){_0x31cdf1=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5dfb78,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x31cdf1)){throw new db['Sequelize']['ValidationError'](_[_0x8882('0x60')](_0x8882('0x50'))+_0x8882('0x68'));}return _0x36e675[_0x8882('0x64')](_0x31cdf1);}})[_0x8882('0x4d')](handleError(_0x36e675,null));};exports['gdpr']=function(_0x4ced44,_0x5e8fd3){return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4ced44[_0x8882('0x49')]['id']},'attributes':['securePassword']})[_0x8882('0x16')](respondWithResult(_0x5e8fd3,null))['catch'](handleError(_0x5e8fd3,null));};exports[_0x8882('0x69')]=function(_0x202a52,_0xb4410a,_0x3fd213){if(_0x202a52[_0x8882('0x4e')]&&_0x202a52[_0x8882('0x4e')][_0x8882('0x4f')]){_0x202a52[_0x8882('0x4b')][_0x8882('0x55')]=_0x202a52[_0x8882('0x4e')]['filename'];}return db['Setting'][_0x8882('0x4c')]({'where':{'id':_0x202a52[_0x8882('0x49')]['id']}})[_0x8882('0x16')](handleEntityNotFound(_0xb4410a,null))[_0x8882('0x16')](saveUpdates(_0x202a52[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0xb4410a,null))['catch'](handleError(_0xb4410a,null));};var utilLicense=require(_0x8882('0x51'));exports[_0x8882('0x6a')]=function(_0x2826b8,_0x4ebafd,_0x42916a){var _0x13492e=_0x8882('0x52');var _0x28e261={'custom':![]};return utilLicense['getLicense']()[_0x8882('0x16')](function(_0x371fdd){if(_0x371fdd){_0x28e261=_0x371fdd;}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x2826b8[_0x8882('0x49')]['id']},'attributes':['logo',_0x8882('0x50'),'preferred','favicon',_0x8882('0x57'),'defaultLoginLogo',_0x8882('0x66'),'defaultFavicon'],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x4ebafd,null))[_0x8882('0x16')](function(_0x1d3ad7){if(_0x1d3ad7){var _0xb3dec9=_0x1d3ad7[_0x8882('0x55')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x1d3ad7[_0x8882('0x55')])))?path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x1d3ad7[_0x8882('0x55')])):path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x13492e,_[_0x8882('0x5d')](_0x8882('0x6b')));var _0x413286=_0x8882('0x5f')+_[_0x8882('0x60')]('preferred');if(_0x1d3ad7[_0x413286]||!_0x28e261[_0x8882('0x61')]||!_0x28e261[_0x8882('0x55')]){_0xb3dec9=path['join'](config[_0x8882('0x5c')],_0x13492e,_['toLower'](_0x8882('0x6b')));}if(!fs[_0x8882('0x5a')](_0xb3dec9)){throw new db[(_0x8882('0x62'))][(_0x8882('0x63'))](_['upperFirst'](_0x8882('0x55'))+_0x8882('0x68'));}return _0x4ebafd[_0x8882('0x64')](_0xb3dec9);}})[_0x8882('0x4d')](handleError(_0x4ebafd,null));};exports[_0x8882('0x6c')]=function(_0x4c5c65,_0x305c16,_0x1d08a9){if(_0x4c5c65[_0x8882('0x4e')]&&_0x4c5c65[_0x8882('0x4e')][_0x8882('0x4f')]){_0x4c5c65[_0x8882('0x4b')][_0x8882('0x56')]=_0x4c5c65[_0x8882('0x4e')][_0x8882('0x4f')];}return db[_0x8882('0x31')][_0x8882('0x4c')]({'where':{'id':_0x4c5c65[_0x8882('0x49')]['id']}})[_0x8882('0x16')](handleEntityNotFound(_0x305c16,null))['then'](saveUpdates(_0x4c5c65[_0x8882('0x4b')],null))[_0x8882('0x16')](respondWithResult(_0x305c16,null))[_0x8882('0x4d')](handleError(_0x305c16,null));};var utilLicense=require(_0x8882('0x51'));exports['getFavicon']=function(_0x181783,_0x5d26c2,_0x312715){var _0x5250b5=_0x8882('0x52');var _0xf4c770={'custom':![]};return utilLicense['getLicense']()[_0x8882('0x16')](function(_0x4fa652){if(_0x4fa652){_0xf4c770=_0x4fa652;}return db['Setting'][_0x8882('0x4c')]({'where':{'id':_0x181783[_0x8882('0x49')]['id']},'attributes':['logo',_0x8882('0x50'),'preferred',_0x8882('0x56'),'defaultLogo',_0x8882('0x58'),'defaultPreferred',_0x8882('0x59')],'raw':!![]});})[_0x8882('0x16')](handleEntityNotFound(_0x5d26c2,null))['then'](function(_0x5c6f25){if(_0x5c6f25){var _0x37bb4e=_0x5c6f25[_0x8882('0x56')]&&fs[_0x8882('0x5a')](path[_0x8882('0x5b')](config['root'],_0x5250b5,_['toLower'](_0x5c6f25[_0x8882('0x56')])))?path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5250b5,_[_0x8882('0x5d')](_0x5c6f25[_0x8882('0x56')])):path['join'](config[_0x8882('0x5c')],_0x5250b5,_['toLower']('default_favicon.ico'));var _0x477156='default'+_['upperFirst'](_0x8882('0x56'));if(_0x5c6f25[_0x477156]||!_0xf4c770[_0x8882('0x61')]){_0x37bb4e=path[_0x8882('0x5b')](config[_0x8882('0x5c')],_0x5250b5,_[_0x8882('0x5d')]('default_favicon.ico'));}if(!fs[_0x8882('0x5a')](_0x37bb4e)){throw new db[(_0x8882('0x62'))]['ValidationError'](_[_0x8882('0x60')](_0x8882('0x56'))+_0x8882('0x68'));}return _0x5d26c2[_0x8882('0x64')](_0x37bb4e);}})[_0x8882('0x4d')](handleError(_0x5d26c2,null));};exports[_0x8882('0x6d')]=function(_0x44b520,_0x3260e0){var _0x1891e1={'offset':moment()[_0x8882('0x6e')]()};_0x1891e1[_0x8882('0x6f')]=moment()[_0x8882('0x6e')](_0x1891e1[_0x8882('0x22')])[_0x8882('0x70')](_0x8882('0x71'));return _0x3260e0[_0x8882('0x20')](0xc8)[_0x8882('0x2f')](_0x1891e1);}; \ No newline at end of file +var _0x752a=['gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','getDate','utcOffset','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','sendStatus','status','end','undefined','limit','offset','count','apply','reject','save','update','destroy','stack','send','index','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','map','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','keys','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','logo','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize','\x20not\x20found','download','getLogoLogin','getLicense','defaultLoginLogo','custom','default_loginLogo.svg','ValidationError'];(function(_0x17d9c0,_0x4b1faa){var _0x48bed8=function(_0x1aad7f){while(--_0x1aad7f){_0x17d9c0['push'](_0x17d9c0['shift']());}};_0x48bed8(++_0x4b1faa);}(_0x752a,0x103));var _0xa752=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x752a[_0x519756];return _0x37047e;};'use strict';var emlformat=require(_0xa752('0x0'));var rimraf=require(_0xa752('0x1'));var zipdir=require(_0xa752('0x2'));var jsonpatch=require(_0xa752('0x3'));var rp=require(_0xa752('0x4'));var moment=require('moment');var BPromise=require(_0xa752('0x5'));var Mustache=require(_0xa752('0x6'));var util=require(_0xa752('0x7'));var path=require(_0xa752('0x8'));var sox=require(_0xa752('0x9'));var csv=require('to-csv');var ejs=require(_0xa752('0xa'));var fs=require('fs');var fs_extra=require(_0xa752('0xb'));var _=require(_0xa752('0xc'));var squel=require(_0xa752('0xd'));var crypto=require('crypto');var jsforce=require(_0xa752('0xe'));var deskjs=require(_0xa752('0xf'));var toCsv=require(_0xa752('0x10'));var querystring=require(_0xa752('0x11'));var Papa=require('papaparse');var Redis=require(_0xa752('0x12'));var authService=require(_0xa752('0x13'));var qs=require(_0xa752('0x14'));var as=require(_0xa752('0x15'));var hardwareService=require(_0xa752('0x16'));var logger=require(_0xa752('0x17'))(_0xa752('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa752('0x19'));var db=require(_0xa752('0x1a'))['db'];var jayson=require(_0xa752('0x1b'));var client=jayson[_0xa752('0x1c')][_0xa752('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5f193e,_0x54ab8c,_0x47e320,_0x1ea0f7){return new BPromise(function(_0x5ed672,_0x17501d){var _0x44470e=_0x1ea0f7||client;return _0x44470e[_0xa752('0x1e')](_0x5f193e,_0x47e320)[_0xa752('0x1f')](function(_0x38e90c){logger[_0xa752('0x20')]('Setting,\x20%s,\x20%s',_0x54ab8c,_0xa752('0x21'));logger[_0xa752('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x54ab8c,_0xa752('0x21'),JSON[_0xa752('0x23')](_0x38e90c));if(_0x38e90c[_0xa752('0x24')]){if(_0x38e90c[_0xa752('0x24')][_0xa752('0x25')]===0x1f4){logger[_0xa752('0x24')]('Setting,\x20%s,\x20%s',_0x54ab8c,_0x38e90c[_0xa752('0x24')][_0xa752('0x26')]);return _0x17501d(_0x38e90c[_0xa752('0x24')][_0xa752('0x26')]);}logger[_0xa752('0x24')]('Setting,\x20%s,\x20%s',_0x54ab8c,_0x38e90c[_0xa752('0x24')][_0xa752('0x26')]);return _0x5ed672(_0x38e90c[_0xa752('0x24')][_0xa752('0x26')]);}else{logger[_0xa752('0x20')](_0xa752('0x27'),_0x54ab8c,_0xa752('0x21'));_0x5ed672(_0x38e90c[_0xa752('0x28')]['message']);}})[_0xa752('0x29')](function(_0x1f276e){logger[_0xa752('0x24')]('Setting,\x20%s,\x20%s',_0x54ab8c,_0x1f276e);_0x17501d(_0x1f276e);});});}function respondWithStatusCode(_0x56bbbd,_0x4bfcfe){_0x4bfcfe=_0x4bfcfe||0xcc;return function(_0x2d36f8){if(_0x2d36f8){return _0x56bbbd[_0xa752('0x2a')](_0x4bfcfe);}return _0x56bbbd[_0xa752('0x2b')](_0x4bfcfe)[_0xa752('0x2c')]();};}function respondWithResult(_0x566309,_0x34e0bf){_0x34e0bf=_0x34e0bf||0xc8;return function(_0x289c29){if(_0x289c29){return _0x566309[_0xa752('0x2b')](_0x34e0bf)['json'](_0x289c29);}};}function respondWithFilteredResult(_0x4220ba,_0xff5fe0){return function(_0x27bf22){if(_0x27bf22){var _0x237eab=typeof _0xff5fe0['offset']===_0xa752('0x2d')&&typeof _0xff5fe0[_0xa752('0x2e')]===_0xa752('0x2d');var _0x3f49bc=_0x27bf22['count'];var _0x56ab89=_0x237eab?0x0:_0xff5fe0[_0xa752('0x2f')];var _0x492142=_0x237eab?_0x27bf22[_0xa752('0x30')]:_0xff5fe0[_0xa752('0x2f')]+_0xff5fe0[_0xa752('0x2e')];var _0x461419;if(_0x492142>=_0x3f49bc){_0x492142=_0x3f49bc;_0x461419=0xc8;}else{_0x461419=0xce;}_0x4220ba['status'](_0x461419);return _0x4220ba['set']('Content-Range',_0x56ab89+'-'+_0x492142+'/'+_0x3f49bc)['json'](_0x27bf22);}return null;};}function patchUpdates(_0x2f4ca1){return function(_0x57d950){try{jsonpatch[_0xa752('0x31')](_0x57d950,_0x2f4ca1,!![]);}catch(_0x912318){return BPromise[_0xa752('0x32')](_0x912318);}return _0x57d950[_0xa752('0x33')]();};}function saveUpdates(_0x1782d6,_0x5361b6){return function(_0x13d275){if(_0x13d275){return _0x13d275[_0xa752('0x34')](_0x1782d6)[_0xa752('0x1f')](function(_0x37426b){return _0x37426b;});}return null;};}function removeEntity(_0x457261,_0x420e0f){return function(_0x5676ac){if(_0x5676ac){return _0x5676ac[_0xa752('0x35')]()[_0xa752('0x1f')](function(){_0x457261[_0xa752('0x2b')](0xcc)[_0xa752('0x2c')]();});}};}function handleEntityNotFound(_0x15c6e9,_0x403264){return function(_0x26c94e){if(!_0x26c94e){_0x15c6e9[_0xa752('0x2a')](0x194);}return _0x26c94e;};}function handleError(_0x3110a7,_0x1d7e9b){_0x1d7e9b=_0x1d7e9b||0x1f4;return function(_0x330156){logger[_0xa752('0x24')](_0x330156[_0xa752('0x36')]);if(_0x330156['name']){delete _0x330156['name'];}_0x3110a7[_0xa752('0x2b')](_0x1d7e9b)[_0xa752('0x37')](_0x330156);};}exports[_0xa752('0x38')]=function(_0x251366,_0x15d2da){var _0x347f6e={},_0x55842f={},_0xc25265={'count':0x0,'rows':[]};var _0x4d211d=_['map'](db['Setting'][_0xa752('0x39')],function(_0x2ab49f){return{'name':_0x2ab49f[_0xa752('0x3a')],'type':_0x2ab49f[_0xa752('0x3b')][_0xa752('0x3c')]};});_0x55842f[_0xa752('0x3d')]=_['map'](_0x4d211d,_0xa752('0x3e'));_0x55842f[_0xa752('0x3f')]=_['keys'](_0x251366[_0xa752('0x3f')]);_0x55842f[_0xa752('0x40')]=_[_0xa752('0x41')](_0x55842f[_0xa752('0x3d')],_0x55842f[_0xa752('0x3f')]);_0x347f6e['attributes']=_[_0xa752('0x41')](_0x55842f['model'],qs[_0xa752('0x42')](_0x251366[_0xa752('0x3f')][_0xa752('0x42')]));_0x347f6e['attributes']=_0x347f6e[_0xa752('0x43')][_0xa752('0x44')]?_0x347f6e[_0xa752('0x43')]:_0x55842f[_0xa752('0x3d')];if(!_0x251366['query']['hasOwnProperty'](_0xa752('0x45'))){_0x347f6e[_0xa752('0x2e')]=qs['limit'](_0x251366[_0xa752('0x3f')][_0xa752('0x2e')]);_0x347f6e[_0xa752('0x2f')]=qs[_0xa752('0x2f')](_0x251366[_0xa752('0x3f')][_0xa752('0x2f')]);}_0x347f6e['order']=qs['sort'](_0x251366[_0xa752('0x3f')][_0xa752('0x46')]);_0x347f6e[_0xa752('0x47')]=qs['filters'](_['pick'](_0x251366[_0xa752('0x3f')],_0x55842f[_0xa752('0x40')]),_0x4d211d);if(_0x251366[_0xa752('0x3f')][_0xa752('0x48')]){_0x347f6e[_0xa752('0x47')]=_[_0xa752('0x49')](_0x347f6e[_0xa752('0x47')],{'$or':_[_0xa752('0x4a')](_0x4d211d,function(_0x5df914){if(_0x5df914['type']!==_0xa752('0x4b')){var _0x12d41e={};_0x12d41e[_0x5df914[_0xa752('0x3e')]]={'$like':'%'+_0x251366[_0xa752('0x3f')][_0xa752('0x48')]+'%'};return _0x12d41e;}})});}_0x347f6e=_[_0xa752('0x49')]({},_0x347f6e,_0x251366[_0xa752('0x4c')]);var _0x9309bd={'where':_0x347f6e['where']};return db[_0xa752('0x4d')][_0xa752('0x30')](_0x9309bd)[_0xa752('0x1f')](function(_0x3b577f){_0xc25265[_0xa752('0x30')]=_0x3b577f;if(_0x251366[_0xa752('0x3f')][_0xa752('0x4e')]){_0x347f6e[_0xa752('0x4f')]=[{'all':!![]}];}return db[_0xa752('0x4d')][_0xa752('0x50')](_0x347f6e);})[_0xa752('0x1f')](function(_0x4c1381){_0xc25265[_0xa752('0x51')]=_0x4c1381;return _0xc25265;})['then'](respondWithFilteredResult(_0x15d2da,_0x347f6e))[_0xa752('0x29')](handleError(_0x15d2da,null));};exports[_0xa752('0x52')]=function(_0x373643,_0x25f996){var _0x1d5c68={'raw':![],'where':{'id':_0x373643['params']['id']}},_0x371bd0={};_0x371bd0['model']=_[_0xa752('0x53')](db[_0xa752('0x4d')][_0xa752('0x39')]);_0x371bd0['query']=_[_0xa752('0x53')](_0x373643[_0xa752('0x3f')]);_0x371bd0['filters']=_[_0xa752('0x41')](_0x371bd0[_0xa752('0x3d')],_0x371bd0[_0xa752('0x3f')]);_0x1d5c68[_0xa752('0x43')]=_[_0xa752('0x41')](_0x371bd0[_0xa752('0x3d')],qs[_0xa752('0x42')](_0x373643[_0xa752('0x3f')]['fields']));_0x1d5c68[_0xa752('0x43')]=_0x1d5c68['attributes'][_0xa752('0x44')]?_0x1d5c68[_0xa752('0x43')]:_0x371bd0[_0xa752('0x3d')];if(_0x373643[_0xa752('0x3f')][_0xa752('0x4e')]){_0x1d5c68[_0xa752('0x4f')]=[{'all':!![]}];}_0x1d5c68=_[_0xa752('0x49')]({},_0x1d5c68,_0x373643['options']);return db[_0xa752('0x4d')][_0xa752('0x54')](_0x1d5c68)[_0xa752('0x1f')](handleEntityNotFound(_0x25f996,null))[_0xa752('0x1f')](respondWithResult(_0x25f996,null))[_0xa752('0x29')](handleError(_0x25f996,null));};exports['update']=function(_0x2577c1,_0xfce33f){if(_0x2577c1[_0xa752('0x55')]['id']){delete _0x2577c1[_0xa752('0x55')]['id'];}return db['Setting']['find']({'where':{'id':_0x2577c1[_0xa752('0x56')]['id']}})[_0xa752('0x1f')](handleEntityNotFound(_0xfce33f,null))[_0xa752('0x1f')](saveUpdates(_0x2577c1['body'],null))[_0xa752('0x1f')](respondWithResult(_0xfce33f,null))['catch'](handleError(_0xfce33f,null));};exports[_0xa752('0x57')]=function(_0x32ffe0,_0x37bf49,_0x49dce0){if(_0x32ffe0['file']&&_0x32ffe0[_0xa752('0x58')][_0xa752('0x59')]){_0x32ffe0[_0xa752('0x55')]['logo']=_0x32ffe0[_0xa752('0x58')][_0xa752('0x59')];}return db['Setting'][_0xa752('0x54')]({'where':{'id':_0x32ffe0['params']['id']}})[_0xa752('0x1f')](handleEntityNotFound(_0x37bf49,null))['then'](saveUpdates(_0x32ffe0['body'],null))[_0xa752('0x1f')](respondWithResult(_0x37bf49,null))[_0xa752('0x29')](handleError(_0x37bf49,null));};exports[_0xa752('0x5a')]=function(_0x27a6fb,_0x50bbf2,_0x3a6779){if(_0x27a6fb[_0xa752('0x58')]&&_0x27a6fb[_0xa752('0x58')][_0xa752('0x59')]){_0x27a6fb[_0xa752('0x55')][_0xa752('0x5b')]=_0x27a6fb['file'][_0xa752('0x59')];}return db['Setting'][_0xa752('0x54')]({'where':{'id':_0x27a6fb[_0xa752('0x56')]['id']}})[_0xa752('0x1f')](handleEntityNotFound(_0x50bbf2,null))[_0xa752('0x1f')](saveUpdates(_0x27a6fb[_0xa752('0x55')],null))[_0xa752('0x1f')](respondWithResult(_0x50bbf2,null))[_0xa752('0x29')](handleError(_0x50bbf2,null));};var utilLicense=require(_0xa752('0x19'));exports[_0xa752('0x5c')]=function(_0x457877,_0x3e24df,_0x42d35a){var _0x566846=_0xa752('0x5d');var _0x3cc818={'custom':![]};return utilLicense['getLicense']()[_0xa752('0x1f')](function(_0x4f2c31){if(_0x4f2c31){_0x3cc818=_0x4f2c31;}return db[_0xa752('0x4d')][_0xa752('0x54')]({'where':{'id':_0x457877[_0xa752('0x56')]['id']},'attributes':[_0xa752('0x5e'),_0xa752('0x5b'),_0xa752('0x5f'),_0xa752('0x60'),_0xa752('0x61'),'defaultLoginLogo',_0xa752('0x62'),_0xa752('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x3e24df,null))[_0xa752('0x1f')](function(_0x5e5f87){if(_0x5e5f87){var _0x57f260=_0x5e5f87[_0xa752('0x5e')]&&fs[_0xa752('0x64')](path[_0xa752('0x65')](config[_0xa752('0x66')],_0x566846,_[_0xa752('0x67')](_0x5e5f87[_0xa752('0x5e')])))?path[_0xa752('0x65')](config[_0xa752('0x66')],_0x566846,_['toLower'](_0x5e5f87[_0xa752('0x5e')])):path[_0xa752('0x65')](config[_0xa752('0x66')],_0x566846,_[_0xa752('0x67')]('default_logo.svg'));var _0x3d1231=_0xa752('0x68')+_[_0xa752('0x69')](_0xa752('0x5e'));if(_0x5e5f87[_0x3d1231]||!_0x3cc818['custom']){_0x57f260=path[_0xa752('0x65')](config['root'],_0x566846,_[_0xa752('0x67')](_0xa752('0x6a')));}if(!fs[_0xa752('0x64')](_0x57f260)){throw new db[(_0xa752('0x6b'))]['ValidationError'](_[_0xa752('0x69')](_0xa752('0x5e'))+_0xa752('0x6c'));}return _0x3e24df[_0xa752('0x6d')](_0x57f260);}})[_0xa752('0x29')](handleError(_0x3e24df,null));};var utilLicense=require(_0xa752('0x19'));exports[_0xa752('0x6e')]=function(_0xc60525,_0x43ca86,_0x333869){var _0x42ee86='server/files/images/logos';var _0x1f29c3={'custom':![]};return utilLicense[_0xa752('0x6f')]()[_0xa752('0x1f')](function(_0x365c5d){if(_0x365c5d){_0x1f29c3=_0x365c5d;}return db[_0xa752('0x4d')][_0xa752('0x54')]({'where':{'id':_0xc60525['params']['id']},'attributes':['logo',_0xa752('0x5b'),_0xa752('0x5f'),_0xa752('0x60'),_0xa752('0x61'),_0xa752('0x70'),_0xa752('0x62'),_0xa752('0x63')],'raw':!![]});})[_0xa752('0x1f')](handleEntityNotFound(_0x43ca86,null))['then'](function(_0x14f405){if(_0x14f405){var _0x49aea3=_0x14f405[_0xa752('0x5b')]&&fs[_0xa752('0x64')](path[_0xa752('0x65')](config[_0xa752('0x66')],_0x42ee86,_[_0xa752('0x67')](_0x14f405[_0xa752('0x5b')])))?path[_0xa752('0x65')](config[_0xa752('0x66')],_0x42ee86,_[_0xa752('0x67')](_0x14f405[_0xa752('0x5b')])):path[_0xa752('0x65')](config['root'],_0x42ee86,_[_0xa752('0x67')]('default_loginLogo.svg'));var _0x3c1d22='default'+_['upperFirst'](_0xa752('0x5b'));if(_0x14f405[_0x3c1d22]||!_0x1f29c3[_0xa752('0x71')]){_0x49aea3=path[_0xa752('0x65')](config[_0xa752('0x66')],_0x42ee86,_[_0xa752('0x67')](_0xa752('0x72')));}if(!fs[_0xa752('0x64')](_0x49aea3)){throw new db[(_0xa752('0x6b'))][(_0xa752('0x73'))](_[_0xa752('0x69')](_0xa752('0x5b'))+_0xa752('0x6c'));}return _0x43ca86[_0xa752('0x6d')](_0x49aea3);}})['catch'](handleError(_0x43ca86,null));};exports[_0xa752('0x74')]=function(_0x3533a7,_0x7330bb){return db['Setting'][_0xa752('0x54')]({'where':{'id':_0x3533a7[_0xa752('0x56')]['id']},'attributes':[_0xa752('0x75')]})[_0xa752('0x1f')](respondWithResult(_0x7330bb,null))[_0xa752('0x29')](handleError(_0x7330bb,null));};exports[_0xa752('0x76')]=function(_0x4638bb,_0x39382c,_0x44b4c4){if(_0x4638bb[_0xa752('0x58')]&&_0x4638bb[_0xa752('0x58')]['filename']){_0x4638bb[_0xa752('0x55')][_0xa752('0x5f')]=_0x4638bb['file'][_0xa752('0x59')];}return db[_0xa752('0x4d')]['find']({'where':{'id':_0x4638bb[_0xa752('0x56')]['id']}})[_0xa752('0x1f')](handleEntityNotFound(_0x39382c,null))[_0xa752('0x1f')](saveUpdates(_0x4638bb[_0xa752('0x55')],null))[_0xa752('0x1f')](respondWithResult(_0x39382c,null))[_0xa752('0x29')](handleError(_0x39382c,null));};var utilLicense=require(_0xa752('0x19'));exports[_0xa752('0x77')]=function(_0x10d039,_0x5b577d,_0x523ac1){var _0x3e12a2=_0xa752('0x5d');var _0x1f17cf={'custom':![]};return utilLicense[_0xa752('0x6f')]()[_0xa752('0x1f')](function(_0x136ee3){if(_0x136ee3){_0x1f17cf=_0x136ee3;}return db['Setting'][_0xa752('0x54')]({'where':{'id':_0x10d039[_0xa752('0x56')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0xa752('0x61'),_0xa752('0x70'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa752('0x1f')](handleEntityNotFound(_0x5b577d,null))['then'](function(_0xe4b3dd){if(_0xe4b3dd){var _0xebc70f=_0xe4b3dd['preferred']&&fs[_0xa752('0x64')](path[_0xa752('0x65')](config[_0xa752('0x66')],_0x3e12a2,_[_0xa752('0x67')](_0xe4b3dd['preferred'])))?path[_0xa752('0x65')](config[_0xa752('0x66')],_0x3e12a2,_[_0xa752('0x67')](_0xe4b3dd['preferred'])):path[_0xa752('0x65')](config['root'],_0x3e12a2,_['toLower'](_0xa752('0x78')));var _0x4f9409='default'+_[_0xa752('0x69')](_0xa752('0x5f'));if(_0xe4b3dd[_0x4f9409]||!_0x1f17cf[_0xa752('0x71')]||!_0x1f17cf[_0xa752('0x5f')]){_0xebc70f=path['join'](config[_0xa752('0x66')],_0x3e12a2,_[_0xa752('0x67')](_0xa752('0x78')));}if(!fs[_0xa752('0x64')](_0xebc70f)){throw new db['Sequelize'][(_0xa752('0x73'))](_[_0xa752('0x69')]('preferred')+_0xa752('0x6c'));}return _0x5b577d[_0xa752('0x6d')](_0xebc70f);}})[_0xa752('0x29')](handleError(_0x5b577d,null));};exports['addFavicon']=function(_0x25d065,_0x3c4d61,_0x1b8534){if(_0x25d065['file']&&_0x25d065[_0xa752('0x58')][_0xa752('0x59')]){_0x25d065[_0xa752('0x55')][_0xa752('0x60')]=_0x25d065[_0xa752('0x58')][_0xa752('0x59')];}return db[_0xa752('0x4d')][_0xa752('0x54')]({'where':{'id':_0x25d065['params']['id']}})[_0xa752('0x1f')](handleEntityNotFound(_0x3c4d61,null))['then'](saveUpdates(_0x25d065[_0xa752('0x55')],null))['then'](respondWithResult(_0x3c4d61,null))[_0xa752('0x29')](handleError(_0x3c4d61,null));};var utilLicense=require(_0xa752('0x19'));exports[_0xa752('0x79')]=function(_0x20e989,_0x873509,_0x1d77d6){var _0x2410ad=_0xa752('0x5d');var _0x45a125={'custom':![]};return utilLicense[_0xa752('0x6f')]()['then'](function(_0x3d2c99){if(_0x3d2c99){_0x45a125=_0x3d2c99;}return db[_0xa752('0x4d')][_0xa752('0x54')]({'where':{'id':_0x20e989[_0xa752('0x56')]['id']},'attributes':[_0xa752('0x5e'),'loginLogo',_0xa752('0x5f'),_0xa752('0x60'),_0xa752('0x61'),_0xa752('0x70'),_0xa752('0x62'),_0xa752('0x63')],'raw':!![]});})['then'](handleEntityNotFound(_0x873509,null))[_0xa752('0x1f')](function(_0x13141b){if(_0x13141b){var _0x71669f=_0x13141b['favicon']&&fs['existsSync'](path[_0xa752('0x65')](config[_0xa752('0x66')],_0x2410ad,_[_0xa752('0x67')](_0x13141b[_0xa752('0x60')])))?path[_0xa752('0x65')](config[_0xa752('0x66')],_0x2410ad,_[_0xa752('0x67')](_0x13141b[_0xa752('0x60')])):path[_0xa752('0x65')](config[_0xa752('0x66')],_0x2410ad,_[_0xa752('0x67')]('default_favicon.ico'));var _0x374f86=_0xa752('0x68')+_[_0xa752('0x69')](_0xa752('0x60'));if(_0x13141b[_0x374f86]||!_0x45a125[_0xa752('0x71')]){_0x71669f=path[_0xa752('0x65')](config['root'],_0x2410ad,_[_0xa752('0x67')]('default_favicon.ico'));}if(!fs[_0xa752('0x64')](_0x71669f)){throw new db[(_0xa752('0x6b'))][(_0xa752('0x73'))](_[_0xa752('0x69')](_0xa752('0x60'))+_0xa752('0x6c'));}return _0x873509[_0xa752('0x6d')](_0x71669f);}})[_0xa752('0x29')](handleError(_0x873509,null));};exports[_0xa752('0x7a')]=function(_0x144023,_0xaa71a){var _0x4d4e9d={'offset':moment()[_0xa752('0x7b')]()};_0x4d4e9d['now']=moment()[_0xa752('0x7b')](_0x4d4e9d[_0xa752('0x2f')])[_0xa752('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xaa71a[_0xa752('0x2b')](0xc8)[_0xa752('0x37')](_0x4d4e9d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 81575b0..a2f86c0 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x42f1e6,_0x372465){var _0xea2816=function(_0x20050e){while(--_0x20050e){_0x42f1e6['push'](_0x42f1e6['shift']());}};_0xea2816(++_0x372465);}(_0x008c,0x188));var _0xc008=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0x008c[_0x3baaf2];return _0x50e8b0;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 891de88..a3f6039 100644 --- a/server/api/setting/setting.rpc.js +++ b/server/api/setting/setting.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4259=['error','code','message','result','catch','Setting','find','options','where','attributes','include','map','model','info','ShowSetting','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2bc9f3,_0x160f7e){var _0x1bb67d=function(_0x2d15a7){while(--_0x2d15a7){_0x2bc9f3['push'](_0x2bc9f3['shift']());}};_0x1bb67d(++_0x160f7e);}(_0x4259,0x6a));var _0x9425=function(_0x4bbf78,_0x102916){_0x4bbf78=_0x4bbf78-0x0;var _0x354286=_0x4259[_0x4bbf78];return _0x354286;};'use strict';var _=require(_0x9425('0x0'));var util=require(_0x9425('0x1'));var moment=require(_0x9425('0x2'));var BPromise=require('bluebird');var rs=require(_0x9425('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9425('0x4'))['db'];var utils=require(_0x9425('0x5'));var logger=require(_0x9425('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9425('0x7'));var client=jayson['client'][_0x9425('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e3ab,_0x37a66d,_0x22f5ce){return new BPromise(function(_0x246d9f,_0xa18253){return client[_0x9425('0x9')](_0x3e3ab,_0x22f5ce)[_0x9425('0xa')](function(_0x27b27d){logger['info'](_0x9425('0xb'),_0x37a66d,_0x9425('0xc'));logger[_0x9425('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x37a66d,_0x9425('0xc'),JSON['stringify'](_0x27b27d));if(_0x27b27d[_0x9425('0xe')]){if(_0x27b27d['error'][_0x9425('0xf')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x37a66d,_0x27b27d[_0x9425('0xe')][_0x9425('0x10')]);return _0xa18253(_0x27b27d['error'][_0x9425('0x10')]);}logger[_0x9425('0xe')]('Setting,\x20%s,\x20%s',_0x37a66d,_0x27b27d['error'][_0x9425('0x10')]);return _0x246d9f(_0x27b27d[_0x9425('0xe')]['message']);}else{logger['info'](_0x9425('0xb'),_0x37a66d,'request\x20sent');_0x246d9f(_0x27b27d[_0x9425('0x11')][_0x9425('0x10')]);}})[_0x9425('0x12')](function(_0x237978){logger[_0x9425('0xe')](_0x9425('0xb'),_0x37a66d,_0x237978);_0xa18253(_0x237978);});});}exports['ShowSetting']=function(_0x10c857){var _0x537857=this;return new Promise(function(_0x2bc61f,_0x207a74){return db[_0x9425('0x13')][_0x9425('0x14')]({'raw':_0x10c857[_0x9425('0x15')]?_0x10c857['options']['raw']===undefined?!![]:![]:!![],'where':_0x10c857[_0x9425('0x15')]?_0x10c857[_0x9425('0x15')][_0x9425('0x16')]||null:null,'attributes':_0x10c857[_0x9425('0x15')]?_0x10c857['options'][_0x9425('0x17')]||null:null,'include':_0x10c857[_0x9425('0x15')]?_0x10c857['options'][_0x9425('0x18')]?_[_0x9425('0x19')](_0x10c857['options'][_0x9425('0x18')],function(_0x430b42){return{'model':db[_0x430b42[_0x9425('0x1a')]],'as':_0x430b42['as'],'attributes':_0x430b42['attributes'],'include':_0x430b42['include']?_['map'](_0x430b42['include'],function(_0x229d5){return{'model':db[_0x229d5[_0x9425('0x1a')]],'as':_0x229d5['as'],'attributes':_0x229d5[_0x9425('0x17')],'include':_0x229d5['include']?_[_0x9425('0x19')](_0x229d5['include'],function(_0x17cd5e){return{'model':db[_0x17cd5e[_0x9425('0x1a')]],'as':_0x17cd5e['as'],'attributes':_0x17cd5e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a444d){logger[_0x9425('0x1b')](_0x9425('0x1c'),_0x10c857);logger[_0x9425('0xd')](_0x9425('0x1c'),_0x10c857,JSON[_0x9425('0x1d')](_0x4a444d));_0x2bc61f(_0x4a444d);})[_0x9425('0x12')](function(_0xe2a629){logger[_0x9425('0xe')](_0x9425('0x1c'),_0xe2a629['message'],_0x10c857);_0x207a74(_0x537857['error'](0x1f4,_0xe2a629[_0x9425('0x10')]));});});}; \ No newline at end of file +var _0xa927=['where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','ShowSetting','Setting','options','raw'];(function(_0x2298e2,_0x51c324){var _0x11e3cd=function(_0x1f850c){while(--_0x1f850c){_0x2298e2['push'](_0x2298e2['shift']());}};_0x11e3cd(++_0x51c324);}(_0xa927,0x68));var _0x7a92=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa927[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x7a92('0x0'));var util=require(_0x7a92('0x1'));var moment=require('moment');var BPromise=require(_0x7a92('0x2'));var rs=require(_0x7a92('0x3'));var fs=require('fs');var Redis=require(_0x7a92('0x4'));var db=require(_0x7a92('0x5'))['db'];var utils=require(_0x7a92('0x6'));var logger=require(_0x7a92('0x7'))(_0x7a92('0x8'));var config=require(_0x7a92('0x9'));var jayson=require(_0x7a92('0xa'));var client=jayson[_0x7a92('0xb')][_0x7a92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ecba8,_0xc478e5,_0x12afc0){return new BPromise(function(_0x2b6218,_0x12d52f){return client['request'](_0x2ecba8,_0x12afc0)[_0x7a92('0xd')](function(_0x531f74){logger['info'](_0x7a92('0xe'),_0xc478e5,'request\x20sent');logger[_0x7a92('0xf')](_0x7a92('0x10'),_0xc478e5,_0x7a92('0x11'),JSON['stringify'](_0x531f74));if(_0x531f74['error']){if(_0x531f74[_0x7a92('0x12')][_0x7a92('0x13')]===0x1f4){logger[_0x7a92('0x12')](_0x7a92('0xe'),_0xc478e5,_0x531f74[_0x7a92('0x12')][_0x7a92('0x14')]);return _0x12d52f(_0x531f74[_0x7a92('0x12')][_0x7a92('0x14')]);}logger[_0x7a92('0x12')](_0x7a92('0xe'),_0xc478e5,_0x531f74['error'][_0x7a92('0x14')]);return _0x2b6218(_0x531f74[_0x7a92('0x12')][_0x7a92('0x14')]);}else{logger[_0x7a92('0x15')](_0x7a92('0xe'),_0xc478e5,_0x7a92('0x11'));_0x2b6218(_0x531f74[_0x7a92('0x16')][_0x7a92('0x14')]);}})[_0x7a92('0x17')](function(_0x677a37){logger[_0x7a92('0x12')]('Setting,\x20%s,\x20%s',_0xc478e5,_0x677a37);_0x12d52f(_0x677a37);});});}exports[_0x7a92('0x18')]=function(_0x187706){var _0x58d868=this;return new Promise(function(_0x36afe4,_0x215a93){return db[_0x7a92('0x19')]['find']({'raw':_0x187706['options']?_0x187706[_0x7a92('0x1a')][_0x7a92('0x1b')]===undefined?!![]:![]:!![],'where':_0x187706[_0x7a92('0x1a')]?_0x187706[_0x7a92('0x1a')][_0x7a92('0x1c')]||null:null,'attributes':_0x187706[_0x7a92('0x1a')]?_0x187706[_0x7a92('0x1a')][_0x7a92('0x1d')]||null:null,'include':_0x187706[_0x7a92('0x1a')]?_0x187706[_0x7a92('0x1a')]['include']?_['map'](_0x187706[_0x7a92('0x1a')][_0x7a92('0x1e')],function(_0x4b7069){return{'model':db[_0x4b7069['model']],'as':_0x4b7069['as'],'attributes':_0x4b7069[_0x7a92('0x1d')],'include':_0x4b7069[_0x7a92('0x1e')]?_[_0x7a92('0x1f')](_0x4b7069[_0x7a92('0x1e')],function(_0x26d739){return{'model':db[_0x26d739['model']],'as':_0x26d739['as'],'attributes':_0x26d739[_0x7a92('0x1d')],'include':_0x26d739['include']?_[_0x7a92('0x1f')](_0x26d739[_0x7a92('0x1e')],function(_0x36c3c5){return{'model':db[_0x36c3c5[_0x7a92('0x20')]],'as':_0x36c3c5['as'],'attributes':_0x36c3c5[_0x7a92('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7a92('0xd')](function(_0x5b4e02){logger[_0x7a92('0x15')](_0x7a92('0x18'),_0x187706);logger['debug']('ShowSetting',_0x187706,JSON['stringify'](_0x5b4e02));_0x36afe4(_0x5b4e02);})[_0x7a92('0x17')](function(_0x22fcd7){logger[_0x7a92('0x12')](_0x7a92('0x18'),_0x22fcd7[_0x7a92('0x14')],_0x187706);_0x215a93(_0x58d868[_0x7a92('0x12')](0x1f4,_0x22fcd7[_0x7a92('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 65b6164..da3fa9d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x326f,0xd1));var _0xf326=function(_0x46cc3b,_0x5317c5){_0x46cc3b=_0x46cc3b-0x0;var _0x23af92=_0x326f[_0x46cc3b];return _0x23af92;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x37e784,_0x15fcc3){var _0x11a38a=function(_0x5c44e6){while(--_0x5c44e6){_0x37e784['push'](_0x37e784['shift']());}};_0x11a38a(++_0x15fcc3);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3be2a0,_0x30d5af){_0x3be2a0=_0x3be2a0-0x0;var _0x130828=_0x7fbe[_0x3be2a0];return _0x130828;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index f0e992e..4e7311e 100644 --- a/server/api/smsAccount/smsAccount.attributes.js +++ b/server/api/smsAccount/smsAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce4c=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x4b467a,_0x561eca){var _0x227662=function(_0x4329a1){while(--_0x4329a1){_0x4b467a['push'](_0x4b467a['shift']());}};_0x227662(++_0x561eca);}(_0xce4c,0x18b));var _0xcce4=function(_0x3027fd,_0x32c20c){_0x3027fd=_0x3027fd-0x0;var _0x3b3387=_0xce4c[_0x3027fd];return _0x3b3387;};'use strict';var Sequelize=require(_0xcce4('0x0'));var rs=require(_0xcce4('0x1'));module[_0xcce4('0x2')]={'name':{'type':Sequelize[_0xcce4('0x3')],'unique':_0xcce4('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcce4('0x5')]();}},'phone':{'type':Sequelize[_0xcce4('0x3')]},'type':{'type':Sequelize[_0xcce4('0x6')](_0xcce4('0x7'),'skebby',_0xcce4('0x8'),_0xcce4('0x9'),'plivo',_0xcce4('0xa'),_0xcce4('0xb'),_0xcce4('0xc'),_0xcce4('0xd'),_0xcce4('0xe'))},'accountSid':{'type':Sequelize[_0xcce4('0x3')]},'authId':{'type':Sequelize[_0xcce4('0x3')]},'authToken':{'type':Sequelize[_0xcce4('0x3')]},'smsMethod':{'type':Sequelize[_0xcce4('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcce4('0x3')]},'password':{'type':Sequelize[_0xcce4('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xcce4('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xcce4('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcce4('0x10')],'defaultValue':function(){return _0xcce4('0x11');}},'notificationSound':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcce4('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcce4('0x12')],'comment':_0xcce4('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xcce4('0xf')],'defaultValue':![],'comment':_0xcce4('0x14'),'set':function(_0x1c039b){if(!_0x1c039b)this[_0xcce4('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcce4('0x16'),_0x1c039b);}}}; \ No newline at end of file +var _0x1500=['plivo','csc','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend'];(function(_0xc3d91f,_0x1fd22a){var _0x34c458=function(_0x330a72){while(--_0x330a72){_0xc3d91f['push'](_0xc3d91f['shift']());}};_0x34c458(++_0x1fd22a);}(_0x1500,0xb4));var _0x0150=function(_0x177271,_0x44a708){_0x177271=_0x177271-0x0;var _0x271038=_0x1500[_0x177271];return _0x271038;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0150('0x0'));module[_0x0150('0x1')]={'name':{'type':Sequelize[_0x0150('0x2')],'unique':_0x0150('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x0150('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0150('0x4')]();}},'phone':{'type':Sequelize[_0x0150('0x2')]},'type':{'type':Sequelize[_0x0150('0x5')](_0x0150('0x6'),_0x0150('0x7'),_0x0150('0x8'),_0x0150('0x9'),_0x0150('0xa'),'clickatell','bandwidth',_0x0150('0xb'),'infobip','intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0150('0x2')]},'authToken':{'type':Sequelize[_0x0150('0x2')]},'smsMethod':{'type':Sequelize[_0x0150('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0150('0x2')]},'password':{'type':Sequelize[_0x0150('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x0150('0x2')]},'accountId':{'type':Sequelize[_0x0150('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x0150('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0150('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0150('0xd')],'defaultValue':function(){return _0x0150('0xe');}},'notificationSound':{'type':Sequelize[_0x0150('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0150('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0150('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0150('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0150('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0150('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0150('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0150('0xc')],'defaultValue':![],'comment':_0x0150('0x10'),'set':function(_0x15541c){if(!_0x15541c)this[_0x0150('0x11')](_0x0150('0x12'),null);this[_0x0150('0x11')]('mandatoryDisposition',_0x15541c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 17be1e4..6485c25 100644 --- a/server/api/smsAccount/smsAccount.controller.js +++ b/server/api/smsAccount/smsAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8754=['messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','CmList','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','intelepeer','redif','DELIVERED','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','map','SmsAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From'];(function(_0x829914,_0x8e6ba){var _0x4a1250=function(_0x3c048c){while(--_0x3c048c){_0x829914['push'](_0x829914['shift']());}};_0x4a1250(++_0x8e6ba);}(_0x8754,0x69));var _0x4875=function(_0x20ef5b,_0x592331){_0x20ef5b=_0x20ef5b-0x0;var _0x177ef1=_0x8754[_0x20ef5b];return _0x177ef1;};'use strict';var emlformat=require(_0x4875('0x0'));var rimraf=require(_0x4875('0x1'));var zipdir=require(_0x4875('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4875('0x3'));var moment=require(_0x4875('0x4'));var BPromise=require(_0x4875('0x5'));var Mustache=require(_0x4875('0x6'));var util=require(_0x4875('0x7'));var path=require(_0x4875('0x8'));var sox=require(_0x4875('0x9'));var csv=require(_0x4875('0xa'));var ejs=require(_0x4875('0xb'));var fs=require('fs');var fs_extra=require(_0x4875('0xc'));var _=require(_0x4875('0xd'));var squel=require('squel');var crypto=require(_0x4875('0xe'));var jsforce=require(_0x4875('0xf'));var deskjs=require(_0x4875('0x10'));var toCsv=require(_0x4875('0xa'));var querystring=require(_0x4875('0x11'));var Papa=require(_0x4875('0x12'));var Redis=require(_0x4875('0x13'));var authService=require(_0x4875('0x14'));var qs=require(_0x4875('0x15'));var as=require(_0x4875('0x16'));var hardwareService=require(_0x4875('0x17'));var logger=require(_0x4875('0x18'))(_0x4875('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4875('0x1a'));var db=require(_0x4875('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4875('0x1c'),'port':0x18eb});var socket=require(_0x4875('0x1d'))(new Redis(config[_0x4875('0x1e')]));require(_0x4875('0x1f'))[_0x4875('0x20')](socket);var jayson=require(_0x4875('0x21'));var client=jayson[_0x4875('0x22')][_0x4875('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4e6246,_0x229733,_0x57bd89,_0x2fd8b4){return new BPromise(function(_0xf73750,_0x299c88){var _0x210efb=_0x2fd8b4||client;return _0x210efb[_0x4875('0x24')](_0x4e6246,_0x57bd89)[_0x4875('0x25')](function(_0x3c6288){logger['info'](_0x4875('0x26'),_0x229733,_0x4875('0x27'));logger['debug'](_0x4875('0x28'),_0x229733,_0x4875('0x27'),JSON[_0x4875('0x29')](_0x3c6288));if(_0x3c6288[_0x4875('0x2a')]){if(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2b')]===0x1f4){logger[_0x4875('0x2a')](_0x4875('0x26'),_0x229733,_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);return _0x299c88(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);}logger[_0x4875('0x2a')](_0x4875('0x26'),_0x229733,_0x3c6288[_0x4875('0x2a')]['message']);return _0xf73750(_0x3c6288[_0x4875('0x2a')][_0x4875('0x2c')]);}else{logger[_0x4875('0x2d')](_0x4875('0x26'),_0x229733,_0x4875('0x27'));_0xf73750(_0x3c6288[_0x4875('0x2e')]['message']);}})['catch'](function(_0x45978e){logger[_0x4875('0x2a')]('SmsAccount,\x20%s,\x20%s',_0x229733,_0x45978e);_0x299c88(_0x45978e);});});}function respondWithStatusCode(_0x237aaa,_0x466a19){_0x466a19=_0x466a19||0xcc;return function(_0x2ca5b4){if(_0x2ca5b4){return _0x237aaa['sendStatus'](_0x466a19);}return _0x237aaa[_0x4875('0x2f')](_0x466a19)[_0x4875('0x30')]();};}function respondWithResult(_0xb5836c,_0x1897c6){_0x1897c6=_0x1897c6||0xc8;return function(_0x53de0c){if(_0x53de0c){return _0xb5836c[_0x4875('0x2f')](_0x1897c6)[_0x4875('0x31')](_0x53de0c);}};}function respondWithFilteredResult(_0x5940dd,_0x4a3c53){return function(_0x50a12f){if(_0x50a12f){var _0x31856a=typeof _0x4a3c53[_0x4875('0x32')]===_0x4875('0x33')&&typeof _0x4a3c53['limit']===_0x4875('0x33');var _0x6fb23a=_0x50a12f[_0x4875('0x34')];var _0x59b1b8=_0x31856a?0x0:_0x4a3c53[_0x4875('0x32')];var _0x30abfe=_0x31856a?_0x50a12f[_0x4875('0x34')]:_0x4a3c53[_0x4875('0x32')]+_0x4a3c53[_0x4875('0x35')];var _0x1c08ce;if(_0x30abfe>=_0x6fb23a){_0x30abfe=_0x6fb23a;_0x1c08ce=0xc8;}else{_0x1c08ce=0xce;}_0x5940dd[_0x4875('0x2f')](_0x1c08ce);return _0x5940dd[_0x4875('0x36')](_0x4875('0x37'),_0x59b1b8+'-'+_0x30abfe+'/'+_0x6fb23a)['json'](_0x50a12f);}return null;};}function patchUpdates(_0x41edef){return function(_0x2d9920){try{jsonpatch[_0x4875('0x38')](_0x2d9920,_0x41edef,!![]);}catch(_0x2a6458){return BPromise[_0x4875('0x39')](_0x2a6458);}return _0x2d9920[_0x4875('0x3a')]();};}function saveUpdates(_0x37f953,_0x2f6e56){return function(_0x5b44d4){if(_0x5b44d4){return _0x5b44d4['update'](_0x37f953)['then'](function(_0x2dbffb){return _0x2dbffb;});}return null;};}function removeEntity(_0x296599,_0x3303e5){return function(_0x92fc41){if(_0x92fc41){return _0x92fc41['destroy']()[_0x4875('0x25')](function(){var _0x5eb408=_0x92fc41['get']({'plain':!![]});var _0x41142d=_0x4875('0x3b');return db[_0x4875('0x3c')][_0x4875('0x3d')]({'where':{'type':_0x41142d,'resourceId':_0x5eb408['id']}})[_0x4875('0x25')](function(){return _0x92fc41;});})[_0x4875('0x25')](function(){_0x296599['status'](0xcc)[_0x4875('0x30')]();});}};}function handleEntityNotFound(_0x3a29a2,_0x8fb446){return function(_0xb47ac2){if(!_0xb47ac2){_0x3a29a2[_0x4875('0x3e')](0x194);}return _0xb47ac2;};}function handleError(_0xb5ed70,_0xdccf9f){_0xdccf9f=_0xdccf9f||0x1f4;return function(_0x1cfe29){logger['error'](_0x1cfe29[_0x4875('0x3f')]);if(_0x1cfe29[_0x4875('0x40')]){delete _0x1cfe29['name'];}_0xb5ed70[_0x4875('0x2f')](_0xdccf9f)['send'](_0x1cfe29);};}exports['index']=function(_0x20a88d,_0x57f4b2){var _0x3eeaa7={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x198aa3={},_0x38ab62={'count':0x0,'rows':[]};var _0xb60f51=_[_0x4875('0x41')](db[_0x4875('0x42')][_0x4875('0x43')],function(_0x5a0367){return{'name':_0x5a0367[_0x4875('0x44')],'type':_0x5a0367['type'][_0x4875('0x45')]};});_0x198aa3['model']=_[_0x4875('0x41')](_0xb60f51,_0x4875('0x40'));_0x198aa3[_0x4875('0x46')]=_[_0x4875('0x47')](_0x20a88d['query']);_0x198aa3['filters']=_[_0x4875('0x48')](_0x198aa3[_0x4875('0x49')],_0x198aa3[_0x4875('0x46')]);_0x3eeaa7[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x198aa3[_0x4875('0x49')],qs['fields'](_0x20a88d['query'][_0x4875('0x4b')]));_0x3eeaa7['attributes']=_0x3eeaa7['attributes'][_0x4875('0x4c')]?_0x3eeaa7[_0x4875('0x4a')]:_0x198aa3[_0x4875('0x49')];if(!_0x20a88d['query'][_0x4875('0x4d')](_0x4875('0x4e'))){_0x3eeaa7[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x20a88d['query']['limit']);_0x3eeaa7[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x20a88d['query']['offset']);}_0x3eeaa7[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x20a88d[_0x4875('0x46')][_0x4875('0x50')]);_0x3eeaa7[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x20a88d[_0x4875('0x46')],_0x198aa3[_0x4875('0x52')]),_0xb60f51);if(_0x20a88d[_0x4875('0x46')][_0x4875('0x54')]){_0x3eeaa7[_0x4875('0x51')]=_[_0x4875('0x55')](_0x3eeaa7['where'],{'$or':_['map'](_0xb60f51,function(_0x45107d){if(_0x45107d[_0x4875('0x56')]!==_0x4875('0x57')){var _0x36709d={};_0x36709d[_0x45107d[_0x4875('0x40')]]={'$like':'%'+_0x20a88d['query']['filter']+'%'};return _0x36709d;}})});}_0x3eeaa7=_['merge']({},_0x3eeaa7,_0x20a88d['options']);var _0x443684={'where':_0x3eeaa7[_0x4875('0x51')]};return db[_0x4875('0x42')][_0x4875('0x34')](_0x443684)[_0x4875('0x25')](function(_0x1d81a1){_0x38ab62['count']=_0x1d81a1;if(_0x20a88d[_0x4875('0x46')]['includeAll']){_0x3eeaa7[_0x4875('0x58')]=[{'all':!![]}];}return db[_0x4875('0x42')][_0x4875('0x59')](_0x3eeaa7);})[_0x4875('0x25')](function(_0x42e21b){_0x38ab62[_0x4875('0x5a')]=_0x42e21b;return _0x38ab62;})[_0x4875('0x25')](respondWithFilteredResult(_0x57f4b2,_0x3eeaa7))['catch'](handleError(_0x57f4b2,null));};exports[_0x4875('0x5b')]=function(_0x91aba6,_0x14679c){var _0x300adb={'raw':![],'where':{'id':_0x91aba6[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x5d')],'as':_0x4875('0x5e')}]},_0x3e806d={};_0x3e806d[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0x42')][_0x4875('0x43')]);_0x3e806d['query']=_[_0x4875('0x47')](_0x91aba6[_0x4875('0x46')]);_0x3e806d['filters']=_[_0x4875('0x48')](_0x3e806d[_0x4875('0x49')],_0x3e806d[_0x4875('0x46')]);_0x300adb[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x3e806d[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x91aba6[_0x4875('0x46')][_0x4875('0x4b')]));_0x300adb[_0x4875('0x4a')]=_0x300adb['attributes'][_0x4875('0x4c')]?_0x300adb[_0x4875('0x4a')]:_0x3e806d[_0x4875('0x49')];if(_0x91aba6[_0x4875('0x46')][_0x4875('0x5f')]){_0x300adb['include']=[{'all':!![]}];}_0x300adb=_[_0x4875('0x55')]({},_0x300adb,_0x91aba6[_0x4875('0x60')]);return db[_0x4875('0x42')][_0x4875('0x61')](_0x300adb)[_0x4875('0x25')](handleEntityNotFound(_0x14679c,null))[_0x4875('0x25')](respondWithResult(_0x14679c,null))['catch'](handleError(_0x14679c,null));};exports[_0x4875('0x62')]=function(_0x49d519,_0x5c58ad){return db[_0x4875('0x42')][_0x4875('0x62')](_0x49d519[_0x4875('0x63')],{})['then'](function(_0x2f21d7){var _0x619464=_0x49d519[_0x4875('0x64')][_0x4875('0x65')]({'plain':!![]});if(!_0x619464)throw new Error(_0x4875('0x66'));if(_0x619464['role']===_0x4875('0x64')){var _0x29ade6=_0x2f21d7['get']({'plain':!![]});var _0x1f065f=_0x4875('0x3b');return db[_0x4875('0x67')][_0x4875('0x61')]({'where':{'name':_0x1f065f,'userProfileId':_0x619464[_0x4875('0x68')]},'raw':!![]})['then'](function(_0x5a2ff3){if(_0x5a2ff3&&_0x5a2ff3[_0x4875('0x69')]===0x0){return db['UserProfileResource'][_0x4875('0x62')]({'name':_0x29ade6[_0x4875('0x40')],'resourceId':_0x29ade6['id'],'type':_0x5a2ff3[_0x4875('0x40')],'sectionId':_0x5a2ff3['id']},{})[_0x4875('0x25')](function(){return _0x2f21d7;});}else{return _0x2f21d7;}})[_0x4875('0x6a')](function(_0x48fdf3){logger[_0x4875('0x2a')](_0x4875('0x6b'),_0x48fdf3);throw _0x48fdf3;});}return _0x2f21d7;})[_0x4875('0x25')](respondWithResult(_0x5c58ad,0xc9))[_0x4875('0x6a')](handleError(_0x5c58ad,null));};exports[_0x4875('0x6c')]=function(_0x169340,_0x4d5abd){if(_0x169340[_0x4875('0x63')]['id']){delete _0x169340[_0x4875('0x63')]['id'];}return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x169340[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x5d')],'as':_0x4875('0x5e')}]})[_0x4875('0x25')](handleEntityNotFound(_0x4d5abd,null))[_0x4875('0x25')](saveUpdates(_0x169340[_0x4875('0x63')],null))['then'](respondWithResult(_0x4d5abd,null))[_0x4875('0x6a')](handleError(_0x4d5abd,null));};exports[_0x4875('0x3d')]=function(_0x55dfb7,_0x34f110){return db[_0x4875('0x42')]['find']({'where':{'id':_0x55dfb7[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x34f110,null))['then'](removeEntity(_0x34f110,null))[_0x4875('0x6a')](handleError(_0x34f110,null));};exports[_0x4875('0x6d')]=function(_0x2104bf,_0x5daea6){return db[_0x4875('0x42')][_0x4875('0x6d')]()[_0x4875('0x25')](respondWithResult(_0x5daea6,null))[_0x4875('0x6a')](handleError(_0x5daea6,null));};exports[_0x4875('0x6e')]=function(_0x4535f5,_0x34c953,_0x450ea6){if(_0x4535f5['body']['id']){delete _0x4535f5[_0x4875('0x63')]['id'];}return db['SmsAccount'][_0x4875('0x61')]({'where':{'id':_0x4535f5[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x34c953,null))[_0x4875('0x25')](function(_0x4c2029){if(_0x4c2029){_0x4535f5[_0x4875('0x63')][_0x4875('0x6f')]=_0x4c2029['id'];return db[_0x4875('0x70')][_0x4875('0x62')](_0x4535f5['body']);}})[_0x4875('0x25')](respondWithResult(_0x34c953,null))['catch'](handleError(_0x34c953,null));};exports['getDispositions']=function(_0x29ae83,_0x2ace01,_0x482718){var _0x24000f={'raw':![],'where':{}};var _0x3b8227={};var _0x4ff847={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4875('0x71')]({'where':{'id':_0x29ae83[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2ace01,null))[_0x4875('0x25')](function(_0x2aae31){if(_0x2aae31){_0x3b8227[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0x70')][_0x4875('0x43')]);_0x3b8227[_0x4875('0x46')]=_[_0x4875('0x47')](_0x29ae83[_0x4875('0x46')]);_0x3b8227[_0x4875('0x52')]=_[_0x4875('0x48')](_0x3b8227[_0x4875('0x49')],_0x3b8227['query']);_0x24000f[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x3b8227['model'],qs[_0x4875('0x4b')](_0x29ae83[_0x4875('0x46')][_0x4875('0x4b')]));_0x24000f['attributes']=_0x24000f[_0x4875('0x4a')][_0x4875('0x4c')]?_0x24000f[_0x4875('0x4a')]:_0x3b8227[_0x4875('0x49')];if(!_0x29ae83['query'][_0x4875('0x4d')]('nolimit')){_0x24000f[_0x4875('0x35')]=qs['limit'](_0x29ae83[_0x4875('0x46')][_0x4875('0x35')]);_0x24000f[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x29ae83['query'][_0x4875('0x32')]);}_0x24000f[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x29ae83['query'][_0x4875('0x50')]);_0x24000f[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x29ae83[_0x4875('0x46')],_0x3b8227[_0x4875('0x52')]));_0x24000f[_0x4875('0x51')]['SmsAccountId']=_0x2aae31['id'];if(_0x29ae83[_0x4875('0x46')][_0x4875('0x54')]){_0x24000f[_0x4875('0x51')]=_[_0x4875('0x55')](_0x24000f[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x24000f[_0x4875('0x4a')],function(_0x3c1abf){var _0x2b4a84={};_0x2b4a84[_0x3c1abf]={'$like':'%'+_0x29ae83[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x2b4a84;})});}_0x24000f=_['merge']({},_0x24000f,_0x29ae83[_0x4875('0x60')]);return db[_0x4875('0x70')][_0x4875('0x34')]({'where':_0x24000f['where']})[_0x4875('0x25')](function(_0x3c3807){_0x4ff847[_0x4875('0x34')]=_0x3c3807;if(_0x29ae83[_0x4875('0x46')]['includeAll']){_0x24000f[_0x4875('0x58')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x24000f);})['then'](function(_0x4b68c4){_0x4ff847[_0x4875('0x5a')]=_0x4b68c4;return _0x4ff847;});}})[_0x4875('0x25')](respondWithFilteredResult(_0x2ace01,_0x24000f))['catch'](handleError(_0x2ace01,null));};exports[_0x4875('0x72')]=function(_0x2e50ba,_0x20194f,_0x59f507){return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x2e50ba[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x20194f,null))[_0x4875('0x25')](function(_0x4f9189){if(_0x4f9189){return _0x4f9189[_0x4875('0x72')](_0x2e50ba[_0x4875('0x46')][_0x4875('0x73')]);}})[_0x4875('0x25')](respondWithStatusCode(_0x20194f,null))[_0x4875('0x6a')](handleError(_0x20194f,null));};exports[_0x4875('0x74')]=function(_0x50fd19,_0x1b53cd,_0x3baadf){if(_0x50fd19['body']['id']){delete _0x50fd19[_0x4875('0x63')]['id'];}return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x50fd19['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x1b53cd,null))[_0x4875('0x25')](function(_0x3e3f53){if(_0x3e3f53){_0x50fd19[_0x4875('0x63')][_0x4875('0x6f')]=_0x3e3f53['id'];return db['CannedAnswer'][_0x4875('0x62')](_0x50fd19[_0x4875('0x63')]);}})[_0x4875('0x25')](respondWithResult(_0x1b53cd,null))[_0x4875('0x6a')](handleError(_0x1b53cd,null));};exports['getAnswers']=function(_0x2b1a09,_0x54c0f5,_0x16df1a){var _0x1a1b58={'raw':![],'where':{}};var _0x1f0220={};var _0x42c683={'count':0x0,'rows':[]};return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x2b1a09['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x54c0f5,null))[_0x4875('0x25')](function(_0xcd9d9f){if(_0xcd9d9f){_0x1f0220['model']=_[_0x4875('0x47')](db['CannedAnswer'][_0x4875('0x43')]);_0x1f0220[_0x4875('0x46')]=_[_0x4875('0x47')](_0x2b1a09[_0x4875('0x46')]);_0x1f0220[_0x4875('0x52')]=_['intersection'](_0x1f0220[_0x4875('0x49')],_0x1f0220[_0x4875('0x46')]);_0x1a1b58[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x1f0220['model'],qs[_0x4875('0x4b')](_0x2b1a09[_0x4875('0x46')]['fields']));_0x1a1b58['attributes']=_0x1a1b58[_0x4875('0x4a')][_0x4875('0x4c')]?_0x1a1b58[_0x4875('0x4a')]:_0x1f0220[_0x4875('0x49')];if(!_0x2b1a09['query'][_0x4875('0x4d')](_0x4875('0x4e'))){_0x1a1b58[_0x4875('0x35')]=qs['limit'](_0x2b1a09['query'][_0x4875('0x35')]);_0x1a1b58[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x2b1a09[_0x4875('0x46')][_0x4875('0x32')]);}_0x1a1b58[_0x4875('0x4f')]=qs['sort'](_0x2b1a09[_0x4875('0x46')][_0x4875('0x50')]);_0x1a1b58[_0x4875('0x51')]=qs[_0x4875('0x52')](_['pick'](_0x2b1a09['query'],_0x1f0220[_0x4875('0x52')]));_0x1a1b58['where'][_0x4875('0x6f')]=_0xcd9d9f['id'];if(_0x2b1a09[_0x4875('0x46')]['filter']){_0x1a1b58['where']=_[_0x4875('0x55')](_0x1a1b58[_0x4875('0x51')],{'$or':_['map'](_0x1a1b58[_0x4875('0x4a')],function(_0x204bb3){var _0x4bdda9={};_0x4bdda9[_0x204bb3]={'$like':'%'+_0x2b1a09['query'][_0x4875('0x54')]+'%'};return _0x4bdda9;})});}_0x1a1b58=_['merge']({},_0x1a1b58,_0x2b1a09[_0x4875('0x60')]);return db[_0x4875('0x75')]['count']({'where':_0x1a1b58[_0x4875('0x51')]})[_0x4875('0x25')](function(_0xa3d687){_0x42c683[_0x4875('0x34')]=_0xa3d687;if(_0x2b1a09[_0x4875('0x46')][_0x4875('0x5f')]){_0x1a1b58[_0x4875('0x58')]=[{'all':!![]}];}return db[_0x4875('0x75')]['findAll'](_0x1a1b58);})[_0x4875('0x25')](function(_0x213474){_0x42c683[_0x4875('0x5a')]=_0x213474;return _0x42c683;});}})['then'](respondWithFilteredResult(_0x54c0f5,_0x1a1b58))['catch'](handleError(_0x54c0f5,null));};exports['removeAnswers']=function(_0x4399fb,_0x5a1aba,_0x56c744){return db['SmsAccount'][_0x4875('0x61')]({'where':{'id':_0x4399fb[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5a1aba,null))[_0x4875('0x25')](function(_0x5888e9){if(_0x5888e9){return _0x5888e9[_0x4875('0x76')](_0x4399fb[_0x4875('0x46')][_0x4875('0x73')]);}})[_0x4875('0x25')](respondWithStatusCode(_0x5a1aba,null))[_0x4875('0x6a')](handleError(_0x5a1aba,null));};exports[_0x4875('0x77')]=function(_0x4269cc,_0x2ff06d,_0x305d3f){var _0x41b0bb={'channel':_0x4875('0x78')};var _0x459af5=[];var _0x37a6fa=[];var _0x35f2d1={};return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x4269cc[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0x79')],'as':_0x4875('0x7a')}]})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))[_0x4875('0x25')](function(_0x41c8c5){_0x41b0bb[_0x4875('0x7b')]=_0x41c8c5;_0x41b0bb['applications']=_[_0x4875('0x7c')](_0x41c8c5[_0x4875('0x7a')],[_0x4875('0x7d')],[_0x4875('0x7e')]);if(_0x41b0bb[_0x4875('0x7b')]['Applications']){delete _0x41b0bb[_0x4875('0x7b')][_0x4875('0x7a')];}return db[_0x4875('0x7f')][_0x4875('0x6d')]();})[_0x4875('0x25')](function(_0x15f8e4){if(!_0x15f8e4){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0x82'));}_0x459af5=_[_0x4875('0x83')](_['keys'](_0x15f8e4),[_0x4875('0x84'),_0x4875('0x85')]);_0x37a6fa=_[_0x4875('0x83')](_[_0x4875('0x47')](_0x15f8e4),[_0x4875('0x84'),_0x4875('0x85'),_0x4875('0x86'),_0x4875('0x87')]);_0x41b0bb[_0x4875('0x63')]={'mapKey':_0x4875('0x88')};if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]){switch(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]){case'twilio':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x8a')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')]['Body'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x8b')]=_0x4269cc['body'][_0x4875('0x8c')];break;case'skebby':_0x41b0bb['body'][_0x4875('0x89')]='+'+_0x4269cc[_0x4875('0x63')][_0x4875('0x8d')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body']['text'];break;case _0x4875('0x8e'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc['body']['from'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body'][_0x4875('0x2c')];break;case _0x4875('0x8f'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc[_0x4875('0x63')][_0x4875('0x89')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')]['body'];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc['body'][_0x4875('0x90')];break;case _0x4875('0x91'):_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')]['From'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x92')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x93')];break;case _0x4875('0x94'):_0x41b0bb[_0x4875('0x63')]['from']='+'+_0x4269cc[_0x4875('0x63')][_0x4875('0x95')][0x0][_0x4875('0x89')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc['body'][_0x4875('0x95')][0x0][_0x4875('0x96')];_0x41b0bb['body'][_0x4875('0x8b')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x95')][0x0][_0x4875('0x8b')];break;case _0x4875('0x97'):_0x41b0bb['body']['from']=_0x4269cc[_0x4875('0x63')][_0x4875('0x98')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x99')][_0x4875('0x2c')];break;case _0x4875('0x9a'):_0x41b0bb[_0x4875('0x63')]['from']=_0x4269cc['body'][_0x4875('0x9b')];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x96')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x9c')];break;case _0x4875('0x9d'):_0x41b0bb['body'][_0x4875('0x8b')]=_0x4269cc[_0x4875('0x63')][0x0]['message']['id'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc[_0x4875('0x63')][0x0][_0x4875('0x2c')]['from'];_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][0x0]['message'][_0x4875('0x96')];break;case'intelepeer':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')]=_0x4269cc['body'][_0x4875('0x89')];_0x41b0bb['body'][_0x4875('0x63')]=_0x4269cc[_0x4875('0x63')][_0x4875('0x2c')];_0x41b0bb[_0x4875('0x63')]['messageId']=_0x4269cc[_0x4875('0x63')][_0x4875('0x9e')];break;}}if(_0x41b0bb[_0x4875('0x63')]['id']){delete _0x41b0bb[_0x4875('0x63')]['id'];}if(_['isNil'](_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0x9f'));}if(_['isNil'](_0x41b0bb['body']['body'])||_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')]===''){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0xa0'));}if(_[_0x4875('0xa1')](_0x41b0bb[_0x4875('0x63')]['mapKey'])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))](_0x4875('0xa2')+_0x37a6fa);}if(!_[_0x4875('0xa3')](_0x37a6fa,_0x41b0bb['body'][_0x4875('0xa4')])){throw new db['Sequelize'][(_0x4875('0x81'))](_0x4875('0xa5')+_0x37a6fa);}_0x35f2d1[_0x41b0bb[_0x4875('0x63')][_0x4875('0xa4')]]=_0x41b0bb['body'][_0x4875('0x89')];return db['CmList'][_0x4875('0x61')]({'where':{'id':_0x41b0bb[_0x4875('0x7b')][_0x4875('0x87')]},'include':[{'model':db['CmContact'],'as':_0x4875('0xa6'),'where':_0x35f2d1,'limit':0x1,'order':[['updatedAt',_0x4875('0xa7')]]}]});})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))[_0x4875('0x25')](function(_0x47fe09){if(_0x47fe09){_0x41b0bb['list']=_[_0x4875('0xa8')](_0x47fe09,[_0x4875('0xa6')]);if(_0x47fe09[_0x4875('0xa6')][_0x4875('0x4c')]){return _0x47fe09[_0x4875('0xa6')][0x0];}var _0x2c4ed9=_[_0x4875('0xa9')](_0x41b0bb[_0x4875('0x63')],{'firstName':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'ListId':_0x47fe09['id']});_0x2c4ed9[_0x41b0bb[_0x4875('0x63')][_0x4875('0xa4')]]=_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')];return db[_0x4875('0x7f')]['create'](_0x2c4ed9,{'fields':_0x459af5,'raw':!![]});}})[_0x4875('0x25')](handleEntityNotFound(_0x2ff06d,null))['then'](function(_0x3c7e4a){if(_0x3c7e4a){_0x41b0bb[_0x4875('0xaa')]=_0x3c7e4a;var _0x5c0ed1={'ContactId':_0x3c7e4a['id'],'phone':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id']};var _0x1275d6={'ContactId':_0x3c7e4a['id'],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id'],'closed':![]};return db[_0x4875('0xab')][_0x4875('0x61')]({'where':_0x1275d6})[_0x4875('0x25')](function(_0x191a56){if(_0x191a56){return[_0x191a56,![]];}return db[_0x4875('0xab')][_0x4875('0x62')](_0x5c0ed1)['then'](function(_0x1f8010){return[_0x1f8010,!![]];});});}})['spread'](function(_0x131301,_0xc7eb55){_0x41b0bb[_0x4875('0xac')]=_0x131301[_0x4875('0x65')]({'plain':!![]});_0x41b0bb[_0x4875('0xac')][_0x4875('0xad')]=![];if(_0xc7eb55){if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0xae')]){_0x41b0bb[_0x4875('0xaf')][_0x4875('0xb0')]({'id':0x0,'priority':_0x41b0bb['applications'][_0x4875('0x4c')]+0x1,'app':_0x4875('0xb1'),'appdata':_0x4875('0xb2'),'interval':_0x4875('0xb3')});}_0x41b0bb[_0x4875('0xac')][_0x4875('0xad')]=!![];}return db[_0x4875('0xb4')][_0x4875('0x62')]({'phone':_0x41b0bb[_0x4875('0x63')][_0x4875('0x89')],'messageId':_0x41b0bb[_0x4875('0x63')][_0x4875('0x8b')],'body':_0x41b0bb[_0x4875('0x63')][_0x4875('0x63')],'SmsAccountId':_0x4269cc[_0x4875('0x5c')]['id'],'SmsInteractionId':_0x131301['id'],'direction':'in','ContactId':_0x131301[_0x4875('0xb5')],'AttachmentId':_0x41b0bb['body'][_0x4875('0xb6')]});})[_0x4875('0x25')](function(_0x5ef2fc){_0x41b0bb[_0x4875('0x2c')]=_0x5ef2fc;if(_0x41b0bb[_0x4875('0xac')][_0x4875('0xb7')]){return db[_0x4875('0xb8')]['find']({'attributes':['id',_0x4875('0x40')],'where':{'id':_0x41b0bb[_0x4875('0xac')][_0x4875('0xb7')]}})['then'](function(_0x16c290){if(_0x16c290){_0x41b0bb[_0x4875('0xaf')][_0x4875('0xb9')]({'id':0x0,'priority':0x0,'app':_0x4875('0xba'),'appdata':_0x16c290['name']+','+(_0x41b0bb['account'][_0x4875('0xbb')]||0xa),'interval':_0x4875('0xb3')});}return respondWithRpcPromise('Start',_0x4875('0xbc'),_0x41b0bb);});}return respondWithRpcPromise(_0x4875('0xbd'),'startRouting',_0x41b0bb);})[_0x4875('0x25')](function(_0x4cbe6b){if(_0x4cbe6b){var _0x53885b=0xc8;var _0x2c62d8=_0x4875('0xbe');logger[_0x4875('0x2d')](_0x4875('0x28'),_0x2c62d8,_0x53885b,_0x4875('0xbf'));logger[_0x4875('0xc0')](_0x4875('0xc1'),_0x2c62d8,_0x53885b,_0x4875('0xbf'),JSON[_0x4875('0x29')](_0x4cbe6b));if(_0x41b0bb[_0x4875('0x7b')][_0x4875('0x56')]===_0x4875('0xc2')){return _0x2ff06d[_0x4875('0x2f')](_0x53885b)[_0x4875('0x36')](_0x4875('0xc3'),_0x4875('0xc4'))[_0x4875('0xc5')](_0x4875('0xc6'));}else{return _0x2ff06d['status'](_0x53885b)[_0x4875('0x31')](_0x4cbe6b);}}})[_0x4875('0x6a')](handleError(_0x2ff06d,null));};exports[_0x4875('0xc7')]=function(_0xb87e06,_0x409834){var _0x27e186=_0xb87e06[_0x4875('0x5c')]['id'];var _0x40e4c0=_0xb87e06[_0x4875('0x63')];var _0x2999b5=0xc8;var _0x4b0788=null;return db['sequelize'][_0x4875('0xc8')]({'isolationLevel':db['sequelize']['Transaction'][_0x4875('0xc9')][_0x4875('0xca')]},function(_0x13ce68){return db['SmsAccount'][_0x4875('0x71')]({'where':{'id':_0x27e186},'transaction':_0x13ce68})[_0x4875('0x25')](function(_0x32ac2b){if(_0x32ac2b){return db[_0x4875('0x79')][_0x4875('0x3d')]({'where':{'SmsAccountId':_0x27e186},'transaction':_0x13ce68})[_0x4875('0x25')](function(){var _0x193244=_[_0x4875('0x41')](_0x40e4c0,function(_0x880793){_0x880793[_0x4875('0x6f')]=_0x27e186;return _0x880793;});return db['SmsApplication']['bulkCreate'](_0x193244,{'transaction':_0x13ce68});});}else{_0x2999b5=0x194;_0x4b0788=[];}});})[_0x4875('0x25')](function(){if(_0x2999b5!==0x194){return db[_0x4875('0x79')][_0x4875('0xcb')]({'where':{'SmsAccountId':_0x27e186},'order':'priority'})['then'](function(_0x42d52c){_0x4b0788=_0x42d52c;});}})['catch'](function(_0x1b195b){_0x2999b5=0x1f4;logger[_0x4875('0x2a')](_0x1b195b[_0x4875('0x3f')]);if(_0x1b195b[_0x4875('0x40')]){delete _0x1b195b[_0x4875('0x40')];}_0x4b0788=_0x1b195b;})['finally'](function(){if(_0x4b0788===null){_0x409834['sendStatus'](_0x2999b5);}else{if(_0x2999b5===0x1f4){_0x409834[_0x4875('0x2f')](_0x2999b5)['send'](_0x4b0788);}else{_0x409834[_0x4875('0x2f')](_0x2999b5)[_0x4875('0x31')](_0x4b0788);}}});};exports[_0x4875('0xcc')]=function(_0x400332,_0x33b7f6,_0x21a6be){var _0xc5de54={};var _0x809285={};var _0x2d8e52;var _0x7f3a4b;return db[_0x4875('0x42')][_0x4875('0x71')]({'where':{'id':_0x400332[_0x4875('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33b7f6,null))[_0x4875('0x25')](function(_0x23588d){if(_0x23588d){_0x2d8e52=_0x23588d;_0x809285[_0x4875('0x49')]=_['keys'](db[_0x4875('0x79')][_0x4875('0x43')]);_0x809285[_0x4875('0x46')]=_[_0x4875('0x47')](_0x400332[_0x4875('0x46')]);_0x809285['filters']=_[_0x4875('0x48')](_0x809285['model'],_0x809285['query']);_0xc5de54['attributes']=_['intersection'](_0x809285[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x400332[_0x4875('0x46')][_0x4875('0x4b')]));_0xc5de54['attributes']=_0xc5de54[_0x4875('0x4a')][_0x4875('0x4c')]?_0xc5de54[_0x4875('0x4a')]:_0x809285['model'];_0xc5de54[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x400332[_0x4875('0x46')][_0x4875('0x50')]);_0xc5de54[_0x4875('0x51')]=qs[_0x4875('0x52')](_['pick'](_0x400332[_0x4875('0x46')],_0x809285[_0x4875('0x52')]));if(_0x400332[_0x4875('0x46')][_0x4875('0x54')]){_0xc5de54[_0x4875('0x51')]=_[_0x4875('0x55')](_0xc5de54[_0x4875('0x51')],{'$or':_['map'](_0xc5de54['attributes'],function(_0x242752){var _0x281f10={};_0x281f10[_0x242752]={'$like':'%'+_0x400332[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x281f10;})});}_0xc5de54=_[_0x4875('0x55')]({},_0xc5de54,_0x400332[_0x4875('0x60')]);return _0x2d8e52['getApplications'](_0xc5de54);}})[_0x4875('0x25')](function(_0x40ab0b){if(_0x40ab0b){_0x7f3a4b=_0x40ab0b[_0x4875('0x4c')];if(!_0x400332[_0x4875('0x46')][_0x4875('0x4d')]('nolimit')){_0xc5de54[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x400332[_0x4875('0x46')][_0x4875('0x35')]);_0xc5de54[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x400332[_0x4875('0x46')][_0x4875('0x32')]);}return _0x2d8e52[_0x4875('0xcc')](_0xc5de54);}})[_0x4875('0x25')](function(_0x204574){if(_0x204574){return _0x204574?{'count':_0x7f3a4b,'rows':_0x204574}:null;}})[_0x4875('0x25')](respondWithResult(_0x33b7f6,null))[_0x4875('0x6a')](handleError(_0x33b7f6,null));};exports[_0x4875('0xcd')]=function(_0x49ad87,_0x45ced9,_0xe4d918){var _0x3e5e05={'raw':![],'where':{}};var _0x2701dc={};var _0x48a3a9={'count':0x0,'rows':[]};return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x49ad87[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x45ced9,null))[_0x4875('0x25')](function(_0x315d9f){if(_0x315d9f){_0x2701dc[_0x4875('0x49')]=_[_0x4875('0x47')](db[_0x4875('0xab')][_0x4875('0x43')]);_0x2701dc[_0x4875('0x46')]=_['keys'](_0x49ad87[_0x4875('0x46')]);_0x2701dc[_0x4875('0x52')]=_[_0x4875('0x48')](_0x2701dc[_0x4875('0x49')],_0x2701dc[_0x4875('0x46')]);_0x3e5e05[_0x4875('0x4a')]=_[_0x4875('0x48')](_0x2701dc[_0x4875('0x49')],qs[_0x4875('0x4b')](_0x49ad87[_0x4875('0x46')][_0x4875('0x4b')]));_0x3e5e05[_0x4875('0x4a')]=_0x3e5e05[_0x4875('0x4a')][_0x4875('0x4c')]?_0x3e5e05[_0x4875('0x4a')]:_0x2701dc[_0x4875('0x49')];if(!_0x49ad87[_0x4875('0x46')]['hasOwnProperty'](_0x4875('0x4e'))){_0x3e5e05[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x49ad87[_0x4875('0x46')][_0x4875('0x35')]);_0x3e5e05[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x49ad87[_0x4875('0x46')][_0x4875('0x32')]);}_0x3e5e05[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x49ad87['query'][_0x4875('0x50')]);_0x3e5e05[_0x4875('0x51')]=qs['filters'](_[_0x4875('0x53')](_0x49ad87['query'],_0x2701dc[_0x4875('0x52')]));_0x3e5e05[_0x4875('0x51')]['SmsAccountId']=_0x315d9f['id'];if(_0x49ad87[_0x4875('0x46')][_0x4875('0x54')]){_0x3e5e05[_0x4875('0x51')]=_['merge'](_0x3e5e05[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x3e5e05[_0x4875('0x4a')],function(_0x1db4d2){var _0x2929cf={};_0x2929cf[_0x1db4d2]={'$like':'%'+_0x49ad87['query'][_0x4875('0x54')]+'%'};return _0x2929cf;})});}_0x3e5e05=_[_0x4875('0x55')]({},_0x3e5e05,_0x49ad87[_0x4875('0x60')]);return db['SmsInteraction']['count']({'where':_0x3e5e05[_0x4875('0x51')]})[_0x4875('0x25')](function(_0x3b5183){_0x48a3a9[_0x4875('0x34')]=_0x3b5183;if(_0x49ad87[_0x4875('0x46')][_0x4875('0x5f')]){_0x3e5e05[_0x4875('0x58')]=[{'model':db[_0x4875('0x7f')],'as':_0x4875('0xce'),'required':![]},{'model':db[_0x4875('0xb8')],'as':_0x4875('0xcf'),'attributes':[_0x4875('0x40'),_0x4875('0xd0'),'internal'],'required':![]},{'model':db[_0x4875('0xd1')],'as':_0x4875('0xd2'),'attributes':['id',_0x4875('0x40'),_0x4875('0xd3')],'where':_0x49ad87[_0x4875('0x46')]['tag']?{'id':_0x49ad87[_0x4875('0x46')][_0x4875('0xd4')]}:undefined,'required':_0x49ad87[_0x4875('0x46')][_0x4875('0xd4')]?!![]:![]}];}return db[_0x4875('0xab')][_0x4875('0x59')](_0x3e5e05);})[_0x4875('0x25')](function(_0x249eb8){_0x48a3a9[_0x4875('0x5a')]=_0x249eb8;return _0x48a3a9;});}})[_0x4875('0x25')](respondWithFilteredResult(_0x45ced9,_0x3e5e05))[_0x4875('0x6a')](handleError(_0x45ced9,null));};exports[_0x4875('0xc5')]=function(_0x1a32d3,_0xeb8a68,_0x2eb57d){var _0x1759ea,_0x167a39,_0x5d17e0;if(_['isNil'](_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')])||_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')]===''){throw new db[(_0x4875('0x80'))]['ValidationError'](_0x4875('0xa0'));}if(_[_0x4875('0xa1')](_0x1a32d3[_0x4875('0x63')]['to'])){throw new db[(_0x4875('0x80'))][(_0x4875('0x81'))]('to\x20is\x20mandatory');}_0x1759ea=_0x1a32d3['body']['to'];return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x1a32d3[_0x4875('0x5c')]['id']},'include':[{'model':db[_0x4875('0xd5')],'as':_0x4875('0xd6'),'include':[{'model':db[_0x4875('0x7f')],'as':'Contacts','where':{'mobile':_0x1759ea},'limit':0x1,'order':[[_0x4875('0x85'),_0x4875('0xa7')]]}]}]})[_0x4875('0x25')](handleEntityNotFound(_0xeb8a68,null))[_0x4875('0x25')](function(_0x1c2965){if(_0x1c2965&&_0x1c2965[_0x4875('0xd6')]){_0x167a39=_0x1c2965['get']({'plain':!![]});if(_0x167a39['List']&&_0x167a39[_0x4875('0xd6')][_0x4875('0xa6')][_0x4875('0x4c')]){return _0x167a39[_0x4875('0xd6')][_0x4875('0xa6')][0x0];}return db['CmContact'][_0x4875('0x62')](_[_0x4875('0xa9')](_0x1a32d3['body'],{'firstName':_0x1759ea,'mobile':_0x1759ea,'phone':_0x1759ea,'ListId':_0x167a39[_0x4875('0x87')]}));}})['then'](handleEntityNotFound(_0xeb8a68,null))[_0x4875('0x25')](function(_0x3bc0fd){if(_0x3bc0fd){_0x5d17e0=_0x3bc0fd;return db[_0x4875('0xab')][_0x4875('0x61')]({'where':{'ContactId':_0x5d17e0['id'],'closed':![],'SmsAccountId':_0x167a39['id']}})[_0x4875('0x25')](function(_0xdad3fb){if(_0xdad3fb){return[_0xdad3fb,![]];}return db['SmsInteraction'][_0x4875('0x62')]({'UserId':_0x1a32d3[_0x4875('0x64')]['id'],'ContactId':_0x5d17e0['id'],'SmsAccountId':_0x167a39['id'],'phone':_0x1759ea,'firstMsgDirection':_0x4875('0xd7'),'Messages':[_['merge'](_0x1a32d3['body'],{'read':![],'body':_0x1a32d3['body'][_0x4875('0x63')],'phone':_0x1759ea,'SmsAccountId':_0x167a39['id'],'UserId':_0x1a32d3['user']['id'],'ContactId':_0x5d17e0['id']})]},{'include':[{'model':db[_0x4875('0xb4')],'as':_0x4875('0xd8')}]})['then'](function(_0x56ce0f){return[_0x56ce0f,!![]];});});}})[_0x4875('0xd9')](function(_0x1444bc,_0x44058a){if(_0x44058a){return _0x1444bc;}return db[_0x4875('0xb4')][_0x4875('0x62')](_[_0x4875('0x55')](_0x1a32d3[_0x4875('0x63')],{'read':![],'body':_0x1a32d3[_0x4875('0x63')][_0x4875('0x63')],'phone':_0x1759ea,'SmsAccountId':_0x167a39['id'],'SmsInteractionId':_0x1444bc['id'],'UserId':_0x1a32d3[_0x4875('0x64')]['id'],'ContactId':_0x5d17e0['id']}))[_0x4875('0x25')](function(_0x5bc483){_0x1444bc[_0x4875('0xda')]['Messages']=[];_0x1444bc[_0x4875('0xda')]['Messages']['push'](_0x5bc483[_0x4875('0xda')]);return _0x1444bc;});})[_0x4875('0x25')](respondWithResult(_0xeb8a68,null))[_0x4875('0x6a')](handleError(_0xeb8a68,null));};exports[_0x4875('0x2f')]=function(_0x2cffcc,_0x282023,_0x1ddc42){if(_0x2cffcc['body']['id']){delete _0x2cffcc[_0x4875('0x63')]['id'];}var _0x1ab02c,_0x237bda,_0x2c5ae5;return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0x2cffcc[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x282023,null))['then'](function(_0x55e5be){if(_0x55e5be){_0x2c5ae5=_0x55e5be;logger[_0x4875('0xc0')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4875('0x2f'),_0x4875('0xdb'),_0x55e5be['type'],util[_0x4875('0xdc')](_0x2cffcc['body'],{'showHidden':![],'depth':null}));switch(_0x55e5be[_0x4875('0x56')]){case'skebby':if(_0x2cffcc['body']['skebby_dispatch_id']&&_0x2cffcc[_0x4875('0x63')]['status']){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')];return db['SmsMessage'][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc['body'][_0x4875('0xdd')]}});}break;case _0x4875('0x8e'):if(_0x2cffcc['body'][_0x4875('0xde')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0xdf')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0xdf')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0xde')]}});}break;case'clicksend':if(_0x2cffcc[_0x4875('0x63')][_0x4875('0x90')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0xe0')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0xe0')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0x90')]}});}break;case _0x4875('0x94'):var _0xcc2890=_0x2cffcc['body']['results'][0x0];if(_0xcc2890[_0x4875('0x8b')]&&_0xcc2890[_0x4875('0x2f')][_0x4875('0xe1')]==='DELIVERED'){_0x237bda=_0xcc2890[_0x4875('0x2f')][_0x4875('0xe1')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0xcc2890[_0x4875('0x8b')]}});}break;case _0x4875('0x9a'):if(_0x2cffcc['body'][_0x4875('0x8b')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')]){_0x237bda=_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')];return db['SmsMessage'][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc['body'][_0x4875('0x8b')]}});}break;case _0x4875('0x9d'):if(_0x2cffcc[_0x4875('0x63')][0x0]['message']['id']){_0x237bda=_0x2cffcc[_0x4875('0x63')][0x0][_0x4875('0x56')];return db['SmsMessage']['find']({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][0x0][_0x4875('0x2c')]['id']}});}break;case _0x4875('0xe2'):if(_0x2cffcc[_0x4875('0x63')][_0x4875('0xe3')]&&_0x2cffcc[_0x4875('0x63')][_0x4875('0x2f')]){_0x237bda=_0x2cffcc[_0x4875('0x63')]['status'];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x2cffcc[_0x4875('0x63')][_0x4875('0xe3')]}});}break;}}})['then'](handleEntityNotFound(_0x282023,null))[_0x4875('0x25')](function(_0x1736da){if(_0x1736da){_0x1ab02c=_0x1736da;switch(_0x2c5ae5[_0x4875('0x56')]){case'skebby':if(_0x237bda===_0x4875('0xe4')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),'skebby',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x8e'):if(_0x237bda==='1'){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4875('0x2f'),_0x4875('0xe5'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x8f'):if(!_0x2cffcc['body'][_0x4875('0xe6')]&&_0x237bda>=0xc8&&_0x237bda<=0xce){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger['error'](_0x4875('0x28'),_0x4875('0x2f'),'clicksend',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x94'):var _0x33abc4=_0x2cffcc[_0x4875('0x63')]['results'][0x0];if(_0x33abc4[_0x4875('0x2f')][_0x4875('0xe1')]===_0x4875('0xe4')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x94'),util[_0x4875('0xdc')](_0x2cffcc['body'],{'showHidden':![],'depth':null}));}break;case _0x4875('0x9a'):if(_0x237bda==_0x4875('0xe7')||_0x237bda==_0x4875('0xe8')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger['error'](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x9a'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0x9d'):if(_0x237bda=='message-delivered'){return _0x1ab02c['update']({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x9d'),util[_0x4875('0xdc')](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;case _0x4875('0xe2'):if(_0x237bda==='DELIVRD'||_0x237bda===_0x4875('0xe9')){return _0x1ab02c[_0x4875('0x6c')]({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),'intelepeer',util['inspect'](_0x2cffcc[_0x4875('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x1ab02c;}})[_0x4875('0x25')](respondWithResult(_0x282023,null))[_0x4875('0x6a')](handleError(_0x282023,null));};exports[_0x4875('0xea')]=function(_0x3fcae8,_0x14ec15,_0x18e500){var _0x32e6fa,_0x1384ec,_0x5736c7;return db[_0x4875('0x42')]['find']({'where':{'id':_0x3fcae8['params']['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x14ec15,null))[_0x4875('0x25')](function(_0x555ac){if(_0x555ac){_0x5736c7=_0x555ac;logger[_0x4875('0xc0')](_0x4875('0x28'),_0x4875('0x2f'),'received\x20delivery\x20report\x20from',_0x555ac[_0x4875('0x56')],util[_0x4875('0xdc')](_0x3fcae8[_0x4875('0x46')],{'showHidden':![],'depth':null}));switch(_0x555ac['type']){case _0x4875('0x97'):if(_0x3fcae8['query'][_0x4875('0xeb')]&&_0x3fcae8[_0x4875('0x46')][_0x4875('0xec')]){_0x1384ec=_0x3fcae8[_0x4875('0x46')][_0x4875('0xec')];return db[_0x4875('0xb4')][_0x4875('0x61')]({'where':{'messageId':_0x3fcae8['query']['message-id']}});}break;}}})[_0x4875('0x25')](handleEntityNotFound(_0x14ec15,null))[_0x4875('0x25')](function(_0x290a53){if(_0x290a53){_0x32e6fa=_0x290a53;switch(_0x5736c7[_0x4875('0x56')]){case'csc':if(_0x1384ec==='2'||_0x1384ec==='6'){return _0x32e6fa['update']({'read':!![]});}else{logger[_0x4875('0x2a')](_0x4875('0x28'),_0x4875('0x2f'),_0x4875('0x97'),util[_0x4875('0xdc')](_0x3fcae8['query'],{'showHidden':![],'depth':null}));};break;}return _0x32e6fa;}})[_0x4875('0x25')](respondWithResult(_0x14ec15,null))[_0x4875('0x6a')](handleError(_0x14ec15,null));};exports['addAgents']=function(_0xd6adf1,_0x26c0bc,_0x189e43){return db[_0x4875('0x42')][_0x4875('0x61')]({'where':{'id':_0xd6adf1[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x26c0bc,null))[_0x4875('0x25')](function(_0x348646){if(_0x348646){return _0x348646[_0x4875('0xed')](_0xd6adf1['body'][_0x4875('0x73')],_[_0x4875('0xa8')](_0xd6adf1[_0x4875('0x63')],[_0x4875('0x73'),'id'])||{})['spread'](function(_0xcda813){for(var _0x2bc0ca=0x0;_0x2bc0ca<_0xd6adf1[_0x4875('0x63')][_0x4875('0x73')][_0x4875('0x4c')];_0x2bc0ca+=0x1){socket[_0x4875('0xee')](_0x4875('0xef'),{'UserId':Number(_0xd6adf1[_0x4875('0x63')][_0x4875('0x73')][_0x2bc0ca]),'SmsAccountId':Number(_0xd6adf1[_0x4875('0x5c')]['id'])});}return _0xcda813;});}})['then'](respondWithResult(_0x26c0bc,null))[_0x4875('0x6a')](handleError(_0x26c0bc,null));};exports[_0x4875('0xf0')]=function(_0x48cf4a,_0x39d188,_0x36863e){return db['SmsAccount']['find']({'where':{'id':_0x48cf4a[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x39d188,null))[_0x4875('0x25')](function(_0x1a1231){if(_0x1a1231){return _0x1a1231['removeAgents'](_0x48cf4a['query'][_0x4875('0x73')])[_0x4875('0x25')](function(){if(_[_0x4875('0xf1')](_0x48cf4a['query'][_0x4875('0x73')])){for(var _0x4307e5=0x0;_0x4307e5<_0x48cf4a[_0x4875('0x46')]['ids'][_0x4875('0x4c')];_0x4307e5+=0x1){socket[_0x4875('0xee')](_0x4875('0xf2'),{'UserId':Number(_0x48cf4a[_0x4875('0x46')][_0x4875('0x73')][_0x4307e5]),'SmsAccountId':Number(_0x48cf4a['params']['id'])});}}else{socket[_0x4875('0xee')](_0x4875('0xf2'),{'UserId':Number(_0x48cf4a[_0x4875('0x46')]['ids']),'SmsAccountId':Number(_0x48cf4a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39d188,null))[_0x4875('0x6a')](handleError(_0x39d188,null));};exports[_0x4875('0xf3')]=function(_0x407c9e,_0x5f0dec,_0x19a915){var _0x36c258={};var _0xf0515d={};var _0x4e63fb;var _0x2b9be2;return db[_0x4875('0x42')]['findOne']({'where':{'id':_0x407c9e[_0x4875('0x5c')]['id']}})[_0x4875('0x25')](handleEntityNotFound(_0x5f0dec,null))[_0x4875('0x25')](function(_0x2f8e1b){if(_0x2f8e1b){_0x4e63fb=_0x2f8e1b;_0xf0515d[_0x4875('0x49')]=_['keys'](db['User'][_0x4875('0x43')]);_0xf0515d[_0x4875('0x46')]=_['keys'](_0x407c9e[_0x4875('0x46')]);_0xf0515d[_0x4875('0x52')]=_[_0x4875('0x48')](_0xf0515d[_0x4875('0x49')],_0xf0515d[_0x4875('0x46')]);_0x36c258['attributes']=_[_0x4875('0x48')](_0xf0515d['model'],qs[_0x4875('0x4b')](_0x407c9e[_0x4875('0x46')]['fields']));_0x36c258[_0x4875('0x4a')]=_0x36c258[_0x4875('0x4a')]['length']?_0x36c258[_0x4875('0x4a')]:_0xf0515d[_0x4875('0x49')];_0x36c258[_0x4875('0x4f')]=qs[_0x4875('0x50')](_0x407c9e[_0x4875('0x46')][_0x4875('0x50')]);_0x36c258[_0x4875('0x51')]=qs[_0x4875('0x52')](_[_0x4875('0x53')](_0x407c9e[_0x4875('0x46')],_0xf0515d[_0x4875('0x52')]));if(_0x407c9e[_0x4875('0x46')][_0x4875('0x54')]){_0x36c258[_0x4875('0x51')]=_[_0x4875('0x55')](_0x36c258[_0x4875('0x51')],{'$or':_[_0x4875('0x41')](_0x36c258['attributes'],function(_0x3fcdd5){var _0x2c9650={};_0x2c9650[_0x3fcdd5]={'$like':'%'+_0x407c9e[_0x4875('0x46')][_0x4875('0x54')]+'%'};return _0x2c9650;})});}_0x36c258=_[_0x4875('0x55')]({},_0x36c258,_0x407c9e[_0x4875('0x60')]);return _0x4e63fb[_0x4875('0xf3')](_0x36c258);}})[_0x4875('0x25')](function(_0x3bad46){if(_0x3bad46){_0x2b9be2=_0x3bad46[_0x4875('0x4c')];if(!_0x407c9e[_0x4875('0x46')][_0x4875('0x4d')]('nolimit')){_0x36c258[_0x4875('0x35')]=qs[_0x4875('0x35')](_0x407c9e[_0x4875('0x46')]['limit']);_0x36c258[_0x4875('0x32')]=qs[_0x4875('0x32')](_0x407c9e[_0x4875('0x46')][_0x4875('0x32')]);}return _0x4e63fb[_0x4875('0xf3')](_0x36c258);}})[_0x4875('0x25')](function(_0x334746){if(_0x334746){return _0x334746?{'count':_0x2b9be2,'rows':_0x334746}:null;}})[_0x4875('0x25')](respondWithResult(_0x5f0dec,null))[_0x4875('0x6a')](handleError(_0x5f0dec,null));}; \ No newline at end of file +var _0xc9a5=['Pause','map','SmsAccount','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','userProfileId','mandatoryDispositionPause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','skebby','text','connectel','clicksend','messageId','message_id','MessageUUID','infobip','results','originatingAddress','segmentedMessage','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','ListId','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','tag','to\x20is\x20mandatory','CmList','List','DESC','out','Messages','push','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','update','error_code','clickatell','DELIVERED_TO_GATEWAY','ACCEPTD','statusGet','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','destroy','then','get','stack','name','send','index'];(function(_0x35d028,_0x11639c){var _0x2c167d=function(_0x3f75b0){while(--_0x3f75b0){_0x35d028['push'](_0x35d028['shift']());}};_0x2c167d(++_0x11639c);}(_0xc9a5,0xa8));var _0x5c9a=function(_0x1aff8d,_0x393add){_0x1aff8d=_0x1aff8d-0x0;var _0x3fb4a7=_0xc9a5[_0x1aff8d];return _0x3fb4a7;};'use strict';var emlformat=require(_0x5c9a('0x0'));var rimraf=require(_0x5c9a('0x1'));var zipdir=require(_0x5c9a('0x2'));var jsonpatch=require(_0x5c9a('0x3'));var rp=require(_0x5c9a('0x4'));var moment=require('moment');var BPromise=require(_0x5c9a('0x5'));var Mustache=require(_0x5c9a('0x6'));var util=require(_0x5c9a('0x7'));var path=require(_0x5c9a('0x8'));var sox=require('sox');var csv=require(_0x5c9a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c9a('0xa'));var squel=require(_0x5c9a('0xb'));var crypto=require(_0x5c9a('0xc'));var jsforce=require(_0x5c9a('0xd'));var deskjs=require(_0x5c9a('0xe'));var toCsv=require(_0x5c9a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c9a('0xf'));var authService=require(_0x5c9a('0x10'));var qs=require(_0x5c9a('0x11'));var as=require(_0x5c9a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c9a('0x13'))(_0x5c9a('0x14'));var utils=require(_0x5c9a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5c9a('0x16'))['db'];config[_0x5c9a('0x17')]=_[_0x5c9a('0x18')](config[_0x5c9a('0x17')],{'host':_0x5c9a('0x19'),'port':0x18eb});var socket=require(_0x5c9a('0x1a'))(new Redis(config[_0x5c9a('0x17')]));require('./smsAccount.socket')[_0x5c9a('0x1b')](socket);var jayson=require(_0x5c9a('0x1c'));var client=jayson[_0x5c9a('0x1d')][_0x5c9a('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5daeb4,_0x365db9,_0x220273,_0x25cf8c){return new BPromise(function(_0x195358,_0x238168){var _0x3ef879=_0x25cf8c||client;return _0x3ef879['request'](_0x5daeb4,_0x220273)['then'](function(_0x2fc201){logger['info'](_0x5c9a('0x1f'),_0x365db9,_0x5c9a('0x20'));logger[_0x5c9a('0x21')](_0x5c9a('0x22'),_0x365db9,_0x5c9a('0x20'),JSON[_0x5c9a('0x23')](_0x2fc201));if(_0x2fc201[_0x5c9a('0x24')]){if(_0x2fc201[_0x5c9a('0x24')]['code']===0x1f4){logger[_0x5c9a('0x24')](_0x5c9a('0x1f'),_0x365db9,_0x2fc201[_0x5c9a('0x24')]['message']);return _0x238168(_0x2fc201[_0x5c9a('0x24')][_0x5c9a('0x25')]);}logger[_0x5c9a('0x24')](_0x5c9a('0x1f'),_0x365db9,_0x2fc201[_0x5c9a('0x24')][_0x5c9a('0x25')]);return _0x195358(_0x2fc201[_0x5c9a('0x24')][_0x5c9a('0x25')]);}else{logger[_0x5c9a('0x26')](_0x5c9a('0x1f'),_0x365db9,_0x5c9a('0x20'));_0x195358(_0x2fc201[_0x5c9a('0x27')]['message']);}})[_0x5c9a('0x28')](function(_0x4de037){logger[_0x5c9a('0x24')]('SmsAccount,\x20%s,\x20%s',_0x365db9,_0x4de037);_0x238168(_0x4de037);});});}function respondWithStatusCode(_0x390acd,_0x3dae82){_0x3dae82=_0x3dae82||0xcc;return function(_0x3f9346){if(_0x3f9346){return _0x390acd[_0x5c9a('0x29')](_0x3dae82);}return _0x390acd[_0x5c9a('0x2a')](_0x3dae82)[_0x5c9a('0x2b')]();};}function respondWithResult(_0x5d1155,_0x2c63ba){_0x2c63ba=_0x2c63ba||0xc8;return function(_0x26316e){if(_0x26316e){return _0x5d1155[_0x5c9a('0x2a')](_0x2c63ba)[_0x5c9a('0x2c')](_0x26316e);}};}function respondWithFilteredResult(_0x4b6108,_0x27df83){return function(_0x5c7536){if(_0x5c7536){var _0x358a0a=typeof _0x27df83[_0x5c9a('0x2d')]===_0x5c9a('0x2e')&&typeof _0x27df83['limit']===_0x5c9a('0x2e');var _0x4c0fc2=_0x5c7536[_0x5c9a('0x2f')];var _0x504747=_0x358a0a?0x0:_0x27df83[_0x5c9a('0x2d')];var _0x332e3c=_0x358a0a?_0x5c7536[_0x5c9a('0x2f')]:_0x27df83[_0x5c9a('0x2d')]+_0x27df83['limit'];var _0x6284b;if(_0x332e3c>=_0x4c0fc2){_0x332e3c=_0x4c0fc2;_0x6284b=0xc8;}else{_0x6284b=0xce;}_0x4b6108[_0x5c9a('0x2a')](_0x6284b);return _0x4b6108[_0x5c9a('0x30')]('Content-Range',_0x504747+'-'+_0x332e3c+'/'+_0x4c0fc2)[_0x5c9a('0x2c')](_0x5c7536);}return null;};}function patchUpdates(_0x4fd64d){return function(_0x4242a6){try{jsonpatch[_0x5c9a('0x31')](_0x4242a6,_0x4fd64d,!![]);}catch(_0x4e648c){return BPromise[_0x5c9a('0x32')](_0x4e648c);}return _0x4242a6[_0x5c9a('0x33')]();};}function saveUpdates(_0x5ca4ea,_0x337513){return function(_0x25e5aa){if(_0x25e5aa){return _0x25e5aa['update'](_0x5ca4ea)['then'](function(_0x389c4c){return _0x389c4c;});}return null;};}function removeEntity(_0x220210,_0xf9553f){return function(_0x143bc8){if(_0x143bc8){return _0x143bc8[_0x5c9a('0x34')]()[_0x5c9a('0x35')](function(){var _0x2e21d6=_0x143bc8[_0x5c9a('0x36')]({'plain':!![]});var _0x3687a2='SmsAccounts';return db['UserProfileResource'][_0x5c9a('0x34')]({'where':{'type':_0x3687a2,'resourceId':_0x2e21d6['id']}})[_0x5c9a('0x35')](function(){return _0x143bc8;});})[_0x5c9a('0x35')](function(){_0x220210['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4675ae,_0x362a41){return function(_0x20c365){if(!_0x20c365){_0x4675ae[_0x5c9a('0x29')](0x194);}return _0x20c365;};}function handleError(_0x3a3866,_0x2128c3){_0x2128c3=_0x2128c3||0x1f4;return function(_0x4c8d6c){logger[_0x5c9a('0x24')](_0x4c8d6c[_0x5c9a('0x37')]);if(_0x4c8d6c[_0x5c9a('0x38')]){delete _0x4c8d6c[_0x5c9a('0x38')];}_0x3a3866['status'](_0x2128c3)[_0x5c9a('0x39')](_0x4c8d6c);};}exports[_0x5c9a('0x3a')]=function(_0xe98226,_0x1feb77){var _0x5d85b8={'include':[{'model':db[_0x5c9a('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3e1450={},_0x22495e={'count':0x0,'rows':[]};var _0x5cb9d5=_[_0x5c9a('0x3c')](db[_0x5c9a('0x3d')][_0x5c9a('0x3e')],function(_0x598cc7){return{'name':_0x598cc7['fieldName'],'type':_0x598cc7['type'][_0x5c9a('0x3f')]};});_0x3e1450['model']=_[_0x5c9a('0x3c')](_0x5cb9d5,'name');_0x3e1450[_0x5c9a('0x40')]=_['keys'](_0xe98226['query']);_0x3e1450[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x3e1450[_0x5c9a('0x43')],_0x3e1450[_0x5c9a('0x40')]);_0x5d85b8[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x3e1450[_0x5c9a('0x43')],qs[_0x5c9a('0x45')](_0xe98226[_0x5c9a('0x40')][_0x5c9a('0x45')]));_0x5d85b8['attributes']=_0x5d85b8[_0x5c9a('0x44')][_0x5c9a('0x46')]?_0x5d85b8['attributes']:_0x3e1450[_0x5c9a('0x43')];if(!_0xe98226['query'][_0x5c9a('0x47')](_0x5c9a('0x48'))){_0x5d85b8[_0x5c9a('0x49')]=qs[_0x5c9a('0x49')](_0xe98226[_0x5c9a('0x40')][_0x5c9a('0x49')]);_0x5d85b8[_0x5c9a('0x2d')]=qs[_0x5c9a('0x2d')](_0xe98226['query'][_0x5c9a('0x2d')]);}_0x5d85b8[_0x5c9a('0x4a')]=qs[_0x5c9a('0x4b')](_0xe98226['query'][_0x5c9a('0x4b')]);_0x5d85b8[_0x5c9a('0x4c')]=qs['filters'](_['pick'](_0xe98226[_0x5c9a('0x40')],_0x3e1450['filters']),_0x5cb9d5);if(_0xe98226['query'][_0x5c9a('0x4d')]){_0x5d85b8[_0x5c9a('0x4c')]=_['merge'](_0x5d85b8['where'],{'$or':_[_0x5c9a('0x3c')](_0x5cb9d5,function(_0x527286){if(_0x527286[_0x5c9a('0x4e')]!==_0x5c9a('0x4f')){var _0x168345={};_0x168345[_0x527286['name']]={'$like':'%'+_0xe98226['query'][_0x5c9a('0x4d')]+'%'};return _0x168345;}})});}_0x5d85b8=_[_0x5c9a('0x50')]({},_0x5d85b8,_0xe98226[_0x5c9a('0x51')]);var _0x1206b2={'where':_0x5d85b8[_0x5c9a('0x4c')]};return db[_0x5c9a('0x3d')]['count'](_0x1206b2)[_0x5c9a('0x35')](function(_0x563721){_0x22495e[_0x5c9a('0x2f')]=_0x563721;if(_0xe98226[_0x5c9a('0x40')]['includeAll']){_0x5d85b8[_0x5c9a('0x52')]=[{'all':!![]}];}return db[_0x5c9a('0x3d')][_0x5c9a('0x53')](_0x5d85b8);})['then'](function(_0x270405){_0x22495e[_0x5c9a('0x54')]=_0x270405;return _0x22495e;})[_0x5c9a('0x35')](respondWithFilteredResult(_0x1feb77,_0x5d85b8))['catch'](handleError(_0x1feb77,null));};exports['show']=function(_0x5e5e7b,_0x316058){var _0x4dbf90={'raw':![],'where':{'id':_0x5e5e7b[_0x5c9a('0x55')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x38c7aa={};_0x38c7aa[_0x5c9a('0x43')]=_[_0x5c9a('0x56')](db[_0x5c9a('0x3d')][_0x5c9a('0x3e')]);_0x38c7aa[_0x5c9a('0x40')]=_[_0x5c9a('0x56')](_0x5e5e7b['query']);_0x38c7aa[_0x5c9a('0x41')]=_['intersection'](_0x38c7aa[_0x5c9a('0x43')],_0x38c7aa['query']);_0x4dbf90[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x38c7aa[_0x5c9a('0x43')],qs['fields'](_0x5e5e7b['query'][_0x5c9a('0x45')]));_0x4dbf90[_0x5c9a('0x44')]=_0x4dbf90[_0x5c9a('0x44')][_0x5c9a('0x46')]?_0x4dbf90[_0x5c9a('0x44')]:_0x38c7aa[_0x5c9a('0x43')];if(_0x5e5e7b[_0x5c9a('0x40')]['includeAll']){_0x4dbf90['include']=[{'all':!![]}];}_0x4dbf90=_[_0x5c9a('0x50')]({},_0x4dbf90,_0x5e5e7b[_0x5c9a('0x51')]);return db[_0x5c9a('0x3d')][_0x5c9a('0x57')](_0x4dbf90)[_0x5c9a('0x35')](handleEntityNotFound(_0x316058,null))[_0x5c9a('0x35')](respondWithResult(_0x316058,null))['catch'](handleError(_0x316058,null));};exports['create']=function(_0x5df5df,_0x2bae10){return db[_0x5c9a('0x3d')][_0x5c9a('0x58')](_0x5df5df[_0x5c9a('0x59')],{})['then'](function(_0x38bc7f){var _0x8a7417=_0x5df5df[_0x5c9a('0x5a')][_0x5c9a('0x36')]({'plain':!![]});if(!_0x8a7417)throw new Error(_0x5c9a('0x5b'));if(_0x8a7417['role']===_0x5c9a('0x5a')){var _0x587191=_0x38bc7f[_0x5c9a('0x36')]({'plain':!![]});var _0x2724ca=_0x5c9a('0x5c');return db[_0x5c9a('0x5d')]['find']({'where':{'name':_0x2724ca,'userProfileId':_0x8a7417[_0x5c9a('0x5e')]},'raw':!![]})[_0x5c9a('0x35')](function(_0x5dca38){if(_0x5dca38&&_0x5dca38['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x587191[_0x5c9a('0x38')],'resourceId':_0x587191['id'],'type':_0x5dca38[_0x5c9a('0x38')],'sectionId':_0x5dca38['id']},{})[_0x5c9a('0x35')](function(){return _0x38bc7f;});}else{return _0x38bc7f;}})[_0x5c9a('0x28')](function(_0x424444){logger[_0x5c9a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424444);throw _0x424444;});}return _0x38bc7f;})[_0x5c9a('0x35')](respondWithResult(_0x2bae10,0xc9))['catch'](handleError(_0x2bae10,null));};exports['update']=function(_0x5622bf,_0x3bbc62){if(_0x5622bf['body']['id']){delete _0x5622bf[_0x5c9a('0x59')]['id'];}return db[_0x5c9a('0x3d')]['find']({'where':{'id':_0x5622bf[_0x5c9a('0x55')]['id']},'include':[{'model':db[_0x5c9a('0x3b')],'as':_0x5c9a('0x5f')}]})[_0x5c9a('0x35')](handleEntityNotFound(_0x3bbc62,null))[_0x5c9a('0x35')](saveUpdates(_0x5622bf[_0x5c9a('0x59')],null))[_0x5c9a('0x35')](respondWithResult(_0x3bbc62,null))['catch'](handleError(_0x3bbc62,null));};exports[_0x5c9a('0x34')]=function(_0x8bc5b0,_0x8629be){return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x8bc5b0[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x8629be,null))[_0x5c9a('0x35')](removeEntity(_0x8629be,null))[_0x5c9a('0x28')](handleError(_0x8629be,null));};exports['describe']=function(_0x573f2d,_0x2b883d){return db[_0x5c9a('0x3d')][_0x5c9a('0x60')]()['then'](respondWithResult(_0x2b883d,null))['catch'](handleError(_0x2b883d,null));};exports[_0x5c9a('0x61')]=function(_0x3dda2d,_0x1d20f6,_0x319292){if(_0x3dda2d[_0x5c9a('0x59')]['id']){delete _0x3dda2d[_0x5c9a('0x59')]['id'];}return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x3dda2d[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x1d20f6,null))[_0x5c9a('0x35')](function(_0xdfbdeb){if(_0xdfbdeb){_0x3dda2d[_0x5c9a('0x59')][_0x5c9a('0x62')]=_0xdfbdeb['id'];return db[_0x5c9a('0x63')][_0x5c9a('0x58')](_0x3dda2d['body']);}})[_0x5c9a('0x35')](respondWithResult(_0x1d20f6,null))['catch'](handleError(_0x1d20f6,null));};exports[_0x5c9a('0x64')]=function(_0x57f805,_0x10fa3f,_0x4ffd9d){var _0x107a2c={'raw':![],'where':{}};var _0x413ba7={};var _0x1c0033={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5c9a('0x65')]({'where':{'id':_0x57f805['params']['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x10fa3f,null))[_0x5c9a('0x35')](function(_0x10ace5){if(_0x10ace5){_0x413ba7[_0x5c9a('0x43')]=_[_0x5c9a('0x56')](db[_0x5c9a('0x63')][_0x5c9a('0x3e')]);_0x413ba7[_0x5c9a('0x40')]=_['keys'](_0x57f805[_0x5c9a('0x40')]);_0x413ba7[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x413ba7[_0x5c9a('0x43')],_0x413ba7[_0x5c9a('0x40')]);_0x107a2c[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x413ba7['model'],qs[_0x5c9a('0x45')](_0x57f805[_0x5c9a('0x40')][_0x5c9a('0x45')]));_0x107a2c['attributes']=_0x107a2c[_0x5c9a('0x44')][_0x5c9a('0x46')]?_0x107a2c[_0x5c9a('0x44')]:_0x413ba7[_0x5c9a('0x43')];if(!_0x57f805['query'][_0x5c9a('0x47')](_0x5c9a('0x48'))){_0x107a2c[_0x5c9a('0x49')]=qs['limit'](_0x57f805[_0x5c9a('0x40')][_0x5c9a('0x49')]);_0x107a2c['offset']=qs[_0x5c9a('0x2d')](_0x57f805['query'][_0x5c9a('0x2d')]);}_0x107a2c[_0x5c9a('0x4a')]=qs['sort'](_0x57f805[_0x5c9a('0x40')][_0x5c9a('0x4b')]);_0x107a2c[_0x5c9a('0x4c')]=qs[_0x5c9a('0x41')](_[_0x5c9a('0x66')](_0x57f805['query'],_0x413ba7['filters']));_0x107a2c['where'][_0x5c9a('0x62')]=_0x10ace5['id'];if(_0x57f805['query'][_0x5c9a('0x4d')]){_0x107a2c[_0x5c9a('0x4c')]=_[_0x5c9a('0x50')](_0x107a2c[_0x5c9a('0x4c')],{'$or':_[_0x5c9a('0x3c')](_0x107a2c[_0x5c9a('0x44')],function(_0x582199){var _0x453257={};_0x453257[_0x582199]={'$like':'%'+_0x57f805[_0x5c9a('0x40')][_0x5c9a('0x4d')]+'%'};return _0x453257;})});}_0x107a2c=_[_0x5c9a('0x50')]({},_0x107a2c,_0x57f805[_0x5c9a('0x51')]);return db[_0x5c9a('0x63')]['count']({'where':_0x107a2c[_0x5c9a('0x4c')]})[_0x5c9a('0x35')](function(_0x45b6f2){_0x1c0033['count']=_0x45b6f2;if(_0x57f805[_0x5c9a('0x40')][_0x5c9a('0x67')]){_0x107a2c[_0x5c9a('0x52')]=[{'all':!![]}];}return db[_0x5c9a('0x63')]['findAll'](_0x107a2c);})[_0x5c9a('0x35')](function(_0x26d60b){_0x1c0033[_0x5c9a('0x54')]=_0x26d60b;return _0x1c0033;});}})[_0x5c9a('0x35')](respondWithFilteredResult(_0x10fa3f,_0x107a2c))[_0x5c9a('0x28')](handleError(_0x10fa3f,null));};exports[_0x5c9a('0x68')]=function(_0x51dab7,_0xfa5161,_0x3cc579){return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x51dab7['params']['id']}})['then'](handleEntityNotFound(_0xfa5161,null))['then'](function(_0x246b1e){if(_0x246b1e){return _0x246b1e['removeDispositions'](_0x51dab7[_0x5c9a('0x40')][_0x5c9a('0x69')]);}})['then'](respondWithStatusCode(_0xfa5161,null))[_0x5c9a('0x28')](handleError(_0xfa5161,null));};exports[_0x5c9a('0x6a')]=function(_0x1fd2fa,_0x3e363c,_0x801c82){if(_0x1fd2fa[_0x5c9a('0x59')]['id']){delete _0x1fd2fa[_0x5c9a('0x59')]['id'];}return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x1fd2fa[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x3e363c,null))[_0x5c9a('0x35')](function(_0x26af6a){if(_0x26af6a){_0x1fd2fa[_0x5c9a('0x59')][_0x5c9a('0x62')]=_0x26af6a['id'];return db[_0x5c9a('0x6b')]['create'](_0x1fd2fa[_0x5c9a('0x59')]);}})['then'](respondWithResult(_0x3e363c,null))[_0x5c9a('0x28')](handleError(_0x3e363c,null));};exports[_0x5c9a('0x6c')]=function(_0x527d7d,_0x52a62b,_0x46b239){var _0x33ac86={'raw':![],'where':{}};var _0x15706f={};var _0x5cd8fd={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5c9a('0x65')]({'where':{'id':_0x527d7d[_0x5c9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x52a62b,null))[_0x5c9a('0x35')](function(_0x317fbf){if(_0x317fbf){_0x15706f[_0x5c9a('0x43')]=_['keys'](db[_0x5c9a('0x6b')][_0x5c9a('0x3e')]);_0x15706f[_0x5c9a('0x40')]=_[_0x5c9a('0x56')](_0x527d7d['query']);_0x15706f[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x15706f['model'],_0x15706f[_0x5c9a('0x40')]);_0x33ac86[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x15706f['model'],qs['fields'](_0x527d7d['query']['fields']));_0x33ac86[_0x5c9a('0x44')]=_0x33ac86[_0x5c9a('0x44')][_0x5c9a('0x46')]?_0x33ac86[_0x5c9a('0x44')]:_0x15706f[_0x5c9a('0x43')];if(!_0x527d7d[_0x5c9a('0x40')][_0x5c9a('0x47')](_0x5c9a('0x48'))){_0x33ac86[_0x5c9a('0x49')]=qs[_0x5c9a('0x49')](_0x527d7d[_0x5c9a('0x40')]['limit']);_0x33ac86[_0x5c9a('0x2d')]=qs['offset'](_0x527d7d[_0x5c9a('0x40')][_0x5c9a('0x2d')]);}_0x33ac86[_0x5c9a('0x4a')]=qs[_0x5c9a('0x4b')](_0x527d7d[_0x5c9a('0x40')]['sort']);_0x33ac86[_0x5c9a('0x4c')]=qs[_0x5c9a('0x41')](_[_0x5c9a('0x66')](_0x527d7d['query'],_0x15706f[_0x5c9a('0x41')]));_0x33ac86['where'][_0x5c9a('0x62')]=_0x317fbf['id'];if(_0x527d7d[_0x5c9a('0x40')][_0x5c9a('0x4d')]){_0x33ac86[_0x5c9a('0x4c')]=_[_0x5c9a('0x50')](_0x33ac86[_0x5c9a('0x4c')],{'$or':_[_0x5c9a('0x3c')](_0x33ac86['attributes'],function(_0x3da308){var _0x12a405={};_0x12a405[_0x3da308]={'$like':'%'+_0x527d7d[_0x5c9a('0x40')][_0x5c9a('0x4d')]+'%'};return _0x12a405;})});}_0x33ac86=_[_0x5c9a('0x50')]({},_0x33ac86,_0x527d7d[_0x5c9a('0x51')]);return db[_0x5c9a('0x6b')][_0x5c9a('0x2f')]({'where':_0x33ac86['where']})[_0x5c9a('0x35')](function(_0x17331d){_0x5cd8fd[_0x5c9a('0x2f')]=_0x17331d;if(_0x527d7d['query'][_0x5c9a('0x67')]){_0x33ac86['include']=[{'all':!![]}];}return db[_0x5c9a('0x6b')]['findAll'](_0x33ac86);})['then'](function(_0x53cb1a){_0x5cd8fd[_0x5c9a('0x54')]=_0x53cb1a;return _0x5cd8fd;});}})[_0x5c9a('0x35')](respondWithFilteredResult(_0x52a62b,_0x33ac86))[_0x5c9a('0x28')](handleError(_0x52a62b,null));};exports[_0x5c9a('0x6d')]=function(_0x24810d,_0x4df5c2,_0x45ea83){return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x24810d[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x4df5c2,null))[_0x5c9a('0x35')](function(_0xc953bb){if(_0xc953bb){return _0xc953bb[_0x5c9a('0x6d')](_0x24810d[_0x5c9a('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x4df5c2,null))[_0x5c9a('0x28')](handleError(_0x4df5c2,null));};exports[_0x5c9a('0x6e')]=function(_0x55a0e7,_0x2c39f7,_0x5c6263){var _0x3a938a={'channel':_0x5c9a('0x6f')};var _0x3c5dec=[];var _0x3d79b5=[];var _0x16f554={};return db['SmsAccount'][_0x5c9a('0x57')]({'where':{'id':_0x55a0e7[_0x5c9a('0x55')]['id']},'include':[{'model':db[_0x5c9a('0x70')],'as':_0x5c9a('0x71')}]})[_0x5c9a('0x35')](handleEntityNotFound(_0x2c39f7,null))['then'](function(_0x16d27a){_0x3a938a[_0x5c9a('0x72')]=_0x16d27a;_0x3a938a[_0x5c9a('0x73')]=_['orderBy'](_0x16d27a[_0x5c9a('0x71')],[_0x5c9a('0x74')],[_0x5c9a('0x75')]);if(_0x3a938a[_0x5c9a('0x72')][_0x5c9a('0x71')]){delete _0x3a938a[_0x5c9a('0x72')]['Applications'];}return db['CmContact']['describe']();})[_0x5c9a('0x35')](function(_0x31a399){if(!_0x31a399){throw new db[(_0x5c9a('0x76'))][(_0x5c9a('0x77'))](_0x5c9a('0x78'));}_0x3c5dec=_[_0x5c9a('0x79')](_[_0x5c9a('0x56')](_0x31a399),[_0x5c9a('0x7a'),_0x5c9a('0x7b')]);_0x3d79b5=_[_0x5c9a('0x79')](_[_0x5c9a('0x56')](_0x31a399),[_0x5c9a('0x7a'),_0x5c9a('0x7b'),_0x5c9a('0x7c'),'ListId']);_0x3a938a[_0x5c9a('0x59')]={'mapKey':_0x5c9a('0x7d')};if(_0x3a938a[_0x5c9a('0x72')][_0x5c9a('0x4e')]){switch(_0x3a938a[_0x5c9a('0x72')][_0x5c9a('0x4e')]){case _0x5c9a('0x7e'):_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')]=_0x55a0e7['body'][_0x5c9a('0x80')];_0x3a938a['body'][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x81')];_0x3a938a[_0x5c9a('0x59')]['messageId']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x82')];break;case _0x5c9a('0x83'):_0x3a938a[_0x5c9a('0x59')]['from']='+'+_0x55a0e7[_0x5c9a('0x59')]['sender'];_0x3a938a[_0x5c9a('0x59')]['body']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x84')];break;case _0x5c9a('0x85'):_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')]=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x7f')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x25')];break;case _0x5c9a('0x86'):_0x3a938a[_0x5c9a('0x59')]['from']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x7f')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x59')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x87')]=_0x55a0e7['body'][_0x5c9a('0x88')];break;case'plivo':_0x3a938a['body'][_0x5c9a('0x7f')]=_0x55a0e7['body']['From'];_0x3a938a['body'][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')]['Text'];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x87')]=_0x55a0e7['body'][_0x5c9a('0x89')];break;case _0x5c9a('0x8a'):_0x3a938a[_0x5c9a('0x59')]['from']='+'+_0x55a0e7[_0x5c9a('0x59')]['results'][0x0][_0x5c9a('0x7f')];_0x3a938a['body'][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')]['results'][0x0]['text'];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x87')]=_0x55a0e7['body'][_0x5c9a('0x8b')][0x0][_0x5c9a('0x87')];break;case'csc':_0x3a938a['body']['from']=_0x55a0e7['body'][_0x5c9a('0x8c')];_0x3a938a[_0x5c9a('0x59')]['body']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x8d')]['message'];break;case'clickatell':_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')]=_0x55a0e7[_0x5c9a('0x59')]['fromNumber'];_0x3a938a[_0x5c9a('0x59')]['body']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x84')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x87')]=_0x55a0e7['body'][_0x5c9a('0x8e')];break;case'bandwidth':_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x87')]=_0x55a0e7[_0x5c9a('0x59')][0x0]['message']['id'];_0x3a938a[_0x5c9a('0x59')]['from']=_0x55a0e7[_0x5c9a('0x59')][0x0][_0x5c9a('0x25')][_0x5c9a('0x7f')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')][0x0][_0x5c9a('0x25')]['text'];break;case _0x5c9a('0x8f'):_0x3a938a['body'][_0x5c9a('0x7f')]=_0x55a0e7['body'][_0x5c9a('0x7f')];_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')]=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x25')];_0x3a938a['body']['messageId']=_0x55a0e7[_0x5c9a('0x59')][_0x5c9a('0x90')];break;}}if(_0x3a938a['body']['id']){delete _0x3a938a[_0x5c9a('0x59')]['id'];}if(_[_0x5c9a('0x91')](_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')])){throw new db[(_0x5c9a('0x76'))][(_0x5c9a('0x77'))](_0x5c9a('0x92'));}if(_['isNil'](_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')])||_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x59')]===''){throw new db['Sequelize'][(_0x5c9a('0x77'))](_0x5c9a('0x93'));}if(_[_0x5c9a('0x91')](_0x3a938a[_0x5c9a('0x59')]['mapKey'])){throw new db[(_0x5c9a('0x76'))][(_0x5c9a('0x77'))](_0x5c9a('0x94')+_0x3d79b5);}if(!_[_0x5c9a('0x95')](_0x3d79b5,_0x3a938a[_0x5c9a('0x59')]['mapKey'])){throw new db[(_0x5c9a('0x76'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d79b5);}_0x16f554[_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x96')]]=_0x3a938a['body'][_0x5c9a('0x7f')];return db['CmList'][_0x5c9a('0x57')]({'where':{'id':_0x3a938a['account'][_0x5c9a('0x97')]},'include':[{'model':db[_0x5c9a('0x98')],'as':_0x5c9a('0x99'),'where':_0x16f554,'limit':0x1,'order':[[_0x5c9a('0x7b'),'DESC']]}]});})['then'](handleEntityNotFound(_0x2c39f7,null))[_0x5c9a('0x35')](function(_0x24018b){if(_0x24018b){_0x3a938a[_0x5c9a('0x9a')]=_[_0x5c9a('0x9b')](_0x24018b,[_0x5c9a('0x99')]);if(_0x24018b[_0x5c9a('0x99')][_0x5c9a('0x46')]){return _0x24018b[_0x5c9a('0x99')][0x0];}var _0x152da3=_['defaults'](_0x3a938a[_0x5c9a('0x59')],{'firstName':_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')],'ListId':_0x24018b['id']});_0x152da3[_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x96')]]=_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')];return db[_0x5c9a('0x98')][_0x5c9a('0x58')](_0x152da3,{'fields':_0x3c5dec,'raw':!![]});}})[_0x5c9a('0x35')](handleEntityNotFound(_0x2c39f7,null))[_0x5c9a('0x35')](function(_0x4e0c42){if(_0x4e0c42){_0x3a938a[_0x5c9a('0x9c')]=_0x4e0c42;var _0x4fdd35={'ContactId':_0x4e0c42['id'],'phone':_0x3a938a[_0x5c9a('0x59')]['from'],'SmsAccountId':_0x55a0e7['params']['id']};var _0x5d8158={'ContactId':_0x4e0c42['id'],'SmsAccountId':_0x55a0e7[_0x5c9a('0x55')]['id'],'closed':![]};return db[_0x5c9a('0x9d')][_0x5c9a('0x57')]({'where':_0x5d8158})[_0x5c9a('0x35')](function(_0x1cf16a){if(_0x1cf16a){return[_0x1cf16a,![]];}return db['SmsInteraction'][_0x5c9a('0x58')](_0x4fdd35)['then'](function(_0x5398a0){return[_0x5398a0,!![]];});});}})[_0x5c9a('0x9e')](function(_0x23ed72,_0x16e7ff){_0x3a938a[_0x5c9a('0x9f')]=_0x23ed72[_0x5c9a('0x36')]({'plain':!![]});_0x3a938a['interaction'][_0x5c9a('0xa0')]=![];if(_0x16e7ff){if(_0x3a938a[_0x5c9a('0x72')][_0x5c9a('0xa1')]){_0x3a938a[_0x5c9a('0x73')]['push']({'id':0x0,'priority':_0x3a938a[_0x5c9a('0x73')][_0x5c9a('0x46')]+0x1,'app':_0x5c9a('0xa2'),'appdata':_0x5c9a('0xa3'),'interval':_0x5c9a('0xa4')});}_0x3a938a['interaction'][_0x5c9a('0xa0')]=!![];}return db[_0x5c9a('0xa5')][_0x5c9a('0x58')]({'phone':_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0x7f')],'messageId':_0x3a938a['body']['messageId'],'body':_0x3a938a['body'][_0x5c9a('0x59')],'SmsAccountId':_0x55a0e7[_0x5c9a('0x55')]['id'],'SmsInteractionId':_0x23ed72['id'],'direction':'in','ContactId':_0x23ed72[_0x5c9a('0xa6')],'AttachmentId':_0x3a938a[_0x5c9a('0x59')][_0x5c9a('0xa7')]});})[_0x5c9a('0x35')](function(_0x1c0147){_0x3a938a[_0x5c9a('0x25')]=_0x1c0147;if(_0x3a938a[_0x5c9a('0x9f')][_0x5c9a('0xa8')]){return db['User'][_0x5c9a('0x57')]({'attributes':['id',_0x5c9a('0x38')],'where':{'id':_0x3a938a[_0x5c9a('0x9f')][_0x5c9a('0xa8')]}})[_0x5c9a('0x35')](function(_0x35a68f){if(_0x35a68f){_0x3a938a['applications'][_0x5c9a('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x35a68f[_0x5c9a('0x38')]+','+(_0x3a938a['account'][_0x5c9a('0xaa')]||0xa),'interval':_0x5c9a('0xa4')});}return respondWithRpcPromise(_0x5c9a('0xab'),_0x5c9a('0xac'),_0x3a938a);});}return respondWithRpcPromise(_0x5c9a('0xab'),_0x5c9a('0xac'),_0x3a938a);})[_0x5c9a('0x35')](function(_0x573b81){if(_0x573b81){var _0x2ffa6a=0xc8;var _0x4d14e1=_0x5c9a('0xad');logger['info'](_0x5c9a('0x22'),_0x4d14e1,_0x2ffa6a,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4d14e1,_0x2ffa6a,_0x5c9a('0xae'),JSON['stringify'](_0x573b81));if(_0x3a938a['account'][_0x5c9a('0x4e')]===_0x5c9a('0x7e')){return _0x2c39f7[_0x5c9a('0x2a')](_0x2ffa6a)[_0x5c9a('0x30')](_0x5c9a('0xaf'),'text/xml')['send'](_0x5c9a('0xb0'));}else{return _0x2c39f7[_0x5c9a('0x2a')](_0x2ffa6a)[_0x5c9a('0x2c')](_0x573b81);}}})[_0x5c9a('0x28')](handleError(_0x2c39f7,null));};exports[_0x5c9a('0xb1')]=function(_0x4ede6e,_0x1788dc){var _0x55020e=_0x4ede6e[_0x5c9a('0x55')]['id'];var _0x58aaf6=_0x4ede6e[_0x5c9a('0x59')];var _0x62127f=0xc8;var _0x5ca25e=null;return db[_0x5c9a('0xb2')][_0x5c9a('0xb3')]({'isolationLevel':db[_0x5c9a('0xb2')][_0x5c9a('0xb4')][_0x5c9a('0xb5')][_0x5c9a('0xb6')]},function(_0x167052){return db[_0x5c9a('0x3d')][_0x5c9a('0x65')]({'where':{'id':_0x55020e},'transaction':_0x167052})['then'](function(_0x23f880){if(_0x23f880){return db['SmsApplication'][_0x5c9a('0x34')]({'where':{'SmsAccountId':_0x55020e},'transaction':_0x167052})['then'](function(){var _0x2c848a=_[_0x5c9a('0x3c')](_0x58aaf6,function(_0x4e7b1e){_0x4e7b1e['SmsAccountId']=_0x55020e;return _0x4e7b1e;});return db[_0x5c9a('0x70')]['bulkCreate'](_0x2c848a,{'transaction':_0x167052});});}else{_0x62127f=0x194;_0x5ca25e=[];}});})[_0x5c9a('0x35')](function(){if(_0x62127f!==0x194){return db[_0x5c9a('0x70')][_0x5c9a('0xb7')]({'where':{'SmsAccountId':_0x55020e},'order':_0x5c9a('0x74')})[_0x5c9a('0x35')](function(_0x559135){_0x5ca25e=_0x559135;});}})['catch'](function(_0x393543){_0x62127f=0x1f4;logger[_0x5c9a('0x24')](_0x393543['stack']);if(_0x393543[_0x5c9a('0x38')]){delete _0x393543[_0x5c9a('0x38')];}_0x5ca25e=_0x393543;})[_0x5c9a('0xb8')](function(){if(_0x5ca25e===null){_0x1788dc['sendStatus'](_0x62127f);}else{if(_0x62127f===0x1f4){_0x1788dc[_0x5c9a('0x2a')](_0x62127f)[_0x5c9a('0x39')](_0x5ca25e);}else{_0x1788dc['status'](_0x62127f)[_0x5c9a('0x2c')](_0x5ca25e);}}});};exports[_0x5c9a('0xb9')]=function(_0x30cf1b,_0x4a9ec3,_0x3447ef){var _0x196d3b={};var _0x2136a7={};var _0x382008;var _0x34c7cf;return db[_0x5c9a('0x3d')]['findOne']({'where':{'id':_0x30cf1b['params']['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x4a9ec3,null))['then'](function(_0x273695){if(_0x273695){_0x382008=_0x273695;_0x2136a7[_0x5c9a('0x43')]=_['keys'](db[_0x5c9a('0x70')]['rawAttributes']);_0x2136a7['query']=_[_0x5c9a('0x56')](_0x30cf1b[_0x5c9a('0x40')]);_0x2136a7[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x2136a7[_0x5c9a('0x43')],_0x2136a7[_0x5c9a('0x40')]);_0x196d3b[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x2136a7['model'],qs[_0x5c9a('0x45')](_0x30cf1b[_0x5c9a('0x40')]['fields']));_0x196d3b[_0x5c9a('0x44')]=_0x196d3b[_0x5c9a('0x44')][_0x5c9a('0x46')]?_0x196d3b[_0x5c9a('0x44')]:_0x2136a7[_0x5c9a('0x43')];_0x196d3b[_0x5c9a('0x4a')]=qs[_0x5c9a('0x4b')](_0x30cf1b[_0x5c9a('0x40')]['sort']);_0x196d3b[_0x5c9a('0x4c')]=qs[_0x5c9a('0x41')](_[_0x5c9a('0x66')](_0x30cf1b[_0x5c9a('0x40')],_0x2136a7['filters']));if(_0x30cf1b[_0x5c9a('0x40')]['filter']){_0x196d3b[_0x5c9a('0x4c')]=_['merge'](_0x196d3b[_0x5c9a('0x4c')],{'$or':_[_0x5c9a('0x3c')](_0x196d3b['attributes'],function(_0x1539d4){var _0x2be2eb={};_0x2be2eb[_0x1539d4]={'$like':'%'+_0x30cf1b[_0x5c9a('0x40')][_0x5c9a('0x4d')]+'%'};return _0x2be2eb;})});}_0x196d3b=_['merge']({},_0x196d3b,_0x30cf1b['options']);return _0x382008[_0x5c9a('0xb9')](_0x196d3b);}})[_0x5c9a('0x35')](function(_0x552b4b){if(_0x552b4b){_0x34c7cf=_0x552b4b[_0x5c9a('0x46')];if(!_0x30cf1b[_0x5c9a('0x40')][_0x5c9a('0x47')](_0x5c9a('0x48'))){_0x196d3b['limit']=qs[_0x5c9a('0x49')](_0x30cf1b[_0x5c9a('0x40')][_0x5c9a('0x49')]);_0x196d3b[_0x5c9a('0x2d')]=qs[_0x5c9a('0x2d')](_0x30cf1b[_0x5c9a('0x40')]['offset']);}return _0x382008[_0x5c9a('0xb9')](_0x196d3b);}})['then'](function(_0x402dbc){if(_0x402dbc){return _0x402dbc?{'count':_0x34c7cf,'rows':_0x402dbc}:null;}})[_0x5c9a('0x35')](respondWithResult(_0x4a9ec3,null))[_0x5c9a('0x28')](handleError(_0x4a9ec3,null));};exports[_0x5c9a('0xba')]=function(_0x12d1a4,_0x20d6c7,_0x4ef460){var _0x5f0a8c={'raw':![],'where':{}};var _0x1a20ee={};var _0x4b9dd6={'count':0x0,'rows':[]};return db[_0x5c9a('0x3d')]['findOne']({'where':{'id':_0x12d1a4['params']['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x20d6c7,null))[_0x5c9a('0x35')](function(_0x5e317e){if(_0x5e317e){_0x1a20ee[_0x5c9a('0x43')]=_['keys'](db['SmsInteraction'][_0x5c9a('0x3e')]);_0x1a20ee[_0x5c9a('0x40')]=_[_0x5c9a('0x56')](_0x12d1a4[_0x5c9a('0x40')]);_0x1a20ee[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x1a20ee[_0x5c9a('0x43')],_0x1a20ee[_0x5c9a('0x40')]);_0x5f0a8c[_0x5c9a('0x44')]=_[_0x5c9a('0x42')](_0x1a20ee[_0x5c9a('0x43')],qs[_0x5c9a('0x45')](_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x45')]));_0x5f0a8c[_0x5c9a('0x44')]=_0x5f0a8c[_0x5c9a('0x44')]['length']?_0x5f0a8c[_0x5c9a('0x44')]:_0x1a20ee[_0x5c9a('0x43')];if(!_0x12d1a4['query'][_0x5c9a('0x47')](_0x5c9a('0x48'))){_0x5f0a8c[_0x5c9a('0x49')]=qs['limit'](_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x49')]);_0x5f0a8c[_0x5c9a('0x2d')]=qs[_0x5c9a('0x2d')](_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x2d')]);}_0x5f0a8c[_0x5c9a('0x4a')]=qs[_0x5c9a('0x4b')](_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x4b')]);_0x5f0a8c[_0x5c9a('0x4c')]=qs[_0x5c9a('0x41')](_[_0x5c9a('0x66')](_0x12d1a4[_0x5c9a('0x40')],_0x1a20ee[_0x5c9a('0x41')]));_0x5f0a8c['where']['SmsAccountId']=_0x5e317e['id'];if(_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x4d')]){_0x5f0a8c[_0x5c9a('0x4c')]=_[_0x5c9a('0x50')](_0x5f0a8c[_0x5c9a('0x4c')],{'$or':_[_0x5c9a('0x3c')](_0x5f0a8c[_0x5c9a('0x44')],function(_0x1ce3ab){var _0xb9c0c8={};_0xb9c0c8[_0x1ce3ab]={'$like':'%'+_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x4d')]+'%'};return _0xb9c0c8;})});}_0x5f0a8c=_[_0x5c9a('0x50')]({},_0x5f0a8c,_0x12d1a4[_0x5c9a('0x51')]);return db['SmsInteraction'][_0x5c9a('0x2f')]({'where':_0x5f0a8c[_0x5c9a('0x4c')]})[_0x5c9a('0x35')](function(_0xf73534){_0x4b9dd6[_0x5c9a('0x2f')]=_0xf73534;if(_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0x67')]){_0x5f0a8c[_0x5c9a('0x52')]=[{'model':db[_0x5c9a('0x98')],'as':_0x5c9a('0xbb'),'required':![]},{'model':db[_0x5c9a('0xbc')],'as':_0x5c9a('0xbd'),'attributes':[_0x5c9a('0x38'),'fullname',_0x5c9a('0xbe')],'required':![]},{'model':db[_0x5c9a('0xbf')],'as':'Tags','attributes':['id',_0x5c9a('0x38'),'color'],'where':_0x12d1a4['query']['tag']?{'id':_0x12d1a4[_0x5c9a('0x40')]['tag']}:undefined,'required':_0x12d1a4[_0x5c9a('0x40')][_0x5c9a('0xc0')]?!![]:![]}];}return db[_0x5c9a('0x9d')][_0x5c9a('0x53')](_0x5f0a8c);})['then'](function(_0x40a82f){_0x4b9dd6[_0x5c9a('0x54')]=_0x40a82f;return _0x4b9dd6;});}})[_0x5c9a('0x35')](respondWithFilteredResult(_0x20d6c7,_0x5f0a8c))[_0x5c9a('0x28')](handleError(_0x20d6c7,null));};exports[_0x5c9a('0x39')]=function(_0x10cca0,_0x4f10c0,_0x440eb7){var _0x16dbff,_0x531983,_0x28b720;if(_[_0x5c9a('0x91')](_0x10cca0[_0x5c9a('0x59')][_0x5c9a('0x59')])||_0x10cca0['body'][_0x5c9a('0x59')]===''){throw new db[(_0x5c9a('0x76'))][(_0x5c9a('0x77'))](_0x5c9a('0x93'));}if(_['isNil'](_0x10cca0[_0x5c9a('0x59')]['to'])){throw new db[(_0x5c9a('0x76'))][(_0x5c9a('0x77'))](_0x5c9a('0xc1'));}_0x16dbff=_0x10cca0[_0x5c9a('0x59')]['to'];return db[_0x5c9a('0x3d')]['find']({'where':{'id':_0x10cca0[_0x5c9a('0x55')]['id']},'include':[{'model':db[_0x5c9a('0xc2')],'as':_0x5c9a('0xc3'),'include':[{'model':db[_0x5c9a('0x98')],'as':_0x5c9a('0x99'),'where':{'mobile':_0x16dbff},'limit':0x1,'order':[[_0x5c9a('0x7b'),_0x5c9a('0xc4')]]}]}]})['then'](handleEntityNotFound(_0x4f10c0,null))[_0x5c9a('0x35')](function(_0x22b4d0){if(_0x22b4d0&&_0x22b4d0[_0x5c9a('0xc3')]){_0x531983=_0x22b4d0[_0x5c9a('0x36')]({'plain':!![]});if(_0x531983['List']&&_0x531983[_0x5c9a('0xc3')]['Contacts'][_0x5c9a('0x46')]){return _0x531983[_0x5c9a('0xc3')]['Contacts'][0x0];}return db[_0x5c9a('0x98')]['create'](_[_0x5c9a('0x18')](_0x10cca0[_0x5c9a('0x59')],{'firstName':_0x16dbff,'mobile':_0x16dbff,'phone':_0x16dbff,'ListId':_0x531983[_0x5c9a('0x97')]}));}})[_0x5c9a('0x35')](handleEntityNotFound(_0x4f10c0,null))[_0x5c9a('0x35')](function(_0xb15b28){if(_0xb15b28){_0x28b720=_0xb15b28;return db[_0x5c9a('0x9d')][_0x5c9a('0x57')]({'where':{'ContactId':_0x28b720['id'],'closed':![],'SmsAccountId':_0x531983['id']}})['then'](function(_0x859b45){if(_0x859b45){return[_0x859b45,![]];}return db[_0x5c9a('0x9d')][_0x5c9a('0x58')]({'UserId':_0x10cca0[_0x5c9a('0x5a')]['id'],'ContactId':_0x28b720['id'],'SmsAccountId':_0x531983['id'],'phone':_0x16dbff,'firstMsgDirection':_0x5c9a('0xc5'),'Messages':[_['merge'](_0x10cca0[_0x5c9a('0x59')],{'read':![],'body':_0x10cca0['body'][_0x5c9a('0x59')],'phone':_0x16dbff,'SmsAccountId':_0x531983['id'],'UserId':_0x10cca0[_0x5c9a('0x5a')]['id'],'ContactId':_0x28b720['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x5c9a('0x35')](function(_0x369c5c){return[_0x369c5c,!![]];});});}})['spread'](function(_0x1ed351,_0x3a9e93){if(_0x3a9e93){return _0x1ed351;}return db[_0x5c9a('0xa5')]['create'](_['merge'](_0x10cca0[_0x5c9a('0x59')],{'read':![],'body':_0x10cca0[_0x5c9a('0x59')]['body'],'phone':_0x16dbff,'SmsAccountId':_0x531983['id'],'SmsInteractionId':_0x1ed351['id'],'UserId':_0x10cca0['user']['id'],'ContactId':_0x28b720['id']}))[_0x5c9a('0x35')](function(_0x5b07b8){_0x1ed351['dataValues'][_0x5c9a('0xc6')]=[];_0x1ed351['dataValues'][_0x5c9a('0xc6')][_0x5c9a('0xc7')](_0x5b07b8[_0x5c9a('0xc8')]);return _0x1ed351;});})[_0x5c9a('0x35')](respondWithResult(_0x4f10c0,null))[_0x5c9a('0x28')](handleError(_0x4f10c0,null));};exports[_0x5c9a('0x2a')]=function(_0x32db3f,_0x3fae52,_0x1b9278){if(_0x32db3f[_0x5c9a('0x59')]['id']){delete _0x32db3f['body']['id'];}var _0x2583f5,_0x87c74f,_0x3717ca;return db[_0x5c9a('0x3d')]['find']({'where':{'id':_0x32db3f[_0x5c9a('0x55')]['id']}})['then'](handleEntityNotFound(_0x3fae52,null))['then'](function(_0x14350c){if(_0x14350c){_0x3717ca=_0x14350c;logger[_0x5c9a('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c9a('0x2a'),_0x5c9a('0xc9'),_0x14350c[_0x5c9a('0x4e')],util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));switch(_0x14350c[_0x5c9a('0x4e')]){case _0x5c9a('0x83'):if(_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xcb')]&&_0x32db3f['body'][_0x5c9a('0x2a')]){_0x87c74f=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x32db3f['body'][_0x5c9a('0xcc')]&&_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xcd')]){_0x87c74f=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xcd')];return db[_0x5c9a('0xa5')][_0x5c9a('0x57')]({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xcc')]}});}break;case _0x5c9a('0x86'):if(_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x88')]&&_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xce')]){_0x87c74f=_0x32db3f['body']['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x88')]}});}break;case'infobip':var _0x2284a9=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x8b')][0x0];if(_0x2284a9[_0x5c9a('0x87')]&&_0x2284a9['status'][_0x5c9a('0xcf')]===_0x5c9a('0xd0')){_0x87c74f=_0x2284a9[_0x5c9a('0x2a')]['groupName'];return db[_0x5c9a('0xa5')]['find']({'where':{'messageId':_0x2284a9[_0x5c9a('0x87')]}});}break;case'clickatell':if(_0x32db3f['body'][_0x5c9a('0x87')]&&_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x2a')]){_0x87c74f=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x2a')];return db[_0x5c9a('0xa5')]['find']({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x87')]}});}break;case _0x5c9a('0xd1'):if(_0x32db3f[_0x5c9a('0x59')][0x0][_0x5c9a('0x25')]['id']){_0x87c74f=_0x32db3f[_0x5c9a('0x59')][0x0]['type'];return db['SmsMessage'][_0x5c9a('0x57')]({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')][0x0][_0x5c9a('0x25')]['id']}});}break;case _0x5c9a('0x8f'):if(_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xd2')]&&_0x32db3f[_0x5c9a('0x59')]['status']){_0x87c74f=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x2a')];return db[_0x5c9a('0xa5')][_0x5c9a('0x57')]({'where':{'messageId':_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xd2')]}});}break;}}})[_0x5c9a('0x35')](handleEntityNotFound(_0x3fae52,null))[_0x5c9a('0x35')](function(_0x471052){if(_0x471052){_0x2583f5=_0x471052;switch(_0x3717ca[_0x5c9a('0x4e')]){case _0x5c9a('0x83'):if(_0x87c74f===_0x5c9a('0xd0')){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger[_0x5c9a('0x24')](_0x5c9a('0x22'),'status',_0x5c9a('0x83'),util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x87c74f==='1'){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c9a('0x2a'),'skebby',util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x5c9a('0x86'):if(!_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0xd4')]&&_0x87c74f>=0xc8&&_0x87c74f<=0xce){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger['error'](_0x5c9a('0x22'),'status',_0x5c9a('0x86'),util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x5c9a('0x8a'):var _0x4afdb1=_0x32db3f[_0x5c9a('0x59')][_0x5c9a('0x8b')][0x0];if(_0x4afdb1[_0x5c9a('0x2a')][_0x5c9a('0xcf')]===_0x5c9a('0xd0')){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger['error'](_0x5c9a('0x22'),'status',_0x5c9a('0x8a'),util['inspect'](_0x32db3f['body'],{'showHidden':![],'depth':null}));}break;case _0x5c9a('0xd5'):if(_0x87c74f==_0x5c9a('0xd6')||_0x87c74f=='RECEIVED_BY_RECIPIENT'){return _0x2583f5['update']({'read':!![]});}else{logger['error'](_0x5c9a('0x22'),_0x5c9a('0x2a'),_0x5c9a('0xd5'),util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x5c9a('0xd1'):if(_0x87c74f=='message-delivered'){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger[_0x5c9a('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c9a('0x2a'),'bandwidth',util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x5c9a('0x8f'):if(_0x87c74f==='DELIVRD'||_0x87c74f===_0x5c9a('0xd7')){return _0x2583f5[_0x5c9a('0xd3')]({'read':!![]});}else{logger['error'](_0x5c9a('0x22'),_0x5c9a('0x2a'),_0x5c9a('0x8f'),util[_0x5c9a('0xca')](_0x32db3f[_0x5c9a('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2583f5;}})['then'](respondWithResult(_0x3fae52,null))[_0x5c9a('0x28')](handleError(_0x3fae52,null));};exports[_0x5c9a('0xd8')]=function(_0x2c59b6,_0x149a11,_0x64afb){var _0x3ca54a,_0x56527d,_0x3c6935;return db[_0x5c9a('0x3d')][_0x5c9a('0x57')]({'where':{'id':_0x2c59b6[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x149a11,null))['then'](function(_0x3aa53b){if(_0x3aa53b){_0x3c6935=_0x3aa53b;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5c9a('0x2a'),'received\x20delivery\x20report\x20from',_0x3aa53b['type'],util['inspect'](_0x2c59b6[_0x5c9a('0x40')],{'showHidden':![],'depth':null}));switch(_0x3aa53b[_0x5c9a('0x4e')]){case _0x5c9a('0xd9'):if(_0x2c59b6[_0x5c9a('0x40')][_0x5c9a('0xda')]&&_0x2c59b6[_0x5c9a('0x40')][_0x5c9a('0xdb')]){_0x56527d=_0x2c59b6['query'][_0x5c9a('0xdb')];return db['SmsMessage']['find']({'where':{'messageId':_0x2c59b6[_0x5c9a('0x40')][_0x5c9a('0xda')]}});}break;}}})[_0x5c9a('0x35')](handleEntityNotFound(_0x149a11,null))[_0x5c9a('0x35')](function(_0x402b2a){if(_0x402b2a){_0x3ca54a=_0x402b2a;switch(_0x3c6935[_0x5c9a('0x4e')]){case _0x5c9a('0xd9'):if(_0x56527d==='2'||_0x56527d==='6'){return _0x3ca54a[_0x5c9a('0xd3')]({'read':!![]});}else{logger[_0x5c9a('0x24')](_0x5c9a('0x22'),_0x5c9a('0x2a'),_0x5c9a('0xd9'),util[_0x5c9a('0xca')](_0x2c59b6['query'],{'showHidden':![],'depth':null}));};break;}return _0x3ca54a;}})[_0x5c9a('0x35')](respondWithResult(_0x149a11,null))[_0x5c9a('0x28')](handleError(_0x149a11,null));};exports[_0x5c9a('0xdc')]=function(_0x4481a1,_0x8ba33d,_0x1eaf69){return db[_0x5c9a('0x3d')]['find']({'where':{'id':_0x4481a1['params']['id']}})['then'](handleEntityNotFound(_0x8ba33d,null))[_0x5c9a('0x35')](function(_0x48a9f5){if(_0x48a9f5){return _0x48a9f5[_0x5c9a('0xdc')](_0x4481a1[_0x5c9a('0x59')][_0x5c9a('0x69')],_[_0x5c9a('0x9b')](_0x4481a1[_0x5c9a('0x59')],[_0x5c9a('0x69'),'id'])||{})[_0x5c9a('0x9e')](function(_0xd28868){for(var _0x226d6d=0x0;_0x226d6d<_0x4481a1[_0x5c9a('0x59')][_0x5c9a('0x69')][_0x5c9a('0x46')];_0x226d6d+=0x1){socket['emit'](_0x5c9a('0xdd'),{'UserId':Number(_0x4481a1[_0x5c9a('0x59')]['ids'][_0x226d6d]),'SmsAccountId':Number(_0x4481a1['params']['id'])});}return _0xd28868;});}})[_0x5c9a('0x35')](respondWithResult(_0x8ba33d,null))[_0x5c9a('0x28')](handleError(_0x8ba33d,null));};exports[_0x5c9a('0xde')]=function(_0x3135cb,_0x22a2e5,_0x2087a5){return db['SmsAccount'][_0x5c9a('0x57')]({'where':{'id':_0x3135cb[_0x5c9a('0x55')]['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x22a2e5,null))['then'](function(_0x49164f){if(_0x49164f){return _0x49164f[_0x5c9a('0xde')](_0x3135cb[_0x5c9a('0x40')][_0x5c9a('0x69')])[_0x5c9a('0x35')](function(){if(_[_0x5c9a('0xdf')](_0x3135cb[_0x5c9a('0x40')][_0x5c9a('0x69')])){for(var _0x9b8dbb=0x0;_0x9b8dbb<_0x3135cb[_0x5c9a('0x40')][_0x5c9a('0x69')][_0x5c9a('0x46')];_0x9b8dbb+=0x1){socket[_0x5c9a('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x3135cb['query'][_0x5c9a('0x69')][_0x9b8dbb]),'SmsAccountId':Number(_0x3135cb[_0x5c9a('0x55')]['id'])});}}else{socket[_0x5c9a('0xe0')](_0x5c9a('0xe1'),{'UserId':Number(_0x3135cb['query'][_0x5c9a('0x69')]),'SmsAccountId':Number(_0x3135cb[_0x5c9a('0x55')]['id'])});}});}})[_0x5c9a('0x35')](respondWithStatusCode(_0x22a2e5,null))[_0x5c9a('0x28')](handleError(_0x22a2e5,null));};exports[_0x5c9a('0xe2')]=function(_0x50d46c,_0x35f36f,_0x20c5e6){var _0x2151e4={};var _0x23df90={};var _0x423e5e;var _0x3179b0;return db['SmsAccount']['findOne']({'where':{'id':_0x50d46c['params']['id']}})[_0x5c9a('0x35')](handleEntityNotFound(_0x35f36f,null))[_0x5c9a('0x35')](function(_0x35911e){if(_0x35911e){_0x423e5e=_0x35911e;_0x23df90['model']=_[_0x5c9a('0x56')](db[_0x5c9a('0xbc')][_0x5c9a('0x3e')]);_0x23df90[_0x5c9a('0x40')]=_[_0x5c9a('0x56')](_0x50d46c[_0x5c9a('0x40')]);_0x23df90[_0x5c9a('0x41')]=_[_0x5c9a('0x42')](_0x23df90[_0x5c9a('0x43')],_0x23df90['query']);_0x2151e4['attributes']=_[_0x5c9a('0x42')](_0x23df90['model'],qs[_0x5c9a('0x45')](_0x50d46c['query'][_0x5c9a('0x45')]));_0x2151e4[_0x5c9a('0x44')]=_0x2151e4[_0x5c9a('0x44')]['length']?_0x2151e4[_0x5c9a('0x44')]:_0x23df90[_0x5c9a('0x43')];_0x2151e4[_0x5c9a('0x4a')]=qs[_0x5c9a('0x4b')](_0x50d46c['query'][_0x5c9a('0x4b')]);_0x2151e4[_0x5c9a('0x4c')]=qs[_0x5c9a('0x41')](_[_0x5c9a('0x66')](_0x50d46c[_0x5c9a('0x40')],_0x23df90['filters']));if(_0x50d46c[_0x5c9a('0x40')]['filter']){_0x2151e4[_0x5c9a('0x4c')]=_[_0x5c9a('0x50')](_0x2151e4['where'],{'$or':_[_0x5c9a('0x3c')](_0x2151e4[_0x5c9a('0x44')],function(_0x471246){var _0x55bab5={};_0x55bab5[_0x471246]={'$like':'%'+_0x50d46c[_0x5c9a('0x40')][_0x5c9a('0x4d')]+'%'};return _0x55bab5;})});}_0x2151e4=_[_0x5c9a('0x50')]({},_0x2151e4,_0x50d46c['options']);return _0x423e5e[_0x5c9a('0xe2')](_0x2151e4);}})[_0x5c9a('0x35')](function(_0x28158c){if(_0x28158c){_0x3179b0=_0x28158c[_0x5c9a('0x46')];if(!_0x50d46c[_0x5c9a('0x40')]['hasOwnProperty'](_0x5c9a('0x48'))){_0x2151e4[_0x5c9a('0x49')]=qs[_0x5c9a('0x49')](_0x50d46c[_0x5c9a('0x40')][_0x5c9a('0x49')]);_0x2151e4[_0x5c9a('0x2d')]=qs[_0x5c9a('0x2d')](_0x50d46c[_0x5c9a('0x40')][_0x5c9a('0x2d')]);}return _0x423e5e[_0x5c9a('0xe2')](_0x2151e4);}})[_0x5c9a('0x35')](function(_0x4e8551){if(_0x4e8551){return _0x4e8551?{'count':_0x3179b0,'rows':_0x4e8551}:null;}})['then'](respondWithResult(_0x35f36f,null))['catch'](handleError(_0x35f36f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 6961b27..df41633 100644 --- a/server/api/smsAccount/smsAccount.events.js +++ b/server/api/smsAccount/smsAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7f9=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x33cca3,_0x1e954d){var _0x30f6fd=function(_0x55e587){while(--_0x55e587){_0x33cca3['push'](_0x33cca3['shift']());}};_0x30f6fd(++_0x1e954d);}(_0xa7f9,0x87));var _0x9a7f=function(_0x2007e6,_0x43b204){_0x2007e6=_0x2007e6-0x0;var _0x31a410=_0xa7f9[_0x2007e6];return _0x31a410;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x9a7f('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9a7f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a7f('0x2'),'afterDestroy':_0x9a7f('0x3')};function emitEvent(_0x53c0a9){return function(_0x5081c2,_0x150eb7,_0x1f8661){SmsAccountEvents[_0x9a7f('0x4')](_0x53c0a9+':'+_0x5081c2['id'],_0x5081c2);SmsAccountEvents[_0x9a7f('0x4')](_0x53c0a9,_0x5081c2);_0x1f8661(null);};}for(var e in events){if(events[_0x9a7f('0x5')](e)){var event=events[e];SmsAccount[_0x9a7f('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x6ac3=['hasOwnProperty','hook','SmsAccount','setMaxListeners','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ac3,0xb1));var _0x36ac=function(_0x341a64,_0x51e5ff){_0x341a64=_0x341a64-0x0;var _0xbe40f4=_0x6ac3[_0x341a64];return _0xbe40f4;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x36ac('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x36ac('0x1')](0x0);var events={'afterCreate':_0x36ac('0x2'),'afterUpdate':_0x36ac('0x3'),'afterDestroy':'remove'};function emitEvent(_0xbb0d1a){return function(_0x19222e,_0x1a44d5,_0x46998e){SmsAccountEvents[_0x36ac('0x4')](_0xbb0d1a+':'+_0x19222e['id'],_0x19222e);SmsAccountEvents[_0x36ac('0x4')](_0xbb0d1a,_0x19222e);_0x46998e(null);};}for(var e in events){if(events[_0x36ac('0x5')](e)){var event=events[e];SmsAccount[_0x36ac('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index c0d4265..645aa30 100644 --- a/server/api/smsAccount/smsAccount.model.js +++ b/server/api/smsAccount/smsAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a35=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','define','util','../../config/logger'];(function(_0xd501b,_0x570d56){var _0x26a42a=function(_0x10a148){while(--_0x10a148){_0xd501b['push'](_0xd501b['shift']());}};_0x26a42a(++_0x570d56);}(_0x3a35,0x1a2));var _0x53a3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3a35[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x53a3('0x0'));var logger=require(_0x53a3('0x1'))(_0x53a3('0x2'));var moment=require(_0x53a3('0x3'));var BPromise=require(_0x53a3('0x4'));var rp=require(_0x53a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53a3('0x6'));var config=require(_0x53a3('0x7'));var attributes=require(_0x53a3('0x8'));module['exports']=function(_0x3ad1db,_0x34533b){return _0x3ad1db[_0x53a3('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6806=['rimraf','../../config/environment','define','SmsAccount','sms_accounts','../../config/logger','api','request-promise','path'];(function(_0x27fe14,_0x70915b){var _0x2623cd=function(_0x3cd43c){while(--_0x3cd43c){_0x27fe14['push'](_0x27fe14['shift']());}};_0x2623cd(++_0x70915b);}(_0x6806,0x191));var _0x6680=function(_0x4d8742,_0xd8d845){_0x4d8742=_0x4d8742-0x0;var _0x59701d=_0x6806[_0x4d8742];return _0x59701d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6680('0x0'))(_0x6680('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6680('0x2'));var fs=require('fs');var path=require(_0x6680('0x3'));var rimraf=require(_0x6680('0x4'));var config=require(_0x6680('0x5'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x33932c,_0x20dd14){return _0x33932c[_0x6680('0x6')](_0x6680('0x7'),attributes,{'tableName':_0x6680('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 0aa1375..254bfc8 100644 --- a/server/api/smsAccount/smsAccount.rpc.js +++ b/server/api/smsAccount/smsAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2d8=['defaults','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options','where','map','model','attributes','include','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x12d014,_0x57a28b){var _0x3398de=function(_0x364e3d){while(--_0x364e3d){_0x12d014['push'](_0x12d014['shift']());}};_0x3398de(++_0x57a28b);}(_0xa2d8,0x165));var _0x8a2d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa2d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8a2d('0x0'));var moment=require(_0x8a2d('0x1'));var BPromise=require(_0x8a2d('0x2'));var rs=require(_0x8a2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a2d('0x4'))['db'];var utils=require(_0x8a2d('0x5'));var logger=require(_0x8a2d('0x6'))(_0x8a2d('0x7'));var config=require(_0x8a2d('0x8'));var jayson=require(_0x8a2d('0x9'));var client=jayson[_0x8a2d('0xa')][_0x8a2d('0xb')]({'port':0x232a});config[_0x8a2d('0xc')]=_[_0x8a2d('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8a2d('0xe'))(new Redis(config['redis']));require(_0x8a2d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5dfb0f,_0x227197,_0x4dc66a){return new BPromise(function(_0x4fe7ec,_0x10c958){return client[_0x8a2d('0x10')](_0x5dfb0f,_0x4dc66a)[_0x8a2d('0x11')](function(_0x1734f){logger['info'](_0x8a2d('0x12'),_0x227197,_0x8a2d('0x13'));logger[_0x8a2d('0x14')](_0x8a2d('0x15'),_0x227197,'request\x20sent',JSON[_0x8a2d('0x16')](_0x1734f));if(_0x1734f[_0x8a2d('0x17')]){if(_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x18')]===0x1f4){logger[_0x8a2d('0x17')](_0x8a2d('0x12'),_0x227197,_0x1734f['error'][_0x8a2d('0x19')]);return _0x10c958(_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x19')]);}logger[_0x8a2d('0x17')]('SmsAccount,\x20%s,\x20%s',_0x227197,_0x1734f[_0x8a2d('0x17')][_0x8a2d('0x19')]);return _0x4fe7ec(_0x1734f[_0x8a2d('0x17')]['message']);}else{logger[_0x8a2d('0x1a')](_0x8a2d('0x12'),_0x227197,_0x8a2d('0x13'));_0x4fe7ec(_0x1734f[_0x8a2d('0x1b')]['message']);}})[_0x8a2d('0x1c')](function(_0x222091){logger['error']('SmsAccount,\x20%s,\x20%s',_0x227197,_0x222091);_0x10c958(_0x222091);});});}exports[_0x8a2d('0x1d')]=function(_0x3a345e){var _0x502953=this;return new Promise(function(_0x2d46cf,_0x57ebcf){return db['SmsAccount'][_0x8a2d('0x1e')]({'raw':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e[_0x8a2d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e['options'][_0x8a2d('0x20')]||null:null,'attributes':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e['options']['attributes']||null:null,'include':_0x3a345e[_0x8a2d('0x1f')]?_0x3a345e[_0x8a2d('0x1f')]['include']?_[_0x8a2d('0x21')](_0x3a345e[_0x8a2d('0x1f')]['include'],function(_0x425585){return{'model':db[_0x425585[_0x8a2d('0x22')]],'as':_0x425585['as'],'attributes':_0x425585[_0x8a2d('0x23')],'include':_0x425585[_0x8a2d('0x24')]?_[_0x8a2d('0x21')](_0x425585[_0x8a2d('0x24')],function(_0x55a620){return{'model':db[_0x55a620['model']],'as':_0x55a620['as'],'attributes':_0x55a620[_0x8a2d('0x23')],'include':_0x55a620[_0x8a2d('0x24')]?_[_0x8a2d('0x21')](_0x55a620[_0x8a2d('0x24')],function(_0x27851d){return{'model':db[_0x27851d[_0x8a2d('0x22')]],'as':_0x27851d['as'],'attributes':_0x27851d['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a2d('0x11')](function(_0x496ab7){logger[_0x8a2d('0x1a')](_0x8a2d('0x1d'),_0x3a345e);logger[_0x8a2d('0x14')](_0x8a2d('0x1d'),_0x3a345e,JSON[_0x8a2d('0x16')](_0x496ab7));_0x2d46cf(_0x496ab7);})[_0x8a2d('0x1c')](function(_0x92f75c){logger[_0x8a2d('0x17')](_0x8a2d('0x1d'),_0x92f75c['message'],_0x3a345e);_0x57ebcf(_0x502953[_0x8a2d('0x17')](0x1f4,_0x92f75c['message']));});});}; \ No newline at end of file +var _0x5d6d=['localhost','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','SmsAccount','find','raw','options','where','attributes','include','map','model','ShowSmsAccount','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis'];(function(_0x215269,_0x1a436e){var _0x4343f8=function(_0xbdca07){while(--_0xbdca07){_0x215269['push'](_0x215269['shift']());}};_0x4343f8(++_0x1a436e);}(_0x5d6d,0x121));var _0xd5d6=function(_0x2be03e,_0x5abbf8){_0x2be03e=_0x2be03e-0x0;var _0x1a7d64=_0x5d6d[_0x2be03e];return _0x1a7d64;};'use strict';var _=require('lodash');var util=require(_0xd5d6('0x0'));var moment=require(_0xd5d6('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5d6('0x2'));var db=require(_0xd5d6('0x3'))['db'];var utils=require(_0xd5d6('0x4'));var logger=require(_0xd5d6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd5d6('0x6')]['http']({'port':0x232a});config[_0xd5d6('0x7')]=_['defaults'](config[_0xd5d6('0x7')],{'host':_0xd5d6('0x8'),'port':0x18eb});var socket=require(_0xd5d6('0x9'))(new Redis(config['redis']));require(_0xd5d6('0xa'))[_0xd5d6('0xb')](socket);function respondWithRpcPromise(_0x4a573d,_0x365f08,_0x4c6070){return new BPromise(function(_0x152e49,_0x37b803){return client[_0xd5d6('0xc')](_0x4a573d,_0x4c6070)[_0xd5d6('0xd')](function(_0x23989b){logger['info'](_0xd5d6('0xe'),_0x365f08,_0xd5d6('0xf'));logger['debug'](_0xd5d6('0x10'),_0x365f08,'request\x20sent',JSON[_0xd5d6('0x11')](_0x23989b));if(_0x23989b[_0xd5d6('0x12')]){if(_0x23989b[_0xd5d6('0x12')][_0xd5d6('0x13')]===0x1f4){logger[_0xd5d6('0x12')](_0xd5d6('0xe'),_0x365f08,_0x23989b['error']['message']);return _0x37b803(_0x23989b['error']['message']);}logger['error'](_0xd5d6('0xe'),_0x365f08,_0x23989b[_0xd5d6('0x12')][_0xd5d6('0x14')]);return _0x152e49(_0x23989b[_0xd5d6('0x12')]['message']);}else{logger[_0xd5d6('0x15')](_0xd5d6('0xe'),_0x365f08,_0xd5d6('0xf'));_0x152e49(_0x23989b[_0xd5d6('0x16')][_0xd5d6('0x14')]);}})['catch'](function(_0x595916){logger[_0xd5d6('0x12')]('SmsAccount,\x20%s,\x20%s',_0x365f08,_0x595916);_0x37b803(_0x595916);});});}exports['ShowSmsAccount']=function(_0x25823e){var _0x9a8a8a=this;return new Promise(function(_0x29575e,_0x9c9938){return db[_0xd5d6('0x17')][_0xd5d6('0x18')]({'raw':_0x25823e['options']?_0x25823e['options'][_0xd5d6('0x19')]===undefined?!![]:![]:!![],'where':_0x25823e[_0xd5d6('0x1a')]?_0x25823e[_0xd5d6('0x1a')][_0xd5d6('0x1b')]||null:null,'attributes':_0x25823e[_0xd5d6('0x1a')]?_0x25823e[_0xd5d6('0x1a')][_0xd5d6('0x1c')]||null:null,'include':_0x25823e[_0xd5d6('0x1a')]?_0x25823e[_0xd5d6('0x1a')][_0xd5d6('0x1d')]?_[_0xd5d6('0x1e')](_0x25823e[_0xd5d6('0x1a')][_0xd5d6('0x1d')],function(_0x1e3e6e){return{'model':db[_0x1e3e6e['model']],'as':_0x1e3e6e['as'],'attributes':_0x1e3e6e['attributes'],'include':_0x1e3e6e[_0xd5d6('0x1d')]?_['map'](_0x1e3e6e['include'],function(_0x1fc944){return{'model':db[_0x1fc944[_0xd5d6('0x1f')]],'as':_0x1fc944['as'],'attributes':_0x1fc944[_0xd5d6('0x1c')],'include':_0x1fc944['include']?_[_0xd5d6('0x1e')](_0x1fc944[_0xd5d6('0x1d')],function(_0x4d16cf){return{'model':db[_0x4d16cf[_0xd5d6('0x1f')]],'as':_0x4d16cf['as'],'attributes':_0x4d16cf['attributes']};}):[]};}):[]};}):[]:[]})[_0xd5d6('0xd')](function(_0x713b31){logger['info']('ShowSmsAccount',_0x25823e);logger['debug'](_0xd5d6('0x20'),_0x25823e,JSON[_0xd5d6('0x11')](_0x713b31));_0x29575e(_0x713b31);})['catch'](function(_0x5b009c){logger[_0xd5d6('0x12')](_0xd5d6('0x20'),_0x5b009c[_0xd5d6('0x14')],_0x25823e);_0x9c9938(_0x9a8a8a[_0xd5d6('0x12')](0x1f4,_0x5b009c[_0xd5d6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 6ec768b..e977420 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index ec93bc5..60bf888 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x519b00,_0x30427a){var _0x35ea24=function(_0x4c93f4){while(--_0x4c93f4){_0x519b00['push'](_0x519b00['shift']());}};_0x35ea24(++_0x30427a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5a94b9,_0x353ad1){_0x5a94b9=_0x5a94b9-0x0;var _0x191437=_0xedd9[_0x5a94b9];return _0x191437;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x1b4bfa,_0x398a9d){var _0x1235aa=function(_0x394580){while(--_0x394580){_0x1b4bfa['push'](_0x1b4bfa['shift']());}};_0x1235aa(++_0x398a9d);}(_0x008c,0x188));var _0xc008=function(_0x121985,_0x252db3){_0x121985=_0x121985-0x0;var _0x20bc79=_0x008c[_0x121985];return _0x20bc79;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 5803bbe..48b712b 100644 --- a/server/api/smsApplication/smsApplication.attributes.js +++ b/server/api/smsApplication/smsApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c35=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7c35,0x139));var _0x57c3=function(_0x4e79ec,_0x56d359){_0x4e79ec=_0x4e79ec-0x0;var _0x5828cd=_0x7c35[_0x4e79ec];return _0x5828cd;};'use strict';var Sequelize=require(_0x57c3('0x0'));module[_0x57c3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x57c3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x57c3('0x3')]()},'description':{'type':Sequelize[_0x57c3('0x2')]},'interval':{'type':Sequelize[_0x57c3('0x2')],'defaultValue':_0x57c3('0x4')}}; \ No newline at end of file +var _0x7341=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7341,0x18a));var _0x1734=function(_0x2659c1,_0x37819f){_0x2659c1=_0x2659c1-0x0;var _0x28a83b=_0x7341[_0x2659c1];return _0x28a83b;};'use strict';var Sequelize=require(_0x1734('0x0'));module[_0x1734('0x1')]={'priority':{'type':Sequelize[_0x1734('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1734('0x3')],'allowNull':![],'defaultValue':_0x1734('0x4')},'appdata':{'type':Sequelize[_0x1734('0x5')]()},'description':{'type':Sequelize[_0x1734('0x3')]},'interval':{'type':Sequelize[_0x1734('0x3')],'defaultValue':_0x1734('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6ef1295..4c81c75 100644 --- a/server/api/smsApplication/smsApplication.controller.js +++ b/server/api/smsApplication/smsApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b5c=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','SmsApplication','find','create','body','destroy','eml-format','rimraf','fast-json-patch'];(function(_0x2ae0a4,_0x13ff20){var _0x4aacb4=function(_0x28ccb4){while(--_0x28ccb4){_0x2ae0a4['push'](_0x2ae0a4['shift']());}};_0x4aacb4(++_0x13ff20);}(_0x1b5c,0x1b3));var _0xc1b5=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x1b5c[_0xd0a847];return _0x2536ec;};'use strict';var emlformat=require(_0xc1b5('0x0'));var rimraf=require(_0xc1b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc1b5('0x2'));var rp=require('request-promise');var moment=require(_0xc1b5('0x3'));var BPromise=require(_0xc1b5('0x4'));var Mustache=require(_0xc1b5('0x5'));var util=require('util');var path=require(_0xc1b5('0x6'));var sox=require(_0xc1b5('0x7'));var csv=require(_0xc1b5('0x8'));var ejs=require(_0xc1b5('0x9'));var fs=require('fs');var fs_extra=require(_0xc1b5('0xa'));var _=require(_0xc1b5('0xb'));var squel=require(_0xc1b5('0xc'));var crypto=require(_0xc1b5('0xd'));var jsforce=require(_0xc1b5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc1b5('0x8'));var querystring=require(_0xc1b5('0xf'));var Papa=require(_0xc1b5('0x10'));var Redis=require(_0xc1b5('0x11'));var authService=require(_0xc1b5('0x12'));var qs=require(_0xc1b5('0x13'));var as=require(_0xc1b5('0x14'));var hardwareService=require(_0xc1b5('0x15'));var logger=require(_0xc1b5('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc1b5('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10188a,_0x26bacf){_0x26bacf=_0x26bacf||0xcc;return function(_0x54db71){if(_0x54db71){return _0x10188a['sendStatus'](_0x26bacf);}return _0x10188a[_0xc1b5('0x18')](_0x26bacf)[_0xc1b5('0x19')]();};}function respondWithResult(_0x16c8db,_0x4ef618){_0x4ef618=_0x4ef618||0xc8;return function(_0x55e018){if(_0x55e018){return _0x16c8db[_0xc1b5('0x18')](_0x4ef618)['json'](_0x55e018);}};}function respondWithFilteredResult(_0x1a0001,_0xc94c55){return function(_0x23213d){if(_0x23213d){var _0x53f555=typeof _0xc94c55['offset']===_0xc1b5('0x1a')&&typeof _0xc94c55[_0xc1b5('0x1b')]===_0xc1b5('0x1a');var _0x592b13=_0x23213d['count'];var _0x33be65=_0x53f555?0x0:_0xc94c55['offset'];var _0x2b4bf2=_0x53f555?_0x23213d[_0xc1b5('0x1c')]:_0xc94c55[_0xc1b5('0x1d')]+_0xc94c55[_0xc1b5('0x1b')];var _0x1af221;if(_0x2b4bf2>=_0x592b13){_0x2b4bf2=_0x592b13;_0x1af221=0xc8;}else{_0x1af221=0xce;}_0x1a0001[_0xc1b5('0x18')](_0x1af221);return _0x1a0001[_0xc1b5('0x1e')](_0xc1b5('0x1f'),_0x33be65+'-'+_0x2b4bf2+'/'+_0x592b13)[_0xc1b5('0x20')](_0x23213d);}return null;};}function patchUpdates(_0xc7ef72){return function(_0x3d6664){try{jsonpatch[_0xc1b5('0x21')](_0x3d6664,_0xc7ef72,!![]);}catch(_0x5ed1b9){return BPromise['reject'](_0x5ed1b9);}return _0x3d6664[_0xc1b5('0x22')]();};}function saveUpdates(_0xf557e5,_0x3cfd85){return function(_0x22d438){if(_0x22d438){return _0x22d438['update'](_0xf557e5)[_0xc1b5('0x23')](function(_0x53a3ba){return _0x53a3ba;});}return null;};}function removeEntity(_0x5065fe,_0x334164){return function(_0x4f1fdf){if(_0x4f1fdf){return _0x4f1fdf['destroy']()[_0xc1b5('0x23')](function(){_0x5065fe[_0xc1b5('0x18')](0xcc)[_0xc1b5('0x19')]();});}};}function handleEntityNotFound(_0x331542,_0x3552fa){return function(_0x3d53c3){if(!_0x3d53c3){_0x331542[_0xc1b5('0x24')](0x194);}return _0x3d53c3;};}function handleError(_0xc8060c,_0x1cdc2d){_0x1cdc2d=_0x1cdc2d||0x1f4;return function(_0xa89742){logger[_0xc1b5('0x25')](_0xa89742[_0xc1b5('0x26')]);if(_0xa89742['name']){delete _0xa89742[_0xc1b5('0x27')];}_0xc8060c[_0xc1b5('0x18')](_0x1cdc2d)[_0xc1b5('0x28')](_0xa89742);};}exports['index']=function(_0x2f0215,_0x26c48e){var _0xf91be4={},_0x43cb5d={},_0x5cc4f0={'count':0x0,'rows':[]};var _0x441cc9=_[_0xc1b5('0x29')](db['SmsApplication'][_0xc1b5('0x2a')],function(_0x864bb2){return{'name':_0x864bb2[_0xc1b5('0x2b')],'type':_0x864bb2[_0xc1b5('0x2c')]['key']};});_0x43cb5d[_0xc1b5('0x2d')]=_[_0xc1b5('0x29')](_0x441cc9,_0xc1b5('0x27'));_0x43cb5d['query']=_[_0xc1b5('0x2e')](_0x2f0215[_0xc1b5('0x2f')]);_0x43cb5d[_0xc1b5('0x30')]=_[_0xc1b5('0x31')](_0x43cb5d[_0xc1b5('0x2d')],_0x43cb5d[_0xc1b5('0x2f')]);_0xf91be4[_0xc1b5('0x32')]=_[_0xc1b5('0x31')](_0x43cb5d['model'],qs[_0xc1b5('0x33')](_0x2f0215['query']['fields']));_0xf91be4['attributes']=_0xf91be4[_0xc1b5('0x32')][_0xc1b5('0x34')]?_0xf91be4[_0xc1b5('0x32')]:_0x43cb5d[_0xc1b5('0x2d')];if(!_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x35')](_0xc1b5('0x36'))){_0xf91be4[_0xc1b5('0x1b')]=qs[_0xc1b5('0x1b')](_0x2f0215['query']['limit']);_0xf91be4['offset']=qs[_0xc1b5('0x1d')](_0x2f0215[_0xc1b5('0x2f')]['offset']);}_0xf91be4['order']=qs['sort'](_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x37')]);_0xf91be4[_0xc1b5('0x38')]=qs[_0xc1b5('0x30')](_[_0xc1b5('0x39')](_0x2f0215[_0xc1b5('0x2f')],_0x43cb5d[_0xc1b5('0x30')]),_0x441cc9);if(_0x2f0215['query'][_0xc1b5('0x3a')]){_0xf91be4['where']=_[_0xc1b5('0x3b')](_0xf91be4['where'],{'$or':_['map'](_0x441cc9,function(_0x147dcb){if(_0x147dcb[_0xc1b5('0x2c')]!==_0xc1b5('0x3c')){var _0x13b460={};_0x13b460[_0x147dcb[_0xc1b5('0x27')]]={'$like':'%'+_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x3a')]+'%'};return _0x13b460;}})});}_0xf91be4=_[_0xc1b5('0x3b')]({},_0xf91be4,_0x2f0215[_0xc1b5('0x3d')]);var _0x407a39={'where':_0xf91be4[_0xc1b5('0x38')]};return db['SmsApplication'][_0xc1b5('0x1c')](_0x407a39)[_0xc1b5('0x23')](function(_0x51aaf4){_0x5cc4f0[_0xc1b5('0x1c')]=_0x51aaf4;if(_0x2f0215[_0xc1b5('0x2f')][_0xc1b5('0x3e')]){_0xf91be4[_0xc1b5('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xc1b5('0x40')](_0xf91be4);})['then'](function(_0x43607d){_0x5cc4f0[_0xc1b5('0x41')]=_0x43607d;return _0x5cc4f0;})[_0xc1b5('0x23')](respondWithFilteredResult(_0x26c48e,_0xf91be4))[_0xc1b5('0x42')](handleError(_0x26c48e,null));};exports['show']=function(_0x319d55,_0x411901){var _0x28bf78={'raw':!![],'where':{'id':_0x319d55[_0xc1b5('0x43')]['id']}},_0x37018e={};_0x37018e[_0xc1b5('0x2d')]=_[_0xc1b5('0x2e')](db['SmsApplication']['rawAttributes']);_0x37018e[_0xc1b5('0x2f')]=_[_0xc1b5('0x2e')](_0x319d55[_0xc1b5('0x2f')]);_0x37018e[_0xc1b5('0x30')]=_[_0xc1b5('0x31')](_0x37018e[_0xc1b5('0x2d')],_0x37018e[_0xc1b5('0x2f')]);_0x28bf78[_0xc1b5('0x32')]=_[_0xc1b5('0x31')](_0x37018e[_0xc1b5('0x2d')],qs[_0xc1b5('0x33')](_0x319d55['query'][_0xc1b5('0x33')]));_0x28bf78[_0xc1b5('0x32')]=_0x28bf78['attributes'][_0xc1b5('0x34')]?_0x28bf78[_0xc1b5('0x32')]:_0x37018e[_0xc1b5('0x2d')];if(_0x319d55['query'][_0xc1b5('0x3e')]){_0x28bf78[_0xc1b5('0x3f')]=[{'all':!![]}];}_0x28bf78=_[_0xc1b5('0x3b')]({},_0x28bf78,_0x319d55[_0xc1b5('0x3d')]);return db[_0xc1b5('0x44')][_0xc1b5('0x45')](_0x28bf78)[_0xc1b5('0x23')](handleEntityNotFound(_0x411901,null))[_0xc1b5('0x23')](respondWithResult(_0x411901,null))['catch'](handleError(_0x411901,null));};exports[_0xc1b5('0x46')]=function(_0x1ed427,_0x5e7362){return db[_0xc1b5('0x44')]['create'](_0x1ed427['body'],{})[_0xc1b5('0x23')](respondWithResult(_0x5e7362,0xc9))['catch'](handleError(_0x5e7362,null));};exports['update']=function(_0x4d0add,_0xcc10d4){if(_0x4d0add[_0xc1b5('0x47')]['id']){delete _0x4d0add[_0xc1b5('0x47')]['id'];}return db[_0xc1b5('0x44')]['find']({'where':{'id':_0x4d0add[_0xc1b5('0x43')]['id']}})[_0xc1b5('0x23')](handleEntityNotFound(_0xcc10d4,null))[_0xc1b5('0x23')](saveUpdates(_0x4d0add[_0xc1b5('0x47')],null))[_0xc1b5('0x23')](respondWithResult(_0xcc10d4,null))['catch'](handleError(_0xcc10d4,null));};exports[_0xc1b5('0x48')]=function(_0x1c4c90,_0x38259d){return db['SmsApplication']['find']({'where':{'id':_0x1c4c90[_0xc1b5('0x43')]['id']}})[_0xc1b5('0x23')](handleEntityNotFound(_0x38259d,null))[_0xc1b5('0x23')](removeEntity(_0x38259d,null))[_0xc1b5('0x42')](handleError(_0x38259d,null));}; \ No newline at end of file +var _0xd666=['limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','merge','type','VIRTUAL','options','where','then','includeAll','include','SmsApplication','findAll','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset'];(function(_0x3f92bc,_0x482ad4){var _0xa15d20=function(_0x1381be){while(--_0x1381be){_0x3f92bc['push'](_0x3f92bc['shift']());}};_0xa15d20(++_0x482ad4);}(_0xd666,0x1ea));var _0x6d66=function(_0x293ff3,_0xaf4417){_0x293ff3=_0x293ff3-0x0;var _0x3c6fef=_0xd666[_0x293ff3];return _0x3c6fef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d66('0x0'));var jsonpatch=require(_0x6d66('0x1'));var rp=require(_0x6d66('0x2'));var moment=require(_0x6d66('0x3'));var BPromise=require(_0x6d66('0x4'));var Mustache=require('mustache');var util=require(_0x6d66('0x5'));var path=require(_0x6d66('0x6'));var sox=require(_0x6d66('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d66('0x8'));var _=require(_0x6d66('0x9'));var squel=require(_0x6d66('0xa'));var crypto=require(_0x6d66('0xb'));var jsforce=require(_0x6d66('0xc'));var deskjs=require(_0x6d66('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6d66('0xe'));var Papa=require(_0x6d66('0xf'));var Redis=require(_0x6d66('0x10'));var authService=require(_0x6d66('0x11'));var qs=require(_0x6d66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6d66('0x13'))('api');var utils=require(_0x6d66('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6d66('0x15'));var db=require(_0x6d66('0x16'))['db'];function respondWithStatusCode(_0x7d78bf,_0x1a03fc){_0x1a03fc=_0x1a03fc||0xcc;return function(_0x42dfb0){if(_0x42dfb0){return _0x7d78bf['sendStatus'](_0x1a03fc);}return _0x7d78bf[_0x6d66('0x17')](_0x1a03fc)[_0x6d66('0x18')]();};}function respondWithResult(_0x2353ea,_0x3e455f){_0x3e455f=_0x3e455f||0xc8;return function(_0x12c358){if(_0x12c358){return _0x2353ea[_0x6d66('0x17')](_0x3e455f)[_0x6d66('0x19')](_0x12c358);}};}function respondWithFilteredResult(_0x41d861,_0x108e7e){return function(_0x247dd0){if(_0x247dd0){var _0xa5f34e=typeof _0x108e7e['offset']==='undefined'&&typeof _0x108e7e['limit']==='undefined';var _0x567616=_0x247dd0[_0x6d66('0x1a')];var _0x1fc5ab=_0xa5f34e?0x0:_0x108e7e[_0x6d66('0x1b')];var _0x176ada=_0xa5f34e?_0x247dd0[_0x6d66('0x1a')]:_0x108e7e[_0x6d66('0x1b')]+_0x108e7e[_0x6d66('0x1c')];var _0x34414a;if(_0x176ada>=_0x567616){_0x176ada=_0x567616;_0x34414a=0xc8;}else{_0x34414a=0xce;}_0x41d861[_0x6d66('0x17')](_0x34414a);return _0x41d861[_0x6d66('0x1d')](_0x6d66('0x1e'),_0x1fc5ab+'-'+_0x176ada+'/'+_0x567616)[_0x6d66('0x19')](_0x247dd0);}return null;};}function patchUpdates(_0x2c54bd){return function(_0x3db7d6){try{jsonpatch[_0x6d66('0x1f')](_0x3db7d6,_0x2c54bd,!![]);}catch(_0x48a37f){return BPromise[_0x6d66('0x20')](_0x48a37f);}return _0x3db7d6[_0x6d66('0x21')]();};}function saveUpdates(_0x53a10d,_0x4acb15){return function(_0x1d1f74){if(_0x1d1f74){return _0x1d1f74[_0x6d66('0x22')](_0x53a10d)['then'](function(_0x30532e){return _0x30532e;});}return null;};}function removeEntity(_0x200a24,_0x6db715){return function(_0xc0c0bc){if(_0xc0c0bc){return _0xc0c0bc[_0x6d66('0x23')]()['then'](function(){_0x200a24[_0x6d66('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6da4,_0x24f79d){return function(_0xfd03d1){if(!_0xfd03d1){_0x4c6da4[_0x6d66('0x24')](0x194);}return _0xfd03d1;};}function handleError(_0x3c823e,_0x34ad57){_0x34ad57=_0x34ad57||0x1f4;return function(_0x4f5f19){logger[_0x6d66('0x25')](_0x4f5f19[_0x6d66('0x26')]);if(_0x4f5f19[_0x6d66('0x27')]){delete _0x4f5f19[_0x6d66('0x27')];}_0x3c823e[_0x6d66('0x17')](_0x34ad57)[_0x6d66('0x28')](_0x4f5f19);};}exports['index']=function(_0x153874,_0x2eec99){var _0xd5e3c6={},_0x11cc79={},_0x4cf666={'count':0x0,'rows':[]};var _0x4ca2f1=_[_0x6d66('0x29')](db['SmsApplication'][_0x6d66('0x2a')],function(_0x120f21){return{'name':_0x120f21[_0x6d66('0x2b')],'type':_0x120f21['type'][_0x6d66('0x2c')]};});_0x11cc79[_0x6d66('0x2d')]=_[_0x6d66('0x29')](_0x4ca2f1,_0x6d66('0x27'));_0x11cc79[_0x6d66('0x2e')]=_[_0x6d66('0x2f')](_0x153874['query']);_0x11cc79['filters']=_['intersection'](_0x11cc79[_0x6d66('0x2d')],_0x11cc79[_0x6d66('0x2e')]);_0xd5e3c6[_0x6d66('0x30')]=_[_0x6d66('0x31')](_0x11cc79[_0x6d66('0x2d')],qs[_0x6d66('0x32')](_0x153874[_0x6d66('0x2e')][_0x6d66('0x32')]));_0xd5e3c6[_0x6d66('0x30')]=_0xd5e3c6['attributes'][_0x6d66('0x33')]?_0xd5e3c6[_0x6d66('0x30')]:_0x11cc79[_0x6d66('0x2d')];if(!_0x153874[_0x6d66('0x2e')]['hasOwnProperty'](_0x6d66('0x34'))){_0xd5e3c6[_0x6d66('0x1c')]=qs[_0x6d66('0x1c')](_0x153874['query']['limit']);_0xd5e3c6[_0x6d66('0x1b')]=qs[_0x6d66('0x1b')](_0x153874[_0x6d66('0x2e')][_0x6d66('0x1b')]);}_0xd5e3c6[_0x6d66('0x35')]=qs[_0x6d66('0x36')](_0x153874[_0x6d66('0x2e')][_0x6d66('0x36')]);_0xd5e3c6['where']=qs[_0x6d66('0x37')](_[_0x6d66('0x38')](_0x153874[_0x6d66('0x2e')],_0x11cc79['filters']),_0x4ca2f1);if(_0x153874['query'][_0x6d66('0x39')]){_0xd5e3c6['where']=_[_0x6d66('0x3a')](_0xd5e3c6['where'],{'$or':_[_0x6d66('0x29')](_0x4ca2f1,function(_0x2f8e6c){if(_0x2f8e6c[_0x6d66('0x3b')]!==_0x6d66('0x3c')){var _0x583b60={};_0x583b60[_0x2f8e6c['name']]={'$like':'%'+_0x153874[_0x6d66('0x2e')][_0x6d66('0x39')]+'%'};return _0x583b60;}})});}_0xd5e3c6=_[_0x6d66('0x3a')]({},_0xd5e3c6,_0x153874[_0x6d66('0x3d')]);var _0x13f233={'where':_0xd5e3c6[_0x6d66('0x3e')]};return db['SmsApplication'][_0x6d66('0x1a')](_0x13f233)[_0x6d66('0x3f')](function(_0x1db633){_0x4cf666['count']=_0x1db633;if(_0x153874[_0x6d66('0x2e')][_0x6d66('0x40')]){_0xd5e3c6[_0x6d66('0x41')]=[{'all':!![]}];}return db[_0x6d66('0x42')][_0x6d66('0x43')](_0xd5e3c6);})[_0x6d66('0x3f')](function(_0x10f38f){_0x4cf666['rows']=_0x10f38f;return _0x4cf666;})['then'](respondWithFilteredResult(_0x2eec99,_0xd5e3c6))[_0x6d66('0x44')](handleError(_0x2eec99,null));};exports[_0x6d66('0x45')]=function(_0x141cab,_0xb2c58a){var _0x3282={'raw':!![],'where':{'id':_0x141cab[_0x6d66('0x46')]['id']}},_0x2d688b={};_0x2d688b[_0x6d66('0x2d')]=_['keys'](db[_0x6d66('0x42')][_0x6d66('0x2a')]);_0x2d688b[_0x6d66('0x2e')]=_[_0x6d66('0x2f')](_0x141cab[_0x6d66('0x2e')]);_0x2d688b['filters']=_[_0x6d66('0x31')](_0x2d688b[_0x6d66('0x2d')],_0x2d688b['query']);_0x3282[_0x6d66('0x30')]=_[_0x6d66('0x31')](_0x2d688b[_0x6d66('0x2d')],qs[_0x6d66('0x32')](_0x141cab[_0x6d66('0x2e')][_0x6d66('0x32')]));_0x3282[_0x6d66('0x30')]=_0x3282[_0x6d66('0x30')]['length']?_0x3282[_0x6d66('0x30')]:_0x2d688b['model'];if(_0x141cab['query'][_0x6d66('0x40')]){_0x3282[_0x6d66('0x41')]=[{'all':!![]}];}_0x3282=_[_0x6d66('0x3a')]({},_0x3282,_0x141cab['options']);return db[_0x6d66('0x42')][_0x6d66('0x47')](_0x3282)[_0x6d66('0x3f')](handleEntityNotFound(_0xb2c58a,null))[_0x6d66('0x3f')](respondWithResult(_0xb2c58a,null))[_0x6d66('0x44')](handleError(_0xb2c58a,null));};exports[_0x6d66('0x48')]=function(_0x2c5a0e,_0x13ea54){return db[_0x6d66('0x42')][_0x6d66('0x48')](_0x2c5a0e[_0x6d66('0x49')],{})[_0x6d66('0x3f')](respondWithResult(_0x13ea54,0xc9))['catch'](handleError(_0x13ea54,null));};exports[_0x6d66('0x22')]=function(_0x5c7ef0,_0x23b1ba){if(_0x5c7ef0[_0x6d66('0x49')]['id']){delete _0x5c7ef0['body']['id'];}return db[_0x6d66('0x42')][_0x6d66('0x47')]({'where':{'id':_0x5c7ef0[_0x6d66('0x46')]['id']}})[_0x6d66('0x3f')](handleEntityNotFound(_0x23b1ba,null))[_0x6d66('0x3f')](saveUpdates(_0x5c7ef0['body'],null))[_0x6d66('0x3f')](respondWithResult(_0x23b1ba,null))[_0x6d66('0x44')](handleError(_0x23b1ba,null));};exports['destroy']=function(_0x9ab6dd,_0x1cd023){return db[_0x6d66('0x42')][_0x6d66('0x47')]({'where':{'id':_0x9ab6dd[_0x6d66('0x46')]['id']}})[_0x6d66('0x3f')](handleEntityNotFound(_0x1cd023,null))[_0x6d66('0x3f')](removeEntity(_0x1cd023,null))[_0x6d66('0x44')](handleError(_0x1cd023,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b857fb2..193fa34 100644 --- a/server/api/smsApplication/smsApplication.model.js +++ b/server/api/smsApplication/smsApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x321b=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x3be0af,_0x30dd0f){var _0x339a4c=function(_0x5e6204){while(--_0x5e6204){_0x3be0af['push'](_0x3be0af['shift']());}};_0x339a4c(++_0x30dd0f);}(_0x321b,0x161));var _0xb321=function(_0x58578a,_0x12b225){_0x58578a=_0x58578a-0x0;var _0x49f0a8=_0x321b[_0x58578a];return _0x49f0a8;};'use strict';var _=require(_0xb321('0x0'));var util=require('util');var logger=require(_0xb321('0x1'))(_0xb321('0x2'));var moment=require('moment');var BPromise=require(_0xb321('0x3'));var rp=require(_0xb321('0x4'));var fs=require('fs');var path=require(_0xb321('0x5'));var rimraf=require(_0xb321('0x6'));var config=require(_0xb321('0x7'));var attributes=require(_0xb321('0x8'));module[_0xb321('0x9')]=function(_0x46f15a,_0x40b90a){return _0x46f15a[_0xb321('0xa')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb321('0xb'),'collate':_0xb321('0xc')});}; \ No newline at end of file +var _0x7550=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x3bec61,_0x3a04b8){var _0x4bf6d2=function(_0x51e312){while(--_0x51e312){_0x3bec61['push'](_0x3bec61['shift']());}};_0x4bf6d2(++_0x3a04b8);}(_0x7550,0x133));var _0x0755=function(_0x118c45,_0x542683){_0x118c45=_0x118c45-0x0;var _0x3c61ef=_0x7550[_0x118c45];return _0x3c61ef;};'use strict';var _=require('lodash');var util=require(_0x0755('0x0'));var logger=require(_0x0755('0x1'))(_0x0755('0x2'));var moment=require(_0x0755('0x3'));var BPromise=require(_0x0755('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0755('0x5'));var rimraf=require(_0x0755('0x6'));var config=require(_0x0755('0x7'));var attributes=require(_0x0755('0x8'));module[_0x0755('0x9')]=function(_0x98527,_0x102eda){return _0x98527[_0x0755('0xa')](_0x0755('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0755('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c99440d..aa02863 100644 --- a/server/api/smsApplication/smsApplication.rpc.js +++ b/server/api/smsApplication/smsApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8710=['then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request'];(function(_0x56b645,_0x436a9e){var _0x5dd073=function(_0x2d80a6){while(--_0x2d80a6){_0x56b645['push'](_0x56b645['shift']());}};_0x5dd073(++_0x436a9e);}(_0x8710,0x68));var _0x0871=function(_0x1b93fe,_0x1fb6e7){_0x1b93fe=_0x1b93fe-0x0;var _0x268e0e=_0x8710[_0x1b93fe];return _0x268e0e;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var moment=require('moment');var BPromise=require(_0x0871('0x2'));var rs=require(_0x0871('0x3'));var fs=require('fs');var Redis=require(_0x0871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0871('0x5'));var logger=require(_0x0871('0x6'))('rpc');var config=require(_0x0871('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0871('0x8')][_0x0871('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18b47f,_0x846dd7,_0x3df2b3){return new BPromise(function(_0x3ed8f4,_0x47dd75){return client[_0x0871('0xa')](_0x18b47f,_0x3df2b3)[_0x0871('0xb')](function(_0x5e9ef){logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,'request\x20sent');logger[_0x0871('0xe')](_0x0871('0xf'),_0x846dd7,_0x0871('0x10'),JSON[_0x0871('0x11')](_0x5e9ef));if(_0x5e9ef[_0x0871('0x12')]){if(_0x5e9ef['error'][_0x0871('0x13')]===0x1f4){logger[_0x0871('0x12')](_0x0871('0xd'),_0x846dd7,_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);return _0x47dd75(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x5e9ef['error'][_0x0871('0x14')]);return _0x3ed8f4(_0x5e9ef[_0x0871('0x12')][_0x0871('0x14')]);}else{logger[_0x0871('0xc')](_0x0871('0xd'),_0x846dd7,_0x0871('0x10'));_0x3ed8f4(_0x5e9ef[_0x0871('0x15')][_0x0871('0x14')]);}})[_0x0871('0x16')](function(_0x4decab){logger[_0x0871('0x12')]('SmsApplication,\x20%s,\x20%s',_0x846dd7,_0x4decab);_0x47dd75(_0x4decab);});});} \ No newline at end of file +var _0x97db=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis'];(function(_0x13ebe4,_0x5c7330){var _0xe5bce2=function(_0x2f9ce7){while(--_0x2f9ce7){_0x13ebe4['push'](_0x13ebe4['shift']());}};_0xe5bce2(++_0x5c7330);}(_0x97db,0x1b4));var _0xb97d=function(_0x5ab5c6,_0x6c8f66){_0x5ab5c6=_0x5ab5c6-0x0;var _0x5c4885=_0x97db[_0x5ab5c6];return _0x5c4885;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var moment=require(_0xb97d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb97d('0x3'));var db=require(_0xb97d('0x4'))['db'];var utils=require(_0xb97d('0x5'));var logger=require(_0xb97d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb97d('0x7'));var client=jayson[_0xb97d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533149,_0x2ff80e,_0x57cbd4){return new BPromise(function(_0x20f1e1,_0x2e1230){return client['request'](_0x533149,_0x57cbd4)[_0xb97d('0x9')](function(_0xe9acff){logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,'request\x20sent');logger[_0xb97d('0xc')](_0xb97d('0xd'),_0x2ff80e,_0xb97d('0xe'),JSON[_0xb97d('0xf')](_0xe9acff));if(_0xe9acff[_0xb97d('0x10')]){if(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x11')]===0x1f4){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x2e1230(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);}logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x20f1e1(_0xe9acff[_0xb97d('0x10')]['message']);}else{logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,_0xb97d('0xe'));_0x20f1e1(_0xe9acff[_0xb97d('0x13')][_0xb97d('0x12')]);}})['catch'](function(_0x416d6a){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0x416d6a);_0x2e1230(_0x416d6a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1b2ae71..ef9610e 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x36554f,_0x3b96b0){_0x36554f=_0x36554f-0x0;var _0x5e6691=_0x757a[_0x36554f];return _0x5e6691;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x273f31,_0x33da14){var _0x240af6=function(_0x143d61){while(--_0x143d61){_0x273f31['push'](_0x273f31['shift']());}};_0x240af6(++_0x33da14);}(_0x3c81,0x102));var _0x13c8=function(_0x9cb785,_0x550691){_0x9cb785=_0x9cb785-0x0;var _0x19dee1=_0x3c81[_0x9cb785];return _0x19dee1;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 005adcd..43d3618 100644 --- a/server/api/smsInteraction/smsInteraction.attributes.js +++ b/server/api/smsInteraction/smsInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4491=['out','BOOLEAN','sequelize','exports','DATE','STRING','ENUM'];(function(_0x1e9300,_0x1cd496){var _0x39573d=function(_0x327de2){while(--_0x327de2){_0x1e9300['push'](_0x1e9300['shift']());}};_0x39573d(++_0x1cd496);}(_0x4491,0x1bb));var _0x1449=function(_0xf3fb84,_0x172dd4){_0xf3fb84=_0xf3fb84-0x0;var _0x554ea0=_0x4491[_0xf3fb84];return _0x554ea0;};'use strict';var Sequelize=require(_0x1449('0x0'));var moment=require('moment');module[_0x1449('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1449('0x2')]},'disposition':{'type':Sequelize[_0x1449('0x3')]},'secondDisposition':{'type':Sequelize[_0x1449('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1449('0x3')]},'note':{'type':Sequelize[_0x1449('0x3')]},'phone':{'type':Sequelize[_0x1449('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x1449('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1449('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1449('0x4')]('in',_0x1449('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1449('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a93=['moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x5a93,0xf6));var _0x35a9=function(_0xccd7fe,_0x5c8811){_0xccd7fe=_0xccd7fe-0x0;var _0x3d2d5d=_0x5a93[_0xccd7fe];return _0x3d2d5d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35a9('0x0'));module['exports']={'closed':{'type':Sequelize[_0x35a9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35a9('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x35a9('0x3')]},'note':{'type':Sequelize[_0x35a9('0x3')]},'phone':{'type':Sequelize[_0x35a9('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x35a9('0x4')]('in',_0x35a9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x35a9('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x35a9('0x4')]('in',_0x35a9('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x35a9('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 60a3dd4..ad5cd86 100644 --- a/server/api/smsInteraction/smsInteraction.controller.js +++ b/server/api/smsInteraction/smsInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d0e=['null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SmsInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','catch','show','params','includeAll','options','create','body','update','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','color','emit','smsInteractionTags:save','removeTags','download','join','root','server','files','attachments','User','fullname','firstName','lastName','Messages','direction','secret','SmsAccount','Account','mkdirSync','Owner','N.A.','format','closedAt','disposition','out','downloadInteraction.ejs','.pdf','Sms','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','Users','TagIds','split','forEach','push','waiting','answered','unmanaged','total','closed','UserId','talking','index','map','rawAttributes','fieldName','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','keys','some','isEmpty','SmsAccountId','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x45071a,_0x406695){var _0x4502ca=function(_0x486222){while(--_0x486222){_0x45071a['push'](_0x45071a['shift']());}};_0x4502ca(++_0x406695);}(_0x4d0e,0x15a));var _0xe4d0=function(_0xe4f9b8,_0x295102){_0xe4f9b8=_0xe4f9b8-0x0;var _0x5d1b78=_0x4d0e[_0xe4f9b8];return _0x5d1b78;};'use strict';var emlformat=require(_0xe4d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4d0('0x1'));var jsonpatch=require(_0xe4d0('0x2'));var rp=require(_0xe4d0('0x3'));var moment=require(_0xe4d0('0x4'));var BPromise=require(_0xe4d0('0x5'));var Mustache=require(_0xe4d0('0x6'));var util=require(_0xe4d0('0x7'));var path=require(_0xe4d0('0x8'));var sox=require(_0xe4d0('0x9'));var csv=require(_0xe4d0('0xa'));var ejs=require(_0xe4d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4d0('0xc'));var squel=require(_0xe4d0('0xd'));var crypto=require('crypto');var jsforce=require(_0xe4d0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe4d0('0xa'));var querystring=require(_0xe4d0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe4d0('0x10'));var qs=require(_0xe4d0('0x11'));var as=require(_0xe4d0('0x12'));var pdf=require(_0xe4d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4d0('0x14'))(_0xe4d0('0x15'));var utils=require('../../config/utils');var config=require(_0xe4d0('0x16'));var licenseUtil=require(_0xe4d0('0x17'));var db=require(_0xe4d0('0x18'))['db'];config[_0xe4d0('0x19')]=_[_0xe4d0('0x1a')](config[_0xe4d0('0x19')],{'host':_0xe4d0('0x1b'),'port':0x18eb});var socket=require(_0xe4d0('0x1c'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0xe4d0('0x1d')](socket);function respondWithStatusCode(_0x49af06,_0x5d3842){_0x5d3842=_0x5d3842||0xcc;return function(_0x4450ce){if(_0x4450ce){return _0x49af06['sendStatus'](_0x5d3842);}return _0x49af06[_0xe4d0('0x1e')](_0x5d3842)[_0xe4d0('0x1f')]();};}function respondWithResult(_0x34d63a,_0x24687e){_0x24687e=_0x24687e||0xc8;return function(_0x39c32a){if(_0x39c32a){return _0x34d63a['status'](_0x24687e)[_0xe4d0('0x20')](_0x39c32a);}};}function respondWithFilteredResult(_0x19c8eb,_0x186273){return function(_0x1b91bb){if(_0x1b91bb){var _0xf3673f=typeof _0x186273['offset']===_0xe4d0('0x21')&&typeof _0x186273[_0xe4d0('0x22')]===_0xe4d0('0x21');var _0x61115d=_0x1b91bb[_0xe4d0('0x23')];var _0x2d492b=_0xf3673f?0x0:_0x186273[_0xe4d0('0x24')];var _0x41d76a=_0xf3673f?_0x1b91bb[_0xe4d0('0x23')]:_0x186273[_0xe4d0('0x24')]+_0x186273[_0xe4d0('0x22')];var _0x5e9057;if(_0x41d76a>=_0x61115d){_0x41d76a=_0x61115d;_0x5e9057=0xc8;}else{_0x5e9057=0xce;}_0x19c8eb[_0xe4d0('0x1e')](_0x5e9057);return _0x19c8eb[_0xe4d0('0x25')](_0xe4d0('0x26'),_0x2d492b+'-'+_0x41d76a+'/'+_0x61115d)['json'](_0x1b91bb);}return null;};}function patchUpdates(_0x261b1c){return function(_0x2082be){try{jsonpatch['apply'](_0x2082be,_0x261b1c,!![]);}catch(_0x5ead45){return BPromise[_0xe4d0('0x27')](_0x5ead45);}return _0x2082be[_0xe4d0('0x28')]();};}function saveUpdates(_0x116c32,_0xec74a9){return function(_0x3d2bc9){if(_0x3d2bc9){return _0x3d2bc9['update'](_0x116c32)[_0xe4d0('0x29')](function(_0x5e0fa9){return _0x5e0fa9;});}return null;};}function removeEntity(_0x3ed0d2,_0x134378){return function(_0x4efb10){if(_0x4efb10){return _0x4efb10[_0xe4d0('0x2a')]()[_0xe4d0('0x29')](function(){_0x3ed0d2['status'](0xcc)[_0xe4d0('0x1f')]();});}};}function handleEntityNotFound(_0x4c253d,_0x59b385){return function(_0x5d288b){if(!_0x5d288b){_0x4c253d[_0xe4d0('0x2b')](0x194);}return _0x5d288b;};}function handleError(_0x5532ed,_0x665edc){_0x665edc=_0x665edc||0x1f4;return function(_0x17d603){logger['error'](_0x17d603[_0xe4d0('0x2c')]);if(_0x17d603[_0xe4d0('0x2d')]){delete _0x17d603[_0xe4d0('0x2d')];}_0x5532ed['status'](_0x665edc)[_0xe4d0('0x2e')](_0x17d603);};}function getInteractionUsers(_0x374427,_0x2f82e9){return new BPromise(function(_0x542e86,_0x45751a){try{if(_0x2f82e9[_0x374427['id']]){_0x374427[_0xe4d0('0x2f')]=_['map'](_0x2f82e9[_0x374427['id']],function(_0x29388a){return{'id':_0x29388a['id'],'fullname':_0x29388a['fullname']};});}}catch(_0x277afc){_0x45751a(_0x277afc);}_0x542e86(_0x374427);});}function getInteractionTags(_0x43a063,_0xdae2c6){return new BPromise(function(_0x5a5a4b,_0x464397){try{if(_0x43a063[_0xe4d0('0x30')]){_0x43a063['Tags']=[];_0x43a063['TagIds'][_0xe4d0('0x31')](',')[_0xe4d0('0x32')](function(_0x32437d){_0x43a063['Tags'][_0xe4d0('0x33')](_0xdae2c6[_0x32437d]);});}delete _0x43a063[_0xe4d0('0x30')];}catch(_0x41a55e){_0x464397(_0x41a55e);}_0x5a5a4b(_0x43a063);});}function updateSmsInteraction(_0x5b4ee7,_0x38af8a,_0x59a78c){return new BPromise(function(_0x4933fd,_0x4b0c93){return getInteractionUsers(_0x5b4ee7,_0x59a78c)[_0xe4d0('0x29')](function(_0x12b9fc){return getInteractionTags(_0x12b9fc,_0x38af8a);})[_0xe4d0('0x29')](function(_0x3eb34f){return getStateInteraction(_0x3eb34f);})[_0xe4d0('0x29')](function(_0x518587){_0x4933fd(_0x518587);})['catch'](function(_0x3b99df){_0x4b0c93(_0x3b99df);});});}function getStateInteraction(_0x183da8){return new BPromise(function(_0x17514d){_0x183da8[_0xe4d0('0x34')]=0x0;_0x183da8['talking']=0x0;_0x183da8[_0xe4d0('0x35')]=0x0;_0x183da8[_0xe4d0('0x36')]=0x0;_0x183da8[_0xe4d0('0x37')]=0x0;if(!_0x183da8[_0xe4d0('0x38')]&&!_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x34')]+=0x1;}if(!_0x183da8[_0xe4d0('0x38')]&&_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x3a')]+=0x1;if(_0x183da8[_0xe4d0('0x34')]){_0x183da8[_0xe4d0('0x34')]-=0x1;}}if(_0x183da8[_0xe4d0('0x38')]&&_0x183da8[_0xe4d0('0x39')]){_0x183da8[_0xe4d0('0x35')]+=0x1;if(_0x183da8[_0xe4d0('0x3a')]){_0x183da8[_0xe4d0('0x3a')]-=0x1;}}if(_0x183da8[_0xe4d0('0x38')]&&!_0x183da8[_0xe4d0('0x39')]){_0x183da8['unmanaged']+=0x1;if(_0x183da8[_0xe4d0('0x34')]){_0x183da8[_0xe4d0('0x34')]-=0x1;}}_0x183da8[_0xe4d0('0x37')]+=0x1;_0x17514d(_0x183da8);});}exports[_0xe4d0('0x3b')]=function(_0x34eda5,_0x5c36ef){var _0x78bdf6={},_0x4727f1={},_0x218bf9={'count':0x0,'rows':[]};var _0xd9f567=_[_0xe4d0('0x3c')](db['SmsInteraction'][_0xe4d0('0x3d')],function(_0x4bea45){return{'name':_0x4bea45[_0xe4d0('0x3e')],'type':_0x4bea45['type']['key']};});_0x4727f1['model']=_['map'](_0xd9f567,_0xe4d0('0x2d'));_0x4727f1['query']=_['keys'](_0x34eda5[_0xe4d0('0x3f')]);_0x4727f1[_0xe4d0('0x40')]=_[_0xe4d0('0x41')](_0x4727f1['model'],_0x4727f1[_0xe4d0('0x3f')]);_0x78bdf6[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x4727f1[_0xe4d0('0x43')],qs[_0xe4d0('0x44')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x44')]));_0x78bdf6[_0xe4d0('0x42')]=_0x78bdf6['attributes'][_0xe4d0('0x45')]?_0x78bdf6[_0xe4d0('0x42')]:_0x4727f1[_0xe4d0('0x43')];if(!_0x34eda5[_0xe4d0('0x3f')]['hasOwnProperty'](_0xe4d0('0x46'))){_0x78bdf6[_0xe4d0('0x22')]=qs[_0xe4d0('0x22')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x22')]);_0x78bdf6[_0xe4d0('0x24')]=qs[_0xe4d0('0x24')](_0x34eda5[_0xe4d0('0x3f')]['offset']);}_0x78bdf6['order']=qs[_0xe4d0('0x47')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x47')]);_0x78bdf6[_0xe4d0('0x48')]=qs[_0xe4d0('0x40')](_[_0xe4d0('0x49')](_0x34eda5['query'],_0x4727f1[_0xe4d0('0x40')]),_0xd9f567);var _0x3718cb=[];var _0x41248f=squel[_0xe4d0('0x4a')]()[_0xe4d0('0x4b')]('id')[_0xe4d0('0x4b')](_0xe4d0('0x2d'))[_0xe4d0('0x4b')]('color')[_0xe4d0('0x4c')](_0xe4d0('0x4d'));var _0x3ff5fa=squel['select']()[_0xe4d0('0x4b')](_0xe4d0('0x4e'))['field'](_0xe4d0('0x4f'))[_0xe4d0('0x4b')]('ui.SmsInteractionId')[_0xe4d0('0x4c')](_0xe4d0('0x50'),'ui')[_0xe4d0('0x51')](_0xe4d0('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x32772e=squel['select']()[_0xe4d0('0x4c')](_0xe4d0('0x53'),'i')[_0xe4d0('0x51')](_0xe4d0('0x54'),'c',_0xe4d0('0x55'))[_0xe4d0('0x51')](_0xe4d0('0x52'),'o',_0xe4d0('0x56'))['left_join']('sms_accounts','a',_0xe4d0('0x57'))[_0xe4d0('0x51')]('sms_messages','me',_0xe4d0('0x58'))['left_join'](_0xe4d0('0x59'),'it',_0xe4d0('0x5a'))[_0xe4d0('0x51')](_0xe4d0('0x4d'),'t',_0xe4d0('0x5b'));var _0x36818d=squel[_0xe4d0('0x5c')]();var _0x14c134=[];var _0x5642bb=squel['expr']();var _0x2661e9;if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x5d')]){_0x2661e9=as[_0xe4d0('0x5e')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x5d')]);var _0x3e72ff=_0x2661e9[_0xe4d0('0x5f')];for(var _0x44e44d=0x0;_0x44e44d<_0x2661e9[_0xe4d0('0x60')][_0xe4d0('0x45')];_0x44e44d++){var _0x2865a4=_0x2661e9[_0xe4d0('0x60')][_0x44e44d];var _0x256777='i';var _0x4eba71=_['find'](_0xd9f567,[_0xe4d0('0x2d'),_0x2865a4['field']]);if(!_0x4eba71){switch(_0x2865a4[_0xe4d0('0x4b')]){case _0xe4d0('0x61'):if(_0x2865a4[_0xe4d0('0x62')]==0x1){_0x32772e[_0xe4d0('0x63')]('`'+_0x2865a4[_0xe4d0('0x4b')]+_0xe4d0('0x64'));}else{_0x32772e[_0xe4d0('0x63')]('`'+_0x2865a4[_0xe4d0('0x4b')]+_0xe4d0('0x65'));}break;case _0xe4d0('0x66'):if(_0x2865a4['operator']===_0xe4d0('0x67')){if(_0x2865a4[_0xe4d0('0x62')][_0xe4d0('0x31')]('\x20')[_0xe4d0('0x45')]>0x1){_0x36818d[_0x3e72ff](_0xe4d0('0x68'),qs[_0xe4d0('0x69')](_0x2865a4[_0xe4d0('0x62')]),null);}else{var _0x3da8b4='%'+_0x2865a4[_0xe4d0('0x62')]+'%';_0x36818d[_0x3e72ff](_0xe4d0('0x6a'),_0x3da8b4,_0x3da8b4,_0x3da8b4);}}else{_0x4eba71=_[_0xe4d0('0x6b')](_0xd9f567,[_0xe4d0('0x2d'),_0xe4d0('0x6c')]);_0x2865a4['field']=_0xe4d0('0x6c');_0x494dac=as[_0xe4d0('0x6d')](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x70')],_0x494dac['value'][_0xe4d0('0x1f')]);}break;case _0xe4d0('0x71'):var _0xec6ffc=_0x2865a4[_0xe4d0('0x62')][_0xe4d0('0x31')](',')[_0xe4d0('0x3c')](function(_0x2fa7d9){return Number(_0x2fa7d9);});_0xec6ffc[_0xe4d0('0x32')](function(_0x35249b){_0x5642bb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35249b+',%');});_0x14c134=_[_0xe4d0('0x72')](_0x14c134,_0xec6ffc);break;case'User':if(_0x2865a4[_0xe4d0('0x73')]===_0xe4d0('0x67')){_0x36818d[_0x3e72ff](_0xe4d0('0x74'),'%'+_0x2865a4[_0xe4d0('0x62')]+'%',null);}else{_0x4eba71=_[_0xe4d0('0x6b')](_0xd9f567,[_0xe4d0('0x2d'),_0xe4d0('0x39')]);_0x2865a4[_0xe4d0('0x4b')]=_0xe4d0('0x39');_0x494dac=as['buildExpression'](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);}break;case'body':_0x494dac=as['buildExpression']('me',null,_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac['value'][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);break;}}else{var _0x494dac=as[_0xe4d0('0x6d')](_0x256777,_0x4eba71[_0xe4d0('0x6e')],_0x2865a4);_0x36818d[_0x3e72ff](_0x494dac[_0xe4d0('0x6f')],_0x494dac['value'][_0xe4d0('0x70')],_0x494dac[_0xe4d0('0x62')][_0xe4d0('0x1f')]);}}}else{var _0x4104a4=_(_0x34eda5['query'])[_0xe4d0('0x75')]()[_0xe4d0('0x3c')](function(_0x3bd1e6){return _[_0xe4d0('0x76')](_0xd9f567,[_0xe4d0('0x2d'),_0x3bd1e6])?_0x3bd1e6:undefined;})['compact']()['value']();if(!_[_0xe4d0('0x77')](_0x4104a4)){_0x4104a4['forEach'](function(_0x521b0c){if(_0x521b0c===_0xe4d0('0x78')){_0x32772e['where']('i.SmsAccountId\x20IN\x20?',[][_0xe4d0('0x79')](_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]));}else if(_0x521b0c===_0xe4d0('0x7a')){var _0x499c28=JSON['parse'](_0x34eda5['query'][_0x521b0c])[_0xe4d0('0x7b')];var _0x1f20dc=JSON['parse'](_0x34eda5['query'][_0x521b0c])[_0xe4d0('0x7c')];_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x7d'),_0x499c28,_0x1f20dc);}else{if(_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]===_0xe4d0('0x7e')){_0x32772e[_0xe4d0('0x48')]('i.'+_0x521b0c+_0xe4d0('0x7f'));}else{_0x32772e[_0xe4d0('0x48')]('i.'+_0x521b0c+'\x20=\x20?',_0x34eda5[_0xe4d0('0x3f')][_0x521b0c]);}}});}if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x80')]){if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x80')]==0x1){_0x32772e[_0xe4d0('0x63')](_0xe4d0('0x81'));}else{_0x32772e[_0xe4d0('0x63')](_0xe4d0('0x82'));}}if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x83')]){_0x14c134=_[_0xe4d0('0x84')](_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x83')])?_0x34eda5['query']['tag']:new Array(_0x34eda5['query'][_0xe4d0('0x83')]);_0x14c134[_0xe4d0('0x32')](function(_0x6f02d0){_0x5642bb['or'](_0xe4d0('0x85'),'%,'+_0x6f02d0+',%');});}if(_0x34eda5['query'][_0xe4d0('0x86')]){var _0x56683f=_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x86')][_0xe4d0('0x87')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x56683f)){_0x36818d['or']('i.id\x20LIKE\x20?',_0x56683f+'%')['or'](_0xe4d0('0x88'),_0x56683f+'%');}else{_0x36818d['or'](_0xe4d0('0x89'),qs[_0xe4d0('0x69')](_0x56683f))['or'](_0xe4d0('0x8a'),_0x56683f+'%');}}}_0x32772e['where'](_0x36818d);_0x32772e['group']('i.id');var _0x2b4722={'type':db[_0xe4d0('0x8b')][_0xe4d0('0x8c')][_0xe4d0('0x8d')],'raw':!![]};var _0xbe3d8b=_0x32772e['clone']();_0xbe3d8b[_0xe4d0('0x4b')]('i.id');_0xbe3d8b[_0xe4d0('0x4b')](_0xe4d0('0x8e'),_0xe4d0('0x61'));if(_0x78bdf6[_0xe4d0('0x8f')]){_0x78bdf6[_0xe4d0('0x8f')][_0xe4d0('0x32')](function(_0x187125){var _0x5b0c86=_0x187125[0x0]===_0xe4d0('0x90')?_0x187125[0x0]:'i.'+_0x187125[0x0];_0x32772e['order'](_0x5b0c86,_0x187125[0x1]===_0xe4d0('0x91')?![]:!![]);});}if(!_[_0xe4d0('0x77')](_0x14c134)){_0x32772e[_0xe4d0('0x63')](_0x5642bb);_0xbe3d8b['where'](_0xe4d0('0x92'),_0x14c134);}BPromise[_0xe4d0('0x93')]()[_0xe4d0('0x29')](function(){if(!_0x2661e9){if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x78')])return;_0xbe3d8b[_0xe4d0('0x48')](_0xe4d0('0x94'));_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x94'));return;}if(_0x34eda5[_0xe4d0('0x95')][_0xe4d0('0x96')]!==_0xe4d0('0x97'))return;return _0x34eda5[_0xe4d0('0x95')][_0xe4d0('0x98')]({'attributes':['id'],'raw':!![]})[_0xe4d0('0x29')](function(_0x9644d6){if(_[_0xe4d0('0x77')](_0x9644d6)){_0xbe3d8b[_0xe4d0('0x48')](_0xe4d0('0x99'));_0x32772e[_0xe4d0('0x48')](_0xe4d0('0x99'));}else{_0xbe3d8b['where'](_0xe4d0('0x9a'),_[_0xe4d0('0x3c')](_0x9644d6,'id'));_0x32772e['where']('i.SmsAccountId\x20IN\x20?',_[_0xe4d0('0x3c')](_0x9644d6,'id'));}});})[_0xe4d0('0x29')](function(){if(_0x34eda5['user'][_0xe4d0('0x96')]==='agent'&&!_0x2661e9&&!_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x78')])return[];return db[_0xe4d0('0x9b')][_0xe4d0('0x3f')](_0xbe3d8b['toString'](),_0x2b4722);})[_0xe4d0('0x29')](function(_0x1b1bb3){_0x218bf9[_0xe4d0('0x23')]=_0x1b1bb3[_0xe4d0('0x45')];if(_0x218bf9[_0xe4d0('0x23')]===0x0)return[];return db['sequelize']['query'](_0x41248f[_0xe4d0('0x9c')](),_0x2b4722)[_0xe4d0('0x29')](function(_0x4713e1){_0x3718cb=_[_0xe4d0('0x9d')](_0x4713e1,'id');_0x2b4722=_[_0xe4d0('0x9e')](_0x2b4722,{'model':db[_0xe4d0('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34eda5[_0xe4d0('0x3f')][_0xe4d0('0x44')]){_0x78bdf6[_0xe4d0('0x42')][_0xe4d0('0x32')](function(_0x6cff7){_0x32772e['field']('i.'+_0x6cff7);});}else{_0x32772e['field'](_0xe4d0('0x8e'),_0xe4d0('0x61'));_0x32772e['field'](_0xe4d0('0xa0'),'Account.key');_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa1'),_0xe4d0('0xa2'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa3'),'contactName');_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa4'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa5'),_0xe4d0('0xa6'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xa7'),'Contact.lastName');_0x32772e['field'](_0xe4d0('0xa8'),_0xe4d0('0xa9'));_0x32772e['field'](_0xe4d0('0xaa'),_0xe4d0('0xab'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xac'),_0xe4d0('0xad'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xae'),_0xe4d0('0xaf'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xb0'),_0xe4d0('0xb1'));_0x32772e[_0xe4d0('0x4b')](_0xe4d0('0xb2'),_0xe4d0('0xb3'));_0x32772e['field'](_0xe4d0('0xb4'),_0xe4d0('0x30'));}if(_0x78bdf6[_0xe4d0('0x22')])_0x32772e[_0xe4d0('0x22')](_0x78bdf6[_0xe4d0('0x22')]);if(_0x78bdf6[_0xe4d0('0x24')])_0x32772e['offset'](_0x78bdf6[_0xe4d0('0x24')]);return db['sequelize'][_0xe4d0('0x3f')](_0x32772e[_0xe4d0('0x9c')](),_0x2b4722);})[_0xe4d0('0x29')](function(_0x1107a6){if(_0x1107a6[_0xe4d0('0x45')]>0x0)_0x3ff5fa[_0xe4d0('0x48')](_0xe4d0('0xb5'),_[_0xe4d0('0x3c')](_0x1107a6,'id'));return db[_0xe4d0('0x9b')][_0xe4d0('0x3f')](_0x3ff5fa[_0xe4d0('0x9c')](),_0x2b4722)[_0xe4d0('0x29')](function(_0x4fbef9){var _0x228fec=_[_0xe4d0('0xb6')](_0x4fbef9,_0xe4d0('0xb7'));var _0x33237e=[];_0x1107a6[_0xe4d0('0x32')](function(_0xef5d5){_0x33237e['push'](updateSmsInteraction(_0xef5d5,_0x3718cb,_0x228fec));});return BPromise[_0xe4d0('0xb8')](_0x33237e);});});})[_0xe4d0('0x29')](function(_0x404f3a){_0x218bf9[_0xe4d0('0xb9')]=_0x404f3a;return _0x218bf9;})[_0xe4d0('0x29')](respondWithFilteredResult(_0x5c36ef,_0x78bdf6))[_0xe4d0('0xba')](handleError(_0x5c36ef,null));};exports[_0xe4d0('0xbb')]=function(_0x326a04,_0x2a9c24){var _0x4c0db8={'raw':![],'where':{'id':_0x326a04[_0xe4d0('0xbc')]['id']}},_0x1d0b83={};_0x1d0b83['model']=_[_0xe4d0('0x75')](db['SmsInteraction'][_0xe4d0('0x3d')]);_0x1d0b83[_0xe4d0('0x3f')]=_['keys'](_0x326a04[_0xe4d0('0x3f')]);_0x1d0b83[_0xe4d0('0x40')]=_[_0xe4d0('0x41')](_0x1d0b83[_0xe4d0('0x43')],_0x1d0b83['query']);_0x4c0db8[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x1d0b83[_0xe4d0('0x43')],qs['fields'](_0x326a04['query'][_0xe4d0('0x44')]));_0x4c0db8[_0xe4d0('0x42')]=_0x4c0db8[_0xe4d0('0x42')][_0xe4d0('0x45')]?_0x4c0db8[_0xe4d0('0x42')]:_0x1d0b83[_0xe4d0('0x43')];if(_0x326a04[_0xe4d0('0x3f')][_0xe4d0('0xbd')]){_0x4c0db8['include']=[{'all':!![]}];}_0x4c0db8=_[_0xe4d0('0x9e')]({},_0x4c0db8,_0x326a04[_0xe4d0('0xbe')]);return db['SmsInteraction'][_0xe4d0('0x6b')](_0x4c0db8)[_0xe4d0('0x29')](handleEntityNotFound(_0x2a9c24,null))[_0xe4d0('0x29')](respondWithResult(_0x2a9c24,null))[_0xe4d0('0xba')](handleError(_0x2a9c24,null));};exports[_0xe4d0('0xbf')]=function(_0x26f6c9,_0x251e33){return db['SmsInteraction'][_0xe4d0('0xbf')](_0x26f6c9[_0xe4d0('0xc0')],{})[_0xe4d0('0x29')](respondWithResult(_0x251e33,0xc9))['catch'](handleError(_0x251e33,null));};exports[_0xe4d0('0xc1')]=function(_0x382d5f,_0x21f011){if(_0x382d5f[_0xe4d0('0xc0')]['id']){delete _0x382d5f[_0xe4d0('0xc0')]['id'];}return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x382d5f[_0xe4d0('0xbc')]['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x21f011,null))[_0xe4d0('0x29')](saveUpdates(_0x382d5f[_0xe4d0('0xc0')],null))[_0xe4d0('0x29')](respondWithResult(_0x21f011,null))['catch'](handleError(_0x21f011,null));};exports[_0xe4d0('0x2a')]=function(_0x2986d1,_0x225142){return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x2986d1['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x225142,null))['then'](removeEntity(_0x225142,null))[_0xe4d0('0xba')](handleError(_0x225142,null));};exports[_0xe4d0('0xc2')]=function(_0x55ceee,_0x186b52){return db['SmsInteraction'][_0xe4d0('0xc2')]()['then'](respondWithResult(_0x186b52,null))[_0xe4d0('0xba')](handleError(_0x186b52,null));};exports[_0xe4d0('0xc3')]=function(_0x1c1a11,_0x33d3e5,_0x311b54){return db[_0xe4d0('0xc4')][_0xe4d0('0x6b')]({'where':{'id':_0x1c1a11['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x33d3e5,null))[_0xe4d0('0x29')](function(_0x1dd018){if(_0x1dd018){return _0x1dd018[_0xe4d0('0xc3')](_0x1c1a11['body'][_0xe4d0('0xc5')],_[_0xe4d0('0xc6')](_0x1c1a11[_0xe4d0('0xc0')],[_0xe4d0('0xc5'),'id'])||{});}})[_0xe4d0('0x29')](respondWithResult(_0x33d3e5,null))[_0xe4d0('0xba')](handleError(_0x33d3e5,null));};exports['getMessages']=function(_0x214ca2,_0x1bfa6b,_0x46776f){var _0xb9a5c6={'raw':![],'where':{}};var _0x4d9556={};var _0xfeef1c={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe4d0('0xc7')]({'where':{'id':_0x214ca2[_0xe4d0('0xbc')]['id']}})['then'](handleEntityNotFound(_0x1bfa6b,null))[_0xe4d0('0x29')](function(_0x18ee19){if(_0x18ee19){_0x4d9556[_0xe4d0('0x43')]=_[_0xe4d0('0x75')](db[_0xe4d0('0xc4')][_0xe4d0('0x3d')]);_0x4d9556['query']=_['keys'](_0x214ca2['query']);_0x4d9556['filters']=_[_0xe4d0('0x41')](_0x4d9556[_0xe4d0('0x43')],_0x4d9556[_0xe4d0('0x3f')]);_0xb9a5c6[_0xe4d0('0x42')]=_[_0xe4d0('0x41')](_0x4d9556['model'],qs['fields'](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x44')]));_0xb9a5c6[_0xe4d0('0x42')]=_0xb9a5c6[_0xe4d0('0x42')][_0xe4d0('0x45')]?_0xb9a5c6[_0xe4d0('0x42')]:_0x4d9556['model'];if(!_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0xc8')](_0xe4d0('0x46'))){_0xb9a5c6['limit']=qs[_0xe4d0('0x22')](_0x214ca2[_0xe4d0('0x3f')]['limit']);_0xb9a5c6['offset']=qs[_0xe4d0('0x24')](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x24')]);}_0xb9a5c6['order']=qs[_0xe4d0('0x47')](_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x47')]);_0xb9a5c6[_0xe4d0('0x48')]=qs[_0xe4d0('0x40')](_[_0xe4d0('0x49')](_0x214ca2[_0xe4d0('0x3f')],_0x4d9556[_0xe4d0('0x40')]));_0xb9a5c6[_0xe4d0('0x48')][_0xe4d0('0xb7')]=_0x18ee19['id'];if(_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x86')]){_0xb9a5c6['where']=_[_0xe4d0('0x9e')](_0xb9a5c6[_0xe4d0('0x48')],{'$or':_[_0xe4d0('0x3c')](_0xb9a5c6[_0xe4d0('0x42')],function(_0x4e4869){var _0x2ba69b={};_0x2ba69b[_0x4e4869]={'$like':'%'+_0x214ca2['query'][_0xe4d0('0x86')]+'%'};return _0x2ba69b;})});}if(_0x214ca2['query'][_0xe4d0('0x7b')]){var _0xca8156=_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0x7b')][_0xe4d0('0x31')](',');var _0x36476c={};_0x36476c[_0xca8156[0x0]]={'$gte':moment(_0xca8156[0x1])['format'](_0xe4d0('0xc9'))};_0xb9a5c6[_0xe4d0('0x48')]=_[_0xe4d0('0x9e')](_0xb9a5c6[_0xe4d0('0x48')],_0x36476c);}_0xb9a5c6=_['merge']({},_0xb9a5c6,_0x214ca2[_0xe4d0('0xbe')]);return db[_0xe4d0('0xc4')]['count']({'where':_0xb9a5c6[_0xe4d0('0x48')]})['then'](function(_0x3a38b3){_0xfeef1c[_0xe4d0('0x23')]=_0x3a38b3;if(_0x214ca2[_0xe4d0('0x3f')][_0xe4d0('0xbd')]){_0xb9a5c6[_0xe4d0('0xca')]=[{'all':!![]}];}return db['SmsMessage'][_0xe4d0('0xcb')](_0xb9a5c6);})[_0xe4d0('0x29')](function(_0x547b0a){_0xfeef1c[_0xe4d0('0xb9')]=_0x547b0a;return _0xfeef1c;});}})[_0xe4d0('0x29')](respondWithFilteredResult(_0x1bfa6b,_0xb9a5c6))[_0xe4d0('0xba')](handleError(_0x1bfa6b,null));};exports['addTags']=function(_0xb11546,_0x8f9f72,_0x6fce9d){return db['SmsInteraction'][_0xe4d0('0x6b')]({'where':{'id':_0xb11546[_0xe4d0('0xbc')]['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x8f9f72,null))[_0xe4d0('0x29')](function(_0x9e1ab5){if(_0x9e1ab5){return _0x9e1ab5[_0xe4d0('0xcc')](_0xb11546[_0xe4d0('0xc0')][_0xe4d0('0xc5')],_[_0xe4d0('0xc6')](_0xb11546[_0xe4d0('0xc0')],[_0xe4d0('0xc5'),'id'])||{})['spread'](function(){return db[_0xe4d0('0x71')]['findAll']({'attributes':['id',_0xe4d0('0x2d'),_0xe4d0('0xcd')],'where':{'id':_0xb11546['body'][_0xe4d0('0xc5')]}});})['then'](function(_0x2baac1){socket[_0xe4d0('0xce')](_0xe4d0('0xcf'),{'id':Number(_0xb11546[_0xe4d0('0xbc')]['id']),'tags':_0x2baac1||[]});return{'id':Number(_0xb11546['params']['id']),'tags':_0x2baac1||[]};});}})[_0xe4d0('0x29')](respondWithResult(_0x8f9f72,null))[_0xe4d0('0xba')](handleError(_0x8f9f72,null));};exports['removeTags']=function(_0x4adf77,_0x57469c,_0x101136){return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x4adf77['params']['id']}})[_0xe4d0('0x29')](handleEntityNotFound(_0x57469c,null))['then'](function(_0x97c890){if(_0x97c890){return _0x97c890[_0xe4d0('0xd0')](_0x4adf77[_0xe4d0('0x3f')][_0xe4d0('0xc5')]);}})[_0xe4d0('0x29')](respondWithStatusCode(_0x57469c,null))['catch'](handleError(_0x57469c,null));};exports[_0xe4d0('0xd1')]=function(_0x5913aa,_0x3836e5){var _0x258100=moment()['unix']()['toString']();var _0x3f45da=path[_0xe4d0('0xd2')](config[_0xe4d0('0xd3')],_0xe4d0('0xd4'),_0xe4d0('0xd5'),'tmp');var _0x5a98fb=path['join'](config['root'],_0xe4d0('0xd4'),'files',_0xe4d0('0xd6'));var _0x23898a=path['join'](_0x3f45da,_0x258100);var _0x28fc04=util['format']('transcript-%d-%s.zip',_0x5913aa[_0xe4d0('0xbc')]['id'],_0x258100);var _0x3bbcbb=path[_0xe4d0('0xd2')](_0x3f45da,_0x28fc04);var _0x40262b=[];_0x40262b[_0xe4d0('0x33')]({'model':db[_0xe4d0('0xd7')],'as':_0xe4d0('0xd7'),'attributes':['id',_0xe4d0('0xd8')],'raw':!![]});_0x40262b[_0xe4d0('0x33')]({'model':db['CmContact'],'as':_0xe4d0('0x66'),'attributes':['id',_0xe4d0('0xd9'),_0xe4d0('0xda')],'raw':!![]});var _0x1a0055=[{'model':db[_0xe4d0('0xc4')],'as':_0xe4d0('0xdb'),'attributes':['id',_0xe4d0('0xc0'),'createdAt',_0xe4d0('0xdc'),_0xe4d0('0xdd'),'read'],'include':_0x40262b}];_0x1a0055['push']({'model':db[_0xe4d0('0xde')],'as':_0xe4d0('0xdf'),'attributes':['id',_0xe4d0('0x2d')]});_0x1a0055[_0xe4d0('0x33')]({'model':db[_0xe4d0('0xd7')],'as':'Owner','attributes':['id',_0xe4d0('0xd8')]});return db[_0xe4d0('0x9f')][_0xe4d0('0x6b')]({'where':{'id':_0x5913aa[_0xe4d0('0xbc')]['id']},'include':_0x1a0055})[_0xe4d0('0x29')](handleEntityNotFound(_0x3836e5,null))[_0xe4d0('0x29')](function(_0x450df5){if(_0x450df5){var _0x2a5044=_0x450df5['get']({'plain':!![]});fs[_0xe4d0('0xe0')](_0x23898a);var _0x417c40={'channel':'Sms','account':_0x2a5044[_0xe4d0('0xdf')][_0xe4d0('0x2d')],'agent':_0x2a5044['Owner']?_0x2a5044[_0xe4d0('0xe1')]['fullname']:_0xe4d0('0xe2'),'createdAt':moment(_0x2a5044[_0xe4d0('0x7a')])[_0xe4d0('0xe3')](_0xe4d0('0xc9'))[_0xe4d0('0x9c')](),'closedAt':_0x2a5044[_0xe4d0('0x38')]?moment(_0x2a5044[_0xe4d0('0xe4')])[_0xe4d0('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x2a5044[_0xe4d0('0xe5')],'messages':_(_0x2a5044[_0xe4d0('0xdb')])[_0xe4d0('0x86')]({'secret':![]})[_0xe4d0('0x3c')](function(_0x12acc8){return{'date':moment(_0x12acc8[_0xe4d0('0x7a')])[_0xe4d0('0xe3')](_0xe4d0('0xc9'))[_0xe4d0('0x9c')](),'sender':_0x12acc8[_0xe4d0('0xdc')]===_0xe4d0('0xe6')?_0x12acc8[_0xe4d0('0xd7')]?_0x12acc8[_0xe4d0('0xd7')][_0xe4d0('0xd8')]:'System':_0x12acc8[_0xe4d0('0x66')][_0xe4d0('0xd9')]+(_0x12acc8[_0xe4d0('0x66')][_0xe4d0('0xda')]?'\x20'+_0x12acc8['Contact'][_0xe4d0('0xda')]:''),'body':_0x12acc8[_0xe4d0('0xc0')],'direction':_0x12acc8[_0xe4d0('0xdc')]===_0xe4d0('0xe6')?'A':'C','secret':_0x12acc8[_0xe4d0('0xdd')],'read':_0x12acc8['read']};})['value']()};return ejs['renderFile'](path[_0xe4d0('0xd2')](config[_0xe4d0('0xd3')],_0xe4d0('0xd4'),'views',_0xe4d0('0xe7')),{'interaction':_0x417c40})['then'](function(_0xa34124){var _0x3b4995=path[_0xe4d0('0xd2')](_0x23898a,'transcript-'+_0x2a5044['id']+'-'+_0x258100+_0xe4d0('0xe8'));var _0x9a8c04={'path':_0x3b4995,'channel':_0xe4d0('0xe9'),'interactionId':_0x2a5044['id']};return pdf['createPdfFromHTML'](_0xa34124,_0x9a8c04);})[_0xe4d0('0x29')](function(){return new BPromise(function(_0x5b3de0,_0x34426e){zipdir(_0x23898a,{'saveTo':_0x3bbcbb},function(_0x46d0b8,_0x13bfb3){if(_0x46d0b8)return _0x34426e(_0x46d0b8);return _0x5b3de0(_0x13bfb3);});})[_0xe4d0('0x29')](function(){return new BPromise(function(_0x3ed61f,_0x5dc35d){rimraf(_0x23898a,function(_0xa5e94b){if(_0xa5e94b)_0x5dc35d(_0xa5e94b);return _0x3ed61f();});});})[_0xe4d0('0x29')](function(){return _0x3836e5[_0xe4d0('0xd1')](_0x3bbcbb,_0x28fc04,function(_0x5ddbe1){if(_0x5ddbe1){console['log'](_0xe4d0('0xea'),_0x5ddbe1);}else{fs[_0xe4d0('0xeb')](_0x3bbcbb);}});});});}else{return _0x3836e5[_0xe4d0('0x2b')](0xc8);}})['catch'](handleError(_0x3836e5,null));}; \ No newline at end of file +var _0xbede=['to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','talking','answered','unmanaged','total','closed','UserId','waiting','SmsInteraction','rawAttributes','type','keys','filters','model','fields','query','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','search','parseSearch','sqlOperator','length','conditions','find','having','`\x20=\x200','Contact','value','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','compact','SmsAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','show','intersection','include','options','create','body','params','SmsMessage','addMessage','omit','ids','getMessages','findOne','merge','format','includeAll','findAll','addTags','setTags','Tag','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Messages','SmsAccount','Account','get','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','direction','out','System','secret','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x303f5f,_0x5c082a){var _0x2f0a9e=function(_0x426589){while(--_0x426589){_0x303f5f['push'](_0x303f5f['shift']());}};_0x2f0a9e(++_0x5c082a);}(_0xbede,0xe2));var _0xebed=function(_0x555aa7,_0x77f4ac){_0x555aa7=_0x555aa7-0x0;var _0x157bcf=_0xbede[_0x555aa7];return _0x157bcf;};'use strict';var emlformat=require(_0xebed('0x0'));var rimraf=require(_0xebed('0x1'));var zipdir=require(_0xebed('0x2'));var jsonpatch=require(_0xebed('0x3'));var rp=require('request-promise');var moment=require(_0xebed('0x4'));var BPromise=require(_0xebed('0x5'));var Mustache=require(_0xebed('0x6'));var util=require(_0xebed('0x7'));var path=require(_0xebed('0x8'));var sox=require(_0xebed('0x9'));var csv=require(_0xebed('0xa'));var ejs=require(_0xebed('0xb'));var fs=require('fs');var fs_extra=require(_0xebed('0xc'));var _=require('lodash');var squel=require(_0xebed('0xd'));var crypto=require('crypto');var jsforce=require(_0xebed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xebed('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xebed('0xf'));var authService=require(_0xebed('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xebed('0x11'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xebed('0x12'));var logger=require(_0xebed('0x13'))(_0xebed('0x14'));var utils=require('../../config/utils');var config=require(_0xebed('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xebed('0x16')]=_['defaults'](config[_0xebed('0x16')],{'host':_0xebed('0x17'),'port':0x18eb});var socket=require(_0xebed('0x18'))(new Redis(config[_0xebed('0x16')]));require(_0xebed('0x19'))[_0xebed('0x1a')](socket);function respondWithStatusCode(_0x49ff75,_0x82183e){_0x82183e=_0x82183e||0xcc;return function(_0x46cf40){if(_0x46cf40){return _0x49ff75[_0xebed('0x1b')](_0x82183e);}return _0x49ff75[_0xebed('0x1c')](_0x82183e)[_0xebed('0x1d')]();};}function respondWithResult(_0x36a215,_0x555b45){_0x555b45=_0x555b45||0xc8;return function(_0x39ff30){if(_0x39ff30){return _0x36a215[_0xebed('0x1c')](_0x555b45)[_0xebed('0x1e')](_0x39ff30);}};}function respondWithFilteredResult(_0x219b84,_0x44c30e){return function(_0x1d254a){if(_0x1d254a){var _0x125db8=typeof _0x44c30e[_0xebed('0x1f')]===_0xebed('0x20')&&typeof _0x44c30e['limit']==='undefined';var _0x26b8e3=_0x1d254a[_0xebed('0x21')];var _0x1cd228=_0x125db8?0x0:_0x44c30e[_0xebed('0x1f')];var _0x2e8fe0=_0x125db8?_0x1d254a['count']:_0x44c30e[_0xebed('0x1f')]+_0x44c30e['limit'];var _0x134497;if(_0x2e8fe0>=_0x26b8e3){_0x2e8fe0=_0x26b8e3;_0x134497=0xc8;}else{_0x134497=0xce;}_0x219b84[_0xebed('0x1c')](_0x134497);return _0x219b84[_0xebed('0x22')]('Content-Range',_0x1cd228+'-'+_0x2e8fe0+'/'+_0x26b8e3)['json'](_0x1d254a);}return null;};}function patchUpdates(_0x43c4c1){return function(_0x4ed11d){try{jsonpatch[_0xebed('0x23')](_0x4ed11d,_0x43c4c1,!![]);}catch(_0xc319be){return BPromise['reject'](_0xc319be);}return _0x4ed11d[_0xebed('0x24')]();};}function saveUpdates(_0x49e9e8,_0x4ad56e){return function(_0x477aa4){if(_0x477aa4){return _0x477aa4[_0xebed('0x25')](_0x49e9e8)[_0xebed('0x26')](function(_0x55d3e5){return _0x55d3e5;});}return null;};}function removeEntity(_0x45d227,_0x27b178){return function(_0x485153){if(_0x485153){return _0x485153[_0xebed('0x27')]()['then'](function(){_0x45d227['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20c400,_0x37763e){return function(_0x50948a){if(!_0x50948a){_0x20c400[_0xebed('0x1b')](0x194);}return _0x50948a;};}function handleError(_0x4cf20f,_0x2f478a){_0x2f478a=_0x2f478a||0x1f4;return function(_0x3c7a58){logger['error'](_0x3c7a58[_0xebed('0x28')]);if(_0x3c7a58[_0xebed('0x29')]){delete _0x3c7a58[_0xebed('0x29')];}_0x4cf20f[_0xebed('0x1c')](_0x2f478a)[_0xebed('0x2a')](_0x3c7a58);};}function getInteractionUsers(_0x91f4b3,_0x557b89){return new BPromise(function(_0x222e11,_0x301e29){try{if(_0x557b89[_0x91f4b3['id']]){_0x91f4b3[_0xebed('0x2b')]=_[_0xebed('0x2c')](_0x557b89[_0x91f4b3['id']],function(_0x1c1d62){return{'id':_0x1c1d62['id'],'fullname':_0x1c1d62['fullname']};});}}catch(_0x44d578){_0x301e29(_0x44d578);}_0x222e11(_0x91f4b3);});}function getInteractionTags(_0x2920d3,_0x581671){return new BPromise(function(_0x26afbb,_0x241692){try{if(_0x2920d3[_0xebed('0x2d')]){_0x2920d3[_0xebed('0x2e')]=[];_0x2920d3[_0xebed('0x2d')]['split'](',')[_0xebed('0x2f')](function(_0x3e3f9f){_0x2920d3['Tags'][_0xebed('0x30')](_0x581671[_0x3e3f9f]);});}delete _0x2920d3[_0xebed('0x2d')];}catch(_0x36a864){_0x241692(_0x36a864);}_0x26afbb(_0x2920d3);});}function updateSmsInteraction(_0x1fc220,_0x22438a,_0xbd96d){return new BPromise(function(_0x382ce9,_0x1301b6){return getInteractionUsers(_0x1fc220,_0xbd96d)[_0xebed('0x26')](function(_0x90751){return getInteractionTags(_0x90751,_0x22438a);})['then'](function(_0x1d5ca3){return getStateInteraction(_0x1d5ca3);})[_0xebed('0x26')](function(_0x472da0){_0x382ce9(_0x472da0);})[_0xebed('0x31')](function(_0x2bb4dc){_0x1301b6(_0x2bb4dc);});});}function getStateInteraction(_0x2c2c2e){return new BPromise(function(_0x20b349){_0x2c2c2e['waiting']=0x0;_0x2c2c2e[_0xebed('0x32')]=0x0;_0x2c2c2e[_0xebed('0x33')]=0x0;_0x2c2c2e[_0xebed('0x34')]=0x0;_0x2c2c2e[_0xebed('0x35')]=0x0;if(!_0x2c2c2e[_0xebed('0x36')]&&!_0x2c2c2e[_0xebed('0x37')]){_0x2c2c2e[_0xebed('0x38')]+=0x1;}if(!_0x2c2c2e['closed']&&_0x2c2c2e[_0xebed('0x37')]){_0x2c2c2e[_0xebed('0x32')]+=0x1;if(_0x2c2c2e[_0xebed('0x38')]){_0x2c2c2e[_0xebed('0x38')]-=0x1;}}if(_0x2c2c2e[_0xebed('0x36')]&&_0x2c2c2e[_0xebed('0x37')]){_0x2c2c2e[_0xebed('0x33')]+=0x1;if(_0x2c2c2e['talking']){_0x2c2c2e['talking']-=0x1;}}if(_0x2c2c2e[_0xebed('0x36')]&&!_0x2c2c2e[_0xebed('0x37')]){_0x2c2c2e[_0xebed('0x34')]+=0x1;if(_0x2c2c2e['waiting']){_0x2c2c2e['waiting']-=0x1;}}_0x2c2c2e[_0xebed('0x35')]+=0x1;_0x20b349(_0x2c2c2e);});}exports['index']=function(_0x4582b9,_0x474d06){var _0x194c66={},_0x3bfa3e={},_0x53aa9f={'count':0x0,'rows':[]};var _0x111193=_[_0xebed('0x2c')](db[_0xebed('0x39')][_0xebed('0x3a')],function(_0x43f18b){return{'name':_0x43f18b['fieldName'],'type':_0x43f18b[_0xebed('0x3b')]['key']};});_0x3bfa3e['model']=_[_0xebed('0x2c')](_0x111193,_0xebed('0x29'));_0x3bfa3e['query']=_[_0xebed('0x3c')](_0x4582b9['query']);_0x3bfa3e[_0xebed('0x3d')]=_['intersection'](_0x3bfa3e[_0xebed('0x3e')],_0x3bfa3e['query']);_0x194c66['attributes']=_['intersection'](_0x3bfa3e[_0xebed('0x3e')],qs[_0xebed('0x3f')](_0x4582b9[_0xebed('0x40')]['fields']));_0x194c66[_0xebed('0x41')]=_0x194c66[_0xebed('0x41')]['length']?_0x194c66['attributes']:_0x3bfa3e[_0xebed('0x3e')];if(!_0x4582b9[_0xebed('0x40')][_0xebed('0x42')](_0xebed('0x43'))){_0x194c66[_0xebed('0x44')]=qs[_0xebed('0x44')](_0x4582b9[_0xebed('0x40')][_0xebed('0x44')]);_0x194c66[_0xebed('0x1f')]=qs['offset'](_0x4582b9[_0xebed('0x40')]['offset']);}_0x194c66[_0xebed('0x45')]=qs[_0xebed('0x46')](_0x4582b9[_0xebed('0x40')]['sort']);_0x194c66[_0xebed('0x47')]=qs[_0xebed('0x3d')](_[_0xebed('0x48')](_0x4582b9['query'],_0x3bfa3e[_0xebed('0x3d')]),_0x111193);var _0x4ecb82=[];var _0x32b26c=squel[_0xebed('0x49')]()['field']('id')[_0xebed('0x4a')](_0xebed('0x29'))['field'](_0xebed('0x4b'))[_0xebed('0x4c')](_0xebed('0x4d'));var _0x1b8140=squel[_0xebed('0x49')]()[_0xebed('0x4a')](_0xebed('0x4e'))[_0xebed('0x4a')](_0xebed('0x4f'))[_0xebed('0x4a')]('ui.SmsInteractionId')['from']('user_has_sms_interactions','ui')[_0xebed('0x50')](_0xebed('0x51'),'u',_0xebed('0x52'));var _0x56939f=squel[_0xebed('0x49')]()['from'](_0xebed('0x53'),'i')[_0xebed('0x50')]('cm_contacts','c',_0xebed('0x54'))[_0xebed('0x50')]('users','o','o.id\x20=\x20i.UserId')[_0xebed('0x50')](_0xebed('0x55'),'a',_0xebed('0x56'))[_0xebed('0x50')](_0xebed('0x57'),'me',_0xebed('0x58'))[_0xebed('0x50')](_0xebed('0x59'),'it',_0xebed('0x5a'))[_0xebed('0x50')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x2e8954=squel['expr']();var _0xc81d78=[];var _0x10d5da=squel['expr']();var _0x3a7f4f;if(_0x4582b9[_0xebed('0x40')][_0xebed('0x5b')]){_0x3a7f4f=as[_0xebed('0x5c')](_0x4582b9['query'][_0xebed('0x5b')]);var _0x226959=_0x3a7f4f[_0xebed('0x5d')];for(var _0x304822=0x0;_0x304822<_0x3a7f4f['conditions'][_0xebed('0x5e')];_0x304822++){var _0x1c3bd7=_0x3a7f4f[_0xebed('0x5f')][_0x304822];var _0x47ab28='i';var _0x322dd6=_[_0xebed('0x60')](_0x111193,[_0xebed('0x29'),_0x1c3bd7[_0xebed('0x4a')]]);if(!_0x322dd6){switch(_0x1c3bd7[_0xebed('0x4a')]){case'unreadMessages':if(_0x1c3bd7['value']==0x1){_0x56939f[_0xebed('0x61')]('`'+_0x1c3bd7[_0xebed('0x4a')]+_0xebed('0x62'));}else{_0x56939f['having']('`'+_0x1c3bd7['field']+'`\x20>\x200');}break;case _0xebed('0x63'):if(_0x1c3bd7['operator']==='$substring'){if(_0x1c3bd7[_0xebed('0x64')][_0xebed('0x65')]('\x20')[_0xebed('0x5e')]>0x1){_0x2e8954[_0x226959]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xebed('0x66')](_0x1c3bd7[_0xebed('0x64')]),null);}else{var _0x2bceae='%'+_0x1c3bd7[_0xebed('0x64')]+'%';_0x2e8954[_0x226959](_0xebed('0x67'),_0x2bceae,_0x2bceae,_0x2bceae);}}else{_0x322dd6=_['find'](_0x111193,[_0xebed('0x29'),_0xebed('0x68')]);_0x1c3bd7[_0xebed('0x4a')]=_0xebed('0x68');_0x1ba80f=as[_0xebed('0x69')](_0x47ab28,_0x322dd6[_0xebed('0x3b')],_0x1c3bd7);_0x2e8954[_0x226959](_0x1ba80f[_0xebed('0x6a')],_0x1ba80f[_0xebed('0x64')]['start'],_0x1ba80f[_0xebed('0x64')][_0xebed('0x1d')]);}break;case'Tag':var _0x39df5e=_0x1c3bd7[_0xebed('0x64')]['split'](',')[_0xebed('0x2c')](function(_0xbcb9ca){return Number(_0xbcb9ca);});_0x39df5e[_0xebed('0x2f')](function(_0x581210){_0x10d5da['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x581210+',%');});_0xc81d78=_[_0xebed('0x6b')](_0xc81d78,_0x39df5e);break;case _0xebed('0x6c'):if(_0x1c3bd7[_0xebed('0x6d')]===_0xebed('0x6e')){_0x2e8954[_0x226959](_0xebed('0x6f'),'%'+_0x1c3bd7[_0xebed('0x64')]+'%',null);}else{_0x322dd6=_[_0xebed('0x60')](_0x111193,[_0xebed('0x29'),_0xebed('0x37')]);_0x1c3bd7['field']=_0xebed('0x37');_0x1ba80f=as[_0xebed('0x69')](_0x47ab28,_0x322dd6[_0xebed('0x3b')],_0x1c3bd7);_0x2e8954[_0x226959](_0x1ba80f[_0xebed('0x6a')],_0x1ba80f[_0xebed('0x64')][_0xebed('0x70')],_0x1ba80f[_0xebed('0x64')]['end']);}break;case'body':_0x1ba80f=as['buildExpression']('me',null,_0x1c3bd7);_0x2e8954[_0x226959](_0x1ba80f[_0xebed('0x6a')],_0x1ba80f[_0xebed('0x64')][_0xebed('0x70')],_0x1ba80f[_0xebed('0x64')][_0xebed('0x1d')]);break;}}else{var _0x1ba80f=as[_0xebed('0x69')](_0x47ab28,_0x322dd6[_0xebed('0x3b')],_0x1c3bd7);_0x2e8954[_0x226959](_0x1ba80f[_0xebed('0x6a')],_0x1ba80f[_0xebed('0x64')][_0xebed('0x70')],_0x1ba80f[_0xebed('0x64')][_0xebed('0x1d')]);}}}else{var _0x1ed6be=_(_0x4582b9[_0xebed('0x40')])[_0xebed('0x3c')]()['map'](function(_0x1e25b6){return _['some'](_0x111193,[_0xebed('0x29'),_0x1e25b6])?_0x1e25b6:undefined;})[_0xebed('0x71')]()[_0xebed('0x64')]();if(!_['isEmpty'](_0x1ed6be)){_0x1ed6be[_0xebed('0x2f')](function(_0xe8b111){if(_0xe8b111===_0xebed('0x72')){_0x56939f['where']('i.SmsAccountId\x20IN\x20?',[][_0xebed('0x73')](_0x4582b9[_0xebed('0x40')][_0xe8b111]));}else if(_0xe8b111===_0xebed('0x74')){var _0x14c9ce=JSON[_0xebed('0x75')](_0x4582b9[_0xebed('0x40')][_0xe8b111])[_0xebed('0x76')];var _0x18bb81=JSON['parse'](_0x4582b9[_0xebed('0x40')][_0xe8b111])[_0xebed('0x77')];_0x56939f['where'](_0xebed('0x78'),_0x14c9ce,_0x18bb81);}else{if(_0x4582b9[_0xebed('0x40')][_0xe8b111]===_0xebed('0x79')){_0x56939f[_0xebed('0x47')]('i.'+_0xe8b111+'\x20IS\x20NULL');}else{_0x56939f['where']('i.'+_0xe8b111+_0xebed('0x7a'),_0x4582b9[_0xebed('0x40')][_0xe8b111]);}}});}if(_0x4582b9[_0xebed('0x40')][_0xebed('0x7b')]){if(_0x4582b9['query'][_0xebed('0x7b')]==0x1){_0x56939f[_0xebed('0x61')]('`unreadMessages`\x20=\x200');}else{_0x56939f[_0xebed('0x61')](_0xebed('0x7c'));}}if(_0x4582b9['query'][_0xebed('0x7d')]){_0xc81d78=_[_0xebed('0x7e')](_0x4582b9[_0xebed('0x40')][_0xebed('0x7d')])?_0x4582b9[_0xebed('0x40')][_0xebed('0x7d')]:new Array(_0x4582b9['query'][_0xebed('0x7d')]);_0xc81d78['forEach'](function(_0x8e2363){_0x10d5da['or'](_0xebed('0x7f'),'%,'+_0x8e2363+',%');});}if(_0x4582b9[_0xebed('0x40')][_0xebed('0x80')]){var _0x1e2b07=_0x4582b9['query'][_0xebed('0x80')][_0xebed('0x81')]('\x5c','\x5c\x5c')[_0xebed('0x81')](/'/g,'\x27\x27');if(qs[_0xebed('0x82')](_0x1e2b07)){_0x2e8954['or'](_0xebed('0x83'),_0x1e2b07+'%')['or'](_0xebed('0x84'),_0x1e2b07+'%');}else{_0x2e8954['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xebed('0x66')](_0x1e2b07))['or'](_0xebed('0x85'),_0x1e2b07+'%');}}}_0x56939f['where'](_0x2e8954);_0x56939f[_0xebed('0x86')](_0xebed('0x87'));var _0x5fdd92={'type':db[_0xebed('0x88')][_0xebed('0x89')][_0xebed('0x8a')],'raw':!![]};var _0x1a4d1f=_0x56939f[_0xebed('0x8b')]();_0x1a4d1f[_0xebed('0x4a')](_0xebed('0x87'));_0x1a4d1f[_0xebed('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xebed('0x8c'));if(_0x194c66[_0xebed('0x45')]){_0x194c66[_0xebed('0x45')][_0xebed('0x2f')](function(_0x44bb88){var _0xb979e8=_0x44bb88[0x0]===_0xebed('0x8d')?_0x44bb88[0x0]:'i.'+_0x44bb88[0x0];_0x56939f[_0xebed('0x45')](_0xb979e8,_0x44bb88[0x1]===_0xebed('0x8e')?![]:!![]);});}if(!_[_0xebed('0x8f')](_0xc81d78)){_0x56939f[_0xebed('0x61')](_0x10d5da);_0x1a4d1f['where'](_0xebed('0x90'),_0xc81d78);}BPromise[_0xebed('0x91')]()[_0xebed('0x26')](function(){if(!_0x3a7f4f){if(_0x4582b9[_0xebed('0x40')][_0xebed('0x72')])return;_0x1a4d1f[_0xebed('0x47')](_0xebed('0x92'));_0x56939f[_0xebed('0x47')](_0xebed('0x92'));return;}if(_0x4582b9[_0xebed('0x93')][_0xebed('0x94')]!==_0xebed('0x95'))return;return _0x4582b9[_0xebed('0x93')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xebed('0x26')](function(_0x557d67){if(_[_0xebed('0x8f')](_0x557d67)){_0x1a4d1f[_0xebed('0x47')](_0xebed('0x96'));_0x56939f[_0xebed('0x47')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x1a4d1f[_0xebed('0x47')](_0xebed('0x97'),_['map'](_0x557d67,'id'));_0x56939f[_0xebed('0x47')](_0xebed('0x97'),_[_0xebed('0x2c')](_0x557d67,'id'));}});})[_0xebed('0x26')](function(){if(_0x4582b9[_0xebed('0x93')][_0xebed('0x94')]===_0xebed('0x95')&&!_0x3a7f4f&&!_0x4582b9[_0xebed('0x40')]['SmsAccountId'])return[];return db[_0xebed('0x98')][_0xebed('0x40')](_0x1a4d1f[_0xebed('0x99')](),_0x5fdd92);})['then'](function(_0xde0cc9){_0x53aa9f['count']=_0xde0cc9[_0xebed('0x5e')];if(_0x53aa9f[_0xebed('0x21')]===0x0)return[];return db[_0xebed('0x98')]['query'](_0x32b26c[_0xebed('0x99')](),_0x5fdd92)[_0xebed('0x26')](function(_0x23001e){_0x4ecb82=_[_0xebed('0x9a')](_0x23001e,'id');_0x5fdd92=_['merge'](_0x5fdd92,{'model':db[_0xebed('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4582b9[_0xebed('0x40')][_0xebed('0x3f')]){_0x194c66['attributes'][_0xebed('0x2f')](function(_0x226dac){_0x56939f[_0xebed('0x4a')]('i.'+_0x226dac);});}else{_0x56939f[_0xebed('0x4a')](_0xebed('0x9b'),_0xebed('0x8c'));_0x56939f[_0xebed('0x4a')](_0xebed('0x9c'),_0xebed('0x9d'));_0x56939f['field'](_0xebed('0x9e'),_0xebed('0x9f'));_0x56939f[_0xebed('0x4a')](_0xebed('0xa0'),_0xebed('0x8d'));_0x56939f['field']('i.*');_0x56939f[_0xebed('0x4a')](_0xebed('0xa1'),_0xebed('0xa2'));_0x56939f[_0xebed('0x4a')](_0xebed('0xa3'),_0xebed('0xa4'));_0x56939f[_0xebed('0x4a')](_0xebed('0xa5'),_0xebed('0xa6'));_0x56939f[_0xebed('0x4a')](_0xebed('0xa7'),_0xebed('0xa8'));_0x56939f[_0xebed('0x4a')](_0xebed('0xa9'),_0xebed('0xaa'));_0x56939f[_0xebed('0x4a')](_0xebed('0xab'),_0xebed('0xac'));_0x56939f[_0xebed('0x4a')]('o.fullname',_0xebed('0xad'));_0x56939f[_0xebed('0x4a')]('o.internal',_0xebed('0xae'));_0x56939f[_0xebed('0x4a')](_0xebed('0xaf'),_0xebed('0x2d'));}if(_0x194c66[_0xebed('0x44')])_0x56939f[_0xebed('0x44')](_0x194c66[_0xebed('0x44')]);if(_0x194c66['offset'])_0x56939f[_0xebed('0x1f')](_0x194c66['offset']);return db[_0xebed('0x98')][_0xebed('0x40')](_0x56939f[_0xebed('0x99')](),_0x5fdd92);})[_0xebed('0x26')](function(_0x3b2c28){if(_0x3b2c28[_0xebed('0x5e')]>0x0)_0x1b8140[_0xebed('0x47')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x3b2c28,'id'));return db[_0xebed('0x98')]['query'](_0x1b8140[_0xebed('0x99')](),_0x5fdd92)[_0xebed('0x26')](function(_0x47687a){var _0x2a31e8=_[_0xebed('0xb0')](_0x47687a,_0xebed('0xb1'));var _0x430a1a=[];_0x3b2c28['forEach'](function(_0x30b31c){_0x430a1a[_0xebed('0x30')](updateSmsInteraction(_0x30b31c,_0x4ecb82,_0x2a31e8));});return BPromise[_0xebed('0xb2')](_0x430a1a);});});})['then'](function(_0x157a07){_0x53aa9f[_0xebed('0xb3')]=_0x157a07;return _0x53aa9f;})[_0xebed('0x26')](respondWithFilteredResult(_0x474d06,_0x194c66))[_0xebed('0x31')](handleError(_0x474d06,null));};exports[_0xebed('0xb4')]=function(_0x208f31,_0x4e2871){var _0x25046e={'raw':![],'where':{'id':_0x208f31['params']['id']}},_0x259b06={};_0x259b06[_0xebed('0x3e')]=_[_0xebed('0x3c')](db[_0xebed('0x39')]['rawAttributes']);_0x259b06[_0xebed('0x40')]=_['keys'](_0x208f31['query']);_0x259b06[_0xebed('0x3d')]=_['intersection'](_0x259b06[_0xebed('0x3e')],_0x259b06[_0xebed('0x40')]);_0x25046e[_0xebed('0x41')]=_[_0xebed('0xb5')](_0x259b06[_0xebed('0x3e')],qs[_0xebed('0x3f')](_0x208f31[_0xebed('0x40')][_0xebed('0x3f')]));_0x25046e['attributes']=_0x25046e[_0xebed('0x41')][_0xebed('0x5e')]?_0x25046e[_0xebed('0x41')]:_0x259b06[_0xebed('0x3e')];if(_0x208f31['query']['includeAll']){_0x25046e[_0xebed('0xb6')]=[{'all':!![]}];}_0x25046e=_['merge']({},_0x25046e,_0x208f31[_0xebed('0xb7')]);return db[_0xebed('0x39')][_0xebed('0x60')](_0x25046e)[_0xebed('0x26')](handleEntityNotFound(_0x4e2871,null))[_0xebed('0x26')](respondWithResult(_0x4e2871,null))[_0xebed('0x31')](handleError(_0x4e2871,null));};exports[_0xebed('0xb8')]=function(_0x6396ed,_0x6431b0){return db[_0xebed('0x39')][_0xebed('0xb8')](_0x6396ed['body'],{})['then'](respondWithResult(_0x6431b0,0xc9))[_0xebed('0x31')](handleError(_0x6431b0,null));};exports[_0xebed('0x25')]=function(_0xad822b,_0x229848){if(_0xad822b['body']['id']){delete _0xad822b[_0xebed('0xb9')]['id'];}return db[_0xebed('0x39')][_0xebed('0x60')]({'where':{'id':_0xad822b[_0xebed('0xba')]['id']}})[_0xebed('0x26')](handleEntityNotFound(_0x229848,null))['then'](saveUpdates(_0xad822b[_0xebed('0xb9')],null))['then'](respondWithResult(_0x229848,null))['catch'](handleError(_0x229848,null));};exports[_0xebed('0x27')]=function(_0x452625,_0x337730){return db[_0xebed('0x39')][_0xebed('0x60')]({'where':{'id':_0x452625[_0xebed('0xba')]['id']}})[_0xebed('0x26')](handleEntityNotFound(_0x337730,null))[_0xebed('0x26')](removeEntity(_0x337730,null))['catch'](handleError(_0x337730,null));};exports['describe']=function(_0x5f54f8,_0x150165){return db[_0xebed('0x39')]['describe']()[_0xebed('0x26')](respondWithResult(_0x150165,null))['catch'](handleError(_0x150165,null));};exports['addMessage']=function(_0x75348d,_0x16860d,_0x3019bc){return db[_0xebed('0xbb')][_0xebed('0x60')]({'where':{'id':_0x75348d['params']['id']}})['then'](handleEntityNotFound(_0x16860d,null))[_0xebed('0x26')](function(_0xba7456){if(_0xba7456){return _0xba7456[_0xebed('0xbc')](_0x75348d[_0xebed('0xb9')]['ids'],_[_0xebed('0xbd')](_0x75348d[_0xebed('0xb9')],[_0xebed('0xbe'),'id'])||{});}})[_0xebed('0x26')](respondWithResult(_0x16860d,null))[_0xebed('0x31')](handleError(_0x16860d,null));};exports[_0xebed('0xbf')]=function(_0x2f72fe,_0x14812e,_0x4c0b6a){var _0x3632c8={'raw':![],'where':{}};var _0x52ac10={};var _0x56cf12={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xebed('0xc0')]({'where':{'id':_0x2f72fe[_0xebed('0xba')]['id']}})[_0xebed('0x26')](handleEntityNotFound(_0x14812e,null))[_0xebed('0x26')](function(_0x52b067){if(_0x52b067){_0x52ac10[_0xebed('0x3e')]=_['keys'](db[_0xebed('0xbb')]['rawAttributes']);_0x52ac10[_0xebed('0x40')]=_[_0xebed('0x3c')](_0x2f72fe[_0xebed('0x40')]);_0x52ac10[_0xebed('0x3d')]=_[_0xebed('0xb5')](_0x52ac10[_0xebed('0x3e')],_0x52ac10['query']);_0x3632c8[_0xebed('0x41')]=_[_0xebed('0xb5')](_0x52ac10[_0xebed('0x3e')],qs['fields'](_0x2f72fe[_0xebed('0x40')]['fields']));_0x3632c8[_0xebed('0x41')]=_0x3632c8['attributes'][_0xebed('0x5e')]?_0x3632c8['attributes']:_0x52ac10[_0xebed('0x3e')];if(!_0x2f72fe[_0xebed('0x40')]['hasOwnProperty'](_0xebed('0x43'))){_0x3632c8[_0xebed('0x44')]=qs['limit'](_0x2f72fe[_0xebed('0x40')][_0xebed('0x44')]);_0x3632c8[_0xebed('0x1f')]=qs[_0xebed('0x1f')](_0x2f72fe['query']['offset']);}_0x3632c8[_0xebed('0x45')]=qs[_0xebed('0x46')](_0x2f72fe['query'][_0xebed('0x46')]);_0x3632c8[_0xebed('0x47')]=qs[_0xebed('0x3d')](_[_0xebed('0x48')](_0x2f72fe[_0xebed('0x40')],_0x52ac10[_0xebed('0x3d')]));_0x3632c8[_0xebed('0x47')][_0xebed('0xb1')]=_0x52b067['id'];if(_0x2f72fe['query']['filter']){_0x3632c8[_0xebed('0x47')]=_[_0xebed('0xc1')](_0x3632c8['where'],{'$or':_['map'](_0x3632c8['attributes'],function(_0x2d2266){var _0x3c6de3={};_0x3c6de3[_0x2d2266]={'$like':'%'+_0x2f72fe[_0xebed('0x40')][_0xebed('0x80')]+'%'};return _0x3c6de3;})});}if(_0x2f72fe['query'][_0xebed('0x76')]){var _0x5255fb=_0x2f72fe[_0xebed('0x40')][_0xebed('0x76')][_0xebed('0x65')](',');var _0x3560af={};_0x3560af[_0x5255fb[0x0]]={'$gte':moment(_0x5255fb[0x1])[_0xebed('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3632c8[_0xebed('0x47')]=_[_0xebed('0xc1')](_0x3632c8[_0xebed('0x47')],_0x3560af);}_0x3632c8=_['merge']({},_0x3632c8,_0x2f72fe['options']);return db[_0xebed('0xbb')][_0xebed('0x21')]({'where':_0x3632c8[_0xebed('0x47')]})[_0xebed('0x26')](function(_0x122438){_0x56cf12[_0xebed('0x21')]=_0x122438;if(_0x2f72fe['query'][_0xebed('0xc3')]){_0x3632c8[_0xebed('0xb6')]=[{'all':!![]}];}return db['SmsMessage'][_0xebed('0xc4')](_0x3632c8);})[_0xebed('0x26')](function(_0x225539){_0x56cf12[_0xebed('0xb3')]=_0x225539;return _0x56cf12;});}})['then'](respondWithFilteredResult(_0x14812e,_0x3632c8))['catch'](handleError(_0x14812e,null));};exports[_0xebed('0xc5')]=function(_0x498be0,_0x42c432,_0x31a486){return db['SmsInteraction'][_0xebed('0x60')]({'where':{'id':_0x498be0['params']['id']}})[_0xebed('0x26')](handleEntityNotFound(_0x42c432,null))[_0xebed('0x26')](function(_0x598762){if(_0x598762){return _0x598762[_0xebed('0xc6')](_0x498be0['body']['ids'],_[_0xebed('0xbd')](_0x498be0[_0xebed('0xb9')],[_0xebed('0xbe'),'id'])||{})['spread'](function(){return db[_0xebed('0xc7')]['findAll']({'attributes':['id',_0xebed('0x29'),_0xebed('0x4b')],'where':{'id':_0x498be0['body'][_0xebed('0xbe')]}});})['then'](function(_0x40250a){socket[_0xebed('0xc8')]('smsInteractionTags:save',{'id':Number(_0x498be0['params']['id']),'tags':_0x40250a||[]});return{'id':Number(_0x498be0['params']['id']),'tags':_0x40250a||[]};});}})[_0xebed('0x26')](respondWithResult(_0x42c432,null))['catch'](handleError(_0x42c432,null));};exports[_0xebed('0xc9')]=function(_0x375212,_0x28fbb5,_0x50c288){return db[_0xebed('0x39')][_0xebed('0x60')]({'where':{'id':_0x375212[_0xebed('0xba')]['id']}})[_0xebed('0x26')](handleEntityNotFound(_0x28fbb5,null))[_0xebed('0x26')](function(_0x1f7bb0){if(_0x1f7bb0){return _0x1f7bb0[_0xebed('0xc9')](_0x375212[_0xebed('0x40')][_0xebed('0xbe')]);}})[_0xebed('0x26')](respondWithStatusCode(_0x28fbb5,null))[_0xebed('0x31')](handleError(_0x28fbb5,null));};exports[_0xebed('0xca')]=function(_0x9370e2,_0x3c35e7){var _0x333e0d=moment()[_0xebed('0xcb')]()[_0xebed('0x99')]();var _0x5ea325=path[_0xebed('0xcc')](config[_0xebed('0xcd')],_0xebed('0xce'),_0xebed('0xcf'),_0xebed('0xd0'));var _0x24b5df=path[_0xebed('0xcc')](config[_0xebed('0xcd')],_0xebed('0xce'),_0xebed('0xcf'),_0xebed('0xd1'));var _0x5d9efa=path[_0xebed('0xcc')](_0x5ea325,_0x333e0d);var _0x213fc7=util[_0xebed('0xc2')](_0xebed('0xd2'),_0x9370e2[_0xebed('0xba')]['id'],_0x333e0d);var _0x562ff3=path['join'](_0x5ea325,_0x213fc7);var _0x550210=[];_0x550210[_0xebed('0x30')]({'model':db[_0xebed('0x6c')],'as':_0xebed('0x6c'),'attributes':['id',_0xebed('0xd3')],'raw':!![]});_0x550210[_0xebed('0x30')]({'model':db[_0xebed('0xd4')],'as':_0xebed('0x63'),'attributes':['id',_0xebed('0xd5'),_0xebed('0xd6')],'raw':!![]});var _0x4fca48=[{'model':db['SmsMessage'],'as':_0xebed('0xd7'),'attributes':['id',_0xebed('0xb9'),_0xebed('0x74'),'direction','secret','read'],'include':_0x550210}];_0x4fca48['push']({'model':db[_0xebed('0xd8')],'as':_0xebed('0xd9'),'attributes':['id',_0xebed('0x29')]});_0x4fca48['push']({'model':db[_0xebed('0x6c')],'as':'Owner','attributes':['id',_0xebed('0xd3')]});return db['SmsInteraction'][_0xebed('0x60')]({'where':{'id':_0x9370e2['params']['id']},'include':_0x4fca48})[_0xebed('0x26')](handleEntityNotFound(_0x3c35e7,null))[_0xebed('0x26')](function(_0x44c18d){if(_0x44c18d){var _0x3672e7=_0x44c18d[_0xebed('0xda')]({'plain':!![]});fs['mkdirSync'](_0x5d9efa);var _0x16019f={'channel':_0xebed('0xdb'),'account':_0x3672e7[_0xebed('0xd9')][_0xebed('0x29')],'agent':_0x3672e7[_0xebed('0xdc')]?_0x3672e7[_0xebed('0xdc')][_0xebed('0xd3')]:_0xebed('0xdd'),'createdAt':moment(_0x3672e7['createdAt'])[_0xebed('0xc2')](_0xebed('0xde'))[_0xebed('0x99')](),'closedAt':_0x3672e7[_0xebed('0x36')]?moment(_0x3672e7[_0xebed('0xdf')])[_0xebed('0xc2')](_0xebed('0xde'))[_0xebed('0x99')]():'','disposition':_0x3672e7[_0xebed('0xe0')],'messages':_(_0x3672e7['Messages'])[_0xebed('0x80')]({'secret':![]})['map'](function(_0x1a776e){return{'date':moment(_0x1a776e[_0xebed('0x74')])[_0xebed('0xc2')](_0xebed('0xde'))['toString'](),'sender':_0x1a776e[_0xebed('0xe1')]===_0xebed('0xe2')?_0x1a776e[_0xebed('0x6c')]?_0x1a776e[_0xebed('0x6c')][_0xebed('0xd3')]:_0xebed('0xe3'):_0x1a776e['Contact'][_0xebed('0xd5')]+(_0x1a776e[_0xebed('0x63')][_0xebed('0xd6')]?'\x20'+_0x1a776e[_0xebed('0x63')][_0xebed('0xd6')]:''),'body':_0x1a776e[_0xebed('0xb9')],'direction':_0x1a776e[_0xebed('0xe1')]===_0xebed('0xe2')?'A':'C','secret':_0x1a776e[_0xebed('0xe4')],'read':_0x1a776e['read']};})[_0xebed('0x64')]()};return ejs[_0xebed('0xe5')](path[_0xebed('0xcc')](config[_0xebed('0xcd')],'server',_0xebed('0xe6'),'downloadInteraction.ejs'),{'interaction':_0x16019f})[_0xebed('0x26')](function(_0xbc5acb){var _0x3e2f85=path[_0xebed('0xcc')](_0x5d9efa,_0xebed('0xe7')+_0x3672e7['id']+'-'+_0x333e0d+_0xebed('0xe8'));var _0x22dba8={'path':_0x3e2f85,'channel':_0xebed('0xdb'),'interactionId':_0x3672e7['id']};return pdf[_0xebed('0xe9')](_0xbc5acb,_0x22dba8);})[_0xebed('0x26')](function(){return new BPromise(function(_0x3fe9a7,_0x46aff2){zipdir(_0x5d9efa,{'saveTo':_0x562ff3},function(_0x41132b,_0x575223){if(_0x41132b)return _0x46aff2(_0x41132b);return _0x3fe9a7(_0x575223);});})['then'](function(){return new BPromise(function(_0x365b9c,_0x466f18){rimraf(_0x5d9efa,function(_0x39cecb){if(_0x39cecb)_0x466f18(_0x39cecb);return _0x365b9c();});});})[_0xebed('0x26')](function(){return _0x3c35e7['download'](_0x562ff3,_0x213fc7,function(_0x4fd5e7){if(_0x4fd5e7){console[_0xebed('0xea')]('err',_0x4fd5e7);}else{fs[_0xebed('0xeb')](_0x562ff3);}});});});}else{return _0x3c35e7[_0xebed('0x1b')](0xc8);}})[_0xebed('0x31')](handleError(_0x3c35e7,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9713aa8..a32a8c3 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf2f=['setDataValue','Users','map','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x509140,_0x3f8187){_0x509140=_0x509140-0x0;var _0x4ffd18=_0xcf2f[_0x509140];return _0x4ffd18;};'use strict';var EventEmitter=require(_0xfcf2('0x0'));var SmsInteraction=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x2')];var SmsMessage=require(_0xfcf2('0x1'))['db'][_0xfcf2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfcf2('0x4'),'afterUpdate':_0xfcf2('0x5'),'afterDestroy':_0xfcf2('0x6')};function emitEvent(_0x34bcaf){return function(_0x179e60,_0x167a77,_0x1e6d99){_0x179e60[_0xfcf2('0x7')]({'attributes':['id'],'raw':!![]})[_0xfcf2('0x8')](function(_0x157f48){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xa'),_0x157f48[_0xfcf2('0xb')](function(_0x13ce18){return{'id':_0x13ce18['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x179e60['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4d6fc9){_0x179e60[_0xfcf2('0x9')](_0xfcf2('0xc'),_0x4d6fc9['length']);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf+':'+_0x179e60['id'],_0x179e60);SmsInteractionEvents[_0xfcf2('0xd')](_0x34bcaf,_0x179e60);_0x1e6d99(null);})[_0xfcf2('0xe')](_0x1e6d99(null));};}for(var e in events){if(events[_0xfcf2('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x9582=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','exports','events'];(function(_0xcbcc6e,_0x434172){var _0x1ca910=function(_0x29373a){while(--_0x29373a){_0xcbcc6e['push'](_0xcbcc6e['shift']());}};_0x1ca910(++_0x434172);}(_0x9582,0x95));var _0x2958=function(_0x20dbec,_0x39a514){_0x20dbec=_0x20dbec-0x0;var _0x590e4f=_0x9582[_0x20dbec];return _0x590e4f;};'use strict';var EventEmitter=require(_0x2958('0x0'));var SmsInteraction=require(_0x2958('0x1'))['db'][_0x2958('0x2')];var SmsMessage=require(_0x2958('0x1'))['db'][_0x2958('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2958('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2958('0x5'),'afterDestroy':_0x2958('0x6')};function emitEvent(_0x136c77){return function(_0x195138,_0x2f15c9,_0xbde128){_0x195138[_0x2958('0x7')]({'attributes':['id'],'raw':!![]})[_0x2958('0x8')](function(_0xa385ec){_0x195138[_0x2958('0x9')]('Users',_0xa385ec['map'](function(_0x313702){return{'id':_0x313702['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x195138['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2958('0x8')](function(_0x51e460){_0x195138[_0x2958('0x9')]('unreadMessages',_0x51e460[_0x2958('0xa')]);SmsInteractionEvents[_0x2958('0xb')](_0x136c77+':'+_0x195138['id'],_0x195138);SmsInteractionEvents[_0x2958('0xb')](_0x136c77,_0x195138);_0xbde128(null);})[_0x2958('0xc')](_0xbde128(null));};}for(var e in events){if(events[_0x2958('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2958('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index e42d09a..2b1a33d 100644 --- a/server/api/smsInteraction/smsInteraction.model.js +++ b/server/api/smsInteraction/smsInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfa2=['closed','closedAt','format','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed'];(function(_0x3fd92b,_0x7c1c){var _0x5e75cd=function(_0x15b0e0){while(--_0x15b0e0){_0x3fd92b['push'](_0x3fd92b['shift']());}};_0x5e75cd(++_0x7c1c);}(_0xcfa2,0x193));var _0x2cfa=function(_0x5d4901,_0x2724bb){_0x5d4901=_0x5d4901-0x0;var _0x2b07b1=_0xcfa2[_0x5d4901];return _0x2b07b1;};'use strict';var _=require(_0x2cfa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2cfa('0x1'));var moment=require(_0x2cfa('0x2'));var BPromise=require(_0x2cfa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cfa('0x4'));var rimraf=require(_0x2cfa('0x5'));var config=require(_0x2cfa('0x6'));var attributes=require(_0x2cfa('0x7'));module[_0x2cfa('0x8')]=function(_0x38176e,_0x5264f7){return _0x38176e[_0x2cfa('0x9')](_0x2cfa('0xa'),attributes,{'tableName':_0x2cfa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x409658,_0x6f51c7,_0x33b329){if(_0x409658[_0x2cfa('0xc')](_0x2cfa('0xd'))){_0x409658[_0x2cfa('0xe')]=moment()[_0x2cfa('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x33b329(null,_0x409658);}}});}; \ No newline at end of file +var _0x0eca=['request-promise','path','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x739556,_0x290f4c){var _0x4e04c7=function(_0x466a13){while(--_0x466a13){_0x739556['push'](_0x739556['shift']());}};_0x4e04c7(++_0x290f4c);}(_0x0eca,0x13d));var _0xa0ec=function(_0x287d51,_0x46b59f){_0x287d51=_0x287d51-0x0;var _0x3709c7=_0x0eca[_0x287d51];return _0x3709c7;};'use strict';var _=require(_0xa0ec('0x0'));var util=require(_0xa0ec('0x1'));var logger=require(_0xa0ec('0x2'))(_0xa0ec('0x3'));var moment=require(_0xa0ec('0x4'));var BPromise=require(_0xa0ec('0x5'));var rp=require(_0xa0ec('0x6'));var fs=require('fs');var path=require(_0xa0ec('0x7'));var rimraf=require('rimraf');var config=require(_0xa0ec('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x222a83,_0x1afe7a){return _0x222a83[_0xa0ec('0x9')](_0xa0ec('0xa'),attributes,{'tableName':_0xa0ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23f6ad,_0x11f18e,_0x35770b){if(_0x23f6ad[_0xa0ec('0xc')](_0xa0ec('0xd'))){_0x23f6ad[_0xa0ec('0xe')]=moment()[_0xa0ec('0xf')](_0xa0ec('0x10'));}_0x35770b(null,_0x23f6ad);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index befcbd1..d3c8ff7 100644 --- a/server/api/smsInteraction/smsInteraction.rpc.js +++ b/server/api/smsInteraction/smsInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe25b=['AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','UpdateSmsInteraction','update','raw','options','where','limit','stringify','AddTagsToSmsInteraction','SmsInteraction','find','addTags','body','omit','spread'];(function(_0x23f0a2,_0x16a681){var _0x5398a8=function(_0x1e292c){while(--_0x1e292c){_0x23f0a2['push'](_0x23f0a2['shift']());}};_0x5398a8(++_0x16a681);}(_0xe25b,0x19b));var _0xbe25=function(_0x13ce1a,_0x7ccc3b){_0x13ce1a=_0x13ce1a-0x0;var _0x46d010=_0xe25b[_0x13ce1a];return _0x46d010;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var moment=require('moment');var BPromise=require(_0xbe25('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe25('0x3'));var db=require(_0xbe25('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe25('0x5'))(_0xbe25('0x6'));var config=require(_0xbe25('0x7'));var jayson=require(_0xbe25('0x8'));var client=jayson[_0xbe25('0x9')]['http']({'port':0x232a});config[_0xbe25('0xa')]=_[_0xbe25('0xb')](config[_0xbe25('0xa')],{'host':_0xbe25('0xc'),'port':0x18eb});var socket=require(_0xbe25('0xd'))(new Redis(config[_0xbe25('0xa')]));require(_0xbe25('0xe'))[_0xbe25('0xf')](socket);function respondWithRpcPromise(_0x53a8f7,_0x314bda,_0x191b63){return new BPromise(function(_0x169644,_0x40e266){return client[_0xbe25('0x10')](_0x53a8f7,_0x191b63)[_0xbe25('0x11')](function(_0x32c082){logger[_0xbe25('0x12')](_0xbe25('0x13'),_0x314bda,'request\x20sent');logger[_0xbe25('0x14')](_0xbe25('0x15'),_0x314bda,'request\x20sent',JSON['stringify'](_0x32c082));if(_0x32c082[_0xbe25('0x16')]){if(_0x32c082[_0xbe25('0x16')]['code']===0x1f4){logger[_0xbe25('0x16')](_0xbe25('0x13'),_0x314bda,_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);return _0x40e266(_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);}logger['error'](_0xbe25('0x13'),_0x314bda,_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);return _0x169644(_0x32c082[_0xbe25('0x16')][_0xbe25('0x17')]);}else{logger[_0xbe25('0x12')](_0xbe25('0x13'),_0x314bda,_0xbe25('0x18'));_0x169644(_0x32c082['result'][_0xbe25('0x17')]);}})[_0xbe25('0x19')](function(_0x10fd47){logger[_0xbe25('0x16')](_0xbe25('0x13'),_0x314bda,_0x10fd47);_0x40e266(_0x10fd47);});});}exports[_0xbe25('0x1a')]=function(_0x100509){var _0x3ad300=this;return new Promise(function(_0x309c7e,_0x1990aa){return db['SmsInteraction'][_0xbe25('0x1b')](_0x100509['body'],{'raw':_0x100509['options']?_0x100509['options'][_0xbe25('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100509[_0xbe25('0x1d')]?_0x100509[_0xbe25('0x1d')][_0xbe25('0x1e')]||null:null,'attributes':_0x100509['options']?_0x100509[_0xbe25('0x1d')]['attributes']||null:null,'limit':_0x100509[_0xbe25('0x1d')]?_0x100509[_0xbe25('0x1d')][_0xbe25('0x1f')]||null:null})[_0xbe25('0x11')](function(_0x2252ff){logger[_0xbe25('0x12')](_0xbe25('0x1a'),_0x100509);logger[_0xbe25('0x14')](_0xbe25('0x1a'),_0x100509,JSON[_0xbe25('0x20')](_0x2252ff));_0x309c7e(_0x2252ff);})[_0xbe25('0x19')](function(_0x534f6f){logger[_0xbe25('0x16')](_0xbe25('0x1a'),_0x534f6f[_0xbe25('0x17')],_0x100509);_0x1990aa(_0x3ad300[_0xbe25('0x16')](0x1f4,_0x534f6f[_0xbe25('0x17')]));});});};exports[_0xbe25('0x21')]=function(_0x14a642){return new Promise(function(_0x1ecc53,_0x4f1531){return db[_0xbe25('0x22')][_0xbe25('0x23')]({'where':_0x14a642[_0xbe25('0x1d')]?_0x14a642[_0xbe25('0x1d')][_0xbe25('0x1e')]||null:null})[_0xbe25('0x11')](function(_0x69bf91){if(_0x69bf91){return _0x69bf91[_0xbe25('0x24')](_0x14a642[_0xbe25('0x25')]['ids'],_[_0xbe25('0x26')](_0x14a642[_0xbe25('0x25')],['ids','id'])||{});}})[_0xbe25('0x27')](function(_0x4198c3){logger[_0xbe25('0x12')](_0xbe25('0x28'),_0x14a642);logger[_0xbe25('0x14')](_0xbe25('0x28'),_0x14a642,JSON[_0xbe25('0x20')](_0x4198c3));_0x1ecc53(_0x4198c3);})['catch'](function(_0x22baf5){logger[_0xbe25('0x16')](_0xbe25('0x28'),_0x22baf5['message'],_0x14a642);_0x4f1531(_this[_0xbe25('0x16')](0x1f4,_0x22baf5[_0xbe25('0x17')]));});});}; \ No newline at end of file +var _0xa68e=['omit','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsInteraction','update','options','where','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags'];(function(_0x336825,_0x22eb35){var _0x35fe69=function(_0x112142){while(--_0x112142){_0x336825['push'](_0x336825['shift']());}};_0x35fe69(++_0x22eb35);}(_0xa68e,0x80));var _0xea68=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0xa68e[_0x22d202];return _0x3cb212;};'use strict';var _=require(_0xea68('0x0'));var util=require(_0xea68('0x1'));var moment=require(_0xea68('0x2'));var BPromise=require(_0xea68('0x3'));var rs=require(_0xea68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea68('0x5'))['db'];var utils=require(_0xea68('0x6'));var logger=require(_0xea68('0x7'))(_0xea68('0x8'));var config=require(_0xea68('0x9'));var jayson=require(_0xea68('0xa'));var client=jayson[_0xea68('0xb')]['http']({'port':0x232a});config[_0xea68('0xc')]=_['defaults'](config[_0xea68('0xc')],{'host':_0xea68('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xea68('0xe'))['register'](socket);function respondWithRpcPromise(_0x67764c,_0x2f82a3,_0x305c07){return new BPromise(function(_0x9fade3,_0x16ee41){return client[_0xea68('0xf')](_0x67764c,_0x305c07)[_0xea68('0x10')](function(_0x2f9859){logger[_0xea68('0x11')](_0xea68('0x12'),_0x2f82a3,_0xea68('0x13'));logger[_0xea68('0x14')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2f82a3,_0xea68('0x13'),JSON[_0xea68('0x15')](_0x2f9859));if(_0x2f9859[_0xea68('0x16')]){if(_0x2f9859[_0xea68('0x16')][_0xea68('0x17')]===0x1f4){logger[_0xea68('0x16')]('SmsInteraction,\x20%s,\x20%s',_0x2f82a3,_0x2f9859[_0xea68('0x16')][_0xea68('0x18')]);return _0x16ee41(_0x2f9859[_0xea68('0x16')][_0xea68('0x18')]);}logger[_0xea68('0x16')](_0xea68('0x12'),_0x2f82a3,_0x2f9859['error'][_0xea68('0x18')]);return _0x9fade3(_0x2f9859['error'][_0xea68('0x18')]);}else{logger[_0xea68('0x11')](_0xea68('0x12'),_0x2f82a3,'request\x20sent');_0x9fade3(_0x2f9859[_0xea68('0x19')][_0xea68('0x18')]);}})[_0xea68('0x1a')](function(_0xe04d9a){logger[_0xea68('0x16')](_0xea68('0x12'),_0x2f82a3,_0xe04d9a);_0x16ee41(_0xe04d9a);});});}exports['UpdateSmsInteraction']=function(_0x18af16){var _0x74c55c=this;return new Promise(function(_0x47c7a0,_0x2be73b){return db[_0xea68('0x1b')][_0xea68('0x1c')](_0x18af16['body'],{'raw':_0x18af16[_0xea68('0x1d')]?_0x18af16['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18af16[_0xea68('0x1d')]?_0x18af16[_0xea68('0x1d')][_0xea68('0x1e')]||null:null,'attributes':_0x18af16[_0xea68('0x1d')]?_0x18af16[_0xea68('0x1d')]['attributes']||null:null,'limit':_0x18af16[_0xea68('0x1d')]?_0x18af16['options'][_0xea68('0x1f')]||null:null})[_0xea68('0x10')](function(_0x3b7757){logger[_0xea68('0x11')](_0xea68('0x20'),_0x18af16);logger[_0xea68('0x14')](_0xea68('0x20'),_0x18af16,JSON[_0xea68('0x15')](_0x3b7757));_0x47c7a0(_0x3b7757);})[_0xea68('0x1a')](function(_0x2686b9){logger['error'](_0xea68('0x20'),_0x2686b9['message'],_0x18af16);_0x2be73b(_0x74c55c[_0xea68('0x16')](0x1f4,_0x2686b9['message']));});});};exports[_0xea68('0x21')]=function(_0x55dc00){return new Promise(function(_0x4bd9cf,_0x2e05ea){return db[_0xea68('0x1b')][_0xea68('0x22')]({'where':_0x55dc00['options']?_0x55dc00[_0xea68('0x1d')][_0xea68('0x1e')]||null:null})[_0xea68('0x10')](function(_0x23f0ff){if(_0x23f0ff){return _0x23f0ff[_0xea68('0x23')](_0x55dc00['body']['ids'],_[_0xea68('0x24')](_0x55dc00[_0xea68('0x25')],[_0xea68('0x26'),'id'])||{});}})[_0xea68('0x27')](function(_0x39d5e4){logger[_0xea68('0x11')](_0xea68('0x28'),_0x55dc00);logger['debug'](_0xea68('0x28'),_0x55dc00,JSON[_0xea68('0x15')](_0x39d5e4));_0x4bd9cf(_0x39d5e4);})[_0xea68('0x1a')](function(_0x2d9e5b){logger[_0xea68('0x16')](_0xea68('0x28'),_0x2d9e5b[_0xea68('0x18')],_0x55dc00);_0x2e05ea(_this[_0xea68('0x16')](0x1f4,_0x2d9e5b[_0xea68('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 5696c14..4ed54cd 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc54=['save','remove','update','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xfc54,0x7f));var _0x4fc5=function(_0x46c9a5,_0x1cb9e7){_0x46c9a5=_0x46c9a5-0x0;var _0x5e3eec=_0xfc54[_0x46c9a5];return _0x5e3eec;};'use strict';var SmsInteractionEvents=require(_0x4fc5('0x0'));var events=[_0x4fc5('0x1'),_0x4fc5('0x2'),_0x4fc5('0x3')];function createListener(_0x36ea5d,_0x54f4dd){return function(_0x50bdcc){_0x54f4dd[_0x4fc5('0x4')](_0x36ea5d,_0x50bdcc);};}function removeListener(_0x1a20ee,_0x1848e0){return function(){SmsInteractionEvents['removeListener'](_0x1a20ee,_0x1848e0);};}exports[_0x4fc5('0x5')]=function(_0x4e4c07){for(var _0x56f906=0x0,_0x562280=events[_0x4fc5('0x6')];_0x56f906<_0x562280;_0x56f906++){var _0x4e84d3=events[_0x56f906];var _0x2d383b=createListener(_0x4fc5('0x7')+_0x4e84d3,_0x4e4c07);SmsInteractionEvents['on'](_0x4e84d3,_0x2d383b);}}; \ No newline at end of file +var _0x8c89=['emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x2e3f82,_0x13683c){var _0xdd92e4=function(_0x2b1194){while(--_0x2b1194){_0x2e3f82['push'](_0x2e3f82['shift']());}};_0xdd92e4(++_0x13683c);}(_0x8c89,0xc5));var _0x98c8=function(_0x2b65de,_0x1f3879){_0x2b65de=_0x2b65de-0x0;var _0x557845=_0x8c89[_0x2b65de];return _0x557845;};'use strict';var SmsInteractionEvents=require(_0x98c8('0x0'));var events=['save',_0x98c8('0x1'),_0x98c8('0x2')];function createListener(_0x1be186,_0x497de8){return function(_0x2aad43){_0x497de8[_0x98c8('0x3')](_0x1be186,_0x2aad43);};}function removeListener(_0x36a8ad,_0x51f4e1){return function(){SmsInteractionEvents[_0x98c8('0x4')](_0x36a8ad,_0x51f4e1);};}exports[_0x98c8('0x5')]=function(_0x75cb15){for(var _0xaea533=0x0,_0xb143c6=events[_0x98c8('0x6')];_0xaea533<_0xb143c6;_0xaea533++){var _0x58a9bb=events[_0xaea533];var _0x40ac24=createListener(_0x98c8('0x7')+_0x58a9bb,_0x75cb15);SmsInteractionEvents['on'](_0x58a9bb,_0x40ac24);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ad30d31..732c6fb 100644 --- a/server/api/smsMessage/index.js +++ b/server/api/smsMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe084=['../../config/environment','./smsMessage.controller','isAuthenticated','get','/describe','describe','show','post','smsmessage:create','create','/:id/status','status','/:id','update','put','/:id/accept','accept','reject','delete','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x4d3846,_0x19e479){var _0x2f8652=function(_0x59dd43){while(--_0x59dd43){_0x4d3846['push'](_0x4d3846['shift']());}};_0x2f8652(++_0x19e479);}(_0xe084,0x171));var _0x4e08=function(_0x4f1791,_0x3999c6){_0x4f1791=_0x4f1791-0x0;var _0x7ce3e0=_0xe084[_0x4f1791];return _0x7ce3e0;};'use strict';var multer=require(_0x4e08('0x0'));var util=require(_0x4e08('0x1'));var path=require(_0x4e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e08('0x3'));var router=express['Router']();var fs_extra=require(_0x4e08('0x4'));var auth=require(_0x4e08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4e08('0x6'));var controller=require(_0x4e08('0x7'));router['get']('/',auth[_0x4e08('0x8')](),controller['index']);router[_0x4e08('0x9')](_0x4e08('0xa'),auth[_0x4e08('0x8')](),controller[_0x4e08('0xb')]);router[_0x4e08('0x9')]('/:id',auth[_0x4e08('0x8')](),controller[_0x4e08('0xc')]);router[_0x4e08('0xd')]('/',auth[_0x4e08('0x8')](),interaction['tracked']('sms',_0x4e08('0xe')),controller[_0x4e08('0xf')]);router['post'](_0x4e08('0x10'),controller[_0x4e08('0x11')]);router['put'](_0x4e08('0x12'),auth[_0x4e08('0x8')](),controller[_0x4e08('0x13')]);router[_0x4e08('0x14')](_0x4e08('0x15'),auth[_0x4e08('0x8')](),controller[_0x4e08('0x16')]);router[_0x4e08('0x14')]('/:id/reject',auth[_0x4e08('0x8')](),controller[_0x4e08('0x17')]);router[_0x4e08('0x18')]('/:id',auth[_0x4e08('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf8d0=['reject','delete','/:id','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','sms','/:id/status','status','put','/:id/accept','accept','/:id/reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8d0,0x199));var _0x0f8d=function(_0x56ee2b,_0x348e1d){_0x56ee2b=_0x56ee2b-0x0;var _0x305aea=_0xf8d0[_0x56ee2b];return _0x305aea;};'use strict';var multer=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var path=require('path');var timeout=require(_0x0f8d('0x2'));var express=require(_0x0f8d('0x3'));var router=express['Router']();var fs_extra=require(_0x0f8d('0x4'));var auth=require(_0x0f8d('0x5'));var interaction=require(_0x0f8d('0x6'));var config=require(_0x0f8d('0x7'));var controller=require(_0x0f8d('0x8'));router[_0x0f8d('0x9')]('/',auth[_0x0f8d('0xa')](),controller[_0x0f8d('0xb')]);router[_0x0f8d('0x9')](_0x0f8d('0xc'),auth[_0x0f8d('0xa')](),controller[_0x0f8d('0xd')]);router[_0x0f8d('0x9')]('/:id',auth[_0x0f8d('0xa')](),controller['show']);router[_0x0f8d('0xe')]('/',auth['isAuthenticated'](),interaction[_0x0f8d('0xf')](_0x0f8d('0x10'),'smsmessage:create'),controller['create']);router[_0x0f8d('0xe')](_0x0f8d('0x11'),controller[_0x0f8d('0x12')]);router[_0x0f8d('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0f8d('0x13')](_0x0f8d('0x14'),auth[_0x0f8d('0xa')](),controller[_0x0f8d('0x15')]);router['put'](_0x0f8d('0x16'),auth[_0x0f8d('0xa')](),controller[_0x0f8d('0x17')]);router[_0x0f8d('0x18')](_0x0f8d('0x19'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f8d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index efb90bd..ed42754 100644 --- a/server/api/smsMessage/smsMessage.attributes.js +++ b/server/api/smsMessage/smsMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb6a3=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x271caa,_0x485e70){var _0x18a8fa=function(_0x205826){while(--_0x205826){_0x271caa['push'](_0x271caa['shift']());}};_0x18a8fa(++_0x485e70);}(_0xb6a3,0xa6));var _0x3b6a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb6a3[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x3b6a('0x0'));module[_0x3b6a('0x1')]={'body':{'type':Sequelize[_0x3b6a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3b6a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b6a('0x4')]('in',_0x3b6a('0x5')),'defaultValue':_0x3b6a('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b6a('0x6')](0xbe)},'phone':{'type':Sequelize[_0x3b6a('0x6')]},'readAt':{'type':Sequelize[_0x3b6a('0x7')]},'secret':{'type':Sequelize[_0x3b6a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3b6a('0x2')]}}; \ No newline at end of file +var _0xff39=['STRING','DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xff39,0xba));var _0x9ff3=function(_0x399131,_0x2db855){_0x399131=_0x399131-0x0;var _0xce76e2=_0xff39[_0x399131];return _0xce76e2;};'use strict';var Sequelize=require('sequelize');module[_0x9ff3('0x0')]={'body':{'type':Sequelize[_0x9ff3('0x1')](_0x9ff3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9ff3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9ff3('0x4')]('in','out'),'defaultValue':_0x9ff3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9ff3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9ff3('0x6')]},'readAt':{'type':Sequelize[_0x9ff3('0x7')]},'secret':{'type':Sequelize[_0x9ff3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 495f70f..fcae932 100644 --- a/server/api/smsMessage/smsMessage.controller.js +++ b/server/api/smsMessage/smsMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8a0=['reject','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','channel','motionChannel','event'];(function(_0x361755,_0x1bfe73){var _0x53a53d=function(_0x4d5e83){while(--_0x4d5e83){_0x361755['push'](_0x361755['shift']());}};_0x53a53d(++_0x1bfe73);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x14db20,_0x25aa0e){_0x14db20=_0x14db20-0x0;var _0x343157=_0xb8a0[_0x14db20];return _0x343157;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b8a('0x0'));var jsonpatch=require(_0x0b8a('0x1'));var rp=require('request-promise');var moment=require(_0x0b8a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0b8a('0x3'));var csv=require(_0x0b8a('0x4'));var ejs=require(_0x0b8a('0x5'));var fs=require('fs');var fs_extra=require(_0x0b8a('0x6'));var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x4'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var licenseUtil=require(_0x0b8a('0x17'));var db=require('../../mysqldb')['db'];config[_0x0b8a('0x18')]=_[_0x0b8a('0x19')](config[_0x0b8a('0x18')],{'host':_0x0b8a('0x1a'),'port':0x18eb});var socket=require(_0x0b8a('0x1b'))(new Redis(config[_0x0b8a('0x18')]));require(_0x0b8a('0x1c'))[_0x0b8a('0x1d')](socket);var jayson=require(_0x0b8a('0x1e'));var client=jayson['client'][_0x0b8a('0x1f')]({'port':0x232c});var client9002=jayson[_0x0b8a('0x20')][_0x0b8a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x554237,_0x1afb89,_0x2f9867,_0x1c5ac2){return new BPromise(function(_0x5a2623,_0x5c562f){var _0x4b58d7=_0x1c5ac2||client;return _0x4b58d7[_0x0b8a('0x21')](_0x554237,_0x2f9867)['then'](function(_0x1a1d6b){logger[_0x0b8a('0x22')](_0x0b8a('0x23'),_0x1afb89,_0x0b8a('0x24'));logger[_0x0b8a('0x25')](_0x0b8a('0x26'),_0x1afb89,_0x0b8a('0x24'),JSON[_0x0b8a('0x27')](_0x1a1d6b));if(_0x1a1d6b[_0x0b8a('0x28')]){if(_0x1a1d6b[_0x0b8a('0x28')][_0x0b8a('0x29')]===0x1f4){logger['error'](_0x0b8a('0x23'),_0x1afb89,_0x1a1d6b[_0x0b8a('0x28')]['message']);return _0x5c562f(_0x1a1d6b[_0x0b8a('0x28')][_0x0b8a('0x2a')]);}logger[_0x0b8a('0x28')](_0x0b8a('0x23'),_0x1afb89,_0x1a1d6b['error'][_0x0b8a('0x2a')]);return _0x5a2623(_0x1a1d6b['error'][_0x0b8a('0x2a')]);}else{logger[_0x0b8a('0x22')]('SmsMessage,\x20%s,\x20%s',_0x1afb89,_0x0b8a('0x24'));_0x5a2623(_0x1a1d6b[_0x0b8a('0x2b')][_0x0b8a('0x2a')]);}})['catch'](function(_0x65f12b){logger[_0x0b8a('0x28')](_0x0b8a('0x23'),_0x1afb89,_0x65f12b);_0x5c562f(_0x65f12b);});});}function respondWithStatusCode(_0x4af078,_0x37f47b){_0x37f47b=_0x37f47b||0xcc;return function(_0x499db6){if(_0x499db6){return _0x4af078[_0x0b8a('0x2c')](_0x37f47b);}return _0x4af078[_0x0b8a('0x2d')](_0x37f47b)[_0x0b8a('0x2e')]();};}function respondWithResult(_0x292097,_0x32670f){_0x32670f=_0x32670f||0xc8;return function(_0x2fc6a7){if(_0x2fc6a7){return _0x292097[_0x0b8a('0x2d')](_0x32670f)[_0x0b8a('0x2f')](_0x2fc6a7);}};}function respondWithFilteredResult(_0x94f6b4,_0xc94471){return function(_0x1e61f4){if(_0x1e61f4){var _0x20b16d=typeof _0xc94471['offset']===_0x0b8a('0x30')&&typeof _0xc94471[_0x0b8a('0x31')]===_0x0b8a('0x30');var _0x22ef59=_0x1e61f4[_0x0b8a('0x32')];var _0x59f54d=_0x20b16d?0x0:_0xc94471[_0x0b8a('0x33')];var _0x4690b6=_0x20b16d?_0x1e61f4['count']:_0xc94471[_0x0b8a('0x33')]+_0xc94471[_0x0b8a('0x31')];var _0x151a2f;if(_0x4690b6>=_0x22ef59){_0x4690b6=_0x22ef59;_0x151a2f=0xc8;}else{_0x151a2f=0xce;}_0x94f6b4[_0x0b8a('0x2d')](_0x151a2f);return _0x94f6b4[_0x0b8a('0x34')]('Content-Range',_0x59f54d+'-'+_0x4690b6+'/'+_0x22ef59)[_0x0b8a('0x2f')](_0x1e61f4);}return null;};}function patchUpdates(_0x3f4967){return function(_0x1d08e9){try{jsonpatch[_0x0b8a('0x35')](_0x1d08e9,_0x3f4967,!![]);}catch(_0x44d7a1){return BPromise['reject'](_0x44d7a1);}return _0x1d08e9[_0x0b8a('0x36')]();};}function saveUpdates(_0x21cecc,_0x559c13){return function(_0x329c56){if(_0x329c56){return _0x329c56[_0x0b8a('0x37')](_0x21cecc)[_0x0b8a('0x38')](function(_0x2e0582){return _0x2e0582;});}return null;};}function removeEntity(_0x4ccb0c,_0x167b25){return function(_0x23d83a){if(_0x23d83a){return _0x23d83a['destroy']()['then'](function(){_0x4ccb0c[_0x0b8a('0x2d')](0xcc)[_0x0b8a('0x2e')]();});}};}function handleEntityNotFound(_0x102ab8,_0x45f418){return function(_0x5dc373){if(!_0x5dc373){_0x102ab8[_0x0b8a('0x2c')](0x194);}return _0x5dc373;};}function handleError(_0xe94bcc,_0x208a5f){_0x208a5f=_0x208a5f||0x1f4;return function(_0x5b2a9a){logger[_0x0b8a('0x28')](_0x5b2a9a[_0x0b8a('0x39')]);if(_0x5b2a9a[_0x0b8a('0x3a')]){delete _0x5b2a9a[_0x0b8a('0x3a')];}_0xe94bcc[_0x0b8a('0x2d')](_0x208a5f)[_0x0b8a('0x3b')](_0x5b2a9a);};}exports[_0x0b8a('0x3c')]=function(_0x2d01c0,_0x1a189a){var _0x406a1a={},_0x53586f={},_0x37635b={'count':0x0,'rows':[]};var _0x34f6e6=_[_0x0b8a('0x3d')](db[_0x0b8a('0x3e')][_0x0b8a('0x3f')],function(_0xe85b9){return{'name':_0xe85b9[_0x0b8a('0x40')],'type':_0xe85b9[_0x0b8a('0x41')]['key']};});_0x53586f[_0x0b8a('0x42')]=_['map'](_0x34f6e6,_0x0b8a('0x3a'));_0x53586f['query']=_[_0x0b8a('0x43')](_0x2d01c0[_0x0b8a('0x44')]);_0x53586f['filters']=_[_0x0b8a('0x45')](_0x53586f[_0x0b8a('0x42')],_0x53586f['query']);_0x406a1a[_0x0b8a('0x46')]=_[_0x0b8a('0x45')](_0x53586f['model'],qs[_0x0b8a('0x47')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x47')]));_0x406a1a['attributes']=_0x406a1a[_0x0b8a('0x46')][_0x0b8a('0x48')]?_0x406a1a['attributes']:_0x53586f[_0x0b8a('0x42')];if(!_0x2d01c0['query'][_0x0b8a('0x49')]('nolimit')){_0x406a1a[_0x0b8a('0x31')]=qs[_0x0b8a('0x31')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x31')]);_0x406a1a[_0x0b8a('0x33')]=qs[_0x0b8a('0x33')](_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x33')]);}_0x406a1a[_0x0b8a('0x4a')]=qs['sort'](_0x2d01c0[_0x0b8a('0x44')]['sort']);_0x406a1a['where']=qs['filters'](_['pick'](_0x2d01c0[_0x0b8a('0x44')],_0x53586f[_0x0b8a('0x4b')]),_0x34f6e6);if(_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x4c')]){_0x406a1a[_0x0b8a('0x4d')]=_[_0x0b8a('0x4e')](_0x406a1a['where'],{'$or':_[_0x0b8a('0x3d')](_0x34f6e6,function(_0x500f39){if(_0x500f39[_0x0b8a('0x41')]!=='VIRTUAL'){var _0x3d952={};_0x3d952[_0x500f39[_0x0b8a('0x3a')]]={'$like':'%'+_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x4c')]+'%'};return _0x3d952;}})});}_0x406a1a=_[_0x0b8a('0x4e')]({},_0x406a1a,_0x2d01c0[_0x0b8a('0x4f')]);var _0x4f52d0={'where':_0x406a1a[_0x0b8a('0x4d')]};return db[_0x0b8a('0x3e')][_0x0b8a('0x32')](_0x4f52d0)[_0x0b8a('0x38')](function(_0x224b28){_0x37635b[_0x0b8a('0x32')]=_0x224b28;if(_0x2d01c0[_0x0b8a('0x44')][_0x0b8a('0x50')]){_0x406a1a[_0x0b8a('0x51')]=[{'all':!![]}];}return db[_0x0b8a('0x3e')][_0x0b8a('0x52')](_0x406a1a);})[_0x0b8a('0x38')](function(_0x53793e){_0x37635b[_0x0b8a('0x53')]=_0x53793e;return _0x37635b;})[_0x0b8a('0x38')](respondWithFilteredResult(_0x1a189a,_0x406a1a))[_0x0b8a('0x54')](handleError(_0x1a189a,null));};exports['show']=function(_0x2f13f5,_0x2afd66){var _0x360c11={'raw':!![],'where':{'id':_0x2f13f5['params']['id']}},_0x50a85c={};_0x50a85c[_0x0b8a('0x42')]=_['keys'](db[_0x0b8a('0x3e')][_0x0b8a('0x3f')]);_0x50a85c[_0x0b8a('0x44')]=_[_0x0b8a('0x43')](_0x2f13f5[_0x0b8a('0x44')]);_0x50a85c[_0x0b8a('0x4b')]=_['intersection'](_0x50a85c['model'],_0x50a85c[_0x0b8a('0x44')]);_0x360c11[_0x0b8a('0x46')]=_[_0x0b8a('0x45')](_0x50a85c[_0x0b8a('0x42')],qs['fields'](_0x2f13f5[_0x0b8a('0x44')][_0x0b8a('0x47')]));_0x360c11[_0x0b8a('0x46')]=_0x360c11[_0x0b8a('0x46')][_0x0b8a('0x48')]?_0x360c11['attributes']:_0x50a85c[_0x0b8a('0x42')];if(_0x2f13f5[_0x0b8a('0x44')][_0x0b8a('0x50')]){_0x360c11[_0x0b8a('0x51')]=[{'all':!![]}];}_0x360c11=_[_0x0b8a('0x4e')]({},_0x360c11,_0x2f13f5[_0x0b8a('0x4f')]);return db[_0x0b8a('0x3e')][_0x0b8a('0x55')](_0x360c11)[_0x0b8a('0x38')](handleEntityNotFound(_0x2afd66,null))[_0x0b8a('0x38')](respondWithResult(_0x2afd66,null))[_0x0b8a('0x54')](handleError(_0x2afd66,null));};exports[_0x0b8a('0x56')]=function(_0x5108b1,_0x24200b){return db[_0x0b8a('0x3e')]['create'](_0x5108b1[_0x0b8a('0x57')],{})[_0x0b8a('0x38')](respondWithResult(_0x24200b,0xc9))[_0x0b8a('0x54')](handleError(_0x24200b,null));};exports['update']=function(_0x5da6d0,_0x22a0cc){if(_0x5da6d0[_0x0b8a('0x57')]['id']){delete _0x5da6d0[_0x0b8a('0x57')]['id'];}return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x5da6d0[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x22a0cc,null))[_0x0b8a('0x38')](saveUpdates(_0x5da6d0[_0x0b8a('0x57')],null))['then'](respondWithResult(_0x22a0cc,null))['catch'](handleError(_0x22a0cc,null));};exports[_0x0b8a('0x59')]=function(_0x3f9f38,_0x588b1c){return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x3f9f38[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x588b1c,null))[_0x0b8a('0x38')](removeEntity(_0x588b1c,null))['catch'](handleError(_0x588b1c,null));};exports[_0x0b8a('0x5a')]=function(_0x173221,_0x4a56cc){return db[_0x0b8a('0x3e')][_0x0b8a('0x5a')]()[_0x0b8a('0x38')](respondWithResult(_0x4a56cc,null))[_0x0b8a('0x54')](handleError(_0x4a56cc,null));};var interaction_log=require('../../config/logger')(_0x0b8a('0x5b'));exports['accept']=function(_0x53144f,_0x144beb,_0x22061c){var _0x1fdc20={'agent':{},'channel':_0x0b8a('0x5c')};if(_0x53144f['body']['id']){delete _0x53144f[_0x0b8a('0x57')]['id'];}_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x5d')]=!![];_0x53144f['body']['readAt']=moment()[_0x0b8a('0x5e')](_0x0b8a('0x5f'));_0x53144f[_0x0b8a('0x57')]['UserId']=_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')]||_0x53144f[_0x0b8a('0x61')]['id'];_0x1fdc20['agent']['id']=_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')];return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x53144f['params']['id'],'UserId':null}})[_0x0b8a('0x38')](handleEntityNotFound(_0x144beb,null))['then'](saveUpdates(_0x53144f[_0x0b8a('0x57')],null))[_0x0b8a('0x38')](function(_0x494208){if(_0x494208){_0x1fdc20[_0x0b8a('0x2a')]=_0x494208[_0x0b8a('0x62')]({'plain':!![]});return db[_0x0b8a('0x63')][_0x0b8a('0x55')]({'where':{'id':_0x494208[_0x0b8a('0x64')]}});}return null;})[_0x0b8a('0x38')](handleEntityNotFound(_0x144beb,null))[_0x0b8a('0x38')](function(_0xaff5){if(_0xaff5){return _0xaff5[_0x0b8a('0x37')]({'UserId':_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')],'read1stAt':_['isNil'](_0xaff5[_0x0b8a('0x65')])?moment()[_0x0b8a('0x5e')](_0x0b8a('0x5f')):undefined});}return null;})[_0x0b8a('0x38')](function(_0x5a2aeb){if(_0x5a2aeb){_0x1fdc20[_0x0b8a('0x66')]=_0x5a2aeb[_0x0b8a('0x62')]({'plain':!![]});interaction_log[_0x0b8a('0x22')](_0x0b8a('0x67'),_0x53144f['user']['id'],_0x53144f[_0x0b8a('0x61')][_0x0b8a('0x3a')],_0x53144f[_0x0b8a('0x61')]['role'],_0x1fdc20[_0x0b8a('0x66')]['id'],_0x53144f['body']?JSON[_0x0b8a('0x27')](_0x53144f[_0x0b8a('0x57')]):_0x0b8a('0x68'));return respondWithRpcPromise('AcceptMessage',_0x0b8a('0x69'),_0x1fdc20);}return null;})[_0x0b8a('0x38')](function(_0x5af193){var _0x2332ec=_0x0b8a('0x6a')+_0x5af193[_0x0b8a('0x2a')][_0x0b8a('0x6b')];return db['sequelize'][_0x0b8a('0x44')](_0x2332ec,{'type':db[_0x0b8a('0x6c')][_0x0b8a('0x6d')][_0x0b8a('0x6e')],'raw':!![]})[_0x0b8a('0x38')](function(_0x127900){return _0x127900;});})['then'](function(_0x5a05ad){if(_0x5a05ad){_0x1fdc20[_0x0b8a('0x2a')][_0x0b8a('0x6f')]=_0x5a05ad[0x0];if(!_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')])return;return db[_0x0b8a('0x70')][_0x0b8a('0x55')]({'where':{'id':_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x60')],'role':_0x0b8a('0x71')},'attributes':['id',_0x0b8a('0x3a'),_0x0b8a('0x72'),_0x0b8a('0x73'),_0x0b8a('0x74')],'raw':!![]});}return null;})[_0x0b8a('0x38')](function(_0x34b55a){if(!_0x34b55a)return null;_0x1fdc20['message'][_0x0b8a('0x71')]=_0x34b55a;return _0x1fdc20;})['then'](function(_0x2e3764){if(_0x2e3764){if(_0x53144f[_0x0b8a('0x57')][_0x0b8a('0x75')]){_0x1fdc20[_0x0b8a('0x2a')][_0x0b8a('0x76')]=util[_0x0b8a('0x5e')](_0x0b8a('0x77'),_0x53144f[_0x0b8a('0x61')][_0x0b8a('0x3a')]);_0x1fdc20[_0x0b8a('0x2a')]['channel']=_0x1fdc20['channel'];_0x1fdc20[_0x0b8a('0x2a')]['motionChannel']=_0x1fdc20['channel'];_0x1fdc20[_0x0b8a('0x2a')]['event']=_0x0b8a('0x78');return respondWithRpcPromise('EventManager',_0x0b8a('0x79'),{'event':_0x0b8a('0x7a'),'message':_0x1fdc20[_0x0b8a('0x2a')]},client9002)[_0x0b8a('0x38')](function(){return _0x1fdc20;});}return _0x1fdc20;}return null;})[_0x0b8a('0x38')](respondWithResult(_0x144beb,null))[_0x0b8a('0x54')](handleError(_0x144beb,null));};var interaction_log=require(_0x0b8a('0x13'))('sms-interactions');exports['reject']=function(_0x1c481d,_0x5b6735,_0x1c5a54){var _0x22bd0f={'agent':{},'channel':_0x0b8a('0x5c')};if(_0x1c481d[_0x0b8a('0x57')]['id']){delete _0x1c481d[_0x0b8a('0x57')]['id'];}_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')]=_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')]||_0x1c481d[_0x0b8a('0x61')]['id'];_0x22bd0f[_0x0b8a('0x71')]['id']=_0x1c481d['body'][_0x0b8a('0x60')];return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x1c481d[_0x0b8a('0x58')]['id'],'UserId':null}})[_0x0b8a('0x38')](handleEntityNotFound(_0x5b6735,null))[_0x0b8a('0x38')](function(_0x3652a5){if(_0x3652a5){_0x22bd0f[_0x0b8a('0x2a')]=_0x3652a5[_0x0b8a('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3652a5['SmsInteractionId']}});}return null;})[_0x0b8a('0x38')](handleEntityNotFound(_0x5b6735,null))[_0x0b8a('0x38')](function(_0x459931){if(_0x459931){_0x22bd0f[_0x0b8a('0x66')]=_0x459931[_0x0b8a('0x62')]({'plain':!![]});interaction_log[_0x0b8a('0x22')](_0x0b8a('0x7b'),_0x1c481d['user']['id'],_0x1c481d['user'][_0x0b8a('0x3a')],_0x1c481d[_0x0b8a('0x61')][_0x0b8a('0x7c')],_0x22bd0f[_0x0b8a('0x66')]['id'],_0x1c481d[_0x0b8a('0x57')]?JSON[_0x0b8a('0x27')](_0x1c481d[_0x0b8a('0x57')]):_0x0b8a('0x68'));return respondWithRpcPromise(_0x0b8a('0x7d'),_0x0b8a('0x7e'),_0x22bd0f);}return null;})['then'](function(_0x103aad){var _0x3cdc30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x103aad[_0x0b8a('0x2a')][_0x0b8a('0x6b')];return db[_0x0b8a('0x7f')][_0x0b8a('0x44')](_0x3cdc30,{'type':db[_0x0b8a('0x6c')]['QueryTypes'][_0x0b8a('0x6e')],'raw':!![]})[_0x0b8a('0x38')](function(_0x4e45d7){return _0x4e45d7;});})[_0x0b8a('0x38')](function(_0x2707c3){if(_0x2707c3){_0x22bd0f[_0x0b8a('0x2a')]['contact']=_0x2707c3[0x0];if(!_0x1c481d['body'][_0x0b8a('0x60')])return;return db[_0x0b8a('0x70')][_0x0b8a('0x55')]({'where':{'id':_0x1c481d[_0x0b8a('0x57')][_0x0b8a('0x60')],'role':_0x0b8a('0x71')},'attributes':['id',_0x0b8a('0x3a'),_0x0b8a('0x72'),_0x0b8a('0x73'),_0x0b8a('0x74')],'raw':!![]});}return null;})[_0x0b8a('0x38')](function(_0x2dcc18){if(!_0x2dcc18)return null;_0x22bd0f[_0x0b8a('0x2a')]['agent']=_0x2dcc18;return _0x22bd0f;})[_0x0b8a('0x38')](function(_0x32bc3f){if(_0x32bc3f){_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x76')]=util['format'](_0x0b8a('0x77'),_0x1c481d['user'][_0x0b8a('0x3a')]);_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x80')]=_0x22bd0f[_0x0b8a('0x80')];_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x81')]=_0x22bd0f[_0x0b8a('0x80')];_0x32bc3f[_0x0b8a('0x2a')][_0x0b8a('0x82')]=_0x0b8a('0x83');respondWithRpcPromise(_0x0b8a('0x79'),_0x0b8a('0x79'),{'event':_0x0b8a('0x84'),'message':_0x32bc3f[_0x0b8a('0x2a')]},client9002);return _0x22bd0f;}return null;})['then'](respondWithResult(_0x5b6735,null))[_0x0b8a('0x54')](handleError(_0x5b6735,null));};exports[_0x0b8a('0x2d')]=function(_0x1e501f,_0x1b287c,_0x5eb97e){if(_0x1e501f[_0x0b8a('0x57')]['id']){delete _0x1e501f[_0x0b8a('0x57')]['id'];}var _0x147c14;return db[_0x0b8a('0x3e')][_0x0b8a('0x55')]({'where':{'id':_0x1e501f[_0x0b8a('0x58')]['id']}})[_0x0b8a('0x38')](handleEntityNotFound(_0x1b287c,null))[_0x0b8a('0x38')](function(_0x22a785){if(_0x22a785){_0x147c14=_0x22a785;return db[_0x0b8a('0x85')][_0x0b8a('0x55')]({'where':{'id':_0x22a785[_0x0b8a('0x86')]}});}})[_0x0b8a('0x38')](handleEntityNotFound(_0x1b287c,null))[_0x0b8a('0x38')](function(_0xb9769a){if(_0xb9769a){logger[_0x0b8a('0x25')](_0x0b8a('0x26'),_0x0b8a('0x2d'),_0x0b8a('0x87'),_0xb9769a[_0x0b8a('0x41')],util['inspect'](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));switch(_0xb9769a[_0x0b8a('0x41')]){case _0x0b8a('0x88'):if(_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x89')]&&_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x89')]===_0x147c14['messageId']){return _0x147c14['update']({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x88'),util[_0x0b8a('0x8b')](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x0b8a('0x8c'):if(_0x1e501f['body'][_0x0b8a('0x8d')]&&_0x1e501f['body']['MessageUUID']===_0x147c14[_0x0b8a('0x8e')]&&_[_0x0b8a('0x8f')](['sent','delivered'],_0x1e501f[_0x0b8a('0x57')][_0x0b8a('0x90')])>=0x0){return _0x147c14[_0x0b8a('0x37')]({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x91'),util['inspect'](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;case _0x0b8a('0x92'):var _0x1a66c8=_0x1e501f['body'][_0x0b8a('0x93')][0x0];if(_0x1a66c8[_0x0b8a('0x2d')][_0x0b8a('0x94')]===_0x0b8a('0x95')){return _0x147c14[_0x0b8a('0x37')]({'read':!![]});}else{logger[_0x0b8a('0x28')](_0x0b8a('0x8a'),_0x0b8a('0x2d'),_0x0b8a('0x92'),util[_0x0b8a('0x8b')](_0x1e501f[_0x0b8a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x147c14;}})[_0x0b8a('0x38')](respondWithResult(_0x1b287c,null))[_0x0b8a('0x54')](handleError(_0x1b287c,null));}; \ No newline at end of file +var _0xef1a=['SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','infobip','results','groupName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','client','http','request','then','info','debug','request\x20sent','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','count','set','json','apply','reject','save','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','show','length','include','find','create','body','params','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','update','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','event','EventManager','SmsInteractionId','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','internal','interface','rejectmessage','SmsAccount'];(function(_0x122f5a,_0x4828d3){var _0x570a96=function(_0x5c31d0){while(--_0x5c31d0){_0x122f5a['push'](_0x122f5a['shift']());}};_0x570a96(++_0x4828d3);}(_0xef1a,0x1c1));var _0xaef1=function(_0x3d2244,_0x2680d9){_0x3d2244=_0x3d2244-0x0;var _0x554105=_0xef1a[_0x3d2244];return _0x554105;};'use strict';var emlformat=require(_0xaef1('0x0'));var rimraf=require(_0xaef1('0x1'));var zipdir=require(_0xaef1('0x2'));var jsonpatch=require(_0xaef1('0x3'));var rp=require(_0xaef1('0x4'));var moment=require(_0xaef1('0x5'));var BPromise=require(_0xaef1('0x6'));var Mustache=require(_0xaef1('0x7'));var util=require(_0xaef1('0x8'));var path=require(_0xaef1('0x9'));var sox=require(_0xaef1('0xa'));var csv=require(_0xaef1('0xb'));var ejs=require(_0xaef1('0xc'));var fs=require('fs');var fs_extra=require(_0xaef1('0xd'));var _=require(_0xaef1('0xe'));var squel=require(_0xaef1('0xf'));var crypto=require(_0xaef1('0x10'));var jsforce=require(_0xaef1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xaef1('0xb'));var querystring=require(_0xaef1('0x12'));var Papa=require(_0xaef1('0x13'));var Redis=require('ioredis');var authService=require(_0xaef1('0x14'));var qs=require(_0xaef1('0x15'));var as=require(_0xaef1('0x16'));var hardwareService=require(_0xaef1('0x17'));var logger=require(_0xaef1('0x18'))('api');var utils=require(_0xaef1('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xaef1('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaef1('0x1b')](config[_0xaef1('0x1c')],{'host':_0xaef1('0x1d'),'port':0x18eb});var socket=require(_0xaef1('0x1e'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xaef1('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xaef1('0x20')][_0xaef1('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xaef1('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1a3a4c,_0x10bb85,_0x12c0b1,_0x361c01){return new BPromise(function(_0x41028e,_0x11394e){var _0x251fae=_0x361c01||client;return _0x251fae[_0xaef1('0x22')](_0x1a3a4c,_0x12c0b1)[_0xaef1('0x23')](function(_0x44170e){logger[_0xaef1('0x24')]('SmsMessage,\x20%s,\x20%s',_0x10bb85,'request\x20sent');logger[_0xaef1('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x10bb85,_0xaef1('0x26'),JSON[_0xaef1('0x27')](_0x44170e));if(_0x44170e[_0xaef1('0x28')]){if(_0x44170e['error']['code']===0x1f4){logger['error'](_0xaef1('0x29'),_0x10bb85,_0x44170e[_0xaef1('0x28')]['message']);return _0x11394e(_0x44170e[_0xaef1('0x28')][_0xaef1('0x2a')]);}logger[_0xaef1('0x28')](_0xaef1('0x29'),_0x10bb85,_0x44170e['error'][_0xaef1('0x2a')]);return _0x41028e(_0x44170e[_0xaef1('0x28')][_0xaef1('0x2a')]);}else{logger[_0xaef1('0x24')](_0xaef1('0x29'),_0x10bb85,_0xaef1('0x26'));_0x41028e(_0x44170e[_0xaef1('0x2b')]['message']);}})[_0xaef1('0x2c')](function(_0x5acf0d){logger[_0xaef1('0x28')](_0xaef1('0x29'),_0x10bb85,_0x5acf0d);_0x11394e(_0x5acf0d);});});}function respondWithStatusCode(_0x2d8dda,_0x276ecd){_0x276ecd=_0x276ecd||0xcc;return function(_0x2aa3f7){if(_0x2aa3f7){return _0x2d8dda['sendStatus'](_0x276ecd);}return _0x2d8dda[_0xaef1('0x2d')](_0x276ecd)[_0xaef1('0x2e')]();};}function respondWithResult(_0x56a70f,_0x4361d1){_0x4361d1=_0x4361d1||0xc8;return function(_0xa3342){if(_0xa3342){return _0x56a70f['status'](_0x4361d1)['json'](_0xa3342);}};}function respondWithFilteredResult(_0x270400,_0x55d019){return function(_0xb66e30){if(_0xb66e30){var _0x5ac53a=typeof _0x55d019[_0xaef1('0x2f')]===_0xaef1('0x30')&&typeof _0x55d019['limit']===_0xaef1('0x30');var _0x8422ad=_0xb66e30[_0xaef1('0x31')];var _0x469726=_0x5ac53a?0x0:_0x55d019[_0xaef1('0x2f')];var _0x4b0c75=_0x5ac53a?_0xb66e30[_0xaef1('0x31')]:_0x55d019['offset']+_0x55d019['limit'];var _0x510ff1;if(_0x4b0c75>=_0x8422ad){_0x4b0c75=_0x8422ad;_0x510ff1=0xc8;}else{_0x510ff1=0xce;}_0x270400[_0xaef1('0x2d')](_0x510ff1);return _0x270400[_0xaef1('0x32')]('Content-Range',_0x469726+'-'+_0x4b0c75+'/'+_0x8422ad)[_0xaef1('0x33')](_0xb66e30);}return null;};}function patchUpdates(_0x3cadc2){return function(_0x2f2f12){try{jsonpatch[_0xaef1('0x34')](_0x2f2f12,_0x3cadc2,!![]);}catch(_0x472218){return BPromise[_0xaef1('0x35')](_0x472218);}return _0x2f2f12[_0xaef1('0x36')]();};}function saveUpdates(_0x520486,_0x278ed3){return function(_0xbb402c){if(_0xbb402c){return _0xbb402c['update'](_0x520486)[_0xaef1('0x23')](function(_0x2a7d8c){return _0x2a7d8c;});}return null;};}function removeEntity(_0x1c5f31,_0x395e97){return function(_0x718811){if(_0x718811){return _0x718811[_0xaef1('0x37')]()[_0xaef1('0x23')](function(){_0x1c5f31[_0xaef1('0x2d')](0xcc)[_0xaef1('0x2e')]();});}};}function handleEntityNotFound(_0x50298e,_0x211214){return function(_0x259d55){if(!_0x259d55){_0x50298e['sendStatus'](0x194);}return _0x259d55;};}function handleError(_0x57b548,_0x4523a2){_0x4523a2=_0x4523a2||0x1f4;return function(_0x174a85){logger[_0xaef1('0x28')](_0x174a85['stack']);if(_0x174a85['name']){delete _0x174a85[_0xaef1('0x38')];}_0x57b548[_0xaef1('0x2d')](_0x4523a2)[_0xaef1('0x39')](_0x174a85);};}exports[_0xaef1('0x3a')]=function(_0x5b8f5b,_0xccc0cb){var _0x5c0903={},_0x2dccf0={},_0x294d9c={'count':0x0,'rows':[]};var _0x20e049=_['map'](db[_0xaef1('0x3b')][_0xaef1('0x3c')],function(_0x24357e){return{'name':_0x24357e[_0xaef1('0x3d')],'type':_0x24357e['type']['key']};});_0x2dccf0[_0xaef1('0x3e')]=_[_0xaef1('0x3f')](_0x20e049,_0xaef1('0x38'));_0x2dccf0[_0xaef1('0x40')]=_[_0xaef1('0x41')](_0x5b8f5b['query']);_0x2dccf0[_0xaef1('0x42')]=_['intersection'](_0x2dccf0[_0xaef1('0x3e')],_0x2dccf0['query']);_0x5c0903[_0xaef1('0x43')]=_[_0xaef1('0x44')](_0x2dccf0[_0xaef1('0x3e')],qs['fields'](_0x5b8f5b[_0xaef1('0x40')][_0xaef1('0x45')]));_0x5c0903[_0xaef1('0x43')]=_0x5c0903[_0xaef1('0x43')]['length']?_0x5c0903[_0xaef1('0x43')]:_0x2dccf0[_0xaef1('0x3e')];if(!_0x5b8f5b[_0xaef1('0x40')][_0xaef1('0x46')]('nolimit')){_0x5c0903['limit']=qs[_0xaef1('0x47')](_0x5b8f5b[_0xaef1('0x40')]['limit']);_0x5c0903[_0xaef1('0x2f')]=qs['offset'](_0x5b8f5b[_0xaef1('0x40')]['offset']);}_0x5c0903[_0xaef1('0x48')]=qs[_0xaef1('0x49')](_0x5b8f5b[_0xaef1('0x40')]['sort']);_0x5c0903['where']=qs[_0xaef1('0x42')](_[_0xaef1('0x4a')](_0x5b8f5b[_0xaef1('0x40')],_0x2dccf0[_0xaef1('0x42')]),_0x20e049);if(_0x5b8f5b['query'][_0xaef1('0x4b')]){_0x5c0903[_0xaef1('0x4c')]=_[_0xaef1('0x4d')](_0x5c0903[_0xaef1('0x4c')],{'$or':_[_0xaef1('0x3f')](_0x20e049,function(_0x221c64){if(_0x221c64[_0xaef1('0x4e')]!=='VIRTUAL'){var _0x35a022={};_0x35a022[_0x221c64[_0xaef1('0x38')]]={'$like':'%'+_0x5b8f5b[_0xaef1('0x40')][_0xaef1('0x4b')]+'%'};return _0x35a022;}})});}_0x5c0903=_['merge']({},_0x5c0903,_0x5b8f5b[_0xaef1('0x4f')]);var _0x2ba354={'where':_0x5c0903[_0xaef1('0x4c')]};return db[_0xaef1('0x3b')][_0xaef1('0x31')](_0x2ba354)[_0xaef1('0x23')](function(_0x125b1e){_0x294d9c[_0xaef1('0x31')]=_0x125b1e;if(_0x5b8f5b[_0xaef1('0x40')][_0xaef1('0x50')]){_0x5c0903['include']=[{'all':!![]}];}return db[_0xaef1('0x3b')][_0xaef1('0x51')](_0x5c0903);})['then'](function(_0x2bacf9){_0x294d9c[_0xaef1('0x52')]=_0x2bacf9;return _0x294d9c;})[_0xaef1('0x23')](respondWithFilteredResult(_0xccc0cb,_0x5c0903))[_0xaef1('0x2c')](handleError(_0xccc0cb,null));};exports[_0xaef1('0x53')]=function(_0x25d7b3,_0x38ef22){var _0x152de1={'raw':!![],'where':{'id':_0x25d7b3['params']['id']}},_0x3f0b97={};_0x3f0b97['model']=_[_0xaef1('0x41')](db[_0xaef1('0x3b')]['rawAttributes']);_0x3f0b97[_0xaef1('0x40')]=_[_0xaef1('0x41')](_0x25d7b3[_0xaef1('0x40')]);_0x3f0b97['filters']=_[_0xaef1('0x44')](_0x3f0b97[_0xaef1('0x3e')],_0x3f0b97['query']);_0x152de1[_0xaef1('0x43')]=_[_0xaef1('0x44')](_0x3f0b97['model'],qs['fields'](_0x25d7b3[_0xaef1('0x40')][_0xaef1('0x45')]));_0x152de1[_0xaef1('0x43')]=_0x152de1['attributes'][_0xaef1('0x54')]?_0x152de1['attributes']:_0x3f0b97[_0xaef1('0x3e')];if(_0x25d7b3[_0xaef1('0x40')][_0xaef1('0x50')]){_0x152de1[_0xaef1('0x55')]=[{'all':!![]}];}_0x152de1=_['merge']({},_0x152de1,_0x25d7b3[_0xaef1('0x4f')]);return db[_0xaef1('0x3b')][_0xaef1('0x56')](_0x152de1)[_0xaef1('0x23')](handleEntityNotFound(_0x38ef22,null))['then'](respondWithResult(_0x38ef22,null))[_0xaef1('0x2c')](handleError(_0x38ef22,null));};exports[_0xaef1('0x57')]=function(_0x45a22f,_0x57edcd){return db[_0xaef1('0x3b')][_0xaef1('0x57')](_0x45a22f[_0xaef1('0x58')],{})[_0xaef1('0x23')](respondWithResult(_0x57edcd,0xc9))['catch'](handleError(_0x57edcd,null));};exports['update']=function(_0xc1ba2,_0x50d363){if(_0xc1ba2[_0xaef1('0x58')]['id']){delete _0xc1ba2[_0xaef1('0x58')]['id'];}return db[_0xaef1('0x3b')][_0xaef1('0x56')]({'where':{'id':_0xc1ba2[_0xaef1('0x59')]['id']}})['then'](handleEntityNotFound(_0x50d363,null))['then'](saveUpdates(_0xc1ba2[_0xaef1('0x58')],null))[_0xaef1('0x23')](respondWithResult(_0x50d363,null))[_0xaef1('0x2c')](handleError(_0x50d363,null));};exports[_0xaef1('0x37')]=function(_0xeecf0b,_0x2c7df0){return db[_0xaef1('0x3b')]['find']({'where':{'id':_0xeecf0b[_0xaef1('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c7df0,null))['then'](removeEntity(_0x2c7df0,null))['catch'](handleError(_0x2c7df0,null));};exports['describe']=function(_0x54e6d9,_0x20f626){return db[_0xaef1('0x3b')]['describe']()[_0xaef1('0x23')](respondWithResult(_0x20f626,null))[_0xaef1('0x2c')](handleError(_0x20f626,null));};var interaction_log=require(_0xaef1('0x18'))(_0xaef1('0x5a'));exports[_0xaef1('0x5b')]=function(_0x4ddbd0,_0x4230a9,_0x939e5c){var _0x350fe7={'agent':{},'channel':_0xaef1('0x5c')};if(_0x4ddbd0[_0xaef1('0x58')]['id']){delete _0x4ddbd0[_0xaef1('0x58')]['id'];}_0x4ddbd0['body']['read']=!![];_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x5d')]=moment()[_0xaef1('0x5e')](_0xaef1('0x5f'));_0x4ddbd0[_0xaef1('0x58')]['UserId']=_0x4ddbd0['body'][_0xaef1('0x60')]||_0x4ddbd0[_0xaef1('0x61')]['id'];_0x350fe7[_0xaef1('0x62')]['id']=_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x60')];return db[_0xaef1('0x3b')]['find']({'where':{'id':_0x4ddbd0[_0xaef1('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4230a9,null))[_0xaef1('0x23')](saveUpdates(_0x4ddbd0[_0xaef1('0x58')],null))[_0xaef1('0x23')](function(_0x3eee97){if(_0x3eee97){_0x350fe7[_0xaef1('0x2a')]=_0x3eee97['get']({'plain':!![]});return db[_0xaef1('0x63')]['find']({'where':{'id':_0x3eee97['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4230a9,null))[_0xaef1('0x23')](function(_0x5df4ae){if(_0x5df4ae){return _0x5df4ae[_0xaef1('0x64')]({'UserId':_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x60')],'read1stAt':_[_0xaef1('0x65')](_0x5df4ae[_0xaef1('0x66')])?moment()['format'](_0xaef1('0x5f')):undefined});}return null;})[_0xaef1('0x23')](function(_0x5180d8){if(_0x5180d8){_0x350fe7['interaction']=_0x5180d8[_0xaef1('0x67')]({'plain':!![]});interaction_log[_0xaef1('0x24')](_0xaef1('0x68'),_0x4ddbd0[_0xaef1('0x61')]['id'],_0x4ddbd0['user'][_0xaef1('0x38')],_0x4ddbd0[_0xaef1('0x61')]['role'],_0x350fe7['interaction']['id'],_0x4ddbd0[_0xaef1('0x58')]?JSON[_0xaef1('0x27')](_0x4ddbd0[_0xaef1('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0xaef1('0x69'),_0x350fe7);}return null;})[_0xaef1('0x23')](function(_0x2964c3){var _0x4180c8=_0xaef1('0x6a')+_0x2964c3[_0xaef1('0x2a')][_0xaef1('0x6b')];return db[_0xaef1('0x6c')][_0xaef1('0x40')](_0x4180c8,{'type':db[_0xaef1('0x6d')][_0xaef1('0x6e')][_0xaef1('0x6f')],'raw':!![]})[_0xaef1('0x23')](function(_0x4afb57){return _0x4afb57;});})[_0xaef1('0x23')](function(_0x20d497){if(_0x20d497){_0x350fe7['message'][_0xaef1('0x70')]=_0x20d497[0x0];if(!_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x60')])return;return db[_0xaef1('0x71')][_0xaef1('0x56')]({'where':{'id':_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x60')],'role':_0xaef1('0x62')},'attributes':['id','name',_0xaef1('0x72'),_0xaef1('0x73'),'internal'],'raw':!![]});}return null;})[_0xaef1('0x23')](function(_0x111473){if(!_0x111473)return null;_0x350fe7[_0xaef1('0x2a')][_0xaef1('0x62')]=_0x111473;return _0x350fe7;})[_0xaef1('0x23')](function(_0x41e8ce){if(_0x41e8ce){if(_0x4ddbd0[_0xaef1('0x58')][_0xaef1('0x74')]){_0x350fe7[_0xaef1('0x2a')]['interface']=util[_0xaef1('0x5e')](_0xaef1('0x75'),_0x4ddbd0[_0xaef1('0x61')][_0xaef1('0x38')]);_0x350fe7[_0xaef1('0x2a')][_0xaef1('0x76')]=_0x350fe7[_0xaef1('0x76')];_0x350fe7['message']['motionChannel']=_0x350fe7[_0xaef1('0x76')];_0x350fe7[_0xaef1('0x2a')][_0xaef1('0x77')]='accept';return respondWithRpcPromise('EventManager',_0xaef1('0x78'),{'event':'acceptmessage','message':_0x350fe7[_0xaef1('0x2a')]},client9002)[_0xaef1('0x23')](function(){return _0x350fe7;});}return _0x350fe7;}return null;})[_0xaef1('0x23')](respondWithResult(_0x4230a9,null))[_0xaef1('0x2c')](handleError(_0x4230a9,null));};var interaction_log=require(_0xaef1('0x18'))(_0xaef1('0x5a'));exports[_0xaef1('0x35')]=function(_0x5ee9b1,_0x26b505,_0x17717a){var _0xbcbc0f={'agent':{},'channel':_0xaef1('0x5c')};if(_0x5ee9b1['body']['id']){delete _0x5ee9b1[_0xaef1('0x58')]['id'];}_0x5ee9b1[_0xaef1('0x58')]['UserId']=_0x5ee9b1[_0xaef1('0x58')][_0xaef1('0x60')]||_0x5ee9b1[_0xaef1('0x61')]['id'];_0xbcbc0f['agent']['id']=_0x5ee9b1[_0xaef1('0x58')][_0xaef1('0x60')];return db['SmsMessage']['find']({'where':{'id':_0x5ee9b1[_0xaef1('0x59')]['id'],'UserId':null}})[_0xaef1('0x23')](handleEntityNotFound(_0x26b505,null))[_0xaef1('0x23')](function(_0x77a1cf){if(_0x77a1cf){_0xbcbc0f[_0xaef1('0x2a')]=_0x77a1cf['get']({'plain':!![]});return db[_0xaef1('0x63')]['find']({'where':{'id':_0x77a1cf[_0xaef1('0x79')]}});}return null;})[_0xaef1('0x23')](handleEntityNotFound(_0x26b505,null))[_0xaef1('0x23')](function(_0x4ab965){if(_0x4ab965){_0xbcbc0f[_0xaef1('0x7a')]=_0x4ab965[_0xaef1('0x67')]({'plain':!![]});interaction_log[_0xaef1('0x24')](_0xaef1('0x7b'),_0x5ee9b1[_0xaef1('0x61')]['id'],_0x5ee9b1['user'][_0xaef1('0x38')],_0x5ee9b1[_0xaef1('0x61')]['role'],_0xbcbc0f[_0xaef1('0x7a')]['id'],_0x5ee9b1['body']?JSON[_0xaef1('0x27')](_0x5ee9b1[_0xaef1('0x58')]):_0xaef1('0x7c'));return respondWithRpcPromise(_0xaef1('0x7d'),_0xaef1('0x7e'),_0xbcbc0f);}return null;})[_0xaef1('0x23')](function(_0x35868e){var _0x2b079d=_0xaef1('0x6a')+_0x35868e[_0xaef1('0x2a')]['ContactId'];return db['sequelize'][_0xaef1('0x40')](_0x2b079d,{'type':db[_0xaef1('0x6d')]['QueryTypes'][_0xaef1('0x6f')],'raw':!![]})[_0xaef1('0x23')](function(_0x5d2912){return _0x5d2912;});})[_0xaef1('0x23')](function(_0x318935){if(_0x318935){_0xbcbc0f[_0xaef1('0x2a')][_0xaef1('0x70')]=_0x318935[0x0];if(!_0x5ee9b1[_0xaef1('0x58')]['UserId'])return;return db[_0xaef1('0x71')][_0xaef1('0x56')]({'where':{'id':_0x5ee9b1[_0xaef1('0x58')][_0xaef1('0x60')],'role':_0xaef1('0x62')},'attributes':['id',_0xaef1('0x38'),_0xaef1('0x72'),_0xaef1('0x73'),_0xaef1('0x7f')],'raw':!![]});}return null;})[_0xaef1('0x23')](function(_0x5b6630){if(!_0x5b6630)return null;_0xbcbc0f[_0xaef1('0x2a')][_0xaef1('0x62')]=_0x5b6630;return _0xbcbc0f;})[_0xaef1('0x23')](function(_0xdc8d63){if(_0xdc8d63){_0xdc8d63[_0xaef1('0x2a')][_0xaef1('0x80')]=util[_0xaef1('0x5e')](_0xaef1('0x75'),_0x5ee9b1['user'][_0xaef1('0x38')]);_0xdc8d63[_0xaef1('0x2a')][_0xaef1('0x76')]=_0xbcbc0f['channel'];_0xdc8d63['message']['motionChannel']=_0xbcbc0f[_0xaef1('0x76')];_0xdc8d63[_0xaef1('0x2a')][_0xaef1('0x77')]=_0xaef1('0x35');respondWithRpcPromise(_0xaef1('0x78'),_0xaef1('0x78'),{'event':_0xaef1('0x81'),'message':_0xdc8d63[_0xaef1('0x2a')]},client9002);return _0xbcbc0f;}return null;})[_0xaef1('0x23')](respondWithResult(_0x26b505,null))[_0xaef1('0x2c')](handleError(_0x26b505,null));};exports['status']=function(_0x4c571d,_0x5ab45a,_0x497abe){if(_0x4c571d[_0xaef1('0x58')]['id']){delete _0x4c571d[_0xaef1('0x58')]['id'];}var _0x4658f4;return db[_0xaef1('0x3b')]['find']({'where':{'id':_0x4c571d['params']['id']}})[_0xaef1('0x23')](handleEntityNotFound(_0x5ab45a,null))[_0xaef1('0x23')](function(_0x4add31){if(_0x4add31){_0x4658f4=_0x4add31;return db[_0xaef1('0x82')][_0xaef1('0x56')]({'where':{'id':_0x4add31[_0xaef1('0x83')]}});}})[_0xaef1('0x23')](handleEntityNotFound(_0x5ab45a,null))[_0xaef1('0x23')](function(_0x2180b6){if(_0x2180b6){logger[_0xaef1('0x25')](_0xaef1('0x84'),_0xaef1('0x2d'),'received\x20delivery\x20report\x20from',_0x2180b6[_0xaef1('0x4e')],util[_0xaef1('0x85')](_0x4c571d[_0xaef1('0x58')],{'showHidden':![],'depth':null}));switch(_0x2180b6[_0xaef1('0x4e')]){case _0xaef1('0x86'):if(_0x4c571d[_0xaef1('0x58')][_0xaef1('0x87')]&&_0x4c571d[_0xaef1('0x58')][_0xaef1('0x87')]===_0x4658f4[_0xaef1('0x88')]){return _0x4658f4[_0xaef1('0x64')]({'read':!![]});}else{logger[_0xaef1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaef1('0x2d'),_0xaef1('0x86'),util[_0xaef1('0x85')](_0x4c571d[_0xaef1('0x58')],{'showHidden':![],'depth':null}));}break;case _0xaef1('0x89'):if(_0x4c571d[_0xaef1('0x58')][_0xaef1('0x8a')]&&_0x4c571d[_0xaef1('0x58')][_0xaef1('0x8a')]===_0x4658f4[_0xaef1('0x88')]&&_['indexOf']([_0xaef1('0x8b'),_0xaef1('0x8c')],_0x4c571d[_0xaef1('0x58')][_0xaef1('0x8d')])>=0x0){return _0x4658f4[_0xaef1('0x64')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','plivio',util[_0xaef1('0x85')](_0x4c571d[_0xaef1('0x58')],{'showHidden':![],'depth':null}));}break;case _0xaef1('0x8e'):var _0x51b593=_0x4c571d[_0xaef1('0x58')][_0xaef1('0x8f')][0x0];if(_0x51b593[_0xaef1('0x2d')][_0xaef1('0x90')]==='DELIVERED'){return _0x4658f4[_0xaef1('0x64')]({'read':!![]});}else{logger[_0xaef1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaef1('0x2d'),'infobip',util[_0xaef1('0x85')](_0x4c571d[_0xaef1('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4658f4;}})[_0xaef1('0x23')](respondWithResult(_0x5ab45a,null))['catch'](handleError(_0x5ab45a,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7079798..723bb98 100644 --- a/server/api/smsMessage/smsMessage.events.js +++ b/server/api/smsMessage/smsMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd23e=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x43356f,_0x44b293){var _0x3f5546=function(_0x479658){while(--_0x479658){_0x43356f['push'](_0x43356f['shift']());}};_0x3f5546(++_0x44b293);}(_0xd23e,0x181));var _0xed23=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xd23e[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0xed23('0x0'));var SmsMessage=require(_0xed23('0x1'))['db'][_0xed23('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xed23('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed23('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2702e1){return function(_0x298564,_0x20105d,_0x28b344){SmsMessageEvents['emit'](_0x2702e1+':'+_0x298564['id'],_0x298564);SmsMessageEvents[_0xed23('0x5')](_0x2702e1,_0x298564);_0x28b344(null);};}for(var e in events){if(events[_0xed23('0x6')](e)){var event=events[e];SmsMessage[_0xed23('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x62fb=['../../mysqldb','SmsMessage','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x121195,_0x2cd8b8){var _0x363aea=function(_0xa148f9){while(--_0xa148f9){_0x121195['push'](_0x121195['shift']());}};_0x363aea(++_0x2cd8b8);}(_0x62fb,0x198));var _0xb62f=function(_0x5c487f,_0x3f3c5b){_0x5c487f=_0x5c487f-0x0;var _0x2cb3bb=_0x62fb[_0x5c487f];return _0x2cb3bb;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb62f('0x0'))['db'][_0xb62f('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb62f('0x2')](0x0);var events={'afterCreate':_0xb62f('0x3'),'afterUpdate':'update','afterDestroy':_0xb62f('0x4')};function emitEvent(_0x4ad19d){return function(_0x33b623,_0x43814c,_0x28f768){SmsMessageEvents[_0xb62f('0x5')](_0x4ad19d+':'+_0x33b623['id'],_0x33b623);SmsMessageEvents[_0xb62f('0x5')](_0x4ad19d,_0x33b623);_0x28f768(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xb62f('0x6')](e,emitEvent(event));}}module[_0xb62f('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 321580e..03b95f5 100644 --- a/server/api/smsMessage/smsMessage.model.js +++ b/server/api/smsMessage/smsMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b3e=['https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','application/json','message','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','secret','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','senderString','remote','%s:%s','authId','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','infobip','csc','login','text','timestamp','keys','length','apiKey','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1b3e,0x16d));var _0xe1b3=function(_0xaeea2d,_0x32d6be){_0xaeea2d=_0xaeea2d-0x0;var _0x466247=_0x1b3e[_0xaeea2d];return _0x466247;};'use strict';var _=require('lodash');var util=require(_0xe1b3('0x0'));var logger=require(_0xe1b3('0x1'))(_0xe1b3('0x2'));var moment=require('moment');var BPromise=require(_0xe1b3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1b3('0x4'));var rimraf=require(_0xe1b3('0x5'));var config=require('../../config/environment');var attributes=require(_0xe1b3('0x6'));module['exports']=function(_0x3e32d6,_0x5b4724){return _0x3e32d6[_0xe1b3('0x7')](_0xe1b3('0x8'),attributes,{'tableName':_0xe1b3('0x9'),'paranoid':![],'indexes':[{'name':_0xe1b3('0xa'),'fields':[_0xe1b3('0xa')]},{'name':_0xe1b3('0xb'),'fields':[_0xe1b3('0xc')],'type':_0xe1b3('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c2cdf,_0x5f285c,_0x4d1e11){var _0xb27cf7=_0x3e32d6[_0xe1b3('0xe')];var _0x5b3a6c=_0x3c2cdf['get']({'plain':!![]});if(_0x5b3a6c[_0xe1b3('0xf')][_0xe1b3('0x10')]()==='in'||_0x5b3a6c[_0xe1b3('0xf')][_0xe1b3('0x10')]()===_0xe1b3('0x11')&&!_0x5b3a6c['secret']&&!_['isNil'](_0x5b3a6c[_0xe1b3('0x12')])&&!_['isNil'](_0x5b3a6c['SmsInteractionId'])){_0xb27cf7[_0xe1b3('0x13')][_0xe1b3('0x14')]({'where':{'id':_0x5b3a6c[_0xe1b3('0x15')]}})[_0xe1b3('0x16')](function(_0x4e8a10){if(_0x4e8a10){_0x4e8a10[_0xe1b3('0x17')]({'lastMsgAt':_0x5b3a6c['createdAt'],'lastMsgDirection':_0x5b3a6c['direction'][_0xe1b3('0x10')]()});}})[_0xe1b3('0x18')](function(_0xd73529){console['error'](_0xd73529);});}if(_0x5b3a6c[_0xe1b3('0xf')]==='out'&&!_0x5b3a6c[_0xe1b3('0x19')]){var _0x4173ea;_0xb27cf7['SmsAccount']['find']({'where':{'id':_0x5b3a6c[_0xe1b3('0x1a')]},'raw':!![]})[_0xe1b3('0x16')](function(_0x2a79a1){_0x4173ea=_0x2a79a1;if(_0x4173ea&&_0x4173ea[_0xe1b3('0x1b')]){switch(_0x4173ea[_0xe1b3('0x1b')]){case _0xe1b3('0x1c'):var _0x2ef214=require(_0xe1b3('0x1c'));if(_0x4173ea[_0xe1b3('0x1d')]&&_0x4173ea['authToken']&&_0x4173ea[_0xe1b3('0x1e')]){var _0x35d53e=new _0x2ef214(_0x4173ea[_0xe1b3('0x1d')],_0x4173ea[_0xe1b3('0x1f')]);_0x35d53e[_0xe1b3('0x20')][_0xe1b3('0x21')]({'body':_0x5b3a6c['body'],'to':_0x5b3a6c[_0xe1b3('0x1e')],'from':_0x4173ea[_0xe1b3('0x1e')],'statusCallback':_0x4173ea['remote']+_0xe1b3('0x22')+_0x5b3a6c['id']+_0xe1b3('0x23')+_0x4173ea[_0xe1b3('0x24')]})[_0xe1b3('0x16')](function(_0x28a3cc){if(_0x28a3cc[_0xe1b3('0x25')]){return _0x3c2cdf[_0xe1b3('0x17')]({'messageId':_0x28a3cc[_0xe1b3('0x25')]});}})[_0xe1b3('0x18')](function(_0x1dcce8){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x1c'),util[_0xe1b3('0x29')](_0x1dcce8,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate','twilio',_0xe1b3('0x2a'));}break;case _0xe1b3('0x2b'):var _0x21266b='https://api.skebby.it/API/v1.0/REST/';if(_0x4173ea['username']&&_0x4173ea[_0xe1b3('0x2c')]){var _0x3e5f80={'recipient':[_0x5b3a6c[_0xe1b3('0x1e')]],'message':_0x5b3a6c[_0xe1b3('0xc')],'message_type':_0x4173ea[_0xe1b3('0x2d')]};if(_0x4173ea[_0xe1b3('0x2d')]&&_0x4173ea[_0xe1b3('0x2d')]!=='SI'){_0x3e5f80[_0xe1b3('0x2e')]=_0x4173ea[_0xe1b3('0x1e')];}var _0x4989f6={'url':_0x21266b+_0xe1b3('0x2f')+_0x4173ea['username']+_0xe1b3('0x30')+_0x4173ea['password'],'method':'GET'};rp(_0x4989f6)['then'](function(_0x2201cf){var _0x3978a6=_0x2201cf[_0xe1b3('0x31')](';');var _0x407f5d={'user_key':_0x3978a6[0x0],'session_key':_0x3978a6[0x1]};_0x4989f6={'url':_0x21266b+'sms','method':_0xe1b3('0x32'),'headers':{'user_key':_0x407f5d[_0xe1b3('0x33')],'Session_key':_0x407f5d[_0xe1b3('0x34')]},'json':!![],'body':_0x3e5f80};return rp(_0x4989f6);})['then'](function(_0x39820d){if(_0x39820d[_0xe1b3('0x35')]>=0x1){var _0x1e3e17={'messageId':_0x39820d[_0xe1b3('0x36')]};if(_0x4173ea[_0xe1b3('0x2d')]!=='GP'||!_0x4173ea[_0xe1b3('0x37')]){_0x1e3e17[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x1e3e17);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x2b'),util[_0xe1b3('0x29')](_0x39820d,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x4450fa){return logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x2b'),util[_0xe1b3('0x29')](_0x4450fa,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x2b'),_0xe1b3('0x39'));}break;case _0xe1b3('0x3a'):if(_0x4173ea[_0xe1b3('0x1f')]){var _0x5d635c={'recipient':_0x5b3a6c['phone'],'message':_0x5b3a6c[_0xe1b3('0xc')],'sender':_0x4173ea['senderString']||_0x4173ea[_0xe1b3('0x1e')],'authorization':_0x4173ea[_0xe1b3('0x1f')]};var _0x5f285c={'method':_0xe1b3('0x32'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5d635c,'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0x4dcf09){var _0x3b62c6={'messageId':_0x4dcf09['requestid']};if(!_0x4173ea[_0xe1b3('0x37')]){_0x3b62c6[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x3b62c6);})[_0xe1b3('0x18')](function(_0x4b34de){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x3a'),util['inspect'](_0x4b34de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x3a'),_0xe1b3('0x3b'));}break;case _0xe1b3('0x3c'):if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea['password']){var _0x5d635c={'messages':[{'source':_0xe1b3('0x3e'),'to':_0x5b3a6c[_0xe1b3('0x1e')],'body':_0x5b3a6c['body'],'from':_0x4173ea['senderString']||_0x4173ea[_0xe1b3('0x1e')]}]};var _0x38026b=util[_0xe1b3('0x3f')]('%s:%s',_0x4173ea[_0xe1b3('0x3d')],_0x4173ea[_0xe1b3('0x2c')]);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x40'),'body':_0x5d635c,'headers':{'Authorization':util['format'](_0xe1b3('0x41'),new Buffer(_0x38026b)[_0xe1b3('0x42')](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0x2b74d7){if(_0x2b74d7['http_code']>=0xc8&&_0x2b74d7[_0xe1b3('0x44')]<=0xce){if(_0x2b74d7[_0xe1b3('0x45')]&&_0x2b74d7[_0xe1b3('0x45')]['queued_count']>0x0){var _0x2f6d08=_[_0xe1b3('0x46')](_0x2b74d7[_0xe1b3('0x45')][_0xe1b3('0x20')]);var _0x2736e8={'messageId':_0x2f6d08[_0xe1b3('0x47')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x2736e8[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x2736e8);}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x2b74d7,{'showHidden':![],'depth':null}));}}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x2b74d7,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x43f66f){logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe1b3('0x48'),util[_0xe1b3('0x29')](_0x43f66f,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x48'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x4173ea['authId']&&_0x4173ea['authToken']){var _0x5d635c={'dst':_0x5b3a6c['phone'],'text':_0x5b3a6c['body'],'src':_0x4173ea[_0xe1b3('0x49')]||_0x4173ea['phone'],'url':_0x4173ea[_0xe1b3('0x4a')]+'/api/sms/messages/'+_0x5b3a6c['id']+'/status?token='+_0x4173ea[_0xe1b3('0x24')]};var _0x38026b=util[_0xe1b3('0x3f')](_0xe1b3('0x4b'),_0x4173ea[_0xe1b3('0x4c')],_0x4173ea['authToken']);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':util[_0xe1b3('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4173ea['authId']),'body':_0x5d635c,'headers':{'Authorization':util[_0xe1b3('0x3f')]('Basic\x20%s',new Buffer(_0x38026b)[_0xe1b3('0x42')](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)[_0xe1b3('0x16')](function(_0xe13d35){var _0x300352={'messageId':_0xe13d35['message_uuid'][0x0]};return _0x3c2cdf[_0xe1b3('0x17')](_0x300352);})[_0xe1b3('0x18')](function(_0x188f7e){logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x4d'),util['inspect'](_0x188f7e,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea[_0xe1b3('0x2c')]){if(_0x4173ea[_0xe1b3('0x4e')]){var _0x5c4fa5={'method':_0xe1b3('0x32'),'uri':_0x4173ea[_0xe1b3('0x4e')]+_0xe1b3('0x4f'),'body':{'username':_0x4173ea[_0xe1b3('0x3d')],'password':_0x4173ea[_0xe1b3('0x2c')]},'json':!![]};return rp(_0x5c4fa5)[_0xe1b3('0x16')](function(_0x73bcd6){var _0x232cd5={'method':_0xe1b3('0x32'),'uri':_0x4173ea['baseUrl']+_0xe1b3('0x50'),'body':{'messages':[{'from':_0x4173ea[_0xe1b3('0x1e')],'destinations':[{'to':_0x5b3a6c[_0xe1b3('0x1e')]}],'text':_0x5b3a6c[_0xe1b3('0xc')],'notifyUrl':_0x4173ea[_0xe1b3('0x4a')]+_0xe1b3('0x22')+_0x5b3a6c['id']+'/status?token='+_0x4173ea['token'],'notifyContentType':'application/json','callbackData':_0x4173ea[_0xe1b3('0x1e')]+';'+_0x5b3a6c[_0xe1b3('0xc')]}]},'headers':{'Authorization':_0xe1b3('0x51')+_0x73bcd6['token']},'json':!![]};return rp(_0x232cd5)['then'](function(_0x139b2b){if(_0x139b2b[_0xe1b3('0x20')]){var _0x13b12f={'messageId':_0x139b2b[_0xe1b3('0x20')][0x0][_0xe1b3('0xa')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x13b12f[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x13b12f);}else{return logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x52'),util[_0xe1b3('0x29')](_0x139b2b,{'showHidden':![],'depth':null}));}});})[_0xe1b3('0x18')](function(_0x34069f){return logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x52'),util[_0xe1b3('0x29')](_0x34069f,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0xe1b3('0x53'):var _0x45a0d0=require('crypto');if(_0x4173ea['apiKey']){var _0x33b363={};_0x33b363[_0xe1b3('0x54')]=_0x4173ea[_0xe1b3('0x3d')];_0x33b363['phone']=_0x5b3a6c['phone'];_0x33b363[_0xe1b3('0x2e')]=_0x4173ea[_0xe1b3('0x1e')];_0x33b363[_0xe1b3('0x55')]=_0x5b3a6c['body'];_0x33b363[_0xe1b3('0x56')]=+new Date();var _0x1ed39b='';var _0x276133='';var _0x2d3380=Object[_0xe1b3('0x57')](_0x33b363);_0x2d3380['sort']();for(var _0x4bb8b3=0x0;_0x4bb8b3<_0x2d3380[_0xe1b3('0x58')];_0x4bb8b3++){if(_0x1ed39b!=''){_0x1ed39b+='&';}_0x1ed39b+=_0x2d3380[_0x4bb8b3]+'='+encodeURIComponent(_0x33b363[_0x2d3380[_0x4bb8b3]]);_0x276133+=_0x33b363[_0x2d3380[_0x4bb8b3]];}_0x276133+=_0x4173ea[_0xe1b3('0x59')];_0x276133=_0x45a0d0['createHash'](_0xe1b3('0x5a'))[_0xe1b3('0x17')](_0x276133)[_0xe1b3('0x5b')](_0xe1b3('0x5c'));if(_0x1ed39b!==''){_0x1ed39b+='&';}_0x1ed39b+=_0xe1b3('0x5d')+_0x276133;var _0x4989f6={'method':_0xe1b3('0x5e'),'uri':_0x4173ea['baseUrl']+_0xe1b3('0x5f')+_0x1ed39b,'json':!![]};return rp(_0x4989f6)['then'](function(_0x5d21aa){var _0x5a58fe=Object['keys'](_0x5d21aa);if(_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x26')]&&parseInt(_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x26')])===0x0){var _0x5920a6={'messageId':_0x5d21aa[_0x5a58fe[0x0]][_0xe1b3('0x60')]};if(!_0x4173ea[_0xe1b3('0x37')]){_0x5920a6[_0xe1b3('0x38')]=!![];}return _0x3c2cdf[_0xe1b3('0x17')](_0x5920a6);}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x53'),util[_0xe1b3('0x29')](_0x5d21aa[_0xe1b3('0x26')],{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x340d96){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'csc',util[_0xe1b3('0x29')](_0x340d96,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),'csc',_0xe1b3('0x61'));}break;case _0xe1b3('0x62'):if(_0x4173ea[_0xe1b3('0x59')]){var _0x5e9e5b={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x63'),'headers':{'Authorization':_0x4173ea[_0xe1b3('0x59')]},'body':{'content':_0x5b3a6c[_0xe1b3('0xc')],'to':[_0x5b3a6c['phone']],'from':_0x4173ea[_0xe1b3('0x1e')],'binary':![],'clientMessageId':_0xe1b3('0x64'),'charset':_0xe1b3('0x65')},'json':!![]};rp(_0x5e9e5b)[_0xe1b3('0x16')](function(_0x3c998c){if(!_0x3c998c[_0xe1b3('0x26')]){var _0x513338={'messageId':_0x3c998c[_0xe1b3('0x20')][0x0]['apiMessageId']};if(!_0x4173ea[_0xe1b3('0x37')]){_0x513338['read']=!![];}return _0x3c2cdf['update'](_0x513338);}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),'clickatell',util[_0xe1b3('0x29')](_0x3c998c['error'],{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x2fefe2){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x62'),util[_0xe1b3('0x29')](_0x2fefe2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe1b3('0x27'),_0xe1b3('0x28'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xe1b3('0x66'):if(_0x4173ea[_0xe1b3('0x3d')]&&_0x4173ea['password']){var _0x38026b=util[_0xe1b3('0x3f')](_0xe1b3('0x4b'),_0x4173ea[_0xe1b3('0x3d')],_0x4173ea[_0xe1b3('0x2c')]);var _0x5f285c={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x67')+_0x4173ea[_0xe1b3('0x68')]+_0xe1b3('0x69'),'body':{'to':[_0x5b3a6c[_0xe1b3('0x1e')]],'text':_0x5b3a6c[_0xe1b3('0xc')],'from':_0x4173ea[_0xe1b3('0x1e')],'applicationId':_0x4173ea['applicationId']},'headers':{'Authorization':util['format'](_0xe1b3('0x41'),new Buffer(_0x38026b)['toString'](_0xe1b3('0x43')))},'json':!![]};rp(_0x5f285c)['then'](function(_0x137521){if(_0x137521['id']){var _0x215b67={'messageId':_0x137521['id']};return _0x3c2cdf[_0xe1b3('0x17')](_0x215b67);}else{logger['error'](_0xe1b3('0x27'),'afterCreate',_0xe1b3('0x66'),util['inspect'](_0x137521,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x1da770){logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x66'),util[_0xe1b3('0x29')](_0x1da770,{'showHidden':![],'depth':null}));});}else{logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe1b3('0x28'),_0xe1b3('0x66'),_0xe1b3('0x39'));}break;case'intelepeer':if(_0x4173ea['apiKey']){var _0x1369aa={};var _0x4989f6={'method':_0xe1b3('0x32'),'uri':_0xe1b3('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x4173ea[_0xe1b3('0x59')],'Content-Type':'application/json'},'body':{'from':_0x4173ea[_0xe1b3('0x1e')],'to':_0x5b3a6c[_0xe1b3('0x1e')],'text':_0x5b3a6c[_0xe1b3('0xc')]},'json':!![]};return rp(_0x4989f6)[_0xe1b3('0x16')](function(_0x55a1eb){if(_0x55a1eb['code']==0xca){_0x1369aa['message']=_0x55a1eb;var _0x149840={'method':'POST','uri':_0xe1b3('0x6b'),'headers':{'Authorization':_0xe1b3('0x6c')+_0x4173ea[_0xe1b3('0x59')],'Content-Type':_0xe1b3('0x6d')},'body':{'refid':_0x1369aa[_0xe1b3('0x6e')]['refid']},'json':!![]};return rp(_0x149840)[_0xe1b3('0x16')](function(_0x19804f){_0x1369aa[_0xe1b3('0x6f')]=_0x19804f;var _0x165b6a={'messageId':_0x1369aa[_0xe1b3('0x6e')][_0xe1b3('0x70')],'read':!![]};return _0x3c2cdf['update'](_0x165b6a);});}else{return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x71'),util['inspect'](_0x55a1eb,{'showHidden':![],'depth':null}));}})[_0xe1b3('0x18')](function(_0x38fb77){return logger[_0xe1b3('0x26')](_0xe1b3('0x27'),_0xe1b3('0x28'),_0xe1b3('0x71'),util[_0xe1b3('0x29')](_0x38fb77,{'showHidden':![],'depth':null}));});}else{return logger[_0xe1b3('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe1b3('0x71'),_0xe1b3('0x72'));}break;}}})[_0xe1b3('0x73')](function(){_0x4d1e11();});}else{_0x4d1e11();}}},'charset':_0xe1b3('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8820=['Missing\x20parameters:\x20base_url','apiKey','login','sender','text','keys','sort','length','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','then','update','createdAt','catch','error','SmsAccountId','type','twilio','accountSid','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','head','data','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip'];(function(_0x556d84,_0x57b7a2){var _0x430879=function(_0x5197b4){while(--_0x5197b4){_0x556d84['push'](_0x556d84['shift']());}};_0x430879(++_0x57b7a2);}(_0x8820,0x97));var _0x0882=function(_0x277ff4,_0x582774){_0x277ff4=_0x277ff4-0x0;var _0x167a32=_0x8820[_0x277ff4];return _0x167a32;};'use strict';var _=require(_0x0882('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0882('0x1'));var moment=require(_0x0882('0x2'));var BPromise=require(_0x0882('0x3'));var rp=require(_0x0882('0x4'));var fs=require('fs');var path=require(_0x0882('0x5'));var rimraf=require(_0x0882('0x6'));var config=require(_0x0882('0x7'));var attributes=require('./smsMessage.attributes');module[_0x0882('0x8')]=function(_0x1f81ce,_0x4a80d1){return _0x1f81ce[_0x0882('0x9')]('SmsMessage',attributes,{'tableName':_0x0882('0xa'),'paranoid':![],'indexes':[{'name':_0x0882('0xb'),'fields':[_0x0882('0xb')]},{'name':_0x0882('0xc'),'fields':[_0x0882('0xd')],'type':_0x0882('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x76bca9,_0x9f157d,_0x1b709f){var _0x4b2f31=_0x1f81ce[_0x0882('0xf')];var _0xba58fa=_0x76bca9[_0x0882('0x10')]({'plain':!![]});if(_0xba58fa[_0x0882('0x11')][_0x0882('0x12')]()==='in'||_0xba58fa[_0x0882('0x11')][_0x0882('0x12')]()===_0x0882('0x13')&&!_0xba58fa[_0x0882('0x14')]&&!_[_0x0882('0x15')](_0xba58fa['UserId'])&&!_['isNil'](_0xba58fa[_0x0882('0x16')])){_0x4b2f31[_0x0882('0x17')]['findOne']({'where':{'id':_0xba58fa[_0x0882('0x16')]}})[_0x0882('0x18')](function(_0x246cd1){if(_0x246cd1){_0x246cd1[_0x0882('0x19')]({'lastMsgAt':_0xba58fa[_0x0882('0x1a')],'lastMsgDirection':_0xba58fa['direction']['toLowerCase']()});}})[_0x0882('0x1b')](function(_0x36c0a){console[_0x0882('0x1c')](_0x36c0a);});}if(_0xba58fa[_0x0882('0x11')]==='out'&&!_0xba58fa[_0x0882('0x14')]){var _0x29f3ba;_0x4b2f31['SmsAccount']['find']({'where':{'id':_0xba58fa[_0x0882('0x1d')]},'raw':!![]})[_0x0882('0x18')](function(_0x29edd4){_0x29f3ba=_0x29edd4;if(_0x29f3ba&&_0x29f3ba[_0x0882('0x1e')]){switch(_0x29f3ba[_0x0882('0x1e')]){case _0x0882('0x1f'):var _0xb735be=require(_0x0882('0x1f'));if(_0x29f3ba[_0x0882('0x20')]&&_0x29f3ba['authToken']&&_0x29f3ba[_0x0882('0x21')]){var _0x199d34=new _0xb735be(_0x29f3ba[_0x0882('0x20')],_0x29f3ba['authToken']);_0x199d34[_0x0882('0x22')][_0x0882('0x23')]({'body':_0xba58fa[_0x0882('0xd')],'to':_0xba58fa[_0x0882('0x21')],'from':_0x29f3ba[_0x0882('0x21')],'statusCallback':_0x29f3ba[_0x0882('0x24')]+_0x0882('0x25')+_0xba58fa['id']+_0x0882('0x26')+_0x29f3ba[_0x0882('0x27')]})[_0x0882('0x18')](function(_0x50d6a5){if(_0x50d6a5['sid']){return _0x76bca9[_0x0882('0x19')]({'messageId':_0x50d6a5['sid']});}})['catch'](function(_0x5e6ad9){logger[_0x0882('0x1c')](_0x0882('0x28'),'afterCreate','twilio',util['inspect'](_0x5e6ad9,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0882('0x29'),_0x0882('0x1f'),_0x0882('0x2a'));}break;case'skebby':var _0x48a2fd='https://api.skebby.it/API/v1.0/REST/';if(_0x29f3ba[_0x0882('0x2b')]&&_0x29f3ba[_0x0882('0x2c')]){var _0xa8d877={'recipient':[_0xba58fa[_0x0882('0x21')]],'message':_0xba58fa['body'],'message_type':_0x29f3ba[_0x0882('0x2d')]};if(_0x29f3ba[_0x0882('0x2d')]&&_0x29f3ba[_0x0882('0x2d')]!=='SI'){_0xa8d877['sender']=_0x29f3ba[_0x0882('0x21')];}var _0x4b7ca3={'url':_0x48a2fd+'login?username='+_0x29f3ba[_0x0882('0x2b')]+_0x0882('0x2e')+_0x29f3ba['password'],'method':_0x0882('0x2f')};rp(_0x4b7ca3)['then'](function(_0x55d313){var _0xb4b14a=_0x55d313['split'](';');var _0x284a98={'user_key':_0xb4b14a[0x0],'session_key':_0xb4b14a[0x1]};_0x4b7ca3={'url':_0x48a2fd+_0x0882('0x30'),'method':_0x0882('0x31'),'headers':{'user_key':_0x284a98[_0x0882('0x32')],'Session_key':_0x284a98[_0x0882('0x33')]},'json':!![],'body':_0xa8d877};return rp(_0x4b7ca3);})['then'](function(_0x56ab08){if(_0x56ab08[_0x0882('0x34')]>=0x1){var _0x12dd89={'messageId':_0x56ab08[_0x0882('0x35')]};if(_0x29f3ba[_0x0882('0x2d')]!=='GP'||!_0x29f3ba[_0x0882('0x36')]){_0x12dd89[_0x0882('0x37')]=!![];}return _0x76bca9['update'](_0x12dd89);}else{return logger['error'](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x38'),util[_0x0882('0x39')](_0x56ab08,{'showHidden':![],'depth':null}));}})[_0x0882('0x1b')](function(_0x2d94b6){return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x38'),util[_0x0882('0x39')](_0x2d94b6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0882('0x28'),'afterCreate','skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x29f3ba[_0x0882('0x3a')]){var _0x2c5006={'recipient':_0xba58fa['phone'],'message':_0xba58fa[_0x0882('0xd')],'sender':_0x29f3ba[_0x0882('0x3b')]||_0x29f3ba[_0x0882('0x21')],'authorization':_0x29f3ba[_0x0882('0x3a')]};var _0x9f157d={'method':_0x0882('0x31'),'uri':_0x0882('0x3c'),'body':_0x2c5006,'json':!![]};rp(_0x9f157d)[_0x0882('0x18')](function(_0x598056){var _0x4c3a3d={'messageId':_0x598056['requestid']};if(!_0x29f3ba['deliveryReport']){_0x4c3a3d[_0x0882('0x37')]=!![];}return _0x76bca9[_0x0882('0x19')](_0x4c3a3d);})[_0x0882('0x1b')](function(_0x49846c){logger[_0x0882('0x1c')](_0x0882('0x28'),'afterCreate','connectel',util['inspect'](_0x49846c,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x3d'),_0x0882('0x3e'));}break;case _0x0882('0x3f'):if(_0x29f3ba[_0x0882('0x2b')]&&_0x29f3ba['password']){var _0x2c5006={'messages':[{'source':_0x0882('0x40'),'to':_0xba58fa[_0x0882('0x21')],'body':_0xba58fa[_0x0882('0xd')],'from':_0x29f3ba[_0x0882('0x3b')]||_0x29f3ba[_0x0882('0x21')]}]};var _0x4c7ad1=util['format'](_0x0882('0x41'),_0x29f3ba[_0x0882('0x2b')],_0x29f3ba['password']);var _0x9f157d={'method':_0x0882('0x31'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2c5006,'headers':{'Authorization':util[_0x0882('0x42')](_0x0882('0x43'),new Buffer(_0x4c7ad1)[_0x0882('0x44')](_0x0882('0x45')))},'json':!![]};rp(_0x9f157d)[_0x0882('0x18')](function(_0x2158ad){if(_0x2158ad[_0x0882('0x46')]>=0xc8&&_0x2158ad[_0x0882('0x46')]<=0xce){if(_0x2158ad['data']&&_0x2158ad['data']['queued_count']>0x0){var _0x37c5e0=_[_0x0882('0x47')](_0x2158ad[_0x0882('0x48')][_0x0882('0x22')]);var _0x515ef1={'messageId':_0x37c5e0[_0x0882('0x49')]};if(!_0x29f3ba['deliveryReport']){_0x515ef1[_0x0882('0x37')]=!![];}return _0x76bca9[_0x0882('0x19')](_0x515ef1);}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),'clickSend',util[_0x0882('0x39')](_0x2158ad,{'showHidden':![],'depth':null}));}}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x4a'),util[_0x0882('0x39')](_0x2158ad,{'showHidden':![],'depth':null}));}})[_0x0882('0x1b')](function(_0x1a2b32){logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0882('0x4a'),util[_0x0882('0x39')](_0x1a2b32,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0882('0x29'),'clickSend',_0x0882('0x4b'));}break;case _0x0882('0x4c'):if(_0x29f3ba[_0x0882('0x4d')]&&_0x29f3ba[_0x0882('0x3a')]){var _0x2c5006={'dst':_0xba58fa['phone'],'text':_0xba58fa[_0x0882('0xd')],'src':_0x29f3ba[_0x0882('0x3b')]||_0x29f3ba['phone'],'url':_0x29f3ba['remote']+_0x0882('0x25')+_0xba58fa['id']+_0x0882('0x26')+_0x29f3ba[_0x0882('0x27')]};var _0x4c7ad1=util[_0x0882('0x42')](_0x0882('0x41'),_0x29f3ba[_0x0882('0x4d')],_0x29f3ba[_0x0882('0x3a')]);var _0x9f157d={'method':_0x0882('0x31'),'uri':util[_0x0882('0x42')](_0x0882('0x4e'),_0x29f3ba[_0x0882('0x4d')]),'body':_0x2c5006,'headers':{'Authorization':util['format'](_0x0882('0x43'),new Buffer(_0x4c7ad1)[_0x0882('0x44')](_0x0882('0x45')))},'json':!![]};rp(_0x9f157d)[_0x0882('0x18')](function(_0x40a7e5){var _0x2dd722={'messageId':_0x40a7e5[_0x0882('0x4f')][0x0]};return _0x76bca9[_0x0882('0x19')](_0x2dd722);})['catch'](function(_0x1765f2){logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x4c'),util[_0x0882('0x39')](_0x1765f2,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x4c'),_0x0882('0x50'));}break;case'infobip':if(_0x29f3ba[_0x0882('0x2b')]&&_0x29f3ba[_0x0882('0x2c')]){if(_0x29f3ba[_0x0882('0x51')]){var _0x47080a={'method':_0x0882('0x31'),'uri':_0x29f3ba[_0x0882('0x51')]+_0x0882('0x52'),'body':{'username':_0x29f3ba[_0x0882('0x2b')],'password':_0x29f3ba[_0x0882('0x2c')]},'json':!![]};return rp(_0x47080a)[_0x0882('0x18')](function(_0x4700b7){var _0x2aa38a={'method':_0x0882('0x31'),'uri':_0x29f3ba[_0x0882('0x51')]+_0x0882('0x53'),'body':{'messages':[{'from':_0x29f3ba[_0x0882('0x21')],'destinations':[{'to':_0xba58fa[_0x0882('0x21')]}],'text':_0xba58fa[_0x0882('0xd')],'notifyUrl':_0x29f3ba[_0x0882('0x24')]+'/api/sms/messages/'+_0xba58fa['id']+'/status?token='+_0x29f3ba['token'],'notifyContentType':_0x0882('0x54'),'callbackData':_0x29f3ba[_0x0882('0x21')]+';'+_0xba58fa[_0x0882('0xd')]}]},'headers':{'Authorization':_0x0882('0x55')+_0x4700b7[_0x0882('0x27')]},'json':!![]};return rp(_0x2aa38a)[_0x0882('0x18')](function(_0x5bb4a3){if(_0x5bb4a3[_0x0882('0x22')]){var _0x3e79ed={'messageId':_0x5bb4a3[_0x0882('0x22')][0x0][_0x0882('0xb')]};if(!_0x29f3ba[_0x0882('0x36')]){_0x3e79ed[_0x0882('0x37')]=!![];}return _0x76bca9[_0x0882('0x19')](_0x3e79ed);}else{return logger['error'](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x56'),util[_0x0882('0x39')](_0x5bb4a3,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2c3b5c){return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x56'),util[_0x0882('0x39')](_0x2c3b5c,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')](_0x0882('0x28'),'afterCreate','infobip',_0x0882('0x57'));}}else{logger[_0x0882('0x1c')](_0x0882('0x28'),'afterCreate','infobip',_0x0882('0x4b'));}break;case'csc':var _0x1505d2=require('crypto');if(_0x29f3ba[_0x0882('0x58')]){var _0x3238f4={};_0x3238f4[_0x0882('0x59')]=_0x29f3ba[_0x0882('0x2b')];_0x3238f4[_0x0882('0x21')]=_0xba58fa[_0x0882('0x21')];_0x3238f4[_0x0882('0x5a')]=_0x29f3ba['phone'];_0x3238f4[_0x0882('0x5b')]=_0xba58fa[_0x0882('0xd')];_0x3238f4['timestamp']=+new Date();var _0x3e36d3='';var _0x3dc025='';var _0x56edb6=Object[_0x0882('0x5c')](_0x3238f4);_0x56edb6[_0x0882('0x5d')]();for(var _0x220469=0x0;_0x220469<_0x56edb6[_0x0882('0x5e')];_0x220469++){if(_0x3e36d3!=''){_0x3e36d3+='&';}_0x3e36d3+=_0x56edb6[_0x220469]+'='+encodeURIComponent(_0x3238f4[_0x56edb6[_0x220469]]);_0x3dc025+=_0x3238f4[_0x56edb6[_0x220469]];}_0x3dc025+=_0x29f3ba[_0x0882('0x58')];_0x3dc025=_0x1505d2['createHash']('md5')[_0x0882('0x19')](_0x3dc025)['digest']('hex');if(_0x3e36d3!==''){_0x3e36d3+='&';}_0x3e36d3+=_0x0882('0x5f')+_0x3dc025;var _0x4b7ca3={'method':_0x0882('0x2f'),'uri':_0x29f3ba[_0x0882('0x51')]+_0x0882('0x60')+_0x3e36d3,'json':!![]};return rp(_0x4b7ca3)[_0x0882('0x18')](function(_0x381f91){var _0x44d7a6=Object[_0x0882('0x5c')](_0x381f91);if(_0x381f91[_0x44d7a6[0x0]][_0x0882('0x1c')]&&parseInt(_0x381f91[_0x44d7a6[0x0]][_0x0882('0x1c')])===0x0){var _0x270846={'messageId':_0x381f91[_0x44d7a6[0x0]]['id_sms']};if(!_0x29f3ba[_0x0882('0x36')]){_0x270846[_0x0882('0x37')]=!![];}return _0x76bca9[_0x0882('0x19')](_0x270846);}else{return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),'csc',util[_0x0882('0x39')](_0x381f91[_0x0882('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x492707){return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x61'),util[_0x0882('0x39')](_0x492707,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x61'),_0x0882('0x62'));}break;case _0x0882('0x63'):if(_0x29f3ba[_0x0882('0x58')]){var _0x199be8={'method':_0x0882('0x31'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x29f3ba[_0x0882('0x58')]},'body':{'content':_0xba58fa[_0x0882('0xd')],'to':[_0xba58fa['phone']],'from':_0x29f3ba['phone'],'binary':![],'clientMessageId':_0x0882('0x64'),'charset':_0x0882('0x65')},'json':!![]};rp(_0x199be8)[_0x0882('0x18')](function(_0x1a1411){if(!_0x1a1411[_0x0882('0x1c')]){var _0x51be10={'messageId':_0x1a1411['messages'][0x0][_0x0882('0x66')]};if(!_0x29f3ba[_0x0882('0x36')]){_0x51be10['read']=!![];}return _0x76bca9[_0x0882('0x19')](_0x51be10);}else{return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x63'),util[_0x0882('0x39')](_0x1a1411['error'],{'showHidden':![],'depth':null}));}})[_0x0882('0x1b')](function(_0x3d848f){return logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0882('0x29'),_0x0882('0x63'),util['inspect'](_0x3d848f,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0882('0x29'),_0x0882('0x63'),_0x0882('0x62'));}break;case _0x0882('0x67'):if(_0x29f3ba[_0x0882('0x2b')]&&_0x29f3ba['password']){var _0x4c7ad1=util[_0x0882('0x42')](_0x0882('0x41'),_0x29f3ba['username'],_0x29f3ba[_0x0882('0x2c')]);var _0x9f157d={'method':'POST','uri':_0x0882('0x68')+_0x29f3ba[_0x0882('0x69')]+_0x0882('0x6a'),'body':{'to':[_0xba58fa[_0x0882('0x21')]],'text':_0xba58fa[_0x0882('0xd')],'from':_0x29f3ba[_0x0882('0x21')],'applicationId':_0x29f3ba[_0x0882('0x6b')]},'headers':{'Authorization':util[_0x0882('0x42')]('Basic\x20%s',new Buffer(_0x4c7ad1)[_0x0882('0x44')](_0x0882('0x45')))},'json':!![]};rp(_0x9f157d)[_0x0882('0x18')](function(_0x5ed012){if(_0x5ed012['id']){var _0x22075f={'messageId':_0x5ed012['id']};return _0x76bca9[_0x0882('0x19')](_0x22075f);}else{logger[_0x0882('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0882('0x29'),_0x0882('0x67'),util[_0x0882('0x39')](_0x5ed012,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2520ab){logger[_0x0882('0x1c')](_0x0882('0x28'),'afterCreate',_0x0882('0x67'),util[_0x0882('0x39')](_0x2520ab,{'showHidden':![],'depth':null}));});}else{logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x67'),_0x0882('0x4b'));}break;case'intelepeer':if(_0x29f3ba['apiKey']){var _0x11fabd={};var _0x4b7ca3={'method':_0x0882('0x31'),'uri':_0x0882('0x6c'),'headers':{'Authorization':'Bearer\x20'+_0x29f3ba[_0x0882('0x58')],'Content-Type':_0x0882('0x54')},'body':{'from':_0x29f3ba[_0x0882('0x21')],'to':_0xba58fa[_0x0882('0x21')],'text':_0xba58fa[_0x0882('0xd')]},'json':!![]};return rp(_0x4b7ca3)[_0x0882('0x18')](function(_0xb6a115){if(_0xb6a115[_0x0882('0x6d')]==0xca){_0x11fabd['message']=_0xb6a115;var _0x2831f6={'method':_0x0882('0x31'),'uri':_0x0882('0x6e'),'headers':{'Authorization':_0x0882('0x6f')+_0x29f3ba[_0x0882('0x58')],'Content-Type':_0x0882('0x54')},'body':{'refid':_0x11fabd['message'][_0x0882('0x70')]},'json':!![]};return rp(_0x2831f6)[_0x0882('0x18')](function(_0x167e22){_0x11fabd[_0x0882('0x71')]=_0x167e22;var _0x851e35={'messageId':_0x11fabd[_0x0882('0x72')]['refid'],'read':!![]};return _0x76bca9[_0x0882('0x19')](_0x851e35);});}else{return logger[_0x0882('0x1c')](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x73'),util[_0x0882('0x39')](_0xb6a115,{'showHidden':![],'depth':null}));}})[_0x0882('0x1b')](function(_0xd362bd){return logger['error'](_0x0882('0x28'),_0x0882('0x29'),_0x0882('0x73'),util['inspect'](_0xd362bd,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x0882('0x28'),'afterCreate',_0x0882('0x73'),_0x0882('0x74'));}break;}}})[_0x0882('0x75')](function(){_0x1b709f();});}else{_0x1b709f();}}},'charset':'utf8mb4','collate':_0x0882('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 43bac64..9244ac0 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc506=['raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateSmsMessage','create','body','options'];(function(_0x50f6e7,_0x566a01){var _0x362e69=function(_0x1c8e53){while(--_0x1c8e53){_0x50f6e7['push'](_0x50f6e7['shift']());}};_0x362e69(++_0x566a01);}(_0xc506,0x16d));var _0x6c50=function(_0x4cdba5,_0x5373a7){_0x4cdba5=_0x4cdba5-0x0;var _0x3be43d=_0xc506[_0x4cdba5];return _0x3be43d;};'use strict';var _=require(_0x6c50('0x0'));var util=require(_0x6c50('0x1'));var moment=require(_0x6c50('0x2'));var BPromise=require(_0x6c50('0x3'));var rs=require(_0x6c50('0x4'));var fs=require('fs');var Redis=require(_0x6c50('0x5'));var db=require(_0x6c50('0x6'))['db'];var utils=require(_0x6c50('0x7'));var logger=require(_0x6c50('0x8'))(_0x6c50('0x9'));var config=require(_0x6c50('0xa'));var jayson=require(_0x6c50('0xb'));var client=jayson[_0x6c50('0xc')][_0x6c50('0xd')]({'port':0x232a});config[_0x6c50('0xe')]=_[_0x6c50('0xf')](config['redis'],{'host':_0x6c50('0x10'),'port':0x18eb});var socket=require(_0x6c50('0x11'))(new Redis(config[_0x6c50('0xe')]));require(_0x6c50('0x12'))['register'](socket);function respondWithRpcPromise(_0x32e0aa,_0x435c86,_0x4ab943){return new BPromise(function(_0x11d094,_0x563620){return client['request'](_0x32e0aa,_0x4ab943)['then'](function(_0x13c358){logger[_0x6c50('0x13')](_0x6c50('0x14'),_0x435c86,_0x6c50('0x15'));logger[_0x6c50('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x435c86,_0x6c50('0x15'),JSON[_0x6c50('0x17')](_0x13c358));if(_0x13c358['error']){if(_0x13c358[_0x6c50('0x18')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x435c86,_0x13c358[_0x6c50('0x18')][_0x6c50('0x19')]);return _0x563620(_0x13c358['error'][_0x6c50('0x19')]);}logger[_0x6c50('0x18')](_0x6c50('0x14'),_0x435c86,_0x13c358['error']['message']);return _0x11d094(_0x13c358['error'][_0x6c50('0x19')]);}else{logger[_0x6c50('0x13')](_0x6c50('0x14'),_0x435c86,'request\x20sent');_0x11d094(_0x13c358[_0x6c50('0x1a')]['message']);}})['catch'](function(_0xc870b1){logger[_0x6c50('0x18')](_0x6c50('0x14'),_0x435c86,_0xc870b1);_0x563620(_0xc870b1);});});}exports[_0x6c50('0x1b')]=function(_0x3163a5){var _0x17208a=this;return new Promise(function(_0x256631,_0x1db0ee){return db['SmsMessage'][_0x6c50('0x1c')](_0x3163a5[_0x6c50('0x1d')],{'raw':_0x3163a5[_0x6c50('0x1e')]?_0x3163a5[_0x6c50('0x1e')][_0x6c50('0x1f')]===undefined?!![]:![]:!![]})[_0x6c50('0x20')](function(_0x52818a){logger[_0x6c50('0x13')](_0x6c50('0x1b'),_0x3163a5);logger[_0x6c50('0x16')]('CreateSmsMessage',_0x3163a5,JSON['stringify'](_0x52818a));_0x256631(_0x52818a);})['catch'](function(_0x2f1f77){logger[_0x6c50('0x18')](_0x6c50('0x1b'),_0x2f1f77[_0x6c50('0x19')],_0x3163a5);_0x1db0ee(_0x17208a[_0x6c50('0x18')](0x1f4,_0x2f1f77[_0x6c50('0x19')]));});});}; \ No newline at end of file +var _0x6e96=['then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','socket.io-emitter','./smsMessage.socket','request'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x6e96,0x115));var _0x66e9=function(_0x1f43bd,_0x17f48b){_0x1f43bd=_0x1f43bd-0x0;var _0x55db6f=_0x6e96[_0x1f43bd];return _0x55db6f;};'use strict';var _=require(_0x66e9('0x0'));var util=require('util');var moment=require(_0x66e9('0x1'));var BPromise=require(_0x66e9('0x2'));var rs=require(_0x66e9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e9('0x4'))['db'];var utils=require(_0x66e9('0x5'));var logger=require(_0x66e9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x66e9('0x7')]['http']({'port':0x232a});config[_0x66e9('0x8')]=_[_0x66e9('0x9')](config[_0x66e9('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x66e9('0xa'))(new Redis(config[_0x66e9('0x8')]));require(_0x66e9('0xb'))['register'](socket);function respondWithRpcPromise(_0xbd2541,_0x3fc1b6,_0x3d9a21){return new BPromise(function(_0x30e8ef,_0xbc47cb){return client[_0x66e9('0xc')](_0xbd2541,_0x3d9a21)[_0x66e9('0xd')](function(_0x33eff4){logger[_0x66e9('0xe')](_0x66e9('0xf'),_0x3fc1b6,_0x66e9('0x10'));logger[_0x66e9('0x11')](_0x66e9('0x12'),_0x3fc1b6,'request\x20sent',JSON[_0x66e9('0x13')](_0x33eff4));if(_0x33eff4[_0x66e9('0x14')]){if(_0x33eff4[_0x66e9('0x14')]['code']===0x1f4){logger[_0x66e9('0x14')](_0x66e9('0xf'),_0x3fc1b6,_0x33eff4[_0x66e9('0x14')][_0x66e9('0x15')]);return _0xbc47cb(_0x33eff4[_0x66e9('0x14')][_0x66e9('0x15')]);}logger[_0x66e9('0x14')](_0x66e9('0xf'),_0x3fc1b6,_0x33eff4[_0x66e9('0x14')][_0x66e9('0x15')]);return _0x30e8ef(_0x33eff4[_0x66e9('0x14')][_0x66e9('0x15')]);}else{logger['info'](_0x66e9('0xf'),_0x3fc1b6,'request\x20sent');_0x30e8ef(_0x33eff4[_0x66e9('0x16')][_0x66e9('0x15')]);}})[_0x66e9('0x17')](function(_0x384f6f){logger[_0x66e9('0x14')](_0x66e9('0xf'),_0x3fc1b6,_0x384f6f);_0xbc47cb(_0x384f6f);});});}exports[_0x66e9('0x18')]=function(_0x1008fa){var _0x40b4d9=this;return new Promise(function(_0x53d8c8,_0x17ea7f){return db['SmsMessage'][_0x66e9('0x19')](_0x1008fa[_0x66e9('0x1a')],{'raw':_0x1008fa[_0x66e9('0x1b')]?_0x1008fa[_0x66e9('0x1b')][_0x66e9('0x1c')]===undefined?!![]:![]:!![]})[_0x66e9('0xd')](function(_0x3367ec){logger[_0x66e9('0xe')](_0x66e9('0x18'),_0x1008fa);logger[_0x66e9('0x11')](_0x66e9('0x18'),_0x1008fa,JSON['stringify'](_0x3367ec));_0x53d8c8(_0x3367ec);})[_0x66e9('0x17')](function(_0x1ae49b){logger['error'](_0x66e9('0x18'),_0x1ae49b[_0x66e9('0x15')],_0x1008fa);_0x17ea7f(_0x40b4d9[_0x66e9('0x14')](0x1f4,_0x1ae49b['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 0f17787..c3e4caa 100644 --- a/server/api/smsMessage/smsMessage.socket.js +++ b/server/api/smsMessage/smsMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e4=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x55abb3,_0x5c2552){var _0x586b93=function(_0x5af402){while(--_0x5af402){_0x55abb3['push'](_0x55abb3['shift']());}};_0x586b93(++_0x5c2552);}(_0x70e4,0x11b));var _0x470e=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x70e4[_0x187718];return _0x29ddf4;};'use strict';var SmsMessageEvents=require(_0x470e('0x0'));var events=[_0x470e('0x1'),_0x470e('0x2'),_0x470e('0x3')];function createListener(_0x5125f5,_0x8150f9){return function(_0x2936a1){_0x8150f9[_0x470e('0x4')](_0x5125f5,_0x2936a1);};}function removeListener(_0x33dffa,_0x559ef4){return function(){SmsMessageEvents[_0x470e('0x5')](_0x33dffa,_0x559ef4);};}exports[_0x470e('0x6')]=function(_0x9b3c17){for(var _0x423d74=0x0,_0x451331=events[_0x470e('0x7')];_0x423d74<_0x451331;_0x423d74++){var _0x1e74c7=events[_0x423d74];var _0x38c5ce=createListener(_0x470e('0x8')+_0x1e74c7,_0x9b3c17);SmsMessageEvents['on'](_0x1e74c7,_0x38c5ce);}}; \ No newline at end of file +var _0xe5a2=['save','remove','update','emit','register','length','smsMessage:','./smsMessage.events'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0xe5a2,0x12f));var _0x2e5a=function(_0x423e34,_0x4b636b){_0x423e34=_0x423e34-0x0;var _0x5afedf=_0xe5a2[_0x423e34];return _0x5afedf;};'use strict';var SmsMessageEvents=require(_0x2e5a('0x0'));var events=[_0x2e5a('0x1'),_0x2e5a('0x2'),_0x2e5a('0x3')];function createListener(_0x489e12,_0x2dd3c6){return function(_0x273612){_0x2dd3c6[_0x2e5a('0x4')](_0x489e12,_0x273612);};}function removeListener(_0x104343,_0x31a319){return function(){SmsMessageEvents['removeListener'](_0x104343,_0x31a319);};}exports[_0x2e5a('0x5')]=function(_0x5a4dda){for(var _0x40c4a9=0x0,_0x1c2ea0=events[_0x2e5a('0x6')];_0x40c4a9<_0x1c2ea0;_0x40c4a9++){var _0x495dc8=events[_0x40c4a9];var _0x835475=createListener(_0x2e5a('0x7')+_0x495dc8,_0x5a4dda);SmsMessageEvents['on'](_0x495dc8,_0x835475);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0e6a052..c5057ce 100644 --- a/server/api/smsQueue/index.js +++ b/server/api/smsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafbb=['index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated'];(function(_0x4473e4,_0x24eac9){var _0x59f07b=function(_0x1e9abf){while(--_0x1e9abf){_0x4473e4['push'](_0x4473e4['shift']());}};_0x59f07b(++_0x24eac9);}(_0xafbb,0xad));var _0xbafb=function(_0x4bdff0,_0x394598){_0x4bdff0=_0x4bdff0-0x0;var _0x55b5f3=_0xafbb[_0x4bdff0];return _0x55b5f3;};'use strict';var multer=require(_0xbafb('0x0'));var util=require(_0xbafb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbafb('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbafb('0x3'));var interaction=require(_0xbafb('0x4'));var config=require(_0xbafb('0x5'));var controller=require(_0xbafb('0x6'));router[_0xbafb('0x7')]('/',auth[_0xbafb('0x8')](),controller[_0xbafb('0x9')]);router['get'](_0xbafb('0xa'),auth['isAuthenticated'](),controller[_0xbafb('0xb')]);router[_0xbafb('0x7')](_0xbafb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xbafb('0x7')](_0xbafb('0xd'),auth[_0xbafb('0x8')](),controller[_0xbafb('0xe')]);router[_0xbafb('0x7')](_0xbafb('0xf'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x10')]);router['get'](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller['getAgents']);router[_0xbafb('0x12')]('/',auth[_0xbafb('0x8')](),controller[_0xbafb('0x13')]);router[_0xbafb('0x12')](_0xbafb('0xf'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x14')]);router['post'](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x15')]);router[_0xbafb('0x16')](_0xbafb('0xc'),auth[_0xbafb('0x8')](),controller['update']);router['delete'](_0xbafb('0xc'),auth[_0xbafb('0x8')](),controller['destroy']);router[_0xbafb('0x17')](_0xbafb('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xbafb('0x17')](_0xbafb('0x11'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x18')]);module[_0xbafb('0x19')]=router; \ No newline at end of file +var _0xd42f=['removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','getMembers','getTeams','getAgents','post','create','/:id/teams','/:id/users','addAgents','put','update','delete','destroy'];(function(_0x4f69e6,_0x19861d){var _0x703f64=function(_0xc2067e){while(--_0xc2067e){_0x4f69e6['push'](_0x4f69e6['shift']());}};_0x703f64(++_0x19861d);}(_0xd42f,0x7b));var _0xfd42=function(_0x49c324,_0x5c8ec3){_0x49c324=_0x49c324-0x0;var _0x422775=_0xd42f[_0x49c324];return _0x422775;};'use strict';var multer=require('multer');var util=require(_0xfd42('0x0'));var path=require(_0xfd42('0x1'));var timeout=require(_0xfd42('0x2'));var express=require(_0xfd42('0x3'));var router=express[_0xfd42('0x4')]();var fs_extra=require(_0xfd42('0x5'));var auth=require(_0xfd42('0x6'));var interaction=require(_0xfd42('0x7'));var config=require(_0xfd42('0x8'));var controller=require('./smsQueue.controller');router[_0xfd42('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd42('0x9')](_0xfd42('0xa'),auth[_0xfd42('0xb')](),controller[_0xfd42('0xc')]);router[_0xfd42('0x9')](_0xfd42('0xd'),auth[_0xfd42('0xb')](),controller[_0xfd42('0xe')]);router[_0xfd42('0x9')]('/:id/members',auth[_0xfd42('0xb')](),controller[_0xfd42('0xf')]);router[_0xfd42('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xfd42('0x10')]);router['get']('/:id/users',auth[_0xfd42('0xb')](),controller[_0xfd42('0x11')]);router[_0xfd42('0x12')]('/',auth[_0xfd42('0xb')](),controller[_0xfd42('0x13')]);router[_0xfd42('0x12')](_0xfd42('0x14'),auth['isAuthenticated'](),controller['addTeams']);router[_0xfd42('0x12')](_0xfd42('0x15'),auth['isAuthenticated'](),controller[_0xfd42('0x16')]);router[_0xfd42('0x17')](_0xfd42('0xd'),auth[_0xfd42('0xb')](),controller[_0xfd42('0x18')]);router[_0xfd42('0x19')](_0xfd42('0xd'),auth[_0xfd42('0xb')](),controller[_0xfd42('0x1a')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xfd42('0x1b')]);router[_0xfd42('0x19')](_0xfd42('0x15'),auth['isAuthenticated'](),controller[_0xfd42('0x1c')]);module[_0xfd42('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 23ab52e..0f997d2 100644 --- a/server/api/smsQueue/smsQueue.attributes.js +++ b/server/api/smsQueue/smsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3878bd,_0x51e3e5){var _0x359e60=function(_0xe70276){while(--_0xe70276){_0x3878bd['push'](_0x3878bd['shift']());}};_0x359e60(++_0x51e3e5);}(_0x8b8e,0x1e2));var _0xe8b8=function(_0x314dab,_0x19b6be){_0x314dab=_0x314dab-0x0;var _0x154d75=_0x8b8e[_0x314dab];return _0x154d75;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module[_0xe8b8('0x1')]={'name':{'type':Sequelize[_0xe8b8('0x2')],'unique':_0xe8b8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe8b8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8b8('0x5')]('rrmemory',_0xe8b8('0x6'),_0xe8b8('0x7'))}}; \ No newline at end of file +var _0xfb37=['STRING','name','INTEGER','beepall','exports'];(function(_0x433914,_0x539077){var _0x36691e=function(_0x54dc1a){while(--_0x54dc1a){_0x433914['push'](_0x433914['shift']());}};_0x36691e(++_0x539077);}(_0xfb37,0xc2));var _0x7fb3=function(_0x3c08ea,_0x419b25){_0x3c08ea=_0x3c08ea-0x0;var _0x4b6e51=_0xfb37[_0x3c08ea];return _0x4b6e51;};'use strict';var Sequelize=require('sequelize');module[_0x7fb3('0x0')]={'name':{'type':Sequelize[_0x7fb3('0x1')],'unique':_0x7fb3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fb3('0x1')]},'timeout':{'type':Sequelize[_0x7fb3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x7fb3('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 4230fc1..cdd0aba 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23db=['smsPause','createdAt','%s/%s','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userSmsQueue:save','removeTeams','Team','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','includes','all','union','compact','isEmpty','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','apply','reject','save','update','then','get','UserProfileResource','destroy','end','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','keys','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','autoAssociation','error','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','findAll','User','findAndCountAll','UserId'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x23db,0x141));var _0xb23d=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x23db[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0xb23d('0x0'));var rimraf=require(_0xb23d('0x1'));var zipdir=require(_0xb23d('0x2'));var jsonpatch=require(_0xb23d('0x3'));var rp=require(_0xb23d('0x4'));var moment=require(_0xb23d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb23d('0x6'));var path=require(_0xb23d('0x7'));var sox=require('sox');var csv=require(_0xb23d('0x8'));var ejs=require(_0xb23d('0x9'));var fs=require('fs');var fs_extra=require(_0xb23d('0xa'));var _=require(_0xb23d('0xb'));var squel=require(_0xb23d('0xc'));var crypto=require(_0xb23d('0xd'));var jsforce=require(_0xb23d('0xe'));var deskjs=require(_0xb23d('0xf'));var toCsv=require(_0xb23d('0x8'));var querystring=require('querystring');var Papa=require(_0xb23d('0x10'));var Redis=require(_0xb23d('0x11'));var authService=require(_0xb23d('0x12'));var qs=require(_0xb23d('0x13'));var as=require(_0xb23d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb23d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb23d('0x16'));var db=require(_0xb23d('0x17'))['db'];config[_0xb23d('0x18')]=_[_0xb23d('0x19')](config[_0xb23d('0x18')],{'host':_0xb23d('0x1a'),'port':0x18eb});var socket=require(_0xb23d('0x1b'))(new Redis(config['redis']));require(_0xb23d('0x1c'))[_0xb23d('0x1d')](socket);function respondWithStatusCode(_0x2fa37a,_0x199560){_0x199560=_0x199560||0xcc;return function(_0x3cb244){if(_0x3cb244){return _0x2fa37a[_0xb23d('0x1e')](_0x199560);}return _0x2fa37a['status'](_0x199560)['end']();};}function respondWithResult(_0x2fba80,_0x45f0d1){_0x45f0d1=_0x45f0d1||0xc8;return function(_0x1b35d7){if(_0x1b35d7){return _0x2fba80[_0xb23d('0x1f')](_0x45f0d1)[_0xb23d('0x20')](_0x1b35d7);}};}function respondWithFilteredResult(_0x21f5a,_0x5a09c3){return function(_0x37bfe2){if(_0x37bfe2){var _0x3f2c6b=typeof _0x5a09c3[_0xb23d('0x21')]===_0xb23d('0x22')&&typeof _0x5a09c3['limit']===_0xb23d('0x22');var _0x5baf53=_0x37bfe2[_0xb23d('0x23')];var _0x2cb813=_0x3f2c6b?0x0:_0x5a09c3[_0xb23d('0x21')];var _0x1287e8=_0x3f2c6b?_0x37bfe2[_0xb23d('0x23')]:_0x5a09c3[_0xb23d('0x21')]+_0x5a09c3[_0xb23d('0x24')];var _0x4b7fea;if(_0x1287e8>=_0x5baf53){_0x1287e8=_0x5baf53;_0x4b7fea=0xc8;}else{_0x4b7fea=0xce;}_0x21f5a[_0xb23d('0x1f')](_0x4b7fea);return _0x21f5a['set']('Content-Range',_0x2cb813+'-'+_0x1287e8+'/'+_0x5baf53)[_0xb23d('0x20')](_0x37bfe2);}return null;};}function patchUpdates(_0x29cacf){return function(_0x8382ab){try{jsonpatch[_0xb23d('0x25')](_0x8382ab,_0x29cacf,!![]);}catch(_0x9348e1){return BPromise[_0xb23d('0x26')](_0x9348e1);}return _0x8382ab[_0xb23d('0x27')]();};}function saveUpdates(_0x219d34,_0x3f0142){return function(_0x20d4b8){if(_0x20d4b8){return _0x20d4b8[_0xb23d('0x28')](_0x219d34)['then'](function(_0x1f0731){return _0x1f0731;});}return null;};}function removeEntity(_0x145ae9,_0x243416){return function(_0x4e1538){if(_0x4e1538){return _0x4e1538['destroy']()[_0xb23d('0x29')](function(){var _0x2e758e=_0x4e1538[_0xb23d('0x2a')]({'plain':!![]});var _0x33e7bc='SmsQueues';return db[_0xb23d('0x2b')][_0xb23d('0x2c')]({'where':{'type':_0x33e7bc,'resourceId':_0x2e758e['id']}})[_0xb23d('0x29')](function(){return _0x4e1538;});})[_0xb23d('0x29')](function(){_0x145ae9[_0xb23d('0x1f')](0xcc)[_0xb23d('0x2d')]();});}};}function handleEntityNotFound(_0x26990e,_0x867d69){return function(_0x2f039f){if(!_0x2f039f){_0x26990e[_0xb23d('0x1e')](0x194);}return _0x2f039f;};}function handleError(_0x2931a2,_0x269e9a){_0x269e9a=_0x269e9a||0x1f4;return function(_0x917292){logger['error'](_0x917292['stack']);if(_0x917292['name']){delete _0x917292[_0xb23d('0x2e')];}_0x2931a2['status'](_0x269e9a)['send'](_0x917292);};}exports[_0xb23d('0x2f')]=function(_0x49d4cf,_0x2e1775){var _0x42e0eb={},_0x44f3d1={},_0x1926ab={'count':0x0,'rows':[]};var _0x2026e0=_[_0xb23d('0x30')](db[_0xb23d('0x31')][_0xb23d('0x32')],function(_0x372471){return{'name':_0x372471[_0xb23d('0x33')],'type':_0x372471[_0xb23d('0x34')][_0xb23d('0x35')]};});_0x44f3d1[_0xb23d('0x36')]=_[_0xb23d('0x30')](_0x2026e0,_0xb23d('0x2e'));_0x44f3d1[_0xb23d('0x37')]=_['keys'](_0x49d4cf[_0xb23d('0x37')]);_0x44f3d1[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x44f3d1[_0xb23d('0x36')],_0x44f3d1[_0xb23d('0x37')]);_0x42e0eb[_0xb23d('0x3a')]=_[_0xb23d('0x39')](_0x44f3d1[_0xb23d('0x36')],qs['fields'](_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x3b')]));_0x42e0eb[_0xb23d('0x3a')]=_0x42e0eb[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x42e0eb[_0xb23d('0x3a')]:_0x44f3d1[_0xb23d('0x36')];if(!_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x3d')](_0xb23d('0x3e'))){_0x42e0eb[_0xb23d('0x24')]=qs[_0xb23d('0x24')](_0x49d4cf['query'][_0xb23d('0x24')]);_0x42e0eb[_0xb23d('0x21')]=qs[_0xb23d('0x21')](_0x49d4cf['query'][_0xb23d('0x21')]);}_0x42e0eb[_0xb23d('0x3f')]=qs[_0xb23d('0x40')](_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x40')]);_0x42e0eb[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x49d4cf[_0xb23d('0x37')],_0x44f3d1['filters']),_0x2026e0);if(_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x43')]){_0x42e0eb[_0xb23d('0x41')]=_[_0xb23d('0x44')](_0x42e0eb['where'],{'$or':_[_0xb23d('0x30')](_0x2026e0,function(_0x55fddd){if(_0x55fddd['type']!==_0xb23d('0x45')){var _0x4900c0={};_0x4900c0[_0x55fddd[_0xb23d('0x2e')]]={'$like':'%'+_0x49d4cf[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x4900c0;}})});}_0x42e0eb=_[_0xb23d('0x44')]({},_0x42e0eb,_0x49d4cf['options']);var _0x12d7e8={'where':_0x42e0eb['where']};return db[_0xb23d('0x31')]['count'](_0x12d7e8)[_0xb23d('0x29')](function(_0x53030d){_0x1926ab['count']=_0x53030d;if(_0x49d4cf['query']['includeAll']){_0x42e0eb[_0xb23d('0x46')]=[{'all':!![]}];}return db[_0xb23d('0x31')]['findAll'](_0x42e0eb);})[_0xb23d('0x29')](function(_0x3c3366){_0x1926ab[_0xb23d('0x47')]=_0x3c3366;return _0x1926ab;})[_0xb23d('0x29')](respondWithFilteredResult(_0x2e1775,_0x42e0eb))['catch'](handleError(_0x2e1775,null));};exports['show']=function(_0x3a94eb,_0x32a5cc){var _0x1e1836={'raw':!![],'where':{'id':_0x3a94eb['params']['id']}},_0x298ccc={};_0x298ccc[_0xb23d('0x36')]=_[_0xb23d('0x48')](db[_0xb23d('0x31')][_0xb23d('0x32')]);_0x298ccc['query']=_[_0xb23d('0x48')](_0x3a94eb['query']);_0x298ccc[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x298ccc[_0xb23d('0x36')],_0x298ccc['query']);_0x1e1836[_0xb23d('0x3a')]=_['intersection'](_0x298ccc[_0xb23d('0x36')],qs['fields'](_0x3a94eb[_0xb23d('0x37')][_0xb23d('0x3b')]));_0x1e1836[_0xb23d('0x3a')]=_0x1e1836[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x1e1836[_0xb23d('0x3a')]:_0x298ccc[_0xb23d('0x36')];if(_0x3a94eb[_0xb23d('0x37')][_0xb23d('0x49')]){_0x1e1836['include']=[{'all':!![]}];}_0x1e1836=_[_0xb23d('0x44')]({},_0x1e1836,_0x3a94eb[_0xb23d('0x4a')]);return db['SmsQueue'][_0xb23d('0x4b')](_0x1e1836)['then'](handleEntityNotFound(_0x32a5cc,null))[_0xb23d('0x29')](respondWithResult(_0x32a5cc,null))[_0xb23d('0x4c')](handleError(_0x32a5cc,null));};exports[_0xb23d('0x4d')]=function(_0x4f0956,_0xc78b28){return db[_0xb23d('0x31')]['create'](_0x4f0956[_0xb23d('0x4e')],{})[_0xb23d('0x29')](function(_0x268d90){var _0xbfcf00=_0x4f0956[_0xb23d('0x4f')][_0xb23d('0x2a')]({'plain':!![]});if(!_0xbfcf00)throw new Error(_0xb23d('0x50'));if(_0xbfcf00[_0xb23d('0x51')]==='user'){var _0x5607ec=_0x268d90[_0xb23d('0x2a')]({'plain':!![]});var _0x4ba49c=_0xb23d('0x52');return db[_0xb23d('0x53')][_0xb23d('0x4b')]({'where':{'name':_0x4ba49c,'userProfileId':_0xbfcf00['userProfileId']},'raw':!![]})[_0xb23d('0x29')](function(_0x25f467){if(_0x25f467&&_0x25f467[_0xb23d('0x54')]===0x0){return db['UserProfileResource'][_0xb23d('0x4d')]({'name':_0x5607ec['name'],'resourceId':_0x5607ec['id'],'type':_0x25f467[_0xb23d('0x2e')],'sectionId':_0x25f467['id']},{})[_0xb23d('0x29')](function(){return _0x268d90;});}else{return _0x268d90;}})[_0xb23d('0x4c')](function(_0x2fc4d5){logger[_0xb23d('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc4d5);throw _0x2fc4d5;});}return _0x268d90;})[_0xb23d('0x29')](respondWithResult(_0xc78b28,0xc9))['catch'](handleError(_0xc78b28,null));};exports[_0xb23d('0x28')]=function(_0x357925,_0xfdbf55){if(_0x357925[_0xb23d('0x4e')]['id']){delete _0x357925[_0xb23d('0x4e')]['id'];}return db[_0xb23d('0x31')]['find']({'where':{'id':_0x357925['params']['id']}})['then'](handleEntityNotFound(_0xfdbf55,null))[_0xb23d('0x29')](saveUpdates(_0x357925[_0xb23d('0x4e')],null))[_0xb23d('0x29')](respondWithResult(_0xfdbf55,null))['catch'](handleError(_0xfdbf55,null));};exports[_0xb23d('0x2c')]=function(_0x20f106,_0x10e633){return db['SmsQueue'][_0xb23d('0x4b')]({'where':{'id':_0x20f106[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x10e633,null))[_0xb23d('0x29')](removeEntity(_0x10e633,null))[_0xb23d('0x4c')](handleError(_0x10e633,null));};exports['describe']=function(_0x6ca095,_0x34dbdf){return db['SmsQueue'][_0xb23d('0x57')]()[_0xb23d('0x29')](respondWithResult(_0x34dbdf,null))['catch'](handleError(_0x34dbdf,null));};exports[_0xb23d('0x58')]=function(_0x25507b,_0x2f0467,_0x337986){var _0x40b9b9={'raw':!![],'where':{}},_0x25fc65={},_0x24fb1c;return db['SmsQueue'][_0xb23d('0x59')]({'where':{'id':_0x25507b['params']['id']}})['then'](handleEntityNotFound(_0x2f0467,null))[_0xb23d('0x29')](function(_0x2fcecb){if(_0x2fcecb){_0x24fb1c=_0x2fcecb[_0xb23d('0x2a')]({'plain':!![]});_0x25fc65[_0xb23d('0x36')]=_[_0xb23d('0x48')](db[_0xb23d('0x5a')]['rawAttributes']);_0x25fc65[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x25507b[_0xb23d('0x37')]);_0x25fc65[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x25fc65['model'],_0x25fc65[_0xb23d('0x37')]);_0x40b9b9['attributes']=_[_0xb23d('0x39')](_0x25fc65[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x25507b['query'][_0xb23d('0x3b')]));_0x40b9b9[_0xb23d('0x3a')]=_0x40b9b9['attributes'][_0xb23d('0x3c')]?_0x40b9b9[_0xb23d('0x3a')]:_0x25fc65[_0xb23d('0x36')];if(!_0x25507b['query'][_0xb23d('0x3d')]('nolimit')){_0x40b9b9[_0xb23d('0x24')]=qs[_0xb23d('0x24')](_0x25507b[_0xb23d('0x37')][_0xb23d('0x24')]);_0x40b9b9['offset']=qs[_0xb23d('0x21')](_0x25507b[_0xb23d('0x37')][_0xb23d('0x21')]);}_0x40b9b9[_0xb23d('0x3f')]=qs[_0xb23d('0x40')](_0x25507b[_0xb23d('0x37')]['sort']);_0x40b9b9[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x25507b['query'],_0x25fc65[_0xb23d('0x38')]));_0x40b9b9[_0xb23d('0x41')][_0xb23d('0x5b')]=_0x2fcecb['id'];if(_0x25507b[_0xb23d('0x37')][_0xb23d('0x43')]){_0x40b9b9[_0xb23d('0x41')]=_[_0xb23d('0x44')](_0x40b9b9[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x40b9b9[_0xb23d('0x3a')],function(_0x3a4a27){var _0x4cf7b4={};_0x4cf7b4[_0x3a4a27]={'$like':'%'+_0x25507b['query'][_0xb23d('0x43')]+'%'};return _0x4cf7b4;})});}_0x40b9b9=_['merge']({},_0x40b9b9,_0x25507b[_0xb23d('0x4a')]);return db['UserSmsQueue'][_0xb23d('0x5c')](_0x40b9b9);}})['then'](function(_0x455c2e){if(_0x455c2e){return db[_0xb23d('0x5d')][_0xb23d('0x5e')]({'where':{'id':_[_0xb23d('0x30')](_0x455c2e,_0xb23d('0x5f')),'role':'agent'},'attributes':['id','name',_0xb23d('0x60'),'updatedAt',_0xb23d('0x61')]});}})['then'](function(_0xb4933e){if(_0xb4933e){return{'count':_0xb4933e[_0xb23d('0x23')],'rows':_['map'](_0xb4933e[_0xb23d('0x47')],function(_0x5e82ca){return{'membername':_0x5e82ca[_0xb23d('0x2e')],'UserId':_0x5e82ca['id'],'queue_name':_0x24fb1c[_0xb23d('0x2e')],'SmsQueueId':_0x24fb1c['id'],'interface':util['format'](_0xb23d('0x62'),'SIP',_0x5e82ca[_0xb23d('0x2e')]),'penalty':0x0,'paused':_0x5e82ca[_0xb23d('0x60')],'createdAt':_0x5e82ca[_0xb23d('0x61')],'updatedAt':_0x5e82ca['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f0467,_0x40b9b9))[_0xb23d('0x4c')](handleError(_0x2f0467,null));};exports[_0xb23d('0x63')]=function(_0x12dabc,_0x49b60b,_0x5d09eb){var _0x274760={};var _0x4340a5={};var _0x481015;var _0x2d866e;return db[_0xb23d('0x31')][_0xb23d('0x59')]({'where':{'id':_0x12dabc[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x49b60b,null))[_0xb23d('0x29')](function(_0x3481b0){if(_0x3481b0){_0x481015=_0x3481b0;_0x4340a5[_0xb23d('0x36')]=_[_0xb23d('0x48')](db['Team'][_0xb23d('0x32')]);_0x4340a5[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x12dabc[_0xb23d('0x37')]);_0x4340a5[_0xb23d('0x38')]=_[_0xb23d('0x39')](_0x4340a5['model'],_0x4340a5[_0xb23d('0x37')]);_0x274760[_0xb23d('0x3a')]=_[_0xb23d('0x39')](_0x4340a5[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x12dabc[_0xb23d('0x37')]['fields']));_0x274760[_0xb23d('0x3a')]=_0x274760[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x274760['attributes']:_0x4340a5[_0xb23d('0x36')];_0x274760['order']=qs[_0xb23d('0x40')](_0x12dabc[_0xb23d('0x37')]['sort']);_0x274760[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x12dabc[_0xb23d('0x37')],_0x4340a5['filters']));if(_0x12dabc[_0xb23d('0x37')][_0xb23d('0x43')]){_0x274760['where']=_[_0xb23d('0x44')](_0x274760[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x274760[_0xb23d('0x3a')],function(_0x5610d8){var _0x122288={};_0x122288[_0x5610d8]={'$like':'%'+_0x12dabc[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x122288;})});}_0x274760=_[_0xb23d('0x44')]({},_0x274760,_0x12dabc[_0xb23d('0x4a')]);return _0x481015[_0xb23d('0x63')](_0x274760);}})[_0xb23d('0x29')](function(_0x546a24){if(_0x546a24){_0x2d866e=_0x546a24['length'];if(!_0x12dabc[_0xb23d('0x37')][_0xb23d('0x3d')](_0xb23d('0x3e'))){_0x274760['limit']=qs[_0xb23d('0x24')](_0x12dabc[_0xb23d('0x37')]['limit']);_0x274760['offset']=qs[_0xb23d('0x21')](_0x12dabc[_0xb23d('0x37')][_0xb23d('0x21')]);}return _0x481015['getTeams'](_0x274760);}})[_0xb23d('0x29')](function(_0x16fb68){if(_0x16fb68){return _0x16fb68?{'count':_0x2d866e,'rows':_0x16fb68}:null;}})[_0xb23d('0x29')](respondWithResult(_0x49b60b,null))[_0xb23d('0x4c')](handleError(_0x49b60b,null));};exports['addTeams']=function(_0x459deb,_0x1039a1,_0x484c26){var _0x37e440=_0x459deb['body']['ids'];return db['Team'][_0xb23d('0x5c')]({'where':{'id':_0x37e440},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb23d('0x64'),'attributes':['id','name',_0xb23d('0x65'),_0xb23d('0x66'),_0xb23d('0x67')],'raw':!![]}]})[_0xb23d('0x29')](function(_0x13b8fe){if(_0x13b8fe){var _0x582ef5=_[_0xb23d('0x68')](_0x13b8fe,function(_0x2984be){var _0x59e14d=_0x2984be[_0xb23d('0x2a')]({'plain':!![]});return _0x59e14d[_0xb23d('0x64')];});return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0x459deb[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](function(_0xb240ed){return db[_0xb23d('0x69')][_0xb23d('0x6a')](function(_0x3b1ddb){return _0xb240ed[_0xb23d('0x6b')](_0x37e440,{'transaction':_0x3b1ddb})['then'](function(){return BPromise[_0xb23d('0x6c')](_0x582ef5,function(_0x8045b8){return db[_0xb23d('0x5a')]['findOrCreate']({'where':{'UserId':_0x8045b8['id'],'SmsQueueId':_0x459deb[_0xb23d('0x56')]['id']},'transaction':_0x3b1ddb});});})[_0xb23d('0x29')](function(){_0x582ef5[_0xb23d('0x6d')](function(_0x43ee31){socket[_0xb23d('0x6e')](_0xb23d('0x6f'),{'UserId':_0x43ee31['id'],'SmsQueueId':_0xb240ed['id']});});});});});}})[_0xb23d('0x29')](respondWithStatusCode(_0x1039a1,null))[_0xb23d('0x4c')](handleError(_0x1039a1,null));};exports[_0xb23d('0x70')]=function(_0x20a9bc,_0x547965,_0x1c1b14){return db[_0xb23d('0x71')]['findAll']({'where':{'id':_0x20a9bc[_0xb23d('0x37')][_0xb23d('0x72')]},'attributes':['id'],'include':[{'model':db[_0xb23d('0x5d')],'as':_0xb23d('0x64'),'attributes':['id'],'raw':!![]}]})[_0xb23d('0x29')](handleEntityNotFound(_0x547965,null))[_0xb23d('0x29')](function(_0x5be5d2){var _0x1ad4d2=_[_0xb23d('0x30')](_0x5be5d2,'id');var _0x158f13=[];var _0xff9f92=[];var _0x56e7cf=squel[_0xb23d('0x73')]();_0x56e7cf[_0xb23d('0x74')]('tq.TeamId')[_0xb23d('0x75')](_0xb23d('0x76'),'tq')[_0xb23d('0x77')](_0xb23d('0x78'),'ut',_0xb23d('0x79'))[_0xb23d('0x41')](_0xb23d('0x7a'),_0x20a9bc[_0xb23d('0x56')]['id']);for(var _0x3de7c1=0x0;_0x3de7c1<_0x5be5d2[_0xb23d('0x3c')];_0x3de7c1+=0x1){let _0x352816=_0x5be5d2[_0x3de7c1];for(var _0x174f4b=0x0;_0x174f4b<_0x352816[_0xb23d('0x64')][_0xb23d('0x3c')];_0x174f4b+=0x1){let _0x328086=_0x352816[_0xb23d('0x64')][_0x174f4b];var _0x4d49a3=_0x56e7cf[_0xb23d('0x7b')]();_0x4d49a3[_0xb23d('0x41')]('ut.UserId\x20=\x20?',_0x328086['id']);_0xff9f92[_0xb23d('0x7c')](db[_0xb23d('0x69')]['query'](_0x4d49a3['toString'](),{'type':db['sequelize'][_0xb23d('0x7d')][_0xb23d('0x7e')]})[_0xb23d('0x29')](function(_0x5c8bf7){if(_0x5c8bf7[_0xb23d('0x3c')]===0x1){return _0x328086['id'];}else{var _0x2cbc73=_['every'](_[_0xb23d('0x30')](_0x5c8bf7,'TeamId'),function(_0x33cbfc){return _[_0xb23d('0x7f')](_0x1ad4d2,_0x33cbfc);});if(_0x2cbc73){return _0x328086['id'];}}}));}}return BPromise[_0xb23d('0x80')](_0xff9f92)[_0xb23d('0x29')](function(_0x24592b){_0x158f13=_(_0x158f13)[_0xb23d('0x81')](_0x24592b)[_0xb23d('0x82')]()['value']();return db[_0xb23d('0x31')]['find']({'where':{'id':_0x20a9bc[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](function(_0x581673){return db[_0xb23d('0x69')][_0xb23d('0x6a')](function(_0x26fcba){return _0x581673[_0xb23d('0x70')](_0x20a9bc[_0xb23d('0x37')][_0xb23d('0x72')],{'transaction':_0x26fcba})['then'](function(){if(!_[_0xb23d('0x83')](_0x158f13)){return _0x581673['removeAgents'](_0x158f13,{'transaction':_0x26fcba});}})[_0xb23d('0x29')](function(){_0x158f13[_0xb23d('0x6d')](function(_0x520070){socket[_0xb23d('0x6e')](_0xb23d('0x84'),{'UserId':_0x520070,'SmsQueueId':_0x581673['id']});});});});});});})[_0xb23d('0x29')](respondWithStatusCode(_0x547965,null))[_0xb23d('0x4c')](handleError(_0x547965,null));};exports[_0xb23d('0x85')]=function(_0x10f984,_0x3325f1,_0x5687d9){return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0x10f984['params']['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x3325f1,null))[_0xb23d('0x29')](function(_0x447304){if(_0x447304){return _0x447304[_0xb23d('0x85')](_0x10f984[_0xb23d('0x4e')][_0xb23d('0x72')],_[_0xb23d('0x86')](_0x10f984[_0xb23d('0x4e')],['ids','id'])||{})[_0xb23d('0x87')](function(_0x4ad010){for(var _0x933de7=0x0;_0x933de7<_0x10f984['body']['ids']['length'];_0x933de7+=0x1){socket[_0xb23d('0x6e')](_0xb23d('0x6f'),{'UserId':Number(_0x10f984[_0xb23d('0x4e')]['ids'][_0x933de7]),'SmsQueueId':Number(_0x10f984[_0xb23d('0x56')]['id'])});}return _0x4ad010;});}})[_0xb23d('0x29')](respondWithResult(_0x3325f1,null))[_0xb23d('0x4c')](handleError(_0x3325f1,null));};exports[_0xb23d('0x88')]=function(_0xc7cbff,_0x58f355,_0xb2d80f){return db[_0xb23d('0x31')][_0xb23d('0x4b')]({'where':{'id':_0xc7cbff[_0xb23d('0x56')]['id']}})[_0xb23d('0x29')](handleEntityNotFound(_0x58f355,null))['then'](function(_0x564f04){if(_0x564f04){return _0x564f04[_0xb23d('0x88')](_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')])[_0xb23d('0x29')](function(){if(_[_0xb23d('0x89')](_0xc7cbff[_0xb23d('0x37')]['ids'])){for(var _0x3db0b9=0x0;_0x3db0b9<_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')][_0xb23d('0x3c')];_0x3db0b9+=0x1){socket[_0xb23d('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0xc7cbff['query'][_0xb23d('0x72')][_0x3db0b9]),'SmsQueueId':Number(_0xc7cbff[_0xb23d('0x56')]['id'])});}}else{socket['emit'](_0xb23d('0x84'),{'UserId':Number(_0xc7cbff[_0xb23d('0x37')][_0xb23d('0x72')]),'SmsQueueId':Number(_0xc7cbff[_0xb23d('0x56')]['id'])});}});}})[_0xb23d('0x29')](respondWithStatusCode(_0x58f355,null))[_0xb23d('0x4c')](handleError(_0x58f355,null));};exports[_0xb23d('0x8a')]=function(_0x135d92,_0x4fea85,_0x2e5710){var _0x192c47={};var _0x1ab70d={};var _0x2e3649;var _0x5d02b4;return db[_0xb23d('0x31')]['findOne']({'where':{'id':_0x135d92[_0xb23d('0x56')]['id']}})['then'](handleEntityNotFound(_0x4fea85,null))[_0xb23d('0x29')](function(_0x10bc79){if(_0x10bc79){_0x2e3649=_0x10bc79;_0x1ab70d['model']=_[_0xb23d('0x48')](db[_0xb23d('0x5d')][_0xb23d('0x32')]);_0x1ab70d[_0xb23d('0x37')]=_[_0xb23d('0x48')](_0x135d92[_0xb23d('0x37')]);_0x1ab70d[_0xb23d('0x38')]=_['intersection'](_0x1ab70d[_0xb23d('0x36')],_0x1ab70d['query']);_0x192c47['attributes']=_[_0xb23d('0x39')](_0x1ab70d[_0xb23d('0x36')],qs[_0xb23d('0x3b')](_0x135d92['query'][_0xb23d('0x3b')]));_0x192c47[_0xb23d('0x3a')]=_0x192c47[_0xb23d('0x3a')][_0xb23d('0x3c')]?_0x192c47[_0xb23d('0x3a')]:_0x1ab70d[_0xb23d('0x36')];_0x192c47[_0xb23d('0x3f')]=qs['sort'](_0x135d92['query'][_0xb23d('0x40')]);_0x192c47[_0xb23d('0x41')]=qs[_0xb23d('0x38')](_[_0xb23d('0x42')](_0x135d92[_0xb23d('0x37')],_0x1ab70d[_0xb23d('0x38')]));if(_0x135d92['query'][_0xb23d('0x43')]){_0x192c47['where']=_['merge'](_0x192c47[_0xb23d('0x41')],{'$or':_[_0xb23d('0x30')](_0x192c47[_0xb23d('0x3a')],function(_0x2653db){var _0x234ea1={};_0x234ea1[_0x2653db]={'$like':'%'+_0x135d92[_0xb23d('0x37')][_0xb23d('0x43')]+'%'};return _0x234ea1;})});}_0x192c47=_[_0xb23d('0x44')]({},_0x192c47,_0x135d92[_0xb23d('0x4a')]);return _0x2e3649['getAgents'](_0x192c47);}})[_0xb23d('0x29')](function(_0x1ad626){if(_0x1ad626){_0x5d02b4=_0x1ad626['length'];if(!_0x135d92[_0xb23d('0x37')]['hasOwnProperty'](_0xb23d('0x3e'))){_0x192c47['limit']=qs[_0xb23d('0x24')](_0x135d92['query']['limit']);_0x192c47[_0xb23d('0x21')]=qs[_0xb23d('0x21')](_0x135d92[_0xb23d('0x37')][_0xb23d('0x21')]);}return _0x2e3649[_0xb23d('0x8a')](_0x192c47);}})[_0xb23d('0x29')](function(_0x516f4f){if(_0x516f4f){return _0x516f4f?{'count':_0x5d02b4,'rows':_0x516f4f}:null;}})[_0xb23d('0x29')](respondWithResult(_0x4fea85,null))[_0xb23d('0x4c')](handleError(_0x4fea85,null));}; \ No newline at end of file +var _0x25b2=['field','tq.TeamId','from','team_has_sms_queues','user_has_teams','SmsQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','sox','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','SmsQueues','error','stack','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','pick','UserSmsQueue','User','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select'];(function(_0x2bc0db,_0x138000){var _0x3ecd3d=function(_0x5255e7){while(--_0x5255e7){_0x2bc0db['push'](_0x2bc0db['shift']());}};_0x3ecd3d(++_0x138000);}(_0x25b2,0x1bc));var _0x225b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x25b2[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0x225b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x225b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x225b('0x2'));var moment=require(_0x225b('0x3'));var BPromise=require(_0x225b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x225b('0x5'));var csv=require(_0x225b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x225b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x225b('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x225b('0x9'));var Papa=require(_0x225b('0xa'));var Redis=require(_0x225b('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x225b('0xc'));var as=require(_0x225b('0xd'));var hardwareService=require(_0x225b('0xe'));var logger=require('../../config/logger')(_0x225b('0xf'));var utils=require(_0x225b('0x10'));var config=require(_0x225b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x225b('0x12'))['db'];config[_0x225b('0x13')]=_[_0x225b('0x14')](config[_0x225b('0x13')],{'host':_0x225b('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x225b('0x13')]));require(_0x225b('0x16'))[_0x225b('0x17')](socket);function respondWithStatusCode(_0x1d19b3,_0x38f60a){_0x38f60a=_0x38f60a||0xcc;return function(_0x42b1fc){if(_0x42b1fc){return _0x1d19b3[_0x225b('0x18')](_0x38f60a);}return _0x1d19b3['status'](_0x38f60a)[_0x225b('0x19')]();};}function respondWithResult(_0xe5f52,_0x429ac2){_0x429ac2=_0x429ac2||0xc8;return function(_0x249156){if(_0x249156){return _0xe5f52[_0x225b('0x1a')](_0x429ac2)[_0x225b('0x1b')](_0x249156);}};}function respondWithFilteredResult(_0x5f407b,_0x46e7f5){return function(_0x1837d6){if(_0x1837d6){var _0x30afd5=typeof _0x46e7f5[_0x225b('0x1c')]===_0x225b('0x1d')&&typeof _0x46e7f5[_0x225b('0x1e')]===_0x225b('0x1d');var _0x5437c6=_0x1837d6[_0x225b('0x1f')];var _0x2fd875=_0x30afd5?0x0:_0x46e7f5[_0x225b('0x1c')];var _0x599f4e=_0x30afd5?_0x1837d6['count']:_0x46e7f5[_0x225b('0x1c')]+_0x46e7f5[_0x225b('0x1e')];var _0x42ef61;if(_0x599f4e>=_0x5437c6){_0x599f4e=_0x5437c6;_0x42ef61=0xc8;}else{_0x42ef61=0xce;}_0x5f407b['status'](_0x42ef61);return _0x5f407b[_0x225b('0x20')](_0x225b('0x21'),_0x2fd875+'-'+_0x599f4e+'/'+_0x5437c6)[_0x225b('0x1b')](_0x1837d6);}return null;};}function patchUpdates(_0x5af6f6){return function(_0x23b8cc){try{jsonpatch['apply'](_0x23b8cc,_0x5af6f6,!![]);}catch(_0x3466a0){return BPromise[_0x225b('0x22')](_0x3466a0);}return _0x23b8cc[_0x225b('0x23')]();};}function saveUpdates(_0x1a8c4f,_0x39a65f){return function(_0x4c8bef){if(_0x4c8bef){return _0x4c8bef[_0x225b('0x24')](_0x1a8c4f)[_0x225b('0x25')](function(_0x3eaad7){return _0x3eaad7;});}return null;};}function removeEntity(_0x574f0a,_0x20f912){return function(_0x50f3c9){if(_0x50f3c9){return _0x50f3c9[_0x225b('0x26')]()[_0x225b('0x25')](function(){var _0x16900d=_0x50f3c9[_0x225b('0x27')]({'plain':!![]});var _0x43f2ee=_0x225b('0x28');return db['UserProfileResource'][_0x225b('0x26')]({'where':{'type':_0x43f2ee,'resourceId':_0x16900d['id']}})[_0x225b('0x25')](function(){return _0x50f3c9;});})['then'](function(){_0x574f0a[_0x225b('0x1a')](0xcc)[_0x225b('0x19')]();});}};}function handleEntityNotFound(_0x539490,_0x5c2d12){return function(_0x550a90){if(!_0x550a90){_0x539490['sendStatus'](0x194);}return _0x550a90;};}function handleError(_0xc4f3c2,_0x373df2){_0x373df2=_0x373df2||0x1f4;return function(_0x178eef){logger[_0x225b('0x29')](_0x178eef[_0x225b('0x2a')]);if(_0x178eef['name']){delete _0x178eef['name'];}_0xc4f3c2[_0x225b('0x1a')](_0x373df2)[_0x225b('0x2b')](_0x178eef);};}exports[_0x225b('0x2c')]=function(_0x5a4d23,_0x79380d){var _0x2fb16a={},_0x4f5018={},_0x1be0ca={'count':0x0,'rows':[]};var _0x1e94ac=_[_0x225b('0x2d')](db[_0x225b('0x2e')][_0x225b('0x2f')],function(_0x258785){return{'name':_0x258785[_0x225b('0x30')],'type':_0x258785[_0x225b('0x31')][_0x225b('0x32')]};});_0x4f5018['model']=_[_0x225b('0x2d')](_0x1e94ac,_0x225b('0x33'));_0x4f5018[_0x225b('0x34')]=_[_0x225b('0x35')](_0x5a4d23['query']);_0x4f5018['filters']=_[_0x225b('0x36')](_0x4f5018[_0x225b('0x37')],_0x4f5018['query']);_0x2fb16a[_0x225b('0x38')]=_[_0x225b('0x36')](_0x4f5018[_0x225b('0x37')],qs[_0x225b('0x39')](_0x5a4d23['query']['fields']));_0x2fb16a[_0x225b('0x38')]=_0x2fb16a[_0x225b('0x38')][_0x225b('0x3a')]?_0x2fb16a[_0x225b('0x38')]:_0x4f5018['model'];if(!_0x5a4d23[_0x225b('0x34')][_0x225b('0x3b')](_0x225b('0x3c'))){_0x2fb16a[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0x5a4d23[_0x225b('0x34')]['limit']);_0x2fb16a['offset']=qs['offset'](_0x5a4d23['query'][_0x225b('0x1c')]);}_0x2fb16a[_0x225b('0x3d')]=qs[_0x225b('0x3e')](_0x5a4d23[_0x225b('0x34')][_0x225b('0x3e')]);_0x2fb16a[_0x225b('0x3f')]=qs[_0x225b('0x40')](_['pick'](_0x5a4d23[_0x225b('0x34')],_0x4f5018[_0x225b('0x40')]),_0x1e94ac);if(_0x5a4d23[_0x225b('0x34')]['filter']){_0x2fb16a['where']=_[_0x225b('0x41')](_0x2fb16a[_0x225b('0x3f')],{'$or':_['map'](_0x1e94ac,function(_0xe0eaca){if(_0xe0eaca['type']!==_0x225b('0x42')){var _0x418405={};_0x418405[_0xe0eaca[_0x225b('0x33')]]={'$like':'%'+_0x5a4d23[_0x225b('0x34')][_0x225b('0x43')]+'%'};return _0x418405;}})});}_0x2fb16a=_[_0x225b('0x41')]({},_0x2fb16a,_0x5a4d23[_0x225b('0x44')]);var _0x2512ed={'where':_0x2fb16a[_0x225b('0x3f')]};return db[_0x225b('0x2e')][_0x225b('0x1f')](_0x2512ed)[_0x225b('0x25')](function(_0x3200d1){_0x1be0ca[_0x225b('0x1f')]=_0x3200d1;if(_0x5a4d23['query'][_0x225b('0x45')]){_0x2fb16a['include']=[{'all':!![]}];}return db[_0x225b('0x2e')][_0x225b('0x46')](_0x2fb16a);})[_0x225b('0x25')](function(_0x12bf72){_0x1be0ca[_0x225b('0x47')]=_0x12bf72;return _0x1be0ca;})[_0x225b('0x25')](respondWithFilteredResult(_0x79380d,_0x2fb16a))[_0x225b('0x48')](handleError(_0x79380d,null));};exports['show']=function(_0x33d098,_0x439ef4){var _0x53db08={'raw':!![],'where':{'id':_0x33d098[_0x225b('0x49')]['id']}},_0x548346={};_0x548346[_0x225b('0x37')]=_[_0x225b('0x35')](db[_0x225b('0x2e')][_0x225b('0x2f')]);_0x548346['query']=_[_0x225b('0x35')](_0x33d098[_0x225b('0x34')]);_0x548346[_0x225b('0x40')]=_[_0x225b('0x36')](_0x548346[_0x225b('0x37')],_0x548346[_0x225b('0x34')]);_0x53db08[_0x225b('0x38')]=_[_0x225b('0x36')](_0x548346[_0x225b('0x37')],qs[_0x225b('0x39')](_0x33d098[_0x225b('0x34')][_0x225b('0x39')]));_0x53db08[_0x225b('0x38')]=_0x53db08[_0x225b('0x38')][_0x225b('0x3a')]?_0x53db08['attributes']:_0x548346[_0x225b('0x37')];if(_0x33d098[_0x225b('0x34')][_0x225b('0x45')]){_0x53db08[_0x225b('0x4a')]=[{'all':!![]}];}_0x53db08=_[_0x225b('0x41')]({},_0x53db08,_0x33d098[_0x225b('0x44')]);return db['SmsQueue']['find'](_0x53db08)[_0x225b('0x25')](handleEntityNotFound(_0x439ef4,null))[_0x225b('0x25')](respondWithResult(_0x439ef4,null))['catch'](handleError(_0x439ef4,null));};exports['create']=function(_0x1333e6,_0x1c8d1f){return db[_0x225b('0x2e')][_0x225b('0x4b')](_0x1333e6['body'],{})[_0x225b('0x25')](function(_0x196b69){var _0x384973=_0x1333e6['user'][_0x225b('0x27')]({'plain':!![]});if(!_0x384973)throw new Error(_0x225b('0x4c'));if(_0x384973['role']===_0x225b('0x4d')){var _0x296b70=_0x196b69[_0x225b('0x27')]({'plain':!![]});var _0x1a9364=_0x225b('0x28');return db[_0x225b('0x4e')][_0x225b('0x4f')]({'where':{'name':_0x1a9364,'userProfileId':_0x384973[_0x225b('0x50')]},'raw':!![]})[_0x225b('0x25')](function(_0x315d72){if(_0x315d72&&_0x315d72[_0x225b('0x51')]===0x0){return db[_0x225b('0x52')][_0x225b('0x4b')]({'name':_0x296b70[_0x225b('0x33')],'resourceId':_0x296b70['id'],'type':_0x315d72[_0x225b('0x33')],'sectionId':_0x315d72['id']},{})['then'](function(){return _0x196b69;});}else{return _0x196b69;}})['catch'](function(_0x2db4e8){logger[_0x225b('0x29')](_0x225b('0x53'),_0x2db4e8);throw _0x2db4e8;});}return _0x196b69;})[_0x225b('0x25')](respondWithResult(_0x1c8d1f,0xc9))[_0x225b('0x48')](handleError(_0x1c8d1f,null));};exports['update']=function(_0x5668d9,_0x37867d){if(_0x5668d9[_0x225b('0x54')]['id']){delete _0x5668d9['body']['id'];}return db[_0x225b('0x2e')][_0x225b('0x4f')]({'where':{'id':_0x5668d9[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x37867d,null))[_0x225b('0x25')](saveUpdates(_0x5668d9[_0x225b('0x54')],null))[_0x225b('0x25')](respondWithResult(_0x37867d,null))[_0x225b('0x48')](handleError(_0x37867d,null));};exports[_0x225b('0x26')]=function(_0x1d32eb,_0x4c6bf8){return db[_0x225b('0x2e')][_0x225b('0x4f')]({'where':{'id':_0x1d32eb[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x4c6bf8,null))[_0x225b('0x25')](removeEntity(_0x4c6bf8,null))[_0x225b('0x48')](handleError(_0x4c6bf8,null));};exports[_0x225b('0x55')]=function(_0x27b37d,_0x285056){return db[_0x225b('0x2e')][_0x225b('0x55')]()[_0x225b('0x25')](respondWithResult(_0x285056,null))['catch'](handleError(_0x285056,null));};exports[_0x225b('0x56')]=function(_0x3e8b69,_0x21b220,_0x1fd31c){var _0x4b1eb6={'raw':!![],'where':{}},_0x400a43={},_0x43554a;return db[_0x225b('0x2e')][_0x225b('0x57')]({'where':{'id':_0x3e8b69[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x21b220,null))[_0x225b('0x25')](function(_0x445936){if(_0x445936){_0x43554a=_0x445936[_0x225b('0x27')]({'plain':!![]});_0x400a43[_0x225b('0x37')]=_[_0x225b('0x35')](db['UserSmsQueue'][_0x225b('0x2f')]);_0x400a43['query']=_[_0x225b('0x35')](_0x3e8b69[_0x225b('0x34')]);_0x400a43[_0x225b('0x40')]=_[_0x225b('0x36')](_0x400a43['model'],_0x400a43[_0x225b('0x34')]);_0x4b1eb6[_0x225b('0x38')]=_[_0x225b('0x36')](_0x400a43['model'],qs[_0x225b('0x39')](_0x3e8b69[_0x225b('0x34')][_0x225b('0x39')]));_0x4b1eb6['attributes']=_0x4b1eb6[_0x225b('0x38')][_0x225b('0x3a')]?_0x4b1eb6[_0x225b('0x38')]:_0x400a43[_0x225b('0x37')];if(!_0x3e8b69[_0x225b('0x34')]['hasOwnProperty']('nolimit')){_0x4b1eb6[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0x3e8b69[_0x225b('0x34')][_0x225b('0x1e')]);_0x4b1eb6[_0x225b('0x1c')]=qs['offset'](_0x3e8b69[_0x225b('0x34')]['offset']);}_0x4b1eb6['order']=qs[_0x225b('0x3e')](_0x3e8b69['query'][_0x225b('0x3e')]);_0x4b1eb6[_0x225b('0x3f')]=qs[_0x225b('0x40')](_[_0x225b('0x58')](_0x3e8b69['query'],_0x400a43[_0x225b('0x40')]));_0x4b1eb6[_0x225b('0x3f')]['SmsQueueId']=_0x445936['id'];if(_0x3e8b69[_0x225b('0x34')][_0x225b('0x43')]){_0x4b1eb6[_0x225b('0x3f')]=_[_0x225b('0x41')](_0x4b1eb6[_0x225b('0x3f')],{'$or':_['map'](_0x4b1eb6['attributes'],function(_0x45f510){var _0x236844={};_0x236844[_0x45f510]={'$like':'%'+_0x3e8b69['query'][_0x225b('0x43')]+'%'};return _0x236844;})});}_0x4b1eb6=_['merge']({},_0x4b1eb6,_0x3e8b69[_0x225b('0x44')]);return db[_0x225b('0x59')][_0x225b('0x46')](_0x4b1eb6);}})[_0x225b('0x25')](function(_0x4601c6){if(_0x4601c6){return db[_0x225b('0x5a')][_0x225b('0x5b')]({'where':{'id':_[_0x225b('0x2d')](_0x4601c6,'UserId'),'role':_0x225b('0x5c')},'attributes':['id',_0x225b('0x33'),_0x225b('0x5d'),_0x225b('0x5e'),_0x225b('0x5f')]});}})[_0x225b('0x25')](function(_0x22261c){if(_0x22261c){return{'count':_0x22261c[_0x225b('0x1f')],'rows':_['map'](_0x22261c['rows'],function(_0x114c6e){return{'membername':_0x114c6e['name'],'UserId':_0x114c6e['id'],'queue_name':_0x43554a['name'],'SmsQueueId':_0x43554a['id'],'interface':util[_0x225b('0x60')](_0x225b('0x61'),_0x225b('0x62'),_0x114c6e[_0x225b('0x33')]),'penalty':0x0,'paused':_0x114c6e[_0x225b('0x5d')],'createdAt':_0x114c6e[_0x225b('0x5f')],'updatedAt':_0x114c6e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x225b('0x25')](respondWithFilteredResult(_0x21b220,_0x4b1eb6))['catch'](handleError(_0x21b220,null));};exports[_0x225b('0x63')]=function(_0xb174c2,_0x41c2ae,_0xb6602e){var _0x259939={};var _0x23e60e={};var _0x3752b8;var _0x3f74f2;return db[_0x225b('0x2e')][_0x225b('0x57')]({'where':{'id':_0xb174c2[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x41c2ae,null))[_0x225b('0x25')](function(_0x9b16c3){if(_0x9b16c3){_0x3752b8=_0x9b16c3;_0x23e60e[_0x225b('0x37')]=_[_0x225b('0x35')](db[_0x225b('0x64')][_0x225b('0x2f')]);_0x23e60e['query']=_['keys'](_0xb174c2[_0x225b('0x34')]);_0x23e60e[_0x225b('0x40')]=_[_0x225b('0x36')](_0x23e60e[_0x225b('0x37')],_0x23e60e['query']);_0x259939['attributes']=_[_0x225b('0x36')](_0x23e60e[_0x225b('0x37')],qs[_0x225b('0x39')](_0xb174c2[_0x225b('0x34')]['fields']));_0x259939[_0x225b('0x38')]=_0x259939[_0x225b('0x38')][_0x225b('0x3a')]?_0x259939['attributes']:_0x23e60e[_0x225b('0x37')];_0x259939[_0x225b('0x3d')]=qs[_0x225b('0x3e')](_0xb174c2['query'][_0x225b('0x3e')]);_0x259939[_0x225b('0x3f')]=qs[_0x225b('0x40')](_[_0x225b('0x58')](_0xb174c2['query'],_0x23e60e[_0x225b('0x40')]));if(_0xb174c2[_0x225b('0x34')][_0x225b('0x43')]){_0x259939['where']=_['merge'](_0x259939[_0x225b('0x3f')],{'$or':_[_0x225b('0x2d')](_0x259939[_0x225b('0x38')],function(_0x41cb31){var _0x15c8f0={};_0x15c8f0[_0x41cb31]={'$like':'%'+_0xb174c2[_0x225b('0x34')][_0x225b('0x43')]+'%'};return _0x15c8f0;})});}_0x259939=_[_0x225b('0x41')]({},_0x259939,_0xb174c2[_0x225b('0x44')]);return _0x3752b8[_0x225b('0x63')](_0x259939);}})[_0x225b('0x25')](function(_0x3fcf4b){if(_0x3fcf4b){_0x3f74f2=_0x3fcf4b[_0x225b('0x3a')];if(!_0xb174c2[_0x225b('0x34')][_0x225b('0x3b')](_0x225b('0x3c'))){_0x259939[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0xb174c2[_0x225b('0x34')][_0x225b('0x1e')]);_0x259939[_0x225b('0x1c')]=qs[_0x225b('0x1c')](_0xb174c2[_0x225b('0x34')][_0x225b('0x1c')]);}return _0x3752b8['getTeams'](_0x259939);}})['then'](function(_0x20578c){if(_0x20578c){return _0x20578c?{'count':_0x3f74f2,'rows':_0x20578c}:null;}})[_0x225b('0x25')](respondWithResult(_0x41c2ae,null))['catch'](handleError(_0x41c2ae,null));};exports[_0x225b('0x65')]=function(_0xb0f27,_0x489133,_0x44bfdb){var _0x91c8d5=_0xb0f27['body'][_0x225b('0x66')];return db[_0x225b('0x64')][_0x225b('0x46')]({'where':{'id':_0x91c8d5},'attributes':['id'],'include':[{'model':db[_0x225b('0x5a')],'as':'Agents','attributes':['id',_0x225b('0x33'),_0x225b('0x67'),_0x225b('0x68'),_0x225b('0x69')],'raw':!![]}]})['then'](function(_0x1c8d14){if(_0x1c8d14){var _0x4d153e=_[_0x225b('0x6a')](_0x1c8d14,function(_0x45b88a){var _0x51e224=_0x45b88a[_0x225b('0x27')]({'plain':!![]});return _0x51e224[_0x225b('0x6b')];});return db['SmsQueue'][_0x225b('0x4f')]({'where':{'id':_0xb0f27['params']['id']}})[_0x225b('0x25')](function(_0x5db59f){return db[_0x225b('0x6c')]['transaction'](function(_0x42d02e){return _0x5db59f['addTeams'](_0x91c8d5,{'transaction':_0x42d02e})['then'](function(){return BPromise[_0x225b('0x6d')](_0x4d153e,function(_0x5e62b0){return db['UserSmsQueue'][_0x225b('0x6e')]({'where':{'UserId':_0x5e62b0['id'],'SmsQueueId':_0xb0f27['params']['id']},'transaction':_0x42d02e});});})[_0x225b('0x25')](function(){_0x4d153e[_0x225b('0x6f')](function(_0x29c186){socket[_0x225b('0x70')](_0x225b('0x71'),{'UserId':_0x29c186['id'],'SmsQueueId':_0x5db59f['id']});});});});});}})['then'](respondWithStatusCode(_0x489133,null))['catch'](handleError(_0x489133,null));};exports[_0x225b('0x72')]=function(_0xf929d9,_0x1fbbac,_0x52e674){return db[_0x225b('0x64')][_0x225b('0x46')]({'where':{'id':_0xf929d9[_0x225b('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x225b('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1fbbac,null))[_0x225b('0x25')](function(_0x22845f){var _0x493aba=_['map'](_0x22845f,'id');var _0x47e984=[];var _0x5c20c1=[];var _0x221423=squel[_0x225b('0x73')]();_0x221423[_0x225b('0x74')](_0x225b('0x75'))[_0x225b('0x76')](_0x225b('0x77'),'tq')['join'](_0x225b('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x225b('0x3f')](_0x225b('0x79'),_0xf929d9[_0x225b('0x49')]['id']);for(var _0x587572=0x0;_0x587572<_0x22845f[_0x225b('0x3a')];_0x587572+=0x1){let _0x30b04f=_0x22845f[_0x587572];for(var _0x4e117b=0x0;_0x4e117b<_0x30b04f[_0x225b('0x6b')][_0x225b('0x3a')];_0x4e117b+=0x1){let _0x464c5b=_0x30b04f[_0x225b('0x6b')][_0x4e117b];var _0x26ca47=_0x221423[_0x225b('0x7a')]();_0x26ca47[_0x225b('0x3f')]('ut.UserId\x20=\x20?',_0x464c5b['id']);_0x5c20c1[_0x225b('0x7b')](db['sequelize']['query'](_0x26ca47[_0x225b('0x7c')](),{'type':db[_0x225b('0x6c')][_0x225b('0x7d')][_0x225b('0x7e')]})[_0x225b('0x25')](function(_0x55dd51){if(_0x55dd51[_0x225b('0x3a')]===0x1){return _0x464c5b['id'];}else{var _0x2c1759=_[_0x225b('0x7f')](_[_0x225b('0x2d')](_0x55dd51,_0x225b('0x80')),function(_0x15f0e4){return _[_0x225b('0x81')](_0x493aba,_0x15f0e4);});if(_0x2c1759){return _0x464c5b['id'];}}}));}}return BPromise['all'](_0x5c20c1)[_0x225b('0x25')](function(_0x4ba337){_0x47e984=_(_0x47e984)[_0x225b('0x82')](_0x4ba337)[_0x225b('0x83')]()[_0x225b('0x84')]();return db[_0x225b('0x2e')][_0x225b('0x4f')]({'where':{'id':_0xf929d9['params']['id']}})['then'](function(_0x1380c0){return db[_0x225b('0x6c')]['transaction'](function(_0x566cc4){return _0x1380c0[_0x225b('0x72')](_0xf929d9[_0x225b('0x34')]['ids'],{'transaction':_0x566cc4})[_0x225b('0x25')](function(){if(!_[_0x225b('0x85')](_0x47e984)){return _0x1380c0[_0x225b('0x86')](_0x47e984,{'transaction':_0x566cc4});}})['then'](function(){_0x47e984['forEach'](function(_0x1a233d){socket[_0x225b('0x70')](_0x225b('0x87'),{'UserId':_0x1a233d,'SmsQueueId':_0x1380c0['id']});});});});});});})[_0x225b('0x25')](respondWithStatusCode(_0x1fbbac,null))[_0x225b('0x48')](handleError(_0x1fbbac,null));};exports[_0x225b('0x88')]=function(_0x545463,_0x384e6c,_0x1c628d){return db[_0x225b('0x2e')][_0x225b('0x4f')]({'where':{'id':_0x545463[_0x225b('0x49')]['id']}})['then'](handleEntityNotFound(_0x384e6c,null))[_0x225b('0x25')](function(_0x5cc974){if(_0x5cc974){return _0x5cc974[_0x225b('0x88')](_0x545463['body'][_0x225b('0x66')],_['omit'](_0x545463[_0x225b('0x54')],[_0x225b('0x66'),'id'])||{})[_0x225b('0x89')](function(_0x35d446){for(var _0x4a7304=0x0;_0x4a7304<_0x545463[_0x225b('0x54')][_0x225b('0x66')][_0x225b('0x3a')];_0x4a7304+=0x1){socket[_0x225b('0x70')](_0x225b('0x71'),{'UserId':Number(_0x545463[_0x225b('0x54')]['ids'][_0x4a7304]),'SmsQueueId':Number(_0x545463['params']['id'])});}return _0x35d446;});}})[_0x225b('0x25')](respondWithResult(_0x384e6c,null))[_0x225b('0x48')](handleError(_0x384e6c,null));};exports[_0x225b('0x86')]=function(_0x318435,_0x4dc679,_0xfeef29){return db[_0x225b('0x2e')][_0x225b('0x4f')]({'where':{'id':_0x318435[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x4dc679,null))[_0x225b('0x25')](function(_0x4cafb9){if(_0x4cafb9){return _0x4cafb9[_0x225b('0x86')](_0x318435[_0x225b('0x34')][_0x225b('0x66')])[_0x225b('0x25')](function(){if(_[_0x225b('0x8a')](_0x318435[_0x225b('0x34')][_0x225b('0x66')])){for(var _0x561164=0x0;_0x561164<_0x318435[_0x225b('0x34')][_0x225b('0x66')][_0x225b('0x3a')];_0x561164+=0x1){socket[_0x225b('0x70')](_0x225b('0x87'),{'UserId':Number(_0x318435[_0x225b('0x34')]['ids'][_0x561164]),'SmsQueueId':Number(_0x318435['params']['id'])});}}else{socket['emit'](_0x225b('0x87'),{'UserId':Number(_0x318435[_0x225b('0x34')][_0x225b('0x66')]),'SmsQueueId':Number(_0x318435['params']['id'])});}});}})[_0x225b('0x25')](respondWithStatusCode(_0x4dc679,null))[_0x225b('0x48')](handleError(_0x4dc679,null));};exports[_0x225b('0x8b')]=function(_0x482646,_0x13aef0,_0x486b10){var _0x3990d8={};var _0x483e6e={};var _0x36bd75;var _0x22642f;return db[_0x225b('0x2e')][_0x225b('0x57')]({'where':{'id':_0x482646[_0x225b('0x49')]['id']}})[_0x225b('0x25')](handleEntityNotFound(_0x13aef0,null))['then'](function(_0x39b9ea){if(_0x39b9ea){_0x36bd75=_0x39b9ea;_0x483e6e[_0x225b('0x37')]=_['keys'](db[_0x225b('0x5a')][_0x225b('0x2f')]);_0x483e6e[_0x225b('0x34')]=_[_0x225b('0x35')](_0x482646[_0x225b('0x34')]);_0x483e6e[_0x225b('0x40')]=_[_0x225b('0x36')](_0x483e6e['model'],_0x483e6e[_0x225b('0x34')]);_0x3990d8[_0x225b('0x38')]=_['intersection'](_0x483e6e[_0x225b('0x37')],qs['fields'](_0x482646[_0x225b('0x34')][_0x225b('0x39')]));_0x3990d8['attributes']=_0x3990d8[_0x225b('0x38')][_0x225b('0x3a')]?_0x3990d8[_0x225b('0x38')]:_0x483e6e[_0x225b('0x37')];_0x3990d8[_0x225b('0x3d')]=qs['sort'](_0x482646[_0x225b('0x34')][_0x225b('0x3e')]);_0x3990d8[_0x225b('0x3f')]=qs[_0x225b('0x40')](_[_0x225b('0x58')](_0x482646[_0x225b('0x34')],_0x483e6e[_0x225b('0x40')]));if(_0x482646[_0x225b('0x34')]['filter']){_0x3990d8[_0x225b('0x3f')]=_[_0x225b('0x41')](_0x3990d8[_0x225b('0x3f')],{'$or':_['map'](_0x3990d8[_0x225b('0x38')],function(_0x12b118){var _0x17f1a3={};_0x17f1a3[_0x12b118]={'$like':'%'+_0x482646['query']['filter']+'%'};return _0x17f1a3;})});}_0x3990d8=_[_0x225b('0x41')]({},_0x3990d8,_0x482646[_0x225b('0x44')]);return _0x36bd75[_0x225b('0x8b')](_0x3990d8);}})[_0x225b('0x25')](function(_0x55d924){if(_0x55d924){_0x22642f=_0x55d924['length'];if(!_0x482646[_0x225b('0x34')][_0x225b('0x3b')](_0x225b('0x3c'))){_0x3990d8[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0x482646[_0x225b('0x34')][_0x225b('0x1e')]);_0x3990d8['offset']=qs[_0x225b('0x1c')](_0x482646[_0x225b('0x34')][_0x225b('0x1c')]);}return _0x36bd75[_0x225b('0x8b')](_0x3990d8);}})[_0x225b('0x25')](function(_0x17f2c8){if(_0x17f2c8){return _0x17f2c8?{'count':_0x22642f,'rows':_0x17f2c8}:null;}})[_0x225b('0x25')](respondWithResult(_0x13aef0,null))[_0x225b('0x48')](handleError(_0x13aef0,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9d6c54d..11d447d 100644 --- a/server/api/smsQueue/smsQueue.events.js +++ b/server/api/smsQueue/smsQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe02f=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xe02f,0x1d3));var _0xfe02=function(_0x1a3e33,_0xe419f4){_0x1a3e33=_0x1a3e33-0x0;var _0x545085=_0xe02f[_0x1a3e33];return _0x545085;};'use strict';var EventEmitter=require(_0xfe02('0x0'));var SmsQueue=require(_0xfe02('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfe02('0x2')](0x0);var events={'afterCreate':_0xfe02('0x3'),'afterUpdate':_0xfe02('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1eb89c){return function(_0x193273,_0x358035,_0x30f101){SmsQueueEvents['emit'](_0x1eb89c+':'+_0x193273['id'],_0x193273);SmsQueueEvents[_0xfe02('0x5')](_0x1eb89c,_0x193273);_0x30f101(null);};}for(var e in events){if(events[_0xfe02('0x6')](e)){var event=events[e];SmsQueue[_0xfe02('0x7')](e,emitEvent(event));}}module[_0xfe02('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xb45d=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','save'];(function(_0x382ec9,_0x420df6){var _0x784c0=function(_0x36c95e){while(--_0x36c95e){_0x382ec9['push'](_0x382ec9['shift']());}};_0x784c0(++_0x420df6);}(_0xb45d,0x85));var _0xdb45=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xb45d[_0x120bc2];return _0x454a41;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xdb45('0x0'))['db'][_0xdb45('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdb45('0x2'),'afterUpdate':'update','afterDestroy':_0xdb45('0x3')};function emitEvent(_0x549308){return function(_0x201e81,_0x2ed924,_0x11eacd){SmsQueueEvents[_0xdb45('0x4')](_0x549308+':'+_0x201e81['id'],_0x201e81);SmsQueueEvents['emit'](_0x549308,_0x201e81);_0x11eacd(null);};}for(var e in events){if(events[_0xdb45('0x5')](e)){var event=events[e];SmsQueue[_0xdb45('0x6')](e,emitEvent(event));}}module[_0xdb45('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index fae5889..db356ab 100644 --- a/server/api/smsQueue/smsQueue.model.js +++ b/server/api/smsQueue/smsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ed3=['sms_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x1857ae,_0xc0afe6){var _0x46302c=function(_0x3a34e9){while(--_0x3a34e9){_0x1857ae['push'](_0x1857ae['shift']());}};_0x46302c(++_0xc0afe6);}(_0x9ed3,0x1e1));var _0x39ed=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x9ed3[_0x5c9307];return _0x373e29;};'use strict';var _=require('lodash');var util=require(_0x39ed('0x0'));var logger=require(_0x39ed('0x1'))('api');var moment=require(_0x39ed('0x2'));var BPromise=require(_0x39ed('0x3'));var rp=require(_0x39ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39ed('0x5'));var config=require(_0x39ed('0x6'));var attributes=require(_0x39ed('0x7'));module[_0x39ed('0x8')]=function(_0x54aeb5,_0x5bb4f4){return _0x54aeb5[_0x39ed('0x9')](_0x39ed('0xa'),attributes,{'tableName':_0x39ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d10=['exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x434d68,_0xcbdfed){var _0x56f3ce=function(_0x3553ab){while(--_0x3553ab){_0x434d68['push'](_0x434d68['shift']());}};_0x56f3ce(++_0xcbdfed);}(_0x0d10,0x1bb));var _0x00d1=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x0d10[_0x4f6d08];return _0x53a9c6;};'use strict';var _=require(_0x00d1('0x0'));var util=require('util');var logger=require(_0x00d1('0x1'))(_0x00d1('0x2'));var moment=require(_0x00d1('0x3'));var BPromise=require(_0x00d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00d1('0x5'));var rimraf=require(_0x00d1('0x6'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x00d1('0x7')]=function(_0x1868a8,_0x590ca4){return _0x1868a8['define'](_0x00d1('0x8'),attributes,{'tableName':_0x00d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 46895c3..79fb845 100644 --- a/server/api/smsQueue/smsQueue.rpc.js +++ b/server/api/smsQueue/smsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb76=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x321c8d,_0xff6f31){var _0x3d1564=function(_0x26e52b){while(--_0x26e52b){_0x321c8d['push'](_0x321c8d['shift']());}};_0x3d1564(++_0xff6f31);}(_0xcb76,0x8e));var _0x6cb7=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xcb76[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x6cb7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6cb7('0x1'));var rs=require(_0x6cb7('0x2'));var fs=require('fs');var Redis=require(_0x6cb7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cb7('0x4'));var logger=require('../../config/logger')(_0x6cb7('0x5'));var config=require(_0x6cb7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6cb7('0x7')][_0x6cb7('0x8')]({'port':0x232a});config[_0x6cb7('0x9')]=_[_0x6cb7('0xa')](config[_0x6cb7('0x9')],{'host':_0x6cb7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6cb7('0x9')]));require(_0x6cb7('0xc'))[_0x6cb7('0xd')](socket);function respondWithRpcPromise(_0x1f6460,_0x297f42,_0x1ba56d){return new BPromise(function(_0x29efb3,_0x300f86){return client[_0x6cb7('0xe')](_0x1f6460,_0x1ba56d)[_0x6cb7('0xf')](function(_0x47b2d8){logger[_0x6cb7('0x10')](_0x6cb7('0x11'),_0x297f42,'request\x20sent');logger[_0x6cb7('0x12')](_0x6cb7('0x13'),_0x297f42,_0x6cb7('0x14'),JSON[_0x6cb7('0x15')](_0x47b2d8));if(_0x47b2d8[_0x6cb7('0x16')]){if(_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x17')]===0x1f4){logger[_0x6cb7('0x16')](_0x6cb7('0x11'),_0x297f42,_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);return _0x300f86(_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x297f42,_0x47b2d8[_0x6cb7('0x16')][_0x6cb7('0x18')]);return _0x29efb3(_0x47b2d8[_0x6cb7('0x16')]['message']);}else{logger[_0x6cb7('0x10')](_0x6cb7('0x11'),_0x297f42,_0x6cb7('0x14'));_0x29efb3(_0x47b2d8[_0x6cb7('0x19')][_0x6cb7('0x18')]);}})[_0x6cb7('0x1a')](function(_0x30146d){logger['error']('SmsQueue,\x20%s,\x20%s',_0x297f42,_0x30146d);_0x300f86(_0x30146d);});});}exports[_0x6cb7('0x1b')]=function(_0x3db199){var _0x169f21=this;return new Promise(function(_0x4d116c,_0x22af5d){return db[_0x6cb7('0x1c')][_0x6cb7('0x1d')]({'raw':_0x3db199[_0x6cb7('0x1e')]?_0x3db199['options'][_0x6cb7('0x1f')]===undefined?!![]:![]:!![],'where':_0x3db199[_0x6cb7('0x1e')]?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x20')]||null:null,'attributes':_0x3db199['options']?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x21')]||null:null,'limit':_0x3db199[_0x6cb7('0x1e')]?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x22')]||null:null,'include':_0x3db199['options']?_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x3db199[_0x6cb7('0x1e')][_0x6cb7('0x23')],function(_0x2b51ec){return{'model':db[_0x2b51ec['model']],'as':_0x2b51ec['as'],'attributes':_0x2b51ec[_0x6cb7('0x21')],'include':_0x2b51ec[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x2b51ec[_0x6cb7('0x23')],function(_0x16a34c){return{'model':db[_0x16a34c[_0x6cb7('0x25')]],'as':_0x16a34c['as'],'attributes':_0x16a34c['attributes'],'include':_0x16a34c['include']?_[_0x6cb7('0x24')](_0x16a34c[_0x6cb7('0x23')],function(_0x30b702){return{'model':db[_0x30b702[_0x6cb7('0x25')]],'as':_0x30b702['as'],'attributes':_0x30b702[_0x6cb7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa34118){logger[_0x6cb7('0x10')](_0x6cb7('0x1b'),_0x3db199);logger[_0x6cb7('0x12')]('GetSmsQueue',_0x3db199,JSON[_0x6cb7('0x15')](_0xa34118));_0x4d116c(_0xa34118);})['catch'](function(_0x50cabc){logger['error'](_0x6cb7('0x1b'),_0x50cabc[_0x6cb7('0x18')],_0x3db199);_0x22af5d(_0x169f21[_0x6cb7('0x16')](0x1f4,_0x50cabc['message']));});});};exports[_0x6cb7('0x26')]=function(_0x443cc2){var _0xf8a185=this;return new Promise(function(_0x5cf32f,_0x51e4ba){return db[_0x6cb7('0x1c')][_0x6cb7('0x27')]({'raw':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2['options'][_0x6cb7('0x1f')]===undefined?!![]:![]:!![],'where':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x20')]||null:null,'attributes':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x21')]||null:null,'include':_0x443cc2[_0x6cb7('0x1e')]?_0x443cc2['options'][_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x443cc2[_0x6cb7('0x1e')][_0x6cb7('0x23')],function(_0x51b51c){return{'model':db[_0x51b51c[_0x6cb7('0x25')]],'as':_0x51b51c['as'],'attributes':_0x51b51c['attributes'],'include':_0x51b51c[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x51b51c['include'],function(_0x392d26){return{'model':db[_0x392d26[_0x6cb7('0x25')]],'as':_0x392d26['as'],'attributes':_0x392d26[_0x6cb7('0x21')],'include':_0x392d26[_0x6cb7('0x23')]?_[_0x6cb7('0x24')](_0x392d26['include'],function(_0x4f620d){return{'model':db[_0x4f620d[_0x6cb7('0x25')]],'as':_0x4f620d['as'],'attributes':_0x4f620d[_0x6cb7('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6cb7('0xf')](function(_0xee38ed){logger[_0x6cb7('0x10')](_0x6cb7('0x26'),_0x443cc2);logger[_0x6cb7('0x12')](_0x6cb7('0x26'),_0x443cc2,JSON[_0x6cb7('0x15')](_0xee38ed));_0x5cf32f(_0xee38ed);})['catch'](function(_0x4b4030){logger[_0x6cb7('0x16')](_0x6cb7('0x26'),_0x4b4030[_0x6cb7('0x18')],_0x443cc2);_0x51e4ba(_0xf8a185[_0x6cb7('0x16')](0x1f4,_0x4b4030[_0x6cb7('0x18')]));});});}; \ No newline at end of file +var _0x0773=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','findAll','options','attributes','include','map','model','stringify','ShowSmsQueue','SmsQueue','find','raw','where','lodash','util','moment','bluebird','randomstring'];(function(_0x9a43eb,_0x37996f){var _0x38abdc=function(_0x1c36de){while(--_0x1c36de){_0x9a43eb['push'](_0x9a43eb['shift']());}};_0x38abdc(++_0x37996f);}(_0x0773,0x1c9));var _0x3077=function(_0x2d5cd9,_0x36373d){_0x2d5cd9=_0x2d5cd9-0x0;var _0x144670=_0x0773[_0x2d5cd9];return _0x144670;};'use strict';var _=require(_0x3077('0x0'));var util=require(_0x3077('0x1'));var moment=require(_0x3077('0x2'));var BPromise=require(_0x3077('0x3'));var rs=require(_0x3077('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3077('0x5'))['db'];var utils=require(_0x3077('0x6'));var logger=require(_0x3077('0x7'))(_0x3077('0x8'));var config=require('../../config/environment');var jayson=require(_0x3077('0x9'));var client=jayson[_0x3077('0xa')][_0x3077('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3077('0xc')],{'host':_0x3077('0xd'),'port':0x18eb});var socket=require(_0x3077('0xe'))(new Redis(config[_0x3077('0xc')]));require(_0x3077('0xf'))[_0x3077('0x10')](socket);function respondWithRpcPromise(_0x53ae38,_0xa5ac7e,_0xa8e9d9){return new BPromise(function(_0x2c2882,_0x20d405){return client[_0x3077('0x11')](_0x53ae38,_0xa8e9d9)[_0x3077('0x12')](function(_0x55b480){logger[_0x3077('0x13')](_0x3077('0x14'),_0xa5ac7e,_0x3077('0x15'));logger[_0x3077('0x16')](_0x3077('0x17'),_0xa5ac7e,_0x3077('0x15'),JSON['stringify'](_0x55b480));if(_0x55b480['error']){if(_0x55b480[_0x3077('0x18')][_0x3077('0x19')]===0x1f4){logger[_0x3077('0x18')](_0x3077('0x14'),_0xa5ac7e,_0x55b480[_0x3077('0x18')]['message']);return _0x20d405(_0x55b480[_0x3077('0x18')][_0x3077('0x1a')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0xa5ac7e,_0x55b480[_0x3077('0x18')][_0x3077('0x1a')]);return _0x2c2882(_0x55b480[_0x3077('0x18')][_0x3077('0x1a')]);}else{logger[_0x3077('0x13')](_0x3077('0x14'),_0xa5ac7e,'request\x20sent');_0x2c2882(_0x55b480[_0x3077('0x1b')]['message']);}})[_0x3077('0x1c')](function(_0x496907){logger[_0x3077('0x18')](_0x3077('0x14'),_0xa5ac7e,_0x496907);_0x20d405(_0x496907);});});}exports[_0x3077('0x1d')]=function(_0x1ff14f){var _0x46580f=this;return new Promise(function(_0x1f6397,_0xe15e88){return db['SmsQueue'][_0x3077('0x1e')]({'raw':_0x1ff14f[_0x3077('0x1f')]?_0x1ff14f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ff14f[_0x3077('0x1f')]?_0x1ff14f[_0x3077('0x1f')]['where']||null:null,'attributes':_0x1ff14f['options']?_0x1ff14f[_0x3077('0x1f')][_0x3077('0x20')]||null:null,'limit':_0x1ff14f[_0x3077('0x1f')]?_0x1ff14f['options']['limit']||null:null,'include':_0x1ff14f['options']?_0x1ff14f['options'][_0x3077('0x21')]?_[_0x3077('0x22')](_0x1ff14f['options'][_0x3077('0x21')],function(_0x30ad22){return{'model':db[_0x30ad22['model']],'as':_0x30ad22['as'],'attributes':_0x30ad22[_0x3077('0x20')],'include':_0x30ad22['include']?_[_0x3077('0x22')](_0x30ad22['include'],function(_0x1c6f89){return{'model':db[_0x1c6f89[_0x3077('0x23')]],'as':_0x1c6f89['as'],'attributes':_0x1c6f89['attributes'],'include':_0x1c6f89[_0x3077('0x21')]?_['map'](_0x1c6f89[_0x3077('0x21')],function(_0x30a275){return{'model':db[_0x30a275['model']],'as':_0x30a275['as'],'attributes':_0x30a275[_0x3077('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3077('0x12')](function(_0xe4410c){logger[_0x3077('0x13')](_0x3077('0x1d'),_0x1ff14f);logger[_0x3077('0x16')](_0x3077('0x1d'),_0x1ff14f,JSON[_0x3077('0x24')](_0xe4410c));_0x1f6397(_0xe4410c);})[_0x3077('0x1c')](function(_0x57b7c8){logger[_0x3077('0x18')]('GetSmsQueue',_0x57b7c8[_0x3077('0x1a')],_0x1ff14f);_0xe15e88(_0x46580f[_0x3077('0x18')](0x1f4,_0x57b7c8[_0x3077('0x1a')]));});});};exports[_0x3077('0x25')]=function(_0x299e26){var _0x18f5ab=this;return new Promise(function(_0x5dd3c1,_0x2883a1){return db[_0x3077('0x26')][_0x3077('0x27')]({'raw':_0x299e26[_0x3077('0x1f')]?_0x299e26[_0x3077('0x1f')][_0x3077('0x28')]===undefined?!![]:![]:!![],'where':_0x299e26[_0x3077('0x1f')]?_0x299e26[_0x3077('0x1f')][_0x3077('0x29')]||null:null,'attributes':_0x299e26[_0x3077('0x1f')]?_0x299e26[_0x3077('0x1f')][_0x3077('0x20')]||null:null,'include':_0x299e26[_0x3077('0x1f')]?_0x299e26[_0x3077('0x1f')][_0x3077('0x21')]?_[_0x3077('0x22')](_0x299e26[_0x3077('0x1f')]['include'],function(_0x26405e){return{'model':db[_0x26405e[_0x3077('0x23')]],'as':_0x26405e['as'],'attributes':_0x26405e[_0x3077('0x20')],'include':_0x26405e['include']?_['map'](_0x26405e[_0x3077('0x21')],function(_0x3c2079){return{'model':db[_0x3c2079[_0x3077('0x23')]],'as':_0x3c2079['as'],'attributes':_0x3c2079['attributes'],'include':_0x3c2079[_0x3077('0x21')]?_[_0x3077('0x22')](_0x3c2079[_0x3077('0x21')],function(_0x5161f8){return{'model':db[_0x5161f8[_0x3077('0x23')]],'as':_0x5161f8['as'],'attributes':_0x5161f8[_0x3077('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce7bf){logger['info'](_0x3077('0x25'),_0x299e26);logger[_0x3077('0x16')](_0x3077('0x25'),_0x299e26,JSON[_0x3077('0x24')](_0x1ce7bf));_0x5dd3c1(_0x1ce7bf);})['catch'](function(_0x6e9ead){logger[_0x3077('0x18')](_0x3077('0x25'),_0x6e9ead[_0x3077('0x1a')],_0x299e26);_0x2883a1(_0x18f5ab[_0x3077('0x18')](0x1f4,_0x6e9ead['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 85117e4..099c608 100644 --- a/server/api/smsQueue/smsQueue.socket.js +++ b/server/api/smsQueue/smsQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb889=['./smsQueue.events','save','update','emit','removeListener','register','length'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb889,0xb6));var _0x9b88=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb889[_0x342baa];return _0x1208f3;};'use strict';var SmsQueueEvents=require(_0x9b88('0x0'));var events=[_0x9b88('0x1'),'remove',_0x9b88('0x2')];function createListener(_0x251861,_0x4fe2b6){return function(_0x12adb1){_0x4fe2b6[_0x9b88('0x3')](_0x251861,_0x12adb1);};}function removeListener(_0xbb14e1,_0x42d3dc){return function(){SmsQueueEvents[_0x9b88('0x4')](_0xbb14e1,_0x42d3dc);};}exports[_0x9b88('0x5')]=function(_0x57c54e){for(var _0x1b7ff1=0x0,_0x4a8652=events[_0x9b88('0x6')];_0x1b7ff1<_0x4a8652;_0x1b7ff1++){var _0x38b404=events[_0x1b7ff1];var _0x48231f=createListener('smsQueue:'+_0x38b404,_0x57c54e);SmsQueueEvents['on'](_0x38b404,_0x48231f);}}; \ No newline at end of file +var _0xb48e=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb48e,0x169));var _0xeb48=function(_0x272cb3,_0x4118e6){_0x272cb3=_0x272cb3-0x0;var _0x3f1147=_0xb48e[_0x272cb3];return _0x3f1147;};'use strict';var SmsQueueEvents=require(_0xeb48('0x0'));var events=[_0xeb48('0x1'),_0xeb48('0x2'),_0xeb48('0x3')];function createListener(_0x3b21b0,_0x1508d6){return function(_0x57c50d){_0x1508d6[_0xeb48('0x4')](_0x3b21b0,_0x57c50d);};}function removeListener(_0x552418,_0x38c045){return function(){SmsQueueEvents[_0xeb48('0x5')](_0x552418,_0x38c045);};}exports[_0xeb48('0x6')]=function(_0x5109e5){for(var _0x216338=0x0,_0x5f5608=events['length'];_0x216338<_0x5f5608;_0x216338++){var _0x386ddf=events[_0x216338];var _0xc6d8da=createListener(_0xeb48('0x7')+_0x386ddf,_0x5109e5);SmsQueueEvents['on'](_0x386ddf,_0xc6d8da);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f26196b..b55c2cd 100644 --- a/server/api/smsQueueReport/index.js +++ b/server/api/smsQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad68=['/:id','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','put'];(function(_0x5a0b6c,_0x175969){var _0x539441=function(_0x36eeb1){while(--_0x36eeb1){_0x5a0b6c['push'](_0x5a0b6c['shift']());}};_0x539441(++_0x175969);}(_0xad68,0x100));var _0x8ad6=function(_0x11a287,_0x57df55){_0x11a287=_0x11a287-0x0;var _0x111e64=_0xad68[_0x11a287];return _0x111e64;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8ad6('0x0'));var timeout=require(_0x8ad6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ad6('0x2'));var auth=require(_0x8ad6('0x3'));var interaction=require(_0x8ad6('0x4'));var config=require(_0x8ad6('0x5'));var controller=require(_0x8ad6('0x6'));router[_0x8ad6('0x7')]('/',auth[_0x8ad6('0x8')](),controller['index']);router[_0x8ad6('0x7')](_0x8ad6('0x9'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0xa')]);router[_0x8ad6('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x8ad6('0xb')]);router[_0x8ad6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ad6('0xd')](_0x8ad6('0xe'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0xf')]);router[_0x8ad6('0x10')](_0x8ad6('0xe'),auth[_0x8ad6('0x8')](),controller[_0x8ad6('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3de9=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','get'];(function(_0x44712c,_0x4c980c){var _0x49b547=function(_0x3131d6){while(--_0x3131d6){_0x44712c['push'](_0x44712c['shift']());}};_0x49b547(++_0x4c980c);}(_0x3de9,0x147));var _0x93de=function(_0x1922b6,_0x1f8fc8){_0x1922b6=_0x1922b6-0x0;var _0x517ddb=_0x3de9[_0x1922b6];return _0x517ddb;};'use strict';var multer=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var path=require('path');var timeout=require(_0x93de('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x93de('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x93de('0x4'));var config=require(_0x93de('0x5'));var controller=require(_0x93de('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x93de('0x7')]);router[_0x93de('0x8')](_0x93de('0x9'),auth[_0x93de('0xa')](),controller[_0x93de('0xb')]);router['get'](_0x93de('0xc'),auth[_0x93de('0xa')](),controller[_0x93de('0xd')]);router[_0x93de('0xe')]('/',auth[_0x93de('0xa')](),controller[_0x93de('0xf')]);router[_0x93de('0x10')](_0x93de('0xc'),auth[_0x93de('0xa')](),controller[_0x93de('0x11')]);router[_0x93de('0x12')](_0x93de('0xc'),auth[_0x93de('0xa')](),controller[_0x93de('0x13')]);module[_0x93de('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b82cdfe..65a2cb9 100644 --- a/server/api/smsQueueReport/smsQueueReport.attributes.js +++ b/server/api/smsQueueReport/smsQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x830f=['DATE','moment','sequelize','exports','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x830f,0x1a0));var _0xf830=function(_0x14601f,_0x3a8258){_0x14601f=_0x14601f-0x0;var _0x3a4923=_0x830f[_0x14601f];return _0x3a4923;};'use strict';var moment=require(_0xf830('0x0'));var Sequelize=require(_0xf830('0x1'));module[_0xf830('0x2')]={'uniqueid':{'type':Sequelize[_0xf830('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf830('0x4')]},'reason':{'type':Sequelize[_0xf830('0x3')]}}; \ No newline at end of file +var _0xfdf0=['STRING','DATE','moment','exports'];(function(_0x2595a6,_0x48fc45){var _0x460197=function(_0x18f9db){while(--_0x18f9db){_0x2595a6['push'](_0x2595a6['shift']());}};_0x460197(++_0x48fc45);}(_0xfdf0,0xea));var _0x0fdf=function(_0x2f32c4,_0x2597ba){_0x2f32c4=_0x2f32c4-0x0;var _0x95b5dc=_0xfdf0[_0x2f32c4];return _0x95b5dc;};'use strict';var moment=require(_0x0fdf('0x0'));var Sequelize=require('sequelize');module[_0x0fdf('0x1')]={'uniqueid':{'type':Sequelize[_0x0fdf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0fdf('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0fdf('0x3')]},'exitAt':{'type':Sequelize[_0x0fdf('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9b42452..0701b27 100644 --- a/server/api/smsQueueReport/smsQueueReport.controller.js +++ b/server/api/smsQueueReport/smsQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0411=['params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','length','find','create','body'];(function(_0x200661,_0xc8d664){var _0x2b4b91=function(_0x176e9e){while(--_0x176e9e){_0x200661['push'](_0x200661['shift']());}};_0x2b4b91(++_0xc8d664);}(_0x0411,0x1d0));var _0x1041=function(_0x3da7a1,_0x151473){_0x3da7a1=_0x3da7a1-0x0;var _0x3b7290=_0x0411[_0x3da7a1];return _0x3b7290;};'use strict';var emlformat=require(_0x1041('0x0'));var rimraf=require(_0x1041('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1041('0x2'));var rp=require(_0x1041('0x3'));var moment=require(_0x1041('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1041('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1041('0x6'));var csv=require(_0x1041('0x7'));var ejs=require(_0x1041('0x8'));var fs=require('fs');var fs_extra=require(_0x1041('0x9'));var _=require(_0x1041('0xa'));var squel=require(_0x1041('0xb'));var crypto=require(_0x1041('0xc'));var jsforce=require(_0x1041('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1041('0x7'));var querystring=require(_0x1041('0xe'));var Papa=require(_0x1041('0xf'));var Redis=require('ioredis');var authService=require(_0x1041('0x10'));var qs=require(_0x1041('0x11'));var as=require(_0x1041('0x12'));var hardwareService=require(_0x1041('0x13'));var logger=require(_0x1041('0x14'))('api');var utils=require(_0x1041('0x15'));var config=require(_0x1041('0x16'));var licenseUtil=require(_0x1041('0x17'));var db=require(_0x1041('0x18'))['db'];function respondWithStatusCode(_0x50f6d4,_0x5ea4a8){_0x5ea4a8=_0x5ea4a8||0xcc;return function(_0x478311){if(_0x478311){return _0x50f6d4[_0x1041('0x19')](_0x5ea4a8);}return _0x50f6d4[_0x1041('0x1a')](_0x5ea4a8)[_0x1041('0x1b')]();};}function respondWithResult(_0x17e3ed,_0x330f60){_0x330f60=_0x330f60||0xc8;return function(_0x2cb23c){if(_0x2cb23c){return _0x17e3ed[_0x1041('0x1a')](_0x330f60)[_0x1041('0x1c')](_0x2cb23c);}};}function respondWithFilteredResult(_0x3169b4,_0x40d986){return function(_0x5a00b8){if(_0x5a00b8){var _0x4af04c=typeof _0x40d986[_0x1041('0x1d')]==='undefined'&&typeof _0x40d986[_0x1041('0x1e')]===_0x1041('0x1f');var _0x2c2412=_0x5a00b8['count'];var _0x564996=_0x4af04c?0x0:_0x40d986[_0x1041('0x1d')];var _0x27d8e7=_0x4af04c?_0x5a00b8['count']:_0x40d986['offset']+_0x40d986['limit'];var _0x38b9ed;if(_0x27d8e7>=_0x2c2412){_0x27d8e7=_0x2c2412;_0x38b9ed=0xc8;}else{_0x38b9ed=0xce;}_0x3169b4['status'](_0x38b9ed);return _0x3169b4[_0x1041('0x20')](_0x1041('0x21'),_0x564996+'-'+_0x27d8e7+'/'+_0x2c2412)[_0x1041('0x1c')](_0x5a00b8);}return null;};}function patchUpdates(_0x108e67){return function(_0x4c1620){try{jsonpatch['apply'](_0x4c1620,_0x108e67,!![]);}catch(_0x2a6553){return BPromise[_0x1041('0x22')](_0x2a6553);}return _0x4c1620[_0x1041('0x23')]();};}function saveUpdates(_0x3b9aa7,_0x1e42d1){return function(_0x5d987d){if(_0x5d987d){return _0x5d987d[_0x1041('0x24')](_0x3b9aa7)[_0x1041('0x25')](function(_0x5b48e0){return _0x5b48e0;});}return null;};}function removeEntity(_0x362996,_0x2c58ce){return function(_0x1ae82e){if(_0x1ae82e){return _0x1ae82e[_0x1041('0x26')]()['then'](function(){_0x362996[_0x1041('0x1a')](0xcc)[_0x1041('0x1b')]();});}};}function handleEntityNotFound(_0xbec30d,_0x4a6d73){return function(_0x473ef7){if(!_0x473ef7){_0xbec30d['sendStatus'](0x194);}return _0x473ef7;};}function handleError(_0x4239af,_0x5257ca){_0x5257ca=_0x5257ca||0x1f4;return function(_0x32ca6b){logger['error'](_0x32ca6b[_0x1041('0x27')]);if(_0x32ca6b[_0x1041('0x28')]){delete _0x32ca6b[_0x1041('0x28')];}_0x4239af[_0x1041('0x1a')](_0x5257ca)[_0x1041('0x29')](_0x32ca6b);};}exports[_0x1041('0x2a')]=function(_0x7b9ecf,_0x4c3822){var _0x51d428={},_0x4b8dd6={},_0x194f04={'count':0x0,'rows':[]};var _0x5bae02=_[_0x1041('0x2b')](db[_0x1041('0x2c')][_0x1041('0x2d')],function(_0x449eb9){return{'name':_0x449eb9[_0x1041('0x2e')],'type':_0x449eb9[_0x1041('0x2f')][_0x1041('0x30')]};});_0x4b8dd6[_0x1041('0x31')]=_[_0x1041('0x2b')](_0x5bae02,'name');_0x4b8dd6['query']=_[_0x1041('0x32')](_0x7b9ecf[_0x1041('0x33')]);_0x4b8dd6[_0x1041('0x34')]=_[_0x1041('0x35')](_0x4b8dd6[_0x1041('0x31')],_0x4b8dd6[_0x1041('0x33')]);_0x51d428['attributes']=_[_0x1041('0x35')](_0x4b8dd6[_0x1041('0x31')],qs[_0x1041('0x36')](_0x7b9ecf[_0x1041('0x33')][_0x1041('0x36')]));_0x51d428[_0x1041('0x37')]=_0x51d428['attributes']['length']?_0x51d428[_0x1041('0x37')]:_0x4b8dd6[_0x1041('0x31')];if(!_0x7b9ecf[_0x1041('0x33')][_0x1041('0x38')](_0x1041('0x39'))){_0x51d428[_0x1041('0x1e')]=qs[_0x1041('0x1e')](_0x7b9ecf['query'][_0x1041('0x1e')]);_0x51d428[_0x1041('0x1d')]=qs[_0x1041('0x1d')](_0x7b9ecf[_0x1041('0x33')]['offset']);}_0x51d428[_0x1041('0x3a')]=qs[_0x1041('0x3b')](_0x7b9ecf['query']['sort']);_0x51d428[_0x1041('0x3c')]=qs[_0x1041('0x34')](_['pick'](_0x7b9ecf['query'],_0x4b8dd6[_0x1041('0x34')]),_0x5bae02);if(_0x7b9ecf['query'][_0x1041('0x3d')]){_0x51d428[_0x1041('0x3c')]=_[_0x1041('0x3e')](_0x51d428[_0x1041('0x3c')],{'$or':_['map'](_0x5bae02,function(_0x2fb1ef){if(_0x2fb1ef[_0x1041('0x2f')]!=='VIRTUAL'){var _0x44f065={};_0x44f065[_0x2fb1ef[_0x1041('0x28')]]={'$like':'%'+_0x7b9ecf[_0x1041('0x33')][_0x1041('0x3d')]+'%'};return _0x44f065;}})});}_0x51d428=_['merge']({},_0x51d428,_0x7b9ecf[_0x1041('0x3f')]);var _0x4288db={'where':_0x51d428[_0x1041('0x3c')]};return db['SmsQueueReport'][_0x1041('0x40')](_0x4288db)[_0x1041('0x25')](function(_0x471f39){_0x194f04[_0x1041('0x40')]=_0x471f39;if(_0x7b9ecf[_0x1041('0x33')][_0x1041('0x41')]){_0x51d428[_0x1041('0x42')]=[{'all':!![]}];}return db[_0x1041('0x2c')][_0x1041('0x43')](_0x51d428);})['then'](function(_0x1ec6ae){_0x194f04[_0x1041('0x44')]=_0x1ec6ae;return _0x194f04;})[_0x1041('0x25')](respondWithFilteredResult(_0x4c3822,_0x51d428))[_0x1041('0x45')](handleError(_0x4c3822,null));};exports[_0x1041('0x46')]=function(_0x2eb6be,_0x4741fd){var _0x564831={'raw':!![],'where':{'id':_0x2eb6be['params']['id']}},_0x211fbe={};_0x211fbe[_0x1041('0x31')]=_[_0x1041('0x32')](db[_0x1041('0x2c')][_0x1041('0x2d')]);_0x211fbe[_0x1041('0x33')]=_['keys'](_0x2eb6be['query']);_0x211fbe[_0x1041('0x34')]=_[_0x1041('0x35')](_0x211fbe['model'],_0x211fbe[_0x1041('0x33')]);_0x564831[_0x1041('0x37')]=_[_0x1041('0x35')](_0x211fbe[_0x1041('0x31')],qs[_0x1041('0x36')](_0x2eb6be['query'][_0x1041('0x36')]));_0x564831[_0x1041('0x37')]=_0x564831[_0x1041('0x37')][_0x1041('0x47')]?_0x564831[_0x1041('0x37')]:_0x211fbe['model'];if(_0x2eb6be[_0x1041('0x33')][_0x1041('0x41')]){_0x564831[_0x1041('0x42')]=[{'all':!![]}];}_0x564831=_[_0x1041('0x3e')]({},_0x564831,_0x2eb6be[_0x1041('0x3f')]);return db[_0x1041('0x2c')][_0x1041('0x48')](_0x564831)['then'](handleEntityNotFound(_0x4741fd,null))[_0x1041('0x25')](respondWithResult(_0x4741fd,null))[_0x1041('0x45')](handleError(_0x4741fd,null));};exports[_0x1041('0x49')]=function(_0xab5a9,_0x228117){return db[_0x1041('0x2c')][_0x1041('0x49')](_0xab5a9[_0x1041('0x4a')],{})['then'](respondWithResult(_0x228117,0xc9))[_0x1041('0x45')](handleError(_0x228117,null));};exports[_0x1041('0x24')]=function(_0x24efd8,_0x2891b6){if(_0x24efd8[_0x1041('0x4a')]['id']){delete _0x24efd8[_0x1041('0x4a')]['id'];}return db['SmsQueueReport'][_0x1041('0x48')]({'where':{'id':_0x24efd8[_0x1041('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2891b6,null))[_0x1041('0x25')](saveUpdates(_0x24efd8['body'],null))[_0x1041('0x25')](respondWithResult(_0x2891b6,null))[_0x1041('0x45')](handleError(_0x2891b6,null));};exports[_0x1041('0x26')]=function(_0x1c9f68,_0x309d70){return db[_0x1041('0x2c')][_0x1041('0x48')]({'where':{'id':_0x1c9f68[_0x1041('0x4b')]['id']}})[_0x1041('0x25')](handleEntityNotFound(_0x309d70,null))['then'](removeEntity(_0x309d70,null))[_0x1041('0x45')](handleError(_0x309d70,null));};exports[_0x1041('0x4c')]=function(_0xc499f,_0x150e4c){return db['SmsQueueReport'][_0x1041('0x4c')]()['then'](respondWithResult(_0x150e4c,null))[_0x1041('0x45')](handleError(_0x150e4c,null));}; \ No newline at end of file +var _0xb5eb=['set','apply','save','then','stack','name','send','index','SmsQueueReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','catch','create','update','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count'];(function(_0x16854e,_0x5a3ee6){var _0x325e2e=function(_0x2e935c){while(--_0x2e935c){_0x16854e['push'](_0x16854e['shift']());}};_0x325e2e(++_0x5a3ee6);}(_0xb5eb,0x151));var _0xbb5e=function(_0x30e344,_0x499b6d){_0x30e344=_0x30e344-0x0;var _0xe1e5cb=_0xb5eb[_0x30e344];return _0xe1e5cb;};'use strict';var emlformat=require(_0xbb5e('0x0'));var rimraf=require(_0xbb5e('0x1'));var zipdir=require(_0xbb5e('0x2'));var jsonpatch=require(_0xbb5e('0x3'));var rp=require('request-promise');var moment=require(_0xbb5e('0x4'));var BPromise=require(_0xbb5e('0x5'));var Mustache=require(_0xbb5e('0x6'));var util=require(_0xbb5e('0x7'));var path=require(_0xbb5e('0x8'));var sox=require('sox');var csv=require(_0xbb5e('0x9'));var ejs=require(_0xbb5e('0xa'));var fs=require('fs');var fs_extra=require(_0xbb5e('0xb'));var _=require(_0xbb5e('0xc'));var squel=require(_0xbb5e('0xd'));var crypto=require(_0xbb5e('0xe'));var jsforce=require(_0xbb5e('0xf'));var deskjs=require(_0xbb5e('0x10'));var toCsv=require(_0xbb5e('0x9'));var querystring=require(_0xbb5e('0x11'));var Papa=require(_0xbb5e('0x12'));var Redis=require(_0xbb5e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbb5e('0x14'));var as=require(_0xbb5e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb5e('0x16'))('api');var utils=require(_0xbb5e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbb5e('0x18'));var db=require(_0xbb5e('0x19'))['db'];function respondWithStatusCode(_0x124437,_0x2628c3){_0x2628c3=_0x2628c3||0xcc;return function(_0x2a161c){if(_0x2a161c){return _0x124437[_0xbb5e('0x1a')](_0x2628c3);}return _0x124437[_0xbb5e('0x1b')](_0x2628c3)[_0xbb5e('0x1c')]();};}function respondWithResult(_0x518676,_0x13171a){_0x13171a=_0x13171a||0xc8;return function(_0x23c4a0){if(_0x23c4a0){return _0x518676['status'](_0x13171a)[_0xbb5e('0x1d')](_0x23c4a0);}};}function respondWithFilteredResult(_0x3d362d,_0x577544){return function(_0x4f122c){if(_0x4f122c){var _0x57b2a4=typeof _0x577544[_0xbb5e('0x1e')]==='undefined'&&typeof _0x577544[_0xbb5e('0x1f')]==='undefined';var _0x7768a8=_0x4f122c[_0xbb5e('0x20')];var _0x441093=_0x57b2a4?0x0:_0x577544[_0xbb5e('0x1e')];var _0x18c4b5=_0x57b2a4?_0x4f122c['count']:_0x577544[_0xbb5e('0x1e')]+_0x577544[_0xbb5e('0x1f')];var _0x4ab570;if(_0x18c4b5>=_0x7768a8){_0x18c4b5=_0x7768a8;_0x4ab570=0xc8;}else{_0x4ab570=0xce;}_0x3d362d[_0xbb5e('0x1b')](_0x4ab570);return _0x3d362d[_0xbb5e('0x21')]('Content-Range',_0x441093+'-'+_0x18c4b5+'/'+_0x7768a8)[_0xbb5e('0x1d')](_0x4f122c);}return null;};}function patchUpdates(_0xa5e021){return function(_0x77e04f){try{jsonpatch[_0xbb5e('0x22')](_0x77e04f,_0xa5e021,!![]);}catch(_0x13d68b){return BPromise['reject'](_0x13d68b);}return _0x77e04f[_0xbb5e('0x23')]();};}function saveUpdates(_0x579191,_0x383467){return function(_0x5d8135){if(_0x5d8135){return _0x5d8135['update'](_0x579191)[_0xbb5e('0x24')](function(_0x2e6906){return _0x2e6906;});}return null;};}function removeEntity(_0x2b49a0,_0x5aaa72){return function(_0x10e536){if(_0x10e536){return _0x10e536['destroy']()[_0xbb5e('0x24')](function(){_0x2b49a0['status'](0xcc)[_0xbb5e('0x1c')]();});}};}function handleEntityNotFound(_0x87a866,_0x4ea413){return function(_0x3ea92e){if(!_0x3ea92e){_0x87a866[_0xbb5e('0x1a')](0x194);}return _0x3ea92e;};}function handleError(_0x1ca47d,_0x48674e){_0x48674e=_0x48674e||0x1f4;return function(_0x5b8b0b){logger['error'](_0x5b8b0b[_0xbb5e('0x25')]);if(_0x5b8b0b['name']){delete _0x5b8b0b[_0xbb5e('0x26')];}_0x1ca47d[_0xbb5e('0x1b')](_0x48674e)[_0xbb5e('0x27')](_0x5b8b0b);};}exports[_0xbb5e('0x28')]=function(_0xa1824f,_0x9f293f){var _0x2d6be1={},_0x527f55={},_0x44c9cc={'count':0x0,'rows':[]};var _0x4862a8=_['map'](db[_0xbb5e('0x29')][_0xbb5e('0x2a')],function(_0x3b09b8){return{'name':_0x3b09b8['fieldName'],'type':_0x3b09b8[_0xbb5e('0x2b')][_0xbb5e('0x2c')]};});_0x527f55[_0xbb5e('0x2d')]=_[_0xbb5e('0x2e')](_0x4862a8,_0xbb5e('0x26'));_0x527f55['query']=_[_0xbb5e('0x2f')](_0xa1824f[_0xbb5e('0x30')]);_0x527f55[_0xbb5e('0x31')]=_[_0xbb5e('0x32')](_0x527f55[_0xbb5e('0x2d')],_0x527f55[_0xbb5e('0x30')]);_0x2d6be1[_0xbb5e('0x33')]=_['intersection'](_0x527f55[_0xbb5e('0x2d')],qs[_0xbb5e('0x34')](_0xa1824f[_0xbb5e('0x30')]['fields']));_0x2d6be1[_0xbb5e('0x33')]=_0x2d6be1[_0xbb5e('0x33')][_0xbb5e('0x35')]?_0x2d6be1[_0xbb5e('0x33')]:_0x527f55['model'];if(!_0xa1824f[_0xbb5e('0x30')]['hasOwnProperty']('nolimit')){_0x2d6be1[_0xbb5e('0x1f')]=qs['limit'](_0xa1824f['query'][_0xbb5e('0x1f')]);_0x2d6be1['offset']=qs[_0xbb5e('0x1e')](_0xa1824f[_0xbb5e('0x30')][_0xbb5e('0x1e')]);}_0x2d6be1[_0xbb5e('0x36')]=qs[_0xbb5e('0x37')](_0xa1824f[_0xbb5e('0x30')][_0xbb5e('0x37')]);_0x2d6be1[_0xbb5e('0x38')]=qs[_0xbb5e('0x31')](_[_0xbb5e('0x39')](_0xa1824f[_0xbb5e('0x30')],_0x527f55['filters']),_0x4862a8);if(_0xa1824f['query']['filter']){_0x2d6be1[_0xbb5e('0x38')]=_[_0xbb5e('0x3a')](_0x2d6be1[_0xbb5e('0x38')],{'$or':_['map'](_0x4862a8,function(_0x560184){if(_0x560184['type']!==_0xbb5e('0x3b')){var _0x5d4ebb={};_0x5d4ebb[_0x560184['name']]={'$like':'%'+_0xa1824f[_0xbb5e('0x30')][_0xbb5e('0x3c')]+'%'};return _0x5d4ebb;}})});}_0x2d6be1=_[_0xbb5e('0x3a')]({},_0x2d6be1,_0xa1824f[_0xbb5e('0x3d')]);var _0x12f373={'where':_0x2d6be1[_0xbb5e('0x38')]};return db['SmsQueueReport'][_0xbb5e('0x20')](_0x12f373)[_0xbb5e('0x24')](function(_0x3f723e){_0x44c9cc[_0xbb5e('0x20')]=_0x3f723e;if(_0xa1824f[_0xbb5e('0x30')][_0xbb5e('0x3e')]){_0x2d6be1[_0xbb5e('0x3f')]=[{'all':!![]}];}return db[_0xbb5e('0x29')][_0xbb5e('0x40')](_0x2d6be1);})[_0xbb5e('0x24')](function(_0x27c1bc){_0x44c9cc[_0xbb5e('0x41')]=_0x27c1bc;return _0x44c9cc;})['then'](respondWithFilteredResult(_0x9f293f,_0x2d6be1))['catch'](handleError(_0x9f293f,null));};exports['show']=function(_0x423eda,_0xaa4215){var _0x3b887d={'raw':!![],'where':{'id':_0x423eda[_0xbb5e('0x42')]['id']}},_0x5bab39={};_0x5bab39[_0xbb5e('0x2d')]=_[_0xbb5e('0x2f')](db[_0xbb5e('0x29')][_0xbb5e('0x2a')]);_0x5bab39[_0xbb5e('0x30')]=_[_0xbb5e('0x2f')](_0x423eda[_0xbb5e('0x30')]);_0x5bab39['filters']=_[_0xbb5e('0x32')](_0x5bab39['model'],_0x5bab39[_0xbb5e('0x30')]);_0x3b887d['attributes']=_[_0xbb5e('0x32')](_0x5bab39[_0xbb5e('0x2d')],qs[_0xbb5e('0x34')](_0x423eda[_0xbb5e('0x30')][_0xbb5e('0x34')]));_0x3b887d['attributes']=_0x3b887d[_0xbb5e('0x33')][_0xbb5e('0x35')]?_0x3b887d[_0xbb5e('0x33')]:_0x5bab39[_0xbb5e('0x2d')];if(_0x423eda[_0xbb5e('0x30')][_0xbb5e('0x3e')]){_0x3b887d[_0xbb5e('0x3f')]=[{'all':!![]}];}_0x3b887d=_[_0xbb5e('0x3a')]({},_0x3b887d,_0x423eda['options']);return db[_0xbb5e('0x29')]['find'](_0x3b887d)[_0xbb5e('0x24')](handleEntityNotFound(_0xaa4215,null))[_0xbb5e('0x24')](respondWithResult(_0xaa4215,null))[_0xbb5e('0x43')](handleError(_0xaa4215,null));};exports[_0xbb5e('0x44')]=function(_0x52bff2,_0xa37e5f){return db['SmsQueueReport'][_0xbb5e('0x44')](_0x52bff2['body'],{})[_0xbb5e('0x24')](respondWithResult(_0xa37e5f,0xc9))[_0xbb5e('0x43')](handleError(_0xa37e5f,null));};exports[_0xbb5e('0x45')]=function(_0x141306,_0x5f081c){if(_0x141306[_0xbb5e('0x46')]['id']){delete _0x141306[_0xbb5e('0x46')]['id'];}return db[_0xbb5e('0x29')]['find']({'where':{'id':_0x141306[_0xbb5e('0x42')]['id']}})[_0xbb5e('0x24')](handleEntityNotFound(_0x5f081c,null))[_0xbb5e('0x24')](saveUpdates(_0x141306[_0xbb5e('0x46')],null))['then'](respondWithResult(_0x5f081c,null))[_0xbb5e('0x43')](handleError(_0x5f081c,null));};exports[_0xbb5e('0x47')]=function(_0x32aabe,_0x165478){return db[_0xbb5e('0x29')][_0xbb5e('0x48')]({'where':{'id':_0x32aabe[_0xbb5e('0x42')]['id']}})['then'](handleEntityNotFound(_0x165478,null))['then'](removeEntity(_0x165478,null))[_0xbb5e('0x43')](handleError(_0x165478,null));};exports[_0xbb5e('0x49')]=function(_0x2b2d2a,_0x47f129){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x47f129,null))[_0xbb5e('0x43')](handleError(_0x47f129,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index cd1a044..204ab28 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1289a9,_0x9eba4d){var _0x514cbb=function(_0x3c7d9a){while(--_0x3c7d9a){_0x1289a9['push'](_0x1289a9['shift']());}};_0x514cbb(++_0x9eba4d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 129ff86..0aee20c 100644 --- a/server/api/smsQueueReport/smsQueueReport.rpc.js +++ b/server/api/smsQueueReport/smsQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x145a=['UpdateSmsQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','raw','where','attributes'];(function(_0x3d5d0d,_0x4d1362){var _0x7098a1=function(_0x4b5814){while(--_0x4b5814){_0x3d5d0d['push'](_0x3d5d0d['shift']());}};_0x7098a1(++_0x4d1362);}(_0x145a,0x16c));var _0xa145=function(_0x46e27c,_0x325905){_0x46e27c=_0x46e27c-0x0;var _0x1819b0=_0x145a[_0x46e27c];return _0x1819b0;};'use strict';var _=require(_0xa145('0x0'));var util=require('util');var moment=require(_0xa145('0x1'));var BPromise=require(_0xa145('0x2'));var rs=require(_0xa145('0x3'));var fs=require('fs');var Redis=require(_0xa145('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa145('0x5'));var logger=require(_0xa145('0x6'))(_0xa145('0x7'));var config=require('../../config/environment');var jayson=require(_0xa145('0x8'));var client=jayson['client'][_0xa145('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1747fe,_0x400886,_0x41e93d){return new BPromise(function(_0xfa199e,_0x44e955){return client[_0xa145('0xa')](_0x1747fe,_0x41e93d)[_0xa145('0xb')](function(_0x1f3bdb){logger[_0xa145('0xc')](_0xa145('0xd'),_0x400886,'request\x20sent');logger[_0xa145('0xe')](_0xa145('0xf'),_0x400886,_0xa145('0x10'),JSON[_0xa145('0x11')](_0x1f3bdb));if(_0x1f3bdb[_0xa145('0x12')]){if(_0x1f3bdb[_0xa145('0x12')][_0xa145('0x13')]===0x1f4){logger[_0xa145('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x400886,_0x1f3bdb['error'][_0xa145('0x14')]);return _0x44e955(_0x1f3bdb[_0xa145('0x12')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x400886,_0x1f3bdb[_0xa145('0x12')][_0xa145('0x14')]);return _0xfa199e(_0x1f3bdb[_0xa145('0x12')][_0xa145('0x14')]);}else{logger[_0xa145('0xc')](_0xa145('0xd'),_0x400886,'request\x20sent');_0xfa199e(_0x1f3bdb[_0xa145('0x15')][_0xa145('0x14')]);}})[_0xa145('0x16')](function(_0xa6dbc9){logger[_0xa145('0x12')](_0xa145('0xd'),_0x400886,_0xa6dbc9);_0x44e955(_0xa6dbc9);});});}exports[_0xa145('0x17')]=function(_0x39e459){var _0x35956a=this;return new Promise(function(_0xddb30a,_0x228968){return db[_0xa145('0x18')][_0xa145('0x19')](_0x39e459[_0xa145('0x1a')],{'raw':_0x39e459[_0xa145('0x1b')]?_0x39e459['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x46fa49){logger[_0xa145('0xc')]('CreateSmsQueueReport',_0x39e459);logger[_0xa145('0xe')](_0xa145('0x17'),_0x39e459,JSON['stringify'](_0x46fa49));_0xddb30a(_0x46fa49);})[_0xa145('0x16')](function(_0x30515b){logger[_0xa145('0x12')](_0xa145('0x17'),_0x30515b[_0xa145('0x14')],_0x39e459);_0x228968(_0x35956a[_0xa145('0x12')](0x1f4,_0x30515b[_0xa145('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x1702e3){var _0x145cd9=this;return new Promise(function(_0x3bfc4f,_0x1e419f){return db[_0xa145('0x18')][_0xa145('0x1c')](_0x1702e3['body'],{'raw':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1e')]||null:null,'attributes':_0x1702e3[_0xa145('0x1b')]?_0x1702e3[_0xa145('0x1b')][_0xa145('0x1f')]||null:null,'limit':_0x1702e3['options']?_0x1702e3[_0xa145('0x1b')]['limit']||null:null})[_0xa145('0xb')](function(_0x1fe318){logger['info'](_0xa145('0x20'),_0x1702e3);logger[_0xa145('0xe')]('UpdateSmsQueueReport',_0x1702e3,JSON['stringify'](_0x1fe318));_0x3bfc4f(_0x1fe318);})[_0xa145('0x16')](function(_0x3ff781){logger['error'](_0xa145('0x20'),_0x3ff781[_0xa145('0x14')],_0x1702e3);_0x1e419f(_0x145cd9[_0xa145('0x12')](0x1f4,_0x3ff781[_0xa145('0x14')]));});});}; \ No newline at end of file +var _0xd267=['info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then','UpdateSmsQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x42639d,_0x2d1f80){var _0x390dff=function(_0x1c742f){while(--_0x1c742f){_0x42639d['push'](_0x42639d['shift']());}};_0x390dff(++_0x2d1f80);}(_0xd267,0xb5));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d26('0x0'));var util=require(_0x7d26('0x1'));var moment=require(_0x7d26('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d26('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d26('0x5'));var config=require(_0x7d26('0x6'));var jayson=require(_0x7d26('0x7'));var client=jayson[_0x7d26('0x8')][_0x7d26('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fb5c9,_0x1673a2,_0x4367d3){return new BPromise(function(_0x30b326,_0x4648a0){return client[_0x7d26('0xa')](_0x1fb5c9,_0x4367d3)['then'](function(_0x28c2bd){logger[_0x7d26('0xb')](_0x7d26('0xc'),_0x1673a2,'request\x20sent');logger[_0x7d26('0xd')](_0x7d26('0xe'),_0x1673a2,_0x7d26('0xf'),JSON[_0x7d26('0x10')](_0x28c2bd));if(_0x28c2bd[_0x7d26('0x11')]){if(_0x28c2bd[_0x7d26('0x11')]['code']===0x1f4){logger[_0x7d26('0x11')](_0x7d26('0xc'),_0x1673a2,_0x28c2bd['error'][_0x7d26('0x12')]);return _0x4648a0(_0x28c2bd[_0x7d26('0x11')][_0x7d26('0x12')]);}logger[_0x7d26('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1673a2,_0x28c2bd['error']['message']);return _0x30b326(_0x28c2bd[_0x7d26('0x11')][_0x7d26('0x12')]);}else{logger[_0x7d26('0xb')](_0x7d26('0xc'),_0x1673a2,'request\x20sent');_0x30b326(_0x28c2bd['result'][_0x7d26('0x12')]);}})[_0x7d26('0x13')](function(_0x571756){logger[_0x7d26('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1673a2,_0x571756);_0x4648a0(_0x571756);});});}exports[_0x7d26('0x14')]=function(_0x15acfc){var _0x5579c9=this;return new Promise(function(_0x2a8372,_0x1463e5){return db[_0x7d26('0x15')][_0x7d26('0x16')](_0x15acfc['body'],{'raw':_0x15acfc[_0x7d26('0x17')]?_0x15acfc['options'][_0x7d26('0x18')]===undefined?!![]:![]:!![]})[_0x7d26('0x19')](function(_0x443801){logger['info']('CreateSmsQueueReport',_0x15acfc);logger[_0x7d26('0xd')](_0x7d26('0x14'),_0x15acfc,JSON[_0x7d26('0x10')](_0x443801));_0x2a8372(_0x443801);})[_0x7d26('0x13')](function(_0x1e16bd){logger[_0x7d26('0x11')](_0x7d26('0x14'),_0x1e16bd[_0x7d26('0x12')],_0x15acfc);_0x1463e5(_0x5579c9[_0x7d26('0x11')](0x1f4,_0x1e16bd['message']));});});};exports[_0x7d26('0x1a')]=function(_0x3224cc){var _0x4639ef=this;return new Promise(function(_0x337fb0,_0x1b1167){return db['SmsQueueReport'][_0x7d26('0x1b')](_0x3224cc[_0x7d26('0x1c')],{'raw':_0x3224cc[_0x7d26('0x17')]?_0x3224cc['options'][_0x7d26('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3224cc[_0x7d26('0x17')]?_0x3224cc[_0x7d26('0x17')][_0x7d26('0x1d')]||null:null,'attributes':_0x3224cc[_0x7d26('0x17')]?_0x3224cc['options'][_0x7d26('0x1e')]||null:null,'limit':_0x3224cc[_0x7d26('0x17')]?_0x3224cc[_0x7d26('0x17')][_0x7d26('0x1f')]||null:null})['then'](function(_0x4bc29c){logger[_0x7d26('0xb')](_0x7d26('0x1a'),_0x3224cc);logger['debug'](_0x7d26('0x1a'),_0x3224cc,JSON[_0x7d26('0x10')](_0x4bc29c));_0x337fb0(_0x4bc29c);})[_0x7d26('0x13')](function(_0x467159){logger[_0x7d26('0x11')](_0x7d26('0x1a'),_0x467159[_0x7d26('0x12')],_0x3224cc);_0x1b1167(_0x4639ef[_0x7d26('0x11')](0x1f4,_0x467159[_0x7d26('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d5fbe5f..33e3ad4 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61a5=['describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x61a5,0xf0));var _0x561a=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x61a5[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./smsTransferReport.controller');router[_0x561a('0x8')]('/',auth[_0x561a('0x9')](),controller[_0x561a('0xa')]);router[_0x561a('0x8')](_0x561a('0xb'),auth[_0x561a('0x9')](),controller[_0x561a('0xc')]);router['get'](_0x561a('0xd'),auth['isAuthenticated'](),controller[_0x561a('0xe')]);router[_0x561a('0xf')]('/',auth['isAuthenticated'](),controller[_0x561a('0x10')]);router[_0x561a('0x11')]('/:id',auth[_0x561a('0x9')](),controller['update']);router[_0x561a('0x12')](_0x561a('0xd'),auth[_0x561a('0x9')](),controller[_0x561a('0x13')]);module[_0x561a('0x14')]=router; \ No newline at end of file +var _0x2b83=['/describe','describe','/:id','put','update','util','path','express','Router','fs-extra','../../config/environment','./smsTransferReport.controller','isAuthenticated','get'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x2b83,0x1d3));var _0x32b8=function(_0x3fef8d,_0x4f56f5){_0x3fef8d=_0x3fef8d-0x0;var _0x534b33=_0x2b83[_0x3fef8d];return _0x534b33;};'use strict';var multer=require('multer');var util=require(_0x32b8('0x0'));var path=require(_0x32b8('0x1'));var timeout=require('connect-timeout');var express=require(_0x32b8('0x2'));var router=express[_0x32b8('0x3')]();var fs_extra=require(_0x32b8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32b8('0x5'));var controller=require(_0x32b8('0x6'));router['get']('/',auth[_0x32b8('0x7')](),controller['index']);router[_0x32b8('0x8')](_0x32b8('0x9'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xa')]);router['get'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['show']);router['post']('/',auth[_0x32b8('0x7')](),controller['create']);router[_0x32b8('0xc')](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller[_0x32b8('0xd')]);router['delete'](_0x32b8('0xb'),auth[_0x32b8('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5c4b479..e2270b3 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2e47c1,_0x1bed12){var _0x1a0364=function(_0x12cf22){while(--_0x12cf22){_0x2e47c1['push'](_0x2e47c1['shift']());}};_0x1a0364(++_0x1bed12);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x90cba6,_0x3c97d3){var _0x500b97=function(_0x2b6263){while(--_0x2b6263){_0x90cba6['push'](_0x90cba6['shift']());}};_0x500b97(++_0x3c97d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index deaf803..6ac7fc1 100644 --- a/server/api/smsTransferReport/smsTransferReport.controller.js +++ b/server/api/smsTransferReport/smsTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f72=['VIRTUAL','merge','options','include','findAll','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5236eb,_0x4093f0){var _0x193085=function(_0x49176d){while(--_0x49176d){_0x5236eb['push'](_0x5236eb['shift']());}};_0x193085(++_0x4093f0);}(_0x0f72,0x1d5));var _0x20f7=function(_0x1a4a14,_0x34a5df){_0x1a4a14=_0x1a4a14-0x0;var _0x506897=_0x0f72[_0x1a4a14];return _0x506897;};'use strict';var emlformat=require(_0x20f7('0x0'));var rimraf=require(_0x20f7('0x1'));var zipdir=require(_0x20f7('0x2'));var jsonpatch=require(_0x20f7('0x3'));var rp=require(_0x20f7('0x4'));var moment=require(_0x20f7('0x5'));var BPromise=require(_0x20f7('0x6'));var Mustache=require(_0x20f7('0x7'));var util=require('util');var path=require(_0x20f7('0x8'));var sox=require(_0x20f7('0x9'));var csv=require(_0x20f7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20f7('0xb'));var _=require('lodash');var squel=require(_0x20f7('0xc'));var crypto=require(_0x20f7('0xd'));var jsforce=require(_0x20f7('0xe'));var deskjs=require(_0x20f7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x20f7('0x10'));var Papa=require(_0x20f7('0x11'));var Redis=require(_0x20f7('0x12'));var authService=require(_0x20f7('0x13'));var qs=require(_0x20f7('0x14'));var as=require(_0x20f7('0x15'));var hardwareService=require(_0x20f7('0x16'));var logger=require(_0x20f7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x20f7('0x18'));var licenseUtil=require(_0x20f7('0x19'));var db=require(_0x20f7('0x1a'))['db'];function respondWithStatusCode(_0x4914a4,_0x1aee03){_0x1aee03=_0x1aee03||0xcc;return function(_0x4f365e){if(_0x4f365e){return _0x4914a4[_0x20f7('0x1b')](_0x1aee03);}return _0x4914a4[_0x20f7('0x1c')](_0x1aee03)['end']();};}function respondWithResult(_0x577197,_0xf1efee){_0xf1efee=_0xf1efee||0xc8;return function(_0x4d9643){if(_0x4d9643){return _0x577197[_0x20f7('0x1c')](_0xf1efee)['json'](_0x4d9643);}};}function respondWithFilteredResult(_0x5bf075,_0x5c82f2){return function(_0x702920){if(_0x702920){var _0x4682ef=typeof _0x5c82f2[_0x20f7('0x1d')]===_0x20f7('0x1e')&&typeof _0x5c82f2[_0x20f7('0x1f')]===_0x20f7('0x1e');var _0x162459=_0x702920[_0x20f7('0x20')];var _0x453018=_0x4682ef?0x0:_0x5c82f2[_0x20f7('0x1d')];var _0x2b17ea=_0x4682ef?_0x702920['count']:_0x5c82f2[_0x20f7('0x1d')]+_0x5c82f2[_0x20f7('0x1f')];var _0x3ac1d8;if(_0x2b17ea>=_0x162459){_0x2b17ea=_0x162459;_0x3ac1d8=0xc8;}else{_0x3ac1d8=0xce;}_0x5bf075[_0x20f7('0x1c')](_0x3ac1d8);return _0x5bf075[_0x20f7('0x21')]('Content-Range',_0x453018+'-'+_0x2b17ea+'/'+_0x162459)['json'](_0x702920);}return null;};}function patchUpdates(_0x127361){return function(_0x112ae6){try{jsonpatch[_0x20f7('0x22')](_0x112ae6,_0x127361,!![]);}catch(_0x1398f0){return BPromise[_0x20f7('0x23')](_0x1398f0);}return _0x112ae6['save']();};}function saveUpdates(_0x1e8421,_0x3aba7f){return function(_0x3d1b34){if(_0x3d1b34){return _0x3d1b34[_0x20f7('0x24')](_0x1e8421)[_0x20f7('0x25')](function(_0x405917){return _0x405917;});}return null;};}function removeEntity(_0x4201f3,_0x419357){return function(_0x275bf4){if(_0x275bf4){return _0x275bf4[_0x20f7('0x26')]()[_0x20f7('0x25')](function(){_0x4201f3[_0x20f7('0x1c')](0xcc)[_0x20f7('0x27')]();});}};}function handleEntityNotFound(_0x4e72a9,_0xe0aad4){return function(_0x163856){if(!_0x163856){_0x4e72a9[_0x20f7('0x1b')](0x194);}return _0x163856;};}function handleError(_0x424d79,_0x33adbc){_0x33adbc=_0x33adbc||0x1f4;return function(_0x3d4beb){logger[_0x20f7('0x28')](_0x3d4beb[_0x20f7('0x29')]);if(_0x3d4beb[_0x20f7('0x2a')]){delete _0x3d4beb[_0x20f7('0x2a')];}_0x424d79[_0x20f7('0x1c')](_0x33adbc)[_0x20f7('0x2b')](_0x3d4beb);};}exports[_0x20f7('0x2c')]=function(_0x3074b7,_0x61f293){var _0x2b8590={},_0x43f0bf={},_0x5a892b={'count':0x0,'rows':[]};var _0x1ff865=_[_0x20f7('0x2d')](db[_0x20f7('0x2e')][_0x20f7('0x2f')],function(_0x635d1d){return{'name':_0x635d1d[_0x20f7('0x30')],'type':_0x635d1d[_0x20f7('0x31')]['key']};});_0x43f0bf[_0x20f7('0x32')]=_['map'](_0x1ff865,_0x20f7('0x2a'));_0x43f0bf[_0x20f7('0x33')]=_['keys'](_0x3074b7[_0x20f7('0x33')]);_0x43f0bf['filters']=_[_0x20f7('0x34')](_0x43f0bf['model'],_0x43f0bf[_0x20f7('0x33')]);_0x2b8590[_0x20f7('0x35')]=_[_0x20f7('0x34')](_0x43f0bf[_0x20f7('0x32')],qs[_0x20f7('0x36')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x36')]));_0x2b8590[_0x20f7('0x35')]=_0x2b8590['attributes'][_0x20f7('0x37')]?_0x2b8590[_0x20f7('0x35')]:_0x43f0bf[_0x20f7('0x32')];if(!_0x3074b7[_0x20f7('0x33')]['hasOwnProperty'](_0x20f7('0x38'))){_0x2b8590['limit']=qs[_0x20f7('0x1f')](_0x3074b7[_0x20f7('0x33')]['limit']);_0x2b8590[_0x20f7('0x1d')]=qs[_0x20f7('0x1d')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x1d')]);}_0x2b8590[_0x20f7('0x39')]=qs[_0x20f7('0x3a')](_0x3074b7[_0x20f7('0x33')][_0x20f7('0x3a')]);_0x2b8590[_0x20f7('0x3b')]=qs[_0x20f7('0x3c')](_[_0x20f7('0x3d')](_0x3074b7[_0x20f7('0x33')],_0x43f0bf[_0x20f7('0x3c')]),_0x1ff865);if(_0x3074b7['query'][_0x20f7('0x3e')]){_0x2b8590[_0x20f7('0x3b')]=_['merge'](_0x2b8590[_0x20f7('0x3b')],{'$or':_[_0x20f7('0x2d')](_0x1ff865,function(_0x2743a8){if(_0x2743a8[_0x20f7('0x31')]!==_0x20f7('0x3f')){var _0x2c01cc={};_0x2c01cc[_0x2743a8[_0x20f7('0x2a')]]={'$like':'%'+_0x3074b7[_0x20f7('0x33')]['filter']+'%'};return _0x2c01cc;}})});}_0x2b8590=_[_0x20f7('0x40')]({},_0x2b8590,_0x3074b7[_0x20f7('0x41')]);var _0x19a201={'where':_0x2b8590['where']};return db[_0x20f7('0x2e')][_0x20f7('0x20')](_0x19a201)[_0x20f7('0x25')](function(_0xdb4465){_0x5a892b[_0x20f7('0x20')]=_0xdb4465;if(_0x3074b7[_0x20f7('0x33')]['includeAll']){_0x2b8590[_0x20f7('0x42')]=[{'all':!![]}];}return db[_0x20f7('0x2e')][_0x20f7('0x43')](_0x2b8590);})[_0x20f7('0x25')](function(_0x5ca700){_0x5a892b['rows']=_0x5ca700;return _0x5a892b;})[_0x20f7('0x25')](respondWithFilteredResult(_0x61f293,_0x2b8590))['catch'](handleError(_0x61f293,null));};exports[_0x20f7('0x44')]=function(_0x5e3f40,_0x14588a){var _0x28c977={'raw':!![],'where':{'id':_0x5e3f40[_0x20f7('0x45')]['id']}},_0x2f3bf2={};_0x2f3bf2['model']=_[_0x20f7('0x46')](db[_0x20f7('0x2e')][_0x20f7('0x2f')]);_0x2f3bf2[_0x20f7('0x33')]=_[_0x20f7('0x46')](_0x5e3f40[_0x20f7('0x33')]);_0x2f3bf2[_0x20f7('0x3c')]=_[_0x20f7('0x34')](_0x2f3bf2['model'],_0x2f3bf2[_0x20f7('0x33')]);_0x28c977[_0x20f7('0x35')]=_[_0x20f7('0x34')](_0x2f3bf2[_0x20f7('0x32')],qs[_0x20f7('0x36')](_0x5e3f40[_0x20f7('0x33')][_0x20f7('0x36')]));_0x28c977[_0x20f7('0x35')]=_0x28c977[_0x20f7('0x35')][_0x20f7('0x37')]?_0x28c977[_0x20f7('0x35')]:_0x2f3bf2['model'];if(_0x5e3f40['query']['includeAll']){_0x28c977[_0x20f7('0x42')]=[{'all':!![]}];}_0x28c977=_[_0x20f7('0x40')]({},_0x28c977,_0x5e3f40[_0x20f7('0x41')]);return db['SmsTransferReport'][_0x20f7('0x47')](_0x28c977)[_0x20f7('0x25')](handleEntityNotFound(_0x14588a,null))[_0x20f7('0x25')](respondWithResult(_0x14588a,null))[_0x20f7('0x48')](handleError(_0x14588a,null));};exports[_0x20f7('0x49')]=function(_0x4abec5,_0x5554f9){return db[_0x20f7('0x2e')][_0x20f7('0x49')](_0x4abec5[_0x20f7('0x4a')],{})[_0x20f7('0x25')](respondWithResult(_0x5554f9,0xc9))['catch'](handleError(_0x5554f9,null));};exports[_0x20f7('0x24')]=function(_0x25543c,_0x1e02a8){if(_0x25543c['body']['id']){delete _0x25543c[_0x20f7('0x4a')]['id'];}return db['SmsTransferReport'][_0x20f7('0x47')]({'where':{'id':_0x25543c['params']['id']}})[_0x20f7('0x25')](handleEntityNotFound(_0x1e02a8,null))[_0x20f7('0x25')](saveUpdates(_0x25543c[_0x20f7('0x4a')],null))[_0x20f7('0x25')](respondWithResult(_0x1e02a8,null))[_0x20f7('0x48')](handleError(_0x1e02a8,null));};exports[_0x20f7('0x26')]=function(_0x15919a,_0x406a66){return db[_0x20f7('0x2e')]['find']({'where':{'id':_0x15919a['params']['id']}})['then'](handleEntityNotFound(_0x406a66,null))[_0x20f7('0x25')](removeEntity(_0x406a66,null))['catch'](handleError(_0x406a66,null));};exports['describe']=function(_0x44f8ea,_0x551123){return db[_0x20f7('0x2e')][_0x20f7('0x4b')]()['then'](respondWithResult(_0x551123,null))['catch'](handleError(_0x551123,null));}; \ No newline at end of file +var _0xb80c=['hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','SmsTransferReport','findAll','rows','catch','show','params','keys','merge','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length'];(function(_0x2255f9,_0x3dcfb2){var _0x202f8f=function(_0x4aed51){while(--_0x4aed51){_0x2255f9['push'](_0x2255f9['shift']());}};_0x202f8f(++_0x3dcfb2);}(_0xb80c,0xb4));var _0xcb80=function(_0x2c9db1,_0x212e84){_0x2c9db1=_0x2c9db1-0x0;var _0x727ff=_0xb80c[_0x2c9db1];return _0x727ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcb80('0x0'));var zipdir=require(_0xcb80('0x1'));var jsonpatch=require(_0xcb80('0x2'));var rp=require(_0xcb80('0x3'));var moment=require(_0xcb80('0x4'));var BPromise=require(_0xcb80('0x5'));var Mustache=require(_0xcb80('0x6'));var util=require(_0xcb80('0x7'));var path=require(_0xcb80('0x8'));var sox=require(_0xcb80('0x9'));var csv=require(_0xcb80('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb80('0xb'));var _=require('lodash');var squel=require(_0xcb80('0xc'));var crypto=require(_0xcb80('0xd'));var jsforce=require(_0xcb80('0xe'));var deskjs=require(_0xcb80('0xf'));var toCsv=require(_0xcb80('0xa'));var querystring=require(_0xcb80('0x10'));var Papa=require(_0xcb80('0x11'));var Redis=require(_0xcb80('0x12'));var authService=require(_0xcb80('0x13'));var qs=require(_0xcb80('0x14'));var as=require(_0xcb80('0x15'));var hardwareService=require(_0xcb80('0x16'));var logger=require(_0xcb80('0x17'))(_0xcb80('0x18'));var utils=require(_0xcb80('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcb80('0x1a'));var db=require(_0xcb80('0x1b'))['db'];function respondWithStatusCode(_0x1dc95c,_0x2d4d7a){_0x2d4d7a=_0x2d4d7a||0xcc;return function(_0x7c4ccf){if(_0x7c4ccf){return _0x1dc95c[_0xcb80('0x1c')](_0x2d4d7a);}return _0x1dc95c[_0xcb80('0x1d')](_0x2d4d7a)[_0xcb80('0x1e')]();};}function respondWithResult(_0x2cc524,_0x44bd7e){_0x44bd7e=_0x44bd7e||0xc8;return function(_0x48a477){if(_0x48a477){return _0x2cc524[_0xcb80('0x1d')](_0x44bd7e)['json'](_0x48a477);}};}function respondWithFilteredResult(_0x536a58,_0x5f0340){return function(_0xbe7b46){if(_0xbe7b46){var _0x16ed39=typeof _0x5f0340[_0xcb80('0x1f')]===_0xcb80('0x20')&&typeof _0x5f0340['limit']==='undefined';var _0x57026e=_0xbe7b46[_0xcb80('0x21')];var _0x4603b4=_0x16ed39?0x0:_0x5f0340[_0xcb80('0x1f')];var _0x4e401c=_0x16ed39?_0xbe7b46['count']:_0x5f0340[_0xcb80('0x1f')]+_0x5f0340['limit'];var _0x40d5f4;if(_0x4e401c>=_0x57026e){_0x4e401c=_0x57026e;_0x40d5f4=0xc8;}else{_0x40d5f4=0xce;}_0x536a58['status'](_0x40d5f4);return _0x536a58['set'](_0xcb80('0x22'),_0x4603b4+'-'+_0x4e401c+'/'+_0x57026e)['json'](_0xbe7b46);}return null;};}function patchUpdates(_0x2beedb){return function(_0x49030e){try{jsonpatch[_0xcb80('0x23')](_0x49030e,_0x2beedb,!![]);}catch(_0x563d67){return BPromise[_0xcb80('0x24')](_0x563d67);}return _0x49030e[_0xcb80('0x25')]();};}function saveUpdates(_0x365e4b,_0x125e09){return function(_0x1cfa26){if(_0x1cfa26){return _0x1cfa26['update'](_0x365e4b)[_0xcb80('0x26')](function(_0x2a1793){return _0x2a1793;});}return null;};}function removeEntity(_0x4b4a80,_0x547687){return function(_0x58287c){if(_0x58287c){return _0x58287c['destroy']()[_0xcb80('0x26')](function(){_0x4b4a80['status'](0xcc)[_0xcb80('0x1e')]();});}};}function handleEntityNotFound(_0x527565,_0x32d825){return function(_0x590726){if(!_0x590726){_0x527565[_0xcb80('0x1c')](0x194);}return _0x590726;};}function handleError(_0x577c4b,_0x1c1c59){_0x1c1c59=_0x1c1c59||0x1f4;return function(_0x298b85){logger[_0xcb80('0x27')](_0x298b85[_0xcb80('0x28')]);if(_0x298b85[_0xcb80('0x29')]){delete _0x298b85[_0xcb80('0x29')];}_0x577c4b['status'](_0x1c1c59)[_0xcb80('0x2a')](_0x298b85);};}exports[_0xcb80('0x2b')]=function(_0x320bc6,_0x225afd){var _0x16acfc={},_0x6722ad={},_0x1a18d0={'count':0x0,'rows':[]};var _0x897d03=_['map'](db['SmsTransferReport'][_0xcb80('0x2c')],function(_0x2b0c02){return{'name':_0x2b0c02['fieldName'],'type':_0x2b0c02[_0xcb80('0x2d')][_0xcb80('0x2e')]};});_0x6722ad[_0xcb80('0x2f')]=_[_0xcb80('0x30')](_0x897d03,_0xcb80('0x29'));_0x6722ad[_0xcb80('0x31')]=_['keys'](_0x320bc6[_0xcb80('0x31')]);_0x6722ad['filters']=_['intersection'](_0x6722ad[_0xcb80('0x2f')],_0x6722ad[_0xcb80('0x31')]);_0x16acfc['attributes']=_[_0xcb80('0x32')](_0x6722ad[_0xcb80('0x2f')],qs[_0xcb80('0x33')](_0x320bc6[_0xcb80('0x31')]['fields']));_0x16acfc[_0xcb80('0x34')]=_0x16acfc[_0xcb80('0x34')][_0xcb80('0x35')]?_0x16acfc[_0xcb80('0x34')]:_0x6722ad[_0xcb80('0x2f')];if(!_0x320bc6['query'][_0xcb80('0x36')]('nolimit')){_0x16acfc['limit']=qs[_0xcb80('0x37')](_0x320bc6[_0xcb80('0x31')]['limit']);_0x16acfc[_0xcb80('0x1f')]=qs[_0xcb80('0x1f')](_0x320bc6['query'][_0xcb80('0x1f')]);}_0x16acfc[_0xcb80('0x38')]=qs['sort'](_0x320bc6[_0xcb80('0x31')][_0xcb80('0x39')]);_0x16acfc[_0xcb80('0x3a')]=qs[_0xcb80('0x3b')](_[_0xcb80('0x3c')](_0x320bc6[_0xcb80('0x31')],_0x6722ad[_0xcb80('0x3b')]),_0x897d03);if(_0x320bc6[_0xcb80('0x31')][_0xcb80('0x3d')]){_0x16acfc['where']=_['merge'](_0x16acfc[_0xcb80('0x3a')],{'$or':_['map'](_0x897d03,function(_0x5afd03){if(_0x5afd03['type']!==_0xcb80('0x3e')){var _0x3f6e81={};_0x3f6e81[_0x5afd03[_0xcb80('0x29')]]={'$like':'%'+_0x320bc6[_0xcb80('0x31')][_0xcb80('0x3d')]+'%'};return _0x3f6e81;}})});}_0x16acfc=_['merge']({},_0x16acfc,_0x320bc6['options']);var _0x42ff4d={'where':_0x16acfc[_0xcb80('0x3a')]};return db['SmsTransferReport'][_0xcb80('0x21')](_0x42ff4d)['then'](function(_0xf20935){_0x1a18d0[_0xcb80('0x21')]=_0xf20935;if(_0x320bc6['query'][_0xcb80('0x3f')]){_0x16acfc[_0xcb80('0x40')]=[{'all':!![]}];}return db[_0xcb80('0x41')][_0xcb80('0x42')](_0x16acfc);})['then'](function(_0x22744c){_0x1a18d0[_0xcb80('0x43')]=_0x22744c;return _0x1a18d0;})[_0xcb80('0x26')](respondWithFilteredResult(_0x225afd,_0x16acfc))[_0xcb80('0x44')](handleError(_0x225afd,null));};exports[_0xcb80('0x45')]=function(_0x20024d,_0x514738){var _0x425511={'raw':!![],'where':{'id':_0x20024d[_0xcb80('0x46')]['id']}},_0x5ab66={};_0x5ab66['model']=_[_0xcb80('0x47')](db['SmsTransferReport'][_0xcb80('0x2c')]);_0x5ab66['query']=_[_0xcb80('0x47')](_0x20024d[_0xcb80('0x31')]);_0x5ab66[_0xcb80('0x3b')]=_['intersection'](_0x5ab66['model'],_0x5ab66[_0xcb80('0x31')]);_0x425511[_0xcb80('0x34')]=_[_0xcb80('0x32')](_0x5ab66[_0xcb80('0x2f')],qs[_0xcb80('0x33')](_0x20024d['query'][_0xcb80('0x33')]));_0x425511[_0xcb80('0x34')]=_0x425511['attributes'][_0xcb80('0x35')]?_0x425511[_0xcb80('0x34')]:_0x5ab66[_0xcb80('0x2f')];if(_0x20024d[_0xcb80('0x31')][_0xcb80('0x3f')]){_0x425511[_0xcb80('0x40')]=[{'all':!![]}];}_0x425511=_[_0xcb80('0x48')]({},_0x425511,_0x20024d['options']);return db[_0xcb80('0x41')][_0xcb80('0x49')](_0x425511)[_0xcb80('0x26')](handleEntityNotFound(_0x514738,null))[_0xcb80('0x26')](respondWithResult(_0x514738,null))[_0xcb80('0x44')](handleError(_0x514738,null));};exports[_0xcb80('0x4a')]=function(_0x170ffb,_0x4039ff){return db[_0xcb80('0x41')][_0xcb80('0x4a')](_0x170ffb[_0xcb80('0x4b')],{})[_0xcb80('0x26')](respondWithResult(_0x4039ff,0xc9))['catch'](handleError(_0x4039ff,null));};exports['update']=function(_0x5b7d51,_0x3ef891){if(_0x5b7d51[_0xcb80('0x4b')]['id']){delete _0x5b7d51[_0xcb80('0x4b')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x5b7d51['params']['id']}})[_0xcb80('0x26')](handleEntityNotFound(_0x3ef891,null))[_0xcb80('0x26')](saveUpdates(_0x5b7d51[_0xcb80('0x4b')],null))[_0xcb80('0x26')](respondWithResult(_0x3ef891,null))[_0xcb80('0x44')](handleError(_0x3ef891,null));};exports[_0xcb80('0x4c')]=function(_0x3050b2,_0x48fd29){return db[_0xcb80('0x41')]['find']({'where':{'id':_0x3050b2[_0xcb80('0x46')]['id']}})[_0xcb80('0x26')](handleEntityNotFound(_0x48fd29,null))['then'](removeEntity(_0x48fd29,null))[_0xcb80('0x44')](handleError(_0x48fd29,null));};exports[_0xcb80('0x4d')]=function(_0x7b75f0,_0x6dd639){return db[_0xcb80('0x41')][_0xcb80('0x4d')]()[_0xcb80('0x26')](respondWithResult(_0x6dd639,null))['catch'](handleError(_0x6dd639,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 74d1fcc..aeb6446 100644 --- a/server/api/smsTransferReport/smsTransferReport.model.js +++ b/server/api/smsTransferReport/smsTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbda9=['api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x54fff0,_0x5146fe){var _0x1b5524=function(_0x1f4ad6){while(--_0x1f4ad6){_0x54fff0['push'](_0x54fff0['shift']());}};_0x1b5524(++_0x5146fe);}(_0xbda9,0x101));var _0x9bda=function(_0x5db7f2,_0x3d4bc9){_0x5db7f2=_0x5db7f2-0x0;var _0x1bacf9=_0xbda9[_0x5db7f2];return _0x1bacf9;};'use strict';var _=require(_0x9bda('0x0'));var util=require(_0x9bda('0x1'));var logger=require(_0x9bda('0x2'))(_0x9bda('0x3'));var moment=require(_0x9bda('0x4'));var BPromise=require(_0x9bda('0x5'));var rp=require(_0x9bda('0x6'));var fs=require('fs');var path=require(_0x9bda('0x7'));var rimraf=require(_0x9bda('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bda('0x9'));module[_0x9bda('0xa')]=function(_0x26544e,_0x4d2979){return _0x26544e[_0x9bda('0xb')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x9bda('0xc'),'fields':[_0x9bda('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d01=['../../config/environment','./smsTransferReport.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5bd3a5,_0x1acdb3){var _0x6284df=function(_0x6e7eb5){while(--_0x6e7eb5){_0x5bd3a5['push'](_0x5bd3a5['shift']());}};_0x6284df(++_0x1acdb3);}(_0x1d01,0xb7));var _0x11d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11d0('0x0'));var util=require(_0x11d0('0x1'));var logger=require(_0x11d0('0x2'))(_0x11d0('0x3'));var moment=require(_0x11d0('0x4'));var BPromise=require(_0x11d0('0x5'));var rp=require(_0x11d0('0x6'));var fs=require('fs');var path=require(_0x11d0('0x7'));var rimraf=require(_0x11d0('0x8'));var config=require(_0x11d0('0x9'));var attributes=require(_0x11d0('0xa'));module[_0x11d0('0xb')]=function(_0x3617ab,_0x56d9c5){return _0x3617ab['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index eb35c88..33a6a86 100644 --- a/server/api/smsTransferReport/smsTransferReport.rpc.js +++ b/server/api/smsTransferReport/smsTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9b9=['debug','stringify','code','SmsTransferReport,\x20%s,\x20%s','error','message','result','catch','moment','bluebird','randomstring','rpc','http','request','then','info','request\x20sent'];(function(_0x18227e,_0x30cd35){var _0x3954e6=function(_0x1fe980){while(--_0x1fe980){_0x18227e['push'](_0x18227e['shift']());}};_0x3954e6(++_0x30cd35);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xc9b9[_0x3598bb];return _0x13c837;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c9b('0x0'));var BPromise=require(_0x9c9b('0x1'));var rs=require(_0x9c9b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c9b('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9c9b('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x15d94b,_0x13060c,_0x193305){return new BPromise(function(_0xbbd998,_0x5e0081){return client[_0x9c9b('0x5')](_0x15d94b,_0x193305)[_0x9c9b('0x6')](function(_0x2a2178){logger[_0x9c9b('0x7')]('SmsTransferReport,\x20%s,\x20%s',_0x13060c,_0x9c9b('0x8'));logger[_0x9c9b('0x9')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x13060c,_0x9c9b('0x8'),JSON[_0x9c9b('0xa')](_0x2a2178));if(_0x2a2178['error']){if(_0x2a2178['error'][_0x9c9b('0xb')]===0x1f4){logger['error'](_0x9c9b('0xc'),_0x13060c,_0x2a2178[_0x9c9b('0xd')]['message']);return _0x5e0081(_0x2a2178['error']['message']);}logger['error'](_0x9c9b('0xc'),_0x13060c,_0x2a2178[_0x9c9b('0xd')]['message']);return _0xbbd998(_0x2a2178[_0x9c9b('0xd')][_0x9c9b('0xe')]);}else{logger['info'](_0x9c9b('0xc'),_0x13060c,_0x9c9b('0x8'));_0xbbd998(_0x2a2178[_0x9c9b('0xf')][_0x9c9b('0xe')]);}})[_0x9c9b('0x10')](function(_0x299221){logger[_0x9c9b('0xd')](_0x9c9b('0xc'),_0x13060c,_0x299221);_0x5e0081(_0x299221);});});} \ No newline at end of file +var _0xfb82=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x3d7d77,_0x481e20){var _0x1cd6de=function(_0x43efc1){while(--_0x43efc1){_0x3d7d77['push'](_0x3d7d77['shift']());}};_0x1cd6de(++_0x481e20);}(_0xfb82,0x17f));var _0x2fb8=function(_0x75c9ed,_0x2cac8e){_0x75c9ed=_0x75c9ed-0x0;var _0x905135=_0xfb82[_0x75c9ed];return _0x905135;};'use strict';var _=require(_0x2fb8('0x0'));var util=require(_0x2fb8('0x1'));var moment=require(_0x2fb8('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fb8('0x3'));var fs=require('fs');var Redis=require(_0x2fb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fb8('0x5'));var logger=require(_0x2fb8('0x6'))(_0x2fb8('0x7'));var config=require(_0x2fb8('0x8'));var jayson=require(_0x2fb8('0x9'));var client=jayson[_0x2fb8('0xa')][_0x2fb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8ede42,_0x420bec,_0x1f7575){return new BPromise(function(_0x5d58fa,_0xf3961c){return client[_0x2fb8('0xc')](_0x8ede42,_0x1f7575)[_0x2fb8('0xd')](function(_0x29be44){logger[_0x2fb8('0xe')](_0x2fb8('0xf'),_0x420bec,_0x2fb8('0x10'));logger[_0x2fb8('0x11')](_0x2fb8('0x12'),_0x420bec,_0x2fb8('0x10'),JSON[_0x2fb8('0x13')](_0x29be44));if(_0x29be44['error']){if(_0x29be44[_0x2fb8('0x14')][_0x2fb8('0x15')]===0x1f4){logger[_0x2fb8('0x14')](_0x2fb8('0xf'),_0x420bec,_0x29be44['error']['message']);return _0xf3961c(_0x29be44[_0x2fb8('0x14')]['message']);}logger[_0x2fb8('0x14')](_0x2fb8('0xf'),_0x420bec,_0x29be44['error'][_0x2fb8('0x16')]);return _0x5d58fa(_0x29be44[_0x2fb8('0x14')]['message']);}else{logger['info'](_0x2fb8('0xf'),_0x420bec,_0x2fb8('0x10'));_0x5d58fa(_0x29be44[_0x2fb8('0x17')][_0x2fb8('0x16')]);}})['catch'](function(_0x3fda1b){logger[_0x2fb8('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x420bec,_0x3fda1b);_0xf3961c(_0x3fda1b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 744c4b3..76335e3 100644 --- a/server/api/sound/index.js +++ b/server/api/sound/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb39d=['format','extname','now','post','single','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace'];(function(_0x486e6f,_0x395450){var _0x104212=function(_0x368754){while(--_0x368754){_0x486e6f['push'](_0x486e6f['shift']());}};_0x104212(++_0x395450);}(_0xb39d,0x81));var _0xdb39=function(_0x10d358,_0x594e73){_0x10d358=_0x10d358-0x0;var _0x549c73=_0xb39d[_0x10d358];return _0x549c73;};'use strict';var multer=require('multer');var util=require(_0xdb39('0x0'));var path=require(_0xdb39('0x1'));var timeout=require(_0xdb39('0x2'));var express=require(_0xdb39('0x3'));var router=express[_0xdb39('0x4')]();var fs_extra=require(_0xdb39('0x5'));var auth=require(_0xdb39('0x6'));var interaction=require(_0xdb39('0x7'));var config=require(_0xdb39('0x8'));var controller=require(_0xdb39('0x9'));router[_0xdb39('0xa')]('/',auth[_0xdb39('0xb')](),controller[_0xdb39('0xc')]);router[_0xdb39('0xa')](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller['show']);router[_0xdb39('0xa')](_0xdb39('0xe'),auth[_0xdb39('0xb')](),controller[_0xdb39('0xf')]);var upload=multer({'storage':multer[_0xdb39('0x10')]({'destination':function(_0x19d79c,_0x957cd9,_0x61886d){_0x61886d(null,path['join'](config[_0xdb39('0x11')],_0xdb39('0x12')));},'filename':function(_0x6dadd1,_0x2ac5c2,_0x595332){_0x2ac5c2[_0xdb39('0x13')]=_0x2ac5c2[_0xdb39('0x13')][_0xdb39('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x595332(null,util[_0xdb39('0x15')]('%s-%s%s',path['basename'](_0x2ac5c2[_0xdb39('0x13')],path[_0xdb39('0x16')](_0x2ac5c2[_0xdb39('0x13')])),Date[_0xdb39('0x17')](),path[_0xdb39('0x16')](_0x2ac5c2['originalname'])));}})});router[_0xdb39('0x18')]('/',upload[_0xdb39('0x19')]('file'),controller[_0xdb39('0x1a')]);router['put'](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller[_0xdb39('0x1b')]);router[_0xdb39('0x1c')](_0xdb39('0xd'),auth[_0xdb39('0xb')](),controller[_0xdb39('0x1c')]);module[_0xdb39('0x1d')]=router; \ No newline at end of file +var _0x92ad=['originalname','replace','format','%s-%s%s','basename','now','extname','post','single','create','put','/:id','update','delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','root','server/files/sounds/original/'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x92ad,0x159));var _0xd92a=function(_0x4468a0,_0x474c14){_0x4468a0=_0x4468a0-0x0;var _0x5e6338=_0x92ad[_0x4468a0];return _0x5e6338;};'use strict';var multer=require(_0xd92a('0x0'));var util=require(_0xd92a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd92a('0x2'));var router=express[_0xd92a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd92a('0x4'));var config=require(_0xd92a('0x5'));var controller=require(_0xd92a('0x6'));router[_0xd92a('0x7')]('/',auth[_0xd92a('0x8')](),controller[_0xd92a('0x9')]);router[_0xd92a('0x7')]('/:id',auth[_0xd92a('0x8')](),controller[_0xd92a('0xa')]);router[_0xd92a('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xd92a('0xb')]);var upload=multer({'storage':multer[_0xd92a('0xc')]({'destination':function(_0x55520a,_0x37b9f7,_0x5bb50a){_0x5bb50a(null,path['join'](config[_0xd92a('0xd')],_0xd92a('0xe')));},'filename':function(_0x33e4fb,_0x5eda13,_0x4e2ac1){_0x5eda13[_0xd92a('0xf')]=_0x5eda13[_0xd92a('0xf')][_0xd92a('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4e2ac1(null,util[_0xd92a('0x11')](_0xd92a('0x12'),path[_0xd92a('0x13')](_0x5eda13[_0xd92a('0xf')],path['extname'](_0x5eda13[_0xd92a('0xf')])),Date[_0xd92a('0x14')](),path[_0xd92a('0x15')](_0x5eda13[_0xd92a('0xf')])));}})});router[_0xd92a('0x16')]('/',upload[_0xd92a('0x17')]('file'),controller[_0xd92a('0x18')]);router[_0xd92a('0x19')](_0xd92a('0x1a'),auth['isAuthenticated'](),controller[_0xd92a('0x1b')]);router[_0xd92a('0x1c')]('/:id',auth[_0xd92a('0x8')](),controller[_0xd92a('0x1c')]);module[_0xd92a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b159b78..f2f4b93 100644 --- a/server/api/sound/sound.attributes.js +++ b/server/api/sound/sound.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d8d=['FLOAT','BIGINT','INTEGER','sequelize','exports','STRING','name'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x592238,_0xc8ff1e){_0x592238=_0x592238-0x0;var _0x4bdf33=_0x0d8d[_0x592238];return _0x4bdf33;};'use strict';var Sequelize=require(_0xd0d8('0x0'));module[_0xd0d8('0x1')]={'name':{'type':Sequelize[_0xd0d8('0x2')],'unique':_0xd0d8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd0d8('0x2')]},'display_name':{'type':Sequelize[_0xd0d8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd0d8('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xd0d8('0x4')]},'original_sampleCount':{'type':Sequelize[_0xd0d8('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xd0d8('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd0d8('0x5')]},'converted_channelCount':{'type':Sequelize[_0xd0d8('0x6')]},'converted_bitRate':{'type':Sequelize[_0xd0d8('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xd0d8('0x6')]}}; \ No newline at end of file +var _0x461d=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x47c934,_0x1f623d){var _0x11e2db=function(_0x5f1ec3){while(--_0x5f1ec3){_0x47c934['push'](_0x47c934['shift']());}};_0x11e2db(++_0x1f623d);}(_0x461d,0x1b7));var _0xd461=function(_0x27fcfe,_0x450aee){_0x27fcfe=_0x27fcfe-0x0;var _0x59219a=_0x461d[_0x27fcfe];return _0x59219a;};'use strict';var Sequelize=require(_0xd461('0x0'));module[_0xd461('0x1')]={'name':{'type':Sequelize[_0xd461('0x2')],'unique':_0xd461('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd461('0x2')]},'display_name':{'type':Sequelize[_0xd461('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xd461('0x2')]},'original_format':{'type':Sequelize[_0xd461('0x2')]},'original_duration':{'type':Sequelize[_0xd461('0x4')]},'original_sampleCount':{'type':Sequelize[_0xd461('0x5')]},'original_channelCount':{'type':Sequelize[_0xd461('0x6')]},'original_bitRate':{'type':Sequelize[_0xd461('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xd461('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xd461('0x5')]},'converted_channelCount':{'type':Sequelize[_0xd461('0x6')]},'converted_bitRate':{'type':Sequelize[_0xd461('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xd461('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 75e092b..04ee0d4 100644 --- a/server/api/sound/sound.controller.js +++ b/server/api/sound/sound.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa7a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','name','merge','options','Sound','rows','catch','show','params','keys','length','includeAll','include','find','download','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','create','file','originalname','basename','filename','extname','substring','wav','root','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','transcode','error','unlinkSync','send','src','original_duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','server/files/sounds/original','original_format','end','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','fs-extra','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x13eec2,_0xe78b42){var _0x46c367=function(_0x3f399a){while(--_0x3f399a){_0x13eec2['push'](_0x13eec2['shift']());}};_0x46c367(++_0xe78b42);}(_0xaa7a,0x16b));var _0xaaa7=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xaa7a[_0x22b68a];return _0x1ac67a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaa7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaaa7('0x1'));var rp=require(_0xaaa7('0x2'));var moment=require(_0xaaa7('0x3'));var BPromise=require(_0xaaa7('0x4'));var Mustache=require(_0xaaa7('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaaa7('0x6'));var _=require('lodash');var squel=require(_0xaaa7('0x7'));var crypto=require(_0xaaa7('0x8'));var jsforce=require(_0xaaa7('0x9'));var deskjs=require(_0xaaa7('0xa'));var toCsv=require(_0xaaa7('0xb'));var querystring=require(_0xaaa7('0xc'));var Papa=require(_0xaaa7('0xd'));var Redis=require(_0xaaa7('0xe'));var authService=require(_0xaaa7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaaa7('0x10'));var hardwareService=require(_0xaaa7('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xaaa7('0x12'));var config=require(_0xaaa7('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357c63,_0x429298){_0x429298=_0x429298||0xcc;return function(_0x4ab0f1){if(_0x4ab0f1){return _0x357c63[_0xaaa7('0x14')](_0x429298);}return _0x357c63[_0xaaa7('0x15')](_0x429298)['end']();};}function respondWithResult(_0x2e504c,_0x2bb079){_0x2bb079=_0x2bb079||0xc8;return function(_0x48c383){if(_0x48c383){return _0x2e504c['status'](_0x2bb079)[_0xaaa7('0x16')](_0x48c383);}};}function respondWithFilteredResult(_0x3537a2,_0x2f8898){return function(_0x29537d){if(_0x29537d){var _0xcb49f6=typeof _0x2f8898[_0xaaa7('0x17')]===_0xaaa7('0x18')&&typeof _0x2f8898[_0xaaa7('0x19')]===_0xaaa7('0x18');var _0xbc148d=_0x29537d[_0xaaa7('0x1a')];var _0x429357=_0xcb49f6?0x0:_0x2f8898[_0xaaa7('0x17')];var _0x319cb0=_0xcb49f6?_0x29537d['count']:_0x2f8898['offset']+_0x2f8898[_0xaaa7('0x19')];var _0x21b9e8;if(_0x319cb0>=_0xbc148d){_0x319cb0=_0xbc148d;_0x21b9e8=0xc8;}else{_0x21b9e8=0xce;}_0x3537a2[_0xaaa7('0x15')](_0x21b9e8);return _0x3537a2[_0xaaa7('0x1b')](_0xaaa7('0x1c'),_0x429357+'-'+_0x319cb0+'/'+_0xbc148d)[_0xaaa7('0x16')](_0x29537d);}return null;};}function patchUpdates(_0xcd904c){return function(_0x332cbf){try{jsonpatch[_0xaaa7('0x1d')](_0x332cbf,_0xcd904c,!![]);}catch(_0x304301){return BPromise[_0xaaa7('0x1e')](_0x304301);}return _0x332cbf[_0xaaa7('0x1f')]();};}function saveUpdates(_0x3c984f,_0xe9e0cb){return function(_0x4063cc){if(_0x4063cc){return _0x4063cc['update'](_0x3c984f)[_0xaaa7('0x20')](function(_0x55eaf9){return _0x55eaf9;});}return null;};}function removeEntity(_0x45250d,_0x422e66){return function(_0x3f5fb5){if(_0x3f5fb5){return _0x3f5fb5[_0xaaa7('0x21')]()[_0xaaa7('0x20')](function(){var _0x545314=_0x3f5fb5[_0xaaa7('0x22')]({'plain':!![]});var _0x1e6f54='Sounds';return db['UserProfileResource'][_0xaaa7('0x21')]({'where':{'type':_0x1e6f54,'resourceId':_0x545314['id']}})[_0xaaa7('0x20')](function(){return _0x3f5fb5;});})[_0xaaa7('0x20')](function(){_0x45250d[_0xaaa7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db12a,_0x324f35){return function(_0x13077e){if(!_0x13077e){_0x2db12a[_0xaaa7('0x14')](0x194);}return _0x13077e;};}function handleError(_0x1114da,_0x4a8d68){_0x4a8d68=_0x4a8d68||0x1f4;return function(_0x457686){logger['error'](_0x457686['stack']);if(_0x457686['name']){delete _0x457686['name'];}_0x1114da[_0xaaa7('0x15')](_0x4a8d68)['send'](_0x457686);};}exports['index']=function(_0xb30f0b,_0x403054){var _0x134e74={},_0xb038ad={},_0x5a3d66={'count':0x0,'rows':[]};var _0xcf6447=_[_0xaaa7('0x23')](db['Sound'][_0xaaa7('0x24')],function(_0x58ff8b){return{'name':_0x58ff8b['fieldName'],'type':_0x58ff8b[_0xaaa7('0x25')][_0xaaa7('0x26')]};});_0xb038ad[_0xaaa7('0x27')]=_[_0xaaa7('0x23')](_0xcf6447,'name');_0xb038ad[_0xaaa7('0x28')]=_['keys'](_0xb30f0b[_0xaaa7('0x28')]);_0xb038ad[_0xaaa7('0x29')]=_['intersection'](_0xb038ad[_0xaaa7('0x27')],_0xb038ad[_0xaaa7('0x28')]);_0x134e74[_0xaaa7('0x2a')]=_[_0xaaa7('0x2b')](_0xb038ad['model'],qs[_0xaaa7('0x2c')](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x2c')]));_0x134e74[_0xaaa7('0x2a')]=_0x134e74[_0xaaa7('0x2a')]['length']?_0x134e74['attributes']:_0xb038ad['model'];if(!_0xb30f0b['query'][_0xaaa7('0x2d')](_0xaaa7('0x2e'))){_0x134e74['limit']=qs[_0xaaa7('0x19')](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x19')]);_0x134e74['offset']=qs['offset'](_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x17')]);}_0x134e74['order']=qs[_0xaaa7('0x2f')](_0xb30f0b[_0xaaa7('0x28')]['sort']);_0x134e74[_0xaaa7('0x30')]=qs['filters'](_['pick'](_0xb30f0b[_0xaaa7('0x28')],_0xb038ad[_0xaaa7('0x29')]),_0xcf6447);if(_0xb30f0b['query'][_0xaaa7('0x31')]){_0x134e74['where']=_['merge'](_0x134e74['where'],{'$or':_[_0xaaa7('0x23')](_0xcf6447,function(_0x3d8000){if(_0x3d8000[_0xaaa7('0x25')]!==_0xaaa7('0x32')){var _0x280a7f={};_0x280a7f[_0x3d8000[_0xaaa7('0x33')]]={'$like':'%'+_0xb30f0b[_0xaaa7('0x28')][_0xaaa7('0x31')]+'%'};return _0x280a7f;}})});}_0x134e74=_[_0xaaa7('0x34')]({},_0x134e74,_0xb30f0b[_0xaaa7('0x35')]);var _0x12694e={'where':_0x134e74[_0xaaa7('0x30')]};return db[_0xaaa7('0x36')][_0xaaa7('0x1a')](_0x12694e)[_0xaaa7('0x20')](function(_0x49a6bd){_0x5a3d66['count']=_0x49a6bd;if(_0xb30f0b[_0xaaa7('0x28')]['includeAll']){_0x134e74['include']=[{'all':!![]}];}return db[_0xaaa7('0x36')]['findAll'](_0x134e74);})['then'](function(_0x24ee4c){_0x5a3d66[_0xaaa7('0x37')]=_0x24ee4c;return _0x5a3d66;})[_0xaaa7('0x20')](respondWithFilteredResult(_0x403054,_0x134e74))[_0xaaa7('0x38')](handleError(_0x403054,null));};exports[_0xaaa7('0x39')]=function(_0x10b318,_0x57888a){var _0x14c771={'raw':!![],'where':{'id':_0x10b318[_0xaaa7('0x3a')]['id']}},_0x4fd857={};_0x4fd857[_0xaaa7('0x27')]=_[_0xaaa7('0x3b')](db[_0xaaa7('0x36')]['rawAttributes']);_0x4fd857[_0xaaa7('0x28')]=_[_0xaaa7('0x3b')](_0x10b318[_0xaaa7('0x28')]);_0x4fd857[_0xaaa7('0x29')]=_[_0xaaa7('0x2b')](_0x4fd857[_0xaaa7('0x27')],_0x4fd857[_0xaaa7('0x28')]);_0x14c771[_0xaaa7('0x2a')]=_[_0xaaa7('0x2b')](_0x4fd857[_0xaaa7('0x27')],qs[_0xaaa7('0x2c')](_0x10b318['query'][_0xaaa7('0x2c')]));_0x14c771[_0xaaa7('0x2a')]=_0x14c771[_0xaaa7('0x2a')][_0xaaa7('0x3c')]?_0x14c771[_0xaaa7('0x2a')]:_0x4fd857[_0xaaa7('0x27')];if(_0x10b318[_0xaaa7('0x28')][_0xaaa7('0x3d')]){_0x14c771[_0xaaa7('0x3e')]=[{'all':!![]}];}_0x14c771=_[_0xaaa7('0x34')]({},_0x14c771,_0x10b318[_0xaaa7('0x35')]);return db[_0xaaa7('0x36')][_0xaaa7('0x3f')](_0x14c771)[_0xaaa7('0x20')](handleEntityNotFound(_0x57888a,null))['then'](respondWithResult(_0x57888a,null))['catch'](handleError(_0x57888a,null));};exports[_0xaaa7('0x40')]=function(_0x244c86,_0x387ba0,_0x334e51){return db[_0xaaa7('0x36')][_0xaaa7('0x3f')]({'where':{'id':_0x244c86[_0xaaa7('0x3a')]['id']},'attributes':['name',_0xaaa7('0x41'),_0xaaa7('0x42')],'raw':!![]})[_0xaaa7('0x20')](handleEntityNotFound(_0x387ba0,null))['then'](function(_0xde2a9){if(_0xde2a9){if(!fs[_0xaaa7('0x43')](path['join'](config['root'],_0xaaa7('0x44'),_0xde2a9[_0xaaa7('0x41')]+'.'+_0xde2a9[_0xaaa7('0x42')]))){throw new db[(_0xaaa7('0x45'))][(_0xaaa7('0x46'))](_0xaaa7('0x47'));}return _0x387ba0[_0xaaa7('0x40')](path[_0xaaa7('0x48')](config['root'],_0xaaa7('0x44'),util[_0xaaa7('0x49')]('%s.%s',_0xde2a9[_0xaaa7('0x41')],_0xde2a9[_0xaaa7('0x42')])),util['format']('%s.%s',_0xde2a9['name'],_0xde2a9[_0xaaa7('0x42')]));}return null;})[_0xaaa7('0x38')](handleError(_0x387ba0,null));};exports[_0xaaa7('0x4a')]=function(_0x1ee0ee,_0xf6d5f1,_0x3f704f){var _0x1fca34={'name':path['basename'](_0x1ee0ee[_0xaaa7('0x4b')]['originalname'],path['extname'](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4c')])),'save_name':path[_0xaaa7('0x4d')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')],path[_0xaaa7('0x4f')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')])),'original_format':path[_0xaaa7('0x4f')](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4c')])[_0xaaa7('0x50')](0x1),'converted_format':_0xaaa7('0x51')};var _0x5f7bb6=path[_0xaaa7('0x48')](config['root'],'server/files/sounds/original',_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')]);var _0x3194ef=path[_0xaaa7('0x48')](config[_0xaaa7('0x52')],_0xaaa7('0x44'),util[_0xaaa7('0x49')](_0xaaa7('0x53'),path['basename'](_0x1ee0ee[_0xaaa7('0x4b')][_0xaaa7('0x4e')],path[_0xaaa7('0x4f')](_0x1ee0ee['file']['filename'])),_0x1fca34[_0xaaa7('0x42')]));logger['info'](_0xaaa7('0x54'),_0x5f7bb6);logger[_0xaaa7('0x55')](_0xaaa7('0x56'),_0x3194ef);try{fs['chmodSync'](_0x5f7bb6,parseInt('0777',0x8));var _0x45562c=sox[_0xaaa7('0x57')](_0x5f7bb6,_0x3194ef,{'sampleRate':0x1f40,'format':_0xaaa7('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45562c['on'](_0xaaa7('0x58'),function(_0x12f40c){fs[_0xaaa7('0x59')](_0x5f7bb6);_0xf6d5f1[_0xaaa7('0x15')](0x1f4)[_0xaaa7('0x5a')](_0x12f40c);});_0x45562c['on'](_0xaaa7('0x5b'),function(_0x52f830){_0x1fca34[_0xaaa7('0x5c')]=isNaN(_0x52f830['duration'])?null:_0x52f830['duration']*0x3e8;_0x1fca34[_0xaaa7('0x5d')]=isNaN(_0x52f830[_0xaaa7('0x5e')])?null:_0x52f830[_0xaaa7('0x5e')];_0x1fca34['original_channelCount']=isNaN(_0x52f830[_0xaaa7('0x5f')])?null:_0x52f830[_0xaaa7('0x5f')];_0x1fca34[_0xaaa7('0x60')]=isNaN(_0x52f830[_0xaaa7('0x61')])?null:_0x52f830[_0xaaa7('0x61')];_0x1fca34[_0xaaa7('0x62')]=isNaN(_0x52f830[_0xaaa7('0x63')])?null:_0x52f830[_0xaaa7('0x63')];});_0x45562c['on'](_0xaaa7('0x64'),function(_0x16b9c6){_0x1fca34[_0xaaa7('0x65')]=isNaN(_0x16b9c6[_0xaaa7('0x66')])?null:_0x16b9c6[_0xaaa7('0x66')]*0x3e8;_0x1fca34[_0xaaa7('0x67')]=isNaN(_0x16b9c6[_0xaaa7('0x5e')])?null:_0x16b9c6[_0xaaa7('0x5e')];_0x1fca34['converted_channelCount']=isNaN(_0x16b9c6[_0xaaa7('0x5f')])?null:_0x16b9c6[_0xaaa7('0x5f')];_0x1fca34[_0xaaa7('0x68')]=isNaN(_0x16b9c6['bitRate'])?null:_0x16b9c6[_0xaaa7('0x61')];_0x1fca34[_0xaaa7('0x69')]=isNaN(_0x16b9c6[_0xaaa7('0x63')])?null:_0x16b9c6[_0xaaa7('0x63')];});_0x45562c['on']('end',function(){fs[_0xaaa7('0x6a')](_0x3194ef,parseInt(_0xaaa7('0x6b'),0x8));return db[_0xaaa7('0x36')][_0xaaa7('0x4a')](_0x1fca34)['then'](function(_0x201242){var _0x498f6b={'role':_0x1ee0ee[_0xaaa7('0x6c')][_0xaaa7('0x6d')],'userProfileId':_0x1ee0ee[_0xaaa7('0x6c')][_0xaaa7('0x6e')]};if(!_0x498f6b)throw new Error(_0xaaa7('0x6f'));if(_0x498f6b[_0xaaa7('0x6d')]===_0xaaa7('0x70')){var _0x5f4b49=_0x201242[_0xaaa7('0x22')]({'plain':!![]});return db['UserProfileSection'][_0xaaa7('0x3f')]({'where':{'name':_0xaaa7('0x71'),'userProfileId':_0x498f6b['userProfileId']},'raw':!![]})[_0xaaa7('0x20')](function(_0x23dd13){if(_0x23dd13&&_0x23dd13[_0xaaa7('0x72')]===0x0){return db[_0xaaa7('0x73')][_0xaaa7('0x4a')]({'name':_0x5f4b49[_0xaaa7('0x33')],'resourceId':_0x5f4b49['id'],'type':_0x23dd13[_0xaaa7('0x33')],'sectionId':_0x23dd13['id']},{})['then'](function(){return _0x201242;});}else{return _0x201242;}})[_0xaaa7('0x38')](function(_0x28ad0b){logger[_0xaaa7('0x58')](_0xaaa7('0x74'),_0x28ad0b);throw _0x28ad0b;});}return _0x201242;})['then'](respondWithResult(_0xf6d5f1,null))['catch'](handleError(_0xf6d5f1,null));});_0x45562c[_0xaaa7('0x75')]();}catch(_0x2bd528){_0xf6d5f1['status'](0x1f4)[_0xaaa7('0x5a')](_0x2bd528);}};exports[_0xaaa7('0x76')]=function(_0x32842f,_0x4f6cd0,_0x505930){return db[_0xaaa7('0x36')][_0xaaa7('0x3f')]({'where':{'id':_0x32842f[_0xaaa7('0x3a')]['id']}})[_0xaaa7('0x20')](handleEntityNotFound(_0x4f6cd0,null))[_0xaaa7('0x20')](saveUpdates(_[_0xaaa7('0x77')](_0x32842f[_0xaaa7('0x6c')],[_0xaaa7('0x33'),_0xaaa7('0x78')]),null))[_0xaaa7('0x20')](respondWithResult(_0x4f6cd0,null))[_0xaaa7('0x38')](handleError(_0x4f6cd0,null));};exports[_0xaaa7('0x79')]=function(_0x1267e7,_0xdeda05,_0x3db598){return db[_0xaaa7('0x36')]['find']({'where':{'id':_0x1267e7['params']['id']}})[_0xaaa7('0x20')](function(_0x5f184f){if(_0x5f184f){return _0x5f184f['destroy']();}})[_0xaaa7('0x20')](function(_0x55490c){var _0x2d4c3e=path[_0xaaa7('0x48')](config[_0xaaa7('0x52')],_0xaaa7('0x7a'),util[_0xaaa7('0x49')](_0xaaa7('0x53'),_0x55490c['save_name'],_0x55490c[_0xaaa7('0x7b')]));var _0x53db12=path['join'](config['root'],_0xaaa7('0x44'),util[_0xaaa7('0x49')]('%s.%s',_0x55490c[_0xaaa7('0x41')],_0x55490c[_0xaaa7('0x42')]));fs[_0xaaa7('0x59')](_0x2d4c3e);fs[_0xaaa7('0x59')](_0x53db12);return _0x55490c;})['then'](function(_0x53994d){if(_0x53994d){return _0xdeda05['status'](0xcc)[_0xaaa7('0x7c')]();}})[_0xaaa7('0x20')](handleEntityNotFound(_0xdeda05,null))[_0xaaa7('0x38')](handleError(_0xdeda05,null));}; \ No newline at end of file +var _0x45d7=['merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','%s.%s','format','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','sampleCount','converted_channelCount','converted_sampleRate','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','end','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x3390b2,_0x2e30d8){var _0x3be5e8=function(_0x438b01){while(--_0x438b01){_0x3390b2['push'](_0x3390b2['shift']());}};_0x3be5e8(++_0x2e30d8);}(_0x45d7,0x1c1));var _0x745d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x45d7[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x745d('0x0'));var zipdir=require(_0x745d('0x1'));var jsonpatch=require(_0x745d('0x2'));var rp=require(_0x745d('0x3'));var moment=require(_0x745d('0x4'));var BPromise=require(_0x745d('0x5'));var Mustache=require(_0x745d('0x6'));var util=require(_0x745d('0x7'));var path=require(_0x745d('0x8'));var sox=require('sox');var csv=require(_0x745d('0x9'));var ejs=require(_0x745d('0xa'));var fs=require('fs');var fs_extra=require(_0x745d('0xb'));var _=require(_0x745d('0xc'));var squel=require(_0x745d('0xd'));var crypto=require(_0x745d('0xe'));var jsforce=require(_0x745d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x745d('0x9'));var querystring=require('querystring');var Papa=require(_0x745d('0x10'));var Redis=require(_0x745d('0x11'));var authService=require(_0x745d('0x12'));var qs=require(_0x745d('0x13'));var as=require(_0x745d('0x14'));var hardwareService=require(_0x745d('0x15'));var logger=require(_0x745d('0x16'))(_0x745d('0x17'));var utils=require('../../config/utils');var config=require(_0x745d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139a56,_0x5107cb){_0x5107cb=_0x5107cb||0xcc;return function(_0x5bcb46){if(_0x5bcb46){return _0x139a56[_0x745d('0x19')](_0x5107cb);}return _0x139a56[_0x745d('0x1a')](_0x5107cb)['end']();};}function respondWithResult(_0x41d4cd,_0x4e4303){_0x4e4303=_0x4e4303||0xc8;return function(_0x58dba4){if(_0x58dba4){return _0x41d4cd[_0x745d('0x1a')](_0x4e4303)[_0x745d('0x1b')](_0x58dba4);}};}function respondWithFilteredResult(_0x1c86a2,_0x376686){return function(_0x222d79){if(_0x222d79){var _0x561c30=typeof _0x376686[_0x745d('0x1c')]===_0x745d('0x1d')&&typeof _0x376686['limit']===_0x745d('0x1d');var _0x267910=_0x222d79[_0x745d('0x1e')];var _0x35b0a7=_0x561c30?0x0:_0x376686[_0x745d('0x1c')];var _0x2dbe98=_0x561c30?_0x222d79[_0x745d('0x1e')]:_0x376686[_0x745d('0x1c')]+_0x376686['limit'];var _0x540176;if(_0x2dbe98>=_0x267910){_0x2dbe98=_0x267910;_0x540176=0xc8;}else{_0x540176=0xce;}_0x1c86a2[_0x745d('0x1a')](_0x540176);return _0x1c86a2[_0x745d('0x1f')](_0x745d('0x20'),_0x35b0a7+'-'+_0x2dbe98+'/'+_0x267910)['json'](_0x222d79);}return null;};}function patchUpdates(_0x133826){return function(_0x5e7d59){try{jsonpatch[_0x745d('0x21')](_0x5e7d59,_0x133826,!![]);}catch(_0x1c4ae7){return BPromise[_0x745d('0x22')](_0x1c4ae7);}return _0x5e7d59[_0x745d('0x23')]();};}function saveUpdates(_0x445c3e,_0x39c52a){return function(_0x3a88c6){if(_0x3a88c6){return _0x3a88c6[_0x745d('0x24')](_0x445c3e)['then'](function(_0x43b854){return _0x43b854;});}return null;};}function removeEntity(_0x232185,_0xe5f888){return function(_0x2f78a9){if(_0x2f78a9){return _0x2f78a9['destroy']()[_0x745d('0x25')](function(){var _0x332eec=_0x2f78a9[_0x745d('0x26')]({'plain':!![]});var _0x58bd42=_0x745d('0x27');return db[_0x745d('0x28')][_0x745d('0x29')]({'where':{'type':_0x58bd42,'resourceId':_0x332eec['id']}})[_0x745d('0x25')](function(){return _0x2f78a9;});})[_0x745d('0x25')](function(){_0x232185[_0x745d('0x1a')](0xcc)[_0x745d('0x2a')]();});}};}function handleEntityNotFound(_0x5bd2a2,_0x203001){return function(_0x4a5bfb){if(!_0x4a5bfb){_0x5bd2a2['sendStatus'](0x194);}return _0x4a5bfb;};}function handleError(_0x1bc8d6,_0x308c96){_0x308c96=_0x308c96||0x1f4;return function(_0x4f6fa9){logger[_0x745d('0x2b')](_0x4f6fa9[_0x745d('0x2c')]);if(_0x4f6fa9[_0x745d('0x2d')]){delete _0x4f6fa9[_0x745d('0x2d')];}_0x1bc8d6[_0x745d('0x1a')](_0x308c96)[_0x745d('0x2e')](_0x4f6fa9);};}exports[_0x745d('0x2f')]=function(_0x2c98a9,_0x5d700b){var _0x2fe01a={},_0x467b73={},_0x5967dd={'count':0x0,'rows':[]};var _0x445694=_[_0x745d('0x30')](db[_0x745d('0x31')][_0x745d('0x32')],function(_0x34b24f){return{'name':_0x34b24f[_0x745d('0x33')],'type':_0x34b24f[_0x745d('0x34')]['key']};});_0x467b73['model']=_['map'](_0x445694,_0x745d('0x2d'));_0x467b73[_0x745d('0x35')]=_[_0x745d('0x36')](_0x2c98a9[_0x745d('0x35')]);_0x467b73[_0x745d('0x37')]=_[_0x745d('0x38')](_0x467b73[_0x745d('0x39')],_0x467b73[_0x745d('0x35')]);_0x2fe01a[_0x745d('0x3a')]=_['intersection'](_0x467b73[_0x745d('0x39')],qs[_0x745d('0x3b')](_0x2c98a9[_0x745d('0x35')][_0x745d('0x3b')]));_0x2fe01a[_0x745d('0x3a')]=_0x2fe01a[_0x745d('0x3a')][_0x745d('0x3c')]?_0x2fe01a[_0x745d('0x3a')]:_0x467b73[_0x745d('0x39')];if(!_0x2c98a9[_0x745d('0x35')][_0x745d('0x3d')](_0x745d('0x3e'))){_0x2fe01a['limit']=qs[_0x745d('0x3f')](_0x2c98a9[_0x745d('0x35')][_0x745d('0x3f')]);_0x2fe01a['offset']=qs[_0x745d('0x1c')](_0x2c98a9[_0x745d('0x35')][_0x745d('0x1c')]);}_0x2fe01a[_0x745d('0x40')]=qs[_0x745d('0x41')](_0x2c98a9[_0x745d('0x35')][_0x745d('0x41')]);_0x2fe01a[_0x745d('0x42')]=qs[_0x745d('0x37')](_['pick'](_0x2c98a9['query'],_0x467b73['filters']),_0x445694);if(_0x2c98a9[_0x745d('0x35')]['filter']){_0x2fe01a['where']=_[_0x745d('0x43')](_0x2fe01a['where'],{'$or':_[_0x745d('0x30')](_0x445694,function(_0x398ce6){if(_0x398ce6[_0x745d('0x34')]!==_0x745d('0x44')){var _0x1f5072={};_0x1f5072[_0x398ce6[_0x745d('0x2d')]]={'$like':'%'+_0x2c98a9['query']['filter']+'%'};return _0x1f5072;}})});}_0x2fe01a=_[_0x745d('0x43')]({},_0x2fe01a,_0x2c98a9['options']);var _0xdc3592={'where':_0x2fe01a[_0x745d('0x42')]};return db[_0x745d('0x31')][_0x745d('0x1e')](_0xdc3592)[_0x745d('0x25')](function(_0x2e8c66){_0x5967dd['count']=_0x2e8c66;if(_0x2c98a9[_0x745d('0x35')][_0x745d('0x45')]){_0x2fe01a[_0x745d('0x46')]=[{'all':!![]}];}return db[_0x745d('0x31')]['findAll'](_0x2fe01a);})['then'](function(_0x21afe1){_0x5967dd[_0x745d('0x47')]=_0x21afe1;return _0x5967dd;})[_0x745d('0x25')](respondWithFilteredResult(_0x5d700b,_0x2fe01a))[_0x745d('0x48')](handleError(_0x5d700b,null));};exports[_0x745d('0x49')]=function(_0x3778b0,_0x2ca8f7){var _0x67dcdc={'raw':!![],'where':{'id':_0x3778b0[_0x745d('0x4a')]['id']}},_0x24eb69={};_0x24eb69[_0x745d('0x39')]=_['keys'](db['Sound']['rawAttributes']);_0x24eb69['query']=_[_0x745d('0x36')](_0x3778b0[_0x745d('0x35')]);_0x24eb69[_0x745d('0x37')]=_[_0x745d('0x38')](_0x24eb69[_0x745d('0x39')],_0x24eb69[_0x745d('0x35')]);_0x67dcdc['attributes']=_[_0x745d('0x38')](_0x24eb69['model'],qs[_0x745d('0x3b')](_0x3778b0[_0x745d('0x35')]['fields']));_0x67dcdc[_0x745d('0x3a')]=_0x67dcdc[_0x745d('0x3a')][_0x745d('0x3c')]?_0x67dcdc[_0x745d('0x3a')]:_0x24eb69[_0x745d('0x39')];if(_0x3778b0[_0x745d('0x35')][_0x745d('0x45')]){_0x67dcdc[_0x745d('0x46')]=[{'all':!![]}];}_0x67dcdc=_['merge']({},_0x67dcdc,_0x3778b0[_0x745d('0x4b')]);return db[_0x745d('0x31')][_0x745d('0x4c')](_0x67dcdc)[_0x745d('0x25')](handleEntityNotFound(_0x2ca8f7,null))[_0x745d('0x25')](respondWithResult(_0x2ca8f7,null))[_0x745d('0x48')](handleError(_0x2ca8f7,null));};exports[_0x745d('0x4d')]=function(_0x4171bc,_0x22163a,_0x194a84){return db[_0x745d('0x31')]['find']({'where':{'id':_0x4171bc[_0x745d('0x4a')]['id']},'attributes':[_0x745d('0x2d'),_0x745d('0x4e'),_0x745d('0x4f')],'raw':!![]})[_0x745d('0x25')](handleEntityNotFound(_0x22163a,null))[_0x745d('0x25')](function(_0x283bc0){if(_0x283bc0){if(!fs[_0x745d('0x50')](path[_0x745d('0x51')](config[_0x745d('0x52')],_0x745d('0x53'),_0x283bc0[_0x745d('0x4e')]+'.'+_0x283bc0[_0x745d('0x4f')]))){throw new db['Sequelize'][(_0x745d('0x54'))](_0x745d('0x55'));}return _0x22163a[_0x745d('0x4d')](path['join'](config[_0x745d('0x52')],_0x745d('0x53'),util['format'](_0x745d('0x56'),_0x283bc0['save_name'],_0x283bc0[_0x745d('0x4f')])),util[_0x745d('0x57')](_0x745d('0x56'),_0x283bc0[_0x745d('0x2d')],_0x283bc0[_0x745d('0x4f')]));}return null;})[_0x745d('0x48')](handleError(_0x22163a,null));};exports['create']=function(_0x2b7054,_0x1c9fcd,_0x443e37){var _0x1c2824={'name':path[_0x745d('0x58')](_0x2b7054['file'][_0x745d('0x59')],path[_0x745d('0x5a')](_0x2b7054[_0x745d('0x5b')][_0x745d('0x59')])),'save_name':path[_0x745d('0x58')](_0x2b7054[_0x745d('0x5b')][_0x745d('0x5c')],path[_0x745d('0x5a')](_0x2b7054[_0x745d('0x5b')]['filename'])),'original_format':path['extname'](_0x2b7054[_0x745d('0x5b')][_0x745d('0x59')])[_0x745d('0x5d')](0x1),'converted_format':_0x745d('0x5e')};var _0x92ea48=path[_0x745d('0x51')](config[_0x745d('0x52')],_0x745d('0x5f'),_0x2b7054['file'][_0x745d('0x5c')]);var _0x525146=path[_0x745d('0x51')](config[_0x745d('0x52')],_0x745d('0x53'),util[_0x745d('0x57')]('%s.%s',path[_0x745d('0x58')](_0x2b7054[_0x745d('0x5b')][_0x745d('0x5c')],path[_0x745d('0x5a')](_0x2b7054[_0x745d('0x5b')][_0x745d('0x5c')])),_0x1c2824[_0x745d('0x4f')]));logger[_0x745d('0x60')](_0x745d('0x61'),_0x92ea48);logger[_0x745d('0x60')]('Sound\x20upload\x20destination:\x20%s',_0x525146);try{fs[_0x745d('0x62')](_0x92ea48,parseInt(_0x745d('0x63'),0x8));var _0x21e8b5=sox[_0x745d('0x64')](_0x92ea48,_0x525146,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21e8b5['on']('error',function(_0x121d15){fs[_0x745d('0x65')](_0x92ea48);_0x1c9fcd[_0x745d('0x1a')](0x1f4)['send'](_0x121d15);});_0x21e8b5['on'](_0x745d('0x66'),function(_0x66e432){_0x1c2824[_0x745d('0x67')]=isNaN(_0x66e432[_0x745d('0x68')])?null:_0x66e432[_0x745d('0x68')]*0x3e8;_0x1c2824['original_sampleCount']=isNaN(_0x66e432['sampleCount'])?null:_0x66e432['sampleCount'];_0x1c2824[_0x745d('0x69')]=isNaN(_0x66e432[_0x745d('0x6a')])?null:_0x66e432[_0x745d('0x6a')];_0x1c2824[_0x745d('0x6b')]=isNaN(_0x66e432[_0x745d('0x6c')])?null:_0x66e432[_0x745d('0x6c')];_0x1c2824[_0x745d('0x6d')]=isNaN(_0x66e432[_0x745d('0x6e')])?null:_0x66e432[_0x745d('0x6e')];});_0x21e8b5['on'](_0x745d('0x6f'),function(_0x4e8023){_0x1c2824[_0x745d('0x70')]=isNaN(_0x4e8023[_0x745d('0x68')])?null:_0x4e8023['duration']*0x3e8;_0x1c2824['converted_sampleCount']=isNaN(_0x4e8023[_0x745d('0x71')])?null:_0x4e8023[_0x745d('0x71')];_0x1c2824[_0x745d('0x72')]=isNaN(_0x4e8023[_0x745d('0x6a')])?null:_0x4e8023[_0x745d('0x6a')];_0x1c2824['converted_bitRate']=isNaN(_0x4e8023['bitRate'])?null:_0x4e8023[_0x745d('0x6c')];_0x1c2824[_0x745d('0x73')]=isNaN(_0x4e8023['sampleRate'])?null:_0x4e8023[_0x745d('0x6e')];});_0x21e8b5['on'](_0x745d('0x2a'),function(){fs[_0x745d('0x62')](_0x525146,parseInt(_0x745d('0x63'),0x8));return db[_0x745d('0x31')][_0x745d('0x74')](_0x1c2824)[_0x745d('0x25')](function(_0x301c2b){var _0xf95a3c={'role':_0x2b7054[_0x745d('0x75')][_0x745d('0x76')],'userProfileId':_0x2b7054[_0x745d('0x75')][_0x745d('0x77')]};if(!_0xf95a3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf95a3c['role']===_0x745d('0x78')){var _0x3a1f4c=_0x301c2b[_0x745d('0x26')]({'plain':!![]});return db[_0x745d('0x79')][_0x745d('0x4c')]({'where':{'name':_0x745d('0x27'),'userProfileId':_0xf95a3c[_0x745d('0x77')]},'raw':!![]})['then'](function(_0xf5a77c){if(_0xf5a77c&&_0xf5a77c[_0x745d('0x7a')]===0x0){return db[_0x745d('0x28')][_0x745d('0x74')]({'name':_0x3a1f4c[_0x745d('0x2d')],'resourceId':_0x3a1f4c['id'],'type':_0xf5a77c['name'],'sectionId':_0xf5a77c['id']},{})['then'](function(){return _0x301c2b;});}else{return _0x301c2b;}})['catch'](function(_0x332aaf){logger[_0x745d('0x2b')](_0x745d('0x7b'),_0x332aaf);throw _0x332aaf;});}return _0x301c2b;})[_0x745d('0x25')](respondWithResult(_0x1c9fcd,null))[_0x745d('0x48')](handleError(_0x1c9fcd,null));});_0x21e8b5[_0x745d('0x7c')]();}catch(_0x2418e2){_0x1c9fcd[_0x745d('0x1a')](0x1f4)[_0x745d('0x2e')](_0x2418e2);}};exports['update']=function(_0x33ff06,_0x1368b4,_0x2006d8){return db[_0x745d('0x31')]['find']({'where':{'id':_0x33ff06[_0x745d('0x4a')]['id']}})[_0x745d('0x25')](handleEntityNotFound(_0x1368b4,null))['then'](saveUpdates(_[_0x745d('0x7d')](_0x33ff06[_0x745d('0x75')],[_0x745d('0x2d'),_0x745d('0x7e')]),null))[_0x745d('0x25')](respondWithResult(_0x1368b4,null))[_0x745d('0x48')](handleError(_0x1368b4,null));};exports[_0x745d('0x7f')]=function(_0x2484d3,_0x51923b,_0x47de69){return db['Sound']['find']({'where':{'id':_0x2484d3[_0x745d('0x4a')]['id']}})[_0x745d('0x25')](function(_0x15dac4){if(_0x15dac4){return _0x15dac4['destroy']();}})[_0x745d('0x25')](function(_0x1b43db){var _0x370a45=path[_0x745d('0x51')](config['root'],_0x745d('0x5f'),util[_0x745d('0x57')](_0x745d('0x56'),_0x1b43db['save_name'],_0x1b43db[_0x745d('0x80')]));var _0x39eae7=path[_0x745d('0x51')](config['root'],_0x745d('0x53'),util['format']('%s.%s',_0x1b43db[_0x745d('0x4e')],_0x1b43db[_0x745d('0x4f')]));fs['unlinkSync'](_0x370a45);fs[_0x745d('0x65')](_0x39eae7);return _0x1b43db;})[_0x745d('0x25')](function(_0x54a82c){if(_0x54a82c){return _0x51923b[_0x745d('0x1a')](0xcc)[_0x745d('0x2a')]();}})['then'](handleEntityNotFound(_0x51923b,null))[_0x745d('0x48')](handleError(_0x51923b,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 818f366..d307a94 100644 --- a/server/api/sound/sound.model.js +++ b/server/api/sound/sound.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06b7=['./sound.attributes','define','tools_sounds','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c543d,_0x596974){var _0x2b5fba=function(_0x342124){while(--_0x342124){_0x2c543d['push'](_0x2c543d['shift']());}};_0x2b5fba(++_0x596974);}(_0x06b7,0x117));var _0x706b=function(_0x1530c5,_0x2f67a3){_0x1530c5=_0x1530c5-0x0;var _0x1534d7=_0x06b7[_0x1530c5];return _0x1534d7;};'use strict';var _=require(_0x706b('0x0'));var util=require(_0x706b('0x1'));var logger=require(_0x706b('0x2'))(_0x706b('0x3'));var moment=require('moment');var BPromise=require(_0x706b('0x4'));var rp=require(_0x706b('0x5'));var fs=require('fs');var path=require(_0x706b('0x6'));var rimraf=require(_0x706b('0x7'));var config=require(_0x706b('0x8'));var attributes=require(_0x706b('0x9'));module['exports']=function(_0x24230b,_0x13ca07){return _0x24230b[_0x706b('0xa')]('Sound',attributes,{'tableName':_0x706b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27d3=['tools_sounds','moment','bluebird','path','rimraf','./sound.attributes','exports','define','Sound'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x27d3,0x1de));var _0x327d=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x27d3[_0x243b59];return _0x3e1676;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x327d('0x0'));var BPromise=require(_0x327d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x327d('0x2'));var rimraf=require(_0x327d('0x3'));var config=require('../../config/environment');var attributes=require(_0x327d('0x4'));module[_0x327d('0x5')]=function(_0x579841,_0x58aa0c){return _0x579841[_0x327d('0x6')](_0x327d('0x7'),attributes,{'tableName':_0x327d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 50b853f..76ef959 100644 --- a/server/api/sound/sound.rpc.js +++ b/server/api/sound/sound.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa70f=['error','code','message','result','catch','ShowSound','Sound','find','options','raw','include','model','attributes','map','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x727e40,_0x55c539){var _0x734039=function(_0x1cc794){while(--_0x1cc794){_0x727e40['push'](_0x727e40['shift']());}};_0x734039(++_0x55c539);}(_0xa70f,0x1b2));var _0xfa70=function(_0x4bcc87,_0x30f832){_0x4bcc87=_0x4bcc87-0x0;var _0x3d4dc1=_0xa70f[_0x4bcc87];return _0x3d4dc1;};'use strict';var _=require('lodash');var util=require(_0xfa70('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfa70('0x1'));var fs=require('fs');var Redis=require(_0xfa70('0x2'));var db=require(_0xfa70('0x3'))['db'];var utils=require(_0xfa70('0x4'));var logger=require(_0xfa70('0x5'))(_0xfa70('0x6'));var config=require(_0xfa70('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa70('0x8')][_0xfa70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x454343,_0x29a8fd,_0x5d330b){return new BPromise(function(_0x2f4476,_0x3ee940){return client[_0xfa70('0xa')](_0x454343,_0x5d330b)[_0xfa70('0xb')](function(_0xbb3ee7){logger[_0xfa70('0xc')](_0xfa70('0xd'),_0x29a8fd,_0xfa70('0xe'));logger[_0xfa70('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x29a8fd,_0xfa70('0xe'),JSON['stringify'](_0xbb3ee7));if(_0xbb3ee7[_0xfa70('0x10')]){if(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x11')]===0x1f4){logger[_0xfa70('0x10')](_0xfa70('0xd'),_0x29a8fd,_0xbb3ee7[_0xfa70('0x10')]['message']);return _0x3ee940(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);}logger[_0xfa70('0x10')](_0xfa70('0xd'),_0x29a8fd,_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);return _0x2f4476(_0xbb3ee7[_0xfa70('0x10')][_0xfa70('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x29a8fd,_0xfa70('0xe'));_0x2f4476(_0xbb3ee7[_0xfa70('0x13')][_0xfa70('0x12')]);}})[_0xfa70('0x14')](function(_0x4ed5b7){logger[_0xfa70('0x10')]('Sound,\x20%s,\x20%s',_0x29a8fd,_0x4ed5b7);_0x3ee940(_0x4ed5b7);});});}exports[_0xfa70('0x15')]=function(_0x335ef6){var _0x37e67a=this;return new Promise(function(_0x5cb269,_0x4c7848){return db[_0xfa70('0x16')][_0xfa70('0x17')]({'raw':_0x335ef6['options']?_0x335ef6[_0xfa70('0x18')][_0xfa70('0x19')]===undefined?!![]:![]:!![],'where':_0x335ef6[_0xfa70('0x18')]?_0x335ef6[_0xfa70('0x18')]['where']||null:null,'attributes':_0x335ef6[_0xfa70('0x18')]?_0x335ef6[_0xfa70('0x18')]['attributes']||null:null,'include':_0x335ef6[_0xfa70('0x18')]?_0x335ef6['options'][_0xfa70('0x1a')]?_['map'](_0x335ef6[_0xfa70('0x18')][_0xfa70('0x1a')],function(_0x3252dd){return{'model':db[_0x3252dd[_0xfa70('0x1b')]],'as':_0x3252dd['as'],'attributes':_0x3252dd[_0xfa70('0x1c')],'include':_0x3252dd[_0xfa70('0x1a')]?_[_0xfa70('0x1d')](_0x3252dd[_0xfa70('0x1a')],function(_0x448b71){return{'model':db[_0x448b71[_0xfa70('0x1b')]],'as':_0x448b71['as'],'attributes':_0x448b71[_0xfa70('0x1c')],'include':_0x448b71[_0xfa70('0x1a')]?_[_0xfa70('0x1d')](_0x448b71[_0xfa70('0x1a')],function(_0x2577ef){return{'model':db[_0x2577ef[_0xfa70('0x1b')]],'as':_0x2577ef['as'],'attributes':_0x2577ef[_0xfa70('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfa70('0xb')](function(_0x28070b){logger[_0xfa70('0xc')]('ShowSound',_0x335ef6);logger[_0xfa70('0xf')](_0xfa70('0x15'),_0x335ef6,JSON['stringify'](_0x28070b));_0x5cb269(_0x28070b);})[_0xfa70('0x14')](function(_0x15eed8){logger['error'](_0xfa70('0x15'),_0x15eed8['message'],_0x335ef6);_0x4c7848(_0x37e67a[_0xfa70('0x10')](0x1f4,_0x15eed8[_0xfa70('0x12')]));});});}; \ No newline at end of file +var _0xc2bc=['ShowSound','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','Sound','find','options','raw','where','attributes','map','include','model'];(function(_0x1d3a72,_0x4bc667){var _0x7d7427=function(_0x36455e){while(--_0x36455e){_0x1d3a72['push'](_0x1d3a72['shift']());}};_0x7d7427(++_0x4bc667);}(_0xc2bc,0x1d0));var _0xcc2b=function(_0x410e6b,_0x42af04){_0x410e6b=_0x410e6b-0x0;var _0x51febc=_0xc2bc[_0x410e6b];return _0x51febc;};'use strict';var _=require(_0xcc2b('0x0'));var util=require('util');var moment=require(_0xcc2b('0x1'));var BPromise=require(_0xcc2b('0x2'));var rs=require(_0xcc2b('0x3'));var fs=require('fs');var Redis=require(_0xcc2b('0x4'));var db=require(_0xcc2b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc2b('0x6'));var config=require(_0xcc2b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcc2b('0x8')][_0xcc2b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cc819,_0x7305d6,_0xd7147e){return new BPromise(function(_0x51c8a1,_0x52f561){return client[_0xcc2b('0xa')](_0x4cc819,_0xd7147e)[_0xcc2b('0xb')](function(_0x47f028){logger['info'](_0xcc2b('0xc'),_0x7305d6,_0xcc2b('0xd'));logger[_0xcc2b('0xe')](_0xcc2b('0xf'),_0x7305d6,'request\x20sent',JSON[_0xcc2b('0x10')](_0x47f028));if(_0x47f028[_0xcc2b('0x11')]){if(_0x47f028['error'][_0xcc2b('0x12')]===0x1f4){logger[_0xcc2b('0x11')](_0xcc2b('0xc'),_0x7305d6,_0x47f028[_0xcc2b('0x11')][_0xcc2b('0x13')]);return _0x52f561(_0x47f028['error']['message']);}logger['error'](_0xcc2b('0xc'),_0x7305d6,_0x47f028['error']['message']);return _0x51c8a1(_0x47f028[_0xcc2b('0x11')][_0xcc2b('0x13')]);}else{logger[_0xcc2b('0x14')]('Sound,\x20%s,\x20%s',_0x7305d6,_0xcc2b('0xd'));_0x51c8a1(_0x47f028[_0xcc2b('0x15')]['message']);}})['catch'](function(_0x800fab){logger[_0xcc2b('0x11')]('Sound,\x20%s,\x20%s',_0x7305d6,_0x800fab);_0x52f561(_0x800fab);});});}exports['ShowSound']=function(_0x77da5d){var _0x4b7197=this;return new Promise(function(_0x2ab31d,_0x382db9){return db[_0xcc2b('0x16')][_0xcc2b('0x17')]({'raw':_0x77da5d[_0xcc2b('0x18')]?_0x77da5d[_0xcc2b('0x18')][_0xcc2b('0x19')]===undefined?!![]:![]:!![],'where':_0x77da5d[_0xcc2b('0x18')]?_0x77da5d[_0xcc2b('0x18')][_0xcc2b('0x1a')]||null:null,'attributes':_0x77da5d[_0xcc2b('0x18')]?_0x77da5d[_0xcc2b('0x18')][_0xcc2b('0x1b')]||null:null,'include':_0x77da5d['options']?_0x77da5d['options']['include']?_[_0xcc2b('0x1c')](_0x77da5d[_0xcc2b('0x18')]['include'],function(_0x26cd9b){return{'model':db[_0x26cd9b['model']],'as':_0x26cd9b['as'],'attributes':_0x26cd9b[_0xcc2b('0x1b')],'include':_0x26cd9b[_0xcc2b('0x1d')]?_['map'](_0x26cd9b[_0xcc2b('0x1d')],function(_0x23c7d8){return{'model':db[_0x23c7d8['model']],'as':_0x23c7d8['as'],'attributes':_0x23c7d8[_0xcc2b('0x1b')],'include':_0x23c7d8['include']?_[_0xcc2b('0x1c')](_0x23c7d8[_0xcc2b('0x1d')],function(_0x4ba370){return{'model':db[_0x4ba370[_0xcc2b('0x1e')]],'as':_0x4ba370['as'],'attributes':_0x4ba370[_0xcc2b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc2b('0xb')](function(_0x1c2da5){logger[_0xcc2b('0x14')](_0xcc2b('0x1f'),_0x77da5d);logger[_0xcc2b('0xe')](_0xcc2b('0x1f'),_0x77da5d,JSON['stringify'](_0x1c2da5));_0x2ab31d(_0x1c2da5);})[_0xcc2b('0x20')](function(_0x32c890){logger[_0xcc2b('0x11')]('ShowSound',_0x32c890[_0xcc2b('0x13')],_0x77da5d);_0x382db9(_0x4b7197[_0xcc2b('0x11')](0x1f4,_0x32c890[_0xcc2b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e38543a..13dd1ec 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0x4fc2,0x111));var _0x24fc=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x4fc2[_0x5c883f];return _0x4210cc;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x14d250,_0x4b2e12){var _0xb991d8=function(_0x4ea76d){while(--_0x4ea76d){_0x14d250['push'](_0x14d250['shift']());}};_0xb991d8(++_0x4b2e12);}(_0x8603,0x190));var _0x3860=function(_0x32f093,_0x658e1a){_0x32f093=_0x32f093-0x0;var _0x1b8fb2=_0x8603[_0x32f093];return _0x1b8fb2;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e83395e..45c274b 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd25=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xdd25,0x178));var _0x5dd2=function(_0x425ff3,_0x53a7f6){_0x425ff3=_0x425ff3-0x0;var _0x56f85c=_0xdd25[_0x425ff3];return _0x56f85c;};'use strict';var Sequelize=require('sequelize');module[_0x5dd2('0x0')]={'uniqueid':{'type':Sequelize[_0x5dd2('0x1')]},'body':{'type':Sequelize[_0x5dd2('0x2')](_0x5dd2('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5dd2('0x4')]('in','out'),'defaultValue':_0x5dd2('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5dd2('0x1')]},'providerResponse':{'type':Sequelize[_0x5dd2('0x2')]}}; \ No newline at end of file +var _0xae37=['medium','out','exports','TEXT'];(function(_0x42595c,_0xe3a233){var _0x1ce878=function(_0x18608b){while(--_0x18608b){_0x42595c['push'](_0x42595c['shift']());}};_0x1ce878(++_0xe3a233);}(_0xae37,0x72));var _0x7ae3=function(_0x366028,_0x33ec1d){_0x366028=_0x366028-0x0;var _0x2577be=_0xae37[_0x366028];return _0x2577be;};'use strict';var Sequelize=require('sequelize');module[_0x7ae3('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x7ae3('0x1')](_0x7ae3('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7ae3('0x3')),'defaultValue':_0x7ae3('0x3'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7ae3('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 89fcf31..3d7b7bc 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc674=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort'];(function(_0x4cb92e,_0x2d7349){var _0x3378c8=function(_0x32e43c){while(--_0x32e43c){_0x4cb92e['push'](_0x4cb92e['shift']());}};_0x3378c8(++_0x2d7349);}(_0xc674,0xe8));var _0x4c67=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xc674[_0x277721];return _0x286051;};'use strict';var emlformat=require(_0x4c67('0x0'));var rimraf=require(_0x4c67('0x1'));var zipdir=require(_0x4c67('0x2'));var jsonpatch=require(_0x4c67('0x3'));var rp=require(_0x4c67('0x4'));var moment=require(_0x4c67('0x5'));var BPromise=require(_0x4c67('0x6'));var Mustache=require('mustache');var util=require(_0x4c67('0x7'));var path=require('path');var sox=require(_0x4c67('0x8'));var csv=require(_0x4c67('0x9'));var ejs=require(_0x4c67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c67('0xb'));var crypto=require(_0x4c67('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c67('0x9'));var querystring=require(_0x4c67('0xd'));var Papa=require('papaparse');var Redis=require(_0x4c67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4c67('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c67('0x10'));var logger=require(_0x4c67('0x11'))(_0x4c67('0x12'));var utils=require(_0x4c67('0x13'));var config=require(_0x4c67('0x14'));var licenseUtil=require(_0x4c67('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d87b,_0x46d3b0){_0x46d3b0=_0x46d3b0||0xcc;return function(_0x382563){if(_0x382563){return _0x13d87b['sendStatus'](_0x46d3b0);}return _0x13d87b['status'](_0x46d3b0)[_0x4c67('0x16')]();};}function respondWithResult(_0x307f15,_0x4d8e74){_0x4d8e74=_0x4d8e74||0xc8;return function(_0x497eab){if(_0x497eab){return _0x307f15[_0x4c67('0x17')](_0x4d8e74)[_0x4c67('0x18')](_0x497eab);}};}function respondWithFilteredResult(_0x617aaf,_0x441665){return function(_0x42fdb7){if(_0x42fdb7){var _0x3be40d=typeof _0x441665[_0x4c67('0x19')]===_0x4c67('0x1a')&&typeof _0x441665[_0x4c67('0x1b')]===_0x4c67('0x1a');var _0x5c5d49=_0x42fdb7['count'];var _0x217ce6=_0x3be40d?0x0:_0x441665[_0x4c67('0x19')];var _0x5c062c=_0x3be40d?_0x42fdb7[_0x4c67('0x1c')]:_0x441665[_0x4c67('0x19')]+_0x441665[_0x4c67('0x1b')];var _0x162791;if(_0x5c062c>=_0x5c5d49){_0x5c062c=_0x5c5d49;_0x162791=0xc8;}else{_0x162791=0xce;}_0x617aaf[_0x4c67('0x17')](_0x162791);return _0x617aaf[_0x4c67('0x1d')](_0x4c67('0x1e'),_0x217ce6+'-'+_0x5c062c+'/'+_0x5c5d49)[_0x4c67('0x18')](_0x42fdb7);}return null;};}function patchUpdates(_0x5a96c8){return function(_0x1f5e01){try{jsonpatch[_0x4c67('0x1f')](_0x1f5e01,_0x5a96c8,!![]);}catch(_0x2498dc){return BPromise[_0x4c67('0x20')](_0x2498dc);}return _0x1f5e01['save']();};}function saveUpdates(_0x4905c5,_0x44a0b1){return function(_0x1b34fc){if(_0x1b34fc){return _0x1b34fc[_0x4c67('0x21')](_0x4905c5)[_0x4c67('0x22')](function(_0x586111){return _0x586111;});}return null;};}function removeEntity(_0x2f6fac,_0x2dec4d){return function(_0x495320){if(_0x495320){return _0x495320[_0x4c67('0x23')]()[_0x4c67('0x22')](function(){_0x2f6fac[_0x4c67('0x17')](0xcc)[_0x4c67('0x16')]();});}};}function handleEntityNotFound(_0x38f684,_0x1f5d0e){return function(_0x5b9149){if(!_0x5b9149){_0x38f684[_0x4c67('0x24')](0x194);}return _0x5b9149;};}function handleError(_0x354524,_0x131610){_0x131610=_0x131610||0x1f4;return function(_0x3a5406){logger[_0x4c67('0x25')](_0x3a5406['stack']);if(_0x3a5406[_0x4c67('0x26')]){delete _0x3a5406[_0x4c67('0x26')];}_0x354524['status'](_0x131610)[_0x4c67('0x27')](_0x3a5406);};}exports[_0x4c67('0x28')]=function(_0x4b0191,_0x30648a){var _0x36dc2d={},_0x36d07a={},_0x54bef8={'count':0x0,'rows':[]};var _0x2a9403=_[_0x4c67('0x29')](db[_0x4c67('0x2a')][_0x4c67('0x2b')],function(_0x349dd6){return{'name':_0x349dd6[_0x4c67('0x2c')],'type':_0x349dd6[_0x4c67('0x2d')]['key']};});_0x36d07a[_0x4c67('0x2e')]=_[_0x4c67('0x29')](_0x2a9403,'name');_0x36d07a[_0x4c67('0x2f')]=_[_0x4c67('0x30')](_0x4b0191[_0x4c67('0x2f')]);_0x36d07a[_0x4c67('0x31')]=_['intersection'](_0x36d07a[_0x4c67('0x2e')],_0x36d07a['query']);_0x36dc2d[_0x4c67('0x32')]=_['intersection'](_0x36d07a[_0x4c67('0x2e')],qs[_0x4c67('0x33')](_0x4b0191[_0x4c67('0x2f')]['fields']));_0x36dc2d[_0x4c67('0x32')]=_0x36dc2d[_0x4c67('0x32')][_0x4c67('0x34')]?_0x36dc2d[_0x4c67('0x32')]:_0x36d07a[_0x4c67('0x2e')];if(!_0x4b0191[_0x4c67('0x2f')]['hasOwnProperty'](_0x4c67('0x35'))){_0x36dc2d[_0x4c67('0x1b')]=qs[_0x4c67('0x1b')](_0x4b0191[_0x4c67('0x2f')]['limit']);_0x36dc2d['offset']=qs[_0x4c67('0x19')](_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x19')]);}_0x36dc2d[_0x4c67('0x36')]=qs['sort'](_0x4b0191['query'][_0x4c67('0x37')]);_0x36dc2d[_0x4c67('0x38')]=qs['filters'](_[_0x4c67('0x39')](_0x4b0191[_0x4c67('0x2f')],_0x36d07a[_0x4c67('0x31')]),_0x2a9403);if(_0x4b0191['query'][_0x4c67('0x3a')]){_0x36dc2d[_0x4c67('0x38')]=_[_0x4c67('0x3b')](_0x36dc2d['where'],{'$or':_['map'](_0x2a9403,function(_0x356978){if(_0x356978[_0x4c67('0x2d')]!==_0x4c67('0x3c')){var _0x3a58b7={};_0x3a58b7[_0x356978[_0x4c67('0x26')]]={'$like':'%'+_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x3a')]+'%'};return _0x3a58b7;}})});}_0x36dc2d=_['merge']({},_0x36dc2d,_0x4b0191[_0x4c67('0x3d')]);var _0x2cfe81={'where':_0x36dc2d[_0x4c67('0x38')]};return db[_0x4c67('0x2a')]['count'](_0x2cfe81)[_0x4c67('0x22')](function(_0x3fad44){_0x54bef8['count']=_0x3fad44;if(_0x4b0191[_0x4c67('0x2f')][_0x4c67('0x3e')]){_0x36dc2d[_0x4c67('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x4c67('0x40')](_0x36dc2d);})[_0x4c67('0x22')](function(_0x136cfb){_0x54bef8[_0x4c67('0x41')]=_0x136cfb;return _0x54bef8;})['then'](respondWithFilteredResult(_0x30648a,_0x36dc2d))[_0x4c67('0x42')](handleError(_0x30648a,null));};exports['show']=function(_0x125719,_0x2b37ae){var _0x2dba44={'raw':!![],'where':{'id':_0x125719[_0x4c67('0x43')]['id']}},_0xb24b39={};_0xb24b39['model']=_['keys'](db[_0x4c67('0x2a')][_0x4c67('0x2b')]);_0xb24b39[_0x4c67('0x2f')]=_[_0x4c67('0x30')](_0x125719[_0x4c67('0x2f')]);_0xb24b39[_0x4c67('0x31')]=_['intersection'](_0xb24b39['model'],_0xb24b39[_0x4c67('0x2f')]);_0x2dba44[_0x4c67('0x32')]=_[_0x4c67('0x44')](_0xb24b39[_0x4c67('0x2e')],qs[_0x4c67('0x33')](_0x125719['query'][_0x4c67('0x33')]));_0x2dba44[_0x4c67('0x32')]=_0x2dba44['attributes'][_0x4c67('0x34')]?_0x2dba44[_0x4c67('0x32')]:_0xb24b39[_0x4c67('0x2e')];if(_0x125719['query'][_0x4c67('0x3e')]){_0x2dba44[_0x4c67('0x3f')]=[{'all':!![]}];}_0x2dba44=_[_0x4c67('0x3b')]({},_0x2dba44,_0x125719['options']);return db[_0x4c67('0x2a')][_0x4c67('0x45')](_0x2dba44)[_0x4c67('0x22')](handleEntityNotFound(_0x2b37ae,null))['then'](respondWithResult(_0x2b37ae,null))['catch'](handleError(_0x2b37ae,null));};exports[_0x4c67('0x46')]=function(_0x30e9ec,_0x3a0f12){return db['SquareMessage'][_0x4c67('0x46')](_0x30e9ec[_0x4c67('0x47')],{})[_0x4c67('0x22')](respondWithResult(_0x3a0f12,0xc9))[_0x4c67('0x42')](handleError(_0x3a0f12,null));};exports['update']=function(_0x142e2c,_0x54b262){if(_0x142e2c[_0x4c67('0x47')]['id']){delete _0x142e2c['body']['id'];}return db[_0x4c67('0x2a')][_0x4c67('0x45')]({'where':{'id':_0x142e2c[_0x4c67('0x43')]['id']}})[_0x4c67('0x22')](handleEntityNotFound(_0x54b262,null))[_0x4c67('0x22')](saveUpdates(_0x142e2c[_0x4c67('0x47')],null))['then'](respondWithResult(_0x54b262,null))[_0x4c67('0x42')](handleError(_0x54b262,null));};exports['destroy']=function(_0xf51a4a,_0x996a4d){return db[_0x4c67('0x2a')]['find']({'where':{'id':_0xf51a4a[_0x4c67('0x43')]['id']}})[_0x4c67('0x22')](handleEntityNotFound(_0x996a4d,null))['then'](removeEntity(_0x996a4d,null))[_0x4c67('0x42')](handleError(_0x996a4d,null));}; \ No newline at end of file +var _0xf29f=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x1f27df,_0x4f1a64){var _0x286ee2=function(_0x255ea7){while(--_0x255ea7){_0x1f27df['push'](_0x1f27df['shift']());}};_0x286ee2(++_0x4f1a64);}(_0xf29f,0x18d));var _0xff29=function(_0x48a8a7,_0x1af9a6){_0x48a8a7=_0x48a8a7-0x0;var _0x1d244a=_0xf29f[_0x48a8a7];return _0x1d244a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff29('0x0'));var zipdir=require(_0xff29('0x1'));var jsonpatch=require(_0xff29('0x2'));var rp=require('request-promise');var moment=require(_0xff29('0x3'));var BPromise=require(_0xff29('0x4'));var Mustache=require('mustache');var util=require(_0xff29('0x5'));var path=require(_0xff29('0x6'));var sox=require('sox');var csv=require(_0xff29('0x7'));var ejs=require(_0xff29('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xff29('0x9'));var crypto=require('crypto');var jsforce=require(_0xff29('0xa'));var deskjs=require(_0xff29('0xb'));var toCsv=require(_0xff29('0x7'));var querystring=require(_0xff29('0xc'));var Papa=require(_0xff29('0xd'));var Redis=require(_0xff29('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xff29('0xf'));var hardwareService=require(_0xff29('0x10'));var logger=require(_0xff29('0x11'))(_0xff29('0x12'));var utils=require(_0xff29('0x13'));var config=require(_0xff29('0x14'));var licenseUtil=require(_0xff29('0x15'));var db=require(_0xff29('0x16'))['db'];function respondWithStatusCode(_0x18c3f2,_0x1f4a9c){_0x1f4a9c=_0x1f4a9c||0xcc;return function(_0xf67040){if(_0xf67040){return _0x18c3f2[_0xff29('0x17')](_0x1f4a9c);}return _0x18c3f2[_0xff29('0x18')](_0x1f4a9c)[_0xff29('0x19')]();};}function respondWithResult(_0x284823,_0x518c75){_0x518c75=_0x518c75||0xc8;return function(_0x1ff15e){if(_0x1ff15e){return _0x284823[_0xff29('0x18')](_0x518c75)['json'](_0x1ff15e);}};}function respondWithFilteredResult(_0x2228fb,_0xbd98f5){return function(_0x24567d){if(_0x24567d){var _0x2d633b=typeof _0xbd98f5[_0xff29('0x1a')]===_0xff29('0x1b')&&typeof _0xbd98f5[_0xff29('0x1c')]===_0xff29('0x1b');var _0x3ecb1e=_0x24567d[_0xff29('0x1d')];var _0x146313=_0x2d633b?0x0:_0xbd98f5['offset'];var _0x9f70a5=_0x2d633b?_0x24567d[_0xff29('0x1d')]:_0xbd98f5[_0xff29('0x1a')]+_0xbd98f5[_0xff29('0x1c')];var _0x35cbd3;if(_0x9f70a5>=_0x3ecb1e){_0x9f70a5=_0x3ecb1e;_0x35cbd3=0xc8;}else{_0x35cbd3=0xce;}_0x2228fb[_0xff29('0x18')](_0x35cbd3);return _0x2228fb['set'](_0xff29('0x1e'),_0x146313+'-'+_0x9f70a5+'/'+_0x3ecb1e)[_0xff29('0x1f')](_0x24567d);}return null;};}function patchUpdates(_0x202748){return function(_0x43f2b6){try{jsonpatch[_0xff29('0x20')](_0x43f2b6,_0x202748,!![]);}catch(_0x21667c){return BPromise[_0xff29('0x21')](_0x21667c);}return _0x43f2b6[_0xff29('0x22')]();};}function saveUpdates(_0x2ccbb0,_0x33612d){return function(_0x421786){if(_0x421786){return _0x421786[_0xff29('0x23')](_0x2ccbb0)[_0xff29('0x24')](function(_0x2d955c){return _0x2d955c;});}return null;};}function removeEntity(_0x39f505,_0x331de6){return function(_0x2b157d){if(_0x2b157d){return _0x2b157d['destroy']()[_0xff29('0x24')](function(){_0x39f505[_0xff29('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36cc24,_0x4e71d1){return function(_0x566a88){if(!_0x566a88){_0x36cc24[_0xff29('0x17')](0x194);}return _0x566a88;};}function handleError(_0x51fbc9,_0x13b237){_0x13b237=_0x13b237||0x1f4;return function(_0x215c9a){logger[_0xff29('0x25')](_0x215c9a[_0xff29('0x26')]);if(_0x215c9a[_0xff29('0x27')]){delete _0x215c9a['name'];}_0x51fbc9[_0xff29('0x18')](_0x13b237)[_0xff29('0x28')](_0x215c9a);};}exports[_0xff29('0x29')]=function(_0x132682,_0x250ad){var _0x3b2321={},_0x37b773={},_0x3ec16e={'count':0x0,'rows':[]};var _0x3b6132=_[_0xff29('0x2a')](db[_0xff29('0x2b')][_0xff29('0x2c')],function(_0xafccf2){return{'name':_0xafccf2['fieldName'],'type':_0xafccf2[_0xff29('0x2d')][_0xff29('0x2e')]};});_0x37b773[_0xff29('0x2f')]=_[_0xff29('0x2a')](_0x3b6132,'name');_0x37b773[_0xff29('0x30')]=_[_0xff29('0x31')](_0x132682[_0xff29('0x30')]);_0x37b773['filters']=_[_0xff29('0x32')](_0x37b773['model'],_0x37b773['query']);_0x3b2321[_0xff29('0x33')]=_[_0xff29('0x32')](_0x37b773[_0xff29('0x2f')],qs[_0xff29('0x34')](_0x132682[_0xff29('0x30')][_0xff29('0x34')]));_0x3b2321[_0xff29('0x33')]=_0x3b2321[_0xff29('0x33')][_0xff29('0x35')]?_0x3b2321[_0xff29('0x33')]:_0x37b773[_0xff29('0x2f')];if(!_0x132682[_0xff29('0x30')][_0xff29('0x36')](_0xff29('0x37'))){_0x3b2321[_0xff29('0x1c')]=qs[_0xff29('0x1c')](_0x132682[_0xff29('0x30')]['limit']);_0x3b2321[_0xff29('0x1a')]=qs[_0xff29('0x1a')](_0x132682['query'][_0xff29('0x1a')]);}_0x3b2321[_0xff29('0x38')]=qs[_0xff29('0x39')](_0x132682[_0xff29('0x30')][_0xff29('0x39')]);_0x3b2321[_0xff29('0x3a')]=qs[_0xff29('0x3b')](_[_0xff29('0x3c')](_0x132682['query'],_0x37b773[_0xff29('0x3b')]),_0x3b6132);if(_0x132682[_0xff29('0x30')][_0xff29('0x3d')]){_0x3b2321[_0xff29('0x3a')]=_[_0xff29('0x3e')](_0x3b2321[_0xff29('0x3a')],{'$or':_[_0xff29('0x2a')](_0x3b6132,function(_0x1f0960){if(_0x1f0960[_0xff29('0x2d')]!==_0xff29('0x3f')){var _0x8ad9ff={};_0x8ad9ff[_0x1f0960[_0xff29('0x27')]]={'$like':'%'+_0x132682[_0xff29('0x30')][_0xff29('0x3d')]+'%'};return _0x8ad9ff;}})});}_0x3b2321=_['merge']({},_0x3b2321,_0x132682[_0xff29('0x40')]);var _0x351804={'where':_0x3b2321['where']};return db[_0xff29('0x2b')][_0xff29('0x1d')](_0x351804)[_0xff29('0x24')](function(_0x539e94){_0x3ec16e['count']=_0x539e94;if(_0x132682[_0xff29('0x30')][_0xff29('0x41')]){_0x3b2321[_0xff29('0x42')]=[{'all':!![]}];}return db[_0xff29('0x2b')][_0xff29('0x43')](_0x3b2321);})[_0xff29('0x24')](function(_0x16046c){_0x3ec16e['rows']=_0x16046c;return _0x3ec16e;})['then'](respondWithFilteredResult(_0x250ad,_0x3b2321))['catch'](handleError(_0x250ad,null));};exports[_0xff29('0x44')]=function(_0x10206e,_0x1e6991){var _0x347710={'raw':!![],'where':{'id':_0x10206e[_0xff29('0x45')]['id']}},_0x45a4e6={};_0x45a4e6[_0xff29('0x2f')]=_[_0xff29('0x31')](db[_0xff29('0x2b')]['rawAttributes']);_0x45a4e6[_0xff29('0x30')]=_[_0xff29('0x31')](_0x10206e[_0xff29('0x30')]);_0x45a4e6['filters']=_['intersection'](_0x45a4e6[_0xff29('0x2f')],_0x45a4e6['query']);_0x347710['attributes']=_[_0xff29('0x32')](_0x45a4e6[_0xff29('0x2f')],qs[_0xff29('0x34')](_0x10206e['query'][_0xff29('0x34')]));_0x347710['attributes']=_0x347710[_0xff29('0x33')][_0xff29('0x35')]?_0x347710[_0xff29('0x33')]:_0x45a4e6[_0xff29('0x2f')];if(_0x10206e['query'][_0xff29('0x41')]){_0x347710[_0xff29('0x42')]=[{'all':!![]}];}_0x347710=_[_0xff29('0x3e')]({},_0x347710,_0x10206e[_0xff29('0x40')]);return db['SquareMessage'][_0xff29('0x46')](_0x347710)[_0xff29('0x24')](handleEntityNotFound(_0x1e6991,null))[_0xff29('0x24')](respondWithResult(_0x1e6991,null))[_0xff29('0x47')](handleError(_0x1e6991,null));};exports['create']=function(_0x4e0ea6,_0x1de220){return db[_0xff29('0x2b')][_0xff29('0x48')](_0x4e0ea6[_0xff29('0x49')],{})[_0xff29('0x24')](respondWithResult(_0x1de220,0xc9))[_0xff29('0x47')](handleError(_0x1de220,null));};exports[_0xff29('0x23')]=function(_0x45bdcd,_0xeae254){if(_0x45bdcd['body']['id']){delete _0x45bdcd[_0xff29('0x49')]['id'];}return db[_0xff29('0x2b')][_0xff29('0x46')]({'where':{'id':_0x45bdcd[_0xff29('0x45')]['id']}})[_0xff29('0x24')](handleEntityNotFound(_0xeae254,null))['then'](saveUpdates(_0x45bdcd[_0xff29('0x49')],null))[_0xff29('0x24')](respondWithResult(_0xeae254,null))[_0xff29('0x47')](handleError(_0xeae254,null));};exports[_0xff29('0x4a')]=function(_0x5956ab,_0x5eb8cf){return db[_0xff29('0x2b')][_0xff29('0x46')]({'where':{'id':_0x5956ab[_0xff29('0x45')]['id']}})['then'](handleEntityNotFound(_0x5eb8cf,null))[_0xff29('0x24')](removeEntity(_0x5eb8cf,null))['catch'](handleError(_0x5eb8cf,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3e5f40a..7985e5f 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ba9=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x31543a,_0x41b33d){var _0x468934=function(_0x1b47be){while(--_0x1b47be){_0x31543a['push'](_0x31543a['shift']());}};_0x468934(++_0x41b33d);}(_0x6ba9,0x1e0));var _0x96ba=function(_0x2ecf59,_0x84bf62){_0x2ecf59=_0x2ecf59-0x0;var _0x5841e6=_0x6ba9[_0x2ecf59];return _0x5841e6;};'use strict';var _=require(_0x96ba('0x0'));var util=require(_0x96ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x96ba('0x2'));var BPromise=require(_0x96ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96ba('0x4'));var rimraf=require(_0x96ba('0x5'));var config=require(_0x96ba('0x6'));var attributes=require(_0x96ba('0x7'));module[_0x96ba('0x8')]=function(_0x192551,_0x464e74){return _0x192551[_0x96ba('0x9')](_0x96ba('0xa'),attributes,{'tableName':_0x96ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72c=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','util','moment','bluebird'];(function(_0x4ee489,_0x5c98e4){var _0x46ba55=function(_0x5afa37){while(--_0x5afa37){_0x4ee489['push'](_0x4ee489['shift']());}};_0x46ba55(++_0x5c98e4);}(_0xf72c,0x81));var _0xcf72=function(_0x5b4f7a,_0xf7eab5){_0x5b4f7a=_0x5b4f7a-0x0;var _0x57d68c=_0xf72c[_0x5b4f7a];return _0x57d68c;};'use strict';var _=require('lodash');var util=require(_0xcf72('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcf72('0x1'));var BPromise=require(_0xcf72('0x2'));var rp=require(_0xcf72('0x3'));var fs=require('fs');var path=require(_0xcf72('0x4'));var rimraf=require(_0xcf72('0x5'));var config=require(_0xcf72('0x6'));var attributes=require(_0xcf72('0x7'));module[_0xcf72('0x8')]=function(_0x5c924f,_0x3c52d3){return _0x5c924f[_0xcf72('0x9')](_0xcf72('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3bfa62d..6faf431 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x458c=['SquareMessage','body','options','raw','catch','CreateSquareMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','SquareMessage,\x20%s,\x20%s','message'];(function(_0x5b408d,_0x26cb67){var _0x4072ce=function(_0x354b6b){while(--_0x354b6b){_0x5b408d['push'](_0x5b408d['shift']());}};_0x4072ce(++_0x26cb67);}(_0x458c,0xf0));var _0xc458=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0x458c[_0x5e238b];return _0x389bea;};'use strict';var _=require(_0xc458('0x0'));var util=require(_0xc458('0x1'));var moment=require(_0xc458('0x2'));var BPromise=require(_0xc458('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc458('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc458('0x5'));var logger=require('../../config/logger')(_0xc458('0x6'));var config=require(_0xc458('0x7'));var jayson=require(_0xc458('0x8'));var client=jayson[_0xc458('0x9')][_0xc458('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x300396,_0xa36533,_0x56a13e){return new BPromise(function(_0x36c56e,_0x2882cb){return client[_0xc458('0xb')](_0x300396,_0x56a13e)['then'](function(_0x17a3e8){logger[_0xc458('0xc')]('SquareMessage,\x20%s,\x20%s',_0xa36533,_0xc458('0xd'));logger[_0xc458('0xe')](_0xc458('0xf'),_0xa36533,_0xc458('0xd'),JSON[_0xc458('0x10')](_0x17a3e8));if(_0x17a3e8[_0xc458('0x11')]){if(_0x17a3e8['error']['code']===0x1f4){logger[_0xc458('0x11')](_0xc458('0x12'),_0xa36533,_0x17a3e8[_0xc458('0x11')]['message']);return _0x2882cb(_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);}logger[_0xc458('0x11')]('SquareMessage,\x20%s,\x20%s',_0xa36533,_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);return _0x36c56e(_0x17a3e8[_0xc458('0x11')][_0xc458('0x13')]);}else{logger[_0xc458('0xc')](_0xc458('0x12'),_0xa36533,_0xc458('0xd'));_0x36c56e(_0x17a3e8['result']['message']);}})['catch'](function(_0x4d6acc){logger[_0xc458('0x11')](_0xc458('0x12'),_0xa36533,_0x4d6acc);_0x2882cb(_0x4d6acc);});});}exports['CreateSquareMessage']=function(_0x317672){var _0x30fb75=this;return new Promise(function(_0x5b8744,_0x217edc){return db[_0xc458('0x14')]['create'](_0x317672[_0xc458('0x15')],{'raw':_0x317672[_0xc458('0x16')]?_0x317672[_0xc458('0x16')][_0xc458('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3c3624){logger[_0xc458('0xc')]('CreateSquareMessage',_0x317672);logger[_0xc458('0xe')]('CreateSquareMessage',_0x317672,JSON[_0xc458('0x10')](_0x3c3624));_0x5b8744(_0x3c3624);})[_0xc458('0x18')](function(_0x35ecd5){logger[_0xc458('0x11')](_0xc458('0x19'),_0x35ecd5[_0xc458('0x13')],_0x317672);_0x217edc(_0x30fb75[_0xc458('0x11')](0x1f4,_0x35ecd5[_0xc458('0x13')]));});});}; \ No newline at end of file +var _0xde25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','debug','lodash','moment'];(function(_0x5a3c7b,_0x3fad44){var _0x5763f5=function(_0x238f9b){while(--_0x238f9b){_0x5a3c7b['push'](_0x5a3c7b['shift']());}};_0x5763f5(++_0x3fad44);}(_0xde25,0x94));var _0x5de2=function(_0x36247a,_0x20cdd2){_0x36247a=_0x36247a-0x0;var _0x5140e9=_0xde25[_0x36247a];return _0x5140e9;};'use strict';var _=require(_0x5de2('0x0'));var util=require('util');var moment=require(_0x5de2('0x1'));var BPromise=require(_0x5de2('0x2'));var rs=require(_0x5de2('0x3'));var fs=require('fs');var Redis=require(_0x5de2('0x4'));var db=require(_0x5de2('0x5'))['db'];var utils=require(_0x5de2('0x6'));var logger=require(_0x5de2('0x7'))(_0x5de2('0x8'));var config=require(_0x5de2('0x9'));var jayson=require(_0x5de2('0xa'));var client=jayson[_0x5de2('0xb')][_0x5de2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bdd05,_0x584b31,_0x4fc4e4){return new BPromise(function(_0x280fad,_0x567dc6){return client['request'](_0x2bdd05,_0x4fc4e4)[_0x5de2('0xd')](function(_0x2b3d50){logger[_0x5de2('0xe')](_0x5de2('0xf'),_0x584b31,'request\x20sent');logger['debug'](_0x5de2('0x10'),_0x584b31,_0x5de2('0x11'),JSON[_0x5de2('0x12')](_0x2b3d50));if(_0x2b3d50[_0x5de2('0x13')]){if(_0x2b3d50[_0x5de2('0x13')][_0x5de2('0x14')]===0x1f4){logger[_0x5de2('0x13')](_0x5de2('0xf'),_0x584b31,_0x2b3d50['error'][_0x5de2('0x15')]);return _0x567dc6(_0x2b3d50[_0x5de2('0x13')][_0x5de2('0x15')]);}logger[_0x5de2('0x13')](_0x5de2('0xf'),_0x584b31,_0x2b3d50[_0x5de2('0x13')][_0x5de2('0x15')]);return _0x280fad(_0x2b3d50[_0x5de2('0x13')][_0x5de2('0x15')]);}else{logger[_0x5de2('0xe')](_0x5de2('0xf'),_0x584b31,'request\x20sent');_0x280fad(_0x2b3d50[_0x5de2('0x16')][_0x5de2('0x15')]);}})[_0x5de2('0x17')](function(_0x24dc5e){logger[_0x5de2('0x13')]('SquareMessage,\x20%s,\x20%s',_0x584b31,_0x24dc5e);_0x567dc6(_0x24dc5e);});});}exports[_0x5de2('0x18')]=function(_0x450177){var _0x6fc473=this;return new Promise(function(_0x2f16b8,_0x1b8d01){return db[_0x5de2('0x19')]['create'](_0x450177[_0x5de2('0x1a')],{'raw':_0x450177[_0x5de2('0x1b')]?_0x450177['options'][_0x5de2('0x1c')]===undefined?!![]:![]:!![]})[_0x5de2('0xd')](function(_0x295ff8){logger[_0x5de2('0xe')](_0x5de2('0x18'),_0x450177);logger[_0x5de2('0x1d')](_0x5de2('0x18'),_0x450177,JSON[_0x5de2('0x12')](_0x295ff8));_0x2f16b8(_0x295ff8);})[_0x5de2('0x17')](function(_0x59427b){logger[_0x5de2('0x13')](_0x5de2('0x18'),_0x59427b[_0x5de2('0x15')],_0x450177);_0x1b8d01(_0x6fc473[_0x5de2('0x13')](0x1f4,_0x59427b[_0x5de2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c5a3c2c..5c92129 100644 --- a/server/api/squareOdbc/index.js +++ b/server/api/squareOdbc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc078=['../../config/environment','./squareOdbc.controller','get','/:id','isAuthenticated','show','15s','test','create','update','delete','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a7981,_0x30cd1e){var _0x4c64cf=function(_0x572902){while(--_0x572902){_0x1a7981['push'](_0x1a7981['shift']());}};_0x4c64cf(++_0x30cd1e);}(_0xc078,0x1bd));var _0x8c07=function(_0x84fb1f,_0xb68308){_0x84fb1f=_0x84fb1f-0x0;var _0x4eadf9=_0xc078[_0x84fb1f];return _0x4eadf9;};'use strict';var multer=require('multer');var util=require(_0x8c07('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c07('0x1'));var router=express['Router']();var fs_extra=require(_0x8c07('0x2'));var auth=require(_0x8c07('0x3'));var interaction=require(_0x8c07('0x4'));var config=require(_0x8c07('0x5'));var controller=require(_0x8c07('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8c07('0x7')](_0x8c07('0x8'),auth[_0x8c07('0x9')](),controller[_0x8c07('0xa')]);router['get']('/:id/test',auth[_0x8c07('0x9')](),timeout(_0x8c07('0xb')),controller[_0x8c07('0xc')]);router['post']('/',auth[_0x8c07('0x9')](),controller[_0x8c07('0xd')]);router['put'](_0x8c07('0x8'),auth[_0x8c07('0x9')](),controller[_0x8c07('0xe')]);router[_0x8c07('0xf')]('/:id',auth[_0x8c07('0x9')](),controller[_0x8c07('0x10')]);module[_0x8c07('0x11')]=router; \ No newline at end of file +var _0x5d0a=['./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4fb5e9,_0x1d8fa3){var _0x29c192=function(_0x30569b){while(--_0x30569b){_0x4fb5e9['push'](_0x4fb5e9['shift']());}};_0x29c192(++_0x1d8fa3);}(_0x5d0a,0xf5));var _0xa5d0=function(_0x284172,_0x30af4a){_0x284172=_0x284172-0x0;var _0x1ff8a3=_0x5d0a[_0x284172];return _0x1ff8a3;};'use strict';var multer=require(_0xa5d0('0x0'));var util=require(_0xa5d0('0x1'));var path=require(_0xa5d0('0x2'));var timeout=require(_0xa5d0('0x3'));var express=require(_0xa5d0('0x4'));var router=express[_0xa5d0('0x5')]();var fs_extra=require(_0xa5d0('0x6'));var auth=require(_0xa5d0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa5d0('0x8'));router[_0xa5d0('0x9')]('/',auth[_0xa5d0('0xa')](),controller[_0xa5d0('0xb')]);router[_0xa5d0('0x9')](_0xa5d0('0xc'),auth[_0xa5d0('0xa')](),controller[_0xa5d0('0xd')]);router['get'](_0xa5d0('0xe'),auth['isAuthenticated'](),timeout(_0xa5d0('0xf')),controller['test']);router[_0xa5d0('0x10')]('/',auth['isAuthenticated'](),controller[_0xa5d0('0x11')]);router[_0xa5d0('0x12')](_0xa5d0('0xc'),auth[_0xa5d0('0xa')](),controller[_0xa5d0('0x13')]);router[_0xa5d0('0x14')](_0xa5d0('0xc'),auth[_0xa5d0('0xa')](),controller[_0xa5d0('0x15')]);module[_0xa5d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1d2da96..a4e3046 100644 --- a/server/api/squareOdbc/squareOdbc.attributes.js +++ b/server/api/squareOdbc/squareOdbc.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43c3=['STRING','sequelize'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0x43c3,0xcd));var _0x343c=function(_0x30a115,_0x1869d6){_0x30a115=_0x30a115-0x0;var _0x4cc727=_0x43c3[_0x30a115];return _0x4cc727;};'use strict';var Sequelize=require(_0x343c('0x0'));module['exports']={'name':{'type':Sequelize[_0x343c('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x343c('0x1')]}}; \ No newline at end of file +var _0xa58a=['STRING','name','exports'];(function(_0x58851b,_0x587ea6){var _0x37ff80=function(_0xa36f7c){while(--_0xa36f7c){_0x58851b['push'](_0x58851b['shift']());}};_0x37ff80(++_0x587ea6);}(_0xa58a,0x8c));var _0xaa58=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xa58a[_0x5a95fa];return _0x1a61b8;};'use strict';var Sequelize=require('sequelize');module[_0xaa58('0x0')]={'name':{'type':Sequelize[_0xaa58('0x1')],'unique':_0xaa58('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xaa58('0x1')]},'description':{'type':Sequelize[_0xaa58('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 8dea263..d50799b 100644 --- a/server/api/squareOdbc/squareOdbc.controller.js +++ b/server/api/squareOdbc/squareOdbc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x774f=['error','stack','name','send','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','SquareOdbc','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','odbc','dsn','closeSync','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','ODBC','UserProfileResource'];(function(_0x11ce79,_0x4d6025){var _0x4805b7=function(_0xbbd0aa){while(--_0xbbd0aa){_0x11ce79['push'](_0x11ce79['shift']());}};_0x4805b7(++_0x4d6025);}(_0x774f,0x185));var _0xf774=function(_0x46f697,_0x38b6c1){_0x46f697=_0x46f697-0x0;var _0xfc274=_0x774f[_0x46f697];return _0xfc274;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf774('0x0'));var zipdir=require(_0xf774('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf774('0x2'));var moment=require('moment');var BPromise=require(_0xf774('0x3'));var Mustache=require(_0xf774('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf774('0x5'));var csv=require(_0xf774('0x6'));var ejs=require(_0xf774('0x7'));var fs=require('fs');var fs_extra=require(_0xf774('0x8'));var _=require('lodash');var squel=require(_0xf774('0x9'));var crypto=require(_0xf774('0xa'));var jsforce=require(_0xf774('0xb'));var deskjs=require(_0xf774('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf774('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf774('0xe'));var hardwareService=require(_0xf774('0xf'));var logger=require(_0xf774('0x10'))(_0xf774('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf774('0x12'));var db=require(_0xf774('0x13'))['db'];function respondWithStatusCode(_0x921ea6,_0x45c139){_0x45c139=_0x45c139||0xcc;return function(_0x9f2930){if(_0x9f2930){return _0x921ea6[_0xf774('0x14')](_0x45c139);}return _0x921ea6[_0xf774('0x15')](_0x45c139)[_0xf774('0x16')]();};}function respondWithResult(_0xb2324d,_0x1c3ebf){_0x1c3ebf=_0x1c3ebf||0xc8;return function(_0x4c9a1d){if(_0x4c9a1d){return _0xb2324d[_0xf774('0x15')](_0x1c3ebf)[_0xf774('0x17')](_0x4c9a1d);}};}function respondWithFilteredResult(_0x212d63,_0x23ba58){return function(_0x400071){if(_0x400071){var _0x2c4303=typeof _0x23ba58['offset']===_0xf774('0x18')&&typeof _0x23ba58[_0xf774('0x19')]===_0xf774('0x18');var _0x37d40b=_0x400071[_0xf774('0x1a')];var _0x31762a=_0x2c4303?0x0:_0x23ba58['offset'];var _0x542749=_0x2c4303?_0x400071[_0xf774('0x1a')]:_0x23ba58['offset']+_0x23ba58[_0xf774('0x19')];var _0x4f1e64;if(_0x542749>=_0x37d40b){_0x542749=_0x37d40b;_0x4f1e64=0xc8;}else{_0x4f1e64=0xce;}_0x212d63[_0xf774('0x15')](_0x4f1e64);return _0x212d63[_0xf774('0x1b')](_0xf774('0x1c'),_0x31762a+'-'+_0x542749+'/'+_0x37d40b)[_0xf774('0x17')](_0x400071);}return null;};}function patchUpdates(_0x394e01){return function(_0x11dd60){try{jsonpatch[_0xf774('0x1d')](_0x11dd60,_0x394e01,!![]);}catch(_0x1d7d6a){return BPromise[_0xf774('0x1e')](_0x1d7d6a);}return _0x11dd60[_0xf774('0x1f')]();};}function saveUpdates(_0xdba81c,_0x45077c){return function(_0x3632bb){if(_0x3632bb){return _0x3632bb['update'](_0xdba81c)[_0xf774('0x20')](function(_0xf38001){return _0xf38001;});}return null;};}function removeEntity(_0x367b67,_0x5ed6c5){return function(_0x33c70f){if(_0x33c70f){return _0x33c70f[_0xf774('0x21')]()[_0xf774('0x20')](function(){var _0x14ae72=_0x33c70f['get']({'plain':!![]});var _0x204326=_0xf774('0x22');return db[_0xf774('0x23')]['destroy']({'where':{'type':_0x204326,'resourceId':_0x14ae72['id']}})[_0xf774('0x20')](function(){return _0x33c70f;});})[_0xf774('0x20')](function(){_0x367b67['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2877d7,_0x343bfd){return function(_0x437bb9){if(!_0x437bb9){_0x2877d7['sendStatus'](0x194);}return _0x437bb9;};}function handleError(_0x3e6aad,_0x5b7ef1){_0x5b7ef1=_0x5b7ef1||0x1f4;return function(_0x332a87){logger[_0xf774('0x24')](_0x332a87[_0xf774('0x25')]);if(_0x332a87['name']){delete _0x332a87[_0xf774('0x26')];}_0x3e6aad[_0xf774('0x15')](_0x5b7ef1)[_0xf774('0x27')](_0x332a87);};}exports['index']=function(_0x3adc68,_0x14e860){var _0x4782c7={},_0xfdfa30={},_0x1f49d5={'count':0x0,'rows':[]};var _0x2e9128=_[_0xf774('0x28')](db['SquareOdbc']['rawAttributes'],function(_0x24d749){return{'name':_0x24d749[_0xf774('0x29')],'type':_0x24d749[_0xf774('0x2a')][_0xf774('0x2b')]};});_0xfdfa30['model']=_[_0xf774('0x28')](_0x2e9128,_0xf774('0x26'));_0xfdfa30[_0xf774('0x2c')]=_[_0xf774('0x2d')](_0x3adc68[_0xf774('0x2c')]);_0xfdfa30[_0xf774('0x2e')]=_[_0xf774('0x2f')](_0xfdfa30[_0xf774('0x30')],_0xfdfa30[_0xf774('0x2c')]);_0x4782c7[_0xf774('0x31')]=_[_0xf774('0x2f')](_0xfdfa30[_0xf774('0x30')],qs[_0xf774('0x32')](_0x3adc68[_0xf774('0x2c')][_0xf774('0x32')]));_0x4782c7[_0xf774('0x31')]=_0x4782c7[_0xf774('0x31')][_0xf774('0x33')]?_0x4782c7[_0xf774('0x31')]:_0xfdfa30['model'];if(!_0x3adc68[_0xf774('0x2c')][_0xf774('0x34')](_0xf774('0x35'))){_0x4782c7[_0xf774('0x19')]=qs[_0xf774('0x19')](_0x3adc68['query'][_0xf774('0x19')]);_0x4782c7[_0xf774('0x36')]=qs[_0xf774('0x36')](_0x3adc68['query']['offset']);}_0x4782c7[_0xf774('0x37')]=qs[_0xf774('0x38')](_0x3adc68[_0xf774('0x2c')][_0xf774('0x38')]);_0x4782c7[_0xf774('0x39')]=qs[_0xf774('0x2e')](_[_0xf774('0x3a')](_0x3adc68[_0xf774('0x2c')],_0xfdfa30[_0xf774('0x2e')]),_0x2e9128);if(_0x3adc68['query'][_0xf774('0x3b')]){_0x4782c7['where']=_[_0xf774('0x3c')](_0x4782c7['where'],{'$or':_[_0xf774('0x28')](_0x2e9128,function(_0x68a8f0){if(_0x68a8f0[_0xf774('0x2a')]!==_0xf774('0x3d')){var _0x2e5a6e={};_0x2e5a6e[_0x68a8f0['name']]={'$like':'%'+_0x3adc68['query'][_0xf774('0x3b')]+'%'};return _0x2e5a6e;}})});}_0x4782c7=_['merge']({},_0x4782c7,_0x3adc68['options']);var _0x175851={'where':_0x4782c7[_0xf774('0x39')]};return db['SquareOdbc'][_0xf774('0x1a')](_0x175851)['then'](function(_0x1f2c74){_0x1f49d5[_0xf774('0x1a')]=_0x1f2c74;if(_0x3adc68['query'][_0xf774('0x3e')]){_0x4782c7[_0xf774('0x3f')]=[{'all':!![]}];}return db[_0xf774('0x40')][_0xf774('0x41')](_0x4782c7);})[_0xf774('0x20')](function(_0x19b58f){_0x1f49d5[_0xf774('0x42')]=_0x19b58f;return _0x1f49d5;})[_0xf774('0x20')](respondWithFilteredResult(_0x14e860,_0x4782c7))[_0xf774('0x43')](handleError(_0x14e860,null));};exports[_0xf774('0x44')]=function(_0x4760ec,_0x4702f8){var _0x41d194={'raw':!![],'where':{'id':_0x4760ec[_0xf774('0x45')]['id']}},_0xa3f510={};_0xa3f510[_0xf774('0x30')]=_[_0xf774('0x2d')](db[_0xf774('0x40')][_0xf774('0x46')]);_0xa3f510['query']=_[_0xf774('0x2d')](_0x4760ec[_0xf774('0x2c')]);_0xa3f510[_0xf774('0x2e')]=_[_0xf774('0x2f')](_0xa3f510[_0xf774('0x30')],_0xa3f510[_0xf774('0x2c')]);_0x41d194[_0xf774('0x31')]=_[_0xf774('0x2f')](_0xa3f510[_0xf774('0x30')],qs['fields'](_0x4760ec[_0xf774('0x2c')][_0xf774('0x32')]));_0x41d194[_0xf774('0x31')]=_0x41d194[_0xf774('0x31')][_0xf774('0x33')]?_0x41d194[_0xf774('0x31')]:_0xa3f510[_0xf774('0x30')];if(_0x4760ec[_0xf774('0x2c')][_0xf774('0x3e')]){_0x41d194[_0xf774('0x3f')]=[{'all':!![]}];}_0x41d194=_[_0xf774('0x3c')]({},_0x41d194,_0x4760ec[_0xf774('0x47')]);return db['SquareOdbc'][_0xf774('0x48')](_0x41d194)[_0xf774('0x20')](handleEntityNotFound(_0x4702f8,null))[_0xf774('0x20')](respondWithResult(_0x4702f8,null))['catch'](handleError(_0x4702f8,null));};exports[_0xf774('0x49')]=function(_0x1a47ed,_0x4fb781){return db[_0xf774('0x40')][_0xf774('0x49')](_0x1a47ed[_0xf774('0x4a')],{})['then'](function(_0x3c8243){var _0x16632e=_0x1a47ed[_0xf774('0x4b')][_0xf774('0x4c')]({'plain':!![]});if(!_0x16632e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16632e[_0xf774('0x4d')]==='user'){var _0x2153bc=_0x3c8243[_0xf774('0x4c')]({'plain':!![]});var _0x330d97='ODBC';return db[_0xf774('0x4e')][_0xf774('0x48')]({'where':{'name':_0x330d97,'userProfileId':_0x16632e[_0xf774('0x4f')]},'raw':!![]})['then'](function(_0x38bc32){if(_0x38bc32&&_0x38bc32['autoAssociation']===0x0){return db[_0xf774('0x23')][_0xf774('0x49')]({'name':_0x2153bc['name'],'resourceId':_0x2153bc['id'],'type':_0x38bc32[_0xf774('0x26')],'sectionId':_0x38bc32['id']},{})['then'](function(){return _0x3c8243;});}else{return _0x3c8243;}})[_0xf774('0x43')](function(_0x3e986e){logger[_0xf774('0x24')](_0xf774('0x50'),_0x3e986e);throw _0x3e986e;});}return _0x3c8243;})[_0xf774('0x20')](respondWithResult(_0x4fb781,0xc9))['catch'](handleError(_0x4fb781,null));};exports[_0xf774('0x51')]=function(_0x5bb3dc,_0x2ea173){if(_0x5bb3dc[_0xf774('0x4a')]['id']){delete _0x5bb3dc[_0xf774('0x4a')]['id'];}return db[_0xf774('0x40')][_0xf774('0x48')]({'where':{'id':_0x5bb3dc[_0xf774('0x45')]['id']}})[_0xf774('0x20')](handleEntityNotFound(_0x2ea173,null))['then'](saveUpdates(_0x5bb3dc[_0xf774('0x4a')],null))['then'](respondWithResult(_0x2ea173,null))['catch'](handleError(_0x2ea173,null));};exports[_0xf774('0x21')]=function(_0x16774c,_0x25324){return db[_0xf774('0x40')]['find']({'where':{'id':_0x16774c[_0xf774('0x45')]['id']}})['then'](handleEntityNotFound(_0x25324,null))[_0xf774('0x20')](removeEntity(_0x25324,null))[_0xf774('0x43')](handleError(_0x25324,null));};exports['test']=function(_0x1f4b9c,_0x1feb7a,_0x1f017b){var _0x4723f4;return db['SquareOdbc'][_0xf774('0x48')]({'where':{'id':_0x1f4b9c[_0xf774('0x45')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x1feb7a,null))[_0xf774('0x20')](function(_0x556098){if(_0x556098){var _0x5454b1=require(_0xf774('0x52'))();_0x5454b1['openSync'](_0x556098[_0xf774('0x53')]);_0x5454b1[_0xf774('0x54')]();return _0x556098;}})[_0xf774('0x20')](respondWithResult(_0x1feb7a,null))[_0xf774('0x43')](handleError(_0x1feb7a,null));}; \ No newline at end of file +var _0x7b58=['send','index','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','show','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','odbc','openSync','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','ODBC','UserProfileResource','destroy','error','stack','name'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x7b58,0xcf));var _0x87b5=function(_0x59118a,_0xb6849e){_0x59118a=_0x59118a-0x0;var _0x1600df=_0x7b58[_0x59118a];return _0x1600df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87b5('0x1'));var rp=require(_0x87b5('0x2'));var moment=require(_0x87b5('0x3'));var BPromise=require(_0x87b5('0x4'));var Mustache=require('mustache');var util=require(_0x87b5('0x5'));var path=require(_0x87b5('0x6'));var sox=require(_0x87b5('0x7'));var csv=require(_0x87b5('0x8'));var ejs=require(_0x87b5('0x9'));var fs=require('fs');var fs_extra=require(_0x87b5('0xa'));var _=require('lodash');var squel=require(_0x87b5('0xb'));var crypto=require(_0x87b5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x87b5('0x8'));var querystring=require(_0x87b5('0xd'));var Papa=require('papaparse');var Redis=require(_0x87b5('0xe'));var authService=require(_0x87b5('0xf'));var qs=require(_0x87b5('0x10'));var as=require(_0x87b5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x87b5('0x12'));var utils=require('../../config/utils');var config=require(_0x87b5('0x13'));var licenseUtil=require(_0x87b5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x149a25,_0x1b86de){_0x1b86de=_0x1b86de||0xcc;return function(_0x143e32){if(_0x143e32){return _0x149a25[_0x87b5('0x15')](_0x1b86de);}return _0x149a25['status'](_0x1b86de)[_0x87b5('0x16')]();};}function respondWithResult(_0x3372c4,_0x37381f){_0x37381f=_0x37381f||0xc8;return function(_0x71379c){if(_0x71379c){return _0x3372c4[_0x87b5('0x17')](_0x37381f)[_0x87b5('0x18')](_0x71379c);}};}function respondWithFilteredResult(_0x4588aa,_0x2f9a66){return function(_0x23610c){if(_0x23610c){var _0x15e82c=typeof _0x2f9a66[_0x87b5('0x19')]===_0x87b5('0x1a')&&typeof _0x2f9a66[_0x87b5('0x1b')]==='undefined';var _0x1576a2=_0x23610c[_0x87b5('0x1c')];var _0x4736cb=_0x15e82c?0x0:_0x2f9a66['offset'];var _0x8f0ba8=_0x15e82c?_0x23610c['count']:_0x2f9a66[_0x87b5('0x19')]+_0x2f9a66[_0x87b5('0x1b')];var _0x280f87;if(_0x8f0ba8>=_0x1576a2){_0x8f0ba8=_0x1576a2;_0x280f87=0xc8;}else{_0x280f87=0xce;}_0x4588aa[_0x87b5('0x17')](_0x280f87);return _0x4588aa['set'](_0x87b5('0x1d'),_0x4736cb+'-'+_0x8f0ba8+'/'+_0x1576a2)['json'](_0x23610c);}return null;};}function patchUpdates(_0x4a03cd){return function(_0x316746){try{jsonpatch[_0x87b5('0x1e')](_0x316746,_0x4a03cd,!![]);}catch(_0x4e32a8){return BPromise['reject'](_0x4e32a8);}return _0x316746['save']();};}function saveUpdates(_0x5c934f,_0x5337c7){return function(_0x251d49){if(_0x251d49){return _0x251d49[_0x87b5('0x1f')](_0x5c934f)[_0x87b5('0x20')](function(_0x2bdc3a){return _0x2bdc3a;});}return null;};}function removeEntity(_0x2af5b4,_0x3a30fc){return function(_0x3e44e3){if(_0x3e44e3){return _0x3e44e3['destroy']()['then'](function(){var _0x456cd4=_0x3e44e3['get']({'plain':!![]});var _0x178586=_0x87b5('0x21');return db[_0x87b5('0x22')][_0x87b5('0x23')]({'where':{'type':_0x178586,'resourceId':_0x456cd4['id']}})['then'](function(){return _0x3e44e3;});})['then'](function(){_0x2af5b4[_0x87b5('0x17')](0xcc)[_0x87b5('0x16')]();});}};}function handleEntityNotFound(_0x4cc6a1,_0x51c07c){return function(_0x27cc26){if(!_0x27cc26){_0x4cc6a1[_0x87b5('0x15')](0x194);}return _0x27cc26;};}function handleError(_0x332cea,_0x2cdcf3){_0x2cdcf3=_0x2cdcf3||0x1f4;return function(_0x5c4655){logger[_0x87b5('0x24')](_0x5c4655[_0x87b5('0x25')]);if(_0x5c4655[_0x87b5('0x26')]){delete _0x5c4655[_0x87b5('0x26')];}_0x332cea[_0x87b5('0x17')](_0x2cdcf3)[_0x87b5('0x27')](_0x5c4655);};}exports[_0x87b5('0x28')]=function(_0x27b054,_0x4261e6){var _0x44cc5e={},_0x35e8a9={},_0x187f2b={'count':0x0,'rows':[]};var _0x179465=_['map'](db['SquareOdbc'][_0x87b5('0x29')],function(_0x22b54d){return{'name':_0x22b54d[_0x87b5('0x2a')],'type':_0x22b54d['type'][_0x87b5('0x2b')]};});_0x35e8a9['model']=_['map'](_0x179465,_0x87b5('0x26'));_0x35e8a9[_0x87b5('0x2c')]=_['keys'](_0x27b054[_0x87b5('0x2c')]);_0x35e8a9[_0x87b5('0x2d')]=_[_0x87b5('0x2e')](_0x35e8a9[_0x87b5('0x2f')],_0x35e8a9[_0x87b5('0x2c')]);_0x44cc5e[_0x87b5('0x30')]=_['intersection'](_0x35e8a9['model'],qs[_0x87b5('0x31')](_0x27b054['query'][_0x87b5('0x31')]));_0x44cc5e[_0x87b5('0x30')]=_0x44cc5e[_0x87b5('0x30')]['length']?_0x44cc5e[_0x87b5('0x30')]:_0x35e8a9[_0x87b5('0x2f')];if(!_0x27b054[_0x87b5('0x2c')][_0x87b5('0x32')](_0x87b5('0x33'))){_0x44cc5e['limit']=qs[_0x87b5('0x1b')](_0x27b054['query'][_0x87b5('0x1b')]);_0x44cc5e['offset']=qs[_0x87b5('0x19')](_0x27b054[_0x87b5('0x2c')]['offset']);}_0x44cc5e[_0x87b5('0x34')]=qs['sort'](_0x27b054[_0x87b5('0x2c')][_0x87b5('0x35')]);_0x44cc5e[_0x87b5('0x36')]=qs[_0x87b5('0x2d')](_[_0x87b5('0x37')](_0x27b054[_0x87b5('0x2c')],_0x35e8a9[_0x87b5('0x2d')]),_0x179465);if(_0x27b054['query'][_0x87b5('0x38')]){_0x44cc5e['where']=_[_0x87b5('0x39')](_0x44cc5e[_0x87b5('0x36')],{'$or':_[_0x87b5('0x3a')](_0x179465,function(_0x33cfd4){if(_0x33cfd4['type']!==_0x87b5('0x3b')){var _0x51d481={};_0x51d481[_0x33cfd4[_0x87b5('0x26')]]={'$like':'%'+_0x27b054[_0x87b5('0x2c')][_0x87b5('0x38')]+'%'};return _0x51d481;}})});}_0x44cc5e=_['merge']({},_0x44cc5e,_0x27b054[_0x87b5('0x3c')]);var _0x559805={'where':_0x44cc5e[_0x87b5('0x36')]};return db[_0x87b5('0x3d')]['count'](_0x559805)[_0x87b5('0x20')](function(_0x504d6e){_0x187f2b[_0x87b5('0x1c')]=_0x504d6e;if(_0x27b054[_0x87b5('0x2c')][_0x87b5('0x3e')]){_0x44cc5e[_0x87b5('0x3f')]=[{'all':!![]}];}return db[_0x87b5('0x3d')][_0x87b5('0x40')](_0x44cc5e);})[_0x87b5('0x20')](function(_0x3c6297){_0x187f2b[_0x87b5('0x41')]=_0x3c6297;return _0x187f2b;})[_0x87b5('0x20')](respondWithFilteredResult(_0x4261e6,_0x44cc5e))['catch'](handleError(_0x4261e6,null));};exports[_0x87b5('0x42')]=function(_0x207130,_0x27bf8f){var _0x1b2977={'raw':!![],'where':{'id':_0x207130['params']['id']}},_0x4356f0={};_0x4356f0[_0x87b5('0x2f')]=_[_0x87b5('0x43')](db[_0x87b5('0x3d')][_0x87b5('0x29')]);_0x4356f0[_0x87b5('0x2c')]=_[_0x87b5('0x43')](_0x207130[_0x87b5('0x2c')]);_0x4356f0[_0x87b5('0x2d')]=_[_0x87b5('0x2e')](_0x4356f0[_0x87b5('0x2f')],_0x4356f0[_0x87b5('0x2c')]);_0x1b2977['attributes']=_['intersection'](_0x4356f0[_0x87b5('0x2f')],qs['fields'](_0x207130[_0x87b5('0x2c')][_0x87b5('0x31')]));_0x1b2977[_0x87b5('0x30')]=_0x1b2977[_0x87b5('0x30')]['length']?_0x1b2977[_0x87b5('0x30')]:_0x4356f0[_0x87b5('0x2f')];if(_0x207130[_0x87b5('0x2c')][_0x87b5('0x3e')]){_0x1b2977[_0x87b5('0x3f')]=[{'all':!![]}];}_0x1b2977=_['merge']({},_0x1b2977,_0x207130['options']);return db['SquareOdbc'][_0x87b5('0x44')](_0x1b2977)[_0x87b5('0x20')](handleEntityNotFound(_0x27bf8f,null))[_0x87b5('0x20')](respondWithResult(_0x27bf8f,null))['catch'](handleError(_0x27bf8f,null));};exports[_0x87b5('0x45')]=function(_0x288f54,_0x426a91){return db[_0x87b5('0x3d')][_0x87b5('0x45')](_0x288f54['body'],{})[_0x87b5('0x20')](function(_0x12094b){var _0x2b5e0f=_0x288f54[_0x87b5('0x46')][_0x87b5('0x47')]({'plain':!![]});if(!_0x2b5e0f)throw new Error(_0x87b5('0x48'));if(_0x2b5e0f['role']===_0x87b5('0x46')){var _0xdc18ab=_0x12094b[_0x87b5('0x47')]({'plain':!![]});var _0x2f1955=_0x87b5('0x21');return db[_0x87b5('0x49')][_0x87b5('0x44')]({'where':{'name':_0x2f1955,'userProfileId':_0x2b5e0f[_0x87b5('0x4a')]},'raw':!![]})['then'](function(_0x2a2d01){if(_0x2a2d01&&_0x2a2d01[_0x87b5('0x4b')]===0x0){return db[_0x87b5('0x22')][_0x87b5('0x45')]({'name':_0xdc18ab[_0x87b5('0x26')],'resourceId':_0xdc18ab['id'],'type':_0x2a2d01[_0x87b5('0x26')],'sectionId':_0x2a2d01['id']},{})[_0x87b5('0x20')](function(){return _0x12094b;});}else{return _0x12094b;}})[_0x87b5('0x4c')](function(_0x4fd1ea){logger[_0x87b5('0x24')](_0x87b5('0x4d'),_0x4fd1ea);throw _0x4fd1ea;});}return _0x12094b;})[_0x87b5('0x20')](respondWithResult(_0x426a91,0xc9))[_0x87b5('0x4c')](handleError(_0x426a91,null));};exports[_0x87b5('0x1f')]=function(_0x5d2625,_0x53359d){if(_0x5d2625['body']['id']){delete _0x5d2625[_0x87b5('0x4e')]['id'];}return db[_0x87b5('0x3d')]['find']({'where':{'id':_0x5d2625['params']['id']}})[_0x87b5('0x20')](handleEntityNotFound(_0x53359d,null))[_0x87b5('0x20')](saveUpdates(_0x5d2625[_0x87b5('0x4e')],null))[_0x87b5('0x20')](respondWithResult(_0x53359d,null))[_0x87b5('0x4c')](handleError(_0x53359d,null));};exports[_0x87b5('0x23')]=function(_0x24bdc3,_0x104836){return db[_0x87b5('0x3d')]['find']({'where':{'id':_0x24bdc3[_0x87b5('0x4f')]['id']}})[_0x87b5('0x20')](handleEntityNotFound(_0x104836,null))[_0x87b5('0x20')](removeEntity(_0x104836,null))[_0x87b5('0x4c')](handleError(_0x104836,null));};exports['test']=function(_0x1c0cb8,_0x449488,_0x8575cc){var _0x49d239;return db[_0x87b5('0x3d')][_0x87b5('0x44')]({'where':{'id':_0x1c0cb8[_0x87b5('0x4f')]['id']},'attributes':['id','dsn']})[_0x87b5('0x20')](handleEntityNotFound(_0x449488,null))[_0x87b5('0x20')](function(_0x146bd9){if(_0x146bd9){var _0x26630f=require(_0x87b5('0x50'))();_0x26630f[_0x87b5('0x51')](_0x146bd9['dsn']);_0x26630f['closeSync']();return _0x146bd9;}})['then'](respondWithResult(_0x449488,null))[_0x87b5('0x4c')](handleError(_0x449488,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f3e5c7a..6f0191c 100644 --- a/server/api/squareOdbc/squareOdbc.model.js +++ b/server/api/squareOdbc/squareOdbc.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88f1=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x88f1,0x1a4));var _0x188f=function(_0x82cdf0,_0x4525b2){_0x82cdf0=_0x82cdf0-0x0;var _0x418d8d=_0x88f1[_0x82cdf0];return _0x418d8d;};'use strict';var _=require(_0x188f('0x0'));var util=require(_0x188f('0x1'));var logger=require(_0x188f('0x2'))(_0x188f('0x3'));var moment=require(_0x188f('0x4'));var BPromise=require(_0x188f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x188f('0x6'));var rimraf=require('rimraf');var config=require(_0x188f('0x7'));var attributes=require(_0x188f('0x8'));module[_0x188f('0x9')]=function(_0x55e297,_0x19e2f3){return _0x55e297[_0x188f('0xa')](_0x188f('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf54b=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf54b,0x1d9));var _0xbf54=function(_0x1a0139,_0xf3f49b){_0x1a0139=_0x1a0139-0x0;var _0x111033=_0xf54b[_0x1a0139];return _0x111033;};'use strict';var _=require('lodash');var util=require(_0xbf54('0x0'));var logger=require(_0xbf54('0x1'))(_0xbf54('0x2'));var moment=require('moment');var BPromise=require(_0xbf54('0x3'));var rp=require(_0xbf54('0x4'));var fs=require('fs');var path=require(_0xbf54('0x5'));var rimraf=require(_0xbf54('0x6'));var config=require(_0xbf54('0x7'));var attributes=require(_0xbf54('0x8'));module[_0xbf54('0x9')]=function(_0x4a0491,_0x2118d1){return _0x4a0491[_0xbf54('0xa')](_0xbf54('0xb'),attributes,{'tableName':_0xbf54('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index e8c9071..a697e64 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7ac=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SquareOdbc','options','where','attributes','map','include','model','ShowSquareOdbc'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xc7ac,0x136));var _0xcc7a=function(_0x38eec3,_0x4b9ef2){_0x38eec3=_0x38eec3-0x0;var _0x761220=_0xc7ac[_0x38eec3];return _0x761220;};'use strict';var _=require(_0xcc7a('0x0'));var util=require(_0xcc7a('0x1'));var moment=require(_0xcc7a('0x2'));var BPromise=require(_0xcc7a('0x3'));var rs=require(_0xcc7a('0x4'));var fs=require('fs');var Redis=require(_0xcc7a('0x5'));var db=require(_0xcc7a('0x6'))['db'];var utils=require(_0xcc7a('0x7'));var logger=require(_0xcc7a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc7a('0x9')][_0xcc7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dad95,_0xabd0ed,_0x2180f5){return new BPromise(function(_0x40b801,_0x26a146){return client[_0xcc7a('0xb')](_0x5dad95,_0x2180f5)[_0xcc7a('0xc')](function(_0x148b85){logger['info'](_0xcc7a('0xd'),_0xabd0ed,_0xcc7a('0xe'));logger['debug'](_0xcc7a('0xf'),_0xabd0ed,'request\x20sent',JSON[_0xcc7a('0x10')](_0x148b85));if(_0x148b85['error']){if(_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x12')]===0x1f4){logger['error'](_0xcc7a('0xd'),_0xabd0ed,_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x13')]);return _0x26a146(_0x148b85[_0xcc7a('0x11')][_0xcc7a('0x13')]);}logger[_0xcc7a('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xabd0ed,_0x148b85['error'][_0xcc7a('0x13')]);return _0x40b801(_0x148b85['error'][_0xcc7a('0x13')]);}else{logger[_0xcc7a('0x14')]('SquareOdbc,\x20%s,\x20%s',_0xabd0ed,'request\x20sent');_0x40b801(_0x148b85[_0xcc7a('0x15')]['message']);}})[_0xcc7a('0x16')](function(_0x2a16b1){logger['error'](_0xcc7a('0xd'),_0xabd0ed,_0x2a16b1);_0x26a146(_0x2a16b1);});});}exports['ShowSquareOdbc']=function(_0x586eb6){var _0x5d8be8=this;return new Promise(function(_0x52140c,_0x1e99e4){return db[_0xcc7a('0x17')]['find']({'raw':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x19')]||null:null,'attributes':_0x586eb6[_0xcc7a('0x18')]?_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x1a')]||null:null,'include':_0x586eb6['options']?_0x586eb6[_0xcc7a('0x18')]['include']?_[_0xcc7a('0x1b')](_0x586eb6[_0xcc7a('0x18')][_0xcc7a('0x1c')],function(_0x22ce83){return{'model':db[_0x22ce83[_0xcc7a('0x1d')]],'as':_0x22ce83['as'],'attributes':_0x22ce83['attributes'],'include':_0x22ce83[_0xcc7a('0x1c')]?_[_0xcc7a('0x1b')](_0x22ce83[_0xcc7a('0x1c')],function(_0x416dbc){return{'model':db[_0x416dbc[_0xcc7a('0x1d')]],'as':_0x416dbc['as'],'attributes':_0x416dbc['attributes'],'include':_0x416dbc[_0xcc7a('0x1c')]?_[_0xcc7a('0x1b')](_0x416dbc[_0xcc7a('0x1c')],function(_0x151969){return{'model':db[_0x151969[_0xcc7a('0x1d')]],'as':_0x151969['as'],'attributes':_0x151969[_0xcc7a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcc7a('0xc')](function(_0x2b0127){logger[_0xcc7a('0x14')]('ShowSquareOdbc',_0x586eb6);logger['debug'](_0xcc7a('0x1e'),_0x586eb6,JSON['stringify'](_0x2b0127));_0x52140c(_0x2b0127);})[_0xcc7a('0x16')](function(_0x4d82f3){logger[_0xcc7a('0x11')](_0xcc7a('0x1e'),_0x4d82f3['message'],_0x586eb6);_0x1e99e4(_0x5d8be8[_0xcc7a('0x11')](0x1f4,_0x4d82f3['message']));});});}; \ No newline at end of file +var _0x6e8a=['result','catch','find','options','raw','include','map','model','attributes','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e8a,0x14a));var _0xa6e8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x6e8a[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0xa6e8('0x0'));var util=require(_0xa6e8('0x1'));var moment=require(_0xa6e8('0x2'));var BPromise=require(_0xa6e8('0x3'));var rs=require(_0xa6e8('0x4'));var fs=require('fs');var Redis=require(_0xa6e8('0x5'));var db=require(_0xa6e8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6e8('0x7'))(_0xa6e8('0x8'));var config=require(_0xa6e8('0x9'));var jayson=require(_0xa6e8('0xa'));var client=jayson[_0xa6e8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419799,_0x534e2d,_0x3d0619){return new BPromise(function(_0x4c78ed,_0x4e3c45){return client['request'](_0x419799,_0x3d0619)[_0xa6e8('0xc')](function(_0x47bbb9){logger[_0xa6e8('0xd')](_0xa6e8('0xe'),_0x534e2d,_0xa6e8('0xf'));logger[_0xa6e8('0x10')](_0xa6e8('0x11'),_0x534e2d,_0xa6e8('0xf'),JSON[_0xa6e8('0x12')](_0x47bbb9));if(_0x47bbb9['error']){if(_0x47bbb9['error'][_0xa6e8('0x13')]===0x1f4){logger['error'](_0xa6e8('0xe'),_0x534e2d,_0x47bbb9['error']['message']);return _0x4e3c45(_0x47bbb9[_0xa6e8('0x14')]['message']);}logger[_0xa6e8('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x534e2d,_0x47bbb9[_0xa6e8('0x14')][_0xa6e8('0x15')]);return _0x4c78ed(_0x47bbb9[_0xa6e8('0x14')]['message']);}else{logger['info'](_0xa6e8('0xe'),_0x534e2d,_0xa6e8('0xf'));_0x4c78ed(_0x47bbb9[_0xa6e8('0x16')][_0xa6e8('0x15')]);}})[_0xa6e8('0x17')](function(_0x52dc5e){logger['error'](_0xa6e8('0xe'),_0x534e2d,_0x52dc5e);_0x4e3c45(_0x52dc5e);});});}exports['ShowSquareOdbc']=function(_0x367914){var _0x4145e2=this;return new Promise(function(_0x5b1613,_0x2301f6){return db['SquareOdbc'][_0xa6e8('0x18')]({'raw':_0x367914[_0xa6e8('0x19')]?_0x367914[_0xa6e8('0x19')][_0xa6e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x367914[_0xa6e8('0x19')]?_0x367914[_0xa6e8('0x19')]['where']||null:null,'attributes':_0x367914[_0xa6e8('0x19')]?_0x367914[_0xa6e8('0x19')]['attributes']||null:null,'include':_0x367914[_0xa6e8('0x19')]?_0x367914[_0xa6e8('0x19')][_0xa6e8('0x1b')]?_[_0xa6e8('0x1c')](_0x367914[_0xa6e8('0x19')][_0xa6e8('0x1b')],function(_0x38f4ab){return{'model':db[_0x38f4ab[_0xa6e8('0x1d')]],'as':_0x38f4ab['as'],'attributes':_0x38f4ab['attributes'],'include':_0x38f4ab[_0xa6e8('0x1b')]?_[_0xa6e8('0x1c')](_0x38f4ab[_0xa6e8('0x1b')],function(_0x3ed893){return{'model':db[_0x3ed893[_0xa6e8('0x1d')]],'as':_0x3ed893['as'],'attributes':_0x3ed893[_0xa6e8('0x1e')],'include':_0x3ed893['include']?_[_0xa6e8('0x1c')](_0x3ed893[_0xa6e8('0x1b')],function(_0xca1928){return{'model':db[_0xca1928['model']],'as':_0xca1928['as'],'attributes':_0xca1928[_0xa6e8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa6e8('0xc')](function(_0x5c1f39){logger[_0xa6e8('0xd')](_0xa6e8('0x1f'),_0x367914);logger['debug'](_0xa6e8('0x1f'),_0x367914,JSON[_0xa6e8('0x12')](_0x5c1f39));_0x5b1613(_0x5c1f39);})['catch'](function(_0x54c555){logger[_0xa6e8('0x14')](_0xa6e8('0x1f'),_0x54c555[_0xa6e8('0x15')],_0x367914);_0x2301f6(_0x4145e2[_0xa6e8('0x14')](0x1f4,_0x54c555[_0xa6e8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d89bdd0..3186df7 100644 --- a/server/api/squareProject/index.js +++ b/server/api/squareProject/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa03c=['delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update'];(function(_0x244961,_0xdb54c4){var _0x1f15de=function(_0x1709e1){while(--_0x1709e1){_0x244961['push'](_0x244961['shift']());}};_0x1f15de(++_0xdb54c4);}(_0xa03c,0x94));var _0xca03=function(_0x2695dd,_0x1986b1){_0x2695dd=_0x2695dd-0x0;var _0x361e8a=_0xa03c[_0x2695dd];return _0x361e8a;};'use strict';var multer=require(_0xca03('0x0'));var util=require('util');var path=require(_0xca03('0x1'));var timeout=require(_0xca03('0x2'));var express=require(_0xca03('0x3'));var router=express['Router']();var fs_extra=require(_0xca03('0x4'));var auth=require(_0xca03('0x5'));var interaction=require(_0xca03('0x6'));var config=require('../../config/environment');var controller=require(_0xca03('0x7'));router[_0xca03('0x8')]('/',auth[_0xca03('0x9')](),controller[_0xca03('0xa')]);router[_0xca03('0x8')](_0xca03('0xb'),auth['isAuthenticated'](),controller[_0xca03('0xc')]);router[_0xca03('0x8')](_0xca03('0xd'),auth[_0xca03('0x9')](),controller[_0xca03('0xe')]);router[_0xca03('0xf')]('/',auth[_0xca03('0x9')](),controller[_0xca03('0x10')]);router[_0xca03('0xf')](_0xca03('0xd'),auth['isAuthenticated'](),controller[_0xca03('0x11')]);router[_0xca03('0x12')](_0xca03('0xb'),auth[_0xca03('0x9')](),controller[_0xca03('0x13')]);router[_0xca03('0x14')](_0xca03('0xb'),auth[_0xca03('0x9')](),controller[_0xca03('0x15')]);router[_0xca03('0x14')](_0xca03('0xd'),auth[_0xca03('0x9')](),controller[_0xca03('0x16')]);module[_0xca03('0x17')]=router; \ No newline at end of file +var _0x5227=['isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','create','addUsers','put','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5227,0x1d1));var _0x7522=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x5227[_0x4c0d2b];return _0x58c4fe;};'use strict';var multer=require(_0x7522('0x0'));var util=require(_0x7522('0x1'));var path=require(_0x7522('0x2'));var timeout=require(_0x7522('0x3'));var express=require(_0x7522('0x4'));var router=express[_0x7522('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7522('0x6'));var interaction=require(_0x7522('0x7'));var config=require(_0x7522('0x8'));var controller=require(_0x7522('0x9'));router['get']('/',auth[_0x7522('0xa')](),controller[_0x7522('0xb')]);router[_0x7522('0xc')](_0x7522('0xd'),auth[_0x7522('0xa')](),controller[_0x7522('0xe')]);router[_0x7522('0xc')](_0x7522('0xf'),auth[_0x7522('0xa')](),controller[_0x7522('0x10')]);router[_0x7522('0x11')]('/',auth[_0x7522('0xa')](),controller[_0x7522('0x12')]);router['post'](_0x7522('0xf'),auth[_0x7522('0xa')](),controller[_0x7522('0x13')]);router[_0x7522('0x14')](_0x7522('0xd'),auth[_0x7522('0xa')](),controller['update']);router[_0x7522('0x15')](_0x7522('0xd'),auth[_0x7522('0xa')](),controller[_0x7522('0x16')]);router[_0x7522('0x15')](_0x7522('0xf'),auth[_0x7522('0xa')](),controller[_0x7522('0x17')]);module[_0x7522('0x18')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a839861..3eff4ed 100644 --- a/server/api/squareProject/squareProject.attributes.js +++ b/server/api/squareProject/squareProject.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf271=['utf8','production','DATE','sequelize','STRING','name','BLOB','long','getDataValue','preproduction','toString'];(function(_0x1fa18a,_0x3be4a9){var _0x1d5a72=function(_0x1c91dc){while(--_0x1c91dc){_0x1fa18a['push'](_0x1fa18a['shift']());}};_0x1d5a72(++_0x3be4a9);}(_0xf271,0x10b));var _0x1f27=function(_0x1f1f7c,_0x4863fe){_0x1f1f7c=_0x1f1f7c-0x0;var _0x277975=_0xf271[_0x1f1f7c];return _0x277975;};'use strict';var Sequelize=require(_0x1f27('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f27('0x1')],'unique':_0x1f27('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x1f27('0x3')](_0x1f27('0x4')),'get':function(){if(this[_0x1f27('0x5')](_0x1f27('0x6'))){return this[_0x1f27('0x5')](_0x1f27('0x6'))[_0x1f27('0x7')](_0x1f27('0x8'));}}},'production':{'type':Sequelize[_0x1f27('0x3')](_0x1f27('0x4')),'get':function(){if(this[_0x1f27('0x5')](_0x1f27('0x9'))){return this[_0x1f27('0x5')](_0x1f27('0x9'))[_0x1f27('0x7')](_0x1f27('0x8'));}}},'savedAt':{'type':Sequelize[_0x1f27('0xa')]},'publishedAt':{'type':Sequelize[_0x1f27('0xa')]}}; \ No newline at end of file +var _0x9ade=['DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x9ade,0xde));var _0xe9ad=function(_0x588901,_0x17249f){_0x588901=_0x588901-0x0;var _0x39c89c=_0x9ade[_0x588901];return _0x39c89c;};'use strict';var Sequelize=require(_0xe9ad('0x0'));module[_0xe9ad('0x1')]={'name':{'type':Sequelize[_0xe9ad('0x2')],'unique':_0xe9ad('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe9ad('0x4')]},'preproduction':{'type':Sequelize[_0xe9ad('0x5')](_0xe9ad('0x6')),'get':function(){if(this[_0xe9ad('0x7')](_0xe9ad('0x8'))){return this[_0xe9ad('0x7')](_0xe9ad('0x8'))[_0xe9ad('0x9')](_0xe9ad('0xa'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xe9ad('0xb'))){return this[_0xe9ad('0x7')](_0xe9ad('0xb'))[_0xe9ad('0x9')](_0xe9ad('0xa'));}}},'savedAt':{'type':Sequelize[_0xe9ad('0xc')]},'publishedAt':{'type':Sequelize[_0xe9ad('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1e5dda1..89c097f 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c7=['getUsers','User','order','nolimit','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','stringify','error','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','SquareProject','include','findAll','rows','catch','show','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','publish','agi','production','omit','ids','removeUsers','isArray','emit','userSquareProject:remove'];(function(_0xb47459,_0x591914){var _0x2bb784=function(_0x5727e2){while(--_0x5727e2){_0xb47459['push'](_0xb47459['shift']());}};_0x2bb784(++_0x591914);}(_0xc2c7,0x134));var _0x7c2c=function(_0x14782e,_0x2b7aad){_0x14782e=_0x14782e-0x0;var _0x24cb10=_0xc2c7[_0x14782e];return _0x24cb10;};'use strict';var _=require('lodash');var Redis=require(_0x7c2c('0x0'));var qs=require(_0x7c2c('0x1'));var logger=require(_0x7c2c('0x2'))(_0x7c2c('0x3'));var config=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];config[_0x7c2c('0x6')]=_[_0x7c2c('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7c2c('0x8'))(new Redis(config[_0x7c2c('0x6')]));require(_0x7c2c('0x9'))['register'](socket);function respondWithStatusCode(_0x4abe93,_0x5a1027){_0x5a1027=_0x5a1027||0xcc;return function(_0x2274cd){if(_0x2274cd){return _0x4abe93[_0x7c2c('0xa')](_0x5a1027);}return _0x4abe93[_0x7c2c('0xb')](_0x5a1027)[_0x7c2c('0xc')]();};}function respondWithResult(_0x279cff,_0x57b107){_0x57b107=_0x57b107||0xc8;return function(_0x3093d2){if(_0x3093d2){return _0x279cff[_0x7c2c('0xb')](_0x57b107)[_0x7c2c('0xd')](_0x3093d2);}};}function respondWithFilteredResult(_0x1bfeaf,_0x2587ec){return function(_0x1c66b4){if(_0x1c66b4){var _0x2cb057=typeof _0x2587ec[_0x7c2c('0xe')]===_0x7c2c('0xf')&&typeof _0x2587ec[_0x7c2c('0x10')]===_0x7c2c('0xf');var _0x45847d=_0x1c66b4[_0x7c2c('0x11')];var _0x132133=_0x2cb057?0x0:_0x2587ec[_0x7c2c('0xe')];var _0x29fe58=_0x2cb057?_0x1c66b4['count']:_0x2587ec['offset']+_0x2587ec[_0x7c2c('0x10')];var _0xd1a3db;if(_0x29fe58>=_0x45847d){_0x29fe58=_0x45847d;_0xd1a3db=0xc8;}else{_0xd1a3db=0xce;}_0x1bfeaf[_0x7c2c('0xb')](_0xd1a3db);return _0x1bfeaf['set'](_0x7c2c('0x12'),_0x132133+'-'+_0x29fe58+'/'+_0x45847d)[_0x7c2c('0xd')](_0x1c66b4);}return null;};}function saveUpdates(_0x5e55e0){return function(_0x88f54b){if(_0x88f54b){return _0x88f54b['update'](_0x5e55e0)[_0x7c2c('0x13')](function(_0x51b73c){return _0x51b73c;});}return null;};}function removeEntity(_0x342ea2){return function(_0x3c948a){if(_0x3c948a){return _0x3c948a[_0x7c2c('0x14')]()[_0x7c2c('0x13')](function(){var _0x17df4a=_0x3c948a[_0x7c2c('0x15')]({'plain':!![]});var _0x2c1378=_0x7c2c('0x16');return db[_0x7c2c('0x17')][_0x7c2c('0x14')]({'where':{'type':_0x2c1378,'resourceId':_0x17df4a['id']}})[_0x7c2c('0x13')](function(){return _0x3c948a;});})[_0x7c2c('0x13')](function(){var _0x55116a=new Redis(config[_0x7c2c('0x6')]);_0x55116a['publish']('agi',JSON[_0x7c2c('0x18')]({'id':_0x3c948a['id'],'deleted':!![]}));})[_0x7c2c('0x13')](function(){_0x342ea2[_0x7c2c('0xb')](0xcc)[_0x7c2c('0xc')]();});}};}function handleEntityNotFound(_0x41552f){return function(_0x1883b5){if(!_0x1883b5){_0x41552f[_0x7c2c('0xa')](0x194);}return _0x1883b5;};}function handleError(_0x541368,_0x10c356){_0x10c356=_0x10c356||0x1f4;return function(_0x4dedd8){logger[_0x7c2c('0x19')](_0x4dedd8['stack']);if(_0x4dedd8[_0x7c2c('0x1a')]){delete _0x4dedd8[_0x7c2c('0x1a')];}_0x541368[_0x7c2c('0xb')](_0x10c356)['send'](_0x4dedd8);};}exports['index']=function(_0x31a50c,_0x30c53e){var _0x3d2b8d={},_0x150690={},_0x31d8f3={'count':0x0,'rows':[]};var _0xa8e145=_[_0x7c2c('0x1b')](db['SquareProject'][_0x7c2c('0x1c')],function(_0xf39941){return{'name':_0xf39941[_0x7c2c('0x1d')],'type':_0xf39941[_0x7c2c('0x1e')][_0x7c2c('0x1f')]};});_0x150690[_0x7c2c('0x20')]=_[_0x7c2c('0x1b')](_0xa8e145,_0x7c2c('0x1a'));_0x150690[_0x7c2c('0x21')]=_['keys'](_0x31a50c[_0x7c2c('0x21')]);_0x150690[_0x7c2c('0x22')]=_[_0x7c2c('0x23')](_0x150690[_0x7c2c('0x20')],_0x150690['query']);_0x3d2b8d[_0x7c2c('0x24')]=_[_0x7c2c('0x23')](_0x150690[_0x7c2c('0x20')],qs[_0x7c2c('0x25')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x25')]));_0x3d2b8d[_0x7c2c('0x24')]=_0x3d2b8d['attributes'][_0x7c2c('0x26')]?_0x3d2b8d[_0x7c2c('0x24')]:_0x150690[_0x7c2c('0x20')];if(!_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x27')]('nolimit')){_0x3d2b8d['limit']=qs[_0x7c2c('0x10')](_0x31a50c['query']['limit']);_0x3d2b8d[_0x7c2c('0xe')]=qs[_0x7c2c('0xe')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0xe')]);}_0x3d2b8d['order']=qs[_0x7c2c('0x28')](_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x28')]);_0x3d2b8d[_0x7c2c('0x29')]=qs[_0x7c2c('0x22')](_[_0x7c2c('0x2a')](_0x31a50c[_0x7c2c('0x21')],_0x150690[_0x7c2c('0x22')]),_0xa8e145);if(_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x2b')]){_0x3d2b8d[_0x7c2c('0x29')]=_[_0x7c2c('0x2c')](_0x3d2b8d[_0x7c2c('0x29')],{'$or':_['map'](_0xa8e145,function(_0x54cbb7){if(_0x54cbb7[_0x7c2c('0x1e')]!=='VIRTUAL'){var _0x4c421c={};_0x4c421c[_0x54cbb7['name']]={'$like':'%'+_0x31a50c[_0x7c2c('0x21')][_0x7c2c('0x2b')]+'%'};return _0x4c421c;}})});}_0x3d2b8d=_[_0x7c2c('0x2c')]({},_0x3d2b8d,_0x31a50c[_0x7c2c('0x2d')]);var _0x1cf51e={'where':_0x3d2b8d[_0x7c2c('0x29')]};return db[_0x7c2c('0x2e')][_0x7c2c('0x11')](_0x1cf51e)[_0x7c2c('0x13')](function(_0x3bd119){_0x31d8f3[_0x7c2c('0x11')]=_0x3bd119;if(_0x31a50c['query']['includeAll']){_0x3d2b8d[_0x7c2c('0x2f')]=[{'all':!![]}];}return db[_0x7c2c('0x2e')][_0x7c2c('0x30')](_0x3d2b8d);})[_0x7c2c('0x13')](function(_0x5e8c96){_0x31d8f3[_0x7c2c('0x31')]=_0x5e8c96;return _0x31d8f3;})[_0x7c2c('0x13')](respondWithFilteredResult(_0x30c53e,_0x3d2b8d))[_0x7c2c('0x32')](handleError(_0x30c53e,null));};exports[_0x7c2c('0x33')]=function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'raw':![],'where':{'id':_0x18e288[_0x7c2c('0x34')]['id']}},_0x2e4093={};_0x2e4093['model']=_[_0x7c2c('0x35')](db['SquareProject'][_0x7c2c('0x1c')]);_0x2e4093[_0x7c2c('0x21')]=_['keys'](_0x18e288[_0x7c2c('0x21')]);_0x2e4093['filters']=_[_0x7c2c('0x23')](_0x2e4093[_0x7c2c('0x20')],_0x2e4093[_0x7c2c('0x21')]);_0x12c9cd[_0x7c2c('0x24')]=_['intersection'](_0x2e4093[_0x7c2c('0x20')],qs['fields'](_0x18e288['query'][_0x7c2c('0x25')]));_0x12c9cd[_0x7c2c('0x24')]=_0x12c9cd[_0x7c2c('0x24')]['length']?_0x12c9cd[_0x7c2c('0x24')]:_0x2e4093[_0x7c2c('0x20')];if(_0x18e288['query'][_0x7c2c('0x36')]){_0x12c9cd['include']=[{'all':!![]}];}_0x12c9cd=_[_0x7c2c('0x2c')]({},_0x12c9cd,_0x18e288[_0x7c2c('0x2d')]);return db['SquareProject']['find'](_0x12c9cd)[_0x7c2c('0x13')](handleEntityNotFound(_0x8b0dc9,null))[_0x7c2c('0x13')](respondWithResult(_0x8b0dc9,null))['catch'](handleError(_0x8b0dc9,null));};exports[_0x7c2c('0x37')]=function(_0x58966a,_0x51e3b7){return db[_0x7c2c('0x2e')][_0x7c2c('0x37')](_0x58966a[_0x7c2c('0x38')],{})[_0x7c2c('0x13')](function(_0x6978bc){var _0x23121f=_0x58966a[_0x7c2c('0x39')][_0x7c2c('0x15')]({'plain':!![]});if(!_0x23121f)throw new Error(_0x7c2c('0x3a'));if(_0x23121f['role']==='user'){var _0xeb067b=_0x6978bc[_0x7c2c('0x15')]({'plain':!![]});var _0x3ce2fb='SquareProjects';return db['UserProfileSection'][_0x7c2c('0x3b')]({'where':{'name':_0x3ce2fb,'userProfileId':_0x23121f[_0x7c2c('0x3c')]},'raw':!![]})[_0x7c2c('0x13')](function(_0x2b79d5){if(_0x2b79d5&&_0x2b79d5['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xeb067b[_0x7c2c('0x1a')],'resourceId':_0xeb067b['id'],'type':_0x2b79d5[_0x7c2c('0x1a')],'sectionId':_0x2b79d5['id']},{})[_0x7c2c('0x13')](function(){return _0x6978bc;});}else{return _0x6978bc;}})[_0x7c2c('0x32')](function(_0x438cbd){logger['error'](_0x7c2c('0x3d'),_0x438cbd);throw _0x438cbd;});}return _0x6978bc;})[_0x7c2c('0x13')](respondWithResult(_0x51e3b7,0xc9))['catch'](handleError(_0x51e3b7,null));};exports[_0x7c2c('0x3e')]=function(_0x56e09d,_0xfba6a7){if(_0x56e09d[_0x7c2c('0x38')]['id']){delete _0x56e09d[_0x7c2c('0x38')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x56e09d[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x13')](saveUpdates(_0x56e09d[_0x7c2c('0x38')],null))['then'](function(_0x101205){if(!_0x101205)return;var _0x400d79=_0x101205['get']({'plain':!![]});return _0x400d79;})[_0x7c2c('0x13')](function(_0x5d4d02){var _0x5b242c=new Redis(config[_0x7c2c('0x6')]);_0x5b242c[_0x7c2c('0x3f')](_0x7c2c('0x40'),JSON['stringify'](_[_0x7c2c('0x2a')](_0x5d4d02,['id','name',_0x7c2c('0x41')])));return _0x5d4d02;})[_0x7c2c('0x13')](respondWithResult(_0xfba6a7,null))['catch'](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x14')]=function(_0x3750bf,_0x4404e3){return db[_0x7c2c('0x2e')]['find']({'where':{'id':_0x3750bf[_0x7c2c('0x34')]['id']}})[_0x7c2c('0x13')](handleEntityNotFound(_0x4404e3,null))['then'](removeEntity(_0x4404e3,null))[_0x7c2c('0x32')](handleError(_0x4404e3,null));};exports['addUsers']=function(_0x2b912c,_0x3f2eb0){return db[_0x7c2c('0x2e')][_0x7c2c('0x3b')]({'where':{'id':_0x2b912c[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0x3f2eb0,null))[_0x7c2c('0x13')](function(_0x2ec03e){if(_0x2ec03e){return _0x2ec03e['addUsers'](_0x2b912c['body']['ids'],_[_0x7c2c('0x42')](_0x2b912c['body'],[_0x7c2c('0x43'),'id'])||{});}})['then'](respondWithResult(_0x3f2eb0,null))[_0x7c2c('0x32')](handleError(_0x3f2eb0,null));};exports[_0x7c2c('0x44')]=function(_0x455e69,_0xb2924c){return db[_0x7c2c('0x2e')][_0x7c2c('0x3b')]({'where':{'id':_0x455e69[_0x7c2c('0x34')]['id']}})[_0x7c2c('0x13')](handleEntityNotFound(_0xb2924c,null))['then'](function(_0x570cd3){if(_0x570cd3){return _0x570cd3['removeUsers'](_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')])[_0x7c2c('0x13')](function(){if(_[_0x7c2c('0x45')](_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')])){for(var _0x2d04da=0x0;_0x2d04da<_0x455e69[_0x7c2c('0x21')]['ids']['length'];_0x2d04da+=0x1){socket[_0x7c2c('0x46')](_0x7c2c('0x47'),{'UserId':Number(_0x455e69['query'][_0x7c2c('0x43')][_0x2d04da]),'SquareProjectId':Number(_0x455e69['params']['id'])});}}else{socket['emit'](_0x7c2c('0x47'),{'UserId':Number(_0x455e69[_0x7c2c('0x21')][_0x7c2c('0x43')]),'SquareProjectId':Number(_0x455e69[_0x7c2c('0x34')]['id'])});}});}})[_0x7c2c('0x13')](respondWithStatusCode(_0xb2924c,null))[_0x7c2c('0x32')](handleError(_0xb2924c,null));};exports[_0x7c2c('0x48')]=function(_0x2a4de1,_0xf06cd1){var _0x44b953={};var _0xd01d59={};var _0x43949a;var _0xbe0568;return db[_0x7c2c('0x2e')]['findOne']({'where':{'id':_0x2a4de1[_0x7c2c('0x34')]['id']}})['then'](handleEntityNotFound(_0xf06cd1,null))['then'](function(_0x4c0a69){if(_0x4c0a69){_0x43949a=_0x4c0a69;_0xd01d59['model']=_[_0x7c2c('0x35')](db[_0x7c2c('0x49')][_0x7c2c('0x1c')]);_0xd01d59[_0x7c2c('0x21')]=_[_0x7c2c('0x35')](_0x2a4de1[_0x7c2c('0x21')]);_0xd01d59['filters']=_[_0x7c2c('0x23')](_0xd01d59[_0x7c2c('0x20')],_0xd01d59[_0x7c2c('0x21')]);_0x44b953[_0x7c2c('0x24')]=_[_0x7c2c('0x23')](_0xd01d59[_0x7c2c('0x20')],qs['fields'](_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x25')]));_0x44b953['attributes']=_0x44b953[_0x7c2c('0x24')][_0x7c2c('0x26')]?_0x44b953['attributes']:_0xd01d59[_0x7c2c('0x20')];_0x44b953[_0x7c2c('0x4a')]=qs['sort'](_0x2a4de1['query'][_0x7c2c('0x28')]);_0x44b953['where']=qs[_0x7c2c('0x22')](_['pick'](_0x2a4de1[_0x7c2c('0x21')],_0xd01d59[_0x7c2c('0x22')]));if(_0x2a4de1['query'][_0x7c2c('0x2b')]){_0x44b953['where']=_[_0x7c2c('0x2c')](_0x44b953[_0x7c2c('0x29')],{'$or':_[_0x7c2c('0x1b')](_0x44b953['attributes'],function(_0x37e646){var _0x156b53={};_0x156b53[_0x37e646]={'$like':'%'+_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x2b')]+'%'};return _0x156b53;})});}_0x44b953=_['merge']({},_0x44b953,_0x2a4de1[_0x7c2c('0x2d')]);return _0x43949a[_0x7c2c('0x48')](_0x44b953);}})[_0x7c2c('0x13')](function(_0x1d75ba){if(_0x1d75ba){_0xbe0568=_0x1d75ba[_0x7c2c('0x26')];if(!_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x27')](_0x7c2c('0x4b'))){_0x44b953[_0x7c2c('0x10')]=qs['limit'](_0x2a4de1[_0x7c2c('0x21')][_0x7c2c('0x10')]);_0x44b953['offset']=qs[_0x7c2c('0xe')](_0x2a4de1['query']['offset']);}return _0x43949a[_0x7c2c('0x48')](_0x44b953);}})[_0x7c2c('0x13')](function(_0x17a721){if(_0x17a721){return _0x17a721?{'count':_0xbe0568,'rows':_0x17a721}:null;}})['then'](respondWithResult(_0xf06cd1,null))[_0x7c2c('0x32')](handleError(_0xf06cd1,null));}; \ No newline at end of file +var _0x5c3c=['set','Content-Range','json','then','destroy','SquareProjects','UserProfileResource','publish','agi','error','stack','send','index','SquareProject','type','key','model','map','name','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','rawAttributes','intersection','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','catch','update','stringify','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','end','status','offset','undefined','count','limit'];(function(_0x5d3965,_0x24aa6e){var _0x4d4c23=function(_0x1ade31){while(--_0x1ade31){_0x5d3965['push'](_0x5d3965['shift']());}};_0x4d4c23(++_0x24aa6e);}(_0x5c3c,0x132));var _0xc5c3=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x5c3c[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xc5c3('0x0'));var Redis=require(_0xc5c3('0x1'));var qs=require(_0xc5c3('0x2'));var logger=require(_0xc5c3('0x3'))('api');var config=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];config[_0xc5c3('0x6')]=_[_0xc5c3('0x7')](config[_0xc5c3('0x6')],{'host':_0xc5c3('0x8'),'port':0x18eb});var socket=require(_0xc5c3('0x9'))(new Redis(config[_0xc5c3('0x6')]));require(_0xc5c3('0xa'))['register'](socket);function respondWithStatusCode(_0x4b8404,_0x591f7d){_0x591f7d=_0x591f7d||0xcc;return function(_0x723c31){if(_0x723c31){return _0x4b8404[_0xc5c3('0xb')](_0x591f7d);}return _0x4b8404['status'](_0x591f7d)[_0xc5c3('0xc')]();};}function respondWithResult(_0x46e2c1,_0x52f3eb){_0x52f3eb=_0x52f3eb||0xc8;return function(_0x14140f){if(_0x14140f){return _0x46e2c1[_0xc5c3('0xd')](_0x52f3eb)['json'](_0x14140f);}};}function respondWithFilteredResult(_0x1f2e34,_0x105e43){return function(_0x3b27e8){if(_0x3b27e8){var _0x59fb60=typeof _0x105e43[_0xc5c3('0xe')]===_0xc5c3('0xf')&&typeof _0x105e43['limit']===_0xc5c3('0xf');var _0x44d2b9=_0x3b27e8[_0xc5c3('0x10')];var _0x5ce47d=_0x59fb60?0x0:_0x105e43[_0xc5c3('0xe')];var _0x54fa08=_0x59fb60?_0x3b27e8[_0xc5c3('0x10')]:_0x105e43[_0xc5c3('0xe')]+_0x105e43[_0xc5c3('0x11')];var _0x5f34bb;if(_0x54fa08>=_0x44d2b9){_0x54fa08=_0x44d2b9;_0x5f34bb=0xc8;}else{_0x5f34bb=0xce;}_0x1f2e34['status'](_0x5f34bb);return _0x1f2e34[_0xc5c3('0x12')](_0xc5c3('0x13'),_0x5ce47d+'-'+_0x54fa08+'/'+_0x44d2b9)[_0xc5c3('0x14')](_0x3b27e8);}return null;};}function saveUpdates(_0xef8b21){return function(_0x5ecd4b){if(_0x5ecd4b){return _0x5ecd4b['update'](_0xef8b21)[_0xc5c3('0x15')](function(_0x52cd2e){return _0x52cd2e;});}return null;};}function removeEntity(_0xa9bc84){return function(_0x17ec62){if(_0x17ec62){return _0x17ec62[_0xc5c3('0x16')]()[_0xc5c3('0x15')](function(){var _0x28bae6=_0x17ec62['get']({'plain':!![]});var _0x364f42=_0xc5c3('0x17');return db[_0xc5c3('0x18')][_0xc5c3('0x16')]({'where':{'type':_0x364f42,'resourceId':_0x28bae6['id']}})['then'](function(){return _0x17ec62;});})[_0xc5c3('0x15')](function(){var _0x41578a=new Redis(config[_0xc5c3('0x6')]);_0x41578a[_0xc5c3('0x19')](_0xc5c3('0x1a'),JSON['stringify']({'id':_0x17ec62['id'],'deleted':!![]}));})[_0xc5c3('0x15')](function(){_0xa9bc84[_0xc5c3('0xd')](0xcc)[_0xc5c3('0xc')]();});}};}function handleEntityNotFound(_0x2de266){return function(_0x1c5793){if(!_0x1c5793){_0x2de266[_0xc5c3('0xb')](0x194);}return _0x1c5793;};}function handleError(_0x40ebcc,_0x5996a0){_0x5996a0=_0x5996a0||0x1f4;return function(_0x52d638){logger[_0xc5c3('0x1b')](_0x52d638[_0xc5c3('0x1c')]);if(_0x52d638['name']){delete _0x52d638['name'];}_0x40ebcc[_0xc5c3('0xd')](_0x5996a0)[_0xc5c3('0x1d')](_0x52d638);};}exports[_0xc5c3('0x1e')]=function(_0x52e54a,_0x4af067){var _0x2df06b={},_0x22f607={},_0x20c506={'count':0x0,'rows':[]};var _0x29791c=_['map'](db[_0xc5c3('0x1f')]['rawAttributes'],function(_0x2eacec){return{'name':_0x2eacec['fieldName'],'type':_0x2eacec[_0xc5c3('0x20')][_0xc5c3('0x21')]};});_0x22f607[_0xc5c3('0x22')]=_[_0xc5c3('0x23')](_0x29791c,_0xc5c3('0x24'));_0x22f607[_0xc5c3('0x25')]=_[_0xc5c3('0x26')](_0x52e54a['query']);_0x22f607[_0xc5c3('0x27')]=_['intersection'](_0x22f607[_0xc5c3('0x22')],_0x22f607[_0xc5c3('0x25')]);_0x2df06b['attributes']=_['intersection'](_0x22f607[_0xc5c3('0x22')],qs[_0xc5c3('0x28')](_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0x28')]));_0x2df06b['attributes']=_0x2df06b[_0xc5c3('0x29')][_0xc5c3('0x2a')]?_0x2df06b[_0xc5c3('0x29')]:_0x22f607[_0xc5c3('0x22')];if(!_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0x2b')](_0xc5c3('0x2c'))){_0x2df06b[_0xc5c3('0x11')]=qs[_0xc5c3('0x11')](_0x52e54a['query'][_0xc5c3('0x11')]);_0x2df06b[_0xc5c3('0xe')]=qs[_0xc5c3('0xe')](_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0xe')]);}_0x2df06b[_0xc5c3('0x2d')]=qs[_0xc5c3('0x2e')](_0x52e54a['query']['sort']);_0x2df06b[_0xc5c3('0x2f')]=qs['filters'](_[_0xc5c3('0x30')](_0x52e54a[_0xc5c3('0x25')],_0x22f607[_0xc5c3('0x27')]),_0x29791c);if(_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0x31')]){_0x2df06b['where']=_[_0xc5c3('0x32')](_0x2df06b[_0xc5c3('0x2f')],{'$or':_['map'](_0x29791c,function(_0x29f57d){if(_0x29f57d[_0xc5c3('0x20')]!==_0xc5c3('0x33')){var _0x80d0df={};_0x80d0df[_0x29f57d[_0xc5c3('0x24')]]={'$like':'%'+_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0x31')]+'%'};return _0x80d0df;}})});}_0x2df06b=_[_0xc5c3('0x32')]({},_0x2df06b,_0x52e54a[_0xc5c3('0x34')]);var _0xf4f027={'where':_0x2df06b['where']};return db[_0xc5c3('0x1f')]['count'](_0xf4f027)['then'](function(_0x11c029){_0x20c506[_0xc5c3('0x10')]=_0x11c029;if(_0x52e54a[_0xc5c3('0x25')][_0xc5c3('0x35')]){_0x2df06b[_0xc5c3('0x36')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x2df06b);})[_0xc5c3('0x15')](function(_0xa7cb91){_0x20c506['rows']=_0xa7cb91;return _0x20c506;})[_0xc5c3('0x15')](respondWithFilteredResult(_0x4af067,_0x2df06b))['catch'](handleError(_0x4af067,null));};exports[_0xc5c3('0x37')]=function(_0x2dfd19,_0x44121e){var _0x59c9cb={'raw':![],'where':{'id':_0x2dfd19[_0xc5c3('0x38')]['id']}},_0xca2b9a={};_0xca2b9a['model']=_[_0xc5c3('0x26')](db['SquareProject'][_0xc5c3('0x39')]);_0xca2b9a[_0xc5c3('0x25')]=_['keys'](_0x2dfd19['query']);_0xca2b9a['filters']=_[_0xc5c3('0x3a')](_0xca2b9a[_0xc5c3('0x22')],_0xca2b9a['query']);_0x59c9cb[_0xc5c3('0x29')]=_[_0xc5c3('0x3a')](_0xca2b9a[_0xc5c3('0x22')],qs[_0xc5c3('0x28')](_0x2dfd19['query'][_0xc5c3('0x28')]));_0x59c9cb['attributes']=_0x59c9cb['attributes'][_0xc5c3('0x2a')]?_0x59c9cb[_0xc5c3('0x29')]:_0xca2b9a['model'];if(_0x2dfd19[_0xc5c3('0x25')][_0xc5c3('0x35')]){_0x59c9cb['include']=[{'all':!![]}];}_0x59c9cb=_[_0xc5c3('0x32')]({},_0x59c9cb,_0x2dfd19['options']);return db[_0xc5c3('0x1f')][_0xc5c3('0x3b')](_0x59c9cb)['then'](handleEntityNotFound(_0x44121e,null))[_0xc5c3('0x15')](respondWithResult(_0x44121e,null))['catch'](handleError(_0x44121e,null));};exports[_0xc5c3('0x3c')]=function(_0x30179f,_0x4ce23a){return db[_0xc5c3('0x1f')][_0xc5c3('0x3c')](_0x30179f[_0xc5c3('0x3d')],{})[_0xc5c3('0x15')](function(_0x450c46){var _0x41dca5=_0x30179f['user'][_0xc5c3('0x3e')]({'plain':!![]});if(!_0x41dca5)throw new Error(_0xc5c3('0x3f'));if(_0x41dca5[_0xc5c3('0x40')]===_0xc5c3('0x41')){var _0x23002b=_0x450c46['get']({'plain':!![]});var _0x4cf12b=_0xc5c3('0x17');return db[_0xc5c3('0x42')][_0xc5c3('0x3b')]({'where':{'name':_0x4cf12b,'userProfileId':_0x41dca5['userProfileId']},'raw':!![]})[_0xc5c3('0x15')](function(_0x65f720){if(_0x65f720&&_0x65f720[_0xc5c3('0x43')]===0x0){return db[_0xc5c3('0x18')][_0xc5c3('0x3c')]({'name':_0x23002b[_0xc5c3('0x24')],'resourceId':_0x23002b['id'],'type':_0x65f720[_0xc5c3('0x24')],'sectionId':_0x65f720['id']},{})['then'](function(){return _0x450c46;});}else{return _0x450c46;}})[_0xc5c3('0x44')](function(_0x3ff21e){logger[_0xc5c3('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ff21e);throw _0x3ff21e;});}return _0x450c46;})[_0xc5c3('0x15')](respondWithResult(_0x4ce23a,0xc9))[_0xc5c3('0x44')](handleError(_0x4ce23a,null));};exports[_0xc5c3('0x45')]=function(_0x103bde,_0x21d480){if(_0x103bde['body']['id']){delete _0x103bde[_0xc5c3('0x3d')]['id'];}return db['SquareProject'][_0xc5c3('0x3b')]({'where':{'id':_0x103bde['params']['id']}})[_0xc5c3('0x15')](handleEntityNotFound(_0x21d480,null))[_0xc5c3('0x15')](saveUpdates(_0x103bde[_0xc5c3('0x3d')],null))[_0xc5c3('0x15')](function(_0x1311de){if(!_0x1311de)return;var _0x4be969=_0x1311de[_0xc5c3('0x3e')]({'plain':!![]});return _0x4be969;})[_0xc5c3('0x15')](function(_0x348960){var _0x2baaf6=new Redis(config[_0xc5c3('0x6')]);_0x2baaf6['publish'](_0xc5c3('0x1a'),JSON[_0xc5c3('0x46')](_[_0xc5c3('0x30')](_0x348960,['id','name',_0xc5c3('0x47')])));return _0x348960;})['then'](respondWithResult(_0x21d480,null))['catch'](handleError(_0x21d480,null));};exports[_0xc5c3('0x16')]=function(_0x11a6c4,_0x110105){return db[_0xc5c3('0x1f')][_0xc5c3('0x3b')]({'where':{'id':_0x11a6c4[_0xc5c3('0x38')]['id']}})['then'](handleEntityNotFound(_0x110105,null))[_0xc5c3('0x15')](removeEntity(_0x110105,null))[_0xc5c3('0x44')](handleError(_0x110105,null));};exports[_0xc5c3('0x48')]=function(_0x2a93d8,_0x2df9a6){return db[_0xc5c3('0x1f')][_0xc5c3('0x3b')]({'where':{'id':_0x2a93d8['params']['id']}})['then'](handleEntityNotFound(_0x2df9a6,null))[_0xc5c3('0x15')](function(_0x16c26f){if(_0x16c26f){return _0x16c26f['addUsers'](_0x2a93d8[_0xc5c3('0x3d')][_0xc5c3('0x49')],_[_0xc5c3('0x4a')](_0x2a93d8[_0xc5c3('0x3d')],['ids','id'])||{});}})[_0xc5c3('0x15')](respondWithResult(_0x2df9a6,null))[_0xc5c3('0x44')](handleError(_0x2df9a6,null));};exports[_0xc5c3('0x4b')]=function(_0x314392,_0x1b66bf){return db[_0xc5c3('0x1f')][_0xc5c3('0x3b')]({'where':{'id':_0x314392[_0xc5c3('0x38')]['id']}})[_0xc5c3('0x15')](handleEntityNotFound(_0x1b66bf,null))['then'](function(_0x394c9d){if(_0x394c9d){return _0x394c9d[_0xc5c3('0x4b')](_0x314392[_0xc5c3('0x25')]['ids'])[_0xc5c3('0x15')](function(){if(_[_0xc5c3('0x4c')](_0x314392[_0xc5c3('0x25')][_0xc5c3('0x49')])){for(var _0x32d5e2=0x0;_0x32d5e2<_0x314392['query'][_0xc5c3('0x49')][_0xc5c3('0x2a')];_0x32d5e2+=0x1){socket[_0xc5c3('0x4d')](_0xc5c3('0x4e'),{'UserId':Number(_0x314392[_0xc5c3('0x25')][_0xc5c3('0x49')][_0x32d5e2]),'SquareProjectId':Number(_0x314392[_0xc5c3('0x38')]['id'])});}}else{socket['emit'](_0xc5c3('0x4e'),{'UserId':Number(_0x314392[_0xc5c3('0x25')][_0xc5c3('0x49')]),'SquareProjectId':Number(_0x314392[_0xc5c3('0x38')]['id'])});}});}})[_0xc5c3('0x15')](respondWithStatusCode(_0x1b66bf,null))[_0xc5c3('0x44')](handleError(_0x1b66bf,null));};exports[_0xc5c3('0x4f')]=function(_0x5b9013,_0x485ae9){var _0x200eca={};var _0x33d489={};var _0x1e7e4d;var _0x30ab45;return db[_0xc5c3('0x1f')][_0xc5c3('0x50')]({'where':{'id':_0x5b9013[_0xc5c3('0x38')]['id']}})[_0xc5c3('0x15')](handleEntityNotFound(_0x485ae9,null))[_0xc5c3('0x15')](function(_0x4d3e6f){if(_0x4d3e6f){_0x1e7e4d=_0x4d3e6f;_0x33d489[_0xc5c3('0x22')]=_[_0xc5c3('0x26')](db['User']['rawAttributes']);_0x33d489[_0xc5c3('0x25')]=_[_0xc5c3('0x26')](_0x5b9013[_0xc5c3('0x25')]);_0x33d489[_0xc5c3('0x27')]=_[_0xc5c3('0x3a')](_0x33d489[_0xc5c3('0x22')],_0x33d489[_0xc5c3('0x25')]);_0x200eca[_0xc5c3('0x29')]=_[_0xc5c3('0x3a')](_0x33d489['model'],qs[_0xc5c3('0x28')](_0x5b9013[_0xc5c3('0x25')][_0xc5c3('0x28')]));_0x200eca[_0xc5c3('0x29')]=_0x200eca[_0xc5c3('0x29')][_0xc5c3('0x2a')]?_0x200eca[_0xc5c3('0x29')]:_0x33d489[_0xc5c3('0x22')];_0x200eca[_0xc5c3('0x2d')]=qs[_0xc5c3('0x2e')](_0x5b9013[_0xc5c3('0x25')]['sort']);_0x200eca['where']=qs[_0xc5c3('0x27')](_[_0xc5c3('0x30')](_0x5b9013[_0xc5c3('0x25')],_0x33d489[_0xc5c3('0x27')]));if(_0x5b9013[_0xc5c3('0x25')][_0xc5c3('0x31')]){_0x200eca[_0xc5c3('0x2f')]=_[_0xc5c3('0x32')](_0x200eca[_0xc5c3('0x2f')],{'$or':_[_0xc5c3('0x23')](_0x200eca[_0xc5c3('0x29')],function(_0x237fdf){var _0x4a3f71={};_0x4a3f71[_0x237fdf]={'$like':'%'+_0x5b9013[_0xc5c3('0x25')]['filter']+'%'};return _0x4a3f71;})});}_0x200eca=_[_0xc5c3('0x32')]({},_0x200eca,_0x5b9013[_0xc5c3('0x34')]);return _0x1e7e4d[_0xc5c3('0x4f')](_0x200eca);}})[_0xc5c3('0x15')](function(_0x15ba91){if(_0x15ba91){_0x30ab45=_0x15ba91[_0xc5c3('0x2a')];if(!_0x5b9013[_0xc5c3('0x25')][_0xc5c3('0x2b')]('nolimit')){_0x200eca[_0xc5c3('0x11')]=qs[_0xc5c3('0x11')](_0x5b9013[_0xc5c3('0x25')]['limit']);_0x200eca['offset']=qs[_0xc5c3('0xe')](_0x5b9013['query'][_0xc5c3('0xe')]);}return _0x1e7e4d[_0xc5c3('0x4f')](_0x200eca);}})[_0xc5c3('0x15')](function(_0x5f42d5){if(_0x5f42d5){return _0x5f42d5?{'count':_0x30ab45,'rows':_0x5f42d5}:null;}})[_0xc5c3('0x15')](respondWithResult(_0x485ae9,null))['catch'](handleError(_0x485ae9,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index c70d526..a677e4c 100644 --- a/server/api/squareProject/squareProject.events.js +++ b/server/api/squareProject/squareProject.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ed0=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x2d3206,_0x434cf5){var _0x18702d=function(_0x4e0735){while(--_0x4e0735){_0x2d3206['push'](_0x2d3206['shift']());}};_0x18702d(++_0x434cf5);}(_0x3ed0,0xf7));var _0x03ed=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x3ed0[_0x2d9e27];return _0xd35381;};'use strict';var EventEmitter=require(_0x03ed('0x0'));var SquareProject=require(_0x03ed('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x03ed('0x2')](0x0);var events={'afterCreate':_0x03ed('0x3'),'afterUpdate':_0x03ed('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14ae44){return function(_0x150a66,_0x550d92,_0x2857e7){SquareProjectEvents[_0x03ed('0x5')](_0x14ae44+':'+_0x150a66['id'],_0x150a66);SquareProjectEvents[_0x03ed('0x5')](_0x14ae44,_0x150a66);_0x2857e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x03ed('0x6')](e,emitEvent(event));}}module[_0x03ed('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x87ce=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3d27b9,_0x3b0802){var _0x38b850=function(_0x57e18a){while(--_0x57e18a){_0x3d27b9['push'](_0x3d27b9['shift']());}};_0x38b850(++_0x3b0802);}(_0x87ce,0x1c1));var _0xe87c=function(_0x37c40d,_0x21d7d6){_0x37c40d=_0x37c40d-0x0;var _0x577fc5=_0x87ce[_0x37c40d];return _0x577fc5;};'use strict';var EventEmitter=require(_0xe87c('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xe87c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe87c('0x2')](0x0);var events={'afterCreate':_0xe87c('0x3'),'afterUpdate':_0xe87c('0x4'),'afterDestroy':_0xe87c('0x5')};function emitEvent(_0x35b710){return function(_0x4d3fac,_0x45f10a,_0x3fe721){SquareProjectEvents[_0xe87c('0x6')](_0x35b710+':'+_0x4d3fac['id'],_0x4d3fac);SquareProjectEvents[_0xe87c('0x6')](_0x35b710,_0x4d3fac);_0x3fe721(null);};}for(var e in events){if(events[_0xe87c('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe87c('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index dfb38a9..8506d9a 100644 --- a/server/api/squareProject/squareProject.model.js +++ b/server/api/squareProject/squareProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x676e=['moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','changed','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','../../config/logger','api'];(function(_0x35e5b3,_0x3864f8){var _0x548d54=function(_0x4926fd){while(--_0x4926fd){_0x35e5b3['push'](_0x35e5b3['shift']());}};_0x548d54(++_0x3864f8);}(_0x676e,0x85));var _0xe676=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x676e[_0x28509b];return _0x1e0b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe676('0x0'))(_0xe676('0x1'));var moment=require(_0xe676('0x2'));var BPromise=require('bluebird');var rp=require(_0xe676('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe676('0x4'));var config=require(_0xe676('0x5'));var attributes=require(_0xe676('0x6'));module[_0xe676('0x7')]=function(_0x1bcc8b,_0x3feffa){return _0x1bcc8b[_0xe676('0x8')](_0xe676('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29d0cf,_0x50190d,_0x2ad782){if(_0x29d0cf[_0xe676('0xa')]('preproduction')){_0x29d0cf['savedAt']=moment()['format'](_0xe676('0xb'));}if(_0x29d0cf[_0xe676('0xa')](_0xe676('0xc'))){_0x29d0cf[_0xe676('0xd')]=moment()[_0xe676('0xe')](_0xe676('0xb'));}_0x2ad782(null,_0x29d0cf);}}});}; \ No newline at end of file +var _0x7b05=['exports','SquareProject','square_projects','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b05,0x1d1));var _0x57b0=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x7b05[_0x15fc7a];return _0x3aa9f4;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var logger=require(_0x57b0('0x2'))(_0x57b0('0x3'));var moment=require(_0x57b0('0x4'));var BPromise=require(_0x57b0('0x5'));var rp=require(_0x57b0('0x6'));var fs=require('fs');var path=require(_0x57b0('0x7'));var rimraf=require(_0x57b0('0x8'));var config=require(_0x57b0('0x9'));var attributes=require('./squareProject.attributes');module[_0x57b0('0xa')]=function(_0xed0976,_0x1031af){return _0xed0976['define'](_0x57b0('0xb'),attributes,{'tableName':_0x57b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x87d1f0,_0x5ad144,_0x4b601d){if(_0x87d1f0['changed']('preproduction')){_0x87d1f0[_0x57b0('0xd')]=moment()[_0x57b0('0xe')](_0x57b0('0xf'));}if(_0x87d1f0[_0x57b0('0x10')](_0x57b0('0x11'))){_0x87d1f0[_0x57b0('0x12')]=moment()[_0x57b0('0xe')](_0x57b0('0xf'));}_0x4b601d(null,_0x87d1f0);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e1d7af0..e70ea25 100644 --- a/server/api/squareProject/squareProject.rpc.js +++ b/server/api/squareProject/squareProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bf4=['redis','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','where','attributes','limit','map','include','model','then','info','debug','GetSquareProjects','catch','message','error','ShowSquareProject','raw','lodash','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x476e31,_0x1284b9){var _0x1620c9=function(_0x91b680){while(--_0x91b680){_0x476e31['push'](_0x476e31['shift']());}};_0x1620c9(++_0x1284b9);}(_0x4bf4,0x19f));var _0x44bf=function(_0x4b8bec,_0x334ef3){_0x4b8bec=_0x4b8bec-0x0;var _0x38e0f5=_0x4bf4[_0x4b8bec];return _0x38e0f5;};'use strict';var _=require(_0x44bf('0x0'));var Redis=require(_0x44bf('0x1'));var db=require(_0x44bf('0x2'))['db'];var logger=require('../../config/logger')(_0x44bf('0x3'));var config=require(_0x44bf('0x4'));config['redis']=_['defaults'](config[_0x44bf('0x5')],{'host':_0x44bf('0x6'),'port':0x18eb});var socket=require(_0x44bf('0x7'))(new Redis(config[_0x44bf('0x5')]));require(_0x44bf('0x8'))[_0x44bf('0x9')](socket);exports['GetSquareProjects']=function(_0x40f4a2){var _0x3d3cee=this;return new Promise(function(_0x5b85cb,_0x580273){return db[_0x44bf('0xa')][_0x44bf('0xb')]({'raw':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')][_0x44bf('0xd')]||null:null,'attributes':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2['options'][_0x44bf('0xe')]||null:null,'limit':_0x40f4a2['options']?_0x40f4a2[_0x44bf('0xc')][_0x44bf('0xf')]||null:null,'include':_0x40f4a2[_0x44bf('0xc')]?_0x40f4a2[_0x44bf('0xc')]['include']?_[_0x44bf('0x10')](_0x40f4a2[_0x44bf('0xc')][_0x44bf('0x11')],function(_0x13b8ae){return{'model':db[_0x13b8ae[_0x44bf('0x12')]],'as':_0x13b8ae['as'],'attributes':_0x13b8ae[_0x44bf('0xe')],'include':_0x13b8ae[_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x13b8ae[_0x44bf('0x11')],function(_0x41c89f){return{'model':db[_0x41c89f[_0x44bf('0x12')]],'as':_0x41c89f['as'],'attributes':_0x41c89f['attributes'],'include':_0x41c89f['include']?_[_0x44bf('0x10')](_0x41c89f[_0x44bf('0x11')],function(_0x54a0d6){return{'model':db[_0x54a0d6['model']],'as':_0x54a0d6['as'],'attributes':_0x54a0d6[_0x44bf('0xe')]};}):[]};}):[]};}):[]:[]})[_0x44bf('0x13')](function(_0x3035a0){logger[_0x44bf('0x14')]('GetSquareProjects',_0x40f4a2);logger[_0x44bf('0x15')](_0x44bf('0x16'),_0x40f4a2,JSON['stringify'](_0x3035a0));_0x5b85cb(_0x3035a0);})[_0x44bf('0x17')](function(_0x18f5d6){logger['error'](_0x44bf('0x16'),_0x18f5d6[_0x44bf('0x18')],_0x40f4a2);_0x580273(_0x3d3cee[_0x44bf('0x19')](0x1f4,_0x18f5d6[_0x44bf('0x18')]));});});};exports[_0x44bf('0x1a')]=function(_0x434f36){var _0x2ce181=this;return new Promise(function(_0x4001fe,_0x3b6674){return db[_0x44bf('0xa')]['find']({'raw':_0x434f36[_0x44bf('0xc')]?_0x434f36[_0x44bf('0xc')][_0x44bf('0x1b')]===undefined?!![]:![]:!![],'where':_0x434f36['options']?_0x434f36['options'][_0x44bf('0xd')]||null:null,'attributes':_0x434f36[_0x44bf('0xc')]?_0x434f36['options'][_0x44bf('0xe')]||null:null,'include':_0x434f36[_0x44bf('0xc')]?_0x434f36[_0x44bf('0xc')][_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x434f36[_0x44bf('0xc')][_0x44bf('0x11')],function(_0x4fb163){return{'model':db[_0x4fb163[_0x44bf('0x12')]],'as':_0x4fb163['as'],'attributes':_0x4fb163[_0x44bf('0xe')],'include':_0x4fb163[_0x44bf('0x11')]?_[_0x44bf('0x10')](_0x4fb163['include'],function(_0x4cbf53){return{'model':db[_0x4cbf53['model']],'as':_0x4cbf53['as'],'attributes':_0x4cbf53[_0x44bf('0xe')],'include':_0x4cbf53[_0x44bf('0x11')]?_['map'](_0x4cbf53[_0x44bf('0x11')],function(_0x268a0b){return{'model':db[_0x268a0b['model']],'as':_0x268a0b['as'],'attributes':_0x268a0b[_0x44bf('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23f731){logger[_0x44bf('0x14')](_0x44bf('0x1a'),_0x434f36);logger['debug'](_0x44bf('0x1a'),_0x434f36,JSON['stringify'](_0x23f731));_0x4001fe(_0x23f731);})[_0x44bf('0x17')](function(_0x1e9094){logger[_0x44bf('0x19')](_0x44bf('0x1a'),_0x1e9094[_0x44bf('0x18')],_0x434f36);_0x3b6674(_0x2ce181['error'](0x1f4,_0x1e9094[_0x44bf('0x18')]));});});}; \ No newline at end of file +var _0xd245=['SquareProject','options','raw','where','attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','register','GetSquareProjects'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xd245,0x82));var _0x5d24=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xd245[_0x6e1239];return _0x418150;};'use strict';var _=require(_0x5d24('0x0'));var Redis=require(_0x5d24('0x1'));var db=require(_0x5d24('0x2'))['db'];var logger=require('../../config/logger')(_0x5d24('0x3'));var config=require('../../config/environment');config[_0x5d24('0x4')]=_[_0x5d24('0x5')](config[_0x5d24('0x4')],{'host':_0x5d24('0x6'),'port':0x18eb});var socket=require(_0x5d24('0x7'))(new Redis(config[_0x5d24('0x4')]));require('./squareProject.socket')[_0x5d24('0x8')](socket);exports[_0x5d24('0x9')]=function(_0x5e5975){var _0x34dade=this;return new Promise(function(_0x5614aa,_0x2a0114){return db[_0x5d24('0xa')]['findAll']({'raw':_0x5e5975[_0x5d24('0xb')]?_0x5e5975[_0x5d24('0xb')][_0x5d24('0xc')]===undefined?!![]:![]:!![],'where':_0x5e5975[_0x5d24('0xb')]?_0x5e5975[_0x5d24('0xb')][_0x5d24('0xd')]||null:null,'attributes':_0x5e5975['options']?_0x5e5975[_0x5d24('0xb')][_0x5d24('0xe')]||null:null,'limit':_0x5e5975[_0x5d24('0xb')]?_0x5e5975[_0x5d24('0xb')][_0x5d24('0xf')]||null:null,'include':_0x5e5975[_0x5d24('0xb')]?_0x5e5975[_0x5d24('0xb')][_0x5d24('0x10')]?_['map'](_0x5e5975[_0x5d24('0xb')][_0x5d24('0x10')],function(_0x233c85){return{'model':db[_0x233c85[_0x5d24('0x11')]],'as':_0x233c85['as'],'attributes':_0x233c85['attributes'],'include':_0x233c85[_0x5d24('0x10')]?_[_0x5d24('0x12')](_0x233c85[_0x5d24('0x10')],function(_0x19b0e2){return{'model':db[_0x19b0e2['model']],'as':_0x19b0e2['as'],'attributes':_0x19b0e2['attributes'],'include':_0x19b0e2[_0x5d24('0x10')]?_[_0x5d24('0x12')](_0x19b0e2[_0x5d24('0x10')],function(_0x654119){return{'model':db[_0x654119[_0x5d24('0x11')]],'as':_0x654119['as'],'attributes':_0x654119['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d24('0x13')](function(_0x59cc5e){logger[_0x5d24('0x14')]('GetSquareProjects',_0x5e5975);logger[_0x5d24('0x15')](_0x5d24('0x9'),_0x5e5975,JSON[_0x5d24('0x16')](_0x59cc5e));_0x5614aa(_0x59cc5e);})[_0x5d24('0x17')](function(_0x3a73a0){logger[_0x5d24('0x18')]('GetSquareProjects',_0x3a73a0[_0x5d24('0x19')],_0x5e5975);_0x2a0114(_0x34dade[_0x5d24('0x18')](0x1f4,_0x3a73a0[_0x5d24('0x19')]));});});};exports[_0x5d24('0x1a')]=function(_0x11c8db){var _0x34ac74=this;return new Promise(function(_0x42dc23,_0x5bae09){return db[_0x5d24('0xa')][_0x5d24('0x1b')]({'raw':_0x11c8db[_0x5d24('0xb')]?_0x11c8db[_0x5d24('0xb')][_0x5d24('0xc')]===undefined?!![]:![]:!![],'where':_0x11c8db[_0x5d24('0xb')]?_0x11c8db[_0x5d24('0xb')][_0x5d24('0xd')]||null:null,'attributes':_0x11c8db[_0x5d24('0xb')]?_0x11c8db['options'][_0x5d24('0xe')]||null:null,'include':_0x11c8db['options']?_0x11c8db['options'][_0x5d24('0x10')]?_['map'](_0x11c8db['options'][_0x5d24('0x10')],function(_0x551ec9){return{'model':db[_0x551ec9['model']],'as':_0x551ec9['as'],'attributes':_0x551ec9['attributes'],'include':_0x551ec9[_0x5d24('0x10')]?_[_0x5d24('0x12')](_0x551ec9[_0x5d24('0x10')],function(_0x3dedef){return{'model':db[_0x3dedef[_0x5d24('0x11')]],'as':_0x3dedef['as'],'attributes':_0x3dedef[_0x5d24('0xe')],'include':_0x3dedef[_0x5d24('0x10')]?_[_0x5d24('0x12')](_0x3dedef['include'],function(_0x1d5ebf){return{'model':db[_0x1d5ebf[_0x5d24('0x11')]],'as':_0x1d5ebf['as'],'attributes':_0x1d5ebf[_0x5d24('0xe')]};}):[]};}):[]};}):[]:[]})[_0x5d24('0x13')](function(_0x17687a){logger[_0x5d24('0x14')](_0x5d24('0x1a'),_0x11c8db);logger[_0x5d24('0x15')]('ShowSquareProject',_0x11c8db,JSON[_0x5d24('0x16')](_0x17687a));_0x42dc23(_0x17687a);})[_0x5d24('0x17')](function(_0x34d2d7){logger[_0x5d24('0x18')]('ShowSquareProject',_0x34d2d7[_0x5d24('0x19')],_0x11c8db);_0x5bae09(_0x34ac74[_0x5d24('0x18')](0x1f4,_0x34d2d7['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 155c66a..94e1044 100644 --- a/server/api/squareProject/squareProject.socket.js +++ b/server/api/squareProject/squareProject.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4864=['removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x3ff6c5,_0x4b4a74){var _0x4bf17c=function(_0x5ecb9c){while(--_0x5ecb9c){_0x3ff6c5['push'](_0x3ff6c5['shift']());}};_0x4bf17c(++_0x4b4a74);}(_0x4864,0x14d));var _0x4486=function(_0x1d92f8,_0xe82340){_0x1d92f8=_0x1d92f8-0x0;var _0x56dba3=_0x4864[_0x1d92f8];return _0x56dba3;};'use strict';var SquareProjectEvents=require(_0x4486('0x0'));var events=[_0x4486('0x1'),_0x4486('0x2'),'update'];function createListener(_0x4245ba,_0x373db3){return function(_0x4352b0){_0x373db3['emit'](_0x4245ba,_0x4352b0);};}function removeListener(_0x13b8b0,_0x328d23){return function(){SquareProjectEvents[_0x4486('0x3')](_0x13b8b0,_0x328d23);};}exports[_0x4486('0x4')]=function(_0x45fe13){for(var _0x385fff=0x0,_0x314c8f=events[_0x4486('0x5')];_0x385fff<_0x314c8f;_0x385fff++){var _0x27ebd2=events[_0x385fff];var _0x5eeb1e=createListener(_0x4486('0x6')+_0x27ebd2,_0x45fe13);SquareProjectEvents['on'](_0x27ebd2,_0x5eeb1e);}}; \ No newline at end of file +var _0xd9dd=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x5876aa,_0x4b790d){var _0x3017f3=function(_0x144954){while(--_0x144954){_0x5876aa['push'](_0x5876aa['shift']());}};_0x3017f3(++_0x4b790d);}(_0xd9dd,0x99));var _0xdd9d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9dd[_0x20a584];return _0x4b41a8;};'use strict';var SquareProjectEvents=require(_0xdd9d('0x0'));var events=[_0xdd9d('0x1'),_0xdd9d('0x2'),_0xdd9d('0x3')];function createListener(_0x44202e,_0x1f576a){return function(_0xe0095){_0x1f576a[_0xdd9d('0x4')](_0x44202e,_0xe0095);};}function removeListener(_0x9e2ca6,_0x1ffb84){return function(){SquareProjectEvents[_0xdd9d('0x5')](_0x9e2ca6,_0x1ffb84);};}exports[_0xdd9d('0x6')]=function(_0x38f6fa){for(var _0x51c39a=0x0,_0x21b126=events[_0xdd9d('0x7')];_0x51c39a<_0x21b126;_0x51c39a++){var _0x1832d1=events[_0x51c39a];var _0x52ae72=createListener(_0xdd9d('0x8')+_0x1832d1,_0x38f6fa);SquareProjectEvents['on'](_0x1832d1,_0x52ae72);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 2162a2f..b83400c 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0x47c552,_0x1fbe9e){var _0x2f0b26=function(_0x2fe799){while(--_0x2fe799){_0x47c552['push'](_0x47c552['shift']());}};_0x2f0b26(++_0x1fbe9e);}(_0xabce,0x103));var _0xeabc=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xabce[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0x7217,0x19e));var _0x7721=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7217[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9a6c8f8..3b5c4c3 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['exports','STRING','getDataValue','substring','lastIndexOf','sequelize'];(function(_0x4c9849,_0x3d673a){var _0x3d0008=function(_0x5e99a6){while(--_0x5e99a6){_0x4c9849['push'](_0x4c9849['shift']());}};_0x3d0008(++_0x3d673a);}(_0xa41a,0x6b));var _0xaa41=function(_0x23346f,_0x237af7){_0x23346f=_0x23346f-0x0;var _0x2409db=_0xa41a[_0x23346f];return _0x2409db;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'context':{'type':Sequelize[_0xaa41('0x2')]},'extension':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize[_0xaa41('0x2')]},'dnid':{'type':Sequelize[_0xaa41('0x2')]},'projectName':{'type':Sequelize[_0xaa41('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xaa41('0x2')]},'savePath':{'type':Sequelize[_0xaa41('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5b1fff='';var _0x179545=this[_0xaa41('0x3')]('savePath');if(_0x179545){_0x5b1fff=_0x179545[_0xaa41('0x4')](_0x179545[_0xaa41('0x5')]('.'));}return _0x5b1fff;}}}; \ No newline at end of file +var _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x4c1c6a,_0x4c1ef5){var _0x59a9df=function(_0x6825f8){while(--_0x6825f8){_0x4c1c6a['push'](_0x4c1c6a['shift']());}};_0x59a9df(++_0x4c1ef5);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5ee2ff,_0x550f49){_0x5ee2ff=_0x5ee2ff-0x0;var _0x5cf96e=_0x9c5a[_0x5ee2ff];return _0x5cf96e;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f8ca693..44cbd5b 100644 --- a/server/api/squareRecording/squareRecording.controller.js +++ b/server/api/squareRecording/squareRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a7=['eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','end','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','../../components/encryptor','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync'];(function(_0x2cb775,_0x54e8db){var _0x3d7f76=function(_0x669a60){while(--_0x669a60){_0x2cb775['push'](_0x2cb775['shift']());}};_0x3d7f76(++_0x54e8db);}(_0x16a7,0x1d1));var _0x716a=function(_0x3ef0bc,_0x54c7d4){_0x3ef0bc=_0x3ef0bc-0x0;var _0x5c923f=_0x16a7[_0x3ef0bc];return _0x5c923f;};'use strict';var emlformat=require(_0x716a('0x0'));var rimraf=require(_0x716a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x716a('0x2'));var rp=require('request-promise');var moment=require(_0x716a('0x3'));var BPromise=require(_0x716a('0x4'));var Mustache=require('mustache');var util=require(_0x716a('0x5'));var path=require(_0x716a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x716a('0x7'));var fs=require('fs');var fs_extra=require(_0x716a('0x8'));var _=require(_0x716a('0x9'));var squel=require(_0x716a('0xa'));var crypto=require('crypto');var jsforce=require(_0x716a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x716a('0xc'));var querystring=require(_0x716a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x716a('0xe'));var qs=require(_0x716a('0xf'));var as=require(_0x716a('0x10'));var hardwareService=require(_0x716a('0x11'));var logger=require(_0x716a('0x12'))(_0x716a('0x13'));var utils=require('../../config/utils');var config=require(_0x716a('0x14'));var licenseUtil=require(_0x716a('0x15'));var db=require(_0x716a('0x16'))['db'];function respondWithStatusCode(_0xee7905,_0x2459c9){_0x2459c9=_0x2459c9||0xcc;return function(_0x5ab411){if(_0x5ab411){return _0xee7905[_0x716a('0x17')](_0x2459c9);}return _0xee7905[_0x716a('0x18')](_0x2459c9)['end']();};}function respondWithResult(_0x18d419,_0x272f3a){_0x272f3a=_0x272f3a||0xc8;return function(_0x55e378){if(_0x55e378){return _0x18d419[_0x716a('0x18')](_0x272f3a)[_0x716a('0x19')](_0x55e378);}};}function respondWithFilteredResult(_0x460335,_0x3685cf){return function(_0x4a816f){if(_0x4a816f){var _0x24430b=typeof _0x3685cf[_0x716a('0x1a')]===_0x716a('0x1b')&&typeof _0x3685cf[_0x716a('0x1c')]==='undefined';var _0x574162=_0x4a816f['count'];var _0x2357b3=_0x24430b?0x0:_0x3685cf['offset'];var _0x25557e=_0x24430b?_0x4a816f[_0x716a('0x1d')]:_0x3685cf[_0x716a('0x1a')]+_0x3685cf['limit'];var _0x4abaaf;if(_0x25557e>=_0x574162){_0x25557e=_0x574162;_0x4abaaf=0xc8;}else{_0x4abaaf=0xce;}_0x460335[_0x716a('0x18')](_0x4abaaf);return _0x460335[_0x716a('0x1e')]('Content-Range',_0x2357b3+'-'+_0x25557e+'/'+_0x574162)[_0x716a('0x19')](_0x4a816f);}return null;};}function patchUpdates(_0x33027a){return function(_0x1d2328){try{jsonpatch['apply'](_0x1d2328,_0x33027a,!![]);}catch(_0x60d0d7){return BPromise[_0x716a('0x1f')](_0x60d0d7);}return _0x1d2328[_0x716a('0x20')]();};}function saveUpdates(_0x3185de,_0x54734e){return function(_0x22bb39){if(_0x22bb39){return _0x22bb39[_0x716a('0x21')](_0x3185de)['then'](function(_0x4625fa){return _0x4625fa;});}return null;};}function removeEntity(_0x2e1f85,_0x499b76){return function(_0x4ae261){if(_0x4ae261){return _0x4ae261['destroy']()[_0x716a('0x22')](function(){_0x2e1f85[_0x716a('0x18')](0xcc)[_0x716a('0x23')]();});}};}function handleEntityNotFound(_0x2dfcd5,_0x8d8495){return function(_0x1ddc5e){if(!_0x1ddc5e){_0x2dfcd5[_0x716a('0x17')](0x194);}return _0x1ddc5e;};}function handleError(_0x3bc1b6,_0x51c505){_0x51c505=_0x51c505||0x1f4;return function(_0x44873e){logger['error'](_0x44873e['stack']);if(_0x44873e['name']){delete _0x44873e[_0x716a('0x24')];}_0x3bc1b6[_0x716a('0x18')](_0x51c505)[_0x716a('0x25')](_0x44873e);};}exports[_0x716a('0x26')]=function(_0x2675a7,_0x1f003d){var _0x2a0cfd={},_0x587565={},_0x1d60f2={'count':0x0,'rows':[]};var _0x3c5707=_['map'](db[_0x716a('0x27')][_0x716a('0x28')],function(_0x55a481){return{'name':_0x55a481[_0x716a('0x29')],'type':_0x55a481[_0x716a('0x2a')][_0x716a('0x2b')]};});_0x587565[_0x716a('0x2c')]=_[_0x716a('0x2d')](_0x3c5707,_0x716a('0x24'));_0x587565[_0x716a('0x2e')]=_[_0x716a('0x2f')](_0x2675a7['query']);_0x587565[_0x716a('0x30')]=_[_0x716a('0x31')](_0x587565['model'],_0x587565[_0x716a('0x2e')]);_0x2a0cfd[_0x716a('0x32')]=_[_0x716a('0x31')](_0x587565[_0x716a('0x2c')],qs[_0x716a('0x33')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x33')]));_0x2a0cfd[_0x716a('0x32')]=_0x2a0cfd[_0x716a('0x32')][_0x716a('0x34')]?_0x2a0cfd[_0x716a('0x32')]:_0x587565[_0x716a('0x2c')];if(!_0x2675a7[_0x716a('0x2e')][_0x716a('0x35')](_0x716a('0x36'))){_0x2a0cfd[_0x716a('0x1c')]=qs[_0x716a('0x1c')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x1c')]);_0x2a0cfd[_0x716a('0x1a')]=qs[_0x716a('0x1a')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x1a')]);}_0x2a0cfd[_0x716a('0x37')]=qs[_0x716a('0x38')](_0x2675a7[_0x716a('0x2e')][_0x716a('0x38')]);_0x2a0cfd[_0x716a('0x39')]=qs[_0x716a('0x30')](_[_0x716a('0x3a')](_0x2675a7[_0x716a('0x2e')],_0x587565['filters']),_0x3c5707);if(_0x2675a7[_0x716a('0x2e')]['filter']){_0x2a0cfd[_0x716a('0x39')]=_[_0x716a('0x3b')](_0x2a0cfd[_0x716a('0x39')],{'$or':_[_0x716a('0x2d')](_0x3c5707,function(_0x7b0491){if(_0x7b0491[_0x716a('0x2a')]!==_0x716a('0x3c')){var _0x3c99a7={};_0x3c99a7[_0x7b0491[_0x716a('0x24')]]={'$like':'%'+_0x2675a7[_0x716a('0x2e')]['filter']+'%'};return _0x3c99a7;}})});}_0x2a0cfd=_[_0x716a('0x3b')]({},_0x2a0cfd,_0x2675a7[_0x716a('0x3d')]);var _0xe6c695={'where':_0x2a0cfd[_0x716a('0x39')]};return db[_0x716a('0x27')][_0x716a('0x1d')](_0xe6c695)[_0x716a('0x22')](function(_0x986ef5){_0x1d60f2['count']=_0x986ef5;if(_0x2675a7[_0x716a('0x2e')][_0x716a('0x3e')]){_0x2a0cfd['include']=[{'all':!![]}];}return db[_0x716a('0x27')][_0x716a('0x3f')](_0x2a0cfd);})[_0x716a('0x22')](function(_0x552305){_0x1d60f2['rows']=_0x552305;return _0x1d60f2;})[_0x716a('0x22')](respondWithFilteredResult(_0x1f003d,_0x2a0cfd))[_0x716a('0x40')](handleError(_0x1f003d,null));};exports[_0x716a('0x41')]=function(_0x338e2f,_0xe433af){var _0xb40496={'raw':!![],'where':{'id':_0x338e2f[_0x716a('0x42')]['id']}},_0x31058b={};_0x31058b[_0x716a('0x2c')]=_[_0x716a('0x2f')](db[_0x716a('0x27')][_0x716a('0x28')]);_0x31058b[_0x716a('0x2e')]=_['keys'](_0x338e2f['query']);_0x31058b[_0x716a('0x30')]=_[_0x716a('0x31')](_0x31058b[_0x716a('0x2c')],_0x31058b[_0x716a('0x2e')]);_0xb40496[_0x716a('0x32')]=_[_0x716a('0x31')](_0x31058b['model'],qs[_0x716a('0x33')](_0x338e2f[_0x716a('0x2e')]['fields']));_0xb40496['attributes']=_0xb40496[_0x716a('0x32')][_0x716a('0x34')]?_0xb40496[_0x716a('0x32')]:_0x31058b[_0x716a('0x2c')];if(_0x338e2f[_0x716a('0x2e')][_0x716a('0x3e')]){_0xb40496[_0x716a('0x43')]=[{'all':!![]}];}_0xb40496=_['merge']({},_0xb40496,_0x338e2f['options']);return db[_0x716a('0x27')][_0x716a('0x44')](_0xb40496)[_0x716a('0x22')](handleEntityNotFound(_0xe433af,null))['then'](respondWithResult(_0xe433af,null))['catch'](handleError(_0xe433af,null));};exports[_0x716a('0x45')]=function(_0x7bdbef,_0x47e102){return db[_0x716a('0x27')][_0x716a('0x45')](_0x7bdbef[_0x716a('0x46')],{})[_0x716a('0x22')](respondWithResult(_0x47e102,0xc9))[_0x716a('0x40')](handleError(_0x47e102,null));};exports['update']=function(_0x420a86,_0x99be6f){if(_0x420a86[_0x716a('0x46')]['id']){delete _0x420a86[_0x716a('0x46')]['id'];}return db[_0x716a('0x27')][_0x716a('0x44')]({'where':{'id':_0x420a86[_0x716a('0x42')]['id']}})[_0x716a('0x22')](handleEntityNotFound(_0x99be6f,null))[_0x716a('0x22')](saveUpdates(_0x420a86[_0x716a('0x46')],null))[_0x716a('0x22')](respondWithResult(_0x99be6f,null))[_0x716a('0x40')](handleError(_0x99be6f,null));};exports['download']=function(_0x44f146,_0x1ed086,_0x203a72){var _0x3519be=require(_0x716a('0x47'));var _0x2c5e35=![];var _0x358e47={};if(_0x44f146[_0x716a('0x2e')]['type']&&_0x44f146[_0x716a('0x2e')][_0x716a('0x2a')]==='uniqueid'){_0x358e47['uniqueid']=_0x44f146[_0x716a('0x42')]['id'];}else{_0x358e47['id']=_0x44f146[_0x716a('0x42')]['id'];}return db[_0x716a('0x27')]['find']({'where':_0x358e47,'attributes':['id',_0x716a('0x48'),_0x716a('0x49')],'raw':!![]})[_0x716a('0x22')](handleEntityNotFound(_0x1ed086,null))[_0x716a('0x22')](function(_0x29d780){if(_0x29d780){var _0x4b66ec=_0x29d780[_0x716a('0x48')];var _0x8d69fd=util[_0x716a('0x4a')](_0x716a('0x4b'),_0x4b66ec);if(fs[_0x716a('0x4c')](_0x8d69fd)){_0x2c5e35=!![];return _0x3519be[_0x716a('0x4d')](_0x8d69fd,_0x4b66ec,config[_0x716a('0x4e')][_0x716a('0x4f')])[_0x716a('0x22')](function(){return _0x29d780;});}return _0x29d780;}})['then'](function(_0x5285e5){if(_0x5285e5){var _0x37db6e=_0x5285e5['savePath'];if(!fs[_0x716a('0x4c')](_0x37db6e)){throw new db[(_0x716a('0x50'))][(_0x716a('0x51'))](_0x716a('0x52'));}if(_0x5285e5[_0x716a('0x49')]){return _0x1ed086[_0x716a('0x53')](_0x37db6e,_0x5285e5[_0x716a('0x49')]+path[_0x716a('0x54')](_0x37db6e),function(){if(_0x2c5e35){fs[_0x716a('0x55')](_0x37db6e);}});}else{return _0x1ed086['download'](_0x37db6e,function(_0x5557cb){if(_0x2c5e35){fs[_0x716a('0x55')](_0x37db6e);}});}}})[_0x716a('0x40')](function(_0xfa7fb8){if(_0xfa7fb8['message']===_0x716a('0x52')){_0x1ed086[_0x716a('0x18')](0x194)['send'](_0x716a('0x56'));}else{return handleError(_0x1ed086,null);}});};exports[_0x716a('0x57')]=function(_0x3a205f,_0x770938){return db['SquareRecording'][_0x716a('0x44')]({'where':{'id':_0x3a205f[_0x716a('0x42')]['id']}})['then'](function(_0x57617a){if(_[_0x716a('0x58')](_0x57617a)){throw new ReferenceError(_0x716a('0x59'));}return _0x57617a;})[_0x716a('0x22')](function(_0x4763e8){var _0x41075a=_0x4763e8[_0x716a('0x48')];logger[_0x716a('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x41075a);if(!_[_0x716a('0x58')](_0x4763e8['savePath'])&&fs[_0x716a('0x4c')](_0x41075a)){logger['info'](_0x716a('0x5b')+_0x41075a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x716a('0x5c')](_0x41075a);}_0x41075a=_0x41075a+'.cypher';if(!_[_0x716a('0x58')](_0x4763e8['savePath'])&&fs[_0x716a('0x4c')](_0x41075a)){logger[_0x716a('0x5a')]('File:\x20\x22'+_0x41075a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x716a('0x5c')](_0x41075a);}return _0x4763e8;})[_0x716a('0x22')](function(_0xc61918){if(!_0xc61918)throw new InternalError();return _0xc61918[_0x716a('0x57')]();})[_0x716a('0x22')](function(){_0x770938[_0x716a('0x18')](0xcc)[_0x716a('0x23')]();})['catch'](handleError(_0x770938,null));}; \ No newline at end of file +var _0xe975=['sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','SquareRecording','includeAll','include','rows','catch','show','keys','options','find','body','uniqueid','params','savePath','filename','format','existsSync','decryptFile','secrets','recording','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x239a3b,_0x3bdc4c){var _0x541793=function(_0x5a7a96){while(--_0x5a7a96){_0x239a3b['push'](_0x239a3b['shift']());}};_0x541793(++_0x3bdc4c);}(_0xe975,0xa2));var _0x5e97=function(_0x1603e3,_0x2d3fa8){_0x1603e3=_0x1603e3-0x0;var _0x26349c=_0xe975[_0x1603e3];return _0x26349c;};'use strict';var emlformat=require(_0x5e97('0x0'));var rimraf=require(_0x5e97('0x1'));var zipdir=require(_0x5e97('0x2'));var jsonpatch=require(_0x5e97('0x3'));var rp=require(_0x5e97('0x4'));var moment=require('moment');var BPromise=require(_0x5e97('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5e97('0x6'));var csv=require('to-csv');var ejs=require(_0x5e97('0x7'));var fs=require('fs');var fs_extra=require(_0x5e97('0x8'));var _=require(_0x5e97('0x9'));var squel=require(_0x5e97('0xa'));var crypto=require(_0x5e97('0xb'));var jsforce=require(_0x5e97('0xc'));var deskjs=require(_0x5e97('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e97('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e97('0xf'));var authService=require(_0x5e97('0x10'));var qs=require(_0x5e97('0x11'));var as=require(_0x5e97('0x12'));var hardwareService=require(_0x5e97('0x13'));var logger=require(_0x5e97('0x14'))(_0x5e97('0x15'));var utils=require(_0x5e97('0x16'));var config=require(_0x5e97('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10cd79,_0x33b69f){_0x33b69f=_0x33b69f||0xcc;return function(_0x12893c){if(_0x12893c){return _0x10cd79[_0x5e97('0x18')](_0x33b69f);}return _0x10cd79['status'](_0x33b69f)[_0x5e97('0x19')]();};}function respondWithResult(_0x88dd89,_0xcb11d2){_0xcb11d2=_0xcb11d2||0xc8;return function(_0x561d65){if(_0x561d65){return _0x88dd89[_0x5e97('0x1a')](_0xcb11d2)[_0x5e97('0x1b')](_0x561d65);}};}function respondWithFilteredResult(_0x10ba35,_0x17a733){return function(_0x19dbc9){if(_0x19dbc9){var _0x24fc7a=typeof _0x17a733['offset']===_0x5e97('0x1c')&&typeof _0x17a733[_0x5e97('0x1d')]===_0x5e97('0x1c');var _0x55c195=_0x19dbc9[_0x5e97('0x1e')];var _0xc2cf01=_0x24fc7a?0x0:_0x17a733[_0x5e97('0x1f')];var _0x213420=_0x24fc7a?_0x19dbc9[_0x5e97('0x1e')]:_0x17a733['offset']+_0x17a733[_0x5e97('0x1d')];var _0x45a147;if(_0x213420>=_0x55c195){_0x213420=_0x55c195;_0x45a147=0xc8;}else{_0x45a147=0xce;}_0x10ba35[_0x5e97('0x1a')](_0x45a147);return _0x10ba35['set'](_0x5e97('0x20'),_0xc2cf01+'-'+_0x213420+'/'+_0x55c195)[_0x5e97('0x1b')](_0x19dbc9);}return null;};}function patchUpdates(_0x1c25eb){return function(_0x5972e4){try{jsonpatch[_0x5e97('0x21')](_0x5972e4,_0x1c25eb,!![]);}catch(_0x392ece){return BPromise[_0x5e97('0x22')](_0x392ece);}return _0x5972e4[_0x5e97('0x23')]();};}function saveUpdates(_0x416194,_0x166311){return function(_0x3bbcbb){if(_0x3bbcbb){return _0x3bbcbb[_0x5e97('0x24')](_0x416194)[_0x5e97('0x25')](function(_0x5f5410){return _0x5f5410;});}return null;};}function removeEntity(_0x55bf0a,_0x5e6ab8){return function(_0x596a6a){if(_0x596a6a){return _0x596a6a['destroy']()[_0x5e97('0x25')](function(){_0x55bf0a[_0x5e97('0x1a')](0xcc)[_0x5e97('0x19')]();});}};}function handleEntityNotFound(_0x31f7f6,_0x13150b){return function(_0x404061){if(!_0x404061){_0x31f7f6[_0x5e97('0x18')](0x194);}return _0x404061;};}function handleError(_0x6130f8,_0x42b74c){_0x42b74c=_0x42b74c||0x1f4;return function(_0x25a84c){logger[_0x5e97('0x26')](_0x25a84c[_0x5e97('0x27')]);if(_0x25a84c[_0x5e97('0x28')]){delete _0x25a84c[_0x5e97('0x28')];}_0x6130f8[_0x5e97('0x1a')](_0x42b74c)[_0x5e97('0x29')](_0x25a84c);};}exports['index']=function(_0x8f2ada,_0x717ca9){var _0x1438ed={},_0x5d60a4={},_0x5dba02={'count':0x0,'rows':[]};var _0x27a55a=_[_0x5e97('0x2a')](db['SquareRecording'][_0x5e97('0x2b')],function(_0x269e3a){return{'name':_0x269e3a[_0x5e97('0x2c')],'type':_0x269e3a[_0x5e97('0x2d')]['key']};});_0x5d60a4[_0x5e97('0x2e')]=_['map'](_0x27a55a,'name');_0x5d60a4['query']=_['keys'](_0x8f2ada[_0x5e97('0x2f')]);_0x5d60a4[_0x5e97('0x30')]=_[_0x5e97('0x31')](_0x5d60a4[_0x5e97('0x2e')],_0x5d60a4[_0x5e97('0x2f')]);_0x1438ed[_0x5e97('0x32')]=_[_0x5e97('0x31')](_0x5d60a4['model'],qs[_0x5e97('0x33')](_0x8f2ada[_0x5e97('0x2f')]['fields']));_0x1438ed['attributes']=_0x1438ed['attributes'][_0x5e97('0x34')]?_0x1438ed[_0x5e97('0x32')]:_0x5d60a4[_0x5e97('0x2e')];if(!_0x8f2ada[_0x5e97('0x2f')]['hasOwnProperty']('nolimit')){_0x1438ed[_0x5e97('0x1d')]=qs[_0x5e97('0x1d')](_0x8f2ada[_0x5e97('0x2f')][_0x5e97('0x1d')]);_0x1438ed['offset']=qs[_0x5e97('0x1f')](_0x8f2ada[_0x5e97('0x2f')][_0x5e97('0x1f')]);}_0x1438ed[_0x5e97('0x35')]=qs[_0x5e97('0x36')](_0x8f2ada[_0x5e97('0x2f')][_0x5e97('0x36')]);_0x1438ed[_0x5e97('0x37')]=qs['filters'](_[_0x5e97('0x38')](_0x8f2ada[_0x5e97('0x2f')],_0x5d60a4[_0x5e97('0x30')]),_0x27a55a);if(_0x8f2ada[_0x5e97('0x2f')]['filter']){_0x1438ed['where']=_[_0x5e97('0x39')](_0x1438ed[_0x5e97('0x37')],{'$or':_['map'](_0x27a55a,function(_0x3b9aeb){if(_0x3b9aeb[_0x5e97('0x2d')]!==_0x5e97('0x3a')){var _0x6dc17e={};_0x6dc17e[_0x3b9aeb['name']]={'$like':'%'+_0x8f2ada[_0x5e97('0x2f')][_0x5e97('0x3b')]+'%'};return _0x6dc17e;}})});}_0x1438ed=_['merge']({},_0x1438ed,_0x8f2ada['options']);var _0x35156c={'where':_0x1438ed[_0x5e97('0x37')]};return db[_0x5e97('0x3c')]['count'](_0x35156c)[_0x5e97('0x25')](function(_0x305a7a){_0x5dba02[_0x5e97('0x1e')]=_0x305a7a;if(_0x8f2ada[_0x5e97('0x2f')][_0x5e97('0x3d')]){_0x1438ed[_0x5e97('0x3e')]=[{'all':!![]}];}return db[_0x5e97('0x3c')]['findAll'](_0x1438ed);})[_0x5e97('0x25')](function(_0x3e4dd7){_0x5dba02[_0x5e97('0x3f')]=_0x3e4dd7;return _0x5dba02;})[_0x5e97('0x25')](respondWithFilteredResult(_0x717ca9,_0x1438ed))[_0x5e97('0x40')](handleError(_0x717ca9,null));};exports[_0x5e97('0x41')]=function(_0x417635,_0x3dd1b5){var _0x10658d={'raw':!![],'where':{'id':_0x417635['params']['id']}},_0x47d082={};_0x47d082[_0x5e97('0x2e')]=_[_0x5e97('0x42')](db[_0x5e97('0x3c')]['rawAttributes']);_0x47d082[_0x5e97('0x2f')]=_[_0x5e97('0x42')](_0x417635[_0x5e97('0x2f')]);_0x47d082[_0x5e97('0x30')]=_[_0x5e97('0x31')](_0x47d082['model'],_0x47d082[_0x5e97('0x2f')]);_0x10658d['attributes']=_[_0x5e97('0x31')](_0x47d082['model'],qs['fields'](_0x417635['query']['fields']));_0x10658d[_0x5e97('0x32')]=_0x10658d[_0x5e97('0x32')][_0x5e97('0x34')]?_0x10658d[_0x5e97('0x32')]:_0x47d082[_0x5e97('0x2e')];if(_0x417635['query'][_0x5e97('0x3d')]){_0x10658d[_0x5e97('0x3e')]=[{'all':!![]}];}_0x10658d=_[_0x5e97('0x39')]({},_0x10658d,_0x417635[_0x5e97('0x43')]);return db[_0x5e97('0x3c')][_0x5e97('0x44')](_0x10658d)[_0x5e97('0x25')](handleEntityNotFound(_0x3dd1b5,null))[_0x5e97('0x25')](respondWithResult(_0x3dd1b5,null))[_0x5e97('0x40')](handleError(_0x3dd1b5,null));};exports['create']=function(_0x33e7a9,_0xfcf36f){return db[_0x5e97('0x3c')]['create'](_0x33e7a9[_0x5e97('0x45')],{})[_0x5e97('0x25')](respondWithResult(_0xfcf36f,0xc9))[_0x5e97('0x40')](handleError(_0xfcf36f,null));};exports[_0x5e97('0x24')]=function(_0x25707f,_0x42e86f){if(_0x25707f[_0x5e97('0x45')]['id']){delete _0x25707f[_0x5e97('0x45')]['id'];}return db[_0x5e97('0x3c')][_0x5e97('0x44')]({'where':{'id':_0x25707f['params']['id']}})[_0x5e97('0x25')](handleEntityNotFound(_0x42e86f,null))[_0x5e97('0x25')](saveUpdates(_0x25707f[_0x5e97('0x45')],null))[_0x5e97('0x25')](respondWithResult(_0x42e86f,null))['catch'](handleError(_0x42e86f,null));};exports['download']=function(_0x5e6d9a,_0x2d5247,_0x3063f7){var _0xb2c151=require('../../components/encryptor');var _0x4b62a2=![];var _0x7c8a9a={};if(_0x5e6d9a[_0x5e97('0x2f')][_0x5e97('0x2d')]&&_0x5e6d9a[_0x5e97('0x2f')]['type']==='uniqueid'){_0x7c8a9a[_0x5e97('0x46')]=_0x5e6d9a[_0x5e97('0x47')]['id'];}else{_0x7c8a9a['id']=_0x5e6d9a[_0x5e97('0x47')]['id'];}return db[_0x5e97('0x3c')][_0x5e97('0x44')]({'where':_0x7c8a9a,'attributes':['id',_0x5e97('0x48'),_0x5e97('0x49')],'raw':!![]})[_0x5e97('0x25')](handleEntityNotFound(_0x2d5247,null))['then'](function(_0x5c0748){if(_0x5c0748){var _0x2de3ea=_0x5c0748[_0x5e97('0x48')];var _0x281f45=util[_0x5e97('0x4a')]('%s.cypher',_0x2de3ea);if(fs[_0x5e97('0x4b')](_0x281f45)){_0x4b62a2=!![];return _0xb2c151[_0x5e97('0x4c')](_0x281f45,_0x2de3ea,config[_0x5e97('0x4d')][_0x5e97('0x4e')])['then'](function(){return _0x5c0748;});}return _0x5c0748;}})['then'](function(_0x1fdc9e){if(_0x1fdc9e){var _0x481c42=_0x1fdc9e[_0x5e97('0x48')];if(!fs[_0x5e97('0x4b')](_0x481c42)){throw new db['Sequelize']['ValidationError'](_0x5e97('0x4f'));}if(_0x1fdc9e['filename']){return _0x2d5247[_0x5e97('0x50')](_0x481c42,_0x1fdc9e['filename']+path[_0x5e97('0x51')](_0x481c42),function(){if(_0x4b62a2){fs[_0x5e97('0x52')](_0x481c42);}});}else{return _0x2d5247['download'](_0x481c42,function(_0x56c244){if(_0x4b62a2){fs[_0x5e97('0x52')](_0x481c42);}});}}})['catch'](function(_0x118112){if(_0x118112[_0x5e97('0x53')]===_0x5e97('0x4f')){_0x2d5247[_0x5e97('0x1a')](0x194)[_0x5e97('0x29')](_0x5e97('0x54'));}else{return handleError(_0x2d5247,null);}});};exports[_0x5e97('0x55')]=function(_0x707f54,_0x1e8026){return db[_0x5e97('0x3c')][_0x5e97('0x44')]({'where':{'id':_0x707f54[_0x5e97('0x47')]['id']}})[_0x5e97('0x25')](function(_0x1fe907){if(_[_0x5e97('0x56')](_0x1fe907)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1fe907;})[_0x5e97('0x25')](function(_0xbc56cd){var _0x32bf1d=_0xbc56cd[_0x5e97('0x48')];logger[_0x5e97('0x57')](_0x5e97('0x58'),_0x32bf1d);if(!_[_0x5e97('0x56')](_0xbc56cd['savePath'])&&fs[_0x5e97('0x4b')](_0x32bf1d)){logger[_0x5e97('0x57')](_0x5e97('0x59')+_0x32bf1d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5e97('0x5a')](_0x32bf1d);}_0x32bf1d=_0x32bf1d+_0x5e97('0x5b');if(!_[_0x5e97('0x56')](_0xbc56cd[_0x5e97('0x48')])&&fs['existsSync'](_0x32bf1d)){logger[_0x5e97('0x57')]('File:\x20\x22'+_0x32bf1d+_0x5e97('0x5c'));fs['unlinkSync'](_0x32bf1d);}return _0xbc56cd;})[_0x5e97('0x25')](function(_0x2f77fa){if(!_0x2f77fa)throw new InternalError();return _0x2f77fa[_0x5e97('0x55')]();})['then'](function(){_0x1e8026[_0x5e97('0x1a')](0xcc)[_0x5e97('0x19')]();})[_0x5e97('0x40')](handleError(_0x1e8026,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index f1cc7c4..397f949 100644 --- a/server/api/squareRecording/squareRecording.model.js +++ b/server/api/squareRecording/squareRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d49=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','api','moment','bluebird'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x4d49,0x141));var _0x94d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d49[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var logger=require('../../config/logger')(_0x94d4('0x1'));var moment=require(_0x94d4('0x2'));var BPromise=require(_0x94d4('0x3'));var rp=require(_0x94d4('0x4'));var fs=require('fs');var path=require(_0x94d4('0x5'));var rimraf=require(_0x94d4('0x6'));var config=require(_0x94d4('0x7'));var attributes=require(_0x94d4('0x8'));module[_0x94d4('0x9')]=function(_0x4dd133,_0x2b3127){return _0x4dd133[_0x94d4('0xa')](_0x94d4('0xb'),attributes,{'tableName':_0x94d4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ae=['exports','define','square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x253df7,_0x2af793){var _0x12bd19=function(_0x1cfc9a){while(--_0x1cfc9a){_0x253df7['push'](_0x253df7['shift']());}};_0x12bd19(++_0x2af793);}(_0xb7ae,0xf3));var _0xeb7a=function(_0x345f49,_0x3d4c1b){_0x345f49=_0x345f49-0x0;var _0x4d69d8=_0xb7ae[_0x345f49];return _0x4d69d8;};'use strict';var _=require(_0xeb7a('0x0'));var util=require(_0xeb7a('0x1'));var logger=require(_0xeb7a('0x2'))(_0xeb7a('0x3'));var moment=require(_0xeb7a('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb7a('0x5'));var fs=require('fs');var path=require(_0xeb7a('0x6'));var rimraf=require(_0xeb7a('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7a('0x8'));module[_0xeb7a('0x9')]=function(_0x33c928,_0x2564ab){return _0x33c928[_0xeb7a('0xa')]('SquareRecording',attributes,{'tableName':_0xeb7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index a9b12c8..3a772d7 100644 --- a/server/api/squareRecording/squareRecording.rpc.js +++ b/server/api/squareRecording/squareRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe06=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','info','lodash','util'];(function(_0x3dac2a,_0x2ded9d){var _0x1e598d=function(_0x4d15b1){while(--_0x4d15b1){_0x3dac2a['push'](_0x3dac2a['shift']());}};_0x1e598d(++_0x2ded9d);}(_0xfe06,0x15d));var _0x6fe0=function(_0x155908,_0x33a1f2){_0x155908=_0x155908-0x0;var _0x1f8699=_0xfe06[_0x155908];return _0x1f8699;};'use strict';var _=require(_0x6fe0('0x0'));var util=require(_0x6fe0('0x1'));var moment=require(_0x6fe0('0x2'));var BPromise=require('bluebird');var rs=require(_0x6fe0('0x3'));var fs=require('fs');var Redis=require(_0x6fe0('0x4'));var db=require(_0x6fe0('0x5'))['db'];var utils=require(_0x6fe0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6fe0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6fe0('0x8')][_0x6fe0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c54e,_0x511113,_0x2ec9c8){return new BPromise(function(_0x13bf86,_0x51bc93){return client[_0x6fe0('0xa')](_0x47c54e,_0x2ec9c8)[_0x6fe0('0xb')](function(_0xc60c52){logger['info']('SquareRecording,\x20%s,\x20%s',_0x511113,_0x6fe0('0xc'));logger[_0x6fe0('0xd')](_0x6fe0('0xe'),_0x511113,_0x6fe0('0xc'),JSON[_0x6fe0('0xf')](_0xc60c52));if(_0xc60c52[_0x6fe0('0x10')]){if(_0xc60c52['error']['code']===0x1f4){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52['error'][_0x6fe0('0x12')]);return _0x51bc93(_0xc60c52[_0x6fe0('0x10')]['message']);}logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);return _0x13bf86(_0xc60c52[_0x6fe0('0x10')][_0x6fe0('0x12')]);}else{logger['info'](_0x6fe0('0x11'),_0x511113,_0x6fe0('0xc'));_0x13bf86(_0xc60c52['result'][_0x6fe0('0x12')]);}})[_0x6fe0('0x13')](function(_0xd0b529){logger[_0x6fe0('0x10')](_0x6fe0('0x11'),_0x511113,_0xd0b529);_0x51bc93(_0xd0b529);});});}exports[_0x6fe0('0x14')]=function(_0x5daab1){var _0x5f33cf=this;return new Promise(function(_0x50e817,_0x560e3c){return db[_0x6fe0('0x15')][_0x6fe0('0x16')](_0x5daab1[_0x6fe0('0x17')],{'raw':_0x5daab1['options']?_0x5daab1[_0x6fe0('0x18')][_0x6fe0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x549f62){logger[_0x6fe0('0x1a')](_0x6fe0('0x14'),_0x5daab1);logger[_0x6fe0('0xd')](_0x6fe0('0x14'),_0x5daab1,JSON[_0x6fe0('0xf')](_0x549f62));_0x50e817(_0x549f62);})['catch'](function(_0x5815dd){logger['error']('CreateSquareRecording',_0x5815dd['message'],_0x5daab1);_0x560e3c(_0x5f33cf[_0x6fe0('0x10')](0x1f4,_0x5815dd['message']));});});}; \ No newline at end of file +var _0x2ed4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util'];(function(_0x182321,_0x537f4e){var _0x55617c=function(_0x4490bd){while(--_0x4490bd){_0x182321['push'](_0x182321['shift']());}};_0x55617c(++_0x537f4e);}(_0x2ed4,0xe6));var _0x42ed=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0x2ed4[_0x4d08b8];return _0x70214a;};'use strict';var _=require(_0x42ed('0x0'));var util=require(_0x42ed('0x1'));var moment=require(_0x42ed('0x2'));var BPromise=require(_0x42ed('0x3'));var rs=require(_0x42ed('0x4'));var fs=require('fs');var Redis=require(_0x42ed('0x5'));var db=require(_0x42ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x42ed('0x7'))(_0x42ed('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x42ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2549f8,_0x5e8b58,_0x50983c){return new BPromise(function(_0x2c19ab,_0x4ef196){return client[_0x42ed('0xa')](_0x2549f8,_0x50983c)[_0x42ed('0xb')](function(_0x339d0d){logger[_0x42ed('0xc')](_0x42ed('0xd'),_0x5e8b58,_0x42ed('0xe'));logger[_0x42ed('0xf')](_0x42ed('0x10'),_0x5e8b58,'request\x20sent',JSON[_0x42ed('0x11')](_0x339d0d));if(_0x339d0d[_0x42ed('0x12')]){if(_0x339d0d[_0x42ed('0x12')][_0x42ed('0x13')]===0x1f4){logger[_0x42ed('0x12')](_0x42ed('0xd'),_0x5e8b58,_0x339d0d[_0x42ed('0x12')]['message']);return _0x4ef196(_0x339d0d['error'][_0x42ed('0x14')]);}logger['error'](_0x42ed('0xd'),_0x5e8b58,_0x339d0d[_0x42ed('0x12')][_0x42ed('0x14')]);return _0x2c19ab(_0x339d0d[_0x42ed('0x12')][_0x42ed('0x14')]);}else{logger[_0x42ed('0xc')](_0x42ed('0xd'),_0x5e8b58,_0x42ed('0xe'));_0x2c19ab(_0x339d0d[_0x42ed('0x15')][_0x42ed('0x14')]);}})[_0x42ed('0x16')](function(_0x17788d){logger[_0x42ed('0x12')](_0x42ed('0xd'),_0x5e8b58,_0x17788d);_0x4ef196(_0x17788d);});});}exports[_0x42ed('0x17')]=function(_0x436827){var _0x432d95=this;return new Promise(function(_0x465782,_0x116d53){return db[_0x42ed('0x18')][_0x42ed('0x19')](_0x436827[_0x42ed('0x1a')],{'raw':_0x436827['options']?_0x436827[_0x42ed('0x1b')][_0x42ed('0x1c')]===undefined?!![]:![]:!![]})[_0x42ed('0xb')](function(_0x3ddd86){logger['info'](_0x42ed('0x17'),_0x436827);logger[_0x42ed('0xf')]('CreateSquareRecording',_0x436827,JSON[_0x42ed('0x11')](_0x3ddd86));_0x465782(_0x3ddd86);})[_0x42ed('0x16')](function(_0x23c9f0){logger[_0x42ed('0x12')](_0x42ed('0x17'),_0x23c9f0[_0x42ed('0x14')],_0x436827);_0x116d53(_0x432d95[_0x42ed('0x12')](0x1f4,_0x23c9f0[_0x42ed('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index fd8171a..488fc38 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3ca256,_0xad3514){var _0xf5fa63=function(_0x5819f5){while(--_0x5819f5){_0x3ca256['push'](_0x3ca256['shift']());}};_0xf5fa63(++_0xad3514);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3b282e,_0x3fceb4){var _0x4c22e6=function(_0x1da6d7){while(--_0x1da6d7){_0x3b282e['push'](_0x3b282e['shift']());}};_0x4c22e6(++_0x3fceb4);}(_0xe706,0xa3));var _0x6e70=function(_0x209e12,_0x2ce907){_0x209e12=_0x209e12-0x0;var _0x3f5b89=_0xe706[_0x209e12];return _0x3f5b89;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 20d5d5c..9fde82f 100644 --- a/server/api/squareReport/squareReport.attributes.js +++ b/server/api/squareReport/squareReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x023d=['STRING','DATE','BOOLEAN','exports'];(function(_0x81e5d9,_0x4493fc){var _0x1d00f6=function(_0x3e9acd){while(--_0x3e9acd){_0x81e5d9['push'](_0x81e5d9['shift']());}};_0x1d00f6(++_0x4493fc);}(_0x023d,0x67));var _0xd023=function(_0x15b50e,_0x398bda){_0x15b50e=_0x15b50e-0x0;var _0x9e8ffe=_0x023d[_0x15b50e];return _0x9e8ffe;};'use strict';var Sequelize=require('sequelize');module[_0xd023('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd023('0x1')]},'request':{'type':Sequelize[_0xd023('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd023('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xd023('0x1')]},'callerid':{'type':Sequelize[_0xd023('0x1')]},'calleridname':{'type':Sequelize[_0xd023('0x1')]},'callingpres':{'type':Sequelize[_0xd023('0x1')]},'callingani2':{'type':Sequelize[_0xd023('0x1')]},'callington':{'type':Sequelize[_0xd023('0x1')]},'callingtns':{'type':Sequelize[_0xd023('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd023('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd023('0x1')]},'enhanced':{'type':Sequelize[_0xd023('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xd023('0x1')]},'project_name':{'type':Sequelize[_0xd023('0x1')]},'joinAt':{'type':Sequelize[_0xd023('0x2')]},'leaveAt':{'type':Sequelize[_0xd023('0x2')]},'bot':{'type':Sequelize[_0xd023('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdd92=['STRING','DATE','BOOLEAN','exports'];(function(_0xa16401,_0x9a9949){var _0x3d5676=function(_0x2e639f){while(--_0x2e639f){_0xa16401['push'](_0xa16401['shift']());}};_0x3d5676(++_0x9a9949);}(_0xdd92,0x16b));var _0x2dd9=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xdd92[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require('sequelize');module[_0x2dd9('0x0')]={'network':{'type':Sequelize[_0x2dd9('0x1')]},'network_script':{'type':Sequelize[_0x2dd9('0x1')]},'request':{'type':Sequelize[_0x2dd9('0x1')]},'channel':{'type':Sequelize[_0x2dd9('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2dd9('0x1')]},'uniqueid':{'type':Sequelize[_0x2dd9('0x1')]},'version':{'type':Sequelize[_0x2dd9('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2dd9('0x1')]},'callingpres':{'type':Sequelize[_0x2dd9('0x1')]},'callingani2':{'type':Sequelize[_0x2dd9('0x1')]},'callington':{'type':Sequelize[_0x2dd9('0x1')]},'callingtns':{'type':Sequelize[_0x2dd9('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x2dd9('0x1')]},'context':{'type':Sequelize[_0x2dd9('0x1')]},'extension':{'type':Sequelize[_0x2dd9('0x1')]},'priority':{'type':Sequelize[_0x2dd9('0x1')]},'enhanced':{'type':Sequelize[_0x2dd9('0x1')]},'accountcode':{'type':Sequelize[_0x2dd9('0x1')]},'threadid':{'type':Sequelize[_0x2dd9('0x1')]},'project_name':{'type':Sequelize[_0x2dd9('0x1')]},'joinAt':{'type':Sequelize[_0x2dd9('0x2')]},'leaveAt':{'type':Sequelize[_0x2dd9('0x2')]},'bot':{'type':Sequelize[_0x2dd9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 804723e..62b062e 100644 --- a/server/api/squareReport/squareReport.controller.js +++ b/server/api/squareReport/squareReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6954=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5b8237,_0x327039){var _0x372191=function(_0x59b7b5){while(--_0x59b7b5){_0x5b8237['push'](_0x5b8237['shift']());}};_0x372191(++_0x327039);}(_0x6954,0x8f));var _0x4695=function(_0x460fdd,_0x16703a){_0x460fdd=_0x460fdd-0x0;var _0x4145a7=_0x6954[_0x460fdd];return _0x4145a7;};'use strict';var emlformat=require(_0x4695('0x0'));var rimraf=require(_0x4695('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4695('0x2'));var rp=require('request-promise');var moment=require(_0x4695('0x3'));var BPromise=require(_0x4695('0x4'));var Mustache=require(_0x4695('0x5'));var util=require(_0x4695('0x6'));var path=require('path');var sox=require(_0x4695('0x7'));var csv=require(_0x4695('0x8'));var ejs=require(_0x4695('0x9'));var fs=require('fs');var fs_extra=require(_0x4695('0xa'));var _=require(_0x4695('0xb'));var squel=require(_0x4695('0xc'));var crypto=require(_0x4695('0xd'));var jsforce=require(_0x4695('0xe'));var deskjs=require(_0x4695('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4695('0x10'));var Papa=require(_0x4695('0x11'));var Redis=require('ioredis');var authService=require(_0x4695('0x12'));var qs=require(_0x4695('0x13'));var as=require(_0x4695('0x14'));var hardwareService=require(_0x4695('0x15'));var logger=require(_0x4695('0x16'))(_0x4695('0x17'));var utils=require(_0x4695('0x18'));var config=require(_0x4695('0x19'));var licenseUtil=require(_0x4695('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c13e8,_0x158235){_0x158235=_0x158235||0xcc;return function(_0x23bb96){if(_0x23bb96){return _0x4c13e8[_0x4695('0x1b')](_0x158235);}return _0x4c13e8[_0x4695('0x1c')](_0x158235)[_0x4695('0x1d')]();};}function respondWithResult(_0x57dca2,_0x3ac892){_0x3ac892=_0x3ac892||0xc8;return function(_0x4fd6c6){if(_0x4fd6c6){return _0x57dca2['status'](_0x3ac892)[_0x4695('0x1e')](_0x4fd6c6);}};}function respondWithFilteredResult(_0x2ebb78,_0x51cabc){return function(_0x3041dc){if(_0x3041dc){var _0xa69ab0=typeof _0x51cabc[_0x4695('0x1f')]===_0x4695('0x20')&&typeof _0x51cabc[_0x4695('0x21')]===_0x4695('0x20');var _0x54fdbf=_0x3041dc[_0x4695('0x22')];var _0x543b91=_0xa69ab0?0x0:_0x51cabc[_0x4695('0x1f')];var _0x384f88=_0xa69ab0?_0x3041dc['count']:_0x51cabc['offset']+_0x51cabc[_0x4695('0x21')];var _0x5d91d1;if(_0x384f88>=_0x54fdbf){_0x384f88=_0x54fdbf;_0x5d91d1=0xc8;}else{_0x5d91d1=0xce;}_0x2ebb78[_0x4695('0x1c')](_0x5d91d1);return _0x2ebb78[_0x4695('0x23')](_0x4695('0x24'),_0x543b91+'-'+_0x384f88+'/'+_0x54fdbf)[_0x4695('0x1e')](_0x3041dc);}return null;};}function patchUpdates(_0x346d4e){return function(_0x574b1e){try{jsonpatch['apply'](_0x574b1e,_0x346d4e,!![]);}catch(_0x5bdcaf){return BPromise[_0x4695('0x25')](_0x5bdcaf);}return _0x574b1e[_0x4695('0x26')]();};}function saveUpdates(_0x1b34c6,_0x1725e1){return function(_0x43c9e3){if(_0x43c9e3){return _0x43c9e3[_0x4695('0x27')](_0x1b34c6)[_0x4695('0x28')](function(_0x2289a8){return _0x2289a8;});}return null;};}function removeEntity(_0x5e8930,_0x3a1942){return function(_0x509dbf){if(_0x509dbf){return _0x509dbf['destroy']()['then'](function(){_0x5e8930[_0x4695('0x1c')](0xcc)[_0x4695('0x1d')]();});}};}function handleEntityNotFound(_0x102b1c,_0x3346a5){return function(_0x15c997){if(!_0x15c997){_0x102b1c['sendStatus'](0x194);}return _0x15c997;};}function handleError(_0x422358,_0xd985e2){_0xd985e2=_0xd985e2||0x1f4;return function(_0x45dfc6){logger[_0x4695('0x29')](_0x45dfc6[_0x4695('0x2a')]);if(_0x45dfc6[_0x4695('0x2b')]){delete _0x45dfc6[_0x4695('0x2b')];}_0x422358[_0x4695('0x1c')](_0xd985e2)[_0x4695('0x2c')](_0x45dfc6);};}exports[_0x4695('0x2d')]=function(_0x1e8cec,_0x402d15){var _0x39bf9a={},_0x27a538={},_0x1e747f={'count':0x0,'rows':[]};var _0x95171=_[_0x4695('0x2e')](db[_0x4695('0x2f')][_0x4695('0x30')],function(_0x493b72){return{'name':_0x493b72['fieldName'],'type':_0x493b72[_0x4695('0x31')][_0x4695('0x32')]};});_0x27a538[_0x4695('0x33')]=_[_0x4695('0x2e')](_0x95171,_0x4695('0x2b'));_0x27a538['query']=_[_0x4695('0x34')](_0x1e8cec[_0x4695('0x35')]);_0x27a538[_0x4695('0x36')]=_[_0x4695('0x37')](_0x27a538['model'],_0x27a538[_0x4695('0x35')]);_0x39bf9a[_0x4695('0x38')]=_[_0x4695('0x37')](_0x27a538['model'],qs[_0x4695('0x39')](_0x1e8cec['query']['fields']));_0x39bf9a[_0x4695('0x38')]=_0x39bf9a[_0x4695('0x38')]['length']?_0x39bf9a[_0x4695('0x38')]:_0x27a538[_0x4695('0x33')];if(!_0x1e8cec[_0x4695('0x35')][_0x4695('0x3a')](_0x4695('0x3b'))){_0x39bf9a[_0x4695('0x21')]=qs[_0x4695('0x21')](_0x1e8cec[_0x4695('0x35')][_0x4695('0x21')]);_0x39bf9a[_0x4695('0x1f')]=qs[_0x4695('0x1f')](_0x1e8cec[_0x4695('0x35')][_0x4695('0x1f')]);}_0x39bf9a['order']=qs[_0x4695('0x3c')](_0x1e8cec['query']['sort']);_0x39bf9a['where']=qs['filters'](_[_0x4695('0x3d')](_0x1e8cec[_0x4695('0x35')],_0x27a538[_0x4695('0x36')]),_0x95171);if(_0x1e8cec['query']['filter']){_0x39bf9a[_0x4695('0x3e')]=_[_0x4695('0x3f')](_0x39bf9a['where'],{'$or':_[_0x4695('0x2e')](_0x95171,function(_0x6fd2fd){if(_0x6fd2fd[_0x4695('0x31')]!==_0x4695('0x40')){var _0x2b6dd3={};_0x2b6dd3[_0x6fd2fd['name']]={'$like':'%'+_0x1e8cec[_0x4695('0x35')]['filter']+'%'};return _0x2b6dd3;}})});}_0x39bf9a=_['merge']({},_0x39bf9a,_0x1e8cec[_0x4695('0x41')]);var _0x45da01={'where':_0x39bf9a[_0x4695('0x3e')]};return db[_0x4695('0x2f')]['count'](_0x45da01)[_0x4695('0x28')](function(_0x5d1bf4){_0x1e747f['count']=_0x5d1bf4;if(_0x1e8cec['query'][_0x4695('0x42')]){_0x39bf9a[_0x4695('0x43')]=[{'all':!![]}];}return db['SquareReport'][_0x4695('0x44')](_0x39bf9a);})[_0x4695('0x28')](function(_0x1b83c2){_0x1e747f[_0x4695('0x45')]=_0x1b83c2;return _0x1e747f;})['then'](respondWithFilteredResult(_0x402d15,_0x39bf9a))[_0x4695('0x46')](handleError(_0x402d15,null));};exports[_0x4695('0x47')]=function(_0x26a490,_0x35f7ae){var _0x3ca562={'raw':!![],'where':{'id':_0x26a490['params']['id']}},_0x2dfee0={};_0x2dfee0[_0x4695('0x33')]=_[_0x4695('0x34')](db[_0x4695('0x2f')]['rawAttributes']);_0x2dfee0['query']=_['keys'](_0x26a490[_0x4695('0x35')]);_0x2dfee0[_0x4695('0x36')]=_['intersection'](_0x2dfee0[_0x4695('0x33')],_0x2dfee0[_0x4695('0x35')]);_0x3ca562[_0x4695('0x38')]=_['intersection'](_0x2dfee0[_0x4695('0x33')],qs[_0x4695('0x39')](_0x26a490[_0x4695('0x35')][_0x4695('0x39')]));_0x3ca562[_0x4695('0x38')]=_0x3ca562['attributes'][_0x4695('0x48')]?_0x3ca562['attributes']:_0x2dfee0[_0x4695('0x33')];if(_0x26a490[_0x4695('0x35')]['includeAll']){_0x3ca562[_0x4695('0x43')]=[{'all':!![]}];}_0x3ca562=_[_0x4695('0x3f')]({},_0x3ca562,_0x26a490[_0x4695('0x41')]);return db[_0x4695('0x2f')][_0x4695('0x49')](_0x3ca562)[_0x4695('0x28')](handleEntityNotFound(_0x35f7ae,null))[_0x4695('0x28')](respondWithResult(_0x35f7ae,null))[_0x4695('0x46')](handleError(_0x35f7ae,null));};exports['create']=function(_0x1d551c,_0x127c06){return db['SquareReport'][_0x4695('0x4a')](_0x1d551c[_0x4695('0x4b')],{})[_0x4695('0x28')](respondWithResult(_0x127c06,0xc9))[_0x4695('0x46')](handleError(_0x127c06,null));};exports['update']=function(_0x469154,_0x4ef3da){if(_0x469154[_0x4695('0x4b')]['id']){delete _0x469154[_0x4695('0x4b')]['id'];}return db[_0x4695('0x2f')][_0x4695('0x49')]({'where':{'id':_0x469154[_0x4695('0x4c')]['id']}})[_0x4695('0x28')](handleEntityNotFound(_0x4ef3da,null))[_0x4695('0x28')](saveUpdates(_0x469154[_0x4695('0x4b')],null))[_0x4695('0x28')](respondWithResult(_0x4ef3da,null))[_0x4695('0x46')](handleError(_0x4ef3da,null));};exports[_0x4695('0x4d')]=function(_0x412a14,_0x1e218b){return db[_0x4695('0x2f')]['find']({'where':{'id':_0x412a14[_0x4695('0x4c')]['id']}})[_0x4695('0x28')](handleEntityNotFound(_0x1e218b,null))[_0x4695('0x28')](removeEntity(_0x1e218b,null))['catch'](handleError(_0x1e218b,null));};exports[_0x4695('0x4e')]=function(_0x1acb0e,_0x55225d){return db[_0x4695('0x2f')][_0x4695('0x4e')]()[_0x4695('0x28')](respondWithResult(_0x55225d,null))[_0x4695('0x46')](handleError(_0x55225d,null));}; \ No newline at end of file +var _0x2b0d=['where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','body','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','stack','name','send','index','map','SquareReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x19609b,_0x5918ad){var _0x1eda35=function(_0x3e4bf6){while(--_0x3e4bf6){_0x19609b['push'](_0x19609b['shift']());}};_0x1eda35(++_0x5918ad);}(_0x2b0d,0x16d));var _0xd2b0=function(_0x435681,_0x5e6a4a){_0x435681=_0x435681-0x0;var _0x157d07=_0x2b0d[_0x435681];return _0x157d07;};'use strict';var emlformat=require(_0xd2b0('0x0'));var rimraf=require(_0xd2b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd2b0('0x2'));var moment=require(_0xd2b0('0x3'));var BPromise=require(_0xd2b0('0x4'));var Mustache=require('mustache');var util=require(_0xd2b0('0x5'));var path=require('path');var sox=require(_0xd2b0('0x6'));var csv=require(_0xd2b0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd2b0('0x8'));var squel=require(_0xd2b0('0x9'));var crypto=require(_0xd2b0('0xa'));var jsforce=require(_0xd2b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd2b0('0x7'));var querystring=require('querystring');var Papa=require(_0xd2b0('0xc'));var Redis=require(_0xd2b0('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd2b0('0xe'));var hardwareService=require(_0xd2b0('0xf'));var logger=require(_0xd2b0('0x10'))(_0xd2b0('0x11'));var utils=require(_0xd2b0('0x12'));var config=require(_0xd2b0('0x13'));var licenseUtil=require(_0xd2b0('0x14'));var db=require(_0xd2b0('0x15'))['db'];function respondWithStatusCode(_0x4c173d,_0x12b5b8){_0x12b5b8=_0x12b5b8||0xcc;return function(_0x229e44){if(_0x229e44){return _0x4c173d[_0xd2b0('0x16')](_0x12b5b8);}return _0x4c173d[_0xd2b0('0x17')](_0x12b5b8)['end']();};}function respondWithResult(_0xa7953e,_0x4d566b){_0x4d566b=_0x4d566b||0xc8;return function(_0x2df990){if(_0x2df990){return _0xa7953e[_0xd2b0('0x17')](_0x4d566b)[_0xd2b0('0x18')](_0x2df990);}};}function respondWithFilteredResult(_0x222fed,_0x1bb648){return function(_0x11bf3f){if(_0x11bf3f){var _0x4bf154=typeof _0x1bb648[_0xd2b0('0x19')]===_0xd2b0('0x1a')&&typeof _0x1bb648[_0xd2b0('0x1b')]==='undefined';var _0x207edc=_0x11bf3f[_0xd2b0('0x1c')];var _0x26f714=_0x4bf154?0x0:_0x1bb648[_0xd2b0('0x19')];var _0x563ede=_0x4bf154?_0x11bf3f['count']:_0x1bb648['offset']+_0x1bb648[_0xd2b0('0x1b')];var _0x5a56b5;if(_0x563ede>=_0x207edc){_0x563ede=_0x207edc;_0x5a56b5=0xc8;}else{_0x5a56b5=0xce;}_0x222fed[_0xd2b0('0x17')](_0x5a56b5);return _0x222fed[_0xd2b0('0x1d')](_0xd2b0('0x1e'),_0x26f714+'-'+_0x563ede+'/'+_0x207edc)[_0xd2b0('0x18')](_0x11bf3f);}return null;};}function patchUpdates(_0x1d7698){return function(_0x17b381){try{jsonpatch['apply'](_0x17b381,_0x1d7698,!![]);}catch(_0x2ca934){return BPromise['reject'](_0x2ca934);}return _0x17b381[_0xd2b0('0x1f')]();};}function saveUpdates(_0x410ef6,_0x5c5a6b){return function(_0x24613d){if(_0x24613d){return _0x24613d[_0xd2b0('0x20')](_0x410ef6)['then'](function(_0x559135){return _0x559135;});}return null;};}function removeEntity(_0x33679a,_0x241264){return function(_0x2b837c){if(_0x2b837c){return _0x2b837c['destroy']()[_0xd2b0('0x21')](function(){_0x33679a[_0xd2b0('0x17')](0xcc)[_0xd2b0('0x22')]();});}};}function handleEntityNotFound(_0x10b484,_0x4842d2){return function(_0x49f511){if(!_0x49f511){_0x10b484[_0xd2b0('0x16')](0x194);}return _0x49f511;};}function handleError(_0x12460d,_0x6140f4){_0x6140f4=_0x6140f4||0x1f4;return function(_0x4f9a36){logger['error'](_0x4f9a36[_0xd2b0('0x23')]);if(_0x4f9a36['name']){delete _0x4f9a36[_0xd2b0('0x24')];}_0x12460d[_0xd2b0('0x17')](_0x6140f4)[_0xd2b0('0x25')](_0x4f9a36);};}exports[_0xd2b0('0x26')]=function(_0x2a8b33,_0xcf37e9){var _0xf26c65={},_0x17812a={},_0x34ac54={'count':0x0,'rows':[]};var _0x43fa2c=_[_0xd2b0('0x27')](db[_0xd2b0('0x28')]['rawAttributes'],function(_0x485555){return{'name':_0x485555[_0xd2b0('0x29')],'type':_0x485555[_0xd2b0('0x2a')][_0xd2b0('0x2b')]};});_0x17812a[_0xd2b0('0x2c')]=_[_0xd2b0('0x27')](_0x43fa2c,_0xd2b0('0x24'));_0x17812a[_0xd2b0('0x2d')]=_[_0xd2b0('0x2e')](_0x2a8b33['query']);_0x17812a[_0xd2b0('0x2f')]=_['intersection'](_0x17812a[_0xd2b0('0x2c')],_0x17812a[_0xd2b0('0x2d')]);_0xf26c65[_0xd2b0('0x30')]=_[_0xd2b0('0x31')](_0x17812a[_0xd2b0('0x2c')],qs[_0xd2b0('0x32')](_0x2a8b33['query'][_0xd2b0('0x32')]));_0xf26c65[_0xd2b0('0x30')]=_0xf26c65[_0xd2b0('0x30')][_0xd2b0('0x33')]?_0xf26c65[_0xd2b0('0x30')]:_0x17812a[_0xd2b0('0x2c')];if(!_0x2a8b33[_0xd2b0('0x2d')][_0xd2b0('0x34')](_0xd2b0('0x35'))){_0xf26c65[_0xd2b0('0x1b')]=qs['limit'](_0x2a8b33['query'][_0xd2b0('0x1b')]);_0xf26c65[_0xd2b0('0x19')]=qs['offset'](_0x2a8b33[_0xd2b0('0x2d')][_0xd2b0('0x19')]);}_0xf26c65['order']=qs['sort'](_0x2a8b33['query'][_0xd2b0('0x36')]);_0xf26c65[_0xd2b0('0x37')]=qs['filters'](_[_0xd2b0('0x38')](_0x2a8b33[_0xd2b0('0x2d')],_0x17812a[_0xd2b0('0x2f')]),_0x43fa2c);if(_0x2a8b33[_0xd2b0('0x2d')][_0xd2b0('0x39')]){_0xf26c65[_0xd2b0('0x37')]=_[_0xd2b0('0x3a')](_0xf26c65[_0xd2b0('0x37')],{'$or':_['map'](_0x43fa2c,function(_0x51b8c3){if(_0x51b8c3[_0xd2b0('0x2a')]!=='VIRTUAL'){var _0x5dd633={};_0x5dd633[_0x51b8c3[_0xd2b0('0x24')]]={'$like':'%'+_0x2a8b33[_0xd2b0('0x2d')]['filter']+'%'};return _0x5dd633;}})});}_0xf26c65=_[_0xd2b0('0x3a')]({},_0xf26c65,_0x2a8b33[_0xd2b0('0x3b')]);var _0x4e9092={'where':_0xf26c65[_0xd2b0('0x37')]};return db['SquareReport'][_0xd2b0('0x1c')](_0x4e9092)['then'](function(_0x40bc94){_0x34ac54['count']=_0x40bc94;if(_0x2a8b33['query'][_0xd2b0('0x3c')]){_0xf26c65[_0xd2b0('0x3d')]=[{'all':!![]}];}return db['SquareReport'][_0xd2b0('0x3e')](_0xf26c65);})[_0xd2b0('0x21')](function(_0x28fd6c){_0x34ac54[_0xd2b0('0x3f')]=_0x28fd6c;return _0x34ac54;})[_0xd2b0('0x21')](respondWithFilteredResult(_0xcf37e9,_0xf26c65))[_0xd2b0('0x40')](handleError(_0xcf37e9,null));};exports['show']=function(_0x32b36f,_0x52261c){var _0x39c13f={'raw':!![],'where':{'id':_0x32b36f['params']['id']}},_0x3d2f74={};_0x3d2f74['model']=_[_0xd2b0('0x2e')](db['SquareReport'][_0xd2b0('0x41')]);_0x3d2f74['query']=_[_0xd2b0('0x2e')](_0x32b36f[_0xd2b0('0x2d')]);_0x3d2f74[_0xd2b0('0x2f')]=_['intersection'](_0x3d2f74[_0xd2b0('0x2c')],_0x3d2f74[_0xd2b0('0x2d')]);_0x39c13f[_0xd2b0('0x30')]=_[_0xd2b0('0x31')](_0x3d2f74['model'],qs['fields'](_0x32b36f[_0xd2b0('0x2d')]['fields']));_0x39c13f['attributes']=_0x39c13f[_0xd2b0('0x30')][_0xd2b0('0x33')]?_0x39c13f[_0xd2b0('0x30')]:_0x3d2f74[_0xd2b0('0x2c')];if(_0x32b36f[_0xd2b0('0x2d')][_0xd2b0('0x3c')]){_0x39c13f[_0xd2b0('0x3d')]=[{'all':!![]}];}_0x39c13f=_[_0xd2b0('0x3a')]({},_0x39c13f,_0x32b36f[_0xd2b0('0x3b')]);return db[_0xd2b0('0x28')][_0xd2b0('0x42')](_0x39c13f)['then'](handleEntityNotFound(_0x52261c,null))[_0xd2b0('0x21')](respondWithResult(_0x52261c,null))[_0xd2b0('0x40')](handleError(_0x52261c,null));};exports['create']=function(_0x81f0ab,_0x51e723){return db['SquareReport']['create'](_0x81f0ab[_0xd2b0('0x43')],{})[_0xd2b0('0x21')](respondWithResult(_0x51e723,0xc9))[_0xd2b0('0x40')](handleError(_0x51e723,null));};exports['update']=function(_0x1e8cce,_0x2ba7b5){if(_0x1e8cce['body']['id']){delete _0x1e8cce[_0xd2b0('0x43')]['id'];}return db[_0xd2b0('0x28')][_0xd2b0('0x42')]({'where':{'id':_0x1e8cce['params']['id']}})['then'](handleEntityNotFound(_0x2ba7b5,null))[_0xd2b0('0x21')](saveUpdates(_0x1e8cce['body'],null))[_0xd2b0('0x21')](respondWithResult(_0x2ba7b5,null))[_0xd2b0('0x40')](handleError(_0x2ba7b5,null));};exports[_0xd2b0('0x44')]=function(_0xb0efcb,_0x5d21b4){return db[_0xd2b0('0x28')][_0xd2b0('0x42')]({'where':{'id':_0xb0efcb['params']['id']}})['then'](handleEntityNotFound(_0x5d21b4,null))[_0xd2b0('0x21')](removeEntity(_0x5d21b4,null))[_0xd2b0('0x40')](handleError(_0x5d21b4,null));};exports[_0xd2b0('0x45')]=function(_0x52b1e9,_0x193f36){return db[_0xd2b0('0x28')][_0xd2b0('0x45')]()['then'](respondWithResult(_0x193f36,null))[_0xd2b0('0x40')](handleError(_0x193f36,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2af1617..9019256 100644 --- a/server/api/squareReport/squareReport.model.js +++ b/server/api/squareReport/squareReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f7=['rimraf','../../config/environment','define','SquareReport','report_square','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xd4f7,0xe8));var _0x7d4f=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xd4f7[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0x7d4f('0x0'));var util=require(_0x7d4f('0x1'));var logger=require(_0x7d4f('0x2'))(_0x7d4f('0x3'));var moment=require(_0x7d4f('0x4'));var BPromise=require(_0x7d4f('0x5'));var rp=require(_0x7d4f('0x6'));var fs=require('fs');var path=require(_0x7d4f('0x7'));var rimraf=require(_0x7d4f('0x8'));var config=require(_0x7d4f('0x9'));var attributes=require('./squareReport.attributes');module['exports']=function(_0x2de8d2,_0x35fd6f){return _0x2de8d2[_0x7d4f('0xa')](_0x7d4f('0xb'),attributes,{'tableName':_0x7d4f('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x7d4f('0xd')]},{'name':_0x7d4f('0xe'),'fields':[_0x7d4f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f10=['uniqueid','project_name','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname'];(function(_0x53ef79,_0x13c62b){var _0x3e4ad6=function(_0x3ff709){while(--_0x3ff709){_0x53ef79['push'](_0x53ef79['shift']());}};_0x3e4ad6(++_0x13c62b);}(_0x5f10,0x10c));var _0x05f1=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0x5f10[_0x3e1829];return _0x129345;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var logger=require(_0x05f1('0x2'))(_0x05f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x05f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x05f1('0x5'));var config=require(_0x05f1('0x6'));var attributes=require(_0x05f1('0x7'));module[_0x05f1('0x8')]=function(_0x25b02b,_0x90e02b){return _0x25b02b[_0x05f1('0x9')]('SquareReport',attributes,{'tableName':_0x05f1('0xa'),'paranoid':![],'indexes':[{'name':_0x05f1('0xb'),'fields':[_0x05f1('0xc'),_0x05f1('0xd')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 1d49a75..222b8b0 100644 --- a/server/api/squareReport/squareReport.rpc.js +++ b/server/api/squareReport/squareReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd307=['message','result','catch','CreateSquareReport','SquareReport','options','then','UpdateSquareReport','body','raw','where','attributes','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4e9ed1,_0x7d61ec){var _0x38cd16=function(_0x28e1e2){while(--_0x28e1e2){_0x4e9ed1['push'](_0x4e9ed1['shift']());}};_0x38cd16(++_0x7d61ec);}(_0xd307,0x143));var _0x7d30=function(_0x558d4f,_0x3c32ae){_0x558d4f=_0x558d4f-0x0;var _0x4abb73=_0xd307[_0x558d4f];return _0x4abb73;};'use strict';var _=require(_0x7d30('0x0'));var util=require(_0x7d30('0x1'));var moment=require(_0x7d30('0x2'));var BPromise=require(_0x7d30('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d30('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d30('0x5'))('rpc');var config=require(_0x7d30('0x6'));var jayson=require(_0x7d30('0x7'));var client=jayson[_0x7d30('0x8')][_0x7d30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10b3eb,_0x4a7bda,_0x1e7bd4){return new BPromise(function(_0x288ed4,_0x724db){return client['request'](_0x10b3eb,_0x1e7bd4)['then'](function(_0x5e0d69){logger[_0x7d30('0xa')](_0x7d30('0xb'),_0x4a7bda,_0x7d30('0xc'));logger[_0x7d30('0xd')](_0x7d30('0xe'),_0x4a7bda,_0x7d30('0xc'),JSON[_0x7d30('0xf')](_0x5e0d69));if(_0x5e0d69[_0x7d30('0x10')]){if(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x11')]===0x1f4){logger[_0x7d30('0x10')]('SquareReport,\x20%s,\x20%s',_0x4a7bda,_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);return _0x724db(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);}logger[_0x7d30('0x10')](_0x7d30('0xb'),_0x4a7bda,_0x5e0d69['error'][_0x7d30('0x12')]);return _0x288ed4(_0x5e0d69[_0x7d30('0x10')][_0x7d30('0x12')]);}else{logger[_0x7d30('0xa')](_0x7d30('0xb'),_0x4a7bda,'request\x20sent');_0x288ed4(_0x5e0d69[_0x7d30('0x13')][_0x7d30('0x12')]);}})[_0x7d30('0x14')](function(_0x4b8e2c){logger[_0x7d30('0x10')]('SquareReport,\x20%s,\x20%s',_0x4a7bda,_0x4b8e2c);_0x724db(_0x4b8e2c);});});}exports[_0x7d30('0x15')]=function(_0x1da56a){var _0x20e1ca=this;return new Promise(function(_0x4aef11,_0x412aa0){return db[_0x7d30('0x16')]['create'](_0x1da56a['body'],{'raw':_0x1da56a['options']?_0x1da56a[_0x7d30('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7d30('0x18')](function(_0xeb9a80){logger[_0x7d30('0xa')](_0x7d30('0x15'),_0x1da56a);logger[_0x7d30('0xd')](_0x7d30('0x15'),_0x1da56a,JSON['stringify'](_0xeb9a80));_0x4aef11(_0xeb9a80);})['catch'](function(_0x151cce){logger[_0x7d30('0x10')](_0x7d30('0x15'),_0x151cce['message'],_0x1da56a);_0x412aa0(_0x20e1ca[_0x7d30('0x10')](0x1f4,_0x151cce[_0x7d30('0x12')]));});});};exports[_0x7d30('0x19')]=function(_0x4880a2){var _0x3dece2=this;return new Promise(function(_0x4f6207,_0x588edc){return db[_0x7d30('0x16')]['update'](_0x4880a2[_0x7d30('0x1a')],{'raw':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1c')]||null:null,'attributes':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1d')]||null:null,'limit':_0x4880a2[_0x7d30('0x17')]?_0x4880a2[_0x7d30('0x17')][_0x7d30('0x1e')]||null:null})[_0x7d30('0x18')](function(_0x451e86){logger['info'](_0x7d30('0x19'),_0x4880a2);logger[_0x7d30('0xd')]('UpdateSquareReport',_0x4880a2,JSON['stringify'](_0x451e86));_0x4f6207(_0x451e86);})['catch'](function(_0x2bac7e){logger['error'](_0x7d30('0x19'),_0x2bac7e[_0x7d30('0x12')],_0x4880a2);_0x588edc(_0x3dece2[_0x7d30('0x10')](0x1f4,_0x2bac7e['message']));});});}; \ No newline at end of file +var _0x45cc=['info','UpdateSquareReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','options','then'];(function(_0x1a02a9,_0x906f45){var _0x4c241f=function(_0xcae2da){while(--_0xcae2da){_0x1a02a9['push'](_0x1a02a9['shift']());}};_0x4c241f(++_0x906f45);}(_0x45cc,0x1b8));var _0xc45c=function(_0x425036,_0x39bebc){_0x425036=_0x425036-0x0;var _0x7fc880=_0x45cc[_0x425036];return _0x7fc880;};'use strict';var _=require(_0xc45c('0x0'));var util=require(_0xc45c('0x1'));var moment=require(_0xc45c('0x2'));var BPromise=require(_0xc45c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc45c('0x4'));var db=require(_0xc45c('0x5'))['db'];var utils=require(_0xc45c('0x6'));var logger=require(_0xc45c('0x7'))('rpc');var config=require(_0xc45c('0x8'));var jayson=require(_0xc45c('0x9'));var client=jayson[_0xc45c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa79e86,_0x1bbd16,_0x334694){return new BPromise(function(_0x41a97f,_0x428084){return client[_0xc45c('0xb')](_0xa79e86,_0x334694)['then'](function(_0x1bac3f){logger['info']('SquareReport,\x20%s,\x20%s',_0x1bbd16,_0xc45c('0xc'));logger[_0xc45c('0xd')](_0xc45c('0xe'),_0x1bbd16,_0xc45c('0xc'),JSON[_0xc45c('0xf')](_0x1bac3f));if(_0x1bac3f[_0xc45c('0x10')]){if(_0x1bac3f[_0xc45c('0x10')]['code']===0x1f4){logger[_0xc45c('0x10')](_0xc45c('0x11'),_0x1bbd16,_0x1bac3f[_0xc45c('0x10')][_0xc45c('0x12')]);return _0x428084(_0x1bac3f[_0xc45c('0x10')][_0xc45c('0x12')]);}logger[_0xc45c('0x10')](_0xc45c('0x11'),_0x1bbd16,_0x1bac3f[_0xc45c('0x10')]['message']);return _0x41a97f(_0x1bac3f[_0xc45c('0x10')]['message']);}else{logger['info'](_0xc45c('0x11'),_0x1bbd16,'request\x20sent');_0x41a97f(_0x1bac3f[_0xc45c('0x13')][_0xc45c('0x12')]);}})[_0xc45c('0x14')](function(_0x338454){logger[_0xc45c('0x10')](_0xc45c('0x11'),_0x1bbd16,_0x338454);_0x428084(_0x338454);});});}exports[_0xc45c('0x15')]=function(_0x32188c){var _0x344530=this;return new Promise(function(_0x3a956d,_0x113339){return db['SquareReport'][_0xc45c('0x16')](_0x32188c['body'],{'raw':_0x32188c[_0xc45c('0x17')]?_0x32188c['options']['raw']===undefined?!![]:![]:!![]})[_0xc45c('0x18')](function(_0x34fa95){logger[_0xc45c('0x19')]('CreateSquareReport',_0x32188c);logger[_0xc45c('0xd')]('CreateSquareReport',_0x32188c,JSON['stringify'](_0x34fa95));_0x3a956d(_0x34fa95);})[_0xc45c('0x14')](function(_0x49c414){logger[_0xc45c('0x10')](_0xc45c('0x15'),_0x49c414[_0xc45c('0x12')],_0x32188c);_0x113339(_0x344530[_0xc45c('0x10')](0x1f4,_0x49c414[_0xc45c('0x12')]));});});};exports[_0xc45c('0x1a')]=function(_0xb0782e){var _0x30529e=this;return new Promise(function(_0x16d9a1,_0x9096dc){return db['SquareReport'][_0xc45c('0x1b')](_0xb0782e['body'],{'raw':_0xb0782e[_0xc45c('0x17')]?_0xb0782e[_0xc45c('0x17')][_0xc45c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb0782e[_0xc45c('0x17')]?_0xb0782e[_0xc45c('0x17')][_0xc45c('0x1d')]||null:null,'attributes':_0xb0782e[_0xc45c('0x17')]?_0xb0782e[_0xc45c('0x17')]['attributes']||null:null,'limit':_0xb0782e['options']?_0xb0782e[_0xc45c('0x17')][_0xc45c('0x1e')]||null:null})[_0xc45c('0x18')](function(_0x17d253){logger['info']('UpdateSquareReport',_0xb0782e);logger[_0xc45c('0xd')](_0xc45c('0x1a'),_0xb0782e,JSON[_0xc45c('0xf')](_0x17d253));_0x16d9a1(_0x17d253);})[_0xc45c('0x14')](function(_0x1d268d){logger[_0xc45c('0x10')]('UpdateSquareReport',_0x1d268d[_0xc45c('0x12')],_0xb0782e);_0x9096dc(_0x30529e[_0xc45c('0x10')](0x1f4,_0x1d268d[_0xc45c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 31fbf2d..80e9ea9 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e02=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','exports'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x1e02,0x140));var _0x21e0=function(_0x5e45cd,_0x2e73fe){_0x5e45cd=_0x5e45cd-0x0;var _0x545b4b=_0x1e02[_0x5e45cd];return _0x545b4b;};'use strict';var multer=require('multer');var util=require(_0x21e0('0x0'));var path=require(_0x21e0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e0('0x2')]();var fs_extra=require(_0x21e0('0x3'));var auth=require(_0x21e0('0x4'));var interaction=require(_0x21e0('0x5'));var config=require(_0x21e0('0x6'));var controller=require('./squareReportDetail.controller');router[_0x21e0('0x7')]('/',auth['isAuthenticated'](),controller[_0x21e0('0x8')]);router['get'](_0x21e0('0x9'),auth[_0x21e0('0xa')](),controller[_0x21e0('0xb')]);router['get']('/:id',auth[_0x21e0('0xa')](),controller[_0x21e0('0xc')]);router[_0x21e0('0xd')]('/',auth['isAuthenticated'](),controller[_0x21e0('0xe')]);router[_0x21e0('0xf')]('/:id',auth[_0x21e0('0xa')](),controller[_0x21e0('0x10')]);router[_0x21e0('0x11')](_0x21e0('0x12'),auth[_0x21e0('0xa')](),controller['destroy']);module[_0x21e0('0x13')]=router; \ No newline at end of file +var _0x699b=['express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x699b,0x174));var _0xb699=function(_0x309144,_0x3783bb){_0x309144=_0x309144-0x0;var _0x278139=_0x699b[_0x309144];return _0x278139;};'use strict';var multer=require(_0xb699('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb699('0x1'));var express=require(_0xb699('0x2'));var router=express[_0xb699('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb699('0x4'));var config=require(_0xb699('0x5'));var controller=require('./squareReportDetail.controller');router[_0xb699('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb699('0x6')](_0xb699('0x7'),auth[_0xb699('0x8')](),controller[_0xb699('0x9')]);router[_0xb699('0x6')](_0xb699('0xa'),auth[_0xb699('0x8')](),controller[_0xb699('0xb')]);router[_0xb699('0xc')]('/',auth[_0xb699('0x8')](),controller[_0xb699('0xd')]);router['put'](_0xb699('0xa'),auth[_0xb699('0x8')](),controller[_0xb699('0xe')]);router[_0xb699('0xf')](_0xb699('0xa'),auth['isAuthenticated'](),controller[_0xb699('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f94c1b3..64c968b 100644 --- a/server/api/squareReportDetail/squareReportDetail.attributes.js +++ b/server/api/squareReportDetail/squareReportDetail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x419d=['exports','STRING','TEXT','sequelize'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x419d,0x11f));var _0xd419=function(_0x4801a0,_0x252c24){_0x4801a0=_0x4801a0-0x0;var _0x338e26=_0x419d[_0x4801a0];return _0x338e26;};'use strict';var Sequelize=require(_0xd419('0x0'));module[_0xd419('0x1')]={'uniqueid':{'type':Sequelize[_0xd419('0x2')]},'node':{'type':Sequelize[_0xd419('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xd419('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd419('0x2')]}}; \ No newline at end of file +var _0x2102=['exports','STRING','sequelize'];(function(_0x9cf14e,_0x57d04f){var _0x14877a=function(_0x35e94f){while(--_0x35e94f){_0x9cf14e['push'](_0x9cf14e['shift']());}};_0x14877a(++_0x57d04f);}(_0x2102,0x179));var _0x2210=function(_0x550d07,_0x13084f){_0x550d07=_0x550d07-0x0;var _0x3be37c=_0x2102[_0x550d07];return _0x3be37c;};'use strict';var Sequelize=require(_0x2210('0x0'));module[_0x2210('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x2210('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x2210('0x2')]},'callerid':{'type':Sequelize[_0x2210('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index edb9378..36bc064 100644 --- a/server/api/squareReportDetail/squareReportDetail.controller.js +++ b/server/api/squareReportDetail/squareReportDetail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x05ec=['reject','save','update','then','destroy','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply'];(function(_0x11d62e,_0x5b093f){var _0x22b971=function(_0xeba872){while(--_0xeba872){_0x11d62e['push'](_0x11d62e['shift']());}};_0x22b971(++_0x5b093f);}(_0x05ec,0x107));var _0xc05e=function(_0x134527,_0x45f6cc){_0x134527=_0x134527-0x0;var _0x2ee10d=_0x05ec[_0x134527];return _0x2ee10d;};'use strict';var emlformat=require(_0xc05e('0x0'));var rimraf=require(_0xc05e('0x1'));var zipdir=require(_0xc05e('0x2'));var jsonpatch=require(_0xc05e('0x3'));var rp=require('request-promise');var moment=require(_0xc05e('0x4'));var BPromise=require(_0xc05e('0x5'));var Mustache=require(_0xc05e('0x6'));var util=require('util');var path=require(_0xc05e('0x7'));var sox=require(_0xc05e('0x8'));var csv=require(_0xc05e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc05e('0xa'));var _=require(_0xc05e('0xb'));var squel=require(_0xc05e('0xc'));var crypto=require(_0xc05e('0xd'));var jsforce=require(_0xc05e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc05e('0x9'));var querystring=require(_0xc05e('0xf'));var Papa=require('papaparse');var Redis=require(_0xc05e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc05e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc05e('0x12'));var utils=require(_0xc05e('0x13'));var config=require(_0xc05e('0x14'));var licenseUtil=require(_0xc05e('0x15'));var db=require(_0xc05e('0x16'))['db'];function respondWithStatusCode(_0x2489f8,_0x2f1cce){_0x2f1cce=_0x2f1cce||0xcc;return function(_0x5e1449){if(_0x5e1449){return _0x2489f8[_0xc05e('0x17')](_0x2f1cce);}return _0x2489f8[_0xc05e('0x18')](_0x2f1cce)[_0xc05e('0x19')]();};}function respondWithResult(_0x39e8c8,_0x5e92ac){_0x5e92ac=_0x5e92ac||0xc8;return function(_0xaad51e){if(_0xaad51e){return _0x39e8c8[_0xc05e('0x18')](_0x5e92ac)[_0xc05e('0x1a')](_0xaad51e);}};}function respondWithFilteredResult(_0x20274,_0x10d2eb){return function(_0x312061){if(_0x312061){var _0x58cbc3=typeof _0x10d2eb[_0xc05e('0x1b')]===_0xc05e('0x1c')&&typeof _0x10d2eb[_0xc05e('0x1d')]===_0xc05e('0x1c');var _0x19e09d=_0x312061['count'];var _0x496847=_0x58cbc3?0x0:_0x10d2eb[_0xc05e('0x1b')];var _0xb9a696=_0x58cbc3?_0x312061[_0xc05e('0x1e')]:_0x10d2eb[_0xc05e('0x1b')]+_0x10d2eb['limit'];var _0x371c13;if(_0xb9a696>=_0x19e09d){_0xb9a696=_0x19e09d;_0x371c13=0xc8;}else{_0x371c13=0xce;}_0x20274[_0xc05e('0x18')](_0x371c13);return _0x20274[_0xc05e('0x1f')]('Content-Range',_0x496847+'-'+_0xb9a696+'/'+_0x19e09d)['json'](_0x312061);}return null;};}function patchUpdates(_0x5cc25f){return function(_0x1ade80){try{jsonpatch[_0xc05e('0x20')](_0x1ade80,_0x5cc25f,!![]);}catch(_0xde3b1){return BPromise[_0xc05e('0x21')](_0xde3b1);}return _0x1ade80[_0xc05e('0x22')]();};}function saveUpdates(_0x561579,_0xedab56){return function(_0x2fd3dc){if(_0x2fd3dc){return _0x2fd3dc[_0xc05e('0x23')](_0x561579)[_0xc05e('0x24')](function(_0x44ed01){return _0x44ed01;});}return null;};}function removeEntity(_0x146264,_0x542b50){return function(_0x173ac0){if(_0x173ac0){return _0x173ac0[_0xc05e('0x25')]()[_0xc05e('0x24')](function(){_0x146264[_0xc05e('0x18')](0xcc)[_0xc05e('0x19')]();});}};}function handleEntityNotFound(_0x146d34,_0x5940aa){return function(_0x305373){if(!_0x305373){_0x146d34[_0xc05e('0x17')](0x194);}return _0x305373;};}function handleError(_0x475394,_0x2b0285){_0x2b0285=_0x2b0285||0x1f4;return function(_0x4f5bcf){logger[_0xc05e('0x26')](_0x4f5bcf['stack']);if(_0x4f5bcf[_0xc05e('0x27')]){delete _0x4f5bcf[_0xc05e('0x27')];}_0x475394['status'](_0x2b0285)[_0xc05e('0x28')](_0x4f5bcf);};}exports[_0xc05e('0x29')]=function(_0x308670,_0x2f4afd){var _0x3a1801={},_0x296dcb={},_0x47f64d={'count':0x0,'rows':[]};var _0x3cf0a6=_[_0xc05e('0x2a')](db[_0xc05e('0x2b')][_0xc05e('0x2c')],function(_0x548a63){return{'name':_0x548a63[_0xc05e('0x2d')],'type':_0x548a63[_0xc05e('0x2e')]['key']};});_0x296dcb[_0xc05e('0x2f')]=_[_0xc05e('0x2a')](_0x3cf0a6,_0xc05e('0x27'));_0x296dcb[_0xc05e('0x30')]=_['keys'](_0x308670[_0xc05e('0x30')]);_0x296dcb[_0xc05e('0x31')]=_['intersection'](_0x296dcb['model'],_0x296dcb[_0xc05e('0x30')]);_0x3a1801[_0xc05e('0x32')]=_[_0xc05e('0x33')](_0x296dcb[_0xc05e('0x2f')],qs[_0xc05e('0x34')](_0x308670[_0xc05e('0x30')][_0xc05e('0x34')]));_0x3a1801[_0xc05e('0x32')]=_0x3a1801[_0xc05e('0x32')]['length']?_0x3a1801['attributes']:_0x296dcb[_0xc05e('0x2f')];if(!_0x308670[_0xc05e('0x30')][_0xc05e('0x35')](_0xc05e('0x36'))){_0x3a1801[_0xc05e('0x1d')]=qs['limit'](_0x308670['query'][_0xc05e('0x1d')]);_0x3a1801[_0xc05e('0x1b')]=qs[_0xc05e('0x1b')](_0x308670[_0xc05e('0x30')][_0xc05e('0x1b')]);}_0x3a1801['order']=qs[_0xc05e('0x37')](_0x308670[_0xc05e('0x30')][_0xc05e('0x37')]);_0x3a1801['where']=qs[_0xc05e('0x31')](_[_0xc05e('0x38')](_0x308670[_0xc05e('0x30')],_0x296dcb['filters']),_0x3cf0a6);if(_0x308670[_0xc05e('0x30')][_0xc05e('0x39')]){_0x3a1801[_0xc05e('0x3a')]=_[_0xc05e('0x3b')](_0x3a1801[_0xc05e('0x3a')],{'$or':_['map'](_0x3cf0a6,function(_0x43cd69){if(_0x43cd69[_0xc05e('0x2e')]!==_0xc05e('0x3c')){var _0x22d927={};_0x22d927[_0x43cd69[_0xc05e('0x27')]]={'$like':'%'+_0x308670[_0xc05e('0x30')][_0xc05e('0x39')]+'%'};return _0x22d927;}})});}_0x3a1801=_[_0xc05e('0x3b')]({},_0x3a1801,_0x308670[_0xc05e('0x3d')]);var _0x5c5604={'where':_0x3a1801[_0xc05e('0x3a')]};return db['SquareDetailsReport'][_0xc05e('0x1e')](_0x5c5604)['then'](function(_0x20e955){_0x47f64d[_0xc05e('0x1e')]=_0x20e955;if(_0x308670[_0xc05e('0x30')][_0xc05e('0x3e')]){_0x3a1801[_0xc05e('0x3f')]=[{'all':!![]}];}return db[_0xc05e('0x2b')][_0xc05e('0x40')](_0x3a1801);})[_0xc05e('0x24')](function(_0x4bcc12){_0x47f64d['rows']=_0x4bcc12;return _0x47f64d;})[_0xc05e('0x24')](respondWithFilteredResult(_0x2f4afd,_0x3a1801))[_0xc05e('0x41')](handleError(_0x2f4afd,null));};exports[_0xc05e('0x42')]=function(_0xbabb80,_0x4f4f99){var _0x1addb8={'raw':!![],'where':{'id':_0xbabb80[_0xc05e('0x43')]['id']}},_0x36ba30={};_0x36ba30['model']=_['keys'](db[_0xc05e('0x2b')][_0xc05e('0x2c')]);_0x36ba30[_0xc05e('0x30')]=_[_0xc05e('0x44')](_0xbabb80[_0xc05e('0x30')]);_0x36ba30[_0xc05e('0x31')]=_['intersection'](_0x36ba30[_0xc05e('0x2f')],_0x36ba30['query']);_0x1addb8['attributes']=_[_0xc05e('0x33')](_0x36ba30[_0xc05e('0x2f')],qs['fields'](_0xbabb80[_0xc05e('0x30')]['fields']));_0x1addb8[_0xc05e('0x32')]=_0x1addb8['attributes'][_0xc05e('0x45')]?_0x1addb8[_0xc05e('0x32')]:_0x36ba30[_0xc05e('0x2f')];if(_0xbabb80[_0xc05e('0x30')][_0xc05e('0x3e')]){_0x1addb8[_0xc05e('0x3f')]=[{'all':!![]}];}_0x1addb8=_[_0xc05e('0x3b')]({},_0x1addb8,_0xbabb80[_0xc05e('0x3d')]);return db[_0xc05e('0x2b')][_0xc05e('0x46')](_0x1addb8)[_0xc05e('0x24')](handleEntityNotFound(_0x4f4f99,null))[_0xc05e('0x24')](respondWithResult(_0x4f4f99,null))['catch'](handleError(_0x4f4f99,null));};exports[_0xc05e('0x47')]=function(_0x54ca34,_0x10a51c){return db['SquareDetailsReport'][_0xc05e('0x47')](_0x54ca34[_0xc05e('0x48')],{})[_0xc05e('0x24')](respondWithResult(_0x10a51c,0xc9))[_0xc05e('0x41')](handleError(_0x10a51c,null));};exports[_0xc05e('0x23')]=function(_0x36b506,_0x1da9a0){if(_0x36b506[_0xc05e('0x48')]['id']){delete _0x36b506[_0xc05e('0x48')]['id'];}return db[_0xc05e('0x2b')][_0xc05e('0x46')]({'where':{'id':_0x36b506[_0xc05e('0x43')]['id']}})[_0xc05e('0x24')](handleEntityNotFound(_0x1da9a0,null))[_0xc05e('0x24')](saveUpdates(_0x36b506['body'],null))[_0xc05e('0x24')](respondWithResult(_0x1da9a0,null))[_0xc05e('0x41')](handleError(_0x1da9a0,null));};exports['destroy']=function(_0x44c8c4,_0x2bb85b){return db[_0xc05e('0x2b')][_0xc05e('0x46')]({'where':{'id':_0x44c8c4[_0xc05e('0x43')]['id']}})[_0xc05e('0x24')](handleEntityNotFound(_0x2bb85b,null))[_0xc05e('0x24')](removeEntity(_0x2bb85b,null))[_0xc05e('0x41')](handleError(_0x2bb85b,null));};exports[_0xc05e('0x49')]=function(_0x4346d4,_0x11643e){return db[_0xc05e('0x2b')][_0xc05e('0x49')]()[_0xc05e('0x24')](respondWithResult(_0x11643e,null))[_0xc05e('0x41')](handleError(_0x11643e,null));}; \ No newline at end of file +var _0x197e=['pick','filter','merge','VIRTUAL','options','count','findAll','show','keys','includeAll','include','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','apply','save','update','destroy','then','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','where'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x197e,0x12d));var _0xe197=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x197e[_0x5f0089];return _0x193892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe197('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe197('0x1'));var rp=require(_0xe197('0x2'));var moment=require('moment');var BPromise=require(_0xe197('0x3'));var Mustache=require(_0xe197('0x4'));var util=require(_0xe197('0x5'));var path=require('path');var sox=require(_0xe197('0x6'));var csv=require(_0xe197('0x7'));var ejs=require(_0xe197('0x8'));var fs=require('fs');var fs_extra=require(_0xe197('0x9'));var _=require('lodash');var squel=require(_0xe197('0xa'));var crypto=require(_0xe197('0xb'));var jsforce=require(_0xe197('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe197('0xd'));var Papa=require(_0xe197('0xe'));var Redis=require('ioredis');var authService=require(_0xe197('0xf'));var qs=require(_0xe197('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe197('0x11'));var logger=require(_0xe197('0x12'))(_0xe197('0x13'));var utils=require(_0xe197('0x14'));var config=require(_0xe197('0x15'));var licenseUtil=require(_0xe197('0x16'));var db=require(_0xe197('0x17'))['db'];function respondWithStatusCode(_0x5b436c,_0x57cf94){_0x57cf94=_0x57cf94||0xcc;return function(_0x291a90){if(_0x291a90){return _0x5b436c[_0xe197('0x18')](_0x57cf94);}return _0x5b436c[_0xe197('0x19')](_0x57cf94)[_0xe197('0x1a')]();};}function respondWithResult(_0x66f9bf,_0x48b5ce){_0x48b5ce=_0x48b5ce||0xc8;return function(_0x191bec){if(_0x191bec){return _0x66f9bf[_0xe197('0x19')](_0x48b5ce)[_0xe197('0x1b')](_0x191bec);}};}function respondWithFilteredResult(_0x2eeb7e,_0x4d7011){return function(_0x265338){if(_0x265338){var _0x295939=typeof _0x4d7011[_0xe197('0x1c')]===_0xe197('0x1d')&&typeof _0x4d7011['limit']===_0xe197('0x1d');var _0x42979e=_0x265338['count'];var _0x28fc38=_0x295939?0x0:_0x4d7011['offset'];var _0x26d3bd=_0x295939?_0x265338['count']:_0x4d7011[_0xe197('0x1c')]+_0x4d7011['limit'];var _0xbdc240;if(_0x26d3bd>=_0x42979e){_0x26d3bd=_0x42979e;_0xbdc240=0xc8;}else{_0xbdc240=0xce;}_0x2eeb7e[_0xe197('0x19')](_0xbdc240);return _0x2eeb7e['set']('Content-Range',_0x28fc38+'-'+_0x26d3bd+'/'+_0x42979e)[_0xe197('0x1b')](_0x265338);}return null;};}function patchUpdates(_0x1a5f3a){return function(_0x239e98){try{jsonpatch[_0xe197('0x1e')](_0x239e98,_0x1a5f3a,!![]);}catch(_0xed1b6b){return BPromise['reject'](_0xed1b6b);}return _0x239e98[_0xe197('0x1f')]();};}function saveUpdates(_0x1d1dc9,_0x4ae9f1){return function(_0x2aa4bb){if(_0x2aa4bb){return _0x2aa4bb[_0xe197('0x20')](_0x1d1dc9)['then'](function(_0x1974fb){return _0x1974fb;});}return null;};}function removeEntity(_0x4ec3fb,_0x482565){return function(_0x1ab225){if(_0x1ab225){return _0x1ab225[_0xe197('0x21')]()[_0xe197('0x22')](function(){_0x4ec3fb[_0xe197('0x19')](0xcc)[_0xe197('0x1a')]();});}};}function handleEntityNotFound(_0x1b60f9,_0x4ddd63){return function(_0x489fa1){if(!_0x489fa1){_0x1b60f9[_0xe197('0x18')](0x194);}return _0x489fa1;};}function handleError(_0x336602,_0x483cd8){_0x483cd8=_0x483cd8||0x1f4;return function(_0x2c1aea){logger[_0xe197('0x23')](_0x2c1aea['stack']);if(_0x2c1aea[_0xe197('0x24')]){delete _0x2c1aea[_0xe197('0x24')];}_0x336602['status'](_0x483cd8)[_0xe197('0x25')](_0x2c1aea);};}exports['index']=function(_0x10d7a1,_0x54bbf2){var _0x35b517={},_0x392915={},_0x3c7b47={'count':0x0,'rows':[]};var _0x961914=_[_0xe197('0x26')](db[_0xe197('0x27')][_0xe197('0x28')],function(_0x1ec7b8){return{'name':_0x1ec7b8[_0xe197('0x29')],'type':_0x1ec7b8[_0xe197('0x2a')][_0xe197('0x2b')]};});_0x392915[_0xe197('0x2c')]=_[_0xe197('0x26')](_0x961914,_0xe197('0x24'));_0x392915[_0xe197('0x2d')]=_['keys'](_0x10d7a1[_0xe197('0x2d')]);_0x392915[_0xe197('0x2e')]=_['intersection'](_0x392915[_0xe197('0x2c')],_0x392915[_0xe197('0x2d')]);_0x35b517['attributes']=_[_0xe197('0x2f')](_0x392915['model'],qs['fields'](_0x10d7a1[_0xe197('0x2d')][_0xe197('0x30')]));_0x35b517[_0xe197('0x31')]=_0x35b517[_0xe197('0x31')][_0xe197('0x32')]?_0x35b517['attributes']:_0x392915[_0xe197('0x2c')];if(!_0x10d7a1['query']['hasOwnProperty'](_0xe197('0x33'))){_0x35b517[_0xe197('0x34')]=qs[_0xe197('0x34')](_0x10d7a1[_0xe197('0x2d')][_0xe197('0x34')]);_0x35b517[_0xe197('0x1c')]=qs[_0xe197('0x1c')](_0x10d7a1[_0xe197('0x2d')][_0xe197('0x1c')]);}_0x35b517['order']=qs['sort'](_0x10d7a1[_0xe197('0x2d')]['sort']);_0x35b517[_0xe197('0x35')]=qs[_0xe197('0x2e')](_[_0xe197('0x36')](_0x10d7a1[_0xe197('0x2d')],_0x392915[_0xe197('0x2e')]),_0x961914);if(_0x10d7a1[_0xe197('0x2d')][_0xe197('0x37')]){_0x35b517[_0xe197('0x35')]=_[_0xe197('0x38')](_0x35b517[_0xe197('0x35')],{'$or':_[_0xe197('0x26')](_0x961914,function(_0x319080){if(_0x319080[_0xe197('0x2a')]!==_0xe197('0x39')){var _0x3a37a2={};_0x3a37a2[_0x319080[_0xe197('0x24')]]={'$like':'%'+_0x10d7a1['query'][_0xe197('0x37')]+'%'};return _0x3a37a2;}})});}_0x35b517=_[_0xe197('0x38')]({},_0x35b517,_0x10d7a1[_0xe197('0x3a')]);var _0x27f7c0={'where':_0x35b517[_0xe197('0x35')]};return db[_0xe197('0x27')][_0xe197('0x3b')](_0x27f7c0)[_0xe197('0x22')](function(_0x265104){_0x3c7b47[_0xe197('0x3b')]=_0x265104;if(_0x10d7a1['query']['includeAll']){_0x35b517['include']=[{'all':!![]}];}return db[_0xe197('0x27')][_0xe197('0x3c')](_0x35b517);})['then'](function(_0x356a29){_0x3c7b47['rows']=_0x356a29;return _0x3c7b47;})[_0xe197('0x22')](respondWithFilteredResult(_0x54bbf2,_0x35b517))['catch'](handleError(_0x54bbf2,null));};exports[_0xe197('0x3d')]=function(_0x2cb018,_0x521306){var _0xa35670={'raw':!![],'where':{'id':_0x2cb018['params']['id']}},_0x3c7b48={};_0x3c7b48[_0xe197('0x2c')]=_[_0xe197('0x3e')](db['SquareDetailsReport'][_0xe197('0x28')]);_0x3c7b48['query']=_[_0xe197('0x3e')](_0x2cb018[_0xe197('0x2d')]);_0x3c7b48['filters']=_[_0xe197('0x2f')](_0x3c7b48['model'],_0x3c7b48[_0xe197('0x2d')]);_0xa35670[_0xe197('0x31')]=_[_0xe197('0x2f')](_0x3c7b48[_0xe197('0x2c')],qs['fields'](_0x2cb018[_0xe197('0x2d')]['fields']));_0xa35670['attributes']=_0xa35670[_0xe197('0x31')]['length']?_0xa35670['attributes']:_0x3c7b48['model'];if(_0x2cb018['query'][_0xe197('0x3f')]){_0xa35670[_0xe197('0x40')]=[{'all':!![]}];}_0xa35670=_[_0xe197('0x38')]({},_0xa35670,_0x2cb018[_0xe197('0x3a')]);return db[_0xe197('0x27')][_0xe197('0x41')](_0xa35670)[_0xe197('0x22')](handleEntityNotFound(_0x521306,null))[_0xe197('0x22')](respondWithResult(_0x521306,null))[_0xe197('0x42')](handleError(_0x521306,null));};exports[_0xe197('0x43')]=function(_0x4be747,_0x3a09db){return db[_0xe197('0x27')]['create'](_0x4be747[_0xe197('0x44')],{})[_0xe197('0x22')](respondWithResult(_0x3a09db,0xc9))[_0xe197('0x42')](handleError(_0x3a09db,null));};exports[_0xe197('0x20')]=function(_0x9c9826,_0x1c093f){if(_0x9c9826[_0xe197('0x44')]['id']){delete _0x9c9826['body']['id'];}return db['SquareDetailsReport'][_0xe197('0x41')]({'where':{'id':_0x9c9826[_0xe197('0x45')]['id']}})[_0xe197('0x22')](handleEntityNotFound(_0x1c093f,null))[_0xe197('0x22')](saveUpdates(_0x9c9826[_0xe197('0x44')],null))[_0xe197('0x22')](respondWithResult(_0x1c093f,null))[_0xe197('0x42')](handleError(_0x1c093f,null));};exports[_0xe197('0x21')]=function(_0x3a8662,_0x48c69e){return db[_0xe197('0x27')][_0xe197('0x41')]({'where':{'id':_0x3a8662[_0xe197('0x45')]['id']}})[_0xe197('0x22')](handleEntityNotFound(_0x48c69e,null))[_0xe197('0x22')](removeEntity(_0x48c69e,null))[_0xe197('0x42')](handleError(_0x48c69e,null));};exports[_0xe197('0x46')]=function(_0x3123ca,_0x1ef927){return db[_0xe197('0x27')]['describe']()[_0xe197('0x22')](respondWithResult(_0x1ef927,null))['catch'](handleError(_0x1ef927,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 41e8871..a8a38e6 100644 --- a/server/api/squareReportDetail/squareReportDetail.model.js +++ b/server/api/squareReportDetail/squareReportDetail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a7a=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash'];(function(_0xaea4ca,_0x462707){var _0x4e00c3=function(_0x45229d){while(--_0x45229d){_0xaea4ca['push'](_0xaea4ca['shift']());}};_0x4e00c3(++_0x462707);}(_0x8a7a,0x6b));var _0xa8a7=function(_0x405ebb,_0x548660){_0x405ebb=_0x405ebb-0x0;var _0xd89ca9=_0x8a7a[_0x405ebb];return _0xd89ca9;};'use strict';var _=require(_0xa8a7('0x0'));var util=require('util');var logger=require(_0xa8a7('0x1'))(_0xa8a7('0x2'));var moment=require('moment');var BPromise=require(_0xa8a7('0x3'));var rp=require(_0xa8a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8a7('0x5'));var config=require(_0xa8a7('0x6'));var attributes=require(_0xa8a7('0x7'));module[_0xa8a7('0x8')]=function(_0x256bce,_0x3ebb7d){return _0x256bce[_0xa8a7('0x9')](_0xa8a7('0xa'),attributes,{'tableName':_0xa8a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3d9=['./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f826c,_0x38fbce){var _0x5a41c5=function(_0x81bd9d){while(--_0x81bd9d){_0x1f826c['push'](_0x1f826c['shift']());}};_0x5a41c5(++_0x38fbce);}(_0xc3d9,0x190));var _0x9c3d=function(_0x4474c2,_0x59cf02){_0x4474c2=_0x4474c2-0x0;var _0x435fbb=_0xc3d9[_0x4474c2];return _0x435fbb;};'use strict';var _=require(_0x9c3d('0x0'));var util=require(_0x9c3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9c3d('0x2'));var BPromise=require(_0x9c3d('0x3'));var rp=require(_0x9c3d('0x4'));var fs=require('fs');var path=require(_0x9c3d('0x5'));var rimraf=require(_0x9c3d('0x6'));var config=require(_0x9c3d('0x7'));var attributes=require(_0x9c3d('0x8'));module['exports']=function(_0xdd050d,_0x2fba50){return _0xdd050d[_0x9c3d('0x9')](_0x9c3d('0xa'),attributes,{'tableName':_0x9c3d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index bdb52a9..7372f32 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a7=['http','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x02a7,0x1a6));var _0x702a=function(_0x1a9c7a,_0x226faf){_0x1a9c7a=_0x1a9c7a-0x0;var _0x1e1740=_0x02a7[_0x1a9c7a];return _0x1e1740;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});}exports[_0x702a('0x16')]=function(_0x340dc2){var _0x2071ad=this;return new Promise(function(_0x3d1550,_0x1885eb){return db['SquareDetailsReport'][_0x702a('0x17')](_0x340dc2[_0x702a('0x18')],{'raw':_0x340dc2[_0x702a('0x19')]?_0x340dc2[_0x702a('0x19')][_0x702a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b2998){logger['info'](_0x702a('0x16'),_0x340dc2);logger['debug'](_0x702a('0x16'),_0x340dc2,JSON[_0x702a('0xf')](_0x5b2998));_0x3d1550(_0x5b2998);})['catch'](function(_0x2ca064){logger[_0x702a('0x10')](_0x702a('0x16'),_0x2ca064[_0x702a('0x13')],_0x340dc2);_0x1885eb(_0x2071ad[_0x702a('0x10')](0x1f4,_0x2ca064['message']));});});}; \ No newline at end of file +var _0xd7d1=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw'];(function(_0x424614,_0x2fb718){var _0x4be29d=function(_0x15cf18){while(--_0x15cf18){_0x424614['push'](_0x424614['shift']());}};_0x4be29d(++_0x2fb718);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x5181e2,_0x5cda35){_0x5181e2=_0x5181e2-0x0;var _0x38303c=_0xd7d1[_0x5181e2];return _0x38303c;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}exports[_0x1d7d('0x19')]=function(_0x4db4f2){var _0x664e3f=this;return new Promise(function(_0x191024,_0x5cbb8f){return db['SquareDetailsReport'][_0x1d7d('0x1a')](_0x4db4f2[_0x1d7d('0x1b')],{'raw':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')][_0x1d7d('0x1d')]===undefined?!![]:![]:!![]})[_0x1d7d('0xe')](function(_0x54d401){logger[_0x1d7d('0xf')](_0x1d7d('0x19'),_0x4db4f2);logger[_0x1d7d('0x1e')]('CreateSquareDetailsReport',_0x4db4f2,JSON[_0x1d7d('0x13')](_0x54d401));_0x191024(_0x54d401);})[_0x1d7d('0x18')](function(_0x4a1cdc){logger['error'](_0x1d7d('0x19'),_0x4a1cdc[_0x1d7d('0x16')],_0x4db4f2);_0x5cbb8f(_0x664e3f[_0x1d7d('0x14')](0x1f4,_0x4a1cdc['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a977d20..7145920 100644 --- a/server/api/system/index.js +++ b/server/api/system/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc048=['./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express','Router','../../components/auth/service'];(function(_0x24488b,_0x29b82f){var _0x5dad24=function(_0x59a846){while(--_0x59a846){_0x24488b['push'](_0x24488b['shift']());}};_0x5dad24(++_0x29b82f);}(_0xc048,0xde));var _0x8c04=function(_0xcdb11f,_0x29298f){_0xcdb11f=_0xcdb11f-0x0;var _0x4133bd=_0xc048[_0xcdb11f];return _0x4133bd;};'use strict';var express=require(_0x8c04('0x0'));var router=express[_0x8c04('0x1')]();var auth=require(_0x8c04('0x2'));var controller=require(_0x8c04('0x3'));router[_0x8c04('0x4')]('/',auth[_0x8c04('0x5')](),controller[_0x8c04('0x6')]);router['get'](_0x8c04('0x7'),auth[_0x8c04('0x5')](),controller[_0x8c04('0x8')]);module['exports']=router; \ No newline at end of file +var _0xd5bb=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess'];(function(_0x4422a6,_0x510190){var _0x3b5c7a=function(_0x4d3521){while(--_0x4d3521){_0x4422a6['push'](_0x4422a6['shift']());}};_0x3b5c7a(++_0x510190);}(_0xd5bb,0x110));var _0xbd5b=function(_0x42b8ee,_0x4f37c5){_0x42b8ee=_0x42b8ee-0x0;var _0x1d6524=_0xd5bb[_0x42b8ee];return _0x1d6524;};'use strict';var express=require('express');var router=express[_0xbd5b('0x0')]();var auth=require(_0xbd5b('0x1'));var controller=require(_0xbd5b('0x2'));router[_0xbd5b('0x3')]('/',auth[_0xbd5b('0x4')](),controller[_0xbd5b('0x5')]);router['get'](_0xbd5b('0x6'),auth[_0xbd5b('0x4')](),controller[_0xbd5b('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6b6483f..be3ebc8 100644 --- a/server/api/system/system.controller.js +++ b/server/api/system/system.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f14=['indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','bluebird','lodash','inspect','name','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split'];(function(_0x4329f4,_0x172436){var _0x26f3d0=function(_0x6f282f){while(--_0x6f282f){_0x4329f4['push'](_0x4329f4['shift']());}};_0x26f3d0(++_0x172436);}(_0x1f14,0x148));var _0x41f1=function(_0x43eb9d,_0x300a6e){_0x43eb9d=_0x43eb9d-0x0;var _0x4a170b=_0x1f14[_0x43eb9d];return _0x4a170b;};'use strict';var info=require(_0x41f1('0x0'));var exec=require(_0x41f1('0x1'))['exec'];var logger=require(_0x41f1('0x2'))(_0x41f1('0x3'));var util=require('util');var BPromise=require(_0x41f1('0x4'));var _=require(_0x41f1('0x5'));function handleError(_0x50b47d,_0x494753,_0x4b3e8a){_0x494753=_0x494753||0x1f4;return function(_0x750122){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4b3e8a,_0x494753,util[_0x41f1('0x6')](_0x750122,{'showHidden':![],'depth':null}));delete _0x750122[_0x41f1('0x7')];_0x50b47d[_0x41f1('0x8')](_0x494753)[_0x41f1('0x9')](_0x750122);};}exports[_0x41f1('0xa')]=function(_0x2a3596,_0x2aec47){return info[_0x41f1('0xb')]()['then'](function(_0x87bab5){return _0x2aec47['status'](0xc8)[_0x41f1('0xc')](_0x87bab5);})[_0x41f1('0xd')](function(_0x735625){return _0x2aec47[_0x41f1('0x8')](0x1f4)[_0x41f1('0xc')](_0x735625);});};exports[_0x41f1('0xe')]=function(_0x248483,_0x96cfce){var _0x35bcb7=[_0x41f1('0xf')];return new BPromise(function(_0x421dfa,_0x1d63ba){return exec(util[_0x41f1('0x10')](_0x41f1('0x11'),_0x248483[_0x41f1('0x12')][_0x41f1('0x13')]),function(_0x374b30,_0x498e12,_0x27d786){if(_0x374b30){return _0x1d63ba(_0x374b30);}return _0x421dfa(_0x498e12);});})[_0x41f1('0x14')](function(_0x2a7658){var _0x5e331a=![];var _0x3a51e4=_0x2a7658[_0x41f1('0x15')](/\n/);for(var _0x592ca4=0x0,_0xebdd70=_0x35bcb7['length'];_0x592ca4<_0xebdd70,_0x5e331a===![];_0x592ca4+=0x1){if(_0x2a7658[_0x41f1('0x16')](_0x35bcb7[_0x592ca4])>=0x0){_0x5e331a=!![];}}if(!_0x5e331a){throw new Error(util[_0x41f1('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x248483[_0x41f1('0x12')][_0x41f1('0x13')]));}process['kill'](_0x248483[_0x41f1('0x12')][_0x41f1('0x13')],_0x41f1('0x17'));return _0x96cfce['status'](0xc8)['json']({'message':util[_0x41f1('0x10')](_0x41f1('0x18'),_0x248483[_0x41f1('0x12')][_0x41f1('0x13')])});})[_0x41f1('0xd')](handleError(_0x96cfce,null,'killProcess'));}; \ No newline at end of file +var _0x6e09=['then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6e09,0xdf));var _0x96e0=function(_0x1155e6,_0x233e73){_0x1155e6=_0x1155e6-0x0;var _0x35dd79=_0x6e09[_0x1155e6];return _0x35dd79;};'use strict';var info=require(_0x96e0('0x0'));var exec=require(_0x96e0('0x1'))[_0x96e0('0x2')];var logger=require('../../config/logger')(_0x96e0('0x3'));var util=require('util');var BPromise=require(_0x96e0('0x4'));var _=require('lodash');function handleError(_0x2ff809,_0x4f78f3,_0x506ab9){_0x4f78f3=_0x4f78f3||0x1f4;return function(_0xa75473){logger[_0x96e0('0x5')](_0x96e0('0x6'),_0x506ab9,_0x4f78f3,util[_0x96e0('0x7')](_0xa75473,{'showHidden':![],'depth':null}));delete _0xa75473[_0x96e0('0x8')];_0x2ff809[_0x96e0('0x9')](_0x4f78f3)[_0x96e0('0xa')](_0xa75473);};}exports['index']=function(_0x3f0e14,_0x396c56){return info['getAllData']()[_0x96e0('0xb')](function(_0x50f2d1){return _0x396c56[_0x96e0('0x9')](0xc8)[_0x96e0('0xc')](_0x50f2d1);})[_0x96e0('0xd')](function(_0x5848df){return _0x396c56['status'](0x1f4)[_0x96e0('0xc')](_0x5848df);});};exports[_0x96e0('0xe')]=function(_0x34cd8c,_0x3261b5){var _0x22a508=[_0x96e0('0xf')];return new BPromise(function(_0xf40b6e,_0x146e4b){return exec(util[_0x96e0('0x10')](_0x96e0('0x11'),_0x34cd8c[_0x96e0('0x12')][_0x96e0('0x13')]),function(_0x365e14,_0x3b6fe5,_0x41542c){if(_0x365e14){return _0x146e4b(_0x365e14);}return _0xf40b6e(_0x3b6fe5);});})[_0x96e0('0xb')](function(_0x30fa0e){var _0xe077ea=![];var _0x57f4ea=_0x30fa0e[_0x96e0('0x14')](/\n/);for(var _0x497a45=0x0,_0x373e8d=_0x22a508[_0x96e0('0x15')];_0x497a45<_0x373e8d,_0xe077ea===![];_0x497a45+=0x1){if(_0x30fa0e[_0x96e0('0x16')](_0x22a508[_0x497a45])>=0x0){_0xe077ea=!![];}}if(!_0xe077ea){throw new Error(util[_0x96e0('0x10')](_0x96e0('0x17'),_0x34cd8c['params'][_0x96e0('0x13')]));}process[_0x96e0('0x18')](_0x34cd8c[_0x96e0('0x12')]['pid'],'SIGINT');return _0x3261b5[_0x96e0('0x9')](0xc8)['json']({'message':util[_0x96e0('0x10')](_0x96e0('0x19'),_0x34cd8c['params'][_0x96e0('0x13')])});})[_0x96e0('0xd')](handleError(_0x3261b5,null,_0x96e0('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1ae0b06..7d6426c 100644 --- a/server/api/tag/index.js +++ b/server/api/tag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaaf=['fs-extra','../../components/auth/service','isAuthenticated','index','/:id','show','post','create','update','delete','util','path','connect-timeout','Router'];(function(_0x3dca36,_0x35e97f){var _0x16aa05=function(_0x483e70){while(--_0x483e70){_0x3dca36['push'](_0x3dca36['shift']());}};_0x16aa05(++_0x35e97f);}(_0xdaaf,0x130));var _0xfdaa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdaaf[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xfdaa('0x0'));var path=require(_0xfdaa('0x1'));var timeout=require(_0xfdaa('0x2'));var express=require('express');var router=express[_0xfdaa('0x3')]();var fs_extra=require(_0xfdaa('0x4'));var auth=require(_0xfdaa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x7')]);router['get'](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller[_0xfdaa('0x9')]);router[_0xfdaa('0xa')]('/',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xb')]);router['put']('/:id',auth[_0xfdaa('0x6')](),controller[_0xfdaa('0xc')]);router[_0xfdaa('0xd')](_0xfdaa('0x8'),auth[_0xfdaa('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xec79=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3def1b,_0x56f748){var _0x57340e=function(_0x1e1949){while(--_0x1e1949){_0x3def1b['push'](_0x3def1b['shift']());}};_0x57340e(++_0x56f748);}(_0xec79,0x1b7));var _0x9ec7=function(_0x3ed211,_0x44ff7d){_0x3ed211=_0x3ed211-0x0;var _0x44e593=_0xec79[_0x3ed211];return _0x44e593;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ec7('0x0'));var timeout=require(_0x9ec7('0x1'));var express=require(_0x9ec7('0x2'));var router=express[_0x9ec7('0x3')]();var fs_extra=require(_0x9ec7('0x4'));var auth=require(_0x9ec7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ec7('0x6'));var controller=require('./tag.controller');router[_0x9ec7('0x7')]('/',auth[_0x9ec7('0x8')](),controller[_0x9ec7('0x9')]);router[_0x9ec7('0x7')](_0x9ec7('0xa'),auth[_0x9ec7('0x8')](),controller[_0x9ec7('0xb')]);router['post']('/',auth[_0x9ec7('0x8')](),controller['create']);router[_0x9ec7('0xc')](_0x9ec7('0xa'),auth['isAuthenticated'](),controller[_0x9ec7('0xd')]);router[_0x9ec7('0xe')](_0x9ec7('0xa'),auth['isAuthenticated'](),controller[_0x9ec7('0xf')]);module[_0x9ec7('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 46ced95..49a930f 100644 --- a/server/api/tag/tag.attributes.js +++ b/server/api/tag/tag.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a2a=['exports','STRING','sequelize'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x5f2fea,_0x9fde07){_0x5f2fea=_0x5f2fea-0x0;var _0x198a0c=_0x9a2a[_0x5f2fea];return _0x198a0c;};'use strict';var Sequelize=require(_0xa9a2('0x0'));module[_0xa9a2('0x1')]={'name':{'type':Sequelize[_0xa9a2('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xa9a2('0x2')]}}; \ No newline at end of file +var _0x9e5e=['STRING','#0091EA','sequelize','exports','name'];(function(_0x365b05,_0x3c3537){var _0x1b9556=function(_0x755936){while(--_0x755936){_0x365b05['push'](_0x365b05['shift']());}};_0x1b9556(++_0x3c3537);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x9e5e[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0xe9e5('0x0'));module[_0xe9e5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe9e5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe9e5('0x3')],'defaultValue':_0xe9e5('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 6954228..49baa5e 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7794=['stack','name','send','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','error'];(function(_0x285e86,_0x183485){var _0x2fe1ca=function(_0x5b646d){while(--_0x5b646d){_0x285e86['push'](_0x285e86['shift']());}};_0x2fe1ca(++_0x183485);}(_0x7794,0x7b));var _0x4779=function(_0x2b5f49,_0x3570be){_0x2b5f49=_0x2b5f49-0x0;var _0xc6e7ff=_0x7794[_0x2b5f49];return _0xc6e7ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4779('0x0'));var zipdir=require(_0x4779('0x1'));var jsonpatch=require(_0x4779('0x2'));var rp=require(_0x4779('0x3'));var moment=require('moment');var BPromise=require(_0x4779('0x4'));var Mustache=require(_0x4779('0x5'));var util=require('util');var path=require(_0x4779('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4779('0x7'));var _=require(_0x4779('0x8'));var squel=require('squel');var crypto=require(_0x4779('0x9'));var jsforce=require(_0x4779('0xa'));var deskjs=require(_0x4779('0xb'));var toCsv=require(_0x4779('0xc'));var querystring=require(_0x4779('0xd'));var Papa=require(_0x4779('0xe'));var Redis=require(_0x4779('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4779('0x10'));var as=require(_0x4779('0x11'));var hardwareService=require(_0x4779('0x12'));var logger=require(_0x4779('0x13'))(_0x4779('0x14'));var utils=require(_0x4779('0x15'));var config=require(_0x4779('0x16'));var licenseUtil=require(_0x4779('0x17'));var db=require(_0x4779('0x18'))['db'];function respondWithStatusCode(_0x13c989,_0x50e17e){_0x50e17e=_0x50e17e||0xcc;return function(_0x5b1219){if(_0x5b1219){return _0x13c989['sendStatus'](_0x50e17e);}return _0x13c989[_0x4779('0x19')](_0x50e17e)[_0x4779('0x1a')]();};}function respondWithResult(_0xb9a06f,_0xddf5cd){_0xddf5cd=_0xddf5cd||0xc8;return function(_0x4fe370){if(_0x4fe370){return _0xb9a06f[_0x4779('0x19')](_0xddf5cd)[_0x4779('0x1b')](_0x4fe370);}};}function respondWithFilteredResult(_0x4d71a0,_0x599deb){return function(_0x1dbbe1){if(_0x1dbbe1){var _0x2de2be=typeof _0x599deb[_0x4779('0x1c')]===_0x4779('0x1d')&&typeof _0x599deb['limit']==='undefined';var _0x445e0b=_0x1dbbe1[_0x4779('0x1e')];var _0x19fbb6=_0x2de2be?0x0:_0x599deb['offset'];var _0x3dbe70=_0x2de2be?_0x1dbbe1['count']:_0x599deb[_0x4779('0x1c')]+_0x599deb[_0x4779('0x1f')];var _0x478fa5;if(_0x3dbe70>=_0x445e0b){_0x3dbe70=_0x445e0b;_0x478fa5=0xc8;}else{_0x478fa5=0xce;}_0x4d71a0[_0x4779('0x19')](_0x478fa5);return _0x4d71a0['set'](_0x4779('0x20'),_0x19fbb6+'-'+_0x3dbe70+'/'+_0x445e0b)[_0x4779('0x1b')](_0x1dbbe1);}return null;};}function patchUpdates(_0x143ef6){return function(_0x298e25){try{jsonpatch[_0x4779('0x21')](_0x298e25,_0x143ef6,!![]);}catch(_0x1ce270){return BPromise['reject'](_0x1ce270);}return _0x298e25[_0x4779('0x22')]();};}function saveUpdates(_0x4f2158,_0x4ad246){return function(_0xd983f0){if(_0xd983f0){return _0xd983f0[_0x4779('0x23')](_0x4f2158)[_0x4779('0x24')](function(_0x2b7ab6){return _0x2b7ab6;});}return null;};}function removeEntity(_0x555cd6,_0x152887){return function(_0x29a39a){if(_0x29a39a){return _0x29a39a[_0x4779('0x25')]()['then'](function(){var _0x340648=_0x29a39a[_0x4779('0x26')]({'plain':!![]});var _0x577b13=_0x4779('0x27');return db[_0x4779('0x28')]['destroy']({'where':{'type':_0x577b13,'resourceId':_0x340648['id']}})[_0x4779('0x24')](function(){return _0x29a39a;});})[_0x4779('0x24')](function(){_0x555cd6[_0x4779('0x19')](0xcc)[_0x4779('0x1a')]();});}};}function handleEntityNotFound(_0x2634c2,_0x254562){return function(_0xeb1850){if(!_0xeb1850){_0x2634c2[_0x4779('0x29')](0x194);}return _0xeb1850;};}function handleError(_0x4b9066,_0x44c162){_0x44c162=_0x44c162||0x1f4;return function(_0x1607a5){logger[_0x4779('0x2a')](_0x1607a5[_0x4779('0x2b')]);if(_0x1607a5[_0x4779('0x2c')]){delete _0x1607a5[_0x4779('0x2c')];}_0x4b9066[_0x4779('0x19')](_0x44c162)[_0x4779('0x2d')](_0x1607a5);};}exports['index']=function(_0x5b1b36,_0x179717){var _0x986bed={},_0xc7e4d1={},_0x15da6d={'count':0x0,'rows':[]};var _0x335d48=_['map'](db[_0x4779('0x2e')][_0x4779('0x2f')],function(_0x1fa222){return{'name':_0x1fa222[_0x4779('0x30')],'type':_0x1fa222['type']['key']};});_0xc7e4d1[_0x4779('0x31')]=_['map'](_0x335d48,_0x4779('0x2c'));_0xc7e4d1[_0x4779('0x32')]=_[_0x4779('0x33')](_0x5b1b36[_0x4779('0x32')]);_0xc7e4d1[_0x4779('0x34')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],_0xc7e4d1[_0x4779('0x32')]);_0x986bed[_0x4779('0x36')]=_[_0x4779('0x35')](_0xc7e4d1[_0x4779('0x31')],qs[_0x4779('0x37')](_0x5b1b36['query']['fields']));_0x986bed[_0x4779('0x36')]=_0x986bed['attributes'][_0x4779('0x38')]?_0x986bed['attributes']:_0xc7e4d1[_0x4779('0x31')];if(!_0x5b1b36[_0x4779('0x32')][_0x4779('0x39')](_0x4779('0x3a'))){_0x986bed[_0x4779('0x1f')]=qs['limit'](_0x5b1b36['query'][_0x4779('0x1f')]);_0x986bed[_0x4779('0x1c')]=qs[_0x4779('0x1c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x1c')]);}_0x986bed[_0x4779('0x3b')]=qs[_0x4779('0x3c')](_0x5b1b36[_0x4779('0x32')][_0x4779('0x3c')]);_0x986bed[_0x4779('0x3d')]=qs[_0x4779('0x34')](_[_0x4779('0x3e')](_0x5b1b36[_0x4779('0x32')],_0xc7e4d1[_0x4779('0x34')]),_0x335d48);if(_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]){_0x986bed[_0x4779('0x3d')]=_[_0x4779('0x40')](_0x986bed[_0x4779('0x3d')],{'$or':_['map'](_0x335d48,function(_0xa48aa1){if(_0xa48aa1['type']!==_0x4779('0x41')){var _0x1cc7da={};_0x1cc7da[_0xa48aa1[_0x4779('0x2c')]]={'$like':'%'+_0x5b1b36[_0x4779('0x32')][_0x4779('0x3f')]+'%'};return _0x1cc7da;}})});}_0x986bed=_[_0x4779('0x40')]({},_0x986bed,_0x5b1b36['options']);var _0x2ab9c3={'where':_0x986bed['where']};return db[_0x4779('0x2e')][_0x4779('0x1e')](_0x2ab9c3)[_0x4779('0x24')](function(_0x3a3589){_0x15da6d[_0x4779('0x1e')]=_0x3a3589;if(_0x5b1b36[_0x4779('0x32')]['includeAll']){_0x986bed[_0x4779('0x42')]=[{'all':!![]}];}return db['Tag'][_0x4779('0x43')](_0x986bed);})[_0x4779('0x24')](function(_0x2e60ab){_0x15da6d['rows']=_0x2e60ab;return _0x15da6d;})[_0x4779('0x24')](respondWithFilteredResult(_0x179717,_0x986bed))[_0x4779('0x44')](handleError(_0x179717,null));};exports[_0x4779('0x45')]=function(_0x15520d,_0xbc5a86){var _0x3b0bfd={'raw':!![],'where':{'id':_0x15520d[_0x4779('0x46')]['id']}},_0x13f768={};_0x13f768[_0x4779('0x31')]=_[_0x4779('0x33')](db[_0x4779('0x2e')][_0x4779('0x2f')]);_0x13f768[_0x4779('0x32')]=_[_0x4779('0x33')](_0x15520d[_0x4779('0x32')]);_0x13f768['filters']=_['intersection'](_0x13f768[_0x4779('0x31')],_0x13f768[_0x4779('0x32')]);_0x3b0bfd[_0x4779('0x36')]=_[_0x4779('0x35')](_0x13f768[_0x4779('0x31')],qs[_0x4779('0x37')](_0x15520d[_0x4779('0x32')][_0x4779('0x37')]));_0x3b0bfd['attributes']=_0x3b0bfd[_0x4779('0x36')][_0x4779('0x38')]?_0x3b0bfd[_0x4779('0x36')]:_0x13f768[_0x4779('0x31')];if(_0x15520d[_0x4779('0x32')][_0x4779('0x47')]){_0x3b0bfd['include']=[{'all':!![]}];}_0x3b0bfd=_[_0x4779('0x40')]({},_0x3b0bfd,_0x15520d[_0x4779('0x48')]);return db[_0x4779('0x2e')][_0x4779('0x49')](_0x3b0bfd)[_0x4779('0x24')](handleEntityNotFound(_0xbc5a86,null))['then'](respondWithResult(_0xbc5a86,null))[_0x4779('0x44')](handleError(_0xbc5a86,null));};exports[_0x4779('0x4a')]=function(_0x3873d4,_0x4a1040){return db[_0x4779('0x2e')]['create'](_0x3873d4[_0x4779('0x4b')],{})[_0x4779('0x24')](function(_0x397216){var _0x4f0aaf=_0x3873d4[_0x4779('0x4c')]['get']({'plain':!![]});if(!_0x4f0aaf)throw new Error(_0x4779('0x4d'));if(_0x4f0aaf[_0x4779('0x4e')]===_0x4779('0x4c')){var _0x58e14e=_0x397216['get']({'plain':!![]});var _0x5dc79a=_0x4779('0x27');return db[_0x4779('0x4f')]['find']({'where':{'name':_0x5dc79a,'userProfileId':_0x4f0aaf[_0x4779('0x50')]},'raw':!![]})[_0x4779('0x24')](function(_0x3c7493){if(_0x3c7493&&_0x3c7493[_0x4779('0x51')]===0x0){return db[_0x4779('0x28')]['create']({'name':_0x58e14e[_0x4779('0x2c')],'resourceId':_0x58e14e['id'],'type':_0x3c7493[_0x4779('0x2c')],'sectionId':_0x3c7493['id']},{})[_0x4779('0x24')](function(){return _0x397216;});}else{return _0x397216;}})[_0x4779('0x44')](function(_0x15c180){logger[_0x4779('0x2a')](_0x4779('0x52'),_0x15c180);throw _0x15c180;});}return _0x397216;})[_0x4779('0x24')](respondWithResult(_0x4a1040,0xc9))['catch'](handleError(_0x4a1040,null));};exports['update']=function(_0x1e4bff,_0x34e951){if(_0x1e4bff[_0x4779('0x4b')]['id']){delete _0x1e4bff[_0x4779('0x4b')]['id'];}return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x1e4bff[_0x4779('0x46')]['id']}})['then'](handleEntityNotFound(_0x34e951,null))[_0x4779('0x24')](saveUpdates(_0x1e4bff[_0x4779('0x4b')],null))[_0x4779('0x24')](respondWithResult(_0x34e951,null))['catch'](handleError(_0x34e951,null));};exports['destroy']=function(_0x225734,_0xe836e0){return db['Tag'][_0x4779('0x49')]({'where':{'id':_0x225734[_0x4779('0x46')]['id']}})[_0x4779('0x24')](handleEntityNotFound(_0xe836e0,null))[_0x4779('0x24')](removeEntity(_0xe836e0,null))[_0x4779('0x44')](handleError(_0xe836e0,null));}; \ No newline at end of file +var _0x049e=['map','rawAttributes','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','Tag','includeAll','include','rows','catch','show','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','Tags','destroy','end','error','stack','name','send','index'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x049e,0x16a));var _0xe049=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x049e[_0x2cde0a];return _0x260610;};'use strict';var emlformat=require(_0xe049('0x0'));var rimraf=require(_0xe049('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe049('0x2'));var rp=require('request-promise');var moment=require(_0xe049('0x3'));var BPromise=require(_0xe049('0x4'));var Mustache=require(_0xe049('0x5'));var util=require(_0xe049('0x6'));var path=require(_0xe049('0x7'));var sox=require('sox');var csv=require(_0xe049('0x8'));var ejs=require(_0xe049('0x9'));var fs=require('fs');var fs_extra=require(_0xe049('0xa'));var _=require(_0xe049('0xb'));var squel=require(_0xe049('0xc'));var crypto=require(_0xe049('0xd'));var jsforce=require(_0xe049('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe049('0x8'));var querystring=require(_0xe049('0xf'));var Papa=require(_0xe049('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe049('0x11'));var as=require(_0xe049('0x12'));var hardwareService=require(_0xe049('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe049('0x14'));var licenseUtil=require(_0xe049('0x15'));var db=require(_0xe049('0x16'))['db'];function respondWithStatusCode(_0x359931,_0x301c7e){_0x301c7e=_0x301c7e||0xcc;return function(_0x1021e7){if(_0x1021e7){return _0x359931[_0xe049('0x17')](_0x301c7e);}return _0x359931[_0xe049('0x18')](_0x301c7e)['end']();};}function respondWithResult(_0x20c286,_0x3f4a57){_0x3f4a57=_0x3f4a57||0xc8;return function(_0x3924a4){if(_0x3924a4){return _0x20c286[_0xe049('0x18')](_0x3f4a57)['json'](_0x3924a4);}};}function respondWithFilteredResult(_0x3a539b,_0xcc35b6){return function(_0x5c90fd){if(_0x5c90fd){var _0x388be0=typeof _0xcc35b6[_0xe049('0x19')]==='undefined'&&typeof _0xcc35b6[_0xe049('0x1a')]===_0xe049('0x1b');var _0x5d435b=_0x5c90fd[_0xe049('0x1c')];var _0x54c303=_0x388be0?0x0:_0xcc35b6['offset'];var _0x3cbbeb=_0x388be0?_0x5c90fd['count']:_0xcc35b6['offset']+_0xcc35b6[_0xe049('0x1a')];var _0x1092ec;if(_0x3cbbeb>=_0x5d435b){_0x3cbbeb=_0x5d435b;_0x1092ec=0xc8;}else{_0x1092ec=0xce;}_0x3a539b['status'](_0x1092ec);return _0x3a539b['set'](_0xe049('0x1d'),_0x54c303+'-'+_0x3cbbeb+'/'+_0x5d435b)[_0xe049('0x1e')](_0x5c90fd);}return null;};}function patchUpdates(_0x1d2f5b){return function(_0x430421){try{jsonpatch['apply'](_0x430421,_0x1d2f5b,!![]);}catch(_0x572f29){return BPromise[_0xe049('0x1f')](_0x572f29);}return _0x430421[_0xe049('0x20')]();};}function saveUpdates(_0x572a80,_0x36a03b){return function(_0x3f14eb){if(_0x3f14eb){return _0x3f14eb[_0xe049('0x21')](_0x572a80)['then'](function(_0x197358){return _0x197358;});}return null;};}function removeEntity(_0x3b0f54,_0x4c7492){return function(_0x4848c9){if(_0x4848c9){return _0x4848c9['destroy']()[_0xe049('0x22')](function(){var _0x5954c0=_0x4848c9['get']({'plain':!![]});var _0x1aafd1=_0xe049('0x23');return db['UserProfileResource'][_0xe049('0x24')]({'where':{'type':_0x1aafd1,'resourceId':_0x5954c0['id']}})[_0xe049('0x22')](function(){return _0x4848c9;});})[_0xe049('0x22')](function(){_0x3b0f54[_0xe049('0x18')](0xcc)[_0xe049('0x25')]();});}};}function handleEntityNotFound(_0x1843b8,_0x5b0e64){return function(_0x50552d){if(!_0x50552d){_0x1843b8[_0xe049('0x17')](0x194);}return _0x50552d;};}function handleError(_0x542c7c,_0x38ff5b){_0x38ff5b=_0x38ff5b||0x1f4;return function(_0x495d33){logger[_0xe049('0x26')](_0x495d33[_0xe049('0x27')]);if(_0x495d33['name']){delete _0x495d33[_0xe049('0x28')];}_0x542c7c[_0xe049('0x18')](_0x38ff5b)[_0xe049('0x29')](_0x495d33);};}exports[_0xe049('0x2a')]=function(_0x4464b2,_0x4055fc){var _0x123d2e={},_0x44faff={},_0x4038f0={'count':0x0,'rows':[]};var _0x1a4b97=_[_0xe049('0x2b')](db['Tag'][_0xe049('0x2c')],function(_0x1e99c8){return{'name':_0x1e99c8['fieldName'],'type':_0x1e99c8['type']['key']};});_0x44faff['model']=_[_0xe049('0x2b')](_0x1a4b97,_0xe049('0x28'));_0x44faff[_0xe049('0x2d')]=_[_0xe049('0x2e')](_0x4464b2[_0xe049('0x2d')]);_0x44faff['filters']=_[_0xe049('0x2f')](_0x44faff[_0xe049('0x30')],_0x44faff[_0xe049('0x2d')]);_0x123d2e[_0xe049('0x31')]=_[_0xe049('0x2f')](_0x44faff['model'],qs[_0xe049('0x32')](_0x4464b2['query'][_0xe049('0x32')]));_0x123d2e['attributes']=_0x123d2e[_0xe049('0x31')][_0xe049('0x33')]?_0x123d2e[_0xe049('0x31')]:_0x44faff[_0xe049('0x30')];if(!_0x4464b2[_0xe049('0x2d')][_0xe049('0x34')](_0xe049('0x35'))){_0x123d2e[_0xe049('0x1a')]=qs[_0xe049('0x1a')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x1a')]);_0x123d2e['offset']=qs[_0xe049('0x19')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x19')]);}_0x123d2e[_0xe049('0x36')]=qs[_0xe049('0x37')](_0x4464b2[_0xe049('0x2d')][_0xe049('0x37')]);_0x123d2e[_0xe049('0x38')]=qs['filters'](_[_0xe049('0x39')](_0x4464b2[_0xe049('0x2d')],_0x44faff[_0xe049('0x3a')]),_0x1a4b97);if(_0x4464b2[_0xe049('0x2d')][_0xe049('0x3b')]){_0x123d2e[_0xe049('0x38')]=_[_0xe049('0x3c')](_0x123d2e[_0xe049('0x38')],{'$or':_[_0xe049('0x2b')](_0x1a4b97,function(_0x3d6a4b){if(_0x3d6a4b['type']!==_0xe049('0x3d')){var _0x176374={};_0x176374[_0x3d6a4b[_0xe049('0x28')]]={'$like':'%'+_0x4464b2['query'][_0xe049('0x3b')]+'%'};return _0x176374;}})});}_0x123d2e=_['merge']({},_0x123d2e,_0x4464b2['options']);var _0x19dbc4={'where':_0x123d2e['where']};return db[_0xe049('0x3e')][_0xe049('0x1c')](_0x19dbc4)[_0xe049('0x22')](function(_0xe4f184){_0x4038f0[_0xe049('0x1c')]=_0xe4f184;if(_0x4464b2['query'][_0xe049('0x3f')]){_0x123d2e[_0xe049('0x40')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x123d2e);})[_0xe049('0x22')](function(_0x20d264){_0x4038f0[_0xe049('0x41')]=_0x20d264;return _0x4038f0;})[_0xe049('0x22')](respondWithFilteredResult(_0x4055fc,_0x123d2e))[_0xe049('0x42')](handleError(_0x4055fc,null));};exports[_0xe049('0x43')]=function(_0x56a309,_0x1a4707){var _0x3f92ee={'raw':!![],'where':{'id':_0x56a309[_0xe049('0x44')]['id']}},_0x5c04f6={};_0x5c04f6[_0xe049('0x30')]=_[_0xe049('0x2e')](db[_0xe049('0x3e')][_0xe049('0x2c')]);_0x5c04f6['query']=_['keys'](_0x56a309[_0xe049('0x2d')]);_0x5c04f6[_0xe049('0x3a')]=_[_0xe049('0x2f')](_0x5c04f6[_0xe049('0x30')],_0x5c04f6[_0xe049('0x2d')]);_0x3f92ee[_0xe049('0x31')]=_['intersection'](_0x5c04f6[_0xe049('0x30')],qs[_0xe049('0x32')](_0x56a309['query'][_0xe049('0x32')]));_0x3f92ee['attributes']=_0x3f92ee[_0xe049('0x31')]['length']?_0x3f92ee[_0xe049('0x31')]:_0x5c04f6['model'];if(_0x56a309[_0xe049('0x2d')][_0xe049('0x3f')]){_0x3f92ee[_0xe049('0x40')]=[{'all':!![]}];}_0x3f92ee=_[_0xe049('0x3c')]({},_0x3f92ee,_0x56a309[_0xe049('0x45')]);return db['Tag'][_0xe049('0x46')](_0x3f92ee)[_0xe049('0x22')](handleEntityNotFound(_0x1a4707,null))[_0xe049('0x22')](respondWithResult(_0x1a4707,null))[_0xe049('0x42')](handleError(_0x1a4707,null));};exports[_0xe049('0x47')]=function(_0x3c15a2,_0x12f9b8){return db[_0xe049('0x3e')][_0xe049('0x47')](_0x3c15a2['body'],{})['then'](function(_0x478387){var _0xd1beaf=_0x3c15a2[_0xe049('0x48')][_0xe049('0x49')]({'plain':!![]});if(!_0xd1beaf)throw new Error(_0xe049('0x4a'));if(_0xd1beaf[_0xe049('0x4b')]===_0xe049('0x48')){var _0x2e4dce=_0x478387[_0xe049('0x49')]({'plain':!![]});var _0x23da27=_0xe049('0x23');return db['UserProfileSection'][_0xe049('0x46')]({'where':{'name':_0x23da27,'userProfileId':_0xd1beaf[_0xe049('0x4c')]},'raw':!![]})[_0xe049('0x22')](function(_0x4710ae){if(_0x4710ae&&_0x4710ae[_0xe049('0x4d')]===0x0){return db[_0xe049('0x4e')][_0xe049('0x47')]({'name':_0x2e4dce['name'],'resourceId':_0x2e4dce['id'],'type':_0x4710ae['name'],'sectionId':_0x4710ae['id']},{})['then'](function(){return _0x478387;});}else{return _0x478387;}})[_0xe049('0x42')](function(_0x2e508e){logger['error'](_0xe049('0x4f'),_0x2e508e);throw _0x2e508e;});}return _0x478387;})[_0xe049('0x22')](respondWithResult(_0x12f9b8,0xc9))[_0xe049('0x42')](handleError(_0x12f9b8,null));};exports[_0xe049('0x21')]=function(_0x4c3ba3,_0x5b0155){if(_0x4c3ba3[_0xe049('0x50')]['id']){delete _0x4c3ba3[_0xe049('0x50')]['id'];}return db['Tag']['find']({'where':{'id':_0x4c3ba3[_0xe049('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b0155,null))[_0xe049('0x22')](saveUpdates(_0x4c3ba3[_0xe049('0x50')],null))['then'](respondWithResult(_0x5b0155,null))[_0xe049('0x42')](handleError(_0x5b0155,null));};exports['destroy']=function(_0x356605,_0x3ec963){return db['Tag'][_0xe049('0x46')]({'where':{'id':_0x356605[_0xe049('0x44')]['id']}})[_0xe049('0x22')](handleEntityNotFound(_0x3ec963,null))[_0xe049('0x22')](removeEntity(_0x3ec963,null))[_0xe049('0x42')](handleError(_0x3ec963,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index daa1179..f3ebea0 100644 --- a/server/api/tag/tag.model.js +++ b/server/api/tag/tag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35f0=['./tag.attributes','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37bb99,_0x2d9e01){var _0x16e07d=function(_0x430802){while(--_0x430802){_0x37bb99['push'](_0x37bb99['shift']());}};_0x16e07d(++_0x2d9e01);}(_0x35f0,0xb9));var _0x035f=function(_0x1ec9cb,_0xccade7){_0x1ec9cb=_0x1ec9cb-0x0;var _0x379582=_0x35f0[_0x1ec9cb];return _0x379582;};'use strict';var _=require(_0x035f('0x0'));var util=require(_0x035f('0x1'));var logger=require(_0x035f('0x2'))(_0x035f('0x3'));var moment=require(_0x035f('0x4'));var BPromise=require(_0x035f('0x5'));var rp=require(_0x035f('0x6'));var fs=require('fs');var path=require(_0x035f('0x7'));var rimraf=require(_0x035f('0x8'));var config=require(_0x035f('0x9'));var attributes=require(_0x035f('0xa'));module['exports']=function(_0x100527,_0x479ef0){return _0x100527['define'](_0x035f('0xb'),attributes,{'tableName':_0x035f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x982f=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0xa589b0,_0x295ce8){var _0x442bb8=function(_0x2be6b2){while(--_0x2be6b2){_0xa589b0['push'](_0xa589b0['shift']());}};_0x442bb8(++_0x295ce8);}(_0x982f,0x6b));var _0xf982=function(_0x32780c,_0x1d7b49){_0x32780c=_0x32780c-0x0;var _0x56fd6c=_0x982f[_0x32780c];return _0x56fd6c;};'use strict';var _=require(_0xf982('0x0'));var util=require(_0xf982('0x1'));var logger=require(_0xf982('0x2'))(_0xf982('0x3'));var moment=require(_0xf982('0x4'));var BPromise=require(_0xf982('0x5'));var rp=require(_0xf982('0x6'));var fs=require('fs');var path=require(_0xf982('0x7'));var rimraf=require(_0xf982('0x8'));var config=require(_0xf982('0x9'));var attributes=require(_0xf982('0xa'));module[_0xf982('0xb')]=function(_0x958918,_0x2b0e5c){return _0x958918['define'](_0xf982('0xc'),attributes,{'tableName':_0xf982('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index dc6785a..c9a6180 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x919e=['client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x547125,_0x423554){var _0x5ac7ad=function(_0x2b001c){while(--_0x2b001c){_0x547125['push'](_0x547125['shift']());}};_0x5ac7ad(++_0x423554);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493b47,_0x7c1fa4,_0x2ceb41){return new BPromise(function(_0x57c3fe,_0x44d418){return client['request'](_0x493b47,_0x2ceb41)[_0xe919('0xb')](function(_0x22ea65){logger[_0xe919('0xc')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0xe919('0xd'));logger[_0xe919('0xe')](_0xe919('0xf'),_0x7c1fa4,'request\x20sent',JSON[_0xe919('0x10')](_0x22ea65));if(_0x22ea65['error']){if(_0x22ea65['error']['code']===0x1f4){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x22ea65[_0xe919('0x11')]['message']);return _0x44d418(_0x22ea65['error'][_0xe919('0x13')]);}logger[_0xe919('0x11')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);return _0x57c3fe(_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);}else{logger[_0xe919('0xc')](_0xe919('0x12'),_0x7c1fa4,_0xe919('0xd'));_0x57c3fe(_0x22ea65['result'][_0xe919('0x13')]);}})['catch'](function(_0x5ba7ad){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x5ba7ad);_0x44d418(_0x5ba7ad);});});} \ No newline at end of file +var _0xb7c8=['error','Tag,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x4f148a,_0x547c20){var _0xe37aad=function(_0x2b2dbb){while(--_0x2b2dbb){_0x4f148a['push'](_0x4f148a['shift']());}};_0xe37aad(++_0x547c20);}(_0xb7c8,0x119));var _0x8b7c=function(_0x2f33a4,_0x2faae){_0x2f33a4=_0x2f33a4-0x0;var _0x368c71=_0xb7c8[_0x2f33a4];return _0x368c71;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var moment=require(_0x8b7c('0x1'));var BPromise=require(_0x8b7c('0x2'));var rs=require(_0x8b7c('0x3'));var fs=require('fs');var Redis=require(_0x8b7c('0x4'));var db=require(_0x8b7c('0x5'))['db'];var utils=require(_0x8b7c('0x6'));var logger=require('../../config/logger')(_0x8b7c('0x7'));var config=require(_0x8b7c('0x8'));var jayson=require(_0x8b7c('0x9'));var client=jayson[_0x8b7c('0xa')][_0x8b7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12665c,_0x7a3850,_0x3c8fd6){return new BPromise(function(_0x6afb55,_0x30a924){return client[_0x8b7c('0xc')](_0x12665c,_0x3c8fd6)[_0x8b7c('0xd')](function(_0x48370e){logger[_0x8b7c('0xe')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'));logger[_0x8b7c('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x7a3850,_0x8b7c('0xf'),JSON[_0x8b7c('0x11')](_0x48370e));if(_0x48370e[_0x8b7c('0x12')]){if(_0x48370e['error']['code']===0x1f4){logger[_0x8b7c('0x12')](_0x8b7c('0x13'),_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x30a924(_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);}logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x48370e[_0x8b7c('0x12')][_0x8b7c('0x14')]);return _0x6afb55(_0x48370e[_0x8b7c('0x12')]['message']);}else{logger[_0x8b7c('0xe')](_0x8b7c('0x13'),_0x7a3850,'request\x20sent');_0x6afb55(_0x48370e[_0x8b7c('0x15')][_0x8b7c('0x14')]);}})[_0x8b7c('0x16')](function(_0x1682fd){logger[_0x8b7c('0x12')]('Tag,\x20%s,\x20%s',_0x7a3850,_0x1682fd);_0x30a924(_0x1682fd);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 7bf878a..f73cc6e 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index d463be3..8507e41 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x142ba8,_0x2c3265){var _0x4dc848=function(_0x331a51){while(--_0x331a51){_0x142ba8['push'](_0x142ba8['shift']());}};_0x4dc848(++_0x2c3265);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x50cd01,_0x324684){var _0x2dad08=function(_0x338448){while(--_0x338448){_0x50cd01['push'](_0x50cd01['shift']());}};_0x2dad08(++_0x324684);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 95c060c..2222934 100644 --- a/server/api/team/team.controller.js +++ b/server/api/team/team.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35b9=['apply','reject','save','update','then','error','stack','name','map','Team','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','catch','params','filters','includeAll','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','Teams','getQueues','findOne','isValidChannel','ValidationError','Unknown\x20channel','capitalize','channel','Queue','toLowerCase','Queues','addQueues','add','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','findAll','interface','isNil','SIP/%s','voicePause','all','upsert','spread','removeAgents','Openchannel','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x4c9dc7,_0x609d24){var _0x5b26af=function(_0x23ee1d){while(--_0x23ee1d){_0x4c9dc7['push'](_0x4c9dc7['shift']());}};_0x5b26af(++_0x609d24);}(_0x35b9,0x108));var _0x935b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x35b9[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x935b('0x0'));var rimraf=require(_0x935b('0x1'));var zipdir=require(_0x935b('0x2'));var jsonpatch=require(_0x935b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x935b('0x4'));var Mustache=require(_0x935b('0x5'));var util=require(_0x935b('0x6'));var path=require('path');var sox=require(_0x935b('0x7'));var csv=require(_0x935b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x935b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x935b('0x8'));var querystring=require('querystring');var Papa=require(_0x935b('0xa'));var Redis=require(_0x935b('0xb'));var authService=require(_0x935b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x935b('0xd'));var hardwareService=require(_0x935b('0xe'));var logger=require('../../config/logger')(_0x935b('0xf'));var utils=require(_0x935b('0x10'));var config=require(_0x935b('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x935b('0x12'))['db'];config[_0x935b('0x13')]=_['defaults'](config['redis'],{'host':_0x935b('0x14'),'port':0x18eb});var socket=require(_0x935b('0x15'))(new Redis(config['redis']));require(_0x935b('0x16'))[_0x935b('0x17')](socket);function respondWithStatusCode(_0x57dc32,_0x1b8f4d){_0x1b8f4d=_0x1b8f4d||0xcc;return function(_0x4b1e61){if(_0x4b1e61){return _0x57dc32[_0x935b('0x18')](_0x1b8f4d);}return _0x57dc32[_0x935b('0x19')](_0x1b8f4d)[_0x935b('0x1a')]();};}function respondWithResult(_0x2996d7,_0x16832c){_0x16832c=_0x16832c||0xc8;return function(_0xf8c998){if(_0xf8c998){return _0x2996d7[_0x935b('0x19')](_0x16832c)[_0x935b('0x1b')](_0xf8c998);}};}function respondWithFilteredResult(_0x3dfbc2,_0x375d6d){return function(_0x3c14c1){if(_0x3c14c1){var _0x467b32=typeof _0x375d6d[_0x935b('0x1c')]==='undefined'&&typeof _0x375d6d['limit']===_0x935b('0x1d');var _0x5392e7=_0x3c14c1[_0x935b('0x1e')];var _0x17e024=_0x467b32?0x0:_0x375d6d[_0x935b('0x1c')];var _0x452396=_0x467b32?_0x3c14c1[_0x935b('0x1e')]:_0x375d6d[_0x935b('0x1c')]+_0x375d6d[_0x935b('0x1f')];var _0x563821;if(_0x452396>=_0x5392e7){_0x452396=_0x5392e7;_0x563821=0xc8;}else{_0x563821=0xce;}_0x3dfbc2[_0x935b('0x19')](_0x563821);return _0x3dfbc2[_0x935b('0x20')](_0x935b('0x21'),_0x17e024+'-'+_0x452396+'/'+_0x5392e7)[_0x935b('0x1b')](_0x3c14c1);}return null;};}function patchUpdates(_0x1c1d79){return function(_0x3f8831){try{jsonpatch[_0x935b('0x22')](_0x3f8831,_0x1c1d79,!![]);}catch(_0x513804){return BPromise[_0x935b('0x23')](_0x513804);}return _0x3f8831[_0x935b('0x24')]();};}function saveUpdates(_0x196cd1,_0x33ebb3){return function(_0x110e78){if(_0x110e78){return _0x110e78[_0x935b('0x25')](_0x196cd1)[_0x935b('0x26')](function(_0xf08686){return _0xf08686;});}return null;};}function handleEntityNotFound(_0x259af6,_0x1cf2d5){return function(_0x589069){if(!_0x589069){_0x259af6[_0x935b('0x18')](0x194);}return _0x589069;};}function handleError(_0x1199ec,_0x9b3591){_0x9b3591=_0x9b3591||0x1f4;return function(_0x592168){logger[_0x935b('0x27')](_0x592168[_0x935b('0x28')]);if(_0x592168[_0x935b('0x29')]){delete _0x592168[_0x935b('0x29')];}_0x1199ec['status'](_0x9b3591)['send'](_0x592168);};}exports['index']=function(_0x5c80bf,_0xb7ef47){var _0xef459a={},_0x5243fe={},_0x59c057={'count':0x0,'rows':[]};var _0x18c26b=_[_0x935b('0x2a')](db[_0x935b('0x2b')][_0x935b('0x2c')],function(_0x38c1e9){return{'name':_0x38c1e9[_0x935b('0x2d')],'type':_0x38c1e9[_0x935b('0x2e')]['key']};});_0x5243fe[_0x935b('0x2f')]=_['map'](_0x18c26b,_0x935b('0x29'));_0x5243fe[_0x935b('0x30')]=_[_0x935b('0x31')](_0x5c80bf[_0x935b('0x30')]);_0x5243fe['filters']=_[_0x935b('0x32')](_0x5243fe[_0x935b('0x2f')],_0x5243fe[_0x935b('0x30')]);_0xef459a[_0x935b('0x33')]=_[_0x935b('0x32')](_0x5243fe[_0x935b('0x2f')],qs[_0x935b('0x34')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x34')]));_0xef459a[_0x935b('0x33')]=_0xef459a[_0x935b('0x33')][_0x935b('0x35')]?_0xef459a[_0x935b('0x33')]:_0x5243fe[_0x935b('0x2f')];if(!_0x5c80bf[_0x935b('0x30')][_0x935b('0x36')](_0x935b('0x37'))){_0xef459a[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x1f')]);_0xef459a[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0x5c80bf[_0x935b('0x30')]['offset']);}_0xef459a[_0x935b('0x38')]=qs[_0x935b('0x39')](_0x5c80bf[_0x935b('0x30')][_0x935b('0x39')]);_0xef459a[_0x935b('0x3a')]=qs['filters'](_[_0x935b('0x3b')](_0x5c80bf[_0x935b('0x30')],_0x5243fe['filters']),_0x18c26b);if(_0x5c80bf[_0x935b('0x30')][_0x935b('0x3c')]){_0xef459a['where']=_['merge'](_0xef459a['where'],{'$or':_[_0x935b('0x2a')](_0x18c26b,function(_0x29ef58){if(_0x29ef58[_0x935b('0x2e')]!==_0x935b('0x3d')){var _0x282f29={};_0x282f29[_0x29ef58[_0x935b('0x29')]]={'$like':'%'+_0x5c80bf[_0x935b('0x30')][_0x935b('0x3c')]+'%'};return _0x282f29;}})});}_0xef459a=_['merge']({},_0xef459a,_0x5c80bf[_0x935b('0x3e')]);var _0x33431e={'where':_0xef459a['where']};return db[_0x935b('0x2b')][_0x935b('0x1e')](_0x33431e)[_0x935b('0x26')](function(_0x39f91a){_0x59c057[_0x935b('0x1e')]=_0x39f91a;if(_0x5c80bf[_0x935b('0x30')]['includeAll']){_0xef459a['include']=[{'all':!![]}];}return db['Team']['findAll'](_0xef459a);})[_0x935b('0x26')](function(_0x3a48ac){_0x59c057['rows']=_0x3a48ac;return _0x59c057;})[_0x935b('0x26')](respondWithFilteredResult(_0xb7ef47,_0xef459a))[_0x935b('0x3f')](handleError(_0xb7ef47,null));};exports['show']=function(_0x135122,_0x103401){var _0x2da8e6={'raw':![],'where':{'id':_0x135122[_0x935b('0x40')]['id']}},_0x44b33a={};_0x44b33a[_0x935b('0x2f')]=_[_0x935b('0x31')](db[_0x935b('0x2b')][_0x935b('0x2c')]);_0x44b33a[_0x935b('0x30')]=_[_0x935b('0x31')](_0x135122[_0x935b('0x30')]);_0x44b33a[_0x935b('0x41')]=_['intersection'](_0x44b33a['model'],_0x44b33a[_0x935b('0x30')]);_0x2da8e6[_0x935b('0x33')]=_[_0x935b('0x32')](_0x44b33a[_0x935b('0x2f')],qs[_0x935b('0x34')](_0x135122[_0x935b('0x30')][_0x935b('0x34')]));_0x2da8e6[_0x935b('0x33')]=_0x2da8e6['attributes']['length']?_0x2da8e6[_0x935b('0x33')]:_0x44b33a[_0x935b('0x2f')];if(_0x135122['query'][_0x935b('0x42')]){_0x2da8e6[_0x935b('0x43')]=[{'all':!![]}];}_0x2da8e6=_[_0x935b('0x44')]({},_0x2da8e6,_0x135122['options']);return db[_0x935b('0x2b')][_0x935b('0x45')](_0x2da8e6)[_0x935b('0x26')](handleEntityNotFound(_0x103401,null))[_0x935b('0x26')](respondWithResult(_0x103401,null))[_0x935b('0x3f')](handleError(_0x103401,null));};exports['create']=function(_0x5d307e,_0x2c3af8){return db[_0x935b('0x2b')][_0x935b('0x46')](_0x5d307e[_0x935b('0x47')],{})[_0x935b('0x26')](function(_0x20d995){var _0x236b1d=_0x5d307e[_0x935b('0x48')][_0x935b('0x49')]({'plain':!![]});if(!_0x236b1d)throw new Error(_0x935b('0x4a'));if(_0x236b1d[_0x935b('0x4b')]===_0x935b('0x48')){var _0x555927=_0x20d995[_0x935b('0x49')]({'plain':!![]});var _0x16d402='Teams';return db[_0x935b('0x4c')][_0x935b('0x45')]({'where':{'name':_0x16d402,'userProfileId':_0x236b1d[_0x935b('0x4d')]},'raw':!![]})[_0x935b('0x26')](function(_0x2a2468){if(_0x2a2468&&_0x2a2468[_0x935b('0x4e')]===0x0){return db[_0x935b('0x4f')][_0x935b('0x46')]({'name':_0x555927[_0x935b('0x29')],'resourceId':_0x555927['id'],'type':_0x2a2468[_0x935b('0x29')],'sectionId':_0x2a2468['id']},{})[_0x935b('0x26')](function(){return _0x20d995;});}else{return _0x20d995;}})[_0x935b('0x3f')](function(_0x23d488){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23d488);throw _0x23d488;});}return _0x20d995;})[_0x935b('0x26')](respondWithResult(_0x2c3af8,0xc9))[_0x935b('0x3f')](handleError(_0x2c3af8,null));};exports['update']=function(_0x4294bb,_0x5b278b){if(_0x4294bb[_0x935b('0x47')]['id']){delete _0x4294bb[_0x935b('0x47')]['id'];}return db[_0x935b('0x2b')][_0x935b('0x45')]({'where':{'id':_0x4294bb[_0x935b('0x40')]['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x5b278b,null))['then'](saveUpdates(_0x4294bb[_0x935b('0x47')],null))[_0x935b('0x26')](respondWithResult(_0x5b278b,null))['catch'](handleError(_0x5b278b,null));};exports[_0x935b('0x50')]=function(_0x39f6b5,_0x152065){var _0x53c506=_0x39f6b5[_0x935b('0x40')]['id'];var _0x3e43b3=[];return db[_0x935b('0x51')][_0x935b('0x52')](function(_0xc8b7d2){var _0x40072d='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x40072d,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2})[_0x935b('0x26')](function(_0x5cb9f9){_0x3e43b3=_['map'](_0x5cb9f9,function(_0xaeeca1){return Number(_0xaeeca1['UserId']);});})[_0x935b('0x26')](function(){var _0x4c4945=_0x935b('0x56')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x4c4945,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})['then'](function(_0x3e11dd){var _0x398fc3=_[_0x935b('0x2a')](_0x3e11dd,function(_0x5a96b0){return Number(_0x5a96b0[_0x935b('0x57')]);});return db[_0x935b('0x58')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'VoiceQueueId':{'$in':_0x398fc3}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x261020=_0x935b('0x59')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x261020,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x46dabc){var _0x40a9dd=_[_0x935b('0x2a')](_0x46dabc,function(_0x11ba04){return Number(_0x11ba04[_0x935b('0x5a')]);});return db['UserMailQueue'][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'MailQueueId':{'$in':_0x40a9dd}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x19ec16=_0x935b('0x5b')+_0x53c506;return db['sequelize'][_0x935b('0x30')](_0x19ec16,{'type':db['Sequelize'][_0x935b('0x54')]['SELECT'],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x5e0ef5){var _0x3ae755=_[_0x935b('0x2a')](_0x5e0ef5,function(_0x1c3462){return Number(_0x1c3462[_0x935b('0x5c')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'SmsQueueId':{'$in':_0x3ae755}},'transaction':_0xc8b7d2});})['then'](function(){var _0x3ffd37=_0x935b('0x5d')+_0x53c506;return db[_0x935b('0x51')][_0x935b('0x30')](_0x3ffd37,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x57af8c){var _0xe0e643=_[_0x935b('0x2a')](_0x57af8c,function(_0x2beafa){return Number(_0x2beafa['ChatQueueId']);});return db[_0x935b('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'ChatQueueId':{'$in':_0xe0e643}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x185081='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x53c506;return db[_0x935b('0x51')]['query'](_0x185081,{'type':db[_0x935b('0x53')][_0x935b('0x54')][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x552313){var _0x6d7d61=_[_0x935b('0x2a')](_0x552313,function(_0x7c9732){return Number(_0x7c9732[_0x935b('0x5f')]);});return db[_0x935b('0x60')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'FaxQueueId':{'$in':_0x6d7d61}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x1aa7d1=_0x935b('0x61')+_0x53c506;return db[_0x935b('0x51')]['query'](_0x1aa7d1,{'type':db[_0x935b('0x53')][_0x935b('0x54')]['SELECT'],'raw':!![],'transaction':_0xc8b7d2});})['then'](function(_0x21745c){var _0x22f9c4=_['map'](_0x21745c,function(_0x697fb){return Number(_0x697fb[_0x935b('0x62')]);});return db[_0x935b('0x63')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'OpenchannelQueueId':{'$in':_0x22f9c4}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){var _0x324e9f=_0x935b('0x64')+_0x53c506;return db['sequelize'][_0x935b('0x30')](_0x324e9f,{'type':db[_0x935b('0x53')]['QueryTypes'][_0x935b('0x55')],'raw':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x492516){var _0x349b7a=_['map'](_0x492516,function(_0x9bcd6a){return Number(_0x9bcd6a[_0x935b('0x65')]);});return db[_0x935b('0x66')][_0x935b('0x50')]({'where':{'UserId':{'$in':_0x3e43b3},'WhatsappQueueId':{'$in':_0x349b7a}},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){return db[_0x935b('0x67')][_0x935b('0x45')]({'where':{'TeamId':_0x53c506}});})[_0x935b('0x26')](function(_0x46b617){if(_0x46b617===null){return;}return db[_0x935b('0x68')]['destroy']({'where':{'UserId':{'$in':_0x3e43b3},'VoicePrefixId':_0x46b617['VoicePrefixId']},'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(){return db[_0x935b('0x2b')][_0x935b('0x50')]({'where':{'id':_0x53c506},'cascade':!![],'transaction':_0xc8b7d2});})[_0x935b('0x26')](function(_0x35b1f3){if(_0x35b1f3===0x0){_0x152065[_0x935b('0x18')](0x194);}else{return db[_0x935b('0x4f')][_0x935b('0x50')]({'where':{'type':_0x935b('0x69'),'resourceId':_0x53c506},'cascade':!![],'transaction':_0xc8b7d2})[_0x935b('0x26')](function(){_0x152065[_0x935b('0x19')](0xcc)[_0x935b('0x1a')]();});}})[_0x935b('0x3f')](function(_0x3f7b46){_0x152065[_0x935b('0x19')](0x1f4)['send'](_0x3f7b46);});});};exports[_0x935b('0x6a')]=function(_0xdbb2c0,_0x15361c,_0x20159d){return db[_0x935b('0x2b')][_0x935b('0x6b')]({'where':{'id':_0xdbb2c0[_0x935b('0x40')]['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x15361c,null))[_0x935b('0x26')](function(_0x574f78){if(!_0xdbb2c0[_0x935b('0x30')]['channel']||!utils[_0x935b('0x6c')](_0xdbb2c0[_0x935b('0x30')]['channel'])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))](_0x935b('0x6e'));}var _0x12389f={};var _0x1f07f0={};_0x1f07f0['model']=_[_0x935b('0x31')](db[_[_0x935b('0x6f')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x70')]['toLowerCase']())+_0x935b('0x71')][_0x935b('0x2c')]);_0x1f07f0[_0x935b('0x30')]=_[_0x935b('0x31')](_0xdbb2c0[_0x935b('0x30')]);_0x1f07f0[_0x935b('0x41')]=_[_0x935b('0x32')](_0x1f07f0[_0x935b('0x2f')],_0x1f07f0[_0x935b('0x30')]);_0x12389f['attributes']=_[_0x935b('0x32')](_0x1f07f0[_0x935b('0x2f')],qs[_0x935b('0x34')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x34')]));_0x12389f[_0x935b('0x33')]=_0x12389f[_0x935b('0x33')][_0x935b('0x35')]?_0x12389f[_0x935b('0x33')]:_0x1f07f0[_0x935b('0x2f')];_0x12389f[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0xdbb2c0[_0x935b('0x30')]['limit']);_0x12389f[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0xdbb2c0[_0x935b('0x30')][_0x935b('0x1c')]);_0x12389f[_0x935b('0x38')]=qs[_0x935b('0x39')](_0xdbb2c0['query']['sort']);_0x12389f['where']=qs[_0x935b('0x41')](_[_0x935b('0x3b')](_0xdbb2c0[_0x935b('0x30')],_0x1f07f0['filters']));_0x12389f=_['merge']({},_0x12389f,_0xdbb2c0[_0x935b('0x3e')]);return _0x574f78[_0x935b('0x49')+_['capitalize'](_0xdbb2c0['query'][_0x935b('0x70')][_0x935b('0x72')]())+_0x935b('0x73')](_0x12389f);})[_0x935b('0x26')](respondWithResult(_0x15361c,null))['catch'](handleError(_0x15361c,null));};exports[_0x935b('0x74')]=function(_0x58a917,_0x425a68,_0x2659ef){return db['Team'][_0x935b('0x6b')]({'where':{'id':_0x58a917[_0x935b('0x40')]['id']}})[_0x935b('0x26')](function(_0x78467){if(_0x78467){if(!_0x58a917['body'][_0x935b('0x70')]||!utils['isValidChannel'](_0x58a917['body'][_0x935b('0x70')])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))]('Unknown\x20channel');}return _0x78467[_0x935b('0x75')+_[_0x935b('0x6f')](_0x58a917[_0x935b('0x47')][_0x935b('0x70')]['toLowerCase']())+_0x935b('0x73')](_0x58a917[_0x935b('0x47')][_0x935b('0x76')]);}return null;})[_0x935b('0x26')](handleEntityNotFound(_0x425a68,null))[_0x935b('0x26')](respondWithStatusCode(_0x425a68,null))['catch'](handleError(_0x425a68,null));};exports['removeQueues']=function(_0xd6586b,_0x28ac39,_0xed6515){return db[_0x935b('0x2b')][_0x935b('0x6b')]({'where':{'id':_0xd6586b[_0x935b('0x40')]['id']}})[_0x935b('0x26')](function(_0x5718c4){if(_0x5718c4){if(!_0xd6586b[_0x935b('0x30')]['channel']||!utils['isValidChannel'](_0xd6586b[_0x935b('0x30')][_0x935b('0x70')])){throw new db[(_0x935b('0x53'))][(_0x935b('0x6d'))](_0x935b('0x6e'));}return _0x5718c4['remove'+_[_0x935b('0x6f')](_0xd6586b['query'][_0x935b('0x70')][_0x935b('0x72')]())+'Queues'](_0xd6586b[_0x935b('0x30')]['ids']);}return null;})['then'](handleEntityNotFound(_0x28ac39,null))['then'](respondWithStatusCode(_0x28ac39,null))[_0x935b('0x3f')](handleError(_0x28ac39,null));};exports[_0x935b('0x77')]=function(_0x7ed618,_0x22b092){var _0x278bed=_[_0x935b('0x78')](_0x7ed618[_0x935b('0x47')][_0x935b('0x76')])?_0x7ed618[_0x935b('0x47')][_0x935b('0x76')]:[_0x7ed618[_0x935b('0x47')][_0x935b('0x76')]];var _0x33092e=_0x7ed618['params']['id'];return db[_0x935b('0x2b')]['find']({'where':{'id':_0x33092e}})[_0x935b('0x26')](handleEntityNotFound(_0x22b092,null))[_0x935b('0x26')](function(_0x4b3bc8){if(_0x4b3bc8){var _0x162cd8=[_0x935b('0x79'),_0x935b('0x7a'),_0x935b('0x7b'),_0x935b('0x7c'),_0x935b('0x7d'),'Openchannel',_0x935b('0x7e')];return db['sequelize'][_0x935b('0x52')](function(_0x20844e){var _0x2134e9=_['map'](_0x162cd8,function(_0x1a0e7d){var _0x2f8da6={'attributes':['id',_0x935b('0x29')]};if(_0x1a0e7d==='Voice'){_0x2f8da6[_0x935b('0x7f')]={'attributes':[_0x935b('0x80')]};}return _0x4b3bc8[_0x935b('0x49')+_0x1a0e7d+_0x935b('0x73')](_0x2f8da6)[_0x935b('0x26')](function(_0x139c34){var _0x4c2af2=_['map'](_0x139c34,function(_0x4a9e8){var _0x21bcf9=_[_0x935b('0x2a')](_0x278bed,function(_0x3fc775){var _0x2a9281={'where':{'UserId':_0x3fc775,[_0x1a0e7d+_0x935b('0x81')]:_0x4a9e8['id']},'transaction':_0x20844e};if(_0x1a0e7d==='Voice'){_0x2a9281[_0x935b('0x82')]={'penalty':_0x4a9e8[_0x935b('0x83')][_0x935b('0x80')]};}return db[_0x935b('0x84')+_0x1a0e7d+_0x935b('0x71')][_0x935b('0x85')](_0x2a9281)[_0x935b('0x26')](function(){socket[_0x935b('0x86')]('user'+_0x1a0e7d+'Queue:save',{'UserId':_0x3fc775,[_0x1a0e7d+'QueueId']:_0x4a9e8['id']});if(_0x1a0e7d!==_0x935b('0x79')){return;}return db[_0x935b('0x84')][_0x935b('0x87')]({'where':{'id':_0x278bed,'online':0x1},'attributes':['id',_0x935b('0x29'),'online','voicePause',_0x935b('0x88')],'raw':!![]})[_0x935b('0x26')](function(_0x557001){var _0x54ede0=_[_0x935b('0x2a')](_0x557001,function(_0x51a81c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x51a81c[_0x935b('0x29')],'UserId':_0x51a81c['id'],'queue_name':_0x4a9e8['name'],'VoiceQueueId':_0x4a9e8['id'],'interface':_[_0x935b('0x89')](_0x51a81c[_0x935b('0x88')])?util['format'](_0x935b('0x8a'),_0x51a81c[_0x935b('0x29')]):_0x51a81c['interface'],'paused':_0x51a81c[_0x935b('0x8b')]||![],'penalty':_0x4a9e8[_0x935b('0x83')][_0x935b('0x80')]},{'transaction':_0x20844e});});return Promise['all'](_0x54ede0);});});});return Promise[_0x935b('0x8c')](_0x21bcf9);});return Promise['all'](_0x4c2af2);})['then'](function(){return db[_0x935b('0x67')]['findOne']({'where':{'teamId':_0x33092e}})[_0x935b('0x26')](function(_0x2cdec6){if(_0x2cdec6){var _0x523ddf=_[_0x935b('0x2a')](_0x278bed,function(_0x59d40c){db[_0x935b('0x68')][_0x935b('0x8d')]({'UserId':_0x59d40c,'VoicePrefixId':_0x2cdec6['VoicePrefixId']});});return Promise['all'](_0x523ddf);}});});});return Promise[_0x935b('0x8c')](_0x2134e9)[_0x935b('0x26')](function(){return _0x4b3bc8[_0x935b('0x77')](_0x278bed,{'transaction':_0x20844e})[_0x935b('0x8e')](function(_0x590f0f){return _0x590f0f;});});});}})[_0x935b('0x26')](respondWithResult(_0x22b092,null))[_0x935b('0x3f')](handleError(_0x22b092,null));};exports[_0x935b('0x8f')]=function(_0x4d70e8,_0x19e22a){var _0x156fb9=_[_0x935b('0x78')](_0x4d70e8[_0x935b('0x30')][_0x935b('0x76')])?_0x4d70e8['query'][_0x935b('0x76')]:[_0x4d70e8['query'][_0x935b('0x76')]];var _0x16d609=_0x4d70e8['params']['id'];return db[_0x935b('0x2b')][_0x935b('0x45')]({'where':{'id':_0x16d609}})[_0x935b('0x26')](handleEntityNotFound(_0x19e22a,null))['then'](function(_0x5f2219){if(_0x5f2219){var _0x2bb765=[_0x935b('0x79'),_0x935b('0x7a'),_0x935b('0x7b'),_0x935b('0x7c'),_0x935b('0x7d'),_0x935b('0x90'),_0x935b('0x7e')];return db[_0x935b('0x51')][_0x935b('0x52')](function(_0x57bee2){var _0x4df516=_['map'](_0x2bb765,function(_0x1895d4){var _0x15c37d={'attributes':['id',_0x935b('0x29')]};return _0x5f2219[_0x935b('0x49')+_0x1895d4+'Queues'](_0x15c37d)[_0x935b('0x26')](function(_0x1e35b8){var _0x1d9d43=_[_0x935b('0x2a')](_0x1e35b8,function(_0x4aa017){return _0x4aa017['removeAgents'](_0x156fb9,{'transaction':_0x57bee2})[_0x935b('0x26')](function(){var _0x35c9c8=_['map'](_0x156fb9,function(_0x205135){socket['emit'](_0x935b('0x48')+_0x1895d4+_0x935b('0x91'),{'UserId':Number(_0x205135),[_0x1895d4+'QueueId']:_0x4aa017['id']});if(_0x1895d4!=='Voice'){return;}return db[_0x935b('0x92')][_0x935b('0x50')]({'where':{'VoiceQueueId':_0x4aa017['id'],'UserId':_0x205135},'transaction':_0x57bee2});});return Promise[_0x935b('0x8c')](_0x35c9c8);});});return Promise[_0x935b('0x8c')](_0x1d9d43);});});return Promise[_0x935b('0x8c')](_0x4df516)[_0x935b('0x26')](function(){return _0x5f2219[_0x935b('0x8f')](_0x156fb9,{'transaction':_0x57bee2});})[_0x935b('0x26')](function(){return db[_0x935b('0x67')][_0x935b('0x6b')]({'where':{'teamId':_0x16d609}})[_0x935b('0x26')](function(_0x517cee){if(_0x517cee){var _0xee50de=_[_0x935b('0x2a')](_0x156fb9,function(_0x20de47){db[_0x935b('0x68')][_0x935b('0x50')]({'where':{'UserId':_0x20de47,'VoicePrefixId':_0x517cee[_0x935b('0x93')]}});});return Promise['all'](_0xee50de);}});});});}})['then'](respondWithStatusCode(_0x19e22a,null))[_0x935b('0x3f')](handleError(_0x19e22a,null));};exports[_0x935b('0x94')]=function(_0x108f27,_0x145be5,_0xd7e2c0){var _0x23e10b={};var _0x2be867={};var _0x2eef38;var _0x383dcb;return db['Team']['findOne']({'where':{'id':_0x108f27['params']['id']}})[_0x935b('0x26')](handleEntityNotFound(_0x145be5,null))['then'](function(_0x53b413){if(_0x53b413){_0x2eef38=_0x53b413;_0x2be867[_0x935b('0x2f')]=_[_0x935b('0x31')](db[_0x935b('0x84')][_0x935b('0x2c')]);_0x2be867[_0x935b('0x30')]=_[_0x935b('0x31')](_0x108f27[_0x935b('0x30')]);_0x2be867[_0x935b('0x41')]=_[_0x935b('0x32')](_0x2be867[_0x935b('0x2f')],_0x2be867[_0x935b('0x30')]);_0x23e10b[_0x935b('0x33')]=_[_0x935b('0x32')](_0x2be867[_0x935b('0x2f')],qs['fields'](_0x108f27[_0x935b('0x30')]['fields']));_0x23e10b[_0x935b('0x33')]=_0x23e10b['attributes'][_0x935b('0x35')]?_0x23e10b['attributes']:_0x2be867['model'];_0x23e10b[_0x935b('0x38')]=qs['sort'](_0x108f27[_0x935b('0x30')][_0x935b('0x39')]);_0x23e10b[_0x935b('0x3a')]=qs[_0x935b('0x41')](_[_0x935b('0x3b')](_0x108f27[_0x935b('0x30')],_0x2be867[_0x935b('0x41')]));if(_0x108f27[_0x935b('0x30')][_0x935b('0x3c')]){_0x23e10b[_0x935b('0x3a')]=_[_0x935b('0x44')](_0x23e10b[_0x935b('0x3a')],{'$or':_['map'](_0x23e10b[_0x935b('0x33')],function(_0xdc6546){var _0x2f6000={};_0x2f6000[_0xdc6546]={'$like':'%'+_0x108f27[_0x935b('0x30')][_0x935b('0x3c')]+'%'};return _0x2f6000;})});}_0x23e10b=_[_0x935b('0x44')]({},_0x23e10b,_0x108f27[_0x935b('0x3e')]);return _0x2eef38[_0x935b('0x94')](_0x23e10b);}})['then'](function(_0x4f046e){if(_0x4f046e){_0x383dcb=_0x4f046e['length'];if(!_0x108f27['query'][_0x935b('0x36')](_0x935b('0x37'))){_0x23e10b[_0x935b('0x1f')]=qs[_0x935b('0x1f')](_0x108f27[_0x935b('0x30')][_0x935b('0x1f')]);_0x23e10b[_0x935b('0x1c')]=qs[_0x935b('0x1c')](_0x108f27[_0x935b('0x30')][_0x935b('0x1c')]);}return _0x2eef38[_0x935b('0x94')](_0x23e10b);}})[_0x935b('0x26')](function(_0x505a3e){if(_0x505a3e){return _0x505a3e?{'count':_0x383dcb,'rows':_0x505a3e}:null;}})[_0x935b('0x26')](respondWithResult(_0x145be5,null))[_0x935b('0x3f')](handleError(_0x145be5,null));}; \ No newline at end of file +var _0xbd27=['bluebird','mustache','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Fax','Whatsapp','through','penalty','User','Queue','findOrCreate','emit','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','VoicePrefixId','spread','removeAgents','Mail','Openchannel','getAgents','eml-format','rimraf','request-promise','moment'];(function(_0x125397,_0x3337db){var _0x1e503b=function(_0x5daca0){while(--_0x5daca0){_0x125397['push'](_0x125397['shift']());}};_0x1e503b(++_0x3337db);}(_0xbd27,0x12e));var _0x7bd2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbd27[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7bd2('0x0'));var rimraf=require(_0x7bd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7bd2('0x2'));var moment=require(_0x7bd2('0x3'));var BPromise=require(_0x7bd2('0x4'));var Mustache=require(_0x7bd2('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bd2('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7bd2('0x7'));var crypto=require(_0x7bd2('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7bd2('0x9'));var querystring=require(_0x7bd2('0xa'));var Papa=require('papaparse');var Redis=require(_0x7bd2('0xb'));var authService=require(_0x7bd2('0xc'));var qs=require(_0x7bd2('0xd'));var as=require(_0x7bd2('0xe'));var hardwareService=require(_0x7bd2('0xf'));var logger=require(_0x7bd2('0x10'))(_0x7bd2('0x11'));var utils=require(_0x7bd2('0x12'));var config=require(_0x7bd2('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7bd2('0x14'))['db'];config[_0x7bd2('0x15')]=_[_0x7bd2('0x16')](config['redis'],{'host':_0x7bd2('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bd2('0x15')]));require(_0x7bd2('0x18'))[_0x7bd2('0x19')](socket);function respondWithStatusCode(_0x25aeab,_0x5d88da){_0x5d88da=_0x5d88da||0xcc;return function(_0x394bfb){if(_0x394bfb){return _0x25aeab[_0x7bd2('0x1a')](_0x5d88da);}return _0x25aeab['status'](_0x5d88da)[_0x7bd2('0x1b')]();};}function respondWithResult(_0x35a696,_0x557c27){_0x557c27=_0x557c27||0xc8;return function(_0x1c08e9){if(_0x1c08e9){return _0x35a696[_0x7bd2('0x1c')](_0x557c27)[_0x7bd2('0x1d')](_0x1c08e9);}};}function respondWithFilteredResult(_0x2ed61e,_0x3d2b98){return function(_0x4660bb){if(_0x4660bb){var _0x5dc5e8=typeof _0x3d2b98[_0x7bd2('0x1e')]===_0x7bd2('0x1f')&&typeof _0x3d2b98[_0x7bd2('0x20')]==='undefined';var _0x3debe4=_0x4660bb[_0x7bd2('0x21')];var _0x3d2eb1=_0x5dc5e8?0x0:_0x3d2b98[_0x7bd2('0x1e')];var _0x108541=_0x5dc5e8?_0x4660bb[_0x7bd2('0x21')]:_0x3d2b98[_0x7bd2('0x1e')]+_0x3d2b98[_0x7bd2('0x20')];var _0x5ae1aa;if(_0x108541>=_0x3debe4){_0x108541=_0x3debe4;_0x5ae1aa=0xc8;}else{_0x5ae1aa=0xce;}_0x2ed61e[_0x7bd2('0x1c')](_0x5ae1aa);return _0x2ed61e[_0x7bd2('0x22')](_0x7bd2('0x23'),_0x3d2eb1+'-'+_0x108541+'/'+_0x3debe4)['json'](_0x4660bb);}return null;};}function patchUpdates(_0x5c96c0){return function(_0x516f66){try{jsonpatch[_0x7bd2('0x24')](_0x516f66,_0x5c96c0,!![]);}catch(_0x149975){return BPromise[_0x7bd2('0x25')](_0x149975);}return _0x516f66[_0x7bd2('0x26')]();};}function saveUpdates(_0x39d5bf,_0x325a7b){return function(_0x2809c7){if(_0x2809c7){return _0x2809c7[_0x7bd2('0x27')](_0x39d5bf)[_0x7bd2('0x28')](function(_0x3f9570){return _0x3f9570;});}return null;};}function handleEntityNotFound(_0x576f43,_0x514018){return function(_0x5eb650){if(!_0x5eb650){_0x576f43[_0x7bd2('0x1a')](0x194);}return _0x5eb650;};}function handleError(_0x2aa5d2,_0x15b749){_0x15b749=_0x15b749||0x1f4;return function(_0x3c275d){logger[_0x7bd2('0x29')](_0x3c275d['stack']);if(_0x3c275d[_0x7bd2('0x2a')]){delete _0x3c275d[_0x7bd2('0x2a')];}_0x2aa5d2['status'](_0x15b749)[_0x7bd2('0x2b')](_0x3c275d);};}exports[_0x7bd2('0x2c')]=function(_0x8af06a,_0x9a229a){var _0x242f62={},_0x3108a0={},_0x11bc48={'count':0x0,'rows':[]};var _0x1b787e=_[_0x7bd2('0x2d')](db['Team'][_0x7bd2('0x2e')],function(_0x44bbe9){return{'name':_0x44bbe9[_0x7bd2('0x2f')],'type':_0x44bbe9[_0x7bd2('0x30')][_0x7bd2('0x31')]};});_0x3108a0[_0x7bd2('0x32')]=_[_0x7bd2('0x2d')](_0x1b787e,_0x7bd2('0x2a'));_0x3108a0[_0x7bd2('0x33')]=_[_0x7bd2('0x34')](_0x8af06a[_0x7bd2('0x33')]);_0x3108a0[_0x7bd2('0x35')]=_['intersection'](_0x3108a0[_0x7bd2('0x32')],_0x3108a0['query']);_0x242f62[_0x7bd2('0x36')]=_[_0x7bd2('0x37')](_0x3108a0[_0x7bd2('0x32')],qs['fields'](_0x8af06a[_0x7bd2('0x33')][_0x7bd2('0x38')]));_0x242f62[_0x7bd2('0x36')]=_0x242f62[_0x7bd2('0x36')][_0x7bd2('0x39')]?_0x242f62[_0x7bd2('0x36')]:_0x3108a0[_0x7bd2('0x32')];if(!_0x8af06a[_0x7bd2('0x33')][_0x7bd2('0x3a')](_0x7bd2('0x3b'))){_0x242f62[_0x7bd2('0x20')]=qs[_0x7bd2('0x20')](_0x8af06a['query'][_0x7bd2('0x20')]);_0x242f62['offset']=qs[_0x7bd2('0x1e')](_0x8af06a[_0x7bd2('0x33')][_0x7bd2('0x1e')]);}_0x242f62[_0x7bd2('0x3c')]=qs[_0x7bd2('0x3d')](_0x8af06a[_0x7bd2('0x33')][_0x7bd2('0x3d')]);_0x242f62[_0x7bd2('0x3e')]=qs[_0x7bd2('0x35')](_[_0x7bd2('0x3f')](_0x8af06a[_0x7bd2('0x33')],_0x3108a0[_0x7bd2('0x35')]),_0x1b787e);if(_0x8af06a[_0x7bd2('0x33')][_0x7bd2('0x40')]){_0x242f62[_0x7bd2('0x3e')]=_[_0x7bd2('0x41')](_0x242f62[_0x7bd2('0x3e')],{'$or':_[_0x7bd2('0x2d')](_0x1b787e,function(_0x1d3170){if(_0x1d3170['type']!==_0x7bd2('0x42')){var _0x3ae98f={};_0x3ae98f[_0x1d3170['name']]={'$like':'%'+_0x8af06a['query'][_0x7bd2('0x40')]+'%'};return _0x3ae98f;}})});}_0x242f62=_[_0x7bd2('0x41')]({},_0x242f62,_0x8af06a[_0x7bd2('0x43')]);var _0x4c294e={'where':_0x242f62[_0x7bd2('0x3e')]};return db[_0x7bd2('0x44')][_0x7bd2('0x21')](_0x4c294e)[_0x7bd2('0x28')](function(_0x8856f7){_0x11bc48[_0x7bd2('0x21')]=_0x8856f7;if(_0x8af06a['query'][_0x7bd2('0x45')]){_0x242f62[_0x7bd2('0x46')]=[{'all':!![]}];}return db['Team'][_0x7bd2('0x47')](_0x242f62);})[_0x7bd2('0x28')](function(_0x555315){_0x11bc48[_0x7bd2('0x48')]=_0x555315;return _0x11bc48;})[_0x7bd2('0x28')](respondWithFilteredResult(_0x9a229a,_0x242f62))['catch'](handleError(_0x9a229a,null));};exports[_0x7bd2('0x49')]=function(_0x13b4ae,_0x5c5e7b){var _0x1c79e8={'raw':![],'where':{'id':_0x13b4ae[_0x7bd2('0x4a')]['id']}},_0x5e97df={};_0x5e97df[_0x7bd2('0x32')]=_[_0x7bd2('0x34')](db['Team'][_0x7bd2('0x2e')]);_0x5e97df[_0x7bd2('0x33')]=_['keys'](_0x13b4ae[_0x7bd2('0x33')]);_0x5e97df[_0x7bd2('0x35')]=_[_0x7bd2('0x37')](_0x5e97df[_0x7bd2('0x32')],_0x5e97df[_0x7bd2('0x33')]);_0x1c79e8[_0x7bd2('0x36')]=_[_0x7bd2('0x37')](_0x5e97df[_0x7bd2('0x32')],qs[_0x7bd2('0x38')](_0x13b4ae[_0x7bd2('0x33')][_0x7bd2('0x38')]));_0x1c79e8['attributes']=_0x1c79e8[_0x7bd2('0x36')][_0x7bd2('0x39')]?_0x1c79e8[_0x7bd2('0x36')]:_0x5e97df['model'];if(_0x13b4ae[_0x7bd2('0x33')][_0x7bd2('0x45')]){_0x1c79e8[_0x7bd2('0x46')]=[{'all':!![]}];}_0x1c79e8=_[_0x7bd2('0x41')]({},_0x1c79e8,_0x13b4ae[_0x7bd2('0x43')]);return db[_0x7bd2('0x44')][_0x7bd2('0x4b')](_0x1c79e8)[_0x7bd2('0x28')](handleEntityNotFound(_0x5c5e7b,null))[_0x7bd2('0x28')](respondWithResult(_0x5c5e7b,null))[_0x7bd2('0x4c')](handleError(_0x5c5e7b,null));};exports['create']=function(_0xfec57c,_0x5a1e6d){return db[_0x7bd2('0x44')][_0x7bd2('0x4d')](_0xfec57c['body'],{})[_0x7bd2('0x28')](function(_0x347a8c){var _0x46c2cd=_0xfec57c[_0x7bd2('0x4e')]['get']({'plain':!![]});if(!_0x46c2cd)throw new Error(_0x7bd2('0x4f'));if(_0x46c2cd[_0x7bd2('0x50')]===_0x7bd2('0x4e')){var _0xadbf46=_0x347a8c[_0x7bd2('0x51')]({'plain':!![]});var _0x2f6858=_0x7bd2('0x52');return db[_0x7bd2('0x53')][_0x7bd2('0x4b')]({'where':{'name':_0x2f6858,'userProfileId':_0x46c2cd['userProfileId']},'raw':!![]})[_0x7bd2('0x28')](function(_0x44d740){if(_0x44d740&&_0x44d740[_0x7bd2('0x54')]===0x0){return db[_0x7bd2('0x55')][_0x7bd2('0x4d')]({'name':_0xadbf46[_0x7bd2('0x2a')],'resourceId':_0xadbf46['id'],'type':_0x44d740[_0x7bd2('0x2a')],'sectionId':_0x44d740['id']},{})[_0x7bd2('0x28')](function(){return _0x347a8c;});}else{return _0x347a8c;}})[_0x7bd2('0x4c')](function(_0x513b6f){logger[_0x7bd2('0x29')](_0x7bd2('0x56'),_0x513b6f);throw _0x513b6f;});}return _0x347a8c;})[_0x7bd2('0x28')](respondWithResult(_0x5a1e6d,0xc9))[_0x7bd2('0x4c')](handleError(_0x5a1e6d,null));};exports[_0x7bd2('0x27')]=function(_0x404b0f,_0xdb2a6e){if(_0x404b0f[_0x7bd2('0x57')]['id']){delete _0x404b0f[_0x7bd2('0x57')]['id'];}return db[_0x7bd2('0x44')][_0x7bd2('0x4b')]({'where':{'id':_0x404b0f['params']['id']}})[_0x7bd2('0x28')](handleEntityNotFound(_0xdb2a6e,null))['then'](saveUpdates(_0x404b0f[_0x7bd2('0x57')],null))[_0x7bd2('0x28')](respondWithResult(_0xdb2a6e,null))[_0x7bd2('0x4c')](handleError(_0xdb2a6e,null));};exports[_0x7bd2('0x58')]=function(_0x4f06e6,_0x523218){var _0x39729c=_0x4f06e6[_0x7bd2('0x4a')]['id'];var _0x236c10=[];return db[_0x7bd2('0x59')][_0x7bd2('0x5a')](function(_0x511a0d){var _0x2c547e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x39729c;return db['sequelize'][_0x7bd2('0x33')](_0x2c547e,{'type':db[_0x7bd2('0x5b')][_0x7bd2('0x5c')]['SELECT'],'raw':!![],'transaction':_0x511a0d})[_0x7bd2('0x28')](function(_0x286b0f){_0x236c10=_[_0x7bd2('0x2d')](_0x286b0f,function(_0x3593ed){return Number(_0x3593ed[_0x7bd2('0x5d')]);});})[_0x7bd2('0x28')](function(){var _0x87625d=_0x7bd2('0x5e')+_0x39729c;return db[_0x7bd2('0x59')][_0x7bd2('0x33')](_0x87625d,{'type':db[_0x7bd2('0x5b')][_0x7bd2('0x5c')][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(_0x404154){var _0x361be3=_[_0x7bd2('0x2d')](_0x404154,function(_0x20b4e1){return Number(_0x20b4e1[_0x7bd2('0x60')]);});return db[_0x7bd2('0x61')][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'VoiceQueueId':{'$in':_0x361be3}},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){var _0x4e5d69=_0x7bd2('0x62')+_0x39729c;return db['sequelize'][_0x7bd2('0x33')](_0x4e5d69,{'type':db[_0x7bd2('0x5b')][_0x7bd2('0x5c')][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(_0x31d7af){var _0x51132e=_[_0x7bd2('0x2d')](_0x31d7af,function(_0x4283c4){return Number(_0x4283c4['MailQueueId']);});return db['UserMailQueue'][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'MailQueueId':{'$in':_0x51132e}},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){var _0x1e9c0a='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x39729c;return db[_0x7bd2('0x59')]['query'](_0x1e9c0a,{'type':db[_0x7bd2('0x5b')]['QueryTypes'][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})['then'](function(_0x318b6f){var _0x46d95f=_[_0x7bd2('0x2d')](_0x318b6f,function(_0x590085){return Number(_0x590085[_0x7bd2('0x63')]);});return db[_0x7bd2('0x64')][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'SmsQueueId':{'$in':_0x46d95f}},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){var _0x178dd3='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x39729c;return db['sequelize'][_0x7bd2('0x33')](_0x178dd3,{'type':db[_0x7bd2('0x5b')][_0x7bd2('0x5c')][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})['then'](function(_0x46dc95){var _0x3d2266=_['map'](_0x46dc95,function(_0x445005){return Number(_0x445005[_0x7bd2('0x65')]);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x236c10},'ChatQueueId':{'$in':_0x3d2266}},'transaction':_0x511a0d});})['then'](function(){var _0x433f88='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x39729c;return db['sequelize'][_0x7bd2('0x33')](_0x433f88,{'type':db[_0x7bd2('0x5b')]['QueryTypes'][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(_0x52e719){var _0x197cff=_[_0x7bd2('0x2d')](_0x52e719,function(_0x524c16){return Number(_0x524c16[_0x7bd2('0x66')]);});return db[_0x7bd2('0x67')][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'FaxQueueId':{'$in':_0x197cff}},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){var _0x520057=_0x7bd2('0x68')+_0x39729c;return db[_0x7bd2('0x59')][_0x7bd2('0x33')](_0x520057,{'type':db[_0x7bd2('0x5b')][_0x7bd2('0x5c')][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(_0x41a55c){var _0x4be306=_['map'](_0x41a55c,function(_0x3802ff){return Number(_0x3802ff[_0x7bd2('0x69')]);});return db[_0x7bd2('0x6a')][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'OpenchannelQueueId':{'$in':_0x4be306}},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){var _0x34f141=_0x7bd2('0x6b')+_0x39729c;return db[_0x7bd2('0x59')][_0x7bd2('0x33')](_0x34f141,{'type':db['Sequelize'][_0x7bd2('0x5c')][_0x7bd2('0x5f')],'raw':!![],'transaction':_0x511a0d});})['then'](function(_0x4a8062){var _0x362682=_[_0x7bd2('0x2d')](_0x4a8062,function(_0x5be99b){return Number(_0x5be99b['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x236c10},'WhatsappQueueId':{'$in':_0x362682}},'transaction':_0x511a0d});})['then'](function(){return db[_0x7bd2('0x6c')][_0x7bd2('0x4b')]({'where':{'TeamId':_0x39729c}});})[_0x7bd2('0x28')](function(_0x1c3d83){if(_0x1c3d83===null){return;}return db[_0x7bd2('0x6d')][_0x7bd2('0x58')]({'where':{'UserId':{'$in':_0x236c10},'VoicePrefixId':_0x1c3d83['VoicePrefixId']},'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(){return db[_0x7bd2('0x44')]['destroy']({'where':{'id':_0x39729c},'cascade':!![],'transaction':_0x511a0d});})[_0x7bd2('0x28')](function(_0x39bd83){if(_0x39bd83===0x0){_0x523218['sendStatus'](0x194);}else{return db[_0x7bd2('0x55')][_0x7bd2('0x58')]({'where':{'type':_0x7bd2('0x52'),'resourceId':_0x39729c},'cascade':!![],'transaction':_0x511a0d})[_0x7bd2('0x28')](function(){_0x523218[_0x7bd2('0x1c')](0xcc)[_0x7bd2('0x1b')]();});}})[_0x7bd2('0x4c')](function(_0x28f65a){_0x523218[_0x7bd2('0x1c')](0x1f4)[_0x7bd2('0x2b')](_0x28f65a);});});};exports[_0x7bd2('0x6e')]=function(_0x1fe47c,_0x3b4a35,_0x5ec8f1){return db['Team'][_0x7bd2('0x6f')]({'where':{'id':_0x1fe47c[_0x7bd2('0x4a')]['id']}})[_0x7bd2('0x28')](handleEntityNotFound(_0x3b4a35,null))[_0x7bd2('0x28')](function(_0x5f4fb6){if(!_0x1fe47c[_0x7bd2('0x33')][_0x7bd2('0x70')]||!utils[_0x7bd2('0x71')](_0x1fe47c[_0x7bd2('0x33')]['channel'])){throw new db['Sequelize'][(_0x7bd2('0x72'))]('Unknown\x20channel');}var _0x410b85={};var _0x4658cd={};_0x4658cd[_0x7bd2('0x32')]=_[_0x7bd2('0x34')](db[_['capitalize'](_0x1fe47c[_0x7bd2('0x33')]['channel']['toLowerCase']())+'Queue'][_0x7bd2('0x2e')]);_0x4658cd[_0x7bd2('0x33')]=_[_0x7bd2('0x34')](_0x1fe47c[_0x7bd2('0x33')]);_0x4658cd['filters']=_[_0x7bd2('0x37')](_0x4658cd[_0x7bd2('0x32')],_0x4658cd[_0x7bd2('0x33')]);_0x410b85[_0x7bd2('0x36')]=_['intersection'](_0x4658cd[_0x7bd2('0x32')],qs[_0x7bd2('0x38')](_0x1fe47c['query']['fields']));_0x410b85['attributes']=_0x410b85['attributes']['length']?_0x410b85[_0x7bd2('0x36')]:_0x4658cd[_0x7bd2('0x32')];_0x410b85[_0x7bd2('0x20')]=qs[_0x7bd2('0x20')](_0x1fe47c[_0x7bd2('0x33')]['limit']);_0x410b85[_0x7bd2('0x1e')]=qs[_0x7bd2('0x1e')](_0x1fe47c[_0x7bd2('0x33')]['offset']);_0x410b85[_0x7bd2('0x3c')]=qs[_0x7bd2('0x3d')](_0x1fe47c[_0x7bd2('0x33')]['sort']);_0x410b85[_0x7bd2('0x3e')]=qs[_0x7bd2('0x35')](_[_0x7bd2('0x3f')](_0x1fe47c[_0x7bd2('0x33')],_0x4658cd[_0x7bd2('0x35')]));_0x410b85=_['merge']({},_0x410b85,_0x1fe47c[_0x7bd2('0x43')]);return _0x5f4fb6[_0x7bd2('0x51')+_[_0x7bd2('0x73')](_0x1fe47c[_0x7bd2('0x33')][_0x7bd2('0x70')][_0x7bd2('0x74')]())+_0x7bd2('0x75')](_0x410b85);})[_0x7bd2('0x28')](respondWithResult(_0x3b4a35,null))[_0x7bd2('0x4c')](handleError(_0x3b4a35,null));};exports['addQueues']=function(_0x146b76,_0x111e99,_0x53a887){return db['Team'][_0x7bd2('0x6f')]({'where':{'id':_0x146b76[_0x7bd2('0x4a')]['id']}})[_0x7bd2('0x28')](function(_0x2b900b){if(_0x2b900b){if(!_0x146b76[_0x7bd2('0x57')][_0x7bd2('0x70')]||!utils[_0x7bd2('0x71')](_0x146b76[_0x7bd2('0x57')][_0x7bd2('0x70')])){throw new db[(_0x7bd2('0x5b'))][(_0x7bd2('0x72'))](_0x7bd2('0x76'));}return _0x2b900b[_0x7bd2('0x77')+_[_0x7bd2('0x73')](_0x146b76[_0x7bd2('0x57')][_0x7bd2('0x70')][_0x7bd2('0x74')]())+_0x7bd2('0x75')](_0x146b76[_0x7bd2('0x57')][_0x7bd2('0x78')]);}return null;})['then'](handleEntityNotFound(_0x111e99,null))[_0x7bd2('0x28')](respondWithStatusCode(_0x111e99,null))[_0x7bd2('0x4c')](handleError(_0x111e99,null));};exports[_0x7bd2('0x79')]=function(_0x29aedd,_0x269792,_0x4ea828){return db['Team']['findOne']({'where':{'id':_0x29aedd[_0x7bd2('0x4a')]['id']}})['then'](function(_0x348a15){if(_0x348a15){if(!_0x29aedd[_0x7bd2('0x33')][_0x7bd2('0x70')]||!utils[_0x7bd2('0x71')](_0x29aedd[_0x7bd2('0x33')][_0x7bd2('0x70')])){throw new db['Sequelize'][(_0x7bd2('0x72'))](_0x7bd2('0x76'));}return _0x348a15[_0x7bd2('0x7a')+_[_0x7bd2('0x73')](_0x29aedd[_0x7bd2('0x33')]['channel'][_0x7bd2('0x74')]())+_0x7bd2('0x75')](_0x29aedd[_0x7bd2('0x33')][_0x7bd2('0x78')]);}return null;})[_0x7bd2('0x28')](handleEntityNotFound(_0x269792,null))[_0x7bd2('0x28')](respondWithStatusCode(_0x269792,null))[_0x7bd2('0x4c')](handleError(_0x269792,null));};exports[_0x7bd2('0x7b')]=function(_0x32616c,_0x541494){var _0x2176c3=_[_0x7bd2('0x7c')](_0x32616c[_0x7bd2('0x57')][_0x7bd2('0x78')])?_0x32616c[_0x7bd2('0x57')]['ids']:[_0x32616c[_0x7bd2('0x57')]['ids']];var _0x3a252a=_0x32616c[_0x7bd2('0x4a')]['id'];return db[_0x7bd2('0x44')][_0x7bd2('0x4b')]({'where':{'id':_0x3a252a}})['then'](handleEntityNotFound(_0x541494,null))['then'](function(_0x3bb241){if(_0x3bb241){var _0x30f6f2=[_0x7bd2('0x7d'),_0x7bd2('0x7e'),'Mail',_0x7bd2('0x7f'),_0x7bd2('0x80'),'Openchannel',_0x7bd2('0x81')];return db[_0x7bd2('0x59')][_0x7bd2('0x5a')](function(_0x593575){var _0x4e5424=_['map'](_0x30f6f2,function(_0x558544){var _0x170801={'attributes':['id','name']};if(_0x558544===_0x7bd2('0x7d')){_0x170801[_0x7bd2('0x82')]={'attributes':[_0x7bd2('0x83')]};}return _0x3bb241[_0x7bd2('0x51')+_0x558544+'Queues'](_0x170801)[_0x7bd2('0x28')](function(_0x5ddb6e){var _0x5d97f3=_['map'](_0x5ddb6e,function(_0x858137){var _0x2a9dbc=_[_0x7bd2('0x2d')](_0x2176c3,function(_0x186ba1){var _0x18b0e0={'where':{'UserId':_0x186ba1,[_0x558544+'QueueId']:_0x858137['id']},'transaction':_0x593575};if(_0x558544===_0x7bd2('0x7d')){_0x18b0e0['defaults']={'penalty':_0x858137['TeamVoiceQueue'][_0x7bd2('0x83')]};}return db[_0x7bd2('0x84')+_0x558544+_0x7bd2('0x85')][_0x7bd2('0x86')](_0x18b0e0)['then'](function(){socket[_0x7bd2('0x87')](_0x7bd2('0x4e')+_0x558544+_0x7bd2('0x88'),{'UserId':_0x186ba1,[_0x558544+_0x7bd2('0x89')]:_0x858137['id']});if(_0x558544!==_0x7bd2('0x7d')){return;}return db[_0x7bd2('0x84')][_0x7bd2('0x47')]({'where':{'id':_0x2176c3,'online':0x1},'attributes':['id','name',_0x7bd2('0x8a'),'voicePause',_0x7bd2('0x8b')],'raw':!![]})[_0x7bd2('0x28')](function(_0x29cb10){var _0x14be7d=_['map'](_0x29cb10,function(_0x14c9c1){return db[_0x7bd2('0x8c')][_0x7bd2('0x8d')]({'membername':_0x14c9c1['name'],'UserId':_0x14c9c1['id'],'queue_name':_0x858137[_0x7bd2('0x2a')],'VoiceQueueId':_0x858137['id'],'interface':_[_0x7bd2('0x8e')](_0x14c9c1[_0x7bd2('0x8b')])?util[_0x7bd2('0x8f')](_0x7bd2('0x90'),_0x14c9c1[_0x7bd2('0x2a')]):_0x14c9c1['interface'],'paused':_0x14c9c1[_0x7bd2('0x91')]||![],'penalty':_0x858137['TeamVoiceQueue'][_0x7bd2('0x83')]},{'transaction':_0x593575});});return Promise['all'](_0x14be7d);});});});return Promise[_0x7bd2('0x92')](_0x2a9dbc);});return Promise[_0x7bd2('0x92')](_0x5d97f3);})[_0x7bd2('0x28')](function(){return db[_0x7bd2('0x6c')][_0x7bd2('0x6f')]({'where':{'teamId':_0x3a252a}})[_0x7bd2('0x28')](function(_0x296b37){if(_0x296b37){var _0x19f9d0=_[_0x7bd2('0x2d')](_0x2176c3,function(_0x3ea8eb){db[_0x7bd2('0x6d')]['upsert']({'UserId':_0x3ea8eb,'VoicePrefixId':_0x296b37[_0x7bd2('0x93')]});});return Promise['all'](_0x19f9d0);}});});});return Promise[_0x7bd2('0x92')](_0x4e5424)[_0x7bd2('0x28')](function(){return _0x3bb241[_0x7bd2('0x7b')](_0x2176c3,{'transaction':_0x593575})[_0x7bd2('0x94')](function(_0x4173e7){return _0x4173e7;});});});}})[_0x7bd2('0x28')](respondWithResult(_0x541494,null))['catch'](handleError(_0x541494,null));};exports[_0x7bd2('0x95')]=function(_0x51a2c9,_0x460390){var _0x105cf4=_[_0x7bd2('0x7c')](_0x51a2c9['query'][_0x7bd2('0x78')])?_0x51a2c9[_0x7bd2('0x33')]['ids']:[_0x51a2c9[_0x7bd2('0x33')]['ids']];var _0x314545=_0x51a2c9[_0x7bd2('0x4a')]['id'];return db[_0x7bd2('0x44')][_0x7bd2('0x4b')]({'where':{'id':_0x314545}})[_0x7bd2('0x28')](handleEntityNotFound(_0x460390,null))['then'](function(_0x5a1e35){if(_0x5a1e35){var _0x54b734=[_0x7bd2('0x7d'),_0x7bd2('0x7e'),_0x7bd2('0x96'),_0x7bd2('0x7f'),_0x7bd2('0x80'),_0x7bd2('0x97'),_0x7bd2('0x81')];return db[_0x7bd2('0x59')][_0x7bd2('0x5a')](function(_0x434170){var _0x4b7d5e=_[_0x7bd2('0x2d')](_0x54b734,function(_0x54be93){var _0x3d2a2a={'attributes':['id',_0x7bd2('0x2a')]};return _0x5a1e35[_0x7bd2('0x51')+_0x54be93+_0x7bd2('0x75')](_0x3d2a2a)[_0x7bd2('0x28')](function(_0x4d50fe){var _0x1ecf58=_[_0x7bd2('0x2d')](_0x4d50fe,function(_0x3bf0a8){return _0x3bf0a8[_0x7bd2('0x95')](_0x105cf4,{'transaction':_0x434170})[_0x7bd2('0x28')](function(){var _0x1cd410=_[_0x7bd2('0x2d')](_0x105cf4,function(_0x47a581){socket['emit'](_0x7bd2('0x4e')+_0x54be93+'Queue:remove',{'UserId':Number(_0x47a581),[_0x54be93+_0x7bd2('0x89')]:_0x3bf0a8['id']});if(_0x54be93!==_0x7bd2('0x7d')){return;}return db[_0x7bd2('0x8c')][_0x7bd2('0x58')]({'where':{'VoiceQueueId':_0x3bf0a8['id'],'UserId':_0x47a581},'transaction':_0x434170});});return Promise['all'](_0x1cd410);});});return Promise[_0x7bd2('0x92')](_0x1ecf58);});});return Promise[_0x7bd2('0x92')](_0x4b7d5e)[_0x7bd2('0x28')](function(){return _0x5a1e35[_0x7bd2('0x95')](_0x105cf4,{'transaction':_0x434170});})[_0x7bd2('0x28')](function(){return db['TeamVoicePrefix'][_0x7bd2('0x6f')]({'where':{'teamId':_0x314545}})[_0x7bd2('0x28')](function(_0xb8fa19){if(_0xb8fa19){var _0x50e0da=_[_0x7bd2('0x2d')](_0x105cf4,function(_0x4b9bf9){db[_0x7bd2('0x6d')]['destroy']({'where':{'UserId':_0x4b9bf9,'VoicePrefixId':_0xb8fa19[_0x7bd2('0x93')]}});});return Promise['all'](_0x50e0da);}});});});}})[_0x7bd2('0x28')](respondWithStatusCode(_0x460390,null))[_0x7bd2('0x4c')](handleError(_0x460390,null));};exports[_0x7bd2('0x98')]=function(_0xd9a8d9,_0x32a267,_0x5d04ff){var _0x3e66d7={};var _0x4d1226={};var _0x255a7f;var _0x467c8f;return db[_0x7bd2('0x44')][_0x7bd2('0x6f')]({'where':{'id':_0xd9a8d9[_0x7bd2('0x4a')]['id']}})[_0x7bd2('0x28')](handleEntityNotFound(_0x32a267,null))['then'](function(_0x178313){if(_0x178313){_0x255a7f=_0x178313;_0x4d1226[_0x7bd2('0x32')]=_[_0x7bd2('0x34')](db[_0x7bd2('0x84')]['rawAttributes']);_0x4d1226[_0x7bd2('0x33')]=_[_0x7bd2('0x34')](_0xd9a8d9[_0x7bd2('0x33')]);_0x4d1226[_0x7bd2('0x35')]=_[_0x7bd2('0x37')](_0x4d1226[_0x7bd2('0x32')],_0x4d1226[_0x7bd2('0x33')]);_0x3e66d7[_0x7bd2('0x36')]=_['intersection'](_0x4d1226['model'],qs[_0x7bd2('0x38')](_0xd9a8d9['query'][_0x7bd2('0x38')]));_0x3e66d7[_0x7bd2('0x36')]=_0x3e66d7[_0x7bd2('0x36')]['length']?_0x3e66d7['attributes']:_0x4d1226[_0x7bd2('0x32')];_0x3e66d7[_0x7bd2('0x3c')]=qs[_0x7bd2('0x3d')](_0xd9a8d9['query'][_0x7bd2('0x3d')]);_0x3e66d7['where']=qs[_0x7bd2('0x35')](_[_0x7bd2('0x3f')](_0xd9a8d9[_0x7bd2('0x33')],_0x4d1226['filters']));if(_0xd9a8d9[_0x7bd2('0x33')][_0x7bd2('0x40')]){_0x3e66d7[_0x7bd2('0x3e')]=_['merge'](_0x3e66d7[_0x7bd2('0x3e')],{'$or':_[_0x7bd2('0x2d')](_0x3e66d7[_0x7bd2('0x36')],function(_0x1b68d2){var _0x3eb2af={};_0x3eb2af[_0x1b68d2]={'$like':'%'+_0xd9a8d9[_0x7bd2('0x33')]['filter']+'%'};return _0x3eb2af;})});}_0x3e66d7=_['merge']({},_0x3e66d7,_0xd9a8d9[_0x7bd2('0x43')]);return _0x255a7f[_0x7bd2('0x98')](_0x3e66d7);}})['then'](function(_0x1fd9d3){if(_0x1fd9d3){_0x467c8f=_0x1fd9d3[_0x7bd2('0x39')];if(!_0xd9a8d9[_0x7bd2('0x33')][_0x7bd2('0x3a')](_0x7bd2('0x3b'))){_0x3e66d7[_0x7bd2('0x20')]=qs[_0x7bd2('0x20')](_0xd9a8d9['query'][_0x7bd2('0x20')]);_0x3e66d7[_0x7bd2('0x1e')]=qs['offset'](_0xd9a8d9[_0x7bd2('0x33')][_0x7bd2('0x1e')]);}return _0x255a7f[_0x7bd2('0x98')](_0x3e66d7);}})[_0x7bd2('0x28')](function(_0x16a394){if(_0x16a394){return _0x16a394?{'count':_0x467c8f,'rows':_0x16a394}:null;}})[_0x7bd2('0x28')](respondWithResult(_0x32a267,null))['catch'](handleError(_0x32a267,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f33ff42..e81165f 100644 --- a/server/api/team/team.events.js +++ b/server/api/team/team.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ec4=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2ad003,_0x2d4962){var _0x4cdf67=function(_0x3159e0){while(--_0x3159e0){_0x2ad003['push'](_0x2ad003['shift']());}};_0x4cdf67(++_0x2d4962);}(_0x1ec4,0x6e));var _0x41ec=function(_0x54520c,_0x53843f){_0x54520c=_0x54520c-0x0;var _0x327812=_0x1ec4[_0x54520c];return _0x327812;};'use strict';var EventEmitter=require(_0x41ec('0x0'));var Team=require(_0x41ec('0x1'))['db'][_0x41ec('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x41ec('0x3')](0x0);var events={'afterCreate':_0x41ec('0x4'),'afterUpdate':_0x41ec('0x5'),'afterDestroy':_0x41ec('0x6')};function emitEvent(_0x56b18c){return function(_0x299da8,_0x4e3f4b,_0x34045a){TeamEvents[_0x41ec('0x7')](_0x56b18c+':'+_0x299da8['id'],_0x299da8);TeamEvents[_0x41ec('0x7')](_0x56b18c,_0x299da8);_0x34045a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x41ec('0x8')](e,emitEvent(event));}}module[_0x41ec('0x9')]=TeamEvents; \ No newline at end of file +var _0x4521=['exports','../../mysqldb','Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x4521,0xb5));var _0x1452=function(_0x3e4a68,_0x5f1131){_0x3e4a68=_0x3e4a68-0x0;var _0x57db76=_0x4521[_0x3e4a68];return _0x57db76;};'use strict';var EventEmitter=require('events');var Team=require(_0x1452('0x0'))['db'][_0x1452('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1452('0x2')](0x0);var events={'afterCreate':_0x1452('0x3'),'afterUpdate':'update','afterDestroy':_0x1452('0x4')};function emitEvent(_0x424946){return function(_0x38752c,_0x58fab1,_0xc0f20e){TeamEvents[_0x1452('0x5')](_0x424946+':'+_0x38752c['id'],_0x38752c);TeamEvents[_0x1452('0x5')](_0x424946,_0x38752c);_0xc0f20e(null);};}for(var e in events){if(events[_0x1452('0x6')](e)){var event=events[e];Team[_0x1452('0x7')](e,emitEvent(event));}}module[_0x1452('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1cb8f9b..b42cea1 100644 --- a/server/api/team/team.model.js +++ b/server/api/team/team.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24f9=['Sms','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team','Fax','Mail','Openchannel'];(function(_0x56e0e8,_0x16ef91){var _0x2dab50=function(_0x4fe720){while(--_0x4fe720){_0x56e0e8['push'](_0x56e0e8['shift']());}};_0x2dab50(++_0x16ef91);}(_0x24f9,0x135));var _0x924f=function(_0x4cb8fe,_0x14ac27){_0x4cb8fe=_0x4cb8fe-0x0;var _0x48cc90=_0x24f9[_0x4cb8fe];return _0x48cc90;};'use strict';var _=require(_0x924f('0x0'));var attributes=require(_0x924f('0x1'));function getQueuesByChannel(_0x597d5d,_0xd05375){var _0x21dbc5=_0x924f('0x2')+_0xd05375+_0x924f('0x3');return _0x597d5d[_0x21dbc5]()[_0x924f('0x4')](function(_0x5ae867){return _[_0x924f('0x5')](_0x5ae867,function(_0x1535bf){_0x1535bf[_0x924f('0x6')](_0x924f('0x7'),_0xd05375);return _0x1535bf;});})[_0x924f('0x8')](function(_0x57ac3e){throw _0x57ac3e;});}module[_0x924f('0x9')]=function(_0x1460ed){return _0x1460ed[_0x924f('0xa')](_0x924f('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x12c853=this;var _0x5d488b=['Chat',_0x924f('0xc'),_0x924f('0xd'),_0x924f('0xe'),_0x924f('0xf'),'Voice','Whatsapp'];return Promise[_0x924f('0x10')]()[_0x924f('0x4')](function(){var _0x43f13f=_[_0x924f('0x5')](_0x5d488b,function(_0x315d0b){return getQueuesByChannel(_0x12c853,_0x315d0b);});return Promise[_0x924f('0x11')](_0x43f13f);})[_0x924f('0x8')](function(_0x49a135){throw _0x49a135;});}}});}; \ No newline at end of file +var _0x7650=['Chat','Openchannel','Sms','Voice','Whatsapp','all','lodash','get','then','map','setDataValue','channel','catch','exports','define','Team'];(function(_0x57e2bb,_0x30e387){var _0x156275=function(_0x4114ea){while(--_0x4114ea){_0x57e2bb['push'](_0x57e2bb['shift']());}};_0x156275(++_0x30e387);}(_0x7650,0xc6));var _0x0765=function(_0x40e2ac,_0x38bf16){_0x40e2ac=_0x40e2ac-0x0;var _0x3aeb49=_0x7650[_0x40e2ac];return _0x3aeb49;};'use strict';var _=require(_0x0765('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x4d5638,_0x16408b){var _0x835a68=_0x0765('0x1')+_0x16408b+'Queues';return _0x4d5638[_0x835a68]()[_0x0765('0x2')](function(_0x17f59e){return _[_0x0765('0x3')](_0x17f59e,function(_0x238c29){_0x238c29[_0x0765('0x4')](_0x0765('0x5'),_0x16408b);return _0x238c29;});})[_0x0765('0x6')](function(_0x54bccf){throw _0x54bccf;});}module[_0x0765('0x7')]=function(_0x5b26dd){return _0x5b26dd[_0x0765('0x8')](_0x0765('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x59c050=this;var _0x693927=[_0x0765('0xa'),'Fax','Mail',_0x0765('0xb'),_0x0765('0xc'),_0x0765('0xd'),_0x0765('0xe')];return Promise['resolve']()[_0x0765('0x2')](function(){var _0xd5347=_['map'](_0x693927,function(_0x15b8ee){return getQueuesByChannel(_0x59c050,_0x15b8ee);});return Promise[_0x0765('0xf')](_0xd5347);})[_0x0765('0x6')](function(_0x47667c){throw _0x47667c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 36ea3b3..4b5a154 100644 --- a/server/api/team/team.rpc.js +++ b/server/api/team/team.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42a1=['Team,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','request','then','info'];(function(_0x5ce7b9,_0x3b0d8b){var _0x1f469f=function(_0x444e80){while(--_0x444e80){_0x5ce7b9['push'](_0x5ce7b9['shift']());}};_0x1f469f(++_0x3b0d8b);}(_0x42a1,0x13f));var _0x142a=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x42a1[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0x142a('0x0'));var util=require(_0x142a('0x1'));var moment=require('moment');var BPromise=require(_0x142a('0x2'));var rs=require(_0x142a('0x3'));var fs=require('fs');var Redis=require(_0x142a('0x4'));var db=require(_0x142a('0x5'))['db'];var utils=require(_0x142a('0x6'));var logger=require('../../config/logger')(_0x142a('0x7'));var config=require(_0x142a('0x8'));var jayson=require(_0x142a('0x9'));var client=jayson[_0x142a('0xa')][_0x142a('0xb')]({'port':0x232a});config[_0x142a('0xc')]=_[_0x142a('0xd')](config[_0x142a('0xc')],{'host':_0x142a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x142a('0xf'))['register'](socket);function respondWithRpcPromise(_0x31aa67,_0x67e511,_0x3693f4){return new BPromise(function(_0x3755c1,_0xa18443){return client[_0x142a('0x10')](_0x31aa67,_0x3693f4)[_0x142a('0x11')](function(_0x34b24b){logger[_0x142a('0x12')](_0x142a('0x13'),_0x67e511,_0x142a('0x14'));logger[_0x142a('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x67e511,_0x142a('0x14'),JSON['stringify'](_0x34b24b));if(_0x34b24b[_0x142a('0x16')]){if(_0x34b24b['error']['code']===0x1f4){logger[_0x142a('0x16')]('Team,\x20%s,\x20%s',_0x67e511,_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);return _0xa18443(_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);}logger['error'](_0x142a('0x13'),_0x67e511,_0x34b24b['error'][_0x142a('0x17')]);return _0x3755c1(_0x34b24b[_0x142a('0x16')][_0x142a('0x17')]);}else{logger[_0x142a('0x12')]('Team,\x20%s,\x20%s',_0x67e511,'request\x20sent');_0x3755c1(_0x34b24b[_0x142a('0x18')][_0x142a('0x17')]);}})[_0x142a('0x19')](function(_0x4f9e0d){logger[_0x142a('0x16')](_0x142a('0x13'),_0x67e511,_0x4f9e0d);_0xa18443(_0x4f9e0d);});});} \ No newline at end of file +var _0x8d40=['./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults'];(function(_0xa3ec8e,_0x35f872){var _0x388a9c=function(_0x127d05){while(--_0x127d05){_0xa3ec8e['push'](_0xa3ec8e['shift']());}};_0x388a9c(++_0x35f872);}(_0x8d40,0x1a6));var _0x08d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8d40[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x08d4('0x0'));var util=require(_0x08d4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x08d4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08d4('0x3'))['db'];var utils=require(_0x08d4('0x4'));var logger=require(_0x08d4('0x5'))('rpc');var config=require(_0x08d4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x08d4('0x7')]['http']({'port':0x232a});config[_0x08d4('0x8')]=_[_0x08d4('0x9')](config[_0x08d4('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08d4('0x8')]));require(_0x08d4('0xa'))[_0x08d4('0xb')](socket);function respondWithRpcPromise(_0x82c86c,_0x19bee2,_0xba8d51){return new BPromise(function(_0x2cd31e,_0x10abbe){return client[_0x08d4('0xc')](_0x82c86c,_0xba8d51)[_0x08d4('0xd')](function(_0x38762a){logger['info'](_0x08d4('0xe'),_0x19bee2,_0x08d4('0xf'));logger[_0x08d4('0x10')](_0x08d4('0x11'),_0x19bee2,_0x08d4('0xf'),JSON[_0x08d4('0x12')](_0x38762a));if(_0x38762a[_0x08d4('0x13')]){if(_0x38762a[_0x08d4('0x13')][_0x08d4('0x14')]===0x1f4){logger[_0x08d4('0x13')](_0x08d4('0xe'),_0x19bee2,_0x38762a[_0x08d4('0x13')][_0x08d4('0x15')]);return _0x10abbe(_0x38762a[_0x08d4('0x13')]['message']);}logger[_0x08d4('0x13')](_0x08d4('0xe'),_0x19bee2,_0x38762a[_0x08d4('0x13')]['message']);return _0x2cd31e(_0x38762a[_0x08d4('0x13')][_0x08d4('0x15')]);}else{logger[_0x08d4('0x16')](_0x08d4('0xe'),_0x19bee2,'request\x20sent');_0x2cd31e(_0x38762a['result']['message']);}})[_0x08d4('0x17')](function(_0xd8a854){logger['error'](_0x08d4('0xe'),_0x19bee2,_0xd8a854);_0x10abbe(_0xd8a854);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 137ad4d..a511dec 100644 --- a/server/api/team/team.socket.js +++ b/server/api/team/team.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a67=['emit','removeListener','register','length','team:','./team.events','update'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1a67,0x1c5));var _0x71a6=function(_0x2e47cb,_0xc4784e){_0x2e47cb=_0x2e47cb-0x0;var _0x24096b=_0x1a67[_0x2e47cb];return _0x24096b;};'use strict';var TeamEvents=require(_0x71a6('0x0'));var events=['save','remove',_0x71a6('0x1')];function createListener(_0x24e9f8,_0x4dee15){return function(_0x3b118d){_0x4dee15[_0x71a6('0x2')](_0x24e9f8,_0x3b118d);};}function removeListener(_0x4ecdba,_0x556dca){return function(){TeamEvents[_0x71a6('0x3')](_0x4ecdba,_0x556dca);};}exports[_0x71a6('0x4')]=function(_0x3a9925){for(var _0x26b8f7=0x0,_0x1b0639=events[_0x71a6('0x5')];_0x26b8f7<_0x1b0639;_0x26b8f7++){var _0x236196=events[_0x26b8f7];var _0x2da358=createListener(_0x71a6('0x6')+_0x236196,_0x3a9925);TeamEvents['on'](_0x236196,_0x2da358);}}; \ No newline at end of file +var _0x1161=['length','emit','register'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x1161,0xf7));var _0x1116=function(_0xc54486,_0x1083cc){_0xc54486=_0xc54486-0x0;var _0x542764=_0x1161[_0xc54486];return _0x542764;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove','update'];function createListener(_0x544d68,_0x153aae){return function(_0x13c53a){_0x153aae[_0x1116('0x0')](_0x544d68,_0x13c53a);};}function removeListener(_0x4ec916,_0x3bfb3c){return function(){TeamEvents['removeListener'](_0x4ec916,_0x3bfb3c);};}exports[_0x1116('0x1')]=function(_0x521a75){for(var _0x5c72c8=0x0,_0x1cdaa9=events[_0x1116('0x2')];_0x5c72c8<_0x1cdaa9;_0x5c72c8++){var _0x5dfdec=events[_0x5c72c8];var _0x1e10fe=createListener('team:'+_0x5dfdec,_0x521a75);TeamEvents['on'](_0x5dfdec,_0x1e10fe);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index fbee4a1..5c28e61 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6037=['INTEGER','sequelize','exports'];(function(_0xfa1c5d,_0x9b234c){var _0x67893e=function(_0x1749b1){while(--_0x1749b1){_0xfa1c5d['push'](_0xfa1c5d['shift']());}};_0x67893e(++_0x9b234c);}(_0x6037,0xe2));var _0x7603=function(_0x463ca7,_0x1a8fe7){_0x463ca7=_0x463ca7-0x0;var _0x358437=_0x6037[_0x463ca7];return _0x358437;};'use strict';var Sequelize=require(_0x7603('0x0'));module[_0x7603('0x1')]={'TeamId':{'type':Sequelize[_0x7603('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5271=['sequelize','INTEGER'];(function(_0x533ecf,_0x5e962d){var _0x1b4455=function(_0x199a94){while(--_0x199a94){_0x533ecf['push'](_0x533ecf['shift']());}};_0x1b4455(++_0x5e962d);}(_0x5271,0xa0));var _0x1527=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x5271[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x1527('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x1527('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x1527('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 30d0b53..189a8c1 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c19=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0c19,0xf5));var _0x90c1=function(_0x8c5c5b,_0x365527){_0x8c5c5b=_0x8c5c5b-0x0;var _0x4437ac=_0x0c19[_0x8c5c5b];return _0x4437ac;};'use strict';var _=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var logger=require(_0x90c1('0x2'))(_0x90c1('0x3'));var moment=require(_0x90c1('0x4'));var BPromise=require(_0x90c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90c1('0x6'));var rimraf=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x90c1('0x9')]=function(_0xb605b6,_0x5434a1){return _0xb605b6[_0x90c1('0xa')](_0x90c1('0xb'),attributes,{'tableName':_0x90c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x585e=['rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','path'];(function(_0x4e565c,_0xa594ee){var _0x4ad464=function(_0x202e79){while(--_0x202e79){_0x4e565c['push'](_0x4e565c['shift']());}};_0x4ad464(++_0xa594ee);}(_0x585e,0x1c2));var _0xe585=function(_0x35339c,_0x188cd4){_0x35339c=_0x35339c-0x0;var _0x5ecafd=_0x585e[_0x35339c];return _0x5ecafd;};'use strict';var _=require(_0xe585('0x0'));var util=require(_0xe585('0x1'));var logger=require(_0xe585('0x2'))(_0xe585('0x3'));var moment=require(_0xe585('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe585('0x5'));var rimraf=require(_0xe585('0x6'));var config=require('../../config/environment');var attributes=require(_0xe585('0x7'));module[_0xe585('0x8')]=function(_0x14dcd7,_0x2301bc){return _0x14dcd7[_0xe585('0x9')](_0xe585('0xa'),attributes,{'tableName':_0xe585('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 39fea2b..ee1bcfd 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1e0d88,_0x3df610){var _0x47ba9a=function(_0x274f6a){while(--_0x274f6a){_0x1e0d88['push'](_0x1e0d88['shift']());}};_0x47ba9a(++_0x3df610);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x111b29,_0x57139e){var _0x56fe78=function(_0x4a9673){while(--_0x4a9673){_0x111b29['push'](_0x111b29['shift']());}};_0x56fe78(++_0x57139e);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 716e377..27c5745 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e1b=['sequelize','exports'];(function(_0x3efd5e,_0x566606){var _0x47cf5f=function(_0x373f1a){while(--_0x373f1a){_0x3efd5e['push'](_0x3efd5e['shift']());}};_0x47cf5f(++_0x566606);}(_0x1e1b,0xfc));var _0xb1e1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x1e1b[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0xb1e1('0x0'));module[_0xb1e1('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4115=['INTEGER'];(function(_0x43cca5,_0x45b9a5){var _0x37b7bd=function(_0x57a765){while(--_0x57a765){_0x43cca5['push'](_0x43cca5['shift']());}};_0x37b7bd(++_0x45b9a5);}(_0x4115,0x1eb));var _0x5411=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x4115[_0x39e84d];return _0x1991bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5411('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 67aa8e5..f4059af 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.model.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d6a=['./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x248ce2,_0xe4e175){var _0x1b0e85=function(_0x19bb76){while(--_0x19bb76){_0x248ce2['push'](_0x248ce2['shift']());}};_0x1b0e85(++_0xe4e175);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x0d6a[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var logger=require('../../config/logger')(_0xa0d6('0x2'));var moment=require(_0xa0d6('0x3'));var BPromise=require(_0xa0d6('0x4'));var rp=require(_0xa0d6('0x5'));var fs=require('fs');var path=require(_0xa0d6('0x6'));var rimraf=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var attributes=require(_0xa0d6('0x9'));module[_0xa0d6('0xa')]=function(_0x179a70,_0x4857ce){return _0x179a70[_0xa0d6('0xb')](_0xa0d6('0xc'),attributes,{'tableName':_0xa0d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59c3=['bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x3a2398,_0x2b97a2){var _0x155edb=function(_0x5985b0){while(--_0x5985b0){_0x3a2398['push'](_0x3a2398['shift']());}};_0x155edb(++_0x2b97a2);}(_0x59c3,0x133));var _0x359c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x59c3[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var logger=require(_0x359c('0x2'))(_0x359c('0x3'));var moment=require(_0x359c('0x4'));var BPromise=require(_0x359c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x359c('0x6'));var rimraf=require(_0x359c('0x7'));var config=require(_0x359c('0x8'));var attributes=require(_0x359c('0x9'));module[_0x359c('0xa')]=function(_0x3d56a8,_0x55c899){return _0x3d56a8[_0x359c('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x359c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 91bef06..2463160 100644 --- a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js +++ b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a66=['request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','then','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3ec228,_0x2fd121){var _0x5d44bc=function(_0x1d63bc){while(--_0x1d63bc){_0x3ec228['push'](_0x3ec228['shift']());}};_0x5d44bc(++_0x2fd121);}(_0x1a66,0x102));var _0x61a6=function(_0x2b95bc,_0x2c6ae3){_0x2b95bc=_0x2b95bc-0x0;var _0x3c734b=_0x1a66[_0x2b95bc];return _0x3c734b;};'use strict';var _=require(_0x61a6('0x0'));var util=require(_0x61a6('0x1'));var moment=require(_0x61a6('0x2'));var BPromise=require(_0x61a6('0x3'));var rs=require(_0x61a6('0x4'));var fs=require('fs');var Redis=require(_0x61a6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61a6('0x6'))(_0x61a6('0x7'));var config=require(_0x61a6('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5da7,_0x357097,_0x8a2c87){return new BPromise(function(_0x50a8d8,_0x2058ce){return client['request'](_0x4b5da7,_0x8a2c87)[_0x61a6('0x9')](function(_0x7363c4){logger['info'](_0x61a6('0xa'),_0x357097,'request\x20sent');logger['debug'](_0x61a6('0xb'),_0x357097,_0x61a6('0xc'),JSON[_0x61a6('0xd')](_0x7363c4));if(_0x7363c4[_0x61a6('0xe')]){if(_0x7363c4['error'][_0x61a6('0xf')]===0x1f4){logger[_0x61a6('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x357097,_0x7363c4[_0x61a6('0xe')]['message']);return _0x2058ce(_0x7363c4[_0x61a6('0xe')]['message']);}logger['error'](_0x61a6('0xa'),_0x357097,_0x7363c4[_0x61a6('0xe')][_0x61a6('0x10')]);return _0x50a8d8(_0x7363c4[_0x61a6('0xe')][_0x61a6('0x10')]);}else{logger[_0x61a6('0x11')](_0x61a6('0xa'),_0x357097,_0x61a6('0xc'));_0x50a8d8(_0x7363c4['result'][_0x61a6('0x10')]);}})['catch'](function(_0xd232d8){logger[_0x61a6('0xe')](_0x61a6('0xa'),_0x357097,_0xd232d8);_0x2058ce(_0xd232d8);});});} \ No newline at end of file +var _0x0a70=['then','info','TeamVoiceQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0a70,0x1c2));var _0x00a7=function(_0xeafe1a,_0x4dc813){_0xeafe1a=_0xeafe1a-0x0;var _0x312ca5=_0x0a70[_0xeafe1a];return _0x312ca5;};'use strict';var _=require(_0x00a7('0x0'));var util=require(_0x00a7('0x1'));var moment=require('moment');var BPromise=require(_0x00a7('0x2'));var rs=require(_0x00a7('0x3'));var fs=require('fs');var Redis=require(_0x00a7('0x4'));var db=require(_0x00a7('0x5'))['db'];var utils=require(_0x00a7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x00a7('0x7'));var jayson=require(_0x00a7('0x8'));var client=jayson[_0x00a7('0x9')][_0x00a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x213741,_0x287868,_0x996bac){return new BPromise(function(_0x103047,_0x2a29dc){return client[_0x00a7('0xb')](_0x213741,_0x996bac)[_0x00a7('0xc')](function(_0x3a2e58){logger[_0x00a7('0xd')](_0x00a7('0xe'),_0x287868,'request\x20sent');logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x287868,'request\x20sent',JSON[_0x00a7('0xf')](_0x3a2e58));if(_0x3a2e58[_0x00a7('0x10')]){if(_0x3a2e58[_0x00a7('0x10')][_0x00a7('0x11')]===0x1f4){logger[_0x00a7('0x10')](_0x00a7('0xe'),_0x287868,_0x3a2e58['error'][_0x00a7('0x12')]);return _0x2a29dc(_0x3a2e58[_0x00a7('0x10')]['message']);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x287868,_0x3a2e58[_0x00a7('0x10')]['message']);return _0x103047(_0x3a2e58[_0x00a7('0x10')][_0x00a7('0x12')]);}else{logger[_0x00a7('0xd')](_0x00a7('0xe'),_0x287868,_0x00a7('0x13'));_0x103047(_0x3a2e58[_0x00a7('0x14')][_0x00a7('0x12')]);}})[_0x00a7('0x15')](function(_0x2b6d7c){logger[_0x00a7('0x10')](_0x00a7('0xe'),_0x287868,_0x2b6d7c);_0x2a29dc(_0x2b6d7c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e816e4e..e152f5d 100644 --- a/server/api/template/index.js +++ b/server/api/template/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['../../config/environment','get','isAuthenticated','/:id','post','create','put','exports','path','connect-timeout','../../components/interaction/service'];(function(_0xf18dbc,_0x5c8f43){var _0x107ed0=function(_0x11b227){while(--_0x11b227){_0xf18dbc['push'](_0xf18dbc['shift']());}};_0x107ed0(++_0x5c8f43);}(_0x6343,0x168));var _0x3634=function(_0x5be408,_0x53bf93){_0x5be408=_0x5be408-0x0;var _0x7d7b80=_0x6343[_0x5be408];return _0x7d7b80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3634('0x0'));var timeout=require(_0x3634('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var controller=require('./template.controller');router[_0x3634('0x4')]('/',auth[_0x3634('0x5')](),controller['index']);router[_0x3634('0x4')](_0x3634('0x6'),auth['isAuthenticated'](),controller['show']);router[_0x3634('0x7')]('/',auth[_0x3634('0x5')](),controller[_0x3634('0x8')]);router[_0x3634('0x9')](_0x3634('0x6'),auth[_0x3634('0x5')](),controller['update']);router['delete'](_0x3634('0x6'),auth[_0x3634('0x5')](),controller['destroy']);module[_0x3634('0xa')]=router; \ No newline at end of file +var _0xb1ef=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x4322ac,_0x54a827){var _0x23621b=function(_0xdee47){while(--_0xdee47){_0x4322ac['push'](_0x4322ac['shift']());}};_0x23621b(++_0x54a827);}(_0xb1ef,0x93));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var path=require('path');var timeout=require(_0xfb1e('0x2'));var express=require(_0xfb1e('0x3'));var router=express[_0xfb1e('0x4')]();var fs_extra=require(_0xfb1e('0x5'));var auth=require(_0xfb1e('0x6'));var interaction=require(_0xfb1e('0x7'));var config=require(_0xfb1e('0x8'));var controller=require(_0xfb1e('0x9'));router['get']('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xb')]);router[_0xfb1e('0xc')](_0xfb1e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfb1e('0xe')]('/',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0xf')]);router[_0xfb1e('0x10')](_0xfb1e('0xd'),auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x11')]);router[_0xfb1e('0x12')]('/:id',auth[_0xfb1e('0xa')](),controller[_0xfb1e('0x13')]);module[_0xfb1e('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 02755d5..2a6f51d 100644 --- a/server/api/template/template.attributes.js +++ b/server/api/template/template.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x076a=['STRING','TEXT','sequelize','exports'];(function(_0x48d539,_0x112cec){var _0x42a131=function(_0x2bc951){while(--_0x2bc951){_0x48d539['push'](_0x48d539['shift']());}};_0x42a131(++_0x112cec);}(_0x076a,0x19e));var _0xa076=function(_0x51b829,_0xb2594c){_0x51b829=_0x51b829-0x0;var _0x12437a=_0x076a[_0x51b829];return _0x12437a;};'use strict';var Sequelize=require(_0xa076('0x0'));module[_0xa076('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa076('0x2')]},'html':{'type':Sequelize[_0xa076('0x3')]}}; \ No newline at end of file +var _0x79d9=['TEXT','exports','STRING'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x79d9,0x1d2));var _0x979d=function(_0x54f6b4,_0x3bc100){_0x54f6b4=_0x54f6b4-0x0;var _0x25eceb=_0x79d9[_0x54f6b4];return _0x25eceb;};'use strict';var Sequelize=require('sequelize');module[_0x979d('0x0')]={'name':{'type':Sequelize[_0x979d('0x1')]},'description':{'type':Sequelize[_0x979d('0x1')]},'html':{'type':Sequelize[_0x979d('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 6983cbe..d3ad582 100644 --- a/server/api/template/template.controller.js +++ b/server/api/template/template.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe593=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Template','includeAll','findAll','rows','show','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x29ab6f,_0x2ff009){var _0x4eea0e=function(_0x339ebf){while(--_0x339ebf){_0x29ab6f['push'](_0x29ab6f['shift']());}};_0x4eea0e(++_0x2ff009);}(_0xe593,0xa9));var _0x3e59=function(_0x5515fc,_0x20084c){_0x5515fc=_0x5515fc-0x0;var _0x152b97=_0xe593[_0x5515fc];return _0x152b97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e59('0x0'));var zipdir=require(_0x3e59('0x1'));var jsonpatch=require(_0x3e59('0x2'));var rp=require(_0x3e59('0x3'));var moment=require(_0x3e59('0x4'));var BPromise=require(_0x3e59('0x5'));var Mustache=require(_0x3e59('0x6'));var util=require('util');var path=require(_0x3e59('0x7'));var sox=require(_0x3e59('0x8'));var csv=require(_0x3e59('0x9'));var ejs=require(_0x3e59('0xa'));var fs=require('fs');var fs_extra=require(_0x3e59('0xb'));var _=require(_0x3e59('0xc'));var squel=require(_0x3e59('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3e59('0xe'));var Papa=require(_0x3e59('0xf'));var Redis=require(_0x3e59('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3e59('0x11'));var as=require(_0x3e59('0x12'));var hardwareService=require(_0x3e59('0x13'));var logger=require(_0x3e59('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3e59('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e59('0x16'))['db'];function respondWithStatusCode(_0x49da6a,_0x513c25){_0x513c25=_0x513c25||0xcc;return function(_0x100d17){if(_0x100d17){return _0x49da6a[_0x3e59('0x17')](_0x513c25);}return _0x49da6a[_0x3e59('0x18')](_0x513c25)[_0x3e59('0x19')]();};}function respondWithResult(_0x256543,_0x59a3be){_0x59a3be=_0x59a3be||0xc8;return function(_0x5464f3){if(_0x5464f3){return _0x256543[_0x3e59('0x18')](_0x59a3be)[_0x3e59('0x1a')](_0x5464f3);}};}function respondWithFilteredResult(_0x3cc6ff,_0x226c67){return function(_0x7f33e2){if(_0x7f33e2){var _0x212380=typeof _0x226c67[_0x3e59('0x1b')]==='undefined'&&typeof _0x226c67[_0x3e59('0x1c')]===_0x3e59('0x1d');var _0x3a309a=_0x7f33e2[_0x3e59('0x1e')];var _0x34c0aa=_0x212380?0x0:_0x226c67[_0x3e59('0x1b')];var _0x3baf60=_0x212380?_0x7f33e2['count']:_0x226c67['offset']+_0x226c67[_0x3e59('0x1c')];var _0x290b26;if(_0x3baf60>=_0x3a309a){_0x3baf60=_0x3a309a;_0x290b26=0xc8;}else{_0x290b26=0xce;}_0x3cc6ff[_0x3e59('0x18')](_0x290b26);return _0x3cc6ff['set'](_0x3e59('0x1f'),_0x34c0aa+'-'+_0x3baf60+'/'+_0x3a309a)['json'](_0x7f33e2);}return null;};}function patchUpdates(_0x24dbda){return function(_0x454c9d){try{jsonpatch['apply'](_0x454c9d,_0x24dbda,!![]);}catch(_0x346a33){return BPromise[_0x3e59('0x20')](_0x346a33);}return _0x454c9d[_0x3e59('0x21')]();};}function saveUpdates(_0x313877,_0xcdc943){return function(_0x107680){if(_0x107680){return _0x107680[_0x3e59('0x22')](_0x313877)[_0x3e59('0x23')](function(_0x583cd8){return _0x583cd8;});}return null;};}function removeEntity(_0x23589d,_0x48539a){return function(_0x319136){if(_0x319136){return _0x319136['destroy']()[_0x3e59('0x23')](function(){var _0x151d05=_0x319136[_0x3e59('0x24')]({'plain':!![]});var _0x2d0cff='Templates';return db[_0x3e59('0x25')][_0x3e59('0x26')]({'where':{'type':_0x2d0cff,'resourceId':_0x151d05['id']}})['then'](function(){return _0x319136;});})['then'](function(){_0x23589d[_0x3e59('0x18')](0xcc)[_0x3e59('0x19')]();});}};}function handleEntityNotFound(_0x502ba5,_0x52c3d0){return function(_0x412abe){if(!_0x412abe){_0x502ba5['sendStatus'](0x194);}return _0x412abe;};}function handleError(_0x22598f,_0x2b498d){_0x2b498d=_0x2b498d||0x1f4;return function(_0x123607){logger[_0x3e59('0x27')](_0x123607['stack']);if(_0x123607[_0x3e59('0x28')]){delete _0x123607['name'];}_0x22598f[_0x3e59('0x18')](_0x2b498d)[_0x3e59('0x29')](_0x123607);};}exports[_0x3e59('0x2a')]=function(_0x4eff26,_0x11b48f){var _0x2a6594={},_0x301cda={},_0x213054={'count':0x0,'rows':[]};var _0x296bf8=_[_0x3e59('0x2b')](db['Template'][_0x3e59('0x2c')],function(_0x4ac0d1){return{'name':_0x4ac0d1[_0x3e59('0x2d')],'type':_0x4ac0d1[_0x3e59('0x2e')][_0x3e59('0x2f')]};});_0x301cda[_0x3e59('0x30')]=_[_0x3e59('0x2b')](_0x296bf8,_0x3e59('0x28'));_0x301cda[_0x3e59('0x31')]=_[_0x3e59('0x32')](_0x4eff26[_0x3e59('0x31')]);_0x301cda[_0x3e59('0x33')]=_[_0x3e59('0x34')](_0x301cda[_0x3e59('0x30')],_0x301cda['query']);_0x2a6594[_0x3e59('0x35')]=_['intersection'](_0x301cda[_0x3e59('0x30')],qs[_0x3e59('0x36')](_0x4eff26[_0x3e59('0x31')]['fields']));_0x2a6594['attributes']=_0x2a6594[_0x3e59('0x35')][_0x3e59('0x37')]?_0x2a6594[_0x3e59('0x35')]:_0x301cda[_0x3e59('0x30')];if(!_0x4eff26[_0x3e59('0x31')][_0x3e59('0x38')](_0x3e59('0x39'))){_0x2a6594[_0x3e59('0x1c')]=qs[_0x3e59('0x1c')](_0x4eff26['query']['limit']);_0x2a6594[_0x3e59('0x1b')]=qs[_0x3e59('0x1b')](_0x4eff26[_0x3e59('0x31')][_0x3e59('0x1b')]);}_0x2a6594['order']=qs['sort'](_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3a')]);_0x2a6594['where']=qs[_0x3e59('0x33')](_[_0x3e59('0x3b')](_0x4eff26[_0x3e59('0x31')],_0x301cda[_0x3e59('0x33')]),_0x296bf8);if(_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3c')]){_0x2a6594[_0x3e59('0x3d')]=_[_0x3e59('0x3e')](_0x2a6594[_0x3e59('0x3d')],{'$or':_['map'](_0x296bf8,function(_0x2da53b){if(_0x2da53b['type']!==_0x3e59('0x3f')){var _0x927539={};_0x927539[_0x2da53b[_0x3e59('0x28')]]={'$like':'%'+_0x4eff26[_0x3e59('0x31')][_0x3e59('0x3c')]+'%'};return _0x927539;}})});}_0x2a6594=_['merge']({},_0x2a6594,_0x4eff26[_0x3e59('0x40')]);var _0x97c9fb={'where':_0x2a6594['where']};return db[_0x3e59('0x41')][_0x3e59('0x1e')](_0x97c9fb)[_0x3e59('0x23')](function(_0x26dae9){_0x213054[_0x3e59('0x1e')]=_0x26dae9;if(_0x4eff26[_0x3e59('0x31')][_0x3e59('0x42')]){_0x2a6594['include']=[{'all':!![]}];}return db[_0x3e59('0x41')][_0x3e59('0x43')](_0x2a6594);})[_0x3e59('0x23')](function(_0x12b10a){_0x213054[_0x3e59('0x44')]=_0x12b10a;return _0x213054;})['then'](respondWithFilteredResult(_0x11b48f,_0x2a6594))['catch'](handleError(_0x11b48f,null));};exports[_0x3e59('0x45')]=function(_0x17dd62,_0x2629ff){var _0x398776={'raw':!![],'where':{'id':_0x17dd62['params']['id']}},_0x5e2354={};_0x5e2354[_0x3e59('0x30')]=_[_0x3e59('0x32')](db[_0x3e59('0x41')][_0x3e59('0x2c')]);_0x5e2354['query']=_[_0x3e59('0x32')](_0x17dd62[_0x3e59('0x31')]);_0x5e2354[_0x3e59('0x33')]=_[_0x3e59('0x34')](_0x5e2354[_0x3e59('0x30')],_0x5e2354['query']);_0x398776[_0x3e59('0x35')]=_[_0x3e59('0x34')](_0x5e2354[_0x3e59('0x30')],qs[_0x3e59('0x36')](_0x17dd62['query']['fields']));_0x398776['attributes']=_0x398776[_0x3e59('0x35')][_0x3e59('0x37')]?_0x398776['attributes']:_0x5e2354['model'];if(_0x17dd62['query']['includeAll']){_0x398776[_0x3e59('0x46')]=[{'all':!![]}];}_0x398776=_['merge']({},_0x398776,_0x17dd62['options']);return db[_0x3e59('0x41')]['find'](_0x398776)[_0x3e59('0x23')](handleEntityNotFound(_0x2629ff,null))['then'](respondWithResult(_0x2629ff,null))[_0x3e59('0x47')](handleError(_0x2629ff,null));};exports[_0x3e59('0x48')]=function(_0x3e9e5a,_0x465389){return db[_0x3e59('0x41')]['create'](_0x3e9e5a['body'],{})[_0x3e59('0x23')](function(_0x2d7fbe){var _0x549bf5=_0x3e9e5a[_0x3e59('0x49')][_0x3e59('0x24')]({'plain':!![]});if(!_0x549bf5)throw new Error(_0x3e59('0x4a'));if(_0x549bf5[_0x3e59('0x4b')]===_0x3e59('0x49')){var _0xe89018=_0x2d7fbe[_0x3e59('0x24')]({'plain':!![]});var _0x4aa108='Templates';return db[_0x3e59('0x4c')][_0x3e59('0x4d')]({'where':{'name':_0x4aa108,'userProfileId':_0x549bf5[_0x3e59('0x4e')]},'raw':!![]})[_0x3e59('0x23')](function(_0x134175){if(_0x134175&&_0x134175[_0x3e59('0x4f')]===0x0){return db[_0x3e59('0x25')]['create']({'name':_0xe89018[_0x3e59('0x28')],'resourceId':_0xe89018['id'],'type':_0x134175['name'],'sectionId':_0x134175['id']},{})['then'](function(){return _0x2d7fbe;});}else{return _0x2d7fbe;}})['catch'](function(_0x26a83e){logger[_0x3e59('0x27')](_0x3e59('0x50'),_0x26a83e);throw _0x26a83e;});}return _0x2d7fbe;})[_0x3e59('0x23')](respondWithResult(_0x465389,0xc9))[_0x3e59('0x47')](handleError(_0x465389,null));};exports['update']=function(_0xeeb16f,_0x41d7a3){if(_0xeeb16f[_0x3e59('0x51')]['id']){delete _0xeeb16f[_0x3e59('0x51')]['id'];}return db[_0x3e59('0x41')][_0x3e59('0x4d')]({'where':{'id':_0xeeb16f[_0x3e59('0x52')]['id']}})[_0x3e59('0x23')](handleEntityNotFound(_0x41d7a3,null))['then'](saveUpdates(_0xeeb16f[_0x3e59('0x51')],null))[_0x3e59('0x23')](respondWithResult(_0x41d7a3,null))[_0x3e59('0x47')](handleError(_0x41d7a3,null));};exports[_0x3e59('0x26')]=function(_0x57bdba,_0x45914b){return db[_0x3e59('0x41')][_0x3e59('0x4d')]({'where':{'id':_0x57bdba['params']['id']}})[_0x3e59('0x23')](handleEntityNotFound(_0x45914b,null))['then'](removeEntity(_0x45914b,null))[_0x3e59('0x47')](handleError(_0x45914b,null));}; \ No newline at end of file +var _0xe882=['offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','Templates','UserProfileResource','end','error','stack','name','send','map','Template','rawAttributes','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','type','options','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json'];(function(_0xdf535b,_0x75e584){var _0x5aac13=function(_0x356d4c){while(--_0x356d4c){_0xdf535b['push'](_0xdf535b['shift']());}};_0x5aac13(++_0x75e584);}(_0xe882,0x1e0));var _0x2e88=function(_0x5c69e1,_0x4647b3){_0x5c69e1=_0x5c69e1-0x0;var _0x80574=_0xe882[_0x5c69e1];return _0x80574;};'use strict';var emlformat=require(_0x2e88('0x0'));var rimraf=require(_0x2e88('0x1'));var zipdir=require(_0x2e88('0x2'));var jsonpatch=require(_0x2e88('0x3'));var rp=require(_0x2e88('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e88('0x5'));var path=require(_0x2e88('0x6'));var sox=require(_0x2e88('0x7'));var csv=require(_0x2e88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e88('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e88('0xa'));var jsforce=require(_0x2e88('0xb'));var deskjs=require(_0x2e88('0xc'));var toCsv=require(_0x2e88('0x8'));var querystring=require('querystring');var Papa=require(_0x2e88('0xd'));var Redis=require('ioredis');var authService=require(_0x2e88('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2e88('0xf'));var hardwareService=require(_0x2e88('0x10'));var logger=require(_0x2e88('0x11'))(_0x2e88('0x12'));var utils=require(_0x2e88('0x13'));var config=require(_0x2e88('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2e88('0x15'))['db'];function respondWithStatusCode(_0x2090ba,_0x127776){_0x127776=_0x127776||0xcc;return function(_0x571005){if(_0x571005){return _0x2090ba['sendStatus'](_0x127776);}return _0x2090ba['status'](_0x127776)['end']();};}function respondWithResult(_0x326086,_0x1c6613){_0x1c6613=_0x1c6613||0xc8;return function(_0x36c49b){if(_0x36c49b){return _0x326086[_0x2e88('0x16')](_0x1c6613)[_0x2e88('0x17')](_0x36c49b);}};}function respondWithFilteredResult(_0xc709ca,_0x592571){return function(_0x2b8699){if(_0x2b8699){var _0x5ce9cb=typeof _0x592571[_0x2e88('0x18')]===_0x2e88('0x19')&&typeof _0x592571['limit']===_0x2e88('0x19');var _0x132a99=_0x2b8699[_0x2e88('0x1a')];var _0x1c144a=_0x5ce9cb?0x0:_0x592571[_0x2e88('0x18')];var _0x3d472e=_0x5ce9cb?_0x2b8699[_0x2e88('0x1a')]:_0x592571[_0x2e88('0x18')]+_0x592571[_0x2e88('0x1b')];var _0xb467f1;if(_0x3d472e>=_0x132a99){_0x3d472e=_0x132a99;_0xb467f1=0xc8;}else{_0xb467f1=0xce;}_0xc709ca[_0x2e88('0x16')](_0xb467f1);return _0xc709ca[_0x2e88('0x1c')](_0x2e88('0x1d'),_0x1c144a+'-'+_0x3d472e+'/'+_0x132a99)[_0x2e88('0x17')](_0x2b8699);}return null;};}function patchUpdates(_0x1a7f9a){return function(_0x3f9acf){try{jsonpatch[_0x2e88('0x1e')](_0x3f9acf,_0x1a7f9a,!![]);}catch(_0x241b2d){return BPromise[_0x2e88('0x1f')](_0x241b2d);}return _0x3f9acf['save']();};}function saveUpdates(_0x4f400f,_0x5bdc71){return function(_0x17638e){if(_0x17638e){return _0x17638e[_0x2e88('0x20')](_0x4f400f)[_0x2e88('0x21')](function(_0x2f33ca){return _0x2f33ca;});}return null;};}function removeEntity(_0x219b24,_0x2b99f1){return function(_0x2e68fe){if(_0x2e68fe){return _0x2e68fe[_0x2e88('0x22')]()[_0x2e88('0x21')](function(){var _0x57f39f=_0x2e68fe['get']({'plain':!![]});var _0x45b3bd=_0x2e88('0x23');return db[_0x2e88('0x24')][_0x2e88('0x22')]({'where':{'type':_0x45b3bd,'resourceId':_0x57f39f['id']}})['then'](function(){return _0x2e68fe;});})[_0x2e88('0x21')](function(){_0x219b24[_0x2e88('0x16')](0xcc)[_0x2e88('0x25')]();});}};}function handleEntityNotFound(_0x4a6d70,_0x4bfc7f){return function(_0x336562){if(!_0x336562){_0x4a6d70['sendStatus'](0x194);}return _0x336562;};}function handleError(_0x138606,_0x4c753f){_0x4c753f=_0x4c753f||0x1f4;return function(_0x1b9c4c){logger[_0x2e88('0x26')](_0x1b9c4c[_0x2e88('0x27')]);if(_0x1b9c4c[_0x2e88('0x28')]){delete _0x1b9c4c[_0x2e88('0x28')];}_0x138606['status'](_0x4c753f)[_0x2e88('0x29')](_0x1b9c4c);};}exports['index']=function(_0x599ab0,_0x4248ed){var _0x394b72={},_0x42f35d={},_0x2d8aa2={'count':0x0,'rows':[]};var _0x55127c=_[_0x2e88('0x2a')](db[_0x2e88('0x2b')][_0x2e88('0x2c')],function(_0x499984){return{'name':_0x499984['fieldName'],'type':_0x499984['type']['key']};});_0x42f35d['model']=_[_0x2e88('0x2a')](_0x55127c,_0x2e88('0x28'));_0x42f35d[_0x2e88('0x2d')]=_['keys'](_0x599ab0[_0x2e88('0x2d')]);_0x42f35d[_0x2e88('0x2e')]=_['intersection'](_0x42f35d[_0x2e88('0x2f')],_0x42f35d[_0x2e88('0x2d')]);_0x394b72[_0x2e88('0x30')]=_[_0x2e88('0x31')](_0x42f35d[_0x2e88('0x2f')],qs[_0x2e88('0x32')](_0x599ab0['query'][_0x2e88('0x32')]));_0x394b72[_0x2e88('0x30')]=_0x394b72['attributes'][_0x2e88('0x33')]?_0x394b72[_0x2e88('0x30')]:_0x42f35d[_0x2e88('0x2f')];if(!_0x599ab0[_0x2e88('0x2d')][_0x2e88('0x34')]('nolimit')){_0x394b72[_0x2e88('0x1b')]=qs[_0x2e88('0x1b')](_0x599ab0[_0x2e88('0x2d')][_0x2e88('0x1b')]);_0x394b72[_0x2e88('0x18')]=qs[_0x2e88('0x18')](_0x599ab0[_0x2e88('0x2d')][_0x2e88('0x18')]);}_0x394b72['order']=qs[_0x2e88('0x35')](_0x599ab0['query'][_0x2e88('0x35')]);_0x394b72[_0x2e88('0x36')]=qs[_0x2e88('0x2e')](_[_0x2e88('0x37')](_0x599ab0[_0x2e88('0x2d')],_0x42f35d[_0x2e88('0x2e')]),_0x55127c);if(_0x599ab0['query']['filter']){_0x394b72[_0x2e88('0x36')]=_[_0x2e88('0x38')](_0x394b72[_0x2e88('0x36')],{'$or':_[_0x2e88('0x2a')](_0x55127c,function(_0x56cd5a){if(_0x56cd5a[_0x2e88('0x39')]!=='VIRTUAL'){var _0xa9ea4f={};_0xa9ea4f[_0x56cd5a['name']]={'$like':'%'+_0x599ab0['query']['filter']+'%'};return _0xa9ea4f;}})});}_0x394b72=_['merge']({},_0x394b72,_0x599ab0[_0x2e88('0x3a')]);var _0xe1eb73={'where':_0x394b72[_0x2e88('0x36')]};return db[_0x2e88('0x2b')]['count'](_0xe1eb73)[_0x2e88('0x21')](function(_0x243527){_0x2d8aa2['count']=_0x243527;if(_0x599ab0[_0x2e88('0x2d')]['includeAll']){_0x394b72['include']=[{'all':!![]}];}return db[_0x2e88('0x2b')]['findAll'](_0x394b72);})[_0x2e88('0x21')](function(_0x26db72){_0x2d8aa2['rows']=_0x26db72;return _0x2d8aa2;})['then'](respondWithFilteredResult(_0x4248ed,_0x394b72))[_0x2e88('0x3b')](handleError(_0x4248ed,null));};exports[_0x2e88('0x3c')]=function(_0x4c579f,_0x42bfa9){var _0x148d1f={'raw':!![],'where':{'id':_0x4c579f[_0x2e88('0x3d')]['id']}},_0x50f453={};_0x50f453[_0x2e88('0x2f')]=_[_0x2e88('0x3e')](db[_0x2e88('0x2b')][_0x2e88('0x2c')]);_0x50f453[_0x2e88('0x2d')]=_[_0x2e88('0x3e')](_0x4c579f['query']);_0x50f453[_0x2e88('0x2e')]=_[_0x2e88('0x31')](_0x50f453[_0x2e88('0x2f')],_0x50f453[_0x2e88('0x2d')]);_0x148d1f[_0x2e88('0x30')]=_[_0x2e88('0x31')](_0x50f453[_0x2e88('0x2f')],qs[_0x2e88('0x32')](_0x4c579f[_0x2e88('0x2d')]['fields']));_0x148d1f['attributes']=_0x148d1f[_0x2e88('0x30')][_0x2e88('0x33')]?_0x148d1f[_0x2e88('0x30')]:_0x50f453[_0x2e88('0x2f')];if(_0x4c579f[_0x2e88('0x2d')]['includeAll']){_0x148d1f['include']=[{'all':!![]}];}_0x148d1f=_['merge']({},_0x148d1f,_0x4c579f[_0x2e88('0x3a')]);return db[_0x2e88('0x2b')][_0x2e88('0x3f')](_0x148d1f)[_0x2e88('0x21')](handleEntityNotFound(_0x42bfa9,null))['then'](respondWithResult(_0x42bfa9,null))[_0x2e88('0x3b')](handleError(_0x42bfa9,null));};exports[_0x2e88('0x40')]=function(_0x48a950,_0x5ef82d){return db['Template'][_0x2e88('0x40')](_0x48a950['body'],{})[_0x2e88('0x21')](function(_0xb3a64b){var _0x5d9464=_0x48a950[_0x2e88('0x41')][_0x2e88('0x42')]({'plain':!![]});if(!_0x5d9464)throw new Error(_0x2e88('0x43'));if(_0x5d9464['role']===_0x2e88('0x41')){var _0x209eca=_0xb3a64b[_0x2e88('0x42')]({'plain':!![]});var _0x27804a='Templates';return db[_0x2e88('0x44')]['find']({'where':{'name':_0x27804a,'userProfileId':_0x5d9464[_0x2e88('0x45')]},'raw':!![]})[_0x2e88('0x21')](function(_0x2d0ed6){if(_0x2d0ed6&&_0x2d0ed6[_0x2e88('0x46')]===0x0){return db[_0x2e88('0x24')][_0x2e88('0x40')]({'name':_0x209eca[_0x2e88('0x28')],'resourceId':_0x209eca['id'],'type':_0x2d0ed6[_0x2e88('0x28')],'sectionId':_0x2d0ed6['id']},{})['then'](function(){return _0xb3a64b;});}else{return _0xb3a64b;}})[_0x2e88('0x3b')](function(_0x306b1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x306b1f);throw _0x306b1f;});}return _0xb3a64b;})[_0x2e88('0x21')](respondWithResult(_0x5ef82d,0xc9))[_0x2e88('0x3b')](handleError(_0x5ef82d,null));};exports['update']=function(_0x7ff76c,_0x465260){if(_0x7ff76c[_0x2e88('0x47')]['id']){delete _0x7ff76c[_0x2e88('0x47')]['id'];}return db[_0x2e88('0x2b')][_0x2e88('0x3f')]({'where':{'id':_0x7ff76c[_0x2e88('0x3d')]['id']}})[_0x2e88('0x21')](handleEntityNotFound(_0x465260,null))[_0x2e88('0x21')](saveUpdates(_0x7ff76c[_0x2e88('0x47')],null))['then'](respondWithResult(_0x465260,null))['catch'](handleError(_0x465260,null));};exports[_0x2e88('0x22')]=function(_0x25f444,_0x4de278){return db[_0x2e88('0x2b')]['find']({'where':{'id':_0x25f444[_0x2e88('0x3d')]['id']}})[_0x2e88('0x21')](handleEntityNotFound(_0x4de278,null))[_0x2e88('0x21')](removeEntity(_0x4de278,null))[_0x2e88('0x3b')](handleError(_0x4de278,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a62a025..d11c8b4 100644 --- a/server/api/template/template.model.js +++ b/server/api/template/template.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc66f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x4bcd2b,_0x1b0d63){var _0x440873=function(_0x3d5210){while(--_0x3d5210){_0x4bcd2b['push'](_0x4bcd2b['shift']());}};_0x440873(++_0x1b0d63);}(_0xc66f,0x13f));var _0xfc66=function(_0x29b919,_0x352ddc){_0x29b919=_0x29b919-0x0;var _0x5137ba=_0xc66f[_0x29b919];return _0x5137ba;};'use strict';var _=require(_0xfc66('0x0'));var util=require(_0xfc66('0x1'));var logger=require(_0xfc66('0x2'))(_0xfc66('0x3'));var moment=require(_0xfc66('0x4'));var BPromise=require(_0xfc66('0x5'));var rp=require(_0xfc66('0x6'));var fs=require('fs');var path=require(_0xfc66('0x7'));var rimraf=require(_0xfc66('0x8'));var config=require(_0xfc66('0x9'));var attributes=require(_0xfc66('0xa'));module['exports']=function(_0x2f6951,_0x8662bd){return _0x2f6951[_0xfc66('0xb')](_0xfc66('0xc'),attributes,{'tableName':_0xfc66('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1958=['../../config/logger','api','moment','bluebird','request-promise','path','./template.attributes','exports','define','tools_templates','lodash','util'];(function(_0x40be40,_0x268d8d){var _0x2312ad=function(_0x5c5ace){while(--_0x5c5ace){_0x40be40['push'](_0x40be40['shift']());}};_0x2312ad(++_0x268d8d);}(_0x1958,0xca));var _0x8195=function(_0x434010,_0x591dd5){_0x434010=_0x434010-0x0;var _0x37cab1=_0x1958[_0x434010];return _0x37cab1;};'use strict';var _=require(_0x8195('0x0'));var util=require(_0x8195('0x1'));var logger=require(_0x8195('0x2'))(_0x8195('0x3'));var moment=require(_0x8195('0x4'));var BPromise=require(_0x8195('0x5'));var rp=require(_0x8195('0x6'));var fs=require('fs');var path=require(_0x8195('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8195('0x8'));module[_0x8195('0x9')]=function(_0x28949e,_0x38cdfd){return _0x28949e[_0x8195('0xa')]('Template',attributes,{'tableName':_0x8195('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index a20c4f5..c4e3824 100644 --- a/server/api/template/template.rpc.js +++ b/server/api/template/template.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99ad=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate'];(function(_0x4419eb,_0x4f7756){var _0x38d8ef=function(_0x4ba0d5){while(--_0x4ba0d5){_0x4419eb['push'](_0x4419eb['shift']());}};_0x38d8ef(++_0x4f7756);}(_0x99ad,0x119));var _0xd99a=function(_0x3a76a1,_0x5982e1){_0x3a76a1=_0x3a76a1-0x0;var _0x319f1d=_0x99ad[_0x3a76a1];return _0x319f1d;};'use strict';var _=require(_0xd99a('0x0'));var util=require(_0xd99a('0x1'));var moment=require(_0xd99a('0x2'));var BPromise=require(_0xd99a('0x3'));var rs=require(_0xd99a('0x4'));var fs=require('fs');var Redis=require(_0xd99a('0x5'));var db=require(_0xd99a('0x6'))['db'];var utils=require(_0xd99a('0x7'));var logger=require(_0xd99a('0x8'))(_0xd99a('0x9'));var config=require('../../config/environment');var jayson=require(_0xd99a('0xa'));var client=jayson[_0xd99a('0xb')][_0xd99a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56412a,_0x5f01bb,_0x28e2f9){return new BPromise(function(_0x5064f5,_0x9c44e5){return client[_0xd99a('0xd')](_0x56412a,_0x28e2f9)[_0xd99a('0xe')](function(_0x4d1bf3){logger[_0xd99a('0xf')](_0xd99a('0x10'),_0x5f01bb,'request\x20sent');logger['debug'](_0xd99a('0x11'),_0x5f01bb,'request\x20sent',JSON[_0xd99a('0x12')](_0x4d1bf3));if(_0x4d1bf3[_0xd99a('0x13')]){if(_0x4d1bf3['error'][_0xd99a('0x14')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x5f01bb,_0x4d1bf3['error'][_0xd99a('0x15')]);return _0x9c44e5(_0x4d1bf3[_0xd99a('0x13')][_0xd99a('0x15')]);}logger[_0xd99a('0x13')]('Template,\x20%s,\x20%s',_0x5f01bb,_0x4d1bf3['error']['message']);return _0x5064f5(_0x4d1bf3['error'][_0xd99a('0x15')]);}else{logger[_0xd99a('0xf')](_0xd99a('0x10'),_0x5f01bb,_0xd99a('0x16'));_0x5064f5(_0x4d1bf3[_0xd99a('0x17')]['message']);}})['catch'](function(_0x449e60){logger[_0xd99a('0x13')](_0xd99a('0x10'),_0x5f01bb,_0x449e60);_0x9c44e5(_0x449e60);});});}exports['GetTemplate']=function(_0x25cdf5){var _0x44c302=this;return new Promise(function(_0x2879ac,_0xecea73){return db['Template'][_0xd99a('0x18')]({'raw':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5['options'][_0xd99a('0x1a')]===undefined?!![]:![]:!![],'where':_0x25cdf5['options']?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1b')]||null:null,'attributes':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1c')]||null:null,'limit':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1d')]||null:null,'include':_0x25cdf5[_0xd99a('0x19')]?_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1e')]?_[_0xd99a('0x1f')](_0x25cdf5[_0xd99a('0x19')][_0xd99a('0x1e')],function(_0x533bd0){return{'model':db[_0x533bd0[_0xd99a('0x20')]],'as':_0x533bd0['as'],'attributes':_0x533bd0[_0xd99a('0x1c')],'include':_0x533bd0[_0xd99a('0x1e')]?_[_0xd99a('0x1f')](_0x533bd0[_0xd99a('0x1e')],function(_0x42c37a){return{'model':db[_0x42c37a[_0xd99a('0x20')]],'as':_0x42c37a['as'],'attributes':_0x42c37a[_0xd99a('0x1c')],'include':_0x42c37a['include']?_[_0xd99a('0x1f')](_0x42c37a[_0xd99a('0x1e')],function(_0x1cfc05){return{'model':db[_0x1cfc05['model']],'as':_0x1cfc05['as'],'attributes':_0x1cfc05[_0xd99a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x393989){logger[_0xd99a('0xf')](_0xd99a('0x21'),_0x25cdf5);logger[_0xd99a('0x22')]('GetTemplate',_0x25cdf5,JSON['stringify'](_0x393989));_0x2879ac(_0x393989);})['catch'](function(_0x357fc1){logger[_0xd99a('0x13')](_0xd99a('0x21'),_0x357fc1[_0xd99a('0x15')],_0x25cdf5);_0xecea73(_0x44c302[_0xd99a('0x13')](0x1f4,_0x357fc1['message']));});});}; \ No newline at end of file +var _0xbb56=['code','message','result','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x36df1c,_0x5b7bd6){var _0x29cf3c=function(_0x1e7c63){while(--_0x1e7c63){_0x36df1c['push'](_0x36df1c['shift']());}};_0x29cf3c(++_0x5b7bd6);}(_0xbb56,0x158));var _0x6bb5=function(_0xd58ee8,_0x2ecdc0){_0xd58ee8=_0xd58ee8-0x0;var _0x13c09f=_0xbb56[_0xd58ee8];return _0x13c09f;};'use strict';var _=require(_0x6bb5('0x0'));var util=require('util');var moment=require(_0x6bb5('0x1'));var BPromise=require(_0x6bb5('0x2'));var rs=require(_0x6bb5('0x3'));var fs=require('fs');var Redis=require(_0x6bb5('0x4'));var db=require(_0x6bb5('0x5'))['db'];var utils=require(_0x6bb5('0x6'));var logger=require(_0x6bb5('0x7'))(_0x6bb5('0x8'));var config=require(_0x6bb5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bb5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x474155,_0x5b210e,_0x165398){return new BPromise(function(_0x3d3a04,_0x1cb895){return client[_0x6bb5('0xb')](_0x474155,_0x165398)[_0x6bb5('0xc')](function(_0x38e781){logger[_0x6bb5('0xd')](_0x6bb5('0xe'),_0x5b210e,_0x6bb5('0xf'));logger[_0x6bb5('0x10')](_0x6bb5('0x11'),_0x5b210e,_0x6bb5('0xf'),JSON['stringify'](_0x38e781));if(_0x38e781[_0x6bb5('0x12')]){if(_0x38e781[_0x6bb5('0x12')][_0x6bb5('0x13')]===0x1f4){logger['error'](_0x6bb5('0xe'),_0x5b210e,_0x38e781[_0x6bb5('0x12')][_0x6bb5('0x14')]);return _0x1cb895(_0x38e781[_0x6bb5('0x12')][_0x6bb5('0x14')]);}logger[_0x6bb5('0x12')](_0x6bb5('0xe'),_0x5b210e,_0x38e781[_0x6bb5('0x12')]['message']);return _0x3d3a04(_0x38e781[_0x6bb5('0x12')][_0x6bb5('0x14')]);}else{logger[_0x6bb5('0xd')](_0x6bb5('0xe'),_0x5b210e,_0x6bb5('0xf'));_0x3d3a04(_0x38e781[_0x6bb5('0x15')][_0x6bb5('0x14')]);}})[_0x6bb5('0x16')](function(_0x455395){logger[_0x6bb5('0x12')](_0x6bb5('0xe'),_0x5b210e,_0x455395);_0x1cb895(_0x455395);});});}exports[_0x6bb5('0x17')]=function(_0x1b2ecc){var _0x9d299=this;return new Promise(function(_0x31298a,_0x18ea50){return db[_0x6bb5('0x18')]['findAll']({'raw':_0x1b2ecc[_0x6bb5('0x19')]?_0x1b2ecc[_0x6bb5('0x19')][_0x6bb5('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b2ecc[_0x6bb5('0x19')]?_0x1b2ecc[_0x6bb5('0x19')]['where']||null:null,'attributes':_0x1b2ecc[_0x6bb5('0x19')]?_0x1b2ecc[_0x6bb5('0x19')][_0x6bb5('0x1b')]||null:null,'limit':_0x1b2ecc[_0x6bb5('0x19')]?_0x1b2ecc[_0x6bb5('0x19')][_0x6bb5('0x1c')]||null:null,'include':_0x1b2ecc['options']?_0x1b2ecc[_0x6bb5('0x19')][_0x6bb5('0x1d')]?_[_0x6bb5('0x1e')](_0x1b2ecc[_0x6bb5('0x19')][_0x6bb5('0x1d')],function(_0xcea1a9){return{'model':db[_0xcea1a9[_0x6bb5('0x1f')]],'as':_0xcea1a9['as'],'attributes':_0xcea1a9[_0x6bb5('0x1b')],'include':_0xcea1a9[_0x6bb5('0x1d')]?_[_0x6bb5('0x1e')](_0xcea1a9[_0x6bb5('0x1d')],function(_0x4ef59b){return{'model':db[_0x4ef59b[_0x6bb5('0x1f')]],'as':_0x4ef59b['as'],'attributes':_0x4ef59b[_0x6bb5('0x1b')],'include':_0x4ef59b['include']?_['map'](_0x4ef59b['include'],function(_0x2d5ccf){return{'model':db[_0x2d5ccf[_0x6bb5('0x1f')]],'as':_0x2d5ccf['as'],'attributes':_0x2d5ccf[_0x6bb5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6bb5('0xc')](function(_0x2f6fd6){logger['info'](_0x6bb5('0x17'),_0x1b2ecc);logger['debug']('GetTemplate',_0x1b2ecc,JSON[_0x6bb5('0x20')](_0x2f6fd6));_0x31298a(_0x2f6fd6);})[_0x6bb5('0x16')](function(_0x2aa086){logger[_0x6bb5('0x12')](_0x6bb5('0x17'),_0x2aa086[_0x6bb5('0x14')],_0x1b2ecc);_0x18ea50(_0x9d299[_0x6bb5('0x12')](0x1f4,_0x2aa086[_0x6bb5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index fdea3a9..ea149d4 100644 --- a/server/api/trigger/index.js +++ b/server/api/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b93=['addAction','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create'];(function(_0x1f9dc3,_0x100a49){var _0x2df719=function(_0x54d825){while(--_0x54d825){_0x1f9dc3['push'](_0x1f9dc3['shift']());}};_0x2df719(++_0x100a49);}(_0x3b93,0x92));var _0x33b9=function(_0x4354c9,_0xd26c43){_0x4354c9=_0x4354c9-0x0;var _0x4bea34=_0x3b93[_0x4354c9];return _0x4bea34;};'use strict';var multer=require('multer');var util=require(_0x33b9('0x0'));var path=require(_0x33b9('0x1'));var timeout=require(_0x33b9('0x2'));var express=require(_0x33b9('0x3'));var router=express[_0x33b9('0x4')]();var fs_extra=require(_0x33b9('0x5'));var auth=require(_0x33b9('0x6'));var interaction=require(_0x33b9('0x7'));var config=require(_0x33b9('0x8'));var controller=require(_0x33b9('0x9'));router[_0x33b9('0xa')]('/',auth['isAuthenticated'](),controller[_0x33b9('0xb')]);router[_0x33b9('0xa')](_0x33b9('0xc'),auth[_0x33b9('0xd')](),controller['show']);router[_0x33b9('0xa')](_0x33b9('0xe'),auth['isAuthenticated'](),controller[_0x33b9('0xf')]);router['get'](_0x33b9('0x10'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x11')]);router[_0x33b9('0xa')](_0x33b9('0x12'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x13')]);router[_0x33b9('0x14')]('/',auth['isAuthenticated'](),controller[_0x33b9('0x15')]);router[_0x33b9('0x14')](_0x33b9('0xe'),auth[_0x33b9('0xd')](),controller['addAllCondition']);router[_0x33b9('0x14')]('/:id/any_conditions',auth[_0x33b9('0xd')](),controller['addAnyCondition']);router[_0x33b9('0x14')](_0x33b9('0x12'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x16')]);router[_0x33b9('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x33b9('0x18')]);router[_0x33b9('0x19')](_0x33b9('0xc'),auth[_0x33b9('0xd')](),controller[_0x33b9('0x1a')]);module[_0x33b9('0x1b')]=router; \ No newline at end of file +var _0xf4a5=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post','addAction','update','delete'];(function(_0x98cfa6,_0x4513e3){var _0x3e7e7a=function(_0x3ab67b){while(--_0x3ab67b){_0x98cfa6['push'](_0x98cfa6['shift']());}};_0x3e7e7a(++_0x4513e3);}(_0xf4a5,0x1cf));var _0x5f4a=function(_0x7777c7,_0x278b61){_0x7777c7=_0x7777c7-0x0;var _0x363a0e=_0xf4a5[_0x7777c7];return _0x363a0e;};'use strict';var multer=require('multer');var util=require(_0x5f4a('0x0'));var path=require(_0x5f4a('0x1'));var timeout=require(_0x5f4a('0x2'));var express=require(_0x5f4a('0x3'));var router=express[_0x5f4a('0x4')]();var fs_extra=require(_0x5f4a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5f4a('0x6'));var config=require(_0x5f4a('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0x5f4a('0x8')](),controller[_0x5f4a('0x9')]);router[_0x5f4a('0xa')](_0x5f4a('0xb'),auth[_0x5f4a('0x8')](),controller[_0x5f4a('0xc')]);router[_0x5f4a('0xa')](_0x5f4a('0xd'),auth[_0x5f4a('0x8')](),controller[_0x5f4a('0xe')]);router[_0x5f4a('0xa')](_0x5f4a('0xf'),auth[_0x5f4a('0x8')](),controller['getAnyConditions']);router[_0x5f4a('0xa')](_0x5f4a('0x10'),auth[_0x5f4a('0x8')](),controller['getActions']);router[_0x5f4a('0x11')]('/',auth[_0x5f4a('0x8')](),controller['create']);router[_0x5f4a('0x11')](_0x5f4a('0xd'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0x5f4a('0x11')](_0x5f4a('0xf'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x5f4a('0x11')]('/:id/actions',auth[_0x5f4a('0x8')](),controller[_0x5f4a('0x12')]);router['put']('/:id',auth[_0x5f4a('0x8')](),controller[_0x5f4a('0x13')]);router[_0x5f4a('0x14')]('/:id',auth[_0x5f4a('0x8')](),controller['destroy']);module[_0x5f4a('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7c12ca1..e4a8ee0 100644 --- a/server/api/trigger/trigger.attributes.js +++ b/server/api/trigger/trigger.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc57c=['BOOLEAN','sequelize','STRING'];(function(_0x3f670b,_0x10f414){var _0x1c0978=function(_0x5c1276){while(--_0x5c1276){_0x3f670b['push'](_0x3f670b['shift']());}};_0x1c0978(++_0x10f414);}(_0xc57c,0x1a2));var _0xcc57=function(_0x2a40a6,_0x267a4a){_0x2a40a6=_0x2a40a6-0x0;var _0xcd7635=_0xc57c[_0x2a40a6];return _0xcd7635;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'name':{'type':Sequelize[_0xcc57('0x1')]},'channel':{'type':Sequelize[_0xcc57('0x1')]},'description':{'type':Sequelize[_0xcc57('0x1')]},'status':{'type':Sequelize[_0xcc57('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0f4b=['STRING','BOOLEAN'];(function(_0x4cddd4,_0x14dd59){var _0x5de8db=function(_0x249f24){while(--_0x249f24){_0x4cddd4['push'](_0x4cddd4['shift']());}};_0x5de8db(++_0x14dd59);}(_0x0f4b,0x178));var _0xb0f4=function(_0x3efd03,_0x229be1){_0x3efd03=_0x3efd03-0x0;var _0x5f3825=_0x0f4b[_0x3efd03];return _0x5f3825;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb0f4('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xb0f4('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index bf52376..6d5ff74 100644 --- a/server/api/trigger/trigger.controller.js +++ b/server/api/trigger/trigger.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34a2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','update','then','Triggers','UserProfileResource','destroy','end','error','name','send','index','map','Trigger','rawAttributes','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','hasOwnProperty','Action','getActions','eml-format'];(function(_0x2a9e6f,_0x216211){var _0x1159d1=function(_0x86dcc0){while(--_0x86dcc0){_0x2a9e6f['push'](_0x2a9e6f['shift']());}};_0x1159d1(++_0x216211);}(_0x34a2,0x10d));var _0x234a=function(_0x1d2654,_0x460aec){_0x1d2654=_0x1d2654-0x0;var _0x249fd1=_0x34a2[_0x1d2654];return _0x249fd1;};'use strict';var emlformat=require(_0x234a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x234a('0x1'));var jsonpatch=require(_0x234a('0x2'));var rp=require(_0x234a('0x3'));var moment=require(_0x234a('0x4'));var BPromise=require(_0x234a('0x5'));var Mustache=require(_0x234a('0x6'));var util=require(_0x234a('0x7'));var path=require(_0x234a('0x8'));var sox=require(_0x234a('0x9'));var csv=require(_0x234a('0xa'));var ejs=require(_0x234a('0xb'));var fs=require('fs');var fs_extra=require(_0x234a('0xc'));var _=require(_0x234a('0xd'));var squel=require(_0x234a('0xe'));var crypto=require(_0x234a('0xf'));var jsforce=require(_0x234a('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x234a('0x11'));var Redis=require('ioredis');var authService=require(_0x234a('0x12'));var qs=require(_0x234a('0x13'));var as=require(_0x234a('0x14'));var hardwareService=require(_0x234a('0x15'));var logger=require(_0x234a('0x16'))(_0x234a('0x17'));var utils=require('../../config/utils');var config=require(_0x234a('0x18'));var licenseUtil=require(_0x234a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5996aa,_0x4b2004){_0x4b2004=_0x4b2004||0xcc;return function(_0x3a0635){if(_0x3a0635){return _0x5996aa['sendStatus'](_0x4b2004);}return _0x5996aa[_0x234a('0x1a')](_0x4b2004)['end']();};}function respondWithResult(_0x253d48,_0x3739c6){_0x3739c6=_0x3739c6||0xc8;return function(_0x2a2895){if(_0x2a2895){return _0x253d48['status'](_0x3739c6)[_0x234a('0x1b')](_0x2a2895);}};}function respondWithFilteredResult(_0x562bb6,_0x5168b3){return function(_0x465fce){if(_0x465fce){var _0x22ab0e=typeof _0x5168b3[_0x234a('0x1c')]==='undefined'&&typeof _0x5168b3[_0x234a('0x1d')]===_0x234a('0x1e');var _0x56cb63=_0x465fce[_0x234a('0x1f')];var _0x487ad1=_0x22ab0e?0x0:_0x5168b3[_0x234a('0x1c')];var _0xc3e70c=_0x22ab0e?_0x465fce['count']:_0x5168b3[_0x234a('0x1c')]+_0x5168b3['limit'];var _0x220290;if(_0xc3e70c>=_0x56cb63){_0xc3e70c=_0x56cb63;_0x220290=0xc8;}else{_0x220290=0xce;}_0x562bb6['status'](_0x220290);return _0x562bb6[_0x234a('0x20')](_0x234a('0x21'),_0x487ad1+'-'+_0xc3e70c+'/'+_0x56cb63)[_0x234a('0x1b')](_0x465fce);}return null;};}function patchUpdates(_0x2698b3){return function(_0x3a7a35){try{jsonpatch['apply'](_0x3a7a35,_0x2698b3,!![]);}catch(_0x4ed050){return BPromise['reject'](_0x4ed050);}return _0x3a7a35['save']();};}function saveUpdates(_0x55f6ec,_0x398fad){return function(_0x3f9337){if(_0x3f9337){return _0x3f9337[_0x234a('0x22')](_0x55f6ec)[_0x234a('0x23')](function(_0x67ef48){return _0x67ef48;});}return null;};}function removeEntity(_0xba77e3,_0x3858f8){return function(_0x14c6ad){if(_0x14c6ad){return _0x14c6ad['destroy']()[_0x234a('0x23')](function(){var _0x1da39e=_0x14c6ad['get']({'plain':!![]});var _0x1ac724=_0x234a('0x24');return db[_0x234a('0x25')][_0x234a('0x26')]({'where':{'type':_0x1ac724,'resourceId':_0x1da39e['id']}})[_0x234a('0x23')](function(){return _0x14c6ad;});})[_0x234a('0x23')](function(){_0xba77e3['status'](0xcc)[_0x234a('0x27')]();});}};}function handleEntityNotFound(_0x2f94f5,_0xcdfca2){return function(_0x54da60){if(!_0x54da60){_0x2f94f5['sendStatus'](0x194);}return _0x54da60;};}function handleError(_0x4dab02,_0x72179c){_0x72179c=_0x72179c||0x1f4;return function(_0x18745c){logger[_0x234a('0x28')](_0x18745c['stack']);if(_0x18745c['name']){delete _0x18745c[_0x234a('0x29')];}_0x4dab02[_0x234a('0x1a')](_0x72179c)[_0x234a('0x2a')](_0x18745c);};}exports[_0x234a('0x2b')]=function(_0x466306,_0x36e0df){var _0x3fd1ba={},_0x526613={},_0x2ef875={'count':0x0,'rows':[]};var _0x3ee3c1=_[_0x234a('0x2c')](db[_0x234a('0x2d')][_0x234a('0x2e')],function(_0x1ddb0d){return{'name':_0x1ddb0d['fieldName'],'type':_0x1ddb0d['type']['key']};});_0x526613[_0x234a('0x2f')]=_[_0x234a('0x2c')](_0x3ee3c1,'name');_0x526613[_0x234a('0x30')]=_['keys'](_0x466306['query']);_0x526613[_0x234a('0x31')]=_[_0x234a('0x32')](_0x526613['model'],_0x526613['query']);_0x3fd1ba[_0x234a('0x33')]=_[_0x234a('0x32')](_0x526613[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x466306[_0x234a('0x30')][_0x234a('0x34')]));_0x3fd1ba[_0x234a('0x33')]=_0x3fd1ba[_0x234a('0x33')][_0x234a('0x35')]?_0x3fd1ba[_0x234a('0x33')]:_0x526613['model'];if(!_0x466306[_0x234a('0x30')]['hasOwnProperty'](_0x234a('0x36'))){_0x3fd1ba[_0x234a('0x1d')]=qs['limit'](_0x466306[_0x234a('0x30')][_0x234a('0x1d')]);_0x3fd1ba[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x466306[_0x234a('0x30')][_0x234a('0x1c')]);}_0x3fd1ba[_0x234a('0x37')]=qs[_0x234a('0x38')](_0x466306[_0x234a('0x30')][_0x234a('0x38')]);_0x3fd1ba['where']=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x466306[_0x234a('0x30')],_0x526613['filters']),_0x3ee3c1);if(_0x466306['query'][_0x234a('0x3a')]){_0x3fd1ba[_0x234a('0x3b')]=_['merge'](_0x3fd1ba[_0x234a('0x3b')],{'$or':_['map'](_0x3ee3c1,function(_0x4836b5){if(_0x4836b5['type']!==_0x234a('0x3c')){var _0x597184={};_0x597184[_0x4836b5[_0x234a('0x29')]]={'$like':'%'+_0x466306['query'][_0x234a('0x3a')]+'%'};return _0x597184;}})});}_0x3fd1ba=_[_0x234a('0x3d')]({},_0x3fd1ba,_0x466306[_0x234a('0x3e')]);var _0x25c187={'where':_0x3fd1ba['where']};return db[_0x234a('0x2d')]['count'](_0x25c187)['then'](function(_0x43b855){_0x2ef875[_0x234a('0x1f')]=_0x43b855;if(_0x466306[_0x234a('0x30')][_0x234a('0x3f')]){_0x3fd1ba[_0x234a('0x40')]=[{'all':!![]}];}return db[_0x234a('0x2d')][_0x234a('0x41')](_0x3fd1ba);})[_0x234a('0x23')](function(_0x3e524d){_0x2ef875['rows']=_0x3e524d;return _0x2ef875;})[_0x234a('0x23')](respondWithFilteredResult(_0x36e0df,_0x3fd1ba))['catch'](handleError(_0x36e0df,null));};exports[_0x234a('0x42')]=function(_0x2c0406,_0x5112b0){var _0x42716a={'raw':![],'where':{'id':_0x2c0406['params']['id']}},_0x572e16={};_0x572e16[_0x234a('0x2f')]=_[_0x234a('0x43')](db[_0x234a('0x2d')][_0x234a('0x2e')]);_0x572e16[_0x234a('0x30')]=_[_0x234a('0x43')](_0x2c0406[_0x234a('0x30')]);_0x572e16[_0x234a('0x31')]=_[_0x234a('0x32')](_0x572e16[_0x234a('0x2f')],_0x572e16[_0x234a('0x30')]);_0x42716a[_0x234a('0x33')]=_[_0x234a('0x32')](_0x572e16[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x2c0406[_0x234a('0x30')][_0x234a('0x34')]));_0x42716a[_0x234a('0x33')]=_0x42716a[_0x234a('0x33')][_0x234a('0x35')]?_0x42716a[_0x234a('0x33')]:_0x572e16[_0x234a('0x2f')];if(_0x2c0406[_0x234a('0x30')][_0x234a('0x3f')]){_0x42716a['include']=[{'all':!![]}];}_0x42716a=_[_0x234a('0x3d')]({},_0x42716a,_0x2c0406[_0x234a('0x3e')]);return db[_0x234a('0x2d')][_0x234a('0x44')](_0x42716a)[_0x234a('0x23')](handleEntityNotFound(_0x5112b0,null))[_0x234a('0x23')](respondWithResult(_0x5112b0,null))[_0x234a('0x45')](handleError(_0x5112b0,null));};exports[_0x234a('0x46')]=function(_0x578fd7,_0x272974){return db['Trigger'][_0x234a('0x46')](_0x578fd7[_0x234a('0x47')],{})['then'](function(_0x2cd6d0){var _0xe29568=_0x578fd7[_0x234a('0x48')][_0x234a('0x49')]({'plain':!![]});if(!_0xe29568)throw new Error(_0x234a('0x4a'));if(_0xe29568[_0x234a('0x4b')]===_0x234a('0x48')){var _0x225cfd=_0x2cd6d0[_0x234a('0x49')]({'plain':!![]});var _0x59aa80=_0x234a('0x24');return db[_0x234a('0x4c')][_0x234a('0x44')]({'where':{'name':_0x59aa80,'userProfileId':_0xe29568[_0x234a('0x4d')]},'raw':!![]})[_0x234a('0x23')](function(_0x50f83f){if(_0x50f83f&&_0x50f83f[_0x234a('0x4e')]===0x0){return db[_0x234a('0x25')][_0x234a('0x46')]({'name':_0x225cfd[_0x234a('0x29')],'resourceId':_0x225cfd['id'],'type':_0x50f83f['name'],'sectionId':_0x50f83f['id']},{})[_0x234a('0x23')](function(){return _0x2cd6d0;});}else{return _0x2cd6d0;}})[_0x234a('0x45')](function(_0x14004d){logger['error'](_0x234a('0x4f'),_0x14004d);throw _0x14004d;});}return _0x2cd6d0;})[_0x234a('0x23')](respondWithResult(_0x272974,0xc9))[_0x234a('0x45')](handleError(_0x272974,null));};exports[_0x234a('0x22')]=function(_0xffa5ff,_0xbad3e5){if(_0xffa5ff[_0x234a('0x47')]['id']){delete _0xffa5ff[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0xffa5ff['params']['id']}})[_0x234a('0x23')](handleEntityNotFound(_0xbad3e5,null))['then'](saveUpdates(_0xffa5ff[_0x234a('0x47')],null))['then'](respondWithResult(_0xbad3e5,null))[_0x234a('0x45')](handleError(_0xbad3e5,null));};exports[_0x234a('0x26')]=function(_0x359726,_0x41a45e){return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x359726[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x41a45e,null))[_0x234a('0x23')](removeEntity(_0x41a45e,null))[_0x234a('0x45')](handleError(_0x41a45e,null));};exports['addAllCondition']=function(_0x4e01a8,_0x553ab6,_0x24b9cc){if(_0x4e01a8['body']['id']){delete _0x4e01a8[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x4e01a8[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x553ab6,null))[_0x234a('0x23')](function(_0xd486b1){if(_0xd486b1){_0x4e01a8['body']['TriggerAllId']=_0xd486b1['id'];return db[_0x234a('0x51')][_0x234a('0x46')](_0x4e01a8[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x553ab6,null))['catch'](handleError(_0x553ab6,null));};exports[_0x234a('0x52')]=function(_0xe38a95,_0x1d675b,_0x1e752b){if(_0xe38a95['body']['id']){delete _0xe38a95[_0x234a('0x47')]['id'];}return db['Trigger']['find']({'where':{'id':_0xe38a95[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x1d675b,null))[_0x234a('0x23')](function(_0x537977){if(_0x537977){_0xe38a95[_0x234a('0x47')][_0x234a('0x53')]=_0x537977['id'];return db[_0x234a('0x51')][_0x234a('0x46')](_0xe38a95[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x1d675b,null))['catch'](handleError(_0x1d675b,null));};exports[_0x234a('0x54')]=function(_0x2d64f9,_0x5ed9e0,_0x5de25d){var _0x2f08c9={};var _0x575e2c={};var _0xc7e6d6;var _0x12503f;return db[_0x234a('0x2d')]['findOne']({'where':{'id':_0x2d64f9[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x5ed9e0,null))[_0x234a('0x23')](function(_0xebc853){if(_0xebc853){_0xc7e6d6=_0xebc853;_0x575e2c[_0x234a('0x2f')]=_[_0x234a('0x43')](db[_0x234a('0x51')][_0x234a('0x2e')]);_0x575e2c[_0x234a('0x30')]=_[_0x234a('0x43')](_0x2d64f9['query']);_0x575e2c[_0x234a('0x31')]=_[_0x234a('0x32')](_0x575e2c[_0x234a('0x2f')],_0x575e2c['query']);_0x2f08c9['attributes']=_[_0x234a('0x32')](_0x575e2c['model'],qs[_0x234a('0x34')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x34')]));_0x2f08c9[_0x234a('0x33')]=_0x2f08c9['attributes'][_0x234a('0x35')]?_0x2f08c9['attributes']:_0x575e2c[_0x234a('0x2f')];_0x2f08c9[_0x234a('0x37')]=qs[_0x234a('0x38')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x38')]);_0x2f08c9['where']=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x2d64f9[_0x234a('0x30')],_0x575e2c[_0x234a('0x31')]));if(_0x2d64f9[_0x234a('0x30')][_0x234a('0x3a')]){_0x2f08c9[_0x234a('0x3b')]=_[_0x234a('0x3d')](_0x2f08c9[_0x234a('0x3b')],{'$or':_[_0x234a('0x2c')](_0x2f08c9[_0x234a('0x33')],function(_0x1cc11c){var _0x2acc58={};_0x2acc58[_0x1cc11c]={'$like':'%'+_0x2d64f9[_0x234a('0x30')][_0x234a('0x3a')]+'%'};return _0x2acc58;})});}_0x2f08c9=_['merge']({},_0x2f08c9,_0x2d64f9['options']);return _0xc7e6d6['getAllConditions'](_0x2f08c9);}})['then'](function(_0x15097e){if(_0x15097e){_0x12503f=_0x15097e[_0x234a('0x35')];if(!_0x2d64f9[_0x234a('0x30')]['hasOwnProperty'](_0x234a('0x36'))){_0x2f08c9['limit']=qs[_0x234a('0x1d')](_0x2d64f9[_0x234a('0x30')]['limit']);_0x2f08c9[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x2d64f9[_0x234a('0x30')][_0x234a('0x1c')]);}return _0xc7e6d6['getAllConditions'](_0x2f08c9);}})['then'](function(_0x4b4472){if(_0x4b4472){return _0x4b4472?{'count':_0x12503f,'rows':_0x4b4472}:null;}})[_0x234a('0x23')](respondWithResult(_0x5ed9e0,null))[_0x234a('0x45')](handleError(_0x5ed9e0,null));};exports['getAnyConditions']=function(_0x464db6,_0x486c9f,_0x4d274b){var _0x598e05={};var _0x3647ae={};var _0x4f56d4;var _0x402ef6;return db[_0x234a('0x2d')][_0x234a('0x55')]({'where':{'id':_0x464db6['params']['id']}})['then'](handleEntityNotFound(_0x486c9f,null))['then'](function(_0x5c891c){if(_0x5c891c){_0x4f56d4=_0x5c891c;_0x3647ae['model']=_[_0x234a('0x43')](db[_0x234a('0x51')][_0x234a('0x2e')]);_0x3647ae[_0x234a('0x30')]=_['keys'](_0x464db6[_0x234a('0x30')]);_0x3647ae[_0x234a('0x31')]=_[_0x234a('0x32')](_0x3647ae['model'],_0x3647ae[_0x234a('0x30')]);_0x598e05[_0x234a('0x33')]=_[_0x234a('0x32')](_0x3647ae[_0x234a('0x2f')],qs[_0x234a('0x34')](_0x464db6[_0x234a('0x30')][_0x234a('0x34')]));_0x598e05[_0x234a('0x33')]=_0x598e05[_0x234a('0x33')][_0x234a('0x35')]?_0x598e05[_0x234a('0x33')]:_0x3647ae[_0x234a('0x2f')];_0x598e05[_0x234a('0x37')]=qs['sort'](_0x464db6['query']['sort']);_0x598e05[_0x234a('0x3b')]=qs['filters'](_[_0x234a('0x39')](_0x464db6[_0x234a('0x30')],_0x3647ae[_0x234a('0x31')]));if(_0x464db6[_0x234a('0x30')]['filter']){_0x598e05[_0x234a('0x3b')]=_[_0x234a('0x3d')](_0x598e05['where'],{'$or':_[_0x234a('0x2c')](_0x598e05['attributes'],function(_0xd4eea7){var _0x39c511={};_0x39c511[_0xd4eea7]={'$like':'%'+_0x464db6[_0x234a('0x30')]['filter']+'%'};return _0x39c511;})});}_0x598e05=_[_0x234a('0x3d')]({},_0x598e05,_0x464db6[_0x234a('0x3e')]);return _0x4f56d4[_0x234a('0x56')](_0x598e05);}})[_0x234a('0x23')](function(_0x1d226e){if(_0x1d226e){_0x402ef6=_0x1d226e[_0x234a('0x35')];if(!_0x464db6['query'][_0x234a('0x57')](_0x234a('0x36'))){_0x598e05[_0x234a('0x1d')]=qs[_0x234a('0x1d')](_0x464db6[_0x234a('0x30')][_0x234a('0x1d')]);_0x598e05['offset']=qs['offset'](_0x464db6[_0x234a('0x30')][_0x234a('0x1c')]);}return _0x4f56d4[_0x234a('0x56')](_0x598e05);}})[_0x234a('0x23')](function(_0xe66148){if(_0xe66148){return _0xe66148?{'count':_0x402ef6,'rows':_0xe66148}:null;}})[_0x234a('0x23')](respondWithResult(_0x486c9f,null))['catch'](handleError(_0x486c9f,null));};exports['addAction']=function(_0x4a7103,_0x77558b,_0x5e01f1){if(_0x4a7103[_0x234a('0x47')]['id']){delete _0x4a7103[_0x234a('0x47')]['id'];}return db[_0x234a('0x2d')][_0x234a('0x44')]({'where':{'id':_0x4a7103[_0x234a('0x50')]['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x77558b,null))[_0x234a('0x23')](function(_0x5a6c25){if(_0x5a6c25){_0x4a7103[_0x234a('0x47')]['TriggerId']=_0x5a6c25['id'];return db[_0x234a('0x58')][_0x234a('0x46')](_0x4a7103[_0x234a('0x47')]);}})[_0x234a('0x23')](respondWithResult(_0x77558b,null))['catch'](handleError(_0x77558b,null));};exports[_0x234a('0x59')]=function(_0x474428,_0x418e84,_0x1b2cb4){var _0x5a487d={};var _0x3e48af={};var _0x57cc85;var _0x204707;return db['Trigger']['findOne']({'where':{'id':_0x474428['params']['id']}})[_0x234a('0x23')](handleEntityNotFound(_0x418e84,null))[_0x234a('0x23')](function(_0x114992){if(_0x114992){_0x57cc85=_0x114992;_0x3e48af['model']=_['keys'](db['Action']['rawAttributes']);_0x3e48af['query']=_[_0x234a('0x43')](_0x474428[_0x234a('0x30')]);_0x3e48af[_0x234a('0x31')]=_[_0x234a('0x32')](_0x3e48af[_0x234a('0x2f')],_0x3e48af[_0x234a('0x30')]);_0x5a487d['attributes']=_[_0x234a('0x32')](_0x3e48af[_0x234a('0x2f')],qs['fields'](_0x474428[_0x234a('0x30')][_0x234a('0x34')]));_0x5a487d['attributes']=_0x5a487d['attributes'][_0x234a('0x35')]?_0x5a487d[_0x234a('0x33')]:_0x3e48af[_0x234a('0x2f')];_0x5a487d['order']=qs[_0x234a('0x38')](_0x474428['query'][_0x234a('0x38')]);_0x5a487d[_0x234a('0x3b')]=qs[_0x234a('0x31')](_[_0x234a('0x39')](_0x474428['query'],_0x3e48af['filters']));if(_0x474428['query']['filter']){_0x5a487d['where']=_[_0x234a('0x3d')](_0x5a487d[_0x234a('0x3b')],{'$or':_[_0x234a('0x2c')](_0x5a487d['attributes'],function(_0x46865a){var _0xe705df={};_0xe705df[_0x46865a]={'$like':'%'+_0x474428['query'][_0x234a('0x3a')]+'%'};return _0xe705df;})});}_0x5a487d=_[_0x234a('0x3d')]({},_0x5a487d,_0x474428[_0x234a('0x3e')]);return _0x57cc85[_0x234a('0x59')](_0x5a487d);}})['then'](function(_0x5f422b){if(_0x5f422b){_0x204707=_0x5f422b[_0x234a('0x35')];if(!_0x474428['query'][_0x234a('0x57')](_0x234a('0x36'))){_0x5a487d[_0x234a('0x1d')]=qs[_0x234a('0x1d')](_0x474428[_0x234a('0x30')][_0x234a('0x1d')]);_0x5a487d[_0x234a('0x1c')]=qs[_0x234a('0x1c')](_0x474428[_0x234a('0x30')][_0x234a('0x1c')]);}return _0x57cc85[_0x234a('0x59')](_0x5a487d);}})[_0x234a('0x23')](function(_0x4f6a07){if(_0x4f6a07){return _0x4f6a07?{'count':_0x204707,'rows':_0x4f6a07}:null;}})[_0x234a('0x23')](respondWithResult(_0x418e84,null))[_0x234a('0x45')](handleError(_0x418e84,null));}; \ No newline at end of file +var _0x2bdb=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','order','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','Triggers','end','error','stack','name','index','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','catch'];(function(_0x2f431e,_0x427aa7){var _0x297da2=function(_0x16f18c){while(--_0x16f18c){_0x2f431e['push'](_0x2f431e['shift']());}};_0x297da2(++_0x427aa7);}(_0x2bdb,0xc8));var _0xb2bd=function(_0x2b7248,_0x17b24e){_0x2b7248=_0x2b7248-0x0;var _0x418838=_0x2bdb[_0x2b7248];return _0x418838;};'use strict';var emlformat=require(_0xb2bd('0x0'));var rimraf=require(_0xb2bd('0x1'));var zipdir=require(_0xb2bd('0x2'));var jsonpatch=require(_0xb2bd('0x3'));var rp=require(_0xb2bd('0x4'));var moment=require(_0xb2bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb2bd('0x6'));var util=require(_0xb2bd('0x7'));var path=require('path');var sox=require(_0xb2bd('0x8'));var csv=require(_0xb2bd('0x9'));var ejs=require(_0xb2bd('0xa'));var fs=require('fs');var fs_extra=require(_0xb2bd('0xb'));var _=require(_0xb2bd('0xc'));var squel=require('squel');var crypto=require(_0xb2bd('0xd'));var jsforce=require(_0xb2bd('0xe'));var deskjs=require(_0xb2bd('0xf'));var toCsv=require(_0xb2bd('0x9'));var querystring=require(_0xb2bd('0x10'));var Papa=require(_0xb2bd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb2bd('0x12'));var as=require(_0xb2bd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb2bd('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5889bb,_0x28b0e0){_0x28b0e0=_0x28b0e0||0xcc;return function(_0x486bb9){if(_0x486bb9){return _0x5889bb[_0xb2bd('0x15')](_0x28b0e0);}return _0x5889bb['status'](_0x28b0e0)['end']();};}function respondWithResult(_0x563a3c,_0x2511d5){_0x2511d5=_0x2511d5||0xc8;return function(_0x158d85){if(_0x158d85){return _0x563a3c[_0xb2bd('0x16')](_0x2511d5)[_0xb2bd('0x17')](_0x158d85);}};}function respondWithFilteredResult(_0x1b5a60,_0xac5023){return function(_0x3b00ed){if(_0x3b00ed){var _0x89da86=typeof _0xac5023['offset']===_0xb2bd('0x18')&&typeof _0xac5023[_0xb2bd('0x19')]===_0xb2bd('0x18');var _0x1e20ad=_0x3b00ed[_0xb2bd('0x1a')];var _0xeb1128=_0x89da86?0x0:_0xac5023['offset'];var _0x54a5e7=_0x89da86?_0x3b00ed[_0xb2bd('0x1a')]:_0xac5023[_0xb2bd('0x1b')]+_0xac5023['limit'];var _0x454949;if(_0x54a5e7>=_0x1e20ad){_0x54a5e7=_0x1e20ad;_0x454949=0xc8;}else{_0x454949=0xce;}_0x1b5a60[_0xb2bd('0x16')](_0x454949);return _0x1b5a60[_0xb2bd('0x1c')](_0xb2bd('0x1d'),_0xeb1128+'-'+_0x54a5e7+'/'+_0x1e20ad)[_0xb2bd('0x17')](_0x3b00ed);}return null;};}function patchUpdates(_0x5b7634){return function(_0x370d5d){try{jsonpatch[_0xb2bd('0x1e')](_0x370d5d,_0x5b7634,!![]);}catch(_0x2d31c9){return BPromise[_0xb2bd('0x1f')](_0x2d31c9);}return _0x370d5d[_0xb2bd('0x20')]();};}function saveUpdates(_0x4ade88,_0xadfcff){return function(_0x2bfbdd){if(_0x2bfbdd){return _0x2bfbdd[_0xb2bd('0x21')](_0x4ade88)['then'](function(_0x3d14a3){return _0x3d14a3;});}return null;};}function removeEntity(_0x3218a2,_0x24b9a2){return function(_0x831382){if(_0x831382){return _0x831382[_0xb2bd('0x22')]()[_0xb2bd('0x23')](function(){var _0x175578=_0x831382['get']({'plain':!![]});var _0x437378=_0xb2bd('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x437378,'resourceId':_0x175578['id']}})[_0xb2bd('0x23')](function(){return _0x831382;});})[_0xb2bd('0x23')](function(){_0x3218a2['status'](0xcc)[_0xb2bd('0x25')]();});}};}function handleEntityNotFound(_0x51dd1d,_0x5b9872){return function(_0x25ef49){if(!_0x25ef49){_0x51dd1d[_0xb2bd('0x15')](0x194);}return _0x25ef49;};}function handleError(_0x2f594e,_0x1c800b){_0x1c800b=_0x1c800b||0x1f4;return function(_0x297f98){logger[_0xb2bd('0x26')](_0x297f98[_0xb2bd('0x27')]);if(_0x297f98['name']){delete _0x297f98[_0xb2bd('0x28')];}_0x2f594e['status'](_0x1c800b)['send'](_0x297f98);};}exports[_0xb2bd('0x29')]=function(_0x2b50d0,_0x2356a6){var _0x11f2d0={},_0x5bdfc5={},_0x4ea5e5={'count':0x0,'rows':[]};var _0x2120f3=_['map'](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')],function(_0x27c0fc){return{'name':_0x27c0fc[_0xb2bd('0x2c')],'type':_0x27c0fc[_0xb2bd('0x2d')][_0xb2bd('0x2e')]};});_0x5bdfc5[_0xb2bd('0x2f')]=_[_0xb2bd('0x30')](_0x2120f3,_0xb2bd('0x28'));_0x5bdfc5[_0xb2bd('0x31')]=_[_0xb2bd('0x32')](_0x2b50d0[_0xb2bd('0x31')]);_0x5bdfc5[_0xb2bd('0x33')]=_['intersection'](_0x5bdfc5['model'],_0x5bdfc5[_0xb2bd('0x31')]);_0x11f2d0[_0xb2bd('0x34')]=_[_0xb2bd('0x35')](_0x5bdfc5[_0xb2bd('0x2f')],qs[_0xb2bd('0x36')](_0x2b50d0[_0xb2bd('0x31')]['fields']));_0x11f2d0['attributes']=_0x11f2d0['attributes'][_0xb2bd('0x37')]?_0x11f2d0[_0xb2bd('0x34')]:_0x5bdfc5[_0xb2bd('0x2f')];if(!_0x2b50d0['query'][_0xb2bd('0x38')](_0xb2bd('0x39'))){_0x11f2d0['limit']=qs['limit'](_0x2b50d0['query'][_0xb2bd('0x19')]);_0x11f2d0[_0xb2bd('0x1b')]=qs[_0xb2bd('0x1b')](_0x2b50d0[_0xb2bd('0x31')][_0xb2bd('0x1b')]);}_0x11f2d0['order']=qs[_0xb2bd('0x3a')](_0x2b50d0[_0xb2bd('0x31')][_0xb2bd('0x3a')]);_0x11f2d0[_0xb2bd('0x3b')]=qs['filters'](_[_0xb2bd('0x3c')](_0x2b50d0[_0xb2bd('0x31')],_0x5bdfc5[_0xb2bd('0x33')]),_0x2120f3);if(_0x2b50d0[_0xb2bd('0x31')][_0xb2bd('0x3d')]){_0x11f2d0['where']=_['merge'](_0x11f2d0[_0xb2bd('0x3b')],{'$or':_['map'](_0x2120f3,function(_0x3796d8){if(_0x3796d8[_0xb2bd('0x2d')]!=='VIRTUAL'){var _0xa2952c={};_0xa2952c[_0x3796d8['name']]={'$like':'%'+_0x2b50d0[_0xb2bd('0x31')]['filter']+'%'};return _0xa2952c;}})});}_0x11f2d0=_['merge']({},_0x11f2d0,_0x2b50d0[_0xb2bd('0x3e')]);var _0x17ad0e={'where':_0x11f2d0['where']};return db[_0xb2bd('0x2a')]['count'](_0x17ad0e)[_0xb2bd('0x23')](function(_0x5d9bac){_0x4ea5e5[_0xb2bd('0x1a')]=_0x5d9bac;if(_0x2b50d0[_0xb2bd('0x31')][_0xb2bd('0x3f')]){_0x11f2d0[_0xb2bd('0x40')]=[{'all':!![]}];}return db[_0xb2bd('0x2a')][_0xb2bd('0x41')](_0x11f2d0);})[_0xb2bd('0x23')](function(_0x5e1ce5){_0x4ea5e5[_0xb2bd('0x42')]=_0x5e1ce5;return _0x4ea5e5;})['then'](respondWithFilteredResult(_0x2356a6,_0x11f2d0))['catch'](handleError(_0x2356a6,null));};exports['show']=function(_0x2ecf17,_0x3b365f){var _0x978f87={'raw':![],'where':{'id':_0x2ecf17[_0xb2bd('0x43')]['id']}},_0x5afb66={};_0x5afb66[_0xb2bd('0x2f')]=_['keys'](db['Trigger']['rawAttributes']);_0x5afb66[_0xb2bd('0x31')]=_['keys'](_0x2ecf17[_0xb2bd('0x31')]);_0x5afb66['filters']=_[_0xb2bd('0x35')](_0x5afb66[_0xb2bd('0x2f')],_0x5afb66['query']);_0x978f87[_0xb2bd('0x34')]=_['intersection'](_0x5afb66[_0xb2bd('0x2f')],qs[_0xb2bd('0x36')](_0x2ecf17[_0xb2bd('0x31')][_0xb2bd('0x36')]));_0x978f87['attributes']=_0x978f87[_0xb2bd('0x34')][_0xb2bd('0x37')]?_0x978f87['attributes']:_0x5afb66[_0xb2bd('0x2f')];if(_0x2ecf17[_0xb2bd('0x31')][_0xb2bd('0x3f')]){_0x978f87[_0xb2bd('0x40')]=[{'all':!![]}];}_0x978f87=_[_0xb2bd('0x44')]({},_0x978f87,_0x2ecf17[_0xb2bd('0x3e')]);return db[_0xb2bd('0x2a')][_0xb2bd('0x45')](_0x978f87)[_0xb2bd('0x23')](handleEntityNotFound(_0x3b365f,null))['then'](respondWithResult(_0x3b365f,null))['catch'](handleError(_0x3b365f,null));};exports[_0xb2bd('0x46')]=function(_0x2caeaf,_0x303c96){return db[_0xb2bd('0x2a')][_0xb2bd('0x46')](_0x2caeaf[_0xb2bd('0x47')],{})[_0xb2bd('0x23')](function(_0x14bb55){var _0x144461=_0x2caeaf[_0xb2bd('0x48')][_0xb2bd('0x49')]({'plain':!![]});if(!_0x144461)throw new Error(_0xb2bd('0x4a'));if(_0x144461['role']===_0xb2bd('0x48')){var _0x158007=_0x14bb55[_0xb2bd('0x49')]({'plain':!![]});var _0x1fc17b=_0xb2bd('0x24');return db[_0xb2bd('0x4b')][_0xb2bd('0x45')]({'where':{'name':_0x1fc17b,'userProfileId':_0x144461['userProfileId']},'raw':!![]})['then'](function(_0x119b19){if(_0x119b19&&_0x119b19[_0xb2bd('0x4c')]===0x0){return db[_0xb2bd('0x4d')]['create']({'name':_0x158007[_0xb2bd('0x28')],'resourceId':_0x158007['id'],'type':_0x119b19['name'],'sectionId':_0x119b19['id']},{})['then'](function(){return _0x14bb55;});}else{return _0x14bb55;}})[_0xb2bd('0x4e')](function(_0x11b911){logger[_0xb2bd('0x26')](_0xb2bd('0x4f'),_0x11b911);throw _0x11b911;});}return _0x14bb55;})['then'](respondWithResult(_0x303c96,0xc9))[_0xb2bd('0x4e')](handleError(_0x303c96,null));};exports[_0xb2bd('0x21')]=function(_0x5f0bc6,_0x288594){if(_0x5f0bc6[_0xb2bd('0x47')]['id']){delete _0x5f0bc6[_0xb2bd('0x47')]['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x45')]({'where':{'id':_0x5f0bc6[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x288594,null))[_0xb2bd('0x23')](saveUpdates(_0x5f0bc6[_0xb2bd('0x47')],null))[_0xb2bd('0x23')](respondWithResult(_0x288594,null))[_0xb2bd('0x4e')](handleError(_0x288594,null));};exports[_0xb2bd('0x22')]=function(_0x33de08,_0x1a855a){return db[_0xb2bd('0x2a')][_0xb2bd('0x45')]({'where':{'id':_0x33de08[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x1a855a,null))['then'](removeEntity(_0x1a855a,null))['catch'](handleError(_0x1a855a,null));};exports[_0xb2bd('0x50')]=function(_0x506ff9,_0x1a163f,_0x273d09){if(_0x506ff9['body']['id']){delete _0x506ff9[_0xb2bd('0x47')]['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x45')]({'where':{'id':_0x506ff9[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x1a163f,null))[_0xb2bd('0x23')](function(_0x361463){if(_0x361463){_0x506ff9[_0xb2bd('0x47')][_0xb2bd('0x51')]=_0x361463['id'];return db['Condition'][_0xb2bd('0x46')](_0x506ff9[_0xb2bd('0x47')]);}})[_0xb2bd('0x23')](respondWithResult(_0x1a163f,null))[_0xb2bd('0x4e')](handleError(_0x1a163f,null));};exports[_0xb2bd('0x52')]=function(_0x58705f,_0x3eb13e,_0x1015e0){if(_0x58705f['body']['id']){delete _0x58705f['body']['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x45')]({'where':{'id':_0x58705f[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x3eb13e,null))[_0xb2bd('0x23')](function(_0x4e120c){if(_0x4e120c){_0x58705f[_0xb2bd('0x47')][_0xb2bd('0x53')]=_0x4e120c['id'];return db[_0xb2bd('0x54')][_0xb2bd('0x46')](_0x58705f[_0xb2bd('0x47')]);}})['then'](respondWithResult(_0x3eb13e,null))['catch'](handleError(_0x3eb13e,null));};exports['getAllConditions']=function(_0xeefde1,_0x34dba3,_0x5234d4){var _0x368758={};var _0x504e7a={};var _0x3027fd;var _0x127365;return db[_0xb2bd('0x2a')][_0xb2bd('0x55')]({'where':{'id':_0xeefde1[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x23')](handleEntityNotFound(_0x34dba3,null))[_0xb2bd('0x23')](function(_0x418444){if(_0x418444){_0x3027fd=_0x418444;_0x504e7a[_0xb2bd('0x2f')]=_[_0xb2bd('0x32')](db[_0xb2bd('0x54')]['rawAttributes']);_0x504e7a[_0xb2bd('0x31')]=_[_0xb2bd('0x32')](_0xeefde1['query']);_0x504e7a['filters']=_[_0xb2bd('0x35')](_0x504e7a['model'],_0x504e7a[_0xb2bd('0x31')]);_0x368758[_0xb2bd('0x34')]=_['intersection'](_0x504e7a[_0xb2bd('0x2f')],qs[_0xb2bd('0x36')](_0xeefde1['query'][_0xb2bd('0x36')]));_0x368758['attributes']=_0x368758[_0xb2bd('0x34')][_0xb2bd('0x37')]?_0x368758[_0xb2bd('0x34')]:_0x504e7a[_0xb2bd('0x2f')];_0x368758[_0xb2bd('0x56')]=qs['sort'](_0xeefde1[_0xb2bd('0x31')]['sort']);_0x368758[_0xb2bd('0x3b')]=qs[_0xb2bd('0x33')](_[_0xb2bd('0x3c')](_0xeefde1[_0xb2bd('0x31')],_0x504e7a[_0xb2bd('0x33')]));if(_0xeefde1[_0xb2bd('0x31')]['filter']){_0x368758[_0xb2bd('0x3b')]=_[_0xb2bd('0x44')](_0x368758[_0xb2bd('0x3b')],{'$or':_['map'](_0x368758[_0xb2bd('0x34')],function(_0x24b589){var _0x567458={};_0x567458[_0x24b589]={'$like':'%'+_0xeefde1[_0xb2bd('0x31')][_0xb2bd('0x3d')]+'%'};return _0x567458;})});}_0x368758=_[_0xb2bd('0x44')]({},_0x368758,_0xeefde1[_0xb2bd('0x3e')]);return _0x3027fd['getAllConditions'](_0x368758);}})[_0xb2bd('0x23')](function(_0x3ba2ee){if(_0x3ba2ee){_0x127365=_0x3ba2ee[_0xb2bd('0x37')];if(!_0xeefde1['query'][_0xb2bd('0x38')](_0xb2bd('0x39'))){_0x368758[_0xb2bd('0x19')]=qs[_0xb2bd('0x19')](_0xeefde1[_0xb2bd('0x31')]['limit']);_0x368758[_0xb2bd('0x1b')]=qs[_0xb2bd('0x1b')](_0xeefde1[_0xb2bd('0x31')]['offset']);}return _0x3027fd[_0xb2bd('0x57')](_0x368758);}})[_0xb2bd('0x23')](function(_0x30f2be){if(_0x30f2be){return _0x30f2be?{'count':_0x127365,'rows':_0x30f2be}:null;}})[_0xb2bd('0x23')](respondWithResult(_0x34dba3,null))[_0xb2bd('0x4e')](handleError(_0x34dba3,null));};exports['getAnyConditions']=function(_0x353115,_0x3ecdb0,_0xcd231e){var _0x313c17={};var _0x54e378={};var _0x5259b5;var _0x30dcf3;return db['Trigger'][_0xb2bd('0x55')]({'where':{'id':_0x353115[_0xb2bd('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ecdb0,null))[_0xb2bd('0x23')](function(_0xa7a4ba){if(_0xa7a4ba){_0x5259b5=_0xa7a4ba;_0x54e378['model']=_[_0xb2bd('0x32')](db[_0xb2bd('0x54')][_0xb2bd('0x2b')]);_0x54e378[_0xb2bd('0x31')]=_[_0xb2bd('0x32')](_0x353115[_0xb2bd('0x31')]);_0x54e378[_0xb2bd('0x33')]=_[_0xb2bd('0x35')](_0x54e378[_0xb2bd('0x2f')],_0x54e378[_0xb2bd('0x31')]);_0x313c17[_0xb2bd('0x34')]=_[_0xb2bd('0x35')](_0x54e378[_0xb2bd('0x2f')],qs[_0xb2bd('0x36')](_0x353115[_0xb2bd('0x31')]['fields']));_0x313c17[_0xb2bd('0x34')]=_0x313c17[_0xb2bd('0x34')][_0xb2bd('0x37')]?_0x313c17['attributes']:_0x54e378[_0xb2bd('0x2f')];_0x313c17[_0xb2bd('0x56')]=qs[_0xb2bd('0x3a')](_0x353115['query']['sort']);_0x313c17[_0xb2bd('0x3b')]=qs['filters'](_[_0xb2bd('0x3c')](_0x353115['query'],_0x54e378[_0xb2bd('0x33')]));if(_0x353115['query'][_0xb2bd('0x3d')]){_0x313c17[_0xb2bd('0x3b')]=_[_0xb2bd('0x44')](_0x313c17['where'],{'$or':_[_0xb2bd('0x30')](_0x313c17[_0xb2bd('0x34')],function(_0x57c2a3){var _0x35684d={};_0x35684d[_0x57c2a3]={'$like':'%'+_0x353115[_0xb2bd('0x31')][_0xb2bd('0x3d')]+'%'};return _0x35684d;})});}_0x313c17=_['merge']({},_0x313c17,_0x353115[_0xb2bd('0x3e')]);return _0x5259b5[_0xb2bd('0x58')](_0x313c17);}})[_0xb2bd('0x23')](function(_0x4f5750){if(_0x4f5750){_0x30dcf3=_0x4f5750[_0xb2bd('0x37')];if(!_0x353115['query'][_0xb2bd('0x38')](_0xb2bd('0x39'))){_0x313c17['limit']=qs['limit'](_0x353115[_0xb2bd('0x31')][_0xb2bd('0x19')]);_0x313c17['offset']=qs[_0xb2bd('0x1b')](_0x353115[_0xb2bd('0x31')][_0xb2bd('0x1b')]);}return _0x5259b5[_0xb2bd('0x58')](_0x313c17);}})[_0xb2bd('0x23')](function(_0x285acc){if(_0x285acc){return _0x285acc?{'count':_0x30dcf3,'rows':_0x285acc}:null;}})[_0xb2bd('0x23')](respondWithResult(_0x3ecdb0,null))['catch'](handleError(_0x3ecdb0,null));};exports[_0xb2bd('0x59')]=function(_0x5e0654,_0x16bf1a,_0x3abcc4){if(_0x5e0654[_0xb2bd('0x47')]['id']){delete _0x5e0654['body']['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x45')]({'where':{'id':_0x5e0654[_0xb2bd('0x43')]['id']}})['then'](handleEntityNotFound(_0x16bf1a,null))[_0xb2bd('0x23')](function(_0x471d38){if(_0x471d38){_0x5e0654[_0xb2bd('0x47')][_0xb2bd('0x5a')]=_0x471d38['id'];return db[_0xb2bd('0x5b')]['create'](_0x5e0654[_0xb2bd('0x47')]);}})[_0xb2bd('0x23')](respondWithResult(_0x16bf1a,null))[_0xb2bd('0x4e')](handleError(_0x16bf1a,null));};exports['getActions']=function(_0x30fb07,_0x2aa308,_0x3e0337){var _0x29c268={};var _0x3673de={};var _0x3efbce;var _0x11c7cc;return db[_0xb2bd('0x2a')]['findOne']({'where':{'id':_0x30fb07[_0xb2bd('0x43')]['id']}})['then'](handleEntityNotFound(_0x2aa308,null))[_0xb2bd('0x23')](function(_0x572bd2){if(_0x572bd2){_0x3efbce=_0x572bd2;_0x3673de[_0xb2bd('0x2f')]=_[_0xb2bd('0x32')](db['Action']['rawAttributes']);_0x3673de['query']=_[_0xb2bd('0x32')](_0x30fb07[_0xb2bd('0x31')]);_0x3673de['filters']=_[_0xb2bd('0x35')](_0x3673de[_0xb2bd('0x2f')],_0x3673de[_0xb2bd('0x31')]);_0x29c268[_0xb2bd('0x34')]=_[_0xb2bd('0x35')](_0x3673de[_0xb2bd('0x2f')],qs[_0xb2bd('0x36')](_0x30fb07[_0xb2bd('0x31')][_0xb2bd('0x36')]));_0x29c268[_0xb2bd('0x34')]=_0x29c268[_0xb2bd('0x34')][_0xb2bd('0x37')]?_0x29c268['attributes']:_0x3673de['model'];_0x29c268['order']=qs['sort'](_0x30fb07[_0xb2bd('0x31')][_0xb2bd('0x3a')]);_0x29c268[_0xb2bd('0x3b')]=qs[_0xb2bd('0x33')](_[_0xb2bd('0x3c')](_0x30fb07['query'],_0x3673de[_0xb2bd('0x33')]));if(_0x30fb07['query']['filter']){_0x29c268[_0xb2bd('0x3b')]=_['merge'](_0x29c268[_0xb2bd('0x3b')],{'$or':_['map'](_0x29c268['attributes'],function(_0xb41f10){var _0x2d28d1={};_0x2d28d1[_0xb41f10]={'$like':'%'+_0x30fb07[_0xb2bd('0x31')]['filter']+'%'};return _0x2d28d1;})});}_0x29c268=_[_0xb2bd('0x44')]({},_0x29c268,_0x30fb07['options']);return _0x3efbce['getActions'](_0x29c268);}})[_0xb2bd('0x23')](function(_0x437155){if(_0x437155){_0x11c7cc=_0x437155[_0xb2bd('0x37')];if(!_0x30fb07[_0xb2bd('0x31')][_0xb2bd('0x38')](_0xb2bd('0x39'))){_0x29c268['limit']=qs['limit'](_0x30fb07[_0xb2bd('0x31')][_0xb2bd('0x19')]);_0x29c268[_0xb2bd('0x1b')]=qs[_0xb2bd('0x1b')](_0x30fb07[_0xb2bd('0x31')][_0xb2bd('0x1b')]);}return _0x3efbce[_0xb2bd('0x5c')](_0x29c268);}})[_0xb2bd('0x23')](function(_0x59c4de){if(_0x59c4de){return _0x59c4de?{'count':_0x11c7cc,'rows':_0x59c4de}:null;}})[_0xb2bd('0x23')](respondWithResult(_0x2aa308,null))[_0xb2bd('0x4e')](handleError(_0x2aa308,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 44d8dfc..96ef3f6 100644 --- a/server/api/trigger/trigger.model.js +++ b/server/api/trigger/trigger.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b7c=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0x8b7c,0x119));var _0xc8b7=function(_0x2af3e1,_0xb5207f){_0x2af3e1=_0x2af3e1-0x0;var _0xfa27d=_0x8b7c[_0x2af3e1];return _0xfa27d;};'use strict';var _=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var logger=require(_0xc8b7('0x2'))(_0xc8b7('0x3'));var moment=require(_0xc8b7('0x4'));var BPromise=require(_0xc8b7('0x5'));var rp=require(_0xc8b7('0x6'));var fs=require('fs');var path=require(_0xc8b7('0x7'));var rimraf=require('rimraf');var config=require(_0xc8b7('0x8'));var attributes=require(_0xc8b7('0x9'));module[_0xc8b7('0xa')]=function(_0x4a8b93,_0x256c78){return _0x4a8b93[_0xc8b7('0xb')](_0xc8b7('0xc'),attributes,{'tableName':_0xc8b7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc090=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','exports','define'];(function(_0x57e9e1,_0x129979){var _0x260b91=function(_0xb046d1){while(--_0xb046d1){_0x57e9e1['push'](_0x57e9e1['shift']());}};_0x260b91(++_0x129979);}(_0xc090,0x112));var _0x0c09=function(_0x1223e6,_0x1023c9){_0x1223e6=_0x1223e6-0x0;var _0x2ba929=_0xc090[_0x1223e6];return _0x2ba929;};'use strict';var _=require(_0x0c09('0x0'));var util=require(_0x0c09('0x1'));var logger=require(_0x0c09('0x2'))(_0x0c09('0x3'));var moment=require(_0x0c09('0x4'));var BPromise=require(_0x0c09('0x5'));var rp=require(_0x0c09('0x6'));var fs=require('fs');var path=require(_0x0c09('0x7'));var rimraf=require(_0x0c09('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c09('0x9'));module[_0x0c09('0xa')]=function(_0x4f3f48,_0x49a403){return _0x4f3f48[_0x0c09('0xb')]('Trigger',attributes,{'tableName':_0x0c09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index e4a4db5..18927df 100644 --- a/server/api/trigger/trigger.rpc.js +++ b/server/api/trigger/trigger.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ab6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','model','map','catch','ShowTrigger','find','util','moment','bluebird'];(function(_0x3ff95a,_0x2aeb82){var _0x172fd5=function(_0x424462){while(--_0x424462){_0x3ff95a['push'](_0x3ff95a['shift']());}};_0x172fd5(++_0x2aeb82);}(_0x4ab6,0x19f));var _0x64ab=function(_0x3920b4,_0x4cd07a){_0x3920b4=_0x3920b4-0x0;var _0x1ef94f=_0x4ab6[_0x3920b4];return _0x1ef94f;};'use strict';var _=require('lodash');var util=require(_0x64ab('0x0'));var moment=require(_0x64ab('0x1'));var BPromise=require(_0x64ab('0x2'));var rs=require(_0x64ab('0x3'));var fs=require('fs');var Redis=require(_0x64ab('0x4'));var db=require(_0x64ab('0x5'))['db'];var utils=require(_0x64ab('0x6'));var logger=require(_0x64ab('0x7'))(_0x64ab('0x8'));var config=require(_0x64ab('0x9'));var jayson=require(_0x64ab('0xa'));var client=jayson[_0x64ab('0xb')][_0x64ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18eb22,_0x27a53b,_0x41738c){return new BPromise(function(_0x5cb2e5,_0x44e8a8){return client[_0x64ab('0xd')](_0x18eb22,_0x41738c)[_0x64ab('0xe')](function(_0x2aabeb){logger[_0x64ab('0xf')]('Trigger,\x20%s,\x20%s',_0x27a53b,'request\x20sent');logger[_0x64ab('0x10')](_0x64ab('0x11'),_0x27a53b,_0x64ab('0x12'),JSON[_0x64ab('0x13')](_0x2aabeb));if(_0x2aabeb[_0x64ab('0x14')]){if(_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x15')]===0x1f4){logger[_0x64ab('0x14')](_0x64ab('0x16'),_0x27a53b,_0x2aabeb[_0x64ab('0x14')][_0x64ab('0x17')]);return _0x44e8a8(_0x2aabeb['error'][_0x64ab('0x17')]);}logger['error'](_0x64ab('0x16'),_0x27a53b,_0x2aabeb['error']['message']);return _0x5cb2e5(_0x2aabeb['error'][_0x64ab('0x17')]);}else{logger['info'](_0x64ab('0x16'),_0x27a53b,_0x64ab('0x12'));_0x5cb2e5(_0x2aabeb[_0x64ab('0x18')][_0x64ab('0x17')]);}})['catch'](function(_0x12cb1e){logger[_0x64ab('0x14')]('Trigger,\x20%s,\x20%s',_0x27a53b,_0x12cb1e);_0x44e8a8(_0x12cb1e);});});}exports[_0x64ab('0x19')]=function(_0x20f441){var _0x34a972=this;return new Promise(function(_0x5bf4fa,_0x27579d){return db[_0x64ab('0x1a')][_0x64ab('0x1b')]({'raw':_0x20f441['options']?_0x20f441[_0x64ab('0x1c')][_0x64ab('0x1d')]===undefined?!![]:![]:!![],'where':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')][_0x64ab('0x1e')]||null:null,'attributes':_0x20f441[_0x64ab('0x1c')]?_0x20f441['options'][_0x64ab('0x1f')]||null:null,'limit':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')]['limit']||null:null,'include':_0x20f441[_0x64ab('0x1c')]?_0x20f441[_0x64ab('0x1c')]['include']?_['map'](_0x20f441['options'][_0x64ab('0x20')],function(_0x5e3506){return{'model':db[_0x5e3506[_0x64ab('0x21')]],'as':_0x5e3506['as'],'attributes':_0x5e3506[_0x64ab('0x1f')],'include':_0x5e3506['include']?_[_0x64ab('0x22')](_0x5e3506['include'],function(_0x416f61){return{'model':db[_0x416f61['model']],'as':_0x416f61['as'],'attributes':_0x416f61[_0x64ab('0x1f')],'include':_0x416f61['include']?_['map'](_0x416f61[_0x64ab('0x20')],function(_0x566b11){return{'model':db[_0x566b11[_0x64ab('0x21')]],'as':_0x566b11['as'],'attributes':_0x566b11['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ab('0xe')](function(_0x335f86){logger[_0x64ab('0xf')]('GetTrigger',_0x20f441);logger[_0x64ab('0x10')]('GetTrigger',_0x20f441,JSON[_0x64ab('0x13')](_0x335f86));_0x5bf4fa(_0x335f86);})[_0x64ab('0x23')](function(_0xb04e8e){logger[_0x64ab('0x14')]('GetTrigger',_0xb04e8e['message'],_0x20f441);_0x27579d(_0x34a972['error'](0x1f4,_0xb04e8e['message']));});});};exports[_0x64ab('0x24')]=function(_0x52e6d8){var _0x1441b3=this;return new Promise(function(_0x2637c9,_0x2aa65d){return db['Trigger'][_0x64ab('0x25')]({'raw':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')][_0x64ab('0x1e')]||null:null,'attributes':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')]['attributes']||null:null,'include':_0x52e6d8[_0x64ab('0x1c')]?_0x52e6d8[_0x64ab('0x1c')]['include']?_[_0x64ab('0x22')](_0x52e6d8[_0x64ab('0x1c')][_0x64ab('0x20')],function(_0x583372){return{'model':db[_0x583372['model']],'as':_0x583372['as'],'attributes':_0x583372[_0x64ab('0x1f')],'include':_0x583372[_0x64ab('0x20')]?_[_0x64ab('0x22')](_0x583372['include'],function(_0xe1cf0){return{'model':db[_0xe1cf0[_0x64ab('0x21')]],'as':_0xe1cf0['as'],'attributes':_0xe1cf0[_0x64ab('0x1f')],'include':_0xe1cf0[_0x64ab('0x20')]?_[_0x64ab('0x22')](_0xe1cf0['include'],function(_0x5e2ee0){return{'model':db[_0x5e2ee0['model']],'as':_0x5e2ee0['as'],'attributes':_0x5e2ee0['attributes']};}):[]};}):[]};}):[]:[]})[_0x64ab('0xe')](function(_0x10c3d7){logger[_0x64ab('0xf')]('ShowTrigger',_0x52e6d8);logger[_0x64ab('0x10')](_0x64ab('0x24'),_0x52e6d8,JSON['stringify'](_0x10c3d7));_0x2637c9(_0x10c3d7);})[_0x64ab('0x23')](function(_0x38f48b){logger[_0x64ab('0x14')](_0x64ab('0x24'),_0x38f48b[_0x64ab('0x17')],_0x52e6d8);_0x2aa65d(_0x1441b3['error'](0x1f4,_0x38f48b['message']));});});}; \ No newline at end of file +var _0x0803=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','GetTrigger','Trigger','findAll','options','raw','attributes','include','map','model','stringify','catch','ShowTrigger','where','moment'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0x0803,0x13f));var _0x3080=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0803[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3080('0x0'));var BPromise=require(_0x3080('0x1'));var rs=require(_0x3080('0x2'));var fs=require('fs');var Redis=require(_0x3080('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3080('0x4'));var logger=require(_0x3080('0x5'))(_0x3080('0x6'));var config=require(_0x3080('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3080('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a2f3c,_0x49e387,_0x5226ea){return new BPromise(function(_0x1e26b3,_0x2e1c05){return client[_0x3080('0x9')](_0x5a2f3c,_0x5226ea)[_0x3080('0xa')](function(_0x2a9f0d){logger['info'](_0x3080('0xb'),_0x49e387,_0x3080('0xc'));logger[_0x3080('0xd')](_0x3080('0xe'),_0x49e387,_0x3080('0xc'),JSON['stringify'](_0x2a9f0d));if(_0x2a9f0d[_0x3080('0xf')]){if(_0x2a9f0d[_0x3080('0xf')][_0x3080('0x10')]===0x1f4){logger[_0x3080('0xf')](_0x3080('0xb'),_0x49e387,_0x2a9f0d[_0x3080('0xf')][_0x3080('0x11')]);return _0x2e1c05(_0x2a9f0d['error'][_0x3080('0x11')]);}logger[_0x3080('0xf')]('Trigger,\x20%s,\x20%s',_0x49e387,_0x2a9f0d[_0x3080('0xf')][_0x3080('0x11')]);return _0x1e26b3(_0x2a9f0d[_0x3080('0xf')][_0x3080('0x11')]);}else{logger[_0x3080('0x12')](_0x3080('0xb'),_0x49e387,_0x3080('0xc'));_0x1e26b3(_0x2a9f0d['result'][_0x3080('0x11')]);}})['catch'](function(_0x4bfcb9){logger[_0x3080('0xf')](_0x3080('0xb'),_0x49e387,_0x4bfcb9);_0x2e1c05(_0x4bfcb9);});});}exports[_0x3080('0x13')]=function(_0x56878b){var _0x967be=this;return new Promise(function(_0x2fa37c,_0x2244d1){return db[_0x3080('0x14')][_0x3080('0x15')]({'raw':_0x56878b[_0x3080('0x16')]?_0x56878b[_0x3080('0x16')][_0x3080('0x17')]===undefined?!![]:![]:!![],'where':_0x56878b[_0x3080('0x16')]?_0x56878b[_0x3080('0x16')]['where']||null:null,'attributes':_0x56878b[_0x3080('0x16')]?_0x56878b['options'][_0x3080('0x18')]||null:null,'limit':_0x56878b[_0x3080('0x16')]?_0x56878b[_0x3080('0x16')]['limit']||null:null,'include':_0x56878b[_0x3080('0x16')]?_0x56878b[_0x3080('0x16')][_0x3080('0x19')]?_[_0x3080('0x1a')](_0x56878b[_0x3080('0x16')]['include'],function(_0x37645d){return{'model':db[_0x37645d['model']],'as':_0x37645d['as'],'attributes':_0x37645d['attributes'],'include':_0x37645d[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x37645d[_0x3080('0x19')],function(_0x35446b){return{'model':db[_0x35446b['model']],'as':_0x35446b['as'],'attributes':_0x35446b[_0x3080('0x18')],'include':_0x35446b[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x35446b['include'],function(_0x578a20){return{'model':db[_0x578a20[_0x3080('0x1b')]],'as':_0x578a20['as'],'attributes':_0x578a20[_0x3080('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xba8865){logger[_0x3080('0x12')](_0x3080('0x13'),_0x56878b);logger[_0x3080('0xd')]('GetTrigger',_0x56878b,JSON[_0x3080('0x1c')](_0xba8865));_0x2fa37c(_0xba8865);})[_0x3080('0x1d')](function(_0x4f0aa1){logger[_0x3080('0xf')](_0x3080('0x13'),_0x4f0aa1[_0x3080('0x11')],_0x56878b);_0x2244d1(_0x967be[_0x3080('0xf')](0x1f4,_0x4f0aa1[_0x3080('0x11')]));});});};exports[_0x3080('0x1e')]=function(_0x4a1524){var _0x3a6593=this;return new Promise(function(_0x2902bc,_0x5e65eb){return db[_0x3080('0x14')]['find']({'raw':_0x4a1524[_0x3080('0x16')]?_0x4a1524[_0x3080('0x16')][_0x3080('0x17')]===undefined?!![]:![]:!![],'where':_0x4a1524[_0x3080('0x16')]?_0x4a1524['options'][_0x3080('0x1f')]||null:null,'attributes':_0x4a1524['options']?_0x4a1524['options'][_0x3080('0x18')]||null:null,'include':_0x4a1524[_0x3080('0x16')]?_0x4a1524[_0x3080('0x16')]['include']?_[_0x3080('0x1a')](_0x4a1524[_0x3080('0x16')]['include'],function(_0x1ce17d){return{'model':db[_0x1ce17d['model']],'as':_0x1ce17d['as'],'attributes':_0x1ce17d[_0x3080('0x18')],'include':_0x1ce17d[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x1ce17d['include'],function(_0x47ac5f){return{'model':db[_0x47ac5f[_0x3080('0x1b')]],'as':_0x47ac5f['as'],'attributes':_0x47ac5f['attributes'],'include':_0x47ac5f[_0x3080('0x19')]?_[_0x3080('0x1a')](_0x47ac5f[_0x3080('0x19')],function(_0x4132ce){return{'model':db[_0x4132ce[_0x3080('0x1b')]],'as':_0x4132ce['as'],'attributes':_0x4132ce[_0x3080('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3080('0xa')](function(_0x324b7e){logger[_0x3080('0x12')](_0x3080('0x1e'),_0x4a1524);logger['debug'](_0x3080('0x1e'),_0x4a1524,JSON[_0x3080('0x1c')](_0x324b7e));_0x2902bc(_0x324b7e);})[_0x3080('0x1d')](function(_0x24b344){logger['error'](_0x3080('0x1e'),_0x24b344['message'],_0x4a1524);_0x5e65eb(_0x3a6593['error'](0x1f4,_0x24b344['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8cd05ab..ef08d0f 100644 --- a/server/api/trunk/index.js +++ b/server/api/trunk/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47f2=['get','isAuthenticated','show','post','/:id/clone','clone','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47f2,0x186));var _0x247f=function(_0x5dd217,_0x32307f){_0x5dd217=_0x5dd217-0x0;var _0x31bb18=_0x47f2[_0x5dd217];return _0x31bb18;};'use strict';var multer=require(_0x247f('0x0'));var util=require(_0x247f('0x1'));var path=require('path');var timeout=require(_0x247f('0x2'));var express=require(_0x247f('0x3'));var router=express[_0x247f('0x4')]();var fs_extra=require(_0x247f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x247f('0x6'));var config=require(_0x247f('0x7'));var controller=require(_0x247f('0x8'));router[_0x247f('0x9')]('/',auth[_0x247f('0xa')](),controller['index']);router[_0x247f('0x9')]('/:id',auth[_0x247f('0xa')](),controller[_0x247f('0xb')]);router[_0x247f('0xc')](_0x247f('0xd'),auth[_0x247f('0xa')](),controller[_0x247f('0xe')]);router[_0x247f('0xc')]('/',auth[_0x247f('0xa')](),controller[_0x247f('0xf')]);router[_0x247f('0x10')]('/:id',auth[_0x247f('0xa')](),controller['update']);router[_0x247f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x247f('0x12')]=router; \ No newline at end of file +var _0xd891=['/:id/clone','create','destroy','exports','multer','util','Router','fs-extra','get','isAuthenticated','/:id','show','post'];(function(_0xbd693,_0x384d44){var _0xdf5fda=function(_0x2c0492){while(--_0x2c0492){_0xbd693['push'](_0xbd693['shift']());}};_0xdf5fda(++_0x384d44);}(_0xd891,0x12f));var _0x1d89=function(_0x1244c5,_0x2f7daf){_0x1244c5=_0x1244c5-0x0;var _0xffe3a9=_0xd891[_0x1244c5];return _0xffe3a9;};'use strict';var multer=require(_0x1d89('0x0'));var util=require(_0x1d89('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1d89('0x2')]();var fs_extra=require(_0x1d89('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x1d89('0x4')]('/',auth[_0x1d89('0x5')](),controller['index']);router[_0x1d89('0x4')](_0x1d89('0x6'),auth[_0x1d89('0x5')](),controller[_0x1d89('0x7')]);router[_0x1d89('0x8')](_0x1d89('0x9'),auth[_0x1d89('0x5')](),controller['clone']);router[_0x1d89('0x8')]('/',auth[_0x1d89('0x5')](),controller[_0x1d89('0xa')]);router['put'](_0x1d89('0x6'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1d89('0x6'),auth[_0x1d89('0x5')](),controller[_0x1d89('0xb')]);module[_0x1d89('0xc')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 12cae62..a4ab8d7 100644 --- a/server/api/trunk/trunk.attributes.js +++ b/server/api/trunk/trunk.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b9f=['join','getDataValue','rfc2833','info','inband','yes','nonat','outgoing','force_rport,comedia','setDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','\x22\x22\x20<>','INTEGER','always','refuse','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','friend','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x41b8f9,_0x2e5a01){var _0x5145d1=function(_0x1aafe9){while(--_0x1aafe9){_0x41b8f9['push'](_0x41b8f9['shift']());}};_0x5145d1(++_0x2e5a01);}(_0x9b9f,0x80));var _0xf9b9=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x9b9f[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0xf9b9('0x0'));module['exports']={'name':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'unique':_0xf9b9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xf9b9('0x3'),_0xf9b9('0x4'),_0xf9b9('0x5')),'allowNull':![],'defaultValue':_0xf9b9('0x3')},'context':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'defaultValue':_0xf9b9('0x6')},'callingpres':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x8'),_0xf9b9('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xf9b9('0xa'),_0xf9b9('0xb'),_0xf9b9('0xc'),_0xf9b9('0xd'))},'deny':{'type':Sequelize[_0xf9b9('0x1')]},'permit':{'type':Sequelize[_0xf9b9('0x1')]},'secret':{'type':Sequelize[_0xf9b9('0x1')]},'md5secret':{'type':Sequelize[_0xf9b9('0x1')]},'remotesecret':{'type':Sequelize[_0xf9b9('0x1')]},'transport':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0xe'),'set':function(_0x173e7b){this['setDataValue'](_0xf9b9('0xf'),_0x173e7b?_0x173e7b[_0xf9b9('0x10')](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0xf'))?this[_0xf9b9('0x11')](_0xf9b9('0xf'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xf9b9('0x12'),_0xf9b9('0x13'),'shortinfo',_0xf9b9('0x14'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x16'),'update',_0xf9b9('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf9b9('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x18'),'set':function(_0x25b06b){this[_0xf9b9('0x19')]('nat',_0x25b06b?_0x25b06b['join'](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0x1a'))?this['getDataValue'](_0xf9b9('0x1a'))[_0xf9b9('0x1b')](','):null;},'comment':_0xf9b9('0x1c')},'callgroup':{'type':Sequelize[_0xf9b9('0x1')]},'namedcallgroup':{'type':Sequelize[_0xf9b9('0x1')]},'pickupgroup':{'type':Sequelize[_0xf9b9('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xf9b9('0x1')]},'language':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x1d')},'allow':{'type':Sequelize[_0xf9b9('0x1')],'allowNull':![],'defaultValue':_0xf9b9('0x1e'),'set':function(_0x3b33b7){this[_0xf9b9('0x19')](_0xf9b9('0x1f'),_0x3b33b7?_0x3b33b7[_0xf9b9('0x10')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf9b9('0x11')]('allow')?this[_0xf9b9('0x11')](_0xf9b9('0x1f'))[_0xf9b9('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'insecure':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x20'),'set':function(_0xb2e5a0){this[_0xf9b9('0x19')]('insecure',_0xb2e5a0?_0xb2e5a0[_0xf9b9('0x10')](','):null);},'get':function(){return this[_0xf9b9('0x11')](_0xf9b9('0x21'))?this['getDataValue'](_0xf9b9('0x21'))[_0xf9b9('0x1b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xf9b9('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xf9b9('0x22')},'amaflags':{'type':Sequelize[_0xf9b9('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf9b9('0x1')]},'videosupport':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'mailbox':{'type':Sequelize[_0xf9b9('0x1')]},'session_timers':{'type':Sequelize[_0xf9b9('0x7')]('accept',_0xf9b9('0x25'),'originate')},'session_expires':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xf9b9('0x26'),_0xf9b9('0x27')),'defaultValue':_0xf9b9('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf9b9('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf9b9('0x15')},'keepalive':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf9b9('0x1')]},'rtptimeout':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xf9b9('0x7')]('yes','no',_0xf9b9('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf9b9('0x1')]},'timert1':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'timerb':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf9b9('0x1')]},'contactacl':{'type':Sequelize[_0xf9b9('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xf9b9('0x1')]},'use_q850_reason':{'type':Sequelize[_0xf9b9('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'force_avp':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'icesupport':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf9b9('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x29'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xf9b9('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf9b9('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xf9b9('0x1')]},'dtlscipher':{'type':Sequelize[_0xf9b9('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf9b9('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf9b9('0x2a'),_0xf9b9('0x2b'),_0xf9b9('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf9b9('0x1')]},'usereqphone':{'type':Sequelize[_0xf9b9('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf9b9('0x1')]},'recordofffeature':{'type':Sequelize[_0xf9b9('0x1')]},'call_limit':{'type':Sequelize[_0xf9b9('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf9b9('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no')},'vmexten':{'type':Sequelize[_0xf9b9('0x1')]},'mohinterpret':{'type':Sequelize[_0xf9b9('0x1')]},'mohsuggest':{'type':Sequelize[_0xf9b9('0x1')]},'parkinglot':{'type':Sequelize[_0xf9b9('0x1')]},'description':{'type':Sequelize[_0xf9b9('0x1')]},'host':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':_0xf9b9('0x2d')},'canreinvite':{'type':Sequelize[_0xf9b9('0x7')](_0xf9b9('0x15'),'no',_0xf9b9('0x16'),'update',_0xf9b9('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf9b9('0x1')]},'otherFields':{'type':Sequelize[_0xf9b9('0x1')]},'active':{'type':Sequelize[_0xf9b9('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf9b9('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8cd4=['dynamic','update,nonat','BOOLEAN','sequelize','exports','name','user','peer','friend','STRING','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass'];(function(_0x2ef4a6,_0xd243dc){var _0x4cd6ef=function(_0x4d3d90){while(--_0x4d3d90){_0x2ef4a6['push'](_0x2ef4a6['shift']());}};_0x4cd6ef(++_0xd243dc);}(_0x8cd4,0x6b));var _0x48cd=function(_0x5a2da5,_0x12e6c3){_0x5a2da5=_0x5a2da5-0x0;var _0x477530=_0x8cd4[_0x5a2da5];return _0x477530;};'use strict';var Sequelize=require(_0x48cd('0x0'));module[_0x48cd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x48cd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x48cd('0x3'),_0x48cd('0x4')),'allowNull':![],'defaultValue':_0x48cd('0x5')},'context':{'type':Sequelize[_0x48cd('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x8'),_0x48cd('0x9'),_0x48cd('0xa'),_0x48cd('0xb'),'PROHIB_NOT_SCREENED',_0x48cd('0xc'),_0x48cd('0xd'),_0x48cd('0xe'))},'deny':{'type':Sequelize[_0x48cd('0x6')]},'permit':{'type':Sequelize[_0x48cd('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x48cd('0x6')]},'transport':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':_0x48cd('0xf'),'set':function(_0x343bc3){this[_0x48cd('0x10')]('transport',_0x343bc3?_0x343bc3[_0x48cd('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x48cd('0x12'))?this['getDataValue'](_0x48cd('0x12'))[_0x48cd('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x48cd('0x14'),_0x48cd('0x15'),_0x48cd('0x16'),_0x48cd('0x17'),_0x48cd('0x18')),'defaultValue':_0x48cd('0x14')},'directmedia':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no',_0x48cd('0x1a'),_0x48cd('0x1b'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x48cd('0x6')]},'directmediadeny':{'type':Sequelize[_0x48cd('0x6')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x11f995){this[_0x48cd('0x10')](_0x48cd('0x1c'),_0x11f995?_0x11f995[_0x48cd('0x11')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x48cd('0x1d')]('nat')[_0x48cd('0x13')](','):null;},'comment':_0x48cd('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x48cd('0x6')]},'language':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x48cd('0x6')],'allowNull':![],'defaultValue':_0x48cd('0x1f'),'set':function(_0x199689){this[_0x48cd('0x10')](_0x48cd('0x20'),_0x199689?_0x199689[_0x48cd('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x48cd('0x20'))?this['getDataValue'](_0x48cd('0x20'))[_0x48cd('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'insecure':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':_0x48cd('0x21'),'set':function(_0x3afea2){this[_0x48cd('0x10')](_0x48cd('0x22'),_0x3afea2?_0x3afea2[_0x48cd('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x48cd('0x22'))?this[_0x48cd('0x1d')](_0x48cd('0x22'))[_0x48cd('0x13')](','):null;},'comment':_0x48cd('0x23')},'trustrpid':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no',_0x48cd('0x24'))},'promiscredir':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'accountcode':{'type':Sequelize[_0x48cd('0x25')](0xb)},'setvar':{'type':Sequelize[_0x48cd('0x6')]},'callerid':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x48cd('0x6')]},'callcounter':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no'),'defaultValue':_0x48cd('0x19')},'busylevel':{'type':Sequelize[_0x48cd('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x48cd('0x6')]},'template':{'type':Sequelize[_0x48cd('0x6')]},'videosupport':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no',_0x48cd('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x48cd('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no')},'mailbox':{'type':Sequelize[_0x48cd('0x6')]},'session_timers':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x27'),_0x48cd('0x28'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x48cd('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x29'),'uas'),'defaultValue':_0x48cd('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x48cd('0x6')]},'regexten':{'type':Sequelize[_0x48cd('0x6')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x48cd('0x6')]},'port':{'type':Sequelize[_0x48cd('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no'),'defaultValue':_0x48cd('0x19')},'keepalive':{'type':Sequelize[_0x48cd('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x48cd('0x6')]},'defaultuser':{'type':Sequelize[_0x48cd('0x6')]},'rtptimeout':{'type':Sequelize[_0x48cd('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x48cd('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x48cd('0x7')]('yes','no',_0x48cd('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x48cd('0x6')]},'callbackextension':{'type':Sequelize[_0x48cd('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x48cd('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x48cd('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x48cd('0x6')]},'use_q850_reason':{'type':Sequelize[_0x48cd('0x6')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no')},'force_avp':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x48cd('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no',_0x48cd('0x2c'),_0x48cd('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x48cd('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x48cd('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x48cd('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x2e'),_0x48cd('0x2f'),_0x48cd('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x48cd('0x6')]},'usereqphone':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x48cd('0x6')]},'recordofffeature':{'type':Sequelize[_0x48cd('0x6')]},'call_limit':{'type':Sequelize[_0x48cd('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x48cd('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x48cd('0x7')](_0x48cd('0x19'),'no')},'vmexten':{'type':Sequelize[_0x48cd('0x6')]},'mohinterpret':{'type':Sequelize[_0x48cd('0x6')]},'mohsuggest':{'type':Sequelize[_0x48cd('0x6')]},'parkinglot':{'type':Sequelize[_0x48cd('0x6')]},'description':{'type':Sequelize[_0x48cd('0x6')]},'host':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':_0x48cd('0x31')},'canreinvite':{'type':Sequelize[_0x48cd('0x7')]('yes','no','nonat',_0x48cd('0x1b'),_0x48cd('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x48cd('0x6')]},'otherFields':{'type':Sequelize[_0x48cd('0x6')]},'active':{'type':Sequelize[_0x48cd('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x48cd('0x6')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5abaecc..6e29cc3 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4b84,0x1cc));var _0x44b8=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x4b84[_0x146a97];return _0x259d5c;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x7b0b07,_0x2cd75e){var _0x451d2f=function(_0x17d044){while(--_0x17d044){_0x7b0b07['push'](_0x7b0b07['shift']());}};_0x451d2f(++_0x2cd75e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index dce4efd..a3092be 100644 --- a/server/api/trunk/trunk.model.js +++ b/server/api/trunk/trunk.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72e3=['rimraf','../../config/environment','define','lodash','util','../../config/logger','moment','bluebird'];(function(_0x434990,_0x53a229){var _0x20ac46=function(_0x2cafc3){while(--_0x2cafc3){_0x434990['push'](_0x434990['shift']());}};_0x20ac46(++_0x53a229);}(_0x72e3,0xfb));var _0x372e=function(_0x51c94d,_0x205d6a){_0x51c94d=_0x51c94d-0x0;var _0x5de98c=_0x72e3[_0x51c94d];return _0x5de98c;};'use strict';var _=require(_0x372e('0x0'));var util=require(_0x372e('0x1'));var logger=require(_0x372e('0x2'))('api');var moment=require(_0x372e('0x3'));var BPromise=require(_0x372e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x372e('0x5'));var config=require(_0x372e('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x3c58c2,_0x1a0b32){return _0x3c58c2[_0x372e('0x7')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fe3=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks'];(function(_0x13659a,_0x41453c){var _0x4b1c49=function(_0x270c47){while(--_0x270c47){_0x13659a['push'](_0x13659a['shift']());}};_0x4b1c49(++_0x41453c);}(_0x6fe3,0x18c));var _0x36fe=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0x6fe3[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0x36fe('0x0'));var util=require(_0x36fe('0x1'));var logger=require(_0x36fe('0x2'))(_0x36fe('0x3'));var moment=require('moment');var BPromise=require(_0x36fe('0x4'));var rp=require(_0x36fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36fe('0x6'));var attributes=require(_0x36fe('0x7'));module[_0x36fe('0x8')]=function(_0x2eb32f,_0x45310e){return _0x2eb32f['define'](_0x36fe('0x9'),attributes,{'tableName':_0x36fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 78cb36b..30b857f 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6334=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options','where','attributes','limit','map','include','model','message','ShowTrunk','Trunk','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1e36e0,_0x575529){var _0x5ca698=function(_0x1a7697){while(--_0x1a7697){_0x1e36e0['push'](_0x1e36e0['shift']());}};_0x5ca698(++_0x575529);}(_0x6334,0x119));var _0x4633=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x6334[_0x35f6b4];return _0x10f072;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a8997,_0x5647f1,_0x56891d){return new BPromise(function(_0x21af74,_0x148e72){return client['request'](_0x4a8997,_0x56891d)[_0x4633('0xd')](function(_0x31e794){logger[_0x4633('0xe')]('Trunk,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'));logger[_0x4633('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'),JSON[_0x4633('0x11')](_0x31e794));if(_0x31e794[_0x4633('0x12')]){if(_0x31e794[_0x4633('0x12')]['code']===0x1f4){logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794[_0x4633('0x12')]['message']);return _0x148e72(_0x31e794['error']['message']);}logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794['error']['message']);return _0x21af74(_0x31e794[_0x4633('0x12')]['message']);}else{logger[_0x4633('0xe')](_0x4633('0x13'),_0x5647f1,_0x4633('0xf'));_0x21af74(_0x31e794[_0x4633('0x14')]['message']);}})[_0x4633('0x15')](function(_0x15bd98){logger[_0x4633('0x12')]('Trunk,\x20%s,\x20%s',_0x5647f1,_0x15bd98);_0x148e72(_0x15bd98);});});}exports[_0x4633('0x16')]=function(_0x37e536){var _0x1c7186=this;return new Promise(function(_0x2ad562,_0xbab957){return db['Trunk'][_0x4633('0x17')]({'raw':_0x37e536[_0x4633('0x18')]?_0x37e536['options']['raw']===undefined?!![]:![]:!![],'where':_0x37e536[_0x4633('0x18')]?_0x37e536['options'][_0x4633('0x19')]||null:null,'attributes':_0x37e536['options']?_0x37e536['options'][_0x4633('0x1a')]||null:null,'limit':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')][_0x4633('0x1b')]||null:null,'include':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')]['include']?_[_0x4633('0x1c')](_0x37e536['options'][_0x4633('0x1d')],function(_0xcfac3f){return{'model':db[_0xcfac3f[_0x4633('0x1e')]],'as':_0xcfac3f['as'],'attributes':_0xcfac3f[_0x4633('0x1a')],'include':_0xcfac3f[_0x4633('0x1d')]?_['map'](_0xcfac3f[_0x4633('0x1d')],function(_0x399220){return{'model':db[_0x399220[_0x4633('0x1e')]],'as':_0x399220['as'],'attributes':_0x399220[_0x4633('0x1a')],'include':_0x399220[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x399220[_0x4633('0x1d')],function(_0x368582){return{'model':db[_0x368582[_0x4633('0x1e')]],'as':_0x368582['as'],'attributes':_0x368582[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x2539a2){logger[_0x4633('0xe')](_0x4633('0x16'),_0x37e536);logger[_0x4633('0x10')](_0x4633('0x16'),_0x37e536,JSON[_0x4633('0x11')](_0x2539a2));_0x2ad562(_0x2539a2);})[_0x4633('0x15')](function(_0x5de12a){logger[_0x4633('0x12')](_0x4633('0x16'),_0x5de12a[_0x4633('0x1f')],_0x37e536);_0xbab957(_0x1c7186[_0x4633('0x12')](0x1f4,_0x5de12a[_0x4633('0x1f')]));});});};exports[_0x4633('0x20')]=function(_0x559fa5){var _0x23c33c=this;return new Promise(function(_0x52fc85,_0x1d3811){return db[_0x4633('0x21')][_0x4633('0x22')]({'raw':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x23')]===undefined?!![]:![]:!![],'where':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x19')]||null:null,'attributes':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x1a')]||null:null,'include':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')]['include']?_['map'](_0x559fa5[_0x4633('0x18')][_0x4633('0x1d')],function(_0x5177f2){return{'model':db[_0x5177f2[_0x4633('0x1e')]],'as':_0x5177f2['as'],'attributes':_0x5177f2[_0x4633('0x1a')],'include':_0x5177f2[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x5177f2['include'],function(_0x3f92ef){return{'model':db[_0x3f92ef['model']],'as':_0x3f92ef['as'],'attributes':_0x3f92ef[_0x4633('0x1a')],'include':_0x3f92ef[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x3f92ef[_0x4633('0x1d')],function(_0x213768){return{'model':db[_0x213768[_0x4633('0x1e')]],'as':_0x213768['as'],'attributes':_0x213768[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x546390){logger[_0x4633('0xe')](_0x4633('0x20'),_0x559fa5);logger['debug'](_0x4633('0x20'),_0x559fa5,JSON[_0x4633('0x11')](_0x546390));_0x52fc85(_0x546390);})[_0x4633('0x15')](function(_0x468648){logger['error']('ShowTrunk',_0x468648[_0x4633('0x1f')],_0x559fa5);_0x1d3811(_0x23c33c['error'](0x1f4,_0x468648['message']));});});}; \ No newline at end of file +var _0x15c9=['map','model','attributes','GetTrunk','ShowTrunk','find','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','limit','include'];(function(_0x33ff23,_0x2e2f0a){var _0xce614=function(_0x5bc499){while(--_0x5bc499){_0x33ff23['push'](_0x33ff23['shift']());}};_0xce614(++_0x2e2f0a);}(_0x15c9,0x10f));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x915c('0x0'));var util=require(_0x915c('0x1'));var moment=require(_0x915c('0x2'));var BPromise=require('bluebird');var rs=require(_0x915c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x915c('0x4'))['db'];var utils=require(_0x915c('0x5'));var logger=require(_0x915c('0x6'))('rpc');var config=require(_0x915c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x915c('0x8')][_0x915c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x381a84,_0x5d4d24,_0x2fd14d){return new BPromise(function(_0x48ad6f,_0x5be820){return client[_0x915c('0xa')](_0x381a84,_0x2fd14d)[_0x915c('0xb')](function(_0x2e2b95){logger[_0x915c('0xc')]('Trunk,\x20%s,\x20%s',_0x5d4d24,'request\x20sent');logger[_0x915c('0xd')](_0x915c('0xe'),_0x5d4d24,'request\x20sent',JSON[_0x915c('0xf')](_0x2e2b95));if(_0x2e2b95[_0x915c('0x10')]){if(_0x2e2b95[_0x915c('0x10')]['code']===0x1f4){logger[_0x915c('0x10')](_0x915c('0x11'),_0x5d4d24,_0x2e2b95[_0x915c('0x10')][_0x915c('0x12')]);return _0x5be820(_0x2e2b95[_0x915c('0x10')][_0x915c('0x12')]);}logger[_0x915c('0x10')](_0x915c('0x11'),_0x5d4d24,_0x2e2b95[_0x915c('0x10')][_0x915c('0x12')]);return _0x48ad6f(_0x2e2b95['error'][_0x915c('0x12')]);}else{logger[_0x915c('0xc')](_0x915c('0x11'),_0x5d4d24,_0x915c('0x13'));_0x48ad6f(_0x2e2b95[_0x915c('0x14')][_0x915c('0x12')]);}})[_0x915c('0x15')](function(_0x57fd97){logger[_0x915c('0x10')](_0x915c('0x11'),_0x5d4d24,_0x57fd97);_0x5be820(_0x57fd97);});});}exports['GetTrunk']=function(_0x924020){var _0x4d587a=this;return new Promise(function(_0x1d43f2,_0x294baa){return db['Trunk'][_0x915c('0x16')]({'raw':_0x924020[_0x915c('0x17')]?_0x924020[_0x915c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x924020[_0x915c('0x17')]?_0x924020[_0x915c('0x17')]['where']||null:null,'attributes':_0x924020[_0x915c('0x17')]?_0x924020[_0x915c('0x17')]['attributes']||null:null,'limit':_0x924020['options']?_0x924020[_0x915c('0x17')][_0x915c('0x18')]||null:null,'include':_0x924020[_0x915c('0x17')]?_0x924020[_0x915c('0x17')][_0x915c('0x19')]?_[_0x915c('0x1a')](_0x924020[_0x915c('0x17')][_0x915c('0x19')],function(_0x2e5795){return{'model':db[_0x2e5795[_0x915c('0x1b')]],'as':_0x2e5795['as'],'attributes':_0x2e5795[_0x915c('0x1c')],'include':_0x2e5795['include']?_[_0x915c('0x1a')](_0x2e5795[_0x915c('0x19')],function(_0x1c31f2){return{'model':db[_0x1c31f2[_0x915c('0x1b')]],'as':_0x1c31f2['as'],'attributes':_0x1c31f2[_0x915c('0x1c')],'include':_0x1c31f2['include']?_['map'](_0x1c31f2[_0x915c('0x19')],function(_0x5f3f0a){return{'model':db[_0x5f3f0a[_0x915c('0x1b')]],'as':_0x5f3f0a['as'],'attributes':_0x5f3f0a[_0x915c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x915c('0xb')](function(_0x5c0010){logger[_0x915c('0xc')]('GetTrunk',_0x924020);logger[_0x915c('0xd')](_0x915c('0x1d'),_0x924020,JSON[_0x915c('0xf')](_0x5c0010));_0x1d43f2(_0x5c0010);})['catch'](function(_0x32ca48){logger[_0x915c('0x10')](_0x915c('0x1d'),_0x32ca48[_0x915c('0x12')],_0x924020);_0x294baa(_0x4d587a[_0x915c('0x10')](0x1f4,_0x32ca48[_0x915c('0x12')]));});});};exports[_0x915c('0x1e')]=function(_0x116354){var _0x1e0f73=this;return new Promise(function(_0x214043,_0x37c3c7){return db['Trunk'][_0x915c('0x1f')]({'raw':_0x116354[_0x915c('0x17')]?_0x116354[_0x915c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x116354[_0x915c('0x17')]?_0x116354[_0x915c('0x17')][_0x915c('0x20')]||null:null,'attributes':_0x116354['options']?_0x116354['options'][_0x915c('0x1c')]||null:null,'include':_0x116354[_0x915c('0x17')]?_0x116354[_0x915c('0x17')][_0x915c('0x19')]?_[_0x915c('0x1a')](_0x116354['options'][_0x915c('0x19')],function(_0x44a513){return{'model':db[_0x44a513['model']],'as':_0x44a513['as'],'attributes':_0x44a513[_0x915c('0x1c')],'include':_0x44a513['include']?_[_0x915c('0x1a')](_0x44a513[_0x915c('0x19')],function(_0x402676){return{'model':db[_0x402676['model']],'as':_0x402676['as'],'attributes':_0x402676[_0x915c('0x1c')],'include':_0x402676[_0x915c('0x19')]?_[_0x915c('0x1a')](_0x402676[_0x915c('0x19')],function(_0x5048e2){return{'model':db[_0x5048e2[_0x915c('0x1b')]],'as':_0x5048e2['as'],'attributes':_0x5048e2[_0x915c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d2ae6){logger[_0x915c('0xc')](_0x915c('0x1e'),_0x116354);logger[_0x915c('0xd')](_0x915c('0x1e'),_0x116354,JSON[_0x915c('0xf')](_0x3d2ae6));_0x214043(_0x3d2ae6);})[_0x915c('0x15')](function(_0x5d0df0){logger[_0x915c('0x10')](_0x915c('0x1e'),_0x5d0df0[_0x915c('0x12')],_0x116354);_0x37c3c7(_0x1e0f73[_0x915c('0x10')](0x1f4,_0x5d0df0[_0x915c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 3086c38..99207d7 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfe3=['put','/:id','isAuthenticated','update','express','Router','../../components/auth/service'];(function(_0x1d0213,_0x337f9e){var _0x18ff7b=function(_0x79afff){while(--_0x79afff){_0x1d0213['push'](_0x1d0213['shift']());}};_0x18ff7b(++_0x337f9e);}(_0xcfe3,0x18c));var _0x3cfe=function(_0x444990,_0x4b4ee6){_0x444990=_0x444990-0x0;var _0x486d89=_0xcfe3[_0x444990];return _0x486d89;};'use strict';var express=require(_0x3cfe('0x0'));var router=express[_0x3cfe('0x1')]();var auth=require(_0x3cfe('0x2'));var controller=require('./user-setting.controller');router[_0x3cfe('0x3')](_0x3cfe('0x4'),auth[_0x3cfe('0x5')](),controller[_0x3cfe('0x6')]);module['exports']=router; \ No newline at end of file +var _0x1d37=['/:id','isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x2fbb21,_0x1f3785){var _0x1caa91=function(_0x339eef){while(--_0x339eef){_0x2fbb21['push'](_0x2fbb21['shift']());}};_0x1caa91(++_0x1f3785);}(_0x1d37,0xd3));var _0x71d3=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x1d37[_0x166953];return _0x4a8baf;};'use strict';var express=require(_0x71d3('0x0'));var router=express[_0x71d3('0x1')]();var auth=require(_0x71d3('0x2'));var controller=require(_0x71d3('0x3'));router[_0x71d3('0x4')](_0x71d3('0x5'),auth[_0x71d3('0x6')](),controller[_0x71d3('0x7')]);module[_0x71d3('0x8')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 3041856..c977918 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x265b=['UserId','sequelize','error','warning','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER'];(function(_0x32f7b3,_0x47f0df){var _0x16be9a=function(_0x206985){while(--_0x206985){_0x32f7b3['push'](_0x32f7b3['shift']());}};_0x16be9a(++_0x47f0df);}(_0x265b,0x119));var _0xb265=function(_0x2bc89f,_0xc06799){_0x2bc89f=_0x2bc89f-0x0;var _0x4dfb39=_0x265b[_0x2bc89f];return _0x4dfb39;};'use strict';var Sequelize=require(_0xb265('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb265('0x1'),_0xb265('0x2'),'info','debug'];module[_0xb265('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb265('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb265('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb265('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb265('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb265('0x8')],'unique':_0xb265('0x9')}}; \ No newline at end of file +var _0x7948=['warning','info','debug','exports','ENUM','DATE','INTEGER','UserId','sequelize','error'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x7948,0x1de));var _0x8794=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x7948[_0x102977];return _0x15c466;};'use strict';var Sequelize=require(_0x8794('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x8794('0x1'),_0x8794('0x2'),_0x8794('0x3'),_0x8794('0x4')];module[_0x8794('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8794('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8794('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8794('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8794('0x8')],'unique':_0x8794('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 0944605..c3cd670 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x385b=['../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','redis','defaults','localhost','status','json','then','sendStatus','error','name','send','user','admin','Unauthorized','params','UserSetting','find','body','catch','ioredis','api'];(function(_0x7577b9,_0x4fe21c){var _0x2660c8=function(_0x3f94ae){while(--_0x3f94ae){_0x7577b9['push'](_0x7577b9['shift']());}};_0x2660c8(++_0x4fe21c);}(_0x385b,0x1a7));var _0xb385=function(_0x55a76a,_0x2d0203){_0x55a76a=_0x55a76a-0x0;var _0x45885a=_0x385b[_0x55a76a];return _0x45885a;};'use strict';var _=require('lodash');var Redis=require(_0xb385('0x0'));var logger=require('../../config/logger')(_0xb385('0x1'));var config=require(_0xb385('0x2'));var db=require(_0xb385('0x3'))['db'];var socket=require(_0xb385('0x4'))(new Redis(config['redis']));require(_0xb385('0x5'))[_0xb385('0x6')](socket);config[_0xb385('0x7')]=_[_0xb385('0x8')](config[_0xb385('0x7')],{'host':_0xb385('0x9'),'port':0x18eb});function respondWithResult(_0x411034,_0x367d50){_0x367d50=_0x367d50||0xc8;return function(_0x5b7929){if(_0x5b7929){return _0x411034[_0xb385('0xa')](_0x367d50)[_0xb385('0xb')](_0x5b7929);}};}function saveUpdates(_0x107223){return function(_0x14861d){if(_0x14861d){return _0x14861d['update'](_0x107223)[_0xb385('0xc')](function(_0x40f65e){return _0x40f65e;});}return null;};}function handleEntityNotFound(_0x524ed4){return function(_0x44b026){if(!_0x44b026){_0x524ed4[_0xb385('0xd')](0x194);}return _0x44b026;};}function handleError(_0x35a5c9,_0x371315){_0x371315=_0x371315||0x1f4;return function(_0x1b0471){logger[_0xb385('0xe')](_0x1b0471['stack']);if(_0x1b0471[_0xb385('0xf')]){delete _0x1b0471['name'];}_0x35a5c9['status'](_0x371315)[_0xb385('0x10')](_0x1b0471);};}exports['update']=function(_0x1421c7,_0x886ece){if(_0x1421c7[_0xb385('0x11')]['role']!==_0xb385('0x12'))throw new Error(_0xb385('0x13'));if(isNaN(Number(_0x1421c7[_0xb385('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xb385('0x15')][_0xb385('0x16')]({'where':{'id':_0x1421c7[_0xb385('0x14')]['id']}})['then'](handleEntityNotFound(_0x886ece,null))[_0xb385('0xc')](saveUpdates(_0x1421c7[_0xb385('0x17')],null))[_0xb385('0xc')](respondWithResult(_0x886ece,null))[_0xb385('0x18')](handleError(_0x886ece,null));}; \ No newline at end of file +var _0xd246=['../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','status','json','then','sendStatus','stack','name','user','role','admin','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd246,0xf5));var _0x6d24=function(_0x3da241,_0xeba26a){_0x3da241=_0x3da241-0x0;var _0x43e156=_0xd246[_0x3da241];return _0x43e156;};'use strict';var _=require(_0x6d24('0x0'));var Redis=require(_0x6d24('0x1'));var logger=require(_0x6d24('0x2'))(_0x6d24('0x3'));var config=require(_0x6d24('0x4'));var db=require(_0x6d24('0x5'))['db'];var socket=require(_0x6d24('0x6'))(new Redis(config[_0x6d24('0x7')]));require('./user-setting.socket')[_0x6d24('0x8')](socket);config['redis']=_[_0x6d24('0x9')](config['redis'],{'host':_0x6d24('0xa'),'port':0x18eb});function respondWithResult(_0x7f6dfa,_0x1dcaa2){_0x1dcaa2=_0x1dcaa2||0xc8;return function(_0x358a65){if(_0x358a65){return _0x7f6dfa[_0x6d24('0xb')](_0x1dcaa2)[_0x6d24('0xc')](_0x358a65);}};}function saveUpdates(_0x1eae36){return function(_0x4d3556){if(_0x4d3556){return _0x4d3556['update'](_0x1eae36)[_0x6d24('0xd')](function(_0x519e5e){return _0x519e5e;});}return null;};}function handleEntityNotFound(_0x23e705){return function(_0x52d670){if(!_0x52d670){_0x23e705[_0x6d24('0xe')](0x194);}return _0x52d670;};}function handleError(_0x5b5ea6,_0x40811a){_0x40811a=_0x40811a||0x1f4;return function(_0x200c79){logger['error'](_0x200c79[_0x6d24('0xf')]);if(_0x200c79['name']){delete _0x200c79[_0x6d24('0x10')];}_0x5b5ea6[_0x6d24('0xb')](_0x40811a)['send'](_0x200c79);};}exports['update']=function(_0x565477,_0x269778){if(_0x565477[_0x6d24('0x11')][_0x6d24('0x12')]!==_0x6d24('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0x565477['params']['id'])))throw new Error(_0x6d24('0x14'));return db[_0x6d24('0x15')][_0x6d24('0x16')]({'where':{'id':_0x565477['params']['id']}})['then'](handleEntityNotFound(_0x269778,null))[_0x6d24('0xd')](saveUpdates(_0x565477[_0x6d24('0x17')],null))[_0x6d24('0xd')](respondWithResult(_0x269778,null))[_0x6d24('0x18')](handleError(_0x269778,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 86c90fc..f6dc03e 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3071=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x8bcb4a,_0x3ad476){var _0x22d7d1=function(_0x3bb2da){while(--_0x3bb2da){_0x8bcb4a['push'](_0x8bcb4a['shift']());}};_0x22d7d1(++_0x3ad476);}(_0x3071,0x160));var _0x1307=function(_0xd3e0b9,_0xd80d4d){_0xd3e0b9=_0xd3e0b9-0x0;var _0x470133=_0x3071[_0xd3e0b9];return _0x470133;};'use strict';var EventEmitter=require(_0x1307('0x0'));var UserSetting=require(_0x1307('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1307('0x2'),'afterUpdate':_0x1307('0x3'),'afterDestroy':_0x1307('0x4')};function emitEvent(_0x1dca18){return function(_0x59a48b,_0x4fb19a,_0x4de13c){UserSettingEvents[_0x1307('0x5')](_0x1dca18+':'+_0x59a48b['id'],_0x59a48b);UserSettingEvents['emit'](_0x1dca18,_0x59a48b);_0x4de13c(null);};}for(var e in events){if(events[_0x1307('0x6')](e)){var event=events[e];UserSetting[_0x1307('0x7')](e,emitEvent(event));}}module[_0x1307('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x0699=['update','remove','emit','hook','events','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0699,0xc1));var _0x9069=function(_0x574db6,_0x5f49f0){_0x574db6=_0x574db6-0x0;var _0x4c859e=_0x0699[_0x574db6];return _0x4c859e;};'use strict';var EventEmitter=require(_0x9069('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9069('0x1')](0x0);var events={'afterCreate':_0x9069('0x2'),'afterUpdate':_0x9069('0x3'),'afterDestroy':_0x9069('0x4')};function emitEvent(_0x37b960){return function(_0x2f7c43,_0x11a9bc,_0x4aadd3){UserSettingEvents[_0x9069('0x5')](_0x37b960+':'+_0x2f7c43['id'],_0x2f7c43);UserSettingEvents['emit'](_0x37b960,_0x2f7c43);_0x4aadd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x9069('0x6')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index cdf7a47..da383dd 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0833=['./user-setting.attributes','exports','define','UserSetting','clientSideLoggingEnabledSince'];(function(_0x1c4b8d,_0x146a41){var _0x203346=function(_0x541d4d){while(--_0x541d4d){_0x1c4b8d['push'](_0x1c4b8d['shift']());}};_0x203346(++_0x146a41);}(_0x0833,0x1bd));var _0x3083=function(_0x17070a,_0x50d2fb){_0x17070a=_0x17070a-0x0;var _0x246a40=_0x0833[_0x17070a];return _0x246a40;};'use strict';var attributes=require(_0x3083('0x0'));module[_0x3083('0x1')]=function(_0x33f231){return _0x33f231[_0x3083('0x2')](_0x3083('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52255d){if(!_0x52255d['clientSideLoggingEnabled'])_0x52255d[_0x3083('0x4')]=null;else if(_0x52255d['clientSideLoggingEnabledSince']===null)_0x52255d[_0x3083('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x4157=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x3c179d,_0x4d60fc){var _0x23db0f=function(_0x467475){while(--_0x467475){_0x3c179d['push'](_0x3c179d['shift']());}};_0x23db0f(++_0x4d60fc);}(_0x4157,0xf3));var _0x7415=function(_0x97f3b9,_0x1077b1){_0x97f3b9=_0x97f3b9-0x0;var _0x543a18=_0x4157[_0x97f3b9];return _0x543a18;};'use strict';var attributes=require(_0x7415('0x0'));module[_0x7415('0x1')]=function(_0x325318){return _0x325318[_0x7415('0x2')](_0x7415('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3efb60){if(!_0x3efb60[_0x7415('0x4')])_0x3efb60[_0x7415('0x5')]=null;else if(_0x3efb60[_0x7415('0x5')]===null)_0x3efb60[_0x7415('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 371935f..08337e8 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events','remove','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9bde,0xf8));var _0xe9bd=function(_0x36cfc4,_0x147c92){_0x36cfc4=_0x36cfc4-0x0;var _0x15f180=_0x9bde[_0x36cfc4];return _0x15f180;};'use strict';var UserSettingEvents=require(_0xe9bd('0x0'));var events=['save',_0xe9bd('0x1'),_0xe9bd('0x2')];function createListener(_0x4c0041,_0x3e1a02){return function(_0x354a62){_0x3e1a02[_0xe9bd('0x3')](_0x4c0041,_0x354a62);if(_0x4c0041===_0xe9bd('0x4')){_0x3e1a02[_0xe9bd('0x3')](_0xe9bd('0x5')+_0x354a62[_0xe9bd('0x6')],_0x354a62);}};}exports[_0xe9bd('0x7')]=function(_0x160b2b){for(var _0xb4496c=0x0,_0x29e31d=events['length'];_0xb4496c<_0x29e31d;_0xb4496c++){var _0x4defc5=events[_0xb4496c];var _0x5867bc=createListener(_0xe9bd('0x8')+_0x4defc5,_0x160b2b);UserSettingEvents['on'](_0x4defc5,_0x5867bc);}}; \ No newline at end of file +var _0xda96=['save','update','emit','user-setting:update:user-','UserId','register','length','./user-setting.events'];(function(_0x2ee172,_0x278363){var _0x2106e7=function(_0x54f214){while(--_0x54f214){_0x2ee172['push'](_0x2ee172['shift']());}};_0x2106e7(++_0x278363);}(_0xda96,0xaf));var _0x6da9=function(_0x59a2fb,_0x5d0821){_0x59a2fb=_0x59a2fb-0x0;var _0x553f80=_0xda96[_0x59a2fb];return _0x553f80;};'use strict';var UserSettingEvents=require(_0x6da9('0x0'));var events=[_0x6da9('0x1'),'remove',_0x6da9('0x2')];function createListener(_0x22ad82,_0x321e97){return function(_0x347cd3){_0x321e97[_0x6da9('0x3')](_0x22ad82,_0x347cd3);if(_0x22ad82==='user-setting:update'){_0x321e97[_0x6da9('0x3')](_0x6da9('0x4')+_0x347cd3[_0x6da9('0x5')],_0x347cd3);}};}exports[_0x6da9('0x6')]=function(_0x14a522){for(var _0x28b403=0x0,_0x238f6b=events[_0x6da9('0x7')];_0x28b403<_0x238f6b;_0x28b403++){var _0xae05f1=events[_0x28b403];var _0x33a679=createListener('user-setting:'+_0xae05f1,_0x14a522);UserSettingEvents['on'](_0xae05f1,_0x33a679);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 3513305..b0b20a7 100644 --- a/server/api/user/index.js +++ b/server/api/user/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4949=['/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','removeQueues','delete','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','whoami'];(function(_0x2de699,_0x29ccd8){var _0x1754b7=function(_0x4f70ee){while(--_0x4f70ee){_0x2de699['push'](_0x2de699['shift']());}};_0x1754b7(++_0x29ccd8);}(_0x4949,0x68));var _0x9494=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4949[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9494('0x0'));var util=require(_0x9494('0x1'));var path=require('path');var timeout=require(_0x9494('0x2'));var express=require(_0x9494('0x3'));var router=express[_0x9494('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9494('0x5'));var interaction=require(_0x9494('0x6'));var config=require(_0x9494('0x7'));var controller=require(_0x9494('0x8'));router[_0x9494('0x9')]('/',auth['isAuthenticated'](),controller[_0x9494('0xa')]);router[_0x9494('0x9')](_0x9494('0xb'),auth[_0x9494('0xc')](),controller[_0x9494('0xd')]);router[_0x9494('0x9')]('/whoami',auth[_0x9494('0xc')](),controller[_0x9494('0xe')]);router[_0x9494('0x9')](_0x9494('0xf'),auth['isAuthenticated'](),controller[_0x9494('0x10')]);router[_0x9494('0x9')](_0x9494('0x11'),auth[_0x9494('0xc')](),controller['show']);router['get'](_0x9494('0x12'),controller[_0x9494('0x13')]);router[_0x9494('0x9')](_0x9494('0x14'),auth[_0x9494('0xc')](),controller[_0x9494('0x15')]);router['get'](_0x9494('0x16'),auth[_0x9494('0xc')](),controller[_0x9494('0x17')]);router[_0x9494('0x9')]('/:id/queues',auth[_0x9494('0xc')](),controller[_0x9494('0x18')]);router['get'](_0x9494('0x19'),auth[_0x9494('0xc')](),controller['getVoiceQueuesRt']);router[_0x9494('0x9')](_0x9494('0x1a'),auth[_0x9494('0xc')](),controller[_0x9494('0x1b')]);router['get'](_0x9494('0x1c'),auth[_0x9494('0xc')](),controller[_0x9494('0x1d')]);router[_0x9494('0x9')](_0x9494('0x1e'),auth[_0x9494('0xc')](),controller['getScreenRecordings']);router['get'](_0x9494('0x1f'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x9494('0x9')](_0x9494('0x20'),auth[_0x9494('0xc')](),controller[_0x9494('0x21')]);router[_0x9494('0x9')](_0x9494('0x22'),auth[_0x9494('0xc')](),controller['getMailInteractions']);router[_0x9494('0x9')](_0x9494('0x23'),auth['isAuthenticated'](),controller[_0x9494('0x24')]);router[_0x9494('0x9')](_0x9494('0x25'),auth[_0x9494('0xc')](),controller[_0x9494('0x26')]);router['get']('/:id/whatsapp/interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x27')]);router['get'](_0x9494('0x28'),auth[_0x9494('0xc')](),controller[_0x9494('0x29')]);router[_0x9494('0x9')](_0x9494('0x2a'),auth[_0x9494('0xc')](),controller[_0x9494('0x2b')]);router[_0x9494('0x9')](_0x9494('0x2c'),auth[_0x9494('0xc')](),controller[_0x9494('0x2d')]);router[_0x9494('0x9')](_0x9494('0x2e'),auth[_0x9494('0xc')](),controller['getVoicePrefixes']);router[_0x9494('0x9')](_0x9494('0x2f'),auth[_0x9494('0xc')](),controller[_0x9494('0x30')]);router[_0x9494('0x9')](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x32')]);router['get'](_0x9494('0x33'),auth[_0x9494('0xc')](),controller['getOpenchannelAccounts']);router[_0x9494('0x9')]('/:id/sms_accounts',auth[_0x9494('0xc')](),controller[_0x9494('0x34')]);router[_0x9494('0x9')](_0x9494('0x35'),auth[_0x9494('0xc')](),controller[_0x9494('0x36')]);router[_0x9494('0x9')](_0x9494('0x37'),auth[_0x9494('0xc')](),controller['getWhatsappAccounts']);router['get'](_0x9494('0x38'),auth[_0x9494('0xc')](),controller['getSquareProjects']);router['get'](_0x9494('0x39'),auth[_0x9494('0xc')](),controller[_0x9494('0x3a')]);router[_0x9494('0x9')](_0x9494('0x3b'),auth[_0x9494('0xc')](),controller[_0x9494('0x3c')]);router[_0x9494('0x3d')](_0x9494('0x16'),auth['isAuthenticated'](),controller[_0x9494('0x3e')]);router[_0x9494('0x3d')]('/',auth[_0x9494('0xc')](),controller[_0x9494('0x3f')]);router[_0x9494('0x3d')]('/create_many',auth[_0x9494('0xc')](),controller[_0x9494('0x40')]);router[_0x9494('0x3d')](_0x9494('0x41'),auth[_0x9494('0xc')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9494('0x42')]({'destination':function(_0x28b19a,_0x2c4d90,_0x45828c){_0x45828c(null,path[_0x9494('0x43')](config[_0x9494('0x44')],_0x9494('0x45')));},'filename':function(_0x24ad7d,_0x1be2d7,_0x425370){_0x425370(null,util[_0x9494('0x46')](_0x9494('0x47'),Date[_0x9494('0x48')](),_0x1be2d7['originalname']));}})});router[_0x9494('0x3d')]('/:id/avatar',upload[_0x9494('0x49')](_0x9494('0x4a')),controller[_0x9494('0x4b')]);router[_0x9494('0x3d')](_0x9494('0x4c'),auth['isAuthenticated'](),controller[_0x9494('0x4d')]);router[_0x9494('0x3d')]('/:id/logout',auth[_0x9494('0xc')](),controller[_0x9494('0x4e')]);router[_0x9494('0x3d')]('/:id/pause',auth[_0x9494('0xc')](),controller[_0x9494('0x4f')]);router[_0x9494('0x3d')](_0x9494('0x50'),auth[_0x9494('0xc')](),controller['unpause']);router['post']('/:id/teams',auth[_0x9494('0xc')](),controller[_0x9494('0x51')]);router['post']('/:id/chat_interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x52')]);router[_0x9494('0x3d')](_0x9494('0x53'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x9494('0x3d')](_0x9494('0x54'),auth[_0x9494('0xc')](),controller[_0x9494('0x55')]);router['post'](_0x9494('0x56'),auth[_0x9494('0xc')](),controller[_0x9494('0x57')]);router[_0x9494('0x3d')](_0x9494('0x58'),auth[_0x9494('0xc')](),controller[_0x9494('0x59')]);router[_0x9494('0x3d')](_0x9494('0x5a'),auth[_0x9494('0xc')](),controller[_0x9494('0x5b')]);router[_0x9494('0x3d')]('/:id/fax_accounts',auth[_0x9494('0xc')](),controller['addFaxAccounts']);router['post'](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x5c')]);router['post'](_0x9494('0x33'),auth[_0x9494('0xc')](),controller['addOpenchannelAccounts']);router[_0x9494('0x3d')](_0x9494('0x5d'),auth['isAuthenticated'](),controller[_0x9494('0x5e')]);router[_0x9494('0x3d')](_0x9494('0x35'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x9494('0x37'),auth[_0x9494('0xc')](),controller[_0x9494('0x5f')]);router[_0x9494('0x3d')]('/:id/square_projects',auth[_0x9494('0xc')](),controller[_0x9494('0x60')]);router[_0x9494('0x3d')]('/:id/api_key',auth[_0x9494('0xc')](),controller['createApiKey']);router[_0x9494('0x61')](_0x9494('0x11'),auth['isAuthenticated'](),controller[_0x9494('0x62')]);router[_0x9494('0x61')](_0x9494('0x63'),auth[_0x9494('0xc')](),controller[_0x9494('0x64')]);router['delete'](_0x9494('0x41'),auth[_0x9494('0xc')](),controller[_0x9494('0x65')]);router[_0x9494('0x66')](_0x9494('0x28'),auth[_0x9494('0xc')](),controller['removeTeams']);router[_0x9494('0x66')](_0x9494('0x11'),auth[_0x9494('0xc')](),controller[_0x9494('0x67')]);router['delete'](_0x9494('0x68'),auth[_0x9494('0xc')](),controller[_0x9494('0x69')]);router['delete']('/:id/mail_interactions',auth[_0x9494('0xc')](),controller[_0x9494('0x6a')]);router[_0x9494('0x66')](_0x9494('0x54'),auth[_0x9494('0xc')](),controller[_0x9494('0x6b')]);router[_0x9494('0x66')](_0x9494('0x56'),auth[_0x9494('0xc')](),controller[_0x9494('0x6c')]);router[_0x9494('0x66')](_0x9494('0x58'),auth['isAuthenticated'](),controller[_0x9494('0x6d')]);router['delete'](_0x9494('0x5a'),auth[_0x9494('0xc')](),controller[_0x9494('0x6e')]);router[_0x9494('0x66')](_0x9494('0x2f'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x9494('0x66')](_0x9494('0x31'),auth[_0x9494('0xc')](),controller[_0x9494('0x6f')]);router[_0x9494('0x66')](_0x9494('0x33'),auth['isAuthenticated'](),controller[_0x9494('0x70')]);router[_0x9494('0x66')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x9494('0x71')]);router[_0x9494('0x66')](_0x9494('0x35'),auth[_0x9494('0xc')](),controller[_0x9494('0x72')]);router[_0x9494('0x66')](_0x9494('0x37'),auth[_0x9494('0xc')](),controller[_0x9494('0x73')]);router[_0x9494('0x66')](_0x9494('0x38'),auth[_0x9494('0xc')](),controller[_0x9494('0x74')]);router[_0x9494('0x66')](_0x9494('0x3b'),auth['isAuthenticated'](),controller[_0x9494('0x75')]);module[_0x9494('0x76')]=router; \ No newline at end of file +var _0x4c3c=['getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addQueues','join','root','server/files/images/','format','%s-%s','now','originalname','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','removeTeams','delete','destroy','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4c3c,0x13f));var _0xc4c3=function(_0x507409,_0x869c56){_0x507409=_0x507409-0x0;var _0x2dc136=_0x4c3c[_0x507409];return _0x2dc136;};'use strict';var multer=require(_0xc4c3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc4c3('0x1'));var router=express[_0xc4c3('0x2')]();var fs_extra=require(_0xc4c3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc4c3('0x4'));var config=require(_0xc4c3('0x5'));var controller=require('./user.controller');router['get']('/',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x7')]);router[_0xc4c3('0x8')](_0xc4c3('0x9'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0xa')]);router[_0xc4c3('0x8')](_0xc4c3('0xb'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0xc')]);router[_0xc4c3('0x8')](_0xc4c3('0xd'),auth['isAuthenticated'](),controller[_0xc4c3('0xe')]);router[_0xc4c3('0x8')](_0xc4c3('0xf'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x10')]);router['get'](_0xc4c3('0x11'),controller[_0xc4c3('0x12')]);router[_0xc4c3('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xc4c3('0x13')]);router[_0xc4c3('0x8')](_0xc4c3('0x14'),auth[_0xc4c3('0x6')](),controller['getContacts']);router[_0xc4c3('0x8')](_0xc4c3('0x15'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x16')]);router[_0xc4c3('0x8')](_0xc4c3('0x17'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x18')]);router['get'](_0xc4c3('0x19'),auth['isAuthenticated'](),controller[_0xc4c3('0x1a')]);router[_0xc4c3('0x8')]('/:id/recordings',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x1b')]);router[_0xc4c3('0x8')](_0xc4c3('0x1c'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x1d')]);router[_0xc4c3('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0xc4c3('0x1e')]);router[_0xc4c3('0x8')](_0xc4c3('0x1f'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x20')]);router['get'](_0xc4c3('0x21'),auth['isAuthenticated'](),controller[_0xc4c3('0x22')]);router['get'](_0xc4c3('0x23'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x24')]);router[_0xc4c3('0x8')]('/:id/fax/interactions',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x25')]);router[_0xc4c3('0x8')](_0xc4c3('0x26'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x27')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xc4c3('0x28')]);router['get'](_0xc4c3('0x29'),auth[_0xc4c3('0x6')](),controller['getLists']);router[_0xc4c3('0x8')](_0xc4c3('0x2a'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x2b')]);router[_0xc4c3('0x8')](_0xc4c3('0x2c'),auth['isAuthenticated'](),controller[_0xc4c3('0x2d')]);router[_0xc4c3('0x8')](_0xc4c3('0x2e'),auth[_0xc4c3('0x6')](),controller['getFaxAccounts']);router[_0xc4c3('0x8')]('/:id/mail_accounts',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x2f')]);router[_0xc4c3('0x8')]('/:id/openchannel_accounts',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x30')]);router[_0xc4c3('0x8')](_0xc4c3('0x31'),auth['isAuthenticated'](),controller[_0xc4c3('0x32')]);router[_0xc4c3('0x8')]('/:id/chat_websites',auth[_0xc4c3('0x6')](),controller['getChatWebsites']);router[_0xc4c3('0x8')](_0xc4c3('0x33'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x34')]);router[_0xc4c3('0x8')](_0xc4c3('0x35'),auth['isAuthenticated'](),controller[_0xc4c3('0x36')]);router[_0xc4c3('0x8')]('/:id/scheduled_calls',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x37')]);router[_0xc4c3('0x8')](_0xc4c3('0x38'),auth['isAuthenticated'](),controller[_0xc4c3('0x39')]);router[_0xc4c3('0x3a')](_0xc4c3('0x14'),auth['isAuthenticated'](),controller['addContacts']);router[_0xc4c3('0x3a')]('/',auth[_0xc4c3('0x6')](),controller['create']);router[_0xc4c3('0x3a')](_0xc4c3('0x3b'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x3c')]);router['post'](_0xc4c3('0x15'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x3d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c3611,_0x2bb799,_0x13705e){_0x13705e(null,path[_0xc4c3('0x3e')](config[_0xc4c3('0x3f')],_0xc4c3('0x40')));},'filename':function(_0x13eb78,_0x34aa38,_0x5c30c4){_0x5c30c4(null,util[_0xc4c3('0x41')](_0xc4c3('0x42'),Date[_0xc4c3('0x43')](),_0x34aa38[_0xc4c3('0x44')]));}})});router[_0xc4c3('0x3a')](_0xc4c3('0x11'),upload['single']('file'),controller[_0xc4c3('0x45')]);router[_0xc4c3('0x3a')](_0xc4c3('0x46'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x47')]);router[_0xc4c3('0x3a')](_0xc4c3('0x48'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x49')]);router[_0xc4c3('0x3a')](_0xc4c3('0x4a'),auth[_0xc4c3('0x6')](),controller['pause']);router['post'](_0xc4c3('0x4b'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x4c')]);router[_0xc4c3('0x3a')]('/:id/teams',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x4d')]);router[_0xc4c3('0x3a')](_0xc4c3('0x4e'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x4f')]);router[_0xc4c3('0x3a')](_0xc4c3('0x50'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x51')]);router[_0xc4c3('0x3a')]('/:id/fax_interactions',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x52')]);router[_0xc4c3('0x3a')](_0xc4c3('0x53'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x54')]);router[_0xc4c3('0x3a')](_0xc4c3('0x55'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x56')]);router[_0xc4c3('0x3a')]('/:id/whatsapp_interactions',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x57')]);router['post'](_0xc4c3('0x2e'),auth['isAuthenticated'](),controller[_0xc4c3('0x58')]);router[_0xc4c3('0x3a')](_0xc4c3('0x59'),auth['isAuthenticated'](),controller[_0xc4c3('0x5a')]);router[_0xc4c3('0x3a')](_0xc4c3('0x5b'),auth[_0xc4c3('0x6')](),controller['addOpenchannelAccounts']);router[_0xc4c3('0x3a')](_0xc4c3('0x31'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x5c')]);router['post']('/:id/chat_websites',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x5d')]);router[_0xc4c3('0x3a')]('/:id/whatsapp_accounts',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x5e')]);router[_0xc4c3('0x3a')](_0xc4c3('0x35'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x5f')]);router['post']('/:id/api_key',auth['isAuthenticated'](),controller[_0xc4c3('0x60')]);router[_0xc4c3('0x61')](_0xc4c3('0xf'),auth['isAuthenticated'](),controller[_0xc4c3('0x62')]);router['put']('/:id/password',auth[_0xc4c3('0x6')](),controller['changePassword']);router['delete'](_0xc4c3('0x15'),auth['isAuthenticated'](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x63')]);router[_0xc4c3('0x64')]('/:id',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x65')]);router[_0xc4c3('0x64')](_0xc4c3('0x4e'),auth[_0xc4c3('0x6')](),controller['removeChatInteractions']);router[_0xc4c3('0x64')](_0xc4c3('0x50'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x66')]);router[_0xc4c3('0x64')](_0xc4c3('0x67'),auth['isAuthenticated'](),controller[_0xc4c3('0x68')]);router[_0xc4c3('0x64')](_0xc4c3('0x53'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x69')]);router[_0xc4c3('0x64')](_0xc4c3('0x55'),auth[_0xc4c3('0x6')](),controller['removeOpenchannelInteractions']);router[_0xc4c3('0x64')](_0xc4c3('0x6a'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x6b')]);router['delete'](_0xc4c3('0x2e'),auth['isAuthenticated'](),controller[_0xc4c3('0x6c')]);router[_0xc4c3('0x64')](_0xc4c3('0x59'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x6d')]);router['delete']('/:id/openchannel_accounts',auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x6e')]);router[_0xc4c3('0x64')](_0xc4c3('0x31'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x6f')]);router[_0xc4c3('0x64')](_0xc4c3('0x70'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x71')]);router['delete'](_0xc4c3('0x33'),auth['isAuthenticated'](),controller[_0xc4c3('0x72')]);router[_0xc4c3('0x64')](_0xc4c3('0x35'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x73')]);router[_0xc4c3('0x64')](_0xc4c3('0x38'),auth[_0xc4c3('0x6')](),controller[_0xc4c3('0x74')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index bb5b756..f9da0fd 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x1c50b7,_0x57209b){var _0x23e643=function(_0x498d02){while(--_0x498d02){_0x1c50b7['push'](_0x1c50b7['shift']());}};_0x23e643(++_0x57209b);}(_0x70e0,0x17b));var _0x070e=function(_0x2c1f55,_0x501fe3){_0x2c1f55=_0x2c1f55-0x0;var _0x23aa80=_0x70e0[_0x2c1f55];return _0x23aa80;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedd9=['rfc2833','info','shortinfo','inband','auto','yes','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','certificate','active','passive','actpass','nonat','update,nonat','DATE','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','rtcp_mux','dtlsenable','dtlssetup','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','getDataValue','fullname','BOOLEAN','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'];(function(_0x193306,_0x126c75){var _0x5eb382=function(_0x4ee5ab){while(--_0x4ee5ab){_0x193306['push'](_0x193306['shift']());}};_0x5eb382(++_0x126c75);}(_0xedd9,0xfc));var _0x9edd=function(_0x254b6c,_0x52a73e){_0x254b6c=_0x254b6c-0x0;var _0x1c3f87=_0xedd9[_0x254b6c];return _0x1c3f87;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var _=require(_0x9edd('0x2'));module[_0x9edd('0x3')]={'name':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3e6d3a){this[_0x9edd('0x6')]('name',_0x3e6d3a);this[_0x9edd('0x6')](_0x9edd('0x7'),_0x3e6d3a);},'comment':_0x9edd('0x8')},'fullname':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'set':function(_0x5319f7){this[_0x9edd('0x6')]('fullname',_0x5319f7);this[_0x9edd('0x6')](_0x9edd('0x9'),util[_0x9edd('0xa')](_0x9edd('0xb'),_0x5319f7,this['getDataValue'](_0x9edd('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'unique':_0x9edd('0xd'),'validate':{'isEmail':!![]},'set':function(_0x523026){if(_0x523026){this[_0x9edd('0x6')](_0x9edd('0xd'),_0x523026['toLowerCase']());}}},'role':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0xf'),_0x9edd('0x10'),_0x9edd('0x11'),_0x9edd('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':_0x9edd('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x9edd('0xc'),'set':function(_0x44fc7c){this[_0x9edd('0x6')](_0x9edd('0xc'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x14'),_0x44fc7c);this[_0x9edd('0x6')](_0x9edd('0x9'),util['format'](_0x9edd('0xb'),this[_0x9edd('0x15')](_0x9edd('0x16')),_0x44fc7c));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9edd('0x4')]},'mobile':{'type':Sequelize[_0x9edd('0x4')]},'address':{'type':Sequelize[_0x9edd('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9edd('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9edd('0x4')]},'online':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9edd('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9edd('0x19')},'ipaddr':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x9edd('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x1a'),'user',_0x9edd('0x1b')),'allowNull':!![],'defaultValue':_0x9edd('0x1a')},'context':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x9edd('0x1d'),_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x25'),'set':function(_0x5af178){this[_0x9edd('0x6')](_0x9edd('0x26'),_0x5af178?_0x5af178[_0x9edd('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9edd('0x26'))?this[_0x9edd('0x15')](_0x9edd('0x26'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x29')},'dtmfmode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x9edd('0x2c'),_0x9edd('0x2d'),_0x9edd('0x2e')),'allowNull':!![],'defaultValue':_0x9edd('0x2a')},'directmedia':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no','nonat',_0x9edd('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x6de835){this[_0x9edd('0x6')](_0x9edd('0x31'),_0x6de835?_0x6de835[_0x9edd('0x27')](','):null);},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x31'))?this[_0x9edd('0x15')](_0x9edd('0x31'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x32')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9edd('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9edd('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9edd('0x4')]},'disallow':{'type':Sequelize[_0x9edd('0x4')],'allowNull':![],'defaultValue':_0x9edd('0x33')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9edd('0x34'),'set':function(_0xcbd0ef){this[_0x9edd('0x6')]('allow',_0xcbd0ef?_0xcbd0ef[_0x9edd('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x35'))?this['getDataValue'](_0x9edd('0x35'))[_0x9edd('0x28')](';'):null;},'comment':_0x9edd('0x36')},'autoframing':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'set':function(_0x5bbdf8){this[_0x9edd('0x6')](_0x9edd('0x37'),_0x5bbdf8?_0x5bbdf8['join'](','):null);},'get':function(){return this[_0x9edd('0x15')]('insecure')?this['getDataValue'](_0x9edd('0x37'))[_0x9edd('0x28')](','):null;},'comment':_0x9edd('0x38')},'trustrpid':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![],'defaultValue':_0x9edd('0x3a')},'amaflags':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'busylevel':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no',_0x9edd('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x3c'),_0x9edd('0x3d'),_0x9edd('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9edd('0xe')]('uac',_0x9edd('0x3f')),'allowNull':!![],'defaultValue':_0x9edd('0x3f')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x9edd('0x2f')},'keepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x9edd('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x41'),_0x9edd('0x42'),_0x9edd('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9edd('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9edd('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9edd('0xe')](_0x9edd('0x2f'),'no',_0x9edd('0x44'),_0x9edd('0x30'),_0x9edd('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0,'set':function(_0x3e9a3e){this[_0x9edd('0x6')](_0x9edd('0x47'),_0x3e9a3e);var _0x5df1d7=this[_0x9edd('0x48')]({'plain':!![]});switch(_0x3e9a3e){case 0x0:case 0x1:var _0x507cce=_0x5df1d7[_0x9edd('0x26')]?_[_0x9edd('0x49')](_0x5df1d7[_0x9edd('0x26')])?_0x5df1d7['transport'][_0x9edd('0x27')]():_0x5df1d7['transport']:_0x9edd('0x25');if(_0x507cce===_0x9edd('0x4a')){_0x507cce='udp';}this[_0x9edd('0x6')]('transport',_0x507cce);this[_0x9edd('0x6')](_0x9edd('0x4b'),'no');this[_0x9edd('0x6')]('avpf',null);this[_0x9edd('0x6')](_0x9edd('0x4c'),null);this[_0x9edd('0x6')](_0x9edd('0x4d'),null);this[_0x9edd('0x6')]('dtlsenable',null);this['setDataValue'](_0x9edd('0x4e'),null);this[_0x9edd('0x6')]('dtlssetup',null);this['setDataValue']('dtlscertfile',null);this[_0x9edd('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x9edd('0x4f'),'no');break;case 0x2:this[_0x9edd('0x6')]('transport',_0x9edd('0x4a'));this[_0x9edd('0x6')](_0x9edd('0x4b'),'yes');this[_0x9edd('0x6')]('avpf',_0x9edd('0x2f'));this[_0x9edd('0x6')]('force_avp',_0x9edd('0x2f'));this[_0x9edd('0x6')]('icesupport',_0x9edd('0x2f'));this[_0x9edd('0x6')](_0x9edd('0x50'),_0x9edd('0x2f'));this['setDataValue'](_0x9edd('0x4e'),'no');this['setDataValue'](_0x9edd('0x51'),_0x9edd('0x43'));this[_0x9edd('0x6')]('dtlscertfile',_0x5df1d7[_0x9edd('0x52')]||_0x9edd('0x53'));this[_0x9edd('0x6')](_0x9edd('0x54'),_0x5df1d7[_0x9edd('0x54')]||_0x9edd('0x55'));this[_0x9edd('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x9edd('0x56')],'set':function(_0x3c7874){this[_0x9edd('0x6')](_0x9edd('0x57'),_0x3c7874?_0x3c7874[_0x9edd('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9edd('0x57'))?_[_0x9edd('0x58')](this[_0x9edd('0x15')]('permissions')[_0x9edd('0x28')](','),function(_0x29d70d){return parseInt(_0x29d70d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9edd('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9edd('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9edd('0x59')],'get':function(){return this[_0x9edd('0x15')](_0x9edd('0x5a'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9edd('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9edd('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x1eabcd){if(typeof _0x1eabcd===_0x9edd('0x5b')){var _0xef1397=_0x1eabcd==='1'?!![]:_0x1eabcd==='0'?![]:_0x1eabcd==='true'?!![]:_0x1eabcd===_0x9edd('0x5c')?![]:![];this[_0x9edd('0x6')](_0x9edd('0x5d'),_0xef1397);}else{this[_0x9edd('0x6')](_0x9edd('0x5d'),_0x1eabcd);}}},'blocked':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![],'set':function(_0x14fa8a){this['setDataValue'](_0x9edd('0x5e'),_0x14fa8a);if(_0x14fa8a===!![]){this[_0x9edd('0x6')]('blockedAt',moment());this[_0x9edd('0x6')](_0x9edd('0x5f'),0x0);}else{this['setDataValue'](_0x9edd('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0x9edd('0x46')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9edd('0x18')](0x5)[_0x9edd('0x61')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9edd('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9edd('0x18')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 74e2c22..284aa20 100644 --- a/server/api/user/user.controller.js +++ b/server/api/user/user.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4450=['addContacts','ids','internal','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','110','105','106','107','108','109','111','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','bulkCreate','Unauthorized','some','each','isEmpty','autoAssociation','map','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','get','SIP/%s','UserVoiceQueueRt','isArray','Queue:remove','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','existsSync','server/files/images/','download','join','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','where','merge','hasOwnProperty','List','Tags','color','tag','nolimit','getQueues','Queue','pick','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','set','%s%s','Pause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','Voice','getLists','CmList','getAgents','getVoiceQueues','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$or','$gt','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$notLike','$iLike','$contains','$any','CmHopper','firstName','lastName','Contact','dialActive','VoiceQueue','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','inbound','flatten','lower','col','toString','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','ringing','voiceStatus','slice','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','moment','util','path','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','redis','./user.socket','register','defaults','localhost','client','http','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','limit','undefined','count','Content-Range','json','update','then','emit','userNotification:recalc:','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','value','find','name','UserProfileResource','destroy','end','stack','index','User','rawAttributes','fieldName','type','key','includes','password','salt','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','openTabs','length','chat','rows','dataValues','fax','mail','openchannel','whatsapp','all','show','params','model','keys','filters','intersection','fields','options','sms','body','describe'];(function(_0x426234,_0xb3f87a){var _0x8c230e=function(_0x4e4f78){while(--_0x4e4f78){_0x426234['push'](_0x426234['shift']());}};_0x8c230e(++_0xb3f87a);}(_0x4450,0x135));var _0x0445=function(_0x559a91,_0x1c4e12){_0x559a91=_0x559a91-0x0;var _0x440eb1=_0x4450[_0x559a91];return _0x440eb1;};'use strict';var moment=require(_0x0445('0x0'));var BPromise=require('bluebird');var util=require(_0x0445('0x1'));var path=require(_0x0445('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0445('0x3'));var jayson=require(_0x0445('0x4'));var Redis=require(_0x0445('0x5'));var authService=require(_0x0445('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x0445('0x7'))(_0x0445('0x8'));var utils=require(_0x0445('0x9'));var config=require(_0x0445('0xa'));var licenseUtil=require(_0x0445('0xb'));var APIBadRequestError=require(_0x0445('0xc'))[_0x0445('0xd')];var APINotFoundError=require(_0x0445('0xc'))[_0x0445('0xe')];var APIHandleError=require(_0x0445('0xc'))[_0x0445('0xf')];var db=require(_0x0445('0x10'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0445('0x11')]));require(_0x0445('0x12'))[_0x0445('0x13')](socket);config[_0x0445('0x11')]=_[_0x0445('0x14')](config[_0x0445('0x11')],{'host':_0x0445('0x15'),'port':0x18eb});var client=jayson[_0x0445('0x16')][_0x0445('0x17')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4fa453,_0x2e85fd,_0x58c738,_0x1c5163){return new BPromise(function(_0x3a1e0e,_0x43d3a8){var _0x4282c9=_0x1c5163||client;return _0x4282c9['request'](_0x4fa453,_0x58c738)['then'](function(_0x1fd6b8){logger[_0x0445('0x18')](_0x0445('0x19'),_0x2e85fd,_0x0445('0x1a'));logger['debug'](_0x0445('0x1b'),_0x2e85fd,_0x0445('0x1a'),JSON['stringify'](_0x1fd6b8));if(_0x1fd6b8['error']){if(_0x1fd6b8[_0x0445('0x1c')][_0x0445('0x1d')]===0x1f4){logger[_0x0445('0x1c')]('User,\x20%s,\x20%s',_0x2e85fd,_0x1fd6b8[_0x0445('0x1c')]['message']);return _0x43d3a8(_0x1fd6b8['error'][_0x0445('0x1e')]);}logger['error'](_0x0445('0x19'),_0x2e85fd,_0x1fd6b8[_0x0445('0x1c')][_0x0445('0x1e')]);return _0x3a1e0e(_0x1fd6b8['error']['message']);}else{logger[_0x0445('0x18')]('User,\x20%s,\x20%s',_0x2e85fd,_0x0445('0x1a'));_0x3a1e0e(_0x1fd6b8[_0x0445('0x1f')][_0x0445('0x1e')]);}})[_0x0445('0x20')](function(_0x20029c){logger[_0x0445('0x1c')]('User,\x20%s,\x20%s',_0x2e85fd,_0x20029c);_0x43d3a8(_0x20029c);});});}function respondWithStatusCode(_0x5d830a,_0x373c58){_0x373c58=_0x373c58||0xcc;return function(_0x2b277c){if(_0x2b277c){return _0x5d830a[_0x0445('0x21')](_0x373c58);}return _0x5d830a[_0x0445('0x22')](_0x373c58)['end']();};}function respondWithResult(_0x102d68,_0x4902f6){_0x4902f6=_0x4902f6||0xc8;return function(_0x8eb4ff){if(_0x8eb4ff){return _0x102d68[_0x0445('0x22')](_0x4902f6)['json'](_0x8eb4ff);}};}function respondWithFilteredResult(_0x49aaf6,_0x22d9ff){return function(_0x195e2b){if(_0x195e2b){var _0x14f3f5=typeof _0x22d9ff[_0x0445('0x23')]==='undefined'&&typeof _0x22d9ff[_0x0445('0x24')]===_0x0445('0x25');var _0xdf0e79=_0x195e2b[_0x0445('0x26')];var _0x210491=_0x14f3f5?0x0:_0x22d9ff[_0x0445('0x23')];var _0x2659e3=_0x14f3f5?_0x195e2b[_0x0445('0x26')]:_0x22d9ff[_0x0445('0x23')]+_0x22d9ff[_0x0445('0x24')];var _0x499a13;if(_0x2659e3>=_0xdf0e79){_0x2659e3=_0xdf0e79;_0x499a13=0xc8;}else{_0x499a13=0xce;}_0x49aaf6[_0x0445('0x22')](_0x499a13);return _0x49aaf6['set'](_0x0445('0x27'),_0x210491+'-'+_0x2659e3+'/'+_0xdf0e79)[_0x0445('0x28')](_0x195e2b);}return null;};}function saveUpdates(_0x28d4da){return function(_0x27b649){if(_0x27b649){return _0x27b649[_0x0445('0x29')](_0x28d4da)[_0x0445('0x2a')](function(_0x54d02f){socket[_0x0445('0x2b')](_0x0445('0x2c')+_0x54d02f['id'],{});return _0x54d02f;});}return null;};}function removeEntity(_0x4c5e70){return function(_0x4a7b23){if(_0x4a7b23){return _0x4a7b23['destroy']()[_0x0445('0x2a')](function(){var _0x1ad78f=_0x4a7b23['get']({'plain':!![]});if(_0x1ad78f[_0x0445('0x2d')]===_0x0445('0x2e'))return;var _0x12437e=[{'name':_0x0445('0x2f'),'value':_0x0445('0x30'),'ignore':!![]},{'name':_0x0445('0x31'),'value':_0x0445('0x32'),'ignore':![]},{'name':_0x0445('0x33'),'value':_0x0445('0x34'),'ignore':![]}];var _0x3e6dff=_(_0x12437e)[_0x0445('0x35')](_0x0445('0x36'))['map'](_0x0445('0x37'))['value']();if(_['includes'](_0x3e6dff,_0x1ad78f[_0x0445('0x2d')])){return;}var _0x40e866=_[_0x0445('0x38')](_0x12437e,['value',_0x1ad78f['role']])[_0x0445('0x39')];return db[_0x0445('0x3a')][_0x0445('0x3b')]({'where':{'type':_0x40e866,'resourceId':_0x1ad78f['id']}})['then'](function(){return _0x4a7b23;});})[_0x0445('0x2a')](function(){_0x4c5e70[_0x0445('0x22')](0xcc)[_0x0445('0x3c')]();});}};}function handleEntityNotFound(_0x5fd06b){return function(_0x14b6a6){if(!_0x14b6a6){_0x5fd06b[_0x0445('0x21')](0x194);}return _0x14b6a6;};}function handleError(_0x4cbf9e,_0x1abe55){_0x1abe55=_0x1abe55||0x1f4;return function(_0x102f13){logger[_0x0445('0x1c')](_0x102f13[_0x0445('0x3d')]);if(_0x102f13[_0x0445('0x39')]){delete _0x102f13[_0x0445('0x39')];}_0x4cbf9e[_0x0445('0x22')](_0x1abe55)['send'](_0x102f13);};}exports[_0x0445('0x3e')]=function(_0x335866,_0x211222){var _0x5afa17={},_0x4cf860={'count':0x0,'rows':[]};var _0x3a9068=_(db[_0x0445('0x3f')][_0x0445('0x40')])['map'](function(_0x5ad5c5){return{'name':_0x5ad5c5[_0x0445('0x41')],'type':_0x5ad5c5[_0x0445('0x42')][_0x0445('0x43')]};})[_0x0445('0x35')](function(_0x45629f){return!_[_0x0445('0x44')]([_0x0445('0x45'),_0x0445('0x46')],_0x45629f['name']);})[_0x0445('0x37')]();_0x5afa17=qs['getOptions'](_0x3a9068,_0x335866);var _0x4a96fe={'where':_0x5afa17['where']};return db[_0x0445('0x3f')][_0x0445('0x26')](_0x4a96fe)[_0x0445('0x2a')](function(_0x54470a){_0x4cf860[_0x0445('0x26')]=_0x54470a;if(_0x335866['query'][_0x0445('0x47')]){_0x5afa17[_0x0445('0x48')]=[{'all':!![]}];}if(_0x335866[_0x0445('0x49')][_0x0445('0x4a')]===_0x0445('0x4b')){_0x5afa17[_0x0445('0x48')]=[{'model':db[_0x0445('0x4c')],'as':_0x0445('0x4a')}];}if(!_[_0x0445('0x44')](_0x5afa17[_0x0445('0x4d')],'id')){_0x5afa17[_0x0445('0x4d')][_0x0445('0x4e')]('id');}return db[_0x0445('0x3f')][_0x0445('0x4f')](_0x5afa17);})[_0x0445('0x2a')](function(_0x24b8cf){_0x4cf860['rows']=_0x24b8cf;if(_0x335866[_0x0445('0x49')][_0x0445('0x50')]==='true'){var _0x6564d8=[];for(var _0x5438ec=0x0;_0x5438ec<_0x4cf860['rows'][_0x0445('0x51')];_0x5438ec++){_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8['push'](get_open_tabs('sms',_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8['push'](get_open_tabs(_0x0445('0x55'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x4cf860[_0x0445('0x53')][_0x5438ec]['dataValues']));_0x6564d8['push'](get_open_tabs(_0x0445('0x57'),_0x4cf860['rows'][_0x5438ec][_0x0445('0x54')]));_0x6564d8[_0x0445('0x4e')](get_open_tabs(_0x0445('0x58'),_0x4cf860[_0x0445('0x53')][_0x5438ec][_0x0445('0x54')]));}return BPromise[_0x0445('0x59')](_0x6564d8)[_0x0445('0x2a')](function(){return _0x4cf860;});}else{return _0x4cf860;}})[_0x0445('0x2a')](respondWithFilteredResult(_0x211222,_0x5afa17))[_0x0445('0x20')](handleError(_0x211222,null));};exports[_0x0445('0x5a')]=function(_0x468bea,_0x140168){var _0x504f52={'raw':![],'where':{'id':_0x468bea[_0x0445('0x5b')]['id']}},_0x5a7f42={};_0x5a7f42[_0x0445('0x5c')]=_['differenceBy'](_[_0x0445('0x5d')](db[_0x0445('0x3f')][_0x0445('0x40')]),['password',_0x0445('0x46')]);_0x5a7f42[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x468bea['query']);_0x5a7f42[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x5a7f42['model'],_0x5a7f42[_0x0445('0x49')]);_0x504f52[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x5a7f42[_0x0445('0x5c')],qs['fields'](_0x468bea[_0x0445('0x49')][_0x0445('0x60')]));_0x504f52[_0x0445('0x4d')]=_0x504f52[_0x0445('0x4d')]['length']?_0x504f52[_0x0445('0x4d')]:_0x5a7f42['model'];if(_0x468bea[_0x0445('0x49')]['includeAll']){_0x504f52[_0x0445('0x48')]=[{'all':!![]}];}if(_0x468bea[_0x0445('0x49')][_0x0445('0x4a')]===_0x0445('0x4b')){_0x504f52['include']=[{'model':db[_0x0445('0x4c')],'as':_0x0445('0x4a')}];}_0x504f52=_['merge']({},_0x504f52,_0x468bea[_0x0445('0x61')]);if(!_[_0x0445('0x44')](_0x504f52['attributes'],'id')){_0x504f52[_0x0445('0x4d')][_0x0445('0x4e')]('id');}return db[_0x0445('0x3f')][_0x0445('0x38')](_0x504f52)['then'](handleEntityNotFound(_0x140168,null))[_0x0445('0x2a')](function(_0x1e06f2){var _0x30477f=[];values=_0x1e06f2;if(_0x468bea['query'][_0x0445('0x50')]===_0x0445('0x4b')){_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x1e06f2['dataValues']));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x62'),_0x1e06f2[_0x0445('0x54')]));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x57'),_0x1e06f2[_0x0445('0x54')]));_0x30477f['push'](get_open_tabs(_0x0445('0x58'),_0x1e06f2[_0x0445('0x54')]));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x55'),_0x1e06f2['dataValues']));_0x30477f[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x1e06f2[_0x0445('0x54')]));return BPromise['all'](_0x30477f);}else{return values;}})[_0x0445('0x2a')](function(){return values;})[_0x0445('0x2a')](respondWithResult(_0x140168,null))[_0x0445('0x20')](handleError(_0x140168,null));};exports[_0x0445('0x29')]=function(_0x3db4a3,_0x5436ec){if(_0x3db4a3['body']['id']){delete _0x3db4a3[_0x0445('0x63')]['id'];}delete _0x3db4a3[_0x0445('0x63')][_0x0445('0x2d')];return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3db4a3[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x5436ec,null))[_0x0445('0x2a')](saveUpdates(_0x3db4a3[_0x0445('0x63')],null))[_0x0445('0x2a')](respondWithResult(_0x5436ec,null))[_0x0445('0x20')](handleError(_0x5436ec,null));};exports['describe']=function(_0x57eec5,_0x533037){return db[_0x0445('0x3f')][_0x0445('0x64')]()[_0x0445('0x2a')](respondWithResult(_0x533037,null))['catch'](handleError(_0x533037,null));};exports[_0x0445('0x65')]=function(_0x203b66,_0x8ff745){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x203b66['params']['id']}})['then'](handleEntityNotFound(_0x8ff745,null))[_0x0445('0x2a')](function(_0xf8837c){if(_0xf8837c){return _0xf8837c[_0x0445('0x65')](_0x203b66[_0x0445('0x63')][_0x0445('0x66')],_['omit'](_0x203b66[_0x0445('0x63')],[_0x0445('0x66'),'id'])||{});}})['then'](respondWithResult(_0x8ff745,null))[_0x0445('0x20')](handleError(_0x8ff745,null));};function validateUser(_0x40fcaf){return new BPromise(function(_0x2d1575,_0x1f416b){if(_0x40fcaf[_0x0445('0x67')])return _0x2d1575(_0x40fcaf);return db['Setting'][_0x0445('0x68')](0x1)['then'](function(_0x156478){if(_0x156478[_0x0445('0x69')])authService['validatePasswordPattern'](_0x40fcaf[_0x0445('0x45')]);db[_0x0445('0x3f')][_0x0445('0x6a')](_0x0445('0x67'))[_0x0445('0x2a')](function(_0x1d7fb7){if(_[_0x0445('0x6b')](_0x1d7fb7)){_0x40fcaf['internal']=_0x156478[_0x0445('0x6c')]||0x1;return;}if(_['isNil'](_0x156478[_0x0445('0x6c')])||_0x156478[_0x0445('0x6c')]===_0x1d7fb7){_0x40fcaf['internal']=_0x1d7fb7+0x1;return;}if(_0x156478['min_internal']>_0x1d7fb7){_0x40fcaf[_0x0445('0x67')]=_0x156478[_0x0445('0x6c')];return;}return db[_0x0445('0x6d')]['query'](_0x0445('0x6e'),{'type':db['sequelize']['QueryTypes'][_0x0445('0x6f')]})[_0x0445('0x2a')](function(_0x141459){if(_0x141459&&_0x141459['length']){for(var _0x64bafa=0x0,_0x8c05d5=_0x141459['length'];_0x64bafa<_0x8c05d5&&_['isNil'](_0x40fcaf[_0x0445('0x67')]);_0x64bafa++){if(_0x156478[_0x0445('0x6c')]<=_0x141459[_0x64bafa][_0x0445('0x70')]){_0x40fcaf[_0x0445('0x67')]=_0x141459[_0x64bafa]['from'];}else if(_0x156478[_0x0445('0x6c')]>_0x141459[_0x64bafa][_0x0445('0x70')]&&_0x156478[_0x0445('0x6c')]<=_0x141459[_0x64bafa]['to']){_0x40fcaf['internal']=_0x156478[_0x0445('0x6c')];}}}if(_['isNil'](_0x40fcaf[_0x0445('0x67')])){_0x40fcaf[_0x0445('0x67')]=_0x1d7fb7+0x1;}return _0x2d1575(_0x40fcaf);});});})[_0x0445('0x20')](function(_0x537767){_0x1f416b(_0x537767);});});}function updateUser(_0xfa63d){return new BPromise(function(_0x358822,_0x14bc90){try{if(_0xfa63d[_0x0445('0x71')]){_0xfa63d[_0x0445('0x72')]=_0xfa63d['internal'];_0xfa63d[_0x0445('0x73')]={'mailbox':_0xfa63d['internal'],'password':_0xfa63d[_0x0445('0x45')],'fullname':_0xfa63d[_0x0445('0x74')],'email':_0xfa63d[_0x0445('0x75')]};}if(_0xfa63d['role']===_0x0445('0x32')){if(!_0xfa63d[_0x0445('0x76')])_0xfa63d[_0x0445('0x76')]=[_0x0445('0x77'),_0x0445('0x78'),'103','113',_0x0445('0x79'),'104',_0x0445('0x7a'),_0x0445('0x7b'),_0x0445('0x7c'),_0x0445('0x7d'),_0x0445('0x7e'),'100',_0x0445('0x7f'),_0x0445('0x80'),_0x0445('0x81')];}_0x358822(_0xfa63d);}catch(_0x527af3){_0x14bc90(_0x527af3);}});}exports[_0x0445('0x82')]=function(_0x32af1c,_0x283686){if(_0x32af1c['user'][_0x0445('0x2d')]==='agent')throw new Error('Unauthorized');if(_0x32af1c['body']['role']==='user'&&_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!==_0x0445('0x2e')){throw new Error(_0x0445('0x83'));}if(_0x32af1c['body'][_0x0445('0x2d')]==='admin'&&_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!=='admin'){throw new Error(_0x0445('0x84'));}return licenseUtil[_0x0445('0x85')]([_0x32af1c[_0x0445('0x63')]])[_0x0445('0x2a')](function(){return validateUser(_0x32af1c[_0x0445('0x63')]);})['then'](function(_0x51eeea){return updateUser(_0x51eeea)[_0x0445('0x2a')](function(_0x3960a9){if(_0x3960a9[_0x0445('0x2d')]==='admin'){_0x3960a9[_0x0445('0x86')]=_0x32af1c['user'][_0x0445('0x86')];delete _0x3960a9[_0x0445('0x87')];}return _0x3960a9;});})['then'](function(_0x5513f4){return db[_0x0445('0x3f')][_0x0445('0x82')](_0x5513f4,{'include':[{'model':db[_0x0445('0x73')],'as':'VoiceMail'}]});})[_0x0445('0x2a')](function(_0x17a094){if(_0x32af1c[_0x0445('0x63')]['role']===_0x0445('0x30'))return _0x17a094;if(_0x32af1c[_0x0445('0x30')][_0x0445('0x2d')]!==_0x0445('0x30'))return _0x17a094;return db[_0x0445('0x88')]['find']({'where':{'name':_0x17a094[_0x0445('0x2d')]===_0x0445('0x32')?_0x0445('0x31'):_0x0445('0x33'),'userProfileId':_0x32af1c[_0x0445('0x30')]['userProfileId']},'raw':!![]})[_0x0445('0x2a')](function(_0x5ad0f9){if(!_0x5ad0f9||_0x5ad0f9['autoAssociation']!=0x0)return _0x17a094;return db['UserProfileResource'][_0x0445('0x82')]({'name':_0x17a094['name'],'resourceId':_0x17a094['id'],'type':_0x5ad0f9[_0x0445('0x39')],'sectionId':_0x5ad0f9['id']},{})[_0x0445('0x2a')](function(){return _0x17a094;});})[_0x0445('0x20')](function(_0x10e81c){logger[_0x0445('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10e81c);throw _0x10e81c;});})[_0x0445('0x2a')](respondWithResult(_0x283686,0xc9))['catch'](handleError(_0x283686,null));};exports[_0x0445('0x89')]=function(_0x69dc37,_0x54d904){var _0x3cc4b1=_0x69dc37[_0x0445('0x63')];var _0x3fa221=[];if(_0x69dc37[_0x0445('0x30')]['role']===_0x0445('0x32'))throw new Error(_0x0445('0x8a'));if(_['some'](_0x3cc4b1,[_0x0445('0x2d'),_0x0445('0x30')])&&_0x69dc37['user'][_0x0445('0x2d')]!=='admin'){throw new Error(_0x0445('0x83'));}if(_[_0x0445('0x8b')](_0x3cc4b1,['role',_0x0445('0x2e')])&&_0x69dc37[_0x0445('0x30')]['role']!==_0x0445('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x0445('0x85')](_0x3cc4b1)[_0x0445('0x2a')](function(){return validateUser(_0x3cc4b1[0x0]);})[_0x0445('0x2a')](function(){for(var _0x57f7fc=0x1;_0x57f7fc<_0x3cc4b1[_0x0445('0x51')];_0x57f7fc++){var _0x35ffad=_0x3cc4b1[_0x57f7fc-0x1][_0x0445('0x67')];if(!_0x3cc4b1[_0x57f7fc][_0x0445('0x67')])_0x3cc4b1[_0x57f7fc][_0x0445('0x67')]=_0x35ffad+0x1;_0x3fa221[_0x0445('0x4e')](validateUser(_0x3cc4b1[_0x57f7fc]));}return BPromise[_0x0445('0x59')](_0x3fa221);})[_0x0445('0x2a')](function(){_0x3fa221=[];for(var _0x9bf9ff=0x0;_0x9bf9ff<_0x3cc4b1[_0x0445('0x51')];_0x9bf9ff++){_0x3fa221[_0x0445('0x4e')](updateUser(_0x3cc4b1[_0x9bf9ff]));}return BPromise[_0x0445('0x59')](_0x3fa221);})['then'](function(){return BPromise[_0x0445('0x8c')](_0x3cc4b1,function(_0x1a1cc1){return db[_0x0445('0x3f')][_0x0445('0x82')](_0x1a1cc1,{'include':[{'model':db['VoiceMail'],'as':_0x0445('0x73')}]})[_0x0445('0x2a')](function(_0x387cba){_0x1a1cc1['id']=_0x387cba['id'];return _0x1a1cc1;});});})[_0x0445('0x2a')](function(_0x37b2c9){if(_0x69dc37['body'][_0x0445('0x2d')]===_0x0445('0x30'))return _0x37b2c9;if(_0x69dc37[_0x0445('0x30')]['role']!==_0x0445('0x30'))return _0x37b2c9;var _0xaf0804=_[_0x0445('0x8b')](_0x37b2c9,function(_0xeba198){return _0xeba198[_0x0445('0x2d')]==='agent'||_0xeba198[_0x0445('0x2d')]==='telephone';});if(!_0xaf0804)return _0x37b2c9;return db['UserProfileSection'][_0x0445('0x4f')]({'where':{'name':{'$or':[_0x0445('0x31'),'Telephones']},'userProfileId':_0x69dc37['user']['userProfileId']},'raw':!![]})[_0x0445('0x2a')](function(_0x396261){if(_[_0x0445('0x8d')](_0x396261)||!_['some'](_0x396261,[_0x0445('0x8e'),0x0]))return _0x37b2c9;_0x3fa221=[];var _0x359e60=_(_0x396261)[_0x0445('0x8f')](function(_0x4d89e2){if(_0x4d89e2[_0x0445('0x8e')]===0x1)return;return _0x4d89e2[_0x0445('0x39')]===_0x0445('0x31')?_0x0445('0x32'):_0x0445('0x34');})['compact']()[_0x0445('0x37')]();for(var _0x472221=0x0;_0x472221<_0x37b2c9['length'];_0x472221++){if(!_[_0x0445('0x44')](_0x359e60,_0x37b2c9[_0x472221][_0x0445('0x2d')]))return;var _0x29767d=_0x37b2c9[_0x472221][_0x0445('0x2d')]===_0x0445('0x32')?'Agents':_0x0445('0x33');_0x3fa221[_0x0445('0x4e')](db['UserProfileResource'][_0x0445('0x82')]({'name':_0x37b2c9[_0x472221]['name'],'resourceId':_0x37b2c9[_0x472221]['id'],'type':_0x29767d,'sectionId':_[_0x0445('0x38')](_0x396261,['name',_0x29767d])['id']},{}));}return BPromise[_0x0445('0x59')](_0x3fa221);});})[_0x0445('0x2a')](respondWithResult(_0x54d904,0xc9))[_0x0445('0x20')](handleError(_0x54d904,null));};exports[_0x0445('0x90')]=function(_0x33e08e,_0x589a72){if(_0x33e08e[_0x0445('0x63')]['id']){delete _0x33e08e[_0x0445('0x63')]['id'];}return db['User'][_0x0445('0x38')]({'where':{'id':_0x33e08e[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](function(_0x2d1852){if(!_0x2d1852)return null;if(_0x2d1852['id']===_0x33e08e[_0x0445('0x30')]['id']){if(!_0x33e08e[_0x0445('0x63')][_0x0445('0x91')]||!_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x95'));}if(!_0x2d1852['authenticate'](_0x33e08e[_0x0445('0x63')][_0x0445('0x91')])){throw new db[(_0x0445('0x93'))]['ValidationError'](_0x0445('0x96'));}if(_0x33e08e['body'][_0x0445('0x91')]===_0x33e08e[_0x0445('0x63')]['newPassword']){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x97'));}}else if(_0x33e08e[_0x0445('0x30')][_0x0445('0x2d')]==='admin'){if(!_0x33e08e['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0x0445('0x98'));}}else if(_0x33e08e[_0x0445('0x30')][_0x0445('0x2d')]===_0x0445('0x30')){if(!_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]){throw new db[(_0x0445('0x93'))]['ValidationError'](_0x0445('0x98'));}if(_0x2d1852[_0x0445('0x2d')]!==_0x0445('0x32')){throw new db['Sequelize'][(_0x0445('0x94'))]('Unauthorized');}}else{throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0x8a'));}return _0x2d1852;})[_0x0445('0x2a')](handleEntityNotFound(_0x589a72,null))[_0x0445('0x2a')](function(_0x43b88f){return db[_0x0445('0x99')][_0x0445('0x9a')]({'attributes':['id','securePassword',_0x0445('0x9b'),_0x0445('0x9c')]})[_0x0445('0x2a')](function(_0x1150e7){if(_0x1150e7['securePassword'])authService[_0x0445('0x9d')](_0x33e08e[_0x0445('0x63')][_0x0445('0x92')]);if(!_0x1150e7['enforcePasswordHistory']||!_0x43b88f[_0x0445('0x9e')])return _0x43b88f;authService[_0x0445('0x9f')](_0x33e08e[_0x0445('0x63')][_0x0445('0x92')],_0x43b88f['previousPasswords'],_0x1150e7[_0x0445('0x9c')]);return _0x43b88f;})['then'](saveUpdates({'password':_0x33e08e[_0x0445('0x63')][_0x0445('0x92')],'passwordResetAt':_0x33e08e[_0x0445('0x30')]['id']==_0x33e08e[_0x0445('0x5b')]['id']?moment():null,'previousPasswords':authService[_0x0445('0xa0')](_0x33e08e[_0x0445('0x63')]['newPassword'],_0x43b88f['previousPasswords'])},null));})[_0x0445('0x2a')](respondWithResult(_0x589a72,null))[_0x0445('0x20')](handleError(_0x589a72,null));};exports[_0x0445('0xa1')]=function(_0x3a20e9,_0x13ac6d){var _0x4e8f1d=_0x3a20e9[_0x0445('0x63')][_0x0445('0xa2')];return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3a20e9[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),_0x0445('0xa3'),_0x0445('0xa4'),_0x0445('0xa5'),_0x0445('0xa6')]})['then'](handleEntityNotFound(_0x13ac6d,null))[_0x0445('0x2a')](function(_0x250a31){if(_0x250a31){if(!utils[_0x0445('0xa7')](_0x4e8f1d)){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}return _0x250a31[_0x0445('0xa9')+_[_0x0445('0xaa')](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xac')](_0x3a20e9[_0x0445('0x63')]['ids'],{'penalty':_0x3a20e9[_0x0445('0x63')][_0x0445('0xad')]||0x0})[_0x0445('0xae')](function(_0x109921){for(var _0xa731a1=0x0;_0xa731a1<_0x3a20e9[_0x0445('0x63')][_0x0445('0x66')][_0x0445('0x51')];_0xa731a1+=0x1){var _0x3717f0={'UserId':Number(_0x3a20e9['params']['id'])};_0x3717f0[_['capitalize'](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xaf')]=Number(_0x3a20e9[_0x0445('0x63')][_0x0445('0x66')][_0xa731a1]);socket['emit'](_0x0445('0x30')+_[_0x0445('0xaa')](_0x4e8f1d[_0x0445('0xab')]())+_0x0445('0xb0'),_0x3717f0);}return _0x109921;})[_0x0445('0x2a')](function(){if(_0x4e8f1d===_0x0445('0xb1')){return db['VoiceQueue'][_0x0445('0x4f')]({'where':{'id':_0x3a20e9['body'][_0x0445('0x66')]||[]},'raw':!![],'attributes':['id',_0x0445('0x39')]});}})[_0x0445('0x2a')](function(_0x202afe){var _0x4d0f08=_0x250a31[_0x0445('0xb2')]({'plain':!![]});var _0x293eee=[];if(_0x4e8f1d==='voice'&&_0x4d0f08['role']==='agent'&&_0x4d0f08['online']){for(var _0x26268d=0x0;_0x26268d<_0x202afe['length'];_0x26268d+=0x1){_0x293eee['push']({'membername':_0x4d0f08[_0x0445('0x39')],'UserId':_0x4d0f08['id'],'queue_name':_0x202afe[_0x26268d][_0x0445('0x39')],'VoiceQueueId':_0x202afe[_0x26268d]['id'],'interface':_['isNil'](_0x4d0f08['interface'])?util['format'](_0x0445('0xb3'),_0x4d0f08[_0x0445('0x39')]):_0x4d0f08[_0x0445('0xa6')],'paused':_0x4d0f08[_0x0445('0xa5')]||![],'penalty':_0x3a20e9[_0x0445('0x63')][_0x0445('0xad')]||0x0});}return BPromise[_0x0445('0x8c')](_0x293eee,function(_0x44fe37){return db[_0x0445('0xb4')]['upsert'](_0x44fe37);});}return _0x250a31;});}})[_0x0445('0x2a')](respondWithStatusCode(_0x13ac6d,null))[_0x0445('0x20')](handleError(_0x13ac6d,null));};exports['removeQueues']=function(_0xf79cd3,_0x175944){var _0x4d470a,_0x531b98;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0xf79cd3['params']['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x175944,null))['then'](function(_0xbff0db){if(_0xbff0db){_0x4d470a=_0xbff0db;if(!_0xf79cd3['query'][_0x0445('0xa2')]||!utils[_0x0445('0xa7')](_0xf79cd3[_0x0445('0x49')]['channel'])){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}return _0xbff0db['remove'+_['capitalize'](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')][_0x0445('0xab')]())+_0x0445('0xac')](_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')]);}})['then'](function(_0x46b6f8){if(_[_0x0445('0xb5')](_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')])){for(var _0x507627=0x0;_0x507627<_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')][_0x0445('0x51')];_0x507627+=0x1){_0x531b98={'UserId':Number(_0xf79cd3[_0x0445('0x5b')]['id'])};_0x531b98[_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')]['channel']['toLowerCase']())+'QueueId']=Number(_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')][_0x507627]);socket['emit'](_0x0445('0x30')+_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')][_0x0445('0xab')]())+_0x0445('0xb6'),_0x531b98);}}else{_0x531b98={'UserId':Number(_0xf79cd3[_0x0445('0x5b')]['id'])};_0x531b98[_['capitalize'](_0xf79cd3[_0x0445('0x49')]['channel'][_0x0445('0xab')]())+'QueueId']=Number(_0xf79cd3['query'][_0x0445('0x66')]);socket[_0x0445('0x2b')](_0x0445('0x30')+_[_0x0445('0xaa')](_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')]['toLowerCase']())+'Queue:remove',_0x531b98);}return _0x46b6f8;})['then'](function(){if(_0xf79cd3[_0x0445('0x49')][_0x0445('0xa2')]===_0x0445('0xb1')){return db[_0x0445('0xb4')]['destroy']({'where':{'UserId':_0xf79cd3[_0x0445('0x5b')]['id'],'VoiceQueueId':_0xf79cd3[_0x0445('0x49')][_0x0445('0x66')]},'individualHooks':!![]})[_0x0445('0x2a')](function(){return _0x4d470a;});}return _0x4d470a;})['then'](respondWithStatusCode(_0x175944,null))[_0x0445('0x20')](handleError(_0x175944,null));};exports['addAvatar']=function(_0x4a3cc9,_0x2a7637){_0x4a3cc9[_0x0445('0x63')][_0x0445('0xb7')]=_0x4a3cc9[_0x0445('0xb8')]['filename'];return db[_0x0445('0x3f')]['find']({'where':{'id':_0x4a3cc9[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2a7637,null))[_0x0445('0x2a')](saveUpdates(_0x4a3cc9['body'],null))[_0x0445('0x2a')](respondWithResult(_0x2a7637,null))[_0x0445('0x20')](handleError(_0x2a7637,null));};exports[_0x0445('0xb9')]=function(_0x3fa55e,_0x56a732){var _0x39e521=path['join'](config[_0x0445('0xba')],_0x0445('0xbb'));return db[_0x0445('0x3f')]['find']({'where':{'id':_0x3fa55e[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0xb7')],'raw':!![]})[_0x0445('0x2a')](handleEntityNotFound(_0x56a732,null))[_0x0445('0x2a')](function(_0x4f20d6){if(_0x4f20d6){if(_[_0x0445('0x6b')](_0x4f20d6[_0x0445('0xb7')])){return _0x56a732['download'](_0x39e521);}else{if(!fs[_0x0445('0xbc')](path['join'](config[_0x0445('0xba')],_0x0445('0xbd'),_0x4f20d6[_0x0445('0xb7')]))){return _0x56a732[_0x0445('0xbe')](_0x39e521);}return _0x56a732['download'](path[_0x0445('0xbf')](config[_0x0445('0xba')],_0x0445('0xbd'),_0x4f20d6[_0x0445('0xb7')]));}}})['catch'](handleError(_0x56a732,null));};exports['getOpenTabs']=function(_0x3a9249,_0x599f99){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3a9249[_0x0445('0x5b')]['id']},'attributes':['id']})[_0x0445('0x2a')](handleEntityNotFound(_0x599f99,null))['then'](function(_0x41db05){var _0x263f4b=[];values=_0x41db05[_0x0445('0x54')];_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x52'),_0x41db05['dataValues']));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x62'),_0x41db05[_0x0445('0x54')]));_0x263f4b['push'](get_open_tabs('openchannel',_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x58'),_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x55'),_0x41db05[_0x0445('0x54')]));_0x263f4b[_0x0445('0x4e')](get_open_tabs(_0x0445('0x56'),_0x41db05[_0x0445('0x54')]));return BPromise[_0x0445('0x59')](_0x263f4b);})['then'](function(_0x1cde52){if(_0x1cde52){var _0x2f2f1f=_[_0x0445('0x8f')](values[_0x0445('0xc0')],function(_0x473026){return{'channel':_0x0445('0xc1'),'id':_0x473026['id'],'createdAt':_0x473026[_0x0445('0xc2')]};});var _0x1939d2=_[_0x0445('0x8f')](values[_0x0445('0xc3')],function(_0x4e3fb8){return{'channel':_0x0445('0xc4'),'id':_0x4e3fb8['id'],'createdAt':_0x4e3fb8[_0x0445('0xc2')]};});var _0x195ad9=_[_0x0445('0x8f')](values[_0x0445('0xc5')],function(_0x47de4e){return{'channel':'OPENCHANNEL','id':_0x47de4e['id'],'createdAt':_0x47de4e[_0x0445('0xc2')]};});var _0x118512=_[_0x0445('0x8f')](values[_0x0445('0xc6')],function(_0x23a1c0){return{'channel':_0x0445('0xc7'),'id':_0x23a1c0['id'],'createdAt':_0x23a1c0['createdAt']};});var _0x1dab85=_['map'](values[_0x0445('0xc8')],function(_0x1dde2b){return{'channel':_0x0445('0xc9'),'id':_0x1dde2b['id'],'createdAt':_0x1dde2b[_0x0445('0xc2')]};});var _0x289e17=_[_0x0445('0x8f')](values[_0x0445('0xca')],function(_0x305560){return{'channel':_0x0445('0xcb'),'id':_0x305560['id'],'createdAt':_0x305560['createdAt']};});var _0x53ea7f=_[_0x0445('0xcc')](_0x2f2f1f,_0x1939d2,_0x195ad9,_0x118512,_0x1dab85,_0x289e17);var _0x6b190d={'count':_0x53ea7f[_0x0445('0x51')],'rows':_0x53ea7f};return _0x6b190d;}else return null;})[_0x0445('0x2a')](respondWithResult(_0x599f99,null))['catch'](handleError(_0x599f99,null));};exports[_0x0445('0xcd')]=function(_0x3668c5,_0x2c4ed6){var _0x4fa63a={};var _0x29aa64={};var _0x24dd39;var _0x1872b3;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x3668c5[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2c4ed6,null))[_0x0445('0x2a')](function(_0x76d6ef){if(_0x76d6ef){_0x24dd39=_0x76d6ef;_0x29aa64[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xce')]['rawAttributes']);_0x29aa64[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x3668c5['query']);_0x29aa64[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x29aa64['model'],_0x29aa64[_0x0445('0x49')]);_0x4fa63a['attributes']=_[_0x0445('0x5f')](_0x29aa64[_0x0445('0x5c')],qs['fields'](_0x3668c5['query']['fields']));_0x4fa63a['attributes']=_0x4fa63a['attributes'][_0x0445('0x51')]?_0x4fa63a[_0x0445('0x4d')]:_0x29aa64['model'];_0x4fa63a[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x3668c5[_0x0445('0x49')][_0x0445('0xd0')]);_0x4fa63a[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x3668c5['query'],_0x29aa64[_0x0445('0x5e')]));if(_0x3668c5[_0x0445('0x49')][_0x0445('0x35')]){_0x4fa63a[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x4fa63a[_0x0445('0xd1')],{'$or':_['map'](_0x4fa63a[_0x0445('0x4d')],function(_0xe12ffe){var _0x2483eb={};_0x2483eb[_0xe12ffe]={'$like':'%'+_0x3668c5[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x2483eb;})});}_0x4fa63a=_[_0x0445('0xd2')]({},_0x4fa63a,_0x3668c5[_0x0445('0x61')]);return _0x24dd39[_0x0445('0xcd')](_0x4fa63a);}})['then'](function(_0x589d30){if(_0x589d30){_0x1872b3=_0x589d30[_0x0445('0x51')];if(_0x3668c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0x47'))){_0x4fa63a[_0x0445('0x48')]=[{'model':db['CmList'],'as':_0x0445('0xd4'),'required':![]},{'model':db['Tag'],'as':_0x0445('0xd5'),'attributes':['id','name',_0x0445('0xd6')],'where':_0x3668c5[_0x0445('0x49')][_0x0445('0xd7')]?{'id':_0x3668c5['query'][_0x0445('0xd7')]}:undefined,'required':_0x3668c5['query']['tag']?!![]:![]}];}if(!_0x3668c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x4fa63a[_0x0445('0x24')]=qs['limit'](_0x3668c5[_0x0445('0x49')][_0x0445('0x24')]);_0x4fa63a[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x3668c5[_0x0445('0x49')]['offset']);}return _0x24dd39['getContacts'](_0x4fa63a);}})['then'](function(_0x3f3bcf){if(_0x3f3bcf){return _0x3f3bcf?{'count':_0x1872b3,'rows':_0x3f3bcf}:null;}})[_0x0445('0x2a')](respondWithResult(_0x2c4ed6,null))[_0x0445('0x20')](handleError(_0x2c4ed6,null));};exports[_0x0445('0xd9')]=function(_0x12a9c5,_0x5dbd7a){var _0x12931e;var _0x121801={};var _0x2964bd;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x12a9c5[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x5dbd7a,null))['then'](function(_0x473378){if(!utils[_0x0445('0xa7')](_0x12a9c5['query'][_0x0445('0xa2')])){throw new db[(_0x0445('0x93'))]['ValidationError']('Unknown\x20channel');}_0x12931e=_0x473378;var _0xe35c93={};_0xe35c93[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')]['channel'])+_0x0445('0xda')][_0x0445('0x40')]);_0xe35c93[_0x0445('0x49')]=_['keys'](_0x12a9c5['query']);_0xe35c93[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0xe35c93[_0x0445('0x5c')],_0xe35c93[_0x0445('0x49')]);_0x121801[_0x0445('0x4d')]=_['intersection'](_0xe35c93[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x12a9c5[_0x0445('0x49')][_0x0445('0x60')]));_0x121801[_0x0445('0x4d')]=_0x121801[_0x0445('0x4d')][_0x0445('0x51')]?_0x121801[_0x0445('0x4d')]:_0xe35c93['model'];_0x121801[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x12a9c5['query']['sort']);_0x121801[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x12a9c5['query'],_0xe35c93['filters']));if(_0x12a9c5[_0x0445('0x49')][_0x0445('0x35')]){_0x121801[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x121801['where'],{'$or':_['map'](_0x121801['attributes'],function(_0x2aeb0d){var _0x2b6d06={};_0x2b6d06[_0x2aeb0d]={'$like':'%'+_0x12a9c5['query']['filter']+'%'};return _0x2b6d06;})});}_0x121801=_[_0x0445('0xd2')]({},_0x121801,_0x12a9c5[_0x0445('0x61')]);switch(_0x12931e[_0x0445('0x2d')]){case'admin':return db[_['capitalize'](_0x12a9c5['query']['channel'])+_0x0445('0xda')][_0x0445('0x4f')](_0x121801);case _0x0445('0x30'):case _0x0445('0x32'):return _0x12931e[_0x0445('0xb2')+_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')][_0x0445('0xa2')])+_0x0445('0xac')](_0x121801);default:throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))]('Unknown\x20role');}})[_0x0445('0x2a')](function(_0x568aa1){_0x2964bd=_0x568aa1[_0x0445('0x51')];if(!_0x12a9c5[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x121801[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x12a9c5['query'][_0x0445('0x24')]);_0x121801[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x12a9c5['query'][_0x0445('0x23')]);}switch(_0x12931e['role']){case _0x0445('0x2e'):return db[_[_0x0445('0xaa')](_0x12a9c5['query'][_0x0445('0xa2')])+_0x0445('0xda')]['findAll'](_0x121801);case'user':case _0x0445('0x32'):return _0x12931e[_0x0445('0xb2')+_[_0x0445('0xaa')](_0x12a9c5[_0x0445('0x49')][_0x0445('0xa2')])+_0x0445('0xac')](_0x121801);}})['then'](function(_0x375f46){return{'count':_0x2964bd,'rows':_0x375f46};})[_0x0445('0x2a')](respondWithResult(_0x5dbd7a,null))[_0x0445('0x20')](handleError(_0x5dbd7a,null));};exports[_0x0445('0xdc')]=function(_0x2f30cf,_0x29037e){var _0x3e0ed4={};var _0x38617={};var _0xa5f950;var _0x32bcf8;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x2f30cf[_0x0445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x29037e,null))[_0x0445('0x2a')](function(_0x2685ab){if(_0x2685ab){_0xa5f950=_0x2685ab;_0x38617['model']=_[_0x0445('0x5d')](db[_0x0445('0xb4')][_0x0445('0x40')]);_0x38617['query']=_[_0x0445('0x5d')](_0x2f30cf['query']);_0x38617['filters']=_[_0x0445('0x5f')](_0x38617[_0x0445('0x5c')],_0x38617['query']);_0x3e0ed4[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x38617[_0x0445('0x5c')],qs['fields'](_0x2f30cf[_0x0445('0x49')][_0x0445('0x60')]));_0x3e0ed4[_0x0445('0x4d')]=_0x3e0ed4['attributes'][_0x0445('0x51')]?_0x3e0ed4[_0x0445('0x4d')]:_0x38617[_0x0445('0x5c')];_0x3e0ed4[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x2f30cf[_0x0445('0x49')][_0x0445('0xd0')]);_0x3e0ed4[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x2f30cf['query'],_0x38617[_0x0445('0x5e')]));if(_0x2f30cf[_0x0445('0x49')][_0x0445('0x35')]){_0x3e0ed4[_0x0445('0xd1')]=_['merge'](_0x3e0ed4['where'],{'$or':_['map'](_0x3e0ed4[_0x0445('0x4d')],function(_0x7202e8){var _0x58770b={};_0x58770b[_0x7202e8]={'$like':'%'+_0x2f30cf[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x58770b;})});}_0x3e0ed4=_[_0x0445('0xd2')]({},_0x3e0ed4,_0x2f30cf['options']);return _0xa5f950[_0x0445('0xdc')](_0x3e0ed4);}})['then'](function(_0x551835){if(_0x551835){_0x32bcf8=_0x551835['length'];if(!_0x2f30cf[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x3e0ed4['limit']=qs[_0x0445('0x24')](_0x2f30cf['query'][_0x0445('0x24')]);_0x3e0ed4[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x2f30cf[_0x0445('0x49')][_0x0445('0x23')]);}return _0xa5f950[_0x0445('0xdc')](_0x3e0ed4);}})['then'](function(_0x3e3ba7){if(_0x3e3ba7){return _0x3e3ba7?{'count':_0x32bcf8,'rows':_0x3e3ba7}:null;}})[_0x0445('0x2a')](respondWithResult(_0x29037e,null))[_0x0445('0x20')](handleError(_0x29037e,null));};exports[_0x0445('0xdd')]=function(_0x580bbd,_0x1a1152){var _0x4b0fa9={};var _0x469afc={};var _0x56d16d;var _0x480f44;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x580bbd[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x1a1152,null))[_0x0445('0x2a')](function(_0x4e186e){if(_0x4e186e){_0x56d16d=_0x4e186e;_0x469afc[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xde')][_0x0445('0x40')]);_0x469afc[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x580bbd[_0x0445('0x49')]);_0x469afc['filters']=_[_0x0445('0x5f')](_0x469afc[_0x0445('0x5c')],_0x469afc[_0x0445('0x49')]);_0x4b0fa9['attributes']=_[_0x0445('0x5f')](_0x469afc['model'],qs[_0x0445('0x60')](_0x580bbd['query']['fields']));_0x4b0fa9[_0x0445('0x4d')]=_0x4b0fa9['attributes'][_0x0445('0x51')]?_0x4b0fa9['attributes']:_0x469afc['model'];_0x4b0fa9[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x580bbd[_0x0445('0x49')][_0x0445('0xd0')]);_0x4b0fa9[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x580bbd[_0x0445('0x49')],_0x469afc['filters']));if(_0x580bbd['query'][_0x0445('0x35')]){_0x4b0fa9['where']=_[_0x0445('0xd2')](_0x4b0fa9[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x4b0fa9[_0x0445('0x4d')],function(_0x5aa166){var _0x52dd35={};_0x52dd35[_0x5aa166]={'$like':'%'+_0x580bbd['query'][_0x0445('0x35')]+'%'};return _0x52dd35;})});}_0x4b0fa9=_[_0x0445('0xd2')]({},_0x4b0fa9,_0x580bbd[_0x0445('0x61')]);return _0x56d16d['getGroups'](_0x4b0fa9);}})['then'](function(_0x54cea6){if(_0x54cea6){_0x480f44=_0x54cea6['length'];if(!_0x580bbd[_0x0445('0x49')][_0x0445('0xd3')]('nolimit')){_0x4b0fa9[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x580bbd[_0x0445('0x49')]['limit']);_0x4b0fa9[_0x0445('0x23')]=qs['offset'](_0x580bbd['query']['offset']);}return _0x56d16d[_0x0445('0xdd')](_0x4b0fa9);}})[_0x0445('0x2a')](function(_0x1f6519){if(_0x1f6519){return _0x1f6519?{'count':_0x480f44,'rows':_0x1f6519}:null;}})['then'](respondWithResult(_0x1a1152,null))[_0x0445('0x20')](handleError(_0x1a1152,null));};exports[_0x0445('0xdf')]=function(_0x4aaed9,_0x33a30c){var _0x1d7540={'raw':!![],'where':{}};var _0x3088e5={};var _0x6a473e={'count':0x0,'rows':[]};return db['User'][_0x0445('0x9a')]({'where':{'id':_0x4aaed9['params']['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x33a30c,null))['then'](function(_0xe22f96){if(_0xe22f96){_0x3088e5[_0x0445('0x5c')]=_['keys'](db['VoiceRecording'][_0x0445('0x40')]);_0x3088e5[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x4aaed9['query']);_0x3088e5[_0x0445('0x5e')]=_['intersection'](_0x3088e5[_0x0445('0x5c')],_0x3088e5[_0x0445('0x49')]);_0x1d7540['attributes']=_[_0x0445('0x5f')](_0x3088e5[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x4aaed9[_0x0445('0x49')][_0x0445('0x60')]));_0x1d7540['attributes']=_0x1d7540[_0x0445('0x4d')][_0x0445('0x51')]?_0x1d7540[_0x0445('0x4d')]:_0x3088e5[_0x0445('0x5c')];if(!_0x4aaed9[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x1d7540[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x4aaed9[_0x0445('0x49')]['limit']);_0x1d7540[_0x0445('0x23')]=qs['offset'](_0x4aaed9['query'][_0x0445('0x23')]);}_0x1d7540['order']=qs[_0x0445('0xd0')](_0x4aaed9[_0x0445('0x49')][_0x0445('0xd0')]);_0x1d7540[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x4aaed9[_0x0445('0x49')],_0x3088e5['filters']));_0x1d7540['where'][_0x0445('0xe0')]=_0xe22f96['id'];if(_0x4aaed9[_0x0445('0x49')]['filter']){_0x1d7540[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x1d7540[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x1d7540['attributes'],function(_0x58236a){var _0x4929a9={};_0x4929a9[_0x58236a]={'$like':'%'+_0x4aaed9['query'][_0x0445('0x35')]+'%'};return _0x4929a9;})});}_0x1d7540=_[_0x0445('0xd2')]({},_0x1d7540,_0x4aaed9[_0x0445('0x61')]);return db[_0x0445('0xe1')]['count']({'where':_0x1d7540['where']})[_0x0445('0x2a')](function(_0x5653be){_0x6a473e[_0x0445('0x26')]=_0x5653be;if(_0x4aaed9['query'][_0x0445('0x47')]){_0x1d7540['include']=[{'all':!![]}];}return db[_0x0445('0xe1')][_0x0445('0x4f')](_0x1d7540);})[_0x0445('0x2a')](function(_0x3a0aeb){_0x6a473e[_0x0445('0x53')]=_0x3a0aeb;return _0x6a473e;});}})['then'](respondWithFilteredResult(_0x33a30c,_0x1d7540))[_0x0445('0x20')](handleError(_0x33a30c,null));};exports[_0x0445('0xe2')]=function(_0x1e499d,_0x56c3e7){var _0x54dd86={'raw':!![],'where':{}};var _0x54ae54={};var _0x3ffe4d={'count':0x0,'rows':[]};return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x1e499d[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x56c3e7,null))['then'](function(_0x5f41cf){if(_0x5f41cf){_0x54ae54[_0x0445('0x5c')]=_[_0x0445('0x5d')](db['ScreenRecording']['rawAttributes']);_0x54ae54[_0x0445('0x49')]=_['keys'](_0x1e499d[_0x0445('0x49')]);_0x54ae54[_0x0445('0x5e')]=_['intersection'](_0x54ae54[_0x0445('0x5c')],_0x54ae54[_0x0445('0x49')]);_0x54dd86['attributes']=_[_0x0445('0x5f')](_0x54ae54[_0x0445('0x5c')],qs['fields'](_0x1e499d[_0x0445('0x49')][_0x0445('0x60')]));_0x54dd86['attributes']=_0x54dd86[_0x0445('0x4d')][_0x0445('0x51')]?_0x54dd86['attributes']:_0x54ae54[_0x0445('0x5c')];if(!_0x1e499d['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0x54dd86[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x1e499d['query'][_0x0445('0x24')]);_0x54dd86[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x1e499d[_0x0445('0x49')]['offset']);}_0x54dd86[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x1e499d[_0x0445('0x49')][_0x0445('0xd0')]);_0x54dd86[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x1e499d['query'],_0x54ae54[_0x0445('0x5e')]));_0x54dd86[_0x0445('0xd1')][_0x0445('0xe0')]=_0x5f41cf['id'];if(_0x1e499d[_0x0445('0x49')]['filter']){_0x54dd86[_0x0445('0xd1')]=_['merge'](_0x54dd86[_0x0445('0xd1')],{'$or':_['map'](_0x54dd86['attributes'],function(_0x5d7025){var _0x1fb06a={};_0x1fb06a[_0x5d7025]={'$like':'%'+_0x1e499d[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x1fb06a;})});}_0x54dd86=_[_0x0445('0xd2')]({},_0x54dd86,_0x1e499d[_0x0445('0x61')]);return db[_0x0445('0xe3')]['count']({'where':_0x54dd86[_0x0445('0xd1')]})[_0x0445('0x2a')](function(_0x57b7c6){_0x3ffe4d[_0x0445('0x26')]=_0x57b7c6;if(_0x1e499d['query'][_0x0445('0x47')]){_0x54dd86[_0x0445('0x48')]=[{'all':!![]}];}return db[_0x0445('0xe3')][_0x0445('0x4f')](_0x54dd86);})['then'](function(_0x4ee4bf){_0x3ffe4d[_0x0445('0x53')]=_0x4ee4bf;return _0x3ffe4d;});}})['then'](respondWithFilteredResult(_0x56c3e7,_0x54dd86))['catch'](handleError(_0x56c3e7,null));};exports['getChatInteractions']=function(_0x5594b5,_0x30b5fc){var _0x3de9f6={};var _0x3cf29b={};var _0x121416;var _0x4bfea6;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x5594b5[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x30b5fc,null))['then'](function(_0x2ab7df){if(_0x2ab7df){_0x121416=_0x2ab7df;_0x3cf29b[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xe4')][_0x0445('0x40')]);_0x3cf29b[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x5594b5[_0x0445('0x49')]);_0x3cf29b[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x3cf29b[_0x0445('0x5c')],_0x3cf29b[_0x0445('0x49')]);_0x3de9f6[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x3cf29b[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x5594b5['query'][_0x0445('0x60')]));_0x3de9f6[_0x0445('0x4d')]=_0x3de9f6[_0x0445('0x4d')][_0x0445('0x51')]?_0x3de9f6[_0x0445('0x4d')]:_0x3cf29b[_0x0445('0x5c')];_0x3de9f6[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x5594b5[_0x0445('0x49')][_0x0445('0xd0')]);_0x3de9f6[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x5594b5['query'],_0x3cf29b['filters']));if(_0x5594b5[_0x0445('0x49')][_0x0445('0x35')]){_0x3de9f6[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x3de9f6[_0x0445('0xd1')],{'$or':_['map'](_0x3de9f6[_0x0445('0x4d')],function(_0x36a5ad){var _0xdf435a={};_0xdf435a[_0x36a5ad]={'$like':'%'+_0x5594b5[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0xdf435a;})});}_0x3de9f6=_['merge']({},_0x3de9f6,_0x5594b5[_0x0445('0x61')]);return _0x121416[_0x0445('0xe5')](_0x3de9f6);}})[_0x0445('0x2a')](function(_0x543c6c){if(_0x543c6c){_0x4bfea6=_0x543c6c[_0x0445('0x51')];if(!_0x5594b5[_0x0445('0x49')]['hasOwnProperty'](_0x0445('0xd8'))){_0x3de9f6['limit']=qs[_0x0445('0x24')](_0x5594b5[_0x0445('0x49')][_0x0445('0x24')]);_0x3de9f6[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x5594b5[_0x0445('0x49')][_0x0445('0x23')]);}return _0x121416[_0x0445('0xe5')](_0x3de9f6);}})[_0x0445('0x2a')](function(_0x36fb99){if(_0x36fb99){return _0x36fb99?{'count':_0x4bfea6,'rows':_0x36fb99}:null;}})[_0x0445('0x2a')](respondWithResult(_0x30b5fc,null))[_0x0445('0x20')](handleError(_0x30b5fc,null));};exports[_0x0445('0xe6')]=function(_0x20bd52,_0xb53dab){var _0x9639a6={};var _0x44dce7={};var _0x33264a;var _0x2926be;return db['User']['findOne']({'where':{'id':_0x20bd52[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0xb53dab,null))['then'](function(_0x1e6362){if(_0x1e6362){_0x33264a=_0x1e6362;_0x44dce7[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xe7')]['rawAttributes']);_0x44dce7[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x20bd52[_0x0445('0x49')]);_0x44dce7[_0x0445('0x5e')]=_['intersection'](_0x44dce7[_0x0445('0x5c')],_0x44dce7[_0x0445('0x49')]);_0x9639a6[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x44dce7[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x20bd52[_0x0445('0x49')]['fields']));_0x9639a6[_0x0445('0x4d')]=_0x9639a6['attributes']['length']?_0x9639a6[_0x0445('0x4d')]:_0x44dce7[_0x0445('0x5c')];_0x9639a6[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x20bd52['query'][_0x0445('0xd0')]);_0x9639a6['where']=qs[_0x0445('0x5e')](_['pick'](_0x20bd52[_0x0445('0x49')],_0x44dce7[_0x0445('0x5e')]));if(_0x20bd52['query'][_0x0445('0x35')]){_0x9639a6[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x9639a6[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x9639a6[_0x0445('0x4d')],function(_0x5c76ab){var _0x281f10={};_0x281f10[_0x5c76ab]={'$like':'%'+_0x20bd52[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x281f10;})});}_0x9639a6=_[_0x0445('0xd2')]({},_0x9639a6,_0x20bd52[_0x0445('0x61')]);return _0x33264a[_0x0445('0xe6')](_0x9639a6);}})[_0x0445('0x2a')](function(_0x483180){if(_0x483180){_0x2926be=_0x483180['length'];if(!_0x20bd52['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0x9639a6[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x20bd52['query']['limit']);_0x9639a6[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x20bd52[_0x0445('0x49')][_0x0445('0x23')]);}return _0x33264a['getOpenchannelInteractions'](_0x9639a6);}})[_0x0445('0x2a')](function(_0x15253a){if(_0x15253a){return _0x15253a?{'count':_0x2926be,'rows':_0x15253a}:null;}})[_0x0445('0x2a')](respondWithResult(_0xb53dab,null))[_0x0445('0x20')](handleError(_0xb53dab,null));};exports[_0x0445('0xe8')]=function(_0x56ec4d,_0x1949a6){var _0xb2b697={'raw':!![],'where':{}};var _0x535a8c={};var _0x388395={'count':0x0,'rows':[]};return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x56ec4d[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x1949a6,null))[_0x0445('0x2a')](function(_0x820e31){if(_0x820e31){_0x535a8c[_0x0445('0x5c')]=_['keys'](db[_0x0445('0xe9')][_0x0445('0x40')]);_0x535a8c[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x56ec4d[_0x0445('0x49')]);_0x535a8c['filters']=_[_0x0445('0x5f')](_0x535a8c['model'],_0x535a8c[_0x0445('0x49')]);_0xb2b697[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x535a8c[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x56ec4d[_0x0445('0x49')]['fields']));_0xb2b697[_0x0445('0x4d')]=_0xb2b697[_0x0445('0x4d')][_0x0445('0x51')]?_0xb2b697[_0x0445('0x4d')]:_0x535a8c[_0x0445('0x5c')];if(!_0x56ec4d['query'][_0x0445('0xd3')](_0x0445('0xd8'))){_0xb2b697['limit']=qs['limit'](_0x56ec4d[_0x0445('0x49')][_0x0445('0x24')]);_0xb2b697[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x56ec4d[_0x0445('0x49')][_0x0445('0x23')]);}_0xb2b697[_0x0445('0xcf')]=qs['sort'](_0x56ec4d[_0x0445('0x49')][_0x0445('0xd0')]);_0xb2b697[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x56ec4d[_0x0445('0x49')],_0x535a8c[_0x0445('0x5e')]));_0xb2b697[_0x0445('0xd1')][_0x0445('0xe0')]=_0x820e31['id'];if(_0x56ec4d[_0x0445('0x49')][_0x0445('0x35')]){_0xb2b697[_0x0445('0xd1')]=_['merge'](_0xb2b697['where'],{'$or':_['map'](_0xb2b697['attributes'],function(_0x56085d){var _0x2723ac={};_0x2723ac[_0x56085d]={'$like':'%'+_0x56ec4d[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x2723ac;})});}_0xb2b697=_[_0x0445('0xd2')]({},_0xb2b697,_0x56ec4d[_0x0445('0x61')]);return db[_0x0445('0xe9')][_0x0445('0x26')]({'where':_0xb2b697['where']})[_0x0445('0x2a')](function(_0x44e611){_0x388395[_0x0445('0x26')]=_0x44e611;if(_0x56ec4d[_0x0445('0x49')][_0x0445('0x47')]){_0xb2b697[_0x0445('0x48')]=[{'all':!![]}];}return db[_0x0445('0xe9')][_0x0445('0x4f')](_0xb2b697);})[_0x0445('0x2a')](function(_0x15cf79){_0x388395[_0x0445('0x53')]=_0x15cf79;return _0x388395;});}})[_0x0445('0x2a')](respondWithFilteredResult(_0x1949a6,_0xb2b697))['catch'](handleError(_0x1949a6,null));};exports[_0x0445('0xea')]=function(_0x27e81a,_0x355ebd){var _0x10b1e7={};var _0x1c61d7={};var _0xc7fc81;var _0x47bb3f;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x27e81a[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x355ebd,null))[_0x0445('0x2a')](function(_0x5dc31a){if(_0x5dc31a){_0xc7fc81=_0x5dc31a;_0x1c61d7[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xeb')][_0x0445('0x40')]);_0x1c61d7[_0x0445('0x49')]=_['keys'](_0x27e81a[_0x0445('0x49')]);_0x1c61d7[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x1c61d7[_0x0445('0x5c')],_0x1c61d7[_0x0445('0x49')]);_0x10b1e7[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x1c61d7[_0x0445('0x5c')],qs['fields'](_0x27e81a[_0x0445('0x49')][_0x0445('0x60')]));_0x10b1e7['attributes']=_0x10b1e7[_0x0445('0x4d')]['length']?_0x10b1e7[_0x0445('0x4d')]:_0x1c61d7[_0x0445('0x5c')];_0x10b1e7[_0x0445('0xcf')]=qs['sort'](_0x27e81a['query'][_0x0445('0xd0')]);_0x10b1e7[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x27e81a[_0x0445('0x49')],_0x1c61d7['filters']));if(_0x27e81a[_0x0445('0x49')][_0x0445('0x35')]){_0x10b1e7[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x10b1e7[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x10b1e7[_0x0445('0x4d')],function(_0x199d95){var _0x4b0773={};_0x4b0773[_0x199d95]={'$like':'%'+_0x27e81a[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x4b0773;})});}_0x10b1e7=_[_0x0445('0xd2')]({},_0x10b1e7,_0x27e81a[_0x0445('0x61')]);return _0xc7fc81[_0x0445('0xea')](_0x10b1e7);}})['then'](function(_0x1ec14f){if(_0x1ec14f){_0x47bb3f=_0x1ec14f[_0x0445('0x51')];if(!_0x27e81a[_0x0445('0x49')][_0x0445('0xd3')]('nolimit')){_0x10b1e7[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x27e81a['query'][_0x0445('0x24')]);_0x10b1e7[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x27e81a[_0x0445('0x49')][_0x0445('0x23')]);}return _0xc7fc81[_0x0445('0xea')](_0x10b1e7);}})[_0x0445('0x2a')](function(_0x1a73d2){if(_0x1a73d2){return _0x1a73d2?{'count':_0x47bb3f,'rows':_0x1a73d2}:null;}})[_0x0445('0x2a')](respondWithResult(_0x355ebd,null))[_0x0445('0x20')](handleError(_0x355ebd,null));};exports[_0x0445('0xec')]=function(_0x998a86,_0x134583){var _0x530618={};var _0x533cee={};var _0x10bd19;var _0x590a15;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x998a86[_0x0445('0x5b')]['id']}})['then'](handleEntityNotFound(_0x134583,null))['then'](function(_0x5af57d){if(_0x5af57d){_0x10bd19=_0x5af57d;_0x533cee[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0xed')][_0x0445('0x40')]);_0x533cee[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x998a86[_0x0445('0x49')]);_0x533cee[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x533cee[_0x0445('0x5c')],_0x533cee[_0x0445('0x49')]);_0x530618['attributes']=_[_0x0445('0x5f')](_0x533cee['model'],qs[_0x0445('0x60')](_0x998a86[_0x0445('0x49')]['fields']));_0x530618[_0x0445('0x4d')]=_0x530618[_0x0445('0x4d')][_0x0445('0x51')]?_0x530618[_0x0445('0x4d')]:_0x533cee[_0x0445('0x5c')];_0x530618['order']=qs[_0x0445('0xd0')](_0x998a86['query'][_0x0445('0xd0')]);_0x530618[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_['pick'](_0x998a86[_0x0445('0x49')],_0x533cee[_0x0445('0x5e')]));if(_0x998a86['query'][_0x0445('0x35')]){_0x530618[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x530618[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x530618[_0x0445('0x4d')],function(_0x3a1c71){var _0x44c788={};_0x44c788[_0x3a1c71]={'$like':'%'+_0x998a86[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x44c788;})});}_0x530618=_[_0x0445('0xd2')]({},_0x530618,_0x998a86[_0x0445('0x61')]);return _0x10bd19[_0x0445('0xec')](_0x530618);}})[_0x0445('0x2a')](function(_0x4a484b){if(_0x4a484b){_0x590a15=_0x4a484b['length'];if(!_0x998a86[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x530618[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x998a86[_0x0445('0x49')]['limit']);_0x530618[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x998a86[_0x0445('0x49')][_0x0445('0x23')]);}return _0x10bd19['getFaxInteractions'](_0x530618);}})[_0x0445('0x2a')](function(_0x486755){if(_0x486755){return _0x486755?{'count':_0x590a15,'rows':_0x486755}:null;}})[_0x0445('0x2a')](respondWithResult(_0x134583,null))['catch'](handleError(_0x134583,null));};exports[_0x0445('0xee')]=function(_0x52e21b,_0x5db167){var _0x4489f1={};var _0x42d97c={};var _0x1761fd;var _0xaf8937;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x52e21b['params']['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x5db167,null))['then'](function(_0x35bf0c){if(_0x35bf0c){_0x1761fd=_0x35bf0c;_0x42d97c['model']=_[_0x0445('0x5d')](db[_0x0445('0xef')][_0x0445('0x40')]);_0x42d97c[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x52e21b['query']);_0x42d97c[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x42d97c[_0x0445('0x5c')],_0x42d97c[_0x0445('0x49')]);_0x4489f1[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x42d97c[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x52e21b['query'][_0x0445('0x60')]));_0x4489f1['attributes']=_0x4489f1[_0x0445('0x4d')][_0x0445('0x51')]?_0x4489f1[_0x0445('0x4d')]:_0x42d97c[_0x0445('0x5c')];_0x4489f1[_0x0445('0xcf')]=qs['sort'](_0x52e21b[_0x0445('0x49')][_0x0445('0xd0')]);_0x4489f1['where']=qs['filters'](_[_0x0445('0xdb')](_0x52e21b[_0x0445('0x49')],_0x42d97c[_0x0445('0x5e')]));if(_0x52e21b[_0x0445('0x49')][_0x0445('0x35')]){_0x4489f1['where']=_['merge'](_0x4489f1[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x4489f1[_0x0445('0x4d')],function(_0x181476){var _0x266517={};_0x266517[_0x181476]={'$like':'%'+_0x52e21b[_0x0445('0x49')]['filter']+'%'};return _0x266517;})});}_0x4489f1=_[_0x0445('0xd2')]({},_0x4489f1,_0x52e21b['options']);return _0x1761fd[_0x0445('0xee')](_0x4489f1);}})[_0x0445('0x2a')](function(_0x28a752){if(_0x28a752){_0xaf8937=_0x28a752[_0x0445('0x51')];if(!_0x52e21b[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x4489f1[_0x0445('0x24')]=qs['limit'](_0x52e21b[_0x0445('0x49')][_0x0445('0x24')]);_0x4489f1['offset']=qs[_0x0445('0x23')](_0x52e21b[_0x0445('0x49')][_0x0445('0x23')]);}return _0x1761fd[_0x0445('0xee')](_0x4489f1);}})[_0x0445('0x2a')](function(_0x24fb74){if(_0x24fb74){return _0x24fb74?{'count':_0xaf8937,'rows':_0x24fb74}:null;}})[_0x0445('0x2a')](respondWithResult(_0x5db167,null))[_0x0445('0x20')](handleError(_0x5db167,null));};exports[_0x0445('0xf0')]=function(_0x1f5ba4,_0x32fde7,_0x52b834){var _0x14ed87;var _0x349932;var _0x3f6767;var _0x1908c6=!_[_0x0445('0x6b')](_0x1f5ba4['params']['id'])?_0x1f5ba4[_0x0445('0x5b')]['id']:!_['isNil'](_0x1f5ba4['user']['id'])?_0x1f5ba4[_0x0445('0x30')]['id']:null;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x1908c6,'role':{'$or':[_0x0445('0x2e'),'user',_0x0445('0x32')]}},'attributes':['id',_0x0445('0x39'),'phone',_0x0445('0xf1'),_0x0445('0x2d'),'internal',_0x0445('0xa4')]})[_0x0445('0x2a')](function(_0x318669){if(_0x318669){if(_0x318669[_0x0445('0x2d')]==='agent'){_0x14ed87=_0x318669;if(_0x1f5ba4['body'][_0x0445('0xa6')]){_0x3f6767=util[_0x0445('0xf2')](_0x0445('0xf3'),_0x14ed87[_0x1f5ba4[_0x0445('0x63')][_0x0445('0xa6')]]);}else if(_0x1f5ba4[_0x0445('0x63')][_0x0445('0xf4')]){_0x3f6767=util[_0x0445('0xf2')](_0x0445('0xb3'),_0x1f5ba4['body'][_0x0445('0xf4')]);}else{_0x3f6767=util[_0x0445('0xf2')]('SIP/%s',_0x14ed87[_0x0445('0x39')]);}socket['to'](util[_0x0445('0xf2')](_0x0445('0xf5'),_0x14ed87[_0x0445('0x39')]))[_0x0445('0x2b')](_0x0445('0xf6'),{'user':{'id':_0x14ed87['id'],'name':_0x14ed87['name']},'ip':_0x1f5ba4['headers'][_0x0445('0xf7')]||_0x1f5ba4[_0x0445('0xf8')][_0x0445('0xf9')]||_0x1f5ba4['socket'][_0x0445('0xf9')]||_0x1f5ba4[_0x0445('0xf8')][_0x0445('0xfa')][_0x0445('0xf9')]});return db[_0x0445('0xb4')][_0x0445('0x3b')]({'where':{'membername':_0x14ed87[_0x0445('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xfb'));}})[_0x0445('0x2a')](function(){if(_0x14ed87){return _0x14ed87['getVoiceQueues']({'raw':!![]});}})[_0x0445('0x2a')](function(_0x2fe744){if(_0x14ed87){var _0x8743=[];if(_0x2fe744){_0x349932=_0x2fe744;if(_0x349932[_0x0445('0x51')]){for(var _0x1a2f27=0x0;_0x1a2f27<_0x349932[_0x0445('0x51')];_0x1a2f27++){_0x8743[_0x0445('0x4e')]({'membername':_0x14ed87[_0x0445('0x39')],'UserId':_0x14ed87['id'],'queue_name':_0x349932[_0x1a2f27][_0x0445('0x39')],'VoiceQueueId':_0x349932[_0x1a2f27]['id'],'interface':_0x3f6767,'paused':_0x14ed87[_0x0445('0xa4')]||![],'penalty':_0x349932[_0x1a2f27]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x8743,function(_0x302af3){return db[_0x0445('0xb4')][_0x0445('0xfc')](_0x302af3);});}}}})[_0x0445('0x2a')](function(){if(_0x14ed87){return db[_0x0445('0xfd')]['findAll']({'where':{'membername':_0x14ed87[_0x0445('0x39')],'exitAt':null}});}})[_0x0445('0x2a')](function(_0x197cf6){if(_0x14ed87){var _0x4e770e=[];_0x197cf6['forEach'](function(_0x10a399){_0x4e770e[_0x0445('0x4e')](_0x10a399[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))}));});return BPromise[_0x0445('0x59')](_0x4e770e);}})[_0x0445('0x2a')](function(){if(_0x14ed87){var _0x18b396=[];var _0x333adf=[];var _0x5f05be=utils[_0x0445('0xff')]();var _0x28cdb4={'membername':_0x14ed87['name'],'interface':_0x3f6767,'enterAt':moment()['format'](_0x0445('0xfe')),'role':_0x14ed87[_0x0445('0x2d')],'internal':_0x14ed87[_0x0445('0x67')]};_0x5f05be[_0x0445('0x100')](function(_0x8c9907){_0x18b396['push'](_[_0x0445('0xd2')]({'channel':_0x8c9907,'type':_0x0445('0x101'),'data1':_0x1f5ba4[_0x0445('0x63')]['device'],'data2':_0x3f6767},_0x28cdb4));if(_0x14ed87[_0x0445('0xa4')]){_0x333adf['push'](_['merge']({'channel':_0x8c9907,'type':_0x0445('0x102'),'data1':_0x0445('0x103')},_0x28cdb4));}});return db['MemberReport'][_0x0445('0x89')](_0x18b396[_0x0445('0xcc')](_0x333adf),{'individualHooks':!![]});}})['then'](function(){if(_0x14ed87){return _0x14ed87['update']({'online':!![],'lastLoginAt':moment()[_0x0445('0xf2')](_0x0445('0xfe')),'voicePause':_0x14ed87[_0x0445('0xa4')]||![],'mailPause':_0x14ed87['loginInPause']||![],'chatPause':_0x14ed87['loginInPause']||![],'faxPause':_0x14ed87['loginInPause']||![],'smsPause':_0x14ed87['loginInPause']||![],'openchannelPause':_0x14ed87[_0x0445('0xa4')]||![],'whatsappPause':_0x14ed87[_0x0445('0xa4')]||![],'pauseType':_0x14ed87['loginInPause']?_0x0445('0x103'):null,'interface':_0x3f6767,'lastPauseAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))});}})['then'](function(_0x42504e){if(_0x1f5ba4[_0x0445('0x104')]){return _0x52b834();}else{return BPromise[_0x0445('0x105')](_0x42504e)[_0x0445('0x2a')](respondWithResult(_0x32fde7,null));}})['catch'](handleError(_0x32fde7,null));};exports[_0x0445('0x106')]=function(_0x3b776a,_0x25c3c8){var _0x1e779f;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x3b776a[_0x0445('0x5b')]['id'],'role':_0x0445('0x32')},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d')]})['then'](handleEntityNotFound(_0x25c3c8,null))['then'](function(_0x5d657a){if(_0x5d657a){_0x1e779f=_0x5d657a;return db[_0x0445('0xb4')][_0x0445('0x3b')]({'where':{'membername':_0x1e779f[_0x0445('0x39')]},'individualHooks':!![]});}})[_0x0445('0x2a')](function(){return db[_0x0445('0xfd')][_0x0445('0x4f')]({'where':{'membername':_0x1e779f[_0x0445('0x39')],'exitAt':null}});})['then'](function(_0x4af0d7){var _0x452d99=[];_0x4af0d7[_0x0445('0x100')](function(_0x196479){_0x452d99[_0x0445('0x4e')](_0x196479[_0x0445('0x29')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x0445('0x59')](_0x452d99);})[_0x0445('0x2a')](function(){return _0x1e779f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0445('0x2a')](respondWithResult(_0x25c3c8,null))[_0x0445('0x20')](handleError(_0x25c3c8,null));};exports[_0x0445('0x107')]=function(_0x16cb8c,_0x1a0361){var _0x4418c1;return db[_0x0445('0xb4')][_0x0445('0x29')]({'paused':0x1},{'where':{'UserId':_0x16cb8c[_0x0445('0x5b')]['id']},'individualHooks':!![]})[_0x0445('0x2a')](function(){return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x16cb8c[_0x0445('0x5b')]['id'],'role':_0x0445('0x32')},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),_0x0445('0x67'),_0x0445('0xa6')]});})[_0x0445('0x2a')](handleEntityNotFound(_0x1a0361,null))[_0x0445('0x2a')](function(_0x224141){if(_0x224141){_0x4418c1=_0x224141;return respondWithRpcPromise(_0x0445('0x108'),_0x0445('0x107'),{'id':_0x4418c1['id'],'name':_0x4418c1[_0x0445('0x39')],'pause':!![]});}})['then'](function(){if(_0x4418c1){return db[_0x0445('0xfd')][_0x0445('0x4f')]({'where':{'membername':_0x4418c1[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});}})[_0x0445('0x2a')](function(_0x2de928){if(_0x2de928[_0x0445('0x51')]){var _0x1a1ca0=moment()[_0x0445('0xf2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x45893b=0x0,_0x405194=_0x2de928[_0x0445('0x51')];_0x45893b<_0x405194;_0x45893b++){_0x2de928[_0x45893b][_0x0445('0x109')]({'exitAt':_0x1a1ca0});}}})['then'](function(){var _0x40a569=[];var _0x2e7cae=utils[_0x0445('0xff')]();_0x2e7cae['forEach'](function(_0xf4042c){_0x40a569[_0x0445('0x4e')]({'channel':_0xf4042c,'membername':_0x4418c1[_0x0445('0x39')],'interface':_[_0x0445('0x6b')](_0x4418c1['interface'])?util[_0x0445('0xf2')](_0x0445('0xb3'),_0x4418c1[_0x0445('0x39')]):_0x4418c1[_0x0445('0xa6')],'type':_0x0445('0x102'),'enterAt':moment()['format'](_0x0445('0xfe')),'data1':_0x16cb8c[_0x0445('0x63')][_0x0445('0x42')]||_0x0445('0x10a'),'role':_0x4418c1[_0x0445('0x2d')],'internal':_0x4418c1['internal']});});return db[_0x0445('0xfd')][_0x0445('0x89')](_0x40a569,{'individualHooks':!![]});})[_0x0445('0x2a')](function(){return _0x4418c1['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x16cb8c['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x0445('0xf2')](_0x0445('0xfe'))});})[_0x0445('0x2a')](respondWithResult(_0x1a0361,null))[_0x0445('0x20')](handleError(_0x1a0361,null));};exports[_0x0445('0x10b')]=function(_0x44ac15,_0x54be0){var _0x544718;return db[_0x0445('0x3f')][_0x0445('0x38')]({'where':{'id':_0x44ac15[_0x0445('0x5b')]['id']},'attributes':['id',_0x0445('0x39'),_0x0445('0x2d'),'voicePause',_0x0445('0x10c'),_0x0445('0x10d'),_0x0445('0x10e'),_0x0445('0x10f'),_0x0445('0x110'),_0x0445('0x111'),_0x0445('0x112'),_0x0445('0x113')]})[_0x0445('0x2a')](handleEntityNotFound(_0x54be0,null))[_0x0445('0x2a')](function(_0x13abe0){if(_0x13abe0){_0x544718=_0x13abe0;if(_0x44ac15['body'][_0x0445('0xa2')]&&!utils[_0x0445('0xa7')](_0x44ac15[_0x0445('0x63')]['channel'])){throw new db[(_0x0445('0x93'))][(_0x0445('0x94'))](_0x0445('0xa8'));}switch(_0x44ac15[_0x0445('0x63')][_0x0445('0xa2')]){case _0x0445('0xb1'):return respondWithRpcPromise('QueuePause',_0x0445('0x10b'),{'id':_0x544718['id'],'name':_0x544718[_0x0445('0x39')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x544718['id']},'individualHooks':!![]});})[_0x0445('0x2a')](function(){return db['MemberReport'][_0x0445('0x38')]({'where':{'channel':_0x44ac15[_0x0445('0x63')]['channel'],'membername':_0x544718[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});})['then'](function(_0x11ee4f){if(_0x11ee4f){return _0x11ee4f[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0445('0x114')},{'individualHooks':!![]});}return null;})[_0x0445('0x2a')](function(){return _0x544718['update']({'voicePause':![]});});case _0x0445('0x56'):case _0x0445('0x52'):case _0x0445('0x55'):case _0x0445('0x62'):case _0x0445('0x58'):case _0x0445('0x57'):return db[_0x0445('0xfd')]['find']({'where':{'channel':_0x44ac15[_0x0445('0x63')]['channel'],'membername':_0x544718['name'],'type':'PAUSE','exitAt':null}})[_0x0445('0x2a')](function(_0xfa12b2){if(_0xfa12b2){return _0xfa12b2[_0x0445('0x29')]({'exitAt':moment()[_0x0445('0xf2')](_0x0445('0xfe')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0445('0x2a')](function(){var _0xc487b5={};_[_0x0445('0x115')](_0xc487b5,util[_0x0445('0xf2')](_0x0445('0x116'),_0x44ac15['body'][_0x0445('0xa2')],_0x0445('0x117')),![]);return _0x544718[_0x0445('0x29')](_0xc487b5);});default:return respondWithRpcPromise(_0x0445('0x108'),_0x0445('0x10b'),{'id':_0x544718['id'],'name':_0x544718[_0x0445('0x39')],'pause':![]})[_0x0445('0x2a')](function(){return db[_0x0445('0xb4')][_0x0445('0x29')]({'paused':0x0},{'where':{'UserId':_0x544718['id']}});})[_0x0445('0x2a')](function(){return db['MemberReport'][_0x0445('0x4f')]({'where':{'membername':_0x544718[_0x0445('0x39')],'type':_0x0445('0x102'),'exitAt':null}});})[_0x0445('0x2a')](function(_0xe8fcba){var _0x5f3d6b=[];_0xe8fcba[_0x0445('0x100')](function(_0x111bde){_0x5f3d6b['push'](_0x111bde[_0x0445('0x29')]({'exitAt':moment()['format'](_0x0445('0xfe')),'data2':_0x0445('0x114')}));});return BPromise['all'](_0x5f3d6b);})[_0x0445('0x2a')](function(){return _0x544718[_0x0445('0x29')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0445('0x2a')](respondWithResult(_0x54be0,null))[_0x0445('0x20')](handleError(_0x54be0,null));};exports[_0x0445('0x118')]=function(_0x522927,_0x2b0210){var _0x25ba88={};var _0x4acd44={};var _0xf03edd;var _0x7be9b0;return db[_0x0445('0x3f')]['findOne']({'where':{'id':_0x522927[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x2b0210,null))[_0x0445('0x2a')](function(_0x17994f){if(_0x17994f){_0xf03edd=_0x17994f;_0x4acd44[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x119')][_0x0445('0x40')]);_0x4acd44['query']=_[_0x0445('0x5d')](_0x522927[_0x0445('0x49')]);_0x4acd44['filters']=_['intersection'](_0x4acd44['model'],_0x4acd44[_0x0445('0x49')]);_0x25ba88[_0x0445('0x4d')]=_[_0x0445('0x5f')](_0x4acd44[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x522927['query'][_0x0445('0x60')]));_0x25ba88[_0x0445('0x4d')]=_0x25ba88[_0x0445('0x4d')][_0x0445('0x51')]?_0x25ba88['attributes']:_0x4acd44[_0x0445('0x5c')];_0x25ba88[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x522927[_0x0445('0x49')][_0x0445('0xd0')]);_0x25ba88[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x522927[_0x0445('0x49')],_0x4acd44[_0x0445('0x5e')]));if(_0x522927[_0x0445('0x49')][_0x0445('0x35')]){_0x25ba88[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x25ba88[_0x0445('0xd1')],{'$or':_['map'](_0x25ba88['attributes'],function(_0x68bb3c){var _0x133a54={};_0x133a54[_0x68bb3c]={'$like':'%'+_0x522927[_0x0445('0x49')][_0x0445('0x35')]+'%'};return _0x133a54;})});}_0x25ba88=_[_0x0445('0xd2')]({},_0x25ba88,_0x522927[_0x0445('0x61')]);return _0xf03edd['getTeams'](_0x25ba88);}})[_0x0445('0x2a')](function(_0x28e8b2){if(_0x28e8b2){_0x7be9b0=_0x28e8b2['length'];if(!_0x522927['query']['hasOwnProperty'](_0x0445('0xd8'))){_0x25ba88[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x522927[_0x0445('0x49')][_0x0445('0x24')]);_0x25ba88[_0x0445('0x23')]=qs['offset'](_0x522927[_0x0445('0x49')][_0x0445('0x23')]);}return _0xf03edd['getTeams'](_0x25ba88);}})[_0x0445('0x2a')](function(_0x4833b0){if(_0x4833b0){return _0x4833b0?{'count':_0x7be9b0,'rows':_0x4833b0}:null;}})[_0x0445('0x2a')](respondWithResult(_0x2b0210,null))[_0x0445('0x20')](handleError(_0x2b0210,null));};exports[_0x0445('0x11a')]=function(_0x159d2d,_0x55452d){var _0x1dac44=_0x159d2d['params']['id'];var _0x390a12=_0x159d2d[_0x0445('0x63')]?_0x159d2d[_0x0445('0x63')][_0x0445('0x66')]:null;var _0x3f53a7=[];return Promise[_0x0445('0x105')]()['then'](function(){if(!_0x390a12)throw new APIBadRequestError(_0x0445('0x11b'));})[_0x0445('0x2a')](function(){return db['User'][_0x0445('0x9a')]({'where':{'id':_0x1dac44}});})[_0x0445('0x2a')](function(_0x59f47d){if(!_0x59f47d)throw new APINotFoundError(util[_0x0445('0xf2')](_0x0445('0x11c'),_0x159d2d[_0x0445('0x5b')]['id']));return db['sequelize'][_0x0445('0x11d')](function(_0x260a8a){return _0x59f47d[_0x0445('0x11a')](_0x390a12,{'transaction':_0x260a8a})[_0x0445('0x2a')](function(){return db[_0x0445('0x119')][_0x0445('0x4f')]({'where':{'id':{'$in':_0x390a12}}});})[_0x0445('0x2a')](function(_0x411982){var _0x114eb3=_[_0x0445('0x8f')](_0x411982,function(_0x1ff63c){return _0x1ff63c[_0x0445('0x11e')]();});return Promise['all'](_0x114eb3);})[_0x0445('0x2a')](function(_0x1c7314){_0x3f53a7=_[_0x0445('0x11f')](_0x1c7314);var _0x569a6f=_[_0x0445('0x8f')](_0x3f53a7,function(_0xc9adab){return _0xc9adab[_0x0445('0x120')](_0x59f47d['id'],{'transaction':_0x260a8a});});return Promise[_0x0445('0x59')](_0x569a6f);})[_0x0445('0x2a')](function(){if(!_0x59f47d[_0x0445('0xa3')])return;var _0x1875b1=_[_0x0445('0x35')](_0x3f53a7,function(_0x546e93){return _0x546e93[_0x0445('0x121')]('channel')==='Voice';});var _0x3dbd23=_['map'](_0x1875b1,function(_0x242af5){return db[_0x0445('0xb4')][_0x0445('0xfc')]({'membername':_0x59f47d['name'],'UserId':_0x59f47d['id'],'queue_name':_0x242af5['name'],'VoiceQueueId':_0x242af5['id'],'interface':_[_0x0445('0x6b')](_0x59f47d['interface'])?util['format'](_0x0445('0xb3'),_0x59f47d['name']):_0x59f47d[_0x0445('0xa6')],'paused':_0x59f47d['voicePause']||![],'penalty':_0x59f47d[_0x0445('0xad')]},{'transaction':_0x260a8a});});return Promise['all'](_0x3dbd23);})[_0x0445('0x2a')](function(){return db[_0x0445('0x122')][_0x0445('0x4f')]({'where':{'teamId':{'$in':_0x390a12}}});})[_0x0445('0x2a')](function(_0x6b84e7){var _0x193329=_[_0x0445('0x8f')](_0x6b84e7,function(_0x12e7b8){return db[_0x0445('0x123')][_0x0445('0x82')]({'UserId':_0x59f47d['id'],'VoicePrefixId':_0x12e7b8[_0x0445('0x124')]},{'transaction':_0x260a8a});});return Promise[_0x0445('0x59')](_0x193329);});});})[_0x0445('0x2a')](function(){for(var _0x40511b=0x0;_0x40511b<_0x3f53a7['length'];_0x40511b++){var _0x64e70a=_0x3f53a7[_0x40511b]['getDataValue'](_0x0445('0xa2'));var _0x1c0e76=_0x64e70a+'QueueId';socket['emit']('user'+_0x64e70a+_0x0445('0xb0'),{'UserId':_0x1dac44,['queueField']:_0x3f53a7[_0x40511b]['id']});}})[_0x0445('0x2a')](respondWithStatusCode(_0x55452d,null))[_0x0445('0x20')](APIHandleError(_0x55452d));};exports[_0x0445('0x125')]=function(_0x4767b4,_0xaf8f3a){var _0x2d58f3=_0x4767b4[_0x0445('0x5b')]['id'];var _0x382cc9=null;if(_0x4767b4[_0x0445('0x49')]['ids']){_0x382cc9=_[_0x0445('0xb5')](_0x4767b4[_0x0445('0x49')][_0x0445('0x66')])?_0x4767b4[_0x0445('0x49')]['ids']:[_0x4767b4[_0x0445('0x49')][_0x0445('0x66')]];}var _0x143faa=[];return Promise[_0x0445('0x105')]()[_0x0445('0x2a')](function(){if(!_0x382cc9)throw new APIBadRequestError(_0x0445('0x126'));})[_0x0445('0x2a')](function(){return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x2d58f3}});})[_0x0445('0x2a')](function(_0xe1a678){if(!_0xe1a678)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4767b4[_0x0445('0x5b')]['id']));return db[_0x0445('0x6d')][_0x0445('0x11d')](function(_0x2bf923){return _0xe1a678[_0x0445('0x125')](_0x382cc9,{'transaction':_0x2bf923})['then'](function(){return db[_0x0445('0x119')][_0x0445('0x4f')]({'where':{'id':{'$in':_0x382cc9}}});})[_0x0445('0x2a')](function(_0x5b17a1){var _0x365570=_[_0x0445('0x8f')](_0x5b17a1,function(_0x1a1b58){return _0x1a1b58[_0x0445('0x11e')]();});return Promise['all'](_0x365570);})[_0x0445('0x2a')](function(_0x2e4338){_0x143faa=_['flattenDeep'](_0x2e4338);var _0x494986=_[_0x0445('0x8f')](_0x143faa,function(_0x3bdf8c){return _0x3bdf8c[_0x0445('0x127')](_0xe1a678['id'],{'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x494986);})[_0x0445('0x2a')](function(){if(!_0xe1a678[_0x0445('0xa3')])return;var _0x3fd924=_['filter'](_0x143faa,function(_0x2318d0){return _0x2318d0[_0x0445('0x121')](_0x0445('0xa2'))===_0x0445('0x128');});var _0x293e70=_['map'](_0x3fd924,function(_0x1fda5c){return db[_0x0445('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x1fda5c['id'],'UserId':_0xe1a678['id']},'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x293e70);})[_0x0445('0x2a')](function(){return db['TeamVoicePrefix'][_0x0445('0x4f')]({'where':{'teamId':{'$in':_0x382cc9}}});})[_0x0445('0x2a')](function(_0x1f18a1){var _0x2a8ccb=_['map'](_0x1f18a1,function(_0x45537a){return db[_0x0445('0x123')][_0x0445('0x3b')]({'where':{'UserId':_0xe1a678['id'],'VoicePrefixId':_0x45537a['VoicePrefixId']}},{'transaction':_0x2bf923});});return Promise[_0x0445('0x59')](_0x2a8ccb);});});})['then'](function(){for(var _0x87ba95=0x0;_0x87ba95<_0x143faa['length'];_0x87ba95++){var _0x137229=_0x143faa[_0x87ba95]['getDataValue'](_0x0445('0xa2'));var _0x59579f=_0x137229+_0x0445('0xaf');socket[_0x0445('0x2b')]('user'+_0x137229+_0x0445('0xb6'),{'UserId':_0x2d58f3,['queueField']:_0x143faa[_0x87ba95]['id']});}})['then'](respondWithStatusCode(_0xaf8f3a,null))[_0x0445('0x20')](APIHandleError(_0xaf8f3a));};exports[_0x0445('0x129')]=function(_0x333999,_0x4287e6){var _0x2d590b={};var _0x5c6de3={};var _0x59fd23;var _0x21f75a;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x333999[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x4287e6,null))[_0x0445('0x2a')](function(_0x532cad){if(_0x532cad){_0x59fd23=_0x532cad;_0x5c6de3[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x12a')][_0x0445('0x40')]);_0x5c6de3[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x333999[_0x0445('0x49')]);_0x5c6de3['filters']=_[_0x0445('0x5f')](_0x5c6de3[_0x0445('0x5c')],_0x5c6de3[_0x0445('0x49')]);_0x2d590b['attributes']=_[_0x0445('0x5f')](_0x5c6de3[_0x0445('0x5c')],qs['fields'](_0x333999[_0x0445('0x49')]['fields']));_0x2d590b[_0x0445('0x4d')]=_0x2d590b[_0x0445('0x4d')]['length']?_0x2d590b['attributes']:_0x5c6de3[_0x0445('0x5c')];_0x2d590b[_0x0445('0xcf')]=qs['sort'](_0x333999['query'][_0x0445('0xd0')]);_0x2d590b[_0x0445('0xd1')]=qs[_0x0445('0x5e')](_[_0x0445('0xdb')](_0x333999[_0x0445('0x49')],_0x5c6de3[_0x0445('0x5e')]));if(_0x333999[_0x0445('0x49')][_0x0445('0x35')]){_0x2d590b[_0x0445('0xd1')]=_[_0x0445('0xd2')](_0x2d590b[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0x2d590b[_0x0445('0x4d')],function(_0xf1e288){var _0x358cc1={};_0x358cc1[_0xf1e288]={'$like':'%'+_0x333999['query'][_0x0445('0x35')]+'%'};return _0x358cc1;})});}_0x2d590b=_[_0x0445('0xd2')]({},_0x2d590b,_0x333999['options']);return _0x59fd23['getLists'](_0x2d590b);}})[_0x0445('0x2a')](function(_0x416389){if(_0x416389){_0x21f75a=_0x416389[_0x0445('0x51')];if(!_0x333999[_0x0445('0x49')][_0x0445('0xd3')](_0x0445('0xd8'))){_0x2d590b[_0x0445('0x24')]=qs[_0x0445('0x24')](_0x333999['query']['limit']);_0x2d590b[_0x0445('0x23')]=qs[_0x0445('0x23')](_0x333999[_0x0445('0x49')][_0x0445('0x23')]);}return _0x59fd23[_0x0445('0x129')](_0x2d590b);}})[_0x0445('0x2a')](function(_0x234656){if(_0x234656){return _0x234656?{'count':_0x21f75a,'rows':_0x234656}:null;}})[_0x0445('0x2a')](respondWithResult(_0x4287e6,null))[_0x0445('0x20')](handleError(_0x4287e6,null));};exports[_0x0445('0x12b')]=function(_0x30a868,_0x416106){var _0xe38a93={};var _0x1ce433={};var _0x54ba9f;return db[_0x0445('0x3f')][_0x0445('0x9a')]({'where':{'id':_0x30a868[_0x0445('0x5b')]['id']}})[_0x0445('0x2a')](handleEntityNotFound(_0x416106,null))[_0x0445('0x2a')](function(_0x59ec02){if(_0x59ec02){_0x54ba9f=_0x59ec02;_0x1ce433[_0x0445('0x5c')]=_[_0x0445('0x5d')](db[_0x0445('0x3f')][_0x0445('0x40')]);_0x1ce433[_0x0445('0x49')]=_[_0x0445('0x5d')](_0x30a868[_0x0445('0x49')]);_0x1ce433[_0x0445('0x5e')]=_[_0x0445('0x5f')](_0x1ce433[_0x0445('0x5c')],_0x1ce433[_0x0445('0x49')]);_0xe38a93[_0x0445('0x4d')]=_['intersection'](_0x1ce433[_0x0445('0x5c')],qs[_0x0445('0x60')](_0x30a868[_0x0445('0x49')][_0x0445('0x60')]));_0xe38a93[_0x0445('0x4d')]=_0xe38a93['attributes'][_0x0445('0x51')]?_0xe38a93['attributes']:_0x1ce433['model'];_0xe38a93[_0x0445('0xcf')]=qs[_0x0445('0xd0')](_0x30a868[_0x0445('0x49')][_0x0445('0xd0')]);_0xe38a93[_0x0445('0xd1')]=qs['filters'](_[_0x0445('0xdb')](_0x30a868[_0x0445('0x49')],_0x1ce433[_0x0445('0x5e')]));if(_0x30a868['query'][_0x0445('0x35')]){_0xe38a93['where']=_[_0x0445('0xd2')](_0xe38a93[_0x0445('0xd1')],{'$or':_[_0x0445('0x8f')](_0xe38a93[_0x0445('0x4d')],function(_0x4d7f8a){var _0x4202f9={};_0x4202f9[_0x4d7f8a]={'$like':'%'+_0x30a868['query'][_0x0445('0x35')]+'%'};return _0x4202f9;})});}_0xe38a93['model']=db[_0x0445('0x3f')];_0xe38a93['as']=_0x0445('0x31');_0xe38a93=_['merge']({},_0xe38a93,_0x30a868[_0x0445('0x61')]);return _0x54ba9f[_0x0445('0x12c')]({'include':[_0xe38a93]});}})['then'](function(_0x5e0cb2){if(_0x5e0cb2){var _0x1828e7={},_0x3df9e2=[];for(var _0x34e80c=0x0;_0x34e80c<_0x5e0cb2[_0x0445('0x51')];_0x34e80c+=0x1){for(var _0x4686c7=0x0,_0x2f4988;_0x4686c7<_0x5e0cb2[_0x34e80c][_0x0445('0x31')][_0x0445('0x51')];_0x4686c7+=0x1){_0x2f4988=_0x5e0cb2[_0x34e80c]['Agents'][_0x4686c7]['get']({'plain':!![]});_0x1828e7[_0x2f4988['id']]=_0x2f4988;}}_0x1828e7=_['values'](_0x1828e7);for(var _0x4bec2d=qs[_0x0445('0x23')](_0x30a868[_0x0445('0x49')][_0x0445('0x23')]);_0x4bec2d<_0x1828e7[_0x0445('0x51')]&&_0x3df9e2[_0x0445('0x51')]=_0x5efeb6){_0x3a0c51=_0x5efeb6;_0x20a50a=0xc8;}else{_0x20a50a=0xce;}_0x1063a9['status'](_0x20a50a);return _0x1063a9[_0x0cf1('0x26')](_0x0cf1('0x27'),_0x41b0eb+'-'+_0x3a0c51+'/'+_0x5efeb6)[_0x0cf1('0x22')](_0x41e88b);}return null;};}function saveUpdates(_0x97c0bf){return function(_0x54ae55){if(_0x54ae55){return _0x54ae55[_0x0cf1('0x28')](_0x97c0bf)['then'](function(_0x2dddb1){socket[_0x0cf1('0x29')](_0x0cf1('0x2a')+_0x2dddb1['id'],{});return _0x2dddb1;});}return null;};}function removeEntity(_0x442182){return function(_0x1cc2b3){if(_0x1cc2b3){return _0x1cc2b3[_0x0cf1('0x2b')]()[_0x0cf1('0x16')](function(){var _0x4510d4=_0x1cc2b3['get']({'plain':!![]});if(_0x4510d4['role']===_0x0cf1('0x2c'))return;var _0x3a1199=[{'name':_0x0cf1('0x2d'),'value':_0x0cf1('0x2e'),'ignore':!![]},{'name':'Agents','value':_0x0cf1('0x2f'),'ignore':![]},{'name':_0x0cf1('0x30'),'value':_0x0cf1('0x31'),'ignore':![]}];var _0x1b9965=_(_0x3a1199)[_0x0cf1('0x32')](_0x0cf1('0x33'))[_0x0cf1('0x34')](_0x0cf1('0x35'))[_0x0cf1('0x35')]();if(_[_0x0cf1('0x36')](_0x1b9965,_0x4510d4[_0x0cf1('0x37')])){return;}var _0x5053d2=_[_0x0cf1('0x38')](_0x3a1199,[_0x0cf1('0x35'),_0x4510d4['role']])[_0x0cf1('0x39')];return db['UserProfileResource'][_0x0cf1('0x2b')]({'where':{'type':_0x5053d2,'resourceId':_0x4510d4['id']}})[_0x0cf1('0x16')](function(){return _0x1cc2b3;});})[_0x0cf1('0x16')](function(){_0x442182[_0x0cf1('0x3a')](0xcc)[_0x0cf1('0x3b')]();});}};}function handleEntityNotFound(_0x4408e4){return function(_0x559594){if(!_0x559594){_0x4408e4[_0x0cf1('0x21')](0x194);}return _0x559594;};}function handleError(_0x27d11d,_0x4e1527){_0x4e1527=_0x4e1527||0x1f4;return function(_0x5b2a4e){logger['error'](_0x5b2a4e[_0x0cf1('0x3c')]);if(_0x5b2a4e[_0x0cf1('0x39')]){delete _0x5b2a4e[_0x0cf1('0x39')];}_0x27d11d[_0x0cf1('0x3a')](_0x4e1527)[_0x0cf1('0x3d')](_0x5b2a4e);};}exports['index']=function(_0x5e7e72,_0x36a2ba){var _0x152720={},_0x1bf72b={'count':0x0,'rows':[]};var _0x59cdb4=_(db['User'][_0x0cf1('0x3e')])['map'](function(_0x2e8b6a){return{'name':_0x2e8b6a[_0x0cf1('0x3f')],'type':_0x2e8b6a[_0x0cf1('0x40')]['key']};})[_0x0cf1('0x32')](function(_0x3e5ed1){return!_['includes']([_0x0cf1('0x41'),_0x0cf1('0x42')],_0x3e5ed1[_0x0cf1('0x39')]);})['value']();_0x152720=qs[_0x0cf1('0x43')](_0x59cdb4,_0x5e7e72);var _0x2b73e5={'where':_0x152720[_0x0cf1('0x44')]};return db[_0x0cf1('0x45')][_0x0cf1('0x24')](_0x2b73e5)[_0x0cf1('0x16')](function(_0x3d97fa){_0x1bf72b[_0x0cf1('0x24')]=_0x3d97fa;if(_0x5e7e72['query']['includeAll']){_0x152720['include']=[{'all':!![]}];}if(_0x5e7e72['query'][_0x0cf1('0x46')]==='true'){_0x152720[_0x0cf1('0x47')]=[{'model':db[_0x0cf1('0x48')],'as':_0x0cf1('0x46')}];}if(!_[_0x0cf1('0x36')](_0x152720[_0x0cf1('0x49')],'id')){_0x152720[_0x0cf1('0x49')][_0x0cf1('0x4a')]('id');}return db['User'][_0x0cf1('0x4b')](_0x152720);})[_0x0cf1('0x16')](function(_0x11f973){_0x1bf72b[_0x0cf1('0x4c')]=_0x11f973;if(_0x5e7e72[_0x0cf1('0x4d')][_0x0cf1('0x4e')]===_0x0cf1('0x4f')){var _0x2f3261=[];for(var _0x32b02a=0x0;_0x32b02a<_0x1bf72b[_0x0cf1('0x4c')][_0x0cf1('0x50')];_0x32b02a++){_0x2f3261[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x51'),_0x1bf72b[_0x0cf1('0x4c')][_0x32b02a][_0x0cf1('0x52')]));_0x2f3261[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x53'),_0x1bf72b[_0x0cf1('0x4c')][_0x32b02a][_0x0cf1('0x52')]));_0x2f3261[_0x0cf1('0x4a')](get_open_tabs('fax',_0x1bf72b[_0x0cf1('0x4c')][_0x32b02a]['dataValues']));_0x2f3261[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x54'),_0x1bf72b['rows'][_0x32b02a][_0x0cf1('0x52')]));_0x2f3261[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x55'),_0x1bf72b['rows'][_0x32b02a]['dataValues']));_0x2f3261['push'](get_open_tabs(_0x0cf1('0x56'),_0x1bf72b[_0x0cf1('0x4c')][_0x32b02a][_0x0cf1('0x52')]));}return BPromise[_0x0cf1('0x57')](_0x2f3261)['then'](function(){return _0x1bf72b;});}else{return _0x1bf72b;}})[_0x0cf1('0x16')](respondWithFilteredResult(_0x36a2ba,_0x152720))[_0x0cf1('0x20')](handleError(_0x36a2ba,null));};exports['show']=function(_0x560b92,_0x4bb174){var _0x3c10e1={'raw':![],'where':{'id':_0x560b92[_0x0cf1('0x58')]['id']}},_0x2470c1={};_0x2470c1[_0x0cf1('0x59')]=_[_0x0cf1('0x5a')](_[_0x0cf1('0x5b')](db['User'][_0x0cf1('0x3e')]),[_0x0cf1('0x41'),_0x0cf1('0x42')]);_0x2470c1['query']=_[_0x0cf1('0x5b')](_0x560b92[_0x0cf1('0x4d')]);_0x2470c1[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x2470c1['model'],_0x2470c1[_0x0cf1('0x4d')]);_0x3c10e1[_0x0cf1('0x49')]=_['intersection'](_0x2470c1[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0x560b92['query'][_0x0cf1('0x5e')]));_0x3c10e1['attributes']=_0x3c10e1[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x3c10e1[_0x0cf1('0x49')]:_0x2470c1[_0x0cf1('0x59')];if(_0x560b92[_0x0cf1('0x4d')][_0x0cf1('0x5f')]){_0x3c10e1[_0x0cf1('0x47')]=[{'all':!![]}];}if(_0x560b92['query']['userSetting']===_0x0cf1('0x4f')){_0x3c10e1[_0x0cf1('0x47')]=[{'model':db[_0x0cf1('0x48')],'as':_0x0cf1('0x46')}];}_0x3c10e1=_[_0x0cf1('0x60')]({},_0x3c10e1,_0x560b92[_0x0cf1('0x61')]);if(!_['includes'](_0x3c10e1[_0x0cf1('0x49')],'id')){_0x3c10e1[_0x0cf1('0x49')][_0x0cf1('0x4a')]('id');}return db[_0x0cf1('0x45')][_0x0cf1('0x38')](_0x3c10e1)['then'](handleEntityNotFound(_0x4bb174,null))['then'](function(_0x1aec2e){var _0x1c2a4e=[];values=_0x1aec2e;if(_0x560b92[_0x0cf1('0x4d')]['openTabs']==='true'){_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x51'),_0x1aec2e[_0x0cf1('0x52')]));_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x53'),_0x1aec2e['dataValues']));_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs('openchannel',_0x1aec2e[_0x0cf1('0x52')]));_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x56'),_0x1aec2e[_0x0cf1('0x52')]));_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs('fax',_0x1aec2e[_0x0cf1('0x52')]));_0x1c2a4e[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x54'),_0x1aec2e['dataValues']));return BPromise[_0x0cf1('0x57')](_0x1c2a4e);}else{return values;}})[_0x0cf1('0x16')](function(){return values;})['then'](respondWithResult(_0x4bb174,null))[_0x0cf1('0x20')](handleError(_0x4bb174,null));};exports[_0x0cf1('0x28')]=function(_0x154b22,_0x4c054f){if(_0x154b22[_0x0cf1('0x62')]['id']){delete _0x154b22[_0x0cf1('0x62')]['id'];}delete _0x154b22[_0x0cf1('0x62')][_0x0cf1('0x37')];return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x154b22[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x4c054f,null))[_0x0cf1('0x16')](saveUpdates(_0x154b22[_0x0cf1('0x62')],null))[_0x0cf1('0x16')](respondWithResult(_0x4c054f,null))[_0x0cf1('0x20')](handleError(_0x4c054f,null));};exports[_0x0cf1('0x63')]=function(_0x52c6b5,_0x3c2a17){return db[_0x0cf1('0x45')][_0x0cf1('0x63')]()['then'](respondWithResult(_0x3c2a17,null))[_0x0cf1('0x20')](handleError(_0x3c2a17,null));};exports[_0x0cf1('0x64')]=function(_0x208fe5,_0x34928d){return db[_0x0cf1('0x45')]['find']({'where':{'id':_0x208fe5[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x34928d,null))[_0x0cf1('0x16')](function(_0x5edff1){if(_0x5edff1){return _0x5edff1[_0x0cf1('0x64')](_0x208fe5[_0x0cf1('0x62')][_0x0cf1('0x65')],_['omit'](_0x208fe5[_0x0cf1('0x62')],[_0x0cf1('0x65'),'id'])||{});}})[_0x0cf1('0x16')](respondWithResult(_0x34928d,null))['catch'](handleError(_0x34928d,null));};function validateUser(_0x37c9c3){return new BPromise(function(_0x2eb104,_0x1b61db){if(_0x37c9c3[_0x0cf1('0x66')])return _0x2eb104(_0x37c9c3);return db[_0x0cf1('0x67')][_0x0cf1('0x68')](0x1)[_0x0cf1('0x16')](function(_0x758307){if(_0x758307[_0x0cf1('0x69')])authService[_0x0cf1('0x6a')](_0x37c9c3[_0x0cf1('0x41')]);db['User'][_0x0cf1('0x6b')](_0x0cf1('0x66'))[_0x0cf1('0x16')](function(_0x317d42){if(_['isNil'](_0x317d42)){_0x37c9c3[_0x0cf1('0x66')]=_0x758307[_0x0cf1('0x6c')]||0x1;return;}if(_['isNil'](_0x758307[_0x0cf1('0x6c')])||_0x758307['min_internal']===_0x317d42){_0x37c9c3[_0x0cf1('0x66')]=_0x317d42+0x1;return;}if(_0x758307[_0x0cf1('0x6c')]>_0x317d42){_0x37c9c3[_0x0cf1('0x66')]=_0x758307[_0x0cf1('0x6c')];return;}return db[_0x0cf1('0x6d')]['query'](_0x0cf1('0x6e'),{'type':db[_0x0cf1('0x6d')][_0x0cf1('0x6f')]['SELECT']})[_0x0cf1('0x16')](function(_0x222272){if(_0x222272&&_0x222272[_0x0cf1('0x50')]){for(var _0x3e315a=0x0,_0x3e888b=_0x222272[_0x0cf1('0x50')];_0x3e315a<_0x3e888b&&_[_0x0cf1('0x70')](_0x37c9c3[_0x0cf1('0x66')]);_0x3e315a++){if(_0x758307[_0x0cf1('0x6c')]<=_0x222272[_0x3e315a]['from']){_0x37c9c3[_0x0cf1('0x66')]=_0x222272[_0x3e315a][_0x0cf1('0x71')];}else if(_0x758307[_0x0cf1('0x6c')]>_0x222272[_0x3e315a][_0x0cf1('0x71')]&&_0x758307['min_internal']<=_0x222272[_0x3e315a]['to']){_0x37c9c3[_0x0cf1('0x66')]=_0x758307[_0x0cf1('0x6c')];}}}if(_[_0x0cf1('0x70')](_0x37c9c3['internal'])){_0x37c9c3[_0x0cf1('0x66')]=_0x317d42+0x1;}return _0x2eb104(_0x37c9c3);});});})['catch'](function(_0x41728c){_0x1b61db(_0x41728c);});});}function updateUser(_0x2278a7){return new BPromise(function(_0x2c1225,_0x177006){try{if(_0x2278a7[_0x0cf1('0x72')]){_0x2278a7[_0x0cf1('0x73')]=_0x2278a7[_0x0cf1('0x66')];_0x2278a7['VoiceMail']={'mailbox':_0x2278a7['internal'],'password':_0x2278a7[_0x0cf1('0x41')],'fullname':_0x2278a7['fullname'],'email':_0x2278a7[_0x0cf1('0x74')]};}if(_0x2278a7['role']==='agent'){if(!_0x2278a7[_0x0cf1('0x75')])_0x2278a7[_0x0cf1('0x75')]=[_0x0cf1('0x76'),_0x0cf1('0x77'),_0x0cf1('0x78'),'113','110',_0x0cf1('0x79'),_0x0cf1('0x7a'),'106',_0x0cf1('0x7b'),_0x0cf1('0x7c'),_0x0cf1('0x7d'),_0x0cf1('0x7e'),_0x0cf1('0x7f'),_0x0cf1('0x80'),'115'];}_0x2c1225(_0x2278a7);}catch(_0x520178){_0x177006(_0x520178);}});}exports[_0x0cf1('0x81')]=function(_0x349f03,_0x583cb2){if(_0x349f03[_0x0cf1('0x2e')][_0x0cf1('0x37')]===_0x0cf1('0x2f'))throw new Error(_0x0cf1('0x82'));if(_0x349f03[_0x0cf1('0x62')]['role']===_0x0cf1('0x2e')&&_0x349f03[_0x0cf1('0x2e')][_0x0cf1('0x37')]!==_0x0cf1('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x349f03[_0x0cf1('0x62')][_0x0cf1('0x37')]===_0x0cf1('0x2c')&&_0x349f03[_0x0cf1('0x2e')]['role']!=='admin'){throw new Error(_0x0cf1('0x83'));}return licenseUtil[_0x0cf1('0x84')]([_0x349f03['body']])['then'](function(){return validateUser(_0x349f03[_0x0cf1('0x62')]);})[_0x0cf1('0x16')](function(_0x3aad72){return updateUser(_0x3aad72)[_0x0cf1('0x16')](function(_0x4dba38){if(_0x4dba38[_0x0cf1('0x37')]===_0x0cf1('0x2c')){_0x4dba38[_0x0cf1('0x85')]=_0x349f03['user'][_0x0cf1('0x85')];delete _0x4dba38[_0x0cf1('0x86')];}return _0x4dba38;});})[_0x0cf1('0x16')](function(_0x4ab599){return db[_0x0cf1('0x45')][_0x0cf1('0x81')](_0x4ab599,{'include':[{'model':db[_0x0cf1('0x87')],'as':'VoiceMail'}]});})[_0x0cf1('0x16')](function(_0x28af85){if(_0x349f03[_0x0cf1('0x62')][_0x0cf1('0x37')]===_0x0cf1('0x2e'))return _0x28af85;if(_0x349f03[_0x0cf1('0x2e')][_0x0cf1('0x37')]!==_0x0cf1('0x2e'))return _0x28af85;return db[_0x0cf1('0x88')][_0x0cf1('0x38')]({'where':{'name':_0x28af85[_0x0cf1('0x37')]==='agent'?_0x0cf1('0x89'):_0x0cf1('0x30'),'userProfileId':_0x349f03['user'][_0x0cf1('0x86')]},'raw':!![]})['then'](function(_0x415861){if(!_0x415861||_0x415861[_0x0cf1('0x8a')]!=0x0)return _0x28af85;return db[_0x0cf1('0x8b')][_0x0cf1('0x81')]({'name':_0x28af85['name'],'resourceId':_0x28af85['id'],'type':_0x415861[_0x0cf1('0x39')],'sectionId':_0x415861['id']},{})[_0x0cf1('0x16')](function(){return _0x28af85;});})[_0x0cf1('0x20')](function(_0x1aefd1){logger[_0x0cf1('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1aefd1);throw _0x1aefd1;});})['then'](respondWithResult(_0x583cb2,0xc9))[_0x0cf1('0x20')](handleError(_0x583cb2,null));};exports[_0x0cf1('0x8c')]=function(_0x181215,_0x3ba776){var _0x2ae257=_0x181215['body'];var _0x454612=[];if(_0x181215[_0x0cf1('0x2e')][_0x0cf1('0x37')]===_0x0cf1('0x2f'))throw new Error(_0x0cf1('0x82'));if(_[_0x0cf1('0x8d')](_0x2ae257,['role',_0x0cf1('0x2e')])&&_0x181215[_0x0cf1('0x2e')]['role']!==_0x0cf1('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x0cf1('0x8d')](_0x2ae257,[_0x0cf1('0x37'),_0x0cf1('0x2c')])&&_0x181215[_0x0cf1('0x2e')][_0x0cf1('0x37')]!==_0x0cf1('0x2c')){throw new Error(_0x0cf1('0x8e'));}return licenseUtil[_0x0cf1('0x84')](_0x2ae257)['then'](function(){return validateUser(_0x2ae257[0x0]);})[_0x0cf1('0x16')](function(){for(var _0xa6b44b=0x1;_0xa6b44b<_0x2ae257[_0x0cf1('0x50')];_0xa6b44b++){var _0xf99214=_0x2ae257[_0xa6b44b-0x1][_0x0cf1('0x66')];if(!_0x2ae257[_0xa6b44b]['internal'])_0x2ae257[_0xa6b44b][_0x0cf1('0x66')]=_0xf99214+0x1;_0x454612[_0x0cf1('0x4a')](validateUser(_0x2ae257[_0xa6b44b]));}return BPromise[_0x0cf1('0x57')](_0x454612);})['then'](function(){_0x454612=[];for(var _0x5486e6=0x0;_0x5486e6<_0x2ae257['length'];_0x5486e6++){_0x454612['push'](updateUser(_0x2ae257[_0x5486e6]));}return BPromise[_0x0cf1('0x57')](_0x454612);})[_0x0cf1('0x16')](function(){return BPromise[_0x0cf1('0x8f')](_0x2ae257,function(_0x3f0d9f){return db['User'][_0x0cf1('0x81')](_0x3f0d9f,{'include':[{'model':db[_0x0cf1('0x87')],'as':'VoiceMail'}]})[_0x0cf1('0x16')](function(_0x367386){_0x3f0d9f['id']=_0x367386['id'];return _0x3f0d9f;});});})['then'](function(_0x38f7be){if(_0x181215[_0x0cf1('0x62')][_0x0cf1('0x37')]===_0x0cf1('0x2e'))return _0x38f7be;if(_0x181215['user']['role']!=='user')return _0x38f7be;var _0x52182a=_[_0x0cf1('0x8d')](_0x38f7be,function(_0x1ca75f){return _0x1ca75f[_0x0cf1('0x37')]===_0x0cf1('0x2f')||_0x1ca75f[_0x0cf1('0x37')]===_0x0cf1('0x31');});if(!_0x52182a)return _0x38f7be;return db[_0x0cf1('0x88')]['findAll']({'where':{'name':{'$or':[_0x0cf1('0x89'),'Telephones']},'userProfileId':_0x181215[_0x0cf1('0x2e')][_0x0cf1('0x86')]},'raw':!![]})[_0x0cf1('0x16')](function(_0x48e20a){if(_['isEmpty'](_0x48e20a)||!_[_0x0cf1('0x8d')](_0x48e20a,[_0x0cf1('0x8a'),0x0]))return _0x38f7be;_0x454612=[];var _0x3bd58c=_(_0x48e20a)[_0x0cf1('0x34')](function(_0x5050e3){if(_0x5050e3['autoAssociation']===0x1)return;return _0x5050e3[_0x0cf1('0x39')]===_0x0cf1('0x89')?_0x0cf1('0x2f'):_0x0cf1('0x31');})[_0x0cf1('0x90')]()[_0x0cf1('0x35')]();for(var _0x27c74e=0x0;_0x27c74e<_0x38f7be['length'];_0x27c74e++){if(!_[_0x0cf1('0x36')](_0x3bd58c,_0x38f7be[_0x27c74e][_0x0cf1('0x37')]))return;var _0x56048d=_0x38f7be[_0x27c74e][_0x0cf1('0x37')]===_0x0cf1('0x2f')?_0x0cf1('0x89'):'Telephones';_0x454612[_0x0cf1('0x4a')](db[_0x0cf1('0x8b')][_0x0cf1('0x81')]({'name':_0x38f7be[_0x27c74e][_0x0cf1('0x39')],'resourceId':_0x38f7be[_0x27c74e]['id'],'type':_0x56048d,'sectionId':_[_0x0cf1('0x38')](_0x48e20a,['name',_0x56048d])['id']},{}));}return BPromise[_0x0cf1('0x57')](_0x454612);});})[_0x0cf1('0x16')](respondWithResult(_0x3ba776,0xc9))[_0x0cf1('0x20')](handleError(_0x3ba776,null));};exports[_0x0cf1('0x91')]=function(_0x1b0649,_0x594737){if(_0x1b0649['body']['id']){delete _0x1b0649['body']['id'];}return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x1b0649[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](function(_0x239507){if(!_0x239507)return null;if(_0x239507['id']===_0x1b0649[_0x0cf1('0x2e')]['id']){if(!_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x92')]||!_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')]){throw new db[(_0x0cf1('0x94'))]['ValidationError'](_0x0cf1('0x95'));}if(!_0x239507[_0x0cf1('0x96')](_0x1b0649[_0x0cf1('0x62')]['oldPassword'])){throw new db['Sequelize'][(_0x0cf1('0x97'))](_0x0cf1('0x98'));}if(_0x1b0649['body'][_0x0cf1('0x92')]===_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')]){throw new db[(_0x0cf1('0x94'))][(_0x0cf1('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1b0649['user'][_0x0cf1('0x37')]===_0x0cf1('0x2c')){if(!_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')]){throw new db[(_0x0cf1('0x94'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1b0649[_0x0cf1('0x2e')]['role']==='user'){if(!_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')]){throw new db['Sequelize'][(_0x0cf1('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x239507[_0x0cf1('0x37')]!==_0x0cf1('0x2f')){throw new db[(_0x0cf1('0x94'))][(_0x0cf1('0x97'))](_0x0cf1('0x82'));}}else{throw new db[(_0x0cf1('0x94'))]['ValidationError'](_0x0cf1('0x82'));}return _0x239507;})[_0x0cf1('0x16')](handleEntityNotFound(_0x594737,null))[_0x0cf1('0x16')](function(_0x2944a0){return db['Setting'][_0x0cf1('0x99')]({'attributes':['id','securePassword',_0x0cf1('0x9a'),_0x0cf1('0x9b')]})['then'](function(_0x145723){if(_0x145723[_0x0cf1('0x69')])authService[_0x0cf1('0x6a')](_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')]);if(!_0x145723['enforcePasswordHistory']||!_0x2944a0['previousPasswords'])return _0x2944a0;authService[_0x0cf1('0x9c')](_0x1b0649['body'][_0x0cf1('0x93')],_0x2944a0[_0x0cf1('0x9d')],_0x145723[_0x0cf1('0x9b')]);return _0x2944a0;})[_0x0cf1('0x16')](saveUpdates({'password':_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')],'passwordResetAt':_0x1b0649[_0x0cf1('0x2e')]['id']==_0x1b0649[_0x0cf1('0x58')]['id']?moment():null,'previousPasswords':authService[_0x0cf1('0x9e')](_0x1b0649[_0x0cf1('0x62')][_0x0cf1('0x93')],_0x2944a0[_0x0cf1('0x9d')])},null));})['then'](respondWithResult(_0x594737,null))[_0x0cf1('0x20')](handleError(_0x594737,null));};exports[_0x0cf1('0x9f')]=function(_0x9a6c7b,_0x311af3){var _0x3266d7=_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0xa0')];return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x9a6c7b['params']['id']},'attributes':['id','name',_0x0cf1('0x37'),_0x0cf1('0xa1'),_0x0cf1('0xa2'),'voicePause',_0x0cf1('0xa3')]})[_0x0cf1('0x16')](handleEntityNotFound(_0x311af3,null))[_0x0cf1('0x16')](function(_0x7f85b2){if(_0x7f85b2){if(!utils[_0x0cf1('0xa4')](_0x3266d7)){throw new db[(_0x0cf1('0x94'))][(_0x0cf1('0x97'))]('Unknown\x20channel');}return _0x7f85b2[_0x0cf1('0xa5')+_[_0x0cf1('0xa6')](_0x3266d7[_0x0cf1('0xa7')]())+_0x0cf1('0xa8')](_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0x65')],{'penalty':_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0xa9')]||0x0})[_0x0cf1('0xaa')](function(_0xebe552){for(var _0x39b394=0x0;_0x39b394<_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0x65')][_0x0cf1('0x50')];_0x39b394+=0x1){var _0xf8d36d={'UserId':Number(_0x9a6c7b['params']['id'])};_0xf8d36d[_[_0x0cf1('0xa6')](_0x3266d7[_0x0cf1('0xa7')]())+_0x0cf1('0xab')]=Number(_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0x65')][_0x39b394]);socket['emit']('user'+_[_0x0cf1('0xa6')](_0x3266d7['toLowerCase']())+_0x0cf1('0xac'),_0xf8d36d);}return _0xebe552;})[_0x0cf1('0x16')](function(){if(_0x3266d7==='voice'){return db[_0x0cf1('0xad')][_0x0cf1('0x4b')]({'where':{'id':_0x9a6c7b['body'][_0x0cf1('0x65')]||[]},'raw':!![],'attributes':['id',_0x0cf1('0x39')]});}})['then'](function(_0x198cb2){var _0x52d53f=_0x7f85b2[_0x0cf1('0xae')]({'plain':!![]});var _0x5bf05f=[];if(_0x3266d7==='voice'&&_0x52d53f[_0x0cf1('0x37')]===_0x0cf1('0x2f')&&_0x52d53f[_0x0cf1('0xa1')]){for(var _0x26c8e7=0x0;_0x26c8e7<_0x198cb2[_0x0cf1('0x50')];_0x26c8e7+=0x1){_0x5bf05f[_0x0cf1('0x4a')]({'membername':_0x52d53f[_0x0cf1('0x39')],'UserId':_0x52d53f['id'],'queue_name':_0x198cb2[_0x26c8e7]['name'],'VoiceQueueId':_0x198cb2[_0x26c8e7]['id'],'interface':_[_0x0cf1('0x70')](_0x52d53f['interface'])?util[_0x0cf1('0xaf')](_0x0cf1('0xb0'),_0x52d53f['name']):_0x52d53f['interface'],'paused':_0x52d53f[_0x0cf1('0xb1')]||![],'penalty':_0x9a6c7b[_0x0cf1('0x62')][_0x0cf1('0xa9')]||0x0});}return BPromise['each'](_0x5bf05f,function(_0x1c6d30){return db[_0x0cf1('0xb2')]['upsert'](_0x1c6d30);});}return _0x7f85b2;});}})['then'](respondWithStatusCode(_0x311af3,null))[_0x0cf1('0x20')](handleError(_0x311af3,null));};exports[_0x0cf1('0xb3')]=function(_0x10a98b,_0x425e3b){var _0x5ae010,_0xe73f3b;return db[_0x0cf1('0x45')]['find']({'where':{'id':_0x10a98b['params']['id']},'attributes':['id',_0x0cf1('0x39'),'role']})[_0x0cf1('0x16')](handleEntityNotFound(_0x425e3b,null))[_0x0cf1('0x16')](function(_0x4a5624){if(_0x4a5624){_0x5ae010=_0x4a5624;if(!_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0xa0')]||!utils[_0x0cf1('0xa4')](_0x10a98b['query'][_0x0cf1('0xa0')])){throw new db[(_0x0cf1('0x94'))][(_0x0cf1('0x97'))]('Unknown\x20channel');}return _0x4a5624[_0x0cf1('0xb4')+_[_0x0cf1('0xa6')](_0x10a98b[_0x0cf1('0x4d')]['channel'][_0x0cf1('0xa7')]())+'Queues'](_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0x65')]);}})['then'](function(_0x24146b){if(_[_0x0cf1('0xb5')](_0x10a98b['query'][_0x0cf1('0x65')])){for(var _0x16b753=0x0;_0x16b753<_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0x65')][_0x0cf1('0x50')];_0x16b753+=0x1){_0xe73f3b={'UserId':Number(_0x10a98b[_0x0cf1('0x58')]['id'])};_0xe73f3b[_['capitalize'](_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0xa0')]['toLowerCase']())+'QueueId']=Number(_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0x65')][_0x16b753]);socket[_0x0cf1('0x29')](_0x0cf1('0x2e')+_[_0x0cf1('0xa6')](_0x10a98b['query']['channel'][_0x0cf1('0xa7')]())+_0x0cf1('0xb6'),_0xe73f3b);}}else{_0xe73f3b={'UserId':Number(_0x10a98b[_0x0cf1('0x58')]['id'])};_0xe73f3b[_['capitalize'](_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0xa0')][_0x0cf1('0xa7')]())+_0x0cf1('0xab')]=Number(_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0x65')]);socket['emit'](_0x0cf1('0x2e')+_[_0x0cf1('0xa6')](_0x10a98b[_0x0cf1('0x4d')]['channel']['toLowerCase']())+_0x0cf1('0xb6'),_0xe73f3b);}return _0x24146b;})[_0x0cf1('0x16')](function(){if(_0x10a98b['query']['channel']===_0x0cf1('0xb7')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x10a98b[_0x0cf1('0x58')]['id'],'VoiceQueueId':_0x10a98b[_0x0cf1('0x4d')][_0x0cf1('0x65')]},'individualHooks':!![]})[_0x0cf1('0x16')](function(){return _0x5ae010;});}return _0x5ae010;})[_0x0cf1('0x16')](respondWithStatusCode(_0x425e3b,null))[_0x0cf1('0x20')](handleError(_0x425e3b,null));};exports['addAvatar']=function(_0x15afd0,_0x484ef9){_0x15afd0[_0x0cf1('0x62')][_0x0cf1('0xb8')]=_0x15afd0[_0x0cf1('0xb9')][_0x0cf1('0xba')];return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x15afd0['params']['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x484ef9,null))[_0x0cf1('0x16')](saveUpdates(_0x15afd0[_0x0cf1('0x62')],null))['then'](respondWithResult(_0x484ef9,null))['catch'](handleError(_0x484ef9,null));};exports[_0x0cf1('0xbb')]=function(_0xeca7e9,_0x35ad05){var _0x5544c8=path[_0x0cf1('0xbc')](config[_0x0cf1('0xbd')],'server/files/images/logos/default_profile.png');return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0xeca7e9[_0x0cf1('0x58')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x35ad05,null))[_0x0cf1('0x16')](function(_0x5778e6){if(_0x5778e6){if(_[_0x0cf1('0x70')](_0x5778e6['userpic'])){return _0x35ad05[_0x0cf1('0xbe')](_0x5544c8);}else{if(!fs[_0x0cf1('0xbf')](path['join'](config[_0x0cf1('0xbd')],_0x0cf1('0xc0'),_0x5778e6[_0x0cf1('0xb8')]))){return _0x35ad05[_0x0cf1('0xbe')](_0x5544c8);}return _0x35ad05[_0x0cf1('0xbe')](path[_0x0cf1('0xbc')](config['root'],'server/files/images/',_0x5778e6[_0x0cf1('0xb8')]));}}})[_0x0cf1('0x20')](handleError(_0x35ad05,null));};exports[_0x0cf1('0xc1')]=function(_0xf8053f,_0x18b9ee){return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0xf8053f[_0x0cf1('0x58')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x18b9ee,null))[_0x0cf1('0x16')](function(_0x5cd653){var _0x198992=[];values=_0x5cd653[_0x0cf1('0x52')];_0x198992[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x51'),_0x5cd653[_0x0cf1('0x52')]));_0x198992[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x53'),_0x5cd653[_0x0cf1('0x52')]));_0x198992['push'](get_open_tabs('openchannel',_0x5cd653[_0x0cf1('0x52')]));_0x198992['push'](get_open_tabs('whatsapp',_0x5cd653[_0x0cf1('0x52')]));_0x198992[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0xc2'),_0x5cd653[_0x0cf1('0x52')]));_0x198992[_0x0cf1('0x4a')](get_open_tabs(_0x0cf1('0x54'),_0x5cd653[_0x0cf1('0x52')]));return BPromise[_0x0cf1('0x57')](_0x198992);})['then'](function(_0x4d6e08){if(_0x4d6e08){var _0x256c46=_[_0x0cf1('0x34')](values[_0x0cf1('0xc3')],function(_0x17a13d){return{'channel':_0x0cf1('0xc4'),'id':_0x17a13d['id'],'createdAt':_0x17a13d[_0x0cf1('0xc5')]};});var _0x22d15d=_[_0x0cf1('0x34')](values[_0x0cf1('0xc6')],function(_0xa9c4a){return{'channel':_0x0cf1('0xc7'),'id':_0xa9c4a['id'],'createdAt':_0xa9c4a[_0x0cf1('0xc5')]};});var _0x53576b=_[_0x0cf1('0x34')](values['OpenchannelOpenTabs'],function(_0x33d7f1){return{'channel':_0x0cf1('0xc8'),'id':_0x33d7f1['id'],'createdAt':_0x33d7f1['createdAt']};});var _0x19536a=_[_0x0cf1('0x34')](values[_0x0cf1('0xc9')],function(_0x4b1df7){return{'channel':_0x0cf1('0xca'),'id':_0x4b1df7['id'],'createdAt':_0x4b1df7[_0x0cf1('0xc5')]};});var _0x450527=_[_0x0cf1('0x34')](values['SmsOpenTabs'],function(_0x5ab8cb){return{'channel':_0x0cf1('0xcb'),'id':_0x5ab8cb['id'],'createdAt':_0x5ab8cb[_0x0cf1('0xc5')]};});var _0xa86fd7=_[_0x0cf1('0x34')](values[_0x0cf1('0xcc')],function(_0x5824f4){return{'channel':_0x0cf1('0xcd'),'id':_0x5824f4['id'],'createdAt':_0x5824f4['createdAt']};});var _0x5690d2=_[_0x0cf1('0xce')](_0x256c46,_0x22d15d,_0x53576b,_0x19536a,_0x450527,_0xa86fd7);var _0x13f9fd={'count':_0x5690d2['length'],'rows':_0x5690d2};return _0x13f9fd;}else return null;})[_0x0cf1('0x16')](respondWithResult(_0x18b9ee,null))[_0x0cf1('0x20')](handleError(_0x18b9ee,null));};exports['getContacts']=function(_0x1572d9,_0x45e440){var _0x5acf0e={};var _0x6f0025={};var _0x30fcb7;var _0x23435a;return db['User'][_0x0cf1('0x99')]({'where':{'id':_0x1572d9[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x45e440,null))[_0x0cf1('0x16')](function(_0x817b1e){if(_0x817b1e){_0x30fcb7=_0x817b1e;_0x6f0025[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xcf')][_0x0cf1('0x3e')]);_0x6f0025[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x1572d9[_0x0cf1('0x4d')]);_0x6f0025['filters']=_['intersection'](_0x6f0025['model'],_0x6f0025[_0x0cf1('0x4d')]);_0x5acf0e['attributes']=_[_0x0cf1('0x5d')](_0x6f0025[_0x0cf1('0x59')],qs['fields'](_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x5acf0e[_0x0cf1('0x49')]=_0x5acf0e['attributes'][_0x0cf1('0x50')]?_0x5acf0e['attributes']:_0x6f0025[_0x0cf1('0x59')];_0x5acf0e['order']=qs[_0x0cf1('0xd0')](_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x5acf0e[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x1572d9[_0x0cf1('0x4d')],_0x6f0025[_0x0cf1('0x5c')]));if(_0x1572d9[_0x0cf1('0x4d')]['filter']){_0x5acf0e[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x5acf0e[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x5acf0e[_0x0cf1('0x49')],function(_0x10dac8){var _0x49c90b={};_0x49c90b[_0x10dac8]={'$like':'%'+_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0x49c90b;})});}_0x5acf0e=_[_0x0cf1('0x60')]({},_0x5acf0e,_0x1572d9[_0x0cf1('0x61')]);return _0x30fcb7[_0x0cf1('0xd2')](_0x5acf0e);}})[_0x0cf1('0x16')](function(_0x54b63d){if(_0x54b63d){_0x23435a=_0x54b63d[_0x0cf1('0x50')];if(_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0xd3')]('includeAll')){_0x5acf0e[_0x0cf1('0x47')]=[{'model':db[_0x0cf1('0xd4')],'as':_0x0cf1('0xd5'),'required':![]},{'model':db[_0x0cf1('0xd6')],'as':_0x0cf1('0xd7'),'attributes':['id','name','color'],'where':_0x1572d9['query'][_0x0cf1('0xd8')]?{'id':_0x1572d9[_0x0cf1('0x4d')]['tag']}:undefined,'required':_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0xd8')]?!![]:![]}];}if(!_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0xd3')]('nolimit')){_0x5acf0e[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x5acf0e[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x1572d9[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x30fcb7[_0x0cf1('0xd2')](_0x5acf0e);}})[_0x0cf1('0x16')](function(_0x3ba275){if(_0x3ba275){return _0x3ba275?{'count':_0x23435a,'rows':_0x3ba275}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x45e440,null))[_0x0cf1('0x20')](handleError(_0x45e440,null));};exports['getQueues']=function(_0x255e03,_0x38647f){var _0x39d9d9;var _0x23f673={};var _0x20b69c;return db['User'][_0x0cf1('0x99')]({'where':{'id':_0x255e03[_0x0cf1('0x58')]['id']},'attributes':['id',_0x0cf1('0x39'),_0x0cf1('0x37')]})[_0x0cf1('0x16')](handleEntityNotFound(_0x38647f,null))[_0x0cf1('0x16')](function(_0x440ffd){if(!utils[_0x0cf1('0xa4')](_0x255e03['query']['channel'])){throw new db[(_0x0cf1('0x94'))][(_0x0cf1('0x97'))](_0x0cf1('0xda'));}_0x39d9d9=_0x440ffd;var _0x2d1d62={};_0x2d1d62['model']=_[_0x0cf1('0x5b')](db[_[_0x0cf1('0xa6')](_0x255e03[_0x0cf1('0x4d')]['channel'])+_0x0cf1('0xdb')][_0x0cf1('0x3e')]);_0x2d1d62[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x255e03[_0x0cf1('0x4d')]);_0x2d1d62['filters']=_[_0x0cf1('0x5d')](_0x2d1d62[_0x0cf1('0x59')],_0x2d1d62[_0x0cf1('0x4d')]);_0x23f673['attributes']=_[_0x0cf1('0x5d')](_0x2d1d62['model'],qs[_0x0cf1('0x5e')](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x23f673[_0x0cf1('0x49')]=_0x23f673[_0x0cf1('0x49')]['length']?_0x23f673[_0x0cf1('0x49')]:_0x2d1d62[_0x0cf1('0x59')];_0x23f673[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x23f673[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x255e03['query'],_0x2d1d62['filters']));if(_0x255e03['query'][_0x0cf1('0x32')]){_0x23f673[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x23f673[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x23f673[_0x0cf1('0x49')],function(_0x15fd26){var _0x113bf6={};_0x113bf6[_0x15fd26]={'$like':'%'+_0x255e03['query'][_0x0cf1('0x32')]+'%'};return _0x113bf6;})});}_0x23f673=_[_0x0cf1('0x60')]({},_0x23f673,_0x255e03[_0x0cf1('0x61')]);switch(_0x39d9d9[_0x0cf1('0x37')]){case'admin':return db[_[_0x0cf1('0xa6')](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0xa0')])+'Queue'][_0x0cf1('0x4b')](_0x23f673);case _0x0cf1('0x2e'):case _0x0cf1('0x2f'):return _0x39d9d9[_0x0cf1('0xae')+_[_0x0cf1('0xa6')](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0xa0')])+_0x0cf1('0xa8')](_0x23f673);default:throw new db['Sequelize'][(_0x0cf1('0x97'))](_0x0cf1('0xdd'));}})[_0x0cf1('0x16')](function(_0x4baedc){_0x20b69c=_0x4baedc[_0x0cf1('0x50')];if(!_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x23f673[_0x0cf1('0xd9')]=qs['limit'](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x23f673[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x255e03[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}switch(_0x39d9d9['role']){case _0x0cf1('0x2c'):return db[_[_0x0cf1('0xa6')](_0x255e03['query'][_0x0cf1('0xa0')])+_0x0cf1('0xdb')][_0x0cf1('0x4b')](_0x23f673);case'user':case'agent':return _0x39d9d9[_0x0cf1('0xae')+_['capitalize'](_0x255e03[_0x0cf1('0x4d')]['channel'])+_0x0cf1('0xa8')](_0x23f673);}})['then'](function(_0x2a6494){return{'count':_0x20b69c,'rows':_0x2a6494};})[_0x0cf1('0x16')](respondWithResult(_0x38647f,null))[_0x0cf1('0x20')](handleError(_0x38647f,null));};exports[_0x0cf1('0xdf')]=function(_0x53b939,_0x52ff45){var _0x2627fb={};var _0x33015b={};var _0x448d4d;var _0x41b4b2;return db[_0x0cf1('0x45')]['findOne']({'where':{'id':_0x53b939['params']['id']}})['then'](handleEntityNotFound(_0x52ff45,null))['then'](function(_0x3ed9cf){if(_0x3ed9cf){_0x448d4d=_0x3ed9cf;_0x33015b['model']=_[_0x0cf1('0x5b')](db[_0x0cf1('0xb2')][_0x0cf1('0x3e')]);_0x33015b['query']=_[_0x0cf1('0x5b')](_0x53b939[_0x0cf1('0x4d')]);_0x33015b[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x33015b[_0x0cf1('0x59')],_0x33015b[_0x0cf1('0x4d')]);_0x2627fb['attributes']=_[_0x0cf1('0x5d')](_0x33015b['model'],qs[_0x0cf1('0x5e')](_0x53b939[_0x0cf1('0x4d')]['fields']));_0x2627fb[_0x0cf1('0x49')]=_0x2627fb[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x2627fb[_0x0cf1('0x49')]:_0x33015b['model'];_0x2627fb['order']=qs[_0x0cf1('0xd0')](_0x53b939[_0x0cf1('0x4d')]['sort']);_0x2627fb['where']=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x53b939[_0x0cf1('0x4d')],_0x33015b[_0x0cf1('0x5c')]));if(_0x53b939[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x2627fb['where']=_[_0x0cf1('0x60')](_0x2627fb['where'],{'$or':_['map'](_0x2627fb[_0x0cf1('0x49')],function(_0x4d761b){var _0x28efad={};_0x28efad[_0x4d761b]={'$like':'%'+_0x53b939[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0x28efad;})});}_0x2627fb=_[_0x0cf1('0x60')]({},_0x2627fb,_0x53b939[_0x0cf1('0x61')]);return _0x448d4d[_0x0cf1('0xdf')](_0x2627fb);}})[_0x0cf1('0x16')](function(_0x39a0d2){if(_0x39a0d2){_0x41b4b2=_0x39a0d2[_0x0cf1('0x50')];if(!_0x53b939[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x2627fb[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x53b939[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x2627fb['offset']=qs[_0x0cf1('0x25')](_0x53b939[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x448d4d[_0x0cf1('0xdf')](_0x2627fb);}})['then'](function(_0x2b7507){if(_0x2b7507){return _0x2b7507?{'count':_0x41b4b2,'rows':_0x2b7507}:null;}})['then'](respondWithResult(_0x52ff45,null))['catch'](handleError(_0x52ff45,null));};exports[_0x0cf1('0xe0')]=function(_0x1d8ee7,_0x223c9f){var _0x471340={};var _0x29b707={};var _0x456bf8;var _0x1261b4;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x1d8ee7[_0x0cf1('0x58')]['id']}})['then'](handleEntityNotFound(_0x223c9f,null))['then'](function(_0x39c9e0){if(_0x39c9e0){_0x456bf8=_0x39c9e0;_0x29b707['model']=_[_0x0cf1('0x5b')](db['ChatGroup'][_0x0cf1('0x3e')]);_0x29b707[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x1d8ee7['query']);_0x29b707[_0x0cf1('0x5c')]=_['intersection'](_0x29b707[_0x0cf1('0x59')],_0x29b707[_0x0cf1('0x4d')]);_0x471340[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x29b707['model'],qs[_0x0cf1('0x5e')](_0x1d8ee7['query'][_0x0cf1('0x5e')]));_0x471340[_0x0cf1('0x49')]=_0x471340[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x471340[_0x0cf1('0x49')]:_0x29b707['model'];_0x471340[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x1d8ee7[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x471340[_0x0cf1('0x44')]=qs['filters'](_[_0x0cf1('0xd1')](_0x1d8ee7[_0x0cf1('0x4d')],_0x29b707[_0x0cf1('0x5c')]));if(_0x1d8ee7[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x471340[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x471340[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x471340['attributes'],function(_0x274657){var _0x40204f={};_0x40204f[_0x274657]={'$like':'%'+_0x1d8ee7[_0x0cf1('0x4d')]['filter']+'%'};return _0x40204f;})});}_0x471340=_[_0x0cf1('0x60')]({},_0x471340,_0x1d8ee7['options']);return _0x456bf8[_0x0cf1('0xe0')](_0x471340);}})['then'](function(_0xa685e8){if(_0xa685e8){_0x1261b4=_0xa685e8[_0x0cf1('0x50')];if(!_0x1d8ee7[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x471340[_0x0cf1('0xd9')]=qs['limit'](_0x1d8ee7[_0x0cf1('0x4d')]['limit']);_0x471340[_0x0cf1('0x25')]=qs['offset'](_0x1d8ee7[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x456bf8[_0x0cf1('0xe0')](_0x471340);}})[_0x0cf1('0x16')](function(_0x279b49){if(_0x279b49){return _0x279b49?{'count':_0x1261b4,'rows':_0x279b49}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x223c9f,null))[_0x0cf1('0x20')](handleError(_0x223c9f,null));};exports[_0x0cf1('0xe1')]=function(_0x453545,_0x1af673){var _0x1cdcde={'raw':!![],'where':{}};var _0x5d4052={};var _0x12d490={'count':0x0,'rows':[]};return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x453545[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x1af673,null))[_0x0cf1('0x16')](function(_0x96ce4c){if(_0x96ce4c){_0x5d4052[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xe2')]['rawAttributes']);_0x5d4052[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x453545['query']);_0x5d4052[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x5d4052[_0x0cf1('0x59')],_0x5d4052['query']);_0x1cdcde[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x5d4052[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0x453545['query'][_0x0cf1('0x5e')]));_0x1cdcde[_0x0cf1('0x49')]=_0x1cdcde[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x1cdcde[_0x0cf1('0x49')]:_0x5d4052[_0x0cf1('0x59')];if(!_0x453545[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x1cdcde['limit']=qs['limit'](_0x453545['query']['limit']);_0x1cdcde[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x453545['query'][_0x0cf1('0x25')]);}_0x1cdcde[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x453545[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x1cdcde[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x453545[_0x0cf1('0x4d')],_0x5d4052[_0x0cf1('0x5c')]));_0x1cdcde['where'][_0x0cf1('0xe3')]=_0x96ce4c['id'];if(_0x453545['query'][_0x0cf1('0x32')]){_0x1cdcde[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x1cdcde['where'],{'$or':_[_0x0cf1('0x34')](_0x1cdcde[_0x0cf1('0x49')],function(_0x5305a2){var _0x45db0c={};_0x45db0c[_0x5305a2]={'$like':'%'+_0x453545['query'][_0x0cf1('0x32')]+'%'};return _0x45db0c;})});}_0x1cdcde=_['merge']({},_0x1cdcde,_0x453545[_0x0cf1('0x61')]);return db['VoiceRecording'][_0x0cf1('0x24')]({'where':_0x1cdcde[_0x0cf1('0x44')]})['then'](function(_0x59a4ca){_0x12d490[_0x0cf1('0x24')]=_0x59a4ca;if(_0x453545[_0x0cf1('0x4d')]['includeAll']){_0x1cdcde[_0x0cf1('0x47')]=[{'all':!![]}];}return db[_0x0cf1('0xe2')]['findAll'](_0x1cdcde);})['then'](function(_0x56d0fe){_0x12d490[_0x0cf1('0x4c')]=_0x56d0fe;return _0x12d490;});}})['then'](respondWithFilteredResult(_0x1af673,_0x1cdcde))[_0x0cf1('0x20')](handleError(_0x1af673,null));};exports[_0x0cf1('0xe4')]=function(_0x59686f,_0x3b5912){var _0x359d40={'raw':!![],'where':{}};var _0x1ceefc={};var _0xbcf20f={'count':0x0,'rows':[]};return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x59686f['params']['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x3b5912,null))[_0x0cf1('0x16')](function(_0x3e0cfb){if(_0x3e0cfb){_0x1ceefc['model']=_[_0x0cf1('0x5b')](db[_0x0cf1('0xe5')][_0x0cf1('0x3e')]);_0x1ceefc['query']=_[_0x0cf1('0x5b')](_0x59686f[_0x0cf1('0x4d')]);_0x1ceefc[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x1ceefc['model'],_0x1ceefc[_0x0cf1('0x4d')]);_0x359d40[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x1ceefc[_0x0cf1('0x59')],qs['fields'](_0x59686f[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x359d40[_0x0cf1('0x49')]=_0x359d40[_0x0cf1('0x49')]['length']?_0x359d40[_0x0cf1('0x49')]:_0x1ceefc[_0x0cf1('0x59')];if(!_0x59686f['query'][_0x0cf1('0xd3')]('nolimit')){_0x359d40[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x59686f[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x359d40[_0x0cf1('0x25')]=qs['offset'](_0x59686f[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}_0x359d40[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x59686f[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x359d40[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x59686f['query'],_0x1ceefc[_0x0cf1('0x5c')]));_0x359d40[_0x0cf1('0x44')][_0x0cf1('0xe3')]=_0x3e0cfb['id'];if(_0x59686f[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x359d40[_0x0cf1('0x44')]=_['merge'](_0x359d40[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x359d40[_0x0cf1('0x49')],function(_0x4673dc){var _0x168c12={};_0x168c12[_0x4673dc]={'$like':'%'+_0x59686f['query'][_0x0cf1('0x32')]+'%'};return _0x168c12;})});}_0x359d40=_[_0x0cf1('0x60')]({},_0x359d40,_0x59686f[_0x0cf1('0x61')]);return db[_0x0cf1('0xe5')][_0x0cf1('0x24')]({'where':_0x359d40[_0x0cf1('0x44')]})[_0x0cf1('0x16')](function(_0x1fd5eb){_0xbcf20f['count']=_0x1fd5eb;if(_0x59686f['query']['includeAll']){_0x359d40[_0x0cf1('0x47')]=[{'all':!![]}];}return db[_0x0cf1('0xe5')][_0x0cf1('0x4b')](_0x359d40);})[_0x0cf1('0x16')](function(_0x3f52f3){_0xbcf20f[_0x0cf1('0x4c')]=_0x3f52f3;return _0xbcf20f;});}})[_0x0cf1('0x16')](respondWithFilteredResult(_0x3b5912,_0x359d40))[_0x0cf1('0x20')](handleError(_0x3b5912,null));};exports[_0x0cf1('0xe6')]=function(_0xe751a6,_0x19f70c){var _0x18d331={};var _0x7efb68={};var _0x80de85;var _0x36814c;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0xe751a6['params']['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x19f70c,null))[_0x0cf1('0x16')](function(_0x4b4112){if(_0x4b4112){_0x80de85=_0x4b4112;_0x7efb68[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xe7')][_0x0cf1('0x3e')]);_0x7efb68[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0xe751a6['query']);_0x7efb68[_0x0cf1('0x5c')]=_['intersection'](_0x7efb68[_0x0cf1('0x59')],_0x7efb68[_0x0cf1('0x4d')]);_0x18d331[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x7efb68['model'],qs['fields'](_0xe751a6['query'][_0x0cf1('0x5e')]));_0x18d331[_0x0cf1('0x49')]=_0x18d331[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x18d331[_0x0cf1('0x49')]:_0x7efb68['model'];_0x18d331[_0x0cf1('0xdc')]=qs['sort'](_0xe751a6[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x18d331[_0x0cf1('0x44')]=qs['filters'](_[_0x0cf1('0xd1')](_0xe751a6['query'],_0x7efb68[_0x0cf1('0x5c')]));if(_0xe751a6[_0x0cf1('0x4d')]['filter']){_0x18d331[_0x0cf1('0x44')]=_['merge'](_0x18d331[_0x0cf1('0x44')],{'$or':_['map'](_0x18d331[_0x0cf1('0x49')],function(_0x422615){var _0xf0fb1a={};_0xf0fb1a[_0x422615]={'$like':'%'+_0xe751a6[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0xf0fb1a;})});}_0x18d331=_[_0x0cf1('0x60')]({},_0x18d331,_0xe751a6[_0x0cf1('0x61')]);return _0x80de85[_0x0cf1('0xe6')](_0x18d331);}})[_0x0cf1('0x16')](function(_0x42e047){if(_0x42e047){_0x36814c=_0x42e047[_0x0cf1('0x50')];if(!_0xe751a6[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x18d331[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0xe751a6['query'][_0x0cf1('0xd9')]);_0x18d331[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0xe751a6['query']['offset']);}return _0x80de85['getChatInteractions'](_0x18d331);}})[_0x0cf1('0x16')](function(_0x5046a8){if(_0x5046a8){return _0x5046a8?{'count':_0x36814c,'rows':_0x5046a8}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x19f70c,null))['catch'](handleError(_0x19f70c,null));};exports['getOpenchannelInteractions']=function(_0x5661ee,_0x381972){var _0x50580a={};var _0x272632={};var _0x3dfe76;var _0x3014de;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x5661ee[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x381972,null))[_0x0cf1('0x16')](function(_0xb1acc2){if(_0xb1acc2){_0x3dfe76=_0xb1acc2;_0x272632[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xe8')][_0x0cf1('0x3e')]);_0x272632[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x5661ee[_0x0cf1('0x4d')]);_0x272632[_0x0cf1('0x5c')]=_['intersection'](_0x272632[_0x0cf1('0x59')],_0x272632['query']);_0x50580a['attributes']=_['intersection'](_0x272632[_0x0cf1('0x59')],qs['fields'](_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x50580a[_0x0cf1('0x49')]=_0x50580a['attributes']['length']?_0x50580a[_0x0cf1('0x49')]:_0x272632[_0x0cf1('0x59')];_0x50580a[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x50580a[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x5661ee[_0x0cf1('0x4d')],_0x272632['filters']));if(_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x50580a[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x50580a[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x50580a[_0x0cf1('0x49')],function(_0x57f48c){var _0x154b30={};_0x154b30[_0x57f48c]={'$like':'%'+_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0x154b30;})});}_0x50580a=_[_0x0cf1('0x60')]({},_0x50580a,_0x5661ee[_0x0cf1('0x61')]);return _0x3dfe76['getOpenchannelInteractions'](_0x50580a);}})[_0x0cf1('0x16')](function(_0x2700ae){if(_0x2700ae){_0x3014de=_0x2700ae[_0x0cf1('0x50')];if(!_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x50580a[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x5661ee['query']['limit']);_0x50580a[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x5661ee[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x3dfe76['getOpenchannelInteractions'](_0x50580a);}})[_0x0cf1('0x16')](function(_0x58c2f1){if(_0x58c2f1){return _0x58c2f1?{'count':_0x3014de,'rows':_0x58c2f1}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x381972,null))[_0x0cf1('0x20')](handleError(_0x381972,null));};exports[_0x0cf1('0xe9')]=function(_0x2c22d3,_0x3e2398){var _0x49b0df={'raw':!![],'where':{}};var _0xbb7145={};var _0x2b62b4={'count':0x0,'rows':[]};return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x2c22d3[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x3e2398,null))[_0x0cf1('0x16')](function(_0x3aed46){if(_0x3aed46){_0xbb7145[_0x0cf1('0x59')]=_['keys'](db[_0x0cf1('0xea')][_0x0cf1('0x3e')]);_0xbb7145[_0x0cf1('0x4d')]=_['keys'](_0x2c22d3[_0x0cf1('0x4d')]);_0xbb7145['filters']=_[_0x0cf1('0x5d')](_0xbb7145[_0x0cf1('0x59')],_0xbb7145[_0x0cf1('0x4d')]);_0x49b0df[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0xbb7145[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0x2c22d3[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x49b0df[_0x0cf1('0x49')]=_0x49b0df[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x49b0df[_0x0cf1('0x49')]:_0xbb7145[_0x0cf1('0x59')];if(!_0x2c22d3[_0x0cf1('0x4d')][_0x0cf1('0xd3')]('nolimit')){_0x49b0df[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x2c22d3[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x49b0df[_0x0cf1('0x25')]=qs['offset'](_0x2c22d3['query'][_0x0cf1('0x25')]);}_0x49b0df[_0x0cf1('0xdc')]=qs['sort'](_0x2c22d3['query'][_0x0cf1('0xd0')]);_0x49b0df[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x2c22d3[_0x0cf1('0x4d')],_0xbb7145[_0x0cf1('0x5c')]));_0x49b0df[_0x0cf1('0x44')][_0x0cf1('0xe3')]=_0x3aed46['id'];if(_0x2c22d3['query']['filter']){_0x49b0df[_0x0cf1('0x44')]=_['merge'](_0x49b0df['where'],{'$or':_['map'](_0x49b0df[_0x0cf1('0x49')],function(_0xab7488){var _0x1969a8={};_0x1969a8[_0xab7488]={'$like':'%'+_0x2c22d3[_0x0cf1('0x4d')]['filter']+'%'};return _0x1969a8;})});}_0x49b0df=_[_0x0cf1('0x60')]({},_0x49b0df,_0x2c22d3[_0x0cf1('0x61')]);return db['MailInteraction'][_0x0cf1('0x24')]({'where':_0x49b0df[_0x0cf1('0x44')]})['then'](function(_0x4df797){_0x2b62b4[_0x0cf1('0x24')]=_0x4df797;if(_0x2c22d3[_0x0cf1('0x4d')][_0x0cf1('0x5f')]){_0x49b0df[_0x0cf1('0x47')]=[{'all':!![]}];}return db[_0x0cf1('0xea')][_0x0cf1('0x4b')](_0x49b0df);})['then'](function(_0x26e83c){_0x2b62b4[_0x0cf1('0x4c')]=_0x26e83c;return _0x2b62b4;});}})[_0x0cf1('0x16')](respondWithFilteredResult(_0x3e2398,_0x49b0df))[_0x0cf1('0x20')](handleError(_0x3e2398,null));};exports[_0x0cf1('0xeb')]=function(_0x22961,_0x3662e7){var _0x1327f1={};var _0x2dbb61={};var _0x4773fa;var _0x478148;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x22961[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x3662e7,null))[_0x0cf1('0x16')](function(_0x1e56bc){if(_0x1e56bc){_0x4773fa=_0x1e56bc;_0x2dbb61[_0x0cf1('0x59')]=_['keys'](db[_0x0cf1('0xec')]['rawAttributes']);_0x2dbb61[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x22961['query']);_0x2dbb61[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x2dbb61['model'],_0x2dbb61[_0x0cf1('0x4d')]);_0x1327f1[_0x0cf1('0x49')]=_['intersection'](_0x2dbb61['model'],qs[_0x0cf1('0x5e')](_0x22961[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x1327f1[_0x0cf1('0x49')]=_0x1327f1[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x1327f1[_0x0cf1('0x49')]:_0x2dbb61[_0x0cf1('0x59')];_0x1327f1[_0x0cf1('0xdc')]=qs['sort'](_0x22961[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x1327f1[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x22961['query'],_0x2dbb61['filters']));if(_0x22961[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x1327f1[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x1327f1[_0x0cf1('0x44')],{'$or':_['map'](_0x1327f1[_0x0cf1('0x49')],function(_0x5da6fe){var _0xfd79ff={};_0xfd79ff[_0x5da6fe]={'$like':'%'+_0x22961[_0x0cf1('0x4d')]['filter']+'%'};return _0xfd79ff;})});}_0x1327f1=_[_0x0cf1('0x60')]({},_0x1327f1,_0x22961[_0x0cf1('0x61')]);return _0x4773fa[_0x0cf1('0xeb')](_0x1327f1);}})[_0x0cf1('0x16')](function(_0x581aba){if(_0x581aba){_0x478148=_0x581aba[_0x0cf1('0x50')];if(!_0x22961['query'][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x1327f1[_0x0cf1('0xd9')]=qs['limit'](_0x22961[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x1327f1['offset']=qs[_0x0cf1('0x25')](_0x22961[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x4773fa[_0x0cf1('0xeb')](_0x1327f1);}})[_0x0cf1('0x16')](function(_0x17253e){if(_0x17253e){return _0x17253e?{'count':_0x478148,'rows':_0x17253e}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x3662e7,null))[_0x0cf1('0x20')](handleError(_0x3662e7,null));};exports[_0x0cf1('0xed')]=function(_0x34f1d6,_0x6970c0){var _0x16a908={};var _0x4ec661={};var _0xc3e9b2;var _0x1f891e;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x34f1d6[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x6970c0,null))[_0x0cf1('0x16')](function(_0x7f46b5){if(_0x7f46b5){_0xc3e9b2=_0x7f46b5;_0x4ec661[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xee')][_0x0cf1('0x3e')]);_0x4ec661[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0x34f1d6[_0x0cf1('0x4d')]);_0x4ec661[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x4ec661['model'],_0x4ec661[_0x0cf1('0x4d')]);_0x16a908['attributes']=_[_0x0cf1('0x5d')](_0x4ec661[_0x0cf1('0x59')],qs['fields'](_0x34f1d6[_0x0cf1('0x4d')]['fields']));_0x16a908[_0x0cf1('0x49')]=_0x16a908[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x16a908[_0x0cf1('0x49')]:_0x4ec661[_0x0cf1('0x59')];_0x16a908['order']=qs[_0x0cf1('0xd0')](_0x34f1d6[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x16a908[_0x0cf1('0x44')]=qs['filters'](_[_0x0cf1('0xd1')](_0x34f1d6[_0x0cf1('0x4d')],_0x4ec661[_0x0cf1('0x5c')]));if(_0x34f1d6['query'][_0x0cf1('0x32')]){_0x16a908[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x16a908[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x16a908[_0x0cf1('0x49')],function(_0x33fa45){var _0x66a437={};_0x66a437[_0x33fa45]={'$like':'%'+_0x34f1d6[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0x66a437;})});}_0x16a908=_[_0x0cf1('0x60')]({},_0x16a908,_0x34f1d6[_0x0cf1('0x61')]);return _0xc3e9b2[_0x0cf1('0xed')](_0x16a908);}})[_0x0cf1('0x16')](function(_0x13edf1){if(_0x13edf1){_0x1f891e=_0x13edf1['length'];if(!_0x34f1d6['query'][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x16a908[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x34f1d6[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x16a908[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x34f1d6['query'][_0x0cf1('0x25')]);}return _0xc3e9b2[_0x0cf1('0xed')](_0x16a908);}})['then'](function(_0x3f79ca){if(_0x3f79ca){return _0x3f79ca?{'count':_0x1f891e,'rows':_0x3f79ca}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x6970c0,null))[_0x0cf1('0x20')](handleError(_0x6970c0,null));};exports[_0x0cf1('0xef')]=function(_0x10b3be,_0x2d20ac){var _0x1695fe={};var _0x33f005={};var _0x11014d;var _0x1630d4;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x10b3be[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x2d20ac,null))[_0x0cf1('0x16')](function(_0x31e41c){if(_0x31e41c){_0x11014d=_0x31e41c;_0x33f005[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db[_0x0cf1('0xf0')]['rawAttributes']);_0x33f005['query']=_[_0x0cf1('0x5b')](_0x10b3be[_0x0cf1('0x4d')]);_0x33f005[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x33f005[_0x0cf1('0x59')],_0x33f005[_0x0cf1('0x4d')]);_0x1695fe[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x33f005['model'],qs[_0x0cf1('0x5e')](_0x10b3be[_0x0cf1('0x4d')]['fields']));_0x1695fe[_0x0cf1('0x49')]=_0x1695fe['attributes'][_0x0cf1('0x50')]?_0x1695fe[_0x0cf1('0x49')]:_0x33f005[_0x0cf1('0x59')];_0x1695fe[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0x10b3be[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x1695fe[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_['pick'](_0x10b3be['query'],_0x33f005['filters']));if(_0x10b3be[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x1695fe['where']=_[_0x0cf1('0x60')](_0x1695fe[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x1695fe[_0x0cf1('0x49')],function(_0x1dd7fc){var _0x4223d0={};_0x4223d0[_0x1dd7fc]={'$like':'%'+_0x10b3be['query']['filter']+'%'};return _0x4223d0;})});}_0x1695fe=_[_0x0cf1('0x60')]({},_0x1695fe,_0x10b3be['options']);return _0x11014d[_0x0cf1('0xef')](_0x1695fe);}})['then'](function(_0x5340b4){if(_0x5340b4){_0x1630d4=_0x5340b4[_0x0cf1('0x50')];if(!_0x10b3be[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x1695fe[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x10b3be[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x1695fe[_0x0cf1('0x25')]=qs[_0x0cf1('0x25')](_0x10b3be['query'][_0x0cf1('0x25')]);}return _0x11014d[_0x0cf1('0xef')](_0x1695fe);}})[_0x0cf1('0x16')](function(_0x23aafd){if(_0x23aafd){return _0x23aafd?{'count':_0x1630d4,'rows':_0x23aafd}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x2d20ac,null))[_0x0cf1('0x20')](handleError(_0x2d20ac,null));};exports['login']=function(_0x4502ae,_0x3f31ea,_0x3196d8){var _0x32be87;var _0xdfaf9e;var _0x53d2aa;var _0x4cc5ed=!_['isNil'](_0x4502ae[_0x0cf1('0x58')]['id'])?_0x4502ae[_0x0cf1('0x58')]['id']:!_[_0x0cf1('0x70')](_0x4502ae[_0x0cf1('0x2e')]['id'])?_0x4502ae[_0x0cf1('0x2e')]['id']:null;return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x4cc5ed,'role':{'$or':[_0x0cf1('0x2c'),_0x0cf1('0x2e'),_0x0cf1('0x2f')]}},'attributes':['id',_0x0cf1('0x39'),_0x0cf1('0xf1'),_0x0cf1('0xf2'),'role',_0x0cf1('0x66'),'loginInPause']})[_0x0cf1('0x16')](function(_0x4a5c05){if(_0x4a5c05){if(_0x4a5c05[_0x0cf1('0x37')]===_0x0cf1('0x2f')){_0x32be87=_0x4a5c05;if(_0x4502ae[_0x0cf1('0x62')][_0x0cf1('0xa3')]){_0x53d2aa=util[_0x0cf1('0xaf')](_0x0cf1('0xf3'),_0x32be87[_0x4502ae[_0x0cf1('0x62')][_0x0cf1('0xa3')]]);}else if(_0x4502ae[_0x0cf1('0x62')][_0x0cf1('0xf4')]){_0x53d2aa=util['format'](_0x0cf1('0xb0'),_0x4502ae[_0x0cf1('0x62')][_0x0cf1('0xf4')]);}else{_0x53d2aa=util['format'](_0x0cf1('0xb0'),_0x32be87[_0x0cf1('0x39')]);}socket['to'](util[_0x0cf1('0xaf')](_0x0cf1('0xf5'),_0x32be87['name']))['emit'](_0x0cf1('0xf6'),{'user':{'id':_0x32be87['id'],'name':_0x32be87[_0x0cf1('0x39')]},'ip':_0x4502ae['headers']['x-forwarded-for']||_0x4502ae[_0x0cf1('0xf7')][_0x0cf1('0xf8')]||_0x4502ae[_0x0cf1('0xf9')][_0x0cf1('0xf8')]||_0x4502ae['connection'][_0x0cf1('0xf9')][_0x0cf1('0xf8')]});return db[_0x0cf1('0xb2')]['destroy']({'where':{'membername':_0x32be87[_0x0cf1('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x0cf1('0x94'))]['ValidationError'](_0x0cf1('0xfa'));}})['then'](function(){if(_0x32be87){return _0x32be87[_0x0cf1('0xfb')]({'raw':!![]});}})[_0x0cf1('0x16')](function(_0xd573ef){if(_0x32be87){var _0xf52e3=[];if(_0xd573ef){_0xdfaf9e=_0xd573ef;if(_0xdfaf9e[_0x0cf1('0x50')]){for(var _0x101b4f=0x0;_0x101b4f<_0xdfaf9e[_0x0cf1('0x50')];_0x101b4f++){_0xf52e3[_0x0cf1('0x4a')]({'membername':_0x32be87['name'],'UserId':_0x32be87['id'],'queue_name':_0xdfaf9e[_0x101b4f][_0x0cf1('0x39')],'VoiceQueueId':_0xdfaf9e[_0x101b4f]['id'],'interface':_0x53d2aa,'paused':_0x32be87['loginInPause']||![],'penalty':_0xdfaf9e[_0x101b4f]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x0cf1('0x8f')](_0xf52e3,function(_0x12cede){return db[_0x0cf1('0xb2')][_0x0cf1('0xfc')](_0x12cede);});}}}})[_0x0cf1('0x16')](function(){if(_0x32be87){return db[_0x0cf1('0xfd')]['findAll']({'where':{'membername':_0x32be87[_0x0cf1('0x39')],'exitAt':null}});}})[_0x0cf1('0x16')](function(_0x9a7563){if(_0x32be87){var _0x3dd69c=[];_0x9a7563[_0x0cf1('0xfe')](function(_0x37211e){_0x3dd69c[_0x0cf1('0x4a')](_0x37211e[_0x0cf1('0x28')]({'exitAt':moment()['format'](_0x0cf1('0xff'))}));});return BPromise[_0x0cf1('0x57')](_0x3dd69c);}})['then'](function(){if(_0x32be87){var _0x3c0ce1=[];var _0x9088b5=[];var _0x30d875=utils[_0x0cf1('0x100')]();var _0x5c62d4={'membername':_0x32be87[_0x0cf1('0x39')],'interface':_0x53d2aa,'enterAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff')),'role':_0x32be87[_0x0cf1('0x37')],'internal':_0x32be87['internal']};_0x30d875[_0x0cf1('0xfe')](function(_0x5899c0){_0x3c0ce1[_0x0cf1('0x4a')](_[_0x0cf1('0x60')]({'channel':_0x5899c0,'type':_0x0cf1('0x101'),'data1':_0x4502ae[_0x0cf1('0x62')]['device'],'data2':_0x53d2aa},_0x5c62d4));if(_0x32be87[_0x0cf1('0xa2')]){_0x9088b5['push'](_[_0x0cf1('0x60')]({'channel':_0x5899c0,'type':_0x0cf1('0x102'),'data1':_0x0cf1('0x103')},_0x5c62d4));}});return db[_0x0cf1('0xfd')][_0x0cf1('0x8c')](_0x3c0ce1[_0x0cf1('0xce')](_0x9088b5),{'individualHooks':!![]});}})[_0x0cf1('0x16')](function(){if(_0x32be87){return _0x32be87[_0x0cf1('0x28')]({'online':!![],'lastLoginAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff')),'voicePause':_0x32be87[_0x0cf1('0xa2')]||![],'mailPause':_0x32be87[_0x0cf1('0xa2')]||![],'chatPause':_0x32be87[_0x0cf1('0xa2')]||![],'faxPause':_0x32be87['loginInPause']||![],'smsPause':_0x32be87[_0x0cf1('0xa2')]||![],'openchannelPause':_0x32be87[_0x0cf1('0xa2')]||![],'whatsappPause':_0x32be87[_0x0cf1('0xa2')]||![],'pauseType':_0x32be87['loginInPause']?_0x0cf1('0x103'):null,'interface':_0x53d2aa,'lastPauseAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff'))});}})[_0x0cf1('0x16')](function(_0x1370bc){if(_0x4502ae['isMiddleware']){return _0x3196d8();}else{return BPromise['resolve'](_0x1370bc)['then'](respondWithResult(_0x3f31ea,null));}})['catch'](handleError(_0x3f31ea,null));};exports['logout']=function(_0x1529ba,_0x6cf401){var _0x425cf9;return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x1529ba[_0x0cf1('0x58')]['id'],'role':'agent'},'attributes':['id',_0x0cf1('0x39'),_0x0cf1('0x37')]})[_0x0cf1('0x16')](handleEntityNotFound(_0x6cf401,null))[_0x0cf1('0x16')](function(_0x2434ca){if(_0x2434ca){_0x425cf9=_0x2434ca;return db[_0x0cf1('0xb2')][_0x0cf1('0x2b')]({'where':{'membername':_0x425cf9['name']},'individualHooks':!![]});}})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0xfd')]['findAll']({'where':{'membername':_0x425cf9[_0x0cf1('0x39')],'exitAt':null}});})[_0x0cf1('0x16')](function(_0x44028e){var _0x14c6dd=[];_0x44028e[_0x0cf1('0xfe')](function(_0x3b510a){_0x14c6dd[_0x0cf1('0x4a')](_0x3b510a['update']({'exitAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff'))}));});return BPromise[_0x0cf1('0x57')](_0x14c6dd);})[_0x0cf1('0x16')](function(){return _0x425cf9[_0x0cf1('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x6cf401,null))[_0x0cf1('0x20')](handleError(_0x6cf401,null));};exports[_0x0cf1('0x104')]=function(_0x5f3998,_0x29ba1b){var _0x45c2ee;return db[_0x0cf1('0xb2')][_0x0cf1('0x28')]({'paused':0x1},{'where':{'UserId':_0x5f3998[_0x0cf1('0x58')]['id']},'individualHooks':!![]})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0x45')][_0x0cf1('0x38')]({'where':{'id':_0x5f3998[_0x0cf1('0x58')]['id'],'role':'agent'},'attributes':['id',_0x0cf1('0x39'),_0x0cf1('0x37'),_0x0cf1('0x66'),'interface']});})[_0x0cf1('0x16')](handleEntityNotFound(_0x29ba1b,null))[_0x0cf1('0x16')](function(_0x36daaa){if(_0x36daaa){_0x45c2ee=_0x36daaa;return respondWithRpcPromise(_0x0cf1('0x105'),_0x0cf1('0x104'),{'id':_0x45c2ee['id'],'name':_0x45c2ee['name'],'pause':!![]});}})[_0x0cf1('0x16')](function(){if(_0x45c2ee){return db['MemberReport'][_0x0cf1('0x4b')]({'where':{'membername':_0x45c2ee[_0x0cf1('0x39')],'type':_0x0cf1('0x102'),'exitAt':null}});}})[_0x0cf1('0x16')](function(_0x2af021){if(_0x2af021['length']){var _0x1e1e57=moment()[_0x0cf1('0xaf')](_0x0cf1('0xff'));for(var _0x4e4f67=0x0,_0x59c3ad=_0x2af021[_0x0cf1('0x50')];_0x4e4f67<_0x59c3ad;_0x4e4f67++){_0x2af021[_0x4e4f67][_0x0cf1('0x106')]({'exitAt':_0x1e1e57});}}})[_0x0cf1('0x16')](function(){var _0x2b3db4=[];var _0xfb249c=utils[_0x0cf1('0x100')]();_0xfb249c[_0x0cf1('0xfe')](function(_0x93a1e7){_0x2b3db4[_0x0cf1('0x4a')]({'channel':_0x93a1e7,'membername':_0x45c2ee['name'],'interface':_[_0x0cf1('0x70')](_0x45c2ee[_0x0cf1('0xa3')])?util['format'](_0x0cf1('0xb0'),_0x45c2ee[_0x0cf1('0x39')]):_0x45c2ee[_0x0cf1('0xa3')],'type':_0x0cf1('0x102'),'enterAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff')),'data1':_0x5f3998[_0x0cf1('0x62')]['type']||_0x0cf1('0x107'),'role':_0x45c2ee[_0x0cf1('0x37')],'internal':_0x45c2ee[_0x0cf1('0x66')]});});return db[_0x0cf1('0xfd')]['bulkCreate'](_0x2b3db4,{'individualHooks':!![]});})[_0x0cf1('0x16')](function(){return _0x45c2ee[_0x0cf1('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5f3998[_0x0cf1('0x62')][_0x0cf1('0x40')]||_0x0cf1('0x107'),'lastPauseAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff'))});})[_0x0cf1('0x16')](respondWithResult(_0x29ba1b,null))[_0x0cf1('0x20')](handleError(_0x29ba1b,null));};exports[_0x0cf1('0x108')]=function(_0x9307d2,_0x3e76cc){var _0xec4627;return db['User'][_0x0cf1('0x38')]({'where':{'id':_0x9307d2[_0x0cf1('0x58')]['id']},'attributes':['id',_0x0cf1('0x39'),_0x0cf1('0x37'),'voicePause',_0x0cf1('0x109'),_0x0cf1('0x10a'),_0x0cf1('0x10b'),'openchannelPause',_0x0cf1('0x10c'),'whatsapppause',_0x0cf1('0x10d'),_0x0cf1('0x10e')]})[_0x0cf1('0x16')](handleEntityNotFound(_0x3e76cc,null))[_0x0cf1('0x16')](function(_0x25eb4c){if(_0x25eb4c){_0xec4627=_0x25eb4c;if(_0x9307d2[_0x0cf1('0x62')]['channel']&&!utils['isValidChannel'](_0x9307d2['body'][_0x0cf1('0xa0')])){throw new db[(_0x0cf1('0x94'))]['ValidationError'](_0x0cf1('0xda'));}switch(_0x9307d2['body'][_0x0cf1('0xa0')]){case _0x0cf1('0xb7'):return respondWithRpcPromise('QueuePause',_0x0cf1('0x108'),{'id':_0xec4627['id'],'name':_0xec4627[_0x0cf1('0x39')],'pause':![]})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0xec4627['id']},'individualHooks':!![]});})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0xfd')]['find']({'where':{'channel':_0x9307d2['body']['channel'],'membername':_0xec4627[_0x0cf1('0x39')],'type':_0x0cf1('0x102'),'exitAt':null}});})['then'](function(_0x433a07){if(_0x433a07){return _0x433a07['update']({'exitAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff')),'data2':_0x0cf1('0x10f')},{'individualHooks':!![]});}return null;})['then'](function(){return _0xec4627[_0x0cf1('0x28')]({'voicePause':![]});});case _0x0cf1('0x54'):case _0x0cf1('0x51'):case _0x0cf1('0xc2'):case _0x0cf1('0x53'):case _0x0cf1('0x56'):case _0x0cf1('0x55'):return db[_0x0cf1('0xfd')]['find']({'where':{'channel':_0x9307d2[_0x0cf1('0x62')]['channel'],'membername':_0xec4627[_0x0cf1('0x39')],'type':'PAUSE','exitAt':null}})[_0x0cf1('0x16')](function(_0x1416e1){if(_0x1416e1){return _0x1416e1[_0x0cf1('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x0cf1('0x16')](function(){var _0x3a391a={};_[_0x0cf1('0x26')](_0x3a391a,util['format'](_0x0cf1('0x110'),_0x9307d2[_0x0cf1('0x62')][_0x0cf1('0xa0')],'Pause'),![]);return _0xec4627['update'](_0x3a391a);});default:return respondWithRpcPromise(_0x0cf1('0x105'),_0x0cf1('0x108'),{'id':_0xec4627['id'],'name':_0xec4627[_0x0cf1('0x39')],'pause':![]})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0xec4627['id']}});})[_0x0cf1('0x16')](function(){return db['MemberReport'][_0x0cf1('0x4b')]({'where':{'membername':_0xec4627[_0x0cf1('0x39')],'type':'PAUSE','exitAt':null}});})[_0x0cf1('0x16')](function(_0x162e1a){var _0x1bc004=[];_0x162e1a[_0x0cf1('0xfe')](function(_0x301d8f){_0x1bc004['push'](_0x301d8f[_0x0cf1('0x28')]({'exitAt':moment()[_0x0cf1('0xaf')](_0x0cf1('0xff')),'data2':'manual'}));});return BPromise['all'](_0x1bc004);})[_0x0cf1('0x16')](function(){return _0xec4627[_0x0cf1('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x3e76cc,null))['catch'](handleError(_0x3e76cc,null));};exports[_0x0cf1('0x111')]=function(_0x2bf9af,_0x3cf9a1){var _0xc39d97={};var _0x3182a9={};var _0x10f6ef;var _0x22c809;return db['User'][_0x0cf1('0x99')]({'where':{'id':_0x2bf9af['params']['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x3cf9a1,null))['then'](function(_0xb00597){if(_0xb00597){_0x10f6ef=_0xb00597;_0x3182a9[_0x0cf1('0x59')]=_[_0x0cf1('0x5b')](db['Team']['rawAttributes']);_0x3182a9['query']=_[_0x0cf1('0x5b')](_0x2bf9af[_0x0cf1('0x4d')]);_0x3182a9[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x3182a9[_0x0cf1('0x59')],_0x3182a9[_0x0cf1('0x4d')]);_0xc39d97[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x3182a9[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0x2bf9af[_0x0cf1('0x4d')]['fields']));_0xc39d97['attributes']=_0xc39d97[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0xc39d97['attributes']:_0x3182a9['model'];_0xc39d97[_0x0cf1('0xdc')]=qs['sort'](_0x2bf9af['query'][_0x0cf1('0xd0')]);_0xc39d97['where']=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x2bf9af[_0x0cf1('0x4d')],_0x3182a9['filters']));if(_0x2bf9af[_0x0cf1('0x4d')]['filter']){_0xc39d97[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0xc39d97[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0xc39d97[_0x0cf1('0x49')],function(_0x42e3f9){var _0x4e98f0={};_0x4e98f0[_0x42e3f9]={'$like':'%'+_0x2bf9af['query']['filter']+'%'};return _0x4e98f0;})});}_0xc39d97=_[_0x0cf1('0x60')]({},_0xc39d97,_0x2bf9af[_0x0cf1('0x61')]);return _0x10f6ef['getTeams'](_0xc39d97);}})[_0x0cf1('0x16')](function(_0x34cca0){if(_0x34cca0){_0x22c809=_0x34cca0[_0x0cf1('0x50')];if(!_0x2bf9af[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0xc39d97[_0x0cf1('0xd9')]=qs[_0x0cf1('0xd9')](_0x2bf9af[_0x0cf1('0x4d')]['limit']);_0xc39d97['offset']=qs['offset'](_0x2bf9af[_0x0cf1('0x4d')][_0x0cf1('0x25')]);}return _0x10f6ef[_0x0cf1('0x111')](_0xc39d97);}})[_0x0cf1('0x16')](function(_0x41b42d){if(_0x41b42d){return _0x41b42d?{'count':_0x22c809,'rows':_0x41b42d}:null;}})[_0x0cf1('0x16')](respondWithResult(_0x3cf9a1,null))[_0x0cf1('0x20')](handleError(_0x3cf9a1,null));};exports[_0x0cf1('0x112')]=function(_0x300f1c,_0x2fe5e6){var _0x2899b4=_0x300f1c['params']['id'];var _0x218984=_0x300f1c['body']?_0x300f1c[_0x0cf1('0x62')][_0x0cf1('0x65')]:null;var _0x56da50=[];return Promise['resolve']()[_0x0cf1('0x16')](function(){if(!_0x218984)throw new APIBadRequestError(_0x0cf1('0x113'));})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x2899b4}});})['then'](function(_0x547cad){if(!_0x547cad)throw new APINotFoundError(util['format'](_0x0cf1('0x114'),_0x300f1c['params']['id']));return db[_0x0cf1('0x6d')][_0x0cf1('0x115')](function(_0x2635f9){return _0x547cad[_0x0cf1('0x112')](_0x218984,{'transaction':_0x2635f9})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0x116')][_0x0cf1('0x4b')]({'where':{'id':{'$in':_0x218984}}});})[_0x0cf1('0x16')](function(_0x1dba46){var _0x3204bf=_['map'](_0x1dba46,function(_0xbf71ac){return _0xbf71ac[_0x0cf1('0x117')]();});return Promise[_0x0cf1('0x57')](_0x3204bf);})[_0x0cf1('0x16')](function(_0x372b6a){_0x56da50=_[_0x0cf1('0x118')](_0x372b6a);var _0x2867df=_['map'](_0x56da50,function(_0x516389){return _0x516389[_0x0cf1('0x119')](_0x547cad['id'],{'transaction':_0x2635f9});});return Promise[_0x0cf1('0x57')](_0x2867df);})[_0x0cf1('0x16')](function(){if(!_0x547cad[_0x0cf1('0xa1')])return;var _0x41799b=_[_0x0cf1('0x32')](_0x56da50,function(_0x2b5feb){return _0x2b5feb[_0x0cf1('0x11a')](_0x0cf1('0xa0'))===_0x0cf1('0x11b');});var _0x4c32f5=_['map'](_0x41799b,function(_0x1d3617){return db['UserVoiceQueueRt']['upsert']({'membername':_0x547cad['name'],'UserId':_0x547cad['id'],'queue_name':_0x1d3617['name'],'VoiceQueueId':_0x1d3617['id'],'interface':_[_0x0cf1('0x70')](_0x547cad[_0x0cf1('0xa3')])?util[_0x0cf1('0xaf')](_0x0cf1('0xb0'),_0x547cad[_0x0cf1('0x39')]):_0x547cad[_0x0cf1('0xa3')],'paused':_0x547cad[_0x0cf1('0xb1')]||![],'penalty':_0x547cad[_0x0cf1('0xa9')]},{'transaction':_0x2635f9});});return Promise[_0x0cf1('0x57')](_0x4c32f5);})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0x11c')][_0x0cf1('0x4b')]({'where':{'teamId':{'$in':_0x218984}}});})[_0x0cf1('0x16')](function(_0x4eaadc){var _0x581074=_['map'](_0x4eaadc,function(_0x4eb267){return db[_0x0cf1('0x11d')][_0x0cf1('0x81')]({'UserId':_0x547cad['id'],'VoicePrefixId':_0x4eb267[_0x0cf1('0x11e')]},{'transaction':_0x2635f9});});return Promise[_0x0cf1('0x57')](_0x581074);});});})['then'](function(){for(var _0x358090=0x0;_0x358090<_0x56da50[_0x0cf1('0x50')];_0x358090++){var _0x1e02fe=_0x56da50[_0x358090]['getDataValue'](_0x0cf1('0xa0'));var _0x2a8285=_0x1e02fe+_0x0cf1('0xab');socket[_0x0cf1('0x29')](_0x0cf1('0x2e')+_0x1e02fe+_0x0cf1('0xac'),{'UserId':_0x2899b4,['queueField']:_0x56da50[_0x358090]['id']});}})[_0x0cf1('0x16')](respondWithStatusCode(_0x2fe5e6,null))['catch'](APIHandleError(_0x2fe5e6));};exports[_0x0cf1('0x11f')]=function(_0x5c3bb3,_0x1ed9d5){var _0x3e3658=_0x5c3bb3['params']['id'];var _0x514df1=null;if(_0x5c3bb3[_0x0cf1('0x4d')][_0x0cf1('0x65')]){_0x514df1=_['isArray'](_0x5c3bb3[_0x0cf1('0x4d')][_0x0cf1('0x65')])?_0x5c3bb3[_0x0cf1('0x4d')]['ids']:[_0x5c3bb3['query'][_0x0cf1('0x65')]];}var _0x11409b=[];return Promise[_0x0cf1('0x120')]()[_0x0cf1('0x16')](function(){if(!_0x514df1)throw new APIBadRequestError(_0x0cf1('0x121'));})[_0x0cf1('0x16')](function(){return db['User'][_0x0cf1('0x99')]({'where':{'id':_0x3e3658}});})[_0x0cf1('0x16')](function(_0x161a24){if(!_0x161a24)throw new APINotFoundError(util[_0x0cf1('0xaf')](_0x0cf1('0x114'),_0x5c3bb3[_0x0cf1('0x58')]['id']));return db['sequelize'][_0x0cf1('0x115')](function(_0x326e0c){return _0x161a24[_0x0cf1('0x11f')](_0x514df1,{'transaction':_0x326e0c})['then'](function(){return db[_0x0cf1('0x116')][_0x0cf1('0x4b')]({'where':{'id':{'$in':_0x514df1}}});})[_0x0cf1('0x16')](function(_0x5a1620){var _0x523ea1=_[_0x0cf1('0x34')](_0x5a1620,function(_0x370d27){return _0x370d27[_0x0cf1('0x117')]();});return Promise[_0x0cf1('0x57')](_0x523ea1);})[_0x0cf1('0x16')](function(_0x3af81b){_0x11409b=_[_0x0cf1('0x118')](_0x3af81b);var _0x1de36f=_[_0x0cf1('0x34')](_0x11409b,function(_0x319f12){return _0x319f12[_0x0cf1('0x122')](_0x161a24['id'],{'transaction':_0x326e0c});});return Promise[_0x0cf1('0x57')](_0x1de36f);})[_0x0cf1('0x16')](function(){if(!_0x161a24[_0x0cf1('0xa1')])return;var _0x54c464=_[_0x0cf1('0x32')](_0x11409b,function(_0x3de10c){return _0x3de10c[_0x0cf1('0x11a')](_0x0cf1('0xa0'))===_0x0cf1('0x11b');});var _0x22d606=_['map'](_0x54c464,function(_0x4dd24c){return db[_0x0cf1('0xb2')][_0x0cf1('0x2b')]({'where':{'VoiceQueueId':_0x4dd24c['id'],'UserId':_0x161a24['id']},'transaction':_0x326e0c});});return Promise[_0x0cf1('0x57')](_0x22d606);})[_0x0cf1('0x16')](function(){return db[_0x0cf1('0x11c')]['findAll']({'where':{'teamId':{'$in':_0x514df1}}});})[_0x0cf1('0x16')](function(_0x4028eb){var _0xb10161=_[_0x0cf1('0x34')](_0x4028eb,function(_0x5a8690){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x161a24['id'],'VoicePrefixId':_0x5a8690['VoicePrefixId']}},{'transaction':_0x326e0c});});return Promise['all'](_0xb10161);});});})['then'](function(){for(var _0x53b270=0x0;_0x53b270<_0x11409b[_0x0cf1('0x50')];_0x53b270++){var _0x306aa5=_0x11409b[_0x53b270]['getDataValue'](_0x0cf1('0xa0'));var _0x51d2ee=_0x306aa5+_0x0cf1('0xab');socket[_0x0cf1('0x29')]('user'+_0x306aa5+_0x0cf1('0xb6'),{'UserId':_0x3e3658,['queueField']:_0x11409b[_0x53b270]['id']});}})['then'](respondWithStatusCode(_0x1ed9d5,null))[_0x0cf1('0x20')](APIHandleError(_0x1ed9d5));};exports[_0x0cf1('0x123')]=function(_0xd8f9a3,_0x4fc744){var _0x3a6f8c={};var _0x3ef4d7={};var _0x4e59ab;var _0x2176b6;return db['User'][_0x0cf1('0x99')]({'where':{'id':_0xd8f9a3[_0x0cf1('0x58')]['id']}})['then'](handleEntityNotFound(_0x4fc744,null))[_0x0cf1('0x16')](function(_0x187039){if(_0x187039){_0x4e59ab=_0x187039;_0x3ef4d7['model']=_[_0x0cf1('0x5b')](db['CmList']['rawAttributes']);_0x3ef4d7[_0x0cf1('0x4d')]=_[_0x0cf1('0x5b')](_0xd8f9a3[_0x0cf1('0x4d')]);_0x3ef4d7['filters']=_['intersection'](_0x3ef4d7[_0x0cf1('0x59')],_0x3ef4d7[_0x0cf1('0x4d')]);_0x3a6f8c[_0x0cf1('0x49')]=_[_0x0cf1('0x5d')](_0x3ef4d7[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0xd8f9a3[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x3a6f8c[_0x0cf1('0x49')]=_0x3a6f8c[_0x0cf1('0x49')]['length']?_0x3a6f8c[_0x0cf1('0x49')]:_0x3ef4d7[_0x0cf1('0x59')];_0x3a6f8c[_0x0cf1('0xdc')]=qs[_0x0cf1('0xd0')](_0xd8f9a3[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x3a6f8c[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0xd8f9a3['query'],_0x3ef4d7['filters']));if(_0xd8f9a3['query']['filter']){_0x3a6f8c[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x3a6f8c[_0x0cf1('0x44')],{'$or':_[_0x0cf1('0x34')](_0x3a6f8c['attributes'],function(_0x4b5dc1){var _0x2c436a={};_0x2c436a[_0x4b5dc1]={'$like':'%'+_0xd8f9a3[_0x0cf1('0x4d')]['filter']+'%'};return _0x2c436a;})});}_0x3a6f8c=_[_0x0cf1('0x60')]({},_0x3a6f8c,_0xd8f9a3[_0x0cf1('0x61')]);return _0x4e59ab[_0x0cf1('0x123')](_0x3a6f8c);}})[_0x0cf1('0x16')](function(_0x1c7bb6){if(_0x1c7bb6){_0x2176b6=_0x1c7bb6[_0x0cf1('0x50')];if(!_0xd8f9a3[_0x0cf1('0x4d')][_0x0cf1('0xd3')](_0x0cf1('0xde'))){_0x3a6f8c['limit']=qs[_0x0cf1('0xd9')](_0xd8f9a3[_0x0cf1('0x4d')][_0x0cf1('0xd9')]);_0x3a6f8c[_0x0cf1('0x25')]=qs['offset'](_0xd8f9a3['query']['offset']);}return _0x4e59ab[_0x0cf1('0x123')](_0x3a6f8c);}})[_0x0cf1('0x16')](function(_0xbe3d7b){if(_0xbe3d7b){return _0xbe3d7b?{'count':_0x2176b6,'rows':_0xbe3d7b}:null;}})['then'](respondWithResult(_0x4fc744,null))['catch'](handleError(_0x4fc744,null));};exports[_0x0cf1('0x124')]=function(_0x170545,_0x191f41){var _0x22746f={};var _0x59a001={};var _0x568739;return db[_0x0cf1('0x45')][_0x0cf1('0x99')]({'where':{'id':_0x170545[_0x0cf1('0x58')]['id']}})[_0x0cf1('0x16')](handleEntityNotFound(_0x191f41,null))[_0x0cf1('0x16')](function(_0x2864b3){if(_0x2864b3){_0x568739=_0x2864b3;_0x59a001['model']=_[_0x0cf1('0x5b')](db['User'][_0x0cf1('0x3e')]);_0x59a001[_0x0cf1('0x4d')]=_['keys'](_0x170545['query']);_0x59a001[_0x0cf1('0x5c')]=_[_0x0cf1('0x5d')](_0x59a001['model'],_0x59a001[_0x0cf1('0x4d')]);_0x22746f['attributes']=_[_0x0cf1('0x5d')](_0x59a001[_0x0cf1('0x59')],qs[_0x0cf1('0x5e')](_0x170545[_0x0cf1('0x4d')][_0x0cf1('0x5e')]));_0x22746f[_0x0cf1('0x49')]=_0x22746f[_0x0cf1('0x49')][_0x0cf1('0x50')]?_0x22746f[_0x0cf1('0x49')]:_0x59a001['model'];_0x22746f[_0x0cf1('0xdc')]=qs['sort'](_0x170545[_0x0cf1('0x4d')][_0x0cf1('0xd0')]);_0x22746f[_0x0cf1('0x44')]=qs[_0x0cf1('0x5c')](_[_0x0cf1('0xd1')](_0x170545[_0x0cf1('0x4d')],_0x59a001[_0x0cf1('0x5c')]));if(_0x170545[_0x0cf1('0x4d')][_0x0cf1('0x32')]){_0x22746f[_0x0cf1('0x44')]=_[_0x0cf1('0x60')](_0x22746f['where'],{'$or':_[_0x0cf1('0x34')](_0x22746f[_0x0cf1('0x49')],function(_0x1bf105){var _0x5a6719={};_0x5a6719[_0x1bf105]={'$like':'%'+_0x170545[_0x0cf1('0x4d')][_0x0cf1('0x32')]+'%'};return _0x5a6719;})});}_0x22746f['model']=db[_0x0cf1('0x45')];_0x22746f['as']='Agents';_0x22746f=_['merge']({},_0x22746f,_0x170545[_0x0cf1('0x61')]);return _0x568739['getVoiceQueues']({'include':[_0x22746f]});}})[_0x0cf1('0x16')](function(_0x2c5ae6){if(_0x2c5ae6){var _0x4bfa03={},_0x4cbd9a=[];for(var _0x1b8924=0x0;_0x1b8924<_0x2c5ae6[_0x0cf1('0x50')];_0x1b8924+=0x1){for(var _0x317f36=0x0,_0x34d894;_0x317f36<_0x2c5ae6[_0x1b8924][_0x0cf1('0x89')][_0x0cf1('0x50')];_0x317f36+=0x1){_0x34d894=_0x2c5ae6[_0x1b8924][_0x0cf1('0x89')][_0x317f36][_0x0cf1('0xae')]({'plain':!![]});_0x4bfa03[_0x34d894['id']]=_0x34d894;}}_0x4bfa03=_[_0x0cf1('0x125')](_0x4bfa03);for(var _0x5415e4=qs[_0x0cf1('0x25')](_0x170545[_0x0cf1('0x4d')]['offset']);_0x5415e4<_0x4bfa03['length']&&_0x4cbd9a['length']=_0x530be8[_0xb888('0x56')]){throw new Error(_0xb888('0x57'));}})[_0xb888('0x24')](function(){if(_0x23b149){return db[_0xb888('0x41')][_0xb888('0x4d')]({'where':{'membername':_0x23b149[_0xb888('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x23b149){return _0x23b149[_0xb888('0x58')]({'raw':!![]});}})[_0xb888('0x24')](function(_0x5d770c){if(_0x23b149){if(_0x5d770c){var _0x414351=[];_0x5c3ff9=_0x5d770c;if(_0x5c3ff9[_0xb888('0x2d')]){for(var _0x1a92e4=0x0;_0x1a92e4<_0x5c3ff9[_0xb888('0x2d')];_0x1a92e4++){_0x414351['push'](db[_0xb888('0x41')][_0xb888('0x59')]({'membername':_0x23b149['name'],'UserId':_0x23b149['id'],'queue_name':_0x5c3ff9[_0x1a92e4][_0xb888('0x28')],'VoiceQueueId':_0x5c3ff9[_0x1a92e4]['id'],'interface':_0xf0fc2e,'paused':_0x23b149[_0xb888('0x51')]||![],'penalty':_0x5c3ff9[_0x1a92e4][_0xb888('0x5a')]||0x0}));}return BPromise[_0xb888('0x4b')](_0x414351);}}}})[_0xb888('0x24')](function(){if(_0x23b149){return db[_0xb888('0x2c')][_0xb888('0x1b')]({'where':{'membername':_0x23b149[_0xb888('0x28')],'exitAt':null}});}})[_0xb888('0x24')](function(_0x14b87d){if(_0x23b149){if(_0x14b87d&&_0x14b87d[_0xb888('0x2d')]){var _0x5d3193=[];_0x14b87d[_0xb888('0x31')](function(_0x17a24d){_0x5d3193[_0xb888('0x32')](_0x17a24d[_0xb888('0x38')]({'exitAt':moment()[_0xb888('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xb888('0x4b')](_0x5d3193);}}})[_0xb888('0x24')](function(_0x738aa9){if(_0x23b149){var _0x32a4d2=[];var _0x3f09ab=[];var _0x5abded=utils[_0xb888('0x30')]();var _0x4d6428={'membername':_0x23b149[_0xb888('0x28')],'interface':_0xf0fc2e,'enterAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'role':_0x23b149[_0xb888('0x29')],'internal':_0x23b149[_0xb888('0x2a')]};_0x5abded[_0xb888('0x31')](function(_0x41b5e6){_0x32a4d2[_0xb888('0x32')](_[_0xb888('0x5b')]({'channel':_0x41b5e6,'type':'LOGIN','data1':_0xb888('0x5c'),'data2':_0xf0fc2e},_0x4d6428));if(_0x23b149[_0xb888('0x51')]){_0x3f09ab[_0xb888('0x32')](_[_0xb888('0x5b')]({'channel':_0x41b5e6,'type':'PAUSE','data1':'LOGININPAUSE'},_0x4d6428));}});return db[_0xb888('0x2c')][_0xb888('0x37')](_0x32a4d2[_0xb888('0x5d')](_0x3f09ab),{'individualHooks':!![]});}})['then'](function(){if(_0x23b149){return _0x23b149['update']({'online':!![],'lastLoginAt':moment()['format'](_0xb888('0x2e')),'voicePause':_0x23b149['loginInPause']||![],'mailPause':_0x23b149[_0xb888('0x51')]||![],'chatPause':_0x23b149['loginInPause']||![],'faxPause':_0x23b149['loginInPause']||![],'smsPause':_0x23b149[_0xb888('0x51')]||![],'openchannelPause':_0x23b149['loginInPause']||![],'pauseType':_0x23b149[_0xb888('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xb888('0x34')](_0xb888('0x2e')),'interface':_0xf0fc2e});}})['then'](function(_0xe7e8f6){_0x21dce4(_0xe7e8f6);})[_0xb888('0x19')](function(_0xa78126){_0x4dd2f7(_0xe5c5a9[_0xb888('0x14')](0x1f4,_0xa78126['message']));});});}; \ No newline at end of file +var _0x3f69=['forEach','push','isNil','interface','body','type','role','uniqueid','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','fax','sms','whatsapp','set','%s%s','Pause','all','destroy','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','LOGIN','callysquare','concat','loginInPause','LOGININPAUSE','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','localhost','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetUser','User','findAll','where','options','include','map','model','attributes','ShowUser','find','raw','PauseUser','name','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x50889e,_0xeb0acf){var _0x4d59db=function(_0x33ff5a){while(--_0x33ff5a){_0x50889e['push'](_0x50889e['shift']());}};_0x4d59db(++_0xeb0acf);}(_0x3f69,0x13e));var _0x93f6=function(_0x425f9e,_0x57049f){_0x425f9e=_0x425f9e-0x0;var _0x17028c=_0x3f69[_0x425f9e];return _0x17028c;};'use strict';var _=require('lodash');var util=require(_0x93f6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93f6('0x1'));var fs=require('fs');var Redis=require(_0x93f6('0x2'));var db=require(_0x93f6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x93f6('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f6('0x5'));var client=jayson[_0x93f6('0x6')]['http']({'port':0x232a});config[_0x93f6('0x7')]=_[_0x93f6('0x8')](config['redis'],{'host':_0x93f6('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93f6('0x7')]));require(_0x93f6('0xa'))[_0x93f6('0xb')](socket);function respondWithRpcPromise(_0x40b39b,_0x3a0233,_0x485b64){return new BPromise(function(_0xed5009,_0x47c478){return client['request'](_0x40b39b,_0x485b64)[_0x93f6('0xc')](function(_0x2bb9bc){logger[_0x93f6('0xd')](_0x93f6('0xe'),_0x3a0233,_0x93f6('0xf'));logger[_0x93f6('0x10')]('User,\x20%s,\x20%s,\x20%s',_0x3a0233,'request\x20sent',JSON[_0x93f6('0x11')](_0x2bb9bc));if(_0x2bb9bc[_0x93f6('0x12')]){if(_0x2bb9bc[_0x93f6('0x12')][_0x93f6('0x13')]===0x1f4){logger[_0x93f6('0x12')](_0x93f6('0xe'),_0x3a0233,_0x2bb9bc[_0x93f6('0x12')][_0x93f6('0x14')]);return _0x47c478(_0x2bb9bc['error']['message']);}logger[_0x93f6('0x12')]('User,\x20%s,\x20%s',_0x3a0233,_0x2bb9bc[_0x93f6('0x12')][_0x93f6('0x14')]);return _0xed5009(_0x2bb9bc[_0x93f6('0x12')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x3a0233,_0x93f6('0xf'));_0xed5009(_0x2bb9bc[_0x93f6('0x15')][_0x93f6('0x14')]);}})[_0x93f6('0x16')](function(_0x2b4b33){logger[_0x93f6('0x12')]('User,\x20%s,\x20%s',_0x3a0233,_0x2b4b33);_0x47c478(_0x2b4b33);});});}exports[_0x93f6('0x17')]=function(_0x2f0f56){var _0x2f6a19=this;return new Promise(function(_0x4e0852,_0x25d456){return db[_0x93f6('0x18')][_0x93f6('0x19')]({'raw':_0x2f0f56['options']?_0x2f0f56['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f0f56['options']?_0x2f0f56['options'][_0x93f6('0x1a')]||null:null,'attributes':_0x2f0f56[_0x93f6('0x1b')]?_0x2f0f56[_0x93f6('0x1b')]['attributes']||null:null,'limit':_0x2f0f56[_0x93f6('0x1b')]?_0x2f0f56['options']['limit']||null:null,'include':_0x2f0f56[_0x93f6('0x1b')]?_0x2f0f56[_0x93f6('0x1b')][_0x93f6('0x1c')]?_[_0x93f6('0x1d')](_0x2f0f56['options']['include'],function(_0x5eb42a){return{'model':db[_0x5eb42a[_0x93f6('0x1e')]],'as':_0x5eb42a['as'],'attributes':_0x5eb42a[_0x93f6('0x1f')],'include':_0x5eb42a[_0x93f6('0x1c')]?_['map'](_0x5eb42a[_0x93f6('0x1c')],function(_0x2fcb3c){return{'model':db[_0x2fcb3c[_0x93f6('0x1e')]],'as':_0x2fcb3c['as'],'attributes':_0x2fcb3c[_0x93f6('0x1f')],'include':_0x2fcb3c[_0x93f6('0x1c')]?_['map'](_0x2fcb3c[_0x93f6('0x1c')],function(_0x3f1345){return{'model':db[_0x3f1345[_0x93f6('0x1e')]],'as':_0x3f1345['as'],'attributes':_0x3f1345[_0x93f6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x93f6('0xc')](function(_0x34b0da){logger[_0x93f6('0xd')](_0x93f6('0x17'),_0x2f0f56);logger['debug'](_0x93f6('0x17'),_0x2f0f56,JSON[_0x93f6('0x11')](_0x34b0da));_0x4e0852(_0x34b0da);})[_0x93f6('0x16')](function(_0x4d8bde){logger[_0x93f6('0x12')](_0x93f6('0x17'),_0x4d8bde[_0x93f6('0x14')],_0x2f0f56);_0x25d456(_0x2f6a19[_0x93f6('0x12')](0x1f4,_0x4d8bde[_0x93f6('0x14')]));});});};exports[_0x93f6('0x20')]=function(_0x553db7){var _0x11d17a=this;return new Promise(function(_0x330dc1,_0x1e8835){return db[_0x93f6('0x18')][_0x93f6('0x21')]({'raw':_0x553db7[_0x93f6('0x1b')]?_0x553db7[_0x93f6('0x1b')][_0x93f6('0x22')]===undefined?!![]:![]:!![],'where':_0x553db7[_0x93f6('0x1b')]?_0x553db7[_0x93f6('0x1b')][_0x93f6('0x1a')]||null:null,'attributes':_0x553db7[_0x93f6('0x1b')]?_0x553db7['options'][_0x93f6('0x1f')]||null:null,'include':_0x553db7[_0x93f6('0x1b')]?_0x553db7[_0x93f6('0x1b')][_0x93f6('0x1c')]?_[_0x93f6('0x1d')](_0x553db7[_0x93f6('0x1b')]['include'],function(_0x379b53){return{'model':db[_0x379b53[_0x93f6('0x1e')]],'as':_0x379b53['as'],'attributes':_0x379b53['attributes'],'include':_0x379b53[_0x93f6('0x1c')]?_['map'](_0x379b53['include'],function(_0xc92e2c){return{'model':db[_0xc92e2c[_0x93f6('0x1e')]],'as':_0xc92e2c['as'],'attributes':_0xc92e2c[_0x93f6('0x1f')],'include':_0xc92e2c[_0x93f6('0x1c')]?_[_0x93f6('0x1d')](_0xc92e2c[_0x93f6('0x1c')],function(_0x40431a){return{'model':db[_0x40431a[_0x93f6('0x1e')]],'as':_0x40431a['as'],'attributes':_0x40431a[_0x93f6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x93f6('0xc')](function(_0x2a1ff9){logger[_0x93f6('0xd')](_0x93f6('0x20'),_0x553db7);logger[_0x93f6('0x10')](_0x93f6('0x20'),_0x553db7,JSON[_0x93f6('0x11')](_0x2a1ff9));_0x330dc1(_0x2a1ff9);})[_0x93f6('0x16')](function(_0x98d460){logger[_0x93f6('0x12')](_0x93f6('0x20'),_0x98d460[_0x93f6('0x14')],_0x553db7);_0x1e8835(_0x11d17a[_0x93f6('0x12')](0x1f4,_0x98d460['message']));});});};exports[_0x93f6('0x23')]=function(_0xe2e706){var _0x34ba39=this;return new Promise(function(_0x1ecbe0,_0xc5e44a){var _0x3e5f97;return db[_0x93f6('0x18')]['find']({'where':_0xe2e706['options']['where']||{},'attributes':['id',_0x93f6('0x24'),'role',_0x93f6('0x25'),'interface']})[_0x93f6('0xc')](function(_0x58f27d){if(_0x58f27d){_0x3e5f97=_0x58f27d;return db[_0x93f6('0x26')][_0x93f6('0x27')]({'paused':0x1},{'where':{'UserId':_0x3e5f97['id']},'individualHooks':!![]});}})['then'](function(){if(_0x3e5f97){return db[_0x93f6('0x28')][_0x93f6('0x19')]({'where':{'membername':_0x3e5f97[_0x93f6('0x24')],'type':_0x93f6('0x29'),'exitAt':null}});}})['then'](function(_0x803fca){if(_0x3e5f97){if(_0x803fca&&_0x803fca[_0x93f6('0x2a')]){var _0x26f44e=moment()[_0x93f6('0x2b')](_0x93f6('0x2c'));for(var _0x3bad10=0x0,_0x3fc727=_0x803fca[_0x93f6('0x2a')];_0x3bad10<_0x3fc727;_0x3bad10++){_0x803fca[_0x3bad10][_0x93f6('0x2d')]({'exitAt':_0x26f44e});}}}})[_0x93f6('0xc')](function(){if(_0x3e5f97){var _0x2de353=[];var _0xbd8ffe=utils['getChannels']();_0xbd8ffe[_0x93f6('0x2e')](function(_0x341525){_0x2de353[_0x93f6('0x2f')]({'channel':_0x341525,'membername':_0x3e5f97[_0x93f6('0x24')],'interface':_[_0x93f6('0x30')](_0x3e5f97['interface'])?util[_0x93f6('0x2b')]('SIP/%s',_0x3e5f97[_0x93f6('0x24')]):_0x3e5f97[_0x93f6('0x31')],'type':'PAUSE','enterAt':moment()[_0x93f6('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xe2e706[_0x93f6('0x32')][_0x93f6('0x33')]||'DEFAULT\x20PAUSE','role':_0x3e5f97[_0x93f6('0x34')],'internal':_0x3e5f97[_0x93f6('0x25')],'uniqueid':_0xe2e706[_0x93f6('0x32')][_0x93f6('0x35')]||null});});return db[_0x93f6('0x28')][_0x93f6('0x36')](_0x2de353,{'individualHooks':!![]});}})[_0x93f6('0xc')](function(){if(_0x3e5f97){return _0x3e5f97[_0x93f6('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xe2e706[_0x93f6('0x32')][_0x93f6('0x33')]||_0x93f6('0x37'),'lastPauseAt':moment()['format'](_0x93f6('0x2c'))});}})[_0x93f6('0xc')](function(_0xdd88c7){_0x1ecbe0(_0xdd88c7);})[_0x93f6('0x16')](function(_0x2cc651){_0xc5e44a(_0x34ba39['error'](0x1f4,_0x2cc651[_0x93f6('0x14')]));});});};exports[_0x93f6('0x38')]=function(_0x3566a5){var _0x560de2=this;return new Promise(function(_0xdc4a1d,_0x5728be){var _0x3c6e83;return db['User'][_0x93f6('0x39')]({'where':_0x3566a5[_0x93f6('0x1b')]['where']||{},'attributes':['id','name']})[_0x93f6('0xc')](function(_0x5893fd){if(_0x5893fd){_0x3c6e83=_0x5893fd;if(_0x3566a5['body'][_0x93f6('0x3a')]&&!utils[_0x93f6('0x3b')](_0x3566a5[_0x93f6('0x32')][_0x93f6('0x3a')])){throw new Error(_0x93f6('0x3c'));}switch(_0x3566a5['body'][_0x93f6('0x3a')]){case _0x93f6('0x3d'):return db[_0x93f6('0x26')]['update']({'paused':0x0},{'where':{'UserId':_0x3c6e83['id']}})['then'](function(){return db[_0x93f6('0x28')][_0x93f6('0x21')]({'where':{'channel':_0x3566a5[_0x93f6('0x32')][_0x93f6('0x3a')],'membername':_0x3c6e83[_0x93f6('0x24')],'type':'PAUSE','exitAt':null}});})[_0x93f6('0xc')](function(_0xe07639){if(_0xe07639){return _0xe07639[_0x93f6('0x27')]({'exitAt':moment()[_0x93f6('0x2b')](_0x93f6('0x2c')),'data2':_0x93f6('0x3e')},{'individualHooks':!![]});}return null;})[_0x93f6('0xc')](function(){return _0x3c6e83[_0x93f6('0x27')]({'voicePause':![]});});case _0x93f6('0x3f'):case _0x93f6('0x40'):case _0x93f6('0x41'):case _0x93f6('0x42'):case'openchannel':case _0x93f6('0x43'):return db[_0x93f6('0x28')][_0x93f6('0x21')]({'where':{'channel':_0x3566a5[_0x93f6('0x32')]['channel'],'membername':_0x3c6e83[_0x93f6('0x24')],'type':_0x93f6('0x29'),'exitAt':null}})[_0x93f6('0xc')](function(_0x35b4a6){return _0x35b4a6['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x1f7a97={};_[_0x93f6('0x44')](_0x1f7a97,util[_0x93f6('0x2b')](_0x93f6('0x45'),_0x3566a5[_0x93f6('0x32')]['channel'],_0x93f6('0x46')),![]);return _0x3c6e83['update'](_0x1f7a97);});default:return db[_0x93f6('0x26')][_0x93f6('0x27')]({'paused':0x0},{'where':{'UserId':_0x3c6e83['id']}})[_0x93f6('0xc')](function(){return db[_0x93f6('0x28')][_0x93f6('0x19')]({'where':{'membername':_0x3c6e83[_0x93f6('0x24')],'type':'PAUSE','exitAt':null}});})[_0x93f6('0xc')](function(_0x50f007){var _0x495af1=[];_0x50f007[_0x93f6('0x2e')](function(_0x5427da){_0x495af1[_0x93f6('0x2f')](_0x5427da[_0x93f6('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x93f6('0x3e')}));});return BPromise[_0x93f6('0x47')](_0x495af1);})[_0x93f6('0xc')](function(){return _0x3c6e83[_0x93f6('0x27')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x93f6('0xc')](function(_0x45cef0){_0xdc4a1d(_0x45cef0);})['catch'](function(_0x2fb881){_0x5728be(_0x560de2[_0x93f6('0x12')](0x1f4,_0x2fb881[_0x93f6('0x14')]));});});};exports['LogoutUser']=function(_0x1bec00){var _0x1e9e56=this;return new Promise(function(_0x4ea1d6,_0x348a65){var _0x509bc0;return db[_0x93f6('0x18')][_0x93f6('0x39')]({'where':_0x1bec00[_0x93f6('0x1b')][_0x93f6('0x1a')]||{},'attributes':['id',_0x93f6('0x24')]})[_0x93f6('0xc')](function(_0x325f95){if(_0x325f95){_0x509bc0=_0x325f95;return db[_0x93f6('0x26')][_0x93f6('0x48')]({'where':{'membername':_0x509bc0['name']},'individualHooks':!![]});}})['then'](function(){if(_0x509bc0){return db['MemberReport'][_0x93f6('0x19')]({'where':{'membername':_0x509bc0[_0x93f6('0x24')],'exitAt':null}});}})[_0x93f6('0xc')](function(_0x30cb37){if(_0x509bc0){if(_0x30cb37&&_0x30cb37[_0x93f6('0x2a')]){var _0x4c9701=[];_0x30cb37[_0x93f6('0x2e')](function(_0x4135d4){_0x4c9701['push'](_0x4135d4['update']({'exitAt':moment()[_0x93f6('0x2b')](_0x93f6('0x2c'))}));});return BPromise[_0x93f6('0x47')](_0x4c9701);}}})[_0x93f6('0xc')](function(){if(_0x509bc0){return _0x509bc0[_0x93f6('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x93f6('0xc')](function(_0x55820f){_0x4ea1d6(_0x55820f);})[_0x93f6('0x16')](function(_0x4a69ed){_0x348a65(_0x1e9e56[_0x93f6('0x12')](0x1f4,_0x4a69ed[_0x93f6('0x14')]));});});};exports[_0x93f6('0x49')]=function(_0x53a48a){var _0x4a5c58=this;return new Promise(function(_0x43036f,_0x22307c){var _0x1cf790;var _0x42b8b6;var _0x50b4bc;var _0x2e258c;return db[_0x93f6('0x18')][_0x93f6('0x39')]({'where':_0x53a48a[_0x93f6('0x1b')][_0x93f6('0x1a')]||{},'attributes':['id',_0x93f6('0x24'),_0x93f6('0x34'),_0x93f6('0x4a'),_0x93f6('0x4b'),_0x93f6('0x25'),'loginInPause',_0x93f6('0x31')]})[_0x93f6('0xc')](function(_0x5c77c5){if(_0x5c77c5){_0x1cf790=_0x5c77c5;_0x2e258c=_0x53a48a[_0x93f6('0x32')][_0x93f6('0x31')]?_0x53a48a[_0x93f6('0x32')][_0x93f6('0x31')]:util[_0x93f6('0x2b')]('SIP/%s',_0x1cf790[_0x93f6('0x24')]);return db[_0x93f6('0x18')][_0x93f6('0x4c')]({'where':{'role':_0x93f6('0x4d'),'online':!![],'id':{'$ne':_0x1cf790['id']}}});}})[_0x93f6('0xc')](function(_0x125624){if(_0x125624){_0x50b4bc=_0x125624;return require(_0x93f6('0x4e'))[_0x93f6('0x4f')]();}})[_0x93f6('0xc')](function(_0x27b86f){if(_0x27b86f&&_0x27b86f[_0x93f6('0x50')]&&_0x50b4bc>=_0x27b86f[_0x93f6('0x50')]){throw new Error(_0x93f6('0x51'));}})[_0x93f6('0xc')](function(){if(_0x1cf790){return db[_0x93f6('0x26')]['destroy']({'where':{'membername':_0x1cf790[_0x93f6('0x24')]},'individualHooks':!![]});}})[_0x93f6('0xc')](function(){if(_0x1cf790){return _0x1cf790[_0x93f6('0x52')]({'raw':!![]});}})[_0x93f6('0xc')](function(_0x1c6225){if(_0x1cf790){if(_0x1c6225){var _0x479a46=[];_0x42b8b6=_0x1c6225;if(_0x42b8b6[_0x93f6('0x2a')]){for(var _0x2389d6=0x0;_0x2389d6<_0x42b8b6[_0x93f6('0x2a')];_0x2389d6++){_0x479a46[_0x93f6('0x2f')](db[_0x93f6('0x26')][_0x93f6('0x53')]({'membername':_0x1cf790[_0x93f6('0x24')],'UserId':_0x1cf790['id'],'queue_name':_0x42b8b6[_0x2389d6][_0x93f6('0x24')],'VoiceQueueId':_0x42b8b6[_0x2389d6]['id'],'interface':_0x2e258c,'paused':_0x1cf790['loginInPause']||![],'penalty':_0x42b8b6[_0x2389d6][_0x93f6('0x54')]||0x0}));}return BPromise[_0x93f6('0x47')](_0x479a46);}}}})['then'](function(){if(_0x1cf790){return db[_0x93f6('0x28')][_0x93f6('0x19')]({'where':{'membername':_0x1cf790['name'],'exitAt':null}});}})[_0x93f6('0xc')](function(_0x2aaf55){if(_0x1cf790){if(_0x2aaf55&&_0x2aaf55[_0x93f6('0x2a')]){var _0x21ad3e=[];_0x2aaf55['forEach'](function(_0x9aeab3){_0x21ad3e[_0x93f6('0x2f')](_0x9aeab3[_0x93f6('0x27')]({'exitAt':moment()[_0x93f6('0x2b')](_0x93f6('0x2c'))}));});return BPromise['all'](_0x21ad3e);}}})[_0x93f6('0xc')](function(_0x65ce97){if(_0x1cf790){var _0x3b65b2=[];var _0x50e1c2=[];var _0x4bbd5e=utils[_0x93f6('0x55')]();var _0x6f30ce={'membername':_0x1cf790[_0x93f6('0x24')],'interface':_0x2e258c,'enterAt':moment()['format'](_0x93f6('0x2c')),'role':_0x1cf790['role'],'internal':_0x1cf790[_0x93f6('0x25')]};_0x4bbd5e[_0x93f6('0x2e')](function(_0x3de857){_0x3b65b2['push'](_['merge']({'channel':_0x3de857,'type':_0x93f6('0x56'),'data1':_0x93f6('0x57'),'data2':_0x2e258c},_0x6f30ce));if(_0x1cf790['loginInPause']){_0x50e1c2[_0x93f6('0x2f')](_['merge']({'channel':_0x3de857,'type':'PAUSE','data1':'LOGININPAUSE'},_0x6f30ce));}});return db['MemberReport'][_0x93f6('0x36')](_0x3b65b2[_0x93f6('0x58')](_0x50e1c2),{'individualHooks':!![]});}})[_0x93f6('0xc')](function(){if(_0x1cf790){return _0x1cf790[_0x93f6('0x27')]({'online':!![],'lastLoginAt':moment()['format'](_0x93f6('0x2c')),'voicePause':_0x1cf790[_0x93f6('0x59')]||![],'mailPause':_0x1cf790['loginInPause']||![],'chatPause':_0x1cf790[_0x93f6('0x59')]||![],'faxPause':_0x1cf790['loginInPause']||![],'smsPause':_0x1cf790[_0x93f6('0x59')]||![],'openchannelPause':_0x1cf790[_0x93f6('0x59')]||![],'pauseType':_0x1cf790[_0x93f6('0x59')]?_0x93f6('0x5a'):null,'lastPauseAt':moment()[_0x93f6('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2e258c});}})[_0x93f6('0xc')](function(_0x29cc0c){_0x43036f(_0x29cc0c);})[_0x93f6('0x16')](function(_0x2732b8){_0x22307c(_0x4a5c58[_0x93f6('0x12')](0x1f4,_0x2732b8['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bed555e..a38346f 100644 --- a/server/api/user/user.socket.js +++ b/server/api/user/user.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2fd=['emit','register','length','user:','./user.events','update'];(function(_0x3eb8a1,_0x5b5f08){var _0x45938e=function(_0xea3246){while(--_0xea3246){_0x3eb8a1['push'](_0x3eb8a1['shift']());}};_0x45938e(++_0x5b5f08);}(_0xf2fd,0x9a));var _0xdf2f=function(_0x3df56d,_0x4297d1){_0x3df56d=_0x3df56d-0x0;var _0x2a7a69=_0xf2fd[_0x3df56d];return _0x2a7a69;};'use strict';var UserEvents=require(_0xdf2f('0x0'));var events=['save','remove',_0xdf2f('0x1')];function createListener(_0x1d3925,_0x31ce93){return function(_0xc46915){_0x31ce93[_0xdf2f('0x2')](_0x1d3925,_0xc46915);};}function removeListener(_0x4287b4,_0x14bb3c){return function(){UserEvents['removeListener'](_0x4287b4,_0x14bb3c);};}exports[_0xdf2f('0x3')]=function(_0x3d36b7){for(var _0xbd4fa1=0x0,_0xb7b584=events[_0xdf2f('0x4')];_0xbd4fa1<_0xb7b584;_0xbd4fa1++){var _0xa89077=events[_0xbd4fa1];var _0x5d9c08=createListener(_0xdf2f('0x5')+_0xa89077,_0x3d36b7);UserEvents['on'](_0xa89077,_0x5d9c08);}}; \ No newline at end of file +var _0x15c0=['save','remove','update','emit','removeListener','register','length','user:','./user.events'];(function(_0x1c6643,_0x628f55){var _0x549742=function(_0x1caa15){while(--_0x1caa15){_0x1c6643['push'](_0x1c6643['shift']());}};_0x549742(++_0x628f55);}(_0x15c0,0xaa));var _0x015c=function(_0x20ba94,_0x2718b3){_0x20ba94=_0x20ba94-0x0;var _0x17f044=_0x15c0[_0x20ba94];return _0x17f044;};'use strict';var UserEvents=require(_0x015c('0x0'));var events=[_0x015c('0x1'),_0x015c('0x2'),_0x015c('0x3')];function createListener(_0x22cb5a,_0x4096f5){return function(_0x16ed3a){_0x4096f5[_0x015c('0x4')](_0x22cb5a,_0x16ed3a);};}function removeListener(_0x134b40,_0x5cba6e){return function(){UserEvents[_0x015c('0x5')](_0x134b40,_0x5cba6e);};}exports[_0x015c('0x6')]=function(_0x31d411){for(var _0x34c182=0x0,_0xd1de5c=events[_0x015c('0x7')];_0x34c182<_0xd1de5c;_0x34c182++){var _0x1a71c5=events[_0x34c182];var _0x2596d8=createListener(_0x015c('0x8')+_0x1a71c5,_0x31d411);UserEvents['on'](_0x1a71c5,_0x2596d8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 68c5d52..3e8fd19 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x41a5cc,_0x3b0082){var _0x25f138=function(_0x1e432d){while(--_0x1e432d){_0x41a5cc['push'](_0x41a5cc['shift']());}};_0x25f138(++_0x3b0082);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593d89,_0x45145f){_0x593d89=_0x593d89-0x0;var _0x4aa403=_0xcb91[_0x593d89];return _0x4aa403;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x56523d,_0x4f050a){var _0xbb257e=function(_0xf435c4){while(--_0xf435c4){_0x56523d['push'](_0x56523d['shift']());}};_0xbb257e(++_0x4f050a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0xcb91[_0xa1e3ca];return _0x5005ab;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9006424..2a17bcb 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9b70=['INTEGER','sequelize','exports'];(function(_0x381fa6,_0x5532d9){var _0x488bb5=function(_0x271fc9){while(--_0x271fc9){_0x381fa6['push'](_0x381fa6['shift']());}};_0x488bb5(++_0x5532d9);}(_0x9b70,0x8b));var _0x09b7=function(_0x228d2d,_0x557835){_0x228d2d=_0x228d2d-0x0;var _0x59b4e4=_0x9b70[_0x228d2d];return _0x59b4e4;};'use strict';var Sequelize=require(_0x09b7('0x0'));module[_0x09b7('0x1')]={'penalty':{'type':Sequelize[_0x09b7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index db1d09c..aa1ffd5 100644 --- a/server/api/userChatQueue/userChatQueue.model.js +++ b/server/api/userChatQueue/userChatQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c46=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','request-promise'];(function(_0x665328,_0x196657){var _0xfdaf67=function(_0x4ea406){while(--_0x4ea406){_0x665328['push'](_0x665328['shift']());}};_0xfdaf67(++_0x196657);}(_0x9c46,0x19f));var _0x69c4=function(_0x3c7ed0,_0x25a399){_0x3c7ed0=_0x3c7ed0-0x0;var _0x3a7307=_0x9c46[_0x3c7ed0];return _0x3a7307;};'use strict';var _=require(_0x69c4('0x0'));var util=require(_0x69c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x69c4('0x2'));var BPromise=require(_0x69c4('0x3'));var rp=require(_0x69c4('0x4'));var fs=require('fs');var path=require(_0x69c4('0x5'));var rimraf=require(_0x69c4('0x6'));var config=require(_0x69c4('0x7'));var attributes=require(_0x69c4('0x8'));module[_0x69c4('0x9')]=function(_0x32c492,_0x813af){return _0x32c492['define'](_0x69c4('0xa'),attributes,{'tableName':_0x69c4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab82=['bluebird','request-promise','path','./userChatQueue.attributes','exports','user_has_chat_queues','lodash','util','moment'];(function(_0x23d2a3,_0x16e7d1){var _0x10c1a8=function(_0x547141){while(--_0x547141){_0x23d2a3['push'](_0x23d2a3['shift']());}};_0x10c1a8(++_0x16e7d1);}(_0xab82,0x1b6));var _0x2ab8=function(_0x329237,_0x4612d6){_0x329237=_0x329237-0x0;var _0x325a21=_0xab82[_0x329237];return _0x325a21;};'use strict';var _=require(_0x2ab8('0x0'));var util=require(_0x2ab8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2ab8('0x2'));var BPromise=require(_0x2ab8('0x3'));var rp=require(_0x2ab8('0x4'));var fs=require('fs');var path=require(_0x2ab8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2ab8('0x6'));module[_0x2ab8('0x7')]=function(_0xf017f6,_0x13c9ae){return _0xf017f6['define']('UserChatQueue',attributes,{'tableName':_0x2ab8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index ab03779..a8b31ba 100644 --- a/server/api/userChatQueue/userChatQueue.rpc.js +++ b/server/api/userChatQueue/userChatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa899=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x42f314,_0x88895f){var _0xc57a42=function(_0x16c690){while(--_0x16c690){_0x42f314['push'](_0x42f314['shift']());}};_0xc57a42(++_0x88895f);}(_0xa899,0x67));var _0x9a89=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xa899[_0x24618a];return _0x2e3d64;};'use strict';var _=require(_0x9a89('0x0'));var util=require('util');var moment=require(_0x9a89('0x1'));var BPromise=require(_0x9a89('0x2'));var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))('rpc');var config=require(_0x9a89('0x8'));var jayson=require(_0x9a89('0x9'));var client=jayson[_0x9a89('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cdf74,_0x151332,_0x39686a){return new BPromise(function(_0x1f7bb5,_0x2d888b){return client['request'](_0x3cdf74,_0x39686a)['then'](function(_0x8ec9a2){logger[_0x9a89('0xb')](_0x9a89('0xc'),_0x151332,_0x9a89('0xd'));logger[_0x9a89('0xe')](_0x9a89('0xf'),_0x151332,_0x9a89('0xd'),JSON[_0x9a89('0x10')](_0x8ec9a2));if(_0x8ec9a2[_0x9a89('0x11')]){if(_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x12')]===0x1f4){logger['error'](_0x9a89('0xc'),_0x151332,_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);return _0x2d888b(_0x8ec9a2[_0x9a89('0x11')]['message']);}logger['error'](_0x9a89('0xc'),_0x151332,_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);return _0x1f7bb5(_0x8ec9a2[_0x9a89('0x11')][_0x9a89('0x13')]);}else{logger[_0x9a89('0xb')](_0x9a89('0xc'),_0x151332,'request\x20sent');_0x1f7bb5(_0x8ec9a2['result'][_0x9a89('0x13')]);}})[_0x9a89('0x14')](function(_0x83df58){logger[_0x9a89('0x11')](_0x9a89('0xc'),_0x151332,_0x83df58);_0x2d888b(_0x83df58);});});} \ No newline at end of file +var _0x4d20=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x609c7b,_0xffd9fc){var _0xafc313=function(_0x145190){while(--_0x145190){_0x609c7b['push'](_0x609c7b['shift']());}};_0xafc313(++_0xffd9fc);}(_0x4d20,0xad));var _0x04d2=function(_0x16bc51,_0x3b3279){_0x16bc51=_0x16bc51-0x0;var _0x1fba2d=_0x4d20[_0x16bc51];return _0x1fba2d;};'use strict';var _=require('lodash');var util=require(_0x04d2('0x0'));var moment=require(_0x04d2('0x1'));var BPromise=require('bluebird');var rs=require(_0x04d2('0x2'));var fs=require('fs');var Redis=require(_0x04d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x04d2('0x4'))(_0x04d2('0x5'));var config=require(_0x04d2('0x6'));var jayson=require(_0x04d2('0x7'));var client=jayson[_0x04d2('0x8')][_0x04d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c051d,_0x5c348b,_0xa64e4){return new BPromise(function(_0x498944,_0x5edaff){return client[_0x04d2('0xa')](_0x6c051d,_0xa64e4)[_0x04d2('0xb')](function(_0x57d751){logger[_0x04d2('0xc')](_0x04d2('0xd'),_0x5c348b,_0x04d2('0xe'));logger[_0x04d2('0xf')](_0x04d2('0x10'),_0x5c348b,_0x04d2('0xe'),JSON[_0x04d2('0x11')](_0x57d751));if(_0x57d751[_0x04d2('0x12')]){if(_0x57d751['error'][_0x04d2('0x13')]===0x1f4){logger[_0x04d2('0x12')](_0x04d2('0xd'),_0x5c348b,_0x57d751[_0x04d2('0x12')]['message']);return _0x5edaff(_0x57d751[_0x04d2('0x12')][_0x04d2('0x14')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x5c348b,_0x57d751[_0x04d2('0x12')][_0x04d2('0x14')]);return _0x498944(_0x57d751[_0x04d2('0x12')][_0x04d2('0x14')]);}else{logger['info'](_0x04d2('0xd'),_0x5c348b,'request\x20sent');_0x498944(_0x57d751[_0x04d2('0x15')][_0x04d2('0x14')]);}})[_0x04d2('0x16')](function(_0x2ca00c){logger[_0x04d2('0x12')](_0x04d2('0xd'),_0x5c348b,_0x2ca00c);_0x5edaff(_0x2ca00c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c207192..a86906a 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3e5f6d,_0x121db6){var _0x1bea6e=function(_0x435c7c){while(--_0x435c7c){_0x3e5f6d['push'](_0x3e5f6d['shift']());}};_0x1bea6e(++_0x121db6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5363a3,_0x3c6310){var _0x4cd0c6=function(_0x3d7747){while(--_0x3d7747){_0x5363a3['push'](_0x5363a3['shift']());}};_0x4cd0c6(++_0x3c6310);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 9073dda..a617168 100644 --- a/server/api/userFaxQueue/userFaxQueue.attributes.js +++ b/server/api/userFaxQueue/userFaxQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xecf8=['INTEGER','STRING','exports'];(function(_0x5a3db4,_0x5ea07e){var _0x3211c3=function(_0x45da4f){while(--_0x45da4f){_0x5a3db4['push'](_0x5a3db4['shift']());}};_0x3211c3(++_0x5ea07e);}(_0xecf8,0x14c));var _0x8ecf=function(_0x516bc0,_0x577539){_0x516bc0=_0x516bc0-0x0;var _0x25ba14=_0xecf8[_0x516bc0];return _0x25ba14;};'use strict';var Sequelize=require('sequelize');module[_0x8ecf('0x0')]={'penalty':{'type':Sequelize[_0x8ecf('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8ecf('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8ecf('0x2')]}}; \ No newline at end of file +var _0x2d52=['exports','INTEGER','STRING','sequelize'];(function(_0x3c9df8,_0x387a5d){var _0x3c8cd3=function(_0x4a0541){while(--_0x4a0541){_0x3c9df8['push'](_0x3c9df8['shift']());}};_0x3c8cd3(++_0x387a5d);}(_0x2d52,0x1f3));var _0x22d5=function(_0x3ae38e,_0x3aaa14){_0x3ae38e=_0x3ae38e-0x0;var _0x483595=_0x2d52[_0x3ae38e];return _0x483595;};'use strict';var Sequelize=require(_0x22d5('0x0'));module[_0x22d5('0x1')]={'penalty':{'type':Sequelize[_0x22d5('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x22d5('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x22d5('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index c5614bf..0e2e43f 100644 --- a/server/api/userFaxQueue/userFaxQueue.model.js +++ b/server/api/userFaxQueue/userFaxQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2115=['../../config/logger','api','bluebird','path','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x26d4f4,_0x4b9b22){var _0x50fc2d=function(_0x9a1fe2){while(--_0x9a1fe2){_0x26d4f4['push'](_0x26d4f4['shift']());}};_0x50fc2d(++_0x4b9b22);}(_0x2115,0x8b));var _0x5211=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x2115[_0xc82d1a];return _0x32fad2;};'use strict';var _=require(_0x5211('0x0'));var util=require('util');var logger=require(_0x5211('0x1'))(_0x5211('0x2'));var moment=require('moment');var BPromise=require(_0x5211('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5211('0x4'));var rimraf=require('rimraf');var config=require(_0x5211('0x5'));var attributes=require(_0x5211('0x6'));module['exports']=function(_0xa0f528,_0x1afa05){return _0xa0f528[_0x5211('0x7')](_0x5211('0x8'),attributes,{'tableName':_0x5211('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22c8=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0x22c8,0x118));var _0x822c=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x22c8[_0x305c31];return _0x17f39f;};'use strict';var _=require(_0x822c('0x0'));var util=require('util');var logger=require(_0x822c('0x1'))(_0x822c('0x2'));var moment=require(_0x822c('0x3'));var BPromise=require(_0x822c('0x4'));var rp=require(_0x822c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x822c('0x6'));var attributes=require(_0x822c('0x7'));module[_0x822c('0x8')]=function(_0xe86d8b,_0x34751d){return _0xe86d8b[_0x822c('0x9')](_0x822c('0xa'),attributes,{'tableName':_0x822c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 8911400..10cc939 100644 --- a/server/api/userFaxQueue/userFaxQueue.rpc.js +++ b/server/api/userFaxQueue/userFaxQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x798848,_0x324311){var _0x2501b6=function(_0x31e392){while(--_0x31e392){_0x798848['push'](_0x798848['shift']());}};_0x2501b6(++_0x324311);}(_0xbdb6,0x164));var _0x6bdb=function(_0x5e0ca0,_0x3f3560){_0x5e0ca0=_0x5e0ca0-0x0;var _0x3dd119=_0xbdb6[_0x5e0ca0];return _0x3dd119;};'use strict';var _=require(_0x6bdb('0x0'));var util=require(_0x6bdb('0x1'));var moment=require(_0x6bdb('0x2'));var BPromise=require(_0x6bdb('0x3'));var rs=require(_0x6bdb('0x4'));var fs=require('fs');var Redis=require(_0x6bdb('0x5'));var db=require(_0x6bdb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6bdb('0x7'));var config=require(_0x6bdb('0x8'));var jayson=require(_0x6bdb('0x9'));var client=jayson[_0x6bdb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x521adf,_0x2647db,_0x27c32a){return new BPromise(function(_0x463ef3,_0x8c9399){return client['request'](_0x521adf,_0x27c32a)[_0x6bdb('0xb')](function(_0x4badaf){logger[_0x6bdb('0xc')](_0x6bdb('0xd'),_0x2647db,_0x6bdb('0xe'));logger['debug'](_0x6bdb('0xf'),_0x2647db,_0x6bdb('0xe'),JSON['stringify'](_0x4badaf));if(_0x4badaf[_0x6bdb('0x10')]){if(_0x4badaf['error'][_0x6bdb('0x11')]===0x1f4){logger[_0x6bdb('0x10')](_0x6bdb('0xd'),_0x2647db,_0x4badaf[_0x6bdb('0x10')][_0x6bdb('0x12')]);return _0x8c9399(_0x4badaf['error'][_0x6bdb('0x12')]);}logger['error'](_0x6bdb('0xd'),_0x2647db,_0x4badaf['error'][_0x6bdb('0x12')]);return _0x463ef3(_0x4badaf[_0x6bdb('0x10')][_0x6bdb('0x12')]);}else{logger['info'](_0x6bdb('0xd'),_0x2647db,_0x6bdb('0xe'));_0x463ef3(_0x4badaf[_0x6bdb('0x13')][_0x6bdb('0x12')]);}})[_0x6bdb('0x14')](function(_0x3ecf52){logger[_0x6bdb('0x10')](_0x6bdb('0xd'),_0x2647db,_0x3ecf52);_0x8c9399(_0x3ecf52);});});} \ No newline at end of file +var _0xcdcc=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2a0126,_0x1e6683){var _0x1dd95a=function(_0x35969f){while(--_0x35969f){_0x2a0126['push'](_0x2a0126['shift']());}};_0x1dd95a(++_0x1e6683);}(_0xcdcc,0x8f));var _0xccdc=function(_0x1c1489,_0x167dfa){_0x1c1489=_0x1c1489-0x0;var _0xff0770=_0xcdcc[_0x1c1489];return _0xff0770;};'use strict';var _=require(_0xccdc('0x0'));var util=require('util');var moment=require(_0xccdc('0x1'));var BPromise=require('bluebird');var rs=require(_0xccdc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccdc('0x3'))['db'];var utils=require(_0xccdc('0x4'));var logger=require(_0xccdc('0x5'))(_0xccdc('0x6'));var config=require(_0xccdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xccdc('0x8')][_0xccdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x152549,_0x492442,_0xb8a16d){return new BPromise(function(_0x2f9d2b,_0x4838a8){return client[_0xccdc('0xa')](_0x152549,_0xb8a16d)[_0xccdc('0xb')](function(_0x1fff01){logger[_0xccdc('0xc')](_0xccdc('0xd'),_0x492442,_0xccdc('0xe'));logger[_0xccdc('0xf')](_0xccdc('0x10'),_0x492442,_0xccdc('0xe'),JSON[_0xccdc('0x11')](_0x1fff01));if(_0x1fff01[_0xccdc('0x12')]){if(_0x1fff01[_0xccdc('0x12')][_0xccdc('0x13')]===0x1f4){logger['error'](_0xccdc('0xd'),_0x492442,_0x1fff01[_0xccdc('0x12')][_0xccdc('0x14')]);return _0x4838a8(_0x1fff01[_0xccdc('0x12')]['message']);}logger[_0xccdc('0x12')](_0xccdc('0xd'),_0x492442,_0x1fff01['error'][_0xccdc('0x14')]);return _0x2f9d2b(_0x1fff01[_0xccdc('0x12')][_0xccdc('0x14')]);}else{logger[_0xccdc('0xc')](_0xccdc('0xd'),_0x492442,_0xccdc('0xe'));_0x2f9d2b(_0x1fff01[_0xccdc('0x15')][_0xccdc('0x14')]);}})[_0xccdc('0x16')](function(_0x55a959){logger[_0xccdc('0x12')](_0xccdc('0xd'),_0x492442,_0x55a959);_0x4838a8(_0x55a959);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 6e09205..9399394 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b47ba,_0x2aeb85){var _0x3d5034=function(_0x4c4f05){while(--_0x4c4f05){_0x4b47ba['push'](_0x4b47ba['shift']());}};_0x3d5034(++_0x2aeb85);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xa0ec46,_0x4a70aa){var _0x34d213=function(_0x4c11d3){while(--_0x4c11d3){_0xa0ec46['push'](_0xa0ec46['shift']());}};_0x34d213(++_0x4a70aa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0xcb91[_0x5d8631];return _0x34c15e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index acbe914..fc0ee58 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa925=['INTEGER'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xa925,0x1b2));var _0x5a92=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa925[_0x3c2a69];return _0x596bc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5a92('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x142f=['sequelize'];(function(_0x3e43c4,_0x185813){var _0x2a4818=function(_0x53029c){while(--_0x53029c){_0x3e43c4['push'](_0x3e43c4['shift']());}};_0x2a4818(++_0x185813);}(_0x142f,0x136));var _0xf142=function(_0x39f957,_0x4f7972){_0x39f957=_0x39f957-0x0;var _0x251b11=_0x142f[_0x39f957];return _0x251b11;};'use strict';var Sequelize=require(_0xf142('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 066f7fe..af2576e 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7328=['define','UserMailQueue','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7328,0xa2));var _0x8732=function(_0x277ced,_0x44d15f){_0x277ced=_0x277ced-0x0;var _0x29b3fb=_0x7328[_0x277ced];return _0x29b3fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8732('0x0'))(_0x8732('0x1'));var moment=require(_0x8732('0x2'));var BPromise=require(_0x8732('0x3'));var rp=require(_0x8732('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8732('0x5'));var config=require(_0x8732('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x8732('0x7')]=function(_0x5a44a8,_0x1945e9){return _0x5a44a8[_0x8732('0x8')](_0x8732('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f95=['exports','define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes'];(function(_0x40749a,_0x3c6560){var _0x2b8fd7=function(_0x11ac03){while(--_0x11ac03){_0x40749a['push'](_0x40749a['shift']());}};_0x2b8fd7(++_0x3c6560);}(_0x1f95,0xd0));var _0x51f9=function(_0x473196,_0x14c192){_0x473196=_0x473196-0x0;var _0x25f37b=_0x1f95[_0x473196];return _0x25f37b;};'use strict';var _=require('lodash');var util=require(_0x51f9('0x0'));var logger=require(_0x51f9('0x1'))(_0x51f9('0x2'));var moment=require(_0x51f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f9('0x4'));var rimraf=require(_0x51f9('0x5'));var config=require(_0x51f9('0x6'));var attributes=require(_0x51f9('0x7'));module[_0x51f9('0x8')]=function(_0x13ac72,_0x418757){return _0x13ac72[_0x51f9('0x9')](_0x51f9('0xa'),attributes,{'tableName':_0x51f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 5d517cf..1df9026 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x64df79,_0x27d446){var _0x506e45=function(_0x102ccf){while(--_0x102ccf){_0x64df79['push'](_0x64df79['shift']());}};_0x506e45(++_0x27d446);}(_0x4b84,0x1cc));var _0x44b8=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4b84[_0x160c73];return _0xd9302;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x324582,_0x13e7c6){var _0xdd5f2=function(_0x519817){while(--_0x519817){_0x324582['push'](_0x324582['shift']());}};_0xdd5f2(++_0x13e7c6);}(_0x34e8,0x12c));var _0x834e=function(_0xa6ac57,_0x17e72d){_0xa6ac57=_0xa6ac57-0x0;var _0x358863=_0x34e8[_0xa6ac57];return _0x358863;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 75e0aae..6e2d4af 100644 --- a/server/api/userNotification/index.js +++ b/server/api/userNotification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd59c=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e3398,_0x2b4b4d){var _0x18b770=function(_0x41bf07){while(--_0x41bf07){_0x4e3398['push'](_0x4e3398['shift']());}};_0x18b770(++_0x2b4b4d);}(_0xd59c,0x94));var _0xcd59=function(_0x4cbbde,_0x409fa9){_0x4cbbde=_0x4cbbde-0x0;var _0x33e8cd=_0xd59c[_0x4cbbde];return _0x33e8cd;};'use strict';var multer=require(_0xcd59('0x0'));var util=require(_0xcd59('0x1'));var path=require(_0xcd59('0x2'));var timeout=require(_0xcd59('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd59('0x4'));var auth=require(_0xcd59('0x5'));var interaction=require(_0xcd59('0x6'));var config=require(_0xcd59('0x7'));var controller=require('./userNotification.controller');router[_0xcd59('0x8')]('/',auth[_0xcd59('0x9')](),controller[_0xcd59('0xa')]);module[_0xcd59('0xb')]=router; \ No newline at end of file +var _0xa8d1=['sendUserNotification','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userNotification.controller'];(function(_0x228dac,_0x4fa98a){var _0x403192=function(_0x5dfdd8){while(--_0x5dfdd8){_0x228dac['push'](_0x228dac['shift']());}};_0x403192(++_0x4fa98a);}(_0xa8d1,0x8d));var _0x1a8d=function(_0x229066,_0x443063){_0x229066=_0x229066-0x0;var _0xd7c89=_0xa8d1[_0x229066];return _0xd7c89;};'use strict';var multer=require(_0x1a8d('0x0'));var util=require(_0x1a8d('0x1'));var path=require(_0x1a8d('0x2'));var timeout=require(_0x1a8d('0x3'));var express=require(_0x1a8d('0x4'));var router=express[_0x1a8d('0x5')]();var fs_extra=require(_0x1a8d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1a8d('0x7'));var config=require('../../config/environment');var controller=require(_0x1a8d('0x8'));router['post']('/',auth['isAuthenticated'](),controller[_0x1a8d('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 5ba5b8b..d427ae6 100644 --- a/server/api/userNotification/userNotification.attributes.js +++ b/server/api/userNotification/userNotification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7e7=['STRING','sequelize','exports','TEXT'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xc7e7,0xa1));var _0x7c7e=function(_0x1b3183,_0x3cfee8){_0x1b3183=_0x1b3183-0x0;var _0xe526a7=_0xc7e7[_0x1b3183];return _0xe526a7;};'use strict';var Sequelize=require(_0x7c7e('0x0'));module[_0x7c7e('0x1')]={'body':{'type':Sequelize[_0x7c7e('0x2')]},'senderName':{'type':Sequelize[_0x7c7e('0x3')]},'recipientsId':{'type':Sequelize[_0x7c7e('0x2')]},'recipientsDescription':{'type':Sequelize[_0x7c7e('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x4891=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x2a2177,_0xd3c452){var _0x15b499=function(_0x575e3c){while(--_0x575e3c){_0x2a2177['push'](_0x2a2177['shift']());}};_0x15b499(++_0xd3c452);}(_0x4891,0xec));var _0x1489=function(_0x307ab9,_0x100002){_0x307ab9=_0x307ab9-0x0;var _0x3a5d49=_0x4891[_0x307ab9];return _0x3a5d49;};'use strict';var Sequelize=require(_0x1489('0x0'));module[_0x1489('0x1')]={'body':{'type':Sequelize[_0x1489('0x2')]},'senderName':{'type':Sequelize[_0x1489('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x1489('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3656a44..1cad54d 100644 --- a/server/api/userNotification/userNotification.controller.js +++ b/server/api/userNotification/userNotification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb675=['send','sendUserNotification','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','Missing\x20\x27view\x27\x20parameter','body','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','recipientsId','sequelize','transaction','forEach','recipient','emit','userNotification:send','catch','Template','html','render','startCase','User','union','ids','queue','replace','Queue','push','all','flatten','findOne','getAgents','map','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','then','destroy','end','error','stack','name'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb675,0x94));var _0x5b67=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0xb675[_0x37b7b6];return _0x10c4c3;};'use strict';var emlformat=require(_0x5b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b67('0x1'));var jsonpatch=require(_0x5b67('0x2'));var rp=require('request-promise');var moment=require(_0x5b67('0x3'));var BPromise=require(_0x5b67('0x4'));var Mustache=require('mustache');var util=require(_0x5b67('0x5'));var path=require(_0x5b67('0x6'));var sox=require(_0x5b67('0x7'));var csv=require(_0x5b67('0x8'));var ejs=require(_0x5b67('0x9'));var fs=require('fs');var fs_extra=require(_0x5b67('0xa'));var _=require(_0x5b67('0xb'));var squel=require(_0x5b67('0xc'));var crypto=require(_0x5b67('0xd'));var jsforce=require(_0x5b67('0xe'));var deskjs=require(_0x5b67('0xf'));var toCsv=require(_0x5b67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b67('0x10'));var authService=require(_0x5b67('0x11'));var qs=require(_0x5b67('0x12'));var as=require(_0x5b67('0x13'));var hardwareService=require(_0x5b67('0x14'));var logger=require(_0x5b67('0x15'))(_0x5b67('0x16'));var utils=require(_0x5b67('0x17'));var config=require(_0x5b67('0x18'));var licenseUtil=require(_0x5b67('0x19'));var db=require(_0x5b67('0x1a'))['db'];config['redis']=_[_0x5b67('0x1b')](config[_0x5b67('0x1c')],{'host':_0x5b67('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5b67('0x1e'))[_0x5b67('0x1f')](socket);function respondWithStatusCode(_0x26f30c,_0x4c71bc){_0x4c71bc=_0x4c71bc||0xcc;return function(_0xb6b79f){if(_0xb6b79f){return _0x26f30c[_0x5b67('0x20')](_0x4c71bc);}return _0x26f30c['status'](_0x4c71bc)['end']();};}function respondWithResult(_0x2c325a,_0x4ef7d6){_0x4ef7d6=_0x4ef7d6||0xc8;return function(_0x3024c2){if(_0x3024c2){return _0x2c325a[_0x5b67('0x21')](_0x4ef7d6)[_0x5b67('0x22')](_0x3024c2);}};}function respondWithFilteredResult(_0x32dc88,_0x4e9d0d){return function(_0xfa824a){if(_0xfa824a){var _0x27f53c=typeof _0x4e9d0d[_0x5b67('0x23')]==='undefined'&&typeof _0x4e9d0d[_0x5b67('0x24')]===_0x5b67('0x25');var _0x2396ae=_0xfa824a[_0x5b67('0x26')];var _0x2186d4=_0x27f53c?0x0:_0x4e9d0d['offset'];var _0x461671=_0x27f53c?_0xfa824a[_0x5b67('0x26')]:_0x4e9d0d[_0x5b67('0x23')]+_0x4e9d0d['limit'];var _0x1238f3;if(_0x461671>=_0x2396ae){_0x461671=_0x2396ae;_0x1238f3=0xc8;}else{_0x1238f3=0xce;}_0x32dc88[_0x5b67('0x21')](_0x1238f3);return _0x32dc88[_0x5b67('0x27')]('Content-Range',_0x2186d4+'-'+_0x461671+'/'+_0x2396ae)['json'](_0xfa824a);}return null;};}function patchUpdates(_0x1232be){return function(_0x5a2b07){try{jsonpatch['apply'](_0x5a2b07,_0x1232be,!![]);}catch(_0x47a4be){return BPromise[_0x5b67('0x28')](_0x47a4be);}return _0x5a2b07[_0x5b67('0x29')]();};}function saveUpdates(_0x4db883,_0x361cf4){return function(_0xf67192){if(_0xf67192){return _0xf67192['update'](_0x4db883)[_0x5b67('0x2a')](function(_0x4eb8ac){return _0x4eb8ac;});}return null;};}function removeEntity(_0x7b68ce,_0x2bd209){return function(_0x22d45c){if(_0x22d45c){return _0x22d45c[_0x5b67('0x2b')]()[_0x5b67('0x2a')](function(){_0x7b68ce['status'](0xcc)[_0x5b67('0x2c')]();});}};}function handleEntityNotFound(_0x186b2c,_0x5a11ba){return function(_0x312ab9){if(!_0x312ab9){_0x186b2c['sendStatus'](0x194);}return _0x312ab9;};}function handleError(_0x1798df,_0x3d35ef){_0x3d35ef=_0x3d35ef||0x1f4;return function(_0xbc4a8a){logger[_0x5b67('0x2d')](_0xbc4a8a[_0x5b67('0x2e')]);if(_0xbc4a8a[_0x5b67('0x2f')]){delete _0xbc4a8a[_0x5b67('0x2f')];}_0x1798df[_0x5b67('0x21')](_0x3d35ef)[_0x5b67('0x30')](_0xbc4a8a);};}exports[_0x5b67('0x31')]=function(_0x3c8e3c,_0x51296e,_0x9d4a99){if(!_0x3c8e3c['body']['hasOwnProperty'](_0x5b67('0x32'))&&!_0x3c8e3c['body']['hasOwnProperty'](_0x5b67('0x33'))){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x36'));}else{if(_0x3c8e3c['body'][_0x5b67('0x37')](_0x5b67('0x33'))&&!_0x3c8e3c['body'][_0x5b67('0x37')]('view')){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x38'));}if(!_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x37')]('recipients')){throw new db['Sequelize'][(_0x5b67('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x237a2f=JSON[_0x5b67('0x3a')](_0x3c8e3c['body'][_0x5b67('0x3b')]);}catch(_0x1a3db5){logger['error'](_0x1a3db5);throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x3c'));}var _0x17cbd4=[_0x5b67('0x3d'),'faxqueue',_0x5b67('0x3e'),_0x5b67('0x3f'),'smsqueue','voicequeue',_0x5b67('0x40'),_0x5b67('0x41'),_0x5b67('0x42')];if(_[_0x5b67('0x43')](_0x237a2f,function(_0x425694){return!_[_0x5b67('0x44')](_0x17cbd4,_0x425694[_0x5b67('0x45')]['toLowerCase']());})){throw new db[(_0x5b67('0x34'))][(_0x5b67('0x35'))](_0x5b67('0x46'));}}}var _0x58f0a5={};_0x58f0a5[_0x5b67('0x47')]=_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x37')](_0x5b67('0x47'))?_0x3c8e3c[_0x5b67('0x39')][_0x5b67('0x47')]:_0x3c8e3c[_0x5b67('0x42')]['fullname'];_0x58f0a5[_0x5b67('0x48')]=_['isEmpty'](_0x3c8e3c['body'][_0x5b67('0x48')])?null:_0x3c8e3c['body'][_0x5b67('0x48')];_0x58f0a5[_0x5b67('0x49')]=_0x3c8e3c['body'][_0x5b67('0x49')]||![];_0x58f0a5['SenderId']=_0x3c8e3c[_0x5b67('0x42')]['id'];return getContent(_0x3c8e3c[_0x5b67('0x39')])[_0x5b67('0x2a')](function(_0x197997){_0x58f0a5[_0x5b67('0x39')]=_0x197997;return getRecipients(_0x237a2f);})[_0x5b67('0x2a')](function(_0x3534af){_0x58f0a5[_0x5b67('0x4a')]=_['sortBy'](_0x3534af)['join'](',');return db[_0x5b67('0x4b')][_0x5b67('0x4c')](function(_0x4fe027){return db['UserNotification']['create'](_0x58f0a5,{'raw':!![],'transaction':_0x4fe027})['then'](function(_0x1a430c){var _0x3a9dc0={'sender':_0x58f0a5[_0x5b67('0x47')],'description':_0x58f0a5[_0x5b67('0x48')],'content':_0x58f0a5['body'],'beep':_0x58f0a5[_0x5b67('0x49')]};_0x3534af[_0x5b67('0x4d')](function(_0x1d28b2){_0x3a9dc0[_0x5b67('0x4e')]=_0x1d28b2;socket[_0x5b67('0x4f')](_0x5b67('0x50'),_0x3a9dc0);});return _0x1a430c;});});})[_0x5b67('0x2a')](respondWithResult(_0x51296e,0xc9))[_0x5b67('0x51')](handleError(_0x51296e,null));};function getContent(_0x334d8d){return new BPromise(function(_0x476951,_0x5484b9){if(_0x334d8d['text']){_0x476951(_0x334d8d[_0x5b67('0x32')]);return;}return db[_0x5b67('0x52')]['findOne']({'attributes':[_0x5b67('0x53')],'where':{'id':_0x334d8d[_0x5b67('0x33')]},'raw':!![]})[_0x5b67('0x2a')](function(_0x30b048){if(!_0x30b048)throw new db[(_0x5b67('0x34'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4aec29=Mustache[_0x5b67('0x54')](_0x30b048[_0x5b67('0x53')],_0x334d8d['view']);_0x476951(_0x4aec29);})[_0x5b67('0x51')](function(_0x2306b1){_0x5484b9(_0x2306b1);});});}function getRecipients(_0xccab70){return new BPromise(function(_0x479360,_0x2dcfc7){var _0x5bd813=[];var _0x3d4865=[];_0xccab70[_0x5b67('0x4d')](function(_0x43fcb1){var _0x167639=_[_0x5b67('0x55')](_0x43fcb1['model']['toLowerCase']());if(_0x167639===_0x5b67('0x56')){_0x5bd813=_[_0x5b67('0x57')](_0x5bd813,_0x43fcb1[_0x5b67('0x58')]);}else{if(_['includes'](_0x167639,_0x5b67('0x59')))_0x167639=_0x167639[_0x5b67('0x5a')](_0x5b67('0x59'),_0x5b67('0x5b'));_0x43fcb1['ids'][_0x5b67('0x4d')](function(_0x39908d){_0x3d4865[_0x5b67('0x5c')](getAgents(_0x167639,_0x39908d));});}});return BPromise[_0x5b67('0x5d')](_0x3d4865)[_0x5b67('0x2a')](function(_0x58d1c8){_0x5bd813=_['union'](_0x5bd813,_[_0x5b67('0x5e')](_0x58d1c8));_0x479360(_0x5bd813);})[_0x5b67('0x51')](function(_0x601a7f){_0x2dcfc7(_0x601a7f);});});}function getAgents(_0x553248,_0x2ef2b1){return new BPromise(function(_0x38e2d8,_0x2d68d4){return db[_0x553248][_0x5b67('0x5f')]({'where':{'id':_0x2ef2b1}})['then'](function(_0x1fb738){return _0x1fb738[_0x5b67('0x60')]({'attributes':['id'],'raw':!![]})[_0x5b67('0x2a')](function(_0x535ab3){var _0x5c1766=_[_0x5b67('0x61')](_0x535ab3,'id');_0x38e2d8(_0x5c1766);});})['catch'](function(_0x4560e1){_0x2d68d4(_0x4560e1);});});} \ No newline at end of file +var _0xc317=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./userNotification.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','sendUserNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','senderName','fullname','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipientsDescription','forEach','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','User','ids','queue','all','union','flatten','getAgents','map'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0xc317,0x190));var _0x7c31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc317[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7c31('0x0'));var rimraf=require(_0x7c31('0x1'));var zipdir=require(_0x7c31('0x2'));var jsonpatch=require(_0x7c31('0x3'));var rp=require(_0x7c31('0x4'));var moment=require(_0x7c31('0x5'));var BPromise=require(_0x7c31('0x6'));var Mustache=require('mustache');var util=require(_0x7c31('0x7'));var path=require(_0x7c31('0x8'));var sox=require(_0x7c31('0x9'));var csv=require(_0x7c31('0xa'));var ejs=require(_0x7c31('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c31('0xc'));var squel=require(_0x7c31('0xd'));var crypto=require(_0x7c31('0xe'));var jsforce=require(_0x7c31('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c31('0x10'));var Papa=require(_0x7c31('0x11'));var Redis=require('ioredis');var authService=require(_0x7c31('0x12'));var qs=require(_0x7c31('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c31('0x14'));var logger=require('../../config/logger')(_0x7c31('0x15'));var utils=require(_0x7c31('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7c31('0x17'));var db=require(_0x7c31('0x18'))['db'];config['redis']=_[_0x7c31('0x19')](config['redis'],{'host':_0x7c31('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c31('0x1b')]));require(_0x7c31('0x1c'))[_0x7c31('0x1d')](socket);function respondWithStatusCode(_0x23c358,_0x1b000a){_0x1b000a=_0x1b000a||0xcc;return function(_0x12c764){if(_0x12c764){return _0x23c358['sendStatus'](_0x1b000a);}return _0x23c358[_0x7c31('0x1e')](_0x1b000a)[_0x7c31('0x1f')]();};}function respondWithResult(_0x3095a1,_0x1ed7da){_0x1ed7da=_0x1ed7da||0xc8;return function(_0x9c401d){if(_0x9c401d){return _0x3095a1[_0x7c31('0x1e')](_0x1ed7da)[_0x7c31('0x20')](_0x9c401d);}};}function respondWithFilteredResult(_0x5c0abc,_0x590502){return function(_0x54982c){if(_0x54982c){var _0xd17820=typeof _0x590502[_0x7c31('0x21')]==='undefined'&&typeof _0x590502[_0x7c31('0x22')]===_0x7c31('0x23');var _0x31407e=_0x54982c[_0x7c31('0x24')];var _0x1e4e95=_0xd17820?0x0:_0x590502[_0x7c31('0x21')];var _0x16c22e=_0xd17820?_0x54982c[_0x7c31('0x24')]:_0x590502[_0x7c31('0x21')]+_0x590502[_0x7c31('0x22')];var _0x30a891;if(_0x16c22e>=_0x31407e){_0x16c22e=_0x31407e;_0x30a891=0xc8;}else{_0x30a891=0xce;}_0x5c0abc[_0x7c31('0x1e')](_0x30a891);return _0x5c0abc[_0x7c31('0x25')](_0x7c31('0x26'),_0x1e4e95+'-'+_0x16c22e+'/'+_0x31407e)[_0x7c31('0x20')](_0x54982c);}return null;};}function patchUpdates(_0x249646){return function(_0x5832b2){try{jsonpatch[_0x7c31('0x27')](_0x5832b2,_0x249646,!![]);}catch(_0x2b2fa3){return BPromise[_0x7c31('0x28')](_0x2b2fa3);}return _0x5832b2[_0x7c31('0x29')]();};}function saveUpdates(_0x556739,_0x3003ee){return function(_0x38cc07){if(_0x38cc07){return _0x38cc07[_0x7c31('0x2a')](_0x556739)['then'](function(_0x2a099d){return _0x2a099d;});}return null;};}function removeEntity(_0x310564,_0x120b77){return function(_0x53f874){if(_0x53f874){return _0x53f874[_0x7c31('0x2b')]()[_0x7c31('0x2c')](function(){_0x310564['status'](0xcc)[_0x7c31('0x1f')]();});}};}function handleEntityNotFound(_0x1981d0,_0x46890b){return function(_0x13b108){if(!_0x13b108){_0x1981d0[_0x7c31('0x2d')](0x194);}return _0x13b108;};}function handleError(_0x10a628,_0x51b120){_0x51b120=_0x51b120||0x1f4;return function(_0x1ec084){logger[_0x7c31('0x2e')](_0x1ec084[_0x7c31('0x2f')]);if(_0x1ec084[_0x7c31('0x30')]){delete _0x1ec084[_0x7c31('0x30')];}_0x10a628[_0x7c31('0x1e')](_0x51b120)['send'](_0x1ec084);};}exports[_0x7c31('0x31')]=function(_0x45cb8d,_0x5dbf9c,_0x5a74a6){if(!_0x45cb8d[_0x7c31('0x32')]['hasOwnProperty'](_0x7c31('0x33'))&&!_0x45cb8d[_0x7c31('0x32')][_0x7c31('0x34')](_0x7c31('0x35'))){throw new db[(_0x7c31('0x36'))][(_0x7c31('0x37'))](_0x7c31('0x38'));}else{if(_0x45cb8d[_0x7c31('0x32')][_0x7c31('0x34')](_0x7c31('0x35'))&&!_0x45cb8d[_0x7c31('0x32')][_0x7c31('0x34')]('view')){throw new db[(_0x7c31('0x36'))][(_0x7c31('0x37'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x45cb8d[_0x7c31('0x32')]['hasOwnProperty'](_0x7c31('0x39'))){throw new db[(_0x7c31('0x36'))][(_0x7c31('0x37'))](_0x7c31('0x3a'));}else{try{var _0x1a747a=JSON['parse'](_0x45cb8d['body']['recipients']);}catch(_0x4bc47f){logger[_0x7c31('0x2e')](_0x4bc47f);throw new db['Sequelize']['ValidationError'](_0x7c31('0x3b'));}var _0x5a3c90=[_0x7c31('0x3c'),_0x7c31('0x3d'),_0x7c31('0x3e'),_0x7c31('0x3f'),_0x7c31('0x40'),'voicequeue','whatsappqueue',_0x7c31('0x41'),_0x7c31('0x42')];if(_[_0x7c31('0x43')](_0x1a747a,function(_0x5cd848){return!_[_0x7c31('0x44')](_0x5a3c90,_0x5cd848[_0x7c31('0x45')][_0x7c31('0x46')]());})){throw new db[(_0x7c31('0x36'))][(_0x7c31('0x37'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x203db2={};_0x203db2['senderName']=_0x45cb8d[_0x7c31('0x32')][_0x7c31('0x34')](_0x7c31('0x47'))?_0x45cb8d['body'][_0x7c31('0x47')]:_0x45cb8d[_0x7c31('0x42')][_0x7c31('0x48')];_0x203db2['recipientsDescription']=_[_0x7c31('0x49')](_0x45cb8d[_0x7c31('0x32')]['recipientsDescription'])?null:_0x45cb8d[_0x7c31('0x32')]['recipientsDescription'];_0x203db2[_0x7c31('0x4a')]=_0x45cb8d[_0x7c31('0x32')][_0x7c31('0x4a')]||![];_0x203db2[_0x7c31('0x4b')]=_0x45cb8d[_0x7c31('0x42')]['id'];return getContent(_0x45cb8d[_0x7c31('0x32')])[_0x7c31('0x2c')](function(_0x5323c4){_0x203db2[_0x7c31('0x32')]=_0x5323c4;return getRecipients(_0x1a747a);})[_0x7c31('0x2c')](function(_0x890fd6){_0x203db2[_0x7c31('0x4c')]=_[_0x7c31('0x4d')](_0x890fd6)[_0x7c31('0x4e')](',');return db[_0x7c31('0x4f')][_0x7c31('0x50')](function(_0x756b97){return db[_0x7c31('0x51')][_0x7c31('0x52')](_0x203db2,{'raw':!![],'transaction':_0x756b97})[_0x7c31('0x2c')](function(_0x51f096){var _0x36b812={'sender':_0x203db2[_0x7c31('0x47')],'description':_0x203db2[_0x7c31('0x53')],'content':_0x203db2[_0x7c31('0x32')],'beep':_0x203db2[_0x7c31('0x4a')]};_0x890fd6[_0x7c31('0x54')](function(_0x5ac85c){_0x36b812['recipient']=_0x5ac85c;socket['emit'](_0x7c31('0x55'),_0x36b812);});return _0x51f096;});});})['then'](respondWithResult(_0x5dbf9c,0xc9))[_0x7c31('0x56')](handleError(_0x5dbf9c,null));};function getContent(_0x300878){return new BPromise(function(_0x30d1ec,_0x3c5d11){if(_0x300878['text']){_0x30d1ec(_0x300878[_0x7c31('0x33')]);return;}return db[_0x7c31('0x57')][_0x7c31('0x58')]({'attributes':[_0x7c31('0x59')],'where':{'id':_0x300878[_0x7c31('0x35')]},'raw':!![]})[_0x7c31('0x2c')](function(_0x46fcfe){if(!_0x46fcfe)throw new db[(_0x7c31('0x36'))][(_0x7c31('0x37'))](_0x7c31('0x5a'));var _0x1fd6d9=Mustache['render'](_0x46fcfe[_0x7c31('0x59')],_0x300878[_0x7c31('0x5b')]);_0x30d1ec(_0x1fd6d9);})[_0x7c31('0x56')](function(_0x41d9a1){_0x3c5d11(_0x41d9a1);});});}function getRecipients(_0x3832ab){return new BPromise(function(_0x10e794,_0x345009){var _0x16208b=[];var _0x152c5f=[];_0x3832ab[_0x7c31('0x54')](function(_0x55a7a6){var _0x47764d=_['startCase'](_0x55a7a6['model'][_0x7c31('0x46')]());if(_0x47764d===_0x7c31('0x5c')){_0x16208b=_['union'](_0x16208b,_0x55a7a6[_0x7c31('0x5d')]);}else{if(_[_0x7c31('0x44')](_0x47764d,_0x7c31('0x5e')))_0x47764d=_0x47764d['replace'](_0x7c31('0x5e'),'Queue');_0x55a7a6[_0x7c31('0x5d')][_0x7c31('0x54')](function(_0x16c7a7){_0x152c5f['push'](getAgents(_0x47764d,_0x16c7a7));});}});return BPromise[_0x7c31('0x5f')](_0x152c5f)['then'](function(_0x523743){_0x16208b=_[_0x7c31('0x60')](_0x16208b,_[_0x7c31('0x61')](_0x523743));_0x10e794(_0x16208b);})['catch'](function(_0x2a385b){_0x345009(_0x2a385b);});});}function getAgents(_0x1e682d,_0x5402e2){return new BPromise(function(_0x19b437,_0x2f7bbf){return db[_0x1e682d][_0x7c31('0x58')]({'where':{'id':_0x5402e2}})[_0x7c31('0x2c')](function(_0x2fe45f){return _0x2fe45f[_0x7c31('0x62')]({'attributes':['id'],'raw':!![]})[_0x7c31('0x2c')](function(_0x542455){var _0x15cb47=_[_0x7c31('0x63')](_0x542455,'id');_0x19b437(_0x15cb47);});})[_0x7c31('0x56')](function(_0x115e49){_0x2f7bbf(_0x115e49);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 18b912e..4ab683a 100644 --- a/server/api/userNotification/userNotification.events.js +++ b/server/api/userNotification/userNotification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc039=['hook','exports','events','UserNotification','remove','emit','hasOwnProperty'];(function(_0x5a4ac1,_0xb9eb0b){var _0x11dc18=function(_0x49d481){while(--_0x49d481){_0x5a4ac1['push'](_0x5a4ac1['shift']());}};_0x11dc18(++_0xb9eb0b);}(_0xc039,0xe2));var _0x9c03=function(_0x17c3de,_0x1a4494){_0x17c3de=_0x17c3de-0x0;var _0x1044c6=_0xc039[_0x17c3de];return _0x1044c6;};'use strict';var EventEmitter=require(_0x9c03('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x9c03('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9c03('0x2')};function emitEvent(_0x3b85eb){return function(_0x4177cd,_0x347692,_0x3bd965){UserNotificationEvents[_0x9c03('0x3')](_0x3b85eb+':'+_0x4177cd['id'],_0x4177cd);UserNotificationEvents[_0x9c03('0x3')](_0x3b85eb,_0x4177cd);_0x3bd965(null);};}for(var e in events){if(events[_0x9c03('0x4')](e)){var event=events[e];UserNotification[_0x9c03('0x5')](e,emitEvent(event));}}module[_0x9c03('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0xca82=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x29210d,_0x45648b){var _0x4a66e6=function(_0x1ec623){while(--_0x1ec623){_0x29210d['push'](_0x29210d['shift']());}};_0x4a66e6(++_0x45648b);}(_0xca82,0x6b));var _0x2ca8=function(_0xfff9cf,_0x55ad70){_0xfff9cf=_0xfff9cf-0x0;var _0x231718=_0xca82[_0xfff9cf];return _0x231718;};'use strict';var EventEmitter=require(_0x2ca8('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2ca8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2ca8('0x2'),'afterDestroy':_0x2ca8('0x3')};function emitEvent(_0xd6cea6){return function(_0x495516,_0x2841c3,_0x3efea2){UserNotificationEvents[_0x2ca8('0x4')](_0xd6cea6+':'+_0x495516['id'],_0x495516);UserNotificationEvents[_0x2ca8('0x4')](_0xd6cea6,_0x495516);_0x3efea2(null);};}for(var e in events){if(events[_0x2ca8('0x5')](e)){var event=events[e];UserNotification[_0x2ca8('0x6')](e,emitEvent(event));}}module[_0x2ca8('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 87927bc..ca70c23 100644 --- a/server/api/userNotification/userNotification.model.js +++ b/server/api/userNotification/userNotification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x335a=['request-promise','path','rimraf','define','UserNotification','userNotifications','../../config/logger','api','moment','bluebird'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x335a,0x150));var _0xa335=function(_0x5f110c,_0x1ce402){_0x5f110c=_0x5f110c-0x0;var _0x1f0234=_0x335a[_0x5f110c];return _0x1f0234;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa335('0x0'))(_0xa335('0x1'));var moment=require(_0xa335('0x2'));var BPromise=require(_0xa335('0x3'));var rp=require(_0xa335('0x4'));var fs=require('fs');var path=require(_0xa335('0x5'));var rimraf=require(_0xa335('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x24c1e5,_0x48701c){return _0x24c1e5[_0xa335('0x7')](_0xa335('0x8'),attributes,{'tableName':_0xa335('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3eb3=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications','utf8mb4','utf8mb4_unicode_ci','bluebird'];(function(_0x201d88,_0x129163){var _0x47e5c7=function(_0x2e15bf){while(--_0x2e15bf){_0x201d88['push'](_0x201d88['shift']());}};_0x47e5c7(++_0x129163);}(_0x3eb3,0xf9));var _0x33eb=function(_0x4bf944,_0x2a6edf){_0x4bf944=_0x4bf944-0x0;var _0x242e1b=_0x3eb3[_0x4bf944];return _0x242e1b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x33eb('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33eb('0x1'));var rimraf=require(_0x33eb('0x2'));var config=require(_0x33eb('0x3'));var attributes=require(_0x33eb('0x4'));module[_0x33eb('0x5')]=function(_0x583779,_0xf1d6a){return _0x583779[_0x33eb('0x6')]('UserNotification',attributes,{'tableName':_0x33eb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x33eb('0x8'),'collate':_0x33eb('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0bb4b6f..428727c 100644 --- a/server/api/userNotification/userNotification.rpc.js +++ b/server/api/userNotification/userNotification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5825=['UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','localhost','socket.io-emitter','redis','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5825,0xaa));var _0x5582=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5825[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x5582('0x0'));var moment=require(_0x5582('0x1'));var BPromise=require(_0x5582('0x2'));var rs=require(_0x5582('0x3'));var fs=require('fs');var Redis=require(_0x5582('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5582('0x5'));var logger=require('../../config/logger')(_0x5582('0x6'));var config=require(_0x5582('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5582('0x8')][_0x5582('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5582('0xa'),'port':0x18eb});var socket=require(_0x5582('0xb'))(new Redis(config[_0x5582('0xc')]));require(_0x5582('0xd'))[_0x5582('0xe')](socket);function respondWithRpcPromise(_0x423ca1,_0x341a29,_0x155742){return new BPromise(function(_0x15851e,_0x222a28){return client[_0x5582('0xf')](_0x423ca1,_0x155742)['then'](function(_0x3bd2ca){logger[_0x5582('0x10')](_0x5582('0x11'),_0x341a29,'request\x20sent');logger[_0x5582('0x12')](_0x5582('0x13'),_0x341a29,_0x5582('0x14'),JSON[_0x5582('0x15')](_0x3bd2ca));if(_0x3bd2ca[_0x5582('0x16')]){if(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x17')]===0x1f4){logger[_0x5582('0x16')](_0x5582('0x11'),_0x341a29,_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);return _0x222a28(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);}logger[_0x5582('0x16')]('UserNotification,\x20%s,\x20%s',_0x341a29,_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);return _0x15851e(_0x3bd2ca[_0x5582('0x16')][_0x5582('0x18')]);}else{logger[_0x5582('0x10')]('UserNotification,\x20%s,\x20%s',_0x341a29,_0x5582('0x14'));_0x15851e(_0x3bd2ca[_0x5582('0x19')][_0x5582('0x18')]);}})[_0x5582('0x1a')](function(_0x4b92d7){logger[_0x5582('0x16')](_0x5582('0x11'),_0x341a29,_0x4b92d7);_0x222a28(_0x4b92d7);});});} \ No newline at end of file +var _0x5f10=['stringify','error','message','request\x20sent','lodash','util','randomstring','ioredis','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x31a460,_0x1399b1){var _0xceb8c5=function(_0x6180f6){while(--_0x6180f6){_0x31a460['push'](_0x31a460['shift']());}};_0xceb8c5(++_0x1399b1);}(_0x5f10,0xac));var _0x05f1=function(_0x136a01,_0x3e0f10){_0x136a01=_0x136a01-0x0;var _0x39ccee=_0x5f10[_0x136a01];return _0x39ccee;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x05f1('0x2'));var fs=require('fs');var Redis=require(_0x05f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05f1('0x4'));var config=require(_0x05f1('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x05f1('0x6')]=_[_0x05f1('0x7')](config['redis'],{'host':_0x05f1('0x8'),'port':0x18eb});var socket=require(_0x05f1('0x9'))(new Redis(config[_0x05f1('0x6')]));require(_0x05f1('0xa'))[_0x05f1('0xb')](socket);function respondWithRpcPromise(_0x50b524,_0x4d558b,_0x3567e4){return new BPromise(function(_0x130df7,_0x36fbbf){return client[_0x05f1('0xc')](_0x50b524,_0x3567e4)['then'](function(_0x4de7a8){logger[_0x05f1('0xd')](_0x05f1('0xe'),_0x4d558b,'request\x20sent');logger[_0x05f1('0xf')](_0x05f1('0x10'),_0x4d558b,'request\x20sent',JSON[_0x05f1('0x11')](_0x4de7a8));if(_0x4de7a8['error']){if(_0x4de7a8[_0x05f1('0x12')]['code']===0x1f4){logger[_0x05f1('0x12')](_0x05f1('0xe'),_0x4d558b,_0x4de7a8[_0x05f1('0x12')]['message']);return _0x36fbbf(_0x4de7a8[_0x05f1('0x12')][_0x05f1('0x13')]);}logger[_0x05f1('0x12')](_0x05f1('0xe'),_0x4d558b,_0x4de7a8['error'][_0x05f1('0x13')]);return _0x130df7(_0x4de7a8[_0x05f1('0x12')][_0x05f1('0x13')]);}else{logger[_0x05f1('0xd')](_0x05f1('0xe'),_0x4d558b,_0x05f1('0x14'));_0x130df7(_0x4de7a8['result'][_0x05f1('0x13')]);}})['catch'](function(_0x53607e){logger[_0x05f1('0x12')](_0x05f1('0xe'),_0x4d558b,_0x53607e);_0x36fbbf(_0x53607e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 682ecdd..d620db1 100644 --- a/server/api/userNotification/userNotification.socket.js +++ b/server/api/userNotification/userNotification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x27f0=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x36fa4b,_0x8e293){var _0x5e56bc=function(_0x1f1b65){while(--_0x1f1b65){_0x36fa4b['push'](_0x36fa4b['shift']());}};_0x5e56bc(++_0x8e293);}(_0x27f0,0x129));var _0x027f=function(_0x26a2f1,_0x530684){_0x26a2f1=_0x26a2f1-0x0;var _0x3be229=_0x27f0[_0x26a2f1];return _0x3be229;};'use strict';var UserNotificationEvents=require(_0x027f('0x0'));var events=[_0x027f('0x1'),_0x027f('0x2'),_0x027f('0x3')];function createListener(_0x1f437a,_0x47d76f){return function(_0x43347d){_0x47d76f[_0x027f('0x4')](_0x1f437a,_0x43347d);};}function removeListener(_0x24565c,_0x58bf8e){return function(){UserNotificationEvents[_0x027f('0x5')](_0x24565c,_0x58bf8e);};}exports[_0x027f('0x6')]=function(_0xec6191){for(var _0x276487=0x0,_0x2d7cb7=events[_0x027f('0x7')];_0x276487<_0x2d7cb7;_0x276487++){var _0x359047=events[_0x276487];var _0x5135d6=createListener(_0x027f('0x8')+_0x359047,_0xec6191);UserNotificationEvents['on'](_0x359047,_0x5135d6);}}; \ No newline at end of file +var _0xddb2=['update','emit'];(function(_0x392e18,_0x1ce2ed){var _0x2ead8c=function(_0x3f7934){while(--_0x3f7934){_0x392e18['push'](_0x392e18['shift']());}};_0x2ead8c(++_0x1ce2ed);}(_0xddb2,0xfc));var _0x2ddb=function(_0x231c24,_0x46f76d){_0x231c24=_0x231c24-0x0;var _0x1d3df=_0xddb2[_0x231c24];return _0x1d3df;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save','remove',_0x2ddb('0x0')];function createListener(_0x2af8cc,_0x4aaa8f){return function(_0x40f4b1){_0x4aaa8f[_0x2ddb('0x1')](_0x2af8cc,_0x40f4b1);};}function removeListener(_0x556699,_0x27dd88){return function(){UserNotificationEvents['removeListener'](_0x556699,_0x27dd88);};}exports['register']=function(_0x48dbed){for(var _0xad9e32=0x0,_0x453339=events['length'];_0xad9e32<_0x453339;_0xad9e32++){var _0x585e8a=events[_0xad9e32];var _0x5f40f4=createListener('userNotification:'+_0x585e8a,_0x48dbed);UserNotificationEvents['on'](_0x585e8a,_0x5f40f4);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7f2ae89..fc13c32 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2752d2,_0x6e18ef){var _0x113b40=function(_0x3ae9a5){while(--_0x3ae9a5){_0x2752d2['push'](_0x2752d2['shift']());}};_0x113b40(++_0x6e18ef);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x25bf47,_0x50e901){var _0x2b181d=function(_0x30bbf1){while(--_0x30bbf1){_0x25bf47['push'](_0x25bf47['shift']());}};_0x2b181d(++_0x50e901);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 71afd75..24fd3dc 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d23=['exports','INTEGER'];(function(_0x55f3d1,_0x524d87){var _0x2d9606=function(_0x5462d9){while(--_0x5462d9){_0x55f3d1['push'](_0x55f3d1['shift']());}};_0x2d9606(++_0x524d87);}(_0x4d23,0x82));var _0x34d2=function(_0x27acf4,_0x68c4ff){_0x27acf4=_0x27acf4-0x0;var _0x5a6a53=_0x4d23[_0x27acf4];return _0x5a6a53;};'use strict';var Sequelize=require('sequelize');module[_0x34d2('0x0')]={'penalty':{'type':Sequelize[_0x34d2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7cdf=['exports'];(function(_0x25c297,_0x10b3ac){var _0x119e92=function(_0xeb3073){while(--_0xeb3073){_0x25c297['push'](_0x25c297['shift']());}};_0x119e92(++_0x10b3ac);}(_0x7cdf,0x169));var _0xf7cd=function(_0x2c9ad4,_0x2b26c5){_0x2c9ad4=_0x2c9ad4-0x0;var _0x5a1156=_0x7cdf[_0x2c9ad4];return _0x5a1156;};'use strict';var Sequelize=require('sequelize');module[_0xf7cd('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 40c72cc..7a79cf7 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68ea=['exports','define','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x508632,_0x44bfac){var _0x2e517a=function(_0x1cbe5c){while(--_0x1cbe5c){_0x508632['push'](_0x508632['shift']());}};_0x2e517a(++_0x44bfac);}(_0x68ea,0x173));var _0xa68e=function(_0x26489e,_0x17fca8){_0x26489e=_0x26489e-0x0;var _0x41b00d=_0x68ea[_0x26489e];return _0x41b00d;};'use strict';var _=require(_0xa68e('0x0'));var util=require(_0xa68e('0x1'));var logger=require(_0xa68e('0x2'))(_0xa68e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa68e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa68e('0x5'));var config=require(_0xa68e('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xa68e('0x7')]=function(_0xd27746,_0x277e45){return _0xd27746[_0xa68e('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07bf=['path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','moment','bluebird','request-promise'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0x07bf,0x1b4));var _0xf07b=function(_0x492d07,_0x21ed32){_0x492d07=_0x492d07-0x0;var _0x3b3b4a=_0x07bf[_0x492d07];return _0x3b3b4a;};'use strict';var _=require(_0xf07b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf07b('0x1'));var BPromise=require(_0xf07b('0x2'));var rp=require(_0xf07b('0x3'));var fs=require('fs');var path=require(_0xf07b('0x4'));var rimraf=require(_0xf07b('0x5'));var config=require(_0xf07b('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xf07b('0x7')]=function(_0x2a383d,_0xef305){return _0x2a383d[_0xf07b('0x8')](_0xf07b('0x9'),attributes,{'tableName':_0xf07b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8f740b5..16650f4 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe937=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4491ef,_0x5153d9){var _0x3c72dc=function(_0x4c467d){while(--_0x4c467d){_0x4491ef['push'](_0x4491ef['shift']());}};_0x3c72dc(++_0x5153d9);}(_0xe937,0xc9));var _0x7e93=function(_0x30ecfd,_0x30132a){_0x30ecfd=_0x30ecfd-0x0;var _0x5e0553=_0xe937[_0x30ecfd];return _0x5e0553;};'use strict';var _=require(_0x7e93('0x0'));var util=require(_0x7e93('0x1'));var moment=require('moment');var BPromise=require(_0x7e93('0x2'));var rs=require(_0x7e93('0x3'));var fs=require('fs');var Redis=require(_0x7e93('0x4'));var db=require(_0x7e93('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e93('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7e93('0x7'));var client=jayson[_0x7e93('0x8')][_0x7e93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x378708,_0x40e4fc,_0x9c1615){return new BPromise(function(_0x4707b7,_0xd1fdc4){return client[_0x7e93('0xa')](_0x378708,_0x9c1615)[_0x7e93('0xb')](function(_0x2f2228){logger['info'](_0x7e93('0xc'),_0x40e4fc,_0x7e93('0xd'));logger[_0x7e93('0xe')](_0x7e93('0xf'),_0x40e4fc,_0x7e93('0xd'),JSON[_0x7e93('0x10')](_0x2f2228));if(_0x2f2228[_0x7e93('0x11')]){if(_0x2f2228['error']['code']===0x1f4){logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);return _0xd1fdc4(_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);}logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);return _0x4707b7(_0x2f2228[_0x7e93('0x11')][_0x7e93('0x12')]);}else{logger[_0x7e93('0x13')](_0x7e93('0xc'),_0x40e4fc,'request\x20sent');_0x4707b7(_0x2f2228[_0x7e93('0x14')]['message']);}})[_0x7e93('0x15')](function(_0x51290b){logger[_0x7e93('0x11')](_0x7e93('0xc'),_0x40e4fc,_0x51290b);_0xd1fdc4(_0x51290b);});});} \ No newline at end of file +var _0x76be=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x1da8ef,_0x4708e2){var _0x2d05bd=function(_0x4aa58e){while(--_0x4aa58e){_0x1da8ef['push'](_0x1da8ef['shift']());}};_0x2d05bd(++_0x4708e2);}(_0x76be,0x103));var _0xe76b=function(_0x4f0a22,_0x508918){_0x4f0a22=_0x4f0a22-0x0;var _0x5b1b67=_0x76be[_0x4f0a22];return _0x5b1b67;};'use strict';var _=require(_0xe76b('0x0'));var util=require('util');var moment=require(_0xe76b('0x1'));var BPromise=require(_0xe76b('0x2'));var rs=require(_0xe76b('0x3'));var fs=require('fs');var Redis=require(_0xe76b('0x4'));var db=require(_0xe76b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe76b('0x6'))(_0xe76b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe76b('0x8'));var client=jayson[_0xe76b('0x9')][_0xe76b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564efa,_0x38f8eb,_0x5d54ff){return new BPromise(function(_0xccdce6,_0x3a79c5){return client['request'](_0x564efa,_0x5d54ff)[_0xe76b('0xb')](function(_0x53af46){logger[_0xe76b('0xc')](_0xe76b('0xd'),_0x38f8eb,'request\x20sent');logger['debug'](_0xe76b('0xe'),_0x38f8eb,_0xe76b('0xf'),JSON['stringify'](_0x53af46));if(_0x53af46[_0xe76b('0x10')]){if(_0x53af46[_0xe76b('0x10')][_0xe76b('0x11')]===0x1f4){logger[_0xe76b('0x10')](_0xe76b('0xd'),_0x38f8eb,_0x53af46[_0xe76b('0x10')]['message']);return _0x3a79c5(_0x53af46['error'][_0xe76b('0x12')]);}logger[_0xe76b('0x10')](_0xe76b('0xd'),_0x38f8eb,_0x53af46[_0xe76b('0x10')]['message']);return _0xccdce6(_0x53af46[_0xe76b('0x10')][_0xe76b('0x12')]);}else{logger[_0xe76b('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38f8eb,_0xe76b('0xf'));_0xccdce6(_0x53af46[_0xe76b('0x13')][_0xe76b('0x12')]);}})[_0xe76b('0x14')](function(_0x3dfe4f){logger['error'](_0xe76b('0xd'),_0x38f8eb,_0x3dfe4f);_0x3a79c5(_0x3dfe4f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4c70e5d..9a91d34 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42ba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getResources','post','clone','/:id/sections','addSections','/:id/resources','addResources','put','update','delete','destroy','multer','util'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x42ba,0x1da));var _0xa42b=function(_0x2cd04f,_0x5ce2ae){_0x2cd04f=_0x2cd04f-0x0;var _0x5839ab=_0x42ba[_0x2cd04f];return _0x5839ab;};'use strict';var multer=require(_0xa42b('0x0'));var util=require(_0xa42b('0x1'));var path=require(_0xa42b('0x2'));var timeout=require(_0xa42b('0x3'));var express=require(_0xa42b('0x4'));var router=express[_0xa42b('0x5')]();var fs_extra=require(_0xa42b('0x6'));var auth=require(_0xa42b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa42b('0x8'));var controller=require(_0xa42b('0x9'));router[_0xa42b('0xa')]('/',auth[_0xa42b('0xb')](),controller[_0xa42b('0xc')]);router[_0xa42b('0xa')](_0xa42b('0xd'),auth[_0xa42b('0xb')](),controller[_0xa42b('0xe')]);router[_0xa42b('0xa')](_0xa42b('0xf'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x10')]);router[_0xa42b('0xa')]('/:id/sections',auth[_0xa42b('0xb')](),controller['getSections']);router['get']('/:id/resources',auth[_0xa42b('0xb')](),controller[_0xa42b('0x11')]);router[_0xa42b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa42b('0x12')]('/:id/clone',auth[_0xa42b('0xb')](),controller[_0xa42b('0x13')]);router['post'](_0xa42b('0x14'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x15')]);router[_0xa42b('0x12')](_0xa42b('0x16'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x17')]);router[_0xa42b('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xa42b('0x19')]);router[_0xa42b('0x1a')](_0xa42b('0xf'),auth[_0xa42b('0xb')](),controller[_0xa42b('0x1b')]);router[_0xa42b('0x1a')]('/:id/sections',auth[_0xa42b('0xb')](),controller['removeSections']);router[_0xa42b('0x1a')](_0xa42b('0x16'),auth[_0xa42b('0xb')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0xc77a=['addSections','addResources','put','/:id','update','destroy','delete','removeSections','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','describe','show','get','/:id/resources','getResources','post','create','/:id/clone','clone'];(function(_0x54e30c,_0x562795){var _0x7d2bf7=function(_0x4302c0){while(--_0x4302c0){_0x54e30c['push'](_0x54e30c['shift']());}};_0x7d2bf7(++_0x562795);}(_0xc77a,0x13d));var _0xac77=function(_0x5c41fd,_0xf1ae4c){_0x5c41fd=_0x5c41fd-0x0;var _0x12641f=_0xc77a[_0x5c41fd];return _0x12641f;};'use strict';var multer=require(_0xac77('0x0'));var util=require(_0xac77('0x1'));var path=require(_0xac77('0x2'));var timeout=require(_0xac77('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac77('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac77('0x5'));var controller=require(_0xac77('0x6'));router['get']('/',auth[_0xac77('0x7')](),controller[_0xac77('0x8')]);router['get'](_0xac77('0x9'),auth[_0xac77('0x7')](),controller[_0xac77('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xac77('0xb')]);router[_0xac77('0xc')]('/:id/sections',auth[_0xac77('0x7')](),controller['getSections']);router[_0xac77('0xc')](_0xac77('0xd'),auth[_0xac77('0x7')](),controller[_0xac77('0xe')]);router[_0xac77('0xf')]('/',auth[_0xac77('0x7')](),controller[_0xac77('0x10')]);router[_0xac77('0xf')](_0xac77('0x11'),auth[_0xac77('0x7')](),controller[_0xac77('0x12')]);router[_0xac77('0xf')]('/:id/sections',auth[_0xac77('0x7')](),controller[_0xac77('0x13')]);router[_0xac77('0xf')]('/:id/resources',auth[_0xac77('0x7')](),controller[_0xac77('0x14')]);router[_0xac77('0x15')](_0xac77('0x16'),auth[_0xac77('0x7')](),controller[_0xac77('0x17')]);router['delete'](_0xac77('0x16'),auth[_0xac77('0x7')](),controller[_0xac77('0x18')]);router[_0xac77('0x19')]('/:id/sections',auth[_0xac77('0x7')](),controller[_0xac77('0x1a')]);router[_0xac77('0x19')](_0xac77('0xd'),auth[_0xac77('0x7')](),controller['removeResources']);module[_0xac77('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 6cced58..cd6165e 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d67=['BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions','getDataValue','split'];(function(_0x410612,_0x9a7bd0){var _0x56155e=function(_0x1d4fc1){while(--_0x1d4fc1){_0x410612['push'](_0x410612['shift']());}};_0x56155e(++_0x9a7bd0);}(_0x5d67,0x121));var _0x75d6=function(_0x32442f,_0x31f094){_0x32442f=_0x32442f-0x0;var _0x4147be=_0x5d67[_0x32442f];return _0x4147be;};'use strict';var Sequelize=require(_0x75d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x75d6('0x1')],'allowNull':![],'unique':_0x75d6('0x2')},'crudPermissions':{'type':Sequelize[_0x75d6('0x1')],'set':function(_0x1ede15){this[_0x75d6('0x3')](_0x75d6('0x4'),_0x1ede15?_0x1ede15['join'](''):[]);},'get':function(){return this[_0x75d6('0x5')](_0x75d6('0x4'))?this[_0x75d6('0x5')](_0x75d6('0x4'))[_0x75d6('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x75d6('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x75d6('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3d82=['exports','STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3d82,0x80));var _0x23d8=function(_0x2cb76f,_0x18b8da){_0x2cb76f=_0x2cb76f-0x0;var _0x1ed050=_0x3d82[_0x2cb76f];return _0x1ed050;};'use strict';var Sequelize=require('sequelize');module[_0x23d8('0x0')]={'name':{'type':Sequelize[_0x23d8('0x1')],'allowNull':![],'unique':_0x23d8('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3b1fbd){this['setDataValue'](_0x23d8('0x3'),_0x3b1fbd?_0x3b1fbd[_0x23d8('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x23d8('0x3'))?this[_0x23d8('0x5')]('crudPermissions')[_0x23d8('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x23d8('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x23d8('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index edc80ac..50eb0e7 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0137=['resourceId','Plugin','bulkCreate','removeResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','UserProfile','fieldName','type','model','query','keys','attributes','intersection','nolimit','order','sort','pick','filters','VIRTUAL','merge','options','where','count','findAll','rows','show','params','fields','include','find','catch','create','clone','rawAttributes','length','includeAll','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','includes','sectionId','subsections','enabled','filter','Dashboard','forEach'];(function(_0x520a1b,_0x446485){var _0x11bea9=function(_0x2241cc){while(--_0x2241cc){_0x520a1b['push'](_0x520a1b['shift']());}};_0x11bea9(++_0x446485);}(_0x0137,0x1d8));var _0x7013=function(_0x962fc5,_0x58f074){_0x962fc5=_0x962fc5-0x0;var _0x43667c=_0x0137[_0x962fc5];return _0x43667c;};'use strict';var emlformat=require(_0x7013('0x0'));var rimraf=require(_0x7013('0x1'));var zipdir=require(_0x7013('0x2'));var jsonpatch=require(_0x7013('0x3'));var rp=require(_0x7013('0x4'));var moment=require('moment');var BPromise=require(_0x7013('0x5'));var Mustache=require(_0x7013('0x6'));var util=require(_0x7013('0x7'));var path=require(_0x7013('0x8'));var sox=require(_0x7013('0x9'));var csv=require(_0x7013('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7013('0xb'));var _=require(_0x7013('0xc'));var squel=require('squel');var crypto=require(_0x7013('0xd'));var jsforce=require(_0x7013('0xe'));var deskjs=require(_0x7013('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7013('0x10'));var Papa=require(_0x7013('0x11'));var Redis=require(_0x7013('0x12'));var authService=require(_0x7013('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7013('0x14'));var hardwareService=require(_0x7013('0x15'));var logger=require(_0x7013('0x16'))(_0x7013('0x17'));var utils=require(_0x7013('0x18'));var config=require(_0x7013('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7013('0x1a'))['db'];config[_0x7013('0x1b')]=_[_0x7013('0x1c')](config[_0x7013('0x1b')],{'host':_0x7013('0x1d'),'port':0x18eb});var socket=require(_0x7013('0x1e'))(new Redis(config[_0x7013('0x1b')]));require(_0x7013('0x1f'))[_0x7013('0x20')](socket);function respondWithStatusCode(_0x710f8a,_0x1c579f){_0x1c579f=_0x1c579f||0xcc;return function(_0x4af565){if(_0x4af565){return _0x710f8a['sendStatus'](_0x1c579f);}return _0x710f8a[_0x7013('0x21')](_0x1c579f)[_0x7013('0x22')]();};}function respondWithResult(_0x3e1a30,_0x4651a6){_0x4651a6=_0x4651a6||0xc8;return function(_0x36beb8){if(_0x36beb8){return _0x3e1a30['status'](_0x4651a6)['json'](_0x36beb8);}};}function respondWithFilteredResult(_0x13590e,_0x159a59){return function(_0x161a19){if(_0x161a19){var _0x1b68b0=typeof _0x159a59[_0x7013('0x23')]==='undefined'&&typeof _0x159a59[_0x7013('0x24')]===_0x7013('0x25');var _0x5da44b=_0x161a19['count'];var _0xdedff=_0x1b68b0?0x0:_0x159a59[_0x7013('0x23')];var _0x1e6e54=_0x1b68b0?_0x161a19['count']:_0x159a59[_0x7013('0x23')]+_0x159a59['limit'];var _0x2e4177;if(_0x1e6e54>=_0x5da44b){_0x1e6e54=_0x5da44b;_0x2e4177=0xc8;}else{_0x2e4177=0xce;}_0x13590e[_0x7013('0x21')](_0x2e4177);return _0x13590e[_0x7013('0x26')](_0x7013('0x27'),_0xdedff+'-'+_0x1e6e54+'/'+_0x5da44b)[_0x7013('0x28')](_0x161a19);}return null;};}function patchUpdates(_0x44c93a){return function(_0x2f261d){try{jsonpatch[_0x7013('0x29')](_0x2f261d,_0x44c93a,!![]);}catch(_0x1ba140){return BPromise[_0x7013('0x2a')](_0x1ba140);}return _0x2f261d[_0x7013('0x2b')]();};}function saveUpdates(_0x99f13d,_0x34811e){return function(_0x18a137){if(_0x18a137){return _0x18a137[_0x7013('0x2c')](_0x99f13d)[_0x7013('0x2d')](function(_0x1c11bf){return _0x1c11bf;});}return null;};}function removeEntity(_0x39c5f0,_0x15eda3){return function(_0x2e591b){if(_0x2e591b){return _0x2e591b[_0x7013('0x2e')]()['then'](function(){_0x39c5f0[_0x7013('0x21')](0xcc)[_0x7013('0x22')]();});}};}function handleEntityNotFound(_0x35d23f,_0x5b4562){return function(_0x15c3eb){if(!_0x15c3eb){_0x35d23f['sendStatus'](0x194);}return _0x15c3eb;};}function handleError(_0xedca92,_0x2c9daa){_0x2c9daa=_0x2c9daa||0x1f4;return function(_0x58a254){logger[_0x7013('0x2f')](_0x58a254['stack']);if(_0x58a254[_0x7013('0x30')]){delete _0x58a254[_0x7013('0x30')];}_0xedca92[_0x7013('0x21')](_0x2c9daa)['send'](_0x58a254);};}exports[_0x7013('0x31')]=function(_0x182958,_0x406322){var _0xe8090={},_0x5ef79c={},_0x44ab0b={'count':0x0,'rows':[]};var _0x4764df=_[_0x7013('0x32')](db[_0x7013('0x33')]['rawAttributes'],function(_0x520525){return{'name':_0x520525[_0x7013('0x34')],'type':_0x520525[_0x7013('0x35')]['key']};});_0x5ef79c[_0x7013('0x36')]=_[_0x7013('0x32')](_0x4764df,_0x7013('0x30'));_0x5ef79c[_0x7013('0x37')]=_[_0x7013('0x38')](_0x182958[_0x7013('0x37')]);_0x5ef79c['filters']=_['intersection'](_0x5ef79c[_0x7013('0x36')],_0x5ef79c[_0x7013('0x37')]);_0xe8090[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x5ef79c[_0x7013('0x36')],qs['fields'](_0x182958[_0x7013('0x37')]['fields']));_0xe8090['attributes']=_0xe8090['attributes']['length']?_0xe8090[_0x7013('0x39')]:_0x5ef79c['model'];if(!_0x182958[_0x7013('0x37')]['hasOwnProperty'](_0x7013('0x3b'))){_0xe8090[_0x7013('0x24')]=qs[_0x7013('0x24')](_0x182958['query'][_0x7013('0x24')]);_0xe8090[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x182958[_0x7013('0x37')][_0x7013('0x23')]);}_0xe8090[_0x7013('0x3c')]=qs[_0x7013('0x3d')](_0x182958[_0x7013('0x37')][_0x7013('0x3d')]);_0xe8090['where']=qs['filters'](_[_0x7013('0x3e')](_0x182958[_0x7013('0x37')],_0x5ef79c[_0x7013('0x3f')]),_0x4764df);if(_0x182958[_0x7013('0x37')]['filter']){_0xe8090['where']=_['merge'](_0xe8090['where'],{'$or':_['map'](_0x4764df,function(_0x28e17b){if(_0x28e17b['type']!==_0x7013('0x40')){var _0x56a178={};_0x56a178[_0x28e17b[_0x7013('0x30')]]={'$like':'%'+_0x182958[_0x7013('0x37')]['filter']+'%'};return _0x56a178;}})});}_0xe8090=_[_0x7013('0x41')]({},_0xe8090,_0x182958[_0x7013('0x42')]);var _0x2627a0={'where':_0xe8090[_0x7013('0x43')]};return db[_0x7013('0x33')][_0x7013('0x44')](_0x2627a0)[_0x7013('0x2d')](function(_0x3afd4a){_0x44ab0b[_0x7013('0x44')]=_0x3afd4a;if(_0x182958[_0x7013('0x37')]['includeAll']){_0xe8090['include']=[{'all':!![]}];}return db[_0x7013('0x33')][_0x7013('0x45')](_0xe8090);})[_0x7013('0x2d')](function(_0x3a9fec){_0x44ab0b[_0x7013('0x46')]=_0x3a9fec;return _0x44ab0b;})['then'](respondWithFilteredResult(_0x406322,_0xe8090))['catch'](handleError(_0x406322,null));};exports[_0x7013('0x47')]=function(_0x25f45a,_0xda2d3a){var _0x4a0e7a={'raw':![],'where':{'id':_0x25f45a[_0x7013('0x48')]['id']}},_0x327cc2={};_0x327cc2['model']=_[_0x7013('0x38')](db[_0x7013('0x33')]['rawAttributes']);_0x327cc2[_0x7013('0x37')]=_['keys'](_0x25f45a[_0x7013('0x37')]);_0x327cc2['filters']=_['intersection'](_0x327cc2[_0x7013('0x36')],_0x327cc2[_0x7013('0x37')]);_0x4a0e7a[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x327cc2[_0x7013('0x36')],qs[_0x7013('0x49')](_0x25f45a[_0x7013('0x37')][_0x7013('0x49')]));_0x4a0e7a[_0x7013('0x39')]=_0x4a0e7a['attributes']['length']?_0x4a0e7a[_0x7013('0x39')]:_0x327cc2[_0x7013('0x36')];if(_0x25f45a['query']['includeAll']){_0x4a0e7a[_0x7013('0x4a')]=[{'all':!![]}];}_0x4a0e7a=_['merge']({},_0x4a0e7a,_0x25f45a[_0x7013('0x42')]);return db['UserProfile'][_0x7013('0x4b')](_0x4a0e7a)[_0x7013('0x2d')](handleEntityNotFound(_0xda2d3a,null))[_0x7013('0x2d')](respondWithResult(_0xda2d3a,null))[_0x7013('0x4c')](handleError(_0xda2d3a,null));};exports[_0x7013('0x4d')]=function(_0x28f10c,_0x3c71fa){return db[_0x7013('0x33')][_0x7013('0x4d')](_0x28f10c['body'],{})['then'](respondWithResult(_0x3c71fa,0xc9))[_0x7013('0x4c')](handleError(_0x3c71fa,null));};exports[_0x7013('0x4e')]=function(_0xa1881a,_0x10cc12){var _0x128009={'where':{'id':_0xa1881a[_0x7013('0x48')]['id']}},_0x461a40={};_0x461a40[_0x7013('0x36')]=_['keys'](db[_0x7013('0x33')][_0x7013('0x4f')]);_0x128009['attributes']=_[_0x7013('0x3a')](_0x461a40[_0x7013('0x36')],qs[_0x7013('0x49')](_0xa1881a[_0x7013('0x37')][_0x7013('0x49')]));_0x128009['attributes']=_0x128009[_0x7013('0x39')][_0x7013('0x50')]?_0x128009['attributes']:_0x461a40[_0x7013('0x36')];if(_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]){_0x128009[_0x7013('0x4a')]=[{'all':!![]}];}_0x128009=_['merge']({},_0x128009,_0xa1881a[_0x7013('0x42')]);return db[_0x7013('0x33')]['find'](_0x128009)[_0x7013('0x2d')](handleEntityNotFound(_0x10cc12,null))['then'](function(_0x5195ae){if(_0x5195ae){var _0x425b06=_0x5195ae[_0x7013('0x52')]({'plain':!![]});_0x425b06=qs[_0x7013('0x53')](_0x425b06,['id',_0x7013('0x54'),_0x7013('0x55'),_0x7013('0x56')]);_0xa1881a[_0x7013('0x57')]=_[_0x7013('0x53')](_0xa1881a[_0x7013('0x57')],['id',_0x7013('0x54'),_0x7013('0x55')]);return db[_0x7013('0x58')][_0x7013('0x59')](function(_0x42cd12){return db[_0x7013('0x33')]['create'](_['merge'](_0x425b06,_0xa1881a['body']),{'include':_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]?[{'all':!![]}]:undefined,'transaction':_0x42cd12})[_0x7013('0x2d')](function(_0x44b678){var _0x2836a3=_0x44b678[_0x7013('0x52')]({'plain':!![]});return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0xa1881a[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x2ae1ea){if(_0x2ae1ea){return BPromise['each'](_0x2ae1ea,function(_0x5e7e43){return new BPromise(function(_0xe83ce9,_0x888890){if(_0x5e7e43[_0x7013('0x5b')]===null||_0x5e7e43[_0x7013('0x5b')]===0x1)_0xe83ce9(null);return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x5e7e43['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x31df3d){var _0x4a2239=_[_0x7013('0x32')](_0x31df3d,function(_0x395840){return qs[_0x7013('0x53')](_0x395840,['id',_0x7013('0x54'),_0x7013('0x55'),'sectionId']);});_0xe83ce9(_0x4a2239);})[_0x7013('0x4c')](function(_0x5498f7){_0x888890(_0x5498f7);});})[_0x7013('0x2d')](function(_0x3e08b3){var _0x394729=qs['omit'](_0x5e7e43,['id',_0x7013('0x54'),_0x7013('0x55')]);_0x394729[_0x7013('0x5d')]=_0x2836a3['id'];if(_0x3e08b3)_0x394729[_0x7013('0x5e')]=_0x3e08b3;return _0x394729;})[_0x7013('0x2d')](function(_0x42fa64){return db[_0x7013('0x5a')]['create'](_0x42fa64,{'include':[{'model':db[_0x7013('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x42cd12});});})[_0x7013('0x2d')](function(){return _0x2836a3;});}});});});}})[_0x7013('0x2d')](respondWithResult(_0x10cc12,0xc9))[_0x7013('0x4c')](handleError(_0x10cc12,null));};exports[_0x7013('0x2c')]=function(_0x57fb5b,_0x3ea42c){if(_0x57fb5b['body']['id']){delete _0x57fb5b['body']['id'];}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x57fb5b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ea42c,null))['then'](saveUpdates(_0x57fb5b[_0x7013('0x57')],null))['then'](respondWithResult(_0x3ea42c,null))['catch'](handleError(_0x3ea42c,null));};exports['destroy']=function(_0x4d0665,_0x4caa98){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4d0665[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x4caa98,null))[_0x7013('0x2d')](removeEntity(_0x4caa98,null))[_0x7013('0x4c')](handleError(_0x4caa98,null));};exports[_0x7013('0x5f')]=function(_0xcff2c7,_0x488caa){return db['UserProfile'][_0x7013('0x5f')]()[_0x7013('0x2d')](respondWithResult(_0x488caa,null))['catch'](handleError(_0x488caa,null));};exports[_0x7013('0x60')]=function(_0x4f85e8,_0x3ad0da){var _0x2dc245=_0x4f85e8[_0x7013('0x57')];return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4f85e8[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](handleEntityNotFound(_0x3ad0da,null))['then'](function(_0x312d71){if(_0x312d71){return db['sequelize'][_0x7013('0x59')](function(_0x20151d){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x4f85e8[_0x7013('0x48')]['id'],'sectionId':_['map'](_0x2dc245,function(_0x4056f4){return _0x4056f4['sectionId'];})},'transaction':_0x20151d})[_0x7013('0x2d')](function(){var _0x3a7eb6=_[_0x7013('0x32')](_0x2dc245,function(_0x27a034){_0x27a034[_0x7013('0x5d')]=_0x4f85e8['params']['id'];return _0x27a034;});var _0x53ec35=[];return BPromise['each'](_0x3a7eb6,function(_0x567a18){return db[_0x7013('0x5a')]['create'](_0x567a18,{'include':[{'model':db['UserProfileResource'],'as':_0x7013('0x5e')}],'raw':!![],'transaction':_0x20151d})['then'](function(_0x16fdc6){_0x53ec35[_0x7013('0x61')](_0x16fdc6[_0x7013('0x52')]({'plain':!![]}));});})['then'](function(){return _0x53ec35;});});});}})[_0x7013('0x2d')](function(_0x3b991d){return _0x3b991d;})[_0x7013('0x2d')](respondWithResult(_0x3ad0da,null))[_0x7013('0x4c')](handleError(_0x3ad0da,null));};exports[_0x7013('0x62')]=function(_0x36d4f8,_0x3a58d1){var _0x51df7c;return db[_0x7013('0x33')]['find']({'where':{'id':_0x36d4f8[_0x7013('0x48')]['id']},'attributes':['id',_0x7013('0x30')]})['then'](handleEntityNotFound(_0x3a58d1,null))['then'](function(_0x10184a){if(_0x10184a){_0x51df7c=_0x10184a;return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x36d4f8[_0x7013('0x48')]['id'],'sectionId':_0x36d4f8[_0x7013('0x37')][_0x7013('0x63')]}});}})[_0x7013('0x2d')](function(){return _0x51df7c;})[_0x7013('0x2d')](respondWithStatusCode(_0x3a58d1,null))['catch'](handleError(_0x3a58d1,null));};exports[_0x7013('0x64')]=function(_0x3b483b,_0xb89bf3){var _0x1d7aa6=[];var _0x3d01e7=[];return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x3b483b[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x413c9e){_0x1d7aa6=_['filter'](_0x413c9e,function(_0x29804e){return _0x29804e['enabled']===0x1||_[_0x7013('0x65')]([0x3eb,0x709],_0x29804e[_0x7013('0x66')]);});if(!_['isEmpty'](_0x1d7aa6)){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x36ec07){return _0x36ec07[_0x7013('0x66')];});}else{return;}})['then'](function(_0x582931){if(_0x582931)_0x3d01e7=_0x582931;if(_[_0x7013('0x65')](_0x3d01e7,0x64)){var _0x17c13b=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x64});return hasDefaultDashboard(_0x17c13b)[_0x7013('0x2d')](function(_0x30b0d9){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x20f13d){if(_0x20f13d[_0x7013('0x66')]===0x64){_0x20f13d[_0x7013('0x67')]=_0x30b0d9;}return _0x20f13d;});});}else{return;}})[_0x7013('0x2d')](function(_0x335e62){if(_0x335e62)_0x1d7aa6=_0x335e62;if(_[_0x7013('0x65')](_0x3d01e7,0x3eb)){var _0x3624ed=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x3eb});return getCustomDashboards(_0x3624ed)[_0x7013('0x2d')](function(_0x542aff){return _[_0x7013('0x32')](_0x1d7aa6,function(_0xcd460d){if(_0x3624ed[_0x7013('0x68')]){if(_0xcd460d[_0x7013('0x66')]===0x3eb){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}else{if(_0xcd460d[_0x7013('0x66')]===0x64){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}return _0xcd460d;});});}else{return;}})[_0x7013('0x2d')](function(_0x33e064){if(_0x33e064)_0x1d7aa6=_0x33e064;if(_['includes'](_0x3d01e7,0x709)){var _0x5c5715=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x709});return getPlugins(_0x5c5715)[_0x7013('0x2d')](function(_0x2d67b6){if(_0x5c5715['enabled']){return _['map'](_0x1d7aa6,function(_0x9887c2){if(_0x9887c2['sectionId']===0x709){_0x9887c2[_0x7013('0x67')]=_0x2d67b6;}return _0x9887c2;});}else{var _0x5ca440={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d67b6};var _0x351642=_[_0x7013('0x32')](_0x1d7aa6);_0x351642['push'](_0x5ca440);return _0x351642;}});}else{return;}})[_0x7013('0x2d')](function(_0xfb256){if(_0xfb256)_0x1d7aa6=_0xfb256;return _[_0x7013('0x69')](_0x1d7aa6,[_0x7013('0x68'),0x1]);})['then'](respondWithResult(_0xb89bf3,null))['catch'](handleError(_0xb89bf3,null));};function hasDefaultDashboard(_0x23566f){var _0x2e68a9=[0x65];return new BPromise(function(_0x12e071,_0x504860){try{if(_0x23566f[_0x7013('0x5b')]){_0x12e071(_0x2e68a9);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x23566f['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x36c309){_0x36c309?_0x12e071(_0x2e68a9):_0x12e071();});}}catch(_0x324335){_0x504860(_0x324335);}});}function getCustomDashboards(_0x124b7a){var _0x2f8790=[];return new BPromise(function(_0x5ae9da,_0x1ceb47){try{if(_0x124b7a[_0x7013('0x5b')]){return db[_0x7013('0x6a')][_0x7013('0x45')]({'raw':!![]})[_0x7013('0x2d')](function(_0x94f539){_0x94f539[_0x7013('0x6b')](function(_0x3b5c70){_0x2f8790['push'](_0x3b5c70['id']+0x1869f);});_0x5ae9da(_0x2f8790);});}else{return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x124b7a['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x8ce268){_0x8ce268['forEach'](function(_0x2fdba1){_0x2f8790[_0x7013('0x61')](_0x2fdba1[_0x7013('0x6c')]+0x1869f);});_0x5ae9da(_0x2f8790);});}}catch(_0x17dac2){_0x1ceb47(_0x17dac2);}});}function getPlugins(_0x150d07){var _0x159111=[];return new BPromise(function(_0x4ee653,_0x39f649){try{if(_0x150d07['autoAssociation']){return db[_0x7013('0x6d')][_0x7013('0x45')]({'raw':!![]})['then'](function(_0xbf39c8){_0xbf39c8['forEach'](function(_0x20676d){_0x159111[_0x7013('0x61')](_0x20676d['id']+0x15b38);});_0x4ee653(_0x159111);});}else{return db['UserProfileResource'][_0x7013('0x45')]({'where':{'sectionId':_0x150d07['id']},'raw':!![]})['then'](function(_0x310b53){_0x310b53['forEach'](function(_0x3a3aa6){_0x159111[_0x7013('0x61')](_0x3a3aa6[_0x7013('0x6c')]+0x15b38);});_0x4ee653(_0x159111);});}}catch(_0x14d179){_0x39f649(_0x14d179);}});}exports['addResources']=function(_0x126f5a,_0x152605){return db['UserProfile'][_0x7013('0x4b')]({'where':{'id':_0x126f5a[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x152605,null))[_0x7013('0x2d')](function(_0x31b468){if(_0x31b468){return db[_0x7013('0x58')][_0x7013('0x59')](function(_0xae7b6b){return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x216eab){if(_0x216eab){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'id':_['map'](_0x216eab,function(_0x3ded8e){return _0x3ded8e['id'];})},'transaction':_0xae7b6b});}})['then'](function(_0x279c64){var _0x43c155=_[_0x7013('0x32')](_0x126f5a['body'],function(_0x181c31){_0x181c31[_0x7013('0x5d')]=_0x126f5a['params']['id'];return _0x181c31;});return db[_0x7013('0x5a')][_0x7013('0x6e')](_0x43c155,{'raw':!![],'transaction':_0xae7b6b});})[_0x7013('0x2d')](function(_0x3ad702){var _0x3dd4db=_[_0x7013('0x69')](_[_0x7013('0x32')](_0x3ad702,function(_0x4a1002){return _0x4a1002[_0x7013('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3dd4db){return db['UserProfileSection'][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'sectionId':_[_0x7013('0x32')](_0x3dd4db,function(_0x54b03f){return _0x54b03f['sectionId'];})},'attributes':['id',_0x7013('0x66')],'raw':!![]})['then'](function(_0x20aa2c){var _0x3069ff=_[_0x7013('0x32')](_0x126f5a[_0x7013('0x57')],function(_0x4e33b2){_0x4e33b2['userProfileId']=_0x126f5a[_0x7013('0x48')]['id'];return _0x4e33b2;});return db[_0x7013('0x5c')]['bulkCreate'](_0x3069ff,{'raw':!![],'transaction':_0xae7b6b});});}})['catch'](handleError(_0x152605,null));});}})[_0x7013('0x2d')](function(_0x1af5ea){var _0x1dd404=_[_0x7013('0x32')](_0x1af5ea,function(_0x1ee9f4){return _0x1ee9f4[_0x7013('0x52')]({'plain':!![]});});})[_0x7013('0x2d')](respondWithResult(_0x152605,null))['catch'](handleError(_0x152605,null));};exports[_0x7013('0x6f')]=function(_0x4db20b,_0x98dc40,_0x1ef916){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4db20b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x98dc40,null))['then'](function(_0x35f41b){if(_0x35f41b){return _0x35f41b[_0x7013('0x6f')](_0x4db20b[_0x7013('0x37')][_0x7013('0x63')]);}})[_0x7013('0x2d')](respondWithStatusCode(_0x98dc40,null))[_0x7013('0x4c')](handleError(_0x98dc40,null));};exports['getResources']=function(_0x5e35b4,_0x47aab0){var _0x4042d5={};if(!_0x5e35b4['query']['section'])throw new Error(_0x7013('0x70'));if(!_0x5e35b4[_0x7013('0x37')][_0x7013('0x71')]('nolimit')){_0x4042d5[_0x7013('0x24')]=qs['limit'](_0x5e35b4['query']['limit']);_0x4042d5[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x5e35b4['query']['offset']);}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x5e35b4[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](function(_0x100644){if(!_0x100644)throw new Error(_0x7013('0x72')+_0x5e35b4[_0x7013('0x48')]['id']);return db[_0x7013('0x33')][_0x7013('0x73')](_0x5e35b4);})['then'](respondWithFilteredResult(_0x47aab0,_0x4042d5))['catch'](handleError(_0x47aab0,null));}; \ No newline at end of file +var _0x9672=['subsections','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','UserProfile','include','findAll','catch','includeAll','options','find','clone','params','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','create','each','autoAssociation','UserProfileResource','userProfileId','UserProfileSection','Resources','describe','addSections','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty'];(function(_0x77e7e8,_0x5a319f){var _0x205a3e=function(_0x2a0454){while(--_0x2a0454){_0x77e7e8['push'](_0x77e7e8['shift']());}};_0x205a3e(++_0x5a319f);}(_0x9672,0xee));var _0x2967=function(_0x40b239,_0x396afd){_0x40b239=_0x40b239-0x0;var _0x2f1f17=_0x9672[_0x40b239];return _0x2f1f17;};'use strict';var emlformat=require(_0x2967('0x0'));var rimraf=require(_0x2967('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2967('0x2'));var rp=require(_0x2967('0x3'));var moment=require(_0x2967('0x4'));var BPromise=require(_0x2967('0x5'));var Mustache=require('mustache');var util=require(_0x2967('0x6'));var path=require(_0x2967('0x7'));var sox=require(_0x2967('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2967('0x9'));var _=require(_0x2967('0xa'));var squel=require(_0x2967('0xb'));var crypto=require(_0x2967('0xc'));var jsforce=require(_0x2967('0xd'));var deskjs=require(_0x2967('0xe'));var toCsv=require(_0x2967('0xf'));var querystring=require(_0x2967('0x10'));var Papa=require('papaparse');var Redis=require(_0x2967('0x11'));var authService=require(_0x2967('0x12'));var qs=require(_0x2967('0x13'));var as=require(_0x2967('0x14'));var hardwareService=require(_0x2967('0x15'));var logger=require(_0x2967('0x16'))('api');var utils=require(_0x2967('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2967('0x18'));var db=require('../../mysqldb')['db'];config[_0x2967('0x19')]=_[_0x2967('0x1a')](config['redis'],{'host':_0x2967('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2967('0x19')]));require(_0x2967('0x1c'))[_0x2967('0x1d')](socket);function respondWithStatusCode(_0x52d5c0,_0x47ce2b){_0x47ce2b=_0x47ce2b||0xcc;return function(_0xa2e896){if(_0xa2e896){return _0x52d5c0[_0x2967('0x1e')](_0x47ce2b);}return _0x52d5c0[_0x2967('0x1f')](_0x47ce2b)['end']();};}function respondWithResult(_0x574a9f,_0x2fff79){_0x2fff79=_0x2fff79||0xc8;return function(_0x12910a){if(_0x12910a){return _0x574a9f[_0x2967('0x1f')](_0x2fff79)[_0x2967('0x20')](_0x12910a);}};}function respondWithFilteredResult(_0x50fbcb,_0x40520f){return function(_0x426fee){if(_0x426fee){var _0x8a7c84=typeof _0x40520f[_0x2967('0x21')]===_0x2967('0x22')&&typeof _0x40520f['limit']===_0x2967('0x22');var _0x449991=_0x426fee[_0x2967('0x23')];var _0x10ea93=_0x8a7c84?0x0:_0x40520f['offset'];var _0x321e36=_0x8a7c84?_0x426fee[_0x2967('0x23')]:_0x40520f[_0x2967('0x21')]+_0x40520f['limit'];var _0x5e0e26;if(_0x321e36>=_0x449991){_0x321e36=_0x449991;_0x5e0e26=0xc8;}else{_0x5e0e26=0xce;}_0x50fbcb[_0x2967('0x1f')](_0x5e0e26);return _0x50fbcb[_0x2967('0x24')](_0x2967('0x25'),_0x10ea93+'-'+_0x321e36+'/'+_0x449991)[_0x2967('0x20')](_0x426fee);}return null;};}function patchUpdates(_0x832a72){return function(_0x170d7d){try{jsonpatch[_0x2967('0x26')](_0x170d7d,_0x832a72,!![]);}catch(_0x3d1040){return BPromise[_0x2967('0x27')](_0x3d1040);}return _0x170d7d['save']();};}function saveUpdates(_0x436b45,_0x1fc3bd){return function(_0x3c47e2){if(_0x3c47e2){return _0x3c47e2[_0x2967('0x28')](_0x436b45)['then'](function(_0x42acb3){return _0x42acb3;});}return null;};}function removeEntity(_0x4327a5,_0x524ab1){return function(_0x153d63){if(_0x153d63){return _0x153d63[_0x2967('0x29')]()[_0x2967('0x2a')](function(){_0x4327a5[_0x2967('0x1f')](0xcc)[_0x2967('0x2b')]();});}};}function handleEntityNotFound(_0x36c1d9,_0x1a3d42){return function(_0x4e0603){if(!_0x4e0603){_0x36c1d9[_0x2967('0x1e')](0x194);}return _0x4e0603;};}function handleError(_0x2a0ad8,_0x1eefcb){_0x1eefcb=_0x1eefcb||0x1f4;return function(_0x57cee6){logger[_0x2967('0x2c')](_0x57cee6[_0x2967('0x2d')]);if(_0x57cee6[_0x2967('0x2e')]){delete _0x57cee6['name'];}_0x2a0ad8[_0x2967('0x1f')](_0x1eefcb)[_0x2967('0x2f')](_0x57cee6);};}exports['index']=function(_0x1ee7cb,_0x45c7fd){var _0xcf476e={},_0x506c4e={},_0xbb2094={'count':0x0,'rows':[]};var _0xa264c9=_[_0x2967('0x30')](db['UserProfile'][_0x2967('0x31')],function(_0x2589b1){return{'name':_0x2589b1[_0x2967('0x32')],'type':_0x2589b1[_0x2967('0x33')][_0x2967('0x34')]};});_0x506c4e[_0x2967('0x35')]=_[_0x2967('0x30')](_0xa264c9,_0x2967('0x2e'));_0x506c4e[_0x2967('0x36')]=_[_0x2967('0x37')](_0x1ee7cb[_0x2967('0x36')]);_0x506c4e[_0x2967('0x38')]=_[_0x2967('0x39')](_0x506c4e[_0x2967('0x35')],_0x506c4e[_0x2967('0x36')]);_0xcf476e[_0x2967('0x3a')]=_['intersection'](_0x506c4e['model'],qs[_0x2967('0x3b')](_0x1ee7cb[_0x2967('0x36')][_0x2967('0x3b')]));_0xcf476e[_0x2967('0x3a')]=_0xcf476e['attributes'][_0x2967('0x3c')]?_0xcf476e['attributes']:_0x506c4e[_0x2967('0x35')];if(!_0x1ee7cb[_0x2967('0x36')][_0x2967('0x3d')]('nolimit')){_0xcf476e[_0x2967('0x3e')]=qs['limit'](_0x1ee7cb[_0x2967('0x36')]['limit']);_0xcf476e[_0x2967('0x21')]=qs[_0x2967('0x21')](_0x1ee7cb['query'][_0x2967('0x21')]);}_0xcf476e[_0x2967('0x3f')]=qs[_0x2967('0x40')](_0x1ee7cb[_0x2967('0x36')][_0x2967('0x40')]);_0xcf476e[_0x2967('0x41')]=qs[_0x2967('0x38')](_[_0x2967('0x42')](_0x1ee7cb[_0x2967('0x36')],_0x506c4e[_0x2967('0x38')]),_0xa264c9);if(_0x1ee7cb[_0x2967('0x36')][_0x2967('0x43')]){_0xcf476e[_0x2967('0x41')]=_[_0x2967('0x44')](_0xcf476e[_0x2967('0x41')],{'$or':_[_0x2967('0x30')](_0xa264c9,function(_0x22d07e){if(_0x22d07e[_0x2967('0x33')]!==_0x2967('0x45')){var _0x27cdd8={};_0x27cdd8[_0x22d07e[_0x2967('0x2e')]]={'$like':'%'+_0x1ee7cb[_0x2967('0x36')][_0x2967('0x43')]+'%'};return _0x27cdd8;}})});}_0xcf476e=_[_0x2967('0x44')]({},_0xcf476e,_0x1ee7cb['options']);var _0x55b6a0={'where':_0xcf476e[_0x2967('0x41')]};return db[_0x2967('0x46')][_0x2967('0x23')](_0x55b6a0)[_0x2967('0x2a')](function(_0x3ce06d){_0xbb2094[_0x2967('0x23')]=_0x3ce06d;if(_0x1ee7cb['query']['includeAll']){_0xcf476e[_0x2967('0x47')]=[{'all':!![]}];}return db['UserProfile'][_0x2967('0x48')](_0xcf476e);})[_0x2967('0x2a')](function(_0x31a35f){_0xbb2094['rows']=_0x31a35f;return _0xbb2094;})[_0x2967('0x2a')](respondWithFilteredResult(_0x45c7fd,_0xcf476e))[_0x2967('0x49')](handleError(_0x45c7fd,null));};exports['show']=function(_0x58d864,_0x22aa97){var _0xf7e5a5={'raw':![],'where':{'id':_0x58d864['params']['id']}},_0x14be71={};_0x14be71[_0x2967('0x35')]=_[_0x2967('0x37')](db[_0x2967('0x46')][_0x2967('0x31')]);_0x14be71['query']=_['keys'](_0x58d864[_0x2967('0x36')]);_0x14be71['filters']=_[_0x2967('0x39')](_0x14be71['model'],_0x14be71['query']);_0xf7e5a5[_0x2967('0x3a')]=_[_0x2967('0x39')](_0x14be71['model'],qs[_0x2967('0x3b')](_0x58d864[_0x2967('0x36')]['fields']));_0xf7e5a5[_0x2967('0x3a')]=_0xf7e5a5[_0x2967('0x3a')][_0x2967('0x3c')]?_0xf7e5a5['attributes']:_0x14be71[_0x2967('0x35')];if(_0x58d864['query'][_0x2967('0x4a')]){_0xf7e5a5[_0x2967('0x47')]=[{'all':!![]}];}_0xf7e5a5=_[_0x2967('0x44')]({},_0xf7e5a5,_0x58d864[_0x2967('0x4b')]);return db[_0x2967('0x46')][_0x2967('0x4c')](_0xf7e5a5)['then'](handleEntityNotFound(_0x22aa97,null))[_0x2967('0x2a')](respondWithResult(_0x22aa97,null))[_0x2967('0x49')](handleError(_0x22aa97,null));};exports['create']=function(_0x369128,_0x27bbac){return db['UserProfile']['create'](_0x369128['body'],{})['then'](respondWithResult(_0x27bbac,0xc9))[_0x2967('0x49')](handleError(_0x27bbac,null));};exports[_0x2967('0x4d')]=function(_0x5306e5,_0x5408ed){var _0x4254d7={'where':{'id':_0x5306e5[_0x2967('0x4e')]['id']}},_0x473cab={};_0x473cab[_0x2967('0x35')]=_[_0x2967('0x37')](db['UserProfile']['rawAttributes']);_0x4254d7[_0x2967('0x3a')]=_[_0x2967('0x39')](_0x473cab['model'],qs['fields'](_0x5306e5[_0x2967('0x36')]['fields']));_0x4254d7[_0x2967('0x3a')]=_0x4254d7[_0x2967('0x3a')]['length']?_0x4254d7[_0x2967('0x3a')]:_0x473cab['model'];if(_0x5306e5[_0x2967('0x36')][_0x2967('0x4a')]){_0x4254d7[_0x2967('0x47')]=[{'all':!![]}];}_0x4254d7=_[_0x2967('0x44')]({},_0x4254d7,_0x5306e5[_0x2967('0x4b')]);return db[_0x2967('0x46')][_0x2967('0x4c')](_0x4254d7)[_0x2967('0x2a')](handleEntityNotFound(_0x5408ed,null))[_0x2967('0x2a')](function(_0x5f52c0){if(_0x5f52c0){var _0xd7a109=_0x5f52c0[_0x2967('0x4f')]({'plain':!![]});_0xd7a109=qs[_0x2967('0x50')](_0xd7a109,['id',_0x2967('0x51'),_0x2967('0x52'),_0x2967('0x53')]);_0x5306e5['body']=_[_0x2967('0x50')](_0x5306e5[_0x2967('0x54')],['id',_0x2967('0x51'),_0x2967('0x52')]);return db[_0x2967('0x55')][_0x2967('0x56')](function(_0x55cec0){return db[_0x2967('0x46')][_0x2967('0x57')](_['merge'](_0xd7a109,_0x5306e5[_0x2967('0x54')]),{'include':_0x5306e5[_0x2967('0x36')][_0x2967('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x55cec0})[_0x2967('0x2a')](function(_0x28a4b9){var _0x29eb9d=_0x28a4b9['get']({'plain':!![]});return db['UserProfileSection'][_0x2967('0x48')]({'where':{'userProfileId':_0x5306e5[_0x2967('0x4e')]['id']},'raw':!![]})[_0x2967('0x2a')](function(_0x5c0d3a){if(_0x5c0d3a){return BPromise[_0x2967('0x58')](_0x5c0d3a,function(_0x3ea97c){return new BPromise(function(_0x40d8ff,_0x3da0f9){if(_0x3ea97c[_0x2967('0x59')]===null||_0x3ea97c[_0x2967('0x59')]===0x1)_0x40d8ff(null);return db[_0x2967('0x5a')]['findAll']({'where':{'sectionId':_0x3ea97c['id']},'raw':!![]})[_0x2967('0x2a')](function(_0x1649a6){var _0x3ea771=_[_0x2967('0x30')](_0x1649a6,function(_0x4c1ca1){return qs[_0x2967('0x50')](_0x4c1ca1,['id',_0x2967('0x51'),_0x2967('0x52'),'sectionId']);});_0x40d8ff(_0x3ea771);})[_0x2967('0x49')](function(_0x37d08b){_0x3da0f9(_0x37d08b);});})[_0x2967('0x2a')](function(_0x471e09){var _0x2999a4=qs[_0x2967('0x50')](_0x3ea97c,['id',_0x2967('0x51'),_0x2967('0x52')]);_0x2999a4[_0x2967('0x5b')]=_0x29eb9d['id'];if(_0x471e09)_0x2999a4['Resources']=_0x471e09;return _0x2999a4;})['then'](function(_0x5338d0){return db[_0x2967('0x5c')][_0x2967('0x57')](_0x5338d0,{'include':[{'model':db['UserProfileResource'],'as':_0x2967('0x5d')}],'raw':!![],'transaction':_0x55cec0});});})[_0x2967('0x2a')](function(){return _0x29eb9d;});}});});});}})[_0x2967('0x2a')](respondWithResult(_0x5408ed,0xc9))[_0x2967('0x49')](handleError(_0x5408ed,null));};exports[_0x2967('0x28')]=function(_0x35ee98,_0x90265d){if(_0x35ee98['body']['id']){delete _0x35ee98[_0x2967('0x54')]['id'];}return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0x35ee98[_0x2967('0x4e')]['id']}})[_0x2967('0x2a')](handleEntityNotFound(_0x90265d,null))[_0x2967('0x2a')](saveUpdates(_0x35ee98[_0x2967('0x54')],null))[_0x2967('0x2a')](respondWithResult(_0x90265d,null))['catch'](handleError(_0x90265d,null));};exports[_0x2967('0x29')]=function(_0x18bc64,_0x5bbdea){return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0x18bc64['params']['id']}})['then'](handleEntityNotFound(_0x5bbdea,null))[_0x2967('0x2a')](removeEntity(_0x5bbdea,null))[_0x2967('0x49')](handleError(_0x5bbdea,null));};exports['describe']=function(_0x8c878,_0x1bdeb1){return db[_0x2967('0x46')][_0x2967('0x5e')]()[_0x2967('0x2a')](respondWithResult(_0x1bdeb1,null))['catch'](handleError(_0x1bdeb1,null));};exports[_0x2967('0x5f')]=function(_0x40dd82,_0x183cc5){var _0x3285e6=_0x40dd82['body'];return db[_0x2967('0x46')]['find']({'where':{'id':_0x40dd82[_0x2967('0x4e')]['id']}})[_0x2967('0x2a')](handleEntityNotFound(_0x183cc5,null))[_0x2967('0x2a')](function(_0x4acf9b){if(_0x4acf9b){return db['sequelize'][_0x2967('0x56')](function(_0x32bedf){return db[_0x2967('0x5c')][_0x2967('0x29')]({'where':{'userProfileId':_0x40dd82[_0x2967('0x4e')]['id'],'sectionId':_[_0x2967('0x30')](_0x3285e6,function(_0x5c9707){return _0x5c9707[_0x2967('0x60')];})},'transaction':_0x32bedf})['then'](function(){var _0x398e96=_['map'](_0x3285e6,function(_0x8c54b4){_0x8c54b4['userProfileId']=_0x40dd82[_0x2967('0x4e')]['id'];return _0x8c54b4;});var _0x4dac09=[];return BPromise[_0x2967('0x58')](_0x398e96,function(_0x491b63){return db['UserProfileSection'][_0x2967('0x57')](_0x491b63,{'include':[{'model':db[_0x2967('0x5a')],'as':_0x2967('0x5d')}],'raw':!![],'transaction':_0x32bedf})['then'](function(_0x1ea072){_0x4dac09[_0x2967('0x61')](_0x1ea072[_0x2967('0x4f')]({'plain':!![]}));});})['then'](function(){return _0x4dac09;});});});}})['then'](function(_0x318f95){return _0x318f95;})[_0x2967('0x2a')](respondWithResult(_0x183cc5,null))[_0x2967('0x49')](handleError(_0x183cc5,null));};exports[_0x2967('0x62')]=function(_0xc4f1cd,_0x1d1413){var _0x2e2a46;return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0xc4f1cd['params']['id']},'attributes':['id',_0x2967('0x2e')]})[_0x2967('0x2a')](handleEntityNotFound(_0x1d1413,null))[_0x2967('0x2a')](function(_0x2b29ec){if(_0x2b29ec){_0x2e2a46=_0x2b29ec;return db['UserProfileSection'][_0x2967('0x29')]({'where':{'userProfileId':_0xc4f1cd['params']['id'],'sectionId':_0xc4f1cd[_0x2967('0x36')][_0x2967('0x63')]}});}})[_0x2967('0x2a')](function(){return _0x2e2a46;})['then'](respondWithStatusCode(_0x1d1413,null))[_0x2967('0x49')](handleError(_0x1d1413,null));};exports[_0x2967('0x64')]=function(_0x2bb0fe,_0x38a8ec){var _0x4c5ad9=[];var _0x1d6500=[];return db[_0x2967('0x5c')][_0x2967('0x48')]({'where':{'userProfileId':_0x2bb0fe['params']['id']},'raw':!![]})['then'](function(_0x35d7d3){_0x4c5ad9=_[_0x2967('0x43')](_0x35d7d3,function(_0xc8e345){return _0xc8e345[_0x2967('0x65')]===0x1||_[_0x2967('0x66')]([0x3eb,0x709],_0xc8e345[_0x2967('0x60')]);});if(!_[_0x2967('0x67')](_0x4c5ad9)){return _['map'](_0x4c5ad9,function(_0x3da43c){return _0x3da43c['sectionId'];});}else{return;}})['then'](function(_0xddfdc9){if(_0xddfdc9)_0x1d6500=_0xddfdc9;if(_[_0x2967('0x66')](_0x1d6500,0x64)){var _0x2b8fc3=_[_0x2967('0x4c')](_0x4c5ad9,{'sectionId':0x64});return hasDefaultDashboard(_0x2b8fc3)[_0x2967('0x2a')](function(_0x21ec90){return _[_0x2967('0x30')](_0x4c5ad9,function(_0x29dd35){if(_0x29dd35[_0x2967('0x60')]===0x64){_0x29dd35['subsections']=_0x21ec90;}return _0x29dd35;});});}else{return;}})['then'](function(_0x5a3cc5){if(_0x5a3cc5)_0x4c5ad9=_0x5a3cc5;if(_[_0x2967('0x66')](_0x1d6500,0x3eb)){var _0x3ba641=_[_0x2967('0x4c')](_0x4c5ad9,{'sectionId':0x3eb});return getCustomDashboards(_0x3ba641)[_0x2967('0x2a')](function(_0x4d5011){return _[_0x2967('0x30')](_0x4c5ad9,function(_0x924fa){if(_0x3ba641[_0x2967('0x65')]){if(_0x924fa[_0x2967('0x60')]===0x3eb){_0x924fa[_0x2967('0x68')]=_0x4d5011;}}else{if(_0x924fa[_0x2967('0x60')]===0x64){_0x924fa[_0x2967('0x68')]=_0x4d5011;}}return _0x924fa;});});}else{return;}})[_0x2967('0x2a')](function(_0x457c1b){if(_0x457c1b)_0x4c5ad9=_0x457c1b;if(_[_0x2967('0x66')](_0x1d6500,0x709)){var _0xf31ab7=_[_0x2967('0x4c')](_0x4c5ad9,{'sectionId':0x709});return getPlugins(_0xf31ab7)['then'](function(_0x17c6e8){if(_0xf31ab7[_0x2967('0x65')]){return _['map'](_0x4c5ad9,function(_0x1468a3){if(_0x1468a3['sectionId']===0x709){_0x1468a3[_0x2967('0x68')]=_0x17c6e8;}return _0x1468a3;});}else{var _0x4ef91c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x17c6e8};var _0x238322=_[_0x2967('0x30')](_0x4c5ad9);_0x238322[_0x2967('0x61')](_0x4ef91c);return _0x238322;}});}else{return;}})[_0x2967('0x2a')](function(_0x416c6c){if(_0x416c6c)_0x4c5ad9=_0x416c6c;return _[_0x2967('0x43')](_0x4c5ad9,[_0x2967('0x65'),0x1]);})[_0x2967('0x2a')](respondWithResult(_0x38a8ec,null))[_0x2967('0x49')](handleError(_0x38a8ec,null));};function hasDefaultDashboard(_0x283d73){var _0x5f12b2=[0x65];return new BPromise(function(_0x3f1530,_0x350b98){try{if(_0x283d73[_0x2967('0x59')]){_0x3f1530(_0x5f12b2);}else{return db[_0x2967('0x5a')]['findOne']({'where':{'sectionId':_0x283d73['id']},'raw':!![]})[_0x2967('0x2a')](function(_0x479d42){_0x479d42?_0x3f1530(_0x5f12b2):_0x3f1530();});}}catch(_0xfd266a){_0x350b98(_0xfd266a);}});}function getCustomDashboards(_0xb0f3ab){var _0x58b40b=[];return new BPromise(function(_0x40575b,_0x7fb6da){try{if(_0xb0f3ab['autoAssociation']){return db['Dashboard']['findAll']({'raw':!![]})[_0x2967('0x2a')](function(_0x2faace){_0x2faace[_0x2967('0x69')](function(_0x2b6059){_0x58b40b['push'](_0x2b6059['id']+0x1869f);});_0x40575b(_0x58b40b);});}else{return db['UserProfileResource'][_0x2967('0x48')]({'where':{'sectionId':_0xb0f3ab['id']},'raw':!![]})[_0x2967('0x2a')](function(_0x48263b){_0x48263b[_0x2967('0x69')](function(_0x9aa41f){_0x58b40b[_0x2967('0x61')](_0x9aa41f['resourceId']+0x1869f);});_0x40575b(_0x58b40b);});}}catch(_0xa34c10){_0x7fb6da(_0xa34c10);}});}function getPlugins(_0x3cc3b2){var _0x1c9678=[];return new BPromise(function(_0x23445,_0x35fcd3){try{if(_0x3cc3b2[_0x2967('0x59')]){return db[_0x2967('0x6a')]['findAll']({'raw':!![]})['then'](function(_0x553ed6){_0x553ed6[_0x2967('0x69')](function(_0x1c8fbb){_0x1c9678[_0x2967('0x61')](_0x1c8fbb['id']+0x15b38);});_0x23445(_0x1c9678);});}else{return db[_0x2967('0x5a')][_0x2967('0x48')]({'where':{'sectionId':_0x3cc3b2['id']},'raw':!![]})['then'](function(_0xe20a09){_0xe20a09[_0x2967('0x69')](function(_0x34210f){_0x1c9678[_0x2967('0x61')](_0x34210f['resourceId']+0x15b38);});_0x23445(_0x1c9678);});}}catch(_0xec4aac){_0x35fcd3(_0xec4aac);}});}exports[_0x2967('0x6b')]=function(_0x53c641,_0x271ed7){return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0x53c641[_0x2967('0x4e')]['id']}})[_0x2967('0x2a')](handleEntityNotFound(_0x271ed7,null))['then'](function(_0x458bcb){if(_0x458bcb){return db['sequelize'][_0x2967('0x56')](function(_0xe551ca){return db[_0x2967('0x5c')][_0x2967('0x48')]({'where':{'userProfileId':_0x53c641[_0x2967('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x2967('0x2a')](function(_0x59c44a){if(_0x59c44a){return db[_0x2967('0x5c')][_0x2967('0x29')]({'where':{'userProfileId':_0x53c641[_0x2967('0x4e')]['id'],'id':_[_0x2967('0x30')](_0x59c44a,function(_0x328d63){return _0x328d63['id'];})},'transaction':_0xe551ca});}})['then'](function(_0x5b33ec){var _0x3d2856=_[_0x2967('0x30')](_0x53c641[_0x2967('0x54')],function(_0x524761){_0x524761[_0x2967('0x5b')]=_0x53c641[_0x2967('0x4e')]['id'];return _0x524761;});return db[_0x2967('0x5c')][_0x2967('0x6c')](_0x3d2856,{'raw':!![],'transaction':_0xe551ca});})[_0x2967('0x2a')](function(_0x572d2e){var _0x404755=_[_0x2967('0x43')](_[_0x2967('0x30')](_0x572d2e,function(_0x2bb85b){return _0x2bb85b[_0x2967('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x404755){return db[_0x2967('0x5c')][_0x2967('0x48')]({'where':{'userProfileId':_0x53c641[_0x2967('0x4e')]['id'],'sectionId':_[_0x2967('0x30')](_0x404755,function(_0x51af3d){return _0x51af3d[_0x2967('0x60')];})},'attributes':['id',_0x2967('0x60')],'raw':!![]})['then'](function(_0x41a9e2){var _0x3bb066=_['map'](_0x53c641['body'],function(_0x54bdc6){_0x54bdc6[_0x2967('0x5b')]=_0x53c641['params']['id'];return _0x54bdc6;});return db[_0x2967('0x5a')][_0x2967('0x6c')](_0x3bb066,{'raw':!![],'transaction':_0xe551ca});});}})[_0x2967('0x49')](handleError(_0x271ed7,null));});}})[_0x2967('0x2a')](function(_0x46a6d1){var _0x150cbf=_['map'](_0x46a6d1,function(_0x47d3f7){return _0x47d3f7[_0x2967('0x4f')]({'plain':!![]});});})[_0x2967('0x2a')](respondWithResult(_0x271ed7,null))[_0x2967('0x49')](handleError(_0x271ed7,null));};exports[_0x2967('0x6d')]=function(_0x3b87bc,_0x5770ca,_0x354487){return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0x3b87bc[_0x2967('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5770ca,null))[_0x2967('0x2a')](function(_0x3be433){if(_0x3be433){return _0x3be433[_0x2967('0x6d')](_0x3b87bc[_0x2967('0x36')]['ids']);}})[_0x2967('0x2a')](respondWithStatusCode(_0x5770ca,null))['catch'](handleError(_0x5770ca,null));};exports[_0x2967('0x6e')]=function(_0x1a69f1,_0x5233dc){var _0x882af1={};if(!_0x1a69f1[_0x2967('0x36')][_0x2967('0x6f')])throw new Error('Missing\x20section\x20parameter');if(!_0x1a69f1[_0x2967('0x36')][_0x2967('0x3d')](_0x2967('0x70'))){_0x882af1[_0x2967('0x3e')]=qs[_0x2967('0x3e')](_0x1a69f1[_0x2967('0x36')][_0x2967('0x3e')]);_0x882af1[_0x2967('0x21')]=qs[_0x2967('0x21')](_0x1a69f1[_0x2967('0x36')][_0x2967('0x21')]);}return db[_0x2967('0x46')][_0x2967('0x4c')]({'where':{'id':_0x1a69f1['params']['id']}})[_0x2967('0x2a')](function(_0x224f7d){if(!_0x224f7d)throw new Error(_0x2967('0x71')+_0x1a69f1['params']['id']);return db[_0x2967('0x46')][_0x2967('0x6e')](_0x1a69f1);})[_0x2967('0x2a')](respondWithFilteredResult(_0x5233dc,_0x882af1))[_0x2967('0x49')](handleError(_0x5233dc,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index eb44e82..5896f86 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f83=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','save'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x6f83,0x72));var _0x36f8=function(_0x18539a,_0x23ebea){_0x18539a=_0x18539a-0x0;var _0x4b8e37=_0x6f83[_0x18539a];return _0x4b8e37;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x36f8('0x0'))['db'][_0x36f8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x36f8('0x2'),'afterUpdate':_0x36f8('0x3'),'afterDestroy':_0x36f8('0x4')};function emitEvent(_0x442b8b){return function(_0x456795,_0xf53947,_0x9ed336){UserProfileEvents[_0x36f8('0x5')](_0x442b8b+':'+_0x456795['id'],_0x456795);UserProfileEvents[_0x36f8('0x5')](_0x442b8b,_0x456795);_0x9ed336(null);};}for(var e in events){if(events[_0x36f8('0x6')](e)){var event=events[e];UserProfile[_0x36f8('0x7')](e,emitEvent(event));}}module[_0x36f8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x8579=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8579,0x16c));var _0x9857=function(_0x427397,_0x3ecf8b){_0x427397=_0x427397-0x0;var _0x35e9d9=_0x8579[_0x427397];return _0x35e9d9;};'use strict';var EventEmitter=require(_0x9857('0x0'));var UserProfile=require(_0x9857('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x9857('0x2')](0x0);var events={'afterCreate':_0x9857('0x3'),'afterUpdate':_0x9857('0x4'),'afterDestroy':_0x9857('0x5')};function emitEvent(_0x48bc70){return function(_0x48dd34,_0x5ae8ce,_0x4910ae){UserProfileEvents[_0x9857('0x6')](_0x48bc70+':'+_0x48dd34['id'],_0x48dd34);UserProfileEvents[_0x9857('0x6')](_0x48bc70,_0x48dd34);_0x4910ae(null);};}for(var e in events){if(events[_0x9857('0x7')](e)){var event=events[e];UserProfile[_0x9857('0x8')](e,emitEvent(event));}}module[_0x9857('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 73e1ada..2cb4b5b 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['CustomReports','count','rows','ids','include','Tags','color','tag','ThroughTags','true','chat','dataValues','sms','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','catch','resolve','UserProfileResource','resourceId','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','name','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','user','ZendeskAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','foreignKey','includeAll','forEach','reportType','default','reportId','custom'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x1967,0x173));var _0x7196=function(_0x2c1271,_0x4ecb54){_0x2c1271=_0x2c1271-0x0;var _0x47ae44=_0x1967[_0x2c1271];return _0x47ae44;};'use strict';var _=require('lodash');var attributes=require(_0x7196('0x0'));var qs=require(_0x7196('0x1'));var squel=require(_0x7196('0x2'));module[_0x7196('0x3')]=function(_0x3319fa){var _0xa80a3f=_0x3319fa[_0x7196('0x4')];function _0x1aaddd(_0x458ae8,_0x3ae43f){return new Promise(function(_0x5c128f,_0x36b01e){if(!_0x3ae43f)return _0x5c128f(null);var _0x186175=_0x3ae43f[_0x7196('0x5')]?{[_0x3ae43f[_0x7196('0x5')][_0x7196('0x6')]]:_0x3ae43f[_0x7196('0x5')]['value']}:undefined;return _0xa80a3f[_0x458ae8][_0x7196('0x7')]({'where':_0x186175,'raw':!![]})[_0x7196('0x8')](function(_0x3f846e){_0x3ae43f[_0x7196('0x9')]=_[_0x7196('0xa')](_0x3f846e,'id');_0x5c128f(_0x3ae43f);})['catch'](function(_0x49e5fb){_0x36b01e(_0x49e5fb);});});}function _0x2028dd(_0x10459b,_0x97bbff){return new Promise(function(_0x107759,_0x25b780){var _0x46f26c=_0x10459b[_0x7196('0x5')]?{[_0x10459b[_0x7196('0x5')][_0x7196('0x6')]]:_0x10459b[_0x7196('0x5')][_0x7196('0xb')]}:undefined;return _0xa80a3f[_0x10459b['model']][_0x7196('0x7')]({'where':_0x46f26c,'raw':!![]})[_0x7196('0x8')](function(_0x3545aa){_0x97bbff[_0x7196('0x9')]=_['map'](_0x3545aa,function(_0x31c778){return _0x31c778['name'];});_0x107759(_0x97bbff);})[_0x7196('0xc')](function(_0x2590a6){_0x25b780(_0x2590a6);});});}function _0xf7e97(_0x3ed1ad,_0x12dce7,_0x2e3e0e){if(!_0x12dce7)return Promise[_0x7196('0xd')](null);return new Promise(function(_0x1ed296,_0x3e4e69){return _0xa80a3f[_0x7196('0xe')][_0x7196('0x7')]({'where':{'sectionId':_0x12dce7['id']},'raw':!![]})['then'](function(_0x4c4f91){if(_0x3ed1ad[_0x7196('0x6')]&&_0x3ed1ad[_0x7196('0x6')]!=='id'){_0x12dce7[_0x7196('0x9')]=_['map'](_0x4c4f91,function(_0x39b944){return _0x39b944[_0x3ed1ad['field']];});}else{if(_0x2e3e0e==='AnalyticExtractedReport'){_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x8dee9d){return{'id':_0x8dee9d['resourceId'],'type':_0x8dee9d['type']};});}else{_0x12dce7[_0x7196('0x9')]=_[_0x7196('0xa')](_0x4c4f91,function(_0x598a26){return _0x598a26[_0x7196('0xf')];});}}_0x1ed296(_0x12dce7);})[_0x7196('0xc')](function(_0x6e22e5){_0x3e4e69(_0x6e22e5);});});}function _0x18d389(_0x38b3d6,_0x549f34){var _0x3f8178={'parentSections':[]};switch(_0x38b3d6['toLowerCase']()){case _0x7196('0x10'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x12');break;case _0x7196('0x13'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x14');break;case'squarerecordings':_0x3f8178['childModel']=_0x7196('0x15');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x17'),'field':'name','foreignKey':'projectName'}];break;case _0x7196('0x18'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x19');break;case'contacts':_0x3f8178[_0x7196('0x11')]='CmContact';_0x3f8178[_0x7196('0x16')]=[{'name':'Lists','field':'id','foreignKey':_0x7196('0x1a')}];break;case _0x7196('0x1b'):_0x3f8178[_0x7196('0x11')]='CmList';break;case _0x7196('0x1c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x1d');break;case _0x7196('0x1e'):_0x3f8178['childModel']=_0x7196('0x1f');break;case _0x7196('0x20'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x21');break;case _0x7196('0x22'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x23');break;case _0x7196('0x24'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x25');break;case _0x7196('0x26'):_0x3f8178['childModel']=_0x7196('0x27');break;case'inboundroutes':case _0x7196('0x28'):case'outboundroutes':_0x3f8178[_0x7196('0x11')]=_0x7196('0x29');break;case'contexts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2a');break;case _0x7196('0x2b'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x2c');break;case'voicerecordings':_0x3f8178[_0x7196('0x11')]=_0x7196('0x2d');_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x2e'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x30'),'model':'User','filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x32')]}},{'name':_0x7196('0x33'),'field':'name','foreignKey':_0x7196('0x30'),'model':_0x7196('0x34'),'filter':{'field':_0x7196('0x31'),'value':[_0x7196('0x35')]}},{'name':_0x7196('0x36'),'field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':_0x7196('0x38'),'filter':{'field':_0x7196('0x39'),'value':[_0x7196('0x3a')]}},{'name':'QueueCampaigns','field':_0x7196('0x2f'),'foreignKey':_0x7196('0x37'),'model':'VoiceQueue','filter':{'field':_0x7196('0x39'),'value':['outbound']}}];break;case'musiconholds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x3b');break;case'chanspies':_0x3f8178['childModel']=_0x7196('0x3c');break;case _0x7196('0x3d'):_0x3f8178[_0x7196('0x11')]='VoicePrefix';break;case _0x7196('0x3e'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x3f');break;case _0x7196('0x40'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x41');break;case _0x7196('0x42'):_0x3f8178[_0x7196('0x11')]='MailAccount';break;case _0x7196('0x43'):_0x3f8178[_0x7196('0x11')]='MailSubstatus';break;case _0x7196('0x44'):_0x3f8178[_0x7196('0x11')]='OpenchannelQueue';break;case _0x7196('0x45'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x46');break;case'smsqueues':_0x3f8178[_0x7196('0x11')]=_0x7196('0x47');break;case'smsaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x48');break;case'whatsappqueues':_0x3f8178[_0x7196('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x3f8178['childModel']='WhatsappAccount';break;case'teams':_0x3f8178[_0x7196('0x11')]='Team';break;case _0x7196('0x49'):case _0x7196('0x4a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x38');if(_0x549f34){_0x3f8178['parentSections']=[{'name':_0x7196('0x36')},{'name':'QueueCampaigns'}];}break;case _0x7196('0x4b'):case _0x7196('0x4c'):case _0x7196('0x4d'):_0x3f8178['childModel']=_0x7196('0x34');if(_0x549f34){_0x3f8178[_0x7196('0x16')]=[{'name':_0x7196('0x4e'),'filter':{'field':'role','value':['admin',_0x7196('0x4f')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7196('0x33')}];}break;case'zendeskaccounts':_0x3f8178['childModel']=_0x7196('0x50');break;case'salesforceaccounts':_0x3f8178['childModel']='SalesforceAccount';break;case _0x7196('0x51'):_0x3f8178['childModel']='FreshdeskAccount';break;case _0x7196('0x52'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x53');break;case _0x7196('0x54'):_0x3f8178['childModel']=_0x7196('0x55');break;case'zohoaccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x56');break;case'vtigeraccounts':_0x3f8178[_0x7196('0x11')]=_0x7196('0x34');break;case _0x7196('0x57'):_0x3f8178['childModel']=_0x7196('0x58');break;case'dispositions':_0x3f8178[_0x7196('0x11')]=_0x7196('0x59');break;case _0x7196('0x5a'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5b');break;case _0x7196('0x5c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x5d');break;case'pauses':_0x3f8178['childModel']=_0x7196('0x5e');break;case _0x7196('0x5f'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x60');break;case'sounds':_0x3f8178[_0x7196('0x11')]=_0x7196('0x61');break;case _0x7196('0x62'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x63');break;case _0x7196('0x64'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x65');break;case _0x7196('0x66'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x67');break;case'trunks':_0x3f8178[_0x7196('0x11')]=_0x7196('0x68');break;case _0x7196('0x69'):_0x3f8178['childModel']=_0x7196('0x6a');break;case'plugins':_0x3f8178[_0x7196('0x11')]=_0x7196('0x6b');break;case _0x7196('0x6c'):_0x3f8178[_0x7196('0x11')]=_0x7196('0x6d');_0x3f8178['parentSections']=[{'name':_0x7196('0x6e'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x3f8178['childModel']=_0x7196('0x6f');break;}return _0x3f8178;}function _0x3be180(_0x20d306,_0x35f342){var _0x105a3f=_0x20d306[_0x7196('0x70')](0x0)[_0x7196('0x71')]()+_0x20d306['slice'](0x1);var _0x293467={'type':_0xa80a3f[_0x7196('0x72')][_0x7196('0x73')][_0x7196('0x74')],'raw':!![]};return new Promise(function(_0x196f12,_0x5ef1eb){var _0x49282d=squel[_0x7196('0x75')]()[_0x7196('0x6')](_0x7196('0x76')+_0x105a3f+_0x7196('0x77'),'id')[_0x7196('0x6')](_0x7196('0x78'))[_0x7196('0x79')](_0x7196('0x7a')+_0x20d306+_0x7196('0x7b'),'ui')[_0x7196('0x7c')](_0x7196('0x7d'),_0x35f342['id']);return _0xa80a3f['sequelize'][_0x7196('0x7e')](_0x49282d[_0x7196('0x7f')](),_0x293467)[_0x7196('0x8')](function(_0x33f43b){_0x35f342[_0x105a3f+'OpenTabs']=_0x33f43b;_0x196f12(_0x33f43b);})[_0x7196('0xc')](function(_0x204c3a){_0x5ef1eb(_0x204c3a);});});}return _0x3319fa[_0x7196('0x80')](_0x7196('0x81'),attributes,{'tableName':_0x7196('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3c3d64){var _0x1d9e75={'raw':_0x3c3d64['query'][_0x7196('0x83')],'where':{}};var _0x2c5cba={};var _0x40df9b={'count':0x0,'rows':[]};var _0x3fb671=_0x3c3d64['query'][_0x7196('0x84')];var _0x3809c4=_0x3c3d64[_0x7196('0x7e')][_0x7196('0x85')]||![];var _0x4673e9=_0x18d389(_0x3fb671,_0x3809c4);if(!_0x4673e9[_0x7196('0x11')])throw new Error(_0x7196('0x86')+_0x3fb671+'\x27');var _0x517dfb=[{'name':_0x3fb671}];if(!_['isEmpty'](_0x4673e9['parentSections']))_0x517dfb=_0x4673e9[_0x7196('0x16')];var _0x49183a=[];for(var _0xd94bd1=0x0;_0xd94bd1<_0x517dfb[_0x7196('0x87')];_0xd94bd1++){_0x49183a[_0x7196('0x88')](_0xa80a3f[_0x7196('0x89')][_0x7196('0x8a')]({'where':{'userProfileId':_0x3c3d64[_0x7196('0x8b')]['id'],'name':_0x517dfb[_0xd94bd1][_0x7196('0x2f')]},'raw':!![]}));}return Promise[_0x7196('0x8c')](_0x49183a)[_0x7196('0x8')](function(_0x52ab69){var _0x5c001a=_[_0x7196('0x5')](_0x52ab69,function(_0x3f939a){return _0x3f939a?_0x3f939a:undefined;});var _0x13e53b=_[_0x7196('0x5')](_0x517dfb,[_0x7196('0x8d'),!![]]);var _0x45e21f=_[_0x7196('0x8e')](_0x5c001a)&&_[_0x7196('0x8e')](_0x13e53b)?null:_['union'](_0x13e53b,_0x5c001a);if(!_0x45e21f)return null;var _0x4cb99d=[];for(var _0x1a736a=0x0;_0x1a736a<_0x45e21f['length'];_0x1a736a++){var _0x30d114=_['find'](_0x517dfb,function(_0x18efc7){return _0x45e21f[_0x1a736a]?_0x18efc7[_0x7196('0x2f')]===_0x45e21f[_0x1a736a][_0x7196('0x2f')]:null;});if(_0x30d114){if(_0x45e21f[_0x1a736a][_0x7196('0x8d')]){_0x4cb99d['push'](_0x1aaddd(_0x4673e9['childModel'],_0x45e21f[_0x1a736a]));}else{if(!_0x45e21f[_0x1a736a][_0x7196('0x8f')]){_0x4cb99d['push'](_0xf7e97(_0x30d114,_0x45e21f[_0x1a736a],_0x4673e9[_0x7196('0x11')]));}else{if(_0x30d114[_0x7196('0x90')]){_0x4cb99d[_0x7196('0x88')](_0x2028dd(_0x30d114,_0x45e21f[_0x1a736a]));}}}}}return Promise[_0x7196('0x8c')](_0x4cb99d);})[_0x7196('0x8')](function(_0x1af971){var _0x4bb3e1=_0x1af971;var _0x3128e6=null;if(_0x4bb3e1){_0x3128e6=_0x4bb3e1[_0x7196('0x87')]===0x1?_0x4bb3e1[0x0]:null;}if(!_0x3128e6&&!_0x4bb3e1)return _0x40df9b;var _0x41208b=_0xa80a3f[_0x4673e9[_0x7196('0x11')]][_0x7196('0x91')];_0x2c5cba[_0x7196('0x90')]=_[_0x7196('0x92')](_0x41208b);_0x2c5cba[_0x7196('0x7e')]=_[_0x7196('0x92')](_0x3c3d64[_0x7196('0x7e')]);_0x2c5cba[_0x7196('0x93')]=_[_0x7196('0x94')](_0x2c5cba['model'],_0x2c5cba[_0x7196('0x7e')]);_0x1d9e75[_0x7196('0x95')]=_['intersection'](_0x2c5cba['model'],qs[_0x7196('0x96')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x96')]));_0x1d9e75['attributes']=_0x1d9e75[_0x7196('0x95')]['length']?_0x1d9e75[_0x7196('0x95')]:_0x2c5cba[_0x7196('0x90')];if(!_0x3c3d64['query'][_0x7196('0x97')]('nolimit')){_0x1d9e75['limit']=qs[_0x7196('0x98')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x98')]);_0x1d9e75['offset']=qs[_0x7196('0x99')](_0x3c3d64['query'][_0x7196('0x99')]);}_0x1d9e75[_0x7196('0x9a')]=qs[_0x7196('0x9b')](_0x3c3d64[_0x7196('0x7e')][_0x7196('0x9b')]);_0x1d9e75['where']=qs[_0x7196('0x93')](_[_0x7196('0x9c')](_0x3c3d64[_0x7196('0x7e')],_0x2c5cba[_0x7196('0x93')]));if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0x5')]){_0x1d9e75[_0x7196('0x7c')]=_[_0x7196('0x9d')](_0x1d9e75['where'],{'$or':_[_0x7196('0xa')](_0x41208b,function(_0x1919d8){if(_0x1919d8[_0x7196('0x39')][_0x7196('0x9e')]!=='VIRTUAL'){var _0x1364f5={};_0x1364f5[_0x1919d8[_0x7196('0x6')]]={'$like':'%'+_0x3c3d64['query'][_0x7196('0x5')]+'%'};return _0x1364f5;}})});}var _0x53d470=[];var _0xd6d8cf=null;var _0x5318c1={};if(_0x3128e6){_0xd6d8cf=_[_0x7196('0x8a')](_0x517dfb,[_0x7196('0x2f'),_0x3128e6['name']]);if(_0xd6d8cf[_0x7196('0x6')]){_0x5318c1={};if(_0x4673e9[_0x7196('0x11')]===_0x7196('0x6d')){_0x5318c1[_0xd6d8cf['foreignKey']]=_['map'](_0x3128e6[_0x7196('0x9')],'id');}else{_0x5318c1[_0xd6d8cf['foreignKey']]=_0x3128e6['associatedResources'];}_0x53d470[_0x7196('0x88')](_0x5318c1);}else{_0x1d9e75[_0x7196('0x7c')]['id']=_0x3128e6[_0x7196('0x9')];}}else{for(var _0x509c4a=0x0;_0x509c4a<_0x4bb3e1[_0x7196('0x87')];_0x509c4a++){_0xd6d8cf=_[_0x7196('0x8a')](_0x517dfb,[_0x7196('0x2f'),_0x4bb3e1[_0x509c4a][_0x7196('0x2f')]]);if(_0xd6d8cf[_0x7196('0x6')]){_0x5318c1={};_0x5318c1[_0xd6d8cf[_0x7196('0x9f')]]=_0x4bb3e1[_0x509c4a][_0x7196('0x9')];_0x53d470[_0x7196('0x88')](_0x5318c1);}else{if(!_0x1d9e75[_0x7196('0x7c')]['id'])_0x1d9e75[_0x7196('0x7c')]['id']=[];_0x4bb3e1[_0x509c4a][_0x7196('0x9')]['forEach'](function(_0x5acff1){_0x1d9e75[_0x7196('0x7c')]['id']['push'](_0x5acff1);});}}}if(!_['isEmpty'](_0x53d470)){_0x1d9e75[_0x7196('0x7c')]=_[_0x7196('0x9d')](_0x1d9e75[_0x7196('0x7c')],{'$and':{'$or':_0x53d470}});}_0x1d9e75=_[_0x7196('0x9d')]({},_0x1d9e75,_0x3c3d64['options']);if(_0x3128e6&&!_0x3128e6['autoAssociation']&&_0x4673e9[_0x7196('0x11')]===_0x7196('0x6d')){if(_0x3c3d64[_0x7196('0x7e')][_0x7196('0xa0')]){_0x1d9e75['include']=[{'all':!![]}];}return _0xa80a3f[_0x4673e9[_0x7196('0x11')]]['findAll'](_0x1d9e75)['then'](function(_0x2820ef){var _0x884d80=[];_0x2820ef[_0x7196('0xa1')](function(_0x494418){var _0x400aa5;switch(_0x494418[_0x7196('0xa2')]){case _0x7196('0xa3'):_0x400aa5=_[_0x7196('0x8a')](_0x3128e6[_0x7196('0x9')],function(_0x3e06c4){return _0x3e06c4['id']===_0x494418[_0x7196('0xa4')]&&_0x3e06c4[_0x7196('0x39')]==='DefaultReports';});break;case _0x7196('0xa5'):_0x400aa5=_[_0x7196('0x8a')](_0x3128e6[_0x7196('0x9')],function(_0x408760){return _0x408760['id']===_0x494418[_0x7196('0xa4')]&&_0x408760['type']===_0x7196('0xa6');});break;}if(_0x400aa5)_0x884d80[_0x7196('0x88')](_0x494418);});_0x40df9b[_0x7196('0xa7')]=_0x884d80['length'];_0x40df9b[_0x7196('0xa8')]=_0x884d80;return _0x40df9b;});}else{if(!_['isEmpty'](_0x3c3d64['query'][_0x7196('0xa9')])){_0x1d9e75[_0x7196('0x7c')]['id']=_0x1d9e75['where']['id']?_[_0x7196('0x94')](_0x1d9e75[_0x7196('0x7c')]['id'],_0x3c3d64['query'][_0x7196('0xa9')]):_0x3c3d64[_0x7196('0x7e')][_0x7196('0xa9')];}return _0xa80a3f[_0x4673e9[_0x7196('0x11')]][_0x7196('0xa7')]({'where':_0x1d9e75[_0x7196('0x7c')]})['then'](function(_0x3639be){_0x40df9b[_0x7196('0xa7')]=_0x3639be;if(_0x3c3d64[_0x7196('0x7e')]['includeAll']){if(_0x4673e9['childModel']==='CmContact'){_0x1d9e75[_0x7196('0xaa')]=[{'model':_0xa80a3f[_0x7196('0x63')],'as':_0x7196('0xab'),'attributes':['id','name',_0x7196('0xac')],'required':_0x3c3d64['query'][_0x7196('0xad')]?!![]:![]},{'model':_0xa80a3f['Tag'],'as':_0x7196('0xae'),'attributes':['id',_0x7196('0x2f'),_0x7196('0xac')],'through':_0x3c3d64[_0x7196('0x7e')][_0x7196('0xad')]?{'attributes':[],'where':{'TagId':_0x3c3d64[_0x7196('0x7e')][_0x7196('0xad')]||undefined}}:{},'required':_0x3c3d64['query'][_0x7196('0xad')]?!![]:![]}];}else{_0x1d9e75['include']=[{'all':!![]}];}}return _0xa80a3f[_0x4673e9['childModel']]['findAll'](_0x1d9e75);})['then'](function(_0x4cf635){_0x40df9b[_0x7196('0xa8')]=_0x4cf635;if(_0x3fb671===_0x7196('0x2e')&&_0x3c3d64[_0x7196('0x7e')]['openTabs']===_0x7196('0xaf')){var _0x49bf7e=[];for(var _0x5080fd=0x0;_0x5080fd<_0x40df9b['rows'][_0x7196('0x87')];_0x5080fd++){_0x49bf7e['push'](_0x3be180(_0x7196('0xb0'),_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180(_0x7196('0xb2'),_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('fax',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('mail',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('openchannel',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));_0x49bf7e[_0x7196('0x88')](_0x3be180('whatsapp',_0x40df9b[_0x7196('0xa8')][_0x5080fd][_0x7196('0xb1')]));}return Promise['all'](_0x49bf7e)[_0x7196('0x8')](function(){return _0x40df9b;});}return _0x40df9b;});}});}}});}; \ No newline at end of file +var _0x4213=['smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','telephones','Users','admin','user','Agents','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','sounds','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','push','find','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','where','pick','merge','key','foreignKey','length','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','ids','Tags','color','ThroughTags','tag','rows','chat','dataValues','fax','mail','openchannel','whatsapp','all','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','catch','model','then','map','name','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','SquareOdbc','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','ListId','companies','globalcustomfields','CmCustomField','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','User','role','agent','Telephones','membername','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount'];(function(_0x113c4e,_0x42c038){var _0x167a11=function(_0x48b613){while(--_0x48b613){_0x113c4e['push'](_0x113c4e['shift']());}};_0x167a11(++_0x42c038);}(_0x4213,0x77));var _0x3421=function(_0x20e034,_0x1393ef){_0x20e034=_0x20e034-0x0;var _0x40ffa0=_0x4213[_0x20e034];return _0x40ffa0;};'use strict';var _=require(_0x3421('0x0'));var attributes=require(_0x3421('0x1'));var qs=require(_0x3421('0x2'));var squel=require(_0x3421('0x3'));module[_0x3421('0x4')]=function(_0x153f3a){var _0x1bab18=_0x153f3a['models'];function _0xdbd54e(_0x5c3719,_0x459c5e){return new Promise(function(_0xfe969c,_0x2155f8){if(!_0x459c5e)return _0xfe969c(null);var _0x2a04e0=_0x459c5e['filter']?{[_0x459c5e[_0x3421('0x5')][_0x3421('0x6')]]:_0x459c5e[_0x3421('0x5')][_0x3421('0x7')]}:undefined;return _0x1bab18[_0x5c3719][_0x3421('0x8')]({'where':_0x2a04e0,'raw':!![]})['then'](function(_0x1f20cf){_0x459c5e['associatedResources']=_['map'](_0x1f20cf,'id');_0xfe969c(_0x459c5e);})[_0x3421('0x9')](function(_0x4b9d24){_0x2155f8(_0x4b9d24);});});}function _0x2d8676(_0x3c1c44,_0x113554){return new Promise(function(_0x38b521,_0x2f12b1){var _0x55c317=_0x3c1c44[_0x3421('0x5')]?{[_0x3c1c44['filter'][_0x3421('0x6')]]:_0x3c1c44[_0x3421('0x5')][_0x3421('0x7')]}:undefined;return _0x1bab18[_0x3c1c44[_0x3421('0xa')]][_0x3421('0x8')]({'where':_0x55c317,'raw':!![]})[_0x3421('0xb')](function(_0x25ffd4){_0x113554['associatedResources']=_[_0x3421('0xc')](_0x25ffd4,function(_0x4b5f43){return _0x4b5f43[_0x3421('0xd')];});_0x38b521(_0x113554);})[_0x3421('0x9')](function(_0x59ae45){_0x2f12b1(_0x59ae45);});});}function _0x1e33ab(_0x4c6f7b,_0x16bc8f,_0x23694b){if(!_0x16bc8f)return Promise['resolve'](null);return new Promise(function(_0x3584d6,_0x3dec08){return _0x1bab18[_0x3421('0xe')][_0x3421('0x8')]({'where':{'sectionId':_0x16bc8f['id']},'raw':!![]})[_0x3421('0xb')](function(_0x200fdd){if(_0x4c6f7b[_0x3421('0x6')]&&_0x4c6f7b[_0x3421('0x6')]!=='id'){_0x16bc8f[_0x3421('0xf')]=_[_0x3421('0xc')](_0x200fdd,function(_0x538a8b){return _0x538a8b[_0x4c6f7b['field']];});}else{if(_0x23694b===_0x3421('0x10')){_0x16bc8f['associatedResources']=_['map'](_0x200fdd,function(_0x545b1c){return{'id':_0x545b1c[_0x3421('0x11')],'type':_0x545b1c[_0x3421('0x12')]};});}else{_0x16bc8f[_0x3421('0xf')]=_[_0x3421('0xc')](_0x200fdd,function(_0x132e8e){return _0x132e8e[_0x3421('0x11')];});}}_0x3584d6(_0x16bc8f);})[_0x3421('0x9')](function(_0x705591){_0x3dec08(_0x705591);});});}function _0xb9af5f(_0x34389e,_0x48fb3d){var _0x57a4af={'parentSections':[]};switch(_0x34389e['toLowerCase']()){case _0x3421('0x13'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x15');break;case'odbc':_0x57a4af['childModel']=_0x3421('0x16');break;case'squarerecordings':_0x57a4af[_0x3421('0x14')]='SquareRecording';_0x57a4af[_0x3421('0x17')]=[{'name':_0x3421('0x18'),'field':_0x3421('0xd'),'foreignKey':_0x3421('0x19')}];break;case _0x3421('0x1a'):_0x57a4af['childModel']=_0x3421('0x1b');break;case'contacts':_0x57a4af['childModel']=_0x3421('0x1c');_0x57a4af['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x3421('0x1d')}];break;case'lists':_0x57a4af[_0x3421('0x14')]='CmList';break;case _0x3421('0x1e'):_0x57a4af[_0x3421('0x14')]='CmCompany';break;case _0x3421('0x1f'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x20');break;case'chatqueues':_0x57a4af[_0x3421('0x14')]='ChatQueue';break;case _0x3421('0x21'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x22');break;case _0x3421('0x23'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x24');break;case _0x3421('0x25'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x26');break;case _0x3421('0x27'):case'internalroutes':case'outboundroutes':_0x57a4af[_0x3421('0x14')]=_0x3421('0x28');break;case'contexts':_0x57a4af[_0x3421('0x14')]=_0x3421('0x29');break;case _0x3421('0x2a'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x2b');break;case'voicerecordings':_0x57a4af[_0x3421('0x14')]=_0x3421('0x2c');_0x57a4af[_0x3421('0x17')]=[{'name':'Agents','field':_0x3421('0xd'),'foreignKey':'membername','model':_0x3421('0x2d'),'filter':{'field':_0x3421('0x2e'),'value':[_0x3421('0x2f')]}},{'name':_0x3421('0x30'),'field':_0x3421('0xd'),'foreignKey':_0x3421('0x31'),'model':_0x3421('0x2d'),'filter':{'field':'role','value':['telephone']}},{'name':'VoiceQueues','field':_0x3421('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x3421('0x12'),'value':['inbound']}},{'name':_0x3421('0x32'),'field':_0x3421('0xd'),'foreignKey':'queue','model':_0x3421('0x33'),'filter':{'field':_0x3421('0x12'),'value':[_0x3421('0x34')]}}];break;case _0x3421('0x35'):_0x57a4af['childModel']=_0x3421('0x36');break;case _0x3421('0x37'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x38');break;case _0x3421('0x39'):_0x57a4af['childModel']=_0x3421('0x3a');break;case _0x3421('0x3b'):_0x57a4af['childModel']=_0x3421('0x3c');break;case'mailqueues':_0x57a4af['childModel']='MailQueue';break;case _0x3421('0x3d'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x3e');break;case _0x3421('0x3f'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x40');break;case _0x3421('0x41'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x42');break;case _0x3421('0x43'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x44');break;case _0x3421('0x45'):_0x57a4af[_0x3421('0x14')]='SmsQueue';break;case _0x3421('0x46'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x47');break;case _0x3421('0x48'):_0x57a4af['childModel']=_0x3421('0x49');break;case'whatsappaccounts':_0x57a4af[_0x3421('0x14')]=_0x3421('0x4a');break;case _0x3421('0x4b'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x4c');break;case _0x3421('0x4d'):case _0x3421('0x4e'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x33');if(_0x48fb3d){_0x57a4af[_0x3421('0x17')]=[{'name':_0x3421('0x4f')},{'name':_0x3421('0x32')}];}break;case _0x3421('0x50'):case'agents':case _0x3421('0x51'):_0x57a4af['childModel']=_0x3421('0x2d');if(_0x48fb3d){_0x57a4af[_0x3421('0x17')]=[{'name':_0x3421('0x52'),'filter':{'field':_0x3421('0x2e'),'value':[_0x3421('0x53'),_0x3421('0x54')]},'ignore':!![]},{'name':_0x3421('0x55')},{'name':_0x3421('0x30')}];}break;case _0x3421('0x56'):_0x57a4af[_0x3421('0x14')]='ZendeskAccount';break;case _0x3421('0x57'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x58');break;case'freshdeskaccounts':_0x57a4af['childModel']=_0x3421('0x59');break;case _0x3421('0x5a'):_0x57a4af[_0x3421('0x14')]='SugarcrmAccount';break;case _0x3421('0x5b'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x5c');break;case _0x3421('0x5d'):_0x57a4af['childModel']=_0x3421('0x5e');break;case _0x3421('0x5f'):_0x57a4af[_0x3421('0x14')]='User';break;case'cannedanswers':_0x57a4af['childModel']=_0x3421('0x60');break;case _0x3421('0x61'):_0x57a4af['childModel']='Disposition';break;case _0x3421('0x62'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x63');break;case _0x3421('0x64'):_0x57a4af[_0x3421('0x14')]='Interval';break;case _0x3421('0x65'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x66');break;case _0x3421('0x67'):_0x57a4af['childModel']=_0x3421('0x68');break;case _0x3421('0x69'):_0x57a4af[_0x3421('0x14')]='Sound';break;case _0x3421('0x6a'):_0x57a4af['childModel']='Tag';break;case _0x3421('0x6b'):_0x57a4af['childModel']=_0x3421('0x6c');break;case _0x3421('0x6d'):_0x57a4af[_0x3421('0x14')]='Trigger';break;case _0x3421('0x6e'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x6f');break;case _0x3421('0x70'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x71');break;case _0x3421('0x72'):_0x57a4af[_0x3421('0x14')]=_0x3421('0x73');break;case'extractedreports':_0x57a4af[_0x3421('0x14')]=_0x3421('0x10');_0x57a4af['parentSections']=[{'name':_0x3421('0x74'),'field':'id','foreignKey':_0x3421('0x75')}];break;case _0x3421('0x76'):_0x57a4af['childModel']=_0x3421('0x77');break;}return _0x57a4af;}function _0x27085d(_0x447456,_0xfe91d7){var _0x1bca2c=_0x447456[_0x3421('0x78')](0x0)[_0x3421('0x79')]()+_0x447456[_0x3421('0x7a')](0x1);var _0x31fd9b={'type':_0x1bab18[_0x3421('0x7b')][_0x3421('0x7c')][_0x3421('0x7d')],'raw':!![]};return new Promise(function(_0x5ac16a,_0x10be7c){var _0x3a8883=squel['select']()[_0x3421('0x6')](_0x3421('0x7e')+_0x1bca2c+_0x3421('0x7f'),'id')[_0x3421('0x6')](_0x3421('0x80'))[_0x3421('0x81')](_0x3421('0x82')+_0x447456+_0x3421('0x83'),'ui')['where'](_0x3421('0x84'),_0xfe91d7['id']);return _0x1bab18['sequelize'][_0x3421('0x85')](_0x3a8883[_0x3421('0x86')](),_0x31fd9b)[_0x3421('0xb')](function(_0x897cde){_0xfe91d7[_0x1bca2c+'OpenTabs']=_0x897cde;_0x5ac16a(_0x897cde);})[_0x3421('0x9')](function(_0x21e11b){_0x10be7c(_0x21e11b);});});}return _0x153f3a[_0x3421('0x87')](_0x3421('0x88'),attributes,{'tableName':_0x3421('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x823366){var _0x5e6c4d={'raw':_0x823366[_0x3421('0x85')][_0x3421('0x8a')],'where':{}};var _0x1e9971={};var _0x278bbf={'count':0x0,'rows':[]};var _0x443b0a=_0x823366[_0x3421('0x85')][_0x3421('0x8b')];var _0x3d7c9a=_0x823366['query'][_0x3421('0x8c')]||![];var _0x46717b=_0xb9af5f(_0x443b0a,_0x3d7c9a);if(!_0x46717b[_0x3421('0x14')])throw new Error(_0x3421('0x8d')+_0x443b0a+'\x27');var _0x347299=[{'name':_0x443b0a}];if(!_['isEmpty'](_0x46717b['parentSections']))_0x347299=_0x46717b[_0x3421('0x17')];var _0x103d84=[];for(var _0x230f65=0x0;_0x230f65<_0x347299['length'];_0x230f65++){_0x103d84[_0x3421('0x8e')](_0x1bab18['UserProfileSection'][_0x3421('0x8f')]({'where':{'userProfileId':_0x823366['params']['id'],'name':_0x347299[_0x230f65]['name']},'raw':!![]}));}return Promise['all'](_0x103d84)['then'](function(_0x4fd786){var _0x326b54=_[_0x3421('0x5')](_0x4fd786,function(_0x2f64a4){return _0x2f64a4?_0x2f64a4:undefined;});var _0x994444=_[_0x3421('0x5')](_0x347299,[_0x3421('0x90'),!![]]);var _0x231067=_[_0x3421('0x91')](_0x326b54)&&_[_0x3421('0x91')](_0x994444)?null:_[_0x3421('0x92')](_0x994444,_0x326b54);if(!_0x231067)return null;var _0x5c7a78=[];for(var _0x297184=0x0;_0x297184<_0x231067['length'];_0x297184++){var _0x252b28=_[_0x3421('0x8f')](_0x347299,function(_0x40e0a6){return _0x231067[_0x297184]?_0x40e0a6[_0x3421('0xd')]===_0x231067[_0x297184][_0x3421('0xd')]:null;});if(_0x252b28){if(_0x231067[_0x297184][_0x3421('0x90')]){_0x5c7a78[_0x3421('0x8e')](_0xdbd54e(_0x46717b[_0x3421('0x14')],_0x231067[_0x297184]));}else{if(!_0x231067[_0x297184][_0x3421('0x93')]){_0x5c7a78['push'](_0x1e33ab(_0x252b28,_0x231067[_0x297184],_0x46717b[_0x3421('0x14')]));}else{if(_0x252b28[_0x3421('0xa')]){_0x5c7a78[_0x3421('0x8e')](_0x2d8676(_0x252b28,_0x231067[_0x297184]));}}}}}return Promise['all'](_0x5c7a78);})['then'](function(_0x54554a){var _0x5dba56=_0x54554a;var _0x8b3181=null;if(_0x5dba56){_0x8b3181=_0x5dba56['length']===0x1?_0x5dba56[0x0]:null;}if(!_0x8b3181&&!_0x5dba56)return _0x278bbf;var _0x2b3837=_0x1bab18[_0x46717b[_0x3421('0x14')]][_0x3421('0x94')];_0x1e9971[_0x3421('0xa')]=_['keys'](_0x2b3837);_0x1e9971[_0x3421('0x85')]=_[_0x3421('0x95')](_0x823366[_0x3421('0x85')]);_0x1e9971[_0x3421('0x96')]=_[_0x3421('0x97')](_0x1e9971[_0x3421('0xa')],_0x1e9971['query']);_0x5e6c4d[_0x3421('0x98')]=_[_0x3421('0x97')](_0x1e9971[_0x3421('0xa')],qs[_0x3421('0x99')](_0x823366[_0x3421('0x85')][_0x3421('0x99')]));_0x5e6c4d[_0x3421('0x98')]=_0x5e6c4d['attributes']['length']?_0x5e6c4d[_0x3421('0x98')]:_0x1e9971[_0x3421('0xa')];if(!_0x823366[_0x3421('0x85')]['hasOwnProperty'](_0x3421('0x9a'))){_0x5e6c4d['limit']=qs[_0x3421('0x9b')](_0x823366['query'][_0x3421('0x9b')]);_0x5e6c4d[_0x3421('0x9c')]=qs[_0x3421('0x9c')](_0x823366[_0x3421('0x85')][_0x3421('0x9c')]);}_0x5e6c4d[_0x3421('0x9d')]=qs[_0x3421('0x9e')](_0x823366[_0x3421('0x85')][_0x3421('0x9e')]);_0x5e6c4d[_0x3421('0x9f')]=qs[_0x3421('0x96')](_[_0x3421('0xa0')](_0x823366['query'],_0x1e9971[_0x3421('0x96')]));if(_0x823366[_0x3421('0x85')][_0x3421('0x5')]){_0x5e6c4d[_0x3421('0x9f')]=_[_0x3421('0xa1')](_0x5e6c4d[_0x3421('0x9f')],{'$or':_[_0x3421('0xc')](_0x2b3837,function(_0x271222){if(_0x271222['type'][_0x3421('0xa2')]!=='VIRTUAL'){var _0x4d92ed={};_0x4d92ed[_0x271222['field']]={'$like':'%'+_0x823366[_0x3421('0x85')][_0x3421('0x5')]+'%'};return _0x4d92ed;}})});}var _0x3e28eb=[];var _0x22ff90=null;var _0x5ee132={};if(_0x8b3181){_0x22ff90=_[_0x3421('0x8f')](_0x347299,[_0x3421('0xd'),_0x8b3181[_0x3421('0xd')]]);if(_0x22ff90[_0x3421('0x6')]){_0x5ee132={};if(_0x46717b[_0x3421('0x14')]===_0x3421('0x10')){_0x5ee132[_0x22ff90[_0x3421('0xa3')]]=_[_0x3421('0xc')](_0x8b3181[_0x3421('0xf')],'id');}else{_0x5ee132[_0x22ff90[_0x3421('0xa3')]]=_0x8b3181[_0x3421('0xf')];}_0x3e28eb[_0x3421('0x8e')](_0x5ee132);}else{_0x5e6c4d[_0x3421('0x9f')]['id']=_0x8b3181[_0x3421('0xf')];}}else{for(var _0x456644=0x0;_0x456644<_0x5dba56[_0x3421('0xa4')];_0x456644++){_0x22ff90=_[_0x3421('0x8f')](_0x347299,['name',_0x5dba56[_0x456644]['name']]);if(_0x22ff90[_0x3421('0x6')]){_0x5ee132={};_0x5ee132[_0x22ff90['foreignKey']]=_0x5dba56[_0x456644][_0x3421('0xf')];_0x3e28eb[_0x3421('0x8e')](_0x5ee132);}else{if(!_0x5e6c4d['where']['id'])_0x5e6c4d[_0x3421('0x9f')]['id']=[];_0x5dba56[_0x456644][_0x3421('0xf')][_0x3421('0xa5')](function(_0x87404){_0x5e6c4d[_0x3421('0x9f')]['id'][_0x3421('0x8e')](_0x87404);});}}}if(!_[_0x3421('0x91')](_0x3e28eb)){_0x5e6c4d[_0x3421('0x9f')]=_[_0x3421('0xa1')](_0x5e6c4d[_0x3421('0x9f')],{'$and':{'$or':_0x3e28eb}});}_0x5e6c4d=_[_0x3421('0xa1')]({},_0x5e6c4d,_0x823366[_0x3421('0xa6')]);if(_0x8b3181&&!_0x8b3181[_0x3421('0x93')]&&_0x46717b['childModel']===_0x3421('0x10')){if(_0x823366['query'][_0x3421('0xa7')]){_0x5e6c4d[_0x3421('0xa8')]=[{'all':!![]}];}return _0x1bab18[_0x46717b['childModel']][_0x3421('0x8')](_0x5e6c4d)['then'](function(_0x554b53){var _0x233fd9=[];_0x554b53[_0x3421('0xa5')](function(_0x3e88fa){var _0x52104f;switch(_0x3e88fa[_0x3421('0xa9')]){case _0x3421('0xaa'):_0x52104f=_[_0x3421('0x8f')](_0x8b3181['associatedResources'],function(_0x5a3bfd){return _0x5a3bfd['id']===_0x3e88fa[_0x3421('0x75')]&&_0x5a3bfd[_0x3421('0x12')]===_0x3421('0xab');});break;case _0x3421('0xac'):_0x52104f=_['find'](_0x8b3181[_0x3421('0xf')],function(_0x1fcd4b){return _0x1fcd4b['id']===_0x3e88fa[_0x3421('0x75')]&&_0x1fcd4b[_0x3421('0x12')]===_0x3421('0xad');});break;}if(_0x52104f)_0x233fd9[_0x3421('0x8e')](_0x3e88fa);});_0x278bbf[_0x3421('0xae')]=_0x233fd9[_0x3421('0xa4')];_0x278bbf['rows']=_0x233fd9;return _0x278bbf;});}else{if(!_[_0x3421('0x91')](_0x823366[_0x3421('0x85')]['ids'])){_0x5e6c4d['where']['id']=_0x5e6c4d[_0x3421('0x9f')]['id']?_[_0x3421('0x97')](_0x5e6c4d[_0x3421('0x9f')]['id'],_0x823366[_0x3421('0x85')][_0x3421('0xaf')]):_0x823366['query']['ids'];}return _0x1bab18[_0x46717b[_0x3421('0x14')]]['count']({'where':_0x5e6c4d['where']})[_0x3421('0xb')](function(_0x1a5b7c){_0x278bbf[_0x3421('0xae')]=_0x1a5b7c;if(_0x823366[_0x3421('0x85')]['includeAll']){if(_0x46717b['childModel']===_0x3421('0x1c')){_0x5e6c4d['include']=[{'model':_0x1bab18['Tag'],'as':_0x3421('0xb0'),'attributes':['id',_0x3421('0xd'),_0x3421('0xb1')],'required':_0x823366['query']['tag']?!![]:![]},{'model':_0x1bab18['Tag'],'as':_0x3421('0xb2'),'attributes':['id',_0x3421('0xd'),_0x3421('0xb1')],'through':_0x823366[_0x3421('0x85')][_0x3421('0xb3')]?{'attributes':[],'where':{'TagId':_0x823366[_0x3421('0x85')][_0x3421('0xb3')]||undefined}}:{},'required':_0x823366['query'][_0x3421('0xb3')]?!![]:![]}];}else{_0x5e6c4d[_0x3421('0xa8')]=[{'all':!![]}];}}return _0x1bab18[_0x46717b[_0x3421('0x14')]][_0x3421('0x8')](_0x5e6c4d);})[_0x3421('0xb')](function(_0x25258b){_0x278bbf[_0x3421('0xb4')]=_0x25258b;if(_0x443b0a===_0x3421('0x55')&&_0x823366[_0x3421('0x85')]['openTabs']==='true'){var _0x171d32=[];for(var _0x5537c2=0x0;_0x5537c2<_0x278bbf[_0x3421('0xb4')]['length'];_0x5537c2++){_0x171d32[_0x3421('0x8e')](_0x27085d(_0x3421('0xb5'),_0x278bbf[_0x3421('0xb4')][_0x5537c2][_0x3421('0xb6')]));_0x171d32[_0x3421('0x8e')](_0x27085d('sms',_0x278bbf['rows'][_0x5537c2][_0x3421('0xb6')]));_0x171d32[_0x3421('0x8e')](_0x27085d(_0x3421('0xb7'),_0x278bbf[_0x3421('0xb4')][_0x5537c2]['dataValues']));_0x171d32[_0x3421('0x8e')](_0x27085d(_0x3421('0xb8'),_0x278bbf[_0x3421('0xb4')][_0x5537c2][_0x3421('0xb6')]));_0x171d32[_0x3421('0x8e')](_0x27085d(_0x3421('0xb9'),_0x278bbf[_0x3421('0xb4')][_0x5537c2]['dataValues']));_0x171d32[_0x3421('0x8e')](_0x27085d(_0x3421('0xba'),_0x278bbf['rows'][_0x5537c2][_0x3421('0xb6')]));}return Promise[_0x3421('0xbb')](_0x171d32)[_0x3421('0xb')](function(){return _0x278bbf;});}return _0x278bbf;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7511fdd..82bd2af 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a03=['http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x15526e,_0x223176){var _0x2c2005=function(_0x236bb2){while(--_0x236bb2){_0x15526e['push'](_0x15526e['shift']());}};_0x2c2005(++_0x223176);}(_0x4a03,0x16e));var _0x34a0=function(_0x17c193,_0x57560d){_0x17c193=_0x17c193-0x0;var _0x153d76=_0x4a03[_0x17c193];return _0x153d76;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});config['redis']=_[_0x34a0('0xa')](config[_0x34a0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x34a0('0xc'))(new Redis(config[_0x34a0('0xb')]));require(_0x34a0('0xd'))[_0x34a0('0xe')](socket);function respondWithRpcPromise(_0x761a80,_0x4faf06,_0x40d73d){return new BPromise(function(_0x2c39bf,_0x21e702){return client[_0x34a0('0xf')](_0x761a80,_0x40d73d)[_0x34a0('0x10')](function(_0x343d24){logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,'request\x20sent');logger['debug'](_0x34a0('0x13'),_0x4faf06,_0x34a0('0x14'),JSON['stringify'](_0x343d24));if(_0x343d24[_0x34a0('0x15')]){if(_0x343d24[_0x34a0('0x15')][_0x34a0('0x16')]===0x1f4){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x21e702(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);return _0x2c39bf(_0x343d24[_0x34a0('0x15')][_0x34a0('0x17')]);}else{logger[_0x34a0('0x11')](_0x34a0('0x12'),_0x4faf06,_0x34a0('0x14'));_0x2c39bf(_0x343d24[_0x34a0('0x18')][_0x34a0('0x17')]);}})['catch'](function(_0x466525){logger[_0x34a0('0x15')](_0x34a0('0x12'),_0x4faf06,_0x466525);_0x21e702(_0x466525);});});} \ No newline at end of file +var _0x0eb2=['UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x2ca5e0,_0x11ee68){var _0x41aeb3=function(_0x28ddf2){while(--_0x28ddf2){_0x2ca5e0['push'](_0x2ca5e0['shift']());}};_0x41aeb3(++_0x11ee68);}(_0x0eb2,0x11c));var _0x20eb=function(_0x3bae51,_0x25e192){_0x3bae51=_0x3bae51-0x0;var _0xee8c63=_0x0eb2[_0x3bae51];return _0xee8c63;};'use strict';var _=require(_0x20eb('0x0'));var util=require('util');var moment=require(_0x20eb('0x1'));var BPromise=require(_0x20eb('0x2'));var rs=require(_0x20eb('0x3'));var fs=require('fs');var Redis=require(_0x20eb('0x4'));var db=require(_0x20eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20eb('0x7')][_0x20eb('0x8')]({'port':0x232a});config[_0x20eb('0x9')]=_['defaults'](config[_0x20eb('0x9')],{'host':_0x20eb('0xa'),'port':0x18eb});var socket=require(_0x20eb('0xb'))(new Redis(config[_0x20eb('0x9')]));require(_0x20eb('0xc'))[_0x20eb('0xd')](socket);function respondWithRpcPromise(_0x2c704d,_0x178e1a,_0x354645){return new BPromise(function(_0x3e6330,_0x198a58){return client[_0x20eb('0xe')](_0x2c704d,_0x354645)[_0x20eb('0xf')](function(_0x304536){logger['info'](_0x20eb('0x10'),_0x178e1a,'request\x20sent');logger[_0x20eb('0x11')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x178e1a,_0x20eb('0x12'),JSON[_0x20eb('0x13')](_0x304536));if(_0x304536[_0x20eb('0x14')]){if(_0x304536[_0x20eb('0x14')][_0x20eb('0x15')]===0x1f4){logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x198a58(_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);}logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x3e6330(_0x304536['error'][_0x20eb('0x16')]);}else{logger['info'](_0x20eb('0x10'),_0x178e1a,_0x20eb('0x12'));_0x3e6330(_0x304536[_0x20eb('0x17')][_0x20eb('0x16')]);}})[_0x20eb('0x18')](function(_0x934bbc){logger[_0x20eb('0x14')]('UserProfile,\x20%s,\x20%s',_0x178e1a,_0x934bbc);_0x198a58(_0x934bbc);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 328a218..e9e9cd1 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x036d=['./userProfile.events','save','remove','update','emit','register','length','userProfile:'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x036d,0x1d8));var _0xd036=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x036d[_0x465a0c];return _0x1e202e;};'use strict';var UserProfileEvents=require(_0xd036('0x0'));var events=[_0xd036('0x1'),_0xd036('0x2'),_0xd036('0x3')];function createListener(_0x598f7d,_0x2a1bc5){return function(_0x273624){_0x2a1bc5[_0xd036('0x4')](_0x598f7d,_0x273624);};}function removeListener(_0x3cdb73,_0x232e46){return function(){UserProfileEvents['removeListener'](_0x3cdb73,_0x232e46);};}exports[_0xd036('0x5')]=function(_0x31dc91){for(var _0x376b75=0x0,_0x48b2f7=events[_0xd036('0x6')];_0x376b75<_0x48b2f7;_0x376b75++){var _0x2b1d14=events[_0x376b75];var _0x3fe7c0=createListener(_0xd036('0x7')+_0x2b1d14,_0x31dc91);UserProfileEvents['on'](_0x2b1d14,_0x3fe7c0);}}; \ No newline at end of file +var _0x0333=['save','remove','update','emit','removeListener','register','length'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x0333,0x1ab));var _0x3033=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x0333[_0x30cc1a];return _0xb3f18f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x3033('0x0'),_0x3033('0x1'),_0x3033('0x2')];function createListener(_0x46ba5d,_0x21daf6){return function(_0x396950){_0x21daf6[_0x3033('0x3')](_0x46ba5d,_0x396950);};}function removeListener(_0x4639db,_0x268f38){return function(){UserProfileEvents[_0x3033('0x4')](_0x4639db,_0x268f38);};}exports[_0x3033('0x5')]=function(_0x55b89e){for(var _0xf4bfb1=0x0,_0x4cecd1=events[_0x3033('0x6')];_0xf4bfb1<_0x4cecd1;_0xf4bfb1++){var _0x3293b6=events[_0xf4bfb1];var _0x270259=createListener('userProfile:'+_0x3293b6,_0x55b89e);UserProfileEvents['on'](_0x3293b6,_0x270259);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 447c8f4..50e8a3e 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4a1=['./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4a1,0xa1));var _0x1c4a=function(_0xd03201,_0x1644c9){_0xd03201=_0xd03201-0x0;var _0x383be4=_0xc4a1[_0xd03201];return _0x383be4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c4a('0x0'));var timeout=require(_0x1c4a('0x1'));var express=require(_0x1c4a('0x2'));var router=express[_0x1c4a('0x3')]();var fs_extra=require(_0x1c4a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1c4a('0x5'));var config=require(_0x1c4a('0x6'));var controller=require(_0x1c4a('0x7'));router['get']('/',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x9')]);router[_0x1c4a('0xa')](_0x1c4a('0xb'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0xc')]);router['get'](_0x1c4a('0xd'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0xe')]);router[_0x1c4a('0xf')]('/',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x10')]);router[_0x1c4a('0x11')](_0x1c4a('0xd'),auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x12')]);router['delete']('/:id',auth[_0x1c4a('0x8')](),controller[_0x1c4a('0x13')]);module[_0x1c4a('0x14')]=router; \ No newline at end of file +var _0x79a5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','exports','multer','util'];(function(_0x4074df,_0x431fe3){var _0x191edd=function(_0x502959){while(--_0x502959){_0x4074df['push'](_0x4074df['shift']());}};_0x191edd(++_0x431fe3);}(_0x79a5,0x17a));var _0x579a=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x79a5[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x579a('0x0'));var util=require(_0x579a('0x1'));var path=require(_0x579a('0x2'));var timeout=require(_0x579a('0x3'));var express=require('express');var router=express[_0x579a('0x4')]();var fs_extra=require(_0x579a('0x5'));var auth=require(_0x579a('0x6'));var interaction=require(_0x579a('0x7'));var config=require(_0x579a('0x8'));var controller=require(_0x579a('0x9'));router[_0x579a('0xa')]('/',auth[_0x579a('0xb')](),controller['index']);router['get'](_0x579a('0xc'),auth[_0x579a('0xb')](),controller[_0x579a('0xd')]);router['get'](_0x579a('0xe'),auth[_0x579a('0xb')](),controller[_0x579a('0xf')]);router[_0x579a('0x10')]('/',auth[_0x579a('0xb')](),controller['create']);router['put'](_0x579a('0xe'),auth[_0x579a('0xb')](),controller[_0x579a('0x11')]);router[_0x579a('0x12')](_0x579a('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x579a('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 21b6bcb..4f69e9b 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1d07=['sequelize','INTEGER','STRING'];(function(_0x25dfa5,_0x481524){var _0x2cb0a3=function(_0x1d9901){while(--_0x1d9901){_0x25dfa5['push'](_0x25dfa5['shift']());}};_0x2cb0a3(++_0x481524);}(_0x1d07,0xd5));var _0x71d0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1d07[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x71d0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x71d0('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x71d0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x26fd=['sequelize','STRING','INTEGER'];(function(_0x54d562,_0x470834){var _0x3fc568=function(_0x255a0a){while(--_0x255a0a){_0x54d562['push'](_0x54d562['shift']());}};_0x3fc568(++_0x470834);}(_0x26fd,0x195));var _0xd26f=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x26fd[_0x5ec453];return _0x25548f;};'use strict';var Sequelize=require(_0xd26f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd26f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd26f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd26f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 2212cff..88c4519 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x1167ac,_0x2793e0){var _0x272913=function(_0x1f6fd3){while(--_0x1f6fd3){_0x1167ac['push'](_0x1167ac['shift']());}};_0x272913(++_0x2793e0);}(_0x5496,0x175));var _0x6549=function(_0x1fd0a2,_0x1b896a){_0x1fd0a2=_0x1fd0a2-0x0;var _0x6ba97f=_0x5496[_0x1fd0a2];return _0x6ba97f;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['UserProfileResource'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x1e6845,_0x58daeb){var _0x5d6870=function(_0x56143b){while(--_0x56143b){_0x1e6845['push'](_0x1e6845['shift']());}};_0x5d6870(++_0x58daeb);}(_0x7096,0x10c));var _0x6709=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7096[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d271afd..d1163dc 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8166=['moment','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','sectionId','util','../../config/logger','api'];(function(_0x2a0030,_0x49e6ac){var _0x59e0e0=function(_0xb519fe){while(--_0xb519fe){_0x2a0030['push'](_0x2a0030['shift']());}};_0x59e0e0(++_0x49e6ac);}(_0x8166,0xf4));var _0x6816=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x8166[_0x5ad0d7];return _0xd83bd;};'use strict';var _=require('lodash');var util=require(_0x6816('0x0'));var logger=require(_0x6816('0x1'))(_0x6816('0x2'));var moment=require(_0x6816('0x3'));var BPromise=require('bluebird');var rp=require(_0x6816('0x4'));var fs=require('fs');var path=require(_0x6816('0x5'));var rimraf=require(_0x6816('0x6'));var config=require('../../config/environment');var attributes=require(_0x6816('0x7'));module[_0x6816('0x8')]=function(_0x1858d4,_0x13ea18){return _0x1858d4[_0x6816('0x9')](_0x6816('0xa'),attributes,{'tableName':_0x6816('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x6816('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb76=['compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x2c3e10,_0x54b232){var _0x31b3af=function(_0x27794d){while(--_0x27794d){_0x2c3e10['push'](_0x2c3e10['shift']());}};_0x31b3af(++_0x54b232);}(_0xdb76,0xe3));var _0x6db7=function(_0xa746fd,_0x3cc0a4){_0xa746fd=_0xa746fd-0x0;var _0x3bf7da=_0xdb76[_0xa746fd];return _0x3bf7da;};'use strict';var _=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var logger=require(_0x6db7('0x2'))(_0x6db7('0x3'));var moment=require('moment');var BPromise=require(_0x6db7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6db7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6db7('0x6'));module[_0x6db7('0x7')]=function(_0x10a1c7,_0x10e800){return _0x10a1c7[_0x6db7('0x8')](_0x6db7('0x9'),attributes,{'tableName':_0x6db7('0xa'),'paranoid':![],'indexes':[{'name':_0x6db7('0xb'),'fields':[_0x6db7('0xc'),_0x6db7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 2b89ddb..17a492d 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x005c=['then','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','rpc','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x005c,0x173));var _0xc005=function(_0x578f07,_0x7fb8d5){_0x578f07=_0x578f07-0x0;var _0x5cdd72=_0x005c[_0x578f07];return _0x5cdd72;};'use strict';var _=require(_0xc005('0x0'));var util=require(_0xc005('0x1'));var moment=require('moment');var BPromise=require(_0xc005('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc005('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc005('0x4'))(_0xc005('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc005('0x6')][_0xc005('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x140afb,_0x43b25d,_0xdfffdf){return new BPromise(function(_0x3c69b0,_0xe19bc2){return client[_0xc005('0x8')](_0x140afb,_0xdfffdf)[_0xc005('0x9')](function(_0x528c1b){logger[_0xc005('0xa')](_0xc005('0xb'),_0x43b25d,'request\x20sent');logger['debug'](_0xc005('0xc'),_0x43b25d,_0xc005('0xd'),JSON['stringify'](_0x528c1b));if(_0x528c1b['error']){if(_0x528c1b[_0xc005('0xe')][_0xc005('0xf')]===0x1f4){logger[_0xc005('0xe')](_0xc005('0xb'),_0x43b25d,_0x528c1b[_0xc005('0xe')][_0xc005('0x10')]);return _0xe19bc2(_0x528c1b['error'][_0xc005('0x10')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43b25d,_0x528c1b[_0xc005('0xe')]['message']);return _0x3c69b0(_0x528c1b[_0xc005('0xe')][_0xc005('0x10')]);}else{logger[_0xc005('0xa')](_0xc005('0xb'),_0x43b25d,'request\x20sent');_0x3c69b0(_0x528c1b[_0xc005('0x11')][_0xc005('0x10')]);}})[_0xc005('0x12')](function(_0x5c5ffe){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43b25d,_0x5c5ffe);_0xe19bc2(_0x5c5ffe);});});} \ No newline at end of file +var _0xfb39=['../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x34ebbf,_0x41c45e){var _0x2b225c=function(_0x391245){while(--_0x391245){_0x34ebbf['push'](_0x34ebbf['shift']());}};_0x2b225c(++_0x41c45e);}(_0xfb39,0x13c));var _0x9fb3=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfb39[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x9fb3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9fb3('0x1'));var rs=require(_0x9fb3('0x2'));var fs=require('fs');var Redis=require(_0x9fb3('0x3'));var db=require(_0x9fb3('0x4'))['db'];var utils=require(_0x9fb3('0x5'));var logger=require('../../config/logger')(_0x9fb3('0x6'));var config=require(_0x9fb3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9fb3('0x8')][_0x9fb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c3ed0,_0x2bed97,_0x37631e){return new BPromise(function(_0x5ef68e,_0x2c73b0){return client[_0x9fb3('0xa')](_0x1c3ed0,_0x37631e)[_0x9fb3('0xb')](function(_0xd0caa5){logger[_0x9fb3('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x2bed97,_0x9fb3('0xd'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2bed97,'request\x20sent',JSON[_0x9fb3('0xe')](_0xd0caa5));if(_0xd0caa5[_0x9fb3('0xf')]){if(_0xd0caa5[_0x9fb3('0xf')]['code']===0x1f4){logger[_0x9fb3('0xf')](_0x9fb3('0x10'),_0x2bed97,_0xd0caa5[_0x9fb3('0xf')][_0x9fb3('0x11')]);return _0x2c73b0(_0xd0caa5[_0x9fb3('0xf')][_0x9fb3('0x11')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x2bed97,_0xd0caa5['error'][_0x9fb3('0x11')]);return _0x5ef68e(_0xd0caa5[_0x9fb3('0xf')]['message']);}else{logger[_0x9fb3('0xc')](_0x9fb3('0x10'),_0x2bed97,_0x9fb3('0xd'));_0x5ef68e(_0xd0caa5['result'][_0x9fb3('0x11')]);}})[_0x9fb3('0x12')](function(_0x28fd24){logger['error'](_0x9fb3('0x10'),_0x2bed97,_0x28fd24);_0x2c73b0(_0x28fd24);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 98c1b41..bd07750 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7173=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x4ef870,_0x2f480a){var _0x1ebe09=function(_0x1f98a1){while(--_0x1f98a1){_0x4ef870['push'](_0x4ef870['shift']());}};_0x1ebe09(++_0x2f480a);}(_0x7173,0xb1));var _0x3717=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7173[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require(_0x3717('0x0'));var util=require(_0x3717('0x1'));var path=require(_0x3717('0x2'));var timeout=require(_0x3717('0x3'));var express=require(_0x3717('0x4'));var router=express[_0x3717('0x5')]();var fs_extra=require(_0x3717('0x6'));var auth=require(_0x3717('0x7'));var interaction=require(_0x3717('0x8'));var config=require('../../config/environment');var controller=require(_0x3717('0x9'));router[_0x3717('0xa')]('/',auth['isAuthenticated'](),controller[_0x3717('0xb')]);router[_0x3717('0xa')]('/describe',auth[_0x3717('0xc')](),controller[_0x3717('0xd')]);router[_0x3717('0xa')]('/:id',auth[_0x3717('0xc')](),controller['show']);router[_0x3717('0xe')]('/',auth[_0x3717('0xc')](),controller[_0x3717('0xf')]);router[_0x3717('0x10')](_0x3717('0x11'),auth[_0x3717('0xc')](),controller[_0x3717('0x12')]);router[_0x3717('0x13')](_0x3717('0x11'),auth[_0x3717('0xc')](),controller[_0x3717('0x14')]);module[_0x3717('0x15')]=router; \ No newline at end of file +var _0xf5d6=['put','/:id','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe','describe','show','post'];(function(_0x2f023d,_0x4ea17a){var _0x17557d=function(_0x3ff4a0){while(--_0x3ff4a0){_0x2f023d['push'](_0x2f023d['shift']());}};_0x17557d(++_0x4ea17a);}(_0xf5d6,0x101));var _0x6f5d=function(_0x3712e7,_0x160056){_0x3712e7=_0x3712e7-0x0;var _0x104692=_0xf5d6[_0x3712e7];return _0x104692;};'use strict';var multer=require('multer');var util=require(_0x6f5d('0x0'));var path=require(_0x6f5d('0x1'));var timeout=require(_0x6f5d('0x2'));var express=require('express');var router=express[_0x6f5d('0x3')]();var fs_extra=require(_0x6f5d('0x4'));var auth=require(_0x6f5d('0x5'));var interaction=require(_0x6f5d('0x6'));var config=require(_0x6f5d('0x7'));var controller=require(_0x6f5d('0x8'));router['get']('/',auth[_0x6f5d('0x9')](),controller[_0x6f5d('0xa')]);router[_0x6f5d('0xb')](_0x6f5d('0xc'),auth[_0x6f5d('0x9')](),controller[_0x6f5d('0xd')]);router[_0x6f5d('0xb')]('/:id',auth[_0x6f5d('0x9')](),controller[_0x6f5d('0xe')]);router[_0x6f5d('0xf')]('/',auth[_0x6f5d('0x9')](),controller['create']);router[_0x6f5d('0x10')](_0x6f5d('0x11'),auth[_0x6f5d('0x9')](),controller['update']);router[_0x6f5d('0x12')](_0x6f5d('0x11'),auth[_0x6f5d('0x9')](),controller[_0x6f5d('0x13')]);module[_0x6f5d('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f7bddc8..0bc2690 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefda=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x143539,_0x110d02){var _0x21d039=function(_0x287a1e){while(--_0x287a1e){_0x143539['push'](_0x143539['shift']());}};_0x21d039(++_0x110d02);}(_0xefda,0x96));var _0xaefd=function(_0xc74b1b,_0x2d57e1){_0xc74b1b=_0xc74b1b-0x0;var _0x93ada=_0xefda[_0xc74b1b];return _0x93ada;};'use strict';var Sequelize=require(_0xaefd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xaefd('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaefd('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xaefd('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xaefd('0x1')],'set':function(_0x2ade44){this[_0xaefd('0x4')](_0xaefd('0x5'),_0x2ade44?_0x2ade44[_0xaefd('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xaefd('0x5'))?this[_0xaefd('0x7')](_0xaefd('0x5'))[_0xaefd('0x8')](''):[];}}}; \ No newline at end of file +var _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x4571ae,_0x5309bf){var _0x52b48b=function(_0x20695c){while(--_0x20695c){_0x4571ae['push'](_0x4571ae['shift']());}};_0x52b48b(++_0x5309bf);}(_0x63a5,0x18e));var _0x563a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x63a5[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'name':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x563a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x563a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x563a('0x2')],'set':function(_0x386400){this[_0x563a('0x5')]('crudPermissions',_0x386400?_0x386400['join'](''):[]);},'get':function(){return this[_0x563a('0x6')]('crudPermissions')?this[_0x563a('0x6')](_0x563a('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 3a218ee..90886fd 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfb7=['sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','catch','show','UserProfileSection','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xbfb7,0x1d3));var _0x7bfb=function(_0x53273a,_0x5ed978){_0x53273a=_0x53273a-0x0;var _0x3c41db=_0xbfb7[_0x53273a];return _0x3c41db;};'use strict';var emlformat=require(_0x7bfb('0x0'));var rimraf=require(_0x7bfb('0x1'));var zipdir=require(_0x7bfb('0x2'));var jsonpatch=require(_0x7bfb('0x3'));var rp=require(_0x7bfb('0x4'));var moment=require(_0x7bfb('0x5'));var BPromise=require(_0x7bfb('0x6'));var Mustache=require(_0x7bfb('0x7'));var util=require(_0x7bfb('0x8'));var path=require(_0x7bfb('0x9'));var sox=require(_0x7bfb('0xa'));var csv=require(_0x7bfb('0xb'));var ejs=require(_0x7bfb('0xc'));var fs=require('fs');var fs_extra=require(_0x7bfb('0xd'));var _=require(_0x7bfb('0xe'));var squel=require('squel');var crypto=require(_0x7bfb('0xf'));var jsforce=require(_0x7bfb('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7bfb('0xb'));var querystring=require(_0x7bfb('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7bfb('0x12'));var qs=require(_0x7bfb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bfb('0x14'));var logger=require('../../config/logger')(_0x7bfb('0x15'));var utils=require(_0x7bfb('0x16'));var config=require(_0x7bfb('0x17'));var licenseUtil=require(_0x7bfb('0x18'));var db=require(_0x7bfb('0x19'))['db'];function respondWithStatusCode(_0xd795f7,_0x2c4c98){_0x2c4c98=_0x2c4c98||0xcc;return function(_0x563502){if(_0x563502){return _0xd795f7[_0x7bfb('0x1a')](_0x2c4c98);}return _0xd795f7[_0x7bfb('0x1b')](_0x2c4c98)[_0x7bfb('0x1c')]();};}function respondWithResult(_0x5f4315,_0x4506a6){_0x4506a6=_0x4506a6||0xc8;return function(_0x5e964d){if(_0x5e964d){return _0x5f4315[_0x7bfb('0x1b')](_0x4506a6)[_0x7bfb('0x1d')](_0x5e964d);}};}function respondWithFilteredResult(_0x40f75c,_0x842fd8){return function(_0x40b45b){if(_0x40b45b){var _0x4f44b7=typeof _0x842fd8[_0x7bfb('0x1e')]===_0x7bfb('0x1f')&&typeof _0x842fd8[_0x7bfb('0x20')]==='undefined';var _0x5ba8dd=_0x40b45b[_0x7bfb('0x21')];var _0x23d45f=_0x4f44b7?0x0:_0x842fd8['offset'];var _0x168355=_0x4f44b7?_0x40b45b['count']:_0x842fd8['offset']+_0x842fd8[_0x7bfb('0x20')];var _0x45b4db;if(_0x168355>=_0x5ba8dd){_0x168355=_0x5ba8dd;_0x45b4db=0xc8;}else{_0x45b4db=0xce;}_0x40f75c[_0x7bfb('0x1b')](_0x45b4db);return _0x40f75c['set'](_0x7bfb('0x22'),_0x23d45f+'-'+_0x168355+'/'+_0x5ba8dd)[_0x7bfb('0x1d')](_0x40b45b);}return null;};}function patchUpdates(_0x2fb53d){return function(_0x16389e){try{jsonpatch[_0x7bfb('0x23')](_0x16389e,_0x2fb53d,!![]);}catch(_0x11178b){return BPromise['reject'](_0x11178b);}return _0x16389e['save']();};}function saveUpdates(_0x2ced16,_0x421d8c){return function(_0x1c1311){if(_0x1c1311){return _0x1c1311[_0x7bfb('0x24')](_0x2ced16)[_0x7bfb('0x25')](function(_0x39a790){return _0x39a790;});}return null;};}function removeEntity(_0x23d7c4,_0x1e31ee){return function(_0x5a2757){if(_0x5a2757){return _0x5a2757[_0x7bfb('0x26')]()[_0x7bfb('0x25')](function(){_0x23d7c4[_0x7bfb('0x1b')](0xcc)[_0x7bfb('0x1c')]();});}};}function handleEntityNotFound(_0x16cbcd,_0x2fd002){return function(_0x2c9dfc){if(!_0x2c9dfc){_0x16cbcd['sendStatus'](0x194);}return _0x2c9dfc;};}function handleError(_0x5a0ccd,_0x2a7837){_0x2a7837=_0x2a7837||0x1f4;return function(_0xcbbfeb){logger[_0x7bfb('0x27')](_0xcbbfeb[_0x7bfb('0x28')]);if(_0xcbbfeb[_0x7bfb('0x29')]){delete _0xcbbfeb['name'];}_0x5a0ccd[_0x7bfb('0x1b')](_0x2a7837)['send'](_0xcbbfeb);};}exports[_0x7bfb('0x2a')]=function(_0x311421,_0x4b4f1d){var _0x37587c={},_0x2ef855={},_0x5c1113={'count':0x0,'rows':[]};var _0x1a1bb8=_[_0x7bfb('0x2b')](db['UserProfileSection'][_0x7bfb('0x2c')],function(_0x332475){return{'name':_0x332475[_0x7bfb('0x2d')],'type':_0x332475[_0x7bfb('0x2e')][_0x7bfb('0x2f')]};});_0x2ef855['model']=_[_0x7bfb('0x2b')](_0x1a1bb8,_0x7bfb('0x29'));_0x2ef855[_0x7bfb('0x30')]=_[_0x7bfb('0x31')](_0x311421['query']);_0x2ef855[_0x7bfb('0x32')]=_[_0x7bfb('0x33')](_0x2ef855[_0x7bfb('0x34')],_0x2ef855['query']);_0x37587c['attributes']=_[_0x7bfb('0x33')](_0x2ef855['model'],qs[_0x7bfb('0x35')](_0x311421[_0x7bfb('0x30')][_0x7bfb('0x35')]));_0x37587c['attributes']=_0x37587c[_0x7bfb('0x36')][_0x7bfb('0x37')]?_0x37587c[_0x7bfb('0x36')]:_0x2ef855[_0x7bfb('0x34')];if(!_0x311421['query']['hasOwnProperty'](_0x7bfb('0x38'))){_0x37587c[_0x7bfb('0x20')]=qs[_0x7bfb('0x20')](_0x311421[_0x7bfb('0x30')]['limit']);_0x37587c[_0x7bfb('0x1e')]=qs[_0x7bfb('0x1e')](_0x311421[_0x7bfb('0x30')][_0x7bfb('0x1e')]);}_0x37587c[_0x7bfb('0x39')]=qs[_0x7bfb('0x3a')](_0x311421[_0x7bfb('0x30')]['sort']);_0x37587c[_0x7bfb('0x3b')]=qs[_0x7bfb('0x32')](_[_0x7bfb('0x3c')](_0x311421[_0x7bfb('0x30')],_0x2ef855[_0x7bfb('0x32')]),_0x1a1bb8);if(_0x311421[_0x7bfb('0x30')]['filter']){_0x37587c['where']=_[_0x7bfb('0x3d')](_0x37587c[_0x7bfb('0x3b')],{'$or':_[_0x7bfb('0x2b')](_0x1a1bb8,function(_0x5c1566){if(_0x5c1566[_0x7bfb('0x2e')]!==_0x7bfb('0x3e')){var _0x3cf13a={};_0x3cf13a[_0x5c1566[_0x7bfb('0x29')]]={'$like':'%'+_0x311421['query'][_0x7bfb('0x3f')]+'%'};return _0x3cf13a;}})});}_0x37587c=_['merge']({},_0x37587c,_0x311421[_0x7bfb('0x40')]);var _0x587305={'where':_0x37587c['where']};return db['UserProfileSection'][_0x7bfb('0x21')](_0x587305)[_0x7bfb('0x25')](function(_0x500605){_0x5c1113[_0x7bfb('0x21')]=_0x500605;if(_0x311421['query']['includeAll']){_0x37587c[_0x7bfb('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x7bfb('0x42')](_0x37587c);})[_0x7bfb('0x25')](function(_0x1e5623){_0x5c1113['rows']=_0x1e5623;return _0x5c1113;})[_0x7bfb('0x25')](respondWithFilteredResult(_0x4b4f1d,_0x37587c))[_0x7bfb('0x43')](handleError(_0x4b4f1d,null));};exports[_0x7bfb('0x44')]=function(_0x54f3d2,_0x23b7dc){var _0x3e320f={'raw':![],'where':{'id':_0x54f3d2['params']['id']}},_0x5c7f3c={};_0x5c7f3c['model']=_[_0x7bfb('0x31')](db[_0x7bfb('0x45')]['rawAttributes']);_0x5c7f3c[_0x7bfb('0x30')]=_[_0x7bfb('0x31')](_0x54f3d2[_0x7bfb('0x30')]);_0x5c7f3c[_0x7bfb('0x32')]=_[_0x7bfb('0x33')](_0x5c7f3c[_0x7bfb('0x34')],_0x5c7f3c[_0x7bfb('0x30')]);_0x3e320f[_0x7bfb('0x36')]=_[_0x7bfb('0x33')](_0x5c7f3c[_0x7bfb('0x34')],qs[_0x7bfb('0x35')](_0x54f3d2[_0x7bfb('0x30')][_0x7bfb('0x35')]));_0x3e320f[_0x7bfb('0x36')]=_0x3e320f['attributes'][_0x7bfb('0x37')]?_0x3e320f[_0x7bfb('0x36')]:_0x5c7f3c['model'];if(_0x54f3d2[_0x7bfb('0x30')][_0x7bfb('0x46')]){_0x3e320f[_0x7bfb('0x41')]=[{'all':!![]}];}_0x3e320f=_['merge']({},_0x3e320f,_0x54f3d2[_0x7bfb('0x40')]);return db[_0x7bfb('0x45')][_0x7bfb('0x47')](_0x3e320f)[_0x7bfb('0x25')](handleEntityNotFound(_0x23b7dc,null))[_0x7bfb('0x25')](respondWithResult(_0x23b7dc,null))['catch'](handleError(_0x23b7dc,null));};exports['create']=function(_0xc322fe,_0x411451){return db[_0x7bfb('0x45')][_0x7bfb('0x48')](_0xc322fe[_0x7bfb('0x49')],{})[_0x7bfb('0x25')](respondWithResult(_0x411451,0xc9))['catch'](handleError(_0x411451,null));};exports[_0x7bfb('0x24')]=function(_0x1f113e,_0x307f1f){if(_0x1f113e[_0x7bfb('0x49')]['id']){delete _0x1f113e[_0x7bfb('0x49')]['id'];}return db[_0x7bfb('0x45')]['find']({'where':{'id':_0x1f113e['params']['id']}})[_0x7bfb('0x25')](handleEntityNotFound(_0x307f1f,null))[_0x7bfb('0x25')](saveUpdates(_0x1f113e['body'],null))[_0x7bfb('0x25')](respondWithResult(_0x307f1f,null))[_0x7bfb('0x43')](handleError(_0x307f1f,null));};exports[_0x7bfb('0x26')]=function(_0x5c49f4,_0x517cd6){return db['UserProfileSection'][_0x7bfb('0x47')]({'where':{'id':_0x5c49f4['params']['id']}})['then'](handleEntityNotFound(_0x517cd6,null))[_0x7bfb('0x25')](removeEntity(_0x517cd6,null))[_0x7bfb('0x43')](handleError(_0x517cd6,null));};exports[_0x7bfb('0x4a')]=function(_0x479384,_0x506b82){return db[_0x7bfb('0x45')][_0x7bfb('0x4a')]()[_0x7bfb('0x25')](respondWithResult(_0x506b82,null))[_0x7bfb('0x43')](handleError(_0x506b82,null));}; \ No newline at end of file +var _0x8c41=['json','offset','undefined','limit','count','set','Content-Range','reject','update','then','sendStatus','error','stack','send','map','UserProfileSection','key','name','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','create','body','find','params','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end'];(function(_0x20410e,_0x11ea83){var _0x18e1cc=function(_0x58a0f0){while(--_0x58a0f0){_0x20410e['push'](_0x20410e['shift']());}};_0x18e1cc(++_0x11ea83);}(_0x8c41,0x19b));var _0x18c4=function(_0x8fc198,_0x3278fd){_0x8fc198=_0x8fc198-0x0;var _0x1007d7=_0x8c41[_0x8fc198];return _0x1007d7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x18c4('0x0'));var jsonpatch=require(_0x18c4('0x1'));var rp=require(_0x18c4('0x2'));var moment=require(_0x18c4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x18c4('0x4'));var util=require(_0x18c4('0x5'));var path=require(_0x18c4('0x6'));var sox=require('sox');var csv=require(_0x18c4('0x7'));var ejs=require(_0x18c4('0x8'));var fs=require('fs');var fs_extra=require(_0x18c4('0x9'));var _=require(_0x18c4('0xa'));var squel=require('squel');var crypto=require(_0x18c4('0xb'));var jsforce=require(_0x18c4('0xc'));var deskjs=require(_0x18c4('0xd'));var toCsv=require(_0x18c4('0x7'));var querystring=require(_0x18c4('0xe'));var Papa=require(_0x18c4('0xf'));var Redis=require(_0x18c4('0x10'));var authService=require(_0x18c4('0x11'));var qs=require(_0x18c4('0x12'));var as=require(_0x18c4('0x13'));var hardwareService=require(_0x18c4('0x14'));var logger=require(_0x18c4('0x15'))(_0x18c4('0x16'));var utils=require(_0x18c4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x18c4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b975f,_0x383032){_0x383032=_0x383032||0xcc;return function(_0x596eb4){if(_0x596eb4){return _0x2b975f['sendStatus'](_0x383032);}return _0x2b975f[_0x18c4('0x19')](_0x383032)[_0x18c4('0x1a')]();};}function respondWithResult(_0x262bb9,_0x118a17){_0x118a17=_0x118a17||0xc8;return function(_0x5dd0db){if(_0x5dd0db){return _0x262bb9[_0x18c4('0x19')](_0x118a17)[_0x18c4('0x1b')](_0x5dd0db);}};}function respondWithFilteredResult(_0x56fa73,_0x35eee3){return function(_0x3a8d68){if(_0x3a8d68){var _0x49381f=typeof _0x35eee3[_0x18c4('0x1c')]===_0x18c4('0x1d')&&typeof _0x35eee3[_0x18c4('0x1e')]===_0x18c4('0x1d');var _0x2aadd2=_0x3a8d68[_0x18c4('0x1f')];var _0x2eb187=_0x49381f?0x0:_0x35eee3[_0x18c4('0x1c')];var _0x3ac423=_0x49381f?_0x3a8d68[_0x18c4('0x1f')]:_0x35eee3[_0x18c4('0x1c')]+_0x35eee3[_0x18c4('0x1e')];var _0x3675e2;if(_0x3ac423>=_0x2aadd2){_0x3ac423=_0x2aadd2;_0x3675e2=0xc8;}else{_0x3675e2=0xce;}_0x56fa73[_0x18c4('0x19')](_0x3675e2);return _0x56fa73[_0x18c4('0x20')](_0x18c4('0x21'),_0x2eb187+'-'+_0x3ac423+'/'+_0x2aadd2)[_0x18c4('0x1b')](_0x3a8d68);}return null;};}function patchUpdates(_0x4168b9){return function(_0x15fdea){try{jsonpatch['apply'](_0x15fdea,_0x4168b9,!![]);}catch(_0x24afb4){return BPromise[_0x18c4('0x22')](_0x24afb4);}return _0x15fdea['save']();};}function saveUpdates(_0x3f773f,_0x1cc161){return function(_0x262409){if(_0x262409){return _0x262409[_0x18c4('0x23')](_0x3f773f)['then'](function(_0x4003ab){return _0x4003ab;});}return null;};}function removeEntity(_0x21fc25,_0x1aaa5e){return function(_0x357bc0){if(_0x357bc0){return _0x357bc0['destroy']()[_0x18c4('0x24')](function(){_0x21fc25[_0x18c4('0x19')](0xcc)[_0x18c4('0x1a')]();});}};}function handleEntityNotFound(_0x88524e,_0x513d9f){return function(_0x33b2e6){if(!_0x33b2e6){_0x88524e[_0x18c4('0x25')](0x194);}return _0x33b2e6;};}function handleError(_0x4bae16,_0x44dfc7){_0x44dfc7=_0x44dfc7||0x1f4;return function(_0x16b06b){logger[_0x18c4('0x26')](_0x16b06b[_0x18c4('0x27')]);if(_0x16b06b['name']){delete _0x16b06b['name'];}_0x4bae16['status'](_0x44dfc7)[_0x18c4('0x28')](_0x16b06b);};}exports['index']=function(_0x372909,_0x5092f5){var _0x42bfae={},_0x350ff5={},_0x1c2969={'count':0x0,'rows':[]};var _0x12b1d0=_[_0x18c4('0x29')](db[_0x18c4('0x2a')]['rawAttributes'],function(_0x12c124){return{'name':_0x12c124['fieldName'],'type':_0x12c124['type'][_0x18c4('0x2b')]};});_0x350ff5['model']=_[_0x18c4('0x29')](_0x12b1d0,_0x18c4('0x2c'));_0x350ff5[_0x18c4('0x2d')]=_[_0x18c4('0x2e')](_0x372909['query']);_0x350ff5['filters']=_['intersection'](_0x350ff5[_0x18c4('0x2f')],_0x350ff5[_0x18c4('0x2d')]);_0x42bfae[_0x18c4('0x30')]=_[_0x18c4('0x31')](_0x350ff5[_0x18c4('0x2f')],qs['fields'](_0x372909[_0x18c4('0x2d')][_0x18c4('0x32')]));_0x42bfae[_0x18c4('0x30')]=_0x42bfae[_0x18c4('0x30')][_0x18c4('0x33')]?_0x42bfae[_0x18c4('0x30')]:_0x350ff5['model'];if(!_0x372909[_0x18c4('0x2d')]['hasOwnProperty'](_0x18c4('0x34'))){_0x42bfae[_0x18c4('0x1e')]=qs['limit'](_0x372909['query'][_0x18c4('0x1e')]);_0x42bfae[_0x18c4('0x1c')]=qs[_0x18c4('0x1c')](_0x372909['query']['offset']);}_0x42bfae[_0x18c4('0x35')]=qs[_0x18c4('0x36')](_0x372909[_0x18c4('0x2d')]['sort']);_0x42bfae[_0x18c4('0x37')]=qs[_0x18c4('0x38')](_[_0x18c4('0x39')](_0x372909[_0x18c4('0x2d')],_0x350ff5['filters']),_0x12b1d0);if(_0x372909[_0x18c4('0x2d')][_0x18c4('0x3a')]){_0x42bfae[_0x18c4('0x37')]=_[_0x18c4('0x3b')](_0x42bfae[_0x18c4('0x37')],{'$or':_[_0x18c4('0x29')](_0x12b1d0,function(_0x1052fb){if(_0x1052fb['type']!==_0x18c4('0x3c')){var _0xcb8ee6={};_0xcb8ee6[_0x1052fb[_0x18c4('0x2c')]]={'$like':'%'+_0x372909[_0x18c4('0x2d')][_0x18c4('0x3a')]+'%'};return _0xcb8ee6;}})});}_0x42bfae=_['merge']({},_0x42bfae,_0x372909[_0x18c4('0x3d')]);var _0x17d3f4={'where':_0x42bfae[_0x18c4('0x37')]};return db[_0x18c4('0x2a')][_0x18c4('0x1f')](_0x17d3f4)['then'](function(_0x3c8cf1){_0x1c2969[_0x18c4('0x1f')]=_0x3c8cf1;if(_0x372909[_0x18c4('0x2d')][_0x18c4('0x3e')]){_0x42bfae[_0x18c4('0x3f')]=[{'all':!![]}];}return db[_0x18c4('0x2a')]['findAll'](_0x42bfae);})[_0x18c4('0x24')](function(_0x3cd38f){_0x1c2969['rows']=_0x3cd38f;return _0x1c2969;})[_0x18c4('0x24')](respondWithFilteredResult(_0x5092f5,_0x42bfae))[_0x18c4('0x40')](handleError(_0x5092f5,null));};exports[_0x18c4('0x41')]=function(_0xb692e1,_0x47911d){var _0xfa7404={'raw':![],'where':{'id':_0xb692e1['params']['id']}},_0xa442b1={};_0xa442b1[_0x18c4('0x2f')]=_['keys'](db[_0x18c4('0x2a')][_0x18c4('0x42')]);_0xa442b1[_0x18c4('0x2d')]=_[_0x18c4('0x2e')](_0xb692e1['query']);_0xa442b1[_0x18c4('0x38')]=_[_0x18c4('0x31')](_0xa442b1[_0x18c4('0x2f')],_0xa442b1[_0x18c4('0x2d')]);_0xfa7404[_0x18c4('0x30')]=_['intersection'](_0xa442b1[_0x18c4('0x2f')],qs['fields'](_0xb692e1[_0x18c4('0x2d')][_0x18c4('0x32')]));_0xfa7404[_0x18c4('0x30')]=_0xfa7404[_0x18c4('0x30')][_0x18c4('0x33')]?_0xfa7404[_0x18c4('0x30')]:_0xa442b1[_0x18c4('0x2f')];if(_0xb692e1[_0x18c4('0x2d')][_0x18c4('0x3e')]){_0xfa7404[_0x18c4('0x3f')]=[{'all':!![]}];}_0xfa7404=_[_0x18c4('0x3b')]({},_0xfa7404,_0xb692e1[_0x18c4('0x3d')]);return db['UserProfileSection']['find'](_0xfa7404)[_0x18c4('0x24')](handleEntityNotFound(_0x47911d,null))[_0x18c4('0x24')](respondWithResult(_0x47911d,null))['catch'](handleError(_0x47911d,null));};exports[_0x18c4('0x43')]=function(_0x29ca01,_0x435355){return db[_0x18c4('0x2a')][_0x18c4('0x43')](_0x29ca01[_0x18c4('0x44')],{})[_0x18c4('0x24')](respondWithResult(_0x435355,0xc9))[_0x18c4('0x40')](handleError(_0x435355,null));};exports[_0x18c4('0x23')]=function(_0x260c06,_0x21fb65){if(_0x260c06['body']['id']){delete _0x260c06[_0x18c4('0x44')]['id'];}return db[_0x18c4('0x2a')][_0x18c4('0x45')]({'where':{'id':_0x260c06[_0x18c4('0x46')]['id']}})[_0x18c4('0x24')](handleEntityNotFound(_0x21fb65,null))[_0x18c4('0x24')](saveUpdates(_0x260c06[_0x18c4('0x44')],null))[_0x18c4('0x24')](respondWithResult(_0x21fb65,null))['catch'](handleError(_0x21fb65,null));};exports[_0x18c4('0x47')]=function(_0x37a68e,_0x12adcc){return db[_0x18c4('0x2a')]['find']({'where':{'id':_0x37a68e[_0x18c4('0x46')]['id']}})['then'](handleEntityNotFound(_0x12adcc,null))[_0x18c4('0x24')](removeEntity(_0x12adcc,null))[_0x18c4('0x40')](handleError(_0x12adcc,null));};exports[_0x18c4('0x48')]=function(_0x142eda,_0x142fbe){return db[_0x18c4('0x2a')][_0x18c4('0x48')]()[_0x18c4('0x24')](respondWithResult(_0x142fbe,null))[_0x18c4('0x40')](handleError(_0x142fbe,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index bb8ff43..b9c2704 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cd2=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','UserProfileSection'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x8cd2,0x12a));var _0x28cd=function(_0x194d23,_0x35b80e){_0x194d23=_0x194d23-0x0;var _0x159102=_0x8cd2[_0x194d23];return _0x159102;};'use strict';var _=require('lodash');var util=require(_0x28cd('0x0'));var logger=require(_0x28cd('0x1'))(_0x28cd('0x2'));var moment=require(_0x28cd('0x3'));var BPromise=require(_0x28cd('0x4'));var rp=require(_0x28cd('0x5'));var fs=require('fs');var path=require(_0x28cd('0x6'));var rimraf=require(_0x28cd('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x545b25,_0x3e782a){return _0x545b25[_0x28cd('0x8')](_0x28cd('0x9'),attributes,{'tableName':_0x28cd('0xa'),'paranoid':![],'indexes':[{'name':_0x28cd('0xb'),'fields':[_0x28cd('0xc'),_0x28cd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc434=['bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x5f0fb7,_0x2165ac){var _0x5c9045=function(_0x2cd2ac){while(--_0x2cd2ac){_0x5f0fb7['push'](_0x5f0fb7['shift']());}};_0x5c9045(++_0x2165ac);}(_0xc434,0x17b));var _0x4c43=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xc434[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x4c43('0x0'));var util=require(_0x4c43('0x1'));var logger=require(_0x4c43('0x2'))(_0x4c43('0x3'));var moment=require(_0x4c43('0x4'));var BPromise=require(_0x4c43('0x5'));var rp=require(_0x4c43('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c43('0x7'));var config=require(_0x4c43('0x8'));var attributes=require(_0x4c43('0x9'));module[_0x4c43('0xa')]=function(_0x1c2502,_0x49e801){return _0x1c2502[_0x4c43('0xb')](_0x4c43('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x4c43('0xd'),'fields':[_0x4c43('0xe'),_0x4c43('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a3d8c2f..5bdebff 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b8b=['then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x4b8b,0x16a));var _0xb4b8=function(_0xc65834,_0x5df6fb){_0xc65834=_0xc65834-0x0;var _0x5da298=_0x4b8b[_0xc65834];return _0x5da298;};'use strict';var _=require(_0xb4b8('0x0'));var util=require(_0xb4b8('0x1'));var moment=require(_0xb4b8('0x2'));var BPromise=require(_0xb4b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4b8('0x4'))['db'];var utils=require(_0xb4b8('0x5'));var logger=require('../../config/logger')(_0xb4b8('0x6'));var config=require(_0xb4b8('0x7'));var jayson=require(_0xb4b8('0x8'));var client=jayson[_0xb4b8('0x9')][_0xb4b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101b8f,_0x33d218,_0x1f607b){return new BPromise(function(_0x2e0e26,_0x8dff27){return client[_0xb4b8('0xb')](_0x101b8f,_0x1f607b)[_0xb4b8('0xc')](function(_0x34d86e){logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));logger['debug'](_0xb4b8('0x10'),_0x33d218,'request\x20sent',JSON[_0xb4b8('0x11')](_0x34d86e));if(_0x34d86e['error']){if(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x13')]===0x1f4){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')]['message']);return _0x8dff27(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);return _0x2e0e26(_0x34d86e[_0xb4b8('0x12')][_0xb4b8('0x14')]);}else{logger[_0xb4b8('0xd')](_0xb4b8('0xe'),_0x33d218,_0xb4b8('0xf'));_0x2e0e26(_0x34d86e[_0xb4b8('0x15')][_0xb4b8('0x14')]);}})['catch'](function(_0x10c7b9){logger[_0xb4b8('0x12')](_0xb4b8('0xe'),_0x33d218,_0x10c7b9);_0x8dff27(_0x10c7b9);});});} \ No newline at end of file +var _0x855e=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash'];(function(_0x54f859,_0x59d463){var _0x17a08b=function(_0x3f8e49){while(--_0x3f8e49){_0x54f859['push'](_0x54f859['shift']());}};_0x17a08b(++_0x59d463);}(_0x855e,0x1af));var _0xe855=function(_0x1f909a,_0x15d56f){_0x1f909a=_0x1f909a-0x0;var _0x543f16=_0x855e[_0x1f909a];return _0x543f16;};'use strict';var _=require(_0xe855('0x0'));var util=require(_0xe855('0x1'));var moment=require(_0xe855('0x2'));var BPromise=require(_0xe855('0x3'));var rs=require(_0xe855('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe855('0x5'))['db'];var utils=require(_0xe855('0x6'));var logger=require(_0xe855('0x7'))(_0xe855('0x8'));var config=require(_0xe855('0x9'));var jayson=require(_0xe855('0xa'));var client=jayson[_0xe855('0xb')][_0xe855('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58be7e,_0x3a598e,_0x127739){return new BPromise(function(_0x812b79,_0x3cf2b2){return client[_0xe855('0xd')](_0x58be7e,_0x127739)[_0xe855('0xe')](function(_0x27b04c){logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));logger[_0xe855('0x12')](_0xe855('0x13'),_0x3a598e,_0xe855('0x11'),JSON[_0xe855('0x14')](_0x27b04c));if(_0x27b04c[_0xe855('0x15')]){if(_0x27b04c[_0xe855('0x15')][_0xe855('0x16')]===0x1f4){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c[_0xe855('0x15')]['message']);return _0x3cf2b2(_0x27b04c[_0xe855('0x15')][_0xe855('0x17')]);}logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x27b04c['error']['message']);return _0x812b79(_0x27b04c[_0xe855('0x15')]['message']);}else{logger[_0xe855('0xf')](_0xe855('0x10'),_0x3a598e,_0xe855('0x11'));_0x812b79(_0x27b04c['result']['message']);}})['catch'](function(_0x312920){logger[_0xe855('0x15')](_0xe855('0x10'),_0x3a598e,_0x312920);_0x3cf2b2(_0x312920);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 07a0538..9eca998 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x23e346,_0x2ffc96){var _0x58fd5a=function(_0x47052e){while(--_0x47052e){_0x23e346['push'](_0x23e346['shift']());}};_0x58fd5a(++_0x2ffc96);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xb4a3bd,_0x39f574){var _0x26fef9=function(_0x2c79a3){while(--_0x2c79a3){_0xb4a3bd['push'](_0xb4a3bd['shift']());}};_0x26fef9(++_0x39f574);}(_0x70e0,0x17b));var _0x070e=function(_0x386f18,_0xba8833){_0x386f18=_0x386f18-0x0;var _0x393c32=_0x70e0[_0x386f18];return _0x393c32;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 4da9bab..c5de81f 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5da0=['sequelize','INTEGER'];(function(_0x9fdfc5,_0x5ae737){var _0x206a78=function(_0x4d0a5d){while(--_0x4d0a5d){_0x9fdfc5['push'](_0x9fdfc5['shift']());}};_0x206a78(++_0x5ae737);}(_0x5da0,0x1be));var _0x05da=function(_0x2762fc,_0x4d21a6){_0x2762fc=_0x2762fc-0x0;var _0x1ae50b=_0x5da0[_0x2762fc];return _0x1ae50b;};'use strict';var Sequelize=require(_0x05da('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x05da('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1ac6=['sequelize','exports','INTEGER'];(function(_0x1528a6,_0x4b70f8){var _0x1d0e0a=function(_0x474eb7){while(--_0x474eb7){_0x1528a6['push'](_0x1528a6['shift']());}};_0x1d0e0a(++_0x4b70f8);}(_0x1ac6,0x10b));var _0x61ac=function(_0x42b949,_0x5ef2cd){_0x42b949=_0x42b949-0x0;var _0x1bd737=_0x1ac6[_0x42b949];return _0x1bd737;};'use strict';var Sequelize=require(_0x61ac('0x0'));module[_0x61ac('0x1')]={'penalty':{'type':Sequelize[_0x61ac('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0bb274f..8e9a7db 100644 --- a/server/api/userSmsQueue/userSmsQueue.model.js +++ b/server/api/userSmsQueue/userSmsQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdec3=['../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1c75ec,_0x26f5d8){var _0x1a8443=function(_0x5e88b8){while(--_0x5e88b8){_0x1c75ec['push'](_0x1c75ec['shift']());}};_0x1a8443(++_0x26f5d8);}(_0xdec3,0x89));var _0x3dec=function(_0x28f459,_0x1d0c6c){_0x28f459=_0x28f459-0x0;var _0x54fb2e=_0xdec3[_0x28f459];return _0x54fb2e;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var logger=require(_0x3dec('0x1'))(_0x3dec('0x2'));var moment=require(_0x3dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dec('0x4'));var fs=require('fs');var path=require(_0x3dec('0x5'));var rimraf=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x3dec('0x8')]=function(_0x2894eb,_0x347c06){return _0x2894eb[_0x3dec('0x9')](_0x3dec('0xa'),attributes,{'tableName':_0x3dec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6691=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0x6691,0x12d));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var logger=require(_0x1669('0x2'))(_0x1669('0x3'));var moment=require(_0x1669('0x4'));var BPromise=require(_0x1669('0x5'));var rp=require(_0x1669('0x6'));var fs=require('fs');var path=require(_0x1669('0x7'));var rimraf=require(_0x1669('0x8'));var config=require(_0x1669('0x9'));var attributes=require('./userSmsQueue.attributes');module[_0x1669('0xa')]=function(_0x1bf2c8,_0x30f92c){return _0x1bf2c8[_0x1669('0xb')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 62c0382..3a186a5 100644 --- a/server/api/userSmsQueue/userSmsQueue.rpc.js +++ b/server/api/userSmsQueue/userSmsQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3bb=['error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','code'];(function(_0x14e442,_0x36b1bd){var _0x1385e2=function(_0x2535b5){while(--_0x2535b5){_0x14e442['push'](_0x14e442['shift']());}};_0x1385e2(++_0x36b1bd);}(_0xc3bb,0x129));var _0xbc3b=function(_0x1a065f,_0x4e5dde){_0x1a065f=_0x1a065f-0x0;var _0x55509a=_0xc3bb[_0x1a065f];return _0x55509a;};'use strict';var _=require('lodash');var util=require(_0xbc3b('0x0'));var moment=require(_0xbc3b('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc3b('0x2'));var fs=require('fs');var Redis=require(_0xbc3b('0x3'));var db=require(_0xbc3b('0x4'))['db'];var utils=require(_0xbc3b('0x5'));var logger=require('../../config/logger')(_0xbc3b('0x6'));var config=require(_0xbc3b('0x7'));var jayson=require(_0xbc3b('0x8'));var client=jayson['client'][_0xbc3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed2d6d,_0x53bfc7,_0x1d5b8a){return new BPromise(function(_0x10b92c,_0x13d266){return client[_0xbc3b('0xa')](_0xed2d6d,_0x1d5b8a)[_0xbc3b('0xb')](function(_0x14a180){logger[_0xbc3b('0xc')](_0xbc3b('0xd'),_0x53bfc7,'request\x20sent');logger[_0xbc3b('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x53bfc7,_0xbc3b('0xf'),JSON[_0xbc3b('0x10')](_0x14a180));if(_0x14a180['error']){if(_0x14a180['error'][_0xbc3b('0x11')]===0x1f4){logger[_0xbc3b('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x53bfc7,_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);return _0x13d266(_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);}logger[_0xbc3b('0x12')](_0xbc3b('0xd'),_0x53bfc7,_0x14a180[_0xbc3b('0x12')][_0xbc3b('0x13')]);return _0x10b92c(_0x14a180['error'][_0xbc3b('0x13')]);}else{logger[_0xbc3b('0xc')](_0xbc3b('0xd'),_0x53bfc7,_0xbc3b('0xf'));_0x10b92c(_0x14a180['result'][_0xbc3b('0x13')]);}})[_0xbc3b('0x14')](function(_0x36fb3e){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x53bfc7,_0x36fb3e);_0x13d266(_0x36fb3e);});});} \ No newline at end of file +var _0xf852=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0xca1259,_0x413072){var _0x1162bf=function(_0x26dd81){while(--_0x26dd81){_0xca1259['push'](_0xca1259['shift']());}};_0x1162bf(++_0x413072);}(_0xf852,0x65));var _0x2f85=function(_0x2bc41d,_0x22b03c){_0x2bc41d=_0x2bc41d-0x0;var _0x663f8d=_0xf852[_0x2bc41d];return _0x663f8d;};'use strict';var _=require('lodash');var util=require(_0x2f85('0x0'));var moment=require(_0x2f85('0x1'));var BPromise=require(_0x2f85('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f85('0x3'));var db=require(_0x2f85('0x4'))['db'];var utils=require(_0x2f85('0x5'));var logger=require(_0x2f85('0x6'))('rpc');var config=require(_0x2f85('0x7'));var jayson=require(_0x2f85('0x8'));var client=jayson[_0x2f85('0x9')][_0x2f85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5de7e5,_0x5349f2,_0x7a0c24){return new BPromise(function(_0x222f06,_0x1a2c92){return client[_0x2f85('0xb')](_0x5de7e5,_0x7a0c24)['then'](function(_0x250834){logger[_0x2f85('0xc')](_0x2f85('0xd'),_0x5349f2,'request\x20sent');logger[_0x2f85('0xe')](_0x2f85('0xf'),_0x5349f2,_0x2f85('0x10'),JSON[_0x2f85('0x11')](_0x250834));if(_0x250834[_0x2f85('0x12')]){if(_0x250834[_0x2f85('0x12')][_0x2f85('0x13')]===0x1f4){logger[_0x2f85('0x12')](_0x2f85('0xd'),_0x5349f2,_0x250834[_0x2f85('0x12')][_0x2f85('0x14')]);return _0x1a2c92(_0x250834[_0x2f85('0x12')][_0x2f85('0x14')]);}logger['error'](_0x2f85('0xd'),_0x5349f2,_0x250834[_0x2f85('0x12')]['message']);return _0x222f06(_0x250834[_0x2f85('0x12')][_0x2f85('0x14')]);}else{logger['info'](_0x2f85('0xd'),_0x5349f2,_0x2f85('0x10'));_0x222f06(_0x250834[_0x2f85('0x15')]['message']);}})[_0x2f85('0x16')](function(_0x646389){logger['error'](_0x2f85('0xd'),_0x5349f2,_0x646389);_0x1a2c92(_0x646389);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index fc90637..19bd94a 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e5d=['INTEGER','exports'];(function(_0x353a43,_0x515ac6){var _0x289eb8=function(_0x5bcbc4){while(--_0x5bcbc4){_0x353a43['push'](_0x353a43['shift']());}};_0x289eb8(++_0x515ac6);}(_0x8e5d,0x139));var _0xd8e5=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x8e5d[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require('sequelize');module[_0xd8e5('0x0')]={'UserId':{'type':Sequelize[_0xd8e5('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd8e5('0x1')]}}; \ No newline at end of file +var _0xa92f=['sequelize','INTEGER'];(function(_0x297c92,_0x5b8a20){var _0x3795e3=function(_0x3a0e5c){while(--_0x3a0e5c){_0x297c92['push'](_0x297c92['shift']());}};_0x3795e3(++_0x5b8a20);}(_0xa92f,0xd4));var _0xfa92=function(_0x11d4e5,_0x4a917c){_0x11d4e5=_0x11d4e5-0x0;var _0x1ca4f3=_0xa92f[_0x11d4e5];return _0x1ca4f3;};'use strict';var Sequelize=require(_0xfa92('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xfa92('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xfa92('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 13d5d3d..5076127 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5df421,_0x2c2618){var _0x2b68f1=function(_0x47ddc5){while(--_0x47ddc5){_0x5df421['push'](_0x5df421['shift']());}};_0x2b68f1(++_0x2c2618);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x191b2d,_0x6eb60e){var _0x76cc20=function(_0x127634){while(--_0x127634){_0x191b2d['push'](_0x191b2d['shift']());}};_0x76cc20(++_0x6eb60e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index be1a351..f3448f8 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15db7e,_0x1333e4){var _0x3ef26d=function(_0x40a448){while(--_0x40a448){_0x15db7e['push'](_0x15db7e['shift']());}};_0x3ef26d(++_0x1333e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5560be,_0x185099){var _0x45c44d=function(_0x36d050){while(--_0x36d050){_0x5560be['push'](_0x5560be['shift']());}};_0x45c44d(++_0x185099);}(_0xe706,0xa3));var _0x6e70=function(_0x51cf44,_0x2b04e1){_0x51cf44=_0x51cf44-0x0;var _0xb4dbd6=_0xe706[_0x51cf44];return _0xb4dbd6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index cd68ca2..31cfc8b 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7a0=['exports','INTEGER','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf7a0,0x80));var _0x0f7a=function(_0x582a95,_0x491418){_0x582a95=_0x582a95-0x0;var _0x35aa2b=_0xf7a0[_0x582a95];return _0x35aa2b;};'use strict';var Sequelize=require(_0x0f7a('0x0'));module[_0x0f7a('0x1')]={'penalty':{'type':Sequelize[_0x0f7a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34fb=['exports','sequelize'];(function(_0x250cfd,_0x598f99){var _0x3fbc10=function(_0x3393c7){while(--_0x3393c7){_0x250cfd['push'](_0x250cfd['shift']());}};_0x3fbc10(++_0x598f99);}(_0x34fb,0xdd));var _0xb34f=function(_0x1a4569,_0x253ff8){_0x1a4569=_0x1a4569-0x0;var _0x4bf295=_0x34fb[_0x1a4569];return _0x4bf295;};'use strict';var Sequelize=require(_0xb34f('0x0'));module[_0xb34f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 51be3e9..8ac1da4 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.model.js +++ b/server/api/userVoiceQueue/userVoiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79b4=['api','moment','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','util','../../config/logger'];(function(_0x3bcc22,_0xd8b8f8){var _0x1eaad3=function(_0xc57d06){while(--_0xc57d06){_0x3bcc22['push'](_0x3bcc22['shift']());}};_0x1eaad3(++_0xd8b8f8);}(_0x79b4,0xf8));var _0x479b=function(_0x269133,_0x51004c){_0x269133=_0x269133-0x0;var _0x400de2=_0x79b4[_0x269133];return _0x400de2;};'use strict';var _=require('lodash');var util=require(_0x479b('0x0'));var logger=require(_0x479b('0x1'))(_0x479b('0x2'));var moment=require(_0x479b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x479b('0x4'));var rimraf=require('rimraf');var config=require(_0x479b('0x5'));var attributes=require(_0x479b('0x6'));module[_0x479b('0x7')]=function(_0x1a9cf4,_0x1ccc26){return _0x1a9cf4['define'](_0x479b('0x8'),attributes,{'tableName':_0x479b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe244=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0xe380e0,_0x3c8265){var _0x3f8a75=function(_0x57a03c){while(--_0x57a03c){_0xe380e0['push'](_0xe380e0['shift']());}};_0x3f8a75(++_0x3c8265);}(_0xe244,0x1e7));var _0x4e24=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xe244[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x4e24('0x0'));var util=require(_0x4e24('0x1'));var logger=require(_0x4e24('0x2'))(_0x4e24('0x3'));var moment=require(_0x4e24('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e24('0x5'));var config=require(_0x4e24('0x6'));var attributes=require(_0x4e24('0x7'));module[_0x4e24('0x8')]=function(_0x3842b2,_0x36e5e8){return _0x3842b2[_0x4e24('0x9')](_0x4e24('0xa'),attributes,{'tableName':_0x4e24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 66b5eed..14c8730 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.rpc.js +++ b/server/api/userVoiceQueue/userVoiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc58b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x20d8d3,_0x118ad0){var _0x7c229e=function(_0x1a639b){while(--_0x1a639b){_0x20d8d3['push'](_0x20d8d3['shift']());}};_0x7c229e(++_0x118ad0);}(_0xc58b,0x1df));var _0xbc58=function(_0x3391ad,_0x25691b){_0x3391ad=_0x3391ad-0x0;var _0x4b7925=_0xc58b[_0x3391ad];return _0x4b7925;};'use strict';var _=require(_0xbc58('0x0'));var util=require(_0xbc58('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbc58('0x2'));var fs=require('fs');var Redis=require(_0xbc58('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc58('0x4'))(_0xbc58('0x5'));var config=require(_0xbc58('0x6'));var jayson=require(_0xbc58('0x7'));var client=jayson[_0xbc58('0x8')][_0xbc58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d87c4,_0x51556a,_0x4b0a65){return new BPromise(function(_0x64dfc7,_0x3ce8be){return client[_0xbc58('0xa')](_0x5d87c4,_0x4b0a65)[_0xbc58('0xb')](function(_0x30487f){logger[_0xbc58('0xc')](_0xbc58('0xd'),_0x51556a,_0xbc58('0xe'));logger[_0xbc58('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x51556a,'request\x20sent',JSON['stringify'](_0x30487f));if(_0x30487f['error']){if(_0x30487f['error'][_0xbc58('0x10')]===0x1f4){logger[_0xbc58('0x11')](_0xbc58('0xd'),_0x51556a,_0x30487f[_0xbc58('0x11')]['message']);return _0x3ce8be(_0x30487f[_0xbc58('0x11')][_0xbc58('0x12')]);}logger['error'](_0xbc58('0xd'),_0x51556a,_0x30487f['error'][_0xbc58('0x12')]);return _0x64dfc7(_0x30487f[_0xbc58('0x11')]['message']);}else{logger[_0xbc58('0xc')](_0xbc58('0xd'),_0x51556a,_0xbc58('0xe'));_0x64dfc7(_0x30487f[_0xbc58('0x13')]['message']);}})[_0xbc58('0x14')](function(_0xdb0f02){logger[_0xbc58('0x11')](_0xbc58('0xd'),_0x51556a,_0xdb0f02);_0x3ce8be(_0xdb0f02);});});} \ No newline at end of file +var _0xc5fd=['jayson/promise','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xcb0eb2,_0x3906bf){var _0xbab9b8=function(_0x24fa8a){while(--_0x24fa8a){_0xcb0eb2['push'](_0xcb0eb2['shift']());}};_0xbab9b8(++_0x3906bf);}(_0xc5fd,0x149));var _0xdc5f=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0xc5fd[_0x1562a2];return _0x39a636;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdc5f('0x0'));var BPromise=require(_0xdc5f('0x1'));var rs=require(_0xdc5f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc5f('0x3'));var logger=require(_0xdc5f('0x4'))(_0xdc5f('0x5'));var config=require(_0xdc5f('0x6'));var jayson=require(_0xdc5f('0x7'));var client=jayson['client'][_0xdc5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d4a73,_0x429b33,_0x5998a1){return new BPromise(function(_0x4f1ef0,_0x2808d4){return client['request'](_0x3d4a73,_0x5998a1)[_0xdc5f('0x9')](function(_0x50e6ad){logger[_0xdc5f('0xa')](_0xdc5f('0xb'),_0x429b33,_0xdc5f('0xc'));logger[_0xdc5f('0xd')](_0xdc5f('0xe'),_0x429b33,'request\x20sent',JSON[_0xdc5f('0xf')](_0x50e6ad));if(_0x50e6ad[_0xdc5f('0x10')]){if(_0x50e6ad[_0xdc5f('0x10')][_0xdc5f('0x11')]===0x1f4){logger['error'](_0xdc5f('0xb'),_0x429b33,_0x50e6ad[_0xdc5f('0x10')][_0xdc5f('0x12')]);return _0x2808d4(_0x50e6ad[_0xdc5f('0x10')][_0xdc5f('0x12')]);}logger['error'](_0xdc5f('0xb'),_0x429b33,_0x50e6ad['error'][_0xdc5f('0x12')]);return _0x4f1ef0(_0x50e6ad[_0xdc5f('0x10')][_0xdc5f('0x12')]);}else{logger['info'](_0xdc5f('0xb'),_0x429b33,'request\x20sent');_0x4f1ef0(_0x50e6ad[_0xdc5f('0x13')][_0xdc5f('0x12')]);}})[_0xdc5f('0x14')](function(_0x2e90c7){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x429b33,_0x2e90c7);_0x2808d4(_0x2e90c7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 70087cd..ee6bcdf 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1b6e8d,_0x57ef1e){var _0x55f0bb=function(_0x4b5a71){while(--_0x4b5a71){_0x1b6e8d['push'](_0x1b6e8d['shift']());}};_0x55f0bb(++_0x57ef1e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x24310a,_0x22f59f){var _0x34fe89=function(_0x4a26c2){while(--_0x4a26c2){_0x24310a['push'](_0x24310a['shift']());}};_0x34fe89(++_0x22f59f);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 15339f4..042c3bb 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2408=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x3f1151,_0x173f43){var _0x3abe96=function(_0x20e1e5){while(--_0x20e1e5){_0x3f1151['push'](_0x3f1151['shift']());}};_0x3abe96(++_0x173f43);}(_0x2408,0x97));var _0x8240=function(_0x167dfe,_0x4e5971){_0x167dfe=_0x167dfe-0x0;var _0x2a17ea=_0x2408[_0x167dfe];return _0x2a17ea;};'use strict';var Sequelize=require(_0x8240('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8240('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8240('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x8240('0x2')},'UserId':{'type':Sequelize[_0x8240('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8240('0x3')],'allowNull':![],'unique':_0x8240('0x4'),'comment':_0x8240('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8240('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8240('0x3')],'allowNull':![],'unique':_0x8240('0x4'),'comment':_0x8240('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x8240('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xbb57=['sequelize','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk'];(function(_0x56e76b,_0x3049b5){var _0x8b9240=function(_0x2a381a){while(--_0x2a381a){_0x56e76b['push'](_0x56e76b['shift']());}};_0x8b9240(++_0x3049b5);}(_0xbb57,0x136));var _0x7bb5=function(_0x35020d,_0x3152c8){_0x35020d=_0x35020d-0x0;var _0xff7f9e=_0xbb57[_0x35020d];return _0xff7f9e;};'use strict';var Sequelize=require(_0x7bb5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7bb5('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x7bb5('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x7bb5('0x2')],'allowNull':![],'unique':_0x7bb5('0x3'),'comment':_0x7bb5('0x4')},'VoiceQueueId':{'type':Sequelize[_0x7bb5('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x7bb5('0x2')],'allowNull':![],'unique':_0x7bb5('0x3'),'comment':_0x7bb5('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f4c8f77..7179207 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70a3=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove'];(function(_0x135cbc,_0x633cb7){var _0x1df236=function(_0x1e0864){while(--_0x1e0864){_0x135cbc['push'](_0x135cbc['shift']());}};_0x1df236(++_0x633cb7);}(_0x70a3,0x8b));var _0x370a=function(_0x2d4791,_0x54a483){_0x2d4791=_0x2d4791-0x0;var _0x2099e1=_0x70a3[_0x2d4791];return _0x2099e1;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x370a('0x0'))['db'][_0x370a('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x370a('0x2')](0x0);var events={'afterCreate':_0x370a('0x3'),'afterUpdate':'update','afterDestroy':_0x370a('0x4')};function emitEvent(_0x109a6c){return function(_0x21f638,_0x50b1de,_0x549a0d){UserVoiceQueueRtEvents[_0x370a('0x5')](_0x109a6c+':'+_0x21f638['id'],_0x21f638);UserVoiceQueueRtEvents[_0x370a('0x5')](_0x109a6c,_0x21f638);_0x549a0d(null);};}for(var e in events){if(events[_0x370a('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x370a('0x7')](e,emitEvent(event));}}module[_0x370a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe5f6=['events','../../mysqldb','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b6cc7,_0x5df0c1){var _0x37f564=function(_0x160517){while(--_0x160517){_0x3b6cc7['push'](_0x3b6cc7['shift']());}};_0x37f564(++_0x5df0c1);}(_0xe5f6,0x1dc));var _0x6e5f=function(_0x56477b,_0x3378d5){_0x56477b=_0x56477b-0x0;var _0x2ff160=_0xe5f6[_0x56477b];return _0x2ff160;};'use strict';var EventEmitter=require(_0x6e5f('0x0'));var UserVoiceQueueRt=require(_0x6e5f('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e5f('0x2'),'afterDestroy':_0x6e5f('0x3')};function emitEvent(_0x398252){return function(_0x317af6,_0xcf93b5,_0x2acd75){UserVoiceQueueRtEvents[_0x6e5f('0x4')](_0x398252+':'+_0x317af6['id'],_0x317af6);UserVoiceQueueRtEvents[_0x6e5f('0x4')](_0x398252,_0x317af6);_0x2acd75(null);};}for(var e in events){if(events[_0x6e5f('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x6e5f('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 980164d..ad65a5d 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16d7=['define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x16d7,0x70));var _0x716d=function(_0x2a5486,_0x9996a1){_0x2a5486=_0x2a5486-0x0;var _0x323da9=_0x16d7[_0x2a5486];return _0x323da9;};'use strict';var _=require(_0x716d('0x0'));var util=require(_0x716d('0x1'));var logger=require('../../config/logger')(_0x716d('0x2'));var moment=require(_0x716d('0x3'));var BPromise=require(_0x716d('0x4'));var rp=require(_0x716d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x716d('0x6'));var attributes=require(_0x716d('0x7'));module[_0x716d('0x8')]=function(_0x2af418,_0x40f10b){return _0x2af418[_0x716d('0x9')](_0x716d('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1370=['../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','path'];(function(_0xb344f,_0x3ac8ea){var _0x48ce67=function(_0x486566){while(--_0x486566){_0xb344f['push'](_0xb344f['shift']());}};_0x48ce67(++_0x3ac8ea);}(_0x1370,0x1f4));var _0x0137=function(_0x6330a4,_0x31ce3f){_0x6330a4=_0x6330a4-0x0;var _0x3a9b65=_0x1370[_0x6330a4];return _0x3a9b65;};'use strict';var _=require(_0x0137('0x0'));var util=require(_0x0137('0x1'));var logger=require(_0x0137('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0137('0x3'));var rimraf=require('rimraf');var config=require(_0x0137('0x4'));var attributes=require(_0x0137('0x5'));module[_0x0137('0x6')]=function(_0x371444,_0x1eebcb){return _0x371444[_0x0137('0x7')](_0x0137('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 179ffdd..14eecca 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3395=['bluebird','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','catch','lodash','util','moment'];(function(_0x1ea809,_0x4fa8bb){var _0x54be42=function(_0xe51094){while(--_0xe51094){_0x1ea809['push'](_0x1ea809['shift']());}};_0x54be42(++_0x4fa8bb);}(_0x3395,0x173));var _0x5339=function(_0x42af67,_0x1007d8){_0x42af67=_0x42af67-0x0;var _0x2ce8cd=_0x3395[_0x42af67];return _0x2ce8cd;};'use strict';var _=require(_0x5339('0x0'));var util=require(_0x5339('0x1'));var moment=require(_0x5339('0x2'));var BPromise=require(_0x5339('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5339('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x5339('0x5'));var jayson=require(_0x5339('0x6'));var client=jayson[_0x5339('0x7')]['http']({'port':0x232a});config[_0x5339('0x8')]=_[_0x5339('0x9')](config[_0x5339('0x8')],{'host':_0x5339('0xa'),'port':0x18eb});var socket=require(_0x5339('0xb'))(new Redis(config[_0x5339('0x8')]));require(_0x5339('0xc'))['register'](socket);function respondWithRpcPromise(_0x402a57,_0x18a34b,_0x315d8e){return new BPromise(function(_0x790680,_0x101a29){return client[_0x5339('0xd')](_0x402a57,_0x315d8e)[_0x5339('0xe')](function(_0x2517c3){logger[_0x5339('0xf')](_0x5339('0x10'),_0x18a34b,_0x5339('0x11'));logger[_0x5339('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x18a34b,'request\x20sent',JSON[_0x5339('0x13')](_0x2517c3));if(_0x2517c3['error']){if(_0x2517c3['error'][_0x5339('0x14')]===0x1f4){logger['error'](_0x5339('0x10'),_0x18a34b,_0x2517c3[_0x5339('0x15')]['message']);return _0x101a29(_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);}logger[_0x5339('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x18a34b,_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);return _0x790680(_0x2517c3[_0x5339('0x15')][_0x5339('0x16')]);}else{logger[_0x5339('0xf')](_0x5339('0x10'),_0x18a34b,_0x5339('0x11'));_0x790680(_0x2517c3[_0x5339('0x17')]['message']);}})['catch'](function(_0x3231c3){logger[_0x5339('0x15')](_0x5339('0x10'),_0x18a34b,_0x3231c3);_0x101a29(_0x3231c3);});});}exports[_0x5339('0x18')]=function(_0x3870ca){var _0x243b13=this;return new Promise(function(_0xc3e91a,_0x4502c6){return db['UserVoiceQueueRt'][_0x5339('0x19')]({'raw':_0x3870ca[_0x5339('0x1a')]?_0x3870ca[_0x5339('0x1a')][_0x5339('0x1b')]===undefined?!![]:![]:!![],'where':_0x3870ca['options']?_0x3870ca['options'][_0x5339('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5339('0x1d'),db[_0x5339('0x1e')]['fn']('IF',db[_0x5339('0x1e')][_0x5339('0x1f')](_0x5339('0x20')))),'outboundQueuePauses']]})[_0x5339('0xe')](function(_0x27283d){logger['info'](_0x5339('0x18'),_0x3870ca);logger[_0x5339('0x12')](_0x5339('0x18'),_0x3870ca,JSON[_0x5339('0x13')](_0x27283d));_0xc3e91a(_0x27283d);})[_0x5339('0x21')](function(_0x37b6a2){logger['error']('GetVoiceQueueRtPauses',_0x37b6a2[_0x5339('0x16')],_0x3870ca);_0x4502c6(_0x243b13[_0x5339('0x15')](0x1f4,_0x37b6a2[_0x5339('0x16')]));});});}; \ No newline at end of file +var _0x4aaa=['options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4aaa,0x194));var _0xa4aa=function(_0x509f7a,_0x418a9d){_0x509f7a=_0x509f7a-0x0;var _0x53f890=_0x4aaa[_0x509f7a];return _0x53f890;};'use strict';var _=require(_0xa4aa('0x0'));var util=require('util');var moment=require(_0xa4aa('0x1'));var BPromise=require(_0xa4aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4aa('0x3'));var db=require(_0xa4aa('0x4'))['db'];var utils=require(_0xa4aa('0x5'));var logger=require('../../config/logger')(_0xa4aa('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4aa('0x7'));var client=jayson[_0xa4aa('0x8')][_0xa4aa('0x9')]({'port':0x232a});config[_0xa4aa('0xa')]=_['defaults'](config[_0xa4aa('0xa')],{'host':_0xa4aa('0xb'),'port':0x18eb});var socket=require(_0xa4aa('0xc'))(new Redis(config[_0xa4aa('0xa')]));require(_0xa4aa('0xd'))['register'](socket);function respondWithRpcPromise(_0x211649,_0x1ee552,_0x30f968){return new BPromise(function(_0x27dbb5,_0xd768ae){return client['request'](_0x211649,_0x30f968)[_0xa4aa('0xe')](function(_0x4b336b){logger[_0xa4aa('0xf')](_0xa4aa('0x10'),_0x1ee552,'request\x20sent');logger[_0xa4aa('0x11')](_0xa4aa('0x12'),_0x1ee552,_0xa4aa('0x13'),JSON[_0xa4aa('0x14')](_0x4b336b));if(_0x4b336b[_0xa4aa('0x15')]){if(_0x4b336b['error']['code']===0x1f4){logger[_0xa4aa('0x15')](_0xa4aa('0x10'),_0x1ee552,_0x4b336b[_0xa4aa('0x15')][_0xa4aa('0x16')]);return _0xd768ae(_0x4b336b['error'][_0xa4aa('0x16')]);}logger[_0xa4aa('0x15')](_0xa4aa('0x10'),_0x1ee552,_0x4b336b[_0xa4aa('0x15')][_0xa4aa('0x16')]);return _0x27dbb5(_0x4b336b[_0xa4aa('0x15')]['message']);}else{logger[_0xa4aa('0xf')](_0xa4aa('0x10'),_0x1ee552,_0xa4aa('0x13'));_0x27dbb5(_0x4b336b[_0xa4aa('0x17')][_0xa4aa('0x16')]);}})[_0xa4aa('0x18')](function(_0x6e3679){logger[_0xa4aa('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1ee552,_0x6e3679);_0xd768ae(_0x6e3679);});});}exports[_0xa4aa('0x19')]=function(_0x36ffa5){var _0x2123a4=this;return new Promise(function(_0x36d994,_0x2f6664){return db[_0xa4aa('0x1a')][_0xa4aa('0x1b')]({'raw':_0x36ffa5[_0xa4aa('0x1c')]?_0x36ffa5[_0xa4aa('0x1c')][_0xa4aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x36ffa5[_0xa4aa('0x1c')]?_0x36ffa5[_0xa4aa('0x1c')][_0xa4aa('0x1e')]||null:null,'attributes':[[db[_0xa4aa('0x1f')]['fn'](_0xa4aa('0x20'),db[_0xa4aa('0x1f')]['fn']('IF',db[_0xa4aa('0x1f')][_0xa4aa('0x21')](_0xa4aa('0x22')))),_0xa4aa('0x23')]]})[_0xa4aa('0xe')](function(_0x241dcb){logger['info'](_0xa4aa('0x19'),_0x36ffa5);logger[_0xa4aa('0x11')]('GetVoiceQueueRtPauses',_0x36ffa5,JSON['stringify'](_0x241dcb));_0x36d994(_0x241dcb);})[_0xa4aa('0x18')](function(_0x22c0e7){logger[_0xa4aa('0x15')](_0xa4aa('0x19'),_0x22c0e7[_0xa4aa('0x16')],_0x36ffa5);_0x2f6664(_0x2123a4[_0xa4aa('0x15')](0x1f4,_0x22c0e7[_0xa4aa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9b974a1..e796458 100644 --- a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js +++ b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x282a=['userVoiceQueueRt:','save','remove','update','emit','removeListener','length'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x282a,0xa2));var _0xa282=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x282a[_0x413feb];return _0x40ee88;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa282('0x0'),_0xa282('0x1'),_0xa282('0x2')];function createListener(_0x1b46a8,_0x1f74da){return function(_0x4f7a2b){_0x1f74da[_0xa282('0x3')](_0x1b46a8,_0x4f7a2b);};}function removeListener(_0x3344f0,_0x5af988){return function(){UserVoiceQueueRtEvents[_0xa282('0x4')](_0x3344f0,_0x5af988);};}exports['register']=function(_0x2076ee){for(var _0x54caed=0x0,_0x1a2c3d=events[_0xa282('0x5')];_0x54caed<_0x1a2c3d;_0x54caed++){var _0x1d1e7a=events[_0x54caed];var _0x5e41ef=createListener(_0xa282('0x6')+_0x1d1e7a,_0x2076ee);UserVoiceQueueRtEvents['on'](_0x1d1e7a,_0x5e41ef);}}; \ No newline at end of file +var _0x8958=['removeListener','length','userVoiceQueueRt:','save'];(function(_0x1ad9b4,_0x5df9ed){var _0xbbee74=function(_0x39c75f){while(--_0x39c75f){_0x1ad9b4['push'](_0x1ad9b4['shift']());}};_0xbbee74(++_0x5df9ed);}(_0x8958,0x93));var _0x8895=function(_0x508d27,_0x4eeeba){_0x508d27=_0x508d27-0x0;var _0x14eff9=_0x8958[_0x508d27];return _0x14eff9;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x8895('0x0'),'remove','update'];function createListener(_0x5baab1,_0x4cea64){return function(_0x418b66){_0x4cea64['emit'](_0x5baab1,_0x418b66);};}function removeListener(_0x38d5d7,_0xce4955){return function(){UserVoiceQueueRtEvents[_0x8895('0x1')](_0x38d5d7,_0xce4955);};}exports['register']=function(_0x22fa52){for(var _0x2f03ad=0x0,_0x124e1e=events[_0x8895('0x2')];_0x2f03ad<_0x124e1e;_0x2f03ad++){var _0x33013a=events[_0x2f03ad];var _0x51376b=createListener(_0x8895('0x3')+_0x33013a,_0x22fa52);UserVoiceQueueRtEvents['on'](_0x33013a,_0x51376b);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 637c206..018aa76 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2a7ed2,_0x1548f3){var _0x526e23=function(_0x243811){while(--_0x243811){_0x2a7ed2['push'](_0x2a7ed2['shift']());}};_0x526e23(++_0x1548f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xcb91[_0x3f94f9];return _0x46f84f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 413d9f8..e7fe73b 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b14=['exports','INTEGER'];(function(_0x491d08,_0x19fad0){var _0x4a3b0=function(_0x264d24){while(--_0x264d24){_0x491d08['push'](_0x491d08['shift']());}};_0x4a3b0(++_0x19fad0);}(_0x6b14,0x102));var _0x46b1=function(_0x50c400,_0x264be1){_0x50c400=_0x50c400-0x0;var _0x184e8e=_0x6b14[_0x50c400];return _0x184e8e;};'use strict';var Sequelize=require('sequelize');module[_0x46b1('0x0')]={'penalty':{'type':Sequelize[_0x46b1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfa59=['INTEGER'];(function(_0x1f11dc,_0x54a86d){var _0x3c2810=function(_0x32b3f9){while(--_0x32b3f9){_0x1f11dc['push'](_0x1f11dc['shift']());}};_0x3c2810(++_0x54a86d);}(_0xfa59,0x121));var _0x9fa5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xfa59[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9fa5('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index dbf0c52..43037e3 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x718c=['exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes'];(function(_0x224d0e,_0x2119d8){var _0x148098=function(_0x47cf6d){while(--_0x47cf6d){_0x224d0e['push'](_0x224d0e['shift']());}};_0x148098(++_0x2119d8);}(_0x718c,0xd3));var _0xc718=function(_0x468b46,_0xddc4ab){_0x468b46=_0x468b46-0x0;var _0x451417=_0x718c[_0x468b46];return _0x451417;};'use strict';var _=require(_0xc718('0x0'));var util=require(_0xc718('0x1'));var logger=require(_0xc718('0x2'))(_0xc718('0x3'));var moment=require(_0xc718('0x4'));var BPromise=require(_0xc718('0x5'));var rp=require(_0xc718('0x6'));var fs=require('fs');var path=require(_0xc718('0x7'));var rimraf=require(_0xc718('0x8'));var config=require('../../config/environment');var attributes=require(_0xc718('0x9'));module[_0xc718('0xa')]=function(_0x360a44,_0x4f233c){return _0x360a44['define'](_0xc718('0xb'),attributes,{'tableName':_0xc718('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3354=['../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3354,0x179));var _0x4335=function(_0x5b74b5,_0x2f9a14){_0x5b74b5=_0x5b74b5-0x0;var _0x1db625=_0x3354[_0x5b74b5];return _0x1db625;};'use strict';var _=require('lodash');var util=require(_0x4335('0x0'));var logger=require(_0x4335('0x1'))(_0x4335('0x2'));var moment=require(_0x4335('0x3'));var BPromise=require(_0x4335('0x4'));var rp=require(_0x4335('0x5'));var fs=require('fs');var path=require(_0x4335('0x6'));var rimraf=require('rimraf');var config=require(_0x4335('0x7'));var attributes=require(_0x4335('0x8'));module[_0x4335('0x9')]=function(_0x3d7aa6,_0x318a38){return _0x3d7aa6[_0x4335('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x4335('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 03b8130..28fe36d 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeeae=['../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xe3c242,_0x5be66b){var _0x2a3b71=function(_0x57d236){while(--_0x57d236){_0xe3c242['push'](_0xe3c242['shift']());}};_0x2a3b71(++_0x5be66b);}(_0xeeae,0xf7));var _0xeeea=function(_0x50f0e9,_0x2f9300){_0x50f0e9=_0x50f0e9-0x0;var _0x12dae4=_0xeeae[_0x50f0e9];return _0x12dae4;};'use strict';var _=require(_0xeeea('0x0'));var util=require(_0xeeea('0x1'));var moment=require(_0xeeea('0x2'));var BPromise=require(_0xeeea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeea('0x4'));var db=require(_0xeeea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeeea('0x6'))(_0xeeea('0x7'));var config=require(_0xeeea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeeea('0x9')][_0xeeea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a1dfe,_0x3898c3,_0x62136a){return new BPromise(function(_0x52dd8d,_0x9533ba){return client[_0xeeea('0xb')](_0x4a1dfe,_0x62136a)[_0xeeea('0xc')](function(_0x1d7a98){logger['info'](_0xeeea('0xd'),_0x3898c3,_0xeeea('0xe'));logger[_0xeeea('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3898c3,_0xeeea('0xe'),JSON[_0xeeea('0x10')](_0x1d7a98));if(_0x1d7a98[_0xeeea('0x11')]){if(_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x12')]===0x1f4){logger[_0xeeea('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3898c3,_0x1d7a98['error']['message']);return _0x9533ba(_0x1d7a98['error'][_0xeeea('0x13')]);}logger['error'](_0xeeea('0xd'),_0x3898c3,_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x13')]);return _0x52dd8d(_0x1d7a98[_0xeeea('0x11')][_0xeeea('0x13')]);}else{logger[_0xeeea('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3898c3,_0xeeea('0xe'));_0x52dd8d(_0x1d7a98[_0xeeea('0x15')]['message']);}})[_0xeeea('0x16')](function(_0x3dab28){logger[_0xeeea('0x11')](_0xeeea('0xd'),_0x3898c3,_0x3dab28);_0x9533ba(_0x3dab28);});});} \ No newline at end of file +var _0x2af0=['ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0x2af0,0x95));var _0x02af=function(_0x5921c7,_0x4b5384){_0x5921c7=_0x5921c7-0x0;var _0x6405e9=_0x2af0[_0x5921c7];return _0x6405e9;};'use strict';var _=require(_0x02af('0x0'));var util=require(_0x02af('0x1'));var moment=require(_0x02af('0x2'));var BPromise=require(_0x02af('0x3'));var rs=require(_0x02af('0x4'));var fs=require('fs');var Redis=require(_0x02af('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x02af('0x6'))('rpc');var config=require(_0x02af('0x7'));var jayson=require(_0x02af('0x8'));var client=jayson[_0x02af('0x9')][_0x02af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dfdab,_0x4ef880,_0x1a7685){return new BPromise(function(_0x213ae8,_0x635b52){return client[_0x02af('0xb')](_0x5dfdab,_0x1a7685)[_0x02af('0xc')](function(_0x1be29f){logger['info'](_0x02af('0xd'),_0x4ef880,_0x02af('0xe'));logger[_0x02af('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4ef880,_0x02af('0xe'),JSON[_0x02af('0x10')](_0x1be29f));if(_0x1be29f[_0x02af('0x11')]){if(_0x1be29f[_0x02af('0x11')][_0x02af('0x12')]===0x1f4){logger[_0x02af('0x11')](_0x02af('0xd'),_0x4ef880,_0x1be29f[_0x02af('0x11')]['message']);return _0x635b52(_0x1be29f['error'][_0x02af('0x13')]);}logger[_0x02af('0x11')](_0x02af('0xd'),_0x4ef880,_0x1be29f['error'][_0x02af('0x13')]);return _0x213ae8(_0x1be29f[_0x02af('0x11')][_0x02af('0x13')]);}else{logger[_0x02af('0x14')](_0x02af('0xd'),_0x4ef880,'request\x20sent');_0x213ae8(_0x1be29f['result'][_0x02af('0x13')]);}})[_0x02af('0x15')](function(_0x26f69a){logger['error'](_0x02af('0xd'),_0x4ef880,_0x26f69a);_0x635b52(_0x26f69a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 435fc58..4bd5620 100644 --- a/server/api/variable/index.js +++ b/server/api/variable/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5712=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x438eb3,_0x164c2b){var _0x4e62ba=function(_0x549ae4){while(--_0x549ae4){_0x438eb3['push'](_0x438eb3['shift']());}};_0x4e62ba(++_0x164c2b);}(_0x5712,0x140));var _0x2571=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5712[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var path=require(_0x2571('0x2'));var timeout=require(_0x2571('0x3'));var express=require(_0x2571('0x4'));var router=express[_0x2571('0x5')]();var fs_extra=require(_0x2571('0x6'));var auth=require(_0x2571('0x7'));var interaction=require(_0x2571('0x8'));var config=require(_0x2571('0x9'));var controller=require('./variable.controller');router['get']('/',auth[_0x2571('0xa')](),controller['index']);router[_0x2571('0xb')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0xd')]);router[_0x2571('0xe')]('/',auth[_0x2571('0xa')](),controller['create']);router[_0x2571('0xf')]('/:id',auth[_0x2571('0xa')](),controller[_0x2571('0x10')]);router[_0x2571('0x11')](_0x2571('0xc'),auth[_0x2571('0xa')](),controller[_0x2571('0x12')]);module[_0x2571('0x13')]=router; \ No newline at end of file +var _0xafa5=['./variable.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb85b10,_0x5d5338){var _0x5d5356=function(_0x248b7a){while(--_0x248b7a){_0xb85b10['push'](_0xb85b10['shift']());}};_0x5d5356(++_0x5d5338);}(_0xafa5,0x1af));var _0x5afa=function(_0x53fdd1,_0x23c6b7){_0x53fdd1=_0x53fdd1-0x0;var _0x2b9cd6=_0xafa5[_0x53fdd1];return _0x2b9cd6;};'use strict';var multer=require('multer');var util=require(_0x5afa('0x0'));var path=require(_0x5afa('0x1'));var timeout=require(_0x5afa('0x2'));var express=require(_0x5afa('0x3'));var router=express[_0x5afa('0x4')]();var fs_extra=require(_0x5afa('0x5'));var auth=require(_0x5afa('0x6'));var interaction=require(_0x5afa('0x7'));var config=require(_0x5afa('0x8'));var controller=require(_0x5afa('0x9'));router[_0x5afa('0xa')]('/',auth['isAuthenticated'](),controller[_0x5afa('0xb')]);router[_0x5afa('0xa')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0xe')]);router[_0x5afa('0xf')]('/',auth[_0x5afa('0xd')](),controller[_0x5afa('0x10')]);router[_0x5afa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5afa('0x12')]);router[_0x5afa('0x13')](_0x5afa('0xc'),auth[_0x5afa('0xd')](),controller[_0x5afa('0x14')]);module[_0x5afa('0x15')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 4731443..8aa54e3 100644 --- a/server/api/variable/variable.attributes.js +++ b/server/api/variable/variable.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdc2=['sequelize','STRING'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xcdc2,0xae));var _0x2cdc=function(_0x39e3a,_0x2231a6){_0x39e3a=_0x39e3a-0x0;var _0x2294d8=_0xcdc2[_0x39e3a];return _0x2294d8;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'name':{'type':Sequelize[_0x2cdc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2cdc('0x1')]}}; \ No newline at end of file +var _0x4355=['name','STRING','sequelize','exports'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x4355,0x196));var _0x5435=function(_0x345ced,_0x3cd8b8){_0x345ced=_0x345ced-0x0;var _0x252253=_0x4355[_0x345ced];return _0x252253;};'use strict';var Sequelize=require(_0x5435('0x0'));module[_0x5435('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5435('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5435('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 301d597..0230633 100644 --- a/server/api/variable/variable.controller.js +++ b/server/api/variable/variable.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x105c=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','Variable','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x105c,0xed));var _0xc105=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x105c[_0x5a1a51];return _0x47edd7;};'use strict';var emlformat=require(_0xc105('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc105('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc105('0x2'));var moment=require(_0xc105('0x3'));var BPromise=require(_0xc105('0x4'));var Mustache=require(_0xc105('0x5'));var util=require('util');var path=require(_0xc105('0x6'));var sox=require(_0xc105('0x7'));var csv=require(_0xc105('0x8'));var ejs=require(_0xc105('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc105('0xa'));var squel=require(_0xc105('0xb'));var crypto=require(_0xc105('0xc'));var jsforce=require(_0xc105('0xd'));var deskjs=require(_0xc105('0xe'));var toCsv=require(_0xc105('0x8'));var querystring=require(_0xc105('0xf'));var Papa=require(_0xc105('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc105('0x11'));var hardwareService=require(_0xc105('0x12'));var logger=require(_0xc105('0x13'))(_0xc105('0x14'));var utils=require(_0xc105('0x15'));var config=require(_0xc105('0x16'));var licenseUtil=require(_0xc105('0x17'));var db=require(_0xc105('0x18'))['db'];function respondWithStatusCode(_0x463785,_0xf10776){_0xf10776=_0xf10776||0xcc;return function(_0x5de634){if(_0x5de634){return _0x463785[_0xc105('0x19')](_0xf10776);}return _0x463785['status'](_0xf10776)[_0xc105('0x1a')]();};}function respondWithResult(_0x3f28a0,_0x2f68a4){_0x2f68a4=_0x2f68a4||0xc8;return function(_0x2c2e3a){if(_0x2c2e3a){return _0x3f28a0[_0xc105('0x1b')](_0x2f68a4)[_0xc105('0x1c')](_0x2c2e3a);}};}function respondWithFilteredResult(_0x813ed0,_0x1ec3df){return function(_0x3aa839){if(_0x3aa839){var _0x14bfcc=typeof _0x1ec3df[_0xc105('0x1d')]==='undefined'&&typeof _0x1ec3df['limit']===_0xc105('0x1e');var _0x2ba40e=_0x3aa839[_0xc105('0x1f')];var _0x193530=_0x14bfcc?0x0:_0x1ec3df[_0xc105('0x1d')];var _0x4fcf2f=_0x14bfcc?_0x3aa839['count']:_0x1ec3df[_0xc105('0x1d')]+_0x1ec3df[_0xc105('0x20')];var _0x454e5f;if(_0x4fcf2f>=_0x2ba40e){_0x4fcf2f=_0x2ba40e;_0x454e5f=0xc8;}else{_0x454e5f=0xce;}_0x813ed0[_0xc105('0x1b')](_0x454e5f);return _0x813ed0[_0xc105('0x21')](_0xc105('0x22'),_0x193530+'-'+_0x4fcf2f+'/'+_0x2ba40e)[_0xc105('0x1c')](_0x3aa839);}return null;};}function patchUpdates(_0x161377){return function(_0x70215){try{jsonpatch[_0xc105('0x23')](_0x70215,_0x161377,!![]);}catch(_0x35faa7){return BPromise[_0xc105('0x24')](_0x35faa7);}return _0x70215[_0xc105('0x25')]();};}function saveUpdates(_0x2eddf9,_0x2bb349){return function(_0x263a30){if(_0x263a30){return _0x263a30[_0xc105('0x26')](_0x2eddf9)[_0xc105('0x27')](function(_0x5cc371){return _0x5cc371;});}return null;};}function removeEntity(_0x22cd0c,_0x4385b4){return function(_0x593b45){if(_0x593b45){return _0x593b45[_0xc105('0x28')]()[_0xc105('0x27')](function(){var _0x55d5f3=_0x593b45[_0xc105('0x29')]({'plain':!![]});var _0x44fe54='Variables';return db[_0xc105('0x2a')][_0xc105('0x28')]({'where':{'type':_0x44fe54,'resourceId':_0x55d5f3['id']}})[_0xc105('0x27')](function(){return _0x593b45;});})[_0xc105('0x27')](function(){_0x22cd0c[_0xc105('0x1b')](0xcc)[_0xc105('0x1a')]();});}};}function handleEntityNotFound(_0x59a624,_0x52a1a5){return function(_0x109cee){if(!_0x109cee){_0x59a624[_0xc105('0x19')](0x194);}return _0x109cee;};}function handleError(_0x333981,_0x17bffc){_0x17bffc=_0x17bffc||0x1f4;return function(_0x2bf8ff){logger[_0xc105('0x2b')](_0x2bf8ff[_0xc105('0x2c')]);if(_0x2bf8ff[_0xc105('0x2d')]){delete _0x2bf8ff[_0xc105('0x2d')];}_0x333981[_0xc105('0x1b')](_0x17bffc)[_0xc105('0x2e')](_0x2bf8ff);};}exports[_0xc105('0x2f')]=function(_0x1c4ed2,_0x3bd94b){var _0x56ac8e={},_0x2f66d6={},_0xd7aca4={'count':0x0,'rows':[]};var _0xca60b1=_[_0xc105('0x30')](db['Variable'][_0xc105('0x31')],function(_0x1f0220){return{'name':_0x1f0220[_0xc105('0x32')],'type':_0x1f0220['type'][_0xc105('0x33')]};});_0x2f66d6[_0xc105('0x34')]=_[_0xc105('0x30')](_0xca60b1,_0xc105('0x2d'));_0x2f66d6['query']=_['keys'](_0x1c4ed2[_0xc105('0x35')]);_0x2f66d6['filters']=_[_0xc105('0x36')](_0x2f66d6[_0xc105('0x34')],_0x2f66d6[_0xc105('0x35')]);_0x56ac8e['attributes']=_['intersection'](_0x2f66d6[_0xc105('0x34')],qs[_0xc105('0x37')](_0x1c4ed2[_0xc105('0x35')]['fields']));_0x56ac8e[_0xc105('0x38')]=_0x56ac8e[_0xc105('0x38')]['length']?_0x56ac8e[_0xc105('0x38')]:_0x2f66d6['model'];if(!_0x1c4ed2[_0xc105('0x35')][_0xc105('0x39')]('nolimit')){_0x56ac8e[_0xc105('0x20')]=qs[_0xc105('0x20')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x20')]);_0x56ac8e[_0xc105('0x1d')]=qs[_0xc105('0x1d')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x1d')]);}_0x56ac8e['order']=qs[_0xc105('0x3a')](_0x1c4ed2[_0xc105('0x35')][_0xc105('0x3a')]);_0x56ac8e[_0xc105('0x3b')]=qs['filters'](_[_0xc105('0x3c')](_0x1c4ed2[_0xc105('0x35')],_0x2f66d6[_0xc105('0x3d')]),_0xca60b1);if(_0x1c4ed2[_0xc105('0x35')]['filter']){_0x56ac8e['where']=_[_0xc105('0x3e')](_0x56ac8e[_0xc105('0x3b')],{'$or':_[_0xc105('0x30')](_0xca60b1,function(_0x44e8ab){if(_0x44e8ab[_0xc105('0x3f')]!==_0xc105('0x40')){var _0x4de248={};_0x4de248[_0x44e8ab[_0xc105('0x2d')]]={'$like':'%'+_0x1c4ed2['query'][_0xc105('0x41')]+'%'};return _0x4de248;}})});}_0x56ac8e=_[_0xc105('0x3e')]({},_0x56ac8e,_0x1c4ed2[_0xc105('0x42')]);var _0x4f4538={'where':_0x56ac8e[_0xc105('0x3b')]};return db['Variable']['count'](_0x4f4538)[_0xc105('0x27')](function(_0x2df467){_0xd7aca4[_0xc105('0x1f')]=_0x2df467;if(_0x1c4ed2[_0xc105('0x35')][_0xc105('0x43')]){_0x56ac8e[_0xc105('0x44')]=[{'all':!![]}];}return db[_0xc105('0x45')][_0xc105('0x46')](_0x56ac8e);})['then'](function(_0x5c3988){_0xd7aca4[_0xc105('0x47')]=_0x5c3988;return _0xd7aca4;})['then'](respondWithFilteredResult(_0x3bd94b,_0x56ac8e))[_0xc105('0x48')](handleError(_0x3bd94b,null));};exports[_0xc105('0x49')]=function(_0x8b20c8,_0x43fde1){var _0x26a20a={'raw':!![],'where':{'id':_0x8b20c8[_0xc105('0x4a')]['id']}},_0x1b4f34={};_0x1b4f34['model']=_[_0xc105('0x4b')](db[_0xc105('0x45')][_0xc105('0x31')]);_0x1b4f34[_0xc105('0x35')]=_[_0xc105('0x4b')](_0x8b20c8[_0xc105('0x35')]);_0x1b4f34[_0xc105('0x3d')]=_[_0xc105('0x36')](_0x1b4f34[_0xc105('0x34')],_0x1b4f34[_0xc105('0x35')]);_0x26a20a[_0xc105('0x38')]=_[_0xc105('0x36')](_0x1b4f34[_0xc105('0x34')],qs[_0xc105('0x37')](_0x8b20c8[_0xc105('0x35')][_0xc105('0x37')]));_0x26a20a[_0xc105('0x38')]=_0x26a20a[_0xc105('0x38')][_0xc105('0x4c')]?_0x26a20a['attributes']:_0x1b4f34[_0xc105('0x34')];if(_0x8b20c8[_0xc105('0x35')]['includeAll']){_0x26a20a[_0xc105('0x44')]=[{'all':!![]}];}_0x26a20a=_[_0xc105('0x3e')]({},_0x26a20a,_0x8b20c8[_0xc105('0x42')]);return db[_0xc105('0x45')][_0xc105('0x4d')](_0x26a20a)[_0xc105('0x27')](handleEntityNotFound(_0x43fde1,null))[_0xc105('0x27')](respondWithResult(_0x43fde1,null))['catch'](handleError(_0x43fde1,null));};exports['create']=function(_0xac50a4,_0x4b3885){return db['Variable'][_0xc105('0x4e')](_0xac50a4[_0xc105('0x4f')],{})['then'](function(_0x1dc5da){var _0x31167d=_0xac50a4[_0xc105('0x50')][_0xc105('0x29')]({'plain':!![]});if(!_0x31167d)throw new Error(_0xc105('0x51'));if(_0x31167d[_0xc105('0x52')]===_0xc105('0x50')){var _0x8cc4b6=_0x1dc5da[_0xc105('0x29')]({'plain':!![]});var _0xb39969='Variables';return db[_0xc105('0x53')][_0xc105('0x4d')]({'where':{'name':_0xb39969,'userProfileId':_0x31167d[_0xc105('0x54')]},'raw':!![]})[_0xc105('0x27')](function(_0x598d3e){if(_0x598d3e&&_0x598d3e['autoAssociation']===0x0){return db['UserProfileResource'][_0xc105('0x4e')]({'name':_0x8cc4b6[_0xc105('0x2d')],'resourceId':_0x8cc4b6['id'],'type':_0x598d3e[_0xc105('0x2d')],'sectionId':_0x598d3e['id']},{})[_0xc105('0x27')](function(){return _0x1dc5da;});}else{return _0x1dc5da;}})[_0xc105('0x48')](function(_0x56a4b3){logger[_0xc105('0x2b')](_0xc105('0x55'),_0x56a4b3);throw _0x56a4b3;});}return _0x1dc5da;})[_0xc105('0x27')](respondWithResult(_0x4b3885,0xc9))[_0xc105('0x48')](handleError(_0x4b3885,null));};exports[_0xc105('0x26')]=function(_0x2967cd,_0x1d6d0c){if(_0x2967cd['body']['id']){delete _0x2967cd[_0xc105('0x4f')]['id'];}return db[_0xc105('0x45')][_0xc105('0x4d')]({'where':{'id':_0x2967cd['params']['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x1d6d0c,null))[_0xc105('0x27')](saveUpdates(_0x2967cd[_0xc105('0x4f')],null))[_0xc105('0x27')](respondWithResult(_0x1d6d0c,null))[_0xc105('0x48')](handleError(_0x1d6d0c,null));};exports[_0xc105('0x28')]=function(_0x196aaa,_0x1d2a7e){return db['Variable'][_0xc105('0x4d')]({'where':{'id':_0x196aaa[_0xc105('0x4a')]['id']}})[_0xc105('0x27')](handleEntityNotFound(_0x1d2a7e,null))['then'](removeEntity(_0x1d2a7e,null))[_0xc105('0x48')](handleError(_0x1d2a7e,null));}; \ No newline at end of file +var _0xa7d1=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0xd62db,_0x5e81b8){var _0x104c01=function(_0x586a53){while(--_0x586a53){_0xd62db['push'](_0xd62db['shift']());}};_0x104c01(++_0x5e81b8);}(_0xa7d1,0x177));var _0x1a7d=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0xa7d1[_0x3cb3ca];return _0x214366;};'use strict';var emlformat=require(_0x1a7d('0x0'));var rimraf=require(_0x1a7d('0x1'));var zipdir=require(_0x1a7d('0x2'));var jsonpatch=require(_0x1a7d('0x3'));var rp=require(_0x1a7d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a7d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1a7d('0x6'));var csv=require(_0x1a7d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a7d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a7d('0x9'));var deskjs=require(_0x1a7d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1a7d('0xb'));var Papa=require(_0x1a7d('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a7d('0xd'));var hardwareService=require(_0x1a7d('0xe'));var logger=require(_0x1a7d('0xf'))(_0x1a7d('0x10'));var utils=require('../../config/utils');var config=require(_0x1a7d('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a7d('0x12'))['db'];function respondWithStatusCode(_0x4bf069,_0x4c9c06){_0x4c9c06=_0x4c9c06||0xcc;return function(_0x5e5d86){if(_0x5e5d86){return _0x4bf069[_0x1a7d('0x13')](_0x4c9c06);}return _0x4bf069[_0x1a7d('0x14')](_0x4c9c06)[_0x1a7d('0x15')]();};}function respondWithResult(_0x5b20d5,_0x216c86){_0x216c86=_0x216c86||0xc8;return function(_0x1463c0){if(_0x1463c0){return _0x5b20d5[_0x1a7d('0x14')](_0x216c86)[_0x1a7d('0x16')](_0x1463c0);}};}function respondWithFilteredResult(_0xfb63ea,_0x40938e){return function(_0x53d97d){if(_0x53d97d){var _0x1d27b4=typeof _0x40938e[_0x1a7d('0x17')]===_0x1a7d('0x18')&&typeof _0x40938e['limit']===_0x1a7d('0x18');var _0x5f4c9a=_0x53d97d[_0x1a7d('0x19')];var _0x4e19ed=_0x1d27b4?0x0:_0x40938e[_0x1a7d('0x17')];var _0x2981b0=_0x1d27b4?_0x53d97d[_0x1a7d('0x19')]:_0x40938e[_0x1a7d('0x17')]+_0x40938e[_0x1a7d('0x1a')];var _0x5489fa;if(_0x2981b0>=_0x5f4c9a){_0x2981b0=_0x5f4c9a;_0x5489fa=0xc8;}else{_0x5489fa=0xce;}_0xfb63ea[_0x1a7d('0x14')](_0x5489fa);return _0xfb63ea[_0x1a7d('0x1b')]('Content-Range',_0x4e19ed+'-'+_0x2981b0+'/'+_0x5f4c9a)['json'](_0x53d97d);}return null;};}function patchUpdates(_0x57e8c2){return function(_0x416499){try{jsonpatch[_0x1a7d('0x1c')](_0x416499,_0x57e8c2,!![]);}catch(_0x146b1d){return BPromise[_0x1a7d('0x1d')](_0x146b1d);}return _0x416499['save']();};}function saveUpdates(_0x1782c6,_0x38913c){return function(_0x111b76){if(_0x111b76){return _0x111b76['update'](_0x1782c6)['then'](function(_0x555aeb){return _0x555aeb;});}return null;};}function removeEntity(_0x3fb534,_0x556254){return function(_0x59e46c){if(_0x59e46c){return _0x59e46c['destroy']()[_0x1a7d('0x1e')](function(){var _0x5e3f38=_0x59e46c[_0x1a7d('0x1f')]({'plain':!![]});var _0xb1a268='Variables';return db[_0x1a7d('0x20')][_0x1a7d('0x21')]({'where':{'type':_0xb1a268,'resourceId':_0x5e3f38['id']}})[_0x1a7d('0x1e')](function(){return _0x59e46c;});})[_0x1a7d('0x1e')](function(){_0x3fb534['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb58b98,_0x953a14){return function(_0x245dfd){if(!_0x245dfd){_0xb58b98['sendStatus'](0x194);}return _0x245dfd;};}function handleError(_0x3c675a,_0x2bf347){_0x2bf347=_0x2bf347||0x1f4;return function(_0x2ba662){logger[_0x1a7d('0x22')](_0x2ba662[_0x1a7d('0x23')]);if(_0x2ba662[_0x1a7d('0x24')]){delete _0x2ba662[_0x1a7d('0x24')];}_0x3c675a['status'](_0x2bf347)[_0x1a7d('0x25')](_0x2ba662);};}exports[_0x1a7d('0x26')]=function(_0x499f62,_0x4cd7ba){var _0x2bd227={},_0x29084f={},_0x1889a1={'count':0x0,'rows':[]};var _0x268900=_[_0x1a7d('0x27')](db[_0x1a7d('0x28')][_0x1a7d('0x29')],function(_0x25707a){return{'name':_0x25707a[_0x1a7d('0x2a')],'type':_0x25707a['type'][_0x1a7d('0x2b')]};});_0x29084f[_0x1a7d('0x2c')]=_[_0x1a7d('0x27')](_0x268900,_0x1a7d('0x24'));_0x29084f[_0x1a7d('0x2d')]=_[_0x1a7d('0x2e')](_0x499f62['query']);_0x29084f[_0x1a7d('0x2f')]=_['intersection'](_0x29084f[_0x1a7d('0x2c')],_0x29084f[_0x1a7d('0x2d')]);_0x2bd227[_0x1a7d('0x30')]=_[_0x1a7d('0x31')](_0x29084f[_0x1a7d('0x2c')],qs[_0x1a7d('0x32')](_0x499f62[_0x1a7d('0x2d')]['fields']));_0x2bd227[_0x1a7d('0x30')]=_0x2bd227[_0x1a7d('0x30')][_0x1a7d('0x33')]?_0x2bd227[_0x1a7d('0x30')]:_0x29084f[_0x1a7d('0x2c')];if(!_0x499f62[_0x1a7d('0x2d')]['hasOwnProperty'](_0x1a7d('0x34'))){_0x2bd227[_0x1a7d('0x1a')]=qs['limit'](_0x499f62['query'][_0x1a7d('0x1a')]);_0x2bd227[_0x1a7d('0x17')]=qs[_0x1a7d('0x17')](_0x499f62[_0x1a7d('0x2d')]['offset']);}_0x2bd227[_0x1a7d('0x35')]=qs[_0x1a7d('0x36')](_0x499f62[_0x1a7d('0x2d')][_0x1a7d('0x36')]);_0x2bd227[_0x1a7d('0x37')]=qs[_0x1a7d('0x2f')](_[_0x1a7d('0x38')](_0x499f62[_0x1a7d('0x2d')],_0x29084f['filters']),_0x268900);if(_0x499f62[_0x1a7d('0x2d')][_0x1a7d('0x39')]){_0x2bd227[_0x1a7d('0x37')]=_[_0x1a7d('0x3a')](_0x2bd227[_0x1a7d('0x37')],{'$or':_[_0x1a7d('0x27')](_0x268900,function(_0x52f026){if(_0x52f026[_0x1a7d('0x3b')]!=='VIRTUAL'){var _0x3fcbbc={};_0x3fcbbc[_0x52f026[_0x1a7d('0x24')]]={'$like':'%'+_0x499f62[_0x1a7d('0x2d')][_0x1a7d('0x39')]+'%'};return _0x3fcbbc;}})});}_0x2bd227=_['merge']({},_0x2bd227,_0x499f62[_0x1a7d('0x3c')]);var _0x843a49={'where':_0x2bd227[_0x1a7d('0x37')]};return db[_0x1a7d('0x28')]['count'](_0x843a49)[_0x1a7d('0x1e')](function(_0x5cb5db){_0x1889a1[_0x1a7d('0x19')]=_0x5cb5db;if(_0x499f62[_0x1a7d('0x2d')]['includeAll']){_0x2bd227[_0x1a7d('0x3d')]=[{'all':!![]}];}return db[_0x1a7d('0x28')][_0x1a7d('0x3e')](_0x2bd227);})[_0x1a7d('0x1e')](function(_0x159f64){_0x1889a1[_0x1a7d('0x3f')]=_0x159f64;return _0x1889a1;})[_0x1a7d('0x1e')](respondWithFilteredResult(_0x4cd7ba,_0x2bd227))[_0x1a7d('0x40')](handleError(_0x4cd7ba,null));};exports['show']=function(_0x55b1cd,_0x4e599b){var _0x10650b={'raw':!![],'where':{'id':_0x55b1cd[_0x1a7d('0x41')]['id']}},_0x4be312={};_0x4be312[_0x1a7d('0x2c')]=_[_0x1a7d('0x2e')](db[_0x1a7d('0x28')][_0x1a7d('0x29')]);_0x4be312[_0x1a7d('0x2d')]=_[_0x1a7d('0x2e')](_0x55b1cd['query']);_0x4be312[_0x1a7d('0x2f')]=_[_0x1a7d('0x31')](_0x4be312['model'],_0x4be312[_0x1a7d('0x2d')]);_0x10650b[_0x1a7d('0x30')]=_['intersection'](_0x4be312['model'],qs['fields'](_0x55b1cd['query'][_0x1a7d('0x32')]));_0x10650b[_0x1a7d('0x30')]=_0x10650b[_0x1a7d('0x30')]['length']?_0x10650b['attributes']:_0x4be312[_0x1a7d('0x2c')];if(_0x55b1cd[_0x1a7d('0x2d')]['includeAll']){_0x10650b[_0x1a7d('0x3d')]=[{'all':!![]}];}_0x10650b=_['merge']({},_0x10650b,_0x55b1cd['options']);return db[_0x1a7d('0x28')]['find'](_0x10650b)[_0x1a7d('0x1e')](handleEntityNotFound(_0x4e599b,null))[_0x1a7d('0x1e')](respondWithResult(_0x4e599b,null))['catch'](handleError(_0x4e599b,null));};exports[_0x1a7d('0x42')]=function(_0x43e755,_0x40eb8a){return db['Variable'][_0x1a7d('0x42')](_0x43e755['body'],{})['then'](function(_0x5aa76e){var _0x403ce4=_0x43e755['user'][_0x1a7d('0x1f')]({'plain':!![]});if(!_0x403ce4)throw new Error(_0x1a7d('0x43'));if(_0x403ce4[_0x1a7d('0x44')]==='user'){var _0x557829=_0x5aa76e[_0x1a7d('0x1f')]({'plain':!![]});var _0x44efe6=_0x1a7d('0x45');return db[_0x1a7d('0x46')][_0x1a7d('0x47')]({'where':{'name':_0x44efe6,'userProfileId':_0x403ce4[_0x1a7d('0x48')]},'raw':!![]})['then'](function(_0x5f000d){if(_0x5f000d&&_0x5f000d['autoAssociation']===0x0){return db[_0x1a7d('0x20')]['create']({'name':_0x557829['name'],'resourceId':_0x557829['id'],'type':_0x5f000d[_0x1a7d('0x24')],'sectionId':_0x5f000d['id']},{})['then'](function(){return _0x5aa76e;});}else{return _0x5aa76e;}})[_0x1a7d('0x40')](function(_0x2357bc){logger[_0x1a7d('0x22')](_0x1a7d('0x49'),_0x2357bc);throw _0x2357bc;});}return _0x5aa76e;})[_0x1a7d('0x1e')](respondWithResult(_0x40eb8a,0xc9))[_0x1a7d('0x40')](handleError(_0x40eb8a,null));};exports['update']=function(_0x523789,_0x34c076){if(_0x523789[_0x1a7d('0x4a')]['id']){delete _0x523789['body']['id'];}return db[_0x1a7d('0x28')][_0x1a7d('0x47')]({'where':{'id':_0x523789[_0x1a7d('0x41')]['id']}})[_0x1a7d('0x1e')](handleEntityNotFound(_0x34c076,null))[_0x1a7d('0x1e')](saveUpdates(_0x523789[_0x1a7d('0x4a')],null))[_0x1a7d('0x1e')](respondWithResult(_0x34c076,null))[_0x1a7d('0x40')](handleError(_0x34c076,null));};exports['destroy']=function(_0x3db8a3,_0x236152){return db[_0x1a7d('0x28')][_0x1a7d('0x47')]({'where':{'id':_0x3db8a3['params']['id']}})[_0x1a7d('0x1e')](handleEntityNotFound(_0x236152,null))['then'](removeEntity(_0x236152,null))[_0x1a7d('0x40')](handleError(_0x236152,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7a197a1..9b5e52f 100644 --- a/server/api/variable/variable.model.js +++ b/server/api/variable/variable.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb277=['path','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird'];(function(_0x382d8e,_0x2a5761){var _0x23993d=function(_0x1f491c){while(--_0x1f491c){_0x382d8e['push'](_0x382d8e['shift']());}};_0x23993d(++_0x2a5761);}(_0xb277,0x7b));var _0x7b27=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb277[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x7b27('0x0'));var util=require(_0x7b27('0x1'));var logger=require(_0x7b27('0x2'))('api');var moment=require(_0x7b27('0x3'));var BPromise=require(_0x7b27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b27('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0x46ee41,_0x15301a){return _0x46ee41['define'](_0x7b27('0x6'),attributes,{'tableName':_0x7b27('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa96=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','../../config/logger','moment','path'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xaa96,0xf6));var _0x6aa9=function(_0x1417ad,_0x435a34){_0x1417ad=_0x1417ad-0x0;var _0x4396a2=_0xaa96[_0x1417ad];return _0x4396a2;};'use strict';var _=require(_0x6aa9('0x0'));var util=require('util');var logger=require(_0x6aa9('0x1'))('api');var moment=require(_0x6aa9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6aa9('0x3'));var rimraf=require(_0x6aa9('0x4'));var config=require(_0x6aa9('0x5'));var attributes=require(_0x6aa9('0x6'));module[_0x6aa9('0x7')]=function(_0x3ab7c6,_0x53d88f){return _0x3ab7c6[_0x6aa9('0x8')](_0x6aa9('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 94759ee..4ff35be 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x153c6a,_0x2a217a){var _0xce898f=function(_0x84c97c){while(--_0x84c97c){_0x153c6a['push'](_0x153c6a['shift']());}};_0xce898f(++_0x2a217a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x288e77,_0x5a48b8){_0x288e77=_0x288e77-0x0;var _0xc5262=_0x1cb9[_0x288e77];return _0xc5262;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x4eb662,_0x540e40){var _0x2d7889=function(_0xbe80a7){while(--_0xbe80a7){_0x4eb662['push'](_0x4eb662['shift']());}};_0x2d7889(++_0x540e40);}(_0x55ca,0x126));var _0xa55c=function(_0x4a4a43,_0x115ccf){_0x4a4a43=_0x4a4a43-0x0;var _0x5893a6=_0x55ca[_0x4a4a43];return _0x5893a6;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 05e4299..5c6ea5f 100644 --- a/server/api/version/index.js +++ b/server/api/version/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c6d=['index','get','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','exports','Router','../../components/auth/service'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1c6d,0x136));var _0xd1c6=function(_0x3e83f1,_0x1b09ae){_0x3e83f1=_0x3e83f1-0x0;var _0x28cd96=_0x1c6d[_0x3e83f1];return _0x28cd96;};'use strict';var express=require('express');var router=express[_0xd1c6('0x0')]();var auth=require(_0xd1c6('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0xd1c6('0x2')]);router[_0xd1c6('0x3')]('/fetch',auth[_0xd1c6('0x4')](),auth[_0xd1c6('0x5')](),controller['fetch']);router[_0xd1c6('0x3')](_0xd1c6('0x6'),auth['isAuthenticated'](),auth[_0xd1c6('0x5')](),controller[_0xd1c6('0x7')]);router[_0xd1c6('0x3')](_0xd1c6('0x8'),auth['isAuthenticated'](),auth[_0xd1c6('0x5')](),controller[_0xd1c6('0x9')]);router[_0xd1c6('0x3')](_0xd1c6('0xa'),auth[_0xd1c6('0x4')](),controller[_0xd1c6('0xb')]);router['get']('/migrations',controller['migrations']);module[_0xd1c6('0xc')]=router; \ No newline at end of file +var _0x341f=['get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','pull','/restart','restart','migrations','exports','Router','../../components/auth/service','./version.controller'];(function(_0x4157c6,_0x336359){var _0x72fc95=function(_0x13575e){while(--_0x13575e){_0x4157c6['push'](_0x4157c6['shift']());}};_0x72fc95(++_0x336359);}(_0x341f,0x10b));var _0xf341=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0x341f[_0x5decec];return _0x35e1b4;};'use strict';var express=require('express');var router=express[_0xf341('0x0')]();var auth=require(_0xf341('0x1'));var controller=require(_0xf341('0x2'));router[_0xf341('0x3')]('/',controller[_0xf341('0x4')]);router[_0xf341('0x3')](_0xf341('0x5'),auth[_0xf341('0x6')](),auth[_0xf341('0x7')](),controller['fetch']);router[_0xf341('0x3')](_0xf341('0x8'),auth[_0xf341('0x6')](),auth['canUpdate'](),controller[_0xf341('0x9')]);router[_0xf341('0x3')]('/pull',auth[_0xf341('0x6')](),auth['canUpdate'](),controller[_0xf341('0xa')]);router[_0xf341('0x3')](_0xf341('0xb'),auth[_0xf341('0x6')](),controller[_0xf341('0xc')]);router[_0xf341('0x3')]('/migrations',controller[_0xf341('0xd')]);module[_0xf341('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 29d0225..0d11bf3 100644 --- a/server/api/version/version.controller.js +++ b/server/api/version/version.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3acf=['latest','fetch','tags','version','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','migrations','server','length','replace','.js','exports','push','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','join','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','query'];(function(_0x4c1bf9,_0x1e4f68){var _0x3bde0d=function(_0x5b7fb1){while(--_0x5b7fb1){_0x4c1bf9['push'](_0x4c1bf9['shift']());}};_0x3bde0d(++_0x1e4f68);}(_0x3acf,0x16d));var _0xf3ac=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x3acf[_0x3048ea];return _0x1a13c4;};'use strict';var Umzug=require(_0xf3ac('0x0'));var path=require(_0xf3ac('0x1'));var fs=require('fs');var _=require(_0xf3ac('0x2'));var pkginfo=require(_0xf3ac('0x3'))(module,'version');var compareVersions=require(_0xf3ac('0x4'));var exec=require(_0xf3ac('0x5'))[_0xf3ac('0x6')];var db=require(_0xf3ac('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xf3ac('0x8'));var logger=require(_0xf3ac('0x9'))(_0xf3ac('0xa'));var git=require('simple-git')(config[_0xf3ac('0xb')]);exports['index']=function(_0x16d029,_0x2e736f){var _0x166d78={'current':module['exports']['version'],'phonebar':0x2};if(_0x16d029[_0xf3ac('0xc')]&&_0x16d029['query'][_0xf3ac('0xd')]){return git[_0xf3ac('0xe')]()[_0xf3ac('0xf')](function(_0x1acb86,_0x1d6c47){_0x166d78[_0xf3ac('0xd')]=(_0x1acb86?module['exports'][_0xf3ac('0x10')]:_0x1d6c47['latest'])||_0xf3ac('0x11');return _0x2e736f[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')](_0x166d78);});}else{return _0x2e736f[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')](_0x166d78);}};exports[_0xf3ac('0xe')]=function(_0x77c2d4,_0x30e875){return git[_0xf3ac('0xe')]([_0xf3ac('0x14'),_0xf3ac('0x15')],function(_0x401738){if(_0x401738){logger['error'](_0x401738);return _0x30e875[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x401738);}logger[_0xf3ac('0x16')](_0xf3ac('0x17'));return _0x30e875[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x18')});});};exports[_0xf3ac('0x19')]=function(_0x1aa62f,_0x19201b){return git['reset']([_0xf3ac('0x1a'),_0xf3ac('0x1b')],function(_0x4d78f3){if(_0x4d78f3){logger[_0xf3ac('0x1c')](_0x4d78f3);return _0x19201b[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x4d78f3);}logger[_0xf3ac('0x16')](_0xf3ac('0x1d'));return _0x19201b[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x1e')});});};exports[_0xf3ac('0x1f')]=function(_0x1575ac,_0x8fed87){exec('npm\x20install\x20--production',function(_0x77045f,_0x39d199,_0xd1b33f){logger[_0xf3ac('0x16')](_0x39d199);logger['info'](_0xd1b33f);if(_0x77045f){logger['error'](_0x77045f);return _0x8fed87['status'](0x1f4)['json'](_0x77045f);}return _0x8fed87['status'](0xc8)['json']({'output':_0x39d199});});};exports[_0xf3ac('0x20')]=function(_0x1dfc51,_0x49d3f1){return pm2['restart'](_0xf3ac('0x21'))[_0xf3ac('0x22')](function(_0x5b4c5d){logger[_0xf3ac('0x16')](_0xf3ac('0x23'),_0x5b4c5d);return _0x49d3f1[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x8227ee){logger[_0xf3ac('0x1c')](_0x8227ee);return _0x49d3f1[_0xf3ac('0x12')](0x1f4)[_0xf3ac('0x13')](_0x8227ee);});};exports[_0xf3ac('0x24')]=function(_0x553802,_0x43d265){var _0x4f5b99=fs['readdirSync'](path['join'](config[_0xf3ac('0xb')],_0xf3ac('0x25'),_0xf3ac('0x24')));var _0x5d25c7=[];for(var _0x5623fa=0x0;_0x5623fa<_0x4f5b99[_0xf3ac('0x26')];_0x5623fa++){var _0x4f9de2=_0x4f5b99[_0x5623fa][_0xf3ac('0x27')](_0xf3ac('0x28'),'');if(compareVersions(module[_0xf3ac('0x29')]['version'],_0x4f9de2)===-0x1){_0x5d25c7[_0xf3ac('0x2a')](_0x4f9de2);}}if(_0x5d25c7[_0xf3ac('0x26')]){var _0x4a005d=_0x5d25c7[_0xf3ac('0x2b')](compareVersions);var _0x172a19=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf3ac('0x2c')],'modelName':_0xf3ac('0x2c'),'columnName':_0xf3ac('0x10')},'migrations':{'params':[db[_0xf3ac('0x2d')]['getQueryInterface'](),db[_0xf3ac('0x2d')]['constructor'],function(){throw new Error(_0xf3ac('0x2e'));}],'path':path['join'](config[_0xf3ac('0xb')],_0xf3ac('0x25'),_0xf3ac('0x24')),'pattern':/\.js$/}});_0x172a19['up']({'migrations':_[_0xf3ac('0x2f')](_0x4a005d,function(_0x44b76b){return _0x44b76b+_0xf3ac('0x28');})})[_0xf3ac('0x22')](function(){return _0x43d265[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xf3ac('0x29')]['version']+_0xf3ac('0x30')+_[_0xf3ac('0x31')](_0x4a005d),'migrations':_[_0xf3ac('0x32')](_0x4a005d)});})[_0xf3ac('0x33')](function(_0x2a454d){if(_0x2a454d instanceof db[_0xf3ac('0x2d')][_0xf3ac('0x34')]){return _0x43d265['status'](0xc8)[_0xf3ac('0x13')]({'output':_0xf3ac('0x35')});}else{return _0x43d265['status'](0x1f4)[_0xf3ac('0x13')](_0x2a454d);}});}else{return _0x43d265[_0xf3ac('0x12')](0xc8)[_0xf3ac('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x799f=['json','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','readdirSync','join','server','migrations','length','replace','push','Migration','getQueryInterface','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','version','compare-versions','child_process','exec','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status'];(function(_0xfafae6,_0x89be47){var _0x94ac93=function(_0x1cc1c1){while(--_0x1cc1c1){_0xfafae6['push'](_0xfafae6['shift']());}};_0x94ac93(++_0x89be47);}(_0x799f,0x105));var _0xf799=function(_0x186a9a,_0x8e61c){_0x186a9a=_0x186a9a-0x0;var _0x4acc7d=_0x799f[_0x186a9a];return _0x4acc7d;};'use strict';var Umzug=require('umzug');var path=require(_0xf799('0x0'));var fs=require('fs');var _=require(_0xf799('0x1'));var pkginfo=require('pkginfo')(module,_0xf799('0x2'));var compareVersions=require(_0xf799('0x3'));var exec=require(_0xf799('0x4'))[_0xf799('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xf799('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xf799('0x7'))(_0xf799('0x8'));var git=require(_0xf799('0x9'))(config[_0xf799('0xa')]);exports[_0xf799('0xb')]=function(_0x4a88c6,_0xb61a60){var _0x4286f4={'current':module[_0xf799('0xc')][_0xf799('0x2')],'phonebar':0x2};if(_0x4a88c6[_0xf799('0xd')]&&_0x4a88c6[_0xf799('0xd')]['latest']){return git[_0xf799('0xe')]()[_0xf799('0xf')](function(_0x54136b,_0x40fd4b){_0x4286f4[_0xf799('0x10')]=(_0x54136b?module['exports'][_0xf799('0x2')]:_0x40fd4b[_0xf799('0x10')])||_0xf799('0x11');return _0xb61a60[_0xf799('0x12')](0xc8)[_0xf799('0x13')](_0x4286f4);});}else{return _0xb61a60[_0xf799('0x12')](0xc8)[_0xf799('0x13')](_0x4286f4);}};exports[_0xf799('0xe')]=function(_0x347123,_0x496621){return git[_0xf799('0xe')]([_0xf799('0x14'),_0xf799('0x15')],function(_0x499413){if(_0x499413){logger['error'](_0x499413);return _0x496621['status'](0x1f4)['json'](_0x499413);}logger['info'](_0xf799('0x16'));return _0x496621[_0xf799('0x12')](0xc8)[_0xf799('0x13')]({'output':_0xf799('0x17')});});};exports[_0xf799('0x18')]=function(_0x31ad54,_0x601ff9){return git['reset']([_0xf799('0x19'),_0xf799('0x1a')],function(_0x598d55){if(_0x598d55){logger[_0xf799('0x1b')](_0x598d55);return _0x601ff9[_0xf799('0x12')](0x1f4)['json'](_0x598d55);}logger['info'](_0xf799('0x1c'));return _0x601ff9[_0xf799('0x12')](0xc8)[_0xf799('0x13')]({'output':_0xf799('0x1d')});});};exports[_0xf799('0x1e')]=function(_0x3b3714,_0x18980c){exec(_0xf799('0x1f'),function(_0x3350ef,_0x139457,_0x21f65f){logger['info'](_0x139457);logger[_0xf799('0x20')](_0x21f65f);if(_0x3350ef){logger[_0xf799('0x1b')](_0x3350ef);return _0x18980c[_0xf799('0x12')](0x1f4)[_0xf799('0x13')](_0x3350ef);}return _0x18980c[_0xf799('0x12')](0xc8)[_0xf799('0x13')]({'output':_0x139457});});};exports[_0xf799('0x21')]=function(_0x2a57a2,_0x2c715b){return pm2[_0xf799('0x21')](_0xf799('0x22'))[_0xf799('0x23')](function(_0x39862d){logger[_0xf799('0x20')](_0xf799('0x24'),_0x39862d);return _0x2c715b[_0xf799('0x12')](0xc8)[_0xf799('0x13')]({'output':_0xf799('0x25')});})['catch'](function(_0x32471e){logger[_0xf799('0x1b')](_0x32471e);return _0x2c715b[_0xf799('0x12')](0x1f4)[_0xf799('0x13')](_0x32471e);});};exports['migrations']=function(_0x4f7ce7,_0x2e70a5){var _0x4bb7a6=fs[_0xf799('0x26')](path[_0xf799('0x27')](config['root'],_0xf799('0x28'),_0xf799('0x29')));var _0x5e4f46=[];for(var _0x446d04=0x0;_0x446d04<_0x4bb7a6[_0xf799('0x2a')];_0x446d04++){var _0x37d1b6=_0x4bb7a6[_0x446d04][_0xf799('0x2b')]('.js','');if(compareVersions(module[_0xf799('0xc')][_0xf799('0x2')],_0x37d1b6)===-0x1){_0x5e4f46[_0xf799('0x2c')](_0x37d1b6);}}if(_0x5e4f46['length']){var _0x16e748=_0x5e4f46['sort'](compareVersions);var _0x59abc8=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xf799('0x2d')],'modelName':_0xf799('0x2d'),'columnName':_0xf799('0x2')},'migrations':{'params':[db['sequelize'][_0xf799('0x2e')](),db[_0xf799('0x2f')]['constructor'],function(){throw new Error(_0xf799('0x30'));}],'path':path['join'](config[_0xf799('0xa')],_0xf799('0x28'),_0xf799('0x29')),'pattern':/\.js$/}});_0x59abc8['up']({'migrations':_[_0xf799('0x31')](_0x16e748,function(_0x3d22ab){return _0x3d22ab+_0xf799('0x32');})})[_0xf799('0x23')](function(){return _0x2e70a5['status'](0xc8)[_0xf799('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xf799('0xc')][_0xf799('0x2')]+_0xf799('0x33')+_[_0xf799('0x34')](_0x16e748),'migrations':_[_0xf799('0x27')](_0x16e748)});})[_0xf799('0x35')](function(_0x13f804){if(_0x13f804 instanceof db['sequelize'][_0xf799('0x36')]){return _0x2e70a5['status'](0xc8)[_0xf799('0x13')]({'output':_0xf799('0x37')});}else{return _0x2e70a5[_0xf799('0x12')](0x1f4)[_0xf799('0x13')](_0x13f804);}});}else{return _0x2e70a5[_0xf799('0x12')](0xc8)['json']({'output':_0xf799('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 19e4297..3df884a 100644 --- a/server/api/voiceAgentReport/index.js +++ b/server/api/voiceAgentReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44df=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x2978c1,_0x428ef3){var _0x244298=function(_0x12e8ac){while(--_0x12e8ac){_0x2978c1['push'](_0x2978c1['shift']());}};_0x244298(++_0x428ef3);}(_0x44df,0x16a));var _0xf44d=function(_0x55305a,_0x387c32){_0x55305a=_0x55305a-0x0;var _0x24db5d=_0x44df[_0x55305a];return _0x24db5d;};'use strict';var multer=require(_0xf44d('0x0'));var util=require('util');var path=require(_0xf44d('0x1'));var timeout=require(_0xf44d('0x2'));var express=require(_0xf44d('0x3'));var router=express[_0xf44d('0x4')]();var fs_extra=require(_0xf44d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf44d('0x6'));var config=require(_0xf44d('0x7'));var controller=require(_0xf44d('0x8'));router[_0xf44d('0x9')]('/',auth[_0xf44d('0xa')](),controller['index']);router['get'](_0xf44d('0xb'),auth['isAuthenticated'](),controller[_0xf44d('0xc')]);router[_0xf44d('0x9')](_0xf44d('0xd'),auth[_0xf44d('0xa')](),controller[_0xf44d('0xe')]);router[_0xf44d('0xf')]('/',auth[_0xf44d('0xa')](),controller[_0xf44d('0x10')]);router[_0xf44d('0x11')](_0xf44d('0xd'),auth[_0xf44d('0xa')](),controller['update']);router[_0xf44d('0x12')]('/:id',auth[_0xf44d('0xa')](),controller['destroy']);module[_0xf44d('0x13')]=router; \ No newline at end of file +var _0x8796=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x158c4e,_0x532918){var _0x170d32=function(_0x52fd6e){while(--_0x52fd6e){_0x158c4e['push'](_0x158c4e['shift']());}};_0x170d32(++_0x532918);}(_0x8796,0x1a3));var _0x6879=function(_0x4b3cc3,_0x22bf1a){_0x4b3cc3=_0x4b3cc3-0x0;var _0x117aa1=_0x8796[_0x4b3cc3];return _0x117aa1;};'use strict';var multer=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var path=require(_0x6879('0x2'));var timeout=require(_0x6879('0x3'));var express=require(_0x6879('0x4'));var router=express[_0x6879('0x5')]();var fs_extra=require(_0x6879('0x6'));var auth=require(_0x6879('0x7'));var interaction=require(_0x6879('0x8'));var config=require('../../config/environment');var controller=require(_0x6879('0x9'));router[_0x6879('0xa')]('/',auth[_0x6879('0xb')](),controller['index']);router[_0x6879('0xa')](_0x6879('0xc'),auth[_0x6879('0xb')](),controller[_0x6879('0xd')]);router[_0x6879('0xa')](_0x6879('0xe'),auth[_0x6879('0xb')](),controller[_0x6879('0xf')]);router['post']('/',auth[_0x6879('0xb')](),controller[_0x6879('0x10')]);router[_0x6879('0x11')](_0x6879('0xe'),auth[_0x6879('0xb')](),controller[_0x6879('0x12')]);router[_0x6879('0x13')](_0x6879('0xe'),auth[_0x6879('0xb')](),controller[_0x6879('0x14')]);module[_0x6879('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 94df0bb..1ec5ad8 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.attributes.js +++ b/server/api/voiceAgentReport/voiceAgentReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2da=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x3c974f,_0x33a7db){var _0x157515=function(_0x504eb8){while(--_0x504eb8){_0x3c974f['push'](_0x3c974f['shift']());}};_0x157515(++_0x33a7db);}(_0xc2da,0x124));var _0xac2d=function(_0x25f3e3,_0x207891){_0x25f3e3=_0x25f3e3-0x0;var _0xa89b6d=_0xc2da[_0x25f3e3];return _0xa89b6d;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'type':{'type':Sequelize[_0xac2d('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac2d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xac2d('0x1')]},'interface':{'type':Sequelize[_0xac2d('0x1')]},'membername':{'type':Sequelize[_0xac2d('0x1')]},'agentcalledAt':{'type':Sequelize[_0xac2d('0x2')]},'agentconnectAt':{'type':Sequelize[_0xac2d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xac2d('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xac2d('0x2')]},'agentdumpAt':{'type':Sequelize[_0xac2d('0x2')]},'holdtime':{'type':Sequelize[_0xac2d('0x3')]},'agentcomplete':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xac2d('0x1')]},'lastevent':{'type':Sequelize[_0xac2d('0x1')]},'channel':{'type':Sequelize[_0xac2d('0x1')]},'channelstate':{'type':Sequelize[_0xac2d('0x3')]},'channelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac2d('0x1')]},'context':{'type':Sequelize[_0xac2d('0x1')]},'exten':{'type':Sequelize[_0xac2d('0x1')]},'priority':{'type':Sequelize[_0xac2d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xac2d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridname':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xac2d('0x1')]},'destlanguage':{'type':Sequelize[_0xac2d('0x1')]},'destaccountcode':{'type':Sequelize[_0xac2d('0x1')]},'destcontext':{'type':Sequelize[_0xac2d('0x1')]},'destexten':{'type':Sequelize[_0xac2d('0x1')]},'destpriority':{'type':Sequelize[_0xac2d('0x1')]},'destuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xac2d('0x1')]},'transfer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xac2d('0x5')},'transferexten':{'type':Sequelize[_0xac2d('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac2d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x00ea=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x00ea,0x19d));var _0xa00e=function(_0xe29662,_0x1d358c){_0xe29662=_0xe29662-0x0;var _0x240c0b=_0x00ea[_0xe29662];return _0x240c0b;};'use strict';var Sequelize=require('sequelize');module[_0xa00e('0x0')]={'type':{'type':Sequelize[_0xa00e('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa00e('0x1')]},'calleridname':{'type':Sequelize[_0xa00e('0x1')]},'queue':{'type':Sequelize[_0xa00e('0x1')]},'interface':{'type':Sequelize[_0xa00e('0x1')]},'membername':{'type':Sequelize[_0xa00e('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa00e('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xa00e('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xa00e('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa00e('0x2')]},'holdtime':{'type':Sequelize[_0xa00e('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa00e('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa00e('0x1')]},'channel':{'type':Sequelize[_0xa00e('0x1')]},'channelstate':{'type':Sequelize[_0xa00e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa00e('0x1')]},'connectedlinename':{'type':Sequelize[_0xa00e('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa00e('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa00e('0x1')]},'priority':{'type':Sequelize[_0xa00e('0x1')]},'destchannel':{'type':Sequelize[_0xa00e('0x1')]},'destchannelstate':{'type':Sequelize[_0xa00e('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xa00e('0x1')]},'destcalleridname':{'type':Sequelize[_0xa00e('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa00e('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa00e('0x1')]},'destcontext':{'type':Sequelize[_0xa00e('0x1')]},'destexten':{'type':Sequelize[_0xa00e('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa00e('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa00e('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa00e('0x1')],'comment':_0xa00e('0x5')},'transferexten':{'type':Sequelize[_0xa00e('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa00e('0x1')]},'agententerreason':{'type':Sequelize[_0xa00e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index d9657c7..8d2d404 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b9c20ae..784e99d 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.model.js +++ b/server/api/voiceAgentReport/voiceAgentReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc59=['./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1e5b6d,_0x4ffca4){var _0x18e719=function(_0x1dd192){while(--_0x1dd192){_0x1e5b6d['push'](_0x1e5b6d['shift']());}};_0x18e719(++_0x4ffca4);}(_0xdc59,0x12c));var _0x9dc5=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xdc59[_0x2261ce];return _0x524640;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9dc5('0x3'));var rp=require(_0x9dc5('0x4'));var fs=require('fs');var path=require(_0x9dc5('0x5'));var rimraf=require(_0x9dc5('0x6'));var config=require(_0x9dc5('0x7'));var attributes=require(_0x9dc5('0x8'));module[_0x9dc5('0x9')]=function(_0xf17598,_0x13e31c){return _0xf17598['define'](_0x9dc5('0xa'),attributes,{'tableName':_0x9dc5('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9dc5('0xc'),_0x9dc5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x37c5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','report_agent','uniqueid','destuniqueid','util'];(function(_0x345249,_0x554350){var _0x566d17=function(_0x39da75){while(--_0x39da75){_0x345249['push'](_0x345249['shift']());}};_0x566d17(++_0x554350);}(_0x37c5,0xa7));var _0x537c=function(_0x53fcad,_0x52158f){_0x53fcad=_0x53fcad-0x0;var _0x52841e=_0x37c5[_0x53fcad];return _0x52841e;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var logger=require(_0x537c('0x1'))(_0x537c('0x2'));var moment=require(_0x537c('0x3'));var BPromise=require(_0x537c('0x4'));var rp=require(_0x537c('0x5'));var fs=require('fs');var path=require(_0x537c('0x6'));var rimraf=require(_0x537c('0x7'));var config=require(_0x537c('0x8'));var attributes=require(_0x537c('0x9'));module['exports']=function(_0x42c86a,_0x1156f4){return _0x42c86a[_0x537c('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x537c('0xb'),'paranoid':![],'indexes':[{'fields':[_0x537c('0xc'),_0x537c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9c50db5..9e21e3a 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.rpc.js +++ b/server/api/voiceAgentReport/voiceAgentReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d80=['stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','then','update','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13e453,_0x4ab30c){var _0x26aad2=function(_0x3387a1){while(--_0x3387a1){_0x13e453['push'](_0x13e453['shift']());}};_0x26aad2(++_0x4ab30c);}(_0x5d80,0x1c1));var _0x05d8=function(_0x3d0ae6,_0x4ced2c){_0x3d0ae6=_0x3d0ae6-0x0;var _0x16a82b=_0x5d80[_0x3d0ae6];return _0x16a82b;};'use strict';var _=require(_0x05d8('0x0'));var util=require(_0x05d8('0x1'));var moment=require(_0x05d8('0x2'));var BPromise=require(_0x05d8('0x3'));var rs=require(_0x05d8('0x4'));var fs=require('fs');var Redis=require(_0x05d8('0x5'));var db=require(_0x05d8('0x6'))['db'];var utils=require(_0x05d8('0x7'));var logger=require(_0x05d8('0x8'))(_0x05d8('0x9'));var config=require(_0x05d8('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05d8('0xb')][_0x05d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2de0cc,_0x12e11b,_0x5b29dd){return new BPromise(function(_0x44f643,_0x73b892){return client[_0x05d8('0xd')](_0x2de0cc,_0x5b29dd)['then'](function(_0x52d57f){logger[_0x05d8('0xe')](_0x05d8('0xf'),_0x12e11b,'request\x20sent');logger[_0x05d8('0x10')](_0x05d8('0x11'),_0x12e11b,_0x05d8('0x12'),JSON[_0x05d8('0x13')](_0x52d57f));if(_0x52d57f['error']){if(_0x52d57f[_0x05d8('0x14')][_0x05d8('0x15')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x12e11b,_0x52d57f['error'][_0x05d8('0x16')]);return _0x73b892(_0x52d57f[_0x05d8('0x14')]['message']);}logger[_0x05d8('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x12e11b,_0x52d57f['error'][_0x05d8('0x16')]);return _0x44f643(_0x52d57f[_0x05d8('0x14')][_0x05d8('0x16')]);}else{logger[_0x05d8('0xe')](_0x05d8('0xf'),_0x12e11b,_0x05d8('0x12'));_0x44f643(_0x52d57f[_0x05d8('0x17')][_0x05d8('0x16')]);}})[_0x05d8('0x18')](function(_0x3dcb72){logger[_0x05d8('0x14')](_0x05d8('0xf'),_0x12e11b,_0x3dcb72);_0x73b892(_0x3dcb72);});});}exports[_0x05d8('0x19')]=function(_0x21a3c8){var _0x1c8fd0=this;return new Promise(function(_0x4f8196,_0x42413c){return db[_0x05d8('0x1a')][_0x05d8('0x1b')](_0x21a3c8['body'],{'raw':_0x21a3c8[_0x05d8('0x1c')]?_0x21a3c8[_0x05d8('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x05d8('0x1d')](function(_0x30dab4){logger[_0x05d8('0xe')]('CreateVoiceAgentReport',_0x21a3c8);logger['debug'](_0x05d8('0x19'),_0x21a3c8,JSON['stringify'](_0x30dab4));_0x4f8196(_0x30dab4);})[_0x05d8('0x18')](function(_0x284f9d){logger[_0x05d8('0x14')]('CreateVoiceAgentReport',_0x284f9d[_0x05d8('0x16')],_0x21a3c8);_0x42413c(_0x1c8fd0[_0x05d8('0x14')](0x1f4,_0x284f9d[_0x05d8('0x16')]));});});};exports['UpdateVoiceAgentReport']=function(_0x309149){var _0x53782c=this;return new Promise(function(_0x9e09e2,_0x457db2){return db[_0x05d8('0x1a')][_0x05d8('0x1e')](_0x309149['body'],{'raw':_0x309149[_0x05d8('0x1c')]?_0x309149['options'][_0x05d8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309149[_0x05d8('0x1c')]?_0x309149['options'][_0x05d8('0x20')]||null:null,'attributes':_0x309149['options']?_0x309149['options'][_0x05d8('0x21')]||null:null,'limit':_0x309149[_0x05d8('0x1c')]?_0x309149[_0x05d8('0x1c')][_0x05d8('0x22')]||null:null})[_0x05d8('0x1d')](function(_0x58be49){logger['info'](_0x05d8('0x23'),_0x309149);logger[_0x05d8('0x10')](_0x05d8('0x23'),_0x309149,JSON[_0x05d8('0x13')](_0x58be49));_0x9e09e2(_0x58be49);})[_0x05d8('0x18')](function(_0x20d025){logger['error'](_0x05d8('0x23'),_0x20d025[_0x05d8('0x16')],_0x309149);_0x457db2(_0x53782c[_0x05d8('0x14')](0x1f4,_0x20d025['message']));});});}; \ No newline at end of file +var _0xe1d6=['../../config/environment','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','attributes','limit','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x359565,_0xe16d57){var _0xbc9af1=function(_0x3421a6){while(--_0x3421a6){_0x359565['push'](_0x359565['shift']());}};_0xbc9af1(++_0xe16d57);}(_0xe1d6,0x119));var _0x6e1d=function(_0x3f1385,_0x3620ff){_0x3f1385=_0x3f1385-0x0;var _0x5e13d0=_0xe1d6[_0x3f1385];return _0x5e13d0;};'use strict';var _=require(_0x6e1d('0x0'));var util=require('util');var moment=require(_0x6e1d('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e1d('0x2'));var fs=require('fs');var Redis=require(_0x6e1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e1d('0x4'));var logger=require(_0x6e1d('0x5'))(_0x6e1d('0x6'));var config=require(_0x6e1d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e1d('0x8')][_0x6e1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3988c5,_0x2554e0,_0x38de0b){return new BPromise(function(_0x4f10a7,_0x4c543b){return client[_0x6e1d('0xa')](_0x3988c5,_0x38de0b)[_0x6e1d('0xb')](function(_0x408205){logger[_0x6e1d('0xc')](_0x6e1d('0xd'),_0x2554e0,'request\x20sent');logger[_0x6e1d('0xe')](_0x6e1d('0xf'),_0x2554e0,_0x6e1d('0x10'),JSON[_0x6e1d('0x11')](_0x408205));if(_0x408205[_0x6e1d('0x12')]){if(_0x408205[_0x6e1d('0x12')][_0x6e1d('0x13')]===0x1f4){logger['error'](_0x6e1d('0xd'),_0x2554e0,_0x408205['error'][_0x6e1d('0x14')]);return _0x4c543b(_0x408205[_0x6e1d('0x12')]['message']);}logger[_0x6e1d('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x2554e0,_0x408205[_0x6e1d('0x12')][_0x6e1d('0x14')]);return _0x4f10a7(_0x408205['error'][_0x6e1d('0x14')]);}else{logger[_0x6e1d('0xc')](_0x6e1d('0xd'),_0x2554e0,_0x6e1d('0x10'));_0x4f10a7(_0x408205[_0x6e1d('0x15')]['message']);}})[_0x6e1d('0x16')](function(_0x4c1f98){logger[_0x6e1d('0x12')](_0x6e1d('0xd'),_0x2554e0,_0x4c1f98);_0x4c543b(_0x4c1f98);});});}exports[_0x6e1d('0x17')]=function(_0x25bd10){var _0x44a141=this;return new Promise(function(_0x275b7c,_0x342281){return db['VoiceAgentReport'][_0x6e1d('0x18')](_0x25bd10[_0x6e1d('0x19')],{'raw':_0x25bd10[_0x6e1d('0x1a')]?_0x25bd10['options'][_0x6e1d('0x1b')]===undefined?!![]:![]:!![]})[_0x6e1d('0xb')](function(_0x5a40dc){logger[_0x6e1d('0xc')](_0x6e1d('0x17'),_0x25bd10);logger[_0x6e1d('0xe')](_0x6e1d('0x17'),_0x25bd10,JSON[_0x6e1d('0x11')](_0x5a40dc));_0x275b7c(_0x5a40dc);})[_0x6e1d('0x16')](function(_0x500911){logger[_0x6e1d('0x12')](_0x6e1d('0x17'),_0x500911['message'],_0x25bd10);_0x342281(_0x44a141[_0x6e1d('0x12')](0x1f4,_0x500911[_0x6e1d('0x14')]));});});};exports[_0x6e1d('0x1c')]=function(_0x42ce7b){var _0x531a5c=this;return new Promise(function(_0x2466d0,_0x509316){return db[_0x6e1d('0x1d')]['update'](_0x42ce7b[_0x6e1d('0x19')],{'raw':_0x42ce7b[_0x6e1d('0x1a')]?_0x42ce7b[_0x6e1d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ce7b[_0x6e1d('0x1a')]?_0x42ce7b['options']['where']||null:null,'attributes':_0x42ce7b[_0x6e1d('0x1a')]?_0x42ce7b[_0x6e1d('0x1a')][_0x6e1d('0x1e')]||null:null,'limit':_0x42ce7b[_0x6e1d('0x1a')]?_0x42ce7b[_0x6e1d('0x1a')][_0x6e1d('0x1f')]||null:null})['then'](function(_0x2b4cad){logger['info'](_0x6e1d('0x1c'),_0x42ce7b);logger[_0x6e1d('0xe')](_0x6e1d('0x1c'),_0x42ce7b,JSON['stringify'](_0x2b4cad));_0x2466d0(_0x2b4cad);})['catch'](function(_0x56a857){logger[_0x6e1d('0x12')](_0x6e1d('0x1c'),_0x56a857[_0x6e1d('0x14')],_0x42ce7b);_0x509316(_0x531a5c[_0x6e1d('0x12')](0x1f4,_0x56a857['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4d07d13..10b3c01 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25fa=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./voiceCallReport.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x25fa,0x109));var _0xa25f=function(_0x22e5c3,_0x408ba4){_0x22e5c3=_0x22e5c3-0x0;var _0x5c6c76=_0x25fa[_0x22e5c3];return _0x5c6c76;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0xd')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0xe')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xf')]);router['delete'](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['destroy']);module[_0xa25f('0x10')]=router; \ No newline at end of file +var _0xd13e=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x592eeb,_0x10ef82){var _0x3ea777=function(_0x4ca4f7){while(--_0x4ca4f7){_0x592eeb['push'](_0x592eeb['shift']());}};_0x3ea777(++_0x10ef82);}(_0xd13e,0x193));var _0xed13=function(_0x3ca8e1,_0x2faa90){_0x3ca8e1=_0x3ca8e1-0x0;var _0x300b03=_0xd13e[_0x3ca8e1];return _0x300b03;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed13('0x8')](_0xed13('0x9'),auth[_0xed13('0xa')](),controller[_0xed13('0xb')]);router[_0xed13('0x8')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0xd')]);router[_0xed13('0xe')]('/',auth['isAuthenticated'](),controller[_0xed13('0xf')]);router[_0xed13('0x10')](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x11')]);router['delete'](_0xed13('0xc'),auth[_0xed13('0xa')](),controller[_0xed13('0x12')]);module[_0xed13('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7133a3d..0c6a42c 100644 --- a/server/api/voiceCallReport/voiceCallReport.attributes.js +++ b/server/api/voiceCallReport/voiceCallReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b84=['ENUM','inbound','internal','inbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x2b84,0x1ed));var _0x42b8=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2b84[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x42b8('0x0'));module[_0x42b8('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x42b8('0x2')](_0x42b8('0x3'),_0x42b8('0x4'),'outbound',_0x42b8('0x5'),'outbound-fax',_0x42b8('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x42b8('0x7')]},'source':{'type':Sequelize[_0x42b8('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x42b8('0x7')]},'channel':{'type':Sequelize[_0x42b8('0x7')]},'destinationchannel':{'type':Sequelize[_0x42b8('0x7')]},'lastapplication':{'type':Sequelize[_0x42b8('0x7')]},'lastdata':{'type':Sequelize[_0x42b8('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x42b8('0x9')]},'answertime':{'type':Sequelize[_0x42b8('0x9')]},'endtime':{'type':Sequelize[_0x42b8('0x9')]},'duration':{'type':Sequelize[_0x42b8('0xa')]},'billableseconds':{'type':Sequelize[_0x42b8('0xa')]},'mohtime':{'type':Sequelize[_0x42b8('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x42b8('0x7')]},'amaflags':{'type':Sequelize[_0x42b8('0x7')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x42b8('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x42b8('0x7')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x42b8('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdae1=['inbound','internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x221b0e,_0x13fa00){var _0x38560b=function(_0x376de6){while(--_0x376de6){_0x221b0e['push'](_0x221b0e['shift']());}};_0x38560b(++_0x13fa00);}(_0xdae1,0x76));var _0x1dae=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xdae1[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0x1dae('0x0'));module[_0x1dae('0x1')]={'uniqueid':{'type':Sequelize[_0x1dae('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1dae('0x3'),_0x1dae('0x4'),_0x1dae('0x5'),_0x1dae('0x6'),_0x1dae('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1dae('0x2')]},'source':{'type':Sequelize[_0x1dae('0x2')]},'destination':{'type':Sequelize[_0x1dae('0x2')]},'destinationcontext':{'type':Sequelize[_0x1dae('0x2')]},'callerid':{'type':Sequelize[_0x1dae('0x2')]},'channel':{'type':Sequelize[_0x1dae('0x2')]},'destinationchannel':{'type':Sequelize[_0x1dae('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x1dae('0x8')]},'starttime':{'type':Sequelize[_0x1dae('0x9')]},'systemanswertime':{'type':Sequelize[_0x1dae('0x9')]},'answertime':{'type':Sequelize[_0x1dae('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x1dae('0xa')]},'billableseconds':{'type':Sequelize[_0x1dae('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1dae('0x2')]},'amaflags':{'type':Sequelize[_0x1dae('0x2')]},'userfield':{'type':Sequelize[_0x1dae('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x1dae('0x2')]},'note':{'type':Sequelize[_0x1dae('0x2')]},'prefix':{'type':Sequelize[_0x1dae('0x2')]},'routeid':{'type':Sequelize[_0x1dae('0xa')]},'sipcallid':{'type':Sequelize[_0x1dae('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index cf854b9..fb732d7 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x1dc249,_0x2932fe){var _0x14ef44=function(_0x6138cc){while(--_0x6138cc){_0x1dc249['push'](_0x1dc249['shift']());}};_0x14ef44(++_0x2932fe);}(_0x0b0e,0x187));var _0xe0b0=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x0b0e[_0x522ae8];return _0x3189b9;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x2530f1,_0x1306dd){_0x2530f1=_0x2530f1-0x0;var _0x304c62=_0x2032[_0x2530f1];return _0x304c62;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 9178b1e..47faa76 100644 --- a/server/api/voiceCallReport/voiceCallReport.model.js +++ b/server/api/voiceCallReport/voiceCallReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf71b=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x55a4ca,_0x59f293){var _0x4bc165=function(_0x22eac9){while(--_0x22eac9){_0x55a4ca['push'](_0x55a4ca['shift']());}};_0x4bc165(++_0x59f293);}(_0xf71b,0x8e));var _0xbf71=function(_0x3bff3a,_0x43d4af){_0x3bff3a=_0x3bff3a-0x0;var _0x2e9271=_0xf71b[_0x3bff3a];return _0x2e9271;};'use strict';var _=require(_0xbf71('0x0'));var util=require(_0xbf71('0x1'));var logger=require(_0xbf71('0x2'))(_0xbf71('0x3'));var moment=require(_0xbf71('0x4'));var BPromise=require(_0xbf71('0x5'));var rp=require(_0xbf71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf71('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf71('0x8'));module[_0xbf71('0x9')]=function(_0x1db098,_0x5e7bd8){return _0x1db098[_0xbf71('0xa')](_0xbf71('0xb'),attributes,{'tableName':_0xbf71('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c0e=['moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0x117d60,_0x217e31){var _0x155472=function(_0x506d92){while(--_0x506d92){_0x117d60['push'](_0x117d60['shift']());}};_0x155472(++_0x217e31);}(_0x4c0e,0x128));var _0xe4c0=function(_0x3c8679,_0x2faea3){_0x3c8679=_0x3c8679-0x0;var _0x2791f8=_0x4c0e[_0x3c8679];return _0x2791f8;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var logger=require(_0xe4c0('0x2'))(_0xe4c0('0x3'));var moment=require(_0xe4c0('0x4'));var BPromise=require(_0xe4c0('0x5'));var rp=require(_0xe4c0('0x6'));var fs=require('fs');var path=require(_0xe4c0('0x7'));var rimraf=require(_0xe4c0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe4c0('0x9'));module['exports']=function(_0x38fc6d,_0x48e07f){return _0x38fc6d[_0xe4c0('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0xe4c0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 15b4891..ced2a06 100644 --- a/server/api/voiceCallReport/voiceCallReport.rpc.js +++ b/server/api/voiceCallReport/voiceCallReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4841=['catch','GetVoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0xc905e2,_0x3202e4){var _0x3c7028=function(_0x56b5cf){while(--_0x56b5cf){_0xc905e2['push'](_0xc905e2['shift']());}};_0x3c7028(++_0x3202e4);}(_0x4841,0x1e4));var _0x1484=function(_0x4d15ff,_0x219f04){_0x4d15ff=_0x4d15ff-0x0;var _0x4bfacc=_0x4841[_0x4d15ff];return _0x4bfacc;};'use strict';var _=require('lodash');var util=require(_0x1484('0x0'));var moment=require('moment');var BPromise=require(_0x1484('0x1'));var rs=require(_0x1484('0x2'));var fs=require('fs');var Redis=require(_0x1484('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1484('0x4'));var logger=require(_0x1484('0x5'))(_0x1484('0x6'));var config=require(_0x1484('0x7'));var jayson=require(_0x1484('0x8'));var client=jayson[_0x1484('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8ec2,_0x5d218d,_0x2ebf54){return new BPromise(function(_0x4b94cc,_0x470028){return client['request'](_0x2c8ec2,_0x2ebf54)[_0x1484('0xa')](function(_0x56f811){logger[_0x1484('0xb')](_0x1484('0xc'),_0x5d218d,'request\x20sent');logger[_0x1484('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5d218d,_0x1484('0xe'),JSON[_0x1484('0xf')](_0x56f811));if(_0x56f811[_0x1484('0x10')]){if(_0x56f811['error'][_0x1484('0x11')]===0x1f4){logger['error'](_0x1484('0xc'),_0x5d218d,_0x56f811[_0x1484('0x10')][_0x1484('0x12')]);return _0x470028(_0x56f811['error']['message']);}logger[_0x1484('0x10')](_0x1484('0xc'),_0x5d218d,_0x56f811[_0x1484('0x10')][_0x1484('0x12')]);return _0x4b94cc(_0x56f811['error']['message']);}else{logger[_0x1484('0xb')](_0x1484('0xc'),_0x5d218d,_0x1484('0xe'));_0x4b94cc(_0x56f811[_0x1484('0x13')][_0x1484('0x12')]);}})[_0x1484('0x14')](function(_0x1387a5){logger[_0x1484('0x10')](_0x1484('0xc'),_0x5d218d,_0x1387a5);_0x470028(_0x1387a5);});});}exports[_0x1484('0x15')]=function(_0x23a93b){var _0x5e79b5=this;return new Promise(function(_0x25e0b9,_0x2afb3b){return db['VoiceCallReport'][_0x1484('0x16')]({'raw':_0x23a93b[_0x1484('0x17')]?_0x23a93b[_0x1484('0x17')][_0x1484('0x18')]===undefined?!![]:![]:!![],'where':_0x23a93b[_0x1484('0x17')]?_0x23a93b[_0x1484('0x17')][_0x1484('0x19')]||null:null,'attributes':_0x23a93b['options']?_0x23a93b['options'][_0x1484('0x1a')]||null:null,'limit':_0x23a93b[_0x1484('0x17')]?_0x23a93b['options']['limit']||null:null,'include':_0x23a93b['options']?_0x23a93b['options'][_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x23a93b[_0x1484('0x17')][_0x1484('0x1b')],function(_0x639577){return{'model':db[_0x639577[_0x1484('0x1d')]],'as':_0x639577['as'],'attributes':_0x639577[_0x1484('0x1a')],'include':_0x639577[_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x639577[_0x1484('0x1b')],function(_0x3bb6a6){return{'model':db[_0x3bb6a6[_0x1484('0x1d')]],'as':_0x3bb6a6['as'],'attributes':_0x3bb6a6[_0x1484('0x1a')],'include':_0x3bb6a6[_0x1484('0x1b')]?_[_0x1484('0x1c')](_0x3bb6a6[_0x1484('0x1b')],function(_0x2053bd){return{'model':db[_0x2053bd['model']],'as':_0x2053bd['as'],'attributes':_0x2053bd['attributes']};}):[]};}):[]};}):[]:[]})[_0x1484('0xa')](function(_0x51e7e7){logger[_0x1484('0xb')](_0x1484('0x15'),_0x23a93b);logger[_0x1484('0xd')](_0x1484('0x15'),_0x23a93b,JSON[_0x1484('0xf')](_0x51e7e7));_0x25e0b9(_0x51e7e7);})[_0x1484('0x14')](function(_0x372045){logger[_0x1484('0x10')](_0x1484('0x15'),_0x372045['message'],_0x23a93b);_0x2afb3b(_0x5e79b5[_0x1484('0x10')](0x1f4,_0x372045[_0x1484('0x12')]));});});};exports[_0x1484('0x1e')]=function(_0x361833){var _0x38334f=this;return new Promise(function(_0x5d6ba9,_0x387a9d){return db[_0x1484('0x1f')][_0x1484('0x20')](_0x361833[_0x1484('0x21')],{'raw':_0x361833['options']?_0x361833[_0x1484('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b3520){logger[_0x1484('0xb')](_0x1484('0x1e'),_0x361833);logger[_0x1484('0xd')]('CreateVoiceCallReport',_0x361833,JSON[_0x1484('0xf')](_0x4b3520));_0x5d6ba9(_0x4b3520);})[_0x1484('0x14')](function(_0x15e1e4){logger['error'](_0x1484('0x1e'),_0x15e1e4[_0x1484('0x12')],_0x361833);_0x387a9d(_0x38334f[_0x1484('0x10')](0x1f4,_0x15e1e4[_0x1484('0x12')]));});});};exports[_0x1484('0x22')]=function(_0x33ef0b){var _0x24ca6f=this;return new Promise(function(_0x3c1377,_0x3f535a){return db[_0x1484('0x1f')][_0x1484('0x23')](_0x33ef0b[_0x1484('0x21')],{'raw':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ef0b['options']?_0x33ef0b[_0x1484('0x17')][_0x1484('0x19')]||null:null,'attributes':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')][_0x1484('0x1a')]||null:null,'limit':_0x33ef0b[_0x1484('0x17')]?_0x33ef0b[_0x1484('0x17')]['limit']||null:null})[_0x1484('0xa')](function(_0x36a6af){logger[_0x1484('0xb')](_0x1484('0x22'),_0x33ef0b);logger[_0x1484('0xd')](_0x1484('0x22'),_0x33ef0b,JSON[_0x1484('0xf')](_0x36a6af));_0x3c1377(_0x36a6af);})[_0x1484('0x14')](function(_0xba20ca){logger[_0x1484('0x10')]('UpdateVoiceCallReport',_0xba20ca[_0x1484('0x12')],_0x33ef0b);_0x3f535a(_0x24ca6f[_0x1484('0x10')](0x1f4,_0xba20ca[_0x1484('0x12')]));});});}; \ No newline at end of file +var _0x5721=['request','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceCallReport','findAll','options','where','attributes','map','include','model','then','stringify','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','VoiceCallReport','update','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5cfb51,_0x3b8b1b){var _0x568c36=function(_0x41a81c){while(--_0x41a81c){_0x5cfb51['push'](_0x5cfb51['shift']());}};_0x568c36(++_0x3b8b1b);}(_0x5721,0x1a3));var _0x1572=function(_0x3231b6,_0x1b492a){_0x3231b6=_0x3231b6-0x0;var _0x18b738=_0x5721[_0x3231b6];return _0x18b738;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1572('0x0'));var BPromise=require('bluebird');var rs=require(_0x1572('0x1'));var fs=require('fs');var Redis=require(_0x1572('0x2'));var db=require(_0x1572('0x3'))['db'];var utils=require(_0x1572('0x4'));var logger=require(_0x1572('0x5'))(_0x1572('0x6'));var config=require(_0x1572('0x7'));var jayson=require(_0x1572('0x8'));var client=jayson[_0x1572('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36b1bc,_0x5d73bc,_0x2f5998){return new BPromise(function(_0x31de57,_0x334cd8){return client[_0x1572('0xa')](_0x36b1bc,_0x2f5998)['then'](function(_0x131415){logger[_0x1572('0xb')](_0x1572('0xc'),_0x5d73bc,'request\x20sent');logger[_0x1572('0xd')](_0x1572('0xe'),_0x5d73bc,_0x1572('0xf'),JSON['stringify'](_0x131415));if(_0x131415['error']){if(_0x131415[_0x1572('0x10')][_0x1572('0x11')]===0x1f4){logger['error'](_0x1572('0xc'),_0x5d73bc,_0x131415[_0x1572('0x10')][_0x1572('0x12')]);return _0x334cd8(_0x131415['error'][_0x1572('0x12')]);}logger[_0x1572('0x10')](_0x1572('0xc'),_0x5d73bc,_0x131415[_0x1572('0x10')][_0x1572('0x12')]);return _0x31de57(_0x131415['error'][_0x1572('0x12')]);}else{logger[_0x1572('0xb')](_0x1572('0xc'),_0x5d73bc,_0x1572('0xf'));_0x31de57(_0x131415[_0x1572('0x13')]['message']);}})[_0x1572('0x14')](function(_0x7cb800){logger[_0x1572('0x10')](_0x1572('0xc'),_0x5d73bc,_0x7cb800);_0x334cd8(_0x7cb800);});});}exports[_0x1572('0x15')]=function(_0x400982){var _0x530ad8=this;return new Promise(function(_0x2ff073,_0x579906){return db['VoiceCallReport'][_0x1572('0x16')]({'raw':_0x400982[_0x1572('0x17')]?_0x400982[_0x1572('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x400982[_0x1572('0x17')]?_0x400982[_0x1572('0x17')][_0x1572('0x18')]||null:null,'attributes':_0x400982['options']?_0x400982[_0x1572('0x17')][_0x1572('0x19')]||null:null,'limit':_0x400982[_0x1572('0x17')]?_0x400982[_0x1572('0x17')]['limit']||null:null,'include':_0x400982['options']?_0x400982[_0x1572('0x17')]['include']?_[_0x1572('0x1a')](_0x400982['options'][_0x1572('0x1b')],function(_0x419b75){return{'model':db[_0x419b75['model']],'as':_0x419b75['as'],'attributes':_0x419b75['attributes'],'include':_0x419b75['include']?_[_0x1572('0x1a')](_0x419b75[_0x1572('0x1b')],function(_0x3fc24a){return{'model':db[_0x3fc24a[_0x1572('0x1c')]],'as':_0x3fc24a['as'],'attributes':_0x3fc24a['attributes'],'include':_0x3fc24a[_0x1572('0x1b')]?_[_0x1572('0x1a')](_0x3fc24a[_0x1572('0x1b')],function(_0x5979f8){return{'model':db[_0x5979f8[_0x1572('0x1c')]],'as':_0x5979f8['as'],'attributes':_0x5979f8['attributes']};}):[]};}):[]};}):[]:[]})[_0x1572('0x1d')](function(_0x58d4db){logger['info']('GetVoiceCallReport',_0x400982);logger[_0x1572('0xd')](_0x1572('0x15'),_0x400982,JSON[_0x1572('0x1e')](_0x58d4db));_0x2ff073(_0x58d4db);})['catch'](function(_0x13d54f){logger[_0x1572('0x10')](_0x1572('0x15'),_0x13d54f[_0x1572('0x12')],_0x400982);_0x579906(_0x530ad8[_0x1572('0x10')](0x1f4,_0x13d54f[_0x1572('0x12')]));});});};exports[_0x1572('0x1f')]=function(_0xf69dfd){var _0xb6d960=this;return new Promise(function(_0x3c8353,_0xf78c7d){return db['VoiceCallReport'][_0x1572('0x20')](_0xf69dfd[_0x1572('0x21')],{'raw':_0xf69dfd[_0x1572('0x17')]?_0xf69dfd[_0x1572('0x17')][_0x1572('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x39f5aa){logger[_0x1572('0xb')]('CreateVoiceCallReport',_0xf69dfd);logger[_0x1572('0xd')](_0x1572('0x1f'),_0xf69dfd,JSON[_0x1572('0x1e')](_0x39f5aa));_0x3c8353(_0x39f5aa);})[_0x1572('0x14')](function(_0x2dc0bf){logger[_0x1572('0x10')](_0x1572('0x1f'),_0x2dc0bf['message'],_0xf69dfd);_0xf78c7d(_0xb6d960[_0x1572('0x10')](0x1f4,_0x2dc0bf['message']));});});};exports[_0x1572('0x23')]=function(_0x37fae2){var _0x193e26=this;return new Promise(function(_0x2a1f90,_0x482001){return db[_0x1572('0x24')][_0x1572('0x25')](_0x37fae2[_0x1572('0x21')],{'raw':_0x37fae2[_0x1572('0x17')]?_0x37fae2[_0x1572('0x17')][_0x1572('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37fae2[_0x1572('0x17')]?_0x37fae2['options'][_0x1572('0x18')]||null:null,'attributes':_0x37fae2['options']?_0x37fae2['options'][_0x1572('0x19')]||null:null,'limit':_0x37fae2['options']?_0x37fae2[_0x1572('0x17')][_0x1572('0x26')]||null:null})['then'](function(_0x452063){logger[_0x1572('0xb')](_0x1572('0x23'),_0x37fae2);logger[_0x1572('0xd')](_0x1572('0x23'),_0x37fae2,JSON['stringify'](_0x452063));_0x2a1f90(_0x452063);})['catch'](function(_0x433d68){logger[_0x1572('0x10')]('UpdateVoiceCallReport',_0x433d68['message'],_0x37fae2);_0x482001(_0x193e26[_0x1572('0x10')](0x1f4,_0x433d68[_0x1572('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 13a7f23..62d5044 100644 --- a/server/api/voiceChanSpy/index.js +++ b/server/api/voiceChanSpy/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6e5=['create','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post'];(function(_0x41432b,_0x2b26da){var _0x401932=function(_0x3ed256){while(--_0x3ed256){_0x41432b['push'](_0x41432b['shift']());}};_0x401932(++_0x2b26da);}(_0xf6e5,0x112));var _0x5f6e=function(_0x1f179a,_0x92185c){_0x1f179a=_0x1f179a-0x0;var _0x3fc700=_0xf6e5[_0x1f179a];return _0x3fc700;};'use strict';var multer=require('multer');var util=require(_0x5f6e('0x0'));var path=require(_0x5f6e('0x1'));var timeout=require(_0x5f6e('0x2'));var express=require(_0x5f6e('0x3'));var router=express[_0x5f6e('0x4')]();var fs_extra=require(_0x5f6e('0x5'));var auth=require(_0x5f6e('0x6'));var interaction=require(_0x5f6e('0x7'));var config=require(_0x5f6e('0x8'));var controller=require(_0x5f6e('0x9'));router[_0x5f6e('0xa')]('/',auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xc')]);router[_0x5f6e('0xa')](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller['show']);router[_0x5f6e('0xe')]('/',auth[_0x5f6e('0xb')](),controller[_0x5f6e('0xf')]);router['put'](_0x5f6e('0xd'),auth[_0x5f6e('0xb')](),controller['update']);router['delete'](_0x5f6e('0xd'),auth['isAuthenticated'](),controller[_0x5f6e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa561=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','multer','util','connect-timeout'];(function(_0x29ce37,_0xdfe533){var _0x5b754f=function(_0x3f9324){while(--_0x3f9324){_0x29ce37['push'](_0x29ce37['shift']());}};_0x5b754f(++_0xdfe533);}(_0xa561,0x1b7));var _0x1a56=function(_0x4fdc9d,_0x250163){_0x4fdc9d=_0x4fdc9d-0x0;var _0x37df45=_0xa561[_0x4fdc9d];return _0x37df45;};'use strict';var multer=require(_0x1a56('0x0'));var util=require(_0x1a56('0x1'));var path=require('path');var timeout=require(_0x1a56('0x2'));var express=require(_0x1a56('0x3'));var router=express[_0x1a56('0x4')]();var fs_extra=require(_0x1a56('0x5'));var auth=require(_0x1a56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1a56('0x7'));var controller=require(_0x1a56('0x8'));router[_0x1a56('0x9')]('/',auth[_0x1a56('0xa')](),controller['index']);router['get'](_0x1a56('0xb'),auth['isAuthenticated'](),controller[_0x1a56('0xc')]);router['post']('/',auth[_0x1a56('0xa')](),controller[_0x1a56('0xd')]);router[_0x1a56('0xe')](_0x1a56('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1a56('0xb'),auth[_0x1a56('0xa')](),controller[_0x1a56('0xf')]);module[_0x1a56('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 947aa2e..3d51e57 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.attributes.js +++ b/server/api/voiceChanSpy/voiceChanSpy.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x112f=['join','getDataValue','split','BOOLEAN','sequelize','STRING','setDataValue','options'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x112f,0x7c));var _0xf112=function(_0x17fdde,_0x4b3717){_0x17fdde=_0x17fdde-0x0;var _0x4fd885=_0x112f[_0x17fdde];return _0x4fd885;};'use strict';var Sequelize=require(_0xf112('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xf112('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0xf112('0x1')],'set':function(_0x4c243f){this[_0xf112('0x2')](_0xf112('0x3'),_0x4c243f?_0x4c243f[_0xf112('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xf112('0x3'))?this[_0xf112('0x5')](_0xf112('0x3'))[_0xf112('0x6')](''):[];}},'auth':{'type':Sequelize[_0xf112('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e6f=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x27371f,_0x469ecb){var _0x464729=function(_0x2137d5){while(--_0x2137d5){_0x27371f['push'](_0x27371f['shift']());}};_0x464729(++_0x469ecb);}(_0x2e6f,0x1ef));var _0xf2e6=function(_0x4dedf6,_0x5e8b82){_0x4dedf6=_0x4dedf6-0x0;var _0x183bf7=_0x2e6f[_0x4dedf6];return _0x183bf7;};'use strict';var Sequelize=require(_0xf2e6('0x0'));module[_0xf2e6('0x1')]={'name':{'type':Sequelize[_0xf2e6('0x2')]},'prefix':{'type':Sequelize[_0xf2e6('0x2')],'unique':_0xf2e6('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf2e6('0x2')],'set':function(_0x2c3f4e){this['setDataValue'](_0xf2e6('0x4'),_0x2c3f4e?_0x2c3f4e[_0xf2e6('0x5')](''):[]);},'get':function(){return this[_0xf2e6('0x6')](_0xf2e6('0x4'))?this['getDataValue'](_0xf2e6('0x4'))[_0xf2e6('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xf2e6('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf2e6('0x2')]},'description':{'type':Sequelize[_0xf2e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1558bf1..dae6e10 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.controller.js +++ b/server/api/voiceChanSpy/voiceChanSpy.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53d5=['undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit'];(function(_0x27b300,_0x30d773){var _0xe62f0b=function(_0x26d769){while(--_0x26d769){_0x27b300['push'](_0x27b300['shift']());}};_0xe62f0b(++_0x30d773);}(_0x53d5,0x1cc));var _0x553d=function(_0x4cc593,_0x82927){_0x4cc593=_0x4cc593-0x0;var _0x1ac9e7=_0x53d5[_0x4cc593];return _0x1ac9e7;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){var _0x5bc7f0=_0x2e4f1b['get']({'plain':!![]});var _0x2caed9='ChanSpies';return db[_0x553d('0x2a')][_0x553d('0x29')]({'where':{'type':_0x2caed9,'resourceId':_0x5bc7f0['id']}})['then'](function(){return _0x2e4f1b;});})[_0x553d('0x28')](function(){_0x82dd3a[_0x553d('0x1c')](0xcc)[_0x553d('0x1d')]();});}};}function handleEntityNotFound(_0x5cda9e,_0x1f3f5c){return function(_0x349b3f){if(!_0x349b3f){_0x5cda9e[_0x553d('0x1b')](0x194);}return _0x349b3f;};}function handleError(_0x54f0ed,_0x24ff8b){_0x24ff8b=_0x24ff8b||0x1f4;return function(_0x39943d){logger[_0x553d('0x2b')](_0x39943d['stack']);if(_0x39943d[_0x553d('0x2c')]){delete _0x39943d[_0x553d('0x2c')];}_0x54f0ed[_0x553d('0x1c')](_0x24ff8b)['send'](_0x39943d);};}exports[_0x553d('0x2d')]=function(_0x4b70b3,_0x174fea){var _0x35a77d={},_0xe1a5b5={},_0x615816={'count':0x0,'rows':[]};var _0x8e6605=_[_0x553d('0x2e')](db[_0x553d('0x2f')][_0x553d('0x30')],function(_0x5acfce){return{'name':_0x5acfce[_0x553d('0x31')],'type':_0x5acfce[_0x553d('0x32')][_0x553d('0x33')]};});_0xe1a5b5[_0x553d('0x34')]=_[_0x553d('0x2e')](_0x8e6605,_0x553d('0x2c'));_0xe1a5b5[_0x553d('0x35')]=_[_0x553d('0x36')](_0x4b70b3['query']);_0xe1a5b5[_0x553d('0x37')]=_[_0x553d('0x38')](_0xe1a5b5[_0x553d('0x34')],_0xe1a5b5['query']);_0x35a77d[_0x553d('0x39')]=_[_0x553d('0x38')](_0xe1a5b5[_0x553d('0x34')],qs[_0x553d('0x3a')](_0x4b70b3[_0x553d('0x35')][_0x553d('0x3a')]));_0x35a77d[_0x553d('0x39')]=_0x35a77d[_0x553d('0x39')]['length']?_0x35a77d['attributes']:_0xe1a5b5[_0x553d('0x34')];if(!_0x4b70b3[_0x553d('0x35')]['hasOwnProperty'](_0x553d('0x3b'))){_0x35a77d['limit']=qs['limit'](_0x4b70b3[_0x553d('0x35')]['limit']);_0x35a77d[_0x553d('0x21')]=qs['offset'](_0x4b70b3[_0x553d('0x35')][_0x553d('0x21')]);}_0x35a77d['order']=qs['sort'](_0x4b70b3[_0x553d('0x35')][_0x553d('0x3c')]);_0x35a77d[_0x553d('0x3d')]=qs[_0x553d('0x37')](_['pick'](_0x4b70b3[_0x553d('0x35')],_0xe1a5b5[_0x553d('0x37')]),_0x8e6605);if(_0x4b70b3['query'][_0x553d('0x3e')]){_0x35a77d['where']=_[_0x553d('0x3f')](_0x35a77d[_0x553d('0x3d')],{'$or':_[_0x553d('0x2e')](_0x8e6605,function(_0xcd967f){if(_0xcd967f['type']!=='VIRTUAL'){var _0x299a45={};_0x299a45[_0xcd967f[_0x553d('0x2c')]]={'$like':'%'+_0x4b70b3[_0x553d('0x35')][_0x553d('0x3e')]+'%'};return _0x299a45;}})});}_0x35a77d=_[_0x553d('0x3f')]({},_0x35a77d,_0x4b70b3[_0x553d('0x40')]);var _0x403f4a={'where':_0x35a77d[_0x553d('0x3d')]};return db[_0x553d('0x2f')][_0x553d('0x22')](_0x403f4a)['then'](function(_0x431fdb){_0x615816[_0x553d('0x22')]=_0x431fdb;if(_0x4b70b3['query'][_0x553d('0x41')]){_0x35a77d[_0x553d('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x553d('0x43')](_0x35a77d);})[_0x553d('0x28')](function(_0x40bc7a){_0x615816[_0x553d('0x44')]=_0x40bc7a;return _0x615816;})[_0x553d('0x28')](respondWithFilteredResult(_0x174fea,_0x35a77d))[_0x553d('0x45')](handleError(_0x174fea,null));};exports['show']=function(_0xb0f66e,_0x15426f){var _0x13d2e9={'raw':![],'where':{'id':_0xb0f66e[_0x553d('0x46')]['id']}},_0x5d300e={};_0x5d300e[_0x553d('0x34')]=_['keys'](db[_0x553d('0x2f')][_0x553d('0x30')]);_0x5d300e[_0x553d('0x35')]=_[_0x553d('0x36')](_0xb0f66e[_0x553d('0x35')]);_0x5d300e[_0x553d('0x37')]=_[_0x553d('0x38')](_0x5d300e[_0x553d('0x34')],_0x5d300e[_0x553d('0x35')]);_0x13d2e9['attributes']=_[_0x553d('0x38')](_0x5d300e['model'],qs[_0x553d('0x3a')](_0xb0f66e['query'][_0x553d('0x3a')]));_0x13d2e9[_0x553d('0x39')]=_0x13d2e9['attributes'][_0x553d('0x47')]?_0x13d2e9[_0x553d('0x39')]:_0x5d300e[_0x553d('0x34')];if(_0xb0f66e[_0x553d('0x35')][_0x553d('0x41')]){_0x13d2e9['include']=[{'all':!![]}];}_0x13d2e9=_[_0x553d('0x3f')]({},_0x13d2e9,_0xb0f66e['options']);return db[_0x553d('0x2f')][_0x553d('0x48')](_0x13d2e9)[_0x553d('0x28')](handleEntityNotFound(_0x15426f,null))[_0x553d('0x28')](respondWithResult(_0x15426f,null))[_0x553d('0x45')](handleError(_0x15426f,null));};exports[_0x553d('0x49')]=function(_0xb6b182,_0x29259a){return db[_0x553d('0x2f')][_0x553d('0x49')](_0xb6b182[_0x553d('0x4a')],{})[_0x553d('0x28')](function(_0x1c176f){var _0x300f0f=_0xb6b182[_0x553d('0x4b')][_0x553d('0x4c')]({'plain':!![]});if(!_0x300f0f)throw new Error(_0x553d('0x4d'));if(_0x300f0f['role']===_0x553d('0x4b')){var _0x1ed718=_0x1c176f[_0x553d('0x4c')]({'plain':!![]});var _0x2e63cd='ChanSpies';return db['UserProfileSection'][_0x553d('0x48')]({'where':{'name':_0x2e63cd,'userProfileId':_0x300f0f[_0x553d('0x4e')]},'raw':!![]})[_0x553d('0x28')](function(_0x30cb25){if(_0x30cb25&&_0x30cb25[_0x553d('0x4f')]===0x0){return db[_0x553d('0x2a')][_0x553d('0x49')]({'name':_0x1ed718[_0x553d('0x2c')],'resourceId':_0x1ed718['id'],'type':_0x30cb25[_0x553d('0x2c')],'sectionId':_0x30cb25['id']},{})['then'](function(){return _0x1c176f;});}else{return _0x1c176f;}})[_0x553d('0x45')](function(_0xec2dff){logger[_0x553d('0x2b')](_0x553d('0x50'),_0xec2dff);throw _0xec2dff;});}return _0x1c176f;})['then'](respondWithResult(_0x29259a,0xc9))['catch'](handleError(_0x29259a,null));};exports[_0x553d('0x51')]=function(_0x433c1e,_0x3d04e8){if(_0x433c1e[_0x553d('0x4a')]['id']){delete _0x433c1e[_0x553d('0x4a')]['id'];}return db[_0x553d('0x2f')][_0x553d('0x48')]({'where':{'id':_0x433c1e[_0x553d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d04e8,null))[_0x553d('0x28')](saveUpdates(_0x433c1e['body'],null))[_0x553d('0x28')](respondWithResult(_0x3d04e8,null))['catch'](handleError(_0x3d04e8,null));};exports[_0x553d('0x29')]=function(_0x50489f,_0x543103){return db[_0x553d('0x2f')][_0x553d('0x48')]({'where':{'id':_0x50489f['params']['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x543103,null))[_0x553d('0x28')](removeEntity(_0x543103,null))[_0x553d('0x45')](handleError(_0x543103,null));}; \ No newline at end of file +var _0x3ae9=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','stack','name','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x480496,_0x943da3){var _0x5ddc8c=function(_0x5bd231){while(--_0x5bd231){_0x480496['push'](_0x480496['shift']());}};_0x5ddc8c(++_0x943da3);}(_0x3ae9,0xdb));var _0x93ae=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x3ae9[_0x49ca18];return _0x145d54;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ae('0x0'));var jsonpatch=require(_0x93ae('0x1'));var rp=require(_0x93ae('0x2'));var moment=require('moment');var BPromise=require(_0x93ae('0x3'));var Mustache=require(_0x93ae('0x4'));var util=require(_0x93ae('0x5'));var path=require(_0x93ae('0x6'));var sox=require('sox');var csv=require(_0x93ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ae('0x8'));var _=require(_0x93ae('0x9'));var squel=require(_0x93ae('0xa'));var crypto=require(_0x93ae('0xb'));var jsforce=require(_0x93ae('0xc'));var deskjs=require(_0x93ae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x93ae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93ae('0xf'));var as=require(_0x93ae('0x10'));var hardwareService=require(_0x93ae('0x11'));var logger=require(_0x93ae('0x12'))(_0x93ae('0x13'));var utils=require(_0x93ae('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93ae('0x15'))['db'];function respondWithStatusCode(_0x1a23a3,_0x4a9f52){_0x4a9f52=_0x4a9f52||0xcc;return function(_0x571e5f){if(_0x571e5f){return _0x1a23a3[_0x93ae('0x16')](_0x4a9f52);}return _0x1a23a3['status'](_0x4a9f52)[_0x93ae('0x17')]();};}function respondWithResult(_0xbaf0e,_0x5b4ea1){_0x5b4ea1=_0x5b4ea1||0xc8;return function(_0x392a55){if(_0x392a55){return _0xbaf0e[_0x93ae('0x18')](_0x5b4ea1)[_0x93ae('0x19')](_0x392a55);}};}function respondWithFilteredResult(_0x1f8aa2,_0x121937){return function(_0x2d1df5){if(_0x2d1df5){var _0x5ed82a=typeof _0x121937[_0x93ae('0x1a')]===_0x93ae('0x1b')&&typeof _0x121937[_0x93ae('0x1c')]==='undefined';var _0x1a1718=_0x2d1df5['count'];var _0x54cfd0=_0x5ed82a?0x0:_0x121937[_0x93ae('0x1a')];var _0x51c77d=_0x5ed82a?_0x2d1df5[_0x93ae('0x1d')]:_0x121937[_0x93ae('0x1a')]+_0x121937['limit'];var _0x2dd19a;if(_0x51c77d>=_0x1a1718){_0x51c77d=_0x1a1718;_0x2dd19a=0xc8;}else{_0x2dd19a=0xce;}_0x1f8aa2[_0x93ae('0x18')](_0x2dd19a);return _0x1f8aa2[_0x93ae('0x1e')](_0x93ae('0x1f'),_0x54cfd0+'-'+_0x51c77d+'/'+_0x1a1718)['json'](_0x2d1df5);}return null;};}function patchUpdates(_0x128913){return function(_0x2f4187){try{jsonpatch['apply'](_0x2f4187,_0x128913,!![]);}catch(_0x3e0407){return BPromise[_0x93ae('0x20')](_0x3e0407);}return _0x2f4187[_0x93ae('0x21')]();};}function saveUpdates(_0x29922f,_0x26d5ac){return function(_0x468fdf){if(_0x468fdf){return _0x468fdf[_0x93ae('0x22')](_0x29922f)['then'](function(_0x5e7c32){return _0x5e7c32;});}return null;};}function removeEntity(_0xd33af5,_0x283e50){return function(_0x4f9f43){if(_0x4f9f43){return _0x4f9f43['destroy']()[_0x93ae('0x23')](function(){var _0x367c0f=_0x4f9f43[_0x93ae('0x24')]({'plain':!![]});var _0x10f6a3=_0x93ae('0x25');return db[_0x93ae('0x26')][_0x93ae('0x27')]({'where':{'type':_0x10f6a3,'resourceId':_0x367c0f['id']}})[_0x93ae('0x23')](function(){return _0x4f9f43;});})['then'](function(){_0xd33af5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x270319,_0x29e4e7){return function(_0x2dada4){if(!_0x2dada4){_0x270319[_0x93ae('0x16')](0x194);}return _0x2dada4;};}function handleError(_0x3d89ea,_0x17fab9){_0x17fab9=_0x17fab9||0x1f4;return function(_0x520d6d){logger['error'](_0x520d6d[_0x93ae('0x28')]);if(_0x520d6d[_0x93ae('0x29')]){delete _0x520d6d[_0x93ae('0x29')];}_0x3d89ea[_0x93ae('0x18')](_0x17fab9)['send'](_0x520d6d);};}exports['index']=function(_0x554318,_0x19aaaa){var _0x512d8f={},_0x4436f3={},_0x44267d={'count':0x0,'rows':[]};var _0x58b5d6=_[_0x93ae('0x2a')](db[_0x93ae('0x2b')][_0x93ae('0x2c')],function(_0x369ac2){return{'name':_0x369ac2[_0x93ae('0x2d')],'type':_0x369ac2[_0x93ae('0x2e')][_0x93ae('0x2f')]};});_0x4436f3[_0x93ae('0x30')]=_['map'](_0x58b5d6,_0x93ae('0x29'));_0x4436f3[_0x93ae('0x31')]=_[_0x93ae('0x32')](_0x554318[_0x93ae('0x31')]);_0x4436f3[_0x93ae('0x33')]=_[_0x93ae('0x34')](_0x4436f3[_0x93ae('0x30')],_0x4436f3[_0x93ae('0x31')]);_0x512d8f['attributes']=_[_0x93ae('0x34')](_0x4436f3['model'],qs[_0x93ae('0x35')](_0x554318[_0x93ae('0x31')][_0x93ae('0x35')]));_0x512d8f[_0x93ae('0x36')]=_0x512d8f[_0x93ae('0x36')][_0x93ae('0x37')]?_0x512d8f['attributes']:_0x4436f3[_0x93ae('0x30')];if(!_0x554318[_0x93ae('0x31')][_0x93ae('0x38')]('nolimit')){_0x512d8f[_0x93ae('0x1c')]=qs[_0x93ae('0x1c')](_0x554318[_0x93ae('0x31')]['limit']);_0x512d8f['offset']=qs[_0x93ae('0x1a')](_0x554318[_0x93ae('0x31')][_0x93ae('0x1a')]);}_0x512d8f[_0x93ae('0x39')]=qs[_0x93ae('0x3a')](_0x554318[_0x93ae('0x31')][_0x93ae('0x3a')]);_0x512d8f[_0x93ae('0x3b')]=qs[_0x93ae('0x33')](_[_0x93ae('0x3c')](_0x554318[_0x93ae('0x31')],_0x4436f3[_0x93ae('0x33')]),_0x58b5d6);if(_0x554318[_0x93ae('0x31')][_0x93ae('0x3d')]){_0x512d8f['where']=_[_0x93ae('0x3e')](_0x512d8f[_0x93ae('0x3b')],{'$or':_['map'](_0x58b5d6,function(_0x31df39){if(_0x31df39['type']!=='VIRTUAL'){var _0xf47c8c={};_0xf47c8c[_0x31df39['name']]={'$like':'%'+_0x554318[_0x93ae('0x31')][_0x93ae('0x3d')]+'%'};return _0xf47c8c;}})});}_0x512d8f=_[_0x93ae('0x3e')]({},_0x512d8f,_0x554318[_0x93ae('0x3f')]);var _0x1b7e1f={'where':_0x512d8f[_0x93ae('0x3b')]};return db['VoiceChanSpy'][_0x93ae('0x1d')](_0x1b7e1f)[_0x93ae('0x23')](function(_0x2baf95){_0x44267d[_0x93ae('0x1d')]=_0x2baf95;if(_0x554318[_0x93ae('0x31')][_0x93ae('0x40')]){_0x512d8f[_0x93ae('0x41')]=[{'all':!![]}];}return db[_0x93ae('0x2b')][_0x93ae('0x42')](_0x512d8f);})[_0x93ae('0x23')](function(_0x3ba904){_0x44267d['rows']=_0x3ba904;return _0x44267d;})[_0x93ae('0x23')](respondWithFilteredResult(_0x19aaaa,_0x512d8f))[_0x93ae('0x43')](handleError(_0x19aaaa,null));};exports['show']=function(_0x553f3a,_0xb014d1){var _0x2b04d6={'raw':![],'where':{'id':_0x553f3a[_0x93ae('0x44')]['id']}},_0x1cbc76={};_0x1cbc76[_0x93ae('0x30')]=_[_0x93ae('0x32')](db[_0x93ae('0x2b')][_0x93ae('0x2c')]);_0x1cbc76['query']=_[_0x93ae('0x32')](_0x553f3a[_0x93ae('0x31')]);_0x1cbc76[_0x93ae('0x33')]=_[_0x93ae('0x34')](_0x1cbc76[_0x93ae('0x30')],_0x1cbc76['query']);_0x2b04d6['attributes']=_[_0x93ae('0x34')](_0x1cbc76['model'],qs[_0x93ae('0x35')](_0x553f3a['query']['fields']));_0x2b04d6[_0x93ae('0x36')]=_0x2b04d6[_0x93ae('0x36')][_0x93ae('0x37')]?_0x2b04d6[_0x93ae('0x36')]:_0x1cbc76[_0x93ae('0x30')];if(_0x553f3a[_0x93ae('0x31')][_0x93ae('0x40')]){_0x2b04d6['include']=[{'all':!![]}];}_0x2b04d6=_[_0x93ae('0x3e')]({},_0x2b04d6,_0x553f3a['options']);return db['VoiceChanSpy'][_0x93ae('0x45')](_0x2b04d6)[_0x93ae('0x23')](handleEntityNotFound(_0xb014d1,null))[_0x93ae('0x23')](respondWithResult(_0xb014d1,null))[_0x93ae('0x43')](handleError(_0xb014d1,null));};exports['create']=function(_0x2c8ca5,_0x4e7652){return db[_0x93ae('0x2b')][_0x93ae('0x46')](_0x2c8ca5[_0x93ae('0x47')],{})[_0x93ae('0x23')](function(_0x135d91){var _0x46e115=_0x2c8ca5[_0x93ae('0x48')][_0x93ae('0x24')]({'plain':!![]});if(!_0x46e115)throw new Error(_0x93ae('0x49'));if(_0x46e115['role']==='user'){var _0x501d57=_0x135d91['get']({'plain':!![]});var _0x5f11ab=_0x93ae('0x25');return db[_0x93ae('0x4a')][_0x93ae('0x45')]({'where':{'name':_0x5f11ab,'userProfileId':_0x46e115[_0x93ae('0x4b')]},'raw':!![]})['then'](function(_0x3c5ffe){if(_0x3c5ffe&&_0x3c5ffe['autoAssociation']===0x0){return db[_0x93ae('0x26')][_0x93ae('0x46')]({'name':_0x501d57[_0x93ae('0x29')],'resourceId':_0x501d57['id'],'type':_0x3c5ffe[_0x93ae('0x29')],'sectionId':_0x3c5ffe['id']},{})[_0x93ae('0x23')](function(){return _0x135d91;});}else{return _0x135d91;}})[_0x93ae('0x43')](function(_0x161f30){logger[_0x93ae('0x4c')](_0x93ae('0x4d'),_0x161f30);throw _0x161f30;});}return _0x135d91;})['then'](respondWithResult(_0x4e7652,0xc9))[_0x93ae('0x43')](handleError(_0x4e7652,null));};exports['update']=function(_0x2b1aa2,_0x11644c){if(_0x2b1aa2[_0x93ae('0x47')]['id']){delete _0x2b1aa2[_0x93ae('0x47')]['id'];}return db[_0x93ae('0x2b')][_0x93ae('0x45')]({'where':{'id':_0x2b1aa2[_0x93ae('0x44')]['id']}})['then'](handleEntityNotFound(_0x11644c,null))[_0x93ae('0x23')](saveUpdates(_0x2b1aa2['body'],null))['then'](respondWithResult(_0x11644c,null))[_0x93ae('0x43')](handleError(_0x11644c,null));};exports[_0x93ae('0x27')]=function(_0x488376,_0x1efe77){return db[_0x93ae('0x2b')][_0x93ae('0x45')]({'where':{'id':_0x488376[_0x93ae('0x44')]['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x1efe77,null))[_0x93ae('0x23')](removeEntity(_0x1efe77,null))[_0x93ae('0x43')](handleError(_0x1efe77,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a71681e..576b4a6 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.model.js +++ b/server/api/voiceChanSpy/voiceChanSpy.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7fa=['MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','bluebird','context','from-sip','format','prefix','system','merge','Set','chanspy','push'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0xd7fa,0x1b0));var _0xad7f=function(_0x2aa161,_0xa7a83d){_0x2aa161=_0x2aa161-0x0;var _0x2831ae=_0xd7fa[_0x2aa161];return _0x2831ae;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xad7f('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x43a4fe,_0x10e162,_0x387865){var _0xc4aedb=0x1;var _0x3c1318=[];var _0x4f3791={'context':_0x10e162[_0xad7f('0x1')]||_0xad7f('0x2'),'exten':util[_0xad7f('0x3')]('%s%s',_0x43a4fe[_0xad7f('0x4')],_0x387865),'type':_0xad7f('0x5'),'isApp':![],'ChanSpyId':_0x43a4fe['id'],'UserId':_0x10e162['id']};_0x3c1318['push'](_[_0xad7f('0x6')]({'app':_0xad7f('0x7'),'appdata':util[_0xad7f('0x3')]('CDR(type)=%s',_0xad7f('0x8')),'priority':_0xc4aedb++},_0x4f3791));if(_0x43a4fe['record']){_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':_0xad7f('0xa'),'appdata':util[_0xad7f('0x3')](_0xad7f('0xb'),_0x43a4fe['recordingFormat']),'priority':_0xc4aedb++},_0x4f3791));}if(_0x43a4fe[_0xad7f('0xc')]){_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':'Authenticate','appdata':_0x43a4fe[_0xad7f('0xd')],'priority':_0xc4aedb++},_0x4f3791));}_0x3c1318[_0xad7f('0x9')](_[_0xad7f('0x6')]({'app':_0xad7f('0xe'),'appdata':util['format'](_0xad7f('0xf'),_0x10e162[_0xad7f('0x10')],_0x43a4fe[_0xad7f('0x11')]?_0x43a4fe[_0xad7f('0x11')][_0xad7f('0x12')](''):''),'priority':_0xc4aedb++},_0x4f3791));if(_0x43a4fe['record']){_0x3c1318['push'](_['merge']({'app':'StopMixMonitor','priority':_0xc4aedb++},_0x4f3791));}return _0x3c1318;};var getChanSpyApplications=function(_0x57fee5,_0x43970c){var _0xe68834=[];for(var _0x348a6d=0x0,_0x1ba911=0x1;_0x348a6d<_0x43970c[_0xad7f('0x13')];_0x348a6d++,_0x1ba911=0x1){_0xe68834=_0xe68834[_0xad7f('0x14')](getUserApplications(_0x57fee5,_0x43970c[_0x348a6d],_0x43970c[_0x348a6d][_0xad7f('0x15')]));if(_0x43970c[_0x348a6d][_0xad7f('0x15')]!=_0x43970c[_0x348a6d]['name']){_0xe68834=_0xe68834[_0xad7f('0x14')](getUserApplications(_0x57fee5,_0x43970c[_0x348a6d],_0x43970c[_0x348a6d][_0xad7f('0x10')]));}}return _0xe68834;};var getChanSpyPromise=function(_0x1a48cc,_0xf14ec0){return new BPromise(function(_0x16b601,_0x2fbcd9){return _0x1a48cc['User'][_0xad7f('0x16')]({'attributes':['id',_0xad7f('0x10'),_0xad7f('0x15')],'where':{'role':_0xad7f('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31d679){if(_0x31d679){return _0x16b601(getChanSpyApplications(_0xf14ec0,_0x31d679));}return _0x16b601([]);})[_0xad7f('0x18')](function(_0x35f2f1){_0x2fbcd9(_0x35f2f1);});});};module[_0xad7f('0x19')]=function(_0x55f766,_0x3de82f){var _0x155327=_0x55f766[_0xad7f('0x1a')];return _0x55f766[_0xad7f('0x1b')](_0xad7f('0x1c'),attributes,{'tableName':_0xad7f('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f1f0d,_0xdf715c,_0x4abe73){return getChanSpyPromise(_0x155327,_0x3f1f0d)[_0xad7f('0x1e')](function(_0x10325c){if(_0x10325c&&_0x10325c[_0xad7f('0x13')]){return _0x155327[_0xad7f('0x1f')]['bulkCreate'](_0x10325c);}})[_0xad7f('0x1e')](function(){_0x4abe73();})[_0xad7f('0x18')](function(_0x1df92c){_0x4abe73(_0x1df92c);});},'afterUpdate':function(_0x1a6680,_0x3e3f4e,_0x36820b){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x20')]({'where':{'ChanSpyId':_0x1a6680['id']}})[_0xad7f('0x1e')](function(){return getChanSpyPromise(_0x155327,_0x1a6680);})[_0xad7f('0x1e')](function(_0x3004cb){if(_0x3004cb&&_0x3004cb[_0xad7f('0x13')]){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x21')](_0x3004cb);}})[_0xad7f('0x1e')](function(){_0x36820b();})[_0xad7f('0x18')](function(_0x3b1037){_0x36820b(_0x3b1037);});},'afterDestroy':function(_0x535f5d,_0x4f9386,_0x2c96ae){return _0x155327[_0xad7f('0x1f')][_0xad7f('0x20')]({'where':{'ChanSpyId':_0x535f5d['id']}})['then'](function(){_0x2c96ae();})[_0xad7f('0x18')](function(_0x3379f0){_0x2c96ae(_0x3379f0);});}}});}; \ No newline at end of file +var _0xebdb=['record','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','then','./voiceChanSpy.attributes','context','from-sip','format','prefix','Set','CDR(type)=%s','push','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join'];(function(_0x3087c3,_0x43ab01){var _0x3caaf5=function(_0xa195f1){while(--_0xa195f1){_0x3087c3['push'](_0x3087c3['shift']());}};_0x3caaf5(++_0x43ab01);}(_0xebdb,0x19d));var _0xbebd=function(_0x6899c7,_0x363413){_0x6899c7=_0x6899c7-0x0;var _0x5186ee=_0xebdb[_0x6899c7];return _0x5186ee;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xbebd('0x0'));var getUserApplications=function(_0x160c6e,_0x1e16cf,_0x804bc5){var _0x50d045=0x1;var _0x752afe=[];var _0x4a97bc={'context':_0x1e16cf[_0xbebd('0x1')]||_0xbebd('0x2'),'exten':util[_0xbebd('0x3')]('%s%s',_0x160c6e[_0xbebd('0x4')],_0x804bc5),'type':'system','isApp':![],'ChanSpyId':_0x160c6e['id'],'UserId':_0x1e16cf['id']};_0x752afe['push'](_['merge']({'app':_0xbebd('0x5'),'appdata':util['format'](_0xbebd('0x6'),'chanspy'),'priority':_0x50d045++},_0x4a97bc));if(_0x160c6e['record']){_0x752afe[_0xbebd('0x7')](_[_0xbebd('0x8')]({'app':_0xbebd('0x9'),'appdata':util[_0xbebd('0x3')](_0xbebd('0xa'),_0x160c6e[_0xbebd('0xb')]),'priority':_0x50d045++},_0x4a97bc));}if(_0x160c6e[_0xbebd('0xc')]){_0x752afe[_0xbebd('0x7')](_[_0xbebd('0x8')]({'app':_0xbebd('0xd'),'appdata':_0x160c6e[_0xbebd('0xe')],'priority':_0x50d045++},_0x4a97bc));}_0x752afe[_0xbebd('0x7')](_['merge']({'app':_0xbebd('0xf'),'appdata':util[_0xbebd('0x3')]('SIP/%s,%s',_0x1e16cf[_0xbebd('0x10')],_0x160c6e['options']?_0x160c6e[_0xbebd('0x11')][_0xbebd('0x12')](''):''),'priority':_0x50d045++},_0x4a97bc));if(_0x160c6e[_0xbebd('0x13')]){_0x752afe[_0xbebd('0x7')](_['merge']({'app':_0xbebd('0x14'),'priority':_0x50d045++},_0x4a97bc));}return _0x752afe;};var getChanSpyApplications=function(_0x50b0a5,_0x1333e9){var _0x47b9e0=[];for(var _0x36355b=0x0,_0x4539b7=0x1;_0x36355b<_0x1333e9[_0xbebd('0x15')];_0x36355b++,_0x4539b7=0x1){_0x47b9e0=_0x47b9e0[_0xbebd('0x16')](getUserApplications(_0x50b0a5,_0x1333e9[_0x36355b],_0x1333e9[_0x36355b][_0xbebd('0x17')]));if(_0x1333e9[_0x36355b]['internal']!=_0x1333e9[_0x36355b][_0xbebd('0x10')]){_0x47b9e0=_0x47b9e0[_0xbebd('0x16')](getUserApplications(_0x50b0a5,_0x1333e9[_0x36355b],_0x1333e9[_0x36355b][_0xbebd('0x10')]));}}return _0x47b9e0;};var getChanSpyPromise=function(_0x1abd88,_0x14893b){return new BPromise(function(_0x22f519,_0x3b5bd2){return _0x1abd88[_0xbebd('0x18')][_0xbebd('0x19')]({'attributes':['id',_0xbebd('0x10'),_0xbebd('0x17')],'where':{'role':_0xbebd('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x579e1c){if(_0x579e1c){return _0x22f519(getChanSpyApplications(_0x14893b,_0x579e1c));}return _0x22f519([]);})[_0xbebd('0x1b')](function(_0x16f628){_0x3b5bd2(_0x16f628);});});};module[_0xbebd('0x1c')]=function(_0x5ee1ec,_0x5ec2c7){var _0x27c83f=_0x5ee1ec[_0xbebd('0x1d')];return _0x5ee1ec[_0xbebd('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0xbebd('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19f412,_0x34f5ec,_0x10f7d0){return getChanSpyPromise(_0x27c83f,_0x19f412)['then'](function(_0x319b03){if(_0x319b03&&_0x319b03[_0xbebd('0x15')]){return _0x27c83f[_0xbebd('0x20')][_0xbebd('0x21')](_0x319b03);}})['then'](function(){_0x10f7d0();})[_0xbebd('0x1b')](function(_0x48b49f){_0x10f7d0(_0x48b49f);});},'afterUpdate':function(_0x5526ff,_0x140b25,_0x293307){return _0x27c83f[_0xbebd('0x20')][_0xbebd('0x22')]({'where':{'ChanSpyId':_0x5526ff['id']}})[_0xbebd('0x23')](function(){return getChanSpyPromise(_0x27c83f,_0x5526ff);})[_0xbebd('0x23')](function(_0x29bcb4){if(_0x29bcb4&&_0x29bcb4['length']){return _0x27c83f['VoiceExtension'][_0xbebd('0x21')](_0x29bcb4);}})[_0xbebd('0x23')](function(){_0x293307();})[_0xbebd('0x1b')](function(_0x249105){_0x293307(_0x249105);});},'afterDestroy':function(_0x3db971,_0x3686f1,_0x85514a){return _0x27c83f[_0xbebd('0x20')][_0xbebd('0x22')]({'where':{'ChanSpyId':_0x3db971['id']}})[_0xbebd('0x23')](function(){_0x85514a();})['catch'](function(_0x5d37f9){_0x85514a(_0x5d37f9);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 6de54b1..1dd272c 100644 --- a/server/api/voiceChanSpy/voiceChanSpy.rpc.js +++ b/server/api/voiceChanSpy/voiceChanSpy.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceChanSpy,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4058,0x129));var _0x8405=function(_0x3b97a2,_0x377d68){_0x3b97a2=_0x3b97a2-0x0;var _0x4a297e=_0x4058[_0x3b97a2];return _0x4a297e;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file +var _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x16d2,0x123));var _0x216d=function(_0x159424,_0x401a52){_0x159424=_0x159424-0x0;var _0x1eabe4=_0x16d2[_0x159424];return _0x1eabe4;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 09eea43..480cd61 100644 --- a/server/api/voiceContext/index.js +++ b/server/api/voiceContext/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe692=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','express','fs-extra','../../components/auth/service'];(function(_0x599d71,_0xc4507a){var _0x22b097=function(_0x1666a6){while(--_0x1666a6){_0x599d71['push'](_0x599d71['shift']());}};_0x22b097(++_0xc4507a);}(_0xe692,0x1ac));var _0x2e69=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xe692[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e69('0x0'));var timeout=require('connect-timeout');var express=require(_0x2e69('0x1'));var router=express['Router']();var fs_extra=require(_0x2e69('0x2'));var auth=require(_0x2e69('0x3'));var interaction=require(_0x2e69('0x4'));var config=require(_0x2e69('0x5'));var controller=require(_0x2e69('0x6'));router[_0x2e69('0x7')]('/',auth[_0x2e69('0x8')](),controller[_0x2e69('0x9')]);router[_0x2e69('0x7')](_0x2e69('0xa'),auth['isAuthenticated'](),controller[_0x2e69('0xb')]);router[_0x2e69('0xc')]('/',auth[_0x2e69('0x8')](),controller[_0x2e69('0xd')]);router[_0x2e69('0xe')](_0x2e69('0xa'),auth[_0x2e69('0x8')](),controller[_0x2e69('0xf')]);router['delete'](_0x2e69('0xa'),auth[_0x2e69('0x8')](),controller[_0x2e69('0x10')]);module[_0x2e69('0x11')]=router; \ No newline at end of file +var _0x364e=['index','/:id','show','post','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','./voiceContext.controller','get','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x364e,0xf7));var _0xe364=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x364e[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var path=require('path');var timeout=require(_0xe364('0x2'));var express=require(_0xe364('0x3'));var router=express[_0xe364('0x4')]();var fs_extra=require(_0xe364('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe364('0x6'));router[_0xe364('0x7')]('/',auth[_0xe364('0x8')](),controller[_0xe364('0x9')]);router[_0xe364('0x7')](_0xe364('0xa'),auth[_0xe364('0x8')](),controller[_0xe364('0xb')]);router[_0xe364('0xc')]('/',auth[_0xe364('0x8')](),controller['create']);router['put']('/:id',auth[_0xe364('0x8')](),controller[_0xe364('0xd')]);router[_0xe364('0xe')](_0xe364('0xa'),auth[_0xe364('0x8')](),controller[_0xe364('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index ea09d68..f7c78aa 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa23=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x456a54,_0xb1bf9e){var _0x50f3db=function(_0x3aa4c7){while(--_0x3aa4c7){_0x456a54['push'](_0x456a54['shift']());}};_0x50f3db(++_0xb1bf9e);}(_0xaa23,0xbb));var _0x3aa2=function(_0x56d550,_0x1c3fd0){_0x56d550=_0x56d550-0x0;var _0x5e6a91=_0xaa23[_0x56d550];return _0x5e6a91;};'use strict';var Sequelize=require(_0x3aa2('0x0'));module[_0x3aa2('0x1')]={'name':{'type':Sequelize[_0x3aa2('0x2')],'unique':_0x3aa2('0x3')},'description':{'type':Sequelize[_0x3aa2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x3aa2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x32cf=['STRING','BOOLEAN','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x32cf,0x1b8));var _0xf32c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x32cf[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require('sequelize');module[_0xf32c('0x0')]={'name':{'type':Sequelize[_0xf32c('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xf32c('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf32c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 27eb240..e473923 100644 --- a/server/api/voiceContext/voiceContext.controller.js +++ b/server/api/voiceContext/voiceContext.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1ab=['lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','destroy','get','Contexts','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','VoiceContext','findAll','rows','show','params','keys','find','create','body','readFileSync','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','root','Reload','join','utf8','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs'];(function(_0x4841d0,_0x43ff8b){var _0x3b4ffc=function(_0x4e4a50){while(--_0x4e4a50){_0x4841d0['push'](_0x4841d0['shift']());}};_0x3b4ffc(++_0x43ff8b);}(_0xc1ab,0x12b));var _0xbc1a=function(_0x322530,_0x37f4e9){_0x322530=_0x322530-0x0;var _0x1d9e8e=_0xc1ab[_0x322530];return _0x1d9e8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc1a('0x0'));var zipdir=require(_0xbc1a('0x1'));var jsonpatch=require(_0xbc1a('0x2'));var rp=require(_0xbc1a('0x3'));var moment=require(_0xbc1a('0x4'));var BPromise=require(_0xbc1a('0x5'));var Mustache=require(_0xbc1a('0x6'));var util=require('util');var path=require(_0xbc1a('0x7'));var sox=require('sox');var csv=require(_0xbc1a('0x8'));var ejs=require(_0xbc1a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc1a('0xa'));var squel=require(_0xbc1a('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc1a('0xc'));var deskjs=require(_0xbc1a('0xd'));var toCsv=require(_0xbc1a('0x8'));var querystring=require('querystring');var Papa=require(_0xbc1a('0xe'));var Redis=require(_0xbc1a('0xf'));var authService=require(_0xbc1a('0x10'));var qs=require(_0xbc1a('0x11'));var as=require(_0xbc1a('0x12'));var hardwareService=require(_0xbc1a('0x13'));var logger=require(_0xbc1a('0x14'))(_0xbc1a('0x15'));var utils=require(_0xbc1a('0x16'));var config=require(_0xbc1a('0x17'));var licenseUtil=require(_0xbc1a('0x18'));var db=require(_0xbc1a('0x19'))['db'];var jayson=require(_0xbc1a('0x1a'));var client=jayson[_0xbc1a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28c0ae,_0x242312,_0x59243f,_0x1e55fb){return new BPromise(function(_0x243302,_0xfa1387){var _0x1c981d=_0x1e55fb||client;return _0x1c981d[_0xbc1a('0x1c')](_0x28c0ae,_0x59243f)[_0xbc1a('0x1d')](function(_0x1510f9){logger[_0xbc1a('0x1e')](_0xbc1a('0x1f'),_0x242312,_0xbc1a('0x20'));logger[_0xbc1a('0x21')](_0xbc1a('0x22'),_0x242312,'request\x20sent',JSON['stringify'](_0x1510f9));if(_0x1510f9[_0xbc1a('0x23')]){if(_0x1510f9[_0xbc1a('0x23')][_0xbc1a('0x24')]===0x1f4){logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x1510f9[_0xbc1a('0x23')]['message']);return _0xfa1387(_0x1510f9['error']['message']);}logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x1510f9[_0xbc1a('0x23')][_0xbc1a('0x25')]);return _0x243302(_0x1510f9['error']['message']);}else{logger[_0xbc1a('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x242312,_0xbc1a('0x20'));_0x243302(_0x1510f9[_0xbc1a('0x26')][_0xbc1a('0x25')]);}})[_0xbc1a('0x27')](function(_0x58e427){logger[_0xbc1a('0x23')](_0xbc1a('0x1f'),_0x242312,_0x58e427);_0xfa1387(_0x58e427);});});}function respondWithStatusCode(_0x14ab1f,_0x3034bc){_0x3034bc=_0x3034bc||0xcc;return function(_0x56bccb){if(_0x56bccb){return _0x14ab1f[_0xbc1a('0x28')](_0x3034bc);}return _0x14ab1f[_0xbc1a('0x29')](_0x3034bc)[_0xbc1a('0x2a')]();};}function respondWithResult(_0xfaaa5b,_0x2e6293){_0x2e6293=_0x2e6293||0xc8;return function(_0x775566){if(_0x775566){return _0xfaaa5b['status'](_0x2e6293)[_0xbc1a('0x2b')](_0x775566);}};}function respondWithFilteredResult(_0x34b085,_0x3cd6b7){return function(_0x5d1e94){if(_0x5d1e94){var _0x4743e8=typeof _0x3cd6b7[_0xbc1a('0x2c')]==='undefined'&&typeof _0x3cd6b7['limit']===_0xbc1a('0x2d');var _0x36a161=_0x5d1e94[_0xbc1a('0x2e')];var _0x39368f=_0x4743e8?0x0:_0x3cd6b7[_0xbc1a('0x2c')];var _0x1aa3e7=_0x4743e8?_0x5d1e94[_0xbc1a('0x2e')]:_0x3cd6b7[_0xbc1a('0x2c')]+_0x3cd6b7[_0xbc1a('0x2f')];var _0x44bb7d;if(_0x1aa3e7>=_0x36a161){_0x1aa3e7=_0x36a161;_0x44bb7d=0xc8;}else{_0x44bb7d=0xce;}_0x34b085[_0xbc1a('0x29')](_0x44bb7d);return _0x34b085['set'](_0xbc1a('0x30'),_0x39368f+'-'+_0x1aa3e7+'/'+_0x36a161)['json'](_0x5d1e94);}return null;};}function patchUpdates(_0x1193c3){return function(_0x1d4bde){try{jsonpatch['apply'](_0x1d4bde,_0x1193c3,!![]);}catch(_0x495adb){return BPromise[_0xbc1a('0x31')](_0x495adb);}return _0x1d4bde[_0xbc1a('0x32')]();};}function saveUpdates(_0x5e9f02,_0x450321){return function(_0x506237){if(_0x506237){return _0x506237['update'](_0x5e9f02)[_0xbc1a('0x1d')](function(_0x3ae5e0){return _0x3ae5e0;});}return null;};}function removeEntity(_0x34d0bd,_0x59f936){return function(_0x33a3ab){if(_0x33a3ab){return _0x33a3ab[_0xbc1a('0x33')]()[_0xbc1a('0x1d')](function(){var _0x5a1793=_0x33a3ab[_0xbc1a('0x34')]({'plain':!![]});var _0x226a21=_0xbc1a('0x35');return db['UserProfileResource'][_0xbc1a('0x33')]({'where':{'type':_0x226a21,'resourceId':_0x5a1793['id']}})['then'](function(){return _0x33a3ab;});})[_0xbc1a('0x1d')](function(){_0x34d0bd['status'](0xcc)[_0xbc1a('0x2a')]();});}};}function handleEntityNotFound(_0x43b55f,_0x567855){return function(_0x1b8db3){if(!_0x1b8db3){_0x43b55f['sendStatus'](0x194);}return _0x1b8db3;};}function handleError(_0x425241,_0x249df6){_0x249df6=_0x249df6||0x1f4;return function(_0x309b37){logger[_0xbc1a('0x23')](_0x309b37[_0xbc1a('0x36')]);if(_0x309b37[_0xbc1a('0x37')]){delete _0x309b37[_0xbc1a('0x37')];}_0x425241[_0xbc1a('0x29')](_0x249df6)['send'](_0x309b37);};}exports[_0xbc1a('0x38')]=function(_0x4205b3,_0x19e708){var _0x2d5d60={},_0x3fd93f={},_0x9bd3fc={'count':0x0,'rows':[]};var _0xca7fbd=_[_0xbc1a('0x39')](db['VoiceContext'][_0xbc1a('0x3a')],function(_0xda55a5){return{'name':_0xda55a5[_0xbc1a('0x3b')],'type':_0xda55a5[_0xbc1a('0x3c')]['key']};});_0x3fd93f[_0xbc1a('0x3d')]=_[_0xbc1a('0x39')](_0xca7fbd,_0xbc1a('0x37'));_0x3fd93f[_0xbc1a('0x3e')]=_['keys'](_0x4205b3[_0xbc1a('0x3e')]);_0x3fd93f[_0xbc1a('0x3f')]=_[_0xbc1a('0x40')](_0x3fd93f[_0xbc1a('0x3d')],_0x3fd93f['query']);_0x2d5d60[_0xbc1a('0x41')]=_[_0xbc1a('0x40')](_0x3fd93f[_0xbc1a('0x3d')],qs[_0xbc1a('0x42')](_0x4205b3['query']['fields']));_0x2d5d60[_0xbc1a('0x41')]=_0x2d5d60['attributes'][_0xbc1a('0x43')]?_0x2d5d60[_0xbc1a('0x41')]:_0x3fd93f[_0xbc1a('0x3d')];if(!_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x44')](_0xbc1a('0x45'))){_0x2d5d60['limit']=qs['limit'](_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x2f')]);_0x2d5d60[_0xbc1a('0x2c')]=qs[_0xbc1a('0x2c')](_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x2c')]);}_0x2d5d60['order']=qs[_0xbc1a('0x46')](_0x4205b3['query'][_0xbc1a('0x46')]);_0x2d5d60[_0xbc1a('0x47')]=qs['filters'](_[_0xbc1a('0x48')](_0x4205b3[_0xbc1a('0x3e')],_0x3fd93f['filters']),_0xca7fbd);if(_0x4205b3[_0xbc1a('0x3e')]['filter']){_0x2d5d60[_0xbc1a('0x47')]=_['merge'](_0x2d5d60[_0xbc1a('0x47')],{'$or':_[_0xbc1a('0x39')](_0xca7fbd,function(_0x22b348){if(_0x22b348[_0xbc1a('0x3c')]!=='VIRTUAL'){var _0x18aa44={};_0x18aa44[_0x22b348[_0xbc1a('0x37')]]={'$like':'%'+_0x4205b3[_0xbc1a('0x3e')][_0xbc1a('0x49')]+'%'};return _0x18aa44;}})});}_0x2d5d60=_[_0xbc1a('0x4a')]({},_0x2d5d60,_0x4205b3[_0xbc1a('0x4b')]);var _0x7a5877={'where':_0x2d5d60['where']};return db[_0xbc1a('0x4c')][_0xbc1a('0x2e')](_0x7a5877)[_0xbc1a('0x1d')](function(_0x26b19f){_0x9bd3fc[_0xbc1a('0x2e')]=_0x26b19f;if(_0x4205b3[_0xbc1a('0x3e')]['includeAll']){_0x2d5d60['include']=[{'all':!![]}];}return db[_0xbc1a('0x4c')][_0xbc1a('0x4d')](_0x2d5d60);})[_0xbc1a('0x1d')](function(_0x7921e7){_0x9bd3fc[_0xbc1a('0x4e')]=_0x7921e7;return _0x9bd3fc;})[_0xbc1a('0x1d')](respondWithFilteredResult(_0x19e708,_0x2d5d60))[_0xbc1a('0x27')](handleError(_0x19e708,null));};exports[_0xbc1a('0x4f')]=function(_0x165ac5,_0x4eac42){var _0x1c0413={'raw':![],'where':{'id':_0x165ac5[_0xbc1a('0x50')]['id']}},_0x890106={};_0x890106[_0xbc1a('0x3d')]=_[_0xbc1a('0x51')](db[_0xbc1a('0x4c')]['rawAttributes']);_0x890106[_0xbc1a('0x3e')]=_['keys'](_0x165ac5[_0xbc1a('0x3e')]);_0x890106['filters']=_[_0xbc1a('0x40')](_0x890106[_0xbc1a('0x3d')],_0x890106['query']);_0x1c0413[_0xbc1a('0x41')]=_[_0xbc1a('0x40')](_0x890106['model'],qs[_0xbc1a('0x42')](_0x165ac5[_0xbc1a('0x3e')][_0xbc1a('0x42')]));_0x1c0413['attributes']=_0x1c0413['attributes'][_0xbc1a('0x43')]?_0x1c0413[_0xbc1a('0x41')]:_0x890106[_0xbc1a('0x3d')];if(_0x165ac5[_0xbc1a('0x3e')]['includeAll']){_0x1c0413['include']=[{'all':!![]}];}_0x1c0413=_[_0xbc1a('0x4a')]({},_0x1c0413,_0x165ac5[_0xbc1a('0x4b')]);return db[_0xbc1a('0x4c')][_0xbc1a('0x52')](_0x1c0413)[_0xbc1a('0x1d')](handleEntityNotFound(_0x4eac42,null))[_0xbc1a('0x1d')](respondWithResult(_0x4eac42,null))[_0xbc1a('0x27')](handleError(_0x4eac42,null));};exports[_0xbc1a('0x53')]=function(_0x52aae8,_0x5dcb95,_0x98bfe7){var _0x9c0897;return db[_0xbc1a('0x4c')][_0xbc1a('0x53')](_0x52aae8[_0xbc1a('0x54')],{'raw':!![]})['then'](function(_0x2e0292){_0x9c0897=_0x2e0292;return db['VoiceContext'][_0xbc1a('0x4d')]({'raw':!![]});})[_0xbc1a('0x1d')](function(_0x1c9daa){var _0x33cae0=fs[_0xbc1a('0x55')](path['join'](config['root'],_0xbc1a('0x56')),'utf8');var _0x5a4c05=ejs[_0xbc1a('0x57')](_0x33cae0,{'contexts':_0x1c9daa||[]});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x5a4c05);})[_0xbc1a('0x1d')](function(){return respondWithRpcPromise('Reload',_0xbc1a('0x53'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x1d')](function(){var _0x161235=_0x52aae8[_0xbc1a('0x5b')][_0xbc1a('0x34')]({'plain':!![]});if(!_0x161235)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x161235[_0xbc1a('0x5c')]==='user'){var _0x5842b0=_0x9c0897[_0xbc1a('0x34')]({'plain':!![]});return db[_0xbc1a('0x5d')]['find']({'where':{'name':_0xbc1a('0x35'),'userProfileId':_0x161235[_0xbc1a('0x5e')]},'raw':!![]})[_0xbc1a('0x1d')](function(_0x2005bb){if(_0x2005bb&&_0x2005bb[_0xbc1a('0x5f')]===0x0){return db[_0xbc1a('0x60')][_0xbc1a('0x53')]({'name':_0x5842b0[_0xbc1a('0x37')],'resourceId':_0x5842b0['id'],'type':_0x2005bb[_0xbc1a('0x37')],'sectionId':_0x2005bb['id']},{})[_0xbc1a('0x1d')](function(){return _0x9c0897;});}else{return _0x9c0897;}})[_0xbc1a('0x27')](function(_0x1064e4){logger[_0xbc1a('0x23')](_0xbc1a('0x61'),_0x1064e4);throw _0x1064e4;});}return _0x9c0897;})['then'](respondWithResult(_0x5dcb95,0xc9))[_0xbc1a('0x27')](handleError(_0x5dcb95,null));};exports[_0xbc1a('0x62')]=function(_0x469171,_0xd38beb,_0x4035be){var _0x2f9fe8;return db[_0xbc1a('0x4c')]['find']({'where':{'id':_0x469171[_0xbc1a('0x50')]['id']}})[_0xbc1a('0x1d')](handleEntityNotFound(_0xd38beb,null))['then'](saveUpdates(_0x469171[_0xbc1a('0x54')],null))[_0xbc1a('0x1d')](function(_0x3464cd){if(_0x3464cd){_0x2f9fe8=_0x3464cd;return db[_0xbc1a('0x4c')][_0xbc1a('0x4d')]({'raw':!![]});}})[_0xbc1a('0x1d')](function(_0x2ac4b8){var _0x5ab5dc=fs[_0xbc1a('0x55')](path['join'](config[_0xbc1a('0x63')],_0xbc1a('0x56')),'utf8');var _0x43fcaf=ejs[_0xbc1a('0x57')](_0x5ab5dc,{'contexts':_0x2ac4b8||[]});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x43fcaf);})['then'](function(){return respondWithRpcPromise(_0xbc1a('0x64'),_0xbc1a('0x62'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x1d')](function(){return _0x2f9fe8;})[_0xbc1a('0x1d')](respondWithResult(_0xd38beb,null))['catch'](handleError(_0xd38beb,null));};exports[_0xbc1a('0x33')]=function(_0x1fa942,_0x4c4b86,_0x48c379){var _0x5b3d02;return db['VoiceContext'][_0xbc1a('0x52')]({'where':{'id':_0x1fa942[_0xbc1a('0x50')]['id']}})[_0xbc1a('0x1d')](handleEntityNotFound(_0x4c4b86,null))[_0xbc1a('0x1d')](removeEntity(_0x4c4b86,null))['then'](function(){return db[_0xbc1a('0x4c')]['findAll']({'raw':!![]});})['then'](function(_0x249bb0){var _0x288da9=fs['readFileSync'](path[_0xbc1a('0x65')](config[_0xbc1a('0x63')],_0xbc1a('0x56')),_0xbc1a('0x66'));var _0x2c82b9=ejs['render'](_0x288da9,{'contexts':_0x249bb0});fs[_0xbc1a('0x58')](_0xbc1a('0x59'),_0x2c82b9);return respondWithRpcPromise('Reload',_0xbc1a('0x33'),{'module':_0xbc1a('0x5a')});})[_0xbc1a('0x27')](handleError(_0x4c4b86,null));}; \ No newline at end of file +var _0x8080=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','UserProfileResource','destroy','end','sendStatus','name','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoiceContext','includeAll','include','findAll','params','length','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','root','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','status'];(function(_0x5124b1,_0x1c81f8){var _0x40975d=function(_0x39e1e9){while(--_0x39e1e9){_0x5124b1['push'](_0x5124b1['shift']());}};_0x40975d(++_0x1c81f8);}(_0x8080,0xa1));var _0x0808=function(_0x3a411d,_0x3b5646){_0x3a411d=_0x3a411d-0x0;var _0x14b4b0=_0x8080[_0x3a411d];return _0x14b4b0;};'use strict';var emlformat=require(_0x0808('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0808('0x1'));var rp=require(_0x0808('0x2'));var moment=require(_0x0808('0x3'));var BPromise=require(_0x0808('0x4'));var Mustache=require(_0x0808('0x5'));var util=require(_0x0808('0x6'));var path=require('path');var sox=require(_0x0808('0x7'));var csv=require(_0x0808('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0808('0x9'));var squel=require(_0x0808('0xa'));var crypto=require(_0x0808('0xb'));var jsforce=require(_0x0808('0xc'));var deskjs=require(_0x0808('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0808('0xe'));var Papa=require(_0x0808('0xf'));var Redis=require(_0x0808('0x10'));var authService=require(_0x0808('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0808('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0808('0x13'))(_0x0808('0x14'));var utils=require(_0x0808('0x15'));var config=require(_0x0808('0x16'));var licenseUtil=require(_0x0808('0x17'));var db=require(_0x0808('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x0808('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfb0f,_0x31bda6,_0x5e7d78,_0x53645b){return new BPromise(function(_0x4723de,_0x5e7a5a){var _0x242284=_0x53645b||client;return _0x242284[_0x0808('0x1a')](_0x2dfb0f,_0x5e7d78)[_0x0808('0x1b')](function(_0x4593b3){logger[_0x0808('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x31bda6,'request\x20sent');logger['debug'](_0x0808('0x1d'),_0x31bda6,_0x0808('0x1e'),JSON[_0x0808('0x1f')](_0x4593b3));if(_0x4593b3['error']){if(_0x4593b3[_0x0808('0x20')][_0x0808('0x21')]===0x1f4){logger[_0x0808('0x20')](_0x0808('0x22'),_0x31bda6,_0x4593b3[_0x0808('0x20')][_0x0808('0x23')]);return _0x5e7a5a(_0x4593b3['error']['message']);}logger[_0x0808('0x20')]('VoiceContext,\x20%s,\x20%s',_0x31bda6,_0x4593b3[_0x0808('0x20')][_0x0808('0x23')]);return _0x4723de(_0x4593b3[_0x0808('0x20')][_0x0808('0x23')]);}else{logger[_0x0808('0x1c')](_0x0808('0x22'),_0x31bda6,_0x0808('0x1e'));_0x4723de(_0x4593b3[_0x0808('0x24')]['message']);}})[_0x0808('0x25')](function(_0x306ef7){logger[_0x0808('0x20')](_0x0808('0x22'),_0x31bda6,_0x306ef7);_0x5e7a5a(_0x306ef7);});});}function respondWithStatusCode(_0x9c6ee0,_0x37f3ba){_0x37f3ba=_0x37f3ba||0xcc;return function(_0x1da9d8){if(_0x1da9d8){return _0x9c6ee0['sendStatus'](_0x37f3ba);}return _0x9c6ee0[_0x0808('0x26')](_0x37f3ba)['end']();};}function respondWithResult(_0x33762d,_0x5e6514){_0x5e6514=_0x5e6514||0xc8;return function(_0x519080){if(_0x519080){return _0x33762d[_0x0808('0x26')](_0x5e6514)[_0x0808('0x27')](_0x519080);}};}function respondWithFilteredResult(_0x5adc1a,_0x20af0e){return function(_0x4e6135){if(_0x4e6135){var _0x13e2e2=typeof _0x20af0e[_0x0808('0x28')]===_0x0808('0x29')&&typeof _0x20af0e[_0x0808('0x2a')]===_0x0808('0x29');var _0x3c0e7d=_0x4e6135[_0x0808('0x2b')];var _0x5bc7d4=_0x13e2e2?0x0:_0x20af0e['offset'];var _0x224d22=_0x13e2e2?_0x4e6135[_0x0808('0x2b')]:_0x20af0e[_0x0808('0x28')]+_0x20af0e[_0x0808('0x2a')];var _0x23fbed;if(_0x224d22>=_0x3c0e7d){_0x224d22=_0x3c0e7d;_0x23fbed=0xc8;}else{_0x23fbed=0xce;}_0x5adc1a[_0x0808('0x26')](_0x23fbed);return _0x5adc1a[_0x0808('0x2c')](_0x0808('0x2d'),_0x5bc7d4+'-'+_0x224d22+'/'+_0x3c0e7d)[_0x0808('0x27')](_0x4e6135);}return null;};}function patchUpdates(_0x325e2d){return function(_0x2cdbfe){try{jsonpatch[_0x0808('0x2e')](_0x2cdbfe,_0x325e2d,!![]);}catch(_0x326e69){return BPromise[_0x0808('0x2f')](_0x326e69);}return _0x2cdbfe[_0x0808('0x30')]();};}function saveUpdates(_0x55581b,_0x1abcc5){return function(_0x5d5ef8){if(_0x5d5ef8){return _0x5d5ef8[_0x0808('0x31')](_0x55581b)['then'](function(_0x4952a9){return _0x4952a9;});}return null;};}function removeEntity(_0x4ea08d,_0x289db9){return function(_0x40a610){if(_0x40a610){return _0x40a610['destroy']()[_0x0808('0x1b')](function(){var _0x331d7a=_0x40a610[_0x0808('0x32')]({'plain':!![]});var _0x374ffa='Contexts';return db[_0x0808('0x33')][_0x0808('0x34')]({'where':{'type':_0x374ffa,'resourceId':_0x331d7a['id']}})[_0x0808('0x1b')](function(){return _0x40a610;});})[_0x0808('0x1b')](function(){_0x4ea08d[_0x0808('0x26')](0xcc)[_0x0808('0x35')]();});}};}function handleEntityNotFound(_0x4a27d6,_0x2beaed){return function(_0x4ea6e9){if(!_0x4ea6e9){_0x4a27d6[_0x0808('0x36')](0x194);}return _0x4ea6e9;};}function handleError(_0x5b1f9d,_0xdea85d){_0xdea85d=_0xdea85d||0x1f4;return function(_0x4be2f3){logger[_0x0808('0x20')](_0x4be2f3['stack']);if(_0x4be2f3[_0x0808('0x37')]){delete _0x4be2f3['name'];}_0x5b1f9d[_0x0808('0x26')](_0xdea85d)['send'](_0x4be2f3);};}exports[_0x0808('0x38')]=function(_0x58c0ae,_0x4a9785){var _0x3e1469={},_0xfa19d1={},_0x53c516={'count':0x0,'rows':[]};var _0x4409d5=_['map'](db['VoiceContext'][_0x0808('0x39')],function(_0x3fc9e6){return{'name':_0x3fc9e6['fieldName'],'type':_0x3fc9e6[_0x0808('0x3a')][_0x0808('0x3b')]};});_0xfa19d1['model']=_[_0x0808('0x3c')](_0x4409d5,_0x0808('0x37'));_0xfa19d1[_0x0808('0x3d')]=_[_0x0808('0x3e')](_0x58c0ae['query']);_0xfa19d1[_0x0808('0x3f')]=_[_0x0808('0x40')](_0xfa19d1[_0x0808('0x41')],_0xfa19d1[_0x0808('0x3d')]);_0x3e1469[_0x0808('0x42')]=_[_0x0808('0x40')](_0xfa19d1[_0x0808('0x41')],qs[_0x0808('0x43')](_0x58c0ae[_0x0808('0x3d')][_0x0808('0x43')]));_0x3e1469[_0x0808('0x42')]=_0x3e1469[_0x0808('0x42')]['length']?_0x3e1469['attributes']:_0xfa19d1[_0x0808('0x41')];if(!_0x58c0ae['query'][_0x0808('0x44')](_0x0808('0x45'))){_0x3e1469[_0x0808('0x2a')]=qs['limit'](_0x58c0ae[_0x0808('0x3d')][_0x0808('0x2a')]);_0x3e1469[_0x0808('0x28')]=qs[_0x0808('0x28')](_0x58c0ae[_0x0808('0x3d')][_0x0808('0x28')]);}_0x3e1469[_0x0808('0x46')]=qs[_0x0808('0x47')](_0x58c0ae[_0x0808('0x3d')][_0x0808('0x47')]);_0x3e1469[_0x0808('0x48')]=qs[_0x0808('0x3f')](_[_0x0808('0x49')](_0x58c0ae['query'],_0xfa19d1[_0x0808('0x3f')]),_0x4409d5);if(_0x58c0ae['query'][_0x0808('0x4a')]){_0x3e1469[_0x0808('0x48')]=_['merge'](_0x3e1469[_0x0808('0x48')],{'$or':_['map'](_0x4409d5,function(_0x36a70f){if(_0x36a70f[_0x0808('0x3a')]!==_0x0808('0x4b')){var _0xe464a0={};_0xe464a0[_0x36a70f['name']]={'$like':'%'+_0x58c0ae['query'][_0x0808('0x4a')]+'%'};return _0xe464a0;}})});}_0x3e1469=_['merge']({},_0x3e1469,_0x58c0ae[_0x0808('0x4c')]);var _0x221ded={'where':_0x3e1469['where']};return db[_0x0808('0x4d')][_0x0808('0x2b')](_0x221ded)[_0x0808('0x1b')](function(_0x3f8cef){_0x53c516[_0x0808('0x2b')]=_0x3f8cef;if(_0x58c0ae[_0x0808('0x3d')][_0x0808('0x4e')]){_0x3e1469[_0x0808('0x4f')]=[{'all':!![]}];}return db['VoiceContext'][_0x0808('0x50')](_0x3e1469);})['then'](function(_0x3d1201){_0x53c516['rows']=_0x3d1201;return _0x53c516;})[_0x0808('0x1b')](respondWithFilteredResult(_0x4a9785,_0x3e1469))['catch'](handleError(_0x4a9785,null));};exports['show']=function(_0x569609,_0x184752){var _0x46b9df={'raw':![],'where':{'id':_0x569609[_0x0808('0x51')]['id']}},_0x5ddbc9={};_0x5ddbc9[_0x0808('0x41')]=_[_0x0808('0x3e')](db[_0x0808('0x4d')][_0x0808('0x39')]);_0x5ddbc9['query']=_[_0x0808('0x3e')](_0x569609['query']);_0x5ddbc9['filters']=_['intersection'](_0x5ddbc9['model'],_0x5ddbc9['query']);_0x46b9df['attributes']=_['intersection'](_0x5ddbc9[_0x0808('0x41')],qs[_0x0808('0x43')](_0x569609[_0x0808('0x3d')]['fields']));_0x46b9df['attributes']=_0x46b9df[_0x0808('0x42')][_0x0808('0x52')]?_0x46b9df['attributes']:_0x5ddbc9[_0x0808('0x41')];if(_0x569609['query']['includeAll']){_0x46b9df[_0x0808('0x4f')]=[{'all':!![]}];}_0x46b9df=_['merge']({},_0x46b9df,_0x569609['options']);return db[_0x0808('0x4d')]['find'](_0x46b9df)[_0x0808('0x1b')](handleEntityNotFound(_0x184752,null))[_0x0808('0x1b')](respondWithResult(_0x184752,null))[_0x0808('0x25')](handleError(_0x184752,null));};exports[_0x0808('0x53')]=function(_0x5b94c9,_0xc3d184,_0x2d3741){var _0x2778ae;return db['VoiceContext'][_0x0808('0x53')](_0x5b94c9['body'],{'raw':!![]})['then'](function(_0x2f9e5d){_0x2778ae=_0x2f9e5d;return db[_0x0808('0x4d')][_0x0808('0x50')]({'raw':!![]});})[_0x0808('0x1b')](function(_0x1b64fc){var _0x51fe63=fs[_0x0808('0x54')](path[_0x0808('0x55')](config['root'],_0x0808('0x56')),_0x0808('0x57'));var _0x8ec86d=ejs[_0x0808('0x58')](_0x51fe63,{'contexts':_0x1b64fc||[]});fs[_0x0808('0x59')](_0x0808('0x5a'),_0x8ec86d);})['then'](function(){return respondWithRpcPromise(_0x0808('0x5b'),'create',{'module':_0x0808('0x5c')});})[_0x0808('0x1b')](function(){var _0xfbb8c4=_0x5b94c9[_0x0808('0x5d')][_0x0808('0x32')]({'plain':!![]});if(!_0xfbb8c4)throw new Error(_0x0808('0x5e'));if(_0xfbb8c4['role']===_0x0808('0x5d')){var _0x5053d6=_0x2778ae[_0x0808('0x32')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x0808('0x5f'),'userProfileId':_0xfbb8c4[_0x0808('0x60')]},'raw':!![]})[_0x0808('0x1b')](function(_0x2d0092){if(_0x2d0092&&_0x2d0092['autoAssociation']===0x0){return db[_0x0808('0x33')]['create']({'name':_0x5053d6[_0x0808('0x37')],'resourceId':_0x5053d6['id'],'type':_0x2d0092[_0x0808('0x37')],'sectionId':_0x2d0092['id']},{})[_0x0808('0x1b')](function(){return _0x2778ae;});}else{return _0x2778ae;}})[_0x0808('0x25')](function(_0x5d0677){logger[_0x0808('0x20')](_0x0808('0x61'),_0x5d0677);throw _0x5d0677;});}return _0x2778ae;})['then'](respondWithResult(_0xc3d184,0xc9))[_0x0808('0x25')](handleError(_0xc3d184,null));};exports[_0x0808('0x31')]=function(_0x1d86c7,_0x87e74b,_0x5f56c9){var _0x4549af;return db[_0x0808('0x4d')][_0x0808('0x62')]({'where':{'id':_0x1d86c7[_0x0808('0x51')]['id']}})[_0x0808('0x1b')](handleEntityNotFound(_0x87e74b,null))[_0x0808('0x1b')](saveUpdates(_0x1d86c7['body'],null))['then'](function(_0x13278b){if(_0x13278b){_0x4549af=_0x13278b;return db[_0x0808('0x4d')][_0x0808('0x50')]({'raw':!![]});}})['then'](function(_0x6accd4){var _0x5c2e28=fs['readFileSync'](path['join'](config['root'],_0x0808('0x56')),'utf8');var _0x1793ee=ejs[_0x0808('0x58')](_0x5c2e28,{'contexts':_0x6accd4||[]});fs[_0x0808('0x59')](_0x0808('0x5a'),_0x1793ee);})[_0x0808('0x1b')](function(){return respondWithRpcPromise('Reload',_0x0808('0x31'),{'module':_0x0808('0x5c')});})[_0x0808('0x1b')](function(){return _0x4549af;})[_0x0808('0x1b')](respondWithResult(_0x87e74b,null))['catch'](handleError(_0x87e74b,null));};exports[_0x0808('0x34')]=function(_0x147399,_0x5f3590,_0x13d767){var _0x556d85;return db['VoiceContext'][_0x0808('0x62')]({'where':{'id':_0x147399[_0x0808('0x51')]['id']}})[_0x0808('0x1b')](handleEntityNotFound(_0x5f3590,null))[_0x0808('0x1b')](removeEntity(_0x5f3590,null))[_0x0808('0x1b')](function(){return db[_0x0808('0x4d')]['findAll']({'raw':!![]});})[_0x0808('0x1b')](function(_0x3a2c15){var _0x18188e=fs['readFileSync'](path[_0x0808('0x55')](config[_0x0808('0x63')],_0x0808('0x56')),_0x0808('0x57'));var _0xf15f7a=ejs[_0x0808('0x58')](_0x18188e,{'contexts':_0x3a2c15});fs[_0x0808('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xf15f7a);return respondWithRpcPromise('Reload',_0x0808('0x34'),{'module':_0x0808('0x5c')});})[_0x0808('0x25')](handleError(_0x5f3590,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 1a4cda7..4eba528 100644 --- a/server/api/voiceContext/voiceContext.model.js +++ b/server/api/voiceContext/voiceContext.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0630=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x5aaac4,_0x116cc2){var _0x1a32cc=function(_0x2137f0){while(--_0x2137f0){_0x5aaac4['push'](_0x5aaac4['shift']());}};_0x1a32cc(++_0x116cc2);}(_0x0630,0x9d));var _0x0063=function(_0x56d0f5,_0x5c0b73){_0x56d0f5=_0x56d0f5-0x0;var _0x249d96=_0x0630[_0x56d0f5];return _0x249d96;};'use strict';var _=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var logger=require(_0x0063('0x2'))(_0x0063('0x3'));var moment=require(_0x0063('0x4'));var BPromise=require(_0x0063('0x5'));var rp=require(_0x0063('0x6'));var fs=require('fs');var path=require(_0x0063('0x7'));var rimraf=require(_0x0063('0x8'));var config=require('../../config/environment');var attributes=require(_0x0063('0x9'));module[_0x0063('0xa')]=function(_0x1f16ba,_0x1237ed){return _0x1f16ba[_0x0063('0xb')]('VoiceContext',attributes,{'tableName':_0x0063('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2fd=['../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xc2fd,0x12e));var _0xdc2f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc2fd[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xdc2f('0x0'));var util=require(_0xdc2f('0x1'));var logger=require(_0xdc2f('0x2'))(_0xdc2f('0x3'));var moment=require(_0xdc2f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc2f('0x5'));var config=require(_0xdc2f('0x6'));var attributes=require(_0xdc2f('0x7'));module['exports']=function(_0x412ed4,_0x189bc0){return _0x412ed4[_0xdc2f('0x8')](_0xdc2f('0x9'),attributes,{'tableName':_0xdc2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 2ed46e0..f317ad6 100644 --- a/server/api/voiceContext/voiceContext.rpc.js +++ b/server/api/voiceContext/voiceContext.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21c9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util'];(function(_0xc66bab,_0x5f1dd2){var _0x16421f=function(_0xccf38d){while(--_0xccf38d){_0xc66bab['push'](_0xc66bab['shift']());}};_0x16421f(++_0x5f1dd2);}(_0x21c9,0x19e));var _0x921c=function(_0x40ea0f,_0x33644d){_0x40ea0f=_0x40ea0f-0x0;var _0x1ae737=_0x21c9[_0x40ea0f];return _0x1ae737;};'use strict';var _=require(_0x921c('0x0'));var util=require(_0x921c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x921c('0x2'))['db'];var utils=require(_0x921c('0x3'));var logger=require('../../config/logger')(_0x921c('0x4'));var config=require(_0x921c('0x5'));var jayson=require(_0x921c('0x6'));var client=jayson[_0x921c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0c84,_0x1ab777,_0x496501){return new BPromise(function(_0x3c0630,_0x382544){return client[_0x921c('0x8')](_0x1b0c84,_0x496501)['then'](function(_0xeb39a7){logger['info'](_0x921c('0x9'),_0x1ab777,_0x921c('0xa'));logger[_0x921c('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1ab777,'request\x20sent',JSON[_0x921c('0xc')](_0xeb39a7));if(_0xeb39a7[_0x921c('0xd')]){if(_0xeb39a7[_0x921c('0xd')][_0x921c('0xe')]===0x1f4){logger[_0x921c('0xd')](_0x921c('0x9'),_0x1ab777,_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);return _0x382544(_0xeb39a7[_0x921c('0xd')]['message']);}logger['error'](_0x921c('0x9'),_0x1ab777,_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);return _0x3c0630(_0xeb39a7[_0x921c('0xd')][_0x921c('0xf')]);}else{logger['info'](_0x921c('0x9'),_0x1ab777,_0x921c('0xa'));_0x3c0630(_0xeb39a7['result'][_0x921c('0xf')]);}})['catch'](function(_0x318640){logger[_0x921c('0xd')](_0x921c('0x9'),_0x1ab777,_0x318640);_0x382544(_0x318640);});});} \ No newline at end of file +var _0x0c99=['../../config/utils','rpc','../../config/environment','jayson/promise','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x27cbfe,_0x4e8039){var _0x456415=function(_0xa83af6){while(--_0xa83af6){_0x27cbfe['push'](_0x27cbfe['shift']());}};_0x456415(++_0x4e8039);}(_0x0c99,0x1af));var _0x90c9=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0x0c99[_0x1f3aec];return _0x409f0d;};'use strict';var _=require(_0x90c9('0x0'));var util=require(_0x90c9('0x1'));var moment=require(_0x90c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x90c9('0x3'));var fs=require('fs');var Redis=require(_0x90c9('0x4'));var db=require(_0x90c9('0x5'))['db'];var utils=require(_0x90c9('0x6'));var logger=require('../../config/logger')(_0x90c9('0x7'));var config=require(_0x90c9('0x8'));var jayson=require(_0x90c9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a43c0,_0x3446a4,_0xcb6555){return new BPromise(function(_0x150cd8,_0x47c9cf){return client['request'](_0x3a43c0,_0xcb6555)['then'](function(_0x28c5f4){logger[_0x90c9('0xa')](_0x90c9('0xb'),_0x3446a4,'request\x20sent');logger[_0x90c9('0xc')](_0x90c9('0xd'),_0x3446a4,_0x90c9('0xe'),JSON[_0x90c9('0xf')](_0x28c5f4));if(_0x28c5f4[_0x90c9('0x10')]){if(_0x28c5f4[_0x90c9('0x10')]['code']===0x1f4){logger[_0x90c9('0x10')](_0x90c9('0xb'),_0x3446a4,_0x28c5f4['error'][_0x90c9('0x11')]);return _0x47c9cf(_0x28c5f4[_0x90c9('0x10')][_0x90c9('0x11')]);}logger[_0x90c9('0x10')](_0x90c9('0xb'),_0x3446a4,_0x28c5f4[_0x90c9('0x10')]['message']);return _0x150cd8(_0x28c5f4[_0x90c9('0x10')][_0x90c9('0x11')]);}else{logger['info'](_0x90c9('0xb'),_0x3446a4,_0x90c9('0xe'));_0x150cd8(_0x28c5f4[_0x90c9('0x12')][_0x90c9('0x11')]);}})['catch'](function(_0x30a65a){logger[_0x90c9('0x10')](_0x90c9('0xb'),_0x3446a4,_0x30a65a);_0x47c9cf(_0x30a65a);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 2deebd9..4a0f472 100644 --- a/server/api/voiceDialReport/index.js +++ b/server/api/voiceDialReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa216=['../../config/environment','get','isAuthenticated','/:id','show','post','create','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xa216,0xf4));var _0x6a21=function(_0x4c30d2,_0x1705cb){_0x4c30d2=_0x4c30d2-0x0;var _0x3764f1=_0xa216[_0x4c30d2];return _0x3764f1;};'use strict';var multer=require('multer');var util=require(_0x6a21('0x0'));var path=require(_0x6a21('0x1'));var timeout=require(_0x6a21('0x2'));var express=require(_0x6a21('0x3'));var router=express[_0x6a21('0x4')]();var fs_extra=require(_0x6a21('0x5'));var auth=require(_0x6a21('0x6'));var interaction=require(_0x6a21('0x7'));var config=require(_0x6a21('0x8'));var controller=require('./voiceDialReport.controller');router[_0x6a21('0x9')]('/',auth[_0x6a21('0xa')](),controller['index']);router['get']('/describe',auth[_0x6a21('0xa')](),controller['describe']);router['get'](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller[_0x6a21('0xc')]);router[_0x6a21('0xd')]('/',auth[_0x6a21('0xa')](),controller[_0x6a21('0xe')]);router['put'](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller[_0x6a21('0xf')]);router[_0x6a21('0x10')](_0x6a21('0xb'),auth[_0x6a21('0xa')](),controller['destroy']);module[_0x6a21('0x11')]=router; \ No newline at end of file +var _0x29ea=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29ea,0xf6));var _0xa29e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x29ea[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa29e('0x0'));var util=require(_0xa29e('0x1'));var path=require(_0xa29e('0x2'));var timeout=require(_0xa29e('0x3'));var express=require(_0xa29e('0x4'));var router=express['Router']();var fs_extra=require(_0xa29e('0x5'));var auth=require(_0xa29e('0x6'));var interaction=require(_0xa29e('0x7'));var config=require(_0xa29e('0x8'));var controller=require(_0xa29e('0x9'));router[_0xa29e('0xa')]('/',auth[_0xa29e('0xb')](),controller[_0xa29e('0xc')]);router[_0xa29e('0xa')](_0xa29e('0xd'),auth[_0xa29e('0xb')](),controller[_0xa29e('0xe')]);router['get'](_0xa29e('0xf'),auth[_0xa29e('0xb')](),controller[_0xa29e('0x10')]);router[_0xa29e('0x11')]('/',auth[_0xa29e('0xb')](),controller[_0xa29e('0x12')]);router['put']('/:id',auth[_0xa29e('0xb')](),controller[_0xa29e('0x13')]);router[_0xa29e('0x14')]('/:id',auth[_0xa29e('0xb')](),controller[_0xa29e('0x15')]);module[_0xa29e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ef64c00..f9c42ff 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0xaea8f6,_0x379ca9){var _0x220c24=function(_0x14e439){while(--_0x14e439){_0xaea8f6['push'](_0xaea8f6['shift']());}};_0x220c24(++_0x379ca9);}(_0x9bde,0xe1));var _0xe9bd=function(_0xd199cb,_0x4e4fc2){_0xd199cb=_0xd199cb-0x0;var _0x4d0ae8=_0x9bde[_0xd199cb];return _0x4d0ae8;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3e74,0x175));var _0x43e7=function(_0x30b719,_0x397de7){_0x30b719=_0x30b719-0x0;var _0x4f25f5=_0x3e74[_0x30b719];return _0x4f25f5;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5afc1f0..fe2497c 100644 --- a/server/api/voiceDialReport/voiceDialReport.controller.js +++ b/server/api/voiceDialReport/voiceDialReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb15e=['show','params','options','create','body','find','describe','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb15e,0xeb));var _0xeb15=function(_0x26f189,_0x1bebf5){_0x26f189=_0x26f189-0x0;var _0x4aa106=_0xb15e[_0x26f189];return _0x4aa106;};'use strict';var emlformat=require(_0xeb15('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb15('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb15('0x2'));var util=require(_0xeb15('0x3'));var path=require(_0xeb15('0x4'));var sox=require(_0xeb15('0x5'));var csv=require(_0xeb15('0x6'));var ejs=require(_0xeb15('0x7'));var fs=require('fs');var fs_extra=require(_0xeb15('0x8'));var _=require(_0xeb15('0x9'));var squel=require('squel');var crypto=require(_0xeb15('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeb15('0x6'));var querystring=require(_0xeb15('0xb'));var Papa=require(_0xeb15('0xc'));var Redis=require(_0xeb15('0xd'));var authService=require(_0xeb15('0xe'));var qs=require(_0xeb15('0xf'));var as=require(_0xeb15('0x10'));var hardwareService=require(_0xeb15('0x11'));var logger=require(_0xeb15('0x12'))(_0xeb15('0x13'));var utils=require('../../config/utils');var config=require(_0xeb15('0x14'));var licenseUtil=require(_0xeb15('0x15'));var db=require(_0xeb15('0x16'))['db'];function respondWithStatusCode(_0x3ffdeb,_0x2bdfe0){_0x2bdfe0=_0x2bdfe0||0xcc;return function(_0x4b880f){if(_0x4b880f){return _0x3ffdeb[_0xeb15('0x17')](_0x2bdfe0);}return _0x3ffdeb[_0xeb15('0x18')](_0x2bdfe0)[_0xeb15('0x19')]();};}function respondWithResult(_0x46d9d8,_0x47120f){_0x47120f=_0x47120f||0xc8;return function(_0x2d9c05){if(_0x2d9c05){return _0x46d9d8[_0xeb15('0x18')](_0x47120f)[_0xeb15('0x1a')](_0x2d9c05);}};}function respondWithFilteredResult(_0x13e5cd,_0x1e3eab){return function(_0x2a6dec){if(_0x2a6dec){var _0x388ac8=typeof _0x1e3eab['offset']==='undefined'&&typeof _0x1e3eab['limit']===_0xeb15('0x1b');var _0x20a31b=_0x2a6dec[_0xeb15('0x1c')];var _0x4b4106=_0x388ac8?0x0:_0x1e3eab[_0xeb15('0x1d')];var _0x560208=_0x388ac8?_0x2a6dec[_0xeb15('0x1c')]:_0x1e3eab[_0xeb15('0x1d')]+_0x1e3eab[_0xeb15('0x1e')];var _0x2a2a02;if(_0x560208>=_0x20a31b){_0x560208=_0x20a31b;_0x2a2a02=0xc8;}else{_0x2a2a02=0xce;}_0x13e5cd[_0xeb15('0x18')](_0x2a2a02);return _0x13e5cd[_0xeb15('0x1f')]('Content-Range',_0x4b4106+'-'+_0x560208+'/'+_0x20a31b)[_0xeb15('0x1a')](_0x2a6dec);}return null;};}function patchUpdates(_0x1cda99){return function(_0x50ee75){try{jsonpatch[_0xeb15('0x20')](_0x50ee75,_0x1cda99,!![]);}catch(_0xc8a3f3){return BPromise[_0xeb15('0x21')](_0xc8a3f3);}return _0x50ee75[_0xeb15('0x22')]();};}function saveUpdates(_0x199b6c,_0x2664b0){return function(_0x1bba7f){if(_0x1bba7f){return _0x1bba7f[_0xeb15('0x23')](_0x199b6c)[_0xeb15('0x24')](function(_0x3a1a7d){return _0x3a1a7d;});}return null;};}function removeEntity(_0x45ddb3,_0x2d6b5d){return function(_0x2e01a3){if(_0x2e01a3){return _0x2e01a3[_0xeb15('0x25')]()[_0xeb15('0x24')](function(){_0x45ddb3[_0xeb15('0x18')](0xcc)[_0xeb15('0x19')]();});}};}function handleEntityNotFound(_0x149b18,_0x9a8c0a){return function(_0x13ef76){if(!_0x13ef76){_0x149b18[_0xeb15('0x17')](0x194);}return _0x13ef76;};}function handleError(_0x24540d,_0xd53d30){_0xd53d30=_0xd53d30||0x1f4;return function(_0x21f805){logger['error'](_0x21f805[_0xeb15('0x26')]);if(_0x21f805[_0xeb15('0x27')]){delete _0x21f805[_0xeb15('0x27')];}_0x24540d['status'](_0xd53d30)[_0xeb15('0x28')](_0x21f805);};}exports[_0xeb15('0x29')]=function(_0x528594,_0x399c30){var _0x426df2={},_0x613e69={},_0x277fd7={'count':0x0,'rows':[]};var _0x5bc4c1=_['map'](db[_0xeb15('0x2a')][_0xeb15('0x2b')],function(_0x5041ad){return{'name':_0x5041ad[_0xeb15('0x2c')],'type':_0x5041ad[_0xeb15('0x2d')][_0xeb15('0x2e')]};});_0x613e69[_0xeb15('0x2f')]=_[_0xeb15('0x30')](_0x5bc4c1,_0xeb15('0x27'));_0x613e69[_0xeb15('0x31')]=_[_0xeb15('0x32')](_0x528594['query']);_0x613e69[_0xeb15('0x33')]=_[_0xeb15('0x34')](_0x613e69[_0xeb15('0x2f')],_0x613e69[_0xeb15('0x31')]);_0x426df2['attributes']=_['intersection'](_0x613e69[_0xeb15('0x2f')],qs[_0xeb15('0x35')](_0x528594['query']['fields']));_0x426df2['attributes']=_0x426df2['attributes'][_0xeb15('0x36')]?_0x426df2[_0xeb15('0x37')]:_0x613e69[_0xeb15('0x2f')];if(!_0x528594[_0xeb15('0x31')]['hasOwnProperty'](_0xeb15('0x38'))){_0x426df2[_0xeb15('0x1e')]=qs[_0xeb15('0x1e')](_0x528594[_0xeb15('0x31')][_0xeb15('0x1e')]);_0x426df2[_0xeb15('0x1d')]=qs['offset'](_0x528594[_0xeb15('0x31')][_0xeb15('0x1d')]);}_0x426df2[_0xeb15('0x39')]=qs[_0xeb15('0x3a')](_0x528594['query'][_0xeb15('0x3a')]);_0x426df2[_0xeb15('0x3b')]=qs[_0xeb15('0x33')](_[_0xeb15('0x3c')](_0x528594['query'],_0x613e69[_0xeb15('0x33')]),_0x5bc4c1);if(_0x528594[_0xeb15('0x31')][_0xeb15('0x3d')]){_0x426df2['where']=_[_0xeb15('0x3e')](_0x426df2[_0xeb15('0x3b')],{'$or':_[_0xeb15('0x30')](_0x5bc4c1,function(_0x427051){if(_0x427051[_0xeb15('0x2d')]!==_0xeb15('0x3f')){var _0x4b77e4={};_0x4b77e4[_0x427051[_0xeb15('0x27')]]={'$like':'%'+_0x528594['query'][_0xeb15('0x3d')]+'%'};return _0x4b77e4;}})});}_0x426df2=_[_0xeb15('0x3e')]({},_0x426df2,_0x528594['options']);var _0x39aa18={'where':_0x426df2[_0xeb15('0x3b')]};return db[_0xeb15('0x2a')][_0xeb15('0x1c')](_0x39aa18)['then'](function(_0x3ba3be){_0x277fd7['count']=_0x3ba3be;if(_0x528594[_0xeb15('0x31')][_0xeb15('0x40')]){_0x426df2[_0xeb15('0x41')]=[{'all':!![]}];}return db[_0xeb15('0x2a')][_0xeb15('0x42')](_0x426df2);})[_0xeb15('0x24')](function(_0x5dbbd4){_0x277fd7[_0xeb15('0x43')]=_0x5dbbd4;return _0x277fd7;})[_0xeb15('0x24')](respondWithFilteredResult(_0x399c30,_0x426df2))[_0xeb15('0x44')](handleError(_0x399c30,null));};exports[_0xeb15('0x45')]=function(_0x3d2a28,_0x220410){var _0x33a2aa={'raw':!![],'where':{'id':_0x3d2a28[_0xeb15('0x46')]['id']}},_0x480793={};_0x480793[_0xeb15('0x2f')]=_['keys'](db[_0xeb15('0x2a')]['rawAttributes']);_0x480793['query']=_[_0xeb15('0x32')](_0x3d2a28[_0xeb15('0x31')]);_0x480793[_0xeb15('0x33')]=_[_0xeb15('0x34')](_0x480793[_0xeb15('0x2f')],_0x480793['query']);_0x33a2aa[_0xeb15('0x37')]=_['intersection'](_0x480793[_0xeb15('0x2f')],qs[_0xeb15('0x35')](_0x3d2a28['query']['fields']));_0x33a2aa[_0xeb15('0x37')]=_0x33a2aa['attributes'][_0xeb15('0x36')]?_0x33a2aa[_0xeb15('0x37')]:_0x480793['model'];if(_0x3d2a28[_0xeb15('0x31')][_0xeb15('0x40')]){_0x33a2aa['include']=[{'all':!![]}];}_0x33a2aa=_[_0xeb15('0x3e')]({},_0x33a2aa,_0x3d2a28[_0xeb15('0x47')]);return db['VoiceDialReport']['find'](_0x33a2aa)[_0xeb15('0x24')](handleEntityNotFound(_0x220410,null))['then'](respondWithResult(_0x220410,null))[_0xeb15('0x44')](handleError(_0x220410,null));};exports[_0xeb15('0x48')]=function(_0x366404,_0x2d9756){return db[_0xeb15('0x2a')][_0xeb15('0x48')](_0x366404[_0xeb15('0x49')],{})[_0xeb15('0x24')](respondWithResult(_0x2d9756,0xc9))['catch'](handleError(_0x2d9756,null));};exports[_0xeb15('0x23')]=function(_0x5d3b2c,_0x5e5836){if(_0x5d3b2c['body']['id']){delete _0x5d3b2c[_0xeb15('0x49')]['id'];}return db[_0xeb15('0x2a')][_0xeb15('0x4a')]({'where':{'id':_0x5d3b2c[_0xeb15('0x46')]['id']}})[_0xeb15('0x24')](handleEntityNotFound(_0x5e5836,null))[_0xeb15('0x24')](saveUpdates(_0x5d3b2c['body'],null))['then'](respondWithResult(_0x5e5836,null))['catch'](handleError(_0x5e5836,null));};exports[_0xeb15('0x25')]=function(_0x3f22cf,_0x16bcfb){return db[_0xeb15('0x2a')]['find']({'where':{'id':_0x3f22cf['params']['id']}})[_0xeb15('0x24')](handleEntityNotFound(_0x16bcfb,null))['then'](removeEntity(_0x16bcfb,null))[_0xeb15('0x44')](handleError(_0x16bcfb,null));};exports[_0xeb15('0x4b')]=function(_0x2eb7eb,_0x50060c){return db['VoiceDialReport'][_0xeb15('0x4b')]()[_0xeb15('0x24')](respondWithResult(_0x50060c,null))[_0xeb15('0x44')](handleError(_0x50060c,null));}; \ No newline at end of file +var _0xe47e=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','VoiceDialReport','fieldName','key','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv'];(function(_0x46165c,_0x5d0b03){var _0x168fd7=function(_0x169bfe){while(--_0x169bfe){_0x46165c['push'](_0x46165c['shift']());}};_0x168fd7(++_0x5d0b03);}(_0xe47e,0x93));var _0xee47=function(_0x10a904,_0x2bf292){_0x10a904=_0x10a904-0x0;var _0x53815a=_0xe47e[_0x10a904];return _0x53815a;};'use strict';var emlformat=require(_0xee47('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee47('0x1'));var rp=require(_0xee47('0x2'));var moment=require('moment');var BPromise=require(_0xee47('0x3'));var Mustache=require('mustache');var util=require(_0xee47('0x4'));var path=require(_0xee47('0x5'));var sox=require('sox');var csv=require(_0xee47('0x6'));var ejs=require(_0xee47('0x7'));var fs=require('fs');var fs_extra=require(_0xee47('0x8'));var _=require(_0xee47('0x9'));var squel=require(_0xee47('0xa'));var crypto=require(_0xee47('0xb'));var jsforce=require(_0xee47('0xc'));var deskjs=require(_0xee47('0xd'));var toCsv=require('to-csv');var querystring=require(_0xee47('0xe'));var Papa=require(_0xee47('0xf'));var Redis=require(_0xee47('0x10'));var authService=require(_0xee47('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xee47('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee47('0x13'))(_0xee47('0x14'));var utils=require(_0xee47('0x15'));var config=require(_0xee47('0x16'));var licenseUtil=require(_0xee47('0x17'));var db=require(_0xee47('0x18'))['db'];function respondWithStatusCode(_0x229ed5,_0x576a0){_0x576a0=_0x576a0||0xcc;return function(_0x5c2f59){if(_0x5c2f59){return _0x229ed5['sendStatus'](_0x576a0);}return _0x229ed5[_0xee47('0x19')](_0x576a0)[_0xee47('0x1a')]();};}function respondWithResult(_0x4d9db0,_0x21b405){_0x21b405=_0x21b405||0xc8;return function(_0x58d9b9){if(_0x58d9b9){return _0x4d9db0[_0xee47('0x19')](_0x21b405)[_0xee47('0x1b')](_0x58d9b9);}};}function respondWithFilteredResult(_0x33694c,_0x81ac1d){return function(_0x513e6a){if(_0x513e6a){var _0x11d564=typeof _0x81ac1d[_0xee47('0x1c')]===_0xee47('0x1d')&&typeof _0x81ac1d[_0xee47('0x1e')]===_0xee47('0x1d');var _0x5136cc=_0x513e6a[_0xee47('0x1f')];var _0x54ad66=_0x11d564?0x0:_0x81ac1d[_0xee47('0x1c')];var _0x4e85ad=_0x11d564?_0x513e6a['count']:_0x81ac1d[_0xee47('0x1c')]+_0x81ac1d[_0xee47('0x1e')];var _0x59324e;if(_0x4e85ad>=_0x5136cc){_0x4e85ad=_0x5136cc;_0x59324e=0xc8;}else{_0x59324e=0xce;}_0x33694c[_0xee47('0x19')](_0x59324e);return _0x33694c[_0xee47('0x20')](_0xee47('0x21'),_0x54ad66+'-'+_0x4e85ad+'/'+_0x5136cc)['json'](_0x513e6a);}return null;};}function patchUpdates(_0x4d609f){return function(_0x2facf){try{jsonpatch[_0xee47('0x22')](_0x2facf,_0x4d609f,!![]);}catch(_0x5e0ddd){return BPromise[_0xee47('0x23')](_0x5e0ddd);}return _0x2facf[_0xee47('0x24')]();};}function saveUpdates(_0x36fe56,_0x21c19a){return function(_0x444b16){if(_0x444b16){return _0x444b16['update'](_0x36fe56)[_0xee47('0x25')](function(_0x306ef5){return _0x306ef5;});}return null;};}function removeEntity(_0x15d5ec,_0x4b9a74){return function(_0x37b3e9){if(_0x37b3e9){return _0x37b3e9['destroy']()['then'](function(){_0x15d5ec[_0xee47('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22c433,_0x36d742){return function(_0x13e53d){if(!_0x13e53d){_0x22c433['sendStatus'](0x194);}return _0x13e53d;};}function handleError(_0x5b2077,_0x10866d){_0x10866d=_0x10866d||0x1f4;return function(_0x3eb74c){logger[_0xee47('0x26')](_0x3eb74c['stack']);if(_0x3eb74c[_0xee47('0x27')]){delete _0x3eb74c[_0xee47('0x27')];}_0x5b2077[_0xee47('0x19')](_0x10866d)[_0xee47('0x28')](_0x3eb74c);};}exports[_0xee47('0x29')]=function(_0x331807,_0x457833){var _0x159ef1={},_0x5f5a40={},_0x23d8ec={'count':0x0,'rows':[]};var _0x50c344=_['map'](db[_0xee47('0x2a')]['rawAttributes'],function(_0x302ee2){return{'name':_0x302ee2[_0xee47('0x2b')],'type':_0x302ee2['type'][_0xee47('0x2c')]};});_0x5f5a40[_0xee47('0x2d')]=_[_0xee47('0x2e')](_0x50c344,'name');_0x5f5a40['query']=_[_0xee47('0x2f')](_0x331807['query']);_0x5f5a40[_0xee47('0x30')]=_[_0xee47('0x31')](_0x5f5a40[_0xee47('0x2d')],_0x5f5a40[_0xee47('0x32')]);_0x159ef1['attributes']=_['intersection'](_0x5f5a40[_0xee47('0x2d')],qs[_0xee47('0x33')](_0x331807['query'][_0xee47('0x33')]));_0x159ef1[_0xee47('0x34')]=_0x159ef1[_0xee47('0x34')][_0xee47('0x35')]?_0x159ef1[_0xee47('0x34')]:_0x5f5a40[_0xee47('0x2d')];if(!_0x331807[_0xee47('0x32')][_0xee47('0x36')]('nolimit')){_0x159ef1[_0xee47('0x1e')]=qs[_0xee47('0x1e')](_0x331807[_0xee47('0x32')][_0xee47('0x1e')]);_0x159ef1['offset']=qs[_0xee47('0x1c')](_0x331807[_0xee47('0x32')]['offset']);}_0x159ef1[_0xee47('0x37')]=qs[_0xee47('0x38')](_0x331807['query']['sort']);_0x159ef1[_0xee47('0x39')]=qs['filters'](_[_0xee47('0x3a')](_0x331807['query'],_0x5f5a40[_0xee47('0x30')]),_0x50c344);if(_0x331807[_0xee47('0x32')][_0xee47('0x3b')]){_0x159ef1[_0xee47('0x39')]=_[_0xee47('0x3c')](_0x159ef1[_0xee47('0x39')],{'$or':_[_0xee47('0x2e')](_0x50c344,function(_0x29f29d){if(_0x29f29d[_0xee47('0x3d')]!==_0xee47('0x3e')){var _0x57f5bb={};_0x57f5bb[_0x29f29d['name']]={'$like':'%'+_0x331807[_0xee47('0x32')]['filter']+'%'};return _0x57f5bb;}})});}_0x159ef1=_[_0xee47('0x3c')]({},_0x159ef1,_0x331807[_0xee47('0x3f')]);var _0x379bb2={'where':_0x159ef1[_0xee47('0x39')]};return db[_0xee47('0x2a')][_0xee47('0x1f')](_0x379bb2)['then'](function(_0x4b13ba){_0x23d8ec[_0xee47('0x1f')]=_0x4b13ba;if(_0x331807[_0xee47('0x32')][_0xee47('0x40')]){_0x159ef1[_0xee47('0x41')]=[{'all':!![]}];}return db[_0xee47('0x2a')][_0xee47('0x42')](_0x159ef1);})['then'](function(_0x1c4492){_0x23d8ec['rows']=_0x1c4492;return _0x23d8ec;})[_0xee47('0x25')](respondWithFilteredResult(_0x457833,_0x159ef1))['catch'](handleError(_0x457833,null));};exports[_0xee47('0x43')]=function(_0x3a937f,_0x1f4757){var _0x535a98={'raw':!![],'where':{'id':_0x3a937f[_0xee47('0x44')]['id']}},_0x1787e7={};_0x1787e7['model']=_[_0xee47('0x2f')](db[_0xee47('0x2a')][_0xee47('0x45')]);_0x1787e7[_0xee47('0x32')]=_[_0xee47('0x2f')](_0x3a937f[_0xee47('0x32')]);_0x1787e7[_0xee47('0x30')]=_[_0xee47('0x31')](_0x1787e7['model'],_0x1787e7[_0xee47('0x32')]);_0x535a98[_0xee47('0x34')]=_['intersection'](_0x1787e7['model'],qs[_0xee47('0x33')](_0x3a937f['query'][_0xee47('0x33')]));_0x535a98['attributes']=_0x535a98[_0xee47('0x34')]['length']?_0x535a98['attributes']:_0x1787e7['model'];if(_0x3a937f[_0xee47('0x32')][_0xee47('0x40')]){_0x535a98['include']=[{'all':!![]}];}_0x535a98=_[_0xee47('0x3c')]({},_0x535a98,_0x3a937f['options']);return db[_0xee47('0x2a')][_0xee47('0x46')](_0x535a98)['then'](handleEntityNotFound(_0x1f4757,null))[_0xee47('0x25')](respondWithResult(_0x1f4757,null))[_0xee47('0x47')](handleError(_0x1f4757,null));};exports[_0xee47('0x48')]=function(_0x27c682,_0x3a32df){return db[_0xee47('0x2a')][_0xee47('0x48')](_0x27c682[_0xee47('0x49')],{})[_0xee47('0x25')](respondWithResult(_0x3a32df,0xc9))[_0xee47('0x47')](handleError(_0x3a32df,null));};exports[_0xee47('0x4a')]=function(_0x2bbabd,_0x263272){if(_0x2bbabd[_0xee47('0x49')]['id']){delete _0x2bbabd[_0xee47('0x49')]['id'];}return db['VoiceDialReport'][_0xee47('0x46')]({'where':{'id':_0x2bbabd['params']['id']}})['then'](handleEntityNotFound(_0x263272,null))['then'](saveUpdates(_0x2bbabd[_0xee47('0x49')],null))[_0xee47('0x25')](respondWithResult(_0x263272,null))[_0xee47('0x47')](handleError(_0x263272,null));};exports[_0xee47('0x4b')]=function(_0x2e66dd,_0x4bd53f){return db['VoiceDialReport'][_0xee47('0x46')]({'where':{'id':_0x2e66dd[_0xee47('0x44')]['id']}})[_0xee47('0x25')](handleEntityNotFound(_0x4bd53f,null))['then'](removeEntity(_0x4bd53f,null))[_0xee47('0x47')](handleError(_0x4bd53f,null));};exports[_0xee47('0x4c')]=function(_0x3d6f5d,_0x271fe0){return db[_0xee47('0x2a')][_0xee47('0x4c')]()[_0xee47('0x25')](respondWithResult(_0x271fe0,null))['catch'](handleError(_0x271fe0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 845b5e1..8369453 100644 --- a/server/api/voiceDialReport/voiceDialReport.model.js +++ b/server/api/voiceDialReport/voiceDialReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d07=['VoiceDialReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x0d07,0x9c));var _0x70d0=function(_0x3c6b9f,_0x25f01f){_0x3c6b9f=_0x3c6b9f-0x0;var _0x190cff=_0x0d07[_0x3c6b9f];return _0x190cff;};'use strict';var _=require('lodash');var util=require(_0x70d0('0x0'));var logger=require(_0x70d0('0x1'))(_0x70d0('0x2'));var moment=require(_0x70d0('0x3'));var BPromise=require(_0x70d0('0x4'));var rp=require(_0x70d0('0x5'));var fs=require('fs');var path=require(_0x70d0('0x6'));var rimraf=require(_0x70d0('0x7'));var config=require(_0x70d0('0x8'));var attributes=require(_0x70d0('0x9'));module[_0x70d0('0xa')]=function(_0x13c906,_0xc2bda6){return _0x13c906[_0x70d0('0xb')](_0x70d0('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x70d0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc925=['bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','util','../../config/logger','api','moment'];(function(_0x4854b1,_0x1000c2){var _0x4e5997=function(_0xb5de7f){while(--_0xb5de7f){_0x4854b1['push'](_0x4854b1['shift']());}};_0x4e5997(++_0x1000c2);}(_0xc925,0x71));var _0x5c92=function(_0x2d842c,_0x85219e){_0x2d842c=_0x2d842c-0x0;var _0x4883f6=_0xc925[_0x2d842c];return _0x4883f6;};'use strict';var _=require('lodash');var util=require(_0x5c92('0x0'));var logger=require(_0x5c92('0x1'))(_0x5c92('0x2'));var moment=require(_0x5c92('0x3'));var BPromise=require(_0x5c92('0x4'));var rp=require(_0x5c92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c92('0x6'));var config=require(_0x5c92('0x7'));var attributes=require(_0x5c92('0x8'));module[_0x5c92('0x9')]=function(_0xf9f996,_0x5b68f0){return _0xf9f996[_0x5c92('0xa')](_0x5c92('0xb'),attributes,{'tableName':_0x5c92('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 19aa82d..ef26782 100644 --- a/server/api/voiceDialReport/voiceDialReport.rpc.js +++ b/server/api/voiceDialReport/voiceDialReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fc8=['attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','where'];(function(_0x3e9b38,_0x44e525){var _0x41b0a2=function(_0x33d9f3){while(--_0x33d9f3){_0x3e9b38['push'](_0x3e9b38['shift']());}};_0x41b0a2(++_0x44e525);}(_0x3fc8,0x19a));var _0x83fc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x3fc8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x83fc('0x0'));var util=require(_0x83fc('0x1'));var moment=require(_0x83fc('0x2'));var BPromise=require(_0x83fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83fc('0x4'));var db=require(_0x83fc('0x5'))['db'];var utils=require(_0x83fc('0x6'));var logger=require(_0x83fc('0x7'))(_0x83fc('0x8'));var config=require(_0x83fc('0x9'));var jayson=require(_0x83fc('0xa'));var client=jayson[_0x83fc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fe1e7,_0x5ed706,_0x36c9fe){return new BPromise(function(_0x24daf2,_0x1c30cb){return client[_0x83fc('0xc')](_0x4fe1e7,_0x36c9fe)[_0x83fc('0xd')](function(_0x31d041){logger[_0x83fc('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x5ed706,_0x83fc('0xf'));logger[_0x83fc('0x10')](_0x83fc('0x11'),_0x5ed706,_0x83fc('0xf'),JSON[_0x83fc('0x12')](_0x31d041));if(_0x31d041[_0x83fc('0x13')]){if(_0x31d041[_0x83fc('0x13')][_0x83fc('0x14')]===0x1f4){logger[_0x83fc('0x13')](_0x83fc('0x15'),_0x5ed706,_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);return _0x1c30cb(_0x31d041['error'][_0x83fc('0x16')]);}logger[_0x83fc('0x13')](_0x83fc('0x15'),_0x5ed706,_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);return _0x24daf2(_0x31d041[_0x83fc('0x13')][_0x83fc('0x16')]);}else{logger[_0x83fc('0xe')](_0x83fc('0x15'),_0x5ed706,'request\x20sent');_0x24daf2(_0x31d041['result']['message']);}})[_0x83fc('0x17')](function(_0x5360b4){logger['error'](_0x83fc('0x15'),_0x5ed706,_0x5360b4);_0x1c30cb(_0x5360b4);});});}exports[_0x83fc('0x18')]=function(_0x140d5c){var _0x1bb45a=this;return new Promise(function(_0xc06c3d,_0x45c7b0){return db[_0x83fc('0x19')][_0x83fc('0x1a')](_0x140d5c[_0x83fc('0x1b')],{'raw':_0x140d5c['options']?_0x140d5c[_0x83fc('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x83fc('0xd')](function(_0x4d2780){logger['info'](_0x83fc('0x18'),_0x140d5c);logger[_0x83fc('0x10')]('CreateVoiceDialReport',_0x140d5c,JSON[_0x83fc('0x12')](_0x4d2780));_0xc06c3d(_0x4d2780);})[_0x83fc('0x17')](function(_0x18c963){logger[_0x83fc('0x13')]('CreateVoiceDialReport',_0x18c963[_0x83fc('0x16')],_0x140d5c);_0x45c7b0(_0x1bb45a[_0x83fc('0x13')](0x1f4,_0x18c963[_0x83fc('0x16')]));});});};exports[_0x83fc('0x1d')]=function(_0x35ee8e){var _0x8c30f8=this;return new Promise(function(_0x58844d,_0x1e0828){return db[_0x83fc('0x19')][_0x83fc('0x1e')](_0x35ee8e['body'],{'raw':_0x35ee8e['options']?_0x35ee8e[_0x83fc('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e['options'][_0x83fc('0x1f')]||null:null,'attributes':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e[_0x83fc('0x1c')][_0x83fc('0x20')]||null:null,'limit':_0x35ee8e[_0x83fc('0x1c')]?_0x35ee8e[_0x83fc('0x1c')][_0x83fc('0x21')]||null:null})['then'](function(_0x32fc83){logger[_0x83fc('0xe')](_0x83fc('0x1d'),_0x35ee8e);logger[_0x83fc('0x10')]('UpdateVoiceDialReport',_0x35ee8e,JSON[_0x83fc('0x12')](_0x32fc83));_0x58844d(_0x32fc83);})['catch'](function(_0x582f67){logger[_0x83fc('0x13')](_0x83fc('0x1d'),_0x582f67[_0x83fc('0x16')],_0x35ee8e);_0x1e0828(_0x8c30f8[_0x83fc('0x13')](0x1f4,_0x582f67[_0x83fc('0x16')]));});});}; \ No newline at end of file +var _0xcc2d=['UpdateVoiceDialReport','VoiceDialReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','debug','stringify'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xcc2d,0x97));var _0xdcc2=function(_0xc21ac7,_0x30ea0f){_0xc21ac7=_0xc21ac7-0x0;var _0x521a45=_0xcc2d[_0xc21ac7];return _0x521a45;};'use strict';var _=require(_0xdcc2('0x0'));var util=require(_0xdcc2('0x1'));var moment=require(_0xdcc2('0x2'));var BPromise=require(_0xdcc2('0x3'));var rs=require(_0xdcc2('0x4'));var fs=require('fs');var Redis=require(_0xdcc2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdcc2('0x6'))(_0xdcc2('0x7'));var config=require(_0xdcc2('0x8'));var jayson=require(_0xdcc2('0x9'));var client=jayson[_0xdcc2('0xa')][_0xdcc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50e31e,_0x1d2b5a,_0x220690){return new BPromise(function(_0x577567,_0x37c6da){return client[_0xdcc2('0xc')](_0x50e31e,_0x220690)[_0xdcc2('0xd')](function(_0x2c5389){logger[_0xdcc2('0xe')](_0xdcc2('0xf'),_0x1d2b5a,_0xdcc2('0x10'));logger['debug'](_0xdcc2('0x11'),_0x1d2b5a,_0xdcc2('0x10'),JSON['stringify'](_0x2c5389));if(_0x2c5389[_0xdcc2('0x12')]){if(_0x2c5389[_0xdcc2('0x12')][_0xdcc2('0x13')]===0x1f4){logger['error'](_0xdcc2('0xf'),_0x1d2b5a,_0x2c5389[_0xdcc2('0x12')][_0xdcc2('0x14')]);return _0x37c6da(_0x2c5389[_0xdcc2('0x12')][_0xdcc2('0x14')]);}logger[_0xdcc2('0x12')](_0xdcc2('0xf'),_0x1d2b5a,_0x2c5389[_0xdcc2('0x12')]['message']);return _0x577567(_0x2c5389['error'][_0xdcc2('0x14')]);}else{logger[_0xdcc2('0xe')](_0xdcc2('0xf'),_0x1d2b5a,_0xdcc2('0x10'));_0x577567(_0x2c5389[_0xdcc2('0x15')][_0xdcc2('0x14')]);}})[_0xdcc2('0x16')](function(_0x3211ae){logger[_0xdcc2('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x1d2b5a,_0x3211ae);_0x37c6da(_0x3211ae);});});}exports[_0xdcc2('0x17')]=function(_0x533c21){var _0x369aae=this;return new Promise(function(_0x217f0a,_0x206f5e){return db['VoiceDialReport'][_0xdcc2('0x18')](_0x533c21['body'],{'raw':_0x533c21[_0xdcc2('0x19')]?_0x533c21[_0xdcc2('0x19')][_0xdcc2('0x1a')]===undefined?!![]:![]:!![]})[_0xdcc2('0xd')](function(_0x4b738a){logger['info'](_0xdcc2('0x17'),_0x533c21);logger[_0xdcc2('0x1b')]('CreateVoiceDialReport',_0x533c21,JSON[_0xdcc2('0x1c')](_0x4b738a));_0x217f0a(_0x4b738a);})[_0xdcc2('0x16')](function(_0x546c82){logger[_0xdcc2('0x12')](_0xdcc2('0x17'),_0x546c82[_0xdcc2('0x14')],_0x533c21);_0x206f5e(_0x369aae[_0xdcc2('0x12')](0x1f4,_0x546c82['message']));});});};exports[_0xdcc2('0x1d')]=function(_0x32ba79){var _0x20ca2d=this;return new Promise(function(_0x5be1e8,_0x182237){return db[_0xdcc2('0x1e')][_0xdcc2('0x1f')](_0x32ba79[_0xdcc2('0x20')],{'raw':_0x32ba79[_0xdcc2('0x19')]?_0x32ba79[_0xdcc2('0x19')][_0xdcc2('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32ba79[_0xdcc2('0x19')]?_0x32ba79[_0xdcc2('0x19')][_0xdcc2('0x21')]||null:null,'attributes':_0x32ba79[_0xdcc2('0x19')]?_0x32ba79['options'][_0xdcc2('0x22')]||null:null,'limit':_0x32ba79[_0xdcc2('0x19')]?_0x32ba79[_0xdcc2('0x19')][_0xdcc2('0x23')]||null:null})[_0xdcc2('0xd')](function(_0x2ed418){logger['info'](_0xdcc2('0x1d'),_0x32ba79);logger[_0xdcc2('0x1b')](_0xdcc2('0x1d'),_0x32ba79,JSON['stringify'](_0x2ed418));_0x5be1e8(_0x2ed418);})[_0xdcc2('0x16')](function(_0x1f1899){logger['error'](_0xdcc2('0x1d'),_0x1f1899[_0xdcc2('0x14')],_0x32ba79);_0x182237(_0x20ca2d['error'](0x1f4,_0x1f1899['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a780839..8b3d27d 100644 --- a/server/api/voiceExtension/index.js +++ b/server/api/voiceExtension/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf507=['index','isAuthenticated','show','create','/:id/applications','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0xf507,0x1af));var _0x7f50=function(_0x1b8139,_0x515e63){_0x1b8139=_0x1b8139-0x0;var _0x378143=_0xf507[_0x1b8139];return _0x378143;};'use strict';var multer=require('multer');var util=require(_0x7f50('0x0'));var path=require('path');var timeout=require(_0x7f50('0x1'));var express=require(_0x7f50('0x2'));var router=express[_0x7f50('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f50('0x4'));var interaction=require(_0x7f50('0x5'));var config=require(_0x7f50('0x6'));var controller=require(_0x7f50('0x7'));router[_0x7f50('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f50('0x9')]);router[_0x7f50('0x8')]('/:id',auth[_0x7f50('0xa')](),controller[_0x7f50('0xb')]);router['post']('/',auth[_0x7f50('0xa')](),controller[_0x7f50('0xc')]);router['post'](_0x7f50('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0x7f50('0xe')](_0x7f50('0xf'),auth[_0x7f50('0xa')](),controller[_0x7f50('0x10')]);router[_0x7f50('0x11')](_0x7f50('0xf'),auth['isAuthenticated'](),controller[_0x7f50('0x12')]);module[_0x7f50('0x13')]=router; \ No newline at end of file +var _0xafc8=['index','get','show','create','post','/:id/applications','addApplications','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceExtension.controller','isAuthenticated'];(function(_0x25da9f,_0x47d72c){var _0x447588=function(_0x212fa5){while(--_0x212fa5){_0x25da9f['push'](_0x25da9f['shift']());}};_0x447588(++_0x47d72c);}(_0xafc8,0x74));var _0x8afc=function(_0x808cb0,_0x775cf4){_0x808cb0=_0x808cb0-0x0;var _0x45dfc6=_0xafc8[_0x808cb0];return _0x45dfc6;};'use strict';var multer=require(_0x8afc('0x0'));var util=require(_0x8afc('0x1'));var path=require(_0x8afc('0x2'));var timeout=require(_0x8afc('0x3'));var express=require(_0x8afc('0x4'));var router=express[_0x8afc('0x5')]();var fs_extra=require(_0x8afc('0x6'));var auth=require(_0x8afc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8afc('0x8'));router['get']('/',auth[_0x8afc('0x9')](),controller[_0x8afc('0xa')]);router[_0x8afc('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x8afc('0xc')]);router['post']('/',auth[_0x8afc('0x9')](),controller[_0x8afc('0xd')]);router[_0x8afc('0xe')](_0x8afc('0xf'),auth[_0x8afc('0x9')](),controller[_0x8afc('0x10')]);router[_0x8afc('0x11')](_0x8afc('0x12'),auth[_0x8afc('0x9')](),controller[_0x8afc('0x13')]);router['delete'](_0x8afc('0x12'),auth[_0x8afc('0x9')](),controller['destroy']);module[_0x8afc('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7e60b80..2670c82 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeae1=['system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','internal'];(function(_0xd18b28,_0x2ccc4c){var _0x12df2c=function(_0x2717b2){while(--_0x2717b2){_0xd18b28['push'](_0xd18b28['shift']());}};_0x12df2c(++_0x2ccc4c);}(_0xeae1,0x98));var _0x1eae=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0xeae1[_0x3e618a];return _0x1f3d61;};'use strict';var Sequelize=require(_0x1eae('0x0'));module[_0x1eae('0x1')]={'context':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'unique':_0x1eae('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x1eae('0x3')},'tag':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x1eae('0x2')],'allowNull':![],'defaultValue':_0x1eae('0x4')},'appdata':{'type':Sequelize[_0x1eae('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x1eae('0x5')](_0x1eae('0x6'),'outbound',_0x1eae('0x7'),'inbound-fax','outbound-fax',_0x1eae('0x8'),_0x1eae('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x1eae('0xa')]},'isApp':{'type':Sequelize[_0x1eae('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1eae('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x1eae('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1eae('0xa')]},'recordingFormat':{'type':Sequelize[_0x1eae('0x2')],'defaultValue':_0x1eae('0xc')},'answer':{'type':Sequelize[_0x1eae('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1eae('0xd')],'get':function(_0x4df77b){return this[_0x1eae('0xe')](_0x1eae('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x94ac=['VIRTUAL','getDataValue','exten','exports','compositeIndex','STRING','outbound','internal','inbound-fax','any','*,*,*,*','BOOLEAN','wav'];(function(_0x1e6f14,_0x28f07d){var _0x326dcd=function(_0x460e2e){while(--_0x460e2e){_0x1e6f14['push'](_0x1e6f14['shift']());}};_0x326dcd(++_0x28f07d);}(_0x94ac,0x1a3));var _0xc94a=function(_0x8c9f66,_0x1f15ee){_0x8c9f66=_0x8c9f66-0x0;var _0x285e84=_0x94ac[_0x8c9f66];return _0x285e84;};'use strict';var Sequelize=require('sequelize');module[_0xc94a('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc94a('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xc94a('0x2')],'allowNull':![],'unique':_0xc94a('0x1')},'priority':{'type':Sequelize[_0xc94a('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xc94a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xc94a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0xc94a('0x3'),_0xc94a('0x4'),_0xc94a('0x5'),'outbound-fax','system',_0xc94a('0x6')),'allowNull':![]},'description':{'type':Sequelize[_0xc94a('0x2')]},'interval':{'type':Sequelize[_0xc94a('0x2')],'allowNull':![],'defaultValue':_0xc94a('0x7')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xc94a('0x8')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc94a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xc94a('0x2')],'defaultValue':_0xc94a('0x9')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xc94a('0xa')],'get':function(_0x316968){return this[_0xc94a('0xb')](_0xc94a('0xc'));}},'alias':{'type':Sequelize[_0xc94a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 22acc4a..51fcb80 100644 --- a/server/api/voiceExtension/voiceExtension.controller.js +++ b/server/api/voiceExtension/voiceExtension.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d34=['error','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','VoiceExtension','include','params','create','body','exten','role','user','inbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','includes','type','find','value','name','UserProfileResource','end'];(function(_0x587784,_0x5cd472){var _0x371dd2=function(_0x73c1b5){while(--_0x73c1b5){_0x587784['push'](_0x587784['shift']());}};_0x371dd2(++_0x5cd472);}(_0x2d34,0xe9));var _0x42d3=function(_0xa32acd,_0x2c79cc){_0xa32acd=_0xa32acd-0x0;var _0x5a6ac6=_0x2d34[_0xa32acd];return _0x5a6ac6;};'use strict';var _=require('lodash');var Redis=require(_0x42d3('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x42d3('0x1'))(_0x42d3('0x2'));var config=require(_0x42d3('0x3'));var db=require(_0x42d3('0x4'))['db'];config[_0x42d3('0x5')]=_['defaults'](config[_0x42d3('0x5')],{'host':_0x42d3('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42d3('0x5')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x249f3a,_0x5d0610){_0x5d0610=_0x5d0610||0xcc;return function(_0x315bd3){if(_0x315bd3){return _0x249f3a[_0x42d3('0x7')](_0x5d0610);}return _0x249f3a[_0x42d3('0x8')](_0x5d0610)['end']();};}function respondWithResult(_0x26649f,_0x976078){_0x976078=_0x976078||0xc8;return function(_0xe8e8fe){if(_0xe8e8fe){return _0x26649f['status'](_0x976078)['json'](_0xe8e8fe);}};}function respondWithFilteredResult(_0x56100d,_0x450ccd){return function(_0x485b35){if(_0x485b35){var _0x2ce3f9=typeof _0x450ccd[_0x42d3('0x9')]===_0x42d3('0xa')&&typeof _0x450ccd[_0x42d3('0xb')]===_0x42d3('0xa');var _0x1a63e2=_0x485b35['count'];var _0x34db2f=_0x2ce3f9?0x0:_0x450ccd[_0x42d3('0x9')];var _0x16caad=_0x2ce3f9?_0x485b35[_0x42d3('0xc')]:_0x450ccd[_0x42d3('0x9')]+_0x450ccd[_0x42d3('0xb')];var _0xed8441;if(_0x16caad>=_0x1a63e2){_0x16caad=_0x1a63e2;_0xed8441=0xc8;}else{_0xed8441=0xce;}_0x56100d[_0x42d3('0x8')](_0xed8441);return _0x56100d[_0x42d3('0xd')](_0x42d3('0xe'),_0x34db2f+'-'+_0x16caad+'/'+_0x1a63e2)[_0x42d3('0xf')](_0x485b35);}return null;};}function removeEntity(_0xeec58){return function(_0x56f600){if(_0x56f600){return _0x56f600[_0x42d3('0x10')]()[_0x42d3('0x11')](function(){var _0x2eb951=_0x56f600[_0x42d3('0x12')]({'plain':!![]});var _0x3a7d8c=[{'name':_0x42d3('0x13'),'value':'inbound','ignore':![]},{'name':_0x42d3('0x14'),'value':_0x42d3('0x15'),'ignore':![]},{'name':_0x42d3('0x16'),'value':_0x42d3('0x17'),'ignore':![]}];var _0x167fd7=_(_0x3a7d8c)[_0x42d3('0x18')](_0x42d3('0x19'))[_0x42d3('0x1a')]('value')['value']();if(_[_0x42d3('0x1b')](_0x167fd7,_0x2eb951[_0x42d3('0x1c')])){return;}var _0x5988ef=_[_0x42d3('0x1d')](_0x3a7d8c,[_0x42d3('0x1e'),_0x2eb951[_0x42d3('0x1c')]])[_0x42d3('0x1f')];return db[_0x42d3('0x20')][_0x42d3('0x10')]({'where':{'type':_0x5988ef,'resourceId':_0x2eb951['id']}})[_0x42d3('0x11')](function(){return _0x56f600;});})['then'](function(){_0xeec58[_0x42d3('0x8')](0xcc)[_0x42d3('0x21')]();});}};}function handleEntityNotFound(_0x3290e5){return function(_0xfc749a){if(!_0xfc749a){_0x3290e5[_0x42d3('0x7')](0x194);}return _0xfc749a;};}function handleError(_0x4fc8af,_0x5bc65a){_0x5bc65a=_0x5bc65a||0x1f4;return function(_0x454885){logger[_0x42d3('0x22')](_0x454885['stack']);if(_0x454885[_0x42d3('0x1f')]){delete _0x454885[_0x42d3('0x1f')];}_0x4fc8af['status'](_0x5bc65a)[_0x42d3('0x23')](_0x454885);};}exports[_0x42d3('0x24')]=function(_0x59b327,_0x26eb6a){var _0x3dbacd={},_0x2eea8a={},_0x1190c2={'count':0x0,'rows':[]};var _0x39a6c0=_[_0x42d3('0x1a')](db['VoiceExtension'][_0x42d3('0x25')],function(_0x3c161f){return{'name':_0x3c161f[_0x42d3('0x26')],'type':_0x3c161f[_0x42d3('0x1c')][_0x42d3('0x27')]};});_0x2eea8a[_0x42d3('0x28')]=_[_0x42d3('0x1a')](_0x39a6c0,'name');_0x2eea8a[_0x42d3('0x29')]=_[_0x42d3('0x2a')](_0x59b327[_0x42d3('0x29')]);_0x2eea8a[_0x42d3('0x2b')]=_[_0x42d3('0x2c')](_0x2eea8a[_0x42d3('0x28')],_0x2eea8a[_0x42d3('0x29')]);_0x3dbacd[_0x42d3('0x2d')]=_['intersection'](_0x2eea8a['model'],qs[_0x42d3('0x2e')](_0x59b327[_0x42d3('0x29')][_0x42d3('0x2e')]));_0x3dbacd['attributes']=_0x3dbacd[_0x42d3('0x2d')][_0x42d3('0x2f')]?_0x3dbacd[_0x42d3('0x2d')]:_0x2eea8a['model'];if(!_0x59b327[_0x42d3('0x29')][_0x42d3('0x30')](_0x42d3('0x31'))){_0x3dbacd['limit']=qs[_0x42d3('0xb')](_0x59b327[_0x42d3('0x29')]['limit']);_0x3dbacd[_0x42d3('0x9')]=qs[_0x42d3('0x9')](_0x59b327[_0x42d3('0x29')][_0x42d3('0x9')]);}_0x3dbacd['order']=qs['sort'](_0x59b327[_0x42d3('0x29')]['sort']);_0x3dbacd['where']=qs[_0x42d3('0x2b')](_[_0x42d3('0x32')](_0x59b327[_0x42d3('0x29')],_0x2eea8a[_0x42d3('0x2b')]),_0x39a6c0);if(_0x59b327['query'][_0x42d3('0x18')]){_0x3dbacd[_0x42d3('0x33')]=_[_0x42d3('0x34')](_0x3dbacd['where'],{'$or':_[_0x42d3('0x1a')](_0x39a6c0,function(_0x5a516a){if(_0x5a516a[_0x42d3('0x1c')]!==_0x42d3('0x35')){var _0x5e321f={};_0x5e321f[_0x5a516a[_0x42d3('0x1f')]]={'$like':'%'+_0x59b327[_0x42d3('0x29')][_0x42d3('0x18')]+'%'};return _0x5e321f;}})});}_0x3dbacd=_[_0x42d3('0x34')]({},_0x3dbacd,_0x59b327[_0x42d3('0x36')]);var _0x211252={'where':_0x3dbacd[_0x42d3('0x33')]};return db['VoiceExtension'][_0x42d3('0xc')](_0x211252)[_0x42d3('0x11')](function(_0x3d2a40){_0x1190c2[_0x42d3('0xc')]=_0x3d2a40;if(_0x59b327[_0x42d3('0x29')][_0x42d3('0x37')]){_0x3dbacd['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x42d3('0x38')](_0x3dbacd);})[_0x42d3('0x11')](function(_0x59efa1){_0x1190c2['rows']=_0x59efa1;return _0x1190c2;})['then'](respondWithFilteredResult(_0x26eb6a,_0x3dbacd))[_0x42d3('0x39')](handleError(_0x26eb6a,null));};exports[_0x42d3('0x3a')]=function(_0x433716,_0x2485f5){var _0xa75f5={'raw':![],'where':{'id':_0x433716['params']['id']}},_0x365b49={};_0x365b49['model']=_[_0x42d3('0x2a')](db[_0x42d3('0x3b')][_0x42d3('0x25')]);_0x365b49[_0x42d3('0x29')]=_[_0x42d3('0x2a')](_0x433716['query']);_0x365b49[_0x42d3('0x2b')]=_[_0x42d3('0x2c')](_0x365b49['model'],_0x365b49[_0x42d3('0x29')]);_0xa75f5[_0x42d3('0x2d')]=_['intersection'](_0x365b49[_0x42d3('0x28')],qs[_0x42d3('0x2e')](_0x433716[_0x42d3('0x29')][_0x42d3('0x2e')]));_0xa75f5['attributes']=_0xa75f5[_0x42d3('0x2d')][_0x42d3('0x2f')]?_0xa75f5[_0x42d3('0x2d')]:_0x365b49[_0x42d3('0x28')];if(_0x433716[_0x42d3('0x29')]['includeAll']){_0xa75f5[_0x42d3('0x3c')]=[{'all':!![]}];}_0xa75f5=_[_0x42d3('0x34')]({},_0xa75f5,_0x433716[_0x42d3('0x36')]);return db[_0x42d3('0x3b')][_0x42d3('0x1d')](_0xa75f5)[_0x42d3('0x11')](handleEntityNotFound(_0x2485f5,null))[_0x42d3('0x11')](respondWithResult(_0x2485f5,null))[_0x42d3('0x39')](handleError(_0x2485f5,null));};exports['destroy']=function(_0x186c0f,_0x61614b){return db['VoiceExtension'][_0x42d3('0x1d')]({'where':{'id':_0x186c0f[_0x42d3('0x3d')]['id']}})[_0x42d3('0x11')](handleEntityNotFound(_0x61614b,null))[_0x42d3('0x11')](removeEntity(_0x61614b,null))[_0x42d3('0x39')](handleError(_0x61614b,null));};exports[_0x42d3('0x3e')]=function(_0x19163f,_0x516565){if(_0x19163f[_0x42d3('0x3f')][_0x42d3('0x1c')]===_0x42d3('0x15')&&!_['startsWith'](_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')],'_')){_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')]='_'['concat'](_0x19163f[_0x42d3('0x3f')][_0x42d3('0x40')]);}return db[_0x42d3('0x3b')][_0x42d3('0x3e')](_0x19163f[_0x42d3('0x3f')],{'raw':![]})['then'](function(_0x292a30){var _0x439e32=_0x19163f['user']['get']({'plain':!![]});if(!_0x439e32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x439e32[_0x42d3('0x41')]===_0x42d3('0x42')){var _0xe11a17=_0x292a30[_0x42d3('0x12')]({'plain':!![]});var _0x17d3af=[{'name':_0x42d3('0x13'),'value':_0x42d3('0x43')},{'name':_0x42d3('0x14'),'value':_0x42d3('0x15')},{'name':_0x42d3('0x16'),'value':_0x42d3('0x17')}];var _0xb0f806=_['find'](_0x17d3af,[_0x42d3('0x1e'),_0xe11a17[_0x42d3('0x1c')]])[_0x42d3('0x1f')];return db[_0x42d3('0x44')][_0x42d3('0x1d')]({'where':{'name':_0xb0f806,'userProfileId':_0x439e32['userProfileId']},'raw':!![]})[_0x42d3('0x11')](function(_0x5ec6be){if(_0x5ec6be&&_0x5ec6be[_0x42d3('0x45')]===0x0){return db['UserProfileResource'][_0x42d3('0x3e')]({'name':_0xe11a17[_0x42d3('0x1f')],'resourceId':_0xe11a17['id'],'type':_0x5ec6be[_0x42d3('0x1f')],'sectionId':_0x5ec6be['id']},{})['then'](function(){return _0x292a30;});}else{return _0x292a30;}})[_0x42d3('0x39')](function(_0x394c3d){logger['error'](_0x42d3('0x46'),_0x394c3d);throw _0x394c3d;});}return _0x292a30;})[_0x42d3('0x11')](respondWithResult(_0x516565,0xc9))[_0x42d3('0x39')](handleError(_0x516565,null));};exports[_0x42d3('0x47')]=function(_0x5097cc,_0x1f39fa){if(_0x5097cc[_0x42d3('0x3f')]['id']){delete _0x5097cc[_0x42d3('0x3f')]['id'];}return db['VoiceExtension'][_0x42d3('0x1d')]({'where':{'id':_0x5097cc[_0x42d3('0x3d')]['id']}})[_0x42d3('0x11')](handleEntityNotFound(_0x1f39fa,null))['then'](function(_0x5273c3){if(_0x5273c3){return db['VoiceExtension'][_0x42d3('0x47')](_[_0x42d3('0x32')](_0x5097cc[_0x42d3('0x3f')],[_0x42d3('0x40'),_0x42d3('0x48'),'description',_0x42d3('0x49'),_0x42d3('0x4a'),_0x42d3('0x4b'),_0x42d3('0x4c')]),{'where':{'context':_0x5273c3[_0x42d3('0x48')],'exten':_0x5273c3['exten']},'individualHooks':!![]})[_0x42d3('0x11')](function(_0x5360ae){return _0x5360ae;});}return null;})[_0x42d3('0x11')](respondWithStatusCode(_0x1f39fa,null))[_0x42d3('0x39')](handleError(_0x1f39fa,null));};exports[_0x42d3('0x4d')]=function(_0xc28b05,_0x23184e){var _0x1f9ec0=_0xc28b05[_0x42d3('0x3d')]['id'];var _0x107504=_0xc28b05['body'];var _0x4c897d=0xc8;var _0x28897e=null;return db['sequelize'][_0x42d3('0x4e')]({'isolationLevel':db[_0x42d3('0x4f')][_0x42d3('0x50')]['ISOLATION_LEVELS'][_0x42d3('0x51')]},function(_0xcc07cf){return db[_0x42d3('0x3b')]['findOne']({'where':{'id':_0x1f9ec0},'transaction':_0xcc07cf})[_0x42d3('0x11')](function(_0x5afbf0){if(_0x5afbf0){return db[_0x42d3('0x3b')][_0x42d3('0x10')]({'where':{'VoiceExtensionId':_0x1f9ec0},'transaction':_0xcc07cf})['then'](function(){var _0x5f897b=_[_0x42d3('0x1a')](_0x107504,function(_0x4046b6){_0x4046b6['VoiceExtensionId']=_0x1f9ec0;_0x4046b6[_0x42d3('0x52')]=!![];return _0x4046b6;});return _0x5afbf0[_0x42d3('0x53')](_0x5f897b);})[_0x42d3('0x11')](function(_0x191999){return db['VoiceExtension'][_0x42d3('0x54')](_0x191999,{'transaction':_0xcc07cf});});}else{_0x4c897d=0x194;_0x28897e=[];}});})[_0x42d3('0x11')](function(){if(_0x4c897d!==0x194){return db[_0x42d3('0x3b')][_0x42d3('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1f9ec0},'order':_0x42d3('0x56')})['then'](function(_0x1c4f3f){_0x28897e=_0x1c4f3f;});}})[_0x42d3('0x39')](function(_0x5aa873){_0x4c897d=0x1f4;logger[_0x42d3('0x22')](_0x5aa873[_0x42d3('0x57')]);if(_0x5aa873[_0x42d3('0x1f')]){delete _0x5aa873['name'];}_0x28897e=_0x5aa873;})[_0x42d3('0x58')](function(){if(_0x28897e===null){_0x23184e[_0x42d3('0x7')](_0x4c897d);}else{if(_0x4c897d===0x1f4){_0x23184e[_0x42d3('0x8')](_0x4c897d)[_0x42d3('0x23')](_0x28897e);}else{_0x23184e[_0x42d3('0x8')](_0x4c897d)[_0x42d3('0xf')](_0x28897e);}}});}; \ No newline at end of file +var _0x5a91=['value','includes','find','UserProfileResource','sendStatus','name','send','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','type','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','update','description','recordingFormat','cutdigits','alias','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','error','finally','ioredis','../../components/parsers/qs','../../config/logger','api','defaults','redis','./voiceExtension.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore'];(function(_0x428a32,_0x369113){var _0x2ac31d=function(_0x58d89f){while(--_0x58d89f){_0x428a32['push'](_0x428a32['shift']());}};_0x2ac31d(++_0x369113);}(_0x5a91,0x14e));var _0x15a9=function(_0x2a609e,_0x24b643){_0x2a609e=_0x2a609e-0x0;var _0x258ea4=_0x5a91[_0x2a609e];return _0x258ea4;};'use strict';var _=require('lodash');var Redis=require(_0x15a9('0x0'));var qs=require(_0x15a9('0x1'));var logger=require(_0x15a9('0x2'))(_0x15a9('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x15a9('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15a9('0x5')]));require(_0x15a9('0x6'))[_0x15a9('0x7')](socket);function respondWithStatusCode(_0x57f8f5,_0x396619){_0x396619=_0x396619||0xcc;return function(_0x44e64e){if(_0x44e64e){return _0x57f8f5['sendStatus'](_0x396619);}return _0x57f8f5[_0x15a9('0x8')](_0x396619)[_0x15a9('0x9')]();};}function respondWithResult(_0x5af2f4,_0x5dcb56){_0x5dcb56=_0x5dcb56||0xc8;return function(_0x134155){if(_0x134155){return _0x5af2f4[_0x15a9('0x8')](_0x5dcb56)[_0x15a9('0xa')](_0x134155);}};}function respondWithFilteredResult(_0x13bdd8,_0x344537){return function(_0x5ad55c){if(_0x5ad55c){var _0x4a1193=typeof _0x344537[_0x15a9('0xb')]===_0x15a9('0xc')&&typeof _0x344537[_0x15a9('0xd')]===_0x15a9('0xc');var _0x48b9ce=_0x5ad55c[_0x15a9('0xe')];var _0x35d340=_0x4a1193?0x0:_0x344537[_0x15a9('0xb')];var _0xd8528e=_0x4a1193?_0x5ad55c[_0x15a9('0xe')]:_0x344537['offset']+_0x344537['limit'];var _0x1bc4d2;if(_0xd8528e>=_0x48b9ce){_0xd8528e=_0x48b9ce;_0x1bc4d2=0xc8;}else{_0x1bc4d2=0xce;}_0x13bdd8[_0x15a9('0x8')](_0x1bc4d2);return _0x13bdd8[_0x15a9('0xf')](_0x15a9('0x10'),_0x35d340+'-'+_0xd8528e+'/'+_0x48b9ce)[_0x15a9('0xa')](_0x5ad55c);}return null;};}function removeEntity(_0x373d43){return function(_0x4ad7f2){if(_0x4ad7f2){return _0x4ad7f2[_0x15a9('0x11')]()[_0x15a9('0x12')](function(){var _0x54a609=_0x4ad7f2[_0x15a9('0x13')]({'plain':!![]});var _0x3681fa=[{'name':'InboundRoutes','value':_0x15a9('0x14'),'ignore':![]},{'name':_0x15a9('0x15'),'value':'outbound','ignore':![]},{'name':_0x15a9('0x16'),'value':_0x15a9('0x17'),'ignore':![]}];var _0x3f3df9=_(_0x3681fa)[_0x15a9('0x18')](_0x15a9('0x19'))['map']('value')[_0x15a9('0x1a')]();if(_[_0x15a9('0x1b')](_0x3f3df9,_0x54a609['type'])){return;}var _0x252e5d=_[_0x15a9('0x1c')](_0x3681fa,['value',_0x54a609['type']])['name'];return db[_0x15a9('0x1d')][_0x15a9('0x11')]({'where':{'type':_0x252e5d,'resourceId':_0x54a609['id']}})[_0x15a9('0x12')](function(){return _0x4ad7f2;});})[_0x15a9('0x12')](function(){_0x373d43[_0x15a9('0x8')](0xcc)[_0x15a9('0x9')]();});}};}function handleEntityNotFound(_0x24d602){return function(_0x1c29ee){if(!_0x1c29ee){_0x24d602[_0x15a9('0x1e')](0x194);}return _0x1c29ee;};}function handleError(_0x55360a,_0x30a12c){_0x30a12c=_0x30a12c||0x1f4;return function(_0x3b91c1){logger['error'](_0x3b91c1['stack']);if(_0x3b91c1[_0x15a9('0x1f')]){delete _0x3b91c1['name'];}_0x55360a[_0x15a9('0x8')](_0x30a12c)[_0x15a9('0x20')](_0x3b91c1);};}exports[_0x15a9('0x21')]=function(_0x240d9d,_0x405d8a){var _0x5db49c={},_0x10b928={},_0x225133={'count':0x0,'rows':[]};var _0x46fdc0=_[_0x15a9('0x22')](db[_0x15a9('0x23')][_0x15a9('0x24')],function(_0x3edaa5){return{'name':_0x3edaa5[_0x15a9('0x25')],'type':_0x3edaa5['type'][_0x15a9('0x26')]};});_0x10b928[_0x15a9('0x27')]=_[_0x15a9('0x22')](_0x46fdc0,_0x15a9('0x1f'));_0x10b928[_0x15a9('0x28')]=_[_0x15a9('0x29')](_0x240d9d['query']);_0x10b928['filters']=_[_0x15a9('0x2a')](_0x10b928[_0x15a9('0x27')],_0x10b928[_0x15a9('0x28')]);_0x5db49c[_0x15a9('0x2b')]=_['intersection'](_0x10b928[_0x15a9('0x27')],qs[_0x15a9('0x2c')](_0x240d9d['query'][_0x15a9('0x2c')]));_0x5db49c[_0x15a9('0x2b')]=_0x5db49c['attributes'][_0x15a9('0x2d')]?_0x5db49c[_0x15a9('0x2b')]:_0x10b928[_0x15a9('0x27')];if(!_0x240d9d['query']['hasOwnProperty'](_0x15a9('0x2e'))){_0x5db49c['limit']=qs['limit'](_0x240d9d[_0x15a9('0x28')][_0x15a9('0xd')]);_0x5db49c['offset']=qs['offset'](_0x240d9d['query']['offset']);}_0x5db49c[_0x15a9('0x2f')]=qs[_0x15a9('0x30')](_0x240d9d[_0x15a9('0x28')][_0x15a9('0x30')]);_0x5db49c[_0x15a9('0x31')]=qs['filters'](_[_0x15a9('0x32')](_0x240d9d['query'],_0x10b928[_0x15a9('0x33')]),_0x46fdc0);if(_0x240d9d[_0x15a9('0x28')][_0x15a9('0x18')]){_0x5db49c[_0x15a9('0x31')]=_[_0x15a9('0x34')](_0x5db49c[_0x15a9('0x31')],{'$or':_[_0x15a9('0x22')](_0x46fdc0,function(_0x385a5e){if(_0x385a5e['type']!==_0x15a9('0x35')){var _0x2b5507={};_0x2b5507[_0x385a5e[_0x15a9('0x1f')]]={'$like':'%'+_0x240d9d[_0x15a9('0x28')][_0x15a9('0x18')]+'%'};return _0x2b5507;}})});}_0x5db49c=_[_0x15a9('0x34')]({},_0x5db49c,_0x240d9d['options']);var _0x2f513b={'where':_0x5db49c[_0x15a9('0x31')]};return db['VoiceExtension'][_0x15a9('0xe')](_0x2f513b)[_0x15a9('0x12')](function(_0xf04c06){_0x225133['count']=_0xf04c06;if(_0x240d9d[_0x15a9('0x28')][_0x15a9('0x36')]){_0x5db49c[_0x15a9('0x37')]=[{'all':!![]}];}return db[_0x15a9('0x23')][_0x15a9('0x38')](_0x5db49c);})['then'](function(_0x41ccb1){_0x225133['rows']=_0x41ccb1;return _0x225133;})['then'](respondWithFilteredResult(_0x405d8a,_0x5db49c))[_0x15a9('0x39')](handleError(_0x405d8a,null));};exports[_0x15a9('0x3a')]=function(_0x5b1579,_0x90c4b6){var _0xb9b37e={'raw':![],'where':{'id':_0x5b1579[_0x15a9('0x3b')]['id']}},_0x418872={};_0x418872[_0x15a9('0x27')]=_[_0x15a9('0x29')](db[_0x15a9('0x23')][_0x15a9('0x24')]);_0x418872[_0x15a9('0x28')]=_[_0x15a9('0x29')](_0x5b1579['query']);_0x418872[_0x15a9('0x33')]=_['intersection'](_0x418872['model'],_0x418872[_0x15a9('0x28')]);_0xb9b37e[_0x15a9('0x2b')]=_[_0x15a9('0x2a')](_0x418872[_0x15a9('0x27')],qs['fields'](_0x5b1579[_0x15a9('0x28')]['fields']));_0xb9b37e[_0x15a9('0x2b')]=_0xb9b37e[_0x15a9('0x2b')]['length']?_0xb9b37e[_0x15a9('0x2b')]:_0x418872[_0x15a9('0x27')];if(_0x5b1579[_0x15a9('0x28')]['includeAll']){_0xb9b37e['include']=[{'all':!![]}];}_0xb9b37e=_[_0x15a9('0x34')]({},_0xb9b37e,_0x5b1579[_0x15a9('0x3c')]);return db[_0x15a9('0x23')][_0x15a9('0x1c')](_0xb9b37e)[_0x15a9('0x12')](handleEntityNotFound(_0x90c4b6,null))[_0x15a9('0x12')](respondWithResult(_0x90c4b6,null))[_0x15a9('0x39')](handleError(_0x90c4b6,null));};exports['destroy']=function(_0x1f5470,_0x5aedd9){return db['VoiceExtension']['find']({'where':{'id':_0x1f5470[_0x15a9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5aedd9,null))[_0x15a9('0x12')](removeEntity(_0x5aedd9,null))[_0x15a9('0x39')](handleError(_0x5aedd9,null));};exports[_0x15a9('0x3d')]=function(_0x54132c,_0x4f1f77){if(_0x54132c[_0x15a9('0x3e')][_0x15a9('0x3f')]===_0x15a9('0x40')&&!_[_0x15a9('0x41')](_0x54132c[_0x15a9('0x3e')][_0x15a9('0x42')],'_')){_0x54132c[_0x15a9('0x3e')][_0x15a9('0x42')]='_'[_0x15a9('0x43')](_0x54132c[_0x15a9('0x3e')][_0x15a9('0x42')]);}return db[_0x15a9('0x23')]['create'](_0x54132c[_0x15a9('0x3e')],{'raw':![]})[_0x15a9('0x12')](function(_0x349ce4){var _0x36590b=_0x54132c[_0x15a9('0x44')][_0x15a9('0x13')]({'plain':!![]});if(!_0x36590b)throw new Error(_0x15a9('0x45'));if(_0x36590b['role']===_0x15a9('0x44')){var _0x4848d0=_0x349ce4[_0x15a9('0x13')]({'plain':!![]});var _0x2af8c2=[{'name':_0x15a9('0x46'),'value':'inbound'},{'name':_0x15a9('0x15'),'value':_0x15a9('0x40')},{'name':_0x15a9('0x16'),'value':_0x15a9('0x17')}];var _0x21c98c=_[_0x15a9('0x1c')](_0x2af8c2,[_0x15a9('0x1a'),_0x4848d0[_0x15a9('0x3f')]])[_0x15a9('0x1f')];return db[_0x15a9('0x47')][_0x15a9('0x1c')]({'where':{'name':_0x21c98c,'userProfileId':_0x36590b[_0x15a9('0x48')]},'raw':!![]})[_0x15a9('0x12')](function(_0x19c2a9){if(_0x19c2a9&&_0x19c2a9[_0x15a9('0x49')]===0x0){return db['UserProfileResource'][_0x15a9('0x3d')]({'name':_0x4848d0[_0x15a9('0x1f')],'resourceId':_0x4848d0['id'],'type':_0x19c2a9[_0x15a9('0x1f')],'sectionId':_0x19c2a9['id']},{})[_0x15a9('0x12')](function(){return _0x349ce4;});}else{return _0x349ce4;}})[_0x15a9('0x39')](function(_0x397c09){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x397c09);throw _0x397c09;});}return _0x349ce4;})[_0x15a9('0x12')](respondWithResult(_0x4f1f77,0xc9))[_0x15a9('0x39')](handleError(_0x4f1f77,null));};exports[_0x15a9('0x4a')]=function(_0x3b5c73,_0x216caa){if(_0x3b5c73[_0x15a9('0x3e')]['id']){delete _0x3b5c73['body']['id'];}return db['VoiceExtension'][_0x15a9('0x1c')]({'where':{'id':_0x3b5c73[_0x15a9('0x3b')]['id']}})[_0x15a9('0x12')](handleEntityNotFound(_0x216caa,null))[_0x15a9('0x12')](function(_0x1fc1ff){if(_0x1fc1ff){return db[_0x15a9('0x23')][_0x15a9('0x4a')](_[_0x15a9('0x32')](_0x3b5c73[_0x15a9('0x3e')],[_0x15a9('0x42'),'context',_0x15a9('0x4b'),_0x15a9('0x4c'),_0x15a9('0x4d'),'mandatoryDisposition',_0x15a9('0x4e')]),{'where':{'context':_0x1fc1ff['context'],'exten':_0x1fc1ff[_0x15a9('0x42')]},'individualHooks':!![]})[_0x15a9('0x12')](function(_0x19b4cf){return _0x19b4cf;});}return null;})[_0x15a9('0x12')](respondWithStatusCode(_0x216caa,null))[_0x15a9('0x39')](handleError(_0x216caa,null));};exports['addApplications']=function(_0x58d9dd,_0x235aa1){var _0x436db1=_0x58d9dd[_0x15a9('0x3b')]['id'];var _0x5a392f=_0x58d9dd[_0x15a9('0x3e')];var _0x809e5c=0xc8;var _0x74702d=null;return db[_0x15a9('0x4f')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x15a9('0x50')][_0x15a9('0x51')]},function(_0x2a45af){return db['VoiceExtension'][_0x15a9('0x52')]({'where':{'id':_0x436db1},'transaction':_0x2a45af})['then'](function(_0x10c705){if(_0x10c705){return db[_0x15a9('0x23')][_0x15a9('0x11')]({'where':{'VoiceExtensionId':_0x436db1},'transaction':_0x2a45af})[_0x15a9('0x12')](function(){var _0x964050=_[_0x15a9('0x22')](_0x5a392f,function(_0x4d75fe){_0x4d75fe[_0x15a9('0x53')]=_0x436db1;_0x4d75fe[_0x15a9('0x54')]=!![];return _0x4d75fe;});return _0x10c705[_0x15a9('0x55')](_0x964050);})['then'](function(_0xe536de){return db[_0x15a9('0x23')][_0x15a9('0x56')](_0xe536de,{'transaction':_0x2a45af});});}else{_0x809e5c=0x194;_0x74702d=[];}});})['then'](function(){if(_0x809e5c!==0x194){return db[_0x15a9('0x23')][_0x15a9('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x436db1},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x5a9d6e){_0x74702d=_0x5a9d6e;});}})['catch'](function(_0x24969e){_0x809e5c=0x1f4;logger[_0x15a9('0x58')](_0x24969e['stack']);if(_0x24969e[_0x15a9('0x1f')]){delete _0x24969e[_0x15a9('0x1f')];}_0x74702d=_0x24969e;})[_0x15a9('0x59')](function(){if(_0x74702d===null){_0x235aa1['sendStatus'](_0x809e5c);}else{if(_0x809e5c===0x1f4){_0x235aa1[_0x15a9('0x8')](_0x809e5c)[_0x15a9('0x20')](_0x74702d);}else{_0x235aa1[_0x15a9('0x8')](_0x809e5c)[_0x15a9('0xa')](_0x74702d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dea1729..91cd49f 100644 --- a/server/api/voiceExtension/voiceExtension.events.js +++ b/server/api/voiceExtension/voiceExtension.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93f9=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove'];(function(_0x195583,_0x5d5396){var _0x471930=function(_0xba8fea){while(--_0xba8fea){_0x195583['push'](_0x195583['shift']());}};_0x471930(++_0x5d5396);}(_0x93f9,0xdf));var _0x993f=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x93f9[_0x3ff085];return _0x2b68c3;};'use strict';var EventEmitter=require(_0x993f('0x0'));var VoiceExtension=require(_0x993f('0x1'))['db'][_0x993f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x993f('0x3')](0x0);var events={'afterCreate':_0x993f('0x4'),'afterUpdate':_0x993f('0x5'),'afterDestroy':_0x993f('0x6')};function emitEvent(_0x4aa9a4){return function(_0x29aec2,_0x551891,_0x1f150c){VoiceExtensionEvents[_0x993f('0x7')](_0x4aa9a4+':'+_0x29aec2['id'],_0x29aec2);VoiceExtensionEvents[_0x993f('0x7')](_0x4aa9a4,_0x29aec2);_0x1f150c(null);};}for(var e in events){if(events[_0x993f('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x993f('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x2b2c=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x8b7843,_0x3f8af5){var _0x3c371a=function(_0x568d07){while(--_0x568d07){_0x8b7843['push'](_0x8b7843['shift']());}};_0x3c371a(++_0x3f8af5);}(_0x2b2c,0x8d));var _0xc2b2=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x2b2c[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require(_0xc2b2('0x0'));var VoiceExtension=require(_0xc2b2('0x1'))['db'][_0xc2b2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc2b2('0x3')](0x0);var events={'afterCreate':_0xc2b2('0x4'),'afterUpdate':'update','afterDestroy':_0xc2b2('0x5')};function emitEvent(_0x2dc73e){return function(_0x4f943d,_0x19201f,_0x4a47ae){VoiceExtensionEvents[_0xc2b2('0x6')](_0x2dc73e+':'+_0x4f943d['id'],_0x4f943d);VoiceExtensionEvents[_0xc2b2('0x6')](_0x2dc73e,_0x4f943d);_0x4a47ae(null);};}for(var e in events){if(events[_0xc2b2('0x7')](e)){var event=events[e];VoiceExtension[_0xc2b2('0x8')](e,emitEvent(event));}}module[_0xc2b2('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7ad1327..cfc84fb 100644 --- a/server/api/voiceExtension/voiceExtension.model.js +++ b/server/api/voiceExtension/voiceExtension.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70a1=['GotoIfTime',',${EXTEN},','appType','appdata','priority','last','concat','catch','define','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','NoOp','alias','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','name','phone','param','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','playback','app','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice'];(function(_0x462b3a,_0x52fa71){var _0xbc5daa=function(_0x10dc88){while(--_0x10dc88){_0x462b3a['push'](_0x462b3a['shift']());}};_0xbc5daa(++_0x52fa71);}(_0x70a1,0x154));var _0x170a=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x70a1[_0x507ac5];return _0x12c1bc;};'use strict';var _=require(_0x170a('0x0'));var attributes=require(_0x170a('0x1'));module[_0x170a('0x2')]=function(_0x4b3c6e){var _0x4c0f14=_0x4b3c6e['models'];function _0x278333(_0x31a95f){var _0x1dcca8=0x2;var _0x5ed819=[{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':_0x170a('0x5')+_0x31a95f[_0x170a('0x3')],'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f['type'],'app':_0x31a95f['alias']?_0x170a('0x4'):_0x170a('0x8'),'appdata':_0x31a95f[_0x170a('0x9')]?'CDR(routeAlias)='+_0x31a95f['alias']:_0x170a('0xa'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']}];if(_0x31a95f[_0x170a('0x3')]===_0x170a('0xb')){_0x5ed819['push']({'type':_0x170a('0xb'),'app':_0x170a('0x4'),'appdata':_0x170a('0xc')+_0x31a95f['id'],'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']});}_0x5ed819[_0x170a('0xd')]({'type':_0x31a95f[_0x170a('0x3')],'app':'Set','appdata':_0x170a('0xe'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']},{'type':_0x31a95f[_0x170a('0x3')],'app':_0x170a('0x4'),'appdata':_0x170a('0xf'),'context':_0x31a95f[_0x170a('0x6')],'exten':_0x31a95f[_0x170a('0x7')],'priority':_0x1dcca8++,'VoiceExtensionId':_0x31a95f['id']});return _0x5ed819;}function _0x259daa(_0x48074c){var _0x22ea4e=0x2;var _0x15603d=[{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x11'),'context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x48074c['alias']?_0x170a('0x4'):_0x170a('0x8'),'appdata':_0x48074c[_0x170a('0x9')]?_0x170a('0x12')+_0x48074c[_0x170a('0x9')]:_0x170a('0xa'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x13')+(_0x48074c[_0x170a('0x14')]?_0x170a('0x15')+_0x48074c[_0x170a('0x14')]+'}':_0x170a('0x16')),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0xc')+_0x48074c['id'],'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':'ExecIf','appdata':_0x170a('0x17')+(_0x22ea4e+0x2)+_0x170a('0x18')+(_0x22ea4e+0x1)+')','context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x48074c[_0x170a('0x14')]?_0x170a('0x19')+_0x48074c[_0x170a('0x14')]+'}':_0x170a('0x1a'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48074c['context'],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0xf'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c['exten'],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':_0x170a('0x1b')+_0x48074c['id'],'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']}];if(_0x48074c[_0x170a('0x1c')](_0x170a('0x1d'))&&_0x48074c[_0x170a('0x1d')]!=='none'){_0x15603d[_0x170a('0xd')]({'type':_0x170a('0x10'),'app':'Set','appdata':_0x170a('0x1e'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']},{'type':_0x170a('0x10'),'app':_0x170a('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x48074c[_0x170a('0x1d')]||_0x170a('0x1f'),'context':_0x48074c[_0x170a('0x6')],'exten':_0x48074c[_0x170a('0x7')],'priority':_0x22ea4e++,'VoiceExtensionId':_0x48074c['id']});}return _0x15603d;}function _0xcb33be(_0x7c95c9,_0xe302fb){var _0x4cf6d4=[{'name':_0x170a('0x20'),'param':0x0},{'name':_0x170a('0x21'),'param':0x1},{'name':_0x170a('0x22'),'param':0x2},{'name':_0x170a('0x23'),'param':0x3}];var _0x5a7ef6={};var _0x5c4aed=_0xe302fb[_0x170a('0x24')](',');var _0x209f8e=[];for(var _0x4d436a=0x0;_0x4d436a<_0x4cf6d4[_0x170a('0x25')];_0x4d436a++){switch(_0x4cf6d4[_0x4d436a][_0x170a('0x26')]){case _0x170a('0x20'):_0x5a7ef6[_0x170a('0x20')]=_0x5c4aed[_0x4cf6d4[_0x4d436a]['param']][_0x170a('0x24')]('/')[0x1];_0x5a7ef6[_0x170a('0x27')]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]][_0x170a('0x24')]('/')[0x2];_0x5a7ef6[_0x170a('0x29')]=_0x5a7ef6[_0x170a('0x27')]?_0x5a7ef6[_0x170a('0x27')][_0x170a('0x24')]('$')[0x0]:undefined;_0x5a7ef6[_0x170a('0x27')]=_0x7c95c9[_0x170a('0x14')]?(_0x5a7ef6[_0x170a('0x29')]||'')+'${EXTEN:'+_0x7c95c9['cutdigits']+'}':(_0x5a7ef6[_0x170a('0x29')]||'')+_0x170a('0x16');_0x209f8e[_0x4cf6d4[_0x4d436a]['param']]=[_0x170a('0x2a'),_0x5a7ef6[_0x170a('0x20')],_0x5a7ef6['phone']][_0x170a('0x2b')]('/');break;case _0x170a('0x22'):_0x5a7ef6[_0x170a('0x22')]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]];if(_0x7c95c9['recordingFormat']!=='none'){if(_0x5a7ef6['options'][_0x170a('0x2c')](_0x170a('0x2d'))<0x0){_0x5a7ef6[_0x170a('0x22')]+=_0x170a('0x2d');}}else{_0x5a7ef6[_0x170a('0x22')]=_0x5a7ef6[_0x170a('0x22')][_0x170a('0x2e')](_0x170a('0x2d'),'');}_0x209f8e[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]]=_0x5a7ef6[_0x170a('0x22')];break;default:_0x209f8e[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]]=_0x5c4aed[_0x4cf6d4[_0x4d436a][_0x170a('0x28')]];}}return _0x209f8e['join'](',');}function _0x3fdb33(_0x557dbb,_0x2e8375,_0x33d382){return new Promise(function(_0x52e14e,_0x5e9265){var _0x3aa1c5=[];if(_[_0x170a('0x2f')](_0x2e8375))return _0x52e14e(_0x3aa1c5);_0x4c0f14[_0x170a('0x30')][_0x170a('0x31')]({'attributes':['id',_0x170a('0x32'),_0x170a('0x33')],'raw':!![]})[_0x170a('0x34')](function(_0xcc64f4){for(var _0x451a97=0x0,_0xe96db1=0x0;_0x451a97<_0x2e8375[_0x170a('0x25')];_0x451a97++,_0xe96db1=0x0){var _0x381423=_0x2e8375[_0x451a97];var _0x276a6b=[];var _0x443a45=[];delete _0x381423['id'];if(_0x381423['interval']!==_0x170a('0x35')){_0x381423[_0x170a('0x36')]=[_0x381423['interval']];}else{_0x381423[_0x170a('0x36')]=_0x381423[_0x170a('0x33')]?_[_0x170a('0x37')](_['filter'](_0xcc64f4,{'IntervalId':_0x381423[_0x170a('0x33')]}),_0x170a('0x32')):[];}_0x381423[_0x170a('0x6')]=_0x557dbb['context'];_0x381423[_0x170a('0x7')]=_0x557dbb[_0x170a('0x7')];if(_0x381423[_0x170a('0x3')])_0x381423['type']=_0x381423[_0x170a('0x3')]['toLowerCase']();if(_0x557dbb[_0x170a('0x3')]===_0x170a('0x10')){if(_0x381423['hasOwnProperty'](_0x170a('0x38'))&&_0x381423['tag']&&_0x381423['tag']!=='--'){_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':'Set','appdata':_0x170a('0x3a')+_0x381423[_0x170a('0x38')],'context':_0x557dbb['context'],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}_0x276a6b[_0x170a('0xd')]({'type':_0x381423['type'][_0x170a('0x39')](),'app':_0x170a('0x3b'),'appdata':_0x170a('0x3c')+(_0x381423[_0x170a('0x3d')]?'Set(CALLERID(all)='+_0x381423[_0x170a('0x3d')]+')':_0x170a('0x3e')),'context':_0x557dbb['context'],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}else{if(_0x381423['hasOwnProperty'](_0x170a('0x3f'))){if(['queue',_0x170a('0x40')]['includes'](_0x381423[_0x170a('0x41')][_0x170a('0x39')]())&&_0x381423['appType']!=='custom'){if(_0x381423[_0x170a('0x3f')]){_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':_0x170a('0x3b'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423[_0x170a('0x36')]['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')][_0x170a('0x39')](),'app':'Set','appdata':_0x170a('0x42'),'context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423['intervals']['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}else{_0x276a6b[_0x170a('0xd')]({'type':_0x381423[_0x170a('0x3')]['toLowerCase'](),'app':_0x170a('0x3b'),'appdata':_0x170a('0x43'),'context':_0x557dbb[_0x170a('0x6')],'exten':_0x557dbb['exten'],'priority':_0x381423[_0x170a('0x36')]['length']+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});_0x276a6b['push']({'type':_0x381423[_0x170a('0x3')]['toLowerCase'](),'app':_0x170a('0x4'),'appdata':_0x170a('0x44'),'context':_0x557dbb['context'],'exten':_0x557dbb[_0x170a('0x7')],'priority':_0x381423[_0x170a('0x36')][_0x170a('0x25')]+_0x33d382+_0xe96db1++,'VoiceExtensionId':_0x557dbb['id']});}}}}for(var _0x3a3469=0x0;_0x3a3469<_0x381423[_0x170a('0x36')]['length'];_0x3a3469++){var _0x1988e5=_0x33d382+_0x381423[_0x170a('0x36')][_0x170a('0x25')];var _0x22cfde=_0x3a3469===_0x381423[_0x170a('0x36')][_0x170a('0x25')]-0x1?_0x33d382+_0x276a6b['length']+_0x443a45[_0x170a('0x25')]+0x2:_0x33d382+_0x3a3469+0x1;_0x276a6b[_0x170a('0x45')](_0x3a3469,0x0,{'type':_0x557dbb[_0x170a('0x3')],'app':_0x170a('0x46'),'appdata':_0x381423['intervals'][_0x3a3469]+'?'+_0x557dbb[_0x170a('0x6')]+_0x170a('0x47')+_0x1988e5+':'+_0x557dbb[_0x170a('0x6')]+',${EXTEN},'+_0x22cfde,'exten':_0x557dbb[_0x170a('0x7')],'context':_0x557dbb[_0x170a('0x6')],'priority':_0x33d382+_0x3a3469,'VoiceExtensionId':_0x557dbb['id']});}if(_0x381423[_0x170a('0x48')]==='outboundDial')_0x381423['appdata']=_0xcb33be(_0x557dbb,_0x381423[_0x170a('0x49')]);_0x381423[_0x170a('0x4a')]=_0x276a6b[_0x170a('0x25')]?_[_0x170a('0x4b')](_0x276a6b)['priority']+0x1:_0x33d382;_0x3aa1c5=_[_0x170a('0x4c')](_0x3aa1c5,_0x276a6b,[_0x381423],_0x443a45);_0x33d382=_[_0x170a('0x4b')](_0x3aa1c5)[_0x170a('0x4a')]+0x1;}return _0x52e14e(_0x3aa1c5);})[_0x170a('0x4d')](function(_0x407df0){_0x5e9265(_0x407df0);});});}return _0x4b3c6e[_0x170a('0x4e')]('VoiceExtension',attributes,{'tableName':_0x170a('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4f6864){var _0x3bd36d=this[_0x170a('0x50')]({'plain':!![]});var _0x1c7607=_0x3bd36d[_0x170a('0x3')]===_0x170a('0x10')?_0x259daa(_0x3bd36d):_0x278333(_0x3bd36d);return _0x3fdb33(_0x3bd36d,_0x4f6864,_['last'](_0x1c7607)['priority']+0x1)[_0x170a('0x34')](function(_0x97d182){var _0x277475=_[_0x170a('0x4c')](_0x1c7607,_0x97d182);_0x277475[_0x170a('0xd')]({'type':_0x3bd36d[_0x170a('0x3')],'app':_0x170a('0x51'),'exten':_0x3bd36d[_0x170a('0x7')],'context':_0x3bd36d[_0x170a('0x6')],'priority':_[_0x170a('0x4b')](_0x277475)[_0x170a('0x4a')]+0x1,'VoiceExtensionId':_0x3bd36d['id']});return _0x277475;});}}});}; \ No newline at end of file +var _0x87d3=['${EXTEN:','${EXTEN}','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','split','length','param','phone','prefix','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','intervals','map','filter','IntervalId','hasOwnProperty','toLowerCase','CDR(tag)=','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','appdata','priority','last','catch','define','voice_extensions','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','cutdigits'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87d3,0x86));var _0x387d=function(_0x4a5046,_0x5b1d8e){_0x4a5046=_0x4a5046-0x0;var _0x3c3b34=_0x87d3[_0x4a5046];return _0x3c3b34;};'use strict';var _=require(_0x387d('0x0'));var attributes=require(_0x387d('0x1'));module[_0x387d('0x2')]=function(_0xe8799a){var _0x928149=_0xe8799a[_0x387d('0x3')];function _0x4c308f(_0x385feb){var _0x54c387=0x2;var _0xde245d=[{'type':_0x385feb[_0x387d('0x4')],'app':_0x387d('0x5'),'appdata':'CDR(type)='+_0x385feb[_0x387d('0x4')],'context':_0x385feb[_0x387d('0x6')],'exten':_0x385feb[_0x387d('0x7')],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']},{'type':_0x385feb[_0x387d('0x4')],'app':_0x385feb[_0x387d('0x8')]?_0x387d('0x5'):_0x387d('0x9'),'appdata':_0x385feb[_0x387d('0x8')]?_0x387d('0xa')+_0x385feb[_0x387d('0x8')]:_0x387d('0xb'),'context':_0x385feb['context'],'exten':_0x385feb[_0x387d('0x7')],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']}];if(_0x385feb[_0x387d('0x4')]===_0x387d('0xc')){_0xde245d[_0x387d('0xd')]({'type':_0x387d('0xc'),'app':_0x387d('0x5'),'appdata':_0x387d('0xe')+_0x385feb['id'],'context':_0x385feb[_0x387d('0x6')],'exten':_0x385feb[_0x387d('0x7')],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']});}_0xde245d[_0x387d('0xd')]({'type':_0x385feb[_0x387d('0x4')],'app':_0x387d('0x5'),'appdata':_0x387d('0xf'),'context':_0x385feb[_0x387d('0x6')],'exten':_0x385feb[_0x387d('0x7')],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']},{'type':_0x385feb['type'],'app':'Set','appdata':_0x387d('0x10'),'context':_0x385feb['context'],'exten':_0x385feb['exten'],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']},{'type':_0x385feb['type'],'app':_0x387d('0x5'),'appdata':_0x387d('0x11'),'context':_0x385feb[_0x387d('0x6')],'exten':_0x385feb[_0x387d('0x7')],'priority':_0x54c387++,'VoiceExtensionId':_0x385feb['id']});return _0xde245d;}function _0x3cd7ce(_0x396328){var _0x3bbf9f=0x2;var _0x1caada=[{'type':'outbound','app':_0x387d('0x5'),'appdata':_0x387d('0x12'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328['exten'],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':_0x396328['alias']?_0x387d('0x5'):'NoOp','appdata':_0x396328[_0x387d('0x8')]?_0x387d('0xa')+_0x396328[_0x387d('0x8')]:_0x387d('0xb'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328['exten'],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':'outbound','app':_0x387d('0x5'),'appdata':_0x387d('0x14')+(_0x396328[_0x387d('0x15')]?_0x387d('0x16')+_0x396328[_0x387d('0x15')]+'}':_0x387d('0x17')),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':'Set','appdata':'CDR(routeid)='+_0x396328['id'],'context':_0x396328['context'],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':'outbound','app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3bbf9f+0x2)+'):Goto('+(_0x3bbf9f+0x1)+')','context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':_0x387d('0x5'),'appdata':_0x396328[_0x387d('0x15')]?_0x387d('0x18')+_0x396328[_0x387d('0x15')]+'}':_0x387d('0x19'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':_0x387d('0x5'),'appdata':_0x387d('0xf'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':'Set','appdata':_0x387d('0x10'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':'outbound','app':_0x387d('0x5'),'appdata':_0x387d('0x11'),'context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':'Set','appdata':_0x387d('0x1a')+_0x396328['id'],'context':_0x396328[_0x387d('0x6')],'exten':_0x396328['exten'],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']}];if(_0x396328['hasOwnProperty'](_0x387d('0x1b'))&&_0x396328[_0x387d('0x1b')]!==_0x387d('0x1c')){_0x1caada[_0x387d('0xd')]({'type':_0x387d('0x13'),'app':_0x387d('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x396328[_0x387d('0x6')],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']},{'type':_0x387d('0x13'),'app':_0x387d('0x5'),'appdata':_0x387d('0x1d')+_0x396328[_0x387d('0x1b')]||_0x387d('0x1e'),'context':_0x396328['context'],'exten':_0x396328[_0x387d('0x7')],'priority':_0x3bbf9f++,'VoiceExtensionId':_0x396328['id']});}return _0x1caada;}function _0x29fe6b(_0x2d6350,_0x1a4762){var _0x398494=[{'name':_0x387d('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x512ab9={};var _0x19668c=_0x1a4762[_0x387d('0x20')](',');var _0x47d3ef=[];for(var _0x9948d5=0x0;_0x9948d5<_0x398494[_0x387d('0x21')];_0x9948d5++){switch(_0x398494[_0x9948d5]['name']){case _0x387d('0x1f'):_0x512ab9[_0x387d('0x1f')]=_0x19668c[_0x398494[_0x9948d5][_0x387d('0x22')]]['split']('/')[0x1];_0x512ab9[_0x387d('0x23')]=_0x19668c[_0x398494[_0x9948d5]['param']][_0x387d('0x20')]('/')[0x2];_0x512ab9[_0x387d('0x24')]=_0x512ab9[_0x387d('0x23')]?_0x512ab9[_0x387d('0x23')]['split']('$')[0x0]:undefined;_0x512ab9[_0x387d('0x23')]=_0x2d6350[_0x387d('0x15')]?(_0x512ab9['prefix']||'')+_0x387d('0x16')+_0x2d6350['cutdigits']+'}':(_0x512ab9[_0x387d('0x24')]||'')+_0x387d('0x17');_0x47d3ef[_0x398494[_0x9948d5][_0x387d('0x22')]]=['SIP',_0x512ab9[_0x387d('0x1f')],_0x512ab9[_0x387d('0x23')]][_0x387d('0x25')]('/');break;case'options':_0x512ab9[_0x387d('0x26')]=_0x19668c[_0x398494[_0x9948d5]['param']];if(_0x2d6350['recordingFormat']!==_0x387d('0x1c')){if(_0x512ab9[_0x387d('0x26')][_0x387d('0x27')](_0x387d('0x28'))<0x0){_0x512ab9['options']+='U(xcally-mixmonitor-context)';}}else{_0x512ab9[_0x387d('0x26')]=_0x512ab9[_0x387d('0x26')][_0x387d('0x29')](_0x387d('0x28'),'');}_0x47d3ef[_0x398494[_0x9948d5][_0x387d('0x22')]]=_0x512ab9[_0x387d('0x26')];break;default:_0x47d3ef[_0x398494[_0x9948d5]['param']]=_0x19668c[_0x398494[_0x9948d5]['param']];}}return _0x47d3ef[_0x387d('0x25')](',');}function _0x28feb0(_0x246415,_0x4deb33,_0x1cc685){return new Promise(function(_0x5b89dd,_0x286ffc){var _0xa340a4=[];if(_[_0x387d('0x2a')](_0x4deb33))return _0x5b89dd(_0xa340a4);_0x928149['Interval'][_0x387d('0x2b')]({'attributes':['id',_0x387d('0x2c'),'IntervalId'],'raw':!![]})[_0x387d('0x2d')](function(_0x28ef45){for(var _0x4d04ed=0x0,_0x6d7283=0x0;_0x4d04ed<_0x4deb33[_0x387d('0x21')];_0x4d04ed++,_0x6d7283=0x0){var _0x8bb6b0=_0x4deb33[_0x4d04ed];var _0x42ee74=[];var _0x4cf2e3=[];delete _0x8bb6b0['id'];if(_0x8bb6b0[_0x387d('0x2c')]!=='*,*,*,*'){_0x8bb6b0[_0x387d('0x2e')]=[_0x8bb6b0[_0x387d('0x2c')]];}else{_0x8bb6b0[_0x387d('0x2e')]=_0x8bb6b0['IntervalId']?_[_0x387d('0x2f')](_[_0x387d('0x30')](_0x28ef45,{'IntervalId':_0x8bb6b0[_0x387d('0x31')]}),_0x387d('0x2c')):[];}_0x8bb6b0[_0x387d('0x6')]=_0x246415[_0x387d('0x6')];_0x8bb6b0[_0x387d('0x7')]=_0x246415[_0x387d('0x7')];if(_0x8bb6b0[_0x387d('0x4')])_0x8bb6b0[_0x387d('0x4')]=_0x8bb6b0[_0x387d('0x4')]['toLowerCase']();if(_0x246415[_0x387d('0x4')]===_0x387d('0x13')){if(_0x8bb6b0[_0x387d('0x32')]('tag')&&_0x8bb6b0['tag']&&_0x8bb6b0['tag']!=='--'){_0x42ee74[_0x387d('0xd')]({'type':_0x8bb6b0[_0x387d('0x4')][_0x387d('0x33')](),'app':_0x387d('0x5'),'appdata':_0x387d('0x34')+_0x8bb6b0[_0x387d('0x35')],'context':_0x246415[_0x387d('0x6')],'exten':_0x246415[_0x387d('0x7')],'priority':_0x8bb6b0[_0x387d('0x2e')][_0x387d('0x21')]+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});}_0x42ee74[_0x387d('0xd')]({'type':_0x8bb6b0[_0x387d('0x4')][_0x387d('0x33')](),'app':_0x387d('0x36'),'appdata':_0x387d('0x37')+(_0x8bb6b0[_0x387d('0x38')]?_0x387d('0x39')+_0x8bb6b0[_0x387d('0x38')]+')':_0x387d('0x3a')),'context':_0x246415['context'],'exten':_0x246415[_0x387d('0x7')],'priority':_0x8bb6b0[_0x387d('0x2e')]['length']+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});}else{if(_0x8bb6b0['hasOwnProperty'](_0x387d('0x3b'))){if([_0x387d('0x3c'),_0x387d('0x3d')]['includes'](_0x8bb6b0[_0x387d('0x3e')][_0x387d('0x33')]())&&_0x8bb6b0[_0x387d('0x3f')]!==_0x387d('0x40')){if(_0x8bb6b0[_0x387d('0x3b')]){_0x42ee74[_0x387d('0xd')]({'type':_0x8bb6b0[_0x387d('0x4')][_0x387d('0x33')](),'app':_0x387d('0x36'),'appdata':_0x387d('0x41'),'context':_0x246415[_0x387d('0x6')],'exten':_0x246415['exten'],'priority':_0x8bb6b0[_0x387d('0x2e')][_0x387d('0x21')]+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});_0x42ee74[_0x387d('0xd')]({'type':_0x8bb6b0[_0x387d('0x4')][_0x387d('0x33')](),'app':_0x387d('0x5'),'appdata':_0x387d('0x42'),'context':_0x246415[_0x387d('0x6')],'exten':_0x246415[_0x387d('0x7')],'priority':_0x8bb6b0[_0x387d('0x2e')][_0x387d('0x21')]+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});}else{_0x42ee74['push']({'type':_0x8bb6b0[_0x387d('0x4')][_0x387d('0x33')](),'app':'ExecIf','appdata':_0x387d('0x43'),'context':_0x246415[_0x387d('0x6')],'exten':_0x246415[_0x387d('0x7')],'priority':_0x8bb6b0[_0x387d('0x2e')][_0x387d('0x21')]+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});_0x42ee74['push']({'type':_0x8bb6b0[_0x387d('0x4')]['toLowerCase'](),'app':_0x387d('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x246415[_0x387d('0x6')],'exten':_0x246415['exten'],'priority':_0x8bb6b0['intervals'][_0x387d('0x21')]+_0x1cc685+_0x6d7283++,'VoiceExtensionId':_0x246415['id']});}}}}for(var _0x533a3a=0x0;_0x533a3a<_0x8bb6b0['intervals'][_0x387d('0x21')];_0x533a3a++){var _0x411dd7=_0x1cc685+_0x8bb6b0[_0x387d('0x2e')][_0x387d('0x21')];var _0x3d5221=_0x533a3a===_0x8bb6b0['intervals']['length']-0x1?_0x1cc685+_0x42ee74[_0x387d('0x21')]+_0x4cf2e3[_0x387d('0x21')]+0x2:_0x1cc685+_0x533a3a+0x1;_0x42ee74['splice'](_0x533a3a,0x0,{'type':_0x246415[_0x387d('0x4')],'app':_0x387d('0x44'),'appdata':_0x8bb6b0['intervals'][_0x533a3a]+'?'+_0x246415['context']+_0x387d('0x45')+_0x411dd7+':'+_0x246415[_0x387d('0x6')]+',${EXTEN},'+_0x3d5221,'exten':_0x246415['exten'],'context':_0x246415['context'],'priority':_0x1cc685+_0x533a3a,'VoiceExtensionId':_0x246415['id']});}if(_0x8bb6b0['appType']==='outboundDial')_0x8bb6b0[_0x387d('0x46')]=_0x29fe6b(_0x246415,_0x8bb6b0[_0x387d('0x46')]);_0x8bb6b0[_0x387d('0x47')]=_0x42ee74[_0x387d('0x21')]?_['last'](_0x42ee74)[_0x387d('0x47')]+0x1:_0x1cc685;_0xa340a4=_['concat'](_0xa340a4,_0x42ee74,[_0x8bb6b0],_0x4cf2e3);_0x1cc685=_[_0x387d('0x48')](_0xa340a4)[_0x387d('0x47')]+0x1;}return _0x5b89dd(_0xa340a4);})[_0x387d('0x49')](function(_0x5f2589){_0x286ffc(_0x5f2589);});});}return _0xe8799a[_0x387d('0x4a')]('VoiceExtension',attributes,{'tableName':_0x387d('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44a402){var _0x2713fc=this['get']({'plain':!![]});var _0xd59bf2=_0x2713fc[_0x387d('0x4')]===_0x387d('0x13')?_0x3cd7ce(_0x2713fc):_0x4c308f(_0x2713fc);return _0x28feb0(_0x2713fc,_0x44a402,_['last'](_0xd59bf2)[_0x387d('0x47')]+0x1)[_0x387d('0x2d')](function(_0x2f8794){var _0x4b5bc0=_[_0x387d('0x4c')](_0xd59bf2,_0x2f8794);_0x4b5bc0[_0x387d('0xd')]({'type':_0x2713fc[_0x387d('0x4')],'app':_0x387d('0x4d'),'exten':_0x2713fc['exten'],'context':_0x2713fc[_0x387d('0x6')],'priority':_['last'](_0x4b5bc0)['priority']+0x1,'VoiceExtensionId':_0x2713fc['id']});return _0x4b5bc0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3d27ca7..7f1e710 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9ab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','then','lodash','util','moment'];(function(_0x4de5bd,_0x3b51b3){var _0x27a717=function(_0x213510){while(--_0x213510){_0x4de5bd['push'](_0x4de5bd['shift']());}};_0x27a717(++_0x3b51b3);}(_0xc9ab,0x125));var _0xbc9a=function(_0x4c3852,_0x16821a){_0x4c3852=_0x4c3852-0x0;var _0x137bd7=_0xc9ab[_0x4c3852];return _0x137bd7;};'use strict';var _=require(_0xbc9a('0x0'));var util=require(_0xbc9a('0x1'));var moment=require(_0xbc9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc9a('0x3'))['db'];var utils=require(_0xbc9a('0x4'));var logger=require(_0xbc9a('0x5'))(_0xbc9a('0x6'));var config=require(_0xbc9a('0x7'));var jayson=require(_0xbc9a('0x8'));var client=jayson[_0xbc9a('0x9')][_0xbc9a('0xa')]({'port':0x232a});config[_0xbc9a('0xb')]=_[_0xbc9a('0xc')](config[_0xbc9a('0xb')],{'host':_0xbc9a('0xd'),'port':0x18eb});var socket=require(_0xbc9a('0xe'))(new Redis(config[_0xbc9a('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x5919c4,_0x2d927f,_0x58f385){return new BPromise(function(_0x3ba3bc,_0x389904){return client['request'](_0x5919c4,_0x58f385)['then'](function(_0x565aa4){logger[_0xbc9a('0xf')](_0xbc9a('0x10'),_0x2d927f,'request\x20sent');logger[_0xbc9a('0x11')](_0xbc9a('0x12'),_0x2d927f,_0xbc9a('0x13'),JSON[_0xbc9a('0x14')](_0x565aa4));if(_0x565aa4[_0xbc9a('0x15')]){if(_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x16')]===0x1f4){logger['error'](_0xbc9a('0x10'),_0x2d927f,_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);return _0x389904(_0x565aa4['error']['message']);}logger[_0xbc9a('0x15')](_0xbc9a('0x10'),_0x2d927f,_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);return _0x3ba3bc(_0x565aa4[_0xbc9a('0x15')][_0xbc9a('0x17')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x2d927f,_0xbc9a('0x13'));_0x3ba3bc(_0x565aa4[_0xbc9a('0x18')]['message']);}})[_0xbc9a('0x19')](function(_0x24d578){logger[_0xbc9a('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x2d927f,_0x24d578);_0x389904(_0x24d578);});});}exports[_0xbc9a('0x1a')]=function(_0x2969ef){var _0x2aeb35=this;return new Promise(function(_0x24032b,_0x44cde0){return db[_0xbc9a('0x1b')][_0xbc9a('0x1c')]({'raw':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x1e')]===undefined?!![]:![]:!![],'where':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef['options']['where']||null:null,'attributes':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x1f')]||null:null,'limit':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x20')]||null:null,'include':_0x2969ef[_0xbc9a('0x1d')]?_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x2969ef[_0xbc9a('0x1d')][_0xbc9a('0x21')],function(_0x5dd6b2){return{'model':db[_0x5dd6b2[_0xbc9a('0x23')]],'as':_0x5dd6b2['as'],'attributes':_0x5dd6b2[_0xbc9a('0x1f')],'include':_0x5dd6b2[_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x5dd6b2[_0xbc9a('0x21')],function(_0x379256){return{'model':db[_0x379256[_0xbc9a('0x23')]],'as':_0x379256['as'],'attributes':_0x379256['attributes'],'include':_0x379256[_0xbc9a('0x21')]?_[_0xbc9a('0x22')](_0x379256[_0xbc9a('0x21')],function(_0x47b196){return{'model':db[_0x47b196[_0xbc9a('0x23')]],'as':_0x47b196['as'],'attributes':_0x47b196[_0xbc9a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc9a('0x24')](function(_0x2fdf64){logger[_0xbc9a('0xf')](_0xbc9a('0x1a'),_0x2969ef);logger[_0xbc9a('0x11')](_0xbc9a('0x1a'),_0x2969ef,JSON[_0xbc9a('0x14')](_0x2fdf64));_0x24032b(_0x2fdf64);})['catch'](function(_0x2d3231){logger[_0xbc9a('0x15')]('GetVoiceExtension',_0x2d3231['message'],_0x2969ef);_0x44cde0(_0x2aeb35[_0xbc9a('0x15')](0x1f4,_0x2d3231[_0xbc9a('0x17')]));});});}; \ No newline at end of file +var _0xafc4=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','randomstring'];(function(_0x931afb,_0x4aa851){var _0x511ae5=function(_0x4cb248){while(--_0x4cb248){_0x931afb['push'](_0x931afb['shift']());}};_0x511ae5(++_0x4aa851);}(_0xafc4,0x69));var _0x4afc=function(_0x332812,_0x287e07){_0x332812=_0x332812-0x0;var _0xda33f1=_0xafc4[_0x332812];return _0xda33f1;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});config[_0x4afc('0x9')]=_[_0x4afc('0xa')](config[_0x4afc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4afc('0xb'))(new Redis(config[_0x4afc('0x9')]));require(_0x4afc('0xc'))[_0x4afc('0xd')](socket);function respondWithRpcPromise(_0x1b8981,_0x458fde,_0x5542ec){return new BPromise(function(_0x5c523b,_0x7f127f){return client['request'](_0x1b8981,_0x5542ec)[_0x4afc('0xe')](function(_0x225793){logger['info'](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));logger[_0x4afc('0x11')](_0x4afc('0x12'),_0x458fde,_0x4afc('0x10'),JSON[_0x4afc('0x13')](_0x225793));if(_0x225793[_0x4afc('0x14')]){if(_0x225793[_0x4afc('0x14')]['code']===0x1f4){logger[_0x4afc('0x14')](_0x4afc('0xf'),_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x7f127f(_0x225793['error']['message']);}logger[_0x4afc('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x458fde,_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);return _0x5c523b(_0x225793[_0x4afc('0x14')][_0x4afc('0x15')]);}else{logger[_0x4afc('0x16')](_0x4afc('0xf'),_0x458fde,_0x4afc('0x10'));_0x5c523b(_0x225793[_0x4afc('0x17')][_0x4afc('0x15')]);}})[_0x4afc('0x18')](function(_0x178229){logger['error'](_0x4afc('0xf'),_0x458fde,_0x178229);_0x7f127f(_0x178229);});});}exports[_0x4afc('0x19')]=function(_0x32865e){var _0x14558a=this;return new Promise(function(_0x557a7e,_0x3bddc0){return db[_0x4afc('0x1a')][_0x4afc('0x1b')]({'raw':_0x32865e[_0x4afc('0x1c')]?_0x32865e[_0x4afc('0x1c')][_0x4afc('0x1d')]===undefined?!![]:![]:!![],'where':_0x32865e[_0x4afc('0x1c')]?_0x32865e['options'][_0x4afc('0x1e')]||null:null,'attributes':_0x32865e[_0x4afc('0x1c')]?_0x32865e['options'][_0x4afc('0x1f')]||null:null,'limit':_0x32865e['options']?_0x32865e[_0x4afc('0x1c')][_0x4afc('0x20')]||null:null,'include':_0x32865e[_0x4afc('0x1c')]?_0x32865e[_0x4afc('0x1c')][_0x4afc('0x21')]?_[_0x4afc('0x22')](_0x32865e[_0x4afc('0x1c')][_0x4afc('0x21')],function(_0x2bb837){return{'model':db[_0x2bb837[_0x4afc('0x23')]],'as':_0x2bb837['as'],'attributes':_0x2bb837[_0x4afc('0x1f')],'include':_0x2bb837[_0x4afc('0x21')]?_[_0x4afc('0x22')](_0x2bb837['include'],function(_0xc3952e){return{'model':db[_0xc3952e[_0x4afc('0x23')]],'as':_0xc3952e['as'],'attributes':_0xc3952e[_0x4afc('0x1f')],'include':_0xc3952e['include']?_['map'](_0xc3952e['include'],function(_0x426e9d){return{'model':db[_0x426e9d[_0x4afc('0x23')]],'as':_0x426e9d['as'],'attributes':_0x426e9d['attributes']};}):[]};}):[]};}):[]:[]})[_0x4afc('0xe')](function(_0x628e42){logger['info']('GetVoiceExtension',_0x32865e);logger['debug'](_0x4afc('0x19'),_0x32865e,JSON[_0x4afc('0x13')](_0x628e42));_0x557a7e(_0x628e42);})[_0x4afc('0x18')](function(_0x46357b){logger[_0x4afc('0x14')](_0x4afc('0x19'),_0x46357b['message'],_0x32865e);_0x3bddc0(_0x14558a[_0x4afc('0x14')](0x1f4,_0x46357b[_0x4afc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index fa6fd01..99ddb4c 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x1607f2,_0x154ae7){var _0x3a5166=function(_0xead263){while(--_0xead263){_0x1607f2['push'](_0x1607f2['shift']());}};_0x3a5166(++_0x154ae7);}(_0x326f,0xd1));var _0xf326=function(_0x5ae5c8,_0x1104b1){_0x5ae5c8=_0x5ae5c8-0x0;var _0x2ea3fe=_0x326f[_0x5ae5c8];return _0x2ea3fe;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x55a707,_0x1537b1){var _0xda6572=function(_0x532181){while(--_0x532181){_0x55a707['push'](_0x55a707['shift']());}};_0xda6572(++_0x1537b1);}(_0x5fab,0x177));var _0xb5fa=function(_0x49cee9,_0x28e9de){_0x49cee9=_0x49cee9-0x0;var _0x5c896d=_0x5fab[_0x49cee9];return _0x5c896d;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1276dd2..fb97a79 100644 --- a/server/api/voiceMail/index.js +++ b/server/api/voiceMail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['/:id','show','get','/:id/messages','getMessages','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','isAuthenticated','index'];(function(_0x60b921,_0x13c29d){var _0x57d238=function(_0x588570){while(--_0x588570){_0x60b921['push'](_0x60b921['shift']());}};_0x57d238(++_0x13c29d);}(_0x1623,0xab));var _0x3162=function(_0x336787,_0x577ce1){_0x336787=_0x336787-0x0;var _0x1474bb=_0x1623[_0x336787];return _0x1474bb;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0xf')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);module[_0x3162('0x13')]=router; \ No newline at end of file +var _0xba34=['getMessages','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x319fc1,_0x29179b){var _0xb768af=function(_0x3509ac){while(--_0x3509ac){_0x319fc1['push'](_0x319fc1['shift']());}};_0xb768af(++_0x29179b);}(_0xba34,0x119));var _0x4ba3=function(_0x3028ab,_0x108b98){_0x3028ab=_0x3028ab-0x0;var _0x24142b=_0xba34[_0x3028ab];return _0x24142b;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x13')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 15d9148..6cbdcba 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x75ed=['setDataValue','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','mailbox','sequelize','exports','from-voicemail','contest_mailbox','STRING'];(function(_0x1230e6,_0x1031ce){var _0x4e7cc5=function(_0x2041ed){while(--_0x2041ed){_0x1230e6['push'](_0x1230e6['shift']());}};_0x4e7cc5(++_0x1031ce);}(_0x75ed,0x15b));var _0xd75e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x75ed[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xd75e('0x0'));module[_0xd75e('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xd75e('0x2'),'unique':_0xd75e('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xd75e('0x4')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd75e('0x4')],'validate':{'isEmail':!![]},'set':function(_0x1c51e4){this[_0xd75e('0x5')]('email',typeof _0x1c51e4===_0xd75e('0x6')&&_0x1c51e4[_0xd75e('0x7')]()?_0x1c51e4[_0xd75e('0x7')]():null);}},'pager':{'type':Sequelize[_0xd75e('0x4')]},'tz':{'type':Sequelize[_0xd75e('0x4')],'defaultValue':_0xd75e('0x8')},'attach':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd75e('0x4')]},'callback':{'type':Sequelize[_0xd75e('0x4')]},'review':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd75e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd75e('0xa')](_0xd75e('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xd75e('0x9'),'no'),'defaultValue':_0xd75e('0x9'),'allowNull':![]},'stamp':{'type':_0xd75e('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xd75e('0x4')]},'maxsecs':{'type':Sequelize[_0xd75e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd75e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd75e('0xd')]('fullname')+_0xd75e('0xe')+this[_0xd75e('0xd')](_0xd75e('0xf'));}}}; \ No newline at end of file +var _0x6a12=['email','string','trim','yes','ENUM','TINYINT(4)','INTEGER','VIRTUAL','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x6a12,0x172));var _0x26a1=function(_0x2a23a5,_0x5299a4){_0x2a23a5=_0x2a23a5-0x0;var _0x41fdab=_0x6a12[_0x2a23a5];return _0x41fdab;};'use strict';var Sequelize=require(_0x26a1('0x0'));module[_0x26a1('0x1')]={'customer_id':{'type':Sequelize[_0x26a1('0x2')]},'context':{'type':Sequelize[_0x26a1('0x2')],'defaultValue':_0x26a1('0x3'),'unique':_0x26a1('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x26a1('0x4')},'password':{'type':Sequelize[_0x26a1('0x2')]},'fullname':{'type':Sequelize[_0x26a1('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2bea96){this['setDataValue'](_0x26a1('0x5'),typeof _0x2bea96===_0x26a1('0x6')&&_0x2bea96[_0x26a1('0x7')]()?_0x2bea96[_0x26a1('0x7')]():null);}},'pager':{'type':Sequelize[_0x26a1('0x2')]},'tz':{'type':Sequelize[_0x26a1('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x26a1('0x8'),'no'),'defaultValue':_0x26a1('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':_0x26a1('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x26a1('0x2')]},'callback':{'type':Sequelize[_0x26a1('0x2')]},'review':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x26a1('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x26a1('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x26a1('0x9')](_0x26a1('0x8'),'no'),'defaultValue':_0x26a1('0x8'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x26a1('0x2')]},'maxsecs':{'type':Sequelize[_0x26a1('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x26a1('0xc')],'get':function(){return this['getDataValue']('fullname')+_0x26a1('0xd')+this['getDataValue'](_0x26a1('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 02d8805..c2493ff 100644 --- a/server/api/voiceMail/voiceMail.controller.js +++ b/server/api/voiceMail/voiceMail.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../config/license/hardware','../../config/logger','api','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','get','Voicemails','UserProfileResource','destroy','end','error','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','findAndCountAll','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5938a8,_0x47cd96){var _0x4f5ca1=function(_0x3701d6){while(--_0x3701d6){_0x5938a8['push'](_0x5938a8['shift']());}};_0x4f5ca1(++_0x47cd96);}(_0x757a,0xde));var _0xa757=function(_0x7c4d2b,_0x233791){_0x7c4d2b=_0x7c4d2b-0x0;var _0x3804ad=_0x757a[_0x7c4d2b];return _0x3804ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa757('0x0'));var zipdir=require(_0xa757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa757('0x2'));var Mustache=require(_0xa757('0x3'));var util=require(_0xa757('0x4'));var path=require(_0xa757('0x5'));var sox=require(_0xa757('0x6'));var csv=require(_0xa757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa757('0x8'));var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0x7'));var querystring=require(_0xa757('0xd'));var Papa=require('papaparse');var Redis=require(_0xa757('0xe'));var authService=require(_0xa757('0xf'));var qs=require(_0xa757('0x10'));var as=require(_0xa757('0x11'));var hardwareService=require(_0xa757('0x12'));var logger=require(_0xa757('0x13'))(_0xa757('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db68e,_0x421040){_0x421040=_0x421040||0xcc;return function(_0x544b45){if(_0x544b45){return _0x4db68e['sendStatus'](_0x421040);}return _0x4db68e[_0xa757('0x15')](_0x421040)['end']();};}function respondWithResult(_0x481508,_0x32112b){_0x32112b=_0x32112b||0xc8;return function(_0x1b670e){if(_0x1b670e){return _0x481508[_0xa757('0x15')](_0x32112b)[_0xa757('0x16')](_0x1b670e);}};}function respondWithFilteredResult(_0x86abd,_0x31cfd2){return function(_0xf12b68){if(_0xf12b68){var _0x2f7947=typeof _0x31cfd2[_0xa757('0x17')]===_0xa757('0x18')&&typeof _0x31cfd2['limit']===_0xa757('0x18');var _0x44eab8=_0xf12b68[_0xa757('0x19')];var _0x4d9f58=_0x2f7947?0x0:_0x31cfd2['offset'];var _0x151c04=_0x2f7947?_0xf12b68[_0xa757('0x19')]:_0x31cfd2[_0xa757('0x17')]+_0x31cfd2[_0xa757('0x1a')];var _0x27f4ba;if(_0x151c04>=_0x44eab8){_0x151c04=_0x44eab8;_0x27f4ba=0xc8;}else{_0x27f4ba=0xce;}_0x86abd[_0xa757('0x15')](_0x27f4ba);return _0x86abd['set'](_0xa757('0x1b'),_0x4d9f58+'-'+_0x151c04+'/'+_0x44eab8)['json'](_0xf12b68);}return null;};}function patchUpdates(_0x32c2a1){return function(_0x167640){try{jsonpatch[_0xa757('0x1c')](_0x167640,_0x32c2a1,!![]);}catch(_0x2c9ec6){return BPromise['reject'](_0x2c9ec6);}return _0x167640['save']();};}function saveUpdates(_0x40ec48,_0x2159cf){return function(_0x2ba923){if(_0x2ba923){return _0x2ba923[_0xa757('0x1d')](_0x40ec48)[_0xa757('0x1e')](function(_0x40562f){return _0x40562f;});}return null;};}function removeEntity(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(_0x2bf276){return _0x2bf276['destroy']()[_0xa757('0x1e')](function(){var _0x59e9d4=_0x2bf276[_0xa757('0x1f')]({'plain':!![]});var _0x47903b=_0xa757('0x20');return db[_0xa757('0x21')][_0xa757('0x22')]({'where':{'type':_0x47903b,'resourceId':_0x59e9d4['id']}})['then'](function(){return _0x2bf276;});})[_0xa757('0x1e')](function(){_0x2ca10d[_0xa757('0x15')](0xcc)[_0xa757('0x23')]();});}};}function handleEntityNotFound(_0x3bf7f3,_0x5b4779){return function(_0x449a7d){if(!_0x449a7d){_0x3bf7f3['sendStatus'](0x194);}return _0x449a7d;};}function handleError(_0x5a5664,_0x54b75e){_0x54b75e=_0x54b75e||0x1f4;return function(_0x4f8de2){logger[_0xa757('0x24')](_0x4f8de2['stack']);if(_0x4f8de2[_0xa757('0x25')]){delete _0x4f8de2[_0xa757('0x25')];}_0x5a5664['status'](_0x54b75e)[_0xa757('0x26')](_0x4f8de2);};}exports['index']=function(_0x2c4823,_0xa6d0f6){var _0x5307c3={},_0x235e54={},_0x5ade7b={'count':0x0,'rows':[]};var _0x3a4a66=_[_0xa757('0x27')](db[_0xa757('0x28')][_0xa757('0x29')],function(_0xcc87c0){return{'name':_0xcc87c0[_0xa757('0x2a')],'type':_0xcc87c0[_0xa757('0x2b')][_0xa757('0x2c')]};});_0x235e54[_0xa757('0x2d')]=_[_0xa757('0x27')](_0x3a4a66,_0xa757('0x25'));_0x235e54[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x2c4823[_0xa757('0x2e')]);_0x235e54[_0xa757('0x30')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],_0x235e54[_0xa757('0x2e')]);_0x5307c3[_0xa757('0x32')]=_[_0xa757('0x31')](_0x235e54[_0xa757('0x2d')],qs[_0xa757('0x33')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x33')]));_0x5307c3['attributes']=_0x5307c3[_0xa757('0x32')][_0xa757('0x34')]?_0x5307c3[_0xa757('0x32')]:_0x235e54[_0xa757('0x2d')];if(!_0x2c4823[_0xa757('0x2e')]['hasOwnProperty'](_0xa757('0x35'))){_0x5307c3[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x1a')]);_0x5307c3[_0xa757('0x17')]=qs['offset'](_0x2c4823[_0xa757('0x2e')][_0xa757('0x17')]);}_0x5307c3[_0xa757('0x36')]=qs[_0xa757('0x37')](_0x2c4823[_0xa757('0x2e')][_0xa757('0x37')]);_0x5307c3[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x2c4823['query'],_0x235e54[_0xa757('0x30')]),_0x3a4a66);if(_0x2c4823[_0xa757('0x2e')][_0xa757('0x3a')]){_0x5307c3[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x5307c3[_0xa757('0x38')],{'$or':_['map'](_0x3a4a66,function(_0x10d3fd){if(_0x10d3fd[_0xa757('0x2b')]!=='VIRTUAL'){var _0x5eae0b={};_0x5eae0b[_0x10d3fd[_0xa757('0x25')]]={'$like':'%'+_0x2c4823[_0xa757('0x2e')]['filter']+'%'};return _0x5eae0b;}})});}_0x5307c3=_['merge']({},_0x5307c3,_0x2c4823[_0xa757('0x3c')]);var _0x1725a2={'where':_0x5307c3[_0xa757('0x38')]};return db['VoiceMail'][_0xa757('0x19')](_0x1725a2)[_0xa757('0x1e')](function(_0x26802c){_0x5ade7b[_0xa757('0x19')]=_0x26802c;if(_0x2c4823[_0xa757('0x2e')]['includeAll']){_0x5307c3[_0xa757('0x3d')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x5307c3);})[_0xa757('0x1e')](function(_0x57298b){_0x5ade7b[_0xa757('0x3e')]=_0x57298b;return _0x5ade7b;})[_0xa757('0x1e')](respondWithFilteredResult(_0xa6d0f6,_0x5307c3))[_0xa757('0x3f')](handleError(_0xa6d0f6,null));};exports['show']=function(_0x5d25bb,_0x11e141){var _0x129d77={'raw':!![],'where':{'id':_0x5d25bb[_0xa757('0x40')]['id']}},_0x2b171c={};_0x2b171c[_0xa757('0x2d')]=_[_0xa757('0x2f')](db['VoiceMail'][_0xa757('0x29')]);_0x2b171c[_0xa757('0x2e')]=_['keys'](_0x5d25bb[_0xa757('0x2e')]);_0x2b171c['filters']=_[_0xa757('0x31')](_0x2b171c[_0xa757('0x2d')],_0x2b171c['query']);_0x129d77[_0xa757('0x32')]=_[_0xa757('0x31')](_0x2b171c['model'],qs[_0xa757('0x33')](_0x5d25bb[_0xa757('0x2e')][_0xa757('0x33')]));_0x129d77[_0xa757('0x32')]=_0x129d77['attributes'][_0xa757('0x34')]?_0x129d77[_0xa757('0x32')]:_0x2b171c[_0xa757('0x2d')];if(_0x5d25bb[_0xa757('0x2e')]['includeAll']){_0x129d77[_0xa757('0x3d')]=[{'all':!![]}];}_0x129d77=_['merge']({},_0x129d77,_0x5d25bb['options']);return db[_0xa757('0x28')][_0xa757('0x41')](_0x129d77)[_0xa757('0x1e')](handleEntityNotFound(_0x11e141,null))['then'](respondWithResult(_0x11e141,null))[_0xa757('0x3f')](handleError(_0x11e141,null));};exports['create']=function(_0x2ed63f,_0x151cc3){return db[_0xa757('0x28')][_0xa757('0x42')](_0x2ed63f[_0xa757('0x43')],{})[_0xa757('0x1e')](function(_0x57bf73){var _0x505cd=_0x2ed63f['user'][_0xa757('0x1f')]({'plain':!![]});if(!_0x505cd)throw new Error(_0xa757('0x44'));if(_0x505cd[_0xa757('0x45')]===_0xa757('0x46')){var _0x319988=_0x57bf73[_0xa757('0x1f')]({'plain':!![]});var _0x15bad7=_0xa757('0x20');return db[_0xa757('0x47')][_0xa757('0x41')]({'where':{'name':_0x15bad7,'userProfileId':_0x505cd[_0xa757('0x48')]},'raw':!![]})[_0xa757('0x1e')](function(_0x2367c7){if(_0x2367c7&&_0x2367c7[_0xa757('0x49')]===0x0){return db[_0xa757('0x21')][_0xa757('0x42')]({'name':_0x319988['name'],'resourceId':_0x319988['id'],'type':_0x2367c7[_0xa757('0x25')],'sectionId':_0x2367c7['id']},{})['then'](function(){return _0x57bf73;});}else{return _0x57bf73;}})[_0xa757('0x3f')](function(_0x311c25){logger[_0xa757('0x24')](_0xa757('0x4a'),_0x311c25);throw _0x311c25;});}return _0x57bf73;})['then'](respondWithResult(_0x151cc3,0xc9))[_0xa757('0x3f')](handleError(_0x151cc3,null));};exports[_0xa757('0x1d')]=function(_0x8614f9,_0x980e1){if(_0x8614f9['body']['id']){delete _0x8614f9[_0xa757('0x43')]['id'];}return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x8614f9[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x980e1,null))[_0xa757('0x1e')](saveUpdates(_0x8614f9['body'],null))['then'](respondWithResult(_0x980e1,null))['catch'](handleError(_0x980e1,null));};exports['destroy']=function(_0x1d8742,_0x9b3779){return db[_0xa757('0x28')][_0xa757('0x41')]({'where':{'id':_0x1d8742[_0xa757('0x40')]['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x9b3779,null))['then'](removeEntity(_0x9b3779,null))[_0xa757('0x3f')](handleError(_0x9b3779,null));};exports[_0xa757('0x4b')]=function(_0x34e03f,_0x29b2f5,_0x48b578){return db[_0xa757('0x28')][_0xa757('0x4c')]({'where':{'id':_0x34e03f['params']['id']}})[_0xa757('0x1e')](handleEntityNotFound(_0x29b2f5,null))['then'](function(_0x211980){var _0x5d375c;var _0x51be6e={},_0x58633a={};_0x58633a['model']=_[_0xa757('0x2f')](db[_0xa757('0x4d')][_0xa757('0x29')]);_0x58633a[_0xa757('0x2e')]=_[_0xa757('0x2f')](_0x34e03f[_0xa757('0x2e')]);_0x58633a['filters']=_['intersection'](_0x58633a[_0xa757('0x2d')],_0x58633a[_0xa757('0x2e')]);_0x51be6e[_0xa757('0x32')]=_['intersection'](_0x58633a['model'],qs[_0xa757('0x33')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x33')]));_0x51be6e[_0xa757('0x32')]=_0x51be6e[_0xa757('0x32')][_0xa757('0x34')]?_0x51be6e['attributes']:_0x58633a[_0xa757('0x2d')];if(!_0x34e03f[_0xa757('0x2e')][_0xa757('0x4e')](_0xa757('0x35'))){_0x51be6e[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x34e03f[_0xa757('0x2e')][_0xa757('0x1a')]);_0x51be6e[_0xa757('0x17')]=qs[_0xa757('0x17')](_0x34e03f['query'][_0xa757('0x17')]);}_0x51be6e['order']=qs['sort'](_0x34e03f[_0xa757('0x2e')][_0xa757('0x37')]);_0x51be6e[_0xa757('0x38')]=qs[_0xa757('0x30')](_[_0xa757('0x39')](_0x34e03f[_0xa757('0x2e')],_0x58633a[_0xa757('0x30')]));if(_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]){_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e['where'],{'$or':_[_0xa757('0x27')](_0x51be6e[_0xa757('0x32')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x34e03f[_0xa757('0x2e')][_0xa757('0x3a')]+'%'};return _0x11ebb3;})});}_0x51be6e[_0xa757('0x38')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x38')],{'mailboxuser':_0x211980['mailbox']});_0x51be6e=_[_0xa757('0x3b')]({},_0x51be6e,_0x34e03f['options']);return db[_0xa757('0x4d')][_0xa757('0x4f')](_0x51be6e)[_0xa757('0x1e')](respondWithFilteredResult(_0x29b2f5,_0x51be6e));})[_0xa757('0x3f')](handleError(_0x29b2f5,null));}; \ No newline at end of file +var _0x63a5=['index','map','VoiceMail','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','getMessages','VoiceMailMessage','sort','pick','mailbox','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x54c3d0,_0x57b9b5){var _0x3cbbfd=function(_0x123cd9){while(--_0x123cd9){_0x54c3d0['push'](_0x54c3d0['shift']());}};_0x3cbbfd(++_0x57b9b5);}(_0x63a5,0x18e));var _0x563a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x63a5[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['VoiceMail'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['VoiceMail'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));};exports[_0x563a('0x54')]=function(_0x16aa03,_0x3919a3,_0x1e275c){return db[_0x563a('0x31')]['findOne']({'where':{'id':_0x16aa03[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3919a3,null))['then'](function(_0x503896){var _0x402bdd;var _0x709bfd={},_0x579d61={};_0x579d61[_0x563a('0x35')]=_['keys'](db[_0x563a('0x55')][_0x563a('0x49')]);_0x579d61[_0x563a('0x36')]=_[_0x563a('0x48')](_0x16aa03[_0x563a('0x36')]);_0x579d61['filters']=_['intersection'](_0x579d61['model'],_0x579d61['query']);_0x709bfd[_0x563a('0x39')]=_['intersection'](_0x579d61[_0x563a('0x35')],qs['fields'](_0x16aa03[_0x563a('0x36')][_0x563a('0x3a')]));_0x709bfd[_0x563a('0x39')]=_0x709bfd[_0x563a('0x39')][_0x563a('0x3b')]?_0x709bfd['attributes']:_0x579d61[_0x563a('0x35')];if(!_0x16aa03['query']['hasOwnProperty'](_0x563a('0x3d'))){_0x709bfd[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1e')]);_0x709bfd['offset']=qs[_0x563a('0x1f')](_0x16aa03[_0x563a('0x36')][_0x563a('0x1f')]);}_0x709bfd[_0x563a('0x3e')]=qs[_0x563a('0x56')](_0x16aa03['query'][_0x563a('0x56')]);_0x709bfd['where']=qs[_0x563a('0x37')](_[_0x563a('0x57')](_0x16aa03['query'],_0x579d61[_0x563a('0x37')]));if(_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]){_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'$or':_[_0x563a('0x30')](_0x709bfd[_0x563a('0x39')],function(_0x4cfa73){var _0x103c59={};_0x103c59[_0x4cfa73]={'$like':'%'+_0x16aa03[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x103c59;})});}_0x709bfd[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x709bfd[_0x563a('0x3f')],{'mailboxuser':_0x503896[_0x563a('0x58')]});_0x709bfd=_['merge']({},_0x709bfd,_0x16aa03[_0x563a('0x42')]);return db['VoiceMailMessage']['findAndCountAll'](_0x709bfd)['then'](respondWithFilteredResult(_0x3919a3,_0x709bfd));})[_0x563a('0x45')](handleError(_0x3919a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b24eb6f..e224b70 100644 --- a/server/api/voiceMail/voiceMail.model.js +++ b/server/api/voiceMail/voiceMail.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30f5=['exports','define','VoiceMail','voice_voicemail','mailbox','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x30f5,0x1ef));var _0x530f=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0x30f5[_0x377217];return _0x26258d;};'use strict';var _=require('lodash');var util=require(_0x530f('0x0'));var logger=require(_0x530f('0x1'))(_0x530f('0x2'));var moment=require(_0x530f('0x3'));var BPromise=require(_0x530f('0x4'));var rp=require(_0x530f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x530f('0x6'));var config=require(_0x530f('0x7'));var attributes=require(_0x530f('0x8'));module[_0x530f('0x9')]=function(_0x236f8c,_0x79fcac){return _0x236f8c[_0x530f('0xa')](_0x530f('0xb'),attributes,{'tableName':_0x530f('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x530f('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34d2=['api','bluebird','request-promise','path','rimraf','exports','VoiceMail','mailbox_context','context','lodash','util','../../config/logger'];(function(_0x15d61f,_0x19f1fe){var _0x42dc3e=function(_0x28e6c7){while(--_0x28e6c7){_0x15d61f['push'](_0x15d61f['shift']());}};_0x42dc3e(++_0x19f1fe);}(_0x34d2,0xf9));var _0x234d=function(_0x48760b,_0x97e6fc){_0x48760b=_0x48760b-0x0;var _0x51e3e0=_0x34d2[_0x48760b];return _0x51e3e0;};'use strict';var _=require(_0x234d('0x0'));var util=require(_0x234d('0x1'));var logger=require(_0x234d('0x2'))(_0x234d('0x3'));var moment=require('moment');var BPromise=require(_0x234d('0x4'));var rp=require(_0x234d('0x5'));var fs=require('fs');var path=require(_0x234d('0x6'));var rimraf=require(_0x234d('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x234d('0x8')]=function(_0x4d72ee,_0x5573b5){return _0x4d72ee['define'](_0x234d('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x234d('0xa'),'fields':['mailbox',_0x234d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5488525..c5e6e8e 100644 --- a/server/api/voiceMail/voiceMail.rpc.js +++ b/server/api/voiceMail/voiceMail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf962=['stringify','code','VoiceMail,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1ea9ee,_0x16dafa){var _0x48ef4b=function(_0x4d2219){while(--_0x4d2219){_0x1ea9ee['push'](_0x1ea9ee['shift']());}};_0x48ef4b(++_0x16dafa);}(_0xf962,0x96));var _0x2f96=function(_0x17fd0d,_0x4be94d){_0x17fd0d=_0x17fd0d-0x0;var _0x4b10bb=_0xf962[_0x17fd0d];return _0x4b10bb;};'use strict';var _=require(_0x2f96('0x0'));var util=require(_0x2f96('0x1'));var moment=require(_0x2f96('0x2'));var BPromise=require(_0x2f96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f96('0x4'));var db=require(_0x2f96('0x5'))['db'];var utils=require(_0x2f96('0x6'));var logger=require(_0x2f96('0x7'))(_0x2f96('0x8'));var config=require(_0x2f96('0x9'));var jayson=require(_0x2f96('0xa'));var client=jayson[_0x2f96('0xb')][_0x2f96('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x49e68b,_0x3b51fa,_0x352ffa){return new BPromise(function(_0x51044b,_0x24d03f){return client[_0x2f96('0xd')](_0x49e68b,_0x352ffa)['then'](function(_0x1364ed){logger[_0x2f96('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3b51fa,'request\x20sent');logger[_0x2f96('0xf')](_0x2f96('0x10'),_0x3b51fa,_0x2f96('0x11'),JSON[_0x2f96('0x12')](_0x1364ed));if(_0x1364ed['error']){if(_0x1364ed['error'][_0x2f96('0x13')]===0x1f4){logger['error'](_0x2f96('0x14'),_0x3b51fa,_0x1364ed[_0x2f96('0x15')]['message']);return _0x24d03f(_0x1364ed[_0x2f96('0x15')][_0x2f96('0x16')]);}logger[_0x2f96('0x15')](_0x2f96('0x14'),_0x3b51fa,_0x1364ed[_0x2f96('0x15')]['message']);return _0x51044b(_0x1364ed[_0x2f96('0x15')][_0x2f96('0x16')]);}else{logger['info'](_0x2f96('0x14'),_0x3b51fa,_0x2f96('0x11'));_0x51044b(_0x1364ed['result'][_0x2f96('0x16')]);}})[_0x2f96('0x17')](function(_0x37a9c2){logger[_0x2f96('0x15')]('VoiceMail,\x20%s,\x20%s',_0x3b51fa,_0x37a9c2);_0x24d03f(_0x37a9c2);});});} \ No newline at end of file +var _0xb964=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xb964,0x199));var _0x4b96=function(_0x23f282,_0x29a7ed){_0x23f282=_0x23f282-0x0;var _0x1f1678=_0xb964[_0x23f282];return _0x1f1678;};'use strict';var _=require(_0x4b96('0x0'));var util=require('util');var moment=require(_0x4b96('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b96('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b96('0x3'))(_0x4b96('0x4'));var config=require('../../config/environment');var jayson=require(_0x4b96('0x5'));var client=jayson[_0x4b96('0x6')][_0x4b96('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x61d680,_0x4e5150,_0x4583c8){return new BPromise(function(_0x42418b,_0x234e05){return client['request'](_0x61d680,_0x4583c8)[_0x4b96('0x8')](function(_0x39f7de){logger[_0x4b96('0x9')](_0x4b96('0xa'),_0x4e5150,_0x4b96('0xb'));logger[_0x4b96('0xc')](_0x4b96('0xd'),_0x4e5150,_0x4b96('0xb'),JSON[_0x4b96('0xe')](_0x39f7de));if(_0x39f7de[_0x4b96('0xf')]){if(_0x39f7de[_0x4b96('0xf')][_0x4b96('0x10')]===0x1f4){logger[_0x4b96('0xf')]('VoiceMail,\x20%s,\x20%s',_0x4e5150,_0x39f7de[_0x4b96('0xf')][_0x4b96('0x11')]);return _0x234e05(_0x39f7de['error'][_0x4b96('0x11')]);}logger['error'](_0x4b96('0xa'),_0x4e5150,_0x39f7de[_0x4b96('0xf')][_0x4b96('0x11')]);return _0x42418b(_0x39f7de[_0x4b96('0xf')]['message']);}else{logger['info'](_0x4b96('0xa'),_0x4e5150,_0x4b96('0xb'));_0x42418b(_0x39f7de[_0x4b96('0x12')][_0x4b96('0x11')]);}})[_0x4b96('0x13')](function(_0x4da1c4){logger[_0x4b96('0xf')]('VoiceMail,\x20%s,\x20%s',_0x4e5150,_0x4da1c4);_0x234e05(_0x4da1c4);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 59d67fb..cf3bab6 100644 --- a/server/api/voiceMailMessage/index.js +++ b/server/api/voiceMailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a33=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x0a33,0x12a));var _0x30a3=function(_0x5ba545,_0x95a648){_0x5ba545=_0x5ba545-0x0;var _0x32d860=_0x0a33[_0x5ba545];return _0x32d860;};'use strict';var multer=require(_0x30a3('0x0'));var util=require(_0x30a3('0x1'));var path=require(_0x30a3('0x2'));var timeout=require(_0x30a3('0x3'));var express=require(_0x30a3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x30a3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x30a3('0x6'));var controller=require(_0x30a3('0x7'));router[_0x30a3('0x8')]('/',auth[_0x30a3('0x9')](),controller[_0x30a3('0xa')]);router['get'](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0xc')]);router[_0x30a3('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x30a3('0xd')]);router[_0x30a3('0xe')]('/',auth['isAuthenticated'](),controller[_0x30a3('0xf')]);router[_0x30a3('0x10')](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0x11')]);router[_0x30a3('0x12')](_0x30a3('0xb'),auth[_0x30a3('0x9')](),controller[_0x30a3('0x13')]);module[_0x30a3('0x14')]=router; \ No newline at end of file +var _0xd74d=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','/:id','isAuthenticated','show','get','/:id/download','post','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1a99cc,_0x54af4d){var _0x373ac0=function(_0x2a2969){while(--_0x2a2969){_0x1a99cc['push'](_0x1a99cc['shift']());}};_0x373ac0(++_0x54af4d);}(_0xd74d,0x1d6));var _0xdd74=function(_0x450bd6,_0x365761){_0x450bd6=_0x450bd6-0x0;var _0x4bc43f=_0xd74d[_0x450bd6];return _0x4bc43f;};'use strict';var multer=require(_0xdd74('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdd74('0x1'));var express=require(_0xdd74('0x2'));var router=express['Router']();var fs_extra=require(_0xdd74('0x3'));var auth=require(_0xdd74('0x4'));var interaction=require(_0xdd74('0x5'));var config=require(_0xdd74('0x6'));var controller=require(_0xdd74('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd74('0x8')]);router['get'](_0xdd74('0x9'),auth[_0xdd74('0xa')](),controller[_0xdd74('0xb')]);router[_0xdd74('0xc')](_0xdd74('0xd'),auth[_0xdd74('0xa')](),controller['download']);router[_0xdd74('0xe')]('/',auth[_0xdd74('0xa')](),controller['create']);router[_0xdd74('0xf')](_0xdd74('0x9'),auth['isAuthenticated'](),controller[_0xdd74('0x10')]);router[_0xdd74('0x11')](_0xdd74('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xdd74('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index cbd861b..dd2c80e 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.attributes.js +++ b/server/api/voiceMailMessage/voiceMailMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2caf=['long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x34a30a,_0x2d555c){var _0x2300b8=function(_0x24bc73){while(--_0x24bc73){_0x34a30a['push'](_0x34a30a['shift']());}};_0x2300b8(++_0x2d555c);}(_0x2caf,0x1d3));var _0xf2ca=function(_0x53cfae,_0x44a7c5){_0x53cfae=_0x53cfae-0x0;var _0xc056ac=_0x2caf[_0x53cfae];return _0xc056ac;};'use strict';var Sequelize=require(_0xf2ca('0x0'));module[_0xf2ca('0x1')]={'name':{'type':Sequelize[_0xf2ca('0x2')],'get':function(_0x44b417){return this[_0xf2ca('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xf2ca('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf2ca('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xf2ca('0x6')](_0xf2ca('0x7'))}}; \ No newline at end of file +var _0xe7b1=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','long','TIMESTAMP'];(function(_0x4721e9,_0x1b221f){var _0x2171e0=function(_0x4a8ee9){while(--_0x4a8ee9){_0x4721e9['push'](_0x4721e9['shift']());}};_0x2171e0(++_0x1b221f);}(_0xe7b1,0x119));var _0x1e7b=function(_0xa636cc,_0x4c1005){_0xa636cc=_0xa636cc-0x0;var _0x7b313e=_0xe7b1[_0xa636cc];return _0x7b313e;};'use strict';var Sequelize=require(_0x1e7b('0x0'));module[_0x1e7b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x58d8cf){return this[_0x1e7b('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1e7b('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x1e7b('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1e7b('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x1e7b('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1e7b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x1e7b('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x1e7b('0x6'),'defaultValue':Sequelize['literal'](_0x1e7b('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 41ab83b..d1505d9 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.controller.js +++ b/server/api/voiceMailMessage/voiceMailMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb447=['rows','catch','show','body','update','find','params','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','end','json','offset','limit','undefined','count','status','set','apply','reject','then','error','stack','name','send','VoiceMailMessage','rawAttributes','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb447,0x158));var _0x7b44=function(_0x24715d,_0x59118f){_0x24715d=_0x24715d-0x0;var _0x1a9681=_0xb447[_0x24715d];return _0x1a9681;};'use strict';var emlformat=require(_0x7b44('0x0'));var rimraf=require(_0x7b44('0x1'));var zipdir=require(_0x7b44('0x2'));var jsonpatch=require(_0x7b44('0x3'));var rp=require(_0x7b44('0x4'));var moment=require(_0x7b44('0x5'));var BPromise=require(_0x7b44('0x6'));var Mustache=require(_0x7b44('0x7'));var util=require(_0x7b44('0x8'));var path=require('path');var sox=require(_0x7b44('0x9'));var csv=require('to-csv');var ejs=require(_0x7b44('0xa'));var fs=require('fs');var fs_extra=require(_0x7b44('0xb'));var _=require('lodash');var squel=require(_0x7b44('0xc'));var crypto=require(_0x7b44('0xd'));var jsforce=require(_0x7b44('0xe'));var deskjs=require(_0x7b44('0xf'));var toCsv=require(_0x7b44('0x10'));var querystring=require(_0x7b44('0x11'));var Papa=require(_0x7b44('0x12'));var Redis=require('ioredis');var authService=require(_0x7b44('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7b44('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b44('0x15'));var utils=require(_0x7b44('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7b44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6324c1,_0x312a14){_0x312a14=_0x312a14||0xcc;return function(_0x5c9d29){if(_0x5c9d29){return _0x6324c1['sendStatus'](_0x312a14);}return _0x6324c1['status'](_0x312a14)[_0x7b44('0x18')]();};}function respondWithResult(_0x5b8b73,_0x52e46d){_0x52e46d=_0x52e46d||0xc8;return function(_0x2f33a6){if(_0x2f33a6){return _0x5b8b73['status'](_0x52e46d)[_0x7b44('0x19')](_0x2f33a6);}};}function respondWithFilteredResult(_0x454f1a,_0x5544ed){return function(_0x4adf31){if(_0x4adf31){var _0x2d89b6=typeof _0x5544ed[_0x7b44('0x1a')]==='undefined'&&typeof _0x5544ed[_0x7b44('0x1b')]===_0x7b44('0x1c');var _0x294905=_0x4adf31[_0x7b44('0x1d')];var _0x3500d9=_0x2d89b6?0x0:_0x5544ed[_0x7b44('0x1a')];var _0x37bbab=_0x2d89b6?_0x4adf31[_0x7b44('0x1d')]:_0x5544ed[_0x7b44('0x1a')]+_0x5544ed[_0x7b44('0x1b')];var _0x8e2b29;if(_0x37bbab>=_0x294905){_0x37bbab=_0x294905;_0x8e2b29=0xc8;}else{_0x8e2b29=0xce;}_0x454f1a[_0x7b44('0x1e')](_0x8e2b29);return _0x454f1a[_0x7b44('0x1f')]('Content-Range',_0x3500d9+'-'+_0x37bbab+'/'+_0x294905)['json'](_0x4adf31);}return null;};}function patchUpdates(_0xea52d0){return function(_0x1a8354){try{jsonpatch[_0x7b44('0x20')](_0x1a8354,_0xea52d0,!![]);}catch(_0x3c0c4f){return BPromise[_0x7b44('0x21')](_0x3c0c4f);}return _0x1a8354['save']();};}function saveUpdates(_0x6e9a36,_0x5d2a2b){return function(_0x482991){if(_0x482991){return _0x482991['update'](_0x6e9a36)[_0x7b44('0x22')](function(_0x527f2a){return _0x527f2a;});}return null;};}function removeEntity(_0x38123d,_0x122237){return function(_0x4d29b1){if(_0x4d29b1){return _0x4d29b1['destroy']()[_0x7b44('0x22')](function(){_0x38123d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3ea2,_0x6fee9c){return function(_0x299595){if(!_0x299595){_0x2e3ea2['sendStatus'](0x194);}return _0x299595;};}function handleError(_0x5d46bd,_0x31122f){_0x31122f=_0x31122f||0x1f4;return function(_0x76265e){logger[_0x7b44('0x23')](_0x76265e[_0x7b44('0x24')]);if(_0x76265e[_0x7b44('0x25')]){delete _0x76265e[_0x7b44('0x25')];}_0x5d46bd[_0x7b44('0x1e')](_0x31122f)[_0x7b44('0x26')](_0x76265e);};}exports['index']=function(_0x2696fc,_0x491277){var _0x4e43f1={},_0x53b153={},_0x2e98ac={'count':0x0,'rows':[]};var _0x1d4390=_['map'](db[_0x7b44('0x27')][_0x7b44('0x28')],function(_0x5bd18d){return{'name':_0x5bd18d['fieldName'],'type':_0x5bd18d[_0x7b44('0x29')][_0x7b44('0x2a')]};});_0x53b153['model']=_[_0x7b44('0x2b')](_[_0x7b44('0x2c')](_0x1d4390,_0x7b44('0x25')),[_0x7b44('0x25')]);_0x53b153[_0x7b44('0x2d')]=_[_0x7b44('0x2e')](_0x2696fc[_0x7b44('0x2d')]);_0x53b153[_0x7b44('0x2f')]=_[_0x7b44('0x30')](_0x53b153[_0x7b44('0x31')],_0x53b153[_0x7b44('0x2d')]);_0x4e43f1[_0x7b44('0x32')]=_[_0x7b44('0x30')](_0x53b153[_0x7b44('0x31')],qs[_0x7b44('0x33')](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x33')]));_0x4e43f1[_0x7b44('0x32')]=_0x4e43f1[_0x7b44('0x32')][_0x7b44('0x34')]?_0x4e43f1[_0x7b44('0x32')]:_0x53b153['model'];if(!_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x35')](_0x7b44('0x36'))){_0x4e43f1['limit']=qs[_0x7b44('0x1b')](_0x2696fc[_0x7b44('0x2d')]['limit']);_0x4e43f1[_0x7b44('0x1a')]=qs[_0x7b44('0x1a')](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x1a')]);}_0x4e43f1[_0x7b44('0x37')]=qs['sort'](_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x38')]);_0x4e43f1[_0x7b44('0x39')]=qs['filters'](_[_0x7b44('0x3a')](_0x2696fc[_0x7b44('0x2d')],_0x53b153[_0x7b44('0x2f')]),_0x1d4390);if(_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x3b')]){_0x4e43f1['where']=_[_0x7b44('0x3c')](_0x4e43f1[_0x7b44('0x39')],{'$or':_[_0x7b44('0x2c')](_0x1d4390,function(_0x25a49c){if(_0x25a49c[_0x7b44('0x29')]!==_0x7b44('0x3d')){var _0x2646d7={};_0x2646d7[_0x25a49c[_0x7b44('0x25')]]={'$like':'%'+_0x2696fc['query'][_0x7b44('0x3b')]+'%'};return _0x2646d7;}})});}_0x4e43f1=_[_0x7b44('0x3c')]({},_0x4e43f1,_0x2696fc[_0x7b44('0x3e')]);var _0x166d40={'where':_0x4e43f1[_0x7b44('0x39')]};return db['VoiceMailMessage'][_0x7b44('0x1d')](_0x166d40)[_0x7b44('0x22')](function(_0x5094e9){_0x2e98ac[_0x7b44('0x1d')]=_0x5094e9;if(_0x2696fc[_0x7b44('0x2d')][_0x7b44('0x3f')]){_0x4e43f1[_0x7b44('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x7b44('0x41')](_0x4e43f1);})[_0x7b44('0x22')](function(_0x1f2740){_0x2e98ac[_0x7b44('0x42')]=_0x1f2740;return _0x2e98ac;})[_0x7b44('0x22')](respondWithFilteredResult(_0x491277,_0x4e43f1))[_0x7b44('0x43')](handleError(_0x491277,null));};exports[_0x7b44('0x44')]=function(_0x269406,_0x2a4431){var _0xc5b160={'raw':!![],'where':{'id':_0x269406['params']['id']}},_0x3524ff={};_0x3524ff[_0x7b44('0x31')]=_[_0x7b44('0x2e')](db[_0x7b44('0x27')][_0x7b44('0x28')]);_0x3524ff[_0x7b44('0x2d')]=_['keys'](_0x269406[_0x7b44('0x2d')]);_0x3524ff['filters']=_['intersection'](_0x3524ff['model'],_0x3524ff[_0x7b44('0x2d')]);_0xc5b160[_0x7b44('0x32')]=_['intersection'](_0x3524ff['model'],qs[_0x7b44('0x33')](_0x269406[_0x7b44('0x2d')][_0x7b44('0x33')]));_0xc5b160[_0x7b44('0x32')]=_0xc5b160[_0x7b44('0x32')]['length']?_0xc5b160[_0x7b44('0x32')]:_0x3524ff['model'];if(_0x269406[_0x7b44('0x2d')][_0x7b44('0x3f')]){_0xc5b160[_0x7b44('0x40')]=[{'all':!![]}];}_0xc5b160=_['merge']({},_0xc5b160,_0x269406[_0x7b44('0x3e')]);return db[_0x7b44('0x27')]['find'](_0xc5b160)['then'](handleEntityNotFound(_0x2a4431,null))[_0x7b44('0x22')](respondWithResult(_0x2a4431,null))[_0x7b44('0x43')](handleError(_0x2a4431,null));};exports['create']=function(_0x4273d4,_0x524a93){return db['VoiceMailMessage']['create'](_0x4273d4[_0x7b44('0x45')],{})[_0x7b44('0x22')](respondWithResult(_0x524a93,0xc9))['catch'](handleError(_0x524a93,null));};exports[_0x7b44('0x46')]=function(_0x593928,_0x4f9e9d){if(_0x593928[_0x7b44('0x45')]['id']){delete _0x593928[_0x7b44('0x45')]['id'];}return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x593928['params']['id']}})[_0x7b44('0x22')](handleEntityNotFound(_0x4f9e9d,null))['then'](saveUpdates(_0x593928[_0x7b44('0x45')],null))['then'](respondWithResult(_0x4f9e9d,null))[_0x7b44('0x43')](handleError(_0x4f9e9d,null));};exports['destroy']=function(_0x3dc0d7,_0x1b47bc){return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x3dc0d7['params']['id']}})[_0x7b44('0x22')](handleEntityNotFound(_0x1b47bc,null))[_0x7b44('0x22')](removeEntity(_0x1b47bc,null))[_0x7b44('0x43')](handleError(_0x1b47bc,null));};exports['download']=function(_0x59feaa,_0x4c722c,_0x52e309){return db[_0x7b44('0x27')][_0x7b44('0x47')]({'where':{'id':_0x59feaa[_0x7b44('0x48')]['id']},'attributes':['id',_0x7b44('0x49'),_0x7b44('0x4a')]})[_0x7b44('0x22')](handleEntityNotFound(_0x4c722c,null))[_0x7b44('0x22')](function(_0x27507e){if(_0x27507e){if(!_0x27507e[_0x7b44('0x49')]){throw new db[(_0x7b44('0x4b'))][(_0x7b44('0x4c'))](_0x7b44('0x4d'));}var _0xc55a7={'Content-Type':_0x7b44('0x4e'),'Content-Disposition':_0x7b44('0x4f')};if(_0x27507e['msg_id']){_0xc55a7['Content-Disposition']=_0x7b44('0x50')+_0x27507e[_0x7b44('0x4a')]+_0x7b44('0x51');}_0x4c722c[_0x7b44('0x1f')](_0xc55a7);return _0x4c722c['send'](new Buffer(_0x27507e[_0x7b44('0x49')]));}})[_0x7b44('0x43')](handleError(_0x4c722c,null));}; \ No newline at end of file +var _0xa8d4=['pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xa8d4,0x15c));var _0x4a8d=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xa8d4[_0x350258];return _0x3714b3;};'use strict';var emlformat=require(_0x4a8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4a8d('0x1'));var rp=require(_0x4a8d('0x2'));var moment=require(_0x4a8d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4a8d('0x4'));var util=require(_0x4a8d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4a8d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a8d('0x7'));var _=require(_0x4a8d('0x8'));var squel=require('squel');var crypto=require(_0x4a8d('0x9'));var jsforce=require(_0x4a8d('0xa'));var deskjs=require(_0x4a8d('0xb'));var toCsv=require(_0x4a8d('0x6'));var querystring=require(_0x4a8d('0xc'));var Papa=require(_0x4a8d('0xd'));var Redis=require(_0x4a8d('0xe'));var authService=require(_0x4a8d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a8d('0x10'));var logger=require(_0x4a8d('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x4a8d('0x12'));var licenseUtil=require(_0x4a8d('0x13'));var db=require(_0x4a8d('0x14'))['db'];function respondWithStatusCode(_0x35194d,_0x1b414d){_0x1b414d=_0x1b414d||0xcc;return function(_0x50eaa1){if(_0x50eaa1){return _0x35194d[_0x4a8d('0x15')](_0x1b414d);}return _0x35194d['status'](_0x1b414d)[_0x4a8d('0x16')]();};}function respondWithResult(_0x2844a3,_0xe96444){_0xe96444=_0xe96444||0xc8;return function(_0x41ad25){if(_0x41ad25){return _0x2844a3[_0x4a8d('0x17')](_0xe96444)[_0x4a8d('0x18')](_0x41ad25);}};}function respondWithFilteredResult(_0x321de0,_0x289fb9){return function(_0x1e23ab){if(_0x1e23ab){var _0x26952f=typeof _0x289fb9[_0x4a8d('0x19')]==='undefined'&&typeof _0x289fb9['limit']===_0x4a8d('0x1a');var _0x44158f=_0x1e23ab[_0x4a8d('0x1b')];var _0x280f6d=_0x26952f?0x0:_0x289fb9[_0x4a8d('0x19')];var _0x184728=_0x26952f?_0x1e23ab[_0x4a8d('0x1b')]:_0x289fb9[_0x4a8d('0x19')]+_0x289fb9[_0x4a8d('0x1c')];var _0x5ed52d;if(_0x184728>=_0x44158f){_0x184728=_0x44158f;_0x5ed52d=0xc8;}else{_0x5ed52d=0xce;}_0x321de0['status'](_0x5ed52d);return _0x321de0[_0x4a8d('0x1d')](_0x4a8d('0x1e'),_0x280f6d+'-'+_0x184728+'/'+_0x44158f)[_0x4a8d('0x18')](_0x1e23ab);}return null;};}function patchUpdates(_0x1228c3){return function(_0x5db252){try{jsonpatch[_0x4a8d('0x1f')](_0x5db252,_0x1228c3,!![]);}catch(_0x45fd84){return BPromise['reject'](_0x45fd84);}return _0x5db252['save']();};}function saveUpdates(_0x2df824,_0xa87cbe){return function(_0x11f794){if(_0x11f794){return _0x11f794[_0x4a8d('0x20')](_0x2df824)[_0x4a8d('0x21')](function(_0x40be79){return _0x40be79;});}return null;};}function removeEntity(_0x12fb0f,_0x59ca6a){return function(_0xeb7a88){if(_0xeb7a88){return _0xeb7a88['destroy']()['then'](function(){_0x12fb0f[_0x4a8d('0x17')](0xcc)[_0x4a8d('0x16')]();});}};}function handleEntityNotFound(_0x3f8319,_0x4cea94){return function(_0x2a77a5){if(!_0x2a77a5){_0x3f8319[_0x4a8d('0x15')](0x194);}return _0x2a77a5;};}function handleError(_0x5e7e3b,_0x3694e6){_0x3694e6=_0x3694e6||0x1f4;return function(_0x2d3258){logger[_0x4a8d('0x22')](_0x2d3258[_0x4a8d('0x23')]);if(_0x2d3258['name']){delete _0x2d3258[_0x4a8d('0x24')];}_0x5e7e3b[_0x4a8d('0x17')](_0x3694e6)['send'](_0x2d3258);};}exports[_0x4a8d('0x25')]=function(_0x180b12,_0x10208e){var _0x533c5b={},_0x73969f={},_0x27cd5b={'count':0x0,'rows':[]};var _0x54075a=_[_0x4a8d('0x26')](db[_0x4a8d('0x27')][_0x4a8d('0x28')],function(_0x10c7be){return{'name':_0x10c7be[_0x4a8d('0x29')],'type':_0x10c7be[_0x4a8d('0x2a')][_0x4a8d('0x2b')]};});_0x73969f[_0x4a8d('0x2c')]=_[_0x4a8d('0x2d')](_[_0x4a8d('0x26')](_0x54075a,'name'),[_0x4a8d('0x24')]);_0x73969f[_0x4a8d('0x2e')]=_[_0x4a8d('0x2f')](_0x180b12[_0x4a8d('0x2e')]);_0x73969f[_0x4a8d('0x30')]=_[_0x4a8d('0x31')](_0x73969f['model'],_0x73969f[_0x4a8d('0x2e')]);_0x533c5b['attributes']=_[_0x4a8d('0x31')](_0x73969f[_0x4a8d('0x2c')],qs[_0x4a8d('0x32')](_0x180b12[_0x4a8d('0x2e')][_0x4a8d('0x32')]));_0x533c5b[_0x4a8d('0x33')]=_0x533c5b['attributes'][_0x4a8d('0x34')]?_0x533c5b[_0x4a8d('0x33')]:_0x73969f[_0x4a8d('0x2c')];if(!_0x180b12[_0x4a8d('0x2e')][_0x4a8d('0x35')](_0x4a8d('0x36'))){_0x533c5b[_0x4a8d('0x1c')]=qs[_0x4a8d('0x1c')](_0x180b12[_0x4a8d('0x2e')][_0x4a8d('0x1c')]);_0x533c5b['offset']=qs[_0x4a8d('0x19')](_0x180b12[_0x4a8d('0x2e')][_0x4a8d('0x19')]);}_0x533c5b[_0x4a8d('0x37')]=qs[_0x4a8d('0x38')](_0x180b12[_0x4a8d('0x2e')]['sort']);_0x533c5b['where']=qs[_0x4a8d('0x30')](_[_0x4a8d('0x39')](_0x180b12['query'],_0x73969f[_0x4a8d('0x30')]),_0x54075a);if(_0x180b12[_0x4a8d('0x2e')]['filter']){_0x533c5b[_0x4a8d('0x3a')]=_['merge'](_0x533c5b['where'],{'$or':_['map'](_0x54075a,function(_0x32d55b){if(_0x32d55b[_0x4a8d('0x2a')]!==_0x4a8d('0x3b')){var _0x5a8c33={};_0x5a8c33[_0x32d55b[_0x4a8d('0x24')]]={'$like':'%'+_0x180b12[_0x4a8d('0x2e')][_0x4a8d('0x3c')]+'%'};return _0x5a8c33;}})});}_0x533c5b=_[_0x4a8d('0x3d')]({},_0x533c5b,_0x180b12[_0x4a8d('0x3e')]);var _0x1b0c98={'where':_0x533c5b['where']};return db[_0x4a8d('0x27')][_0x4a8d('0x1b')](_0x1b0c98)[_0x4a8d('0x21')](function(_0x37988b){_0x27cd5b['count']=_0x37988b;if(_0x180b12['query'][_0x4a8d('0x3f')]){_0x533c5b[_0x4a8d('0x40')]=[{'all':!![]}];}return db[_0x4a8d('0x27')][_0x4a8d('0x41')](_0x533c5b);})[_0x4a8d('0x21')](function(_0x367daa){_0x27cd5b[_0x4a8d('0x42')]=_0x367daa;return _0x27cd5b;})[_0x4a8d('0x21')](respondWithFilteredResult(_0x10208e,_0x533c5b))[_0x4a8d('0x43')](handleError(_0x10208e,null));};exports[_0x4a8d('0x44')]=function(_0x311c1a,_0x72b252){var _0x2edb1c={'raw':!![],'where':{'id':_0x311c1a[_0x4a8d('0x45')]['id']}},_0x466bca={};_0x466bca[_0x4a8d('0x2c')]=_[_0x4a8d('0x2f')](db[_0x4a8d('0x27')]['rawAttributes']);_0x466bca['query']=_['keys'](_0x311c1a[_0x4a8d('0x2e')]);_0x466bca['filters']=_[_0x4a8d('0x31')](_0x466bca['model'],_0x466bca['query']);_0x2edb1c['attributes']=_['intersection'](_0x466bca[_0x4a8d('0x2c')],qs[_0x4a8d('0x32')](_0x311c1a[_0x4a8d('0x2e')]['fields']));_0x2edb1c[_0x4a8d('0x33')]=_0x2edb1c['attributes'][_0x4a8d('0x34')]?_0x2edb1c[_0x4a8d('0x33')]:_0x466bca[_0x4a8d('0x2c')];if(_0x311c1a[_0x4a8d('0x2e')][_0x4a8d('0x3f')]){_0x2edb1c[_0x4a8d('0x40')]=[{'all':!![]}];}_0x2edb1c=_[_0x4a8d('0x3d')]({},_0x2edb1c,_0x311c1a[_0x4a8d('0x3e')]);return db[_0x4a8d('0x27')][_0x4a8d('0x46')](_0x2edb1c)[_0x4a8d('0x21')](handleEntityNotFound(_0x72b252,null))['then'](respondWithResult(_0x72b252,null))[_0x4a8d('0x43')](handleError(_0x72b252,null));};exports[_0x4a8d('0x47')]=function(_0x6bca0c,_0x3205b4){return db[_0x4a8d('0x27')][_0x4a8d('0x47')](_0x6bca0c[_0x4a8d('0x48')],{})[_0x4a8d('0x21')](respondWithResult(_0x3205b4,0xc9))[_0x4a8d('0x43')](handleError(_0x3205b4,null));};exports['update']=function(_0x19a56d,_0x184990){if(_0x19a56d['body']['id']){delete _0x19a56d[_0x4a8d('0x48')]['id'];}return db['VoiceMailMessage'][_0x4a8d('0x46')]({'where':{'id':_0x19a56d['params']['id']}})[_0x4a8d('0x21')](handleEntityNotFound(_0x184990,null))['then'](saveUpdates(_0x19a56d[_0x4a8d('0x48')],null))[_0x4a8d('0x21')](respondWithResult(_0x184990,null))[_0x4a8d('0x43')](handleError(_0x184990,null));};exports[_0x4a8d('0x49')]=function(_0x4530ae,_0x511732){return db[_0x4a8d('0x27')][_0x4a8d('0x46')]({'where':{'id':_0x4530ae['params']['id']}})['then'](handleEntityNotFound(_0x511732,null))[_0x4a8d('0x21')](removeEntity(_0x511732,null))[_0x4a8d('0x43')](handleError(_0x511732,null));};exports['download']=function(_0x1dde51,_0x43a744,_0x2c1794){return db['VoiceMailMessage'][_0x4a8d('0x46')]({'where':{'id':_0x1dde51[_0x4a8d('0x45')]['id']},'attributes':['id',_0x4a8d('0x4a'),_0x4a8d('0x4b')]})[_0x4a8d('0x21')](handleEntityNotFound(_0x43a744,null))['then'](function(_0x403f8b){if(_0x403f8b){if(!_0x403f8b[_0x4a8d('0x4a')]){throw new db[(_0x4a8d('0x4c'))][(_0x4a8d('0x4d'))](_0x4a8d('0x4e'));}var _0x79c1c0={'Content-Type':_0x4a8d('0x4f'),'Content-Disposition':_0x4a8d('0x50')};if(_0x403f8b[_0x4a8d('0x4b')]){_0x79c1c0['Content-Disposition']='attachment;\x20filename=\x22'+_0x403f8b['msg_id']+'.wav\x22';}_0x43a744[_0x4a8d('0x1d')](_0x79c1c0);return _0x43a744['send'](new Buffer(_0x403f8b[_0x4a8d('0x4a')]));}})[_0x4a8d('0x43')](handleError(_0x43a744,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e427220..4615e21 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.model.js +++ b/server/api/voiceMailMessage/voiceMailMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9065=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','dir','lodash'];(function(_0x2aba7c,_0x515b9d){var _0x3f0982=function(_0x29b77c){while(--_0x29b77c){_0x2aba7c['push'](_0x2aba7c['shift']());}};_0x3f0982(++_0x515b9d);}(_0x9065,0x1d8));var _0x5906=function(_0x16e216,_0x765b5b){_0x16e216=_0x16e216-0x0;var _0x16c48f=_0x9065[_0x16e216];return _0x16c48f;};'use strict';var _=require(_0x5906('0x0'));var util=require(_0x5906('0x1'));var logger=require('../../config/logger')(_0x5906('0x2'));var moment=require(_0x5906('0x3'));var BPromise=require(_0x5906('0x4'));var rp=require(_0x5906('0x5'));var fs=require('fs');var path=require(_0x5906('0x6'));var rimraf=require(_0x5906('0x7'));var config=require(_0x5906('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x5906('0x9')]=function(_0x2dc21e,_0x4b30da){return _0x2dc21e['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5906('0xa'),'fields':[_0x5906('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0xa163=['rimraf','../../config/environment','define','voice_voicemail_messages','dir','../../config/logger','moment','request-promise'];(function(_0x494a15,_0x386bf2){var _0x2f98ce=function(_0x9e57a0){while(--_0x9e57a0){_0x494a15['push'](_0x494a15['shift']());}};_0x2f98ce(++_0x386bf2);}(_0xa163,0x1c5));var _0x3a16=function(_0x4f0888,_0x5163d5){_0x4f0888=_0x4f0888-0x0;var _0x341b9d=_0xa163[_0x4f0888];return _0x341b9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3a16('0x0'))('api');var moment=require(_0x3a16('0x1'));var BPromise=require('bluebird');var rp=require(_0x3a16('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a16('0x3'));var config=require(_0x3a16('0x4'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x19fe86,_0x478cbf){return _0x19fe86[_0x3a16('0x5')]('VoiceMailMessage',attributes,{'tableName':_0x3a16('0x6'),'paranoid':![],'indexes':[{'name':_0x3a16('0x7'),'fields':[_0x3a16('0x7')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index e4eefde..1a48816 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x231d=['../../config/environment','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c3b1d,_0x3686ef){var _0x168193=function(_0x39bc26){while(--_0x39bc26){_0x3c3b1d['push'](_0x3c3b1d['shift']());}};_0x168193(++_0x3686ef);}(_0x231d,0x6b));var _0xd231=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x231d[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0xd231('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd231('0x1'));var fs=require('fs');var Redis=require(_0xd231('0x2'));var db=require(_0xd231('0x3'))['db'];var utils=require(_0xd231('0x4'));var logger=require(_0xd231('0x5'))(_0xd231('0x6'));var config=require(_0xd231('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427f8f,_0x560a08,_0x47de98){return new BPromise(function(_0x31b871,_0x58a867){return client[_0xd231('0x8')](_0x427f8f,_0x47de98)[_0xd231('0x9')](function(_0x31c67a){logger['info'](_0xd231('0xa'),_0x560a08,_0xd231('0xb'));logger[_0xd231('0xc')](_0xd231('0xd'),_0x560a08,_0xd231('0xb'),JSON['stringify'](_0x31c67a));if(_0x31c67a[_0xd231('0xe')]){if(_0x31c67a[_0xd231('0xe')][_0xd231('0xf')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x560a08,_0x31c67a[_0xd231('0xe')]['message']);return _0x58a867(_0x31c67a[_0xd231('0xe')][_0xd231('0x10')]);}logger[_0xd231('0xe')](_0xd231('0xa'),_0x560a08,_0x31c67a[_0xd231('0xe')][_0xd231('0x10')]);return _0x31b871(_0x31c67a[_0xd231('0xe')]['message']);}else{logger['info'](_0xd231('0xa'),_0x560a08,_0xd231('0xb'));_0x31b871(_0x31c67a[_0xd231('0x11')][_0xd231('0x10')]);}})[_0xd231('0x12')](function(_0x408931){logger[_0xd231('0xe')](_0xd231('0xa'),_0x560a08,_0x408931);_0x58a867(_0x408931);});});} \ No newline at end of file +var _0x03d7=['info','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x593972,_0x6dfad0){var _0x58868d=function(_0x8807ad){while(--_0x8807ad){_0x593972['push'](_0x593972['shift']());}};_0x58868d(++_0x6dfad0);}(_0x03d7,0x15e));var _0x703d=function(_0x4bbbfc,_0x112dfb){_0x4bbbfc=_0x4bbbfc-0x0;var _0x328bcb=_0x03d7[_0x4bbbfc];return _0x328bcb;};'use strict';var _=require(_0x703d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x703d('0x1'));var rs=require(_0x703d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x703d('0x3'));var logger=require('../../config/logger')(_0x703d('0x4'));var config=require(_0x703d('0x5'));var jayson=require(_0x703d('0x6'));var client=jayson[_0x703d('0x7')][_0x703d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30d118,_0x2029c5,_0x865736){return new BPromise(function(_0x4e1134,_0x5c4a30){return client['request'](_0x30d118,_0x865736)[_0x703d('0x9')](function(_0x313275){logger[_0x703d('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x2029c5,'request\x20sent');logger['debug'](_0x703d('0xb'),_0x2029c5,_0x703d('0xc'),JSON[_0x703d('0xd')](_0x313275));if(_0x313275[_0x703d('0xe')]){if(_0x313275[_0x703d('0xe')][_0x703d('0xf')]===0x1f4){logger[_0x703d('0xe')](_0x703d('0x10'),_0x2029c5,_0x313275[_0x703d('0xe')][_0x703d('0x11')]);return _0x5c4a30(_0x313275['error']['message']);}logger[_0x703d('0xe')](_0x703d('0x10'),_0x2029c5,_0x313275[_0x703d('0xe')][_0x703d('0x11')]);return _0x4e1134(_0x313275[_0x703d('0xe')][_0x703d('0x11')]);}else{logger[_0x703d('0xa')](_0x703d('0x10'),_0x2029c5,_0x703d('0xc'));_0x4e1134(_0x313275['result'][_0x703d('0x11')]);}})['catch'](function(_0x247517){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2029c5,_0x247517);_0x5c4a30(_0x247517);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f3b6215..ac1db87 100644 --- a/server/api/voiceMusicOnHold/index.js +++ b/server/api/voiceMusicOnHold/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec4d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','/:id/sounds','isAuthenticated','getSounds','post','delete','/:id/sounds/:id2','removeSound','multer','util','path'];(function(_0x5dc72,_0x357970){var _0x2a101c=function(_0x1d8886){while(--_0x1d8886){_0x5dc72['push'](_0x5dc72['shift']());}};_0x2a101c(++_0x357970);}(_0xec4d,0xbb));var _0xdec4=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0xec4d[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0xdec4('0x0'));var util=require(_0xdec4('0x1'));var path=require(_0xdec4('0x2'));var timeout=require(_0xdec4('0x3'));var express=require(_0xdec4('0x4'));var router=express[_0xdec4('0x5')]();var fs_extra=require(_0xdec4('0x6'));var auth=require(_0xdec4('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdec4('0x8'));var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdec4('0x9')](_0xdec4('0xa'),auth['isAuthenticated'](),controller[_0xdec4('0xb')]);router['get'](_0xdec4('0xc'),auth[_0xdec4('0xd')](),controller[_0xdec4('0xe')]);router[_0xdec4('0xf')]('/',auth[_0xdec4('0xd')](),controller['create']);router['post'](_0xdec4('0xc'),auth[_0xdec4('0xd')](),controller['addSound']);router['put'](_0xdec4('0xa'),auth[_0xdec4('0xd')](),controller['update']);router[_0xdec4('0x10')](_0xdec4('0xa'),auth[_0xdec4('0xd')](),controller['destroy']);router[_0xdec4('0x10')](_0xdec4('0x11'),auth[_0xdec4('0xd')](),controller[_0xdec4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x671b=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','/:id/sounds','getSounds','post','create','put','update','delete','destroy','removeSound','exports','util'];(function(_0xd2970f,_0x1a906e){var _0x568f42=function(_0x3035ba){while(--_0x3035ba){_0xd2970f['push'](_0xd2970f['shift']());}};_0x568f42(++_0x1a906e);}(_0x671b,0xa0));var _0xb671=function(_0xf6e5ea,_0x1d7ab1){_0xf6e5ea=_0xf6e5ea-0x0;var _0x22e827=_0x671b[_0xf6e5ea];return _0x22e827;};'use strict';var multer=require('multer');var util=require(_0xb671('0x0'));var path=require(_0xb671('0x1'));var timeout=require(_0xb671('0x2'));var express=require('express');var router=express[_0xb671('0x3')]();var fs_extra=require(_0xb671('0x4'));var auth=require(_0xb671('0x5'));var interaction=require(_0xb671('0x6'));var config=require(_0xb671('0x7'));var controller=require(_0xb671('0x8'));router[_0xb671('0x9')]('/',auth['isAuthenticated'](),controller[_0xb671('0xa')]);router[_0xb671('0x9')](_0xb671('0xb'),auth[_0xb671('0xc')](),controller['show']);router['get'](_0xb671('0xd'),auth[_0xb671('0xc')](),controller[_0xb671('0xe')]);router[_0xb671('0xf')]('/',auth[_0xb671('0xc')](),controller[_0xb671('0x10')]);router[_0xb671('0xf')](_0xb671('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0xb671('0x11')](_0xb671('0xb'),auth[_0xb671('0xc')](),controller[_0xb671('0x12')]);router[_0xb671('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb671('0x14')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xb671('0x15')]);module[_0xb671('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index ac6eb84..bb1bbc7 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81a8=['custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','sequelize','STRING','name','ENUM'];(function(_0x51ac5d,_0x5eb100){var _0x30ff4b=function(_0x2a9738){while(--_0x2a9738){_0x51ac5d['push'](_0x51ac5d['shift']());}};_0x30ff4b(++_0x5eb100);}(_0x81a8,0x151));var _0x881a=function(_0x3937b6,_0xd53d2b){_0x3937b6=_0x3937b6-0x0;var _0x1ba356=_0x81a8[_0x3937b6];return _0x1ba356;};'use strict';var Sequelize=require(_0x881a('0x0'));module['exports']={'name':{'type':Sequelize[_0x881a('0x1')],'allowNull':![],'unique':_0x881a('0x2')},'mode':{'type':Sequelize[_0x881a('0x3')](_0x881a('0x4'),_0x881a('0x5'),_0x881a('0x6'),_0x881a('0x7'),_0x881a('0x8'),_0x881a('0x9')),'allowNull':!![],'defaultValue':_0x881a('0x5')},'directory':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![],'defaultValue':_0x881a('0xa')},'format':{'type':Sequelize[_0x881a('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a8e=['STRING','name','custom','files','mp3nb','quietmp3nb','mp3','alpha','sequelize','exports'];(function(_0x2d92cf,_0x434a92){var _0x592841=function(_0x4e5c22){while(--_0x4e5c22){_0x2d92cf['push'](_0x2d92cf['shift']());}};_0x592841(++_0x434a92);}(_0x6a8e,0x15c));var _0xe6a8=function(_0x58eed6,_0x49a046){_0x58eed6=_0x58eed6-0x0;var _0x381fa7=_0x6a8e[_0x58eed6];return _0x381fa7;};'use strict';var Sequelize=require(_0xe6a8('0x0'));module[_0xe6a8('0x1')]={'name':{'type':Sequelize[_0xe6a8('0x2')],'allowNull':![],'unique':_0xe6a8('0x3')},'mode':{'type':Sequelize['ENUM'](_0xe6a8('0x4'),_0xe6a8('0x5'),_0xe6a8('0x6'),_0xe6a8('0x7'),'quietmp3',_0xe6a8('0x8')),'allowNull':!![],'defaultValue':_0xe6a8('0x5')},'directory':{'type':Sequelize[_0xe6a8('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xe6a8('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xe6a8('0x9')},'format':{'type':Sequelize[_0xe6a8('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 04b5d5c..d5d9aa2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f41=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','ValidationError','removeSound','Sound','getSounds','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x235b95,_0x43b276){var _0x323f8f=function(_0x5cbe23){while(--_0x5cbe23){_0x235b95['push'](_0x235b95['shift']());}};_0x323f8f(++_0x43b276);}(_0x1f41,0xd5));var _0x11f4=function(_0x885082,_0x13f7e7){_0x885082=_0x885082-0x0;var _0x3b3a5e=_0x1f41[_0x885082];return _0x3b3a5e;};'use strict';var emlformat=require(_0x11f4('0x0'));var rimraf=require(_0x11f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11f4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x11f4('0x3'));var Mustache=require(_0x11f4('0x4'));var util=require('util');var path=require(_0x11f4('0x5'));var sox=require(_0x11f4('0x6'));var csv=require(_0x11f4('0x7'));var ejs=require(_0x11f4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11f4('0x9'));var squel=require(_0x11f4('0xa'));var crypto=require(_0x11f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x11f4('0xc'));var toCsv=require(_0x11f4('0x7'));var querystring=require(_0x11f4('0xd'));var Papa=require('papaparse');var Redis=require(_0x11f4('0xe'));var authService=require(_0x11f4('0xf'));var qs=require(_0x11f4('0x10'));var as=require(_0x11f4('0x11'));var hardwareService=require(_0x11f4('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x11f4('0x13'));var db=require(_0x11f4('0x14'))['db'];function respondWithStatusCode(_0x1ae73f,_0x3e424c){_0x3e424c=_0x3e424c||0xcc;return function(_0x40625e){if(_0x40625e){return _0x1ae73f[_0x11f4('0x15')](_0x3e424c);}return _0x1ae73f['status'](_0x3e424c)[_0x11f4('0x16')]();};}function respondWithResult(_0x2f0140,_0x258a8d){_0x258a8d=_0x258a8d||0xc8;return function(_0x15f8e3){if(_0x15f8e3){return _0x2f0140[_0x11f4('0x17')](_0x258a8d)[_0x11f4('0x18')](_0x15f8e3);}};}function respondWithFilteredResult(_0x40d9ef,_0x4ec18e){return function(_0xff3591){if(_0xff3591){var _0x26b9d0=typeof _0x4ec18e[_0x11f4('0x19')]===_0x11f4('0x1a')&&typeof _0x4ec18e[_0x11f4('0x1b')]===_0x11f4('0x1a');var _0x5e4541=_0xff3591[_0x11f4('0x1c')];var _0x2fc6c1=_0x26b9d0?0x0:_0x4ec18e[_0x11f4('0x19')];var _0x25f74a=_0x26b9d0?_0xff3591[_0x11f4('0x1c')]:_0x4ec18e[_0x11f4('0x19')]+_0x4ec18e['limit'];var _0x35e621;if(_0x25f74a>=_0x5e4541){_0x25f74a=_0x5e4541;_0x35e621=0xc8;}else{_0x35e621=0xce;}_0x40d9ef['status'](_0x35e621);return _0x40d9ef[_0x11f4('0x1d')]('Content-Range',_0x2fc6c1+'-'+_0x25f74a+'/'+_0x5e4541)[_0x11f4('0x18')](_0xff3591);}return null;};}function patchUpdates(_0x2ef57b){return function(_0x4f1280){try{jsonpatch[_0x11f4('0x1e')](_0x4f1280,_0x2ef57b,!![]);}catch(_0x3af72d){return BPromise['reject'](_0x3af72d);}return _0x4f1280[_0x11f4('0x1f')]();};}function saveUpdates(_0x36ba91,_0x5b0010){return function(_0x53e431){if(_0x53e431){return _0x53e431[_0x11f4('0x20')](_0x36ba91)[_0x11f4('0x21')](function(_0x1a0498){return _0x1a0498;});}return null;};}function removeEntity(_0x4cb402,_0x92c8ce){return function(_0x566186){if(_0x566186){return _0x566186[_0x11f4('0x22')]()[_0x11f4('0x21')](function(){var _0x44de68=_0x566186[_0x11f4('0x23')]({'plain':!![]});var _0x21df77=_0x11f4('0x24');return db[_0x11f4('0x25')][_0x11f4('0x22')]({'where':{'type':_0x21df77,'resourceId':_0x44de68['id']}})[_0x11f4('0x21')](function(){return _0x566186;});})[_0x11f4('0x21')](function(){_0x4cb402[_0x11f4('0x17')](0xcc)[_0x11f4('0x16')]();});}};}function handleEntityNotFound(_0x5b1593,_0x317efb){return function(_0x2e1977){if(!_0x2e1977){_0x5b1593[_0x11f4('0x15')](0x194);}return _0x2e1977;};}function handleError(_0x3bf34c,_0x1bc09f){_0x1bc09f=_0x1bc09f||0x1f4;return function(_0x4e9e2c){logger[_0x11f4('0x26')](_0x4e9e2c[_0x11f4('0x27')]);if(_0x4e9e2c[_0x11f4('0x28')]){delete _0x4e9e2c[_0x11f4('0x28')];}_0x3bf34c[_0x11f4('0x17')](_0x1bc09f)[_0x11f4('0x29')](_0x4e9e2c);};}exports['index']=function(_0x37523f,_0x294bc7){var _0x3c9b23={},_0x2eb913={},_0x4c0e98={'count':0x0,'rows':[]};var _0x4be07b=_['map'](db[_0x11f4('0x2a')][_0x11f4('0x2b')],function(_0xde376){return{'name':_0xde376[_0x11f4('0x2c')],'type':_0xde376['type'][_0x11f4('0x2d')]};});_0x2eb913[_0x11f4('0x2e')]=_['map'](_0x4be07b,_0x11f4('0x28'));_0x2eb913['query']=_['keys'](_0x37523f[_0x11f4('0x2f')]);_0x2eb913[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x2eb913[_0x11f4('0x2e')],_0x2eb913[_0x11f4('0x2f')]);_0x3c9b23[_0x11f4('0x32')]=_[_0x11f4('0x31')](_0x2eb913[_0x11f4('0x2e')],qs['fields'](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x3c9b23['attributes']=_0x3c9b23[_0x11f4('0x32')][_0x11f4('0x34')]?_0x3c9b23[_0x11f4('0x32')]:_0x2eb913[_0x11f4('0x2e')];if(!_0x37523f[_0x11f4('0x2f')][_0x11f4('0x35')](_0x11f4('0x36'))){_0x3c9b23['limit']=qs[_0x11f4('0x1b')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x1b')]);_0x3c9b23[_0x11f4('0x19')]=qs[_0x11f4('0x19')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x19')]);}_0x3c9b23[_0x11f4('0x37')]=qs[_0x11f4('0x38')](_0x37523f[_0x11f4('0x2f')][_0x11f4('0x38')]);delete _0x37523f['query'][_0x11f4('0x38')];_0x3c9b23[_0x11f4('0x39')]=qs[_0x11f4('0x30')](_[_0x11f4('0x3a')](_0x37523f[_0x11f4('0x2f')],_0x2eb913[_0x11f4('0x30')]),_0x4be07b);if(_0x37523f[_0x11f4('0x2f')][_0x11f4('0x3b')]){_0x3c9b23[_0x11f4('0x39')]=_['merge'](_0x3c9b23[_0x11f4('0x39')],{'$or':_[_0x11f4('0x3c')](_0x4be07b,function(_0x464983){if(_0x464983[_0x11f4('0x3d')]!==_0x11f4('0x3e')){var _0x24054f={};_0x24054f[_0x464983[_0x11f4('0x28')]]={'$like':'%'+_0x37523f[_0x11f4('0x2f')][_0x11f4('0x3b')]+'%'};return _0x24054f;}})});}_0x3c9b23=_[_0x11f4('0x3f')]({},_0x3c9b23,_0x37523f[_0x11f4('0x40')]);var _0x3267c1={'where':_0x3c9b23[_0x11f4('0x39')]};return db[_0x11f4('0x2a')][_0x11f4('0x1c')](_0x3267c1)[_0x11f4('0x21')](function(_0x31de99){_0x4c0e98['count']=_0x31de99;if(_0x37523f[_0x11f4('0x2f')][_0x11f4('0x41')]){_0x3c9b23[_0x11f4('0x42')]=[{'all':!![]}];}return db[_0x11f4('0x2a')][_0x11f4('0x43')](_0x3c9b23);})[_0x11f4('0x21')](function(_0x5ef2d2){_0x4c0e98[_0x11f4('0x44')]=_0x5ef2d2;return _0x4c0e98;})[_0x11f4('0x21')](respondWithFilteredResult(_0x294bc7,_0x3c9b23))[_0x11f4('0x45')](handleError(_0x294bc7,null));};exports[_0x11f4('0x46')]=function(_0xddcc25,_0x407861){var _0x1de998={'raw':![],'where':{'id':_0xddcc25[_0x11f4('0x47')]['id']}},_0x3e9be4={};_0x3e9be4['model']=_[_0x11f4('0x48')](db[_0x11f4('0x2a')]['rawAttributes']);_0x3e9be4['query']=_[_0x11f4('0x48')](_0xddcc25[_0x11f4('0x2f')]);_0x3e9be4[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x3e9be4[_0x11f4('0x2e')],_0x3e9be4[_0x11f4('0x2f')]);_0x1de998[_0x11f4('0x32')]=_[_0x11f4('0x31')](_0x3e9be4[_0x11f4('0x2e')],qs[_0x11f4('0x33')](_0xddcc25[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x1de998[_0x11f4('0x32')]=_0x1de998[_0x11f4('0x32')][_0x11f4('0x34')]?_0x1de998['attributes']:_0x3e9be4[_0x11f4('0x2e')];if(_0xddcc25[_0x11f4('0x2f')][_0x11f4('0x41')]){_0x1de998['include']=[{'all':!![]}];}_0x1de998=_[_0x11f4('0x3f')]({},_0x1de998,_0xddcc25[_0x11f4('0x40')]);return db[_0x11f4('0x2a')][_0x11f4('0x49')](_0x1de998)[_0x11f4('0x21')](handleEntityNotFound(_0x407861,null))['then'](respondWithResult(_0x407861,null))['catch'](handleError(_0x407861,null));};exports['update']=function(_0x36da2e,_0x325839){if(_0x36da2e[_0x11f4('0x4a')]['id']){delete _0x36da2e[_0x11f4('0x4a')]['id'];}return db[_0x11f4('0x2a')][_0x11f4('0x49')]({'where':{'id':_0x36da2e[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x325839,null))['then'](saveUpdates(_0x36da2e['body'],null))[_0x11f4('0x21')](respondWithResult(_0x325839,null))[_0x11f4('0x45')](handleError(_0x325839,null));};exports[_0x11f4('0x4b')]=function(_0x450b64,_0x165480,_0x1f9e8e){return db[_0x11f4('0x4c')]['transaction'](function(_0x181cb3){if(_0x450b64['body'][_0x11f4('0x4d')]===_0x11f4('0x4e')){_0x450b64['body'][_0x11f4('0x4f')]=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x52'),_0x450b64['body']['name']);}return db[_0x11f4('0x2a')][_0x11f4('0x4b')](_0x450b64[_0x11f4('0x4a')],{'transaction':_0x181cb3})[_0x11f4('0x21')](function(_0x2ebbdb){if(_0x450b64[_0x11f4('0x4a')]['mode']===_0x11f4('0x4e')){fs[_0x11f4('0x53')](_0x2ebbdb[_0x11f4('0x4f')],parseInt(_0x11f4('0x54'),0x8));}var _0x1f5228=_0x450b64['user'][_0x11f4('0x23')]({'plain':!![]});if(!_0x1f5228)throw new Error(_0x11f4('0x55'));if(_0x1f5228[_0x11f4('0x56')]===_0x11f4('0x57')){var _0x58bc96=_0x2ebbdb[_0x11f4('0x23')]({'plain':!![]});return db[_0x11f4('0x58')][_0x11f4('0x49')]({'where':{'name':_0x11f4('0x24'),'userProfileId':_0x1f5228[_0x11f4('0x59')]},'raw':!![]})['then'](function(_0x4deb84){if(_0x4deb84&&_0x4deb84[_0x11f4('0x5a')]===0x0){return db[_0x11f4('0x25')]['create']({'name':_0x58bc96[_0x11f4('0x28')],'resourceId':_0x58bc96['id'],'type':_0x4deb84[_0x11f4('0x28')],'sectionId':_0x4deb84['id']},{})[_0x11f4('0x21')](function(){return _0x2ebbdb;});}else{return _0x2ebbdb;}})[_0x11f4('0x45')](function(_0x213b6b){logger['error'](_0x11f4('0x5b'),_0x213b6b);});}return _0x2ebbdb;});})['then'](respondWithResult(_0x165480,0xc9))[_0x11f4('0x45')](handleError(_0x165480,null));};exports['destroy']=function(_0x1ed99a,_0x16de4f,_0x371aa6){var _0x2cafe8;return db[_0x11f4('0x2a')]['find']({'where':{'id':_0x1ed99a[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](function(_0x4dcbc7){if(_0x4dcbc7){return db['sequelize'][_0x11f4('0x5c')](function(_0x1b2736){return _0x4dcbc7[_0x11f4('0x22')]({'transaction':_0x1b2736,'raw':!![]})['then'](function(_0x1e32df){if(_0x1e32df[_0x11f4('0x4f')]){fs[_0x11f4('0x5d')](_0x1e32df['directory'])[_0x11f4('0x5e')](function(_0x280ce7){fs[_0x11f4('0x5f')](path[_0x11f4('0x50')](_0x1e32df['directory'],_0x280ce7));});fs[_0x11f4('0x60')](_0x1e32df['directory']);}return _0x1e32df;});})['catch'](function(_0x1f92d3){throw new db[(_0x11f4('0x61'))]['ValidationError'](_0x1f92d3[_0x11f4('0x62')]);});}})[_0x11f4('0x21')](handleEntityNotFound(_0x16de4f,null))['then'](removeEntity(_0x16de4f,null))['catch'](handleError(_0x16de4f,null));};exports[_0x11f4('0x63')]=function(_0x3daf18,_0x2b8d56,_0x34d3f0){return db[_0x11f4('0x4c')][_0x11f4('0x5c')](function(_0x3b80e4){var _0x19a0d2;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x3daf18['params']['id']}})[_0x11f4('0x21')](function(_0x5ba488){if(_0x5ba488){_0x19a0d2=_0x5ba488;return _0x5ba488[_0x11f4('0x63')](_0x3daf18[_0x11f4('0x4a')]['id'],{'transaction':_0x3b80e4});}})[_0x11f4('0x21')](function(_0x6ea9df){if(_0x6ea9df){return db['Sound'][_0x11f4('0x64')]({'where':{'id':_0x3daf18[_0x11f4('0x4a')]['id']},'attributes':['id',_0x11f4('0x28'),_0x11f4('0x65'),_0x11f4('0x66'),_0x11f4('0x67')],'raw':!![]});}})[_0x11f4('0x21')](function(_0x1939f8){if(_0x1939f8){var _0x4cb06b=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x68'),util[_0x11f4('0x69')](_0x11f4('0x6a'),path[_0x11f4('0x6b')](_0x1939f8['save_name'],path[_0x11f4('0x6c')](_0x1939f8[_0x11f4('0x65')])),_0x1939f8['converted_format']));var _0x1bd90e=path[_0x11f4('0x50')](config[_0x11f4('0x51')],_0x11f4('0x52'),_0x19a0d2[_0x11f4('0x28')],util[_0x11f4('0x69')]('%s.%s',_0x1939f8[_0x11f4('0x28')],_0x1939f8[_0x11f4('0x66')]));fs[_0x11f4('0x6d')](_0x4cb06b,_0x1bd90e);return _0x1939f8;}})[_0x11f4('0x45')](function(_0x2c15a3){throw new db[(_0x11f4('0x61'))][(_0x11f4('0x6e'))](_0x2c15a3[_0x11f4('0x62')]);});})[_0x11f4('0x21')](handleEntityNotFound(_0x2b8d56,null))['then'](respondWithResult(_0x2b8d56,0xc9))[_0x11f4('0x45')](handleError(_0x2b8d56,null));};exports[_0x11f4('0x6f')]=function(_0x5214fb,_0x2db4fd,_0x1b0d68){return db[_0x11f4('0x4c')]['transaction'](function(_0x470a45){var _0x42024a;return db['VoiceMusicOnHold'][_0x11f4('0x64')]({'where':{'id':_0x5214fb[_0x11f4('0x47')]['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x2db4fd,null))['then'](function(_0x344c88){if(_0x344c88){_0x42024a=_0x344c88;return _0x344c88[_0x11f4('0x6f')](_0x5214fb[_0x11f4('0x47')]['id2']);}})[_0x11f4('0x21')](function(_0x5b3e94){if(_0x5b3e94){return db[_0x11f4('0x70')]['findOne']({'where':{'id':_0x5214fb[_0x11f4('0x47')]['id2']},'attributes':['id','name','save_name',_0x11f4('0x66'),_0x11f4('0x67')],'raw':!![]});}})[_0x11f4('0x21')](function(_0x28a526){if(_0x28a526){fs[_0x11f4('0x5f')](path[_0x11f4('0x50')](_0x42024a[_0x11f4('0x4f')],util[_0x11f4('0x69')](_0x11f4('0x6a'),_0x28a526[_0x11f4('0x28')],_0x28a526[_0x11f4('0x66')])));return _0x28a526;}})[_0x11f4('0x45')](function(_0x54695b){throw new db[(_0x11f4('0x61'))][(_0x11f4('0x6e'))](_0x54695b['message']);});})[_0x11f4('0x21')](handleEntityNotFound(_0x2db4fd,null))[_0x11f4('0x21')](respondWithStatusCode(_0x2db4fd,0xcc))['catch'](handleError(_0x2db4fd,null));};exports[_0x11f4('0x71')]=function(_0x5c8391,_0x2d8a00,_0x44510f){var _0x3acc39={};var _0x4e2256={};var _0x156829;var _0x504fc2;return db[_0x11f4('0x2a')][_0x11f4('0x64')]({'where':{'id':_0x5c8391['params']['id']}})[_0x11f4('0x21')](handleEntityNotFound(_0x2d8a00,null))[_0x11f4('0x21')](function(_0x57726e){if(_0x57726e){_0x156829=_0x57726e;_0x4e2256[_0x11f4('0x2e')]=_[_0x11f4('0x48')](db[_0x11f4('0x70')][_0x11f4('0x2b')]);_0x4e2256[_0x11f4('0x2f')]=_[_0x11f4('0x48')](_0x5c8391[_0x11f4('0x2f')]);_0x4e2256[_0x11f4('0x30')]=_[_0x11f4('0x31')](_0x4e2256[_0x11f4('0x2e')],_0x4e2256['query']);_0x3acc39[_0x11f4('0x32')]=_['intersection'](_0x4e2256['model'],qs[_0x11f4('0x33')](_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x33')]));_0x3acc39[_0x11f4('0x32')]=_0x3acc39[_0x11f4('0x32')][_0x11f4('0x34')]?_0x3acc39[_0x11f4('0x32')]:_0x4e2256[_0x11f4('0x2e')];_0x3acc39[_0x11f4('0x37')]=qs[_0x11f4('0x38')](_0x5c8391[_0x11f4('0x2f')]['sort']);_0x3acc39[_0x11f4('0x39')]=qs[_0x11f4('0x30')](_[_0x11f4('0x3a')](_0x5c8391[_0x11f4('0x2f')],_0x4e2256[_0x11f4('0x30')]));if(_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x3b')]){_0x3acc39[_0x11f4('0x39')]=_[_0x11f4('0x3f')](_0x3acc39[_0x11f4('0x39')],{'$or':_[_0x11f4('0x3c')](_0x3acc39[_0x11f4('0x32')],function(_0x531c23){var _0x598096={};_0x598096[_0x531c23]={'$like':'%'+_0x5c8391['query'][_0x11f4('0x3b')]+'%'};return _0x598096;})});}_0x3acc39=_['merge']({},_0x3acc39,_0x5c8391[_0x11f4('0x40')]);return _0x156829[_0x11f4('0x71')](_0x3acc39);}})[_0x11f4('0x21')](function(_0x56fadd){if(_0x56fadd){_0x504fc2=_0x56fadd[_0x11f4('0x34')];if(!_0x5c8391['query'][_0x11f4('0x35')]('nolimit')){_0x3acc39[_0x11f4('0x1b')]=qs[_0x11f4('0x1b')](_0x5c8391['query']['limit']);_0x3acc39['offset']=qs[_0x11f4('0x19')](_0x5c8391[_0x11f4('0x2f')][_0x11f4('0x19')]);}return _0x156829[_0x11f4('0x71')](_0x3acc39);}})['then'](function(_0x4770cc){if(_0x4770cc){return _0x4770cc?{'count':_0x504fc2,'rows':_0x4770cc}:null;}})[_0x11f4('0x21')](respondWithResult(_0x2d8a00,null))['catch'](handleError(_0x2d8a00,null));}; \ No newline at end of file +var _0xbd75=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','then','get','UserProfileResource','destroy','sendStatus','error','name','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','show','params','find','update','body','mode','files','directory','join','root','server/files/moh','create','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','autoAssociation','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','transaction','Sound','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','converted_format','removeSound','id2','findOne','unlinkSync','getSounds','eml-format','rimraf'];(function(_0x5e6943,_0x1c5ec7){var _0x6e03cc=function(_0x4f7e22){while(--_0x4f7e22){_0x5e6943['push'](_0x5e6943['shift']());}};_0x6e03cc(++_0x1c5ec7);}(_0xbd75,0x6b));var _0x5bd7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbd75[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x5bd7('0x0'));var rimraf=require(_0x5bd7('0x1'));var zipdir=require(_0x5bd7('0x2'));var jsonpatch=require(_0x5bd7('0x3'));var rp=require(_0x5bd7('0x4'));var moment=require('moment');var BPromise=require(_0x5bd7('0x5'));var Mustache=require(_0x5bd7('0x6'));var util=require(_0x5bd7('0x7'));var path=require(_0x5bd7('0x8'));var sox=require(_0x5bd7('0x9'));var csv=require('to-csv');var ejs=require(_0x5bd7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bd7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5bd7('0xc'));var querystring=require(_0x5bd7('0xd'));var Papa=require('papaparse');var Redis=require(_0x5bd7('0xe'));var authService=require(_0x5bd7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5bd7('0x10'));var hardwareService=require(_0x5bd7('0x11'));var logger=require(_0x5bd7('0x12'))(_0x5bd7('0x13'));var utils=require('../../config/utils');var config=require(_0x5bd7('0x14'));var licenseUtil=require(_0x5bd7('0x15'));var db=require(_0x5bd7('0x16'))['db'];function respondWithStatusCode(_0x55e260,_0x250d03){_0x250d03=_0x250d03||0xcc;return function(_0x50dca0){if(_0x50dca0){return _0x55e260['sendStatus'](_0x250d03);}return _0x55e260[_0x5bd7('0x17')](_0x250d03)[_0x5bd7('0x18')]();};}function respondWithResult(_0x3724be,_0x3e5e1c){_0x3e5e1c=_0x3e5e1c||0xc8;return function(_0x14736c){if(_0x14736c){return _0x3724be[_0x5bd7('0x17')](_0x3e5e1c)[_0x5bd7('0x19')](_0x14736c);}};}function respondWithFilteredResult(_0x36410a,_0x142f23){return function(_0x1bd919){if(_0x1bd919){var _0x1e6dad=typeof _0x142f23[_0x5bd7('0x1a')]===_0x5bd7('0x1b')&&typeof _0x142f23[_0x5bd7('0x1c')]===_0x5bd7('0x1b');var _0x56f557=_0x1bd919['count'];var _0x2674f7=_0x1e6dad?0x0:_0x142f23['offset'];var _0x2f4a33=_0x1e6dad?_0x1bd919['count']:_0x142f23[_0x5bd7('0x1a')]+_0x142f23[_0x5bd7('0x1c')];var _0x2dcadd;if(_0x2f4a33>=_0x56f557){_0x2f4a33=_0x56f557;_0x2dcadd=0xc8;}else{_0x2dcadd=0xce;}_0x36410a[_0x5bd7('0x17')](_0x2dcadd);return _0x36410a[_0x5bd7('0x1d')](_0x5bd7('0x1e'),_0x2674f7+'-'+_0x2f4a33+'/'+_0x56f557)[_0x5bd7('0x19')](_0x1bd919);}return null;};}function patchUpdates(_0x500eb0){return function(_0x144867){try{jsonpatch['apply'](_0x144867,_0x500eb0,!![]);}catch(_0x4d32c1){return BPromise[_0x5bd7('0x1f')](_0x4d32c1);}return _0x144867['save']();};}function saveUpdates(_0xc446df,_0x4a2210){return function(_0x3ee859){if(_0x3ee859){return _0x3ee859['update'](_0xc446df)['then'](function(_0x500b44){return _0x500b44;});}return null;};}function removeEntity(_0x13486f,_0x22876b){return function(_0x504ca5){if(_0x504ca5){return _0x504ca5['destroy']()[_0x5bd7('0x20')](function(){var _0xba462f=_0x504ca5[_0x5bd7('0x21')]({'plain':!![]});var _0x40c5c9='MusicOnHolds';return db[_0x5bd7('0x22')][_0x5bd7('0x23')]({'where':{'type':_0x40c5c9,'resourceId':_0xba462f['id']}})[_0x5bd7('0x20')](function(){return _0x504ca5;});})['then'](function(){_0x13486f[_0x5bd7('0x17')](0xcc)[_0x5bd7('0x18')]();});}};}function handleEntityNotFound(_0x57ca8c,_0x56d02d){return function(_0x40c186){if(!_0x40c186){_0x57ca8c[_0x5bd7('0x24')](0x194);}return _0x40c186;};}function handleError(_0x514ddf,_0x1fa5b7){_0x1fa5b7=_0x1fa5b7||0x1f4;return function(_0x44beb0){logger[_0x5bd7('0x25')](_0x44beb0['stack']);if(_0x44beb0['name']){delete _0x44beb0[_0x5bd7('0x26')];}_0x514ddf['status'](_0x1fa5b7)['send'](_0x44beb0);};}exports['index']=function(_0x4fd56d,_0x1fcb97){var _0x37277e={},_0x12421d={},_0x225ee4={'count':0x0,'rows':[]};var _0x46ae14=_['map'](db['VoiceMusicOnHold'][_0x5bd7('0x27')],function(_0xb53b53){return{'name':_0xb53b53['fieldName'],'type':_0xb53b53[_0x5bd7('0x28')][_0x5bd7('0x29')]};});_0x12421d[_0x5bd7('0x2a')]=_[_0x5bd7('0x2b')](_0x46ae14,'name');_0x12421d[_0x5bd7('0x2c')]=_[_0x5bd7('0x2d')](_0x4fd56d[_0x5bd7('0x2c')]);_0x12421d[_0x5bd7('0x2e')]=_['intersection'](_0x12421d[_0x5bd7('0x2a')],_0x12421d[_0x5bd7('0x2c')]);_0x37277e[_0x5bd7('0x2f')]=_[_0x5bd7('0x30')](_0x12421d[_0x5bd7('0x2a')],qs[_0x5bd7('0x31')](_0x4fd56d['query'][_0x5bd7('0x31')]));_0x37277e[_0x5bd7('0x2f')]=_0x37277e[_0x5bd7('0x2f')][_0x5bd7('0x32')]?_0x37277e['attributes']:_0x12421d[_0x5bd7('0x2a')];if(!_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x33')](_0x5bd7('0x34'))){_0x37277e[_0x5bd7('0x1c')]=qs['limit'](_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x1c')]);_0x37277e[_0x5bd7('0x1a')]=qs[_0x5bd7('0x1a')](_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x1a')]);}_0x37277e[_0x5bd7('0x35')]=qs[_0x5bd7('0x36')](_0x4fd56d[_0x5bd7('0x2c')]['sort']);delete _0x4fd56d['query']['sort'];_0x37277e['where']=qs[_0x5bd7('0x2e')](_[_0x5bd7('0x37')](_0x4fd56d[_0x5bd7('0x2c')],_0x12421d[_0x5bd7('0x2e')]),_0x46ae14);if(_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x38')]){_0x37277e[_0x5bd7('0x39')]=_[_0x5bd7('0x3a')](_0x37277e[_0x5bd7('0x39')],{'$or':_[_0x5bd7('0x2b')](_0x46ae14,function(_0x3a3ca1){if(_0x3a3ca1[_0x5bd7('0x28')]!==_0x5bd7('0x3b')){var _0x5f510f={};_0x5f510f[_0x3a3ca1[_0x5bd7('0x26')]]={'$like':'%'+_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x38')]+'%'};return _0x5f510f;}})});}_0x37277e=_['merge']({},_0x37277e,_0x4fd56d[_0x5bd7('0x3c')]);var _0x972819={'where':_0x37277e[_0x5bd7('0x39')]};return db[_0x5bd7('0x3d')][_0x5bd7('0x3e')](_0x972819)[_0x5bd7('0x20')](function(_0x51040f){_0x225ee4['count']=_0x51040f;if(_0x4fd56d[_0x5bd7('0x2c')][_0x5bd7('0x3f')]){_0x37277e[_0x5bd7('0x40')]=[{'all':!![]}];}return db[_0x5bd7('0x3d')][_0x5bd7('0x41')](_0x37277e);})[_0x5bd7('0x20')](function(_0x559bce){_0x225ee4[_0x5bd7('0x42')]=_0x559bce;return _0x225ee4;})['then'](respondWithFilteredResult(_0x1fcb97,_0x37277e))[_0x5bd7('0x43')](handleError(_0x1fcb97,null));};exports[_0x5bd7('0x44')]=function(_0x523448,_0x461e22){var _0x32c8b5={'raw':![],'where':{'id':_0x523448[_0x5bd7('0x45')]['id']}},_0xe7510={};_0xe7510[_0x5bd7('0x2a')]=_[_0x5bd7('0x2d')](db[_0x5bd7('0x3d')][_0x5bd7('0x27')]);_0xe7510['query']=_[_0x5bd7('0x2d')](_0x523448[_0x5bd7('0x2c')]);_0xe7510[_0x5bd7('0x2e')]=_[_0x5bd7('0x30')](_0xe7510['model'],_0xe7510['query']);_0x32c8b5[_0x5bd7('0x2f')]=_['intersection'](_0xe7510[_0x5bd7('0x2a')],qs[_0x5bd7('0x31')](_0x523448[_0x5bd7('0x2c')][_0x5bd7('0x31')]));_0x32c8b5[_0x5bd7('0x2f')]=_0x32c8b5[_0x5bd7('0x2f')]['length']?_0x32c8b5[_0x5bd7('0x2f')]:_0xe7510[_0x5bd7('0x2a')];if(_0x523448[_0x5bd7('0x2c')][_0x5bd7('0x3f')]){_0x32c8b5[_0x5bd7('0x40')]=[{'all':!![]}];}_0x32c8b5=_[_0x5bd7('0x3a')]({},_0x32c8b5,_0x523448[_0x5bd7('0x3c')]);return db['VoiceMusicOnHold'][_0x5bd7('0x46')](_0x32c8b5)['then'](handleEntityNotFound(_0x461e22,null))[_0x5bd7('0x20')](respondWithResult(_0x461e22,null))['catch'](handleError(_0x461e22,null));};exports[_0x5bd7('0x47')]=function(_0x1bca4b,_0xab0856){if(_0x1bca4b[_0x5bd7('0x48')]['id']){delete _0x1bca4b[_0x5bd7('0x48')]['id'];}return db[_0x5bd7('0x3d')][_0x5bd7('0x46')]({'where':{'id':_0x1bca4b[_0x5bd7('0x45')]['id']}})[_0x5bd7('0x20')](handleEntityNotFound(_0xab0856,null))[_0x5bd7('0x20')](saveUpdates(_0x1bca4b['body'],null))[_0x5bd7('0x20')](respondWithResult(_0xab0856,null))['catch'](handleError(_0xab0856,null));};exports['create']=function(_0x413791,_0x2dc5f9,_0x3792c7){return db['sequelize']['transaction'](function(_0x3c58fb){if(_0x413791[_0x5bd7('0x48')][_0x5bd7('0x49')]===_0x5bd7('0x4a')){_0x413791[_0x5bd7('0x48')][_0x5bd7('0x4b')]=path[_0x5bd7('0x4c')](config[_0x5bd7('0x4d')],_0x5bd7('0x4e'),_0x413791[_0x5bd7('0x48')][_0x5bd7('0x26')]);}return db[_0x5bd7('0x3d')][_0x5bd7('0x4f')](_0x413791[_0x5bd7('0x48')],{'transaction':_0x3c58fb})[_0x5bd7('0x20')](function(_0x282fb8){if(_0x413791['body'][_0x5bd7('0x49')]===_0x5bd7('0x4a')){fs['mkdirSync'](_0x282fb8[_0x5bd7('0x4b')],parseInt(_0x5bd7('0x50'),0x8));}var _0x400a21=_0x413791['user'][_0x5bd7('0x21')]({'plain':!![]});if(!_0x400a21)throw new Error(_0x5bd7('0x51'));if(_0x400a21[_0x5bd7('0x52')]===_0x5bd7('0x53')){var _0x34e243=_0x282fb8[_0x5bd7('0x21')]({'plain':!![]});return db[_0x5bd7('0x54')]['find']({'where':{'name':_0x5bd7('0x55'),'userProfileId':_0x400a21['userProfileId']},'raw':!![]})[_0x5bd7('0x20')](function(_0x27d455){if(_0x27d455&&_0x27d455[_0x5bd7('0x56')]===0x0){return db[_0x5bd7('0x22')][_0x5bd7('0x4f')]({'name':_0x34e243[_0x5bd7('0x26')],'resourceId':_0x34e243['id'],'type':_0x27d455[_0x5bd7('0x26')],'sectionId':_0x27d455['id']},{})[_0x5bd7('0x20')](function(){return _0x282fb8;});}else{return _0x282fb8;}})[_0x5bd7('0x43')](function(_0x266575){logger[_0x5bd7('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x266575);});}return _0x282fb8;});})[_0x5bd7('0x20')](respondWithResult(_0x2dc5f9,0xc9))['catch'](handleError(_0x2dc5f9,null));};exports[_0x5bd7('0x23')]=function(_0x2a802a,_0x3bf3b2,_0x138d8f){var _0x2f6813;return db[_0x5bd7('0x3d')][_0x5bd7('0x46')]({'where':{'id':_0x2a802a[_0x5bd7('0x45')]['id']}})[_0x5bd7('0x20')](function(_0xe4313a){if(_0xe4313a){return db['sequelize']['transaction'](function(_0x16f81d){return _0xe4313a[_0x5bd7('0x23')]({'transaction':_0x16f81d,'raw':!![]})['then'](function(_0x5aae87){if(_0x5aae87[_0x5bd7('0x4b')]){fs[_0x5bd7('0x57')](_0x5aae87[_0x5bd7('0x4b')])[_0x5bd7('0x58')](function(_0x48eeea){fs['unlinkSync'](path[_0x5bd7('0x4c')](_0x5aae87['directory'],_0x48eeea));});fs[_0x5bd7('0x59')](_0x5aae87['directory']);}return _0x5aae87;});})[_0x5bd7('0x43')](function(_0x5e057f){throw new db[(_0x5bd7('0x5a'))][(_0x5bd7('0x5b'))](_0x5e057f[_0x5bd7('0x5c')]);});}})[_0x5bd7('0x20')](handleEntityNotFound(_0x3bf3b2,null))[_0x5bd7('0x20')](removeEntity(_0x3bf3b2,null))['catch'](handleError(_0x3bf3b2,null));};exports[_0x5bd7('0x5d')]=function(_0x5c8c1a,_0x223a4a,_0x2e75d5){return db[_0x5bd7('0x5e')][_0x5bd7('0x5f')](function(_0x584b1f){var _0x56b14c;return db[_0x5bd7('0x3d')][_0x5bd7('0x46')]({'where':{'id':_0x5c8c1a[_0x5bd7('0x45')]['id']}})['then'](function(_0x2eda72){if(_0x2eda72){_0x56b14c=_0x2eda72;return _0x2eda72[_0x5bd7('0x5d')](_0x5c8c1a['body']['id'],{'transaction':_0x584b1f});}})[_0x5bd7('0x20')](function(_0x138ad4){if(_0x138ad4){return db[_0x5bd7('0x60')]['findOne']({'where':{'id':_0x5c8c1a[_0x5bd7('0x48')]['id']},'attributes':['id',_0x5bd7('0x26'),_0x5bd7('0x61'),'converted_format',_0x5bd7('0x62')],'raw':!![]});}})[_0x5bd7('0x20')](function(_0x505857){if(_0x505857){var _0x184308=path['join'](config[_0x5bd7('0x4d')],_0x5bd7('0x63'),util[_0x5bd7('0x64')](_0x5bd7('0x65'),path[_0x5bd7('0x66')](_0x505857['save_name'],path['extname'](_0x505857[_0x5bd7('0x61')])),_0x505857[_0x5bd7('0x67')]));var _0x388c40=path['join'](config['root'],_0x5bd7('0x4e'),_0x56b14c[_0x5bd7('0x26')],util[_0x5bd7('0x64')](_0x5bd7('0x65'),_0x505857[_0x5bd7('0x26')],_0x505857[_0x5bd7('0x67')]));fs['symlinkSync'](_0x184308,_0x388c40);return _0x505857;}})[_0x5bd7('0x43')](function(_0x27f99d){throw new db[(_0x5bd7('0x5a'))]['ValidationError'](_0x27f99d[_0x5bd7('0x5c')]);});})[_0x5bd7('0x20')](handleEntityNotFound(_0x223a4a,null))[_0x5bd7('0x20')](respondWithResult(_0x223a4a,0xc9))['catch'](handleError(_0x223a4a,null));};exports[_0x5bd7('0x68')]=function(_0x519d89,_0x32ccc7,_0x48a51c){return db[_0x5bd7('0x5e')][_0x5bd7('0x5f')](function(_0x3b0efa){var _0x2c0698;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x519d89[_0x5bd7('0x45')]['id']}})[_0x5bd7('0x20')](handleEntityNotFound(_0x32ccc7,null))['then'](function(_0x274893){if(_0x274893){_0x2c0698=_0x274893;return _0x274893[_0x5bd7('0x68')](_0x519d89[_0x5bd7('0x45')][_0x5bd7('0x69')]);}})['then'](function(_0x1e72af){if(_0x1e72af){return db['Sound'][_0x5bd7('0x6a')]({'where':{'id':_0x519d89[_0x5bd7('0x45')]['id2']},'attributes':['id',_0x5bd7('0x26'),'save_name','converted_format',_0x5bd7('0x62')],'raw':!![]});}})['then'](function(_0x4a1d14){if(_0x4a1d14){fs[_0x5bd7('0x6b')](path['join'](_0x2c0698[_0x5bd7('0x4b')],util[_0x5bd7('0x64')](_0x5bd7('0x65'),_0x4a1d14[_0x5bd7('0x26')],_0x4a1d14[_0x5bd7('0x67')])));return _0x4a1d14;}})[_0x5bd7('0x43')](function(_0x5a6c91){throw new db[(_0x5bd7('0x5a'))][(_0x5bd7('0x5b'))](_0x5a6c91[_0x5bd7('0x5c')]);});})['then'](handleEntityNotFound(_0x32ccc7,null))[_0x5bd7('0x20')](respondWithStatusCode(_0x32ccc7,0xcc))[_0x5bd7('0x43')](handleError(_0x32ccc7,null));};exports['getSounds']=function(_0x13e100,_0x43bd4c,_0x1f4e52){var _0x521c6c={};var _0x588ffd={};var _0x26f738;var _0x2954de;return db['VoiceMusicOnHold'][_0x5bd7('0x6a')]({'where':{'id':_0x13e100[_0x5bd7('0x45')]['id']}})[_0x5bd7('0x20')](handleEntityNotFound(_0x43bd4c,null))[_0x5bd7('0x20')](function(_0x763eb4){if(_0x763eb4){_0x26f738=_0x763eb4;_0x588ffd[_0x5bd7('0x2a')]=_['keys'](db[_0x5bd7('0x60')]['rawAttributes']);_0x588ffd[_0x5bd7('0x2c')]=_[_0x5bd7('0x2d')](_0x13e100[_0x5bd7('0x2c')]);_0x588ffd['filters']=_[_0x5bd7('0x30')](_0x588ffd['model'],_0x588ffd['query']);_0x521c6c[_0x5bd7('0x2f')]=_[_0x5bd7('0x30')](_0x588ffd['model'],qs[_0x5bd7('0x31')](_0x13e100[_0x5bd7('0x2c')][_0x5bd7('0x31')]));_0x521c6c[_0x5bd7('0x2f')]=_0x521c6c[_0x5bd7('0x2f')][_0x5bd7('0x32')]?_0x521c6c[_0x5bd7('0x2f')]:_0x588ffd['model'];_0x521c6c[_0x5bd7('0x35')]=qs[_0x5bd7('0x36')](_0x13e100[_0x5bd7('0x2c')][_0x5bd7('0x36')]);_0x521c6c[_0x5bd7('0x39')]=qs[_0x5bd7('0x2e')](_['pick'](_0x13e100[_0x5bd7('0x2c')],_0x588ffd[_0x5bd7('0x2e')]));if(_0x13e100[_0x5bd7('0x2c')][_0x5bd7('0x38')]){_0x521c6c[_0x5bd7('0x39')]=_['merge'](_0x521c6c[_0x5bd7('0x39')],{'$or':_[_0x5bd7('0x2b')](_0x521c6c['attributes'],function(_0x2d9941){var _0x2d7891={};_0x2d7891[_0x2d9941]={'$like':'%'+_0x13e100[_0x5bd7('0x2c')]['filter']+'%'};return _0x2d7891;})});}_0x521c6c=_[_0x5bd7('0x3a')]({},_0x521c6c,_0x13e100[_0x5bd7('0x3c')]);return _0x26f738[_0x5bd7('0x6c')](_0x521c6c);}})[_0x5bd7('0x20')](function(_0x533720){if(_0x533720){_0x2954de=_0x533720[_0x5bd7('0x32')];if(!_0x13e100[_0x5bd7('0x2c')][_0x5bd7('0x33')](_0x5bd7('0x34'))){_0x521c6c[_0x5bd7('0x1c')]=qs[_0x5bd7('0x1c')](_0x13e100[_0x5bd7('0x2c')][_0x5bd7('0x1c')]);_0x521c6c['offset']=qs[_0x5bd7('0x1a')](_0x13e100['query'][_0x5bd7('0x1a')]);}return _0x26f738[_0x5bd7('0x6c')](_0x521c6c);}})['then'](function(_0x22aaeb){if(_0x22aaeb){return _0x22aaeb?{'count':_0x2954de,'rows':_0x22aaeb}:null;}})[_0x5bd7('0x20')](respondWithResult(_0x43bd4c,null))[_0x5bd7('0x43')](handleError(_0x43bd4c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7fd4a6c..38f5075 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1b6=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','moment'];(function(_0x2dbd35,_0x16a0ea){var _0x54be26=function(_0x2c3727){while(--_0x2c3727){_0x2dbd35['push'](_0x2dbd35['shift']());}};_0x54be26(++_0x16a0ea);}(_0xc1b6,0x165));var _0x6c1b=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0xc1b6[_0x16f77c];return _0x78986e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c1b('0x0'))(_0x6c1b('0x1'));var moment=require(_0x6c1b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c1b('0x3'));var rimraf=require(_0x6c1b('0x4'));var config=require(_0x6c1b('0x5'));var attributes=require(_0x6c1b('0x6'));module['exports']=function(_0x1d55f0,_0x45eb9c){return _0x1d55f0['define'](_0x6c1b('0x7'),attributes,{'tableName':_0x6c1b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cb9=['path','rimraf','../../config/environment','exports','lodash','moment','bluebird','request-promise'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2cb9,0x1ac));var _0x92cb=function(_0x1a60da,_0x1523ea){_0x1a60da=_0x1a60da-0x0;var _0x5d5a26=_0x2cb9[_0x1a60da];return _0x5d5a26;};'use strict';var _=require(_0x92cb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x92cb('0x1'));var BPromise=require(_0x92cb('0x2'));var rp=require(_0x92cb('0x3'));var fs=require('fs');var path=require(_0x92cb('0x4'));var rimraf=require(_0x92cb('0x5'));var config=require(_0x92cb('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x92cb('0x7')]=function(_0x528a55,_0x5a4ba0){return _0x528a55['define']('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 2ccd807..e25783e 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x6b2b9f,_0x573f4f){var _0x1933a5=function(_0x32e2b5){while(--_0x32e2b5){_0x6b2b9f['push'](_0x6b2b9f['shift']());}};_0x1933a5(++_0x573f4f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x712b07,_0x553a4e){var _0x69374d=function(_0x5bb830){while(--_0x5bb830){_0x712b07['push'](_0x712b07['shift']());}};_0x69374d(++_0x553a4e);}(_0xe706,0xa3));var _0x6e70=function(_0x2bdf04,_0x5e608e){_0x2bdf04=_0x2bdf04-0x0;var _0x33ce04=_0xe706[_0x2bdf04];return _0x33ce04;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4613e6a..c5a32fb 100644 --- a/server/api/voicePrefix/index.js +++ b/server/api/voicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f8=['getTeams','post','/:id/users','addAgents','addTeams','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','getAgents','/:id/teams'];(function(_0x4c4d9c,_0x5bd0eb){var _0x5063fb=function(_0x46cb30){while(--_0x46cb30){_0x4c4d9c['push'](_0x4c4d9c['shift']());}};_0x5063fb(++_0x5bd0eb);}(_0x34f8,0x80));var _0x834f=function(_0x3c9b8d,_0x435d7f){_0x3c9b8d=_0x3c9b8d-0x0;var _0x44314f=_0x34f8[_0x3c9b8d];return _0x44314f;};'use strict';var multer=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var path=require(_0x834f('0x2'));var timeout=require(_0x834f('0x3'));var express=require(_0x834f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x834f('0x5'));var interaction=require(_0x834f('0x6'));var config=require('../../config/environment');var controller=require(_0x834f('0x7'));router[_0x834f('0x8')]('/',auth[_0x834f('0x9')](),controller[_0x834f('0xa')]);router['get']('/describe',auth[_0x834f('0x9')](),controller[_0x834f('0xb')]);router[_0x834f('0x8')](_0x834f('0xc'),auth['isAuthenticated'](),controller[_0x834f('0xd')]);router[_0x834f('0x8')]('/:id/users',auth[_0x834f('0x9')](),controller[_0x834f('0xe')]);router[_0x834f('0x8')](_0x834f('0xf'),auth[_0x834f('0x9')](),controller[_0x834f('0x10')]);router[_0x834f('0x11')]('/',auth[_0x834f('0x9')](),controller['create']);router[_0x834f('0x11')](_0x834f('0x12'),auth[_0x834f('0x9')](),controller[_0x834f('0x13')]);router[_0x834f('0x11')]('/:id/teams',auth[_0x834f('0x9')](),controller[_0x834f('0x14')]);router['put'](_0x834f('0xc'),auth[_0x834f('0x9')](),controller['update']);router[_0x834f('0x15')]('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0x16')]);router[_0x834f('0x15')](_0x834f('0x12'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x834f('0x15')](_0x834f('0xf'),auth[_0x834f('0x9')](),controller[_0x834f('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd24d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeAgents','multer','util','express','Router'];(function(_0x1daa21,_0x346bb2){var _0x1e32e7=function(_0x5320cf){while(--_0x5320cf){_0x1daa21['push'](_0x1daa21['shift']());}};_0x1e32e7(++_0x346bb2);}(_0xd24d,0x168));var _0xdd24=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd24d[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xdd24('0x0'));var util=require(_0xdd24('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd24('0x2'));var router=express[_0xdd24('0x3')]();var fs_extra=require(_0xdd24('0x4'));var auth=require(_0xdd24('0x5'));var interaction=require(_0xdd24('0x6'));var config=require(_0xdd24('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdd24('0x8')]);router[_0xdd24('0x9')](_0xdd24('0xa'),auth[_0xdd24('0xb')](),controller[_0xdd24('0xc')]);router[_0xdd24('0x9')](_0xdd24('0xd'),auth['isAuthenticated'](),controller[_0xdd24('0xe')]);router[_0xdd24('0x9')](_0xdd24('0xf'),auth[_0xdd24('0xb')](),controller['getAgents']);router['get'](_0xdd24('0x10'),auth[_0xdd24('0xb')](),controller[_0xdd24('0x11')]);router[_0xdd24('0x12')]('/',auth['isAuthenticated'](),controller[_0xdd24('0x13')]);router[_0xdd24('0x12')]('/:id/users',auth[_0xdd24('0xb')](),controller[_0xdd24('0x14')]);router[_0xdd24('0x12')](_0xdd24('0x10'),auth['isAuthenticated'](),controller[_0xdd24('0x15')]);router[_0xdd24('0x16')](_0xdd24('0xd'),auth[_0xdd24('0xb')](),controller[_0xdd24('0x17')]);router[_0xdd24('0x18')](_0xdd24('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xdd24('0xf'),auth['isAuthenticated'](),controller[_0xdd24('0x19')]);router['delete']('/:id/teams',auth[_0xdd24('0xb')](),controller['removeTeams']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9d3632f..3e6543b 100644 --- a/server/api/voicePrefix/voicePrefix.attributes.js +++ b/server/api/voicePrefix/voicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aec=['VIRTUAL','STRING','name'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x0aec,0xbb));var _0xc0ae=function(_0x2bfa34,_0x2ad8c0){_0x2bfa34=_0x2bfa34-0x0;var _0x411a60=_0x0aec[_0x2bfa34];return _0x411a60;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc0ae('0x0')],'allowNull':![],'unique':_0xc0ae('0x1')},'prefix':{'type':Sequelize[_0xc0ae('0x2')],'get':function(_0xbc6b18){return'system-'+this['getDataValue'](_0xc0ae('0x1'))+'-';}},'description':{'type':Sequelize[_0xc0ae('0x0')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9de1=['system-','sequelize','exports','STRING','name'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9de1,0x1dc));var _0x19de=function(_0x2b2c2f,_0x645409){_0x2b2c2f=_0x2b2c2f-0x0;var _0x2984ea=_0x9de1[_0x2b2c2f];return _0x2984ea;};'use strict';var Sequelize=require(_0x19de('0x0'));module[_0x19de('0x1')]={'name':{'type':Sequelize[_0x19de('0x2')],'allowNull':![],'unique':_0x19de('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x4e0659){return _0x19de('0x4')+this['getDataValue'](_0x19de('0x3'))+'-';}},'description':{'type':Sequelize[_0x19de('0x2')]},'callerIdAll':{'type':Sequelize[_0x19de('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e8631ff..5b390ca 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4991=['VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','describe','create','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','NoOp','goto','context','charAt','system-','findById','addAgents','ids','omit','emit','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','Team','findAll','User','interface','Agents','sequelize','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','map'];(function(_0x57f7ea,_0x54da6b){var _0x54a7e4=function(_0x2c9d4f){while(--_0x2c9d4f){_0x57f7ea['push'](_0x57f7ea['shift']());}};_0x54a7e4(++_0x54da6b);}(_0x4991,0xf7));var _0x1499=function(_0x1fd344,_0x572281){_0x1fd344=_0x1fd344-0x0;var _0x397c9f=_0x4991[_0x1fd344];return _0x397c9f;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1499('0x17')]=_[_0x1499('0x18')](config[_0x1499('0x17')],{'host':_0x1499('0x19'),'port':0x18eb});var socket=require(_0x1499('0x1a'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x1499('0x1b')](socket);function respondWithStatusCode(_0x4e5195,_0x37d99e){_0x37d99e=_0x37d99e||0xcc;return function(_0x12cde0){if(_0x12cde0){return _0x4e5195[_0x1499('0x1c')](_0x37d99e);}return _0x4e5195[_0x1499('0x1d')](_0x37d99e)['end']();};}function respondWithResult(_0x1ed43b,_0x373f57){_0x373f57=_0x373f57||0xc8;return function(_0x592c27){if(_0x592c27){return _0x1ed43b[_0x1499('0x1d')](_0x373f57)[_0x1499('0x1e')](_0x592c27);}};}function respondWithFilteredResult(_0x46b364,_0xc92272){return function(_0x1e45a9){if(_0x1e45a9){var _0x27e533=typeof _0xc92272['offset']==='undefined'&&typeof _0xc92272['limit']===_0x1499('0x1f');var _0xad534b=_0x1e45a9['count'];var _0x351da9=_0x27e533?0x0:_0xc92272[_0x1499('0x20')];var _0x28dff3=_0x27e533?_0x1e45a9[_0x1499('0x21')]:_0xc92272[_0x1499('0x20')]+_0xc92272[_0x1499('0x22')];var _0x2b0458;if(_0x28dff3>=_0xad534b){_0x28dff3=_0xad534b;_0x2b0458=0xc8;}else{_0x2b0458=0xce;}_0x46b364[_0x1499('0x1d')](_0x2b0458);return _0x46b364[_0x1499('0x23')](_0x1499('0x24'),_0x351da9+'-'+_0x28dff3+'/'+_0xad534b)[_0x1499('0x1e')](_0x1e45a9);}return null;};}function patchUpdates(_0x836081){return function(_0x223f4c){try{jsonpatch[_0x1499('0x25')](_0x223f4c,_0x836081,!![]);}catch(_0x4ec57a){return BPromise[_0x1499('0x26')](_0x4ec57a);}return _0x223f4c[_0x1499('0x27')]();};}function saveUpdates(_0x5615b4,_0x258e9c){return function(_0xc79f69){if(_0xc79f69){return _0xc79f69[_0x1499('0x28')](_0x5615b4)[_0x1499('0x29')](function(_0x3968e0){return _0x3968e0;});}return null;};}function removeEntity(_0x16d036,_0x54f3c2){return function(_0x501c0d){if(_0x501c0d){return _0x501c0d[_0x1499('0x2a')]()[_0x1499('0x29')](function(){var _0x3b9259=_0x501c0d[_0x1499('0x2b')]({'plain':!![]});var _0x32782a='VoicePrefixes';return db[_0x1499('0x2c')]['destroy']({'where':{'type':_0x32782a,'resourceId':_0x3b9259['id']}})['then'](function(){return _0x501c0d;});})['then'](function(){_0x16d036[_0x1499('0x1d')](0xcc)[_0x1499('0x2d')]();});}};}function handleEntityNotFound(_0x40932a,_0x1b460b){return function(_0x3dad86){if(!_0x3dad86){_0x40932a[_0x1499('0x1c')](0x194);}return _0x3dad86;};}function handleError(_0x3dd534,_0x5d3ec5){_0x5d3ec5=_0x5d3ec5||0x1f4;return function(_0x180171){logger[_0x1499('0x2e')](_0x180171[_0x1499('0x2f')]);if(_0x180171['name']){delete _0x180171[_0x1499('0x30')];}_0x3dd534[_0x1499('0x1d')](_0x5d3ec5)['send'](_0x180171);};}exports[_0x1499('0x31')]=function(_0x72ad,_0x497efd){var _0x464c5a={},_0x2eda80={},_0x15cc57={'count':0x0,'rows':[]};var _0x39f74f=_[_0x1499('0x32')](db[_0x1499('0x33')][_0x1499('0x34')],function(_0x18b662){return{'name':_0x18b662[_0x1499('0x35')],'type':_0x18b662[_0x1499('0x36')][_0x1499('0x37')]};});_0x2eda80[_0x1499('0x38')]=_[_0x1499('0x32')](_0x39f74f,_0x1499('0x30'));_0x2eda80[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x72ad[_0x1499('0x39')]);_0x2eda80[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],_0x2eda80['query']);_0x464c5a[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x2eda80[_0x1499('0x38')],qs[_0x1499('0x3e')](_0x72ad[_0x1499('0x39')][_0x1499('0x3e')]));_0x464c5a[_0x1499('0x3d')]=_0x464c5a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x464c5a[_0x1499('0x3d')]:_0x2eda80[_0x1499('0x38')];if(!_0x72ad['query']['hasOwnProperty'](_0x1499('0x40'))){_0x464c5a['limit']=qs[_0x1499('0x22')](_0x72ad['query'][_0x1499('0x22')]);_0x464c5a[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x72ad[_0x1499('0x39')]['offset']);}_0x464c5a[_0x1499('0x41')]=qs['sort'](_0x72ad[_0x1499('0x39')][_0x1499('0x42')]);_0x464c5a[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x72ad[_0x1499('0x39')],_0x2eda80[_0x1499('0x3b')]),_0x39f74f);if(_0x72ad[_0x1499('0x39')][_0x1499('0x44')]){_0x464c5a['where']=_[_0x1499('0x45')](_0x464c5a['where'],{'$or':_[_0x1499('0x32')](_0x39f74f,function(_0x38f449){if(_0x38f449[_0x1499('0x36')]!==_0x1499('0x46')){var _0x3ed978={};_0x3ed978[_0x38f449[_0x1499('0x30')]]={'$like':'%'+_0x72ad[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x3ed978;}})});}_0x464c5a=_[_0x1499('0x45')]({},_0x464c5a,_0x72ad[_0x1499('0x47')]);var _0x5ab521={'where':_0x464c5a[_0x1499('0x43')]};return db['VoicePrefix'][_0x1499('0x21')](_0x5ab521)[_0x1499('0x29')](function(_0x5646cf){_0x15cc57[_0x1499('0x21')]=_0x5646cf;if(_0x72ad[_0x1499('0x39')][_0x1499('0x48')]){_0x464c5a[_0x1499('0x49')]=[{'all':!![]}];}return db[_0x1499('0x33')]['findAll'](_0x464c5a);})['then'](function(_0x368fdb){_0x15cc57[_0x1499('0x4a')]=_0x368fdb;return _0x15cc57;})['then'](respondWithFilteredResult(_0x497efd,_0x464c5a))[_0x1499('0x4b')](handleError(_0x497efd,null));};exports[_0x1499('0x4c')]=function(_0x4a5529,_0x5de9b6){var _0x3814aa={'raw':![],'where':{'id':_0x4a5529[_0x1499('0x4d')]['id']}},_0x177147={};_0x177147['model']=_[_0x1499('0x3a')](db[_0x1499('0x33')][_0x1499('0x34')]);_0x177147[_0x1499('0x39')]=_['keys'](_0x4a5529[_0x1499('0x39')]);_0x177147[_0x1499('0x3b')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],_0x177147['query']);_0x3814aa[_0x1499('0x3d')]=_[_0x1499('0x3c')](_0x177147[_0x1499('0x38')],qs['fields'](_0x4a5529['query'][_0x1499('0x3e')]));_0x3814aa['attributes']=_0x3814aa[_0x1499('0x3d')][_0x1499('0x3f')]?_0x3814aa[_0x1499('0x3d')]:_0x177147[_0x1499('0x38')];if(_0x4a5529[_0x1499('0x39')][_0x1499('0x48')]){_0x3814aa[_0x1499('0x49')]=[{'all':!![]}];}_0x3814aa=_['merge']({},_0x3814aa,_0x4a5529[_0x1499('0x47')]);return db['VoicePrefix'][_0x1499('0x4e')](_0x3814aa)[_0x1499('0x29')](handleEntityNotFound(_0x5de9b6,null))['then'](respondWithResult(_0x5de9b6,null))[_0x1499('0x4b')](handleError(_0x5de9b6,null));};exports[_0x1499('0x2a')]=function(_0x3de674,_0x4d1d24){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x3de674[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x4d1d24,null))[_0x1499('0x29')](removeEntity(_0x4d1d24,null))[_0x1499('0x4b')](handleError(_0x4d1d24,null));};exports[_0x1499('0x4f')]=function(_0x3b7a6b,_0x28822a){return db[_0x1499('0x33')]['describe']()[_0x1499('0x29')](respondWithResult(_0x28822a,null))[_0x1499('0x4b')](handleError(_0x28822a,null));};exports[_0x1499('0x50')]=function(_0x4dc648,_0x339471){var _0x2a7614;return db['sequelize'][_0x1499('0x51')](function(_0x162ddb){return db['VoicePrefix'][_0x1499('0x50')](_0x4dc648[_0x1499('0x52')],{'transaction':_0x162ddb})[_0x1499('0x29')](function(_0x30b27b){_0x2a7614=_0x30b27b[_0x1499('0x2b')]({'plain':!![]});return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x2a7614['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x2a9f23){return createVoicePrefixExtensions(_0x2a7614,_0x2a9f23,_0x162ddb);});});})[_0x1499('0x29')](function(){var _0x175b8d=_0x4dc648['user']['get']({'plain':!![]});if(!_0x175b8d)throw new Error(_0x1499('0x54'));if(_0x175b8d[_0x1499('0x55')]==='user'){var _0x3c3a20=_0x2a7614;return db[_0x1499('0x56')][_0x1499('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x175b8d['userProfileId']},'raw':!![]})['then'](function(_0x308ce2){if(_0x308ce2&&_0x308ce2[_0x1499('0x57')]===0x0){return db[_0x1499('0x2c')]['create']({'name':_0x3c3a20[_0x1499('0x30')],'resourceId':_0x3c3a20['id'],'type':_0x308ce2['name'],'sectionId':_0x308ce2['id']},{})[_0x1499('0x29')](function(){return _0x2a7614;});}else{return _0x2a7614;}})[_0x1499('0x4b')](function(_0x2fc6f9){logger[_0x1499('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fc6f9);throw _0x2fc6f9;});}return _0x2a7614;})['then'](respondWithResult(_0x339471,null))['catch'](handleError(_0x339471,null));};function Extension(_0x403832,_0x42629d,_0x1e9261,_0x28866f){this['context']=_0x1499('0x58');this[_0x1499('0x59')]=_0x403832;this['app']=_0x1e9261;this[_0x1499('0x36')]='system';this[_0x1499('0x5a')]=_0x1499('0x5b');this[_0x1499('0x5c')]=_0x42629d;this['appdata']=_0x28866f;}function createVoicePrefixExtensions(_0x739e63,_0xca5326,_0x253706){return new BPromise(function(_0x5b2dab,_0x761610){var _0x3ff1ce=new Extension(formatPrefixName(_0x739e63[_0x1499('0x5d')]),0x1,'NoOp',_0x1499('0x5e'));_0x3ff1ce[_0x1499('0x5f')]=_0x739e63['id'];return db[_0x1499('0x53')][_0x1499('0x50')](_0x3ff1ce,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x96a0ed){var _0x5c61dc=_0x96a0ed[_0x1499('0x2b')]({'plain':!![]});var _0x10b49f=_['map'](addVoicePrefixExtensions(_0x739e63,_0xca5326),function(_0x3839da){_0x3839da[_0x1499('0x60')]=_0x5c61dc['id'];_0x3839da[_0x1499('0x5f')]=_0x739e63['id'];return _0x3839da;});return db[_0x1499('0x53')][_0x1499('0x61')](_0x10b49f,{'transaction':_0x253706})[_0x1499('0x29')](function(_0x5e5ee4){if(!_0x5e5ee4){return _0x761610(_0x1499('0x62'));}else{return _0x5b2dab(_0x5e5ee4);}})[_0x1499('0x4b')](function(_0x4eec83){return _0x761610(_0x4eec83);});});;});};function addVoicePrefixExtensions(_0x4a0487,_0x1ff29d){var _0x314d88=[];var _0x502474=formatPrefixName(_0x4a0487[_0x1499('0x5d')]);_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x2,_0x1499('0x64'),_0x1499('0x65')+_0x4a0487[_0x1499('0x30')]));if(_0x4a0487['callerIdAll']){_0x314d88['push'](new Extension(_0x502474,0x3,_0x1499('0x64'),'PREFIX-CALLERIDALL='+_0x4a0487['callerIdAll']));}else{_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x3,_0x1499('0x66'),'No\x20callerid\x20available'));}_0x314d88[_0x1499('0x63')](new Extension(_0x502474,0x4,_0x1499('0x67'),_0x1ff29d[_0x1499('0x68')]+','+'${EXTEN:'+(0x8+_0x4a0487['name'][_0x1499('0x3f')])+'}'+','+0x1));return _0x314d88;}function formatPrefixName(_0x2f3a3a){var _0x256893='_';for(var _0x392f6f=0x0;_0x392f6f<_0x2f3a3a[_0x1499('0x3f')];_0x392f6f++){if(_0x2f3a3a['charAt'](_0x392f6f)=='-'){_0x256893+=_0x2f3a3a[_0x1499('0x69')](_0x392f6f);}else{_0x256893+='['+_0x2f3a3a[_0x1499('0x69')](_0x392f6f)+']';}}_0x256893+='.';return _0x256893;}exports['update']=function(_0x358a76,_0x20e5f3,_0x44d970){var _0x5741e5=_0x358a76[_0x1499('0x52')];_0x5741e5[_0x1499('0x5d')]=_0x1499('0x6a')+_0x5741e5[_0x1499('0x30')]+'-';return db['sequelize'][_0x1499('0x51')](function(_0x74e09b){return db[_0x1499('0x33')]['update'](_0x5741e5,{'where':{'id':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x2a')]({'where':{'VoicePrefixId':_0x5741e5['id']},'transaction':_0x74e09b})[_0x1499('0x29')](function(){return db[_0x1499('0x53')][_0x1499('0x4e')]({'where':{'id':_0x5741e5['VoiceExtensionId']},'raw':!![]})[_0x1499('0x29')](function(_0x57e25b){return createVoicePrefixExtensions(_0x5741e5,_0x57e25b,_0x74e09b);});});});})['then'](function(){return db[_0x1499('0x33')][_0x1499('0x6b')](_0x5741e5['id']);})[_0x1499('0x29')](respondWithResult(_0x20e5f3,null))['catch'](handleError(_0x20e5f3,null));};exports['addAgents']=function(_0x320654,_0xb4a84b,_0x494d88){return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x320654[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0xb4a84b,null))[_0x1499('0x29')](function(_0x3f6f36){if(_0x3f6f36){return _0x3f6f36[_0x1499('0x6c')](_0x320654['body'][_0x1499('0x6d')],_[_0x1499('0x6e')](_0x320654['body'],[_0x1499('0x6d'),'id'])||{})['spread'](function(_0x25a8c4){for(var _0x375576=0x0;_0x375576<_0x320654[_0x1499('0x52')][_0x1499('0x6d')]['length'];_0x375576+=0x1){socket[_0x1499('0x6f')]('userVoicePrefix:save',{'UserId':Number(_0x320654[_0x1499('0x52')]['ids'][_0x375576]),'VoicePrefixId':Number(_0x320654[_0x1499('0x4d')]['id'])});}return _0x25a8c4;});}})[_0x1499('0x29')](respondWithResult(_0xb4a84b,null))[_0x1499('0x4b')](handleError(_0xb4a84b,null));};exports['removeAgents']=function(_0x2349d7,_0x44511c,_0x585fe8){return db['VoicePrefix'][_0x1499('0x4e')]({'where':{'id':_0x2349d7['params']['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x44511c,null))['then'](function(_0x917508){if(_0x917508){return _0x917508['removeAgents'](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])[_0x1499('0x29')](function(){if(_[_0x1499('0x70')](_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')])){for(var _0x114aea=0x0;_0x114aea<_0x2349d7[_0x1499('0x39')]['ids'][_0x1499('0x3f')];_0x114aea+=0x1){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':Number(_0x2349d7['query'][_0x1499('0x6d')][_0x114aea]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}}else{socket['emit'](_0x1499('0x71'),{'UserId':Number(_0x2349d7[_0x1499('0x39')][_0x1499('0x6d')]),'VoicePrefixId':Number(_0x2349d7[_0x1499('0x4d')]['id'])});}});}})[_0x1499('0x29')](respondWithStatusCode(_0x44511c,null))['catch'](handleError(_0x44511c,null));};exports[_0x1499('0x72')]=function(_0x53700c,_0x5ed058,_0x5cc567){var _0x2a0525={};var _0x362d8c={};var _0x419d9a;var _0x23dfc0;return db[_0x1499('0x33')][_0x1499('0x73')]({'where':{'id':_0x53700c['params']['id']}})['then'](handleEntityNotFound(_0x5ed058,null))[_0x1499('0x29')](function(_0x20e0d7){if(_0x20e0d7){_0x419d9a=_0x20e0d7;_0x362d8c['model']=_[_0x1499('0x3a')](db['User'][_0x1499('0x34')]);_0x362d8c['query']=_[_0x1499('0x3a')](_0x53700c['query']);_0x362d8c[_0x1499('0x3b')]=_['intersection'](_0x362d8c[_0x1499('0x38')],_0x362d8c[_0x1499('0x39')]);_0x2a0525['attributes']=_[_0x1499('0x3c')](_0x362d8c[_0x1499('0x38')],qs['fields'](_0x53700c[_0x1499('0x39')][_0x1499('0x3e')]));_0x2a0525[_0x1499('0x3d')]=_0x2a0525[_0x1499('0x3d')][_0x1499('0x3f')]?_0x2a0525[_0x1499('0x3d')]:_0x362d8c[_0x1499('0x38')];_0x2a0525['order']=qs[_0x1499('0x42')](_0x53700c[_0x1499('0x39')]['sort']);_0x2a0525[_0x1499('0x43')]=qs[_0x1499('0x3b')](_['pick'](_0x53700c[_0x1499('0x39')],_0x362d8c[_0x1499('0x3b')]));if(_0x53700c['query'][_0x1499('0x44')]){_0x2a0525[_0x1499('0x43')]=_[_0x1499('0x45')](_0x2a0525[_0x1499('0x43')],{'$or':_[_0x1499('0x32')](_0x2a0525[_0x1499('0x3d')],function(_0x1f4794){var _0x43b74b={};_0x43b74b[_0x1f4794]={'$like':'%'+_0x53700c['query'][_0x1499('0x44')]+'%'};return _0x43b74b;})});}_0x2a0525=_[_0x1499('0x45')]({},_0x2a0525,_0x53700c[_0x1499('0x47')]);return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x3fa3a4){if(_0x3fa3a4){_0x23dfc0=_0x3fa3a4['length'];if(!_0x53700c['query']['hasOwnProperty'](_0x1499('0x40'))){_0x2a0525[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x53700c[_0x1499('0x39')][_0x1499('0x22')]);_0x2a0525[_0x1499('0x20')]=qs[_0x1499('0x20')](_0x53700c[_0x1499('0x39')]['offset']);}return _0x419d9a[_0x1499('0x72')](_0x2a0525);}})[_0x1499('0x29')](function(_0x59a12f){if(_0x59a12f){return _0x59a12f?{'count':_0x23dfc0,'rows':_0x59a12f}:null;}})['then'](respondWithResult(_0x5ed058,null))[_0x1499('0x4b')](handleError(_0x5ed058,null));};exports['getTeams']=function(_0x52282e,_0x5666f5,_0x63c7b3){var _0x118d7a={};var _0x23fd46={};var _0x30ba76;var _0x3c91d2;return db['VoicePrefix']['findOne']({'where':{'id':_0x52282e[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](handleEntityNotFound(_0x5666f5,null))[_0x1499('0x29')](function(_0x497619){if(_0x497619){_0x30ba76=_0x497619;_0x23fd46[_0x1499('0x38')]=_['keys'](db['Team'][_0x1499('0x34')]);_0x23fd46['query']=_[_0x1499('0x3a')](_0x52282e['query']);_0x23fd46[_0x1499('0x3b')]=_['intersection'](_0x23fd46[_0x1499('0x38')],_0x23fd46[_0x1499('0x39')]);_0x118d7a['attributes']=_[_0x1499('0x3c')](_0x23fd46['model'],qs[_0x1499('0x3e')](_0x52282e[_0x1499('0x39')][_0x1499('0x3e')]));_0x118d7a[_0x1499('0x3d')]=_0x118d7a[_0x1499('0x3d')][_0x1499('0x3f')]?_0x118d7a[_0x1499('0x3d')]:_0x23fd46[_0x1499('0x38')];_0x118d7a[_0x1499('0x41')]=qs[_0x1499('0x42')](_0x52282e[_0x1499('0x39')][_0x1499('0x42')]);_0x118d7a[_0x1499('0x43')]=qs['filters'](_[_0x1499('0x74')](_0x52282e[_0x1499('0x39')],_0x23fd46[_0x1499('0x3b')]));if(_0x52282e[_0x1499('0x39')]['filter']){_0x118d7a[_0x1499('0x43')]=_[_0x1499('0x45')](_0x118d7a['where'],{'$or':_['map'](_0x118d7a[_0x1499('0x3d')],function(_0x1fbf21){var _0x2d4e5a={};_0x2d4e5a[_0x1fbf21]={'$like':'%'+_0x52282e[_0x1499('0x39')][_0x1499('0x44')]+'%'};return _0x2d4e5a;})});}_0x118d7a=_[_0x1499('0x45')]({},_0x118d7a,_0x52282e[_0x1499('0x47')]);return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})[_0x1499('0x29')](function(_0x2dd404){if(_0x2dd404){_0x3c91d2=_0x2dd404['length'];if(!_0x52282e['query']['hasOwnProperty'](_0x1499('0x40'))){_0x118d7a[_0x1499('0x22')]=qs[_0x1499('0x22')](_0x52282e[_0x1499('0x39')][_0x1499('0x22')]);_0x118d7a[_0x1499('0x20')]=qs['offset'](_0x52282e[_0x1499('0x39')][_0x1499('0x20')]);}return _0x30ba76[_0x1499('0x75')](_0x118d7a);}})['then'](function(_0x4a11e4){if(_0x4a11e4){return _0x4a11e4?{'count':_0x3c91d2,'rows':_0x4a11e4}:null;}})[_0x1499('0x29')](respondWithResult(_0x5666f5,null))[_0x1499('0x4b')](handleError(_0x5666f5,null));};exports['addTeams']=function(_0x47f7e8,_0x4e5f60,_0x2f9c93){var _0x23e2c6=_0x47f7e8['body'][_0x1499('0x6d')];var _0x7dd273;return db[_0x1499('0x76')][_0x1499('0x77')]({'where':{'id':_0x23e2c6},'attributes':['id'],'include':[{'model':db[_0x1499('0x78')],'as':'Agents','attributes':['id','name','online','voicePause',_0x1499('0x79')],'raw':!![]}]})[_0x1499('0x29')](function(_0x14e4e8){if(_0x14e4e8){_0x7dd273=_0x14e4e8;var _0x5a675b=_['flatMap'](_0x14e4e8,function(_0x479936){var _0x2add75=_0x479936[_0x1499('0x2b')]({'plain':!![]});return _0x2add75[_0x1499('0x7a')];});return db[_0x1499('0x33')][_0x1499('0x4e')]({'where':{'id':_0x47f7e8[_0x1499('0x4d')]['id']}})[_0x1499('0x29')](function(_0x420576){return db[_0x1499('0x7b')]['transaction'](function(_0x3f5aab){return _0x420576['addTeams'](_0x23e2c6,{'transaction':_0x3f5aab})[_0x1499('0x29')](function(){return BPromise[_0x1499('0x7c')](_0x7dd273,function(_0x425dac){return db[_0x1499('0x7d')][_0x1499('0x7e')]({'TeamId':_0x425dac['id'],'VoicePrefixId':_0x47f7e8[_0x1499('0x4d')]['id']},{'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){return BPromise['each'](_0x5a675b,function(_0x56507a){return db[_0x1499('0x7f')][_0x1499('0x80')]({'where':{'UserId':_0x56507a['id'],'VoicePrefixId':_0x47f7e8['params']['id']},'transaction':_0x3f5aab});});})[_0x1499('0x29')](function(){_0x5a675b[_0x1499('0x81')](function(_0x477bb9){socket['emit']('userVoicePrefix:save',{'UserId':_0x477bb9['id'],'VoicePrefixId':_0x420576['id']});});});});});}})[_0x1499('0x29')](respondWithStatusCode(_0x4e5f60,null))['catch'](handleError(_0x4e5f60,null));};exports[_0x1499('0x82')]=function(_0x3f366a,_0x11ef6,_0x548faf){return db['Team']['findAll']({'where':{'id':_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1499('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11ef6,null))['then'](function(_0x10f4cf){var _0x5d1170=_['map'](_0x10f4cf,'id');var _0x52de11=[];var _0x2e39ac=[];var _0x4a9e81=squel[_0x1499('0x83')]();_0x4a9e81[_0x1499('0x84')](_0x1499('0x85'))[_0x1499('0x86')](_0x1499('0x87'),'tq')['join'](_0x1499('0x88'),'ut',_0x1499('0x89'))[_0x1499('0x43')]('VoicePrefixId\x20=\x20?',_0x3f366a[_0x1499('0x4d')]['id']);for(var _0x772b0c=0x0;_0x772b0c<_0x10f4cf[_0x1499('0x3f')];_0x772b0c+=0x1){let _0x27135a=_0x10f4cf[_0x772b0c];for(var _0x1e9c28=0x0;_0x1e9c28<_0x27135a[_0x1499('0x7a')][_0x1499('0x3f')];_0x1e9c28+=0x1){let _0x2c1793=_0x27135a['Agents'][_0x1e9c28];var _0x39d6a9=_0x4a9e81[_0x1499('0x8a')]();_0x39d6a9[_0x1499('0x43')]('ut.UserId\x20=\x20?',_0x2c1793['id']);_0x2e39ac[_0x1499('0x63')](db[_0x1499('0x7b')][_0x1499('0x39')](_0x39d6a9[_0x1499('0x8b')](),{'type':db[_0x1499('0x7b')][_0x1499('0x8c')]['SELECT']})[_0x1499('0x29')](function(_0x18d9bc){if(_0x18d9bc['length']===0x1){return _0x2c1793['id'];}else{var _0x271d85=_[_0x1499('0x8d')](_[_0x1499('0x32')](_0x18d9bc,'TeamId'),function(_0x53659b){return _[_0x1499('0x8e')](_0x5d1170,_0x53659b);});if(_0x271d85){return _0x2c1793['id'];}}}));}}return BPromise[_0x1499('0x8f')](_0x2e39ac)[_0x1499('0x29')](function(_0x6478eb){_0x52de11=_(_0x52de11)[_0x1499('0x90')](_0x6478eb)[_0x1499('0x91')]()[_0x1499('0x92')]();return db[_0x1499('0x33')]['find']({'where':{'id':_0x3f366a['params']['id']}})['then'](function(_0x335af4){return db[_0x1499('0x7b')]['transaction'](function(_0x2c5702){return _0x335af4['removeTeams'](_0x3f366a[_0x1499('0x39')][_0x1499('0x6d')],{'transaction':_0x2c5702})['then'](function(){if(!_[_0x1499('0x93')](_0x52de11)){return _0x335af4[_0x1499('0x94')](_0x52de11,{'transaction':_0x2c5702});}})[_0x1499('0x29')](function(){_0x52de11['forEach'](function(_0x3e7f29){socket[_0x1499('0x6f')](_0x1499('0x71'),{'UserId':_0x3e7f29,'VoicePrefixId':_0x335af4['id']});});});});});});})[_0x1499('0x29')](respondWithStatusCode(_0x11ef6,null))[_0x1499('0x4b')](handleError(_0x11ef6,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8603,0x190));var _0x3860=function(_0x582d6e,_0x2b5cd0){_0x582d6e=_0x582d6e-0x0;var _0x4bbe=_0x8603[_0x582d6e];return _0x4bbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 030255d..4ba5b3b 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x962e=['events','../../mysqldb','VoicePrefix','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x19b604,_0x225957){var _0x540421=function(_0xebfd36){while(--_0xebfd36){_0x19b604['push'](_0x19b604['shift']());}};_0x540421(++_0x225957);}(_0x962e,0x75));var _0xe962=function(_0x5cf94d,_0x3e9b52){_0x5cf94d=_0x5cf94d-0x0;var _0x3242a6=_0x962e[_0x5cf94d];return _0x3242a6;};'use strict';var EventEmitter=require(_0xe962('0x0'));var VoicePrefix=require(_0xe962('0x1'))['db'][_0xe962('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe962('0x3'),'afterUpdate':_0xe962('0x4'),'afterDestroy':_0xe962('0x5')};function emitEvent(_0x5bcb41){return function(_0x151fc3,_0x28642e,_0x5beea0){VoicePrefixEvents[_0xe962('0x6')](_0x5bcb41+':'+_0x151fc3['id'],_0x151fc3);VoicePrefixEvents[_0xe962('0x6')](_0x5bcb41,_0x151fc3);_0x5beea0(null);};}for(var e in events){if(events[_0xe962('0x7')](e)){var event=events[e];VoicePrefix[_0xe962('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x211b=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x211b,0x96));var _0xb211=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x211b[_0x3305de];return _0x3b5a84;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xb211('0x0'))['db'][_0xb211('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xb211('0x2')](0x0);var events={'afterCreate':_0xb211('0x3'),'afterUpdate':_0xb211('0x4'),'afterDestroy':_0xb211('0x5')};function emitEvent(_0x3f2b4e){return function(_0x3bca12,_0x1ad38c,_0x448321){VoicePrefixEvents[_0xb211('0x6')](_0x3f2b4e+':'+_0x3bca12['id'],_0x3bca12);VoicePrefixEvents[_0xb211('0x6')](_0x3f2b4e,_0x3bca12);_0x448321(null);};}for(var e in events){if(events[_0xb211('0x7')](e)){var event=events[e];VoicePrefix[_0xb211('0x8')](e,emitEvent(event));}}module[_0xb211('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9bfd20b..b1ba013 100644 --- a/server/api/voicePrefix/voicePrefix.model.js +++ b/server/api/voicePrefix/voicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71c8=['../../config/environment','exports','VoicePrefix','voice_prefixes','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x501b49,_0x4465ee){var _0x1ffd9e=function(_0x14eb1c){while(--_0x14eb1c){_0x501b49['push'](_0x501b49['shift']());}};_0x1ffd9e(++_0x4465ee);}(_0x71c8,0xb4));var _0x871c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x71c8[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x871c('0x0'))(_0x871c('0x1'));var moment=require(_0x871c('0x2'));var BPromise=require(_0x871c('0x3'));var rp=require(_0x871c('0x4'));var fs=require('fs');var path=require(_0x871c('0x5'));var rimraf=require(_0x871c('0x6'));var config=require(_0x871c('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x871c('0x8')]=function(_0x4fa6cb,_0xfb2220){return _0x4fa6cb['define'](_0x871c('0x9'),attributes,{'tableName':_0x871c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5eb=['util','../../config/logger','moment','request-promise','rimraf','define','voice_prefixes','lodash'];(function(_0x2080bf,_0x1fc682){var _0x23827c=function(_0x73600c){while(--_0x73600c){_0x2080bf['push'](_0x2080bf['shift']());}};_0x23827c(++_0x1fc682);}(_0xf5eb,0xcf));var _0xbf5e=function(_0x272831,_0x1daa6d){_0x272831=_0x272831-0x0;var _0x21f84b=_0xf5eb[_0x272831];return _0x21f84b;};'use strict';var _=require(_0xbf5e('0x0'));var util=require(_0xbf5e('0x1'));var logger=require(_0xbf5e('0x2'))('api');var moment=require(_0xbf5e('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf5e('0x5'));var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x3e9d15,_0x116617){return _0x3e9d15[_0xbf5e('0x6')]('VoicePrefix',attributes,{'tableName':_0xbf5e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 410f59c..0b3f5ce 100644 --- a/server/api/voicePrefix/voicePrefix.rpc.js +++ b/server/api/voicePrefix/voicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x853e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../config/utils'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x853e,0x1ea));var _0xe853=function(_0xbdea18,_0x205eac){_0xbdea18=_0xbdea18-0x0;var _0xbc6600=_0x853e[_0xbdea18];return _0xbc6600;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var moment=require('moment');var BPromise=require(_0xe853('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe853('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe853('0x3'));var logger=require(_0xe853('0x4'))(_0xe853('0x5'));var config=require(_0xe853('0x6'));var jayson=require(_0xe853('0x7'));var client=jayson['client'][_0xe853('0x8')]({'port':0x232a});config[_0xe853('0x9')]=_[_0xe853('0xa')](config[_0xe853('0x9')],{'host':_0xe853('0xb'),'port':0x18eb});var socket=require(_0xe853('0xc'))(new Redis(config[_0xe853('0x9')]));require(_0xe853('0xd'))[_0xe853('0xe')](socket);function respondWithRpcPromise(_0x15bfe2,_0x478b19,_0x581135){return new BPromise(function(_0x54da09,_0xd985c6){return client['request'](_0x15bfe2,_0x581135)['then'](function(_0x1c6224){logger[_0xe853('0xf')](_0xe853('0x10'),_0x478b19,'request\x20sent');logger[_0xe853('0x11')](_0xe853('0x12'),_0x478b19,_0xe853('0x13'),JSON[_0xe853('0x14')](_0x1c6224));if(_0x1c6224[_0xe853('0x15')]){if(_0x1c6224[_0xe853('0x15')][_0xe853('0x16')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x478b19,_0x1c6224['error']['message']);return _0xd985c6(_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);}logger[_0xe853('0x15')](_0xe853('0x10'),_0x478b19,_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);return _0x54da09(_0x1c6224[_0xe853('0x15')][_0xe853('0x17')]);}else{logger[_0xe853('0xf')](_0xe853('0x10'),_0x478b19,_0xe853('0x13'));_0x54da09(_0x1c6224[_0xe853('0x18')][_0xe853('0x17')]);}})[_0xe853('0x19')](function(_0x25a5e2){logger[_0xe853('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x478b19,_0x25a5e2);_0xd985c6(_0x25a5e2);});});} \ No newline at end of file +var _0xfb67=['VoicePrefix,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x486be2,_0x3c50db){var _0x21806b=function(_0x5211b9){while(--_0x5211b9){_0x486be2['push'](_0x486be2['shift']());}};_0x21806b(++_0x3c50db);}(_0xfb67,0xdd));var _0x7fb6=function(_0x14433a,_0x2f32d6){_0x14433a=_0x14433a-0x0;var _0xe302d0=_0xfb67[_0x14433a];return _0xe302d0;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var moment=require(_0x7fb6('0x2'));var BPromise=require(_0x7fb6('0x3'));var rs=require(_0x7fb6('0x4'));var fs=require('fs');var Redis=require(_0x7fb6('0x5'));var db=require(_0x7fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fb6('0x7'))(_0x7fb6('0x8'));var config=require(_0x7fb6('0x9'));var jayson=require(_0x7fb6('0xa'));var client=jayson[_0x7fb6('0xb')]['http']({'port':0x232a});config[_0x7fb6('0xc')]=_[_0x7fb6('0xd')](config[_0x7fb6('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7fb6('0xe'))(new Redis(config[_0x7fb6('0xc')]));require('./voicePrefix.socket')[_0x7fb6('0xf')](socket);function respondWithRpcPromise(_0x24beb3,_0x46cd91,_0x55e8a0){return new BPromise(function(_0x25473f,_0x539c7a){return client[_0x7fb6('0x10')](_0x24beb3,_0x55e8a0)[_0x7fb6('0x11')](function(_0x973821){logger[_0x7fb6('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x46cd91,_0x7fb6('0x13'));logger[_0x7fb6('0x14')](_0x7fb6('0x15'),_0x46cd91,'request\x20sent',JSON['stringify'](_0x973821));if(_0x973821['error']){if(_0x973821['error']['code']===0x1f4){logger['error'](_0x7fb6('0x16'),_0x46cd91,_0x973821[_0x7fb6('0x17')]['message']);return _0x539c7a(_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);}logger[_0x7fb6('0x17')](_0x7fb6('0x16'),_0x46cd91,_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);return _0x25473f(_0x973821[_0x7fb6('0x17')][_0x7fb6('0x18')]);}else{logger[_0x7fb6('0x12')](_0x7fb6('0x16'),_0x46cd91,_0x7fb6('0x13'));_0x25473f(_0x973821[_0x7fb6('0x19')]['message']);}})[_0x7fb6('0x1a')](function(_0x426508){logger[_0x7fb6('0x17')](_0x7fb6('0x16'),_0x46cd91,_0x426508);_0x539c7a(_0x426508);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 8441887..2e3b84b 100644 --- a/server/api/voicePrefix/voicePrefix.socket.js +++ b/server/api/voicePrefix/voicePrefix.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09dd=['register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09dd,0x81));var _0xd09d=function(_0x44c79f,_0x21f727){_0x44c79f=_0x44c79f-0x0;var _0x4089ef=_0x09dd[_0x44c79f];return _0x4089ef;};'use strict';var VoicePrefixEvents=require(_0xd09d('0x0'));var events=[_0xd09d('0x1'),_0xd09d('0x2'),_0xd09d('0x3')];function createListener(_0x45dad5,_0x2a77ce){return function(_0x28a63a){_0x2a77ce[_0xd09d('0x4')](_0x45dad5,_0x28a63a);};}function removeListener(_0x44faf7,_0x3e1b57){return function(){VoicePrefixEvents[_0xd09d('0x5')](_0x44faf7,_0x3e1b57);};}exports[_0xd09d('0x6')]=function(_0x3410c4){for(var _0x2034af=0x0,_0x5621cf=events[_0xd09d('0x7')];_0x2034af<_0x5621cf;_0x2034af++){var _0x1fce72=events[_0x2034af];var _0x3e062b=createListener(_0xd09d('0x8')+_0x1fce72,_0x3410c4);VoicePrefixEvents['on'](_0x1fce72,_0x3e062b);}}; \ No newline at end of file +var _0xf958=['./voicePrefix.events','remove','emit','register','voicePrefix:'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0xf958,0xe6));var _0x8f95=function(_0x58383f,_0x3ec27a){_0x58383f=_0x58383f-0x0;var _0x339915=_0xf958[_0x58383f];return _0x339915;};'use strict';var VoicePrefixEvents=require(_0x8f95('0x0'));var events=['save',_0x8f95('0x1'),'update'];function createListener(_0x4576d2,_0x4de6f3){return function(_0x3155dc){_0x4de6f3[_0x8f95('0x2')](_0x4576d2,_0x3155dc);};}function removeListener(_0x1aeb7b,_0x482c0c){return function(){VoicePrefixEvents['removeListener'](_0x1aeb7b,_0x482c0c);};}exports[_0x8f95('0x3')]=function(_0x10a425){for(var _0x281f38=0x0,_0x5c2af8=events['length'];_0x281f38<_0x5c2af8;_0x281f38++){var _0x1ae9c4=events[_0x281f38];var _0x109bed=createListener(_0x8f95('0x4')+_0x1ae9c4,_0x10a425);VoicePrefixEvents['on'](_0x1ae9c4,_0x109bed);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 05b0b76..4c48425 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xb10b,0x12a));var _0xbb10=function(_0x404f13,_0x4fa35f){_0x404f13=_0x404f13-0x0;var _0x1f9dbb=_0xb10b[_0x404f13];return _0x1f9dbb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x120ecf,_0x511e3f){var _0x118b17=function(_0x498b82){while(--_0x498b82){_0x120ecf['push'](_0x120ecf['shift']());}};_0x118b17(++_0x511e3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 11a9ef5..b204b86 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7cb=['name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0xd7cb,0x9d));var _0xbd7c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd7cb[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xbd7c('0x0'));module[_0xbd7c('0x1')]={'name':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':![],'unique':_0xbd7c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x5'),_0xbd7c('0x6')),'allowNull':![],'defaultValue':_0xbd7c('0x5')},'musiconhold':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':_0xbd7c('0x7')},'announce':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbd7c('0x4')]('rr',_0xbd7c('0x8'),_0xbd7c('0x9'),_0xbd7c('0xa'),_0xbd7c('0xb'),_0xbd7c('0xc'),'linear','wrandom',_0xbd7c('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x279811){this[_0xbd7c('0xe')](_0xbd7c('0xf'),_0x279811?_0x279811:_0xbd7c('0xc'));},'get':function(){var _0x3dfb92=this[_0xbd7c('0x10')]('type');var _0x56acf9=this[_0xbd7c('0x10')]('dialMethod');var _0x50da95=this['getDataValue']('strategy');if(_0x3dfb92===_0xbd7c('0x5')){return _0x50da95;}if(_0x56acf9===_0xbd7c('0x11')&&_0x50da95===_0xbd7c('0xc')||_0x56acf9===_0xbd7c('0x11')&&_0x50da95===_0xbd7c('0x12')){return _0x50da95;}if(_0x56acf9===_0xbd7c('0x13')||_0x56acf9===_0xbd7c('0x14')||_0x56acf9==='power'){return _0x50da95;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbd7c('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xbd7c('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no',_0xbd7c('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xbd7c('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbd7c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no',_0xbd7c('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbd7c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbd7c('0x2')]},'queue_youarenext':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbd7c('0x2')]},'queue_quantity1':{'type':Sequelize[_0xbd7c('0x2')]},'queue_quantity2':{'type':Sequelize[_0xbd7c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xbd7c('0x2')]},'queue_less_than':{'type':Sequelize[_0xbd7c('0x2')]},'periodic_announce':{'type':Sequelize[_0xbd7c('0x19')],'set':function(_0x25f5fa){this['setDataValue'](_0xbd7c('0x1a'),_0x25f5fa?_0x25f5fa[_0xbd7c('0x1b')](','):[]);},'get':function(){return this[_0xbd7c('0x10')]('periodic_announce')?this['getDataValue'](_0xbd7c('0x1a'))[_0xbd7c('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'yes','set':function(_0x33e5c5){this[_0xbd7c('0xe')](_0xbd7c('0x1d'),_0x33e5c5?_0x33e5c5[_0xbd7c('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xbd7c('0x10')](_0xbd7c('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':'no','set':function(_0x2a61a1){this[_0xbd7c('0xe')]('leavewhenempty',_0x2a61a1?_0x2a61a1[_0xbd7c('0x1b')](','):undefined);},'get':function(){return this[_0xbd7c('0x10')](_0xbd7c('0x1e'))?this[_0xbd7c('0x10')](_0xbd7c('0x1e'))[_0xbd7c('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'set':function(_0x5ef4a2){this[_0xbd7c('0xe')](_0xbd7c('0x20'),_0x5ef4a2);if(_0x5ef4a2){if(this['getDataValue'](_0xbd7c('0x21'))<0x2){this['setDataValue'](_0xbd7c('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbd7c('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbd7c('0x22')},'dialMethod':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x23'),'progressive','power',_0xbd7c('0x14'),_0xbd7c('0x11')),'defaultValue':'progressive','comment':_0xbd7c('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbd7c('0x15')](0x4)[_0xbd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xbd7c('0x15')](0x4)[_0xbd7c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbd7c('0x26')},'dialPowerLevel':{'type':Sequelize[_0xbd7c('0x27')](0x2)[_0xbd7c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbd7c('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x29'),_0xbd7c('0x2a')),'defaultValue':_0xbd7c('0x2a'),'comment':_0xbd7c('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbd7c('0x27')](0x2)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbd7c('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbd7c('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbd7c('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':_0xbd7c('0x2e'),'comment':_0xbd7c('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x30')},'dialQueueProject':{'type':Sequelize[_0xbd7c('0x2')],'comment':_0xbd7c('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbd7c('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbd7c('0x37')},'dialTimezone':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbd7c('0x38')},'dialPrefix':{'type':Sequelize[_0xbd7c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbd7c('0x4')](_0xbd7c('0x39'),_0xbd7c('0x3a'),'onlyIfOpen'),'defaultValue':_0xbd7c('0x39')},'dialAMDActive':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'comment':_0xbd7c('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbd7c('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbd7c('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbd7c('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbd7c('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbd7c('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbd7c('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xbd7c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbd7c('0x15')](0x9)[_0xbd7c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbd7c('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbd7c('0x42'),_0xbd7c('0x43')),'defaultValue':_0xbd7c('0x42')},'dialQueueProject2':{'type':Sequelize[_0xbd7c('0x2')],'comment':_0xbd7c('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xbd7c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd7c('0x44')},'dialCutDigit':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbd7c('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbd7c('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbd7c('0x15')](0x5)[_0xbd7c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbd7c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbd7c('0x15')],'allowNull':!![],'comment':_0xbd7c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![],'comment':_0xbd7c('0x4d'),'set':function(_0x1df115){if(!_0x1df115)this[_0xbd7c('0xe')](_0xbd7c('0x4e'),null);this[_0xbd7c('0xe')](_0xbd7c('0x4f'),_0x1df115);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbd7c('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xbd7c('0x15')](0x3)[_0xbd7c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbd7c('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0x4957=['default','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','strategy','getDataValue','booked','progressive','power','INTEGER','yes','once','TEXT','join','periodic_announce','joinempty','split','leavewhenempty','acw','wrapuptime','setDataValue','BOOLEAN','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','STRING','name','ENUM','inbound','outbound'];(function(_0x22e3a2,_0x409cb5){var _0x4f9ad1=function(_0x4d7355){while(--_0x4d7355){_0x22e3a2['push'](_0x22e3a2['shift']());}};_0x4f9ad1(++_0x409cb5);}(_0x4957,0x17c));var _0x7495=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x4957[_0x87b0ff];return _0x3bc0b2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7495('0x0')],'allowNull':![],'unique':_0x7495('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x3'),_0x7495('0x4')),'allowNull':![],'defaultValue':_0x7495('0x3')},'musiconhold':{'type':Sequelize[_0x7495('0x0')],'defaultValue':_0x7495('0x5')},'announce':{'type':Sequelize[_0x7495('0x0')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall','leastrecent',_0x7495('0x6'),_0x7495('0x7'),_0x7495('0x8'),_0x7495('0x9'),_0x7495('0xa'),_0x7495('0xb')),'allowNull':![],'defaultValue':_0x7495('0xc'),'set':function(_0x3a41a0){this['setDataValue'](_0x7495('0xd'),_0x3a41a0?_0x3a41a0:_0x7495('0x8'));},'get':function(){var _0x2e7f4b=this['getDataValue']('type');var _0x28de43=this[_0x7495('0xe')]('dialMethod');var _0x32c552=this['getDataValue']('strategy');if(_0x2e7f4b===_0x7495('0x3')){return _0x32c552;}if(_0x28de43===_0x7495('0xf')&&_0x32c552===_0x7495('0x8')||_0x28de43===_0x7495('0xf')&&_0x32c552==='roundrobin'){return _0x32c552;}if(_0x28de43===_0x7495('0x10')||_0x28de43==='predictive'||_0x28de43===_0x7495('0x11')){return _0x32c552;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x7495('0x12')](0xb)},'timeout':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7495('0x0')]},'weight':{'type':Sequelize[_0x7495('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':_0x7495('0x13')},'autopause':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7495('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7495('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x7495('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7495('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x7495('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':_0x7495('0x13')},'announce_holdtime':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no',_0x7495('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7495('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x7495('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7495('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7495('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7495('0x0')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x7495('0x0')]},'queue_less_than':{'type':Sequelize[_0x7495('0x0')]},'periodic_announce':{'type':Sequelize[_0x7495('0x15')],'set':function(_0x45d7e6){this['setDataValue']('periodic_announce',_0x45d7e6?_0x45d7e6[_0x7495('0x16')](','):[]);},'get':function(){return this[_0x7495('0xe')](_0x7495('0x17'))?this[_0x7495('0xe')](_0x7495('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x7495('0x0')],'defaultValue':_0x7495('0x13'),'set':function(_0xffcf8f){this['setDataValue'](_0x7495('0x18'),_0xffcf8f?_0xffcf8f[_0x7495('0x16')](','):undefined);},'get':function(){return this[_0x7495('0xe')]('joinempty')?this['getDataValue'](_0x7495('0x18'))[_0x7495('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7495('0x0')],'defaultValue':'no','set':function(_0x2354e7){this['setDataValue'](_0x7495('0x1a'),_0x2354e7?_0x2354e7[_0x7495('0x16')](','):undefined);},'get':function(){return this[_0x7495('0xe')](_0x7495('0x1a'))?this[_0x7495('0xe')](_0x7495('0x1a'))[_0x7495('0x19')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7495('0x0')]},'description':{'type':Sequelize[_0x7495('0x0')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x588a25){this['setDataValue'](_0x7495('0x1b'),_0x588a25);if(_0x588a25){if(this[_0x7495('0xe')](_0x7495('0x1c'))<0x2){this[_0x7495('0x1d')](_0x7495('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x7495('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7495('0x1e')],'defaultValue':0x0,'comment':_0x7495('0x1f')},'dialMethod':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x20'),_0x7495('0x10'),_0x7495('0x11'),_0x7495('0x21'),_0x7495('0xf')),'defaultValue':'progressive','comment':_0x7495('0x22')},'dialLimitChannel':{'type':Sequelize[_0x7495('0x12')](0x4)[_0x7495('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7495('0x24')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x7495('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7495('0x25')},'dialPowerLevel':{'type':Sequelize[_0x7495('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7495('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x28'),_0x7495('0x29')),'defaultValue':_0x7495('0x29'),'comment':_0x7495('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7495('0x26')](0x2)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x7495('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x7495('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7495('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x2c')},'dialQueueProject':{'type':Sequelize[_0x7495('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7495('0x32')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7495('0x0')],'defaultValue':_0x7495('0x33')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7495('0x2')]('always',_0x7495('0x34'),'onlyIfOpen'),'defaultValue':_0x7495('0x35')},'dialAMDActive':{'type':Sequelize[_0x7495('0x1e')],'defaultValue':0x0,'comment':_0x7495('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7495('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x7495('0x12')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7495('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7495('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7495('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7495('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7495('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x7495('0x12')](0x9)[_0x7495('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7495('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7495('0x12')](0x9)[_0x7495('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7495('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7495('0x12')](0x9)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7495('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7495('0x3d')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x7495('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7495('0x3e')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x7495('0x2')](_0x7495('0x3f'),_0x7495('0x40')),'defaultValue':_0x7495('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x7495('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7495('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7495('0x41')},'dialCutDigit':{'type':Sequelize[_0x7495('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7495('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7495('0x12')](0x3)[_0x7495('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7495('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7495('0x12')](0x5)[_0x7495('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7495('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7495('0x12')],'allowNull':!![],'comment':_0x7495('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0x7495('0x1e')],'defaultValue':![],'comment':_0x7495('0x4b'),'set':function(_0x262ea0){if(!_0x262ea0)this[_0x7495('0x1d')](_0x7495('0x4c'),null);this[_0x7495('0x1d')]('mandatoryDisposition',_0x262ea0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x7495('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7495('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x7495('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7495('0x1e')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 88d8513..e0ed098 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x62f1=['upsert','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','isNil','format','SIP/%s','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','userVoiceQueue:save','isArray','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','phone','ContactId','ListId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','fromQuery','scheduledAt','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','value','find','type','name','sendStatus','stack','index','map','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','create','user','get','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','VoiceQueueId','CmHopper','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','forEach','each'];(function(_0x17e8cb,_0x1bd556){var _0x27c0d6=function(_0x45e939){while(--_0x45e939){_0x17e8cb['push'](_0x17e8cb['shift']());}};_0x27c0d6(++_0x1bd556);}(_0x62f1,0x112));var _0x162f=function(_0x1fd3e7,_0x133500){_0x1fd3e7=_0x1fd3e7-0x0;var _0x2a17ad=_0x62f1[_0x1fd3e7];return _0x2a17ad;};'use strict';var emlformat=require(_0x162f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x162f('0x1'));var jsonpatch=require(_0x162f('0x2'));var rp=require(_0x162f('0x3'));var moment=require(_0x162f('0x4'));var BPromise=require(_0x162f('0x5'));var Mustache=require(_0x162f('0x6'));var util=require(_0x162f('0x7'));var path=require(_0x162f('0x8'));var sox=require(_0x162f('0x9'));var csv=require(_0x162f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x162f('0xb'));var _=require(_0x162f('0xc'));var squel=require('squel');var crypto=require(_0x162f('0xd'));var jsforce=require(_0x162f('0xe'));var deskjs=require(_0x162f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x162f('0x10'));var Papa=require(_0x162f('0x11'));var Redis=require(_0x162f('0x12'));var authService=require(_0x162f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x162f('0x14'));var hardwareService=require(_0x162f('0x15'));var logger=require(_0x162f('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x162f('0x17'));var db=require('../../mysqldb')['db'];config[_0x162f('0x18')]=_[_0x162f('0x19')](config[_0x162f('0x18')],{'host':_0x162f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x162f('0x18')]));require(_0x162f('0x1b'))[_0x162f('0x1c')](socket);function respondWithStatusCode(_0x130db8,_0x567f37){_0x567f37=_0x567f37||0xcc;return function(_0x195085){if(_0x195085){return _0x130db8['sendStatus'](_0x567f37);}return _0x130db8[_0x162f('0x1d')](_0x567f37)[_0x162f('0x1e')]();};}function respondWithResult(_0x40a284,_0x8990f3){_0x8990f3=_0x8990f3||0xc8;return function(_0x55026b){if(_0x55026b){return _0x40a284['status'](_0x8990f3)[_0x162f('0x1f')](_0x55026b);}};}function respondWithFilteredResult(_0xa03e71,_0x413c63){return function(_0x1ee433){if(_0x1ee433){var _0x45f7ef=typeof _0x413c63[_0x162f('0x20')]===_0x162f('0x21')&&typeof _0x413c63['limit']===_0x162f('0x21');var _0x53ac47=_0x1ee433[_0x162f('0x22')];var _0x46df5e=_0x45f7ef?0x0:_0x413c63['offset'];var _0x26c05b=_0x45f7ef?_0x1ee433[_0x162f('0x22')]:_0x413c63['offset']+_0x413c63[_0x162f('0x23')];var _0x436a5a;if(_0x26c05b>=_0x53ac47){_0x26c05b=_0x53ac47;_0x436a5a=0xc8;}else{_0x436a5a=0xce;}_0xa03e71[_0x162f('0x1d')](_0x436a5a);return _0xa03e71[_0x162f('0x24')]('Content-Range',_0x46df5e+'-'+_0x26c05b+'/'+_0x53ac47)[_0x162f('0x1f')](_0x1ee433);}return null;};}function patchUpdates(_0x246aff){return function(_0x9e3f3c){try{jsonpatch[_0x162f('0x25')](_0x9e3f3c,_0x246aff,!![]);}catch(_0x422241){return BPromise[_0x162f('0x26')](_0x422241);}return _0x9e3f3c[_0x162f('0x27')]();};}function saveUpdates(_0x331d0d,_0x56fdda){return function(_0x352547){if(_0x352547){return _0x352547[_0x162f('0x28')](_0x331d0d)[_0x162f('0x29')](function(_0x16f5e2){return _0x16f5e2;});}return null;};}function removeEntity(_0x59482e,_0x2fc293){return function(_0x58af8a){if(_0x58af8a){return _0x58af8a[_0x162f('0x2a')]()['then'](function(){var _0x2cd181=_0x58af8a['get']({'plain':!![]});var _0x1414dd=[{'name':'VoiceQueues','value':_0x162f('0x2b'),'ignore':![]},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d'),'ignore':![]}];var _0x50fb25=_(_0x1414dd)['filter']('ignore')['map'](_0x162f('0x2e'))[_0x162f('0x2e')]();if(_['includes'](_0x50fb25,_0x2cd181['type'])){return;}var _0x59ccf0=_[_0x162f('0x2f')](_0x1414dd,['value',_0x2cd181[_0x162f('0x30')]])[_0x162f('0x31')];return db['UserProfileResource']['destroy']({'where':{'type':_0x59ccf0,'resourceId':_0x2cd181['id']}})[_0x162f('0x29')](function(){return _0x58af8a;});})[_0x162f('0x29')](function(){_0x59482e[_0x162f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313692,_0x37ffee){return function(_0x1dae7c){if(!_0x1dae7c){_0x313692[_0x162f('0x32')](0x194);}return _0x1dae7c;};}function handleError(_0x5a332a,_0x583302){_0x583302=_0x583302||0x1f4;return function(_0x2f5e77){logger['error'](_0x2f5e77[_0x162f('0x33')]);if(_0x2f5e77['name']){delete _0x2f5e77['name'];}_0x5a332a['status'](_0x583302)['send'](_0x2f5e77);};}exports[_0x162f('0x34')]=function(_0x39284d,_0x9d87a1){var _0x49444e={},_0x2f98aa={},_0x36b094={'count':0x0,'rows':[]};var _0x4e482e=_[_0x162f('0x35')](db[_0x162f('0x36')][_0x162f('0x37')],function(_0x47cb10){return{'name':_0x47cb10[_0x162f('0x38')],'type':_0x47cb10['type'][_0x162f('0x39')]};});_0x2f98aa['model']=_[_0x162f('0x35')](_0x4e482e,'name');_0x2f98aa[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x39284d['query']);_0x2f98aa[_0x162f('0x3c')]=_['intersection'](_0x2f98aa[_0x162f('0x3d')],_0x2f98aa[_0x162f('0x3a')]);_0x49444e['attributes']=_[_0x162f('0x3e')](_0x2f98aa['model'],qs[_0x162f('0x3f')](_0x39284d['query']['fields']));_0x49444e[_0x162f('0x40')]=_0x49444e[_0x162f('0x40')]['length']?_0x49444e[_0x162f('0x40')]:_0x2f98aa['model'];if(!_0x39284d['query'][_0x162f('0x41')](_0x162f('0x42'))){_0x49444e['limit']=qs[_0x162f('0x23')](_0x39284d[_0x162f('0x3a')][_0x162f('0x23')]);_0x49444e[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x39284d['query'][_0x162f('0x20')]);}_0x49444e[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x39284d[_0x162f('0x3a')]['sort']);_0x49444e[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x39284d[_0x162f('0x3a')],_0x2f98aa['filters']),_0x4e482e);if(_0x39284d[_0x162f('0x3a')][_0x162f('0x47')]){_0x49444e['where']=_[_0x162f('0x48')](_0x49444e[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x4e482e,function(_0xdc4eaa){if(_0xdc4eaa[_0x162f('0x30')]!==_0x162f('0x49')){var _0x3110be={};_0x3110be[_0xdc4eaa['name']]={'$like':'%'+_0x39284d[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x3110be;}})});}_0x49444e=_['merge']({},_0x49444e,_0x39284d[_0x162f('0x4a')]);var _0x250f08={'where':_0x49444e['where']};return db[_0x162f('0x36')][_0x162f('0x22')](_0x250f08)[_0x162f('0x29')](function(_0x1f8816){_0x36b094[_0x162f('0x22')]=_0x1f8816;if(_0x39284d[_0x162f('0x3a')][_0x162f('0x4b')]){_0x49444e[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x36')][_0x162f('0x4d')](_0x49444e);})[_0x162f('0x29')](function(_0x18900b){_0x36b094[_0x162f('0x4e')]=_0x18900b;return _0x36b094;})[_0x162f('0x29')](respondWithFilteredResult(_0x9d87a1,_0x49444e))['catch'](handleError(_0x9d87a1,null));};exports[_0x162f('0x4f')]=function(_0x1c90dd,_0x5d23cb){var _0x518fa6={'raw':![],'where':{'id':_0x1c90dd['params']['id']}},_0x428282={};_0x428282[_0x162f('0x3d')]=_['keys'](db[_0x162f('0x36')]['rawAttributes']);_0x428282[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x1c90dd[_0x162f('0x3a')]);_0x428282[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x428282[_0x162f('0x3d')],_0x428282[_0x162f('0x3a')]);_0x518fa6[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x428282['model'],qs[_0x162f('0x3f')](_0x1c90dd[_0x162f('0x3a')]['fields']));_0x518fa6[_0x162f('0x40')]=_0x518fa6[_0x162f('0x40')][_0x162f('0x50')]?_0x518fa6[_0x162f('0x40')]:_0x428282[_0x162f('0x3d')];if(_0x1c90dd['query'][_0x162f('0x4b')]){_0x518fa6[_0x162f('0x4c')]=[{'all':!![]}];}_0x518fa6=_[_0x162f('0x48')]({},_0x518fa6,_0x1c90dd[_0x162f('0x4a')]);return db[_0x162f('0x36')]['find'](_0x518fa6)['then'](handleEntityNotFound(_0x5d23cb,null))[_0x162f('0x29')](respondWithResult(_0x5d23cb,null))['catch'](handleError(_0x5d23cb,null));};exports[_0x162f('0x51')]=function(_0xefabbd,_0x481f57){return db[_0x162f('0x36')][_0x162f('0x51')](_0xefabbd['body'],{})[_0x162f('0x29')](function(_0x289306){var _0x6ac709=_0xefabbd[_0x162f('0x52')][_0x162f('0x53')]({'plain':!![]});if(!_0x6ac709)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6ac709[_0x162f('0x54')]==='user'){var _0x304788=_0x289306['get']({'plain':!![]});var _0x52877c=[{'name':_0x162f('0x55'),'value':_0x162f('0x2b')},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d')}];var _0x58e1a6=_['find'](_0x52877c,[_0x162f('0x2e'),_0x304788[_0x162f('0x30')]])[_0x162f('0x31')];return db[_0x162f('0x56')][_0x162f('0x2f')]({'where':{'name':_0x58e1a6,'userProfileId':_0x6ac709[_0x162f('0x57')]},'raw':!![]})[_0x162f('0x29')](function(_0x3755d7){if(_0x3755d7&&_0x3755d7[_0x162f('0x58')]===0x0){return db[_0x162f('0x59')][_0x162f('0x51')]({'name':_0x304788[_0x162f('0x31')],'resourceId':_0x304788['id'],'type':_0x3755d7['name'],'sectionId':_0x3755d7['id']},{})[_0x162f('0x29')](function(){return _0x289306;});}else{return _0x289306;}})[_0x162f('0x5a')](function(_0x25d903){logger[_0x162f('0x5b')](_0x162f('0x5c'),_0x25d903);throw _0x25d903;});}return _0x289306;})['then'](respondWithResult(_0x481f57,0xc9))[_0x162f('0x5a')](handleError(_0x481f57,null));};exports[_0x162f('0x5d')]=function(_0x587e68,_0x3aa7a9){var _0x2ff24c={'where':{'id':_0x587e68[_0x162f('0x5e')]['id']}},_0x147561={};_0x147561[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x36')][_0x162f('0x37')]);_0x2ff24c['attributes']=_['intersection'](_0x147561[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x587e68['query'][_0x162f('0x3f')]));_0x2ff24c[_0x162f('0x40')]=_0x2ff24c['attributes'][_0x162f('0x50')]?_0x2ff24c['attributes']:_0x147561[_0x162f('0x3d')];if(_0x587e68[_0x162f('0x3a')][_0x162f('0x4b')]){_0x2ff24c[_0x162f('0x4c')]=[{'all':!![]}];}_0x2ff24c=_[_0x162f('0x48')]({},_0x2ff24c,_0x587e68[_0x162f('0x4a')]);return db['VoiceQueue']['find'](_0x2ff24c)[_0x162f('0x29')](handleEntityNotFound(_0x3aa7a9,null))[_0x162f('0x29')](function(_0x16b9f0){if(_0x16b9f0){var _0x3118ff=_0x16b9f0[_0x162f('0x53')]({'plain':!![]});_0x3118ff=qs[_0x162f('0x5f')](_0x3118ff,['id',_0x162f('0x60'),'updatedAt']);_0x587e68[_0x162f('0x61')]=_[_0x162f('0x5f')](_0x587e68[_0x162f('0x61')],['id','createdAt',_0x162f('0x62')]);return db[_0x162f('0x36')][_0x162f('0x51')](_[_0x162f('0x48')](_0x3118ff,_0x587e68[_0x162f('0x61')]),{'include':_0x587e68[_0x162f('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x162f('0x29')](function(_0x3cea4a){var _0xfffd7a=_0x587e68[_0x162f('0x52')][_0x162f('0x53')]({'plain':!![]});if(!_0xfffd7a)throw new Error(_0x162f('0x63'));if(_0xfffd7a[_0x162f('0x54')]==='user'){var _0x34bb82=_0x3cea4a[_0x162f('0x53')]({'plain':!![]});var _0xf238e1=[{'name':_0x162f('0x55'),'value':'inbound'},{'name':_0x162f('0x2c'),'value':_0x162f('0x2d')}];var _0x363cf2=_[_0x162f('0x2f')](_0xf238e1,[_0x162f('0x2e'),_0x34bb82[_0x162f('0x30')]])['name'];return db[_0x162f('0x56')]['find']({'where':{'name':_0x363cf2,'userProfileId':_0xfffd7a[_0x162f('0x57')]},'raw':!![]})[_0x162f('0x29')](function(_0x281d0d){if(_0x281d0d&&_0x281d0d['autoAssociation']===0x0){return db[_0x162f('0x59')][_0x162f('0x51')]({'name':_0x34bb82['name'],'resourceId':_0x34bb82['id'],'type':_0x281d0d[_0x162f('0x31')],'sectionId':_0x281d0d['id']},{})[_0x162f('0x29')](function(){return _0x3cea4a;});}else{return _0x3cea4a;}})[_0x162f('0x5a')](function(_0x5e4538){logger[_0x162f('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e4538);throw _0x5e4538;});}return _0x3cea4a;});}})[_0x162f('0x29')](respondWithResult(_0x3aa7a9,0xc9))[_0x162f('0x5a')](handleError(_0x3aa7a9,null));};exports[_0x162f('0x28')]=function(_0x40cf13,_0xb2c3b3){if(_0x40cf13['body']['id']){delete _0x40cf13[_0x162f('0x61')]['id'];}return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x40cf13['params']['id']}})['then'](handleEntityNotFound(_0xb2c3b3,null))[_0x162f('0x29')](saveUpdates(_0x40cf13[_0x162f('0x61')],null))[_0x162f('0x29')](respondWithResult(_0xb2c3b3,null))['catch'](handleError(_0xb2c3b3,null));};exports[_0x162f('0x2a')]=function(_0x216064,_0x315c5f){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x216064[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x315c5f,null))[_0x162f('0x29')](removeEntity(_0x315c5f,null))['catch'](handleError(_0x315c5f,null));};exports[_0x162f('0x64')]=function(_0x4a1351,_0x403bd5,_0x2be358){var _0x1cd6cb={'raw':![],'where':{}};var _0x33c3fd={};var _0xab20f8={'count':0x0,'rows':[]};return db[_0x162f('0x36')]['findOne']({'where':{'id':_0x4a1351[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x403bd5,null))[_0x162f('0x29')](function(_0x50ae48){if(_0x50ae48){_0x33c3fd[_0x162f('0x3d')]=_['keys'](db['CmHopper']['rawAttributes']);_0x33c3fd[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x4a1351[_0x162f('0x3a')]);_0x33c3fd['filters']=_[_0x162f('0x3e')](_0x33c3fd[_0x162f('0x3d')],_0x33c3fd['query']);_0x1cd6cb[_0x162f('0x40')]=_['intersection'](_0x33c3fd[_0x162f('0x3d')],qs['fields'](_0x4a1351[_0x162f('0x3a')]['fields']));_0x1cd6cb['attributes']=_0x1cd6cb[_0x162f('0x40')][_0x162f('0x50')]?_0x1cd6cb[_0x162f('0x40')]:_0x33c3fd['model'];if(!_0x4a1351[_0x162f('0x3a')][_0x162f('0x41')]('nolimit')){_0x1cd6cb[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x4a1351['query'][_0x162f('0x23')]);_0x1cd6cb[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x4a1351[_0x162f('0x3a')][_0x162f('0x20')]);}_0x1cd6cb[_0x162f('0x43')]=qs['sort'](_0x4a1351[_0x162f('0x3a')][_0x162f('0x44')]);_0x1cd6cb[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x4a1351[_0x162f('0x3a')],_0x33c3fd[_0x162f('0x3c')]));_0x1cd6cb[_0x162f('0x45')][_0x162f('0x65')]=_0x50ae48['id'];if(_0x4a1351[_0x162f('0x3a')][_0x162f('0x47')]){_0x1cd6cb[_0x162f('0x45')]=_[_0x162f('0x48')](_0x1cd6cb[_0x162f('0x45')],{'$or':_['map'](_0x1cd6cb[_0x162f('0x40')],function(_0x8bae9d){var _0x555546={};_0x555546[_0x8bae9d]={'$like':'%'+_0x4a1351[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x555546;})});}_0x1cd6cb=_[_0x162f('0x48')]({},_0x1cd6cb,_0x4a1351[_0x162f('0x4a')]);return db[_0x162f('0x66')][_0x162f('0x22')]({'where':_0x1cd6cb[_0x162f('0x45')]})[_0x162f('0x29')](function(_0x13017c){_0xab20f8['count']=_0x13017c;if(_0x4a1351['query'][_0x162f('0x4b')]){_0x1cd6cb[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x66')][_0x162f('0x4d')](_0x1cd6cb);})['then'](function(_0x4bd0fd){_0xab20f8['rows']=_0x4bd0fd;return _0xab20f8;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x403bd5,_0x1cd6cb))[_0x162f('0x5a')](handleError(_0x403bd5,null));};exports['getHopperHistories']=function(_0x1d5cc5,_0x1b7107,_0x319282){var _0x3ce0be={'raw':!![],'where':{}};var _0x161fc8={};var _0x235d3c={'count':0x0,'rows':[]};return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x1d5cc5['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x1b7107,null))['then'](function(_0x41e3d8){if(_0x41e3d8){_0x161fc8[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x68')][_0x162f('0x37')]);_0x161fc8[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x1d5cc5[_0x162f('0x3a')]);_0x161fc8[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x161fc8['model'],_0x161fc8[_0x162f('0x3a')]);_0x3ce0be['attributes']=_['intersection'](_0x161fc8['model'],qs[_0x162f('0x3f')](_0x1d5cc5['query'][_0x162f('0x3f')]));_0x3ce0be[_0x162f('0x40')]=_0x3ce0be[_0x162f('0x40')][_0x162f('0x50')]?_0x3ce0be[_0x162f('0x40')]:_0x161fc8[_0x162f('0x3d')];if(!_0x1d5cc5[_0x162f('0x3a')]['hasOwnProperty'](_0x162f('0x42'))){_0x3ce0be[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x1d5cc5[_0x162f('0x3a')]['limit']);_0x3ce0be[_0x162f('0x20')]=qs['offset'](_0x1d5cc5[_0x162f('0x3a')][_0x162f('0x20')]);}_0x3ce0be[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x1d5cc5['query'][_0x162f('0x44')]);_0x3ce0be[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x1d5cc5[_0x162f('0x3a')],_0x161fc8[_0x162f('0x3c')]));_0x3ce0be[_0x162f('0x45')][_0x162f('0x65')]=_0x41e3d8['id'];if(_0x1d5cc5['query'][_0x162f('0x47')]){_0x3ce0be[_0x162f('0x45')]=_['merge'](_0x3ce0be['where'],{'$or':_['map'](_0x3ce0be[_0x162f('0x40')],function(_0x53fa1e){var _0x45ce5e={};_0x45ce5e[_0x53fa1e]={'$like':'%'+_0x1d5cc5['query']['filter']+'%'};return _0x45ce5e;})});}_0x3ce0be=_['merge']({},_0x3ce0be,_0x1d5cc5['options']);return db[_0x162f('0x68')][_0x162f('0x22')]({'where':_0x3ce0be[_0x162f('0x45')]})['then'](function(_0x47200d){_0x235d3c[_0x162f('0x22')]=_0x47200d;if(_0x1d5cc5[_0x162f('0x3a')][_0x162f('0x4b')]){_0x3ce0be['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x162f('0x4d')](_0x3ce0be);})[_0x162f('0x29')](function(_0x56699b){_0x235d3c['rows']=_0x56699b;return _0x235d3c;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x1b7107,_0x3ce0be))[_0x162f('0x5a')](handleError(_0x1b7107,null));};exports[_0x162f('0x69')]=function(_0x9d5a42,_0x3b58f3,_0x5abf0f){var _0x3bf73b={'raw':!![],'where':{}};var _0x39d952={};var _0x273554={'count':0x0,'rows':[]};return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x9d5a42[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3b58f3,null))[_0x162f('0x29')](function(_0x3ed8d2){if(_0x3ed8d2){_0x39d952['model']=_[_0x162f('0x3b')](db[_0x162f('0x6a')]['rawAttributes']);_0x39d952['query']=_[_0x162f('0x3b')](_0x9d5a42['query']);_0x39d952[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x39d952[_0x162f('0x3d')],_0x39d952[_0x162f('0x3a')]);_0x3bf73b[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x39d952[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x9d5a42[_0x162f('0x3a')]['fields']));_0x3bf73b[_0x162f('0x40')]=_0x3bf73b['attributes'][_0x162f('0x50')]?_0x3bf73b[_0x162f('0x40')]:_0x39d952['model'];if(!_0x9d5a42[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0x3bf73b[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x23')]);_0x3bf73b[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x20')]);}_0x3bf73b['order']=qs[_0x162f('0x44')](_0x9d5a42[_0x162f('0x3a')][_0x162f('0x44')]);_0x3bf73b[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x9d5a42[_0x162f('0x3a')],_0x39d952[_0x162f('0x3c')]));_0x3bf73b[_0x162f('0x45')][_0x162f('0x65')]=_0x3ed8d2['id'];if(_0x9d5a42[_0x162f('0x3a')][_0x162f('0x47')]){_0x3bf73b['where']=_[_0x162f('0x48')](_0x3bf73b[_0x162f('0x45')],{'$or':_['map'](_0x3bf73b[_0x162f('0x40')],function(_0x394f2b){var _0x271ad3={};_0x271ad3[_0x394f2b]={'$like':'%'+_0x9d5a42[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x271ad3;})});}_0x3bf73b=_[_0x162f('0x48')]({},_0x3bf73b,_0x9d5a42[_0x162f('0x4a')]);return db[_0x162f('0x6a')][_0x162f('0x22')]({'where':_0x3bf73b[_0x162f('0x45')]})[_0x162f('0x29')](function(_0x3308aa){_0x273554[_0x162f('0x22')]=_0x3308aa;if(_0x9d5a42[_0x162f('0x3a')][_0x162f('0x4b')]){_0x3bf73b['include']=[{'all':!![]}];}return db[_0x162f('0x6a')][_0x162f('0x4d')](_0x3bf73b);})[_0x162f('0x29')](function(_0x482b10){_0x273554['rows']=_0x482b10;return _0x273554;});}})['then'](respondWithFilteredResult(_0x3b58f3,_0x3bf73b))[_0x162f('0x5a')](handleError(_0x3b58f3,null));};exports[_0x162f('0x6b')]=function(_0x167605,_0x38eabc,_0x273112){var _0xa426dd={'raw':!![],'where':{}};var _0xa88e8={};var _0x3f01b9={'count':0x0,'rows':[]};return db[_0x162f('0x36')]['findOne']({'where':{'id':_0x167605[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x38eabc,null))[_0x162f('0x29')](function(_0x6d6f3b){if(_0x6d6f3b){_0xa88e8['model']=_[_0x162f('0x3b')](db[_0x162f('0x6c')][_0x162f('0x37')]);_0xa88e8[_0x162f('0x3a')]=_['keys'](_0x167605[_0x162f('0x3a')]);_0xa88e8['filters']=_['intersection'](_0xa88e8['model'],_0xa88e8[_0x162f('0x3a')]);_0xa426dd[_0x162f('0x40')]=_[_0x162f('0x3e')](_0xa88e8[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x167605[_0x162f('0x3a')][_0x162f('0x3f')]));_0xa426dd[_0x162f('0x40')]=_0xa426dd['attributes']['length']?_0xa426dd[_0x162f('0x40')]:_0xa88e8['model'];if(!_0x167605[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0xa426dd[_0x162f('0x23')]=qs['limit'](_0x167605[_0x162f('0x3a')][_0x162f('0x23')]);_0xa426dd[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x167605[_0x162f('0x3a')][_0x162f('0x20')]);}_0xa426dd[_0x162f('0x43')]=qs['sort'](_0x167605[_0x162f('0x3a')][_0x162f('0x44')]);_0xa426dd['where']=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x167605[_0x162f('0x3a')],_0xa88e8[_0x162f('0x3c')]));_0xa426dd[_0x162f('0x45')][_0x162f('0x65')]=_0x6d6f3b['id'];if(_0x167605[_0x162f('0x3a')][_0x162f('0x47')]){_0xa426dd[_0x162f('0x45')]=_[_0x162f('0x48')](_0xa426dd[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0xa426dd[_0x162f('0x40')],function(_0x475547){var _0x1057ca={};_0x1057ca[_0x475547]={'$like':'%'+_0x167605['query']['filter']+'%'};return _0x1057ca;})});}_0xa426dd=_[_0x162f('0x48')]({},_0xa426dd,_0x167605[_0x162f('0x4a')]);return db[_0x162f('0x6c')][_0x162f('0x22')]({'where':_0xa426dd['where']})['then'](function(_0x35dc2d){_0x3f01b9[_0x162f('0x22')]=_0x35dc2d;if(_0x167605[_0x162f('0x3a')][_0x162f('0x4b')]){_0xa426dd[_0x162f('0x4c')]=[{'all':!![]}];}return db[_0x162f('0x6c')]['findAll'](_0xa426dd);})[_0x162f('0x29')](function(_0x4b4e49){_0x3f01b9[_0x162f('0x4e')]=_0x4b4e49;return _0x3f01b9;});}})[_0x162f('0x29')](respondWithFilteredResult(_0x38eabc,_0xa426dd))[_0x162f('0x5a')](handleError(_0x38eabc,null));};exports[_0x162f('0x6d')]=function(_0x50d1c0,_0x307357,_0x4160d4){var _0x11b134={};var _0x317692={};var _0x2b44fb;var _0x3ea2b0;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x50d1c0[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x307357,null))[_0x162f('0x29')](function(_0x276b20){if(_0x276b20){_0x2b44fb=_0x276b20;_0x317692[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x6e')][_0x162f('0x37')]);_0x317692[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x50d1c0[_0x162f('0x3a')]);_0x317692[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x317692[_0x162f('0x3d')],_0x317692[_0x162f('0x3a')]);_0x11b134[_0x162f('0x40')]=_['intersection'](_0x317692[_0x162f('0x3d')],qs['fields'](_0x50d1c0[_0x162f('0x3a')][_0x162f('0x3f')]));_0x11b134['attributes']=_0x11b134[_0x162f('0x40')][_0x162f('0x50')]?_0x11b134[_0x162f('0x40')]:_0x317692[_0x162f('0x3d')];_0x11b134['order']=qs[_0x162f('0x44')](_0x50d1c0['query']['sort']);_0x11b134[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x50d1c0[_0x162f('0x3a')],_0x317692[_0x162f('0x3c')]));if(_0x50d1c0[_0x162f('0x3a')][_0x162f('0x47')]){_0x11b134[_0x162f('0x45')]=_['merge'](_0x11b134['where'],{'$or':_[_0x162f('0x35')](_0x11b134[_0x162f('0x40')],function(_0xa5ed85){var _0x130764={};_0x130764[_0xa5ed85]={'$like':'%'+_0x50d1c0[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x130764;})});}_0x11b134=_[_0x162f('0x48')]({},_0x11b134,_0x50d1c0['options']);return _0x2b44fb[_0x162f('0x6d')](_0x11b134);}})['then'](function(_0x24af06){if(_0x24af06){_0x3ea2b0=_0x24af06[_0x162f('0x50')];if(!_0x50d1c0['query'][_0x162f('0x41')]('nolimit')){_0x11b134['limit']=qs[_0x162f('0x23')](_0x50d1c0[_0x162f('0x3a')]['limit']);_0x11b134[_0x162f('0x20')]=qs['offset'](_0x50d1c0[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x2b44fb[_0x162f('0x6d')](_0x11b134);}})[_0x162f('0x29')](function(_0x419564){if(_0x419564){return _0x419564?{'count':_0x3ea2b0,'rows':_0x419564}:null;}})[_0x162f('0x29')](respondWithResult(_0x307357,null))[_0x162f('0x5a')](handleError(_0x307357,null));};exports[_0x162f('0x6f')]=function(_0xf90dd4,_0x3ee636,_0x86a39b){var _0x23ccc4=_0xf90dd4[_0x162f('0x61')][_0x162f('0x70')];var _0x7f992=_[_0x162f('0x35')](_0x23ccc4,'id');return db[_0x162f('0x6e')]['findAll']({'where':{'id':_0x7f992},'attributes':['id'],'include':[{'model':db[_0x162f('0x71')],'as':_0x162f('0x72'),'attributes':['id',_0x162f('0x31'),_0x162f('0x73'),_0x162f('0x74'),_0x162f('0x75')],'raw':!![]}]})[_0x162f('0x29')](function(_0x43d7fb){if(_0x43d7fb){var _0x3240c7=_['flatMap'](_0x43d7fb,function(_0x4ce7d4){var _0x2191e4=_0x4ce7d4[_0x162f('0x53')]({'plain':!![]});_0x2191e4[_0x162f('0x72')][_0x162f('0x76')](function(_0x521087){_0x521087['penalty']=_['find'](_0x23ccc4,{'id':_0x2191e4['id']})['penalty'];});return _0x2191e4['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0xf90dd4[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(_0xfe352b){return db['sequelize']['transaction'](function(_0x2a6e42){return _0xfe352b[_0x162f('0x6f')](_0x7f992,{'transaction':_0x2a6e42})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_0x23ccc4,function(_0x12c46a){return db['TeamVoiceQueue'][_0x162f('0x78')]({'TeamId':_0x12c46a['id'],'VoiceQueueId':_0xf90dd4[_0x162f('0x5e')]['id'],'penalty':_0x12c46a['penalty']},{'transaction':_0x2a6e42});});})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_0x3240c7,function(_0x4a1aff){return db[_0x162f('0x79')][_0x162f('0x7a')]({'where':{'UserId':_0x4a1aff['id'],'VoiceQueueId':_0xf90dd4[_0x162f('0x5e')]['id']},'defaults':{'penalty':_0x4a1aff[_0x162f('0x7b')]},'transaction':_0x2a6e42});});})[_0x162f('0x29')](function(){return BPromise[_0x162f('0x77')](_[_0x162f('0x47')](_0x3240c7,{'online':!![]}),function(_0xdc6e46){return db[_0x162f('0x7c')][_0x162f('0x78')]({'membername':_0xdc6e46['name'],'UserId':_0xdc6e46['id'],'queue_name':_0xfe352b[_0x162f('0x31')],'VoiceQueueId':_0xfe352b['id'],'interface':_[_0x162f('0x7d')](_0xdc6e46[_0x162f('0x75')])?util[_0x162f('0x7e')](_0x162f('0x7f'),_0xdc6e46[_0x162f('0x31')]):_0xdc6e46[_0x162f('0x75')],'paused':_0xdc6e46[_0x162f('0x74')]||![],'penalty':_0xdc6e46[_0x162f('0x7b')]},{'transaction':_0x2a6e42});});})['then'](function(){_0x3240c7[_0x162f('0x76')](function(_0x3cf46e){socket['emit']('userVoiceQueue:save',{'UserId':_0x3cf46e['id'],'VoiceQueueId':_0xfe352b['id']});});});});});}})[_0x162f('0x29')](respondWithStatusCode(_0x3ee636,null))[_0x162f('0x5a')](handleError(_0x3ee636,null));};exports['removeTeams']=function(_0x1f7f8f,_0xf1374a,_0x424fd5){return db['Team'][_0x162f('0x4d')]({'where':{'id':_0x1f7f8f[_0x162f('0x3a')][_0x162f('0x80')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x162f('0x72'),'attributes':['id'],'raw':!![]}]})[_0x162f('0x29')](handleEntityNotFound(_0xf1374a,null))[_0x162f('0x29')](function(_0x285023){var _0x3f69e2=_['map'](_0x285023,'id');var _0x4358c9=[];var _0xaa28ed=[];var _0x252c97=squel[_0x162f('0x81')]();_0x252c97[_0x162f('0x82')]('tq.TeamId')[_0x162f('0x83')](_0x162f('0x84'),'tq')[_0x162f('0x85')](_0x162f('0x86'),'ut',_0x162f('0x87'))[_0x162f('0x45')]('VoiceQueueId\x20=\x20?',_0x1f7f8f['params']['id']);for(var _0xeebb4e=0x0;_0xeebb4e<_0x285023['length'];_0xeebb4e+=0x1){let _0x57766f=_0x285023[_0xeebb4e];for(var _0x121091=0x0;_0x121091<_0x57766f[_0x162f('0x72')][_0x162f('0x50')];_0x121091+=0x1){let _0x4c1ef1=_0x57766f[_0x162f('0x72')][_0x121091];var _0x51e4e3=_0x252c97[_0x162f('0x5d')]();_0x51e4e3[_0x162f('0x45')](_0x162f('0x88'),_0x4c1ef1['id']);_0xaa28ed[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x51e4e3['toString'](),{'type':db[_0x162f('0x8a')]['QueryTypes'][_0x162f('0x8b')]})[_0x162f('0x29')](function(_0x1e05a5){if(_0x1e05a5['length']===0x1){return _0x4c1ef1['id'];}else{var _0x1f98ad=_[_0x162f('0x8c')](_[_0x162f('0x35')](_0x1e05a5,_0x162f('0x8d')),function(_0x5bc32c){return _[_0x162f('0x8e')](_0x3f69e2,_0x5bc32c);});if(_0x1f98ad){return _0x4c1ef1['id'];}}}));}}return BPromise[_0x162f('0x8f')](_0xaa28ed)[_0x162f('0x29')](function(_0x21766b){_0x4358c9=_(_0x4358c9)[_0x162f('0x90')](_0x21766b)[_0x162f('0x91')]()[_0x162f('0x2e')]();return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x1f7f8f['params']['id']}})['then'](function(_0x46a768){return db[_0x162f('0x8a')][_0x162f('0x92')](function(_0x509940){return _0x46a768[_0x162f('0x93')](_0x1f7f8f[_0x162f('0x3a')]['ids'],{'transaction':_0x509940})['then'](function(){if(!_[_0x162f('0x94')](_0x4358c9)){return _0x46a768[_0x162f('0x95')](_0x4358c9,{'transaction':_0x509940})[_0x162f('0x29')](function(){return db[_0x162f('0x7c')][_0x162f('0x2a')]({'where':{'VoiceQueueId':_0x1f7f8f[_0x162f('0x5e')]['id'],'UserId':_0x4358c9},'transaction':_0x509940});});}})[_0x162f('0x29')](function(){_0x4358c9[_0x162f('0x76')](function(_0x277345){socket['emit'](_0x162f('0x96'),{'UserId':_0x277345,'VoiceQueueId':_0x46a768['id']});});});});});});})[_0x162f('0x29')](respondWithStatusCode(_0xf1374a,null))['catch'](handleError(_0xf1374a,null));};exports[_0x162f('0x97')]=function(_0x56ec2d,_0x36b49f,_0x5ecf68){var _0x305df8,_0x2b3408;return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x56ec2d[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x36b49f,null))[_0x162f('0x29')](function(_0x25161a){if(_0x25161a){_0x2b3408=_0x25161a;return _0x25161a['addAgents'](_0x56ec2d[_0x162f('0x61')]['ids'],_[_0x162f('0x5f')](_0x56ec2d[_0x162f('0x61')],[_0x162f('0x80'),'id'])||{})[_0x162f('0x98')](function(_0x3bd2d3){for(var _0x35fe73=0x0;_0x35fe73<_0x56ec2d['body'][_0x162f('0x80')]['length'];_0x35fe73+=0x1){socket[_0x162f('0x99')](_0x162f('0x9a'),{'UserId':Number(_0x56ec2d[_0x162f('0x61')][_0x162f('0x80')][_0x35fe73]),'VoiceQueueId':Number(_0x56ec2d[_0x162f('0x5e')]['id'])});}return _0x3bd2d3;});}})[_0x162f('0x29')](function(_0x430e1b){_0x305df8=_0x430e1b||[];if(_0x2b3408){return db[_0x162f('0x71')][_0x162f('0x4d')]({'where':{'id':_0x56ec2d[_0x162f('0x61')]['ids']},'attributes':['id','name',_0x162f('0x73'),'voicePause',_0x162f('0x75')],'raw':!![]});}})['then'](function(_0x4428a6){if(!_[_0x162f('0x94')](_0x4428a6)){var _0x2f0610=[];for(var _0x4fb266=0x0;_0x4fb266<_0x4428a6[_0x162f('0x50')];_0x4fb266++){if(_0x4428a6[_0x4fb266][_0x162f('0x73')]){_0x2f0610[_0x162f('0x89')](db[_0x162f('0x7c')]['upsert']({'membername':_0x4428a6[_0x4fb266]['name'],'UserId':_0x4428a6[_0x4fb266]['id'],'queue_name':_0x2b3408[_0x162f('0x31')],'VoiceQueueId':_0x2b3408['id'],'interface':_[_0x162f('0x7d')](_0x4428a6[_0x4fb266][_0x162f('0x75')])?util[_0x162f('0x7e')](_0x162f('0x7f'),_0x4428a6[_0x4fb266][_0x162f('0x31')]):_0x4428a6[_0x4fb266][_0x162f('0x75')],'paused':_0x4428a6[_0x4fb266][_0x162f('0x74')]||![],'penalty':_0x56ec2d[_0x162f('0x61')][_0x162f('0x7b')]||0x0}));}}return BPromise[_0x162f('0x8f')](_0x2f0610);}})['then'](function(){return _0x305df8;})[_0x162f('0x29')](respondWithResult(_0x36b49f,null))['catch'](handleError(_0x36b49f,null));};exports['removeAgents']=function(_0x4a7d99,_0x5c26f2,_0x414b8f){return db[_0x162f('0x36')]['find']({'where':{'id':_0x4a7d99[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x5c26f2,null))[_0x162f('0x29')](function(_0x1f6c41){if(_0x1f6c41){return _0x1f6c41[_0x162f('0x95')](_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')])['then'](function(){if(_[_0x162f('0x9b')](_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')])){for(var _0x5552ff=0x0;_0x5552ff<_0x4a7d99['query'][_0x162f('0x80')][_0x162f('0x50')];_0x5552ff+=0x1){socket[_0x162f('0x99')](_0x162f('0x96'),{'UserId':Number(_0x4a7d99[_0x162f('0x3a')]['ids'][_0x5552ff]),'VoiceQueueId':Number(_0x4a7d99[_0x162f('0x5e')]['id'])});}}else{socket[_0x162f('0x99')](_0x162f('0x96'),{'UserId':Number(_0x4a7d99['query']['ids']),'VoiceQueueId':Number(_0x4a7d99['params']['id'])});}});}})[_0x162f('0x29')](function(_0x544ed8){return db[_0x162f('0x7c')][_0x162f('0x2a')]({'where':{'VoiceQueueId':_0x4a7d99[_0x162f('0x5e')]['id'],'UserId':_0x4a7d99[_0x162f('0x3a')][_0x162f('0x80')]}})[_0x162f('0x29')](function(){return _0x544ed8;});})[_0x162f('0x29')](respondWithStatusCode(_0x5c26f2,null))[_0x162f('0x5a')](handleError(_0x5c26f2,null));};exports[_0x162f('0x9c')]=function(_0x1e2053,_0x4e6db9,_0x3e6590){var _0x28fd51={};var _0x39308a={};var _0x4c9db0;var _0x3fc387;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x1e2053[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4e6db9,null))['then'](function(_0x6c166){if(_0x6c166){_0x4c9db0=_0x6c166;_0x39308a['model']=_['keys'](db[_0x162f('0x71')][_0x162f('0x37')]);_0x39308a['query']=_[_0x162f('0x3b')](_0x1e2053[_0x162f('0x3a')]);_0x39308a['filters']=_[_0x162f('0x3e')](_0x39308a[_0x162f('0x3d')],_0x39308a[_0x162f('0x3a')]);_0x28fd51['attributes']=_['intersection'](_0x39308a[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x1e2053[_0x162f('0x3a')][_0x162f('0x3f')]));_0x28fd51[_0x162f('0x40')]=_0x28fd51[_0x162f('0x40')][_0x162f('0x50')]?_0x28fd51[_0x162f('0x40')]:_0x39308a['model'];_0x28fd51[_0x162f('0x43')]=qs['sort'](_0x1e2053[_0x162f('0x3a')][_0x162f('0x44')]);_0x28fd51[_0x162f('0x45')]=qs['filters'](_[_0x162f('0x46')](_0x1e2053[_0x162f('0x3a')],_0x39308a['filters']));if(_0x1e2053['query'][_0x162f('0x47')]){_0x28fd51[_0x162f('0x45')]=_[_0x162f('0x48')](_0x28fd51[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x28fd51[_0x162f('0x40')],function(_0xe3b537){var _0x5ae33d={};_0x5ae33d[_0xe3b537]={'$like':'%'+_0x1e2053[_0x162f('0x3a')]['filter']+'%'};return _0x5ae33d;})});}_0x28fd51=_[_0x162f('0x48')]({},_0x28fd51,_0x1e2053[_0x162f('0x4a')]);return _0x4c9db0[_0x162f('0x9c')](_0x28fd51);}})['then'](function(_0x4641a5){if(_0x4641a5){_0x3fc387=_0x4641a5[_0x162f('0x50')];if(!_0x1e2053[_0x162f('0x3a')][_0x162f('0x41')]('nolimit')){_0x28fd51[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x1e2053[_0x162f('0x3a')][_0x162f('0x23')]);_0x28fd51[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x1e2053['query'][_0x162f('0x20')]);}return _0x4c9db0['getAgents'](_0x28fd51);}})[_0x162f('0x29')](function(_0x558cdf){if(_0x558cdf){return _0x558cdf?{'count':_0x3fc387,'rows':_0x558cdf}:null;}})[_0x162f('0x29')](respondWithResult(_0x4e6db9,null))['catch'](handleError(_0x4e6db9,null));};exports[_0x162f('0x9d')]=function(_0x32eb18,_0x5788b3,_0x51664f){var _0x258ff5={};var _0xa1ff32={};var _0x5ce9b0;var _0x11be64;return db['VoiceQueue']['findOne']({'where':{'id':_0x32eb18[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x5788b3,null))[_0x162f('0x29')](function(_0x446eb9){if(_0x446eb9){_0x5ce9b0=_0x446eb9;_0xa1ff32[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x7c')][_0x162f('0x37')]);_0xa1ff32['query']=_['keys'](_0x32eb18[_0x162f('0x3a')]);_0xa1ff32[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0xa1ff32[_0x162f('0x3d')],_0xa1ff32[_0x162f('0x3a')]);_0x258ff5['attributes']=_[_0x162f('0x3e')](_0xa1ff32[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x32eb18[_0x162f('0x3a')][_0x162f('0x3f')]));_0x258ff5[_0x162f('0x40')]=_0x258ff5['attributes'][_0x162f('0x50')]?_0x258ff5[_0x162f('0x40')]:_0xa1ff32[_0x162f('0x3d')];_0x258ff5[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x32eb18['query']['sort']);_0x258ff5[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x32eb18[_0x162f('0x3a')],_0xa1ff32['filters']));if(_0x32eb18['query']['filter']){_0x258ff5[_0x162f('0x45')]=_[_0x162f('0x48')](_0x258ff5['where'],{'$or':_['map'](_0x258ff5[_0x162f('0x40')],function(_0x1236f5){var _0x1d43f3={};_0x1d43f3[_0x1236f5]={'$like':'%'+_0x32eb18[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x1d43f3;})});}_0x258ff5=_[_0x162f('0x48')]({},_0x258ff5,_0x32eb18[_0x162f('0x4a')]);return _0x5ce9b0[_0x162f('0x9d')](_0x258ff5);}})[_0x162f('0x29')](function(_0x319876){if(_0x319876){_0x11be64=_0x319876[_0x162f('0x50')];if(!_0x32eb18[_0x162f('0x3a')]['hasOwnProperty'](_0x162f('0x42'))){_0x258ff5[_0x162f('0x23')]=qs['limit'](_0x32eb18['query'][_0x162f('0x23')]);_0x258ff5[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x32eb18[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x5ce9b0['getMembers'](_0x258ff5);}})[_0x162f('0x29')](function(_0x4d7722){return _0x4d7722?{'count':_0x11be64,'rows':_0x4d7722}:null;})[_0x162f('0x29')](respondWithResult(_0x5788b3,null))[_0x162f('0x5a')](handleError(_0x5788b3,null));};exports[_0x162f('0x9e')]=function(_0x2fa4b0,_0xb12f49,_0x1a30b1){var _0x6f1c49={};var _0x3ce9c2={};var _0x389580;var _0xd84c50;return db[_0x162f('0x36')][_0x162f('0x67')]({'where':{'id':_0x2fa4b0['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0xb12f49,null))['then'](function(_0x4206a2){if(_0x4206a2){_0x389580=_0x4206a2;_0x3ce9c2[_0x162f('0x3d')]=_[_0x162f('0x3b')](db[_0x162f('0x9f')][_0x162f('0x37')]);_0x3ce9c2['query']=_[_0x162f('0x3b')](_0x2fa4b0[_0x162f('0x3a')]);_0x3ce9c2['filters']=_[_0x162f('0x3e')](_0x3ce9c2[_0x162f('0x3d')],_0x3ce9c2['query']);_0x6f1c49[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x3ce9c2[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x3f')]));_0x6f1c49[_0x162f('0x40')]=_0x6f1c49[_0x162f('0x40')][_0x162f('0x50')]?_0x6f1c49[_0x162f('0x40')]:_0x3ce9c2[_0x162f('0x3d')];_0x6f1c49['order']=qs[_0x162f('0x44')](_0x2fa4b0['query'][_0x162f('0x44')]);_0x6f1c49['where']=qs['filters'](_[_0x162f('0x46')](_0x2fa4b0[_0x162f('0x3a')],_0x3ce9c2[_0x162f('0x3c')]));if(_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x47')]){_0x6f1c49[_0x162f('0x45')]=_['merge'](_0x6f1c49[_0x162f('0x45')],{'$or':_['map'](_0x6f1c49[_0x162f('0x40')],function(_0x4e0ec6){var _0x270d2d={};_0x270d2d[_0x4e0ec6]={'$like':'%'+_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x270d2d;})});}_0x6f1c49=_[_0x162f('0x48')]({},_0x6f1c49,_0x2fa4b0['options']);return _0x389580[_0x162f('0x9e')](_0x6f1c49);}})[_0x162f('0x29')](function(_0x26a35e){if(_0x26a35e){_0xd84c50=_0x26a35e['length'];if(!_0x2fa4b0[_0x162f('0x3a')]['hasOwnProperty']('nolimit')){_0x6f1c49['limit']=qs[_0x162f('0x23')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x23')]);_0x6f1c49['offset']=qs[_0x162f('0x20')](_0x2fa4b0[_0x162f('0x3a')][_0x162f('0x20')]);}return _0x389580[_0x162f('0x9e')](_0x6f1c49);}})['then'](function(_0x16b312){if(_0x16b312){return _0x16b312?{'count':_0xd84c50,'rows':_0x16b312}:null;}})[_0x162f('0x29')](respondWithResult(_0xb12f49,null))['catch'](handleError(_0xb12f49,null));};exports['addLists']=function(_0x570578,_0x286b17,_0x4c27a0){var _0x49a977=moment()[_0x162f('0x7e')](_0x162f('0xa0'));var _0x4746b0,_0x187d50;return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x570578[_0x162f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x286b17,null))[_0x162f('0x29')](function(_0x263beb){if(_0x263beb){_0x187d50=_0x263beb;return _0x263beb[_0x162f('0xa1')](_0x570578[_0x162f('0x61')]['ids'],_[_0x162f('0x5f')](_0x570578['body'],['ids','id'])||{});}return null;})[_0x162f('0x98')](function(_0x2e18ad){var _0x384ebe;_0x4746b0=_0x2e18ad||[];var _0x17b7db=[];if(_0x2e18ad){for(var _0x2c36b9=0x0;_0x2c36b9<_0x2e18ad['length'];_0x2c36b9+=0x1){var _0x2e27fb=_0x2e18ad[_0x2c36b9][_0x162f('0x53')]({'plain':!![]});_0x187d50[_0x162f('0xa2')]=_0x570578['body']['dialCheckDuplicateType']?_0x570578[_0x162f('0x61')][_0x162f('0xa2')]:_0x187d50[_0x162f('0xa2')];switch(_0x187d50[_0x162f('0xa2')]){case _0x162f('0xa3'):_0x384ebe=squel[_0x162f('0xa4')]()['into']('cm_hopper')['fromQuery']([_0x162f('0xa5'),'scheduledAt',_0x162f('0xa6'),_0x162f('0xa7'),_0x162f('0x65'),_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')](_0x162f('0xa5'),_0x162f('0xa5'))['field']('\x27'+_0x49a977+'\x27','scheduledAt')[_0x162f('0x82')]('id','ContactId')[_0x162f('0x82')](_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x162f('0xad'),squel[_0x162f('0x81')]()[_0x162f('0x82')]('COALESCE(calleridnum,\x27\x27)')[_0x162f('0x83')]('cm_hopper_final')[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]()))[_0x162f('0x45')](_0x162f('0xad'),squel[_0x162f('0x81')]()['field'](_0x162f('0xaf'))['from'](_0x162f('0xb0'))[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]())))[_0x162f('0xa9')]();break;case _0x162f('0xb1'):_0x384ebe=squel['insert']()[_0x162f('0xb2')](_0x162f('0xb0'))[_0x162f('0xb3')]([_0x162f('0xa5'),_0x162f('0xb4'),_0x162f('0xa6'),'ListId','VoiceQueueId',_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')]('phone',_0x162f('0xa5'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','scheduledAt')[_0x162f('0x82')]('id',_0x162f('0xa6'))['field'](_0x2e27fb[_0x162f('0xa8')][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id']['toString'](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','updatedAt')[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x2e27fb['CmListId'][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x162f('0xad'),squel[_0x162f('0x81')]()[_0x162f('0x82')]('COALESCE(phone,\x27\x27)')[_0x162f('0x83')](_0x162f('0xb0'))[_0x162f('0x45')](_0x162f('0xae'),_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')]())))[_0x162f('0xa9')]();break;default:_0x384ebe=squel[_0x162f('0xa4')]()[_0x162f('0xb2')](_0x162f('0xb0'))['fromQuery'](['phone',_0x162f('0xb4'),_0x162f('0xa6'),_0x162f('0xa7'),_0x162f('0x65'),'createdAt','updatedAt'],squel['select']()[_0x162f('0x82')]('phone',_0x162f('0xa5'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0xb4'))['field']('id',_0x162f('0xa6'))[_0x162f('0x82')](_0x2e27fb['CmListId']['toString'](),'ListId')[_0x162f('0x82')](_0x570578[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27',_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))['where'](_0x162f('0xac'),_0x2e27fb[_0x162f('0xa8')]['toString']())[_0x162f('0x45')](_0x162f('0xb5')))[_0x162f('0xa9')]();}_0x17b7db[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x384ebe));}return BPromise[_0x162f('0x8f')](_0x17b7db);}})[_0x162f('0x29')](function(){var _0xcb9973=[];var _0x35f2f0=squel[_0x162f('0xa4')]()['into'](_0x162f('0xb6'))[_0x162f('0xb3')](['CmHopperId',_0x162f('0xa5'),_0x162f('0xb7'),_0x162f('0x60'),_0x162f('0x62')],squel[_0x162f('0x81')]()[_0x162f('0x82')](_0x162f('0xb8'))[_0x162f('0x82')](_0x162f('0xb9'))[_0x162f('0x82')](_0x162f('0xba'))['field']('\x27'+_0x49a977+'\x27',_0x162f('0x60'))[_0x162f('0x82')]('\x27'+_0x49a977+'\x27','updatedAt')[_0x162f('0x83')](_0x162f('0xbb'),'ci')[_0x162f('0x85')]('cm_hopper','h',_0x162f('0xbc'))['where'](_0x162f('0xbd'),_0x49a977)[_0x162f('0x45')](_0x162f('0xbe'),'PHONE'))[_0x162f('0xa9')]();_0xcb9973[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x35f2f0));return BPromise[_0x162f('0x8f')](_0xcb9973);})[_0x162f('0x29')](function(){return _0x4746b0;})[_0x162f('0x29')](respondWithResult(_0x286b17,null))[_0x162f('0x5a')](handleError(_0x286b17,null));};exports[_0x162f('0xbf')]=function(_0x5c5999,_0x3d570a,_0x15feab){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x5c5999['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3d570a,null))[_0x162f('0x29')](function(_0x31cf99){if(_0x31cf99){return _0x31cf99[_0x162f('0xbf')](_0x5c5999[_0x162f('0x3a')][_0x162f('0x80')]);}})[_0x162f('0x29')](function(_0x2c913f){if(_0x2c913f){return db['CmHopper'][_0x162f('0x2a')]({'where':{'ListId':_0x5c5999[_0x162f('0x3a')][_0x162f('0x80')],'VoiceQueueId':_0x5c5999[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(){return _0x2c913f;});}})[_0x162f('0x29')](respondWithStatusCode(_0x3d570a,null))[_0x162f('0x5a')](handleError(_0x3d570a,null));};exports[_0x162f('0xc0')]=function(_0x46162a,_0x184945,_0x48c7b8){var _0x1655e3={};var _0x190988={};var _0x263b80;var _0x5e01b8;return db['VoiceQueue'][_0x162f('0x67')]({'where':{'id':_0x46162a[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x184945,null))[_0x162f('0x29')](function(_0xec07df){if(_0xec07df){_0x263b80=_0xec07df;_0x190988['model']=_['keys'](db[_0x162f('0x9f')][_0x162f('0x37')]);_0x190988[_0x162f('0x3a')]=_[_0x162f('0x3b')](_0x46162a[_0x162f('0x3a')]);_0x190988[_0x162f('0x3c')]=_[_0x162f('0x3e')](_0x190988[_0x162f('0x3d')],_0x190988[_0x162f('0x3a')]);_0x1655e3[_0x162f('0x40')]=_[_0x162f('0x3e')](_0x190988[_0x162f('0x3d')],qs[_0x162f('0x3f')](_0x46162a[_0x162f('0x3a')]['fields']));_0x1655e3[_0x162f('0x40')]=_0x1655e3[_0x162f('0x40')][_0x162f('0x50')]?_0x1655e3[_0x162f('0x40')]:_0x190988[_0x162f('0x3d')];_0x1655e3[_0x162f('0x43')]=qs[_0x162f('0x44')](_0x46162a[_0x162f('0x3a')]['sort']);_0x1655e3[_0x162f('0x45')]=qs[_0x162f('0x3c')](_[_0x162f('0x46')](_0x46162a[_0x162f('0x3a')],_0x190988['filters']));if(_0x46162a['query'][_0x162f('0x47')]){_0x1655e3[_0x162f('0x45')]=_[_0x162f('0x48')](_0x1655e3[_0x162f('0x45')],{'$or':_[_0x162f('0x35')](_0x1655e3[_0x162f('0x40')],function(_0x487396){var _0x157ecd={};_0x157ecd[_0x487396]={'$like':'%'+_0x46162a[_0x162f('0x3a')][_0x162f('0x47')]+'%'};return _0x157ecd;})});}_0x1655e3=_[_0x162f('0x48')]({},_0x1655e3,_0x46162a['options']);return _0x263b80['getBlackLists'](_0x1655e3);}})[_0x162f('0x29')](function(_0x476d2a){if(_0x476d2a){_0x5e01b8=_0x476d2a['length'];if(!_0x46162a[_0x162f('0x3a')][_0x162f('0x41')](_0x162f('0x42'))){_0x1655e3[_0x162f('0x23')]=qs[_0x162f('0x23')](_0x46162a[_0x162f('0x3a')]['limit']);_0x1655e3[_0x162f('0x20')]=qs[_0x162f('0x20')](_0x46162a['query'][_0x162f('0x20')]);}return _0x263b80[_0x162f('0xc0')](_0x1655e3);}})[_0x162f('0x29')](function(_0x39b5a2){if(_0x39b5a2){return _0x39b5a2?{'count':_0x5e01b8,'rows':_0x39b5a2}:null;}})['then'](respondWithResult(_0x184945,null))[_0x162f('0x5a')](handleError(_0x184945,null));};exports[_0x162f('0xc1')]=function(_0x1d69d9,_0x2c75de,_0x5708fb){var _0x2cf913,_0x48ce62;return db['VoiceQueue'][_0x162f('0x2f')]({'where':{'id':_0x1d69d9['params']['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x2c75de,null))[_0x162f('0x29')](function(_0x5dbcbc){if(_0x5dbcbc){_0x48ce62=_0x5dbcbc;return _0x5dbcbc[_0x162f('0xc1')](_0x1d69d9['body'][_0x162f('0x80')],_['omit'](_0x1d69d9['body'],[_0x162f('0x80'),'id'])||{});}return null;})[_0x162f('0x98')](function(_0x41e555){var _0x59d28e;_0x2cf913=_0x41e555||[];var _0x116009=[];if(_0x41e555){for(var _0x6aade7=0x0;_0x6aade7<_0x41e555[_0x162f('0x50')];_0x6aade7+=0x1){var _0x1d1653=_0x41e555[_0x6aade7][_0x162f('0x53')]({'plain':!![]});_0x59d28e=squel['insert']()[_0x162f('0xb2')](_0x162f('0xc2'))[_0x162f('0xb3')]([_0x162f('0xa5'),_0x162f('0xa6'),_0x162f('0xa7'),'VoiceQueueId',_0x162f('0x60'),_0x162f('0x62')],squel['select']()[_0x162f('0x82')]('phone',_0x162f('0xa5'))['field']('id','ContactId')[_0x162f('0x82')](_0x1d1653['CmListId'][_0x162f('0xa9')](),_0x162f('0xa7'))[_0x162f('0x82')](_0x1d69d9[_0x162f('0x5e')]['id'][_0x162f('0xa9')](),_0x162f('0x65'))[_0x162f('0x82')](_0x162f('0xc3'),_0x162f('0x60'))[_0x162f('0x82')](_0x162f('0xc3'),_0x162f('0x62'))[_0x162f('0x83')](_0x162f('0xaa'))[_0x162f('0x45')](_0x162f('0xab'))[_0x162f('0x45')](_0x162f('0xac'),_0x1d1653[_0x162f('0xa8')][_0x162f('0xa9')]())[_0x162f('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0x162f('0xa9')]();_0x116009[_0x162f('0x89')](db[_0x162f('0x8a')][_0x162f('0x3a')](_0x59d28e));}return BPromise[_0x162f('0x8f')](_0x116009);}})['then'](function(){return _0x2cf913;})['then'](respondWithResult(_0x2c75de,null))['catch'](handleError(_0x2c75de,null));};exports[_0x162f('0xc4')]=function(_0x303ead,_0x3b7757,_0x566f8c){return db[_0x162f('0x36')][_0x162f('0x2f')]({'where':{'id':_0x303ead[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](handleEntityNotFound(_0x3b7757,null))[_0x162f('0x29')](function(_0x31f83f){if(_0x31f83f){return _0x31f83f[_0x162f('0xc4')](_0x303ead[_0x162f('0x3a')][_0x162f('0x80')]);}})[_0x162f('0x29')](function(_0x98eeea){if(_0x98eeea){return db[_0x162f('0x6c')]['destroy']({'where':{'ListId':_0x303ead['query'][_0x162f('0x80')],'VoiceQueueId':_0x303ead[_0x162f('0x5e')]['id']}})[_0x162f('0x29')](function(){return _0x98eeea;});}})['then'](respondWithStatusCode(_0x3b7757,null))[_0x162f('0x5a')](handleError(_0x3b7757,null));}; \ No newline at end of file +var _0x1b94=['rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','rows','CmHopperHistory','include','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','isNil','format','emit','userVoiceQueue:save','User','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','CmListId','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','insert','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','CmHopperId','OrderBy','h.id','ci.OrderBy+1','h.ContactId=ci.CmContactId','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','includes','value','type','end','error','stack','name','send','index','VoiceQueue','fieldName','key','keys','filters','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','show','params'];(function(_0x2fa54e,_0x308188){var _0x1348a5=function(_0xffc090){while(--_0xffc090){_0x2fa54e['push'](_0x2fa54e['shift']());}};_0x1348a5(++_0x308188);}(_0x1b94,0x1f2));var _0x41b9=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x1b94[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0x41b9('0x0'));var rimraf=require(_0x41b9('0x1'));var zipdir=require(_0x41b9('0x2'));var jsonpatch=require(_0x41b9('0x3'));var rp=require(_0x41b9('0x4'));var moment=require('moment');var BPromise=require(_0x41b9('0x5'));var Mustache=require(_0x41b9('0x6'));var util=require(_0x41b9('0x7'));var path=require('path');var sox=require(_0x41b9('0x8'));var csv=require(_0x41b9('0x9'));var ejs=require(_0x41b9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41b9('0xb'));var squel=require(_0x41b9('0xc'));var crypto=require(_0x41b9('0xd'));var jsforce=require(_0x41b9('0xe'));var deskjs=require(_0x41b9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x41b9('0x10'));var Papa=require(_0x41b9('0x11'));var Redis=require('ioredis');var authService=require(_0x41b9('0x12'));var qs=require(_0x41b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x41b9('0x14'));var logger=require(_0x41b9('0x15'))('api');var utils=require(_0x41b9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x41b9('0x17'));var db=require('../../mysqldb')['db'];config[_0x41b9('0x18')]=_[_0x41b9('0x19')](config[_0x41b9('0x18')],{'host':_0x41b9('0x1a'),'port':0x18eb});var socket=require(_0x41b9('0x1b'))(new Redis(config['redis']));require(_0x41b9('0x1c'))[_0x41b9('0x1d')](socket);function respondWithStatusCode(_0x5187a8,_0x44ee18){_0x44ee18=_0x44ee18||0xcc;return function(_0x134902){if(_0x134902){return _0x5187a8[_0x41b9('0x1e')](_0x44ee18);}return _0x5187a8[_0x41b9('0x1f')](_0x44ee18)['end']();};}function respondWithResult(_0x5849aa,_0x4a6357){_0x4a6357=_0x4a6357||0xc8;return function(_0x2d7bf0){if(_0x2d7bf0){return _0x5849aa[_0x41b9('0x1f')](_0x4a6357)['json'](_0x2d7bf0);}};}function respondWithFilteredResult(_0x56bd5e,_0x2414c8){return function(_0xfb3b46){if(_0xfb3b46){var _0x17b811=typeof _0x2414c8[_0x41b9('0x20')]===_0x41b9('0x21')&&typeof _0x2414c8[_0x41b9('0x22')]==='undefined';var _0x10bfdf=_0xfb3b46[_0x41b9('0x23')];var _0x5bc794=_0x17b811?0x0:_0x2414c8[_0x41b9('0x20')];var _0x2f6b69=_0x17b811?_0xfb3b46[_0x41b9('0x23')]:_0x2414c8[_0x41b9('0x20')]+_0x2414c8[_0x41b9('0x22')];var _0x1893ca;if(_0x2f6b69>=_0x10bfdf){_0x2f6b69=_0x10bfdf;_0x1893ca=0xc8;}else{_0x1893ca=0xce;}_0x56bd5e['status'](_0x1893ca);return _0x56bd5e[_0x41b9('0x24')]('Content-Range',_0x5bc794+'-'+_0x2f6b69+'/'+_0x10bfdf)[_0x41b9('0x25')](_0xfb3b46);}return null;};}function patchUpdates(_0x14dc16){return function(_0x27b024){try{jsonpatch[_0x41b9('0x26')](_0x27b024,_0x14dc16,!![]);}catch(_0x2fe95){return BPromise['reject'](_0x2fe95);}return _0x27b024[_0x41b9('0x27')]();};}function saveUpdates(_0x50e26b,_0x5553ca){return function(_0x59f751){if(_0x59f751){return _0x59f751[_0x41b9('0x28')](_0x50e26b)[_0x41b9('0x29')](function(_0xfc833b){return _0xfc833b;});}return null;};}function removeEntity(_0x2228d8,_0x136b46){return function(_0x465280){if(_0x465280){return _0x465280[_0x41b9('0x2a')]()[_0x41b9('0x29')](function(){var _0x18ea59=_0x465280['get']({'plain':!![]});var _0x516845=[{'name':_0x41b9('0x2b'),'value':_0x41b9('0x2c'),'ignore':![]},{'name':_0x41b9('0x2d'),'value':_0x41b9('0x2e'),'ignore':![]}];var _0x3dffb2=_(_0x516845)[_0x41b9('0x2f')](_0x41b9('0x30'))[_0x41b9('0x31')]('value')['value']();if(_[_0x41b9('0x32')](_0x3dffb2,_0x18ea59['type'])){return;}var _0x6de6c5=_['find'](_0x516845,[_0x41b9('0x33'),_0x18ea59[_0x41b9('0x34')]])['name'];return db['UserProfileResource'][_0x41b9('0x2a')]({'where':{'type':_0x6de6c5,'resourceId':_0x18ea59['id']}})[_0x41b9('0x29')](function(){return _0x465280;});})['then'](function(){_0x2228d8[_0x41b9('0x1f')](0xcc)[_0x41b9('0x35')]();});}};}function handleEntityNotFound(_0x487477,_0x62770){return function(_0x4d9732){if(!_0x4d9732){_0x487477['sendStatus'](0x194);}return _0x4d9732;};}function handleError(_0x279cec,_0x56f738){_0x56f738=_0x56f738||0x1f4;return function(_0xaeeefd){logger[_0x41b9('0x36')](_0xaeeefd[_0x41b9('0x37')]);if(_0xaeeefd['name']){delete _0xaeeefd[_0x41b9('0x38')];}_0x279cec[_0x41b9('0x1f')](_0x56f738)[_0x41b9('0x39')](_0xaeeefd);};}exports[_0x41b9('0x3a')]=function(_0x699060,_0x2d7414){var _0x411e26={},_0x395c1e={},_0x341ebf={'count':0x0,'rows':[]};var _0x1434b8=_[_0x41b9('0x31')](db[_0x41b9('0x3b')]['rawAttributes'],function(_0x433b95){return{'name':_0x433b95[_0x41b9('0x3c')],'type':_0x433b95[_0x41b9('0x34')][_0x41b9('0x3d')]};});_0x395c1e['model']=_[_0x41b9('0x31')](_0x1434b8,'name');_0x395c1e['query']=_[_0x41b9('0x3e')](_0x699060['query']);_0x395c1e[_0x41b9('0x3f')]=_['intersection'](_0x395c1e[_0x41b9('0x40')],_0x395c1e[_0x41b9('0x41')]);_0x411e26[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x395c1e[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x699060['query']['fields']));_0x411e26[_0x41b9('0x42')]=_0x411e26[_0x41b9('0x42')]['length']?_0x411e26[_0x41b9('0x42')]:_0x395c1e[_0x41b9('0x40')];if(!_0x699060[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0x411e26[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x699060[_0x41b9('0x41')][_0x41b9('0x22')]);_0x411e26[_0x41b9('0x20')]=qs['offset'](_0x699060['query'][_0x41b9('0x20')]);}_0x411e26[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x699060[_0x41b9('0x41')]['sort']);_0x411e26['where']=qs['filters'](_[_0x41b9('0x49')](_0x699060[_0x41b9('0x41')],_0x395c1e[_0x41b9('0x3f')]),_0x1434b8);if(_0x699060['query']['filter']){_0x411e26['where']=_[_0x41b9('0x4a')](_0x411e26[_0x41b9('0x4b')],{'$or':_[_0x41b9('0x31')](_0x1434b8,function(_0x4a221c){if(_0x4a221c[_0x41b9('0x34')]!==_0x41b9('0x4c')){var _0x2b78c5={};_0x2b78c5[_0x4a221c['name']]={'$like':'%'+_0x699060['query'][_0x41b9('0x2f')]+'%'};return _0x2b78c5;}})});}_0x411e26=_[_0x41b9('0x4a')]({},_0x411e26,_0x699060[_0x41b9('0x4d')]);var _0x5560d0={'where':_0x411e26[_0x41b9('0x4b')]};return db[_0x41b9('0x3b')][_0x41b9('0x23')](_0x5560d0)['then'](function(_0x120b34){_0x341ebf[_0x41b9('0x23')]=_0x120b34;if(_0x699060[_0x41b9('0x41')][_0x41b9('0x4e')]){_0x411e26['include']=[{'all':!![]}];}return db[_0x41b9('0x3b')]['findAll'](_0x411e26);})[_0x41b9('0x29')](function(_0x10f1dd){_0x341ebf['rows']=_0x10f1dd;return _0x341ebf;})[_0x41b9('0x29')](respondWithFilteredResult(_0x2d7414,_0x411e26))['catch'](handleError(_0x2d7414,null));};exports[_0x41b9('0x4f')]=function(_0x567c2d,_0x5427f7){var _0x411eeb={'raw':![],'where':{'id':_0x567c2d[_0x41b9('0x50')]['id']}},_0x557c94={};_0x557c94['model']=_[_0x41b9('0x3e')](db[_0x41b9('0x3b')][_0x41b9('0x51')]);_0x557c94[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x567c2d[_0x41b9('0x41')]);_0x557c94[_0x41b9('0x3f')]=_['intersection'](_0x557c94[_0x41b9('0x40')],_0x557c94[_0x41b9('0x41')]);_0x411eeb[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x557c94[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x567c2d[_0x41b9('0x41')][_0x41b9('0x44')]));_0x411eeb[_0x41b9('0x42')]=_0x411eeb['attributes']['length']?_0x411eeb['attributes']:_0x557c94[_0x41b9('0x40')];if(_0x567c2d[_0x41b9('0x41')]['includeAll']){_0x411eeb['include']=[{'all':!![]}];}_0x411eeb=_[_0x41b9('0x4a')]({},_0x411eeb,_0x567c2d[_0x41b9('0x4d')]);return db[_0x41b9('0x3b')][_0x41b9('0x52')](_0x411eeb)[_0x41b9('0x29')](handleEntityNotFound(_0x5427f7,null))[_0x41b9('0x29')](respondWithResult(_0x5427f7,null))[_0x41b9('0x53')](handleError(_0x5427f7,null));};exports['create']=function(_0x430073,_0x1361c2){return db[_0x41b9('0x3b')][_0x41b9('0x54')](_0x430073['body'],{})['then'](function(_0x16cfd8){var _0x38904e=_0x430073[_0x41b9('0x55')]['get']({'plain':!![]});if(!_0x38904e)throw new Error(_0x41b9('0x56'));if(_0x38904e[_0x41b9('0x57')]===_0x41b9('0x55')){var _0x2da43d=_0x16cfd8[_0x41b9('0x58')]({'plain':!![]});var _0x254e90=[{'name':'VoiceQueues','value':_0x41b9('0x2c')},{'name':_0x41b9('0x2d'),'value':_0x41b9('0x2e')}];var _0x1f0ee3=_[_0x41b9('0x52')](_0x254e90,[_0x41b9('0x33'),_0x2da43d['type']])['name'];return db[_0x41b9('0x59')]['find']({'where':{'name':_0x1f0ee3,'userProfileId':_0x38904e[_0x41b9('0x5a')]},'raw':!![]})[_0x41b9('0x29')](function(_0x49aedd){if(_0x49aedd&&_0x49aedd[_0x41b9('0x5b')]===0x0){return db[_0x41b9('0x5c')][_0x41b9('0x54')]({'name':_0x2da43d['name'],'resourceId':_0x2da43d['id'],'type':_0x49aedd['name'],'sectionId':_0x49aedd['id']},{})['then'](function(){return _0x16cfd8;});}else{return _0x16cfd8;}})[_0x41b9('0x53')](function(_0x578a4f){logger[_0x41b9('0x36')](_0x41b9('0x5d'),_0x578a4f);throw _0x578a4f;});}return _0x16cfd8;})['then'](respondWithResult(_0x1361c2,0xc9))['catch'](handleError(_0x1361c2,null));};exports[_0x41b9('0x5e')]=function(_0x20699b,_0x45a58e){var _0x5600da={'where':{'id':_0x20699b[_0x41b9('0x50')]['id']}},_0x704416={};_0x704416[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db['VoiceQueue'][_0x41b9('0x51')]);_0x5600da[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x704416['model'],qs[_0x41b9('0x44')](_0x20699b[_0x41b9('0x41')][_0x41b9('0x44')]));_0x5600da[_0x41b9('0x42')]=_0x5600da[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x5600da[_0x41b9('0x42')]:_0x704416[_0x41b9('0x40')];if(_0x20699b[_0x41b9('0x41')][_0x41b9('0x4e')]){_0x5600da['include']=[{'all':!![]}];}_0x5600da=_[_0x41b9('0x4a')]({},_0x5600da,_0x20699b['options']);return db[_0x41b9('0x3b')][_0x41b9('0x52')](_0x5600da)[_0x41b9('0x29')](handleEntityNotFound(_0x45a58e,null))[_0x41b9('0x29')](function(_0x3f0055){if(_0x3f0055){var _0x22922c=_0x3f0055[_0x41b9('0x58')]({'plain':!![]});_0x22922c=qs[_0x41b9('0x60')](_0x22922c,['id',_0x41b9('0x61'),_0x41b9('0x62')]);_0x20699b[_0x41b9('0x63')]=_[_0x41b9('0x60')](_0x20699b[_0x41b9('0x63')],['id','createdAt',_0x41b9('0x62')]);return db[_0x41b9('0x3b')][_0x41b9('0x54')](_[_0x41b9('0x4a')](_0x22922c,_0x20699b[_0x41b9('0x63')]),{'include':_0x20699b['query'][_0x41b9('0x4e')]?[{'all':!![]}]:undefined})[_0x41b9('0x29')](function(_0x583506){var _0x29b60b=_0x20699b[_0x41b9('0x55')][_0x41b9('0x58')]({'plain':!![]});if(!_0x29b60b)throw new Error(_0x41b9('0x56'));if(_0x29b60b[_0x41b9('0x57')]===_0x41b9('0x55')){var _0x28c18b=_0x583506['get']({'plain':!![]});var _0x1a7034=[{'name':_0x41b9('0x2b'),'value':_0x41b9('0x2c')},{'name':_0x41b9('0x2d'),'value':_0x41b9('0x2e')}];var _0x1273ad=_[_0x41b9('0x52')](_0x1a7034,['value',_0x28c18b[_0x41b9('0x34')]])['name'];return db[_0x41b9('0x59')][_0x41b9('0x52')]({'where':{'name':_0x1273ad,'userProfileId':_0x29b60b[_0x41b9('0x5a')]},'raw':!![]})[_0x41b9('0x29')](function(_0x51604c){if(_0x51604c&&_0x51604c[_0x41b9('0x5b')]===0x0){return db[_0x41b9('0x5c')]['create']({'name':_0x28c18b[_0x41b9('0x38')],'resourceId':_0x28c18b['id'],'type':_0x51604c[_0x41b9('0x38')],'sectionId':_0x51604c['id']},{})[_0x41b9('0x29')](function(){return _0x583506;});}else{return _0x583506;}})['catch'](function(_0x17a7dd){logger[_0x41b9('0x36')](_0x41b9('0x5d'),_0x17a7dd);throw _0x17a7dd;});}return _0x583506;});}})[_0x41b9('0x29')](respondWithResult(_0x45a58e,0xc9))[_0x41b9('0x53')](handleError(_0x45a58e,null));};exports[_0x41b9('0x28')]=function(_0xe5099e,_0x477ba6){if(_0xe5099e[_0x41b9('0x63')]['id']){delete _0xe5099e['body']['id'];}return db[_0x41b9('0x3b')][_0x41b9('0x52')]({'where':{'id':_0xe5099e[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x477ba6,null))[_0x41b9('0x29')](saveUpdates(_0xe5099e[_0x41b9('0x63')],null))['then'](respondWithResult(_0x477ba6,null))['catch'](handleError(_0x477ba6,null));};exports[_0x41b9('0x2a')]=function(_0x21f807,_0x577d55){return db[_0x41b9('0x3b')]['find']({'where':{'id':_0x21f807[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x577d55,null))[_0x41b9('0x29')](removeEntity(_0x577d55,null))[_0x41b9('0x53')](handleError(_0x577d55,null));};exports[_0x41b9('0x64')]=function(_0x5c2ec4,_0x3c4506,_0x7cb52d){var _0xc9a5e={'raw':![],'where':{}};var _0x4e81aa={};var _0x8839c2={'count':0x0,'rows':[]};return db[_0x41b9('0x3b')][_0x41b9('0x65')]({'where':{'id':_0x5c2ec4[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x3c4506,null))[_0x41b9('0x29')](function(_0x542e2c){if(_0x542e2c){_0x4e81aa[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db[_0x41b9('0x66')][_0x41b9('0x51')]);_0x4e81aa[_0x41b9('0x41')]=_['keys'](_0x5c2ec4['query']);_0x4e81aa[_0x41b9('0x3f')]=_['intersection'](_0x4e81aa['model'],_0x4e81aa[_0x41b9('0x41')]);_0xc9a5e['attributes']=_[_0x41b9('0x43')](_0x4e81aa[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x44')]));_0xc9a5e[_0x41b9('0x42')]=_0xc9a5e[_0x41b9('0x42')][_0x41b9('0x5f')]?_0xc9a5e[_0x41b9('0x42')]:_0x4e81aa[_0x41b9('0x40')];if(!_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0xc9a5e[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x5c2ec4[_0x41b9('0x41')]['limit']);_0xc9a5e[_0x41b9('0x20')]=qs['offset'](_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x20')]);}_0xc9a5e[_0x41b9('0x47')]=qs['sort'](_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x48')]);_0xc9a5e[_0x41b9('0x4b')]=qs['filters'](_[_0x41b9('0x49')](_0x5c2ec4[_0x41b9('0x41')],_0x4e81aa[_0x41b9('0x3f')]));_0xc9a5e[_0x41b9('0x4b')][_0x41b9('0x67')]=_0x542e2c['id'];if(_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x2f')]){_0xc9a5e[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0xc9a5e['where'],{'$or':_['map'](_0xc9a5e[_0x41b9('0x42')],function(_0x5f1bc2){var _0x25d07d={};_0x25d07d[_0x5f1bc2]={'$like':'%'+_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x25d07d;})});}_0xc9a5e=_[_0x41b9('0x4a')]({},_0xc9a5e,_0x5c2ec4[_0x41b9('0x4d')]);return db[_0x41b9('0x66')]['count']({'where':_0xc9a5e[_0x41b9('0x4b')]})[_0x41b9('0x29')](function(_0x442045){_0x8839c2[_0x41b9('0x23')]=_0x442045;if(_0x5c2ec4[_0x41b9('0x41')][_0x41b9('0x4e')]){_0xc9a5e['include']=[{'all':!![]}];}return db[_0x41b9('0x66')][_0x41b9('0x68')](_0xc9a5e);})[_0x41b9('0x29')](function(_0xd553cf){_0x8839c2[_0x41b9('0x69')]=_0xd553cf;return _0x8839c2;});}})[_0x41b9('0x29')](respondWithFilteredResult(_0x3c4506,_0xc9a5e))['catch'](handleError(_0x3c4506,null));};exports['getHopperHistories']=function(_0x5a4d7f,_0x58e5df,_0x143dca){var _0x198bb2={'raw':!![],'where':{}};var _0x7cd7fe={};var _0x5183b5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x41b9('0x65')]({'where':{'id':_0x5a4d7f[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x58e5df,null))['then'](function(_0x55d3dd){if(_0x55d3dd){_0x7cd7fe[_0x41b9('0x40')]=_['keys'](db[_0x41b9('0x6a')]['rawAttributes']);_0x7cd7fe[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x5a4d7f[_0x41b9('0x41')]);_0x7cd7fe[_0x41b9('0x3f')]=_['intersection'](_0x7cd7fe['model'],_0x7cd7fe[_0x41b9('0x41')]);_0x198bb2[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x7cd7fe['model'],qs[_0x41b9('0x44')](_0x5a4d7f[_0x41b9('0x41')][_0x41b9('0x44')]));_0x198bb2[_0x41b9('0x42')]=_0x198bb2['attributes'][_0x41b9('0x5f')]?_0x198bb2[_0x41b9('0x42')]:_0x7cd7fe[_0x41b9('0x40')];if(!_0x5a4d7f[_0x41b9('0x41')]['hasOwnProperty'](_0x41b9('0x46'))){_0x198bb2['limit']=qs[_0x41b9('0x22')](_0x5a4d7f['query'][_0x41b9('0x22')]);_0x198bb2[_0x41b9('0x20')]=qs['offset'](_0x5a4d7f[_0x41b9('0x41')]['offset']);}_0x198bb2[_0x41b9('0x47')]=qs['sort'](_0x5a4d7f[_0x41b9('0x41')][_0x41b9('0x48')]);_0x198bb2[_0x41b9('0x4b')]=qs['filters'](_['pick'](_0x5a4d7f[_0x41b9('0x41')],_0x7cd7fe[_0x41b9('0x3f')]));_0x198bb2[_0x41b9('0x4b')]['VoiceQueueId']=_0x55d3dd['id'];if(_0x5a4d7f['query'][_0x41b9('0x2f')]){_0x198bb2[_0x41b9('0x4b')]=_['merge'](_0x198bb2[_0x41b9('0x4b')],{'$or':_['map'](_0x198bb2['attributes'],function(_0x379e5f){var _0xc2849c={};_0xc2849c[_0x379e5f]={'$like':'%'+_0x5a4d7f[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0xc2849c;})});}_0x198bb2=_['merge']({},_0x198bb2,_0x5a4d7f[_0x41b9('0x4d')]);return db[_0x41b9('0x6a')]['count']({'where':_0x198bb2[_0x41b9('0x4b')]})['then'](function(_0x471dda){_0x5183b5[_0x41b9('0x23')]=_0x471dda;if(_0x5a4d7f[_0x41b9('0x41')][_0x41b9('0x4e')]){_0x198bb2[_0x41b9('0x6b')]=[{'all':!![]}];}return db[_0x41b9('0x6a')][_0x41b9('0x68')](_0x198bb2);})[_0x41b9('0x29')](function(_0x1a1829){_0x5183b5[_0x41b9('0x69')]=_0x1a1829;return _0x5183b5;});}})[_0x41b9('0x29')](respondWithFilteredResult(_0x58e5df,_0x198bb2))[_0x41b9('0x53')](handleError(_0x58e5df,null));};exports[_0x41b9('0x6c')]=function(_0x2e5845,_0x3cdfa2,_0x380366){var _0x188795={'raw':!![],'where':{}};var _0x36ab37={};var _0x3f474c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x41b9('0x65')]({'where':{'id':_0x2e5845['params']['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x3cdfa2,null))[_0x41b9('0x29')](function(_0x127042){if(_0x127042){_0x36ab37[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db['CmHopperFinal'][_0x41b9('0x51')]);_0x36ab37['query']=_['keys'](_0x2e5845['query']);_0x36ab37[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x36ab37['model'],_0x36ab37['query']);_0x188795[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x36ab37['model'],qs['fields'](_0x2e5845[_0x41b9('0x41')][_0x41b9('0x44')]));_0x188795[_0x41b9('0x42')]=_0x188795[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x188795[_0x41b9('0x42')]:_0x36ab37[_0x41b9('0x40')];if(!_0x2e5845[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0x188795[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x2e5845[_0x41b9('0x41')]['limit']);_0x188795[_0x41b9('0x20')]=qs[_0x41b9('0x20')](_0x2e5845[_0x41b9('0x41')]['offset']);}_0x188795[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x2e5845[_0x41b9('0x41')][_0x41b9('0x48')]);_0x188795['where']=qs[_0x41b9('0x3f')](_[_0x41b9('0x49')](_0x2e5845[_0x41b9('0x41')],_0x36ab37[_0x41b9('0x3f')]));_0x188795[_0x41b9('0x4b')][_0x41b9('0x67')]=_0x127042['id'];if(_0x2e5845['query']['filter']){_0x188795[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0x188795[_0x41b9('0x4b')],{'$or':_['map'](_0x188795['attributes'],function(_0x2ac50e){var _0x1ac165={};_0x1ac165[_0x2ac50e]={'$like':'%'+_0x2e5845[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x1ac165;})});}_0x188795=_[_0x41b9('0x4a')]({},_0x188795,_0x2e5845['options']);return db['CmHopperFinal'][_0x41b9('0x23')]({'where':_0x188795[_0x41b9('0x4b')]})[_0x41b9('0x29')](function(_0x570af3){_0x3f474c['count']=_0x570af3;if(_0x2e5845[_0x41b9('0x41')][_0x41b9('0x4e')]){_0x188795[_0x41b9('0x6b')]=[{'all':!![]}];}return db[_0x41b9('0x6d')][_0x41b9('0x68')](_0x188795);})['then'](function(_0x4f3484){_0x3f474c[_0x41b9('0x69')]=_0x4f3484;return _0x3f474c;});}})[_0x41b9('0x29')](respondWithFilteredResult(_0x3cdfa2,_0x188795))['catch'](handleError(_0x3cdfa2,null));};exports[_0x41b9('0x6e')]=function(_0x58e6a5,_0x5b8ddf,_0x52b18e){var _0xbd7508={'raw':!![],'where':{}};var _0x32975f={};var _0x283689={'count':0x0,'rows':[]};return db[_0x41b9('0x3b')]['findOne']({'where':{'id':_0x58e6a5[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x5b8ddf,null))[_0x41b9('0x29')](function(_0x1e2762){if(_0x1e2762){_0x32975f['model']=_[_0x41b9('0x3e')](db[_0x41b9('0x6f')][_0x41b9('0x51')]);_0x32975f[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x58e6a5[_0x41b9('0x41')]);_0x32975f[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x32975f['model'],_0x32975f[_0x41b9('0x41')]);_0xbd7508[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x32975f[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x58e6a5[_0x41b9('0x41')]['fields']));_0xbd7508[_0x41b9('0x42')]=_0xbd7508[_0x41b9('0x42')][_0x41b9('0x5f')]?_0xbd7508['attributes']:_0x32975f[_0x41b9('0x40')];if(!_0x58e6a5[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0xbd7508['limit']=qs['limit'](_0x58e6a5[_0x41b9('0x41')]['limit']);_0xbd7508[_0x41b9('0x20')]=qs[_0x41b9('0x20')](_0x58e6a5[_0x41b9('0x41')]['offset']);}_0xbd7508[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x58e6a5[_0x41b9('0x41')]['sort']);_0xbd7508[_0x41b9('0x4b')]=qs[_0x41b9('0x3f')](_['pick'](_0x58e6a5[_0x41b9('0x41')],_0x32975f[_0x41b9('0x3f')]));_0xbd7508[_0x41b9('0x4b')][_0x41b9('0x67')]=_0x1e2762['id'];if(_0x58e6a5[_0x41b9('0x41')][_0x41b9('0x2f')]){_0xbd7508[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0xbd7508['where'],{'$or':_['map'](_0xbd7508[_0x41b9('0x42')],function(_0xdbfb22){var _0xbaceda={};_0xbaceda[_0xdbfb22]={'$like':'%'+_0x58e6a5[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0xbaceda;})});}_0xbd7508=_[_0x41b9('0x4a')]({},_0xbd7508,_0x58e6a5[_0x41b9('0x4d')]);return db[_0x41b9('0x6f')]['count']({'where':_0xbd7508[_0x41b9('0x4b')]})[_0x41b9('0x29')](function(_0x8553dc){_0x283689[_0x41b9('0x23')]=_0x8553dc;if(_0x58e6a5[_0x41b9('0x41')][_0x41b9('0x4e')]){_0xbd7508[_0x41b9('0x6b')]=[{'all':!![]}];}return db[_0x41b9('0x6f')][_0x41b9('0x68')](_0xbd7508);})['then'](function(_0x1ae84c){_0x283689['rows']=_0x1ae84c;return _0x283689;});}})[_0x41b9('0x29')](respondWithFilteredResult(_0x5b8ddf,_0xbd7508))[_0x41b9('0x53')](handleError(_0x5b8ddf,null));};exports[_0x41b9('0x70')]=function(_0x7bc7eb,_0x278a0a,_0x2105c1){var _0x4a93c7={};var _0x5a3f8c={};var _0x4d3948;var _0x23786e;return db[_0x41b9('0x3b')]['findOne']({'where':{'id':_0x7bc7eb[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x278a0a,null))[_0x41b9('0x29')](function(_0x491b33){if(_0x491b33){_0x4d3948=_0x491b33;_0x5a3f8c['model']=_[_0x41b9('0x3e')](db[_0x41b9('0x71')]['rawAttributes']);_0x5a3f8c[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x7bc7eb[_0x41b9('0x41')]);_0x5a3f8c[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x5a3f8c[_0x41b9('0x40')],_0x5a3f8c['query']);_0x4a93c7[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x5a3f8c['model'],qs['fields'](_0x7bc7eb[_0x41b9('0x41')][_0x41b9('0x44')]));_0x4a93c7['attributes']=_0x4a93c7[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x4a93c7['attributes']:_0x5a3f8c['model'];_0x4a93c7[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x7bc7eb[_0x41b9('0x41')][_0x41b9('0x48')]);_0x4a93c7[_0x41b9('0x4b')]=qs[_0x41b9('0x3f')](_[_0x41b9('0x49')](_0x7bc7eb[_0x41b9('0x41')],_0x5a3f8c[_0x41b9('0x3f')]));if(_0x7bc7eb['query'][_0x41b9('0x2f')]){_0x4a93c7[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0x4a93c7[_0x41b9('0x4b')],{'$or':_['map'](_0x4a93c7['attributes'],function(_0x3c2391){var _0x3242d0={};_0x3242d0[_0x3c2391]={'$like':'%'+_0x7bc7eb[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x3242d0;})});}_0x4a93c7=_[_0x41b9('0x4a')]({},_0x4a93c7,_0x7bc7eb[_0x41b9('0x4d')]);return _0x4d3948[_0x41b9('0x70')](_0x4a93c7);}})[_0x41b9('0x29')](function(_0x2c9bd2){if(_0x2c9bd2){_0x23786e=_0x2c9bd2[_0x41b9('0x5f')];if(!_0x7bc7eb[_0x41b9('0x41')]['hasOwnProperty'](_0x41b9('0x46'))){_0x4a93c7[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x7bc7eb[_0x41b9('0x41')][_0x41b9('0x22')]);_0x4a93c7['offset']=qs[_0x41b9('0x20')](_0x7bc7eb[_0x41b9('0x41')][_0x41b9('0x20')]);}return _0x4d3948[_0x41b9('0x70')](_0x4a93c7);}})[_0x41b9('0x29')](function(_0x2bd18f){if(_0x2bd18f){return _0x2bd18f?{'count':_0x23786e,'rows':_0x2bd18f}:null;}})[_0x41b9('0x29')](respondWithResult(_0x278a0a,null))['catch'](handleError(_0x278a0a,null));};exports[_0x41b9('0x72')]=function(_0x2888fd,_0x55bc82,_0x48c58c){var _0x5ef377=_0x2888fd[_0x41b9('0x63')][_0x41b9('0x73')];var _0x1f2393=_[_0x41b9('0x31')](_0x5ef377,'id');return db['Team'][_0x41b9('0x68')]({'where':{'id':_0x1f2393},'attributes':['id'],'include':[{'model':db['User'],'as':_0x41b9('0x74'),'attributes':['id',_0x41b9('0x38'),_0x41b9('0x75'),_0x41b9('0x76'),_0x41b9('0x77')],'raw':!![]}]})[_0x41b9('0x29')](function(_0x15755c){if(_0x15755c){var _0x21d4fe=_[_0x41b9('0x78')](_0x15755c,function(_0x2468d8){var _0x37e12c=_0x2468d8[_0x41b9('0x58')]({'plain':!![]});_0x37e12c['Agents'][_0x41b9('0x79')](function(_0x51b53e){_0x51b53e[_0x41b9('0x7a')]=_[_0x41b9('0x52')](_0x5ef377,{'id':_0x37e12c['id']})['penalty'];});return _0x37e12c[_0x41b9('0x74')];});return db['VoiceQueue']['find']({'where':{'id':_0x2888fd['params']['id']}})[_0x41b9('0x29')](function(_0x4df1aa){return db['sequelize'][_0x41b9('0x7b')](function(_0x116145){return _0x4df1aa['addTeams'](_0x1f2393,{'transaction':_0x116145})[_0x41b9('0x29')](function(){return BPromise[_0x41b9('0x7c')](_0x5ef377,function(_0x53df18){return db[_0x41b9('0x7d')][_0x41b9('0x7e')]({'TeamId':_0x53df18['id'],'VoiceQueueId':_0x2888fd['params']['id'],'penalty':_0x53df18[_0x41b9('0x7a')]},{'transaction':_0x116145});});})[_0x41b9('0x29')](function(){return BPromise[_0x41b9('0x7c')](_0x21d4fe,function(_0x18d59a){return db[_0x41b9('0x7f')][_0x41b9('0x80')]({'where':{'UserId':_0x18d59a['id'],'VoiceQueueId':_0x2888fd[_0x41b9('0x50')]['id']},'defaults':{'penalty':_0x18d59a[_0x41b9('0x7a')]},'transaction':_0x116145});});})[_0x41b9('0x29')](function(){return BPromise[_0x41b9('0x7c')](_['filter'](_0x21d4fe,{'online':!![]}),function(_0x536da4){return db['UserVoiceQueueRt'][_0x41b9('0x7e')]({'membername':_0x536da4[_0x41b9('0x38')],'UserId':_0x536da4['id'],'queue_name':_0x4df1aa['name'],'VoiceQueueId':_0x4df1aa['id'],'interface':_[_0x41b9('0x81')](_0x536da4[_0x41b9('0x77')])?util[_0x41b9('0x82')]('SIP/%s',_0x536da4[_0x41b9('0x38')]):_0x536da4['interface'],'paused':_0x536da4[_0x41b9('0x76')]||![],'penalty':_0x536da4[_0x41b9('0x7a')]},{'transaction':_0x116145});});})[_0x41b9('0x29')](function(){_0x21d4fe[_0x41b9('0x79')](function(_0x53f967){socket[_0x41b9('0x83')](_0x41b9('0x84'),{'UserId':_0x53f967['id'],'VoiceQueueId':_0x4df1aa['id']});});});});});}})[_0x41b9('0x29')](respondWithStatusCode(_0x55bc82,null))[_0x41b9('0x53')](handleError(_0x55bc82,null));};exports['removeTeams']=function(_0x60bfe3,_0x49fbe4,_0x16824d){return db[_0x41b9('0x71')][_0x41b9('0x68')]({'where':{'id':_0x60bfe3[_0x41b9('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0x41b9('0x85')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x41b9('0x29')](handleEntityNotFound(_0x49fbe4,null))[_0x41b9('0x29')](function(_0x309795){var _0x39499f=_[_0x41b9('0x31')](_0x309795,'id');var _0x1e1da5=[];var _0x5c9bd6=[];var _0x4d1e41=squel['select']();_0x4d1e41['field'](_0x41b9('0x86'))[_0x41b9('0x87')]('team_has_voice_queues','tq')[_0x41b9('0x88')](_0x41b9('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x41b9('0x8a'),_0x60bfe3['params']['id']);for(var _0xbad31d=0x0;_0xbad31d<_0x309795['length'];_0xbad31d+=0x1){let _0x172804=_0x309795[_0xbad31d];for(var _0x28c085=0x0;_0x28c085<_0x172804[_0x41b9('0x74')][_0x41b9('0x5f')];_0x28c085+=0x1){let _0x200c8e=_0x172804['Agents'][_0x28c085];var _0x1bd53c=_0x4d1e41[_0x41b9('0x5e')]();_0x1bd53c['where'](_0x41b9('0x8b'),_0x200c8e['id']);_0x5c9bd6[_0x41b9('0x8c')](db[_0x41b9('0x8d')][_0x41b9('0x41')](_0x1bd53c[_0x41b9('0x8e')](),{'type':db[_0x41b9('0x8d')][_0x41b9('0x8f')]['SELECT']})[_0x41b9('0x29')](function(_0xf64bbe){if(_0xf64bbe['length']===0x1){return _0x200c8e['id'];}else{var _0xe213bc=_[_0x41b9('0x90')](_[_0x41b9('0x31')](_0xf64bbe,_0x41b9('0x91')),function(_0x5d654b){return _[_0x41b9('0x32')](_0x39499f,_0x5d654b);});if(_0xe213bc){return _0x200c8e['id'];}}}));}}return BPromise[_0x41b9('0x92')](_0x5c9bd6)[_0x41b9('0x29')](function(_0x313e4d){_0x1e1da5=_(_0x1e1da5)[_0x41b9('0x93')](_0x313e4d)[_0x41b9('0x94')]()[_0x41b9('0x33')]();return db[_0x41b9('0x3b')]['find']({'where':{'id':_0x60bfe3[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](function(_0x3d7018){return db[_0x41b9('0x8d')][_0x41b9('0x7b')](function(_0xf1e43){return _0x3d7018['removeTeams'](_0x60bfe3[_0x41b9('0x41')][_0x41b9('0x95')],{'transaction':_0xf1e43})[_0x41b9('0x29')](function(){if(!_[_0x41b9('0x96')](_0x1e1da5)){return _0x3d7018[_0x41b9('0x97')](_0x1e1da5,{'transaction':_0xf1e43})[_0x41b9('0x29')](function(){return db[_0x41b9('0x98')][_0x41b9('0x2a')]({'where':{'VoiceQueueId':_0x60bfe3[_0x41b9('0x50')]['id'],'UserId':_0x1e1da5},'transaction':_0xf1e43});});}})[_0x41b9('0x29')](function(){_0x1e1da5[_0x41b9('0x79')](function(_0x2df6ea){socket[_0x41b9('0x83')](_0x41b9('0x99'),{'UserId':_0x2df6ea,'VoiceQueueId':_0x3d7018['id']});});});});});});})[_0x41b9('0x29')](respondWithStatusCode(_0x49fbe4,null))['catch'](handleError(_0x49fbe4,null));};exports[_0x41b9('0x9a')]=function(_0x383fde,_0x1674cc,_0x30380e){var _0xb79a4b,_0x39046d;return db[_0x41b9('0x3b')][_0x41b9('0x52')]({'where':{'id':_0x383fde[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x1674cc,null))[_0x41b9('0x29')](function(_0x2d1a91){if(_0x2d1a91){_0x39046d=_0x2d1a91;return _0x2d1a91[_0x41b9('0x9a')](_0x383fde[_0x41b9('0x63')][_0x41b9('0x95')],_['omit'](_0x383fde['body'],[_0x41b9('0x95'),'id'])||{})[_0x41b9('0x9b')](function(_0x18cf01){for(var _0xdc51f7=0x0;_0xdc51f7<_0x383fde[_0x41b9('0x63')][_0x41b9('0x95')][_0x41b9('0x5f')];_0xdc51f7+=0x1){socket['emit'](_0x41b9('0x84'),{'UserId':Number(_0x383fde[_0x41b9('0x63')]['ids'][_0xdc51f7]),'VoiceQueueId':Number(_0x383fde[_0x41b9('0x50')]['id'])});}return _0x18cf01;});}})[_0x41b9('0x29')](function(_0xd1174b){_0xb79a4b=_0xd1174b||[];if(_0x39046d){return db[_0x41b9('0x85')]['findAll']({'where':{'id':_0x383fde[_0x41b9('0x63')][_0x41b9('0x95')]},'attributes':['id',_0x41b9('0x38'),_0x41b9('0x75'),_0x41b9('0x76'),_0x41b9('0x77')],'raw':!![]});}})[_0x41b9('0x29')](function(_0xa9df0c){if(!_[_0x41b9('0x96')](_0xa9df0c)){var _0x28fdbe=[];for(var _0x117a4d=0x0;_0x117a4d<_0xa9df0c[_0x41b9('0x5f')];_0x117a4d++){if(_0xa9df0c[_0x117a4d][_0x41b9('0x75')]){_0x28fdbe[_0x41b9('0x8c')](db[_0x41b9('0x98')][_0x41b9('0x7e')]({'membername':_0xa9df0c[_0x117a4d][_0x41b9('0x38')],'UserId':_0xa9df0c[_0x117a4d]['id'],'queue_name':_0x39046d[_0x41b9('0x38')],'VoiceQueueId':_0x39046d['id'],'interface':_[_0x41b9('0x81')](_0xa9df0c[_0x117a4d][_0x41b9('0x77')])?util[_0x41b9('0x82')](_0x41b9('0x9c'),_0xa9df0c[_0x117a4d]['name']):_0xa9df0c[_0x117a4d][_0x41b9('0x77')],'paused':_0xa9df0c[_0x117a4d]['voicePause']||![],'penalty':_0x383fde[_0x41b9('0x63')][_0x41b9('0x7a')]||0x0}));}}return BPromise[_0x41b9('0x92')](_0x28fdbe);}})[_0x41b9('0x29')](function(){return _0xb79a4b;})[_0x41b9('0x29')](respondWithResult(_0x1674cc,null))[_0x41b9('0x53')](handleError(_0x1674cc,null));};exports[_0x41b9('0x97')]=function(_0x47f681,_0x13fe30,_0x26aac5){return db[_0x41b9('0x3b')][_0x41b9('0x52')]({'where':{'id':_0x47f681[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x13fe30,null))['then'](function(_0x339023){if(_0x339023){return _0x339023['removeAgents'](_0x47f681[_0x41b9('0x41')][_0x41b9('0x95')])[_0x41b9('0x29')](function(){if(_[_0x41b9('0x9d')](_0x47f681[_0x41b9('0x41')][_0x41b9('0x95')])){for(var _0x1d38dc=0x0;_0x1d38dc<_0x47f681[_0x41b9('0x41')][_0x41b9('0x95')][_0x41b9('0x5f')];_0x1d38dc+=0x1){socket[_0x41b9('0x83')]('userVoiceQueue:remove',{'UserId':Number(_0x47f681[_0x41b9('0x41')]['ids'][_0x1d38dc]),'VoiceQueueId':Number(_0x47f681['params']['id'])});}}else{socket[_0x41b9('0x83')](_0x41b9('0x99'),{'UserId':Number(_0x47f681[_0x41b9('0x41')][_0x41b9('0x95')]),'VoiceQueueId':Number(_0x47f681[_0x41b9('0x50')]['id'])});}});}})[_0x41b9('0x29')](function(_0x476b9f){return db[_0x41b9('0x98')]['destroy']({'where':{'VoiceQueueId':_0x47f681[_0x41b9('0x50')]['id'],'UserId':_0x47f681[_0x41b9('0x41')][_0x41b9('0x95')]}})['then'](function(){return _0x476b9f;});})[_0x41b9('0x29')](respondWithStatusCode(_0x13fe30,null))[_0x41b9('0x53')](handleError(_0x13fe30,null));};exports[_0x41b9('0x9e')]=function(_0x41d217,_0x18e17a,_0x3a8a7b){var _0x1a1d16={};var _0x2248a4={};var _0x4d95af;var _0x1b4310;return db['VoiceQueue'][_0x41b9('0x65')]({'where':{'id':_0x41d217[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x18e17a,null))['then'](function(_0x40cea9){if(_0x40cea9){_0x4d95af=_0x40cea9;_0x2248a4[_0x41b9('0x40')]=_['keys'](db[_0x41b9('0x85')]['rawAttributes']);_0x2248a4[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x41d217['query']);_0x2248a4[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x2248a4[_0x41b9('0x40')],_0x2248a4[_0x41b9('0x41')]);_0x1a1d16[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x2248a4[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x41d217[_0x41b9('0x41')][_0x41b9('0x44')]));_0x1a1d16[_0x41b9('0x42')]=_0x1a1d16[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x1a1d16['attributes']:_0x2248a4[_0x41b9('0x40')];_0x1a1d16[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x41d217[_0x41b9('0x41')]['sort']);_0x1a1d16[_0x41b9('0x4b')]=qs['filters'](_[_0x41b9('0x49')](_0x41d217['query'],_0x2248a4[_0x41b9('0x3f')]));if(_0x41d217[_0x41b9('0x41')][_0x41b9('0x2f')]){_0x1a1d16[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0x1a1d16[_0x41b9('0x4b')],{'$or':_[_0x41b9('0x31')](_0x1a1d16['attributes'],function(_0x4c1eb9){var _0x593639={};_0x593639[_0x4c1eb9]={'$like':'%'+_0x41d217['query'][_0x41b9('0x2f')]+'%'};return _0x593639;})});}_0x1a1d16=_['merge']({},_0x1a1d16,_0x41d217['options']);return _0x4d95af[_0x41b9('0x9e')](_0x1a1d16);}})[_0x41b9('0x29')](function(_0x3c72c5){if(_0x3c72c5){_0x1b4310=_0x3c72c5[_0x41b9('0x5f')];if(!_0x41d217[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0x1a1d16['limit']=qs['limit'](_0x41d217[_0x41b9('0x41')][_0x41b9('0x22')]);_0x1a1d16[_0x41b9('0x20')]=qs[_0x41b9('0x20')](_0x41d217[_0x41b9('0x41')][_0x41b9('0x20')]);}return _0x4d95af[_0x41b9('0x9e')](_0x1a1d16);}})[_0x41b9('0x29')](function(_0x2e9936){if(_0x2e9936){return _0x2e9936?{'count':_0x1b4310,'rows':_0x2e9936}:null;}})['then'](respondWithResult(_0x18e17a,null))[_0x41b9('0x53')](handleError(_0x18e17a,null));};exports[_0x41b9('0x9f')]=function(_0x541656,_0x3899ae,_0x3a1f70){var _0x59b546={};var _0x25dc5a={};var _0x1ffb0d;var _0x57f799;return db['VoiceQueue'][_0x41b9('0x65')]({'where':{'id':_0x541656[_0x41b9('0x50')]['id']}})['then'](handleEntityNotFound(_0x3899ae,null))[_0x41b9('0x29')](function(_0x372234){if(_0x372234){_0x1ffb0d=_0x372234;_0x25dc5a[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db['UserVoiceQueueRt'][_0x41b9('0x51')]);_0x25dc5a[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x541656[_0x41b9('0x41')]);_0x25dc5a['filters']=_['intersection'](_0x25dc5a[_0x41b9('0x40')],_0x25dc5a[_0x41b9('0x41')]);_0x59b546[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x25dc5a[_0x41b9('0x40')],qs[_0x41b9('0x44')](_0x541656[_0x41b9('0x41')][_0x41b9('0x44')]));_0x59b546['attributes']=_0x59b546[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x59b546[_0x41b9('0x42')]:_0x25dc5a[_0x41b9('0x40')];_0x59b546[_0x41b9('0x47')]=qs[_0x41b9('0x48')](_0x541656[_0x41b9('0x41')][_0x41b9('0x48')]);_0x59b546[_0x41b9('0x4b')]=qs[_0x41b9('0x3f')](_['pick'](_0x541656[_0x41b9('0x41')],_0x25dc5a[_0x41b9('0x3f')]));if(_0x541656[_0x41b9('0x41')][_0x41b9('0x2f')]){_0x59b546[_0x41b9('0x4b')]=_[_0x41b9('0x4a')](_0x59b546[_0x41b9('0x4b')],{'$or':_['map'](_0x59b546[_0x41b9('0x42')],function(_0x442e59){var _0x1643c3={};_0x1643c3[_0x442e59]={'$like':'%'+_0x541656[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x1643c3;})});}_0x59b546=_['merge']({},_0x59b546,_0x541656[_0x41b9('0x4d')]);return _0x1ffb0d['getMembers'](_0x59b546);}})[_0x41b9('0x29')](function(_0x14bd97){if(_0x14bd97){_0x57f799=_0x14bd97[_0x41b9('0x5f')];if(!_0x541656['query'][_0x41b9('0x45')](_0x41b9('0x46'))){_0x59b546[_0x41b9('0x22')]=qs['limit'](_0x541656[_0x41b9('0x41')][_0x41b9('0x22')]);_0x59b546['offset']=qs[_0x41b9('0x20')](_0x541656['query'][_0x41b9('0x20')]);}return _0x1ffb0d[_0x41b9('0x9f')](_0x59b546);}})['then'](function(_0x7b4eaa){return _0x7b4eaa?{'count':_0x57f799,'rows':_0x7b4eaa}:null;})[_0x41b9('0x29')](respondWithResult(_0x3899ae,null))['catch'](handleError(_0x3899ae,null));};exports[_0x41b9('0xa0')]=function(_0x5d362f,_0x29748e,_0xa6ca29){var _0x2829c4={};var _0x44d126={};var _0x349b19;var _0x356c66;return db[_0x41b9('0x3b')][_0x41b9('0x65')]({'where':{'id':_0x5d362f[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x29748e,null))[_0x41b9('0x29')](function(_0x11064f){if(_0x11064f){_0x349b19=_0x11064f;_0x44d126[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db[_0x41b9('0xa1')]['rawAttributes']);_0x44d126['query']=_[_0x41b9('0x3e')](_0x5d362f[_0x41b9('0x41')]);_0x44d126[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x44d126['model'],_0x44d126[_0x41b9('0x41')]);_0x2829c4[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x44d126[_0x41b9('0x40')],qs['fields'](_0x5d362f['query']['fields']));_0x2829c4[_0x41b9('0x42')]=_0x2829c4[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x2829c4[_0x41b9('0x42')]:_0x44d126[_0x41b9('0x40')];_0x2829c4['order']=qs[_0x41b9('0x48')](_0x5d362f[_0x41b9('0x41')][_0x41b9('0x48')]);_0x2829c4['where']=qs['filters'](_[_0x41b9('0x49')](_0x5d362f[_0x41b9('0x41')],_0x44d126[_0x41b9('0x3f')]));if(_0x5d362f['query'][_0x41b9('0x2f')]){_0x2829c4['where']=_[_0x41b9('0x4a')](_0x2829c4[_0x41b9('0x4b')],{'$or':_[_0x41b9('0x31')](_0x2829c4['attributes'],function(_0x30e635){var _0x291bed={};_0x291bed[_0x30e635]={'$like':'%'+_0x5d362f[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x291bed;})});}_0x2829c4=_[_0x41b9('0x4a')]({},_0x2829c4,_0x5d362f['options']);return _0x349b19[_0x41b9('0xa0')](_0x2829c4);}})[_0x41b9('0x29')](function(_0x30c1ae){if(_0x30c1ae){_0x356c66=_0x30c1ae[_0x41b9('0x5f')];if(!_0x5d362f[_0x41b9('0x41')]['hasOwnProperty'](_0x41b9('0x46'))){_0x2829c4[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x5d362f[_0x41b9('0x41')][_0x41b9('0x22')]);_0x2829c4['offset']=qs[_0x41b9('0x20')](_0x5d362f[_0x41b9('0x41')][_0x41b9('0x20')]);}return _0x349b19[_0x41b9('0xa0')](_0x2829c4);}})[_0x41b9('0x29')](function(_0x2f3df4){if(_0x2f3df4){return _0x2f3df4?{'count':_0x356c66,'rows':_0x2f3df4}:null;}})[_0x41b9('0x29')](respondWithResult(_0x29748e,null))[_0x41b9('0x53')](handleError(_0x29748e,null));};exports[_0x41b9('0xa2')]=function(_0x250abe,_0x3e165d,_0x33934f){var _0x28281e=moment()[_0x41b9('0x82')]('YYYY-MM-DD\x20HH:mm:ss');var _0x266df7,_0xb145ca;return db[_0x41b9('0x3b')][_0x41b9('0x52')]({'where':{'id':_0x250abe['params']['id']}})['then'](handleEntityNotFound(_0x3e165d,null))[_0x41b9('0x29')](function(_0x2aec29){if(_0x2aec29){_0xb145ca=_0x2aec29;return _0x2aec29[_0x41b9('0xa2')](_0x250abe[_0x41b9('0x63')][_0x41b9('0x95')],_[_0x41b9('0x60')](_0x250abe[_0x41b9('0x63')],[_0x41b9('0x95'),'id'])||{});}return null;})[_0x41b9('0x9b')](function(_0x5de044){var _0x80bc6c;_0x266df7=_0x5de044||[];var _0x1fc1bd=[];if(_0x5de044){for(var _0x5c9a05=0x0;_0x5c9a05<_0x5de044['length'];_0x5c9a05+=0x1){var _0x3f04ce=_0x5de044[_0x5c9a05][_0x41b9('0x58')]({'plain':!![]});_0xb145ca['dialCheckDuplicateType']=_0x250abe[_0x41b9('0x63')][_0x41b9('0xa3')]?_0x250abe[_0x41b9('0x63')]['dialCheckDuplicateType']:_0xb145ca[_0x41b9('0xa3')];switch(_0xb145ca['dialCheckDuplicateType']){case _0x41b9('0xa4'):_0x80bc6c=squel['insert']()[_0x41b9('0xa5')](_0x41b9('0xa6'))[_0x41b9('0xa7')]([_0x41b9('0xa8'),_0x41b9('0xa9'),_0x41b9('0xaa'),'ListId','VoiceQueueId',_0x41b9('0x61'),_0x41b9('0x62')],squel[_0x41b9('0xab')]()[_0x41b9('0xac')]('phone',_0x41b9('0xa8'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27',_0x41b9('0xa9'))[_0x41b9('0xac')]('id','ContactId')[_0x41b9('0xac')](_0x3f04ce[_0x41b9('0xad')]['toString'](),_0x41b9('0xae'))[_0x41b9('0xac')](_0x250abe[_0x41b9('0x50')]['id'][_0x41b9('0x8e')](),_0x41b9('0x67'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27','createdAt')['field']('\x27'+_0x28281e+'\x27',_0x41b9('0x62'))[_0x41b9('0x87')]('cm_contacts')[_0x41b9('0x4b')]('deletedAt\x20IS\x20NULL')[_0x41b9('0x4b')](_0x41b9('0xaf'),_0x3f04ce['CmListId'][_0x41b9('0x8e')]())[_0x41b9('0x4b')](_0x41b9('0xb0'))[_0x41b9('0x4b')](_0x41b9('0xb1'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0x41b9('0x87')]('cm_hopper_final')[_0x41b9('0x4b')](_0x41b9('0x8a'),_0x250abe[_0x41b9('0x50')]['id'][_0x41b9('0x8e')]()))['where'](_0x41b9('0xb1'),squel[_0x41b9('0xab')]()[_0x41b9('0xac')]('COALESCE(phone,\x27\x27)')[_0x41b9('0x87')](_0x41b9('0xa6'))[_0x41b9('0x4b')](_0x41b9('0x8a'),_0x250abe[_0x41b9('0x50')]['id'][_0x41b9('0x8e')]())))[_0x41b9('0x8e')]();break;case _0x41b9('0xb2'):_0x80bc6c=squel[_0x41b9('0xb3')]()['into'](_0x41b9('0xa6'))[_0x41b9('0xa7')]([_0x41b9('0xa8'),_0x41b9('0xa9'),_0x41b9('0xaa'),_0x41b9('0xae'),'VoiceQueueId',_0x41b9('0x61'),_0x41b9('0x62')],squel[_0x41b9('0xab')]()[_0x41b9('0xac')]('phone',_0x41b9('0xa8'))['field']('\x27'+_0x28281e+'\x27',_0x41b9('0xa9'))[_0x41b9('0xac')]('id',_0x41b9('0xaa'))[_0x41b9('0xac')](_0x3f04ce[_0x41b9('0xad')][_0x41b9('0x8e')](),'ListId')[_0x41b9('0xac')](_0x250abe[_0x41b9('0x50')]['id'][_0x41b9('0x8e')](),_0x41b9('0x67'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27',_0x41b9('0x61'))['field']('\x27'+_0x28281e+'\x27','updatedAt')[_0x41b9('0x87')](_0x41b9('0xb4'))[_0x41b9('0x4b')](_0x41b9('0xb5'))[_0x41b9('0x4b')]('ListId\x20=\x20?',_0x3f04ce[_0x41b9('0xad')]['toString']())[_0x41b9('0x4b')](_0x41b9('0xb0'))[_0x41b9('0x4b')](_0x41b9('0xb1'),squel['select']()[_0x41b9('0xac')](_0x41b9('0xb6'))[_0x41b9('0x87')]('cm_hopper')[_0x41b9('0x4b')](_0x41b9('0x8a'),_0x250abe['params']['id']['toString']())))[_0x41b9('0x8e')]();break;default:_0x80bc6c=squel[_0x41b9('0xb3')]()['into'](_0x41b9('0xa6'))[_0x41b9('0xa7')]([_0x41b9('0xa8'),_0x41b9('0xa9'),_0x41b9('0xaa'),_0x41b9('0xae'),_0x41b9('0x67'),'createdAt',_0x41b9('0x62')],squel[_0x41b9('0xab')]()[_0x41b9('0xac')](_0x41b9('0xa8'),_0x41b9('0xa8'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27',_0x41b9('0xa9'))[_0x41b9('0xac')]('id','ContactId')['field'](_0x3f04ce[_0x41b9('0xad')][_0x41b9('0x8e')](),_0x41b9('0xae'))['field'](_0x250abe['params']['id'][_0x41b9('0x8e')](),_0x41b9('0x67'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27','createdAt')[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27','updatedAt')[_0x41b9('0x87')](_0x41b9('0xb4'))['where']('deletedAt\x20IS\x20NULL')[_0x41b9('0x4b')](_0x41b9('0xaf'),_0x3f04ce[_0x41b9('0xad')][_0x41b9('0x8e')]())['where'](_0x41b9('0xb0')))[_0x41b9('0x8e')]();}_0x1fc1bd[_0x41b9('0x8c')](db['sequelize']['query'](_0x80bc6c));}return BPromise['all'](_0x1fc1bd);}})['then'](function(){var _0x99684f=[];var _0xd0795a=squel[_0x41b9('0xb3')]()['into']('cm_hopper_additional_phones')[_0x41b9('0xa7')]([_0x41b9('0xb7'),_0x41b9('0xa8'),_0x41b9('0xb8'),'createdAt',_0x41b9('0x62')],squel[_0x41b9('0xab')]()[_0x41b9('0xac')](_0x41b9('0xb9'))[_0x41b9('0xac')]('ci.item')[_0x41b9('0xac')](_0x41b9('0xba'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27',_0x41b9('0x61'))[_0x41b9('0xac')]('\x27'+_0x28281e+'\x27',_0x41b9('0x62'))[_0x41b9('0x87')]('cm_contact_has_items','ci')[_0x41b9('0x88')]('cm_hopper','h',_0x41b9('0xbb'))['where']('h.scheduledat=?',_0x28281e)[_0x41b9('0x4b')]('ci.ItemClass=?','PHONE'))[_0x41b9('0x8e')]();_0x99684f['push'](db[_0x41b9('0x8d')][_0x41b9('0x41')](_0xd0795a));return BPromise[_0x41b9('0x92')](_0x99684f);})[_0x41b9('0x29')](function(){return _0x266df7;})[_0x41b9('0x29')](respondWithResult(_0x3e165d,null))[_0x41b9('0x53')](handleError(_0x3e165d,null));};exports['removeLists']=function(_0x7e6f37,_0x507096,_0x95157e){return db['VoiceQueue'][_0x41b9('0x52')]({'where':{'id':_0x7e6f37[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x507096,null))[_0x41b9('0x29')](function(_0xf25ea){if(_0xf25ea){return _0xf25ea['removeLists'](_0x7e6f37[_0x41b9('0x41')][_0x41b9('0x95')]);}})[_0x41b9('0x29')](function(_0x127993){if(_0x127993){return db[_0x41b9('0x66')][_0x41b9('0x2a')]({'where':{'ListId':_0x7e6f37[_0x41b9('0x41')]['ids'],'VoiceQueueId':_0x7e6f37['params']['id']}})[_0x41b9('0x29')](function(){return _0x127993;});}})[_0x41b9('0x29')](respondWithStatusCode(_0x507096,null))['catch'](handleError(_0x507096,null));};exports[_0x41b9('0xbc')]=function(_0x4fe4b1,_0x18f131,_0x2edad4){var _0x310186={};var _0x3722b7={};var _0x2a24df;var _0x1dde4b;return db['VoiceQueue'][_0x41b9('0x65')]({'where':{'id':_0x4fe4b1[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x18f131,null))[_0x41b9('0x29')](function(_0x586c94){if(_0x586c94){_0x2a24df=_0x586c94;_0x3722b7[_0x41b9('0x40')]=_[_0x41b9('0x3e')](db['CmList'][_0x41b9('0x51')]);_0x3722b7[_0x41b9('0x41')]=_[_0x41b9('0x3e')](_0x4fe4b1[_0x41b9('0x41')]);_0x3722b7[_0x41b9('0x3f')]=_[_0x41b9('0x43')](_0x3722b7[_0x41b9('0x40')],_0x3722b7[_0x41b9('0x41')]);_0x310186[_0x41b9('0x42')]=_[_0x41b9('0x43')](_0x3722b7['model'],qs[_0x41b9('0x44')](_0x4fe4b1[_0x41b9('0x41')][_0x41b9('0x44')]));_0x310186['attributes']=_0x310186[_0x41b9('0x42')][_0x41b9('0x5f')]?_0x310186['attributes']:_0x3722b7[_0x41b9('0x40')];_0x310186[_0x41b9('0x47')]=qs['sort'](_0x4fe4b1['query'][_0x41b9('0x48')]);_0x310186[_0x41b9('0x4b')]=qs[_0x41b9('0x3f')](_[_0x41b9('0x49')](_0x4fe4b1[_0x41b9('0x41')],_0x3722b7[_0x41b9('0x3f')]));if(_0x4fe4b1['query']['filter']){_0x310186['where']=_[_0x41b9('0x4a')](_0x310186[_0x41b9('0x4b')],{'$or':_[_0x41b9('0x31')](_0x310186[_0x41b9('0x42')],function(_0x24298c){var _0x4e9a3b={};_0x4e9a3b[_0x24298c]={'$like':'%'+_0x4fe4b1[_0x41b9('0x41')][_0x41b9('0x2f')]+'%'};return _0x4e9a3b;})});}_0x310186=_[_0x41b9('0x4a')]({},_0x310186,_0x4fe4b1[_0x41b9('0x4d')]);return _0x2a24df['getBlackLists'](_0x310186);}})[_0x41b9('0x29')](function(_0x2da450){if(_0x2da450){_0x1dde4b=_0x2da450[_0x41b9('0x5f')];if(!_0x4fe4b1[_0x41b9('0x41')][_0x41b9('0x45')](_0x41b9('0x46'))){_0x310186[_0x41b9('0x22')]=qs[_0x41b9('0x22')](_0x4fe4b1[_0x41b9('0x41')][_0x41b9('0x22')]);_0x310186[_0x41b9('0x20')]=qs[_0x41b9('0x20')](_0x4fe4b1[_0x41b9('0x41')][_0x41b9('0x20')]);}return _0x2a24df['getBlackLists'](_0x310186);}})[_0x41b9('0x29')](function(_0x37485a){if(_0x37485a){return _0x37485a?{'count':_0x1dde4b,'rows':_0x37485a}:null;}})[_0x41b9('0x29')](respondWithResult(_0x18f131,null))['catch'](handleError(_0x18f131,null));};exports[_0x41b9('0xbd')]=function(_0x3f71ea,_0x268d8b,_0x1fcd1f){var _0x104fe6,_0x378a8f;return db['VoiceQueue'][_0x41b9('0x52')]({'where':{'id':_0x3f71ea['params']['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x268d8b,null))[_0x41b9('0x29')](function(_0x57c802){if(_0x57c802){_0x378a8f=_0x57c802;return _0x57c802[_0x41b9('0xbd')](_0x3f71ea[_0x41b9('0x63')][_0x41b9('0x95')],_[_0x41b9('0x60')](_0x3f71ea[_0x41b9('0x63')],[_0x41b9('0x95'),'id'])||{});}return null;})[_0x41b9('0x9b')](function(_0x5e6d24){var _0x471650;_0x104fe6=_0x5e6d24||[];var _0x3dcb39=[];if(_0x5e6d24){for(var _0x48fd30=0x0;_0x48fd30<_0x5e6d24['length'];_0x48fd30+=0x1){var _0x4961c4=_0x5e6d24[_0x48fd30][_0x41b9('0x58')]({'plain':!![]});_0x471650=squel['insert']()[_0x41b9('0xa5')](_0x41b9('0xbe'))[_0x41b9('0xa7')]([_0x41b9('0xa8'),_0x41b9('0xaa'),_0x41b9('0xae'),_0x41b9('0x67'),_0x41b9('0x61'),_0x41b9('0x62')],squel[_0x41b9('0xab')]()[_0x41b9('0xac')](_0x41b9('0xa8'),_0x41b9('0xa8'))[_0x41b9('0xac')]('id',_0x41b9('0xaa'))[_0x41b9('0xac')](_0x4961c4[_0x41b9('0xad')][_0x41b9('0x8e')](),'ListId')[_0x41b9('0xac')](_0x3f71ea[_0x41b9('0x50')]['id'][_0x41b9('0x8e')](),_0x41b9('0x67'))['field']('NOW()',_0x41b9('0x61'))['field'](_0x41b9('0xbf'),_0x41b9('0x62'))['from'](_0x41b9('0xb4'))[_0x41b9('0x4b')](_0x41b9('0xb5'))[_0x41b9('0x4b')]('ListId\x20=\x20?',_0x4961c4['CmListId'][_0x41b9('0x8e')]())[_0x41b9('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x41b9('0x8e')]();_0x3dcb39[_0x41b9('0x8c')](db[_0x41b9('0x8d')][_0x41b9('0x41')](_0x471650));}return BPromise['all'](_0x3dcb39);}})[_0x41b9('0x29')](function(){return _0x104fe6;})[_0x41b9('0x29')](respondWithResult(_0x268d8b,null))[_0x41b9('0x53')](handleError(_0x268d8b,null));};exports[_0x41b9('0xc0')]=function(_0x2c864b,_0x178f41,_0x29c981){return db[_0x41b9('0x3b')][_0x41b9('0x52')]({'where':{'id':_0x2c864b[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](handleEntityNotFound(_0x178f41,null))[_0x41b9('0x29')](function(_0x3839c5){if(_0x3839c5){return _0x3839c5[_0x41b9('0xc0')](_0x2c864b[_0x41b9('0x41')][_0x41b9('0x95')]);}})[_0x41b9('0x29')](function(_0x25a9ec){if(_0x25a9ec){return db[_0x41b9('0x6f')]['destroy']({'where':{'ListId':_0x2c864b[_0x41b9('0x41')]['ids'],'VoiceQueueId':_0x2c864b[_0x41b9('0x50')]['id']}})[_0x41b9('0x29')](function(){return _0x25a9ec;});}})[_0x41b9('0x29')](respondWithStatusCode(_0x178f41,null))[_0x41b9('0x53')](handleError(_0x178f41,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c135b72..7fd71c1 100644 --- a/server/api/voiceQueue/voiceQueue.events.js +++ b/server/api/voiceQueue/voiceQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a88=['remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save','update'];(function(_0x4f0456,_0x5ea744){var _0x2b8699=function(_0x3a4cf5){while(--_0x3a4cf5){_0x4f0456['push'](_0x4f0456['shift']());}};_0x2b8699(++_0x5ea744);}(_0x8a88,0x87));var _0x88a8=function(_0x4497cd,_0x4a2208){_0x4497cd=_0x4497cd-0x0;var _0x3c6c43=_0x8a88[_0x4497cd];return _0x3c6c43;};'use strict';var EventEmitter=require(_0x88a8('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x88a8('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x88a8('0x2')](0x0);var events={'afterCreate':_0x88a8('0x3'),'afterUpdate':_0x88a8('0x4'),'afterDestroy':_0x88a8('0x5')};function emitEvent(_0x108469){return function(_0x518eec,_0x44f4ac,_0x14d74b){VoiceQueueEvents[_0x88a8('0x6')](_0x108469+':'+_0x518eec['id'],_0x518eec);VoiceQueueEvents[_0x88a8('0x6')](_0x108469,_0x518eec);_0x14d74b(null);};}for(var e in events){if(events[_0x88a8('0x7')](e)){var event=events[e];VoiceQueue[_0x88a8('0x8')](e,emitEvent(event));}}module[_0x88a8('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xedfa=['hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0xedfa,0x12f));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xaedf('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xaedf('0x1')](0x0);var events={'afterCreate':_0xaedf('0x2'),'afterUpdate':_0xaedf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x10a02c){return function(_0x246fa9,_0x2f0636,_0x3719ea){VoiceQueueEvents['emit'](_0x10a02c+':'+_0x246fa9['id'],_0x246fa9);VoiceQueueEvents[_0xaedf('0x4')](_0x10a02c,_0x246fa9);_0x3719ea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xaedf('0x5')](e,emitEvent(event));}}module[_0xaedf('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 857dde0..84b53b1 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x533663,_0x285a8b){var _0x1d1602=function(_0x217b82){while(--_0x217b82){_0x533663['push'](_0x533663['shift']());}};_0x1d1602(++_0x285a8b);}(_0x70e0,0x17b));var _0x070e=function(_0x4d6319,_0x3d9ca2){_0x4d6319=_0x4d6319-0x0;var _0x4a7d38=_0x70e0[_0x4d6319];return _0x4a7d38;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x008c,0x188));var _0xc008=function(_0x32d312,_0xf9cd19){_0x32d312=_0x32d312-0x0;var _0x11b740=_0x008c[_0x32d312];return _0x11b740;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 9604e54..7251fea 100644 --- a/server/api/voiceQueue/voiceQueue.rpc.js +++ b/server/api/voiceQueue/voiceQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5efa=['info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','where','attributes','limit','map','model','include','ShowVoiceQueue','find','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x245384,_0x4cafd9){var _0x2f541d=function(_0x5e3135){while(--_0x5e3135){_0x245384['push'](_0x245384['shift']());}};_0x2f541d(++_0x4cafd9);}(_0x5efa,0x119));var _0xa5ef=function(_0x110bf0,_0x3d8b80){_0x110bf0=_0x110bf0-0x0;var _0x5b4dd7=_0x5efa[_0x110bf0];return _0x5b4dd7;};'use strict';var _=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var moment=require(_0xa5ef('0x2'));var BPromise=require('bluebird');var rs=require(_0xa5ef('0x3'));var fs=require('fs');var Redis=require(_0xa5ef('0x4'));var db=require(_0xa5ef('0x5'))['db'];var utils=require(_0xa5ef('0x6'));var logger=require(_0xa5ef('0x7'))(_0xa5ef('0x8'));var config=require(_0xa5ef('0x9'));var jayson=require(_0xa5ef('0xa'));var client=jayson[_0xa5ef('0xb')][_0xa5ef('0xc')]({'port':0x232a});config[_0xa5ef('0xd')]=_[_0xa5ef('0xe')](config[_0xa5ef('0xd')],{'host':_0xa5ef('0xf'),'port':0x18eb});var socket=require(_0xa5ef('0x10'))(new Redis(config[_0xa5ef('0xd')]));require('./voiceQueue.socket')[_0xa5ef('0x11')](socket);function respondWithRpcPromise(_0xd4862f,_0x4abb8b,_0x2fcab4){return new BPromise(function(_0x5902af,_0x5ed2e5){return client[_0xa5ef('0x12')](_0xd4862f,_0x2fcab4)[_0xa5ef('0x13')](function(_0x2e627e){logger[_0xa5ef('0x14')](_0xa5ef('0x15'),_0x4abb8b,'request\x20sent');logger[_0xa5ef('0x16')](_0xa5ef('0x17'),_0x4abb8b,_0xa5ef('0x18'),JSON['stringify'](_0x2e627e));if(_0x2e627e[_0xa5ef('0x19')]){if(_0x2e627e[_0xa5ef('0x19')][_0xa5ef('0x1a')]===0x1f4){logger[_0xa5ef('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0x2e627e['error'][_0xa5ef('0x1b')]);return _0x5ed2e5(_0x2e627e['error']['message']);}logger[_0xa5ef('0x19')](_0xa5ef('0x15'),_0x4abb8b,_0x2e627e[_0xa5ef('0x19')]['message']);return _0x5902af(_0x2e627e['error'][_0xa5ef('0x1b')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0xa5ef('0x18'));_0x5902af(_0x2e627e[_0xa5ef('0x1c')][_0xa5ef('0x1b')]);}})[_0xa5ef('0x1d')](function(_0x36d2b9){logger[_0xa5ef('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4abb8b,_0x36d2b9);_0x5ed2e5(_0x36d2b9);});});}exports[_0xa5ef('0x1e')]=function(_0x22716d){var _0x3fbd23=this;return new Promise(function(_0x2a895c,_0x592f34){return db['VoiceQueue'][_0xa5ef('0x1f')]({'raw':_0x22716d[_0xa5ef('0x20')]?_0x22716d[_0xa5ef('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')][_0xa5ef('0x21')]||null:null,'attributes':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')][_0xa5ef('0x22')]||null:null,'limit':_0x22716d['options']?_0x22716d['options'][_0xa5ef('0x23')]||null:null,'include':_0x22716d['options']?_0x22716d[_0xa5ef('0x20')]['include']?_[_0xa5ef('0x24')](_0x22716d['options']['include'],function(_0x489dfe){return{'model':db[_0x489dfe[_0xa5ef('0x25')]],'as':_0x489dfe['as'],'attributes':_0x489dfe['attributes'],'include':_0x489dfe[_0xa5ef('0x26')]?_['map'](_0x489dfe[_0xa5ef('0x26')],function(_0x4a99fd){return{'model':db[_0x4a99fd['model']],'as':_0x4a99fd['as'],'attributes':_0x4a99fd['attributes'],'include':_0x4a99fd[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x4a99fd[_0xa5ef('0x26')],function(_0x18ae81){return{'model':db[_0x18ae81[_0xa5ef('0x25')]],'as':_0x18ae81['as'],'attributes':_0x18ae81[_0xa5ef('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b926b){logger['info'](_0xa5ef('0x1e'),_0x22716d);logger[_0xa5ef('0x16')](_0xa5ef('0x1e'),_0x22716d,JSON['stringify'](_0x2b926b));_0x2a895c(_0x2b926b);})[_0xa5ef('0x1d')](function(_0x36540f){logger[_0xa5ef('0x19')](_0xa5ef('0x1e'),_0x36540f[_0xa5ef('0x1b')],_0x22716d);_0x592f34(_0x3fbd23[_0xa5ef('0x19')](0x1f4,_0x36540f[_0xa5ef('0x1b')]));});});};exports[_0xa5ef('0x27')]=function(_0x12b118){var _0x52d83e=this;return new Promise(function(_0x521283,_0x28b2ff){return db['VoiceQueue'][_0xa5ef('0x28')]({'raw':_0x12b118['options']?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x29')]===undefined?!![]:![]:!![],'where':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x21')]||null:null,'attributes':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x22')]||null:null,'include':_0x12b118[_0xa5ef('0x20')]?_0x12b118[_0xa5ef('0x20')][_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x12b118['options']['include'],function(_0x2da1fa){return{'model':db[_0x2da1fa['model']],'as':_0x2da1fa['as'],'attributes':_0x2da1fa[_0xa5ef('0x22')],'include':_0x2da1fa[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x2da1fa[_0xa5ef('0x26')],function(_0x31cc0f){return{'model':db[_0x31cc0f[_0xa5ef('0x25')]],'as':_0x31cc0f['as'],'attributes':_0x31cc0f[_0xa5ef('0x22')],'include':_0x31cc0f[_0xa5ef('0x26')]?_[_0xa5ef('0x24')](_0x31cc0f[_0xa5ef('0x26')],function(_0x36bc19){return{'model':db[_0x36bc19[_0xa5ef('0x25')]],'as':_0x36bc19['as'],'attributes':_0x36bc19[_0xa5ef('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa5ef('0x13')](function(_0x2c159c){logger[_0xa5ef('0x14')](_0xa5ef('0x27'),_0x12b118);logger[_0xa5ef('0x16')](_0xa5ef('0x27'),_0x12b118,JSON[_0xa5ef('0x2a')](_0x2c159c));_0x521283(_0x2c159c);})[_0xa5ef('0x1d')](function(_0x240349){logger['error'](_0xa5ef('0x27'),_0x240349['message'],_0x12b118);_0x28b2ff(_0x52d83e[_0xa5ef('0x19')](0x1f4,_0x240349[_0xa5ef('0x1b')]));});});}; \ No newline at end of file +var _0x1dbe=['localhost','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','map','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dbe,0xd9));var _0xe1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1db('0x0'));var util=require(_0xe1db('0x1'));var moment=require(_0xe1db('0x2'));var BPromise=require(_0xe1db('0x3'));var rs=require(_0xe1db('0x4'));var fs=require('fs');var Redis=require(_0xe1db('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe1db('0x6'));var config=require(_0xe1db('0x7'));var jayson=require(_0xe1db('0x8'));var client=jayson[_0xe1db('0x9')][_0xe1db('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xe1db('0xb'),'port':0x18eb});var socket=require(_0xe1db('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0xe1db('0xd')](socket);function respondWithRpcPromise(_0x28cda5,_0x20bd65,_0x4777df){return new BPromise(function(_0x144927,_0xd78e97){return client[_0xe1db('0xe')](_0x28cda5,_0x4777df)[_0xe1db('0xf')](function(_0x33e3c4){logger[_0xe1db('0x10')](_0xe1db('0x11'),_0x20bd65,'request\x20sent');logger[_0xe1db('0x12')](_0xe1db('0x13'),_0x20bd65,_0xe1db('0x14'),JSON[_0xe1db('0x15')](_0x33e3c4));if(_0x33e3c4[_0xe1db('0x16')]){if(_0x33e3c4[_0xe1db('0x16')][_0xe1db('0x17')]===0x1f4){logger[_0xe1db('0x16')](_0xe1db('0x11'),_0x20bd65,_0x33e3c4[_0xe1db('0x16')][_0xe1db('0x18')]);return _0xd78e97(_0x33e3c4[_0xe1db('0x16')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x20bd65,_0x33e3c4['error'][_0xe1db('0x18')]);return _0x144927(_0x33e3c4[_0xe1db('0x16')]['message']);}else{logger[_0xe1db('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x20bd65,_0xe1db('0x14'));_0x144927(_0x33e3c4[_0xe1db('0x19')][_0xe1db('0x18')]);}})[_0xe1db('0x1a')](function(_0x1b99e7){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x20bd65,_0x1b99e7);_0xd78e97(_0x1b99e7);});});}exports[_0xe1db('0x1b')]=function(_0x51e4a6){var _0xca3e33=this;return new Promise(function(_0x31d550,_0x50cb19){return db[_0xe1db('0x1c')]['findAll']({'raw':_0x51e4a6[_0xe1db('0x1d')]?_0x51e4a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x51e4a6[_0xe1db('0x1d')]?_0x51e4a6[_0xe1db('0x1d')][_0xe1db('0x1e')]||null:null,'attributes':_0x51e4a6[_0xe1db('0x1d')]?_0x51e4a6['options'][_0xe1db('0x1f')]||null:null,'limit':_0x51e4a6[_0xe1db('0x1d')]?_0x51e4a6[_0xe1db('0x1d')][_0xe1db('0x20')]||null:null,'include':_0x51e4a6[_0xe1db('0x1d')]?_0x51e4a6[_0xe1db('0x1d')][_0xe1db('0x21')]?_['map'](_0x51e4a6[_0xe1db('0x1d')]['include'],function(_0x5c4fd7){return{'model':db[_0x5c4fd7[_0xe1db('0x22')]],'as':_0x5c4fd7['as'],'attributes':_0x5c4fd7['attributes'],'include':_0x5c4fd7[_0xe1db('0x21')]?_[_0xe1db('0x23')](_0x5c4fd7[_0xe1db('0x21')],function(_0x1193ed){return{'model':db[_0x1193ed[_0xe1db('0x22')]],'as':_0x1193ed['as'],'attributes':_0x1193ed[_0xe1db('0x1f')],'include':_0x1193ed[_0xe1db('0x21')]?_[_0xe1db('0x23')](_0x1193ed[_0xe1db('0x21')],function(_0x43b843){return{'model':db[_0x43b843[_0xe1db('0x22')]],'as':_0x43b843['as'],'attributes':_0x43b843[_0xe1db('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15bdce){logger[_0xe1db('0x10')](_0xe1db('0x1b'),_0x51e4a6);logger[_0xe1db('0x12')](_0xe1db('0x1b'),_0x51e4a6,JSON[_0xe1db('0x15')](_0x15bdce));_0x31d550(_0x15bdce);})['catch'](function(_0x212d9f){logger[_0xe1db('0x16')](_0xe1db('0x1b'),_0x212d9f[_0xe1db('0x18')],_0x51e4a6);_0x50cb19(_0xca3e33['error'](0x1f4,_0x212d9f['message']));});});};exports[_0xe1db('0x24')]=function(_0x3db2e3){var _0x4f62bd=this;return new Promise(function(_0x39a653,_0x4f08e6){return db[_0xe1db('0x1c')][_0xe1db('0x25')]({'raw':_0x3db2e3[_0xe1db('0x1d')]?_0x3db2e3[_0xe1db('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3db2e3[_0xe1db('0x1d')]?_0x3db2e3['options'][_0xe1db('0x1e')]||null:null,'attributes':_0x3db2e3[_0xe1db('0x1d')]?_0x3db2e3['options']['attributes']||null:null,'include':_0x3db2e3[_0xe1db('0x1d')]?_0x3db2e3['options'][_0xe1db('0x21')]?_['map'](_0x3db2e3[_0xe1db('0x1d')][_0xe1db('0x21')],function(_0x4220e5){return{'model':db[_0x4220e5[_0xe1db('0x22')]],'as':_0x4220e5['as'],'attributes':_0x4220e5[_0xe1db('0x1f')],'include':_0x4220e5[_0xe1db('0x21')]?_[_0xe1db('0x23')](_0x4220e5[_0xe1db('0x21')],function(_0x31540d){return{'model':db[_0x31540d[_0xe1db('0x22')]],'as':_0x31540d['as'],'attributes':_0x31540d[_0xe1db('0x1f')],'include':_0x31540d['include']?_[_0xe1db('0x23')](_0x31540d[_0xe1db('0x21')],function(_0x344409){return{'model':db[_0x344409[_0xe1db('0x22')]],'as':_0x344409['as'],'attributes':_0x344409[_0xe1db('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3752d0){logger['info'](_0xe1db('0x24'),_0x3db2e3);logger[_0xe1db('0x12')](_0xe1db('0x24'),_0x3db2e3,JSON[_0xe1db('0x15')](_0x3752d0));_0x39a653(_0x3752d0);})[_0xe1db('0x1a')](function(_0x6849a){logger[_0xe1db('0x16')](_0xe1db('0x24'),_0x6849a[_0xe1db('0x18')],_0x3db2e3);_0x4f08e6(_0x4f62bd[_0xe1db('0x16')](0x1f4,_0x6849a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 6d10fdb..fa5079f 100644 --- a/server/api/voiceQueue/voiceQueue.socket.js +++ b/server/api/voiceQueue/voiceQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5727=['./voiceQueue.events','remove','register','voiceQueue:'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x5727,0x1d0));var _0x7572=function(_0x48a97d,_0x5b3fbd){_0x48a97d=_0x48a97d-0x0;var _0x4296a8=_0x5727[_0x48a97d];return _0x4296a8;};'use strict';var VoiceQueueEvents=require(_0x7572('0x0'));var events=['save',_0x7572('0x1'),'update'];function createListener(_0x5ce06d,_0x26c8ce){return function(_0x5dd8b2){_0x26c8ce['emit'](_0x5ce06d,_0x5dd8b2);};}function removeListener(_0x3e50b5,_0x397db7){return function(){VoiceQueueEvents['removeListener'](_0x3e50b5,_0x397db7);};}exports[_0x7572('0x2')]=function(_0x24a45e){for(var _0x2de05b=0x0,_0x58e680=events['length'];_0x2de05b<_0x58e680;_0x2de05b++){var _0x21022d=events[_0x2de05b];var _0x326e23=createListener(_0x7572('0x3')+_0x21022d,_0x24a45e);VoiceQueueEvents['on'](_0x21022d,_0x326e23);}}; \ No newline at end of file +var _0x39e3=['./voiceQueue.events','save','update','emit','removeListener','register'];(function(_0x2ce259,_0x4bfb51){var _0x403c01=function(_0x3cbf69){while(--_0x3cbf69){_0x2ce259['push'](_0x2ce259['shift']());}};_0x403c01(++_0x4bfb51);}(_0x39e3,0xd8));var _0x339e=function(_0x89e147,_0x3fbb1c){_0x89e147=_0x89e147-0x0;var _0x30e37b=_0x39e3[_0x89e147];return _0x30e37b;};'use strict';var VoiceQueueEvents=require(_0x339e('0x0'));var events=[_0x339e('0x1'),'remove',_0x339e('0x2')];function createListener(_0x1c4087,_0x42fda9){return function(_0x8c95a0){_0x42fda9[_0x339e('0x3')](_0x1c4087,_0x8c95a0);};}function removeListener(_0x20fdad,_0x1a7287){return function(){VoiceQueueEvents[_0x339e('0x4')](_0x20fdad,_0x1a7287);};}exports[_0x339e('0x5')]=function(_0x5a3398){for(var _0x2e55c0=0x0,_0x2003fc=events['length'];_0x2e55c0<_0x2003fc;_0x2e55c0++){var _0x46569d=events[_0x2e55c0];var _0x3563a3=createListener('voiceQueue:'+_0x46569d,_0x5a3398);VoiceQueueEvents['on'](_0x46569d,_0x3563a3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 50ff0b6..cda1c82 100644 --- a/server/api/voiceQueueReport/index.js +++ b/server/api/voiceQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9513=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','update'];(function(_0x537028,_0x65e5ac){var _0x1d725b=function(_0x39b153){while(--_0x39b153){_0x537028['push'](_0x537028['shift']());}};_0x1d725b(++_0x65e5ac);}(_0x9513,0x1ba));var _0x3951=function(_0x58ecee,_0x507d7f){_0x58ecee=_0x58ecee-0x0;var _0x133866=_0x9513[_0x58ecee];return _0x133866;};'use strict';var multer=require('multer');var util=require(_0x3951('0x0'));var path=require(_0x3951('0x1'));var timeout=require(_0x3951('0x2'));var express=require(_0x3951('0x3'));var router=express['Router']();var fs_extra=require(_0x3951('0x4'));var auth=require(_0x3951('0x5'));var interaction=require(_0x3951('0x6'));var config=require('../../config/environment');var controller=require(_0x3951('0x7'));router[_0x3951('0x8')]('/',auth[_0x3951('0x9')](),controller[_0x3951('0xa')]);router[_0x3951('0x8')](_0x3951('0xb'),auth[_0x3951('0x9')](),controller[_0x3951('0xc')]);router['get'](_0x3951('0xd'),auth['isAuthenticated'](),controller[_0x3951('0xe')]);router[_0x3951('0x8')](_0x3951('0xf'),auth[_0x3951('0x9')](),controller[_0x3951('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3951('0x11')]);router[_0x3951('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3951('0x13')]);router['delete'](_0x3951('0xf'),auth[_0x3951('0x9')](),controller['destroy']);module[_0x3951('0x14')]=router; \ No newline at end of file +var _0xe6ea=['fs-extra','../../config/environment','get','isAuthenticated','/describe','/index','/:id','show','post','put','update','multer','path','connect-timeout','express','Router'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xe6ea,0x15b));var _0xae6e=function(_0x496ebf,_0x3c6a2e){_0x496ebf=_0x496ebf-0x0;var _0x3c2d8e=_0xe6ea[_0x496ebf];return _0x3c2d8e;};'use strict';var multer=require(_0xae6e('0x0'));var util=require('util');var path=require(_0xae6e('0x1'));var timeout=require(_0xae6e('0x2'));var express=require(_0xae6e('0x3'));var router=express[_0xae6e('0x4')]();var fs_extra=require(_0xae6e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae6e('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xae6e('0x7')]('/',auth[_0xae6e('0x8')](),controller['index']);router[_0xae6e('0x7')](_0xae6e('0x9'),auth[_0xae6e('0x8')](),controller['describe']);router[_0xae6e('0x7')](_0xae6e('0xa'),auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xae6e('0x7')](_0xae6e('0xb'),auth[_0xae6e('0x8')](),controller[_0xae6e('0xc')]);router[_0xae6e('0xd')]('/',auth[_0xae6e('0x8')](),controller['create']);router[_0xae6e('0xe')](_0xae6e('0xb'),auth[_0xae6e('0x8')](),controller[_0xae6e('0xf')]);router['delete'](_0xae6e('0xb'),auth[_0xae6e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index b78a9a8..421bb04 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b08=['DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x9b08,0x1ea));var _0x89b0=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x9b08[_0x1a7550];return _0x426e22;};'use strict';var Sequelize=require(_0x89b0('0x0'));var moment=require(_0x89b0('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x89b0('0x2')]},'calleridnum':{'type':Sequelize[_0x89b0('0x2')]},'calleridname':{'type':Sequelize[_0x89b0('0x2')]},'queue':{'type':Sequelize[_0x89b0('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x89b0('0x3')],'set':function(_0x195f4a){var _0x40385d=moment(_0x195f4a);var _0x560b5a=moment(this[_0x89b0('0x4')](_0x89b0('0x5')))[_0x89b0('0x6')](_0x89b0('0x7'));var _0x50ec21=_0x40385d[_0x89b0('0x8')](_0x560b5a,_0x89b0('0x9'));this[_0x89b0('0xa')](_0x89b0('0xb'),_0x195f4a);this[_0x89b0('0xa')](_0x89b0('0xc'),_0x50ec21||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x89b0('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerexit':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x89b0('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x89b0('0x2')],'comment':_0x89b0('0xf')},'originalposition':{'type':Sequelize[_0x89b0('0xd')]},'channel':{'type':Sequelize[_0x89b0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x89b0('0x2')]},'connectedlinename':{'type':Sequelize[_0x89b0('0x2')]},'accountcode':{'type':Sequelize[_0x89b0('0x2')]},'context':{'type':Sequelize[_0x89b0('0x2')]},'exten':{'type':Sequelize[_0x89b0('0x2')]},'priority':{'type':Sequelize[_0x89b0('0x2')]},'holdtime':{'type':Sequelize[_0x89b0('0xd')]},'mohtime':{'type':Sequelize[_0x89b0('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x89b0('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x89b0('0x2')],'comment':_0x89b0('0x10')},'transferexten':{'type':Sequelize[_0x89b0('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x89b0('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x89b0('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe256=['getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe256,0x19c));var _0x6e25=function(_0x317e68,_0x5350b6){_0x317e68=_0x317e68-0x0;var _0x11eaf2=_0xe256[_0x317e68];return _0x11eaf2;};'use strict';var Sequelize=require(_0x6e25('0x0'));var moment=require('moment');module[_0x6e25('0x1')]={'type':{'type':Sequelize[_0x6e25('0x2')]},'uniqueid':{'type':Sequelize[_0x6e25('0x2')]},'calleridnum':{'type':Sequelize[_0x6e25('0x2')]},'calleridname':{'type':Sequelize[_0x6e25('0x2')]},'queue':{'type':Sequelize[_0x6e25('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x6e25('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x6e25('0x3')],'set':function(_0x5db434){var _0x27a079=moment(_0x5db434);var _0x4723f2=moment(this[_0x6e25('0x4')](_0x6e25('0x5')))[_0x6e25('0x6')](_0x6e25('0x7'));var _0x3f7693=_0x27a079['diff'](_0x4723f2,_0x6e25('0x8'));this[_0x6e25('0x9')](_0x6e25('0xa'),_0x5db434);this[_0x6e25('0x9')](_0x6e25('0xb'),_0x3f7693||null);}},'position':{'type':Sequelize[_0x6e25('0xc')]},'count':{'type':Sequelize[_0x6e25('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x6e25('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6e25('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6e25('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6e25('0x3')]},'queuecallerexit':{'type':Sequelize[_0x6e25('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6e25('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x6e25('0x2')],'comment':_0x6e25('0xe')},'originalposition':{'type':Sequelize[_0x6e25('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6e25('0x2')]},'accountcode':{'type':Sequelize[_0x6e25('0x2')]},'context':{'type':Sequelize[_0x6e25('0x2')]},'exten':{'type':Sequelize[_0x6e25('0x2')]},'priority':{'type':Sequelize[_0x6e25('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6e25('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6e25('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6e25('0x2')],'comment':_0x6e25('0xf')},'transferexten':{'type':Sequelize[_0x6e25('0x2')]},'transferuniqueid':{'type':Sequelize[_0x6e25('0x2')]},'disposition':{'type':Sequelize[_0x6e25('0x2')]},'secondDisposition':{'type':Sequelize[_0x6e25('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6e25('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6e25('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b2b16ed..85ec488 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.controller.js +++ b/server/api/voiceQueueReport/voiceQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e45=['rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','describe','findAll','getVoiceQueuesReport','eml-format'];(function(_0x3a7496,_0x2b0dc1){var _0xdf3c20=function(_0x2b0cb0){while(--_0x2b0cb0){_0x3a7496['push'](_0x3a7496['shift']());}};_0xdf3c20(++_0x2b0dc1);}(_0x3e45,0x104));var _0x53e4=function(_0x2bfab4,_0xa044e4){_0x2bfab4=_0x2bfab4-0x0;var _0x26b2f3=_0x3e45[_0x2bfab4];return _0x26b2f3;};'use strict';var emlformat=require(_0x53e4('0x0'));var rimraf=require(_0x53e4('0x1'));var zipdir=require(_0x53e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53e4('0x3'));var moment=require(_0x53e4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53e4('0x5'));var path=require(_0x53e4('0x6'));var sox=require(_0x53e4('0x7'));var csv=require(_0x53e4('0x8'));var ejs=require(_0x53e4('0x9'));var fs=require('fs');var fs_extra=require(_0x53e4('0xa'));var _=require('lodash');var squel=require(_0x53e4('0xb'));var crypto=require(_0x53e4('0xc'));var jsforce=require(_0x53e4('0xd'));var deskjs=require(_0x53e4('0xe'));var toCsv=require(_0x53e4('0x8'));var querystring=require(_0x53e4('0xf'));var Papa=require(_0x53e4('0x10'));var Redis=require(_0x53e4('0x11'));var authService=require(_0x53e4('0x12'));var qs=require(_0x53e4('0x13'));var as=require(_0x53e4('0x14'));var hardwareService=require(_0x53e4('0x15'));var logger=require(_0x53e4('0x16'))(_0x53e4('0x17'));var utils=require(_0x53e4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x53e4('0x19'));var db=require(_0x53e4('0x1a'))['db'];config[_0x53e4('0x1b')]=_[_0x53e4('0x1c')](config[_0x53e4('0x1b')],{'host':_0x53e4('0x1d'),'port':0x18eb});var socket=require(_0x53e4('0x1e'))(new Redis(config[_0x53e4('0x1b')]));require(_0x53e4('0x1f'))[_0x53e4('0x20')](socket);function respondWithStatusCode(_0x398a45,_0x57536f){_0x57536f=_0x57536f||0xcc;return function(_0x1ce99a){if(_0x1ce99a){return _0x398a45[_0x53e4('0x21')](_0x57536f);}return _0x398a45[_0x53e4('0x22')](_0x57536f)[_0x53e4('0x23')]();};}function respondWithResult(_0x4bf823,_0x3820ff){_0x3820ff=_0x3820ff||0xc8;return function(_0x9a731a){if(_0x9a731a){return _0x4bf823[_0x53e4('0x22')](_0x3820ff)[_0x53e4('0x24')](_0x9a731a);}};}function respondWithFilteredResult(_0x4731b5,_0xd1d901){return function(_0x4ed146){if(_0x4ed146){var _0x3d5009=typeof _0xd1d901[_0x53e4('0x25')]===_0x53e4('0x26')&&typeof _0xd1d901[_0x53e4('0x27')]==='undefined';var _0x5dc1b1=_0x4ed146[_0x53e4('0x28')];var _0xf37fe2=_0x3d5009?0x0:_0xd1d901[_0x53e4('0x25')];var _0x553342=_0x3d5009?_0x4ed146[_0x53e4('0x28')]:_0xd1d901[_0x53e4('0x25')]+_0xd1d901[_0x53e4('0x27')];var _0x7bdf75;if(_0x553342>=_0x5dc1b1){_0x553342=_0x5dc1b1;_0x7bdf75=0xc8;}else{_0x7bdf75=0xce;}_0x4731b5[_0x53e4('0x22')](_0x7bdf75);return _0x4731b5['set'](_0x53e4('0x29'),_0xf37fe2+'-'+_0x553342+'/'+_0x5dc1b1)[_0x53e4('0x24')](_0x4ed146);}return null;};}function patchUpdates(_0x4aab1c){return function(_0x430d76){try{jsonpatch['apply'](_0x430d76,_0x4aab1c,!![]);}catch(_0x2db7fa){return BPromise[_0x53e4('0x2a')](_0x2db7fa);}return _0x430d76[_0x53e4('0x2b')]();};}function saveUpdates(_0x2b4706,_0x331d62){return function(_0x5e7470){if(_0x5e7470){return _0x5e7470[_0x53e4('0x2c')](_0x2b4706)['then'](function(_0x57baf4){return _0x57baf4;});}return null;};}function removeEntity(_0x2e8b0e,_0x212664){return function(_0x414d7c){if(_0x414d7c){return _0x414d7c[_0x53e4('0x2d')]()[_0x53e4('0x2e')](function(){_0x2e8b0e[_0x53e4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d6ef,_0x20eb05){return function(_0x16eea5){if(!_0x16eea5){_0x26d6ef[_0x53e4('0x21')](0x194);}return _0x16eea5;};}function handleError(_0x233ada,_0x526727){_0x526727=_0x526727||0x1f4;return function(_0x492e8c){logger['error'](_0x492e8c[_0x53e4('0x2f')]);if(_0x492e8c[_0x53e4('0x30')]){delete _0x492e8c[_0x53e4('0x30')];}_0x233ada[_0x53e4('0x22')](_0x526727)[_0x53e4('0x31')](_0x492e8c);};}exports[_0x53e4('0x32')]=function(_0x21e62e,_0x254979){var _0x3eebfb={},_0x4e71af={},_0x392003={'count':0x0,'rows':[]};var _0x473d0a=_['map'](db[_0x53e4('0x33')][_0x53e4('0x34')],function(_0x358c90){return{'name':_0x358c90[_0x53e4('0x35')],'type':_0x358c90[_0x53e4('0x36')][_0x53e4('0x37')]};});_0x4e71af[_0x53e4('0x38')]=_[_0x53e4('0x39')](_0x473d0a,_0x53e4('0x30'));_0x4e71af[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x21e62e[_0x53e4('0x3a')]);_0x4e71af[_0x53e4('0x3c')]=_[_0x53e4('0x3d')](_0x4e71af[_0x53e4('0x38')],_0x4e71af[_0x53e4('0x3a')]);_0x3eebfb[_0x53e4('0x3e')]=_[_0x53e4('0x3d')](_0x4e71af[_0x53e4('0x38')],qs['fields'](_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x3eebfb['attributes']=_0x3eebfb[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x3eebfb['attributes']:_0x4e71af[_0x53e4('0x38')];if(!_0x21e62e['query'][_0x53e4('0x41')](_0x53e4('0x42'))){_0x3eebfb[_0x53e4('0x27')]=qs[_0x53e4('0x27')](_0x21e62e['query']['limit']);_0x3eebfb['offset']=qs[_0x53e4('0x25')](_0x21e62e['query'][_0x53e4('0x25')]);}_0x3eebfb[_0x53e4('0x43')]=qs[_0x53e4('0x44')](_0x21e62e[_0x53e4('0x3a')]['sort']);_0x3eebfb[_0x53e4('0x45')]=qs[_0x53e4('0x3c')](_[_0x53e4('0x46')](_0x21e62e[_0x53e4('0x3a')],_0x4e71af[_0x53e4('0x3c')]),_0x473d0a);if(_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x47')]){_0x3eebfb[_0x53e4('0x45')]=_['merge'](_0x3eebfb[_0x53e4('0x45')],{'$or':_[_0x53e4('0x39')](_0x473d0a,function(_0x356753){if(_0x356753[_0x53e4('0x36')]!==_0x53e4('0x48')){var _0x46addd={};_0x46addd[_0x356753['name']]={'$like':'%'+_0x21e62e[_0x53e4('0x3a')][_0x53e4('0x47')]+'%'};return _0x46addd;}})});}_0x3eebfb=_[_0x53e4('0x49')]({},_0x3eebfb,_0x21e62e[_0x53e4('0x4a')]);var _0x473722={'where':_0x3eebfb[_0x53e4('0x45')]};return db[_0x53e4('0x33')]['count'](_0x473722)[_0x53e4('0x2e')](function(_0x292bac){_0x392003[_0x53e4('0x28')]=_0x292bac;if(_0x21e62e['query']['includeAll']){_0x3eebfb[_0x53e4('0x4b')]=[{'all':!![]}];}return db[_0x53e4('0x33')]['findAll'](_0x3eebfb);})[_0x53e4('0x2e')](function(_0x44c74e){_0x392003[_0x53e4('0x4c')]=_0x44c74e;return _0x392003;})[_0x53e4('0x2e')](respondWithFilteredResult(_0x254979,_0x3eebfb))[_0x53e4('0x4d')](handleError(_0x254979,null));};exports[_0x53e4('0x4e')]=function(_0x196133,_0x50496f){var _0x59c86a={'raw':![],'where':{'id':_0x196133[_0x53e4('0x4f')]['id']}},_0x1c9c86={};_0x1c9c86[_0x53e4('0x38')]=_['keys'](db[_0x53e4('0x33')]['rawAttributes']);_0x1c9c86[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x196133[_0x53e4('0x3a')]);_0x1c9c86[_0x53e4('0x3c')]=_[_0x53e4('0x3d')](_0x1c9c86[_0x53e4('0x38')],_0x1c9c86['query']);_0x59c86a['attributes']=_[_0x53e4('0x3d')](_0x1c9c86[_0x53e4('0x38')],qs['fields'](_0x196133[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x59c86a[_0x53e4('0x3e')]=_0x59c86a[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x59c86a[_0x53e4('0x3e')]:_0x1c9c86[_0x53e4('0x38')];if(_0x196133[_0x53e4('0x3a')][_0x53e4('0x50')]){_0x59c86a['include']=[{'all':!![]}];}_0x59c86a=_[_0x53e4('0x49')]({},_0x59c86a,_0x196133['options']);return db[_0x53e4('0x33')][_0x53e4('0x51')](_0x59c86a)[_0x53e4('0x2e')](handleEntityNotFound(_0x50496f,null))[_0x53e4('0x2e')](respondWithResult(_0x50496f,null))['catch'](handleError(_0x50496f,null));};exports[_0x53e4('0x52')]=function(_0x2230ee,_0xf193b1){return db[_0x53e4('0x33')][_0x53e4('0x52')](_0x2230ee[_0x53e4('0x53')],{})['then'](respondWithResult(_0xf193b1,0xc9))[_0x53e4('0x4d')](handleError(_0xf193b1,null));};exports[_0x53e4('0x2c')]=function(_0x5c4ec1,_0x2d7e92){if(_0x5c4ec1['body']['id']){delete _0x5c4ec1[_0x53e4('0x53')]['id'];}return db[_0x53e4('0x33')][_0x53e4('0x51')]({'where':{'id':_0x5c4ec1[_0x53e4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d7e92,null))[_0x53e4('0x2e')](saveUpdates(_0x5c4ec1[_0x53e4('0x53')],null))[_0x53e4('0x2e')](respondWithResult(_0x2d7e92,null))[_0x53e4('0x4d')](handleError(_0x2d7e92,null));};exports[_0x53e4('0x2d')]=function(_0x276c2d,_0x4b47a0){return db[_0x53e4('0x33')][_0x53e4('0x51')]({'where':{'id':_0x276c2d[_0x53e4('0x4f')]['id']}})[_0x53e4('0x2e')](handleEntityNotFound(_0x4b47a0,null))[_0x53e4('0x2e')](removeEntity(_0x4b47a0,null))[_0x53e4('0x4d')](handleError(_0x4b47a0,null));};exports[_0x53e4('0x54')]=function(_0x22e89e,_0x5a91fc){return db[_0x53e4('0x33')][_0x53e4('0x54')]()['then'](respondWithResult(_0x5a91fc,null))[_0x53e4('0x4d')](handleError(_0x5a91fc,null));};exports['getVoiceQueuesReport']=function(_0x5ce7e9,_0x4b8f7e){var _0x2952e6={},_0x13bd89={},_0x3fd2bf={'count':0x0,'rows':[]};_0x13bd89['model']=_[_0x53e4('0x3b')](db[_0x53e4('0x33')][_0x53e4('0x34')]);_0x13bd89[_0x53e4('0x3a')]=_[_0x53e4('0x3b')](_0x5ce7e9[_0x53e4('0x3a')]);_0x13bd89[_0x53e4('0x3c')]=_['intersection'](_0x13bd89[_0x53e4('0x38')],_0x13bd89[_0x53e4('0x3a')]);_0x2952e6[_0x53e4('0x3e')]=_[_0x53e4('0x3d')](_0x13bd89[_0x53e4('0x38')],qs[_0x53e4('0x3f')](_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x3f')]));_0x2952e6[_0x53e4('0x3e')]=_0x2952e6[_0x53e4('0x3e')][_0x53e4('0x40')]?_0x2952e6[_0x53e4('0x3e')]:_0x13bd89[_0x53e4('0x38')];if(!_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x41')]('nolimit')){_0x2952e6[_0x53e4('0x27')]=qs[_0x53e4('0x27')](_0x5ce7e9[_0x53e4('0x3a')]['limit']);_0x2952e6[_0x53e4('0x25')]=qs[_0x53e4('0x25')](_0x5ce7e9[_0x53e4('0x3a')]['offset']);}_0x2952e6[_0x53e4('0x43')]=qs[_0x53e4('0x44')](_0x5ce7e9['query'][_0x53e4('0x44')]);_0x2952e6['where']=qs[_0x53e4('0x3c')](_[_0x53e4('0x46')](_0x5ce7e9['query'],_0x13bd89[_0x53e4('0x3c')]));if(_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x47')]){_0x2952e6[_0x53e4('0x45')]=_[_0x53e4('0x49')](_0x2952e6['where'],{'$or':_[_0x53e4('0x39')](_0x2952e6[_0x53e4('0x3e')],function(_0x1148b8){var _0x198acd={};_0x198acd[_0x1148b8]={'$like':'%'+_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x47')]+'%'};return _0x198acd;})});}_0x2952e6=_[_0x53e4('0x49')]({},_0x2952e6,_0x5ce7e9[_0x53e4('0x4a')]);var _0x15940c={'where':_0x2952e6['where']};return db['VoiceQueueReport']['count'](_0x15940c)[_0x53e4('0x2e')](function(_0x24432a){_0x3fd2bf[_0x53e4('0x28')]=_0x24432a;if(_0x5ce7e9[_0x53e4('0x3a')][_0x53e4('0x50')]){_0x2952e6[_0x53e4('0x4b')]=[{'all':!![]}];}return db[_0x53e4('0x33')][_0x53e4('0x55')](_0x2952e6);})[_0x53e4('0x2e')](function(_0xb70e7e){_0x3fd2bf[_0x53e4('0x4c')]=_0xb70e7e;return _0x3fd2bf;})['then'](respondWithFilteredResult(_0x4b8f7e,_0x2952e6,_0x53e4('0x56')))[_0x53e4('0x4d')](handleError(_0x4b8f7e,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x3114=['api','../../config/utils','../../config/environment','../../config/license/util','redis','./voiceQueueReport.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','type','options','includeAll','findAll','rows','catch','show','params','keys','include','merge','find','create','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3114,0x16a));var _0x4311=function(_0x4994e8,_0x24c030){_0x4994e8=_0x4994e8-0x0;var _0x4d10b9=_0x3114[_0x4994e8];return _0x4d10b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4311('0x0'));var zipdir=require(_0x4311('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4311('0x2'));var BPromise=require(_0x4311('0x3'));var Mustache=require(_0x4311('0x4'));var util=require('util');var path=require(_0x4311('0x5'));var sox=require(_0x4311('0x6'));var csv=require(_0x4311('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4311('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4311('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4311('0xa'));var toCsv=require(_0x4311('0x7'));var querystring=require(_0x4311('0xb'));var Papa=require(_0x4311('0xc'));var Redis=require(_0x4311('0xd'));var authService=require(_0x4311('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4311('0xf'));var hardwareService=require(_0x4311('0x10'));var logger=require(_0x4311('0x11'))(_0x4311('0x12'));var utils=require(_0x4311('0x13'));var config=require(_0x4311('0x14'));var licenseUtil=require(_0x4311('0x15'));var db=require('../../mysqldb')['db'];config[_0x4311('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4311('0x16')]));require(_0x4311('0x17'))[_0x4311('0x18')](socket);function respondWithStatusCode(_0x447121,_0x3de3ed){_0x3de3ed=_0x3de3ed||0xcc;return function(_0x4acacf){if(_0x4acacf){return _0x447121[_0x4311('0x19')](_0x3de3ed);}return _0x447121['status'](_0x3de3ed)['end']();};}function respondWithResult(_0x3d705e,_0x2d1654){_0x2d1654=_0x2d1654||0xc8;return function(_0x50d881){if(_0x50d881){return _0x3d705e[_0x4311('0x1a')](_0x2d1654)[_0x4311('0x1b')](_0x50d881);}};}function respondWithFilteredResult(_0x2b9a38,_0xdbdf12){return function(_0x19de1e){if(_0x19de1e){var _0x448c99=typeof _0xdbdf12['offset']===_0x4311('0x1c')&&typeof _0xdbdf12[_0x4311('0x1d')]===_0x4311('0x1c');var _0x385658=_0x19de1e[_0x4311('0x1e')];var _0x2ac3c9=_0x448c99?0x0:_0xdbdf12['offset'];var _0x5100e6=_0x448c99?_0x19de1e[_0x4311('0x1e')]:_0xdbdf12[_0x4311('0x1f')]+_0xdbdf12['limit'];var _0x10abf0;if(_0x5100e6>=_0x385658){_0x5100e6=_0x385658;_0x10abf0=0xc8;}else{_0x10abf0=0xce;}_0x2b9a38[_0x4311('0x1a')](_0x10abf0);return _0x2b9a38[_0x4311('0x20')](_0x4311('0x21'),_0x2ac3c9+'-'+_0x5100e6+'/'+_0x385658)[_0x4311('0x1b')](_0x19de1e);}return null;};}function patchUpdates(_0x217fdd){return function(_0x3c98ca){try{jsonpatch['apply'](_0x3c98ca,_0x217fdd,!![]);}catch(_0x239be9){return BPromise['reject'](_0x239be9);}return _0x3c98ca[_0x4311('0x22')]();};}function saveUpdates(_0x115b67,_0x383c80){return function(_0x2232c7){if(_0x2232c7){return _0x2232c7[_0x4311('0x23')](_0x115b67)[_0x4311('0x24')](function(_0x54b29d){return _0x54b29d;});}return null;};}function removeEntity(_0x4afef0,_0x5e45c4){return function(_0x5234c1){if(_0x5234c1){return _0x5234c1['destroy']()[_0x4311('0x24')](function(){_0x4afef0[_0x4311('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af2c5,_0x19613a){return function(_0x4bef31){if(!_0x4bef31){_0x5af2c5[_0x4311('0x19')](0x194);}return _0x4bef31;};}function handleError(_0x4b32b4,_0x8f60c3){_0x8f60c3=_0x8f60c3||0x1f4;return function(_0x151f39){logger[_0x4311('0x25')](_0x151f39['stack']);if(_0x151f39[_0x4311('0x26')]){delete _0x151f39[_0x4311('0x26')];}_0x4b32b4[_0x4311('0x1a')](_0x8f60c3)[_0x4311('0x27')](_0x151f39);};}exports[_0x4311('0x28')]=function(_0x573782,_0x28abf){var _0x4504bf={},_0x277efb={},_0x37ead9={'count':0x0,'rows':[]};var _0x572dcf=_[_0x4311('0x29')](db[_0x4311('0x2a')][_0x4311('0x2b')],function(_0x37ddbd){return{'name':_0x37ddbd[_0x4311('0x2c')],'type':_0x37ddbd['type'][_0x4311('0x2d')]};});_0x277efb[_0x4311('0x2e')]=_[_0x4311('0x29')](_0x572dcf,'name');_0x277efb['query']=_['keys'](_0x573782[_0x4311('0x2f')]);_0x277efb[_0x4311('0x30')]=_['intersection'](_0x277efb[_0x4311('0x2e')],_0x277efb[_0x4311('0x2f')]);_0x4504bf['attributes']=_[_0x4311('0x31')](_0x277efb[_0x4311('0x2e')],qs[_0x4311('0x32')](_0x573782[_0x4311('0x2f')][_0x4311('0x32')]));_0x4504bf[_0x4311('0x33')]=_0x4504bf[_0x4311('0x33')][_0x4311('0x34')]?_0x4504bf['attributes']:_0x277efb[_0x4311('0x2e')];if(!_0x573782[_0x4311('0x2f')]['hasOwnProperty'](_0x4311('0x35'))){_0x4504bf['limit']=qs[_0x4311('0x1d')](_0x573782['query'][_0x4311('0x1d')]);_0x4504bf[_0x4311('0x1f')]=qs[_0x4311('0x1f')](_0x573782[_0x4311('0x2f')][_0x4311('0x1f')]);}_0x4504bf['order']=qs[_0x4311('0x36')](_0x573782[_0x4311('0x2f')][_0x4311('0x36')]);_0x4504bf[_0x4311('0x37')]=qs[_0x4311('0x30')](_[_0x4311('0x38')](_0x573782[_0x4311('0x2f')],_0x277efb[_0x4311('0x30')]),_0x572dcf);if(_0x573782[_0x4311('0x2f')][_0x4311('0x39')]){_0x4504bf[_0x4311('0x37')]=_['merge'](_0x4504bf[_0x4311('0x37')],{'$or':_[_0x4311('0x29')](_0x572dcf,function(_0x376d17){if(_0x376d17[_0x4311('0x3a')]!=='VIRTUAL'){var _0x34e098={};_0x34e098[_0x376d17[_0x4311('0x26')]]={'$like':'%'+_0x573782[_0x4311('0x2f')][_0x4311('0x39')]+'%'};return _0x34e098;}})});}_0x4504bf=_['merge']({},_0x4504bf,_0x573782[_0x4311('0x3b')]);var _0x440ae7={'where':_0x4504bf['where']};return db[_0x4311('0x2a')]['count'](_0x440ae7)[_0x4311('0x24')](function(_0x51e8b0){_0x37ead9['count']=_0x51e8b0;if(_0x573782[_0x4311('0x2f')][_0x4311('0x3c')]){_0x4504bf['include']=[{'all':!![]}];}return db[_0x4311('0x2a')][_0x4311('0x3d')](_0x4504bf);})[_0x4311('0x24')](function(_0x161095){_0x37ead9[_0x4311('0x3e')]=_0x161095;return _0x37ead9;})[_0x4311('0x24')](respondWithFilteredResult(_0x28abf,_0x4504bf))[_0x4311('0x3f')](handleError(_0x28abf,null));};exports[_0x4311('0x40')]=function(_0x24be1f,_0x27140b){var _0x18f5df={'raw':![],'where':{'id':_0x24be1f[_0x4311('0x41')]['id']}},_0x1a2637={};_0x1a2637[_0x4311('0x2e')]=_[_0x4311('0x42')](db[_0x4311('0x2a')]['rawAttributes']);_0x1a2637[_0x4311('0x2f')]=_[_0x4311('0x42')](_0x24be1f[_0x4311('0x2f')]);_0x1a2637[_0x4311('0x30')]=_[_0x4311('0x31')](_0x1a2637[_0x4311('0x2e')],_0x1a2637[_0x4311('0x2f')]);_0x18f5df[_0x4311('0x33')]=_['intersection'](_0x1a2637[_0x4311('0x2e')],qs[_0x4311('0x32')](_0x24be1f[_0x4311('0x2f')][_0x4311('0x32')]));_0x18f5df['attributes']=_0x18f5df[_0x4311('0x33')][_0x4311('0x34')]?_0x18f5df['attributes']:_0x1a2637[_0x4311('0x2e')];if(_0x24be1f[_0x4311('0x2f')][_0x4311('0x3c')]){_0x18f5df[_0x4311('0x43')]=[{'all':!![]}];}_0x18f5df=_[_0x4311('0x44')]({},_0x18f5df,_0x24be1f[_0x4311('0x3b')]);return db[_0x4311('0x2a')][_0x4311('0x45')](_0x18f5df)[_0x4311('0x24')](handleEntityNotFound(_0x27140b,null))[_0x4311('0x24')](respondWithResult(_0x27140b,null))['catch'](handleError(_0x27140b,null));};exports['create']=function(_0x4de4ba,_0x360e69){return db[_0x4311('0x2a')][_0x4311('0x46')](_0x4de4ba[_0x4311('0x47')],{})[_0x4311('0x24')](respondWithResult(_0x360e69,0xc9))['catch'](handleError(_0x360e69,null));};exports['update']=function(_0x372d30,_0x4587dc){if(_0x372d30[_0x4311('0x47')]['id']){delete _0x372d30[_0x4311('0x47')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x372d30[_0x4311('0x41')]['id']}})[_0x4311('0x24')](handleEntityNotFound(_0x4587dc,null))[_0x4311('0x24')](saveUpdates(_0x372d30['body'],null))[_0x4311('0x24')](respondWithResult(_0x4587dc,null))[_0x4311('0x3f')](handleError(_0x4587dc,null));};exports[_0x4311('0x48')]=function(_0x542b32,_0x4c1322){return db['VoiceQueueReport'][_0x4311('0x45')]({'where':{'id':_0x542b32[_0x4311('0x41')]['id']}})[_0x4311('0x24')](handleEntityNotFound(_0x4c1322,null))[_0x4311('0x24')](removeEntity(_0x4c1322,null))['catch'](handleError(_0x4c1322,null));};exports[_0x4311('0x49')]=function(_0x1410eb,_0x814feb){return db['VoiceQueueReport']['describe']()[_0x4311('0x24')](respondWithResult(_0x814feb,null))[_0x4311('0x3f')](handleError(_0x814feb,null));};exports[_0x4311('0x4a')]=function(_0x54c744,_0x841bae){var _0x35390f={},_0x5a93e1={},_0x3c281c={'count':0x0,'rows':[]};_0x5a93e1[_0x4311('0x2e')]=_[_0x4311('0x42')](db[_0x4311('0x2a')]['rawAttributes']);_0x5a93e1[_0x4311('0x2f')]=_[_0x4311('0x42')](_0x54c744[_0x4311('0x2f')]);_0x5a93e1[_0x4311('0x30')]=_['intersection'](_0x5a93e1[_0x4311('0x2e')],_0x5a93e1['query']);_0x35390f[_0x4311('0x33')]=_[_0x4311('0x31')](_0x5a93e1[_0x4311('0x2e')],qs[_0x4311('0x32')](_0x54c744[_0x4311('0x2f')][_0x4311('0x32')]));_0x35390f[_0x4311('0x33')]=_0x35390f[_0x4311('0x33')][_0x4311('0x34')]?_0x35390f[_0x4311('0x33')]:_0x5a93e1['model'];if(!_0x54c744[_0x4311('0x2f')][_0x4311('0x4b')](_0x4311('0x35'))){_0x35390f[_0x4311('0x1d')]=qs[_0x4311('0x1d')](_0x54c744['query'][_0x4311('0x1d')]);_0x35390f['offset']=qs['offset'](_0x54c744['query'][_0x4311('0x1f')]);}_0x35390f['order']=qs['sort'](_0x54c744[_0x4311('0x2f')][_0x4311('0x36')]);_0x35390f['where']=qs[_0x4311('0x30')](_[_0x4311('0x38')](_0x54c744[_0x4311('0x2f')],_0x5a93e1[_0x4311('0x30')]));if(_0x54c744['query']['filter']){_0x35390f[_0x4311('0x37')]=_[_0x4311('0x44')](_0x35390f['where'],{'$or':_['map'](_0x35390f[_0x4311('0x33')],function(_0x451900){var _0x7609be={};_0x7609be[_0x451900]={'$like':'%'+_0x54c744['query'][_0x4311('0x39')]+'%'};return _0x7609be;})});}_0x35390f=_[_0x4311('0x44')]({},_0x35390f,_0x54c744[_0x4311('0x3b')]);var _0x2250d7={'where':_0x35390f[_0x4311('0x37')]};return db[_0x4311('0x2a')]['count'](_0x2250d7)[_0x4311('0x24')](function(_0x4d72eb){_0x3c281c[_0x4311('0x1e')]=_0x4d72eb;if(_0x54c744[_0x4311('0x2f')][_0x4311('0x3c')]){_0x35390f[_0x4311('0x43')]=[{'all':!![]}];}return db[_0x4311('0x2a')][_0x4311('0x3d')](_0x35390f);})[_0x4311('0x24')](function(_0x417e8a){_0x3c281c[_0x4311('0x3e')]=_0x417e8a;return _0x3c281c;})[_0x4311('0x24')](respondWithFilteredResult(_0x841bae,_0x35390f,_0x4311('0x4a')))[_0x4311('0x3f')](handleError(_0x841bae,null,_0x4311('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 9f82c93..f341b9d 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.events.js +++ b/server/api/voiceQueueReport/voiceQueueReport.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4958=['update','emit','hasOwnProperty','events','../../mysqldb','VoiceQueueReport','save'];(function(_0xb267b0,_0x42b85c){var _0x31338f=function(_0x245c05){while(--_0x245c05){_0xb267b0['push'](_0xb267b0['shift']());}};_0x31338f(++_0x42b85c);}(_0x4958,0x1f4));var _0x8495=function(_0x3219a5,_0x2f68bc){_0x3219a5=_0x3219a5-0x0;var _0x24f1f9=_0x4958[_0x3219a5];return _0x24f1f9;};'use strict';var EventEmitter=require(_0x8495('0x0'));var VoiceQueueReport=require(_0x8495('0x1'))['db'][_0x8495('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8495('0x3'),'afterUpdate':_0x8495('0x4'),'afterDestroy':'remove'};function emitEvent(_0x505a1f){return function(_0x4eb815,_0x5cee61,_0x72fe22){VoiceQueueReportEvents[_0x8495('0x5')](_0x505a1f+':'+_0x4eb815['id'],_0x4eb815);VoiceQueueReportEvents[_0x8495('0x5')](_0x505a1f,_0x4eb815);_0x72fe22(null);};}for(var e in events){if(events[_0x8495('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x7ab1=['exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x5d2e52,_0x1d95b1){var _0x3a5d13=function(_0x74173c){while(--_0x74173c){_0x5d2e52['push'](_0x5d2e52['shift']());}};_0x3a5d13(++_0x1d95b1);}(_0x7ab1,0x1e7));var _0x17ab=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7ab1[_0x164eca];return _0x2ce562;};'use strict';var EventEmitter=require(_0x17ab('0x0'));var VoiceQueueReport=require(_0x17ab('0x1'))['db'][_0x17ab('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x17ab('0x3')](0x0);var events={'afterCreate':_0x17ab('0x4'),'afterUpdate':_0x17ab('0x5'),'afterDestroy':_0x17ab('0x6')};function emitEvent(_0xfbd708){return function(_0x12c55b,_0x504411,_0x1cdf61){VoiceQueueReportEvents['emit'](_0xfbd708+':'+_0x12c55b['id'],_0x12c55b);VoiceQueueReportEvents[_0x17ab('0x7')](_0xfbd708,_0x12c55b);_0x1cdf61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x17ab('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 4eecf84..c7ce7a7 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0677=['api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0677,0xed));var _0x7067=function(_0x263a16,_0x489c01){_0x263a16=_0x263a16-0x0;var _0x251824=_0x0677[_0x263a16];return _0x251824;};'use strict';var _=require(_0x7067('0x0'));var util=require(_0x7067('0x1'));var logger=require(_0x7067('0x2'))(_0x7067('0x3'));var moment=require(_0x7067('0x4'));var BPromise=require(_0x7067('0x5'));var rp=require(_0x7067('0x6'));var fs=require('fs');var path=require(_0x7067('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7067('0x8'));module[_0x7067('0x9')]=function(_0x5977d2,_0x5e47c5){return _0x5977d2[_0x7067('0xa')](_0x7067('0xb'),attributes,{'tableName':_0x7067('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7067('0xd')]},{'fields':[_0x7067('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x211b=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','lodash','util','../../config/logger','api','moment'];(function(_0x32e3de,_0x28629d){var _0x57ff50=function(_0x46bc9d){while(--_0x46bc9d){_0x32e3de['push'](_0x32e3de['shift']());}};_0x57ff50(++_0x28629d);}(_0x211b,0x109));var _0xb211=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x211b[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xb211('0x0'));var util=require(_0xb211('0x1'));var logger=require(_0xb211('0x2'))(_0xb211('0x3'));var moment=require(_0xb211('0x4'));var BPromise=require(_0xb211('0x5'));var rp=require(_0xb211('0x6'));var fs=require('fs');var path=require(_0xb211('0x7'));var rimraf=require(_0xb211('0x8'));var config=require(_0xb211('0x9'));var attributes=require(_0xb211('0xa'));module[_0xb211('0xb')]=function(_0x1de903,_0x86e993){return _0x1de903[_0xb211('0xc')](_0xb211('0xd'),attributes,{'tableName':_0xb211('0xe'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 652d1bd..c04a376 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.rpc.js +++ b/server/api/voiceQueueReport/voiceQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x625f=['register','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x2cb0e8,_0x5a59bf){var _0x39aa03=function(_0x3e6751){while(--_0x3e6751){_0x2cb0e8['push'](_0x2cb0e8['shift']());}};_0x39aa03(++_0x5a59bf);}(_0x625f,0x1cb));var _0xf625=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x625f[_0x43f881];return _0x365c14;};'use strict';var _=require(_0xf625('0x0'));var util=require('util');var moment=require(_0xf625('0x1'));var BPromise=require(_0xf625('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf625('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf625('0x4'));var logger=require('../../config/logger')(_0xf625('0x5'));var config=require(_0xf625('0x6'));var jayson=require(_0xf625('0x7'));var client=jayson[_0xf625('0x8')][_0xf625('0x9')]({'port':0x232a});config[_0xf625('0xa')]=_['defaults'](config[_0xf625('0xa')],{'host':_0xf625('0xb'),'port':0x18eb});var socket=require(_0xf625('0xc'))(new Redis(config[_0xf625('0xa')]));require(_0xf625('0xd'))[_0xf625('0xe')](socket);function respondWithRpcPromise(_0x53dbfd,_0x2d958c,_0x4e80cb){return new BPromise(function(_0x5567ff,_0x5d8a60){return client['request'](_0x53dbfd,_0x4e80cb)[_0xf625('0xf')](function(_0x242007){logger['info'](_0xf625('0x10'),_0x2d958c,_0xf625('0x11'));logger[_0xf625('0x12')](_0xf625('0x13'),_0x2d958c,_0xf625('0x11'),JSON[_0xf625('0x14')](_0x242007));if(_0x242007[_0xf625('0x15')]){if(_0x242007[_0xf625('0x15')][_0xf625('0x16')]===0x1f4){logger[_0xf625('0x15')](_0xf625('0x10'),_0x2d958c,_0x242007[_0xf625('0x15')][_0xf625('0x17')]);return _0x5d8a60(_0x242007[_0xf625('0x15')][_0xf625('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2d958c,_0x242007[_0xf625('0x15')][_0xf625('0x17')]);return _0x5567ff(_0x242007['error'][_0xf625('0x17')]);}else{logger[_0xf625('0x18')](_0xf625('0x10'),_0x2d958c,_0xf625('0x11'));_0x5567ff(_0x242007[_0xf625('0x19')]['message']);}})['catch'](function(_0x44ce5d){logger[_0xf625('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2d958c,_0x44ce5d);_0x5d8a60(_0x44ce5d);});});}exports[_0xf625('0x1a')]=function(_0x35fbdf){var _0x17865c=this;return new Promise(function(_0x31b043,_0x20cf91){return db[_0xf625('0x1b')][_0xf625('0x1c')]({'raw':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![],'where':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x1f')]||null:null,'attributes':_0x35fbdf['options']?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x20')]||null:null,'limit':_0x35fbdf[_0xf625('0x1d')]?_0x35fbdf[_0xf625('0x1d')][_0xf625('0x21')]||null:null,'include':_0x35fbdf['options']?_0x35fbdf['options'][_0xf625('0x22')]?_[_0xf625('0x23')](_0x35fbdf['options'][_0xf625('0x22')],function(_0x646fae){return{'model':db[_0x646fae['model']],'as':_0x646fae['as'],'attributes':_0x646fae[_0xf625('0x20')],'include':_0x646fae[_0xf625('0x22')]?_[_0xf625('0x23')](_0x646fae['include'],function(_0x44841e){return{'model':db[_0x44841e[_0xf625('0x24')]],'as':_0x44841e['as'],'attributes':_0x44841e['attributes'],'include':_0x44841e[_0xf625('0x22')]?_[_0xf625('0x23')](_0x44841e[_0xf625('0x22')],function(_0x1bbcf4){return{'model':db[_0x1bbcf4[_0xf625('0x24')]],'as':_0x1bbcf4['as'],'attributes':_0x1bbcf4[_0xf625('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf625('0xf')](function(_0x458711){logger[_0xf625('0x18')](_0xf625('0x1a'),_0x35fbdf);logger[_0xf625('0x12')]('GetVoiceQueueReport',_0x35fbdf,JSON[_0xf625('0x14')](_0x458711));_0x31b043(_0x458711);})[_0xf625('0x25')](function(_0x13e5e7){logger[_0xf625('0x15')]('GetVoiceQueueReport',_0x13e5e7[_0xf625('0x17')],_0x35fbdf);_0x20cf91(_0x17865c[_0xf625('0x15')](0x1f4,_0x13e5e7[_0xf625('0x17')]));});});};exports[_0xf625('0x26')]=function(_0x584baf){var _0x4faac6=this;return new Promise(function(_0x51dfb9,_0xae407c){return db['VoiceQueueReport'][_0xf625('0x27')](_0x584baf[_0xf625('0x28')],{'raw':_0x584baf[_0xf625('0x1d')]?_0x584baf[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4ebb93){logger[_0xf625('0x18')]('CreateVoiceQueueReport',_0x584baf);logger[_0xf625('0x12')](_0xf625('0x26'),_0x584baf,JSON['stringify'](_0x4ebb93));_0x51dfb9(_0x4ebb93);})[_0xf625('0x25')](function(_0x378e62){logger[_0xf625('0x15')](_0xf625('0x26'),_0x378e62[_0xf625('0x17')],_0x584baf);_0xae407c(_0x4faac6[_0xf625('0x15')](0x1f4,_0x378e62[_0xf625('0x17')]));});});};exports[_0xf625('0x29')]=function(_0x21df1d){var _0x123a23=this;return new Promise(function(_0x5877c9,_0x36a6){return db[_0xf625('0x1b')][_0xf625('0x2a')](_0x21df1d[_0xf625('0x28')],{'raw':_0x21df1d['options']?_0x21df1d[_0xf625('0x1d')][_0xf625('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21df1d[_0xf625('0x1d')]?_0x21df1d['options'][_0xf625('0x1f')]||null:null,'attributes':_0x21df1d['options']?_0x21df1d[_0xf625('0x1d')]['attributes']||null:null,'limit':_0x21df1d[_0xf625('0x1d')]?_0x21df1d[_0xf625('0x1d')][_0xf625('0x21')]||null:null})['then'](function(_0x1c10b5){logger['info'](_0xf625('0x29'),_0x21df1d);logger[_0xf625('0x12')](_0xf625('0x29'),_0x21df1d,JSON[_0xf625('0x14')](_0x1c10b5));_0x5877c9(_0x1c10b5);})[_0xf625('0x25')](function(_0x245faa){logger[_0xf625('0x15')](_0xf625('0x29'),_0x245faa[_0xf625('0x17')],_0x21df1d);_0x36a6(_0x123a23['error'](0x1f4,_0x245faa['message']));});});}; \ No newline at end of file +var _0x96d5=['message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x48541a,_0x41da01){var _0x3bdd3d=function(_0x4b3e53){while(--_0x4b3e53){_0x48541a['push'](_0x48541a['shift']());}};_0x3bdd3d(++_0x41da01);}(_0x96d5,0x14e));var _0x596d=function(_0x2d5934,_0x1acc4f){_0x2d5934=_0x2d5934-0x0;var _0x5807c8=_0x96d5[_0x2d5934];return _0x5807c8;};'use strict';var _=require(_0x596d('0x0'));var util=require(_0x596d('0x1'));var moment=require(_0x596d('0x2'));var BPromise=require(_0x596d('0x3'));var rs=require(_0x596d('0x4'));var fs=require('fs');var Redis=require(_0x596d('0x5'));var db=require(_0x596d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x596d('0x7'));var jayson=require(_0x596d('0x8'));var client=jayson[_0x596d('0x9')][_0x596d('0xa')]({'port':0x232a});config[_0x596d('0xb')]=_[_0x596d('0xc')](config[_0x596d('0xb')],{'host':_0x596d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x596d('0xe'))[_0x596d('0xf')](socket);function respondWithRpcPromise(_0x56d606,_0x1f30b6,_0x2a048f){return new BPromise(function(_0x30db14,_0x22eaae){return client[_0x596d('0x10')](_0x56d606,_0x2a048f)[_0x596d('0x11')](function(_0x512dae){logger[_0x596d('0x12')](_0x596d('0x13'),_0x1f30b6,_0x596d('0x14'));logger[_0x596d('0x15')](_0x596d('0x16'),_0x1f30b6,_0x596d('0x14'),JSON[_0x596d('0x17')](_0x512dae));if(_0x512dae[_0x596d('0x18')]){if(_0x512dae[_0x596d('0x18')][_0x596d('0x19')]===0x1f4){logger[_0x596d('0x18')](_0x596d('0x13'),_0x1f30b6,_0x512dae[_0x596d('0x18')][_0x596d('0x1a')]);return _0x22eaae(_0x512dae[_0x596d('0x18')][_0x596d('0x1a')]);}logger[_0x596d('0x18')](_0x596d('0x13'),_0x1f30b6,_0x512dae['error'][_0x596d('0x1a')]);return _0x30db14(_0x512dae[_0x596d('0x18')][_0x596d('0x1a')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1f30b6,_0x596d('0x14'));_0x30db14(_0x512dae[_0x596d('0x1b')][_0x596d('0x1a')]);}})[_0x596d('0x1c')](function(_0xf40697){logger[_0x596d('0x18')](_0x596d('0x13'),_0x1f30b6,_0xf40697);_0x22eaae(_0xf40697);});});}exports['GetVoiceQueueReport']=function(_0x5772bd){var _0x2ea6e5=this;return new Promise(function(_0x5947c8,_0x450a52){return db[_0x596d('0x1d')][_0x596d('0x1e')]({'raw':_0x5772bd['options']?_0x5772bd[_0x596d('0x1f')][_0x596d('0x20')]===undefined?!![]:![]:!![],'where':_0x5772bd[_0x596d('0x1f')]?_0x5772bd['options'][_0x596d('0x21')]||null:null,'attributes':_0x5772bd['options']?_0x5772bd['options'][_0x596d('0x22')]||null:null,'limit':_0x5772bd[_0x596d('0x1f')]?_0x5772bd[_0x596d('0x1f')][_0x596d('0x23')]||null:null,'include':_0x5772bd[_0x596d('0x1f')]?_0x5772bd['options'][_0x596d('0x24')]?_[_0x596d('0x25')](_0x5772bd[_0x596d('0x1f')]['include'],function(_0x75985d){return{'model':db[_0x75985d[_0x596d('0x26')]],'as':_0x75985d['as'],'attributes':_0x75985d[_0x596d('0x22')],'include':_0x75985d['include']?_['map'](_0x75985d['include'],function(_0x9b4290){return{'model':db[_0x9b4290[_0x596d('0x26')]],'as':_0x9b4290['as'],'attributes':_0x9b4290[_0x596d('0x22')],'include':_0x9b4290[_0x596d('0x24')]?_['map'](_0x9b4290[_0x596d('0x24')],function(_0x3d005d){return{'model':db[_0x3d005d[_0x596d('0x26')]],'as':_0x3d005d['as'],'attributes':_0x3d005d[_0x596d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x596d('0x11')](function(_0x385394){logger[_0x596d('0x12')]('GetVoiceQueueReport',_0x5772bd);logger[_0x596d('0x15')]('GetVoiceQueueReport',_0x5772bd,JSON[_0x596d('0x17')](_0x385394));_0x5947c8(_0x385394);})[_0x596d('0x1c')](function(_0x1456a6){logger[_0x596d('0x18')](_0x596d('0x27'),_0x1456a6[_0x596d('0x1a')],_0x5772bd);_0x450a52(_0x2ea6e5['error'](0x1f4,_0x1456a6['message']));});});};exports[_0x596d('0x28')]=function(_0x29bbdb){var _0xf34055=this;return new Promise(function(_0x35a7e5,_0x382dcf){return db['VoiceQueueReport'][_0x596d('0x29')](_0x29bbdb[_0x596d('0x2a')],{'raw':_0x29bbdb[_0x596d('0x1f')]?_0x29bbdb[_0x596d('0x1f')][_0x596d('0x20')]===undefined?!![]:![]:!![]})[_0x596d('0x11')](function(_0x102c18){logger[_0x596d('0x12')](_0x596d('0x28'),_0x29bbdb);logger[_0x596d('0x15')](_0x596d('0x28'),_0x29bbdb,JSON[_0x596d('0x17')](_0x102c18));_0x35a7e5(_0x102c18);})[_0x596d('0x1c')](function(_0x208028){logger[_0x596d('0x18')](_0x596d('0x28'),_0x208028[_0x596d('0x1a')],_0x29bbdb);_0x382dcf(_0xf34055[_0x596d('0x18')](0x1f4,_0x208028[_0x596d('0x1a')]));});});};exports[_0x596d('0x2b')]=function(_0x2e1b85){var _0x424200=this;return new Promise(function(_0x3eabc3,_0x331c3a){return db[_0x596d('0x1d')][_0x596d('0x2c')](_0x2e1b85[_0x596d('0x2a')],{'raw':_0x2e1b85[_0x596d('0x1f')]?_0x2e1b85['options'][_0x596d('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e1b85['options']?_0x2e1b85[_0x596d('0x1f')][_0x596d('0x21')]||null:null,'attributes':_0x2e1b85[_0x596d('0x1f')]?_0x2e1b85[_0x596d('0x1f')][_0x596d('0x22')]||null:null,'limit':_0x2e1b85['options']?_0x2e1b85['options']['limit']||null:null})[_0x596d('0x11')](function(_0x2b2c71){logger['info'](_0x596d('0x2b'),_0x2e1b85);logger[_0x596d('0x15')](_0x596d('0x2b'),_0x2e1b85,JSON['stringify'](_0x2b2c71));_0x3eabc3(_0x2b2c71);})[_0x596d('0x1c')](function(_0x1ec1fb){logger[_0x596d('0x18')](_0x596d('0x2b'),_0x1ec1fb[_0x596d('0x1a')],_0x2e1b85);_0x331c3a(_0x424200[_0x596d('0x18')](0x1f4,_0x1ec1fb[_0x596d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 837ca0b..2d34e53 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.socket.js +++ b/server/api/voiceQueueReport/voiceQueueReport.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe77f=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe77f,0xba));var _0xfe77=function(_0x4a9526,_0x2af39f){_0x4a9526=_0x4a9526-0x0;var _0x1d1220=_0xe77f[_0x4a9526];return _0x1d1220;};'use strict';var VoiceQueueReportEvents=require(_0xfe77('0x0'));var events=[_0xfe77('0x1'),'remove',_0xfe77('0x2')];function createListener(_0x3aee7f,_0x5eef38){return function(_0x1167e5){_0x5eef38[_0xfe77('0x3')](_0x3aee7f,_0x1167e5);};}function removeListener(_0x55a414,_0x150fc9){return function(){VoiceQueueReportEvents[_0xfe77('0x4')](_0x55a414,_0x150fc9);};}exports[_0xfe77('0x5')]=function(_0x1ce970){for(var _0x130b85=0x0,_0x51d137=events['length'];_0x130b85<_0x51d137;_0x130b85++){var _0x1a65af=events[_0x130b85];var _0xc2b8f4=createListener(_0xfe77('0x6')+_0x1a65af,_0x1ce970);VoiceQueueReportEvents['on'](_0x1a65af,_0xc2b8f4);}}; \ No newline at end of file +var _0xb3ea=['save','remove','removeListener','register','./voiceQueueReport.events'];(function(_0x3d25c3,_0x4ea5e7){var _0x2b82fe=function(_0x4552f2){while(--_0x4552f2){_0x3d25c3['push'](_0x3d25c3['shift']());}};_0x2b82fe(++_0x4ea5e7);}(_0xb3ea,0x10d));var _0xab3e=function(_0xaca63,_0x36f14c){_0xaca63=_0xaca63-0x0;var _0x489bf5=_0xb3ea[_0xaca63];return _0x489bf5;};'use strict';var VoiceQueueReportEvents=require(_0xab3e('0x0'));var events=[_0xab3e('0x1'),_0xab3e('0x2'),'update'];function createListener(_0xc66f7b,_0x4b9d20){return function(_0x283dbe){_0x4b9d20['emit'](_0xc66f7b,_0x283dbe);};}function removeListener(_0x30e8e6,_0x196c45){return function(){VoiceQueueReportEvents[_0xab3e('0x3')](_0x30e8e6,_0x196c45);};}exports[_0xab3e('0x4')]=function(_0x135941){for(var _0x570744=0x0,_0x3c0a3f=events['length'];_0x570744<_0x3c0a3f;_0x570744++){var _0x1026e7=events[_0x570744];var _0x6b6e2=createListener('voiceQueueReport:'+_0x1026e7,_0x135941);VoiceQueueReportEvents['on'](_0x1026e7,_0x6b6e2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 1523fa6..4d4129c 100644 --- a/server/api/voiceQueuesLog/index.js +++ b/server/api/voiceQueuesLog/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0d2=['connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','destroy','exports','util','path'];(function(_0x246e29,_0x5f2ca6){var _0x4b73e8=function(_0x386abf){while(--_0x386abf){_0x246e29['push'](_0x246e29['shift']());}};_0x4b73e8(++_0x5f2ca6);}(_0xc0d2,0x98));var _0x2c0d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc0d2[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x2c0d('0x0'));var path=require(_0x2c0d('0x1'));var timeout=require(_0x2c0d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2c0d('0x3'));var auth=require(_0x2c0d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2c0d('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x2c0d('0x6')]('/',auth[_0x2c0d('0x7')](),controller[_0x2c0d('0x8')]);router[_0x2c0d('0x6')](_0x2c0d('0x9'),auth[_0x2c0d('0x7')](),controller[_0x2c0d('0xa')]);router['post']('/',auth[_0x2c0d('0x7')](),controller['create']);router[_0x2c0d('0xb')](_0x2c0d('0x9'),auth[_0x2c0d('0x7')](),controller['update']);router['delete'](_0x2c0d('0x9'),auth['isAuthenticated'](),controller[_0x2c0d('0xc')]);module[_0x2c0d('0xd')]=router; \ No newline at end of file +var _0x3d7e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','path'];(function(_0x5045c0,_0x47c87c){var _0x1c892f=function(_0x3b59a5){while(--_0x3b59a5){_0x5045c0['push'](_0x5045c0['shift']());}};_0x1c892f(++_0x47c87c);}(_0x3d7e,0x1ae));var _0xe3d7=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x3d7e[_0x4ed1d4];return _0x28e363;};'use strict';var multer=require(_0xe3d7('0x0'));var util=require('util');var path=require(_0xe3d7('0x1'));var timeout=require('connect-timeout');var express=require(_0xe3d7('0x2'));var router=express[_0xe3d7('0x3')]();var fs_extra=require(_0xe3d7('0x4'));var auth=require(_0xe3d7('0x5'));var interaction=require(_0xe3d7('0x6'));var config=require(_0xe3d7('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xe3d7('0x8')]('/',auth[_0xe3d7('0x9')](),controller[_0xe3d7('0xa')]);router['get'](_0xe3d7('0xb'),auth[_0xe3d7('0x9')](),controller[_0xe3d7('0xc')]);router['post']('/',auth[_0xe3d7('0x9')](),controller[_0xe3d7('0xd')]);router[_0xe3d7('0xe')](_0xe3d7('0xb'),auth[_0xe3d7('0x9')](),controller[_0xe3d7('0xf')]);router['delete'](_0xe3d7('0xb'),auth[_0xe3d7('0x9')](),controller[_0xe3d7('0x10')]);module[_0xe3d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a9702d6..7ebfae5 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46bc=['moment','STRING','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x57aa35,_0x57b75f){var _0x262f15=function(_0x567eb0){while(--_0x567eb0){_0x57aa35['push'](_0x57aa35['shift']());}};_0x262f15(++_0x57b75f);}(_0x46bc,0x1b3));var _0xc46b=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x46bc[_0x1a7550];return _0x426e22;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc46b('0x0'));module['exports']={'time':{'type':Sequelize[_0xc46b('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc46b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0xc46b('0x2'))}}; \ No newline at end of file +var _0x1f26=['STRING','DATE','sequelize','moment','exports'];(function(_0x460a79,_0x539af9){var _0x34a218=function(_0x477d78){while(--_0x477d78){_0x460a79['push'](_0x460a79['shift']());}};_0x34a218(++_0x539af9);}(_0x1f26,0x197));var _0x61f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1f26[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x61f2('0x0'));var moment=require(_0x61f2('0x1'));module[_0x61f2('0x2')]={'time':{'type':Sequelize[_0x61f2('0x3')]},'callid':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x61f2('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x61f2('0x4')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 1e2ad7f..574beba 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9f8=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','VoiceQueuesLog','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv'];(function(_0x8c06f7,_0x28822c){var _0x4705c3=function(_0x5edd0e){while(--_0x5edd0e){_0x8c06f7['push'](_0x8c06f7['shift']());}};_0x4705c3(++_0x28822c);}(_0xa9f8,0x1a9));var _0x8a9f=function(_0x9165ab,_0x36d81b){_0x9165ab=_0x9165ab-0x0;var _0x31082a=_0xa9f8[_0x9165ab];return _0x31082a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a9f('0x0'));var zipdir=require(_0x8a9f('0x1'));var jsonpatch=require(_0x8a9f('0x2'));var rp=require(_0x8a9f('0x3'));var moment=require(_0x8a9f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8a9f('0x5'));var sox=require('sox');var csv=require(_0x8a9f('0x6'));var ejs=require(_0x8a9f('0x7'));var fs=require('fs');var fs_extra=require(_0x8a9f('0x8'));var _=require(_0x8a9f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a9f('0xa'));var deskjs=require(_0x8a9f('0xb'));var toCsv=require(_0x8a9f('0x6'));var querystring=require(_0x8a9f('0xc'));var Papa=require(_0x8a9f('0xd'));var Redis=require(_0x8a9f('0xe'));var authService=require(_0x8a9f('0xf'));var qs=require(_0x8a9f('0x10'));var as=require(_0x8a9f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a9f('0x12'))(_0x8a9f('0x13'));var utils=require(_0x8a9f('0x14'));var config=require(_0x8a9f('0x15'));var licenseUtil=require(_0x8a9f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30c117,_0x44a6dc){_0x44a6dc=_0x44a6dc||0xcc;return function(_0x1948f1){if(_0x1948f1){return _0x30c117[_0x8a9f('0x17')](_0x44a6dc);}return _0x30c117[_0x8a9f('0x18')](_0x44a6dc)[_0x8a9f('0x19')]();};}function respondWithResult(_0x24e399,_0x39633a){_0x39633a=_0x39633a||0xc8;return function(_0x5dc430){if(_0x5dc430){return _0x24e399[_0x8a9f('0x18')](_0x39633a)['json'](_0x5dc430);}};}function respondWithFilteredResult(_0x15519c,_0x1b951a){return function(_0x26ad16){if(_0x26ad16){var _0x4c07e0=typeof _0x1b951a[_0x8a9f('0x1a')]===_0x8a9f('0x1b')&&typeof _0x1b951a['limit']===_0x8a9f('0x1b');var _0x5076a1=_0x26ad16[_0x8a9f('0x1c')];var _0x275b71=_0x4c07e0?0x0:_0x1b951a['offset'];var _0x3311fc=_0x4c07e0?_0x26ad16[_0x8a9f('0x1c')]:_0x1b951a[_0x8a9f('0x1a')]+_0x1b951a[_0x8a9f('0x1d')];var _0x59934d;if(_0x3311fc>=_0x5076a1){_0x3311fc=_0x5076a1;_0x59934d=0xc8;}else{_0x59934d=0xce;}_0x15519c['status'](_0x59934d);return _0x15519c[_0x8a9f('0x1e')](_0x8a9f('0x1f'),_0x275b71+'-'+_0x3311fc+'/'+_0x5076a1)['json'](_0x26ad16);}return null;};}function patchUpdates(_0xed7dec){return function(_0x33c3d4){try{jsonpatch[_0x8a9f('0x20')](_0x33c3d4,_0xed7dec,!![]);}catch(_0x49bd29){return BPromise[_0x8a9f('0x21')](_0x49bd29);}return _0x33c3d4[_0x8a9f('0x22')]();};}function saveUpdates(_0x1db9f2,_0x5c0ef9){return function(_0x5dd36f){if(_0x5dd36f){return _0x5dd36f[_0x8a9f('0x23')](_0x1db9f2)[_0x8a9f('0x24')](function(_0x41ecae){return _0x41ecae;});}return null;};}function removeEntity(_0x1e3307,_0x2543a9){return function(_0x7b626c){if(_0x7b626c){return _0x7b626c[_0x8a9f('0x25')]()['then'](function(){_0x1e3307[_0x8a9f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491cd2,_0xc97e1f){return function(_0x50f01f){if(!_0x50f01f){_0x491cd2[_0x8a9f('0x17')](0x194);}return _0x50f01f;};}function handleError(_0x2fa729,_0x2c00f8){_0x2c00f8=_0x2c00f8||0x1f4;return function(_0x5be32d){logger[_0x8a9f('0x26')](_0x5be32d['stack']);if(_0x5be32d[_0x8a9f('0x27')]){delete _0x5be32d[_0x8a9f('0x27')];}_0x2fa729[_0x8a9f('0x18')](_0x2c00f8)[_0x8a9f('0x28')](_0x5be32d);};}exports['index']=function(_0x589aeb,_0x14d99d){var _0x4f8689={},_0x24d74e={},_0x404ea7={'count':0x0,'rows':[]};var _0x53e5a4=_[_0x8a9f('0x29')](db['VoiceQueuesLog']['rawAttributes'],function(_0x471cbf){return{'name':_0x471cbf[_0x8a9f('0x2a')],'type':_0x471cbf['type'][_0x8a9f('0x2b')]};});_0x24d74e[_0x8a9f('0x2c')]=_['map'](_0x53e5a4,'name');_0x24d74e[_0x8a9f('0x2d')]=_['keys'](_0x589aeb[_0x8a9f('0x2d')]);_0x24d74e[_0x8a9f('0x2e')]=_[_0x8a9f('0x2f')](_0x24d74e[_0x8a9f('0x2c')],_0x24d74e[_0x8a9f('0x2d')]);_0x4f8689[_0x8a9f('0x30')]=_[_0x8a9f('0x2f')](_0x24d74e['model'],qs[_0x8a9f('0x31')](_0x589aeb['query']['fields']));_0x4f8689['attributes']=_0x4f8689['attributes'][_0x8a9f('0x32')]?_0x4f8689[_0x8a9f('0x30')]:_0x24d74e[_0x8a9f('0x2c')];if(!_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x33')](_0x8a9f('0x34'))){_0x4f8689[_0x8a9f('0x1d')]=qs[_0x8a9f('0x1d')](_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x1d')]);_0x4f8689[_0x8a9f('0x1a')]=qs[_0x8a9f('0x1a')](_0x589aeb['query']['offset']);}_0x4f8689[_0x8a9f('0x35')]=qs['sort'](_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x36')]);_0x4f8689['where']=qs[_0x8a9f('0x2e')](_['pick'](_0x589aeb[_0x8a9f('0x2d')],_0x24d74e['filters']),_0x53e5a4);if(_0x589aeb[_0x8a9f('0x2d')][_0x8a9f('0x37')]){_0x4f8689[_0x8a9f('0x38')]=_[_0x8a9f('0x39')](_0x4f8689['where'],{'$or':_[_0x8a9f('0x29')](_0x53e5a4,function(_0x447727){if(_0x447727[_0x8a9f('0x3a')]!=='VIRTUAL'){var _0x2a3a54={};_0x2a3a54[_0x447727['name']]={'$like':'%'+_0x589aeb[_0x8a9f('0x2d')]['filter']+'%'};return _0x2a3a54;}})});}_0x4f8689=_['merge']({},_0x4f8689,_0x589aeb[_0x8a9f('0x3b')]);var _0x5c9833={'where':_0x4f8689['where']};return db[_0x8a9f('0x3c')]['count'](_0x5c9833)[_0x8a9f('0x24')](function(_0x3e5182){_0x404ea7[_0x8a9f('0x1c')]=_0x3e5182;if(_0x589aeb[_0x8a9f('0x2d')]['includeAll']){_0x4f8689['include']=[{'all':!![]}];}return db[_0x8a9f('0x3c')][_0x8a9f('0x3d')](_0x4f8689);})['then'](function(_0x25d81e){_0x404ea7[_0x8a9f('0x3e')]=_0x25d81e;return _0x404ea7;})[_0x8a9f('0x24')](respondWithFilteredResult(_0x14d99d,_0x4f8689))[_0x8a9f('0x3f')](handleError(_0x14d99d,null));};exports[_0x8a9f('0x40')]=function(_0x4ca48d,_0x278ae0){var _0x4007ea={'raw':!![],'where':{'id':_0x4ca48d['params']['id']}},_0x3b0e2c={};_0x3b0e2c[_0x8a9f('0x2c')]=_[_0x8a9f('0x41')](db[_0x8a9f('0x3c')][_0x8a9f('0x42')]);_0x3b0e2c[_0x8a9f('0x2d')]=_[_0x8a9f('0x41')](_0x4ca48d['query']);_0x3b0e2c[_0x8a9f('0x2e')]=_[_0x8a9f('0x2f')](_0x3b0e2c[_0x8a9f('0x2c')],_0x3b0e2c['query']);_0x4007ea[_0x8a9f('0x30')]=_[_0x8a9f('0x2f')](_0x3b0e2c[_0x8a9f('0x2c')],qs['fields'](_0x4ca48d[_0x8a9f('0x2d')][_0x8a9f('0x31')]));_0x4007ea[_0x8a9f('0x30')]=_0x4007ea[_0x8a9f('0x30')][_0x8a9f('0x32')]?_0x4007ea[_0x8a9f('0x30')]:_0x3b0e2c[_0x8a9f('0x2c')];if(_0x4ca48d[_0x8a9f('0x2d')]['includeAll']){_0x4007ea[_0x8a9f('0x43')]=[{'all':!![]}];}_0x4007ea=_[_0x8a9f('0x39')]({},_0x4007ea,_0x4ca48d['options']);return db[_0x8a9f('0x3c')][_0x8a9f('0x44')](_0x4007ea)[_0x8a9f('0x24')](handleEntityNotFound(_0x278ae0,null))['then'](respondWithResult(_0x278ae0,null))[_0x8a9f('0x3f')](handleError(_0x278ae0,null));};exports[_0x8a9f('0x45')]=function(_0x42355b,_0x52a953){return db[_0x8a9f('0x3c')][_0x8a9f('0x45')](_0x42355b['body'],{})[_0x8a9f('0x24')](respondWithResult(_0x52a953,0xc9))[_0x8a9f('0x3f')](handleError(_0x52a953,null));};exports[_0x8a9f('0x23')]=function(_0x1bc5bc,_0x49c9c3){if(_0x1bc5bc[_0x8a9f('0x46')]['id']){delete _0x1bc5bc[_0x8a9f('0x46')]['id'];}return db['VoiceQueuesLog'][_0x8a9f('0x44')]({'where':{'id':_0x1bc5bc[_0x8a9f('0x47')]['id']}})[_0x8a9f('0x24')](handleEntityNotFound(_0x49c9c3,null))['then'](saveUpdates(_0x1bc5bc['body'],null))[_0x8a9f('0x24')](respondWithResult(_0x49c9c3,null))[_0x8a9f('0x3f')](handleError(_0x49c9c3,null));};exports[_0x8a9f('0x25')]=function(_0x1357e1,_0x4f79d3){return db[_0x8a9f('0x3c')][_0x8a9f('0x44')]({'where':{'id':_0x1357e1[_0x8a9f('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f79d3,null))[_0x8a9f('0x24')](removeEntity(_0x4f79d3,null))[_0x8a9f('0x3f')](handleError(_0x4f79d3,null));}; \ No newline at end of file +var _0x4d0a=['include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','destroy','then','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','order','sort','where','filters','pick','filter','merge','type','count','includeAll','findAll','rows','catch','show','params'];(function(_0x51e66c,_0x54e05c){var _0x8a35a9=function(_0x3b761f){while(--_0x3b761f){_0x51e66c['push'](_0x51e66c['shift']());}};_0x8a35a9(++_0x54e05c);}(_0x4d0a,0xe6));var _0xa4d0=function(_0x1102ab,_0x5a7c05){_0x1102ab=_0x1102ab-0x0;var _0x83587d=_0x4d0a[_0x1102ab];return _0x83587d;};'use strict';var emlformat=require(_0xa4d0('0x0'));var rimraf=require(_0xa4d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa4d0('0x2'));var rp=require(_0xa4d0('0x3'));var moment=require(_0xa4d0('0x4'));var BPromise=require(_0xa4d0('0x5'));var Mustache=require(_0xa4d0('0x6'));var util=require(_0xa4d0('0x7'));var path=require(_0xa4d0('0x8'));var sox=require(_0xa4d0('0x9'));var csv=require('to-csv');var ejs=require(_0xa4d0('0xa'));var fs=require('fs');var fs_extra=require(_0xa4d0('0xb'));var _=require('lodash');var squel=require(_0xa4d0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa4d0('0xd'));var toCsv=require(_0xa4d0('0xe'));var querystring=require(_0xa4d0('0xf'));var Papa=require(_0xa4d0('0x10'));var Redis=require(_0xa4d0('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa4d0('0x12'));var hardwareService=require(_0xa4d0('0x13'));var logger=require(_0xa4d0('0x14'))(_0xa4d0('0x15'));var utils=require(_0xa4d0('0x16'));var config=require(_0xa4d0('0x17'));var licenseUtil=require(_0xa4d0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564c62,_0x40d14c){_0x40d14c=_0x40d14c||0xcc;return function(_0x55ad34){if(_0x55ad34){return _0x564c62[_0xa4d0('0x19')](_0x40d14c);}return _0x564c62[_0xa4d0('0x1a')](_0x40d14c)[_0xa4d0('0x1b')]();};}function respondWithResult(_0x2b8797,_0x1bb773){_0x1bb773=_0x1bb773||0xc8;return function(_0x22c60b){if(_0x22c60b){return _0x2b8797['status'](_0x1bb773)[_0xa4d0('0x1c')](_0x22c60b);}};}function respondWithFilteredResult(_0x5ba5ab,_0x5a7a40){return function(_0xc70ab){if(_0xc70ab){var _0xa35e6a=typeof _0x5a7a40[_0xa4d0('0x1d')]===_0xa4d0('0x1e')&&typeof _0x5a7a40[_0xa4d0('0x1f')]===_0xa4d0('0x1e');var _0x447dcc=_0xc70ab['count'];var _0x48e3e7=_0xa35e6a?0x0:_0x5a7a40['offset'];var _0x367867=_0xa35e6a?_0xc70ab['count']:_0x5a7a40[_0xa4d0('0x1d')]+_0x5a7a40[_0xa4d0('0x1f')];var _0xc75d71;if(_0x367867>=_0x447dcc){_0x367867=_0x447dcc;_0xc75d71=0xc8;}else{_0xc75d71=0xce;}_0x5ba5ab[_0xa4d0('0x1a')](_0xc75d71);return _0x5ba5ab[_0xa4d0('0x20')]('Content-Range',_0x48e3e7+'-'+_0x367867+'/'+_0x447dcc)['json'](_0xc70ab);}return null;};}function patchUpdates(_0x163a3f){return function(_0x3975ea){try{jsonpatch[_0xa4d0('0x21')](_0x3975ea,_0x163a3f,!![]);}catch(_0x2de63b){return BPromise[_0xa4d0('0x22')](_0x2de63b);}return _0x3975ea[_0xa4d0('0x23')]();};}function saveUpdates(_0x764ca3,_0x45d972){return function(_0x20fdd3){if(_0x20fdd3){return _0x20fdd3[_0xa4d0('0x24')](_0x764ca3)['then'](function(_0x4f9366){return _0x4f9366;});}return null;};}function removeEntity(_0x28ec35,_0xb74f37){return function(_0x23bc83){if(_0x23bc83){return _0x23bc83[_0xa4d0('0x25')]()[_0xa4d0('0x26')](function(){_0x28ec35[_0xa4d0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bd257,_0x2578b5){return function(_0x493e47){if(!_0x493e47){_0x5bd257[_0xa4d0('0x19')](0x194);}return _0x493e47;};}function handleError(_0x45eda2,_0x4be3e4){_0x4be3e4=_0x4be3e4||0x1f4;return function(_0x232390){logger['error'](_0x232390['stack']);if(_0x232390[_0xa4d0('0x27')]){delete _0x232390[_0xa4d0('0x27')];}_0x45eda2[_0xa4d0('0x1a')](_0x4be3e4)[_0xa4d0('0x28')](_0x232390);};}exports['index']=function(_0x4db6c2,_0x6699db){var _0x34faba={},_0x49225e={},_0x3cdc0d={'count':0x0,'rows':[]};var _0xe462f0=_[_0xa4d0('0x29')](db[_0xa4d0('0x2a')][_0xa4d0('0x2b')],function(_0x3f82b7){return{'name':_0x3f82b7[_0xa4d0('0x2c')],'type':_0x3f82b7['type'][_0xa4d0('0x2d')]};});_0x49225e[_0xa4d0('0x2e')]=_[_0xa4d0('0x29')](_0xe462f0,_0xa4d0('0x27'));_0x49225e['query']=_[_0xa4d0('0x2f')](_0x4db6c2['query']);_0x49225e['filters']=_[_0xa4d0('0x30')](_0x49225e['model'],_0x49225e['query']);_0x34faba['attributes']=_[_0xa4d0('0x30')](_0x49225e['model'],qs[_0xa4d0('0x31')](_0x4db6c2['query'][_0xa4d0('0x31')]));_0x34faba['attributes']=_0x34faba[_0xa4d0('0x32')][_0xa4d0('0x33')]?_0x34faba[_0xa4d0('0x32')]:_0x49225e['model'];if(!_0x4db6c2['query'][_0xa4d0('0x34')](_0xa4d0('0x35'))){_0x34faba[_0xa4d0('0x1f')]=qs['limit'](_0x4db6c2['query']['limit']);_0x34faba['offset']=qs[_0xa4d0('0x1d')](_0x4db6c2[_0xa4d0('0x36')]['offset']);}_0x34faba[_0xa4d0('0x37')]=qs[_0xa4d0('0x38')](_0x4db6c2['query'][_0xa4d0('0x38')]);_0x34faba[_0xa4d0('0x39')]=qs[_0xa4d0('0x3a')](_[_0xa4d0('0x3b')](_0x4db6c2['query'],_0x49225e[_0xa4d0('0x3a')]),_0xe462f0);if(_0x4db6c2[_0xa4d0('0x36')][_0xa4d0('0x3c')]){_0x34faba['where']=_[_0xa4d0('0x3d')](_0x34faba[_0xa4d0('0x39')],{'$or':_['map'](_0xe462f0,function(_0x553283){if(_0x553283[_0xa4d0('0x3e')]!=='VIRTUAL'){var _0x5a9e10={};_0x5a9e10[_0x553283[_0xa4d0('0x27')]]={'$like':'%'+_0x4db6c2[_0xa4d0('0x36')][_0xa4d0('0x3c')]+'%'};return _0x5a9e10;}})});}_0x34faba=_[_0xa4d0('0x3d')]({},_0x34faba,_0x4db6c2['options']);var _0x3fba0a={'where':_0x34faba[_0xa4d0('0x39')]};return db[_0xa4d0('0x2a')][_0xa4d0('0x3f')](_0x3fba0a)[_0xa4d0('0x26')](function(_0x38a383){_0x3cdc0d[_0xa4d0('0x3f')]=_0x38a383;if(_0x4db6c2[_0xa4d0('0x36')][_0xa4d0('0x40')]){_0x34faba['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xa4d0('0x41')](_0x34faba);})[_0xa4d0('0x26')](function(_0xce08ed){_0x3cdc0d[_0xa4d0('0x42')]=_0xce08ed;return _0x3cdc0d;})['then'](respondWithFilteredResult(_0x6699db,_0x34faba))[_0xa4d0('0x43')](handleError(_0x6699db,null));};exports[_0xa4d0('0x44')]=function(_0x587075,_0x22f5ec){var _0x2f529e={'raw':!![],'where':{'id':_0x587075[_0xa4d0('0x45')]['id']}},_0x249bce={};_0x249bce[_0xa4d0('0x2e')]=_[_0xa4d0('0x2f')](db[_0xa4d0('0x2a')][_0xa4d0('0x2b')]);_0x249bce[_0xa4d0('0x36')]=_[_0xa4d0('0x2f')](_0x587075['query']);_0x249bce[_0xa4d0('0x3a')]=_[_0xa4d0('0x30')](_0x249bce['model'],_0x249bce[_0xa4d0('0x36')]);_0x2f529e[_0xa4d0('0x32')]=_[_0xa4d0('0x30')](_0x249bce['model'],qs['fields'](_0x587075[_0xa4d0('0x36')][_0xa4d0('0x31')]));_0x2f529e[_0xa4d0('0x32')]=_0x2f529e[_0xa4d0('0x32')][_0xa4d0('0x33')]?_0x2f529e[_0xa4d0('0x32')]:_0x249bce['model'];if(_0x587075['query'][_0xa4d0('0x40')]){_0x2f529e[_0xa4d0('0x46')]=[{'all':!![]}];}_0x2f529e=_[_0xa4d0('0x3d')]({},_0x2f529e,_0x587075[_0xa4d0('0x47')]);return db[_0xa4d0('0x2a')][_0xa4d0('0x48')](_0x2f529e)[_0xa4d0('0x26')](handleEntityNotFound(_0x22f5ec,null))[_0xa4d0('0x26')](respondWithResult(_0x22f5ec,null))[_0xa4d0('0x43')](handleError(_0x22f5ec,null));};exports['create']=function(_0x5daf7c,_0x240fbe){return db['VoiceQueuesLog'][_0xa4d0('0x49')](_0x5daf7c['body'],{})[_0xa4d0('0x26')](respondWithResult(_0x240fbe,0xc9))['catch'](handleError(_0x240fbe,null));};exports[_0xa4d0('0x24')]=function(_0x478352,_0x4dfd44){if(_0x478352['body']['id']){delete _0x478352['body']['id'];}return db[_0xa4d0('0x2a')][_0xa4d0('0x48')]({'where':{'id':_0x478352[_0xa4d0('0x45')]['id']}})[_0xa4d0('0x26')](handleEntityNotFound(_0x4dfd44,null))[_0xa4d0('0x26')](saveUpdates(_0x478352[_0xa4d0('0x4a')],null))['then'](respondWithResult(_0x4dfd44,null))['catch'](handleError(_0x4dfd44,null));};exports[_0xa4d0('0x25')]=function(_0x322e54,_0x1481b4){return db[_0xa4d0('0x2a')][_0xa4d0('0x48')]({'where':{'id':_0x322e54['params']['id']}})[_0xa4d0('0x26')](handleEntityNotFound(_0x1481b4,null))[_0xa4d0('0x26')](removeEntity(_0x1481b4,null))[_0xa4d0('0x43')](handleError(_0x1481b4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 08e0ebe..5f6ad3b 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.model.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c54=['rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xcf8aeb,_0x5b7b2e){var _0x23156c=function(_0x66974){while(--_0x66974){_0xcf8aeb['push'](_0xcf8aeb['shift']());}};_0x23156c(++_0x5b7b2e);}(_0x2c54,0x181));var _0x42c5=function(_0x5b3f45,_0x22182a){_0x5b3f45=_0x5b3f45-0x0;var _0x2ac860=_0x2c54[_0x5b3f45];return _0x2ac860;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42c5('0x0'))('api');var moment=require(_0x42c5('0x1'));var BPromise=require(_0x42c5('0x2'));var rp=require(_0x42c5('0x3'));var fs=require('fs');var path=require(_0x42c5('0x4'));var rimraf=require(_0x42c5('0x5'));var config=require('../../config/environment');var attributes=require(_0x42c5('0x6'));module[_0x42c5('0x7')]=function(_0x1fb089,_0x391ca9){return _0x1fb089['define'](_0x42c5('0x8'),attributes,{'tableName':_0x42c5('0x9'),'paranoid':![],'indexes':[{'name':_0x42c5('0xa'),'fields':[_0x42c5('0xb'),_0x42c5('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6151=['define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x52051f,_0x28eab0){var _0x5b8e8a=function(_0xbe492){while(--_0xbe492){_0x52051f['push'](_0x52051f['shift']());}};_0x5b8e8a(++_0x28eab0);}(_0x6151,0xb5));var _0x1615=function(_0x3b22f0,_0x3463fd){_0x3b22f0=_0x3b22f0-0x0;var _0x55bf4d=_0x6151[_0x3b22f0];return _0x55bf4d;};'use strict';var _=require(_0x1615('0x0'));var util=require(_0x1615('0x1'));var logger=require(_0x1615('0x2'))(_0x1615('0x3'));var moment=require(_0x1615('0x4'));var BPromise=require(_0x1615('0x5'));var rp=require(_0x1615('0x6'));var fs=require('fs');var path=require(_0x1615('0x7'));var rimraf=require(_0x1615('0x8'));var config=require(_0x1615('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x1615('0xa')]=function(_0x5e03eb,_0x43f7ef){return _0x5e03eb[_0x1615('0xb')](_0x1615('0xc'),attributes,{'tableName':_0x1615('0xd'),'paranoid':![],'indexes':[{'name':_0x1615('0xe'),'fields':['event',_0x1615('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index cca1859..3a29239 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8f2=['../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xe8f2,0x133));var _0x2e8f=function(_0x448188,_0x150fd1){_0x448188=_0x448188-0x0;var _0x2f19c0=_0xe8f2[_0x448188];return _0x2f19c0;};'use strict';var _=require(_0x2e8f('0x0'));var util=require(_0x2e8f('0x1'));var moment=require(_0x2e8f('0x2'));var BPromise=require(_0x2e8f('0x3'));var rs=require(_0x2e8f('0x4'));var fs=require('fs');var Redis=require(_0x2e8f('0x5'));var db=require(_0x2e8f('0x6'))['db'];var utils=require(_0x2e8f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2e8f('0x8'));var jayson=require(_0x2e8f('0x9'));var client=jayson[_0x2e8f('0xa')][_0x2e8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2349f0,_0x87fc13,_0x284c13){return new BPromise(function(_0x29e149,_0x1113ba){return client['request'](_0x2349f0,_0x284c13)[_0x2e8f('0xc')](function(_0x44b85d){logger[_0x2e8f('0xd')](_0x2e8f('0xe'),_0x87fc13,'request\x20sent');logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x87fc13,'request\x20sent',JSON[_0x2e8f('0xf')](_0x44b85d));if(_0x44b85d[_0x2e8f('0x10')]){if(_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x11')]===0x1f4){logger[_0x2e8f('0x10')](_0x2e8f('0xe'),_0x87fc13,_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);return _0x1113ba(_0x44b85d['error'][_0x2e8f('0x12')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x87fc13,_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);return _0x29e149(_0x44b85d[_0x2e8f('0x10')][_0x2e8f('0x12')]);}else{logger[_0x2e8f('0xd')](_0x2e8f('0xe'),_0x87fc13,_0x2e8f('0x13'));_0x29e149(_0x44b85d['result'][_0x2e8f('0x12')]);}})[_0x2e8f('0x14')](function(_0x8edd){logger[_0x2e8f('0x10')](_0x2e8f('0xe'),_0x87fc13,_0x8edd);_0x1113ba(_0x8edd);});});} \ No newline at end of file +var _0x84fd=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x3770bf,_0x2f78fb){var _0x29a6fc=function(_0x3348e5){while(--_0x3348e5){_0x3770bf['push'](_0x3770bf['shift']());}};_0x29a6fc(++_0x2f78fb);}(_0x84fd,0xda));var _0xd84f=function(_0x59ae5c,_0x3241ac){_0x59ae5c=_0x59ae5c-0x0;var _0x1df2b2=_0x84fd[_0x59ae5c];return _0x1df2b2;};'use strict';var _=require(_0xd84f('0x0'));var util=require(_0xd84f('0x1'));var moment=require(_0xd84f('0x2'));var BPromise=require(_0xd84f('0x3'));var rs=require(_0xd84f('0x4'));var fs=require('fs');var Redis=require(_0xd84f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd84f('0x6'));var logger=require(_0xd84f('0x7'))(_0xd84f('0x8'));var config=require(_0xd84f('0x9'));var jayson=require(_0xd84f('0xa'));var client=jayson['client'][_0xd84f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4981d2,_0x1edb3f,_0x5b1e51){return new BPromise(function(_0x47940d,_0x22b34f){return client[_0xd84f('0xc')](_0x4981d2,_0x5b1e51)['then'](function(_0x5a5436){logger[_0xd84f('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1edb3f,_0xd84f('0xe'));logger[_0xd84f('0xf')](_0xd84f('0x10'),_0x1edb3f,'request\x20sent',JSON['stringify'](_0x5a5436));if(_0x5a5436[_0xd84f('0x11')]){if(_0x5a5436['error'][_0xd84f('0x12')]===0x1f4){logger[_0xd84f('0x11')](_0xd84f('0x13'),_0x1edb3f,_0x5a5436['error'][_0xd84f('0x14')]);return _0x22b34f(_0x5a5436[_0xd84f('0x11')][_0xd84f('0x14')]);}logger[_0xd84f('0x11')](_0xd84f('0x13'),_0x1edb3f,_0x5a5436[_0xd84f('0x11')][_0xd84f('0x14')]);return _0x47940d(_0x5a5436[_0xd84f('0x11')][_0xd84f('0x14')]);}else{logger['info'](_0xd84f('0x13'),_0x1edb3f,_0xd84f('0xe'));_0x47940d(_0x5a5436[_0xd84f('0x15')][_0xd84f('0x14')]);}})['catch'](function(_0x2d4e23){logger[_0xd84f('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1edb3f,_0x2d4e23);_0x22b34f(_0x2d4e23);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 14391d5..428a304 100644 --- a/server/api/voiceRecording/index.js +++ b/server/api/voiceRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x476d=['post','create','/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','/:id/download','download'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x476d,0x167));var _0xd476=function(_0x229f58,_0x2fc35a){_0x229f58=_0x229f58-0x0;var _0xb7e54a=_0x476d[_0x229f58];return _0xb7e54a;};'use strict';var multer=require(_0xd476('0x0'));var util=require('util');var path=require(_0xd476('0x1'));var timeout=require(_0xd476('0x2'));var express=require('express');var router=express[_0xd476('0x3')]();var fs_extra=require(_0xd476('0x4'));var auth=require(_0xd476('0x5'));var interaction=require(_0xd476('0x6'));var config=require(_0xd476('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd476('0x8')]);router['get'](_0xd476('0x9'),auth[_0xd476('0xa')](),controller[_0xd476('0xb')]);router[_0xd476('0xc')]('/:id',auth[_0xd476('0xa')](),controller[_0xd476('0xd')]);router[_0xd476('0xc')](_0xd476('0xe'),auth['isAuthenticated'](),controller[_0xd476('0xf')]);router[_0xd476('0xc')]('/:id/downloads',controller['downloads']);router[_0xd476('0xc')]('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xd476('0x10')]('/',auth[_0xd476('0xa')](),controller[_0xd476('0x11')]);router[_0xd476('0x10')](_0xd476('0x12'),auth[_0xd476('0xa')](),controller[_0xd476('0x13')]);router[_0xd476('0x14')](_0xd476('0x15'),auth['isAuthenticated'](),controller[_0xd476('0x16')]);router[_0xd476('0x17')]('/:id',auth[_0xd476('0xa')](),controller[_0xd476('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1f91=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceRecording.controller','get','/describe','isAuthenticated','describe','/:id','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put'];(function(_0x1b5b3b,_0x5ac3f9){var _0x3a9e59=function(_0x50efe5){while(--_0x50efe5){_0x1b5b3b['push'](_0x1b5b3b['shift']());}};_0x3a9e59(++_0x5ac3f9);}(_0x1f91,0x182));var _0x11f9=function(_0x8da355,_0x49578a){_0x8da355=_0x8da355-0x0;var _0x19aca3=_0x1f91[_0x8da355];return _0x19aca3;};'use strict';var multer=require('multer');var util=require(_0x11f9('0x0'));var path=require(_0x11f9('0x1'));var timeout=require(_0x11f9('0x2'));var express=require(_0x11f9('0x3'));var router=express[_0x11f9('0x4')]();var fs_extra=require(_0x11f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x11f9('0x6'));var config=require('../../config/environment');var controller=require(_0x11f9('0x7'));router[_0x11f9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x11f9('0x9'),auth[_0x11f9('0xa')](),controller[_0x11f9('0xb')]);router[_0x11f9('0x8')](_0x11f9('0xc'),auth[_0x11f9('0xa')](),controller['show']);router[_0x11f9('0x8')](_0x11f9('0xd'),auth[_0x11f9('0xa')](),controller[_0x11f9('0xe')]);router[_0x11f9('0x8')]('/:id/downloads',controller[_0x11f9('0xf')]);router[_0x11f9('0x8')](_0x11f9('0x10'),auth[_0x11f9('0xa')](),controller[_0x11f9('0x11')]);router[_0x11f9('0x12')]('/',auth[_0x11f9('0xa')](),controller[_0x11f9('0x13')]);router[_0x11f9('0x12')](_0x11f9('0x10'),auth[_0x11f9('0xa')](),controller[_0x11f9('0x14')]);router[_0x11f9('0x15')](_0x11f9('0xc'),auth[_0x11f9('0xa')](),controller['update']);router[_0x11f9('0x16')](_0x11f9('0xc'),auth[_0x11f9('0xa')](),controller[_0x11f9('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 031fc9d..99d4b47 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 38768a3..37aef26 100644 --- a/server/api/voiceRecording/voiceRecording.controller.js +++ b/server/api/voiceRecording/voiceRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x562e=['map','VoiceRecording','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','send','Not\x20found','downloads','sequelize','col','token','$and','push','%s.cypher','secrets','VoiceRecording\x20not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeRegion','language','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','then','error','stack','name','index'];(function(_0x398fbb,_0x43220d){var _0x132e5c=function(_0x54ca84){while(--_0x54ca84){_0x398fbb['push'](_0x398fbb['shift']());}};_0x132e5c(++_0x43220d);}(_0x562e,0x6e));var _0xe562=function(_0x1f8f63,_0x3c1f9f){_0x1f8f63=_0x1f8f63-0x0;var _0x1924a5=_0x562e[_0x1f8f63];return _0x1924a5;};'use strict';var emlformat=require(_0xe562('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe562('0x1'));var BPromise=require(_0xe562('0x2'));var Mustache=require(_0xe562('0x3'));var util=require('util');var path=require(_0xe562('0x4'));var sox=require(_0xe562('0x5'));var csv=require(_0xe562('0x6'));var ejs=require(_0xe562('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe562('0x8'));var crypto=require(_0xe562('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe562('0xa'));var toCsv=require(_0xe562('0x6'));var querystring=require(_0xe562('0xb'));var Papa=require(_0xe562('0xc'));var AWS=require(_0xe562('0xd'));var uuidv4=require(_0xe562('0xe'));var Redis=require(_0xe562('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe562('0x10'));var as=require(_0xe562('0x11'));var hardwareService=require(_0xe562('0x12'));var logger=require(_0xe562('0x13'))(_0xe562('0x14'));var utils=require(_0xe562('0x15'));var config=require(_0xe562('0x16'));var licenseUtil=require(_0xe562('0x17'));var db=require(_0xe562('0x18'))['db'];function respondWithStatusCode(_0x37de2b,_0xe15ec3){_0xe15ec3=_0xe15ec3||0xcc;return function(_0x357339){if(_0x357339){return _0x37de2b[_0xe562('0x19')](_0xe15ec3);}return _0x37de2b[_0xe562('0x1a')](_0xe15ec3)[_0xe562('0x1b')]();};}function respondWithResult(_0x37d942,_0x3e2342){_0x3e2342=_0x3e2342||0xc8;return function(_0x474760){if(_0x474760){return _0x37d942['status'](_0x3e2342)['json'](_0x474760);}};}function respondWithFilteredResult(_0x4283b6,_0x40aaa4){return function(_0x40502d){if(_0x40502d){var _0x569fc8=typeof _0x40aaa4['offset']==='undefined'&&typeof _0x40aaa4[_0xe562('0x1c')]===_0xe562('0x1d');var _0x2caeaa=_0x40502d[_0xe562('0x1e')];var _0xe08ff1=_0x569fc8?0x0:_0x40aaa4[_0xe562('0x1f')];var _0x4cc9b1=_0x569fc8?_0x40502d[_0xe562('0x1e')]:_0x40aaa4['offset']+_0x40aaa4['limit'];var _0x51c357;if(_0x4cc9b1>=_0x2caeaa){_0x4cc9b1=_0x2caeaa;_0x51c357=0xc8;}else{_0x51c357=0xce;}_0x4283b6[_0xe562('0x1a')](_0x51c357);return _0x4283b6[_0xe562('0x20')](_0xe562('0x21'),_0xe08ff1+'-'+_0x4cc9b1+'/'+_0x2caeaa)[_0xe562('0x22')](_0x40502d);}return null;};}function patchUpdates(_0x5d8e1b){return function(_0x241cfb){try{jsonpatch['apply'](_0x241cfb,_0x5d8e1b,!![]);}catch(_0x4839be){return BPromise[_0xe562('0x23')](_0x4839be);}return _0x241cfb['save']();};}function saveUpdates(_0x3b47ed,_0x2d7e70){return function(_0x4c8236){if(_0x4c8236){return _0x4c8236['update'](_0x3b47ed)[_0xe562('0x24')](function(_0x4048a0){return _0x4048a0;});}return null;};}function removeEntity(_0x5159df,_0x40c063){return function(_0xa46ecd){if(_0xa46ecd){return _0xa46ecd['destroy']()[_0xe562('0x24')](function(){_0x5159df['status'](0xcc)[_0xe562('0x1b')]();});}};}function handleEntityNotFound(_0x209a57,_0x1318ac){return function(_0x35f15f){if(!_0x35f15f){_0x209a57['sendStatus'](0x194);}return _0x35f15f;};}function handleError(_0x44ed4d,_0x44255f){_0x44255f=_0x44255f||0x1f4;return function(_0x1c2043){logger[_0xe562('0x25')](_0x1c2043[_0xe562('0x26')]);if(_0x1c2043[_0xe562('0x27')]){delete _0x1c2043[_0xe562('0x27')];}_0x44ed4d[_0xe562('0x1a')](_0x44255f)['send'](_0x1c2043);};}exports[_0xe562('0x28')]=function(_0x53f9b6,_0x178191){var _0x3c9793={},_0x2e44da={},_0x310885={'count':0x0,'rows':[]};var _0x4858a9=_[_0xe562('0x29')](db[_0xe562('0x2a')]['rawAttributes'],function(_0x5ddfa0){return{'name':_0x5ddfa0[_0xe562('0x2b')],'type':_0x5ddfa0[_0xe562('0x2c')][_0xe562('0x2d')]};});_0x2e44da['model']=_['differenceBy'](_[_0xe562('0x29')](_0x4858a9,_0xe562('0x27')),['format']);_0x2e44da['query']=_[_0xe562('0x2e')](_0x53f9b6[_0xe562('0x2f')]);_0x2e44da[_0xe562('0x30')]=_[_0xe562('0x31')](_0x2e44da['model'],_0x2e44da[_0xe562('0x2f')]);_0x3c9793[_0xe562('0x32')]=_['intersection'](_0x2e44da['model'],qs[_0xe562('0x33')](_0x53f9b6[_0xe562('0x2f')]['fields']));_0x3c9793[_0xe562('0x32')]=_0x3c9793[_0xe562('0x32')][_0xe562('0x34')]?_0x3c9793[_0xe562('0x32')]:_0x2e44da[_0xe562('0x35')];if(!_0x53f9b6['query']['hasOwnProperty'](_0xe562('0x36'))){_0x3c9793[_0xe562('0x1c')]=qs[_0xe562('0x1c')](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x1c')]);_0x3c9793['offset']=qs[_0xe562('0x1f')](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x1f')]);}_0x3c9793[_0xe562('0x37')]=qs['sort'](_0x53f9b6[_0xe562('0x2f')][_0xe562('0x38')]);_0x3c9793[_0xe562('0x39')]=qs[_0xe562('0x30')](_[_0xe562('0x3a')](_0x53f9b6[_0xe562('0x2f')],_0x2e44da['filters']),_0x4858a9);if(_0x53f9b6[_0xe562('0x2f')][_0xe562('0x3b')]){_0x3c9793[_0xe562('0x39')]=_[_0xe562('0x3c')](_0x3c9793[_0xe562('0x39')],{'$or':_[_0xe562('0x29')](_0x4858a9,function(_0x23dd0e){if(_0x23dd0e['type']!==_0xe562('0x3d')){var _0x14d524={};_0x14d524[_0x23dd0e[_0xe562('0x27')]]={'$like':'%'+_0x53f9b6[_0xe562('0x2f')]['filter']+'%'};return _0x14d524;}})});}_0x3c9793=_['merge']({},_0x3c9793,_0x53f9b6[_0xe562('0x3e')]);var _0x1871d7={'where':_0x3c9793[_0xe562('0x39')]};return db['VoiceRecording']['count'](_0x1871d7)['then'](function(_0x458258){_0x310885[_0xe562('0x1e')]=_0x458258;if(_0x53f9b6[_0xe562('0x2f')][_0xe562('0x3f')]){_0x3c9793[_0xe562('0x40')]=[{'all':!![]}];}return db[_0xe562('0x2a')][_0xe562('0x41')](_0x3c9793);})['then'](function(_0x52bd42){_0x310885[_0xe562('0x42')]=_0x52bd42;return _0x310885;})[_0xe562('0x24')](respondWithFilteredResult(_0x178191,_0x3c9793))[_0xe562('0x43')](handleError(_0x178191,null));};exports['show']=function(_0x54d94f,_0x3f1fe0){var _0x12cacc={'raw':![],'where':{'id':_0x54d94f['params']['id']}},_0x4e5e57={};_0x4e5e57['model']=_[_0xe562('0x2e')](db[_0xe562('0x2a')]['rawAttributes']);_0x4e5e57[_0xe562('0x2f')]=_['keys'](_0x54d94f[_0xe562('0x2f')]);_0x4e5e57['filters']=_[_0xe562('0x31')](_0x4e5e57[_0xe562('0x35')],_0x4e5e57[_0xe562('0x2f')]);_0x12cacc['attributes']=_['intersection'](_0x4e5e57['model'],qs[_0xe562('0x33')](_0x54d94f[_0xe562('0x2f')][_0xe562('0x33')]));_0x12cacc[_0xe562('0x32')]=_0x12cacc[_0xe562('0x32')][_0xe562('0x34')]?_0x12cacc[_0xe562('0x32')]:_0x4e5e57[_0xe562('0x35')];if(_0x54d94f[_0xe562('0x2f')][_0xe562('0x3f')]){_0x12cacc['include']=[{'all':!![]}];}_0x12cacc=_[_0xe562('0x3c')]({},_0x12cacc,_0x54d94f[_0xe562('0x3e')]);return db[_0xe562('0x2a')][_0xe562('0x44')](_0x12cacc)[_0xe562('0x24')](handleEntityNotFound(_0x3f1fe0,null))[_0xe562('0x24')](respondWithResult(_0x3f1fe0,null))['catch'](handleError(_0x3f1fe0,null));};exports[_0xe562('0x45')]=function(_0x4d3830,_0x4c1b9a){return db[_0xe562('0x2a')]['create'](_0x4d3830[_0xe562('0x46')],{})[_0xe562('0x24')](respondWithResult(_0x4c1b9a,0xc9))['catch'](handleError(_0x4c1b9a,null));};exports[_0xe562('0x47')]=function(_0x301854,_0x26b5df){if(_0x301854[_0xe562('0x46')]['id']){delete _0x301854[_0xe562('0x46')]['id'];}return db[_0xe562('0x2a')]['find']({'where':{'id':_0x301854[_0xe562('0x48')]['id']}})[_0xe562('0x24')](handleEntityNotFound(_0x26b5df,null))[_0xe562('0x24')](saveUpdates(_0x301854['body'],null))[_0xe562('0x24')](respondWithResult(_0x26b5df,null))[_0xe562('0x43')](handleError(_0x26b5df,null));};exports['describe']=function(_0x1a272f,_0x5dd511){return db[_0xe562('0x2a')][_0xe562('0x49')]()[_0xe562('0x24')](respondWithResult(_0x5dd511,null))['catch'](handleError(_0x5dd511,null));};exports[_0xe562('0x4a')]=function(_0x3c8dc3,_0x1e3979,_0x302da4){var _0x17a457=require(_0xe562('0x4b'));var _0x3aec97=![];var _0x4b5e49={};if(_0x3c8dc3['query']['type']&&_0x3c8dc3['query']['type']===_0xe562('0x4c')){_0x4b5e49[_0xe562('0x4c')]=_0x3c8dc3['params']['id'];}else{_0x4b5e49['id']=_0x3c8dc3[_0xe562('0x48')]['id'];}return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':_0x4b5e49,'attributes':['id',_0xe562('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x1e3979,null))[_0xe562('0x24')](function(_0x388ca1){if(_0x388ca1){var _0x1dbc9f=_0x388ca1[_0xe562('0x4d')];var _0x3b63a5=util[_0xe562('0x4e')]('%s.cypher',_0x1dbc9f);if(fs[_0xe562('0x4f')](_0x3b63a5)){_0x3aec97=!![];return _0x17a457[_0xe562('0x50')](_0x3b63a5,_0x1dbc9f,config['secrets'][_0xe562('0x51')])['then'](function(){return _0x388ca1;});}return _0x388ca1;}})[_0xe562('0x24')](function(_0x1a036c){if(_0x1a036c){var _0x26dc58=_0x1a036c[_0xe562('0x4d')];if(!fs[_0xe562('0x4f')](_0x26dc58)){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x1a036c[_0xe562('0x54')]){return _0x1e3979[_0xe562('0x4a')](_0x26dc58,_0x1a036c[_0xe562('0x54')]+path[_0xe562('0x55')](_0x26dc58),function(){if(_0x3aec97){fs[_0xe562('0x56')](_0x26dc58);}});}else{return _0x1e3979['download'](_0x26dc58,function(_0x4612b0){if(_0x3aec97){fs[_0xe562('0x56')](_0x26dc58);}});}}})[_0xe562('0x43')](function(_0x213313){if(_0x213313['message']==='VoiceRecording\x20not\x20found'){_0x1e3979[_0xe562('0x1a')](0x194)[_0xe562('0x57')](_0xe562('0x58'));}else{return handleError(_0x1e3979,null);}});};exports[_0xe562('0x59')]=function(_0xe96e7d,_0x32978a,_0x35a0ff){var _0xdb2efc=require(_0xe562('0x4b'));var _0x549ed7=![];var _0x58b205={'$and':[db[_0xe562('0x5a')][_0xe562('0x39')](db[_0xe562('0x5a')]['fn']('MD5',db[_0xe562('0x5a')][_0xe562('0x5b')](_0xe562('0x4c'))),_0xe96e7d['query'][_0xe562('0x5c')])]};if(_0xe96e7d[_0xe562('0x2f')][_0xe562('0x2c')]&&_0xe96e7d['query'][_0xe562('0x2c')]===_0xe562('0x4c')){_0x58b205[_0xe562('0x5d')][_0xe562('0x5e')]({'uniqueid':_0xe96e7d[_0xe562('0x48')]['id']});}else{_0x58b205[_0xe562('0x5d')][_0xe562('0x5e')]({'id':_0xe96e7d['params']['id']});}return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':_0x58b205,'attributes':['id','value'],'raw':!![]})[_0xe562('0x24')](handleEntityNotFound(_0x32978a,null))['then'](function(_0x14facd){if(_0x14facd){var _0x350f6c=util[_0xe562('0x4e')](_0xe562('0x5f'),_0x14facd[_0xe562('0x4d')]);if(fs['existsSync'](_0x350f6c)){_0x549ed7=!![];return _0xdb2efc['decryptFile'](_0x350f6c,_0x14facd[_0xe562('0x4d')],config[_0xe562('0x60')][_0xe562('0x51')])['then'](function(){return _0x14facd;});}return _0x14facd;}})['then'](function(_0xecc703){if(_0xecc703){if(!fs[_0xe562('0x4f')](_0xecc703[_0xe562('0x4d')])){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))](_0xe562('0x61'));}if(_0xecc703[_0xe562('0x54')]){return _0x32978a[_0xe562('0x4a')](_0xecc703[_0xe562('0x4d')],_0xecc703[_0xe562('0x54')]+path[_0xe562('0x55')](_0xecc703[_0xe562('0x4d')]),function(){if(_0x549ed7){fs[_0xe562('0x56')](_0xecc703[_0xe562('0x4d')]);}});}else{return _0x32978a[_0xe562('0x4a')](_0xecc703['value'],function(_0x440dd4){if(_0x549ed7){fs[_0xe562('0x56')](_0xecc703[_0xe562('0x4d')]);}});}}})[_0xe562('0x43')](handleError(_0x32978a,null));};exports[_0xe562('0x62')]=function(_0x1079f7,_0x1f079f){return db[_0xe562('0x2a')][_0xe562('0x44')]({'where':{'id':_0x1079f7['params']['id']}})['then'](function(_0x30a88b){if(_[_0xe562('0x63')](_0x30a88b)){throw new ReferenceError(_0xe562('0x64'));}return _0x30a88b;})[_0xe562('0x24')](function(_0x2c5216){var _0x2fa7b5=_0x2c5216[_0xe562('0x4d')];logger['info'](_0xe562('0x65'),_0x2fa7b5);if(!_[_0xe562('0x63')](_0x2c5216[_0xe562('0x4d')])&&fs['existsSync'](_0x2fa7b5)){logger['info'](_0xe562('0x66')+_0x2fa7b5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe562('0x67')](_0x2fa7b5);}_0x2fa7b5=_0x2fa7b5+_0xe562('0x68');if(!_[_0xe562('0x63')](_0x2c5216['value'])&&fs[_0xe562('0x4f')](_0x2fa7b5)){logger[_0xe562('0x69')](_0xe562('0x66')+_0x2fa7b5+_0xe562('0x6a'));fs[_0xe562('0x67')](_0x2fa7b5);}return _0x2c5216;})[_0xe562('0x24')](function(_0x524081){if(!_0x524081)throw new InternalError();return _0x524081[_0xe562('0x62')]();})[_0xe562('0x24')](function(){_0x1f079f[_0xe562('0x1a')](0xcc)[_0xe562('0x1b')]();})[_0xe562('0x43')](handleError(_0x1f079f,null));};function getBucketslist(_0x540652,_0x327211,_0xe5fc5e){return new Promise(function(_0xa729cb,_0x40b674){var _0x2eaaef=new AWS['S3']({'accessKeyId':_0x327211,'secretAccessKey':_0x540652,'region':_0xe5fc5e});_0x2eaaef[_0xe562('0x6b')]({},function(_0x5b46c8,_0x4da312){if(_0x5b46c8){return _0x40b674(_0x5b46c8);}else{return _0xa729cb(_0x4da312);}});});}function createBucket(_0x1064fd,_0x19f03b,_0x513810,_0x23a285){return new Promise(function(_0x4d3142,_0x215d63){var _0x350a8d=new AWS['S3']({'accessKeyId':_0x19f03b,'secretAccessKey':_0x1064fd,'region':_0x513810});_0x350a8d[_0xe562('0x6c')]({'Bucket':_0x23a285},function(_0x5e1f98,_0x4243d9){if(_0x5e1f98){return _0x215d63(_0x5e1f98);}else{return _0x4d3142(_0x4243d9);}});});}function uploadFile(_0x167d88,_0x2545c7,_0x297849,_0x1d01d0,_0x115648,_0x2d6900){return new Promise(function(_0x3dcabb,_0x4458ff){var _0xf2621=new AWS['S3']({'accessKeyId':_0x2545c7,'secretAccessKey':_0x167d88,'region':_0x297849});_0xf2621[_0xe562('0x6d')]({'Bucket':_0x1d01d0,'Key':_0x115648,'Body':_0x2d6900},function(_0x356d42,_0x476c82){if(_0x356d42){return _0x4458ff(_0x356d42);}else{return _0x3dcabb(_0x476c82);}});});}function startTranscribe(_0x451fcf,_0x287cda,_0x1c901c,_0x4cf2f0,_0x438610,_0x4f2140){return new Promise(function(_0x423667,_0x56db79){var _0x57cb05=new AWS[(_0xe562('0x6e'))]({'accessKeyId':_0x287cda,'secretAccessKey':_0x451fcf,'region':_0x1c901c});_0x57cb05[_0xe562('0x6f')]({'TranscriptionJobName':_0x4cf2f0,'LanguageCode':_0x438610,'Media':{'MediaFileUri':_0x4f2140}},function(_0x1e8f5e,_0x14d232){if(_0x1e8f5e){return _0x56db79(_0x1e8f5e);}else{return _0x423667(_0x14d232);}});});}function transcribe(_0x2dfeef,_0x12466d,_0x37f886,_0x1e3111,_0x483cd8,_0xb8c4f4,_0x40a39d){return new Promise(function(_0x5209fc,_0x19d3e3){var _0x4e2415={};logger[_0xe562('0x69')](util['format'](_0xe562('0x70'),_0x2dfeef,_0x483cd8));return uploadFile(_0x12466d,_0x37f886,_0x1e3111,_0x483cd8,path['basename'](_0xb8c4f4),fs[_0xe562('0x71')](_0xb8c4f4))[_0xe562('0x24')](function(_0x366d9c){logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x72'),_0x2dfeef,_0x483cd8,_0x366d9c[_0xe562('0x73')]));_0x4e2415[_0xe562('0x74')]=_0x366d9c[_0xe562('0x75')];_0x4e2415[_0xe562('0x76')]=_0x366d9c[_0xe562('0x73')];logger['info'](util[_0xe562('0x4e')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2dfeef));return startTranscribe(_0x12466d,_0x37f886,_0x1e3111,uuidv4(),_0x40a39d,_0x366d9c[_0xe562('0x73')]);})[_0xe562('0x24')](function(_0x2e8007){logger[_0xe562('0x69')](util['format'](_0xe562('0x77'),_0x2dfeef,_0x2e8007[_0xe562('0x78')][_0xe562('0x79')]));_0x4e2415[_0xe562('0x7a')]=_0x2e8007[_0xe562('0x78')]['TranscriptionJobName'];_0x4e2415[_0xe562('0x7b')]=_0x2e8007[_0xe562('0x78')][_0xe562('0x7c')];return _0x5209fc(_0x4e2415);})['catch'](function(_0x549c52){return _0x19d3e3(_0x549c52);});});}exports['runTranscribe']=function(_0x4b5683,_0x185d66,_0x536538){var _0x3d71d8;var _0xdcd780;var _0x3820c1;var _0x15ad9d=require(_0xe562('0x4b'));return db[_0xe562('0x2a')][_0xe562('0x7d')]({'where':{'id':_0x4b5683[_0xe562('0x48')]['id']}})[_0xe562('0x24')](function(_0x34e587){if(_0x34e587){var _0x8853ca=util[_0xe562('0x4e')]('%s.cypher',_0x34e587[_0xe562('0x4d')]);if(fs[_0xe562('0x4f')](_0x8853ca)){cypher=!![];return _0x15ad9d['decryptFile'](_0x8853ca,_0x34e587['value'],config[_0xe562('0x60')]['recording'])[_0xe562('0x24')](function(){return _0x34e587;});}return _0x34e587;}})[_0xe562('0x24')](function(_0x78f314){if(!_0x78f314){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Voice\x20Recording\x20not\x20found');}_0xdcd780=_0x78f314;return db[_0xe562('0x7e')][_0xe562('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x185d66,null))[_0xe562('0x24')](function(_0x2229fd){if(_0x2229fd){_0x3d71d8=_0x2229fd;if(!_0x3d71d8[_0xe562('0x7f')]||!_0x3d71d8['transcribeAccountId']||!_0x3d71d8[_0xe562('0x80')]||!_0x3d71d8[_0xe562('0x81')]||!_0x3d71d8[_0xe562('0x74')]){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Transcribe\x20not\x20configured');}if(_0x4b5683['body']['runSentiment']&&(!_0x3d71d8['sentiment']||!_0x3d71d8[_0xe562('0x82')]||!_0x3d71d8[_0xe562('0x83')]||!_0x3d71d8[_0xe562('0x81')]||!_0x3d71d8['bucket'])){throw new db['Sequelize'][(_0xe562('0x53'))](_0xe562('0x84'));}return db[_0xe562('0x85')][_0xe562('0x7d')]({'where':{'id':_0x3d71d8[_0xe562('0x86')]}});}})['then'](function(_0x23db46){if(!_0x23db46){throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x23db46['data1']||!_0x23db46[_0xe562('0x87')]){throw new db['Sequelize'][(_0xe562('0x53'))](_0xe562('0x88'));}_0x3820c1=_0x23db46;return getBucketslist(_0x3820c1['data1'],_0x3820c1[_0xe562('0x87')],_0x3d71d8['transcribeRegion']);})['then'](function(_0x4b2352){if(_0x4b2352&&_0x4b2352[_0xe562('0x89')]){var _0x2e0d7f=_[_0xe562('0x44')](_0x4b2352['Buckets'],function(_0x5b3c36){return _0x5b3c36['Name']===_0x3d71d8[_0xe562('0x74')];});if(!_0x2e0d7f){logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x8a'),_0x4b5683[_0xe562('0x48')]['id'],_0x3d71d8[_0xe562('0x74')]));return createBucket(_0x3820c1['data1'],_0x3820c1[_0xe562('0x87')],_0x3d71d8[_0xe562('0x80')],_0x3d71d8[_0xe562('0x74')]);}logger[_0xe562('0x69')](util[_0xe562('0x4e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4b5683[_0xe562('0x48')]['id'],_0x3d71d8[_0xe562('0x74')]));return;}})['then'](function(_0x666a12){if(_0xdcd780[_0xe562('0x7b')]===_0xe562('0x8b')){return transcribe(_0x4b5683[_0xe562('0x48')]['id'],_0x3820c1[_0xe562('0x8c')],_0x3820c1[_0xe562('0x87')],_0x3d71d8['transcribeRegion'],_0x3d71d8[_0xe562('0x74')],_0xdcd780['value'],_0x3d71d8[_0xe562('0x81')]);}else{logger[_0xe562('0x69')](util[_0xe562('0x4e')](_0xe562('0x8d'),_0x4b5683[_0xe562('0x48')]['id']));return{'transcribeStatus':_0xe562('0x8e')};}})[_0xe562('0x24')](function(_0x105482){if(_0x105482){_0x105482[_0xe562('0x8f')]=_0x4b5683[_0xe562('0x46')]['runSentiment'];return _0xdcd780[_0xe562('0x90')](_0x105482);}})[_0xe562('0x24')](respondWithResult(_0x185d66,null))[_0xe562('0x43')](handleError(_0x185d66,null));};function writeFile(_0x376fe6,_0x1f1ab5){return new Promise(function(_0x4447ed,_0x132863){fs['writeFile'](_0x1f1ab5,_0x376fe6,function(_0x321793,_0x3181e9){if(_0x321793){return _0x132863(_0x321793);}else{return _0x4447ed(_0x3181e9);}});});}exports[_0xe562('0x91')]=function(_0x12c3a3,_0x53f2dd,_0x343113){return db[_0xe562('0x2a')][_0xe562('0x7d')]({'where':{'id':_0x12c3a3[_0xe562('0x48')]['id']}})[_0xe562('0x24')](handleEntityNotFound(_0x53f2dd))[_0xe562('0x24')](function(_0x50e7fb){if(_0x50e7fb&&_0x50e7fb['fileText']){var _0x561de2=_0x50e7fb[_0xe562('0x92')];var _0x1c159b=config[_0xe562('0x93')]+_0xe562('0x94')+_0x50e7fb['id']+_0xe562('0x95');if(fs[_0xe562('0x4f')](_0x1c159b)){return _0x1c159b;}return writeFile(_0x561de2,_0x1c159b)[_0xe562('0x24')](function(){return _0x1c159b;});}else{throw new db[(_0xe562('0x52'))][(_0xe562('0x53'))](_0xe562('0x96'));}})[_0xe562('0x24')](function(_0x354dbf){return _0x53f2dd[_0xe562('0x4a')](_0x354dbf);})[_0xe562('0x43')](handleError(_0x53f2dd));}; \ No newline at end of file +var _0xcac1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','save','then','destroy','error','stack','map','VoiceRecording','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','hasOwnProperty','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','params','find','create','body','update','describe','download','type','uniqueid','value','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','downloads','../../components/encryptor','MD5','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','jsforce','desk.js','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x24a1e7,_0x299190){var _0x24c3b4=function(_0x4f8206){while(--_0x4f8206){_0x24a1e7['push'](_0x24a1e7['shift']());}};_0x24c3b4(++_0x299190);}(_0xcac1,0x1ac));var _0x1cac=function(_0x3d6ac0,_0x1c52e2){_0x3d6ac0=_0x3d6ac0-0x0;var _0x359130=_0xcac1[_0x3d6ac0];return _0x359130;};'use strict';var emlformat=require(_0x1cac('0x0'));var rimraf=require(_0x1cac('0x1'));var zipdir=require(_0x1cac('0x2'));var jsonpatch=require(_0x1cac('0x3'));var rp=require(_0x1cac('0x4'));var moment=require('moment');var BPromise=require(_0x1cac('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1cac('0x6'));var csv=require('to-csv');var ejs=require(_0x1cac('0x7'));var fs=require('fs');var fs_extra=require(_0x1cac('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1cac('0x9'));var deskjs=require(_0x1cac('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var AWS=require(_0x1cac('0xb'));var uuidv4=require(_0x1cac('0xc'));var Redis=require('ioredis');var authService=require(_0x1cac('0xd'));var qs=require(_0x1cac('0xe'));var as=require(_0x1cac('0xf'));var hardwareService=require(_0x1cac('0x10'));var logger=require(_0x1cac('0x11'))(_0x1cac('0x12'));var utils=require(_0x1cac('0x13'));var config=require(_0x1cac('0x14'));var licenseUtil=require(_0x1cac('0x15'));var db=require(_0x1cac('0x16'))['db'];function respondWithStatusCode(_0x28c3e8,_0x253c39){_0x253c39=_0x253c39||0xcc;return function(_0x4a5b5c){if(_0x4a5b5c){return _0x28c3e8[_0x1cac('0x17')](_0x253c39);}return _0x28c3e8['status'](_0x253c39)[_0x1cac('0x18')]();};}function respondWithResult(_0x5a8979,_0x4f60f0){_0x4f60f0=_0x4f60f0||0xc8;return function(_0x5acea8){if(_0x5acea8){return _0x5a8979[_0x1cac('0x19')](_0x4f60f0)['json'](_0x5acea8);}};}function respondWithFilteredResult(_0x46e4bc,_0x443ab0){return function(_0x107b11){if(_0x107b11){var _0x16d01c=typeof _0x443ab0[_0x1cac('0x1a')]===_0x1cac('0x1b')&&typeof _0x443ab0['limit']===_0x1cac('0x1b');var _0x55c9d9=_0x107b11['count'];var _0x8050e2=_0x16d01c?0x0:_0x443ab0[_0x1cac('0x1a')];var _0x1ea5c4=_0x16d01c?_0x107b11[_0x1cac('0x1c')]:_0x443ab0['offset']+_0x443ab0[_0x1cac('0x1d')];var _0x5d9792;if(_0x1ea5c4>=_0x55c9d9){_0x1ea5c4=_0x55c9d9;_0x5d9792=0xc8;}else{_0x5d9792=0xce;}_0x46e4bc[_0x1cac('0x19')](_0x5d9792);return _0x46e4bc[_0x1cac('0x1e')]('Content-Range',_0x8050e2+'-'+_0x1ea5c4+'/'+_0x55c9d9)[_0x1cac('0x1f')](_0x107b11);}return null;};}function patchUpdates(_0x5b96b5){return function(_0x5c3d0f){try{jsonpatch[_0x1cac('0x20')](_0x5c3d0f,_0x5b96b5,!![]);}catch(_0x5a0584){return BPromise[_0x1cac('0x21')](_0x5a0584);}return _0x5c3d0f[_0x1cac('0x22')]();};}function saveUpdates(_0x22ccf2,_0x567c70){return function(_0x128e1f){if(_0x128e1f){return _0x128e1f['update'](_0x22ccf2)[_0x1cac('0x23')](function(_0x4d5455){return _0x4d5455;});}return null;};}function removeEntity(_0x3d5322,_0x3b5657){return function(_0x5de258){if(_0x5de258){return _0x5de258[_0x1cac('0x24')]()[_0x1cac('0x23')](function(){_0x3d5322[_0x1cac('0x19')](0xcc)[_0x1cac('0x18')]();});}};}function handleEntityNotFound(_0x1495b6,_0x5296d7){return function(_0x48dd50){if(!_0x48dd50){_0x1495b6[_0x1cac('0x17')](0x194);}return _0x48dd50;};}function handleError(_0x27e4ba,_0x25580a){_0x25580a=_0x25580a||0x1f4;return function(_0x37e9c6){logger[_0x1cac('0x25')](_0x37e9c6[_0x1cac('0x26')]);if(_0x37e9c6['name']){delete _0x37e9c6['name'];}_0x27e4ba['status'](_0x25580a)['send'](_0x37e9c6);};}exports['index']=function(_0x53ccb6,_0x32dedd){var _0x12586b={},_0x5b86d5={},_0x3718ac={'count':0x0,'rows':[]};var _0x11af0a=_[_0x1cac('0x27')](db[_0x1cac('0x28')][_0x1cac('0x29')],function(_0x1852e9){return{'name':_0x1852e9[_0x1cac('0x2a')],'type':_0x1852e9['type'][_0x1cac('0x2b')]};});_0x5b86d5[_0x1cac('0x2c')]=_['differenceBy'](_[_0x1cac('0x27')](_0x11af0a,_0x1cac('0x2d')),['format']);_0x5b86d5[_0x1cac('0x2e')]=_[_0x1cac('0x2f')](_0x53ccb6[_0x1cac('0x2e')]);_0x5b86d5['filters']=_[_0x1cac('0x30')](_0x5b86d5[_0x1cac('0x2c')],_0x5b86d5[_0x1cac('0x2e')]);_0x12586b['attributes']=_[_0x1cac('0x30')](_0x5b86d5['model'],qs[_0x1cac('0x31')](_0x53ccb6[_0x1cac('0x2e')]['fields']));_0x12586b[_0x1cac('0x32')]=_0x12586b[_0x1cac('0x32')]['length']?_0x12586b[_0x1cac('0x32')]:_0x5b86d5[_0x1cac('0x2c')];if(!_0x53ccb6[_0x1cac('0x2e')][_0x1cac('0x33')]('nolimit')){_0x12586b[_0x1cac('0x1d')]=qs[_0x1cac('0x1d')](_0x53ccb6[_0x1cac('0x2e')]['limit']);_0x12586b[_0x1cac('0x1a')]=qs[_0x1cac('0x1a')](_0x53ccb6['query']['offset']);}_0x12586b['order']=qs[_0x1cac('0x34')](_0x53ccb6[_0x1cac('0x2e')][_0x1cac('0x34')]);_0x12586b['where']=qs[_0x1cac('0x35')](_[_0x1cac('0x36')](_0x53ccb6[_0x1cac('0x2e')],_0x5b86d5['filters']),_0x11af0a);if(_0x53ccb6['query'][_0x1cac('0x37')]){_0x12586b['where']=_[_0x1cac('0x38')](_0x12586b['where'],{'$or':_[_0x1cac('0x27')](_0x11af0a,function(_0x5265de){if(_0x5265de['type']!==_0x1cac('0x39')){var _0x4abb95={};_0x4abb95[_0x5265de[_0x1cac('0x2d')]]={'$like':'%'+_0x53ccb6['query']['filter']+'%'};return _0x4abb95;}})});}_0x12586b=_[_0x1cac('0x38')]({},_0x12586b,_0x53ccb6[_0x1cac('0x3a')]);var _0x3e4b87={'where':_0x12586b[_0x1cac('0x3b')]};return db[_0x1cac('0x28')]['count'](_0x3e4b87)['then'](function(_0x24bccc){_0x3718ac['count']=_0x24bccc;if(_0x53ccb6[_0x1cac('0x2e')][_0x1cac('0x3c')]){_0x12586b[_0x1cac('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x1cac('0x3e')](_0x12586b);})[_0x1cac('0x23')](function(_0x1d502d){_0x3718ac[_0x1cac('0x3f')]=_0x1d502d;return _0x3718ac;})[_0x1cac('0x23')](respondWithFilteredResult(_0x32dedd,_0x12586b))[_0x1cac('0x40')](handleError(_0x32dedd,null));};exports['show']=function(_0x12bdbf,_0x5ed394){var _0x2f9966={'raw':![],'where':{'id':_0x12bdbf[_0x1cac('0x41')]['id']}},_0x467040={};_0x467040[_0x1cac('0x2c')]=_[_0x1cac('0x2f')](db['VoiceRecording'][_0x1cac('0x29')]);_0x467040[_0x1cac('0x2e')]=_[_0x1cac('0x2f')](_0x12bdbf[_0x1cac('0x2e')]);_0x467040['filters']=_[_0x1cac('0x30')](_0x467040[_0x1cac('0x2c')],_0x467040[_0x1cac('0x2e')]);_0x2f9966['attributes']=_[_0x1cac('0x30')](_0x467040[_0x1cac('0x2c')],qs[_0x1cac('0x31')](_0x12bdbf[_0x1cac('0x2e')][_0x1cac('0x31')]));_0x2f9966[_0x1cac('0x32')]=_0x2f9966[_0x1cac('0x32')]['length']?_0x2f9966[_0x1cac('0x32')]:_0x467040['model'];if(_0x12bdbf[_0x1cac('0x2e')]['includeAll']){_0x2f9966[_0x1cac('0x3d')]=[{'all':!![]}];}_0x2f9966=_[_0x1cac('0x38')]({},_0x2f9966,_0x12bdbf[_0x1cac('0x3a')]);return db[_0x1cac('0x28')][_0x1cac('0x42')](_0x2f9966)[_0x1cac('0x23')](handleEntityNotFound(_0x5ed394,null))['then'](respondWithResult(_0x5ed394,null))['catch'](handleError(_0x5ed394,null));};exports['create']=function(_0x4c1d76,_0x162265){return db[_0x1cac('0x28')][_0x1cac('0x43')](_0x4c1d76[_0x1cac('0x44')],{})['then'](respondWithResult(_0x162265,0xc9))['catch'](handleError(_0x162265,null));};exports[_0x1cac('0x45')]=function(_0x3d7e32,_0x3f9744){if(_0x3d7e32[_0x1cac('0x44')]['id']){delete _0x3d7e32[_0x1cac('0x44')]['id'];}return db[_0x1cac('0x28')][_0x1cac('0x42')]({'where':{'id':_0x3d7e32[_0x1cac('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f9744,null))[_0x1cac('0x23')](saveUpdates(_0x3d7e32[_0x1cac('0x44')],null))[_0x1cac('0x23')](respondWithResult(_0x3f9744,null))[_0x1cac('0x40')](handleError(_0x3f9744,null));};exports[_0x1cac('0x46')]=function(_0x2331a1,_0xfb36f6){return db[_0x1cac('0x28')][_0x1cac('0x46')]()[_0x1cac('0x23')](respondWithResult(_0xfb36f6,null))[_0x1cac('0x40')](handleError(_0xfb36f6,null));};exports[_0x1cac('0x47')]=function(_0x1d13f9,_0x353ca1,_0x559115){var _0x2dc31d=require('../../components/encryptor');var _0x4dd0dd=![];var _0x347a90={};if(_0x1d13f9[_0x1cac('0x2e')][_0x1cac('0x48')]&&_0x1d13f9[_0x1cac('0x2e')][_0x1cac('0x48')]===_0x1cac('0x49')){_0x347a90['uniqueid']=_0x1d13f9[_0x1cac('0x41')]['id'];}else{_0x347a90['id']=_0x1d13f9[_0x1cac('0x41')]['id'];}return db[_0x1cac('0x28')][_0x1cac('0x42')]({'where':_0x347a90,'attributes':['id',_0x1cac('0x4a')],'raw':!![]})[_0x1cac('0x23')](handleEntityNotFound(_0x353ca1,null))[_0x1cac('0x23')](function(_0x1e9b8c){if(_0x1e9b8c){var _0x36d60a=_0x1e9b8c[_0x1cac('0x4a')];var _0x1f456d=util[_0x1cac('0x4b')](_0x1cac('0x4c'),_0x36d60a);if(fs[_0x1cac('0x4d')](_0x1f456d)){_0x4dd0dd=!![];return _0x2dc31d[_0x1cac('0x4e')](_0x1f456d,_0x36d60a,config['secrets'][_0x1cac('0x4f')])['then'](function(){return _0x1e9b8c;});}return _0x1e9b8c;}})[_0x1cac('0x23')](function(_0x1b71cb){if(_0x1b71cb){var _0x5d2568=_0x1b71cb['value'];if(!fs[_0x1cac('0x4d')](_0x5d2568)){throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))]('VoiceRecording\x20not\x20found');}if(_0x1b71cb[_0x1cac('0x52')]){return _0x353ca1[_0x1cac('0x47')](_0x5d2568,_0x1b71cb['filename']+path[_0x1cac('0x53')](_0x5d2568),function(){if(_0x4dd0dd){fs[_0x1cac('0x54')](_0x5d2568);}});}else{return _0x353ca1['download'](_0x5d2568,function(_0xc45f54){if(_0x4dd0dd){fs[_0x1cac('0x54')](_0x5d2568);}});}}})[_0x1cac('0x40')](function(_0x2ccaf6){if(_0x2ccaf6[_0x1cac('0x55')]===_0x1cac('0x56')){_0x353ca1[_0x1cac('0x19')](0x194)[_0x1cac('0x57')](_0x1cac('0x58'));}else{return handleError(_0x353ca1,null);}});};exports[_0x1cac('0x59')]=function(_0x178f9e,_0x14fed7,_0x2f432d){var _0xb0cb4b=require(_0x1cac('0x5a'));var _0x9b0c59=![];var _0x54dd0d={'$and':[db['sequelize'][_0x1cac('0x3b')](db['sequelize']['fn'](_0x1cac('0x5b'),db['sequelize']['col'](_0x1cac('0x49'))),_0x178f9e[_0x1cac('0x2e')]['token'])]};if(_0x178f9e[_0x1cac('0x2e')][_0x1cac('0x48')]&&_0x178f9e[_0x1cac('0x2e')][_0x1cac('0x48')]===_0x1cac('0x49')){_0x54dd0d[_0x1cac('0x5c')][_0x1cac('0x5d')]({'uniqueid':_0x178f9e['params']['id']});}else{_0x54dd0d[_0x1cac('0x5c')][_0x1cac('0x5d')]({'id':_0x178f9e['params']['id']});}return db['VoiceRecording'][_0x1cac('0x42')]({'where':_0x54dd0d,'attributes':['id',_0x1cac('0x4a')],'raw':!![]})[_0x1cac('0x23')](handleEntityNotFound(_0x14fed7,null))[_0x1cac('0x23')](function(_0x531fcd){if(_0x531fcd){var _0x10f809=util['format'](_0x1cac('0x4c'),_0x531fcd[_0x1cac('0x4a')]);if(fs[_0x1cac('0x4d')](_0x10f809)){_0x9b0c59=!![];return _0xb0cb4b[_0x1cac('0x4e')](_0x10f809,_0x531fcd[_0x1cac('0x4a')],config[_0x1cac('0x5e')]['recording'])[_0x1cac('0x23')](function(){return _0x531fcd;});}return _0x531fcd;}})[_0x1cac('0x23')](function(_0x2890b2){if(_0x2890b2){if(!fs[_0x1cac('0x4d')](_0x2890b2[_0x1cac('0x4a')])){throw new db['Sequelize']['ValidationError'](_0x1cac('0x56'));}if(_0x2890b2[_0x1cac('0x52')]){return _0x14fed7['download'](_0x2890b2[_0x1cac('0x4a')],_0x2890b2[_0x1cac('0x52')]+path[_0x1cac('0x53')](_0x2890b2[_0x1cac('0x4a')]),function(){if(_0x9b0c59){fs[_0x1cac('0x54')](_0x2890b2['value']);}});}else{return _0x14fed7[_0x1cac('0x47')](_0x2890b2[_0x1cac('0x4a')],function(_0x59497b){if(_0x9b0c59){fs[_0x1cac('0x54')](_0x2890b2['value']);}});}}})['catch'](handleError(_0x14fed7,null));};exports['destroy']=function(_0x48472c,_0x49300e){return db[_0x1cac('0x28')]['find']({'where':{'id':_0x48472c[_0x1cac('0x41')]['id']}})[_0x1cac('0x23')](function(_0x14d6b2){if(_[_0x1cac('0x5f')](_0x14d6b2)){throw new ReferenceError(_0x1cac('0x60'));}return _0x14d6b2;})[_0x1cac('0x23')](function(_0x5e44d2){var _0x2f237b=_0x5e44d2['value'];logger[_0x1cac('0x61')](_0x1cac('0x62'),_0x2f237b);if(!_[_0x1cac('0x5f')](_0x5e44d2[_0x1cac('0x4a')])&&fs['existsSync'](_0x2f237b)){logger['info'](_0x1cac('0x63')+_0x2f237b+_0x1cac('0x64'));fs[_0x1cac('0x65')](_0x2f237b);}_0x2f237b=_0x2f237b+_0x1cac('0x66');if(!_[_0x1cac('0x5f')](_0x5e44d2[_0x1cac('0x4a')])&&fs[_0x1cac('0x4d')](_0x2f237b)){logger['info']('File:\x20\x22'+_0x2f237b+_0x1cac('0x64'));fs[_0x1cac('0x65')](_0x2f237b);}return _0x5e44d2;})[_0x1cac('0x23')](function(_0x53830c){if(!_0x53830c)throw new InternalError();return _0x53830c['destroy']();})[_0x1cac('0x23')](function(){_0x49300e[_0x1cac('0x19')](0xcc)[_0x1cac('0x18')]();})[_0x1cac('0x40')](handleError(_0x49300e,null));};function getBucketslist(_0x5d2c64,_0x56dcda,_0x4e9d61){return new Promise(function(_0x4a5f45,_0x4e652a){var _0x430fd0=new AWS['S3']({'accessKeyId':_0x56dcda,'secretAccessKey':_0x5d2c64,'region':_0x4e9d61});_0x430fd0['listBuckets']({},function(_0x2f4f4f,_0x13e4a7){if(_0x2f4f4f){return _0x4e652a(_0x2f4f4f);}else{return _0x4a5f45(_0x13e4a7);}});});}function createBucket(_0x408e68,_0x165af8,_0x4e7a5f,_0x2c5497){return new Promise(function(_0x2c1813,_0x2ebc1f){var _0xb33f7f=new AWS['S3']({'accessKeyId':_0x165af8,'secretAccessKey':_0x408e68,'region':_0x4e7a5f});_0xb33f7f[_0x1cac('0x67')]({'Bucket':_0x2c5497},function(_0x2c6936,_0x450312){if(_0x2c6936){return _0x2ebc1f(_0x2c6936);}else{return _0x2c1813(_0x450312);}});});}function uploadFile(_0x2e5f15,_0x38930b,_0x99a4b1,_0x3e9169,_0x551420,_0x2d22d5){return new Promise(function(_0x720422,_0x21f4e3){var _0x2a9df0=new AWS['S3']({'accessKeyId':_0x38930b,'secretAccessKey':_0x2e5f15,'region':_0x99a4b1});_0x2a9df0[_0x1cac('0x68')]({'Bucket':_0x3e9169,'Key':_0x551420,'Body':_0x2d22d5},function(_0x46e700,_0x1b1572){if(_0x46e700){return _0x21f4e3(_0x46e700);}else{return _0x720422(_0x1b1572);}});});}function startTranscribe(_0x444063,_0x5242f2,_0x1e19dd,_0x19b784,_0x183ec8,_0x45adcd){return new Promise(function(_0x4455be,_0xe95832){var _0x572837=new AWS[(_0x1cac('0x69'))]({'accessKeyId':_0x5242f2,'secretAccessKey':_0x444063,'region':_0x1e19dd});_0x572837[_0x1cac('0x6a')]({'TranscriptionJobName':_0x19b784,'LanguageCode':_0x183ec8,'Media':{'MediaFileUri':_0x45adcd}},function(_0x5cac64,_0x5941eb){if(_0x5cac64){return _0xe95832(_0x5cac64);}else{return _0x4455be(_0x5941eb);}});});}function transcribe(_0x313103,_0x3e5454,_0x5c1bdc,_0x16661e,_0x5a3257,_0x11deeb,_0x1bd543){return new Promise(function(_0x2507d2,_0x59bef0){var _0x365119={};logger[_0x1cac('0x61')](util[_0x1cac('0x4b')](_0x1cac('0x6b'),_0x313103,_0x5a3257));return uploadFile(_0x3e5454,_0x5c1bdc,_0x16661e,_0x5a3257,path['basename'](_0x11deeb),fs[_0x1cac('0x6c')](_0x11deeb))[_0x1cac('0x23')](function(_0x482a3a){logger[_0x1cac('0x61')](util[_0x1cac('0x4b')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x313103,_0x5a3257,_0x482a3a[_0x1cac('0x6d')]));_0x365119[_0x1cac('0x6e')]=_0x482a3a[_0x1cac('0x6f')];_0x365119[_0x1cac('0x70')]=_0x482a3a[_0x1cac('0x6d')];logger['info'](util[_0x1cac('0x4b')](_0x1cac('0x71'),_0x313103));return startTranscribe(_0x3e5454,_0x5c1bdc,_0x16661e,uuidv4(),_0x1bd543,_0x482a3a[_0x1cac('0x6d')]);})[_0x1cac('0x23')](function(_0x11510d){logger[_0x1cac('0x61')](util['format'](_0x1cac('0x72'),_0x313103,_0x11510d[_0x1cac('0x73')][_0x1cac('0x74')]));_0x365119[_0x1cac('0x75')]=_0x11510d[_0x1cac('0x73')][_0x1cac('0x74')];_0x365119['transcribeStatus']=_0x11510d['TranscriptionJob']['TranscriptionJobStatus'];return _0x2507d2(_0x365119);})[_0x1cac('0x40')](function(_0x308a0d){return _0x59bef0(_0x308a0d);});});}exports['runTranscribe']=function(_0x492cbc,_0x1d25f8,_0x292f9a){var _0x2c5318;var _0x221807;var _0x3f0791;var _0x4b9265=require('../../components/encryptor');return db[_0x1cac('0x28')]['findOne']({'where':{'id':_0x492cbc[_0x1cac('0x41')]['id']}})[_0x1cac('0x23')](function(_0x20f6c6){if(_0x20f6c6){var _0x521db5=util[_0x1cac('0x4b')](_0x1cac('0x4c'),_0x20f6c6[_0x1cac('0x4a')]);if(fs[_0x1cac('0x4d')](_0x521db5)){cypher=!![];return _0x4b9265[_0x1cac('0x4e')](_0x521db5,_0x20f6c6[_0x1cac('0x4a')],config['secrets']['recording'])[_0x1cac('0x23')](function(){return _0x20f6c6;});}return _0x20f6c6;}})[_0x1cac('0x23')](function(_0x58ca63){if(!_0x58ca63){throw new db[(_0x1cac('0x50'))]['ValidationError'](_0x1cac('0x76'));}_0x221807=_0x58ca63;return db[_0x1cac('0x77')][_0x1cac('0x78')]({'where':{'id':0x1}});})[_0x1cac('0x23')](handleEntityNotFound(_0x1d25f8,null))['then'](function(_0x15c1b2){if(_0x15c1b2){_0x2c5318=_0x15c1b2;if(!_0x2c5318[_0x1cac('0x79')]||!_0x2c5318[_0x1cac('0x7a')]||!_0x2c5318[_0x1cac('0x7b')]||!_0x2c5318[_0x1cac('0x7c')]||!_0x2c5318[_0x1cac('0x6e')]){throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))](_0x1cac('0x7d'));}if(_0x492cbc['body'][_0x1cac('0x7e')]&&(!_0x2c5318[_0x1cac('0x7f')]||!_0x2c5318[_0x1cac('0x80')]||!_0x2c5318[_0x1cac('0x81')]||!_0x2c5318[_0x1cac('0x7c')]||!_0x2c5318['bucket'])){throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))](_0x1cac('0x82'));}return db[_0x1cac('0x83')][_0x1cac('0x78')]({'where':{'id':_0x2c5318[_0x1cac('0x7a')]}});}})['then'](function(_0x167d34){if(!_0x167d34){throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))](_0x1cac('0x84'));}if(!_0x167d34[_0x1cac('0x85')]||!_0x167d34[_0x1cac('0x86')]){throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))](_0x1cac('0x87'));}_0x3f0791=_0x167d34;return getBucketslist(_0x3f0791[_0x1cac('0x85')],_0x3f0791['data2'],_0x2c5318['transcribeRegion']);})[_0x1cac('0x23')](function(_0x2926a5){if(_0x2926a5&&_0x2926a5[_0x1cac('0x88')]){var _0x40f23d=_['find'](_0x2926a5[_0x1cac('0x88')],function(_0x35164a){return _0x35164a['Name']===_0x2c5318['bucket'];});if(!_0x40f23d){logger[_0x1cac('0x61')](util['format'](_0x1cac('0x89'),_0x492cbc[_0x1cac('0x41')]['id'],_0x2c5318[_0x1cac('0x6e')]));return createBucket(_0x3f0791['data1'],_0x3f0791['data2'],_0x2c5318[_0x1cac('0x7b')],_0x2c5318['bucket']);}logger[_0x1cac('0x61')](util[_0x1cac('0x4b')](_0x1cac('0x8a'),_0x492cbc[_0x1cac('0x41')]['id'],_0x2c5318[_0x1cac('0x6e')]));return;}})['then'](function(_0x1bb9a8){if(_0x221807[_0x1cac('0x8b')]===_0x1cac('0x8c')){return transcribe(_0x492cbc[_0x1cac('0x41')]['id'],_0x3f0791[_0x1cac('0x85')],_0x3f0791[_0x1cac('0x86')],_0x2c5318['transcribeRegion'],_0x2c5318[_0x1cac('0x6e')],_0x221807[_0x1cac('0x4a')],_0x2c5318[_0x1cac('0x7c')]);}else{logger['info'](util[_0x1cac('0x4b')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x492cbc[_0x1cac('0x41')]['id']));return{'transcribeStatus':_0x1cac('0x8d')};}})[_0x1cac('0x23')](function(_0x2d4f02){if(_0x2d4f02){_0x2d4f02[_0x1cac('0x8e')]=_0x492cbc['body'][_0x1cac('0x7e')];return _0x221807[_0x1cac('0x8f')](_0x2d4f02);}})[_0x1cac('0x23')](respondWithResult(_0x1d25f8,null))[_0x1cac('0x40')](handleError(_0x1d25f8,null));};function writeFile(_0x3f4d9f,_0x4e6b09){return new Promise(function(_0x467d8e,_0x5c0493){fs[_0x1cac('0x90')](_0x4e6b09,_0x3f4d9f,function(_0x23108a,_0x4a6618){if(_0x23108a){return _0x5c0493(_0x23108a);}else{return _0x467d8e(_0x4a6618);}});});}exports['downloadTranscribe']=function(_0x476338,_0x209730,_0x5e5ce9){return db[_0x1cac('0x28')]['findOne']({'where':{'id':_0x476338[_0x1cac('0x41')]['id']}})[_0x1cac('0x23')](handleEntityNotFound(_0x209730))[_0x1cac('0x23')](function(_0x5bf096){if(_0x5bf096&&_0x5bf096[_0x1cac('0x91')]){var _0x183832=_0x5bf096[_0x1cac('0x91')];var _0x1eae08=config[_0x1cac('0x92')]+_0x1cac('0x93')+_0x5bf096['id']+_0x1cac('0x94');if(fs[_0x1cac('0x4d')](_0x1eae08)){return _0x1eae08;}return writeFile(_0x183832,_0x1eae08)[_0x1cac('0x23')](function(){return _0x1eae08;});}else{throw new db[(_0x1cac('0x50'))][(_0x1cac('0x51'))]('Transcript\x20not\x20available');}})[_0x1cac('0x23')](function(_0x2aca15){return _0x209730[_0x1cac('0x47')](_0x2aca15);})[_0x1cac('0x40')](handleError(_0x209730));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index e055933..d9619ff 100644 --- a/server/api/voiceRecording/voiceRecording.model.js +++ b/server/api/voiceRecording/voiceRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97dd=['util','api','moment','bluebird','request-promise','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash'];(function(_0x18a1b0,_0x180021){var _0x7315b2=function(_0x3d5c04){while(--_0x3d5c04){_0x18a1b0['push'](_0x18a1b0['shift']());}};_0x7315b2(++_0x180021);}(_0x97dd,0xef));var _0xd97d=function(_0x6b1b97,_0x5a34b7){_0x6b1b97=_0x6b1b97-0x0;var _0x156c7f=_0x97dd[_0x6b1b97];return _0x156c7f;};'use strict';var _=require(_0xd97d('0x0'));var util=require(_0xd97d('0x1'));var logger=require('../../config/logger')(_0xd97d('0x2'));var moment=require(_0xd97d('0x3'));var BPromise=require(_0xd97d('0x4'));var rp=require(_0xd97d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd97d('0x6'));var config=require('../../config/environment');var attributes=require(_0xd97d('0x7'));module[_0xd97d('0x8')]=function(_0x572c87,_0x2f1347){return _0x572c87[_0xd97d('0x9')](_0xd97d('0xa'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xd97d('0xb'),'fields':[_0xd97d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd114=['./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xd114,0x157));var _0x4d11=function(_0x411fdf,_0x33c914){_0x411fdf=_0x411fdf-0x0;var _0x4fd58d=_0xd114[_0x411fdf];return _0x4fd58d;};'use strict';var _=require(_0x4d11('0x0'));var util=require(_0x4d11('0x1'));var logger=require(_0x4d11('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4d11('0x3'));var rp=require(_0x4d11('0x4'));var fs=require('fs');var path=require(_0x4d11('0x5'));var rimraf=require(_0x4d11('0x6'));var config=require(_0x4d11('0x7'));var attributes=require(_0x4d11('0x8'));module[_0x4d11('0x9')]=function(_0x427ac5,_0x5cbc0f){return _0x427ac5['define'](_0x4d11('0xa'),attributes,{'tableName':_0x4d11('0xb'),'paranoid':![],'indexes':[{'name':_0x4d11('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 503a332..467622c 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x5940c4,_0x11b2c3){var _0x2f8337=function(_0x11c06b){while(--_0x11c06b){_0x5940c4['push'](_0x5940c4['shift']());}};_0x2f8337(++_0x11b2c3);}(_0x66fa,0x117));var _0xa66f=function(_0x5239bf,_0x4aa2f1){_0x5239bf=_0x5239bf-0x0;var _0x20b106=_0x66fa[_0x5239bf];return _0x20b106;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5637f4,_0x28bb07){var _0xdd68c0=function(_0x1c465b){while(--_0x1c465b){_0x5637f4['push'](_0x5637f4['shift']());}};_0xdd68c0(++_0x28bb07);}(_0x0295,0x1f0));var _0x5029=function(_0x7670a7,_0x5d628a){_0x7670a7=_0x7670a7-0x0;var _0xb6bb41=_0x0295[_0x7670a7];return _0xb6bb41;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b2f649b..b8e2e32 100644 --- a/server/api/voiceTransferReport/index.js +++ b/server/api/voiceTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f63=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48296c,_0xc556f1){var _0x514a35=function(_0x59e1de){while(--_0x59e1de){_0x48296c['push'](_0x48296c['shift']());}};_0x514a35(++_0xc556f1);}(_0x0f63,0x14c));var _0x30f6=function(_0xc8778e,_0x42280e){_0xc8778e=_0xc8778e-0x0;var _0x1134ab=_0x0f63[_0xc8778e];return _0x1134ab;};'use strict';var multer=require(_0x30f6('0x0'));var util=require(_0x30f6('0x1'));var path=require(_0x30f6('0x2'));var timeout=require(_0x30f6('0x3'));var express=require(_0x30f6('0x4'));var router=express[_0x30f6('0x5')]();var fs_extra=require(_0x30f6('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x30f6('0x7'));var config=require(_0x30f6('0x8'));var controller=require(_0x30f6('0x9'));router[_0x30f6('0xa')]('/',auth[_0x30f6('0xb')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x30f6('0xc')]);router[_0x30f6('0xa')](_0x30f6('0xd'),auth[_0x30f6('0xb')](),controller[_0x30f6('0xe')]);router[_0x30f6('0xf')]('/',auth['isAuthenticated'](),controller[_0x30f6('0x10')]);router[_0x30f6('0x11')](_0x30f6('0xd'),auth[_0x30f6('0xb')](),controller[_0x30f6('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x30f6('0x13')]);module[_0x30f6('0x14')]=router; \ No newline at end of file +var _0x0fe9=['util','path','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','multer'];(function(_0x33bad7,_0x523b96){var _0xa8175=function(_0x52e369){while(--_0x52e369){_0x33bad7['push'](_0x33bad7['shift']());}};_0xa8175(++_0x523b96);}(_0x0fe9,0xc5));var _0x90fe=function(_0x1f195f,_0x25e553){_0x1f195f=_0x1f195f-0x0;var _0x36aec3=_0x0fe9[_0x1f195f];return _0x36aec3;};'use strict';var multer=require(_0x90fe('0x0'));var util=require(_0x90fe('0x1'));var path=require(_0x90fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x90fe('0x3'));var router=express[_0x90fe('0x4')]();var fs_extra=require(_0x90fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x90fe('0x6'));var config=require('../../config/environment');var controller=require(_0x90fe('0x7'));router[_0x90fe('0x8')]('/',auth[_0x90fe('0x9')](),controller[_0x90fe('0xa')]);router[_0x90fe('0x8')](_0x90fe('0xb'),auth[_0x90fe('0x9')](),controller['describe']);router[_0x90fe('0x8')](_0x90fe('0xc'),auth[_0x90fe('0x9')](),controller['show']);router[_0x90fe('0xd')]('/',auth[_0x90fe('0x9')](),controller[_0x90fe('0xe')]);router[_0x90fe('0xf')](_0x90fe('0xc'),auth[_0x90fe('0x9')](),controller['update']);router[_0x90fe('0x10')](_0x90fe('0xc'),auth[_0x90fe('0x9')](),controller[_0x90fe('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index be64fd4..c5167a3 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.attributes.js +++ b/server/api/voiceTransferReport/voiceTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef8f=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x4b487e,_0x38ad8c){var _0x3f538d=function(_0x35a858){while(--_0x35a858){_0x4b487e['push'](_0x4b487e['shift']());}};_0x3f538d(++_0x38ad8c);}(_0xef8f,0x7e));var _0xfef8=function(_0x7b9ca4,_0x3b9479){_0x7b9ca4=_0x7b9ca4-0x0;var _0x34ba14=_0xef8f[_0x7b9ca4];return _0x34ba14;};'use strict';var Sequelize=require(_0xfef8('0x0'));var moment=require(_0xfef8('0x1'));module[_0xfef8('0x2')]={'type':{'type':Sequelize[_0xfef8('0x3')](_0xfef8('0x4'),_0xfef8('0x5'))},'result':{'type':Sequelize[_0xfef8('0x6')]},'transfererchannel':{'type':Sequelize[_0xfef8('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xfef8('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xfef8('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xfef8('0x6')]},'transferercontext':{'type':Sequelize[_0xfef8('0x6')]},'transfererexten':{'type':Sequelize[_0xfef8('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xfef8('0x6')]},'transfereechannel':{'type':Sequelize[_0xfef8('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xfef8('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xfef8('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xfef8('0x6')]},'isexternal':{'type':Sequelize[_0xfef8('0x3')](_0xfef8('0x7'),'No')},'context':{'type':Sequelize[_0xfef8('0x6')]},'extension':{'type':Sequelize[_0xfef8('0x6')]}}; \ No newline at end of file +var _0x998b=['ENUM','Yes','sequelize','moment','exports','blind','attended','STRING'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0x998b,0x1b2));var _0xb998=function(_0x1d3b61,_0x352951){_0x1d3b61=_0x1d3b61-0x0;var _0x2f0900=_0x998b[_0x1d3b61];return _0x2f0900;};'use strict';var Sequelize=require(_0xb998('0x0'));var moment=require(_0xb998('0x1'));module[_0xb998('0x2')]={'type':{'type':Sequelize['ENUM'](_0xb998('0x3'),_0xb998('0x4'))},'result':{'type':Sequelize[_0xb998('0x5')]},'transfererchannel':{'type':Sequelize[_0xb998('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb998('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xb998('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb998('0x5')]},'transferercontext':{'type':Sequelize[_0xb998('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xb998('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb998('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb998('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb998('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb998('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb998('0x5')]},'transfereeexten':{'type':Sequelize[_0xb998('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb998('0x5')]},'isexternal':{'type':Sequelize[_0xb998('0x6')](_0xb998('0x7'),'No')},'context':{'type':Sequelize[_0xb998('0x5')]},'extension':{'type':Sequelize[_0xb998('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f6c18f4..65d8b30 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.controller.js +++ b/server/api/voiceTransferReport/voiceTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5dd=['end','json','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0xb5dd,0x7b));var _0xdb5d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb5dd[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xdb5d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb5d('0x1'));var rp=require(_0xdb5d('0x2'));var moment=require('moment');var BPromise=require(_0xdb5d('0x3'));var Mustache=require(_0xdb5d('0x4'));var util=require(_0xdb5d('0x5'));var path=require(_0xdb5d('0x6'));var sox=require(_0xdb5d('0x7'));var csv=require('to-csv');var ejs=require(_0xdb5d('0x8'));var fs=require('fs');var fs_extra=require(_0xdb5d('0x9'));var _=require(_0xdb5d('0xa'));var squel=require(_0xdb5d('0xb'));var crypto=require(_0xdb5d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdb5d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdb5d('0xe'));var Papa=require(_0xdb5d('0xf'));var Redis=require(_0xdb5d('0x10'));var authService=require(_0xdb5d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdb5d('0x12'));var hardwareService=require(_0xdb5d('0x13'));var logger=require('../../config/logger')(_0xdb5d('0x14'));var utils=require(_0xdb5d('0x15'));var config=require(_0xdb5d('0x16'));var licenseUtil=require(_0xdb5d('0x17'));var db=require(_0xdb5d('0x18'))['db'];function respondWithStatusCode(_0x541928,_0x42d2f9){_0x42d2f9=_0x42d2f9||0xcc;return function(_0x4fd7e9){if(_0x4fd7e9){return _0x541928[_0xdb5d('0x19')](_0x42d2f9);}return _0x541928[_0xdb5d('0x1a')](_0x42d2f9)[_0xdb5d('0x1b')]();};}function respondWithResult(_0x13edcc,_0x12ead0){_0x12ead0=_0x12ead0||0xc8;return function(_0x180cd8){if(_0x180cd8){return _0x13edcc[_0xdb5d('0x1a')](_0x12ead0)[_0xdb5d('0x1c')](_0x180cd8);}};}function respondWithFilteredResult(_0x5afdd6,_0xd795c5){return function(_0x349867){if(_0x349867){var _0x5c7b4f=typeof _0xd795c5['offset']===_0xdb5d('0x1d')&&typeof _0xd795c5[_0xdb5d('0x1e')]===_0xdb5d('0x1d');var _0x1ee3cc=_0x349867[_0xdb5d('0x1f')];var _0x295ad3=_0x5c7b4f?0x0:_0xd795c5['offset'];var _0x11bb4c=_0x5c7b4f?_0x349867[_0xdb5d('0x1f')]:_0xd795c5['offset']+_0xd795c5[_0xdb5d('0x1e')];var _0x36c930;if(_0x11bb4c>=_0x1ee3cc){_0x11bb4c=_0x1ee3cc;_0x36c930=0xc8;}else{_0x36c930=0xce;}_0x5afdd6[_0xdb5d('0x1a')](_0x36c930);return _0x5afdd6['set'](_0xdb5d('0x20'),_0x295ad3+'-'+_0x11bb4c+'/'+_0x1ee3cc)['json'](_0x349867);}return null;};}function patchUpdates(_0x1199ea){return function(_0x26ccab){try{jsonpatch[_0xdb5d('0x21')](_0x26ccab,_0x1199ea,!![]);}catch(_0x313a78){return BPromise['reject'](_0x313a78);}return _0x26ccab['save']();};}function saveUpdates(_0x19b813,_0x268352){return function(_0x2a213a){if(_0x2a213a){return _0x2a213a[_0xdb5d('0x22')](_0x19b813)[_0xdb5d('0x23')](function(_0x127028){return _0x127028;});}return null;};}function removeEntity(_0x299358,_0x5a0f12){return function(_0x2c8170){if(_0x2c8170){return _0x2c8170[_0xdb5d('0x24')]()['then'](function(){_0x299358['status'](0xcc)[_0xdb5d('0x1b')]();});}};}function handleEntityNotFound(_0x2d0f0b,_0x5ae360){return function(_0x3911b4){if(!_0x3911b4){_0x2d0f0b[_0xdb5d('0x19')](0x194);}return _0x3911b4;};}function handleError(_0x49c45d,_0xd066f5){_0xd066f5=_0xd066f5||0x1f4;return function(_0x55da52){logger[_0xdb5d('0x25')](_0x55da52[_0xdb5d('0x26')]);if(_0x55da52[_0xdb5d('0x27')]){delete _0x55da52[_0xdb5d('0x27')];}_0x49c45d['status'](_0xd066f5)['send'](_0x55da52);};}exports[_0xdb5d('0x28')]=function(_0x408c9b,_0x10b716){var _0x27ba12={},_0x42a606={},_0x279e6e={'count':0x0,'rows':[]};var _0x1b8d17=_[_0xdb5d('0x29')](db[_0xdb5d('0x2a')][_0xdb5d('0x2b')],function(_0x6cce1){return{'name':_0x6cce1[_0xdb5d('0x2c')],'type':_0x6cce1[_0xdb5d('0x2d')][_0xdb5d('0x2e')]};});_0x42a606['model']=_[_0xdb5d('0x29')](_0x1b8d17,_0xdb5d('0x27'));_0x42a606[_0xdb5d('0x2f')]=_[_0xdb5d('0x30')](_0x408c9b['query']);_0x42a606[_0xdb5d('0x31')]=_[_0xdb5d('0x32')](_0x42a606[_0xdb5d('0x33')],_0x42a606['query']);_0x27ba12[_0xdb5d('0x34')]=_[_0xdb5d('0x32')](_0x42a606[_0xdb5d('0x33')],qs[_0xdb5d('0x35')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x35')]));_0x27ba12['attributes']=_0x27ba12[_0xdb5d('0x34')][_0xdb5d('0x36')]?_0x27ba12[_0xdb5d('0x34')]:_0x42a606['model'];if(!_0x408c9b[_0xdb5d('0x2f')]['hasOwnProperty'](_0xdb5d('0x37'))){_0x27ba12[_0xdb5d('0x1e')]=qs['limit'](_0x408c9b['query'][_0xdb5d('0x1e')]);_0x27ba12[_0xdb5d('0x38')]=qs[_0xdb5d('0x38')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x38')]);}_0x27ba12[_0xdb5d('0x39')]=qs[_0xdb5d('0x3a')](_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x3a')]);_0x27ba12[_0xdb5d('0x3b')]=qs['filters'](_[_0xdb5d('0x3c')](_0x408c9b[_0xdb5d('0x2f')],_0x42a606['filters']),_0x1b8d17);if(_0x408c9b['query'][_0xdb5d('0x3d')]){_0x27ba12[_0xdb5d('0x3b')]=_[_0xdb5d('0x3e')](_0x27ba12[_0xdb5d('0x3b')],{'$or':_[_0xdb5d('0x29')](_0x1b8d17,function(_0x1fd7ee){if(_0x1fd7ee[_0xdb5d('0x2d')]!==_0xdb5d('0x3f')){var _0x4520bb={};_0x4520bb[_0x1fd7ee[_0xdb5d('0x27')]]={'$like':'%'+_0x408c9b[_0xdb5d('0x2f')][_0xdb5d('0x3d')]+'%'};return _0x4520bb;}})});}_0x27ba12=_[_0xdb5d('0x3e')]({},_0x27ba12,_0x408c9b[_0xdb5d('0x40')]);var _0x4ee4aa={'where':_0x27ba12[_0xdb5d('0x3b')]};return db[_0xdb5d('0x2a')][_0xdb5d('0x1f')](_0x4ee4aa)[_0xdb5d('0x23')](function(_0x2059bc){_0x279e6e['count']=_0x2059bc;if(_0x408c9b['query'][_0xdb5d('0x41')]){_0x27ba12['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xdb5d('0x42')](_0x27ba12);})[_0xdb5d('0x23')](function(_0x11117e){_0x279e6e[_0xdb5d('0x43')]=_0x11117e;return _0x279e6e;})[_0xdb5d('0x23')](respondWithFilteredResult(_0x10b716,_0x27ba12))[_0xdb5d('0x44')](handleError(_0x10b716,null));};exports['show']=function(_0x40a687,_0xc33c88){var _0x2e5639={'raw':!![],'where':{'id':_0x40a687[_0xdb5d('0x45')]['id']}},_0x25a0d1={};_0x25a0d1[_0xdb5d('0x33')]=_['keys'](db[_0xdb5d('0x2a')][_0xdb5d('0x2b')]);_0x25a0d1[_0xdb5d('0x2f')]=_[_0xdb5d('0x30')](_0x40a687[_0xdb5d('0x2f')]);_0x25a0d1[_0xdb5d('0x31')]=_[_0xdb5d('0x32')](_0x25a0d1[_0xdb5d('0x33')],_0x25a0d1[_0xdb5d('0x2f')]);_0x2e5639[_0xdb5d('0x34')]=_[_0xdb5d('0x32')](_0x25a0d1[_0xdb5d('0x33')],qs[_0xdb5d('0x35')](_0x40a687[_0xdb5d('0x2f')][_0xdb5d('0x35')]));_0x2e5639[_0xdb5d('0x34')]=_0x2e5639[_0xdb5d('0x34')][_0xdb5d('0x36')]?_0x2e5639[_0xdb5d('0x34')]:_0x25a0d1[_0xdb5d('0x33')];if(_0x40a687['query']['includeAll']){_0x2e5639[_0xdb5d('0x46')]=[{'all':!![]}];}_0x2e5639=_[_0xdb5d('0x3e')]({},_0x2e5639,_0x40a687[_0xdb5d('0x40')]);return db['VoiceTransferReport'][_0xdb5d('0x47')](_0x2e5639)[_0xdb5d('0x23')](handleEntityNotFound(_0xc33c88,null))[_0xdb5d('0x23')](respondWithResult(_0xc33c88,null))[_0xdb5d('0x44')](handleError(_0xc33c88,null));};exports['create']=function(_0x319d61,_0xe21e05){return db[_0xdb5d('0x2a')][_0xdb5d('0x48')](_0x319d61[_0xdb5d('0x49')],{})[_0xdb5d('0x23')](respondWithResult(_0xe21e05,0xc9))[_0xdb5d('0x44')](handleError(_0xe21e05,null));};exports[_0xdb5d('0x22')]=function(_0x14a07c,_0x2b8713){if(_0x14a07c['body']['id']){delete _0x14a07c[_0xdb5d('0x49')]['id'];}return db[_0xdb5d('0x2a')][_0xdb5d('0x47')]({'where':{'id':_0x14a07c[_0xdb5d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b8713,null))[_0xdb5d('0x23')](saveUpdates(_0x14a07c['body'],null))[_0xdb5d('0x23')](respondWithResult(_0x2b8713,null))['catch'](handleError(_0x2b8713,null));};exports[_0xdb5d('0x24')]=function(_0x1042f4,_0x3f2d11){return db[_0xdb5d('0x2a')][_0xdb5d('0x47')]({'where':{'id':_0x1042f4[_0xdb5d('0x45')]['id']}})[_0xdb5d('0x23')](handleEntityNotFound(_0x3f2d11,null))['then'](removeEntity(_0x3f2d11,null))['catch'](handleError(_0x3f2d11,null));};exports['describe']=function(_0x3d6242,_0x4465f8){return db[_0xdb5d('0x2a')][_0xdb5d('0x4a')]()['then'](respondWithResult(_0x4465f8,null))[_0xdb5d('0x44')](handleError(_0x4465f8,null));}; \ No newline at end of file +var _0xa03e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4c855d,_0x5ccd5f){var _0x395ad4=function(_0x4eec8a){while(--_0x4eec8a){_0x4c855d['push'](_0x4c855d['shift']());}};_0x395ad4(++_0x5ccd5f);}(_0xa03e,0x1bc));var _0xea03=function(_0x53fcc9,_0x65d24f){_0x53fcc9=_0x53fcc9-0x0;var _0x5228dc=_0xa03e[_0x53fcc9];return _0x5228dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xea03('0x0'));var rp=require(_0xea03('0x1'));var moment=require(_0xea03('0x2'));var BPromise=require(_0xea03('0x3'));var Mustache=require(_0xea03('0x4'));var util=require(_0xea03('0x5'));var path=require(_0xea03('0x6'));var sox=require(_0xea03('0x7'));var csv=require(_0xea03('0x8'));var ejs=require(_0xea03('0x9'));var fs=require('fs');var fs_extra=require(_0xea03('0xa'));var _=require(_0xea03('0xb'));var squel=require(_0xea03('0xc'));var crypto=require(_0xea03('0xd'));var jsforce=require(_0xea03('0xe'));var deskjs=require(_0xea03('0xf'));var toCsv=require(_0xea03('0x8'));var querystring=require(_0xea03('0x10'));var Papa=require(_0xea03('0x11'));var Redis=require(_0xea03('0x12'));var authService=require(_0xea03('0x13'));var qs=require(_0xea03('0x14'));var as=require(_0xea03('0x15'));var hardwareService=require(_0xea03('0x16'));var logger=require('../../config/logger')(_0xea03('0x17'));var utils=require(_0xea03('0x18'));var config=require(_0xea03('0x19'));var licenseUtil=require(_0xea03('0x1a'));var db=require(_0xea03('0x1b'))['db'];function respondWithStatusCode(_0x3efbf8,_0xe0afcc){_0xe0afcc=_0xe0afcc||0xcc;return function(_0x40a4e7){if(_0x40a4e7){return _0x3efbf8[_0xea03('0x1c')](_0xe0afcc);}return _0x3efbf8[_0xea03('0x1d')](_0xe0afcc)['end']();};}function respondWithResult(_0x1ccb71,_0x40d085){_0x40d085=_0x40d085||0xc8;return function(_0x3dd095){if(_0x3dd095){return _0x1ccb71[_0xea03('0x1d')](_0x40d085)[_0xea03('0x1e')](_0x3dd095);}};}function respondWithFilteredResult(_0x10c70a,_0x54d1da){return function(_0x22ddd6){if(_0x22ddd6){var _0x2cfc76=typeof _0x54d1da['offset']===_0xea03('0x1f')&&typeof _0x54d1da['limit']===_0xea03('0x1f');var _0x2eb045=_0x22ddd6[_0xea03('0x20')];var _0x29788f=_0x2cfc76?0x0:_0x54d1da['offset'];var _0x2180ae=_0x2cfc76?_0x22ddd6[_0xea03('0x20')]:_0x54d1da['offset']+_0x54d1da['limit'];var _0x3edf27;if(_0x2180ae>=_0x2eb045){_0x2180ae=_0x2eb045;_0x3edf27=0xc8;}else{_0x3edf27=0xce;}_0x10c70a[_0xea03('0x1d')](_0x3edf27);return _0x10c70a['set'](_0xea03('0x21'),_0x29788f+'-'+_0x2180ae+'/'+_0x2eb045)[_0xea03('0x1e')](_0x22ddd6);}return null;};}function patchUpdates(_0x1d8a00){return function(_0x404dd5){try{jsonpatch[_0xea03('0x22')](_0x404dd5,_0x1d8a00,!![]);}catch(_0x122db2){return BPromise[_0xea03('0x23')](_0x122db2);}return _0x404dd5[_0xea03('0x24')]();};}function saveUpdates(_0x50bd2f,_0x7f8bce){return function(_0x9a66b7){if(_0x9a66b7){return _0x9a66b7['update'](_0x50bd2f)[_0xea03('0x25')](function(_0xbab768){return _0xbab768;});}return null;};}function removeEntity(_0x37c3d9,_0x302217){return function(_0x46bc0c){if(_0x46bc0c){return _0x46bc0c[_0xea03('0x26')]()[_0xea03('0x25')](function(){_0x37c3d9[_0xea03('0x1d')](0xcc)[_0xea03('0x27')]();});}};}function handleEntityNotFound(_0x4fd038,_0x4ee51b){return function(_0x2017bb){if(!_0x2017bb){_0x4fd038['sendStatus'](0x194);}return _0x2017bb;};}function handleError(_0x318df9,_0x44f2e8){_0x44f2e8=_0x44f2e8||0x1f4;return function(_0x1d152c){logger['error'](_0x1d152c[_0xea03('0x28')]);if(_0x1d152c['name']){delete _0x1d152c[_0xea03('0x29')];}_0x318df9['status'](_0x44f2e8)['send'](_0x1d152c);};}exports[_0xea03('0x2a')]=function(_0x3f28f9,_0x8e7324){var _0x20f89b={},_0x5cc83={},_0x18ac00={'count':0x0,'rows':[]};var _0x35f48e=_[_0xea03('0x2b')](db[_0xea03('0x2c')][_0xea03('0x2d')],function(_0x33591a){return{'name':_0x33591a[_0xea03('0x2e')],'type':_0x33591a[_0xea03('0x2f')][_0xea03('0x30')]};});_0x5cc83[_0xea03('0x31')]=_['map'](_0x35f48e,'name');_0x5cc83['query']=_[_0xea03('0x32')](_0x3f28f9[_0xea03('0x33')]);_0x5cc83[_0xea03('0x34')]=_['intersection'](_0x5cc83[_0xea03('0x31')],_0x5cc83[_0xea03('0x33')]);_0x20f89b[_0xea03('0x35')]=_[_0xea03('0x36')](_0x5cc83[_0xea03('0x31')],qs[_0xea03('0x37')](_0x3f28f9[_0xea03('0x33')][_0xea03('0x37')]));_0x20f89b[_0xea03('0x35')]=_0x20f89b['attributes'][_0xea03('0x38')]?_0x20f89b[_0xea03('0x35')]:_0x5cc83[_0xea03('0x31')];if(!_0x3f28f9['query'][_0xea03('0x39')]('nolimit')){_0x20f89b['limit']=qs['limit'](_0x3f28f9['query'][_0xea03('0x3a')]);_0x20f89b[_0xea03('0x3b')]=qs[_0xea03('0x3b')](_0x3f28f9[_0xea03('0x33')][_0xea03('0x3b')]);}_0x20f89b[_0xea03('0x3c')]=qs['sort'](_0x3f28f9[_0xea03('0x33')][_0xea03('0x3d')]);_0x20f89b['where']=qs['filters'](_[_0xea03('0x3e')](_0x3f28f9[_0xea03('0x33')],_0x5cc83[_0xea03('0x34')]),_0x35f48e);if(_0x3f28f9[_0xea03('0x33')]['filter']){_0x20f89b[_0xea03('0x3f')]=_[_0xea03('0x40')](_0x20f89b['where'],{'$or':_[_0xea03('0x2b')](_0x35f48e,function(_0x227fa1){if(_0x227fa1[_0xea03('0x2f')]!==_0xea03('0x41')){var _0x5e0aba={};_0x5e0aba[_0x227fa1[_0xea03('0x29')]]={'$like':'%'+_0x3f28f9[_0xea03('0x33')][_0xea03('0x42')]+'%'};return _0x5e0aba;}})});}_0x20f89b=_[_0xea03('0x40')]({},_0x20f89b,_0x3f28f9[_0xea03('0x43')]);var _0xa821f={'where':_0x20f89b[_0xea03('0x3f')]};return db['VoiceTransferReport']['count'](_0xa821f)[_0xea03('0x25')](function(_0x269746){_0x18ac00[_0xea03('0x20')]=_0x269746;if(_0x3f28f9['query'][_0xea03('0x44')]){_0x20f89b[_0xea03('0x45')]=[{'all':!![]}];}return db[_0xea03('0x2c')]['findAll'](_0x20f89b);})[_0xea03('0x25')](function(_0x407092){_0x18ac00[_0xea03('0x46')]=_0x407092;return _0x18ac00;})['then'](respondWithFilteredResult(_0x8e7324,_0x20f89b))[_0xea03('0x47')](handleError(_0x8e7324,null));};exports[_0xea03('0x48')]=function(_0x343734,_0x3e6f67){var _0xd71c47={'raw':!![],'where':{'id':_0x343734[_0xea03('0x49')]['id']}},_0x21e8ff={};_0x21e8ff[_0xea03('0x31')]=_['keys'](db[_0xea03('0x2c')][_0xea03('0x2d')]);_0x21e8ff[_0xea03('0x33')]=_[_0xea03('0x32')](_0x343734[_0xea03('0x33')]);_0x21e8ff[_0xea03('0x34')]=_[_0xea03('0x36')](_0x21e8ff[_0xea03('0x31')],_0x21e8ff['query']);_0xd71c47[_0xea03('0x35')]=_[_0xea03('0x36')](_0x21e8ff[_0xea03('0x31')],qs[_0xea03('0x37')](_0x343734[_0xea03('0x33')][_0xea03('0x37')]));_0xd71c47[_0xea03('0x35')]=_0xd71c47[_0xea03('0x35')][_0xea03('0x38')]?_0xd71c47[_0xea03('0x35')]:_0x21e8ff[_0xea03('0x31')];if(_0x343734[_0xea03('0x33')]['includeAll']){_0xd71c47[_0xea03('0x45')]=[{'all':!![]}];}_0xd71c47=_['merge']({},_0xd71c47,_0x343734['options']);return db[_0xea03('0x2c')][_0xea03('0x4a')](_0xd71c47)[_0xea03('0x25')](handleEntityNotFound(_0x3e6f67,null))[_0xea03('0x25')](respondWithResult(_0x3e6f67,null))[_0xea03('0x47')](handleError(_0x3e6f67,null));};exports['create']=function(_0x2abb59,_0x300629){return db[_0xea03('0x2c')]['create'](_0x2abb59[_0xea03('0x4b')],{})['then'](respondWithResult(_0x300629,0xc9))[_0xea03('0x47')](handleError(_0x300629,null));};exports['update']=function(_0x33d67f,_0x36059b){if(_0x33d67f[_0xea03('0x4b')]['id']){delete _0x33d67f[_0xea03('0x4b')]['id'];}return db[_0xea03('0x2c')][_0xea03('0x4a')]({'where':{'id':_0x33d67f[_0xea03('0x49')]['id']}})['then'](handleEntityNotFound(_0x36059b,null))['then'](saveUpdates(_0x33d67f[_0xea03('0x4b')],null))[_0xea03('0x25')](respondWithResult(_0x36059b,null))[_0xea03('0x47')](handleError(_0x36059b,null));};exports[_0xea03('0x26')]=function(_0x54e9f7,_0x1e95b0){return db[_0xea03('0x2c')][_0xea03('0x4a')]({'where':{'id':_0x54e9f7[_0xea03('0x49')]['id']}})[_0xea03('0x25')](handleEntityNotFound(_0x1e95b0,null))[_0xea03('0x25')](removeEntity(_0x1e95b0,null))[_0xea03('0x47')](handleError(_0x1e95b0,null));};exports[_0xea03('0x4c')]=function(_0x1e872b,_0x53eab8){return db['VoiceTransferReport'][_0xea03('0x4c')]()[_0xea03('0x25')](respondWithResult(_0x53eab8,null))['catch'](handleError(_0x53eab8,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d35930c..13db3c8 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.model.js +++ b/server/api/voiceTransferReport/voiceTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd6b=['path','rimraf','./voiceTransferReport.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd6b,0x1b2));var _0xbbd6=function(_0x4f8b73,_0x499742){_0x4f8b73=_0x4f8b73-0x0;var _0x4ae551=_0xbd6b[_0x4f8b73];return _0x4ae551;};'use strict';var _=require(_0xbbd6('0x0'));var util=require(_0xbbd6('0x1'));var logger=require('../../config/logger')(_0xbbd6('0x2'));var moment=require(_0xbbd6('0x3'));var BPromise=require(_0xbbd6('0x4'));var rp=require(_0xbbd6('0x5'));var fs=require('fs');var path=require(_0xbbd6('0x6'));var rimraf=require(_0xbbd6('0x7'));var config=require('../../config/environment');var attributes=require(_0xbbd6('0x8'));module[_0xbbd6('0x9')]=function(_0x41a849,_0x14d34e){return _0x41a849[_0xbbd6('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc650=['VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define'];(function(_0x340d13,_0x15af2b){var _0x4f9608=function(_0x4e838b){while(--_0x4e838b){_0x340d13['push'](_0x340d13['shift']());}};_0x4f9608(++_0x15af2b);}(_0xc650,0x1ae));var _0x0c65=function(_0x5f08f5,_0x1d59be){_0x5f08f5=_0x5f08f5-0x0;var _0x3825cc=_0xc650[_0x5f08f5];return _0x3825cc;};'use strict';var _=require(_0x0c65('0x0'));var util=require(_0x0c65('0x1'));var logger=require(_0x0c65('0x2'))(_0x0c65('0x3'));var moment=require(_0x0c65('0x4'));var BPromise=require(_0x0c65('0x5'));var rp=require(_0x0c65('0x6'));var fs=require('fs');var path=require(_0x0c65('0x7'));var rimraf=require(_0x0c65('0x8'));var config=require('../../config/environment');var attributes=require(_0x0c65('0x9'));module[_0x0c65('0xa')]=function(_0x402ca7,_0x433a13){return _0x402ca7[_0x0c65('0xb')](_0x0c65('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c38ad4f..7ed19a4 100644 --- a/server/api/voiceTransferReport/voiceTransferReport.rpc.js +++ b/server/api/voiceTransferReport/voiceTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cde=['../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','create','options','raw','debug','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xce8299,_0x55ec18){var _0xa39773=function(_0x42682){while(--_0x42682){_0xce8299['push'](_0xce8299['shift']());}};_0xa39773(++_0x55ec18);}(_0x3cde,0x12c));var _0xe3cd=function(_0x144b94,_0x5e984f){_0x144b94=_0x144b94-0x0;var _0x33cc48=_0x3cde[_0x144b94];return _0x33cc48;};'use strict';var _=require(_0xe3cd('0x0'));var util=require(_0xe3cd('0x1'));var moment=require(_0xe3cd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3cd('0x3'));var db=require(_0xe3cd('0x4'))['db'];var utils=require(_0xe3cd('0x5'));var logger=require(_0xe3cd('0x6'))(_0xe3cd('0x7'));var config=require(_0xe3cd('0x8'));var jayson=require(_0xe3cd('0x9'));var client=jayson[_0xe3cd('0xa')][_0xe3cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x198a99,_0x5d6da0,_0x4ab99e){return new BPromise(function(_0x541882,_0x3d9dad){return client['request'](_0x198a99,_0x4ab99e)[_0xe3cd('0xc')](function(_0x107d19){logger[_0xe3cd('0xd')](_0xe3cd('0xe'),_0x5d6da0,_0xe3cd('0xf'));logger['debug'](_0xe3cd('0x10'),_0x5d6da0,_0xe3cd('0xf'),JSON[_0xe3cd('0x11')](_0x107d19));if(_0x107d19[_0xe3cd('0x12')]){if(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x13')]===0x1f4){logger[_0xe3cd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d6da0,_0x107d19['error'][_0xe3cd('0x14')]);return _0x3d9dad(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);}logger[_0xe3cd('0x12')](_0xe3cd('0xe'),_0x5d6da0,_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);return _0x541882(_0x107d19[_0xe3cd('0x12')][_0xe3cd('0x14')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5d6da0,_0xe3cd('0xf'));_0x541882(_0x107d19[_0xe3cd('0x15')][_0xe3cd('0x14')]);}})['catch'](function(_0x205ac9){logger[_0xe3cd('0x12')](_0xe3cd('0xe'),_0x5d6da0,_0x205ac9);_0x3d9dad(_0x205ac9);});});}exports[_0xe3cd('0x16')]=function(_0x497889){var _0x3a720a=this;return new Promise(function(_0x364af3,_0x1fe181){return db['VoiceTransferReport'][_0xe3cd('0x17')](_0x497889['body'],{'raw':_0x497889[_0xe3cd('0x18')]?_0x497889['options'][_0xe3cd('0x19')]===undefined?!![]:![]:!![]})[_0xe3cd('0xc')](function(_0x2d5cc0){logger[_0xe3cd('0xd')](_0xe3cd('0x16'),_0x497889);logger[_0xe3cd('0x1a')](_0xe3cd('0x16'),_0x497889,JSON[_0xe3cd('0x11')](_0x2d5cc0));_0x364af3(_0x2d5cc0);})[_0xe3cd('0x1b')](function(_0x2486c8){logger[_0xe3cd('0x12')](_0xe3cd('0x16'),_0x2486c8[_0xe3cd('0x14')],_0x497889);_0x1fe181(_0x3a720a[_0xe3cd('0x12')](0x1f4,_0x2486c8[_0xe3cd('0x14')]));});});}; \ No newline at end of file +var _0x4538=['stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3ffccc,_0x39620f){var _0x1583d2=function(_0xdbb320){while(--_0xdbb320){_0x3ffccc['push'](_0x3ffccc['shift']());}};_0x1583d2(++_0x39620f);}(_0x4538,0x7e));var _0x8453=function(_0x5e9254,_0x461f69){_0x5e9254=_0x5e9254-0x0;var _0x550499=_0x4538[_0x5e9254];return _0x550499;};'use strict';var _=require(_0x8453('0x0'));var util=require(_0x8453('0x1'));var moment=require(_0x8453('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8453('0x3'))['db'];var utils=require(_0x8453('0x4'));var logger=require(_0x8453('0x5'))('rpc');var config=require(_0x8453('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8453('0x7')][_0x8453('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x480c7c,_0x3da22b,_0x225f3c){return new BPromise(function(_0x5267e1,_0xbe67d5){return client[_0x8453('0x9')](_0x480c7c,_0x225f3c)['then'](function(_0x586ab3){logger[_0x8453('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x3da22b,_0x8453('0xb'));logger[_0x8453('0xc')](_0x8453('0xd'),_0x3da22b,_0x8453('0xb'),JSON[_0x8453('0xe')](_0x586ab3));if(_0x586ab3[_0x8453('0xf')]){if(_0x586ab3[_0x8453('0xf')][_0x8453('0x10')]===0x1f4){logger[_0x8453('0xf')](_0x8453('0x11'),_0x3da22b,_0x586ab3[_0x8453('0xf')]['message']);return _0xbe67d5(_0x586ab3['error'][_0x8453('0x12')]);}logger['error'](_0x8453('0x11'),_0x3da22b,_0x586ab3[_0x8453('0xf')]['message']);return _0x5267e1(_0x586ab3['error'][_0x8453('0x12')]);}else{logger[_0x8453('0xa')](_0x8453('0x11'),_0x3da22b,'request\x20sent');_0x5267e1(_0x586ab3[_0x8453('0x13')]['message']);}})[_0x8453('0x14')](function(_0x2c6d6e){logger[_0x8453('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3da22b,_0x2c6d6e);_0xbe67d5(_0x2c6d6e);});});}exports[_0x8453('0x15')]=function(_0x35f55f){var _0x9fb241=this;return new Promise(function(_0x39770f,_0x5ddf95){return db[_0x8453('0x16')][_0x8453('0x17')](_0x35f55f[_0x8453('0x18')],{'raw':_0x35f55f[_0x8453('0x19')]?_0x35f55f[_0x8453('0x19')][_0x8453('0x1a')]===undefined?!![]:![]:!![]})[_0x8453('0x1b')](function(_0x271022){logger[_0x8453('0xa')]('CreateVoiceTransferReport',_0x35f55f);logger['debug'](_0x8453('0x15'),_0x35f55f,JSON[_0x8453('0xe')](_0x271022));_0x39770f(_0x271022);})['catch'](function(_0x4a31ef){logger[_0x8453('0xf')](_0x8453('0x15'),_0x4a31ef[_0x8453('0x12')],_0x35f55f);_0x5ddf95(_0x9fb241[_0x8453('0xf')](0x1f4,_0x4a31ef[_0x8453('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 998a8e9..c4d9eb4 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x70e0,0x17b));var _0x070e=function(_0x4b0f47,_0x2afa59){_0x4b0f47=_0x4b0f47-0x0;var _0x317313=_0x70e0[_0x4b0f47];return _0x317313;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xb43b,0x1b2));var _0xbb43=function(_0x373602,_0x8ddb9){_0x373602=_0x373602-0x0;var _0xa67722=_0xb43b[_0x373602];return _0xa67722;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9554520..3f54016 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x202c=['conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','path','../../config/environment','util','bluebird','client','http','../../config/logger','webbarapi','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','status','send','name','NotFound','request','code','message','result','catch','User','then','VoiceChannels','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','sessionId','user:%s','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all'];(function(_0x4622f2,_0x53d8fc){var _0x5adcb2=function(_0x1aa8c7){while(--_0x1aa8c7){_0x4622f2['push'](_0x4622f2['shift']());}};_0x5adcb2(++_0x53d8fc);}(_0x202c,0x178));var _0xc202=function(_0x38ee8c,_0x41ae11){_0x38ee8c=_0x38ee8c-0x0;var _0x95d48c=_0x202c[_0x38ee8c];return _0x95d48c;};'use strict';var path=require(_0xc202('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0xc202('0x1'));var util=require(_0xc202('0x2'));var BPromise=require(_0xc202('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xc202('0x4')][_0xc202('0x5')]({'port':0x232a});var logger=require(_0xc202('0x6'))(_0xc202('0x7'));var Redis=require('ioredis');config[_0xc202('0x8')]=_[_0xc202('0x9')](config['redis'],{'host':_0xc202('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc202('0x8')]));var Schema=require(_0xc202('0xb'));var originateValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'callNumber':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0xf')]},'callerId':{'type':_0xc202('0xe')},'callbackUrl':{'type':_0xc202('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':_0xc202('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],_0xc202('0xd')]},'sessionId':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0x10')]},'transferNumber':{'type':_0xc202('0xe'),'required':[!![],_0xc202('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc202('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc202('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc202('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc202('0xd')]}});function emit(_0x5971a6,_0x19af73,_0x1d580c){logger[_0xc202('0x12')](_0x5971a6,_0x19af73,JSON[_0xc202('0x13')](_0x1d580c));io['to'](_0x5971a6)[_0xc202('0x14')](_0x19af73,_0x1d580c);}function handleError(_0x2419c5){return function(_0x9620a0){console['log'](_0xc202('0x15'),_0x9620a0,_0x9620a0 instanceof RangeError);logger[_0xc202('0x16')](_0x9620a0[_0xc202('0x17')]);if(_0x9620a0 instanceof RangeError){if(_0x9620a0['name']){delete _0x9620a0['name'];}_0x2419c5[_0xc202('0x18')](0x194)[_0xc202('0x19')](_0x9620a0);}else{if(_0x9620a0[_0xc202('0x1a')]){delete _0x9620a0[_0xc202('0x1a')];}_0x2419c5[_0xc202('0x18')](0x1f4)['send'](_0x9620a0);}};}function checkError(){return function(_0x50a32f){if(!_0x50a32f){throw new RangeError(_0xc202('0x1b'));}return _0x50a32f;};}function respondWithRpcPromise(_0x5a6526,_0x3058d3){return new BPromise(function(_0x372b31,_0x56e979){var _0x50f917=amiClient;return _0x50f917[_0xc202('0x1c')](_0x5a6526,_0x3058d3)['then'](function(_0x23e1a0){if(_0x23e1a0[_0xc202('0x16')]){if(_0x23e1a0[_0xc202('0x16')][_0xc202('0x1d')]===0x1f4){return _0x56e979(_0x23e1a0[_0xc202('0x16')]['message']);}return _0x372b31(_0x23e1a0['error'][_0xc202('0x1e')]);}else{_0x372b31(_0x23e1a0[_0xc202('0x1f')]);}})[_0xc202('0x20')](function(_0x4ff3e3){_0x56e979(_0x4ff3e3);});});}function getAgent(_0xdd5798){return db[_0xc202('0x21')]['findOne']({'where':{'id':_0xdd5798,'role':'agent'}})[_0xc202('0x22')](checkError());}function getAgentCheckSession(_0x2f8011,_0xd88a43){return new BPromise(function(_0x6b291c,_0x2a401b){var _0x483357=respondWithRpcPromise(_0xc202('0x23'));var _0x32f56c=getAgent(_0x2f8011);Promise['all']([_0x483357,_0x32f56c])['then'](function(_0x25a954){var _0x278ef5=_0x25a954[0x0];var _0x130e51=_0x25a954[0x1];var _0x189211=_['filter'](_0x278ef5[_0xc202('0x24')],function(_0x2c8fec){return _0x2c8fec[_0xc202('0x25')]==_0x130e51['id']&&_0x2c8fec['sessionId']==_0xd88a43;});if(_0x189211[_0xc202('0x26')]==0x1){_0x6b291c(_0x130e51);}else{_0x2a401b(new RangeError(_0xc202('0x27')+_0xd88a43+_0xc202('0x28')));}});});}exports[_0xc202('0x29')]=function(_0x464ab8,_0x196394){logger[_0xc202('0x12')](_0xc202('0x2a'),_0x464ab8[_0xc202('0x2b')]);var _0x1b4e71=originateValidation[_0xc202('0xb')](_0x464ab8[_0xc202('0x2b')]);if(_0x1b4e71['length']>0x0){return _0x196394[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x1b4e71);}var _0x12e11a=_0x464ab8['body'][_0xc202('0x2d')];var _0x501db2=_0x464ab8[_0xc202('0x2b')][_0xc202('0x2e')];var _0x12bf23=_0x464ab8[_0xc202('0x2b')][_0xc202('0x2f')];var _0x77419a=_0x464ab8['body'][_0xc202('0x30')];return getAgent(_0x12e11a)['then'](function(_0x3ac7e8){logger['info'](_0xc202('0x31'),_0x3ac7e8[_0xc202('0x1a')]);emit(util[_0xc202('0x32')]('user:%s',_0x3ac7e8[_0xc202('0x1a')]),_0xc202('0x33'),{'callNumber':_0x501db2,'callerId':_0x12bf23,'callbackUrl':_0x77419a});return _0x196394[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x34')});})[_0xc202('0x20')](handleError(_0x196394));};exports['hangup']=function(_0x16608b,_0x1e57c3){logger[_0xc202('0x12')]('hangup\x20fired:',_0x16608b[_0xc202('0x2b')]);var _0x1741b7=hangupValidation[_0xc202('0xb')](_0x16608b[_0xc202('0x2b')]);if(_0x1741b7['length']>0x0){return _0x1e57c3['status'](0x190)[_0xc202('0x2c')](_0x1741b7);}var _0x4caf1b=_0x16608b[_0xc202('0x2b')][_0xc202('0x2d')];var _0x25fdd8=_0x16608b[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x4caf1b)[_0xc202('0x22')](function(_0x52d9d2){logger[_0xc202('0x12')](_0xc202('0x31'),_0x52d9d2[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x52d9d2['name']),_0xc202('0x37'),{'sessionId':_0x25fdd8});return _0x1e57c3[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x38')});})[_0xc202('0x20')](handleError(_0x1e57c3));};exports['answer']=function(_0x25d75f,_0x5d89b3){logger[_0xc202('0x12')]('answer\x20fired:',_0x25d75f[_0xc202('0x2b')]);var _0x4393f3=answerValidation[_0xc202('0xb')](_0x25d75f[_0xc202('0x2b')]);if(_0x4393f3['length']>0x0){return _0x5d89b3[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x4393f3);}var _0x865cd1=_0x25d75f[_0xc202('0x2b')][_0xc202('0x2d')];var _0x91785a=_0x25d75f[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x865cd1)[_0xc202('0x22')](function(_0x6cad30){logger[_0xc202('0x12')](_0xc202('0x31'),_0x6cad30[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x6cad30[_0xc202('0x1a')]),_0xc202('0x39'),{'sessionId':_0x91785a});return _0x5d89b3[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x3a')});})['catch'](handleError(_0x5d89b3));};exports[_0xc202('0x3b')]=function(_0x187934,_0x291a6b){logger['info']('hold\x20fired:',_0x187934['body']);var _0x113db6=holdValidation[_0xc202('0xb')](_0x187934[_0xc202('0x2b')]);if(_0x113db6[_0xc202('0x26')]>0x0){return _0x291a6b[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x113db6);}var _0x157d89=_0x187934[_0xc202('0x2b')][_0xc202('0x2d')];var _0x6d6b02=_0x187934[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x157d89)[_0xc202('0x22')](function(_0x5220a2){logger[_0xc202('0x12')](_0xc202('0x31'),_0x5220a2['name']);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x5220a2[_0xc202('0x1a')]),_0xc202('0x3c'),{'sessionId':_0x6d6b02});return _0x291a6b[_0xc202('0x18')](0xc8)['json']({'error':![],'message':_0xc202('0x3d')});})['catch'](handleError(_0x291a6b));};exports[_0xc202('0x3e')]=function(_0x5f1b99,_0x305793){logger[_0xc202('0x12')]('unhold\x20fired:',_0x5f1b99[_0xc202('0x2b')]);var _0x239cd=unholdValidation['validate'](_0x5f1b99['body']);if(_0x239cd['length']>0x0){return _0x305793[_0xc202('0x18')](0x190)['json'](_0x239cd);}var _0x1ac5c5=_0x5f1b99[_0xc202('0x2b')][_0xc202('0x2d')];var _0x1f6233=_0x5f1b99[_0xc202('0x2b')][_0xc202('0x35')];return getAgent(_0x1ac5c5)[_0xc202('0x22')](function(_0x3469e0){logger[_0xc202('0x12')](_0xc202('0x31'),_0x3469e0[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x3469e0['name']),_0xc202('0x3f'),{'sessionId':_0x1f6233});return _0x305793['status'](0xc8)['json']({'error':![],'message':_0xc202('0x40')});})[_0xc202('0x20')](handleError(_0x305793));};exports[_0xc202('0x41')]=function(_0x52fcbd,_0x1fcc19){logger['info'](_0xc202('0x42'),_0x1fcc19[_0xc202('0x2b')]);var _0x5464ea=callsValidation[_0xc202('0xb')](_0x52fcbd[_0xc202('0x2b')]);if(_0x5464ea['length']>0x0){return _0x1fcc19[_0xc202('0x18')](0x190)['json'](_0x5464ea);}var _0x3c765d=_0x52fcbd[_0xc202('0x2b')][_0xc202('0x2d')];var _0x1a06c5=respondWithRpcPromise(_0xc202('0x23'));var _0x2d475a=getAgent(_0x3c765d);return Promise[_0xc202('0x43')]([_0x1a06c5,_0x2d475a])['then'](function(_0xb98cd7){var _0x3beb0a=_0xb98cd7[0x0];var _0x4e2e04=_0xb98cd7[0x1];var _0x2b3238=_['filter'](_0x3beb0a[_0xc202('0x24')],function(_0x4a2a48){return _0x4a2a48[_0xc202('0x25')]==_0x4e2e04['id'];});return _0x1fcc19['status'](0xc8)[_0xc202('0x2c')]({'count':_0x2b3238['length'],'rows':_0x2b3238});})['catch'](handleError(_0x1fcc19));};exports[_0xc202('0x44')]=function(_0x1dc674,_0x31bc10){logger[_0xc202('0x12')](_0xc202('0x45'),_0x1dc674[_0xc202('0x2b')]);var _0x42c898=conferenceValidation[_0xc202('0xb')](_0x1dc674[_0xc202('0x2b')]);if(_0x42c898[_0xc202('0x26')]>0x0){return _0x31bc10['status'](0x190)[_0xc202('0x2c')](_0x42c898);}var _0xc899bd=_0x1dc674['body'][_0xc202('0x2d')];return getAgent(_0xc899bd)[_0xc202('0x22')](function(_0x43fe84){logger[_0xc202('0x12')](_0xc202('0x31'),_0x43fe84[_0xc202('0x1a')]);emit(util[_0xc202('0x32')](_0xc202('0x36'),_0x43fe84['name']),_0xc202('0x46'));return _0x31bc10[_0xc202('0x18')](0xc8)[_0xc202('0x2c')]({'error':![],'message':_0xc202('0x47')});})[_0xc202('0x20')](handleError(_0x31bc10));};exports['transfer']=function(_0x4149fe,_0x39e986){logger[_0xc202('0x12')]('transfer\x20fired:',_0x4149fe[_0xc202('0x2b')]);var _0x4dfb2f=transferValidation['validate'](_0x4149fe['body']);if(_0x4dfb2f[_0xc202('0x26')]>0x0){return _0x39e986[_0xc202('0x18')](0x190)[_0xc202('0x2c')](_0x4dfb2f);}var _0xe05654=_0x4149fe['body'][_0xc202('0x2d')];var _0x5957e8=_0x4149fe[_0xc202('0x2b')][_0xc202('0x35')];var _0x5bb7f8=_0x4149fe[_0xc202('0x2b')][_0xc202('0x48')];return getAgent(_0xe05654)[_0xc202('0x22')](function(_0x4d9423){logger['info']('entityFound:',_0x4d9423[_0xc202('0x1a')]);emit(util[_0xc202('0x32')]('user:%s',_0x4d9423[_0xc202('0x1a')]),_0xc202('0x49'),{'sessionId':_0x5957e8,'transferNumber':_0x5bb7f8});return _0x39e986['status'](0xc8)[_0xc202('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0xc202('0x20')](handleError(_0x39e986));}; \ No newline at end of file +var _0x0ba7=['client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status','send','NotFound','request','code','message','result','findOne','agent','then','VoiceChannels','filter','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','sessionId','hangup\x20executed!','catch','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','unhold','calls','calls\x20fired:','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','../../mysqldb','../../config/environment','util','bluebird'];(function(_0x1c486b,_0x1b36f8){var _0x55fa00=function(_0x4b3008){while(--_0x4b3008){_0x1c486b['push'](_0x1c486b['shift']());}};_0x55fa00(++_0x1b36f8);}(_0x0ba7,0x16d));var _0x70ba=function(_0x26b72b,_0x2ebcc6){_0x26b72b=_0x26b72b-0x0;var _0x19b1ba=_0x0ba7[_0x26b72b];return _0x19b1ba;};'use strict';var path=require(_0x70ba('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x70ba('0x1'))['db'];var config=require(_0x70ba('0x2'));var util=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x70ba('0x5')][_0x70ba('0x6')]({'port':0x232a});var logger=require(_0x70ba('0x7'))(_0x70ba('0x8'));var Redis=require(_0x70ba('0x9'));config[_0x70ba('0xa')]=_[_0x70ba('0xb')](config[_0x70ba('0xa')],{'host':_0x70ba('0xc'),'port':0x18eb});var io=require(_0x70ba('0xd'))(new Redis(config[_0x70ba('0xa')]));var Schema=require(_0x70ba('0xe'));var originateValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'callNumber':{'type':_0x70ba('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x70ba('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'sessionId':{'type':_0x70ba('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x70ba('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x70ba('0x11'),'required':[!![],_0x70ba('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x70ba('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]},'sessionId':{'type':_0x70ba('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x70ba('0xf'),'required':[!![],_0x70ba('0x10')]}});function emit(_0x164521,_0x18334a,_0x3e27e8){logger[_0x70ba('0x13')](_0x164521,_0x18334a,JSON[_0x70ba('0x14')](_0x3e27e8));io['to'](_0x164521)[_0x70ba('0x15')](_0x18334a,_0x3e27e8);}function handleError(_0xb6d69a){return function(_0x5ed907){console['log']('handleError:',_0x5ed907,_0x5ed907 instanceof RangeError);logger[_0x70ba('0x16')](_0x5ed907[_0x70ba('0x17')]);if(_0x5ed907 instanceof RangeError){if(_0x5ed907[_0x70ba('0x18')]){delete _0x5ed907[_0x70ba('0x18')];}_0xb6d69a[_0x70ba('0x19')](0x194)[_0x70ba('0x1a')](_0x5ed907);}else{if(_0x5ed907[_0x70ba('0x18')]){delete _0x5ed907[_0x70ba('0x18')];}_0xb6d69a[_0x70ba('0x19')](0x1f4)[_0x70ba('0x1a')](_0x5ed907);}};}function checkError(){return function(_0x26c039){if(!_0x26c039){throw new RangeError(_0x70ba('0x1b'));}return _0x26c039;};}function respondWithRpcPromise(_0x2a1328,_0x4570b0){return new BPromise(function(_0x273ce4,_0x5ebe9d){var _0x3b31ef=amiClient;return _0x3b31ef[_0x70ba('0x1c')](_0x2a1328,_0x4570b0)['then'](function(_0x123b0c){if(_0x123b0c['error']){if(_0x123b0c['error'][_0x70ba('0x1d')]===0x1f4){return _0x5ebe9d(_0x123b0c['error'][_0x70ba('0x1e')]);}return _0x273ce4(_0x123b0c[_0x70ba('0x16')]['message']);}else{_0x273ce4(_0x123b0c[_0x70ba('0x1f')]);}})['catch'](function(_0x5ad828){_0x5ebe9d(_0x5ad828);});});}function getAgent(_0x39482c){return db['User'][_0x70ba('0x20')]({'where':{'id':_0x39482c,'role':_0x70ba('0x21')}})[_0x70ba('0x22')](checkError());}function getAgentCheckSession(_0x33e218,_0x2c6d18){return new BPromise(function(_0x265423,_0x5a8558){var _0x2d840e=respondWithRpcPromise(_0x70ba('0x23'));var _0x797467=getAgent(_0x33e218);Promise['all']([_0x2d840e,_0x797467])[_0x70ba('0x22')](function(_0x51b5cb){var _0x5955dc=_0x51b5cb[0x0];var _0x505f98=_0x51b5cb[0x1];var _0x77e564=_[_0x70ba('0x24')](_0x5955dc['rows'],function(_0x51b3e3){return _0x51b3e3[_0x70ba('0x25')]==_0x505f98['id']&&_0x51b3e3['sessionId']==_0x2c6d18;});if(_0x77e564[_0x70ba('0x26')]==0x1){_0x265423(_0x505f98);}else{_0x5a8558(new RangeError(_0x70ba('0x27')+_0x2c6d18+_0x70ba('0x28')));}});});}exports[_0x70ba('0x29')]=function(_0x1db0c4,_0x269943){logger[_0x70ba('0x13')](_0x70ba('0x2a'),_0x1db0c4[_0x70ba('0x2b')]);var _0x6055d3=originateValidation[_0x70ba('0xe')](_0x1db0c4['body']);if(_0x6055d3['length']>0x0){return _0x269943[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x6055d3);}var _0x943e49=_0x1db0c4['body']['userId'];var _0x507f00=_0x1db0c4[_0x70ba('0x2b')][_0x70ba('0x2d')];var _0x2200d3=_0x1db0c4['body'][_0x70ba('0x2e')];var _0x5bc56f=_0x1db0c4['body'][_0x70ba('0x2f')];return getAgent(_0x943e49)['then'](function(_0x15774e){logger[_0x70ba('0x13')]('entityFound:',_0x15774e[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x15774e['name']),_0x70ba('0x32'),{'callNumber':_0x507f00,'callerId':_0x2200d3,'callbackUrl':_0x5bc56f});return _0x269943[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x33')});})['catch'](handleError(_0x269943));};exports[_0x70ba('0x34')]=function(_0x569ae3,_0x17707a){logger[_0x70ba('0x13')](_0x70ba('0x35'),_0x569ae3[_0x70ba('0x2b')]);var _0x16ce39=hangupValidation[_0x70ba('0xe')](_0x569ae3[_0x70ba('0x2b')]);if(_0x16ce39['length']>0x0){return _0x17707a[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x16ce39);}var _0x31e713=_0x569ae3[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x473489=_0x569ae3['body'][_0x70ba('0x37')];return getAgent(_0x31e713)[_0x70ba('0x22')](function(_0x1861ed){logger['info']('entityFound:',_0x1861ed['name']);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x1861ed[_0x70ba('0x18')]),'webbar:hangup',{'sessionId':_0x473489});return _0x17707a[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x38')});})[_0x70ba('0x39')](handleError(_0x17707a));};exports[_0x70ba('0x3a')]=function(_0x54e732,_0x5ee74c){logger[_0x70ba('0x13')](_0x70ba('0x3b'),_0x54e732[_0x70ba('0x2b')]);var _0x5a1edb=answerValidation['validate'](_0x54e732[_0x70ba('0x2b')]);if(_0x5a1edb['length']>0x0){return _0x5ee74c[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x5a1edb);}var _0x705ca4=_0x54e732[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x51f4df=_0x54e732[_0x70ba('0x2b')][_0x70ba('0x37')];return getAgent(_0x705ca4)[_0x70ba('0x22')](function(_0x3dc2f7){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x3dc2f7[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x3dc2f7[_0x70ba('0x18')]),_0x70ba('0x3d'),{'sessionId':_0x51f4df});return _0x5ee74c[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':_0x70ba('0x3e')});})[_0x70ba('0x39')](handleError(_0x5ee74c));};exports['hold']=function(_0xd7638f,_0x3121f6){logger['info'](_0x70ba('0x3f'),_0xd7638f[_0x70ba('0x2b')]);var _0x3de825=holdValidation[_0x70ba('0xe')](_0xd7638f[_0x70ba('0x2b')]);if(_0x3de825[_0x70ba('0x26')]>0x0){return _0x3121f6[_0x70ba('0x19')](0x190)['json'](_0x3de825);}var _0x2e2613=_0xd7638f[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x3d1f89=_0xd7638f[_0x70ba('0x2b')][_0x70ba('0x37')];return getAgent(_0x2e2613)[_0x70ba('0x22')](function(_0x400c37){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x400c37[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x400c37[_0x70ba('0x18')]),_0x70ba('0x40'),{'sessionId':_0x3d1f89});return _0x3121f6[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':'hold\x20executed!'});})[_0x70ba('0x39')](handleError(_0x3121f6));};exports[_0x70ba('0x41')]=function(_0x2dc3c5,_0x19c99c){logger['info']('unhold\x20fired:',_0x2dc3c5['body']);var _0x471d19=unholdValidation[_0x70ba('0xe')](_0x2dc3c5['body']);if(_0x471d19['length']>0x0){return _0x19c99c[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x471d19);}var _0x3e3779=_0x2dc3c5[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x4e2397=_0x2dc3c5[_0x70ba('0x2b')]['sessionId'];return getAgent(_0x3e3779)['then'](function(_0x361699){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x361699[_0x70ba('0x18')]);emit(util['format'](_0x70ba('0x31'),_0x361699[_0x70ba('0x18')]),'webbar:unhold',{'sessionId':_0x4e2397});return _0x19c99c['status'](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x70ba('0x39')](handleError(_0x19c99c));};exports[_0x70ba('0x42')]=function(_0x1cb9c7,_0x4cc5b1){logger[_0x70ba('0x13')](_0x70ba('0x43'),_0x4cc5b1[_0x70ba('0x2b')]);var _0x5214eb=callsValidation[_0x70ba('0xe')](_0x1cb9c7[_0x70ba('0x2b')]);if(_0x5214eb['length']>0x0){return _0x4cc5b1['status'](0x190)[_0x70ba('0x2c')](_0x5214eb);}var _0x15b3ab=_0x1cb9c7[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x10e824=respondWithRpcPromise(_0x70ba('0x23'));var _0x44cb31=getAgent(_0x15b3ab);return Promise['all']([_0x10e824,_0x44cb31])[_0x70ba('0x22')](function(_0x27d101){var _0x4de412=_0x27d101[0x0];var _0x508da6=_0x27d101[0x1];var _0x137b7d=_[_0x70ba('0x24')](_0x4de412['rows'],function(_0x4ea26b){return _0x4ea26b[_0x70ba('0x25')]==_0x508da6['id'];});return _0x4cc5b1['status'](0xc8)['json']({'count':_0x137b7d[_0x70ba('0x26')],'rows':_0x137b7d});})[_0x70ba('0x39')](handleError(_0x4cc5b1));};exports[_0x70ba('0x44')]=function(_0xb03649,_0x10bb90){logger[_0x70ba('0x13')](_0x70ba('0x45'),_0xb03649['body']);var _0x46a8a6=conferenceValidation[_0x70ba('0xe')](_0xb03649[_0x70ba('0x2b')]);if(_0x46a8a6[_0x70ba('0x26')]>0x0){return _0x10bb90[_0x70ba('0x19')](0x190)[_0x70ba('0x2c')](_0x46a8a6);}var _0x5d58a1=_0xb03649[_0x70ba('0x2b')]['userId'];return getAgent(_0x5d58a1)[_0x70ba('0x22')](function(_0x4b385b){logger[_0x70ba('0x13')](_0x70ba('0x3c'),_0x4b385b[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x4b385b[_0x70ba('0x18')]),'webbar:conference');return _0x10bb90[_0x70ba('0x19')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x70ba('0x39')](handleError(_0x10bb90));};exports[_0x70ba('0x46')]=function(_0x5b1824,_0x208333){logger['info'](_0x70ba('0x47'),_0x5b1824[_0x70ba('0x2b')]);var _0x378893=transferValidation['validate'](_0x5b1824[_0x70ba('0x2b')]);if(_0x378893['length']>0x0){return _0x208333[_0x70ba('0x19')](0x190)['json'](_0x378893);}var _0x2ee3d0=_0x5b1824[_0x70ba('0x2b')][_0x70ba('0x36')];var _0x4ebc09=_0x5b1824['body'][_0x70ba('0x37')];var _0x530324=_0x5b1824[_0x70ba('0x2b')][_0x70ba('0x48')];return getAgent(_0x2ee3d0)[_0x70ba('0x22')](function(_0x32a246){logger['info'](_0x70ba('0x3c'),_0x32a246[_0x70ba('0x18')]);emit(util[_0x70ba('0x30')](_0x70ba('0x31'),_0x32a246[_0x70ba('0x18')]),_0x70ba('0x49'),{'sessionId':_0x4ebc09,'transferNumber':_0x530324});return _0x208333[_0x70ba('0x19')](0xc8)[_0x70ba('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x70ba('0x39')](handleError(_0x208333));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 887505b..18d7311 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','create','post','addDisposition','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated'];(function(_0x15f603,_0x19466a){var _0x26fd2e=function(_0x57f840){while(--_0x57f840){_0x15f603['push'](_0x15f603['shift']());}};_0x26fd2e(++_0x19466a);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1f2cac,_0x51a59e){_0x1f2cac=_0x1f2cac-0x0;var _0x207a52=_0xc6ac[_0x1f2cac];return _0x207a52;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0xb')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0xb')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);router[_0xcc6a('0xb')](_0xcc6a('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xcc6a('0xb')](_0xcc6a('0x17'),auth[_0xcc6a('0xc')](),controller['getApplications']);router['post']('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x18')]);router[_0xcc6a('0x19')](_0xcc6a('0x12'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1a')]);router[_0xcc6a('0x19')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1b')]);router[_0xcc6a('0x19')](_0xcc6a('0x17'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1c')]);router[_0xcc6a('0x19')](_0xcc6a('0x1d'),controller[_0xcc6a('0x1e')]);router[_0xcc6a('0x19')]('/:id/send',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x1f')]);router[_0xcc6a('0x20')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x21')]);router[_0xcc6a('0x22')](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x23')]);router[_0xcc6a('0x22')](_0xcc6a('0x12'),auth['isAuthenticated'](),controller[_0xcc6a('0x24')]);router[_0xcc6a('0x22')](_0xcc6a('0x14'),auth['isAuthenticated'](),controller[_0xcc6a('0x25')]);router[_0xcc6a('0x22')](_0xcc6a('0x16'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x26')]);module[_0xcc6a('0x27')]=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./whatsappAccount.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 34f8c5c..063c924 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd154=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0xd154,0x75));var _0x4d15=function(_0x44528b,_0x432e95){_0x44528b=_0x44528b-0x0;var _0x5adfba=_0xd154[_0x44528b];return _0x5adfba;};'use strict';var Sequelize=require(_0x4d15('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4d15('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x4d15('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4d15('0x2')],'defaultValue':function(){return rs[_0x4d15('0x3')]();}},'phone':{'type':Sequelize[_0x4d15('0x2')]},'type':{'type':Sequelize[_0x4d15('0x4')](_0x4d15('0x5'),_0x4d15('0x6'))},'accountSid':{'type':Sequelize[_0x4d15('0x2')]},'baseUrl':{'type':Sequelize[_0x4d15('0x2')]},'authToken':{'type':Sequelize[_0x4d15('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4d15('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4d15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4d15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4d15('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4d15('0x8')],'defaultValue':![],'comment':_0x4d15('0xa'),'set':function(_0x487881){if(!_0x487881){this[_0x4d15('0xb')](_0x4d15('0xc'),null);}this[_0x4d15('0xb')](_0x4d15('0xd'),_0x487881);}},'description':{'type':Sequelize[_0x4d15('0x2')]}}; \ No newline at end of file +var _0x4f28=['generate','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','STRING','name'];(function(_0x3af288,_0x94ddce){var _0x516504=function(_0x4041cd){while(--_0x4041cd){_0x3af288['push'](_0x3af288['shift']());}};_0x516504(++_0x94ddce);}(_0x4f28,0x99));var _0x84f2=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x4f28[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x84f2('0x0'));module['exports']={'name':{'type':Sequelize[_0x84f2('0x1')],'unique':_0x84f2('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x84f2('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x84f2('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x84f2('0x1')],'defaultValue':function(){return rs[_0x84f2('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x84f2('0x4'))},'accountSid':{'type':Sequelize[_0x84f2('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x84f2('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x84f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x84f2('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x84f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x84f2('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x84f2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x84f2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x84f2('0x7')],'defaultValue':![],'comment':_0x84f2('0x9'),'set':function(_0x7ce01d){if(!_0x7ce01d){this[_0x84f2('0xa')]('mandatoryDispositionPauseId',null);}this[_0x84f2('0xa')](_0x84f2('0xb'),_0x7ce01d);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 78a4df8..d97406e 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9255=['to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','status','end','sendStatus','stack','name','send','index','WhatsappAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','Pause','mandatoryDispositionPause','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','Disposition','hasOwnProperty','WhatsappAccountId','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','priority','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','createdAt','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','defaults','WhatsappInteraction','spread','interaction','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','List','DESC','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x5f2346,_0x54cd31){var _0x2e0d57=function(_0x4ad842){while(--_0x4ad842){_0x5f2346['push'](_0x5f2346['shift']());}};_0x2e0d57(++_0x54cd31);}(_0x9255,0x17d));var _0x5925=function(_0x46275a,_0x157c56){_0x46275a=_0x46275a-0x0;var _0x1b6b39=_0x9255[_0x46275a];return _0x1b6b39;};'use strict';var emlformat=require(_0x5925('0x0'));var rimraf=require(_0x5925('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5925('0x2'));var rp=require(_0x5925('0x3'));var moment=require('moment');var BPromise=require(_0x5925('0x4'));var Mustache=require(_0x5925('0x5'));var util=require('util');var path=require(_0x5925('0x6'));var sox=require('sox');var csv=require(_0x5925('0x7'));var ejs=require(_0x5925('0x8'));var fs=require('fs');var fs_extra=require(_0x5925('0x9'));var _=require('lodash');var squel=require(_0x5925('0xa'));var crypto=require(_0x5925('0xb'));var jsforce=require(_0x5925('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5925('0x7'));var querystring=require(_0x5925('0xd'));var Papa=require(_0x5925('0xe'));var Redis=require(_0x5925('0xf'));var authService=require(_0x5925('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5925('0x11'));var logger=require('../../config/logger')(_0x5925('0x12'));var utils=require(_0x5925('0x13'));var config=require(_0x5925('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5925('0x15'))['db'];config[_0x5925('0x16')]=_['defaults'](config[_0x5925('0x16')],{'host':_0x5925('0x17'),'port':0x18eb});var socket=require(_0x5925('0x18'))(new Redis(config[_0x5925('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x5925('0x19'));var client=jayson[_0x5925('0x1a')][_0x5925('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2cca22,_0x2f848f,_0x2ecbbc,_0x39132b){return new BPromise(function(_0x1c488d,_0x583a25){var _0x36b04f=_0x39132b||client;return _0x36b04f[_0x5925('0x1c')](_0x2cca22,_0x2ecbbc)[_0x5925('0x1d')](function(_0x5c8ecb){logger[_0x5925('0x1e')](_0x5925('0x1f'),_0x2f848f,_0x5925('0x20'));logger['debug'](_0x5925('0x21'),_0x2f848f,_0x5925('0x20'),JSON[_0x5925('0x22')](_0x5c8ecb));if(_0x5c8ecb[_0x5925('0x23')]){if(_0x5c8ecb[_0x5925('0x23')][_0x5925('0x24')]===0x1f4){logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x5c8ecb['error'][_0x5925('0x25')]);return _0x583a25(_0x5c8ecb['error'][_0x5925('0x25')]);}logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x5c8ecb[_0x5925('0x23')][_0x5925('0x25')]);return _0x1c488d(_0x5c8ecb[_0x5925('0x23')][_0x5925('0x25')]);}else{logger['info'](_0x5925('0x1f'),_0x2f848f,_0x5925('0x20'));_0x1c488d(_0x5c8ecb[_0x5925('0x26')]['message']);}})['catch'](function(_0x3a1616){logger[_0x5925('0x23')](_0x5925('0x1f'),_0x2f848f,_0x3a1616);_0x583a25(_0x3a1616);});});}function respondWithStatusCode(_0xf19357,_0x3e2b71){_0x3e2b71=_0x3e2b71||0xcc;return function(_0x144b68){if(_0x144b68){return _0xf19357['sendStatus'](_0x3e2b71);}return _0xf19357['status'](_0x3e2b71)['end']();};}function respondWithResult(_0x544c34,_0x1c7ea9){_0x1c7ea9=_0x1c7ea9||0xc8;return function(_0x3ce7af){if(_0x3ce7af){return _0x544c34['status'](_0x1c7ea9)[_0x5925('0x27')](_0x3ce7af);}};}function respondWithFilteredResult(_0x2901a9,_0x2274e5){return function(_0x15b2ac){if(_0x15b2ac){var _0x36b8cd=typeof _0x2274e5[_0x5925('0x28')]===_0x5925('0x29')&&typeof _0x2274e5[_0x5925('0x2a')]===_0x5925('0x29');var _0x5bdb61=_0x15b2ac[_0x5925('0x2b')];var _0x15f805=_0x36b8cd?0x0:_0x2274e5[_0x5925('0x28')];var _0x2ad6d2=_0x36b8cd?_0x15b2ac[_0x5925('0x2b')]:_0x2274e5['offset']+_0x2274e5[_0x5925('0x2a')];var _0x353c05;if(_0x2ad6d2>=_0x5bdb61){_0x2ad6d2=_0x5bdb61;_0x353c05=0xc8;}else{_0x353c05=0xce;}_0x2901a9['status'](_0x353c05);return _0x2901a9[_0x5925('0x2c')](_0x5925('0x2d'),_0x15f805+'-'+_0x2ad6d2+'/'+_0x5bdb61)[_0x5925('0x27')](_0x15b2ac);}return null;};}function patchUpdates(_0xaea95){return function(_0x32aee6){try{jsonpatch[_0x5925('0x2e')](_0x32aee6,_0xaea95,!![]);}catch(_0x3f4bc1){return BPromise[_0x5925('0x2f')](_0x3f4bc1);}return _0x32aee6[_0x5925('0x30')]();};}function saveUpdates(_0x123fae,_0x5cbb6b){return function(_0x2b0f9d){if(_0x2b0f9d){return _0x2b0f9d['update'](_0x123fae)[_0x5925('0x1d')](function(_0x45e4d0){return _0x45e4d0;});}return null;};}function removeEntity(_0x118615,_0x126b30){return function(_0x1c8479){if(_0x1c8479){return _0x1c8479[_0x5925('0x31')]()[_0x5925('0x1d')](function(){var _0x29b3d6=_0x1c8479[_0x5925('0x32')]({'plain':!![]});var _0x21968a=_0x5925('0x33');return db[_0x5925('0x34')][_0x5925('0x31')]({'where':{'type':_0x21968a,'resourceId':_0x29b3d6['id']}})['then'](function(){return _0x1c8479;});})['then'](function(){_0x118615[_0x5925('0x35')](0xcc)[_0x5925('0x36')]();});}};}function handleEntityNotFound(_0x3b3c71,_0x5f3e63){return function(_0x6c671a){if(!_0x6c671a){_0x3b3c71[_0x5925('0x37')](0x194);}return _0x6c671a;};}function handleError(_0xdef586,_0x236ddf){_0x236ddf=_0x236ddf||0x1f4;return function(_0xd2d5ff){logger[_0x5925('0x23')](_0xd2d5ff[_0x5925('0x38')]);if(_0xd2d5ff[_0x5925('0x39')]){delete _0xd2d5ff['name'];}_0xdef586['status'](_0x236ddf)[_0x5925('0x3a')](_0xd2d5ff);};}exports[_0x5925('0x3b')]=function(_0x5e3008,_0x4e8369){var _0x1e6249={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1ee075={},_0x1c48fe={'count':0x0,'rows':[]};var _0x2fb90a=_['map'](db[_0x5925('0x3c')][_0x5925('0x3d')],function(_0x344518){return{'name':_0x344518['fieldName'],'type':_0x344518[_0x5925('0x3e')][_0x5925('0x3f')]};});_0x1ee075[_0x5925('0x40')]=_[_0x5925('0x41')](_0x2fb90a,'name');_0x1ee075[_0x5925('0x42')]=_[_0x5925('0x43')](_0x5e3008['query']);_0x1ee075[_0x5925('0x44')]=_[_0x5925('0x45')](_0x1ee075[_0x5925('0x40')],_0x1ee075['query']);_0x1e6249[_0x5925('0x46')]=_[_0x5925('0x45')](_0x1ee075[_0x5925('0x40')],qs['fields'](_0x5e3008[_0x5925('0x42')]['fields']));_0x1e6249[_0x5925('0x46')]=_0x1e6249[_0x5925('0x46')][_0x5925('0x47')]?_0x1e6249[_0x5925('0x46')]:_0x1ee075[_0x5925('0x40')];if(!_0x5e3008['query']['hasOwnProperty'](_0x5925('0x48'))){_0x1e6249[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x5e3008[_0x5925('0x42')][_0x5925('0x2a')]);_0x1e6249[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x5e3008['query'][_0x5925('0x28')]);}_0x1e6249[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x5e3008[_0x5925('0x42')][_0x5925('0x4a')]);_0x1e6249[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x5e3008[_0x5925('0x42')],_0x1ee075['filters']),_0x2fb90a);if(_0x5e3008['query'][_0x5925('0x4d')]){_0x1e6249[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x1e6249['where'],{'$or':_['map'](_0x2fb90a,function(_0x41b909){if(_0x41b909[_0x5925('0x3e')]!==_0x5925('0x4f')){var _0x2bb35a={};_0x2bb35a[_0x41b909['name']]={'$like':'%'+_0x5e3008[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x2bb35a;}})});}_0x1e6249=_['merge']({},_0x1e6249,_0x5e3008[_0x5925('0x50')]);var _0x118a7f={'where':_0x1e6249[_0x5925('0x4b')]};return db[_0x5925('0x3c')][_0x5925('0x2b')](_0x118a7f)[_0x5925('0x1d')](function(_0x182ec4){_0x1c48fe[_0x5925('0x2b')]=_0x182ec4;if(_0x5e3008[_0x5925('0x42')][_0x5925('0x51')]){_0x1e6249['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x1e6249);})[_0x5925('0x1d')](function(_0x4f7601){_0x1c48fe[_0x5925('0x52')]=_0x4f7601;return _0x1c48fe;})[_0x5925('0x1d')](respondWithFilteredResult(_0x4e8369,_0x1e6249))[_0x5925('0x53')](handleError(_0x4e8369,null));};exports[_0x5925('0x54')]=function(_0x1b2bdb,_0x41cb64){var _0x5cf648={'raw':![],'where':{'id':_0x1b2bdb[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0x56')],'as':_0x5925('0x57')}]},_0x27d323={};_0x27d323['model']=_['keys'](db[_0x5925('0x3c')]['rawAttributes']);_0x27d323[_0x5925('0x42')]=_['keys'](_0x1b2bdb[_0x5925('0x42')]);_0x27d323['filters']=_[_0x5925('0x45')](_0x27d323['model'],_0x27d323[_0x5925('0x42')]);_0x5cf648[_0x5925('0x46')]=_[_0x5925('0x45')](_0x27d323[_0x5925('0x40')],qs[_0x5925('0x58')](_0x1b2bdb[_0x5925('0x42')][_0x5925('0x58')]));_0x5cf648[_0x5925('0x46')]=_0x5cf648[_0x5925('0x46')]['length']?_0x5cf648['attributes']:_0x27d323['model'];if(_0x1b2bdb[_0x5925('0x42')]['includeAll']){_0x5cf648['include']=[{'all':!![]}];}_0x5cf648=_[_0x5925('0x4e')]({},_0x5cf648,_0x1b2bdb[_0x5925('0x50')]);return db[_0x5925('0x3c')]['find'](_0x5cf648)[_0x5925('0x1d')](handleEntityNotFound(_0x41cb64,null))[_0x5925('0x1d')](respondWithResult(_0x41cb64,null))['catch'](handleError(_0x41cb64,null));};exports[_0x5925('0x59')]=function(_0x5c1a76,_0x562d52){return db[_0x5925('0x3c')][_0x5925('0x59')](_0x5c1a76[_0x5925('0x5a')],{})[_0x5925('0x1d')](function(_0x2c1871){var _0x53c523=_0x5c1a76[_0x5925('0x5b')][_0x5925('0x32')]({'plain':!![]});if(!_0x53c523)throw new Error(_0x5925('0x5c'));if(_0x53c523[_0x5925('0x5d')]===_0x5925('0x5b')){var _0x56da6=_0x2c1871['get']({'plain':!![]});var _0x33edcc=_0x5925('0x33');return db['UserProfileSection'][_0x5925('0x5e')]({'where':{'name':_0x33edcc,'userProfileId':_0x53c523['userProfileId']},'raw':!![]})['then'](function(_0x1767d0){if(_0x1767d0&&_0x1767d0[_0x5925('0x5f')]===0x0){return db[_0x5925('0x34')]['create']({'name':_0x56da6[_0x5925('0x39')],'resourceId':_0x56da6['id'],'type':_0x1767d0[_0x5925('0x39')],'sectionId':_0x1767d0['id']},{})[_0x5925('0x1d')](function(){return _0x2c1871;});}else{return _0x2c1871;}})[_0x5925('0x53')](function(_0x526656){logger[_0x5925('0x23')](_0x5925('0x60'),_0x526656);throw _0x526656;});}return _0x2c1871;})[_0x5925('0x1d')](respondWithResult(_0x562d52,0xc9))[_0x5925('0x53')](handleError(_0x562d52,null));};exports[_0x5925('0x61')]=function(_0x278433,_0x21c136){if(_0x278433['body']['id']){delete _0x278433[_0x5925('0x5a')]['id'];}return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x278433['params']['id']},'include':[{'model':db['Pause'],'as':_0x5925('0x57')}]})[_0x5925('0x1d')](handleEntityNotFound(_0x21c136,null))[_0x5925('0x1d')](saveUpdates(_0x278433[_0x5925('0x5a')],null))[_0x5925('0x1d')](respondWithResult(_0x21c136,null))[_0x5925('0x53')](handleError(_0x21c136,null));};exports[_0x5925('0x31')]=function(_0x3cfbb9,_0x2548f1){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x3cfbb9[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x2548f1,null))[_0x5925('0x1d')](removeEntity(_0x2548f1,null))[_0x5925('0x53')](handleError(_0x2548f1,null));};exports[_0x5925('0x62')]=function(_0x353ed9,_0x2b4827){return db['WhatsappAccount'][_0x5925('0x62')]()['then'](respondWithResult(_0x2b4827,null))[_0x5925('0x53')](handleError(_0x2b4827,null));};exports[_0x5925('0x63')]=function(_0x34aecd,_0x51c9b1,_0x462388){if(_0x34aecd['body']['id']){delete _0x34aecd[_0x5925('0x5a')]['id'];}return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x34aecd[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x51c9b1,null))['then'](function(_0x1fc164){if(_0x1fc164){_0x34aecd[_0x5925('0x5a')]['WhatsappAccountId']=_0x1fc164['id'];return db['Disposition'][_0x5925('0x59')](_0x34aecd[_0x5925('0x5a')]);}})[_0x5925('0x1d')](respondWithResult(_0x51c9b1,null))[_0x5925('0x53')](handleError(_0x51c9b1,null));};exports[_0x5925('0x64')]=function(_0x58f3b6,_0x258bd4,_0x3ffb1a){var _0x417100={'raw':![],'where':{}};var _0x19d004={};var _0x125b7f={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x58f3b6['params']['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x258bd4,null))['then'](function(_0x541663){if(_0x541663){_0x19d004[_0x5925('0x40')]=_[_0x5925('0x43')](db[_0x5925('0x65')][_0x5925('0x3d')]);_0x19d004[_0x5925('0x42')]=_[_0x5925('0x43')](_0x58f3b6['query']);_0x19d004[_0x5925('0x44')]=_[_0x5925('0x45')](_0x19d004[_0x5925('0x40')],_0x19d004[_0x5925('0x42')]);_0x417100[_0x5925('0x46')]=_[_0x5925('0x45')](_0x19d004[_0x5925('0x40')],qs[_0x5925('0x58')](_0x58f3b6[_0x5925('0x42')][_0x5925('0x58')]));_0x417100['attributes']=_0x417100['attributes'][_0x5925('0x47')]?_0x417100[_0x5925('0x46')]:_0x19d004[_0x5925('0x40')];if(!_0x58f3b6['query'][_0x5925('0x66')](_0x5925('0x48'))){_0x417100[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x58f3b6['query'][_0x5925('0x2a')]);_0x417100[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x58f3b6[_0x5925('0x42')]['offset']);}_0x417100[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x58f3b6[_0x5925('0x42')][_0x5925('0x4a')]);_0x417100[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x58f3b6[_0x5925('0x42')],_0x19d004[_0x5925('0x44')]));_0x417100[_0x5925('0x4b')][_0x5925('0x67')]=_0x541663['id'];if(_0x58f3b6['query']['filter']){_0x417100[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x417100['where'],{'$or':_[_0x5925('0x41')](_0x417100[_0x5925('0x46')],function(_0x2f1236){var _0x3a2db4={};_0x3a2db4[_0x2f1236]={'$like':'%'+_0x58f3b6[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x3a2db4;})});}_0x417100=_[_0x5925('0x4e')]({},_0x417100,_0x58f3b6[_0x5925('0x50')]);return db[_0x5925('0x65')][_0x5925('0x2b')]({'where':_0x417100[_0x5925('0x4b')]})[_0x5925('0x1d')](function(_0x281e82){_0x125b7f[_0x5925('0x2b')]=_0x281e82;if(_0x58f3b6[_0x5925('0x42')][_0x5925('0x51')]){_0x417100[_0x5925('0x68')]=[{'all':!![]}];}return db['Disposition'][_0x5925('0x69')](_0x417100);})['then'](function(_0x499d82){_0x125b7f[_0x5925('0x52')]=_0x499d82;return _0x125b7f;});}})['then'](respondWithFilteredResult(_0x258bd4,_0x417100))[_0x5925('0x53')](handleError(_0x258bd4,null));};exports[_0x5925('0x6a')]=function(_0x242e8e,_0x3ea4af,_0x27d2c0){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x242e8e[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ea4af,null))[_0x5925('0x1d')](function(_0x5ed3c0){if(_0x5ed3c0){return _0x5ed3c0[_0x5925('0x6a')](_0x242e8e[_0x5925('0x42')][_0x5925('0x6b')]);}})[_0x5925('0x1d')](respondWithStatusCode(_0x3ea4af,null))[_0x5925('0x53')](handleError(_0x3ea4af,null));};exports[_0x5925('0x6c')]=function(_0x586744,_0x18924c,_0x116784){if(_0x586744['body']['id']){delete _0x586744[_0x5925('0x5a')]['id'];}return db['WhatsappAccount'][_0x5925('0x5e')]({'where':{'id':_0x586744[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x18924c,null))['then'](function(_0x524f17){if(_0x524f17){_0x586744[_0x5925('0x5a')][_0x5925('0x67')]=_0x524f17['id'];return db[_0x5925('0x6d')][_0x5925('0x59')](_0x586744['body']);}})[_0x5925('0x1d')](respondWithResult(_0x18924c,null))[_0x5925('0x53')](handleError(_0x18924c,null));};exports['getAnswers']=function(_0x5d794b,_0x3359dc,_0xfe7181){var _0x5b2635={'raw':![],'where':{}};var _0x4da127={};var _0xe19505={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5925('0x6e')]({'where':{'id':_0x5d794b[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x3359dc,null))[_0x5925('0x1d')](function(_0xb1372e){if(_0xb1372e){_0x4da127['model']=_['keys'](db['CannedAnswer'][_0x5925('0x3d')]);_0x4da127[_0x5925('0x42')]=_['keys'](_0x5d794b[_0x5925('0x42')]);_0x4da127[_0x5925('0x44')]=_[_0x5925('0x45')](_0x4da127[_0x5925('0x40')],_0x4da127[_0x5925('0x42')]);_0x5b2635['attributes']=_['intersection'](_0x4da127[_0x5925('0x40')],qs[_0x5925('0x58')](_0x5d794b[_0x5925('0x42')][_0x5925('0x58')]));_0x5b2635[_0x5925('0x46')]=_0x5b2635[_0x5925('0x46')][_0x5925('0x47')]?_0x5b2635[_0x5925('0x46')]:_0x4da127[_0x5925('0x40')];if(!_0x5d794b[_0x5925('0x42')]['hasOwnProperty']('nolimit')){_0x5b2635[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x5d794b[_0x5925('0x42')]['limit']);_0x5b2635[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x5d794b[_0x5925('0x42')][_0x5925('0x28')]);}_0x5b2635[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x5d794b[_0x5925('0x42')][_0x5925('0x4a')]);_0x5b2635['where']=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x5d794b['query'],_0x4da127['filters']));_0x5b2635[_0x5925('0x4b')]['WhatsappAccountId']=_0xb1372e['id'];if(_0x5d794b[_0x5925('0x42')]['filter']){_0x5b2635[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x5b2635['where'],{'$or':_['map'](_0x5b2635[_0x5925('0x46')],function(_0x747838){var _0x5938da={};_0x5938da[_0x747838]={'$like':'%'+_0x5d794b[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x5938da;})});}_0x5b2635=_[_0x5925('0x4e')]({},_0x5b2635,_0x5d794b[_0x5925('0x50')]);return db[_0x5925('0x6d')][_0x5925('0x2b')]({'where':_0x5b2635[_0x5925('0x4b')]})[_0x5925('0x1d')](function(_0xcd27d9){_0xe19505[_0x5925('0x2b')]=_0xcd27d9;if(_0x5d794b['query'][_0x5925('0x51')]){_0x5b2635['include']=[{'all':!![]}];}return db[_0x5925('0x6d')][_0x5925('0x69')](_0x5b2635);})[_0x5925('0x1d')](function(_0x54352f){_0xe19505[_0x5925('0x52')]=_0x54352f;return _0xe19505;});}})[_0x5925('0x1d')](respondWithFilteredResult(_0x3359dc,_0x5b2635))['catch'](handleError(_0x3359dc,null));};exports[_0x5925('0x6f')]=function(_0x13b183,_0x365c25,_0x24aa60){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x13b183[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x365c25,null))[_0x5925('0x1d')](function(_0x2e5255){if(_0x2e5255){return _0x2e5255['removeAnswers'](_0x13b183[_0x5925('0x42')][_0x5925('0x6b')]);}})[_0x5925('0x1d')](respondWithStatusCode(_0x365c25,null))[_0x5925('0x53')](handleError(_0x365c25,null));};exports[_0x5925('0x70')]=function(_0x4c453b,_0x3602d4,_0x4b54cb){return db['WhatsappAccount'][_0x5925('0x5e')]({'where':{'id':_0x4c453b['params']['id']}})['then'](handleEntityNotFound(_0x3602d4,null))['then'](function(_0x221c3b){if(_0x221c3b){return _0x221c3b[_0x5925('0x70')](_0x4c453b[_0x5925('0x5a')][_0x5925('0x6b')],_['omit'](_0x4c453b[_0x5925('0x5a')],[_0x5925('0x6b'),'id'])||{})['spread'](function(_0x50ba60){for(var _0x426114=0x0;_0x426114<_0x4c453b['body'][_0x5925('0x6b')]['length'];_0x426114+=0x1){socket[_0x5925('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x4c453b[_0x5925('0x5a')][_0x5925('0x6b')][_0x426114]),'WhatsappAccountId':Number(_0x4c453b['params']['id'])});}return _0x50ba60;});}})[_0x5925('0x1d')](respondWithResult(_0x3602d4,null))[_0x5925('0x53')](handleError(_0x3602d4,null));};exports[_0x5925('0x72')]=function(_0x59110f,_0x26f891,_0x574648){return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x59110f['params']['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x26f891,null))['then'](function(_0x17d86e){if(_0x17d86e){return _0x17d86e[_0x5925('0x72')](_0x59110f[_0x5925('0x42')][_0x5925('0x6b')])[_0x5925('0x1d')](function(){if(_[_0x5925('0x73')](_0x59110f[_0x5925('0x42')]['ids'])){for(var _0x628c=0x0;_0x628c<_0x59110f['query']['ids'][_0x5925('0x47')];_0x628c+=0x1){socket[_0x5925('0x71')](_0x5925('0x74'),{'UserId':Number(_0x59110f[_0x5925('0x42')][_0x5925('0x6b')][_0x628c]),'WhatsappAccountId':Number(_0x59110f[_0x5925('0x55')]['id'])});}}else{socket['emit'](_0x5925('0x74'),{'UserId':Number(_0x59110f['query'][_0x5925('0x6b')]),'WhatsappAccountId':Number(_0x59110f[_0x5925('0x55')]['id'])});}});}})[_0x5925('0x1d')](respondWithStatusCode(_0x26f891,null))[_0x5925('0x53')](handleError(_0x26f891,null));};exports[_0x5925('0x75')]=function(_0x56ab43,_0x5e4e74,_0x59ed4b){var _0x5e3a6c={};var _0xcc8bc1={};var _0x182701;var _0x299a3b;return db[_0x5925('0x3c')]['findOne']({'where':{'id':_0x56ab43[_0x5925('0x55')]['id']}})[_0x5925('0x1d')](handleEntityNotFound(_0x5e4e74,null))['then'](function(_0x59322b){if(_0x59322b){_0x182701=_0x59322b;_0xcc8bc1[_0x5925('0x40')]=_['keys'](db[_0x5925('0x76')]['rawAttributes']);_0xcc8bc1[_0x5925('0x42')]=_[_0x5925('0x43')](_0x56ab43[_0x5925('0x42')]);_0xcc8bc1[_0x5925('0x44')]=_[_0x5925('0x45')](_0xcc8bc1[_0x5925('0x40')],_0xcc8bc1[_0x5925('0x42')]);_0x5e3a6c[_0x5925('0x46')]=_[_0x5925('0x45')](_0xcc8bc1['model'],qs[_0x5925('0x58')](_0x56ab43[_0x5925('0x42')]['fields']));_0x5e3a6c['attributes']=_0x5e3a6c['attributes'][_0x5925('0x47')]?_0x5e3a6c['attributes']:_0xcc8bc1[_0x5925('0x40')];_0x5e3a6c['order']=qs[_0x5925('0x4a')](_0x56ab43['query'][_0x5925('0x4a')]);_0x5e3a6c[_0x5925('0x4b')]=qs[_0x5925('0x44')](_['pick'](_0x56ab43[_0x5925('0x42')],_0xcc8bc1['filters']));if(_0x56ab43['query'][_0x5925('0x4d')]){_0x5e3a6c[_0x5925('0x4b')]=_['merge'](_0x5e3a6c[_0x5925('0x4b')],{'$or':_[_0x5925('0x41')](_0x5e3a6c[_0x5925('0x46')],function(_0x1747dc){var _0x314a80={};_0x314a80[_0x1747dc]={'$like':'%'+_0x56ab43[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x314a80;})});}_0x5e3a6c=_[_0x5925('0x4e')]({},_0x5e3a6c,_0x56ab43[_0x5925('0x50')]);return _0x182701[_0x5925('0x75')](_0x5e3a6c);}})[_0x5925('0x1d')](function(_0x30ab5e){if(_0x30ab5e){_0x299a3b=_0x30ab5e[_0x5925('0x47')];if(!_0x56ab43[_0x5925('0x42')]['hasOwnProperty'](_0x5925('0x48'))){_0x5e3a6c[_0x5925('0x2a')]=qs['limit'](_0x56ab43[_0x5925('0x42')]['limit']);_0x5e3a6c['offset']=qs[_0x5925('0x28')](_0x56ab43[_0x5925('0x42')][_0x5925('0x28')]);}return _0x182701[_0x5925('0x75')](_0x5e3a6c);}})[_0x5925('0x1d')](function(_0xb6d49a){if(_0xb6d49a){return _0xb6d49a?{'count':_0x299a3b,'rows':_0xb6d49a}:null;}})['then'](respondWithResult(_0x5e4e74,null))[_0x5925('0x53')](handleError(_0x5e4e74,null));};exports[_0x5925('0x77')]=function(_0x590ef2,_0x5df5ab){var _0x464e44=_0x590ef2[_0x5925('0x55')]['id'];var _0x56744e=_0x590ef2['body'];var _0x406b9a=0xc8;var _0x372757=null;return db['sequelize'][_0x5925('0x78')]({'isolationLevel':db['sequelize'][_0x5925('0x79')][_0x5925('0x7a')]['READ_COMMITTED']},function(_0x1edf2a){return db[_0x5925('0x3c')][_0x5925('0x6e')]({'where':{'id':_0x464e44},'transaction':_0x1edf2a})[_0x5925('0x1d')](function(_0x437117){if(_0x437117){return db[_0x5925('0x7b')][_0x5925('0x31')]({'where':{'WhatsappAccountId':_0x464e44},'transaction':_0x1edf2a})[_0x5925('0x1d')](function(){var _0x36ca27=_[_0x5925('0x41')](_0x56744e,function(_0x337c5a){_0x337c5a[_0x5925('0x67')]=_0x464e44;return _0x337c5a;});return db[_0x5925('0x7b')][_0x5925('0x7c')](_0x36ca27,{'transaction':_0x1edf2a});});}else{_0x406b9a=0x194;_0x372757=[];}});})[_0x5925('0x1d')](function(){if(_0x406b9a!==0x194){return db[_0x5925('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x464e44},'order':_0x5925('0x7d')})['then'](function(_0x3cfcb2){_0x372757=_0x3cfcb2;});}})[_0x5925('0x53')](function(_0x34b21d){_0x406b9a=0x1f4;logger['error'](_0x34b21d[_0x5925('0x38')]);if(_0x34b21d['name']){delete _0x34b21d[_0x5925('0x39')];}_0x372757=_0x34b21d;})[_0x5925('0x7e')](function(){if(_0x372757===null){_0x5df5ab[_0x5925('0x37')](_0x406b9a);}else{if(_0x406b9a===0x1f4){_0x5df5ab['status'](_0x406b9a)[_0x5925('0x3a')](_0x372757);}else{_0x5df5ab[_0x5925('0x35')](_0x406b9a)[_0x5925('0x27')](_0x372757);}}});};exports[_0x5925('0x7f')]=function(_0x2683bc,_0x49ef7f,_0x3233ab){var _0x1d9948={};var _0x2d704d={};var _0x52a759;var _0x3dbd0d;return db[_0x5925('0x3c')][_0x5925('0x6e')]({'where':{'id':_0x2683bc[_0x5925('0x55')]['id']}})['then'](handleEntityNotFound(_0x49ef7f,null))[_0x5925('0x1d')](function(_0x4cc9fa){if(_0x4cc9fa){_0x52a759=_0x4cc9fa;_0x2d704d[_0x5925('0x40')]=_[_0x5925('0x43')](db['WhatsappApplication'][_0x5925('0x3d')]);_0x2d704d['query']=_[_0x5925('0x43')](_0x2683bc[_0x5925('0x42')]);_0x2d704d[_0x5925('0x44')]=_[_0x5925('0x45')](_0x2d704d[_0x5925('0x40')],_0x2d704d[_0x5925('0x42')]);_0x1d9948['attributes']=_[_0x5925('0x45')](_0x2d704d[_0x5925('0x40')],qs[_0x5925('0x58')](_0x2683bc[_0x5925('0x42')][_0x5925('0x58')]));_0x1d9948['attributes']=_0x1d9948['attributes'][_0x5925('0x47')]?_0x1d9948[_0x5925('0x46')]:_0x2d704d[_0x5925('0x40')];_0x1d9948[_0x5925('0x49')]=qs[_0x5925('0x4a')](_0x2683bc[_0x5925('0x42')][_0x5925('0x4a')]);_0x1d9948[_0x5925('0x4b')]=qs[_0x5925('0x44')](_[_0x5925('0x4c')](_0x2683bc['query'],_0x2d704d[_0x5925('0x44')]));if(_0x2683bc[_0x5925('0x42')][_0x5925('0x4d')]){_0x1d9948[_0x5925('0x4b')]=_[_0x5925('0x4e')](_0x1d9948[_0x5925('0x4b')],{'$or':_[_0x5925('0x41')](_0x1d9948[_0x5925('0x46')],function(_0x5bb172){var _0x2227c3={};_0x2227c3[_0x5bb172]={'$like':'%'+_0x2683bc[_0x5925('0x42')][_0x5925('0x4d')]+'%'};return _0x2227c3;})});}_0x1d9948=_[_0x5925('0x4e')]({},_0x1d9948,_0x2683bc[_0x5925('0x50')]);return _0x52a759[_0x5925('0x7f')](_0x1d9948);}})[_0x5925('0x1d')](function(_0x390844){if(_0x390844){_0x3dbd0d=_0x390844[_0x5925('0x47')];if(!_0x2683bc[_0x5925('0x42')][_0x5925('0x66')](_0x5925('0x48'))){_0x1d9948[_0x5925('0x2a')]=qs[_0x5925('0x2a')](_0x2683bc[_0x5925('0x42')]['limit']);_0x1d9948[_0x5925('0x28')]=qs[_0x5925('0x28')](_0x2683bc[_0x5925('0x42')][_0x5925('0x28')]);}return _0x52a759[_0x5925('0x7f')](_0x1d9948);}})['then'](function(_0x154a34){if(_0x154a34){return _0x154a34?{'count':_0x3dbd0d,'rows':_0x154a34}:null;}})[_0x5925('0x1d')](respondWithResult(_0x49ef7f,null))[_0x5925('0x53')](handleError(_0x49ef7f,null));};exports['notify']=function(_0x60db3c,_0x186cc3,_0x12433c){var _0x17eff3={'channel':_0x5925('0x80')};var _0x3c2339=[];var _0xfc0d01=[];var _0x4878c1={};return db['WhatsappAccount']['find']({'where':{'id':_0x60db3c[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0x7b')],'as':_0x5925('0x81')}]})[_0x5925('0x1d')](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x5b4ce4){_0x17eff3[_0x5925('0x82')]=_0x5b4ce4;if(_0x17eff3['account']&&_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x83')&&_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')]){if(_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][_0x5925('0x47')]===0x0)return;if(_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][0x0][_0x5925('0x85')]!==_0x5925('0x86'))return;return db[_0x5925('0x87')][_0x5925('0x61')]({'read':!![],'readAt':_0x60db3c['body'][_0x5925('0x84')][0x0][_0x5925('0x88')]},{'where':{'messageId':_0x60db3c[_0x5925('0x5a')][_0x5925('0x84')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x508211){return _0x186cc3[_0x5925('0x35')](0xc8)['json'](_0x508211);});}_0x17eff3[_0x5925('0x89')]=_[_0x5925('0x8a')](_0x5b4ce4[_0x5925('0x81')],[_0x5925('0x7d')],[_0x5925('0x8b')]);if(_0x17eff3[_0x5925('0x82')][_0x5925('0x81')]){delete _0x17eff3[_0x5925('0x82')][_0x5925('0x81')];}return db['CmContact']['describe']()['then'](function(_0x4ac0f2){if(!_0x4ac0f2){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0x8e'));}_0x3c2339=_['difference'](_[_0x5925('0x43')](_0x4ac0f2),['createdAt',_0x5925('0x8f')]);_0xfc0d01=_[_0x5925('0x90')](_[_0x5925('0x43')](_0x4ac0f2),[_0x5925('0x91'),_0x5925('0x8f'),'CompanyId',_0x5925('0x92')]);_0x17eff3['body']={'mapKey':_0x5925('0x93')};if(_0x17eff3[_0x5925('0x82')]&&_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x94')){_0x17eff3['body'][_0x5925('0x95')]=_0x60db3c[_0x5925('0x5a')]['From'][_0x5925('0x96')](_0x5925('0x97'),'');_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x98')];_0x17eff3[_0x5925('0x5a')][_0x5925('0x99')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x9a')];}if(_0x17eff3['account']&&_0x17eff3[_0x5925('0x82')]['type']==='sinch'){_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')]=_0x60db3c['body'][_0x5925('0x9b')][0x0][_0x5925('0x95')];_0x17eff3['body'][_0x5925('0x5a')]=_0x60db3c['body'][_0x5925('0x9b')][0x0][_0x5925('0x25')][_0x5925('0x5a')];_0x17eff3[_0x5925('0x5a')][_0x5925('0x99')]=_0x60db3c[_0x5925('0x5a')][_0x5925('0x9b')][0x0][_0x5925('0x9c')];}if(_0x17eff3[_0x5925('0x5a')]['id']){delete _0x17eff3[_0x5925('0x5a')]['id'];}if(_[_0x5925('0x9d')](_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0x9e'));}if(_[_0x5925('0x9d')](_0x17eff3[_0x5925('0x5a')]['body'])||_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')]===''){throw new db['Sequelize'][(_0x5925('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5925('0x9d')](_0x17eff3['body'][_0x5925('0x9f')])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0xa0')+_0xfc0d01);}if(!_[_0x5925('0xa1')](_0xfc0d01,_0x17eff3[_0x5925('0x5a')]['mapKey'])){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))](_0x5925('0xa2')+_0xfc0d01);}_0x4878c1[_0x17eff3[_0x5925('0x5a')][_0x5925('0x9f')]]=_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')];return db[_0x5925('0xa3')][_0x5925('0x5e')]({'where':{'id':_0x17eff3[_0x5925('0x82')]['ListId']},'include':[{'model':db[_0x5925('0xa4')],'as':_0x5925('0xa5'),'where':_0x4878c1,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x5925('0x1d')](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x37531f){if(_0x37531f){_0x17eff3[_0x5925('0xa6')]=_[_0x5925('0xa7')](_0x37531f,[_0x5925('0xa5')]);if(_0x37531f[_0x5925('0xa5')][_0x5925('0x47')]){return _0x37531f[_0x5925('0xa5')][0x0];}var _0x4bb246=_[_0x5925('0xa8')](_0x17eff3[_0x5925('0x5a')],{'firstName':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'ListId':_0x37531f['id']});_0x4bb246[_0x17eff3[_0x5925('0x5a')][_0x5925('0x9f')]]=_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')];return db[_0x5925('0xa4')]['create'](_0x4bb246,{'fields':_0x3c2339,'raw':!![]});}})['then'](handleEntityNotFound(_0x186cc3,null))[_0x5925('0x1d')](function(_0x44e926){if(_0x44e926){_0x17eff3['contact']=_0x44e926;var _0x3a8c7b={'ContactId':_0x44e926['id'],'phone':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id']};var _0x5ceca5={'ContactId':_0x44e926['id'],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id'],'closed':![]};return db[_0x5925('0xa9')][_0x5925('0x5e')]({'where':_0x5ceca5})['then'](function(_0x1f87d8){if(_0x1f87d8){return[_0x1f87d8,![]];}return db[_0x5925('0xa9')][_0x5925('0x59')](_0x3a8c7b)['then'](function(_0xb3c7bd){return[_0xb3c7bd,!![]];});});}})[_0x5925('0xaa')](function(_0x40e62d,_0x46387e){_0x17eff3[_0x5925('0xab')]=_0x40e62d[_0x5925('0x32')]({'plain':!![]});_0x17eff3[_0x5925('0xab')]['created']=![];if(_0x46387e){if(_0x17eff3[_0x5925('0x82')][_0x5925('0xac')]){_0x17eff3[_0x5925('0x89')][_0x5925('0xad')]({'id':0x0,'priority':_0x17eff3[_0x5925('0x89')]['length']+0x1,'app':_0x5925('0xae'),'appdata':_0x5925('0xaf'),'interval':'*,*,*,*'});}_0x17eff3[_0x5925('0xab')]['created']=!![];}return db[_0x5925('0x87')][_0x5925('0x59')]({'phone':_0x17eff3[_0x5925('0x5a')][_0x5925('0x95')],'messageId':_0x17eff3['body'][_0x5925('0x99')],'body':_0x17eff3[_0x5925('0x5a')][_0x5925('0x5a')],'WhatsappAccountId':_0x60db3c[_0x5925('0x55')]['id'],'WhatsappInteractionId':_0x40e62d['id'],'direction':'in','ContactId':_0x40e62d[_0x5925('0xb0')],'AttachmentId':_0x17eff3[_0x5925('0x5a')][_0x5925('0xb1')]});})[_0x5925('0x1d')](function(_0x37078c){_0x17eff3['message']=_0x37078c;if(_0x17eff3['interaction'][_0x5925('0xb2')]){return db[_0x5925('0x76')][_0x5925('0x5e')]({'attributes':['id','name'],'where':{'id':_0x17eff3[_0x5925('0xab')][_0x5925('0xb2')]}})[_0x5925('0x1d')](function(_0x414ede){if(_0x414ede){_0x17eff3[_0x5925('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5925('0xb3'),'appdata':_0x414ede[_0x5925('0x39')]+','+(_0x17eff3[_0x5925('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0x5925('0xb4')});}return respondWithRpcPromise(_0x5925('0xb5'),_0x5925('0xb6'),_0x17eff3);});}return respondWithRpcPromise(_0x5925('0xb5'),_0x5925('0xb6'),_0x17eff3);})['then'](function(_0x3fcaad){if(_0x3fcaad){var _0x75587b=0xc8;var _0x59702e=_0x5925('0xb7');logger['info'](_0x5925('0x21'),_0x59702e,_0x75587b,_0x5925('0xb8'));logger[_0x5925('0xb9')](_0x5925('0xba'),_0x59702e,_0x75587b,_0x5925('0xb8'),JSON[_0x5925('0x22')](_0x3fcaad));if(_0x17eff3[_0x5925('0x82')][_0x5925('0x3e')]===_0x5925('0x94')){return _0x186cc3['status'](_0x75587b)[_0x5925('0x2c')](_0x5925('0xbb'),'text/xml')[_0x5925('0x3a')](_0x5925('0xbc'));}else{return _0x186cc3[_0x5925('0x35')](_0x75587b)['json'](_0x3fcaad);}}});})['catch'](handleError(_0x186cc3,null));};exports['send']=function(_0x5cf0b7,_0x567c89,_0x29925a){var _0x470b3d,_0x221672,_0x1061c6;if(_['isNil'](_0x5cf0b7[_0x5925('0x5a')][_0x5925('0x5a')])||_0x5cf0b7['body'][_0x5925('0x5a')]===''){throw new db[(_0x5925('0x8c'))][(_0x5925('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5925('0x9d')](_0x5cf0b7[_0x5925('0x5a')]['to'])){throw new db['Sequelize'][(_0x5925('0x8d'))]('to\x20is\x20mandatory');}_0x470b3d=_0x5cf0b7[_0x5925('0x5a')]['to'];return db[_0x5925('0x3c')][_0x5925('0x5e')]({'where':{'id':_0x5cf0b7[_0x5925('0x55')]['id']},'include':[{'model':db[_0x5925('0xa3')],'as':_0x5925('0xbd'),'include':[{'model':db[_0x5925('0xa4')],'as':_0x5925('0xa5'),'where':{'mobile':_0x470b3d},'limit':0x1,'order':[[_0x5925('0x8f'),_0x5925('0xbe')]]}]}]})[_0x5925('0x1d')](handleEntityNotFound(_0x567c89,null))[_0x5925('0x1d')](function(_0x22acb0){if(_0x22acb0&&_0x22acb0[_0x5925('0xbd')]){_0x221672=_0x22acb0[_0x5925('0x32')]({'plain':!![]});if(_0x221672['List']&&_0x221672[_0x5925('0xbd')][_0x5925('0xa5')][_0x5925('0x47')]){return _0x221672['List'][_0x5925('0xa5')][0x0];}return db[_0x5925('0xa4')][_0x5925('0x59')](_[_0x5925('0xa8')](_0x5cf0b7['body'],{'firstName':_0x470b3d,'mobile':_0x470b3d,'phone':_0x470b3d,'ListId':_0x221672[_0x5925('0x92')]}));}})['then'](handleEntityNotFound(_0x567c89,null))[_0x5925('0x1d')](function(_0xb07258){if(_0xb07258){_0x1061c6=_0xb07258;return db[_0x5925('0xa9')][_0x5925('0x5e')]({'where':{'ContactId':_0x1061c6['id'],'closed':![],'WhatsappAccountId':_0x221672['id']}})[_0x5925('0x1d')](function(_0x34a132){if(_0x34a132){return[_0x34a132,![]];}return db[_0x5925('0xa9')]['create']({'UserId':_0x5cf0b7[_0x5925('0x5b')]['id'],'ContactId':_0x1061c6['id'],'WhatsappAccountId':_0x221672['id'],'phone':_0x470b3d,'firstMsgDirection':_0x5925('0xbf'),'Messages':[_[_0x5925('0x4e')](_0x5cf0b7[_0x5925('0x5a')],{'read':![],'body':_0x5cf0b7[_0x5925('0x5a')][_0x5925('0x5a')],'phone':_0x470b3d,'WhatsappAccountId':_0x221672['id'],'UserId':_0x5cf0b7['user']['id'],'ContactId':_0x1061c6['id']})]},{'include':[{'model':db[_0x5925('0x87')],'as':_0x5925('0xc0')}]})[_0x5925('0x1d')](function(_0x23dd23){return[_0x23dd23,!![]];});});}})[_0x5925('0xaa')](function(_0x3af367,_0x261c4f){if(_0x261c4f){return _0x3af367;}return db[_0x5925('0x87')]['create'](_[_0x5925('0x4e')](_0x5cf0b7['body'],{'read':![],'body':_0x5cf0b7['body'][_0x5925('0x5a')],'phone':_0x470b3d,'WhatsappAccountId':_0x221672['id'],'WhatsappInteractionId':_0x3af367['id'],'UserId':_0x5cf0b7[_0x5925('0x5b')]['id'],'ContactId':_0x1061c6['id']}))[_0x5925('0x1d')](function(_0x370e90){_0x3af367['dataValues'][_0x5925('0xc0')]=[];_0x3af367[_0x5925('0xc1')][_0x5925('0xc0')]['push'](_0x370e90[_0x5925('0xc1')]);return _0x3af367;});})[_0x5925('0x1d')](respondWithResult(_0x567c89,null))[_0x5925('0x53')](handleError(_0x567c89,null));}; \ No newline at end of file +var _0xd804=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','find','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','MessageSid','sinch','notifications','messageId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','set','text/xml','to\x20is\x20mandatory','List','defaults','out','Messages','dataValues','push','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','limit','undefined','count','offset','Content-Range','apply','save','update','WhatsappAccounts','destroy','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','create','body'];(function(_0x36a997,_0x288f0b){var _0x561b1b=function(_0x8ed5bb){while(--_0x8ed5bb){_0x36a997['push'](_0x36a997['shift']());}};_0x561b1b(++_0x288f0b);}(_0xd804,0x1f1));var _0x4d80=function(_0x309cec,_0x3ad368){_0x309cec=_0x309cec-0x0;var _0x383ffa=_0xd804[_0x309cec];return _0x383ffa;};'use strict';var emlformat=require(_0x4d80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d80('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d80('0x2'));var moment=require('moment');var BPromise=require(_0x4d80('0x3'));var Mustache=require(_0x4d80('0x4'));var util=require(_0x4d80('0x5'));var path=require(_0x4d80('0x6'));var sox=require('sox');var csv=require(_0x4d80('0x7'));var ejs=require(_0x4d80('0x8'));var fs=require('fs');var fs_extra=require(_0x4d80('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4d80('0xa'));var jsforce=require(_0x4d80('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d80('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4d80('0xd'));var hardwareService=require(_0x4d80('0xe'));var logger=require('../../config/logger')(_0x4d80('0xf'));var utils=require(_0x4d80('0x10'));var config=require(_0x4d80('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d80('0x12'))['db'];config[_0x4d80('0x13')]=_['defaults'](config['redis'],{'host':_0x4d80('0x14'),'port':0x18eb});var socket=require(_0x4d80('0x15'))(new Redis(config['redis']));require(_0x4d80('0x16'))[_0x4d80('0x17')](socket);var jayson=require(_0x4d80('0x18'));var client=jayson[_0x4d80('0x19')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3aa32d,_0x3836b4,_0x4021fb,_0x42dce6){return new BPromise(function(_0x387f86,_0xf20430){var _0x190aa0=_0x42dce6||client;return _0x190aa0[_0x4d80('0x1a')](_0x3aa32d,_0x4021fb)[_0x4d80('0x1b')](function(_0x38a5ef){logger[_0x4d80('0x1c')](_0x4d80('0x1d'),_0x3836b4,_0x4d80('0x1e'));logger[_0x4d80('0x1f')](_0x4d80('0x20'),_0x3836b4,_0x4d80('0x1e'),JSON[_0x4d80('0x21')](_0x38a5ef));if(_0x38a5ef[_0x4d80('0x22')]){if(_0x38a5ef[_0x4d80('0x22')][_0x4d80('0x23')]===0x1f4){logger['error'](_0x4d80('0x1d'),_0x3836b4,_0x38a5ef[_0x4d80('0x22')]['message']);return _0xf20430(_0x38a5ef[_0x4d80('0x22')]['message']);}logger[_0x4d80('0x22')](_0x4d80('0x1d'),_0x3836b4,_0x38a5ef[_0x4d80('0x22')]['message']);return _0x387f86(_0x38a5ef[_0x4d80('0x22')][_0x4d80('0x24')]);}else{logger[_0x4d80('0x1c')](_0x4d80('0x1d'),_0x3836b4,_0x4d80('0x1e'));_0x387f86(_0x38a5ef['result'][_0x4d80('0x24')]);}})[_0x4d80('0x25')](function(_0x1bb8e4){logger['error'](_0x4d80('0x1d'),_0x3836b4,_0x1bb8e4);_0xf20430(_0x1bb8e4);});});}function respondWithStatusCode(_0x5e16e1,_0x1f26d1){_0x1f26d1=_0x1f26d1||0xcc;return function(_0x3757a6){if(_0x3757a6){return _0x5e16e1['sendStatus'](_0x1f26d1);}return _0x5e16e1[_0x4d80('0x26')](_0x1f26d1)['end']();};}function respondWithResult(_0x2faddd,_0x5f1fc8){_0x5f1fc8=_0x5f1fc8||0xc8;return function(_0x1a7af6){if(_0x1a7af6){return _0x2faddd[_0x4d80('0x26')](_0x5f1fc8)[_0x4d80('0x27')](_0x1a7af6);}};}function respondWithFilteredResult(_0x41c35f,_0x92ecd9){return function(_0x23af25){if(_0x23af25){var _0xb585e8=typeof _0x92ecd9['offset']==='undefined'&&typeof _0x92ecd9[_0x4d80('0x28')]===_0x4d80('0x29');var _0x333b1c=_0x23af25[_0x4d80('0x2a')];var _0x26f8e1=_0xb585e8?0x0:_0x92ecd9[_0x4d80('0x2b')];var _0x3d5519=_0xb585e8?_0x23af25[_0x4d80('0x2a')]:_0x92ecd9['offset']+_0x92ecd9[_0x4d80('0x28')];var _0x454869;if(_0x3d5519>=_0x333b1c){_0x3d5519=_0x333b1c;_0x454869=0xc8;}else{_0x454869=0xce;}_0x41c35f[_0x4d80('0x26')](_0x454869);return _0x41c35f['set'](_0x4d80('0x2c'),_0x26f8e1+'-'+_0x3d5519+'/'+_0x333b1c)[_0x4d80('0x27')](_0x23af25);}return null;};}function patchUpdates(_0x1039d8){return function(_0x28d5ac){try{jsonpatch[_0x4d80('0x2d')](_0x28d5ac,_0x1039d8,!![]);}catch(_0x56f1f5){return BPromise['reject'](_0x56f1f5);}return _0x28d5ac[_0x4d80('0x2e')]();};}function saveUpdates(_0x3d52c0,_0x53fdc2){return function(_0x5c3603){if(_0x5c3603){return _0x5c3603[_0x4d80('0x2f')](_0x3d52c0)[_0x4d80('0x1b')](function(_0x174d21){return _0x174d21;});}return null;};}function removeEntity(_0x413828,_0x2517c8){return function(_0x5e7300){if(_0x5e7300){return _0x5e7300['destroy']()[_0x4d80('0x1b')](function(){var _0x24ad0d=_0x5e7300['get']({'plain':!![]});var _0x7bad74=_0x4d80('0x30');return db['UserProfileResource'][_0x4d80('0x31')]({'where':{'type':_0x7bad74,'resourceId':_0x24ad0d['id']}})[_0x4d80('0x1b')](function(){return _0x5e7300;});})[_0x4d80('0x1b')](function(){_0x413828['status'](0xcc)[_0x4d80('0x32')]();});}};}function handleEntityNotFound(_0x16a1ba,_0xa08d6c){return function(_0xb2b555){if(!_0xb2b555){_0x16a1ba[_0x4d80('0x33')](0x194);}return _0xb2b555;};}function handleError(_0x2325fe,_0xff866a){_0xff866a=_0xff866a||0x1f4;return function(_0x25ff2c){logger['error'](_0x25ff2c[_0x4d80('0x34')]);if(_0x25ff2c[_0x4d80('0x35')]){delete _0x25ff2c[_0x4d80('0x35')];}_0x2325fe[_0x4d80('0x26')](_0xff866a)[_0x4d80('0x36')](_0x25ff2c);};}exports[_0x4d80('0x37')]=function(_0x586f62,_0x4554fc){var _0x5e909c={'include':[{'model':db[_0x4d80('0x38')],'as':_0x4d80('0x39')}]},_0x573ecf={},_0x409246={'count':0x0,'rows':[]};var _0x1493de=_[_0x4d80('0x3a')](db[_0x4d80('0x3b')][_0x4d80('0x3c')],function(_0x163888){return{'name':_0x163888[_0x4d80('0x3d')],'type':_0x163888[_0x4d80('0x3e')][_0x4d80('0x3f')]};});_0x573ecf[_0x4d80('0x40')]=_[_0x4d80('0x3a')](_0x1493de,_0x4d80('0x35'));_0x573ecf[_0x4d80('0x41')]=_[_0x4d80('0x42')](_0x586f62[_0x4d80('0x41')]);_0x573ecf['filters']=_[_0x4d80('0x43')](_0x573ecf[_0x4d80('0x40')],_0x573ecf[_0x4d80('0x41')]);_0x5e909c['attributes']=_[_0x4d80('0x43')](_0x573ecf[_0x4d80('0x40')],qs[_0x4d80('0x44')](_0x586f62['query'][_0x4d80('0x44')]));_0x5e909c['attributes']=_0x5e909c[_0x4d80('0x45')][_0x4d80('0x46')]?_0x5e909c['attributes']:_0x573ecf[_0x4d80('0x40')];if(!_0x586f62[_0x4d80('0x41')][_0x4d80('0x47')]('nolimit')){_0x5e909c['limit']=qs[_0x4d80('0x28')](_0x586f62[_0x4d80('0x41')][_0x4d80('0x28')]);_0x5e909c[_0x4d80('0x2b')]=qs[_0x4d80('0x2b')](_0x586f62[_0x4d80('0x41')][_0x4d80('0x2b')]);}_0x5e909c[_0x4d80('0x48')]=qs['sort'](_0x586f62['query'][_0x4d80('0x49')]);_0x5e909c[_0x4d80('0x4a')]=qs['filters'](_[_0x4d80('0x4b')](_0x586f62[_0x4d80('0x41')],_0x573ecf[_0x4d80('0x4c')]),_0x1493de);if(_0x586f62[_0x4d80('0x41')]['filter']){_0x5e909c[_0x4d80('0x4a')]=_[_0x4d80('0x4d')](_0x5e909c[_0x4d80('0x4a')],{'$or':_[_0x4d80('0x3a')](_0x1493de,function(_0x2e3f87){if(_0x2e3f87[_0x4d80('0x3e')]!==_0x4d80('0x4e')){var _0x3fd05e={};_0x3fd05e[_0x2e3f87[_0x4d80('0x35')]]={'$like':'%'+_0x586f62['query']['filter']+'%'};return _0x3fd05e;}})});}_0x5e909c=_[_0x4d80('0x4d')]({},_0x5e909c,_0x586f62[_0x4d80('0x4f')]);var _0x2442ce={'where':_0x5e909c['where']};return db['WhatsappAccount'][_0x4d80('0x2a')](_0x2442ce)[_0x4d80('0x1b')](function(_0x1d77e2){_0x409246[_0x4d80('0x2a')]=_0x1d77e2;if(_0x586f62[_0x4d80('0x41')]['includeAll']){_0x5e909c['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x4d80('0x50')](_0x5e909c);})[_0x4d80('0x1b')](function(_0x6c36c2){_0x409246[_0x4d80('0x51')]=_0x6c36c2;return _0x409246;})['then'](respondWithFilteredResult(_0x4554fc,_0x5e909c))[_0x4d80('0x25')](handleError(_0x4554fc,null));};exports[_0x4d80('0x52')]=function(_0x384b66,_0x24b48c){var _0x5d3a33={'raw':![],'where':{'id':_0x384b66[_0x4d80('0x53')]['id']},'include':[{'model':db[_0x4d80('0x38')],'as':_0x4d80('0x39')}]},_0x3dcb08={};_0x3dcb08[_0x4d80('0x40')]=_[_0x4d80('0x42')](db[_0x4d80('0x3b')][_0x4d80('0x3c')]);_0x3dcb08[_0x4d80('0x41')]=_['keys'](_0x384b66[_0x4d80('0x41')]);_0x3dcb08[_0x4d80('0x4c')]=_[_0x4d80('0x43')](_0x3dcb08['model'],_0x3dcb08[_0x4d80('0x41')]);_0x5d3a33[_0x4d80('0x45')]=_[_0x4d80('0x43')](_0x3dcb08['model'],qs[_0x4d80('0x44')](_0x384b66[_0x4d80('0x41')]['fields']));_0x5d3a33[_0x4d80('0x45')]=_0x5d3a33[_0x4d80('0x45')][_0x4d80('0x46')]?_0x5d3a33['attributes']:_0x3dcb08[_0x4d80('0x40')];if(_0x384b66[_0x4d80('0x41')][_0x4d80('0x54')]){_0x5d3a33[_0x4d80('0x55')]=[{'all':!![]}];}_0x5d3a33=_['merge']({},_0x5d3a33,_0x384b66['options']);return db[_0x4d80('0x3b')]['find'](_0x5d3a33)[_0x4d80('0x1b')](handleEntityNotFound(_0x24b48c,null))[_0x4d80('0x1b')](respondWithResult(_0x24b48c,null))['catch'](handleError(_0x24b48c,null));};exports[_0x4d80('0x56')]=function(_0x4cd8ba,_0x1fe96d){return db['WhatsappAccount'][_0x4d80('0x56')](_0x4cd8ba[_0x4d80('0x57')],{})[_0x4d80('0x1b')](function(_0x1d892a){var _0x5aa522=_0x4cd8ba[_0x4d80('0x58')][_0x4d80('0x59')]({'plain':!![]});if(!_0x5aa522)throw new Error(_0x4d80('0x5a'));if(_0x5aa522[_0x4d80('0x5b')]===_0x4d80('0x58')){var _0x15127f=_0x1d892a[_0x4d80('0x59')]({'plain':!![]});var _0x635965=_0x4d80('0x30');return db[_0x4d80('0x5c')]['find']({'where':{'name':_0x635965,'userProfileId':_0x5aa522[_0x4d80('0x5d')]},'raw':!![]})[_0x4d80('0x1b')](function(_0x5521f1){if(_0x5521f1&&_0x5521f1[_0x4d80('0x5e')]===0x0){return db['UserProfileResource'][_0x4d80('0x56')]({'name':_0x15127f[_0x4d80('0x35')],'resourceId':_0x15127f['id'],'type':_0x5521f1[_0x4d80('0x35')],'sectionId':_0x5521f1['id']},{})[_0x4d80('0x1b')](function(){return _0x1d892a;});}else{return _0x1d892a;}})[_0x4d80('0x25')](function(_0x2d8975){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d8975);throw _0x2d8975;});}return _0x1d892a;})[_0x4d80('0x1b')](respondWithResult(_0x1fe96d,0xc9))[_0x4d80('0x25')](handleError(_0x1fe96d,null));};exports['update']=function(_0x947634,_0x3859fb){if(_0x947634[_0x4d80('0x57')]['id']){delete _0x947634[_0x4d80('0x57')]['id'];}return db[_0x4d80('0x3b')]['find']({'where':{'id':_0x947634[_0x4d80('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4d80('0x1b')](handleEntityNotFound(_0x3859fb,null))['then'](saveUpdates(_0x947634['body'],null))[_0x4d80('0x1b')](respondWithResult(_0x3859fb,null))[_0x4d80('0x25')](handleError(_0x3859fb,null));};exports[_0x4d80('0x31')]=function(_0x37b972,_0x4899f2){return db['WhatsappAccount'][_0x4d80('0x5f')]({'where':{'id':_0x37b972[_0x4d80('0x53')]['id']}})['then'](handleEntityNotFound(_0x4899f2,null))[_0x4d80('0x1b')](removeEntity(_0x4899f2,null))[_0x4d80('0x25')](handleError(_0x4899f2,null));};exports[_0x4d80('0x60')]=function(_0x12df34,_0x1acedb){return db[_0x4d80('0x3b')][_0x4d80('0x60')]()['then'](respondWithResult(_0x1acedb,null))[_0x4d80('0x25')](handleError(_0x1acedb,null));};exports[_0x4d80('0x61')]=function(_0x203f9f,_0x3c11b9,_0x12bccd){if(_0x203f9f[_0x4d80('0x57')]['id']){delete _0x203f9f['body']['id'];}return db['WhatsappAccount'][_0x4d80('0x5f')]({'where':{'id':_0x203f9f[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x3c11b9,null))[_0x4d80('0x1b')](function(_0x1e74b4){if(_0x1e74b4){_0x203f9f[_0x4d80('0x57')][_0x4d80('0x62')]=_0x1e74b4['id'];return db[_0x4d80('0x63')][_0x4d80('0x56')](_0x203f9f['body']);}})[_0x4d80('0x1b')](respondWithResult(_0x3c11b9,null))['catch'](handleError(_0x3c11b9,null));};exports[_0x4d80('0x64')]=function(_0x3963be,_0x307065,_0x217b5d){var _0x51e81b={'raw':![],'where':{}};var _0x81af20={};var _0x3a8be7={'count':0x0,'rows':[]};return db[_0x4d80('0x3b')][_0x4d80('0x65')]({'where':{'id':_0x3963be[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x307065,null))[_0x4d80('0x1b')](function(_0x4d3f07){if(_0x4d3f07){_0x81af20[_0x4d80('0x40')]=_[_0x4d80('0x42')](db['Disposition'][_0x4d80('0x3c')]);_0x81af20[_0x4d80('0x41')]=_[_0x4d80('0x42')](_0x3963be['query']);_0x81af20[_0x4d80('0x4c')]=_[_0x4d80('0x43')](_0x81af20[_0x4d80('0x40')],_0x81af20[_0x4d80('0x41')]);_0x51e81b['attributes']=_['intersection'](_0x81af20['model'],qs[_0x4d80('0x44')](_0x3963be[_0x4d80('0x41')][_0x4d80('0x44')]));_0x51e81b['attributes']=_0x51e81b[_0x4d80('0x45')][_0x4d80('0x46')]?_0x51e81b[_0x4d80('0x45')]:_0x81af20[_0x4d80('0x40')];if(!_0x3963be[_0x4d80('0x41')][_0x4d80('0x47')](_0x4d80('0x66'))){_0x51e81b[_0x4d80('0x28')]=qs[_0x4d80('0x28')](_0x3963be[_0x4d80('0x41')]['limit']);_0x51e81b[_0x4d80('0x2b')]=qs['offset'](_0x3963be[_0x4d80('0x41')]['offset']);}_0x51e81b[_0x4d80('0x48')]=qs['sort'](_0x3963be['query'][_0x4d80('0x49')]);_0x51e81b[_0x4d80('0x4a')]=qs[_0x4d80('0x4c')](_[_0x4d80('0x4b')](_0x3963be[_0x4d80('0x41')],_0x81af20[_0x4d80('0x4c')]));_0x51e81b[_0x4d80('0x4a')]['WhatsappAccountId']=_0x4d3f07['id'];if(_0x3963be[_0x4d80('0x41')][_0x4d80('0x67')]){_0x51e81b['where']=_[_0x4d80('0x4d')](_0x51e81b['where'],{'$or':_['map'](_0x51e81b[_0x4d80('0x45')],function(_0x407b6e){var _0x1b822e={};_0x1b822e[_0x407b6e]={'$like':'%'+_0x3963be['query']['filter']+'%'};return _0x1b822e;})});}_0x51e81b=_[_0x4d80('0x4d')]({},_0x51e81b,_0x3963be[_0x4d80('0x4f')]);return db['Disposition'][_0x4d80('0x2a')]({'where':_0x51e81b[_0x4d80('0x4a')]})[_0x4d80('0x1b')](function(_0x95c8d0){_0x3a8be7['count']=_0x95c8d0;if(_0x3963be['query'][_0x4d80('0x54')]){_0x51e81b[_0x4d80('0x55')]=[{'all':!![]}];}return db[_0x4d80('0x63')][_0x4d80('0x50')](_0x51e81b);})[_0x4d80('0x1b')](function(_0x53acd2){_0x3a8be7[_0x4d80('0x51')]=_0x53acd2;return _0x3a8be7;});}})[_0x4d80('0x1b')](respondWithFilteredResult(_0x307065,_0x51e81b))[_0x4d80('0x25')](handleError(_0x307065,null));};exports[_0x4d80('0x68')]=function(_0x5bc10d,_0x5947c6,_0x5ae1c0){return db['WhatsappAccount'][_0x4d80('0x5f')]({'where':{'id':_0x5bc10d['params']['id']}})['then'](handleEntityNotFound(_0x5947c6,null))[_0x4d80('0x1b')](function(_0x15ba28){if(_0x15ba28){return _0x15ba28[_0x4d80('0x68')](_0x5bc10d[_0x4d80('0x41')][_0x4d80('0x69')]);}})['then'](respondWithStatusCode(_0x5947c6,null))[_0x4d80('0x25')](handleError(_0x5947c6,null));};exports[_0x4d80('0x6a')]=function(_0x2b11d6,_0x5ec518,_0x1c269c){if(_0x2b11d6[_0x4d80('0x57')]['id']){delete _0x2b11d6[_0x4d80('0x57')]['id'];}return db[_0x4d80('0x3b')][_0x4d80('0x5f')]({'where':{'id':_0x2b11d6['params']['id']}})['then'](handleEntityNotFound(_0x5ec518,null))[_0x4d80('0x1b')](function(_0x4dcd32){if(_0x4dcd32){_0x2b11d6[_0x4d80('0x57')][_0x4d80('0x62')]=_0x4dcd32['id'];return db[_0x4d80('0x6b')][_0x4d80('0x56')](_0x2b11d6['body']);}})[_0x4d80('0x1b')](respondWithResult(_0x5ec518,null))[_0x4d80('0x25')](handleError(_0x5ec518,null));};exports[_0x4d80('0x6c')]=function(_0x57bd69,_0x2ae9b1,_0x483984){var _0x441513={'raw':![],'where':{}};var _0x45dbb6={};var _0x206852={'count':0x0,'rows':[]};return db[_0x4d80('0x3b')]['findOne']({'where':{'id':_0x57bd69['params']['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x2ae9b1,null))[_0x4d80('0x1b')](function(_0x52a2ba){if(_0x52a2ba){_0x45dbb6['model']=_[_0x4d80('0x42')](db[_0x4d80('0x6b')][_0x4d80('0x3c')]);_0x45dbb6['query']=_['keys'](_0x57bd69[_0x4d80('0x41')]);_0x45dbb6[_0x4d80('0x4c')]=_[_0x4d80('0x43')](_0x45dbb6['model'],_0x45dbb6[_0x4d80('0x41')]);_0x441513[_0x4d80('0x45')]=_[_0x4d80('0x43')](_0x45dbb6['model'],qs[_0x4d80('0x44')](_0x57bd69['query'][_0x4d80('0x44')]));_0x441513['attributes']=_0x441513['attributes'][_0x4d80('0x46')]?_0x441513['attributes']:_0x45dbb6[_0x4d80('0x40')];if(!_0x57bd69[_0x4d80('0x41')]['hasOwnProperty'](_0x4d80('0x66'))){_0x441513['limit']=qs[_0x4d80('0x28')](_0x57bd69[_0x4d80('0x41')][_0x4d80('0x28')]);_0x441513[_0x4d80('0x2b')]=qs[_0x4d80('0x2b')](_0x57bd69[_0x4d80('0x41')][_0x4d80('0x2b')]);}_0x441513['order']=qs[_0x4d80('0x49')](_0x57bd69[_0x4d80('0x41')]['sort']);_0x441513[_0x4d80('0x4a')]=qs[_0x4d80('0x4c')](_[_0x4d80('0x4b')](_0x57bd69[_0x4d80('0x41')],_0x45dbb6[_0x4d80('0x4c')]));_0x441513[_0x4d80('0x4a')][_0x4d80('0x62')]=_0x52a2ba['id'];if(_0x57bd69[_0x4d80('0x41')][_0x4d80('0x67')]){_0x441513['where']=_[_0x4d80('0x4d')](_0x441513[_0x4d80('0x4a')],{'$or':_[_0x4d80('0x3a')](_0x441513[_0x4d80('0x45')],function(_0x212ef9){var _0x54a0e9={};_0x54a0e9[_0x212ef9]={'$like':'%'+_0x57bd69[_0x4d80('0x41')][_0x4d80('0x67')]+'%'};return _0x54a0e9;})});}_0x441513=_[_0x4d80('0x4d')]({},_0x441513,_0x57bd69[_0x4d80('0x4f')]);return db[_0x4d80('0x6b')]['count']({'where':_0x441513[_0x4d80('0x4a')]})[_0x4d80('0x1b')](function(_0x25db50){_0x206852[_0x4d80('0x2a')]=_0x25db50;if(_0x57bd69[_0x4d80('0x41')][_0x4d80('0x54')]){_0x441513[_0x4d80('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4d80('0x50')](_0x441513);})['then'](function(_0x1aac13){_0x206852[_0x4d80('0x51')]=_0x1aac13;return _0x206852;});}})['then'](respondWithFilteredResult(_0x2ae9b1,_0x441513))[_0x4d80('0x25')](handleError(_0x2ae9b1,null));};exports['removeAnswers']=function(_0x41d12d,_0x449b65,_0x1116e7){return db[_0x4d80('0x3b')][_0x4d80('0x5f')]({'where':{'id':_0x41d12d[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x449b65,null))[_0x4d80('0x1b')](function(_0x54c80b){if(_0x54c80b){return _0x54c80b[_0x4d80('0x6d')](_0x41d12d['query']['ids']);}})[_0x4d80('0x1b')](respondWithStatusCode(_0x449b65,null))['catch'](handleError(_0x449b65,null));};exports[_0x4d80('0x6e')]=function(_0x21aa53,_0x2c8c92,_0x4491e8){return db[_0x4d80('0x3b')][_0x4d80('0x5f')]({'where':{'id':_0x21aa53['params']['id']}})['then'](handleEntityNotFound(_0x2c8c92,null))[_0x4d80('0x1b')](function(_0x3c053c){if(_0x3c053c){return _0x3c053c[_0x4d80('0x6e')](_0x21aa53['body']['ids'],_[_0x4d80('0x6f')](_0x21aa53[_0x4d80('0x57')],[_0x4d80('0x69'),'id'])||{})[_0x4d80('0x70')](function(_0x1cd3c0){for(var _0x498e0e=0x0;_0x498e0e<_0x21aa53['body'][_0x4d80('0x69')][_0x4d80('0x46')];_0x498e0e+=0x1){socket[_0x4d80('0x71')](_0x4d80('0x72'),{'UserId':Number(_0x21aa53['body'][_0x4d80('0x69')][_0x498e0e]),'WhatsappAccountId':Number(_0x21aa53[_0x4d80('0x53')]['id'])});}return _0x1cd3c0;});}})['then'](respondWithResult(_0x2c8c92,null))['catch'](handleError(_0x2c8c92,null));};exports[_0x4d80('0x73')]=function(_0x34abce,_0x73a736,_0x4cc899){return db['WhatsappAccount'][_0x4d80('0x5f')]({'where':{'id':_0x34abce[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x73a736,null))['then'](function(_0x4e5f8c){if(_0x4e5f8c){return _0x4e5f8c['removeAgents'](_0x34abce[_0x4d80('0x41')][_0x4d80('0x69')])['then'](function(){if(_[_0x4d80('0x74')](_0x34abce['query'][_0x4d80('0x69')])){for(var _0x4d05c7=0x0;_0x4d05c7<_0x34abce[_0x4d80('0x41')][_0x4d80('0x69')]['length'];_0x4d05c7+=0x1){socket[_0x4d80('0x71')](_0x4d80('0x75'),{'UserId':Number(_0x34abce['query']['ids'][_0x4d05c7]),'WhatsappAccountId':Number(_0x34abce['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x34abce[_0x4d80('0x41')]['ids']),'WhatsappAccountId':Number(_0x34abce[_0x4d80('0x53')]['id'])});}});}})[_0x4d80('0x1b')](respondWithStatusCode(_0x73a736,null))['catch'](handleError(_0x73a736,null));};exports[_0x4d80('0x76')]=function(_0x26b224,_0x1d9f29,_0x2b8f01){var _0x25598f={};var _0x2f1138={};var _0x3d9d30;var _0x31cf04;return db[_0x4d80('0x3b')][_0x4d80('0x65')]({'where':{'id':_0x26b224[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x1d9f29,null))[_0x4d80('0x1b')](function(_0x41288a){if(_0x41288a){_0x3d9d30=_0x41288a;_0x2f1138[_0x4d80('0x40')]=_['keys'](db[_0x4d80('0x77')][_0x4d80('0x3c')]);_0x2f1138[_0x4d80('0x41')]=_[_0x4d80('0x42')](_0x26b224[_0x4d80('0x41')]);_0x2f1138[_0x4d80('0x4c')]=_[_0x4d80('0x43')](_0x2f1138[_0x4d80('0x40')],_0x2f1138['query']);_0x25598f[_0x4d80('0x45')]=_[_0x4d80('0x43')](_0x2f1138[_0x4d80('0x40')],qs[_0x4d80('0x44')](_0x26b224['query'][_0x4d80('0x44')]));_0x25598f['attributes']=_0x25598f[_0x4d80('0x45')][_0x4d80('0x46')]?_0x25598f[_0x4d80('0x45')]:_0x2f1138[_0x4d80('0x40')];_0x25598f[_0x4d80('0x48')]=qs[_0x4d80('0x49')](_0x26b224[_0x4d80('0x41')][_0x4d80('0x49')]);_0x25598f['where']=qs[_0x4d80('0x4c')](_['pick'](_0x26b224[_0x4d80('0x41')],_0x2f1138['filters']));if(_0x26b224[_0x4d80('0x41')][_0x4d80('0x67')]){_0x25598f['where']=_[_0x4d80('0x4d')](_0x25598f[_0x4d80('0x4a')],{'$or':_[_0x4d80('0x3a')](_0x25598f[_0x4d80('0x45')],function(_0x2ef26c){var _0x2efd68={};_0x2efd68[_0x2ef26c]={'$like':'%'+_0x26b224['query'][_0x4d80('0x67')]+'%'};return _0x2efd68;})});}_0x25598f=_[_0x4d80('0x4d')]({},_0x25598f,_0x26b224['options']);return _0x3d9d30['getAgents'](_0x25598f);}})['then'](function(_0xc3c70e){if(_0xc3c70e){_0x31cf04=_0xc3c70e['length'];if(!_0x26b224[_0x4d80('0x41')][_0x4d80('0x47')]('nolimit')){_0x25598f[_0x4d80('0x28')]=qs[_0x4d80('0x28')](_0x26b224['query'][_0x4d80('0x28')]);_0x25598f['offset']=qs[_0x4d80('0x2b')](_0x26b224[_0x4d80('0x41')][_0x4d80('0x2b')]);}return _0x3d9d30[_0x4d80('0x76')](_0x25598f);}})[_0x4d80('0x1b')](function(_0x58935f){if(_0x58935f){return _0x58935f?{'count':_0x31cf04,'rows':_0x58935f}:null;}})[_0x4d80('0x1b')](respondWithResult(_0x1d9f29,null))[_0x4d80('0x25')](handleError(_0x1d9f29,null));};exports['addApplications']=function(_0xc72af4,_0x6c6591){var _0x58206a=_0xc72af4[_0x4d80('0x53')]['id'];var _0x49b947=_0xc72af4[_0x4d80('0x57')];var _0xb414f9=0xc8;var _0x442eb8=null;return db[_0x4d80('0x78')]['transaction']({'isolationLevel':db[_0x4d80('0x78')][_0x4d80('0x79')][_0x4d80('0x7a')]['READ_COMMITTED']},function(_0x4e4d4b){return db['WhatsappAccount'][_0x4d80('0x65')]({'where':{'id':_0x58206a},'transaction':_0x4e4d4b})[_0x4d80('0x1b')](function(_0x4b59d2){if(_0x4b59d2){return db[_0x4d80('0x7b')][_0x4d80('0x31')]({'where':{'WhatsappAccountId':_0x58206a},'transaction':_0x4e4d4b})[_0x4d80('0x1b')](function(){var _0x425455=_[_0x4d80('0x3a')](_0x49b947,function(_0x597221){_0x597221[_0x4d80('0x62')]=_0x58206a;return _0x597221;});return db[_0x4d80('0x7b')][_0x4d80('0x7c')](_0x425455,{'transaction':_0x4e4d4b});});}else{_0xb414f9=0x194;_0x442eb8=[];}});})[_0x4d80('0x1b')](function(){if(_0xb414f9!==0x194){return db[_0x4d80('0x7b')][_0x4d80('0x7d')]({'where':{'WhatsappAccountId':_0x58206a},'order':'priority'})[_0x4d80('0x1b')](function(_0x364b03){_0x442eb8=_0x364b03;});}})[_0x4d80('0x25')](function(_0x61535c){_0xb414f9=0x1f4;logger[_0x4d80('0x22')](_0x61535c['stack']);if(_0x61535c['name']){delete _0x61535c[_0x4d80('0x35')];}_0x442eb8=_0x61535c;})[_0x4d80('0x7e')](function(){if(_0x442eb8===null){_0x6c6591[_0x4d80('0x33')](_0xb414f9);}else{if(_0xb414f9===0x1f4){_0x6c6591[_0x4d80('0x26')](_0xb414f9)[_0x4d80('0x36')](_0x442eb8);}else{_0x6c6591['status'](_0xb414f9)[_0x4d80('0x27')](_0x442eb8);}}});};exports[_0x4d80('0x7f')]=function(_0x27fb17,_0x3a090a,_0x24b0d8){var _0x5927a7={};var _0x23b80c={};var _0x59a0b0;var _0x593791;return db['WhatsappAccount'][_0x4d80('0x65')]({'where':{'id':_0x27fb17[_0x4d80('0x53')]['id']}})[_0x4d80('0x1b')](handleEntityNotFound(_0x3a090a,null))['then'](function(_0x303f63){if(_0x303f63){_0x59a0b0=_0x303f63;_0x23b80c[_0x4d80('0x40')]=_[_0x4d80('0x42')](db[_0x4d80('0x7b')]['rawAttributes']);_0x23b80c[_0x4d80('0x41')]=_[_0x4d80('0x42')](_0x27fb17[_0x4d80('0x41')]);_0x23b80c[_0x4d80('0x4c')]=_[_0x4d80('0x43')](_0x23b80c[_0x4d80('0x40')],_0x23b80c[_0x4d80('0x41')]);_0x5927a7[_0x4d80('0x45')]=_[_0x4d80('0x43')](_0x23b80c[_0x4d80('0x40')],qs[_0x4d80('0x44')](_0x27fb17[_0x4d80('0x41')]['fields']));_0x5927a7[_0x4d80('0x45')]=_0x5927a7['attributes']['length']?_0x5927a7[_0x4d80('0x45')]:_0x23b80c[_0x4d80('0x40')];_0x5927a7[_0x4d80('0x48')]=qs[_0x4d80('0x49')](_0x27fb17[_0x4d80('0x41')][_0x4d80('0x49')]);_0x5927a7[_0x4d80('0x4a')]=qs['filters'](_[_0x4d80('0x4b')](_0x27fb17[_0x4d80('0x41')],_0x23b80c[_0x4d80('0x4c')]));if(_0x27fb17[_0x4d80('0x41')][_0x4d80('0x67')]){_0x5927a7[_0x4d80('0x4a')]=_[_0x4d80('0x4d')](_0x5927a7['where'],{'$or':_[_0x4d80('0x3a')](_0x5927a7[_0x4d80('0x45')],function(_0x331172){var _0x598a03={};_0x598a03[_0x331172]={'$like':'%'+_0x27fb17['query'][_0x4d80('0x67')]+'%'};return _0x598a03;})});}_0x5927a7=_[_0x4d80('0x4d')]({},_0x5927a7,_0x27fb17[_0x4d80('0x4f')]);return _0x59a0b0['getApplications'](_0x5927a7);}})['then'](function(_0x22e5bd){if(_0x22e5bd){_0x593791=_0x22e5bd[_0x4d80('0x46')];if(!_0x27fb17['query'][_0x4d80('0x47')](_0x4d80('0x66'))){_0x5927a7[_0x4d80('0x28')]=qs['limit'](_0x27fb17['query'][_0x4d80('0x28')]);_0x5927a7['offset']=qs[_0x4d80('0x2b')](_0x27fb17['query']['offset']);}return _0x59a0b0[_0x4d80('0x7f')](_0x5927a7);}})[_0x4d80('0x1b')](function(_0x5df36e){if(_0x5df36e){return _0x5df36e?{'count':_0x593791,'rows':_0x5df36e}:null;}})[_0x4d80('0x1b')](respondWithResult(_0x3a090a,null))[_0x4d80('0x25')](handleError(_0x3a090a,null));};exports[_0x4d80('0x80')]=function(_0x442860,_0x533465,_0x1a778b){var _0x881f95={'channel':_0x4d80('0x81')};var _0x264ec5=[];var _0x42c296=[];var _0x5843ec={};return db[_0x4d80('0x3b')]['find']({'where':{'id':_0x442860[_0x4d80('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x4d80('0x82')}]})[_0x4d80('0x1b')](handleEntityNotFound(_0x533465,null))['then'](function(_0x3910e9){_0x881f95[_0x4d80('0x83')]=_0x3910e9;if(_0x881f95[_0x4d80('0x83')]&&_0x881f95['account'][_0x4d80('0x3e')]==='sinch'&&_0x442860['body']['statuses']){if(_0x442860[_0x4d80('0x57')][_0x4d80('0x84')][_0x4d80('0x46')]===0x0)return;if(_0x442860['body'][_0x4d80('0x84')][0x0][_0x4d80('0x85')]!==_0x4d80('0x86'))return;return db[_0x4d80('0x87')][_0x4d80('0x2f')]({'read':!![],'readAt':_0x442860[_0x4d80('0x57')][_0x4d80('0x84')][0x0][_0x4d80('0x88')]},{'where':{'messageId':_0x442860['body'][_0x4d80('0x84')][0x0][_0x4d80('0x89')]},'individualHooks':!![]})[_0x4d80('0x1b')](function(_0x27baa7){return _0x533465['status'](0xc8)[_0x4d80('0x27')](_0x27baa7);});}_0x881f95[_0x4d80('0x8a')]=_[_0x4d80('0x8b')](_0x3910e9[_0x4d80('0x82')],[_0x4d80('0x8c')],[_0x4d80('0x8d')]);if(_0x881f95[_0x4d80('0x83')][_0x4d80('0x82')]){delete _0x881f95[_0x4d80('0x83')][_0x4d80('0x82')];}return db[_0x4d80('0x8e')]['describe']()[_0x4d80('0x1b')](function(_0xd7cc40){if(!_0xd7cc40){throw new db[(_0x4d80('0x8f'))]['ValidationError'](_0x4d80('0x90'));}_0x264ec5=_[_0x4d80('0x91')](_[_0x4d80('0x42')](_0xd7cc40),['createdAt','updatedAt']);_0x42c296=_[_0x4d80('0x91')](_[_0x4d80('0x42')](_0xd7cc40),[_0x4d80('0x92'),_0x4d80('0x93'),_0x4d80('0x94'),_0x4d80('0x95')]);_0x881f95['body']={'mapKey':_0x4d80('0x96')};if(_0x881f95[_0x4d80('0x83')]&&_0x881f95[_0x4d80('0x83')][_0x4d80('0x3e')]===_0x4d80('0x97')){_0x881f95[_0x4d80('0x57')][_0x4d80('0x98')]=_0x442860[_0x4d80('0x57')][_0x4d80('0x99')]['replace'](_0x4d80('0x9a'),'');_0x881f95['body'][_0x4d80('0x57')]=_0x442860['body'][_0x4d80('0x9b')];_0x881f95[_0x4d80('0x57')]['messageId']=_0x442860[_0x4d80('0x57')][_0x4d80('0x9c')];}if(_0x881f95[_0x4d80('0x83')]&&_0x881f95[_0x4d80('0x83')]['type']===_0x4d80('0x9d')){_0x881f95[_0x4d80('0x57')][_0x4d80('0x98')]=_0x442860['body'][_0x4d80('0x9e')][0x0]['from'];_0x881f95[_0x4d80('0x57')][_0x4d80('0x57')]=_0x442860['body']['notifications'][0x0]['message'][_0x4d80('0x57')];_0x881f95['body'][_0x4d80('0x9f')]=_0x442860['body'][_0x4d80('0x9e')][0x0][_0x4d80('0x89')];}if(_0x881f95[_0x4d80('0x57')]['id']){delete _0x881f95[_0x4d80('0x57')]['id'];}if(_['isNil'](_0x881f95[_0x4d80('0x57')][_0x4d80('0x98')])){throw new db[(_0x4d80('0x8f'))]['ValidationError'](_0x4d80('0xa0'));}if(_['isNil'](_0x881f95[_0x4d80('0x57')][_0x4d80('0x57')])||_0x881f95['body'][_0x4d80('0x57')]===''){throw new db[(_0x4d80('0x8f'))]['ValidationError'](_0x4d80('0xa1'));}if(_[_0x4d80('0xa2')](_0x881f95[_0x4d80('0x57')]['mapKey'])){throw new db['Sequelize'][(_0x4d80('0xa3'))](_0x4d80('0xa4')+_0x42c296);}if(!_['includes'](_0x42c296,_0x881f95[_0x4d80('0x57')][_0x4d80('0xa5')])){throw new db[(_0x4d80('0x8f'))][(_0x4d80('0xa3'))](_0x4d80('0xa6')+_0x42c296);}_0x5843ec[_0x881f95[_0x4d80('0x57')][_0x4d80('0xa5')]]=_0x881f95[_0x4d80('0x57')][_0x4d80('0x98')];return db[_0x4d80('0xa7')][_0x4d80('0x5f')]({'where':{'id':_0x881f95['account'][_0x4d80('0x95')]},'include':[{'model':db[_0x4d80('0x8e')],'as':_0x4d80('0xa8'),'where':_0x5843ec,'limit':0x1,'order':[[_0x4d80('0x93'),_0x4d80('0xa9')]]}]});})['then'](handleEntityNotFound(_0x533465,null))[_0x4d80('0x1b')](function(_0x11007e){if(_0x11007e){_0x881f95[_0x4d80('0xaa')]=_['omit'](_0x11007e,[_0x4d80('0xa8')]);if(_0x11007e[_0x4d80('0xa8')]['length']){return _0x11007e[_0x4d80('0xa8')][0x0];}var _0x201e1d=_['defaults'](_0x881f95[_0x4d80('0x57')],{'firstName':_0x881f95['body'][_0x4d80('0x98')],'ListId':_0x11007e['id']});_0x201e1d[_0x881f95['body'][_0x4d80('0xa5')]]=_0x881f95[_0x4d80('0x57')]['from'];return db[_0x4d80('0x8e')][_0x4d80('0x56')](_0x201e1d,{'fields':_0x264ec5,'raw':!![]});}})[_0x4d80('0x1b')](handleEntityNotFound(_0x533465,null))[_0x4d80('0x1b')](function(_0x1558ed){if(_0x1558ed){_0x881f95[_0x4d80('0xab')]=_0x1558ed;var _0x64f85d={'ContactId':_0x1558ed['id'],'phone':_0x881f95[_0x4d80('0x57')]['from'],'WhatsappAccountId':_0x442860['params']['id']};var _0x1ece54={'ContactId':_0x1558ed['id'],'WhatsappAccountId':_0x442860[_0x4d80('0x53')]['id'],'closed':![]};return db[_0x4d80('0xac')]['find']({'where':_0x1ece54})[_0x4d80('0x1b')](function(_0x391c9e){if(_0x391c9e){return[_0x391c9e,![]];}return db[_0x4d80('0xac')]['create'](_0x64f85d)[_0x4d80('0x1b')](function(_0x560224){return[_0x560224,!![]];});});}})[_0x4d80('0x70')](function(_0x150d0,_0x4c5971){_0x881f95['interaction']=_0x150d0[_0x4d80('0x59')]({'plain':!![]});_0x881f95[_0x4d80('0xad')]['created']=![];if(_0x4c5971){if(_0x881f95[_0x4d80('0x83')]['autoclose']){_0x881f95['applications']['push']({'id':0x0,'priority':_0x881f95[_0x4d80('0x8a')]['length']+0x1,'app':_0x4d80('0xae'),'appdata':_0x4d80('0xaf'),'interval':_0x4d80('0xb0')});}_0x881f95['interaction']['created']=!![];}return db[_0x4d80('0x87')]['create']({'phone':_0x881f95[_0x4d80('0x57')][_0x4d80('0x98')],'messageId':_0x881f95['body'][_0x4d80('0x9f')],'body':_0x881f95[_0x4d80('0x57')][_0x4d80('0x57')],'WhatsappAccountId':_0x442860[_0x4d80('0x53')]['id'],'WhatsappInteractionId':_0x150d0['id'],'direction':'in','ContactId':_0x150d0['ContactId'],'AttachmentId':_0x881f95[_0x4d80('0x57')][_0x4d80('0xb1')]});})['then'](function(_0x1d2157){_0x881f95[_0x4d80('0x24')]=_0x1d2157;if(_0x881f95[_0x4d80('0xad')][_0x4d80('0xb2')]){return db[_0x4d80('0x77')]['find']({'attributes':['id',_0x4d80('0x35')],'where':{'id':_0x881f95[_0x4d80('0xad')][_0x4d80('0xb2')]}})['then'](function(_0x39d300){if(_0x39d300){_0x881f95[_0x4d80('0x8a')][_0x4d80('0xb3')]({'id':0x0,'priority':0x0,'app':_0x4d80('0xb4'),'appdata':_0x39d300[_0x4d80('0x35')]+','+(_0x881f95[_0x4d80('0x83')][_0x4d80('0xb5')]||0xa),'interval':_0x4d80('0xb0')});}return respondWithRpcPromise(_0x4d80('0xb6'),_0x4d80('0xb7'),_0x881f95);});}return respondWithRpcPromise('Start',_0x4d80('0xb7'),_0x881f95);})[_0x4d80('0x1b')](function(_0x33d04b){if(_0x33d04b){var _0x33c80d=0xc8;var _0x47b208=_0x4d80('0xb8');logger[_0x4d80('0x1c')](_0x4d80('0x20'),_0x47b208,_0x33c80d,_0x4d80('0xb9'));logger[_0x4d80('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x47b208,_0x33c80d,_0x4d80('0xb9'),JSON[_0x4d80('0x21')](_0x33d04b));if(_0x881f95['account'][_0x4d80('0x3e')]==='twilio'){return _0x533465[_0x4d80('0x26')](_0x33c80d)[_0x4d80('0xba')]('Content-Type',_0x4d80('0xbb'))[_0x4d80('0x36')]('\x0a');}else{return _0x533465['status'](_0x33c80d)[_0x4d80('0x27')](_0x33d04b);}}});})['catch'](handleError(_0x533465,null));};exports[_0x4d80('0x36')]=function(_0x5351da,_0x424aa3,_0x2cdca9){var _0xf581ad,_0x2b1a4b,_0x42b554;if(_[_0x4d80('0xa2')](_0x5351da[_0x4d80('0x57')][_0x4d80('0x57')])||_0x5351da[_0x4d80('0x57')][_0x4d80('0x57')]===''){throw new db[(_0x4d80('0x8f'))][(_0x4d80('0xa3'))](_0x4d80('0xa1'));}if(_[_0x4d80('0xa2')](_0x5351da[_0x4d80('0x57')]['to'])){throw new db['Sequelize'][(_0x4d80('0xa3'))](_0x4d80('0xbc'));}_0xf581ad=_0x5351da[_0x4d80('0x57')]['to'];return db[_0x4d80('0x3b')]['find']({'where':{'id':_0x5351da[_0x4d80('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x4d80('0xbd'),'include':[{'model':db[_0x4d80('0x8e')],'as':'Contacts','where':{'mobile':_0xf581ad},'limit':0x1,'order':[[_0x4d80('0x93'),_0x4d80('0xa9')]]}]}]})[_0x4d80('0x1b')](handleEntityNotFound(_0x424aa3,null))['then'](function(_0x5af00a){if(_0x5af00a&&_0x5af00a[_0x4d80('0xbd')]){_0x2b1a4b=_0x5af00a[_0x4d80('0x59')]({'plain':!![]});if(_0x2b1a4b[_0x4d80('0xbd')]&&_0x2b1a4b[_0x4d80('0xbd')][_0x4d80('0xa8')][_0x4d80('0x46')]){return _0x2b1a4b[_0x4d80('0xbd')][_0x4d80('0xa8')][0x0];}return db[_0x4d80('0x8e')][_0x4d80('0x56')](_[_0x4d80('0xbe')](_0x5351da[_0x4d80('0x57')],{'firstName':_0xf581ad,'mobile':_0xf581ad,'phone':_0xf581ad,'ListId':_0x2b1a4b['ListId']}));}})[_0x4d80('0x1b')](handleEntityNotFound(_0x424aa3,null))[_0x4d80('0x1b')](function(_0x420bc4){if(_0x420bc4){_0x42b554=_0x420bc4;return db[_0x4d80('0xac')][_0x4d80('0x5f')]({'where':{'ContactId':_0x42b554['id'],'closed':![],'WhatsappAccountId':_0x2b1a4b['id']}})['then'](function(_0x4bc993){if(_0x4bc993){return[_0x4bc993,![]];}return db[_0x4d80('0xac')][_0x4d80('0x56')]({'UserId':_0x5351da[_0x4d80('0x58')]['id'],'ContactId':_0x42b554['id'],'WhatsappAccountId':_0x2b1a4b['id'],'phone':_0xf581ad,'firstMsgDirection':_0x4d80('0xbf'),'Messages':[_[_0x4d80('0x4d')](_0x5351da['body'],{'read':![],'body':_0x5351da[_0x4d80('0x57')]['body'],'phone':_0xf581ad,'WhatsappAccountId':_0x2b1a4b['id'],'UserId':_0x5351da['user']['id'],'ContactId':_0x42b554['id']})]},{'include':[{'model':db[_0x4d80('0x87')],'as':_0x4d80('0xc0')}]})[_0x4d80('0x1b')](function(_0x519de3){return[_0x519de3,!![]];});});}})[_0x4d80('0x70')](function(_0x54faa3,_0x8d6d26){if(_0x8d6d26){return _0x54faa3;}return db[_0x4d80('0x87')][_0x4d80('0x56')](_[_0x4d80('0x4d')](_0x5351da[_0x4d80('0x57')],{'read':![],'body':_0x5351da[_0x4d80('0x57')][_0x4d80('0x57')],'phone':_0xf581ad,'WhatsappAccountId':_0x2b1a4b['id'],'WhatsappInteractionId':_0x54faa3['id'],'UserId':_0x5351da[_0x4d80('0x58')]['id'],'ContactId':_0x42b554['id']}))[_0x4d80('0x1b')](function(_0x121a53){_0x54faa3[_0x4d80('0xc1')][_0x4d80('0xc0')]=[];_0x54faa3[_0x4d80('0xc1')]['Messages'][_0x4d80('0xc2')](_0x121a53['dataValues']);return _0x54faa3;});})[_0x4d80('0x1b')](respondWithResult(_0x424aa3,null))[_0x4d80('0x25')](handleError(_0x424aa3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ca1b1a3..4428716 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xec12=['events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xec12,0xe0));var _0x2ec1=function(_0xa0c7ce,_0x1d353a){_0xa0c7ce=_0xa0c7ce-0x0;var _0xce382a=_0xec12[_0xa0c7ce];return _0xce382a;};'use strict';var EventEmitter=require(_0x2ec1('0x0'));var WhatsappAccount=require(_0x2ec1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2ec1('0x2')](0x0);var events={'afterCreate':_0x2ec1('0x3'),'afterUpdate':'update','afterDestroy':_0x2ec1('0x4')};function emitEvent(_0xd14b04){return function(_0x535930,_0x28edb7,_0x51e882){WhatsappAccountEvents[_0x2ec1('0x5')](_0xd14b04+':'+_0x535930['id'],_0x535930);WhatsappAccountEvents[_0x2ec1('0x5')](_0xd14b04,_0x535930);_0x51e882(null);};}for(var e in events){if(events[_0x2ec1('0x6')](e)){var event=events[e];WhatsappAccount[_0x2ec1('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x591f=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2da18b,_0x548ecc){var _0x2a7c64=function(_0x1dc9d3){while(--_0x1dc9d3){_0x2da18b['push'](_0x2da18b['shift']());}};_0x2a7c64(++_0x548ecc);}(_0x591f,0x1c8));var _0xf591=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0x591f[_0x20efe6];return _0x2680c2;};'use strict';var EventEmitter=require(_0xf591('0x0'));var WhatsappAccount=require(_0xf591('0x1'))['db'][_0xf591('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf591('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf591('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42235a){return function(_0x5cd032,_0x1632e0,_0x3919e0){WhatsappAccountEvents[_0xf591('0x5')](_0x42235a+':'+_0x5cd032['id'],_0x5cd032);WhatsappAccountEvents[_0xf591('0x5')](_0x42235a,_0x5cd032);_0x3919e0(null);};}for(var e in events){if(events[_0xf591('0x6')](e)){var event=events[e];WhatsappAccount[_0xf591('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index d4be0d2..95b51cd 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd78=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define'];(function(_0x21514d,_0x107eb3){var _0x53d096=function(_0x2dcbae){while(--_0x2dcbae){_0x21514d['push'](_0x21514d['shift']());}};_0x53d096(++_0x107eb3);}(_0xcd78,0x128));var _0x8cd7=function(_0x3b02dd,_0x16847e){_0x3b02dd=_0x3b02dd-0x0;var _0x538563=_0xcd78[_0x3b02dd];return _0x538563;};'use strict';var _=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var logger=require(_0x8cd7('0x2'))(_0x8cd7('0x3'));var moment=require(_0x8cd7('0x4'));var BPromise=require(_0x8cd7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8cd7('0x6'));var rimraf=require(_0x8cd7('0x7'));var config=require(_0x8cd7('0x8'));var attributes=require(_0x8cd7('0x9'));module[_0x8cd7('0xa')]=function(_0x1447e5,_0x1ebe76){return _0x1447e5[_0x8cd7('0xb')](_0x8cd7('0xc'),attributes,{'tableName':_0x8cd7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bb8=['api','moment','bluebird','request-promise','path','rimraf','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x465a13,_0x57add6){var _0x292387=function(_0x10bd90){while(--_0x10bd90){_0x465a13['push'](_0x465a13['shift']());}};_0x292387(++_0x57add6);}(_0x2bb8,0xc9));var _0x82bb=function(_0x5ad294,_0x59b2da){_0x5ad294=_0x5ad294-0x0;var _0xdfdbab=_0x2bb8[_0x5ad294];return _0xdfdbab;};'use strict';var _=require(_0x82bb('0x0'));var util=require(_0x82bb('0x1'));var logger=require(_0x82bb('0x2'))(_0x82bb('0x3'));var moment=require(_0x82bb('0x4'));var BPromise=require(_0x82bb('0x5'));var rp=require(_0x82bb('0x6'));var fs=require('fs');var path=require(_0x82bb('0x7'));var rimraf=require(_0x82bb('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x461f97,_0x23b432){return _0x461f97[_0x82bb('0x9')](_0x82bb('0xa'),attributes,{'tableName':_0x82bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 854902c..1aed265 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xccbd=['moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','where','include','map','model','attributes','ShowWhatsappAccount','lodash','util'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xccbd,0xb2));var _0xdccb=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xccbd[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xdccb('0x0'));var util=require(_0xdccb('0x1'));var moment=require(_0xdccb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdccb('0x3'));var db=require(_0xdccb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdccb('0x5'))(_0xdccb('0x6'));var config=require(_0xdccb('0x7'));var jayson=require(_0xdccb('0x8'));var client=jayson[_0xdccb('0x9')][_0xdccb('0xa')]({'port':0x232a});config[_0xdccb('0xb')]=_[_0xdccb('0xc')](config[_0xdccb('0xb')],{'host':_0xdccb('0xd'),'port':0x18eb});var socket=require(_0xdccb('0xe'))(new Redis(config[_0xdccb('0xb')]));require('./whatsappAccount.socket')[_0xdccb('0xf')](socket);function respondWithRpcPromise(_0x30b20b,_0x59d78a,_0x31e812){return new BPromise(function(_0x2fd7b5,_0x232379){return client['request'](_0x30b20b,_0x31e812)[_0xdccb('0x10')](function(_0x15cb8d){logger[_0xdccb('0x11')](_0xdccb('0x12'),_0x59d78a,_0xdccb('0x13'));logger[_0xdccb('0x14')](_0xdccb('0x15'),_0x59d78a,'request\x20sent',JSON[_0xdccb('0x16')](_0x15cb8d));if(_0x15cb8d[_0xdccb('0x17')]){if(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x18')]===0x1f4){logger[_0xdccb('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x59d78a,_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);return _0x232379(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);}logger[_0xdccb('0x17')](_0xdccb('0x12'),_0x59d78a,_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);return _0x2fd7b5(_0x15cb8d[_0xdccb('0x17')][_0xdccb('0x19')]);}else{logger['info'](_0xdccb('0x12'),_0x59d78a,'request\x20sent');_0x2fd7b5(_0x15cb8d[_0xdccb('0x1a')][_0xdccb('0x19')]);}})[_0xdccb('0x1b')](function(_0x2692b6){logger[_0xdccb('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x59d78a,_0x2692b6);_0x232379(_0x2692b6);});});}exports['ShowWhatsappAccount']=function(_0x59424a){var _0x2df28c=this;return new Promise(function(_0x30c705,_0x318bce){return db['WhatsappAccount'][_0xdccb('0x1c')]({'raw':_0x59424a['options']?_0x59424a['options']['raw']===undefined?!![]:![]:!![],'where':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')][_0xdccb('0x1e')]||null:null,'attributes':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')]['attributes']||null:null,'include':_0x59424a[_0xdccb('0x1d')]?_0x59424a[_0xdccb('0x1d')][_0xdccb('0x1f')]?_[_0xdccb('0x20')](_0x59424a[_0xdccb('0x1d')]['include'],function(_0x3a251d){return{'model':db[_0x3a251d[_0xdccb('0x21')]],'as':_0x3a251d['as'],'attributes':_0x3a251d[_0xdccb('0x22')],'include':_0x3a251d[_0xdccb('0x1f')]?_['map'](_0x3a251d[_0xdccb('0x1f')],function(_0x25d661){return{'model':db[_0x25d661[_0xdccb('0x21')]],'as':_0x25d661['as'],'attributes':_0x25d661['attributes'],'include':_0x25d661[_0xdccb('0x1f')]?_['map'](_0x25d661[_0xdccb('0x1f')],function(_0x5d22ce){return{'model':db[_0x5d22ce[_0xdccb('0x21')]],'as':_0x5d22ce['as'],'attributes':_0x5d22ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xdccb('0x10')](function(_0x5dd0d3){logger[_0xdccb('0x11')](_0xdccb('0x23'),_0x59424a);logger[_0xdccb('0x14')]('ShowWhatsappAccount',_0x59424a,JSON[_0xdccb('0x16')](_0x5dd0d3));_0x30c705(_0x5dd0d3);})[_0xdccb('0x1b')](function(_0x262532){logger[_0xdccb('0x17')]('ShowWhatsappAccount',_0x262532[_0xdccb('0x19')],_0x59424a);_0x318bce(_0x2df28c[_0xdccb('0x17')](0x1f4,_0x262532[_0xdccb('0x19')]));});});}; \ No newline at end of file +var _0xf93e=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','map','attributes','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3638cd,_0xf04fca){var _0x1997df=function(_0x5dc942){while(--_0x5dc942){_0x3638cd['push'](_0x3638cd['shift']());}};_0x1997df(++_0xf04fca);}(_0xf93e,0xa3));var _0xef93=function(_0x32b5be,_0x5ad1f2){_0x32b5be=_0x32b5be-0x0;var _0x7a9763=_0xf93e[_0x32b5be];return _0x7a9763;};'use strict';var _=require('lodash');var util=require(_0xef93('0x0'));var moment=require(_0xef93('0x1'));var BPromise=require(_0xef93('0x2'));var rs=require(_0xef93('0x3'));var fs=require('fs');var Redis=require(_0xef93('0x4'));var db=require(_0xef93('0x5'))['db'];var utils=require(_0xef93('0x6'));var logger=require('../../config/logger')(_0xef93('0x7'));var config=require(_0xef93('0x8'));var jayson=require(_0xef93('0x9'));var client=jayson[_0xef93('0xa')][_0xef93('0xb')]({'port':0x232a});config[_0xef93('0xc')]=_[_0xef93('0xd')](config[_0xef93('0xc')],{'host':_0xef93('0xe'),'port':0x18eb});var socket=require(_0xef93('0xf'))(new Redis(config['redis']));require(_0xef93('0x10'))['register'](socket);function respondWithRpcPromise(_0x248d10,_0x4a88c4,_0xffcc9){return new BPromise(function(_0x74fb29,_0x1f618f){return client['request'](_0x248d10,_0xffcc9)[_0xef93('0x11')](function(_0x256b3b){logger['info'](_0xef93('0x12'),_0x4a88c4,_0xef93('0x13'));logger['debug'](_0xef93('0x14'),_0x4a88c4,_0xef93('0x13'),JSON[_0xef93('0x15')](_0x256b3b));if(_0x256b3b['error']){if(_0x256b3b['error']['code']===0x1f4){logger['error'](_0xef93('0x12'),_0x4a88c4,_0x256b3b['error'][_0xef93('0x16')]);return _0x1f618f(_0x256b3b[_0xef93('0x17')][_0xef93('0x16')]);}logger[_0xef93('0x17')](_0xef93('0x12'),_0x4a88c4,_0x256b3b[_0xef93('0x17')]['message']);return _0x74fb29(_0x256b3b[_0xef93('0x17')][_0xef93('0x16')]);}else{logger['info'](_0xef93('0x12'),_0x4a88c4,_0xef93('0x13'));_0x74fb29(_0x256b3b['result'][_0xef93('0x16')]);}})[_0xef93('0x18')](function(_0x75ee11){logger[_0xef93('0x17')](_0xef93('0x12'),_0x4a88c4,_0x75ee11);_0x1f618f(_0x75ee11);});});}exports[_0xef93('0x19')]=function(_0x1487d8){var _0x343bea=this;return new Promise(function(_0xd4aecf,_0x26afdf){return db[_0xef93('0x1a')][_0xef93('0x1b')]({'raw':_0x1487d8[_0xef93('0x1c')]?_0x1487d8[_0xef93('0x1c')][_0xef93('0x1d')]===undefined?!![]:![]:!![],'where':_0x1487d8[_0xef93('0x1c')]?_0x1487d8[_0xef93('0x1c')]['where']||null:null,'attributes':_0x1487d8[_0xef93('0x1c')]?_0x1487d8[_0xef93('0x1c')]['attributes']||null:null,'include':_0x1487d8[_0xef93('0x1c')]?_0x1487d8[_0xef93('0x1c')][_0xef93('0x1e')]?_[_0xef93('0x1f')](_0x1487d8[_0xef93('0x1c')][_0xef93('0x1e')],function(_0x113909){return{'model':db[_0x113909['model']],'as':_0x113909['as'],'attributes':_0x113909[_0xef93('0x20')],'include':_0x113909['include']?_[_0xef93('0x1f')](_0x113909[_0xef93('0x1e')],function(_0x58a3a8){return{'model':db[_0x58a3a8[_0xef93('0x21')]],'as':_0x58a3a8['as'],'attributes':_0x58a3a8[_0xef93('0x20')],'include':_0x58a3a8['include']?_[_0xef93('0x1f')](_0x58a3a8[_0xef93('0x1e')],function(_0x35eaec){return{'model':db[_0x35eaec['model']],'as':_0x35eaec['as'],'attributes':_0x35eaec['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2325f9){logger[_0xef93('0x22')](_0xef93('0x19'),_0x1487d8);logger['debug'](_0xef93('0x19'),_0x1487d8,JSON[_0xef93('0x15')](_0x2325f9));_0xd4aecf(_0x2325f9);})[_0xef93('0x18')](function(_0x12d119){logger[_0xef93('0x17')]('ShowWhatsappAccount',_0x12d119['message'],_0x1487d8);_0x26afdf(_0x343bea[_0xef93('0x17')](0x1f4,_0x12d119[_0xef93('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index fb67955..aec16f1 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73a7=['register','./whatsappAccount.events','save','update','emit','removeListener'];(function(_0x2d978f,_0xc8b202){var _0x6ad24f=function(_0x4e191a){while(--_0x4e191a){_0x2d978f['push'](_0x2d978f['shift']());}};_0x6ad24f(++_0xc8b202);}(_0x73a7,0xa3));var _0x773a=function(_0x1d2e96,_0x158219){_0x1d2e96=_0x1d2e96-0x0;var _0x3d0b52=_0x73a7[_0x1d2e96];return _0x3d0b52;};'use strict';var WhatsappAccountEvents=require(_0x773a('0x0'));var events=[_0x773a('0x1'),'remove',_0x773a('0x2')];function createListener(_0x3414f4,_0xf6b2a1){return function(_0x3e4caa){_0xf6b2a1[_0x773a('0x3')](_0x3414f4,_0x3e4caa);};}function removeListener(_0x2799db,_0x2de5f0){return function(){WhatsappAccountEvents[_0x773a('0x4')](_0x2799db,_0x2de5f0);};}exports[_0x773a('0x5')]=function(_0x57cb66){for(var _0x5c87b3=0x0,_0x1a2969=events['length'];_0x5c87b3<_0x1a2969;_0x5c87b3++){var _0x44c4c0=events[_0x5c87b3];var _0x22b66e=createListener('whatsappAccount:'+_0x44c4c0,_0x57cb66);WhatsappAccountEvents['on'](_0x44c4c0,_0x22b66e);}}; \ No newline at end of file +var _0x91be=['removeListener','whatsappAccount:','save','remove','emit'];(function(_0x3491fa,_0x2a0db8){var _0x285f79=function(_0x58fb0a){while(--_0x58fb0a){_0x3491fa['push'](_0x3491fa['shift']());}};_0x285f79(++_0x2a0db8);}(_0x91be,0x66));var _0xe91b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x91be[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xe91b('0x0'),_0xe91b('0x1'),'update'];function createListener(_0x547f01,_0x347d0c){return function(_0x448f6f){_0x347d0c[_0xe91b('0x2')](_0x547f01,_0x448f6f);};}function removeListener(_0xdaf32c,_0x256edd){return function(){WhatsappAccountEvents[_0xe91b('0x3')](_0xdaf32c,_0x256edd);};}exports['register']=function(_0x150a42){for(var _0x17eca1=0x0,_0xcb6876=events['length'];_0x17eca1<_0xcb6876;_0x17eca1++){var _0x1b7e68=events[_0x17eca1];var _0x190bd8=createListener(_0xe91b('0x4')+_0x1b7e68,_0x150a42);WhatsappAccountEvents['on'](_0x1b7e68,_0x190bd8);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 35609eb..d42bbf8 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc86=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','/:id','post','isAuthenticated','create','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbc86,0x1e8));var _0x6bc8=function(_0x16691e,_0x239876){_0x16691e=_0x16691e-0x0;var _0xd391a5=_0xbc86[_0x16691e];return _0xd391a5;};'use strict';var multer=require('multer');var util=require(_0x6bc8('0x0'));var path=require('path');var timeout=require(_0x6bc8('0x1'));var express=require(_0x6bc8('0x2'));var router=express[_0x6bc8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bc8('0x4'));var interaction=require(_0x6bc8('0x5'));var config=require(_0x6bc8('0x6'));var controller=require(_0x6bc8('0x7'));router[_0x6bc8('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bc8('0x9')]);router[_0x6bc8('0x8')](_0x6bc8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6bc8('0xb')]('/',auth[_0x6bc8('0xc')](),controller[_0x6bc8('0xd')]);router[_0x6bc8('0xe')](_0x6bc8('0xa'),auth[_0x6bc8('0xc')](),controller[_0x6bc8('0xf')]);router[_0x6bc8('0x10')]('/:id',auth[_0x6bc8('0xc')](),controller[_0x6bc8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe1aa=['index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x51a95a,_0xbea60b){var _0xf9eb6c=function(_0x5d86ce){while(--_0x5d86ce){_0x51a95a['push'](_0x51a95a['shift']());}};_0xf9eb6c(++_0xbea60b);}(_0xe1aa,0xdb));var _0xae1a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe1aa[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xae1a('0x0'));var util=require(_0xae1a('0x1'));var path=require(_0xae1a('0x2'));var timeout=require(_0xae1a('0x3'));var express=require(_0xae1a('0x4'));var router=express[_0xae1a('0x5')]();var fs_extra=require(_0xae1a('0x6'));var auth=require(_0xae1a('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0xae1a('0x8')]('/',auth['isAuthenticated'](),controller[_0xae1a('0x9')]);router[_0xae1a('0x8')](_0xae1a('0xa'),auth[_0xae1a('0xb')](),controller[_0xae1a('0xc')]);router[_0xae1a('0xd')]('/',auth['isAuthenticated'](),controller[_0xae1a('0xe')]);router[_0xae1a('0xf')](_0xae1a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xae1a('0x10')]('/:id',auth[_0xae1a('0xb')](),controller[_0xae1a('0x11')]);module[_0xae1a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 17b0400..9f294a8 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe52=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x1b0068,_0x320cdb){var _0x302827=function(_0x5137cb){while(--_0x5137cb){_0x1b0068['push'](_0x1b0068['shift']());}};_0x302827(++_0x320cdb);}(_0xfe52,0x93));var _0x2fe5=function(_0x541b3b,_0x2e058f){_0x541b3b=_0x541b3b-0x0;var _0x1d58e8=_0xfe52[_0x541b3b];return _0x1d58e8;};'use strict';var Sequelize=require(_0x2fe5('0x0'));module[_0x2fe5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2fe5('0x2')],'allowNull':![],'defaultValue':_0x2fe5('0x3')},'appdata':{'type':Sequelize[_0x2fe5('0x4')]()},'description':{'type':Sequelize[_0x2fe5('0x2')]},'interval':{'type':Sequelize[_0x2fe5('0x2')],'defaultValue':_0x2fe5('0x5')}}; \ No newline at end of file +var _0x7831=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x56a0ea,_0x513e71){var _0x49dde5=function(_0x485b43){while(--_0x485b43){_0x56a0ea['push'](_0x56a0ea['shift']());}};_0x49dde5(++_0x513e71);}(_0x7831,0x1ba));var _0x1783=function(_0x10a64c,_0x3ff1fb){_0x10a64c=_0x10a64c-0x0;var _0xc9a8af=_0x7831[_0x10a64c];return _0xc9a8af;};'use strict';var Sequelize=require(_0x1783('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1783('0x1')],'allowNull':![],'defaultValue':_0x1783('0x2')},'appdata':{'type':Sequelize[_0x1783('0x3')]()},'description':{'type':Sequelize[_0x1783('0x1')]},'interval':{'type':Sequelize[_0x1783('0x1')],'defaultValue':_0x1783('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 6f25ca1..e1d60a1 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20de=['keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','then','rows','catch','show','params','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','key','model','map','query'];(function(_0x418908,_0x25a375){var _0x8db3b4=function(_0x2b2ead){while(--_0x2b2ead){_0x418908['push'](_0x418908['shift']());}};_0x8db3b4(++_0x25a375);}(_0x20de,0x134));var _0xe20d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x20de[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0xe20d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe20d('0x1'));var jsonpatch=require(_0xe20d('0x2'));var rp=require(_0xe20d('0x3'));var moment=require(_0xe20d('0x4'));var BPromise=require(_0xe20d('0x5'));var Mustache=require(_0xe20d('0x6'));var util=require(_0xe20d('0x7'));var path=require(_0xe20d('0x8'));var sox=require(_0xe20d('0x9'));var csv=require(_0xe20d('0xa'));var ejs=require(_0xe20d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe20d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe20d('0xd'));var toCsv=require(_0xe20d('0xa'));var querystring=require(_0xe20d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe20d('0xf'));var authService=require(_0xe20d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe20d('0x11'));var hardwareService=require(_0xe20d('0x12'));var logger=require('../../config/logger')(_0xe20d('0x13'));var utils=require(_0xe20d('0x14'));var config=require(_0xe20d('0x15'));var licenseUtil=require(_0xe20d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a581,_0x28d9c5){_0x28d9c5=_0x28d9c5||0xcc;return function(_0xdc395e){if(_0xdc395e){return _0x59a581[_0xe20d('0x17')](_0x28d9c5);}return _0x59a581[_0xe20d('0x18')](_0x28d9c5)[_0xe20d('0x19')]();};}function respondWithResult(_0x26f1dd,_0x2e8b2b){_0x2e8b2b=_0x2e8b2b||0xc8;return function(_0x2e0fff){if(_0x2e0fff){return _0x26f1dd[_0xe20d('0x18')](_0x2e8b2b)['json'](_0x2e0fff);}};}function respondWithFilteredResult(_0x2367f7,_0x4a3576){return function(_0x42e8e4){if(_0x42e8e4){var _0x3aa19d=typeof _0x4a3576[_0xe20d('0x1a')]==='undefined'&&typeof _0x4a3576[_0xe20d('0x1b')]==='undefined';var _0x1738d9=_0x42e8e4[_0xe20d('0x1c')];var _0x285916=_0x3aa19d?0x0:_0x4a3576['offset'];var _0x4353cb=_0x3aa19d?_0x42e8e4[_0xe20d('0x1c')]:_0x4a3576[_0xe20d('0x1a')]+_0x4a3576[_0xe20d('0x1b')];var _0x5d93da;if(_0x4353cb>=_0x1738d9){_0x4353cb=_0x1738d9;_0x5d93da=0xc8;}else{_0x5d93da=0xce;}_0x2367f7[_0xe20d('0x18')](_0x5d93da);return _0x2367f7[_0xe20d('0x1d')](_0xe20d('0x1e'),_0x285916+'-'+_0x4353cb+'/'+_0x1738d9)[_0xe20d('0x1f')](_0x42e8e4);}return null;};}function patchUpdates(_0x48577c){return function(_0x1b4151){try{jsonpatch['apply'](_0x1b4151,_0x48577c,!![]);}catch(_0x4ac635){return BPromise[_0xe20d('0x20')](_0x4ac635);}return _0x1b4151[_0xe20d('0x21')]();};}function saveUpdates(_0x4baa28,_0x5e7237){return function(_0x1552d8){if(_0x1552d8){return _0x1552d8[_0xe20d('0x22')](_0x4baa28)['then'](function(_0x20b62b){return _0x20b62b;});}return null;};}function removeEntity(_0x3fc8b0,_0x3f0227){return function(_0x3b962f){if(_0x3b962f){return _0x3b962f[_0xe20d('0x23')]()['then'](function(){_0x3fc8b0[_0xe20d('0x18')](0xcc)[_0xe20d('0x19')]();});}};}function handleEntityNotFound(_0x1a76bc,_0x4504ee){return function(_0x21a53a){if(!_0x21a53a){_0x1a76bc['sendStatus'](0x194);}return _0x21a53a;};}function handleError(_0x5f1626,_0x27b759){_0x27b759=_0x27b759||0x1f4;return function(_0x497726){logger[_0xe20d('0x24')](_0x497726[_0xe20d('0x25')]);if(_0x497726[_0xe20d('0x26')]){delete _0x497726[_0xe20d('0x26')];}_0x5f1626[_0xe20d('0x18')](_0x27b759)[_0xe20d('0x27')](_0x497726);};}exports[_0xe20d('0x28')]=function(_0x59d416,_0x8b7386){var _0x5ecc55={},_0x555eb5={},_0x514891={'count':0x0,'rows':[]};var _0x58cad3=_['map'](db[_0xe20d('0x29')][_0xe20d('0x2a')],function(_0x41e140){return{'name':_0x41e140['fieldName'],'type':_0x41e140['type'][_0xe20d('0x2b')]};});_0x555eb5[_0xe20d('0x2c')]=_[_0xe20d('0x2d')](_0x58cad3,_0xe20d('0x26'));_0x555eb5[_0xe20d('0x2e')]=_[_0xe20d('0x2f')](_0x59d416[_0xe20d('0x2e')]);_0x555eb5[_0xe20d('0x30')]=_['intersection'](_0x555eb5[_0xe20d('0x2c')],_0x555eb5['query']);_0x5ecc55['attributes']=_[_0xe20d('0x31')](_0x555eb5['model'],qs[_0xe20d('0x32')](_0x59d416[_0xe20d('0x2e')]['fields']));_0x5ecc55['attributes']=_0x5ecc55['attributes'][_0xe20d('0x33')]?_0x5ecc55[_0xe20d('0x34')]:_0x555eb5[_0xe20d('0x2c')];if(!_0x59d416[_0xe20d('0x2e')][_0xe20d('0x35')](_0xe20d('0x36'))){_0x5ecc55['limit']=qs[_0xe20d('0x1b')](_0x59d416[_0xe20d('0x2e')][_0xe20d('0x1b')]);_0x5ecc55[_0xe20d('0x1a')]=qs['offset'](_0x59d416[_0xe20d('0x2e')][_0xe20d('0x1a')]);}_0x5ecc55[_0xe20d('0x37')]=qs[_0xe20d('0x38')](_0x59d416['query']['sort']);_0x5ecc55[_0xe20d('0x39')]=qs[_0xe20d('0x30')](_['pick'](_0x59d416[_0xe20d('0x2e')],_0x555eb5[_0xe20d('0x30')]),_0x58cad3);if(_0x59d416[_0xe20d('0x2e')][_0xe20d('0x3a')]){_0x5ecc55[_0xe20d('0x39')]=_[_0xe20d('0x3b')](_0x5ecc55[_0xe20d('0x39')],{'$or':_[_0xe20d('0x2d')](_0x58cad3,function(_0x548301){if(_0x548301['type']!=='VIRTUAL'){var _0x1733e3={};_0x1733e3[_0x548301[_0xe20d('0x26')]]={'$like':'%'+_0x59d416['query'][_0xe20d('0x3a')]+'%'};return _0x1733e3;}})});}_0x5ecc55=_[_0xe20d('0x3b')]({},_0x5ecc55,_0x59d416['options']);var _0x589980={'where':_0x5ecc55[_0xe20d('0x39')]};return db['WhatsappApplication'][_0xe20d('0x1c')](_0x589980)['then'](function(_0x1d5e89){_0x514891[_0xe20d('0x1c')]=_0x1d5e89;if(_0x59d416['query'][_0xe20d('0x3c')]){_0x5ecc55[_0xe20d('0x3d')]=[{'all':!![]}];}return db[_0xe20d('0x29')]['findAll'](_0x5ecc55);})[_0xe20d('0x3e')](function(_0x26958c){_0x514891[_0xe20d('0x3f')]=_0x26958c;return _0x514891;})[_0xe20d('0x3e')](respondWithFilteredResult(_0x8b7386,_0x5ecc55))[_0xe20d('0x40')](handleError(_0x8b7386,null));};exports[_0xe20d('0x41')]=function(_0x201954,_0x340c88){var _0x1770f4={'raw':!![],'where':{'id':_0x201954[_0xe20d('0x42')]['id']}},_0x47b5b5={};_0x47b5b5['model']=_[_0xe20d('0x2f')](db[_0xe20d('0x29')][_0xe20d('0x2a')]);_0x47b5b5[_0xe20d('0x2e')]=_[_0xe20d('0x2f')](_0x201954['query']);_0x47b5b5[_0xe20d('0x30')]=_[_0xe20d('0x31')](_0x47b5b5[_0xe20d('0x2c')],_0x47b5b5[_0xe20d('0x2e')]);_0x1770f4[_0xe20d('0x34')]=_[_0xe20d('0x31')](_0x47b5b5['model'],qs[_0xe20d('0x32')](_0x201954[_0xe20d('0x2e')][_0xe20d('0x32')]));_0x1770f4[_0xe20d('0x34')]=_0x1770f4[_0xe20d('0x34')]['length']?_0x1770f4[_0xe20d('0x34')]:_0x47b5b5[_0xe20d('0x2c')];if(_0x201954[_0xe20d('0x2e')]['includeAll']){_0x1770f4['include']=[{'all':!![]}];}_0x1770f4=_[_0xe20d('0x3b')]({},_0x1770f4,_0x201954[_0xe20d('0x43')]);return db[_0xe20d('0x29')][_0xe20d('0x44')](_0x1770f4)[_0xe20d('0x3e')](handleEntityNotFound(_0x340c88,null))[_0xe20d('0x3e')](respondWithResult(_0x340c88,null))[_0xe20d('0x40')](handleError(_0x340c88,null));};exports[_0xe20d('0x45')]=function(_0x1f37c1,_0x5dc2e1){return db[_0xe20d('0x29')][_0xe20d('0x45')](_0x1f37c1[_0xe20d('0x46')],{})[_0xe20d('0x3e')](respondWithResult(_0x5dc2e1,0xc9))[_0xe20d('0x40')](handleError(_0x5dc2e1,null));};exports[_0xe20d('0x22')]=function(_0x4279b4,_0x510d50){if(_0x4279b4[_0xe20d('0x46')]['id']){delete _0x4279b4[_0xe20d('0x46')]['id'];}return db[_0xe20d('0x29')]['find']({'where':{'id':_0x4279b4[_0xe20d('0x42')]['id']}})[_0xe20d('0x3e')](handleEntityNotFound(_0x510d50,null))['then'](saveUpdates(_0x4279b4[_0xe20d('0x46')],null))[_0xe20d('0x3e')](respondWithResult(_0x510d50,null))[_0xe20d('0x40')](handleError(_0x510d50,null));};exports[_0xe20d('0x23')]=function(_0x23a586,_0x317a0d){return db[_0xe20d('0x29')][_0xe20d('0x44')]({'where':{'id':_0x23a586[_0xe20d('0x42')]['id']}})[_0xe20d('0x3e')](handleEntityNotFound(_0x317a0d,null))['then'](removeEntity(_0x317a0d,null))[_0xe20d('0x40')](handleError(_0x317a0d,null));}; \ No newline at end of file +var _0xc648=['include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','WhatsappApplication','rawAttributes','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','fields'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xc648,0x171));var _0x8c64=function(_0x1b3c39,_0x242b15){_0x1b3c39=_0x1b3c39-0x0;var _0x4252b5=_0xc648[_0x1b3c39];return _0x4252b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c64('0x0'));var zipdir=require(_0x8c64('0x1'));var jsonpatch=require(_0x8c64('0x2'));var rp=require(_0x8c64('0x3'));var moment=require(_0x8c64('0x4'));var BPromise=require(_0x8c64('0x5'));var Mustache=require(_0x8c64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8c64('0x7'));var ejs=require(_0x8c64('0x8'));var fs=require('fs');var fs_extra=require(_0x8c64('0x9'));var _=require(_0x8c64('0xa'));var squel=require('squel');var crypto=require(_0x8c64('0xb'));var jsforce=require(_0x8c64('0xc'));var deskjs=require(_0x8c64('0xd'));var toCsv=require(_0x8c64('0x7'));var querystring=require(_0x8c64('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c64('0xf'));var authService=require(_0x8c64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c64('0x11'));var hardwareService=require(_0x8c64('0x12'));var logger=require(_0x8c64('0x13'))(_0x8c64('0x14'));var utils=require(_0x8c64('0x15'));var config=require(_0x8c64('0x16'));var licenseUtil=require(_0x8c64('0x17'));var db=require(_0x8c64('0x18'))['db'];function respondWithStatusCode(_0x3834e6,_0x19a173){_0x19a173=_0x19a173||0xcc;return function(_0x54e0f0){if(_0x54e0f0){return _0x3834e6[_0x8c64('0x19')](_0x19a173);}return _0x3834e6[_0x8c64('0x1a')](_0x19a173)[_0x8c64('0x1b')]();};}function respondWithResult(_0x36e227,_0x3a4cbf){_0x3a4cbf=_0x3a4cbf||0xc8;return function(_0xeb374){if(_0xeb374){return _0x36e227[_0x8c64('0x1a')](_0x3a4cbf)['json'](_0xeb374);}};}function respondWithFilteredResult(_0x14df4a,_0x16c84e){return function(_0x4dbf8d){if(_0x4dbf8d){var _0xfacf06=typeof _0x16c84e[_0x8c64('0x1c')]==='undefined'&&typeof _0x16c84e[_0x8c64('0x1d')]===_0x8c64('0x1e');var _0x511608=_0x4dbf8d['count'];var _0x20931c=_0xfacf06?0x0:_0x16c84e[_0x8c64('0x1c')];var _0x4be59b=_0xfacf06?_0x4dbf8d[_0x8c64('0x1f')]:_0x16c84e[_0x8c64('0x1c')]+_0x16c84e['limit'];var _0x4d7350;if(_0x4be59b>=_0x511608){_0x4be59b=_0x511608;_0x4d7350=0xc8;}else{_0x4d7350=0xce;}_0x14df4a['status'](_0x4d7350);return _0x14df4a[_0x8c64('0x20')]('Content-Range',_0x20931c+'-'+_0x4be59b+'/'+_0x511608)['json'](_0x4dbf8d);}return null;};}function patchUpdates(_0x45839d){return function(_0x6d288f){try{jsonpatch[_0x8c64('0x21')](_0x6d288f,_0x45839d,!![]);}catch(_0x2c837c){return BPromise[_0x8c64('0x22')](_0x2c837c);}return _0x6d288f[_0x8c64('0x23')]();};}function saveUpdates(_0x4e7853,_0x28b7dd){return function(_0x51c459){if(_0x51c459){return _0x51c459[_0x8c64('0x24')](_0x4e7853)['then'](function(_0x2624dc){return _0x2624dc;});}return null;};}function removeEntity(_0x3f9a8a,_0x4b2f7b){return function(_0x400bf7){if(_0x400bf7){return _0x400bf7[_0x8c64('0x25')]()[_0x8c64('0x26')](function(){_0x3f9a8a['status'](0xcc)[_0x8c64('0x1b')]();});}};}function handleEntityNotFound(_0x4ddd8f,_0x282f6e){return function(_0xd3001c){if(!_0xd3001c){_0x4ddd8f[_0x8c64('0x19')](0x194);}return _0xd3001c;};}function handleError(_0x153d86,_0x328da5){_0x328da5=_0x328da5||0x1f4;return function(_0x56e847){logger[_0x8c64('0x27')](_0x56e847['stack']);if(_0x56e847['name']){delete _0x56e847[_0x8c64('0x28')];}_0x153d86['status'](_0x328da5)[_0x8c64('0x29')](_0x56e847);};}exports[_0x8c64('0x2a')]=function(_0x1cf017,_0x5570cf){var _0x87f610={},_0x2d7548={},_0x13f0b0={'count':0x0,'rows':[]};var _0x1bb974=_[_0x8c64('0x2b')](db[_0x8c64('0x2c')][_0x8c64('0x2d')],function(_0x1e2706){return{'name':_0x1e2706['fieldName'],'type':_0x1e2706['type']['key']};});_0x2d7548[_0x8c64('0x2e')]=_[_0x8c64('0x2b')](_0x1bb974,_0x8c64('0x28'));_0x2d7548[_0x8c64('0x2f')]=_['keys'](_0x1cf017[_0x8c64('0x2f')]);_0x2d7548[_0x8c64('0x30')]=_['intersection'](_0x2d7548[_0x8c64('0x2e')],_0x2d7548['query']);_0x87f610['attributes']=_[_0x8c64('0x31')](_0x2d7548[_0x8c64('0x2e')],qs['fields'](_0x1cf017['query']['fields']));_0x87f610[_0x8c64('0x32')]=_0x87f610[_0x8c64('0x32')][_0x8c64('0x33')]?_0x87f610[_0x8c64('0x32')]:_0x2d7548[_0x8c64('0x2e')];if(!_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x34')](_0x8c64('0x35'))){_0x87f610[_0x8c64('0x1d')]=qs['limit'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1d')]);_0x87f610[_0x8c64('0x1c')]=qs['offset'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x1c')]);}_0x87f610[_0x8c64('0x36')]=qs['sort'](_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x37')]);_0x87f610[_0x8c64('0x38')]=qs[_0x8c64('0x30')](_[_0x8c64('0x39')](_0x1cf017[_0x8c64('0x2f')],_0x2d7548[_0x8c64('0x30')]),_0x1bb974);if(_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]){_0x87f610[_0x8c64('0x38')]=_[_0x8c64('0x3b')](_0x87f610[_0x8c64('0x38')],{'$or':_[_0x8c64('0x2b')](_0x1bb974,function(_0x3142ee){if(_0x3142ee['type']!=='VIRTUAL'){var _0x444a5b={};_0x444a5b[_0x3142ee[_0x8c64('0x28')]]={'$like':'%'+_0x1cf017[_0x8c64('0x2f')][_0x8c64('0x3a')]+'%'};return _0x444a5b;}})});}_0x87f610=_['merge']({},_0x87f610,_0x1cf017[_0x8c64('0x3c')]);var _0x430d82={'where':_0x87f610[_0x8c64('0x38')]};return db[_0x8c64('0x2c')][_0x8c64('0x1f')](_0x430d82)['then'](function(_0x3b9f51){_0x13f0b0[_0x8c64('0x1f')]=_0x3b9f51;if(_0x1cf017['query'][_0x8c64('0x3d')]){_0x87f610['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x8c64('0x3e')](_0x87f610);})[_0x8c64('0x26')](function(_0x5f3c6d){_0x13f0b0[_0x8c64('0x3f')]=_0x5f3c6d;return _0x13f0b0;})[_0x8c64('0x26')](respondWithFilteredResult(_0x5570cf,_0x87f610))[_0x8c64('0x40')](handleError(_0x5570cf,null));};exports[_0x8c64('0x41')]=function(_0x15bb03,_0x452644){var _0x433d5b={'raw':!![],'where':{'id':_0x15bb03[_0x8c64('0x42')]['id']}},_0x311803={};_0x311803[_0x8c64('0x2e')]=_[_0x8c64('0x43')](db['WhatsappApplication'][_0x8c64('0x2d')]);_0x311803[_0x8c64('0x2f')]=_[_0x8c64('0x43')](_0x15bb03['query']);_0x311803[_0x8c64('0x30')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],_0x311803['query']);_0x433d5b[_0x8c64('0x32')]=_[_0x8c64('0x31')](_0x311803[_0x8c64('0x2e')],qs[_0x8c64('0x44')](_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x44')]));_0x433d5b['attributes']=_0x433d5b[_0x8c64('0x32')][_0x8c64('0x33')]?_0x433d5b[_0x8c64('0x32')]:_0x311803[_0x8c64('0x2e')];if(_0x15bb03[_0x8c64('0x2f')][_0x8c64('0x3d')]){_0x433d5b[_0x8c64('0x45')]=[{'all':!![]}];}_0x433d5b=_[_0x8c64('0x3b')]({},_0x433d5b,_0x15bb03[_0x8c64('0x3c')]);return db[_0x8c64('0x2c')][_0x8c64('0x46')](_0x433d5b)[_0x8c64('0x26')](handleEntityNotFound(_0x452644,null))[_0x8c64('0x26')](respondWithResult(_0x452644,null))[_0x8c64('0x40')](handleError(_0x452644,null));};exports[_0x8c64('0x47')]=function(_0x4f7f1b,_0x163a29){return db[_0x8c64('0x2c')][_0x8c64('0x47')](_0x4f7f1b[_0x8c64('0x48')],{})[_0x8c64('0x26')](respondWithResult(_0x163a29,0xc9))[_0x8c64('0x40')](handleError(_0x163a29,null));};exports['update']=function(_0x2503a7,_0x19d248){if(_0x2503a7[_0x8c64('0x48')]['id']){delete _0x2503a7[_0x8c64('0x48')]['id'];}return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2503a7[_0x8c64('0x42')]['id']}})['then'](handleEntityNotFound(_0x19d248,null))[_0x8c64('0x26')](saveUpdates(_0x2503a7[_0x8c64('0x48')],null))['then'](respondWithResult(_0x19d248,null))['catch'](handleError(_0x19d248,null));};exports[_0x8c64('0x25')]=function(_0x2987cb,_0x219494){return db[_0x8c64('0x2c')][_0x8c64('0x46')]({'where':{'id':_0x2987cb[_0x8c64('0x42')]['id']}})[_0x8c64('0x26')](handleEntityNotFound(_0x219494,null))['then'](removeEntity(_0x219494,null))[_0x8c64('0x40')](handleError(_0x219494,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2f4502c..f48b9bf 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d4=['exports','WhatsappApplication','whatsapp_applications','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x35a4f3,_0x297ce0){var _0x29d8c5=function(_0x45536e){while(--_0x45536e){_0x35a4f3['push'](_0x35a4f3['shift']());}};_0x29d8c5(++_0x297ce0);}(_0x57d4,0x78));var _0x457d=function(_0x19677f,_0x518fe1){_0x19677f=_0x19677f-0x0;var _0x1fe914=_0x57d4[_0x19677f];return _0x1fe914;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x68f5=['bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x4ac72a,_0x10a738){var _0x1eab42=function(_0x1ea784){while(--_0x1ea784){_0x4ac72a['push'](_0x4ac72a['shift']());}};_0x1eab42(++_0x10a738);}(_0x68f5,0x11a));var _0x568f=function(_0x5abcba,_0x7dc4e8){_0x5abcba=_0x5abcba-0x0;var _0x4c48b7=_0x68f5[_0x5abcba];return _0x4c48b7;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))('api');var moment=require(_0x568f('0x3'));var BPromise=require(_0x568f('0x4'));var rp=require(_0x568f('0x5'));var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x31444b,_0x3181fd){return _0x31444b['define']('WhatsappApplication',attributes,{'tableName':_0x568f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x568f('0xb'),'collate':_0x568f('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ac4f71b..3e75124 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a5ac7,_0x519dc0){var _0x58e002=function(_0x545e90){while(--_0x545e90){_0x1a5ac7['push'](_0x1a5ac7['shift']());}};_0x58e002(++_0x519dc0);}(_0x98a8,0x12c));var _0x898a=function(_0x2a1594,_0x399b25){_0x2a1594=_0x2a1594-0x0;var _0xb12ae=_0x98a8[_0x2a1594];return _0xb12ae;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x119a07,_0x2289f6){var _0x36025c=function(_0xf28f4){while(--_0xf28f4){_0x119a07['push'](_0x119a07['shift']());}};_0x36025c(++_0x2289f6);}(_0x99e9,0xb4));var _0x999e=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0x99e9[_0xed9fea];return _0x198f12;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4fb1947..e2ecc09 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['/:id/tags','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','whatsappinteraction:addtags','put','/:id','tracked','whatsapp','update','delete'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xda19,0xd5));var _0x9da1=function(_0x16f3df,_0x3ae995){_0x16f3df=_0x16f3df-0x0;var _0x3787c7=_0xda19[_0x16f3df];return _0x3787c7;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var fs_extra=require(_0x9da1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var controller=require(_0x9da1('0x6'));router[_0x9da1('0x7')]('/',auth[_0x9da1('0x8')](),controller[_0x9da1('0x9')]);router[_0x9da1('0x7')](_0x9da1('0xa'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router['get'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0xe')]);router[_0x9da1('0x7')](_0x9da1('0xf'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9da1('0x11')]);router['post'](_0x9da1('0xd'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/:id/tags',auth[_0x9da1('0x8')](),interaction['tracked']('whatsapp',_0x9da1('0x14')),controller['addTags']);router[_0x9da1('0x15')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:update'),controller[_0x9da1('0x19')]);router[_0x9da1('0x1a')](_0x9da1('0x16'),auth[_0x9da1('0x8')](),interaction[_0x9da1('0x17')](_0x9da1('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x9da1('0x1a')](_0x9da1('0x1b'),auth[_0x9da1('0x8')](),controller[_0x9da1('0x1c')]);module[_0x9da1('0x1d')]=router; \ No newline at end of file +var _0x86f4=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','whatsapp','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x546261,_0x44b70f){var _0x1c6263=function(_0x45a5de){while(--_0x45a5de){_0x546261['push'](_0x546261['shift']());}};_0x1c6263(++_0x44b70f);}(_0x86f4,0x18a));var _0x486f=function(_0xc9e29,_0x2ca44e){_0xc9e29=_0xc9e29-0x0;var _0x2ddcab=_0x86f4[_0xc9e29];return _0x2ddcab;};'use strict';var multer=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var path=require(_0x486f('0x2'));var timeout=require(_0x486f('0x3'));var express=require(_0x486f('0x4'));var router=express[_0x486f('0x5')]();var fs_extra=require(_0x486f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x486f('0x7'));var config=require(_0x486f('0x8'));var controller=require('./whatsappInteraction.controller');router[_0x486f('0x9')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0xb')]);router[_0x486f('0x9')](_0x486f('0xc'),auth[_0x486f('0xa')](),controller['describe']);router[_0x486f('0x9')](_0x486f('0xd'),auth[_0x486f('0xa')](),controller[_0x486f('0xe')]);router[_0x486f('0x9')](_0x486f('0xf'),auth[_0x486f('0xa')](),controller[_0x486f('0x10')]);router[_0x486f('0x9')](_0x486f('0x11'),auth[_0x486f('0xa')](),controller[_0x486f('0x12')]);router[_0x486f('0x13')]('/',auth[_0x486f('0xa')](),controller[_0x486f('0x14')]);router[_0x486f('0x13')](_0x486f('0xf'),auth['isAuthenticated'](),controller[_0x486f('0x15')]);router['post'](_0x486f('0x16'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:addtags'),controller[_0x486f('0x18')]);router[_0x486f('0x19')]('/:id',auth[_0x486f('0xa')](),interaction[_0x486f('0x17')](_0x486f('0x1a'),'whatsappinteraction:update'),controller['update']);router[_0x486f('0x1b')](_0x486f('0xd'),auth[_0x486f('0xa')](),interaction[_0x486f('0x17')]('whatsapp','whatsappinteraction:destroy'),controller[_0x486f('0x1c')]);router[_0x486f('0x1b')](_0x486f('0x16'),auth[_0x486f('0xa')](),controller[_0x486f('0x1d')]);module[_0x486f('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 953c162..25828ec 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8585=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x22ee1a,_0x2fd5c9){var _0x15715d=function(_0x419004){while(--_0x419004){_0x22ee1a['push'](_0x22ee1a['shift']());}};_0x15715d(++_0x2fd5c9);}(_0x8585,0x64));var _0x5858=function(_0x69e19d,_0x25568c){_0x69e19d=_0x69e19d-0x0;var _0x4095e2=_0x8585[_0x69e19d];return _0x4095e2;};'use strict';var Sequelize=require(_0x5858('0x0'));var moment=require(_0x5858('0x1'));module[_0x5858('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5858('0x3')]},'disposition':{'type':Sequelize[_0x5858('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5858('0x4')]},'read1stAt':{'type':Sequelize[_0x5858('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5858('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5858('0x5')]('in',_0x5858('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb4c7=['out','ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x99b05f,_0x355454){_0x99b05f=_0x99b05f-0x0;var _0x3d4597=_0xb4c7[_0x99b05f];return _0x3d4597;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'closed':{'type':Sequelize[_0x7b4c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7b4c('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b4c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7b4c('0x5')]},'note':{'type':Sequelize[_0x7b4c('0x5')]},'phone':{'type':Sequelize[_0x7b4c('0x5')]},'read1stAt':{'type':Sequelize[_0x7b4c('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7b4c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7b4c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x7b4c('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7b4c('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 33d8c6c..cd3b0c8 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9e6d=['fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','sendStatus','status','json','offset','undefined','limit','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','waiting','talking','answered','unmanaged','total','UserId','closed','index','WhatsappInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','find','unreadMessages','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','all','rows','show','include','options','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','unlinkSync','eml-format','zip-dir'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2dee4a,_0x15d24f){_0x2dee4a=_0x2dee4a-0x0;var _0x4ccaa7=_0x9e6d[_0x2dee4a];return _0x4ccaa7;};'use strict';var emlformat=require(_0xd9e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd9e6('0x1'));var jsonpatch=require(_0xd9e6('0x2'));var rp=require(_0xd9e6('0x3'));var moment=require('moment');var BPromise=require(_0xd9e6('0x4'));var Mustache=require(_0xd9e6('0x5'));var util=require(_0xd9e6('0x6'));var path=require(_0xd9e6('0x7'));var sox=require('sox');var csv=require(_0xd9e6('0x8'));var ejs=require(_0xd9e6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd9e6('0xa'));var crypto=require(_0xd9e6('0xb'));var jsforce=require(_0xd9e6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd9e6('0x8'));var querystring=require(_0xd9e6('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9e6('0xe'));var authService=require(_0xd9e6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd9e6('0x10'));var hardwareService=require(_0xd9e6('0x11'));var logger=require(_0xd9e6('0x12'))(_0xd9e6('0x13'));var utils=require(_0xd9e6('0x14'));var config=require(_0xd9e6('0x15'));var licenseUtil=require(_0xd9e6('0x16'));var db=require(_0xd9e6('0x17'))['db'];config[_0xd9e6('0x18')]=_['defaults'](config[_0xd9e6('0x18')],{'host':_0xd9e6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd9e6('0x1a'))['register'](socket);function respondWithStatusCode(_0x3c69bb,_0x1b3e86){_0x1b3e86=_0x1b3e86||0xcc;return function(_0x1404d6){if(_0x1404d6){return _0x3c69bb[_0xd9e6('0x1b')](_0x1b3e86);}return _0x3c69bb[_0xd9e6('0x1c')](_0x1b3e86)['end']();};}function respondWithResult(_0x5ddd5a,_0x10d104){_0x10d104=_0x10d104||0xc8;return function(_0x5dfc4b){if(_0x5dfc4b){return _0x5ddd5a[_0xd9e6('0x1c')](_0x10d104)[_0xd9e6('0x1d')](_0x5dfc4b);}};}function respondWithFilteredResult(_0xbe657c,_0x2db831){return function(_0xe30afc){if(_0xe30afc){var _0xa7fa90=typeof _0x2db831[_0xd9e6('0x1e')]===_0xd9e6('0x1f')&&typeof _0x2db831[_0xd9e6('0x20')]===_0xd9e6('0x1f');var _0x4a95b4=_0xe30afc['count'];var _0x44ae12=_0xa7fa90?0x0:_0x2db831[_0xd9e6('0x1e')];var _0x19dfd7=_0xa7fa90?_0xe30afc['count']:_0x2db831[_0xd9e6('0x1e')]+_0x2db831[_0xd9e6('0x20')];var _0x2f113e;if(_0x19dfd7>=_0x4a95b4){_0x19dfd7=_0x4a95b4;_0x2f113e=0xc8;}else{_0x2f113e=0xce;}_0xbe657c[_0xd9e6('0x1c')](_0x2f113e);return _0xbe657c['set']('Content-Range',_0x44ae12+'-'+_0x19dfd7+'/'+_0x4a95b4)[_0xd9e6('0x1d')](_0xe30afc);}return null;};}function patchUpdates(_0x3ada59){return function(_0x4143c0){try{jsonpatch['apply'](_0x4143c0,_0x3ada59,!![]);}catch(_0x33158e){return BPromise[_0xd9e6('0x21')](_0x33158e);}return _0x4143c0[_0xd9e6('0x22')]();};}function saveUpdates(_0xdfd442,_0x1cebad){return function(_0xdb616f){if(_0xdb616f){return _0xdb616f[_0xd9e6('0x23')](_0xdfd442)['then'](function(_0x3a8c62){return _0x3a8c62;});}return null;};}function removeEntity(_0x3b17f9,_0x33b7af){return function(_0x3ea715){if(_0x3ea715){return _0x3ea715[_0xd9e6('0x24')]()[_0xd9e6('0x25')](function(){_0x3b17f9['status'](0xcc)[_0xd9e6('0x26')]();});}};}function handleEntityNotFound(_0xa32093,_0x38df16){return function(_0x2ae664){if(!_0x2ae664){_0xa32093[_0xd9e6('0x1b')](0x194);}return _0x2ae664;};}function handleError(_0x2f815e,_0x105831){_0x105831=_0x105831||0x1f4;return function(_0x2b2f4b){logger[_0xd9e6('0x27')](_0x2b2f4b[_0xd9e6('0x28')]);if(_0x2b2f4b[_0xd9e6('0x29')]){delete _0x2b2f4b[_0xd9e6('0x29')];}_0x2f815e[_0xd9e6('0x1c')](_0x105831)[_0xd9e6('0x2a')](_0x2b2f4b);};}function getInteractionUsers(_0x5367c9,_0x339d5f){return new BPromise(function(_0x138473,_0x45a52c){try{if(_0x339d5f[_0x5367c9['id']]){_0x5367c9[_0xd9e6('0x2b')]=_[_0xd9e6('0x2c')](_0x339d5f[_0x5367c9['id']],function(_0x19816d){return{'id':_0x19816d['id'],'fullname':_0x19816d[_0xd9e6('0x2d')]};});}}catch(_0x1d988c){_0x45a52c(_0x1d988c);}_0x138473(_0x5367c9);});}function getInteractionTags(_0x53689c,_0x23f993){return new BPromise(function(_0x1a1de4,_0x32bb74){try{if(_0x53689c['TagIds']){_0x53689c[_0xd9e6('0x2e')]=[];_0x53689c['TagIds'][_0xd9e6('0x2f')](',')[_0xd9e6('0x30')](function(_0x543b45){_0x53689c['Tags'][_0xd9e6('0x31')](_0x23f993[_0x543b45]);});}delete _0x53689c[_0xd9e6('0x32')];}catch(_0x5e0fa8){_0x32bb74(_0x5e0fa8);}_0x1a1de4(_0x53689c);});}function updateWhatsappInteraction(_0x466cae,_0x5a5470,_0x3b9dc4){return new BPromise(function(_0x15ff01,_0x213d56){return getInteractionUsers(_0x466cae,_0x3b9dc4)[_0xd9e6('0x25')](function(_0x2c8d4f){return getInteractionTags(_0x2c8d4f,_0x5a5470);})[_0xd9e6('0x25')](function(_0x163521){return getStateInteraction(_0x163521);})[_0xd9e6('0x25')](function(_0x59ee3a){_0x15ff01(_0x59ee3a);})['catch'](function(_0x46c6f8){_0x213d56(_0x46c6f8);});});}function getStateInteraction(_0x1f5790){return new BPromise(function(_0x2b0bc6){_0x1f5790[_0xd9e6('0x33')]=0x0;_0x1f5790[_0xd9e6('0x34')]=0x0;_0x1f5790[_0xd9e6('0x35')]=0x0;_0x1f5790[_0xd9e6('0x36')]=0x0;_0x1f5790[_0xd9e6('0x37')]=0x0;if(!_0x1f5790['closed']&&!_0x1f5790[_0xd9e6('0x38')]){_0x1f5790[_0xd9e6('0x33')]+=0x1;}if(!_0x1f5790[_0xd9e6('0x39')]&&_0x1f5790['UserId']){_0x1f5790[_0xd9e6('0x34')]+=0x1;if(_0x1f5790[_0xd9e6('0x33')]){_0x1f5790[_0xd9e6('0x33')]-=0x1;}}if(_0x1f5790[_0xd9e6('0x39')]&&_0x1f5790[_0xd9e6('0x38')]){_0x1f5790[_0xd9e6('0x35')]+=0x1;if(_0x1f5790[_0xd9e6('0x34')]){_0x1f5790['talking']-=0x1;}}if(_0x1f5790['closed']&&!_0x1f5790['UserId']){_0x1f5790[_0xd9e6('0x36')]+=0x1;if(_0x1f5790['waiting']){_0x1f5790['waiting']-=0x1;}}_0x1f5790[_0xd9e6('0x37')]+=0x1;_0x2b0bc6(_0x1f5790);});}exports[_0xd9e6('0x3a')]=function(_0x44b173,_0x5af9f9){var _0x338dbb={},_0x9d22ea={},_0x296ac2={'count':0x0,'rows':[]};var _0x53fce4=_[_0xd9e6('0x2c')](db[_0xd9e6('0x3b')][_0xd9e6('0x3c')],function(_0x467d89){return{'name':_0x467d89[_0xd9e6('0x3d')],'type':_0x467d89['type'][_0xd9e6('0x3e')]};});_0x9d22ea['model']=_['map'](_0x53fce4,'name');_0x9d22ea[_0xd9e6('0x3f')]=_[_0xd9e6('0x40')](_0x44b173['query']);_0x9d22ea[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x9d22ea[_0xd9e6('0x43')],_0x9d22ea[_0xd9e6('0x3f')]);_0x338dbb[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x9d22ea[_0xd9e6('0x43')],qs[_0xd9e6('0x45')](_0x44b173['query'][_0xd9e6('0x45')]));_0x338dbb[_0xd9e6('0x44')]=_0x338dbb[_0xd9e6('0x44')][_0xd9e6('0x46')]?_0x338dbb[_0xd9e6('0x44')]:_0x9d22ea[_0xd9e6('0x43')];if(!_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x47')](_0xd9e6('0x48'))){_0x338dbb['limit']=qs[_0xd9e6('0x20')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x20')]);_0x338dbb[_0xd9e6('0x1e')]=qs[_0xd9e6('0x1e')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x1e')]);}_0x338dbb[_0xd9e6('0x49')]=qs['sort'](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x4a')]);_0x338dbb[_0xd9e6('0x4b')]=qs[_0xd9e6('0x41')](_[_0xd9e6('0x4c')](_0x44b173[_0xd9e6('0x3f')],_0x9d22ea[_0xd9e6('0x41')]),_0x53fce4);var _0x1f2265=[];var _0x1b9973=squel['select']()[_0xd9e6('0x4d')]('id')[_0xd9e6('0x4d')](_0xd9e6('0x29'))['field'](_0xd9e6('0x4e'))[_0xd9e6('0x4f')](_0xd9e6('0x50'));var _0x22aebe=squel[_0xd9e6('0x51')]()[_0xd9e6('0x4d')](_0xd9e6('0x52'))[_0xd9e6('0x4d')](_0xd9e6('0x53'))[_0xd9e6('0x4d')](_0xd9e6('0x54'))['from']('user_has_whatsapp_interactions','ui')[_0xd9e6('0x55')](_0xd9e6('0x56'),'u',_0xd9e6('0x57'));var _0x3a0135=squel[_0xd9e6('0x51')]()[_0xd9e6('0x4f')]('whatsapp_interactions','i')[_0xd9e6('0x55')]('cm_contacts','c',_0xd9e6('0x58'))[_0xd9e6('0x55')](_0xd9e6('0x56'),'o',_0xd9e6('0x59'))[_0xd9e6('0x55')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0xd9e6('0x55')](_0xd9e6('0x5a'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xd9e6('0x55')](_0xd9e6('0x5b'),'it',_0xd9e6('0x5c'))[_0xd9e6('0x55')]('tools_tags','t',_0xd9e6('0x5d'));var _0x5f16d5=squel[_0xd9e6('0x5e')]();var _0x108042=[];var _0xebeca8=squel[_0xd9e6('0x5e')]();var _0x41efd5;if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x5f')]){_0x41efd5=as[_0xd9e6('0x60')](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x5f')]);var _0x3fd167=_0x41efd5[_0xd9e6('0x61')];for(var _0x843af6=0x0;_0x843af6<_0x41efd5['conditions'][_0xd9e6('0x46')];_0x843af6++){var _0x4ca4d3=_0x41efd5['conditions'][_0x843af6];var _0x2fbf24='i';var _0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,['name',_0x4ca4d3[_0xd9e6('0x4d')]]);if(!_0x5f1cbf){switch(_0x4ca4d3['field']){case _0xd9e6('0x63'):if(_0x4ca4d3['value']==0x1){_0x3a0135[_0xd9e6('0x64')]('`'+_0x4ca4d3[_0xd9e6('0x4d')]+_0xd9e6('0x65'));}else{_0x3a0135['having']('`'+_0x4ca4d3['field']+'`\x20>\x200');}break;case'Contact':if(_0x4ca4d3[_0xd9e6('0x66')]===_0xd9e6('0x67')){if(_0x4ca4d3['value']['split']('\x20')[_0xd9e6('0x46')]>0x1){_0x5f16d5[_0x3fd167](_0xd9e6('0x68'),qs[_0xd9e6('0x69')](_0x4ca4d3[_0xd9e6('0x6a')]),null);}else{var _0x2c05db='%'+_0x4ca4d3['value']+'%';_0x5f16d5[_0x3fd167](_0xd9e6('0x6b'),_0x2c05db,_0x2c05db,_0x2c05db);}}else{_0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,[_0xd9e6('0x29'),_0xd9e6('0x6c')]);_0x4ca4d3[_0xd9e6('0x4d')]='ContactId';_0x224c8a=as['buildExpression'](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x26')]);}break;case _0xd9e6('0x70'):var _0x1baecc=_0x4ca4d3[_0xd9e6('0x6a')][_0xd9e6('0x2f')](',')[_0xd9e6('0x2c')](function(_0x997758){return Number(_0x997758);});_0x1baecc['forEach'](function(_0x742c6b){_0xebeca8['or'](_0xd9e6('0x71'),'%,'+_0x742c6b+',%');});_0x108042=_[_0xd9e6('0x72')](_0x108042,_0x1baecc);break;case _0xd9e6('0x73'):if(_0x4ca4d3[_0xd9e6('0x66')]===_0xd9e6('0x67')){_0x5f16d5[_0x3fd167](_0xd9e6('0x74'),'%'+_0x4ca4d3[_0xd9e6('0x6a')]+'%',null);}else{_0x5f1cbf=_[_0xd9e6('0x62')](_0x53fce4,[_0xd9e6('0x29'),_0xd9e6('0x38')]);_0x4ca4d3[_0xd9e6('0x4d')]=_0xd9e6('0x38');_0x224c8a=as[_0xd9e6('0x75')](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a['value'][_0xd9e6('0x26')]);}break;case _0xd9e6('0x76'):_0x224c8a=as[_0xd9e6('0x75')]('me',null,_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a['value'][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x26')]);break;}}else{var _0x224c8a=as['buildExpression'](_0x2fbf24,_0x5f1cbf[_0xd9e6('0x6d')],_0x4ca4d3);_0x5f16d5[_0x3fd167](_0x224c8a[_0xd9e6('0x6e')],_0x224c8a[_0xd9e6('0x6a')][_0xd9e6('0x6f')],_0x224c8a[_0xd9e6('0x6a')]['end']);}}}else{var _0x2294e2=_(_0x44b173[_0xd9e6('0x3f')])[_0xd9e6('0x40')]()[_0xd9e6('0x2c')](function(_0x33e81d){return _[_0xd9e6('0x77')](_0x53fce4,[_0xd9e6('0x29'),_0x33e81d])?_0x33e81d:undefined;})[_0xd9e6('0x78')]()[_0xd9e6('0x6a')]();if(!_['isEmpty'](_0x2294e2)){_0x2294e2[_0xd9e6('0x30')](function(_0x1d77ce){if(_0x1d77ce===_0xd9e6('0x79')){_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7a'),[][_0xd9e6('0x7b')](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce]));}else if(_0x1d77ce===_0xd9e6('0x7c')){var _0x5cca00=JSON['parse'](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce])['$gte'];var _0x4af328=JSON[_0xd9e6('0x7d')](_0x44b173[_0xd9e6('0x3f')][_0x1d77ce])[_0xd9e6('0x7e')];_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7f'),_0x5cca00,_0x4af328);}else{if(_0x44b173['query'][_0x1d77ce]===_0xd9e6('0x80')){_0x3a0135['where']('i.'+_0x1d77ce+_0xd9e6('0x81'));}else{_0x3a0135[_0xd9e6('0x4b')]('i.'+_0x1d77ce+_0xd9e6('0x82'),_0x44b173[_0xd9e6('0x3f')][_0x1d77ce]);}}});}if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x83')]){if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x83')]==0x1){_0x3a0135[_0xd9e6('0x64')](_0xd9e6('0x84'));}else{_0x3a0135[_0xd9e6('0x64')](_0xd9e6('0x85'));}}if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]){_0x108042=_['isArray'](_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')])?_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]:new Array(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x86')]);_0x108042['forEach'](function(_0x384c26){_0xebeca8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x384c26+',%');});}if(_0x44b173['query'][_0xd9e6('0x87')]){var _0x44e5d7=_0x44b173['query'][_0xd9e6('0x87')]['replace']('\x5c','\x5c\x5c')[_0xd9e6('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x44e5d7)){_0x5f16d5['or'](_0xd9e6('0x89'),_0x44e5d7+'%')['or'](_0xd9e6('0x8a'),_0x44e5d7+'%');}else{_0x5f16d5['or'](_0xd9e6('0x8b'),qs[_0xd9e6('0x69')](_0x44e5d7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x44e5d7+'%');}}}_0x3a0135['where'](_0x5f16d5);_0x3a0135['group'](_0xd9e6('0x8c'));var _0x327f41={'type':db[_0xd9e6('0x8d')][_0xd9e6('0x8e')]['SELECT'],'raw':!![]};var _0x300a6d=_0x3a0135[_0xd9e6('0x8f')]();_0x300a6d[_0xd9e6('0x4d')]('i.id');_0x300a6d['field'](_0xd9e6('0x90'),_0xd9e6('0x63'));if(_0x338dbb[_0xd9e6('0x49')]){_0x338dbb[_0xd9e6('0x49')][_0xd9e6('0x30')](function(_0x5ed76a){var _0x170dc1=_0x5ed76a[0x0]===_0xd9e6('0x91')?_0x5ed76a[0x0]:'i.'+_0x5ed76a[0x0];_0x3a0135[_0xd9e6('0x49')](_0x170dc1,_0x5ed76a[0x1]===_0xd9e6('0x92')?![]:!![]);});}if(!_[_0xd9e6('0x93')](_0x108042)){_0x3a0135[_0xd9e6('0x64')](_0xebeca8);_0x300a6d[_0xd9e6('0x4b')]('t.id\x20IN\x20?',_0x108042);}BPromise[_0xd9e6('0x94')]()[_0xd9e6('0x25')](function(){if(!_0x41efd5){if(_0x44b173[_0xd9e6('0x3f')]['WhatsappAccountId'])return;_0x300a6d['where'](_0xd9e6('0x95'));_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x95'));return;}if(_0x44b173['user'][_0xd9e6('0x96')]!==_0xd9e6('0x97'))return;return _0x44b173[_0xd9e6('0x98')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x15a136){if(_['isEmpty'](_0x15a136)){_0x300a6d[_0xd9e6('0x4b')](_0xd9e6('0x99'));_0x3a0135['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x300a6d[_0xd9e6('0x4b')](_0xd9e6('0x7a'),_[_0xd9e6('0x2c')](_0x15a136,'id'));_0x3a0135[_0xd9e6('0x4b')](_0xd9e6('0x7a'),_[_0xd9e6('0x2c')](_0x15a136,'id'));}});})['then'](function(){if(_0x44b173['user'][_0xd9e6('0x96')]===_0xd9e6('0x97')&&!_0x41efd5&&!_0x44b173['query'][_0xd9e6('0x79')])return[];return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x300a6d[_0xd9e6('0x9b')](),_0x327f41);})[_0xd9e6('0x25')](function(_0x4f3ab1){_0x296ac2[_0xd9e6('0x9c')]=_0x4f3ab1[_0xd9e6('0x46')];if(_0x296ac2[_0xd9e6('0x9c')]===0x0)return[];return db[_0xd9e6('0x9a')]['query'](_0x1b9973[_0xd9e6('0x9b')](),_0x327f41)['then'](function(_0x491371){_0x1f2265=_[_0xd9e6('0x9d')](_0x491371,'id');_0x327f41=_[_0xd9e6('0x9e')](_0x327f41,{'model':db[_0xd9e6('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44b173[_0xd9e6('0x3f')][_0xd9e6('0x45')]){_0x338dbb['attributes'][_0xd9e6('0x30')](function(_0x5a449f){_0x3a0135[_0xd9e6('0x4d')]('i.'+_0x5a449f);});}else{_0x3a0135['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xd9e6('0x63'));_0x3a0135['field']('a.key',_0xd9e6('0x9f'));_0x3a0135[_0xd9e6('0x4d')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa0'),_0xd9e6('0x91'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa1'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa2'),_0xd9e6('0xa3'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa4'),'Contact.lastName');_0x3a0135['field'](_0xd9e6('0xa5'),_0xd9e6('0xa6'));_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa7'),_0xd9e6('0xa8'));_0x3a0135['field']('c.mobile','Contact.mobile');_0x3a0135[_0xd9e6('0x4d')](_0xd9e6('0xa9'),_0xd9e6('0xaa'));_0x3a0135['field'](_0xd9e6('0xab'),_0xd9e6('0xac'));_0x3a0135[_0xd9e6('0x4d')]('o.internal',_0xd9e6('0xad'));_0x3a0135[_0xd9e6('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x338dbb[_0xd9e6('0x20')])_0x3a0135[_0xd9e6('0x20')](_0x338dbb[_0xd9e6('0x20')]);if(_0x338dbb[_0xd9e6('0x1e')])_0x3a0135[_0xd9e6('0x1e')](_0x338dbb[_0xd9e6('0x1e')]);return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x3a0135[_0xd9e6('0x9b')](),_0x327f41);})[_0xd9e6('0x25')](function(_0x2360d2){if(_0x2360d2[_0xd9e6('0x46')]>0x0)_0x22aebe[_0xd9e6('0x4b')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xd9e6('0x2c')](_0x2360d2,'id'));return db[_0xd9e6('0x9a')][_0xd9e6('0x3f')](_0x22aebe[_0xd9e6('0x9b')](),_0x327f41)[_0xd9e6('0x25')](function(_0x1ab2ed){var _0x13382e=_['groupBy'](_0x1ab2ed,'WhatsappInteractionId');var _0x2614d2=[];_0x2360d2[_0xd9e6('0x30')](function(_0x535562){_0x2614d2['push'](updateWhatsappInteraction(_0x535562,_0x1f2265,_0x13382e));});return BPromise[_0xd9e6('0xae')](_0x2614d2);});});})[_0xd9e6('0x25')](function(_0x4b71a3){_0x296ac2[_0xd9e6('0xaf')]=_0x4b71a3;return _0x296ac2;})[_0xd9e6('0x25')](respondWithFilteredResult(_0x5af9f9,_0x338dbb))['catch'](handleError(_0x5af9f9,null));};exports[_0xd9e6('0xb0')]=function(_0x23f04a,_0x9f20c6){var _0x3f8d80={'raw':![],'where':{'id':_0x23f04a['params']['id']}},_0x583acd={};_0x583acd[_0xd9e6('0x43')]=_[_0xd9e6('0x40')](db[_0xd9e6('0x3b')][_0xd9e6('0x3c')]);_0x583acd['query']=_[_0xd9e6('0x40')](_0x23f04a[_0xd9e6('0x3f')]);_0x583acd[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x583acd['model'],_0x583acd[_0xd9e6('0x3f')]);_0x3f8d80[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x583acd[_0xd9e6('0x43')],qs['fields'](_0x23f04a[_0xd9e6('0x3f')][_0xd9e6('0x45')]));_0x3f8d80[_0xd9e6('0x44')]=_0x3f8d80[_0xd9e6('0x44')][_0xd9e6('0x46')]?_0x3f8d80[_0xd9e6('0x44')]:_0x583acd[_0xd9e6('0x43')];if(_0x23f04a[_0xd9e6('0x3f')]['includeAll']){_0x3f8d80[_0xd9e6('0xb1')]=[{'all':!![]}];}_0x3f8d80=_[_0xd9e6('0x9e')]({},_0x3f8d80,_0x23f04a[_0xd9e6('0xb2')]);return db[_0xd9e6('0x3b')][_0xd9e6('0x62')](_0x3f8d80)[_0xd9e6('0x25')](handleEntityNotFound(_0x9f20c6,null))[_0xd9e6('0x25')](respondWithResult(_0x9f20c6,null))[_0xd9e6('0xb3')](handleError(_0x9f20c6,null));};exports[_0xd9e6('0xb4')]=function(_0x38d817,_0xd1568){return db['WhatsappInteraction'][_0xd9e6('0xb4')](_0x38d817['body'],{})[_0xd9e6('0x25')](respondWithResult(_0xd1568,0xc9))[_0xd9e6('0xb3')](handleError(_0xd1568,null));};exports[_0xd9e6('0x23')]=function(_0x4937bb,_0x34e5c1){if(_0x4937bb[_0xd9e6('0x76')]['id']){delete _0x4937bb[_0xd9e6('0x76')]['id'];}return db[_0xd9e6('0x3b')]['find']({'where':{'id':_0x4937bb[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x34e5c1,null))[_0xd9e6('0x25')](saveUpdates(_0x4937bb[_0xd9e6('0x76')],null))[_0xd9e6('0x25')](respondWithResult(_0x34e5c1,null))[_0xd9e6('0xb3')](handleError(_0x34e5c1,null));};exports[_0xd9e6('0x24')]=function(_0x1f3515,_0x35839f){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x1f3515[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x35839f,null))[_0xd9e6('0x25')](removeEntity(_0x35839f,null))[_0xd9e6('0xb3')](handleError(_0x35839f,null));};exports[_0xd9e6('0xb6')]=function(_0x2b3fd0,_0x3d7a3a){return db['WhatsappInteraction'][_0xd9e6('0xb6')]()[_0xd9e6('0x25')](respondWithResult(_0x3d7a3a,null))[_0xd9e6('0xb3')](handleError(_0x3d7a3a,null));};exports[_0xd9e6('0xb7')]=function(_0x5e93de,_0x3881dc,_0x2ddb49){return db[_0xd9e6('0xb8')][_0xd9e6('0x62')]({'where':{'id':_0x5e93de[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x3881dc,null))['then'](function(_0x128dfc){if(_0x128dfc){return _0x128dfc[_0xd9e6('0xb7')](_0x5e93de['body'][_0xd9e6('0xb9')],_[_0xd9e6('0xba')](_0x5e93de[_0xd9e6('0x76')],[_0xd9e6('0xb9'),'id'])||{});}})[_0xd9e6('0x25')](respondWithResult(_0x3881dc,null))[_0xd9e6('0xb3')](handleError(_0x3881dc,null));};exports['getMessages']=function(_0x5f1d5c,_0x3e3c4c,_0x5b9cee){var _0x88143a={'raw':![],'where':{}};var _0x35d57={};var _0x6f317d={'count':0x0,'rows':[]};return db[_0xd9e6('0x3b')][_0xd9e6('0xbb')]({'where':{'id':_0x5f1d5c[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x3e3c4c,null))[_0xd9e6('0x25')](function(_0x31e2b4){if(_0x31e2b4){_0x35d57[_0xd9e6('0x43')]=_[_0xd9e6('0x40')](db[_0xd9e6('0xb8')]['rawAttributes']);_0x35d57['query']=_[_0xd9e6('0x40')](_0x5f1d5c['query']);_0x35d57[_0xd9e6('0x41')]=_[_0xd9e6('0x42')](_0x35d57['model'],_0x35d57[_0xd9e6('0x3f')]);_0x88143a[_0xd9e6('0x44')]=_[_0xd9e6('0x42')](_0x35d57['model'],qs['fields'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x45')]));_0x88143a['attributes']=_0x88143a['attributes'][_0xd9e6('0x46')]?_0x88143a[_0xd9e6('0x44')]:_0x35d57['model'];if(!_0x5f1d5c['query'][_0xd9e6('0x47')](_0xd9e6('0x48'))){_0x88143a[_0xd9e6('0x20')]=qs['limit'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x20')]);_0x88143a[_0xd9e6('0x1e')]=qs['offset'](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x1e')]);}_0x88143a[_0xd9e6('0x49')]=qs[_0xd9e6('0x4a')](_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x4a')]);_0x88143a[_0xd9e6('0x4b')]=qs[_0xd9e6('0x41')](_[_0xd9e6('0x4c')](_0x5f1d5c[_0xd9e6('0x3f')],_0x35d57[_0xd9e6('0x41')]));_0x88143a[_0xd9e6('0x4b')]['WhatsappInteractionId']=_0x31e2b4['id'];if(_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0x87')]){_0x88143a['where']=_['merge'](_0x88143a[_0xd9e6('0x4b')],{'$or':_[_0xd9e6('0x2c')](_0x88143a[_0xd9e6('0x44')],function(_0xad21dd){var _0xf33b0d={};_0xf33b0d[_0xad21dd]={'$like':'%'+_0x5f1d5c['query'][_0xd9e6('0x87')]+'%'};return _0xf33b0d;})});}if(_0x5f1d5c[_0xd9e6('0x3f')]['$gte']){var _0xa3e94b=_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0xbc')][_0xd9e6('0x2f')](',');var _0x294faa={};_0x294faa[_0xa3e94b[0x0]]={'$gte':moment(_0xa3e94b[0x1])[_0xd9e6('0xbd')](_0xd9e6('0xbe'))};_0x88143a['where']=_[_0xd9e6('0x9e')](_0x88143a[_0xd9e6('0x4b')],_0x294faa);}_0x88143a=_['merge']({},_0x88143a,_0x5f1d5c['options']);return db[_0xd9e6('0xb8')]['count']({'where':_0x88143a[_0xd9e6('0x4b')]})[_0xd9e6('0x25')](function(_0x5e480e){_0x6f317d[_0xd9e6('0x9c')]=_0x5e480e;if(_0x5f1d5c[_0xd9e6('0x3f')][_0xd9e6('0xbf')]){_0x88143a[_0xd9e6('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xd9e6('0xc0')](_0x88143a);})[_0xd9e6('0x25')](function(_0x17c19d){_0x6f317d[_0xd9e6('0xaf')]=_0x17c19d;return _0x6f317d;});}})[_0xd9e6('0x25')](respondWithFilteredResult(_0x3e3c4c,_0x88143a))[_0xd9e6('0xb3')](handleError(_0x3e3c4c,null));};exports[_0xd9e6('0xc1')]=function(_0x49f2a1,_0xc11c88,_0x23eec1){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x49f2a1[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0xc11c88,null))[_0xd9e6('0x25')](function(_0x57a1ba){if(_0x57a1ba){return _0x57a1ba[_0xd9e6('0xc2')](_0x49f2a1[_0xd9e6('0x76')]['ids'],_[_0xd9e6('0xba')](_0x49f2a1[_0xd9e6('0x76')],['ids','id'])||{})['spread'](function(){return db[_0xd9e6('0x70')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x49f2a1['body'][_0xd9e6('0xb9')]}});})[_0xd9e6('0x25')](function(_0x4c5742){socket[_0xd9e6('0xc3')](_0xd9e6('0xc4'),{'id':Number(_0x49f2a1['params']['id']),'tags':_0x4c5742||[]});return{'id':Number(_0x49f2a1['params']['id']),'tags':_0x4c5742||[]};});}})[_0xd9e6('0x25')](respondWithResult(_0xc11c88,null))[_0xd9e6('0xb3')](handleError(_0xc11c88,null));};exports[_0xd9e6('0xc5')]=function(_0x1d75c2,_0x458227,_0x30fbba){return db[_0xd9e6('0x3b')][_0xd9e6('0x62')]({'where':{'id':_0x1d75c2[_0xd9e6('0xb5')]['id']}})[_0xd9e6('0x25')](handleEntityNotFound(_0x458227,null))[_0xd9e6('0x25')](function(_0x48d7ac){if(_0x48d7ac){return _0x48d7ac['removeTags'](_0x1d75c2[_0xd9e6('0x3f')][_0xd9e6('0xb9')]);}})[_0xd9e6('0x25')](respondWithStatusCode(_0x458227,null))['catch'](handleError(_0x458227,null));};exports[_0xd9e6('0xc6')]=function(_0x19a357,_0x3e2cd0){var _0x40ea66=moment()['unix']()[_0xd9e6('0x9b')]();var _0x30fa97=path['join'](config[_0xd9e6('0xc7')],_0xd9e6('0xc8'),_0xd9e6('0xc9'),_0xd9e6('0xca'));var _0x58e884=path['join'](config[_0xd9e6('0xc7')],'server',_0xd9e6('0xc9'),'attachments');var _0x18c67b=path[_0xd9e6('0xcb')](_0x30fa97,_0x40ea66);var _0x6fb9b3=util['format'](_0xd9e6('0xcc'),_0x19a357[_0xd9e6('0xb5')]['id'],_0x40ea66);var _0x4111df=path[_0xd9e6('0xcb')](_0x30fa97,_0x6fb9b3);var _0x1daf5c=[];_0x1daf5c['push']({'model':db[_0xd9e6('0x73')],'as':'User','attributes':['id',_0xd9e6('0x2d')],'raw':!![]});_0x1daf5c[_0xd9e6('0x31')]({'model':db[_0xd9e6('0xcd')],'as':'Contact','attributes':['id',_0xd9e6('0xce'),_0xd9e6('0xcf')],'raw':!![]});if(_0x19a357[_0xd9e6('0x3f')][_0xd9e6('0xd0')]){_0x1daf5c[_0xd9e6('0x31')]({'model':db['Attachment'],'as':_0xd9e6('0xd1'),'raw':!![]});}var _0x5aeee6=[{'model':db[_0xd9e6('0xb8')],'as':_0xd9e6('0xd2'),'attributes':['id',_0xd9e6('0x76'),_0xd9e6('0x7c'),_0xd9e6('0xd3'),_0xd9e6('0xd4'),_0xd9e6('0x83')],'include':_0x1daf5c}];_0x5aeee6[_0xd9e6('0x31')]({'model':db[_0xd9e6('0xd5')],'as':_0xd9e6('0xd6'),'attributes':['id',_0xd9e6('0x29')]});_0x5aeee6[_0xd9e6('0x31')]({'model':db[_0xd9e6('0x73')],'as':_0xd9e6('0xd7'),'attributes':['id',_0xd9e6('0x2d')]});return db['WhatsappInteraction'][_0xd9e6('0x62')]({'where':{'id':_0x19a357[_0xd9e6('0xb5')]['id']},'include':_0x5aeee6})['then'](handleEntityNotFound(_0x3e2cd0,null))[_0xd9e6('0x25')](function(_0x2d9625){if(_0x2d9625){var _0x2df41a=_0x2d9625[_0xd9e6('0xd8')]({'plain':!![]});fs[_0xd9e6('0xd9')](_0x18c67b);var _0x2cfbfa={'channel':'Whatsapp','account':_0x2df41a[_0xd9e6('0xd6')][_0xd9e6('0x29')],'agent':_0x2df41a['Owner']?_0x2df41a[_0xd9e6('0xd7')][_0xd9e6('0x2d')]:_0xd9e6('0xda'),'createdAt':moment(_0x2df41a[_0xd9e6('0x7c')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9e6('0x9b')](),'closedAt':_0x2df41a[_0xd9e6('0x39')]?moment(_0x2df41a[_0xd9e6('0xdb')])['format'](_0xd9e6('0xbe'))[_0xd9e6('0x9b')]():'','disposition':_0x2df41a[_0xd9e6('0xdc')],'messages':_(_0x2df41a[_0xd9e6('0xd2')])[_0xd9e6('0x87')]({'secret':![]})[_0xd9e6('0x2c')](function(_0x13bd4d){if(_0x13bd4d[_0xd9e6('0xd1')]){var _0x5d8a32=path[_0xd9e6('0xcb')](_0x58e884,_0x13bd4d[_0xd9e6('0xd1')][_0xd9e6('0xdd')]);if(fs[_0xd9e6('0xde')](_0x5d8a32)){fs[_0xd9e6('0xdf')](_0x5d8a32)[_0xd9e6('0xe0')](fs[_0xd9e6('0xe1')](path[_0xd9e6('0xcb')](_0x18c67b,_0x13bd4d['Attachment']['basename'])));}}return{'date':moment(_0x13bd4d[_0xd9e6('0x7c')])[_0xd9e6('0xbd')](_0xd9e6('0xbe'))['toString'](),'sender':_0x13bd4d['direction']===_0xd9e6('0xe2')?_0x13bd4d[_0xd9e6('0x73')]?_0x13bd4d[_0xd9e6('0x73')][_0xd9e6('0x2d')]:_0xd9e6('0xe3'):_0x13bd4d[_0xd9e6('0xe4')][_0xd9e6('0xce')]+(_0x13bd4d['Contact']['lastName']?'\x20'+_0x13bd4d[_0xd9e6('0xe4')]['lastName']:''),'body':_0x13bd4d[_0xd9e6('0xd1')]?_0x13bd4d[_0xd9e6('0xd1')]['basename']:_0x13bd4d[_0xd9e6('0x76')],'direction':_0x13bd4d[_0xd9e6('0xd3')]==='out'?'A':'C','secret':_0x13bd4d[_0xd9e6('0xd4')],'read':_0x13bd4d[_0xd9e6('0x83')],'attachment':_0x13bd4d['Attachment']};})['value']()};return ejs[_0xd9e6('0xe5')](path[_0xd9e6('0xcb')](config[_0xd9e6('0xc7')],'server',_0xd9e6('0xe6'),_0xd9e6('0xe7')),{'interaction':_0x2cfbfa})[_0xd9e6('0x25')](function(_0x1ff304){var _0x286b7e=path['join'](_0x18c67b,'transcript-'+_0x2df41a['id']+'-'+_0x40ea66+'.pdf');var _0x1ae6c5={'path':_0x286b7e,'channel':'Whatsapp','interactionId':_0x2df41a['id']};return pdf[_0xd9e6('0xe8')](_0x1ff304,_0x1ae6c5);})[_0xd9e6('0x25')](function(){return new BPromise(function(_0x142c84,_0x2ef382){zipdir(_0x18c67b,{'saveTo':_0x4111df},function(_0x2d4d26,_0x3fe8eb){if(_0x2d4d26)return _0x2ef382(_0x2d4d26);return _0x142c84(_0x3fe8eb);});})['then'](function(){return new BPromise(function(_0x3fa329,_0x2919f9){rimraf(_0x18c67b,function(_0x23c5bc){if(_0x23c5bc)_0x2919f9(_0x23c5bc);return _0x3fa329();});});})[_0xd9e6('0x25')](function(){return _0x3e2cd0['download'](_0x4111df,_0x6fb9b3,function(_0x2695c9){if(_0x2695c9){console['log']('err',_0x2695c9);}else{fs[_0xd9e6('0xe9')](_0x4111df);}});});});}else{return _0x3e2cd0[_0xd9e6('0x1b')](0xc8);}})[_0xd9e6('0xb3')](handleError(_0x3e2cd0,null));}; \ No newline at end of file +var _0xf29d=['then','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','WhatsappInteraction','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','text','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','rawAttributes','includeAll','include','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','nolimit','pick','WhatsappInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','color','removeTags','unix','root','server','files','tmp','join','attachments','CmContact','Contact','firstName','lastName','Attachment','WhatsappMessage','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createWriteStream','renderFile','views','transcript-','.pdf','download','log','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0xf29d,0xc4));var _0xdf29=function(_0x321219,_0x1f60d5){_0x321219=_0x321219-0x0;var _0x4d37cd=_0xf29d[_0x321219];return _0x4d37cd;};'use strict';var emlformat=require(_0xdf29('0x0'));var rimraf=require(_0xdf29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf29('0x2'));var rp=require(_0xdf29('0x3'));var moment=require(_0xdf29('0x4'));var BPromise=require(_0xdf29('0x5'));var Mustache=require(_0xdf29('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdf29('0x7'));var ejs=require(_0xdf29('0x8'));var fs=require('fs');var fs_extra=require(_0xdf29('0x9'));var _=require('lodash');var squel=require(_0xdf29('0xa'));var crypto=require(_0xdf29('0xb'));var jsforce=require(_0xdf29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf29('0x7'));var querystring=require(_0xdf29('0xd'));var Papa=require(_0xdf29('0xe'));var Redis=require(_0xdf29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf29('0x10'));var pdf=require(_0xdf29('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf29('0x12'))(_0xdf29('0x13'));var utils=require(_0xdf29('0x14'));var config=require(_0xdf29('0x15'));var licenseUtil=require(_0xdf29('0x16'));var db=require('../../mysqldb')['db'];config[_0xdf29('0x17')]=_['defaults'](config[_0xdf29('0x17')],{'host':_0xdf29('0x18'),'port':0x18eb});var socket=require(_0xdf29('0x19'))(new Redis(config['redis']));require(_0xdf29('0x1a'))[_0xdf29('0x1b')](socket);function respondWithStatusCode(_0x5478df,_0xcf93bd){_0xcf93bd=_0xcf93bd||0xcc;return function(_0x950f44){if(_0x950f44){return _0x5478df[_0xdf29('0x1c')](_0xcf93bd);}return _0x5478df['status'](_0xcf93bd)[_0xdf29('0x1d')]();};}function respondWithResult(_0x57df07,_0x4ef166){_0x4ef166=_0x4ef166||0xc8;return function(_0x1c993b){if(_0x1c993b){return _0x57df07[_0xdf29('0x1e')](_0x4ef166)['json'](_0x1c993b);}};}function respondWithFilteredResult(_0x5ecbf4,_0x11dc19){return function(_0x28a99b){if(_0x28a99b){var _0x4debb5=typeof _0x11dc19[_0xdf29('0x1f')]===_0xdf29('0x20')&&typeof _0x11dc19[_0xdf29('0x21')]===_0xdf29('0x20');var _0x2e1755=_0x28a99b[_0xdf29('0x22')];var _0x3cc6d7=_0x4debb5?0x0:_0x11dc19[_0xdf29('0x1f')];var _0x15501e=_0x4debb5?_0x28a99b[_0xdf29('0x22')]:_0x11dc19[_0xdf29('0x1f')]+_0x11dc19[_0xdf29('0x21')];var _0x1f1426;if(_0x15501e>=_0x2e1755){_0x15501e=_0x2e1755;_0x1f1426=0xc8;}else{_0x1f1426=0xce;}_0x5ecbf4[_0xdf29('0x1e')](_0x1f1426);return _0x5ecbf4[_0xdf29('0x23')](_0xdf29('0x24'),_0x3cc6d7+'-'+_0x15501e+'/'+_0x2e1755)['json'](_0x28a99b);}return null;};}function patchUpdates(_0x554655){return function(_0xe57c47){try{jsonpatch[_0xdf29('0x25')](_0xe57c47,_0x554655,!![]);}catch(_0x10d692){return BPromise[_0xdf29('0x26')](_0x10d692);}return _0xe57c47[_0xdf29('0x27')]();};}function saveUpdates(_0x47a1af,_0x7a2fcd){return function(_0x20907f){if(_0x20907f){return _0x20907f[_0xdf29('0x28')](_0x47a1af)[_0xdf29('0x29')](function(_0x4b2931){return _0x4b2931;});}return null;};}function removeEntity(_0x29d3a1,_0x503cd4){return function(_0x493d01){if(_0x493d01){return _0x493d01['destroy']()['then'](function(){_0x29d3a1['status'](0xcc)[_0xdf29('0x1d')]();});}};}function handleEntityNotFound(_0x5ae2de,_0xc7c1e6){return function(_0x4da675){if(!_0x4da675){_0x5ae2de['sendStatus'](0x194);}return _0x4da675;};}function handleError(_0x54d96d,_0x3f5a96){_0x3f5a96=_0x3f5a96||0x1f4;return function(_0x3cdca4){logger[_0xdf29('0x2a')](_0x3cdca4[_0xdf29('0x2b')]);if(_0x3cdca4[_0xdf29('0x2c')]){delete _0x3cdca4[_0xdf29('0x2c')];}_0x54d96d['status'](_0x3f5a96)['send'](_0x3cdca4);};}function getInteractionUsers(_0x1cf013,_0x24253e){return new BPromise(function(_0x301bc5,_0x240777){try{if(_0x24253e[_0x1cf013['id']]){_0x1cf013[_0xdf29('0x2d')]=_[_0xdf29('0x2e')](_0x24253e[_0x1cf013['id']],function(_0x3157b6){return{'id':_0x3157b6['id'],'fullname':_0x3157b6[_0xdf29('0x2f')]};});}}catch(_0x3780d2){_0x240777(_0x3780d2);}_0x301bc5(_0x1cf013);});}function getInteractionTags(_0xec3f3d,_0x1bb3ce){return new BPromise(function(_0x38ad0d,_0x15141e){try{if(_0xec3f3d[_0xdf29('0x30')]){_0xec3f3d[_0xdf29('0x31')]=[];_0xec3f3d['TagIds'][_0xdf29('0x32')](',')[_0xdf29('0x33')](function(_0x581527){_0xec3f3d[_0xdf29('0x31')][_0xdf29('0x34')](_0x1bb3ce[_0x581527]);});}delete _0xec3f3d[_0xdf29('0x30')];}catch(_0x55eb27){_0x15141e(_0x55eb27);}_0x38ad0d(_0xec3f3d);});}function updateWhatsappInteraction(_0xe3127,_0x31a0b3,_0x10d72f){return new BPromise(function(_0x27f330,_0x5b77db){return getInteractionUsers(_0xe3127,_0x10d72f)[_0xdf29('0x29')](function(_0x29eb8b){return getInteractionTags(_0x29eb8b,_0x31a0b3);})['then'](function(_0x36eac3){return getStateInteraction(_0x36eac3);})['then'](function(_0x28534d){_0x27f330(_0x28534d);})[_0xdf29('0x35')](function(_0x33af6a){_0x5b77db(_0x33af6a);});});}function getStateInteraction(_0xb51e91){return new BPromise(function(_0x174c9e){_0xb51e91[_0xdf29('0x36')]=0x0;_0xb51e91[_0xdf29('0x37')]=0x0;_0xb51e91[_0xdf29('0x38')]=0x0;_0xb51e91[_0xdf29('0x39')]=0x0;_0xb51e91['total']=0x0;if(!_0xb51e91[_0xdf29('0x3a')]&&!_0xb51e91[_0xdf29('0x3b')]){_0xb51e91[_0xdf29('0x36')]+=0x1;}if(!_0xb51e91[_0xdf29('0x3a')]&&_0xb51e91[_0xdf29('0x3b')]){_0xb51e91[_0xdf29('0x37')]+=0x1;if(_0xb51e91[_0xdf29('0x36')]){_0xb51e91[_0xdf29('0x36')]-=0x1;}}if(_0xb51e91['closed']&&_0xb51e91['UserId']){_0xb51e91[_0xdf29('0x38')]+=0x1;if(_0xb51e91['talking']){_0xb51e91[_0xdf29('0x37')]-=0x1;}}if(_0xb51e91[_0xdf29('0x3a')]&&!_0xb51e91[_0xdf29('0x3b')]){_0xb51e91[_0xdf29('0x39')]+=0x1;if(_0xb51e91[_0xdf29('0x36')]){_0xb51e91['waiting']-=0x1;}}_0xb51e91[_0xdf29('0x3c')]+=0x1;_0x174c9e(_0xb51e91);});}exports[_0xdf29('0x3d')]=function(_0x49b950,_0x254fe4){var _0x1a7864={},_0x302d2b={},_0x534fa4={'count':0x0,'rows':[]};var _0x2dbdab=_[_0xdf29('0x2e')](db[_0xdf29('0x3e')]['rawAttributes'],function(_0x151374){return{'name':_0x151374['fieldName'],'type':_0x151374['type'][_0xdf29('0x3f')]};});_0x302d2b[_0xdf29('0x40')]=_[_0xdf29('0x2e')](_0x2dbdab,_0xdf29('0x2c'));_0x302d2b['query']=_[_0xdf29('0x41')](_0x49b950[_0xdf29('0x42')]);_0x302d2b[_0xdf29('0x43')]=_[_0xdf29('0x44')](_0x302d2b[_0xdf29('0x40')],_0x302d2b['query']);_0x1a7864[_0xdf29('0x45')]=_[_0xdf29('0x44')](_0x302d2b[_0xdf29('0x40')],qs['fields'](_0x49b950[_0xdf29('0x42')][_0xdf29('0x46')]));_0x1a7864['attributes']=_0x1a7864[_0xdf29('0x45')][_0xdf29('0x47')]?_0x1a7864[_0xdf29('0x45')]:_0x302d2b[_0xdf29('0x40')];if(!_0x49b950['query'][_0xdf29('0x48')]('nolimit')){_0x1a7864[_0xdf29('0x21')]=qs[_0xdf29('0x21')](_0x49b950[_0xdf29('0x42')][_0xdf29('0x21')]);_0x1a7864[_0xdf29('0x1f')]=qs[_0xdf29('0x1f')](_0x49b950[_0xdf29('0x42')][_0xdf29('0x1f')]);}_0x1a7864[_0xdf29('0x49')]=qs[_0xdf29('0x4a')](_0x49b950[_0xdf29('0x42')][_0xdf29('0x4a')]);_0x1a7864[_0xdf29('0x4b')]=qs['filters'](_['pick'](_0x49b950[_0xdf29('0x42')],_0x302d2b[_0xdf29('0x43')]),_0x2dbdab);var _0x52d3a8=[];var _0x4f5605=squel[_0xdf29('0x4c')]()['field']('id')[_0xdf29('0x4d')](_0xdf29('0x2c'))[_0xdf29('0x4d')]('color')[_0xdf29('0x4e')](_0xdf29('0x4f'));var _0x330295=squel[_0xdf29('0x4c')]()[_0xdf29('0x4d')](_0xdf29('0x50'))['field'](_0xdf29('0x51'))[_0xdf29('0x4d')](_0xdf29('0x52'))[_0xdf29('0x4e')](_0xdf29('0x53'),'ui')['left_join'](_0xdf29('0x54'),'u',_0xdf29('0x55'));var _0x4e71fc=squel[_0xdf29('0x4c')]()[_0xdf29('0x4e')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0xdf29('0x56'))[_0xdf29('0x57')]('users','o',_0xdf29('0x58'))['left_join']('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0xdf29('0x57')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0xdf29('0x57')](_0xdf29('0x59'),'it',_0xdf29('0x5a'))[_0xdf29('0x57')](_0xdf29('0x4f'),'t',_0xdf29('0x5b'));var _0x5a4ba1=squel[_0xdf29('0x5c')]();var _0x19ec82=[];var _0x4ec19f=squel['expr']();var _0x304810;if(_0x49b950[_0xdf29('0x42')][_0xdf29('0x5d')]){_0x304810=as[_0xdf29('0x5e')](_0x49b950[_0xdf29('0x42')][_0xdf29('0x5d')]);var _0x59321a=_0x304810[_0xdf29('0x5f')];for(var _0x1a6852=0x0;_0x1a6852<_0x304810[_0xdf29('0x60')][_0xdf29('0x47')];_0x1a6852++){var _0x1077b0=_0x304810[_0xdf29('0x60')][_0x1a6852];var _0x3b7557='i';var _0x3322d3=_[_0xdf29('0x61')](_0x2dbdab,[_0xdf29('0x2c'),_0x1077b0[_0xdf29('0x4d')]]);if(!_0x3322d3){switch(_0x1077b0[_0xdf29('0x4d')]){case _0xdf29('0x62'):if(_0x1077b0[_0xdf29('0x63')]==0x1){_0x4e71fc[_0xdf29('0x64')]('`'+_0x1077b0[_0xdf29('0x4d')]+_0xdf29('0x65'));}else{_0x4e71fc[_0xdf29('0x64')]('`'+_0x1077b0[_0xdf29('0x4d')]+_0xdf29('0x66'));}break;case'Contact':if(_0x1077b0['operator']===_0xdf29('0x67')){if(_0x1077b0[_0xdf29('0x63')][_0xdf29('0x32')]('\x20')[_0xdf29('0x47')]>0x1){_0x5a4ba1[_0x59321a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdf29('0x68')](_0x1077b0[_0xdf29('0x63')]),null);}else{var _0x1f8c62='%'+_0x1077b0[_0xdf29('0x63')]+'%';_0x5a4ba1[_0x59321a](_0xdf29('0x69'),_0x1f8c62,_0x1f8c62,_0x1f8c62);}}else{_0x3322d3=_[_0xdf29('0x61')](_0x2dbdab,[_0xdf29('0x2c'),_0xdf29('0x6a')]);_0x1077b0[_0xdf29('0x4d')]=_0xdf29('0x6a');_0x3de387=as[_0xdf29('0x6b')](_0x3b7557,_0x3322d3['type'],_0x1077b0);_0x5a4ba1[_0x59321a](_0x3de387['text'],_0x3de387['value'][_0xdf29('0x6c')],_0x3de387[_0xdf29('0x63')][_0xdf29('0x1d')]);}break;case _0xdf29('0x6d'):var _0x5b155e=_0x1077b0[_0xdf29('0x63')]['split'](',')['map'](function(_0x5b49cb){return Number(_0x5b49cb);});_0x5b155e['forEach'](function(_0x46629d){_0x4ec19f['or'](_0xdf29('0x6e'),'%,'+_0x46629d+',%');});_0x19ec82=_[_0xdf29('0x6f')](_0x19ec82,_0x5b155e);break;case _0xdf29('0x70'):if(_0x1077b0[_0xdf29('0x71')]===_0xdf29('0x67')){_0x5a4ba1[_0x59321a](_0xdf29('0x72'),'%'+_0x1077b0[_0xdf29('0x63')]+'%',null);}else{_0x3322d3=_[_0xdf29('0x61')](_0x2dbdab,[_0xdf29('0x2c'),'UserId']);_0x1077b0[_0xdf29('0x4d')]=_0xdf29('0x3b');_0x3de387=as[_0xdf29('0x6b')](_0x3b7557,_0x3322d3[_0xdf29('0x73')],_0x1077b0);_0x5a4ba1[_0x59321a](_0x3de387[_0xdf29('0x74')],_0x3de387[_0xdf29('0x63')][_0xdf29('0x6c')],_0x3de387[_0xdf29('0x63')][_0xdf29('0x1d')]);}break;case'body':_0x3de387=as['buildExpression']('me',null,_0x1077b0);_0x5a4ba1[_0x59321a](_0x3de387[_0xdf29('0x74')],_0x3de387[_0xdf29('0x63')][_0xdf29('0x6c')],_0x3de387['value']['end']);break;}}else{var _0x3de387=as['buildExpression'](_0x3b7557,_0x3322d3['type'],_0x1077b0);_0x5a4ba1[_0x59321a](_0x3de387[_0xdf29('0x74')],_0x3de387['value']['start'],_0x3de387[_0xdf29('0x63')][_0xdf29('0x1d')]);}}}else{var _0x12a956=_(_0x49b950[_0xdf29('0x42')])[_0xdf29('0x41')]()[_0xdf29('0x2e')](function(_0x3ede51){return _[_0xdf29('0x75')](_0x2dbdab,['name',_0x3ede51])?_0x3ede51:undefined;})[_0xdf29('0x76')]()[_0xdf29('0x63')]();if(!_[_0xdf29('0x77')](_0x12a956)){_0x12a956[_0xdf29('0x33')](function(_0x437bb0){if(_0x437bb0===_0xdf29('0x78')){_0x4e71fc[_0xdf29('0x4b')](_0xdf29('0x79'),[][_0xdf29('0x7a')](_0x49b950['query'][_0x437bb0]));}else if(_0x437bb0==='createdAt'){var _0x13dcc1=JSON[_0xdf29('0x7b')](_0x49b950[_0xdf29('0x42')][_0x437bb0])[_0xdf29('0x7c')];var _0x3f9382=JSON['parse'](_0x49b950[_0xdf29('0x42')][_0x437bb0])[_0xdf29('0x7d')];_0x4e71fc['where'](_0xdf29('0x7e'),_0x13dcc1,_0x3f9382);}else{if(_0x49b950[_0xdf29('0x42')][_0x437bb0]===_0xdf29('0x7f')){_0x4e71fc['where']('i.'+_0x437bb0+_0xdf29('0x80'));}else{_0x4e71fc[_0xdf29('0x4b')]('i.'+_0x437bb0+_0xdf29('0x81'),_0x49b950[_0xdf29('0x42')][_0x437bb0]);}}});}if(_0x49b950[_0xdf29('0x42')][_0xdf29('0x82')]){if(_0x49b950['query']['read']==0x1){_0x4e71fc[_0xdf29('0x64')]('`unreadMessages`\x20=\x200');}else{_0x4e71fc[_0xdf29('0x64')](_0xdf29('0x83'));}}if(_0x49b950[_0xdf29('0x42')]['tag']){_0x19ec82=_[_0xdf29('0x84')](_0x49b950[_0xdf29('0x42')]['tag'])?_0x49b950[_0xdf29('0x42')]['tag']:new Array(_0x49b950[_0xdf29('0x42')]['tag']);_0x19ec82[_0xdf29('0x33')](function(_0x500bce){_0x4ec19f['or'](_0xdf29('0x6e'),'%,'+_0x500bce+',%');});}if(_0x49b950[_0xdf29('0x42')][_0xdf29('0x85')]){var _0x194298=_0x49b950['query']['filter'][_0xdf29('0x86')]('\x5c','\x5c\x5c')[_0xdf29('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x194298)){_0x5a4ba1['or'](_0xdf29('0x87'),_0x194298+'%')['or'](_0xdf29('0x88'),_0x194298+'%');}else{_0x5a4ba1['or'](_0xdf29('0x89'),qs[_0xdf29('0x68')](_0x194298))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x194298+'%');}}}_0x4e71fc[_0xdf29('0x4b')](_0x5a4ba1);_0x4e71fc[_0xdf29('0x8a')](_0xdf29('0x8b'));var _0x585554={'type':db[_0xdf29('0x8c')][_0xdf29('0x8d')][_0xdf29('0x8e')],'raw':!![]};var _0x4e0b66=_0x4e71fc[_0xdf29('0x8f')]();_0x4e0b66['field'](_0xdf29('0x8b'));_0x4e0b66[_0xdf29('0x4d')](_0xdf29('0x90'),'unreadMessages');if(_0x1a7864['order']){_0x1a7864[_0xdf29('0x49')][_0xdf29('0x33')](function(_0x4a75c9){var _0x47a133=_0x4a75c9[0x0]===_0xdf29('0x91')?_0x4a75c9[0x0]:'i.'+_0x4a75c9[0x0];_0x4e71fc[_0xdf29('0x49')](_0x47a133,_0x4a75c9[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdf29('0x77')](_0x19ec82)){_0x4e71fc[_0xdf29('0x64')](_0x4ec19f);_0x4e0b66['where'](_0xdf29('0x92'),_0x19ec82);}BPromise['resolve']()[_0xdf29('0x29')](function(){if(!_0x304810){if(_0x49b950[_0xdf29('0x42')][_0xdf29('0x78')])return;_0x4e0b66[_0xdf29('0x4b')](_0xdf29('0x93'));_0x4e71fc[_0xdf29('0x4b')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x49b950['user'][_0xdf29('0x94')]!==_0xdf29('0x95'))return;return _0x49b950[_0xdf29('0x96')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x238ebe){if(_[_0xdf29('0x77')](_0x238ebe)){_0x4e0b66[_0xdf29('0x4b')](_0xdf29('0x97'));_0x4e71fc[_0xdf29('0x4b')](_0xdf29('0x97'));}else{_0x4e0b66[_0xdf29('0x4b')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x238ebe,'id'));_0x4e71fc['where'](_0xdf29('0x79'),_[_0xdf29('0x2e')](_0x238ebe,'id'));}});})[_0xdf29('0x29')](function(){if(_0x49b950['user'][_0xdf29('0x94')]==='agent'&&!_0x304810&&!_0x49b950[_0xdf29('0x42')][_0xdf29('0x78')])return[];return db[_0xdf29('0x98')][_0xdf29('0x42')](_0x4e0b66[_0xdf29('0x99')](),_0x585554);})[_0xdf29('0x29')](function(_0x228671){_0x534fa4[_0xdf29('0x22')]=_0x228671[_0xdf29('0x47')];if(_0x534fa4[_0xdf29('0x22')]===0x0)return[];return db['sequelize'][_0xdf29('0x42')](_0x4f5605[_0xdf29('0x99')](),_0x585554)[_0xdf29('0x29')](function(_0x1c65e6){_0x52d3a8=_[_0xdf29('0x9a')](_0x1c65e6,'id');_0x585554=_[_0xdf29('0x9b')](_0x585554,{'model':db[_0xdf29('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49b950[_0xdf29('0x42')][_0xdf29('0x46')]){_0x1a7864['attributes'][_0xdf29('0x33')](function(_0x4dadbb){_0x4e71fc[_0xdf29('0x4d')]('i.'+_0x4dadbb);});}else{_0x4e71fc['field'](_0xdf29('0x90'),_0xdf29('0x62'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0x9c'),'Account.key');_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0x9d'),_0xdf29('0x9e'));_0x4e71fc['field'](_0xdf29('0x9f'),'contactName');_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xa0'));_0x4e71fc[_0xdf29('0x4d')]('c.firstName',_0xdf29('0xa1'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xa2'),_0xdf29('0xa3'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xa4'),_0xdf29('0xa5'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xa6'),_0xdf29('0xa7'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xa8'),_0xdf29('0xa9'));_0x4e71fc[_0xdf29('0x4d')]('c.fax','Contact.fax');_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xaa'),_0xdf29('0xab'));_0x4e71fc['field'](_0xdf29('0xac'),_0xdf29('0xad'));_0x4e71fc[_0xdf29('0x4d')](_0xdf29('0xae'),_0xdf29('0x30'));}if(_0x1a7864['limit'])_0x4e71fc['limit'](_0x1a7864['limit']);if(_0x1a7864[_0xdf29('0x1f')])_0x4e71fc[_0xdf29('0x1f')](_0x1a7864[_0xdf29('0x1f')]);return db['sequelize'][_0xdf29('0x42')](_0x4e71fc['toString'](),_0x585554);})[_0xdf29('0x29')](function(_0x3889a3){if(_0x3889a3[_0xdf29('0x47')]>0x0)_0x330295[_0xdf29('0x4b')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xdf29('0x2e')](_0x3889a3,'id'));return db['sequelize'][_0xdf29('0x42')](_0x330295[_0xdf29('0x99')](),_0x585554)['then'](function(_0x2cbe19){var _0x57d722=_[_0xdf29('0xaf')](_0x2cbe19,'WhatsappInteractionId');var _0xdde714=[];_0x3889a3['forEach'](function(_0x3f1842){_0xdde714[_0xdf29('0x34')](updateWhatsappInteraction(_0x3f1842,_0x52d3a8,_0x57d722));});return BPromise[_0xdf29('0xb0')](_0xdde714);});});})['then'](function(_0x45b7e7){_0x534fa4[_0xdf29('0xb1')]=_0x45b7e7;return _0x534fa4;})[_0xdf29('0x29')](respondWithFilteredResult(_0x254fe4,_0x1a7864))['catch'](handleError(_0x254fe4,null));};exports[_0xdf29('0xb2')]=function(_0x13cc57,_0x13432d){var _0x13c741={'raw':![],'where':{'id':_0x13cc57[_0xdf29('0xb3')]['id']}},_0x4eb4ef={};_0x4eb4ef[_0xdf29('0x40')]=_[_0xdf29('0x41')](db['WhatsappInteraction'][_0xdf29('0xb4')]);_0x4eb4ef[_0xdf29('0x42')]=_['keys'](_0x13cc57['query']);_0x4eb4ef[_0xdf29('0x43')]=_['intersection'](_0x4eb4ef['model'],_0x4eb4ef[_0xdf29('0x42')]);_0x13c741[_0xdf29('0x45')]=_[_0xdf29('0x44')](_0x4eb4ef[_0xdf29('0x40')],qs['fields'](_0x13cc57['query'][_0xdf29('0x46')]));_0x13c741[_0xdf29('0x45')]=_0x13c741[_0xdf29('0x45')][_0xdf29('0x47')]?_0x13c741[_0xdf29('0x45')]:_0x4eb4ef[_0xdf29('0x40')];if(_0x13cc57[_0xdf29('0x42')][_0xdf29('0xb5')]){_0x13c741[_0xdf29('0xb6')]=[{'all':!![]}];}_0x13c741=_[_0xdf29('0x9b')]({},_0x13c741,_0x13cc57['options']);return db[_0xdf29('0x3e')][_0xdf29('0x61')](_0x13c741)[_0xdf29('0x29')](handleEntityNotFound(_0x13432d,null))[_0xdf29('0x29')](respondWithResult(_0x13432d,null))[_0xdf29('0x35')](handleError(_0x13432d,null));};exports['create']=function(_0x1303ad,_0x38b9d3){return db['WhatsappInteraction'][_0xdf29('0xb7')](_0x1303ad['body'],{})[_0xdf29('0x29')](respondWithResult(_0x38b9d3,0xc9))[_0xdf29('0x35')](handleError(_0x38b9d3,null));};exports[_0xdf29('0x28')]=function(_0x3abfe0,_0x4f30f6){if(_0x3abfe0[_0xdf29('0xb8')]['id']){delete _0x3abfe0[_0xdf29('0xb8')]['id'];}return db[_0xdf29('0x3e')][_0xdf29('0x61')]({'where':{'id':_0x3abfe0['params']['id']}})[_0xdf29('0x29')](handleEntityNotFound(_0x4f30f6,null))[_0xdf29('0x29')](saveUpdates(_0x3abfe0[_0xdf29('0xb8')],null))[_0xdf29('0x29')](respondWithResult(_0x4f30f6,null))['catch'](handleError(_0x4f30f6,null));};exports[_0xdf29('0xb9')]=function(_0x141cb3,_0x9cb05d){return db['WhatsappInteraction'][_0xdf29('0x61')]({'where':{'id':_0x141cb3[_0xdf29('0xb3')]['id']}})['then'](handleEntityNotFound(_0x9cb05d,null))[_0xdf29('0x29')](removeEntity(_0x9cb05d,null))[_0xdf29('0x35')](handleError(_0x9cb05d,null));};exports[_0xdf29('0xba')]=function(_0x3795c4,_0x44416b){return db[_0xdf29('0x3e')][_0xdf29('0xba')]()[_0xdf29('0x29')](respondWithResult(_0x44416b,null))[_0xdf29('0x35')](handleError(_0x44416b,null));};exports['addMessage']=function(_0x4b781e,_0x4a4685,_0x16922d){return db['WhatsappMessage']['find']({'where':{'id':_0x4b781e[_0xdf29('0xb3')]['id']}})[_0xdf29('0x29')](handleEntityNotFound(_0x4a4685,null))['then'](function(_0x4d63c0){if(_0x4d63c0){return _0x4d63c0[_0xdf29('0xbb')](_0x4b781e['body'][_0xdf29('0xbc')],_[_0xdf29('0xbd')](_0x4b781e[_0xdf29('0xb8')],[_0xdf29('0xbc'),'id'])||{});}})[_0xdf29('0x29')](respondWithResult(_0x4a4685,null))[_0xdf29('0x35')](handleError(_0x4a4685,null));};exports[_0xdf29('0xbe')]=function(_0xed7461,_0xbd7675,_0x4a0182){var _0x5e912f={'raw':![],'where':{}};var _0x48ad76={};var _0x3212e4={'count':0x0,'rows':[]};return db[_0xdf29('0x3e')][_0xdf29('0xbf')]({'where':{'id':_0xed7461['params']['id']}})['then'](handleEntityNotFound(_0xbd7675,null))['then'](function(_0x29aed8){if(_0x29aed8){_0x48ad76['model']=_['keys'](db['WhatsappMessage'][_0xdf29('0xb4')]);_0x48ad76[_0xdf29('0x42')]=_[_0xdf29('0x41')](_0xed7461[_0xdf29('0x42')]);_0x48ad76[_0xdf29('0x43')]=_[_0xdf29('0x44')](_0x48ad76[_0xdf29('0x40')],_0x48ad76[_0xdf29('0x42')]);_0x5e912f['attributes']=_[_0xdf29('0x44')](_0x48ad76[_0xdf29('0x40')],qs[_0xdf29('0x46')](_0xed7461[_0xdf29('0x42')][_0xdf29('0x46')]));_0x5e912f['attributes']=_0x5e912f[_0xdf29('0x45')][_0xdf29('0x47')]?_0x5e912f[_0xdf29('0x45')]:_0x48ad76[_0xdf29('0x40')];if(!_0xed7461[_0xdf29('0x42')][_0xdf29('0x48')](_0xdf29('0xc0'))){_0x5e912f[_0xdf29('0x21')]=qs[_0xdf29('0x21')](_0xed7461[_0xdf29('0x42')]['limit']);_0x5e912f['offset']=qs[_0xdf29('0x1f')](_0xed7461['query'][_0xdf29('0x1f')]);}_0x5e912f['order']=qs['sort'](_0xed7461[_0xdf29('0x42')][_0xdf29('0x4a')]);_0x5e912f['where']=qs[_0xdf29('0x43')](_[_0xdf29('0xc1')](_0xed7461['query'],_0x48ad76[_0xdf29('0x43')]));_0x5e912f[_0xdf29('0x4b')][_0xdf29('0xc2')]=_0x29aed8['id'];if(_0xed7461[_0xdf29('0x42')][_0xdf29('0x85')]){_0x5e912f[_0xdf29('0x4b')]=_['merge'](_0x5e912f['where'],{'$or':_['map'](_0x5e912f[_0xdf29('0x45')],function(_0x53eedc){var _0x48e5b8={};_0x48e5b8[_0x53eedc]={'$like':'%'+_0xed7461[_0xdf29('0x42')]['filter']+'%'};return _0x48e5b8;})});}if(_0xed7461[_0xdf29('0x42')][_0xdf29('0x7c')]){var _0x3d49a0=_0xed7461[_0xdf29('0x42')][_0xdf29('0x7c')][_0xdf29('0x32')](',');var _0x5fe031={};_0x5fe031[_0x3d49a0[0x0]]={'$gte':moment(_0x3d49a0[0x1])[_0xdf29('0xc3')](_0xdf29('0xc4'))};_0x5e912f[_0xdf29('0x4b')]=_[_0xdf29('0x9b')](_0x5e912f[_0xdf29('0x4b')],_0x5fe031);}_0x5e912f=_[_0xdf29('0x9b')]({},_0x5e912f,_0xed7461['options']);return db['WhatsappMessage'][_0xdf29('0x22')]({'where':_0x5e912f[_0xdf29('0x4b')]})[_0xdf29('0x29')](function(_0x16b5af){_0x3212e4[_0xdf29('0x22')]=_0x16b5af;if(_0xed7461[_0xdf29('0x42')]['includeAll']){_0x5e912f[_0xdf29('0xb6')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x5e912f);})[_0xdf29('0x29')](function(_0x3ed996){_0x3212e4[_0xdf29('0xb1')]=_0x3ed996;return _0x3212e4;});}})['then'](respondWithFilteredResult(_0xbd7675,_0x5e912f))[_0xdf29('0x35')](handleError(_0xbd7675,null));};exports[_0xdf29('0xc5')]=function(_0x4aae5c,_0x428df5,_0x16c9f){return db[_0xdf29('0x3e')][_0xdf29('0x61')]({'where':{'id':_0x4aae5c['params']['id']}})[_0xdf29('0x29')](handleEntityNotFound(_0x428df5,null))[_0xdf29('0x29')](function(_0x241dc1){if(_0x241dc1){return _0x241dc1['setTags'](_0x4aae5c[_0xdf29('0xb8')][_0xdf29('0xbc')],_['omit'](_0x4aae5c['body'],['ids','id'])||{})[_0xdf29('0xc6')](function(){return db[_0xdf29('0x6d')]['findAll']({'attributes':['id','name',_0xdf29('0xc7')],'where':{'id':_0x4aae5c[_0xdf29('0xb8')][_0xdf29('0xbc')]}});})[_0xdf29('0x29')](function(_0x274535){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x4aae5c[_0xdf29('0xb3')]['id']),'tags':_0x274535||[]});return{'id':Number(_0x4aae5c[_0xdf29('0xb3')]['id']),'tags':_0x274535||[]};});}})[_0xdf29('0x29')](respondWithResult(_0x428df5,null))[_0xdf29('0x35')](handleError(_0x428df5,null));};exports['removeTags']=function(_0x31cff4,_0x20239b,_0x306c2e){return db[_0xdf29('0x3e')][_0xdf29('0x61')]({'where':{'id':_0x31cff4[_0xdf29('0xb3')]['id']}})[_0xdf29('0x29')](handleEntityNotFound(_0x20239b,null))[_0xdf29('0x29')](function(_0xea12f2){if(_0xea12f2){return _0xea12f2[_0xdf29('0xc8')](_0x31cff4[_0xdf29('0x42')][_0xdf29('0xbc')]);}})[_0xdf29('0x29')](respondWithStatusCode(_0x20239b,null))[_0xdf29('0x35')](handleError(_0x20239b,null));};exports['download']=function(_0x5902cc,_0x545b63){var _0xe5c565=moment()[_0xdf29('0xc9')]()[_0xdf29('0x99')]();var _0x140e57=path['join'](config[_0xdf29('0xca')],_0xdf29('0xcb'),_0xdf29('0xcc'),_0xdf29('0xcd'));var _0xacfd29=path[_0xdf29('0xce')](config[_0xdf29('0xca')],'server',_0xdf29('0xcc'),_0xdf29('0xcf'));var _0x44195=path[_0xdf29('0xce')](_0x140e57,_0xe5c565);var _0x30dc65=util[_0xdf29('0xc3')]('transcript-%d-%s.zip',_0x5902cc['params']['id'],_0xe5c565);var _0x64dfe4=path['join'](_0x140e57,_0x30dc65);var _0x5b1947=[];_0x5b1947[_0xdf29('0x34')]({'model':db[_0xdf29('0x70')],'as':_0xdf29('0x70'),'attributes':['id','fullname'],'raw':!![]});_0x5b1947['push']({'model':db[_0xdf29('0xd0')],'as':_0xdf29('0xd1'),'attributes':['id',_0xdf29('0xd2'),_0xdf29('0xd3')],'raw':!![]});if(_0x5902cc[_0xdf29('0x42')]['attachments']){_0x5b1947[_0xdf29('0x34')]({'model':db[_0xdf29('0xd4')],'as':_0xdf29('0xd4'),'raw':!![]});}var _0x459b43=[{'model':db[_0xdf29('0xd5')],'as':_0xdf29('0xd6'),'attributes':['id','body',_0xdf29('0xd7'),_0xdf29('0xd8'),_0xdf29('0xd9'),'read'],'include':_0x5b1947}];_0x459b43[_0xdf29('0x34')]({'model':db[_0xdf29('0xda')],'as':_0xdf29('0xdb'),'attributes':['id',_0xdf29('0x2c')]});_0x459b43[_0xdf29('0x34')]({'model':db[_0xdf29('0x70')],'as':_0xdf29('0xdc'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0xdf29('0x61')]({'where':{'id':_0x5902cc[_0xdf29('0xb3')]['id']},'include':_0x459b43})[_0xdf29('0x29')](handleEntityNotFound(_0x545b63,null))[_0xdf29('0x29')](function(_0x25f708){if(_0x25f708){var _0x40fad1=_0x25f708[_0xdf29('0xdd')]({'plain':!![]});fs[_0xdf29('0xde')](_0x44195);var _0x2208bf={'channel':_0xdf29('0xdf'),'account':_0x40fad1['Account'][_0xdf29('0x2c')],'agent':_0x40fad1['Owner']?_0x40fad1[_0xdf29('0xdc')][_0xdf29('0x2f')]:_0xdf29('0xe0'),'createdAt':moment(_0x40fad1['createdAt'])[_0xdf29('0xc3')](_0xdf29('0xc4'))[_0xdf29('0x99')](),'closedAt':_0x40fad1['closed']?moment(_0x40fad1[_0xdf29('0xe1')])[_0xdf29('0xc3')](_0xdf29('0xc4'))[_0xdf29('0x99')]():'','disposition':_0x40fad1[_0xdf29('0xe2')],'messages':_(_0x40fad1[_0xdf29('0xd6')])['filter']({'secret':![]})['map'](function(_0x492dbb){if(_0x492dbb[_0xdf29('0xd4')]){var _0x1cd74c=path[_0xdf29('0xce')](_0xacfd29,_0x492dbb[_0xdf29('0xd4')][_0xdf29('0xe3')]);if(fs[_0xdf29('0xe4')](_0x1cd74c)){fs['createReadStream'](_0x1cd74c)['pipe'](fs[_0xdf29('0xe5')](path[_0xdf29('0xce')](_0x44195,_0x492dbb[_0xdf29('0xd4')][_0xdf29('0xe3')])));}}return{'date':moment(_0x492dbb[_0xdf29('0xd7')])[_0xdf29('0xc3')](_0xdf29('0xc4'))[_0xdf29('0x99')](),'sender':_0x492dbb[_0xdf29('0xd8')]==='out'?_0x492dbb[_0xdf29('0x70')]?_0x492dbb[_0xdf29('0x70')][_0xdf29('0x2f')]:'System':_0x492dbb[_0xdf29('0xd1')][_0xdf29('0xd2')]+(_0x492dbb['Contact'][_0xdf29('0xd3')]?'\x20'+_0x492dbb[_0xdf29('0xd1')][_0xdf29('0xd3')]:''),'body':_0x492dbb[_0xdf29('0xd4')]?_0x492dbb[_0xdf29('0xd4')][_0xdf29('0xe3')]:_0x492dbb[_0xdf29('0xb8')],'direction':_0x492dbb[_0xdf29('0xd8')]==='out'?'A':'C','secret':_0x492dbb['secret'],'read':_0x492dbb['read'],'attachment':_0x492dbb[_0xdf29('0xd4')]};})[_0xdf29('0x63')]()};return ejs[_0xdf29('0xe6')](path['join'](config[_0xdf29('0xca')],_0xdf29('0xcb'),_0xdf29('0xe7'),'downloadInteraction.ejs'),{'interaction':_0x2208bf})[_0xdf29('0x29')](function(_0xad6f41){var _0x200500=path['join'](_0x44195,_0xdf29('0xe8')+_0x40fad1['id']+'-'+_0xe5c565+_0xdf29('0xe9'));var _0x42b24e={'path':_0x200500,'channel':_0xdf29('0xdf'),'interactionId':_0x40fad1['id']};return pdf['createPdfFromHTML'](_0xad6f41,_0x42b24e);})['then'](function(){return new BPromise(function(_0x4a53cc,_0x5d1360){zipdir(_0x44195,{'saveTo':_0x64dfe4},function(_0x579049,_0xc832c0){if(_0x579049)return _0x5d1360(_0x579049);return _0x4a53cc(_0xc832c0);});})[_0xdf29('0x29')](function(){return new BPromise(function(_0x97fecb,_0x20bdcd){rimraf(_0x44195,function(_0x172886){if(_0x172886)_0x20bdcd(_0x172886);return _0x97fecb();});});})['then'](function(){return _0x545b63[_0xdf29('0xea')](_0x64dfe4,_0x30dc65,function(_0x4297a4){if(_0x4297a4){console[_0xdf29('0xeb')]('err',_0x4297a4);}else{fs[_0xdf29('0xec')](_0x64dfe4);}});});});}else{return _0x545b63[_0xdf29('0x1c')](0xc8);}})[_0xdf29('0x35')](handleError(_0x545b63,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ee46e28..a66d588 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cfa=['then','setDataValue','map','findAll','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','update'];(function(_0x192ab8,_0x2b761e){var _0x135616=function(_0x3bf01a){while(--_0x3bf01a){_0x192ab8['push'](_0x192ab8['shift']());}};_0x135616(++_0x2b761e);}(_0x0cfa,0x18f));var _0xa0cf=function(_0xda5060,_0x328a73){_0xda5060=_0xda5060-0x0;var _0x5ab625=_0x0cfa[_0xda5060];return _0x5ab625;};'use strict';var EventEmitter=require(_0xa0cf('0x0'));var WhatsappInteraction=require(_0xa0cf('0x1'))['db'][_0xa0cf('0x2')];var WhatsappMessage=require(_0xa0cf('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0cf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x469112){return function(_0x1a6281,_0x19f827,_0x2d61de){_0x1a6281['getUsers']({'attributes':['id'],'raw':!![]})[_0xa0cf('0x4')](function(_0x5d9035){_0x1a6281[_0xa0cf('0x5')]('Users',_0x5d9035[_0xa0cf('0x6')](function(_0x4855d0){return{'id':_0x4855d0['id']};}));return WhatsappMessage[_0xa0cf('0x7')]({'where':{'WhatsappInteractionId':_0x1a6281['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa0cf('0x4')](function(_0x354eab){_0x1a6281['setDataValue'](_0xa0cf('0x8'),_0x354eab[_0xa0cf('0x9')]);WhatsappInteractionEvents['emit'](_0x469112+':'+_0x1a6281['id'],_0x1a6281);WhatsappInteractionEvents['emit'](_0x469112,_0x1a6281);_0x2d61de(null);})[_0xa0cf('0xa')](_0x2d61de(null));};}for(var e in events){if(events[_0xa0cf('0xb')](e)){var event=events[e];WhatsappInteraction[_0xa0cf('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x710e=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x545923,_0x2c33b4){var _0x5755e8=function(_0xf2b946){while(--_0xf2b946){_0x545923['push'](_0x545923['shift']());}};_0x5755e8(++_0x2c33b4);}(_0x710e,0xb6));var _0xe710=function(_0x10ddf3,_0x27aa47){_0x10ddf3=_0x10ddf3-0x0;var _0x419659=_0x710e[_0x10ddf3];return _0x419659;};'use strict';var EventEmitter=require(_0xe710('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xe710('0x1'))['db'][_0xe710('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe710('0x3')](0x0);var events={'afterCreate':_0xe710('0x4'),'afterUpdate':_0xe710('0x5'),'afterDestroy':'remove'};function emitEvent(_0x17600b){return function(_0x2e25b1,_0x5289ce,_0x5a9e4c){_0x2e25b1[_0xe710('0x6')]({'attributes':['id'],'raw':!![]})[_0xe710('0x7')](function(_0x205db2){_0x2e25b1[_0xe710('0x8')](_0xe710('0x9'),_0x205db2[_0xe710('0xa')](function(_0x5e162a){return{'id':_0x5e162a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2e25b1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x21aa4f){_0x2e25b1[_0xe710('0x8')](_0xe710('0xb'),_0x21aa4f[_0xe710('0xc')]);WhatsappInteractionEvents[_0xe710('0xd')](_0x17600b+':'+_0x2e25b1['id'],_0x2e25b1);WhatsappInteractionEvents[_0xe710('0xd')](_0x17600b,_0x2e25b1);_0x5a9e4c(null);})[_0xe710('0xe')](_0x5a9e4c(null));};}for(var e in events){if(events[_0xe710('0xf')](e)){var event=events[e];WhatsappInteraction[_0xe710('0x10')](e,emitEvent(event));}}module[_0xe710('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1e02273..18771cf 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb98b=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xb98b,0x144));var _0xbb98=function(_0x491df8,_0x450301){_0x491df8=_0x491df8-0x0;var _0x4a53e7=_0xb98b[_0x491df8];return _0x4a53e7;};'use strict';var _=require(_0xbb98('0x0'));var util=require(_0xbb98('0x1'));var logger=require(_0xbb98('0x2'))(_0xbb98('0x3'));var moment=require('moment');var BPromise=require(_0xbb98('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb98('0x5'));var rimraf=require('rimraf');var config=require(_0xbb98('0x6'));var attributes=require(_0xbb98('0x7'));module['exports']=function(_0x42a7e0,_0x1bab20){return _0x42a7e0[_0xbb98('0x8')](_0xbb98('0x9'),attributes,{'tableName':_0xbb98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4be77a,_0x1cbe26,_0x5876b8){if(_0x4be77a[_0xbb98('0xb')](_0xbb98('0xc'))){_0x4be77a[_0xbb98('0xd')]=moment()[_0xbb98('0xe')](_0xbb98('0xf'));}_0x5876b8(null,_0x4be77a);}}});}; \ No newline at end of file +var _0x501d=['request-promise','path','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x501d,0x94));var _0xd501=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x501d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd501('0x0'));var util=require(_0xd501('0x1'));var logger=require(_0xd501('0x2'))('api');var moment=require(_0xd501('0x3'));var BPromise=require(_0xd501('0x4'));var rp=require(_0xd501('0x5'));var fs=require('fs');var path=require(_0xd501('0x6'));var rimraf=require('rimraf');var config=require(_0xd501('0x7'));var attributes=require(_0xd501('0x8'));module['exports']=function(_0x55df5c,_0x9643a6){return _0x55df5c[_0xd501('0x9')](_0xd501('0xa'),attributes,{'tableName':_0xd501('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a96c8,_0x12b8a2,_0x2ae462){if(_0x5a96c8[_0xd501('0xc')](_0xd501('0xd'))){_0x5a96c8[_0xd501('0xe')]=moment()[_0xd501('0xf')](_0xd501('0x10'));}_0x2ae462(null,_0x5a96c8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8a1d5eb..144613b 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x148e=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','register','request','then','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','info','AddTagsToWhatsappInteraction','addTags','ids','omit','spread'];(function(_0x2906cf,_0x4f1d9d){var _0x4aea48=function(_0x9a7d3b){while(--_0x9a7d3b){_0x2906cf['push'](_0x2906cf['shift']());}};_0x4aea48(++_0x4f1d9d);}(_0x148e,0x7f));var _0xe148=function(_0x3f7861,_0x13619b){_0x3f7861=_0x3f7861-0x0;var _0x36fdae=_0x148e[_0x3f7861];return _0x36fdae;};'use strict';var _=require(_0xe148('0x0'));var util=require(_0xe148('0x1'));var moment=require(_0xe148('0x2'));var BPromise=require(_0xe148('0x3'));var rs=require(_0xe148('0x4'));var fs=require('fs');var Redis=require(_0xe148('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe148('0x6'));var logger=require(_0xe148('0x7'))('rpc');var config=require(_0xe148('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe148('0x9')]['http']({'port':0x232a});config[_0xe148('0xa')]=_[_0xe148('0xb')](config[_0xe148('0xa')],{'host':_0xe148('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xe148('0xd')](socket);function respondWithRpcPromise(_0x520b89,_0x44f8d8,_0x23089c){return new BPromise(function(_0x28e247,_0x4a7b40){return client[_0xe148('0xe')](_0x520b89,_0x23089c)[_0xe148('0xf')](function(_0x59b103){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x44f8d8,'request\x20sent');logger[_0xe148('0x10')](_0xe148('0x11'),_0x44f8d8,'request\x20sent',JSON[_0xe148('0x12')](_0x59b103));if(_0x59b103[_0xe148('0x13')]){if(_0x59b103[_0xe148('0x13')][_0xe148('0x14')]===0x1f4){logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x59b103[_0xe148('0x13')]['message']);return _0x4a7b40(_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);}logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);return _0x28e247(_0x59b103[_0xe148('0x13')][_0xe148('0x16')]);}else{logger['info'](_0xe148('0x15'),_0x44f8d8,_0xe148('0x17'));_0x28e247(_0x59b103[_0xe148('0x18')][_0xe148('0x16')]);}})[_0xe148('0x19')](function(_0x174fb5){logger[_0xe148('0x13')](_0xe148('0x15'),_0x44f8d8,_0x174fb5);_0x4a7b40(_0x174fb5);});});}exports[_0xe148('0x1a')]=function(_0x45206c){var _0x32857a=this;return new Promise(function(_0x7fd733,_0xda5b7){return db[_0xe148('0x1b')][_0xe148('0x1c')](_0x45206c[_0xe148('0x1d')],{'raw':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x20')]||null:null,'attributes':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x21')]||null:null,'limit':_0x45206c[_0xe148('0x1e')]?_0x45206c[_0xe148('0x1e')][_0xe148('0x22')]||null:null})[_0xe148('0xf')](function(_0x57f113){logger[_0xe148('0x23')]('UpdateWhatsappInteraction',_0x45206c);logger[_0xe148('0x10')](_0xe148('0x1a'),_0x45206c,JSON[_0xe148('0x12')](_0x57f113));_0x7fd733(_0x57f113);})['catch'](function(_0x5ceb87){logger[_0xe148('0x13')](_0xe148('0x1a'),_0x5ceb87[_0xe148('0x16')],_0x45206c);_0xda5b7(_0x32857a[_0xe148('0x13')](0x1f4,_0x5ceb87[_0xe148('0x16')]));});});};exports[_0xe148('0x24')]=function(_0x985d37){return new Promise(function(_0x181a51,_0x3e9b80){return db[_0xe148('0x1b')]['find']({'where':_0x985d37[_0xe148('0x1e')]?_0x985d37['options'][_0xe148('0x20')]||null:null})['then'](function(_0x4de715){if(_0x4de715){return _0x4de715[_0xe148('0x25')](_0x985d37['body'][_0xe148('0x26')],_[_0xe148('0x27')](_0x985d37[_0xe148('0x1d')],[_0xe148('0x26'),'id'])||{});}})[_0xe148('0x28')](function(_0x70e0f0){logger[_0xe148('0x23')](_0xe148('0x29'),_0x985d37);logger[_0xe148('0x10')](_0xe148('0x29'),_0x985d37,JSON['stringify'](_0x70e0f0));_0x181a51(_0x70e0f0);})[_0xe148('0x19')](function(_0x249855){logger['error'](_0xe148('0x29'),_0x249855[_0xe148('0x16')],_0x985d37);_0x3e9b80(_this[_0xe148('0x13')](0x1f4,_0x249855[_0xe148('0x16')]));});});}; \ No newline at end of file +var _0x5c8d=['./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','error','code','message','result','catch','UpdateWhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','omit','ids','spread','AddTags','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis'];(function(_0x3af770,_0x1a957a){var _0x42c9a9=function(_0x2afac3){while(--_0x2afac3){_0x3af770['push'](_0x3af770['shift']());}};_0x42c9a9(++_0x1a957a);}(_0x5c8d,0x112));var _0xd5c8=function(_0x3df43b,_0x41971e){_0x3df43b=_0x3df43b-0x0;var _0x7a9f66=_0x5c8d[_0x3df43b];return _0x7a9f66;};'use strict';var _=require(_0xd5c8('0x0'));var util=require(_0xd5c8('0x1'));var moment=require('moment');var BPromise=require(_0xd5c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5c8('0x3'))['db'];var utils=require(_0xd5c8('0x4'));var logger=require(_0xd5c8('0x5'))(_0xd5c8('0x6'));var config=require(_0xd5c8('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd5c8('0x8')]({'port':0x232a});config['redis']=_[_0xd5c8('0x9')](config['redis'],{'host':_0xd5c8('0xa'),'port':0x18eb});var socket=require(_0xd5c8('0xb'))(new Redis(config[_0xd5c8('0xc')]));require(_0xd5c8('0xd'))[_0xd5c8('0xe')](socket);function respondWithRpcPromise(_0x4a6b41,_0x4c1b6b,_0x38df49){return new BPromise(function(_0x4639f3,_0x21e86e){return client[_0xd5c8('0xf')](_0x4a6b41,_0x38df49)[_0xd5c8('0x10')](function(_0x42ffb9){logger[_0xd5c8('0x11')](_0xd5c8('0x12'),_0x4c1b6b,'request\x20sent');logger[_0xd5c8('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4c1b6b,'request\x20sent',JSON['stringify'](_0x42ffb9));if(_0x42ffb9[_0xd5c8('0x14')]){if(_0x42ffb9[_0xd5c8('0x14')][_0xd5c8('0x15')]===0x1f4){logger[_0xd5c8('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4c1b6b,_0x42ffb9[_0xd5c8('0x14')][_0xd5c8('0x16')]);return _0x21e86e(_0x42ffb9[_0xd5c8('0x14')][_0xd5c8('0x16')]);}logger['error'](_0xd5c8('0x12'),_0x4c1b6b,_0x42ffb9['error'][_0xd5c8('0x16')]);return _0x4639f3(_0x42ffb9[_0xd5c8('0x14')][_0xd5c8('0x16')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4c1b6b,'request\x20sent');_0x4639f3(_0x42ffb9[_0xd5c8('0x17')][_0xd5c8('0x16')]);}})[_0xd5c8('0x18')](function(_0x28dbd3){logger[_0xd5c8('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x4c1b6b,_0x28dbd3);_0x21e86e(_0x28dbd3);});});}exports[_0xd5c8('0x19')]=function(_0x40de17){var _0x15d31c=this;return new Promise(function(_0x549253,_0x138d7e){return db['WhatsappInteraction'][_0xd5c8('0x1a')](_0x40de17[_0xd5c8('0x1b')],{'raw':_0x40de17[_0xd5c8('0x1c')]?_0x40de17['options'][_0xd5c8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40de17[_0xd5c8('0x1c')]?_0x40de17[_0xd5c8('0x1c')][_0xd5c8('0x1e')]||null:null,'attributes':_0x40de17[_0xd5c8('0x1c')]?_0x40de17[_0xd5c8('0x1c')]['attributes']||null:null,'limit':_0x40de17[_0xd5c8('0x1c')]?_0x40de17[_0xd5c8('0x1c')][_0xd5c8('0x1f')]||null:null})[_0xd5c8('0x10')](function(_0x2cf2ab){logger[_0xd5c8('0x11')](_0xd5c8('0x19'),_0x40de17);logger[_0xd5c8('0x13')]('UpdateWhatsappInteraction',_0x40de17,JSON['stringify'](_0x2cf2ab));_0x549253(_0x2cf2ab);})['catch'](function(_0x485951){logger['error'](_0xd5c8('0x19'),_0x485951[_0xd5c8('0x16')],_0x40de17);_0x138d7e(_0x15d31c[_0xd5c8('0x14')](0x1f4,_0x485951[_0xd5c8('0x16')]));});});};exports[_0xd5c8('0x20')]=function(_0x40dce6){return new Promise(function(_0x294a78,_0x409d44){return db[_0xd5c8('0x21')][_0xd5c8('0x22')]({'where':_0x40dce6[_0xd5c8('0x1c')]?_0x40dce6['options']['where']||null:null})[_0xd5c8('0x10')](function(_0x44f8e4){if(_0x44f8e4){return _0x44f8e4[_0xd5c8('0x23')](_0x40dce6[_0xd5c8('0x1b')]['ids'],_[_0xd5c8('0x24')](_0x40dce6['body'],[_0xd5c8('0x25'),'id'])||{});}})[_0xd5c8('0x26')](function(_0x257138){logger[_0xd5c8('0x11')](_0xd5c8('0x27'),_0x40dce6);logger[_0xd5c8('0x13')](_0xd5c8('0x27'),_0x40dce6,JSON[_0xd5c8('0x28')](_0x257138));_0x294a78(_0x257138);})[_0xd5c8('0x18')](function(_0x176808){logger[_0xd5c8('0x14')](_0xd5c8('0x27'),_0x176808[_0xd5c8('0x16')],_0x40dce6);_0x409d44(_this['error'](0x1f4,_0x176808[_0xd5c8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4b30675..ce9fee6 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa340=['removeListener','register','length','./whatsappInteraction.events','save','remove','update'];(function(_0x4120fa,_0x44b9b9){var _0xd21c30=function(_0x24a89f){while(--_0x24a89f){_0x4120fa['push'](_0x4120fa['shift']());}};_0xd21c30(++_0x44b9b9);}(_0xa340,0x145));var _0x0a34=function(_0x346039,_0x4dda34){_0x346039=_0x346039-0x0;var _0x5467ac=_0xa340[_0x346039];return _0x5467ac;};'use strict';var WhatsappInteractionEvents=require(_0x0a34('0x0'));var events=[_0x0a34('0x1'),_0x0a34('0x2'),_0x0a34('0x3')];function createListener(_0x455a54,_0x830c58){return function(_0xd9461d){_0x830c58['emit'](_0x455a54,_0xd9461d);};}function removeListener(_0x10a0ef,_0x79d131){return function(){WhatsappInteractionEvents[_0x0a34('0x4')](_0x10a0ef,_0x79d131);};}exports[_0x0a34('0x5')]=function(_0x235a03){for(var _0x3e134f=0x0,_0x3ba204=events[_0x0a34('0x6')];_0x3e134f<_0x3ba204;_0x3e134f++){var _0x545ce0=events[_0x3e134f];var _0x1bc78b=createListener('whatsappInteraction:'+_0x545ce0,_0x235a03);WhatsappInteractionEvents['on'](_0x545ce0,_0x1bc78b);}}; \ No newline at end of file +var _0xfabe=['save','remove','update','removeListener','register','length','./whatsappInteraction.events'];(function(_0x36b140,_0x3be926){var _0x2768dd=function(_0x1c01c1){while(--_0x1c01c1){_0x36b140['push'](_0x36b140['shift']());}};_0x2768dd(++_0x3be926);}(_0xfabe,0xae));var _0xefab=function(_0x5360a7,_0x5e86e8){_0x5360a7=_0x5360a7-0x0;var _0x4d5b24=_0xfabe[_0x5360a7];return _0x4d5b24;};'use strict';var WhatsappInteractionEvents=require(_0xefab('0x0'));var events=[_0xefab('0x1'),_0xefab('0x2'),_0xefab('0x3')];function createListener(_0x147fc7,_0x3264ca){return function(_0x40445c){_0x3264ca['emit'](_0x147fc7,_0x40445c);};}function removeListener(_0x23b8ea,_0x474922){return function(){WhatsappInteractionEvents[_0xefab('0x4')](_0x23b8ea,_0x474922);};}exports[_0xefab('0x5')]=function(_0x1c5e9a){for(var _0x2adcf8=0x0,_0x3351da=events[_0xefab('0x6')];_0x2adcf8<_0x3351da;_0x2adcf8++){var _0x4003bb=events[_0x2adcf8];var _0x41b8b7=createListener('whatsappInteraction:'+_0x4003bb,_0x1c5e9a);WhatsappInteractionEvents['on'](_0x4003bb,_0x41b8b7);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b821fc2..a1a3d6a 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ab8=['update','/:id/accept','accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put'];(function(_0x51562e,_0x112fe1){var _0x3a9faa=function(_0x455b11){while(--_0x455b11){_0x51562e['push'](_0x51562e['shift']());}};_0x3a9faa(++_0x112fe1);}(_0x9ab8,0x1d6));var _0x89ab=function(_0x561697,_0x4950fe){_0x561697=_0x561697-0x0;var _0x227572=_0x9ab8[_0x561697];return _0x227572;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require(_0x89ab('0x2'));var timeout=require(_0x89ab('0x3'));var express=require(_0x89ab('0x4'));var router=express[_0x89ab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x6'));var interaction=require(_0x89ab('0x7'));var config=require(_0x89ab('0x8'));var controller=require('./whatsappMessage.controller');router[_0x89ab('0x9')]('/',auth[_0x89ab('0xa')](),controller[_0x89ab('0xb')]);router[_0x89ab('0x9')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xd')]);router[_0x89ab('0x9')](_0x89ab('0xe'),auth['isAuthenticated'](),controller[_0x89ab('0xf')]);router[_0x89ab('0x10')]('/',auth[_0x89ab('0xa')](),interaction[_0x89ab('0x11')](_0x89ab('0x12'),_0x89ab('0x13')),controller[_0x89ab('0x14')]);router[_0x89ab('0x10')](_0x89ab('0x15'),controller['status']);router[_0x89ab('0x16')]('/:id',auth[_0x89ab('0xa')](),controller[_0x89ab('0x17')]);router['put'](_0x89ab('0x18'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x19')]);router[_0x89ab('0x16')]('/:id/reject',auth['isAuthenticated'](),controller[_0x89ab('0x1a')]);router[_0x89ab('0x1b')](_0x89ab('0xe'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xbfec=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports'];(function(_0x3244f4,_0x402507){var _0x237aa8=function(_0x506a3a){while(--_0x506a3a){_0x3244f4['push'](_0x3244f4['shift']());}};_0x237aa8(++_0x402507);}(_0xbfec,0x1c0));var _0xcbfe=function(_0x37dd56,_0x1dfdcd){_0x37dd56=_0x37dd56-0x0;var _0x320f93=_0xbfec[_0x37dd56];return _0x320f93;};'use strict';var multer=require(_0xcbfe('0x0'));var util=require(_0xcbfe('0x1'));var path=require('path');var timeout=require(_0xcbfe('0x2'));var express=require('express');var router=express[_0xcbfe('0x3')]();var fs_extra=require(_0xcbfe('0x4'));var auth=require(_0xcbfe('0x5'));var interaction=require(_0xcbfe('0x6'));var config=require(_0xcbfe('0x7'));var controller=require('./whatsappMessage.controller');router[_0xcbfe('0x8')]('/',auth[_0xcbfe('0x9')](),controller['index']);router['get'](_0xcbfe('0xa'),auth['isAuthenticated'](),controller[_0xcbfe('0xb')]);router[_0xcbfe('0x8')](_0xcbfe('0xc'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0xd')]);router['post']('/',auth[_0xcbfe('0x9')](),interaction['tracked'](_0xcbfe('0xe'),_0xcbfe('0xf')),controller[_0xcbfe('0x10')]);router[_0xcbfe('0x11')](_0xcbfe('0x12'),controller[_0xcbfe('0x13')]);router[_0xcbfe('0x14')](_0xcbfe('0xc'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0x15')]);router['put'](_0xcbfe('0x16'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0x17')]);router[_0xcbfe('0x14')](_0xcbfe('0x18'),auth[_0xcbfe('0x9')](),controller['reject']);router[_0xcbfe('0x19')](_0xcbfe('0xc'),auth[_0xcbfe('0x9')](),controller[_0xcbfe('0x1a')]);module[_0xcbfe('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f8295b..64f8ac5 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7bae=['DATE','BOOLEAN','exports','TEXT','medium','out','STRING'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0x7bae,0xaa));var _0xe7ba=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x7bae[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');module[_0xe7ba('0x0')]={'body':{'type':Sequelize[_0xe7ba('0x1')](_0xe7ba('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe7ba('0x3')),'defaultValue':_0xe7ba('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe7ba('0x4')]},'readAt':{'type':Sequelize[_0xe7ba('0x5')]},'secret':{'type':Sequelize[_0xe7ba('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe7ba('0x4')]},'providerResponse':{'type':Sequelize[_0xe7ba('0x1')]}}; \ No newline at end of file +var _0xc8e9=['exports','BOOLEAN','ENUM','out','STRING','TEXT'];(function(_0x411eb1,_0x582d41){var _0x2f8bc0=function(_0x26c192){while(--_0x26c192){_0x411eb1['push'](_0x411eb1['shift']());}};_0x2f8bc0(++_0x582d41);}(_0xc8e9,0x18c));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x9c8e('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9c8e('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9c8e('0x2')]('in',_0x9c8e('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9c8e('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9c8e('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9c8e('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6a20984..879dd1c 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x510b=['QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','role','rejectMessage','ContactId','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','error','WhatsappMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','undefined','limit','offset','count','apply','destroy','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','show','params','rawAttributes','length','find','create','body','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','update','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize'];(function(_0x372e22,_0x8fd190){var _0x34b6e0=function(_0xff78f5){while(--_0xff78f5){_0x372e22['push'](_0x372e22['shift']());}};_0x34b6e0(++_0x8fd190);}(_0x510b,0x1b8));var _0xb510=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x510b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb510('0x0'));var rimraf=require(_0xb510('0x1'));var zipdir=require(_0xb510('0x2'));var jsonpatch=require(_0xb510('0x3'));var rp=require(_0xb510('0x4'));var moment=require('moment');var BPromise=require(_0xb510('0x5'));var Mustache=require(_0xb510('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb510('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb510('0x8'));var _=require(_0xb510('0x9'));var squel=require('squel');var crypto=require(_0xb510('0xa'));var jsforce=require(_0xb510('0xb'));var deskjs=require(_0xb510('0xc'));var toCsv=require(_0xb510('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb510('0xd'));var qs=require(_0xb510('0xe'));var as=require(_0xb510('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb510('0x10'))(_0xb510('0x11'));var utils=require(_0xb510('0x12'));var config=require(_0xb510('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb510('0x14'))['db'];config[_0xb510('0x15')]=_[_0xb510('0x16')](config['redis'],{'host':_0xb510('0x17'),'port':0x18eb});var socket=require(_0xb510('0x18'))(new Redis(config['redis']));require(_0xb510('0x19'))[_0xb510('0x1a')](socket);var jayson=require(_0xb510('0x1b'));var client=jayson[_0xb510('0x1c')][_0xb510('0x1d')]({'port':0x232c});var client9002=jayson[_0xb510('0x1c')][_0xb510('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x248695,_0x512efe,_0x5bc156,_0x206e52){return new BPromise(function(_0x5ad1b7,_0xe88021){var _0x258833=_0x206e52||client;return _0x258833[_0xb510('0x1e')](_0x248695,_0x5bc156)[_0xb510('0x1f')](function(_0x50f683){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x512efe,_0xb510('0x20'));logger[_0xb510('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x512efe,_0xb510('0x20'),JSON['stringify'](_0x50f683));if(_0x50f683[_0xb510('0x22')]){if(_0x50f683[_0xb510('0x22')]['code']===0x1f4){logger['error'](_0xb510('0x23'),_0x512efe,_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);return _0xe88021(_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);}logger['error'](_0xb510('0x23'),_0x512efe,_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);return _0x5ad1b7(_0x50f683[_0xb510('0x22')][_0xb510('0x24')]);}else{logger[_0xb510('0x25')](_0xb510('0x23'),_0x512efe,_0xb510('0x20'));_0x5ad1b7(_0x50f683['result'][_0xb510('0x24')]);}})[_0xb510('0x26')](function(_0x5212de){logger[_0xb510('0x22')](_0xb510('0x23'),_0x512efe,_0x5212de);_0xe88021(_0x5212de);});});}function respondWithStatusCode(_0x472601,_0x1b3802){_0x1b3802=_0x1b3802||0xcc;return function(_0x5c56bd){if(_0x5c56bd){return _0x472601[_0xb510('0x27')](_0x1b3802);}return _0x472601[_0xb510('0x28')](_0x1b3802)[_0xb510('0x29')]();};}function respondWithResult(_0x59069f,_0x2070c3){_0x2070c3=_0x2070c3||0xc8;return function(_0x86905){if(_0x86905){return _0x59069f['status'](_0x2070c3)[_0xb510('0x2a')](_0x86905);}};}function respondWithFilteredResult(_0x5a3ebb,_0x2f97fb){return function(_0x5a5641){if(_0x5a5641){var _0x40a330=typeof _0x2f97fb['offset']===_0xb510('0x2b')&&typeof _0x2f97fb[_0xb510('0x2c')]===_0xb510('0x2b');var _0x246e06=_0x5a5641['count'];var _0x5a753b=_0x40a330?0x0:_0x2f97fb[_0xb510('0x2d')];var _0x3ea8d9=_0x40a330?_0x5a5641[_0xb510('0x2e')]:_0x2f97fb[_0xb510('0x2d')]+_0x2f97fb[_0xb510('0x2c')];var _0x5a87ee;if(_0x3ea8d9>=_0x246e06){_0x3ea8d9=_0x246e06;_0x5a87ee=0xc8;}else{_0x5a87ee=0xce;}_0x5a3ebb[_0xb510('0x28')](_0x5a87ee);return _0x5a3ebb['set']('Content-Range',_0x5a753b+'-'+_0x3ea8d9+'/'+_0x246e06)['json'](_0x5a5641);}return null;};}function patchUpdates(_0xe4585a){return function(_0x3ca158){try{jsonpatch[_0xb510('0x2f')](_0x3ca158,_0xe4585a,!![]);}catch(_0x449a74){return BPromise['reject'](_0x449a74);}return _0x3ca158['save']();};}function saveUpdates(_0x39de11,_0xd08e64){return function(_0x5a38be){if(_0x5a38be){return _0x5a38be['update'](_0x39de11)[_0xb510('0x1f')](function(_0x4d4b0e){return _0x4d4b0e;});}return null;};}function removeEntity(_0x304576,_0x224cca){return function(_0x5d0d40){if(_0x5d0d40){return _0x5d0d40[_0xb510('0x30')]()[_0xb510('0x1f')](function(){_0x304576['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41943d,_0x271b92){return function(_0x4d4fd4){if(!_0x4d4fd4){_0x41943d[_0xb510('0x27')](0x194);}return _0x4d4fd4;};}function handleError(_0x3a70e,_0x48a232){_0x48a232=_0x48a232||0x1f4;return function(_0x4b5da9){logger[_0xb510('0x22')](_0x4b5da9[_0xb510('0x31')]);if(_0x4b5da9[_0xb510('0x32')]){delete _0x4b5da9['name'];}_0x3a70e[_0xb510('0x28')](_0x48a232)[_0xb510('0x33')](_0x4b5da9);};}exports['index']=function(_0x3b14c1,_0x2410df){var _0x521d39={},_0x22d2f2={},_0x384f17={'count':0x0,'rows':[]};var _0x4f1a81=_[_0xb510('0x34')](db['WhatsappMessage']['rawAttributes'],function(_0x3e3676){return{'name':_0x3e3676[_0xb510('0x35')],'type':_0x3e3676[_0xb510('0x36')][_0xb510('0x37')]};});_0x22d2f2[_0xb510('0x38')]=_['map'](_0x4f1a81,'name');_0x22d2f2[_0xb510('0x39')]=_[_0xb510('0x3a')](_0x3b14c1[_0xb510('0x39')]);_0x22d2f2['filters']=_[_0xb510('0x3b')](_0x22d2f2[_0xb510('0x38')],_0x22d2f2[_0xb510('0x39')]);_0x521d39['attributes']=_['intersection'](_0x22d2f2['model'],qs[_0xb510('0x3c')](_0x3b14c1[_0xb510('0x39')]['fields']));_0x521d39[_0xb510('0x3d')]=_0x521d39[_0xb510('0x3d')]['length']?_0x521d39[_0xb510('0x3d')]:_0x22d2f2[_0xb510('0x38')];if(!_0x3b14c1[_0xb510('0x39')][_0xb510('0x3e')](_0xb510('0x3f'))){_0x521d39[_0xb510('0x2c')]=qs['limit'](_0x3b14c1[_0xb510('0x39')][_0xb510('0x2c')]);_0x521d39[_0xb510('0x2d')]=qs[_0xb510('0x2d')](_0x3b14c1[_0xb510('0x39')][_0xb510('0x2d')]);}_0x521d39[_0xb510('0x40')]=qs[_0xb510('0x41')](_0x3b14c1[_0xb510('0x39')]['sort']);_0x521d39[_0xb510('0x42')]=qs['filters'](_[_0xb510('0x43')](_0x3b14c1[_0xb510('0x39')],_0x22d2f2['filters']),_0x4f1a81);if(_0x3b14c1['query'][_0xb510('0x44')]){_0x521d39['where']=_[_0xb510('0x45')](_0x521d39['where'],{'$or':_[_0xb510('0x34')](_0x4f1a81,function(_0x38b751){if(_0x38b751[_0xb510('0x36')]!==_0xb510('0x46')){var _0x4556a9={};_0x4556a9[_0x38b751[_0xb510('0x32')]]={'$like':'%'+_0x3b14c1[_0xb510('0x39')][_0xb510('0x44')]+'%'};return _0x4556a9;}})});}_0x521d39=_['merge']({},_0x521d39,_0x3b14c1[_0xb510('0x47')]);var _0x3811a5={'where':_0x521d39[_0xb510('0x42')]};return db[_0xb510('0x48')][_0xb510('0x2e')](_0x3811a5)['then'](function(_0x289f86){_0x384f17[_0xb510('0x2e')]=_0x289f86;if(_0x3b14c1['query'][_0xb510('0x49')]){_0x521d39[_0xb510('0x4a')]=[{'all':!![]}];}return db[_0xb510('0x48')]['findAll'](_0x521d39);})[_0xb510('0x1f')](function(_0x56930a){_0x384f17[_0xb510('0x4b')]=_0x56930a;return _0x384f17;})['then'](respondWithFilteredResult(_0x2410df,_0x521d39))[_0xb510('0x26')](handleError(_0x2410df,null));};exports[_0xb510('0x4c')]=function(_0x155685,_0x54cb3d){var _0x408830={'raw':!![],'where':{'id':_0x155685[_0xb510('0x4d')]['id']}},_0x2d4da2={};_0x2d4da2[_0xb510('0x38')]=_[_0xb510('0x3a')](db[_0xb510('0x48')][_0xb510('0x4e')]);_0x2d4da2[_0xb510('0x39')]=_[_0xb510('0x3a')](_0x155685[_0xb510('0x39')]);_0x2d4da2['filters']=_[_0xb510('0x3b')](_0x2d4da2['model'],_0x2d4da2[_0xb510('0x39')]);_0x408830[_0xb510('0x3d')]=_[_0xb510('0x3b')](_0x2d4da2[_0xb510('0x38')],qs[_0xb510('0x3c')](_0x155685['query']['fields']));_0x408830[_0xb510('0x3d')]=_0x408830['attributes'][_0xb510('0x4f')]?_0x408830[_0xb510('0x3d')]:_0x2d4da2[_0xb510('0x38')];if(_0x155685['query'][_0xb510('0x49')]){_0x408830['include']=[{'all':!![]}];}_0x408830=_[_0xb510('0x45')]({},_0x408830,_0x155685[_0xb510('0x47')]);return db[_0xb510('0x48')][_0xb510('0x50')](_0x408830)[_0xb510('0x1f')](handleEntityNotFound(_0x54cb3d,null))[_0xb510('0x1f')](respondWithResult(_0x54cb3d,null))[_0xb510('0x26')](handleError(_0x54cb3d,null));};exports['create']=function(_0x27e7e2,_0x487713){return db[_0xb510('0x48')][_0xb510('0x51')](_0x27e7e2[_0xb510('0x52')],{})[_0xb510('0x1f')](respondWithResult(_0x487713,0xc9))['catch'](handleError(_0x487713,null));};exports['update']=function(_0x43c605,_0x15a712){if(_0x43c605['body']['id']){delete _0x43c605['body']['id'];}return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x43c605[_0xb510('0x4d')]['id']}})[_0xb510('0x1f')](handleEntityNotFound(_0x15a712,null))[_0xb510('0x1f')](saveUpdates(_0x43c605[_0xb510('0x52')],null))[_0xb510('0x1f')](respondWithResult(_0x15a712,null))[_0xb510('0x26')](handleError(_0x15a712,null));};exports[_0xb510('0x30')]=function(_0x1a930c,_0x1de7fe){return db['WhatsappMessage'][_0xb510('0x50')]({'where':{'id':_0x1a930c[_0xb510('0x4d')]['id']}})[_0xb510('0x1f')](handleEntityNotFound(_0x1de7fe,null))[_0xb510('0x1f')](removeEntity(_0x1de7fe,null))[_0xb510('0x26')](handleError(_0x1de7fe,null));};exports[_0xb510('0x53')]=function(_0x3a1ab7,_0x164cf3){return db[_0xb510('0x48')][_0xb510('0x53')]()[_0xb510('0x1f')](respondWithResult(_0x164cf3,null))['catch'](handleError(_0x164cf3,null));};var interaction_log=require(_0xb510('0x10'))('whatsapp-interactions');exports[_0xb510('0x54')]=function(_0x170c92,_0x3ca9ca,_0x594690){var _0x5bdf5b={'agent':{},'channel':_0xb510('0x55')};if(_0x170c92[_0xb510('0x52')]['id']){delete _0x170c92[_0xb510('0x52')]['id'];}_0x170c92[_0xb510('0x52')][_0xb510('0x56')]=!![];_0x170c92['body'][_0xb510('0x57')]=moment()[_0xb510('0x58')](_0xb510('0x59'));_0x170c92[_0xb510('0x52')][_0xb510('0x5a')]=_0x170c92[_0xb510('0x52')][_0xb510('0x5a')]||_0x170c92[_0xb510('0x5b')]['id'];_0x5bdf5b[_0xb510('0x5c')]['id']=_0x170c92['body'][_0xb510('0x5a')];return db['WhatsappMessage'][_0xb510('0x50')]({'where':{'id':_0x170c92[_0xb510('0x4d')]['id'],'UserId':null}})[_0xb510('0x1f')](handleEntityNotFound(_0x3ca9ca,null))[_0xb510('0x1f')](saveUpdates(_0x170c92['body'],null))[_0xb510('0x1f')](function(_0x37715e){if(_0x37715e){_0x5bdf5b[_0xb510('0x24')]=_0x37715e[_0xb510('0x5d')]({'plain':!![]});return db[_0xb510('0x5e')][_0xb510('0x50')]({'where':{'id':_0x37715e[_0xb510('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x3ca9ca,null))[_0xb510('0x1f')](function(_0x37708a){if(_0x37708a){return _0x37708a[_0xb510('0x60')]({'UserId':_0x170c92[_0xb510('0x52')][_0xb510('0x5a')],'read1stAt':_[_0xb510('0x61')](_0x37708a[_0xb510('0x62')])?moment()['format'](_0xb510('0x59')):undefined});}return null;})[_0xb510('0x1f')](function(_0x2b1e49){if(_0x2b1e49){_0x5bdf5b[_0xb510('0x63')]=_0x2b1e49['get']({'plain':!![]});interaction_log[_0xb510('0x25')](_0xb510('0x64'),_0x170c92[_0xb510('0x5b')]['id'],_0x170c92['user'][_0xb510('0x32')],_0x170c92['user']['role'],_0x5bdf5b[_0xb510('0x63')]['id'],_0x170c92[_0xb510('0x52')]?JSON[_0xb510('0x65')](_0x170c92[_0xb510('0x52')]):_0xb510('0x66'));return respondWithRpcPromise(_0xb510('0x67'),_0xb510('0x68'),_0x5bdf5b);}return null;})[_0xb510('0x1f')](function(_0x8eb256){var _0x36ac1b=_0xb510('0x69')+_0x8eb256[_0xb510('0x24')]['ContactId'];return db[_0xb510('0x6a')][_0xb510('0x39')](_0x36ac1b,{'type':db[_0xb510('0x6b')][_0xb510('0x6c')][_0xb510('0x6d')],'raw':!![]})[_0xb510('0x1f')](function(_0xdb60b4){return _0xdb60b4;});})[_0xb510('0x1f')](function(_0x39e1bc){if(_0x39e1bc){_0x5bdf5b['message'][_0xb510('0x6e')]=_0x39e1bc[0x0];if(!_0x170c92['body']['UserId'])return;return db[_0xb510('0x6f')][_0xb510('0x50')]({'where':{'id':_0x170c92[_0xb510('0x52')][_0xb510('0x5a')],'role':_0xb510('0x5c')},'attributes':['id',_0xb510('0x32'),_0xb510('0x70'),_0xb510('0x71'),_0xb510('0x72')],'raw':!![]});}return null;})['then'](function(_0x3525b7){if(!_0x3525b7)return null;_0x5bdf5b['message']['agent']=_0x3525b7;return _0x5bdf5b;})['then'](function(_0x257b30){if(_0x257b30){if(_0x170c92[_0xb510('0x52')][_0xb510('0x73')]){_0x5bdf5b[_0xb510('0x24')][_0xb510('0x74')]=util['format'](_0xb510('0x75'),_0x170c92[_0xb510('0x5b')][_0xb510('0x32')]);_0x5bdf5b['message'][_0xb510('0x76')]=_0x5bdf5b[_0xb510('0x76')];_0x5bdf5b['message'][_0xb510('0x77')]=_0x5bdf5b[_0xb510('0x76')];_0x5bdf5b[_0xb510('0x24')][_0xb510('0x78')]=_0xb510('0x54');return respondWithRpcPromise(_0xb510('0x79'),_0xb510('0x79'),{'event':_0xb510('0x7a'),'message':_0x5bdf5b[_0xb510('0x24')]},client9002)[_0xb510('0x1f')](function(){return _0x5bdf5b;});}return _0x5bdf5b;}return null;})[_0xb510('0x1f')](respondWithResult(_0x3ca9ca,null))[_0xb510('0x26')](handleError(_0x3ca9ca,null));};var interaction_log=require(_0xb510('0x10'))(_0xb510('0x7b'));exports['reject']=function(_0x2c5ec0,_0x297825,_0x1333fd){var _0x312c65={'agent':{},'channel':_0xb510('0x55')};if(_0x2c5ec0['body']['id']){delete _0x2c5ec0[_0xb510('0x52')]['id'];}_0x2c5ec0[_0xb510('0x52')][_0xb510('0x5a')]=_0x2c5ec0['body'][_0xb510('0x5a')]||_0x2c5ec0[_0xb510('0x5b')]['id'];_0x312c65[_0xb510('0x5c')]['id']=_0x2c5ec0['body'][_0xb510('0x5a')];return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x2c5ec0['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x297825,null))[_0xb510('0x1f')](function(_0x148dc4){if(_0x148dc4){_0x312c65[_0xb510('0x24')]=_0x148dc4[_0xb510('0x5d')]({'plain':!![]});return db[_0xb510('0x5e')][_0xb510('0x50')]({'where':{'id':_0x148dc4['WhatsappInteractionId']}});}return null;})[_0xb510('0x1f')](handleEntityNotFound(_0x297825,null))[_0xb510('0x1f')](function(_0x36749e){if(_0x36749e){_0x312c65[_0xb510('0x63')]=_0x36749e[_0xb510('0x5d')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c5ec0['user']['id'],_0x2c5ec0['user'][_0xb510('0x32')],_0x2c5ec0[_0xb510('0x5b')][_0xb510('0x7c')],_0x312c65[_0xb510('0x63')]['id'],_0x2c5ec0[_0xb510('0x52')]?JSON[_0xb510('0x65')](_0x2c5ec0['body']):'null');return respondWithRpcPromise('RejectMessage',_0xb510('0x7d'),_0x312c65);}return null;})[_0xb510('0x1f')](function(_0x2cfa89){var _0x3b1b52=_0xb510('0x69')+_0x2cfa89[_0xb510('0x24')][_0xb510('0x7e')];return db[_0xb510('0x6a')][_0xb510('0x39')](_0x3b1b52,{'type':db[_0xb510('0x6b')][_0xb510('0x6c')][_0xb510('0x6d')],'raw':!![]})[_0xb510('0x1f')](function(_0x21f4a8){return _0x21f4a8;});})[_0xb510('0x1f')](function(_0x277cb3){if(_0x277cb3){_0x312c65[_0xb510('0x24')]['contact']=_0x277cb3[0x0];if(!_0x2c5ec0[_0xb510('0x52')][_0xb510('0x5a')])return;return db[_0xb510('0x6f')][_0xb510('0x50')]({'where':{'id':_0x2c5ec0[_0xb510('0x52')]['UserId'],'role':_0xb510('0x5c')},'attributes':['id',_0xb510('0x32'),_0xb510('0x70'),'email','internal'],'raw':!![]});}return null;})[_0xb510('0x1f')](function(_0x3a18bf){if(!_0x3a18bf)return null;_0x312c65[_0xb510('0x24')][_0xb510('0x5c')]=_0x3a18bf;return _0x312c65;})['then'](function(_0x161026){if(_0x161026){_0x161026[_0xb510('0x24')][_0xb510('0x74')]=util[_0xb510('0x58')](_0xb510('0x75'),_0x2c5ec0[_0xb510('0x5b')][_0xb510('0x32')]);_0x161026['message']['channel']=_0x312c65[_0xb510('0x76')];_0x161026['message'][_0xb510('0x77')]=_0x312c65['channel'];_0x161026['message'][_0xb510('0x78')]=_0xb510('0x7f');respondWithRpcPromise('EventManager','EventManager',{'event':_0xb510('0x80'),'message':_0x161026[_0xb510('0x24')]},client9002);return _0x312c65;}return null;})[_0xb510('0x1f')](respondWithResult(_0x297825,null))[_0xb510('0x26')](handleError(_0x297825,null));};exports[_0xb510('0x28')]=function(_0x45ffb5,_0xf09dfd,_0x266d17){if(_0x45ffb5['body']['id']){delete _0x45ffb5[_0xb510('0x52')]['id'];}var _0x1b165e;return db[_0xb510('0x48')][_0xb510('0x50')]({'where':{'id':_0x45ffb5[_0xb510('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf09dfd,null))[_0xb510('0x1f')](function(_0x1f92e3){if(_0x1f92e3){_0x1b165e=_0x1f92e3;return db[_0xb510('0x81')][_0xb510('0x50')]({'where':{'id':_0x1f92e3['WhatsappAccountId']}});}})[_0xb510('0x1f')](handleEntityNotFound(_0xf09dfd,null))[_0xb510('0x1f')](function(_0x32fc95){if(_0x32fc95){logger[_0xb510('0x21')](_0xb510('0x82'),_0xb510('0x28'),_0xb510('0x83'),_0x32fc95[_0xb510('0x36')],util['inspect'](_0x45ffb5[_0xb510('0x52')],{'showHidden':![],'depth':null}));switch(_0x32fc95['type']){case'twilio':if(_0x45ffb5['body'][_0xb510('0x84')]&&_0x45ffb5['body'][_0xb510('0x84')]===_0x1b165e['messageId']&&_0x45ffb5[_0xb510('0x52')][_0xb510('0x85')]&&_0x45ffb5[_0xb510('0x52')][_0xb510('0x85')]==='read'){return _0x1b165e[_0xb510('0x60')]({'read':!![]});}else{logger[_0xb510('0x22')](_0xb510('0x86'),_0xb510('0x28'),_0xb510('0x87'),util[_0xb510('0x88')](_0x45ffb5['body'],{'showHidden':![],'depth':null}));}break;}return _0x1b165e;}})[_0xb510('0x1f')](respondWithResult(_0xf09dfd,null))['catch'](handleError(_0xf09dfd,null));}; \ No newline at end of file +var _0xddef=['read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','QueryTypes','contact','User','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','WhatsappMessage','includeAll','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId'];(function(_0x2ba872,_0x152e5a){var _0x4ffcfa=function(_0x6923b9){while(--_0x6923b9){_0x2ba872['push'](_0x2ba872['shift']());}};_0x4ffcfa(++_0x152e5a);}(_0xddef,0x126));var _0xfdde=function(_0x3d2f0c,_0x4e9fa3){_0x3d2f0c=_0x3d2f0c-0x0;var _0x5f7f3=_0xddef[_0x3d2f0c];return _0x5f7f3;};'use strict';var emlformat=require(_0xfdde('0x0'));var rimraf=require(_0xfdde('0x1'));var zipdir=require(_0xfdde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdde('0x3'));var moment=require(_0xfdde('0x4'));var BPromise=require(_0xfdde('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfdde('0x6'));var csv=require(_0xfdde('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdde('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfdde('0x7'));var querystring=require(_0xfdde('0x9'));var Papa=require('papaparse');var Redis=require(_0xfdde('0xa'));var authService=require(_0xfdde('0xb'));var qs=require(_0xfdde('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdde('0xd'));var logger=require(_0xfdde('0xe'))(_0xfdde('0xf'));var utils=require(_0xfdde('0x10'));var config=require(_0xfdde('0x11'));var licenseUtil=require(_0xfdde('0x12'));var db=require(_0xfdde('0x13'))['db'];config[_0xfdde('0x14')]=_[_0xfdde('0x15')](config[_0xfdde('0x14')],{'host':_0xfdde('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdde('0x14')]));require(_0xfdde('0x17'))[_0xfdde('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfdde('0x19')][_0xfdde('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ac567,_0x3e8e9e,_0x483207,_0x5bf62e){return new BPromise(function(_0xe0b1d0,_0x4fb82b){var _0x344992=_0x5bf62e||client;return _0x344992[_0xfdde('0x1b')](_0x1ac567,_0x483207)[_0xfdde('0x1c')](function(_0xed4a87){logger[_0xfdde('0x1d')](_0xfdde('0x1e'),_0x3e8e9e,_0xfdde('0x1f'));logger[_0xfdde('0x20')](_0xfdde('0x21'),_0x3e8e9e,_0xfdde('0x1f'),JSON[_0xfdde('0x22')](_0xed4a87));if(_0xed4a87['error']){if(_0xed4a87[_0xfdde('0x23')][_0xfdde('0x24')]===0x1f4){logger[_0xfdde('0x23')](_0xfdde('0x1e'),_0x3e8e9e,_0xed4a87['error']['message']);return _0x4fb82b(_0xed4a87[_0xfdde('0x23')]['message']);}logger[_0xfdde('0x23')](_0xfdde('0x1e'),_0x3e8e9e,_0xed4a87[_0xfdde('0x23')][_0xfdde('0x25')]);return _0xe0b1d0(_0xed4a87['error'][_0xfdde('0x25')]);}else{logger[_0xfdde('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x3e8e9e,_0xfdde('0x1f'));_0xe0b1d0(_0xed4a87[_0xfdde('0x26')][_0xfdde('0x25')]);}})[_0xfdde('0x27')](function(_0x518d35){logger['error'](_0xfdde('0x1e'),_0x3e8e9e,_0x518d35);_0x4fb82b(_0x518d35);});});}function respondWithStatusCode(_0x530ede,_0x11be73){_0x11be73=_0x11be73||0xcc;return function(_0x31d352){if(_0x31d352){return _0x530ede[_0xfdde('0x28')](_0x11be73);}return _0x530ede[_0xfdde('0x29')](_0x11be73)['end']();};}function respondWithResult(_0x5e68f2,_0x2f0bb4){_0x2f0bb4=_0x2f0bb4||0xc8;return function(_0x157c15){if(_0x157c15){return _0x5e68f2[_0xfdde('0x29')](_0x2f0bb4)[_0xfdde('0x2a')](_0x157c15);}};}function respondWithFilteredResult(_0x1b81ec,_0x237125){return function(_0x2f285f){if(_0x2f285f){var _0x105798=typeof _0x237125[_0xfdde('0x2b')]===_0xfdde('0x2c')&&typeof _0x237125[_0xfdde('0x2d')]==='undefined';var _0x25e4ac=_0x2f285f[_0xfdde('0x2e')];var _0x48f419=_0x105798?0x0:_0x237125[_0xfdde('0x2b')];var _0x145908=_0x105798?_0x2f285f['count']:_0x237125[_0xfdde('0x2b')]+_0x237125['limit'];var _0x4a95e2;if(_0x145908>=_0x25e4ac){_0x145908=_0x25e4ac;_0x4a95e2=0xc8;}else{_0x4a95e2=0xce;}_0x1b81ec[_0xfdde('0x29')](_0x4a95e2);return _0x1b81ec[_0xfdde('0x2f')](_0xfdde('0x30'),_0x48f419+'-'+_0x145908+'/'+_0x25e4ac)[_0xfdde('0x2a')](_0x2f285f);}return null;};}function patchUpdates(_0xdaa1d3){return function(_0x32c8a0){try{jsonpatch[_0xfdde('0x31')](_0x32c8a0,_0xdaa1d3,!![]);}catch(_0x8a216a){return BPromise['reject'](_0x8a216a);}return _0x32c8a0['save']();};}function saveUpdates(_0x576c77,_0x286678){return function(_0x1a69b1){if(_0x1a69b1){return _0x1a69b1[_0xfdde('0x32')](_0x576c77)[_0xfdde('0x1c')](function(_0x18a84d){return _0x18a84d;});}return null;};}function removeEntity(_0x1da19a,_0x263107){return function(_0x2aeabc){if(_0x2aeabc){return _0x2aeabc[_0xfdde('0x33')]()[_0xfdde('0x1c')](function(){_0x1da19a[_0xfdde('0x29')](0xcc)[_0xfdde('0x34')]();});}};}function handleEntityNotFound(_0x370681,_0x5268b2){return function(_0x3781e3){if(!_0x3781e3){_0x370681[_0xfdde('0x28')](0x194);}return _0x3781e3;};}function handleError(_0x4a59a7,_0x5258e1){_0x5258e1=_0x5258e1||0x1f4;return function(_0x491bfd){logger[_0xfdde('0x23')](_0x491bfd[_0xfdde('0x35')]);if(_0x491bfd[_0xfdde('0x36')]){delete _0x491bfd[_0xfdde('0x36')];}_0x4a59a7[_0xfdde('0x29')](_0x5258e1)['send'](_0x491bfd);};}exports[_0xfdde('0x37')]=function(_0x4350bc,_0x1313f8){var _0x2a1d42={},_0x31f595={},_0x83f415={'count':0x0,'rows':[]};var _0x2e7f96=_[_0xfdde('0x38')](db['WhatsappMessage'][_0xfdde('0x39')],function(_0x5095e5){return{'name':_0x5095e5[_0xfdde('0x3a')],'type':_0x5095e5['type']['key']};});_0x31f595['model']=_['map'](_0x2e7f96,_0xfdde('0x36'));_0x31f595['query']=_[_0xfdde('0x3b')](_0x4350bc['query']);_0x31f595['filters']=_[_0xfdde('0x3c')](_0x31f595[_0xfdde('0x3d')],_0x31f595[_0xfdde('0x3e')]);_0x2a1d42[_0xfdde('0x3f')]=_[_0xfdde('0x3c')](_0x31f595[_0xfdde('0x3d')],qs[_0xfdde('0x40')](_0x4350bc[_0xfdde('0x3e')][_0xfdde('0x40')]));_0x2a1d42['attributes']=_0x2a1d42[_0xfdde('0x3f')][_0xfdde('0x41')]?_0x2a1d42[_0xfdde('0x3f')]:_0x31f595[_0xfdde('0x3d')];if(!_0x4350bc['query'][_0xfdde('0x42')](_0xfdde('0x43'))){_0x2a1d42[_0xfdde('0x2d')]=qs[_0xfdde('0x2d')](_0x4350bc['query'][_0xfdde('0x2d')]);_0x2a1d42[_0xfdde('0x2b')]=qs[_0xfdde('0x2b')](_0x4350bc[_0xfdde('0x3e')]['offset']);}_0x2a1d42[_0xfdde('0x44')]=qs[_0xfdde('0x45')](_0x4350bc[_0xfdde('0x3e')]['sort']);_0x2a1d42[_0xfdde('0x46')]=qs[_0xfdde('0x47')](_[_0xfdde('0x48')](_0x4350bc[_0xfdde('0x3e')],_0x31f595[_0xfdde('0x47')]),_0x2e7f96);if(_0x4350bc[_0xfdde('0x3e')][_0xfdde('0x49')]){_0x2a1d42['where']=_[_0xfdde('0x4a')](_0x2a1d42[_0xfdde('0x46')],{'$or':_['map'](_0x2e7f96,function(_0x473afc){if(_0x473afc[_0xfdde('0x4b')]!=='VIRTUAL'){var _0x9abbdd={};_0x9abbdd[_0x473afc[_0xfdde('0x36')]]={'$like':'%'+_0x4350bc[_0xfdde('0x3e')][_0xfdde('0x49')]+'%'};return _0x9abbdd;}})});}_0x2a1d42=_['merge']({},_0x2a1d42,_0x4350bc[_0xfdde('0x4c')]);var _0x527204={'where':_0x2a1d42[_0xfdde('0x46')]};return db[_0xfdde('0x4d')]['count'](_0x527204)['then'](function(_0x389cf0){_0x83f415[_0xfdde('0x2e')]=_0x389cf0;if(_0x4350bc[_0xfdde('0x3e')][_0xfdde('0x4e')]){_0x2a1d42['include']=[{'all':!![]}];}return db[_0xfdde('0x4d')]['findAll'](_0x2a1d42);})['then'](function(_0x3cb33a){_0x83f415['rows']=_0x3cb33a;return _0x83f415;})[_0xfdde('0x1c')](respondWithFilteredResult(_0x1313f8,_0x2a1d42))[_0xfdde('0x27')](handleError(_0x1313f8,null));};exports[_0xfdde('0x4f')]=function(_0x373c42,_0x15484c){var _0x42250f={'raw':!![],'where':{'id':_0x373c42[_0xfdde('0x50')]['id']}},_0x3453cf={};_0x3453cf[_0xfdde('0x3d')]=_[_0xfdde('0x3b')](db[_0xfdde('0x4d')][_0xfdde('0x39')]);_0x3453cf[_0xfdde('0x3e')]=_[_0xfdde('0x3b')](_0x373c42[_0xfdde('0x3e')]);_0x3453cf['filters']=_[_0xfdde('0x3c')](_0x3453cf['model'],_0x3453cf[_0xfdde('0x3e')]);_0x42250f[_0xfdde('0x3f')]=_[_0xfdde('0x3c')](_0x3453cf['model'],qs['fields'](_0x373c42[_0xfdde('0x3e')][_0xfdde('0x40')]));_0x42250f[_0xfdde('0x3f')]=_0x42250f[_0xfdde('0x3f')][_0xfdde('0x41')]?_0x42250f['attributes']:_0x3453cf[_0xfdde('0x3d')];if(_0x373c42[_0xfdde('0x3e')][_0xfdde('0x4e')]){_0x42250f['include']=[{'all':!![]}];}_0x42250f=_[_0xfdde('0x4a')]({},_0x42250f,_0x373c42[_0xfdde('0x4c')]);return db['WhatsappMessage'][_0xfdde('0x51')](_0x42250f)[_0xfdde('0x1c')](handleEntityNotFound(_0x15484c,null))[_0xfdde('0x1c')](respondWithResult(_0x15484c,null))['catch'](handleError(_0x15484c,null));};exports[_0xfdde('0x52')]=function(_0x1ba5d9,_0x206f97){return db[_0xfdde('0x4d')][_0xfdde('0x52')](_0x1ba5d9[_0xfdde('0x53')],{})[_0xfdde('0x1c')](respondWithResult(_0x206f97,0xc9))[_0xfdde('0x27')](handleError(_0x206f97,null));};exports[_0xfdde('0x32')]=function(_0x307dab,_0x1d5919){if(_0x307dab[_0xfdde('0x53')]['id']){delete _0x307dab[_0xfdde('0x53')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x307dab[_0xfdde('0x50')]['id']}})[_0xfdde('0x1c')](handleEntityNotFound(_0x1d5919,null))[_0xfdde('0x1c')](saveUpdates(_0x307dab[_0xfdde('0x53')],null))[_0xfdde('0x1c')](respondWithResult(_0x1d5919,null))[_0xfdde('0x27')](handleError(_0x1d5919,null));};exports[_0xfdde('0x33')]=function(_0x5684a0,_0xf15aff){return db[_0xfdde('0x4d')][_0xfdde('0x51')]({'where':{'id':_0x5684a0[_0xfdde('0x50')]['id']}})['then'](handleEntityNotFound(_0xf15aff,null))[_0xfdde('0x1c')](removeEntity(_0xf15aff,null))[_0xfdde('0x27')](handleError(_0xf15aff,null));};exports[_0xfdde('0x54')]=function(_0x8b7357,_0xc44ad0){return db['WhatsappMessage'][_0xfdde('0x54')]()['then'](respondWithResult(_0xc44ad0,null))[_0xfdde('0x27')](handleError(_0xc44ad0,null));};var interaction_log=require(_0xfdde('0xe'))(_0xfdde('0x55'));exports[_0xfdde('0x56')]=function(_0x2b259d,_0xa5a8e7,_0x50ad8e){var _0x599881={'agent':{},'channel':_0xfdde('0x57')};if(_0x2b259d[_0xfdde('0x53')]['id']){delete _0x2b259d[_0xfdde('0x53')]['id'];}_0x2b259d[_0xfdde('0x53')][_0xfdde('0x58')]=!![];_0x2b259d[_0xfdde('0x53')]['readAt']=moment()[_0xfdde('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b259d[_0xfdde('0x53')][_0xfdde('0x5a')]=_0x2b259d['body'][_0xfdde('0x5a')]||_0x2b259d[_0xfdde('0x5b')]['id'];_0x599881[_0xfdde('0x5c')]['id']=_0x2b259d[_0xfdde('0x53')][_0xfdde('0x5a')];return db['WhatsappMessage'][_0xfdde('0x51')]({'where':{'id':_0x2b259d['params']['id'],'UserId':null}})[_0xfdde('0x1c')](handleEntityNotFound(_0xa5a8e7,null))['then'](saveUpdates(_0x2b259d[_0xfdde('0x53')],null))['then'](function(_0x460e0a){if(_0x460e0a){_0x599881[_0xfdde('0x25')]=_0x460e0a[_0xfdde('0x5d')]({'plain':!![]});return db[_0xfdde('0x5e')][_0xfdde('0x51')]({'where':{'id':_0x460e0a[_0xfdde('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0xa5a8e7,null))[_0xfdde('0x1c')](function(_0xa2e722){if(_0xa2e722){return _0xa2e722[_0xfdde('0x32')]({'UserId':_0x2b259d[_0xfdde('0x53')]['UserId'],'read1stAt':_['isNil'](_0xa2e722[_0xfdde('0x60')])?moment()[_0xfdde('0x59')](_0xfdde('0x61')):undefined});}return null;})[_0xfdde('0x1c')](function(_0x2f67e1){if(_0x2f67e1){_0x599881['interaction']=_0x2f67e1['get']({'plain':!![]});interaction_log[_0xfdde('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b259d[_0xfdde('0x5b')]['id'],_0x2b259d['user'][_0xfdde('0x36')],_0x2b259d[_0xfdde('0x5b')][_0xfdde('0x62')],_0x599881['interaction']['id'],_0x2b259d[_0xfdde('0x53')]?JSON[_0xfdde('0x22')](_0x2b259d[_0xfdde('0x53')]):'null');return respondWithRpcPromise(_0xfdde('0x63'),_0xfdde('0x64'),_0x599881);}return null;})[_0xfdde('0x1c')](function(_0x1dc630){var _0x1aae1d=_0xfdde('0x65')+_0x1dc630[_0xfdde('0x25')][_0xfdde('0x66')];return db['sequelize'][_0xfdde('0x3e')](_0x1aae1d,{'type':db[_0xfdde('0x67')]['QueryTypes'][_0xfdde('0x68')],'raw':!![]})[_0xfdde('0x1c')](function(_0x22e29f){return _0x22e29f;});})[_0xfdde('0x1c')](function(_0x3528d6){if(_0x3528d6){_0x599881['message']['contact']=_0x3528d6[0x0];if(!_0x2b259d[_0xfdde('0x53')][_0xfdde('0x5a')])return;return db['User']['find']({'where':{'id':_0x2b259d[_0xfdde('0x53')]['UserId'],'role':_0xfdde('0x5c')},'attributes':['id','name',_0xfdde('0x69'),_0xfdde('0x6a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x363c4d){if(!_0x363c4d)return null;_0x599881[_0xfdde('0x25')][_0xfdde('0x5c')]=_0x363c4d;return _0x599881;})[_0xfdde('0x1c')](function(_0x363f07){if(_0x363f07){if(_0x2b259d[_0xfdde('0x53')]['manual']){_0x599881[_0xfdde('0x25')][_0xfdde('0x6b')]=util[_0xfdde('0x59')](_0xfdde('0x6c'),_0x2b259d[_0xfdde('0x5b')][_0xfdde('0x36')]);_0x599881[_0xfdde('0x25')][_0xfdde('0x6d')]=_0x599881[_0xfdde('0x6d')];_0x599881[_0xfdde('0x25')][_0xfdde('0x6e')]=_0x599881['channel'];_0x599881[_0xfdde('0x25')][_0xfdde('0x6f')]=_0xfdde('0x56');return respondWithRpcPromise(_0xfdde('0x70'),_0xfdde('0x70'),{'event':'acceptmessage','message':_0x599881[_0xfdde('0x25')]},client9002)['then'](function(){return _0x599881;});}return _0x599881;}return null;})[_0xfdde('0x1c')](respondWithResult(_0xa5a8e7,null))[_0xfdde('0x27')](handleError(_0xa5a8e7,null));};var interaction_log=require(_0xfdde('0xe'))(_0xfdde('0x55'));exports[_0xfdde('0x71')]=function(_0x129776,_0x130709,_0x2a72a9){var _0x1f717b={'agent':{},'channel':_0xfdde('0x57')};if(_0x129776['body']['id']){delete _0x129776[_0xfdde('0x53')]['id'];}_0x129776[_0xfdde('0x53')]['UserId']=_0x129776[_0xfdde('0x53')][_0xfdde('0x5a')]||_0x129776[_0xfdde('0x5b')]['id'];_0x1f717b['agent']['id']=_0x129776[_0xfdde('0x53')]['UserId'];return db[_0xfdde('0x4d')][_0xfdde('0x51')]({'where':{'id':_0x129776[_0xfdde('0x50')]['id'],'UserId':null}})[_0xfdde('0x1c')](handleEntityNotFound(_0x130709,null))[_0xfdde('0x1c')](function(_0x4e6d6d){if(_0x4e6d6d){_0x1f717b['message']=_0x4e6d6d[_0xfdde('0x5d')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4e6d6d['WhatsappInteractionId']}});}return null;})[_0xfdde('0x1c')](handleEntityNotFound(_0x130709,null))[_0xfdde('0x1c')](function(_0x20cd42){if(_0x20cd42){_0x1f717b[_0xfdde('0x72')]=_0x20cd42[_0xfdde('0x5d')]({'plain':!![]});interaction_log[_0xfdde('0x1d')](_0xfdde('0x73'),_0x129776[_0xfdde('0x5b')]['id'],_0x129776[_0xfdde('0x5b')]['name'],_0x129776[_0xfdde('0x5b')]['role'],_0x1f717b[_0xfdde('0x72')]['id'],_0x129776['body']?JSON[_0xfdde('0x22')](_0x129776[_0xfdde('0x53')]):_0xfdde('0x74'));return respondWithRpcPromise(_0xfdde('0x75'),_0xfdde('0x76'),_0x1f717b);}return null;})[_0xfdde('0x1c')](function(_0x3e3218){var _0x15c0bc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e3218['message'][_0xfdde('0x66')];return db[_0xfdde('0x77')][_0xfdde('0x3e')](_0x15c0bc,{'type':db['Sequelize'][_0xfdde('0x78')][_0xfdde('0x68')],'raw':!![]})[_0xfdde('0x1c')](function(_0x1d47f1){return _0x1d47f1;});})[_0xfdde('0x1c')](function(_0x56a8ad){if(_0x56a8ad){_0x1f717b[_0xfdde('0x25')][_0xfdde('0x79')]=_0x56a8ad[0x0];if(!_0x129776['body']['UserId'])return;return db[_0xfdde('0x7a')][_0xfdde('0x51')]({'where':{'id':_0x129776[_0xfdde('0x53')][_0xfdde('0x5a')],'role':'agent'},'attributes':['id',_0xfdde('0x36'),_0xfdde('0x69'),_0xfdde('0x6a'),'internal'],'raw':!![]});}return null;})[_0xfdde('0x1c')](function(_0x3426b7){if(!_0x3426b7)return null;_0x1f717b['message'][_0xfdde('0x5c')]=_0x3426b7;return _0x1f717b;})[_0xfdde('0x1c')](function(_0x4b4a8d){if(_0x4b4a8d){_0x4b4a8d[_0xfdde('0x25')][_0xfdde('0x6b')]=util[_0xfdde('0x59')]('SIP/%s',_0x129776['user'][_0xfdde('0x36')]);_0x4b4a8d['message']['channel']=_0x1f717b[_0xfdde('0x6d')];_0x4b4a8d['message'][_0xfdde('0x6e')]=_0x1f717b[_0xfdde('0x6d')];_0x4b4a8d[_0xfdde('0x25')][_0xfdde('0x6f')]='reject';respondWithRpcPromise(_0xfdde('0x70'),_0xfdde('0x70'),{'event':_0xfdde('0x7b'),'message':_0x4b4a8d[_0xfdde('0x25')]},client9002);return _0x1f717b;}return null;})['then'](respondWithResult(_0x130709,null))[_0xfdde('0x27')](handleError(_0x130709,null));};exports['status']=function(_0x31de14,_0x63c5f5,_0x2d99dd){if(_0x31de14[_0xfdde('0x53')]['id']){delete _0x31de14[_0xfdde('0x53')]['id'];}var _0x4c97f3;return db[_0xfdde('0x4d')]['find']({'where':{'id':_0x31de14['params']['id']}})[_0xfdde('0x1c')](handleEntityNotFound(_0x63c5f5,null))[_0xfdde('0x1c')](function(_0x58b593){if(_0x58b593){_0x4c97f3=_0x58b593;return db['WhatsappAccount']['find']({'where':{'id':_0x58b593[_0xfdde('0x7c')]}});}})[_0xfdde('0x1c')](handleEntityNotFound(_0x63c5f5,null))[_0xfdde('0x1c')](function(_0x421534){if(_0x421534){logger[_0xfdde('0x20')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xfdde('0x29'),_0xfdde('0x7d'),_0x421534['type'],util['inspect'](_0x31de14[_0xfdde('0x53')],{'showHidden':![],'depth':null}));switch(_0x421534[_0xfdde('0x4b')]){case _0xfdde('0x7e'):if(_0x31de14[_0xfdde('0x53')][_0xfdde('0x7f')]&&_0x31de14['body']['MessageSid']===_0x4c97f3['messageId']&&_0x31de14[_0xfdde('0x53')]['MessageStatus']&&_0x31de14['body'][_0xfdde('0x80')]===_0xfdde('0x58')){return _0x4c97f3[_0xfdde('0x32')]({'read':!![]});}else{logger[_0xfdde('0x23')](_0xfdde('0x81'),_0xfdde('0x29'),_0xfdde('0x7e'),util['inspect'](_0x31de14[_0xfdde('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x4c97f3;}})[_0xfdde('0x1c')](respondWithResult(_0x63c5f5,null))[_0xfdde('0x27')](handleError(_0x63c5f5,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 45dfce0..46fb0ca 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1152=['remove','emit','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x34f4d1,_0x28f1be){var _0x28351b=function(_0xac85d5){while(--_0xac85d5){_0x34f4d1['push'](_0x34f4d1['shift']());}};_0x28351b(++_0x28f1be);}(_0x1152,0x182));var _0x2115=function(_0x2df3c1,_0x35b259){_0x2df3c1=_0x2df3c1-0x0;var _0xbfaae3=_0x1152[_0x2df3c1];return _0xbfaae3;};'use strict';var EventEmitter=require(_0x2115('0x0'));var WhatsappMessage=require(_0x2115('0x1'))['db'][_0x2115('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2115('0x3')](0x0);var events={'afterCreate':_0x2115('0x4'),'afterUpdate':_0x2115('0x5'),'afterDestroy':_0x2115('0x6')};function emitEvent(_0x3b8dfa){return function(_0x4d0f31,_0x1e8a26,_0x5c17b3){WhatsappMessageEvents[_0x2115('0x7')](_0x3b8dfa+':'+_0x4d0f31['id'],_0x4d0f31);WhatsappMessageEvents[_0x2115('0x7')](_0x3b8dfa,_0x4d0f31);_0x5c17b3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x39cb=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','save'];(function(_0x24e19c,_0x1eec14){var _0x188fac=function(_0xeac31d){while(--_0xeac31d){_0x24e19c['push'](_0x24e19c['shift']());}};_0x188fac(++_0x1eec14);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xb39c('0x0'))['db'][_0xb39c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb39c('0x2'),'afterUpdate':_0xb39c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x412f1c){return function(_0x285eca,_0x398d07,_0x2bca14){WhatsappMessageEvents[_0xb39c('0x4')](_0x412f1c+':'+_0x285eca['id'],_0x285eca);WhatsappMessageEvents['emit'](_0x412f1c,_0x285eca);_0x2bca14(null);};}for(var e in events){if(events[_0xb39c('0x5')](e)){var event=events[e];WhatsappMessage[_0xb39c('0x6')](e,emitEvent(event));}}module[_0xb39c('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index d2f8e19..8618669 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a50=['WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','request-promise','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','WhatsappInteractionId','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','error'];(function(_0x4669cf,_0x4e47dd){var _0x5e9c4a=function(_0xa05c7){while(--_0xa05c7){_0x4669cf['push'](_0x4669cf['shift']());}};_0x5e9c4a(++_0x4e47dd);}(_0x7a50,0xbf));var _0x07a5=function(_0x4d905c,_0x8d3181){_0x4d905c=_0x4d905c-0x0;var _0x16f577=_0x7a50[_0x4d905c];return _0x16f577;};'use strict';var _=require(_0x07a5('0x0'));var util=require(_0x07a5('0x1'));var logger=require(_0x07a5('0x2'))('api');var moment=require(_0x07a5('0x3'));var BPromise=require('bluebird');var rp=require(_0x07a5('0x4'));var fetch=require(_0x07a5('0x5'));var fs=require('fs');var path=require(_0x07a5('0x6'));var rimraf=require(_0x07a5('0x7'));var config=require(_0x07a5('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x07a5('0x9')]=function(_0x1b78ca,_0x4c72a1){return _0x1b78ca[_0x07a5('0xa')](_0x07a5('0xb'),attributes,{'tableName':_0x07a5('0xc'),'paranoid':![],'indexes':[{'name':_0x07a5('0xd'),'fields':[_0x07a5('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0x07a5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40f2f3,_0x1e4b4f,_0x2c0998){var _0x5be67a=_0x1b78ca['models'];var _0x3c4bc7=_0x40f2f3[_0x07a5('0xf')]({'plain':!![]});if(_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()==='in'||_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()===_0x07a5('0x12')&&!_0x3c4bc7[_0x07a5('0x13')]&&!_['isNil'](_0x3c4bc7[_0x07a5('0x14')])){_0x5be67a[_0x07a5('0x15')]['findOne']({'where':{'id':_0x3c4bc7[_0x07a5('0x16')]}})['then'](function(_0x546d00){if(_0x546d00){_0x546d00['update']({'lastMsgAt':_0x3c4bc7[_0x07a5('0x17')],'lastMsgDirection':_0x3c4bc7[_0x07a5('0x10')][_0x07a5('0x11')]()});}})[_0x07a5('0x18')](function(_0x5b8a88){console['error'](_0x5b8a88);});}if(_0x3c4bc7['direction']===_0x07a5('0x12')&&!_0x3c4bc7[_0x07a5('0x13')]){var _0x5392ff;_0x5be67a[_0x07a5('0x19')][_0x07a5('0x1a')]({'where':{'id':_0x3c4bc7[_0x07a5('0x1b')]},'raw':!![]})[_0x07a5('0x1c')](function(_0x341580){_0x5392ff=_0x341580;if(_0x5392ff&&_0x5392ff['type']){switch(_0x5392ff[_0x07a5('0x1d')]){case _0x07a5('0x1e'):var _0x40daab=require(_0x07a5('0x1e'));if(_0x5392ff[_0x07a5('0x1f')]&&_0x5392ff['authToken']&&_0x5392ff[_0x07a5('0x20')]){var _0x16bff4=new _0x40daab(_0x5392ff['accountSid'],_0x5392ff[_0x07a5('0x21')]);_0x16bff4[_0x07a5('0x22')][_0x07a5('0x23')]({'body':_0x3c4bc7[_0x07a5('0x24')],'to':_0x07a5('0x25')+_0x3c4bc7[_0x07a5('0x20')],'from':'whatsapp:'+_0x5392ff['phone'],'statusCallback':_0x5392ff[_0x07a5('0x26')]+_0x07a5('0x27')+_0x3c4bc7['id']+_0x07a5('0x28')+_0x5392ff[_0x07a5('0x29')]})[_0x07a5('0x1c')](function(_0x1d7c7f){if(_0x1d7c7f[_0x07a5('0x2a')]){return _0x40f2f3[_0x07a5('0x2b')]({'messageId':_0x1d7c7f[_0x07a5('0x2a')]});}})['catch'](function(_0x153f71){logger[_0x07a5('0x2c')](_0x07a5('0x2d'),'afterCreate',_0x07a5('0x1e'),util[_0x07a5('0x2e')](_0x153f71,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x07a5('0x2f'),'twilio',_0x07a5('0x30'));}break;case _0x07a5('0x31'):var _0x437e1c=_0x5392ff[_0x07a5('0x1f')];var _0x49aaeb=_0x5392ff[_0x07a5('0x21')];var _0x293ca0=_0x5392ff[_0x07a5('0x32')]+'/whatsapp/v1/'+_0x437e1c+'/messages/';var _0x634852={'to':[_0x3c4bc7[_0x07a5('0x20')]],'message':{'type':'text','text':_0x3c4bc7['body']}};var _0x531fa8={'method':_0x07a5('0x33'),'uri':_0x293ca0,'headers':{'Authorization':'Bearer\x20'+_0x49aaeb,'Content-Type':_0x07a5('0x34')},'body':_0x634852,'json':!![]};rp(_0x531fa8)[_0x07a5('0x1c')](function(_0x19e84c){if(_0x19e84c[_0x07a5('0x35')][0x0][_0x07a5('0x36')]){return _0x40f2f3[_0x07a5('0x2b')]({'messageId':_0x19e84c[_0x07a5('0x35')][0x0]['message_id']});}})['catch'](function(_0x24843a){logger[_0x07a5('0x37')](_0x07a5('0x38'),_0x24843a);});break;}}})[_0x07a5('0x39')](function(){_0x2c0998();});}else{_0x2c0998();}}},'charset':_0x07a5('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ce8=['rimraf','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','toLowerCase','direction','out','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','secret','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','create','body','whatsapp:','phone','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','update','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x8ce8,0xe8));var _0x88ce=function(_0x1ed60b,_0x38b1de){_0x1ed60b=_0x1ed60b-0x0;var _0x1c4b24=_0x8ce8[_0x1ed60b];return _0x1c4b24;};'use strict';var _=require(_0x88ce('0x0'));var util=require(_0x88ce('0x1'));var logger=require(_0x88ce('0x2'))(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var rp=require(_0x88ce('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x88ce('0x7'));var rimraf=require(_0x88ce('0x8'));var config=require(_0x88ce('0x9'));var attributes=require('./whatsappMessage.attributes');module[_0x88ce('0xa')]=function(_0x4b3856,_0x5b8217){return _0x4b3856['define'](_0x88ce('0xb'),attributes,{'tableName':_0x88ce('0xc'),'paranoid':![],'indexes':[{'name':_0x88ce('0xd'),'fields':['messageId']},{'name':_0x88ce('0xe'),'fields':['body'],'type':_0x88ce('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21589e,_0x59f476,_0x4e6055){var _0x55ddcf=_0x4b3856[_0x88ce('0x10')];var _0x4f0a66=_0x21589e[_0x88ce('0x11')]({'plain':!![]});if(_0x4f0a66['direction'][_0x88ce('0x12')]()==='in'||_0x4f0a66[_0x88ce('0x13')][_0x88ce('0x12')]()===_0x88ce('0x14')&&!_0x4f0a66['secret']&&!_['isNil'](_0x4f0a66[_0x88ce('0x15')])){_0x55ddcf[_0x88ce('0x16')][_0x88ce('0x17')]({'where':{'id':_0x4f0a66[_0x88ce('0x18')]}})[_0x88ce('0x19')](function(_0x2b67ef){if(_0x2b67ef){_0x2b67ef['update']({'lastMsgAt':_0x4f0a66[_0x88ce('0x1a')],'lastMsgDirection':_0x4f0a66[_0x88ce('0x13')][_0x88ce('0x12')]()});}})[_0x88ce('0x1b')](function(_0x4dcd22){console[_0x88ce('0x1c')](_0x4dcd22);});}if(_0x4f0a66[_0x88ce('0x13')]===_0x88ce('0x14')&&!_0x4f0a66[_0x88ce('0x1d')]){var _0x58d580;_0x55ddcf[_0x88ce('0x1e')]['find']({'where':{'id':_0x4f0a66[_0x88ce('0x1f')]},'raw':!![]})[_0x88ce('0x19')](function(_0x507324){_0x58d580=_0x507324;if(_0x58d580&&_0x58d580[_0x88ce('0x20')]){switch(_0x58d580[_0x88ce('0x20')]){case _0x88ce('0x21'):var _0x44db14=require(_0x88ce('0x21'));if(_0x58d580[_0x88ce('0x22')]&&_0x58d580[_0x88ce('0x23')]&&_0x58d580['phone']){var _0x5f5dc0=new _0x44db14(_0x58d580[_0x88ce('0x22')],_0x58d580['authToken']);_0x5f5dc0['messages'][_0x88ce('0x24')]({'body':_0x4f0a66[_0x88ce('0x25')],'to':'whatsapp:'+_0x4f0a66['phone'],'from':_0x88ce('0x26')+_0x58d580[_0x88ce('0x27')],'statusCallback':_0x58d580['remote']+'/api/whatsapp/messages/'+_0x4f0a66['id']+'/status?token='+_0x58d580[_0x88ce('0x28')]})['then'](function(_0x3139c3){if(_0x3139c3[_0x88ce('0x29')]){return _0x21589e['update']({'messageId':_0x3139c3[_0x88ce('0x29')]});}})[_0x88ce('0x1b')](function(_0x356746){logger[_0x88ce('0x1c')](_0x88ce('0x2a'),_0x88ce('0x2b'),'twilio',util['inspect'](_0x356746,{'showHidden':![],'depth':null}));});}else{logger[_0x88ce('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x88ce('0x2b'),_0x88ce('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x88ce('0x2c'):var _0x4f242e=_0x58d580[_0x88ce('0x22')];var _0x549f3f=_0x58d580[_0x88ce('0x23')];var _0x1624cb=_0x58d580[_0x88ce('0x2d')]+_0x88ce('0x2e')+_0x4f242e+_0x88ce('0x2f');var _0x1e48df={'to':[_0x4f0a66[_0x88ce('0x27')]],'message':{'type':_0x88ce('0x30'),'text':_0x4f0a66[_0x88ce('0x25')]}};var _0x27f64e={'method':_0x88ce('0x31'),'uri':_0x1624cb,'headers':{'Authorization':_0x88ce('0x32')+_0x549f3f,'Content-Type':_0x88ce('0x33')},'body':_0x1e48df,'json':!![]};rp(_0x27f64e)[_0x88ce('0x19')](function(_0xf8c06b){if(_0xf8c06b[_0x88ce('0x34')][0x0]['message_id']){return _0x21589e[_0x88ce('0x35')]({'messageId':_0xf8c06b[_0x88ce('0x34')][0x0][_0x88ce('0x36')]});}})['catch'](function(_0x4a6500){logger[_0x88ce('0x37')](_0x88ce('0x38'),_0x4a6500);});break;}}})[_0x88ce('0x39')](function(){_0x4e6055();});}else{_0x4e6055();}}},'charset':_0x88ce('0x3a'),'collate':_0x88ce('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a3fa684..e69a41b 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77e8=['result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','debug','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x77e8,0x1d7));var _0x877e=function(_0x3c9864,_0x488a3c){_0x3c9864=_0x3c9864-0x0;var _0x416dcd=_0x77e8[_0x3c9864];return _0x416dcd;};'use strict';var _=require('lodash');var util=require(_0x877e('0x0'));var moment=require(_0x877e('0x1'));var BPromise=require(_0x877e('0x2'));var rs=require(_0x877e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x877e('0x4'));var logger=require(_0x877e('0x5'))(_0x877e('0x6'));var config=require(_0x877e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x877e('0x8')]({'port':0x232a});config[_0x877e('0x9')]=_[_0x877e('0xa')](config['redis'],{'host':_0x877e('0xb'),'port':0x18eb});var socket=require(_0x877e('0xc'))(new Redis(config[_0x877e('0x9')]));require(_0x877e('0xd'))[_0x877e('0xe')](socket);function respondWithRpcPromise(_0x1b6e6d,_0x3ef37d,_0x33feb9){return new BPromise(function(_0x50ae62,_0x26a89a){return client[_0x877e('0xf')](_0x1b6e6d,_0x33feb9)[_0x877e('0x10')](function(_0x57714d){logger[_0x877e('0x11')](_0x877e('0x12'),_0x3ef37d,'request\x20sent');logger['debug'](_0x877e('0x13'),_0x3ef37d,'request\x20sent',JSON['stringify'](_0x57714d));if(_0x57714d[_0x877e('0x14')]){if(_0x57714d[_0x877e('0x14')][_0x877e('0x15')]===0x1f4){logger['error'](_0x877e('0x12'),_0x3ef37d,_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);return _0x26a89a(_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);}logger[_0x877e('0x14')](_0x877e('0x12'),_0x3ef37d,_0x57714d['error']['message']);return _0x50ae62(_0x57714d[_0x877e('0x14')][_0x877e('0x16')]);}else{logger['info'](_0x877e('0x12'),_0x3ef37d,_0x877e('0x17'));_0x50ae62(_0x57714d[_0x877e('0x18')][_0x877e('0x16')]);}})[_0x877e('0x19')](function(_0x173246){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3ef37d,_0x173246);_0x26a89a(_0x173246);});});}exports[_0x877e('0x1a')]=function(_0xaca327){var _0x55b4d6=this;return new Promise(function(_0x5e0d61,_0x1b1347){return db[_0x877e('0x1b')][_0x877e('0x1c')](_0xaca327[_0x877e('0x1d')],{'raw':_0xaca327[_0x877e('0x1e')]?_0xaca327['options']['raw']===undefined?!![]:![]:!![]})[_0x877e('0x10')](function(_0x30151f){logger[_0x877e('0x11')]('CreateWhatsappMessage',_0xaca327);logger[_0x877e('0x1f')]('CreateWhatsappMessage',_0xaca327,JSON[_0x877e('0x20')](_0x30151f));_0x5e0d61(_0x30151f);})[_0x877e('0x19')](function(_0x3ed77f){logger['error'](_0x877e('0x1a'),_0x3ed77f[_0x877e('0x16')],_0xaca327);_0x1b1347(_0x55b4d6[_0x877e('0x14')](0x1f4,_0x3ed77f[_0x877e('0x16')]));});});}; \ No newline at end of file +var _0xcf09=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf09,0x7b));var _0x9cf0=function(_0x6d6f2f,_0x1b3afd){_0x6d6f2f=_0x6d6f2f-0x0;var _0x3f1fab=_0xcf09[_0x6d6f2f];return _0x3f1fab;};'use strict';var _=require('lodash');var util=require(_0x9cf0('0x0'));var moment=require('moment');var BPromise=require(_0x9cf0('0x1'));var rs=require(_0x9cf0('0x2'));var fs=require('fs');var Redis=require(_0x9cf0('0x3'));var db=require(_0x9cf0('0x4'))['db'];var utils=require(_0x9cf0('0x5'));var logger=require(_0x9cf0('0x6'))(_0x9cf0('0x7'));var config=require(_0x9cf0('0x8'));var jayson=require(_0x9cf0('0x9'));var client=jayson[_0x9cf0('0xa')]['http']({'port':0x232a});config[_0x9cf0('0xb')]=_[_0x9cf0('0xc')](config['redis'],{'host':_0x9cf0('0xd'),'port':0x18eb});var socket=require(_0x9cf0('0xe'))(new Redis(config[_0x9cf0('0xb')]));require(_0x9cf0('0xf'))[_0x9cf0('0x10')](socket);function respondWithRpcPromise(_0x492d90,_0x4147d7,_0x4232d4){return new BPromise(function(_0x586232,_0x387e66){return client[_0x9cf0('0x11')](_0x492d90,_0x4232d4)[_0x9cf0('0x12')](function(_0x2a643a){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4147d7,_0x9cf0('0x13'));logger[_0x9cf0('0x14')](_0x9cf0('0x15'),_0x4147d7,_0x9cf0('0x13'),JSON[_0x9cf0('0x16')](_0x2a643a));if(_0x2a643a[_0x9cf0('0x17')]){if(_0x2a643a[_0x9cf0('0x17')][_0x9cf0('0x18')]===0x1f4){logger[_0x9cf0('0x17')](_0x9cf0('0x19'),_0x4147d7,_0x2a643a[_0x9cf0('0x17')][_0x9cf0('0x1a')]);return _0x387e66(_0x2a643a['error'][_0x9cf0('0x1a')]);}logger['error'](_0x9cf0('0x19'),_0x4147d7,_0x2a643a[_0x9cf0('0x17')][_0x9cf0('0x1a')]);return _0x586232(_0x2a643a['error'][_0x9cf0('0x1a')]);}else{logger[_0x9cf0('0x1b')](_0x9cf0('0x19'),_0x4147d7,_0x9cf0('0x13'));_0x586232(_0x2a643a[_0x9cf0('0x1c')][_0x9cf0('0x1a')]);}})[_0x9cf0('0x1d')](function(_0x3bceba){logger['error'](_0x9cf0('0x19'),_0x4147d7,_0x3bceba);_0x387e66(_0x3bceba);});});}exports[_0x9cf0('0x1e')]=function(_0x406282){var _0x22d8e6=this;return new Promise(function(_0x239493,_0x356ec8){return db[_0x9cf0('0x1f')][_0x9cf0('0x20')](_0x406282[_0x9cf0('0x21')],{'raw':_0x406282['options']?_0x406282[_0x9cf0('0x22')][_0x9cf0('0x23')]===undefined?!![]:![]:!![]})[_0x9cf0('0x12')](function(_0x223425){logger[_0x9cf0('0x1b')](_0x9cf0('0x1e'),_0x406282);logger['debug'](_0x9cf0('0x1e'),_0x406282,JSON['stringify'](_0x223425));_0x239493(_0x223425);})['catch'](function(_0x6b330b){logger['error']('CreateWhatsappMessage',_0x6b330b['message'],_0x406282);_0x356ec8(_0x22d8e6[_0x9cf0('0x17')](0x1f4,_0x6b330b[_0x9cf0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 1df4b37..dc98ff8 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb479=['emit','register','length','whatsappMessage:','save','remove','update'];(function(_0x1be4e9,_0x554e8f){var _0x4d110f=function(_0x1269bc){while(--_0x1269bc){_0x1be4e9['push'](_0x1be4e9['shift']());}};_0x4d110f(++_0x554e8f);}(_0xb479,0x1bd));var _0x9b47=function(_0x2fe260,_0x3d8f2a){_0x2fe260=_0x2fe260-0x0;var _0x4e66bc=_0xb479[_0x2fe260];return _0x4e66bc;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x9b47('0x0'),_0x9b47('0x1'),_0x9b47('0x2')];function createListener(_0x1c6bd4,_0x5cf357){return function(_0xebd628){_0x5cf357[_0x9b47('0x3')](_0x1c6bd4,_0xebd628);};}function removeListener(_0x2119e9,_0x7cca95){return function(){WhatsappMessageEvents['removeListener'](_0x2119e9,_0x7cca95);};}exports[_0x9b47('0x4')]=function(_0x433f69){for(var _0x4e37ac=0x0,_0xf7bc3d=events[_0x9b47('0x5')];_0x4e37ac<_0xf7bc3d;_0x4e37ac++){var _0x4dc6d5=events[_0x4e37ac];var _0x58f888=createListener(_0x9b47('0x6')+_0x4dc6d5,_0x433f69);WhatsappMessageEvents['on'](_0x4dc6d5,_0x58f888);}}; \ No newline at end of file +var _0xf382=['update','removeListener','register','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x5adbbe,_0x24872c){var _0x4ec913=function(_0x226f19){while(--_0x226f19){_0x5adbbe['push'](_0x5adbbe['shift']());}};_0x4ec913(++_0x24872c);}(_0xf382,0x17f));var _0x2f38=function(_0x325169,_0x1b3ee8){_0x325169=_0x325169-0x0;var _0x202a0b=_0xf382[_0x325169];return _0x202a0b;};'use strict';var WhatsappMessageEvents=require(_0x2f38('0x0'));var events=['save','remove',_0x2f38('0x1')];function createListener(_0x43c3d3,_0x1a1f77){return function(_0x17ff51){_0x1a1f77['emit'](_0x43c3d3,_0x17ff51);};}function removeListener(_0x599a74,_0x558758){return function(){WhatsappMessageEvents[_0x2f38('0x2')](_0x599a74,_0x558758);};}exports[_0x2f38('0x3')]=function(_0x5ab20d){for(var _0x3c4746=0x0,_0x136865=events[_0x2f38('0x4')];_0x3c4746<_0x136865;_0x3c4746++){var _0x27abd6=events[_0x3c4746];var _0x839b07=createListener(_0x2f38('0x5')+_0x27abd6,_0x5ab20d);WhatsappMessageEvents['on'](_0x27abd6,_0x839b07);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9d8dd99..530aba6 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd43b=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0xcc44e1,_0x520291){var _0x3e4469=function(_0x563d2c){while(--_0x563d2c){_0xcc44e1['push'](_0xcc44e1['shift']());}};_0x3e4469(++_0x520291);}(_0xd43b,0x1c7));var _0xbd43=function(_0x2086e3,_0x17a5b6){_0x2086e3=_0x2086e3-0x0;var _0x4b8b1f=_0xd43b[_0x2086e3];return _0x4b8b1f;};'use strict';var multer=require(_0xbd43('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd43('0x1'));var express=require('express');var router=express[_0xbd43('0x2')]();var fs_extra=require(_0xbd43('0x3'));var auth=require(_0xbd43('0x4'));var interaction=require(_0xbd43('0x5'));var config=require(_0xbd43('0x6'));var controller=require('./whatsappQueue.controller');router[_0xbd43('0x7')]('/',auth[_0xbd43('0x8')](),controller[_0xbd43('0x9')]);router['get'](_0xbd43('0xa'),auth[_0xbd43('0x8')](),controller[_0xbd43('0xb')]);router['get']('/:id',auth[_0xbd43('0x8')](),controller[_0xbd43('0xc')]);router[_0xbd43('0x7')](_0xbd43('0xd'),auth['isAuthenticated'](),controller[_0xbd43('0xe')]);router['get'](_0xbd43('0xf'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x10')]);router[_0xbd43('0x7')]('/:id/users',auth[_0xbd43('0x8')](),controller['getAgents']);router[_0xbd43('0x11')]('/',auth[_0xbd43('0x8')](),controller[_0xbd43('0x12')]);router['post'](_0xbd43('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xbd43('0x13'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x14')]);router[_0xbd43('0x15')](_0xbd43('0x16'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x17')]);router[_0xbd43('0x18')](_0xbd43('0x16'),auth[_0xbd43('0x8')](),controller[_0xbd43('0x19')]);router[_0xbd43('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbd43('0x1a')]);router['delete'](_0xbd43('0x13'),auth['isAuthenticated'](),controller[_0xbd43('0x1b')]);module[_0xbd43('0x1c')]=router; \ No newline at end of file +var _0xaeb7=['post','addTeams','addAgents','put','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaeb7,0xf0));var _0x7aeb=function(_0x5ae1cb,_0x154745){_0x5ae1cb=_0x5ae1cb-0x0;var _0x2df860=_0xaeb7[_0x5ae1cb];return _0x2df860;};'use strict';var multer=require(_0x7aeb('0x0'));var util=require(_0x7aeb('0x1'));var path=require('path');var timeout=require(_0x7aeb('0x2'));var express=require(_0x7aeb('0x3'));var router=express[_0x7aeb('0x4')]();var fs_extra=require(_0x7aeb('0x5'));var auth=require(_0x7aeb('0x6'));var interaction=require(_0x7aeb('0x7'));var config=require(_0x7aeb('0x8'));var controller=require('./whatsappQueue.controller');router[_0x7aeb('0x9')]('/',auth[_0x7aeb('0xa')](),controller[_0x7aeb('0xb')]);router[_0x7aeb('0x9')](_0x7aeb('0xc'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0xd')]);router[_0x7aeb('0x9')](_0x7aeb('0xe'),auth['isAuthenticated'](),controller[_0x7aeb('0xf')]);router[_0x7aeb('0x9')](_0x7aeb('0x10'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x11')]);router[_0x7aeb('0x9')](_0x7aeb('0x12'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x13')]);router['get'](_0x7aeb('0x14'),auth[_0x7aeb('0xa')](),controller['getAgents']);router[_0x7aeb('0x15')]('/',auth[_0x7aeb('0xa')](),controller['create']);router[_0x7aeb('0x15')](_0x7aeb('0x12'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x16')]);router['post'](_0x7aeb('0x14'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x17')]);router[_0x7aeb('0x18')](_0x7aeb('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x7aeb('0x19')](_0x7aeb('0xe'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x1a')]);router[_0x7aeb('0x19')](_0x7aeb('0x12'),auth[_0x7aeb('0xa')](),controller[_0x7aeb('0x1b')]);router[_0x7aeb('0x19')](_0x7aeb('0x14'),auth[_0x7aeb('0xa')](),controller['removeAgents']);module[_0x7aeb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0edbfaf..6fd4baa 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4bd=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x233716,_0x346676){var _0x302298=function(_0x53d84c){while(--_0x53d84c){_0x233716['push'](_0x233716['shift']());}};_0x302298(++_0x346676);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd4bd[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xdd4b('0x0'));module[_0xdd4b('0x1')]={'name':{'type':Sequelize[_0xdd4b('0x2')],'unique':_0xdd4b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdd4b('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdd4b('0x5'),_0xdd4b('0x6'),_0xdd4b('0x7'))},'description':{'type':Sequelize[_0xdd4b('0x2')]}}; \ No newline at end of file +var _0xb07f=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x321ae7,_0x1f2d6e){var _0x255413=function(_0x364cc3){while(--_0x364cc3){_0x321ae7['push'](_0x321ae7['shift']());}};_0x255413(++_0x1f2d6e);}(_0xb07f,0x109));var _0xfb07=function(_0x4bf760,_0x960da5){_0x4bf760=_0x4bf760-0x0;var _0x7395e9=_0xb07f[_0x4bf760];return _0x7395e9;};'use strict';var Sequelize=require(_0xfb07('0x0'));module[_0xfb07('0x1')]={'name':{'type':Sequelize[_0xfb07('0x2')],'unique':_0xfb07('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xfb07('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfb07('0x5')](_0xfb07('0x6'),_0xfb07('0x7'),_0xfb07('0x8'))},'description':{'type':Sequelize[_0xfb07('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 614331a..de69ca6 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa583=['tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','userWhatsappQueue:remove','addAgents','userWhatsappQueue:save','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','Team','select','field'];(function(_0x31e555,_0x859c76){var _0xd91def=function(_0x49eabb){while(--_0x49eabb){_0x31e555['push'](_0x31e555['shift']());}};_0xd91def(++_0x859c76);}(_0xa583,0x12c));var _0x3a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa583[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3a58('0x0'));var rimraf=require(_0x3a58('0x1'));var zipdir=require(_0x3a58('0x2'));var jsonpatch=require(_0x3a58('0x3'));var rp=require(_0x3a58('0x4'));var moment=require(_0x3a58('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a58('0x6'));var util=require(_0x3a58('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3a58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a58('0x9'));var _=require(_0x3a58('0xa'));var squel=require('squel');var crypto=require(_0x3a58('0xb'));var jsforce=require(_0x3a58('0xc'));var deskjs=require(_0x3a58('0xd'));var toCsv=require(_0x3a58('0x8'));var querystring=require(_0x3a58('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3a58('0xf'));var qs=require(_0x3a58('0x10'));var as=require(_0x3a58('0x11'));var hardwareService=require(_0x3a58('0x12'));var logger=require(_0x3a58('0x13'))(_0x3a58('0x14'));var utils=require(_0x3a58('0x15'));var config=require(_0x3a58('0x16'));var licenseUtil=require(_0x3a58('0x17'));var db=require(_0x3a58('0x18'))['db'];config[_0x3a58('0x19')]=_['defaults'](config[_0x3a58('0x19')],{'host':_0x3a58('0x1a'),'port':0x18eb});var socket=require(_0x3a58('0x1b'))(new Redis(config[_0x3a58('0x19')]));require(_0x3a58('0x1c'))[_0x3a58('0x1d')](socket);function respondWithStatusCode(_0x7c0d2,_0x2907f3){_0x2907f3=_0x2907f3||0xcc;return function(_0x16ef75){if(_0x16ef75){return _0x7c0d2[_0x3a58('0x1e')](_0x2907f3);}return _0x7c0d2['status'](_0x2907f3)[_0x3a58('0x1f')]();};}function respondWithResult(_0x5e8305,_0x46e0be){_0x46e0be=_0x46e0be||0xc8;return function(_0x4fc082){if(_0x4fc082){return _0x5e8305[_0x3a58('0x20')](_0x46e0be)[_0x3a58('0x21')](_0x4fc082);}};}function respondWithFilteredResult(_0x1f96b7,_0x8a377a){return function(_0x366210){if(_0x366210){var _0x51697c=typeof _0x8a377a['offset']===_0x3a58('0x22')&&typeof _0x8a377a[_0x3a58('0x23')]==='undefined';var _0x1258e6=_0x366210[_0x3a58('0x24')];var _0x2eac3d=_0x51697c?0x0:_0x8a377a[_0x3a58('0x25')];var _0x1a1ce4=_0x51697c?_0x366210[_0x3a58('0x24')]:_0x8a377a[_0x3a58('0x25')]+_0x8a377a[_0x3a58('0x23')];var _0x1bc429;if(_0x1a1ce4>=_0x1258e6){_0x1a1ce4=_0x1258e6;_0x1bc429=0xc8;}else{_0x1bc429=0xce;}_0x1f96b7['status'](_0x1bc429);return _0x1f96b7[_0x3a58('0x26')](_0x3a58('0x27'),_0x2eac3d+'-'+_0x1a1ce4+'/'+_0x1258e6)[_0x3a58('0x21')](_0x366210);}return null;};}function patchUpdates(_0x1305ef){return function(_0x373891){try{jsonpatch[_0x3a58('0x28')](_0x373891,_0x1305ef,!![]);}catch(_0x5e2718){return BPromise['reject'](_0x5e2718);}return _0x373891[_0x3a58('0x29')]();};}function saveUpdates(_0xf81894,_0x2324a3){return function(_0x1fda92){if(_0x1fda92){return _0x1fda92[_0x3a58('0x2a')](_0xf81894)[_0x3a58('0x2b')](function(_0x1af087){return _0x1af087;});}return null;};}function removeEntity(_0x557ec5,_0x16c940){return function(_0x262f05){if(_0x262f05){return _0x262f05[_0x3a58('0x2c')]()[_0x3a58('0x2b')](function(){var _0x26def9=_0x262f05[_0x3a58('0x2d')]({'plain':!![]});var _0xe907a3=_0x3a58('0x2e');return db[_0x3a58('0x2f')][_0x3a58('0x2c')]({'where':{'type':_0xe907a3,'resourceId':_0x26def9['id']}})[_0x3a58('0x2b')](function(){return _0x262f05;});})['then'](function(){_0x557ec5[_0x3a58('0x20')](0xcc)[_0x3a58('0x1f')]();});}};}function handleEntityNotFound(_0x468352,_0x1460a5){return function(_0x2d1087){if(!_0x2d1087){_0x468352[_0x3a58('0x1e')](0x194);}return _0x2d1087;};}function handleError(_0x2bfcdf,_0x381c26){_0x381c26=_0x381c26||0x1f4;return function(_0x5bd866){logger[_0x3a58('0x30')](_0x5bd866[_0x3a58('0x31')]);if(_0x5bd866[_0x3a58('0x32')]){delete _0x5bd866[_0x3a58('0x32')];}_0x2bfcdf[_0x3a58('0x20')](_0x381c26)[_0x3a58('0x33')](_0x5bd866);};}exports[_0x3a58('0x34')]=function(_0x291613,_0x358f7b){var _0x18a6b0={},_0x46b7b9={},_0x5733c4={'count':0x0,'rows':[]};var _0x267822=_[_0x3a58('0x35')](db[_0x3a58('0x36')][_0x3a58('0x37')],function(_0x4a25f3){return{'name':_0x4a25f3[_0x3a58('0x38')],'type':_0x4a25f3['type'][_0x3a58('0x39')]};});_0x46b7b9[_0x3a58('0x3a')]=_['map'](_0x267822,'name');_0x46b7b9[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x291613[_0x3a58('0x3b')]);_0x46b7b9['filters']=_[_0x3a58('0x3d')](_0x46b7b9[_0x3a58('0x3a')],_0x46b7b9[_0x3a58('0x3b')]);_0x18a6b0[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x46b7b9[_0x3a58('0x3a')],qs['fields'](_0x291613[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x18a6b0[_0x3a58('0x3e')]=_0x18a6b0['attributes'][_0x3a58('0x40')]?_0x18a6b0[_0x3a58('0x3e')]:_0x46b7b9[_0x3a58('0x3a')];if(!_0x291613[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x18a6b0['limit']=qs[_0x3a58('0x23')](_0x291613[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x18a6b0[_0x3a58('0x25')]=qs['offset'](_0x291613['query'][_0x3a58('0x25')]);}_0x18a6b0[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x291613[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x18a6b0['where']=qs[_0x3a58('0x45')](_[_0x3a58('0x46')](_0x291613['query'],_0x46b7b9[_0x3a58('0x45')]),_0x267822);if(_0x291613[_0x3a58('0x3b')][_0x3a58('0x47')]){_0x18a6b0[_0x3a58('0x48')]=_[_0x3a58('0x49')](_0x18a6b0['where'],{'$or':_[_0x3a58('0x35')](_0x267822,function(_0x1768e8){if(_0x1768e8['type']!==_0x3a58('0x4a')){var _0x3784a4={};_0x3784a4[_0x1768e8['name']]={'$like':'%'+_0x291613[_0x3a58('0x3b')][_0x3a58('0x47')]+'%'};return _0x3784a4;}})});}_0x18a6b0=_[_0x3a58('0x49')]({},_0x18a6b0,_0x291613['options']);var _0x24b819={'where':_0x18a6b0['where']};return db[_0x3a58('0x36')]['count'](_0x24b819)['then'](function(_0x245db2){_0x5733c4[_0x3a58('0x24')]=_0x245db2;if(_0x291613[_0x3a58('0x3b')][_0x3a58('0x4b')]){_0x18a6b0['include']=[{'all':!![]}];}return db[_0x3a58('0x36')][_0x3a58('0x4c')](_0x18a6b0);})[_0x3a58('0x2b')](function(_0x228634){_0x5733c4[_0x3a58('0x4d')]=_0x228634;return _0x5733c4;})[_0x3a58('0x2b')](respondWithFilteredResult(_0x358f7b,_0x18a6b0))[_0x3a58('0x4e')](handleError(_0x358f7b,null));};exports[_0x3a58('0x4f')]=function(_0x4dfce9,_0x1755a9){var _0x202066={'raw':!![],'where':{'id':_0x4dfce9[_0x3a58('0x50')]['id']}},_0x1007d4={};_0x1007d4[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db['WhatsappQueue']['rawAttributes']);_0x1007d4['query']=_[_0x3a58('0x3c')](_0x4dfce9[_0x3a58('0x3b')]);_0x1007d4[_0x3a58('0x45')]=_[_0x3a58('0x3d')](_0x1007d4['model'],_0x1007d4[_0x3a58('0x3b')]);_0x202066[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x1007d4[_0x3a58('0x3a')],qs['fields'](_0x4dfce9[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x202066[_0x3a58('0x3e')]=_0x202066[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x202066[_0x3a58('0x3e')]:_0x1007d4['model'];if(_0x4dfce9[_0x3a58('0x3b')][_0x3a58('0x4b')]){_0x202066[_0x3a58('0x51')]=[{'all':!![]}];}_0x202066=_['merge']({},_0x202066,_0x4dfce9[_0x3a58('0x52')]);return db[_0x3a58('0x36')]['find'](_0x202066)[_0x3a58('0x2b')](handleEntityNotFound(_0x1755a9,null))[_0x3a58('0x2b')](respondWithResult(_0x1755a9,null))['catch'](handleError(_0x1755a9,null));};exports['create']=function(_0x5bce8a,_0x3fa996){return db['WhatsappQueue']['create'](_0x5bce8a[_0x3a58('0x53')],{})[_0x3a58('0x2b')](function(_0x26e1ac){var _0x3d1f05=_0x5bce8a[_0x3a58('0x54')][_0x3a58('0x2d')]({'plain':!![]});if(!_0x3d1f05)throw new Error(_0x3a58('0x55'));if(_0x3d1f05[_0x3a58('0x56')]==='user'){var _0x4e876e=_0x26e1ac[_0x3a58('0x2d')]({'plain':!![]});var _0x565e82=_0x3a58('0x2e');return db['UserProfileSection'][_0x3a58('0x57')]({'where':{'name':_0x565e82,'userProfileId':_0x3d1f05[_0x3a58('0x58')]},'raw':!![]})[_0x3a58('0x2b')](function(_0x206b9d){if(_0x206b9d&&_0x206b9d[_0x3a58('0x59')]===0x0){return db[_0x3a58('0x2f')]['create']({'name':_0x4e876e[_0x3a58('0x32')],'resourceId':_0x4e876e['id'],'type':_0x206b9d[_0x3a58('0x32')],'sectionId':_0x206b9d['id']},{})[_0x3a58('0x2b')](function(){return _0x26e1ac;});}else{return _0x26e1ac;}})['catch'](function(_0x1e488c){logger[_0x3a58('0x30')](_0x3a58('0x5a'),_0x1e488c);throw _0x1e488c;});}return _0x26e1ac;})['then'](respondWithResult(_0x3fa996,0xc9))[_0x3a58('0x4e')](handleError(_0x3fa996,null));};exports[_0x3a58('0x2a')]=function(_0x289e84,_0x39d4ba){if(_0x289e84[_0x3a58('0x53')]['id']){delete _0x289e84['body']['id'];}return db['WhatsappQueue'][_0x3a58('0x57')]({'where':{'id':_0x289e84[_0x3a58('0x50')]['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x39d4ba,null))[_0x3a58('0x2b')](saveUpdates(_0x289e84['body'],null))[_0x3a58('0x2b')](respondWithResult(_0x39d4ba,null))[_0x3a58('0x4e')](handleError(_0x39d4ba,null));};exports[_0x3a58('0x2c')]=function(_0x578799,_0x1cdd81){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x578799[_0x3a58('0x50')]['id']}})['then'](handleEntityNotFound(_0x1cdd81,null))[_0x3a58('0x2b')](removeEntity(_0x1cdd81,null))[_0x3a58('0x4e')](handleError(_0x1cdd81,null));};exports[_0x3a58('0x5b')]=function(_0x4a777d,_0x45f743){return db['WhatsappQueue'][_0x3a58('0x5b')]()[_0x3a58('0x2b')](respondWithResult(_0x45f743,null))[_0x3a58('0x4e')](handleError(_0x45f743,null));};exports[_0x3a58('0x5c')]=function(_0x49a8b0,_0xef2bb,_0x5b7bbc){var _0x5f2989={'raw':!![],'where':{}},_0x39b3fe={},_0x1f9415;return db[_0x3a58('0x36')][_0x3a58('0x5d')]({'where':{'id':_0x49a8b0[_0x3a58('0x50')]['id']}})['then'](handleEntityNotFound(_0xef2bb,null))[_0x3a58('0x2b')](function(_0x13fcfa){if(_0x13fcfa){_0x1f9415=_0x13fcfa['get']({'plain':!![]});_0x39b3fe[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db[_0x3a58('0x5e')][_0x3a58('0x37')]);_0x39b3fe[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x49a8b0['query']);_0x39b3fe[_0x3a58('0x45')]=_['intersection'](_0x39b3fe[_0x3a58('0x3a')],_0x39b3fe[_0x3a58('0x3b')]);_0x5f2989[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x39b3fe['model'],qs[_0x3a58('0x3f')](_0x49a8b0['query']['fields']));_0x5f2989[_0x3a58('0x3e')]=_0x5f2989[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x5f2989['attributes']:_0x39b3fe[_0x3a58('0x3a')];if(!_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x5f2989[_0x3a58('0x23')]=qs['limit'](_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x5f2989[_0x3a58('0x25')]=qs['offset'](_0x49a8b0[_0x3a58('0x3b')]['offset']);}_0x5f2989[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x49a8b0[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x5f2989[_0x3a58('0x48')]=qs[_0x3a58('0x45')](_['pick'](_0x49a8b0[_0x3a58('0x3b')],_0x39b3fe[_0x3a58('0x45')]));_0x5f2989[_0x3a58('0x48')][_0x3a58('0x5f')]=_0x13fcfa['id'];if(_0x49a8b0[_0x3a58('0x3b')]['filter']){_0x5f2989['where']=_[_0x3a58('0x49')](_0x5f2989[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x5f2989['attributes'],function(_0x516c64){var _0x4a33ca={};_0x4a33ca[_0x516c64]={'$like':'%'+_0x49a8b0['query'][_0x3a58('0x47')]+'%'};return _0x4a33ca;})});}_0x5f2989=_[_0x3a58('0x49')]({},_0x5f2989,_0x49a8b0[_0x3a58('0x52')]);return db[_0x3a58('0x5e')][_0x3a58('0x4c')](_0x5f2989);}})['then'](function(_0xcfc9c9){if(_0xcfc9c9){return db['User'][_0x3a58('0x60')]({'where':{'id':_['map'](_0xcfc9c9,_0x3a58('0x61')),'role':_0x3a58('0x62')},'attributes':['id',_0x3a58('0x32'),_0x3a58('0x63'),_0x3a58('0x64'),_0x3a58('0x65')]});}})[_0x3a58('0x2b')](function(_0x35a25){if(_0x35a25){return{'count':_0x35a25[_0x3a58('0x24')],'rows':_[_0x3a58('0x35')](_0x35a25['rows'],function(_0xf0b01a){return{'membername':_0xf0b01a[_0x3a58('0x32')],'UserId':_0xf0b01a['id'],'queue_name':_0x1f9415[_0x3a58('0x32')],'WhatsappQueueId':_0x1f9415['id'],'interface':util['format']('%s/%s','SIP',_0xf0b01a['name']),'penalty':0x0,'paused':_0xf0b01a[_0x3a58('0x63')],'createdAt':_0xf0b01a[_0x3a58('0x65')],'updatedAt':_0xf0b01a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a58('0x2b')](respondWithFilteredResult(_0xef2bb,_0x5f2989))[_0x3a58('0x4e')](handleError(_0xef2bb,null));};exports['getTeams']=function(_0x1e0d90,_0x26e1de,_0x4de6a1){var _0x309b90={};var _0x2056bf={};var _0x44852e;var _0x4ed258;return db['WhatsappQueue'][_0x3a58('0x5d')]({'where':{'id':_0x1e0d90['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x26e1de,null))['then'](function(_0x35b49a){if(_0x35b49a){_0x44852e=_0x35b49a;_0x2056bf[_0x3a58('0x3a')]=_['keys'](db['Team'][_0x3a58('0x37')]);_0x2056bf[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x1e0d90[_0x3a58('0x3b')]);_0x2056bf[_0x3a58('0x45')]=_['intersection'](_0x2056bf[_0x3a58('0x3a')],_0x2056bf[_0x3a58('0x3b')]);_0x309b90[_0x3a58('0x3e')]=_['intersection'](_0x2056bf[_0x3a58('0x3a')],qs[_0x3a58('0x3f')](_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x3f')]));_0x309b90[_0x3a58('0x3e')]=_0x309b90[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x309b90[_0x3a58('0x3e')]:_0x2056bf[_0x3a58('0x3a')];_0x309b90[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x309b90[_0x3a58('0x48')]=qs[_0x3a58('0x45')](_[_0x3a58('0x46')](_0x1e0d90[_0x3a58('0x3b')],_0x2056bf[_0x3a58('0x45')]));if(_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x47')]){_0x309b90[_0x3a58('0x48')]=_[_0x3a58('0x49')](_0x309b90[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x309b90['attributes'],function(_0x2d08d4){var _0x2dec50={};_0x2dec50[_0x2d08d4]={'$like':'%'+_0x1e0d90['query']['filter']+'%'};return _0x2dec50;})});}_0x309b90=_[_0x3a58('0x49')]({},_0x309b90,_0x1e0d90[_0x3a58('0x52')]);return _0x44852e[_0x3a58('0x66')](_0x309b90);}})[_0x3a58('0x2b')](function(_0x16cd8a){if(_0x16cd8a){_0x4ed258=_0x16cd8a[_0x3a58('0x40')];if(!_0x1e0d90[_0x3a58('0x3b')][_0x3a58('0x41')](_0x3a58('0x42'))){_0x309b90[_0x3a58('0x23')]=qs[_0x3a58('0x23')](_0x1e0d90['query']['limit']);_0x309b90[_0x3a58('0x25')]=qs['offset'](_0x1e0d90[_0x3a58('0x3b')]['offset']);}return _0x44852e[_0x3a58('0x66')](_0x309b90);}})[_0x3a58('0x2b')](function(_0xb7f906){if(_0xb7f906){return _0xb7f906?{'count':_0x4ed258,'rows':_0xb7f906}:null;}})[_0x3a58('0x2b')](respondWithResult(_0x26e1de,null))[_0x3a58('0x4e')](handleError(_0x26e1de,null));};exports[_0x3a58('0x67')]=function(_0x187f1c,_0x1d220a,_0x304fb3){var _0x29ced4=_0x187f1c[_0x3a58('0x53')][_0x3a58('0x68')];return db['Team'][_0x3a58('0x4c')]({'where':{'id':_0x29ced4},'attributes':['id'],'include':[{'model':db[_0x3a58('0x69')],'as':'Agents','attributes':['id',_0x3a58('0x32'),_0x3a58('0x6a'),_0x3a58('0x6b'),_0x3a58('0x6c')],'raw':!![]}]})['then'](function(_0x103762){if(_0x103762){var _0x141ae9=_[_0x3a58('0x6d')](_0x103762,function(_0x5e4716){var _0x26ca14=_0x5e4716['get']({'plain':!![]});return _0x26ca14[_0x3a58('0x6e')];});return db['WhatsappQueue'][_0x3a58('0x57')]({'where':{'id':_0x187f1c[_0x3a58('0x50')]['id']}})[_0x3a58('0x2b')](function(_0xb11b3d){return db[_0x3a58('0x6f')][_0x3a58('0x70')](function(_0x59aa69){return _0xb11b3d[_0x3a58('0x67')](_0x29ced4,{'transaction':_0x59aa69})['then'](function(){return BPromise['each'](_0x141ae9,function(_0x3ba6f1){return db['UserWhatsappQueue'][_0x3a58('0x71')]({'where':{'UserId':_0x3ba6f1['id'],'WhatsappQueueId':_0x187f1c[_0x3a58('0x50')]['id']},'transaction':_0x59aa69});});})[_0x3a58('0x2b')](function(){_0x141ae9[_0x3a58('0x72')](function(_0x3af26b){socket[_0x3a58('0x73')]('userWhatsappQueue:save',{'UserId':_0x3af26b['id'],'WhatsappQueueId':_0xb11b3d['id']});});});});});}})[_0x3a58('0x2b')](respondWithStatusCode(_0x1d220a,null))[_0x3a58('0x4e')](handleError(_0x1d220a,null));};exports[_0x3a58('0x74')]=function(_0x48b92e,_0x43d3f1,_0x1075c6){return db[_0x3a58('0x75')][_0x3a58('0x4c')]({'where':{'id':_0x48b92e[_0x3a58('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x3a58('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3a58('0x2b')](handleEntityNotFound(_0x43d3f1,null))[_0x3a58('0x2b')](function(_0x486ad1){var _0x34d4f8=_[_0x3a58('0x35')](_0x486ad1,'id');var _0x21d678=[];var _0x3a9bc4=[];var _0x28da3e=squel[_0x3a58('0x76')]();_0x28da3e[_0x3a58('0x77')](_0x3a58('0x78'))[_0x3a58('0x79')]('team_has_whatsapp_queues','tq')['join'](_0x3a58('0x7a'),'ut',_0x3a58('0x7b'))[_0x3a58('0x48')](_0x3a58('0x7c'),_0x48b92e[_0x3a58('0x50')]['id']);for(var _0x335a50=0x0;_0x335a50<_0x486ad1[_0x3a58('0x40')];_0x335a50+=0x1){let _0x35dc6e=_0x486ad1[_0x335a50];for(var _0xe0f4ad=0x0;_0xe0f4ad<_0x35dc6e[_0x3a58('0x6e')][_0x3a58('0x40')];_0xe0f4ad+=0x1){let _0x123058=_0x35dc6e[_0x3a58('0x6e')][_0xe0f4ad];var _0x563b1d=_0x28da3e['clone']();_0x563b1d[_0x3a58('0x48')](_0x3a58('0x7d'),_0x123058['id']);_0x3a9bc4[_0x3a58('0x7e')](db[_0x3a58('0x6f')]['query'](_0x563b1d[_0x3a58('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x3a58('0x80')]})[_0x3a58('0x2b')](function(_0x108fbd){if(_0x108fbd[_0x3a58('0x40')]===0x1){return _0x123058['id'];}else{var _0x348f6d=_[_0x3a58('0x81')](_[_0x3a58('0x35')](_0x108fbd,_0x3a58('0x82')),function(_0x58b1bf){return _[_0x3a58('0x83')](_0x34d4f8,_0x58b1bf);});if(_0x348f6d){return _0x123058['id'];}}}));}}return BPromise[_0x3a58('0x84')](_0x3a9bc4)[_0x3a58('0x2b')](function(_0x1826a1){_0x21d678=_(_0x21d678)[_0x3a58('0x85')](_0x1826a1)['compact']()[_0x3a58('0x86')]();return db[_0x3a58('0x36')]['find']({'where':{'id':_0x48b92e[_0x3a58('0x50')]['id']}})['then'](function(_0x38829a){return db[_0x3a58('0x6f')]['transaction'](function(_0x530f5e){return _0x38829a[_0x3a58('0x74')](_0x48b92e[_0x3a58('0x3b')][_0x3a58('0x68')],{'transaction':_0x530f5e})[_0x3a58('0x2b')](function(){if(!_['isEmpty'](_0x21d678)){return _0x38829a['removeAgents'](_0x21d678,{'transaction':_0x530f5e});}})[_0x3a58('0x2b')](function(){_0x21d678[_0x3a58('0x72')](function(_0x122623){socket['emit'](_0x3a58('0x87'),{'UserId':_0x122623,'WhatsappQueueId':_0x38829a['id']});});});});});});})['then'](respondWithStatusCode(_0x43d3f1,null))['catch'](handleError(_0x43d3f1,null));};exports[_0x3a58('0x88')]=function(_0x4d4490,_0x2d6f60,_0x36feb6){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x4d4490['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x2d6f60,null))[_0x3a58('0x2b')](function(_0x302345){if(_0x302345){return _0x302345[_0x3a58('0x88')](_0x4d4490['body'][_0x3a58('0x68')],_['omit'](_0x4d4490[_0x3a58('0x53')],[_0x3a58('0x68'),'id'])||{})['spread'](function(_0x3e2380){for(var _0x49fd7e=0x0;_0x49fd7e<_0x4d4490['body'][_0x3a58('0x68')][_0x3a58('0x40')];_0x49fd7e+=0x1){socket[_0x3a58('0x73')](_0x3a58('0x89'),{'UserId':Number(_0x4d4490[_0x3a58('0x53')][_0x3a58('0x68')][_0x49fd7e]),'WhatsappQueueId':Number(_0x4d4490['params']['id'])});}return _0x3e2380;});}})[_0x3a58('0x2b')](respondWithResult(_0x2d6f60,null))['catch'](handleError(_0x2d6f60,null));};exports[_0x3a58('0x8a')]=function(_0x1bf1bc,_0x561b0e,_0x1a94db){return db[_0x3a58('0x36')][_0x3a58('0x57')]({'where':{'id':_0x1bf1bc['params']['id']}})[_0x3a58('0x2b')](handleEntityNotFound(_0x561b0e,null))[_0x3a58('0x2b')](function(_0x2c856f){if(_0x2c856f){return _0x2c856f[_0x3a58('0x8a')](_0x1bf1bc['query']['ids'])[_0x3a58('0x2b')](function(){if(_['isArray'](_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')])){for(var _0x5f2e14=0x0;_0x5f2e14<_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')][_0x3a58('0x40')];_0x5f2e14+=0x1){socket[_0x3a58('0x73')](_0x3a58('0x87'),{'UserId':Number(_0x1bf1bc['query'][_0x3a58('0x68')][_0x5f2e14]),'WhatsappQueueId':Number(_0x1bf1bc[_0x3a58('0x50')]['id'])});}}else{socket[_0x3a58('0x73')](_0x3a58('0x87'),{'UserId':Number(_0x1bf1bc[_0x3a58('0x3b')][_0x3a58('0x68')]),'WhatsappQueueId':Number(_0x1bf1bc[_0x3a58('0x50')]['id'])});}});}})[_0x3a58('0x2b')](respondWithStatusCode(_0x561b0e,null))[_0x3a58('0x4e')](handleError(_0x561b0e,null));};exports[_0x3a58('0x8b')]=function(_0x45983a,_0xed0bd2,_0x576750){var _0x5753bd={};var _0x59c248={};var _0xe9f96;var _0x540f05;return db[_0x3a58('0x36')]['findOne']({'where':{'id':_0x45983a['params']['id']}})['then'](handleEntityNotFound(_0xed0bd2,null))[_0x3a58('0x2b')](function(_0x406414){if(_0x406414){_0xe9f96=_0x406414;_0x59c248[_0x3a58('0x3a')]=_[_0x3a58('0x3c')](db[_0x3a58('0x69')][_0x3a58('0x37')]);_0x59c248[_0x3a58('0x3b')]=_[_0x3a58('0x3c')](_0x45983a[_0x3a58('0x3b')]);_0x59c248['filters']=_[_0x3a58('0x3d')](_0x59c248[_0x3a58('0x3a')],_0x59c248[_0x3a58('0x3b')]);_0x5753bd[_0x3a58('0x3e')]=_[_0x3a58('0x3d')](_0x59c248[_0x3a58('0x3a')],qs[_0x3a58('0x3f')](_0x45983a['query'][_0x3a58('0x3f')]));_0x5753bd['attributes']=_0x5753bd[_0x3a58('0x3e')][_0x3a58('0x40')]?_0x5753bd[_0x3a58('0x3e')]:_0x59c248[_0x3a58('0x3a')];_0x5753bd[_0x3a58('0x43')]=qs[_0x3a58('0x44')](_0x45983a[_0x3a58('0x3b')][_0x3a58('0x44')]);_0x5753bd['where']=qs['filters'](_[_0x3a58('0x46')](_0x45983a[_0x3a58('0x3b')],_0x59c248['filters']));if(_0x45983a[_0x3a58('0x3b')]['filter']){_0x5753bd['where']=_[_0x3a58('0x49')](_0x5753bd[_0x3a58('0x48')],{'$or':_[_0x3a58('0x35')](_0x5753bd['attributes'],function(_0x58f827){var _0x5a0cf6={};_0x5a0cf6[_0x58f827]={'$like':'%'+_0x45983a['query'][_0x3a58('0x47')]+'%'};return _0x5a0cf6;})});}_0x5753bd=_[_0x3a58('0x49')]({},_0x5753bd,_0x45983a[_0x3a58('0x52')]);return _0xe9f96[_0x3a58('0x8b')](_0x5753bd);}})['then'](function(_0x2b89f0){if(_0x2b89f0){_0x540f05=_0x2b89f0[_0x3a58('0x40')];if(!_0x45983a[_0x3a58('0x3b')][_0x3a58('0x41')]('nolimit')){_0x5753bd[_0x3a58('0x23')]=qs[_0x3a58('0x23')](_0x45983a[_0x3a58('0x3b')][_0x3a58('0x23')]);_0x5753bd[_0x3a58('0x25')]=qs['offset'](_0x45983a['query']['offset']);}return _0xe9f96['getAgents'](_0x5753bd);}})[_0x3a58('0x2b')](function(_0x450ade){if(_0x450ade){return _0x450ade?{'count':_0x540f05,'rows':_0x450ade}:null;}})['then'](respondWithResult(_0xed0bd2,null))[_0x3a58('0x4e')](handleError(_0xed0bd2,null));}; \ No newline at end of file +var _0xa451=['send','index','map','WhatsappQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','getTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','offset','undefined','limit','count','status','set','json','apply','reject','save','destroy','then','WhatsappQueues','UserProfileResource','stack','name'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa451,0x64));var _0x1a45=function(_0x5046c6,_0x586004){_0x5046c6=_0x5046c6-0x0;var _0x1f5d3d=_0xa451[_0x5046c6];return _0x1f5d3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a45('0x0'));var zipdir=require(_0x1a45('0x1'));var jsonpatch=require(_0x1a45('0x2'));var rp=require(_0x1a45('0x3'));var moment=require(_0x1a45('0x4'));var BPromise=require(_0x1a45('0x5'));var Mustache=require(_0x1a45('0x6'));var util=require(_0x1a45('0x7'));var path=require(_0x1a45('0x8'));var sox=require(_0x1a45('0x9'));var csv=require(_0x1a45('0xa'));var ejs=require(_0x1a45('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1a45('0xc'));var squel=require(_0x1a45('0xd'));var crypto=require(_0x1a45('0xe'));var jsforce=require(_0x1a45('0xf'));var deskjs=require(_0x1a45('0x10'));var toCsv=require(_0x1a45('0xa'));var querystring=require(_0x1a45('0x11'));var Papa=require(_0x1a45('0x12'));var Redis=require('ioredis');var authService=require(_0x1a45('0x13'));var qs=require(_0x1a45('0x14'));var as=require(_0x1a45('0x15'));var hardwareService=require(_0x1a45('0x16'));var logger=require(_0x1a45('0x17'))(_0x1a45('0x18'));var utils=require(_0x1a45('0x19'));var config=require(_0x1a45('0x1a'));var licenseUtil=require(_0x1a45('0x1b'));var db=require(_0x1a45('0x1c'))['db'];config[_0x1a45('0x1d')]=_[_0x1a45('0x1e')](config[_0x1a45('0x1d')],{'host':_0x1a45('0x1f'),'port':0x18eb});var socket=require(_0x1a45('0x20'))(new Redis(config[_0x1a45('0x1d')]));require(_0x1a45('0x21'))['register'](socket);function respondWithStatusCode(_0xeab983,_0x2d3a8a){_0x2d3a8a=_0x2d3a8a||0xcc;return function(_0x452c79){if(_0x452c79){return _0xeab983[_0x1a45('0x22')](_0x2d3a8a);}return _0xeab983['status'](_0x2d3a8a)['end']();};}function respondWithResult(_0x369190,_0x17fef2){_0x17fef2=_0x17fef2||0xc8;return function(_0x431d1f){if(_0x431d1f){return _0x369190['status'](_0x17fef2)['json'](_0x431d1f);}};}function respondWithFilteredResult(_0x234ef7,_0x342b17){return function(_0x1baa6b){if(_0x1baa6b){var _0xcccece=typeof _0x342b17[_0x1a45('0x23')]===_0x1a45('0x24')&&typeof _0x342b17[_0x1a45('0x25')]===_0x1a45('0x24');var _0x5cc46e=_0x1baa6b[_0x1a45('0x26')];var _0x2b00fa=_0xcccece?0x0:_0x342b17[_0x1a45('0x23')];var _0x4f1338=_0xcccece?_0x1baa6b['count']:_0x342b17[_0x1a45('0x23')]+_0x342b17[_0x1a45('0x25')];var _0x4920a7;if(_0x4f1338>=_0x5cc46e){_0x4f1338=_0x5cc46e;_0x4920a7=0xc8;}else{_0x4920a7=0xce;}_0x234ef7[_0x1a45('0x27')](_0x4920a7);return _0x234ef7[_0x1a45('0x28')]('Content-Range',_0x2b00fa+'-'+_0x4f1338+'/'+_0x5cc46e)[_0x1a45('0x29')](_0x1baa6b);}return null;};}function patchUpdates(_0x2890fc){return function(_0x311df8){try{jsonpatch[_0x1a45('0x2a')](_0x311df8,_0x2890fc,!![]);}catch(_0x3f2f2c){return BPromise[_0x1a45('0x2b')](_0x3f2f2c);}return _0x311df8[_0x1a45('0x2c')]();};}function saveUpdates(_0x5b92e6,_0x1b9744){return function(_0x49127c){if(_0x49127c){return _0x49127c['update'](_0x5b92e6)['then'](function(_0xbeea41){return _0xbeea41;});}return null;};}function removeEntity(_0x49a2f1,_0x4a380){return function(_0x538dab){if(_0x538dab){return _0x538dab[_0x1a45('0x2d')]()[_0x1a45('0x2e')](function(){var _0x5d1a53=_0x538dab['get']({'plain':!![]});var _0x2dab77=_0x1a45('0x2f');return db[_0x1a45('0x30')][_0x1a45('0x2d')]({'where':{'type':_0x2dab77,'resourceId':_0x5d1a53['id']}})['then'](function(){return _0x538dab;});})[_0x1a45('0x2e')](function(){_0x49a2f1[_0x1a45('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e47f8,_0x187f72){return function(_0x58bc74){if(!_0x58bc74){_0x5e47f8[_0x1a45('0x22')](0x194);}return _0x58bc74;};}function handleError(_0x29c782,_0x175dd4){_0x175dd4=_0x175dd4||0x1f4;return function(_0x2a2da8){logger['error'](_0x2a2da8[_0x1a45('0x31')]);if(_0x2a2da8[_0x1a45('0x32')]){delete _0x2a2da8[_0x1a45('0x32')];}_0x29c782[_0x1a45('0x27')](_0x175dd4)[_0x1a45('0x33')](_0x2a2da8);};}exports[_0x1a45('0x34')]=function(_0x5c5a88,_0x135d4c){var _0x3767f6={},_0x36b7e1={},_0x1cd24a={'count':0x0,'rows':[]};var _0x5d109f=_[_0x1a45('0x35')](db[_0x1a45('0x36')]['rawAttributes'],function(_0x170472){return{'name':_0x170472[_0x1a45('0x37')],'type':_0x170472[_0x1a45('0x38')][_0x1a45('0x39')]};});_0x36b7e1[_0x1a45('0x3a')]=_[_0x1a45('0x35')](_0x5d109f,_0x1a45('0x32'));_0x36b7e1[_0x1a45('0x3b')]=_['keys'](_0x5c5a88[_0x1a45('0x3b')]);_0x36b7e1[_0x1a45('0x3c')]=_[_0x1a45('0x3d')](_0x36b7e1[_0x1a45('0x3a')],_0x36b7e1['query']);_0x3767f6[_0x1a45('0x3e')]=_[_0x1a45('0x3d')](_0x36b7e1[_0x1a45('0x3a')],qs[_0x1a45('0x3f')](_0x5c5a88[_0x1a45('0x3b')]['fields']));_0x3767f6[_0x1a45('0x3e')]=_0x3767f6[_0x1a45('0x3e')][_0x1a45('0x40')]?_0x3767f6[_0x1a45('0x3e')]:_0x36b7e1[_0x1a45('0x3a')];if(!_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x41')](_0x1a45('0x42'))){_0x3767f6[_0x1a45('0x25')]=qs[_0x1a45('0x25')](_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x25')]);_0x3767f6[_0x1a45('0x23')]=qs[_0x1a45('0x23')](_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x23')]);}_0x3767f6[_0x1a45('0x43')]=qs[_0x1a45('0x44')](_0x5c5a88[_0x1a45('0x3b')]['sort']);_0x3767f6[_0x1a45('0x45')]=qs['filters'](_[_0x1a45('0x46')](_0x5c5a88[_0x1a45('0x3b')],_0x36b7e1['filters']),_0x5d109f);if(_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x47')]){_0x3767f6[_0x1a45('0x45')]=_[_0x1a45('0x48')](_0x3767f6[_0x1a45('0x45')],{'$or':_['map'](_0x5d109f,function(_0xfa029){if(_0xfa029[_0x1a45('0x38')]!==_0x1a45('0x49')){var _0x523f0e={};_0x523f0e[_0xfa029[_0x1a45('0x32')]]={'$like':'%'+_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x47')]+'%'};return _0x523f0e;}})});}_0x3767f6=_[_0x1a45('0x48')]({},_0x3767f6,_0x5c5a88[_0x1a45('0x4a')]);var _0x578a4b={'where':_0x3767f6[_0x1a45('0x45')]};return db[_0x1a45('0x36')][_0x1a45('0x26')](_0x578a4b)[_0x1a45('0x2e')](function(_0x294cbc){_0x1cd24a[_0x1a45('0x26')]=_0x294cbc;if(_0x5c5a88[_0x1a45('0x3b')][_0x1a45('0x4b')]){_0x3767f6['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x1a45('0x4c')](_0x3767f6);})['then'](function(_0x45dd46){_0x1cd24a[_0x1a45('0x4d')]=_0x45dd46;return _0x1cd24a;})[_0x1a45('0x2e')](respondWithFilteredResult(_0x135d4c,_0x3767f6))[_0x1a45('0x4e')](handleError(_0x135d4c,null));};exports[_0x1a45('0x4f')]=function(_0x16a03f,_0x494a29){var _0xcf6e7b={'raw':!![],'where':{'id':_0x16a03f['params']['id']}},_0x5136c0={};_0x5136c0[_0x1a45('0x3a')]=_[_0x1a45('0x50')](db[_0x1a45('0x36')][_0x1a45('0x51')]);_0x5136c0['query']=_[_0x1a45('0x50')](_0x16a03f[_0x1a45('0x3b')]);_0x5136c0[_0x1a45('0x3c')]=_[_0x1a45('0x3d')](_0x5136c0[_0x1a45('0x3a')],_0x5136c0[_0x1a45('0x3b')]);_0xcf6e7b[_0x1a45('0x3e')]=_[_0x1a45('0x3d')](_0x5136c0[_0x1a45('0x3a')],qs[_0x1a45('0x3f')](_0x16a03f[_0x1a45('0x3b')][_0x1a45('0x3f')]));_0xcf6e7b['attributes']=_0xcf6e7b[_0x1a45('0x3e')][_0x1a45('0x40')]?_0xcf6e7b[_0x1a45('0x3e')]:_0x5136c0[_0x1a45('0x3a')];if(_0x16a03f[_0x1a45('0x3b')][_0x1a45('0x4b')]){_0xcf6e7b[_0x1a45('0x52')]=[{'all':!![]}];}_0xcf6e7b=_[_0x1a45('0x48')]({},_0xcf6e7b,_0x16a03f[_0x1a45('0x4a')]);return db[_0x1a45('0x36')][_0x1a45('0x53')](_0xcf6e7b)[_0x1a45('0x2e')](handleEntityNotFound(_0x494a29,null))[_0x1a45('0x2e')](respondWithResult(_0x494a29,null))[_0x1a45('0x4e')](handleError(_0x494a29,null));};exports[_0x1a45('0x54')]=function(_0x32da1a,_0x497a2a){return db['WhatsappQueue'][_0x1a45('0x54')](_0x32da1a[_0x1a45('0x55')],{})[_0x1a45('0x2e')](function(_0x2afc2f){var _0x5d5969=_0x32da1a[_0x1a45('0x56')][_0x1a45('0x57')]({'plain':!![]});if(!_0x5d5969)throw new Error(_0x1a45('0x58'));if(_0x5d5969[_0x1a45('0x59')]===_0x1a45('0x56')){var _0x478480=_0x2afc2f[_0x1a45('0x57')]({'plain':!![]});var _0x2933f4=_0x1a45('0x2f');return db['UserProfileSection'][_0x1a45('0x53')]({'where':{'name':_0x2933f4,'userProfileId':_0x5d5969['userProfileId']},'raw':!![]})[_0x1a45('0x2e')](function(_0x10e0ff){if(_0x10e0ff&&_0x10e0ff[_0x1a45('0x5a')]===0x0){return db[_0x1a45('0x30')][_0x1a45('0x54')]({'name':_0x478480[_0x1a45('0x32')],'resourceId':_0x478480['id'],'type':_0x10e0ff[_0x1a45('0x32')],'sectionId':_0x10e0ff['id']},{})[_0x1a45('0x2e')](function(){return _0x2afc2f;});}else{return _0x2afc2f;}})[_0x1a45('0x4e')](function(_0x38a1ea){logger[_0x1a45('0x5b')](_0x1a45('0x5c'),_0x38a1ea);throw _0x38a1ea;});}return _0x2afc2f;})[_0x1a45('0x2e')](respondWithResult(_0x497a2a,0xc9))['catch'](handleError(_0x497a2a,null));};exports['update']=function(_0x1bd8ed,_0x5c632d){if(_0x1bd8ed[_0x1a45('0x55')]['id']){delete _0x1bd8ed[_0x1a45('0x55')]['id'];}return db[_0x1a45('0x36')]['find']({'where':{'id':_0x1bd8ed['params']['id']}})[_0x1a45('0x2e')](handleEntityNotFound(_0x5c632d,null))[_0x1a45('0x2e')](saveUpdates(_0x1bd8ed[_0x1a45('0x55')],null))['then'](respondWithResult(_0x5c632d,null))[_0x1a45('0x4e')](handleError(_0x5c632d,null));};exports[_0x1a45('0x2d')]=function(_0xa301f7,_0x2b9dba){return db[_0x1a45('0x36')][_0x1a45('0x53')]({'where':{'id':_0xa301f7['params']['id']}})[_0x1a45('0x2e')](handleEntityNotFound(_0x2b9dba,null))[_0x1a45('0x2e')](removeEntity(_0x2b9dba,null))[_0x1a45('0x4e')](handleError(_0x2b9dba,null));};exports['describe']=function(_0x294ec0,_0xecae4a){return db['WhatsappQueue'][_0x1a45('0x5d')]()[_0x1a45('0x2e')](respondWithResult(_0xecae4a,null))[_0x1a45('0x4e')](handleError(_0xecae4a,null));};exports[_0x1a45('0x5e')]=function(_0x20f430,_0x5ae380,_0x3007ab){var _0x5d92c3={'raw':!![],'where':{}},_0x3ddcd1={},_0x336d40;return db[_0x1a45('0x36')]['findOne']({'where':{'id':_0x20f430[_0x1a45('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5ae380,null))[_0x1a45('0x2e')](function(_0x354eef){if(_0x354eef){_0x336d40=_0x354eef['get']({'plain':!![]});_0x3ddcd1[_0x1a45('0x3a')]=_[_0x1a45('0x50')](db[_0x1a45('0x60')][_0x1a45('0x51')]);_0x3ddcd1[_0x1a45('0x3b')]=_[_0x1a45('0x50')](_0x20f430[_0x1a45('0x3b')]);_0x3ddcd1['filters']=_['intersection'](_0x3ddcd1[_0x1a45('0x3a')],_0x3ddcd1[_0x1a45('0x3b')]);_0x5d92c3[_0x1a45('0x3e')]=_[_0x1a45('0x3d')](_0x3ddcd1[_0x1a45('0x3a')],qs[_0x1a45('0x3f')](_0x20f430[_0x1a45('0x3b')][_0x1a45('0x3f')]));_0x5d92c3[_0x1a45('0x3e')]=_0x5d92c3[_0x1a45('0x3e')][_0x1a45('0x40')]?_0x5d92c3[_0x1a45('0x3e')]:_0x3ddcd1[_0x1a45('0x3a')];if(!_0x20f430['query'][_0x1a45('0x41')]('nolimit')){_0x5d92c3[_0x1a45('0x25')]=qs[_0x1a45('0x25')](_0x20f430[_0x1a45('0x3b')][_0x1a45('0x25')]);_0x5d92c3['offset']=qs[_0x1a45('0x23')](_0x20f430[_0x1a45('0x3b')][_0x1a45('0x23')]);}_0x5d92c3[_0x1a45('0x43')]=qs['sort'](_0x20f430[_0x1a45('0x3b')][_0x1a45('0x44')]);_0x5d92c3['where']=qs[_0x1a45('0x3c')](_[_0x1a45('0x46')](_0x20f430[_0x1a45('0x3b')],_0x3ddcd1[_0x1a45('0x3c')]));_0x5d92c3['where'][_0x1a45('0x61')]=_0x354eef['id'];if(_0x20f430[_0x1a45('0x3b')][_0x1a45('0x47')]){_0x5d92c3[_0x1a45('0x45')]=_[_0x1a45('0x48')](_0x5d92c3['where'],{'$or':_[_0x1a45('0x35')](_0x5d92c3[_0x1a45('0x3e')],function(_0x53ac5b){var _0x3adfb3={};_0x3adfb3[_0x53ac5b]={'$like':'%'+_0x20f430[_0x1a45('0x3b')][_0x1a45('0x47')]+'%'};return _0x3adfb3;})});}_0x5d92c3=_['merge']({},_0x5d92c3,_0x20f430[_0x1a45('0x4a')]);return db[_0x1a45('0x60')][_0x1a45('0x4c')](_0x5d92c3);}})[_0x1a45('0x2e')](function(_0x4e430c){if(_0x4e430c){return db[_0x1a45('0x62')]['findAndCountAll']({'where':{'id':_[_0x1a45('0x35')](_0x4e430c,_0x1a45('0x63')),'role':_0x1a45('0x64')},'attributes':['id','name',_0x1a45('0x65'),_0x1a45('0x66'),_0x1a45('0x67')]});}})['then'](function(_0x53d5c8){if(_0x53d5c8){return{'count':_0x53d5c8['count'],'rows':_[_0x1a45('0x35')](_0x53d5c8[_0x1a45('0x4d')],function(_0x920369){return{'membername':_0x920369[_0x1a45('0x32')],'UserId':_0x920369['id'],'queue_name':_0x336d40[_0x1a45('0x32')],'WhatsappQueueId':_0x336d40['id'],'interface':util[_0x1a45('0x68')](_0x1a45('0x69'),_0x1a45('0x6a'),_0x920369[_0x1a45('0x32')]),'penalty':0x0,'paused':_0x920369[_0x1a45('0x65')],'createdAt':_0x920369[_0x1a45('0x67')],'updatedAt':_0x920369[_0x1a45('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a45('0x2e')](respondWithFilteredResult(_0x5ae380,_0x5d92c3))[_0x1a45('0x4e')](handleError(_0x5ae380,null));};exports['getTeams']=function(_0x1ef767,_0x463dcb,_0x170661){var _0x3b5f0b={};var _0x1c5393={};var _0xd033c2;var _0x62c2a;return db['WhatsappQueue'][_0x1a45('0x6b')]({'where':{'id':_0x1ef767[_0x1a45('0x5f')]['id']}})['then'](handleEntityNotFound(_0x463dcb,null))[_0x1a45('0x2e')](function(_0x406dae){if(_0x406dae){_0xd033c2=_0x406dae;_0x1c5393[_0x1a45('0x3a')]=_[_0x1a45('0x50')](db['Team'][_0x1a45('0x51')]);_0x1c5393[_0x1a45('0x3b')]=_[_0x1a45('0x50')](_0x1ef767[_0x1a45('0x3b')]);_0x1c5393[_0x1a45('0x3c')]=_['intersection'](_0x1c5393[_0x1a45('0x3a')],_0x1c5393['query']);_0x3b5f0b['attributes']=_[_0x1a45('0x3d')](_0x1c5393[_0x1a45('0x3a')],qs[_0x1a45('0x3f')](_0x1ef767[_0x1a45('0x3b')]['fields']));_0x3b5f0b[_0x1a45('0x3e')]=_0x3b5f0b[_0x1a45('0x3e')][_0x1a45('0x40')]?_0x3b5f0b[_0x1a45('0x3e')]:_0x1c5393[_0x1a45('0x3a')];_0x3b5f0b[_0x1a45('0x43')]=qs[_0x1a45('0x44')](_0x1ef767[_0x1a45('0x3b')][_0x1a45('0x44')]);_0x3b5f0b[_0x1a45('0x45')]=qs[_0x1a45('0x3c')](_[_0x1a45('0x46')](_0x1ef767[_0x1a45('0x3b')],_0x1c5393[_0x1a45('0x3c')]));if(_0x1ef767[_0x1a45('0x3b')][_0x1a45('0x47')]){_0x3b5f0b[_0x1a45('0x45')]=_[_0x1a45('0x48')](_0x3b5f0b['where'],{'$or':_[_0x1a45('0x35')](_0x3b5f0b[_0x1a45('0x3e')],function(_0x20dce6){var _0x156806={};_0x156806[_0x20dce6]={'$like':'%'+_0x1ef767['query'][_0x1a45('0x47')]+'%'};return _0x156806;})});}_0x3b5f0b=_[_0x1a45('0x48')]({},_0x3b5f0b,_0x1ef767[_0x1a45('0x4a')]);return _0xd033c2['getTeams'](_0x3b5f0b);}})[_0x1a45('0x2e')](function(_0x5a24ac){if(_0x5a24ac){_0x62c2a=_0x5a24ac[_0x1a45('0x40')];if(!_0x1ef767[_0x1a45('0x3b')][_0x1a45('0x41')](_0x1a45('0x42'))){_0x3b5f0b['limit']=qs[_0x1a45('0x25')](_0x1ef767[_0x1a45('0x3b')][_0x1a45('0x25')]);_0x3b5f0b[_0x1a45('0x23')]=qs[_0x1a45('0x23')](_0x1ef767[_0x1a45('0x3b')][_0x1a45('0x23')]);}return _0xd033c2[_0x1a45('0x6c')](_0x3b5f0b);}})[_0x1a45('0x2e')](function(_0x448823){if(_0x448823){return _0x448823?{'count':_0x62c2a,'rows':_0x448823}:null;}})[_0x1a45('0x2e')](respondWithResult(_0x463dcb,null))[_0x1a45('0x4e')](handleError(_0x463dcb,null));};exports['addTeams']=function(_0x2f24f4,_0x5d9a5e,_0x56202a){var _0x1cf70f=_0x2f24f4['body'][_0x1a45('0x6d')];return db[_0x1a45('0x6e')][_0x1a45('0x4c')]({'where':{'id':_0x1cf70f},'attributes':['id'],'include':[{'model':db[_0x1a45('0x62')],'as':_0x1a45('0x6f'),'attributes':['id',_0x1a45('0x32'),'online',_0x1a45('0x70'),_0x1a45('0x71')],'raw':!![]}]})[_0x1a45('0x2e')](function(_0x2e76ed){if(_0x2e76ed){var _0x24adb1=_[_0x1a45('0x72')](_0x2e76ed,function(_0x571ef7){var _0x526892=_0x571ef7[_0x1a45('0x57')]({'plain':!![]});return _0x526892['Agents'];});return db[_0x1a45('0x36')][_0x1a45('0x53')]({'where':{'id':_0x2f24f4[_0x1a45('0x5f')]['id']}})[_0x1a45('0x2e')](function(_0x3ec907){return db[_0x1a45('0x73')][_0x1a45('0x74')](function(_0x1376e6){return _0x3ec907[_0x1a45('0x75')](_0x1cf70f,{'transaction':_0x1376e6})['then'](function(){return BPromise[_0x1a45('0x76')](_0x24adb1,function(_0x3b7de){return db[_0x1a45('0x60')][_0x1a45('0x77')]({'where':{'UserId':_0x3b7de['id'],'WhatsappQueueId':_0x2f24f4[_0x1a45('0x5f')]['id']},'transaction':_0x1376e6});});})[_0x1a45('0x2e')](function(){_0x24adb1['forEach'](function(_0x2d228c){socket[_0x1a45('0x78')]('userWhatsappQueue:save',{'UserId':_0x2d228c['id'],'WhatsappQueueId':_0x3ec907['id']});});});});});}})[_0x1a45('0x2e')](respondWithStatusCode(_0x5d9a5e,null))['catch'](handleError(_0x5d9a5e,null));};exports[_0x1a45('0x79')]=function(_0x5bdb15,_0x560779,_0x3213f9){return db['Team']['findAll']({'where':{'id':_0x5bdb15[_0x1a45('0x3b')][_0x1a45('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x1a45('0x62')],'as':_0x1a45('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x1a45('0x2e')](handleEntityNotFound(_0x560779,null))[_0x1a45('0x2e')](function(_0xcca01f){var _0x59e302=_['map'](_0xcca01f,'id');var _0x34eb39=[];var _0x2f848c=[];var _0x188842=squel['select']();_0x188842[_0x1a45('0x7a')](_0x1a45('0x7b'))[_0x1a45('0x7c')](_0x1a45('0x7d'),'tq')[_0x1a45('0x7e')](_0x1a45('0x7f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1a45('0x45')](_0x1a45('0x80'),_0x5bdb15[_0x1a45('0x5f')]['id']);for(var _0x142df6=0x0;_0x142df6<_0xcca01f[_0x1a45('0x40')];_0x142df6+=0x1){let _0x31c183=_0xcca01f[_0x142df6];for(var _0x14371d=0x0;_0x14371d<_0x31c183[_0x1a45('0x6f')][_0x1a45('0x40')];_0x14371d+=0x1){let _0x196e70=_0x31c183[_0x1a45('0x6f')][_0x14371d];var _0x3af90a=_0x188842[_0x1a45('0x81')]();_0x3af90a[_0x1a45('0x45')](_0x1a45('0x82'),_0x196e70['id']);_0x2f848c[_0x1a45('0x83')](db[_0x1a45('0x73')][_0x1a45('0x3b')](_0x3af90a[_0x1a45('0x84')](),{'type':db['sequelize'][_0x1a45('0x85')][_0x1a45('0x86')]})[_0x1a45('0x2e')](function(_0x3f654d){if(_0x3f654d[_0x1a45('0x40')]===0x1){return _0x196e70['id'];}else{var _0x4b61d3=_[_0x1a45('0x87')](_[_0x1a45('0x35')](_0x3f654d,_0x1a45('0x88')),function(_0xee392e){return _[_0x1a45('0x89')](_0x59e302,_0xee392e);});if(_0x4b61d3){return _0x196e70['id'];}}}));}}return BPromise[_0x1a45('0x8a')](_0x2f848c)[_0x1a45('0x2e')](function(_0x21c104){_0x34eb39=_(_0x34eb39)[_0x1a45('0x8b')](_0x21c104)['compact']()[_0x1a45('0x8c')]();return db['WhatsappQueue'][_0x1a45('0x53')]({'where':{'id':_0x5bdb15[_0x1a45('0x5f')]['id']}})[_0x1a45('0x2e')](function(_0x5f5c38){return db[_0x1a45('0x73')][_0x1a45('0x74')](function(_0x4f0c5b){return _0x5f5c38[_0x1a45('0x79')](_0x5bdb15[_0x1a45('0x3b')][_0x1a45('0x6d')],{'transaction':_0x4f0c5b})[_0x1a45('0x2e')](function(){if(!_[_0x1a45('0x8d')](_0x34eb39)){return _0x5f5c38['removeAgents'](_0x34eb39,{'transaction':_0x4f0c5b});}})[_0x1a45('0x2e')](function(){_0x34eb39[_0x1a45('0x8e')](function(_0x343193){socket[_0x1a45('0x78')](_0x1a45('0x8f'),{'UserId':_0x343193,'WhatsappQueueId':_0x5f5c38['id']});});});});});});})[_0x1a45('0x2e')](respondWithStatusCode(_0x560779,null))[_0x1a45('0x4e')](handleError(_0x560779,null));};exports['addAgents']=function(_0xec6771,_0x123c7d,_0x1a8708){return db['WhatsappQueue']['find']({'where':{'id':_0xec6771['params']['id']}})[_0x1a45('0x2e')](handleEntityNotFound(_0x123c7d,null))[_0x1a45('0x2e')](function(_0x43f881){if(_0x43f881){return _0x43f881[_0x1a45('0x90')](_0xec6771[_0x1a45('0x55')][_0x1a45('0x6d')],_[_0x1a45('0x91')](_0xec6771[_0x1a45('0x55')],['ids','id'])||{})[_0x1a45('0x92')](function(_0x49a66c){for(var _0x2443b8=0x0;_0x2443b8<_0xec6771[_0x1a45('0x55')]['ids'][_0x1a45('0x40')];_0x2443b8+=0x1){socket[_0x1a45('0x78')](_0x1a45('0x93'),{'UserId':Number(_0xec6771['body'][_0x1a45('0x6d')][_0x2443b8]),'WhatsappQueueId':Number(_0xec6771[_0x1a45('0x5f')]['id'])});}return _0x49a66c;});}})[_0x1a45('0x2e')](respondWithResult(_0x123c7d,null))['catch'](handleError(_0x123c7d,null));};exports[_0x1a45('0x94')]=function(_0x3141cd,_0x52b496,_0x481c14){return db['WhatsappQueue'][_0x1a45('0x53')]({'where':{'id':_0x3141cd[_0x1a45('0x5f')]['id']}})[_0x1a45('0x2e')](handleEntityNotFound(_0x52b496,null))[_0x1a45('0x2e')](function(_0x59df28){if(_0x59df28){return _0x59df28[_0x1a45('0x94')](_0x3141cd[_0x1a45('0x3b')][_0x1a45('0x6d')])[_0x1a45('0x2e')](function(){if(_[_0x1a45('0x95')](_0x3141cd[_0x1a45('0x3b')][_0x1a45('0x6d')])){for(var _0xc8fbf8=0x0;_0xc8fbf8<_0x3141cd[_0x1a45('0x3b')][_0x1a45('0x6d')][_0x1a45('0x40')];_0xc8fbf8+=0x1){socket[_0x1a45('0x78')](_0x1a45('0x8f'),{'UserId':Number(_0x3141cd['query'][_0x1a45('0x6d')][_0xc8fbf8]),'WhatsappQueueId':Number(_0x3141cd[_0x1a45('0x5f')]['id'])});}}else{socket[_0x1a45('0x78')](_0x1a45('0x8f'),{'UserId':Number(_0x3141cd[_0x1a45('0x3b')][_0x1a45('0x6d')]),'WhatsappQueueId':Number(_0x3141cd['params']['id'])});}});}})[_0x1a45('0x2e')](respondWithStatusCode(_0x52b496,null))[_0x1a45('0x4e')](handleError(_0x52b496,null));};exports[_0x1a45('0x96')]=function(_0x31e731,_0xa272ac,_0x205730){var _0x464962={};var _0x5d067f={};var _0x4ffe17;var _0x3bbb93;return db[_0x1a45('0x36')][_0x1a45('0x6b')]({'where':{'id':_0x31e731[_0x1a45('0x5f')]['id']}})['then'](handleEntityNotFound(_0xa272ac,null))['then'](function(_0x14035d){if(_0x14035d){_0x4ffe17=_0x14035d;_0x5d067f[_0x1a45('0x3a')]=_[_0x1a45('0x50')](db[_0x1a45('0x62')][_0x1a45('0x51')]);_0x5d067f['query']=_[_0x1a45('0x50')](_0x31e731[_0x1a45('0x3b')]);_0x5d067f[_0x1a45('0x3c')]=_['intersection'](_0x5d067f[_0x1a45('0x3a')],_0x5d067f[_0x1a45('0x3b')]);_0x464962[_0x1a45('0x3e')]=_[_0x1a45('0x3d')](_0x5d067f[_0x1a45('0x3a')],qs[_0x1a45('0x3f')](_0x31e731[_0x1a45('0x3b')]['fields']));_0x464962[_0x1a45('0x3e')]=_0x464962[_0x1a45('0x3e')][_0x1a45('0x40')]?_0x464962['attributes']:_0x5d067f['model'];_0x464962[_0x1a45('0x43')]=qs['sort'](_0x31e731[_0x1a45('0x3b')][_0x1a45('0x44')]);_0x464962['where']=qs[_0x1a45('0x3c')](_[_0x1a45('0x46')](_0x31e731[_0x1a45('0x3b')],_0x5d067f[_0x1a45('0x3c')]));if(_0x31e731[_0x1a45('0x3b')][_0x1a45('0x47')]){_0x464962[_0x1a45('0x45')]=_[_0x1a45('0x48')](_0x464962[_0x1a45('0x45')],{'$or':_[_0x1a45('0x35')](_0x464962['attributes'],function(_0x2c1e45){var _0x4828ca={};_0x4828ca[_0x2c1e45]={'$like':'%'+_0x31e731[_0x1a45('0x3b')][_0x1a45('0x47')]+'%'};return _0x4828ca;})});}_0x464962=_[_0x1a45('0x48')]({},_0x464962,_0x31e731['options']);return _0x4ffe17[_0x1a45('0x96')](_0x464962);}})[_0x1a45('0x2e')](function(_0x167510){if(_0x167510){_0x3bbb93=_0x167510[_0x1a45('0x40')];if(!_0x31e731[_0x1a45('0x3b')][_0x1a45('0x41')]('nolimit')){_0x464962[_0x1a45('0x25')]=qs[_0x1a45('0x25')](_0x31e731[_0x1a45('0x3b')][_0x1a45('0x25')]);_0x464962[_0x1a45('0x23')]=qs[_0x1a45('0x23')](_0x31e731['query']['offset']);}return _0x4ffe17[_0x1a45('0x96')](_0x464962);}})[_0x1a45('0x2e')](function(_0x38a3c7){if(_0x38a3c7){return _0x38a3c7?{'count':_0x3bbb93,'rows':_0x38a3c7}:null;}})[_0x1a45('0x2e')](respondWithResult(_0xa272ac,null))[_0x1a45('0x4e')](handleError(_0xa272ac,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index dbca0e8..4da8460 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8b3=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x7a1ade,_0x413b03){var _0x2293ef=function(_0x110418){while(--_0x110418){_0x7a1ade['push'](_0x7a1ade['shift']());}};_0x2293ef(++_0x413b03);}(_0xf8b3,0x1ce));var _0x3f8b=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xf8b3[_0x4fbb15];return _0x436338;};'use strict';var EventEmitter=require(_0x3f8b('0x0'));var WhatsappQueue=require(_0x3f8b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3f8b('0x2')](0x0);var events={'afterCreate':_0x3f8b('0x3'),'afterUpdate':_0x3f8b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x528264){return function(_0x56863d,_0x51a6c6,_0x9f074){WhatsappQueueEvents[_0x3f8b('0x5')](_0x528264+':'+_0x56863d['id'],_0x56863d);WhatsappQueueEvents[_0x3f8b('0x5')](_0x528264,_0x56863d);_0x9f074(null);};}for(var e in events){if(events[_0x3f8b('0x6')](e)){var event=events[e];WhatsappQueue[_0x3f8b('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x48e2=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x24656b,_0x48a1e5){var _0x2325f1=function(_0x488446){while(--_0x488446){_0x24656b['push'](_0x24656b['shift']());}};_0x2325f1(++_0x48a1e5);}(_0x48e2,0xd5));var _0x248e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x48e2[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0x248e('0x0'));var WhatsappQueue=require(_0x248e('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x248e('0x2')](0x0);var events={'afterCreate':_0x248e('0x3'),'afterUpdate':_0x248e('0x4'),'afterDestroy':_0x248e('0x5')};function emitEvent(_0x2b2c61){return function(_0x46fa0c,_0x5b002f,_0x3002f7){WhatsappQueueEvents[_0x248e('0x6')](_0x2b2c61+':'+_0x46fa0c['id'],_0x46fa0c);WhatsappQueueEvents[_0x248e('0x6')](_0x2b2c61,_0x46fa0c);_0x3002f7(null);};}for(var e in events){if(events[_0x248e('0x7')](e)){var event=events[e];WhatsappQueue[_0x248e('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 0844abd..4e2f25f 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf675=['WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueue.attributes','define'];(function(_0x3eefc4,_0x13da29){var _0x390870=function(_0x3236fe){while(--_0x3236fe){_0x3eefc4['push'](_0x3eefc4['shift']());}};_0x390870(++_0x13da29);}(_0xf675,0xb5));var _0x5f67=function(_0x47f4c2,_0x134e7b){_0x47f4c2=_0x47f4c2-0x0;var _0x22c63e=_0xf675[_0x47f4c2];return _0x22c63e;};'use strict';var _=require('lodash');var util=require(_0x5f67('0x0'));var logger=require(_0x5f67('0x1'))(_0x5f67('0x2'));var moment=require(_0x5f67('0x3'));var BPromise=require(_0x5f67('0x4'));var rp=require(_0x5f67('0x5'));var fs=require('fs');var path=require(_0x5f67('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module['exports']=function(_0x443c97,_0x18610d){return _0x443c97[_0x5f67('0x8')](_0x5f67('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb17=['../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x442087,_0x520b79){var _0x134cb5=function(_0x1591e9){while(--_0x1591e9){_0x442087['push'](_0x442087['shift']());}};_0x134cb5(++_0x520b79);}(_0xeb17,0x7c));var _0x7eb1=function(_0x4816f4,_0x2c730d){_0x4816f4=_0x4816f4-0x0;var _0x57831f=_0xeb17[_0x4816f4];return _0x57831f;};'use strict';var _=require(_0x7eb1('0x0'));var util=require(_0x7eb1('0x1'));var logger=require(_0x7eb1('0x2'))(_0x7eb1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7eb1('0x4'));var rimraf=require(_0x7eb1('0x5'));var config=require(_0x7eb1('0x6'));var attributes=require(_0x7eb1('0x7'));module[_0x7eb1('0x8')]=function(_0x382481,_0x5cbd05){return _0x382481['define']('WhatsappQueue',attributes,{'tableName':_0x7eb1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 3b8c36b..7b64d38 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39f7=['raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options'];(function(_0x5ceab5,_0x190d14){var _0x59cebf=function(_0x2600ad){while(--_0x2600ad){_0x5ceab5['push'](_0x5ceab5['shift']());}};_0x59cebf(++_0x190d14);}(_0x39f7,0x1b6));var _0x739f=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0x39f7[_0x587fb5];return _0x551105;};'use strict';var _=require('lodash');var util=require(_0x739f('0x0'));var moment=require(_0x739f('0x1'));var BPromise=require(_0x739f('0x2'));var rs=require(_0x739f('0x3'));var fs=require('fs');var Redis=require(_0x739f('0x4'));var db=require(_0x739f('0x5'))['db'];var utils=require(_0x739f('0x6'));var logger=require(_0x739f('0x7'))(_0x739f('0x8'));var config=require(_0x739f('0x9'));var jayson=require(_0x739f('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x739f('0xb')]=_[_0x739f('0xc')](config[_0x739f('0xb')],{'host':_0x739f('0xd'),'port':0x18eb});var socket=require(_0x739f('0xe'))(new Redis(config[_0x739f('0xb')]));require('./whatsappQueue.socket')[_0x739f('0xf')](socket);function respondWithRpcPromise(_0x26f692,_0x3026c1,_0x79d90d){return new BPromise(function(_0x31319f,_0xd450da){return client['request'](_0x26f692,_0x79d90d)['then'](function(_0x4f7817){logger['info'](_0x739f('0x10'),_0x3026c1,_0x739f('0x11'));logger[_0x739f('0x12')](_0x739f('0x13'),_0x3026c1,'request\x20sent',JSON[_0x739f('0x14')](_0x4f7817));if(_0x4f7817[_0x739f('0x15')]){if(_0x4f7817['error']['code']===0x1f4){logger[_0x739f('0x15')](_0x739f('0x10'),_0x3026c1,_0x4f7817['error'][_0x739f('0x16')]);return _0xd450da(_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);}logger[_0x739f('0x15')](_0x739f('0x10'),_0x3026c1,_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);return _0x31319f(_0x4f7817[_0x739f('0x15')][_0x739f('0x16')]);}else{logger[_0x739f('0x17')](_0x739f('0x10'),_0x3026c1,'request\x20sent');_0x31319f(_0x4f7817[_0x739f('0x18')][_0x739f('0x16')]);}})[_0x739f('0x19')](function(_0x75ce93){logger[_0x739f('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x3026c1,_0x75ce93);_0xd450da(_0x75ce93);});});}exports[_0x739f('0x1a')]=function(_0x99740a){var _0x21809d=this;return new Promise(function(_0x2b1c6a,_0x1fe19f){return db[_0x739f('0x1b')][_0x739f('0x1c')]({'raw':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x1e')]===undefined?!![]:![]:!![],'where':_0x99740a['options']?_0x99740a[_0x739f('0x1d')][_0x739f('0x1f')]||null:null,'attributes':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')]['attributes']||null:null,'limit':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x20')]||null:null,'include':_0x99740a[_0x739f('0x1d')]?_0x99740a[_0x739f('0x1d')][_0x739f('0x21')]?_[_0x739f('0x22')](_0x99740a[_0x739f('0x1d')]['include'],function(_0xe23881){return{'model':db[_0xe23881[_0x739f('0x23')]],'as':_0xe23881['as'],'attributes':_0xe23881[_0x739f('0x24')],'include':_0xe23881['include']?_[_0x739f('0x22')](_0xe23881[_0x739f('0x21')],function(_0x33a613){return{'model':db[_0x33a613[_0x739f('0x23')]],'as':_0x33a613['as'],'attributes':_0x33a613[_0x739f('0x24')],'include':_0x33a613[_0x739f('0x21')]?_[_0x739f('0x22')](_0x33a613[_0x739f('0x21')],function(_0x4c13be){return{'model':db[_0x4c13be[_0x739f('0x23')]],'as':_0x4c13be['as'],'attributes':_0x4c13be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b003a){logger['info'](_0x739f('0x1a'),_0x99740a);logger[_0x739f('0x12')](_0x739f('0x1a'),_0x99740a,JSON['stringify'](_0x4b003a));_0x2b1c6a(_0x4b003a);})['catch'](function(_0xd0eed2){logger['error']('GetWhatsappQueue',_0xd0eed2[_0x739f('0x16')],_0x99740a);_0x1fe19f(_0x21809d[_0x739f('0x15')](0x1f4,_0xd0eed2['message']));});});};exports[_0x739f('0x25')]=function(_0x2b018e){var _0x513d29=this;return new Promise(function(_0x17eb0e,_0x4a877b){return db[_0x739f('0x1b')][_0x739f('0x26')]({'raw':_0x2b018e['options']?_0x2b018e[_0x739f('0x1d')][_0x739f('0x1e')]===undefined?!![]:![]:!![],'where':_0x2b018e[_0x739f('0x1d')]?_0x2b018e['options'][_0x739f('0x1f')]||null:null,'attributes':_0x2b018e[_0x739f('0x1d')]?_0x2b018e[_0x739f('0x1d')][_0x739f('0x24')]||null:null,'include':_0x2b018e['options']?_0x2b018e['options'][_0x739f('0x21')]?_[_0x739f('0x22')](_0x2b018e['options'][_0x739f('0x21')],function(_0x28a447){return{'model':db[_0x28a447[_0x739f('0x23')]],'as':_0x28a447['as'],'attributes':_0x28a447['attributes'],'include':_0x28a447['include']?_['map'](_0x28a447[_0x739f('0x21')],function(_0x1f60c2){return{'model':db[_0x1f60c2[_0x739f('0x23')]],'as':_0x1f60c2['as'],'attributes':_0x1f60c2[_0x739f('0x24')],'include':_0x1f60c2[_0x739f('0x21')]?_[_0x739f('0x22')](_0x1f60c2[_0x739f('0x21')],function(_0x26ad7f){return{'model':db[_0x26ad7f[_0x739f('0x23')]],'as':_0x26ad7f['as'],'attributes':_0x26ad7f[_0x739f('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e9ac8){logger['info'](_0x739f('0x25'),_0x2b018e);logger[_0x739f('0x12')](_0x739f('0x25'),_0x2b018e,JSON[_0x739f('0x14')](_0x2e9ac8));_0x17eb0e(_0x2e9ac8);})[_0x739f('0x19')](function(_0x3d386b){logger[_0x739f('0x15')](_0x739f('0x25'),_0x3d386b[_0x739f('0x16')],_0x2b018e);_0x4a877b(_0x513d29['error'](0x1f4,_0x3d386b[_0x739f('0x16')]));});});}; \ No newline at end of file +var _0x86f8=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','GetWhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowWhatsappQueue','WhatsappQueue','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','request\x20sent'];(function(_0x3633f6,_0x1f24df){var _0xf501e8=function(_0x77155e){while(--_0x77155e){_0x3633f6['push'](_0x3633f6['shift']());}};_0xf501e8(++_0x1f24df);}(_0x86f8,0x8a));var _0x886f=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x86f8[_0x380307];return _0x9ea14b;};'use strict';var _=require(_0x886f('0x0'));var util=require(_0x886f('0x1'));var moment=require(_0x886f('0x2'));var BPromise=require(_0x886f('0x3'));var rs=require(_0x886f('0x4'));var fs=require('fs');var Redis=require(_0x886f('0x5'));var db=require(_0x886f('0x6'))['db'];var utils=require(_0x886f('0x7'));var logger=require(_0x886f('0x8'))(_0x886f('0x9'));var config=require(_0x886f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x886f('0xb'),'port':0x18eb});var socket=require(_0x886f('0xc'))(new Redis(config[_0x886f('0xd')]));require(_0x886f('0xe'))[_0x886f('0xf')](socket);function respondWithRpcPromise(_0x19c622,_0xf97d39,_0x4ffa7d){return new BPromise(function(_0x505cf1,_0x55e71b){return client[_0x886f('0x10')](_0x19c622,_0x4ffa7d)['then'](function(_0x19ed8b){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0xf97d39,_0x886f('0x11'));logger[_0x886f('0x12')](_0x886f('0x13'),_0xf97d39,'request\x20sent',JSON['stringify'](_0x19ed8b));if(_0x19ed8b[_0x886f('0x14')]){if(_0x19ed8b[_0x886f('0x14')]['code']===0x1f4){logger['error'](_0x886f('0x15'),_0xf97d39,_0x19ed8b[_0x886f('0x14')][_0x886f('0x16')]);return _0x55e71b(_0x19ed8b[_0x886f('0x14')][_0x886f('0x16')]);}logger[_0x886f('0x14')](_0x886f('0x15'),_0xf97d39,_0x19ed8b[_0x886f('0x14')][_0x886f('0x16')]);return _0x505cf1(_0x19ed8b[_0x886f('0x14')][_0x886f('0x16')]);}else{logger[_0x886f('0x17')](_0x886f('0x15'),_0xf97d39,_0x886f('0x11'));_0x505cf1(_0x19ed8b[_0x886f('0x18')][_0x886f('0x16')]);}})[_0x886f('0x19')](function(_0x177f40){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0xf97d39,_0x177f40);_0x55e71b(_0x177f40);});});}exports[_0x886f('0x1a')]=function(_0x4b7100){var _0x1de254=this;return new Promise(function(_0x1ac6e4,_0xf330a2){return db['WhatsappQueue'][_0x886f('0x1b')]({'raw':_0x4b7100[_0x886f('0x1c')]?_0x4b7100[_0x886f('0x1c')][_0x886f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b7100[_0x886f('0x1c')]?_0x4b7100['options']['where']||null:null,'attributes':_0x4b7100[_0x886f('0x1c')]?_0x4b7100[_0x886f('0x1c')][_0x886f('0x1e')]||null:null,'limit':_0x4b7100[_0x886f('0x1c')]?_0x4b7100[_0x886f('0x1c')][_0x886f('0x1f')]||null:null,'include':_0x4b7100[_0x886f('0x1c')]?_0x4b7100[_0x886f('0x1c')][_0x886f('0x20')]?_[_0x886f('0x21')](_0x4b7100[_0x886f('0x1c')][_0x886f('0x20')],function(_0xa2c8aa){return{'model':db[_0xa2c8aa['model']],'as':_0xa2c8aa['as'],'attributes':_0xa2c8aa[_0x886f('0x1e')],'include':_0xa2c8aa[_0x886f('0x20')]?_[_0x886f('0x21')](_0xa2c8aa[_0x886f('0x20')],function(_0x4f98b3){return{'model':db[_0x4f98b3[_0x886f('0x22')]],'as':_0x4f98b3['as'],'attributes':_0x4f98b3[_0x886f('0x1e')],'include':_0x4f98b3[_0x886f('0x20')]?_[_0x886f('0x21')](_0x4f98b3['include'],function(_0x5aa912){return{'model':db[_0x5aa912[_0x886f('0x22')]],'as':_0x5aa912['as'],'attributes':_0x5aa912[_0x886f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3345da){logger[_0x886f('0x17')](_0x886f('0x1a'),_0x4b7100);logger[_0x886f('0x12')]('GetWhatsappQueue',_0x4b7100,JSON[_0x886f('0x23')](_0x3345da));_0x1ac6e4(_0x3345da);})[_0x886f('0x19')](function(_0xba2b77){logger[_0x886f('0x14')](_0x886f('0x1a'),_0xba2b77[_0x886f('0x16')],_0x4b7100);_0xf330a2(_0x1de254['error'](0x1f4,_0xba2b77[_0x886f('0x16')]));});});};exports[_0x886f('0x24')]=function(_0x18c747){var _0x5979fe=this;return new Promise(function(_0x34ff69,_0x3b046b){return db[_0x886f('0x25')]['find']({'raw':_0x18c747['options']?_0x18c747[_0x886f('0x1c')][_0x886f('0x1d')]===undefined?!![]:![]:!![],'where':_0x18c747[_0x886f('0x1c')]?_0x18c747[_0x886f('0x1c')]['where']||null:null,'attributes':_0x18c747[_0x886f('0x1c')]?_0x18c747[_0x886f('0x1c')][_0x886f('0x1e')]||null:null,'include':_0x18c747[_0x886f('0x1c')]?_0x18c747[_0x886f('0x1c')]['include']?_[_0x886f('0x21')](_0x18c747[_0x886f('0x1c')]['include'],function(_0x10d7c3){return{'model':db[_0x10d7c3[_0x886f('0x22')]],'as':_0x10d7c3['as'],'attributes':_0x10d7c3['attributes'],'include':_0x10d7c3[_0x886f('0x20')]?_[_0x886f('0x21')](_0x10d7c3[_0x886f('0x20')],function(_0x3ced34){return{'model':db[_0x3ced34[_0x886f('0x22')]],'as':_0x3ced34['as'],'attributes':_0x3ced34['attributes'],'include':_0x3ced34['include']?_[_0x886f('0x21')](_0x3ced34[_0x886f('0x20')],function(_0xf41f30){return{'model':db[_0xf41f30['model']],'as':_0xf41f30['as'],'attributes':_0xf41f30[_0x886f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x886f('0x26')](function(_0x2e780c){logger['info'](_0x886f('0x24'),_0x18c747);logger[_0x886f('0x12')]('ShowWhatsappQueue',_0x18c747,JSON['stringify'](_0x2e780c));_0x34ff69(_0x2e780c);})[_0x886f('0x19')](function(_0x466f16){logger[_0x886f('0x14')](_0x886f('0x24'),_0x466f16[_0x886f('0x16')],_0x18c747);_0x3b046b(_0x5979fe['error'](0x1f4,_0x466f16['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6fb768b..c1bd999 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fca=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener'];(function(_0x27e46f,_0x52bd32){var _0x5d090a=function(_0x55e302){while(--_0x55e302){_0x27e46f['push'](_0x27e46f['shift']());}};_0x5d090a(++_0x52bd32);}(_0x7fca,0x102));var _0xa7fc=function(_0x36ca5e,_0x532649){_0x36ca5e=_0x36ca5e-0x0;var _0x185857=_0x7fca[_0x36ca5e];return _0x185857;};'use strict';var WhatsappQueueEvents=require(_0xa7fc('0x0'));var events=[_0xa7fc('0x1'),_0xa7fc('0x2'),_0xa7fc('0x3')];function createListener(_0x27bfc6,_0x4e7f13){return function(_0x5b13ce){_0x4e7f13[_0xa7fc('0x4')](_0x27bfc6,_0x5b13ce);};}function removeListener(_0x2393c2,_0x433eec){return function(){WhatsappQueueEvents[_0xa7fc('0x5')](_0x2393c2,_0x433eec);};}exports['register']=function(_0x387178){for(var _0x2d5722=0x0,_0x26f534=events[_0xa7fc('0x6')];_0x2d5722<_0x26f534;_0x2d5722++){var _0x727943=events[_0x2d5722];var _0x2f4ecd=createListener(_0xa7fc('0x7')+_0x727943,_0x387178);WhatsappQueueEvents['on'](_0x727943,_0x2f4ecd);}}; \ No newline at end of file +var _0x792d=['save','remove','update','emit','removeListener','whatsappQueue:','./whatsappQueue.events'];(function(_0x5f2c63,_0x21b45e){var _0x564222=function(_0x27c557){while(--_0x27c557){_0x5f2c63['push'](_0x5f2c63['shift']());}};_0x564222(++_0x21b45e);}(_0x792d,0x14f));var _0xd792=function(_0x1f3fb7,_0x3589b2){_0x1f3fb7=_0x1f3fb7-0x0;var _0x1c966d=_0x792d[_0x1f3fb7];return _0x1c966d;};'use strict';var WhatsappQueueEvents=require(_0xd792('0x0'));var events=[_0xd792('0x1'),_0xd792('0x2'),_0xd792('0x3')];function createListener(_0x538e77,_0x2cc0e9){return function(_0xfcd8a){_0x2cc0e9[_0xd792('0x4')](_0x538e77,_0xfcd8a);};}function removeListener(_0x4c4229,_0x1b61e7){return function(){WhatsappQueueEvents[_0xd792('0x5')](_0x4c4229,_0x1b61e7);};}exports['register']=function(_0x30b133){for(var _0xd54e34=0x0,_0x3cbc3d=events['length'];_0xd54e34<_0x3cbc3d;_0xd54e34++){var _0x943276=events[_0xd54e34];var _0x4fe1d6=createListener(_0xd792('0x6')+_0x943276,_0x30b133);WhatsappQueueEvents['on'](_0x943276,_0x4fe1d6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e5948be..1b34ac8 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43e7=['connect-timeout','express','Router','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','describe','show','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x89ee74,_0x360343){var _0x2fe465=function(_0x2085bb){while(--_0x2085bb){_0x89ee74['push'](_0x89ee74['shift']());}};_0x2fe465(++_0x360343);}(_0x43e7,0x153));var _0x743e=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x43e7[_0x14a862];return _0x245eb5;};'use strict';var multer=require(_0x743e('0x0'));var util=require(_0x743e('0x1'));var path=require(_0x743e('0x2'));var timeout=require(_0x743e('0x3'));var express=require(_0x743e('0x4'));var router=express[_0x743e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x743e('0x6'));var controller=require(_0x743e('0x7'));router['get']('/',auth[_0x743e('0x8')](),controller[_0x743e('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x743e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x743e('0xb')]);router[_0x743e('0xc')]('/',auth[_0x743e('0x8')](),controller[_0x743e('0xd')]);router[_0x743e('0xe')](_0x743e('0xf'),auth[_0x743e('0x8')](),controller['update']);router[_0x743e('0x10')](_0x743e('0xf'),auth[_0x743e('0x8')](),controller['destroy']);module[_0x743e('0x11')]=router; \ No newline at end of file +var _0xf991=['/:id','show','post','create','put','update','delete','util','path','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0xee4a44,_0x2757ed){var _0x2713c4=function(_0x50b097){while(--_0x50b097){_0xee4a44['push'](_0xee4a44['shift']());}};_0x2713c4(++_0x2757ed);}(_0xf991,0x14a));var _0x1f99=function(_0x36856f,_0x98b59e){_0x36856f=_0x36856f-0x0;var _0x43ac52=_0xf991[_0x36856f];return _0x43ac52;};'use strict';var multer=require('multer');var util=require(_0x1f99('0x0'));var path=require(_0x1f99('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1f99('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1f99('0x3'));var config=require(_0x1f99('0x4'));var controller=require(_0x1f99('0x5'));router[_0x1f99('0x6')]('/',auth[_0x1f99('0x7')](),controller['index']);router['get'](_0x1f99('0x8'),auth[_0x1f99('0x7')](),controller[_0x1f99('0x9')]);router[_0x1f99('0x6')](_0x1f99('0xa'),auth[_0x1f99('0x7')](),controller[_0x1f99('0xb')]);router[_0x1f99('0xc')]('/',auth[_0x1f99('0x7')](),controller[_0x1f99('0xd')]);router[_0x1f99('0xe')](_0x1f99('0xa'),auth[_0x1f99('0x7')](),controller[_0x1f99('0xf')]);router[_0x1f99('0x10')]('/:id',auth[_0x1f99('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index dcdac83..3df0b6e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x34ff66,_0x4856bd){var _0x13973f=function(_0x5ca67c){while(--_0x5ca67c){_0x34ff66['push'](_0x34ff66['shift']());}};_0x13973f(++_0x4856bd);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4edc4d,_0x49e161){var _0x5e882c=function(_0x1368ca){while(--_0x1368ca){_0x4edc4d['push'](_0x4edc4d['shift']());}};_0x5e882c(++_0x49e161);}(_0x7a54,0x106));var _0x47a5=function(_0x367e68,_0x9cd41b){_0x367e68=_0x367e68-0x0;var _0x55c4e8=_0x7a54[_0x367e68];return _0x55c4e8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index d3e5b54..c693b5e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f8c=['end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4e7f4f,_0x1817d5){_0x4e7f4f=_0x4e7f4f-0x0;var _0x55ca67=_0x3f8c[_0x4e7f4f];return _0x55ca67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4569c2,_0x327b2d){return function(_0x2d237e){if(!_0x2d237e){_0x4569c2[_0xc3f8('0x16')](0x194);}return _0x2d237e;};}function handleError(_0x25088f,_0x9d43b4){_0x9d43b4=_0x9d43b4||0x1f4;return function(_0xf1d460){logger[_0xc3f8('0x22')](_0xf1d460[_0xc3f8('0x23')]);if(_0xf1d460[_0xc3f8('0x24')]){delete _0xf1d460[_0xc3f8('0x24')];}_0x25088f[_0xc3f8('0x17')](_0x9d43b4)[_0xc3f8('0x25')](_0xf1d460);};}exports[_0xc3f8('0x26')]=function(_0x59e4dd,_0x58b303){var _0x2909f8={},_0x218029={},_0x5bf6e2={'count':0x0,'rows':[]};var _0x151bba=_['map'](db[_0xc3f8('0x27')][_0xc3f8('0x28')],function(_0x47ab53){return{'name':_0x47ab53['fieldName'],'type':_0x47ab53[_0xc3f8('0x29')][_0xc3f8('0x2a')]};});_0x218029[_0xc3f8('0x2b')]=_[_0xc3f8('0x2c')](_0x151bba,_0xc3f8('0x24'));_0x218029[_0xc3f8('0x2d')]=_[_0xc3f8('0x2e')](_0x59e4dd[_0xc3f8('0x2d')]);_0x218029[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x218029['model'],_0x218029[_0xc3f8('0x2d')]);_0x2909f8[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x218029[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x59e4dd['query']['fields']));_0x2909f8[_0xc3f8('0x31')]=_0x2909f8[_0xc3f8('0x31')][_0xc3f8('0x33')]?_0x2909f8[_0xc3f8('0x31')]:_0x218029[_0xc3f8('0x2b')];if(!_0x59e4dd['query'][_0xc3f8('0x34')](_0xc3f8('0x35'))){_0x2909f8[_0xc3f8('0x1b')]=qs['limit'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1b')]);_0x2909f8[_0xc3f8('0x1a')]=qs['offset'](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x1a')]);}_0x2909f8['order']=qs[_0xc3f8('0x36')](_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x36')]);_0x2909f8[_0xc3f8('0x37')]=qs[_0xc3f8('0x2f')](_[_0xc3f8('0x38')](_0x59e4dd['query'],_0x218029[_0xc3f8('0x2f')]),_0x151bba);if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]){_0x2909f8[_0xc3f8('0x37')]=_[_0xc3f8('0x3a')](_0x2909f8['where'],{'$or':_[_0xc3f8('0x2c')](_0x151bba,function(_0x4451a2){if(_0x4451a2[_0xc3f8('0x29')]!=='VIRTUAL'){var _0x316643={};_0x316643[_0x4451a2[_0xc3f8('0x24')]]={'$like':'%'+_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x39')]+'%'};return _0x316643;}})});}_0x2909f8=_['merge']({},_0x2909f8,_0x59e4dd[_0xc3f8('0x3b')]);var _0x45d416={'where':_0x2909f8[_0xc3f8('0x37')]};return db[_0xc3f8('0x27')]['count'](_0x45d416)[_0xc3f8('0x21')](function(_0x5db44d){_0x5bf6e2['count']=_0x5db44d;if(_0x59e4dd[_0xc3f8('0x2d')][_0xc3f8('0x3c')]){_0x2909f8[_0xc3f8('0x3d')]=[{'all':!![]}];}return db[_0xc3f8('0x27')]['findAll'](_0x2909f8);})['then'](function(_0x361a85){_0x5bf6e2[_0xc3f8('0x3e')]=_0x361a85;return _0x5bf6e2;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x58b303,_0x2909f8))[_0xc3f8('0x3f')](handleError(_0x58b303,null));};exports[_0xc3f8('0x40')]=function(_0x465547,_0x3113b4){var _0x45e6ea={'raw':!![],'where':{'id':_0x465547[_0xc3f8('0x41')]['id']}},_0x13d8dc={};_0x13d8dc[_0xc3f8('0x2b')]=_['keys'](db[_0xc3f8('0x27')][_0xc3f8('0x28')]);_0x13d8dc['query']=_[_0xc3f8('0x2e')](_0x465547[_0xc3f8('0x2d')]);_0x13d8dc['filters']=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],_0x13d8dc[_0xc3f8('0x2d')]);_0x45e6ea[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](_0x13d8dc[_0xc3f8('0x2b')],qs[_0xc3f8('0x32')](_0x465547[_0xc3f8('0x2d')][_0xc3f8('0x32')]));_0x45e6ea[_0xc3f8('0x31')]=_0x45e6ea[_0xc3f8('0x31')]['length']?_0x45e6ea[_0xc3f8('0x31')]:_0x13d8dc[_0xc3f8('0x2b')];if(_0x465547['query'][_0xc3f8('0x3c')]){_0x45e6ea[_0xc3f8('0x3d')]=[{'all':!![]}];}_0x45e6ea=_[_0xc3f8('0x3a')]({},_0x45e6ea,_0x465547[_0xc3f8('0x3b')]);return db['WhatsappQueueReport']['find'](_0x45e6ea)[_0xc3f8('0x21')](handleEntityNotFound(_0x3113b4,null))[_0xc3f8('0x21')](respondWithResult(_0x3113b4,null))[_0xc3f8('0x3f')](handleError(_0x3113b4,null));};exports['create']=function(_0x1b5777,_0x3a665e){return db[_0xc3f8('0x27')][_0xc3f8('0x42')](_0x1b5777[_0xc3f8('0x43')],{})['then'](respondWithResult(_0x3a665e,0xc9))[_0xc3f8('0x3f')](handleError(_0x3a665e,null));};exports[_0xc3f8('0x20')]=function(_0x5961ab,_0x1becae){if(_0x5961ab[_0xc3f8('0x43')]['id']){delete _0x5961ab[_0xc3f8('0x43')]['id'];}return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x5961ab[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x1becae,null))['then'](saveUpdates(_0x5961ab[_0xc3f8('0x43')],null))[_0xc3f8('0x21')](respondWithResult(_0x1becae,null))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x45')]=function(_0x2e9f93,_0x2448bf){return db[_0xc3f8('0x27')][_0xc3f8('0x44')]({'where':{'id':_0x2e9f93[_0xc3f8('0x41')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0x2448bf,null))['then'](removeEntity(_0x2448bf,null))[_0xc3f8('0x3f')](handleError(_0x2448bf,null));};exports[_0xc3f8('0x46')]=function(_0x425fee,_0x267c95){return db[_0xc3f8('0x27')][_0xc3f8('0x46')]()[_0xc3f8('0x21')](respondWithResult(_0x267c95,null))[_0xc3f8('0x3f')](handleError(_0x267c95,null));}; \ No newline at end of file +var _0xdb94=['length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields'];(function(_0x5afa5a,_0x1f8613){var _0x85d8b1=function(_0x51c5f0){while(--_0x51c5f0){_0x5afa5a['push'](_0x5afa5a['shift']());}};_0x85d8b1(++_0x1f8613);}(_0xdb94,0xab));var _0x4db9=function(_0x53ea44,_0x59a5d1){_0x53ea44=_0x53ea44-0x0;var _0x168fcb=_0xdb94[_0x53ea44];return _0x168fcb;};'use strict';var emlformat=require(_0x4db9('0x0'));var rimraf=require(_0x4db9('0x1'));var zipdir=require(_0x4db9('0x2'));var jsonpatch=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var moment=require('moment');var BPromise=require(_0x4db9('0x5'));var Mustache=require(_0x4db9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4db9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4db9('0x8'));var _=require('lodash');var squel=require(_0x4db9('0x9'));var crypto=require('crypto');var jsforce=require(_0x4db9('0xa'));var deskjs=require(_0x4db9('0xb'));var toCsv=require(_0x4db9('0xc'));var querystring=require(_0x4db9('0xd'));var Papa=require(_0x4db9('0xe'));var Redis=require(_0x4db9('0xf'));var authService=require(_0x4db9('0x10'));var qs=require(_0x4db9('0x11'));var as=require(_0x4db9('0x12'));var hardwareService=require(_0x4db9('0x13'));var logger=require(_0x4db9('0x14'))('api');var utils=require(_0x4db9('0x15'));var config=require(_0x4db9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31222b,_0x5e644c){_0x5e644c=_0x5e644c||0xcc;return function(_0x571685){if(_0x571685){return _0x31222b[_0x4db9('0x17')](_0x5e644c);}return _0x31222b[_0x4db9('0x18')](_0x5e644c)['end']();};}function respondWithResult(_0xd37d63,_0x1f9638){_0x1f9638=_0x1f9638||0xc8;return function(_0x452896){if(_0x452896){return _0xd37d63[_0x4db9('0x18')](_0x1f9638)['json'](_0x452896);}};}function respondWithFilteredResult(_0x5e04ab,_0x102274){return function(_0x34de1a){if(_0x34de1a){var _0x4a037f=typeof _0x102274[_0x4db9('0x19')]===_0x4db9('0x1a')&&typeof _0x102274['limit']==='undefined';var _0x250a80=_0x34de1a[_0x4db9('0x1b')];var _0x462af3=_0x4a037f?0x0:_0x102274[_0x4db9('0x19')];var _0x1d3c33=_0x4a037f?_0x34de1a['count']:_0x102274[_0x4db9('0x19')]+_0x102274[_0x4db9('0x1c')];var _0x11012e;if(_0x1d3c33>=_0x250a80){_0x1d3c33=_0x250a80;_0x11012e=0xc8;}else{_0x11012e=0xce;}_0x5e04ab['status'](_0x11012e);return _0x5e04ab[_0x4db9('0x1d')](_0x4db9('0x1e'),_0x462af3+'-'+_0x1d3c33+'/'+_0x250a80)[_0x4db9('0x1f')](_0x34de1a);}return null;};}function patchUpdates(_0x4c92e8){return function(_0x46b522){try{jsonpatch[_0x4db9('0x20')](_0x46b522,_0x4c92e8,!![]);}catch(_0x4553c2){return BPromise[_0x4db9('0x21')](_0x4553c2);}return _0x46b522[_0x4db9('0x22')]();};}function saveUpdates(_0x159d9b,_0x3585d5){return function(_0x5aef3b){if(_0x5aef3b){return _0x5aef3b[_0x4db9('0x23')](_0x159d9b)[_0x4db9('0x24')](function(_0xcde40c){return _0xcde40c;});}return null;};}function removeEntity(_0x319475,_0x4aaa84){return function(_0x213daa){if(_0x213daa){return _0x213daa[_0x4db9('0x25')]()['then'](function(){_0x319475[_0x4db9('0x18')](0xcc)[_0x4db9('0x26')]();});}};}function handleEntityNotFound(_0x2987c6,_0x4dbb1b){return function(_0x3c8237){if(!_0x3c8237){_0x2987c6[_0x4db9('0x17')](0x194);}return _0x3c8237;};}function handleError(_0x43b95e,_0x2d330e){_0x2d330e=_0x2d330e||0x1f4;return function(_0x3f9f7e){logger[_0x4db9('0x27')](_0x3f9f7e[_0x4db9('0x28')]);if(_0x3f9f7e[_0x4db9('0x29')]){delete _0x3f9f7e[_0x4db9('0x29')];}_0x43b95e[_0x4db9('0x18')](_0x2d330e)[_0x4db9('0x2a')](_0x3f9f7e);};}exports[_0x4db9('0x2b')]=function(_0x2d646d,_0x20f133){var _0x583861={},_0x5031fe={},_0x3951b2={'count':0x0,'rows':[]};var _0x331279=_[_0x4db9('0x2c')](db[_0x4db9('0x2d')][_0x4db9('0x2e')],function(_0x459131){return{'name':_0x459131['fieldName'],'type':_0x459131[_0x4db9('0x2f')]['key']};});_0x5031fe[_0x4db9('0x30')]=_[_0x4db9('0x2c')](_0x331279,_0x4db9('0x29'));_0x5031fe[_0x4db9('0x31')]=_[_0x4db9('0x32')](_0x2d646d['query']);_0x5031fe['filters']=_[_0x4db9('0x33')](_0x5031fe['model'],_0x5031fe[_0x4db9('0x31')]);_0x583861[_0x4db9('0x34')]=_['intersection'](_0x5031fe[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x2d646d[_0x4db9('0x31')]['fields']));_0x583861[_0x4db9('0x34')]=_0x583861['attributes'][_0x4db9('0x36')]?_0x583861[_0x4db9('0x34')]:_0x5031fe[_0x4db9('0x30')];if(!_0x2d646d['query']['hasOwnProperty'](_0x4db9('0x37'))){_0x583861[_0x4db9('0x1c')]=qs[_0x4db9('0x1c')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x1c')]);_0x583861[_0x4db9('0x19')]=qs[_0x4db9('0x19')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x19')]);}_0x583861['order']=qs[_0x4db9('0x38')](_0x2d646d[_0x4db9('0x31')][_0x4db9('0x38')]);_0x583861[_0x4db9('0x39')]=qs['filters'](_[_0x4db9('0x3a')](_0x2d646d[_0x4db9('0x31')],_0x5031fe[_0x4db9('0x3b')]),_0x331279);if(_0x2d646d['query'][_0x4db9('0x3c')]){_0x583861[_0x4db9('0x39')]=_[_0x4db9('0x3d')](_0x583861[_0x4db9('0x39')],{'$or':_['map'](_0x331279,function(_0x5a78b4){if(_0x5a78b4[_0x4db9('0x2f')]!==_0x4db9('0x3e')){var _0x32e62b={};_0x32e62b[_0x5a78b4[_0x4db9('0x29')]]={'$like':'%'+_0x2d646d[_0x4db9('0x31')]['filter']+'%'};return _0x32e62b;}})});}_0x583861=_[_0x4db9('0x3d')]({},_0x583861,_0x2d646d[_0x4db9('0x3f')]);var _0x23affc={'where':_0x583861[_0x4db9('0x39')]};return db[_0x4db9('0x2d')]['count'](_0x23affc)[_0x4db9('0x24')](function(_0x324765){_0x3951b2[_0x4db9('0x1b')]=_0x324765;if(_0x2d646d['query'][_0x4db9('0x40')]){_0x583861[_0x4db9('0x41')]=[{'all':!![]}];}return db[_0x4db9('0x2d')][_0x4db9('0x42')](_0x583861);})[_0x4db9('0x24')](function(_0x24aa2a){_0x3951b2[_0x4db9('0x43')]=_0x24aa2a;return _0x3951b2;})[_0x4db9('0x24')](respondWithFilteredResult(_0x20f133,_0x583861))[_0x4db9('0x44')](handleError(_0x20f133,null));};exports[_0x4db9('0x45')]=function(_0x4bb740,_0x56bd68){var _0x48aaf5={'raw':!![],'where':{'id':_0x4bb740[_0x4db9('0x46')]['id']}},_0x22a021={};_0x22a021['model']=_[_0x4db9('0x32')](db[_0x4db9('0x2d')]['rawAttributes']);_0x22a021['query']=_[_0x4db9('0x32')](_0x4bb740['query']);_0x22a021[_0x4db9('0x3b')]=_[_0x4db9('0x33')](_0x22a021['model'],_0x22a021[_0x4db9('0x31')]);_0x48aaf5[_0x4db9('0x34')]=_['intersection'](_0x22a021[_0x4db9('0x30')],qs[_0x4db9('0x35')](_0x4bb740[_0x4db9('0x31')]['fields']));_0x48aaf5['attributes']=_0x48aaf5[_0x4db9('0x34')][_0x4db9('0x36')]?_0x48aaf5[_0x4db9('0x34')]:_0x22a021[_0x4db9('0x30')];if(_0x4bb740[_0x4db9('0x31')][_0x4db9('0x40')]){_0x48aaf5[_0x4db9('0x41')]=[{'all':!![]}];}_0x48aaf5=_[_0x4db9('0x3d')]({},_0x48aaf5,_0x4bb740[_0x4db9('0x3f')]);return db[_0x4db9('0x2d')][_0x4db9('0x47')](_0x48aaf5)[_0x4db9('0x24')](handleEntityNotFound(_0x56bd68,null))[_0x4db9('0x24')](respondWithResult(_0x56bd68,null))['catch'](handleError(_0x56bd68,null));};exports[_0x4db9('0x48')]=function(_0x2faacf,_0x3852f0){return db[_0x4db9('0x2d')][_0x4db9('0x48')](_0x2faacf[_0x4db9('0x49')],{})[_0x4db9('0x24')](respondWithResult(_0x3852f0,0xc9))[_0x4db9('0x44')](handleError(_0x3852f0,null));};exports[_0x4db9('0x23')]=function(_0x2d6094,_0x10dccb){if(_0x2d6094['body']['id']){delete _0x2d6094['body']['id'];}return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0x2d6094[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0x10dccb,null))[_0x4db9('0x24')](saveUpdates(_0x2d6094[_0x4db9('0x49')],null))[_0x4db9('0x24')](respondWithResult(_0x10dccb,null))[_0x4db9('0x44')](handleError(_0x10dccb,null));};exports['destroy']=function(_0xd8eae3,_0xcb832e){return db[_0x4db9('0x2d')][_0x4db9('0x47')]({'where':{'id':_0xd8eae3[_0x4db9('0x46')]['id']}})[_0x4db9('0x24')](handleEntityNotFound(_0xcb832e,null))[_0x4db9('0x24')](removeEntity(_0xcb832e,null))[_0x4db9('0x44')](handleError(_0xcb832e,null));};exports['describe']=function(_0x45bc79,_0xd6701a){return db[_0x4db9('0x2d')][_0x4db9('0x4a')]()[_0x4db9('0x24')](respondWithResult(_0xd6701a,null))[_0x4db9('0x44')](handleError(_0xd6701a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4f796cc..0edd5f4 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad20=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0x4d8a09,_0x4c6992){var _0x2378e5=function(_0xd557f4){while(--_0xd557f4){_0x4d8a09['push'](_0x4d8a09['shift']());}};_0x2378e5(++_0x4c6992);}(_0xad20,0x1c3));var _0x0ad2=function(_0x22cb15,_0xd19206){_0x22cb15=_0x22cb15-0x0;var _0x3844b4=_0xad20[_0x22cb15];return _0x3844b4;};'use strict';var _=require(_0x0ad2('0x0'));var util=require('util');var logger=require(_0x0ad2('0x1'))(_0x0ad2('0x2'));var moment=require('moment');var BPromise=require(_0x0ad2('0x3'));var rp=require(_0x0ad2('0x4'));var fs=require('fs');var path=require(_0x0ad2('0x5'));var rimraf=require(_0x0ad2('0x6'));var config=require(_0x0ad2('0x7'));var attributes=require(_0x0ad2('0x8'));module[_0x0ad2('0x9')]=function(_0x30e18f,_0x35eb44){return _0x30e18f[_0x0ad2('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0x0ad2('0xb'),'paranoid':![],'indexes':[{'name':_0x0ad2('0xc'),'fields':[_0x0ad2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa10f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x1c12e0,_0x49f158){var _0x23fa6e=function(_0x30ddec){while(--_0x30ddec){_0x1c12e0['push'](_0x1c12e0['shift']());}};_0x23fa6e(++_0x49f158);}(_0xa10f,0x11c));var _0xfa10=function(_0x3a6e91,_0x34ff2c){_0x3a6e91=_0x3a6e91-0x0;var _0x36dee5=_0xa10f[_0x3a6e91];return _0x36dee5;};'use strict';var _=require(_0xfa10('0x0'));var util=require(_0xfa10('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfa10('0x2'));var BPromise=require(_0xfa10('0x3'));var rp=require(_0xfa10('0x4'));var fs=require('fs');var path=require(_0xfa10('0x5'));var rimraf=require(_0xfa10('0x6'));var config=require(_0xfa10('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x49c76e,_0x7353db){return _0x49c76e[_0xfa10('0x8')](_0xfa10('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xfa10('0xa'),'fields':[_0xfa10('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1ae360d..9b4c5b9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1720=['info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2aac40,_0x32e7b6){var _0x3fadbb=function(_0x33b429){while(--_0x33b429){_0x2aac40['push'](_0x2aac40['shift']());}};_0x3fadbb(++_0x32e7b6);}(_0x1720,0x98));var _0x0172=function(_0x5938a9,_0x222a6c){_0x5938a9=_0x5938a9-0x0;var _0x364324=_0x1720[_0x5938a9];return _0x364324;};'use strict';var _=require(_0x0172('0x0'));var util=require(_0x0172('0x1'));var moment=require('moment');var BPromise=require(_0x0172('0x2'));var rs=require(_0x0172('0x3'));var fs=require('fs');var Redis=require(_0x0172('0x4'));var db=require(_0x0172('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0172('0x6'))(_0x0172('0x7'));var config=require('../../config/environment');var jayson=require(_0x0172('0x8'));var client=jayson[_0x0172('0x9')][_0x0172('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6d3a,_0x47b5c9,_0x4542e8){return new BPromise(function(_0x5bc825,_0x50fcce){return client[_0x0172('0xb')](_0x4f6d3a,_0x4542e8)[_0x0172('0xc')](function(_0x5bd92c){logger[_0x0172('0xd')](_0x0172('0xe'),_0x47b5c9,'request\x20sent');logger['debug'](_0x0172('0xf'),_0x47b5c9,_0x0172('0x10'),JSON[_0x0172('0x11')](_0x5bd92c));if(_0x5bd92c[_0x0172('0x12')]){if(_0x5bd92c[_0x0172('0x12')][_0x0172('0x13')]===0x1f4){logger['error'](_0x0172('0xe'),_0x47b5c9,_0x5bd92c[_0x0172('0x12')][_0x0172('0x14')]);return _0x50fcce(_0x5bd92c['error']['message']);}logger['error'](_0x0172('0xe'),_0x47b5c9,_0x5bd92c[_0x0172('0x12')]['message']);return _0x5bc825(_0x5bd92c[_0x0172('0x12')][_0x0172('0x14')]);}else{logger[_0x0172('0xd')](_0x0172('0xe'),_0x47b5c9,'request\x20sent');_0x5bc825(_0x5bd92c[_0x0172('0x15')][_0x0172('0x14')]);}})[_0x0172('0x16')](function(_0x846793){logger[_0x0172('0x12')](_0x0172('0xe'),_0x47b5c9,_0x846793);_0x50fcce(_0x846793);});});}exports[_0x0172('0x17')]=function(_0x3c17d2){var _0x462dea=this;return new Promise(function(_0x369813,_0x3f6c54){return db[_0x0172('0x18')]['create'](_0x3c17d2[_0x0172('0x19')],{'raw':_0x3c17d2[_0x0172('0x1a')]?_0x3c17d2[_0x0172('0x1a')][_0x0172('0x1b')]===undefined?!![]:![]:!![]})[_0x0172('0xc')](function(_0x18de3e){logger[_0x0172('0xd')](_0x0172('0x17'),_0x3c17d2);logger['debug'](_0x0172('0x17'),_0x3c17d2,JSON['stringify'](_0x18de3e));_0x369813(_0x18de3e);})['catch'](function(_0x60adf9){logger[_0x0172('0x12')](_0x0172('0x17'),_0x60adf9[_0x0172('0x14')],_0x3c17d2);_0x3f6c54(_0x462dea[_0x0172('0x12')](0x1f4,_0x60adf9[_0x0172('0x14')]));});});};exports[_0x0172('0x1c')]=function(_0x923c2b){var _0x350c95=this;return new Promise(function(_0x439c8e,_0x12eae2){return db['WhatsappQueueReport'][_0x0172('0x1d')](_0x923c2b[_0x0172('0x19')],{'raw':_0x923c2b[_0x0172('0x1a')]?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x923c2b['options']?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1e')]||null:null,'attributes':_0x923c2b[_0x0172('0x1a')]?_0x923c2b[_0x0172('0x1a')]['attributes']||null:null,'limit':_0x923c2b['options']?_0x923c2b[_0x0172('0x1a')][_0x0172('0x1f')]||null:null})[_0x0172('0xc')](function(_0x3c3cd3){logger[_0x0172('0xd')](_0x0172('0x1c'),_0x923c2b);logger[_0x0172('0x20')](_0x0172('0x1c'),_0x923c2b,JSON[_0x0172('0x11')](_0x3c3cd3));_0x439c8e(_0x3c3cd3);})[_0x0172('0x16')](function(_0x53cd16){logger[_0x0172('0x12')](_0x0172('0x1c'),_0x53cd16[_0x0172('0x14')],_0x923c2b);_0x12eae2(_0x350c95['error'](0x1f4,_0x53cd16[_0x0172('0x14')]));});});}; \ No newline at end of file +var _0xd82e=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','update','where','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then'];(function(_0x2f1df2,_0x38e07d){var _0x4fcbbe=function(_0x7f575e){while(--_0x7f575e){_0x2f1df2['push'](_0x2f1df2['shift']());}};_0x4fcbbe(++_0x38e07d);}(_0xd82e,0x10c));var _0xed82=function(_0x5480e7,_0x84f064){_0x5480e7=_0x5480e7-0x0;var _0x55c880=_0xd82e[_0x5480e7];return _0x55c880;};'use strict';var _=require('lodash');var util=require(_0xed82('0x0'));var moment=require(_0xed82('0x1'));var BPromise=require(_0xed82('0x2'));var rs=require(_0xed82('0x3'));var fs=require('fs');var Redis=require(_0xed82('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed82('0x5'));var config=require(_0xed82('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed82('0x7')][_0xed82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bbd62,_0x494aba,_0x34822b){return new BPromise(function(_0x2dd32b,_0x50c68a){return client[_0xed82('0x9')](_0x4bbd62,_0x34822b)[_0xed82('0xa')](function(_0xa87ee4){logger[_0xed82('0xb')](_0xed82('0xc'),_0x494aba,_0xed82('0xd'));logger[_0xed82('0xe')](_0xed82('0xf'),_0x494aba,_0xed82('0xd'),JSON[_0xed82('0x10')](_0xa87ee4));if(_0xa87ee4['error']){if(_0xa87ee4['error'][_0xed82('0x11')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x494aba,_0xa87ee4[_0xed82('0x12')][_0xed82('0x13')]);return _0x50c68a(_0xa87ee4[_0xed82('0x12')]['message']);}logger[_0xed82('0x12')](_0xed82('0xc'),_0x494aba,_0xa87ee4[_0xed82('0x12')][_0xed82('0x13')]);return _0x2dd32b(_0xa87ee4[_0xed82('0x12')][_0xed82('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x494aba,'request\x20sent');_0x2dd32b(_0xa87ee4[_0xed82('0x14')][_0xed82('0x13')]);}})[_0xed82('0x15')](function(_0x169b9d){logger['error'](_0xed82('0xc'),_0x494aba,_0x169b9d);_0x50c68a(_0x169b9d);});});}exports['CreateWhatsappQueueReport']=function(_0x4d2610){var _0x4749a0=this;return new Promise(function(_0xf4f007,_0x8a6b4b){return db[_0xed82('0x16')]['create'](_0x4d2610[_0xed82('0x17')],{'raw':_0x4d2610[_0xed82('0x18')]?_0x4d2610[_0xed82('0x18')][_0xed82('0x19')]===undefined?!![]:![]:!![]})[_0xed82('0xa')](function(_0x212fe5){logger[_0xed82('0xb')](_0xed82('0x1a'),_0x4d2610);logger[_0xed82('0xe')](_0xed82('0x1a'),_0x4d2610,JSON[_0xed82('0x10')](_0x212fe5));_0xf4f007(_0x212fe5);})['catch'](function(_0x3aae6){logger[_0xed82('0x12')](_0xed82('0x1a'),_0x3aae6[_0xed82('0x13')],_0x4d2610);_0x8a6b4b(_0x4749a0[_0xed82('0x12')](0x1f4,_0x3aae6[_0xed82('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x262375){var _0x3bc14c=this;return new Promise(function(_0x46358f,_0x256d48){return db[_0xed82('0x16')][_0xed82('0x1b')](_0x262375[_0xed82('0x17')],{'raw':_0x262375[_0xed82('0x18')]?_0x262375[_0xed82('0x18')][_0xed82('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x262375[_0xed82('0x18')]?_0x262375[_0xed82('0x18')][_0xed82('0x1c')]||null:null,'attributes':_0x262375['options']?_0x262375[_0xed82('0x18')]['attributes']||null:null,'limit':_0x262375[_0xed82('0x18')]?_0x262375['options'][_0xed82('0x1d')]||null:null})['then'](function(_0x2bf725){logger[_0xed82('0xb')](_0xed82('0x1e'),_0x262375);logger['debug'](_0xed82('0x1e'),_0x262375,JSON[_0xed82('0x10')](_0x2bf725));_0x46358f(_0x2bf725);})[_0xed82('0x15')](function(_0x38b2ff){logger[_0xed82('0x12')](_0xed82('0x1e'),_0x38b2ff[_0xed82('0x13')],_0x262375);_0x256d48(_0x3bc14c[_0xed82('0x12')](0x1f4,_0x38b2ff[_0xed82('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 23817a6..37463e7 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69ce=['/describe','describe','/:id','create','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x50fe15,_0xc88085){var _0x54f33e=function(_0x393aec){while(--_0x393aec){_0x50fe15['push'](_0x50fe15['shift']());}};_0x54f33e(++_0xc88085);}(_0x69ce,0x1c1));var _0xe69c=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x69ce[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xe69c('0x0'));var util=require('util');var path=require(_0xe69c('0x1'));var timeout=require('connect-timeout');var express=require(_0xe69c('0x2'));var router=express[_0xe69c('0x3')]();var fs_extra=require(_0xe69c('0x4'));var auth=require(_0xe69c('0x5'));var interaction=require(_0xe69c('0x6'));var config=require(_0xe69c('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xe69c('0x8')]('/',auth[_0xe69c('0x9')](),controller['index']);router[_0xe69c('0x8')](_0xe69c('0xa'),auth[_0xe69c('0x9')](),controller[_0xe69c('0xb')]);router[_0xe69c('0x8')](_0xe69c('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe69c('0x9')](),controller[_0xe69c('0xd')]);router[_0xe69c('0xe')](_0xe69c('0xc'),auth[_0xe69c('0x9')](),controller[_0xe69c('0xf')]);router[_0xe69c('0x10')](_0xe69c('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19c2=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','put','update','delete','destroy','exports'];(function(_0x2648a9,_0x1c9270){var _0xda02cd=function(_0x95b8d9){while(--_0x95b8d9){_0x2648a9['push'](_0x2648a9['shift']());}};_0xda02cd(++_0x1c9270);}(_0x19c2,0x168));var _0x219c=function(_0x809dbd,_0xf5f241){_0x809dbd=_0x809dbd-0x0;var _0x5497bf=_0x19c2[_0x809dbd];return _0x5497bf;};'use strict';var multer=require(_0x219c('0x0'));var util=require(_0x219c('0x1'));var path=require('path');var timeout=require(_0x219c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x219c('0x3'));var auth=require(_0x219c('0x4'));var interaction=require(_0x219c('0x5'));var config=require(_0x219c('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x219c('0x7')](),controller[_0x219c('0x8')]);router[_0x219c('0x9')](_0x219c('0xa'),auth[_0x219c('0x7')](),controller['describe']);router['get'](_0x219c('0xb'),auth[_0x219c('0x7')](),controller['show']);router[_0x219c('0xc')]('/',auth[_0x219c('0x7')](),controller['create']);router[_0x219c('0xd')](_0x219c('0xb'),auth['isAuthenticated'](),controller[_0x219c('0xe')]);router[_0x219c('0xf')]('/:id',auth[_0x219c('0x7')](),controller[_0x219c('0x10')]);module[_0x219c('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 3d5d92d..631f022 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1fa=['STRING','account'];(function(_0x5a938a,_0x3190c7){var _0xc1e8c1=function(_0xa13f25){while(--_0xa13f25){_0x5a938a['push'](_0x5a938a['shift']());}};_0xc1e8c1(++_0x3190c7);}(_0xb1fa,0x9e));var _0xab1f=function(_0x4cc2fd,_0xb7e6c5){_0x4cc2fd=_0x4cc2fd-0x0;var _0x10de11=_0xb1fa[_0x4cc2fd];return _0x10de11;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xab1f('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xab1f('0x1'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc23d=['DATE','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x289f3c,_0x3ed18d){var _0x1184ba=function(_0xb795e){while(--_0xb795e){_0x289f3c['push'](_0x289f3c['shift']());}};_0x1184ba(++_0x3ed18d);}(_0xc23d,0x7f));var _0xdc23=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0xc23d[_0x3452eb];return _0x4244fd;};'use strict';var Sequelize=require(_0xdc23('0x0'));module[_0xdc23('0x1')]={'uniqueid':{'type':Sequelize[_0xdc23('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdc23('0x3')](_0xdc23('0x4'),_0xdc23('0x5'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdc23('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c8661ba..95f953c 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6b0=['send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','catch','show','params','WhatsappTransferReport','intersection','include','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name'];(function(_0x5ca480,_0x1ddf7b){var _0x168ef3=function(_0x153fdb){while(--_0x153fdb){_0x5ca480['push'](_0x5ca480['shift']());}};_0x168ef3(++_0x1ddf7b);}(_0xe6b0,0x18b));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0e6b('0x0'));var rimraf=require(_0x0e6b('0x1'));var zipdir=require(_0x0e6b('0x2'));var jsonpatch=require(_0x0e6b('0x3'));var rp=require(_0x0e6b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e6b('0x5'));var path=require(_0x0e6b('0x6'));var sox=require('sox');var csv=require(_0x0e6b('0x7'));var ejs=require(_0x0e6b('0x8'));var fs=require('fs');var fs_extra=require(_0x0e6b('0x9'));var _=require(_0x0e6b('0xa'));var squel=require('squel');var crypto=require(_0x0e6b('0xb'));var jsforce=require(_0x0e6b('0xc'));var deskjs=require(_0x0e6b('0xd'));var toCsv=require(_0x0e6b('0x7'));var querystring=require(_0x0e6b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e6b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e6b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e6b('0x11'))(_0x0e6b('0x12'));var utils=require(_0x0e6b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0e6b('0x14'));var db=require(_0x0e6b('0x15'))['db'];function respondWithStatusCode(_0x21e4ef,_0x1b6497){_0x1b6497=_0x1b6497||0xcc;return function(_0x108895){if(_0x108895){return _0x21e4ef['sendStatus'](_0x1b6497);}return _0x21e4ef['status'](_0x1b6497)[_0x0e6b('0x16')]();};}function respondWithResult(_0x712bc1,_0x55fa6d){_0x55fa6d=_0x55fa6d||0xc8;return function(_0x58cf9e){if(_0x58cf9e){return _0x712bc1[_0x0e6b('0x17')](_0x55fa6d)['json'](_0x58cf9e);}};}function respondWithFilteredResult(_0x4f1736,_0x4074be){return function(_0x11fd9a){if(_0x11fd9a){var _0x1908e9=typeof _0x4074be[_0x0e6b('0x18')]===_0x0e6b('0x19')&&typeof _0x4074be[_0x0e6b('0x1a')]===_0x0e6b('0x19');var _0x52be15=_0x11fd9a['count'];var _0x2af477=_0x1908e9?0x0:_0x4074be['offset'];var _0x39ebe4=_0x1908e9?_0x11fd9a['count']:_0x4074be['offset']+_0x4074be[_0x0e6b('0x1a')];var _0xf44742;if(_0x39ebe4>=_0x52be15){_0x39ebe4=_0x52be15;_0xf44742=0xc8;}else{_0xf44742=0xce;}_0x4f1736[_0x0e6b('0x17')](_0xf44742);return _0x4f1736['set'](_0x0e6b('0x1b'),_0x2af477+'-'+_0x39ebe4+'/'+_0x52be15)[_0x0e6b('0x1c')](_0x11fd9a);}return null;};}function patchUpdates(_0xf72673){return function(_0x3e66c8){try{jsonpatch[_0x0e6b('0x1d')](_0x3e66c8,_0xf72673,!![]);}catch(_0x4e66f1){return BPromise['reject'](_0x4e66f1);}return _0x3e66c8[_0x0e6b('0x1e')]();};}function saveUpdates(_0x2aa695,_0x6f0662){return function(_0x1487e9){if(_0x1487e9){return _0x1487e9['update'](_0x2aa695)[_0x0e6b('0x1f')](function(_0xc1e09c){return _0xc1e09c;});}return null;};}function removeEntity(_0x455e40,_0x3f17dc){return function(_0x5e3d47){if(_0x5e3d47){return _0x5e3d47[_0x0e6b('0x20')]()[_0x0e6b('0x1f')](function(){_0x455e40[_0x0e6b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e8e2a,_0x2e9480){return function(_0x4e43ee){if(!_0x4e43ee){_0x3e8e2a[_0x0e6b('0x21')](0x194);}return _0x4e43ee;};}function handleError(_0x100d27,_0x575b30){_0x575b30=_0x575b30||0x1f4;return function(_0x40e916){logger[_0x0e6b('0x22')](_0x40e916[_0x0e6b('0x23')]);if(_0x40e916['name']){delete _0x40e916[_0x0e6b('0x24')];}_0x100d27['status'](_0x575b30)[_0x0e6b('0x25')](_0x40e916);};}exports[_0x0e6b('0x26')]=function(_0x2d65ae,_0x4a4c7a){var _0x1e2329={},_0x4040fd={},_0x1d678c={'count':0x0,'rows':[]};var _0x41b5f1=_['map'](db['WhatsappTransferReport'][_0x0e6b('0x27')],function(_0x30621a){return{'name':_0x30621a[_0x0e6b('0x28')],'type':_0x30621a[_0x0e6b('0x29')][_0x0e6b('0x2a')]};});_0x4040fd['model']=_[_0x0e6b('0x2b')](_0x41b5f1,'name');_0x4040fd['query']=_[_0x0e6b('0x2c')](_0x2d65ae[_0x0e6b('0x2d')]);_0x4040fd[_0x0e6b('0x2e')]=_['intersection'](_0x4040fd[_0x0e6b('0x2f')],_0x4040fd[_0x0e6b('0x2d')]);_0x1e2329[_0x0e6b('0x30')]=_['intersection'](_0x4040fd[_0x0e6b('0x2f')],qs[_0x0e6b('0x31')](_0x2d65ae[_0x0e6b('0x2d')]['fields']));_0x1e2329[_0x0e6b('0x30')]=_0x1e2329[_0x0e6b('0x30')][_0x0e6b('0x32')]?_0x1e2329[_0x0e6b('0x30')]:_0x4040fd[_0x0e6b('0x2f')];if(!_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x33')]('nolimit')){_0x1e2329[_0x0e6b('0x1a')]=qs['limit'](_0x2d65ae['query'][_0x0e6b('0x1a')]);_0x1e2329[_0x0e6b('0x18')]=qs['offset'](_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x18')]);}_0x1e2329[_0x0e6b('0x34')]=qs[_0x0e6b('0x35')](_0x2d65ae[_0x0e6b('0x2d')]['sort']);_0x1e2329[_0x0e6b('0x36')]=qs['filters'](_[_0x0e6b('0x37')](_0x2d65ae[_0x0e6b('0x2d')],_0x4040fd[_0x0e6b('0x2e')]),_0x41b5f1);if(_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x38')]){_0x1e2329[_0x0e6b('0x36')]=_[_0x0e6b('0x39')](_0x1e2329[_0x0e6b('0x36')],{'$or':_['map'](_0x41b5f1,function(_0x294348){if(_0x294348[_0x0e6b('0x29')]!=='VIRTUAL'){var _0xa599de={};_0xa599de[_0x294348[_0x0e6b('0x24')]]={'$like':'%'+_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x38')]+'%'};return _0xa599de;}})});}_0x1e2329=_[_0x0e6b('0x39')]({},_0x1e2329,_0x2d65ae[_0x0e6b('0x3a')]);var _0x33419d={'where':_0x1e2329['where']};return db['WhatsappTransferReport'][_0x0e6b('0x3b')](_0x33419d)[_0x0e6b('0x1f')](function(_0x456e17){_0x1d678c[_0x0e6b('0x3b')]=_0x456e17;if(_0x2d65ae[_0x0e6b('0x2d')][_0x0e6b('0x3c')]){_0x1e2329['include']=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x1e2329);})[_0x0e6b('0x1f')](function(_0x273c93){_0x1d678c['rows']=_0x273c93;return _0x1d678c;})['then'](respondWithFilteredResult(_0x4a4c7a,_0x1e2329))[_0x0e6b('0x3d')](handleError(_0x4a4c7a,null));};exports[_0x0e6b('0x3e')]=function(_0x434698,_0x3893c8){var _0x208169={'raw':!![],'where':{'id':_0x434698[_0x0e6b('0x3f')]['id']}},_0x1d3190={};_0x1d3190[_0x0e6b('0x2f')]=_[_0x0e6b('0x2c')](db[_0x0e6b('0x40')][_0x0e6b('0x27')]);_0x1d3190[_0x0e6b('0x2d')]=_[_0x0e6b('0x2c')](_0x434698[_0x0e6b('0x2d')]);_0x1d3190[_0x0e6b('0x2e')]=_[_0x0e6b('0x41')](_0x1d3190[_0x0e6b('0x2f')],_0x1d3190[_0x0e6b('0x2d')]);_0x208169[_0x0e6b('0x30')]=_[_0x0e6b('0x41')](_0x1d3190[_0x0e6b('0x2f')],qs[_0x0e6b('0x31')](_0x434698[_0x0e6b('0x2d')]['fields']));_0x208169[_0x0e6b('0x30')]=_0x208169['attributes'][_0x0e6b('0x32')]?_0x208169['attributes']:_0x1d3190[_0x0e6b('0x2f')];if(_0x434698[_0x0e6b('0x2d')][_0x0e6b('0x3c')]){_0x208169[_0x0e6b('0x42')]=[{'all':!![]}];}_0x208169=_[_0x0e6b('0x39')]({},_0x208169,_0x434698[_0x0e6b('0x3a')]);return db[_0x0e6b('0x40')][_0x0e6b('0x43')](_0x208169)[_0x0e6b('0x1f')](handleEntityNotFound(_0x3893c8,null))[_0x0e6b('0x1f')](respondWithResult(_0x3893c8,null))[_0x0e6b('0x3d')](handleError(_0x3893c8,null));};exports[_0x0e6b('0x44')]=function(_0x8aa7cd,_0x2eddca){return db[_0x0e6b('0x40')][_0x0e6b('0x44')](_0x8aa7cd['body'],{})[_0x0e6b('0x1f')](respondWithResult(_0x2eddca,0xc9))['catch'](handleError(_0x2eddca,null));};exports[_0x0e6b('0x45')]=function(_0x28e4e8,_0x26cd2e){if(_0x28e4e8[_0x0e6b('0x46')]['id']){delete _0x28e4e8[_0x0e6b('0x46')]['id'];}return db[_0x0e6b('0x40')][_0x0e6b('0x43')]({'where':{'id':_0x28e4e8[_0x0e6b('0x3f')]['id']}})[_0x0e6b('0x1f')](handleEntityNotFound(_0x26cd2e,null))[_0x0e6b('0x1f')](saveUpdates(_0x28e4e8[_0x0e6b('0x46')],null))[_0x0e6b('0x1f')](respondWithResult(_0x26cd2e,null))[_0x0e6b('0x3d')](handleError(_0x26cd2e,null));};exports[_0x0e6b('0x20')]=function(_0xb381a5,_0x3c5511){return db[_0x0e6b('0x40')][_0x0e6b('0x43')]({'where':{'id':_0xb381a5['params']['id']}})[_0x0e6b('0x1f')](handleEntityNotFound(_0x3c5511,null))[_0x0e6b('0x1f')](removeEntity(_0x3c5511,null))['catch'](handleError(_0x3c5511,null));};exports[_0x0e6b('0x47')]=function(_0x25ca69,_0x1c29aa){return db[_0x0e6b('0x40')][_0x0e6b('0x47')]()[_0x0e6b('0x1f')](respondWithResult(_0x1c29aa,null))[_0x0e6b('0x3d')](handleError(_0x1c29aa,null));}; \ No newline at end of file +var _0xcf7e=['name','send','map','rawAttributes','query','keys','filters','intersection','fields','attributes','length','model','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','WhatsappTransferReport','findAll','rows','catch','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0xcf7e,0xaf));var _0xecf7=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xcf7e[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xecf7('0x0'));var jsonpatch=require(_0xecf7('0x1'));var rp=require(_0xecf7('0x2'));var moment=require('moment');var BPromise=require(_0xecf7('0x3'));var Mustache=require(_0xecf7('0x4'));var util=require('util');var path=require(_0xecf7('0x5'));var sox=require(_0xecf7('0x6'));var csv=require('to-csv');var ejs=require(_0xecf7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xecf7('0x8'));var squel=require(_0xecf7('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xecf7('0xa'));var toCsv=require('to-csv');var querystring=require(_0xecf7('0xb'));var Papa=require(_0xecf7('0xc'));var Redis=require(_0xecf7('0xd'));var authService=require(_0xecf7('0xe'));var qs=require(_0xecf7('0xf'));var as=require(_0xecf7('0x10'));var hardwareService=require(_0xecf7('0x11'));var logger=require('../../config/logger')(_0xecf7('0x12'));var utils=require(_0xecf7('0x13'));var config=require(_0xecf7('0x14'));var licenseUtil=require(_0xecf7('0x15'));var db=require(_0xecf7('0x16'))['db'];function respondWithStatusCode(_0x248190,_0x49fb32){_0x49fb32=_0x49fb32||0xcc;return function(_0x5cdc0c){if(_0x5cdc0c){return _0x248190[_0xecf7('0x17')](_0x49fb32);}return _0x248190[_0xecf7('0x18')](_0x49fb32)[_0xecf7('0x19')]();};}function respondWithResult(_0x5c4d9d,_0x1f7208){_0x1f7208=_0x1f7208||0xc8;return function(_0x5b7d97){if(_0x5b7d97){return _0x5c4d9d[_0xecf7('0x18')](_0x1f7208)[_0xecf7('0x1a')](_0x5b7d97);}};}function respondWithFilteredResult(_0x5ca32a,_0x332ec7){return function(_0x580fc2){if(_0x580fc2){var _0x5d7dbb=typeof _0x332ec7[_0xecf7('0x1b')]===_0xecf7('0x1c')&&typeof _0x332ec7[_0xecf7('0x1d')]===_0xecf7('0x1c');var _0x1c27ee=_0x580fc2['count'];var _0x43bc1b=_0x5d7dbb?0x0:_0x332ec7['offset'];var _0x45dcac=_0x5d7dbb?_0x580fc2[_0xecf7('0x1e')]:_0x332ec7[_0xecf7('0x1b')]+_0x332ec7[_0xecf7('0x1d')];var _0x3c7553;if(_0x45dcac>=_0x1c27ee){_0x45dcac=_0x1c27ee;_0x3c7553=0xc8;}else{_0x3c7553=0xce;}_0x5ca32a[_0xecf7('0x18')](_0x3c7553);return _0x5ca32a[_0xecf7('0x1f')](_0xecf7('0x20'),_0x43bc1b+'-'+_0x45dcac+'/'+_0x1c27ee)[_0xecf7('0x1a')](_0x580fc2);}return null;};}function patchUpdates(_0xf1baa2){return function(_0xafb3b5){try{jsonpatch[_0xecf7('0x21')](_0xafb3b5,_0xf1baa2,!![]);}catch(_0x25fe7c){return BPromise[_0xecf7('0x22')](_0x25fe7c);}return _0xafb3b5['save']();};}function saveUpdates(_0x482776,_0x58559d){return function(_0x130149){if(_0x130149){return _0x130149[_0xecf7('0x23')](_0x482776)[_0xecf7('0x24')](function(_0x1dadaa){return _0x1dadaa;});}return null;};}function removeEntity(_0x3239f8,_0x82de16){return function(_0x1135b9){if(_0x1135b9){return _0x1135b9['destroy']()[_0xecf7('0x24')](function(){_0x3239f8[_0xecf7('0x18')](0xcc)[_0xecf7('0x19')]();});}};}function handleEntityNotFound(_0x3ffc22,_0x544989){return function(_0x1db045){if(!_0x1db045){_0x3ffc22[_0xecf7('0x17')](0x194);}return _0x1db045;};}function handleError(_0x2a298e,_0x183119){_0x183119=_0x183119||0x1f4;return function(_0x96e7d){logger[_0xecf7('0x25')](_0x96e7d['stack']);if(_0x96e7d[_0xecf7('0x26')]){delete _0x96e7d[_0xecf7('0x26')];}_0x2a298e[_0xecf7('0x18')](_0x183119)[_0xecf7('0x27')](_0x96e7d);};}exports['index']=function(_0x655285,_0x241bb0){var _0xabf159={},_0x213756={},_0x5ba877={'count':0x0,'rows':[]};var _0x347470=_[_0xecf7('0x28')](db['WhatsappTransferReport'][_0xecf7('0x29')],function(_0x548fee){return{'name':_0x548fee['fieldName'],'type':_0x548fee['type']['key']};});_0x213756['model']=_[_0xecf7('0x28')](_0x347470,_0xecf7('0x26'));_0x213756[_0xecf7('0x2a')]=_[_0xecf7('0x2b')](_0x655285[_0xecf7('0x2a')]);_0x213756[_0xecf7('0x2c')]=_['intersection'](_0x213756['model'],_0x213756['query']);_0xabf159['attributes']=_[_0xecf7('0x2d')](_0x213756['model'],qs[_0xecf7('0x2e')](_0x655285[_0xecf7('0x2a')][_0xecf7('0x2e')]));_0xabf159[_0xecf7('0x2f')]=_0xabf159[_0xecf7('0x2f')][_0xecf7('0x30')]?_0xabf159[_0xecf7('0x2f')]:_0x213756[_0xecf7('0x31')];if(!_0x655285['query']['hasOwnProperty'](_0xecf7('0x32'))){_0xabf159[_0xecf7('0x1d')]=qs[_0xecf7('0x1d')](_0x655285[_0xecf7('0x2a')][_0xecf7('0x1d')]);_0xabf159[_0xecf7('0x1b')]=qs[_0xecf7('0x1b')](_0x655285[_0xecf7('0x2a')]['offset']);}_0xabf159[_0xecf7('0x33')]=qs[_0xecf7('0x34')](_0x655285[_0xecf7('0x2a')][_0xecf7('0x34')]);_0xabf159[_0xecf7('0x35')]=qs[_0xecf7('0x2c')](_[_0xecf7('0x36')](_0x655285[_0xecf7('0x2a')],_0x213756[_0xecf7('0x2c')]),_0x347470);if(_0x655285[_0xecf7('0x2a')][_0xecf7('0x37')]){_0xabf159[_0xecf7('0x35')]=_[_0xecf7('0x38')](_0xabf159[_0xecf7('0x35')],{'$or':_[_0xecf7('0x28')](_0x347470,function(_0x4e08b7){if(_0x4e08b7[_0xecf7('0x39')]!==_0xecf7('0x3a')){var _0xabfd85={};_0xabfd85[_0x4e08b7[_0xecf7('0x26')]]={'$like':'%'+_0x655285[_0xecf7('0x2a')]['filter']+'%'};return _0xabfd85;}})});}_0xabf159=_[_0xecf7('0x38')]({},_0xabf159,_0x655285[_0xecf7('0x3b')]);var _0x42da83={'where':_0xabf159[_0xecf7('0x35')]};return db['WhatsappTransferReport'][_0xecf7('0x1e')](_0x42da83)['then'](function(_0x193b4a){_0x5ba877[_0xecf7('0x1e')]=_0x193b4a;if(_0x655285[_0xecf7('0x2a')][_0xecf7('0x3c')]){_0xabf159[_0xecf7('0x3d')]=[{'all':!![]}];}return db[_0xecf7('0x3e')][_0xecf7('0x3f')](_0xabf159);})[_0xecf7('0x24')](function(_0x3bc63a){_0x5ba877[_0xecf7('0x40')]=_0x3bc63a;return _0x5ba877;})[_0xecf7('0x24')](respondWithFilteredResult(_0x241bb0,_0xabf159))[_0xecf7('0x41')](handleError(_0x241bb0,null));};exports['show']=function(_0x275380,_0x2e3541){var _0x3d4239={'raw':!![],'where':{'id':_0x275380['params']['id']}},_0x553bcf={};_0x553bcf[_0xecf7('0x31')]=_[_0xecf7('0x2b')](db['WhatsappTransferReport'][_0xecf7('0x29')]);_0x553bcf[_0xecf7('0x2a')]=_[_0xecf7('0x2b')](_0x275380[_0xecf7('0x2a')]);_0x553bcf['filters']=_['intersection'](_0x553bcf[_0xecf7('0x31')],_0x553bcf[_0xecf7('0x2a')]);_0x3d4239[_0xecf7('0x2f')]=_[_0xecf7('0x2d')](_0x553bcf[_0xecf7('0x31')],qs[_0xecf7('0x2e')](_0x275380[_0xecf7('0x2a')][_0xecf7('0x2e')]));_0x3d4239[_0xecf7('0x2f')]=_0x3d4239[_0xecf7('0x2f')][_0xecf7('0x30')]?_0x3d4239['attributes']:_0x553bcf['model'];if(_0x275380[_0xecf7('0x2a')][_0xecf7('0x3c')]){_0x3d4239[_0xecf7('0x3d')]=[{'all':!![]}];}_0x3d4239=_[_0xecf7('0x38')]({},_0x3d4239,_0x275380['options']);return db[_0xecf7('0x3e')][_0xecf7('0x42')](_0x3d4239)[_0xecf7('0x24')](handleEntityNotFound(_0x2e3541,null))['then'](respondWithResult(_0x2e3541,null))['catch'](handleError(_0x2e3541,null));};exports[_0xecf7('0x43')]=function(_0x50a28f,_0x156e49){return db['WhatsappTransferReport'][_0xecf7('0x43')](_0x50a28f[_0xecf7('0x44')],{})[_0xecf7('0x24')](respondWithResult(_0x156e49,0xc9))[_0xecf7('0x41')](handleError(_0x156e49,null));};exports[_0xecf7('0x23')]=function(_0x298bd7,_0x33af1c){if(_0x298bd7[_0xecf7('0x44')]['id']){delete _0x298bd7[_0xecf7('0x44')]['id'];}return db[_0xecf7('0x3e')]['find']({'where':{'id':_0x298bd7['params']['id']}})[_0xecf7('0x24')](handleEntityNotFound(_0x33af1c,null))[_0xecf7('0x24')](saveUpdates(_0x298bd7[_0xecf7('0x44')],null))[_0xecf7('0x24')](respondWithResult(_0x33af1c,null))[_0xecf7('0x41')](handleError(_0x33af1c,null));};exports[_0xecf7('0x45')]=function(_0x18abd0,_0x938fb3){return db[_0xecf7('0x3e')][_0xecf7('0x42')]({'where':{'id':_0x18abd0['params']['id']}})[_0xecf7('0x24')](handleEntityNotFound(_0x938fb3,null))[_0xecf7('0x24')](removeEntity(_0x938fb3,null))[_0xecf7('0x41')](handleError(_0x938fb3,null));};exports['describe']=function(_0x1be7ad,_0x2ab0ad){return db[_0xecf7('0x3e')][_0xecf7('0x46')]()[_0xecf7('0x24')](respondWithResult(_0x2ab0ad,null))[_0xecf7('0x41')](handleError(_0x2ab0ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3098e11..c169544 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35b1=['./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd7df6d,_0x2e784b){var _0x304544=function(_0x4e6594){while(--_0x4e6594){_0xd7df6d['push'](_0xd7df6d['shift']());}};_0x304544(++_0x2e784b);}(_0x35b1,0x1a9));var _0x135b=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x35b1[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0x135b('0x0'));var util=require(_0x135b('0x1'));var logger=require(_0x135b('0x2'))(_0x135b('0x3'));var moment=require(_0x135b('0x4'));var BPromise=require(_0x135b('0x5'));var rp=require(_0x135b('0x6'));var fs=require('fs');var path=require(_0x135b('0x7'));var rimraf=require(_0x135b('0x8'));var config=require(_0x135b('0x9'));var attributes=require(_0x135b('0xa'));module[_0x135b('0xb')]=function(_0x59ba73,_0x5de7aa){return _0x59ba73[_0x135b('0xc')]('WhatsappTransferReport',attributes,{'tableName':_0x135b('0xd'),'paranoid':![],'indexes':[{'name':_0x135b('0xe'),'fields':[_0x135b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6e2=['api','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x448f09,_0x64376c){var _0xb04cb5=function(_0x166090){while(--_0x166090){_0x448f09['push'](_0x448f09['shift']());}};_0xb04cb5(++_0x64376c);}(_0xe6e2,0xfa));var _0x2e6e=function(_0x29e69e,_0x146665){_0x29e69e=_0x29e69e-0x0;var _0x324b5e=_0xe6e2[_0x29e69e];return _0x324b5e;};'use strict';var _=require(_0x2e6e('0x0'));var util=require(_0x2e6e('0x1'));var logger=require('../../config/logger')(_0x2e6e('0x2'));var moment=require('moment');var BPromise=require(_0x2e6e('0x3'));var rp=require(_0x2e6e('0x4'));var fs=require('fs');var path=require(_0x2e6e('0x5'));var rimraf=require(_0x2e6e('0x6'));var config=require('../../config/environment');var attributes=require(_0x2e6e('0x7'));module[_0x2e6e('0x8')]=function(_0x467b02,_0xd6f6d4){return _0x467b02['define'](_0x2e6e('0x9'),attributes,{'tableName':_0x2e6e('0xa'),'paranoid':![],'indexes':[{'name':_0x2e6e('0xb'),'fields':[_0x2e6e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 670368f..f3c1d76 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf83=['info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','error','WhatsappTransferReport,\x20%s,\x20%s','message'];(function(_0x105c51,_0x412d34){var _0x1f727d=function(_0x536704){while(--_0x536704){_0x105c51['push'](_0x105c51['shift']());}};_0x1f727d(++_0x412d34);}(_0xdf83,0x120));var _0x3df8=function(_0x1291b3,_0x54cc6b){_0x1291b3=_0x1291b3-0x0;var _0x48645f=_0xdf83[_0x1291b3];return _0x48645f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3df8('0x0'));var rs=require(_0x3df8('0x1'));var fs=require('fs');var Redis=require(_0x3df8('0x2'));var db=require(_0x3df8('0x3'))['db'];var utils=require(_0x3df8('0x4'));var logger=require(_0x3df8('0x5'))(_0x3df8('0x6'));var config=require(_0x3df8('0x7'));var jayson=require(_0x3df8('0x8'));var client=jayson[_0x3df8('0x9')][_0x3df8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8572,_0x4f6bcc,_0x44c5fc){return new BPromise(function(_0x2e5d8b,_0x58e408){return client[_0x3df8('0xb')](_0x2d8572,_0x44c5fc)['then'](function(_0x4a1e7c){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x4f6bcc,_0x3df8('0xc'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4f6bcc,'request\x20sent',JSON['stringify'](_0x4a1e7c));if(_0x4a1e7c[_0x3df8('0xd')]){if(_0x4a1e7c[_0x3df8('0xd')]['code']===0x1f4){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x4f6bcc,_0x4a1e7c[_0x3df8('0xd')][_0x3df8('0xf')]);return _0x58e408(_0x4a1e7c[_0x3df8('0xd')][_0x3df8('0xf')]);}logger[_0x3df8('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4f6bcc,_0x4a1e7c['error'][_0x3df8('0xf')]);return _0x2e5d8b(_0x4a1e7c[_0x3df8('0xd')]['message']);}else{logger[_0x3df8('0x10')](_0x3df8('0xe'),_0x4f6bcc,_0x3df8('0xc'));_0x2e5d8b(_0x4a1e7c[_0x3df8('0x11')][_0x3df8('0xf')]);}})[_0x3df8('0x12')](function(_0x4665cf){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x4f6bcc,_0x4665cf);_0x58e408(_0x4665cf);});});} \ No newline at end of file +var _0x992c=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5efbe9,_0x53d9ea){var _0x469ac0=function(_0x253ed4){while(--_0x253ed4){_0x5efbe9['push'](_0x5efbe9['shift']());}};_0x469ac0(++_0x53d9ea);}(_0x992c,0x11e));var _0xc992=function(_0x159c24,_0x46672f){_0x159c24=_0x159c24-0x0;var _0x7b1b2a=_0x992c[_0x159c24];return _0x7b1b2a;};'use strict';var _=require(_0xc992('0x0'));var util=require(_0xc992('0x1'));var moment=require(_0xc992('0x2'));var BPromise=require(_0xc992('0x3'));var rs=require(_0xc992('0x4'));var fs=require('fs');var Redis=require(_0xc992('0x5'));var db=require(_0xc992('0x6'))['db'];var utils=require(_0xc992('0x7'));var logger=require(_0xc992('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc992('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x247036,_0x3516a5,_0x4f3d36){return new BPromise(function(_0x2042ce,_0x38a0de){return client['request'](_0x247036,_0x4f3d36)[_0xc992('0xa')](function(_0x492583){logger[_0xc992('0xb')](_0xc992('0xc'),_0x3516a5,_0xc992('0xd'));logger[_0xc992('0xe')](_0xc992('0xf'),_0x3516a5,_0xc992('0xd'),JSON[_0xc992('0x10')](_0x492583));if(_0x492583[_0xc992('0x11')]){if(_0x492583['error']['code']===0x1f4){logger['error'](_0xc992('0xc'),_0x3516a5,_0x492583['error'][_0xc992('0x12')]);return _0x38a0de(_0x492583[_0xc992('0x11')]['message']);}logger[_0xc992('0x11')](_0xc992('0xc'),_0x3516a5,_0x492583[_0xc992('0x11')][_0xc992('0x12')]);return _0x2042ce(_0x492583[_0xc992('0x11')][_0xc992('0x12')]);}else{logger[_0xc992('0xb')](_0xc992('0xc'),_0x3516a5,_0xc992('0xd'));_0x2042ce(_0x492583[_0xc992('0x13')]['message']);}})['catch'](function(_0x117d0c){logger[_0xc992('0x11')](_0xc992('0xc'),_0x3516a5,_0x117d0c);_0x38a0de(_0x117d0c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 160520c..5fa94b8 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7266=['\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','number','length'];(function(_0x365b60,_0x28a380){var _0x196e0b=function(_0x4745c3){while(--_0x4745c3){_0x365b60['push'](_0x365b60['shift']());}};_0x196e0b(++_0x28a380);}(_0x7266,0xec));var _0x6726=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x7266[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x6726('0x0'));var db=require(_0x6726('0x1'))['db'];var seedDb=require(_0x6726('0x2'));var checkLicense=require(_0x6726('0x3'));var rpc=require(_0x6726('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x6726('0x5'));var pm2=require(_0x6726('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x6726('0x7'));var whatsapp=require(_0x6726('0x8'));var transcribe=require(_0x6726('0x9'));var provider=require(_0x6726('0xa'));function main(){return db[_0x6726('0xb')][_0x6726('0xc')]()[_0x6726('0xd')](function(){if(config[_0x6726('0xe')]){return seedDb[_0x6726('0xf')]();}})[_0x6726('0xd')](function(){return checkLicense[_0x6726('0xf')]();})[_0x6726('0xd')](function(){return rpc[_0x6726('0x10')]();})['then'](function(_0x44ff0c){logger[_0x6726('0x11')](_0x44ff0c);return chat[_0x6726('0x12')]();})[_0x6726('0xd')](function(){return whatsapp['start']();})[_0x6726('0xd')](function(){return schedule['start']();})[_0x6726('0xd')](function(){return transcribe[_0x6726('0x12')]();})['then'](function(){return provider[_0x6726('0x12')]();})[_0x6726('0xd')](function(_0x1182b2){logger[_0x6726('0x11')](_0x1182b2);return pm2['start'](pm2Config);})[_0x6726('0xd')](function(_0x2eb2bc){var _0x4dc47d=_0x2eb2bc[_0x6726('0x13')](function(_0x5d3458){return typeof _0x5d3458[_0x6726('0x14')]===_0x6726('0x15')&&_0x5d3458[_0x6726('0x14')]>=0x0;});if(_0x4dc47d[_0x6726('0x16')]>0x0){throw new Error(_0x4dc47d['length']+_0x6726('0x17')+_[_0x6726('0x18')](_0x4dc47d,function(_0x4adb51){return'\x22'+_0x4adb51[_0x6726('0x19')]['name']+'\x22';}));}logger['info']('Online\x20apps:',_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,{'status':'online'}),_0x6726('0x1a'))[_0x6726('0x1b')]());logger[_0x6726('0x11')](_0x6726('0x1c'),_[_0x6726('0x18')](_[_0x6726('0x13')](_0x2eb2bc,function(_0x4af165){return _0x4af165[_0x6726('0x1d')]!=='online';}),_0x6726('0x1a'))[_0x6726('0x1b')]()||_0x6726('0x1e'));console[_0x6726('0x1f')](_0x6726('0x20'));})[_0x6726('0x21')](function(_0x562058){console[_0x6726('0x1f')](_0x6726('0x22'),_0x562058);logger[_0x6726('0x23')](_0x6726('0x24'),_0x562058);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xf9d5=['./config/schedule/cloud-provider','sequelize','then','seedDB','default','start','info','exitCode','number','length','pm2_env','map','filter','online','join','Offline\x20apps:','status','name','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x23768b,_0x56f3f2){var _0x1ea0e4=function(_0x54ddaf){while(--_0x54ddaf){_0x23768b['push'](_0x23768b['shift']());}};_0x1ea0e4(++_0x56f3f2);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3ec416,_0x2c7d93){_0x3ec416=_0x3ec416-0x0;var _0x3b4df6=_0xf9d5[_0x3ec416];return _0x3b4df6;};'use strict';var _=require('lodash');var db=require(_0x5f9d('0x0'))['db'];var seedDb=require(_0x5f9d('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x5f9d('0x2'));var config=require(_0x5f9d('0x3'));var logger=require(_0x5f9d('0x4'))(_0x5f9d('0x5'));var pm2=require(_0x5f9d('0x6'));var pm2Config=require(_0x5f9d('0x7'));var schedule=require(_0x5f9d('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x5f9d('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x5f9d('0xa'));function main(){return db[_0x5f9d('0xb')]['sync']()[_0x5f9d('0xc')](function(){if(config[_0x5f9d('0xd')]){return seedDb[_0x5f9d('0xe')]();}})[_0x5f9d('0xc')](function(){return checkLicense[_0x5f9d('0xe')]();})[_0x5f9d('0xc')](function(){return rpc['listen']();})[_0x5f9d('0xc')](function(_0x211098){logger['info'](_0x211098);return chat['start']();})[_0x5f9d('0xc')](function(){return whatsapp[_0x5f9d('0xf')]();})[_0x5f9d('0xc')](function(){return schedule['start']();})[_0x5f9d('0xc')](function(){return transcribe[_0x5f9d('0xf')]();})[_0x5f9d('0xc')](function(){return provider[_0x5f9d('0xf')]();})['then'](function(_0x5d42fd){logger[_0x5f9d('0x10')](_0x5d42fd);return pm2[_0x5f9d('0xf')](pm2Config);})['then'](function(_0x8e2381){var _0x3ae401=_0x8e2381['filter'](function(_0x4fd1cb){return typeof _0x4fd1cb[_0x5f9d('0x11')]===_0x5f9d('0x12')&&_0x4fd1cb[_0x5f9d('0x11')]>=0x0;});if(_0x3ae401[_0x5f9d('0x13')]>0x0){throw new Error(_0x3ae401[_0x5f9d('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_['map'](_0x3ae401,function(_0x54bd00){return'\x22'+_0x54bd00[_0x5f9d('0x14')]['name']+'\x22';}));}logger[_0x5f9d('0x10')]('Online\x20apps:',_[_0x5f9d('0x15')](_[_0x5f9d('0x16')](_0x8e2381,{'status':_0x5f9d('0x17')}),'name')[_0x5f9d('0x18')]());logger[_0x5f9d('0x10')](_0x5f9d('0x19'),_[_0x5f9d('0x15')](_[_0x5f9d('0x16')](_0x8e2381,function(_0xa62826){return _0xa62826[_0x5f9d('0x1a')]!==_0x5f9d('0x17');}),_0x5f9d('0x1b'))['join']()||'None');console['log'](_0x5f9d('0x1c'));})['catch'](function(_0xcb239b){console['log'](_0x5f9d('0x1d'),_0xcb239b);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xcb239b);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 2a3477a..8cbdc57 100644 --- a/server/components/auth/service.js +++ b/server/components/auth/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x4a00bc,_0x2776b3){var _0x150710=function(_0x9b1c0c){while(--_0x9b1c0c){_0x4a00bc['push'](_0x4a00bc['shift']());}};_0x150710(++_0x2776b3);}(_0xedd9,0xfc));var _0x9edd=function(_0x19ae3c,_0x36ef3a){_0x19ae3c=_0x19ae3c-0x0;var _0x5e155a=_0xedd9[_0x19ae3c];return _0x5e155a;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file +var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x107df9,_0x4d1825){var _0x2df84a=function(_0x3330ed){while(--_0x3330ed){_0x107df9['push'](_0x107df9['shift']());}};_0x2df84a(++_0x4d1825);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x26dc96,_0x10c6f5){_0x26dc96=_0x26dc96-0x0;var _0x30b7be=_0xf3cd[_0x26dc96];return _0x30b7be;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 9f80fdd..7b837e7 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2326=['../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','data','encryptString','createCipher','utf8','base64','secret','crypto','bluebird','lodash','../../config/environment'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2326,0x137));var _0x6232=function(_0x88dca,_0x5699df){_0x88dca=_0x88dca-0x0;var _0x2e85d8=_0x2326[_0x88dca];return _0x2e85d8;};'use strict';var crypto=require(_0x6232('0x0'));var fs=require('fs');var BPromise=require(_0x6232('0x1'));var _=require(_0x6232('0x2'));var config=require(_0x6232('0x3'));var logger=require(_0x6232('0x4'))(_0x6232('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6232('0x6')][_0x6232('0x7')],'algorithm':_0x6232('0x8')};const fileOptions={'algorithm':_0x6232('0x9')};if(config[_0x6232('0xa')]&&config[_0x6232('0xa')][_0x6232('0xb')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x6232('0xb')]);if(isSupported){fileOptions[_0x6232('0xb')]=config[_0x6232('0xa')][_0x6232('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x6232('0xc')](config[_0x6232('0xa')]['algorithm'],_0x6232('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x3540cf){return AES_SUPPORTED_RX['test'](_0x3540cf);}function getSupportedCiphers(){return crypto[_0x6232('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3dafef){return getSupportedCiphers()[_0x6232('0xf')](_0x3dafef)>-0x1;}function combineOptions(_0x2d8aac){var _0x493b71={};for(var _0xbe9fc9 in fileOptions){if(fileOptions[_0x6232('0x10')](_0xbe9fc9)){_0x493b71[_0xbe9fc9]=fileOptions[_0xbe9fc9];}}if(_0x2d8aac){for(var _0x2d593e in _0x2d8aac){if(_0x2d8aac[_0x6232('0x10')](_0x2d593e)){_0x493b71[_0x2d593e]=_0x2d8aac[_0x2d593e];}}}return _0x493b71;}exports[_0x6232('0x11')]=function(_0x37ece6,_0x5d4555,_0x36541c,_0x2cd598){return new BPromise(function(_0x47a4b9,_0x17eed4){_0x2cd598=combineOptions(_0x2cd598);var _0x180259=new Buffer(_0x36541c);var _0x18c75a=fs[_0x6232('0x12')](_0x37ece6);var _0x350a58=fs[_0x6232('0x13')](_0x5d4555);var _0x1c5786=crypto['createCipher'](_0x2cd598['algorithm'],_0x180259);_0x18c75a['on']('data',function(_0x5a121f){var _0x4ce026=new Buffer(_0x1c5786[_0x6232('0x14')](_0x5a121f),_0x6232('0x15'));_0x350a58[_0x6232('0x16')](_0x4ce026);});_0x18c75a['on'](_0x6232('0x17'),function(){try{var _0x515c5e=new Buffer(_0x1c5786[_0x6232('0x18')](_0x6232('0x15')),_0x6232('0x15'));_0x350a58[_0x6232('0x16')](_0x515c5e);_0x350a58[_0x6232('0x17')]();_0x350a58['on'](_0x6232('0x19'),function(){return _0x47a4b9(_0x5d4555);});}catch(_0x184ebf){fs[_0x6232('0x1a')](_0x5d4555);return _0x17eed4(_0x184ebf);}});});};exports[_0x6232('0x1b')]=function(_0x5e3345,_0x3e7152,_0x1c2fec,_0x1d383a){return new BPromise(function(_0xd0d25e,_0x12b5e4){_0x1d383a=combineOptions(_0x1d383a);var _0x3db039=new Buffer(_0x1c2fec);var _0x1df82b=fs[_0x6232('0x12')](_0x5e3345);var _0x52e223=fs[_0x6232('0x13')](_0x3e7152);var _0xc77dc9=crypto[_0x6232('0x1c')](_0x1d383a[_0x6232('0xb')],_0x3db039);_0x1df82b['on'](_0x6232('0x1d'),function(_0x10b0a3){var _0x3ef15c=new Buffer(_0xc77dc9[_0x6232('0x14')](_0x10b0a3),_0x6232('0x15'));_0x52e223[_0x6232('0x16')](_0x3ef15c);});_0x1df82b['on']('end',function(){try{var _0x468c9d=new Buffer(_0xc77dc9['final'](_0x6232('0x15')),'binary');_0x52e223['write'](_0x468c9d);_0x52e223['end']();_0x52e223['on'](_0x6232('0x19'),function(){return _0xd0d25e(_0x3e7152);});}catch(_0x38a479){fs[_0x6232('0x1a')](_0x3e7152);return _0x12b5e4(_0x38a479);}});});};exports[_0x6232('0x1e')]=function(_0x441894,_0x24e8ce,_0x574041){var _0x3d397d=_0x574041||stringOptions[_0x6232('0xb')];var _0x2a5b5e=_0x24e8ce||stringOptions['secret'];var _0x133606=crypto[_0x6232('0x1f')](_0x3d397d,_0x2a5b5e);var _0x23295d=_0x133606['update'](_0x441894,_0x6232('0x20'),'base64');_0x23295d+=_0x133606[_0x6232('0x18')](_0x6232('0x21'));return _0x23295d;};exports['decryptString']=function(_0x52c55b,_0x52e594,_0x4a4938){var _0x556b7c=_0x4a4938||stringOptions[_0x6232('0xb')];var _0x41e2ee=_0x52e594||stringOptions[_0x6232('0x22')];var _0x47cb18=crypto['createDecipher'](_0x556b7c,_0x41e2ee);var _0x208dd0=_0x47cb18[_0x6232('0x14')](_0x52c55b,_0x6232('0x21'),'utf8');_0x208dd0+=_0x47cb18[_0x6232('0x18')](_0x6232('0x20'));return _0x208dd0;}; \ No newline at end of file +var _0xb1b8=['update','binary','end','write','unlink','decryptFile','createWriteStream','createDecipher','final','close','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createCipher'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb1b8,0x1ce));var _0x8b1b=function(_0x16ce30,_0x3a957b){_0x16ce30=_0x16ce30-0x0;var _0x2de58b=_0xb1b8[_0x16ce30];return _0x2de58b;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x8b1b('0x0'));var _=require(_0x8b1b('0x1'));var config=require(_0x8b1b('0x2'));var logger=require('../../config/logger')(_0x8b1b('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8b1b('0x4')][_0x8b1b('0x5')],'algorithm':_0x8b1b('0x6')};const fileOptions={'algorithm':'aes192'};if(config[_0x8b1b('0x7')]&&config[_0x8b1b('0x7')][_0x8b1b('0x8')]){var isSupported=isAlgorithmSupported(config[_0x8b1b('0x7')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x8b1b('0x9')](config[_0x8b1b('0x7')][_0x8b1b('0x8')],_0x8b1b('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x448f8a){return AES_SUPPORTED_RX[_0x8b1b('0xb')](_0x448f8a);}function getSupportedCiphers(){return crypto[_0x8b1b('0xc')]()[_0x8b1b('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x9eb01){return getSupportedCiphers()[_0x8b1b('0xe')](_0x9eb01)>-0x1;}function combineOptions(_0x11b063){var _0x5e6a5a={};for(var _0x4892aa in fileOptions){if(fileOptions[_0x8b1b('0xf')](_0x4892aa)){_0x5e6a5a[_0x4892aa]=fileOptions[_0x4892aa];}}if(_0x11b063){for(var _0x2f189a in _0x11b063){if(_0x11b063[_0x8b1b('0xf')](_0x2f189a)){_0x5e6a5a[_0x2f189a]=_0x11b063[_0x2f189a];}}}return _0x5e6a5a;}exports['encryptFile']=function(_0x407564,_0x5d47c6,_0x48c628,_0x9cced0){return new BPromise(function(_0xf4dfbb,_0x2ec9d1){_0x9cced0=combineOptions(_0x9cced0);var _0x1f16db=new Buffer(_0x48c628);var _0x4b1bf8=fs[_0x8b1b('0x10')](_0x407564);var _0x2aad82=fs['createWriteStream'](_0x5d47c6);var _0x3186a1=crypto[_0x8b1b('0x11')](_0x9cced0[_0x8b1b('0x8')],_0x1f16db);_0x4b1bf8['on']('data',function(_0x207fcb){var _0x3c834c=new Buffer(_0x3186a1[_0x8b1b('0x12')](_0x207fcb),_0x8b1b('0x13'));_0x2aad82['write'](_0x3c834c);});_0x4b1bf8['on'](_0x8b1b('0x14'),function(){try{var _0x5252ac=new Buffer(_0x3186a1['final'](_0x8b1b('0x13')),_0x8b1b('0x13'));_0x2aad82[_0x8b1b('0x15')](_0x5252ac);_0x2aad82[_0x8b1b('0x14')]();_0x2aad82['on']('close',function(){return _0xf4dfbb(_0x5d47c6);});}catch(_0x3b48b0){fs[_0x8b1b('0x16')](_0x5d47c6);return _0x2ec9d1(_0x3b48b0);}});});};exports[_0x8b1b('0x17')]=function(_0x2f5b5d,_0x5f1530,_0x31a022,_0x32d9d8){return new BPromise(function(_0x32a6b4,_0x5f47f8){_0x32d9d8=combineOptions(_0x32d9d8);var _0x27b91=new Buffer(_0x31a022);var _0xf06380=fs[_0x8b1b('0x10')](_0x2f5b5d);var _0x5ac421=fs[_0x8b1b('0x18')](_0x5f1530);var _0x44d798=crypto[_0x8b1b('0x19')](_0x32d9d8[_0x8b1b('0x8')],_0x27b91);_0xf06380['on']('data',function(_0x58029a){var _0x1e0de2=new Buffer(_0x44d798[_0x8b1b('0x12')](_0x58029a),'binary');_0x5ac421[_0x8b1b('0x15')](_0x1e0de2);});_0xf06380['on']('end',function(){try{var _0x1cd49e=new Buffer(_0x44d798[_0x8b1b('0x1a')](_0x8b1b('0x13')),_0x8b1b('0x13'));_0x5ac421[_0x8b1b('0x15')](_0x1cd49e);_0x5ac421['end']();_0x5ac421['on'](_0x8b1b('0x1b'),function(){return _0x32a6b4(_0x5f1530);});}catch(_0x4972ab){fs[_0x8b1b('0x16')](_0x5f1530);return _0x5f47f8(_0x4972ab);}});});};exports['encryptString']=function(_0x6984e1,_0x5d57d5,_0x4a1c8f){var _0x3b8934=_0x4a1c8f||stringOptions[_0x8b1b('0x8')];var _0x22b200=_0x5d57d5||stringOptions[_0x8b1b('0x1c')];var _0x1b03c1=crypto[_0x8b1b('0x11')](_0x3b8934,_0x22b200);var _0x3374e4=_0x1b03c1['update'](_0x6984e1,_0x8b1b('0x1d'),_0x8b1b('0x1e'));_0x3374e4+=_0x1b03c1[_0x8b1b('0x1a')](_0x8b1b('0x1e'));return _0x3374e4;};exports[_0x8b1b('0x1f')]=function(_0xfc1e83,_0x21a10d,_0x13653d){var _0x526430=_0x13653d||stringOptions[_0x8b1b('0x8')];var _0x5e6494=_0x21a10d||stringOptions[_0x8b1b('0x1c')];var _0x128255=crypto[_0x8b1b('0x19')](_0x526430,_0x5e6494);var _0x43bcdf=_0x128255[_0x8b1b('0x12')](_0xfc1e83,_0x8b1b('0x1e'),_0x8b1b('0x1d'));_0x43bcdf+=_0x128255[_0x8b1b('0x1a')](_0x8b1b('0x1d'));return _0x43bcdf;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 05ec661..1a5cc57 100644 --- a/server/components/export/csv.js +++ b/server/components/export/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc01c=['finally','exit','util','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc01c,0x66));var _0xcc01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc01c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xcc01('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xcc01('0x1'));var zipdir=require(_0xcc01('0x2'));var rimraf=require('rimraf');var db=require(_0xcc01('0x3'))['db'];var dbH=require(_0xcc01('0x3'))[_0xcc01('0x4')];var logger=require(_0xcc01('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcc01('0x6')][0x2]);var QUERY=process[_0xcc01('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x9d6f9c,_0x221ba3){var _0x470bda={'status':_0x9d6f9c};var _0x44cbe0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x221ba3){_0x470bda[_0xcc01('0x7')]=_0x221ba3;}return db[_0xcc01('0x8')]['update'](_0x470bda,_0x44cbe0);}function main(){var _0x581672=0x1388;var _0x21ccf8;logger['info'](util[_0xcc01('0x9')](_0xcc01('0xa'),EXTRACTED_REPORT_ID,_0xcc01('0xb')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcc01('0xc')]})[_0xcc01('0xd')](function(_0x5f302f){if(_0x5f302f){_0x21ccf8=_0x5f302f;_0x581672=_0x21ccf8['splitSizeCsv']||0x1388;}})[_0xcc01('0xd')](function(){return dbH['sequelize'][_0xcc01('0xe')](util[_0xcc01('0x9')](_0xcc01('0xf'),QUERY),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]});})[_0xcc01('0xd')](function(_0x553085){if(!_0x553085[0x0][_0xcc01('0x13')]){return analyticExtractedReport(_0xcc01('0x14'));}var _0x1de813=[];var _0x25de9a=0x0;if(_0x21ccf8[_0xcc01('0x15')]){if(_0x553085&&_0x553085[_0xcc01('0x16')]){var _0x2ff017=_[_0xcc01('0x17')](_0x553085[0x0][_0xcc01('0x13')]/_0x581672);var _0x4a134b=Number[_0xcc01('0x18')](_0x553085[0x0][_0xcc01('0x13')]/_0x581672)?_0x553085[0x0][_0xcc01('0x13')]%_0x581672:0x0;_0x2ff017[_0xcc01('0x19')](function(_0x1112f3){if(_0x1112f3>0x0){_0x25de9a+=_0x581672;}_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')]['query'](util[_0xcc01('0x9')](_0xcc01('0x1b'),QUERY,_0x581672,_0x25de9a),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]}));});if(_0x4a134b>0x0){_0x25de9a+=_0x581672;_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')][_0xcc01('0xe')](util[_0xcc01('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4a134b,_0x25de9a),{'type':dbH[_0xcc01('0x10')][_0xcc01('0x11')][_0xcc01('0x12')]}));}}}else{_0x1de813[_0xcc01('0x1a')](dbH[_0xcc01('0x10')]['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xcc01('0x12')]}));}var _0x5f4c45=path[_0xcc01('0x1c')](PATH);var _0x5924e6=path[_0xcc01('0x1d')](PATH,_0xcc01('0x1e'));var _0x262f65=_0x21ccf8[_0xcc01('0x15')]&&_0x1de813[_0xcc01('0x16')]>0x1;var _0x3bdb49=[];if(!fs[_0xcc01('0x1f')](path['join'](_0x5f4c45,_0x5924e6))&&_0x262f65){fs[_0xcc01('0x20')](path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6));}return BPromise[_0xcc01('0x22')](_0x1de813,function(_0x3f3949){_0x3bdb49['push'](_0x3f3949);})[_0xcc01('0xd')](function(){for(var _0x45c1b4=0x0;_0x45c1b4<_0x3bdb49[_0xcc01('0x16')];_0x45c1b4+=0x1){var _0x2767ba;var _0x5104a9=_0x3bdb49[_0x45c1b4];if(_0x262f65){_0x2767ba=path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6,util[_0xcc01('0x9')](_0xcc01('0x23'),_0x5924e6,_0x45c1b4,_0xcc01('0x24')));}else{_0x2767ba=path[_0xcc01('0x21')](_0x5f4c45,util[_0xcc01('0x9')]('%s.%s',_0x5924e6,_0xcc01('0x24')));}fs[_0xcc01('0x25')](_0x2767ba,csv(_0x5104a9));}})['then'](function(){if(_0x262f65){return new Promise(function(_0x3e7164){zipdir(path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6),{'saveTo':path['join'](_0x5f4c45,util[_0xcc01('0x9')](_0xcc01('0x26'),_0x5924e6,_0xcc01('0x27')))},function(_0x2216eb,_0x4020da){rimraf(path[_0xcc01('0x21')](_0x5f4c45,_0x5924e6),function(){});_0x3e7164(_0xcc01('0x28'));});});}})[_0xcc01('0xd')](function(){logger[_0xcc01('0x29')](util[_0xcc01('0x9')](_0xcc01('0x2a'),EXTRACTED_REPORT_ID,_0xcc01('0xb')));return analyticExtractedReport(_0xcc01('0x2b'),_0x262f65?util[_0xcc01('0x9')](_0xcc01('0x26'),_0x5924e6,_0x262f65?_0xcc01('0x27'):'csv'):null);});})[_0xcc01('0x2c')](function(_0x5a4fc5){logger[_0xcc01('0x29')](util[_0xcc01('0x9')](_0xcc01('0x2d'),EXTRACTED_REPORT_ID,_0xcc01('0xb')),util[_0xcc01('0x2e')](_0x5a4fc5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcc01('0x2f'));})[_0xcc01('0x30')](function(){process[_0xcc01('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x8477=['split','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','query','format','sequelize','SELECT','num','Empty'];(function(_0x34957f,_0x58da35){var _0x53c029=function(_0x4094f8){while(--_0x4094f8){_0x34957f['push'](_0x34957f['shift']());}};_0x53c029(++_0x58da35);}(_0x8477,0x199));var _0x7847=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x8477[_0x3a2e49];return _0x257140;};'use strict';var util=require(_0x7847('0x0'));var path=require('path');var _=require(_0x7847('0x1'));var csv=require(_0x7847('0x2'));var fs=require('fs');var BPromise=require(_0x7847('0x3'));var zipdir=require(_0x7847('0x4'));var rimraf=require('rimraf');var db=require(_0x7847('0x5'))['db'];var dbH=require(_0x7847('0x5'))[_0x7847('0x6')];var logger=require(_0x7847('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7847('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7847('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a92f1,_0x2d62f7){var _0x1302a7={'status':_0x1a92f1};var _0x434ae8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d62f7){_0x1302a7[_0x7847('0x9')]=_0x2d62f7;}return db[_0x7847('0xa')][_0x7847('0xb')](_0x1302a7,_0x434ae8);}function main(){var _0x47b1b9=0x1388;var _0x1983f6;logger['info'](util['format'](_0x7847('0xc'),EXTRACTED_REPORT_ID,_0x7847('0xd')));return db['Setting'][_0x7847('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x7847('0xf')]})[_0x7847('0x10')](function(_0x3b2a34){if(_0x3b2a34){_0x1983f6=_0x3b2a34;_0x47b1b9=_0x1983f6[_0x7847('0xf')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x7847('0x11')](util[_0x7847('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x7847('0x13')]['QueryTypes'][_0x7847('0x14')]});})[_0x7847('0x10')](function(_0x4dc56e){if(!_0x4dc56e[0x0][_0x7847('0x15')]){return analyticExtractedReport(_0x7847('0x16'));}var _0xc1ab4a=[];var _0x1c1d64=0x0;if(_0x1983f6[_0x7847('0x17')]){if(_0x4dc56e&&_0x4dc56e[_0x7847('0x18')]){var _0x484df0=_['range'](_0x4dc56e[0x0]['num']/_0x47b1b9);var _0x161261=Number[_0x7847('0x19')](_0x4dc56e[0x0][_0x7847('0x15')]/_0x47b1b9)?_0x4dc56e[0x0][_0x7847('0x15')]%_0x47b1b9:0x0;_0x484df0[_0x7847('0x1a')](function(_0x26d123){if(_0x26d123>0x0){_0x1c1d64+=_0x47b1b9;}_0xc1ab4a[_0x7847('0x1b')](dbH[_0x7847('0x13')][_0x7847('0x11')](util[_0x7847('0x12')](_0x7847('0x1c'),QUERY,_0x47b1b9,_0x1c1d64),{'type':dbH[_0x7847('0x13')][_0x7847('0x1d')][_0x7847('0x14')]}));});if(_0x161261>0x0){_0x1c1d64+=_0x47b1b9;_0xc1ab4a[_0x7847('0x1b')](dbH['sequelize'][_0x7847('0x11')](util[_0x7847('0x12')](_0x7847('0x1c'),QUERY,_0x161261,_0x1c1d64),{'type':dbH[_0x7847('0x13')][_0x7847('0x1d')][_0x7847('0x14')]}));}}}else{_0xc1ab4a['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x7847('0x13')]['QueryTypes'][_0x7847('0x14')]}));}var _0x2da1ef=path[_0x7847('0x1e')](PATH);var _0x1924bf=path[_0x7847('0x1f')](PATH,_0x7847('0x20'));var _0x45f965=_0x1983f6[_0x7847('0x17')]&&_0xc1ab4a[_0x7847('0x18')]>0x1;var _0x44e65c=[];if(!fs['existsSync'](path['join'](_0x2da1ef,_0x1924bf))&&_0x45f965){fs['mkdirSync'](path[_0x7847('0x21')](_0x2da1ef,_0x1924bf));}return BPromise[_0x7847('0x22')](_0xc1ab4a,function(_0x2ffcb4){_0x44e65c[_0x7847('0x1b')](_0x2ffcb4);})[_0x7847('0x10')](function(){for(var _0x19f4bc=0x0;_0x19f4bc<_0x44e65c[_0x7847('0x18')];_0x19f4bc+=0x1){var _0x47a6bb;var _0x2f6cd7=_0x44e65c[_0x19f4bc];if(_0x45f965){_0x47a6bb=path[_0x7847('0x21')](_0x2da1ef,_0x1924bf,util[_0x7847('0x12')](_0x7847('0x23'),_0x1924bf,_0x19f4bc,_0x7847('0x24')));}else{_0x47a6bb=path['join'](_0x2da1ef,util[_0x7847('0x12')]('%s.%s',_0x1924bf,'csv'));}fs['writeFileSync'](_0x47a6bb,csv(_0x2f6cd7));}})[_0x7847('0x10')](function(){if(_0x45f965){return new Promise(function(_0x2a558a){zipdir(path['join'](_0x2da1ef,_0x1924bf),{'saveTo':path[_0x7847('0x21')](_0x2da1ef,util['format'](_0x7847('0x25'),_0x1924bf,_0x7847('0x26')))},function(_0x40a877,_0x57ea50){rimraf(path['join'](_0x2da1ef,_0x1924bf),function(){});_0x2a558a(_0x7847('0x27'));});});}})['then'](function(){logger[_0x7847('0x28')](util[_0x7847('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7847('0xd')));return analyticExtractedReport(_0x7847('0x29'),_0x45f965?util[_0x7847('0x12')]('%s.%s',_0x1924bf,_0x45f965?_0x7847('0x26'):'csv'):null);});})[_0x7847('0x2a')](function(_0x3867e8){logger['info'](util['format'](_0x7847('0x2b'),EXTRACTED_REPORT_ID,_0x7847('0xd')),util[_0x7847('0x2c')](_0x3867e8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7847('0x2d'));})[_0x7847('0x2e')](function(){process[_0x7847('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2d38249..4b40a59 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b9a=['\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','util','path','moment','html-to-pdfmake','rimraf','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','toString','value','fill','length','auto','body','push','concat','chunk','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','split','splitSizePdf','then','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript'];(function(_0xa47593,_0x37b985){var _0x5cb558=function(_0x4c3fd0){while(--_0x4c3fd0){_0xa47593['push'](_0xa47593['shift']());}};_0x5cb558(++_0x37b985);}(_0x3b9a,0x161));var _0xa3b9=function(_0x2020da,_0x14f147){_0x2020da=_0x2020da-0x0;var _0xae3048=_0x3b9a[_0x2020da];return _0xae3048;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xa3b9('0x0'));var path=require(_0xa3b9('0x1'));var moment=require(_0xa3b9('0x2'));var htmlToPdfmake=require(_0xa3b9('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0xa3b9('0x4'));var JSDOM=require('jsdom')[_0xa3b9('0x5')];var window=new JSDOM('')[_0xa3b9('0x6')];var BPromise=require(_0xa3b9('0x7'));var db=require(_0xa3b9('0x8'))['db'];var dbH=require(_0xa3b9('0x8'))['dbH'];var logger=require('../../config/logger')(_0xa3b9('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xa3b9('0xa')][0x5];var FORMAT=_0xa3b9('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x6f3570,_0x2a9d95){var _0x489aae={'status':_0x6f3570};var _0x34f959={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2a9d95){_0x489aae['savename']=_0x2a9d95;}return db[_0xa3b9('0xc')][_0xa3b9('0xd')](_0x489aae,_0x34f959);}function getHeaders(_0x8ed3f1){return _[_0xa3b9('0xe')](_0x8ed3f1,function(_0x5e4c68){return{'text':_0x5e4c68,'style':'tableHeader'};});}function getRows(_0x5733e0,_0x2479eb){return _[_0xa3b9('0xe')](_0x2479eb,function(_0x51b7ec){return _(_0x51b7ec)['pick'](_0x5733e0)[_0xa3b9('0xe')](function(_0x35c8b7){return _0x35c8b7?_[_0xa3b9('0xf')](_0x35c8b7):'';})[_0xa3b9('0x10')]();});}function createTable(_0x499f5c,_0x5b1168){var _0x5068fb={'widths':_[_0xa3b9('0x11')](Array(_0x499f5c[_0xa3b9('0x12')]),0x91),'heights':function(_0x311516){return _0x311516===0x0?_0xa3b9('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x375e72=getHeaders(_0x499f5c);_0x5068fb[_0xa3b9('0x14')][_0xa3b9('0x15')](_0x375e72);var _0x2e9425=getRows(_0x499f5c,_0x5b1168);_0x5068fb[_0xa3b9('0x14')]=_0x5068fb[_0xa3b9('0x14')][_0xa3b9('0x16')](_0x2e9425);return _0x5068fb;}function createTables(_0xd01078){var _0x4e872f=[];var _0x373e6b=_[_0xa3b9('0x17')](Object[_0xa3b9('0x18')](_0xd01078[0x0]),0x5);_0x373e6b['forEach'](function(_0x410afc){_0x4e872f[_0xa3b9('0x15')](createTable(_0x410afc,_0xd01078));});return _0x4e872f;}function getPDFDocDefinition(_0x403865){var _0x16d7ea=util[_0xa3b9('0x19')](_0xa3b9('0x1a'),NAME,EXTRACTED_REPORT[_0xa3b9('0x1b')],moment(EXTRACTED_REPORT[_0xa3b9('0x1c')])[_0xa3b9('0x19')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xa3b9('0x19')](FORMAT));var _0x3b96bb=[];for(var _0x1985f9=0x0;_0x1985f9<_0x403865['length'];_0x1985f9++){var _0x1cb6c4=[];if(_0x1985f9===0x0){_0x1cb6c4[_0xa3b9('0x15')]({'text':_0x16d7ea,'style':_0xa3b9('0x1d')});}var _0x4c13db={'table':_0x403865[_0x1985f9]};if(_0x1985f9>0x0){_0x4c13db['pageBreak']=_0xa3b9('0x1e');_0x4c13db[_0xa3b9('0x1f')]=[0x0,0x46,0x0,0x0];}_0x1cb6c4[_0xa3b9('0x15')](_0x4c13db);_0x3b96bb[_0xa3b9('0x15')](_0x1cb6c4);}return{'pageSize':'A4','pageOrientation':_0xa3b9('0x20'),'content':_0x3b96bb,'footer':function(_0x28b795,_0x3d8937){return{'text':_0x28b795[_0xa3b9('0xf')]()+_0xa3b9('0x21')+_0x3d8937,'style':_0xa3b9('0x22')};},'defaultStyle':{'font':_0xa3b9('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xa3b9('0x24')},'footer':{'alignment':_0xa3b9('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x35190e){var _0x5b1356=0x1388;var _0x5c9b4a;if(!_0x35190e[0x0][_0xa3b9('0x26')]){return analyticExtractedReport(_0xa3b9('0x27'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa3b9('0x28'),_0xa3b9('0x29')]})[_0xa3b9('0x2a')](function(_0xd4505f){if(_0xd4505f){_0x5c9b4a=_0xd4505f;_0x5b1356=_0x5c9b4a[_0xa3b9('0x29')]||0x3e8;}})[_0xa3b9('0x2a')](function(){var _0x527622=[];var _0x3e7450=0x0;if(_0x5c9b4a[_0xa3b9('0x28')]){if(_0x35190e&&_0x35190e[_0xa3b9('0x12')]){var _0x165ad7=_['range'](_0x35190e[0x0][_0xa3b9('0x26')]/_0x5b1356);var _0xb0a8b5=Number[_0xa3b9('0x2b')](_0x35190e[0x0][_0xa3b9('0x26')]/_0x5b1356)?_0x35190e[0x0][_0xa3b9('0x26')]%_0x5b1356:0x0;_0x165ad7[_0xa3b9('0x2c')](function(_0x53725b){if(_0x53725b>0x0){_0x3e7450+=_0x5b1356;}_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')][_0xa3b9('0x2e')](util[_0xa3b9('0x19')](_0xa3b9('0x2f'),QUERY,_0x5b1356,_0x3e7450),{'type':dbH[_0xa3b9('0x2d')][_0xa3b9('0x30')]['SELECT']}));});if(_0xb0a8b5>0x0){_0x3e7450+=_0x5b1356;_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')]['query'](util[_0xa3b9('0x19')](_0xa3b9('0x2f'),QUERY,_0xb0a8b5,_0x3e7450),{'type':dbH[_0xa3b9('0x2d')][_0xa3b9('0x30')][_0xa3b9('0x31')]}));}}}else{_0x527622[_0xa3b9('0x15')](dbH[_0xa3b9('0x2d')]['query'](QUERY,{'type':dbH[_0xa3b9('0x2d')]['QueryTypes'][_0xa3b9('0x31')]}));}var _0x56a52a=path['dirname'](PATH);var _0x3ed231=path[_0xa3b9('0x32')](PATH,_0xa3b9('0x33'));var _0x4b6ea0=_0x5c9b4a[_0xa3b9('0x28')]&&_0x527622[_0xa3b9('0x12')]>0x1;var _0x4fd5ca=[];if(!fs[_0xa3b9('0x34')](path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231))&&_0x4b6ea0){fs[_0xa3b9('0x36')](path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231));}return BPromise[_0xa3b9('0x37')](_0x527622,function(_0x4404ea){_0x4fd5ca[_0xa3b9('0x15')](_0x4404ea);})[_0xa3b9('0x2a')](function(){var _0x34522a=[];for(var _0x37f9d0=0x0;_0x37f9d0<_0x4fd5ca[_0xa3b9('0x12')];_0x37f9d0+=0x1){var _0x25a13c=_0x4fd5ca[_0x37f9d0];var _0x4c5084=createTables(_[_0xa3b9('0x38')](_0x25a13c));var _0x3714de;var _0x431874=getPDFDocDefinition(_0x4c5084);var _0x494482=getPDFPrinter();var _0x222ae4=_0x494482[_0xa3b9('0x39')](_0x431874);if(_0x4b6ea0){_0x3714de=path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231,util[_0xa3b9('0x19')](_0xa3b9('0x3a'),_0x3ed231,_0x37f9d0,'pdf'));}else{_0x3714de=path[_0xa3b9('0x35')](_0x56a52a,util[_0xa3b9('0x19')](_0xa3b9('0x3b'),_0x3ed231,_0xa3b9('0x3c')));}_0x34522a[_0xa3b9('0x15')](writePDFDocument(_0x222ae4,_0x3714de));}return Promise[_0xa3b9('0x3d')](_0x34522a);})[_0xa3b9('0x2a')](function(){if(_0x4b6ea0){return new Promise(function(_0x53c265){zipdir(path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231),{'saveTo':path[_0xa3b9('0x35')](_0x56a52a,util[_0xa3b9('0x19')](_0xa3b9('0x3b'),_0x3ed231,'zip'))},function(){rimraf(path[_0xa3b9('0x35')](_0x56a52a,_0x3ed231),function(){});_0x53c265(_0xa3b9('0x3e'));});});}})[_0xa3b9('0x2a')](function(){if(!_0x4b6ea0)return;rimraf(path['join'](_0x56a52a,_0x3ed231),function(){});})['then'](function(){logger[_0xa3b9('0x3f')](util[_0xa3b9('0x19')](_0xa3b9('0x40'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')));return analyticExtractedReport(_0xa3b9('0x42'),_0x4b6ea0?util['format'](_0xa3b9('0x3b'),_0x3ed231,_0x4b6ea0?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa3b9('0x3f')](util[_0xa3b9('0x19')](_0xa3b9('0x43'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')));return db[_0xa3b9('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xa3b9('0x2a')](function(_0x392c98){EXTRACTED_REPORT=_0x392c98;return dbH['sequelize'][_0xa3b9('0x2e')](util['format'](_0xa3b9('0x44'),QUERY),{'type':dbH[_0xa3b9('0x2d')]['QueryTypes'][_0xa3b9('0x31')]});})[_0xa3b9('0x2a')](extractReport)[_0xa3b9('0x45')](function(_0x459fd5){logger['info'](util['format'](_0xa3b9('0x46'),EXTRACTED_REPORT_ID,_0xa3b9('0x41')),util[_0xa3b9('0x47')](_0x459fd5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xa3b9('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x6e7ecb=new PdfPrinter({'Arial':{'normal':__dirname+_0xa3b9('0x49'),'bold':__dirname+_0xa3b9('0x4a'),'italics':__dirname+_0xa3b9('0x4b'),'bolditalics':__dirname+_0xa3b9('0x4c')}});return _0x6e7ecb;}function getPDFDocDefinitionFromHTML(_0x156168,_0x1b41e8){var _0xb25f78=util[_0xa3b9('0x19')](_0xa3b9('0x4d'),_0x1b41e8[_0xa3b9('0x4e')],_0x1b41e8[_0xa3b9('0x4f')]);var _0x1465a6=moment()[_0xa3b9('0x19')]('YYYY-MM-DD')[_0xa3b9('0xf')]();var _0x5aeefc=htmlToPdfmake(_0x156168,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5aeefc],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xa3b9('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa3b9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa3b9('0x50')}},'header':function(){return[{'text':_0xa3b9('0x51'),'style':_0xa3b9('0x1d')}];},'footer':function(_0x533617,_0xfee4d6){return[{'text':util[_0xa3b9('0x19')](_0xa3b9('0x52'),_0xb25f78,_0x533617,_0xfee4d6,_0x1465a6),'style':_0xa3b9('0x22')}];}};}function writePDFDocument(_0x33a014,_0x1e8c9d){return new Promise(function(_0x33cd7c,_0x39e286){var _0x3f07da=_0x33a014[_0xa3b9('0x53')](fs[_0xa3b9('0x54')](_0x1e8c9d));_0x3f07da['on'](_0xa3b9('0x55'),function(){_0x33cd7c(_0xa3b9('0x55'));});_0x3f07da['on'](_0xa3b9('0x56'),function(_0x54f04c){_0x39e286(_0x54f04c);});_0x33a014['end']();});}exports['createPdfFromHTML']=function(_0x3d2dc0,_0x587c1d){var _0x24643c=getPDFPrinter();var _0x4edda2=getPDFDocDefinitionFromHTML(_0x3d2dc0,_0x587c1d);var _0x4f39fd=_0x24643c[_0xa3b9('0x39')](_0x4edda2);return writePDFDocument(_0x4f39fd,_0x587c1d[_0xa3b9('0x1')])[_0xa3b9('0x45')](function(_0x170c52){throw _0x170c52;});}; \ No newline at end of file +var _0x32ca=['argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','auto','body','push','concat','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','num','Empty','Setting','splitSizePdf','then','split','isInteger','sequelize','query','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','error','end','lodash','util','path','moment','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics'];(function(_0x58c58c,_0x6b221c){var _0x1a2161=function(_0x1a5020){while(--_0x1a5020){_0x58c58c['push'](_0x58c58c['shift']());}};_0x1a2161(++_0x6b221c);}(_0x32ca,0x162));var _0xa32c=function(_0x391507,_0x564142){_0x391507=_0x391507-0x0;var _0x47fdc4=_0x32ca[_0x391507];return _0x47fdc4;};'use strict';var _=require(_0xa32c('0x0'));var fs=require('fs');var util=require(_0xa32c('0x1'));var path=require(_0xa32c('0x2'));var moment=require(_0xa32c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xa32c('0x4'));var zipdir=require(_0xa32c('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0xa32c('0x6'))[_0xa32c('0x7')];var window=new JSDOM('')[_0xa32c('0x8')];var BPromise=require(_0xa32c('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0xa32c('0xa'))[_0xa32c('0xb')];var logger=require(_0xa32c('0xc'))(_0xa32c('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xa32c('0xe')][0x2]);var QUERY=process[_0xa32c('0xe')][0x3];var PATH=process[_0xa32c('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xa32c('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a9c2,_0x29c218){var _0x4e6e98={'status':_0x2a9c2};var _0x23134c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x29c218){_0x4e6e98['savename']=_0x29c218;}return db[_0xa32c('0x10')][_0xa32c('0x11')](_0x4e6e98,_0x23134c);}function getHeaders(_0x3987b8){return _[_0xa32c('0x12')](_0x3987b8,function(_0x1b7c3b){return{'text':_0x1b7c3b,'style':_0xa32c('0x13')};});}function getRows(_0x3a915d,_0x323d90){return _[_0xa32c('0x12')](_0x323d90,function(_0x533b15){return _(_0x533b15)[_0xa32c('0x14')](_0x3a915d)[_0xa32c('0x12')](function(_0x535159){return _0x535159?_[_0xa32c('0x15')](_0x535159):'';})[_0xa32c('0x16')]();});}function createTable(_0x23f721,_0xd40631){var _0x1f72f6={'widths':_[_0xa32c('0x17')](Array(_0x23f721['length']),0x91),'heights':function(_0x3e3f0f){return _0x3e3f0f===0x0?_0xa32c('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x16f799=getHeaders(_0x23f721);_0x1f72f6[_0xa32c('0x19')][_0xa32c('0x1a')](_0x16f799);var _0x556fc3=getRows(_0x23f721,_0xd40631);_0x1f72f6['body']=_0x1f72f6[_0xa32c('0x19')][_0xa32c('0x1b')](_0x556fc3);return _0x1f72f6;}function createTables(_0x45fbf5){var _0x563eb2=[];var _0x4af024=_['chunk'](Object['keys'](_0x45fbf5[0x0]),0x5);_0x4af024[_0xa32c('0x1c')](function(_0x266fae){_0x563eb2['push'](createTable(_0x266fae,_0x45fbf5));});return _0x563eb2;}function getPDFDocDefinition(_0x52f9ce){var _0x35f9b2=util['format'](_0xa32c('0x1d'),NAME,EXTRACTED_REPORT[_0xa32c('0x1e')],moment(EXTRACTED_REPORT[_0xa32c('0x1f')])[_0xa32c('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0xa32c('0x21')])[_0xa32c('0x20')](FORMAT));var _0x176ebc=[];for(var _0x1702f8=0x0;_0x1702f8<_0x52f9ce[_0xa32c('0x22')];_0x1702f8++){var _0x28e94e=[];if(_0x1702f8===0x0){_0x28e94e[_0xa32c('0x1a')]({'text':_0x35f9b2,'style':_0xa32c('0x23')});}var _0x402021={'table':_0x52f9ce[_0x1702f8]};if(_0x1702f8>0x0){_0x402021[_0xa32c('0x24')]=_0xa32c('0x25');_0x402021[_0xa32c('0x26')]=[0x0,0x46,0x0,0x0];}_0x28e94e[_0xa32c('0x1a')](_0x402021);_0x176ebc['push'](_0x28e94e);}return{'pageSize':'A4','pageOrientation':_0xa32c('0x27'),'content':_0x176ebc,'footer':function(_0x4b64d0,_0x50dce0){return{'text':_0x4b64d0['toString']()+_0xa32c('0x28')+_0x50dce0,'style':_0xa32c('0x29')};},'defaultStyle':{'font':_0xa32c('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x511617){var _0x217f1b=0x1388;var _0x3bec81;if(!_0x511617[0x0][_0xa32c('0x2b')]){return analyticExtractedReport(_0xa32c('0x2c'));}return db[_0xa32c('0x2d')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa32c('0x2e')]})[_0xa32c('0x2f')](function(_0xe4553d){if(_0xe4553d){_0x3bec81=_0xe4553d;_0x217f1b=_0x3bec81[_0xa32c('0x2e')]||0x3e8;}})[_0xa32c('0x2f')](function(){var _0x562f30=[];var _0x632973=0x0;if(_0x3bec81[_0xa32c('0x30')]){if(_0x511617&&_0x511617[_0xa32c('0x22')]){var _0x23e793=_['range'](_0x511617[0x0]['num']/_0x217f1b);var _0x6e8d32=Number[_0xa32c('0x31')](_0x511617[0x0]['num']/_0x217f1b)?_0x511617[0x0]['num']%_0x217f1b:0x0;_0x23e793[_0xa32c('0x1c')](function(_0x42aeca){if(_0x42aeca>0x0){_0x632973+=_0x217f1b;}_0x562f30[_0xa32c('0x1a')](dbH[_0xa32c('0x32')][_0xa32c('0x33')](util[_0xa32c('0x20')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x217f1b,_0x632973),{'type':dbH['sequelize'][_0xa32c('0x34')][_0xa32c('0x35')]}));});if(_0x6e8d32>0x0){_0x632973+=_0x217f1b;_0x562f30['push'](dbH[_0xa32c('0x32')][_0xa32c('0x33')](util[_0xa32c('0x20')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x6e8d32,_0x632973),{'type':dbH[_0xa32c('0x32')][_0xa32c('0x34')][_0xa32c('0x35')]}));}}}else{_0x562f30[_0xa32c('0x1a')](dbH[_0xa32c('0x32')][_0xa32c('0x33')](QUERY,{'type':dbH['sequelize'][_0xa32c('0x34')][_0xa32c('0x35')]}));}var _0x57750f=path[_0xa32c('0x36')](PATH);var _0x2fd78e=path[_0xa32c('0x37')](PATH,_0xa32c('0x38'));var _0x1ed566=_0x3bec81[_0xa32c('0x30')]&&_0x562f30[_0xa32c('0x22')]>0x1;var _0x47de52=[];if(!fs[_0xa32c('0x39')](path[_0xa32c('0x3a')](_0x57750f,_0x2fd78e))&&_0x1ed566){fs[_0xa32c('0x3b')](path[_0xa32c('0x3a')](_0x57750f,_0x2fd78e));}return BPromise[_0xa32c('0x3c')](_0x562f30,function(_0x460690){_0x47de52[_0xa32c('0x1a')](_0x460690);})['then'](function(){var _0x296018=[];for(var _0x25fe31=0x0;_0x25fe31<_0x47de52[_0xa32c('0x22')];_0x25fe31+=0x1){var _0x1ca0fb=_0x47de52[_0x25fe31];var _0xffe8d7=createTables(_[_0xa32c('0x3d')](_0x1ca0fb));var _0x2e4ab0;var _0x5104b0=getPDFDocDefinition(_0xffe8d7);var _0x2d7177=getPDFPrinter();var _0x178666=_0x2d7177[_0xa32c('0x3e')](_0x5104b0);if(_0x1ed566){_0x2e4ab0=path['join'](_0x57750f,_0x2fd78e,util[_0xa32c('0x20')](_0xa32c('0x3f'),_0x2fd78e,_0x25fe31,_0xa32c('0x40')));}else{_0x2e4ab0=path[_0xa32c('0x3a')](_0x57750f,util[_0xa32c('0x20')](_0xa32c('0x41'),_0x2fd78e,_0xa32c('0x40')));}_0x296018[_0xa32c('0x1a')](writePDFDocument(_0x178666,_0x2e4ab0));}return Promise[_0xa32c('0x42')](_0x296018);})[_0xa32c('0x2f')](function(){if(_0x1ed566){return new Promise(function(_0x274f24){zipdir(path[_0xa32c('0x3a')](_0x57750f,_0x2fd78e),{'saveTo':path[_0xa32c('0x3a')](_0x57750f,util[_0xa32c('0x20')](_0xa32c('0x41'),_0x2fd78e,_0xa32c('0x43')))},function(){rimraf(path[_0xa32c('0x3a')](_0x57750f,_0x2fd78e),function(){});_0x274f24(_0xa32c('0x44'));});});}})[_0xa32c('0x2f')](function(){if(!_0x1ed566)return;rimraf(path[_0xa32c('0x3a')](_0x57750f,_0x2fd78e),function(){});})['then'](function(){logger['info'](util[_0xa32c('0x20')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xa32c('0x45'),_0x1ed566?util['format'](_0xa32c('0x41'),_0x2fd78e,_0x1ed566?_0xa32c('0x43'):_0xa32c('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xa32c('0x46')](util[_0xa32c('0x20')](_0xa32c('0x47'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xa32c('0x10')][_0xa32c('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xd237a5){EXTRACTED_REPORT=_0xd237a5;return dbH['sequelize'][_0xa32c('0x33')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa32c('0x32')]['QueryTypes'][_0xa32c('0x35')]});})[_0xa32c('0x2f')](extractReport)[_0xa32c('0x49')](function(_0x36e5c9){logger['info'](util[_0xa32c('0x20')](_0xa32c('0x4a'),EXTRACTED_REPORT_ID,_0xa32c('0x4b')),util[_0xa32c('0x4c')](_0x36e5c9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xa32c('0x4d')](function(){process[_0xa32c('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xc9a81c=new PdfPrinter({'Arial':{'normal':__dirname+_0xa32c('0x4f'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xa32c('0x50'),'bolditalics':__dirname+_0xa32c('0x51')}});return _0xc9a81c;}function getPDFDocDefinitionFromHTML(_0x2760b3,_0x8fbf52){var _0x1b2ccf=util['format'](_0xa32c('0x52'),_0x8fbf52[_0xa32c('0x53')],_0x8fbf52[_0xa32c('0x54')]);var _0x40c703=moment()[_0xa32c('0x20')](_0xa32c('0x55'))[_0xa32c('0x15')]();var _0x16ca83=htmlToPdfmake(_0x2760b3,{'window':window,'tableAutoSize':!![]});return{'content':[_0x16ca83],'defaultStyle':{'font':_0xa32c('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xa32c('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xa32c('0x56')}},'header':function(){return[{'text':_0xa32c('0x57'),'style':_0xa32c('0x23')}];},'footer':function(_0x382afc,_0x4f7772){return[{'text':util[_0xa32c('0x20')](_0xa32c('0x58'),_0x1b2ccf,_0x382afc,_0x4f7772,_0x40c703),'style':_0xa32c('0x29')}];}};}function writePDFDocument(_0x35ac61,_0x347a2f){return new Promise(function(_0x52bd0c,_0x31fa6d){var _0x4c1bb7=_0x35ac61['pipe'](fs['createWriteStream'](_0x347a2f));_0x4c1bb7['on'](_0xa32c('0x59'),function(){_0x52bd0c(_0xa32c('0x59'));});_0x4c1bb7['on'](_0xa32c('0x5a'),function(_0x521f27){_0x31fa6d(_0x521f27);});_0x35ac61[_0xa32c('0x5b')]();});}exports['createPdfFromHTML']=function(_0x44e71e,_0x2a1d4c){var _0x326805=getPDFPrinter();var _0x2765aa=getPDFDocDefinitionFromHTML(_0x44e71e,_0x2a1d4c);var _0xdc17df=_0x326805[_0xa32c('0x3e')](_0x2765aa);return writePDFDocument(_0xdc17df,_0x2a1d4c['path'])[_0xa32c('0x49')](function(_0x1504f3){throw _0x1504f3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 13648b4..4f9603b 100644 --- a/server/components/export/xlsx.js +++ b/server/components/export/xlsx.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc91=['savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','range','isInteger','forEach','push','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip\x20finished','XLSX','zip','catch','inspect','Failed','finally','exit','util','path','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv'];(function(_0x49b4ba,_0x41763f){var _0x1768ac=function(_0x4132e8){while(--_0x4132e8){_0x49b4ba['push'](_0x49b4ba['shift']());}};_0x1768ac(++_0x41763f);}(_0xdc91,0x8b));var _0x1dc9=function(_0x209fd5,_0x2035a8){_0x209fd5=_0x209fd5-0x0;var _0x1f8f75=_0xdc91[_0x209fd5];return _0x1f8f75;};'use strict';var util=require(_0x1dc9('0x0'));var path=require(_0x1dc9('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x1dc9('0x2'));var db=require(_0x1dc9('0x3'))['db'];var dbH=require(_0x1dc9('0x3'))[_0x1dc9('0x4')];var logger=require(_0x1dc9('0x5'))(_0x1dc9('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x1dc9('0x7')][0x2]);var QUERY=process[_0x1dc9('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2c6e6c,_0x25a752){var _0x316995={'status':_0x2c6e6c};var _0x3d1772={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25a752){_0x316995[_0x1dc9('0x8')]=_0x25a752;}return db[_0x1dc9('0x9')][_0x1dc9('0xa')](_0x316995,_0x3d1772);}function main(){var _0x2e2e69=0x1388;var _0x32a428;logger[_0x1dc9('0xb')](util['format'](_0x1dc9('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1dc9('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1dc9('0xe'),_0x1dc9('0xf')]})[_0x1dc9('0x10')](function(_0x123684){if(_0x123684){_0x32a428=_0x123684;_0x2e2e69=_0x32a428['splitSizeXlsx']||0x1388;}})[_0x1dc9('0x10')](function(){return dbH[_0x1dc9('0x11')]['query'](util[_0x1dc9('0x12')](_0x1dc9('0x13'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x1dc9('0x14')]});})[_0x1dc9('0x10')](function(_0x38ee59){if(!_0x38ee59[0x0][_0x1dc9('0x15')]){return analyticExtractedReport('Empty');}var _0x4e8c52=[];var _0x2566bb=0x0;if(_0x32a428[_0x1dc9('0xe')]){if(_0x38ee59&&_0x38ee59['length']){var _0x21cf4d=_[_0x1dc9('0x16')](_0x38ee59[0x0][_0x1dc9('0x15')]/_0x2e2e69);var _0x197bcd=Number[_0x1dc9('0x17')](_0x38ee59[0x0][_0x1dc9('0x15')]/_0x2e2e69)?_0x38ee59[0x0][_0x1dc9('0x15')]%_0x2e2e69:0x0;_0x21cf4d[_0x1dc9('0x18')](function(_0x1386c9){if(_0x1386c9>0x0){_0x2566bb+=_0x2e2e69;}_0x4e8c52[_0x1dc9('0x19')](dbH[_0x1dc9('0x11')][_0x1dc9('0x1a')](util[_0x1dc9('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2e2e69,_0x2566bb),{'type':dbH['sequelize'][_0x1dc9('0x1b')]['SELECT']}));});if(_0x197bcd>0x0){_0x2566bb+=_0x2e2e69;_0x4e8c52['push'](dbH['sequelize'][_0x1dc9('0x1a')](util[_0x1dc9('0x12')](_0x1dc9('0x1c'),QUERY,_0x197bcd,_0x2566bb),{'type':dbH[_0x1dc9('0x11')][_0x1dc9('0x1b')][_0x1dc9('0x14')]}));}}}else{_0x4e8c52[_0x1dc9('0x19')](dbH['sequelize'][_0x1dc9('0x1a')](QUERY,{'type':dbH[_0x1dc9('0x11')][_0x1dc9('0x1b')]['SELECT']}));}var _0x39f3f7=path[_0x1dc9('0x1d')](PATH);var _0xec8330=path[_0x1dc9('0x1e')](PATH,_0x1dc9('0x1f'));var _0x476111=_0x32a428[_0x1dc9('0xe')]&&_0x4e8c52[_0x1dc9('0x20')]>0x1;var _0x3e70c3=[];if(!fs['existsSync'](path['join'](_0x39f3f7,_0xec8330))&&_0x476111){fs[_0x1dc9('0x21')](path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330));}return BPromise[_0x1dc9('0x23')](_0x4e8c52,function(_0x2e01df){_0x3e70c3[_0x1dc9('0x19')](_0x2e01df);})[_0x1dc9('0x10')](function(){for(var _0x10123d=0x0;_0x10123d<_0x3e70c3[_0x1dc9('0x20')];_0x10123d+=0x1){var _0x16b71d;var _0x5f1403=_0x3e70c3[_0x10123d];if(_0x476111){_0x16b71d=path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330,util[_0x1dc9('0x12')](_0x1dc9('0x24'),_0xec8330,_0x10123d,_0x1dc9('0x25')));}else{_0x16b71d=path[_0x1dc9('0x22')](_0x39f3f7,util[_0x1dc9('0x12')]('%s.%s',_0xec8330,'xlsx'));}fs[_0x1dc9('0x26')](_0x16b71d,json2xls(_0x5f1403),_0x1dc9('0x27'));}})['then'](function(){if(_0x476111){return new Promise(function(_0x14223b){zipdir(path[_0x1dc9('0x22')](_0x39f3f7,_0xec8330),{'saveTo':path[_0x1dc9('0x22')](_0x39f3f7,util['format'](_0x1dc9('0x28'),_0xec8330,'zip'))},function(_0x1cc808,_0x5eece6){rimraf(path['join'](_0x39f3f7,_0xec8330),function(){});_0x14223b(_0x1dc9('0x29'));});});}})[_0x1dc9('0x10')](function(){logger[_0x1dc9('0xb')](util[_0x1dc9('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1dc9('0x2a')));return analyticExtractedReport('Completed',_0x476111?util[_0x1dc9('0x12')](_0x1dc9('0x28'),_0xec8330,_0x476111?_0x1dc9('0x2b'):_0x1dc9('0x25')):null);});})[_0x1dc9('0x2c')](function(_0x2d3b0b){logger[_0x1dc9('0xb')](util[_0x1dc9('0x12')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x1dc9('0x2d')](_0x2d3b0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1dc9('0x2e'));})[_0x1dc9('0x2f')](function(){process[_0x1dc9('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xdcec=['find','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','join','mkdirSync','each','then','xlsx','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','lodash','json2xls','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x134700,_0x569804){var _0x2dee65=function(_0x2e67d4){while(--_0x2e67d4){_0x134700['push'](_0x134700['shift']());}};_0x2dee65(++_0x569804);}(_0xdcec,0xf2));var _0xcdce=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0xdcec[_0x4b1665];return _0x5850c0;};'use strict';var util=require('util');var path=require(_0xcdce('0x0'));var _=require(_0xcdce('0x1'));var fs=require('fs');var json2xls=require(_0xcdce('0x2'));var BPromise=require(_0xcdce('0x3'));var zipdir=require(_0xcdce('0x4'));var rimraf=require(_0xcdce('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcdce('0x6')];var logger=require(_0xcdce('0x7'))(_0xcdce('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xcdce('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x321f2f,_0xe97d13){var _0x1c582f={'status':_0x321f2f};var _0x16f148={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe97d13){_0x1c582f[_0xcdce('0xa')]=_0xe97d13;}return db[_0xcdce('0xb')][_0xcdce('0xc')](_0x1c582f,_0x16f148);}function main(){var _0x516ffb=0x1388;var _0x48ee0b;logger[_0xcdce('0xd')](util[_0xcdce('0xe')](_0xcdce('0xf'),EXTRACTED_REPORT_ID,_0xcdce('0x10')));return db[_0xcdce('0x11')][_0xcdce('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcdce('0x13')]})['then'](function(_0x4ba64e){if(_0x4ba64e){_0x48ee0b=_0x4ba64e;_0x516ffb=_0x48ee0b[_0xcdce('0x13')]||0x1388;}})['then'](function(){return dbH[_0xcdce('0x14')][_0xcdce('0x15')](util[_0xcdce('0xe')](_0xcdce('0x16'),QUERY),{'type':dbH[_0xcdce('0x14')][_0xcdce('0x17')]['SELECT']});})['then'](function(_0x3f99b6){if(!_0x3f99b6[0x0][_0xcdce('0x18')]){return analyticExtractedReport(_0xcdce('0x19'));}var _0x510ca9=[];var _0x5c5da6=0x0;if(_0x48ee0b[_0xcdce('0x1a')]){if(_0x3f99b6&&_0x3f99b6[_0xcdce('0x1b')]){var _0x335eb8=_[_0xcdce('0x1c')](_0x3f99b6[0x0][_0xcdce('0x18')]/_0x516ffb);var _0x878fd9=Number[_0xcdce('0x1d')](_0x3f99b6[0x0]['num']/_0x516ffb)?_0x3f99b6[0x0][_0xcdce('0x18')]%_0x516ffb:0x0;_0x335eb8[_0xcdce('0x1e')](function(_0x157b3f){if(_0x157b3f>0x0){_0x5c5da6+=_0x516ffb;}_0x510ca9[_0xcdce('0x1f')](dbH[_0xcdce('0x14')][_0xcdce('0x15')](util[_0xcdce('0xe')](_0xcdce('0x20'),QUERY,_0x516ffb,_0x5c5da6),{'type':dbH[_0xcdce('0x14')]['QueryTypes'][_0xcdce('0x21')]}));});if(_0x878fd9>0x0){_0x5c5da6+=_0x516ffb;_0x510ca9[_0xcdce('0x1f')](dbH[_0xcdce('0x14')]['query'](util[_0xcdce('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x878fd9,_0x5c5da6),{'type':dbH[_0xcdce('0x14')]['QueryTypes'][_0xcdce('0x21')]}));}}}else{_0x510ca9['push'](dbH['sequelize'][_0xcdce('0x15')](QUERY,{'type':dbH[_0xcdce('0x14')]['QueryTypes'][_0xcdce('0x21')]}));}var _0x93a6f4=path[_0xcdce('0x22')](PATH);var _0x5a312c=path[_0xcdce('0x23')](PATH,_0xcdce('0x24'));var _0x48f3c6=_0x48ee0b[_0xcdce('0x1a')]&&_0x510ca9[_0xcdce('0x1b')]>0x1;var _0x5ed16b=[];if(!fs['existsSync'](path[_0xcdce('0x25')](_0x93a6f4,_0x5a312c))&&_0x48f3c6){fs[_0xcdce('0x26')](path[_0xcdce('0x25')](_0x93a6f4,_0x5a312c));}return BPromise[_0xcdce('0x27')](_0x510ca9,function(_0x26042b){_0x5ed16b[_0xcdce('0x1f')](_0x26042b);})[_0xcdce('0x28')](function(){for(var _0x6d0992=0x0;_0x6d0992<_0x5ed16b[_0xcdce('0x1b')];_0x6d0992+=0x1){var _0x2a5a15;var _0x5e95e4=_0x5ed16b[_0x6d0992];if(_0x48f3c6){_0x2a5a15=path[_0xcdce('0x25')](_0x93a6f4,_0x5a312c,util[_0xcdce('0xe')]('%s%d.%s',_0x5a312c,_0x6d0992,'xlsx'));}else{_0x2a5a15=path['join'](_0x93a6f4,util[_0xcdce('0xe')]('%s.%s',_0x5a312c,_0xcdce('0x29')));}fs[_0xcdce('0x2a')](_0x2a5a15,json2xls(_0x5e95e4),'binary');}})[_0xcdce('0x28')](function(){if(_0x48f3c6){return new Promise(function(_0x39ab5b){zipdir(path['join'](_0x93a6f4,_0x5a312c),{'saveTo':path['join'](_0x93a6f4,util[_0xcdce('0xe')](_0xcdce('0x2b'),_0x5a312c,_0xcdce('0x2c')))},function(_0x350584,_0xed4401){rimraf(path['join'](_0x93a6f4,_0x5a312c),function(){});_0x39ab5b(_0xcdce('0x2d'));});});}})[_0xcdce('0x28')](function(){logger['info'](util[_0xcdce('0xe')](_0xcdce('0x2e'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x48f3c6?util[_0xcdce('0xe')](_0xcdce('0x2b'),_0x5a312c,_0x48f3c6?_0xcdce('0x2c'):_0xcdce('0x29')):null);});})[_0xcdce('0x2f')](function(_0x368e68){logger[_0xcdce('0xd')](util[_0xcdce('0xe')](_0xcdce('0x30'),EXTRACTED_REPORT_ID,_0xcdce('0x10')),util[_0xcdce('0x31')](_0x368e68,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcdce('0x32'));})[_0xcdce('0x33')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e2165cc..b2a443c 100644 --- a/server/components/extensions/rewrite.js +++ b/server/components/extensions/rewrite.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf846=['groupBy','queue','extensions','extension','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','priority','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','updatedAt','interval','*,*,*,*','intervals','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','answer','indexOf','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','then','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter'];(function(_0x53a8d3,_0x1a0799){var _0x15e434=function(_0x21f7ac){while(--_0x21f7ac){_0x53a8d3['push'](_0x53a8d3['shift']());}};_0x15e434(++_0x1a0799);}(_0xf846,0x86));var _0x6f84=function(_0x3a444a,_0x2a6ab5){_0x3a444a=_0x3a444a-0x0;var _0x5bde40=_0xf846[_0x3a444a];return _0x5bde40;};'use strict';var _=require(_0x6f84('0x0'));var util=require('util');function rewrite(_0x45489c,_0x1dd4b5){var _0x451d4a=this;return _0x45489c[_0x6f84('0x1')][_0x6f84('0x2')]['findAll']({'raw':!![]})[_0x6f84('0x3')](function(_0x33fc12){_0x451d4a['intervals']=_0x33fc12;return _0x45489c['models'][_0x6f84('0x4')][_0x6f84('0x5')]({'where':{'IntervalId':_0x1dd4b5[_0x6f84('0x6')]},'raw':!![]});})[_0x6f84('0x3')](function(_0x135d51){return _0x45489c[_0x6f84('0x1')][_0x6f84('0x4')][_0x6f84('0x5')]({'where':{'exten':{'$in':_[_0x6f84('0x7')](_[_0x6f84('0x8')](_0x135d51,_0x6f84('0x9')))}},'order':[{'raw':_0x6f84('0xa')}],'raw':!![]});})[_0x6f84('0x3')](function(_0x5ba965){var _0x297815=_[_0x6f84('0xb')](_0x5ba965,{'priority':'1'});var _0x21d3f0=_[_0x6f84('0xb')](_0x5ba965,{'isApp':0x1});var _0x5a0a3b=_[_0x6f84('0xc')](_0x21d3f0,_0x6f84('0x9'));var _0x36db45=[_0x6f84('0xd'),'playback'];var _0x322c28=[];var _0x1d0eb3=[];for(var _0x53a1ef in _0x5a0a3b){if(_0x5a0a3b['hasOwnProperty'](_0x53a1ef)){_0x451d4a['priority']=0x2;_0x451d4a[_0x6f84('0xe')]=[];_0x451d4a[_0x6f84('0xf')]=_['find'](_0x297815,{'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')]});_0x451d4a['extensions'][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':util[_0x6f84('0x13')]('CDR(type)=%s',_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a['priority']++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]===_0x6f84('0x16')){_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x17')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}else if(_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')]===_0x6f84('0x19')){if(_0x451d4a['extension']){_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x1a')+(_0x451d4a['extension'][_0x6f84('0x1b')]?_0x6f84('0x1c')+_0x451d4a[_0x6f84('0xf')][_0x6f84('0x1b')]+'}':_0x6f84('0x1d')),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x17')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});var _0x23439e=_0x451d4a[_0x6f84('0x18')]++;_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x1e'),'appdata':_0x6f84('0x1f')+(_0x23439e+0x2)+_0x6f84('0x20')+(_0x23439e+0x1)+')','context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x23439e,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x451d4a[_0x6f84('0xf')]){_0x451d4a['extensions'][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':'Set','appdata':_0x451d4a[_0x6f84('0xf')]['cutdigits']?_0x6f84('0x21')+_0x451d4a['extension'][_0x6f84('0x1b')]+'}':_0x6f84('0x22'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x23')+_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')],'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});if(_0x451d4a[_0x6f84('0xf')]&&_0x451d4a[_0x6f84('0xf')][_0x6f84('0x24')](_0x6f84('0x25'))&&_0x451d4a[_0x6f84('0xf')][_0x6f84('0x25')]!==_0x6f84('0x26')){_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x27'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x28')+_0x451d4a[_0x6f84('0xf')][_0x6f84('0x25')]||_0x6f84('0x29'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});}}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x2a'),'context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0]['exten'],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});_0x451d4a[_0x6f84('0xe')]['push']({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':'Set','appdata':_0x6f84('0x2b'),'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x14')],'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'priority':_0x451d4a[_0x6f84('0x18')]++,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]});for(var _0x1cfc08=0x0,_0x5bf0c3=0x0;_0x1cfc08<_0x5a0a3b[_0x53a1ef]['length'];_0x1cfc08+=0x1,_0x5bf0c3=0x0){var _0x2220ed=_0x5a0a3b[_0x53a1ef][_0x1cfc08];if(_0x2220ed[_0x6f84('0x11')]){_0x2220ed[_0x6f84('0x11')]=_0x2220ed['type']['toLowerCase']();}var _0x2569e5=[];var _0x5087e3=[];delete _0x2220ed['id'];delete _0x2220ed['createdAt'];delete _0x2220ed[_0x6f84('0x2c')];var _0x4c5b7e=_0x2220ed[_0x6f84('0x2d')]!==_0x6f84('0x2e')?[_0x2220ed[_0x6f84('0x2d')]]:_0x2220ed[_0x6f84('0x6')]?_[_0x6f84('0x8')](_['filter'](_0x451d4a[_0x6f84('0x2f')],{'IntervalId':_0x2220ed[_0x6f84('0x6')]}),'interval'):[];if(_0x2220ed['hasOwnProperty'](_0x6f84('0x30'))){if(_0x2220ed[_0x6f84('0x30')]&&_0x2220ed['tag']!=='--'){_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':'Set','appdata':_0x6f84('0x31')+_0x2220ed[_0x6f84('0x30')],'context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}if(_0x2220ed[_0x6f84('0x11')]===_0x6f84('0x19')&&_0x2220ed['hasOwnProperty']('callerID')){if(_0x2220ed['callerID']){_0x2569e5['push']({'type':_0x2220ed[_0x6f84('0x11')],'app':'ExecIf','appdata':_0x6f84('0x33')+_0x2220ed[_0x6f84('0x34')]+')','context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}else{_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed['type'],'app':_0x6f84('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}if(_0x2220ed['hasOwnProperty'](_0x6f84('0x35'))){if(_0x36db45[_0x6f84('0x36')](_0x2220ed[_0x6f84('0x37')][_0x6f84('0x38')]())>=0x0&&_0x2220ed['appType']!==_0x6f84('0x39')){if(_0x2220ed[_0x6f84('0x35')]){_0x2569e5['push']({'type':_0x2220ed['type'],'app':_0x6f84('0x1e'),'appdata':_0x6f84('0x3a'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed['type'],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x3b'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed['VoiceExtensionId']});}else{_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':_0x6f84('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x2220ed[_0x6f84('0x14')],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e[_0x6f84('0x32')]+_0x451d4a['priority']+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed['VoiceExtensionId']});_0x2569e5[_0x6f84('0x10')]({'type':_0x2220ed[_0x6f84('0x11')],'app':_0x6f84('0x12'),'appdata':_0x6f84('0x3c'),'context':_0x2220ed['context'],'exten':_0x2220ed[_0x6f84('0x9')],'priority':_0x4c5b7e['length']+_0x451d4a[_0x6f84('0x18')]+_0x5bf0c3++,'VoiceExtensionId':_0x2220ed[_0x6f84('0x15')]});}}}for(var _0x10e197=0x0;_0x10e197<_0x4c5b7e[_0x6f84('0x32')];_0x10e197+=0x1){var _0x5de999=_0x451d4a[_0x6f84('0x18')]+_0x4c5b7e[_0x6f84('0x32')];var _0x5105d8=_0x10e197===_0x4c5b7e[_0x6f84('0x32')]-0x1?_0x451d4a['priority']+_0x2569e5[_0x6f84('0x32')]+_0x5087e3[_0x6f84('0x32')]+0x2:_0x451d4a['priority']+_0x10e197+0x1;_0x2569e5[_0x6f84('0x3d')](_0x10e197,0x0,{'type':_0x2220ed['type'],'app':_0x6f84('0x3e'),'appdata':_0x4c5b7e[_0x10e197]+'?'+_0x2220ed[_0x6f84('0x14')]+_0x6f84('0x3f')+_0x5de999+':'+_0x2220ed[_0x6f84('0x14')]+_0x6f84('0x3f')+_0x5105d8,'exten':_0x2220ed[_0x6f84('0x9')],'context':_0x2220ed[_0x6f84('0x14')],'priority':_0x451d4a['priority']+_0x10e197,'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});}_0x2220ed[_0x6f84('0x18')]=_0x2569e5['length']?_[_0x6f84('0x40')](_0x2569e5)[_0x6f84('0x18')]+0x1:_0x451d4a['priority'];_0x451d4a[_0x6f84('0x18')]=(_0x5087e3[_0x6f84('0x32')]?_['last'](_0x5087e3)['priority']:_0x2220ed[_0x6f84('0x18')])+0x1;_0x451d4a[_0x6f84('0xe')]=_['concat'](_0x451d4a[_0x6f84('0xe')],_0x2569e5,[_0x2220ed],_0x5087e3);}_0x451d4a[_0x6f84('0xe')][_0x6f84('0x10')]({'type':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x11')],'app':_0x6f84('0x41'),'exten':_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x9')],'context':_0x5a0a3b[_0x53a1ef][0x0]['context'],'priority':_0x451d4a[_0x6f84('0x18')],'VoiceExtensionId':_0x5a0a3b[_0x53a1ef][0x0]['VoiceExtensionId']});_0x322c28[_0x6f84('0x10')](_0x5a0a3b[_0x53a1ef][0x0][_0x6f84('0x15')]);_0x1d0eb3=_[_0x6f84('0x42')](_0x1d0eb3,_0x451d4a[_0x6f84('0xe')]);}}return _0x45489c[_0x6f84('0x43')](function(_0xc09179){return _0x45489c[_0x6f84('0x1')][_0x6f84('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x322c28}},'transaction':_0xc09179})[_0x6f84('0x3')](function(_0x462f53){return _0x45489c['models'][_0x6f84('0x4')][_0x6f84('0x44')](_[_0x6f84('0x45')](_0x1d0eb3,_0x6f84('0x18')),{'transaction':_0xc09179});});});})[_0x6f84('0x46')](function(_0x1e6389){console[_0x6f84('0x47')](_0x1e6389);});}exports[_0x6f84('0x48')]=rewrite; \ No newline at end of file +var _0xe323=['util','findAll','then','intervals','models','VoiceExtension','uniq','exten','filter','hasOwnProperty','priority','extensions','find','push','type','Set','format','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','extension','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','XCALLY-MOTION-ANSWER=0','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','map','tag','CDR(tag)=','callerID','ExecIf','indexOf','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','error','rewrite','lodash'];(function(_0x77e199,_0x162f83){var _0xe6db43=function(_0x4d9e83){while(--_0x4d9e83){_0x77e199['push'](_0x77e199['shift']());}};_0xe6db43(++_0x162f83);}(_0xe323,0x135));var _0x3e32=function(_0xc5ed9,_0x435e78){_0xc5ed9=_0xc5ed9-0x0;var _0x4c7db7=_0xe323[_0xc5ed9];return _0x4c7db7;};'use strict';var _=require(_0x3e32('0x0'));var util=require(_0x3e32('0x1'));function rewrite(_0xed0570,_0x78ee87){var _0x46a1c2=this;return _0xed0570['models']['Interval'][_0x3e32('0x2')]({'raw':!![]})[_0x3e32('0x3')](function(_0x1bdc13){_0x46a1c2[_0x3e32('0x4')]=_0x1bdc13;return _0xed0570[_0x3e32('0x5')]['VoiceExtension'][_0x3e32('0x2')]({'where':{'IntervalId':_0x78ee87['IntervalId']},'raw':!![]});})[_0x3e32('0x3')](function(_0x451079){return _0xed0570[_0x3e32('0x5')][_0x3e32('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x3e32('0x7')](_['map'](_0x451079,_0x3e32('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x36c974){var _0xbbaaf2=_[_0x3e32('0x9')](_0x36c974,{'priority':'1'});var _0x107943=_['filter'](_0x36c974,{'isApp':0x1});var _0x1b6090=_['groupBy'](_0x107943,_0x3e32('0x8'));var _0x100503=['queue','playback'];var _0x4e7f22=[];var _0x2f50e5=[];for(var _0x5d6a60 in _0x1b6090){if(_0x1b6090[_0x3e32('0xa')](_0x5d6a60)){_0x46a1c2[_0x3e32('0xb')]=0x2;_0x46a1c2[_0x3e32('0xc')]=[];_0x46a1c2['extension']=_[_0x3e32('0xd')](_0xbbaaf2,{'exten':_0x1b6090[_0x5d6a60][0x0]['exten']});_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':util[_0x3e32('0x11')]('CDR(type)=%s',_0x1b6090[_0x5d6a60][0x0]['type']),'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']});if(_0x1b6090[_0x5d6a60][0x0]['type']===_0x3e32('0x13')){_0x46a1c2[_0x3e32('0xc')]['push']({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x3e32('0x14')+_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')],'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0]['exten'],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});}else if(_0x1b6090[_0x5d6a60][0x0]['type']===_0x3e32('0x16')){if(_0x46a1c2[_0x3e32('0x17')]){_0x46a1c2[_0x3e32('0xc')]['push']({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':'CDR(destination)='+(_0x46a1c2[_0x3e32('0x17')]['cutdigits']?_0x3e32('0x18')+_0x46a1c2[_0x3e32('0x17')]['cutdigits']+'}':_0x3e32('0x19')),'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']});}_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x3e32('0x14')+_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId'],'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2['priority']++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});var _0xfe08bb=_0x46a1c2['priority']++;_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':'ExecIf','appdata':_0x3e32('0x1a')+(_0xfe08bb+0x2)+_0x3e32('0x1b')+(_0xfe08bb+0x1)+')','context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0xfe08bb,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});if(_0x46a1c2[_0x3e32('0x17')]){_0x46a1c2['extensions'][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x46a1c2['extension'][_0x3e32('0x1c')]?_0x3e32('0x1d')+_0x46a1c2[_0x3e32('0x17')]['cutdigits']+'}':_0x3e32('0x1e'),'context':_0x1b6090[_0x5d6a60][0x0]['context'],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']});}_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0]['type'],'app':_0x3e32('0x10'),'appdata':'outboundrouteid='+_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')],'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0]['exten'],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});if(_0x46a1c2[_0x3e32('0x17')]&&_0x46a1c2['extension'][_0x3e32('0xa')](_0x3e32('0x1f'))&&_0x46a1c2[_0x3e32('0x17')][_0x3e32('0x1f')]!=='none'){_0x46a1c2['extensions']['push']({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0]['type'],'app':_0x3e32('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x46a1c2[_0x3e32('0x17')][_0x3e32('0x1f')]||'wav','context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});}}_0x46a1c2[_0x3e32('0xc')][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x3e32('0x20'),'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0]['exten'],'priority':_0x46a1c2['priority']++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']});_0x46a1c2['extensions'][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1b6090[_0x5d6a60][0x0]['context'],'exten':_0x1b6090[_0x5d6a60][0x0]['exten'],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});_0x46a1c2[_0x3e32('0xc')]['push']({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'exten':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x8')],'priority':_0x46a1c2[_0x3e32('0xb')]++,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});for(var _0x1c1806=0x0,_0x236b14=0x0;_0x1c1806<_0x1b6090[_0x5d6a60][_0x3e32('0x21')];_0x1c1806+=0x1,_0x236b14=0x0){var _0x7f323c=_0x1b6090[_0x5d6a60][_0x1c1806];if(_0x7f323c[_0x3e32('0xf')]){_0x7f323c[_0x3e32('0xf')]=_0x7f323c[_0x3e32('0xf')][_0x3e32('0x22')]();}var _0x116557=[];var _0x66c111=[];delete _0x7f323c['id'];delete _0x7f323c[_0x3e32('0x23')];delete _0x7f323c[_0x3e32('0x24')];var _0x531fb7=_0x7f323c['interval']!==_0x3e32('0x25')?[_0x7f323c[_0x3e32('0x26')]]:_0x7f323c[_0x3e32('0x27')]?_[_0x3e32('0x28')](_['filter'](_0x46a1c2[_0x3e32('0x4')],{'IntervalId':_0x7f323c['IntervalId']}),_0x3e32('0x26')):[];if(_0x7f323c[_0x3e32('0xa')]('tag')){if(_0x7f323c[_0x3e32('0x29')]&&_0x7f323c[_0x3e32('0x29')]!=='--'){_0x116557[_0x3e32('0xe')]({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x3e32('0x2a')+_0x7f323c['tag'],'context':_0x7f323c[_0x3e32('0x12')],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7['length']+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});}}if(_0x7f323c[_0x3e32('0xf')]===_0x3e32('0x16')&&_0x7f323c[_0x3e32('0xa')](_0x3e32('0x2b'))){if(_0x7f323c[_0x3e32('0x2b')]){_0x116557[_0x3e32('0xe')]({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x2c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x7f323c[_0x3e32('0x2b')]+')','context':_0x7f323c['context'],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7[_0x3e32('0x21')]+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});}else{_0x116557[_0x3e32('0xe')]({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x2c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x7f323c[_0x3e32('0x12')],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7[_0x3e32('0x21')]+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});}}if(_0x7f323c[_0x3e32('0xa')]('answer')){if(_0x100503[_0x3e32('0x2d')](_0x7f323c['app']['toLowerCase']())>=0x0&&_0x7f323c[_0x3e32('0x2e')]!=='custom'){if(_0x7f323c[_0x3e32('0x2f')]){_0x116557['push']({'type':_0x7f323c[_0x3e32('0xf')],'app':'ExecIf','appdata':_0x3e32('0x30'),'context':_0x7f323c[_0x3e32('0x12')],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7[_0x3e32('0x21')]+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});_0x116557[_0x3e32('0xe')]({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x7f323c['context'],'exten':_0x7f323c['exten'],'priority':_0x531fb7['length']+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});}else{_0x116557['push']({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x2c'),'appdata':_0x3e32('0x31'),'context':_0x7f323c['context'],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7['length']+_0x46a1c2['priority']+_0x236b14++,'VoiceExtensionId':_0x7f323c[_0x3e32('0x15')]});_0x116557[_0x3e32('0xe')]({'type':_0x7f323c[_0x3e32('0xf')],'app':_0x3e32('0x10'),'appdata':_0x3e32('0x32'),'context':_0x7f323c[_0x3e32('0x12')],'exten':_0x7f323c[_0x3e32('0x8')],'priority':_0x531fb7[_0x3e32('0x21')]+_0x46a1c2[_0x3e32('0xb')]+_0x236b14++,'VoiceExtensionId':_0x7f323c['VoiceExtensionId']});}}}for(var _0xbd3597=0x0;_0xbd3597<_0x531fb7['length'];_0xbd3597+=0x1){var _0x564557=_0x46a1c2['priority']+_0x531fb7[_0x3e32('0x21')];var _0x40525a=_0xbd3597===_0x531fb7[_0x3e32('0x21')]-0x1?_0x46a1c2[_0x3e32('0xb')]+_0x116557['length']+_0x66c111[_0x3e32('0x21')]+0x2:_0x46a1c2['priority']+_0xbd3597+0x1;_0x116557[_0x3e32('0x33')](_0xbd3597,0x0,{'type':_0x7f323c['type'],'app':_0x3e32('0x34'),'appdata':_0x531fb7[_0xbd3597]+'?'+_0x7f323c[_0x3e32('0x12')]+_0x3e32('0x35')+_0x564557+':'+_0x7f323c[_0x3e32('0x12')]+',${EXTEN},'+_0x40525a,'exten':_0x7f323c[_0x3e32('0x8')],'context':_0x7f323c['context'],'priority':_0x46a1c2[_0x3e32('0xb')]+_0xbd3597,'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']});}_0x7f323c['priority']=_0x116557[_0x3e32('0x21')]?_[_0x3e32('0x36')](_0x116557)['priority']+0x1:_0x46a1c2[_0x3e32('0xb')];_0x46a1c2[_0x3e32('0xb')]=(_0x66c111[_0x3e32('0x21')]?_['last'](_0x66c111)[_0x3e32('0xb')]:_0x7f323c[_0x3e32('0xb')])+0x1;_0x46a1c2[_0x3e32('0xc')]=_[_0x3e32('0x37')](_0x46a1c2['extensions'],_0x116557,[_0x7f323c],_0x66c111);}_0x46a1c2['extensions'][_0x3e32('0xe')]({'type':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0xf')],'app':_0x3e32('0x38'),'exten':_0x1b6090[_0x5d6a60][0x0]['exten'],'context':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x12')],'priority':_0x46a1c2['priority'],'VoiceExtensionId':_0x1b6090[_0x5d6a60][0x0][_0x3e32('0x15')]});_0x4e7f22[_0x3e32('0xe')](_0x1b6090[_0x5d6a60][0x0]['VoiceExtensionId']);_0x2f50e5=_['concat'](_0x2f50e5,_0x46a1c2[_0x3e32('0xc')]);}}return _0xed0570['transaction'](function(_0x46bb0e){return _0xed0570['models'][_0x3e32('0x6')][_0x3e32('0x39')]({'where':{'VoiceExtensionId':{'$in':_0x4e7f22}},'transaction':_0x46bb0e})['then'](function(_0x4c0c56){return _0xed0570[_0x3e32('0x5')][_0x3e32('0x6')][_0x3e32('0x3a')](_[_0x3e32('0x3b')](_0x2f50e5,_0x3e32('0xb')),{'transaction':_0x46bb0e});});});})['catch'](function(_0x572506){console[_0x3e32('0x3c')](_0x572506);});}exports[_0x3e32('0x3d')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6cc5d4d..e8e1593 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb70=['Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','select','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','findAll','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','all','VoiceQueue','outbound','BlackLists','get','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20filepath\x20parameter!'];(function(_0x3a7368,_0x185789){var _0x1aa883=function(_0x41b7b6){while(--_0x41b7b6){_0x3a7368['push'](_0x3a7368['shift']());}};_0x1aa883(++_0x185789);}(_0xdb70,0x13b));var _0x0db7=function(_0xf80f15,_0x190209){_0xf80f15=_0xf80f15-0x0;var _0x41c5be=_0xdb70[_0xf80f15];return _0x41c5be;};'use strict';var BPromise=require(_0x0db7('0x0'));var util=require('util');var _=require(_0x0db7('0x1'));var fs=require('fs');var squel=require(_0x0db7('0x2'));var Papa=require(_0x0db7('0x3'));var Redis=require(_0x0db7('0x4'));var db=require(_0x0db7('0x5'))['db'];var config=require(_0x0db7('0x6'));var logger=require(_0x0db7('0x7'))(_0x0db7('0x8'));config[_0x0db7('0x9')]=_[_0x0db7('0xa')](config['redis'],{'host':_0x0db7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0db7('0x9')]));require(_0x0db7('0xc'))[_0x0db7('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x2]===_0x0db7('0x10')){throw new Error(_0x0db7('0x11'));}var FILEPATH=process['argv'][0x2];if(!process[_0x0db7('0xf')][0x3]||process['argv'][0x3]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x3]===_0x0db7('0x10')||!process[_0x0db7('0xf')][0x4]||process[_0x0db7('0xf')][0x4]===_0x0db7('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x0db7('0x12'));}var FIELDS=_[_0x0db7('0x13')](process[_0x0db7('0xf')][0x3]['split'](','),process[_0x0db7('0xf')][0x4][_0x0db7('0x14')](','));if(!process[_0x0db7('0xf')][0x5]||process[_0x0db7('0xf')][0x5]===_0x0db7('0xe')||process[_0x0db7('0xf')][0x5]==='null'){throw new Error(_0x0db7('0x15'));}var LISTID=process[_0x0db7('0xf')][0x5];var COMPANYID=process[_0x0db7('0xf')][0x6]&&process[_0x0db7('0xf')][0x6]!==_0x0db7('0xe')&&process['argv'][0x6]!==_0x0db7('0x10')?process[_0x0db7('0xf')][0x6]:null;var DUPLICATES=process[_0x0db7('0xf')][0x7]&&process[_0x0db7('0xf')][0x7]!==_0x0db7('0xe')&&process[_0x0db7('0xf')][0x7]!==_0x0db7('0x10')?process['argv'][0x7]:null;if(!process[_0x0db7('0xf')][0x8]||process[_0x0db7('0xf')][0x8]===_0x0db7('0xe')||process['argv'][0x8]===_0x0db7('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x0db7('0xf')][0x8];}catch(_0x19e021){logger[_0x0db7('0x16')](_0x19e021);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(_0x364e38,_0xb9f89f,_0x330f71,_0x481b76){var _0x31f03d={'message':_0xb9f89f};_0x31f03d[_0x364e38]=!![];if(_0x330f71){_0x31f03d[_0x0db7('0x17')]=_0x330f71;}if(_0x481b76){_0x31f03d[_0x0db7('0x18')]=_0x481b76;}return _0x31f03d;}function isEmail(_0x1ed496){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))*$/[_0x0db7('0x19')](_0x1ed496);}function checkRow(_0x534820,_0xec3bad,_0x3cc966){return new BPromise(function(_0x3d4552,_0x206b29){if(_['isNil'](_0x534820)){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3cc966));}if(_0x534820['errors']&&_0x534820[_0x0db7('0x1a')][_0x0db7('0x1b')]){var _0x4fe140=_['map'](_0x534820[_0x0db7('0x1a')],_0x0db7('0x1c'))[_0x0db7('0x1d')](';');return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x4fe140,null,_0x3cc966));}var _0x310b3c={};for(var _0x5012a4 in FIELDS){if(FIELDS[_0x0db7('0x1e')](_0x5012a4)&&FIELDS[_0x5012a4]){_0x310b3c[_0x5012a4]=_0x534820[_0x0db7('0x1f')][0x0][FIELDS[_0x5012a4]]||_0x534820[_0x0db7('0x1f')][0x0]['\ufeff'+FIELDS[_0x5012a4]];}}if(!_0x310b3c[_0x0db7('0x20')]){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x0db7('0x21'),null,_0x3cc966));}if(!_0x310b3c[_0x0db7('0x22')]){return _0x206b29(handleCheckRowError(_0x0db7('0x16'),_0x0db7('0x23'),null,_0x3cc966));}if(_0x310b3c[_0x0db7('0x24')]){var _0x527985=moment(_0x310b3c[_0x0db7('0x24')],_0x0db7('0x25'));if(!_0x527985[_0x0db7('0x26')]()){return _0x206b29(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x3cc966));}}if(_0x310b3c[_0x0db7('0x27')]){if(!isEmail(_0x310b3c[_0x0db7('0x27')])){return _0x206b29(handleCheckRowError('error',_0x0db7('0x28'),null,_0x3cc966));}}_0x310b3c[_0x0db7('0x29')]=LISTID;_0x310b3c[_0x0db7('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0db7('0x1b')]&&_0xec3bad){var _0x2608c9={};for(var _0x72c33f=0x0,_0x3dfa04=DUPLICATES[_0x0db7('0x1b')];_0x72c33f<_0x3dfa04;_0x72c33f+=0x1){_0x2608c9[DUPLICATES[_0x72c33f]]=_0x310b3c[DUPLICATES[_0x72c33f]];}var _0xdab8a1=_[_0x0db7('0x2b')](_0xec3bad,_0x2608c9);if(_0xdab8a1){return _0x206b29(handleCheckRowError(_0x0db7('0x2c'),_0x0db7('0x2d'),_0xdab8a1,_0x3cc966));}}return db[_0x0db7('0x2e')][_0x0db7('0x2f')](_0x310b3c,{'raw':!![],'hooks':![],'fields':_[_0x0db7('0x30')](_0x310b3c)})[_0x0db7('0x31')](function(_0x4cede5){if(DUPLICATES&&DUPLICATES[_0x0db7('0x1b')]&&_0xec3bad){_0xec3bad[_0x0db7('0x32')](_[_0x0db7('0x33')](_0x310b3c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x4cede5['id'];return _0x3d4552();})[_0x0db7('0x34')](function(_0x1ee62c){return _0x206b29(handleCheckRowError('error',_0x0db7('0x35')+(_0x1ee62c[_0x0db7('0x1c')]||JSON['stringify'](_0x1ee62c)),null,_0x3cc966));});});}function checkHopper(){function _0x4decd8(){return function(_0x2b9c61){logger[_0x0db7('0x16')](_0x0db7('0x36'),_0x0db7('0x37'),util[_0x0db7('0x38')](_0x2b9c61,{'showHidden':![],'depth':null}));};}var _0x2c32c9=function(_0x13028b,_0x27c2a6){var _0x588928=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')](_0x0db7('0x3b'))[_0x0db7('0x3c')](['phone',_0x0db7('0x3d'),_0x0db7('0x3e'),'ListId',_0x27c2a6,_0x0db7('0x3f'),_0x0db7('0x40')],squel['select']()[_0x0db7('0x41')](_0x0db7('0x22'),_0x0db7('0x22'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3d'))[_0x0db7('0x41')]('id',_0x0db7('0x3e'))[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))['field'](_0x13028b['id'][_0x0db7('0x43')](),_0x27c2a6)[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3f'))[_0x0db7('0x41')]('NOW()','updatedAt')[_0x0db7('0x44')](_0x0db7('0x45'))[_0x0db7('0x46')](_0x0db7('0x47'))[_0x0db7('0x46')](_0x0db7('0x48'),LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'))[_0x0db7('0x44')](_0x0db7('0x3b'))[_0x0db7('0x46')](_0x27c2a6+'\x20=\x20?',_0x13028b['id'][_0x0db7('0x43')]())))[_0x0db7('0x43')]();return _0x588928;};var _0x2b8dde=function(_0x38bba1,_0x3c26e5){var _0x28fdec=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')]('cm_hopper')[_0x0db7('0x3c')]([_0x0db7('0x22'),_0x0db7('0x3d'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x3c26e5,_0x0db7('0x3f'),_0x0db7('0x40')],squel['select']()[_0x0db7('0x41')]('phone','phone')[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x3d'))[_0x0db7('0x41')]('id','ContactId')[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))['field'](_0x38bba1['id']['toString'](),_0x3c26e5)['field'](_0x0db7('0x42'),_0x0db7('0x3f'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x40'))['from'](_0x0db7('0x45'))[_0x0db7('0x46')](_0x0db7('0x47'))[_0x0db7('0x46')]('ListId\x20=\x20?',LISTID['toString']())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))[_0x0db7('0x46')](_0x0db7('0x4c'))['where'](_0x0db7('0x4d'),squel[_0x0db7('0x49')]()[_0x0db7('0x41')]('calleridnum')[_0x0db7('0x44')]('cm_hopper_final')['where'](_0x3c26e5+_0x0db7('0x4e'),_0x38bba1['id'][_0x0db7('0x43')]()))['where'](_0x0db7('0x4d'),squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'))[_0x0db7('0x44')]('cm_hopper')['where'](_0x3c26e5+_0x0db7('0x4e'),_0x38bba1['id']['toString']())))[_0x0db7('0x43')]();return _0x28fdec;};function _0x79f5a3(_0x9b5dcf,_0x4063a2){var _0x32d2bc=squel[_0x0db7('0x39')]()[_0x0db7('0x3a')](_0x0db7('0x3b'))['fromQuery']([_0x0db7('0x22'),_0x0db7('0x3d'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x4063a2,_0x0db7('0x3f'),'updatedAt'],squel[_0x0db7('0x49')]()[_0x0db7('0x41')](_0x0db7('0x22'),_0x0db7('0x22'))[_0x0db7('0x41')](_0x0db7('0x42'),'scheduledAt')[_0x0db7('0x41')]('id',_0x0db7('0x3e'))[_0x0db7('0x41')](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))[_0x0db7('0x41')](_0x9b5dcf['id']['toString'](),_0x4063a2)[_0x0db7('0x41')]('NOW()',_0x0db7('0x3f'))[_0x0db7('0x41')](_0x0db7('0x42'),_0x0db7('0x40'))[_0x0db7('0x44')](_0x0db7('0x45'))['where'](_0x0db7('0x47'))[_0x0db7('0x46')]('ListId\x20=\x20?',LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))[_0x0db7('0x46')](_0x0db7('0x4c')))['toString']();return _0x32d2bc;}function _0x29d8d5(_0x3d1983,_0x2982f8){var _0x414a52=squel['insert']()[_0x0db7('0x3a')]('cm_hopper_black')[_0x0db7('0x3c')]([_0x0db7('0x22'),_0x0db7('0x3e'),_0x0db7('0x29'),_0x2982f8,_0x0db7('0x3f'),_0x0db7('0x40')],squel[_0x0db7('0x49')]()['field'](_0x0db7('0x22'),'phone')[_0x0db7('0x41')]('id',_0x0db7('0x3e'))['field'](LISTID[_0x0db7('0x43')](),_0x0db7('0x29'))[_0x0db7('0x41')](_0x3d1983['id'][_0x0db7('0x43')](),_0x2982f8)[_0x0db7('0x41')]('NOW()',_0x0db7('0x3f'))[_0x0db7('0x41')]('NOW()',_0x0db7('0x40'))[_0x0db7('0x44')](_0x0db7('0x45'))['where'](_0x0db7('0x47'))[_0x0db7('0x46')](_0x0db7('0x48'),LISTID[_0x0db7('0x43')]())[_0x0db7('0x46')](_0x0db7('0x4a'),squel[_0x0db7('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x414a52;}return db['VoiceQueue'][_0x0db7('0x4f')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x5cfee8){var _0x200655=[];if(_0x5cfee8){var _0x7b21f4;for(var _0x2665a5=0x0,_0x1544b1;_0x2665a5<_0x5cfee8[_0x0db7('0x1b')];_0x2665a5+=0x1){_0x1544b1=_0x5cfee8[_0x2665a5]['get']({'plain':!![]});switch(_0x1544b1[_0x0db7('0x52')]){case _0x0db7('0x53'):_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2b8dde(_0x1544b1,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;case'onlyIfOpen':_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2c32c9(_0x1544b1,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;default:_0x200655[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x79f5a3(_0x1544b1,_0x0db7('0x56')))['then'](function(){})[_0x0db7('0x34')](_0x4decd8()));}}}return _0x200655;})[_0x0db7('0x57')]()[_0x0db7('0x31')](function(){return db[_0x0db7('0x58')][_0x0db7('0x4f')]({'where':{'type':_0x0db7('0x59')},'attributes':['id'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x5a'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x4e0c39){var _0x36abac=[];if(_0x4e0c39){var _0x37cea7;for(var _0x1b3440=0x0,_0x3a8ed3;_0x1b3440<_0x4e0c39[_0x0db7('0x1b')];_0x1b3440+=0x1){_0x3a8ed3=_0x4e0c39[_0x1b3440][_0x0db7('0x5b')]({'plain':!![]});_0x36abac[_0x0db7('0x32')](db['sequelize'][_0x0db7('0x55')](_0x29d8d5(_0x3a8ed3,_0x0db7('0x56')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}return _0x36abac;})[_0x0db7('0x57')]();})[_0x0db7('0x31')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x0db7('0x52')],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x51'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x410c4d){var _0x1eb71c=[];if(_0x410c4d){for(var _0x4776a7=0x0,_0x3a7397;_0x4776a7<_0x410c4d['length'];_0x4776a7+=0x1){_0x3a7397=_0x410c4d[_0x4776a7][_0x0db7('0x5b')]({'plain':!![]});switch(_0x3a7397[_0x0db7('0x52')]){case _0x0db7('0x53'):_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2b8dde(_0x3a7397,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})['catch'](_0x4decd8()));break;case'onlyIfOpen':_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x2c32c9(_0x3a7397,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));break;default:_0x1eb71c[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x79f5a3(_0x3a7397,'CampaignId'))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}}return _0x1eb71c;})[_0x0db7('0x57')]();})[_0x0db7('0x31')](function(){return db[_0x0db7('0x5d')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x0db7('0x50')],'as':_0x0db7('0x5a'),'where':{'id':LISTID}}]})[_0x0db7('0x31')](function(_0x22a97b){var _0x1d57a9=[];if(_0x22a97b){for(var _0x58974c=0x0,_0x25a6db;_0x58974c<_0x22a97b['length'];_0x58974c+=0x1){_0x25a6db=_0x22a97b[_0x58974c]['get']({'plain':!![]});_0x1d57a9[_0x0db7('0x32')](db[_0x0db7('0x54')][_0x0db7('0x55')](_0x29d8d5(_0x25a6db,_0x0db7('0x5c')))[_0x0db7('0x31')](function(){})[_0x0db7('0x34')](_0x4decd8()));}}return _0x1d57a9;})[_0x0db7('0x57')]();})[_0x0db7('0x34')](function(_0xc0e6bd){logger[_0x0db7('0x16')](_0x0db7('0x5e'),'generalCheckHopper',_0xc0e6bd['message']);});}var processPromises=function(_0x4f9778){return BPromise[_0x0db7('0x57')](promises)[_0x0db7('0x31')](function(_0x571092){})['catch'](function(_0x58c629){logger[_0x0db7('0x16')](_0x0db7('0x5f'),JSON[_0x0db7('0x60')](_0x58c629));})[_0x0db7('0x61')](function(){socket['emit'](_0x0db7('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f9778){return _0x4f9778['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x0db7('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x0db7('0x63')](_0x0db7('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0db7('0x64')](FILEPATH);}catch(_0x32ff8d){logger[_0x0db7('0x16')](_0x0db7('0x65'),JSON['stringify'](_0x32ff8d));}finally{process[_0x0db7('0x66')](0x0);}});};process['on'](_0x0db7('0x67'),function(){logger[_0x0db7('0x68')](_0x0db7('0x69'));endCsv();});function main(){return BPromise[_0x0db7('0x6a')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0db7('0x14')](',');return db[_0x0db7('0x2e')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0db7('0x31')](function(_0x95703e){var _0x2623b7=fs[_0x0db7('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2623b7,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4338f4,_0x1b694e){total+=0x1;var _0x5a8731=total;promises['push'](checkRow(_0x4338f4,_0x95703e,_0x5a8731)[_0x0db7('0x31')](function(){success+=0x1;})['catch'](function(_0xc8d039){if(_0xc8d039[_0x0db7('0x16')]){errors+=0x1;delete _0xc8d039[_0x0db7('0x16')];}else if(_0xc8d039[_0x0db7('0x2c')]){duplicates+=0x1;delete _0xc8d039[_0x0db7('0x2c')];}rows[_0x0db7('0x32')](_0xc8d039);}));if(total%0xc8===0x0){_0x1b694e[_0x0db7('0x6c')]();return processPromises(_0x1b694e);}},'complete':function(){return processPromises()[_0x0db7('0x31')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x46bc31,_0x4bb4f4){logger[_0x0db7('0x68')](_0x0db7('0x6d'),JSON[_0x0db7('0x60')](_0x46bc31));endCsv();}});})[_0x0db7('0x34')](function(_0x50f28e){logger[_0x0db7('0x16')](_0x0db7('0x6e'),JSON[_0x0db7('0x60')](_0x50f28e));});}main(); \ No newline at end of file +var _0x9116=['stringify','cmContact','into','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','insert','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','str','\x20=\x20?','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','query','VoiceQueueId','sequelize','all','Campaign','get','CampaignId','onlyIfOpen','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../config/logger','api','redis','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','test','isNil','errors','length','map','message','join','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','CmContact','create','keys','then','push','pick','catch'];(function(_0x352594,_0x2fed28){var _0x2a0bc3=function(_0x359c38){while(--_0x359c38){_0x352594['push'](_0x352594['shift']());}};_0x2a0bc3(++_0x2fed28);}(_0x9116,0x1d1));var _0x6911=function(_0x5b95ec,_0x16e0d0){_0x5b95ec=_0x5b95ec-0x0;var _0x2af647=_0x9116[_0x5b95ec];return _0x2af647;};'use strict';var BPromise=require(_0x6911('0x0'));var util=require(_0x6911('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x6911('0x2'));var Papa=require(_0x6911('0x3'));var Redis=require(_0x6911('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x6911('0x5'))(_0x6911('0x6'));config['redis']=_['defaults'](config[_0x6911('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x6911('0x8'))(new Redis(config[_0x6911('0x7')]));require('../../../api/cmContact/cmContact.socket')[_0x6911('0x9')](socket);try{if(!process['argv'][0x2]||process[_0x6911('0xa')][0x2]===_0x6911('0xb')||process[_0x6911('0xa')][0x2]===_0x6911('0xc')){throw new Error(_0x6911('0xd'));}var FILEPATH=process[_0x6911('0xa')][0x2];if(!process[_0x6911('0xa')][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0x6911('0xc')||!process['argv'][0x4]||process[_0x6911('0xa')][0x4]==='undefined'||process[_0x6911('0xa')][0x4]===_0x6911('0xc')){throw new Error(_0x6911('0xe'));}var FIELDS=_['zipObject'](process[_0x6911('0xa')][0x3][_0x6911('0xf')](','),process[_0x6911('0xa')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x6911('0xa')][0x5]===_0x6911('0xb')||process['argv'][0x5]==='null'){throw new Error(_0x6911('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x6911('0xa')][0x6]!=='undefined'&&process[_0x6911('0xa')][0x6]!=='null'?process[_0x6911('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x6911('0xb')&&process['argv'][0x7]!==_0x6911('0xc')?process[_0x6911('0xa')][0x7]:null;if(!process['argv'][0x8]||process[_0x6911('0xa')][0x8]===_0x6911('0xb')||process['argv'][0x8]==='null'){throw new Error(_0x6911('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xaf689e){logger['error'](_0xaf689e);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(_0x3e922e,_0x4ba47a,_0x24c1a9,_0x452da6){var _0x211897={'message':_0x4ba47a};_0x211897[_0x3e922e]=!![];if(_0x24c1a9){_0x211897[_0x6911('0x12')]=_0x24c1a9;}if(_0x452da6){_0x211897['index']=_0x452da6;}return _0x211897;}function isEmail(_0x1e8a5c){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))*$/[_0x6911('0x13')](_0x1e8a5c);}function checkRow(_0x14ca1c,_0x21ec58,_0x580564){return new BPromise(function(_0x19b180,_0x565cfd){if(_[_0x6911('0x14')](_0x14ca1c)){return _0x565cfd(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x580564));}if(_0x14ca1c[_0x6911('0x15')]&&_0x14ca1c['errors'][_0x6911('0x16')]){var _0xa16b86=_[_0x6911('0x17')](_0x14ca1c[_0x6911('0x15')],_0x6911('0x18'))[_0x6911('0x19')](';');return _0x565cfd(handleCheckRowError('error',_0xa16b86,null,_0x580564));}var _0x40a2cc={};for(var _0x894266 in FIELDS){if(FIELDS[_0x6911('0x1a')](_0x894266)&&FIELDS[_0x894266]){_0x40a2cc[_0x894266]=_0x14ca1c['data'][0x0][FIELDS[_0x894266]]||_0x14ca1c[_0x6911('0x1b')][0x0]['\ufeff'+FIELDS[_0x894266]];}}if(!_0x40a2cc[_0x6911('0x1c')]){return _0x565cfd(handleCheckRowError(_0x6911('0x1d'),_0x6911('0x1e'),null,_0x580564));}if(!_0x40a2cc[_0x6911('0x1f')]){return _0x565cfd(handleCheckRowError(_0x6911('0x1d'),'phone\x20not\x20specified!',null,_0x580564));}if(_0x40a2cc['birthDate']){var _0x4542d7=moment(_0x40a2cc[_0x6911('0x20')],_0x6911('0x21'));if(!_0x4542d7['isValid']()){return _0x565cfd(handleCheckRowError(_0x6911('0x1d'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x580564));}}if(_0x40a2cc['email']){if(!isEmail(_0x40a2cc['email'])){return _0x565cfd(handleCheckRowError('error',_0x6911('0x22'),null,_0x580564));}}_0x40a2cc[_0x6911('0x23')]=LISTID;_0x40a2cc[_0x6911('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x6911('0x16')]&&_0x21ec58){var _0x2d1169={};for(var _0x56724c=0x0,_0x4d1976=DUPLICATES[_0x6911('0x16')];_0x56724c<_0x4d1976;_0x56724c+=0x1){_0x2d1169[DUPLICATES[_0x56724c]]=_0x40a2cc[DUPLICATES[_0x56724c]];}var _0x46474a=_[_0x6911('0x25')](_0x21ec58,_0x2d1169);if(_0x46474a){return _0x565cfd(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x46474a,_0x580564));}}return db[_0x6911('0x26')][_0x6911('0x27')](_0x40a2cc,{'raw':!![],'hooks':![],'fields':_[_0x6911('0x28')](_0x40a2cc)})[_0x6911('0x29')](function(_0x2b2ad6){if(DUPLICATES&&DUPLICATES[_0x6911('0x16')]&&_0x21ec58){_0x21ec58[_0x6911('0x2a')](_[_0x6911('0x2b')](_0x40a2cc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b2ad6['id'];return _0x19b180();})[_0x6911('0x2c')](function(_0x57dbc8){return _0x565cfd(handleCheckRowError(_0x6911('0x1d'),'Error\x20while\x20creating\x20contact:\x20'+(_0x57dbc8[_0x6911('0x18')]||JSON[_0x6911('0x2d')](_0x57dbc8)),null,_0x580564));});});}function checkHopper(){function _0x1cfd83(){return function(_0x27cafb){logger[_0x6911('0x1d')](_0x6911('0x2e'),'checkHopper',util['inspect'](_0x27cafb,{'showHidden':![],'depth':null}));};}var _0x51ae10=function(_0x43a421,_0x5c0d8a){var _0x1399b4=squel['insert']()[_0x6911('0x2f')](_0x6911('0x30'))[_0x6911('0x31')]([_0x6911('0x1f'),'scheduledAt',_0x6911('0x32'),'ListId',_0x5c0d8a,_0x6911('0x33'),_0x6911('0x34')],squel[_0x6911('0x35')]()[_0x6911('0x36')](_0x6911('0x1f'),'phone')[_0x6911('0x36')](_0x6911('0x37'),_0x6911('0x38'))[_0x6911('0x36')]('id',_0x6911('0x32'))[_0x6911('0x36')](LISTID[_0x6911('0x39')](),_0x6911('0x23'))[_0x6911('0x36')](_0x43a421['id'][_0x6911('0x39')](),_0x5c0d8a)[_0x6911('0x36')]('NOW()',_0x6911('0x33'))['field'](_0x6911('0x37'),'updatedAt')[_0x6911('0x3a')](_0x6911('0x3b'))['where']('deletedAt\x20IS\x20NULL')[_0x6911('0x3c')]('ListId\x20=\x20?',LISTID[_0x6911('0x39')]())[_0x6911('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x6911('0x3c')](_0x6911('0x3d'),squel[_0x6911('0x35')]()[_0x6911('0x36')](_0x6911('0x1f'))[_0x6911('0x3a')](_0x6911('0x30'))[_0x6911('0x3c')](_0x5c0d8a+'\x20=\x20?',_0x43a421['id'][_0x6911('0x39')]())))[_0x6911('0x39')]();return _0x1399b4;};var _0x17e8bc=function(_0x150f7f,_0x32b279){var _0x30745d=squel[_0x6911('0x3e')]()[_0x6911('0x2f')](_0x6911('0x30'))[_0x6911('0x31')]([_0x6911('0x1f'),'scheduledAt',_0x6911('0x32'),'ListId',_0x32b279,_0x6911('0x33'),_0x6911('0x34')],squel['select']()['field']('phone','phone')[_0x6911('0x36')](_0x6911('0x37'),_0x6911('0x38'))[_0x6911('0x36')]('id','ContactId')[_0x6911('0x36')](LISTID['toString'](),_0x6911('0x23'))[_0x6911('0x36')](_0x150f7f['id'][_0x6911('0x39')](),_0x32b279)[_0x6911('0x36')]('NOW()',_0x6911('0x33'))[_0x6911('0x36')](_0x6911('0x37'),_0x6911('0x34'))[_0x6911('0x3a')](_0x6911('0x3b'))[_0x6911('0x3c')](_0x6911('0x3f'))[_0x6911('0x3c')](_0x6911('0x40'),LISTID['toString']())[_0x6911('0x3c')]('id\x20IN\x20?',squel[_0x6911('0x41')](hopperContacts))[_0x6911('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x6911('0x3c')](_0x6911('0x3d'),squel[_0x6911('0x35')]()[_0x6911('0x36')]('calleridnum')[_0x6911('0x3a')]('cm_hopper_final')[_0x6911('0x3c')](_0x32b279+_0x6911('0x42'),_0x150f7f['id'][_0x6911('0x39')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6911('0x35')]()[_0x6911('0x36')](_0x6911('0x1f'))[_0x6911('0x3a')](_0x6911('0x30'))['where'](_0x32b279+_0x6911('0x42'),_0x150f7f['id']['toString']())))['toString']();return _0x30745d;};function _0x3eb120(_0x2e1b64,_0x3a3135){var _0xab6e57=squel[_0x6911('0x3e')]()[_0x6911('0x2f')](_0x6911('0x30'))[_0x6911('0x31')]([_0x6911('0x1f'),_0x6911('0x38'),_0x6911('0x32'),_0x6911('0x23'),_0x3a3135,_0x6911('0x33'),_0x6911('0x34')],squel[_0x6911('0x35')]()['field'](_0x6911('0x1f'),_0x6911('0x1f'))[_0x6911('0x36')](_0x6911('0x37'),_0x6911('0x38'))['field']('id',_0x6911('0x32'))[_0x6911('0x36')](LISTID['toString'](),_0x6911('0x23'))[_0x6911('0x36')](_0x2e1b64['id']['toString'](),_0x3a3135)[_0x6911('0x36')](_0x6911('0x37'),'createdAt')['field']('NOW()',_0x6911('0x34'))[_0x6911('0x3a')](_0x6911('0x3b'))[_0x6911('0x3c')](_0x6911('0x3f'))['where'](_0x6911('0x40'),LISTID[_0x6911('0x39')]())[_0x6911('0x3c')](_0x6911('0x43'),squel[_0x6911('0x41')](hopperContacts))['where'](_0x6911('0x44')))[_0x6911('0x39')]();return _0xab6e57;}function _0x5b4195(_0x4dff26,_0xd7148f){var _0x50f125=squel[_0x6911('0x3e')]()[_0x6911('0x2f')]('cm_hopper_black')['fromQuery'](['phone',_0x6911('0x32'),_0x6911('0x23'),_0xd7148f,'createdAt','updatedAt'],squel[_0x6911('0x35')]()[_0x6911('0x36')](_0x6911('0x1f'),'phone')[_0x6911('0x36')]('id','ContactId')['field'](LISTID[_0x6911('0x39')](),'ListId')[_0x6911('0x36')](_0x4dff26['id'][_0x6911('0x39')](),_0xd7148f)[_0x6911('0x36')](_0x6911('0x37'),_0x6911('0x33'))['field'](_0x6911('0x37'),_0x6911('0x34'))[_0x6911('0x3a')](_0x6911('0x3b'))[_0x6911('0x3c')](_0x6911('0x3f'))[_0x6911('0x3c')](_0x6911('0x40'),LISTID[_0x6911('0x39')]())[_0x6911('0x3c')](_0x6911('0x43'),squel['str'](hopperContacts))[_0x6911('0x3c')](_0x6911('0x44')))[_0x6911('0x39')]();return _0x50f125;}return db[_0x6911('0x45')][_0x6911('0x46')]({'where':{'type':_0x6911('0x47')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6911('0x48')],'as':_0x6911('0x49'),'where':{'id':LISTID}}]})[_0x6911('0x29')](function(_0x4f0a39){var _0x2ba53f=[];if(_0x4f0a39){var _0x238786;for(var _0x145a6b=0x0,_0x36cd42;_0x145a6b<_0x4f0a39['length'];_0x145a6b+=0x1){_0x36cd42=_0x4f0a39[_0x145a6b]['get']({'plain':!![]});switch(_0x36cd42[_0x6911('0x4a')]){case _0x6911('0x4b'):_0x2ba53f[_0x6911('0x2a')](db['sequelize'][_0x6911('0x4c')](_0x17e8bc(_0x36cd42,_0x6911('0x4d')))['then'](function(){})[_0x6911('0x2c')](_0x1cfd83()));break;case'onlyIfOpen':_0x2ba53f[_0x6911('0x2a')](db[_0x6911('0x4e')]['query'](_0x51ae10(_0x36cd42,_0x6911('0x4d')))['then'](function(){})[_0x6911('0x2c')](_0x1cfd83()));break;default:_0x2ba53f['push'](db[_0x6911('0x4e')][_0x6911('0x4c')](_0x3eb120(_0x36cd42,_0x6911('0x4d')))[_0x6911('0x29')](function(){})[_0x6911('0x2c')](_0x1cfd83()));}}}return _0x2ba53f;})[_0x6911('0x4f')]()[_0x6911('0x29')](function(){return db[_0x6911('0x45')][_0x6911('0x46')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x6911('0x48')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x17ad2c){var _0x8716e2=[];if(_0x17ad2c){var _0x3f2141;for(var _0x502f61=0x0,_0x351c6c;_0x502f61<_0x17ad2c[_0x6911('0x16')];_0x502f61+=0x1){_0x351c6c=_0x17ad2c[_0x502f61]['get']({'plain':!![]});_0x8716e2['push'](db[_0x6911('0x4e')][_0x6911('0x4c')](_0x5b4195(_0x351c6c,_0x6911('0x4d')))[_0x6911('0x29')](function(){})[_0x6911('0x2c')](_0x1cfd83()));}}return _0x8716e2;})[_0x6911('0x4f')]();})[_0x6911('0x29')](function(){return db[_0x6911('0x50')][_0x6911('0x46')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x6911('0x48')],'as':'Lists','where':{'id':LISTID}}]})[_0x6911('0x29')](function(_0x2bb80d){var _0x36ce4d=[];if(_0x2bb80d){for(var _0x89d1c0=0x0,_0x198010;_0x89d1c0<_0x2bb80d[_0x6911('0x16')];_0x89d1c0+=0x1){_0x198010=_0x2bb80d[_0x89d1c0][_0x6911('0x51')]({'plain':!![]});switch(_0x198010['dialCheckDuplicateType']){case _0x6911('0x4b'):_0x36ce4d[_0x6911('0x2a')](db[_0x6911('0x4e')][_0x6911('0x4c')](_0x17e8bc(_0x198010,_0x6911('0x52')))['then'](function(){})['catch'](_0x1cfd83()));break;case _0x6911('0x53'):_0x36ce4d[_0x6911('0x2a')](db[_0x6911('0x4e')]['query'](_0x51ae10(_0x198010,_0x6911('0x52')))[_0x6911('0x29')](function(){})[_0x6911('0x2c')](_0x1cfd83()));break;default:_0x36ce4d[_0x6911('0x2a')](db[_0x6911('0x4e')][_0x6911('0x4c')](_0x3eb120(_0x198010,_0x6911('0x52')))[_0x6911('0x29')](function(){})[_0x6911('0x2c')](_0x1cfd83()));}}}return _0x36ce4d;})[_0x6911('0x4f')]();})[_0x6911('0x29')](function(){return db[_0x6911('0x50')][_0x6911('0x46')]({'attributes':['id'],'include':[{'model':db[_0x6911('0x48')],'as':_0x6911('0x54'),'where':{'id':LISTID}}]})[_0x6911('0x29')](function(_0x3aa7f9){var _0x5e0918=[];if(_0x3aa7f9){for(var _0x8af03b=0x0,_0x4ea9bf;_0x8af03b<_0x3aa7f9['length'];_0x8af03b+=0x1){_0x4ea9bf=_0x3aa7f9[_0x8af03b][_0x6911('0x51')]({'plain':!![]});_0x5e0918[_0x6911('0x2a')](db['sequelize'][_0x6911('0x4c')](_0x5b4195(_0x4ea9bf,'CampaignId'))[_0x6911('0x29')](function(){})['catch'](_0x1cfd83()));}}return _0x5e0918;})['all']();})[_0x6911('0x2c')](function(_0x3942c5){logger[_0x6911('0x1d')]('cmContact,\x20%s,\x20%s',_0x6911('0x55'),_0x3942c5[_0x6911('0x18')]);});}var processPromises=function(_0x126cca){return BPromise[_0x6911('0x4f')](promises)[_0x6911('0x29')](function(_0x3e1a58){})[_0x6911('0x2c')](function(_0x403c42){logger['error'](_0x6911('0x56'),JSON['stringify'](_0x403c42));})[_0x6911('0x57')](function(){socket[_0x6911('0x58')](_0x6911('0x59')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x126cca){return _0x126cca[_0x6911('0x5a')]();}});};var endCsv=function(){return BPromise[_0x6911('0x5b')]()[_0x6911('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x6911('0x29')](function(){socket[_0x6911('0x58')](_0x6911('0x59')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x6911('0x5c')](FILEPATH);}catch(_0x433acc){logger[_0x6911('0x1d')](_0x6911('0x5d'),JSON[_0x6911('0x2d')](_0x433acc));}finally{process['exit'](0x0);}});};process['on'](_0x6911('0x5e'),function(){logger['info'](_0x6911('0x5f'));endCsv();});function main(){return BPromise[_0x6911('0x5b')]()[_0x6911('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6911('0xf')](',');return db[_0x6911('0x26')][_0x6911('0x46')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x6911('0x29')](function(_0x460e18){var _0x447f45=fs[_0x6911('0x60')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6911('0x61')](_0x447f45,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e8ca7,_0xe8ddd6){total+=0x1;var _0xf20cd3=total;promises[_0x6911('0x2a')](checkRow(_0x3e8ca7,_0x460e18,_0xf20cd3)[_0x6911('0x29')](function(){success+=0x1;})['catch'](function(_0x55fae9){if(_0x55fae9[_0x6911('0x1d')]){errors+=0x1;delete _0x55fae9[_0x6911('0x1d')];}else if(_0x55fae9['duplicate']){duplicates+=0x1;delete _0x55fae9['duplicate'];}rows[_0x6911('0x2a')](_0x55fae9);}));if(total%0xc8===0x0){_0xe8ddd6[_0x6911('0x62')]();return processPromises(_0xe8ddd6);}},'complete':function(){return processPromises()[_0x6911('0x29')](function(){logger[_0x6911('0x63')](_0x6911('0x64'));endCsv();});},'error':function(_0x323fad,_0x32ca1f){logger[_0x6911('0x63')]('CSV\x20parse\x20error',JSON[_0x6911('0x2d')](_0x323fad));endCsv();}});})[_0x6911('0x2c')](function(_0x14a92b){logger[_0x6911('0x1d')](_0x6911('0x65'),JSON[_0x6911('0x2d')](_0x14a92b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 86e588e..094e60a 100644 --- a/server/components/import/cm/csv2.js +++ b/server/components/import/cm/csv2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81d4=['info','Received\x20SIGINT','error','exit','errors','sequelize','spread','catch','message','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','utcOffset','set','offset','dialTimezone','main','start','binding','clone','socket_timestamp','root','server/files/tmp','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','voice_queues_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','contactId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','split','all','isNil','filter','CmContactHasItem','findOne','then','update','updated','create','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','ListId','updatedAt','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','into','scheduledat','UserId','\x22onlyIfOpen\x22','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id'];(function(_0x3253bc,_0x5eb640){var _0x391fe1=function(_0x494030){while(--_0x494030){_0x3253bc['push'](_0x3253bc['shift']());}};_0x391fe1(++_0x5eb640);}(_0x81d4,0x1ca));var _0x481d=function(_0xfccd77,_0x496d8a){_0xfccd77=_0xfccd77-0x0;var _0x2e33e9=_0x81d4[_0xfccd77];return _0x2e33e9;};'use strict';var fs=require('fs');var path=require(_0x481d('0x0'));var _=require('lodash');var Papa=require(_0x481d('0x1'));var util=require(_0x481d('0x2'));var BPromise=require(_0x481d('0x3'));var moment=require(_0x481d('0x4'));var squel=require('squel');var Redis=require(_0x481d('0x5'));var db=require(_0x481d('0x6'))['db'];var config=require(_0x481d('0x7'));var shared=require(_0x481d('0x8'));var logger=require('../../../config/logger')(_0x481d('0x9'));config[_0x481d('0xa')]=_[_0x481d('0xb')](config[_0x481d('0xa')],{'host':_0x481d('0xc'),'port':0x18eb});var socket=require(_0x481d('0xd'))(new Redis(config[_0x481d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x481d('0xe')](_0x481d('0xf'));function isEmail(_0x543d51){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))*$/[_0x481d('0x10')](_0x543d51);}function selectNotIn(_0x5eec25,_0x450ff3,_0x225cea,_0x20a038,_0xa452a8){return squel[_0x481d('0x11')]()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x20a038)[_0x481d('0x15')](_0x450ff3,null,_0x450ff3+_0x481d('0x16')+_0x20a038+'.'+_0x225cea)[_0x481d('0x17')](_0x20a038+'.'+_0x225cea+_0x481d('0x18')+_0x5eec25+'.'+_0x225cea)[_0x481d('0x17')](_0x450ff3+_0x481d('0x19')+_0xa452a8[_0x481d('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x531f45,_0x349331){promisesAdditionalPhones=[];return db[_0x481d('0x1a')][_0x481d('0x1b')]({'raw':!![],'attributes':['id',_0x481d('0x1c')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x4e9e98){if(_0x4e9e98!==null){var _0x3c8674=[];for(var _0x31487b=0x0;_0x31487b<_0x4e9e98[_0x481d('0x1d')];_0x31487b++){var _0x1c4361=_0x4e9e98[_0x31487b];_0x3c8674[_0x481d('0x1e')](insertAdditionalPhones(_0x1c4361));}}Promise['all'](_0x3c8674)['then'](function(){_0x531f45({'val':0x1});});});});}function insertAdditionalPhones(_0x1e40a6){return new Promise(function(_0x49ec0a,_0x2549bc){var _0xbe8f46=_0x1e40a6[_0x481d('0x1c')];var _0x2ce432=_0xbe8f46[_0x481d('0x1f')](';');var _0x31b583=[];orderBy=0x0;for(var _0x8108ba=0x0;_0x8108ba<_0x2ce432[_0x481d('0x1d')];_0x8108ba++){_0x31b583['push'](splitAdditionalPhone(_0x1e40a6['id'],_0x2ce432[_0x8108ba]));}Promise[_0x481d('0x20')](_0x31b583)['then'](function(){_0x49ec0a({'val':_0x2ce432[_0x481d('0x1d')]});});});}function splitAdditionalPhone(_0x2d0933,_0x4bc31b){return new Promise(function(_0x1dff91,_0x11ab9d){var _0x109a87=_0x4bc31b[_0x481d('0x1f')](':');var _0x2fe442=_0x109a87[0x0];var _0x3da368=_0x109a87[0x1];if(!_[_0x481d('0x21')](_0x3da368)){var _0x2d3de7=_0x3da368['split']('|');var _0x10a4b7=[];for(var _0x201c83=0x0;_0x201c83<_0x2d3de7[_0x481d('0x1d')];_0x201c83++){if(_0x2d3de7[_0x201c83]!==''){var _0x45391f=_[_0x481d('0x22')](promisesAdditionalPhones,{'contactId':_0x2d0933,'phone':_0x2d3de7[_0x201c83]});if(_0x45391f[_0x481d('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x481d('0x1e')]({'contactId':_0x2d0933,'contactTypeId':_0x2fe442,'phone':_0x2d3de7[_0x201c83],'orderBy':orderBy});}}}_0x1dff91({'ok':0x1});}else _0x1dff91({'res':0x0});});}function createAdditionalPhone(_0x55defd,_0x5387d6,_0x4db983,_0xc81350){var _0x287698='';var _0x240110='';var _0x750881=_0x4db983[_0x481d('0x1f')]('§');_0x287698=_0x750881[0x0];if(_0x750881[_0x481d('0x1d')]==0x2)_0x240110=_0x750881[0x1];return new Promise(function(_0x4eb87c,_0x2ad8ac){return db[_0x481d('0x23')][_0x481d('0x24')]({'where':{'CmContactId':_0x55defd,'item':_0x287698}})[_0x481d('0x25')](function(_0x2ec7dd){if(_0x2ec7dd){return db[_0x481d('0x23')][_0x481d('0x26')]({'ItemTypeId':_0x5387d6,'description':_0x240110,'OrderBy':_0xc81350},{'where':{'CmContactId':_0x55defd,'item':_0x287698}})['then'](function(_0x2bd19c){_0x4eb87c({'res':_0x481d('0x27')});});}else{return db[_0x481d('0x23')][_0x481d('0x28')]({'CmContactId':_0x55defd,'item':_0x287698,'description':_0x240110,'ItemTypeId':_0x5387d6,'OrderBy':_0xc81350,'ItemClass':'PHONE'})[_0x481d('0x25')](function(_0x403a19){_0x4eb87c({'res':'inserted'});});}});});}function insertCmHopper(_0x1bdd79,_0x7e2c8d,_0xef4261,_0x314878,_0x5a68c2){var _0x317121=[_0x481d('0x29'),_0x481d('0x2a'),_0x481d('0x2b'),'cm_contacts.ListId',_0x7e2c8d+'.'+_0x314878,_0x481d('0x2c'),_0x481d('0x2d'),_0x481d('0x2e'),_0x481d('0x2f'),'\x22'+_0x5a68c2+'\x22'];return squel[_0x481d('0x30')]()['into'](_0x481d('0x31'))[_0x481d('0x32')]([_0x481d('0x13'),'scheduledat',_0x481d('0x33'),'ListId',_0x314878,_0x481d('0x34'),'updatedAt',_0x481d('0x35'),'UserId',_0x481d('0x36')],squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x317121)[_0x481d('0x14')](_0x7e2c8d)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x7e2c8d+_0x481d('0x3a'))[_0x481d('0x15')](_0xef4261,null,_0xef4261+_0x481d('0x16')+_0x7e2c8d+'.'+_0x314878)[_0x481d('0x17')](_0x7e2c8d+_0x481d('0x3b'),_0x1bdd79)['where'](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x7e2c8d,_0xef4261,_0x314878,_0x481d('0x31'),[_0x481d('0x3e'),'\x22onlyIfOpen\x22']))[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x7e2c8d,_0xef4261,_0x314878,_0x481d('0x31'),[_0x481d('0x3e')])))[_0x481d('0x3f')]();}function insertCmHopperBlack(_0x414d7c,_0x31d36a,_0x233094,_0x29bc8e){var _0x44f96f=[_0x481d('0x29'),_0x481d('0x2b'),_0x481d('0x40'),_0x31d36a+'.'+_0x29bc8e,_0x481d('0x2c'),_0x481d('0x2d')];return squel[_0x481d('0x30')]()['into'](_0x481d('0x41'))[_0x481d('0x32')]([_0x481d('0x13'),'ContactId',_0x481d('0x42'),_0x29bc8e,'createdAt',_0x481d('0x43')],squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x44f96f)[_0x481d('0x14')](_0x31d36a)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x31d36a+'.CmListId')[_0x481d('0x15')](_0x233094,null,_0x233094+_0x481d('0x16')+_0x31d36a+'.'+_0x29bc8e)[_0x481d('0x17')](_0x31d36a+_0x481d('0x3b'),_0x414d7c)[_0x481d('0x17')](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),squel['select']()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x481d('0x41'))['where'](_0x481d('0x44'),_0x414d7c)['where'](_0x29bc8e+_0x481d('0x18')+_0x31d36a+'.'+_0x29bc8e)))[_0x481d('0x3f')]();}function insertTzCmHopper(_0x52000b,_0x45d575,_0x45f481,_0x5e08a5,_0x497e57,_0x24d227){var _0x520dfe=[_0x481d('0x29'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x24d227+_0x481d('0x45'),_0x481d('0x2b'),_0x481d('0x40'),_0x45d575+'.'+_0x5e08a5,_0x481d('0x2c'),'cm_contacts.updatedAt',_0x481d('0x2e'),'cm_contacts.UserId','\x22'+_0x497e57+'\x22'];var _0x2655a8=squel['insert']()[_0x481d('0x46')](_0x481d('0x31'))[_0x481d('0x32')](['phone',_0x481d('0x47'),_0x481d('0x33'),_0x481d('0x42'),_0x5e08a5,'createdAt',_0x481d('0x43'),'priority',_0x481d('0x48'),'recallme'],squel[_0x481d('0x11')]()['fields'](_0x520dfe)['from'](_0x45d575)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x45d575+'.CmListId')[_0x481d('0x15')](_0x45f481,null,_0x45f481+_0x481d('0x16')+_0x45d575+'.'+_0x5e08a5)['join'](_0x24d227,null,_0x24d227+_0x481d('0x16')+_0x45d575+'.'+_0x5e08a5)[_0x481d('0x17')](_0x45d575+_0x481d('0x3b'),_0x52000b)[_0x481d('0x17')](_0x481d('0x3c'),NOW)['where'](_0x481d('0x3d'),selectNotIn(_0x45d575,_0x45f481,_0x5e08a5,_0x481d('0x31'),[_0x481d('0x3e'),_0x481d('0x49')]))[_0x481d('0x17')](_0x481d('0x3d'),selectNotIn(_0x45d575,_0x45f481,_0x5e08a5,_0x481d('0x31'),[_0x481d('0x3e')])))[_0x481d('0x3f')]();return _0x2655a8;}function insertTzCmHopperBlack(_0x10f8b1,_0x21145a,_0x1cc947,_0x4187f8){var _0x7ca2f9=['cm_contacts.phone','cm_contacts.id',_0x481d('0x40'),_0x21145a+'.'+_0x4187f8,_0x481d('0x2c'),_0x481d('0x2d')];return squel[_0x481d('0x30')]()[_0x481d('0x46')]('cm_hopper_black')[_0x481d('0x32')]([_0x481d('0x13'),_0x481d('0x33'),_0x481d('0x42'),_0x4187f8,_0x481d('0x34'),_0x481d('0x43')],squel[_0x481d('0x11')]()['fields'](_0x7ca2f9)[_0x481d('0x14')](_0x21145a)[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x39')+_0x21145a+_0x481d('0x3a'))[_0x481d('0x15')](_0x1cc947,null,_0x1cc947+'.id\x20=\x20'+_0x21145a+'.'+_0x4187f8)[_0x481d('0x17')](_0x21145a+_0x481d('0x3b'),_0x10f8b1)[_0x481d('0x17')](_0x481d('0x3c'),NOW)[_0x481d('0x17')](_0x481d('0x3d'),squel[_0x481d('0x11')]()[_0x481d('0x12')](_0x481d('0x13'))[_0x481d('0x14')](_0x481d('0x41'))['where'](_0x481d('0x44'),_0x10f8b1)[_0x481d('0x17')](_0x4187f8+_0x481d('0x18')+_0x21145a+'.'+_0x4187f8)))[_0x481d('0x3f')]();}function insertCmHopperAdditionalPhones(_0x37918a){var _0x2d3c64=['cm_hopper.id',_0x481d('0x4a'),'cm_contact_has_items.OrderBy',_0x481d('0x4b'),_0x481d('0x4c')];return squel[_0x481d('0x30')]()['into'](_0x481d('0x4d'))[_0x481d('0x32')]([_0x481d('0x4e'),'phone',_0x481d('0x4f'),_0x481d('0x34'),_0x481d('0x43')],squel['select']()[_0x481d('0x37')](_0x2d3c64)['from']('cm_hopper')[_0x481d('0x15')](_0x481d('0x38'),null,_0x481d('0x50'))[_0x481d('0x15')](_0x481d('0x51'),null,_0x481d('0x52'))[_0x481d('0x17')](_0x481d('0x53'),_0x37918a)[_0x481d('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x481d('0x3f')]();}function insertCmContact(_0x3a9939,_0x47f9b9,_0x415d0a,_0x3b7ee3){var _0x419217=_[_0x481d('0x54')](_[_0x481d('0x55')](_0x3b7ee3),['ListId','CompanyId',_0x481d('0x34'),_0x481d('0x43')]);return squel['insert']()[_0x481d('0x46')](_0x481d('0x38'))[_0x481d('0x32')](_0x419217,squel[_0x481d('0x11')]()[_0x481d('0x37')](_0x419217)['from'](_0x47f9b9)[_0x481d('0x17')]('('+_0x415d0a[_0x481d('0x15')](',')+_0x481d('0x56'),squel[_0x481d('0x11')]()['fields'](_0x415d0a)[_0x481d('0x14')](_0x481d('0x38'))[_0x481d('0x17')]('ListId\x20=\x20?',_0x3a9939)['where'](_0x481d('0x57')))[_0x481d('0x17')](_0x481d('0x58'),squel[_0x481d('0x11')]()['field'](_0x481d('0x59'),_0x481d('0x5a'))[_0x481d('0x14')](_0x47f9b9)['group'](_0x415d0a[_0x481d('0x15')](','))))[_0x481d('0x3f')]();}function handleStop(){logger[_0x481d('0x5b')](_0x481d('0x5c'));stopped=!![];}function handleUncaughtException(_0x51b9a9){logger[_0x481d('0x5d')](_0x51b9a9['message']);process[_0x481d('0x5e')](0x1);}function handleError(_0x246c0d,_0x4ccb6f){stats[_0x481d('0x5f')][_0x481d('0x1e')]({'name':_0x4ccb6f['code'],'message':_0x4ccb6f['message'],'row':_0x246c0d});}function handleQuery(_0xead03d){logger[_0x481d('0x5b')](_0xead03d);return db[_0x481d('0x60')]['query'](_0xead03d)[_0x481d('0x61')](function(_0x1118ce){results[_0x481d('0x1e')](_0x1118ce);})[_0x481d('0x62')](function(_0xe34fea){logger[_0x481d('0x5d')](_0xe34fea[_0x481d('0x63')]);});}function updateTzCampaigns(_0x4f28d1){return new Promise(function(_0x315087,_0x4a2e10){var _0x3971a3=squel[_0x481d('0x11')]()[_0x481d('0x37')]([_0x481d('0x64'),'campaigns.dialTimezone'])[_0x481d('0x14')](_0x481d('0x65'))[_0x481d('0x15')](_0x481d('0x66'),null,_0x481d('0x67'))[_0x481d('0x17')](_0x481d('0x68')+_0x4f28d1);db[_0x481d('0x60')][_0x481d('0x69')](_0x3971a3['toString']())[_0x481d('0x61')](function(_0x5a5cdd){var _0x2f56cb=[];for(var _0x57aabb=0x0;_0x57aabb<_0x5a5cdd[_0x481d('0x1d')];_0x57aabb++){_0x2f56cb[_0x481d('0x1e')](getTimezoneData(_0x5a5cdd[_0x57aabb],tmp_campaigns));}BPromise[_0x481d('0x20')](_0x2f56cb)[_0x481d('0x25')](function(){_0x315087({'val':0x1});});})[_0x481d('0x62')](function(_0x379ef3){logger[_0x481d('0x5d')](_0x379ef3['message']);_0x315087({'val':0x0});});});}function updateTzVoiceQueues(_0x570da0){return new Promise(function(_0x2292df,_0x356e6c){var _0x3acc57=squel[_0x481d('0x11')]()[_0x481d('0x37')](['voice_queues.id',_0x481d('0x6a')])[_0x481d('0x14')](_0x481d('0x6b'))[_0x481d('0x15')](_0x481d('0x6c'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x481d('0x17')](_0x481d('0x6d')+_0x570da0);db[_0x481d('0x60')][_0x481d('0x69')](_0x3acc57['toString']())[_0x481d('0x61')](function(_0x3e98e8){var _0x3a580c=[];for(var _0x386d78=0x0;_0x386d78<_0x3e98e8[_0x481d('0x1d')];_0x386d78++){_0x3a580c[_0x481d('0x1e')](getTimezoneData(_0x3e98e8[_0x386d78],tmp_voice_queues));}BPromise[_0x481d('0x20')](_0x3a580c)[_0x481d('0x25')](function(){_0x2292df({'val':0x1});});})[_0x481d('0x62')](function(_0x3ed985){logger['error'](_0x3ed985[_0x481d('0x63')]);_0x2292df({'val':0x0});});});}function getTimezoneData(_0x20b567,_0x56816d){return new Promise(function(_0x31916e,_0x3a9882){var _0x503efa=shared[_0x481d('0x6e')];var _0x158f2a=_0x503efa[_0x20b567['dialTimezone']];if(_[_0x481d('0x21')](_0x158f2a)){_0x31916e({'ret':0x1});}else{var _0x3758da=_0x158f2a[_0x481d('0x6f')];var _0x1bf5ce=squel[_0x481d('0x30')]()[_0x481d('0x46')](_0x56816d)[_0x481d('0x70')]('id',_0x20b567['id'])[_0x481d('0x70')](_0x481d('0x71'),_0x3758da)[_0x481d('0x70')](_0x481d('0x72'),_0x20b567[_0x481d('0x72')])['toString']();return db[_0x481d('0x60')]['query'](_0x1bf5ce)['spread'](function(_0x36cf09){_0x31916e({'ret':0x1});})[_0x481d('0x62')](function(_0x21d471){logger[_0x481d('0x5d')](_0x21d471[_0x481d('0x63')]);_0x3a9882({'ret':0x1});});}});}function handleTZQuery(_0x46b728){logger[_0x481d('0x5b')](_0x46b728);return db[_0x481d('0x60')]['query'](_0x46b728)[_0x481d('0x61')](function(_0x1df11a){})[_0x481d('0x62')](function(_0x2bf210){logger[_0x481d('0x5d')](_0x2bf210[_0x481d('0x63')]);});}function main(_0x14beb6,_0x1b363e,_0x2ab2ad,_0x3ab121){logger[_0x481d('0x5b')](_0x481d('0x73'),_0x14beb6,JSON['stringify'](_0x1b363e));process['send'](_0x481d('0x74'));var _0xa1f3fb=_0x1b363e[_0x481d('0x75')];var _0x487f90=_[_0x481d('0x76')](_0xa1f3fb);var _0x1bbf90=_0x1b363e[_0x481d('0x77')];var _0x141dff=path['join'](config[_0x481d('0x78')],_0x481d('0x79'),_0x1bbf90+'.csv');hasTZ=_[_0x481d('0x55')](_0xa1f3fb)['includes'](_0x481d('0x72'));var _0x9d3406=_[_0x481d('0x55')](_0xa1f3fb)[_0x481d('0x15')]();logger[_0x481d('0x5b')]('header',_0x9d3406);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x481d('0x7a')]})[_0x481d('0x25')](function(_0x53b780){for(var _0x593c77=0x0;_0x593c77<_0x53b780[_0x481d('0x1d')];_0x593c77++){if(_0x53b780[_0x593c77]['name']in _0xa1f3fb){contactItemTypes['push'](_0x53b780[_0x593c77]);delete _0x487f90[_0x53b780[_0x593c77][_0x481d('0x7a')]];hasAdditionalPhones=!![];}for(var _0x55e38d in _0xa1f3fb){if(_0x53b780[_0x593c77]['name']+_0x481d('0x7b')===_0x55e38d){phoneDescriptions[_0x481d('0x1e')]({'itemTypeId':_0x53b780[_0x593c77]['id'],'description':_0x55e38d});delete _0x487f90[_0x55e38d];}}}if(hasAdditionalPhones)_0x487f90[_0x481d('0x1c')]='';var _0x38b2ff=_[_0x481d('0x55')](_0x487f90)['join']();logger[_0x481d('0x5b')]('header',_0x38b2ff);fs[_0x481d('0x7c')](_0x141dff,_0x38b2ff+'\x0a');Papa[_0x481d('0x7d')](fs[_0x481d('0x7e')](_0x14beb6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x393c8b,_0x4f4775){try{for(var _0xdcd8f5=0x0,_0xb4446=[];_0xdcd8f5<_0x393c8b[_0x481d('0x7f')]['length'];_0xdcd8f5++){stats[_0x481d('0x80')]+=0x1;if(_0x393c8b[_0x481d('0x5f')][_0xdcd8f5]){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],_0x393c8b[_0x481d('0x5f')][_0xdcd8f5]);}else{var _0x2dcd4f=[];var _0x46552a=[];var _0x42772b={};for(var _0x3b6260 in _0xa1f3fb){let _0x59c1a3=contactItemTypes['find'](_0x538a11=>_0x538a11['name']===_0x3b6260);let _0x5c1de9=contactItemTypes[_0x481d('0x81')](_0x4957b5=>_0x4957b5[_0x481d('0x7a')]+_0x481d('0x7b')===_0x3b6260);if(_[_0x481d('0x21')](_0x59c1a3)&&_[_0x481d('0x21')](_0x5c1de9)){if(_0xa1f3fb['hasOwnProperty'](_0x3b6260)){if(_0x393c8b['data'][_0xdcd8f5][_0xa1f3fb[_0x3b6260]]){var _0x3585e6=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]][_0x481d('0x83')](/"/g,'\x27'));switch(_0x3b6260){case _0x481d('0x47'):var _0x5cf241=moment(_0x3585e6,_0x481d('0xf'),!![]);if(_0x5cf241[_0x481d('0x84')]()){_0xb4446['push']('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f['push'](_0x481d('0x85'));}break;case _0x481d('0x35'):var _0x795f6e=parseInt(_0x3585e6);_0x3585e6=_[_0x481d('0x86')](_0x795f6e)||_0x795f6e<0x0||_0x795f6e>0x4?_0x3ab121?0x3:0x2:_0x795f6e;_0xb4446['push']('\x22'+_0x3585e6+'\x22');break;case'UserId':var _0x3a41a6=parseInt(_0x3585e6);if(_[_0x481d('0x87')](_0x3a41a6)&&_[_0x481d('0x88')](_0x2ab2ad,_0x3a41a6)){_0xb4446[_0x481d('0x1e')]('\x22'+_0x3a41a6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')](_0x481d('0x89'));}break;case'email':if(isEmail(_0x3585e6)){_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x12d64c=moment(_0x3585e6,_0x481d('0x8a'),!![]);if(_0x12d64c[_0x481d('0x84')]()){_0xb4446['push']('\x22'+_0x3585e6+'\x22');}else{_0x2dcd4f[_0x481d('0x1e')](_0x481d('0x8b'));}break;case _0x481d('0x72'):var _0xcd85d8=shared[_0x481d('0x6e')];var _0x1cc039=_0xcd85d8[_0x3585e6];if(!_[_0x481d('0x21')](_0x1cc039)){var _0x1e5724=_0x1cc039[_0x481d('0x6f')];_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');_0xb4446[_0x481d('0x1e')]('\x22'+_0x1e5724+'\x22');}break;default:_0xb4446[_0x481d('0x1e')]('\x22'+_0x3585e6+'\x22');}}else{switch(_0x3b6260){case _0x481d('0x8c'):case _0x481d('0x13'):_0x2dcd4f[_0x481d('0x1e')](_0x3b6260+_0x481d('0x8d'));break;default:_0xb4446[_0x481d('0x1e')]('\x22\x22');}}}}else{var _0x4dea57='';if(!_[_0x481d('0x21')](_0x59c1a3)){if(!_0x42772b['hasOwnProperty'](_0x59c1a3['id'])){if(!_[_0x481d('0x21')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]])){var _0x3585e6=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x3b6260]]['replace'](/"/g,'\x27'));var _0x9adc21=phoneDescriptions['find'](_0x1abb35=>_0x1abb35[_0x481d('0x8e')]===_0x59c1a3['id']);if(!_[_0x481d('0x21')](_0x9adc21)){var _0x1b6a4d=_[_0x481d('0x82')](_0x393c8b[_0x481d('0x7f')][_0xdcd8f5][_0xa1f3fb[_0x9adc21[_0x481d('0x8f')]]][_0x481d('0x83')](/"/g,'\x27'));if(!_[_0x481d('0x21')](_0x1b6a4d))_0x3585e6=_0x3585e6+'§'+_0x1b6a4d;}if(_0x4dea57=='')_0x4dea57=_0x3585e6;else _0x4dea57+='|'+_0x3585e6;}_0x46552a[_0x481d('0x1e')](_0x59c1a3['id']+':'+_0x4dea57);_0x42772b[_0x59c1a3['id']]=0x1;}}}}if(hasAdditionalPhones){_0xb4446[_0x481d('0x1e')]('\x22'+_0x46552a[_0x481d('0x15')](';')+'\x22');}if(_0x2dcd4f[_0x481d('0x1d')]){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],{'code':_0x481d('0x90'),'message':_0x2dcd4f[_0x481d('0x15')]()});}else{fs[_0x481d('0x91')](_0x141dff,_0xb4446[_0x481d('0x15')]()+'\x0a');}_0xb4446=[];}if(!(stats['rows']%0xc8)){socket[_0x481d('0x92')](_0x481d('0x93')+_0x1bbf90,stats);stats[_0x481d('0x5f')]=[];}}if(stopped){logger[_0x481d('0x5b')](_0x481d('0x94'));_0x4f4775[_0x481d('0x95')]();}}catch(_0x4b012b){handleError(_0x393c8b[_0x481d('0x7f')][_0xdcd8f5],{'code':_0x481d('0x96'),'message':_0x4b012b[_0x481d('0x63')]});logger['error']('step',_0x4b012b['message']);}},'complete':function(){try{var _0x2c4d3d=[];var _0x2b198b=[];var _0x6162de=_0x481d('0x38');if(_0x1b363e[_0x481d('0x97')]&&_0x1b363e[_0x481d('0x97')]['length']){_0x6162de=_0x481d('0x98')+_0x1bbf90;_0x2c4d3d['push'](_0x481d('0x99')+_0x6162de+_0x481d('0x9a'));}tmp_campaigns='campaigns_'+_0x1bbf90;tmp_voice_queues=_0x481d('0x9b')+_0x1bbf90;_0x2b198b['push'](_0x481d('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x2b198b[_0x481d('0x1e')](_0x481d('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x481d('0x9c')](_0x2b198b,handleTZQuery)[_0x481d('0x25')](function(_0x5b16a9){updateTzCampaigns(_0x1b363e[_0x481d('0x42')])['then'](function(_0x2842ac){updateTzVoiceQueues(_0x1b363e[_0x481d('0x42')])['then'](function(_0x30c4c7){if(hasTZ)_0x38b2ff=_0x38b2ff[_0x481d('0x83')](_0x481d('0x72'),_0x481d('0x9d'));var _0x351658=util[_0x481d('0xe')](_0x481d('0x9e'),_0x141dff,_0x6162de,_0x38b2ff,_0x1b363e[_0x481d('0x42')],_0x1b363e[_0x481d('0x9f')]||null,NOW,NOW);if(_[_0x481d('0x21')](_0xa1f3fb[_0x481d('0x47')])){_0x351658+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c4d3d['push'](_0x351658);if(_0x1b363e['duplicates']&&_0x1b363e[_0x481d('0x97')][_0x481d('0x1d')]){_0x2c4d3d[_0x481d('0x1e')](insertCmContact(_0x1b363e[_0x481d('0x42')],_0x6162de,_0x1b363e[_0x481d('0x97')],_0xa1f3fb));_0x2c4d3d['push'](_0x481d('0xa0')+_0x6162de+';');}BPromise[_0x481d('0x9c')](_0x2c4d3d,handleQuery)[_0x481d('0x25')](function(_0x56049f){BPromise['all']([handleAdditionalPhones()])[_0x481d('0x25')](function(){_0x2c4d3d=[];for(var _0x2db15d=0x0;_0x2db15d\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93ed,0x9a));var _0xd93e=function(_0x990052,_0x28b108){_0x990052=_0x990052-0x0;var _0x36f959=_0x93ed[_0x990052];return _0x36f959;};'use strict';var fs=require('fs');var path=require(_0xd93e('0x0'));var _=require(_0xd93e('0x1'));var Papa=require(_0xd93e('0x2'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0xd93e('0x3'));var squel=require(_0xd93e('0x4'));var Redis=require(_0xd93e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xd93e('0x6'));var shared=require('../../../config/environment/shared');var logger=require(_0xd93e('0x7'))(_0xd93e('0x8'));config[_0xd93e('0x9')]=_[_0xd93e('0xa')](config[_0xd93e('0x9')],{'host':_0xd93e('0xb'),'port':0x18eb});var socket=require(_0xd93e('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xd93e('0xd')](_0xd93e('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xd93e('0xd')](_0xd93e('0xe'));function isEmail(_0xd3e851){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'](_0xd3e851);}function selectNotIn(_0xb7ae31,_0x29fa39,_0x337fa1,_0xd9a328,_0x5ef000){return squel[_0xd93e('0xf')]()[_0xd93e('0x10')](_0xd93e('0x11'))[_0xd93e('0x12')](_0xd9a328)[_0xd93e('0x13')](_0x29fa39,null,_0x29fa39+_0xd93e('0x14')+_0xd9a328+'.'+_0x337fa1)[_0xd93e('0x15')](_0xd9a328+'.'+_0x337fa1+'\x20=\x20'+_0xb7ae31+'.'+_0x337fa1)[_0xd93e('0x15')](_0x29fa39+_0xd93e('0x16')+_0x5ef000['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x366814,_0x27817c){promisesAdditionalPhones=[];return db[_0xd93e('0x17')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xd93e('0x18')](function(_0x197be8){if(_0x197be8!==null){var _0x39ec1f=[];for(var _0xf0daa1=0x0;_0xf0daa1<_0x197be8[_0xd93e('0x19')];_0xf0daa1++){var _0x5b2c9c=_0x197be8[_0xf0daa1];_0x39ec1f['push'](insertAdditionalPhones(_0x5b2c9c));}}Promise[_0xd93e('0x1a')](_0x39ec1f)[_0xd93e('0x18')](function(){_0x366814({'val':0x1});});});});}function insertAdditionalPhones(_0x374272){return new Promise(function(_0x1c5957,_0xdf6464){var _0x29f88b=_0x374272[_0xd93e('0x1b')];var _0xf739ca=_0x29f88b[_0xd93e('0x1c')](';');var _0x14d11b=[];orderBy=0x0;for(var _0x149526=0x0;_0x149526<_0xf739ca[_0xd93e('0x19')];_0x149526++){_0x14d11b[_0xd93e('0x1d')](splitAdditionalPhone(_0x374272['id'],_0xf739ca[_0x149526]));}Promise[_0xd93e('0x1a')](_0x14d11b)[_0xd93e('0x18')](function(){_0x1c5957({'val':_0xf739ca[_0xd93e('0x19')]});});});}function splitAdditionalPhone(_0x150681,_0x8a0e58){return new Promise(function(_0x13ad85,_0x22cca2){var _0x442b78=_0x8a0e58[_0xd93e('0x1c')](':');var _0x2e25ed=_0x442b78[0x0];var _0x2ff9=_0x442b78[0x1];if(!_[_0xd93e('0x1e')](_0x2ff9)){var _0x5c9fbb=_0x2ff9[_0xd93e('0x1c')]('|');var _0x2ff5ff=[];for(var _0x5d603a=0x0;_0x5d603a<_0x5c9fbb[_0xd93e('0x19')];_0x5d603a++){if(_0x5c9fbb[_0x5d603a]!==''){var _0x566fa8=_[_0xd93e('0x1f')](promisesAdditionalPhones,{'contactId':_0x150681,'phone':_0x5c9fbb[_0x5d603a]});if(_0x566fa8[_0xd93e('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xd93e('0x1d')]({'contactId':_0x150681,'contactTypeId':_0x2e25ed,'phone':_0x5c9fbb[_0x5d603a],'orderBy':orderBy});}}}_0x13ad85({'ok':0x1});}else _0x13ad85({'res':0x0});});}function createAdditionalPhone(_0x11023c,_0x5c155d,_0x46fd8d,_0x1605f4){var _0x101916='';var _0x38651d='';var _0x2d878a=_0x46fd8d[_0xd93e('0x1c')]('§');_0x101916=_0x2d878a[0x0];if(_0x2d878a['length']==0x2)_0x38651d=_0x2d878a[0x1];return new Promise(function(_0x217898,_0x2bacc1){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x11023c,'item':_0x101916}})[_0xd93e('0x18')](function(_0x49888a){if(_0x49888a){return db['CmContactHasItem'][_0xd93e('0x20')]({'ItemTypeId':_0x5c155d,'description':_0x38651d,'OrderBy':_0x1605f4},{'where':{'CmContactId':_0x11023c,'item':_0x101916}})[_0xd93e('0x18')](function(_0x1a35a3){_0x217898({'res':_0xd93e('0x21')});});}else{return db[_0xd93e('0x22')][_0xd93e('0x23')]({'CmContactId':_0x11023c,'item':_0x101916,'description':_0x38651d,'ItemTypeId':_0x5c155d,'OrderBy':_0x1605f4,'ItemClass':_0xd93e('0x24')})['then'](function(_0x48db33){_0x217898({'res':_0xd93e('0x25')});});}});});}function insertCmHopper(_0x3b344a,_0x2c3784,_0x1213ac,_0x2557c2,_0x51cc47){var _0x51ab42=[_0xd93e('0x26'),_0xd93e('0x27'),'cm_contacts.id',_0xd93e('0x28'),_0x2c3784+'.'+_0x2557c2,_0xd93e('0x29'),'cm_contacts.updatedAt',_0xd93e('0x2a'),_0xd93e('0x2b'),'\x22'+_0x51cc47+'\x22'];return squel[_0xd93e('0x2c')]()[_0xd93e('0x2d')]('cm_hopper')[_0xd93e('0x2e')]([_0xd93e('0x11'),'scheduledat','ContactId','ListId',_0x2557c2,_0xd93e('0x2f'),_0xd93e('0x30'),'priority',_0xd93e('0x31'),'recallme'],squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x51ab42)[_0xd93e('0x12')](_0x2c3784)[_0xd93e('0x13')](_0xd93e('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x2c3784+_0xd93e('0x34'))[_0xd93e('0x13')](_0x1213ac,null,_0x1213ac+_0xd93e('0x14')+_0x2c3784+'.'+_0x2557c2)[_0xd93e('0x15')](_0x2c3784+'.CmListId\x20=\x20?',_0x3b344a)[_0xd93e('0x15')](_0xd93e('0x35'),NOW)[_0xd93e('0x15')](_0xd93e('0x36'),selectNotIn(_0x2c3784,_0x1213ac,_0x2557c2,'cm_hopper',['\x22always\x22',_0xd93e('0x37')]))['where'](_0xd93e('0x36'),selectNotIn(_0x2c3784,_0x1213ac,_0x2557c2,'cm_hopper',['\x22always\x22'])))[_0xd93e('0x38')]();}function insertCmHopperBlack(_0x213ae9,_0x455c05,_0x19cdaa,_0x41e767){var _0x4f7795=['cm_contacts.phone','cm_contacts.id',_0xd93e('0x28'),_0x455c05+'.'+_0x41e767,_0xd93e('0x29'),_0xd93e('0x39')];return squel[_0xd93e('0x2c')]()[_0xd93e('0x2d')](_0xd93e('0x3a'))[_0xd93e('0x2e')]([_0xd93e('0x11'),_0xd93e('0x3b'),_0xd93e('0x3c'),_0x41e767,_0xd93e('0x2f'),_0xd93e('0x30')],squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x4f7795)['from'](_0x455c05)[_0xd93e('0x13')](_0xd93e('0x33'),null,_0xd93e('0x3d')+_0x455c05+'.CmListId')[_0xd93e('0x13')](_0x19cdaa,null,_0x19cdaa+'.id\x20=\x20'+_0x455c05+'.'+_0x41e767)['where'](_0x455c05+_0xd93e('0x3e'),_0x213ae9)[_0xd93e('0x15')](_0xd93e('0x35'),NOW)[_0xd93e('0x15')](_0xd93e('0x36'),squel[_0xd93e('0xf')]()[_0xd93e('0x10')]('phone')[_0xd93e('0x12')](_0xd93e('0x3a'))['where']('ListId\x20=\x20?',_0x213ae9)[_0xd93e('0x15')](_0x41e767+_0xd93e('0x3f')+_0x455c05+'.'+_0x41e767)))[_0xd93e('0x38')]();}function insertTzCmHopper(_0x16fe6a,_0x39dc16,_0x260925,_0x57a560,_0xa1bae9,_0xbf8d37){var _0x1d2c29=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0xbf8d37+_0xd93e('0x40'),'cm_contacts.id',_0xd93e('0x28'),_0x39dc16+'.'+_0x57a560,'cm_contacts.createdAt',_0xd93e('0x39'),_0xd93e('0x2a'),_0xd93e('0x2b'),'\x22'+_0xa1bae9+'\x22'];var _0x3c8804=squel[_0xd93e('0x2c')]()[_0xd93e('0x2d')]('cm_hopper')[_0xd93e('0x2e')](['phone','scheduledat',_0xd93e('0x3b'),_0xd93e('0x3c'),_0x57a560,_0xd93e('0x2f'),_0xd93e('0x30'),_0xd93e('0x41'),_0xd93e('0x31'),'recallme'],squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x1d2c29)[_0xd93e('0x12')](_0x39dc16)['join'](_0xd93e('0x33'),null,_0xd93e('0x3d')+_0x39dc16+_0xd93e('0x34'))[_0xd93e('0x13')](_0x260925,null,_0x260925+'.id\x20=\x20'+_0x39dc16+'.'+_0x57a560)[_0xd93e('0x13')](_0xbf8d37,null,_0xbf8d37+_0xd93e('0x14')+_0x39dc16+'.'+_0x57a560)[_0xd93e('0x15')](_0x39dc16+_0xd93e('0x3e'),_0x16fe6a)['where'](_0xd93e('0x35'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x39dc16,_0x260925,_0x57a560,_0xd93e('0x42'),['\x22always\x22',_0xd93e('0x37')]))['where'](_0xd93e('0x36'),selectNotIn(_0x39dc16,_0x260925,_0x57a560,_0xd93e('0x42'),['\x22always\x22'])))[_0xd93e('0x38')]();return _0x3c8804;}function insertTzCmHopperBlack(_0x27d6e2,_0x3caf05,_0x4f004c,_0x30b082){var _0x21649d=[_0xd93e('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x3caf05+'.'+_0x30b082,_0xd93e('0x29'),_0xd93e('0x39')];return squel[_0xd93e('0x2c')]()['into']('cm_hopper_black')[_0xd93e('0x2e')](['phone',_0xd93e('0x3b'),_0xd93e('0x3c'),_0x30b082,_0xd93e('0x2f'),'updatedAt'],squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x21649d)[_0xd93e('0x12')](_0x3caf05)[_0xd93e('0x13')](_0xd93e('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x3caf05+_0xd93e('0x34'))['join'](_0x4f004c,null,_0x4f004c+_0xd93e('0x14')+_0x3caf05+'.'+_0x30b082)['where'](_0x3caf05+_0xd93e('0x3e'),_0x27d6e2)[_0xd93e('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xd93e('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd93e('0xf')]()[_0xd93e('0x10')]('phone')['from']('cm_hopper_black')[_0xd93e('0x15')]('ListId\x20=\x20?',_0x27d6e2)[_0xd93e('0x15')](_0x30b082+_0xd93e('0x3f')+_0x3caf05+'.'+_0x30b082)))[_0xd93e('0x38')]();}function insertCmHopperAdditionalPhones(_0x24f456){var _0x4ceb13=[_0xd93e('0x43'),_0xd93e('0x44'),'cm_contact_has_items.OrderBy',_0xd93e('0x45'),_0xd93e('0x46')];return squel[_0xd93e('0x2c')]()[_0xd93e('0x2d')](_0xd93e('0x47'))['fromQuery']([_0xd93e('0x48'),_0xd93e('0x11'),'OrderBy','createdAt',_0xd93e('0x30')],squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x4ceb13)[_0xd93e('0x12')](_0xd93e('0x42'))[_0xd93e('0x13')](_0xd93e('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xd93e('0x13')](_0xd93e('0x49'),null,_0xd93e('0x4a'))[_0xd93e('0x15')](_0xd93e('0x4b'),_0x24f456)['where'](_0xd93e('0x35'),NOW))[_0xd93e('0x38')]();}function insertCmContact(_0x39e5f2,_0x4ca5db,_0x11f3d2,_0xc00b18){var _0x47cfeb=_['concat'](_[_0xd93e('0x4c')](_0xc00b18),[_0xd93e('0x3c'),_0xd93e('0x4d'),_0xd93e('0x2f'),_0xd93e('0x30')]);return squel[_0xd93e('0x2c')]()[_0xd93e('0x2d')]('cm_contacts')[_0xd93e('0x2e')](_0x47cfeb,squel[_0xd93e('0xf')]()[_0xd93e('0x32')](_0x47cfeb)['from'](_0x4ca5db)[_0xd93e('0x15')]('('+_0x11f3d2[_0xd93e('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xd93e('0x32')](_0x11f3d2)['from'](_0xd93e('0x33'))['where']('ListId\x20=\x20?',_0x39e5f2)['where'](_0xd93e('0x4e')))['where'](_0xd93e('0x4f'),squel['select']()[_0xd93e('0x10')](_0xd93e('0x50'),'min_id')[_0xd93e('0x12')](_0x4ca5db)[_0xd93e('0x51')](_0x11f3d2['join'](','))))[_0xd93e('0x38')]();}function handleStop(){logger[_0xd93e('0x52')](_0xd93e('0x53'));stopped=!![];}function handleUncaughtException(_0x5ea2c9){logger['error'](_0x5ea2c9[_0xd93e('0x54')]);process[_0xd93e('0x55')](0x1);}function handleError(_0x23554d,_0x3e38c9){stats[_0xd93e('0x56')][_0xd93e('0x1d')]({'name':_0x3e38c9['code'],'message':_0x3e38c9[_0xd93e('0x54')],'row':_0x23554d});}function handleQuery(_0x4d251f){logger[_0xd93e('0x52')](_0x4d251f);return db[_0xd93e('0x57')][_0xd93e('0x58')](_0x4d251f)[_0xd93e('0x59')](function(_0x40a928){results['push'](_0x40a928);})[_0xd93e('0x5a')](function(_0x496e83){logger[_0xd93e('0x5b')](_0x496e83['message']);});}function updateTzCampaigns(_0x20cebb){return new Promise(function(_0x48e448,_0x19600d){var _0x254d1f=squel[_0xd93e('0xf')]()[_0xd93e('0x32')]([_0xd93e('0x5c'),_0xd93e('0x5d')])['from'](_0xd93e('0x5e'))[_0xd93e('0x13')](_0xd93e('0x5f'),null,_0xd93e('0x60'))['where']('campaigns_has_cm_lists.CmListId='+_0x20cebb);db[_0xd93e('0x57')][_0xd93e('0x58')](_0x254d1f['toString']())[_0xd93e('0x59')](function(_0x306437){var _0x407006=[];for(var _0x2848e5=0x0;_0x2848e5<_0x306437[_0xd93e('0x19')];_0x2848e5++){_0x407006[_0xd93e('0x1d')](getTimezoneData(_0x306437[_0x2848e5],tmp_campaigns));}BPromise[_0xd93e('0x1a')](_0x407006)[_0xd93e('0x18')](function(){_0x48e448({'val':0x1});});})['catch'](function(_0x368ca7){logger['error'](_0x368ca7[_0xd93e('0x54')]);_0x48e448({'val':0x0});});});}function updateTzVoiceQueues(_0x3ac1f4){return new Promise(function(_0x36fdc7,_0x1d8f64){var _0x23bfed=squel[_0xd93e('0xf')]()['fields']([_0xd93e('0x61'),_0xd93e('0x62')])[_0xd93e('0x12')]('voice_queues')[_0xd93e('0x13')](_0xd93e('0x63'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xd93e('0x15')](_0xd93e('0x64')+_0x3ac1f4);db[_0xd93e('0x57')][_0xd93e('0x58')](_0x23bfed[_0xd93e('0x38')]())['spread'](function(_0x4da043){var _0x19dd9c=[];for(var _0x2a3216=0x0;_0x2a3216<_0x4da043['length'];_0x2a3216++){_0x19dd9c[_0xd93e('0x1d')](getTimezoneData(_0x4da043[_0x2a3216],tmp_voice_queues));}BPromise[_0xd93e('0x1a')](_0x19dd9c)[_0xd93e('0x18')](function(){_0x36fdc7({'val':0x1});});})[_0xd93e('0x5a')](function(_0x2bfc18){logger[_0xd93e('0x5b')](_0x2bfc18[_0xd93e('0x54')]);_0x36fdc7({'val':0x0});});});}function getTimezoneData(_0x14c1b9,_0x64d5a0){return new Promise(function(_0x2188ac,_0x580db6){var _0x157d37=shared[_0xd93e('0x65')];var _0x122467=_0x157d37[_0x14c1b9[_0xd93e('0x66')]];if(_[_0xd93e('0x1e')](_0x122467)){_0x2188ac({'ret':0x1});}else{var _0x184633=_0x122467['utcOffset'];var _0xad46eb=squel['insert']()[_0xd93e('0x2d')](_0x64d5a0)[_0xd93e('0x67')]('id',_0x14c1b9['id'])['set']('offset',_0x184633)[_0xd93e('0x67')](_0xd93e('0x66'),_0x14c1b9[_0xd93e('0x66')])[_0xd93e('0x38')]();return db[_0xd93e('0x57')][_0xd93e('0x58')](_0xad46eb)[_0xd93e('0x59')](function(_0x1b908c){_0x2188ac({'ret':0x1});})[_0xd93e('0x5a')](function(_0x2f6080){logger['error'](_0x2f6080[_0xd93e('0x54')]);_0x580db6({'ret':0x1});});}});}function handleTZQuery(_0x17ce96){logger[_0xd93e('0x52')](_0x17ce96);return db[_0xd93e('0x57')]['query'](_0x17ce96)[_0xd93e('0x59')](function(_0x5e1906){})[_0xd93e('0x5a')](function(_0x39791f){logger['error'](_0x39791f[_0xd93e('0x54')]);});}function main(_0x129b9b,_0x8f2475,_0x66ab4e,_0x35f1ac){logger[_0xd93e('0x52')](_0xd93e('0x68'),_0x129b9b,JSON[_0xd93e('0x69')](_0x8f2475));process[_0xd93e('0x6a')](_0xd93e('0x6b'));var _0x482ae9=_0x8f2475[_0xd93e('0x6c')];var _0x34b0f8=_[_0xd93e('0x6d')](_0x482ae9);var _0x1e57a5=_0x8f2475['socket_timestamp'];var _0x3c7326=path['join'](config[_0xd93e('0x6e')],_0xd93e('0x6f'),_0x1e57a5+_0xd93e('0x70'));hasTZ=_[_0xd93e('0x4c')](_0x482ae9)[_0xd93e('0x71')](_0xd93e('0x66'));var _0xa8325=_[_0xd93e('0x4c')](_0x482ae9)[_0xd93e('0x13')]();logger['info'](_0xd93e('0x72'),_0xa8325);db[_0xd93e('0x73')][_0xd93e('0x74')]({'raw':!![],'attributes':['id',_0xd93e('0x75')]})[_0xd93e('0x18')](function(_0x5c6329){for(var _0x2c2af2=0x0;_0x2c2af2<_0x5c6329[_0xd93e('0x19')];_0x2c2af2++){if(_0x5c6329[_0x2c2af2][_0xd93e('0x75')]in _0x482ae9){contactItemTypes[_0xd93e('0x1d')](_0x5c6329[_0x2c2af2]);delete _0x34b0f8[_0x5c6329[_0x2c2af2][_0xd93e('0x75')]];hasAdditionalPhones=!![];}for(var _0x2b4588 in _0x482ae9){if(_0x5c6329[_0x2c2af2][_0xd93e('0x75')]+'_description'===_0x2b4588){phoneDescriptions[_0xd93e('0x1d')]({'itemTypeId':_0x5c6329[_0x2c2af2]['id'],'description':_0x2b4588});delete _0x34b0f8[_0x2b4588];}}}if(hasAdditionalPhones)_0x34b0f8[_0xd93e('0x1b')]='';var _0x54021b=_[_0xd93e('0x4c')](_0x34b0f8)[_0xd93e('0x13')]();logger['info'](_0xd93e('0x72'),_0x54021b);fs['writeFileSync'](_0x3c7326,_0x54021b+'\x0a');Papa[_0xd93e('0x76')](fs[_0xd93e('0x77')](_0x129b9b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x57eb6c,_0x8dd561){try{for(var _0x3e2bcb=0x0,_0x29f545=[];_0x3e2bcb<_0x57eb6c[_0xd93e('0x78')][_0xd93e('0x19')];_0x3e2bcb++){stats[_0xd93e('0x79')]+=0x1;if(_0x57eb6c[_0xd93e('0x56')][_0x3e2bcb]){handleError(_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb],_0x57eb6c[_0xd93e('0x56')][_0x3e2bcb]);}else{var _0x3325e1=[];var _0x492919=[];var _0x5a40fc={};for(var _0x20a865 in _0x482ae9){let _0x25cb4d=contactItemTypes[_0xd93e('0x7a')](_0x1cf83e=>_0x1cf83e[_0xd93e('0x75')]===_0x20a865);let _0x5da810=contactItemTypes[_0xd93e('0x7a')](_0x2f105b=>_0x2f105b[_0xd93e('0x75')]+_0xd93e('0x7b')===_0x20a865);if(_['isNil'](_0x25cb4d)&&_[_0xd93e('0x1e')](_0x5da810)){if(_0x482ae9[_0xd93e('0x7c')](_0x20a865)){if(_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb][_0x482ae9[_0x20a865]]){var _0x766bde=_[_0xd93e('0x7d')](_0x57eb6c['data'][_0x3e2bcb][_0x482ae9[_0x20a865]]['replace'](/"/g,'\x27'));switch(_0x20a865){case _0xd93e('0x7e'):var _0x13cceb=moment(_0x766bde,_0xd93e('0xe'),!![]);if(_0x13cceb[_0xd93e('0x7f')]()){_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');}else{_0x3325e1[_0xd93e('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xd93e('0x41'):var _0x40b9b9=parseInt(_0x766bde);_0x766bde=_[_0xd93e('0x80')](_0x40b9b9)||_0x40b9b9<0x0||_0x40b9b9>0x4?_0x35f1ac?0x3:0x2:_0x40b9b9;_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');break;case _0xd93e('0x31'):var _0x4e95c0=parseInt(_0x766bde);if(_[_0xd93e('0x81')](_0x4e95c0)&&_[_0xd93e('0x71')](_0x66ab4e,_0x4e95c0)){_0x29f545[_0xd93e('0x1d')]('\x22'+_0x4e95c0+'\x22');}else{_0x3325e1[_0xd93e('0x1d')](_0xd93e('0x82'));}break;case _0xd93e('0x83'):if(isEmail(_0x766bde)){_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');}else{_0x3325e1[_0xd93e('0x1d')](_0xd93e('0x84'));}break;case _0xd93e('0x85'):var _0x22a67b=moment(_0x766bde,_0xd93e('0x86'),!![]);if(_0x22a67b[_0xd93e('0x7f')]()){_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');}else{_0x3325e1['push'](_0xd93e('0x87'));}break;case _0xd93e('0x66'):var _0xda2ef1=shared[_0xd93e('0x65')];var _0x37a952=_0xda2ef1[_0x766bde];if(!_[_0xd93e('0x1e')](_0x37a952)){var _0x580dac=_0x37a952[_0xd93e('0x88')];_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');_0x29f545[_0xd93e('0x1d')]('\x22'+_0x580dac+'\x22');}break;default:_0x29f545[_0xd93e('0x1d')]('\x22'+_0x766bde+'\x22');}}else{switch(_0x20a865){case'firstName':case _0xd93e('0x11'):_0x3325e1['push'](_0x20a865+_0xd93e('0x89'));break;default:_0x29f545['push']('\x22\x22');}}}}else{var _0x23342e='';if(!_[_0xd93e('0x1e')](_0x25cb4d)){if(!_0x5a40fc[_0xd93e('0x7c')](_0x25cb4d['id'])){if(!_[_0xd93e('0x1e')](_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb][_0x482ae9[_0x20a865]])){var _0x766bde=_[_0xd93e('0x7d')](_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb][_0x482ae9[_0x20a865]][_0xd93e('0x8a')](/"/g,'\x27'));var _0x5d35ad=phoneDescriptions[_0xd93e('0x7a')](_0x8355b4=>_0x8355b4[_0xd93e('0x8b')]===_0x25cb4d['id']);if(!_[_0xd93e('0x1e')](_0x5d35ad)){var _0x26d0bc=_[_0xd93e('0x7d')](_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb][_0x482ae9[_0x5d35ad[_0xd93e('0x8c')]]][_0xd93e('0x8a')](/"/g,'\x27'));if(!_[_0xd93e('0x1e')](_0x26d0bc))_0x766bde=_0x766bde+'§'+_0x26d0bc;}if(_0x23342e=='')_0x23342e=_0x766bde;else _0x23342e+='|'+_0x766bde;}_0x492919[_0xd93e('0x1d')](_0x25cb4d['id']+':'+_0x23342e);_0x5a40fc[_0x25cb4d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x29f545['push']('\x22'+_0x492919[_0xd93e('0x13')](';')+'\x22');}if(_0x3325e1[_0xd93e('0x19')]){handleError(_0x57eb6c['data'][_0x3e2bcb],{'code':_0xd93e('0x8d'),'message':_0x3325e1[_0xd93e('0x13')]()});}else{fs[_0xd93e('0x8e')](_0x3c7326,_0x29f545[_0xd93e('0x13')]()+'\x0a');}_0x29f545=[];}if(!(stats[_0xd93e('0x79')]%0xc8)){socket[_0xd93e('0x8f')](_0xd93e('0x90')+_0x1e57a5,stats);stats[_0xd93e('0x56')]=[];}}if(stopped){logger[_0xd93e('0x52')]('Abort\x20parser');_0x8dd561['abort']();}}catch(_0x121f46){handleError(_0x57eb6c[_0xd93e('0x78')][_0x3e2bcb],{'code':_0xd93e('0x91'),'message':_0x121f46['message']});logger['error'](_0xd93e('0x92'),_0x121f46[_0xd93e('0x54')]);}},'complete':function(){try{var _0x59a784=[];var _0x367f61=[];var _0x3a0793=_0xd93e('0x33');if(_0x8f2475['duplicates']&&_0x8f2475[_0xd93e('0x93')][_0xd93e('0x19')]){_0x3a0793=_0xd93e('0x94')+_0x1e57a5;_0x59a784[_0xd93e('0x1d')](_0xd93e('0x95')+_0x3a0793+_0xd93e('0x96'));}tmp_campaigns=_0xd93e('0x97')+_0x1e57a5;tmp_voice_queues=_0xd93e('0x98')+_0x1e57a5;_0x367f61[_0xd93e('0x1d')](_0xd93e('0x95')+tmp_campaigns+_0xd93e('0x99'));_0x367f61[_0xd93e('0x1d')](_0xd93e('0x95')+tmp_voice_queues+_0xd93e('0x99'));BPromise[_0xd93e('0x9a')](_0x367f61,handleTZQuery)['then'](function(_0x4a425f){updateTzCampaigns(_0x8f2475[_0xd93e('0x3c')])[_0xd93e('0x18')](function(_0x463fb3){updateTzVoiceQueues(_0x8f2475[_0xd93e('0x3c')])['then'](function(_0x641221){if(hasTZ)_0x54021b=_0x54021b['replace']('dialTimezone',_0xd93e('0x9b'));var _0x550ca7=util['format'](_0xd93e('0x9c'),_0x3c7326,_0x3a0793,_0x54021b,_0x8f2475['ListId'],_0x8f2475[_0xd93e('0x4d')]||null,NOW,NOW);if(_[_0xd93e('0x1e')](_0x482ae9[_0xd93e('0x7e')])){_0x550ca7+=',\x20scheduledAt\x20=\x20NOW()';}_0x59a784[_0xd93e('0x1d')](_0x550ca7);if(_0x8f2475[_0xd93e('0x93')]&&_0x8f2475['duplicates']['length']){_0x59a784[_0xd93e('0x1d')](insertCmContact(_0x8f2475[_0xd93e('0x3c')],_0x3a0793,_0x8f2475[_0xd93e('0x93')],_0x482ae9));_0x59a784[_0xd93e('0x1d')](_0xd93e('0x9d')+_0x3a0793+';');}BPromise['each'](_0x59a784,handleQuery)['then'](function(_0x15523f){BPromise[_0xd93e('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x59a784=[];for(var _0x39f6c5=0x0;_0x39f6c5_0xbeffe5[_0xf419('0x67')]===_0xeda639);let _0x2031bb=contactItemTypes[_0xf419('0x6f')](_0x544b6b=>_0x544b6b[_0xf419('0x67')]+_0xf419('0x70')===_0xeda639);if(_[_0xf419('0x23')](_0x3581d0)&&_[_0xf419('0x23')](_0x2031bb)){if(_0x57a25b[_0xf419('0x71')](_0xeda639)){if(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f][_0x57a25b[_0xeda639]]){var _0x1bf951=_[_0xf419('0x72')](_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f][_0x57a25b[_0xeda639]][_0xf419('0x73')](/"/g,'\x27'));switch(_0xeda639){case _0xf419('0x37'):var _0x27d22f=moment(_0x1bf951,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x27d22f[_0xf419('0x74')]()){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x75'));}break;case _0xf419('0x76'):var _0x31d900=parseInt(_0x1bf951);_0x1bf951=_[_0xf419('0x77')](_0x31d900)||_0x31d900<0x0||_0x31d900>0x4?_0x5b9484?0x3:0x2:_0x31d900;_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');break;case _0xf419('0x78'):var _0x33f561=parseInt(_0x1bf951);if(_[_0xf419('0x79')](_0x33f561)&&_[_0xf419('0x7a')](_0x4c0214,_0x33f561)){_0x23e815[_0xf419('0x1e')]('\x22'+_0x33f561+'\x22');}else{_0x47185d['push'](_0xf419('0x7b'));}break;case _0xf419('0x7c'):if(isEmail(_0x1bf951)){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x7d'));}break;case'dateOfBirth':var _0x4fbf8b=moment(_0x1bf951,_0xf419('0x7e'),!![]);if(_0x4fbf8b['isValid']()){_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}else{_0x47185d[_0xf419('0x1e')](_0xf419('0x7f'));}break;default:_0x23e815[_0xf419('0x1e')]('\x22'+_0x1bf951+'\x22');}}else{switch(_0xeda639){case _0xf419('0x80'):case _0xf419('0x36'):_0x47185d['push'](_0xeda639+_0xf419('0x81'));break;default:_0x23e815['push']('\x22\x22');}}}}else{var _0x393960='';if(!_['isNil'](_0x3581d0)){if(!_0x4b6fbe[_0xf419('0x71')](_0x3581d0['id'])){for(var _0x444796=0x0;_0x444796<_0x57a25b[_0xeda639][_0xf419('0x1c')];_0x444796++){var _0x1bf951=_['trim'](_0x2ebcf5['data'][_0x41cf1f][_0x57a25b[_0xeda639][_0x444796]][_0xf419('0x73')](/"/g,'\x27'));var _0x416568=phoneDescriptions[_0xf419('0x6f')](_0x177bba=>_0x177bba[_0xf419('0x82')]===_0x3581d0['id']);if(!_[_0xf419('0x23')](_0x416568)){var _0xb266db=_[_0xf419('0x72')](_0x2ebcf5['data'][_0x41cf1f][_0x57a25b[_0x416568['description']][0x0]][_0xf419('0x73')](/"/g,'\x27'));if(!_[_0xf419('0x23')](_0xb266db))_0x1bf951=_0x1bf951+'§'+_0xb266db;}if(_0x393960=='')_0x393960=_0x1bf951;else _0x393960+='|'+_0x1bf951;}_0x3455db['push'](_0x3581d0['id']+':'+_0x393960);_0x4b6fbe[_0x3581d0['id']]=0x1;}}}}if(hasAdditionalPhones){_0x23e815[_0xf419('0x1e')]('\x22'+_0x3455db[_0xf419('0x14')](';')+'\x22');}if(_0x47185d[_0xf419('0x1c')]){handleError(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f],{'code':_0xf419('0x83'),'message':_0x47185d[_0xf419('0x14')]()});}else{fs['appendFileSync'](_0x3ae9ee,_0x23e815[_0xf419('0x14')]()+'\x0a');}_0x23e815=[];}if(!(stats[_0xf419('0x6c')]%0xc8)){socket['emit'](_0xf419('0x84')+_0x5255e2,stats);stats[_0xf419('0x6d')]=[];}}if(stopped){logger[_0xf419('0x68')](_0xf419('0x85'));_0x5b9986[_0xf419('0x86')]();}}catch(_0x8aa272){handleError(_0x2ebcf5[_0xf419('0x6e')][_0x41cf1f],{'code':_0xf419('0x87'),'message':_0x8aa272[_0xf419('0x5a')]});logger[_0xf419('0x22')](_0xf419('0x88'),_0x8aa272[_0xf419('0x5a')]);}},'complete':function(){try{var _0x5c5820=[];var _0xb65620=tempTableName;_0x5c5820[_0xf419('0x1e')]('CREATE\x20TABLE\x20'+_0xb65620+'\x20LIKE\x20cm_contacts;');logger[_0xf419('0x68')]('CIS\x20len',contactItemTypes['length']);var _0x5a061b=util[_0xf419('0x89')](_0xf419('0x8a'),_0x3ae9ee,_0xb65620,_0x165fc4,_0x66d285[_0xf419('0x39')],_0x66d285[_0xf419('0x53')]||null,NOW,NOW);if(_[_0xf419('0x23')](_0x57a25b[_0xf419('0x37')])){_0x5a061b+=_0xf419('0x8b');}_0x5c5820[_0xf419('0x1e')](_0x5a061b);BPromise[_0xf419('0x8c')](_0x5c5820,handleQuery)[_0xf419('0x20')](function(_0x4ace0d){BPromise[_0xf419('0x1f')]([handleAdditionalPhones()])[_0xf419('0x20')](function(){_0x5c5820=[];for(var _0x30045a=0x0;_0x30045a\x20\x20');}var _0x46ee18=path[_0xf419('0x14')](config[_0xf419('0x63')],_0xf419('0x97'),process['argv'][0x2]);if(!fs['existsSync'](_0x46ee18)){throw new Error(_0xf419('0x98'));}var _0x2a0fb1={};try{_0x2a0fb1=JSON[_0xf419('0x6a')](process[_0xf419('0x96')][0x3]);if(!_0x2a0fb1['binding']){throw new Error(_0xf419('0x99'));}var _0x54abc3=0x0;if(_0x2a0fb1[_0xf419('0x60')]['UserId']){_0x54abc3=0x1;}if(!_0x2a0fb1['ListId']){throw new Error(_0xf419('0x9a'));}}catch(_0x45b6fd){throw new Error('body\x20id\x20mandatory');}var _0x2b7f36=[];try{_0x2b7f36=_[_0xf419('0x9b')](JSON[_0xf419('0x6a')](process[_0xf419('0x96')][0x4]),'id');}catch(_0x5ab876){logger['info'](_0xf419('0x9c'));}main(_0x46ee18,_0x2a0fb1,_0x2b7f36,_0x54abc3);}validate();process['on'](_0xf419('0x9d'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x90d2=['message','split','length','CmContactHasItem','findOne','then','update','updated','create','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code','query','catch','main','stringify','start','socket_timestamp','root','.csv','info','body','ContactItemType','name','header','writeFileSync','parse','createReadStream','data','rows','find','_description','hasOwnProperty','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','ListId',',\x20scheduledAt\x20=\x20NOW()','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','error'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x90d2,0x86));var _0x290d=function(_0x643e3d,_0x53262a){_0x643e3d=_0x643e3d-0x0;var _0x2fb4fe=_0x90d2[_0x643e3d];return _0x2fb4fe;};'use strict';var fs=require('fs');var path=require(_0x290d('0x0'));var _=require(_0x290d('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x290d('0x2'));var moment=require('moment');var squel=require(_0x290d('0x3'));var Redis=require('ioredis');var db=require(_0x290d('0x4'))['db'];var config=require(_0x290d('0x5'));var logger=require(_0x290d('0x6'))(_0x290d('0x7'));config[_0x290d('0x8')]=_[_0x290d('0x9')](config[_0x290d('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x290d('0xa'))(new Redis(config[_0x290d('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x290d('0xb')](_0x290d('0xc'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0x290d('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x338348){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))*$/[_0x290d('0xe')](_0x338348);}function selectNotIn(_0x37b2a3,_0x334042,_0x5a51b9,_0x55b58b,_0x3aa728){return squel['select']()[_0x290d('0xf')](_0x290d('0x10'))[_0x290d('0x11')](_0x55b58b)[_0x290d('0x12')](_0x334042,null,_0x334042+'.id\x20=\x20'+_0x55b58b+'.'+_0x5a51b9)[_0x290d('0x13')](_0x55b58b+'.'+_0x5a51b9+_0x290d('0x14')+_0x37b2a3+'.'+_0x5a51b9)[_0x290d('0x13')](_0x334042+_0x290d('0x15')+_0x3aa728[_0x290d('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x239508,_0x305ed4){promisesAdditionalPhones=[];promisesContact=[];return db[_0x290d('0x16')]['query'](_0x290d('0x17')+tempTableName)[_0x290d('0x18')](function(_0x38187c){if(_0x38187c!==null){var _0x1a3e98=[];for(var _0x5bda13=0x0;_0x5bda13<_0x38187c['length'];_0x5bda13++){var _0x2d102b=_0x38187c[_0x5bda13];if(!_['isNil'](_0x2d102b[_0x290d('0x10')])){if(!_[_0x290d('0x19')](_0x2d102b[_0x290d('0x1a')]))_0x1a3e98['push'](insertAdditionalPhones(_0x2d102b));promisesContact[_0x290d('0x1b')]({'contact':_0x2d102b});}}}Promise[_0x290d('0x1c')](_0x1a3e98)['then'](function(){_0x239508({'val':0x1});});})['catch'](function(_0x5a5ad9){logger[_0x290d('0x1d')](_0x5a5ad9[_0x290d('0x1e')]);});});}function insertAdditionalPhones(_0x578b50){return new Promise(function(_0x1bb028,_0x509544){var _0x323e3a=_0x578b50[_0x290d('0x1a')];if(_[_0x290d('0x19')](_0x323e3a))_0x509544({'val':0x0});else{var _0x54d728=_0x323e3a[_0x290d('0x1f')](';');var _0x31de07=[];orderBy=0x0;for(var _0x380347=0x0;_0x380347<_0x54d728[_0x290d('0x20')];_0x380347++){_0x31de07[_0x290d('0x1b')](splitAdditionalPhone(_0x578b50['id'],_0x54d728[_0x380347]));}Promise[_0x290d('0x1c')](_0x31de07)['then'](function(){_0x1bb028({'val':_0x54d728[_0x290d('0x20')]});});}});}function splitAdditionalPhone(_0x260ead,_0x12292){return new Promise(function(_0x408e05,_0x2a0f18){var _0x3e1650=_0x12292[_0x290d('0x1f')](':');var _0x1836c8=_0x3e1650[0x0];var _0x49e52d=_0x3e1650[0x1];if(_0x49e52d!==''){var _0x198a3b=_0x49e52d[_0x290d('0x1f')]('|');var _0x3611fe=[];for(var _0x586411=0x0;_0x586411<_0x198a3b['length'];_0x586411++){if(_0x198a3b[_0x586411]!==''){var _0x15d3c4=_['filter'](promisesAdditionalPhones,{'contactId':_0x260ead,'phone':_0x198a3b[_0x586411]});if(_0x15d3c4[_0x290d('0x20')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x260ead,'contactTypeId':_0x1836c8,'phone':_0x198a3b[_0x586411],'orderBy':orderBy});}}}_0x408e05({'ok':0x1});}else _0x408e05({'res':0x0});});}function createAdditionalPhone(_0x3ff913,_0x4ffb14,_0x219d94,_0xe39248){var _0x5e26e6='';var _0x9cde='';var _0x2cd859=_0x219d94[_0x290d('0x1f')]('§');_0x5e26e6=_0x2cd859[0x0];if(_0x2cd859[_0x290d('0x20')]==0x2)_0x9cde=_0x2cd859[0x1];return new Promise(function(_0x301eed,_0x4a3a27){return db[_0x290d('0x21')][_0x290d('0x22')]({'where':{'CmContactId':_0x3ff913,'item':_0x5e26e6}})[_0x290d('0x23')](function(_0x1c5469){if(_0x1c5469){return db[_0x290d('0x21')][_0x290d('0x24')]({'ItemTypeId':_0x4ffb14,'description':_0x9cde,'OrderBy':_0xe39248},{'where':{'CmContactId':_0x3ff913,'item':_0x5e26e6}})[_0x290d('0x23')](function(_0x505985){_0x301eed({'res':_0x290d('0x25')});});}else{return db['CmContactHasItem'][_0x290d('0x26')]({'CmContactId':_0x3ff913,'item':_0x5e26e6,'ItemTypeId':_0x4ffb14,'description':_0x9cde,'OrderBy':_0xe39248,'ItemClass':_0x290d('0x27')})['then'](function(_0x3545d6){_0x301eed({'res':_0x290d('0x28')});});}});});}function updateContact(_0x14fb62){return new Promise(function(_0x2f91e0,_0x1b2b99){var _0xdab22=_0x14fb62['id'];delete _0x14fb62['id'];return db['CmContact'][_0x290d('0x24')](_0x14fb62,{'where':{'id':_0xdab22}})['then'](function(_0x2679cc){updatedRows+=0x1;return db[_0x290d('0x29')][_0x290d('0x24')]({'phone':_0x14fb62['phone']},{'where':{'ContactId':_0xdab22}})[_0x290d('0x23')](function(_0x19833c){_0x2f91e0({'ret':'OK'});});});});}function insertCmHopper(_0x231974,_0x46521b,_0x3ce65e,_0x189c2c,_0x4f5684){var _0x1c3ac8=[_0x290d('0x2a'),_0x290d('0x2b'),_0x290d('0x2c'),_0x290d('0x2d'),_0x46521b+'.'+_0x189c2c,_0x290d('0x2e'),_0x290d('0x2f'),_0x290d('0x30'),_0x290d('0x31'),'\x22'+_0x4f5684+'\x22'];return squel[_0x290d('0x32')]()['into'](_0x290d('0x33'))[_0x290d('0x34')]([_0x290d('0x10'),_0x290d('0x35'),_0x290d('0x36'),'ListId',_0x189c2c,_0x290d('0x37'),_0x290d('0x38'),_0x290d('0x39'),_0x290d('0x3a'),_0x290d('0x3b')],squel[_0x290d('0x3c')]()[_0x290d('0x3d')](_0x1c3ac8)[_0x290d('0x11')](_0x46521b)['join'](_0x290d('0x3e'),null,_0x290d('0x3f')+_0x46521b+_0x290d('0x40'))[_0x290d('0x12')](_0x3ce65e,null,_0x3ce65e+_0x290d('0x41')+_0x46521b+'.'+_0x189c2c)['where'](_0x46521b+'.CmListId\x20=\x20?',_0x231974)[_0x290d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x290d('0x13')](_0x290d('0x42'),selectNotIn(_0x46521b,_0x3ce65e,_0x189c2c,_0x290d('0x33'),[_0x290d('0x43'),_0x290d('0x44')]))[_0x290d('0x13')](_0x290d('0x42'),selectNotIn(_0x46521b,_0x3ce65e,_0x189c2c,_0x290d('0x33'),['\x22always\x22'])))[_0x290d('0x45')]();}function insertCmHopperBlack(_0x243461,_0x7b2ef1,_0xec9a92,_0x8935ad){var _0x230a3f=['cm_contacts.phone',_0x290d('0x2c'),_0x290d('0x2d'),_0x7b2ef1+'.'+_0x8935ad,_0x290d('0x2e'),_0x290d('0x2f')];return squel[_0x290d('0x32')]()[_0x290d('0x46')](_0x290d('0x47'))[_0x290d('0x34')]([_0x290d('0x10'),'ContactId','ListId',_0x8935ad,_0x290d('0x37'),'updatedAt'],squel[_0x290d('0x3c')]()[_0x290d('0x3d')](_0x230a3f)[_0x290d('0x11')](_0x7b2ef1)[_0x290d('0x12')](_0x290d('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x7b2ef1+_0x290d('0x40'))['join'](_0xec9a92,null,_0xec9a92+_0x290d('0x41')+_0x7b2ef1+'.'+_0x8935ad)['where'](_0x7b2ef1+'.CmListId\x20=\x20?',_0x243461)[_0x290d('0x13')](_0x290d('0x48'),NOW)[_0x290d('0x13')](_0x290d('0x42'),squel[_0x290d('0x3c')]()[_0x290d('0xf')](_0x290d('0x10'))[_0x290d('0x11')](_0x290d('0x47'))[_0x290d('0x13')](_0x290d('0x49'),_0x243461)[_0x290d('0x13')](_0x8935ad+_0x290d('0x4a'),_0x7b2ef1+'.'+_0x8935ad)))[_0x290d('0x45')]();}function insertCmHopperAdditionalPhones(_0x17b73e){var _0x5518c6=[_0x290d('0x4b'),'cm_contact_has_items.item',_0x290d('0x4c'),_0x290d('0x4d'),_0x290d('0x4e')];return squel[_0x290d('0x32')]()[_0x290d('0x46')]('cm_hopper_additional_phones')[_0x290d('0x34')]([_0x290d('0x4f'),'phone',_0x290d('0x50'),_0x290d('0x37'),'updatedAt'],squel[_0x290d('0x3c')]()[_0x290d('0x3d')](_0x5518c6)['from'](_0x290d('0x33'))[_0x290d('0x12')](_0x290d('0x3e'),null,_0x290d('0x51'))['join'](_0x290d('0x52'),null,_0x290d('0x53'))['where'](_0x290d('0x54'),_0x17b73e)[_0x290d('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x290d('0x45')]();}function insertCmContact(_0x1a146c,_0x36c28f,_0x4e46c5,_0x331ed5){var _0xef3f9c=_[_0x290d('0x55')](_[_0x290d('0x56')](_0x331ed5),['ListId',_0x290d('0x57'),_0x290d('0x37'),'updatedAt']);return squel[_0x290d('0x32')]()[_0x290d('0x46')](_0x290d('0x3e'))[_0x290d('0x34')](_0xef3f9c,squel[_0x290d('0x3c')]()['fields'](_0xef3f9c)[_0x290d('0x11')](_0x36c28f)[_0x290d('0x13')]('('+_0x4e46c5[_0x290d('0x12')](',')+_0x290d('0x58'),squel[_0x290d('0x3c')]()['fields'](_0x4e46c5)[_0x290d('0x11')]('cm_contacts')[_0x290d('0x13')](_0x290d('0x49'),_0x1a146c))[_0x290d('0x13')](_0x290d('0x59'),squel[_0x290d('0x3c')]()['field'](_0x290d('0x5a'),_0x290d('0x5b'))['from'](_0x36c28f)[_0x290d('0x5c')](_0x4e46c5[_0x290d('0x12')](','))))[_0x290d('0x45')]();}function handleStop(){logger['info'](_0x290d('0x5d'));stopped=!![];}function handleUncaughtException(_0x16dec8){logger[_0x290d('0x1d')](_0x16dec8[_0x290d('0x1e')]);process[_0x290d('0x5e')](0x1);}function handleError(_0x45b401,_0x211df0){stats[_0x290d('0x5f')][_0x290d('0x1b')]({'name':_0x211df0[_0x290d('0x60')],'message':_0x211df0[_0x290d('0x1e')],'row':_0x45b401});}function handleQuery(_0xc337cd){logger['info'](_0xc337cd);return db[_0x290d('0x16')][_0x290d('0x61')](_0xc337cd)[_0x290d('0x18')](function(_0x3887aa){results[_0x290d('0x1b')](_0x3887aa);})[_0x290d('0x62')](function(_0x1f957a){logger[_0x290d('0x1d')](_0x1f957a[_0x290d('0x1e')]);});}function main(_0x254c74,_0x567da5,_0x311bb9,_0x20b4ed){logger['info'](_0x290d('0x63'),_0x254c74,JSON[_0x290d('0x64')](_0x567da5));process['send'](_0x290d('0x65'));var _0x166d7a=_0x567da5['binding'];var _0x8299b8=_['clone'](_0x166d7a);var _0x48ad7f=_0x567da5[_0x290d('0x66')];var _0x3661a8=path[_0x290d('0x12')](config[_0x290d('0x67')],'server/files/tmp',_0x48ad7f+_0x290d('0x68'));logger[_0x290d('0x69')](_0x290d('0x6a'),_0x567da5);db[_0x290d('0x6b')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x460b28){for(var _0x3809da=0x0;_0x3809da<_0x460b28[_0x290d('0x20')];_0x3809da++){if(_0x460b28[_0x3809da][_0x290d('0x6c')]in _0x166d7a){contactItemTypes[_0x290d('0x1b')](_0x460b28[_0x3809da]);delete _0x8299b8[_0x460b28[_0x3809da][_0x290d('0x6c')]];hasAdditionalPhones=!![];}for(var _0x2afd1d in _0x166d7a){if(_0x460b28[_0x3809da][_0x290d('0x6c')]+'_description'===_0x2afd1d){phoneDescriptions[_0x290d('0x1b')]({'itemTypeId':_0x460b28[_0x3809da]['id'],'description':_0x2afd1d});delete _0x8299b8[_0x2afd1d];}}}if(hasAdditionalPhones)_0x8299b8[_0x290d('0x1a')]='';var _0x13d22c=_['keys'](_0x8299b8)['join']();logger['info'](_0x290d('0x6d'),_0x13d22c);fs[_0x290d('0x6e')](_0x3661a8,_0x13d22c+'\x0a');Papa[_0x290d('0x6f')](fs[_0x290d('0x70')](_0x254c74),{'header':!![],'skipEmptyLines':!![],'step':function(_0x25eda0,_0x315053){try{for(var _0x538e20=0x0,_0x315402=[];_0x538e20<_0x25eda0[_0x290d('0x71')][_0x290d('0x20')];_0x538e20++){stats[_0x290d('0x72')]+=0x1;if(_0x25eda0[_0x290d('0x5f')][_0x538e20]){handleError(_0x25eda0[_0x290d('0x71')][_0x538e20],_0x25eda0[_0x290d('0x5f')][_0x538e20]);}else{var _0x363aab=[];var _0x3ab0b3=[];var _0xf5673c={};for(var _0x17b1cf in _0x166d7a){let _0xcc89b1=contactItemTypes[_0x290d('0x73')](_0x8c6cdb=>_0x8c6cdb[_0x290d('0x6c')]===_0x17b1cf);let _0x253c0a=contactItemTypes[_0x290d('0x73')](_0x4b472f=>_0x4b472f[_0x290d('0x6c')]+_0x290d('0x74')===_0x17b1cf);if(_[_0x290d('0x19')](_0xcc89b1)&&_[_0x290d('0x19')](_0x253c0a)){if(_0x166d7a[_0x290d('0x75')](_0x17b1cf)){if(_0x25eda0[_0x290d('0x71')][_0x538e20][_0x166d7a[_0x17b1cf]]){var _0x14794d=_['trim'](_0x25eda0[_0x290d('0x71')][_0x538e20][_0x166d7a[_0x17b1cf]][_0x290d('0x76')](/"/g,'\x27'));switch(_0x17b1cf){case'scheduledat':var _0x38bcd0=moment(_0x14794d,_0x290d('0xc'),!![]);if(_0x38bcd0[_0x290d('0x77')]()){_0x315402[_0x290d('0x1b')]('\x22'+_0x14794d+'\x22');}else{_0x363aab[_0x290d('0x1b')](_0x290d('0x78'));}break;case _0x290d('0x39'):var _0x72e23d=parseInt(_0x14794d);_0x14794d=_[_0x290d('0x79')](_0x72e23d)||_0x72e23d<0x0||_0x72e23d>0x4?_0x20b4ed?0x3:0x2:_0x72e23d;_0x315402['push']('\x22'+_0x14794d+'\x22');break;case _0x290d('0x3a'):var _0x4de5ba=parseInt(_0x14794d);if(_[_0x290d('0x7a')](_0x4de5ba)&&_['includes'](_0x311bb9,_0x4de5ba)){_0x315402[_0x290d('0x1b')]('\x22'+_0x4de5ba+'\x22');}else{_0x363aab['push'](_0x290d('0x7b'));}break;case _0x290d('0x7c'):if(isEmail(_0x14794d)){_0x315402[_0x290d('0x1b')]('\x22'+_0x14794d+'\x22');}else{_0x363aab[_0x290d('0x1b')]('email\x20wrong\x20format');}break;case _0x290d('0x7d'):var _0x540ac3=moment(_0x14794d,_0x290d('0x7e'),!![]);if(_0x540ac3[_0x290d('0x77')]()){_0x315402['push']('\x22'+_0x14794d+'\x22');}else{_0x363aab['push'](_0x290d('0x7f'));}break;default:_0x315402[_0x290d('0x1b')]('\x22'+_0x14794d+'\x22');}}else{switch(_0x17b1cf){case _0x290d('0x80'):case _0x290d('0x10'):_0x363aab['push'](_0x17b1cf+_0x290d('0x81'));break;default:_0x315402[_0x290d('0x1b')]('\x22\x22');}}}}else{var _0x46e258='';if(!_[_0x290d('0x19')](_0xcc89b1)){if(!_0xf5673c['hasOwnProperty'](_0xcc89b1['id'])){for(var _0x262128=0x0;_0x262128<_0x166d7a[_0x17b1cf][_0x290d('0x20')];_0x262128++){var _0x14794d=_[_0x290d('0x82')](_0x25eda0[_0x290d('0x71')][_0x538e20][_0x166d7a[_0x17b1cf][_0x262128]][_0x290d('0x76')](/"/g,'\x27'));var _0xe6d6db=phoneDescriptions[_0x290d('0x73')](_0x1f0d34=>_0x1f0d34[_0x290d('0x83')]===_0xcc89b1['id']);if(!_[_0x290d('0x19')](_0xe6d6db)){var _0x1d637e=_['trim'](_0x25eda0[_0x290d('0x71')][_0x538e20][_0x166d7a[_0xe6d6db[_0x290d('0x84')]][0x0]][_0x290d('0x76')](/"/g,'\x27'));if(!_[_0x290d('0x19')](_0x1d637e))_0x14794d=_0x14794d+'§'+_0x1d637e;}if(_0x46e258=='')_0x46e258=_0x14794d;else _0x46e258+='|'+_0x14794d;}_0x3ab0b3[_0x290d('0x1b')](_0xcc89b1['id']+':'+_0x46e258);_0xf5673c[_0xcc89b1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x315402[_0x290d('0x1b')]('\x22'+_0x3ab0b3['join'](';')+'\x22');}if(_0x363aab[_0x290d('0x20')]){handleError(_0x25eda0['data'][_0x538e20],{'code':_0x290d('0x85'),'message':_0x363aab[_0x290d('0x12')]()});}else{fs[_0x290d('0x86')](_0x3661a8,_0x315402[_0x290d('0x12')]()+'\x0a');}_0x315402=[];}if(!(stats[_0x290d('0x72')]%0xc8)){socket[_0x290d('0x87')](_0x290d('0x88')+_0x48ad7f,stats);stats[_0x290d('0x5f')]=[];}}if(stopped){logger[_0x290d('0x69')](_0x290d('0x89'));_0x315053[_0x290d('0x8a')]();}}catch(_0x249418){handleError(_0x25eda0[_0x290d('0x71')][_0x538e20],{'code':_0x290d('0x8b'),'message':_0x249418[_0x290d('0x1e')]});logger[_0x290d('0x1d')]('step',_0x249418['message']);}},'complete':function(){try{var _0x3d857a=[];var _0x5d2e48=tempTableName;_0x3d857a[_0x290d('0x1b')]('CREATE\x20TABLE\x20'+_0x5d2e48+'\x20LIKE\x20cm_contacts;');logger[_0x290d('0x69')](_0x290d('0x8c'),contactItemTypes[_0x290d('0x20')]);var _0x4d697c=util[_0x290d('0xb')](_0x290d('0x8d'),_0x3661a8,_0x5d2e48,_0x13d22c,_0x567da5[_0x290d('0x8e')],_0x567da5[_0x290d('0x57')]||null,NOW,NOW);if(_[_0x290d('0x19')](_0x166d7a['scheduledat'])){_0x4d697c+=_0x290d('0x8f');}_0x3d857a[_0x290d('0x1b')](_0x4d697c);BPromise['each'](_0x3d857a,handleQuery)[_0x290d('0x23')](function(_0x5d7e42){BPromise[_0x290d('0x1c')]([handleAdditionalPhones()])[_0x290d('0x23')](function(){_0x3d857a=[];for(var _0x5e1ab7=0x0;_0x5e1ab7=_0x384408){return _0x3fb8d8[_0xdd08('0xf')](0x193)[_0xdd08('0x10')]({'message':util[_0xdd08('0x11')](_0xdd08('0x12'),_0x1fd0bb)});}_0x5f0877();})[_0xdd08('0x13')](function(_0x40f01f){_0x5f0877(_0x40f01f);});});}function isUserLimit(){return isLimit(_0xdd08('0x14'),0x1,db[_0xdd08('0x15')],{'where':{'$or':[{'role':_0xdd08('0x16')},{'role':_0xdd08('0x17')}]}});}exports[_0xdd08('0x18')]=isUserLimit; \ No newline at end of file +var _0xc165=['aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','then','json','catch','users','User','admin','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','split','createDecipher'];(function(_0x3e4b85,_0x130ee8){var _0x4958a5=function(_0x21e494){while(--_0x21e494){_0x3e4b85['push'](_0x3e4b85['shift']());}};_0x4958a5(++_0x130ee8);}(_0xc165,0x1bb));var _0x5c16=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0xc165[_0x199b1f];return _0x267ac9;};'use strict';var crypto=require(_0x5c16('0x0'));var util=require('util');var compose=require(_0x5c16('0x1'));var db=require(_0x5c16('0x2'))['db'];var config=require(_0x5c16('0x3'));function getValueFromLicense(_0x16fd8e,_0x1e9d36){if(_0x16fd8e&&_0x1e9d36){if(_0x1e9d36[_0x5c16('0x4')]&&_0x1e9d36['license']){var _0x189cf1=_0x1e9d36[_0x5c16('0x4')];var _0x34d10f=_0x1e9d36['license'];var _0x3b1e40=_0x189cf1[_0x5c16('0x5')]('-')[0x4];var _0x8173f0=_0x189cf1[_0x5c16('0x5')]('-')[0x0];var _0x3ad092=crypto[_0x5c16('0x6')](_0x5c16('0x7'),util[_0x5c16('0x8')](_0x5c16('0x9'),_0x3b1e40,_0x189cf1,_0x8173f0));var _0x377853=_0x3ad092[_0x5c16('0xa')](_0x34d10f,_0x5c16('0xb'),_0x5c16('0xc'));_0x377853+=_0x3ad092[_0x5c16('0xd')]('utf8');var _0x3e9d8b=JSON[_0x5c16('0xe')](_0x377853);return _0x3e9d8b['hasOwnProperty'](_0x16fd8e)?_0x3e9d8b[_0x16fd8e]:null;}}return null;}function isLimit(_0x1d9c8d,_0x1e0d5d,_0x47bc57,_0x5f1c83){var _0x2d1160=_0x1e0d5d;return compose()[_0x5c16('0xf')](function(_0x43ea54,_0xa114f5,_0x2e4c){return db[_0x5c16('0x10')][_0x5c16('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x5c16('0x12')](function(_0x51bf0d){var _0x18f8b5=getValueFromLicense(_0x1d9c8d,_0x51bf0d);return _0x18f8b5?_0x18f8b5:_0x2d1160;})['then'](function(_0x5ad709){_0x2d1160=_0x5ad709;return _0x47bc57['count'](_0x5f1c83);})[_0x5c16('0x12')](function(_0x8bf917){if(_0x8bf917>=_0x2d1160){return _0xa114f5['status'](0x193)[_0x5c16('0x13')]({'message':util[_0x5c16('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1d9c8d)});}_0x2e4c();})[_0x5c16('0x14')](function(_0x3de40e){_0x2e4c(_0x3de40e);});});}function isUserLimit(){return isLimit(_0x5c16('0x15'),0x1,db[_0x5c16('0x16')],{'where':{'$or':[{'role':_0x5c16('0x17')},{'role':'user'}]}});}exports[_0x5c16('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 36077f8..f2a976a 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc029=['moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','[$or]','length','split','match','forEach','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','shift','pop','add','hours','minutes','lodash'];(function(_0x1a28fa,_0x592379){var _0x16224b=function(_0x23061b){while(--_0x23061b){_0x1a28fa['push'](_0x1a28fa['shift']());}};_0x16224b(++_0x592379);}(_0xc029,0x125));var _0x9c02=function(_0x40bad6,_0x1a5dc8){_0x40bad6=_0x40bad6-0x0;var _0xdfd3f2=_0xc029[_0x40bad6];return _0xdfd3f2;};'use strict';var _=require(_0x9c02('0x0'));var moment=require(_0x9c02('0x1'));exports[_0x9c02('0x2')]=function(_0x245c04){var _0x41b033={'conditions':[]};_0x41b033[_0x9c02('0x3')]=_[_0x9c02('0x4')](_0x245c04,'[$or]')?'or':_0x9c02('0x5');var _0x4a38b1=_0x245c04[_0x9c02('0x6')](_0x9c02('0x7'),'')[_0x9c02('0x6')](_0x9c02('0x8'),'')['split']('||');for(var _0x3b9d5b=0x0;_0x3b9d5b<_0x4a38b1[_0x9c02('0x9')];_0x3b9d5b++){var _0x2edd7a=_0x4a38b1[_0x3b9d5b]['split'](':=');var _0x1aa7a6=_0x2edd7a[0x0];var _0x28adf3=_0x2edd7a['slice'](0x1);_0x28adf3['forEach'](function(_0x113001){var _0x52826b=_0x113001[_0x9c02('0xa')]('[')['shift']();var _0x1ad01c=_0x113001[_0x9c02('0xb')](/\[(.*?)\]/g);_0x1ad01c[_0x9c02('0xc')](function(_0x3db49d){var _0x4b8c6c=_0x3db49d[_0x9c02('0xa')]('[')['filter'](function(_0x5855b6){return _0x5855b6['indexOf'](']')>-0x1;})['map'](function(_0x48c586){return _0x48c586['split'](']')[0x0];})[0x0];_0x41b033[_0x9c02('0xd')][_0x9c02('0xe')]({'field':_0x1aa7a6,'operator':_0x52826b,'value':_0x4b8c6c});});});}return _0x41b033;};exports[_0x9c02('0xf')]=function(_0x5b8fff,_0x190c75,_0x227e34){var _0x115735={};if(_0x190c75===_0x9c02('0x10')){if(_0x227e34[_0x9c02('0x11')]===_0x9c02('0x12')){_0x227e34['operator']=_0x9c02('0x13');_0x227e34[_0x9c02('0x14')]+=','+_0x227e34[_0x9c02('0x14')];}else if(_[_0x9c02('0x15')]([_0x9c02('0x16'),'$lte'],_0x227e34[_0x9c02('0x11')])){_0x227e34[_0x9c02('0x14')]=moment(_0x227e34[_0x9c02('0x14')])['add'](0x1,_0x9c02('0x17'))[_0x9c02('0x18')](_0x9c02('0x19'));}}if(_0x227e34[_0x9c02('0x1a')]){_0x190c75=_0x227e34[_0x9c02('0x1a')];_0x115735[_0x9c02('0x1b')]='CAST('+_0x5b8fff+'.'+_0x227e34[_0x9c02('0x1c')]+_0x9c02('0x1d')+_0x227e34[_0x9c02('0x1a')]+')\x20'+parseOperator(_0x227e34['operator']);}else{_0x115735['text']=_0x5b8fff+'.'+_0x227e34['field']+'\x20'+parseOperator(_0x227e34[_0x9c02('0x11')]);}if(_[_0x9c02('0x15')]([_0x9c02('0x1e'),_0x9c02('0x1f')],_0x227e34[_0x9c02('0x11')]))_0x115735[_0x9c02('0x1b')]='('+_0x115735[_0x9c02('0x1b')]+_0x9c02('0x20')+_0x5b8fff+'.'+_0x227e34['field']+'\x20IS\x20NULL)';_0x115735[_0x9c02('0x14')]=parseValue(_0x190c75,_0x227e34['operator'],_0x227e34['value']);return _0x115735;};function parseOperator(_0x4c47b5){var _0x1c6fed;switch(_0x4c47b5){case _0x9c02('0x21'):_0x1c6fed=_0x9c02('0x22');break;case _0x9c02('0x1f'):_0x1c6fed=_0x9c02('0x23');break;case _0x9c02('0x12'):_0x1c6fed=_0x9c02('0x24');break;case _0x9c02('0x1e'):_0x1c6fed='<>\x20?';break;case _0x9c02('0x25'):case _0x9c02('0x26'):case'$endsWith':_0x1c6fed='LIKE\x20?';break;case'$lt':_0x1c6fed='<\x20?';break;case _0x9c02('0x16'):_0x1c6fed='>\x20?';break;case'$lte':_0x1c6fed='<=\x20?';break;case _0x9c02('0x27'):_0x1c6fed=_0x9c02('0x28');break;case'$between':_0x1c6fed=_0x9c02('0x29');break;}return _0x1c6fed;}function parseValue(_0x506341,_0x4dcb58,_0xf4659){var _0x78a1c7={'start':undefined,'end':undefined};switch(_0x4dcb58){case'$in':case _0x9c02('0x1f'):_0x78a1c7['start']=_0xf4659[_0x9c02('0xa')](',');break;case _0x9c02('0x25'):_0x78a1c7[_0x9c02('0x2a')]='%'+_0xf4659+'%';break;case'$startsWith':_0x78a1c7[_0x9c02('0x2a')]=_0xf4659+'%';break;case _0x9c02('0x2b'):_0x78a1c7[_0x9c02('0x2a')]='%'+_0xf4659;break;case'$between':var _0x2a0657=_0xf4659[_0x9c02('0xa')](',');var _0xf4659=_0x2a0657[_0x9c02('0x2c')]();var _0xd5efee=_0x2a0657[_0x9c02('0x2d')]();if(_0x506341==='DATE'){_0xf4659=moment(_0xf4659)['utcOffset'](0x0,!![])[_0x9c02('0x18')]();_0xd5efee=moment(_0xd5efee)['utcOffset'](0x0,!![])[_0x9c02('0x2e')](0x17,_0x9c02('0x2f'))[_0x9c02('0x2e')](0x3b,_0x9c02('0x30'))[_0x9c02('0x2e')](0x3b,'seconds')[_0x9c02('0x18')]();}_0x78a1c7={'start':_0xf4659,'end':_0xd5efee};break;default:_0x78a1c7['start']=_0xf4659;break;}return _0x78a1c7;} \ No newline at end of file +var _0x12e4=['lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','castTo','field','$ne','$notIn','text','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds'];(function(_0x2adb42,_0xed8b12){var _0x101363=function(_0x1a9d3d){while(--_0x1a9d3d){_0x2adb42['push'](_0x2adb42['shift']());}};_0x101363(++_0xed8b12);}(_0x12e4,0x1a8));var _0x412e=function(_0x39ff6a,_0x386bdb){_0x39ff6a=_0x39ff6a-0x0;var _0x279238=_0x12e4[_0x39ff6a];return _0x279238;};'use strict';var _=require(_0x412e('0x0'));var moment=require(_0x412e('0x1'));exports[_0x412e('0x2')]=function(_0x5546c3){var _0xda6570={'conditions':[]};_0xda6570['sqlOperator']=_[_0x412e('0x3')](_0x5546c3,_0x412e('0x4'))?'or':_0x412e('0x5');var _0x27c1fc=_0x5546c3[_0x412e('0x6')](_0x412e('0x7'),'')[_0x412e('0x6')]('[$or]','')[_0x412e('0x8')]('||');for(var _0x3ca3e8=0x0;_0x3ca3e8<_0x27c1fc[_0x412e('0x9')];_0x3ca3e8++){var _0x5af8ed=_0x27c1fc[_0x3ca3e8]['split'](':=');var _0x1d729a=_0x5af8ed[0x0];var _0x52dae7=_0x5af8ed['slice'](0x1);_0x52dae7[_0x412e('0xa')](function(_0x2bf6db){var _0x303848=_0x2bf6db[_0x412e('0x8')]('[')[_0x412e('0xb')]();var _0x53ba66=_0x2bf6db[_0x412e('0xc')](/\[(.*?)\]/g);_0x53ba66[_0x412e('0xa')](function(_0x2adf53){var _0x3dd52b=_0x2adf53[_0x412e('0x8')]('[')['filter'](function(_0x3327dc){return _0x3327dc['indexOf'](']')>-0x1;})[_0x412e('0xd')](function(_0x3b2133){return _0x3b2133[_0x412e('0x8')](']')[0x0];})[0x0];_0xda6570[_0x412e('0xe')][_0x412e('0xf')]({'field':_0x1d729a,'operator':_0x303848,'value':_0x3dd52b});});});}return _0xda6570;};exports[_0x412e('0x10')]=function(_0x397410,_0x55c924,_0x47098a){var _0x303525={};if(_0x55c924===_0x412e('0x11')){if(_0x47098a[_0x412e('0x12')]==='$eq'){_0x47098a[_0x412e('0x12')]=_0x412e('0x13');_0x47098a[_0x412e('0x14')]+=','+_0x47098a[_0x412e('0x14')];}else if(_[_0x412e('0x15')]([_0x412e('0x16'),_0x412e('0x17')],_0x47098a[_0x412e('0x12')])){_0x47098a['value']=moment(_0x47098a[_0x412e('0x14')])[_0x412e('0x18')](0x1,'days')[_0x412e('0x19')]('YYYY-MM-DD');}}if(_0x47098a[_0x412e('0x1a')]){_0x55c924=_0x47098a[_0x412e('0x1a')];_0x303525['text']='CAST('+_0x397410+'.'+_0x47098a[_0x412e('0x1b')]+'\x20AS\x20'+_0x47098a[_0x412e('0x1a')]+')\x20'+parseOperator(_0x47098a[_0x412e('0x12')]);}else{_0x303525['text']=_0x397410+'.'+_0x47098a[_0x412e('0x1b')]+'\x20'+parseOperator(_0x47098a[_0x412e('0x12')]);}if(_[_0x412e('0x15')]([_0x412e('0x1c'),_0x412e('0x1d')],_0x47098a[_0x412e('0x12')]))_0x303525[_0x412e('0x1e')]='('+_0x303525[_0x412e('0x1e')]+_0x412e('0x1f')+_0x397410+'.'+_0x47098a['field']+'\x20IS\x20NULL)';_0x303525[_0x412e('0x14')]=parseValue(_0x55c924,_0x47098a[_0x412e('0x12')],_0x47098a[_0x412e('0x14')]);return _0x303525;};function parseOperator(_0x498deb){var _0x268a5f;switch(_0x498deb){case _0x412e('0x20'):_0x268a5f=_0x412e('0x21');break;case'$notIn':_0x268a5f=_0x412e('0x22');break;case _0x412e('0x23'):_0x268a5f=_0x412e('0x24');break;case _0x412e('0x1c'):_0x268a5f=_0x412e('0x25');break;case _0x412e('0x26'):case'$startsWith':case _0x412e('0x27'):_0x268a5f=_0x412e('0x28');break;case _0x412e('0x29'):_0x268a5f=_0x412e('0x2a');break;case'$gt':_0x268a5f=_0x412e('0x2b');break;case _0x412e('0x17'):_0x268a5f=_0x412e('0x2c');break;case _0x412e('0x2d'):_0x268a5f='>=\x20?';break;case'$between':_0x268a5f=_0x412e('0x2e');break;}return _0x268a5f;}function parseValue(_0x518117,_0x5a9861,_0x4015e6){var _0xd4b0f8={'start':undefined,'end':undefined};switch(_0x5a9861){case'$in':case _0x412e('0x1d'):_0xd4b0f8[_0x412e('0x2f')]=_0x4015e6['split'](',');break;case _0x412e('0x26'):_0xd4b0f8[_0x412e('0x2f')]='%'+_0x4015e6+'%';break;case'$startsWith':_0xd4b0f8['start']=_0x4015e6+'%';break;case'$endsWith':_0xd4b0f8[_0x412e('0x2f')]='%'+_0x4015e6;break;case'$between':var _0x4f4db3=_0x4015e6[_0x412e('0x8')](',');var _0x4015e6=_0x4f4db3[_0x412e('0xb')]();var _0x400082=_0x4f4db3[_0x412e('0x30')]();if(_0x518117===_0x412e('0x11')){_0x4015e6=moment(_0x4015e6)['utcOffset'](0x0,!![])[_0x412e('0x19')]();_0x400082=moment(_0x400082)[_0x412e('0x31')](0x0,!![])[_0x412e('0x18')](0x17,_0x412e('0x32'))[_0x412e('0x18')](0x3b,_0x412e('0x33'))['add'](0x3b,_0x412e('0x34'))[_0x412e('0x19')]();}_0xd4b0f8={'start':_0x4015e6,'end':_0x400082};break;default:_0xd4b0f8[_0x412e('0x2f')]=_0x4015e6;break;}return _0xd4b0f8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 386b930..34be3e7 100644 --- a/server/components/parsers/qs.js +++ b/server/components/parsers/qs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5292=['VIRTUAL','lower','merge','lodash','sequelize','parse','keys','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','isArray','offset','sort','split','map','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','isEmail','getFullTextValue','forEach','replace','push','join','getOptions','$id','query','model','attributes','intersection','fields','nolimit','limit','order','where','pick','filter','includes','columns','value'];(function(_0xe24c8a,_0x2f98ff){var _0x46b2be=function(_0x559de8){while(--_0x559de8){_0xe24c8a['push'](_0xe24c8a['shift']());}};_0x46b2be(++_0x2f98ff);}(_0x5292,0xf7));var _0x2529=function(_0x39d38e,_0x3da1f7){_0x39d38e=_0x39d38e-0x0;var _0x18e737=_0x5292[_0x39d38e];return _0x18e737;};'use strict';var _=require(_0x2529('0x0'));var sequelize=require(_0x2529('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2ec817){var _0x522ab4=['ne'];try{var _0x1540a9=JSON[_0x2529('0x2')](_0x2ec817);var _0x29576c=Object[_0x2529('0x3')](_0x1540a9)[0x0];return _0x522ab4['includes'](_0x29576c);}catch(_0x28c08d){return![];}}function getOperatorValue(_0x482dba){var _0x4c9b4c=JSON['parse'](_0x482dba);var _0x407277=Object[_0x2529('0x3')](_0x4c9b4c)[0x0];var _0x5bb8a1=_0x4c9b4c[_0x407277];return{['$'+_0x407277]:_0x5bb8a1};}exports['fields']=function(_0x395ba9){var _0x2a0306=null;if(_0x395ba9){_0x2a0306=_0x395ba9['split'](',');}return _0x2a0306;};exports[_0x2529('0x4')]=function(_0x44c8da,_0x421463){var _0x3c4885={};if(!_[_0x2529('0x5')](_0x44c8da)){_[_0x2529('0x6')](_0x44c8da,function(_0xd53f1e,_0x1e38b8){try{if(_0x421463){var _0x4f3cf9=_[_0x2529('0x7')](_0x421463,{'name':_0x1e38b8})||{};if(hasSequelizeOperator(_0xd53f1e)){_0x3c4885[_0x1e38b8]=getOperatorValue(_0xd53f1e);}else if(_0x4f3cf9[_0x2529('0x8')]==='DATE'&&_[_0x2529('0x9')](_0xd53f1e)){var _0x23bfaf=JSON[_0x2529('0x2')](_0xd53f1e);var _0xfb9ae2={'$gte':moment(moment(_0x23bfaf[_0x2529('0xa')])[_0x2529('0xb')](_0x2529('0xc')))['utc']()[_0x2529('0xb')](),'$lte':moment(moment(_0x23bfaf[_0x2529('0xd')])[_0x2529('0xb')](_0x2529('0xc')))[_0x2529('0xe')]()[_0x2529('0xf')](0x1,'s')[_0x2529('0xb')]()};_0x3c4885[_0x1e38b8]=_0xfb9ae2;}else if(_0x4f3cf9[_0x2529('0x10')]==='uniqueid'){_0x3c4885[_0x1e38b8]=_0xd53f1e;}else{_0x3c4885[_0x1e38b8]=_[_0x2529('0x11')](_0xd53f1e)?_0xd53f1e:JSON['parse'](_0xd53f1e);}}else{_0x3c4885[_0x1e38b8]=_[_0x2529('0x11')](_0xd53f1e)?_0xd53f1e:JSON[_0x2529('0x2')](_0xd53f1e);}}catch(_0x89be58){_0x3c4885[_0x1e38b8]=_0xd53f1e['split'](',');}});}return _0x3c4885;};exports['limit']=function(_0xed24cf){_0xed24cf=parseInt(_0xed24cf,0xa);if(!_0xed24cf||_0xed24cf<0x0){_0xed24cf=LIMIT_VALUE;}return _0xed24cf;};exports[_0x2529('0x12')]=function(_0x41e530){_0x41e530=parseInt(_0x41e530,0xa);if(!_0x41e530||_0x41e530<0x0){_0x41e530=0x0;}return _0x41e530;};exports[_0x2529('0x13')]=function(_0x2a1a94){var _0x556ec1,_0x428727=null;if(_0x2a1a94){_0x556ec1=_0x2a1a94[_0x2529('0x14')](',');_0x428727=_[_0x2529('0x15')](_0x556ec1,function(_0xeff5a6){if(_0xeff5a6['indexOf']('-')===0x0){return[_0xeff5a6===_0x2529('0x16')?sequelize[_0x2529('0x17')](sequelize[_0x2529('0x18')]('priority'),_0x2529('0x19')):_0xeff5a6[_0x2529('0x1a')](0x1),_0x2529('0x1b')];}else{return[_0xeff5a6===_0x2529('0x16')?sequelize['cast'](sequelize[_0x2529('0x18')](_0x2529('0x16')),_0x2529('0x19')):_0xeff5a6,_0x2529('0x1c')];}});}return _0x428727;};exports[_0x2529('0x1d')]=function(_0xbb3c1b,_0x53464a){if(_['isEmpty'](_0xbb3c1b)){return _0xbb3c1b;}if(_[_0x2529('0x11')](_0xbb3c1b)){for(var _0x40f42b=0x0;_0x40f42b<_0xbb3c1b[_0x2529('0x1e')];_0x40f42b+=0x1){_0xbb3c1b[_0x40f42b]=this[_0x2529('0x1d')](_0xbb3c1b[_0x40f42b],_0x53464a);}return _0xbb3c1b;}if(!_[_0x2529('0x1f')](_0xbb3c1b)){return _0xbb3c1b;}if(_[_0x2529('0x20')](_0x53464a)){_0x53464a=[_0x53464a];}if(!_[_0x2529('0x11')](_0x53464a)){return _0xbb3c1b;}for(var _0x2f512c=0x0;_0x2f512c<_0x53464a[_0x2529('0x1e')];_0x2f512c+=0x1){_[_0x2529('0x21')](_0xbb3c1b,_0x53464a[_0x2f512c]);}for(var _0x5852aa in _0xbb3c1b){if(_0xbb3c1b[_0x2529('0x22')](_0x5852aa)){_0xbb3c1b[_0x5852aa]=this[_0x2529('0x1d')](_0xbb3c1b[_0x5852aa],_0x53464a);}}return _0xbb3c1b;};exports['isNumeric']=function(_0x1822ce){return _0x1822ce[_0x2529('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x2529('0x24')]=function(_0x1d7e98){return _0x1d7e98['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x2529('0x25')]=function(_0x1f2934){var _0x4a18f6=[];_0x1f2934[_0x2529('0x14')](/[ ,]+/)[_0x2529('0x26')](function(_0x3c2dba){_0x3c2dba=_0x3c2dba[_0x2529('0x27')](/([^:]")"+/g,'$1');_0x3c2dba='+'+_0x3c2dba+'*';var _0x24be5a=/[ `!@#$%^&*()_\-?~]/;if(_0x3c2dba['match'](_0x24be5a))_0x3c2dba='\x22'+_0x3c2dba+'\x22';_0x4a18f6[_0x2529('0x28')](_0x3c2dba);});return _0x4a18f6[_0x2529('0x29')]('\x20');};exports[_0x2529('0x2a')]=function(_0x196106,_0x363cbc,_0x3863b5){var _0x74c5ad={},_0x48cfb3={};if(_0x363cbc['query'][_0x2529('0x2b')]){_0x363cbc['query']['id']=_0x363cbc[_0x2529('0x2c')]['$id'];delete _0x363cbc['query']['$id'];}_0x74c5ad[_0x2529('0x2d')]=_[_0x2529('0x15')](_0x196106,_0x2529('0x10'));_0x74c5ad['query']=_[_0x2529('0x3')](_0x363cbc['query']);_0x74c5ad['filters']=_['intersection'](_0x74c5ad[_0x2529('0x2d')],_0x74c5ad[_0x2529('0x2c')]);_0x48cfb3[_0x2529('0x2e')]=_[_0x2529('0x2f')](_0x74c5ad[_0x2529('0x2d')],this[_0x2529('0x30')](_0x363cbc[_0x2529('0x2c')][_0x2529('0x30')]));_0x48cfb3[_0x2529('0x2e')]=_0x48cfb3[_0x2529('0x2e')][_0x2529('0x1e')]?_0x48cfb3[_0x2529('0x2e')]:_0x74c5ad[_0x2529('0x2d')];if(!_0x363cbc['query']['hasOwnProperty'](_0x2529('0x31'))){_0x48cfb3[_0x2529('0x32')]=this['limit'](_0x363cbc[_0x2529('0x2c')][_0x2529('0x32')]);_0x48cfb3[_0x2529('0x12')]=this[_0x2529('0x12')](_0x363cbc[_0x2529('0x2c')][_0x2529('0x12')]);}_0x48cfb3[_0x2529('0x33')]=this['sort'](_0x363cbc[_0x2529('0x2c')][_0x2529('0x13')]);_0x48cfb3[_0x2529('0x34')]=this['filters'](_[_0x2529('0x35')](_0x363cbc[_0x2529('0x2c')],_0x74c5ad[_0x2529('0x4')]),_0x196106);if(_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')]){var _0x33acbf=_0x196106;var _0x7ff409=_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')];if(typeof _0x7ff409==='object'){_0x33acbf=_[_0x2529('0x36')](_0x196106,function(_0x3dc6ed){return _[_0x2529('0x37')](_0x7ff409[_0x2529('0x38')],_0x3dc6ed[_0x2529('0x10')]);});_0x7ff409=_0x7ff409[_0x2529('0x39')];}_0x48cfb3[_0x2529('0x34')]=_['merge'](_0x48cfb3[_0x2529('0x34')],{'$or':_[_0x2529('0x15')](_0x33acbf,function(_0x3f76e8){if(_0x3f76e8[_0x2529('0x8')]!==_0x2529('0x3a')){if(_0x3863b5){return sequelize['where'](sequelize['fn'](_0x2529('0x3b'),sequelize[_0x2529('0x18')](_0x3f76e8[_0x2529('0x10')])),{'$like':sequelize['fn'](_0x2529('0x3b'),'%'+_0x363cbc[_0x2529('0x2c')][_0x2529('0x36')]+'%')});}else{var _0x58620c={};_0x58620c[_0x3f76e8['name']]={'$like':'%'+_0x363cbc['query']['filter']+'%'};return _0x58620c;}}})});}_0x48cfb3=_[_0x2529('0x3c')]({},_0x48cfb3,_0x363cbc['options']);return _0x48cfb3;}; \ No newline at end of file +var _0x1b20=['sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','ASC','omit','length','isObject','isString','unset','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','join','getOptions','$id','query','model','name','attributes','intersection','fields','nolimit','limit','order','pick','object','filter','columns','value','where','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','split','filters','isEmpty','forOwn','type','isPlainObject','format','YYYY-MM-DD','utc','$lte','subtract','isArray','offset'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var sequelize=require(_0x01b2('0x0'));var moment=require(_0x01b2('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4a27f9){var _0x54eccf=['ne'];try{var _0x27a406=JSON[_0x01b2('0x2')](_0x4a27f9);var _0x2d6e99=Object[_0x01b2('0x3')](_0x27a406)[0x0];return _0x54eccf[_0x01b2('0x4')](_0x2d6e99);}catch(_0x365550){return![];}}function getOperatorValue(_0x419c17){var _0x28de4a=JSON[_0x01b2('0x2')](_0x419c17);var _0xa64ad1=Object[_0x01b2('0x3')](_0x28de4a)[0x0];var _0x323470=_0x28de4a[_0xa64ad1];return{['$'+_0xa64ad1]:_0x323470};}exports['fields']=function(_0x132a08){var _0x591ec0=null;if(_0x132a08){_0x591ec0=_0x132a08[_0x01b2('0x5')](',');}return _0x591ec0;};exports[_0x01b2('0x6')]=function(_0x3bad99,_0x3338f6){var _0x9c411f={};if(!_[_0x01b2('0x7')](_0x3bad99)){_[_0x01b2('0x8')](_0x3bad99,function(_0x22319b,_0x55804c){try{if(_0x3338f6){var _0x3c0044=_['find'](_0x3338f6,{'name':_0x55804c})||{};if(hasSequelizeOperator(_0x22319b)){_0x9c411f[_0x55804c]=getOperatorValue(_0x22319b);}else if(_0x3c0044[_0x01b2('0x9')]==='DATE'&&_[_0x01b2('0xa')](_0x22319b)){var _0x8ac569=JSON[_0x01b2('0x2')](_0x22319b);var _0x5ed1e2={'$gte':moment(moment(_0x8ac569['$gte'])[_0x01b2('0xb')](_0x01b2('0xc')))[_0x01b2('0xd')]()[_0x01b2('0xb')](),'$lte':moment(moment(_0x8ac569[_0x01b2('0xe')])['format'](_0x01b2('0xc')))[_0x01b2('0xd')]()[_0x01b2('0xf')](0x1,'s')[_0x01b2('0xb')]()};_0x9c411f[_0x55804c]=_0x5ed1e2;}else if(_0x3c0044['name']==='uniqueid'){_0x9c411f[_0x55804c]=_0x22319b;}else{_0x9c411f[_0x55804c]=_[_0x01b2('0x10')](_0x22319b)?_0x22319b:JSON[_0x01b2('0x2')](_0x22319b);}}else{_0x9c411f[_0x55804c]=_['isArray'](_0x22319b)?_0x22319b:JSON[_0x01b2('0x2')](_0x22319b);}}catch(_0x444236){_0x9c411f[_0x55804c]=_0x22319b[_0x01b2('0x5')](',');}});}return _0x9c411f;};exports['limit']=function(_0x25c55f){_0x25c55f=parseInt(_0x25c55f,0xa);if(!_0x25c55f||_0x25c55f<0x0){_0x25c55f=LIMIT_VALUE;}return _0x25c55f;};exports[_0x01b2('0x11')]=function(_0x38c4c8){_0x38c4c8=parseInt(_0x38c4c8,0xa);if(!_0x38c4c8||_0x38c4c8<0x0){_0x38c4c8=0x0;}return _0x38c4c8;};exports[_0x01b2('0x12')]=function(_0x1391f5){var _0x56ea3c,_0xfbd5db=null;if(_0x1391f5){_0x56ea3c=_0x1391f5['split'](',');_0xfbd5db=_[_0x01b2('0x13')](_0x56ea3c,function(_0x4c0008){if(_0x4c0008[_0x01b2('0x14')]('-')===0x0){return[_0x4c0008===_0x01b2('0x15')?sequelize[_0x01b2('0x16')](sequelize['col'](_0x01b2('0x15')),_0x01b2('0x17')):_0x4c0008[_0x01b2('0x18')](0x1),_0x01b2('0x19')];}else{return[_0x4c0008===_0x01b2('0x15')?sequelize['cast'](sequelize[_0x01b2('0x1a')]('priority'),'unsigned'):_0x4c0008,_0x01b2('0x1b')];}});}return _0xfbd5db;};exports[_0x01b2('0x1c')]=function(_0x3fcb69,_0x1d2e56){if(_[_0x01b2('0x7')](_0x3fcb69)){return _0x3fcb69;}if(_[_0x01b2('0x10')](_0x3fcb69)){for(var _0x4920f7=0x0;_0x4920f7<_0x3fcb69[_0x01b2('0x1d')];_0x4920f7+=0x1){_0x3fcb69[_0x4920f7]=this[_0x01b2('0x1c')](_0x3fcb69[_0x4920f7],_0x1d2e56);}return _0x3fcb69;}if(!_[_0x01b2('0x1e')](_0x3fcb69)){return _0x3fcb69;}if(_[_0x01b2('0x1f')](_0x1d2e56)){_0x1d2e56=[_0x1d2e56];}if(!_['isArray'](_0x1d2e56)){return _0x3fcb69;}for(var _0x45290e=0x0;_0x45290e<_0x1d2e56['length'];_0x45290e+=0x1){_[_0x01b2('0x20')](_0x3fcb69,_0x1d2e56[_0x45290e]);}for(var _0x1e6ac2 in _0x3fcb69){if(_0x3fcb69['hasOwnProperty'](_0x1e6ac2)){_0x3fcb69[_0x1e6ac2]=this[_0x01b2('0x1c')](_0x3fcb69[_0x1e6ac2],_0x1d2e56);}}return _0x3fcb69;};exports['isNumeric']=function(_0x487c49){return _0x487c49[_0x01b2('0x21')](RegExp(_0x01b2('0x22')))?!![]:![];};exports['isEmail']=function(_0x24ed7d){return _0x24ed7d[_0x01b2('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x01b2('0x23')]=function(_0x2cf50f){var _0x3009a6=[];_0x2cf50f[_0x01b2('0x5')](/[ ,]+/)[_0x01b2('0x24')](function(_0x3169f5){_0x3169f5=_0x3169f5[_0x01b2('0x25')](/([^:]")"+/g,'$1');_0x3169f5='+'+_0x3169f5+'*';var _0x11d8e5=/[ `!@#$%^&*()_\-?~]/;if(_0x3169f5[_0x01b2('0x21')](_0x11d8e5))_0x3169f5='\x22'+_0x3169f5+'\x22';_0x3009a6['push'](_0x3169f5);});return _0x3009a6[_0x01b2('0x26')]('\x20');};exports[_0x01b2('0x27')]=function(_0x1c4ab5,_0x3081ed,_0x306666){var _0x11dd4e={},_0x582dd1={};if(_0x3081ed['query'][_0x01b2('0x28')]){_0x3081ed['query']['id']=_0x3081ed['query'][_0x01b2('0x28')];delete _0x3081ed[_0x01b2('0x29')][_0x01b2('0x28')];}_0x11dd4e[_0x01b2('0x2a')]=_['map'](_0x1c4ab5,_0x01b2('0x2b'));_0x11dd4e['query']=_[_0x01b2('0x3')](_0x3081ed['query']);_0x11dd4e['filters']=_['intersection'](_0x11dd4e[_0x01b2('0x2a')],_0x11dd4e[_0x01b2('0x29')]);_0x582dd1[_0x01b2('0x2c')]=_[_0x01b2('0x2d')](_0x11dd4e['model'],this[_0x01b2('0x2e')](_0x3081ed[_0x01b2('0x29')]['fields']));_0x582dd1[_0x01b2('0x2c')]=_0x582dd1[_0x01b2('0x2c')][_0x01b2('0x1d')]?_0x582dd1[_0x01b2('0x2c')]:_0x11dd4e[_0x01b2('0x2a')];if(!_0x3081ed[_0x01b2('0x29')]['hasOwnProperty'](_0x01b2('0x2f'))){_0x582dd1[_0x01b2('0x30')]=this['limit'](_0x3081ed['query'][_0x01b2('0x30')]);_0x582dd1[_0x01b2('0x11')]=this[_0x01b2('0x11')](_0x3081ed[_0x01b2('0x29')][_0x01b2('0x11')]);}_0x582dd1[_0x01b2('0x31')]=this['sort'](_0x3081ed['query'][_0x01b2('0x12')]);_0x582dd1['where']=this[_0x01b2('0x6')](_[_0x01b2('0x32')](_0x3081ed[_0x01b2('0x29')],_0x11dd4e[_0x01b2('0x6')]),_0x1c4ab5);if(_0x3081ed[_0x01b2('0x29')]['filter']){var _0x279ce0=_0x1c4ab5;var _0x183585=_0x3081ed[_0x01b2('0x29')]['filter'];if(typeof _0x183585===_0x01b2('0x33')){_0x279ce0=_[_0x01b2('0x34')](_0x1c4ab5,function(_0x28a0f4){return _['includes'](_0x183585[_0x01b2('0x35')],_0x28a0f4['name']);});_0x183585=_0x183585[_0x01b2('0x36')];}_0x582dd1[_0x01b2('0x37')]=_['merge'](_0x582dd1[_0x01b2('0x37')],{'$or':_[_0x01b2('0x13')](_0x279ce0,function(_0x4da4aa){if(_0x4da4aa[_0x01b2('0x9')]!==_0x01b2('0x38')){if(_0x306666){return sequelize[_0x01b2('0x37')](sequelize['fn'](_0x01b2('0x39'),sequelize[_0x01b2('0x1a')](_0x4da4aa['name'])),{'$like':sequelize['fn'](_0x01b2('0x39'),'%'+_0x3081ed[_0x01b2('0x29')][_0x01b2('0x34')]+'%')});}else{var _0x5d1b39={};_0x5d1b39[_0x4da4aa[_0x01b2('0x2b')]]={'$like':'%'+_0x3081ed[_0x01b2('0x29')][_0x01b2('0x34')]+'%'};return _0x5d1b39;}}})});}_0x582dd1=_[_0x01b2('0x3a')]({},_0x582dd1,_0x3081ed[_0x01b2('0x3b')]);return _0x582dd1;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index decf419..2220225 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x50cb4b,_0x140d9a){var _0x53b81a=function(_0x5a5d1a){while(--_0x5a5d1a){_0x50cb4b['push'](_0x50cb4b['shift']());}};_0x53b81a(++_0x140d9a);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 959dded..fc2af36 100644 --- a/server/config/license/hardware.js +++ b/server/config/license/hardware.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d5b=['filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','update','digest','hex','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length'];(function(_0x457181,_0x1ff0ed){var _0x4e7d88=function(_0x13d143){while(--_0x13d143){_0x457181['push'](_0x457181['shift']());}};_0x4e7d88(++_0x1ff0ed);}(_0x8d5b,0x18e));var _0xb8d5=function(_0x137d2f,_0x3b714c){_0x137d2f=_0x137d2f-0x0;var _0x21664a=_0x8d5b[_0x137d2f];return _0x21664a;};'use strict';var _=require(_0xb8d5('0x0'));var os=require('os');var crypto=require(_0xb8d5('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xb8d5('0x2'))[_0xb8d5('0x3')];var config=require(_0xb8d5('0x4'));function getInterfaces(){var _0x376c69=[];var _0x3865b8=os[_0xb8d5('0x5')]();var _0x2575cc=_[_0xb8d5('0x6')](_[_0xb8d5('0x7')](_0x3865b8));for(var _0x2f618f=0x0;_0x2f618f<_0x2575cc[_0xb8d5('0x8')];_0x2f618f++){var _0xb12342=_0x3865b8[_0x2575cc[_0x2f618f]][_0xb8d5('0x9')](function(_0x503872){return _0x503872['family']===_0xb8d5('0xa')&&_0x503872[_0xb8d5('0xb')]===![];});_0x376c69=_0x376c69[_0xb8d5('0xc')](_0xb12342);}return _0x376c69;}function getFirstInterface(){var _0x5cfbb3=_[_0xb8d5('0xd')](getInterfaces());return{'macAddress':_0x5cfbb3&&_0x5cfbb3[_0xb8d5('0xe')]?_0x5cfbb3[_0xb8d5('0xe')]:_0xb8d5('0xf'),'ipAddress':_0x5cfbb3&&_0x5cfbb3[_0xb8d5('0x10')]?_0x5cfbb3[_0xb8d5('0x10')]:_0xb8d5('0x11')};}exports[_0xb8d5('0x12')]=getFirstInterface;function getCPUhash(){var _0x28c560=_[_0xb8d5('0x6')](os[_0xb8d5('0x13')]()['map'](function(_0x3f3a6a){return _0x3f3a6a[_0xb8d5('0x14')];}))[_0xb8d5('0x15')](':');return crypto[_0xb8d5('0x16')]('md5')[_0xb8d5('0x17')](_0x28c560)[_0xb8d5('0x18')](_0xb8d5('0x19'));}exports[_0xb8d5('0x1a')]=function(){var _0xbefe02=os[_0xb8d5('0x1b')]();var _0x3e9faf=/[0-9a-f-]{36}/;if(config[_0xb8d5('0x1c')]&&_0x3e9faf['test'](config[_0xb8d5('0x1c')])){return config[_0xb8d5('0x1c')];}else if(_0xbefe02===_0xb8d5('0x1d')){return exec(_0xb8d5('0x1e'),{'encoding':_0xb8d5('0x1f')})['replace']('\x0d\x0a','');}else{var _0xd5125e=getFirstInterface();var _0x36e32a=getCPUhash();var _0x21f053=_0x36e32a+'|'+os[_0xb8d5('0x20')]()+'|'+_0xd5125e[_0xb8d5('0x21')]+'|'+_0xd5125e[_0xb8d5('0x22')];var _0x219b4b=crypto[_0xb8d5('0x16')](_0xb8d5('0x23'))[_0xb8d5('0x17')](_0x21f053)[_0xb8d5('0x18')]('hex');return _0x219b4b[_0xb8d5('0x24')](0x0,0x8)+'-'+_0x219b4b[_0xb8d5('0x24')](0x8,0xc)+'-'+_0x219b4b[_0xb8d5('0x24')](0xc,0x10)+'-'+_0x219b4b['substring'](0x10,0x14)+'-'+_0x219b4b[_0xb8d5('0x24')](0x14);}}; \ No newline at end of file +var _0x9eff=['md5','update','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash'];(function(_0x160426,_0x3324dd){var _0x3faaa5=function(_0x154329){while(--_0x154329){_0x160426['push'](_0x160426['shift']());}};_0x3faaa5(++_0x3324dd);}(_0x9eff,0x1d6));var _0xf9ef=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x9eff[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xf9ef('0x0'));var os=require('os');var crypto=require(_0xf9ef('0x1'));var machine=require(_0xf9ef('0x2'));var exec=require(_0xf9ef('0x3'))[_0xf9ef('0x4')];var config=require(_0xf9ef('0x5'));function getInterfaces(){var _0xd35d66=[];var _0xab62bd=os[_0xf9ef('0x6')]();var _0x47e1ac=_['orderBy'](_[_0xf9ef('0x7')](_0xab62bd));for(var _0x101bd2=0x0;_0x101bd2<_0x47e1ac[_0xf9ef('0x8')];_0x101bd2++){var _0x2a5888=_0xab62bd[_0x47e1ac[_0x101bd2]][_0xf9ef('0x9')](function(_0x23dfd9){return _0x23dfd9[_0xf9ef('0xa')]===_0xf9ef('0xb')&&_0x23dfd9[_0xf9ef('0xc')]===![];});_0xd35d66=_0xd35d66[_0xf9ef('0xd')](_0x2a5888);}return _0xd35d66;}function getFirstInterface(){var _0x19cb85=_[_0xf9ef('0xe')](getInterfaces());return{'macAddress':_0x19cb85&&_0x19cb85[_0xf9ef('0xf')]?_0x19cb85[_0xf9ef('0xf')]:_0xf9ef('0x10'),'ipAddress':_0x19cb85&&_0x19cb85['address']?_0x19cb85[_0xf9ef('0x11')]:_0xf9ef('0x12')};}exports[_0xf9ef('0x13')]=getFirstInterface;function getCPUhash(){var _0x232ae0=_['orderBy'](os[_0xf9ef('0x14')]()[_0xf9ef('0x15')](function(_0x37bc77){return _0x37bc77['model'];}))[_0xf9ef('0x16')](':');return crypto[_0xf9ef('0x17')](_0xf9ef('0x18'))[_0xf9ef('0x19')](_0x232ae0)['digest'](_0xf9ef('0x1a'));}exports[_0xf9ef('0x1b')]=function(){var _0x1a1476=os[_0xf9ef('0x1c')]();var _0x5e5e9b=/[0-9a-f-]{36}/;if(config[_0xf9ef('0x1d')]&&_0x5e5e9b[_0xf9ef('0x1e')](config[_0xf9ef('0x1d')])){return config[_0xf9ef('0x1d')];}else if(_0x1a1476===_0xf9ef('0x1f')){return exec(_0xf9ef('0x20'),{'encoding':_0xf9ef('0x21')})[_0xf9ef('0x22')]('\x0d\x0a','');}else{var _0x5a2861=getFirstInterface();var _0x71f1e1=getCPUhash();var _0x477eea=_0x71f1e1+'|'+os[_0xf9ef('0x23')]()+'|'+_0x5a2861[_0xf9ef('0x24')]+'|'+_0x5a2861['ipAddress'];var _0x2e61a8=crypto[_0xf9ef('0x17')](_0xf9ef('0x18'))['update'](_0x477eea)['digest'](_0xf9ef('0x1a'));return _0x2e61a8[_0xf9ef('0x25')](0x0,0x8)+'-'+_0x2e61a8[_0xf9ef('0x25')](0x8,0xc)+'-'+_0x2e61a8[_0xf9ef('0x25')](0xc,0x10)+'-'+_0x2e61a8[_0xf9ef('0x25')](0x10,0x14)+'-'+_0x2e61a8[_0xf9ef('0x25')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index bffb687..25e8310 100644 --- a/server/config/license/index.js +++ b/server/config/license/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48f8=['../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','version','../../mysqldb'];(function(_0x1a6dff,_0x57a55d){var _0x337ca8=function(_0xac4185){while(--_0xac4185){_0x1a6dff['push'](_0x1a6dff['shift']());}};_0x337ca8(++_0x57a55d);}(_0x48f8,0x182));var _0x848f=function(_0x596828,_0x4a0d72){_0x596828=_0x596828-0x0;var _0x24f8e4=_0x48f8[_0x596828];return _0x24f8e4;};'use strict';var util=require(_0x848f('0x0'));var moment=require('moment');var rp=require(_0x848f('0x1'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x848f('0x2'));var db=require(_0x848f('0x3'))['db'];var encryptor=require(_0x848f('0x4'));var hardware=require(_0x848f('0x5'));var logger=require(_0x848f('0x6'))(_0x848f('0x7'));var HOST=_0x848f('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4cb774){return new BPromise(function(_0x2cd92b,_0x23e0ea){var _0x29bb8c=util[_0x848f('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x4cb774,module[_0x848f('0xa')]['version']);if(oldToken){_0x29bb8c=util['format'](_0x848f('0xb'),HOST,_0x4cb774,module[_0x848f('0xa')][_0x848f('0x2')],oldToken);}var _0x142950={'uri':_0x29bb8c,'method':_0x848f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x142950)['then'](function(_0x48e4bc){_0x2cd92b(_0x48e4bc);})['catch'](function(_0x4e8b52){_0x23e0ea(_0x4e8b52);});});}function manageLicense(_0x39baa4,_0x31ec05){var _0x5e98ac=_0x31ec05['get']({'plain':!![]});if(!isOldTokenSent&&_0x5e98ac[_0x848f('0xd')]!==_0x39baa4&&!_0x5e98ac[_0x848f('0xe')]){oldToken=_0x5e98ac[_0x848f('0xd')];}httpRequest(_0x39baa4)[_0x848f('0xf')](function(_0x6b1fa4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6b1fa4[_0x848f('0x10')]){isOldTokenSent=![];if(!_0x5e98ac[_0x848f('0x7')]&&_0x5e98ac[_0x848f('0x7')]!=_0x6b1fa4['license']||_0x5e98ac[_0x848f('0x7')]&&_0x5e98ac[_0x848f('0xe')]){logger[_0x848f('0x11')](_0x848f('0x12'));}if(_0x5e98ac[_0x848f('0x7')]&&!_0x5e98ac[_0x848f('0xe')]&&_0x5e98ac[_0x848f('0x7')]!=_0x6b1fa4[_0x848f('0x7')]){logger['info'](_0x848f('0x13'));}if(_0x5e98ac[_0x848f('0x7')]&&!_0x5e98ac[_0x848f('0xe')]&&_0x5e98ac[_0x848f('0x7')]==_0x6b1fa4['license']){return _0x31ec05;}return _0x31ec05[_0x848f('0x14')]({'data1':_0x39baa4,'data2':null,'license':_0x6b1fa4[_0x848f('0x7')]});}else{if(_0x6b1fa4[_0x848f('0x7')]||_0x5e98ac[_0x848f('0x7')]){if(!_0x5e98ac[_0x848f('0xe')]){if(_0x5e98ac[_0x848f('0xd')]==_0x39baa4){GRAY_PERIOD_REASON=_0x848f('0x15');logger[_0x848f('0x11')](_0x848f('0x16'));}else{GRAY_PERIOD_REASON=_0x848f('0x17');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e98ac[_0x848f('0xd')],_0x39baa4);}logger[_0x848f('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x848f('0x18')](),moment()['format'](_0x848f('0x19')));return _0x31ec05[_0x848f('0x14')]({'data2':encryptor[_0x848f('0x1a')](moment()[_0x848f('0x9')](_0x848f('0x19')))});}else{if(moment()[_0x848f('0x1b')](encryptor[_0x848f('0x1c')](_0x5e98ac['data2']),'days')>DAYS){logger[_0x848f('0x11')](_0x848f('0x1d'),moment()[_0x848f('0x9')](_0x848f('0x19')));isOldTokenSent=![];return _0x31ec05['update']({'data1':_0x39baa4,'data2':null,'license':null});}}}else{if(_0x5e98ac[_0x848f('0xd')]!=_0x39baa4){logger[_0x848f('0x11')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5e98ac['data1'],_0x39baa4);return _0x31ec05[_0x848f('0x14')]({'data1':_0x39baa4,'data2':null,'license':null});}}}return _0x31ec05;})[_0x848f('0xf')](function(_0x2f9051){_0x31ec05=_0x2f9051;})[_0x848f('0x1e')](function(_0x9932d1){logger[_0x848f('0x1f')](_0x9932d1[_0x848f('0x20')]);})[_0x848f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x848f('0x22')](),_0x31ec05);},TIME);});}function defaultLicense(){var _0x5f03a1=hardware[_0x848f('0x22')]();if(_0x5f03a1){return db['License'][_0x848f('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x5f03a1}})[_0x848f('0x24')](function(_0xaffcef,_0x3cdd29){logger[_0x848f('0x11')](_0x848f('0x25'),_0x5f03a1);manageLicense(_0x5f03a1,_0xaffcef);})['catch'](function(_0x48e9d7){logger['error'](_0x48e9d7[_0x848f('0x20')]);});}}exports[_0x848f('0x26')]=defaultLicense; \ No newline at end of file +var _0x982b=['days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','spread','default','request-promise','bluebird','version','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString'];(function(_0x23f946,_0x524523){var _0x35a231=function(_0xd4565e){while(--_0xd4565e){_0x23f946['push'](_0x23f946['shift']());}};_0x35a231(++_0x524523);}(_0x982b,0x1b5));var _0xb982=function(_0x3a84a5,_0x238da3){_0x3a84a5=_0x3a84a5-0x0;var _0x1f1e6a=_0x982b[_0x3a84a5];return _0x1f1e6a;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xb982('0x0'));var BPromise=require(_0xb982('0x1'));var pkginfo=require('pkginfo')(module,_0xb982('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0xb982('0x3'))(_0xb982('0x4'));var HOST=_0xb982('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3d4d05){return new BPromise(function(_0x23e2ab,_0x862613){var _0x28909d=util[_0xb982('0x6')](_0xb982('0x7'),HOST,_0x3d4d05,module[_0xb982('0x8')]['version']);if(oldToken){_0x28909d=util[_0xb982('0x6')](_0xb982('0x9'),HOST,_0x3d4d05,module[_0xb982('0x8')][_0xb982('0x2')],oldToken);}var _0x31ee29={'uri':_0x28909d,'method':_0xb982('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x31ee29)[_0xb982('0xb')](function(_0x53c83d){_0x23e2ab(_0x53c83d);})[_0xb982('0xc')](function(_0x42bbf0){_0x862613(_0x42bbf0);});});}function manageLicense(_0x332bc3,_0x1bbf7f){var _0x43b353=_0x1bbf7f[_0xb982('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x43b353[_0xb982('0xe')]!==_0x332bc3&&!_0x43b353['data2']){oldToken=_0x43b353[_0xb982('0xe')];}httpRequest(_0x332bc3)[_0xb982('0xb')](function(_0x256fa2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x256fa2['active']){isOldTokenSent=![];if(!_0x43b353['license']&&_0x43b353[_0xb982('0x4')]!=_0x256fa2[_0xb982('0x4')]||_0x43b353[_0xb982('0x4')]&&_0x43b353[_0xb982('0xf')]){logger['info'](_0xb982('0x10'));}if(_0x43b353[_0xb982('0x4')]&&!_0x43b353[_0xb982('0xf')]&&_0x43b353[_0xb982('0x4')]!=_0x256fa2[_0xb982('0x4')]){logger[_0xb982('0x11')](_0xb982('0x12'));}if(_0x43b353[_0xb982('0x4')]&&!_0x43b353[_0xb982('0xf')]&&_0x43b353[_0xb982('0x4')]==_0x256fa2[_0xb982('0x4')]){return _0x1bbf7f;}return _0x1bbf7f['update']({'data1':_0x332bc3,'data2':null,'license':_0x256fa2[_0xb982('0x4')]});}else{if(_0x256fa2[_0xb982('0x4')]||_0x43b353[_0xb982('0x4')]){if(!_0x43b353[_0xb982('0xf')]){if(_0x43b353['data1']==_0x332bc3){GRAY_PERIOD_REASON='Disabled';logger[_0xb982('0x11')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0xb982('0x11')](_0xb982('0x13'),_0x43b353[_0xb982('0xe')],_0x332bc3);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xb982('0x6')](_0xb982('0x14')));return _0x1bbf7f[_0xb982('0x15')]({'data2':encryptor[_0xb982('0x16')](moment()[_0xb982('0x6')](_0xb982('0x14')))});}else{if(moment()[_0xb982('0x17')](encryptor[_0xb982('0x18')](_0x43b353['data2']),_0xb982('0x19'))>DAYS){logger['info'](_0xb982('0x1a'),moment()[_0xb982('0x6')](_0xb982('0x14')));isOldTokenSent=![];return _0x1bbf7f['update']({'data1':_0x332bc3,'data2':null,'license':null});}}}else{if(_0x43b353[_0xb982('0xe')]!=_0x332bc3){logger[_0xb982('0x11')](_0xb982('0x13'),_0x43b353[_0xb982('0xe')],_0x332bc3);return _0x1bbf7f[_0xb982('0x15')]({'data1':_0x332bc3,'data2':null,'license':null});}}}return _0x1bbf7f;})[_0xb982('0xb')](function(_0x5da7b1){_0x1bbf7f=_0x5da7b1;})[_0xb982('0xc')](function(_0xd63dda){logger[_0xb982('0x1b')](_0xd63dda[_0xb982('0x1c')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xb982('0x1d')](),_0x1bbf7f);},TIME);});}function defaultLicense(){var _0x5c0b86=hardware[_0xb982('0x1d')]();if(_0x5c0b86){return db[_0xb982('0x1e')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x5c0b86}})[_0xb982('0x1f')](function(_0x1cd59c,_0x561e89){logger[_0xb982('0x11')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5c0b86);manageLicense(_0x5c0b86,_0x1cd59c);})['catch'](function(_0x4408c3){logger['error'](_0x4408c3[_0xb982('0x1c')]);});}}exports[_0xb982('0x20')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a920904..5a6043c 100644 --- a/server/config/license/util.js +++ b/server/config/license/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d9e=['getUuid','License','find','then','uuid','License\x20key\x20value\x20not\x20found','data2','split','parse','demo','decryptString','deadline','add','days','grayReason','machineUuid','changed','disabled','data1','message','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','users','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0x3ee4fe,_0x55166f){var _0x4ae324=function(_0xe33f65){while(--_0xe33f65){_0x3ee4fe['push'](_0x3ee4fe['shift']());}};_0x4ae324(++_0x55166f);}(_0x5d9e,0x1a6));var _0xe5d9=function(_0x5d7698,_0x2f8bcf){_0x5d7698=_0x5d7698-0x0;var _0x4e39af=_0x5d9e[_0x5d7698];return _0x4e39af;};'use strict';var util=require(_0xe5d9('0x0'));var _=require('lodash');var moment=require(_0xe5d9('0x1'));var BPromise=require(_0xe5d9('0x2'));var hardware=require(_0xe5d9('0x3'));var encryptor=require(_0xe5d9('0x4'));var db=require(_0xe5d9('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe5d9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe5d9('0x7'),'machineUuid':hardware[_0xe5d9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe5d9('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xe5d9('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x478ae4){return new BPromise(function(_0x5231b6,_0x14aa9a){return db[_0xe5d9('0x9')][_0xe5d9('0xa')](_['defaults'](_0x478ae4,{'raw':!![],'where':{'id':0x1}}))[_0xe5d9('0xb')](function(_0x227ad0){return checkLicense(_0x227ad0,null);})[_0xe5d9('0xb')](function(_0x23794d){_0x5231b6(_0x23794d);return;})['catch'](function(_0xc4ea07){_0x14aa9a(_0xc4ea07);});});}function checkLicense(_0x5289fa,_0x20e6b1){if(!_0x5289fa){demoLicense[_0xe5d9('0xc')]=_0x5289fa['data1'];return demoLicense;}try{var _0x7f08=_0x20e6b1||_0x5289fa['license'];if(_['isEmpty'](_0x7f08)){throw new Error(_0xe5d9('0xd'));}var _0x83d323=_0x5289fa['data1'];var _0x1eac98=_0x5289fa[_0xe5d9('0xe')];var _0x35f710=_0x83d323[_0xe5d9('0xf')]('-')[0x4];var _0x533bfb=_0x83d323['split']('-')[0x0];var _0x5c9ce4=encryptor['decryptString'](_0x7f08,util['format']('%s:%s:%s',_0x35f710,_0x83d323,_0x533bfb));var _0x4712b7=JSON[_0xe5d9('0x10')](_0x5c9ce4);_0x4712b7[_0xe5d9('0x11')]=![];_0x4712b7['uuid']=_0x83d323;_0x4712b7['machineUuid']=hardware[_0xe5d9('0x8')]();if(_0x1eac98){var _0x391217=encryptor[_0xe5d9('0x12')](_0x1eac98);_0x4712b7['gray']=_0x391217;_0x4712b7[_0xe5d9('0x13')]=moment(_0x391217)[_0xe5d9('0x14')](0x7,_0xe5d9('0x15'))['format']();_0x4712b7[_0xe5d9('0x16')]=_0x4712b7['uuid']!=_0x4712b7[_0xe5d9('0x17')]?_0xe5d9('0x18'):_0xe5d9('0x19');}return _0x4712b7;}catch(_0x68bd8c){breakingLicense[_0xe5d9('0xc')]=_0x5289fa[_0xe5d9('0x1a')];breakingLicense[_0xe5d9('0x1b')]=_0x68bd8c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x30a0a0,_0x26d6a2){getLicense()[_0xe5d9('0xb')](function(_0x48c703){return db['User'][_0xe5d9('0x1c')]({'attributes':[_0xe5d9('0x1d'),[db[_0xe5d9('0x1e')]['fn'](_0xe5d9('0x1f'),db[_0xe5d9('0x1e')][_0xe5d9('0x20')](_0xe5d9('0x1d'))),_0xe5d9('0x21')]],'group':_0xe5d9('0x1d'),'where':{'role':{'$or':[_0xe5d9('0x22'),_0xe5d9('0x23'),_0xe5d9('0x24')]}},'raw':!![]})[_0xe5d9('0xb')](function(_0x5e006b){var _0x40645e={'user':_0x48c703[_0xe5d9('0x25')]||0x0,'telephone':_0x48c703['telephones']||0x0};_0x5e006b[_0xe5d9('0x26')](function(_0x23f417){var _0x2ad2c5=_0x23f417['role']===_0xe5d9('0x22')?_0xe5d9('0x23'):_0x23f417[_0xe5d9('0x1d')];_0x40645e[_0x2ad2c5]-=_0x23f417['count'];if(_0x40645e[_0x2ad2c5]<0x0)_0x40645e[_0x2ad2c5]=0x0;});_0x30a0a0(_0x40645e);return;});})[_0xe5d9('0x27')](function(_0x7dd3b3){_0x26d6a2(_0x7dd3b3);});});}function checkUserLimits(_0x20fc2b){return new BPromise(function(_0x302cff,_0x233571){getLimits()[_0xe5d9('0xb')](function(_0x402837){var _0xa89423=_[_0xe5d9('0x28')](_[_0xe5d9('0x29')](_0x20fc2b,_0xe5d9('0x1d')),['admin','user',_0xe5d9('0x24')]);var _0x4acb94=(_0xa89423[_0xe5d9('0x22')]||0x0)+(_0xa89423[_0xe5d9('0x23')]||0x0);var _0x27131c=_0xa89423[_0xe5d9('0x24')]||0x0;if(_0x4acb94>_0x402837[_0xe5d9('0x23')])return _0x233571(_0xe5d9('0x2a'));if(_0x27131c>_0x402837['telephone'])return _0x233571('License\x20limit\x20reached\x20for\x20telephones');return _0x302cff();})[_0xe5d9('0x27')](function(_0x2ded52){_0x233571(_0x2ded52);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8ee1=['License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util','lodash','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo','machineUuid','decryptString','gray','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','telephones','forEach','user','pick','countBy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8ee1,0x13f));var _0x18ee=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0x8ee1[_0x522c6d];return _0x26300d;};'use strict';var util=require(_0x18ee('0x0'));var _=require(_0x18ee('0x1'));var moment=require(_0x18ee('0x2'));var BPromise=require('bluebird');var hardware=require(_0x18ee('0x3'));var encryptor=require(_0x18ee('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18ee('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x18ee('0x6'),'machineUuid':hardware[_0x18ee('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18ee('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x18ee('0x8'),'machineUuid':hardware[_0x18ee('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x24899c){return new BPromise(function(_0x441849,_0x419baa){return db['License']['find'](_['defaults'](_0x24899c,{'raw':!![],'where':{'id':0x1}}))[_0x18ee('0x9')](function(_0x21b4ea){return checkLicense(_0x21b4ea,null);})[_0x18ee('0x9')](function(_0x344171){_0x441849(_0x344171);return;})['catch'](function(_0xced044){_0x419baa(_0xced044);});});}function checkLicense(_0x18b7ce,_0x4d109c){if(!_0x18b7ce){demoLicense[_0x18ee('0xa')]=_0x18b7ce[_0x18ee('0xb')];return demoLicense;}try{var _0x4bc374=_0x4d109c||_0x18b7ce['license'];if(_[_0x18ee('0xc')](_0x4bc374)){throw new Error(_0x18ee('0xd'));}var _0x45abd8=_0x18b7ce[_0x18ee('0xb')];var _0x452f23=_0x18b7ce[_0x18ee('0xe')];var _0x4acfce=_0x45abd8[_0x18ee('0xf')]('-')[0x4];var _0x46c914=_0x45abd8[_0x18ee('0xf')]('-')[0x0];var _0x51cc92=encryptor['decryptString'](_0x4bc374,util[_0x18ee('0x10')]('%s:%s:%s',_0x4acfce,_0x45abd8,_0x46c914));var _0xa99744=JSON[_0x18ee('0x11')](_0x51cc92);_0xa99744[_0x18ee('0x12')]=![];_0xa99744[_0x18ee('0xa')]=_0x45abd8;_0xa99744[_0x18ee('0x13')]=hardware[_0x18ee('0x7')]();if(_0x452f23){var _0x3649bd=encryptor[_0x18ee('0x14')](_0x452f23);_0xa99744[_0x18ee('0x15')]=_0x3649bd;_0xa99744['deadline']=moment(_0x3649bd)[_0x18ee('0x16')](0x7,_0x18ee('0x17'))['format']();_0xa99744[_0x18ee('0x18')]=_0xa99744[_0x18ee('0xa')]!=_0xa99744[_0x18ee('0x13')]?'changed':_0x18ee('0x19');}return _0xa99744;}catch(_0x41c049){breakingLicense['uuid']=_0x18b7ce['data1'];breakingLicense[_0x18ee('0x1a')]=_0x41c049[_0x18ee('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x362662,_0x467721){getLicense()['then'](function(_0x2e0edf){return db[_0x18ee('0x1b')][_0x18ee('0x1c')]({'attributes':[_0x18ee('0x1d'),[db[_0x18ee('0x1e')]['fn'](_0x18ee('0x1f'),db[_0x18ee('0x1e')][_0x18ee('0x20')]('role')),_0x18ee('0x21')]],'group':_0x18ee('0x1d'),'where':{'role':{'$or':[_0x18ee('0x22'),'user',_0x18ee('0x23')]}},'raw':!![]})[_0x18ee('0x9')](function(_0x22d192){var _0x4887af={'user':_0x2e0edf['users']||0x0,'telephone':_0x2e0edf[_0x18ee('0x24')]||0x0};_0x22d192[_0x18ee('0x25')](function(_0x1f1102){var _0x177ab4=_0x1f1102[_0x18ee('0x1d')]===_0x18ee('0x22')?_0x18ee('0x26'):_0x1f1102[_0x18ee('0x1d')];_0x4887af[_0x177ab4]-=_0x1f1102['count'];if(_0x4887af[_0x177ab4]<0x0)_0x4887af[_0x177ab4]=0x0;});_0x362662(_0x4887af);return;});})['catch'](function(_0x10d99a){_0x467721(_0x10d99a);});});}function checkUserLimits(_0x5256cd){return new BPromise(function(_0x42ce44,_0x304031){getLimits()[_0x18ee('0x9')](function(_0x2df8a9){var _0x2ecb67=_[_0x18ee('0x27')](_[_0x18ee('0x28')](_0x5256cd,'role'),[_0x18ee('0x22'),_0x18ee('0x26'),_0x18ee('0x23')]);var _0x17dcbe=(_0x2ecb67[_0x18ee('0x22')]||0x0)+(_0x2ecb67['user']||0x0);var _0x1ee4b1=_0x2ecb67[_0x18ee('0x23')]||0x0;if(_0x17dcbe>_0x2df8a9['user'])return _0x304031(_0x18ee('0x29'));if(_0x1ee4b1>_0x2df8a9[_0x18ee('0x23')])return _0x304031(_0x18ee('0x2a'));return _0x42ce44();})[_0x18ee('0x2b')](function(_0x29d79){_0x304031(_0x29d79);});});}module[_0x18ee('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 8ab76c8..96f50d2 100644 --- a/server/config/local.env.js +++ b/server/config/local.env.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4a2=['app-id','exports'];(function(_0x380d64,_0x2464f2){var _0x4ff7b1=function(_0x6534d0){while(--_0x6534d0){_0x380d64['push'](_0x380d64['shift']());}};_0x4ff7b1(++_0x2464f2);}(_0xd4a2,0x173));var _0x2d4a=function(_0x1e8290,_0x17536d){_0x1e8290=_0x1e8290-0x0;var _0x315554=_0xd4a2[_0x1e8290];return _0x315554;};'use strict';module[_0x2d4a('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2d4a('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xb44a=['myappanuglar-secret','secret'];(function(_0x4e7fa9,_0x29d247){var _0x401f9e=function(_0x2f6a12){while(--_0x2f6a12){_0x4e7fa9['push'](_0x4e7fa9['shift']());}};_0x401f9e(++_0x29d247);}(_0xb44a,0x1c2));var _0xab44=function(_0x565d0a,_0x4927cc){_0x565d0a=_0x565d0a-0x0;var _0x24c211=_0xb44a[_0x565d0a];return _0x24c211;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xab44('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xab44('0x1'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index d5a6257..fd0b071 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaccc=['fileLogger','exports'];(function(_0x3bafa7,_0x5067ed){var _0x3ee6d2=function(_0x34bd4e){while(--_0x34bd4e){_0x3bafa7['push'](_0x3bafa7['shift']());}};_0x3ee6d2(++_0x5067ed);}(_0xaccc,0x6a));var _0xcacc=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0xaccc[_0x3b150c];return _0x5cd414;};'use strict';var fileLogger=require('../utils/loggers')[_0xcacc('0x0')];module[_0xcacc('0x1')]=fileLogger; \ No newline at end of file +var _0xa36f=['../utils/loggers','fileLogger'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0xa36f,0xd8));var _0xfa36=function(_0x3b270d,_0x2aecda){_0x3b270d=_0x3b270d-0x0;var _0x4c8463=_0xa36f[_0x3b270d];return _0x4c8463;};'use strict';var fileLogger=require(_0xfa36('0x0'))[_0xfa36('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 34a3db6..451c114 100644 --- a/server/config/pm2/config.js +++ b/server/config/pm2/config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bc1=['path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','xdr','../../services/xdr/index.js','exports'];(function(_0x1452ec,_0x15810e){var _0x42ba0c=function(_0x1bc327){while(--_0x1bc327){_0x1452ec['push'](_0x1452ec['shift']());}};_0x42ba0c(++_0x15810e);}(_0x0bc1,0xfc));var _0x10bc=function(_0x3c79c5,_0x30c6db){_0x3c79c5=_0x3c79c5-0x0;var _0x33ef2c=_0x0bc1[_0x3c79c5];return _0x33ef2c;};'use strict';var path=require(_0x10bc('0x0'));var os=require('os');var config={'apps':[{'name':_0x10bc('0x1'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x3'))},{'name':_0x10bc('0x4'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x5'))},{'name':_0x10bc('0x6'),'script':path[_0x10bc('0x2')](__dirname,_0x10bc('0x7'))},{'name':_0x10bc('0x8'),'script':path[_0x10bc('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x10bc('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x10bc('0x9'),'script':path['join'](__dirname,_0x10bc('0xa'))}]};module[_0x10bc('0xb')]=config; \ No newline at end of file +var _0xaeee=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','exports','join','../../services/express/index.js'];(function(_0x2e0a25,_0x2da7a6){var _0x359873=function(_0x47fb4b){while(--_0x47fb4b){_0x2e0a25['push'](_0x2e0a25['shift']());}};_0x359873(++_0x2da7a6);}(_0xaeee,0x181));var _0xeaee=function(_0x42d23e,_0xc7d174){_0x42d23e=_0x42d23e-0x0;var _0x1480d0=_0xaeee[_0x42d23e];return _0x1480d0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0xeaee('0x0')](__dirname,_0xeaee('0x1'))},{'name':'ami','script':path['join'](__dirname,_0xeaee('0x2'))},{'name':_0xeaee('0x3'),'script':path[_0xeaee('0x0')](__dirname,_0xeaee('0x4'))},{'name':_0xeaee('0x5'),'script':path['join'](__dirname,_0xeaee('0x6'))},{'name':_0xeaee('0x7'),'script':path[_0xeaee('0x0')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0xeaee('0x0')](__dirname,'../../services/xdr/index.js')}]};module[_0xeaee('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e9dd9fd..aa99340 100644 --- a/server/config/pm2/index.js +++ b/server/config/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76a3=['connected','start','then','disconnect','stop','restart','list','describe','delete','saved','pm2','connect'];(function(_0x400dab,_0x466833){var _0x4f6c81=function(_0x2c3167){while(--_0x2c3167){_0x400dab['push'](_0x400dab['shift']());}};_0x4f6c81(++_0x466833);}(_0x76a3,0x9a));var _0x376a=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x76a3[_0x1cd47d];return _0x29d52f;};'use strict';var pm2=require(_0x376a('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x2b6b75,_0x38343e){return pm2[_0x376a('0x1')](function(_0x5b20ad){if(_0x5b20ad){return _0x38343e(_0x5b20ad);}return _0x2b6b75(_0x376a('0x2'));});});};exports[_0x376a('0x3')]=function(_0x6efe9c){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x2d4ef9,_0x19b75d){return pm2[_0x376a('0x3')](_0x6efe9c,function(_0x2c166b,_0x474efc){if(_0x2c166b){return _0x19b75d(_0x2c166b);}pm2[_0x376a('0x5')]();return _0x2d4ef9(_0x474efc);});});});};exports[_0x376a('0x6')]=function(_0x143e42){return connect()['then'](function(){return new BPromise(function(_0x35fdac,_0x5cd1c7){return pm2[_0x376a('0x6')](_0x143e42,function(_0x94f48d,_0x12ad43){if(_0x94f48d){return _0x5cd1c7(_0x94f48d);}pm2[_0x376a('0x5')]();return _0x35fdac(_0x12ad43);});});});};exports[_0x376a('0x7')]=function(_0x2d1849){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x223540,_0x584abe){return pm2[_0x376a('0x7')](_0x2d1849,function(_0x2bb5ae,_0x1cb0c3){if(_0x2bb5ae){return _0x584abe(_0x2bb5ae);}pm2[_0x376a('0x5')]();return _0x223540(_0x1cb0c3);});});});};exports['list']=function(){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x5c549a,_0x1e90c3){return pm2[_0x376a('0x8')](function(_0x14715c,_0x4483ab){if(_0x14715c){return _0x1e90c3(_0x14715c);}pm2['disconnect']();return _0x5c549a(_0x4483ab);});});});};exports[_0x376a('0x9')]=function(_0x58042e){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x4312e1,_0x4396e2){return pm2[_0x376a('0x9')](_0x58042e,function(_0x42ccbd,_0x238c74){if(_0x42ccbd){return _0x4396e2(_0x42ccbd);}pm2[_0x376a('0x5')]();return _0x4312e1(_0x238c74);});});});};exports[_0x376a('0xa')]=function(_0x11851a){return connect()['then'](function(){return new BPromise(function(_0x5054e7,_0x240ade){return pm2['delete'](_0x11851a,function(_0x1e60ac,_0x489841){if(_0x1e60ac){return _0x240ade(_0x1e60ac);}pm2[_0x376a('0x5')]();return _0x5054e7(_0x489841);});});});};exports['dump']=function(){return connect()[_0x376a('0x4')](function(){return new BPromise(function(_0x5e185a,_0x331bd5){return pm2['dump'](function(_0x3a5929){if(_0x3a5929){return _0x331bd5(_0x3a5929);}return _0x5e185a(_0x376a('0xb'));});});});}; \ No newline at end of file +var _0x52a5=['connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x3eaa8f,_0x1b4baf){var _0x4f5046=function(_0x50446b){while(--_0x50446b){_0x3eaa8f['push'](_0x3eaa8f['shift']());}};_0x4f5046(++_0x1b4baf);}(_0x52a5,0xfb));var _0x552a=function(_0x50896a,_0x38b482){_0x50896a=_0x50896a-0x0;var _0x571c2e=_0x52a5[_0x50896a];return _0x571c2e;};'use strict';var pm2=require(_0x552a('0x0'));var BPromise=require(_0x552a('0x1'));var config=require(_0x552a('0x2'));function connect(){return new BPromise(function(_0x3abbc6,_0x588407){return pm2[_0x552a('0x3')](function(_0x221958){if(_0x221958){return _0x588407(_0x221958);}return _0x3abbc6(_0x552a('0x4'));});});};exports['start']=function(_0x42d69a){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x2bf537,_0x4018be){return pm2[_0x552a('0x6')](_0x42d69a,function(_0x34305a,_0x41694c){if(_0x34305a){return _0x4018be(_0x34305a);}pm2[_0x552a('0x7')]();return _0x2bf537(_0x41694c);});});});};exports[_0x552a('0x8')]=function(_0x1a79ba){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x3868fd,_0x1b87b){return pm2[_0x552a('0x8')](_0x1a79ba,function(_0x594cb8,_0x486c2a){if(_0x594cb8){return _0x1b87b(_0x594cb8);}pm2[_0x552a('0x7')]();return _0x3868fd(_0x486c2a);});});});};exports[_0x552a('0x9')]=function(_0x3a477f){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x46c370,_0x4b3254){return pm2[_0x552a('0x9')](_0x3a477f,function(_0xdc4f09,_0x3fe6a5){if(_0xdc4f09){return _0x4b3254(_0xdc4f09);}pm2[_0x552a('0x7')]();return _0x46c370(_0x3fe6a5);});});});};exports['list']=function(){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x203400,_0x307216){return pm2[_0x552a('0xa')](function(_0x5a06e2,_0xdcafb7){if(_0x5a06e2){return _0x307216(_0x5a06e2);}pm2[_0x552a('0x7')]();return _0x203400(_0xdcafb7);});});});};exports[_0x552a('0xb')]=function(_0x8071e8){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x202792,_0x4e04bd){return pm2[_0x552a('0xb')](_0x8071e8,function(_0x294a71,_0x5e3a02){if(_0x294a71){return _0x4e04bd(_0x294a71);}pm2[_0x552a('0x7')]();return _0x202792(_0x5e3a02);});});});};exports[_0x552a('0xc')]=function(_0x2ae281){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x29d948,_0x33f90c){return pm2[_0x552a('0xc')](_0x2ae281,function(_0xf6f70e,_0x159e42){if(_0xf6f70e){return _0x33f90c(_0xf6f70e);}pm2[_0x552a('0x7')]();return _0x29d948(_0x159e42);});});});};exports[_0x552a('0xd')]=function(){return connect()[_0x552a('0x5')](function(){return new BPromise(function(_0x1237a3,_0x16d9ff){return pm2[_0x552a('0xd')](function(_0x34592f){if(_0x34592f){return _0x16d9ff(_0x34592f);}return _0x1237a3(_0x552a('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 1822833..9779643 100644 --- a/server/config/schedule/chat.js +++ b/server/config/schedule/chat.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0028=['../../config/environment','../logger','schedule','defaults','localhost','redis','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','inspect','start','moment','ioredis'];(function(_0x474f1e,_0x448320){var _0x292bd5=function(_0x33800a){while(--_0x33800a){_0x474f1e['push'](_0x474f1e['shift']());}};_0x292bd5(++_0x448320);}(_0x0028,0x85));var _0x8002=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x0028[_0x11ec6c];return _0xb59506;};'use strict';var _=require('lodash');var moment=require(_0x8002('0x0'));var Redis=require(_0x8002('0x1'));var util=require('util');var config=require(_0x8002('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x8002('0x3'))(_0x8002('0x4'));config['redis']=_[_0x8002('0x5')](config['redis'],{'host':_0x8002('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8002('0x7')]));function closeInteractions(){var _0x31d5f3=0x0;var _0x3f6e69=[];return db[_0x8002('0x8')]['find']({'raw':!![],'attributes':['id',_0x8002('0x9')],'where':{'id':0x1}})[_0x8002('0xa')](function(_0x72f589){_0x31d5f3=_0x72f589[_0x8002('0x9')];if(_0x31d5f3){return db['ChatInteraction'][_0x8002('0xb')]({'raw':!![],'attributes':['id',_0x8002('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8002('0xd')](_0x72f589['chatTimeout'],_0x8002('0xe'))}}});}else{return[];}})[_0x8002('0xa')](function(_0x46d296){if(_0x46d296&&_0x46d296[_0x8002('0xf')]){_0x3f6e69=_['map'](_0x46d296||[],'id');logger[_0x8002('0x10')](_0x8002('0x11'),_0x3f6e69[_0x8002('0x12')]());return db[_0x8002('0x13')]['update']({'closeReason':'system','disposition':_0x8002('0x14'),'closed':!![],'closedAt':moment()[_0x8002('0x15')](_0x8002('0x16'))},{'where':{'id':_0x3f6e69}});}})[_0x8002('0xa')](function(){if(_0x3f6e69&&_0x3f6e69[_0x8002('0xf')]){logger[_0x8002('0x10')](_0x8002('0x17'),_0x3f6e69[_0x8002('0x12')]());for(var _0x13bd5b=0x0;_0x13bd5b<_0x3f6e69[_0x8002('0xf')];_0x13bd5b++){io['emit']('chatInteraction:update',{'id':_0x3f6e69[_0x13bd5b],'closed':!![]});}}})[_0x8002('0x18')](function(_0x26860c){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x26860c?util[_0x8002('0x19')](_0x26860c,{'showHidden':![],'depth':null}):'');});}exports[_0x8002('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6b31=['catch','error','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','chatTimeout','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x376125,_0x5a24e1){var _0xfc5dfd=function(_0x5e2e1a){while(--_0x5e2e1a){_0x376125['push'](_0x376125['shift']());}};_0xfc5dfd(++_0x5a24e1);}(_0x6b31,0x88));var _0x16b3=function(_0x27acaa,_0x471fa7){_0x27acaa=_0x27acaa-0x0;var _0x38e824=_0x6b31[_0x27acaa];return _0x38e824;};'use strict';var _=require(_0x16b3('0x0'));var moment=require(_0x16b3('0x1'));var Redis=require(_0x16b3('0x2'));var util=require('util');var config=require(_0x16b3('0x3'));var db=require(_0x16b3('0x4'))['db'];var logger=require(_0x16b3('0x5'))(_0x16b3('0x6'));config[_0x16b3('0x7')]=_[_0x16b3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x16b3('0x9'))(new Redis(config[_0x16b3('0x7')]));function closeInteractions(){var _0x27f25a=0x0;var _0x10d005=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x16b3('0xa')],'where':{'id':0x1}})['then'](function(_0x12cee0){_0x27f25a=_0x12cee0[_0x16b3('0xa')];if(_0x27f25a){return db['ChatInteraction'][_0x16b3('0xb')]({'raw':!![],'attributes':['id',_0x16b3('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x16b3('0xd')](_0x12cee0[_0x16b3('0xa')],_0x16b3('0xe'))}}});}else{return[];}})[_0x16b3('0xf')](function(_0x46bffa){if(_0x46bffa&&_0x46bffa[_0x16b3('0x10')]){_0x10d005=_[_0x16b3('0x11')](_0x46bffa||[],'id');logger[_0x16b3('0x12')](_0x16b3('0x13'),_0x10d005[_0x16b3('0x14')]());return db[_0x16b3('0x15')][_0x16b3('0x16')]({'closeReason':_0x16b3('0x17'),'disposition':_0x16b3('0x18'),'closed':!![],'closedAt':moment()['format'](_0x16b3('0x19'))},{'where':{'id':_0x10d005}});}})[_0x16b3('0xf')](function(){if(_0x10d005&&_0x10d005[_0x16b3('0x10')]){logger[_0x16b3('0x12')](_0x16b3('0x1a'),_0x10d005[_0x16b3('0x14')]());for(var _0x6cda24=0x0;_0x6cda24<_0x10d005[_0x16b3('0x10')];_0x6cda24++){io[_0x16b3('0x1b')](_0x16b3('0x1c'),{'id':_0x10d005[_0x6cda24],'closed':!![]});}}})[_0x16b3('0x1d')](function(_0x57c7ac){logger[_0x16b3('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x57c7ac?util[_0x16b3('0x1f')](_0x57c7ac,{'showHidden':![],'depth':null}):'');});}exports[_0x16b3('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 9435fb6..2e6f75d 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdead=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x48a160,_0x5f4053){var _0x2e2fbe=function(_0x57b99d){while(--_0x57b99d){_0x48a160['push'](_0x48a160['shift']());}};_0x2e2fbe(++_0x5f4053);}(_0xdead,0x197));var _0xddea=function(_0x137972,_0x36f5ba){_0x137972=_0x137972-0x0;var _0x12447d=_0xdead[_0x137972];return _0x12447d;};'use strict';function start(){var _0x40e806=require(_0xddea('0x0'));return _0x40e806[_0xddea('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x8234=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x39643d,_0x502088){var _0x37c280=function(_0x4968e8){while(--_0x4968e8){_0x39643d['push'](_0x39643d['shift']());}};_0x37c280(++_0x502088);}(_0x8234,0x1c9));var _0x4823=function(_0x51c938,_0x7b322){_0x51c938=_0x51c938-0x0;var _0x4bb8b2=_0x8234[_0x51c938];return _0x4bb8b2;};'use strict';function start(){var _0x3362fc=require(_0x4823('0x0'));return _0x3362fc['startAllRefreshIntervals']();}module[_0x4823('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 42b62b1..d70bb9d 100644 --- a/server/config/schedule/index.js +++ b/server/config/schedule/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94d9=['active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','stringify','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','Schedule','CloudProvider','jobs','keyBy','toString','difference','intersection','length','exists','stop','toRun','index','my\x20id','resolve','run\x20job','cron'];(function(_0x1dfa55,_0x1d2007){var _0x893d0e=function(_0x30cace){while(--_0x30cace){_0x1dfa55['push'](_0x1dfa55['shift']());}};_0x893d0e(++_0x1d2007);}(_0x94d9,0x1cd));var _0x994d=function(_0x365272,_0x4948e0){_0x365272=_0x365272-0x0;var _0x36b2a5=_0x94d9[_0x365272];return _0x36b2a5;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x994d('0x0'));var _=require(_0x994d('0x1'));var moment=require(_0x994d('0x2'));var CronJobManager=require(_0x994d('0x3'));var jayson=require(_0x994d('0x4'));var BPromise=require(_0x994d('0x5'));var logger=require(_0x994d('0x6'))(_0x994d('0x7'));var db=require(_0x994d('0x8'))['db'];var analyticCustomReportController=require(_0x994d('0x9'));var analyticDefaultReportController=require(_0x994d('0xa'));var client=jayson[_0x994d('0xb')][_0x994d('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x118304,_0x2a56ca){return function(){logger[_0x994d('0xd')](_0x994d('0xe'),_0x118304[_0x994d('0xf')]);var _0x1a31f2=!![];var _0x34d9d9=_0x118304['MailAccount'][_0x994d('0x10')]();var _0x4fef9e={'account':_0x34d9d9,'message':{'from':util['format'](_0x994d('0x11'),_0x118304['MailAccount'][_0x994d('0x12')],_0x118304[_0x994d('0x13')][_0x994d('0xf')]||_0x118304[_0x994d('0x13')][_0x994d('0x14')][_0x994d('0x15')]),'to':_0x118304[_0x994d('0xf')],'cc':_0x118304['cc'],'bcc':_0x118304['bcc'],'subject':util[_0x994d('0x16')](_0x994d('0x17'),_0x2a56ca['name'],_0x118304[_0x994d('0x18')],_0x118304['subtractUnit'])}};var _0x50f1fd=path[_0x994d('0x19')](__dirname,_0x994d('0x1a'));var _0x2c4515=_0x2a56ca[_0x994d('0x1b')];var _0x388c1c=util[_0x994d('0x16')]('%s.%s',path[_0x994d('0x1c')](_0x2a56ca[_0x994d('0x1b')],path[_0x994d('0x1d')](_0x2a56ca[_0x994d('0x1b')])),_0x994d('0x1e'));var _0x55a08b=path['join'](_0x50f1fd,_0x2c4515);var _0x45ffca=path[_0x994d('0x19')](_0x50f1fd,_0x388c1c);if(fs[_0x994d('0x1f')](_0x55a08b)){_0x2a56ca['status']=_0x994d('0x20');_0x4fef9e[_0x994d('0x21')][_0x994d('0x22')]=[{'filename':_0x2c4515,'path':_0x55a08b}];_0x4fef9e[_0x994d('0x21')][_0x994d('0x23')]=util[_0x994d('0x16')](_0x994d('0x24'),JSON['stringify'](_0x2a56ca,null,0x2));}else if(fs[_0x994d('0x1f')](_0x45ffca)){_0x2a56ca[_0x994d('0x25')]=_0x994d('0x20');_0x4fef9e[_0x994d('0x21')][_0x994d('0x22')]=[{'filename':_0x388c1c,'path':_0x45ffca}];}else{_0x4fef9e[_0x994d('0x21')][_0x994d('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x118304[_0x994d('0x26')]){_0x1a31f2=![];logger[_0x994d('0xd')](_0x994d('0x27'));}}if(_0x1a31f2){return client[_0x994d('0x28')](_0x994d('0x29'),_0x4fef9e)['then'](function(_0x53de1d){if(_0x53de1d[_0x994d('0x2a')]){return logger[_0x994d('0x2a')]('error\x20mail',JSON[_0x994d('0x2b')](_0x53de1d));}return logger[_0x994d('0xd')](_0x994d('0x2c'));})[_0x994d('0x2d')](function(_0x59289e){return logger[_0x994d('0x2a')](_0x994d('0x2e'),JSON['stringify'](_0x59289e));});}};}function handleError(){return function(_0x14a064){return logger['error'](JSON[_0x994d('0x2b')](_0x14a064));};}function handleResult(_0x4e94a2){return function(_0x90a656){logger[_0x994d('0xd')](_0x994d('0x2f'),JSON['stringify'](_0x90a656));if(_0x4e94a2[_0x994d('0x13')]&&_0x4e94a2[_0x994d('0x13')][_0x994d('0x14')]&&!_[_0x994d('0x30')](_0x4e94a2['email'])){setTimeout(handleSendEmail(_0x4e94a2,_0x90a656),0x3c*0x3e8);}};}function handleJob(_0x4a5ae0){return function(){try{if(_['isNil'](_0x4a5ae0['subtractNumber'])){return logger[_0x994d('0xd')](_0x994d('0x31'));}if(_[_0x994d('0x30')](_0x4a5ae0[_0x994d('0x32')])){return logger[_0x994d('0xd')](_0x994d('0x33'));}var _0x3579b2={'startDate':moment()[_0x994d('0x34')](_0x4a5ae0[_0x994d('0x18')],_0x4a5ae0[_0x994d('0x32')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x994d('0x35')),'type':_0x994d('0x36'),'output':_0x4a5ae0[_0x994d('0x37')],'name':_0x4a5ae0['name']};if(!_[_0x994d('0x30')](_0x4a5ae0[_0x994d('0x38')])){logger[_0x994d('0xd')](_0x994d('0x39'),_0x4a5ae0[_0x994d('0x38')]);return analyticDefaultReportController['runReport']({'id':_0x4a5ae0[_0x994d('0x38')]},_0x3579b2)[_0x994d('0x3a')](handleResult(_0x4a5ae0))['catch'](handleError());}if(!_[_0x994d('0x30')](_0x4a5ae0['CustomReportId'])){logger[_0x994d('0xd')](_0x994d('0x3b'),_0x4a5ae0[_0x994d('0x3c')]);return analyticCustomReportController[_0x994d('0x3d')]({'id':_0x4a5ae0[_0x994d('0x3c')]},_0x3579b2)[_0x994d('0x3a')](handleResult(_0x4a5ae0))[_0x994d('0x2d')](handleError());}}catch(_0x3a9915){logger[_0x994d('0x2a')](JSON[_0x994d('0x2b')](_0x3a9915));}return logger[_0x994d('0xd')](_0x994d('0x3e'));};}function getJobs(_0x4f5e8a){var _0x4f5f43={};if(_0x4f5e8a){_0x4f5f43['id']=_0x4f5e8a;}return db[_0x994d('0x3f')]['findAll']({'where':_0x4f5f43,'include':[{'model':db['MailAccount'],'attributes':['id',_0x994d('0x12'),_0x994d('0xf')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x994d('0x40')],'as':_0x994d('0x40')}]}]}]})[_0x994d('0x3a')](function(_0x4fc6e9){var _0x10a3fb=_['keys'](manager[_0x994d('0x41')]);var _0x4cb5e2=_['map'](_0x4fc6e9,function(_0x354a5e){return _0x354a5e['id']['toString']();});var _0x1525f4=_[_0x994d('0x42')](_0x4fc6e9,function(_0x2b1c3c){return _0x2b1c3c['id'][_0x994d('0x43')]();});var _0x571fc8=_0x4f5e8a?_0x4cb5e2:_[_0x994d('0x44')](_0x4cb5e2,_0x10a3fb);var _0xb8bba8=_[_0x994d('0x45')](_0x4cb5e2,_0x10a3fb);var _0x409754=_[_0x994d('0x44')](_0x10a3fb,_0x4cb5e2);var _0x39751f;var _0x23cd71;for(_0x39751f=0x0;_0x39751f<_0x409754[_0x994d('0x46')]&&!_0x4f5e8a;_0x39751f+=0x1){_0x23cd71=_0x409754[_0x39751f][_0x994d('0x43')]();if(manager[_0x994d('0x47')](_0x23cd71)){manager[_0x994d('0x48')](_0x23cd71);manager['deleteJob'](_0x23cd71);logger[_0x994d('0xd')]('delete\x20cron',_0x23cd71);}}logger[_0x994d('0xd')](_0x994d('0x49'),JSON[_0x994d('0x2b')](_0x571fc8));for(_0x39751f=0x0;_0x39751f<_0x571fc8[_0x994d('0x46')];_0x39751f+=0x1){_0x23cd71=_0x571fc8[_0x39751f]['toString']();logger[_0x994d('0xd')](_0x994d('0x4a'),_0x23cd71);if(_0x4f5e8a){logger[_0x994d('0xd')](_0x994d('0x4b'),_0x4f5e8a);logger[_0x994d('0xd')](JSON[_0x994d('0x2b')](_0x1525f4[_0x23cd71]));BPromise[_0x994d('0x4c')]()[_0x994d('0x3a')](handleJob(_0x1525f4[_0x23cd71]));logger['info'](_0x994d('0x4d'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else if(_0x1525f4[_0x23cd71][_0x994d('0x4e')]&&_0x1525f4[_0x23cd71][_0x994d('0x4f')]&&moment()[_0x994d('0x50')](_0x1525f4[_0x23cd71][_0x994d('0x51')],_0x1525f4[_0x23cd71][_0x994d('0x52')])){manager[_0x994d('0x53')](_0x23cd71,_0x1525f4[_0x23cd71][_0x994d('0x4e')],handleJob(_0x1525f4[_0x23cd71]));manager[_0x994d('0x54')](_0x23cd71);logger['info'](_0x994d('0x55'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else if(manager[_0x994d('0x47')](_0x23cd71)){manager['stop'](_0x23cd71);manager[_0x994d('0x56')](_0x23cd71);logger[_0x994d('0xd')](_0x994d('0x57'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}}for(_0x39751f=0x0,_0x23cd71;_0x39751f<_0xb8bba8[_0x994d('0x46')]&&!_0x4f5e8a;_0x39751f+=0x1){_0x23cd71=_0xb8bba8[_0x39751f][_0x994d('0x43')]();if(manager[_0x994d('0x47')](_0x23cd71)){if(_0x1525f4[_0x23cd71][_0x994d('0x4e')]&&_0x1525f4[_0x23cd71]['active']&&moment()[_0x994d('0x50')](_0x1525f4[_0x23cd71]['startAt'],_0x1525f4[_0x23cd71][_0x994d('0x52')])){manager[_0x994d('0x58')](_0x23cd71,_0x1525f4[_0x23cd71][_0x994d('0x4e')],handleJob(_0x1525f4[_0x23cd71]));logger[_0x994d('0xd')]('update\x20cron',_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}else{manager[_0x994d('0x48')](_0x23cd71);manager[_0x994d('0x56')](_0x23cd71);logger[_0x994d('0xd')](_0x994d('0x57'),_0x1525f4[_0x23cd71][_0x994d('0x12')],_0x1525f4[_0x23cd71][_0x994d('0x4e')]);}}}})[_0x994d('0x2d')](function(_0x5a03b6){logger[_0x994d('0x2a')](JSON['stringify'](_0x5a03b6));});}exports[_0x994d('0x59')]=function(_0x105930){return getJobs(_0x105930);};exports[_0x994d('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x67e2=['endAt','add','start','add\x20cron','stop\x20cron','startAt','update','update\x20cron','util','path','lodash','moment','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','format','\x22%s\x22\x20<%s>','MailAccount','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','Sent','message','attachments','text','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','toString','index','my\x20id','resolve','run\x20job','cron','active','isBetween'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x67e2,0x116));var _0x267e=function(_0x27de6d,_0x4b4039){_0x27de6d=_0x27de6d-0x0;var _0xb2d843=_0x67e2[_0x27de6d];return _0xb2d843;};'use strict';var fs=require('fs');var util=require(_0x267e('0x0'));var path=require(_0x267e('0x1'));var _=require(_0x267e('0x2'));var moment=require(_0x267e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x267e('0x4'));var BPromise=require('bluebird');var logger=require('../logger')(_0x267e('0x5'));var db=require(_0x267e('0x6'))['db'];var analyticCustomReportController=require(_0x267e('0x7'));var analyticDefaultReportController=require(_0x267e('0x8'));var client=jayson[_0x267e('0x9')][_0x267e('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x55accd,_0x492b01){return function(){logger[_0x267e('0xb')](_0x267e('0xc'),_0x55accd[_0x267e('0xd')]);var _0x139024=!![];var _0x131a57=_0x55accd['MailAccount']['getSmtpOptions']();var _0x56b2f4={'account':_0x131a57,'message':{'from':util[_0x267e('0xe')](_0x267e('0xf'),_0x55accd[_0x267e('0x10')][_0x267e('0x11')],_0x55accd[_0x267e('0x10')][_0x267e('0xd')]||_0x55accd[_0x267e('0x10')]['Smtp'][_0x267e('0x12')]),'to':_0x55accd[_0x267e('0xd')],'cc':_0x55accd['cc'],'bcc':_0x55accd[_0x267e('0x13')],'subject':util[_0x267e('0xe')](_0x267e('0x14'),_0x492b01[_0x267e('0x11')],_0x55accd[_0x267e('0x15')],_0x55accd[_0x267e('0x16')])}};var _0x2eae46=path['join'](__dirname,_0x267e('0x17'));var _0xbc126c=_0x492b01[_0x267e('0x18')];var _0x3e57a7=util[_0x267e('0xe')](_0x267e('0x19'),path[_0x267e('0x1a')](_0x492b01[_0x267e('0x18')],path[_0x267e('0x1b')](_0x492b01[_0x267e('0x18')])),_0x267e('0x1c'));var _0x218a09=path[_0x267e('0x1d')](_0x2eae46,_0xbc126c);var _0x1fb403=path[_0x267e('0x1d')](_0x2eae46,_0x3e57a7);if(fs[_0x267e('0x1e')](_0x218a09)){_0x492b01['status']=_0x267e('0x1f');_0x56b2f4[_0x267e('0x20')][_0x267e('0x21')]=[{'filename':_0xbc126c,'path':_0x218a09}];_0x56b2f4[_0x267e('0x20')][_0x267e('0x22')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x267e('0x23')](_0x492b01,null,0x2));}else if(fs['existsSync'](_0x1fb403)){_0x492b01[_0x267e('0x24')]=_0x267e('0x1f');_0x56b2f4[_0x267e('0x20')][_0x267e('0x21')]=[{'filename':_0x3e57a7,'path':_0x1fb403}];}else{_0x56b2f4[_0x267e('0x20')][_0x267e('0x22')]=_0x267e('0x25');if(!_0x55accd[_0x267e('0x26')]){_0x139024=![];logger[_0x267e('0xb')](_0x267e('0x27'));}}if(_0x139024){return client[_0x267e('0x28')]('SendMail',_0x56b2f4)[_0x267e('0x29')](function(_0x463238){if(_0x463238['error']){return logger[_0x267e('0x2a')](_0x267e('0x2b'),JSON[_0x267e('0x23')](_0x463238));}return logger[_0x267e('0xb')](_0x267e('0x2c'));})['catch'](function(_0x49133e){return logger[_0x267e('0x2a')](_0x267e('0x2b'),JSON[_0x267e('0x23')](_0x49133e));});}};}function handleError(){return function(_0x154fe0){return logger[_0x267e('0x2a')](JSON[_0x267e('0x23')](_0x154fe0));};}function handleResult(_0x160479){return function(_0x56b73d){logger[_0x267e('0xb')](_0x267e('0x2d'),JSON[_0x267e('0x23')](_0x56b73d));if(_0x160479[_0x267e('0x10')]&&_0x160479['MailAccount'][_0x267e('0x2e')]&&!_[_0x267e('0x2f')](_0x160479[_0x267e('0xd')])){setTimeout(handleSendEmail(_0x160479,_0x56b73d),0x3c*0x3e8);}};}function handleJob(_0x55a9dd){return function(){try{if(_[_0x267e('0x2f')](_0x55a9dd[_0x267e('0x15')])){return logger[_0x267e('0xb')](_0x267e('0x30'));}if(_['isNil'](_0x55a9dd[_0x267e('0x16')])){return logger[_0x267e('0xb')](_0x267e('0x31'));}var _0x4d16d1={'startDate':moment()[_0x267e('0x32')](_0x55a9dd[_0x267e('0x15')],_0x55a9dd[_0x267e('0x16')])[_0x267e('0xe')](_0x267e('0x33')),'endDate':moment()[_0x267e('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x267e('0x34'),'output':_0x55a9dd[_0x267e('0x35')],'name':_0x55a9dd[_0x267e('0x11')]};if(!_['isNil'](_0x55a9dd[_0x267e('0x36')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x55a9dd['DefaultReportId']);return analyticDefaultReportController[_0x267e('0x37')]({'id':_0x55a9dd[_0x267e('0x36')]},_0x4d16d1)[_0x267e('0x29')](handleResult(_0x55a9dd))[_0x267e('0x38')](handleError());}if(!_[_0x267e('0x2f')](_0x55a9dd[_0x267e('0x39')])){logger[_0x267e('0xb')]('exec\x20custom\x20report\x20id:%s',_0x55a9dd[_0x267e('0x39')]);return analyticCustomReportController[_0x267e('0x37')]({'id':_0x55a9dd[_0x267e('0x39')]},_0x4d16d1)['then'](handleResult(_0x55a9dd))[_0x267e('0x38')](handleError());}}catch(_0x215984){logger[_0x267e('0x2a')](JSON[_0x267e('0x23')](_0x215984));}return logger['info'](_0x267e('0x3a'));};}function getJobs(_0x2b5aec){var _0x43269e={};if(_0x2b5aec){_0x43269e['id']=_0x2b5aec;}return db[_0x267e('0x3b')][_0x267e('0x3c')]({'where':_0x43269e,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0x267e('0x3d')],'as':_0x267e('0x2e'),'include':[{'model':db[_0x267e('0x3e')],'as':_0x267e('0x3e')}]}]}]})['then'](function(_0x5ed219){var _0x280274=_[_0x267e('0x3f')](manager[_0x267e('0x40')]);var _0x1de085=_[_0x267e('0x41')](_0x5ed219,function(_0x547886){return _0x547886['id']['toString']();});var _0x446d86=_['keyBy'](_0x5ed219,function(_0x5f16d6){return _0x5f16d6['id']['toString']();});var _0x1d0458=_0x2b5aec?_0x1de085:_[_0x267e('0x42')](_0x1de085,_0x280274);var _0x49c618=_[_0x267e('0x43')](_0x1de085,_0x280274);var _0x36905e=_['difference'](_0x280274,_0x1de085);var _0x3c3ea5;var _0x2bcf32;for(_0x3c3ea5=0x0;_0x3c3ea5<_0x36905e[_0x267e('0x44')]&&!_0x2b5aec;_0x3c3ea5+=0x1){_0x2bcf32=_0x36905e[_0x3c3ea5]['toString']();if(manager[_0x267e('0x45')](_0x2bcf32)){manager[_0x267e('0x46')](_0x2bcf32);manager[_0x267e('0x47')](_0x2bcf32);logger[_0x267e('0xb')](_0x267e('0x48'),_0x2bcf32);}}logger[_0x267e('0xb')](_0x267e('0x49'),JSON[_0x267e('0x23')](_0x1d0458));for(_0x3c3ea5=0x0;_0x3c3ea5<_0x1d0458[_0x267e('0x44')];_0x3c3ea5+=0x1){_0x2bcf32=_0x1d0458[_0x3c3ea5][_0x267e('0x4a')]();logger[_0x267e('0xb')](_0x267e('0x4b'),_0x2bcf32);if(_0x2b5aec){logger[_0x267e('0xb')](_0x267e('0x4c'),_0x2b5aec);logger['info'](JSON[_0x267e('0x23')](_0x446d86[_0x2bcf32]));BPromise[_0x267e('0x4d')]()[_0x267e('0x29')](handleJob(_0x446d86[_0x2bcf32]));logger[_0x267e('0xb')](_0x267e('0x4e'),_0x446d86[_0x2bcf32][_0x267e('0x11')],_0x446d86[_0x2bcf32]['cron']);}else if(_0x446d86[_0x2bcf32][_0x267e('0x4f')]&&_0x446d86[_0x2bcf32][_0x267e('0x50')]&&moment()[_0x267e('0x51')](_0x446d86[_0x2bcf32]['startAt'],_0x446d86[_0x2bcf32][_0x267e('0x52')])){manager[_0x267e('0x53')](_0x2bcf32,_0x446d86[_0x2bcf32][_0x267e('0x4f')],handleJob(_0x446d86[_0x2bcf32]));manager[_0x267e('0x54')](_0x2bcf32);logger[_0x267e('0xb')](_0x267e('0x55'),_0x446d86[_0x2bcf32][_0x267e('0x11')],_0x446d86[_0x2bcf32][_0x267e('0x4f')]);}else if(manager[_0x267e('0x45')](_0x2bcf32)){manager['stop'](_0x2bcf32);manager[_0x267e('0x47')](_0x2bcf32);logger[_0x267e('0xb')](_0x267e('0x56'),_0x446d86[_0x2bcf32][_0x267e('0x11')],_0x446d86[_0x2bcf32][_0x267e('0x4f')]);}}for(_0x3c3ea5=0x0,_0x2bcf32;_0x3c3ea5<_0x49c618[_0x267e('0x44')]&&!_0x2b5aec;_0x3c3ea5+=0x1){_0x2bcf32=_0x49c618[_0x3c3ea5][_0x267e('0x4a')]();if(manager[_0x267e('0x45')](_0x2bcf32)){if(_0x446d86[_0x2bcf32][_0x267e('0x4f')]&&_0x446d86[_0x2bcf32][_0x267e('0x50')]&&moment()[_0x267e('0x51')](_0x446d86[_0x2bcf32][_0x267e('0x57')],_0x446d86[_0x2bcf32][_0x267e('0x52')])){manager[_0x267e('0x58')](_0x2bcf32,_0x446d86[_0x2bcf32][_0x267e('0x4f')],handleJob(_0x446d86[_0x2bcf32]));logger[_0x267e('0xb')](_0x267e('0x59'),_0x446d86[_0x2bcf32][_0x267e('0x11')],_0x446d86[_0x2bcf32][_0x267e('0x4f')]);}else{manager[_0x267e('0x46')](_0x2bcf32);manager[_0x267e('0x47')](_0x2bcf32);logger['info'](_0x267e('0x56'),_0x446d86[_0x2bcf32][_0x267e('0x11')],_0x446d86[_0x2bcf32][_0x267e('0x4f')]);}}}})[_0x267e('0x38')](function(_0x34a876){logger['error'](JSON[_0x267e('0x23')](_0x34a876));});}exports['run']=function(_0x339258){return getJobs(_0x339258);};exports[_0x267e('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 8d7c8ef..b52b9d3 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ab9=['transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','ValidationError','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','error','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results'];(function(_0x96c15f,_0x538403){var _0x202a78=function(_0x311a4a){while(--_0x311a4a){_0x96c15f['push'](_0x96c15f['shift']());}};_0x202a78(++_0x538403);}(_0x9ab9,0x19d));var _0x99ab=function(_0x168d40,_0x5b02b7){_0x168d40=_0x168d40-0x0;var _0x32e04a=_0x9ab9[_0x168d40];return _0x32e04a;};var _=require(_0x99ab('0x0'));var AWS=require(_0x99ab('0x1'));var rp=require(_0x99ab('0x2'));var util=require(_0x99ab('0x3'));var BPromise=require(_0x99ab('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x99ab('0x5'))(_0x99ab('0x6'));function getTranscriptionJob(_0x5f28e4,_0x1b1c96,_0x49761a,_0x442e8c){return new Promise(function(_0x1042a3,_0x390d41){var _0x249c1f=new AWS[(_0x99ab('0x7'))]({'accessKeyId':_0x1b1c96,'secretAccessKey':_0x5f28e4,'region':_0x49761a});_0x249c1f['getTranscriptionJob']({'TranscriptionJobName':_0x442e8c},function(_0x5762c1,_0x3f5a2c){if(_0x5762c1){return _0x390d41(_0x5762c1);}else{return _0x1042a3(_0x3f5a2c);}});});}function sentiment(_0x18ca95,_0x4e94f0,_0x14d083,_0xa40f42,_0x1477cc){return new Promise(function(_0xe1660b,_0xe82b20){var _0x23e904=new AWS['Comprehend']({'accessKeyId':_0x4e94f0,'secretAccessKey':_0x18ca95,'region':_0x14d083});_0x23e904[_0x99ab('0x8')]({'Text':_0xa40f42,'LanguageCode':_0x1477cc[_0x99ab('0x9')](0x0,0x2)},function(_0xffdfeb,_0x5bd277){if(_0xffdfeb){return _0xe82b20(_0xffdfeb);}else{return _0xe1660b(_0x5bd277);}});});}function checkTranscribeJob(_0x4e7b4a,_0xed2100,_0x24229c){var _0x3739fb;return new BPromise(function(_0x3b3bba,_0x25f225){logger[_0x99ab('0xa')](util['format'](_0x99ab('0xb'),_0x4e7b4a['id'],_0x4e7b4a[_0x99ab('0xc')]));return getTranscriptionJob(_0x24229c['data1'],_0x24229c[_0x99ab('0xd')],_0xed2100[_0x99ab('0xe')],_0x4e7b4a[_0x99ab('0xc')])['then'](function(_0x4299ae){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x10'),_0x4e7b4a['id'],_0x4e7b4a[_0x99ab('0xc')],_0x4299ae[_0x99ab('0x11')][_0x99ab('0x12')]));if(!_0x4e7b4a[_0x99ab('0x13')]){switch(_0x4299ae['TranscriptionJob'][_0x99ab('0x12')]){case _0x99ab('0x14'):var _0x4193c0={'transcribeStatus':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x12')],'fileUri':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x15')][_0x99ab('0x16')]};logger[_0x99ab('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x4e7b4a['id']));return rp({'uri':_0x4299ae[_0x99ab('0x11')][_0x99ab('0x15')][_0x99ab('0x16')],'json':!![]})['then'](function(_0x2e0464){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x17'),_0x4e7b4a['id']));if(_0x2e0464&&_0x2e0464[_0x99ab('0x18')]&&_0x2e0464[_0x99ab('0x18')][_0x99ab('0x19')]&&_0x2e0464['results'][_0x99ab('0x19')]['length']){_0x4193c0[_0x99ab('0x13')]='';for(var _0x56bdb7=0x0;_0x56bdb7<_0x2e0464['results'][_0x99ab('0x19')][_0x99ab('0x1a')];_0x56bdb7++){_0x4193c0[_0x99ab('0x13')]+=_0x2e0464['results'][_0x99ab('0x19')][_0x56bdb7][_0x99ab('0x1b')]+'';}}return _0x4e7b4a[_0x99ab('0x1c')](_0x4193c0);})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));if(!_0x4e7b4a[_0x99ab('0x1f')]){throw new db[(_0x99ab('0x20'))]['ValidationError'](_0x99ab('0x21'));}if(!_0xed2100[_0x99ab('0x22')]||!_0xed2100['sentimentAccountId']||!_0xed2100[_0x99ab('0x23')]||!_0xed2100[_0x99ab('0x24')]||!_0xed2100[_0x99ab('0x25')]){throw new db['Sequelize']['ValidationError'](_0x99ab('0x26'));}if(!_0x4193c0[_0x99ab('0x13')]){throw new Error(_0x99ab('0x27'));}if(_0xed2100[_0x99ab('0x28')]===_0x24229c['id']){return _0x24229c;}else{return db[_0x99ab('0x29')][_0x99ab('0x2a')]({'where':{'id':_settings[_0x99ab('0x28')]}});}})[_0x99ab('0x1d')](function(_0x5ba1ea){if(!_0x5ba1ea){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ba1ea[_0x99ab('0x2c')]||!_0x5ba1ea[_0x99ab('0xd')]){throw new db['Sequelize']['ValidationError'](_0x99ab('0x2d'));}_0x3739fb=_0x5ba1ea;logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4e7b4a['id']));return sentiment(_0x3739fb['data1'],_0x3739fb['data2'],_0xed2100['sentimentRegion'],_0x4193c0['fileText'],_0xed2100['language']);})[_0x99ab('0x1d')](function(_0x306721){logger[_0x99ab('0xa')](util['format'](_0x99ab('0x2e'),_0x4e7b4a['id']));return _0x4e7b4a[_0x99ab('0x1c')]({'sentiment':_0x306721[_0x99ab('0x2f')],'sPositive':_0x306721['SentimentScore'][_0x99ab('0x30')],'sNegative':_0x306721[_0x99ab('0x31')][_0x99ab('0x32')],'sMixed':_0x306721[_0x99ab('0x31')][_0x99ab('0x33')],'sNeutral':_0x306721[_0x99ab('0x31')][_0x99ab('0x34')]});})['then'](function(){logger['info'](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));_0x3b3bba();});case'FAILED':return _0x4e7b4a[_0x99ab('0x1c')]({'transcribeStatus':_0x99ab('0x35'),'failureReason':_0x4299ae[_0x99ab('0x11')]['FailureReason']})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x1e'),_0x4e7b4a['id']));_0x3b3bba();});default:logger[_0x99ab('0xa')](util['format'](_0x99ab('0x36'),_0x4e7b4a['id']));break;}}else{return BPromise[_0x99ab('0x37')]()['then'](function(){if(!_0x4e7b4a[_0x99ab('0x1f')]){throw new db['Sequelize'][(_0x99ab('0x2b'))](_0x99ab('0x21'));}if(!_0xed2100[_0x99ab('0x22')]||!_0xed2100[_0x99ab('0x28')]||!_0xed2100[_0x99ab('0x23')]||!_0xed2100[_0x99ab('0x24')]||!_0xed2100[_0x99ab('0x25')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x26'));}if(!_0x4e7b4a['fileText']){throw new Error(_0x99ab('0x27'));}if(_0xed2100[_0x99ab('0x28')]===_0x24229c['id']){return _0x24229c;}else{return db['CloudProvider'][_0x99ab('0x2a')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x99ab('0x1d')](function(_0x5bee18){if(!_0x5bee18){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x38'));}if(!_0x5bee18[_0x99ab('0x2c')]||!_0x5bee18['data2']){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x2d'));}_0x3739fb=_0x5bee18;logger[_0x99ab('0xa')](util[_0x99ab('0xf')](_0x99ab('0x39'),_0x4e7b4a['id']));return sentiment(_0x3739fb[_0x99ab('0x2c')],_0x3739fb[_0x99ab('0xd')],_0xed2100[_0x99ab('0x23')],_0x4e7b4a[_0x99ab('0x13')],_0xed2100[_0x99ab('0x24')]);})[_0x99ab('0x1d')](function(_0x48648d){logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4e7b4a['id']));return _0x4e7b4a[_0x99ab('0x1c')]({'sentiment':_0x48648d[_0x99ab('0x2f')],'sPositive':_0x48648d['SentimentScore'][_0x99ab('0x30')],'sNegative':_0x48648d[_0x99ab('0x31')][_0x99ab('0x32')],'sMixed':_0x48648d[_0x99ab('0x31')][_0x99ab('0x33')],'sNeutral':_0x48648d[_0x99ab('0x31')][_0x99ab('0x34')],'transcribeStatus':_0x99ab('0x14')});})[_0x99ab('0x1d')](function(){logger[_0x99ab('0xa')](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4e7b4a['id']));_0x3b3bba();});}})[_0x99ab('0x3a')](function(_0x313cd0){if(_0x313cd0){if(!_0x313cd0[_0x99ab('0x3b')]||_0x313cd0[_0x99ab('0x3b')]!=='SequelizeValidationError'){logger['error'](util[_0x99ab('0xf')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4e7b4a['id']),util[_0x99ab('0x3c')](_0x313cd0,{'showHidden':![],'depth':null}));}}_0x3b3bba();});});}function checkTranscribe(){var _0xd44d36;var _0x241345;var _0x3953dc;return db[_0x99ab('0x3d')][_0x99ab('0x3e')]({'where':{'transcribeStatus':_0x99ab('0x3f')}})['then'](function(_0x441d2e){if(!_0x441d2e||!_0x441d2e[_0x99ab('0x1a')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x40'));}_0xd44d36=_0x441d2e;return db[_0x99ab('0x41')][_0x99ab('0x2a')]({'where':{'id':0x1}});})[_0x99ab('0x1d')](function(_0x3b6e32){if(!_0x3b6e32){throw new db[(_0x99ab('0x20'))]['ValidationError'](_0x99ab('0x42'));}_0x241345=_0x3b6e32;if(!_0x241345[_0x99ab('0x6')]||!_0x241345['transcribeAccountId']||!_0x241345[_0x99ab('0xe')]||!_0x241345[_0x99ab('0x24')]||!_0x241345[_0x99ab('0x25')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x43'));}return db[_0x99ab('0x29')]['findOne']({'where':{'id':_0x241345[_0x99ab('0x44')]}});})[_0x99ab('0x1d')](function(_0x46814a){if(!_0x46814a){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x46814a['data1']||!_0x46814a[_0x99ab('0xd')]){throw new db[(_0x99ab('0x20'))][(_0x99ab('0x2b'))](_0x99ab('0x2d'));}_0x3953dc=_0x46814a;var _0x5af4a6=[];_0xd44d36[_0x99ab('0x45')](function(_0x498078){_0x5af4a6[_0x99ab('0x46')](checkTranscribeJob(_0x498078,_0x241345,_0x3953dc));});return BPromise[_0x99ab('0x47')](_0x5af4a6);})['catch'](function(_0xd93031){if(_0xd93031){if(!_0xd93031[_0x99ab('0x3b')]||_0xd93031[_0x99ab('0x3b')]!=='SequelizeValidationError'){logger[_0x99ab('0x48')](util[_0x99ab('0x3c')](_0xd93031,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0cfa=['results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','Sequelize','Sentiment','COMPLETED','catch','name','SequelizeValidationError','error','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0xef4cf0,_0x16c9c3){var _0x497ad2=function(_0xce63d4){while(--_0xce63d4){_0xef4cf0['push'](_0xef4cf0['shift']());}};_0x497ad2(++_0x16c9c3);}(_0x0cfa,0x73));var _0xa0cf=function(_0x59b7b6,_0x21b9ba){_0x59b7b6=_0x59b7b6-0x0;var _0x164704=_0x0cfa[_0x59b7b6];return _0x164704;};var _=require(_0xa0cf('0x0'));var AWS=require(_0xa0cf('0x1'));var rp=require(_0xa0cf('0x2'));var util=require(_0xa0cf('0x3'));var BPromise=require(_0xa0cf('0x4'));var db=require(_0xa0cf('0x5'))['db'];var logger=require('../../config/logger')(_0xa0cf('0x6'));function getTranscriptionJob(_0x579809,_0x142a76,_0x17597b,_0x260049){return new Promise(function(_0x265c33,_0x848d37){var _0x3235b4=new AWS[(_0xa0cf('0x7'))]({'accessKeyId':_0x142a76,'secretAccessKey':_0x579809,'region':_0x17597b});_0x3235b4[_0xa0cf('0x8')]({'TranscriptionJobName':_0x260049},function(_0x2dbef8,_0x4e2b85){if(_0x2dbef8){return _0x848d37(_0x2dbef8);}else{return _0x265c33(_0x4e2b85);}});});}function sentiment(_0x1905d3,_0x18da4b,_0x1ba1b7,_0x369815,_0xdab099){return new Promise(function(_0x4e8490,_0x21c01f){var _0x2b2424=new AWS['Comprehend']({'accessKeyId':_0x18da4b,'secretAccessKey':_0x1905d3,'region':_0x1ba1b7});_0x2b2424[_0xa0cf('0x9')]({'Text':_0x369815,'LanguageCode':_0xdab099[_0xa0cf('0xa')](0x0,0x2)},function(_0x37510,_0x1cdca3){if(_0x37510){return _0x21c01f(_0x37510);}else{return _0x4e8490(_0x1cdca3);}});});}function checkTranscribeJob(_0x42eee2,_0x1d0a69,_0xc01ea1){var _0x306b30;return new BPromise(function(_0x43a7e8,_0x2350ea){logger['info'](util['format'](_0xa0cf('0xb'),_0x42eee2['id'],_0x42eee2[_0xa0cf('0xc')]));return getTranscriptionJob(_0xc01ea1[_0xa0cf('0xd')],_0xc01ea1[_0xa0cf('0xe')],_0x1d0a69[_0xa0cf('0xf')],_0x42eee2[_0xa0cf('0xc')])[_0xa0cf('0x10')](function(_0x35dc57){logger['info'](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x42eee2['id'],_0x42eee2['transcribeName'],_0x35dc57[_0xa0cf('0x12')][_0xa0cf('0x13')]));if(!_0x42eee2[_0xa0cf('0x14')]){switch(_0x35dc57['TranscriptionJob'][_0xa0cf('0x13')]){case'COMPLETED':var _0x3732fb={'transcribeStatus':_0x35dc57[_0xa0cf('0x12')][_0xa0cf('0x13')],'fileUri':_0x35dc57[_0xa0cf('0x12')][_0xa0cf('0x15')][_0xa0cf('0x16')]};logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Get\x20transcript',_0x42eee2['id']));return rp({'uri':_0x35dc57[_0xa0cf('0x12')]['Transcript'][_0xa0cf('0x16')],'json':!![]})[_0xa0cf('0x10')](function(_0x30274c){logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')](_0xa0cf('0x18'),_0x42eee2['id']));if(_0x30274c&&_0x30274c['results']&&_0x30274c[_0xa0cf('0x19')][_0xa0cf('0x1a')]&&_0x30274c['results'][_0xa0cf('0x1a')][_0xa0cf('0x1b')]){_0x3732fb[_0xa0cf('0x14')]='';for(var _0x476ff9=0x0;_0x476ff9<_0x30274c[_0xa0cf('0x19')]['transcripts'][_0xa0cf('0x1b')];_0x476ff9++){_0x3732fb['fileText']+=_0x30274c['results'][_0xa0cf('0x1a')][_0x476ff9][_0xa0cf('0x1c')]+'';}}return _0x42eee2[_0xa0cf('0x1d')](_0x3732fb);})['then'](function(){logger['info'](util['format'](_0xa0cf('0x1e'),_0x42eee2['id']));if(!_0x42eee2[_0xa0cf('0x1f')]){throw new db['Sequelize'][(_0xa0cf('0x20'))](_0xa0cf('0x21'));}if(!_0x1d0a69['sentiment']||!_0x1d0a69['sentimentAccountId']||!_0x1d0a69[_0xa0cf('0x22')]||!_0x1d0a69['language']||!_0x1d0a69[_0xa0cf('0x23')]){throw new db['Sequelize']['ValidationError'](_0xa0cf('0x24'));}if(!_0x3732fb[_0xa0cf('0x14')]){throw new Error(_0xa0cf('0x25'));}if(_0x1d0a69[_0xa0cf('0x26')]===_0xc01ea1['id']){return _0xc01ea1;}else{return db[_0xa0cf('0x27')][_0xa0cf('0x28')]({'where':{'id':_settings[_0xa0cf('0x26')]}});}})['then'](function(_0x291ab0){if(!_0x291ab0){throw new db['Sequelize'][(_0xa0cf('0x20'))](_0xa0cf('0x29'));}if(!_0x291ab0['data1']||!_0x291ab0[_0xa0cf('0xe')]){throw new db['Sequelize']['ValidationError'](_0xa0cf('0x2a'));}_0x306b30=_0x291ab0;logger[_0xa0cf('0x17')](util['format'](_0xa0cf('0x2b'),_0x42eee2['id']));return sentiment(_0x306b30[_0xa0cf('0xd')],_0x306b30['data2'],_0x1d0a69['sentimentRegion'],_0x3732fb[_0xa0cf('0x14')],_0x1d0a69[_0xa0cf('0x2c')]);})[_0xa0cf('0x10')](function(_0x40a99e){logger['info'](util[_0xa0cf('0x11')](_0xa0cf('0x2d'),_0x42eee2['id']));return _0x42eee2['update']({'sentiment':_0x40a99e['Sentiment'],'sPositive':_0x40a99e[_0xa0cf('0x2e')][_0xa0cf('0x2f')],'sNegative':_0x40a99e[_0xa0cf('0x2e')][_0xa0cf('0x30')],'sMixed':_0x40a99e[_0xa0cf('0x2e')][_0xa0cf('0x31')],'sNeutral':_0x40a99e[_0xa0cf('0x2e')][_0xa0cf('0x32')]});})[_0xa0cf('0x10')](function(){logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x42eee2['id']));_0x43a7e8();});case _0xa0cf('0x33'):return _0x42eee2['update']({'transcribeStatus':_0xa0cf('0x33'),'failureReason':_0x35dc57[_0xa0cf('0x12')][_0xa0cf('0x34')]})[_0xa0cf('0x10')](function(){logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')](_0xa0cf('0x1e'),_0x42eee2['id']));_0x43a7e8();});default:logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x42eee2['id']));break;}}else{return BPromise['resolve']()[_0xa0cf('0x10')](function(){if(!_0x42eee2['tempSentiment']){throw new db[(_0xa0cf('0x35'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1d0a69['sentiment']||!_0x1d0a69[_0xa0cf('0x26')]||!_0x1d0a69[_0xa0cf('0x22')]||!_0x1d0a69['language']||!_0x1d0a69[_0xa0cf('0x23')]){throw new db['Sequelize']['ValidationError'](_0xa0cf('0x24'));}if(!_0x42eee2['fileText']){throw new Error(_0xa0cf('0x25'));}if(_0x1d0a69[_0xa0cf('0x26')]===_0xc01ea1['id']){return _0xc01ea1;}else{return db[_0xa0cf('0x27')][_0xa0cf('0x28')]({'where':{'id':_settings[_0xa0cf('0x26')]}});}})['then'](function(_0x2cb354){if(!_0x2cb354){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))](_0xa0cf('0x29'));}if(!_0x2cb354[_0xa0cf('0xd')]||!_0x2cb354[_0xa0cf('0xe')]){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x306b30=_0x2cb354;logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x42eee2['id']));return sentiment(_0x306b30['data1'],_0x306b30[_0xa0cf('0xe')],_0x1d0a69[_0xa0cf('0x22')],_0x42eee2[_0xa0cf('0x14')],_0x1d0a69['language']);})[_0xa0cf('0x10')](function(_0x20cd8d){logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')](_0xa0cf('0x2d'),_0x42eee2['id']));return _0x42eee2[_0xa0cf('0x1d')]({'sentiment':_0x20cd8d[_0xa0cf('0x36')],'sPositive':_0x20cd8d[_0xa0cf('0x2e')][_0xa0cf('0x2f')],'sNegative':_0x20cd8d['SentimentScore'][_0xa0cf('0x30')],'sMixed':_0x20cd8d[_0xa0cf('0x2e')]['Mixed'],'sNeutral':_0x20cd8d[_0xa0cf('0x2e')][_0xa0cf('0x32')],'transcribeStatus':_0xa0cf('0x37')});})[_0xa0cf('0x10')](function(){logger[_0xa0cf('0x17')](util[_0xa0cf('0x11')](_0xa0cf('0x1e'),_0x42eee2['id']));_0x43a7e8();});}})[_0xa0cf('0x38')](function(_0x2a8fdc){if(_0x2a8fdc){if(!_0x2a8fdc[_0xa0cf('0x39')]||_0x2a8fdc['name']!==_0xa0cf('0x3a')){logger[_0xa0cf('0x3b')](util[_0xa0cf('0x11')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x42eee2['id']),util[_0xa0cf('0x3c')](_0x2a8fdc,{'showHidden':![],'depth':null}));}}_0x43a7e8();});});}function checkTranscribe(){var _0x14efa3;var _0x4326d6;var _0x842f44;return db['VoiceRecording'][_0xa0cf('0x3d')]({'where':{'transcribeStatus':_0xa0cf('0x3e')}})[_0xa0cf('0x10')](function(_0x36fd69){if(!_0x36fd69||!_0x36fd69[_0xa0cf('0x1b')]){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))](_0xa0cf('0x3f'));}_0x14efa3=_0x36fd69;return db['Setting'][_0xa0cf('0x28')]({'where':{'id':0x1}});})[_0xa0cf('0x10')](function(_0x12110c){if(!_0x12110c){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))](_0xa0cf('0x40'));}_0x4326d6=_0x12110c;if(!_0x4326d6[_0xa0cf('0x6')]||!_0x4326d6[_0xa0cf('0x41')]||!_0x4326d6[_0xa0cf('0xf')]||!_0x4326d6[_0xa0cf('0x2c')]||!_0x4326d6['bucket']){throw new db['Sequelize'][(_0xa0cf('0x20'))]('Transcribe\x20not\x20configured');}return db[_0xa0cf('0x27')][_0xa0cf('0x28')]({'where':{'id':_0x4326d6[_0xa0cf('0x41')]}});})[_0xa0cf('0x10')](function(_0x5b4c1c){if(!_0x5b4c1c){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))](_0xa0cf('0x29'));}if(!_0x5b4c1c[_0xa0cf('0xd')]||!_0x5b4c1c[_0xa0cf('0xe')]){throw new db[(_0xa0cf('0x35'))][(_0xa0cf('0x20'))](_0xa0cf('0x2a'));}_0x842f44=_0x5b4c1c;var _0x5a7ea1=[];_0x14efa3[_0xa0cf('0x42')](function(_0x3e5d6d){_0x5a7ea1[_0xa0cf('0x43')](checkTranscribeJob(_0x3e5d6d,_0x4326d6,_0x842f44));});return BPromise[_0xa0cf('0x44')](_0x5a7ea1);})[_0xa0cf('0x38')](function(_0x8bcf06){if(_0x8bcf06){if(!_0x8bcf06[_0xa0cf('0x39')]||_0x8bcf06[_0xa0cf('0x39')]!==_0xa0cf('0x3a')){logger[_0xa0cf('0x3b')](util[_0xa0cf('0x3c')](_0x8bcf06,{'showHidden':![],'depth':null}));}}});}exports[_0xa0cf('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 10288df..aee6bd7 100644 --- a/server/config/schedule/whatsapp.js +++ b/server/config/schedule/whatsapp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d0d=['redis','defaults','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule'];(function(_0x230ea7,_0x5225da){var _0x123485=function(_0x1979b2){while(--_0x1979b2){_0x230ea7['push'](_0x230ea7['shift']());}};_0x123485(++_0x5225da);}(_0x3d0d,0x144));var _0xd3d0=function(_0x29b551,_0x25b753){_0x29b551=_0x29b551-0x0;var _0x3b6101=_0x3d0d[_0x29b551];return _0x3b6101;};'use strict';var _=require(_0xd3d0('0x0'));var moment=require('moment');var Redis=require(_0xd3d0('0x1'));var util=require('util');var config=require(_0xd3d0('0x2'));var db=require(_0xd3d0('0x3'))['db'];var logger=require(_0xd3d0('0x4'))(_0xd3d0('0x5'));config[_0xd3d0('0x6')]=_[_0xd3d0('0x7')](config[_0xd3d0('0x6')],{'host':_0xd3d0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd3d0('0x6')]));function closeInteractions(){var _0x3e2c1d=[];return db[_0xd3d0('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xd3d0('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd3d0('0xb')](0x18,_0xd3d0('0xc'))}}})[_0xd3d0('0xd')](function(_0x468921){if(_0x468921&&_0x468921[_0xd3d0('0xe')]){_0x3e2c1d=_[_0xd3d0('0xf')](_0x468921||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e2c1d[_0xd3d0('0x10')]());return db[_0xd3d0('0x9')][_0xd3d0('0x11')]({'closeReason':_0xd3d0('0x12'),'disposition':_0xd3d0('0x13'),'closed':!![],'closedAt':moment()[_0xd3d0('0x14')](_0xd3d0('0x15'))},{'where':{'id':_0x3e2c1d}});}})[_0xd3d0('0xd')](function(){if(_0x3e2c1d&&_0x3e2c1d['length']){logger['info'](_0xd3d0('0x16'),_0x3e2c1d[_0xd3d0('0x10')]());for(var _0xcea781=0x0;_0xcea781<_0x3e2c1d['length'];_0xcea781++){io[_0xd3d0('0x17')](_0xd3d0('0x18'),{'id':_0x3e2c1d[_0xcea781],'closed':!![]});}}})[_0xd3d0('0x19')](function(_0x484ba0){logger[_0xd3d0('0x1a')](_0xd3d0('0x1b'),_0x484ba0?util[_0xd3d0('0x1c')](_0x484ba0,{'showHidden':![],'depth':null}):'');});}exports[_0xd3d0('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0893=['then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','join','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction','subtract','hours'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0893,0x138));var _0x3089=function(_0x5040f4,_0x526e5d){_0x5040f4=_0x5040f4-0x0;var _0xb02202=_0x0893[_0x5040f4];return _0xb02202;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var config=require(_0x3089('0x2'));var db=require(_0x3089('0x3'))['db'];var logger=require('../logger')(_0x3089('0x4'));config['redis']=_[_0x3089('0x5')](config[_0x3089('0x6')],{'host':_0x3089('0x7'),'port':0x18eb});var io=require(_0x3089('0x8'))(new Redis(config[_0x3089('0x6')]));function closeInteractions(){var _0x2bd9ec=[];return db[_0x3089('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3089('0xa')](0x18,_0x3089('0xb'))}}})[_0x3089('0xc')](function(_0x42ed59){if(_0x42ed59&&_0x42ed59[_0x3089('0xd')]){_0x2bd9ec=_[_0x3089('0xe')](_0x42ed59||[],'id');logger[_0x3089('0xf')](_0x3089('0x10'),_0x2bd9ec['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x3089('0x11'),'disposition':_0x3089('0x12'),'closed':!![],'closedAt':moment()[_0x3089('0x13')](_0x3089('0x14'))},{'where':{'id':_0x2bd9ec}});}})['then'](function(){if(_0x2bd9ec&&_0x2bd9ec['length']){logger[_0x3089('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2bd9ec[_0x3089('0x15')]());for(var _0x398a05=0x0;_0x398a05<_0x2bd9ec[_0x3089('0xd')];_0x398a05++){io['emit']('whatsappInteraction:update',{'id':_0x2bd9ec[_0x398a05],'closed':!![]});}}})[_0x3089('0x16')](function(_0x559393){logger[_0x3089('0x17')](_0x3089('0x18'),_0x559393?util[_0x3089('0x19')](_0x559393,{'showHidden':![],'depth':null}):'');});}exports[_0x3089('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6dcd1e8..8b90ccb 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcedb=['log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate'];(function(_0x63de62,_0xe5cc89){var _0x3daddf=function(_0x2a5d79){while(--_0x2a5d79){_0x63de62['push'](_0x63de62['shift']());}};_0x3daddf(++_0xe5cc89);}(_0xcedb,0x116));var _0xbced=function(_0x26287a,_0x12c88b){_0x26287a=_0x26287a-0x0;var _0x4210d4=_0xcedb[_0x26287a];return _0x4210d4;};'use strict';var util=require(_0xbced('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbced('0x1')]({'id':i,'firstName':_0xbced('0x2')+i,'lastName':_0xbced('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbced('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xbced('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xbced('0x2')+i,'lastName':_0xbced('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xbced('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xbced('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbced('0x4')](),'updatedAt':Date['now']()});}db[_0xbced('0x6')][_0xbced('0x7')]({'where':{}})[_0xbced('0x8')](function(){return db['CmContact'][_0xbced('0x9')](contacts);})[_0xbced('0x8')](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xc'));return db[_0xbced('0xd')][_0xbced('0x7')]({'where':{}});})['then'](function(){return db[_0xbced('0xd')][_0xbced('0x9')](hopper);})['then'](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xe'));return db['CmContact'][_0xbced('0x9')](contacts2);})[_0xbced('0x8')](function(){console[_0xbced('0xa')](_0xbced('0xb'),_0xbced('0xf'));return db[_0xbced('0xd')]['bulkCreate'](hopper2);})[_0xbced('0x8')](function(){console['log']('finished\x20populating',_0xbced('0x10'));})[_0xbced('0x11')](function(_0x3b1c2d){console[_0xbced('0xa')](_0x3b1c2d);}); \ No newline at end of file +var _0x086e=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x2d4857,_0x2da785){var _0x57f4b1=function(_0x3f9bde){while(--_0x3f9bde){_0x2d4857['push'](_0x2d4857['shift']());}};_0x57f4b1(++_0x2da785);}(_0x086e,0x1c9));var _0xe086=function(_0x20c757,_0xf1f53b){_0x20c757=_0x20c757-0x0;var _0x2720f3=_0x086e[_0x20c757];return _0x2720f3;};'use strict';var util=require(_0xe086('0x0'));var db=require(_0xe086('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xe086('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xe086('0x3')+i,'phone':0xf879fb460+i,'email':_0xe086('0x4')+i+_0xe086('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xe086('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xe086('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe086('0x6')](),'updatedAt':Date[_0xe086('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xe086('0x7')+i,'lastName':_0xe086('0x3')+i,'phone':0xf879fb460+i,'email':_0xe086('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xe086('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xe086('0x6')](),'updatedAt':Date['now']()});}db[_0xe086('0x8')][_0xe086('0x9')]({'where':{}})[_0xe086('0xa')](function(){return db[_0xe086('0x8')][_0xe086('0xb')](contacts);})[_0xe086('0xa')](function(){console[_0xe086('0xc')]('finished\x20populating',_0xe086('0xd'));return db[_0xe086('0xe')][_0xe086('0x9')]({'where':{}});})['then'](function(){return db[_0xe086('0xe')][_0xe086('0xb')](hopper);})['then'](function(){console[_0xe086('0xc')](_0xe086('0xf'),_0xe086('0x10'));return db[_0xe086('0x8')][_0xe086('0xb')](contacts2);})[_0xe086('0xa')](function(){console['log']('finished\x20populating',_0xe086('0x11'));return db['CmHopper'][_0xe086('0xb')](hopper2);})[_0xe086('0xa')](function(){console[_0xe086('0xc')](_0xe086('0xf'),_0xe086('0x12'));})[_0xe086('0x13')](function(_0x362eba){console[_0xe086('0xc')](_0x362eba);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 9cf6d09..16174ef 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb65=['password','friend','udp','wss','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb65,0xa5));var _0x5eb6=function(_0x8391,_0x276214){_0x8391=_0x8391-0x0;var _0x4d36bd=_0xeb65[_0x8391];return _0x4d36bd;};'use strict';var util=require(_0x5eb6('0x0'));var db=require(_0x5eb6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x5eb6('0x2')](_0x5eb6('0x3'),'agent',i),'fullname':util[_0x5eb6('0x2')](_0x5eb6('0x3'),_0x5eb6('0x4'),i),'email':util[_0x5eb6('0x2')](_0x5eb6('0x5'),'agent',i),'role':'agent','password':_0x5eb6('0x6'),'internal':0xfa0+i,'type':_0x5eb6('0x7'),'transport':[_0x5eb6('0x8'),'ws',_0x5eb6('0x9')],'disallow':['all'],'allow':[_0x5eb6('0xa')],'defaultuser':util[_0x5eb6('0x2')]('%s%s',_0x5eb6('0x4'),i),'encryption':_0x5eb6('0xb'),'avpf':_0x5eb6('0xb'),'force_avp':_0x5eb6('0xb'),'icesupport':_0x5eb6('0xb'),'dtlsenable':_0x5eb6('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x5eb6('0xc'),'dtlssetup':_0x5eb6('0xd'),'callerid':util[_0x5eb6('0x2')](_0x5eb6('0xe'),util[_0x5eb6('0x2')](_0x5eb6('0x3'),_0x5eb6('0x4'),i),0xfa0+i)});}db[_0x5eb6('0xf')][_0x5eb6('0x10')](users)['then'](function(){console[_0x5eb6('0x11')]('add\x20user');})[_0x5eb6('0x12')](function(_0x54b913){console[_0x5eb6('0x11')](_0x54b913);}); \ No newline at end of file +var _0xffa5=['log','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','friend','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','add\x20user','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffa5,0x144));var _0x5ffa=function(_0x554316,_0x22f68b){_0x554316=_0x554316-0x0;var _0x10e509=_0xffa5[_0x554316];return _0x10e509;};'use strict';var util=require(_0x5ffa('0x0'));var db=require(_0x5ffa('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5ffa('0x2')]({'name':util['format'](_0x5ffa('0x3'),_0x5ffa('0x4'),i),'fullname':util[_0x5ffa('0x5')](_0x5ffa('0x3'),_0x5ffa('0x4'),i),'email':util['format'](_0x5ffa('0x6'),_0x5ffa('0x4'),i),'role':_0x5ffa('0x4'),'password':'password','internal':0xfa0+i,'type':_0x5ffa('0x7'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0x5ffa('0x3'),'agent',i),'encryption':_0x5ffa('0x8'),'avpf':_0x5ffa('0x8'),'force_avp':_0x5ffa('0x8'),'icesupport':'yes','dtlsenable':_0x5ffa('0x8'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5ffa('0x9'),'callerid':util[_0x5ffa('0x5')](_0x5ffa('0xa'),util[_0x5ffa('0x5')](_0x5ffa('0x3'),'agent',i),0xfa0+i)});}db[_0x5ffa('0xb')][_0x5ffa('0xc')](users)[_0x5ffa('0xd')](function(){console['log'](_0x5ffa('0xe'));})[_0x5ffa('0xf')](function(_0x5e202b){console[_0x5ffa('0x10')](_0x5e202b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 0dafcfa..8db85a7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6343=['UserProfileResource','then','map','resourceId','User','where','type','format','Agents','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','ChatQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','catch','join','default','connection','address','request','remotePort','connectedAt','log','SocketIO\x20','CONNECTED','bluebird','../mysqldb','name','role','telephone','agent','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns'];(function(_0x218fb1,_0x2aa008){var _0x57a5c3=function(_0x5babba){while(--_0x5babba){_0x218fb1['push'](_0x218fb1['shift']());}};_0x57a5c3(++_0x2aa008);}(_0x6343,0x168));var _0x3634=function(_0x66a03b,_0x264ec3){_0x66a03b=_0x66a03b-0x0;var _0x896fb8=_0x6343[_0x66a03b];return _0x896fb8;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x3634('0x0'));var db=require(_0x3634('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x3634('0x2'),_0x3634('0x3')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3634('0x2')],'where':{'role':_0x3634('0x4')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3634('0x2')],'where':{'role':_0x3634('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x3634('0x6')}};function getAssociatedResources(_0x1bcdb2,_0xfac918,_0x3c813b){return db[_0x3634('0x7')][_0x3634('0x8')]({'where':{'name':_0x1bcdb2,'userProfileId':_0xfac918},'raw':!![]})['then'](function(_0x4b965a){if(_0x4b965a){if(_0x4b965a[_0x3634('0x9')]){switch(_0x1bcdb2){case _0x3634('0xa'):case'ChatQueues':case _0x3634('0xb'):case _0x3634('0xc'):case _0x3634('0xd'):case _0x3634('0xe'):case _0x3634('0xf'):return db[_0x3c813b][_0x3634('0x10')](queryQueues);case _0x3634('0x11'):return db[_0x3c813b][_0x3634('0x10')](queryTelephones);case _0x3634('0x12'):return db[_0x3c813b][_0x3634('0x10')](queryTrunks);case _0x3634('0x13'):return db[_0x3c813b][_0x3634('0x10')](queryCampaigns);}}else{return db[_0x3634('0x14')][_0x3634('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x4b965a['id']},'raw':!![]})[_0x3634('0x15')](function(_0x48787f){if(_0x48787f){var _0x69609d={'where':{'id':_[_0x3634('0x16')](_0x48787f,_0x3634('0x17'))},'raw':!![]};switch(_0x3c813b){case _0x3634('0x18'):_0x69609d[_0x3634('0x19')]['role']=_0x3634('0x4');break;case'Campaign':_0x69609d['where'][_0x3634('0x1a')]='ivr';break;}return db[_0x3c813b][_0x3634('0x10')](_0x69609d);}else{return[];}});}}else{return[];}})[_0x3634('0x15')](function(_0x1e4f1d){return _0x1e4f1d;});}function joinOrLeaveQueues(_0x5603d2,_0x3ab7a5,_0x4366bc,_0x577a6c){_0x5603d2[_0x3ab7a5](util[_0x3634('0x1b')]('%s:queue:%s',_0x4366bc,_0x577a6c[_0x3634('0x2')]));if(_0x577a6c[_0x3634('0x1c')]){for(var _0x5b77a7=0x0;_0x5b77a7<_0x577a6c[_0x3634('0x1c')][_0x3634('0x1d')];_0x5b77a7+=0x1){_0x5603d2[_0x3ab7a5](util[_0x3634('0x1b')]('user:%s',_0x577a6c[_0x3634('0x1c')][_0x5b77a7][_0x3634('0x2')]));}}}function joinOrLeave(_0x52652d,_0x3936ee,_0x596acb){var _0x5e9188;if(_0x52652d[_0x3634('0x1e')][_0x3634('0x1f')]['id']){db['User'][_0x3634('0x20')]({'attributes':['id',_0x3634('0x2'),_0x3634('0x3'),_0x3634('0x21')],'where':{'id':_0x52652d[_0x3634('0x1e')][_0x3634('0x1f')]['id']},'include':[{'model':db[_0x3634('0x22')],'as':_0x3634('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3634('0x27')],'as':_0x3634('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x55a77f){if(_0x55a77f){_0x5e9188=_0x55a77f;_0x52652d[_0x3936ee](util[_0x3634('0x1b')]('user:%s',_0x55a77f[_0x3634('0x2')]));var _0x5d273c=[];switch(_0x55a77f[_0x3634('0x3')]){case _0x3634('0x29'):_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));if(queryQueues[_0x3634('0x2c')](_0x3634('0x2d'))){delete queryQueues[_0x3634('0x2d')];}_0x5d273c[_0x3634('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x5d273c['push'](db[_0x3634('0x2f')]['findAll'](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x30')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x31')][_0x3634('0x10')](queryQueues));_0x5d273c['push'](db[_0x3634('0x32')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x33')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x34')][_0x3634('0x10')](queryQueues));_0x5d273c[_0x3634('0x2e')](db['User'][_0x3634('0x10')](queryTelephones));_0x5d273c[_0x3634('0x2e')](db[_0x3634('0x35')][_0x3634('0x10')](queryTrunks));_0x5d273c['push'](db[_0x3634('0x36')][_0x3634('0x10')](queryCampaigns));_0x5d273c[_0x3634('0x2e')](db['User']['findAll'](queryAgents));break;case'user':_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));_0x5d273c['push'](getAssociatedResources(_0x3634('0xa'),_0x55a77f[_0x3634('0x21')],_0x3634('0x37')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0x38'),_0x55a77f[_0x3634('0x21')],_0x3634('0x2f')));_0x5d273c['push'](getAssociatedResources(_0x3634('0xb'),_0x55a77f['userProfileId'],_0x3634('0x30')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xc'),_0x55a77f[_0x3634('0x21')],_0x3634('0x31')));_0x5d273c['push'](getAssociatedResources(_0x3634('0xd'),_0x55a77f[_0x3634('0x21')],_0x3634('0x32')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xe'),_0x55a77f[_0x3634('0x21')],_0x3634('0x33')));_0x5d273c[_0x3634('0x2e')](getAssociatedResources(_0x3634('0xf'),_0x55a77f['userProfileId'],'WhatsappQueue'));_0x5d273c[_0x3634('0x2e')](getAssociatedResources('Telephones',_0x55a77f['userProfileId'],'User'));_0x5d273c[_0x3634('0x2e')](getAssociatedResources('Trunks',_0x55a77f[_0x3634('0x21')],_0x3634('0x35')));_0x5d273c['push'](getAssociatedResources('IvrCampaigns',_0x55a77f['userProfileId'],_0x3634('0x36')));_0x5d273c[_0x3634('0x2e')](db['User'][_0x3634('0x10')](queryAgents));break;case _0x3634('0x5'):_0x52652d[_0x3936ee](_0x3634('0x2a'));_0x52652d[_0x3936ee](_0x3634('0x2b'));_0x5d273c[_0x3634('0x2e')](_0x55a77f['getVoiceQueues']({'attributes':['id','name']}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x39')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3a')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c['push'](_0x55a77f[_0x3634('0x3b')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f['getMailQueues']({'attributes':['id','name']}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3c')]({'attributes':['id',_0x3634('0x2')]}));_0x5d273c[_0x3634('0x2e')](_0x55a77f[_0x3634('0x3d')]({'attributes':['id',_0x3634('0x2')]}));break;}return BPromise[_0x3634('0x3e')](_0x5d273c);}})[_0x3634('0x15')](function(_0x52de40){if(_0x52de40&&_0x52de40[_0x3634('0x1d')]){for(var _0x3401b8=0x0;_0x3401b8<_0x52de40[_0x3634('0x1d')];_0x3401b8+=0x1){for(var _0x23f359=0x0;_0x23f359<_0x52de40[_0x3401b8][_0x3634('0x1d')];_0x23f359+=0x1){switch(_0x3401b8){case 0x0:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x3f'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x1:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x40'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x2:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x41'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x3:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x42'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x4:joinOrLeaveQueues(_0x52652d,_0x3936ee,'mail',_0x52de40[_0x3401b8][_0x23f359]);break;case 0x5:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x43'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x6:joinOrLeaveQueues(_0x52652d,_0x3936ee,_0x3634('0x44'),_0x52de40[_0x3401b8][_0x23f359]);break;case 0x7:if(_0x5e9188['role']!==_0x3634('0x5'))_0x52652d[_0x3936ee](util[_0x3634('0x1b')](_0x3634('0x45'),_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0x8:if(_0x5e9188[_0x3634('0x3')]!==_0x3634('0x5'))_0x52652d[_0x3936ee](util['format'](_0x3634('0x46'),_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0x9:if(_0x5e9188[_0x3634('0x3')]!==_0x3634('0x5'))_0x52652d[_0x3936ee](util[_0x3634('0x1b')]('campaign:%s:%s',_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x1a')],_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;case 0xa:_0x52652d[_0x3936ee](util['format']('user:%s',_0x52de40[_0x3401b8][_0x23f359][_0x3634('0x2')]));break;}}}}})['then'](function(){if(_0x3936ee===_0x3634('0x47')){var _0x475b37=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x23')],'id');return _0x5e9188['removeChatInteractions'](_0x475b37)[_0x3634('0x15')](function(){for(var _0x26d8d0=0x0;_0x26d8d0<_0x475b37[_0x3634('0x1d')];_0x26d8d0+=0x1){_0x596acb[_0x3634('0x48')](_0x3634('0x49'),{'ChatInteractionId':Number(_0x475b37[_0x26d8d0]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0xc83a28=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x4a')],'id');return _0x5e9188[_0x3634('0x4b')](_0xc83a28)[_0x3634('0x15')](function(){for(var _0x557438=0x0;_0x557438<_0xc83a28[_0x3634('0x1d')];_0x557438+=0x1){_0x596acb[_0x3634('0x48')](_0x3634('0x4c'),{'MailInteractionId':Number(_0xc83a28[_0x557438]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x15f414=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x4d')],'id');return _0x5e9188[_0x3634('0x4e')](_0x15f414)['then'](function(){for(var _0x2bcb9e=0x0;_0x2bcb9e<_0x15f414[_0x3634('0x1d')];_0x2bcb9e+=0x1){_0x596acb['emit'](_0x3634('0x4f'),{'FaxInteractionId':Number(_0x15f414[_0x2bcb9e]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee==='leave'){var _0x1089c2=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x50')],'id');return _0x5e9188['removeSmsInteractions'](_0x1089c2)[_0x3634('0x15')](function(){for(var _0x53da29=0x0;_0x53da29<_0x1089c2[_0x3634('0x1d')];_0x53da29+=0x1){_0x596acb['emit'](_0x3634('0x51'),{'SmsInteractionId':Number(_0x1089c2[_0x53da29]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x5e3788=_[_0x3634('0x16')](_0x5e9188[_0x3634('0x52')],'id');return _0x5e9188['removeOpenchannelInteractions'](_0x5e3788)[_0x3634('0x15')](function(){for(var _0xbc0017=0x0;_0xbc0017<_0x5e3788[_0x3634('0x1d')];_0xbc0017+=0x1){_0x596acb[_0x3634('0x48')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x5e3788[_0xbc0017]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x15')](function(){if(_0x3936ee===_0x3634('0x47')){var _0x55fb3d=_['map'](_0x5e9188['WhatsappInteractions'],'id');return _0x5e9188[_0x3634('0x53')](_0x55fb3d)['then'](function(){for(var _0x1a3205=0x0;_0x1a3205<_0x55fb3d[_0x3634('0x1d')];_0x1a3205+=0x1){_0x596acb[_0x3634('0x48')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x55fb3d[_0x1a3205]),'UserId':Number(_0x5e9188['id'])});}});}})[_0x3634('0x54')](function(_0x3f3dc1){_0x52652d['log'](_0x3f3dc1);});}}function onDisconnect(_0x2f1b5d,_0x1c37f4){joinOrLeave(_0x2f1b5d,_0x3634('0x47'),_0x1c37f4);}function onConnect(_0x5a9808){joinOrLeave(_0x5a9808,_0x3634('0x55'));}exports[_0x3634('0x56')]=function(_0x897c0e){_0x897c0e['on'](_0x3634('0x57'),function(_0x218902){_0x218902['setMaxListeners'](0x0);_0x218902[_0x3634('0x58')]=_0x218902[_0x3634('0x59')][_0x3634('0x57')]['remoteAddress']+':'+_0x218902[_0x3634('0x59')]['connection'][_0x3634('0x5a')];_0x218902[_0x3634('0x5b')]=new Date();_0x218902['log']=function(_0x128461){console[_0x3634('0x5c')](_0x3634('0x5d')+_0x218902['nsp'][_0x3634('0x2')]+'['+_0x218902['address']+']',_0x128461);};_0x218902['on']('disconnect',function(){onDisconnect(_0x218902,_0x897c0e);_0x218902[_0x3634('0x5c')]('DISCONNECTED');});onConnect(_0x218902);_0x218902[_0x3634('0x5c')](_0x3634('0x5e'));});}; \ No newline at end of file +var _0x761c=['ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','SmsQueues','WhatsappQueues','WhatsappQueue','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','sms','mail','whatsapp','trunk:%s','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','emit','leave','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','setMaxListeners','request','connectedAt','log','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','telephone','agent','type','UserProfileSection','findOne','then','ChatQueues','FaxQueues','OpenchannelQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','format','%s:queue:%s','length','user:%s','query','find','userProfileId','handshake'];(function(_0x991d83,_0x1888cd){var _0x45189c=function(_0xb19bec){while(--_0xb19bec){_0x991d83['push'](_0x991d83['shift']());}};_0x45189c(++_0x1888cd);}(_0x761c,0x18a));var _0xc761=function(_0x221143,_0x4402ae){_0x221143=_0x221143-0x0;var _0x6741b9=_0x761c[_0x221143];return _0x6741b9;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var BPromise=require(_0xc761('0x1'));var db=require(_0xc761('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xc761('0x3')],'include':[{'as':_0xc761('0x4'),'model':db[_0xc761('0x5')],'attributes':['id','name',_0xc761('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc761('0x3')],'where':{'role':_0xc761('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc761('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xc761('0x3')],'where':{'role':_0xc761('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc761('0x3'),_0xc761('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x3bdf6f,_0x2cf2e9,_0x175c1c){return db[_0xc761('0xa')][_0xc761('0xb')]({'where':{'name':_0x3bdf6f,'userProfileId':_0x2cf2e9},'raw':!![]})[_0xc761('0xc')](function(_0x205c96){if(_0x205c96){if(_0x205c96['autoAssociation']){switch(_0x3bdf6f){case'VoiceQueues':case _0xc761('0xd'):case _0xc761('0xe'):case'SmsQueues':case'MailQueues':case _0xc761('0xf'):case'WhatsappQueues':return db[_0x175c1c][_0xc761('0x10')](queryQueues);case'Telephones':return db[_0x175c1c][_0xc761('0x10')](queryTelephones);case'Trunks':return db[_0x175c1c][_0xc761('0x10')](queryTrunks);case _0xc761('0x11'):return db[_0x175c1c][_0xc761('0x10')](queryCampaigns);}}else{return db[_0xc761('0x12')][_0xc761('0x10')]({'attributes':[_0xc761('0x13')],'where':{'sectionId':_0x205c96['id']},'raw':!![]})[_0xc761('0xc')](function(_0x5d83cc){if(_0x5d83cc){var _0x4c487e={'where':{'id':_[_0xc761('0x14')](_0x5d83cc,_0xc761('0x13'))},'raw':!![]};switch(_0x175c1c){case _0xc761('0x5'):_0x4c487e['where'][_0xc761('0x6')]=_0xc761('0x7');break;case _0xc761('0x15'):_0x4c487e[_0xc761('0x16')][_0xc761('0x9')]='ivr';break;}return db[_0x175c1c]['findAll'](_0x4c487e);}else{return[];}});}}else{return[];}})[_0xc761('0xc')](function(_0x3d5913){return _0x3d5913;});}function joinOrLeaveQueues(_0x5dfd75,_0x49177e,_0x3bebd6,_0x40d48d){_0x5dfd75[_0x49177e](util[_0xc761('0x17')](_0xc761('0x18'),_0x3bebd6,_0x40d48d[_0xc761('0x3')]));if(_0x40d48d['Agents']){for(var _0x2863a9=0x0;_0x2863a9<_0x40d48d[_0xc761('0x4')][_0xc761('0x19')];_0x2863a9+=0x1){_0x5dfd75[_0x49177e](util[_0xc761('0x17')](_0xc761('0x1a'),_0x40d48d['Agents'][_0x2863a9][_0xc761('0x3')]));}}}function joinOrLeave(_0x2043e0,_0xb48d6b,_0x13a002){var _0x47c0d9;if(_0x2043e0['handshake'][_0xc761('0x1b')]['id']){db[_0xc761('0x5')][_0xc761('0x1c')]({'attributes':['id',_0xc761('0x3'),_0xc761('0x6'),_0xc761('0x1d')],'where':{'id':_0x2043e0[_0xc761('0x1e')][_0xc761('0x1b')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xc761('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xc761('0x20')],'as':_0xc761('0x21'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc761('0x22')],'as':_0xc761('0x23'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xc761('0x24'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xc761('0x25'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x47eda8){if(_0x47eda8){_0x47c0d9=_0x47eda8;_0x2043e0[_0xb48d6b](util['format'](_0xc761('0x1a'),_0x47eda8[_0xc761('0x3')]));var _0x358d64=[];switch(_0x47eda8[_0xc761('0x6')]){case'admin':_0x2043e0[_0xb48d6b](_0xc761('0x26'));_0x2043e0[_0xb48d6b](_0xc761('0x27'));if(queryQueues[_0xc761('0x28')](_0xc761('0x29'))){delete queryQueues[_0xc761('0x29')];}_0x358d64['push'](db[_0xc761('0x2a')][_0xc761('0x10')](queryQueues));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x2c')][_0xc761('0x10')](queryQueues));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x2d')][_0xc761('0x10')](queryQueues));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x2e')]['findAll'](queryQueues));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x2f')]['findAll'](queryQueues));_0x358d64['push'](db[_0xc761('0x30')][_0xc761('0x10')](queryQueues));_0x358d64[_0xc761('0x2b')](db['WhatsappQueue']['findAll'](queryQueues));_0x358d64['push'](db[_0xc761('0x5')][_0xc761('0x10')](queryTelephones));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x31')]['findAll'](queryTrunks));_0x358d64[_0xc761('0x2b')](db['Campaign']['findAll'](queryCampaigns));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x5')][_0xc761('0x10')](queryAgents));break;case'user':_0x2043e0[_0xb48d6b](_0xc761('0x26'));_0x2043e0[_0xb48d6b](_0xc761('0x27'));_0x358d64[_0xc761('0x2b')](getAssociatedResources('VoiceQueues',_0x47eda8[_0xc761('0x1d')],_0xc761('0x2a')));_0x358d64[_0xc761('0x2b')](getAssociatedResources('ChatQueues',_0x47eda8[_0xc761('0x1d')],_0xc761('0x2c')));_0x358d64['push'](getAssociatedResources(_0xc761('0xe'),_0x47eda8['userProfileId'],'FaxQueue'));_0x358d64[_0xc761('0x2b')](getAssociatedResources(_0xc761('0x32'),_0x47eda8[_0xc761('0x1d')],_0xc761('0x2e')));_0x358d64['push'](getAssociatedResources('MailQueues',_0x47eda8[_0xc761('0x1d')],_0xc761('0x2f')));_0x358d64[_0xc761('0x2b')](getAssociatedResources(_0xc761('0xf'),_0x47eda8[_0xc761('0x1d')],_0xc761('0x30')));_0x358d64['push'](getAssociatedResources(_0xc761('0x33'),_0x47eda8[_0xc761('0x1d')],_0xc761('0x34')));_0x358d64[_0xc761('0x2b')](getAssociatedResources('Telephones',_0x47eda8['userProfileId'],_0xc761('0x5')));_0x358d64[_0xc761('0x2b')](getAssociatedResources('Trunks',_0x47eda8[_0xc761('0x1d')],_0xc761('0x31')));_0x358d64[_0xc761('0x2b')](getAssociatedResources(_0xc761('0x11'),_0x47eda8[_0xc761('0x1d')],'Campaign'));_0x358d64[_0xc761('0x2b')](db[_0xc761('0x5')][_0xc761('0x10')](queryAgents));break;case'agent':_0x2043e0[_0xb48d6b](_0xc761('0x26'));_0x2043e0[_0xb48d6b]('voice:outbound');_0x358d64['push'](_0x47eda8['getVoiceQueues']({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8['getChatQueues']({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8[_0xc761('0x35')]({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8['getSmsQueues']({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8[_0xc761('0x36')]({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8[_0xc761('0x37')]({'attributes':['id',_0xc761('0x3')]}));_0x358d64[_0xc761('0x2b')](_0x47eda8[_0xc761('0x38')]({'attributes':['id',_0xc761('0x3')]}));break;}return BPromise[_0xc761('0x39')](_0x358d64);}})[_0xc761('0xc')](function(_0x5c27a1){if(_0x5c27a1&&_0x5c27a1[_0xc761('0x19')]){for(var _0x5148d7=0x0;_0x5148d7<_0x5c27a1['length'];_0x5148d7+=0x1){for(var _0x1f2bf3=0x0;_0x1f2bf3<_0x5c27a1[_0x5148d7][_0xc761('0x19')];_0x1f2bf3+=0x1){switch(_0x5148d7){case 0x0:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,_0xc761('0x3a'),_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x1:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,'chat',_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x2:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,'fax',_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x3:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,_0xc761('0x3b'),_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x4:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,_0xc761('0x3c'),_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x5:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,'openchannel',_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x6:joinOrLeaveQueues(_0x2043e0,_0xb48d6b,_0xc761('0x3d'),_0x5c27a1[_0x5148d7][_0x1f2bf3]);break;case 0x7:if(_0x47c0d9['role']!=='agent')_0x2043e0[_0xb48d6b](util['format']('telephone:%s',_0x5c27a1[_0x5148d7][_0x1f2bf3][_0xc761('0x3')]));break;case 0x8:if(_0x47c0d9[_0xc761('0x6')]!==_0xc761('0x8'))_0x2043e0[_0xb48d6b](util[_0xc761('0x17')](_0xc761('0x3e'),_0x5c27a1[_0x5148d7][_0x1f2bf3][_0xc761('0x3')]));break;case 0x9:if(_0x47c0d9[_0xc761('0x6')]!=='agent')_0x2043e0[_0xb48d6b](util['format']('campaign:%s:%s',_0x5c27a1[_0x5148d7][_0x1f2bf3]['type'],_0x5c27a1[_0x5148d7][_0x1f2bf3][_0xc761('0x3')]));break;case 0xa:_0x2043e0[_0xb48d6b](util[_0xc761('0x17')](_0xc761('0x1a'),_0x5c27a1[_0x5148d7][_0x1f2bf3][_0xc761('0x3')]));break;}}}}})[_0xc761('0xc')](function(){if(_0xb48d6b==='leave'){var _0x2d5a41=_[_0xc761('0x14')](_0x47c0d9[_0xc761('0x1f')],'id');return _0x47c0d9[_0xc761('0x3f')](_0x2d5a41)[_0xc761('0xc')](function(){for(var _0x32e280=0x0;_0x32e280<_0x2d5a41[_0xc761('0x19')];_0x32e280+=0x1){_0x13a002['emit'](_0xc761('0x40'),{'ChatInteractionId':Number(_0x2d5a41[_0x32e280]),'UserId':Number(_0x47c0d9['id'])});}});}})[_0xc761('0xc')](function(){if(_0xb48d6b==='leave'){var _0x4b2f08=_[_0xc761('0x14')](_0x47c0d9[_0xc761('0x21')],'id');return _0x47c0d9[_0xc761('0x41')](_0x4b2f08)['then'](function(){for(var _0x3584d4=0x0;_0x3584d4<_0x4b2f08[_0xc761('0x19')];_0x3584d4+=0x1){_0x13a002['emit'](_0xc761('0x42'),{'MailInteractionId':Number(_0x4b2f08[_0x3584d4]),'UserId':Number(_0x47c0d9['id'])});}});}})[_0xc761('0xc')](function(){if(_0xb48d6b==='leave'){var _0x5cee91=_[_0xc761('0x14')](_0x47c0d9['FaxInteractions'],'id');return _0x47c0d9['removeFaxInteractions'](_0x5cee91)[_0xc761('0xc')](function(){for(var _0x2e7049=0x0;_0x2e7049<_0x5cee91[_0xc761('0x19')];_0x2e7049+=0x1){_0x13a002[_0xc761('0x43')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5cee91[_0x2e7049]),'UserId':Number(_0x47c0d9['id'])});}});}})['then'](function(){if(_0xb48d6b===_0xc761('0x44')){var _0xbd67f0=_[_0xc761('0x14')](_0x47c0d9[_0xc761('0x23')],'id');return _0x47c0d9[_0xc761('0x45')](_0xbd67f0)[_0xc761('0xc')](function(){for(var _0xf0cf1f=0x0;_0xf0cf1f<_0xbd67f0['length'];_0xf0cf1f+=0x1){_0x13a002[_0xc761('0x43')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xbd67f0[_0xf0cf1f]),'UserId':Number(_0x47c0d9['id'])});}});}})[_0xc761('0xc')](function(){if(_0xb48d6b==='leave'){var _0x41a9a4=_[_0xc761('0x14')](_0x47c0d9[_0xc761('0x24')],'id');return _0x47c0d9[_0xc761('0x46')](_0x41a9a4)[_0xc761('0xc')](function(){for(var _0x42ada7=0x0;_0x42ada7<_0x41a9a4['length'];_0x42ada7+=0x1){_0x13a002[_0xc761('0x43')](_0xc761('0x47'),{'OpenchannelInteractionId':Number(_0x41a9a4[_0x42ada7]),'UserId':Number(_0x47c0d9['id'])});}});}})[_0xc761('0xc')](function(){if(_0xb48d6b===_0xc761('0x44')){var _0x2a6064=_[_0xc761('0x14')](_0x47c0d9[_0xc761('0x25')],'id');return _0x47c0d9[_0xc761('0x48')](_0x2a6064)[_0xc761('0xc')](function(){for(var _0x31c25a=0x0;_0x31c25a<_0x2a6064[_0xc761('0x19')];_0x31c25a+=0x1){_0x13a002[_0xc761('0x43')](_0xc761('0x49'),{'WhatsappInteractionId':Number(_0x2a6064[_0x31c25a]),'UserId':Number(_0x47c0d9['id'])});}});}})[_0xc761('0x4a')](function(_0x133528){_0x2043e0['log'](_0x133528);});}}function onDisconnect(_0x249768,_0x51e04c){joinOrLeave(_0x249768,_0xc761('0x44'),_0x51e04c);}function onConnect(_0x37cbab){joinOrLeave(_0x37cbab,_0xc761('0x4b'));}exports['default']=function(_0x481b2b){_0x481b2b['on']('connection',function(_0x1f2687){_0x1f2687[_0xc761('0x4c')](0x0);_0x1f2687['address']=_0x1f2687[_0xc761('0x4d')]['connection']['remoteAddress']+':'+_0x1f2687['request']['connection']['remotePort'];_0x1f2687[_0xc761('0x4e')]=new Date();_0x1f2687['log']=function(_0x4783c5){console[_0xc761('0x4f')](_0xc761('0x50')+_0x1f2687[_0xc761('0x51')]['name']+'['+_0x1f2687[_0xc761('0x52')]+']',_0x4783c5);};_0x1f2687['on']('disconnect',function(){onDisconnect(_0x1f2687,_0x481b2b);_0x1f2687[_0xc761('0x4f')](_0xc761('0x53'));});onConnect(_0x1f2687);_0x1f2687['log'](_0xc761('0x54'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index cc1fb68..a059eaa 100644 --- a/server/config/triggers/index.js +++ b/server/config/triggers/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0db7=['code','Trigger,\x20%s','get','channel','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','format','SIP/%s','name','agent','outgoingmessage','catch','AfterCreateMessage','opened','interface','AfterCreate','changed','closed','substatus','UserId','User','fullname','email','internal','length','hasOwnProperty','model','callback','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','ChatInteraction','afterCreate','newinteraction','Chat','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','SmsInteraction','Sms','SmsMessage','newmessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','error'];(function(_0x61b7d0,_0xf9c6cb){var _0xdc3482=function(_0x4453b8){while(--_0x4453b8){_0x61b7d0['push'](_0x61b7d0['shift']());}};_0xdc3482(++_0xf9c6cb);}(_0x0db7,0x1de));var _0x70db=function(_0xb4e5d,_0x562a3e){_0xb4e5d=_0xb4e5d-0x0;var _0x572d83=_0x0db7[_0xb4e5d];return _0x572d83;};'use strict';var util=require(_0x70db('0x0'));var db=require(_0x70db('0x1'))['db'];var jayson=require(_0x70db('0x2'));var logger=require(_0x70db('0x3'))(_0x70db('0x4'));var client=jayson[_0x70db('0x5')][_0x70db('0x6')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0x70db('0x7'),'event':_0x70db('0x8'),'condition':_0x70db('0x9'),'callback':afterCreate},{'channel':_0x70db('0xa'),'model':_0x70db('0x7'),'event':_0x70db('0xb'),'condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':_0x70db('0xa'),'model':_0x70db('0xd'),'event':_0x70db('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x70db('0xa'),'model':_0x70db('0xe'),'event':_0x70db('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x70db('0xf'),'event':'afterCreate','condition':_0x70db('0x9'),'callback':afterCreate},{'channel':_0x70db('0x10'),'model':_0x70db('0xf'),'event':_0x70db('0xb'),'condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':'Sms','model':_0x70db('0x11'),'event':_0x70db('0x8'),'condition':_0x70db('0x12'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x70db('0x13'),'event':_0x70db('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x70db('0x14'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x70db('0x15'),'event':_0x70db('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x70db('0x16'),'model':_0x70db('0x17'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Fax','model':_0x70db('0x17'),'event':_0x70db('0xb'),'condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':'afterCreate','condition':_0x70db('0x12'),'callback':afterCreateMessage},{'channel':_0x70db('0x18'),'model':_0x70db('0x19'),'event':_0x70db('0x8'),'condition':_0x70db('0x9'),'callback':afterCreate},{'channel':_0x70db('0x18'),'model':_0x70db('0x19'),'event':_0x70db('0xb'),'condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':_0x70db('0x18'),'model':'MailMessage','event':'afterCreate','condition':_0x70db('0x12'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x70db('0x1a'),'event':_0x70db('0x8'),'condition':_0x70db('0x9'),'callback':afterCreate},{'channel':_0x70db('0x1b'),'model':_0x70db('0x1a'),'event':_0x70db('0xb'),'condition':_0x70db('0xc'),'callback':afterUpdate},{'channel':_0x70db('0x1b'),'model':_0x70db('0x1c'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage}];function request(_0x1aaf99){return client[_0x70db('0x1d')](_0x70db('0x1e'),_0x1aaf99)[_0x70db('0x1f')](function(_0x2926f3){logger['info']('Trigger,\x20%s',_0x70db('0x1e'),_0x2926f3);if(_0x2926f3[_0x70db('0x20')]){if(_0x2926f3[_0x70db('0x20')][_0x70db('0x21')]===0x1f4){logger[_0x70db('0x20')](_0x70db('0x22'),_0x70db('0x1e'),_0x2926f3[_0x70db('0x20')]);}}})['catch'](function(_0x43a4c7){logger['error']('Trigger,\x20%s',_0x70db('0x1e'),_0x43a4c7);});}function afterCreateMessage(_0x299340){return function(_0x9bf302){_0x9bf302=_0x9bf302[_0x70db('0x23')]({'plain':!![]});_0x9bf302[_0x70db('0x24')]=_0x299340;_0x9bf302[_0x70db('0x25')]=_0x299340;_0x9bf302[_0x70db('0x26')]=_0x9bf302[_0x70db('0x27')];Promise[_0x70db('0x28')]()[_0x70db('0x1f')](function(){if(typeof _0x9bf302['ContactId']===_0x70db('0x29'))return null;var _0x5e794a=_0x70db('0x2a')+_0x9bf302[_0x70db('0x2b')];return db[_0x70db('0x2c')][_0x70db('0x2d')](_0x5e794a,{'type':db[_0x70db('0x2e')][_0x70db('0x2f')][_0x70db('0x30')],'raw':!![]});})[_0x70db('0x1f')](function(_0x4f9e7b){if(_0x4f9e7b){_0x9bf302[_0x70db('0x31')]=_0x4f9e7b[0x0];}if(typeof _0x9bf302['UserId']===_0x70db('0x29'))return;return getAgent(_0x9bf302['UserId']);})[_0x70db('0x1f')](function(_0x136f7a){if(_0x136f7a){_0x9bf302['interface']=util[_0x70db('0x32')](_0x70db('0x33'),_0x136f7a[_0x70db('0x34')]);_0x9bf302[_0x70db('0x35')]=_0x136f7a;_0x9bf302['channel']=_0x299340;return request({'event':'incomingmessage','message':_0x9bf302});}else{return request({'event':_0x70db('0x36'),'message':_0x9bf302});}})[_0x70db('0x37')](function(_0x112bca){logger[_0x70db('0x20')]('Trigger,\x20%s',_0x70db('0x38'),_0x112bca);});};}function afterCreateOfflineMessage(_0x5a02dc){return function(_0x246a7d){_0x246a7d=_0x246a7d[_0x70db('0x23')]({'plain':!![]});_0x246a7d[_0x70db('0x24')]=_0x5a02dc;_0x246a7d[_0x70db('0x25')]=_0x5a02dc;_0x246a7d[_0x70db('0x26')]='offlineMessage';return request({'event':_0x246a7d['event'],'message':_0x246a7d});};}function afterCreate(_0x57f60f,_0x4c22b9){return function(_0x21642b){_0x21642b=_0x21642b[_0x70db('0x23')]({'plain':!![]});_0x21642b[_0x70db('0x24')]=_0x57f60f;_0x21642b['motionChannel']=_0x57f60f;_0x21642b[_0x70db('0x26')]=_0x70db('0x39');Promise[_0x70db('0x28')]()[_0x70db('0x1f')](function(){var _0x8602e0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x21642b[_0x70db('0x2b')];return db[_0x70db('0x2c')][_0x70db('0x2d')](_0x8602e0,{'type':db[_0x70db('0x2e')][_0x70db('0x2f')][_0x70db('0x30')],'raw':!![]});})[_0x70db('0x1f')](function(_0x39b3bf){if(_0x39b3bf){_0x21642b[_0x70db('0x31')]=_0x39b3bf[0x0];}if(typeof _0x21642b['UserId']===_0x70db('0x29'))return;return getAgent(_0x21642b['UserId']);})[_0x70db('0x1f')](function(_0x379cae){if(_0x379cae){_0x21642b[_0x70db('0x3a')]=util[_0x70db('0x32')](_0x70db('0x33'),_0x379cae[_0x70db('0x34')]);_0x21642b[_0x70db('0x35')]=_0x379cae;}return request({'event':_0x4c22b9,'message':_0x21642b});})[_0x70db('0x37')](function(_0x4e3961){logger[_0x70db('0x20')](_0x70db('0x22'),_0x70db('0x3b'),_0x4e3961);});};}function afterUpdate(_0x269ffc){return function(_0x3cc484){var _0x133bee=_0x3cc484[_0x70db('0x3c')](_0x70db('0x3d'))&&_0x3cc484['closed'];var _0x269ea0=_0x3cc484[_0x70db('0x3c')](_0x70db('0x3e'));if(_0x133bee||_0x269ea0){var _0xdf7d10=_0x133bee?'closedinteraction':_0x70db('0x3e');var _0x40800d=_0x3cc484[_0x70db('0x23')]({'plain':!![]});_0x40800d[_0x70db('0x24')]=_0x269ffc;_0x40800d[_0x70db('0x25')]=_0x269ffc;_0x40800d[_0x70db('0x26')]=_0x133bee?'closed':_0x70db('0x3e');var _0x2c7faa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40800d[_0x70db('0x2b')];return db[_0x70db('0x2c')][_0x70db('0x2d')](_0x2c7faa,{'type':db[_0x70db('0x2e')][_0x70db('0x2f')][_0x70db('0x30')],'raw':!![]})[_0x70db('0x1f')](function(_0x1efd2c){if(_0x1efd2c){_0x40800d['contact']=_0x1efd2c[0x0];}if(typeof _0x40800d[_0x70db('0x3f')]===_0x70db('0x29'))return;return getAgent(_0x40800d[_0x70db('0x3f')]);})[_0x70db('0x1f')](function(_0x380a3a){if(_0x380a3a){_0x40800d[_0x70db('0x3a')]=util['format'](_0x70db('0x33'),_0x380a3a['name']);_0x40800d[_0x70db('0x35')]=_0x380a3a;}return request({'event':_0xdf7d10,'message':_0x40800d});})['catch'](function(_0x56946e){logger[_0x70db('0x20')](_0x70db('0x22'),'AfterUpdate',_0x56946e);});}};}function getAgent(_0x55e080){return db[_0x70db('0x40')]['find']({'where':{'id':_0x55e080},'attributes':['id',_0x70db('0x34'),_0x70db('0x41'),_0x70db('0x42'),_0x70db('0x43')],'raw':!![]})['then'](function(_0x104b9a){return _0x104b9a;});}exports['default']=function(){for(var _0x48129b=0x0;_0x48129b=_0x554a6f[_0x8d96('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x2675cd(_0x3e4467);})[_0x8d96('0x14')](function(_0x2a4f0e){_0xf81f29(_0x2a4f0e);});});}; \ No newline at end of file +var _0x704b=['role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense'];(function(_0x102789,_0x24217f){var _0x4aeb4f=function(_0x48bbcb){while(--_0x48bbcb){_0x102789['push'](_0x102789['shift']());}};_0x4aeb4f(++_0x24217f);}(_0x704b,0xa9));var _0xb704=function(_0x11da31,_0x5d576f){_0x11da31=_0x11da31-0x0;var _0x6bb4c8=_0x704b[_0x11da31];return _0x6bb4c8;};'use strict';var _=require(_0xb704('0x0'));var BPromise=require(_0xb704('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xb704('0x2'),_0xb704('0x3'),_0xb704('0x4'),_0xb704('0x5'),_0xb704('0x6'),_0xb704('0x7')];exports[_0xb704('0x8')]=function(){return channels;};exports[_0xb704('0x9')]=function(_0x182de3){_0x182de3=_0x182de3['toLowerCase']();return _['includes'](channels,_0x182de3);};exports[_0xb704('0xa')]=function(_0x3b5c55,_0x3a61b1,_0xa501be,_0x7d087d){var _0x4c55d0={'loginAttempts':_0x3a61b1,'blocked':_0xa501be};if(!_[_0xb704('0xb')](_0x7d087d)){_0x4c55d0[_0xb704('0xc')]=_0x7d087d;}return _0x3b5c55[_0xb704('0xd')](_0x4c55d0);};exports[_0xb704('0xe')]=function(_0x4a738c){return new BPromise(function(_0x55062c,_0x3612b7){var _0xf3b23a=0x0;if(_0x4a738c[_0xb704('0xf')]!==_0xb704('0x10')){_0x55062c(_0x4a738c);}db[_0xb704('0x11')][_0xb704('0x12')]({'where':{'role':_0xb704('0x10'),'online':!![],'id':{'$ne':_0x4a738c['id']}}})[_0xb704('0x13')](function(_0x30cccc){_0xf3b23a=_0x30cccc;return util[_0xb704('0xe')]();})[_0xb704('0x13')](function(_0x324935){if(_0x324935&&_0x324935[_0xb704('0x14')]&&_0xf3b23a>=_0x324935['agents']){throw Error(_0xb704('0x15'));}_0x55062c(_0x4a738c);})[_0xb704('0x16')](function(_0x5f0727){_0x3612b7(_0x5f0727);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1beb66a..0a6c14f 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153f=['inherits','Forbidden','OutOfInterval','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','Error','Bad\x20Request','name','Entity\x20not\x20found','Not\x20Found'];(function(_0x347214,_0x418a02){var _0x1308bd=function(_0x16bd25){while(--_0x16bd25){_0x347214['push'](_0x347214['shift']());}};_0x1308bd(++_0x418a02);}(_0x153f,0x15b));var _0xf153=function(_0x4d5da5,_0x54515d){_0x4d5da5=_0x4d5da5-0x0;var _0x3181b7=_0x153f[_0x4d5da5];return _0x3181b7;};'use strict';var util=require(_0xf153('0x0'));var logger=require(_0xf153('0x1'))(_0xf153('0x2'));var APIError=function(_0x44cea3,_0x2afb9a){this[_0xf153('0x3')]=_0x44cea3||_0xf153('0x4');this['name']=_0x2afb9a||_0xf153('0x5');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x1f9ead){this[_0xf153('0x3')]=_0x1f9ead||_0xf153('0x6');this[_0xf153('0x7')]=_0xf153('0x6');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x17ba96){this[_0xf153('0x3')]=_0x17ba96||_0xf153('0x8');this[_0xf153('0x7')]=_0xf153('0x9');util[_0xf153('0xa')](APINotFoundError,APIError);};function getStatusCode(_0x44845c){switch(_0x44845c){case _0xf153('0x6'):return 0x190;case _0xf153('0xb'),_0xf153('0xc'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2b76eb){return function(_0x1c8de7){logger[_0xf153('0xd')](_0x1c8de7['stack']);var _0x3a8838=getStatusCode(_0x1c8de7[_0xf153('0x7')]);if(_0x1c8de7[_0xf153('0x7')])delete _0x1c8de7[_0xf153('0x7')];return _0x2b76eb[_0xf153('0xe')](_0x3a8838)[_0xf153('0xf')](_0x1c8de7);};}module[_0xf153('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x5b02=['inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','stack','name','status','send','exports','util','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0x5b02,0xe9));var _0x25b0=function(_0x391e28,_0x52044a){_0x391e28=_0x391e28-0x0;var _0xbda6f4=_0x5b02[_0x391e28];return _0xbda6f4;};'use strict';var util=require(_0x25b0('0x0'));var logger=require(_0x25b0('0x1'))(_0x25b0('0x2'));var APIError=function(_0x1c3295,_0x4ef71c){this['message']=_0x1c3295||_0x25b0('0x3');this['name']=_0x4ef71c||_0x25b0('0x4');util[_0x25b0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x38dc14){this[_0x25b0('0x6')]=_0x38dc14||_0x25b0('0x7');this['name']=_0x25b0('0x7');util[_0x25b0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x49ef3a){this[_0x25b0('0x6')]=_0x49ef3a||'Entity\x20not\x20found';this['name']=_0x25b0('0x8');util[_0x25b0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x358af0){switch(_0x358af0){case'Bad\x20Request':return 0x190;case _0x25b0('0x9'),_0x25b0('0xa'):return 0x193;case _0x25b0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x250d31){return function(_0x2c72f3){logger[_0x25b0('0xb')](_0x2c72f3[_0x25b0('0xc')]);var _0x10c3fb=getStatusCode(_0x2c72f3[_0x25b0('0xd')]);if(_0x2c72f3[_0x25b0('0xd')])delete _0x2c72f3[_0x25b0('0xd')];return _0x250d31[_0x25b0('0xe')](_0x10c3fb)[_0x25b0('0xf')](_0x2c72f3);};}module[_0x25b0('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f933e31..c56faf8 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dff=['json','send','exports','404','status'];(function(_0x49dd01,_0x3c7496){var _0x9bfc6e=function(_0x2bd013){while(--_0x2bd013){_0x49dd01['push'](_0x49dd01['shift']());}};_0x9bfc6e(++_0x3c7496);}(_0x7dff,0x75));var _0xf7df=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7dff[_0x9df060];return _0x338dfe;};'use strict';module[_0xf7df('0x0')][0x194]=function pageNotFound(_0x564ea0,_0x107744){var _0x51db9b=_0xf7df('0x1');var _0x1280c4=0x194;var _0x4c7e00={'status':_0x1280c4};_0x107744[_0xf7df('0x2')](_0x4c7e00[_0xf7df('0x2')]);_0x107744['render'](_0x51db9b,{},function(_0x1848e2,_0x32e616){if(_0x1848e2){return _0x107744[_0xf7df('0x2')](_0x4c7e00[_0xf7df('0x2')])[_0xf7df('0x3')](_0x4c7e00);}_0x107744[_0xf7df('0x4')](_0x32e616);});}; \ No newline at end of file +var _0xee0f=['status','render','json','send','exports','404'];(function(_0xdc0e64,_0x38bf67){var _0xb04e82=function(_0x638bea){while(--_0x638bea){_0xdc0e64['push'](_0xdc0e64['shift']());}};_0xb04e82(++_0x38bf67);}(_0xee0f,0x1ea));var _0xfee0=function(_0xbc7ea,_0x4d3f90){_0xbc7ea=_0xbc7ea-0x0;var _0xadc703=_0xee0f[_0xbc7ea];return _0xadc703;};'use strict';module[_0xfee0('0x0')][0x194]=function pageNotFound(_0x5e2ea9,_0x30c300){var _0x5dcc31=_0xfee0('0x1');var _0x555e90=0x194;var _0x1d0bc2={'status':_0x555e90};_0x30c300[_0xfee0('0x2')](_0x1d0bc2[_0xfee0('0x2')]);_0x30c300[_0xfee0('0x3')](_0x5dcc31,{},function(_0xe9537a,_0x136c01){if(_0xe9537a){return _0x30c300[_0xfee0('0x2')](_0x1d0bc2[_0xfee0('0x2')])[_0xfee0('0x4')](_0x1d0bc2);}_0x30c300[_0xfee0('0x5')](_0x136c01);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f4ee6ee..9e9b473 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x204f=['UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','hasOne','VoiceMail','cascade','UserId','userSetting','Recordings','hasMany','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','SmsInteractions','FaxInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','VoiceContext','Sound','Members','VoiceQueueId','Hoppers','HopperFinals','CmHopperBlack','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','MailServerOut','restrict','Smtp','Disposition','Dispositions','Answers','Messages','MailApplication','Applications','List','ListId','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','Items','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','Owner','sms_interaction_has_tags','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','ChatQueue','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Website','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','FaxApplications','SmsApplications','CustomReportId','Mohs','moh_has_sounds','ItemType','CmHopperId','CmContactId','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','Configurations','AccountId','Descriptions','DescriptionId','Subject','SubjectId','Field','FieldId','Variable','VariableId','SugarcrmField','Description','Subjects','ZohoField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','VoiceQueues','team_has_chat_queues','VoicePrefix','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToUserId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsAccountId','Queues','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappAccount','WhatsappApplication','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','database','username','password','options','User','import','../api/user/user.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue'];(function(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0x204f,0x1cb));var _0xf204=function(_0x1848ba,_0x2f4f33){_0x1848ba=_0x1848ba-0x0;var _0x2af2b9=_0x204f[_0x1848ba];return _0x2af2b9;};'use strict';var config=require(_0xf204('0x0'));var Sequelize=require(_0xf204('0x1'));var _=require(_0xf204('0x2'));var jstz=require(_0xf204('0x3'));var timezone=jstz[_0xf204('0x4')]();config['sequelize']=_[_0xf204('0x5')](config[_0xf204('0x1')],{'database':_0xf204('0x6'),'username':'xcall','password':_0xf204('0x7'),'options':{'host':_0xf204('0x8'),'port':0xcea,'dialect':_0xf204('0x9'),'dialectOptions':{'charset':_0xf204('0xa')},'logging':![],'timezone':timezone[_0xf204('0xb')](),'define':{'charset':_0xf204('0xc'),'collate':_0xf204('0xd')}}});config[_0xf204('0xe')]=_[_0xf204('0x5')](config[_0xf204('0xe')],{'database':_0xf204('0x6'),'username':_0xf204('0xf'),'password':_0xf204('0x7'),'options':{'host':_0xf204('0x8'),'port':0xcea,'dialect':_0xf204('0x9'),'dialectOptions':{'charset':_0xf204('0xa')},'logging':![],'timezone':timezone[_0xf204('0xb')](),'define':{'charset':'utf8','collate':_0xf204('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xf204('0x1')][_0xf204('0x10')],config[_0xf204('0x1')][_0xf204('0x11')],config[_0xf204('0x1')][_0xf204('0x12')],config[_0xf204('0x1')][_0xf204('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config[_0xf204('0xe')][_0xf204('0x11')],config['sequelizeHistory']['password'],config[_0xf204('0xe')][_0xf204('0x13')])};db[_0xf204('0x14')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x16'));db['VoiceChanSpy']=db[_0xf204('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize']['import'](_0xf204('0x17'));db[_0xf204('0x18')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0xf204('0x19')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1a'));db[_0xf204('0x1b')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1c'));db['VoiceRecording']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1d'));db[_0xf204('0x1e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x1f'));db['VoiceMail']=db['sequelize'][_0xf204('0x15')](_0xf204('0x20'));db[_0xf204('0x21')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x22'));db[_0xf204('0x23')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x24'));db[_0xf204('0x25')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x26'));db[_0xf204('0x27')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x28'));db[_0xf204('0x29')]=db[_0xf204('0x1')]['import'](_0xf204('0x2a'));db['MemberReport']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/memberReport/memberReport.model');db['Trunk']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/trunk/trunk.model');db[_0xf204('0x2b')]=db['sequelize']['import'](_0xf204('0x2c'));db[_0xf204('0x2d')]=db['sequelize'][_0xf204('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xf204('0x2e')]=db[_0xf204('0x1')]['import'](_0xf204('0x2f'));db['UserChatQueue']=db['sequelize'][_0xf204('0x15')](_0xf204('0x30'));db[_0xf204('0x31')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xf204('0x32')]=db[_0xf204('0x1')]['import'](_0xf204('0x33'));db['UserSmsQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x34'));db[_0xf204('0x35')]=db[_0xf204('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xf204('0x36')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xf204('0x37')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x38'));db['MailServerOut']=db[_0xf204('0x1')]['import'](_0xf204('0x39'));db['MailAccount']=db['sequelize']['import'](_0xf204('0x3a'));db[_0xf204('0x3b')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3c'));db['MailSubstatus']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3d'));db[_0xf204('0x3e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x3f'));db[_0xf204('0x40')]=db[_0xf204('0x1')]['import'](_0xf204('0x41'));db['MailApplication']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x42'));db[_0xf204('0x43')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x44'));db[_0xf204('0x45')]=db[_0xf204('0x1')]['import'](_0xf204('0x46'));db[_0xf204('0x47')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x48'));db['FaxAccount']=db['sequelize'][_0xf204('0x15')](_0xf204('0x49'));db[_0xf204('0x4a')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x4b'));db[_0xf204('0x4c')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x4d'));db['FaxMessage']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x4e'));db['FaxQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x4f'));db[_0xf204('0x50')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xf204('0x51')]=db[_0xf204('0x1')]['import'](_0xf204('0x52'));db[_0xf204('0x53')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x54'));db[_0xf204('0x55')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0xf204('0x56')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x57'));db[_0xf204('0x58')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x59'));db[_0xf204('0x5a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x5b'));db[_0xf204('0x5c')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x5d'));db[_0xf204('0x5e')]=db[_0xf204('0x1')]['import'](_0xf204('0x5f'));db[_0xf204('0x60')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x61'));db[_0xf204('0x62')]=db[_0xf204('0x1')]['import'](_0xf204('0x63'));db[_0xf204('0x64')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x65'));db[_0xf204('0x66')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x67'));db['ChatApplication']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/chatApplication/chatApplication.model');db[_0xf204('0x68')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x69'));db[_0xf204('0x6a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x6b'));db['ChatOfflineMessage']=db['sequelize'][_0xf204('0x15')](_0xf204('0x6c'));db['ChatQueue']=db[_0xf204('0x1')]['import'](_0xf204('0x6d'));db[_0xf204('0x6e')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x6f'));db[_0xf204('0x70')]=db[_0xf204('0x1')]['import'](_0xf204('0x71'));db[_0xf204('0x72')]=db['sequelize']['import']('../api/cmCompany/cmCompany.model');db[_0xf204('0x73')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cmContact/cmContact.model');db[_0xf204('0x74')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x75'));db['CmHopperBlack']=db[_0xf204('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xf204('0x76')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x77'));db['CmHopperHistory']=db[_0xf204('0x1')]['import'](_0xf204('0x78'));db[_0xf204('0x79')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x7a'));db['CmCustomField']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xf204('0x7b')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/action/action.model');db[_0xf204('0x7c')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/automation/automation.model');db[_0xf204('0x7d')]=db[_0xf204('0x1')]['import'](_0xf204('0x7e'));db['Disposition']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/disposition/disposition.model');db[_0xf204('0x7f')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x80'));db[_0xf204('0x81')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x82'));db[_0xf204('0x83')]=db[_0xf204('0x1')]['import']('../api/pause/pause.model');db[_0xf204('0x84')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/cdr/cdr.model');db[_0xf204('0x85')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x86'));db[_0xf204('0x87')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x88'));db['Sound']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x89'));db[_0xf204('0x8a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x8b'));db[_0xf204('0x8c')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x8d'));db[_0xf204('0x8e')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x8f'));db[_0xf204('0x90')]=db[_0xf204('0x1')]['import'](_0xf204('0x91'));db[_0xf204('0x92')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x93'));db[_0xf204('0x94')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x95'));db['Variable']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x96'));db[_0xf204('0x97')]=db['sequelize'][_0xf204('0x15')](_0xf204('0x98'));db[_0xf204('0x99')]=db['sequelize'][_0xf204('0x15')]('../api/integrationReport/integrationReport.model');db[_0xf204('0x9a')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x9b'));db[_0xf204('0x9c')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xf204('0x9d')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x9e'));db[_0xf204('0x9f')]=db[_0xf204('0x1')]['import'](_0xf204('0xa0'));db['AnalyticFieldReport']=db[_0xf204('0x1')]['import'](_0xf204('0xa1'));db[_0xf204('0xa2')]=db['sequelize'][_0xf204('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xf204('0xa3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xa4'));db[_0xf204('0xa5')]=db[_0xf204('0x1')]['import'](_0xf204('0xa6'));db[_0xf204('0xa7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xa8'));db[_0xf204('0xa9')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xaa'));db[_0xf204('0xab')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xac'));db['SugarcrmField']=db['sequelize'][_0xf204('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xf204('0xad')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xae'));db[_0xf204('0xaf')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xb0'));db[_0xf204('0xb1')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb2'));db[_0xf204('0xb3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb4'));db[_0xf204('0xb5')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xb6'));db['ZohoField']=db['sequelize'][_0xf204('0x15')](_0xf204('0xb7'));db[_0xf204('0xb8')]=db[_0xf204('0x1')]['import'](_0xf204('0xb9'));db[_0xf204('0xba')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xbb'));db[_0xf204('0xbc')]=db[_0xf204('0x1')]['import'](_0xf204('0xbd'));db[_0xf204('0xbe')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xbf'));db[_0xf204('0xc0')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc1'));db['FreshdeskField']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc2'));db['VtigerAccount']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xf204('0xc3')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xc4'));db[_0xf204('0xc5')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xc6'));db[_0xf204('0xc7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xc8'));db[_0xf204('0xc9')]=db[_0xf204('0x1')]['import'](_0xf204('0xca'));db[_0xf204('0xcb')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0xf204('0xcc')]=db[_0xf204('0x1')]['import']('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xcd'));db['Dynamics365Field']=db['sequelize'][_0xf204('0x15')](_0xf204('0xce'));db['FreshsalesAccount']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xf204('0xcf')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd0'));db[_0xf204('0xd1')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd2'));db[_0xf204('0x97')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x98'));db['Network']=db[_0xf204('0x1')][_0xf204('0x15')]('../api/network/network.model');db[_0xf204('0xd3')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0xf204('0xd4')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xd5'));db[_0xf204('0xd6')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xd7'));db['JscriptyQuestionReport']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xd8'));db[_0xf204('0xd9')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xf204('0xda')]=db['sequelize']['import'](_0xf204('0xdb'));db[_0xf204('0xdc')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xdd'));db[_0xf204('0xde')]=db['sequelize'][_0xf204('0x15')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xdf'));db[_0xf204('0xe0')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/setting/setting.model');db[_0xf204('0xe1')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe2'));db[_0xf204('0xe3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe4'));db[_0xf204('0xe5')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xe6'));db[_0xf204('0xe7')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xe8'));db[_0xf204('0xe9')]=db[_0xf204('0x1')]['import'](_0xf204('0xea'));db[_0xf204('0xeb')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xec'));db[_0xf204('0xed')]=db[_0xf204('0x1')]['import'](_0xf204('0xee'));db['Migration']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xef'));db['Attachment']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf0'));db[_0xf204('0xf1')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xf2'));db[_0xf204('0xf3')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf4'));db[_0xf204('0xf5')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xf6'));db[_0xf204('0xf7')]=db[_0xf204('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xf204('0xf8')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xf204('0xf9')]=db['sequelize'][_0xf204('0x15')](_0xf204('0xfa'));db[_0xf204('0xfb')]=db['sequelize'][_0xf204('0x15')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0xfc'));db[_0xf204('0xfd')]=db[_0xf204('0x1')]['import'](_0xf204('0xfe'));db['UserProfileSection']=db[_0xf204('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0xf204('0xff')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xf204('0x100')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x101'));db['WhatsappAccount']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x102'));db['WhatsappApplication']=db['sequelize']['import']('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize'][_0xf204('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xf204('0x103')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x104'));db[_0xf204('0x105')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x106'));db['WhatsappTransferReport']=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x107'));db[_0xf204('0x108')]=db[_0xf204('0x1')]['import'](_0xf204('0x109'));db['CloudProvider']=db['sequelize'][_0xf204('0x15')](_0xf204('0x10a'));db[_0xf204('0x10b')]=db['sequelize']['import'](_0xf204('0x10c'));db[_0xf204('0x10d')]=db[_0xf204('0x1')][_0xf204('0x15')](_0xf204('0x10e'));db[_0xf204('0x10f')]=db[_0xf204('0x1')][_0xf204('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xf204('0x110')]=db['sequelize'][_0xf204('0x15')]('../api/user-setting/user-setting.model');db[_0xf204('0x14')][_0xf204('0x111')](db[_0xf204('0x112')],{'as':'VoiceMail','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x111')](db[_0xf204('0x110')],{'as':_0xf204('0x115'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')]['hasMany'](db['VoiceRecording'],{'as':_0xf204('0x116'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x2d')],{'as':_0xf204('0x118'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db['VoiceExtension'],{'as':_0xf204('0x119'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':'HopperFinals','foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':_0xf204('0x11b'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'ChatInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x55')],{'as':_0xf204('0x11c'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x4c')],{'as':_0xf204('0x11d'),'foreignKey':'UserId'});db[_0xf204('0x14')]['hasMany'](db[_0xf204('0x3e')],{'as':'MailInteractions','foreignKey':_0xf204('0x114')});db['User'][_0xf204('0x117')](db[_0xf204('0x11e')],{'as':_0xf204('0x11f'),'foreignKey':'UserId'});db[_0xf204('0x14')][_0xf204('0x117')](db[_0xf204('0x100')],{'as':_0xf204('0x120'),'foreignKey':'SenderId'});db[_0xf204('0x14')][_0xf204('0x121')](db['UserProfile'],{'as':_0xf204('0xfd'),'foreignKey':_0xf204('0x122')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x6e')],{'as':_0xf204('0x124'),'through':_0xf204('0x125')});db[_0xf204('0x14')][_0xf204('0x123')](db['CmContact'],{'as':_0xf204('0x126'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xf204('0xfb')],{'as':'Lists','through':_0xf204('0x127')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x128')});db['User'][_0xf204('0x123')](db[_0xf204('0x3e')],{'as':_0xf204('0x129'),'through':_0xf204('0x12a')});db['User']['belongsToMany'](db[_0xf204('0x68')],{'as':_0xf204('0x12b'),'through':_0xf204('0x12c')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x4c')],{'as':'FaxInteractions','through':_0xf204('0x12d')});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x55')],{'as':'SmsInteractions','through':_0xf204('0x12e')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x5e')],{'as':_0xf204('0x12f'),'through':'user_has_openchannel_interactions'});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x11e')],{'as':_0xf204('0x11f'),'through':'user_has_whatsapp_interactions'});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x1b')],{'as':'VoiceQueues','through':_0xf204('0x2e'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db['VoicePrefix'],{'as':_0xf204('0x130'),'through':_0xf204('0x10f'),'required':![]});db[_0xf204('0x14')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xf204('0x14')]['belongsToMany'](db['ChatQueue'],{'as':_0xf204('0x131'),'through':_0xf204('0x132'),'required':![],'hooks':!![]});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x133')],{'as':_0xf204('0x134'),'through':_0xf204('0x32'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x58')],{'as':_0xf204('0x135'),'through':'UserSmsQueue','required':![]});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x62')],{'as':_0xf204('0x136'),'through':_0xf204('0x35'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x108')],{'as':_0xf204('0x137'),'through':_0xf204('0x36'),'required':![]});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0xfb')],{'through':'cm_user_has_lists'});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x64')],{'as':_0xf204('0x138'),'through':'user_has_chat_websites'});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0x139')],{'as':_0xf204('0x13a'),'through':_0xf204('0x13b')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x13c')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User'][_0xf204('0x123')](db[_0xf204('0x5a')],{'as':_0xf204('0x13d'),'through':_0xf204('0x13e')});db[_0xf204('0x14')][_0xf204('0x123')](db[_0xf204('0x51')],{'as':_0xf204('0x13f'),'through':_0xf204('0x140')});db[_0xf204('0x14')][_0xf204('0x123')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xf204('0x141')});db[_0xf204('0x14')]['belongsToMany'](db[_0xf204('0xe3')],{'as':_0xf204('0x142'),'through':_0xf204('0x143')});db[_0xf204('0x144')]['hasMany'](db['VoiceExtension'],{'as':_0xf204('0x145'),'onDelete':'cascade','foreignKey':_0xf204('0x146')});db[_0xf204('0x147')]['hasMany'](db[_0xf204('0x18')],{'onDelete':_0xf204('0x113')});db[_0xf204('0x18')]['hasMany'](db[_0xf204('0x18')],{'as':'Applications','onDelete':_0xf204('0x113')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xf204('0x148')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x2d')],{'as':_0xf204('0x149'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x74')],{'as':_0xf204('0x14b'),'foreignKey':_0xf204('0x14a')});db['VoiceQueue'][_0xf204('0x117')](db['CmHopperFinal'],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':'HopperHistories','foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x117')](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')]['hasMany'](db[_0xf204('0x14d')],{'as':_0xf204('0x14e'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')]['hasMany'](db[_0xf204('0xd9')],{'as':_0xf204('0x14f'),'foreignKey':_0xf204('0x14a')});db[_0xf204('0x1b')][_0xf204('0x121')](db[_0xf204('0x150')],{'as':_0xf204('0x150'),'foreignKey':_0xf204('0x151')});db[_0xf204('0x1b')]['belongsTo'](db[_0xf204('0x150')],{'as':_0xf204('0x152'),'foreignKey':_0xf204('0x153')});db[_0xf204('0x1b')]['belongsTo'](db['Interval'],{'as':_0xf204('0x81'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x1b')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xf204('0x1b')]['belongsToMany'](db[_0xf204('0xfb')],{'as':_0xf204('0x156'),'through':_0xf204('0x157')});db[_0xf204('0x1b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':'UserVoiceQueue'});db['VoiceQueue'][_0xf204('0x123')](db[_0xf204('0xe9')],{'as':_0xf204('0x159'),'through':_0xf204('0x10b')});db[_0xf204('0x1b')]['belongsToMany'](db[_0xf204('0xfb')],{'as':_0xf204('0x15a'),'through':_0xf204('0x15b')});db[_0xf204('0x15c')]['belongsTo'](db[_0xf204('0x14')],{'as':_0xf204('0x14'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x1e')]['belongsTo'](db[_0xf204('0x14')],{'as':'User','foreignKey':_0xf204('0x114')});db[_0xf204('0x112')]['hasMany'](db[_0xf204('0x21')],{'as':'Messages','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x15d'),'sourceKey':_0xf204('0x15e')});db[_0xf204('0x21')][_0xf204('0x121')](db[_0xf204('0x112')],{'foreignKey':_0xf204('0x15d'),'targetKey':_0xf204('0x15e')});db[_0xf204('0x23')][_0xf204('0x117')](db[_0xf204('0x29')],{'as':_0xf204('0x15f'),'foreignKey':_0xf204('0x160'),'constraints':![]});db[_0xf204('0x23')][_0xf204('0x117')](db[_0xf204('0x27')],{'as':_0xf204('0x161'),'foreignKey':'uniqueid','constraints':![]});db[_0xf204('0x23')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xf204('0x23')]['belongsTo'](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x37')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x37')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':'CloudProvider','foreignKey':_0xf204('0x166'),'onDelete':'restrict'});db[_0xf204('0x167')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':'MailAccountId'});db[_0xf204('0x167')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':'CloudProvider','foreignKey':_0xf204('0x166'),'onDelete':_0xf204('0x168')});db[_0xf204('0x13c')][_0xf204('0x111')](db[_0xf204('0x37')],{'as':'Imap','onDelete':'cascade'});db[_0xf204('0x13c')][_0xf204('0x111')](db[_0xf204('0x167')],{'as':_0xf204('0x169'),'onDelete':_0xf204('0x113')});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x164'),'onDelete':'cascade'});db[_0xf204('0x13c')][_0xf204('0x117')](db['CannedAnswer'],{'as':_0xf204('0x16c'),'foreignKey':'MailAccountId'});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x40')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x13c')][_0xf204('0x117')](db[_0xf204('0x3e')],{'as':'Interactions'});db['MailAccount'][_0xf204('0x117')](db[_0xf204('0x16e')],{'as':_0xf204('0x16f')});db['MailAccount'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x13c')][_0xf204('0x121')](db[_0xf204('0x92')],{'as':_0xf204('0x92'),'foreignKey':_0xf204('0x172')});db['MailAccount'][_0xf204('0x121')](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x13c')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x174')});db[_0xf204('0x3b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':'UserMailQueue'});db[_0xf204('0x3b')][_0xf204('0x123')](db['Team'],{'through':'team_has_mail_queues','as':_0xf204('0x159')});db[_0xf204('0x3e')][_0xf204('0x117')](db[_0xf204('0x40')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x175')});db['MailInteraction']['belongsTo'](db['MailAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x3e')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0xf204('0x3e')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x114')});db[_0xf204('0x3e')][_0xf204('0x123')](db['Tag'],{'through':_0xf204('0x177'),'as':_0xf204('0x178')});db[_0xf204('0x3e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':'mail_interaction_has_tags','as':_0xf204('0x179')});db[_0xf204('0x3e')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x12a'),'foreignKey':_0xf204('0x175')});db['MailMessage']['hasMany'](db[_0xf204('0x17b')],{'as':_0xf204('0x17c'),'onDelete':_0xf204('0x113')});db['MailMessage'][_0xf204('0x121')](db['User'],{'as':_0xf204('0x14')});db[_0xf204('0x40')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xf204('0x162')});db['MailMessage'][_0xf204('0x121')](db['MailInteraction'],{'as':_0xf204('0x17d'),'foreignKey':'MailInteractionId'});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':'Account','foreignKey':_0xf204('0x164')});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x64'),'foreignKey':_0xf204('0x17e')});db[_0xf204('0x40')][_0xf204('0x121')](db[_0xf204('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0xf204('0x180')});db[_0xf204('0x16e')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x16e')][_0xf204('0x121')](db[_0xf204('0x3b')],{'onDelete':'restrict'});db[_0xf204('0x16e')][_0xf204('0x121')](db[_0xf204('0x13c')],{'onDelete':'restrict'});db[_0xf204('0x16e')][_0xf204('0x121')](db['Interval'],{'onDelete':_0xf204('0x168'),'foreignKey':'IntervalId'});db['MailApplication'][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db['MailQueueReport'][_0xf204('0x121')](db['MailAccount'],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x3e')],{});db['MailQueueReport']['belongsTo'](db[_0xf204('0x40')],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x43')][_0xf204('0x121')](db[_0xf204('0x3b')],{});db[_0xf204('0x45')][_0xf204('0x117')](db[_0xf204('0x47')],{'as':_0xf204('0x182'),'onDelete':'cascade'});db['FaxAccount'][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':'FaxAccountId','onDelete':_0xf204('0x113')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':_0xf204('0x183')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x4c')],{'as':_0xf204('0x184')});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x4a')],{'as':'Applications'});db[_0xf204('0x139')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x185'),'onDelete':'cascade'});db['FaxAccount'][_0xf204('0x117')](db[_0xf204('0x186')],{'as':_0xf204('0x16d')});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0x150')],{'as':'Trunk'});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x139')][_0xf204('0x121')](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x139')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x13b')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x133')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x4a')][_0xf204('0x121')](db[_0xf204('0x139')],{'onDelete':_0xf204('0x168')});db['FaxApplication'][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x181')});db[_0xf204('0x4c')]['hasMany'](db[_0xf204('0x186')],{'as':_0xf204('0x16d'),'onDelete':'cascade','foreignKey':_0xf204('0x187')});db[_0xf204('0x4c')]['belongsTo'](db[_0xf204('0x139')],{'as':_0xf204('0x176'),'foreignKey':'FaxAccountId'});db[_0xf204('0x4c')][_0xf204('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0x4c')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x114')});db[_0xf204('0x4c')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x188'),'as':_0xf204('0x178')});db[_0xf204('0x4c')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x188'),'as':_0xf204('0x179')});db[_0xf204('0x4c')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x12d'),'foreignKey':_0xf204('0x187')});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x14')});db[_0xf204('0x186')][_0xf204('0x121')](db[_0xf204('0x4c')],{'as':_0xf204('0x17d'),'foreignKey':_0xf204('0x187')});db[_0xf204('0x186')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':'Contact'});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x17b')],{'as':_0xf204('0x17b'),'foreignKey':_0xf204('0x189')});db['FaxMessage'][_0xf204('0x121')](db[_0xf204('0x139')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxQueue'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x32')});db[_0xf204('0x133')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_fax_queues','as':_0xf204('0x159')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x139')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x4c')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x186')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x50')][_0xf204('0x121')](db[_0xf204('0x133')],{});db[_0xf204('0x51')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':'Dispositions','foreignKey':_0xf204('0x18a'),'onDelete':'cascade'});db[_0xf204('0x51')]['hasMany'](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':_0xf204('0x18a')});db['SmsAccount'][_0xf204('0x117')](db[_0xf204('0x56')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x18a')});db['SmsAccount'][_0xf204('0x117')](db[_0xf204('0x55')],{'as':_0xf204('0x184')});db[_0xf204('0x51')]['hasMany'](db['SmsApplication'],{'as':_0xf204('0x16f')});db['SmsAccount']['belongsTo'](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x51')][_0xf204('0x121')](db[_0xf204('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xf204('0x173')});db['SmsAccount'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x140')});db[_0xf204('0x53')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'restrict'});db[_0xf204('0x53')][_0xf204('0x121')](db[_0xf204('0x58')],{'onDelete':'restrict'});db['SmsApplication'][_0xf204('0x121')](db[_0xf204('0x51')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x53')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':'restrict','foreignKey':_0xf204('0x154')});db[_0xf204('0x53')][_0xf204('0x121')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db[_0xf204('0x55')][_0xf204('0x117')](db[_0xf204('0x56')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':'SmsInteractionId'});db[_0xf204('0x55')][_0xf204('0x121')](db[_0xf204('0x51')],{'as':_0xf204('0x176'),'foreignKey':'SmsAccountId'});db[_0xf204('0x55')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':'ContactId'});db[_0xf204('0x55')][_0xf204('0x121')](db['User'],{'as':_0xf204('0x18b'),'foreignKey':'UserId'});db[_0xf204('0x55')][_0xf204('0x123')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xf204('0x178')});db[_0xf204('0x55')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x18c'),'as':_0xf204('0x179')});db[_0xf204('0x55')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x12e'),'foreignKey':_0xf204('0x18d')});db['SmsMessage'][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x14')});db[_0xf204('0x56')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162')});db[_0xf204('0x56')][_0xf204('0x121')](db[_0xf204('0x55')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x17d'),'foreignKey':_0xf204('0x18d')});db[_0xf204('0x56')][_0xf204('0x121')](db['SmsAccount'],{'as':_0xf204('0x176'),'foreignKey':'SmsAccountId'});db['SmsQueue']['belongsToMany'](db[_0xf204('0x14')],{'as':'Agents','through':_0xf204('0x18e'),'foreignKey':_0xf204('0x18f')});db[_0xf204('0x58')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x190'),'as':_0xf204('0x159')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x191'),'onDelete':_0xf204('0x113')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':_0xf204('0x16c'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x5e')],{'as':_0xf204('0x184'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db[_0xf204('0x60')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5a')][_0xf204('0x117')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xf204('0x121')](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':'ListId'});db[_0xf204('0x5a')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x5a')]['belongsToMany'](db['User'],{'as':_0xf204('0x158'),'through':_0xf204('0x13e')});db[_0xf204('0x5c')][_0xf204('0x121')](db['User'],{'onDelete':_0xf204('0x168')});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x62')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xf204('0x121')](db[_0xf204('0x5a')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':'restrict','foreignKey':_0xf204('0x154')});db[_0xf204('0x5c')][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0xf204('0x117')](db[_0xf204('0x60')],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x192')});db[_0xf204('0x5e')][_0xf204('0x121')](db[_0xf204('0x5a')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x5e')]['belongsTo'](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db['OpenchannelInteraction']['belongsTo'](db['User'],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x5e')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x193'),'as':_0xf204('0x178')});db[_0xf204('0x5e')][_0xf204('0x123')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xf204('0x179')});db['OpenchannelInteraction'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':_0xf204('0x194'),'foreignKey':_0xf204('0x192')});db[_0xf204('0x60')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x14')});db[_0xf204('0x60')][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162')});db[_0xf204('0x60')][_0xf204('0x121')](db['OpenchannelInteraction'],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x192')});db[_0xf204('0x60')]['belongsTo'](db[_0xf204('0x17b')],{'as':_0xf204('0x17b'),'foreignKey':'AttachmentId'});db[_0xf204('0x60')][_0xf204('0x121')](db['OpenchannelAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x191')});db[_0xf204('0x62')]['belongsToMany'](db['User'],{'as':_0xf204('0x158'),'through':_0xf204('0x35'),'foreignKey':_0xf204('0x195')});db[_0xf204('0x62')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x196'),'as':_0xf204('0x159')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x17e'),'onDelete':_0xf204('0x113')});db[_0xf204('0x64')][_0xf204('0x117')](db['CannedAnswer'],{'as':_0xf204('0x16c'),'foreignKey':_0xf204('0x17e')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x70')],{'as':_0xf204('0x197')});db[_0xf204('0x64')][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'Interactions'});db['ChatWebsite'][_0xf204('0x117')](db[_0xf204('0x198')],{'as':'Applications'});db['ChatWebsite'][_0xf204('0x117')](db['ChatMessage'],{'as':_0xf204('0x16d')});db[_0xf204('0x64')][_0xf204('0x121')](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db['ChatWebsite'][_0xf204('0x121')](db[_0xf204('0x81')],{'as':_0xf204('0x81'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x64')][_0xf204('0x121')](db[_0xf204('0x13c')],{'as':_0xf204('0x13c'),'foreignKey':_0xf204('0x164')});db[_0xf204('0x64')][_0xf204('0x121')](db['Pause'],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x64')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xf204('0x199')});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0x5a')],{});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':'ListId'});db[_0xf204('0x66')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x66')][_0xf204('0x121')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xf204('0x121')](db[_0xf204('0x14')],{});db[_0xf204('0x66')][_0xf204('0x121')](db[_0xf204('0x62')],{});db['ChatApplication'][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x19a'),'foreignKey':_0xf204('0x114'),'onDelete':_0xf204('0x168')});db['ChatApplication'][_0xf204('0x121')](db[_0xf204('0x19b')],{'as':_0xf204('0x19c'),'foreignKey':_0xf204('0x19d'),'onDelete':'restrict'});db[_0xf204('0x198')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':'Website','foreignKey':_0xf204('0x17e'),'onDelete':_0xf204('0x168')});db[_0xf204('0x198')][_0xf204('0x121')](db[_0xf204('0x8a')],{'onDelete':'restrict','foreignKey':_0xf204('0x181')});db['ChatInteraction'][_0xf204('0x117')](db['ChatMessage'],{'as':_0xf204('0x16d'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x19e')});db['ChatInteraction'][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x176'),'foreignKey':'ChatWebsiteId'});db[_0xf204('0x68')][_0xf204('0x121')](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x68')][_0xf204('0x121')](db['User'],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x68')][_0xf204('0x123')](db['Tag'],{'through':_0xf204('0x19f'),'as':_0xf204('0x178')});db[_0xf204('0x68')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x19f'),'as':_0xf204('0x179')});db[_0xf204('0x68')]['belongsToMany'](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x12c'),'foreignKey':_0xf204('0x19e')});db[_0xf204('0x6a')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'cascade','as':_0xf204('0x14')});db['ChatMessage'][_0xf204('0x121')](db[_0xf204('0x73')],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162'),'foreignKey':'ContactId'});db['ChatMessage'][_0xf204('0x121')](db[_0xf204('0x68')],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x19e')});db[_0xf204('0x6a')][_0xf204('0x121')](db[_0xf204('0x17b')],{'as':'Attachment','foreignKey':_0xf204('0x189')});db[_0xf204('0x6a')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x17e')});db['ChatOfflineMessage'][_0xf204('0x117')](db[_0xf204('0x17b')],{'as':'Attachments','foreignKey':_0xf204('0x180'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x17f')][_0xf204('0x121')](db['CmContact'],{'onDelete':_0xf204('0x113'),'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x17f')][_0xf204('0x121')](db[_0xf204('0x64')],{'as':'Account','foreignKey':_0xf204('0x17e')});db[_0xf204('0x19b')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x132'),'hooks':!![]});db['ChatQueue'][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_chat_queues','as':_0xf204('0x159')});db[_0xf204('0x6e')]['hasMany'](db[_0xf204('0xd4')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x1a0'),'onDelete':_0xf204('0x113')});db[_0xf204('0x6e')]['belongsToMany'](db[_0xf204('0x14')],{'as':_0xf204('0x149'),'through':_0xf204('0x125')});db[_0xf204('0x70')]['belongsTo'](db[_0xf204('0x64')],{'as':_0xf204('0x1a1'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xf204('0x117')](db['CmContact'],{'as':_0xf204('0x126'),'foreignKey':_0xf204('0x1a2')});db[_0xf204('0x73')][_0xf204('0x117')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0xf204('0x14b'),'foreignKey':'ContactId'});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':'HopperHistories','foreignKey':_0xf204('0x163')});db['CmContact'][_0xf204('0x117')](db[_0xf204('0x79')],{'as':'ReportAgentPreview','foreignKey':_0xf204('0x163')});db[_0xf204('0x73')]['hasMany'](db['JscriptySessionReport'],{'as':_0xf204('0x14f'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x73')]['hasMany'](db[_0xf204('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0xf204('0x163'),'onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db[_0xf204('0x68')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db['SmsInteraction'],{'as':_0xf204('0x11c'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')][_0xf204('0x117')](db['FaxInteraction'],{'as':_0xf204('0x11d'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db[_0xf204('0x73')]['hasMany'](db[_0xf204('0x3e')],{'as':_0xf204('0x129'),'foreignKey':'ContactId','onDelete':_0xf204('0x168')});db['CmContact'][_0xf204('0x121')](db[_0xf204('0x72')],{'as':'Company','foreignKey':_0xf204('0x1a2')});db['CmContact'][_0xf204('0x121')](db['CmList'],{'as':'List','foreignKey':_0xf204('0x171'),'onDelete':'cascade'});db[_0xf204('0x73')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':'cm_user_has_contacts'});db[_0xf204('0x73')][_0xf204('0x123')](db[_0xf204('0x8a')],{'as':_0xf204('0x178'),'through':_0xf204('0x1a3')});db[_0xf204('0x73')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x1a3'),'as':'ThroughTags'});db[_0xf204('0x74')][_0xf204('0x117')](db[_0xf204('0x90')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xf204('0x74')][_0xf204('0x121')](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0x74')]['belongsTo'](db[_0xf204('0x14')],{'as':'Agent','foreignKey':'UserId'});db['CmHopper'][_0xf204('0x121')](db[_0xf204('0x1b')],{'as':_0xf204('0x19c'),'foreignKey':_0xf204('0x14a'),'onDelete':_0xf204('0x113')});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0xed')],{'as':_0xf204('0xed'),'foreignKey':_0xf204('0x1a4'),'onDelete':'cascade'});db[_0xf204('0x74')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':'Owner','foreignKey':_0xf204('0x1a5')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':'ContactId','onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db['CmList'],{'as':'List','foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0x1b')],{'as':'Queue','foreignKey':_0xf204('0x14a'),'onDelete':_0xf204('0x113')});db[_0xf204('0x14d')][_0xf204('0x121')](db[_0xf204('0xed')],{'as':_0xf204('0xed'),'foreignKey':_0xf204('0x1a4'),'onDelete':_0xf204('0x113')});db[_0xf204('0x7c')][_0xf204('0x117')](db[_0xf204('0x7f')],{'as':{'plural':_0xf204('0x1a6'),'singular':_0xf204('0x1a7')},'foreignKey':_0xf204('0x1a8'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x7c')][_0xf204('0x117')](db[_0xf204('0x7f')],{'as':{'plural':_0xf204('0x1a9'),'singular':_0xf204('0x1aa')},'foreignKey':_0xf204('0x1ab'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x7c')]['hasMany'](db[_0xf204('0x7b')],{'as':_0xf204('0x1ac'),'foreignKey':'AutomationId','onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x16a')][_0xf204('0x117')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xf204('0x1ad'),'onDelete':'cascade'});db['Interval'][_0xf204('0x117')](db[_0xf204('0x81')],{'as':_0xf204('0x1ae'),'foreignKey':_0xf204('0x154'),'onDelete':_0xf204('0x113'),'hooks':!![],'required':![]});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x119'),'foreignKey':_0xf204('0x154'),'onDelete':'restrict'});db[_0xf204('0x81')]['hasMany'](db[_0xf204('0x16e')],{'as':'MailApplications','foreignKey':_0xf204('0x154')});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x198')],{'as':'ChatApplications','foreignKey':_0xf204('0x154')});db[_0xf204('0x81')][_0xf204('0x117')](db[_0xf204('0x4a')],{'as':_0xf204('0x1af'),'foreignKey':'IntervalId'});db[_0xf204('0x81')]['hasMany'](db[_0xf204('0x53')],{'as':_0xf204('0x1b0'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x87')][_0xf204('0x121')](db[_0xf204('0x13c')],{});db[_0xf204('0x87')][_0xf204('0x121')](db[_0xf204('0x9c')],{'foreignKey':'DefaultReportId'});db[_0xf204('0x87')][_0xf204('0x121')](db['AnalyticCustomReport'],{'foreignKey':_0xf204('0x1b1')});db['Sound'][_0xf204('0x123')](db[_0xf204('0x19')],{'as':_0xf204('0x1b2'),'through':_0xf204('0x1b3'),'onDelete':_0xf204('0x168')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x73')],{'through':_0xf204('0x1a3')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x68')],{'through':_0xf204('0x19f')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x3e')],{'through':_0xf204('0x177')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x55')],{'through':'sms_interaction_has_tags'});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x4c')],{'through':_0xf204('0x188')});db[_0xf204('0x8a')]['belongsToMany'](db[_0xf204('0x5e')],{'through':_0xf204('0x193')});db[_0xf204('0x8a')][_0xf204('0x123')](db[_0xf204('0x11e')],{'through':'whatsapp_interaction_has_tags'});db[_0xf204('0x8e')]['belongsTo'](db[_0xf204('0x8c')],{'as':_0xf204('0x1b4'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xf204('0x121')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xf204('0x1b5')});db[_0xf204('0x8e')]['belongsTo'](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x1b6')});db[_0xf204('0x94')][_0xf204('0x117')](db['Condition'],{'as':{'plural':_0xf204('0x1b7'),'singular':_0xf204('0x1b8')},'foreignKey':_0xf204('0x1b9'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x94')][_0xf204('0x117')](db['Condition'],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xf204('0x1ba'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x94')][_0xf204('0x117')](db['Action'],{'as':_0xf204('0x1ac'),'foreignKey':_0xf204('0x1bb'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x9a')][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1b1'),'hooks':!![]});db['AnalyticDefaultReport'][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1be')});db['AnalyticMetric'][_0xf204('0x117')](db[_0xf204('0x1bc')],{'as':'Fields','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1bf')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0xf204('0x1bf')});db['SalesforceAccount']['hasMany'](db[_0xf204('0xa5')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xa5')][_0xf204('0x117')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xf204('0x113'),'foreignKey':'SubjectId'});db[_0xf204('0xa5')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1c2'),'onDelete':'cascade','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xa5')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':'FieldId'});db[_0xf204('0xa5')][_0xf204('0x121')](db['SalesforceAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xa7')][_0xf204('0x117')](db['SalesforceField'],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xa7')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf204('0xa7')][_0xf204('0x117')](db[_0xf204('0xa7')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0xa7')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['SugarcrmAccount'][_0xf204('0x117')](db[_0xf204('0xab')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xab')][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':'Subjects','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xab')][_0xf204('0x117')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1bd'),'onDelete':'cascade','foreignKey':_0xf204('0x1c7')});db[_0xf204('0xab')][_0xf204('0x121')](db[_0xf204('0xa9')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1ca')][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1ca')][_0xf204('0x117')](db['SugarcrmField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db['SugarcrmField'][_0xf204('0x117')](db[_0xf204('0x1ca')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1ca')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xad')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xaf')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db['DeskConfiguration'][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xaf')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0xf204('0x121')](db[_0xf204('0xad')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xaf')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':'int_desk_configuration_has_tags'});db[_0xf204('0xb1')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':'Subject','foreignKey':_0xf204('0x1c5')});db['DeskField'][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xb1')][_0xf204('0x117')](db[_0xf204('0xb1')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0xb1')][_0xf204('0x121')](db['Variable'],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['ZohoAccount'][_0xf204('0x117')](db[_0xf204('0xb5')],{'as':_0xf204('0x1c0'),'onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xb5')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c5')});db['ZohoConfiguration'][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db[_0xf204('0xb5')][_0xf204('0x117')](db['ZohoField'],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db['ZohoConfiguration'][_0xf204('0x121')](db[_0xf204('0xb3')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1cd')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0x1cd')][_0xf204('0x117')](db[_0xf204('0x1cd')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db['ZohoField']['hasMany'](db[_0xf204('0x1cd')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ZohoField'][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xb8')][_0xf204('0x117')](db[_0xf204('0xba')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1c2'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xba')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1bd'),'foreignKey':_0xf204('0x1c7')});db['ZendeskConfiguration'][_0xf204('0x121')](db['ZendeskAccount'],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xba')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1ce')});db['ZendeskField']['hasMany'](db[_0xf204('0xbc')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xbc')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xf204('0xbc')][_0xf204('0x117')](db[_0xf204('0xbc')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ZendeskField']['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':'VariableId'});db[_0xf204('0xbe')][_0xf204('0x117')](db['FreshdeskConfiguration'],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':'AccountId'});db[_0xf204('0xc0')]['hasMany'](db[_0xf204('0x1cf')],{'as':_0xf204('0x1cc'),'onDelete':_0xf204('0x113'),'foreignKey':'SubjectId'});db[_0xf204('0xc0')]['hasMany'](db[_0xf204('0x1cf')],{'as':_0xf204('0x1c2'),'onDelete':'cascade','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc0')]['hasMany'](db['FreshdeskField'],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db['FreshdeskConfiguration']['belongsTo'](db[_0xf204('0xbe')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc0')]['belongsToMany'](db[_0xf204('0x8a')],{'through':_0xf204('0x1d0')});db[_0xf204('0x1cf')][_0xf204('0x117')](db[_0xf204('0x1cf')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1cf')][_0xf204('0x117')](db[_0xf204('0x1cf')],{'as':'Description','foreignKey':_0xf204('0x1c3')});db['FreshdeskField']['hasMany'](db[_0xf204('0x1cf')],{'as':'Field','foreignKey':'FieldId'});db[_0xf204('0x1cf')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['VtigerAccount'][_0xf204('0x117')](db[_0xf204('0xc3')],{'as':_0xf204('0x1c0'),'onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc3')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':_0xf204('0x1cc'),'foreignKey':'SubjectId'});db['VtigerConfiguration'][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Descriptions','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc3')]['hasMany'](db[_0xf204('0xc5')],{'as':_0xf204('0x1bd'),'foreignKey':'FieldId'});db[_0xf204('0xc3')][_0xf204('0x121')](db[_0xf204('0x1d1')],{'as':_0xf204('0x176'),'foreignKey':'AccountId'});db[_0xf204('0xc5')][_0xf204('0x117')](db['VtigerField'],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xc5')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Description','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc5')][_0xf204('0x117')](db[_0xf204('0xc5')],{'as':'Field','foreignKey':_0xf204('0x1c7')});db[_0xf204('0xc5')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xc7')][_0xf204('0x117')](db[_0xf204('0xc9')],{'as':'Configurations','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xc9')][_0xf204('0x117')](db['ServicenowField'],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db['ServicenowConfiguration'][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':'Descriptions','foreignKey':_0xf204('0x1c3')});db[_0xf204('0xc9')][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':'Fields','foreignKey':'FieldId'});db[_0xf204('0xc9')][_0xf204('0x121')](db[_0xf204('0xc7')],{'as':'Account','foreignKey':_0xf204('0x1c1')});db['ServicenowField'][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0xcb')][_0xf204('0x117')](db['ServicenowField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xcb')][_0xf204('0x117')](db[_0xf204('0xcb')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db['ServicenowField'][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db[_0xf204('0xcc')][_0xf204('0x117')](db[_0xf204('0x1d2')],{'as':_0xf204('0x1c0'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xcc')][_0xf204('0x121')](db[_0xf204('0x165')],{'as':_0xf204('0x165'),'foreignKey':_0xf204('0x166')});db['Dynamics365Configuration'][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1cc'),'onDelete':'cascade','foreignKey':_0xf204('0x1c5')});db[_0xf204('0x1d2')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1c2'),'onDelete':_0xf204('0x113'),'foreignKey':'DescriptionId'});db[_0xf204('0x1d2')]['hasMany'](db[_0xf204('0x1d3')],{'as':_0xf204('0x1bd'),'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1d2')][_0xf204('0x121')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xf204('0x1c1')});db[_0xf204('0x1d3')]['hasMany'](db['Dynamics365Field'],{'as':_0xf204('0x1c4'),'foreignKey':'SubjectId'});db[_0xf204('0x1d3')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0x1d3')][_0xf204('0x117')](db[_0xf204('0x1d3')],{'as':_0xf204('0x1c6'),'foreignKey':_0xf204('0x1c7')});db[_0xf204('0x1d3')]['belongsTo'](db[_0xf204('0x1c8')],{'as':_0xf204('0x1c8'),'foreignKey':_0xf204('0x1c9')});db['FreshsalesAccount'][_0xf204('0x117')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xf204('0x1c1')});db[_0xf204('0xcf')][_0xf204('0x117')](db[_0xf204('0xd1')],{'as':_0xf204('0x1cc'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xcf')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c2'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xcf')][_0xf204('0x117')](db[_0xf204('0xd1')],{'as':_0xf204('0x1bd'),'foreignKey':_0xf204('0x1c7')});db['FreshsalesConfiguration'][_0xf204('0x121')](db[_0xf204('0x1d4')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1c1')});db[_0xf204('0xd1')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c4'),'foreignKey':_0xf204('0x1c5')});db[_0xf204('0xd1')][_0xf204('0x117')](db['FreshsalesField'],{'as':_0xf204('0x1cb'),'foreignKey':_0xf204('0x1c3')});db[_0xf204('0xd1')]['hasMany'](db[_0xf204('0xd1')],{'as':_0xf204('0x1c6'),'foreignKey':'FieldId'});db[_0xf204('0xd1')][_0xf204('0x121')](db[_0xf204('0x1c8')],{'as':'Variable','foreignKey':_0xf204('0x1c9')});db[_0xf204('0xd3')][_0xf204('0x121')](db['ChatWebsite'],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':'List','foreignKey':_0xf204('0x171')});db[_0xf204('0xd3')][_0xf204('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0xf204('0x163')});db[_0xf204('0xd3')]['belongsTo'](db[_0xf204('0x68')],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0x6a')],{});db[_0xf204('0xd3')][_0xf204('0x121')](db['User'],{});db[_0xf204('0xd3')][_0xf204('0x121')](db[_0xf204('0x19b')],{});db[_0xf204('0xd4')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1d5')});db[_0xf204('0xd4')][_0xf204('0x121')](db[_0xf204('0x14')],{'onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x1d6')});db[_0xf204('0xd9')][_0xf204('0x117')](db[_0xf204('0x1d7')],{'foreignKey':_0xf204('0x1d8'),'onDelete':_0xf204('0x113')});db[_0xf204('0xd9')][_0xf204('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xf204('0x1d8'),'onDelete':_0xf204('0x113')});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x51')],{});db[_0xf204('0xda')]['belongsTo'](db['CmList'],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0xda')][_0xf204('0x121')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xf204('0x121')](db[_0xf204('0x56')],{});db[_0xf204('0xda')][_0xf204('0x121')](db[_0xf204('0x14')],{});db['SmsQueueReport']['belongsTo'](db[_0xf204('0x58')],{});db[_0xf204('0x1d9')][_0xf204('0x117')](db[_0xf204('0xd9')],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0x1d9')][_0xf204('0x117')](db[_0xf204('0x1d7')],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0x1d9')][_0xf204('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xf204('0x1da')});db[_0xf204('0xe3')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Users','through':_0xf204('0x143')});db[_0xf204('0xe9')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x128')});db['Team'][_0xf204('0x123')](db[_0xf204('0x1b')],{'through':_0xf204('0x10b'),'as':_0xf204('0x1db')});db['Team'][_0xf204('0x123')](db[_0xf204('0x3b')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xf204('0xe9')][_0xf204('0x123')](db[_0xf204('0x19b')],{'through':_0xf204('0x1dc'),'as':_0xf204('0x131')});db[_0xf204('0xe9')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xf204('0x134')});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x58')],{'through':_0xf204('0x190'),'as':'SmsQueues'});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x62')],{'through':'team_has_openchannel_queues','as':_0xf204('0x136')});db[_0xf204('0xe9')]['belongsToMany'](db[_0xf204('0x108')],{'through':'team_has_whatsapp_queues','as':_0xf204('0x137')});db['Team'][_0xf204('0x123')](db[_0xf204('0x1dd')],{'through':'TeamVoicePrefix','as':_0xf204('0x130')});db['Campaign'][_0xf204('0x117')](db[_0xf204('0x74')],{'as':'Hoppers','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')]['hasMany'](db[_0xf204('0x76')],{'as':'HopperFinals','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')][_0xf204('0x117')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xf204('0x1a4')});db[_0xf204('0xed')][_0xf204('0x117')](db[_0xf204('0x14d')],{'as':_0xf204('0x14e'),'foreignKey':_0xf204('0x1a4')});db['Campaign']['belongsTo'](db[_0xf204('0x150')],{'as':'Trunk','foreignKey':_0xf204('0x151')});db[_0xf204('0xed')][_0xf204('0x121')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xf204('0x153')});db[_0xf204('0xed')][_0xf204('0x121')](db[_0xf204('0x81')],{'as':'Interval','foreignKey':_0xf204('0x154')});db[_0xf204('0xed')][_0xf204('0x121')](db[_0xf204('0xe3')],{'as':_0xf204('0xe3'),'foreignKey':_0xf204('0x1de')});db[_0xf204('0xed')][_0xf204('0x123')](db['CmList'],{'as':_0xf204('0x156'),'through':'campaigns_has_cm_lists'});db[_0xf204('0xed')][_0xf204('0x123')](db[_0xf204('0xfb')],{'as':_0xf204('0x15a'),'through':'campaigns_has_cm_blacklists'});db[_0xf204('0x17b')]['belongsTo'](db[_0xf204('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0xf204('0x180')});db[_0xf204('0xf3')]['belongsTo'](db[_0xf204('0x40')],{});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x3e')],{});db[_0xf204('0xf3')]['belongsTo'](db[_0xf204('0x13c')],{'foreignKey':_0xf204('0x1df'),'as':_0xf204('0x1e0')});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db['MailTransferReport'][_0xf204('0x121')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xf204('0xf3')][_0xf204('0x121')](db[_0xf204('0x3b')],{'foreignKey':_0xf204('0x1e3'),'as':_0xf204('0x1e4')});db[_0xf204('0xf3')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xf204('0x1e5'),'as':_0xf204('0x1e6')});db[_0xf204('0xf5')][_0xf204('0x121')](db['ChatMessage'],{});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x68')],{});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x64')],{'foreignKey':'FromChatWebsiteId','as':_0xf204('0x1e0')});db['ChatTransferReport'][_0xf204('0x121')](db['User'],{'foreignKey':_0xf204('0x1e1'),'as':'FromAgent'});db[_0xf204('0xf5')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':'ToUserId','as':_0xf204('0x1e7')});db[_0xf204('0xf5')]['belongsTo'](db[_0xf204('0x19b')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xf204('0xf5')]['belongsTo'](db[_0xf204('0x64')],{'foreignKey':_0xf204('0x1e8'),'as':_0xf204('0x1e6')});db['FaxTransferReport'][_0xf204('0x121')](db[_0xf204('0x186')],{});db['FaxTransferReport']['belongsTo'](db[_0xf204('0x4c')],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0xf204('0x1e9'),'as':_0xf204('0x1e0')});db[_0xf204('0xf7')][_0xf204('0x121')](db['User'],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0xf7')]['belongsTo'](db[_0xf204('0x14')],{'foreignKey':'ToUserId','as':_0xf204('0x1e7')});db['FaxTransferReport']['belongsTo'](db[_0xf204('0x133')],{'foreignKey':_0xf204('0x1ea'),'as':'ToQueue'});db['FaxTransferReport'][_0xf204('0x121')](db[_0xf204('0x139')],{'foreignKey':_0xf204('0x1eb'),'as':_0xf204('0x1e6')});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelMessage'],{});db[_0xf204('0xf8')]['belongsTo'](db[_0xf204('0x5e')],{});db['OpenchannelTransferReport'][_0xf204('0x121')](db[_0xf204('0x5a')],{'foreignKey':_0xf204('0x1ec'),'as':'FromAccount'});db[_0xf204('0xf8')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':'FromAgent'});db[_0xf204('0xf8')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':'ToAgent'});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelQueue'],{'foreignKey':_0xf204('0x1ee'),'as':'ToQueue'});db[_0xf204('0xf8')][_0xf204('0x121')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x56')],{});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x55')],{});db['SmsTransferReport'][_0xf204('0x121')](db['SmsAccount'],{'foreignKey':_0xf204('0x1ef'),'as':_0xf204('0x1e0')});db['SmsTransferReport']['belongsTo'](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':_0xf204('0x1e7')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x58')],{'foreignKey':'ToSmsQueueId','as':_0xf204('0x1e4')});db[_0xf204('0xf9')][_0xf204('0x121')](db[_0xf204('0x51')],{'foreignKey':_0xf204('0x1f0'),'as':'ToAccount'});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x171'),'onDelete':_0xf204('0x113')});db[_0xf204('0xfb')][_0xf204('0x117')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xf204('0xfb')]['hasMany'](db[_0xf204('0x73')],{'as':'Contacts','onDelete':_0xf204('0x113'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x76')],{'as':_0xf204('0x14c'),'foreignKey':_0xf204('0x171')});db[_0xf204('0xfb')][_0xf204('0x117')](db[_0xf204('0x11a')],{'as':_0xf204('0x11b'),'foreignKey':_0xf204('0x171')});db['CmList']['hasMany'](db[_0xf204('0x79')],{'as':_0xf204('0x79'),'foreignKey':'ListId'});db[_0xf204('0xfb')][_0xf204('0x123')](db[_0xf204('0x1b')],{'as':_0xf204('0x1f1'),'through':'voice_queues_has_cm_lists'});db[_0xf204('0xfb')]['belongsToMany'](db[_0xf204('0x14')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xf204('0x1dd')][_0xf204('0x117')](db[_0xf204('0x18')],{'as':_0xf204('0x119'),'onDelete':_0xf204('0x113')});db[_0xf204('0x1dd')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':'Agents','through':_0xf204('0x10f')});db['VoicePrefix'][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':_0xf204('0x10d'),'as':'Teams'});db[_0xf204('0xfd')][_0xf204('0x117')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'foreignKey':_0xf204('0x122')});db[_0xf204('0xfd')][_0xf204('0x117')](db[_0xf204('0x1f2')],{'as':_0xf204('0x1f3'),'foreignKey':_0xf204('0x122'),'onDelete':'cascade'});db[_0xf204('0x1f2')][_0xf204('0x117')](db[_0xf204('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xf204('0x113')});db['WhatsappAccount'][_0xf204('0x117')](db[_0xf204('0x16a')],{'as':_0xf204('0x16b'),'foreignKey':_0xf204('0x1f4'),'onDelete':_0xf204('0x113')});db[_0xf204('0x1f5')][_0xf204('0x117')](db[_0xf204('0x7d')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xf204('0x1f5')][_0xf204('0x117')](db[_0xf204('0x103')],{'as':_0xf204('0x16d'),'foreignKey':_0xf204('0x1f4')});db[_0xf204('0x1f5')]['hasMany'](db['WhatsappInteraction'],{'as':_0xf204('0x184')});db[_0xf204('0x1f5')]['hasMany'](db['WhatsappApplication'],{'as':_0xf204('0x16f')});db['WhatsappAccount'][_0xf204('0x121')](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db['WhatsappAccount']['belongsTo'](db[_0xf204('0x83')],{'as':_0xf204('0x155'),'foreignKey':_0xf204('0x173')});db[_0xf204('0x1f5')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x141')});db[_0xf204('0x1f6')]['belongsTo'](db[_0xf204('0x14')],{'onDelete':'restrict'});db[_0xf204('0x1f6')][_0xf204('0x121')](db[_0xf204('0x108')],{'onDelete':_0xf204('0x168')});db['WhatsappApplication'][_0xf204('0x121')](db[_0xf204('0x1f5')],{'onDelete':_0xf204('0x168')});db[_0xf204('0x1f6')][_0xf204('0x121')](db[_0xf204('0x81')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x154')});db[_0xf204('0x1f6')]['belongsTo'](db[_0xf204('0x8a')],{'onDelete':_0xf204('0x168'),'foreignKey':_0xf204('0x181')});db['WhatsappInteraction'][_0xf204('0x117')](db[_0xf204('0x103')],{'as':_0xf204('0x16d'),'onDelete':'cascade','foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xf204('0x121')](db[_0xf204('0x1f5')],{'as':_0xf204('0x176'),'foreignKey':_0xf204('0x1f4')});db[_0xf204('0x11e')]['belongsTo'](db['CmContact'],{'as':_0xf204('0x162'),'foreignKey':'ContactId'});db[_0xf204('0x11e')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x18b'),'foreignKey':_0xf204('0x114')});db[_0xf204('0x11e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1f7'),'as':_0xf204('0x178')});db[_0xf204('0x11e')][_0xf204('0x123')](db[_0xf204('0x8a')],{'through':_0xf204('0x1f7'),'as':_0xf204('0x179')});db['WhatsappInteraction'][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x17a'),'through':'user_has_whatsapp_interactions','foreignKey':_0xf204('0x1f8')});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x14')});db[_0xf204('0x103')][_0xf204('0x121')](db['CmContact'],{'onDelete':_0xf204('0x113'),'as':'Contact'});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x11e')],{'onDelete':_0xf204('0x113'),'as':'Interaction','foreignKey':_0xf204('0x1f8')});db[_0xf204('0x103')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'as':'Account','foreignKey':_0xf204('0x1f4')});db[_0xf204('0x105')]['belongsTo'](db['WhatsappAccount'],{});db[_0xf204('0x105')]['belongsTo'](db[_0xf204('0xfb')],{'as':_0xf204('0x170'),'foreignKey':_0xf204('0x171')});db[_0xf204('0x105')][_0xf204('0x121')](db[_0xf204('0x73')],{'as':_0xf204('0x162'),'foreignKey':_0xf204('0x163')});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappInteraction'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappQueue'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['WhatsappMessage'],{});db[_0xf204('0x105')][_0xf204('0x121')](db['User'],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x103')],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x11e')],{});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'foreignKey':_0xf204('0x1fa'),'as':'FromAccount'});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x1f5')],{'foreignKey':_0xf204('0x1fb'),'as':_0xf204('0x1e6')});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x108')],{'foreignKey':_0xf204('0x1fc'),'as':_0xf204('0x1e4')});db['WhatsappTransferReport']['belongsTo'](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1e1'),'as':_0xf204('0x1e2')});db[_0xf204('0x1f9')][_0xf204('0x121')](db[_0xf204('0x14')],{'foreignKey':_0xf204('0x1ed'),'as':_0xf204('0x1e7')});db[_0xf204('0x108')][_0xf204('0x123')](db[_0xf204('0x14')],{'as':_0xf204('0x158'),'through':_0xf204('0x36'),'foreignKey':_0xf204('0x1fd')});db[_0xf204('0x108')][_0xf204('0x123')](db[_0xf204('0xe9')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0xf204('0x110')][_0xf204('0x121')](db[_0xf204('0x14')],{'as':_0xf204('0x1fe'),'foreignKey':_0xf204('0x114'),'onDelete':_0xf204('0x113'),'hooks':!![]});db[_0xf204('0x165')][_0xf204('0x111')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xf204('0x165')]['hasOne'](db['MailServerIn'],{'as':_0xf204('0x1ff'),'onDelete':_0xf204('0x168')});db[_0xf204('0x165')][_0xf204('0x111')](db['MailServerOut'],{'as':'Smtp','onDelete':'restrict'});module[_0xf204('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe56b=['ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperFinal','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','Schedule','../api/schedule/schedule.model','Sound','ContactItemType','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','UserMailQueue','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserWhatsappQueue','cm_user_has_lists','ChatWebsite','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','HopperHistories','ReportAgentPreview','CmHopperBlack','HopperBlacks','JscriptySessions','belongsTo','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Agents','Teams','voice_queues_has_cm_blacklists','mailbox','mailboxuser','QueueCalls','uniqueid','CmContact','Contact','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','MailServerOut','Dispositions','Answers','MailMessage','Interactions','List','TemplateId','mandatoryDispositionPause','user_has_mail_accounts','team_has_mail_queues','Messages','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatOfflineMessageId','ListId','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsInteractionId','Tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ChatWebsiteId','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','CmCompany','CompanyId','CmContactHasItem','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','Action','Actions','AutomationId','ParentId','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','moh_has_sounds','ItemType','CmHopperAdditionalPhone','Hopper','Trigger','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','SubjectId','DescriptionId','FieldId','AccountId','Description','Field','VariableId','Subjects','Descriptions','Subject','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','ToId','SessionId','JscriptyAnswerReport','VoiceQueues','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','sequelize','lodash','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','password','options','username','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe56b,0x189));var _0xbe56=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe56b[_0x2dafbe];return _0x58a45a;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xbe56('0x0'));var _=require(_0xbe56('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xbe56('0x0')]=_[_0xbe56('0x2')](config[_0xbe56('0x0')],{'database':_0xbe56('0x3'),'username':_0xbe56('0x4'),'password':'xC@LL1234','options':{'host':_0xbe56('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xbe56('0x6')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xbe56('0x7'),'collate':_0xbe56('0x8')}}});config[_0xbe56('0x9')]=_['defaultsDeep'](config[_0xbe56('0x9')],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbe56('0xa')](),'define':{'charset':_0xbe56('0x7'),'collate':_0xbe56('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbe56('0x0')]['database'],config[_0xbe56('0x0')]['username'],config['sequelize'][_0xbe56('0xb')],config[_0xbe56('0x0')][_0xbe56('0xc')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbe56('0x9')]['database'],config['sequelizeHistory'][_0xbe56('0xd')],config['sequelizeHistory'][_0xbe56('0xb')],config[_0xbe56('0x9')]['options'])};db['User']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xf'));db[_0xbe56('0x10')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x11'));db[_0xbe56('0x12')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x13'));db[_0xbe56('0x14')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x15'));db[_0xbe56('0x16')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xbe56('0x17')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x18'));db['VoiceRecording']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x19'));db[_0xbe56('0x1a')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x1b'));db[_0xbe56('0x1c')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x1d'));db[_0xbe56('0x1e')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x1f'));db[_0xbe56('0x20')]=db['sequelize']['import'](_0xbe56('0x21'));db['VoiceDialReport']=db[_0xbe56('0x0')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xbe56('0x22')]=db['sequelize']['import']('../api/voiceAgentReport/voiceAgentReport.model');db['VoiceQueueReport']=db[_0xbe56('0x0')]['import'](_0xbe56('0x23'));db[_0xbe56('0x24')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x25'));db[_0xbe56('0x26')]=db['sequelize'][_0xbe56('0xe')]('../api/trunk/trunk.model');db[_0xbe56('0x27')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x28'));db[_0xbe56('0x29')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xbe56('0x2a')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x2b'));db[_0xbe56('0x2c')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x2d'));db['UserMailQueue']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x2e'));db[_0xbe56('0x2f')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x30'));db[_0xbe56('0x31')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x32'));db[_0xbe56('0x33')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xbe56('0x0')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x34'));db['MailServerOut']=db[_0xbe56('0x0')]['import'](_0xbe56('0x35'));db[_0xbe56('0x36')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x37'));db[_0xbe56('0x38')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x39'));db['MailSubstatus']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/mailSubstatus/mailSubstatus.model');db[_0xbe56('0x3a')]=db[_0xbe56('0x0')]['import']('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x3b'));db[_0xbe56('0x3c')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x3d'));db[_0xbe56('0x3e')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x3f'));db['Dashboard']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x40'));db[_0xbe56('0x41')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/dashboardItem/dashboardItem.model');db[_0xbe56('0x42')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/faxAccount/faxAccount.model');db[_0xbe56('0x43')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x44'));db[_0xbe56('0x45')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x46'));db[_0xbe56('0x47')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/faxMessage/faxMessage.model');db[_0xbe56('0x48')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x49'));db[_0xbe56('0x4a')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x4b'));db['SmsAccount']=db['sequelize'][_0xbe56('0xe')]('../api/smsAccount/smsAccount.model');db[_0xbe56('0x4c')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x4d'));db[_0xbe56('0x4e')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x4f'));db[_0xbe56('0x50')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x51'));db[_0xbe56('0x52')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x53'));db[_0xbe56('0x54')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x55'));db[_0xbe56('0x56')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x57'));db[_0xbe56('0x58')]=db['sequelize'][_0xbe56('0xe')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x59'));db['OpenchannelQueue']=db[_0xbe56('0x0')]['import'](_0xbe56('0x5a'));db['ChatWebsite']=db['sequelize'][_0xbe56('0xe')]('../api/chatWebsite/chatWebsite.model');db[_0xbe56('0x5b')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x5c'));db[_0xbe56('0x5d')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x5e'));db[_0xbe56('0x5f')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0xbe56('0x0')]['import'](_0xbe56('0x60'));db[_0xbe56('0x61')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x62'));db['ChatQueue']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/chatQueue/chatQueue.model');db[_0xbe56('0x63')]=db[_0xbe56('0x0')]['import']('../api/chatGroup/chatGroup.model');db[_0xbe56('0x64')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x65'));db['CmCompany']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x66'));db['CmContact']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x67'));db[_0xbe56('0x68')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x69'));db['CmHopperBlack']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xbe56('0x6a')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x6b'));db['ReportAgentPreview']=db['sequelize']['import'](_0xbe56('0x6c'));db[_0xbe56('0x6d')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x6e'));db['Action']=db['sequelize']['import'](_0xbe56('0x6f'));db[_0xbe56('0x70')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/automation/automation.model');db[_0xbe56('0x71')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x72'));db[_0xbe56('0x73')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x74'));db[_0xbe56('0x75')]=db[_0xbe56('0x0')]['import']('../api/condition/condition.model');db[_0xbe56('0x76')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x77'));db[_0xbe56('0x78')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x79'));db[_0xbe56('0x7a')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x7b'));db['VoiceQueuesLog']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xbe56('0x7c')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x7d'));db[_0xbe56('0x7e')]=db['sequelize'][_0xbe56('0xe')]('../api/sound/sound.model');db['Tag']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/tag/tag.model');db[_0xbe56('0x7f')]=db['sequelize'][_0xbe56('0xe')]('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x80'));db['CmHopperAdditionalPhone']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x81'));db[_0xbe56('0x82')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x83'));db['Trigger']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x84'));db[_0xbe56('0x85')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x86'));db[_0xbe56('0x87')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/integration/integration.model');db[_0xbe56('0x88')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x89'));db[_0xbe56('0x8a')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x8b'));db[_0xbe56('0x8c')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x8d'));db[_0xbe56('0x8e')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x8f'));db[_0xbe56('0x90')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x91'));db[_0xbe56('0x92')]=db[_0xbe56('0x0')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xbe56('0x93')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x94'));db['SalesforceAccount']=db[_0xbe56('0x0')]['import'](_0xbe56('0x95'));db[_0xbe56('0x96')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x97'));db[_0xbe56('0x98')]=db[_0xbe56('0x0')]['import'](_0xbe56('0x99'));db[_0xbe56('0x9a')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x9b'));db[_0xbe56('0x9c')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x9d'));db[_0xbe56('0x9e')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0x9f'));db['DeskAccount']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xa0'));db[_0xbe56('0xa1')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xbe56('0xa2')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xa3'));db[_0xbe56('0xa4')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xbe56('0x0')]['import'](_0xbe56('0xa5'));db[_0xbe56('0xa6')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xa7'));db[_0xbe56('0xa8')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xbe56('0xa9')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xaa'));db[_0xbe56('0xab')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xac'));db[_0xbe56('0xad')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xae'));db['FreshdeskConfiguration']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xaf'));db[_0xbe56('0xb0')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xbe56('0xb1')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xb2'));db[_0xbe56('0xb3')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xbe56('0xb4')]=db['sequelize']['import']('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xb5'));db[_0xbe56('0xb6')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xb7'));db[_0xbe56('0xb8')]=db['sequelize']['import']('../api/intServicenowField/intServicenowField.model');db[_0xbe56('0xb9')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xba'));db['Dynamics365Configuration']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xbb'));db['Dynamics365Field']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db[_0xbe56('0x0')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xbc'));db[_0xbe56('0xbd')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xbe'));db['Integration']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xbf'));db[_0xbe56('0xc0')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xc1'));db[_0xbe56('0xc2')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xc3'));db[_0xbe56('0xc4')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xc5'));db['JscriptyAnswerReport']=db['sequelize']['import'](_0xbe56('0xc6'));db[_0xbe56('0xc7')]=db[_0xbe56('0x0')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xbe56('0xc8')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xc9'));db[_0xbe56('0xca')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xcb'));db[_0xbe56('0xcc')]=db[_0xbe56('0x0')]['import']('../api/squareReport/squareReport.model');db[_0xbe56('0xcd')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xce'));db[_0xbe56('0xcf')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xd0'));db['Setting']=db[_0xbe56('0x0')]['import'](_0xbe56('0xd1'));db[_0xbe56('0xd2')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xd3'));db[_0xbe56('0xd4')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xd5'));db[_0xbe56('0xd6')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xd7'));db['SquareMessage']=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xd8'));db[_0xbe56('0xd9')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/team/team.model');db[_0xbe56('0xda')]=db['sequelize']['import'](_0xbe56('0xdb'));db[_0xbe56('0xdc')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xdd'));db['Migration']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xde'));db[_0xbe56('0xdf')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xe0'));db['Plugin']=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xe1'));db[_0xbe56('0xe2')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xe3'));db[_0xbe56('0xe4')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xe5'));db[_0xbe56('0xe6')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xe7'));db[_0xbe56('0xe8')]=db[_0xbe56('0x0')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xbe56('0xe9')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/smsTransferReport/smsTransferReport.model');db[_0xbe56('0xea')]=db[_0xbe56('0x0')]['import']('../api/cmList/cmList.model');db[_0xbe56('0xeb')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/voicePrefix/voicePrefix.model');db[_0xbe56('0xec')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xed'));db[_0xbe56('0xee')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xef'));db[_0xbe56('0xf0')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xf1'));db['UserNotification']=db[_0xbe56('0x0')]['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/whatsappAccount/whatsappAccount.model');db[_0xbe56('0xf2')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xf3'));db[_0xbe56('0xf4')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xf5'));db[_0xbe56('0xf6')]=db[_0xbe56('0x0')][_0xbe56('0xe')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0xbe56('0x0')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xbe56('0xf7')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xf8'));db[_0xbe56('0xf9')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0xfa'));db[_0xbe56('0xfb')]=db[_0xbe56('0x0')]['import']('../api/cloudProvider/cloudProvider.model');db[_0xbe56('0xfc')]=db[_0xbe56('0x0')]['import'](_0xbe56('0xfd'));db[_0xbe56('0xfe')]=db['sequelize'][_0xbe56('0xe')](_0xbe56('0xff'));db[_0xbe56('0x100')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x101'));db[_0xbe56('0x102')]=db[_0xbe56('0x0')][_0xbe56('0xe')](_0xbe56('0x103'));db[_0xbe56('0x104')][_0xbe56('0x105')](db[_0xbe56('0x1c')],{'as':'VoiceMail','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x107')});db['User'][_0xbe56('0x105')](db[_0xbe56('0x102')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xbe56('0x107')});db['User'][_0xbe56('0x108')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xbe56('0x109'),'foreignKey':_0xbe56('0x107')});db['User']['hasMany'](db[_0xbe56('0x14')],{'as':_0xbe56('0x10a'),'onDelete':_0xbe56('0x106'),'hooks':!![]});db[_0xbe56('0x104')][_0xbe56('0x108')](db['CmHopperFinal'],{'as':_0xbe56('0x10b'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')][_0xbe56('0x108')](db[_0xbe56('0x10c')],{'as':_0xbe56('0x10d'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'UserId'});db['User'][_0xbe56('0x108')](db['OpenchannelInteraction'],{'as':_0xbe56('0x10e'),'foreignKey':'UserId'});db[_0xbe56('0x104')]['hasMany'](db[_0xbe56('0x5f')],{'as':_0xbe56('0x10f'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')][_0xbe56('0x108')](db[_0xbe56('0x4e')],{'as':_0xbe56('0x110'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')][_0xbe56('0x108')](db[_0xbe56('0x45')],{'as':_0xbe56('0x111'),'foreignKey':'UserId'});db[_0xbe56('0x104')][_0xbe56('0x108')](db[_0xbe56('0x3a')],{'as':_0xbe56('0x112'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x104')]['hasMany'](db['WhatsappInteraction'],{'as':_0xbe56('0x113'),'foreignKey':_0xbe56('0x107')});db['User'][_0xbe56('0x108')](db['UserNotification'],{'as':_0xbe56('0x114'),'foreignKey':_0xbe56('0x115')});db['User']['belongsTo'](db[_0xbe56('0xec')],{'as':_0xbe56('0xec'),'foreignKey':'userProfileId'});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x63')],{'as':'Groups','through':'chat_group_has_users'});db[_0xbe56('0x104')][_0xbe56('0x116')](db['CmContact'],{'as':_0xbe56('0x117'),'through':_0xbe56('0x118')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0xea')],{'as':_0xbe56('0x119'),'through':'cm_user_has_lists'});db['User'][_0xbe56('0x116')](db[_0xbe56('0xd9')],{'through':_0xbe56('0x11a')});db['User'][_0xbe56('0x116')](db[_0xbe56('0x3a')],{'as':'MailInteractions','through':_0xbe56('0x11b')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x5f')],{'as':_0xbe56('0x10f'),'through':'user_has_chat_interactions'});db[_0xbe56('0x104')]['belongsToMany'](db['FaxInteraction'],{'as':_0xbe56('0x111'),'through':_0xbe56('0x11c')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x4e')],{'as':_0xbe56('0x110'),'through':_0xbe56('0x11d')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x58')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xbe56('0x104')]['belongsToMany'](db[_0xbe56('0xf4')],{'as':'WhatsappInteractions','through':_0xbe56('0x11e')});db[_0xbe56('0x104')][_0xbe56('0x116')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0xbe56('0x2a'),'required':![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0xeb')],{'as':_0xbe56('0x11f'),'through':_0xbe56('0x100'),'required':![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x38')],{'as':_0xbe56('0x120'),'through':_0xbe56('0x121'),'required':![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x122')],{'as':_0xbe56('0x123'),'through':_0xbe56('0x2c'),'required':![],'hooks':!![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x48')],{'as':_0xbe56('0x124'),'through':'UserFaxQueue','required':![]});db['User'][_0xbe56('0x116')](db[_0xbe56('0x52')],{'as':_0xbe56('0x125'),'through':'UserSmsQueue','required':![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db['OpenchannelQueue'],{'as':_0xbe56('0x126'),'through':_0xbe56('0x33'),'required':![]});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0xf9')],{'as':'WhatsappQueues','through':_0xbe56('0x127'),'required':![]});db['User']['belongsToMany'](db[_0xbe56('0xea')],{'through':_0xbe56('0x128')});db['User'][_0xbe56('0x116')](db[_0xbe56('0x129')],{'as':'ChatWebsites','through':_0xbe56('0x12a')});db[_0xbe56('0x104')]['belongsToMany'](db[_0xbe56('0x42')],{'as':_0xbe56('0x12b'),'through':_0xbe56('0x12c')});db['User']['belongsToMany'](db[_0xbe56('0x36')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x54')],{'as':_0xbe56('0x12d'),'through':_0xbe56('0x12e')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x12f')],{'as':_0xbe56('0x130'),'through':_0xbe56('0x131')});db[_0xbe56('0x104')][_0xbe56('0x116')](db[_0xbe56('0x132')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0xbe56('0x104')]['belongsToMany'](db[_0xbe56('0xd4')],{'as':_0xbe56('0x133'),'through':_0xbe56('0x134')});db['VoiceChanSpy']['hasMany'](db[_0xbe56('0x14')],{'as':_0xbe56('0x135'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x136')});db['VoiceContext'][_0xbe56('0x108')](db[_0xbe56('0x14')],{'onDelete':'cascade'});db['VoiceExtension'][_0xbe56('0x108')](db[_0xbe56('0x14')],{'as':_0xbe56('0x137'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x16')][_0xbe56('0x116')](db[_0xbe56('0x7e')],{'as':_0xbe56('0x138'),'through':'moh_has_sounds'});db[_0xbe56('0x17')]['hasMany'](db[_0xbe56('0x29')],{'as':_0xbe56('0x139'),'foreignKey':_0xbe56('0x13a')});db[_0xbe56('0x17')][_0xbe56('0x108')](db[_0xbe56('0x68')],{'as':_0xbe56('0x13b'),'foreignKey':_0xbe56('0x13a')});db[_0xbe56('0x17')]['hasMany'](db[_0xbe56('0x6a')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0xbe56('0x13c'),'foreignKey':_0xbe56('0x13a')});db[_0xbe56('0x17')][_0xbe56('0x108')](db[_0xbe56('0x13d')],{'as':_0xbe56('0x13d'),'foreignKey':_0xbe56('0x13a')});db['VoiceQueue'][_0xbe56('0x108')](db[_0xbe56('0x13e')],{'as':_0xbe56('0x13f'),'foreignKey':_0xbe56('0x13a')});db[_0xbe56('0x17')][_0xbe56('0x108')](db[_0xbe56('0xc8')],{'as':_0xbe56('0x140'),'foreignKey':'VoiceQueueId'});db[_0xbe56('0x17')]['belongsTo'](db[_0xbe56('0x26')],{'as':_0xbe56('0x26'),'foreignKey':'TrunkId'});db[_0xbe56('0x17')][_0xbe56('0x141')](db[_0xbe56('0x26')],{'as':'TrunkBackup','foreignKey':_0xbe56('0x142')});db[_0xbe56('0x17')][_0xbe56('0x141')](db[_0xbe56('0x76')],{'as':_0xbe56('0x76'),'foreignKey':_0xbe56('0x143')});db[_0xbe56('0x17')][_0xbe56('0x141')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xbe56('0x144')});db['VoiceQueue']['belongsToMany'](db[_0xbe56('0xea')],{'as':_0xbe56('0x119'),'through':'voice_queues_has_cm_lists'});db[_0xbe56('0x17')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':'UserVoiceQueue'});db[_0xbe56('0x17')]['belongsToMany'](db[_0xbe56('0xd9')],{'as':_0xbe56('0x146'),'through':'TeamVoiceQueue'});db[_0xbe56('0x17')][_0xbe56('0x116')](db[_0xbe56('0xea')],{'as':'BlackLists','through':_0xbe56('0x147')});db['VoiceRecording'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':_0xbe56('0x104'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x1a')][_0xbe56('0x141')](db['User'],{'as':_0xbe56('0x104'),'foreignKey':_0xbe56('0x107')});db['VoiceMail'][_0xbe56('0x108')](db[_0xbe56('0x1e')],{'as':'Messages','onDelete':_0xbe56('0x106'),'foreignKey':'mailboxuser','sourceKey':_0xbe56('0x148')});db[_0xbe56('0x1e')][_0xbe56('0x141')](db['VoiceMail'],{'foreignKey':_0xbe56('0x149'),'targetKey':_0xbe56('0x148')});db[_0xbe56('0x20')][_0xbe56('0x108')](db['VoiceQueueReport'],{'as':_0xbe56('0x14a'),'foreignKey':'uniqueid','constraints':![]});db[_0xbe56('0x20')]['hasMany'](db[_0xbe56('0x22')],{'as':'AgentReports','foreignKey':_0xbe56('0x14b'),'constraints':![]});db['VoiceCallReport'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':_0xbe56('0x104'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x20')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x14f')][_0xbe56('0x141')](db[_0xbe56('0x36')],{'as':_0xbe56('0x36'),'foreignKey':_0xbe56('0x150')});db[_0xbe56('0x14f')][_0xbe56('0x141')](db[_0xbe56('0xfb')],{'as':'CloudProvider','foreignKey':_0xbe56('0x151'),'onDelete':'restrict'});db['MailServerOut']['belongsTo'](db[_0xbe56('0x36')],{'as':_0xbe56('0x36'),'foreignKey':'MailAccountId'});db['MailServerOut'][_0xbe56('0x141')](db[_0xbe56('0xfb')],{'as':_0xbe56('0xfb'),'foreignKey':_0xbe56('0x151'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x36')]['hasOne'](db['MailServerIn'],{'as':_0xbe56('0x153'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x36')][_0xbe56('0x105')](db[_0xbe56('0x154')],{'as':'Smtp','onDelete':_0xbe56('0x106')});db[_0xbe56('0x36')][_0xbe56('0x108')](db[_0xbe56('0x73')],{'as':_0xbe56('0x155'),'foreignKey':_0xbe56('0x150'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x36')][_0xbe56('0x108')](db[_0xbe56('0x71')],{'as':_0xbe56('0x156'),'foreignKey':_0xbe56('0x150')});db['MailAccount'][_0xbe56('0x108')](db[_0xbe56('0x157')],{'as':'Messages','foreignKey':_0xbe56('0x150')});db[_0xbe56('0x36')][_0xbe56('0x108')](db[_0xbe56('0x3a')],{'as':_0xbe56('0x158')});db[_0xbe56('0x36')]['hasMany'](db[_0xbe56('0x3c')],{'as':_0xbe56('0x137')});db[_0xbe56('0x36')]['belongsTo'](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':'ListId'});db['MailAccount'][_0xbe56('0x141')](db[_0xbe56('0x82')],{'as':_0xbe56('0x82'),'foreignKey':_0xbe56('0x15a')});db[_0xbe56('0x36')][_0xbe56('0x141')](db[_0xbe56('0x78')],{'as':_0xbe56('0x15b'),'foreignKey':_0xbe56('0x144')});db['MailAccount'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x15c')});db[_0xbe56('0x38')][_0xbe56('0x116')](db['User'],{'as':_0xbe56('0x145'),'through':_0xbe56('0x121')});db[_0xbe56('0x38')]['belongsToMany'](db[_0xbe56('0xd9')],{'through':_0xbe56('0x15d'),'as':_0xbe56('0x146')});db['MailInteraction'][_0xbe56('0x108')](db[_0xbe56('0x157')],{'as':_0xbe56('0x15e'),'onDelete':'cascade','foreignKey':_0xbe56('0x15f')});db[_0xbe56('0x3a')]['belongsTo'](db['MailAccount'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x150')});db[_0xbe56('0x3a')][_0xbe56('0x141')](db['CmContact'],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x3a')]['belongsTo'](db['User'],{'as':_0xbe56('0x161'),'foreignKey':'UserId'});db['MailInteraction'][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x163'),'as':'Tags'});db['MailInteraction'][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x163'),'as':_0xbe56('0x164')});db[_0xbe56('0x3a')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x165'),'through':'user_has_mail_interactions','foreignKey':_0xbe56('0x15f')});db[_0xbe56('0x157')][_0xbe56('0x108')](db[_0xbe56('0xdf')],{'as':_0xbe56('0x166'),'onDelete':'cascade'});db[_0xbe56('0x157')]['belongsTo'](db[_0xbe56('0x104')],{'as':_0xbe56('0x104')});db['MailMessage'][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'onDelete':_0xbe56('0x106'),'as':'Contact'});db[_0xbe56('0x157')][_0xbe56('0x141')](db[_0xbe56('0x3a')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xbe56('0x157')]['belongsTo'](db[_0xbe56('0x36')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x150')});db[_0xbe56('0x157')][_0xbe56('0x141')](db['ChatWebsite'],{'as':_0xbe56('0x129'),'foreignKey':'ChatWebsiteId'});db[_0xbe56('0x157')]['belongsTo'](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':_0xbe56('0x167')});db['MailApplication'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':_0xbe56('0x152')});db[_0xbe56('0x3c')][_0xbe56('0x141')](db[_0xbe56('0x38')],{'onDelete':_0xbe56('0x152')});db['MailApplication'][_0xbe56('0x141')](db[_0xbe56('0x36')],{'onDelete':'restrict'});db['MailApplication'][_0xbe56('0x141')](db[_0xbe56('0x76')],{'onDelete':_0xbe56('0x152'),'foreignKey':_0xbe56('0x143')});db[_0xbe56('0x3c')][_0xbe56('0x141')](db[_0xbe56('0x162')],{'onDelete':_0xbe56('0x152'),'foreignKey':'TagId'});db[_0xbe56('0x3e')][_0xbe56('0x141')](db['MailAccount'],{});db[_0xbe56('0x3e')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168')});db['MailQueueReport'][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':'ContactId'});db[_0xbe56('0x3e')][_0xbe56('0x141')](db[_0xbe56('0x3a')],{});db[_0xbe56('0x3e')][_0xbe56('0x141')](db[_0xbe56('0x157')],{});db[_0xbe56('0x3e')]['belongsTo'](db[_0xbe56('0x104')],{});db[_0xbe56('0x3e')][_0xbe56('0x141')](db[_0xbe56('0x38')],{});db['Dashboard'][_0xbe56('0x108')](db[_0xbe56('0x41')],{'as':'Items','onDelete':_0xbe56('0x106')});db[_0xbe56('0x42')]['hasMany'](db[_0xbe56('0x73')],{'as':'Dispositions','foreignKey':_0xbe56('0x169'),'onDelete':_0xbe56('0x106')});db['FaxAccount'][_0xbe56('0x108')](db['CannedAnswer'],{'as':_0xbe56('0x156'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0xbe56('0x108')](db[_0xbe56('0x45')],{'as':'Interactions'});db[_0xbe56('0x42')][_0xbe56('0x108')](db[_0xbe56('0x43')],{'as':_0xbe56('0x137')});db[_0xbe56('0x42')][_0xbe56('0x108')](db[_0xbe56('0x14')],{'as':_0xbe56('0x16a'),'onDelete':'cascade'});db[_0xbe56('0x42')][_0xbe56('0x108')](db[_0xbe56('0x47')],{'as':_0xbe56('0x15e')});db['FaxAccount'][_0xbe56('0x141')](db[_0xbe56('0x26')],{'as':_0xbe56('0x26')});db[_0xbe56('0x42')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0x42')]['belongsTo'](db['Pause'],{'as':_0xbe56('0x15b'),'foreignKey':_0xbe56('0x144')});db[_0xbe56('0x42')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x12c')});db[_0xbe56('0x43')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':_0xbe56('0x152')});db[_0xbe56('0x43')]['belongsTo'](db[_0xbe56('0x48')],{'onDelete':'restrict'});db['FaxApplication'][_0xbe56('0x141')](db['FaxAccount'],{'onDelete':_0xbe56('0x152')});db['FaxApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xbe56('0x16b')});db[_0xbe56('0x45')][_0xbe56('0x108')](db[_0xbe56('0x47')],{'as':_0xbe56('0x15e'),'onDelete':'cascade','foreignKey':_0xbe56('0x16c')});db[_0xbe56('0x45')]['belongsTo'](db[_0xbe56('0x42')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x169')});db[_0xbe56('0x45')]['belongsTo'](db[_0xbe56('0x14c')],{'as':'Contact','foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x45')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':'Owner','foreignKey':_0xbe56('0x107')});db[_0xbe56('0x45')]['belongsToMany'](db[_0xbe56('0x162')],{'through':'fax_interaction_has_tags','as':'Tags'});db['FaxInteraction'][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x16d'),'as':_0xbe56('0x164')});db['FaxInteraction'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':'Users','through':_0xbe56('0x11c'),'foreignKey':_0xbe56('0x16c')});db['FaxMessage'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':'cascade','as':'User'});db[_0xbe56('0x47')][_0xbe56('0x141')](db[_0xbe56('0x45')],{'as':'Interaction','foreignKey':_0xbe56('0x16c')});db[_0xbe56('0x47')]['belongsTo'](db[_0xbe56('0x14c')],{'onDelete':_0xbe56('0x106'),'as':'Contact'});db['FaxMessage']['belongsTo'](db[_0xbe56('0xdf')],{'as':'Attachment','foreignKey':_0xbe56('0x16e')});db[_0xbe56('0x47')][_0xbe56('0x141')](db['FaxAccount'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x169')});db[_0xbe56('0x48')]['belongsToMany'](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x2f')});db['FaxQueue'][_0xbe56('0x116')](db['Team'],{'through':'team_has_fax_queues','as':_0xbe56('0x146')});db[_0xbe56('0x4a')][_0xbe56('0x141')](db[_0xbe56('0x42')],{});db[_0xbe56('0x4a')]['belongsTo'](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':'ListId'});db[_0xbe56('0x4a')]['belongsTo'](db['CmContact'],{'as':_0xbe56('0x14d'),'foreignKey':'ContactId'});db[_0xbe56('0x4a')]['belongsTo'](db['FaxInteraction'],{});db['FaxQueueReport'][_0xbe56('0x141')](db[_0xbe56('0x47')],{});db[_0xbe56('0x4a')][_0xbe56('0x141')](db['User'],{});db[_0xbe56('0x4a')]['belongsTo'](db[_0xbe56('0x48')],{});db[_0xbe56('0x12f')]['hasMany'](db[_0xbe56('0x73')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xbe56('0x106')});db[_0xbe56('0x12f')][_0xbe56('0x108')](db[_0xbe56('0x71')],{'as':_0xbe56('0x156'),'foreignKey':_0xbe56('0x16f')});db[_0xbe56('0x12f')]['hasMany'](db[_0xbe56('0x50')],{'as':_0xbe56('0x15e'),'foreignKey':_0xbe56('0x16f')});db[_0xbe56('0x12f')][_0xbe56('0x108')](db[_0xbe56('0x4e')],{'as':_0xbe56('0x158')});db['SmsAccount'][_0xbe56('0x108')](db[_0xbe56('0x4c')],{'as':_0xbe56('0x137')});db[_0xbe56('0x12f')][_0xbe56('0x141')](db['CmList'],{'as':_0xbe56('0x159'),'foreignKey':'ListId'});db[_0xbe56('0x12f')][_0xbe56('0x141')](db[_0xbe56('0x78')],{'as':_0xbe56('0x15b'),'foreignKey':_0xbe56('0x144')});db['SmsAccount'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x131')});db[_0xbe56('0x4c')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':'restrict'});db['SmsApplication'][_0xbe56('0x141')](db[_0xbe56('0x52')],{'onDelete':_0xbe56('0x152')});db[_0xbe56('0x4c')][_0xbe56('0x141')](db[_0xbe56('0x12f')],{'onDelete':'restrict'});db[_0xbe56('0x4c')][_0xbe56('0x141')](db[_0xbe56('0x76')],{'onDelete':_0xbe56('0x152'),'foreignKey':'IntervalId'});db[_0xbe56('0x4c')][_0xbe56('0x141')](db[_0xbe56('0x162')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xbe56('0x4e')]['hasMany'](db[_0xbe56('0x50')],{'as':'Messages','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x170')});db[_0xbe56('0x4e')][_0xbe56('0x141')](db['SmsAccount'],{'as':_0xbe56('0x160'),'foreignKey':'SmsAccountId'});db[_0xbe56('0x4e')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':'Contact','foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x4e')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xbe56('0x107')});db[_0xbe56('0x4e')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xbe56('0x171')});db[_0xbe56('0x4e')][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':'sms_interaction_has_tags','as':_0xbe56('0x164')});db[_0xbe56('0x4e')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x165'),'through':_0xbe56('0x11d'),'foreignKey':_0xbe56('0x170')});db[_0xbe56('0x50')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':'User'});db[_0xbe56('0x50')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'onDelete':_0xbe56('0x106'),'as':_0xbe56('0x14d')});db['SmsMessage'][_0xbe56('0x141')](db[_0xbe56('0x4e')],{'onDelete':'cascade','as':_0xbe56('0x172'),'foreignKey':_0xbe56('0x170')});db[_0xbe56('0x50')][_0xbe56('0x141')](db[_0xbe56('0x12f')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x16f')});db[_0xbe56('0x52')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':'UserSmsQueue','foreignKey':_0xbe56('0x173')});db['SmsQueue'][_0xbe56('0x116')](db['Team'],{'through':_0xbe56('0x174'),'as':_0xbe56('0x146')});db['OpenchannelAccount'][_0xbe56('0x108')](db['Disposition'],{'as':_0xbe56('0x155'),'foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0xbe56('0x54')][_0xbe56('0x108')](db['CannedAnswer'],{'as':_0xbe56('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0xbe56('0x54')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xbe56('0x158'),'foreignKey':_0xbe56('0x175')});db[_0xbe56('0x54')][_0xbe56('0x108')](db[_0xbe56('0x176')],{'as':_0xbe56('0x15e'),'foreignKey':_0xbe56('0x175')});db['OpenchannelAccount'][_0xbe56('0x108')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xbe56('0x175')});db[_0xbe56('0x54')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':'List','foreignKey':_0xbe56('0x168')});db['OpenchannelAccount'][_0xbe56('0x141')](db['Pause'],{'as':_0xbe56('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x12e')});db[_0xbe56('0x56')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xbe56('0x141')](db[_0xbe56('0x177')],{'onDelete':_0xbe56('0x152'),'foreignKey':_0xbe56('0x178')});db['OpenchannelApplication'][_0xbe56('0x141')](db[_0xbe56('0x54')],{'onDelete':_0xbe56('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0xbe56('0x56')][_0xbe56('0x141')](db[_0xbe56('0x76')],{'onDelete':'restrict','foreignKey':_0xbe56('0x143')});db[_0xbe56('0x56')]['belongsTo'](db[_0xbe56('0x162')],{'onDelete':_0xbe56('0x152'),'foreignKey':_0xbe56('0x16b')});db[_0xbe56('0x58')][_0xbe56('0x108')](db['OpenchannelMessage'],{'as':_0xbe56('0x15e'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x179')});db[_0xbe56('0x58')]['belongsTo'](db[_0xbe56('0x54')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x175')});db[_0xbe56('0x58')][_0xbe56('0x141')](db['CmContact'],{'as':'Contact','foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x58')][_0xbe56('0x141')](db['User'],{'as':_0xbe56('0x161'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x58')]['belongsToMany'](db[_0xbe56('0x162')],{'through':_0xbe56('0x17a'),'as':_0xbe56('0x171')});db[_0xbe56('0x58')][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':'openchannel_interaction_has_tags','as':_0xbe56('0x164')});db[_0xbe56('0x58')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x165'),'through':_0xbe56('0x17b'),'foreignKey':_0xbe56('0x179')});db[_0xbe56('0x176')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':'cascade','as':_0xbe56('0x104')});db[_0xbe56('0x176')][_0xbe56('0x141')](db['CmContact'],{'onDelete':_0xbe56('0x106'),'as':'Contact'});db[_0xbe56('0x176')]['belongsTo'](db[_0xbe56('0x58')],{'onDelete':'cascade','as':_0xbe56('0x172'),'foreignKey':_0xbe56('0x179')});db[_0xbe56('0x176')]['belongsTo'](db[_0xbe56('0xdf')],{'as':'Attachment','foreignKey':_0xbe56('0x16e')});db[_0xbe56('0x176')][_0xbe56('0x141')](db[_0xbe56('0x54')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x175')});db[_0xbe56('0x177')]['belongsToMany'](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x33'),'foreignKey':_0xbe56('0x178')});db['OpenchannelQueue'][_0xbe56('0x116')](db[_0xbe56('0xd9')],{'through':'team_has_openchannel_queues','as':_0xbe56('0x146')});db[_0xbe56('0x129')][_0xbe56('0x108')](db['Disposition'],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0xbe56('0x106')});db['ChatWebsite'][_0xbe56('0x108')](db[_0xbe56('0x71')],{'as':_0xbe56('0x156'),'foreignKey':_0xbe56('0x17c')});db[_0xbe56('0x129')][_0xbe56('0x108')](db[_0xbe56('0x64')],{'as':'ProactiveActions'});db['ChatWebsite']['hasMany'](db[_0xbe56('0x5f')],{'as':_0xbe56('0x158')});db[_0xbe56('0x129')][_0xbe56('0x108')](db['ChatApplication'],{'as':_0xbe56('0x137')});db['ChatWebsite'][_0xbe56('0x108')](db['ChatMessage'],{'as':_0xbe56('0x15e')});db[_0xbe56('0x129')][_0xbe56('0x141')](db['CmList'],{'as':_0xbe56('0x159'),'foreignKey':'ListId'});db[_0xbe56('0x129')][_0xbe56('0x141')](db['Interval'],{'as':'Interval','foreignKey':_0xbe56('0x143')});db['ChatWebsite'][_0xbe56('0x141')](db[_0xbe56('0x36')],{'as':_0xbe56('0x36'),'foreignKey':_0xbe56('0x150')});db[_0xbe56('0x129')][_0xbe56('0x141')](db[_0xbe56('0x78')],{'as':_0xbe56('0x15b'),'foreignKey':_0xbe56('0x144')});db['ChatWebsite'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x12a')});db[_0xbe56('0x5b')][_0xbe56('0x141')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0x5b')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':'Contact','foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x5b')][_0xbe56('0x141')](db['OpenchannelInteraction'],{});db[_0xbe56('0x5b')][_0xbe56('0x141')](db[_0xbe56('0x176')],{});db[_0xbe56('0x5b')]['belongsTo'](db[_0xbe56('0x104')],{});db[_0xbe56('0x5b')]['belongsTo'](db[_0xbe56('0x177')],{});db[_0xbe56('0x5d')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':'Agent','foreignKey':_0xbe56('0x107'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x5d')]['belongsTo'](db[_0xbe56('0x122')],{'as':_0xbe56('0x17d'),'foreignKey':_0xbe56('0x17e'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x5d')][_0xbe56('0x141')](db[_0xbe56('0x129')],{'as':_0xbe56('0x17f'),'foreignKey':_0xbe56('0x17c'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x5d')][_0xbe56('0x141')](db[_0xbe56('0x162')],{'onDelete':'restrict','foreignKey':_0xbe56('0x16b')});db['ChatInteraction'][_0xbe56('0x108')](db[_0xbe56('0x180')],{'as':_0xbe56('0x15e'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x181')});db['ChatInteraction'][_0xbe56('0x141')](db[_0xbe56('0x129')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x17c')});db[_0xbe56('0x5f')]['belongsTo'](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x5f')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'as':_0xbe56('0x161'),'foreignKey':_0xbe56('0x107')});db[_0xbe56('0x5f')]['belongsToMany'](db[_0xbe56('0x162')],{'through':_0xbe56('0x182'),'as':_0xbe56('0x171')});db['ChatInteraction'][_0xbe56('0x116')](db['Tag'],{'through':_0xbe56('0x182'),'as':_0xbe56('0x164')});db[_0xbe56('0x5f')]['belongsToMany'](db['User'],{'as':_0xbe56('0x165'),'through':_0xbe56('0x183'),'foreignKey':_0xbe56('0x181')});db[_0xbe56('0x180')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':_0xbe56('0x106'),'as':_0xbe56('0x104')});db[_0xbe56('0x180')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'onDelete':_0xbe56('0x106'),'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x180')]['belongsTo'](db[_0xbe56('0x5f')],{'onDelete':_0xbe56('0x106'),'as':_0xbe56('0x172'),'foreignKey':_0xbe56('0x181')});db[_0xbe56('0x180')][_0xbe56('0x141')](db[_0xbe56('0xdf')],{'as':'Attachment','foreignKey':_0xbe56('0x16e')});db[_0xbe56('0x180')]['belongsTo'](db['ChatWebsite'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x17c')});db[_0xbe56('0x61')]['hasMany'](db[_0xbe56('0xdf')],{'as':_0xbe56('0x166'),'foreignKey':_0xbe56('0x167'),'onDelete':_0xbe56('0x106'),'hooks':!![]});db[_0xbe56('0x61')]['belongsTo'](db[_0xbe56('0x14c')],{'onDelete':'cascade','as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x61')]['belongsTo'](db['ChatWebsite'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x17c')});db[_0xbe56('0x122')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x2c'),'hooks':!![]});db[_0xbe56('0x122')][_0xbe56('0x116')](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0xbe56('0x63')][_0xbe56('0x108')](db[_0xbe56('0xc4')],{'as':_0xbe56('0x15e'),'foreignKey':'ChatGroupId','onDelete':_0xbe56('0x106')});db['ChatGroup'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x139'),'through':'chat_group_has_users'});db[_0xbe56('0x64')][_0xbe56('0x141')](db[_0xbe56('0x129')],{'as':_0xbe56('0x17f'),'foreignKey':_0xbe56('0x17c')});db[_0xbe56('0x184')][_0xbe56('0x108')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x117'),'foreignKey':_0xbe56('0x185')});db[_0xbe56('0x14c')][_0xbe56('0x108')](db[_0xbe56('0x186')],{'as':_0xbe56('0x187'),'foreignKey':_0xbe56('0x188')});db[_0xbe56('0x14c')][_0xbe56('0x108')](db[_0xbe56('0x68')],{'as':'Hoppers','foreignKey':_0xbe56('0x14e')});db['CmContact']['hasMany'](db[_0xbe56('0x6a')],{'as':_0xbe56('0x10b'),'foreignKey':_0xbe56('0x14e')});db['CmContact'][_0xbe56('0x108')](db[_0xbe56('0x10c')],{'as':_0xbe56('0x13c'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x14c')][_0xbe56('0x108')](db[_0xbe56('0x13d')],{'as':'ReportAgentPreview','foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x14c')][_0xbe56('0x108')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xbe56('0x14e')});db['CmContact'][_0xbe56('0x108')](db['OpenchannelInteraction'],{'as':_0xbe56('0x10e'),'foreignKey':_0xbe56('0x14e'),'onDelete':'restrict'});db[_0xbe56('0x14c')][_0xbe56('0x108')](db[_0xbe56('0x5f')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0xbe56('0x152')});db[_0xbe56('0x14c')]['hasMany'](db[_0xbe56('0x4e')],{'as':_0xbe56('0x110'),'foreignKey':_0xbe56('0x14e'),'onDelete':'restrict'});db[_0xbe56('0x14c')]['hasMany'](db[_0xbe56('0x45')],{'as':_0xbe56('0x111'),'foreignKey':_0xbe56('0x14e'),'onDelete':_0xbe56('0x152')});db['CmContact'][_0xbe56('0x108')](db[_0xbe56('0x3a')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xbe56('0x152')});db[_0xbe56('0x14c')][_0xbe56('0x141')](db['CmCompany'],{'as':_0xbe56('0x189'),'foreignKey':_0xbe56('0x185')});db['CmContact'][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168'),'onDelete':'cascade'});db[_0xbe56('0x14c')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':'Users','through':_0xbe56('0x118')});db[_0xbe56('0x14c')]['belongsToMany'](db[_0xbe56('0x162')],{'as':_0xbe56('0x171'),'through':_0xbe56('0x18a')});db['CmContact']['belongsToMany'](db[_0xbe56('0x162')],{'through':'cm_contact_has_tags','as':_0xbe56('0x164')});db[_0xbe56('0x68')][_0xbe56('0x108')](db['CmHopperAdditionalPhone'],{'as':_0xbe56('0x18b'),'foreignKey':'CmHopperId'});db[_0xbe56('0x68')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xbe56('0x14e'),'onDelete':'cascade'});db[_0xbe56('0x68')][_0xbe56('0x141')](db['CmList'],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168'),'onDelete':_0xbe56('0x106')});db['CmHopper']['belongsTo'](db[_0xbe56('0x104')],{'as':_0xbe56('0x18c'),'foreignKey':_0xbe56('0x107')});db['CmHopper'][_0xbe56('0x141')](db[_0xbe56('0x17')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xbe56('0x106')});db[_0xbe56('0x68')][_0xbe56('0x141')](db[_0xbe56('0xdc')],{'as':'Campaign','foreignKey':_0xbe56('0x18d'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x68')]['belongsTo'](db[_0xbe56('0x104')],{'as':'Owner','foreignKey':_0xbe56('0x18e')});db['CmHopperBlack']['belongsTo'](db[_0xbe56('0x14c')],{'as':'Contact','foreignKey':_0xbe56('0x14e'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x13e')]['belongsTo'](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x13e')][_0xbe56('0x141')](db[_0xbe56('0x17')],{'as':'Queue','foreignKey':_0xbe56('0x13a'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x13e')][_0xbe56('0x141')](db[_0xbe56('0xdc')],{'as':_0xbe56('0xdc'),'foreignKey':_0xbe56('0x18d'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x70')][_0xbe56('0x108')](db[_0xbe56('0x75')],{'as':{'plural':_0xbe56('0x18f'),'singular':_0xbe56('0x190')},'foreignKey':_0xbe56('0x191'),'onDelete':'cascade','hooks':!![]});db[_0xbe56('0x70')][_0xbe56('0x108')](db[_0xbe56('0x75')],{'as':{'plural':_0xbe56('0x192'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':'cascade','hooks':!![]});db[_0xbe56('0x70')][_0xbe56('0x108')](db[_0xbe56('0x193')],{'as':_0xbe56('0x194'),'foreignKey':_0xbe56('0x195'),'onDelete':_0xbe56('0x106'),'hooks':!![]});db[_0xbe56('0x73')][_0xbe56('0x108')](db[_0xbe56('0x73')],{'as':_0xbe56('0x155'),'foreignKey':_0xbe56('0x196'),'onDelete':_0xbe56('0x106')});db[_0xbe56('0x76')]['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':_0xbe56('0x143'),'onDelete':_0xbe56('0x106'),'hooks':!![],'required':![]});db[_0xbe56('0x76')][_0xbe56('0x108')](db[_0xbe56('0x14')],{'as':_0xbe56('0x10a'),'foreignKey':_0xbe56('0x143'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x76')]['hasMany'](db['MailApplication'],{'as':_0xbe56('0x197'),'foreignKey':'IntervalId'});db[_0xbe56('0x76')][_0xbe56('0x108')](db[_0xbe56('0x5d')],{'as':'ChatApplications','foreignKey':_0xbe56('0x143')});db[_0xbe56('0x76')][_0xbe56('0x108')](db[_0xbe56('0x43')],{'as':_0xbe56('0x198'),'foreignKey':_0xbe56('0x143')});db[_0xbe56('0x76')][_0xbe56('0x108')](db[_0xbe56('0x4c')],{'as':_0xbe56('0x199'),'foreignKey':_0xbe56('0x143')});db['Schedule'][_0xbe56('0x141')](db[_0xbe56('0x36')],{});db['Schedule'][_0xbe56('0x141')](db[_0xbe56('0x8c')],{'foreignKey':_0xbe56('0x19a')});db['Schedule'][_0xbe56('0x141')](db[_0xbe56('0x8a')],{'foreignKey':_0xbe56('0x19b')});db[_0xbe56('0x7e')][_0xbe56('0x116')](db[_0xbe56('0x16')],{'as':'Mohs','through':_0xbe56('0x19c'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0x162')][_0xbe56('0x116')](db[_0xbe56('0x14c')],{'through':'cm_contact_has_tags'});db[_0xbe56('0x162')]['belongsToMany'](db[_0xbe56('0x5f')],{'through':_0xbe56('0x182')});db[_0xbe56('0x162')][_0xbe56('0x116')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xbe56('0x162')]['belongsToMany'](db[_0xbe56('0x4e')],{'through':'sms_interaction_has_tags'});db[_0xbe56('0x162')][_0xbe56('0x116')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xbe56('0x162')][_0xbe56('0x116')](db[_0xbe56('0x58')],{'through':'openchannel_interaction_has_tags'});db[_0xbe56('0x162')]['belongsToMany'](db[_0xbe56('0xf4')],{'through':'whatsapp_interaction_has_tags'});db[_0xbe56('0x186')][_0xbe56('0x141')](db['ContactItemType'],{'as':_0xbe56('0x19d'),'foreignKey':'ItemTypeId'});db[_0xbe56('0x19e')][_0xbe56('0x141')](db['CmHopper'],{'as':_0xbe56('0x19f'),'foreignKey':'CmHopperId'});db[_0xbe56('0x186')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x188')});db[_0xbe56('0x1a0')][_0xbe56('0x108')](db[_0xbe56('0x75')],{'as':{'plural':_0xbe56('0x1a1'),'singular':_0xbe56('0x1a2')},'foreignKey':'TriggerAllId','onDelete':_0xbe56('0x106'),'hooks':!![]});db[_0xbe56('0x1a0')][_0xbe56('0x108')](db['Condition'],{'as':{'plural':_0xbe56('0x1a3'),'singular':_0xbe56('0x1a4')},'foreignKey':'TriggerAnyId','onDelete':_0xbe56('0x106'),'hooks':!![]});db[_0xbe56('0x1a0')]['hasMany'](db[_0xbe56('0x193')],{'as':_0xbe56('0x194'),'foreignKey':_0xbe56('0x1a5'),'onDelete':_0xbe56('0x106'),'hooks':!![]});db['AnalyticCustomReport'][_0xbe56('0x108')](db[_0xbe56('0x92')],{'as':_0xbe56('0x1a6'),'onDelete':'cascade','foreignKey':_0xbe56('0x19b'),'hooks':!![]});db[_0xbe56('0x8c')]['hasMany'](db[_0xbe56('0x92')],{'as':_0xbe56('0x1a6'),'onDelete':'cascade','foreignKey':_0xbe56('0x19a')});db[_0xbe56('0x90')][_0xbe56('0x108')](db[_0xbe56('0x92')],{'as':_0xbe56('0x1a6'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1a7')});db[_0xbe56('0x92')][_0xbe56('0x141')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xbe56('0x1a8')]['hasMany'](db[_0xbe56('0x96')],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':'AccountId'});db[_0xbe56('0x96')]['hasMany'](db['SalesforceField'],{'as':'Subjects','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0x96')]['hasMany'](db[_0xbe56('0x98')],{'as':'Descriptions','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0x96')][_0xbe56('0x108')](db[_0xbe56('0x98')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x96')][_0xbe56('0x141')](db[_0xbe56('0x1a8')],{'as':'Account','foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0x98')][_0xbe56('0x108')](db['SalesforceField'],{'as':'Subject','foreignKey':_0xbe56('0x1aa')});db['SalesforceField'][_0xbe56('0x108')](db[_0xbe56('0x98')],{'as':_0xbe56('0x1ae'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0x98')]['hasMany'](db[_0xbe56('0x98')],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x98')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0x9a')][_0xbe56('0x108')](db[_0xbe56('0x9c')],{'as':_0xbe56('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db[_0xbe56('0x9e')],{'as':_0xbe56('0x1b1'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1aa')});db['SugarcrmConfiguration'][_0xbe56('0x108')](db['SugarcrmField'],{'as':_0xbe56('0x1b2'),'onDelete':_0xbe56('0x106'),'foreignKey':'DescriptionId'});db[_0xbe56('0x9c')]['hasMany'](db[_0xbe56('0x9e')],{'as':_0xbe56('0x1a6'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ac')});db['SugarcrmConfiguration'][_0xbe56('0x141')](db[_0xbe56('0x9a')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0x9e')][_0xbe56('0x108')](db[_0xbe56('0x9e')],{'as':_0xbe56('0x1b3'),'foreignKey':'SubjectId'});db[_0xbe56('0x9e')][_0xbe56('0x108')](db['SugarcrmField'],{'as':_0xbe56('0x1ae'),'foreignKey':'DescriptionId'});db[_0xbe56('0x9e')][_0xbe56('0x108')](db['SugarcrmField'],{'as':_0xbe56('0x1af'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db['DeskAccount'][_0xbe56('0x108')](db[_0xbe56('0xa1')],{'as':_0xbe56('0x1a9'),'onDelete':'cascade','foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0xa1')][_0xbe56('0x108')](db['DeskField'],{'as':_0xbe56('0x1b1'),'onDelete':_0xbe56('0x106'),'foreignKey':'SubjectId'});db[_0xbe56('0xa1')][_0xbe56('0x108')](db[_0xbe56('0xa2')],{'as':'Descriptions','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xa1')][_0xbe56('0x108')](db[_0xbe56('0xa2')],{'as':_0xbe56('0x1a6'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xa1')][_0xbe56('0x141')](db['DeskAccount'],{'as':'Account','foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0xa1')][_0xbe56('0x116')](db['Tag'],{'through':_0xbe56('0x1b4')});db[_0xbe56('0xa2')][_0xbe56('0x108')](db[_0xbe56('0xa2')],{'as':_0xbe56('0x1b3'),'foreignKey':_0xbe56('0x1aa')});db['DeskField']['hasMany'](db[_0xbe56('0xa2')],{'as':_0xbe56('0x1ae'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xa2')][_0xbe56('0x108')](db[_0xbe56('0xa2')],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xa2')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0xa4')]['hasMany'](db['ZohoConfiguration'],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':'AccountId'});db['ZohoConfiguration']['hasMany'](db[_0xbe56('0xa6')],{'as':'Subjects','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0x1b5')][_0xbe56('0x108')](db[_0xbe56('0xa6')],{'as':'Descriptions','onDelete':_0xbe56('0x106'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xbe56('0x108')](db[_0xbe56('0xa6')],{'as':_0xbe56('0x1a6'),'onDelete':'cascade','foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x1b5')][_0xbe56('0x141')](db[_0xbe56('0xa4')],{'as':_0xbe56('0x160'),'foreignKey':'AccountId'});db[_0xbe56('0xa6')][_0xbe56('0x108')](db[_0xbe56('0xa6')],{'as':_0xbe56('0x1b3'),'foreignKey':'SubjectId'});db[_0xbe56('0xa6')][_0xbe56('0x108')](db[_0xbe56('0xa6')],{'as':'Description','foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xa6')][_0xbe56('0x108')](db[_0xbe56('0xa6')],{'as':'Field','foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xa6')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':'Variable','foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0xa8')][_0xbe56('0x108')](db[_0xbe56('0xa9')],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0xa9')]['hasMany'](db['ZendeskField'],{'as':_0xbe56('0x1b1'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0xa9')]['hasMany'](db[_0xbe56('0xab')],{'as':_0xbe56('0x1b2'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xa9')]['hasMany'](db['ZendeskField'],{'as':_0xbe56('0x1a6'),'foreignKey':_0xbe56('0x1ac')});db['ZendeskConfiguration'][_0xbe56('0x141')](db[_0xbe56('0xa8')],{'as':'Account','foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0xa9')][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x1b6')});db[_0xbe56('0xab')][_0xbe56('0x108')](db[_0xbe56('0xab')],{'as':_0xbe56('0x1b3'),'foreignKey':'SubjectId'});db[_0xbe56('0xab')][_0xbe56('0x108')](db[_0xbe56('0xab')],{'as':_0xbe56('0x1ae'),'foreignKey':'DescriptionId'});db[_0xbe56('0xab')][_0xbe56('0x108')](db['ZendeskField'],{'as':_0xbe56('0x1af'),'foreignKey':'FieldId'});db['ZendeskField'][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':'Variable','foreignKey':_0xbe56('0x1b0')});db['FreshdeskAccount'][_0xbe56('0x108')](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0xbe56('0x106'),'foreignKey':'AccountId'});db[_0xbe56('0x1b7')][_0xbe56('0x108')](db[_0xbe56('0xb0')],{'as':'Subjects','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1aa')});db['FreshdeskConfiguration'][_0xbe56('0x108')](db[_0xbe56('0xb0')],{'as':_0xbe56('0x1b2'),'onDelete':_0xbe56('0x106'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xbe56('0x108')](db[_0xbe56('0xb0')],{'as':_0xbe56('0x1a6'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ac')});db['FreshdeskConfiguration']['belongsTo'](db[_0xbe56('0xad')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0x1b7')]['belongsToMany'](db['Tag'],{'through':_0xbe56('0x1b8')});db[_0xbe56('0xb0')][_0xbe56('0x108')](db[_0xbe56('0xb0')],{'as':_0xbe56('0x1b3'),'foreignKey':'SubjectId'});db['FreshdeskField']['hasMany'](db[_0xbe56('0xb0')],{'as':_0xbe56('0x1ae'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xb0')][_0xbe56('0x108')](db[_0xbe56('0xb0')],{'as':'Field','foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xb0')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0xb1')]['hasMany'](db[_0xbe56('0xb3')],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ad')});db['VtigerConfiguration'][_0xbe56('0x108')](db['VtigerField'],{'as':_0xbe56('0x1b1'),'foreignKey':_0xbe56('0x1aa')});db['VtigerConfiguration'][_0xbe56('0x108')](db[_0xbe56('0xb4')],{'as':_0xbe56('0x1b2'),'foreignKey':'DescriptionId'});db[_0xbe56('0xb3')]['hasMany'](db[_0xbe56('0xb4')],{'as':_0xbe56('0x1a6'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xb3')]['belongsTo'](db[_0xbe56('0xb1')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0xb4')]['hasMany'](db[_0xbe56('0xb4')],{'as':_0xbe56('0x1b3'),'foreignKey':_0xbe56('0x1aa')});db['VtigerField'][_0xbe56('0x108')](db[_0xbe56('0xb4')],{'as':'Description','foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xb4')][_0xbe56('0x108')](db[_0xbe56('0xb4')],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xb4')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db['ServicenowAccount'][_0xbe56('0x108')](db[_0xbe56('0xb6')],{'as':_0xbe56('0x1a9'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xbe56('0xb6')]['hasMany'](db[_0xbe56('0xb8')],{'as':_0xbe56('0x1b1'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0xb6')][_0xbe56('0x108')](db['ServicenowField'],{'as':_0xbe56('0x1b2'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xb6')][_0xbe56('0x108')](db[_0xbe56('0xb8')],{'as':'Fields','foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xb6')]['belongsTo'](db[_0xbe56('0x1b9')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db['ServicenowField'][_0xbe56('0x108')](db[_0xbe56('0xb8')],{'as':_0xbe56('0x1b3'),'foreignKey':'SubjectId'});db[_0xbe56('0xb8')][_0xbe56('0x108')](db[_0xbe56('0xb8')],{'as':_0xbe56('0x1ae'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xb8')][_0xbe56('0x108')](db['ServicenowField'],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db['ServicenowField'][_0xbe56('0x141')](db['Variable'],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db['Dynamics365Account'][_0xbe56('0x108')](db[_0xbe56('0x1ba')],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':'AccountId'});db['Dynamics365Account']['belongsTo'](db[_0xbe56('0xfb')],{'as':_0xbe56('0xfb'),'foreignKey':_0xbe56('0x151')});db[_0xbe56('0x1ba')]['hasMany'](db[_0xbe56('0x1bb')],{'as':_0xbe56('0x1b1'),'onDelete':_0xbe56('0x106'),'foreignKey':'SubjectId'});db[_0xbe56('0x1ba')]['hasMany'](db[_0xbe56('0x1bb')],{'as':_0xbe56('0x1b2'),'onDelete':_0xbe56('0x106'),'foreignKey':'DescriptionId'});db[_0xbe56('0x1ba')][_0xbe56('0x108')](db[_0xbe56('0x1bb')],{'as':_0xbe56('0x1a6'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x1ba')][_0xbe56('0x141')](db['Dynamics365Account'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0x1bb')]['hasMany'](db[_0xbe56('0x1bb')],{'as':'Subject','foreignKey':_0xbe56('0x1aa')});db['Dynamics365Field'][_0xbe56('0x108')](db[_0xbe56('0x1bb')],{'as':_0xbe56('0x1ae'),'foreignKey':_0xbe56('0x1ab')});db['Dynamics365Field']['hasMany'](db[_0xbe56('0x1bb')],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x1bb')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0x1bc')][_0xbe56('0x108')](db[_0xbe56('0x1bd')],{'as':_0xbe56('0x1a9'),'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1ad')});db[_0xbe56('0x1bd')][_0xbe56('0x108')](db[_0xbe56('0xbd')],{'as':_0xbe56('0x1b1'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0x1bd')]['hasMany'](db['FreshsalesField'],{'as':_0xbe56('0x1b2'),'foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0x1bd')][_0xbe56('0x108')](db[_0xbe56('0xbd')],{'as':_0xbe56('0x1a6'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0x1bd')]['belongsTo'](db['FreshsalesAccount'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1ad')});db['FreshsalesField'][_0xbe56('0x108')](db[_0xbe56('0xbd')],{'as':_0xbe56('0x1b3'),'foreignKey':_0xbe56('0x1aa')});db[_0xbe56('0xbd')][_0xbe56('0x108')](db[_0xbe56('0xbd')],{'as':'Description','foreignKey':_0xbe56('0x1ab')});db[_0xbe56('0xbd')][_0xbe56('0x108')](db[_0xbe56('0xbd')],{'as':_0xbe56('0x1af'),'foreignKey':_0xbe56('0x1ac')});db[_0xbe56('0xbd')][_0xbe56('0x141')](db[_0xbe56('0x85')],{'as':_0xbe56('0x85'),'foreignKey':_0xbe56('0x1b0')});db[_0xbe56('0xc2')]['belongsTo'](db[_0xbe56('0x129')],{});db[_0xbe56('0xc2')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':'List','foreignKey':_0xbe56('0x168')});db['ChatQueueReport']['belongsTo'](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db['ChatQueueReport']['belongsTo'](db[_0xbe56('0x5f')],{});db[_0xbe56('0xc2')][_0xbe56('0x141')](db[_0xbe56('0x180')],{});db['ChatQueueReport'][_0xbe56('0x141')](db[_0xbe56('0x104')],{});db['ChatQueueReport'][_0xbe56('0x141')](db[_0xbe56('0x122')],{});db[_0xbe56('0xc4')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':'cascade','foreignKey':'FromId'});db['ChatInternalMessage'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1be')});db[_0xbe56('0xc8')][_0xbe56('0x108')](db[_0xbe56('0xc7')],{'foreignKey':_0xbe56('0x1bf'),'onDelete':'cascade'});db[_0xbe56('0xc8')][_0xbe56('0x108')](db[_0xbe56('0x1c0')],{'foreignKey':_0xbe56('0x1bf'),'onDelete':'cascade'});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0x12f')],{});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':'ListId'});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':'Contact','foreignKey':_0xbe56('0x14e')});db['SmsQueueReport']['belongsTo'](db[_0xbe56('0x4e')],{});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0x50')],{});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0x104')],{});db[_0xbe56('0xca')][_0xbe56('0x141')](db[_0xbe56('0x52')],{});db[_0xbe56('0xcf')][_0xbe56('0x108')](db[_0xbe56('0xc8')],{'foreignKey':'ProjectId'});db[_0xbe56('0xcf')][_0xbe56('0x108')](db[_0xbe56('0xc7')],{'foreignKey':'ProjectId'});db[_0xbe56('0xcf')][_0xbe56('0x108')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject'][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x165'),'through':_0xbe56('0x134')});db[_0xbe56('0xd9')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x11a')});db[_0xbe56('0xd9')][_0xbe56('0x116')](db[_0xbe56('0x17')],{'through':_0xbe56('0xfc'),'as':_0xbe56('0x1c1')});db[_0xbe56('0xd9')]['belongsToMany'](db[_0xbe56('0x38')],{'through':_0xbe56('0x15d'),'as':_0xbe56('0x120')});db['Team']['belongsToMany'](db[_0xbe56('0x122')],{'through':_0xbe56('0x1c2'),'as':'ChatQueues'});db[_0xbe56('0xd9')][_0xbe56('0x116')](db['FaxQueue'],{'through':_0xbe56('0x1c3'),'as':_0xbe56('0x124')});db[_0xbe56('0xd9')][_0xbe56('0x116')](db[_0xbe56('0x52')],{'through':_0xbe56('0x174'),'as':_0xbe56('0x125')});db[_0xbe56('0xd9')][_0xbe56('0x116')](db[_0xbe56('0x177')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xbe56('0xd9')]['belongsToMany'](db['WhatsappQueue'],{'through':_0xbe56('0x1c4'),'as':_0xbe56('0x1c5')});db[_0xbe56('0xd9')]['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xbe56('0xdc')]['hasMany'](db['CmHopper'],{'as':_0xbe56('0x13b'),'foreignKey':_0xbe56('0x18d')});db[_0xbe56('0xdc')][_0xbe56('0x108')](db[_0xbe56('0x6a')],{'as':_0xbe56('0x10b'),'foreignKey':'CampaignId'});db[_0xbe56('0xdc')][_0xbe56('0x108')](db[_0xbe56('0x10c')],{'as':_0xbe56('0x13c'),'foreignKey':'CampaignId'});db[_0xbe56('0xdc')][_0xbe56('0x108')](db['CmHopperBlack'],{'as':_0xbe56('0x13f'),'foreignKey':_0xbe56('0x18d')});db[_0xbe56('0xdc')][_0xbe56('0x141')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xbe56('0xdc')][_0xbe56('0x141')](db[_0xbe56('0x26')],{'as':_0xbe56('0x1c6'),'foreignKey':_0xbe56('0x142')});db['Campaign'][_0xbe56('0x141')](db[_0xbe56('0x76')],{'as':'Interval','foreignKey':_0xbe56('0x143')});db[_0xbe56('0xdc')][_0xbe56('0x141')](db[_0xbe56('0xd4')],{'as':_0xbe56('0xd4'),'foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0xbe56('0xea')],{'as':_0xbe56('0x119'),'through':_0xbe56('0x1c7')});db[_0xbe56('0xdc')][_0xbe56('0x116')](db['CmList'],{'as':'BlackLists','through':_0xbe56('0x1c8')});db[_0xbe56('0xdf')][_0xbe56('0x141')](db['ChatOfflineMessage'],{'as':_0xbe56('0x61'),'foreignKey':'ChatOfflineMessageId'});db[_0xbe56('0xe2')][_0xbe56('0x141')](db[_0xbe56('0x157')],{});db[_0xbe56('0xe2')][_0xbe56('0x141')](db[_0xbe56('0x3a')],{});db[_0xbe56('0xe2')][_0xbe56('0x141')](db['MailAccount'],{'foreignKey':_0xbe56('0x1c9'),'as':_0xbe56('0x1ca')});db[_0xbe56('0xe2')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cb'),'as':_0xbe56('0x1cc')});db[_0xbe56('0xe2')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cd'),'as':_0xbe56('0x1ce')});db[_0xbe56('0xe2')]['belongsTo'](db['MailQueue'],{'foreignKey':_0xbe56('0x1cf'),'as':_0xbe56('0x1d0')});db[_0xbe56('0xe2')][_0xbe56('0x141')](db[_0xbe56('0x36')],{'foreignKey':_0xbe56('0x1d1'),'as':_0xbe56('0x1d2')});db[_0xbe56('0xe4')][_0xbe56('0x141')](db[_0xbe56('0x180')],{});db[_0xbe56('0xe4')][_0xbe56('0x141')](db[_0xbe56('0x5f')],{});db[_0xbe56('0xe4')][_0xbe56('0x141')](db[_0xbe56('0x129')],{'foreignKey':_0xbe56('0x1d3'),'as':_0xbe56('0x1ca')});db['ChatTransferReport'][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cb'),'as':_0xbe56('0x1cc')});db[_0xbe56('0xe4')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cd'),'as':'ToAgent'});db[_0xbe56('0xe4')][_0xbe56('0x141')](db[_0xbe56('0x122')],{'foreignKey':_0xbe56('0x1d4'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db[_0xbe56('0x129')],{'foreignKey':_0xbe56('0x1d5'),'as':_0xbe56('0x1d2')});db[_0xbe56('0xe6')]['belongsTo'](db[_0xbe56('0x47')],{});db[_0xbe56('0xe6')][_0xbe56('0x141')](db['FaxInteraction'],{});db[_0xbe56('0xe6')][_0xbe56('0x141')](db[_0xbe56('0x42')],{'foreignKey':'FromFaxAccountId','as':_0xbe56('0x1ca')});db[_0xbe56('0xe6')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':'FromUserId','as':_0xbe56('0x1cc')});db[_0xbe56('0xe6')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cd'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0xbe56('0x48')],{'foreignKey':'ToFaxQueueId','as':_0xbe56('0x1d0')});db[_0xbe56('0xe6')][_0xbe56('0x141')](db[_0xbe56('0x42')],{'foreignKey':_0xbe56('0x1d6'),'as':_0xbe56('0x1d2')});db[_0xbe56('0xe8')][_0xbe56('0x141')](db[_0xbe56('0x176')],{});db[_0xbe56('0xe8')][_0xbe56('0x141')](db[_0xbe56('0x58')],{});db[_0xbe56('0xe8')][_0xbe56('0x141')](db[_0xbe56('0x54')],{'foreignKey':_0xbe56('0x1d7'),'as':_0xbe56('0x1ca')});db[_0xbe56('0xe8')][_0xbe56('0x141')](db['User'],{'foreignKey':_0xbe56('0x1cb'),'as':_0xbe56('0x1cc')});db[_0xbe56('0xe8')][_0xbe56('0x141')](db['User'],{'foreignKey':_0xbe56('0x1cd'),'as':_0xbe56('0x1ce')});db[_0xbe56('0xe8')]['belongsTo'](db[_0xbe56('0x177')],{'foreignKey':'ToOpenchannelQueueId','as':_0xbe56('0x1d0')});db['OpenchannelTransferReport']['belongsTo'](db[_0xbe56('0x54')],{'foreignKey':_0xbe56('0x1d8'),'as':_0xbe56('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0xbe56('0x50')],{});db[_0xbe56('0xe9')][_0xbe56('0x141')](db['SmsInteraction'],{});db['SmsTransferReport'][_0xbe56('0x141')](db[_0xbe56('0x12f')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0xbe56('0xe9')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cb'),'as':_0xbe56('0x1cc')});db[_0xbe56('0xe9')][_0xbe56('0x141')](db['User'],{'foreignKey':_0xbe56('0x1cd'),'as':_0xbe56('0x1ce')});db['SmsTransferReport'][_0xbe56('0x141')](db[_0xbe56('0x52')],{'foreignKey':_0xbe56('0x1d9'),'as':_0xbe56('0x1d0')});db['SmsTransferReport'][_0xbe56('0x141')](db['SmsAccount'],{'foreignKey':_0xbe56('0x1da'),'as':_0xbe56('0x1d2')});db[_0xbe56('0xea')][_0xbe56('0x108')](db[_0xbe56('0x73')],{'as':_0xbe56('0x155'),'foreignKey':_0xbe56('0x168'),'onDelete':_0xbe56('0x106')});db['CmList'][_0xbe56('0x108')](db[_0xbe56('0x6d')],{'as':_0xbe56('0x1db'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0xea')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0xea')][_0xbe56('0x108')](db[_0xbe56('0x6a')],{'as':'HopperFinals','foreignKey':_0xbe56('0x168')});db[_0xbe56('0xea')][_0xbe56('0x108')](db['CmHopperHistory'],{'as':_0xbe56('0x10d'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0xea')]['hasMany'](db[_0xbe56('0x13d')],{'as':_0xbe56('0x13d'),'foreignKey':_0xbe56('0x168')});db['CmList'][_0xbe56('0x116')](db['VoiceQueue'],{'as':_0xbe56('0x1dc'),'through':_0xbe56('0x1dd')});db[_0xbe56('0xea')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x128')});db[_0xbe56('0xeb')]['hasMany'](db[_0xbe56('0x14')],{'as':'Extensions','onDelete':_0xbe56('0x106')});db[_0xbe56('0xeb')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x100')});db[_0xbe56('0xeb')][_0xbe56('0x116')](db['Team'],{'through':_0xbe56('0xfe'),'as':_0xbe56('0x146')});db[_0xbe56('0xec')][_0xbe56('0x108')](db[_0xbe56('0x104')],{'as':'Users','foreignKey':_0xbe56('0x1de')});db['UserProfile']['hasMany'](db[_0xbe56('0xee')],{'as':_0xbe56('0x1df'),'foreignKey':_0xbe56('0x1de'),'onDelete':'cascade'});db[_0xbe56('0xee')][_0xbe56('0x108')](db['UserProfileResource'],{'as':_0xbe56('0x1e0'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0xbe56('0x132')][_0xbe56('0x108')](db['Disposition'],{'as':_0xbe56('0x155'),'foreignKey':_0xbe56('0x1e1'),'onDelete':_0xbe56('0x106')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0xbe56('0x156'),'foreignKey':_0xbe56('0x1e1')});db[_0xbe56('0x132')][_0xbe56('0x108')](db[_0xbe56('0xf6')],{'as':'Messages','foreignKey':_0xbe56('0x1e1')});db[_0xbe56('0x132')]['hasMany'](db[_0xbe56('0xf4')],{'as':_0xbe56('0x158')});db['WhatsappAccount'][_0xbe56('0x108')](db[_0xbe56('0xf2')],{'as':_0xbe56('0x137')});db[_0xbe56('0x132')][_0xbe56('0x141')](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168')});db[_0xbe56('0x132')][_0xbe56('0x141')](db['Pause'],{'as':_0xbe56('0x15b'),'foreignKey':_0xbe56('0x144')});db[_0xbe56('0x132')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':'user_has_whatsapp_accounts'});db[_0xbe56('0xf2')][_0xbe56('0x141')](db[_0xbe56('0x104')],{'onDelete':_0xbe56('0x152')});db[_0xbe56('0xf2')][_0xbe56('0x141')](db['WhatsappQueue'],{'onDelete':_0xbe56('0x152')});db[_0xbe56('0xf2')][_0xbe56('0x141')](db[_0xbe56('0x132')],{'onDelete':'restrict'});db[_0xbe56('0xf2')]['belongsTo'](db[_0xbe56('0x76')],{'onDelete':_0xbe56('0x152'),'foreignKey':_0xbe56('0x143')});db[_0xbe56('0xf2')][_0xbe56('0x141')](db[_0xbe56('0x162')],{'onDelete':'restrict','foreignKey':_0xbe56('0x16b')});db[_0xbe56('0xf4')][_0xbe56('0x108')](db[_0xbe56('0xf6')],{'as':'Messages','onDelete':_0xbe56('0x106'),'foreignKey':_0xbe56('0x1e2')});db[_0xbe56('0xf4')]['belongsTo'](db['WhatsappAccount'],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1e1')});db[_0xbe56('0xf4')][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xbe56('0x107')});db[_0xbe56('0xf4')][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x1e3'),'as':_0xbe56('0x171')});db[_0xbe56('0xf4')][_0xbe56('0x116')](db[_0xbe56('0x162')],{'through':_0xbe56('0x1e3'),'as':_0xbe56('0x164')});db[_0xbe56('0xf4')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x165'),'through':'user_has_whatsapp_interactions','foreignKey':_0xbe56('0x1e2')});db[_0xbe56('0xf6')]['belongsTo'](db['User'],{'as':_0xbe56('0x104')});db[_0xbe56('0xf6')][_0xbe56('0x141')](db['CmContact'],{'onDelete':_0xbe56('0x106'),'as':_0xbe56('0x14d')});db[_0xbe56('0xf6')][_0xbe56('0x141')](db['WhatsappInteraction'],{'onDelete':_0xbe56('0x106'),'as':'Interaction','foreignKey':_0xbe56('0x1e2')});db[_0xbe56('0xf6')][_0xbe56('0x141')](db[_0xbe56('0x132')],{'as':_0xbe56('0x160'),'foreignKey':_0xbe56('0x1e1')});db[_0xbe56('0x1e4')][_0xbe56('0x141')](db[_0xbe56('0x132')],{});db[_0xbe56('0x1e4')]['belongsTo'](db[_0xbe56('0xea')],{'as':_0xbe56('0x159'),'foreignKey':_0xbe56('0x168')});db['WhatsappQueueReport'][_0xbe56('0x141')](db[_0xbe56('0x14c')],{'as':_0xbe56('0x14d'),'foreignKey':_0xbe56('0x14e')});db[_0xbe56('0x1e4')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0xbe56('0x141')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0xbe56('0x141')](db[_0xbe56('0xf6')],{});db[_0xbe56('0x1e4')]['belongsTo'](db[_0xbe56('0x104')],{});db[_0xbe56('0xf7')][_0xbe56('0x141')](db[_0xbe56('0xf6')],{});db[_0xbe56('0xf7')][_0xbe56('0x141')](db['WhatsappInteraction'],{});db[_0xbe56('0xf7')]['belongsTo'](db[_0xbe56('0x132')],{'foreignKey':_0xbe56('0x1e5'),'as':_0xbe56('0x1ca')});db[_0xbe56('0xf7')][_0xbe56('0x141')](db['WhatsappAccount'],{'foreignKey':_0xbe56('0x1e6'),'as':_0xbe56('0x1d2')});db['WhatsappTransferReport'][_0xbe56('0x141')](db[_0xbe56('0xf9')],{'foreignKey':_0xbe56('0x1e7'),'as':_0xbe56('0x1d0')});db[_0xbe56('0xf7')]['belongsTo'](db['User'],{'foreignKey':_0xbe56('0x1cb'),'as':_0xbe56('0x1cc')});db['WhatsappTransferReport']['belongsTo'](db[_0xbe56('0x104')],{'foreignKey':_0xbe56('0x1cd'),'as':'ToAgent'});db[_0xbe56('0xf9')][_0xbe56('0x116')](db[_0xbe56('0x104')],{'as':_0xbe56('0x145'),'through':_0xbe56('0x127'),'foreignKey':_0xbe56('0x1e8')});db['WhatsappQueue'][_0xbe56('0x116')](db[_0xbe56('0xd9')],{'through':_0xbe56('0x1c4'),'as':_0xbe56('0x146')});db[_0xbe56('0x102')][_0xbe56('0x141')](db['User'],{'as':_0xbe56('0x1e9'),'foreignKey':_0xbe56('0x107'),'onDelete':'cascade','hooks':!![]});db[_0xbe56('0xfb')][_0xbe56('0x105')](db[_0xbe56('0xb9')],{'as':'Dynamics365Account','onDelete':_0xbe56('0x152')});db['CloudProvider'][_0xbe56('0x105')](db[_0xbe56('0x14f')],{'as':_0xbe56('0x153'),'onDelete':_0xbe56('0x152')});db[_0xbe56('0xfb')][_0xbe56('0x105')](db[_0xbe56('0x154')],{'as':'Smtp','onDelete':_0xbe56('0x152')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 991f77d..77fd32a 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38fd=['root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','/api/voice/chanspy','./api/voiceContext','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/condition','./api/interval','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/network','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join'];(function(_0xdb50e1,_0x112a80){var _0x2a50fc=function(_0xd47d89){while(--_0xd47d89){_0xdb50e1['push'](_0xdb50e1['shift']());}};_0x2a50fc(++_0x112a80);}(_0x38fd,0x117));var _0xd38f=function(_0x1db504,_0x475eff){_0x1db504=_0x1db504-0x0;var _0x5c6754=_0x38fd[_0x1db504];return _0x5c6754;};'use strict';var path=require(_0xd38f('0x0'));var express=require(_0xd38f('0x1'));var errors=require(_0xd38f('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xd38f('0x3'))[_0xd38f('0x4')];var clientSideLogs=require(_0xd38f('0x5'));exports[_0xd38f('0x6')]=function(_0x4f7185){return setupLoggers(_0x4f7185)['then'](function(){_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8'),require('./api/user'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9'),require('./api/voiceChanSpy'));_0x4f7185[_0xd38f('0x7')]('/api/voice/contexts',require(_0xd38f('0xa')));_0x4f7185[_0xd38f('0x7')]('/api/voice/extensions',require(_0xd38f('0xb')));_0x4f7185[_0xd38f('0x7')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc'),require(_0xd38f('0xd')));_0x4f7185['use'](_0xd38f('0xe'),require(_0xd38f('0xf')));_0x4f7185['use'](_0xd38f('0x10'),require(_0xd38f('0x11')));_0x4f7185['use'](_0xd38f('0x12'),require(_0xd38f('0x13')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x14'),require(_0xd38f('0x15')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x16'),require('./api/voiceCallReport'));_0x4f7185[_0xd38f('0x7')]('/api/voice/dials/reports',require(_0xd38f('0x17')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x18'),require(_0xd38f('0x19')));_0x4f7185['use'](_0xd38f('0x1a'),require('./api/voiceQueueReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1b'),require(_0xd38f('0x1c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1d'),require(_0xd38f('0x1e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x1f'),require(_0xd38f('0x20')));_0x4f7185[_0xd38f('0x7')]('/api/mail/out_servers',require(_0xd38f('0x21')));_0x4f7185[_0xd38f('0x7')]('/api/mail/accounts',require(_0xd38f('0x22')));_0x4f7185[_0xd38f('0x7')]('/api/mail/queues',require(_0xd38f('0x23')));_0x4f7185['use'](_0xd38f('0x24'),require(_0xd38f('0x25')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x26'),require(_0xd38f('0x27')));_0x4f7185[_0xd38f('0x7')]('/api/mail/messages',require('./api/mailMessage'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x28'),require('./api/mailApplication'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x29'),require(_0xd38f('0x2a')));_0x4f7185['use'](_0xd38f('0x2b'),require('./api/dashboard'));_0x4f7185['use'](_0xd38f('0x2c'),require(_0xd38f('0x2d')));_0x4f7185['use']('/api/fax/accounts',require(_0xd38f('0x2e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x2f'),require('./api/faxApplication'));_0x4f7185['use'](_0xd38f('0x30'),require(_0xd38f('0x31')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x32'),require(_0xd38f('0x33')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x34'),require(_0xd38f('0x35')));_0x4f7185[_0xd38f('0x7')]('/api/fax/reports/queue',require(_0xd38f('0x36')));_0x4f7185[_0xd38f('0x7')]('/api/sms/accounts',require(_0xd38f('0x37')));_0x4f7185[_0xd38f('0x7')]('/api/sms/applications',require(_0xd38f('0x38')));_0x4f7185['use'](_0xd38f('0x39'),require('./api/smsInteraction'));_0x4f7185['use'](_0xd38f('0x3a'),require(_0xd38f('0x3b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x3c'),require(_0xd38f('0x3d')));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/applications',require(_0xd38f('0x3e')));_0x4f7185[_0xd38f('0x7')]('/api/openchannel/interactions',require(_0xd38f('0x3f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x40'),require('./api/openchannelMessage'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x41'),require(_0xd38f('0x42')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x43'),require(_0xd38f('0x44')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x45'),require(_0xd38f('0x46')));_0x4f7185[_0xd38f('0x7')]('/api/chat/applications',require(_0xd38f('0x47')));_0x4f7185['use']('/api/chat/interactions',require(_0xd38f('0x48')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x49'),require(_0xd38f('0x4a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4b'),require('./api/chatOfflineMessage'));_0x4f7185[_0xd38f('0x7')]('/api/chat/queues',require(_0xd38f('0x4c')));_0x4f7185['use'](_0xd38f('0x4d'),require('./api/chatGroup'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4e'),require('./api/chatProactiveAction'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x4f'),require(_0xd38f('0x50')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x51'),require(_0xd38f('0x52')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x53'),require(_0xd38f('0x54')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x55'),require(_0xd38f('0x56')));_0x4f7185['use']('/api/cm/hopper_final',require(_0xd38f('0x57')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x58'),require(_0xd38f('0x59')));_0x4f7185['use'](_0xd38f('0x5a'),require(_0xd38f('0x5b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x5c'),require(_0xd38f('0x5d')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x5e'),require(_0xd38f('0x5f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x60'),require(_0xd38f('0x61')));_0x4f7185[_0xd38f('0x7')]('/api/dispositions',require(_0xd38f('0x62')));_0x4f7185[_0xd38f('0x7')]('/api/conditions',require(_0xd38f('0x63')));_0x4f7185[_0xd38f('0x7')]('/api/intervals',require(_0xd38f('0x64')));_0x4f7185[_0xd38f('0x7')]('/api/pauses',require('./api/pause'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x65'),require(_0xd38f('0x66')));_0x4f7185[_0xd38f('0x7')]('/api/voiceQueuesLog',require(_0xd38f('0x67')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x68'),require(_0xd38f('0x69')));_0x4f7185[_0xd38f('0x7')]('/api/sounds',require(_0xd38f('0x6a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6b'),require('./api/tag'));_0x4f7185[_0xd38f('0x7')]('/api/contact_item_types',require(_0xd38f('0x6c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6d'),require(_0xd38f('0x6e')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x6f'),require(_0xd38f('0x70')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x71'),require(_0xd38f('0x72')));_0x4f7185['use'](_0xd38f('0x73'),require('./api/trigger'));_0x4f7185[_0xd38f('0x7')]('/api/variables',require(_0xd38f('0x74')));_0x4f7185[_0xd38f('0x7')]('/api/integrations',require('./api/integration'));_0x4f7185['use'](_0xd38f('0x75'),require(_0xd38f('0x76')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x77'),require(_0xd38f('0x78')));_0x4f7185[_0xd38f('0x7')]('/api/analytics/default_reports',require(_0xd38f('0x79')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x7a'),require(_0xd38f('0x7b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x7c'),require('./api/analyticMetric'));_0x4f7185['use'](_0xd38f('0x7d'),require(_0xd38f('0x7e')));_0x4f7185['use'](_0xd38f('0x7f'),require(_0xd38f('0x80')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/salesforce/accounts',require(_0xd38f('0x81')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x82'),require(_0xd38f('0x83')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x84'),require(_0xd38f('0x85')));_0x4f7185['use'](_0xd38f('0x86'),require(_0xd38f('0x87')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x88'),require(_0xd38f('0x89')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8a'),require(_0xd38f('0x8b')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8c'),require(_0xd38f('0x8d')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x8e'),require(_0xd38f('0x8f')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x90'),require(_0xd38f('0x91')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x92'),require(_0xd38f('0x93')));_0x4f7185['use'](_0xd38f('0x94'),require(_0xd38f('0x95')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x96'),require(_0xd38f('0x97')));_0x4f7185['use'](_0xd38f('0x98'),require('./api/intZendeskAccount'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x99'),require(_0xd38f('0x9a')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9b'),require(_0xd38f('0x9c')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x9d'),require(_0xd38f('0x9e')));_0x4f7185['use'](_0xd38f('0x9f'),require('./api/intFreshdeskConfiguration'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa0'),require('./api/intFreshdeskField'));_0x4f7185['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x4f7185[_0xd38f('0x7')]('/api/integrations/vtiger/configurations',require(_0xd38f('0xa1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa2'),require('./api/intVtigerField'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa3'),require('./api/intServicenowAccount'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa4'),require(_0xd38f('0xa5')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x4f7185['use'](_0xd38f('0xa6'),require(_0xd38f('0xa7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xa8'),require(_0xd38f('0xa9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xaa'),require(_0xd38f('0xab')));_0x4f7185['use']('/api/integrations/freshsales/accounts',require(_0xd38f('0xac')));_0x4f7185['use']('/api/integrations/freshsales/configurations',require(_0xd38f('0xad')));_0x4f7185[_0xd38f('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x4f7185[_0xd38f('0x7')]('/api/networks',require(_0xd38f('0xae')));_0x4f7185['use']('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x4f7185['use']('/api/chat/internal/messages',require(_0xd38f('0xaf')));_0x4f7185['use'](_0xd38f('0xb0'),require(_0xd38f('0xb1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb2'),require(_0xd38f('0xb3')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb4'),require(_0xd38f('0xb5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb6'),require(_0xd38f('0xb7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xb8'),require(_0xd38f('0xb9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xba'),require('./api/squareReportDetail'));_0x4f7185[_0xd38f('0x7')]('/api/jscripty/projects',require(_0xd38f('0xbb')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xbc'),require('./api/setting'));_0x4f7185['use'](_0xd38f('0xbd'),require(_0xd38f('0xbe')));_0x4f7185['use']('/api/square/projects',require('./api/squareProject'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xbf'),require(_0xd38f('0xc0')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc1'),require(_0xd38f('0xc2')));_0x4f7185[_0xd38f('0x7')]('/api/teams',require(_0xd38f('0xc3')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc4'),require(_0xd38f('0xc5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc6'),require('./api/campaign'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc7'),require(_0xd38f('0xc8')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xc9'),require(_0xd38f('0xca')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcb'),require(_0xd38f('0xcc')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcd'),require(_0xd38f('0xce')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xcf'),require('./api/chatTransferReport'));_0x4f7185['use'](_0xd38f('0xd0'),require(_0xd38f('0xd1')));_0x4f7185['use'](_0xd38f('0xd2'),require('./api/openchannelTransferReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd3'),require('./api/smsTransferReport'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd4'),require(_0xd38f('0xd5')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd6'),require(_0xd38f('0xd7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd8'),require('./api/userProfile'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xd9'),require(_0xd38f('0xda')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xdb'),require(_0xd38f('0xdc')));_0x4f7185['use'](_0xd38f('0xdd'),require(_0xd38f('0xde')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xdf'),require(_0xd38f('0xe0')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe1'),require('./api/whatsappApplication'));_0x4f7185[_0xd38f('0x7')]('/api/whatsapp/interactions',require(_0xd38f('0xe2')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe3'),require(_0xd38f('0xe4')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe5'),require('./api/whatsappQueueReport'));_0x4f7185['use'](_0xd38f('0xe6'),require(_0xd38f('0xe7')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xe8'),require(_0xd38f('0xe9')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xea'),require('./api/cloudProvider'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xeb'),require(_0xd38f('0xec')));_0x4f7185['use']('/api/user-settings',require(_0xd38f('0xed')));_0x4f7185[_0xd38f('0x7')]('/api/auth/local',require('./api/authLocal'));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xee'),require(_0xd38f('0xef')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf0'),require('./api/authActiveDirectory'));_0x4f7185[_0xd38f('0x7')]('/api/jira',require(_0xd38f('0xf1')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf2'),require(_0xd38f('0xf3')));_0x4f7185[_0xd38f('0x7')]('/api/version',require(_0xd38f('0xf4')));_0x4f7185[_0xd38f('0x7')]('/api/system',require('./api/system'));_0x4f7185['use'](_0xd38f('0xf5'),require(_0xd38f('0xf6')));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xf7'),require(_0xd38f('0xf8')));_0x4f7185['use'](_0xd38f('0xf9'),clientSideLogs);_0x4f7185[_0xd38f('0x7')](_0xd38f('0xfa'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0xfa'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xfe'),express[_0xd38f('0xfb')](path['join'](config[_0xd38f('0xfd')],_0xd38f('0xfe'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0xff'),express[_0xd38f('0xfb')](path['join'](config[_0xd38f('0xfd')],_0xd38f('0xff'))));_0x4f7185['use'](_0xd38f('0x100'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0x101'),_0xd38f('0x102'))));_0x4f7185[_0xd38f('0x7')](_0xd38f('0x103'),express[_0xd38f('0xfb')](path[_0xd38f('0xfc')](config[_0xd38f('0xfd')],_0xd38f('0x104'))));_0x4f7185[_0xd38f('0x105')](_0xd38f('0x106'))['get'](errors[0x194]);_0x4f7185[_0xd38f('0x105')]('/*')[_0xd38f('0x107')](function(_0x36302d,_0x531c2a){_0x531c2a[_0xd38f('0x108')](path['resolve'](_0x4f7185['get'](_0xd38f('0x109'))+'/index.html'));});return _0x4f7185;});}; \ No newline at end of file +var _0xb141=['./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/setting','/api/square/projects','./api/squareProject','/api/square/messages','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','sendFile','resolve','get','appPath','/index.html','./errors','./config/environment','setupLoggers','./api/client-side-logs','default','then','use','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb141,0xf9));var _0x1b14=function(_0x3efb91,_0x49a131){_0x3efb91=_0x3efb91-0x0;var _0x317ee4=_0xb141[_0x3efb91];return _0x317ee4;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x1b14('0x0'));var config=require(_0x1b14('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x1b14('0x2')];var clientSideLogs=require(_0x1b14('0x3'));exports[_0x1b14('0x4')]=function(_0x50d0ee){return setupLoggers(_0x50d0ee)[_0x1b14('0x5')](function(){_0x50d0ee[_0x1b14('0x6')]('/api/users',require(_0x1b14('0x7')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x8'),require(_0x1b14('0x9')));_0x50d0ee['use'](_0x1b14('0xa'),require(_0x1b14('0xb')));_0x50d0ee[_0x1b14('0x6')]('/api/voice/extensions',require(_0x1b14('0xc')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xd'),require(_0x1b14('0xe')));_0x50d0ee[_0x1b14('0x6')]('/api/voice/queues',require(_0x1b14('0xf')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x10'),require('./api/voiceRecording'));_0x50d0ee['use']('/api/screen/recordings',require('./api/screenRecording'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x11'),require('./api/voiceMail'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x12'),require(_0x1b14('0x13')));_0x50d0ee['use'](_0x1b14('0x14'),require(_0x1b14('0x15')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x16'),require('./api/voiceDialReport'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x17'),require(_0x1b14('0x18')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x19'),require(_0x1b14('0x1a')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x1b'),require(_0x1b14('0x1c')));_0x50d0ee['use'](_0x1b14('0x1d'),require(_0x1b14('0x1e')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x1f'),require('./api/voiceTransferReport'));_0x50d0ee['use'](_0x1b14('0x20'),require(_0x1b14('0x21')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x22'),require(_0x1b14('0x23')));_0x50d0ee[_0x1b14('0x6')]('/api/mail/queues',require(_0x1b14('0x24')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x25'),require('./api/mailSubstatus'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x26'),require(_0x1b14('0x27')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x28'),require(_0x1b14('0x29')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x2a'),require('./api/mailApplication'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x2b'),require(_0x1b14('0x2c')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x2d'),require(_0x1b14('0x2e')));_0x50d0ee[_0x1b14('0x6')]('/api/dashboards/items',require(_0x1b14('0x2f')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x30'),require('./api/faxAccount'));_0x50d0ee[_0x1b14('0x6')]('/api/fax/applications',require('./api/faxApplication'));_0x50d0ee['use'](_0x1b14('0x31'),require('./api/faxInteraction'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x32'),require(_0x1b14('0x33')));_0x50d0ee[_0x1b14('0x6')]('/api/fax/queues',require(_0x1b14('0x34')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x35'),require(_0x1b14('0x36')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x37'),require(_0x1b14('0x38')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x39'),require('./api/smsApplication'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x3a'),require(_0x1b14('0x3b')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x3c'),require(_0x1b14('0x3d')));_0x50d0ee['use'](_0x1b14('0x3e'),require(_0x1b14('0x3f')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x40'),require('./api/openchannelAccount'));_0x50d0ee[_0x1b14('0x6')]('/api/openchannel/applications',require(_0x1b14('0x41')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x42'),require('./api/openchannelInteraction'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x43'),require(_0x1b14('0x44')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x45'),require(_0x1b14('0x46')));_0x50d0ee['use'](_0x1b14('0x47'),require('./api/chatWebsite'));_0x50d0ee['use'](_0x1b14('0x48'),require(_0x1b14('0x49')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x4a'),require(_0x1b14('0x4b')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x4c'),require(_0x1b14('0x4d')));_0x50d0ee['use'](_0x1b14('0x4e'),require(_0x1b14('0x4f')));_0x50d0ee[_0x1b14('0x6')]('/api/chat/offline_messages',require(_0x1b14('0x50')));_0x50d0ee['use'](_0x1b14('0x51'),require('./api/chatQueue'));_0x50d0ee['use'](_0x1b14('0x52'),require(_0x1b14('0x53')));_0x50d0ee[_0x1b14('0x6')]('/api/chat/proactive_actions',require(_0x1b14('0x54')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x55'),require(_0x1b14('0x56')));_0x50d0ee['use'](_0x1b14('0x57'),require(_0x1b14('0x58')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x59'),require(_0x1b14('0x5a')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x5b'),require('./api/cmHopperBlack'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x5c'),require(_0x1b14('0x5d')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x5e'),require('./api/cmHopperHistory'));_0x50d0ee[_0x1b14('0x6')]('/api/cm/custom_fields',require(_0x1b14('0x5f')));_0x50d0ee['use']('/api/actions',require(_0x1b14('0x60')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x61'),require('./api/automation'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x62'),require(_0x1b14('0x63')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x64'),require('./api/disposition'));_0x50d0ee[_0x1b14('0x6')]('/api/conditions',require(_0x1b14('0x65')));_0x50d0ee['use']('/api/intervals',require(_0x1b14('0x66')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x67'),require(_0x1b14('0x68')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x69'),require(_0x1b14('0x6a')));_0x50d0ee[_0x1b14('0x6')]('/api/voiceQueuesLog',require(_0x1b14('0x6b')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x6c'),require(_0x1b14('0x6d')));_0x50d0ee[_0x1b14('0x6')]('/api/sounds',require(_0x1b14('0x6e')));_0x50d0ee[_0x1b14('0x6')]('/api/tags',require(_0x1b14('0x6f')));_0x50d0ee['use'](_0x1b14('0x70'),require(_0x1b14('0x71')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x72'),require(_0x1b14('0x73')));_0x50d0ee[_0x1b14('0x6')]('/api/cm_hopper_additional_phones',require(_0x1b14('0x74')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x75'),require('./api/template'));_0x50d0ee[_0x1b14('0x6')]('/api/triggers',require(_0x1b14('0x76')));_0x50d0ee[_0x1b14('0x6')]('/api/variables',require(_0x1b14('0x77')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x78'),require(_0x1b14('0x79')));_0x50d0ee['use']('/api/integrations/reports',require(_0x1b14('0x7a')));_0x50d0ee['use'](_0x1b14('0x7b'),require(_0x1b14('0x7c')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x7d'),require(_0x1b14('0x7e')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x7f'),require(_0x1b14('0x80')));_0x50d0ee[_0x1b14('0x6')]('/api/analytics/metrics',require(_0x1b14('0x81')));_0x50d0ee[_0x1b14('0x6')]('/api/analytics/field_reports',require(_0x1b14('0x82')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x83'),require('./api/analyticTreeReport'));_0x50d0ee['use'](_0x1b14('0x84'),require('./api/intSalesforceAccount'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x85'),require(_0x1b14('0x86')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x87'),require(_0x1b14('0x88')));_0x50d0ee['use'](_0x1b14('0x89'),require(_0x1b14('0x8a')));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/sugarcrm/configurations',require(_0x1b14('0x8b')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x8c'),require(_0x1b14('0x8d')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x8e'),require(_0x1b14('0x8f')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x90'),require(_0x1b14('0x91')));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/desk/fields',require(_0x1b14('0x92')));_0x50d0ee['use']('/api/integrations/zoho/accounts',require(_0x1b14('0x93')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x94'),require('./api/intZohoConfiguration'));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/zoho/fields',require(_0x1b14('0x95')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x96'),require(_0x1b14('0x97')));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/zendesk/fields',require(_0x1b14('0x98')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x99'),require(_0x1b14('0x9a')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x9b'),require('./api/intFreshdeskConfiguration'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0x9c'),require(_0x1b14('0x9d')));_0x50d0ee['use'](_0x1b14('0x9e'),require(_0x1b14('0x9f')));_0x50d0ee['use']('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/vtiger/fields',require(_0x1b14('0xa0')));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/servicenow/accounts',require(_0x1b14('0xa1')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xa2'),require(_0x1b14('0xa3')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xa4'),require(_0x1b14('0xa5')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xa6'),require(_0x1b14('0xa7')));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x50d0ee[_0x1b14('0x6')]('/api/integrations/freshsales/accounts',require(_0x1b14('0xa8')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xa9'),require('./api/intFreshsalesConfiguration'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xaa'),require(_0x1b14('0xab')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xac'),require(_0x1b14('0xad')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xae'),require(_0x1b14('0xaf')));_0x50d0ee[_0x1b14('0x6')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x50d0ee['use'](_0x1b14('0xb0'),require(_0x1b14('0xb1')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xb2'),require(_0x1b14('0xb3')));_0x50d0ee[_0x1b14('0x6')]('/api/jscripty/sessions/reports',require(_0x1b14('0xb4')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xb5'),require(_0x1b14('0xb6')));_0x50d0ee['use'](_0x1b14('0xb7'),require(_0x1b14('0xb8')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xb9'),require('./api/squareReportDetail'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xba'),require('./api/jscriptyProject'));_0x50d0ee[_0x1b14('0x6')]('/api/settings',require(_0x1b14('0xbb')));_0x50d0ee[_0x1b14('0x6')]('/api/square/odbc',require('./api/squareOdbc'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xbc'),require(_0x1b14('0xbd')));_0x50d0ee['use']('/api/square/recordings',require('./api/squareRecording'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xbe'),require('./api/squareMessage'));_0x50d0ee['use']('/api/teams',require(_0x1b14('0xbf')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xc0'),require(_0x1b14('0xc1')));_0x50d0ee[_0x1b14('0x6')]('/api/campaigns',require(_0x1b14('0xc2')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xc3'),require(_0x1b14('0xc4')));_0x50d0ee[_0x1b14('0x6')]('/api/attachments',require(_0x1b14('0xc5')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xc6'),require('./api/plugin'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xc7'),require(_0x1b14('0xc8')));_0x50d0ee['use'](_0x1b14('0xc9'),require(_0x1b14('0xca')));_0x50d0ee['use'](_0x1b14('0xcb'),require(_0x1b14('0xcc')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xcd'),require('./api/openchannelTransferReport'));_0x50d0ee['use'](_0x1b14('0xce'),require(_0x1b14('0xcf')));_0x50d0ee[_0x1b14('0x6')]('/api/cm/lists',require(_0x1b14('0xd0')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xd1'),require(_0x1b14('0xd2')));_0x50d0ee['use']('/api/userProfiles',require('./api/userProfile'));_0x50d0ee[_0x1b14('0x6')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x50d0ee['use'](_0x1b14('0xd3'),require(_0x1b14('0xd4')));_0x50d0ee['use'](_0x1b14('0xd5'),require('./api/userNotification'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xd6'),require(_0x1b14('0xd7')));_0x50d0ee['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xd8'),require(_0x1b14('0xd9')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xda'),require('./api/whatsappMessage'));_0x50d0ee[_0x1b14('0x6')]('/api/whatsapp/reports/queue',require(_0x1b14('0xdb')));_0x50d0ee['use']('/api/whatsapp/reports/transfer',require(_0x1b14('0xdc')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xdd'),require(_0x1b14('0xde')));_0x50d0ee['use'](_0x1b14('0xdf'),require(_0x1b14('0xe0')));_0x50d0ee['use']('/api/realtime',require(_0x1b14('0xe1')));_0x50d0ee['use'](_0x1b14('0xe2'),require(_0x1b14('0xe3')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xe4'),require(_0x1b14('0xe5')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xe6'),require(_0x1b14('0xe7')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xe8'),require('./api/authActiveDirectory'));_0x50d0ee[_0x1b14('0x6')]('/api/jira',require(_0x1b14('0xe9')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xea'),require(_0x1b14('0xeb')));_0x50d0ee[_0x1b14('0x6')]('/api/version',require(_0x1b14('0xec')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xed'),require(_0x1b14('0xee')));_0x50d0ee['use'](_0x1b14('0xef'),require(_0x1b14('0xf0')));_0x50d0ee['use'](_0x1b14('0xf1'),require(_0x1b14('0xf2')));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xf3'),clientSideLogs);_0x50d0ee['use'](_0x1b14('0xf4'),express[_0x1b14('0xf5')](path[_0x1b14('0xf6')](config[_0x1b14('0xf7')],_0x1b14('0xf4'))));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xf8'),express[_0x1b14('0xf5')](path[_0x1b14('0xf6')](config['root'],'/www')));_0x50d0ee['use'](_0x1b14('0xf9'),express['static'](path[_0x1b14('0xf6')](config[_0x1b14('0xf7')],_0x1b14('0xf9'))));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xfa'),express[_0x1b14('0xf5')](path['join'](config[_0x1b14('0xf7')],_0x1b14('0xfb'),_0x1b14('0xfc'))));_0x50d0ee[_0x1b14('0x6')](_0x1b14('0xfd'),express['static'](path[_0x1b14('0xf6')](config[_0x1b14('0xf7')],_0x1b14('0xfe'))));_0x50d0ee[_0x1b14('0xff')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x50d0ee['route']('/*')['get'](function(_0x30e620,_0x17764d){_0x17764d[_0x1b14('0x100')](path[_0x1b14('0x101')](_0x50d0ee[_0x1b14('0x102')](_0x1b14('0x103'))+_0x1b14('0x104')));});return _0x50d0ee;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3a8caa8..8edc609 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6af=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe6af,0x106));var _0xfe6a=function(_0x27d9b5,_0x5f0b3c){_0x27d9b5=_0x27d9b5-0x0;var _0x5b4039=_0xe6af[_0x27d9b5];return _0x5b4039;};'use strict';var jayson=require('jayson/promise');var _=require(_0xfe6a('0x0'));var config=require(_0xfe6a('0x1'));exports[_0xfe6a('0x2')]=function(){return new Promise(function(_0x5fd6ac,_0x568606){var _0x5f15e3={};_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x3')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/voiceExtension/voiceExtension.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x5')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x6')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x7')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x8')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x9')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xa')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xb')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/trunk/trunk.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0xc')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xd')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xe')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0xf')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x10')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x11')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x12')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x13')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x14')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x15')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/faxApplication/faxApplication.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x16')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x17')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x18')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x19')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/smsInteraction/smsInteraction.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1b')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x1c')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1e')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x1f')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x20')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x21')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x22')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x23')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x24')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x25')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x26')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x27')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x28')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/pause/pause.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x29')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2b')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/trigger/trigger.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2c')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x2e')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x2f')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x30')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x31')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x32')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x33')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x34')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x35')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x36')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x37')));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/setting/setting.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x38')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x39')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3a')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/squareMessage/squareMessage.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/campaign/campaign.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require('../api/attachment/attachment.rpc'));_0x5f15e3=_['merge'](_0x5f15e3,require('../api/plugin/plugin.rpc'));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3b')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3c')));_0x5f15e3=_['merge'](_0x5f15e3,require(_0xfe6a('0x3d')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3e')));_0x5f15e3=_[_0xfe6a('0x4')](_0x5f15e3,require(_0xfe6a('0x3f')));var _0x109ec8=jayson[_0xfe6a('0x40')](_0x5f15e3)[_0xfe6a('0x41')]();var _0x39896d=config[_0xfe6a('0x42')][_0xfe6a('0x43')]||config['port']+0x1;var _0x55b0a2=config['rpc']['ip']||_0xfe6a('0x44');_0x109ec8['on']('error',function(_0x44244c){return _0x568606(_0x44244c);});_0x109ec8[_0xfe6a('0x2')](_0x39896d,_0x55b0a2,function(){console[_0xfe6a('0x45')](_0xfe6a('0x46'),_0x55b0a2,_0x39896d);require(_0xfe6a('0x47'))[_0xfe6a('0x48')]();return _0x5fd6ac('RPC\x20listening\x20on\x20'+_0x55b0a2+':'+_0x39896d);});});}; \ No newline at end of file +var _0xb78f=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x3ccd9f,_0x1b2b46){var _0x273cb8=function(_0x2fa6b8){while(--_0x2fa6b8){_0x3ccd9f['push'](_0x3ccd9f['shift']());}};_0x273cb8(++_0x1b2b46);}(_0xb78f,0x134));var _0xfb78=function(_0x483669,_0x42f9b2){_0x483669=_0x483669-0x0;var _0x1b1eb6=_0xb78f[_0x483669];return _0x1b1eb6;};'use strict';var jayson=require(_0xfb78('0x0'));var _=require(_0xfb78('0x1'));var config=require(_0xfb78('0x2'));exports[_0xfb78('0x3')]=function(){return new Promise(function(_0x40bbd4,_0x122834){var _0x1d415e={};_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/user/user.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x5')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/voiceQueue/voiceQueue.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x6')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x7')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1d415e=_['merge'](_0x1d415e,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x8')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x9')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0xa')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0xb')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0xc')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0xd')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0xe')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0xf')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x10')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x11')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x12')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x13')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x14')));_0x1d415e=_['merge'](_0x1d415e,require('../api/faxQueue/faxQueue.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x15')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x16')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/smsInteraction/smsInteraction.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x17')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x18')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x19')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x1a')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x1b')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x1c')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x1d')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x1e')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x1f')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/chatQueue/chatQueue.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x20')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x21')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x22')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x23')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x24')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x25')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/interval/interval.rpc'));_0x1d415e=_['merge'](_0x1d415e,require('../api/pause/pause.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x26')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x27')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/trigger/trigger.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x28')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x29')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x2a')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x2b')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x2c')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x2d')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x2e')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x2f')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x30')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x31')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x32')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x33')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x34')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x35')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x36')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/squareOdbc/squareOdbc.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/squareProject/squareProject.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x37')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x38')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x39')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x3a')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require('../api/plugin/plugin.rpc'));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x3b')));_0x1d415e=_['merge'](_0x1d415e,require(_0xfb78('0x3c')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x3d')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x3e')));_0x1d415e=_[_0xfb78('0x4')](_0x1d415e,require(_0xfb78('0x3f')));var _0x328704=jayson[_0xfb78('0x40')](_0x1d415e)[_0xfb78('0x41')]();var _0x441116=config['rpc']['port']||config[_0xfb78('0x42')]+0x1;var _0x40a38e=config['rpc']['ip']||_0xfb78('0x43');_0x328704['on']('error',function(_0x2f293d){return _0x122834(_0x2f293d);});_0x328704[_0xfb78('0x3')](_0x441116,_0x40a38e,function(){console[_0xfb78('0x44')](_0xfb78('0x45'),_0x40a38e,_0x441116);require(_0xfb78('0x46'))['default']();return _0x40bbd4(_0xfb78('0x47')+_0x40a38e+':'+_0x441116);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f811046..70fc364 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdaa1=['isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','wait','WAIT','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sync','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable'];(function(_0x5ade35,_0x35cec6){var _0x21d317=function(_0x4369b1){while(--_0x4369b1){_0x5ade35['push'](_0x5ade35['shift']());}};_0x21d317(++_0x35cec6);}(_0xdaa1,0x17d));var _0x1daa=function(_0x1f80c2,_0x35eea6){_0x1f80c2=_0x1f80c2-0x0;var _0x665fc9=_0xdaa1[_0x1f80c2];return _0x665fc9;};'use strict';var util=require(_0x1daa('0x0'));var _=require(_0x1daa('0x1'));var EventEmitter=require(_0x1daa('0x2'))[_0x1daa('0x3')];var AGIReply=require(_0x1daa('0x4'));var AGIError=require(_0x1daa('0x5'));function AGIChannel(_0x6b2157){var _0x5b2c11=this,_0x2dcaf7=new AGIReply(),_0x2c4a89=![],_0x5e6cf5={};EventEmitter[_0x1daa('0x6')](_0x5b2c11);_0x6b2157[_0x1daa('0x7')]('utf8');_0x6b2157[_0x1daa('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2dcaf7[_0x1daa('0x7')](_0x1daa('0x9'));_0x2dcaf7['on'](_0x1daa('0xa'),function(_0x4b5a7d){for(var _0x38e9bd in _0x4b5a7d){_0x5b2c11[_0x38e9bd]=_0x4b5a7d[_0x38e9bd];}_0x5b2c11[_0x1daa('0xb')](_0x1daa('0xc'));});_0x2dcaf7['on'](_0x1daa('0xd'),function(_0x492815){if(_0x492815[_0x1daa('0xe')]()=='hangup'){_0x5b2c11[_0x1daa('0xb')](_0x1daa('0xf'));return;}if(_0x492815[_0x1daa('0x10')](0x0,0xb)==_0x1daa('0x11')){_0x2c4a89=!![];}if(_0x2c4a89){_0x5e6cf5['rx']+=_0x492815+'\x0a';if(_0x492815[_0x1daa('0x12')](_0x1daa('0x13'))!=-0x1){_0x2c4a89=![];}}else{_0x5e6cf5['rx']=_0x492815;}if(_0x2c4a89){return;}if(typeof _0x5e6cf5['cb']==_0x1daa('0x14')){var _0x582fab=_0x5e6cf5['rx'][_0x1daa('0x10')](0x0,0x3),_0xe56336=null,_0x169e81=null;_0x582fab=parseInt(_0x582fab);if(isNaN(_0x582fab)){_0x5e6cf5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x582fab!=0xc8){_0x5e6cf5['cb'](null,{'code':_0x582fab,'result':-0x1,'extra':'KO'});return;}_0xe56336=_0x5e6cf5['rx']['substring'](0x4)[_0x1daa('0x15')]('result=','');if(_0xe56336[_0x1daa('0x16')]('\x20')!=-0x1){_0xe56336=_0xe56336[_0x1daa('0x17')](0x0,_0xe56336['indexOf']('\x20'));}if(_['startsWith'](_0xe56336,'-1')){_0xe56336=parseInt(_0xe56336);}_0x169e81=_0x5e6cf5['rx'][_0x1daa('0x18')]('\x20');if(_0x169e81['length']==0x3){_0x169e81=_0x169e81[0x2][_0x1daa('0x10')](0x1,_0x169e81[0x2][_0x1daa('0x19')]-0x1);}else if(_0x169e81[_0x1daa('0x19')]>0x3){var _0x38278d=/\((.+)\)/;var _0x8a0791=_0x5e6cf5['rx'][_0x1daa('0x1a')](_0x38278d);if(_0x8a0791){_0x169e81=_0x8a0791[0x1];}else{_0x169e81=null;}}else{_0x169e81=null;}_0x5e6cf5['cb'](null,{'code':_0x582fab,'result':_0xe56336,'extra':_0x169e81});}});_0x6b2157['on'](_0x1daa('0x1b'),function(_0x4bee0e){_0x5b2c11[_0x1daa('0xb')]('error',new AGIError(_0x1daa('0x1c'),_0x4bee0e[_0x1daa('0x1d')]));});_0x6b2157['on'](_0x1daa('0x1e'),function(){_0x5b2c11['emit'](_0x1daa('0x1e'),new AGIError(_0x1daa('0x1f')));});_0x6b2157['on'](_0x1daa('0x20'),function(){_0x5b2c11[_0x1daa('0xb')](_0x1daa('0x20'),new AGIError(_0x1daa('0x21')));_0x6b2157[_0x1daa('0x22')]();});_0x6b2157[_0x1daa('0x23')](_0x2dcaf7);this[_0x1daa('0x24')]=function(_0x332870,_0x2bbff8){var _0x332870=_0x332870||'',_0x2bbff8=typeof _0x2bbff8==_0x1daa('0x14')?_0x2bbff8:new Function();_0x5e6cf5={'tx':_0x332870,'rx':'','cb':_0x2bbff8};_0x6b2157[_0x1daa('0x25')](_0x332870+'\x0a');},this[_0x1daa('0x1e')]=function(){_0x6b2157['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1daa('0x26')]['sendRequest']=function(_0x33b91f){return this['command'][_0x1daa('0x27')](this,_0x33b91f);};AGIChannel[_0x1daa('0x26')]['answer']=function(){return this[_0x1daa('0x28')]('ANSWER');};AGIChannel[_0x1daa('0x26')][_0x1daa('0x29')]=function(_0xd36108,_0xdb2080,_0x42818d){_0xd36108=_0xd36108===undefined?_0x1daa('0x2a'):_0xd36108;_0xdb2080=_0xdb2080===undefined?'5':_0xdb2080;_0x42818d=_0x42818d===undefined?'1':_0x42818d;return this['sendRequest'](util[_0x1daa('0x2b')](_0x1daa('0x2c'),_0xd36108,_0xdb2080*0x3e8,_0x42818d));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x2d')]=function(_0x4a724c){_0x4a724c=_0x4a724c||_0x1daa('0x2e');return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x2f'),_0x4a724c));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x30')]=function(_0x7406fb,_0x5df61f){if(_[_0x1daa('0x31')](_0x5df61f)){return this[_0x1daa('0x28')](util['format'](_0x1daa('0x32'),_0x7406fb,_0x5df61f['join'](',')));}return this[_0x1daa('0x28')](util['format'](_0x1daa('0x32'),_0x7406fb,_0x5df61f));};AGIChannel['prototype']['setContext']=function(_0x17e73a){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('SET\x20CONTEXT\x20%s',_0x17e73a));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x33')]=function(_0x5b48a2){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x34'),_0x5b48a2));};AGIChannel['prototype'][_0x1daa('0x35')]=function(_0x12c785){return this['sendRequest'](util[_0x1daa('0x2b')](_0x1daa('0x36'),_0x12c785));};AGIChannel[_0x1daa('0x26')][_0x1daa('0xf')]=function(){return this[_0x1daa('0x28')](_0x1daa('0x37'));};AGIChannel['prototype'][_0x1daa('0x38')]=function(_0x59660c,_0x4a5eb3){var _0x4ab107=_['isBoolean'](_0x4a5eb3)||_[_0x1daa('0x39')](_0x4a5eb3)?_0x4a5eb3[_0x1daa('0x3a')]():_0x4a5eb3;return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x59660c,_0x4ab107?_0x4ab107['toString']()[_0x1daa('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x1cb3ec,_0x118b3f){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x3b'),_0x1cb3ec,_0x118b3f));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x3c')]=function(_0x2836e6,_0x5ad1ae){return this['sendRequest'](util[_0x1daa('0x2b')]('SAY\x20DIGITS\x20%s\x20%s',_0x2836e6,_0x5ad1ae));};AGIChannel[_0x1daa('0x26')]['sayPhonetic']=function(_0xe4f2c0,_0x3c639f){return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x3d'),_0xe4f2c0,_0x3c639f));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x3e')]=function(_0x4c0f34,_0x3da783,_0x14c4dc){_0x3da783=_0x3da783||this[_0x1daa('0x3f')];_0x14c4dc=_0x14c4dc||0x1;this[_0x1daa('0x40')](_0x4c0f34);this['setExtension'](_0x3da783);this[_0x1daa('0x35')](_0x14c4dc);return this[_0x1daa('0x2d')](util[_0x1daa('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x4c0f34,_0x3da783,_0x14c4dc));};AGIChannel['prototype'][_0x1daa('0x41')]=function(_0x3433d4){return this[_0x1daa('0x28')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x3433d4));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x42')]=function(_0x35ea18,_0x3facc2,_0x53781a,_0x92948,_0xd3f858,_0x3799e8){_0x3facc2=_0x3facc2||_0x1daa('0x43');_0x53781a=_0x53781a||'';_0x92948=_0x92948===undefined?-0x1:_0x92948==='-1'?-0x1:_0x92948*0x3e8;_0xd3f858=_0xd3f858===undefined?'':'s='+_0xd3f858;_0x3799e8=_0x3799e8?_0x1daa('0x44'):'';return this[_0x1daa('0x28')](util[_0x1daa('0x2b')](_0x1daa('0x45'),_0x35ea18,_0x3facc2,_0x53781a,_0x92948,_0x3799e8,_0xd3f858));};AGIChannel[_0x1daa('0x26')]['streamFile']=function(_0x465abb,_0x3eae53){_0x3eae53=_0x3eae53||'';return this[_0x1daa('0x28')](util[_0x1daa('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x465abb,_0x3eae53));};AGIChannel[_0x1daa('0x26')][_0x1daa('0x46')]=function(_0x289183){return this[_0x1daa('0x30')]('AGI',_0x289183);};AGIChannel[_0x1daa('0x26')][_0x1daa('0x47')]=function(_0x1538fc){return this[_0x1daa('0x30')](_0x1daa('0x48'),_0x1538fc);};AGIChannel[_0x1daa('0x26')][_0x1daa('0x1b')]=function(_0x5d8dea,_0x4a537c){this['noop'](util[_0x1daa('0x2b')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x5d8dea['id'],_0x5d8dea['label'],_0x4a537c));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x0703=['sync','prototype','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','replace','result=','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','destroy','inherits','sendRequest'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x0703,0xc0));var _0x3070=function(_0x5db96a,_0x60039){_0x5db96a=_0x5db96a-0x0;var _0x13fdb0=_0x0703[_0x5db96a];return _0x13fdb0;};'use strict';var util=require(_0x3070('0x0'));var _=require(_0x3070('0x1'));var EventEmitter=require(_0x3070('0x2'))[_0x3070('0x3')];var AGIReply=require(_0x3070('0x4'));var AGIError=require(_0x3070('0x5'));function AGIChannel(_0x4ab1d4){var _0x579bb1=this,_0x1736e5=new AGIReply(),_0x5f4b06=![],_0x240844={};EventEmitter[_0x3070('0x6')](_0x579bb1);_0x4ab1d4[_0x3070('0x7')](_0x3070('0x8'));_0x4ab1d4[_0x3070('0x9')](0x8*0x3c*0x3c*0x3e8);_0x1736e5[_0x3070('0x7')]('utf8');_0x1736e5['on'](_0x3070('0xa'),function(_0xf3a45f){for(var _0x2fb8bf in _0xf3a45f){_0x579bb1[_0x2fb8bf]=_0xf3a45f[_0x2fb8bf];}_0x579bb1[_0x3070('0xb')](_0x3070('0xc'));});_0x1736e5['on'](_0x3070('0xd'),function(_0x3394b1){if(_0x3394b1[_0x3070('0xe')]()==_0x3070('0xf')){_0x579bb1[_0x3070('0xb')](_0x3070('0xf'));return;}if(_0x3394b1[_0x3070('0x10')](0x0,0xb)==_0x3070('0x11')){_0x5f4b06=!![];}if(_0x5f4b06){_0x240844['rx']+=_0x3394b1+'\x0a';if(_0x3394b1['search'](_0x3070('0x12'))!=-0x1){_0x5f4b06=![];}}else{_0x240844['rx']=_0x3394b1;}if(_0x5f4b06){return;}if(typeof _0x240844['cb']=='function'){var _0x49e797=_0x240844['rx'][_0x3070('0x10')](0x0,0x3),_0x22277c=null,_0x4a80ab=null;_0x49e797=parseInt(_0x49e797);if(isNaN(_0x49e797)){_0x240844['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3070('0x13')});return;}if(_0x49e797!=0xc8){_0x240844['cb'](null,{'code':_0x49e797,'result':-0x1,'extra':'KO'});return;}_0x22277c=_0x240844['rx'][_0x3070('0x10')](0x4)[_0x3070('0x14')](_0x3070('0x15'),'');if(_0x22277c['indexOf']('\x20')!=-0x1){_0x22277c=_0x22277c[_0x3070('0x16')](0x0,_0x22277c[_0x3070('0x17')]('\x20'));}if(_['startsWith'](_0x22277c,'-1')){_0x22277c=parseInt(_0x22277c);}_0x4a80ab=_0x240844['rx']['split']('\x20');if(_0x4a80ab[_0x3070('0x18')]==0x3){_0x4a80ab=_0x4a80ab[0x2][_0x3070('0x10')](0x1,_0x4a80ab[0x2][_0x3070('0x18')]-0x1);}else if(_0x4a80ab[_0x3070('0x18')]>0x3){var _0x766377=/\((.+)\)/;var _0x3641ec=_0x240844['rx'][_0x3070('0x19')](_0x766377);if(_0x3641ec){_0x4a80ab=_0x3641ec[0x1];}else{_0x4a80ab=null;}}else{_0x4a80ab=null;}_0x240844['cb'](null,{'code':_0x49e797,'result':_0x22277c,'extra':_0x4a80ab});}});_0x4ab1d4['on'](_0x3070('0x1a'),function(_0x4564fc){_0x579bb1[_0x3070('0xb')](_0x3070('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x4564fc[_0x3070('0x1b')]));});_0x4ab1d4['on']('close',function(){_0x579bb1[_0x3070('0xb')](_0x3070('0x1c'),new AGIError(_0x3070('0x1d')));});_0x4ab1d4['on'](_0x3070('0x1e'),function(){_0x579bb1[_0x3070('0xb')](_0x3070('0x1e'),new AGIError(_0x3070('0x1f')));_0x4ab1d4['destroy']();});_0x4ab1d4[_0x3070('0x20')](_0x1736e5);this[_0x3070('0x21')]=function(_0x13452c,_0x39735d){var _0x13452c=_0x13452c||'',_0x39735d=typeof _0x39735d==_0x3070('0x22')?_0x39735d:new Function();_0x240844={'tx':_0x13452c,'rx':'','cb':_0x39735d};_0x4ab1d4[_0x3070('0x23')](_0x13452c+'\x0a');},this[_0x3070('0x1c')]=function(){_0x4ab1d4[_0x3070('0x24')]();};}util[_0x3070('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x3070('0x26')]=function(_0x530198){return this[_0x3070('0x21')][_0x3070('0x27')](this,_0x530198);};AGIChannel[_0x3070('0x28')]['answer']=function(){return this[_0x3070('0x26')](_0x3070('0x29'));};AGIChannel[_0x3070('0x28')][_0x3070('0x2a')]=function(_0x853abb,_0xe826d9,_0x2def9d){_0x853abb=_0x853abb===undefined?_0x3070('0x2b'):_0x853abb;_0xe826d9=_0xe826d9===undefined?'5':_0xe826d9;_0x2def9d=_0x2def9d===undefined?'1':_0x2def9d;return this[_0x3070('0x26')](util[_0x3070('0x2c')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x853abb,_0xe826d9*0x3e8,_0x2def9d));};AGIChannel[_0x3070('0x28')][_0x3070('0x2d')]=function(_0x1ffb6a){_0x1ffb6a=_0x1ffb6a||_0x3070('0x2e');return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x2f'),_0x1ffb6a));};AGIChannel[_0x3070('0x28')][_0x3070('0x30')]=function(_0x359ca2,_0x134709){if(_['isArray'](_0x134709)){return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x31'),_0x359ca2,_0x134709[_0x3070('0x32')](',')));}return this['sendRequest'](util[_0x3070('0x2c')]('EXEC\x20%s\x20%s',_0x359ca2,_0x134709));};AGIChannel[_0x3070('0x28')][_0x3070('0x33')]=function(_0x34d973){return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x34'),_0x34d973));};AGIChannel[_0x3070('0x28')]['setExtension']=function(_0xcdd8c8){return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x35'),_0xcdd8c8));};AGIChannel[_0x3070('0x28')][_0x3070('0x36')]=function(_0x23e7cc){return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x37'),_0x23e7cc));};AGIChannel[_0x3070('0x28')]['hangup']=function(){return this[_0x3070('0x26')]('HANGUP');};AGIChannel['prototype'][_0x3070('0x38')]=function(_0x222de6,_0x123ba6){var _0x19b4cf=_[_0x3070('0x39')](_0x123ba6)||_['isNumber'](_0x123ba6)?_0x123ba6[_0x3070('0x3a')]():_0x123ba6;return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x3b'),_0x222de6,_0x19b4cf?_0x19b4cf[_0x3070('0x3a')]()[_0x3070('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3070('0x3c')]=function(_0x3cb314,_0x4ba627){return this[_0x3070('0x26')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x3cb314,_0x4ba627));};AGIChannel[_0x3070('0x28')]['sayDigits']=function(_0x1a31e3,_0x861e63){return this['sendRequest'](util[_0x3070('0x2c')](_0x3070('0x3d'),_0x1a31e3,_0x861e63));};AGIChannel[_0x3070('0x28')]['sayPhonetic']=function(_0x55f16c,_0x10ba8b){return this['sendRequest'](util[_0x3070('0x2c')](_0x3070('0x3e'),_0x55f16c,_0x10ba8b));};AGIChannel['prototype'][_0x3070('0x3f')]=function(_0xcf737f,_0x2944b1,_0x3155ee){_0x2944b1=_0x2944b1||this['extension'];_0x3155ee=_0x3155ee||0x1;this['setContext'](_0xcf737f);this[_0x3070('0x40')](_0x2944b1);this[_0x3070('0x36')](_0x3155ee);return this['noop'](util[_0x3070('0x2c')](_0x3070('0x41'),_0xcf737f,_0x2944b1,_0x3155ee));};AGIChannel['prototype']['getVariable']=function(_0xc49e8e){return this[_0x3070('0x26')](util[_0x3070('0x2c')](_0x3070('0x42'),_0xc49e8e));};AGIChannel[_0x3070('0x28')]['recordFile']=function(_0x3034f1,_0x241f0a,_0x5a25d7,_0x365c4e,_0x7b99fe,_0x4c590c){_0x241f0a=_0x241f0a||_0x3070('0x43');_0x5a25d7=_0x5a25d7||'';_0x365c4e=_0x365c4e===undefined?-0x1:_0x365c4e==='-1'?-0x1:_0x365c4e*0x3e8;_0x7b99fe=_0x7b99fe===undefined?'':'s='+_0x7b99fe;_0x4c590c=_0x4c590c?_0x3070('0x44'):'';return this['sendRequest'](util[_0x3070('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3034f1,_0x241f0a,_0x5a25d7,_0x365c4e,_0x4c590c,_0x7b99fe));};AGIChannel[_0x3070('0x28')][_0x3070('0x45')]=function(_0x209ba2,_0xbf0d1e){_0xbf0d1e=_0xbf0d1e||'';return this['sendRequest'](util['format'](_0x3070('0x46'),_0x209ba2,_0xbf0d1e));};AGIChannel['prototype'][_0x3070('0x47')]=function(_0x3abee0){return this[_0x3070('0x30')](_0x3070('0x48'),_0x3abee0);};AGIChannel[_0x3070('0x28')][_0x3070('0x49')]=function(_0x3cd497){return this[_0x3070('0x30')]('WAIT',_0x3cd497);};AGIChannel['prototype'][_0x3070('0x1a')]=function(_0x1b5294,_0x28299a){this[_0x3070('0x2d')](util[_0x3070('0x2c')](_0x3070('0x4a'),_0x1b5294['id'],_0x1b5294[_0x3070('0x4b')],_0x28299a));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3070('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index b8cddbb..bfaffbc 100644 --- a/server/services/agi/error.js +++ b/server/services/agi/error.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b74=['Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x75fad7,_0x244ad6){var _0x256d88=function(_0x75b171){while(--_0x75b171){_0x75fad7['push'](_0x75fad7['shift']());}};_0x256d88(++_0x244ad6);}(_0x8b74,0xa2));var _0x48b7=function(_0x2cb0f2,_0xc29bc0){_0x2cb0f2=_0x2cb0f2-0x0;var _0x582577=_0x8b74[_0x2cb0f2];return _0x582577;};'use strict';var util=require(_0x48b7('0x0'));var error={'E_AGI_UNDEFINED':_0x48b7('0x1'),'E_AGI_ARGUMENT_PORT':_0x48b7('0x2'),'E_AGI_SERVER_ERROR':_0x48b7('0x3'),'E_AGI_SERVER_CLOSE':_0x48b7('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x48b7('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x48b7('0x6'),'E_AGI_SOCKET_ERROR':_0x48b7('0x7'),'E_AGI_SOCKET_CLOSE':_0x48b7('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x48b7('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x48b7('0xa'),'E_AGI_IVR_ENTRY':_0x48b7('0xb')};function AGIError(_0x409613){var _0x409613=_0x409613||null,_0x3b792e=_0x3b792e||[],_0x37faed=0x1,_0xcf0cf0='';if(!error[_0x409613]){_0x409613='E_AGI_UNDEFINED';}_0x3b792e[_0x48b7('0xc')](error[_0x409613]);while(arguments[_0x37faed]){_0x3b792e[_0x48b7('0xc')](arguments[_0x37faed]);_0x37faed++;}_0xcf0cf0=util[_0x48b7('0xd')][_0x48b7('0xe')](util,_0x3b792e);this[_0x48b7('0xf')]=_0xcf0cf0;this['name']=_0x409613;}module[_0x48b7('0x10')]=AGIError; \ No newline at end of file +var _0xa082=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0xa082,0x6c));var _0x2a08=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa082[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x2a08('0x0'));var error={'E_AGI_UNDEFINED':_0x2a08('0x1'),'E_AGI_ARGUMENT_PORT':_0x2a08('0x2'),'E_AGI_SERVER_ERROR':_0x2a08('0x3'),'E_AGI_SERVER_CLOSE':_0x2a08('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x2a08('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x2a08('0x6'),'E_AGI_SOCKET_CLOSE':_0x2a08('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x2a08('0x8'),'E_AGI_COMMAND_EMPTY':_0x2a08('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2a08('0xa')};function AGIError(_0x5f13ba){var _0x5f13ba=_0x5f13ba||null,_0x522361=_0x522361||[],_0x255e35=0x1,_0x230b81='';if(!error[_0x5f13ba]){_0x5f13ba='E_AGI_UNDEFINED';}_0x522361[_0x2a08('0xb')](error[_0x5f13ba]);while(arguments[_0x255e35]){_0x522361['push'](arguments[_0x255e35]);_0x255e35++;}_0x230b81=util[_0x2a08('0xc')]['apply'](util,_0x522361);this[_0x2a08('0xd')]=_0x230b81;this[_0x2a08('0xe')]=_0x5f13ba;}module[_0x2a08('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d321d1e..d4f2296 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aa3=['E_AGI_SERVER_ERROR','message','agi','parse','lodash','EventEmitter','ioredis','./error','redis','defaults','localhost','emit'];(function(_0x40aae2,_0x3da216){var _0x2187e6=function(_0x468399){while(--_0x468399){_0x40aae2['push'](_0x40aae2['shift']());}};_0x2187e6(++_0x3da216);}(_0x0aa3,0x1c0));var _0x30aa=function(_0x4a7401,_0x4f6059){_0x4a7401=_0x4a7401-0x0;var _0x2d73fa=_0x0aa3[_0x4a7401];return _0x2d73fa;};'use strict';var _=require(_0x30aa('0x0'));var EventEmitter=require('events')[_0x30aa('0x1')];var Redis=require(_0x30aa('0x2'));var AGIError=require(_0x30aa('0x3'));var config=require('../../config/environment');config[_0x30aa('0x4')]=_[_0x30aa('0x5')](config['redis'],{'host':_0x30aa('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x30aa('0x4')]);sub['subscribe']('agi',function(_0x326d8e){if(_0x326d8e)return eventEmitter[_0x30aa('0x7')]('error',new AGIError(_0x30aa('0x8'),_0x326d8e));});sub['on'](_0x30aa('0x9'),function(_0x1dd9af,_0xd47690){if(_0x1dd9af!==_0x30aa('0xa'))return;try{var _0xaefe9b=JSON[_0x30aa('0xb')](_0xd47690);eventEmitter[_0x30aa('0x7')]('projectUpdate',_0xaefe9b);}catch(_0x547d03){eventEmitter[_0x30aa('0x7')]('error',new AGIError(_0x30aa('0x8'),_0x547d03));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x9f15=['localhost','agi','emit','E_AGI_SERVER_ERROR','message','projectUpdate','error','lodash','events','EventEmitter','ioredis','./error','redis','defaults'];(function(_0x5364a4,_0x16f25f){var _0x5bb9fc=function(_0x32531a){while(--_0x32531a){_0x5364a4['push'](_0x5364a4['shift']());}};_0x5bb9fc(++_0x16f25f);}(_0x9f15,0xd9));var _0x59f1=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0x9f15[_0x5a2291];return _0x10e3f5;};'use strict';var _=require(_0x59f1('0x0'));var EventEmitter=require(_0x59f1('0x1'))[_0x59f1('0x2')];var Redis=require(_0x59f1('0x3'));var AGIError=require(_0x59f1('0x4'));var config=require('../../config/environment');config[_0x59f1('0x5')]=_[_0x59f1('0x6')](config[_0x59f1('0x5')],{'host':_0x59f1('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe'](_0x59f1('0x8'),function(_0x2c7791){if(_0x2c7791)return eventEmitter[_0x59f1('0x9')]('error',new AGIError(_0x59f1('0xa'),_0x2c7791));});sub['on'](_0x59f1('0xb'),function(_0x5bc8b0,_0x63e03a){if(_0x5bc8b0!==_0x59f1('0x8'))return;try{var _0x92c472=JSON['parse'](_0x63e03a);eventEmitter[_0x59f1('0x9')](_0x59f1('0xc'),_0x92c472);}catch(_0xe8b0bf){eventEmitter[_0x59f1('0x9')](_0x59f1('0xd'),new AGIError(_0x59f1('0xa'),_0xe8b0bf));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index c6684b0..8e64811 100644 --- a/server/services/agi/graph/index.js +++ b/server/services/agi/graph/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2883=['exports','lodash','menu','getdigits','getsecretdigits','vertices','numberOfEdges','edges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found'];(function(_0x419f76,_0x10fd64){var _0x283be1=function(_0x2b5a86){while(--_0x2b5a86){_0x419f76['push'](_0x419f76['shift']());}};_0x283be1(++_0x10fd64);}(_0x2883,0xfd));var _0x3288=function(_0x117d3d,_0x49505c){_0x117d3d=_0x117d3d-0x0;var _0x2b6f24=_0x2883[_0x117d3d];return _0x2b6f24;};'use strict';var _=require(_0x3288('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x3288('0x1'),_0x3288('0x2'),_0x3288('0x3')];var Graph=function(){this[_0x3288('0x4')]={};this['edges']={};this[_0x3288('0x5')]=0x0;};Graph['prototype']['addVertex']=function(_0x14ae9b){this['vertices'][_0x14ae9b['id']]=_0x14ae9b;this[_0x3288('0x6')][_0x14ae9b['id']]=[];};Graph[_0x3288('0x7')][_0x3288('0x8')]=function(_0x274d36,_0x59334e,_0x4f2563){this[_0x3288('0x6')][_0x274d36][_0x3288('0x9')]({'target':_0x59334e,'condition':_0x4f2563});this[_0x3288('0x5')]+=0x1;};Graph[_0x3288('0x7')]['size']=function(){return _[_0x3288('0xa')](this[_0x3288('0x4')]);};Graph['prototype'][_0x3288('0xb')]=function(){return this[_0x3288('0x5')];};Graph[_0x3288('0x7')][_0x3288('0xc')]=function(_0x35a1a7){return this[_0x3288('0x4')][_0x35a1a7];};Graph[_0x3288('0x7')][_0x3288('0xd')]=function(_0x437904,_0x39848a){if(!this[_0x3288('0x4')][_0x437904]){return logger[_0x3288('0xe')](_0x3288('0xf'));}var _0x354633=_0x39848a(this[_0x3288('0x4')][_0x437904]);if(!_0x354633){return logger[_0x3288('0xe')]('stop\x20traverse');}if(this[_0x3288('0x6')][_0x437904][_0x3288('0x10')]===0x0){return logger[_0x3288('0xe')](_0x3288('0x11'));}for(var _0x24b469=0x0,_0xc1b1f7=[],_0x5d2c95=![];_0x24b469\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x1665,0xf6));var _0x5166=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0x1665[_0x3c7a73];return _0xd0e2b6;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require(_0x5166('0x0'));var config=require(_0x5166('0x1'));var logger=require(_0x5166('0x2'))(_0x5166('0x3'));var utilLicense=require(_0x5166('0x4'));var rpc=require('./rpc');var Project=require(_0x5166('0x5'));var AGIEmitter=require('./events')[_0x5166('0x6')];var projects=[];config[_0x5166('0x3')]=_[_0x5166('0x7')](config[_0x5166('0x3')],{'ip':_0x5166('0x8'),'port':0x11dd});AGIEmitter['on'](_0x5166('0x9'),projectUpdateHandler);function connectionHandler(_0x5e5c3f){process[_0x5166('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5e5c3f);agiHandler(_0x5e5c3f);}catch(_0x174a7f){logger[_0x5166('0xb')](_0x174a7f['stack']);}});});}function projectUpdateHandler(_0x47abe6){try{var _0x3fd25f=_[_0x5166('0xc')](projects,['id',_0x47abe6['id']]);if(_0x3fd25f>-0x1){if(_0x47abe6[_0x5166('0xd')]===!![]){projects['splice'](_0x3fd25f,0x1);}else{projects[_0x3fd25f]=_0x47abe6;}}else{projects['push'](_0x47abe6);}}catch(_0x232e62){logger[_0x5166('0xb')](_0x232e62['stack']);}}function listeningHandler(){console[_0x5166('0xe')](_0x5166('0xf'),config[_0x5166('0x3')]['port']);logger[_0x5166('0x10')](util[_0x5166('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x5166('0x3')]['port']));}function errorHandler(_0x289f37){if(_0x289f37&&_0x289f37[_0x5166('0x12')]&&_0x289f37[_0x5166('0x13')]){logger[_0x5166('0xb')](util['format']('[%s]\x20%s',_0x289f37[_0x5166('0x12')],_0x289f37[_0x5166('0x13')]));}else{logger[_0x5166('0xb')](util[_0x5166('0x11')](_0x5166('0x14'),_0x289f37[_0x5166('0x15')]));}}function closeHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this['dnid'],this[_0x5166('0x19')]));try{createSquareReport(this);}catch(_0x144beb){logger['error'](_0x144beb[_0x5166('0x15')]);}}function timeoutHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')](_0x5166('0x1a'),this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this[_0x5166('0x1b')],this[_0x5166('0x19')]));}function hangupHandler(){logger[_0x5166('0x10')](util[_0x5166('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5166('0x16')],this[_0x5166('0x17')],this[_0x5166('0x18')],this[_0x5166('0x1b')],this['uniqueid']));this[_0x5166('0x1c')]=!![];}function createSquareReport(_0x30a05c,_0x6138c0){rpc[_0x5166('0x1d')](_0x30a05c)[_0x5166('0x1e')](function(_0x190d9a){if(_0x6138c0){_0x6138c0(null,_0x190d9a);}})[_0x5166('0x1f')](function(_0x5569cf){if(_0x6138c0){_0x6138c0(null,_0x5569cf);}});}function setChannelVariables(_0x4b1f53){for(var _0x1b8a39 in _0x4b1f53){if(_0x4b1f53[_0x5166('0x20')](_0x1b8a39)){if(_0x1b8a39[_0x5166('0x21')]('agi_')===0x0){_0x4b1f53[_0x1b8a39[_0x5166('0x22')](0x4)]=_0x4b1f53[_0x1b8a39];delete _0x4b1f53[_0x1b8a39];}}}}function agiHandler(_0x42a462){logger[_0x5166('0x23')](_0x5166('0x24'),JSON[_0x5166('0x25')](_0x42a462,null,0x2));logger[_0x5166('0x10')](util[_0x5166('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42a462['arg_1'],_0x42a462[_0x5166('0x17')],_0x42a462[_0x5166('0x18')],_0x42a462[_0x5166('0x1b')],_0x42a462[_0x5166('0x19')]));_0x42a462['on'](_0x5166('0xb'),errorHandler);_0x42a462['on'](_0x5166('0x26'),closeHandler);_0x42a462['on'](_0x5166('0x27'),timeoutHandler);_0x42a462['evtHangup']=![];_0x42a462['on'](_0x5166('0x28'),hangupHandler);var _0x2e7a79=_[_0x5166('0x29')](projects,[_0x5166('0x12'),_0x42a462[_0x5166('0x16')]]);if(!_0x2e7a79)return Project[_0x5166('0x2a')](_0x42a462);if(!_0x2e7a79[_0x5166('0x2b')])return Project[_0x5166('0x2c')](_0x42a462);return Project['initialize'](_0x2e7a79,_0x42a462);}function main(){var _0x5e814b;return utilLicense[_0x5166('0x2d')]()['then'](function(_0x4bf84d){if(!_0x4bf84d)return;if(_0x4bf84d[_0x5166('0x2e')]){if(_0x4bf84d[_0x5166('0x2f')]&&_0x4bf84d['callysquare']>0x0){logger['info'](util[_0x5166('0x11')](_0x5166('0x30'),_0x4bf84d[_0x5166('0x2f')]));_0x5e814b=_0x4bf84d[_0x5166('0x2f')];}else{logger[_0x5166('0x10')](_0x5166('0x31'));}}else{logger[_0x5166('0x10')](_0x5166('0x32'));_0x5e814b=-0x1;}})[_0x5166('0x1e')](function(){return Project['getAll']();})[_0x5166('0x1e')](function(_0x508a10){projects=_0x508a10;return;})[_0x5166('0x1f')](function(_0x42a43c){logger[_0x5166('0xb')]('[LICENSE]',_0x42a43c[_0x5166('0x15')]);})[_0x5166('0x33')](function(){var _0x36dfe9=require(_0x5166('0x34'))(config['agi'][_0x5166('0x35')],config[_0x5166('0x3')]['ip'],_0x5e814b);_0x36dfe9['on'](_0x5166('0xb'),errorHandler);_0x36dfe9['on'](_0x5166('0x36'),listeningHandler);_0x36dfe9['on']('connection',connectionHandler);_0x36dfe9['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x25b9=['./server','listening','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','indexOf','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','handleNotFound','production','initialize','getLicense','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally'];(function(_0x11091f,_0x246e6c){var _0x42feec=function(_0xb1c8b2){while(--_0xb1c8b2){_0x11091f['push'](_0x11091f['shift']());}};_0x42feec(++_0x246e6c);}(_0x25b9,0x1ba));var _0x925b=function(_0x2f0607,_0x1e6ea3){_0x2f0607=_0x2f0607-0x0;var _0xeaeefd=_0x25b9[_0x2f0607];return _0xeaeefd;};'use strict';var _=require(_0x925b('0x0'));var syncho=require(_0x925b('0x1'));var util=require(_0x925b('0x2'));var config=require(_0x925b('0x3'));var logger=require(_0x925b('0x4'))('agi');var utilLicense=require(_0x925b('0x5'));var rpc=require('./rpc');var Project=require(_0x925b('0x6'));var AGIEmitter=require(_0x925b('0x7'))['EventEmitter'];var projects=[];config[_0x925b('0x8')]=_['defaults'](config[_0x925b('0x8')],{'ip':_0x925b('0x9'),'port':0x11dd});AGIEmitter['on'](_0x925b('0xa'),projectUpdateHandler);function connectionHandler(_0x4e8eed){process[_0x925b('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4e8eed);agiHandler(_0x4e8eed);}catch(_0x35da8e){logger[_0x925b('0xc')](_0x35da8e[_0x925b('0xd')]);}});});}function projectUpdateHandler(_0x5e108b){try{var _0x4b8fdb=_[_0x925b('0xe')](projects,['id',_0x5e108b['id']]);if(_0x4b8fdb>-0x1){if(_0x5e108b[_0x925b('0xf')]===!![]){projects[_0x925b('0x10')](_0x4b8fdb,0x1);}else{projects[_0x4b8fdb]=_0x5e108b;}}else{projects[_0x925b('0x11')](_0x5e108b);}}catch(_0x38099b){logger[_0x925b('0xc')](_0x38099b[_0x925b('0xd')]);}}function listeningHandler(){console[_0x925b('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x925b('0x8')][_0x925b('0x13')]);logger[_0x925b('0x14')](util[_0x925b('0x15')](_0x925b('0x16'),config[_0x925b('0x8')]['ip'],config[_0x925b('0x8')]['port']));}function errorHandler(_0xf0cbb3){if(_0xf0cbb3&&_0xf0cbb3[_0x925b('0x17')]&&_0xf0cbb3[_0x925b('0x18')]){logger[_0x925b('0xc')](util[_0x925b('0x15')](_0x925b('0x19'),_0xf0cbb3['name'],_0xf0cbb3['message']));}else{logger[_0x925b('0xc')](util[_0x925b('0x15')](_0x925b('0x1a'),_0xf0cbb3[_0x925b('0xd')]));}}function closeHandler(){logger[_0x925b('0x14')](util[_0x925b('0x15')](_0x925b('0x1b'),this[_0x925b('0x1c')],this[_0x925b('0x1d')],this[_0x925b('0x1e')],this['dnid'],this[_0x925b('0x1f')]));try{createSquareReport(this);}catch(_0xae7e18){logger[_0x925b('0xc')](_0xae7e18[_0x925b('0xd')]);}}function timeoutHandler(){logger[_0x925b('0x14')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x925b('0x1d')],this[_0x925b('0x1e')],this[_0x925b('0x20')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x925b('0x15')](_0x925b('0x21'),this[_0x925b('0x1c')],this[_0x925b('0x1d')],this['callerid'],this[_0x925b('0x20')],this[_0x925b('0x1f')]));this[_0x925b('0x22')]=!![];}function createSquareReport(_0x4ef858,_0x4b25ed){rpc['createSquareReport'](_0x4ef858)[_0x925b('0x23')](function(_0x1a3349){if(_0x4b25ed){_0x4b25ed(null,_0x1a3349);}})[_0x925b('0x24')](function(_0x367f63){if(_0x4b25ed){_0x4b25ed(null,_0x367f63);}});}function setChannelVariables(_0x1c22b5){for(var _0x5036c7 in _0x1c22b5){if(_0x1c22b5['hasOwnProperty'](_0x5036c7)){if(_0x5036c7[_0x925b('0x25')](_0x925b('0x26'))===0x0){_0x1c22b5[_0x5036c7[_0x925b('0x27')](0x4)]=_0x1c22b5[_0x5036c7];delete _0x1c22b5[_0x5036c7];}}}}function agiHandler(_0x40b075){logger[_0x925b('0x28')]('variables',JSON[_0x925b('0x29')](_0x40b075,null,0x2));logger[_0x925b('0x14')](util[_0x925b('0x15')](_0x925b('0x2a'),_0x40b075[_0x925b('0x1c')],_0x40b075[_0x925b('0x1d')],_0x40b075[_0x925b('0x1e')],_0x40b075[_0x925b('0x20')],_0x40b075['uniqueid']));_0x40b075['on']('error',errorHandler);_0x40b075['on'](_0x925b('0x2b'),closeHandler);_0x40b075['on']('timeout',timeoutHandler);_0x40b075['evtHangup']=![];_0x40b075['on'](_0x925b('0x2c'),hangupHandler);var _0x429f90=_['find'](projects,['name',_0x40b075[_0x925b('0x1c')]]);if(!_0x429f90)return Project[_0x925b('0x2d')](_0x40b075);if(!_0x429f90[_0x925b('0x2e')])return Project['handleUnpublished'](_0x40b075);return Project[_0x925b('0x2f')](_0x429f90,_0x40b075);}function main(){var _0x38aee0;return utilLicense[_0x925b('0x30')]()['then'](function(_0x13f9ed){if(!_0x13f9ed)return;if(_0x13f9ed['voice']){if(_0x13f9ed['callysquare']&&_0x13f9ed['callysquare']>0x0){logger['info'](util[_0x925b('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x13f9ed['callysquare']));_0x38aee0=_0x13f9ed[_0x925b('0x31')];}else{logger[_0x925b('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x925b('0x32'));_0x38aee0=-0x1;}})['then'](function(){return Project['getAll']();})['then'](function(_0x5492b6){projects=_0x5492b6;return;})[_0x925b('0x24')](function(_0x486938){logger['error'](_0x925b('0x33'),_0x486938[_0x925b('0xd')]);})[_0x925b('0x34')](function(){var _0x224420=require(_0x925b('0x35'))(config['agi'][_0x925b('0x13')],config[_0x925b('0x8')]['ip'],_0x38aee0);_0x224420['on'](_0x925b('0xc'),errorHandler);_0x224420['on'](_0x925b('0x36'),listeningHandler);_0x224420['on']('connection',connectionHandler);_0x224420['on'](_0x925b('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 0182112..7c6835f 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f02=['then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x3ccd6e,_0x5baac5){var _0x5cde6b=function(_0x207573){while(--_0x207573){_0x3ccd6e['push'](_0x3ccd6e['shift']());}};_0x5cde6b(++_0x5baac5);}(_0x9f02,0x15b));var _0x29f0=function(_0xa0b41,_0x46df50){_0xa0b41=_0xa0b41-0x0;var _0x53da72=_0x9f02[_0xa0b41];return _0x53da72;};'use strict';var BPromise=require(_0x29f0('0x0'));var jayson=require(_0x29f0('0x1'));var client=jayson[_0x29f0('0x2')][_0x29f0('0x3')]({'port':0x232b});function request(_0x35a83a,_0x596729){return new BPromise(function(_0x108af6,_0x1627bd){return client[_0x29f0('0x4')](_0x35a83a,_0x596729)[_0x29f0('0x5')](function(_0x1fb67b){if(_0x1fb67b[_0x29f0('0x6')]){return _0x1627bd(_0x1fb67b[_0x29f0('0x6')][_0x29f0('0x7')]);}else{return _0x108af6(_0x1fb67b[_0x29f0('0x8')]);}})['catch'](function(_0x3727eb){return _0x1627bd(_0x3727eb);});});}exports[_0x29f0('0x9')]=function(_0x5732b8,_0x4a225e){return request(_0x29f0('0xa'),{'account':_0x5732b8,'message':_0x4a225e});}; \ No newline at end of file +var _0x950a=['jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x379eb3,_0x42926e){var _0x5ce3cb=function(_0x350f8d){while(--_0x350f8d){_0x379eb3['push'](_0x379eb3['shift']());}};_0x5ce3cb(++_0x42926e);}(_0x950a,0x18c));var _0xa950=function(_0x4f4b35,_0x1b5421){_0x4f4b35=_0x4f4b35-0x0;var _0x54d2b8=_0x950a[_0x4f4b35];return _0x54d2b8;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xa950('0x0'));var client=jayson[_0xa950('0x1')][_0xa950('0x2')]({'port':0x232b});function request(_0x21ded9,_0x34081a){return new BPromise(function(_0x4cc4b2,_0x4b6879){return client[_0xa950('0x3')](_0x21ded9,_0x34081a)[_0xa950('0x4')](function(_0x3203eb){if(_0x3203eb['error']){return _0x4b6879(_0x3203eb[_0xa950('0x5')][_0xa950('0x6')]);}else{return _0x4cc4b2(_0x3203eb[_0xa950('0x7')]);}})[_0xa950('0x8')](function(_0x3bc87e){return _0x4b6879(_0x3bc87e);});});}exports['sendMailMessage']=function(_0x47e96a,_0x50c635){return request('SendMail',{'account':_0x47e96a,'message':_0x50c635});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 99a7b93..650de40 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6eac=['[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','util','../../config/logger','agi','./rpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','toJson','mxGraphModel','production','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','start','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x6eac,0xfb));var _0xc6ea=function(_0x316ac7,_0x2f533f){_0x316ac7=_0x316ac7-0x0;var _0x153004=_0x6eac[_0x316ac7];return _0x153004;};'use strict';var _=require('lodash');var moment=require(_0xc6ea('0x0'));var parser=require('xml2json');var util=require(_0xc6ea('0x1'));var logger=require(_0xc6ea('0x2'))(_0xc6ea('0x3'));var rpc=require(_0xc6ea('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0xc6ea('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc6ea('0x6')]()[_0xc6ea('0x7')](function(_0x19cdfb){logger[_0xc6ea('0x8')](_0xc6ea('0x9'),_0x19cdfb[_0xc6ea('0xa')]);return[];});}function addVertex(_0x21e38c,_0xf73d3a,_0x3e850c){_0xf73d3a['agicommand']=_0x3e850c;if(_0xf73d3a[_0xc6ea('0xb')](_0xc6ea('0xc'))){_0xf73d3a[_0xc6ea('0xd')]=parseInt(_0xf73d3a['retry'],0xa);}_0x21e38c[_0xc6ea('0xe')](_['omit'](_0xf73d3a,_0xc6ea('0xf')));}function initGraph(_0x37ca77,_0xf35357){var _0x48411d=new Graph();for(var _0xc11d73 in _0x37ca77){if(_0x37ca77[_0xc6ea('0xb')](_0xc11d73)){if(_[_0xc6ea('0x10')](_0x37ca77[_0xc11d73])){for(var _0x5bf166=0x0;_0x5bf166<_0x37ca77[_0xc11d73][_0xc6ea('0x11')];_0x5bf166+=0x1){addVertex(_0x48411d,_0x37ca77[_0xc11d73][_0x5bf166],_0xc11d73);}}else{addVertex(_0x48411d,_0x37ca77[_0xc11d73],_0xc11d73);}}}for(var _0x341517=0x0;_0x341517<_0xf35357[_0xc6ea('0x11')];_0x341517+=0x1){if(_0xf35357[_0x341517][_0xc6ea('0x12')]&&_0xf35357[_0x341517][_0xc6ea('0x13')]){_0x48411d[_0xc6ea('0x14')](_0xf35357[_0x341517][_0xc6ea('0x12')],_0xf35357[_0x341517][_0xc6ea('0x13')],_0xf35357[_0x341517]['value']);}}return _0x48411d;}function getRoot(_0xd80d29){return parser[_0xc6ea('0x15')](_0xd80d29,{'object':!![]})[_0xc6ea('0x16')]['root'];}function inspect(_0x2119d3){return util['inspect'](_0x2119d3,{'showHidden':![],'depth':null});}function initialize(_0x582c55,_0x403ecc){var _0x248db=getRoot(_0x582c55[_0xc6ea('0x17')]);if(!_0x248db||!_0x248db['start'])return;var _0x5bc818,_0x554ade,_0x1fbb3b;logger[_0xc6ea('0x18')]('root',JSON[_0xc6ea('0x19')](_0x248db,null,0x2));_0x403ecc[_0xc6ea('0x1a')]=moment()[_0xc6ea('0x1b')](_0xc6ea('0x1c'));_0x5bc818=initGraph(_[_0xc6ea('0x1d')](_0x248db,_0xc6ea('0xf')),_0x248db[_0xc6ea('0xf')]);_0x554ade=new Vertices(_0x403ecc,rpc,mailRpc);logger[_0xc6ea('0x1e')](util[_0xc6ea('0x1b')](_0xc6ea('0x1f'),_0x403ecc[_0xc6ea('0x20')],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc[_0xc6ea('0x23')],_0x403ecc[_0xc6ea('0x24')]));_0x5bc818[_0xc6ea('0x25')](_0x248db[_0xc6ea('0x26')]['id'],function(_0x5dca6e){try{_0x5dca6e=_0x554ade[_0xc6ea('0x27')](_0x5dca6e);logger[_0xc6ea('0x18')](_0xc6ea('0x28'),JSON[_0xc6ea('0x19')](_0x5dca6e,null,0x2));if(_0x5dca6e[_0xc6ea('0x29')]===_0xc6ea('0x2a')){logger[_0xc6ea('0x1e')](_0xc6ea('0x2b'));_0x403ecc['context']=_0x5dca6e[_0xc6ea('0x2c')]||_0x403ecc['context'];_0x403ecc[_0xc6ea('0x2d')]=_0x5dca6e['extension'];_0x403ecc[_0xc6ea('0x2e')]=_0x5dca6e[_0xc6ea('0x2e')]?_0x5dca6e['priority']-0x1:0x1;return null;}else if(_0x5dca6e&&_0x554ade[_0x5dca6e[_0xc6ea('0x29')]]){_0x1fbb3b=_0x554ade[_0x5dca6e[_0xc6ea('0x29')]](_0x5dca6e);logger[_0xc6ea('0x1e')](_0xc6ea('0x2f'),JSON[_0xc6ea('0x19')](_0x1fbb3b,null,0x2));if(_0x1fbb3b&&_0x1fbb3b[_0xc6ea('0x30')]===AGI_CODE_SUCCESS&&_0x1fbb3b[_0xc6ea('0x31')]!==AGI_RESULT_ERROR&&!_0x403ecc[_0xc6ea('0x32')]){logger[_0xc6ea('0x18')]('response',inspect(_0x1fbb3b));return _['isUndefined'](_0x1fbb3b[_0xc6ea('0x31')])?null:_0x1fbb3b['result'][_0xc6ea('0x33')]();}else{logger[_0xc6ea('0x8')]('response',inspect(_0x1fbb3b));return null;}}else{logger[_0xc6ea('0x8')](_0xc6ea('0x34'));return null;}}catch(_0x176c71){logger[_0xc6ea('0x8')](_0x176c71['stack']);return null;}});if(_0x248db['finally']){logger['info'](util[_0xc6ea('0x1b')](_0xc6ea('0x35'),_0x403ecc[_0xc6ea('0x20')],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc['dnid'],_0x403ecc[_0xc6ea('0x24')]));_0x5bc818['traverseBFS'](_0x248db['finally']['id'],function(_0x5d95f4){try{_0x5d95f4=_0x554ade[_0xc6ea('0x27')](_0x5d95f4);logger[_0xc6ea('0x18')](_0xc6ea('0x28'),JSON[_0xc6ea('0x19')](_0x5d95f4,null,0x2));if(_0x5d95f4&&_0x554ade[_0x5d95f4[_0xc6ea('0x29')]]){_0x1fbb3b=_0x554ade[_0x5d95f4[_0xc6ea('0x29')]](_0x5d95f4);if(_0x1fbb3b){logger[_0xc6ea('0x18')](_0xc6ea('0x2f'),inspect(_0x1fbb3b));return _['isUndefined'](_0x1fbb3b[_0xc6ea('0x31')])?null:_0x1fbb3b[_0xc6ea('0x31')][_0xc6ea('0x33')]();}else{logger[_0xc6ea('0x8')](_0xc6ea('0x2f'),inspect(_0x1fbb3b));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x213ef8){logger[_0xc6ea('0x8')](_0x213ef8[_0xc6ea('0xa')]);return null;}});}logger['info'](util[_0xc6ea('0x1b')](_0xc6ea('0x36'),_0x403ecc['arg_1'],_0x403ecc[_0xc6ea('0x21')],_0x403ecc[_0xc6ea('0x22')],_0x403ecc['dnid'],_0x403ecc[_0xc6ea('0x24')]));logger[_0xc6ea('0x1e')](util[_0xc6ea('0x1b')](_0xc6ea('0x37'),_0x403ecc[_0xc6ea('0x2c')],_0x403ecc[_0xc6ea('0x2d')],parseInt(_0x403ecc[_0xc6ea('0x2e')],0xa)+0x1));_0x403ecc[_0xc6ea('0x38')](_0x403ecc['context'],_0x403ecc[_0xc6ea('0x2d')],parseInt(_0x403ecc['priority'],0xa)+0x1);_0x403ecc[_0xc6ea('0x39')]();}function handleNotFound(_0x56febd){logger[_0xc6ea('0x8')](util[_0xc6ea('0x1b')](_0xc6ea('0x3a'),_0x56febd['arg_1']));_0x56febd[_0xc6ea('0x38')](_0x56febd[_0xc6ea('0x2c')],_0x56febd['extension'],parseInt(_0x56febd[_0xc6ea('0x2e')],0xa)+0x1);_0x56febd[_0xc6ea('0x39')]();}function handleUnpublished(_0xd0835){logger[_0xc6ea('0x8')](util[_0xc6ea('0x1b')](_0xc6ea('0x3b'),_0xd0835['arg_1']));_0xd0835[_0xc6ea('0x38')](_0xd0835[_0xc6ea('0x2c')],_0xd0835['extension'],parseInt(_0xd0835['priority'],0xa)+0x1);_0xd0835[_0xc6ea('0x39')]();}module[_0xc6ea('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa6bf=['result','toString','error','agicommand\x20not\x20found','finally','response','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','catch','stack','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','inspect','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','evtHangup','isUndefined'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6bf,0x88));var _0xfa6b=function(_0x252fef,_0x588655){_0x252fef=_0x252fef-0x0;var _0x4067d5=_0xa6bf[_0x252fef];return _0x4067d5;};'use strict';var _=require(_0xfa6b('0x0'));var moment=require('moment');var parser=require(_0xfa6b('0x1'));var util=require(_0xfa6b('0x2'));var logger=require(_0xfa6b('0x3'))(_0xfa6b('0x4'));var rpc=require(_0xfa6b('0x5'));var mailRpc=require(_0xfa6b('0x6'));var Graph=require('./graph');var Vertices=require(_0xfa6b('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xfa6b('0x8')](function(_0x270037){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x270037[_0xfa6b('0x9')]);return[];});}function addVertex(_0x3f33f3,_0x10e3ed,_0x317e29){_0x10e3ed[_0xfa6b('0xa')]=_0x317e29;if(_0x10e3ed[_0xfa6b('0xb')]('retry')){_0x10e3ed['maxRetry']=parseInt(_0x10e3ed[_0xfa6b('0xc')],0xa);}_0x3f33f3[_0xfa6b('0xd')](_[_0xfa6b('0xe')](_0x10e3ed,_0xfa6b('0xf')));}function initGraph(_0x197346,_0x5ff835){var _0x1bc0fc=new Graph();for(var _0x421653 in _0x197346){if(_0x197346[_0xfa6b('0xb')](_0x421653)){if(_[_0xfa6b('0x10')](_0x197346[_0x421653])){for(var _0xd250bf=0x0;_0xd250bf<_0x197346[_0x421653][_0xfa6b('0x11')];_0xd250bf+=0x1){addVertex(_0x1bc0fc,_0x197346[_0x421653][_0xd250bf],_0x421653);}}else{addVertex(_0x1bc0fc,_0x197346[_0x421653],_0x421653);}}}for(var _0x14f347=0x0;_0x14f347<_0x5ff835[_0xfa6b('0x11')];_0x14f347+=0x1){if(_0x5ff835[_0x14f347][_0xfa6b('0x12')]&&_0x5ff835[_0x14f347][_0xfa6b('0x13')]){_0x1bc0fc[_0xfa6b('0x14')](_0x5ff835[_0x14f347][_0xfa6b('0x12')],_0x5ff835[_0x14f347][_0xfa6b('0x13')],_0x5ff835[_0x14f347][_0xfa6b('0x15')]);}}return _0x1bc0fc;}function getRoot(_0x2fcb24){return parser[_0xfa6b('0x16')](_0x2fcb24,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x1610de){return util[_0xfa6b('0x17')](_0x1610de,{'showHidden':![],'depth':null});}function initialize(_0x1b3397,_0x3ee9dd){var _0x5c8980=getRoot(_0x1b3397[_0xfa6b('0x18')]);if(!_0x5c8980||!_0x5c8980[_0xfa6b('0x19')])return;var _0x200cf5,_0x475b1a,_0x37acd0;logger[_0xfa6b('0x1a')](_0xfa6b('0x1b'),JSON[_0xfa6b('0x1c')](_0x5c8980,null,0x2));_0x3ee9dd[_0xfa6b('0x1d')]=moment()[_0xfa6b('0x1e')](_0xfa6b('0x1f'));_0x200cf5=initGraph(_[_0xfa6b('0xe')](_0x5c8980,_0xfa6b('0xf')),_0x5c8980[_0xfa6b('0xf')]);_0x475b1a=new Vertices(_0x3ee9dd,rpc,mailRpc);logger['info'](util['format'](_0xfa6b('0x20'),_0x3ee9dd[_0xfa6b('0x21')],_0x3ee9dd[_0xfa6b('0x22')],_0x3ee9dd[_0xfa6b('0x23')],_0x3ee9dd[_0xfa6b('0x24')],_0x3ee9dd[_0xfa6b('0x25')]));_0x200cf5[_0xfa6b('0x26')](_0x5c8980[_0xfa6b('0x19')]['id'],function(_0x4dd994){try{_0x4dd994=_0x475b1a[_0xfa6b('0x27')](_0x4dd994);logger[_0xfa6b('0x1a')](_0xfa6b('0x28'),JSON[_0xfa6b('0x1c')](_0x4dd994,null,0x2));if(_0x4dd994[_0xfa6b('0xa')]===_0xfa6b('0x29')){logger[_0xfa6b('0x2a')](_0xfa6b('0x2b'));_0x3ee9dd['context']=_0x4dd994[_0xfa6b('0x2c')]||_0x3ee9dd['context'];_0x3ee9dd[_0xfa6b('0x2d')]=_0x4dd994[_0xfa6b('0x2d')];_0x3ee9dd['priority']=_0x4dd994[_0xfa6b('0x2e')]?_0x4dd994['priority']-0x1:0x1;return null;}else if(_0x4dd994&&_0x475b1a[_0x4dd994['agicommand']]){_0x37acd0=_0x475b1a[_0x4dd994['agicommand']](_0x4dd994);logger['info']('response',JSON[_0xfa6b('0x1c')](_0x37acd0,null,0x2));if(_0x37acd0&&_0x37acd0[_0xfa6b('0x2f')]===AGI_CODE_SUCCESS&&_0x37acd0['result']!==AGI_RESULT_ERROR&&!_0x3ee9dd[_0xfa6b('0x30')]){logger[_0xfa6b('0x1a')]('response',inspect(_0x37acd0));return _[_0xfa6b('0x31')](_0x37acd0['result'])?null:_0x37acd0[_0xfa6b('0x32')][_0xfa6b('0x33')]();}else{logger[_0xfa6b('0x34')]('response',inspect(_0x37acd0));return null;}}else{logger[_0xfa6b('0x34')](_0xfa6b('0x35'));return null;}}catch(_0x57743b){logger[_0xfa6b('0x34')](_0x57743b[_0xfa6b('0x9')]);return null;}});if(_0x5c8980[_0xfa6b('0x36')]){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3ee9dd[_0xfa6b('0x21')],_0x3ee9dd[_0xfa6b('0x22')],_0x3ee9dd[_0xfa6b('0x23')],_0x3ee9dd[_0xfa6b('0x24')],_0x3ee9dd['uniqueid']));_0x200cf5['traverseBFS'](_0x5c8980[_0xfa6b('0x36')]['id'],function(_0x476a23){try{_0x476a23=_0x475b1a['clear'](_0x476a23);logger[_0xfa6b('0x1a')](_0xfa6b('0x28'),JSON[_0xfa6b('0x1c')](_0x476a23,null,0x2));if(_0x476a23&&_0x475b1a[_0x476a23[_0xfa6b('0xa')]]){_0x37acd0=_0x475b1a[_0x476a23[_0xfa6b('0xa')]](_0x476a23);if(_0x37acd0){logger[_0xfa6b('0x1a')](_0xfa6b('0x37'),inspect(_0x37acd0));return _[_0xfa6b('0x31')](_0x37acd0[_0xfa6b('0x32')])?null:_0x37acd0[_0xfa6b('0x32')][_0xfa6b('0x33')]();}else{logger[_0xfa6b('0x34')]('response',inspect(_0x37acd0));return null;}}else{logger[_0xfa6b('0x34')](_0xfa6b('0x35'));return null;}}catch(_0x2007d1){logger['error'](_0x2007d1[_0xfa6b('0x9')]);return null;}});}logger['info'](util['format'](_0xfa6b('0x38'),_0x3ee9dd[_0xfa6b('0x21')],_0x3ee9dd['calleridname'],_0x3ee9dd[_0xfa6b('0x23')],_0x3ee9dd['dnid'],_0x3ee9dd[_0xfa6b('0x25')]));logger['info'](util[_0xfa6b('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x3ee9dd['context'],_0x3ee9dd[_0xfa6b('0x2d')],parseInt(_0x3ee9dd[_0xfa6b('0x2e')],0xa)+0x1));_0x3ee9dd[_0xfa6b('0x39')](_0x3ee9dd[_0xfa6b('0x2c')],_0x3ee9dd[_0xfa6b('0x2d')],parseInt(_0x3ee9dd['priority'],0xa)+0x1);_0x3ee9dd[_0xfa6b('0x3a')]();}function handleNotFound(_0xe2326f){logger['error'](util['format'](_0xfa6b('0x3b'),_0xe2326f[_0xfa6b('0x21')]));_0xe2326f['continueAt'](_0xe2326f[_0xfa6b('0x2c')],_0xe2326f['extension'],parseInt(_0xe2326f[_0xfa6b('0x2e')],0xa)+0x1);_0xe2326f[_0xfa6b('0x3a')]();}function handleUnpublished(_0x4f8b33){logger[_0xfa6b('0x34')](util['format'](_0xfa6b('0x3c'),_0x4f8b33[_0xfa6b('0x21')]));_0x4f8b33[_0xfa6b('0x39')](_0x4f8b33[_0xfa6b('0x2c')],_0x4f8b33[_0xfa6b('0x2d')],parseInt(_0x4f8b33[_0xfa6b('0x2e')],0xa)+0x1);_0x4f8b33[_0xfa6b('0x3a')]();}module[_0xfa6b('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 4f809db..a605746 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c56=['stream','Transform','call','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','emit','util'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x6c56,0x1af));var _0x66c5=function(_0x3a7db0,_0xe93c50){_0x3a7db0=_0x3a7db0-0x0;var _0x17cbba=_0x6c56[_0x3a7db0];return _0x17cbba;};'use strict';var util=require(_0x66c5('0x0'));var Transform=require(_0x66c5('0x1'))[_0x66c5('0x2')];function AGIReply(_0xa2089){Transform[_0x66c5('0x3')](this,_0xa2089);this[_0x66c5('0x4')]='';this[_0x66c5('0x5')]=![];}util[_0x66c5('0x6')](AGIReply,Transform);AGIReply['prototype'][_0x66c5('0x7')]=function(_0x10bb09,_0x1afeca,_0x4e56b7){var _0x405e1b='\x0a',_0x5dc4e3=['\x0a\x0a',_0x66c5('0x8')],_0x1a0808=-0x1,_0x23debe=-0x1,_0x157683='',_0x48b564=0x0,_0x1df373='',_0x39332a='';this[_0x66c5('0x4')]+=_0x10bb09[_0x66c5('0x9')]();_0x1df373=this[_0x66c5('0x4')];if(!this[_0x66c5('0x5')]){_0x48b564=0x0;while(_0x5dc4e3[_0x48b564]){while((_0x23debe=_0x1df373[_0x66c5('0xa')](_0x5dc4e3[_0x48b564]))!=-0x1){_0x157683=_0x5dc4e3[_0x48b564];_0x39332a=_0x1df373[_0x66c5('0xb')](0x0,_0x23debe);_0x1df373=_0x1df373[_0x66c5('0xb')](_0x23debe+_0x157683[_0x66c5('0xc')]);var _0x49897d=_0x39332a[_0x66c5('0xd')](_0x405e1b),_0x2fc05c=0x0,_0x38735d={},_0x35f4d8='',_0x2c03bd='',_0x418e3e=-0x1;while(_0x49897d[_0x2fc05c]){_0x418e3e=_0x49897d[_0x2fc05c][_0x66c5('0xa')](':');if(_0x418e3e!=-0x1){_0x35f4d8=_0x49897d[_0x2fc05c][_0x66c5('0xe')](0x0,_0x418e3e)[_0x66c5('0xf')]();_0x2c03bd=_0x49897d[_0x2fc05c][_0x66c5('0xe')](_0x418e3e+0x1)[_0x66c5('0xf')]();if(_0x35f4d8[_0x66c5('0xc')]>0x0){_0x38735d[_0x35f4d8]=_0x2c03bd;}}else{}_0x2fc05c++;}this['emit'](_0x66c5('0x10'),_0x38735d);this[_0x66c5('0x5')]=!![];}_0x48b564++;}this[_0x66c5('0x4')]=_0x1df373;}else{while((_0x1a0808=_0x1df373[_0x66c5('0xa')](_0x405e1b))!=-0x1){_0x39332a=_0x1df373['substring'](0x0,_0x1a0808);this[_0x66c5('0x11')]('line',_0x39332a);_0x1df373=_0x1df373[_0x66c5('0xb')](_0x1a0808+_0x405e1b['length']);}this['_localBuffer']=_0x1df373;}_0x4e56b7();};module['exports']=AGIReply; \ No newline at end of file +var _0xb2d3=['split','indexOf','slice','trim','emit','headers','line','util','stream','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','substring','length'];(function(_0x40eab4,_0x1f9b10){var _0x333f32=function(_0x58240f){while(--_0x58240f){_0x40eab4['push'](_0x40eab4['shift']());}};_0x333f32(++_0x1f9b10);}(_0xb2d3,0x197));var _0x3b2d=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xb2d3[_0x1265ed];return _0x5ac459;};'use strict';var util=require(_0x3b2d('0x0'));var Transform=require(_0x3b2d('0x1'))[_0x3b2d('0x2')];function AGIReply(_0x208ef5){Transform[_0x3b2d('0x3')](this,_0x208ef5);this['_localBuffer']='';this[_0x3b2d('0x4')]=![];}util[_0x3b2d('0x5')](AGIReply,Transform);AGIReply[_0x3b2d('0x6')][_0x3b2d('0x7')]=function(_0x8fc858,_0x3ef0a2,_0x443e5e){var _0x6d638c='\x0a',_0x20b0e0=['\x0a\x0a',_0x3b2d('0x8')],_0x26398d=-0x1,_0xe3fcb4=-0x1,_0x2f8209='',_0x1aeb3c=0x0,_0xf02e92='',_0x3e5ecd='';this[_0x3b2d('0x9')]+=_0x8fc858[_0x3b2d('0xa')]();_0xf02e92=this[_0x3b2d('0x9')];if(!this[_0x3b2d('0x4')]){_0x1aeb3c=0x0;while(_0x20b0e0[_0x1aeb3c]){while((_0xe3fcb4=_0xf02e92['indexOf'](_0x20b0e0[_0x1aeb3c]))!=-0x1){_0x2f8209=_0x20b0e0[_0x1aeb3c];_0x3e5ecd=_0xf02e92[_0x3b2d('0xb')](0x0,_0xe3fcb4);_0xf02e92=_0xf02e92[_0x3b2d('0xb')](_0xe3fcb4+_0x2f8209[_0x3b2d('0xc')]);var _0x19dc4d=_0x3e5ecd[_0x3b2d('0xd')](_0x6d638c),_0x45d176=0x0,_0x2b80f8={},_0xd302ae='',_0x150dfc='',_0x4e26c6=-0x1;while(_0x19dc4d[_0x45d176]){_0x4e26c6=_0x19dc4d[_0x45d176][_0x3b2d('0xe')](':');if(_0x4e26c6!=-0x1){_0xd302ae=_0x19dc4d[_0x45d176][_0x3b2d('0xf')](0x0,_0x4e26c6)[_0x3b2d('0x10')]();_0x150dfc=_0x19dc4d[_0x45d176]['slice'](_0x4e26c6+0x1)[_0x3b2d('0x10')]();if(_0xd302ae[_0x3b2d('0xc')]>0x0){_0x2b80f8[_0xd302ae]=_0x150dfc;}}else{}_0x45d176++;}this[_0x3b2d('0x11')](_0x3b2d('0x12'),_0x2b80f8);this[_0x3b2d('0x4')]=!![];}_0x1aeb3c++;}this[_0x3b2d('0x9')]=_0xf02e92;}else{while((_0x26398d=_0xf02e92[_0x3b2d('0xe')](_0x6d638c))!=-0x1){_0x3e5ecd=_0xf02e92[_0x3b2d('0xb')](0x0,_0x26398d);this[_0x3b2d('0x11')](_0x3b2d('0x13'),_0x3e5ecd);_0xf02e92=_0xf02e92[_0x3b2d('0xb')](_0x26398d+_0x6d638c['length']);}this[_0x3b2d('0x9')]=_0xf02e92;}_0x443e5e();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7aa28b8..af1cfc9 100644 --- a/server/services/agi/rpc/index.js +++ b/server/services/agi/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d4e=['getVariableById','getSquareOdbcById','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue'];(function(_0x36bf88,_0x15c459){var _0x332914=function(_0x512adf){while(--_0x512adf){_0x36bf88['push'](_0x36bf88['shift']());}};_0x332914(++_0x15c459);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x0d4e[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xe0d4('0x0'));var moment=require(_0xe0d4('0x1'));var jayson=require(_0xe0d4('0x2'));var client=jayson[_0xe0d4('0x3')][_0xe0d4('0x4')]({'port':0x2329});function request(_0xe383c4,_0xbfd24e){return new Promise(function(_0x154d6d,_0x251804){return client['request'](_0xe383c4,_0xbfd24e)[_0xe0d4('0x5')](function(_0x118831){if(_0x118831[_0xe0d4('0x6')]){return _0x251804(_0x118831[_0xe0d4('0x6')]['message']);}else{return _0x154d6d(_0x118831['result']);}})[_0xe0d4('0x7')](function(_0x1ba14d){return _0x251804(_0x1ba14d);});});}exports[_0xe0d4('0x8')]=function(){return request(_0xe0d4('0x9'),{'options':{'raw':![],'attributes':['id',_0xe0d4('0xa'),_0xe0d4('0xb')]}});};exports[_0xe0d4('0xc')]=function(_0xb36d72){return request(_0xe0d4('0xd'),{'options':{'raw':![],'where':{'name':_0xb36d72},'attributes':[_0xe0d4('0xb')]}});};exports[_0xe0d4('0xe')]=function(_0x418ef9){return request(_0xe0d4('0xf'),{'options':{'raw':![],'where':{'id':_0x418ef9},'include':[{'model':'MailServerOut','as':_0xe0d4('0x10'),'include':[{'model':_0xe0d4('0x11'),'as':_0xe0d4('0x11')}]}],'attributes':['id',_0xe0d4('0xa'),_0xe0d4('0x12')],'smtp':!![]}});};exports[_0xe0d4('0x13')]=function(_0x423e1c){return request(_0xe0d4('0xd'),{'options':{'where':{'id':_0x423e1c},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x14')]=function(_0x3bbfd3){return request(_0xe0d4('0x15'),{'options':{'where':{'id':_0x3bbfd3},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x16')]=function(_0x3a2a41){return request('ShowVariable',{'options':{'where':{'id':_0x3a2a41},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x17')]=function(_0xe0d15b){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xe0d15b},'attributes':['dsn']}});};exports[_0xe0d4('0x18')]=function(_0x252b69){return request(_0xe0d4('0x19'),{'options':{'where':{'id':_0x252b69},'attributes':[_0xe0d4('0xa')]}});};exports[_0xe0d4('0x1a')]=function(_0x58bd0a){return request(_0xe0d4('0x1b'),{'options':{'where':{'phone':_0x58bd0a[_0xe0d4('0x1c')]},'attributes':['id']}});};exports[_0xe0d4('0x1d')]=function(_0x20795b){return request(_0xe0d4('0x1e'),{'options':{'where':{'id':_0x20795b},'attributes':['name']}});};exports[_0xe0d4('0x1f')]=function(_0x4fe73c){return request('ShowSound',{'options':{'where':{'id':_0x4fe73c},'attributes':[_0xe0d4('0x20')]}});};exports[_0xe0d4('0x21')]=function(_0x20c2c8){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x20c2c8},'include':[{'model':_0xe0d4('0x22'),'as':_0xe0d4('0x23')}]}});};exports[_0xe0d4('0x24')]=function(_0xb97419){return request(_0xe0d4('0x25'),{'options':{'where':{'id':_0xb97419},'attributes':['id',_0xe0d4('0xa')]}});};exports[_0xe0d4('0x26')]=function(_0x18613d){return request(_0xe0d4('0x27'),{'body':_0x18613d});};exports['createSquareDetailsReport']=function(_0x29fb66){return request(_0xe0d4('0x28'),{'body':_0x29fb66});};exports['createSquareReport']=function(_0x2c149b){return request('CreateSquareReport',{'body':_[_0xe0d4('0x29')](_0x2c149b,{'project_name':_0x2c149b[_0xe0d4('0x2a')],'prev_project_name':_0x2c149b[_0xe0d4('0x2b')]||'','is_subproject':_0x2c149b['arg_2']?!![]:![],'leaveAt':moment()[_0xe0d4('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x33be37){return request(_0xe0d4('0x2d'),{'body':_0x33be37});};exports[_0xe0d4('0x2e')]=function(_0x245ca3){return request(_0xe0d4('0x2f'),{'body':_0x245ca3});};exports[_0xe0d4('0x30')]=function(_0xcae18f){return request(_0xe0d4('0x31'),{'options':{'raw':![],'where':{'phone':_0xcae18f[_0xe0d4('0x1c')],'ListId':_0xcae18f[_0xe0d4('0x32')]}}})[_0xe0d4('0x5')](function(_0x3f6b3c){if(_0x3f6b3c){return _0x3f6b3c;}return request(_0xe0d4('0x33'),{'body':_0xcae18f});});};exports[_0xe0d4('0x34')]=function(_0x52348b){return request(_0xe0d4('0x35'),{'options':{'where':{'id':_0x52348b},'attributes':['name']}});};exports[_0xe0d4('0x36')]=function(_0x2b6a86,_0x45ca4b){return request(_0xe0d4('0x37'),{'body':{'interface':_0x45ca4b},'options':{'where':_0x2b6a86}});};exports[_0xe0d4('0x38')]=function(_0x180915,_0x3d979b,_0x17eded){return request(_0xe0d4('0x39'),{'body':{'type':_0x3d979b,'uniqueid':_0x17eded},'options':{'where':_0x180915}});};exports[_0xe0d4('0x3a')]=function(_0x2f4c67){return request(_0xe0d4('0x3b'),{'body':{},'options':{'where':_0x2f4c67}});};exports['agentLogout']=function(_0x3dbbb8){return request('LogoutUser',{'body':{},'options':{'where':_0x3dbbb8}});}; \ No newline at end of file +var _0xe6c1=['GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','moment','jayson/promise','client','error','message','result','catch','getSquareProjects'];(function(_0x2bcb4e,_0x453b69){var _0x881e05=function(_0x303756){while(--_0x303756){_0x2bcb4e['push'](_0x2bcb4e['shift']());}};_0x881e05(++_0x453b69);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require(_0x1e6c('0x0'));var jayson=require(_0x1e6c('0x1'));var client=jayson[_0x1e6c('0x2')]['http']({'port':0x2329});function request(_0x5e08f7,_0x435c4a){return new Promise(function(_0x37322d,_0x43ee4d){return client['request'](_0x5e08f7,_0x435c4a)['then'](function(_0x4f5365){if(_0x4f5365['error']){return _0x43ee4d(_0x4f5365[_0x1e6c('0x3')][_0x1e6c('0x4')]);}else{return _0x37322d(_0x4f5365[_0x1e6c('0x5')]);}})[_0x1e6c('0x6')](function(_0x21bf7a){return _0x43ee4d(_0x21bf7a);});});}exports[_0x1e6c('0x7')]=function(){return request(_0x1e6c('0x8'),{'options':{'raw':![],'attributes':['id',_0x1e6c('0x9'),_0x1e6c('0xa')]}});};exports[_0x1e6c('0xb')]=function(_0x350260){return request(_0x1e6c('0xc'),{'options':{'raw':![],'where':{'name':_0x350260},'attributes':[_0x1e6c('0xa')]}});};exports[_0x1e6c('0xd')]=function(_0x1da71d){return request(_0x1e6c('0xe'),{'options':{'raw':![],'where':{'id':_0x1da71d},'include':[{'model':_0x1e6c('0xf'),'as':_0x1e6c('0x10'),'include':[{'model':_0x1e6c('0x11'),'as':_0x1e6c('0x11')}]}],'attributes':['id',_0x1e6c('0x9'),'email'],'smtp':!![]}});};exports[_0x1e6c('0x12')]=function(_0x1ba9b4){return request('ShowSquareProject',{'options':{'where':{'id':_0x1ba9b4},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x13')]=function(_0x121326){return request(_0x1e6c('0x14'),{'options':{'where':{'id':_0x121326},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x15')]=function(_0x3ef544){return request('ShowVariable',{'options':{'where':{'id':_0x3ef544},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x16')]=function(_0x1f79bb){return request(_0x1e6c('0x17'),{'options':{'where':{'id':_0x1f79bb},'attributes':[_0x1e6c('0x18')]}});};exports['getUserById']=function(_0x42a511){return request(_0x1e6c('0x19'),{'options':{'where':{'id':_0x42a511},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x1a')]=function(_0x4dc9d3){return request(_0x1e6c('0x1b'),{'options':{'where':{'phone':_0x4dc9d3[_0x1e6c('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x576fac){return request(_0x1e6c('0x1d'),{'options':{'where':{'id':_0x576fac},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x1e')]=function(_0x27be03){return request(_0x1e6c('0x1f'),{'options':{'where':{'id':_0x27be03},'attributes':['save_name']}});};exports[_0x1e6c('0x20')]=function(_0x444784){return request(_0x1e6c('0x21'),{'options':{'raw':![],'where':{'id':_0x444784},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0x1e6c('0x22')]=function(_0x356df1){return request('ShowSmsAccount',{'options':{'where':{'id':_0x356df1},'attributes':['id',_0x1e6c('0x9')]}});};exports['createSmsMessage']=function(_0x4b5592){return request(_0x1e6c('0x23'),{'body':_0x4b5592});};exports[_0x1e6c('0x24')]=function(_0x3a234e){return request(_0x1e6c('0x25'),{'body':_0x3a234e});};exports[_0x1e6c('0x26')]=function(_0x547e3c){return request(_0x1e6c('0x27'),{'body':_[_0x1e6c('0x28')](_0x547e3c,{'project_name':_0x547e3c['arg_1'],'prev_project_name':_0x547e3c[_0x1e6c('0x29')]||'','is_subproject':_0x547e3c[_0x1e6c('0x29')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x1e6c('0x2a')]=function(_0x3a13c4){return request(_0x1e6c('0x2b'),{'body':_0x3a13c4});};exports[_0x1e6c('0x2c')]=function(_0x5df7e4){return request(_0x1e6c('0x2d'),{'body':_0x5df7e4});};exports[_0x1e6c('0x2e')]=function(_0x1f8d2b){return request(_0x1e6c('0x2f'),{'options':{'raw':![],'where':{'phone':_0x1f8d2b[_0x1e6c('0x1c')],'ListId':_0x1f8d2b['ListId']}}})['then'](function(_0x8d8294){if(_0x8d8294){return _0x8d8294;}return request(_0x1e6c('0x30'),{'body':_0x1f8d2b});});};exports[_0x1e6c('0x31')]=function(_0x5afdd9){return request(_0x1e6c('0x32'),{'options':{'where':{'id':_0x5afdd9},'attributes':[_0x1e6c('0x9')]}});};exports[_0x1e6c('0x33')]=function(_0x4335df,_0x45cc52){return request(_0x1e6c('0x34'),{'body':{'interface':_0x45cc52},'options':{'where':_0x4335df}});};exports['agentPause']=function(_0x2d63e8,_0x5e166b,_0x27ed9c){return request(_0x1e6c('0x35'),{'body':{'type':_0x5e166b,'uniqueid':_0x27ed9c},'options':{'where':_0x2d63e8}});};exports['agentUnpause']=function(_0x29a87a){return request(_0x1e6c('0x36'),{'body':{},'options':{'where':_0x29a87a}});};exports[_0x1e6c('0x37')]=function(_0xf4122){return request('LogoutUser',{'body':{},'options':{'where':_0xf4122}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index 2ec3d9a..4a48dca 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c7=['exports','./polly','./lex'];(function(_0x23ab27,_0x33b148){var _0x212bc7=function(_0xe0d563){while(--_0xe0d563){_0x23ab27['push'](_0x23ab27['shift']());}};_0x212bc7(++_0x33b148);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4b9128,_0x176a8e){_0x4b9128=_0x4b9128-0x0;var _0x25b36d=_0xb4c7[_0x4b9128];return _0x25b36d;};var polly=require(_0x7b4c('0x0'));var lex=require(_0x7b4c('0x1'));module[_0x7b4c('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6bac=['exports','./polly'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bac,0xa5));var _0xc6ba=function(_0x3b4cb3,_0x26e28d){_0x3b4cb3=_0x3b4cb3-0x0;var _0x2afe3a=_0x6bac[_0x3b4cb3];return _0x2afe3a;};var polly=require(_0xc6ba('0x0'));var lex=require('./lex');module[_0xc6ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1a8a92f..ac85a7f 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b){return lex(_0x46400f,_0xa5f6b7,_0x4a08d4,_0x5080f5,_0x229028,_0x1fdf5b);}; \ No newline at end of file +var _0x0bb5=['./lib/api','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0bb5,0x148));var _0x50bb=function(_0x2b5ddc,_0x52751f){_0x2b5ddc=_0x2b5ddc-0x0;var _0x2cede9=_0x0bb5[_0x2b5ddc];return _0x2cede9;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 994559a..e0bfb2c 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x9cd965,_0x1a42e7){var _0x1ba4e6=function(_0x526a54){while(--_0x526a54){_0x9cd965['push'](_0x9cd965['shift']());}};_0x1ba4e6(++_0x1a42e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x554904,_0x551436){var _0x3353cc=function(_0x5dca7c){while(--_0x5dca7c){_0x554904['push'](_0x554904['shift']());}};_0x3353cc(++_0x551436);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index ddc413a..c3a5066 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6655=['exports','./lib/api'];(function(_0x3d6a72,_0x55e5c9){var _0x39cd5d=function(_0xc05977){while(--_0xc05977){_0x3d6a72['push'](_0x3d6a72['shift']());}};_0x39cd5d(++_0x55e5c9);}(_0x6655,0x141));var _0x5665=function(_0x35d32c,_0x5bba8b){_0x35d32c=_0x35d32c-0x0;var _0x5ac55d=_0x6655[_0x35d32c];return _0x5ac55d;};'use strict';var polly=require(_0x5665('0x0'));module[_0x5665('0x1')]=function(_0x1d31b6,_0x5cd670,_0x5c51dc,_0x376112,_0x2a620f,_0xecfc8c,_0x12e41d){return polly(_0x1d31b6,_0x5cd670,_0x5c51dc,_0x376112,_0x2a620f,_0xecfc8c,_0x12e41d);}; \ No newline at end of file +var _0x049c=['exports','./lib/api'];(function(_0x5b045a,_0x48a8a5){var _0x8cf940=function(_0x3dfc43){while(--_0x3dfc43){_0x5b045a['push'](_0x5b045a['shift']());}};_0x8cf940(++_0x48a8a5);}(_0x049c,0xfb));var _0xc049=function(_0x11221a,_0x46411e){_0x11221a=_0x11221a-0x0;var _0x48cc28=_0x049c[_0x11221a];return _0x48cc28;};'use strict';var polly=require(_0xc049('0x0'));module[_0xc049('0x1')]=function(_0x1d31db,_0x2cf68c,_0x16902b,_0x592107,_0x11b68e,_0xdb8e67,_0x24251d){return polly(_0x1d31db,_0x2cf68c,_0x16902b,_0x592107,_0x11b68e,_0xdb8e67,_0x24251d);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 9345c9e..f5a011f 100644 --- a/server/services/agi/scripts/aws/polly/lib/api.js +++ b/server/services/agi/scripts/aws/polly/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe257=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','mp3','path','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x5b6e58,_0x45efd9){var _0x56c7df=function(_0x114e56){while(--_0x114e56){_0x5b6e58['push'](_0x5b6e58['shift']());}};_0x56c7df(++_0x45efd9);}(_0xe257,0xf8));var _0x7e25=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xe257[_0x35007a];return _0x574f68;};'use strict';var fs=require('fs');var path=require(_0x7e25('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x7e25('0x1'));function pollyResult(_0x637616,_0x15c4f9,_0x70da88){return new BPromise(function(_0x1d56ab,_0x4c82ba){_0x637616[_0x7e25('0x2')](_0x15c4f9,function(_0xfc225e,_0x381e65){if(_0xfc225e){_0x4c82ba(_0xfc225e);}else if(_0x381e65){if(_0x381e65[_0x7e25('0x3')]instanceof Buffer){fs[_0x7e25('0x4')](_0x70da88,_0x381e65[_0x7e25('0x3')],function(_0x4486de){if(_0x4486de){_0x4c82ba(_0x4486de);}else{_0x1d56ab();}});}else{_0x4c82ba(new Error(_0x7e25('0x5')));}}else{_0x4c82ba(new Error(_0x7e25('0x6')));}});});}module[_0x7e25('0x7')]=function(_0x30c6c5,_0x569eda,_0x12dbb1,_0x4480a3,_0x45d9c9,_0x450037,_0x4b25b9){var _0x4599e8=new AWS['Polly']({'accessKeyId':_0x30c6c5,'secretAccessKey':_0x569eda,'region':_0x12dbb1});var _0x4d7aa0={'Text':_0x45d9c9,'TextType':_0x450037||'text','OutputFormat':_0x7e25('0x8'),'VoiceId':_0x4480a3};return pollyResult(_0x4599e8,_0x4d7aa0,_0x4b25b9);}; \ No newline at end of file +var _0xbc9e=['text','mp3','path','bluebird','randomstring','aws-sdk','AudioStream','Polly'];(function(_0x3ee162,_0x1a65ef){var _0x358ebd=function(_0x3ee43b){while(--_0x3ee43b){_0x3ee162['push'](_0x3ee162['shift']());}};_0x358ebd(++_0x1a65ef);}(_0xbc9e,0x1c2));var _0xebc9=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xbc9e[_0x1d9aa0];return _0x226868;};'use strict';var fs=require('fs');var path=require(_0xebc9('0x0'));var BPromise=require(_0xebc9('0x1'));var rs=require(_0xebc9('0x2'));var AWS=require(_0xebc9('0x3'));function pollyResult(_0x454ad8,_0x4e3207,_0x220bdb){return new BPromise(function(_0x246d55,_0x366c60){_0x454ad8['synthesizeSpeech'](_0x4e3207,function(_0x41458b,_0x337715){if(_0x41458b){_0x366c60(_0x41458b);}else if(_0x337715){if(_0x337715[_0xebc9('0x4')]instanceof Buffer){fs['writeFile'](_0x220bdb,_0x337715[_0xebc9('0x4')],function(_0x3712c1){if(_0x3712c1){_0x366c60(_0x3712c1);}else{_0x246d55();}});}else{_0x366c60(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x366c60(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x561164,_0x876d5e,_0x2d4b92,_0x34644b,_0x20540a,_0x582b9f,_0x489527){var _0x137003=new AWS[(_0xebc9('0x5'))]({'accessKeyId':_0x561164,'secretAccessKey':_0x876d5e,'region':_0x2d4b92});var _0x1ccc10={'Text':_0x20540a,'TextType':_0x582b9f||_0xebc9('0x6'),'OutputFormat':_0xebc9('0x7'),'VoiceId':_0x34644b};return pollyResult(_0x137003,_0x1ccc10,_0x489527);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index b8f1266..21483fe 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9d1d=['./lib/api'];(function(_0x4b10b3,_0x482a85){var _0x51a75c=function(_0x2e4bf9){while(--_0x2e4bf9){_0x4b10b3['push'](_0x4b10b3['shift']());}};_0x51a75c(++_0x482a85);}(_0x9d1d,0x112));var _0xd9d1=function(_0x39e478,_0x523d36){_0x39e478=_0x39e478-0x0;var _0x1ed14a=_0x9d1d[_0x39e478];return _0x1ed14a;};'use strict';var asr=require(_0xd9d1('0x0'));module['exports']=function(_0x54be93,_0x1d6f9a,_0x3ee217,_0x49a6e9){return asr(_0x54be93,_0x1d6f9a,_0x3ee217);}; \ No newline at end of file +var _0x0a6c=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a6c,0xb2));var _0xc0a6=function(_0x12f993,_0x4ad0bb){_0x12f993=_0x12f993-0x0;var _0x2b022a=_0x0a6c[_0x12f993];return _0x2b022a;};'use strict';var asr=require(_0xc0a6('0x0'));module[_0xc0a6('0x1')]=function(_0x5b27a2,_0x51fbd7,_0x468ba3,_0x20deaa){return asr(_0x5b27a2,_0x51fbd7,_0x468ba3);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index 1e90e31..417ae96 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6658=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x4cf059,_0x175880){var _0x5d9646=function(_0x346670){while(--_0x346670){_0x4cf059['push'](_0x4cf059['shift']());}};_0x5d9646(++_0x175880);}(_0x6658,0x198));var _0x8665=function(_0x4050f8,_0x1f8899){_0x4050f8=_0x4050f8-0x0;var _0xcb36d0=_0x6658[_0x4050f8];return _0xcb36d0;};'use strict';var url=require(_0x8665('0x0'));var BPromise=require(_0x8665('0x1'));var fs=require('fs');var host=_0x8665('0x2');module[_0x8665('0x3')]=function(_0x45eb4a,_0x454e7c,_0x252590){return new BPromise(function(_0x49b4d3,_0x4f1343){var _0xf643d8;if(typeof _0x45eb4a!==_0x8665('0x4')||_0x45eb4a['length']===0x0){return _0x4f1343('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x454e7c!==_0x8665('0x4')||_0x454e7c[_0x8665('0x5')]===0x0){return _0x4f1343(_0x8665('0x6'));}if(typeof _0x252590!==_0x8665('0x7')&&(typeof _0x252590!==_0x8665('0x4')||_0x252590[_0x8665('0x5')]===0x0)){return _0x4f1343(_0x8665('0x8'));}try{_0xf643d8=fs[_0x8665('0x9')](_0x45eb4a)['toString'](_0x8665('0xa'));}catch(_0x20da7d){return _0x4f1343(_0x20da7d);}return _0x49b4d3({'method':_0x8665('0xb'),'uri':host+_0x8665('0xc')+_0x454e7c,'body':{'config':{'encoding':_0x8665('0xd'),'sampleRateHertz':_0x8665('0xe'),'languageCode':_0x252590},'audio':{'content':_0xf643d8}},'json':!![]});});}; \ No newline at end of file +var _0x202c=['string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','exports'];(function(_0x231129,_0x89c72f){var _0x2374a5=function(_0x40dc4f){while(--_0x40dc4f){_0x231129['push'](_0x231129['shift']());}};_0x2374a5(++_0x89c72f);}(_0x202c,0x178));var _0xc202=function(_0x297390,_0x4cba9c){_0x297390=_0x297390-0x0;var _0x4d7ffe=_0x202c[_0x297390];return _0x4d7ffe;};'use strict';var url=require(_0xc202('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xc202('0x1')]=function(_0x1ab6a1,_0x27b3b2,_0x5c5dec){return new BPromise(function(_0x215161,_0x155c3b){var _0x1763f5;if(typeof _0x1ab6a1!==_0xc202('0x2')||_0x1ab6a1['length']===0x0){return _0x155c3b(_0xc202('0x3'));}if(typeof _0x27b3b2!==_0xc202('0x2')||_0x27b3b2['length']===0x0){return _0x155c3b(_0xc202('0x4'));}if(typeof _0x5c5dec!=='undefined'&&(typeof _0x5c5dec!==_0xc202('0x2')||_0x5c5dec[_0xc202('0x5')]===0x0)){return _0x155c3b(_0xc202('0x6'));}try{_0x1763f5=fs[_0xc202('0x7')](_0x1ab6a1)[_0xc202('0x8')](_0xc202('0x9'));}catch(_0x409c93){return _0x155c3b(_0x409c93);}return _0x215161({'method':_0xc202('0xa'),'uri':host+_0xc202('0xb')+_0x27b3b2,'body':{'config':{'encoding':_0xc202('0xc'),'sampleRateHertz':_0xc202('0xd'),'languageCode':_0x5c5dec},'audio':{'content':_0x1763f5}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 8922882..10cb4be 100644 --- a/server/services/agi/scripts/google/index.js +++ b/server/services/agi/scripts/google/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ac6=['./asr','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ac6,0x74));var _0x62ac=function(_0x513c52,_0xeeea01){_0x513c52=_0x513c52-0x0;var _0x51b5f=_0x2ac6[_0x513c52];return _0x51b5f;};var asr=require(_0x62ac('0x0'));module[_0x62ac('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 16f594b..5957e16 100644 --- a/server/services/agi/scripts/index.js +++ b/server/services/agi/scripts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x113c=['fields','end_conversation','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','url','parse','util','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','resolve','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','utf8','POST','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','uri','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','source','action','result','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x113c,0x124));var _0xc113=function(_0x1ae2e1,_0x11b301){_0x1ae2e1=_0x1ae2e1-0x0;var _0xa25618=_0x113c[_0x1ae2e1];return _0xa25618;};'use strict';var apiai=require(_0xc113('0x0'));var BPromise=require(_0xc113('0x1'));var dialogflow=require(_0xc113('0x2'));var fs=require('fs');var http=require(_0xc113('0x3'));var https=require(_0xc113('0x4'));var md5=require(_0xc113('0x5'));var path=require(_0xc113('0x6'));var querystring=require(_0xc113('0x7'));var rp=require('request-promise');var rs=require(_0xc113('0x8'));var sox=require(_0xc113('0x9'));var tts=require('google-tts-api');var urlParse=require(_0xc113('0xa'))[_0xc113('0xb')];var util=require(_0xc113('0xc'));var aws=require(_0xc113('0xd'));var google=require('./google');var sestek=require(_0xc113('0xe'));var tilde=require('./tilde');var logger=require(_0xc113('0xf'))(_0xc113('0x10'));var ISPEECH_API=_0xc113('0x11');function downloadFile(_0x13f96d,_0x2ecf2b){return new BPromise(function(_0xdf0063,_0x365604){var _0x8824e9=urlParse(_0x13f96d);var _0x1a7c1e=_0x8824e9[_0xc113('0x12')]===_0xc113('0x13')?https:http;var _0x1b674a={'host':_0x8824e9[_0xc113('0x14')],'path':_0x8824e9[_0xc113('0x6')],'headers':{'user-agent':_0xc113('0x15')}};_0x1a7c1e[_0xc113('0x16')](_0x1b674a,function(_0xda1682){if(_0xda1682[_0xc113('0x17')]!==0xc8){logger[_0xc113('0x18')](_0xc113('0x19')+_0x13f96d+_0xc113('0x1a')+_0xda1682['statusCode']+'\x20('+_0xda1682[_0xc113('0x1b')]+')');_0x365604(new Error('request\x20to\x20'+_0x13f96d+_0xc113('0x1a')+_0xda1682[_0xc113('0x17')]+'\x20('+_0xda1682['statusMessage']+')'));return;}var _0x152116=fs[_0xc113('0x1c')](_0x2ecf2b);_0x152116['on'](_0xc113('0x1d'),function(){logger[_0xc113('0x1e')](_0xc113('0x1f'));_0x152116[_0xc113('0x20')](_0xdf0063);});_0x152116['on']('error',function(_0x40ef1f){fs[_0xc113('0x21')](_0x2ecf2b);logger[_0xc113('0x18')]('download\x20error',_0x40ef1f);_0x365604(_0x40ef1f);});_0xda1682[_0xc113('0x22')](_0x152116);})['on']('error',function(_0x3daa9b){logger['error'](_0x3daa9b);_0x365604(_0x3daa9b);})[_0xc113('0x23')]();});}function uploadFile(_0x24afa2){return new BPromise(function(_0x300a34,_0xad01c6){var _0x2729c2=urlParse(_0x24afa2);var _0x49d5c3=_0x2729c2[_0xc113('0x12')]===_0xc113('0x13')?https:http;var _0x1eca77={'host':_0x2729c2[_0xc113('0x14')],'path':_0x2729c2[_0xc113('0x6')],'headers':{'user-agent':_0xc113('0x15')}};_0x49d5c3[_0xc113('0x16')](_0x1eca77,function(_0x333974){if(_0x333974['statusCode']!==0xc8){_0xad01c6(new Error('request\x20to\x20'+_0x24afa2+_0xc113('0x1a')+_0x333974[_0xc113('0x17')]+'\x20('+_0x333974['statusMessage']+')'));return;}var _0x1c14ba='';_0x333974['on'](_0xc113('0x24'),function(_0x2f0041){_0x1c14ba+=_0x2f0041;});_0x333974['on'](_0xc113('0x23'),function(){_0x300a34(_0x1c14ba);});})['on']('error',function(_0x3c6e19){_0xad01c6(_0x3c6e19);})[_0xc113('0x23')]();});}function convertFile(_0x5edf94,_0x48a2e8){return new BPromise(function(_0x27672e,_0x203e48){var _0x3a1b0b=sox[_0xc113('0x25')](_0x5edf94,_0x48a2e8,{'sampleRate':0x1f40,'format':_0xc113('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3a1b0b['on'](_0xc113('0x18'),function(_0x469136){logger[_0xc113('0x18')](_0xc113('0x27'),_0x469136);_0x203e48(_0x469136);});_0x3a1b0b['on'](_0xc113('0x23'),function(){logger[_0xc113('0x1e')](_0xc113('0x28'));_0x27672e();});_0x3a1b0b[_0xc113('0x29')]();});}function base64Decode(_0x512bb8,_0x2b3d0b){var _0x53d1f1=path['resolve'](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));fs[_0xc113('0x2d')](_0x53d1f1,_0x512bb8,_0xc113('0x2e'));return convertFile(_0x53d1f1,_0x2b3d0b)[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x53d1f1);fs[_0xc113('0x30')](_0x2b3d0b,_0xc113('0x31'));}catch(_0x578d57){logger[_0xc113('0x18')](_0x578d57);}return _0x2b3d0b[_0xc113('0x32')]('.')[0x0];});}function base64Encode(_0x422c0d){var _0x83a452=fs[_0xc113('0x33')](_0x422c0d);return new Buffer(_0x83a452)[_0xc113('0x34')]('base64');}exports[_0xc113('0x35')]=function(_0x57b4f4,_0x135cf3,_0x43340d,_0x204328,_0x547035,_0x3676f2){var _0x500a0a,_0x168148;var _0x476254=_0xc113('0x36');var _0x2580cd='?key='+_0x57b4f4;var _0x4698f8={};if(_0x135cf3===_0xc113('0x37')){_0x4698f8[_0xc113('0x38')]={'ssml':_0x43340d};}else{_0x4698f8[_0xc113('0x38')]={'text':_0x43340d};};_0x4698f8[_0xc113('0x39')]={'languageCode':_0x204328,'ssmlGender':_0x547035};_0x4698f8['audioConfig']={'audioEncoding':_0xc113('0x3a'),'sampleRateHertz':0x1f40};var _0x297b91={'url':_0x476254+'text:synthesize'+_0x2580cd,'method':'POST','json':!![],'body':_0x4698f8};return rp(_0x297b91)[_0xc113('0x2f')](function(_0x52f706){return new BPromise(function(_0x607604,_0x153394){_0x500a0a=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x4037e9=Buffer[_0xc113('0x3d')](_0x52f706[_0xc113('0x3e')],_0xc113('0x2e'));return fs[_0xc113('0x3f')](_0x500a0a,_0x4037e9,function(_0x5e0f16){_0x153394(_0x5e0f16);},function(_0x4488a2){fs[_0xc113('0x30')](_0x500a0a,'777');_0x607604(_0x4488a2);});});})[_0xc113('0x2f')](function(_0xe371cf){_0x168148=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+'.wav');return convertFile(_0x500a0a,_0x168148);})[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x500a0a);fs[_0xc113('0x30')](_0x168148,'777');}catch(_0x2fbd05){logger[_0xc113('0x18')](_0x2fbd05);}logger[_0xc113('0x1e')](_0xc113('0x40'),_0x168148['split']('.')[0x0]);return _0x168148[_0xc113('0x32')]('.')[0x0];});};exports[_0xc113('0x41')]=function(_0xfff78c,_0x19755e){var _0x11122c='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4e1673,_0x113682;var _0x13fad5;var _0x458d6d={'encoding':_0xc113('0x42'),'method':_0xc113('0x43'),'timeout':0x2710,'url':_0x11122c,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc113('0x44')+encodeURIComponent(JSON[_0xc113('0x45')]([[[_0xc113('0x46'),JSON[_0xc113('0x45')]([_0xfff78c,_0x19755e||'en',![],_0xc113('0x47')]),null,_0xc113('0x48')]]]))};return rp(_0x458d6d)[_0xc113('0x2f')](function(_0x1cc96a){try{_0x13fad5=eval(_0x1cc96a[_0xc113('0x49')](0x5))[0x0][0x2];}catch(_0xa5c65e){throw new Error('parse\x20response\x20failed:\x0a'+_0x1cc96a[_0xc113('0x24')]);}if(!_0x13fad5){if(_0xfff78c[_0xc113('0x4a')]>0xc8){throw new Error(_0xc113('0x4b'));}else{throw new Error(_0xc113('0x4c')+_0x19755e+'\x22\x20might\x20not\x20exist');}}try{_0x13fad5=eval(_0x13fad5)[0x0];}catch(_0x53f524){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xc113('0x24')]);}const _0x19639f=_0x13fad5;_0x4e1673=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs['generate'](0x4)+_0xc113('0x3c'));fs[_0xc113('0x2d')](_0x4e1673,_0x13fad5,{'encoding':_0xc113('0x2e')});_0x113682=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+'.wav');return convertFile(_0x4e1673,_0x113682);})[_0xc113('0x2f')](function(){try{fs['unlink'](_0x4e1673);fs[_0xc113('0x30')](_0x113682,_0xc113('0x31'));}catch(_0x3e6485){logger[_0xc113('0x18')](_0x3e6485);}logger['info']('goggleTTS\x20path',_0x113682[_0xc113('0x32')]('.')[0x0]);return _0x113682[_0xc113('0x32')]('.')[0x0];});};exports['googleASR']=function(_0x319a55,_0xae4847,_0x1f5c4c){return google['asr'](_0x319a55,_0xae4847,_0x1f5c4c)['then'](function(_0x3458e8){logger['info'](_0x3458e8[_0xc113('0x4d')]);return rp(_0x3458e8);})[_0xc113('0x2f')](function(_0x174ccf){var _0x283ea1='';var _0x672637=0x0;try{fs[_0xc113('0x21')](_0x319a55);}catch(_0x14b18f){logger['error'](_0x14b18f);}if(_0x174ccf&&_0x174ccf[_0xc113('0x4e')]){_0x283ea1=_0x174ccf[_0xc113('0x4e')][_0xc113('0x4f')](function(_0x4c19a5){return _0x4c19a5&&_0x4c19a5[_0xc113('0x50')][0x0]&&_0x4c19a5['alternatives'][0x0][_0xc113('0x51')]?_0x4c19a5[_0xc113('0x50')][0x0][_0xc113('0x51')]:'';})[_0xc113('0x52')]('\x0a');_0x672637=_0x174ccf[_0xc113('0x4e')][_0xc113('0x4f')](function(_0x6075f1){return _0x6075f1&&_0x6075f1[_0xc113('0x50')][0x0]&&_0x6075f1[_0xc113('0x50')][0x0][_0xc113('0x53')]?_0x6075f1['alternatives'][0x0][_0xc113('0x53')]:0x0;})['join']('\x0a');}logger[_0xc113('0x1e')]('googleASR\x20transcription',_0x283ea1);logger['info']('googleASR\x20confidence',_0x672637);return{'transcript':_0x283ea1,'confidence':_0x672637};})[_0xc113('0x54')](function(_0x274e48){logger[_0xc113('0x18')](_0xc113('0x55'),_0x274e48[_0xc113('0x17')],_0x274e48[_0xc113('0x56')],_0x274e48[_0xc113('0x57')]);});};exports[_0xc113('0x58')]=function(_0x4bd808,_0x3ef962,_0x292792,_0x458aad){var _0x3ec8b5=apiai(_0x3ef962,{'language':_0x458aad||'en'});return _0x3ec8b5['textRequest'](_0x292792,{'sessionId':md5(_0x4bd808)})['then'](function(_0x505b9b){logger[_0xc113('0x1e')](JSON[_0xc113('0x45')](_0x505b9b));return{'source':_0x505b9b['result'][_0xc113('0x59')],'resolvedQuery':_0x505b9b['result']['resolvedQuery'],'action':_0x505b9b['result'][_0xc113('0x5a')],'actionIncomplete':_0x505b9b[_0xc113('0x5b')][_0xc113('0x5c')],'speech':_0x505b9b['result'][_0xc113('0x5d')][_0xc113('0x5e')],'score':_0x505b9b['result'][_0xc113('0x5f')],'statusCode':_0x505b9b[_0xc113('0x60')]['code'],'endConversation':_0x505b9b[_0xc113('0x5b')][_0xc113('0x61')][_0xc113('0x62')]||![],'isFallbackIntent':_0x505b9b['result']['metadata'][_0xc113('0x63')]};});};exports['googleDialogflowV2']=function(_0x3c8f0c,_0x3392f9,_0x46f127,_0x575006,_0x2bae8f,_0x1212eb){var _0x3094b0=_0x575006[_0xc113('0x64')](/\\n/g,'\x0a');var _0x3562f7={'credentials':{'private_key':_0x3094b0,'client_email':_0x46f127}};var _0x4f3676=new dialogflow[(_0xc113('0x65'))](_0x3562f7);var _0x1fb92f=_0x4f3676[_0xc113('0x66')](_0x3392f9,md5(_0x3c8f0c));var _0x416ceb={'session':_0x1fb92f,'queryInput':{'text':{'text':_0x2bae8f,'languageCode':_0x1212eb}}};return _0x4f3676[_0xc113('0x67')](_0x416ceb)[_0xc113('0x2f')](function(_0x5ad0f2){if(_0x5ad0f2&&_0x5ad0f2['length']){logger['info'](_0xc113('0x68'),JSON[_0xc113('0x45')](_0x5ad0f2));var _0x116ed9=_0x5ad0f2[0x0];if(_0x116ed9){var _0x3b9918={'action':_0x116ed9[_0xc113('0x69')][_0xc113('0x5a')],'allRequiredParamsPresent':_0x116ed9[_0xc113('0x69')]['allRequiredParamsPresent'],'endConversation':_0x116ed9[_0xc113('0x69')][_0xc113('0x6a')]&&_0x116ed9[_0xc113('0x69')][_0xc113('0x6a')][_0xc113('0x6b')]?_0x116ed9[_0xc113('0x69')]['diagnosticInfo']['fields'][_0xc113('0x6c')]['boolValue']:![],'fulfillmentText':_0x116ed9[_0xc113('0x69')][_0xc113('0x6d')],'intentName':_0x116ed9['queryResult']['intent'][_0xc113('0x56')],'intentDisplayName':_0x116ed9[_0xc113('0x69')][_0xc113('0x6e')][_0xc113('0x6f')],'isFallbackIntent':_0x116ed9['queryResult'][_0xc113('0x6e')][_0xc113('0x70')],'languageCode':_0x116ed9[_0xc113('0x69')]['languageCode'],'queryText':_0x116ed9[_0xc113('0x69')]['queryText'],'responseId':_0x116ed9[_0xc113('0x71')],'score':_0x116ed9[_0xc113('0x69')][_0xc113('0x72')],'speech':_0x116ed9['queryResult'][_0xc113('0x6d')],'providerResponse':JSON[_0xc113('0x45')](_0x5ad0f2)};return _0x3b9918;}}});};exports[_0xc113('0x73')]=function(_0x432e93,_0xb909c8,_0xb6e03d,_0x4b98b1){return tilde[_0xc113('0x74')](_0x432e93,_0xb909c8,_0xb6e03d,_0x4b98b1)[_0xc113('0x2f')](function(_0x36cf42){try{fs[_0xc113('0x21')](_0x432e93);}catch(_0x43f03c){logger[_0xc113('0x18')](_0x43f03c);}logger[_0xc113('0x1e')](_0xc113('0x75'),_0x36cf42[_0xc113('0x51')]);logger[_0xc113('0x1e')]('Tilde\x20ASR\x20confidence',_0x36cf42['confidence']);return _0x36cf42;});};exports['awsPolly']=function(_0x3f3cc2,_0x388ad7,_0x54b310,_0x1d5743,_0x20d54f,_0x470fd7){var _0x28c088=path['resolve'](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x44703e;return aws[_0xc113('0x76')](_0x3f3cc2,_0x388ad7,_0x54b310,_0x1d5743,_0x20d54f,_0x470fd7,_0x28c088)[_0xc113('0x2f')](function(){_0x44703e=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));return convertFile(_0x28c088,_0x44703e);})[_0xc113('0x2f')](function(){try{fs['unlink'](_0x28c088);fs[_0xc113('0x30')](_0x44703e,'777');}catch(_0x2ecdef){logger['error'](_0x2ecdef);}return _0x44703e[_0xc113('0x32')]('.')[0x0];});};exports['awsLex']=function(_0x1581b9,_0x33aa8f,_0x4bc998,_0x2ddab5,_0x4c5f31,_0x1f0575){return aws[_0xc113('0x77')](_0x1581b9,_0x33aa8f,_0x4bc998,_0x2ddab5,_0x4c5f31,_0x1f0575)[_0xc113('0x2f')](function(_0x1d2a2d){logger['info'](JSON[_0xc113('0x45')](_0x1d2a2d));return _0x1d2a2d;});};exports[_0xc113('0x78')]=function(_0x3e6af0,_0x21c462,_0x52d57f,_0x288e41){var _0x105e01=util[_0xc113('0x79')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3e6af0,encodeURIComponent(_0x21c462),_0x52d57f,_0x288e41);var _0x33bc48=path[_0xc113('0x3b')](__dirname,'tmp',rs[_0xc113('0x2b')](0x4)+_0xc113('0x3c'));var _0x23f4b7;return downloadFile(_0x105e01,_0x33bc48)[_0xc113('0x2f')](function(){_0x23f4b7=path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c'));return convertFile(_0x33bc48,_0x23f4b7);})[_0xc113('0x2f')](function(){try{fs[_0xc113('0x21')](_0x33bc48);fs[_0xc113('0x30')](_0x23f4b7,_0xc113('0x31'));}catch(_0x54524e){logger[_0xc113('0x18')](_0x54524e);}return _0x23f4b7[_0xc113('0x32')]('.')[0x0];});};exports[_0xc113('0x7a')]=function(_0xb7d080,_0x1dbae4,_0x3450ba,_0x459400){var _0x38820a=util[_0xc113('0x79')](_0xc113('0x7b'),ISPEECH_API,_0x1dbae4,_0x3450ba,base64Encode(_0xb7d080),_0x459400?util['format']('model=%s',encodeURIComponent(_0x459400)):'freeform=3');return uploadFile(_0x38820a)[_0xc113('0x2f')](function(_0x31a62f){return querystring['parse'](_0x31a62f);});};exports[_0xc113('0x7c')]=function(_0x380e18,_0x19bf9f){return sestek[_0xc113('0x7d')](_0x380e18,_0x19bf9f)[_0xc113('0x2f')](function(_0x48063c){logger[_0xc113('0x1e')](JSON[_0xc113('0x45')](_0x48063c));var _0x145b42={'speech':_0x48063c['text'],'action':_0x48063c[_0xc113('0x7e')]?_0x48063c[_0xc113('0x7e')][_0xc113('0x7f')]:undefined,'actiondata':_0x48063c[_0xc113('0x7e')]?_0x48063c[_0xc113('0x7e')][_0xc113('0x80')]:undefined};if(_0x48063c[_0xc113('0x7e')]&&_0x48063c['channelData']['AudioFromTts']){return base64Decode(_0x48063c[_0xc113('0x7e')][_0xc113('0x81')][_0xc113('0x82')],path[_0xc113('0x3b')](__dirname,_0xc113('0x2a'),rs[_0xc113('0x2b')](0x4)+_0xc113('0x2c')))[_0xc113('0x2f')](function(_0x156e08){_0x145b42[_0xc113('0x83')]=_0x156e08;return _0x145b42;});}return _0x145b42;});};exports[_0xc113('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x1202=['text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','http','https','path','querystring','randomstring','sox','url','parse','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','\x20failed,\x20status\x20code\x20=\x20','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','input','voice','audioConfig','text:synthesize','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda'];(function(_0x3c0ea7,_0x356a88){var _0x43088c=function(_0x9edc4e){while(--_0x9edc4e){_0x3c0ea7['push'](_0x3c0ea7['shift']());}};_0x43088c(++_0x356a88);}(_0x1202,0x90));var _0x2120=function(_0x4f0f27,_0x51deba){_0x4f0f27=_0x4f0f27-0x0;var _0x2ce661=_0x1202[_0x4f0f27];return _0x2ce661;};'use strict';var apiai=require(_0x2120('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x2120('0x1'));var https=require(_0x2120('0x2'));var md5=require('md5');var path=require(_0x2120('0x3'));var querystring=require(_0x2120('0x4'));var rp=require('request-promise');var rs=require(_0x2120('0x5'));var sox=require(_0x2120('0x6'));var tts=require('google-tts-api');var urlParse=require(_0x2120('0x7'))[_0x2120('0x8')];var util=require('util');var aws=require(_0x2120('0x9'));var google=require(_0x2120('0xa'));var sestek=require(_0x2120('0xb'));var tilde=require(_0x2120('0xc'));var logger=require('../../../config/logger')(_0x2120('0xd'));var ISPEECH_API=_0x2120('0xe');function downloadFile(_0x1ecc95,_0x58b16b){return new BPromise(function(_0x102594,_0x4090a1){var _0x1312ef=urlParse(_0x1ecc95);var _0x267ca8=_0x1312ef[_0x2120('0xf')]===_0x2120('0x10')?https:http;var _0x2d2461={'host':_0x1312ef[_0x2120('0x11')],'path':_0x1312ef[_0x2120('0x3')],'headers':{'user-agent':_0x2120('0x12')}};_0x267ca8[_0x2120('0x13')](_0x2d2461,function(_0x1a7c42){if(_0x1a7c42[_0x2120('0x14')]!==0xc8){logger[_0x2120('0x15')](_0x2120('0x16')+_0x1ecc95+'\x20failed,\x20status\x20code\x20=\x20'+_0x1a7c42[_0x2120('0x14')]+'\x20('+_0x1a7c42[_0x2120('0x17')]+')');_0x4090a1(new Error('request\x20to\x20'+_0x1ecc95+'\x20failed,\x20status\x20code\x20=\x20'+_0x1a7c42[_0x2120('0x14')]+'\x20('+_0x1a7c42[_0x2120('0x17')]+')'));return;}var _0x27e15c=fs[_0x2120('0x18')](_0x58b16b);_0x27e15c['on'](_0x2120('0x19'),function(){logger[_0x2120('0x1a')](_0x2120('0x1b'));_0x27e15c[_0x2120('0x1c')](_0x102594);});_0x27e15c['on'](_0x2120('0x15'),function(_0x5a73b7){fs[_0x2120('0x1d')](_0x58b16b);logger[_0x2120('0x15')](_0x2120('0x1e'),_0x5a73b7);_0x4090a1(_0x5a73b7);});_0x1a7c42[_0x2120('0x1f')](_0x27e15c);})['on'](_0x2120('0x15'),function(_0x5e0843){logger[_0x2120('0x15')](_0x5e0843);_0x4090a1(_0x5e0843);})[_0x2120('0x20')]();});}function uploadFile(_0x363e2a){return new BPromise(function(_0x1a63b3,_0x4464c9){var _0x4fc438=urlParse(_0x363e2a);var _0x91a738=_0x4fc438[_0x2120('0xf')]==='https:'?https:http;var _0x43da13={'host':_0x4fc438['host'],'path':_0x4fc438[_0x2120('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x91a738['get'](_0x43da13,function(_0x308cfa){if(_0x308cfa['statusCode']!==0xc8){_0x4464c9(new Error('request\x20to\x20'+_0x363e2a+_0x2120('0x21')+_0x308cfa[_0x2120('0x14')]+'\x20('+_0x308cfa['statusMessage']+')'));return;}var _0x1068f9='';_0x308cfa['on']('data',function(_0x362a6a){_0x1068f9+=_0x362a6a;});_0x308cfa['on']('end',function(){_0x1a63b3(_0x1068f9);});})['on'](_0x2120('0x15'),function(_0x1689b1){_0x4464c9(_0x1689b1);})[_0x2120('0x20')]();});}function convertFile(_0x38193e,_0x19cc0b){return new BPromise(function(_0x28ca55,_0x2c399a){var _0x1c1d7d=sox[_0x2120('0x22')](_0x38193e,_0x19cc0b,{'sampleRate':0x1f40,'format':_0x2120('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c1d7d['on'](_0x2120('0x15'),function(_0x3f7b0d){logger[_0x2120('0x15')]('error\x20convert',_0x3f7b0d);_0x2c399a(_0x3f7b0d);});_0x1c1d7d['on'](_0x2120('0x20'),function(){logger[_0x2120('0x1a')](_0x2120('0x24'));_0x28ca55();});_0x1c1d7d[_0x2120('0x25')]();});}function base64Decode(_0x497566,_0x291fab){var _0x5c0305=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x29'));fs[_0x2120('0x2a')](_0x5c0305,_0x497566,_0x2120('0x2b'));return convertFile(_0x5c0305,_0x291fab)[_0x2120('0x2c')](function(){try{fs[_0x2120('0x1d')](_0x5c0305);fs[_0x2120('0x2d')](_0x291fab,'777');}catch(_0x1bb61b){logger['error'](_0x1bb61b);}return _0x291fab[_0x2120('0x2e')]('.')[0x0];});}function base64Encode(_0x54076c){var _0x4d0f61=fs[_0x2120('0x2f')](_0x54076c);return new Buffer(_0x4d0f61)[_0x2120('0x30')](_0x2120('0x2b'));}exports[_0x2120('0x31')]=function(_0x21fdb8,_0x4012c2,_0x3e7621,_0x31ce29,_0x46aef6,_0x30dbc1){var _0x2ad7bc,_0xe13224;var _0x20d5cb=_0x2120('0x32');var _0x49cdff='?key='+_0x21fdb8;var _0x2e6674={};if(_0x4012c2==='ssml'){_0x2e6674[_0x2120('0x33')]={'ssml':_0x3e7621};}else{_0x2e6674[_0x2120('0x33')]={'text':_0x3e7621};};_0x2e6674[_0x2120('0x34')]={'languageCode':_0x31ce29,'ssmlGender':_0x46aef6};_0x2e6674[_0x2120('0x35')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2fa067={'url':_0x20d5cb+_0x2120('0x36')+_0x49cdff,'method':'POST','json':!![],'body':_0x2e6674};return rp(_0x2fa067)[_0x2120('0x2c')](function(_0x463ad8){return new BPromise(function(_0x293861,_0x416296){_0x2ad7bc=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x37'));var _0x269055=Buffer[_0x2120('0x38')](_0x463ad8[_0x2120('0x39')],_0x2120('0x2b'));return fs['writeFile'](_0x2ad7bc,_0x269055,function(_0x34c5e9){_0x416296(_0x34c5e9);},function(_0x12dce9){fs[_0x2120('0x2d')](_0x2ad7bc,_0x2120('0x3a'));_0x293861(_0x12dce9);});});})[_0x2120('0x2c')](function(_0x5ae617){_0xe13224=path[_0x2120('0x26')](__dirname,'tmp',rs[_0x2120('0x28')](0x4)+_0x2120('0x29'));return convertFile(_0x2ad7bc,_0xe13224);})[_0x2120('0x2c')](function(){try{fs[_0x2120('0x1d')](_0x2ad7bc);fs[_0x2120('0x2d')](_0xe13224,_0x2120('0x3a'));}catch(_0x20b3c2){logger[_0x2120('0x15')](_0x20b3c2);}logger['info'](_0x2120('0x3b'),_0xe13224[_0x2120('0x2e')]('.')[0x0]);return _0xe13224[_0x2120('0x2e')]('.')[0x0];});};exports[_0x2120('0x3c')]=function(_0x427817,_0xf6c37e){var _0x4c54b2=_0x2120('0x3d');var _0x1da095,_0x483727;var _0x10a474;var _0x382042={'encoding':_0x2120('0x3e'),'method':_0x2120('0x3f'),'timeout':0x2710,'url':_0x4c54b2,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x2120('0x40')+encodeURIComponent(JSON[_0x2120('0x41')]([[[_0x2120('0x42'),JSON['stringify']([_0x427817,_0xf6c37e||'en',![],'null']),null,_0x2120('0x43')]]]))};return rp(_0x382042)[_0x2120('0x2c')](function(_0x3bc10c){try{_0x10a474=eval(_0x3bc10c[_0x2120('0x44')](0x5))[0x0][0x2];}catch(_0x284f21){throw new Error(_0x2120('0x45')+_0x3bc10c[_0x2120('0x46')]);}if(!_0x10a474){if(_0x427817[_0x2120('0x47')]>0xc8){throw new Error(_0x2120('0x48'));}else{throw new Error('lang\x20\x22'+_0xf6c37e+'\x22\x20might\x20not\x20exist');}}try{_0x10a474=eval(_0x10a474)[0x0];}catch(_0x445308){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2120('0x46')]);}const _0xfe7f84=_0x10a474;_0x1da095=path['resolve'](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x37'));fs[_0x2120('0x2a')](_0x1da095,_0x10a474,{'encoding':'base64'});_0x483727=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x29'));return convertFile(_0x1da095,_0x483727);})['then'](function(){try{fs['unlink'](_0x1da095);fs[_0x2120('0x2d')](_0x483727,_0x2120('0x3a'));}catch(_0xe8435d){logger[_0x2120('0x15')](_0xe8435d);}logger[_0x2120('0x1a')](_0x2120('0x49'),_0x483727['split']('.')[0x0]);return _0x483727[_0x2120('0x2e')]('.')[0x0];});};exports[_0x2120('0x4a')]=function(_0x508daf,_0x41146c,_0x37a26a){return google[_0x2120('0x4b')](_0x508daf,_0x41146c,_0x37a26a)[_0x2120('0x2c')](function(_0x29db3b){logger['info'](_0x29db3b[_0x2120('0x4c')]);return rp(_0x29db3b);})[_0x2120('0x2c')](function(_0x5db13a){var _0x16cddf='';var _0x5bec23=0x0;try{fs[_0x2120('0x1d')](_0x508daf);}catch(_0x4d543c){logger[_0x2120('0x15')](_0x4d543c);}if(_0x5db13a&&_0x5db13a['results']){_0x16cddf=_0x5db13a[_0x2120('0x4d')][_0x2120('0x4e')](function(_0x4ff87d){return _0x4ff87d&&_0x4ff87d[_0x2120('0x4f')][0x0]&&_0x4ff87d['alternatives'][0x0][_0x2120('0x50')]?_0x4ff87d[_0x2120('0x4f')][0x0][_0x2120('0x50')]:'';})[_0x2120('0x51')]('\x0a');_0x5bec23=_0x5db13a[_0x2120('0x4d')]['map'](function(_0x59383a){return _0x59383a&&_0x59383a[_0x2120('0x4f')][0x0]&&_0x59383a['alternatives'][0x0][_0x2120('0x52')]?_0x59383a[_0x2120('0x4f')][0x0][_0x2120('0x52')]:0x0;})[_0x2120('0x51')]('\x0a');}logger[_0x2120('0x1a')](_0x2120('0x53'),_0x16cddf);logger[_0x2120('0x1a')]('googleASR\x20confidence',_0x5bec23);return{'transcript':_0x16cddf,'confidence':_0x5bec23};})[_0x2120('0x54')](function(_0x415254){logger[_0x2120('0x15')](_0x2120('0x55'),_0x415254[_0x2120('0x14')],_0x415254['name'],_0x415254['message']);});};exports[_0x2120('0x56')]=function(_0x34114b,_0x4a9a27,_0x16e7f,_0x54052a){var _0x2b3b09=apiai(_0x4a9a27,{'language':_0x54052a||'en'});return _0x2b3b09[_0x2120('0x57')](_0x16e7f,{'sessionId':md5(_0x34114b)})[_0x2120('0x2c')](function(_0x3d2cee){logger[_0x2120('0x1a')](JSON['stringify'](_0x3d2cee));return{'source':_0x3d2cee[_0x2120('0x58')][_0x2120('0x59')],'resolvedQuery':_0x3d2cee[_0x2120('0x58')][_0x2120('0x5a')],'action':_0x3d2cee['result']['action'],'actionIncomplete':_0x3d2cee['result'][_0x2120('0x5b')],'speech':_0x3d2cee['result'][_0x2120('0x5c')][_0x2120('0x5d')],'score':_0x3d2cee[_0x2120('0x58')][_0x2120('0x5e')],'statusCode':_0x3d2cee[_0x2120('0x5f')]['code'],'endConversation':_0x3d2cee[_0x2120('0x58')][_0x2120('0x60')]['endConversation']||![],'isFallbackIntent':_0x3d2cee[_0x2120('0x58')][_0x2120('0x60')][_0x2120('0x61')]};});};exports[_0x2120('0x62')]=function(_0x3db13a,_0x44dd4a,_0x181c18,_0x33df5f,_0x47561a,_0x3fef61){var _0xae955a=_0x33df5f[_0x2120('0x63')](/\\n/g,'\x0a');var _0xa0ac26={'credentials':{'private_key':_0xae955a,'client_email':_0x181c18}};var _0x407762=new dialogflow[(_0x2120('0x64'))](_0xa0ac26);var _0x5088ef=_0x407762[_0x2120('0x65')](_0x44dd4a,md5(_0x3db13a));var _0x247ae8={'session':_0x5088ef,'queryInput':{'text':{'text':_0x47561a,'languageCode':_0x3fef61}}};return _0x407762[_0x2120('0x66')](_0x247ae8)['then'](function(_0x5c556b){if(_0x5c556b&&_0x5c556b[_0x2120('0x47')]){logger[_0x2120('0x1a')](_0x2120('0x67'),JSON['stringify'](_0x5c556b));var _0x58ff68=_0x5c556b[0x0];if(_0x58ff68){var _0x405c78={'action':_0x58ff68[_0x2120('0x68')][_0x2120('0x69')],'allRequiredParamsPresent':_0x58ff68[_0x2120('0x68')][_0x2120('0x6a')],'endConversation':_0x58ff68['queryResult']['diagnosticInfo']&&_0x58ff68['queryResult'][_0x2120('0x6b')][_0x2120('0x6c')]?_0x58ff68['queryResult'][_0x2120('0x6b')]['fields'][_0x2120('0x6d')][_0x2120('0x6e')]:![],'fulfillmentText':_0x58ff68[_0x2120('0x68')][_0x2120('0x6f')],'intentName':_0x58ff68[_0x2120('0x68')][_0x2120('0x70')][_0x2120('0x71')],'intentDisplayName':_0x58ff68[_0x2120('0x68')][_0x2120('0x70')]['displayName'],'isFallbackIntent':_0x58ff68['queryResult'][_0x2120('0x70')]['isFallback'],'languageCode':_0x58ff68['queryResult'][_0x2120('0x72')],'queryText':_0x58ff68[_0x2120('0x68')]['queryText'],'responseId':_0x58ff68[_0x2120('0x73')],'score':_0x58ff68[_0x2120('0x68')][_0x2120('0x74')],'speech':_0x58ff68['queryResult'][_0x2120('0x6f')],'providerResponse':JSON[_0x2120('0x41')](_0x5c556b)};return _0x405c78;}}});};exports[_0x2120('0x75')]=function(_0x19b032,_0x532d7c,_0x503b21,_0x20de15){return tilde['asr'](_0x19b032,_0x532d7c,_0x503b21,_0x20de15)[_0x2120('0x2c')](function(_0x22fa3b){try{fs[_0x2120('0x1d')](_0x19b032);}catch(_0x2bcd83){logger[_0x2120('0x15')](_0x2bcd83);}logger[_0x2120('0x1a')](_0x2120('0x76'),_0x22fa3b[_0x2120('0x50')]);logger['info']('Tilde\x20ASR\x20confidence',_0x22fa3b[_0x2120('0x52')]);return _0x22fa3b;});};exports[_0x2120('0x77')]=function(_0x5c2205,_0x548ea2,_0x4ab1e8,_0x1d7a4e,_0x50410c,_0x574450){var _0x22ec1c=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs['generate'](0x4)+_0x2120('0x37'));var _0x4916c8;return aws[_0x2120('0x78')](_0x5c2205,_0x548ea2,_0x4ab1e8,_0x1d7a4e,_0x50410c,_0x574450,_0x22ec1c)[_0x2120('0x2c')](function(){_0x4916c8=path[_0x2120('0x26')](__dirname,'tmp',rs[_0x2120('0x28')](0x4)+_0x2120('0x29'));return convertFile(_0x22ec1c,_0x4916c8);})[_0x2120('0x2c')](function(){try{fs[_0x2120('0x1d')](_0x22ec1c);fs[_0x2120('0x2d')](_0x4916c8,'777');}catch(_0x11d3d9){logger[_0x2120('0x15')](_0x11d3d9);}return _0x4916c8[_0x2120('0x2e')]('.')[0x0];});};exports[_0x2120('0x79')]=function(_0x568c14,_0x7afc64,_0x14b871,_0x18ca9f,_0x571897,_0x344c10){return aws['lex'](_0x568c14,_0x7afc64,_0x14b871,_0x18ca9f,_0x571897,_0x344c10)[_0x2120('0x2c')](function(_0x192ec0){logger[_0x2120('0x1a')](JSON[_0x2120('0x41')](_0x192ec0));return _0x192ec0;});};exports['ispeechTTS']=function(_0x22116c,_0x14b861,_0x1a2da2,_0x59b7bb){var _0x5dd2c0=util[_0x2120('0x7a')](_0x2120('0x7b'),ISPEECH_API,_0x22116c,encodeURIComponent(_0x14b861),_0x1a2da2,_0x59b7bb);var _0x4b3073=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x37'));var _0x297744;return downloadFile(_0x5dd2c0,_0x4b3073)[_0x2120('0x2c')](function(){_0x297744=path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+'.wav');return convertFile(_0x4b3073,_0x297744);})[_0x2120('0x2c')](function(){try{fs[_0x2120('0x1d')](_0x4b3073);fs[_0x2120('0x2d')](_0x297744,_0x2120('0x3a'));}catch(_0x5c142b){logger[_0x2120('0x15')](_0x5c142b);}return _0x297744[_0x2120('0x2e')]('.')[0x0];});};exports[_0x2120('0x7c')]=function(_0x452652,_0xe96bad,_0x276f68,_0x52ae01){var _0x179719=util[_0x2120('0x7a')](_0x2120('0x7d'),ISPEECH_API,_0xe96bad,_0x276f68,base64Encode(_0x452652),_0x52ae01?util[_0x2120('0x7a')](_0x2120('0x7e'),encodeURIComponent(_0x52ae01)):_0x2120('0x7f'));return uploadFile(_0x179719)[_0x2120('0x2c')](function(_0x33f4ac){return querystring[_0x2120('0x8')](_0x33f4ac);});};exports[_0x2120('0x80')]=function(_0x46c0e6,_0x3356c4){return sestek[_0x2120('0x81')](_0x46c0e6,_0x3356c4)[_0x2120('0x2c')](function(_0x53bc7a){logger['info'](JSON['stringify'](_0x53bc7a));var _0x10afce={'speech':_0x53bc7a[_0x2120('0x82')],'action':_0x53bc7a['channelData']?_0x53bc7a[_0x2120('0x83')][_0x2120('0x84')]:undefined,'actiondata':_0x53bc7a[_0x2120('0x83')]?_0x53bc7a['channelData'][_0x2120('0x85')]:undefined};if(_0x53bc7a[_0x2120('0x83')]&&_0x53bc7a['channelData']['AudioFromTts']){return base64Decode(_0x53bc7a[_0x2120('0x83')][_0x2120('0x86')]['Data'],path[_0x2120('0x26')](__dirname,_0x2120('0x27'),rs[_0x2120('0x28')](0x4)+_0x2120('0x29')))['then'](function(_0x1162e9){_0x10afce[_0x2120('0x87')]=_0x1162e9;return _0x10afce;});}return _0x10afce;});};exports[_0x2120('0x88')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 7ca88c4..1eb5072 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebec=['exports','./nda'];(function(_0x3f2cd6,_0x46df10){var _0x5db507=function(_0x1f4217){while(--_0x1f4217){_0x3f2cd6['push'](_0x3f2cd6['shift']());}};_0x5db507(++_0x46df10);}(_0xebec,0x1b7));var _0xcebe=function(_0x34b1a5,_0x29c522){_0x34b1a5=_0x34b1a5-0x0;var _0x366c16=_0xebec[_0x34b1a5];return _0x366c16;};var nda=require(_0xcebe('0x0'));module[_0xcebe('0x1')]={'nda':nda}; \ No newline at end of file +var _0x5812=['exports'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0x5812,0x1c6));var _0x2581=function(_0x121da4,_0x2d715a){_0x121da4=_0x121da4-0x0;var _0x381cb4=_0x5812[_0x121da4];return _0x381cb4;};var nda=require('./nda');module[_0x2581('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 5b0a97e..dd775c0 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85b5=['callerid','calleridname','extension','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','agi','POST','ndauth_url','/token','password','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid'];(function(_0x5005f3,_0x3fc6f1){var _0x631810=function(_0x4907bc){while(--_0x4907bc){_0x5005f3['push'](_0x5005f3['shift']());}};_0x631810(++_0x3fc6f1);}(_0x85b5,0x7f));var _0x585b=function(_0x59ec8f,_0x5861bb){_0x59ec8f=_0x59ec8f-0x0;var _0x2f9569=_0x85b5[_0x59ec8f];return _0x2f9569;};'use strict';var rp=require(_0x585b('0x0'));var url=require(_0x585b('0x1'));var logger=require('../../../../../config/logger')(_0x585b('0x2'));module['exports']=function(_0x18ab39,_0x5a7ff0){var _0x4d5064={'method':_0x585b('0x3'),'uri':url['resolve'](_0x5a7ff0[_0x585b('0x4')],_0x585b('0x5')),'form':{'grant_type':_0x585b('0x6'),'username':_0x5a7ff0['username'],'password':_0x5a7ff0[_0x585b('0x6')]},'json':!![]};return rp(_0x4d5064)['then'](function(_0x432e2d){var _0x2f8895={'method':_0x585b('0x3'),'uri':url[_0x585b('0x7')](_0x5a7ff0['ndassistant_url'],_0x585b('0x8')),'body':{'type':_0x5a7ff0[_0x585b('0x9')]||_0x585b('0xa'),'channelId':_0x585b('0xb'),'conversation':{'id':_0x18ab39[_0x585b('0xc')]},'from':{'id':_0x18ab39[_0x585b('0xd')],'name':_0x18ab39[_0x585b('0xe')]},'recipient':{'id':_0x18ab39['dnid'],'name':_0x18ab39[_0x585b('0xf')]},'text':_0x5a7ff0['text'],'channelData':{}},'headers':{'Authorization':_0x585b('0x10')+_0x432e2d['access_token']},'json':!![]};if(_0x5a7ff0[_0x585b('0x11')]){_0x2f8895[_0x585b('0x12')][_0x585b('0x13')]['ProjectName']=_0x5a7ff0[_0x585b('0x11')];}if(_0x5a7ff0[_0x585b('0x14')]=='1'){_0x2f8895[_0x585b('0x12')][_0x585b('0x13')][_0x585b('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x585b('0x16')};}if(_0x5a7ff0[_0x585b('0x17')]){_0x2f8895['body'][_0x585b('0x13')][_0x585b('0x18')]=_0x5a7ff0['custom_action'];if(_0x5a7ff0['custom_action_data']){_0x2f8895[_0x585b('0x12')]['channelData']['CustomActionData']=_0x5a7ff0[_0x585b('0x19')];}}logger[_0x585b('0x1a')](JSON[_0x585b('0x1b')](_0x2f8895));return rp(_0x2f8895);});}; \ No newline at end of file +var _0xe5fb=['channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','request-promise','url','agi','exports','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body'];(function(_0x253a0f,_0x5e56ca){var _0x4228b4=function(_0x4ac0ba){while(--_0x4ac0ba){_0x253a0f['push'](_0x253a0f['shift']());}};_0x4228b4(++_0x5e56ca);}(_0xe5fb,0xce));var _0xbe5f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe5fb[_0x32f7d7];return _0x133d09;};'use strict';var rp=require(_0xbe5f('0x0'));var url=require(_0xbe5f('0x1'));var logger=require('../../../../../config/logger')(_0xbe5f('0x2'));module[_0xbe5f('0x3')]=function(_0x2ec447,_0x534aec){var _0x128e8c={'method':_0xbe5f('0x4'),'uri':url[_0xbe5f('0x5')](_0x534aec[_0xbe5f('0x6')],_0xbe5f('0x7')),'form':{'grant_type':'password','username':_0x534aec[_0xbe5f('0x8')],'password':_0x534aec[_0xbe5f('0x9')]},'json':!![]};return rp(_0x128e8c)[_0xbe5f('0xa')](function(_0x38c423){var _0x3fc210={'method':_0xbe5f('0x4'),'uri':url['resolve'](_0x534aec[_0xbe5f('0xb')],_0xbe5f('0xc')),'body':{'type':_0x534aec[_0xbe5f('0xd')]||_0xbe5f('0xe'),'channelId':_0xbe5f('0xf'),'conversation':{'id':_0x2ec447[_0xbe5f('0x10')]},'from':{'id':_0x2ec447[_0xbe5f('0x11')],'name':_0x2ec447[_0xbe5f('0x12')]},'recipient':{'id':_0x2ec447[_0xbe5f('0x13')],'name':_0x2ec447[_0xbe5f('0x14')]},'text':_0x534aec[_0xbe5f('0x15')],'channelData':{}},'headers':{'Authorization':_0xbe5f('0x16')+_0x38c423['access_token']},'json':!![]};if(_0x534aec[_0xbe5f('0x17')]){_0x3fc210[_0xbe5f('0x18')][_0xbe5f('0x19')][_0xbe5f('0x1a')]=_0x534aec[_0xbe5f('0x17')];}if(_0x534aec[_0xbe5f('0x1b')]=='1'){_0x3fc210[_0xbe5f('0x18')][_0xbe5f('0x19')][_0xbe5f('0x1c')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xbe5f('0x1d')};}if(_0x534aec[_0xbe5f('0x1e')]){_0x3fc210[_0xbe5f('0x18')][_0xbe5f('0x19')][_0xbe5f('0x1f')]=_0x534aec[_0xbe5f('0x1e')];if(_0x534aec[_0xbe5f('0x20')]){_0x3fc210[_0xbe5f('0x18')][_0xbe5f('0x19')]['CustomActionData']=_0x534aec['custom_action_data'];}}logger['info'](JSON['stringify'](_0x3fc210));return rp(_0x3fc210);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index 47c8230..7ba2b61 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdccd=['./lib/api','exports'];(function(_0x539bd8,_0x1a7eee){var _0x47d302=function(_0x1a29f4){while(--_0x1a29f4){_0x539bd8['push'](_0x539bd8['shift']());}};_0x47d302(++_0x1a7eee);}(_0xdccd,0x102));var _0xddcc=function(_0x36cf51,_0x227f71){_0x36cf51=_0x36cf51-0x0;var _0x3aa5f7=_0xdccd[_0x36cf51];return _0x3aa5f7;};'use strict';var asr=require(_0xddcc('0x0'));module[_0xddcc('0x1')]=function(_0x2f0eaa,_0x1678c3,_0x2578c7,_0x5cd689){return asr(_0x2f0eaa,_0x1678c3,_0x2578c7,_0x5cd689);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x25951e,_0x42e09d,_0x31b334,_0x4ef7e7){return asr(_0x25951e,_0x42e09d,_0x31b334,_0x4ef7e7);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 60fddca..3e78bd0 100644 --- a/server/services/agi/scripts/tilde/asr/lib/api.js +++ b/server/services/agi/scripts/tilde/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fef=['digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','hypotheses','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x4fef,0x1b3));var _0xf4fe=function(_0x2cba17,_0x1ae99e){_0x2cba17=_0x2cba17-0x0;var _0x106ac1=_0x4fef[_0x2cba17];return _0x106ac1;};'use strict';var BPromise=require(_0xf4fe('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf4fe('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0xf4fe('0x2'));module[_0xf4fe('0x3')]=function(_0x253f29,_0x4e5a67,_0x1a92f5,_0x132347){return new BPromise(function(_0x517d1a,_0x1e8a15){logger[_0xf4fe('0x4')](_0xf4fe('0x5'),_0x132347||_0xf4fe('0x6'));var _0x1de690=new WebSocket(_0x132347||_0xf4fe('0x6'),{'perMessageDeflate':![]});var _0x3ed7e1='';var _0x27603b='0';var _0xc3f06a='1';var _0x1cabe8=_0xf4fe('0x7');function _0x111c83(_0x21f8ff){var _0x49ae59=crypto[_0xf4fe('0x8')]('sha1');_0x49ae59['update'](_0x21f8ff);return _0x49ae59[_0xf4fe('0x9')](_0xf4fe('0xa'));}function _0x2fc9ad(){try{logger[_0xf4fe('0x4')](_0xf4fe('0xb'));var _0x54749a=moment()[_0xf4fe('0xc')]();var _0x12859e=_0x111c83(_0x54749a+_0x4e5a67+_0x1a92f5);_0x1de690[_0xf4fe('0xd')](JSON[_0xf4fe('0xe')]({'appID':_0x4e5a67,'timestamp':_0x54749a,'appKey':_0x12859e}));var _0x2b0709=fs['createReadStream'](_0x253f29);_0x2b0709['on'](_0xf4fe('0xf'),function(_0x44ba05){_0x1de690['send'](_0x44ba05);});_0x2b0709['on']('close',function(){_0x1de690[_0xf4fe('0xd')](_0xf4fe('0x10'));});}catch(_0x44eaa0){logger['error'](_0xf4fe('0x11'),JSON[_0xf4fe('0xe')](_0x44eaa0));_0x1de690['terminate']();}}function _0x3b3036(_0x548f6f){try{if(_0x548f6f){var _0x1dd3d3=JSON[_0xf4fe('0x12')](_0x548f6f);switch(_0x1dd3d3[_0xf4fe('0x13')]){case 0x0:if(_0x1dd3d3[_0xf4fe('0x14')]){if(_0x1dd3d3[_0xf4fe('0x14')][_0xf4fe('0x15')]){logger[_0xf4fe('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xf4fe('0xe')](_0x1dd3d3[_0xf4fe('0x14')][_0xf4fe('0x16')]));_0x3ed7e1=_0x1dd3d3['result'][_0xf4fe('0x16')][0x0]['transcript'];_0x27603b=_0x1dd3d3[_0xf4fe('0x14')]['hypotheses'][0x0][_0xf4fe('0x17')];_0xc3f06a='0';_0x1cabe8=_0xf4fe('0x18');_0x1de690[_0xf4fe('0x19')]();}}break;case 0x1:logger[_0xf4fe('0x4')](_0xf4fe('0x7'));_0xc3f06a='1';_0x1cabe8=_0xf4fe('0x7');break;case 0x2:logger[_0xf4fe('0x4')](_0xf4fe('0x1a'));_0xc3f06a='2';_0x1cabe8=_0xf4fe('0x1a');break;case 0x9:logger['info'](_0xf4fe('0x1b'));_0xc3f06a='9';_0x1cabe8=_0xf4fe('0x1b');break;case 0xa:logger[_0xf4fe('0x4')]('Authentication\x20failed.');_0xc3f06a='10';_0x1cabe8=_0xf4fe('0x1c');break;case 0xb:logger[_0xf4fe('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xc3f06a='11';_0x1cabe8='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2f7d0d){logger[_0xf4fe('0x1d')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf4fe('0xe')](_0x2f7d0d));_0x1de690['terminate']();}}function _0xbde667(){logger[_0xf4fe('0x4')](_0xf4fe('0x1e'));_0x517d1a({'transcript':_0x3ed7e1,'confidence':_0x27603b,'status':_0xc3f06a,'status_message':_0x1cabe8});}function _0xd76aab(_0x4d5d1e){logger[_0xf4fe('0x1d')](_0xf4fe('0x1f'));if(!_[_0xf4fe('0x20')](_0x4d5d1e)){logger[_0xf4fe('0x1d')](_[_0xf4fe('0x21')](_0x4d5d1e)?JSON[_0xf4fe('0xe')](_0x4d5d1e):_0x4d5d1e);}}_0x1de690['on'](_0xf4fe('0x22'),_0x2fc9ad);_0x1de690['on'](_0xf4fe('0x23'),_0x3b3036);_0x1de690['on'](_0xf4fe('0x24'),_0xbde667);_0x1de690['on'](_0xf4fe('0x1d'),_0xd76aab);});}; \ No newline at end of file +var _0x7923=['Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','info','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','agi','exports'];(function(_0x58ba84,_0x5949c6){var _0x1769eb=function(_0x8c4006){while(--_0x8c4006){_0x58ba84['push'](_0x58ba84['shift']());}};_0x1769eb(++_0x5949c6);}(_0x7923,0x1e9));var _0x3792=function(_0x49ba68,_0x1a731c){_0x49ba68=_0x49ba68-0x0;var _0x2fb17e=_0x7923[_0x49ba68];return _0x2fb17e;};'use strict';var BPromise=require(_0x3792('0x0'));var _=require(_0x3792('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3792('0x2'));var logger=require('../../../../../../config/logger')(_0x3792('0x3'));module[_0x3792('0x4')]=function(_0x3db27c,_0x3a7fc6,_0xc2ecd9,_0x1da7ea){return new BPromise(function(_0x44e17a,_0x219aa3){logger['info'](_0x3792('0x5'),_0x1da7ea||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x587860=new WebSocket(_0x1da7ea||_0x3792('0x6'),{'perMessageDeflate':![]});var _0x455734='';var _0x3d62cd='0';var _0x41d760='1';var _0x5ab758=_0x3792('0x7');function _0xffa6cb(_0x27a8f3){var _0x8e1c82=crypto[_0x3792('0x8')](_0x3792('0x9'));_0x8e1c82[_0x3792('0xa')](_0x27a8f3);return _0x8e1c82[_0x3792('0xb')]('hex');}function _0x6d9c6(){try{logger[_0x3792('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x39f817=moment()['unix']();var _0x344fea=_0xffa6cb(_0x39f817+_0x3a7fc6+_0xc2ecd9);_0x587860[_0x3792('0xd')](JSON['stringify']({'appID':_0x3a7fc6,'timestamp':_0x39f817,'appKey':_0x344fea}));var _0x58bd12=fs[_0x3792('0xe')](_0x3db27c);_0x58bd12['on'](_0x3792('0xf'),function(_0x47f58d){_0x587860[_0x3792('0xd')](_0x47f58d);});_0x58bd12['on'](_0x3792('0x10'),function(){_0x587860['send'](_0x3792('0x11'));});}catch(_0x4febb4){logger[_0x3792('0x12')](_0x3792('0x13'),JSON[_0x3792('0x14')](_0x4febb4));_0x587860[_0x3792('0x15')]();}}function _0x111e07(_0x32b410){try{if(_0x32b410){var _0x2a0935=JSON[_0x3792('0x16')](_0x32b410);switch(_0x2a0935[_0x3792('0x17')]){case 0x0:if(_0x2a0935[_0x3792('0x18')]){if(_0x2a0935['result']['final']){logger[_0x3792('0xc')]('Tilde\x20ASR\x20hypoteses',JSON[_0x3792('0x14')](_0x2a0935['result'][_0x3792('0x19')]));_0x455734=_0x2a0935[_0x3792('0x18')]['hypotheses'][0x0][_0x3792('0x1a')];_0x3d62cd=_0x2a0935[_0x3792('0x18')][_0x3792('0x19')][0x0]['likelihood'];_0x41d760='0';_0x5ab758=_0x3792('0x1b');_0x587860[_0x3792('0x15')]();}}break;case 0x1:logger['info'](_0x3792('0x7'));_0x41d760='1';_0x5ab758='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x3792('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x41d760='2';_0x5ab758=_0x3792('0x1c');break;case 0x9:logger[_0x3792('0xc')](_0x3792('0x1d'));_0x41d760='9';_0x5ab758=_0x3792('0x1d');break;case 0xa:logger[_0x3792('0xc')]('Authentication\x20failed.');_0x41d760='10';_0x5ab758=_0x3792('0x1e');break;case 0xb:logger[_0x3792('0xc')](_0x3792('0x1f'));_0x41d760='11';_0x5ab758=_0x3792('0x1f');}}}catch(_0x50fbdf){logger['error'](_0x3792('0x20'),JSON['stringify'](_0x50fbdf));_0x587860['terminate']();}}function _0xc6f8f1(){logger[_0x3792('0xc')](_0x3792('0x21'));_0x44e17a({'transcript':_0x455734,'confidence':_0x3d62cd,'status':_0x41d760,'status_message':_0x5ab758});}function _0x2b5542(_0x5a217e){logger['error'](_0x3792('0x22'));if(!_[_0x3792('0x23')](_0x5a217e)){logger[_0x3792('0x12')](_['isObject'](_0x5a217e)?JSON['stringify'](_0x5a217e):_0x5a217e);}}_0x587860['on'](_0x3792('0x24'),_0x6d9c6);_0x587860['on'](_0x3792('0x25'),_0x111e07);_0x587860['on'](_0x3792('0x10'),_0xc6f8f1);_0x587860['on'](_0x3792('0x12'),_0x2b5542);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 2d19f5c..a365085 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7466=['exports'];(function(_0x44dd74,_0x5b4ee7){var _0x184833=function(_0x1e4123){while(--_0x1e4123){_0x44dd74['push'](_0x44dd74['shift']());}};_0x184833(++_0x5b4ee7);}(_0x7466,0x12f));var _0x6746=function(_0x51cf1d,_0xc42abf){_0x51cf1d=_0x51cf1d-0x0;var _0xac3047=_0x7466[_0x51cf1d];return _0xac3047;};var asr=require('./asr');module[_0x6746('0x0')]={'asr':asr}; \ No newline at end of file +var _0x1e09=['exports','./asr'];(function(_0x305a88,_0x3022bd){var _0x44ae2a=function(_0x3ed82b){while(--_0x3ed82b){_0x305a88['push'](_0x305a88['shift']());}};_0x44ae2a(++_0x3022bd);}(_0x1e09,0xc1));var _0x91e0=function(_0x46a1b1,_0x403023){_0x46a1b1=_0x46a1b1-0x0;var _0x1758c2=_0x1e09[_0x46a1b1];return _0x1758c2;};var asr=require(_0x91e0('0x0'));module[_0x91e0('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2cda396..026dbb8 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x13cbb5,_0x344699){var _0x226191=function(_0x338542){while(--_0x338542){_0x13cbb5['push'](_0x13cbb5['shift']());}};_0x226191(++_0x344699);}(_0x34e8,0x12c));var _0x834e=function(_0xaef573,_0x287d1f){_0xaef573=_0xaef573-0x0;var _0x14af51=_0x34e8[_0xaef573];return _0x14af51;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index aab6368..f457244 100644 --- a/server/services/agi/vertices.js +++ b/server/services/agi/vertices.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58a7=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','forEach','keys','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','response','no\x20variable\x20selected\x20for\x20the\x20result','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','success','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','user','template_id','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','arg_1','createSquareRecording','uniqueid','callerid','calleridname','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','hasOwnProperty','%s.%s','isArray','length','saveRestApiResult','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','no\x20text\x20configured','MRCPSynth','mrcprecog','grammar','noop','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block'];(function(_0x6893c7,_0x3abe93){var _0x5f39b7=function(_0x1b00b9){while(--_0x1b00b9){_0x6893c7['push'](_0x6893c7['shift']());}};_0x5f39b7(++_0x3abe93);}(_0x58a7,0xf7));var _0x758a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x58a7[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var util=require(_0x758a('0x0'));var _=require(_0x758a('0x1'));var sh=require(_0x758a('0x2'));var odbc=require(_0x758a('0x3'))();var rs=require(_0x758a('0x4'));var moment=require(_0x758a('0x5'));var Mustache=require(_0x758a('0x6'));var rp=require(_0x758a('0x7'));var logger=require('../../config/logger')(_0x758a('0x8'));var config=require(_0x758a('0x9'));var shared=require(_0x758a('0xa'));var scripts=require(_0x758a('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x758a('0xc')];var verticesWithRetry=['menu',_0x758a('0xd'),_0x758a('0xe')];var AGIVertices=function(_0x189085,_0x12a46b,_0x1e5665){this[_0x758a('0xf')]=_0x189085;this[_0x758a('0x10')]=_0x12a46b;this[_0x758a('0x11')]=_0x1e5665;};AGIVertices[_0x758a('0x12')][_0x758a('0x13')]=function(_0x3224b4,_0x4bde5d){this['rpc'][_0x758a('0x14')](_0x3224b4)[_0x758a('0x15')](function(_0x1785d1){_0x4bde5d(null,_0x1785d1?_0x1785d1['name']:![]);})[_0x758a('0x16')](function(_0x2cc841){_0x4bde5d(_0x2cc841);});};AGIVertices[_0x758a('0x12')][_0x758a('0x17')]=function(_0x223861,_0x541d85){this['rpc'][_0x758a('0x18')](_0x223861)[_0x758a('0x15')](function(_0x1653f1){_0x541d85(null,_0x1653f1?_0x1653f1['name']:![]);})['catch'](function(_0x5a9512){_0x541d85(_0x5a9512);});};AGIVertices['prototype'][_0x758a('0x19')]=function(_0x65523a,_0x520883){this[_0x758a('0x10')][_0x758a('0x1a')](_0x65523a)[_0x758a('0x15')](function(_0x12dc48){_0x520883(null,_0x12dc48?_0x12dc48[_0x758a('0x1b')]:![]);})[_0x758a('0x16')](function(_0x452bbb){_0x520883(_0x452bbb);});};AGIVertices[_0x758a('0x12')][_0x758a('0x1c')]=function(_0x15653b,_0x317427){this[_0x758a('0x10')][_0x758a('0x1d')](_0x15653b)[_0x758a('0x15')](function(_0x1f7a34){_0x317427(null,_0x1f7a34?_0x1f7a34[_0x758a('0x1e')]:![]);})['catch'](function(_0xc3f455){_0x317427(_0xc3f455);});};AGIVertices[_0x758a('0x12')][_0x758a('0x1f')]=function(_0x3ba95e,_0x239fd9){this[_0x758a('0x10')][_0x758a('0x20')](_0x3ba95e)['then'](function(_0x1bc4e2){_0x239fd9(null,_0x1bc4e2?_0x1bc4e2[_0x758a('0x1b')]:![]);})['catch'](function(_0x4b1e08){_0x239fd9(_0x4b1e08);});};AGIVertices[_0x758a('0x12')][_0x758a('0x21')]=function(_0x1a73d5,_0x32d0d5){this[_0x758a('0x10')]['getTrunkById'](_0x1a73d5)[_0x758a('0x15')](function(_0x5d0499){_0x32d0d5(null,_0x5d0499?_0x5d0499['name']:![]);})[_0x758a('0x16')](function(_0x3e01f4){_0x32d0d5(_0x3e01f4);});};AGIVertices[_0x758a('0x12')]['getSound']=function(_0x14600a,_0x327082){var _0x68b65d=this;this[_0x758a('0x10')][_0x758a('0x22')](_0x14600a)[_0x758a('0x15')](function(_0xe21322){_0x327082(null,_0xe21322?_0x68b65d[_0x758a('0x23')](_0xe21322[_0x758a('0x24')]):![]);})[_0x758a('0x16')](function(_0x1808c8){_0x327082(_0x1808c8);});};AGIVertices['prototype']['getMailAccount']=function(_0x10850b,_0x1cd222){this[_0x758a('0x10')][_0x758a('0x25')](_0x10850b)[_0x758a('0x15')](function(_0x301508){_0x1cd222(null,_0x301508?_0x301508:![]);})[_0x758a('0x16')](function(_0x17732e){_0x1cd222(_0x17732e);});};AGIVertices[_0x758a('0x12')][_0x758a('0x26')]=function(_0x20d8fb,_0x43a799,_0x3ba6cf){this['mailRpc'][_0x758a('0x26')](_0x20d8fb,_0x43a799)[_0x758a('0x15')](function(){_0x3ba6cf(null);})['catch'](function(_0x4284fb){_0x3ba6cf(_0x4284fb);});};AGIVertices[_0x758a('0x12')][_0x758a('0x27')]=function(_0x10385c,_0x592287){this['rpc'][_0x758a('0x28')](_0x10385c)[_0x758a('0x15')](function(_0x4f239a){if(_0x4f239a){if(_0x4f239a['IntervalId']){_0x592287(null,[_0x4f239a[_0x758a('0x29')]]);}else{_0x592287(null,_[_0x758a('0x2a')](_0x4f239a[_0x758a('0x2b')],_0x758a('0x29')));}}else{_0x592287(null,![]);}})[_0x758a('0x16')](function(_0x571296){_0x592287(_0x571296);});};AGIVertices[_0x758a('0x12')]['getSoundPath']=function(_0x516b94){return util[_0x758a('0x2c')](_0x758a('0x2d'),FILES_PATH,_0x516b94);};AGIVertices[_0x758a('0x12')][_0x758a('0x2e')]=function(_0x3e39db,_0x4810f9,_0xc6d97f){odbc[_0x758a('0x2f')](_0x3e39db,function(_0x2929fb){if(_0x2929fb){logger[_0x758a('0x30')](_0x758a('0x31'),_0x2929fb);_0xc6d97f(_0x2929fb);}else{logger[_0x758a('0x32')](_0x758a('0x33'));odbc['query'](_0x4810f9,function(_0x2c5f6a,_0x38ed79){if(_0x2c5f6a){logger[_0x758a('0x32')](_0x758a('0x34'),_0x4810f9);_0xc6d97f(_0x2c5f6a);}else{logger[_0x758a('0x32')]('Query\x20executed\x20correctly\x20%s',_0x4810f9);odbc[_0x758a('0x35')](function(_0x1d40f3){if(_0x1d40f3){logger[_0x758a('0x30')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1d40f3);}_0xc6d97f(null,_0x38ed79);});}});}});};AGIVertices[_0x758a('0x12')]['getSmsAccount']=function(_0x219d47,_0x16eed5){this['rpc'][_0x758a('0x36')](_0x219d47)[_0x758a('0x15')](function(_0x24755f){_0x16eed5(null,_0x24755f?_0x24755f:![]);})[_0x758a('0x16')](function(_0x1fb698){_0x16eed5(_0x1fb698);});};AGIVertices[_0x758a('0x12')][_0x758a('0x37')]=function(_0x456429,_0x27b83d){this[_0x758a('0x10')][_0x758a('0x37')](_0x456429)[_0x758a('0x15')](function(_0x3dbc2f){_0x27b83d(null,_0x3dbc2f);})[_0x758a('0x16')](function(_0x28b34c){_0x27b83d(_0x28b34c);});};AGIVertices[_0x758a('0x12')][_0x758a('0x38')]=function(_0x3a7bca,_0x114fcb,_0x554f39){this[_0x758a('0x10')][_0x758a('0x38')]({'uniqueid':this['channel']['uniqueid'],'node':_0x3a7bca[_0x758a('0x39')],'application':_0x3a7bca['agicommand'],'data':_0x114fcb||null,'project_name':this['channel'][_0x758a('0x3a')],'callerid':this[_0x758a('0xf')]['callerid']})[_0x758a('0x15')](function(_0x4039e3){if(_0x554f39){_0x554f39(null,_0x4039e3);}})[_0x758a('0x16')](function(_0x21579f){if(_0x554f39){_0x554f39(_0x21579f);}});};AGIVertices[_0x758a('0x12')][_0x758a('0x3b')]=function(_0x210b5f,_0x2b5e53,_0x550002,_0x48fd7b){this[_0x758a('0x10')][_0x758a('0x3b')]({'uniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'callerid':this[_0x758a('0xf')][_0x758a('0x3d')],'calleridname':this[_0x758a('0xf')][_0x758a('0x3e')],'context':this[_0x758a('0xf')]['context'],'extension':this[_0x758a('0xf')]['extension'],'priority':this['channel'][_0x758a('0x3f')],'accountcode':this[_0x758a('0xf')]['accountcode'],'dnid':this[_0x758a('0xf')][_0x758a('0x40')],'projectName':this[_0x758a('0xf')][_0x758a('0x3a')],'saveName':_0x2b5e53,'filename':_0x210b5f[_0x758a('0x41')]||_0x2b5e53,'savePath':_0x550002})['then'](function(_0x3d867c){_0x48fd7b(null,_0x3d867c);})[_0x758a('0x16')](function(_0x1d7ff7){_0x48fd7b(_0x1d7ff7);});};AGIVertices[_0x758a('0x12')][_0x758a('0x42')]=function(_0x5df989,_0x312893,_0x502476,_0x27dd9e,_0x1d0c59){this[_0x758a('0x10')][_0x758a('0x42')]({'uniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'body':_0x5df989,'direction':_0x312893,'providerName':_0x502476,'providerResponse':_0x27dd9e})[_0x758a('0x15')](function(_0x3e8a6c){if(_0x1d0c59){_0x1d0c59(null,_0x3e8a6c);}})[_0x758a('0x16')](function(_0x4f52b9){if(_0x1d0c59){_0x1d0c59(_0x4f52b9);}});};AGIVertices[_0x758a('0x12')][_0x758a('0x43')]=function(_0x2e50a2,_0x181d03){this['rpc'][_0x758a('0x43')]({'firstName':_[_0x758a('0x44')](_0x2e50a2[_0x758a('0x1b')])||_[_0x758a('0x45')](_0x2e50a2[_0x758a('0x1b')])?'callback_'+Math['random']():_0x2e50a2['name'],'lastName':_[_0x758a('0x44')](_0x2e50a2[_0x758a('0x46')])||_[_0x758a('0x45')](_0x2e50a2['lastName'])?null:_0x2e50a2['lastName'],'phone':_0x2e50a2['phone'],'ListId':_0x2e50a2['list_id'],'scheduledat':_0x2e50a2[_0x758a('0x47')],'callbackUniqueid':this[_0x758a('0xf')][_0x758a('0x3c')],'tags':_0x758a('0x48'),'description':_0x758a('0x49')+_0x2e50a2[_0x758a('0x47')][_0x758a('0x4a')](),'priority':_0x2e50a2[_0x758a('0x4b')]})[_0x758a('0x15')](function(_0x12cd48){_0x181d03(null,_0x12cd48);})[_0x758a('0x16')](function(_0x1637c4){_0x181d03(_0x1637c4);});};AGIVertices['prototype']['getPause']=function(_0x20b8ba,_0x2e69b7){this[_0x758a('0x10')][_0x758a('0x4c')](_0x20b8ba)['then'](function(_0x152db5){_0x2e69b7(null,_0x152db5?_0x152db5[_0x758a('0x1b')]:![]);})[_0x758a('0x16')](function(_0x19101b){_0x2e69b7(_0x19101b);});};AGIVertices[_0x758a('0x12')][_0x758a('0x4d')]=function(_0x1275fb,_0x5009b8,_0x2f9e2){var _0xfb063={'role':_0x758a('0x4e')};_0xfb063[_0x1275fb]=this['channel'][_0x758a('0x3d')];this[_0x758a('0x10')][_0x758a('0x4d')](_0xfb063,_0x5009b8,this[_0x758a('0xf')][_0x758a('0x3c')])[_0x758a('0x15')](function(_0x11dae2){_0x2f9e2(null,_[_0x758a('0x45')](_0x11dae2)?![]:!![]);})[_0x758a('0x16')](function(_0x103507){logger['error'](_0x103507);_0x2f9e2(null,![]);});};AGIVertices[_0x758a('0x12')]['agentUnpause']=function(_0x319335,_0x5a41b1){var _0x39af7a={'role':_0x758a('0x4e')};_0x39af7a[_0x319335]=this['channel'][_0x758a('0x3d')];this[_0x758a('0x10')][_0x758a('0x4f')](_0x39af7a)[_0x758a('0x15')](function(_0x1e6059){_0x5a41b1(null,_[_0x758a('0x45')](_0x1e6059)?![]:!![]);})[_0x758a('0x16')](function(_0x112624){logger[_0x758a('0x30')](_0x112624);_0x5a41b1(null,![]);});};AGIVertices[_0x758a('0x12')][_0x758a('0x50')]=function(_0x5cc829,_0x11ca3b){var _0x846881={'role':_0x758a('0x4e')};_0x846881[_0x5cc829]=this[_0x758a('0xf')][_0x758a('0x3d')];this[_0x758a('0x10')]['agentLogout'](_0x846881)[_0x758a('0x15')](function(_0x22a9b3){_0x11ca3b(null,_['isNil'](_0x22a9b3)?![]:!![]);})[_0x758a('0x16')](function(_0xe9c69e){logger[_0x758a('0x30')](_0xe9c69e);_0x11ca3b(null,![]);});};AGIVertices['prototype'][_0x758a('0x51')]=function(_0x1f455f,_0x539cb5){var _0x559f70={'role':_0x758a('0x4e')};_0x559f70[_0x1f455f]=this[_0x758a('0xf')]['callerid'];var _0x2a8ea5=_0x1f455f!='internal'?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x758a('0xf')]['callerid']):undefined;this['rpc'][_0x758a('0x51')](_0x559f70,_0x2a8ea5)[_0x758a('0x15')](function(_0x383be2){_0x539cb5(null,_['isNil'](_0x383be2)?![]:!![]);})[_0x758a('0x16')](function(_0x4cc342){logger[_0x758a('0x30')](_0x4cc342);_0x539cb5(null,![]);});};AGIVertices['prototype'][_0x758a('0x52')]=function(_0x52a120,_0x54cd6a){sh[_0x758a('0x53')](_[_0x758a('0x54')](_0x52a120),function(_0x4eee62,_0x8460df){var _0x54b5a7=_0x8460df['replace'](/(\r\n|\n|\r)/gm,'');_0x54cd6a(null,_0x54b5a7);});};AGIVertices[_0x758a('0x12')][_0x758a('0x55')]=function(_0x27ebdf,_0x57bc7d){scripts[_0x758a('0x55')](_0x27ebdf[_0x758a('0x56')],_0x27ebdf[_0x758a('0x57')]||_0x758a('0x58'),_0x27ebdf[_0x758a('0x58')],_0x27ebdf['languageCode']||'en-US',_0x27ebdf[_0x758a('0x59')]||_0x758a('0x5a'),_0x27ebdf['audioEncoding']||'MP3')[_0x758a('0x15')](function(_0x844cee){_0x57bc7d(null,_0x844cee);})[_0x758a('0x16')](function(_0x2a1531){_0x57bc7d(_0x2a1531);});};AGIVertices['prototype'][_0x758a('0x5b')]=function(_0x2ec75a,_0xd2f9b1){scripts['googleTTS'](_0x2ec75a[_0x758a('0x58')],_0x2ec75a[_0x758a('0x5c')]||'en',0x1)[_0x758a('0x15')](function(_0x40ca6b){_0xd2f9b1(null,_0x40ca6b);})[_0x758a('0x16')](function(_0x47c7f8){_0xd2f9b1(_0x47c7f8);});};AGIVertices['prototype'][_0x758a('0x5d')]=function(_0x2a64b8,_0x426037){var _0x4a8c7f={'uri':_0x2a64b8[_0x758a('0x5e')],'method':_0x2a64b8[_0x758a('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2a64b8[_0x758a('0x60')])==='number'&&parseInt(_0x2a64b8[_0x758a('0x60')])>=0x1?parseInt(_0x2a64b8[_0x758a('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x758a('0x61')]([_0x758a('0x62'),_0x758a('0x63')],_0x4a8c7f['method'][_0x758a('0x64')]())){try{_0x4a8c7f[_0x758a('0x65')]=_0x2a64b8['rawBody']?JSON[_0x758a('0x66')](_0x2a64b8[_0x758a('0xc')]):{};}catch(_0x47d105){logger[_0x758a('0x30')](_0x758a('0x67'),_0x47d105);}}try{_0x4a8c7f['headers']=_0x2a64b8[_0x758a('0x68')]?JSON[_0x758a('0x66')](_0x2a64b8['rawHeaders']):{};}catch(_0x2f6336){logger['error'](_0x758a('0x69'),_0x2f6336);}if(_0x2a64b8[_0x758a('0x6a')]){try{var _0x363c24=require(_0x2a64b8[_0x758a('0x6a')])[_0x758a('0x6b')](this,_0x4a8c7f);_0x4a8c7f[_0x758a('0x6c')]=Mustache['render'](_0x2a64b8[_0x758a('0x5e')],_0x363c24,{},['$$','$$']);if(_0x4a8c7f[_0x758a('0x6d')]){_0x4a8c7f[_0x758a('0x6d')]=JSON[_0x758a('0x66')](Mustache[_0x758a('0x6e')](JSON[_0x758a('0x6f')](_0x4a8c7f[_0x758a('0x6d')]),_0x363c24,{},['$$','$$']));}if(_0x4a8c7f[_0x758a('0x65')]){_0x4a8c7f['body']=JSON[_0x758a('0x66')](Mustache['render'](JSON['stringify'](_0x4a8c7f['body']),_0x363c24,{},['$$','$$']));}}catch(_0x48f33e){logger[_0x758a('0x30')](_0x758a('0x70'),_0x48f33e);}}rp(_0x4a8c7f)[_0x758a('0x15')](function(_0x4812aa){var _0x28caba={'statusCode':_0x4812aa['statusCode']||0xc8,'statusMessage':_0x4812aa[_0x758a('0x71')]||'OK','headers':_0x4812aa[_0x758a('0x6d')]||{},'body':_0x4812aa[_0x758a('0x65')]||{}};_0x426037(null,_0x28caba);})[_0x758a('0x16')](function(_0xb7c2f4){var _0x3d2da5={'statusCode':_0xb7c2f4[_0x758a('0x72')]||0x1f4,'statusMessage':_0xb7c2f4['message']||_0x758a('0x73'),'headers':_0xb7c2f4[_0x758a('0x74')]['headers']||{},'body':_0xb7c2f4[_0x758a('0x74')][_0x758a('0x65')]||{}};_0x426037(null,_0x3d2da5);});};AGIVertices[_0x758a('0x12')][_0x758a('0x75')]=function(_0xc6a643,_0xa78b0b){scripts[_0x758a('0x75')](this[_0x758a('0xf')]['uniqueid'],_0xc6a643[_0x758a('0x76')],_0xc6a643[_0x758a('0x58')],_0xc6a643[_0x758a('0x77')]||'en')[_0x758a('0x15')](function(_0x2db9aa){_0xa78b0b(null,_0x2db9aa);})[_0x758a('0x16')](function(_0x1fd030){_0xa78b0b(_0x1fd030);});};AGIVertices['prototype'][_0x758a('0x78')]=function(_0x2dfb94,_0x2a231d){scripts[_0x758a('0x78')](this['channel'][_0x758a('0x3c')],_0x2dfb94[_0x758a('0x79')],_0x2dfb94[_0x758a('0x7a')],_0x2dfb94[_0x758a('0x7b')],_0x2dfb94['text'],_0x2dfb94[_0x758a('0x7c')]||'en')[_0x758a('0x15')](function(_0x13caea){_0x2a231d(null,_0x13caea);})[_0x758a('0x16')](function(_0x4f0fbb){_0x2a231d(_0x4f0fbb);});};AGIVertices['prototype'][_0x758a('0x7d')]=function(_0x2e3855,_0x540276){scripts[_0x758a('0x7d')](this[_0x758a('0xf')],_0x2e3855)[_0x758a('0x15')](function(_0x3115c6){_0x540276(null,_0x3115c6);})[_0x758a('0x16')](function(_0x3f328b){_0x540276(_0x3f328b);});};AGIVertices[_0x758a('0x12')][_0x758a('0x7e')]=function(_0x31d166,_0x476807){scripts[_0x758a('0x7e')](_0x31d166['key'],_0x31d166[_0x758a('0x58')],_0x31d166[_0x758a('0x7f')]||_0x758a('0x80'),_0x31d166[_0x758a('0x81')])[_0x758a('0x15')](function(_0x475c75){_0x476807(null,_0x475c75);})[_0x758a('0x16')](function(_0x5e3642){_0x476807(_0x5e3642);});};AGIVertices[_0x758a('0x12')][_0x758a('0x82')]=function(_0x4f9c67,_0x25958f,_0x3ee78b){scripts[_0x758a('0x82')](_0x25958f,_0x4f9c67[_0x758a('0x76')],_0x4f9c67[_0x758a('0x83')]||'en-US',this[_0x758a('0x84')](_0x4f9c67[_0x758a('0x85')])?_0x4f9c67[_0x758a('0x85')]:undefined)[_0x758a('0x15')](function(_0x5588bf){_0x3ee78b(null,_0x5588bf);})[_0x758a('0x16')](function(_0x4c90dc){_0x3ee78b(_0x4c90dc);});};AGIVertices['prototype']['awsPolly']=function(_0x2ad855,_0x3c9dcf){scripts[_0x758a('0x86')](_0x2ad855[_0x758a('0x87')],_0x2ad855[_0x758a('0x88')],_0x2ad855[_0x758a('0x89')],_0x2ad855[_0x758a('0x8a')]||_0x758a('0x8b'),_0x2ad855[_0x758a('0x58')],_0x2ad855[_0x758a('0x8c')]||'text')['then'](function(_0x52fcac){_0x3c9dcf(null,_0x52fcac);})[_0x758a('0x16')](function(_0x2c9cf6){_0x3c9dcf(_0x2c9cf6);});};AGIVertices['prototype'][_0x758a('0x8d')]=function(_0x119c3b,_0xccc19e){scripts['awsLex'](this[_0x758a('0xf')][_0x758a('0x3c')],_0x119c3b[_0x758a('0x87')],_0x119c3b[_0x758a('0x88')],_0x119c3b[_0x758a('0x8e')],_0x119c3b[_0x758a('0x58')],_0x119c3b[_0x758a('0x8f')])['then'](function(_0x463d3e){_0xccc19e(null,_0x463d3e);})['catch'](function(_0x41221f){_0xccc19e(_0x41221f);});};AGIVertices[_0x758a('0x12')][_0x758a('0x90')]=function(_0x1da3fe,_0x4b4b41,_0x29be79){scripts[_0x758a('0x90')](_0x4b4b41,_0x1da3fe[_0x758a('0x76')],_0x1da3fe[_0x758a('0x91')]||_0x758a('0x80'))[_0x758a('0x15')](function(_0x39a40d){_0x29be79(null,_0x39a40d);})[_0x758a('0x16')](function(_0x1385a3){_0x29be79(_0x1385a3);});};AGIVertices[_0x758a('0x12')][_0x758a('0x92')]=function(_0x261d2d,_0x5ba616,_0x1a15e3){scripts['tildeASR'](_0x5ba616,_0x261d2d[_0x758a('0x93')],_0x261d2d['appsecret'],_0x261d2d[_0x758a('0x6c')])[_0x758a('0x15')](function(_0x3a1bb0){_0x1a15e3(null,_0x3a1bb0);})[_0x758a('0x16')](function(_0x3412b8){_0x1a15e3(_0x3412b8);});};AGIVertices[_0x758a('0x12')][_0x758a('0x94')]=function(_0x530db7){var _0x584eaa=_['includes'](verticesWithRetry,_0x530db7['agicommand'])?_0x530db7:_[_0x758a('0x95')](_0x530db7);for(var _0x37e4e2 in _0x584eaa){if(_0x584eaa['hasOwnProperty'](_0x37e4e2)){if(_0x584eaa[_0x37e4e2]&&_[_0x758a('0x96')](_0x584eaa[_0x37e4e2])){if(_[_0x758a('0x61')](recursiveMapAttributes,_0x37e4e2)){_0x584eaa[_0x37e4e2]=this[_0x758a('0x97')](_0x584eaa[_0x37e4e2]);}else{_0x584eaa[_0x37e4e2]=this[_0x758a('0x98')](_0x584eaa[_0x37e4e2]);}}}}return _0x584eaa;};AGIVertices[_0x758a('0x12')][_0x758a('0x99')]=function(_0x560e54){for(var _0xeff6fc in _0x560e54){if(_0x560e54['hasOwnProperty'](_0xeff6fc)){if(_[_0x758a('0x9a')](_0x560e54[_0xeff6fc])){this[_0x758a('0x99')](_0x560e54[_0xeff6fc]);}else if(_['isArray'](_0x560e54[_0xeff6fc])){for(var _0x25a8af=0x0;_0x25a8af<_0x560e54[_0xeff6fc]['length'];_0x25a8af++){this[_0x758a('0x99')](_0x560e54[_0xeff6fc][_0x25a8af]);}}else if(_[_0x758a('0x96')](_0x560e54[_0xeff6fc])){_0x560e54[_0xeff6fc]=this['replaceAllVariables'](_0x560e54[_0xeff6fc]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x74c1e4,_0x10fbf3){for(var _0x2dd69c in _0x74c1e4){if(_0x74c1e4[_0x758a('0x9b')](_0x2dd69c)){if(_[_0x758a('0x9a')](_0x74c1e4[_0x2dd69c])){if(!_[_0x758a('0x44')](_0x74c1e4[_0x2dd69c])){this['saveRestApiResult'](_0x74c1e4[_0x2dd69c],util[_0x758a('0x2c')](_0x758a('0x9c'),_0x10fbf3,_0x2dd69c));}}else if(_[_0x758a('0x9d')](_0x74c1e4[_0x2dd69c])){for(var _0x5591c9=0x0;_0x5591c9<_0x74c1e4[_0x2dd69c][_0x758a('0x9e')];_0x5591c9++){this[_0x758a('0x9f')](_0x74c1e4[_0x2dd69c][_0x5591c9],util[_0x758a('0x2c')]('%s.%s',_0x10fbf3,_0x2dd69c+'['+_0x5591c9+']'));}}else{if(!_[_0x758a('0x45')](_0x74c1e4[_0x2dd69c])){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x9c'),_0x10fbf3,_0x2dd69c),_0x74c1e4[_0x2dd69c]);}}}}};AGIVertices[_0x758a('0x12')][_0x758a('0x97')]=function(_0xa6b13a){try{var _0x6cb717=JSON[_0x758a('0x66')](_0xa6b13a);this[_0x758a('0x99')](_0x6cb717);return JSON[_0x758a('0x6f')](_0x6cb717);}catch(_0x1face4){return this[_0x758a('0x98')](_0xa6b13a);}};AGIVertices[_0x758a('0x12')][_0x758a('0x98')]=function(_0x59f56b){var _0x5908a6=_0x59f56b[_0x758a('0xa1')]('{');for(var _0x2cafc3=0x1;_0x2cafc3<_0x5908a6[_0x758a('0x9e')];_0x2cafc3+=0x1){var _0x1c5ba0=_0x5908a6[_0x2cafc3][_0x758a('0xa1')]('}');if(_0x1c5ba0[_0x758a('0x9e')]>0x1){_0x59f56b=_0x59f56b[_0x758a('0xa2')]('{'+_0x1c5ba0[0x0]+'}',this[_0x758a('0xf')][_0x758a('0x13')](_0x1c5ba0[0x0])['extra']||_0x1c5ba0[0x0]);}}if(_0x5908a6[_0x758a('0x9e')]===0x1){return _0x59f56b[_0x758a('0x4a')]();}return this[_0x758a('0x98')](_0x59f56b);};AGIVertices[_0x758a('0x12')][_0x758a('0xa3')]=function(_0x250e28,_0x18d8dd){var _0x524ee4=this[_0x758a('0xf')]['getVariable'](_0x250e28);if(_0x524ee4[_0x758a('0xa4')]===-0x1){return _0x524ee4;}logger['info'](util[_0x758a('0x2c')](_0x758a('0xa5'),_0x18d8dd,_0x524ee4[_0x758a('0xa6')]));return this[_0x758a('0xf')][_0x758a('0xa0')](_0x18d8dd,_0x524ee4[_0x758a('0xa6')]);};AGIVertices[_0x758a('0x12')]['isConfigured']=function(_0x542f10){return _0x542f10&&_0x542f10!=='0'&&_0x542f10!=='-1'&&_0x542f10!=='';};AGIVertices[_0x758a('0x12')][_0x758a('0xa7')]=function(_0x5e3ce1){this['createSquareDetailsReport']['sync'](this,_0x5e3ce1,'-');_0x5e3ce1[_0x758a('0xa8')]=_0x5e3ce1['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x758a('0x12')]['mrcpsynth']=function(_0x4479c4){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4479c4[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4479c4[_0x758a('0x58')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xa9'));}var _0x179d32='\x22'+_0x4479c4[_0x758a('0x58')]+'\x22';if(this['isConfigured'](_0x4479c4[_0x758a('0x74')])){_0x179d32+=','+_0x4479c4[_0x758a('0x74')];}var _0x49109e=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaa'),_0x179d32);if(_0x49109e[_0x758a('0xa4')]===-0x1){return _0x49109e;}return this['channel']['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x179d32));};AGIVertices[_0x758a('0x12')][_0x758a('0xab')]=function(_0x5ccc56){logger['info'](util[_0x758a('0x2c')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5ccc56[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x5ccc56[_0x758a('0xac')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xae'));}var _0x340360=_0x5ccc56[_0x758a('0xac')];if(this['isConfigured'](_0x5ccc56['options'])){_0x340360+=','+_0x5ccc56['options'];}var _0x3faf98=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x340360);if(_0x3faf98[_0x758a('0xa4')]===-0x1){return _0x3faf98;}var _0x3cfd8f=this[_0x758a('0xa3')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x3cfd8f['result']===-0x1){return _0x3cfd8f;}var _0x2661f5=this['getAndSetVariable'](_0x758a('0xb0'),_0x758a('0xb1'));if(_0x2661f5[_0x758a('0xa4')]===-0x1){return _0x2661f5;}var _0x1a209c=this['getAndSetVariable'](_0x758a('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x1a209c['result']===-0x1){return _0x1a209c;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xb3'),_0x340360));};AGIVertices[_0x758a('0x12')]['agi']=function(_0x39e634){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb4'),_0x39e634[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x8')]([_0x39e634[_0x758a('0xb5')],_0x39e634['args']]);};AGIVertices[_0x758a('0x12')][_0x758a('0xb6')]=function(_0x291525){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb7'),_0x291525[_0x758a('0x39')]));if(this['isConfigured'](_0x291525[_0x758a('0x60')])){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xb8'),_0x291525[_0x758a('0x60')]));var _0x18ed75=this[_0x758a('0xf')][_0x758a('0xb9')](_0x291525['timeout']);if(_0x18ed75[_0x758a('0xa4')]===-0x1){return _0x18ed75;}}return this[_0x758a('0xf')]['answer']();};AGIVertices[_0x758a('0x12')][_0x758a('0x48')]=function(_0x56496e){logger[_0x758a('0x32')](util['format'](_0x758a('0xba'),_0x56496e[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x56496e[_0x758a('0xbb')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x56496e,'no\x20list\x20selected');}_0x56496e['scheduledAt']=moment();if(this[_0x758a('0x84')](_0x56496e[_0x758a('0xbc')])){_0x56496e['scheduledAt']=moment()[_0x758a('0xbd')](_0x56496e[_0x758a('0xbc')],_0x758a('0xbe'));}if(!this[_0x758a('0x84')](_0x56496e['callback_priority'])){_0x56496e[_0x758a('0x4b')]=0x2;}this[_0x758a('0x43')]['sync'](this,_0x56496e);return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xbf'),_0x56496e['phone'],_0x56496e[_0x758a('0xbb')],_0x56496e[_0x758a('0x47')]));};AGIVertices[_0x758a('0x12')][_0x758a('0xc0')]=function(_0x463176){logger[_0x758a('0x32')](util['format'](_0x758a('0xc1'),_0x463176['label']));var _0x453ac7=this[_0x758a('0xf')][_0x758a('0x53')](_0x463176['application'],_0x463176[_0x758a('0x74')]);if(_0x453ac7[_0x758a('0xa4')]===-0x1){return _0x453ac7;}return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0xc2'),_0x463176[_0x758a('0xc3')],_0x463176[_0x758a('0x74')]));};AGIVertices['prototype'][_0x758a('0xc4')]=function(_0x368b5d){logger['info'](util[_0x758a('0x2c')](_0x758a('0xc5'),_0x368b5d[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x368b5d[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}var _0x241bd5='\x22'+_0x368b5d[_0x758a('0x58')]+'\x22';if(this[_0x758a('0x84')](_0x368b5d['options'])){_0x241bd5+=','+_0x368b5d[_0x758a('0x74')];}var _0x4dfac5=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaa'),_0x241bd5);if(_0x4dfac5[_0x758a('0xa4')]===-0x1){return _0x4dfac5;}return this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x241bd5));};AGIVertices[_0x758a('0x12')]['sestektts']=function(_0x327f62){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xc6'),_0x327f62[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x327f62[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20text\x20configured');}var _0x194fd0='\x22'+_0x327f62[_0x758a('0x58')]+'\x22';if(this[_0x758a('0x84')](_0x327f62[_0x758a('0x74')])){_0x194fd0+=','+_0x327f62[_0x758a('0x74')];}var _0x56ea16=this['channel']['exec'](_0x758a('0xaa'),_0x194fd0);if(_0x56ea16[_0x758a('0xa4')]===-0x1){return _0x56ea16;}return this['channel'][_0x758a('0xad')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x194fd0));};AGIVertices[_0x758a('0x12')]['lumenvoxasr']=function(_0x3e0d84){logger[_0x758a('0x32')](util['format'](_0x758a('0xc7'),_0x3e0d84[_0x758a('0x39')]));if(!this['isConfigured'](_0x3e0d84['grammar'])){return this[_0x758a('0xf')]['noop']('no\x20grammar\x20configured');}var _0x4844d1=_0x3e0d84[_0x758a('0xac')];if(this['isConfigured'](_0x3e0d84[_0x758a('0x74')])){_0x4844d1+=','+_0x3e0d84['options'];}var _0x192096=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x4844d1);if(_0x192096['result']===-0x1){return _0x192096;}var _0x4f6f84=this[_0x758a('0xa3')](_0x758a('0xc8'),_0x758a('0xc9'));if(_0x4f6f84['result']===-0x1){return _0x4f6f84;}var _0x22db2a=this[_0x758a('0xa3')](_0x758a('0xb0'),_0x758a('0xca'));if(_0x22db2a[_0x758a('0xa4')]===-0x1){return _0x22db2a;}var _0x1d5ed0=this['getAndSetVariable'](_0x758a('0xb2'),_0x758a('0xcb'));if(_0x1d5ed0[_0x758a('0xa4')]===-0x1){return _0x1d5ed0;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xb3'),_0x4844d1));};AGIVertices[_0x758a('0x12')]['sestekasr']=function(_0x22af83){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xcc'),_0x22af83[_0x758a('0x39')]));if(!this['isConfigured'](_0x22af83['grammar'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xae'));}var _0x3451f3=_0x22af83[_0x758a('0xac')];if(this[_0x758a('0x84')](_0x22af83[_0x758a('0x74')])){_0x3451f3+=','+_0x22af83[_0x758a('0x74')];}var _0x36a18d=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xaf'),_0x3451f3);if(_0x36a18d[_0x758a('0xa4')]===-0x1){return _0x36a18d;}var _0x18e521=this[_0x758a('0xa3')]('RECOG_CONFIDENCE()',_0x758a('0xcd'));if(_0x18e521[_0x758a('0xa4')]===-0x1){return _0x18e521;}var _0xaa7a3d=this['getAndSetVariable'](_0x758a('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0xaa7a3d[_0x758a('0xa4')]===-0x1){return _0xaa7a3d;}var _0x14cb83=this[_0x758a('0xa3')](_0x758a('0xb2'),_0x758a('0xce'));if(_0x14cb83[_0x758a('0xa4')]===-0x1){return _0x14cb83;}return this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3451f3));};AGIVertices['prototype'][_0x758a('0xcf')]=function(_0x4f9d3d){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xd0'),_0x4f9d3d['label']));if(!this['isConfigured'](_0x4f9d3d['odbc_id'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,_0x758a('0xd1'));}var _0x4d3348=this[_0x758a('0x1c')][_0x758a('0x6b')](this,_0x4f9d3d[_0x758a('0xd2')]);if(!_0x4d3348){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,_0x758a('0xd3'));}if(!this['isConfigured'](_0x4f9d3d['query'])){return this[_0x758a('0xf')]['error'](_0x4f9d3d,_0x758a('0xd4'));}var _0x24bce6=_0x4f9d3d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd5'),_0x24bce6));var _0x3256d8=this['getQueryOdbc'][_0x758a('0x6b')](this,_0x4d3348,_0x24bce6);this[_0x758a('0x38')]['sync'](this,_0x4f9d3d,_0x24bce6);if(!this[_0x758a('0x84')](_0x4f9d3d[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x41a595=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x4f9d3d['variable_id']);if(!_0x41a595){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4f9d3d,'no\x20variable\x20found');}var _0x55c54=this;_0x3256d8[_0x758a('0xd7')](function(_0x289200,_0x874bce){Object[_0x758a('0xd8')](_0x289200)[_0x758a('0xd7')](function(_0x1dfadb){_0x55c54['channel']['setVariable'](util[_0x758a('0x2c')]('%s[%s][%s]',_0x41a595,_0x874bce,_0x1dfadb),_0x289200[_0x1dfadb]);});});this['channel'][_0x758a('0xa0')](util['format']('%s_ROWS_COUNT',_0x41a595),_0x3256d8[_0x758a('0x9e')]);return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd9'),_0x41a595));};AGIVertices['prototype'][_0x758a('0xda')]=function(_0x50c11d){logger[_0x758a('0xdb')](util[_0x758a('0x2c')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x50c11d[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x50c11d[_0x758a('0xdc')])){return this[_0x758a('0xf')]['error'](_0x50c11d,'no\x20user\x20selected');}var _0x25018f=this[_0x758a('0x1f')]['sync'](this,_0x50c11d[_0x758a('0xdc')]);if(!_0x25018f){return this[_0x758a('0xf')][_0x758a('0x30')](_0x50c11d,_0x758a('0xdd'));}var _0x68bbf=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xde'),[util['format'](_0x758a('0xdf'),_0x25018f),_0x50c11d[_0x758a('0x60')],_0x50c11d[_0x758a('0xe0')],_0x50c11d[_0x758a('0x5e')]]);if(_0x68bbf['result']===-0x1){return _0x68bbf;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Executed\x20command\x20%s',_0x758a('0xde')));};AGIVertices[_0x758a('0x12')][_0x758a('0xe1')]=function(_0x4989ed){logger[_0x758a('0x32')](util['format'](_0x758a('0xe2'),_0x4989ed[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4989ed[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}if(!this[_0x758a('0x84')](_0x4989ed[_0x758a('0x58')])){return this['channel'][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xe4')]=!![];this[_0x758a('0x38')](_0x4989ed);this[_0x758a('0x42')](_0x4989ed[_0x758a('0x58')],'in','','');this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0xe5'),_0x4989ed[_0x758a('0x58')]));var _0x3cc36d=this[_0x758a('0x75')][_0x758a('0x6b')](this,_0x4989ed);if(_0x3cc36d){for(var _0x1912a1 in _0x3cc36d){if(_0x3cc36d[_0x758a('0x9b')](_0x1912a1)){this[_0x758a('0xf')]['setVariable'](util[_0x758a('0x2c')]('DIALOGFLOW_%s',_0x1912a1[_0x758a('0x64')]()),_0x3cc36d[_0x1912a1]);}}this[_0x758a('0x42')](_0x3cc36d[_0x758a('0xe6')],_0x758a('0xe7'),_0x758a('0xe1'),'');return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0xe8'),_0x3cc36d['speech']));}return this[_0x758a('0xf')]['error'](_0x4989ed,_0x758a('0xe9'));};AGIVertices['prototype'][_0x758a('0xea')]=function(_0x3cc974){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3cc974[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x3cc974['dialogflowV2_project_id'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xeb'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7a')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xec'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7b')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xed'));}if(!this[_0x758a('0x84')](_0x3cc974[_0x758a('0x7c')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x3cc974[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this['channel']['bot']=!![];this[_0x758a('0x38')](_0x3cc974);this[_0x758a('0x42')](_0x3cc974[_0x758a('0x58')],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x3cc974['text']));var _0x5a8313=this[_0x758a('0x78')][_0x758a('0x6b')](this,_0x3cc974);if(_0x5a8313){for(var _0x278477 in _0x5a8313){if(_0x5a8313[_0x758a('0x9b')](_0x278477)){if(_0x278477!==_0x758a('0xee')){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0xef'),_0x278477[_0x758a('0x64')]()),_0x5a8313[_0x278477]);}}}this['createSquareMessage'](_0x5a8313[_0x758a('0xe6')],_0x758a('0xe7'),'dialogflowV2',_0x5a8313[_0x758a('0xee')]);return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xf0'),_0x5a8313[_0x758a('0xe6')]));}return this[_0x758a('0xf')][_0x758a('0x30')](_0x3cc974,_0x758a('0xf1'));};AGIVertices[_0x758a('0x12')][_0x758a('0xf2')]=function(_0x51cbd4){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0xf3'),_0x51cbd4[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x51cbd4['ndauth_url'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xf4'));}if(!this[_0x758a('0x84')](_0x51cbd4[_0x758a('0xf5')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xf6'));}if(!this['isConfigured'](_0x51cbd4[_0x758a('0xf7')])){return this[_0x758a('0xf')]['noop']('no\x20password\x20configured');}if(!this[_0x758a('0x84')](_0x51cbd4[_0x758a('0xf8')])){return this[_0x758a('0xf')]['noop'](_0x758a('0xa9'));}this['channel'][_0x758a('0xe4')]=!![];this['createSquareDetailsReport'](_0x51cbd4);this[_0x758a('0x42')](_0x51cbd4['text'],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0xf9'),_0x51cbd4['text']));var _0x5b3db2=this['sestekNDA'][_0x758a('0x6b')](this,_0x51cbd4);if(_0x5b3db2){for(var _0x4c30e1 in _0x5b3db2){if(_0x5b3db2[_0x758a('0x9b')](_0x4c30e1)){this['channel'][_0x758a('0xa0')](util[_0x758a('0x2c')]('SESTEK_NDA_%s',_0x4c30e1[_0x758a('0x64')]()),_0x5b3db2[_0x4c30e1]);}}this[_0x758a('0x42')](_0x5b3db2[_0x758a('0xe6')],_0x758a('0xe7'),'sesteknda','');if(_0x5b3db2['audiofile']){this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xfa'),_0x5b3db2['audiofile']));var _0x905fa9=this[_0x758a('0xf')]['streamFile'](_0x5b3db2[_0x758a('0xfb')]);try{fs[_0x758a('0xfc')](_0x5b3db2[_0x758a('0xfb')]+_0x758a('0xfd'));}catch(_0x121128){logger['error'](_0x121128);}return _0x905fa9;}else{return this['channel']['noop'](util['format'](_0x758a('0xfe'),_0x5b3db2[_0x758a('0xe6')]));}}return this[_0x758a('0xf')][_0x758a('0x30')](_0x51cbd4,_0x758a('0xff'));};AGIVertices[_0x758a('0x12')][_0x758a('0x100')]=function(_0x411db7){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x101'),_0x411db7['label']));return this[_0x758a('0xf')]['noop'](_0x758a('0x100'));};AGIVertices[_0x758a('0x12')][_0x758a('0x102')]=function(_0x41495f){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x103'),_0x41495f['label']));var _0x8eb625='';if(_0x41495f[_0x758a('0x104')]){if(!this[_0x758a('0x84')](_0x41495f[_0x758a('0x104')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x41495f,_0x758a('0x105'));}else{var _0xc6940b=parseInt(_0x41495f[_0x758a('0x104')],0xa);if(isNaN(_0xc6940b)){_0x8eb625=_0x41495f[_0x758a('0x104')];}else{_0x8eb625=this[_0x758a('0x21')][_0x758a('0x6b')](this,_0x41495f[_0x758a('0x104')]);if(!_0x8eb625){return this[_0x758a('0xf')][_0x758a('0x30')](_0x41495f,_0x758a('0x106'));}}}}else if(_0x41495f[_0x758a('0x107')]){_0x8eb625=_0x41495f[_0x758a('0x107')];}else{return this['channel'][_0x758a('0x30')](_0x41495f,_0x758a('0x105'));}var _0x39a8dd=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0xde'),[util[_0x758a('0x2c')](_0x758a('0x108'),_0x8eb625,_0x41495f[_0x758a('0x109')]),_0x41495f['timeout'],_0x41495f[_0x758a('0xe0')],_0x41495f[_0x758a('0x5e')]]);if(_0x39a8dd[_0x758a('0xa4')]===-0x1){return _0x39a8dd;}return this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0x10a'),_0x758a('0xde')));};AGIVertices[_0x758a('0x12')][_0x758a('0x10b')]=function(_0x43945e){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x10c'),_0x43945e[_0x758a('0x39')]));return this['channel'][_0x758a('0xad')](_0x758a('0x10b'));};AGIVertices[_0x758a('0x12')][_0x758a('0xd')]=function(_0xde5f76){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x10d'),_0xde5f76[_0x758a('0x39')]));if(_0xde5f76['retry']===0x0){return this['maxRetry'](_0xde5f76);}_0xde5f76[_0x758a('0xa8')]-=0x1;if(!this[_0x758a('0x84')](_0xde5f76[_0x758a('0x10e')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0xde5f76,_0x758a('0x10f'));}var _0x2fdad7=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0xde5f76['file_id']);if(!_0x2fdad7){return this[_0x758a('0xf')][_0x758a('0x30')](_0xde5f76,'no\x20file\x20audio\x20found');}if(!this['isConfigured'](_0xde5f76['variable_id'])){return this[_0x758a('0xf')][_0x758a('0x30')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x203fbb=this[_0x758a('0xf')]['getData'](_0x2fdad7,_0xde5f76['response'],_0xde5f76[_0x758a('0x111')]);var _0x4158b4=_0x203fbb['result']?_0x203fbb['result'][_0x758a('0x4a')]():'';logger[_0x758a('0x32')](_0x758a('0x112'),JSON[_0x758a('0x6f')](_0x203fbb));if(_0x203fbb[_0x758a('0xa4')]===-0x1){this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0x4158b4);return _0x203fbb;}else if(_0x203fbb[_0x758a('0xa6')]==='timeout'){_0x203fbb['result']=_0x4158b4[_0x758a('0x9e')]>=parseInt(_0xde5f76[_0x758a('0x113')])?'x':'i';}else{_0x203fbb[_0x758a('0xa4')]=_0x4158b4[_0x758a('0x9e')]>=parseInt(_0xde5f76[_0x758a('0x113')])&&_0x4158b4[_0x758a('0x9e')]<=parseInt(_0xde5f76['maxdigit'])?'x':'i';}var _0x33b97c=this['getVariable'][_0x758a('0x6b')](this,_0xde5f76[_0x758a('0xd6')]);if(!_0x33b97c){return this['channel'][_0x758a('0x30')](_0xde5f76,_0x758a('0x114'));}this[_0x758a('0xf')]['setVariable'](_0x33b97c,_0x4158b4);if(this[_0x758a('0x84')](_0xde5f76['hiddendigitsnum'])){var _0x3a6550=parseInt(_0xde5f76[_0x758a('0x115')],0xa);var _0x379f91=rs[_0x758a('0x116')]({'charset':'*','length':_0x3a6550});var _0xc28470=_0x4158b4[_0x758a('0x9e')];if(_0xc28470>0x0){if(_0xc28470>_0x3a6550){this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0xde5f76['hiddendigitspos']===_0x758a('0x117')?_0x379f91+_0x4158b4[_0x758a('0x118')](_0x3a6550):_0x4158b4[_0x758a('0x118')](0x0,_0xc28470-_0x3a6550)+_0x379f91);}else{this[_0x758a('0x38')]['sync'](this,_0xde5f76,rs[_0x758a('0x116')]({'charset':'*','length':_0xc28470}));}}else{this['createSquareDetailsReport'][_0x758a('0x6b')](this,_0xde5f76,'');}}else{this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xde5f76,_0x4158b4);}return _0x203fbb;};AGIVertices[_0x758a('0x12')][_0x758a('0xe')]=function(_0x20bd16){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x119'),_0x20bd16[_0x758a('0x39')]));return this[_0x758a('0xd')](_0x20bd16);};AGIVertices[_0x758a('0x12')][_0x758a('0x11a')]=function(_0x43e7b2){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x11b'),_0x43e7b2[_0x758a('0x39')]));this[_0x758a('0x38')]['sync'](this,_0x43e7b2,_0x43e7b2['goalname']);return this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x11c'),_0x43e7b2[_0x758a('0x11d')]));};AGIVertices[_0x758a('0x12')]['awspolly']=function(_0x50cae8){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x50cae8[_0x758a('0x39')]));if(!this['isConfigured'](_0x50cae8[_0x758a('0x87')])||!this[_0x758a('0x84')](_0x50cae8[_0x758a('0x88')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x11e'));}if(!this['isConfigured'](_0x50cae8[_0x758a('0x58')])){return this['channel'][_0x758a('0xad')](_0x758a('0xa9'));}this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x11f'),_0x50cae8[_0x758a('0x58')]));var _0x4d9275=this[_0x758a('0x86')][_0x758a('0x6b')](this,_0x50cae8);if(_0x4d9275){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x4d9275));var _0x20f8a7=this[_0x758a('0xf')]['streamFile'](_0x4d9275);try{fs[_0x758a('0xfc')](_0x4d9275+_0x758a('0xfd'));}catch(_0x1e6716){logger[_0x758a('0x30')](_0x1e6716);}return _0x20f8a7;}return this[_0x758a('0xf')][_0x758a('0x30')](_0x50cae8,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x758a('0x12')][_0x758a('0x120')]=function(_0x4b87d3){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x4b87d3[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x4b87d3['aws_access_key_id'])||!this['isConfigured'](_0x4b87d3[_0x758a('0x88')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x11e'));}if(!this[_0x758a('0x84')](_0x4b87d3[_0x758a('0x8f')])){return this['channel'][_0x758a('0xad')](_0x758a('0x121'));}if(!this[_0x758a('0x84')](_0x4b87d3[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this['channel']['bot']=!![];this[_0x758a('0x38')](_0x4b87d3);this[_0x758a('0x42')](_0x4b87d3[_0x758a('0x58')],'in','','');this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x122'),_0x4b87d3['text']));var _0x1c0f0a=this[_0x758a('0x8d')][_0x758a('0x6b')](this,_0x4b87d3);if(_0x1c0f0a){for(var _0x3eb781 in _0x1c0f0a){if(_0x1c0f0a[_0x758a('0x9b')](_0x3eb781)&&_['isString'](_0x1c0f0a[_0x3eb781])){this['channel']['setVariable'](util['format'](_0x758a('0x123'),_0x3eb781[_0x758a('0x64')]()),_0x1c0f0a[_0x3eb781]);}}if(_[_0x758a('0x45')](_0x1c0f0a[_0x758a('0x124')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x125'));}else{this[_0x758a('0x42')](_0x1c0f0a[_0x758a('0x124')],_0x758a('0xe7'),_0x758a('0x126'),'');return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Amazon\x20Lex\x20Result\x20%s',_0x1c0f0a['message']));}}return this[_0x758a('0xf')]['error'](_0x4b87d3,_0x758a('0x127'));};AGIVertices['prototype'][_0x758a('0x128')]=function(_0x4ac9e5){logger[_0x758a('0x32')](util['format'](_0x758a('0x129'),_0x4ac9e5['label'],_0x4ac9e5[_0x758a('0x60')]));if(!this['isConfigured'](_0x4ac9e5[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}var _0x1e1913=_0x758a('0x12a');var _0x55f402=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x758a('0x116')](0x4));var _0x264b42=util[_0x758a('0x2c')](_0x758a('0x9c'),_0x55f402,_0x1e1913);var _0x526d4a=!![];if(_0x4ac9e5['beep']===_0x758a('0x12b')){_0x526d4a=![];}var _0x1efd7c=this[_0x758a('0xf')][_0x758a('0x12c')](_0x55f402,_0x1e1913,_0x4ac9e5['intKey'],_0x4ac9e5[_0x758a('0x60')],undefined,_0x526d4a);if(_0x1efd7c[_0x758a('0xa4')]!==-0x1){this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x12d'),_0x264b42));var _0x37ccc1=this[_0x758a('0x90')][_0x758a('0x6b')](this,_0x4ac9e5,_0x264b42);if(_0x37ccc1){for(var _0x54b5ad in _0x37ccc1){if(_0x37ccc1[_0x758a('0x9b')](_0x54b5ad)){this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x12e'),_0x54b5ad['toUpperCase']()),_0x37ccc1[_0x54b5ad]);}}return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x12f'),JSON[_0x758a('0x6f')](_0x37ccc1)));}}return _0x1efd7c;};AGIVertices[_0x758a('0x12')]['tildeasr']=function(_0x5f2a1e){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x130'),_0x5f2a1e['label']));if(!this[_0x758a('0x84')](_0x5f2a1e['appid'])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20appid\x20configured');}if(!this[_0x758a('0x84')](_0x5f2a1e['appsecret'])){return this[_0x758a('0xf')]['noop']('no\x20appsecret\x20configured');}var _0x1d376d=_0x758a('0x12a');var _0x3b1df5=util[_0x758a('0x2c')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2c8db1=util['format']('%s.%s',_0x3b1df5,_0x1d376d);var _0x900c45=!![];if(_0x5f2a1e['beep']==='NOBEEP'){_0x900c45=![];}var _0x3195e9=this['channel'][_0x758a('0x12c')](_0x3b1df5,_0x1d376d,_0x5f2a1e[_0x758a('0x131')],_0x5f2a1e[_0x758a('0x60')],undefined,_0x900c45);if(_0x3195e9['result']!==-0x1){this['channel'][_0x758a('0xad')](util['format'](_0x758a('0x132'),_0x2c8db1));var _0x395b39=this[_0x758a('0x92')][_0x758a('0x6b')](this,_0x5f2a1e,_0x2c8db1);if(_0x395b39){for(var _0x58ce20 in _0x395b39){if(_0x395b39[_0x758a('0x9b')](_0x58ce20)){this[_0x758a('0xf')]['setVariable'](util[_0x758a('0x2c')](_0x758a('0x133'),_0x58ce20[_0x758a('0x64')]()),_0x395b39[_0x58ce20]);}}return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x134'),JSON[_0x758a('0x6f')](_0x395b39)));}}return _0x3195e9;};AGIVertices[_0x758a('0x12')]['gotoc']=function(_0xf1e6dd){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x135'),_0xf1e6dd[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x136')](_0xf1e6dd['context'],_0xf1e6dd[_0x758a('0x137')],_0xf1e6dd[_0x758a('0x3f')]);};AGIVertices[_0x758a('0x12')]['gotoif']=function(_0xb92cd4){logger['info'](util[_0x758a('0x2c')](_0x758a('0x138'),_0xb92cd4['label']));if(!this[_0x758a('0x84')](_0xb92cd4[_0x758a('0x139')])){return this['channel'][_0x758a('0x30')](_0xb92cd4,'no\x20condition\x20configured');}try{var _0x2267d3=eval(_0xb92cd4[_0x758a('0x139')])?_0x758a('0x13a'):_0x758a('0x13b');this[_0x758a('0xf')][_0x758a('0xad')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0xb92cd4['condition'],_0x2267d3));return{'code':0xc8,'result':_0x2267d3};}catch(_0x2104c8){return{'code':0xc8,'result':_0x758a('0x13b')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x13c')]=function(_0x557026){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x557026['label']));if(!this[_0x758a('0x84')](_0x557026['interval_id'])){return this['channel'][_0x758a('0x30')](_0x557026,_0x758a('0x13d'));}var _0x198dc7=this['getIntervals']['sync'](this,_0x557026[_0x758a('0x13e')]);if(!_0x198dc7){return this[_0x758a('0xf')]['error'](_0x557026,'no\x20intervals\x20found');}for(var _0x10b09a=0x0;_0x10b09a<_0x198dc7[_0x758a('0x9e')];_0x10b09a+=0x1){var _0x46737c=this[_0x758a('0xf')][_0x758a('0x13')](util[_0x758a('0x2c')](_0x758a('0x13f'),_0x198dc7[_0x10b09a]));if(_0x46737c['result']===-0x1){return _0x46737c;}logger[_0x758a('0x32')](util['format'](_0x758a('0x140'),_0x198dc7[_0x10b09a],_0x46737c[_0x758a('0xa6')]));if(_0x46737c[_0x758a('0xa6')]===_0x758a('0x13a')){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],_0x758a('0x13a')));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],'true'));return{'code':0xc8,'result':_0x758a('0x13a')};}else{logger['info'](util['format'](_0x758a('0x140'),_0x198dc7[_0x10b09a],'false'));this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x140'),_0x198dc7[_0x10b09a],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype']['hangup']=function(_0x517aa1){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x141'),_0x517aa1[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x142')]();};AGIVertices[_0x758a('0x12')]['ispeechasr']=function(_0x115920){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x143'),_0x115920['label']));if(!this[_0x758a('0x84')](_0x115920[_0x758a('0x76')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20key\x20configured');}var _0x424c72=_0x758a('0x12a');var _0x21dfd7=util[_0x758a('0x2c')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x19d47f=util[_0x758a('0x2c')](_0x758a('0x9c'),_0x21dfd7,_0x424c72);var _0xee8f98=!![];if(_0x115920[_0x758a('0x144')]===_0x758a('0x12b')){_0xee8f98=![];}var _0x417a55=this[_0x758a('0xf')]['recordFile'](_0x21dfd7,_0x424c72,_0x115920[_0x758a('0x131')],_0x115920[_0x758a('0x60')],undefined,_0xee8f98);if(_0x417a55[_0x758a('0xa4')]!==-0x1){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x145'),_0x19d47f));var _0x344bef=this['ispeechASR'][_0x758a('0x6b')](this,_0x115920,_0x19d47f);if(_0x344bef){for(var _0xab254c in _0x344bef){if(_0x344bef['hasOwnProperty'](_0xab254c)){this[_0x758a('0xf')][_0x758a('0xa0')](util['format'](_0x758a('0x146'),_0xab254c[_0x758a('0x64')]()),_0x344bef[_0xab254c]);}}return this[_0x758a('0xf')]['noop'](util['format'](_0x758a('0x147'),JSON['stringify'](_0x344bef)));}}return _0x417a55;};AGIVertices[_0x758a('0x12')]['ispeechtts']=function(_0x476436){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x476436[_0x758a('0x39')]));if(!this['isConfigured'](_0x476436['key'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xe3'));}if(!this['isConfigured'](_0x476436[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20text\x20configured');}this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x148'),_0x476436[_0x758a('0x58')]));var _0x15efe4=this[_0x758a('0x7e')][_0x758a('0x6b')](this,_0x476436);if(_0x15efe4){this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x145'),_0x15efe4));var _0x2ad81a=this[_0x758a('0xf')][_0x758a('0x149')](_0x15efe4,_0x476436[_0x758a('0x131')]);try{fs[_0x758a('0xfc')](_0x15efe4+_0x758a('0xfd'));}catch(_0x1220e3){logger[_0x758a('0x30')](_0x1220e3);}return _0x2ad81a;}return this['channel']['error'](_0x476436,_0x758a('0x14a'));};AGIVertices[_0x758a('0x12')]['login']=function(_0x1d212c){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14b'),_0x1d212c[_0x758a('0x39')]));if(!this['isConfigured'](_0x1d212c[_0x758a('0x14c')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x1d212c,'no\x20find\x20by\x20configured');}logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x1d212c[_0x758a('0x14c')]));var _0x351ed0=this[_0x758a('0x51')][_0x758a('0x6b')](this,_0x1d212c[_0x758a('0x14c')]);if(_0x351ed0){logger[_0x758a('0x32')](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')]['callerid'],_0x1d212c[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14e'),this['channel']['callerid'],_0x1d212c[_0x758a('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x1d212c[_0x758a('0x14c')]));this['channel'][_0x758a('0xad')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x1d212c[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x151')]=function(_0x576749){logger['info'](util[_0x758a('0x2c')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x576749['label']));if(!this[_0x758a('0x84')](_0x576749[_0x758a('0x14c')])){return this[_0x758a('0xf')]['error'](_0x576749,_0x758a('0x152'));}logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x576749[_0x758a('0x14c')]));var _0x2777aa=this[_0x758a('0x50')][_0x758a('0x6b')](this,_0x576749['findBy']);if(_0x2777aa){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x758a('0xf')]['callerid'],_0x576749[_0x758a('0x14c')]));this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));this[_0x758a('0xf')]['noop'](util['format'](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x576749[_0x758a('0x14c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x758a('0x12')]['math']=function(_0x316c76){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x153'),_0x316c76[_0x758a('0x39')]));if(!this['isConfigured'](_0x316c76['operation'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x316c76,_0x758a('0x154'));}this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x155'),_0x316c76[_0x758a('0x156')]));var _0x1d4b7e=eval(_0x316c76[_0x758a('0x156')]);if(!this[_0x758a('0x84')](_0x316c76[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4497d7=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x316c76[_0x758a('0xd6')]);if(!_0x4497d7){return this[_0x758a('0xf')][_0x758a('0x30')](_0x316c76,'no\x20variable\x20found');}if(_[_0x758a('0x9d')](_0x1d4b7e)){var _0x5ec9bd=this;_0x1d4b7e['forEach'](function(_0x2e61d1,_0x485cf9){_0x5ec9bd[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x157'),_0x4497d7,_0x485cf9),_0x2e61d1);});return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x158'),_0x4497d7));}else{return this[_0x758a('0xf')][_0x758a('0xa0')](_0x4497d7,_0x1d4b7e);}};AGIVertices[_0x758a('0x12')]['menu']=function(_0x2196b7){logger['info'](util[_0x758a('0x2c')](_0x758a('0x159'),_0x2196b7[_0x758a('0x39')]));if(_0x2196b7['retry']===0x0){return this[_0x758a('0xa7')](_0x2196b7);}_0x2196b7[_0x758a('0xa8')]-=0x1;if(!this[_0x758a('0x84')](_0x2196b7[_0x758a('0x10e')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,_0x758a('0x10f'));}var _0x2f80c5=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0x2196b7['file_id']);if(!_0x2f80c5){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,'no\x20file\x20audio\x20found');}var _0x3701e2=this[_0x758a('0xf')][_0x758a('0x15a')](_0x2f80c5,_0x2196b7[_0x758a('0x15b')],_0x2196b7['digit']);var _0x3062c4=_0x3701e2[_0x758a('0xa4')];if(_0x3701e2[_0x758a('0xa4')]===-0x1){this[_0x758a('0x38')]['sync'](this,_0x2196b7,'-1');return _0x3701e2;}else if(_0x3701e2['extra']==='timeout'){_0x3701e2['result']=_0x3701e2[_0x758a('0xa4')][_0x758a('0x9e')]>0x0?_0x3701e2[_0x758a('0xa4')]:'t';}else if(_[_0x758a('0x44')](_0x3701e2[_0x758a('0xa4')])){_0x3701e2[_0x758a('0xa4')]='#';_0x3062c4='#';}if(!this['isConfigured'](_0x2196b7['variable_id'])){this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x15c'));}else{var _0x489e62=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0x2196b7[_0x758a('0xd6')]);if(!_0x489e62){return this[_0x758a('0xf')][_0x758a('0x30')](_0x2196b7,_0x758a('0x114'));}this[_0x758a('0xf')]['setVariable'](_0x489e62,_0x3062c4);}this[_0x758a('0x38')]['sync'](this,_0x2196b7,_0x3062c4);return _0x3701e2;};AGIVertices[_0x758a('0x12')][_0x758a('0xad')]=function(_0x674de5){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x674de5[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0xad')](_0x674de5[_0x758a('0x15d')]||_0x674de5['label']);};AGIVertices[_0x758a('0x12')][_0x758a('0x15e')]=function(_0x37fa49){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x15f'),_0x37fa49['label']));if(!this['isConfigured'](_0x37fa49[_0x758a('0x14c')])){return this['channel'][_0x758a('0x30')](_0x37fa49,_0x758a('0x152'));}logger['info'](util[_0x758a('0x2c')](_0x758a('0x14d'),this[_0x758a('0xf')]['callerid'],_0x37fa49[_0x758a('0x14c')]));var _0x1c7704=this[_0x758a('0x160')]['sync'](this,_0x37fa49[_0x758a('0x161')]);var _0xb35ff2=this[_0x758a('0x4d')][_0x758a('0x6b')](this,_0x37fa49[_0x758a('0x14c')],_0x1c7704);if(_0xb35ff2){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')]['callerid'],_0x37fa49[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x162')};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this['channel'][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));this['channel']['noop'](util['format'](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x37fa49[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')]['playback']=function(_0x5c3d90){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x163'),_0x5c3d90['label']));if(!this['isConfigured'](_0x5c3d90['file_id'])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x5c3d90,_0x758a('0x10f'));}var _0x433d4b=this[_0x758a('0x110')][_0x758a('0x6b')](this,_0x5c3d90['file_id']);if(!_0x433d4b){return this[_0x758a('0xf')][_0x758a('0x30')](_0x5c3d90,_0x758a('0x164'));}var _0xc5d6cf=this['channel'][_0x758a('0x53')]('PLAYBACK',[_0x433d4b,_0x5c3d90['opts']]);if(_0xc5d6cf['result']===-0x1){return _0xc5d6cf;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x165'),_0x433d4b));};AGIVertices[_0x758a('0x12')][_0x758a('0x166')]=function(_0x4949d8){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x167'),_0x4949d8['label']));if(!this[_0x758a('0x84')](_0x4949d8[_0x758a('0x168')])){return this[_0x758a('0xf')]['error'](_0x4949d8,_0x758a('0x169'));}var _0x403537='';var _0x3029cc=parseInt(_0x4949d8[_0x758a('0x168')],0xa);if(isNaN(_0x3029cc)){_0x403537=_0x4949d8[_0x758a('0x168')];}else{_0x403537=this[_0x758a('0x17')][_0x758a('0x6b')](this,_0x4949d8[_0x758a('0x168')]);if(!_0x403537){return this[_0x758a('0xf')][_0x758a('0x30')](_0x4949d8,'no\x20queue\x20found');}}var _0x46d300='';if(this[_0x758a('0x84')](_0x4949d8['file_id'])){var _0x202417=this['getSound'][_0x758a('0x6b')](this,_0x4949d8[_0x758a('0x10e')]);if(_0x202417){_0x46d300=_0x202417;}}this[_0x758a('0x38')][_0x758a('0x6b')](this,_0x4949d8,_0x403537);if(_0x4949d8[_0x758a('0xe0')][_0x758a('0x16a')]('x')<0x0){_0x4949d8['opts']+='x';}if(_0x4949d8[_0x758a('0xe0')][_0x758a('0x16a')]('X')<0x0){_0x4949d8[_0x758a('0xe0')]+='X';}this[_0x758a('0xf')]['setVariable'](_0x758a('0x16b'),_0x403537?_0x403537[_0x758a('0x16c')]():'');var _0x27a794=this[_0x758a('0xf')]['exec'](_0x758a('0x16d'),[_0x403537,_0x4949d8[_0x758a('0xe0')],_0x4949d8[_0x758a('0x5e')],_0x46d300,_0x4949d8['timeout'],_0x4949d8[_0x758a('0x8')],_0x4949d8[_0x758a('0x16e')],_0x4949d8[_0x758a('0x16f')],'',_0x4949d8['position']]);if(_0x27a794['result']===-0x1){return _0x27a794;}return this['channel']['noop'](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x16d'),_0x403537));};AGIVertices[_0x758a('0x12')][_0x758a('0x170')]=function(_0xe22f94){logger[_0x758a('0x32')](util['format'](_0x758a('0x171'),_0xe22f94[_0x758a('0x39')]));var _0x13528e=_0xe22f94[_0x758a('0x172')]||_0x758a('0x12a');var _0x856c85=util[_0x758a('0x2c')]('%s_%s',this[_0x758a('0xf')][_0x758a('0x3c')],rs['generate'](0x5));var _0x238779=util[_0x758a('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0x856c85,_0x13528e);var _0x5cb2d4=util[_0x758a('0x2c')](_0x758a('0x173'),FILES_PATH,_0x856c85);this[_0x758a('0x3b')][_0x758a('0x6b')](this,_0xe22f94,_0x856c85,_0x238779);this[_0x758a('0xf')][_0x758a('0xa0')](_0x758a('0x174'),_0x856c85);logger[_0x758a('0x32')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5cb2d4,_0x13528e,_0xe22f94[_0x758a('0x175')],_0xe22f94[_0x758a('0x60')]);return this[_0x758a('0xf')][_0x758a('0x12c')](_0x5cb2d4,_0x13528e,_0xe22f94['escape_digits'],_0xe22f94[_0x758a('0x60')],undefined,!![]);};AGIVertices[_0x758a('0x12')][_0x758a('0x176')]=function(_0xb22dcc){logger[_0x758a('0x32')](util['format'](_0x758a('0x177'),_0xb22dcc['label']));if(!this[_0x758a('0x84')](_0xb22dcc['url'])){return this[_0x758a('0xf')]['noop']('no\x20url\x20configured');}var _0x36ccca=this['restAPI'][_0x758a('0x6b')](this,_0xb22dcc);logger[_0x758a('0x32')](util['format'](_0x758a('0x178'),util[_0x758a('0x179')](_0x36ccca,{'showHidden':![],'depth':null})));if(!this[_0x758a('0x84')](_0xb22dcc[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x17a'));}var _0x1bb809=this['getVariable'][_0x758a('0x6b')](this,_0xb22dcc[_0x758a('0xd6')]);if(!_0x1bb809){return this['channel'][_0x758a('0x30')](_0xb22dcc,_0x758a('0x114'));}this['channel'][_0x758a('0xa0')](util['format'](_0x758a('0x17b'),_0x1bb809),_0x36ccca[_0x758a('0x72')]?_0x36ccca[_0x758a('0x72')]:_0x758a('0x17c'));this[_0x758a('0xf')][_0x758a('0xa0')](util[_0x758a('0x2c')](_0x758a('0x17d'),_0x1bb809),_0x36ccca['statusMessage']?_0x36ccca[_0x758a('0x71')]:'OK');if(_0x36ccca[_0x758a('0x65')]){try{this[_0x758a('0x9f')](_0x36ccca[_0x758a('0x65')],_0x1bb809);}catch(_0x569299){logger[_0x758a('0x30')](util[_0x758a('0x2c')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x1bb809));}}return this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xd9'),_0x1bb809));};AGIVertices[_0x758a('0x12')][_0x758a('0x17e')]=function(_0x1b32f3){logger['info'](util[_0x758a('0x2c')](_0x758a('0x17f'),_0x1b32f3[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x180')](_0x1b32f3[_0x758a('0x181')][_0x758a('0x182')](/\s+/g,''),_0x1b32f3[_0x758a('0x175')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x183')]=function(_0x10e409){logger[_0x758a('0x32')](util['format'](_0x758a('0x184'),_0x10e409[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0x185')](_0x10e409[_0x758a('0x186')][_0x758a('0x182')](/\s+/g,''),_0x10e409[_0x758a('0x175')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x187')]=function(_0x1c7e59){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x188'),_0x1c7e59[_0x758a('0x39')]));return this[_0x758a('0xf')]['sayPhonetic'](_0x1c7e59[_0x758a('0x58')],_0x1c7e59['escape_digits']);};AGIVertices[_0x758a('0x12')][_0x758a('0x189')]=function(_0xfce017){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0xfce017['label']));if(!this[_0x758a('0x84')](_0xfce017[_0x758a('0x18a')])){return this[_0x758a('0xf')]['noop'](_0x758a('0x18b'));}var _0x439774=this[_0x758a('0x18c')][_0x758a('0x6b')](this,_0xfce017[_0x758a('0x18a')]);if(!_0x439774||!_0x439774['Smtp']){return this['channel'][_0x758a('0x30')](_0xfce017,_0x758a('0x18d'));}var _0x383318={'from':util['format']('\x22%s\x22\x20<%s>',_0x439774['name'],_0x439774[_0x758a('0x18e')]||_0x439774[_0x758a('0x18f')][_0x758a('0x190')]),'to':_0xfce017['to']||'','cc':_0xfce017['cc']||'','bcc':_0xfce017['bcc']||'','subject':_0xfce017['subject'],'html':_0xfce017['text'],'text':_0xfce017['text']};if(this[_0x758a('0x84')](_0xfce017[_0x758a('0x191')])){}logger[_0x758a('0xdb')]('sendMail\x20message',JSON[_0x758a('0x6f')](_0x383318));this[_0x758a('0x38')][_0x758a('0x6b')](this,_0xfce017,_0xfce017['account_id']);this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x439774['name']));this[_0x758a('0x26')][_0x758a('0x6b')](this,_0x439774[_0x758a('0x192')],_0x383318);return this[_0x758a('0xf')][_0x758a('0xad')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x758a('0x12')][_0x758a('0x193')]=function(_0x38b261){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x194'),_0x38b261[_0x758a('0x39')]));return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x195'));};AGIVertices[_0x758a('0x12')]['sendSMS']=function(_0xdd7c67){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xdd7c67[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0xdd7c67['sms_account_id'])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x196'));}var _0x53ab5a=this['getSmsAccount'][_0x758a('0x6b')](this,_0xdd7c67[_0x758a('0x197')]);if(!_0x53ab5a){return this[_0x758a('0xf')]['error'](_0xdd7c67,_0x758a('0x198'));}var _0x928496={'body':_0xdd7c67[_0x758a('0x199')],'phone':_0xdd7c67['to']||'','SmsAccountId':_0x53ab5a['id']};logger['debug'](_0x758a('0x19a'),JSON[_0x758a('0x6f')](_0x928496));this['createSquareDetailsReport'][_0x758a('0x6b')](this,_0xdd7c67,_0xdd7c67[_0x758a('0x197')]);this[_0x758a('0xf')]['noop'](util[_0x758a('0x2c')](_0x758a('0x19b'),_0x53ab5a['name']));this[_0x758a('0x37')]['sync'](this,_0x928496);return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x19c'));};AGIVertices[_0x758a('0x12')][_0x758a('0x19d')]=function(_0xaefc43){logger[_0x758a('0x32')](util['format'](_0x758a('0x19e'),_0xaefc43[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0xaefc43[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0xaefc43,'no\x20variable\x20selected');}var _0xfa5a5e=this[_0x758a('0x13')][_0x758a('0x6b')](this,_0xaefc43['variable_id']);if(!_0xfa5a5e){return this[_0x758a('0xf')]['error'](_0xaefc43,_0x758a('0x114'));}return this[_0x758a('0xf')][_0x758a('0xa0')](_0xfa5a5e,_0xaefc43[_0x758a('0x19f')]);};AGIVertices[_0x758a('0x12')][_0x758a('0x1a0')]=function(_0x13e106){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x13e106['label']));this[_0x758a('0xf')][_0x758a('0xad')]('START\x20CALLY\x20SQUARE');if(_0x13e106[_0x758a('0xb6')]===_0x758a('0x1a1')){this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x1a2'));return this[_0x758a('0xf')]['answer']();}return this[_0x758a('0xf')]['noop'](_0x758a('0x1a3'));};AGIVertices[_0x758a('0x12')][_0x758a('0x1a4')]=function(_0x302c63){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1a5'),_0x302c63[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x302c63[_0x758a('0x1a6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x302c63,_0x758a('0x1a7'));}var _0x14338e=this[_0x758a('0x19')][_0x758a('0x6b')](this,_0x302c63['project_id']);if(!this[_0x758a('0x84')](_0x14338e)){return this[_0x758a('0xf')][_0x758a('0x30')](_0x302c63,util[_0x758a('0x2c')](_0x758a('0x1a8'),_0x302c63[_0x758a('0x1a6')]));}if(_0x14338e===this[_0x758a('0xf')][_0x758a('0x3a')]){return this[_0x758a('0xf')]['error'](_0x302c63,_0x758a('0x1a9'));}this[_0x758a('0x38')]['sync'](this,_0x302c63,_0x14338e);var _0x129c96=this[_0x758a('0xf')][_0x758a('0x53')](_0x758a('0x1aa'),util['format'](_0x758a('0x1ab'),config['agi'][_0x758a('0x1ac')]||_0x758a('0x1ad'),_0x14338e,this['channel'][_0x758a('0x3a')]));if(_0x129c96[_0x758a('0xa4')]===-0x1){return _0x129c96;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')]('Executed\x20command\x20%s\x20%s','AGI',_0x14338e));};AGIVertices['prototype'][_0x758a('0x1ae')]=function(_0x1a29b9){logger['info'](util[_0x758a('0x2c')](_0x758a('0x1af'),_0x1a29b9[_0x758a('0x39')]));var _0x569e14=this[_0x758a('0x52')][_0x758a('0x6b')](this,_0x1a29b9['command']);this[_0x758a('0x38')]['sync'](this,_0x1a29b9,_0x1a29b9[_0x758a('0xb5')]);if(this[_0x758a('0x84')](_0x1a29b9[_0x758a('0xd6')])){var _0xce98b1=this['getVariable'][_0x758a('0x6b')](this,_0x1a29b9[_0x758a('0xd6')]);if(_0xce98b1){this[_0x758a('0xf')][_0x758a('0xa0')](_0xce98b1,_0x569e14);return this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x1b0'),_0x1a29b9['command'],_0xce98b1));}}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b1'),_0x1a29b9[_0x758a('0xb5')]));};AGIVertices['prototype'][_0x758a('0x1b2')]=function(_0x129de2){logger[_0x758a('0x32')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x129de2['label']));_0x129de2[_0x758a('0x58')]=_0x129de2[_0x758a('0x58')][_0x758a('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x758a('0x84')](_0x129de2[_0x758a('0x56')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0x1b3'));}if(!this[_0x758a('0x84')](_0x129de2[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xad')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x129de2['text']));var _0x1e4333=this[_0x758a('0x55')][_0x758a('0x6b')](this,_0x129de2);if(_0x1e4333){this['channel'][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b4'),_0x1e4333));var _0x1b9999=this[_0x758a('0xf')]['streamFile'](_0x1e4333);try{fs[_0x758a('0xfc')](_0x1e4333+_0x758a('0xfd'));}catch(_0x29ff70){logger[_0x758a('0x30')](_0x29ff70);}return _0x1b9999;}return this[_0x758a('0xf')]['error'](_0x129de2,_0x758a('0x1b5'));};AGIVertices[_0x758a('0x12')]['tts']=function(_0x39aaa4){logger[_0x758a('0x32')](util['format'](_0x758a('0x1b6'),_0x39aaa4['label']));_0x39aaa4[_0x758a('0x58')]=_0x39aaa4[_0x758a('0x58')][_0x758a('0x182')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x758a('0x84')](_0x39aaa4[_0x758a('0x58')])){return this[_0x758a('0xf')][_0x758a('0xad')](_0x758a('0xa9'));}this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x1b7'),_0x39aaa4[_0x758a('0x58')]));var _0x5f1608=this[_0x758a('0x5b')][_0x758a('0x6b')](this,_0x39aaa4);if(_0x5f1608){this[_0x758a('0xf')][_0x758a('0xad')](util['format'](_0x758a('0x1b8'),_0x5f1608));var _0x32fbed=this['channel']['streamFile'](_0x5f1608);try{fs[_0x758a('0xfc')](_0x5f1608+_0x758a('0xfd'));}catch(_0x451025){logger[_0x758a('0x30')](_0x451025);}return _0x32fbed;}return this['channel'][_0x758a('0x30')](_0x39aaa4,_0x758a('0x1b9'));};AGIVertices[_0x758a('0x12')][_0x758a('0x1ba')]=function(_0x57ea5f){logger[_0x758a('0x32')](util[_0x758a('0x2c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x57ea5f[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x57ea5f[_0x758a('0x14c')])){return this[_0x758a('0xf')]['error'](_0x57ea5f,_0x758a('0x152'));}logger[_0x758a('0x32')](util[_0x758a('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x758a('0xf')]['callerid'],_0x57ea5f[_0x758a('0x14c')]));var _0x12bdf8=this['agentUnpause'][_0x758a('0x6b')](this,_0x57ea5f['findBy']);if(_0x12bdf8){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14e'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x162')};}else{logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f['findBy']));this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0x14f'),this[_0x758a('0xf')][_0x758a('0x3d')],_0x57ea5f[_0x758a('0x14c')]));return{'code':0xc8,'result':_0x758a('0x150')};}};AGIVertices[_0x758a('0x12')][_0x758a('0x1bb')]=function(_0x1c77c7){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1bc'),_0x1c77c7['label']));var _0x268049=this[_0x758a('0xf')][_0x758a('0x53')]('VOICEMAIL',[_0x1c77c7['mailbox'],_0x1c77c7['options']]);if(_0x268049['result']===-0x1){return _0x268049;}return this[_0x758a('0xf')][_0x758a('0xad')](util[_0x758a('0x2c')](_0x758a('0xc2'),_0x758a('0x1bd'),_0x1c77c7[_0x758a('0x1be')]));};AGIVertices[_0x758a('0x12')][_0x758a('0x1bf')]=function(_0x3d797c){logger[_0x758a('0x32')](util[_0x758a('0x2c')](_0x758a('0x1c0'),_0x3d797c[_0x758a('0x39')]));if(!this[_0x758a('0x84')](_0x3d797c[_0x758a('0xd6')])){return this[_0x758a('0xf')][_0x758a('0x30')](_0x3d797c,_0x758a('0x1c1'));}var _0x223950=this[_0x758a('0x13')]['sync'](this,_0x3d797c[_0x758a('0xd6')]);if(!_0x223950){return this[_0x758a('0xf')][_0x758a('0x30')](_0x3d797c,'no\x20variable\x20found');}var _0x3fc352=this[_0x758a('0xf')][_0x758a('0x13')](_0x223950);return{'code':0xc8,'result':_0x3fc352['extra']?_0x3fc352[_0x758a('0xa6')]:'-'};};String[_0x758a('0x12')][_0x758a('0xa2')]=function(_0x4c50b6,_0x12b327){return this[_0x758a('0xa1')](_0x4c50b6)[_0x758a('0x1c2')](_0x12b327);};module[_0x758a('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x38fd=['args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','createSquareMessage','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','Smtp','no\x20mail\x20account\x20found','email','user','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','prototype','getVariable','rpc','getVariableById','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','context','accountcode','dnid','file','createCmContact','isEmpty','callback_','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','isNil','agentUnpause','agentLogout','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','result','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command'];(function(_0x1863be,_0x3fb18f){var _0x5835e1=function(_0xaa0e92){while(--_0xaa0e92){_0x1863be['push'](_0x1863be['shift']());}};_0x5835e1(++_0x3fb18f);}(_0x38fd,0x117));var _0xd38f=function(_0x3447b3,_0x1ff916){_0x3447b3=_0x3447b3-0x0;var _0x54a026=_0x38fd[_0x3447b3];return _0x54a026;};'use strict';var fs=require('fs');var util=require(_0xd38f('0x0'));var _=require(_0xd38f('0x1'));var sh=require(_0xd38f('0x2'));var odbc=require('odbc')();var rs=require(_0xd38f('0x3'));var moment=require(_0xd38f('0x4'));var Mustache=require(_0xd38f('0x5'));var rp=require(_0xd38f('0x6'));var logger=require('../../config/logger')('agi');var config=require(_0xd38f('0x7'));var shared=require(_0xd38f('0x8'));var scripts=require('./scripts');var FILES_PATH=_0xd38f('0x9');var recursiveMapAttributes=[_0xd38f('0xa'),'rawBody'];var verticesWithRetry=[_0xd38f('0xb'),'getdigits',_0xd38f('0xc')];var AGIVertices=function(_0x23976c,_0x5ba653,_0x466a89){this[_0xd38f('0xd')]=_0x23976c;this['rpc']=_0x5ba653;this['mailRpc']=_0x466a89;};AGIVertices[_0xd38f('0xe')][_0xd38f('0xf')]=function(_0x1dddb5,_0x5741ba){this[_0xd38f('0x10')][_0xd38f('0x11')](_0x1dddb5)['then'](function(_0x2e450e){_0x5741ba(null,_0x2e450e?_0x2e450e[_0xd38f('0x12')]:![]);})['catch'](function(_0x7012eb){_0x5741ba(_0x7012eb);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x13')]=function(_0x12c1b0,_0x361a19){this[_0xd38f('0x10')][_0xd38f('0x14')](_0x12c1b0)['then'](function(_0x6a0bc8){_0x361a19(null,_0x6a0bc8?_0x6a0bc8['name']:![]);})[_0xd38f('0x15')](function(_0x1a1aff){_0x361a19(_0x1a1aff);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x16')]=function(_0x5c0c34,_0x12d1ea){this['rpc'][_0xd38f('0x17')](_0x5c0c34)[_0xd38f('0x18')](function(_0xaf4be7){_0x12d1ea(null,_0xaf4be7?_0xaf4be7[_0xd38f('0x12')]:![]);})[_0xd38f('0x15')](function(_0x296082){_0x12d1ea(_0x296082);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x19')]=function(_0x250f15,_0x804923){this['rpc'][_0xd38f('0x1a')](_0x250f15)[_0xd38f('0x18')](function(_0x4e92f7){_0x804923(null,_0x4e92f7?_0x4e92f7[_0xd38f('0x1b')]:![]);})[_0xd38f('0x15')](function(_0x53b5b5){_0x804923(_0x53b5b5);});};AGIVertices[_0xd38f('0xe')]['getUser']=function(_0x1ea6a1,_0x3adaf8){this[_0xd38f('0x10')][_0xd38f('0x1c')](_0x1ea6a1)[_0xd38f('0x18')](function(_0x18efcd){_0x3adaf8(null,_0x18efcd?_0x18efcd['name']:![]);})['catch'](function(_0x2337aa){_0x3adaf8(_0x2337aa);});};AGIVertices[_0xd38f('0xe')]['getTrunk']=function(_0x1109bd,_0x2819b2){this[_0xd38f('0x10')]['getTrunkById'](_0x1109bd)[_0xd38f('0x18')](function(_0x5e83af){_0x2819b2(null,_0x5e83af?_0x5e83af['name']:![]);})[_0xd38f('0x15')](function(_0x14e699){_0x2819b2(_0x14e699);});};AGIVertices['prototype']['getSound']=function(_0x10216a,_0x473580){var _0x17e777=this;this['rpc']['getSoundById'](_0x10216a)[_0xd38f('0x18')](function(_0x1a8f11){_0x473580(null,_0x1a8f11?_0x17e777[_0xd38f('0x1d')](_0x1a8f11[_0xd38f('0x1e')]):![]);})[_0xd38f('0x15')](function(_0x26fe18){_0x473580(_0x26fe18);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1f')]=function(_0x863efb,_0x4e65fa){this[_0xd38f('0x10')][_0xd38f('0x20')](_0x863efb)['then'](function(_0x132f38){_0x4e65fa(null,_0x132f38?_0x132f38:![]);})[_0xd38f('0x15')](function(_0x4f53f2){_0x4e65fa(_0x4f53f2);});};AGIVertices[_0xd38f('0xe')]['sendMailMessage']=function(_0x35984,_0x5ce9f9,_0x544e66){this[_0xd38f('0x21')][_0xd38f('0x22')](_0x35984,_0x5ce9f9)[_0xd38f('0x18')](function(){_0x544e66(null);})[_0xd38f('0x15')](function(_0x4214df){_0x544e66(_0x4214df);});};AGIVertices[_0xd38f('0xe')]['getIntervals']=function(_0x4cb2b4,_0x395745){this['rpc'][_0xd38f('0x23')](_0x4cb2b4)[_0xd38f('0x18')](function(_0x583c9b){if(_0x583c9b){if(_0x583c9b[_0xd38f('0x24')]){_0x395745(null,[_0x583c9b[_0xd38f('0x25')]]);}else{_0x395745(null,_[_0xd38f('0x26')](_0x583c9b['Intervals'],_0xd38f('0x25')));}}else{_0x395745(null,![]);}})[_0xd38f('0x15')](function(_0xda7afd){_0x395745(_0xda7afd);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1d')]=function(_0x2fc5ea){return util[_0xd38f('0x27')](_0xd38f('0x28'),FILES_PATH,_0x2fc5ea);};AGIVertices[_0xd38f('0xe')][_0xd38f('0x29')]=function(_0x47eab7,_0x466660,_0x47e744){odbc['open'](_0x47eab7,function(_0x3fcadf){if(_0x3fcadf){logger[_0xd38f('0x2a')](_0xd38f('0x2b'),_0x3fcadf);_0x47e744(_0x3fcadf);}else{logger[_0xd38f('0x2c')](_0xd38f('0x2d'));odbc[_0xd38f('0x2e')](_0x466660,function(_0x4c75c7,_0x35c525){if(_0x4c75c7){logger['info'](_0xd38f('0x2f'),_0x466660);_0x47e744(_0x4c75c7);}else{logger['info'](_0xd38f('0x30'),_0x466660);odbc['close'](function(_0x3d07fc){if(_0x3d07fc){logger[_0xd38f('0x2a')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3d07fc);}_0x47e744(null,_0x35c525);});}});}});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x31')]=function(_0x2b3e14,_0x120767){this[_0xd38f('0x10')][_0xd38f('0x32')](_0x2b3e14)[_0xd38f('0x18')](function(_0x2ae754){_0x120767(null,_0x2ae754?_0x2ae754:![]);})[_0xd38f('0x15')](function(_0x214105){_0x120767(_0x214105);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x33')]=function(_0x500ab4,_0x5bc230){this[_0xd38f('0x10')][_0xd38f('0x33')](_0x500ab4)[_0xd38f('0x18')](function(_0x469eee){_0x5bc230(null,_0x469eee);})['catch'](function(_0x3b86bb){_0x5bc230(_0x3b86bb);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x34')]=function(_0x458704,_0x2d3a7f,_0x180ab8){this[_0xd38f('0x10')][_0xd38f('0x34')]({'uniqueid':this[_0xd38f('0xd')][_0xd38f('0x35')],'node':_0x458704[_0xd38f('0x36')],'application':_0x458704[_0xd38f('0x37')],'data':_0x2d3a7f||null,'project_name':this['channel'][_0xd38f('0x38')],'callerid':this[_0xd38f('0xd')]['callerid']})[_0xd38f('0x18')](function(_0x388103){if(_0x180ab8){_0x180ab8(null,_0x388103);}})['catch'](function(_0x45e467){if(_0x180ab8){_0x180ab8(_0x45e467);}});};AGIVertices[_0xd38f('0xe')]['createSquareRecording']=function(_0x541a87,_0x1798a5,_0x928674,_0x3ac557){this[_0xd38f('0x10')]['createSquareRecording']({'uniqueid':this[_0xd38f('0xd')][_0xd38f('0x35')],'callerid':this[_0xd38f('0xd')][_0xd38f('0x39')],'calleridname':this[_0xd38f('0xd')]['calleridname'],'context':this[_0xd38f('0xd')][_0xd38f('0x3a')],'extension':this[_0xd38f('0xd')]['extension'],'priority':this[_0xd38f('0xd')]['priority'],'accountcode':this[_0xd38f('0xd')][_0xd38f('0x3b')],'dnid':this[_0xd38f('0xd')][_0xd38f('0x3c')],'projectName':this[_0xd38f('0xd')][_0xd38f('0x38')],'saveName':_0x1798a5,'filename':_0x541a87[_0xd38f('0x3d')]||_0x1798a5,'savePath':_0x928674})[_0xd38f('0x18')](function(_0x2529af){_0x3ac557(null,_0x2529af);})[_0xd38f('0x15')](function(_0x5ad742){_0x3ac557(_0x5ad742);});};AGIVertices[_0xd38f('0xe')]['createSquareMessage']=function(_0x2c6672,_0x5a71aa,_0x6d31ea,_0x162641,_0x562a5b){this['rpc']['createSquareMessage']({'uniqueid':this[_0xd38f('0xd')][_0xd38f('0x35')],'body':_0x2c6672,'direction':_0x5a71aa,'providerName':_0x6d31ea,'providerResponse':_0x162641})[_0xd38f('0x18')](function(_0x22ad54){if(_0x562a5b){_0x562a5b(null,_0x22ad54);}})[_0xd38f('0x15')](function(_0x2927eb){if(_0x562a5b){_0x562a5b(_0x2927eb);}});};AGIVertices['prototype'][_0xd38f('0x3e')]=function(_0x395cb1,_0xc80079){this[_0xd38f('0x10')][_0xd38f('0x3e')]({'firstName':_[_0xd38f('0x3f')](_0x395cb1['name'])||_['isNil'](_0x395cb1[_0xd38f('0x12')])?_0xd38f('0x40')+Math['random']():_0x395cb1[_0xd38f('0x12')],'lastName':_[_0xd38f('0x3f')](_0x395cb1[_0xd38f('0x41')])||_['isNil'](_0x395cb1[_0xd38f('0x41')])?null:_0x395cb1[_0xd38f('0x41')],'phone':_0x395cb1[_0xd38f('0x42')],'ListId':_0x395cb1[_0xd38f('0x43')],'scheduledat':_0x395cb1[_0xd38f('0x44')],'callbackUniqueid':this[_0xd38f('0xd')][_0xd38f('0x35')],'tags':'callback','description':_0xd38f('0x45')+_0x395cb1[_0xd38f('0x44')][_0xd38f('0x46')](),'priority':_0x395cb1[_0xd38f('0x47')]})[_0xd38f('0x18')](function(_0x324276){_0xc80079(null,_0x324276);})[_0xd38f('0x15')](function(_0x10d213){_0xc80079(_0x10d213);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x48')]=function(_0x8020aa,_0x30d548){this[_0xd38f('0x10')][_0xd38f('0x49')](_0x8020aa)[_0xd38f('0x18')](function(_0x3c3685){_0x30d548(null,_0x3c3685?_0x3c3685[_0xd38f('0x12')]:![]);})[_0xd38f('0x15')](function(_0x158ea3){_0x30d548(_0x158ea3);});};AGIVertices[_0xd38f('0xe')]['agentPause']=function(_0x3bc7d7,_0x2dfa4f,_0x18689c){var _0x29eafa={'role':_0xd38f('0x4a')};_0x29eafa[_0x3bc7d7]=this['channel'][_0xd38f('0x39')];this['rpc'][_0xd38f('0x4b')](_0x29eafa,_0x2dfa4f,this[_0xd38f('0xd')][_0xd38f('0x35')])[_0xd38f('0x18')](function(_0x3316ac){_0x18689c(null,_[_0xd38f('0x4c')](_0x3316ac)?![]:!![]);})[_0xd38f('0x15')](function(_0x21c0ec){logger[_0xd38f('0x2a')](_0x21c0ec);_0x18689c(null,![]);});};AGIVertices['prototype'][_0xd38f('0x4d')]=function(_0x4d7f6e,_0x241a46){var _0x1c247b={'role':'agent'};_0x1c247b[_0x4d7f6e]=this['channel']['callerid'];this['rpc'][_0xd38f('0x4d')](_0x1c247b)['then'](function(_0x3d1894){_0x241a46(null,_[_0xd38f('0x4c')](_0x3d1894)?![]:!![]);})[_0xd38f('0x15')](function(_0x48af52){logger[_0xd38f('0x2a')](_0x48af52);_0x241a46(null,![]);});};AGIVertices[_0xd38f('0xe')]['agentLogout']=function(_0x175412,_0x93c22a){var _0x1f2646={'role':_0xd38f('0x4a')};_0x1f2646[_0x175412]=this['channel']['callerid'];this['rpc'][_0xd38f('0x4e')](_0x1f2646)[_0xd38f('0x18')](function(_0xdeaac6){_0x93c22a(null,_[_0xd38f('0x4c')](_0xdeaac6)?![]:!![]);})[_0xd38f('0x15')](function(_0x2a8b93){logger[_0xd38f('0x2a')](_0x2a8b93);_0x93c22a(null,![]);});};AGIVertices[_0xd38f('0xe')]['agentLogin']=function(_0x4c89da,_0x38bfd5){var _0x528912={'role':'agent'};_0x528912[_0x4c89da]=this[_0xd38f('0xd')][_0xd38f('0x39')];var _0x5a7473=_0x4c89da!='internal'?util[_0xd38f('0x27')]('%s/%s@from-sip/n',_0xd38f('0x4f'),this['channel']['callerid']):undefined;this['rpc']['agentLogin'](_0x528912,_0x5a7473)['then'](function(_0x35c733){_0x38bfd5(null,_['isNil'](_0x35c733)?![]:!![]);})[_0xd38f('0x15')](function(_0xfd42fd){logger[_0xd38f('0x2a')](_0xfd42fd);_0x38bfd5(null,![]);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x50')]=function(_0x356368,_0x35e18b){sh[_0xd38f('0x51')](_[_0xd38f('0x52')](_0x356368),function(_0x331f45,_0xbcbcd2){var _0x4248a9=_0xbcbcd2[_0xd38f('0x53')](/(\r\n|\n|\r)/gm,'');_0x35e18b(null,_0x4248a9);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x54')]=function(_0x20a565,_0x4b6866){scripts[_0xd38f('0x54')](_0x20a565['apiKey'],_0x20a565[_0xd38f('0x55')]||_0xd38f('0x56'),_0x20a565[_0xd38f('0x56')],_0x20a565['languageCode']||'en-US',_0x20a565[_0xd38f('0x57')]||_0xd38f('0x58'),_0x20a565['audioEncoding']||'MP3')['then'](function(_0x238f74){_0x4b6866(null,_0x238f74);})[_0xd38f('0x15')](function(_0x3a3f32){_0x4b6866(_0x3a3f32);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x59')]=function(_0x288bd9,_0x5714d5){scripts['googleTTS'](_0x288bd9[_0xd38f('0x56')],_0x288bd9[_0xd38f('0x5a')]||'en',0x1)[_0xd38f('0x18')](function(_0x3ba575){_0x5714d5(null,_0x3ba575);})[_0xd38f('0x15')](function(_0x15af28){_0x5714d5(_0x15af28);});};AGIVertices['prototype'][_0xd38f('0x5b')]=function(_0x142f06,_0x2a44de){var _0x297205={'uri':_0x142f06[_0xd38f('0x5c')],'method':_0x142f06[_0xd38f('0x5d')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x142f06[_0xd38f('0x5e')])===_0xd38f('0x5f')&&parseInt(_0x142f06[_0xd38f('0x5e')])>=0x1?parseInt(_0x142f06[_0xd38f('0x5e')])*0x3e8:0x5*0x3e8};if(_[_0xd38f('0x60')]([_0xd38f('0x61'),_0xd38f('0x62')],_0x297205[_0xd38f('0x5d')]['toUpperCase']())){try{_0x297205['body']=_0x142f06[_0xd38f('0x63')]?JSON[_0xd38f('0x64')](_0x142f06['rawBody']):{};}catch(_0x477d47){logger['error'](_0xd38f('0x65'),_0x477d47);}}try{_0x297205[_0xd38f('0x66')]=_0x142f06['rawHeaders']?JSON[_0xd38f('0x64')](_0x142f06[_0xd38f('0xa')]):{};}catch(_0xeed18b){logger[_0xd38f('0x2a')](_0xd38f('0x67'),_0xeed18b);}if(_0x142f06[_0xd38f('0x68')]){try{var _0x1eac5a=require(_0x142f06[_0xd38f('0x68')])['sync'](this,_0x297205);_0x297205[_0xd38f('0x69')]=Mustache[_0xd38f('0x6a')](_0x142f06[_0xd38f('0x5c')],_0x1eac5a,{},['$$','$$']);if(_0x297205[_0xd38f('0x66')]){_0x297205[_0xd38f('0x66')]=JSON[_0xd38f('0x64')](Mustache['render'](JSON[_0xd38f('0x6b')](_0x297205[_0xd38f('0x66')]),_0x1eac5a,{},['$$','$$']));}if(_0x297205[_0xd38f('0x6c')]){_0x297205[_0xd38f('0x6c')]=JSON[_0xd38f('0x64')](Mustache[_0xd38f('0x6a')](JSON[_0xd38f('0x6b')](_0x297205['body']),_0x1eac5a,{},['$$','$$']));}}catch(_0x458fe9){logger['error'](_0xd38f('0x6d'),_0x458fe9);}}rp(_0x297205)[_0xd38f('0x18')](function(_0x117d05){var _0x3d0e2a={'statusCode':_0x117d05[_0xd38f('0x6e')]||0xc8,'statusMessage':_0x117d05[_0xd38f('0x6f')]||'OK','headers':_0x117d05['headers']||{},'body':_0x117d05['body']||{}};_0x2a44de(null,_0x3d0e2a);})[_0xd38f('0x15')](function(_0x318bd8){var _0x449384={'statusCode':_0x318bd8[_0xd38f('0x6e')]||0x1f4,'statusMessage':_0x318bd8[_0xd38f('0x70')]||_0xd38f('0x71'),'headers':_0x318bd8[_0xd38f('0x72')]['headers']||{},'body':_0x318bd8[_0xd38f('0x72')][_0xd38f('0x6c')]||{}};_0x2a44de(null,_0x449384);});};AGIVertices[_0xd38f('0xe')]['googleDialogflow']=function(_0x5bbda8,_0x3605e0){scripts[_0xd38f('0x73')](this['channel']['uniqueid'],_0x5bbda8[_0xd38f('0x74')],_0x5bbda8[_0xd38f('0x56')],_0x5bbda8[_0xd38f('0x75')]||'en')[_0xd38f('0x18')](function(_0x1b7ecb){_0x3605e0(null,_0x1b7ecb);})['catch'](function(_0x1dff7c){_0x3605e0(_0x1dff7c);});};AGIVertices['prototype'][_0xd38f('0x76')]=function(_0x1f22b6,_0x1d0a6b){scripts[_0xd38f('0x76')](this[_0xd38f('0xd')]['uniqueid'],_0x1f22b6[_0xd38f('0x77')],_0x1f22b6[_0xd38f('0x78')],_0x1f22b6['private_key'],_0x1f22b6['text'],_0x1f22b6['dialogflowV2_language']||'en')[_0xd38f('0x18')](function(_0x16f103){_0x1d0a6b(null,_0x16f103);})[_0xd38f('0x15')](function(_0x1ace36){_0x1d0a6b(_0x1ace36);});};AGIVertices[_0xd38f('0xe')]['sestekNDA']=function(_0x28cd0c,_0x16ca36){scripts[_0xd38f('0x79')](this[_0xd38f('0xd')],_0x28cd0c)[_0xd38f('0x18')](function(_0x46a69c){_0x16ca36(null,_0x46a69c);})[_0xd38f('0x15')](function(_0x2b5f9e){_0x16ca36(_0x2b5f9e);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x7a')]=function(_0x587f11,_0x150e4b){scripts[_0xd38f('0x7a')](_0x587f11[_0xd38f('0x74')],_0x587f11[_0xd38f('0x56')],_0x587f11[_0xd38f('0x7b')]||'en-US',_0x587f11[_0xd38f('0x7c')])[_0xd38f('0x18')](function(_0x54807b){_0x150e4b(null,_0x54807b);})[_0xd38f('0x15')](function(_0x424ed6){_0x150e4b(_0x424ed6);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x7d')]=function(_0x161af8,_0x190c9a,_0x44df44){scripts[_0xd38f('0x7d')](_0x190c9a,_0x161af8[_0xd38f('0x74')],_0x161af8[_0xd38f('0x7e')]||_0xd38f('0x7f'),this[_0xd38f('0x80')](_0x161af8[_0xd38f('0x81')])?_0x161af8[_0xd38f('0x81')]:undefined)['then'](function(_0x399295){_0x44df44(null,_0x399295);})[_0xd38f('0x15')](function(_0x36302d){_0x44df44(_0x36302d);});};AGIVertices['prototype'][_0xd38f('0x82')]=function(_0x57bc4d,_0x499c51){scripts[_0xd38f('0x82')](_0x57bc4d['aws_access_key_id'],_0x57bc4d[_0xd38f('0x83')],_0x57bc4d[_0xd38f('0x84')],_0x57bc4d[_0xd38f('0x85')]||'Amy',_0x57bc4d['text'],_0x57bc4d[_0xd38f('0x86')]||'text')[_0xd38f('0x18')](function(_0x4cfbd1){_0x499c51(null,_0x4cfbd1);})[_0xd38f('0x15')](function(_0x3b9d51){_0x499c51(_0x3b9d51);});};AGIVertices['prototype'][_0xd38f('0x87')]=function(_0x164ece,_0x23f0b7){scripts['awsLex'](this['channel'][_0xd38f('0x35')],_0x164ece[_0xd38f('0x88')],_0x164ece[_0xd38f('0x83')],_0x164ece[_0xd38f('0x89')],_0x164ece['text'],_0x164ece[_0xd38f('0x8a')])[_0xd38f('0x18')](function(_0x49aefe){_0x23f0b7(null,_0x49aefe);})[_0xd38f('0x15')](function(_0x152e16){_0x23f0b7(_0x152e16);});};AGIVertices[_0xd38f('0xe')][_0xd38f('0x8b')]=function(_0x10549c,_0x1ef77e,_0x518536){scripts[_0xd38f('0x8b')](_0x1ef77e,_0x10549c[_0xd38f('0x74')],_0x10549c['google_asr_language']||_0xd38f('0x7f'))[_0xd38f('0x18')](function(_0x14082d){_0x518536(null,_0x14082d);})['catch'](function(_0x2da86c){_0x518536(_0x2da86c);});};AGIVertices['prototype'][_0xd38f('0x8c')]=function(_0x43fde2,_0x4a8fc0,_0x4b8754){scripts[_0xd38f('0x8c')](_0x4a8fc0,_0x43fde2['appid'],_0x43fde2[_0xd38f('0x8d')],_0x43fde2[_0xd38f('0x69')])[_0xd38f('0x18')](function(_0x93235f){_0x4b8754(null,_0x93235f);})[_0xd38f('0x15')](function(_0x421c2e){_0x4b8754(_0x421c2e);});};AGIVertices['prototype']['clear']=function(_0x2d13f9){var _0x562e26=_[_0xd38f('0x60')](verticesWithRetry,_0x2d13f9[_0xd38f('0x37')])?_0x2d13f9:_['clone'](_0x2d13f9);for(var _0x571d22 in _0x562e26){if(_0x562e26[_0xd38f('0x8e')](_0x571d22)){if(_0x562e26[_0x571d22]&&_[_0xd38f('0x8f')](_0x562e26[_0x571d22])){if(_['includes'](recursiveMapAttributes,_0x571d22)){_0x562e26[_0x571d22]=this[_0xd38f('0x90')](_0x562e26[_0x571d22]);}else{_0x562e26[_0x571d22]=this[_0xd38f('0x91')](_0x562e26[_0x571d22]);}}}}return _0x562e26;};AGIVertices[_0xd38f('0xe')][_0xd38f('0x92')]=function(_0x3f6d73){for(var _0x4f7410 in _0x3f6d73){if(_0x3f6d73[_0xd38f('0x8e')](_0x4f7410)){if(_[_0xd38f('0x93')](_0x3f6d73[_0x4f7410])){this['recursiveNodeIndex'](_0x3f6d73[_0x4f7410]);}else if(_[_0xd38f('0x94')](_0x3f6d73[_0x4f7410])){for(var _0x57c775=0x0;_0x57c775<_0x3f6d73[_0x4f7410][_0xd38f('0x95')];_0x57c775++){this[_0xd38f('0x92')](_0x3f6d73[_0x4f7410][_0x57c775]);}}else if(_['isString'](_0x3f6d73[_0x4f7410])){_0x3f6d73[_0x4f7410]=this[_0xd38f('0x91')](_0x3f6d73[_0x4f7410]);}}}};AGIVertices['prototype'][_0xd38f('0x96')]=function(_0x395c61,_0x57bd36){for(var _0x1842b4 in _0x395c61){if(_0x395c61['hasOwnProperty'](_0x1842b4)){if(_[_0xd38f('0x93')](_0x395c61[_0x1842b4])){if(!_[_0xd38f('0x3f')](_0x395c61[_0x1842b4])){this[_0xd38f('0x96')](_0x395c61[_0x1842b4],util[_0xd38f('0x27')](_0xd38f('0x97'),_0x57bd36,_0x1842b4));}}else if(_[_0xd38f('0x94')](_0x395c61[_0x1842b4])){for(var _0x386fe4=0x0;_0x386fe4<_0x395c61[_0x1842b4][_0xd38f('0x95')];_0x386fe4++){this[_0xd38f('0x96')](_0x395c61[_0x1842b4][_0x386fe4],util[_0xd38f('0x27')](_0xd38f('0x97'),_0x57bd36,_0x1842b4+'['+_0x386fe4+']'));}}else{if(!_[_0xd38f('0x4c')](_0x395c61[_0x1842b4])){this['channel']['setVariable'](util[_0xd38f('0x27')](_0xd38f('0x97'),_0x57bd36,_0x1842b4),_0x395c61[_0x1842b4]);}}}}};AGIVertices[_0xd38f('0xe')][_0xd38f('0x90')]=function(_0x5c580a){try{var _0x20e44f=JSON[_0xd38f('0x64')](_0x5c580a);this[_0xd38f('0x92')](_0x20e44f);return JSON[_0xd38f('0x6b')](_0x20e44f);}catch(_0xa268b3){return this[_0xd38f('0x91')](_0x5c580a);}};AGIVertices[_0xd38f('0xe')]['replaceAllVariables']=function(_0x411f26){var _0x3d5409=_0x411f26[_0xd38f('0x98')]('{');for(var _0x2f6e82=0x1;_0x2f6e82<_0x3d5409[_0xd38f('0x95')];_0x2f6e82+=0x1){var _0x32335a=_0x3d5409[_0x2f6e82][_0xd38f('0x98')]('}');if(_0x32335a[_0xd38f('0x95')]>0x1){_0x411f26=_0x411f26[_0xd38f('0x99')]('{'+_0x32335a[0x0]+'}',this[_0xd38f('0xd')][_0xd38f('0xf')](_0x32335a[0x0])[_0xd38f('0x9a')]||_0x32335a[0x0]);}}if(_0x3d5409[_0xd38f('0x95')]===0x1){return _0x411f26['toString']();}return this[_0xd38f('0x91')](_0x411f26);};AGIVertices[_0xd38f('0xe')][_0xd38f('0x9b')]=function(_0x1970f5,_0x10ce4d){var _0x1d211a=this[_0xd38f('0xd')][_0xd38f('0xf')](_0x1970f5);if(_0x1d211a['result']===-0x1){return _0x1d211a;}logger['info'](util[_0xd38f('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x10ce4d,_0x1d211a[_0xd38f('0x9a')]));return this[_0xd38f('0xd')][_0xd38f('0x9c')](_0x10ce4d,_0x1d211a['extra']);};AGIVertices[_0xd38f('0xe')]['isConfigured']=function(_0x3e231c){return _0x3e231c&&_0x3e231c!=='0'&&_0x3e231c!=='-1'&&_0x3e231c!=='';};AGIVertices[_0xd38f('0xe')][_0xd38f('0x9d')]=function(_0x189bd6){this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x189bd6,'-');_0x189bd6[_0xd38f('0x9f')]=_0x189bd6[_0xd38f('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xd38f('0xa0')]=function(_0x2736c5){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xa1'),_0x2736c5['label']));if(!this[_0xd38f('0x80')](_0x2736c5[_0xd38f('0x56')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xa3'));}var _0x323fe1='\x22'+_0x2736c5[_0xd38f('0x56')]+'\x22';if(this[_0xd38f('0x80')](_0x2736c5[_0xd38f('0x72')])){_0x323fe1+=','+_0x2736c5[_0xd38f('0x72')];}var _0x160da4=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0xa4'),_0x323fe1);if(_0x160da4['result']===-0x1){return _0x160da4;}return this['channel']['noop'](util[_0xd38f('0x27')](_0xd38f('0xa5'),_0x323fe1));};AGIVertices[_0xd38f('0xe')][_0xd38f('0xa6')]=function(_0x1024f7){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xa7'),_0x1024f7[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x1024f7['grammar'])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xa8'));}var _0x568745=_0x1024f7['grammar'];if(this['isConfigured'](_0x1024f7[_0xd38f('0x72')])){_0x568745+=','+_0x1024f7['options'];}var _0x44b0c0=this[_0xd38f('0xd')][_0xd38f('0x51')]('MRCPRecog',_0x568745);if(_0x44b0c0[_0xd38f('0xa9')]===-0x1){return _0x44b0c0;}var _0x4f7ad5=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4f7ad5['result']===-0x1){return _0x4f7ad5;}var _0x40151d=this[_0xd38f('0x9b')](_0xd38f('0xaa'),_0xd38f('0xab'));if(_0x40151d[_0xd38f('0xa9')]===-0x1){return _0x40151d;}var _0x45b0dd=this[_0xd38f('0x9b')](_0xd38f('0xac'),_0xd38f('0xad'));if(_0x45b0dd[_0xd38f('0xa9')]===-0x1){return _0x45b0dd;}return this['channel'][_0xd38f('0xa2')](util['format'](_0xd38f('0xae'),_0x568745));};AGIVertices[_0xd38f('0xe')][_0xd38f('0xaf')]=function(_0x3d9aa0){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3d9aa0[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0xaf')]([_0x3d9aa0[_0xd38f('0xb0')],_0x3d9aa0[_0xd38f('0xb1')]]);};AGIVertices[_0xd38f('0xe')][_0xd38f('0xb2')]=function(_0x44bcd5){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x44bcd5[_0xd38f('0x36')]));if(this[_0xd38f('0x80')](_0x44bcd5['timeout'])){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xb3'),_0x44bcd5[_0xd38f('0x5e')]));var _0x3b746f=this[_0xd38f('0xd')][_0xd38f('0xb4')](_0x44bcd5[_0xd38f('0x5e')]);if(_0x3b746f[_0xd38f('0xa9')]===-0x1){return _0x3b746f;}}return this[_0xd38f('0xd')][_0xd38f('0xb2')]();};AGIVertices[_0xd38f('0xe')][_0xd38f('0xb5')]=function(_0x4da3c5){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xb6'),_0x4da3c5[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x4da3c5[_0xd38f('0x43')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x4da3c5,_0xd38f('0xb7'));}_0x4da3c5[_0xd38f('0x44')]=moment();if(this[_0xd38f('0x80')](_0x4da3c5[_0xd38f('0xb8')])){_0x4da3c5[_0xd38f('0x44')]=moment()[_0xd38f('0xb9')](_0x4da3c5['delay'],_0xd38f('0xba'));}if(!this[_0xd38f('0x80')](_0x4da3c5['callback_priority'])){_0x4da3c5[_0xd38f('0x47')]=0x2;}this[_0xd38f('0x3e')][_0xd38f('0x9e')](this,_0x4da3c5);return this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')](_0xd38f('0xbb'),_0x4da3c5['phone'],_0x4da3c5[_0xd38f('0x43')],_0x4da3c5['scheduledAt']));};AGIVertices['prototype'][_0xd38f('0xbc')]=function(_0x5599e2){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xbd'),_0x5599e2['label']));var _0x2cc5f2=this[_0xd38f('0xd')][_0xd38f('0x51')](_0x5599e2[_0xd38f('0xbe')],_0x5599e2['options']);if(_0x2cc5f2[_0xd38f('0xa9')]===-0x1){return _0x2cc5f2;}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format'](_0xd38f('0xbf'),_0x5599e2[_0xd38f('0xbe')],_0x5599e2[_0xd38f('0x72')]));};AGIVertices[_0xd38f('0xe')]['lumenvoxtts']=function(_0x43657b){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0xc0'),_0x43657b[_0xd38f('0x36')]));if(!this['isConfigured'](_0x43657b[_0xd38f('0x56')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xa3'));}var _0x235bdd='\x22'+_0x43657b[_0xd38f('0x56')]+'\x22';if(this[_0xd38f('0x80')](_0x43657b['options'])){_0x235bdd+=','+_0x43657b['options'];}var _0x2bbd1e=this['channel']['exec'](_0xd38f('0xa4'),_0x235bdd);if(_0x2bbd1e[_0xd38f('0xa9')]===-0x1){return _0x2bbd1e;}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xa5'),_0x235bdd));};AGIVertices['prototype'][_0xd38f('0xc1')]=function(_0x5d571c){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5d571c[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x5d571c[_0xd38f('0x56')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x4f8de8='\x22'+_0x5d571c[_0xd38f('0x56')]+'\x22';if(this[_0xd38f('0x80')](_0x5d571c['options'])){_0x4f8de8+=','+_0x5d571c['options'];}var _0x15a193=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0xa4'),_0x4f8de8);if(_0x15a193[_0xd38f('0xa9')]===-0x1){return _0x15a193;}return this[_0xd38f('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4f8de8));};AGIVertices['prototype']['lumenvoxasr']=function(_0x57a5a5){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xc2'),_0x57a5a5[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x57a5a5[_0xd38f('0xc3')])){return this[_0xd38f('0xd')]['noop']('no\x20grammar\x20configured');}var _0x4ca932=_0x57a5a5[_0xd38f('0xc3')];if(this[_0xd38f('0x80')](_0x57a5a5[_0xd38f('0x72')])){_0x4ca932+=','+_0x57a5a5[_0xd38f('0x72')];}var _0x116f72=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0xc4'),_0x4ca932);if(_0x116f72['result']===-0x1){return _0x116f72;}var _0x1e151a=this[_0xd38f('0x9b')](_0xd38f('0xc5'),_0xd38f('0xc6'));if(_0x1e151a[_0xd38f('0xa9')]===-0x1){return _0x1e151a;}var _0x1de539=this[_0xd38f('0x9b')](_0xd38f('0xaa'),_0xd38f('0xc7'));if(_0x1de539['result']===-0x1){return _0x1de539;}var _0x498cb4=this[_0xd38f('0x9b')](_0xd38f('0xac'),'LUMENVOX_ASR_INSTANCE');if(_0x498cb4[_0xd38f('0xa9')]===-0x1){return _0x498cb4;}return this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xae'),_0x4ca932));};AGIVertices['prototype'][_0xd38f('0xc8')]=function(_0x50b692){logger['info'](util[_0xd38f('0x27')](_0xd38f('0xc9'),_0x50b692[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x50b692[_0xd38f('0xc3')])){return this['channel']['noop'](_0xd38f('0xa8'));}var _0x46f52c=_0x50b692[_0xd38f('0xc3')];if(this['isConfigured'](_0x50b692[_0xd38f('0x72')])){_0x46f52c+=','+_0x50b692[_0xd38f('0x72')];}var _0x52c206=this[_0xd38f('0xd')][_0xd38f('0x51')]('MRCPRecog',_0x46f52c);if(_0x52c206[_0xd38f('0xa9')]===-0x1){return _0x52c206;}var _0x2d304d=this[_0xd38f('0x9b')]('RECOG_CONFIDENCE()',_0xd38f('0xca'));if(_0x2d304d[_0xd38f('0xa9')]===-0x1){return _0x2d304d;}var _0x45424d=this[_0xd38f('0x9b')](_0xd38f('0xaa'),'SESTEK_ASR_TRANSCRIPT');if(_0x45424d['result']===-0x1){return _0x45424d;}var _0x860ac9=this[_0xd38f('0x9b')](_0xd38f('0xac'),_0xd38f('0xcb'));if(_0x860ac9['result']===-0x1){return _0x860ac9;}return this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xae'),_0x46f52c));};AGIVertices[_0xd38f('0xe')]['database']=function(_0x31c11f){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xcc'),_0x31c11f[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x31c11f[_0xd38f('0xcd')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x31c11f,_0xd38f('0xce'));}var _0x54a5c=this['getSquareOdbc'][_0xd38f('0x9e')](this,_0x31c11f[_0xd38f('0xcd')]);if(!_0x54a5c){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x31c11f,_0xd38f('0xcf'));}if(!this[_0xd38f('0x80')](_0x31c11f[_0xd38f('0x2e')])){return this[_0xd38f('0xd')]['error'](_0x31c11f,_0xd38f('0xd0'));}var _0x2b42ef=_0x31c11f['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xd1'),_0x2b42ef));var _0x529167=this['getQueryOdbc']['sync'](this,_0x54a5c,_0x2b42ef);this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x31c11f,_0x2b42ef);if(!this[_0xd38f('0x80')](_0x31c11f[_0xd38f('0xd2')])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0xd3'));}var _0xbb8e13=this[_0xd38f('0xf')][_0xd38f('0x9e')](this,_0x31c11f['variable_id']);if(!_0xbb8e13){return this[_0xd38f('0xd')]['error'](_0x31c11f,'no\x20variable\x20found');}var _0x3714d6=this;_0x529167[_0xd38f('0xd4')](function(_0x179d81,_0x4368a6){Object[_0xd38f('0xd5')](_0x179d81)[_0xd38f('0xd4')](function(_0x56b5cd){_0x3714d6[_0xd38f('0xd')]['setVariable'](util[_0xd38f('0x27')]('%s[%s][%s]',_0xbb8e13,_0x4368a6,_0x56b5cd),_0x179d81[_0x56b5cd]);});});this[_0xd38f('0xd')]['setVariable'](util['format'](_0xd38f('0xd6'),_0xbb8e13),_0x529167[_0xd38f('0x95')]);return this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')]('variable\x20%s\x20set',_0xbb8e13));};AGIVertices[_0xd38f('0xe')][_0xd38f('0xd7')]=function(_0x22138c){logger[_0xd38f('0xd8')](util[_0xd38f('0x27')](_0xd38f('0xd9'),_0x22138c['label']));if(!this[_0xd38f('0x80')](_0x22138c[_0xd38f('0xda')])){return this['channel'][_0xd38f('0x2a')](_0x22138c,'no\x20user\x20selected');}var _0x2cdf58=this[_0xd38f('0xdb')]['sync'](this,_0x22138c[_0xd38f('0xda')]);if(!_0x2cdf58){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x22138c,_0xd38f('0xdc'));}var _0x3227b8=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0xdd'),[util['format'](_0xd38f('0xde'),_0x2cdf58),_0x22138c[_0xd38f('0x5e')],_0x22138c['opts'],_0x22138c[_0xd38f('0x5c')]]);if(_0x3227b8['result']===-0x1){return _0x3227b8;}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format'](_0xd38f('0xdf'),_0xd38f('0xdd')));};AGIVertices[_0xd38f('0xe')]['dialogflow']=function(_0x53a735){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0xe0'),_0x53a735[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x53a735[_0xd38f('0x74')])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xe1'));}if(!this['isConfigured'](_0x53a735[_0xd38f('0x56')])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xa3'));}this[_0xd38f('0xd')]['bot']=!![];this[_0xd38f('0x34')](_0x53a735);this['createSquareMessage'](_0x53a735[_0xd38f('0x56')],'in','','');this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xe2'),_0x53a735['text']));var _0x3f5da2=this[_0xd38f('0x73')][_0xd38f('0x9e')](this,_0x53a735);if(_0x3f5da2){for(var _0x2307d7 in _0x3f5da2){if(_0x3f5da2[_0xd38f('0x8e')](_0x2307d7)){this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')](_0xd38f('0xe3'),_0x2307d7[_0xd38f('0xe4')]()),_0x3f5da2[_0x2307d7]);}}this[_0xd38f('0xe5')](_0x3f5da2[_0xd38f('0xe6')],_0xd38f('0xe7'),_0xd38f('0xe8'),'');return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('Dialogflow\x20Result\x20%s',_0x3f5da2['speech']));}return this[_0xd38f('0xd')]['error'](_0x53a735,_0xd38f('0xe9'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0xea')]=function(_0x599220){logger['info'](util[_0xd38f('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x599220['label']));if(!this['isConfigured'](_0x599220['dialogflowV2_project_id'])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xeb'));}if(!this['isConfigured'](_0x599220['client_email'])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xec'));}if(!this[_0xd38f('0x80')](_0x599220[_0xd38f('0xed')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xee'));}if(!this['isConfigured'](_0x599220[_0xd38f('0xef')])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0xf0'));}if(!this['isConfigured'](_0x599220['text'])){return this['channel'][_0xd38f('0xa2')]('no\x20text\x20configured');}this['channel'][_0xd38f('0xf1')]=!![];this[_0xd38f('0x34')](_0x599220);this[_0xd38f('0xe5')](_0x599220[_0xd38f('0x56')],'in','','');this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xf2'),_0x599220['text']));var _0x4eaca8=this['googleDialogflowV2'][_0xd38f('0x9e')](this,_0x599220);if(_0x4eaca8){for(var _0x5675cc in _0x4eaca8){if(_0x4eaca8['hasOwnProperty'](_0x5675cc)){if(_0x5675cc!==_0xd38f('0xf3')){this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')](_0xd38f('0xe3'),_0x5675cc['toUpperCase']()),_0x4eaca8[_0x5675cc]);}}}this['createSquareMessage'](_0x4eaca8[_0xd38f('0xe6')],_0xd38f('0xe7'),_0xd38f('0xea'),_0x4eaca8[_0xd38f('0xf3')]);return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xf4'),_0x4eaca8[_0xd38f('0xe6')]));}return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x599220,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0xcc73b2){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0xf5'),_0xcc73b2[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0xcc73b2[_0xd38f('0xf6')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xf7'));}if(!this[_0xd38f('0x80')](_0xcc73b2[_0xd38f('0xf8')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xf9'));}if(!this[_0xd38f('0x80')](_0xcc73b2[_0xd38f('0xfa')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')]('no\x20password\x20configured');}if(!this['isConfigured'](_0xcc73b2[_0xd38f('0xfb')])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xa3'));}this[_0xd38f('0xd')]['bot']=!![];this[_0xd38f('0x34')](_0xcc73b2);this[_0xd38f('0xe5')](_0xcc73b2['text'],'in','','');this[_0xd38f('0xd')]['noop'](util['format']('Trying\x20SestekNDA:\x20%s',_0xcc73b2[_0xd38f('0x56')]));var _0x327069=this['sestekNDA'][_0xd38f('0x9e')](this,_0xcc73b2);if(_0x327069){for(var _0x13ad6c in _0x327069){if(_0x327069[_0xd38f('0x8e')](_0x13ad6c)){this['channel'][_0xd38f('0x9c')](util[_0xd38f('0x27')]('SESTEK_NDA_%s',_0x13ad6c['toUpperCase']()),_0x327069[_0x13ad6c]);}}this['createSquareMessage'](_0x327069[_0xd38f('0xe6')],'out',_0xd38f('0xfc'),'');if(_0x327069[_0xd38f('0xfd')]){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xfe'),_0x327069[_0xd38f('0xfd')]));var _0x4c3372=this[_0xd38f('0xd')][_0xd38f('0xff')](_0x327069[_0xd38f('0xfd')]);try{fs[_0xd38f('0x100')](_0x327069[_0xd38f('0xfd')]+'.wav');}catch(_0x462f04){logger['error'](_0x462f04);}return _0x4c3372;}else{return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format'](_0xd38f('0x101'),_0x327069['speech']));}}return this[_0xd38f('0xd')]['error'](_0xcc73b2,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd38f('0xe')][_0xd38f('0x102')]=function(_0x25e333){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x103'),_0x25e333[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x102'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x104')]=function(_0x57cd0e){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x105'),_0x57cd0e[_0xd38f('0x36')]));var _0x16cdac='';if(_0x57cd0e[_0xd38f('0x106')]){if(!this[_0xd38f('0x80')](_0x57cd0e[_0xd38f('0x106')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x57cd0e,_0xd38f('0x107'));}else{var _0x4d982e=parseInt(_0x57cd0e[_0xd38f('0x106')],0xa);if(isNaN(_0x4d982e)){_0x16cdac=_0x57cd0e[_0xd38f('0x106')];}else{_0x16cdac=this[_0xd38f('0x108')][_0xd38f('0x9e')](this,_0x57cd0e[_0xd38f('0x106')]);if(!_0x16cdac){return this['channel'][_0xd38f('0x2a')](_0x57cd0e,_0xd38f('0x109'));}}}}else if(_0x57cd0e[_0xd38f('0x10a')]){_0x16cdac=_0x57cd0e['trunk_name'];}else{return this[_0xd38f('0xd')]['error'](_0x57cd0e,_0xd38f('0x107'));}var _0x4b2568=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0xdd'),[util[_0xd38f('0x27')](_0xd38f('0x10b'),_0x16cdac,_0x57cd0e[_0xd38f('0x42')]),_0x57cd0e[_0xd38f('0x5e')],_0x57cd0e[_0xd38f('0x10c')],_0x57cd0e['url']]);if(_0x4b2568[_0xd38f('0xa9')]===-0x1){return _0x4b2568;}return this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xdf'),_0xd38f('0xdd')));};AGIVertices[_0xd38f('0xe')]['finally']=function(_0x573408){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x10d'),_0x573408[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x10e'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x10f')]=function(_0x38e7e1){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x110'),_0x38e7e1[_0xd38f('0x36')]));if(_0x38e7e1[_0xd38f('0x9f')]===0x0){return this[_0xd38f('0x9d')](_0x38e7e1);}_0x38e7e1[_0xd38f('0x9f')]-=0x1;if(!this[_0xd38f('0x80')](_0x38e7e1['file_id'])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x38e7e1,_0xd38f('0x111'));}var _0x3d346a=this['getSound']['sync'](this,_0x38e7e1[_0xd38f('0x112')]);if(!_0x3d346a){return this[_0xd38f('0xd')]['error'](_0x38e7e1,_0xd38f('0x113'));}if(!this[_0xd38f('0x80')](_0x38e7e1['variable_id'])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0xd38f('0xd3'));}var _0x446c81=this['channel'][_0xd38f('0x114')](_0x3d346a,_0x38e7e1[_0xd38f('0x115')],_0x38e7e1[_0xd38f('0x116')]);var _0x57b053=_0x446c81[_0xd38f('0xa9')]?_0x446c81[_0xd38f('0xa9')][_0xd38f('0x46')]():'';logger[_0xd38f('0x2c')](_0xd38f('0x117'),JSON[_0xd38f('0x6b')](_0x446c81));if(_0x446c81[_0xd38f('0xa9')]===-0x1){this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x38e7e1,_0x57b053);return _0x446c81;}else if(_0x446c81[_0xd38f('0x9a')]==='timeout'){_0x446c81[_0xd38f('0xa9')]=_0x57b053[_0xd38f('0x95')]>=parseInt(_0x38e7e1['mindigit'])?'x':'i';}else{_0x446c81['result']=_0x57b053[_0xd38f('0x95')]>=parseInt(_0x38e7e1[_0xd38f('0x118')])&&_0x57b053[_0xd38f('0x95')]<=parseInt(_0x38e7e1['maxdigit'])?'x':'i';}var _0x4dbc44=this[_0xd38f('0xf')]['sync'](this,_0x38e7e1[_0xd38f('0xd2')]);if(!_0x4dbc44){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x38e7e1,_0xd38f('0x119'));}this[_0xd38f('0xd')][_0xd38f('0x9c')](_0x4dbc44,_0x57b053);if(this[_0xd38f('0x80')](_0x38e7e1[_0xd38f('0x11a')])){var _0x20d5b5=parseInt(_0x38e7e1['hiddendigitsnum'],0xa);var _0x1027ac=rs['generate']({'charset':'*','length':_0x20d5b5});var _0xd4e99b=_0x57b053[_0xd38f('0x95')];if(_0xd4e99b>0x0){if(_0xd4e99b>_0x20d5b5){this['createSquareDetailsReport'][_0xd38f('0x9e')](this,_0x38e7e1,_0x38e7e1[_0xd38f('0x11b')]===_0xd38f('0x11c')?_0x1027ac+_0x57b053[_0xd38f('0x11d')](_0x20d5b5):_0x57b053[_0xd38f('0x11d')](0x0,_0xd4e99b-_0x20d5b5)+_0x1027ac);}else{this[_0xd38f('0x34')]['sync'](this,_0x38e7e1,rs[_0xd38f('0x11e')]({'charset':'*','length':_0xd4e99b}));}}else{this[_0xd38f('0x34')]['sync'](this,_0x38e7e1,'');}}else{this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x38e7e1,_0x57b053);}return _0x446c81;};AGIVertices[_0xd38f('0xe')][_0xd38f('0xc')]=function(_0x1ee7ce){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x11f'),_0x1ee7ce[_0xd38f('0x36')]));return this[_0xd38f('0x10f')](_0x1ee7ce);};AGIVertices['prototype'][_0xd38f('0x120')]=function(_0x1aaf98){logger['info'](util['format'](_0xd38f('0x121'),_0x1aaf98['label']));this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x1aaf98,_0x1aaf98[_0xd38f('0x122')]);return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('GOAL\x20%s',_0x1aaf98['goalname']));};AGIVertices[_0xd38f('0xe')]['awspolly']=function(_0x403360){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x403360[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x403360[_0xd38f('0x88')])||!this[_0xd38f('0x80')](_0x403360[_0xd38f('0x83')])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0x123'));}if(!this[_0xd38f('0x80')](_0x403360['text'])){return this[_0xd38f('0xd')][_0xd38f('0xa2')]('no\x20text\x20configured');}this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format'](_0xd38f('0x124'),_0x403360['text']));var _0x2fbf55=this[_0xd38f('0x82')][_0xd38f('0x9e')](this,_0x403360);if(_0x2fbf55){this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x125'),_0x2fbf55));var _0xe5a288=this['channel'][_0xd38f('0xff')](_0x2fbf55);try{fs[_0xd38f('0x100')](_0x2fbf55+_0xd38f('0x126'));}catch(_0xc288bf){logger[_0xd38f('0x2a')](_0xc288bf);}return _0xe5a288;}return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x403360,_0xd38f('0x127'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x128')]=function(_0x9c0723){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x9c0723[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x9c0723['aws_access_key_id'])||!this[_0xd38f('0x80')](_0x9c0723['aws_secret_access_key'])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x123'));}if(!this[_0xd38f('0x80')](_0x9c0723['aws_bot_name'])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x129'));}if(!this[_0xd38f('0x80')](_0x9c0723[_0xd38f('0x56')])){return this['channel'][_0xd38f('0xa2')]('no\x20text\x20configured');}this[_0xd38f('0xd')]['bot']=!![];this[_0xd38f('0x34')](_0x9c0723);this['createSquareMessage'](_0x9c0723[_0xd38f('0x56')],'in','','');this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x12a'),_0x9c0723[_0xd38f('0x56')]));var _0x5af17b=this[_0xd38f('0x87')][_0xd38f('0x9e')](this,_0x9c0723);if(_0x5af17b){for(var _0x542b6c in _0x5af17b){if(_0x5af17b['hasOwnProperty'](_0x542b6c)&&_[_0xd38f('0x8f')](_0x5af17b[_0x542b6c])){this['channel']['setVariable'](util[_0xd38f('0x27')](_0xd38f('0x12b'),_0x542b6c[_0xd38f('0xe4')]()),_0x5af17b[_0x542b6c]);}}if(_[_0xd38f('0x4c')](_0x5af17b[_0xd38f('0x70')])){return this['channel'][_0xd38f('0xa2')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xd38f('0xe5')](_0x5af17b['message'],_0xd38f('0xe7'),'amazonlex','');return this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')](_0xd38f('0x12c'),_0x5af17b[_0xd38f('0x70')]));}}return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x9c0723,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xd38f('0xe')]['googleasr']=function(_0x2830d0){logger[_0xd38f('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2830d0['label'],_0x2830d0['timeout']));if(!this[_0xd38f('0x80')](_0x2830d0[_0xd38f('0x74')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xe1'));}var _0x479be3=_0xd38f('0x12d');var _0x10119a=util[_0xd38f('0x27')](_0xd38f('0x12e'),FILES_PATH,rs[_0xd38f('0x11e')](0x4));var _0x1aa7a9=util[_0xd38f('0x27')]('%s.%s',_0x10119a,_0x479be3);var _0x49019c=!![];if(_0x2830d0[_0xd38f('0x12f')]===_0xd38f('0x130')){_0x49019c=![];}var _0xb7be62=this[_0xd38f('0xd')][_0xd38f('0x131')](_0x10119a,_0x479be3,_0x2830d0[_0xd38f('0x132')],_0x2830d0['timeout'],undefined,_0x49019c);if(_0xb7be62[_0xd38f('0xa9')]!==-0x1){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x133'),_0x1aa7a9));var _0x77c115=this['googleASR']['sync'](this,_0x2830d0,_0x1aa7a9);if(_0x77c115){for(var _0x29fcc6 in _0x77c115){if(_0x77c115[_0xd38f('0x8e')](_0x29fcc6)){this[_0xd38f('0xd')]['setVariable'](util[_0xd38f('0x27')]('GOOGLE_ASR_%s',_0x29fcc6['toUpperCase']()),_0x77c115[_0x29fcc6]);}}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format']('GoogleASR\x20Result\x20%s',JSON[_0xd38f('0x6b')](_0x77c115)));}}return _0xb7be62;};AGIVertices[_0xd38f('0xe')][_0xd38f('0x134')]=function(_0x48af41){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x135'),_0x48af41[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x48af41[_0xd38f('0x136')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x137'));}if(!this['isConfigured'](_0x48af41['appsecret'])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0x138'));}var _0x492e65=_0xd38f('0x12d');var _0x3650b3=util[_0xd38f('0x27')](_0xd38f('0x12e'),FILES_PATH,rs[_0xd38f('0x11e')](0x4));var _0x4dc460=util[_0xd38f('0x27')]('%s.%s',_0x3650b3,_0x492e65);var _0x1b153e=!![];if(_0x48af41['beep']===_0xd38f('0x130')){_0x1b153e=![];}var _0x54455c=this[_0xd38f('0xd')][_0xd38f('0x131')](_0x3650b3,_0x492e65,_0x48af41[_0xd38f('0x132')],_0x48af41[_0xd38f('0x5e')],undefined,_0x1b153e);if(_0x54455c['result']!==-0x1){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x139'),_0x4dc460));var _0x437038=this[_0xd38f('0x8c')][_0xd38f('0x9e')](this,_0x48af41,_0x4dc460);if(_0x437038){for(var _0x17dec3 in _0x437038){if(_0x437038[_0xd38f('0x8e')](_0x17dec3)){this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')](_0xd38f('0x13a'),_0x17dec3[_0xd38f('0xe4')]()),_0x437038[_0x17dec3]);}}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xd38f('0x6b')](_0x437038)));}}return _0x54455c;};AGIVertices[_0xd38f('0xe')][_0xd38f('0x13b')]=function(_0x29c09b){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x13c'),_0x29c09b[_0xd38f('0x36')]));return this['channel'][_0xd38f('0x13d')](_0x29c09b['context'],_0x29c09b[_0xd38f('0x13e')],_0x29c09b[_0xd38f('0x13f')]);};AGIVertices[_0xd38f('0xe')][_0xd38f('0x140')]=function(_0x4b9e10){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x141'),_0x4b9e10['label']));if(!this[_0xd38f('0x80')](_0x4b9e10['condition'])){return this['channel']['error'](_0x4b9e10,_0xd38f('0x142'));}try{var _0x3df27d=eval(_0x4b9e10[_0xd38f('0x143')])?_0xd38f('0x144'):'false';this['channel'][_0xd38f('0xa2')](util['format'](_0xd38f('0x145'),_0x4b9e10[_0xd38f('0x143')],_0x3df27d));return{'code':0xc8,'result':_0x3df27d};}catch(_0x1e7819){return{'code':0xc8,'result':_0xd38f('0x146')};}};AGIVertices['prototype'][_0xd38f('0x147')]=function(_0x277135){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x277135[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x277135['interval_id'])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x277135,_0xd38f('0x148'));}var _0x3ba99a=this[_0xd38f('0x149')][_0xd38f('0x9e')](this,_0x277135[_0xd38f('0x14a')]);if(!_0x3ba99a){return this[_0xd38f('0xd')]['error'](_0x277135,_0xd38f('0x14b'));}for(var _0x1447b9=0x0;_0x1447b9<_0x3ba99a[_0xd38f('0x95')];_0x1447b9+=0x1){var _0xdde8e0=this['channel'][_0xd38f('0xf')](util[_0xd38f('0x27')](_0xd38f('0x14c'),_0x3ba99a[_0x1447b9]));if(_0xdde8e0[_0xd38f('0xa9')]===-0x1){return _0xdde8e0;}logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x14d'),_0x3ba99a[_0x1447b9],_0xdde8e0['extra']));if(_0xdde8e0[_0xd38f('0x9a')]===_0xd38f('0x144')){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x14d'),_0x3ba99a[_0x1447b9],_0xd38f('0x144')));this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')]('IFTIME\x20%s\x20%s',_0x3ba99a[_0x1447b9],_0xd38f('0x144')));return{'code':0xc8,'result':_0xd38f('0x144')};}else{logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('IFTIME\x20%s\x20%s',_0x3ba99a[_0x1447b9],_0xd38f('0x146')));this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x14d'),_0x3ba99a[_0x1447b9],_0xd38f('0x146')));}}return{'code':0xc8,'result':_0xd38f('0x146')};};AGIVertices['prototype'][_0xd38f('0x14e')]=function(_0x5b203f){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x14f'),_0x5b203f[_0xd38f('0x36')]));return this['channel'][_0xd38f('0x14e')]();};AGIVertices[_0xd38f('0xe')][_0xd38f('0x150')]=function(_0x1267da){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x151'),_0x1267da[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x1267da[_0xd38f('0x74')])){return this['channel'][_0xd38f('0xa2')](_0xd38f('0xe1'));}var _0x127f65=_0xd38f('0x12d');var _0x43da9b=util['format'](_0xd38f('0x12e'),FILES_PATH,rs[_0xd38f('0x11e')](0x4));var _0x43d5a1=util['format'](_0xd38f('0x97'),_0x43da9b,_0x127f65);var _0x679730=!![];if(_0x1267da['beep']===_0xd38f('0x130')){_0x679730=![];}var _0x1fea57=this[_0xd38f('0xd')]['recordFile'](_0x43da9b,_0x127f65,_0x1267da[_0xd38f('0x132')],_0x1267da['timeout'],undefined,_0x679730);if(_0x1fea57[_0xd38f('0xa9')]!==-0x1){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('ispeech\x20%s\x20file\x20created',_0x43d5a1));var _0x2d6ca5=this[_0xd38f('0x7d')]['sync'](this,_0x1267da,_0x43d5a1);if(_0x2d6ca5){for(var _0xd91994 in _0x2d6ca5){if(_0x2d6ca5[_0xd38f('0x8e')](_0xd91994)){this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')](_0xd38f('0x152'),_0xd91994[_0xd38f('0xe4')]()),_0x2d6ca5[_0xd91994]);}}return this['channel']['noop'](util['format'](_0xd38f('0x153'),JSON[_0xd38f('0x6b')](_0x2d6ca5)));}}return _0x1fea57;};AGIVertices['prototype'][_0xd38f('0x154')]=function(_0x4c25a1){logger[_0xd38f('0x2c')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x4c25a1[_0xd38f('0x36')]));if(!this['isConfigured'](_0x4c25a1[_0xd38f('0x74')])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0xe1'));}if(!this[_0xd38f('0x80')](_0x4c25a1[_0xd38f('0x56')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xa3'));}this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x4c25a1['text']));var _0x469722=this[_0xd38f('0x7a')][_0xd38f('0x9e')](this,_0x4c25a1);if(_0x469722){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x155'),_0x469722));var _0x2a6e7f=this[_0xd38f('0xd')][_0xd38f('0xff')](_0x469722,_0x4c25a1['intKey']);try{fs['unlink'](_0x469722+'.wav');}catch(_0x31a7fc){logger['error'](_0x31a7fc);}return _0x2a6e7f;}return this[_0xd38f('0xd')]['error'](_0x4c25a1,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd38f('0xe')][_0xd38f('0x156')]=function(_0x51a36c){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x157'),_0x51a36c['label']));if(!this[_0xd38f('0x80')](_0x51a36c['findBy'])){return this[_0xd38f('0xd')]['error'](_0x51a36c,_0xd38f('0x158'));}logger['info'](util[_0xd38f('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd38f('0x39')],_0x51a36c['findBy']));var _0x52e2fb=this['agentLogin']['sync'](this,_0x51a36c[_0xd38f('0x159')]);if(_0x52e2fb){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15a'),this[_0xd38f('0xd')]['callerid'],_0x51a36c['findBy']));this['channel']['noop'](util['format'](_0xd38f('0x15a'),this['channel'][_0xd38f('0x39')],_0x51a36c['findBy']));return{'code':0xc8,'result':_0xd38f('0x15b')};}else{logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x15c'),this[_0xd38f('0xd')]['callerid'],_0x51a36c['findBy']));this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd38f('0xd')][_0xd38f('0x39')],_0x51a36c[_0xd38f('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['logout']=function(_0x5dc25e){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15d'),_0x5dc25e[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x5dc25e['findBy'])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x5dc25e,_0xd38f('0x158'));}logger['info'](util['format'](_0xd38f('0x15e'),this[_0xd38f('0xd')]['callerid'],_0x5dc25e[_0xd38f('0x159')]));var _0x5b4ad6=this['agentLogout'][_0xd38f('0x9e')](this,_0x5dc25e['findBy']);if(_0x5b4ad6){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15a'),this[_0xd38f('0xd')]['callerid'],_0x5dc25e['findBy']));this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd38f('0xd')][_0xd38f('0x39')],_0x5dc25e[_0xd38f('0x159')]));return{'code':0xc8,'result':_0xd38f('0x15b')};}else{logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15c'),this['channel'][_0xd38f('0x39')],_0x5dc25e[_0xd38f('0x159')]));this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')](_0xd38f('0x15c'),this[_0xd38f('0xd')][_0xd38f('0x39')],_0x5dc25e[_0xd38f('0x159')]));return{'code':0xc8,'result':_0xd38f('0x15f')};}};AGIVertices[_0xd38f('0xe')][_0xd38f('0x160')]=function(_0x30fb4d){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x161'),_0x30fb4d[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x30fb4d[_0xd38f('0x162')])){return this['channel'][_0xd38f('0x2a')](_0x30fb4d,_0xd38f('0x163'));}this[_0xd38f('0xd')]['noop'](util['format']('math\x20%s',_0x30fb4d[_0xd38f('0x162')]));var _0x469e29=eval(_0x30fb4d['operation']);if(!this[_0xd38f('0x80')](_0x30fb4d[_0xd38f('0xd2')])){return this['channel']['noop'](_0xd38f('0xd3'));}var _0x3ff830=this[_0xd38f('0xf')][_0xd38f('0x9e')](this,_0x30fb4d[_0xd38f('0xd2')]);if(!_0x3ff830){return this['channel']['error'](_0x30fb4d,_0xd38f('0x119'));}if(_[_0xd38f('0x94')](_0x469e29)){var _0x182a77=this;_0x469e29[_0xd38f('0xd4')](function(_0x187f07,_0xcc7ec8){_0x182a77[_0xd38f('0xd')]['setVariable'](util['format'](_0xd38f('0x164'),_0x3ff830,_0xcc7ec8),_0x187f07);});return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('variable\x20%s[key]\x20set',_0x3ff830));}else{return this[_0xd38f('0xd')]['setVariable'](_0x3ff830,_0x469e29);}};AGIVertices['prototype'][_0xd38f('0xb')]=function(_0x569cb9){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x165'),_0x569cb9[_0xd38f('0x36')]));if(_0x569cb9['retry']===0x0){return this[_0xd38f('0x9d')](_0x569cb9);}_0x569cb9[_0xd38f('0x9f')]-=0x1;if(!this[_0xd38f('0x80')](_0x569cb9[_0xd38f('0x112')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x569cb9,_0xd38f('0x111'));}var _0x571ad1=this[_0xd38f('0x166')][_0xd38f('0x9e')](this,_0x569cb9[_0xd38f('0x112')]);if(!_0x571ad1){return this['channel'][_0xd38f('0x2a')](_0x569cb9,_0xd38f('0x113'));}var _0x2cb0f5=this[_0xd38f('0xd')]['getData'](_0x571ad1,_0x569cb9[_0xd38f('0x115')],_0x569cb9[_0xd38f('0x167')]);var _0x3cd2be=_0x2cb0f5[_0xd38f('0xa9')];if(_0x2cb0f5[_0xd38f('0xa9')]===-0x1){this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x569cb9,'-1');return _0x2cb0f5;}else if(_0x2cb0f5['extra']===_0xd38f('0x5e')){_0x2cb0f5[_0xd38f('0xa9')]=_0x2cb0f5[_0xd38f('0xa9')]['length']>0x0?_0x2cb0f5[_0xd38f('0xa9')]:'t';}else if(_[_0xd38f('0x3f')](_0x2cb0f5[_0xd38f('0xa9')])){_0x2cb0f5['result']='#';_0x3cd2be='#';}if(!this['isConfigured'](_0x569cb9[_0xd38f('0xd2')])){this[_0xd38f('0xd')][_0xd38f('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1a04b0=this['getVariable'][_0xd38f('0x9e')](this,_0x569cb9[_0xd38f('0xd2')]);if(!_0x1a04b0){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x569cb9,_0xd38f('0x119'));}this[_0xd38f('0xd')][_0xd38f('0x9c')](_0x1a04b0,_0x3cd2be);}this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x569cb9,_0x3cd2be);return _0x2cb0f5;};AGIVertices[_0xd38f('0xe')][_0xd38f('0xa2')]=function(_0x2b9154){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x168'),_0x2b9154[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0x2b9154[_0xd38f('0x169')]||_0x2b9154['label']);};AGIVertices[_0xd38f('0xe')]['pause']=function(_0x531551){logger['info'](util[_0xd38f('0x27')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x531551['label']));if(!this[_0xd38f('0x80')](_0x531551[_0xd38f('0x159')])){return this[_0xd38f('0xd')]['error'](_0x531551,_0xd38f('0x158'));}logger['info'](util[_0xd38f('0x27')](_0xd38f('0x15e'),this[_0xd38f('0xd')]['callerid'],_0x531551[_0xd38f('0x159')]));var _0x4fa4c1=this[_0xd38f('0x48')][_0xd38f('0x9e')](this,_0x531551['pause_id']);var _0x5e3b46=this[_0xd38f('0x4b')][_0xd38f('0x9e')](this,_0x531551[_0xd38f('0x159')],_0x4fa4c1);if(_0x5e3b46){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x531551[_0xd38f('0x159')]));this['channel'][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x15a'),this['channel'][_0xd38f('0x39')],_0x531551[_0xd38f('0x159')]));return{'code':0xc8,'result':_0xd38f('0x15b')};}else{logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15c'),this[_0xd38f('0xd')]['callerid'],_0x531551['findBy']));this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x15a'),this[_0xd38f('0xd')][_0xd38f('0x39')],_0x531551[_0xd38f('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd38f('0xe')]['playback']=function(_0x59aeaa){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x16a'),_0x59aeaa[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x59aeaa[_0xd38f('0x112')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x59aeaa,_0xd38f('0x111'));}var _0x272aa8=this[_0xd38f('0x166')]['sync'](this,_0x59aeaa[_0xd38f('0x112')]);if(!_0x272aa8){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x59aeaa,'no\x20file\x20audio\x20found');}var _0x168476=this[_0xd38f('0xd')]['exec'](_0xd38f('0x16b'),[_0x272aa8,_0x59aeaa[_0xd38f('0x10c')]]);if(_0x168476['result']===-0x1){return _0x168476;}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0xbf'),_0xd38f('0x16b'),_0x272aa8));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x16c')]=function(_0x49f013){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x16d'),_0x49f013['label']));if(!this[_0xd38f('0x80')](_0x49f013[_0xd38f('0x16e')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x49f013,_0xd38f('0x16f'));}var _0x100e22='';var _0x15911e=parseInt(_0x49f013[_0xd38f('0x16e')],0xa);if(isNaN(_0x15911e)){_0x100e22=_0x49f013[_0xd38f('0x16e')];}else{_0x100e22=this[_0xd38f('0x13')][_0xd38f('0x9e')](this,_0x49f013[_0xd38f('0x16e')]);if(!_0x100e22){return this['channel']['error'](_0x49f013,_0xd38f('0x170'));}}var _0x35b9be='';if(this[_0xd38f('0x80')](_0x49f013[_0xd38f('0x112')])){var _0x51c3fc=this[_0xd38f('0x166')][_0xd38f('0x9e')](this,_0x49f013['file_id']);if(_0x51c3fc){_0x35b9be=_0x51c3fc;}}this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x49f013,_0x100e22);if(_0x49f013[_0xd38f('0x10c')][_0xd38f('0x171')]('x')<0x0){_0x49f013[_0xd38f('0x10c')]+='x';}if(_0x49f013[_0xd38f('0x10c')][_0xd38f('0x171')]('X')<0x0){_0x49f013[_0xd38f('0x10c')]+='X';}this[_0xd38f('0xd')][_0xd38f('0x9c')](_0xd38f('0x172'),_0x100e22?_0x100e22[_0xd38f('0x173')]():'');var _0x70f8a6=this['channel']['exec'](_0xd38f('0x174'),[_0x100e22,_0x49f013[_0xd38f('0x10c')],_0x49f013['url'],_0x35b9be,_0x49f013['timeout'],_0x49f013[_0xd38f('0xaf')],_0x49f013[_0xd38f('0x175')],_0x49f013[_0xd38f('0x176')],'',_0x49f013['position']]);if(_0x70f8a6[_0xd38f('0xa9')]===-0x1){return _0x70f8a6;}return this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')]('Executed\x20command\x20%s\x20%s',_0xd38f('0x174'),_0x100e22));};AGIVertices['prototype'][_0xd38f('0x177')]=function(_0x1f9dc0){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x178'),_0x1f9dc0[_0xd38f('0x36')]));var _0x27ac2c=_0x1f9dc0[_0xd38f('0x179')]||_0xd38f('0x12d');var _0x5f1bb0=util['format'](_0xd38f('0x17a'),this[_0xd38f('0xd')]['uniqueid'],rs[_0xd38f('0x11e')](0x5));var _0x5196eb=util['format'](_0xd38f('0x17b'),FILES_PATH,_0x5f1bb0,_0x27ac2c);var _0x517164=util[_0xd38f('0x27')](_0xd38f('0x12e'),FILES_PATH,_0x5f1bb0);this[_0xd38f('0x17c')][_0xd38f('0x9e')](this,_0x1f9dc0,_0x5f1bb0,_0x5196eb);this[_0xd38f('0xd')][_0xd38f('0x9c')](_0xd38f('0x17d'),_0x5f1bb0);logger[_0xd38f('0x2c')](_0xd38f('0x17e'),_0x517164,_0x27ac2c,_0x1f9dc0['escape_digits'],_0x1f9dc0[_0xd38f('0x5e')]);return this[_0xd38f('0xd')][_0xd38f('0x131')](_0x517164,_0x27ac2c,_0x1f9dc0[_0xd38f('0x17f')],_0x1f9dc0[_0xd38f('0x5e')],undefined,!![]);};AGIVertices[_0xd38f('0xe')][_0xd38f('0x180')]=function(_0x45a627){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x181'),_0x45a627[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x45a627['url'])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0x182'));}var _0xf27388=this[_0xd38f('0x5b')][_0xd38f('0x9e')](this,_0x45a627);logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Response:',util[_0xd38f('0x183')](_0xf27388,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x45a627[_0xd38f('0xd2')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x476634=this[_0xd38f('0xf')][_0xd38f('0x9e')](this,_0x45a627[_0xd38f('0xd2')]);if(!_0x476634){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x45a627,_0xd38f('0x119'));}this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')](_0xd38f('0x184'),_0x476634),_0xf27388[_0xd38f('0x6e')]?_0xf27388['statusCode']:_0xd38f('0x185'));this[_0xd38f('0xd')][_0xd38f('0x9c')](util[_0xd38f('0x27')]('%s_STATUS_MESSAGE',_0x476634),_0xf27388[_0xd38f('0x6f')]?_0xf27388[_0xd38f('0x6f')]:'OK');if(_0xf27388['body']){try{this[_0xd38f('0x96')](_0xf27388[_0xd38f('0x6c')],_0x476634);}catch(_0x38b218){logger[_0xd38f('0x2a')](util[_0xd38f('0x27')](_0xd38f('0x186'),_0x476634));}}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util['format'](_0xd38f('0x187'),_0x476634));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x188')]=function(_0x53a055){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x189'),_0x53a055[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0x18a')](_0x53a055[_0xd38f('0x18b')][_0xd38f('0x53')](/\s+/g,''),_0x53a055[_0xd38f('0x17f')]);};AGIVertices['prototype'][_0xd38f('0x18c')]=function(_0x4d57cd){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x18d'),_0x4d57cd[_0xd38f('0x36')]));return this[_0xd38f('0xd')]['sayNumber'](_0x4d57cd[_0xd38f('0x5f')][_0xd38f('0x53')](/\s+/g,''),_0x4d57cd[_0xd38f('0x17f')]);};AGIVertices[_0xd38f('0xe')]['sayphonetic']=function(_0x3bd837){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x18e'),_0x3bd837[_0xd38f('0x36')]));return this[_0xd38f('0xd')][_0xd38f('0x18f')](_0x3bd837[_0xd38f('0x56')],_0x3bd837[_0xd38f('0x17f')]);};AGIVertices[_0xd38f('0xe')]['sendMail']=function(_0x3eff3c){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3eff3c[_0xd38f('0x36')]));if(!this[_0xd38f('0x80')](_0x3eff3c[_0xd38f('0x190')])){return this['channel'][_0xd38f('0xa2')]('no\x20mail\x20account\x20configured');}var _0x1dc9ce=this[_0xd38f('0x1f')][_0xd38f('0x9e')](this,_0x3eff3c[_0xd38f('0x190')]);if(!_0x1dc9ce||!_0x1dc9ce[_0xd38f('0x191')]){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x3eff3c,_0xd38f('0x192'));}var _0x2413d3={'from':util[_0xd38f('0x27')]('\x22%s\x22\x20<%s>',_0x1dc9ce[_0xd38f('0x12')],_0x1dc9ce[_0xd38f('0x193')]||_0x1dc9ce[_0xd38f('0x191')][_0xd38f('0x194')]),'to':_0x3eff3c['to']||'','cc':_0x3eff3c['cc']||'','bcc':_0x3eff3c['bcc']||'','subject':_0x3eff3c[_0xd38f('0x195')],'html':_0x3eff3c[_0xd38f('0x56')],'text':_0x3eff3c[_0xd38f('0x56')]};if(this[_0xd38f('0x80')](_0x3eff3c[_0xd38f('0x196')])){}logger[_0xd38f('0xd8')](_0xd38f('0x197'),JSON[_0xd38f('0x6b')](_0x2413d3));this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x3eff3c,_0x3eff3c['account_id']);this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')](_0xd38f('0x198'),_0x1dc9ce[_0xd38f('0x12')]));this[_0xd38f('0x22')]['sync'](this,_0x1dc9ce['smtpOptions'],_0x2413d3);return this[_0xd38f('0xd')][_0xd38f('0xa2')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd38f('0xe')][_0xd38f('0x199')]=function(_0x43fae2){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x19a'),_0x43fae2['label']));return this[_0xd38f('0xd')]['noop'](_0xd38f('0x19b'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x19c')]=function(_0x1ca872){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x19d'),_0x1ca872[_0xd38f('0x36')]));if(!this['isConfigured'](_0x1ca872[_0xd38f('0x19e')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x19f'));}var _0x32a0fa=this['getSmsAccount'][_0xd38f('0x9e')](this,_0x1ca872[_0xd38f('0x19e')]);if(!_0x32a0fa){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x1ca872,'no\x20sms\x20account\x20found');}var _0x11c1b5={'body':_0x1ca872['sms_text'],'phone':_0x1ca872['to']||'','SmsAccountId':_0x32a0fa['id']};logger[_0xd38f('0xd8')](_0xd38f('0x1a0'),JSON['stringify'](_0x11c1b5));this['createSquareDetailsReport'][_0xd38f('0x9e')](this,_0x1ca872,_0x1ca872['sms_account_id']);this['channel'][_0xd38f('0xa2')](util['format'](_0xd38f('0x1a1'),_0x32a0fa[_0xd38f('0x12')]));this[_0xd38f('0x33')][_0xd38f('0x9e')](this,_0x11c1b5);return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x1a2'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1a3')]=function(_0x505264){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x1a4'),_0x505264[_0xd38f('0x36')]));if(!this['isConfigured'](_0x505264[_0xd38f('0xd2')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x505264,_0xd38f('0x1a5'));}var _0x323406=this['getVariable'][_0xd38f('0x9e')](this,_0x505264[_0xd38f('0xd2')]);if(!_0x323406){return this[_0xd38f('0xd')]['error'](_0x505264,_0xd38f('0x119'));}return this[_0xd38f('0xd')]['setVariable'](_0x323406,_0x505264[_0xd38f('0x1a6')]);};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1a7')]=function(_0xdf7b8d){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x1a8'),_0xdf7b8d[_0xd38f('0x36')]));this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x1a9'));if(_0xdf7b8d[_0xd38f('0xb2')]==='yes'){this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x1aa'));return this['channel'][_0xd38f('0xb2')]();}return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0x1ab'));};AGIVertices[_0xd38f('0xe')]['subproject']=function(_0x488e67){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x488e67[_0xd38f('0x36')]));if(!this['isConfigured'](_0x488e67[_0xd38f('0x1ac')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x488e67,_0xd38f('0x1ad'));}var _0x13a361=this[_0xd38f('0x16')][_0xd38f('0x9e')](this,_0x488e67['project_id']);if(!this[_0xd38f('0x80')](_0x13a361)){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x488e67,util[_0xd38f('0x27')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x488e67[_0xd38f('0x1ac')]));}if(_0x13a361===this[_0xd38f('0xd')][_0xd38f('0x38')]){return this['channel'][_0xd38f('0x2a')](_0x488e67,_0xd38f('0x1ae'));}this['createSquareDetailsReport']['sync'](this,_0x488e67,_0x13a361);var _0x42fc4e=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0x1af'),util[_0xd38f('0x27')](_0xd38f('0x1b0'),config[_0xd38f('0xaf')][_0xd38f('0x1b1')]||_0xd38f('0x1b2'),_0x13a361,this['channel'][_0xd38f('0x38')]));if(_0x42fc4e[_0xd38f('0xa9')]===-0x1){return _0x42fc4e;}return this[_0xd38f('0xd')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xd38f('0x1af'),_0x13a361));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1b3')]=function(_0x4772ef){logger['info'](util['format'](_0xd38f('0x1b4'),_0x4772ef[_0xd38f('0x36')]));var _0x567749=this[_0xd38f('0x50')]['sync'](this,_0x4772ef[_0xd38f('0xb0')]);this[_0xd38f('0x34')][_0xd38f('0x9e')](this,_0x4772ef,_0x4772ef['command']);if(this['isConfigured'](_0x4772ef[_0xd38f('0xd2')])){var _0x556740=this[_0xd38f('0xf')][_0xd38f('0x9e')](this,_0x4772ef['variable_id']);if(_0x556740){this[_0xd38f('0xd')][_0xd38f('0x9c')](_0x556740,_0x567749);return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x1b5'),_0x4772ef['command'],_0x556740));}}return this['channel']['noop'](util[_0xd38f('0x27')](_0xd38f('0x1b6'),_0x4772ef['command']));};AGIVertices[_0xd38f('0xe')]['google_cloud_tts']=function(_0x2bab3f){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2bab3f[_0xd38f('0x36')]));_0x2bab3f[_0xd38f('0x56')]=_0x2bab3f[_0xd38f('0x56')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2bab3f[_0xd38f('0x1b7')])){return this[_0xd38f('0xd')]['noop'](_0xd38f('0x1b8'));}if(!this[_0xd38f('0x80')](_0x2bab3f[_0xd38f('0x56')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xa3'));}this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')](_0xd38f('0x1b9'),_0x2bab3f[_0xd38f('0x56')]));var _0x3200aa=this[_0xd38f('0x54')][_0xd38f('0x9e')](this,_0x2bab3f);if(_0x3200aa){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x3200aa));var _0x42a458=this['channel'][_0xd38f('0xff')](_0x3200aa);try{fs[_0xd38f('0x100')](_0x3200aa+'.wav');}catch(_0x5dca81){logger[_0xd38f('0x2a')](_0x5dca81);}return _0x42a458;}return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x2bab3f,_0xd38f('0x1ba'));};AGIVertices['prototype'][_0xd38f('0x1bb')]=function(_0x13ace5){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x1bc'),_0x13ace5[_0xd38f('0x36')]));_0x13ace5[_0xd38f('0x56')]=_0x13ace5[_0xd38f('0x56')][_0xd38f('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd38f('0x80')](_0x13ace5[_0xd38f('0x56')])){return this[_0xd38f('0xd')][_0xd38f('0xa2')](_0xd38f('0xa3'));}this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x1bd'),_0x13ace5['text']));var _0xe1ed52=this[_0xd38f('0x59')][_0xd38f('0x9e')](this,_0x13ace5);if(_0xe1ed52){this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('Google\x20TTS\x20%s\x20file\x20created',_0xe1ed52));var _0x51d40d=this[_0xd38f('0xd')][_0xd38f('0xff')](_0xe1ed52);try{fs[_0xd38f('0x100')](_0xe1ed52+'.wav');}catch(_0x6b4630){logger['error'](_0x6b4630);}return _0x51d40d;}return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x13ace5,_0xd38f('0x1be'));};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1bf')]=function(_0x3de3d3){logger[_0xd38f('0x2c')](util['format'](_0xd38f('0x1c0'),_0x3de3d3[_0xd38f('0x36')]));if(!this['isConfigured'](_0x3de3d3[_0xd38f('0x159')])){return this['channel'][_0xd38f('0x2a')](_0x3de3d3,_0xd38f('0x158'));}logger['info'](util['format'](_0xd38f('0x15e'),this[_0xd38f('0xd')][_0xd38f('0x39')],_0x3de3d3['findBy']));var _0x153cb8=this['agentUnpause'][_0xd38f('0x9e')](this,_0x3de3d3[_0xd38f('0x159')]);if(_0x153cb8){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')](_0xd38f('0x15a'),this[_0xd38f('0xd')][_0xd38f('0x39')],_0x3de3d3[_0xd38f('0x159')]));this[_0xd38f('0xd')]['noop'](util[_0xd38f('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd38f('0xd')][_0xd38f('0x39')],_0x3de3d3['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xd38f('0x27')](_0xd38f('0x15c'),this['channel'][_0xd38f('0x39')],_0x3de3d3['findBy']));this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')](_0xd38f('0x15c'),this[_0xd38f('0xd')]['callerid'],_0x3de3d3['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd38f('0xe')][_0xd38f('0x1c1')]=function(_0x191a4c){logger['info'](util[_0xd38f('0x27')](_0xd38f('0x1c2'),_0x191a4c['label']));var _0x4bbbd3=this[_0xd38f('0xd')][_0xd38f('0x51')](_0xd38f('0x1c3'),[_0x191a4c['mailbox'],_0x191a4c['options']]);if(_0x4bbbd3['result']===-0x1){return _0x4bbbd3;}return this[_0xd38f('0xd')][_0xd38f('0xa2')](util[_0xd38f('0x27')]('Executed\x20command\x20%s\x20%s',_0xd38f('0x1c3'),_0x191a4c[_0xd38f('0x1c4')]));};AGIVertices['prototype'][_0xd38f('0x1c5')]=function(_0x2fc604){logger[_0xd38f('0x2c')](util[_0xd38f('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2fc604['label']));if(!this[_0xd38f('0x80')](_0x2fc604[_0xd38f('0xd2')])){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x2fc604,_0xd38f('0x1a5'));}var _0x214fdd=this[_0xd38f('0xf')][_0xd38f('0x9e')](this,_0x2fc604['variable_id']);if(!_0x214fdd){return this[_0xd38f('0xd')][_0xd38f('0x2a')](_0x2fc604,_0xd38f('0x119'));}var _0x2b01d3=this[_0xd38f('0xd')][_0xd38f('0xf')](_0x214fdd);return{'code':0xc8,'result':_0x2b01d3['extra']?_0x2b01d3[_0xd38f('0x9a')]:'-'};};String['prototype'][_0xd38f('0x99')]=function(_0x5dfe32,_0x5eed91){return this[_0xd38f('0x98')](_0x5dfe32)[_0xd38f('0x1c6')](_0x5eed91);};module[_0xd38f('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 4692b9e..c586313 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb340=['voiceQueues','agents','channels','syncAgentConnect','bind','hanguprequest','hangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','timers','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','interface','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/voiceAgentReport'];(function(_0x254e07,_0x328606){var _0x1687bb=function(_0x26a0d6){while(--_0x26a0d6){_0x254e07['push'](_0x254e07['shift']());}};_0x1687bb(++_0x328606);}(_0xb340,0x185));var _0x0b34=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xb340[_0x134c2e];return _0x2825db;};'use strict';var util=require(_0x0b34('0x0'));var _=require(_0x0b34('0x1'));var moment=require(_0x0b34('0x2'));var ami=require(_0x0b34('0x3'));var logger=require('../../../config/logger')(_0x0b34('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x0b34('0x5'));function Acw(_0x1df291){this['voiceQueues']=_0x1df291[_0x0b34('0x6')];this[_0x0b34('0x7')]=_0x1df291['agents'];this['timers']=_0x1df291['timers'];this[_0x0b34('0x8')]={};ami['on']('agentconnect',this[_0x0b34('0x9')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0xb'),this['syncHangupRequest']['bind'](this));ami['on'](_0x0b34('0xc'),this['syncHangup'][_0x0b34('0xa')](this));ami['on']('agentringnoanswer',this[_0x0b34('0xd')][_0x0b34('0xa')](this));ami['on']('attendedtransfer',this[_0x0b34('0xe')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0xf'),this[_0x0b34('0x10')][_0x0b34('0xa')](this));ami['on'](_0x0b34('0x11'),this[_0x0b34('0x12')][_0x0b34('0xa')](this));}function getDiff(_0x1ae6bd){var _0x59b880=moment()[_0x0b34('0x13')](0x0);var _0x5c983c=moment(_0x1ae6bd)[_0x0b34('0x13')](0x0);return _0x59b880[_0x0b34('0x14')](_0x5c983c,_0x0b34('0x15'));}Acw[_0x0b34('0x16')][_0x0b34('0x17')]=function(_0x26f4e2){try{var _0x3ad3e2=this;var _0x5e4a48=this[_0x0b34('0x8')][_0x26f4e2]['interface'];var _0x308b2c=this[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x18')];var _0x3cb06c=this['voiceQueues'][_0x308b2c];var _0x22274d=![];var _0xda3d30=_0x0b34('0x19');if(_0x3cb06c[_0x0b34('0x1a')]){if(_0x3cb06c[_0x0b34('0x1b')][_0x0b34('0x1c')]){_0x22274d=!![];_0xda3d30=_0x3cb06c['mandatoryDispositionPause']['name'];}}ami['Action']({'action':'QueuePause','interface':_0x5e4a48,'paused':!![],'reason':_0xda3d30})[_0x0b34('0x1d')](function(_0x51273b){if(_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48]){return RpcUser['getAgent'](_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48]['id'])[_0x0b34('0x1d')](function(_0x34fde1){if(_0x34fde1&&!_0x34fde1['voicePause']){logger['info'](_0x0b34('0x1e'),_0x26f4e2,_0x5e4a48,_0x308b2c);var _0x5e63db=_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2]['attended']&&_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x1f')]?_0x3ad3e2[_0x0b34('0x8')][_0x26f4e2][_0x0b34('0x1f')]:_0x26f4e2;return RpcUser[_0x0b34('0x20')](_0x3ad3e2[_0x0b34('0x7')][_0x5e4a48],_0xda3d30,_0x5e63db)[_0x0b34('0x1d')](function(_0x57663a){if(!_0x22274d){_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]={};logger[_0x0b34('0x22')](_0x0b34('0x23'),_0x26f4e2,_0x3ad3e2[_0x0b34('0x6')][_0x308b2c][_0x0b34('0x24')],_0x5e4a48,_0x308b2c);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x25')]=setTimeout(_0x3ad3e2[_0x0b34('0x26')][_0x0b34('0xa')](_0x3ad3e2,_0x5e4a48),_0x3ad3e2['voiceQueues'][_0x308b2c][_0x0b34('0x24')]*0x3e8);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x27')]=moment()[_0x0b34('0x28')](_0x0b34('0x29'));_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['uniqueid']=_0x26f4e2;_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['queue']=_0x308b2c;_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x2a')]=function(){var _0x322a93=getDiff(_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['lastPauseAt']);clearTimeout(_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48]['timer']);_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x25')]=![];RpcVoiceAgentReport[_0x0b34('0x2b')]({'acwtime':_0x322a93},_0x3ad3e2[_0x0b34('0x21')][_0x5e4a48][_0x0b34('0x2c')],_0x5e4a48)['then'](function(_0x73285d){logger[_0x0b34('0x22')](_0x0b34('0x2d'),_0x26f4e2,_0x322a93,_0x73285d);})['catch'](function(_0x1c2932){logger[_0x0b34('0x2e')](_0x0b34('0x2f'),_0x26f4e2,_0x1c2932);});delete _0x3ad3e2[_0x0b34('0x21')][_0x5e4a48];};}});}else{logger[_0x0b34('0x22')](_0x0b34('0x30'),_0x26f4e2,_0x5e4a48,_0x308b2c);}});}})['catch'](function(_0x2e063b){logger[_0x0b34('0x2e')](_0x0b34('0x23'),_0x26f4e2,_0x3ad3e2[_0x0b34('0x6')][_0x308b2c][_0x0b34('0x24')],_0x5e4a48,_0x308b2c);})[_0x0b34('0x31')](function(){delete _0x3ad3e2[_0x0b34('0x8')][_0x26f4e2];});}catch(_0x5a4dbc){logger[_0x0b34('0x2e')](_0x0b34('0x32'),_0x5a4dbc['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x26')]=function(_0x35816d){try{var _0x367724=this;if(_0x367724[_0x0b34('0x21')][_0x35816d]){_0x367724[_0x0b34('0x21')][_0x35816d][_0x0b34('0x25')]=![];var _0x39f1e8=_0x367724[_0x0b34('0x21')][_0x35816d][_0x0b34('0x2c')];var _0x5e1f19=_0x367724['timers'][_0x35816d][_0x0b34('0x18')];var _0x3ea385=_0x367724[_0x0b34('0x6')][_0x5e1f19][_0x0b34('0x24')];logger[_0x0b34('0x22')](_0x0b34('0x33'),_0x39f1e8,_0x35816d);RpcUser['saveUnpause'](this[_0x0b34('0x7')][_0x35816d]);RpcVoiceAgentReport[_0x0b34('0x2b')]({'acwtime':_0x3ea385,'agentacw':!![]},_0x39f1e8,_0x35816d)[_0x0b34('0x1d')](function(_0x32c049){logger[_0x0b34('0x22')](_0x0b34('0x2d'),_0x39f1e8,_0x3ea385,_0x32c049);})[_0x0b34('0x34')](function(_0x370ab8){logger[_0x0b34('0x2e')](_0x0b34('0x2f'),_0x39f1e8,_0x370ab8);});}else{logger[_0x0b34('0x2e')](_0x0b34('0x35'),_0x35816d);if(_0x367724['timers']){logger[_0x0b34('0x22')]('[ACW][TIMERS]',JSON['stringify'](_0x367724['timers']));}}}catch(_0x271246){logger[_0x0b34('0x2e')]('[ACW][STOP]\x20%s',_0x271246['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x9')]=function(_0x179bdb){try{if(this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]]&&(this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]][_0x0b34('0x4')]||this[_0x0b34('0x6')][_0x179bdb[_0x0b34('0x18')]][_0x0b34('0x1a')])){if(this[_0x0b34('0x7')][_0x179bdb[_0x0b34('0x36')]]){this[_0x0b34('0x8')][_0x179bdb[_0x0b34('0x2c')]]={'queue':_0x179bdb[_0x0b34('0x18')],'interface':_0x179bdb[_0x0b34('0x36')],'destlinkedid':_0x179bdb[_0x0b34('0x1f')]};}}}catch(_0x2507b3){logger[_0x0b34('0x2e')](_0x0b34('0x37'),_0x2507b3[_0x0b34('0x38')]);}};Acw['prototype'][_0x0b34('0x12')]=function(_0x1c1a6d){try{if(this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]]&&(this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]][_0x0b34('0x4')]||this[_0x0b34('0x6')][_0x1c1a6d[_0x0b34('0x18')]][_0x0b34('0x1a')])){if(this[_0x0b34('0x7')][_0x1c1a6d[_0x0b34('0x36')]]){this[_0x0b34('0x8')][_0x1c1a6d[_0x0b34('0x2c')]]={'queue':_0x1c1a6d[_0x0b34('0x18')],'interface':_0x1c1a6d[_0x0b34('0x36')]};}}}catch(_0x392d24){logger[_0x0b34('0x2e')](_0x0b34('0x39'),_0x392d24['message']);}};Acw['prototype'][_0x0b34('0x3a')]=function(_0x10862c){try{if(this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x2c')]]&&_['isUndefined'](this[_0x0b34('0x8')][_0x10862c['uniqueid']][_0x0b34('0x3b')])){logger[_0x0b34('0x22')](_0x0b34('0x3c'),_0x10862c[_0x0b34('0x2c')]);this[_0x0b34('0x17')](_0x10862c[_0x0b34('0x2c')]);}else if(this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x3d')]]&&_[_0x0b34('0x3e')](this[_0x0b34('0x8')][_0x10862c[_0x0b34('0x3d')]][_0x0b34('0x3b')])){logger[_0x0b34('0x22')](_0x0b34('0x3f'),_0x10862c[_0x0b34('0x3d')]);this[_0x0b34('0x17')](_0x10862c[_0x0b34('0x3d')]);}}catch(_0x286a0e){logger[_0x0b34('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x286a0e[_0x0b34('0x38')]);}};Acw['prototype'][_0x0b34('0x40')]=function(_0xfa62e6){try{if(this[_0x0b34('0x8')][_0xfa62e6['uniqueid']]&&this[_0x0b34('0x8')][_0xfa62e6['uniqueid']][_0x0b34('0x3b')]){logger[_0x0b34('0x22')](_0x0b34('0x41'),_0xfa62e6[_0x0b34('0x2c')]);this[_0x0b34('0x17')](_0xfa62e6[_0x0b34('0x2c')]);}else if(this[_0x0b34('0x8')][_0xfa62e6[_0x0b34('0x3d')]]&&this[_0x0b34('0x8')][_0xfa62e6['linkedid']][_0x0b34('0x3b')]){logger[_0x0b34('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xfa62e6[_0x0b34('0x3d')]);this[_0x0b34('0x17')](_0xfa62e6['linkedid']);}}catch(_0x5a8cb0){logger[_0x0b34('0x2e')](_0x0b34('0x42'),_0x5a8cb0[_0x0b34('0x38')]);}};Acw[_0x0b34('0x16')][_0x0b34('0xe')]=function(_0x59e685){try{if(!_[_0x0b34('0x43')](this[_0x0b34('0x8')][_0x59e685['transfereeuniqueid']])){this[_0x0b34('0x17')](_0x59e685[_0x0b34('0x44')]);if(this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x45')]]){this['channels'][_0x59e685[_0x0b34('0x45')]][_0x0b34('0x3b')]=!![];this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x46')]]=this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x45')]];delete this[_0x0b34('0x8')][_0x59e685['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x46')]])){this[_0x0b34('0x17')](_0x59e685[_0x0b34('0x46')]);if(this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]]){this[_0x0b34('0x8')][_0x59e685['origtransfereruniqueid']][_0x0b34('0x3b')]=!![];this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x44')]]=this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]];delete this[_0x0b34('0x8')][_0x59e685[_0x0b34('0x47')]];}}}catch(_0x361782){logger[_0x0b34('0x2e')]('[ACW][syncAttendedTransfer]\x20%s',_0x361782['message']);}};Acw[_0x0b34('0x16')][_0x0b34('0x10')]=function(_0x3392c9){try{if(this[_0x0b34('0x8')][_0x3392c9[_0x0b34('0x48')]]){logger[_0x0b34('0x22')](_0x0b34('0x49'),JSON[_0x0b34('0x4a')](_0x3392c9[_0x0b34('0x48')]));this['startAcw'](_0x3392c9['transfereruniqueid']);}else if(this[_0x0b34('0x8')][_0x3392c9[_0x0b34('0x4b')]]){logger[_0x0b34('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x0b34('0x4a')](_0x3392c9[_0x0b34('0x4b')]));this[_0x0b34('0x17')](_0x3392c9[_0x0b34('0x4b')]);}}catch(_0x4376a2){logger[_0x0b34('0x2e')](_0x0b34('0x4c'),_0x4376a2[_0x0b34('0x38')]);}};Acw[_0x0b34('0x16')]['syncAgentRingNoAnswer']=function(_0x27f552){try{if(this[_0x0b34('0x6')][_0x27f552['queue']]&&this['voiceQueues'][_0x27f552[_0x0b34('0x18')]]['autopause']==='all'){if(this['agents'][_0x27f552[_0x0b34('0x36')]]){logger[_0x0b34('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x27f552[_0x0b34('0x2c')],_0x27f552[_0x0b34('0x36')],_0x27f552[_0x0b34('0x18')]);return RpcUser[_0x0b34('0x20')](this[_0x0b34('0x7')][_0x27f552[_0x0b34('0x36')]],_0x0b34('0x4d'),_0x27f552[_0x0b34('0x2c')]);}}}catch(_0x25f50f){logger[_0x0b34('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x25f50f['message']);}};module[_0x0b34('0x4e')]=Acw; \ No newline at end of file +var _0x8d43=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','interface','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','isNil','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','agents','timers','channels','agentconnect','syncAgentConnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','milliseconds','diff','seconds','startAcw','queue','voiceQueues','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error'];(function(_0x1d6d92,_0x2e6f0b){var _0x31ef3a=function(_0x134f39){while(--_0x134f39){_0x1d6d92['push'](_0x1d6d92['shift']());}};_0x31ef3a(++_0x2e6f0b);}(_0x8d43,0x18d));var _0x38d4=function(_0x235ee5,_0x44639b){_0x235ee5=_0x235ee5-0x0;var _0x178b04=_0x8d43[_0x235ee5];return _0x178b04;};'use strict';var util=require('util');var _=require(_0x38d4('0x0'));var moment=require(_0x38d4('0x1'));var ami=require(_0x38d4('0x2'));var logger=require(_0x38d4('0x3'))(_0x38d4('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x38d4('0x5'));function Acw(_0x1c3166){this['voiceQueues']=_0x1c3166['voiceQueues'];this[_0x38d4('0x6')]=_0x1c3166[_0x38d4('0x6')];this['timers']=_0x1c3166[_0x38d4('0x7')];this[_0x38d4('0x8')]={};ami['on'](_0x38d4('0x9'),this[_0x38d4('0xa')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x38d4('0xb')](this));ami['on'](_0x38d4('0xc'),this['syncHangup']['bind'](this));ami['on'](_0x38d4('0xd'),this[_0x38d4('0xe')][_0x38d4('0xb')](this));ami['on'](_0x38d4('0xf'),this[_0x38d4('0x10')][_0x38d4('0xb')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x38d4('0xb')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x2b5746){var _0xee9bbb=moment()[_0x38d4('0x11')](0x0);var _0x45abca=moment(_0x2b5746)[_0x38d4('0x11')](0x0);return _0xee9bbb[_0x38d4('0x12')](_0x45abca,_0x38d4('0x13'));}Acw['prototype'][_0x38d4('0x14')]=function(_0x2eb0c4){try{var _0x58f9ea=this;var _0xbe7c16=this[_0x38d4('0x8')][_0x2eb0c4]['interface'];var _0x295b80=this['channels'][_0x2eb0c4][_0x38d4('0x15')];var _0x444750=this[_0x38d4('0x16')][_0x295b80];var _0x4c012f=![];var _0x43b002=_0x38d4('0x17');if(_0x444750[_0x38d4('0x18')]){if(_0x444750[_0x38d4('0x19')][_0x38d4('0x1a')]){_0x4c012f=!![];_0x43b002=_0x444750[_0x38d4('0x19')]['name'];}}ami[_0x38d4('0x1b')]({'action':'QueuePause','interface':_0xbe7c16,'paused':!![],'reason':_0x43b002})[_0x38d4('0x1c')](function(_0x42f6bc){if(_0x58f9ea[_0x38d4('0x6')][_0xbe7c16]){return RpcUser[_0x38d4('0x1d')](_0x58f9ea['agents'][_0xbe7c16]['id'])[_0x38d4('0x1c')](function(_0xa0f9f8){if(_0xa0f9f8&&!_0xa0f9f8[_0x38d4('0x1e')]){logger[_0x38d4('0x1f')](_0x38d4('0x20'),_0x2eb0c4,_0xbe7c16,_0x295b80);var _0x27da5b=_0x58f9ea[_0x38d4('0x8')][_0x2eb0c4]['attended']&&_0x58f9ea['channels'][_0x2eb0c4][_0x38d4('0x21')]?_0x58f9ea[_0x38d4('0x8')][_0x2eb0c4][_0x38d4('0x21')]:_0x2eb0c4;return RpcUser[_0x38d4('0x22')](_0x58f9ea[_0x38d4('0x6')][_0xbe7c16],_0x43b002,_0x27da5b)[_0x38d4('0x1c')](function(_0x38d14f){if(!_0x4c012f){_0x58f9ea[_0x38d4('0x7')][_0xbe7c16]={};logger[_0x38d4('0x1f')](_0x38d4('0x23'),_0x2eb0c4,_0x58f9ea[_0x38d4('0x16')][_0x295b80][_0x38d4('0x24')],_0xbe7c16,_0x295b80);_0x58f9ea[_0x38d4('0x7')][_0xbe7c16]['timer']=setTimeout(_0x58f9ea[_0x38d4('0x25')][_0x38d4('0xb')](_0x58f9ea,_0xbe7c16),_0x58f9ea[_0x38d4('0x16')][_0x295b80][_0x38d4('0x24')]*0x3e8);_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x26')]=moment()[_0x38d4('0x27')](_0x38d4('0x28'));_0x58f9ea['timers'][_0xbe7c16][_0x38d4('0x29')]=_0x2eb0c4;_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x15')]=_0x295b80;_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x2a')]=function(){var _0x16219c=getDiff(_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x26')]);clearTimeout(_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x2b')]);_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x2b')]=![];RpcVoiceAgentReport[_0x38d4('0x2c')]({'acwtime':_0x16219c},_0x58f9ea[_0x38d4('0x7')][_0xbe7c16][_0x38d4('0x29')],_0xbe7c16)[_0x38d4('0x1c')](function(_0x4cd04a){logger[_0x38d4('0x1f')](_0x38d4('0x2d'),_0x2eb0c4,_0x16219c,_0x4cd04a);})[_0x38d4('0x2e')](function(_0x217aa3){logger[_0x38d4('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x2eb0c4,_0x217aa3);});delete _0x58f9ea[_0x38d4('0x7')][_0xbe7c16];};}});}else{logger[_0x38d4('0x1f')](_0x38d4('0x30'),_0x2eb0c4,_0xbe7c16,_0x295b80);}});}})[_0x38d4('0x2e')](function(_0x5f5a88){logger[_0x38d4('0x2f')](_0x38d4('0x23'),_0x2eb0c4,_0x58f9ea[_0x38d4('0x16')][_0x295b80]['acwTimeout'],_0xbe7c16,_0x295b80);})[_0x38d4('0x31')](function(){delete _0x58f9ea[_0x38d4('0x8')][_0x2eb0c4];});}catch(_0x5eb52b){logger['error'](_0x38d4('0x32'),_0x5eb52b[_0x38d4('0x33')]);}};Acw[_0x38d4('0x34')][_0x38d4('0x25')]=function(_0x545310){try{var _0x2ab72c=this;if(_0x2ab72c[_0x38d4('0x7')][_0x545310]){_0x2ab72c[_0x38d4('0x7')][_0x545310]['timer']=![];var _0x15dc7a=_0x2ab72c[_0x38d4('0x7')][_0x545310][_0x38d4('0x29')];var _0x320a19=_0x2ab72c[_0x38d4('0x7')][_0x545310][_0x38d4('0x15')];var _0x5bfc3f=_0x2ab72c[_0x38d4('0x16')][_0x320a19][_0x38d4('0x24')];logger[_0x38d4('0x1f')](_0x38d4('0x35'),_0x15dc7a,_0x545310);RpcUser[_0x38d4('0x36')](this['agents'][_0x545310]);RpcVoiceAgentReport['update']({'acwtime':_0x5bfc3f,'agentacw':!![]},_0x15dc7a,_0x545310)['then'](function(_0x84e9a9){logger['info'](_0x38d4('0x2d'),_0x15dc7a,_0x5bfc3f,_0x84e9a9);})[_0x38d4('0x2e')](function(_0x3b5f84){logger['error'](_0x38d4('0x37'),_0x15dc7a,_0x3b5f84);});}else{logger[_0x38d4('0x2f')](_0x38d4('0x38'),_0x545310);if(_0x2ab72c[_0x38d4('0x7')]){logger['info'](_0x38d4('0x39'),JSON['stringify'](_0x2ab72c[_0x38d4('0x7')]));}}}catch(_0x27f3ac){logger[_0x38d4('0x2f')](_0x38d4('0x3a'),_0x27f3ac[_0x38d4('0x33')]);}};Acw['prototype'][_0x38d4('0xa')]=function(_0xb7ed82){try{if(this[_0x38d4('0x16')][_0xb7ed82[_0x38d4('0x15')]]&&(this[_0x38d4('0x16')][_0xb7ed82[_0x38d4('0x15')]][_0x38d4('0x4')]||this[_0x38d4('0x16')][_0xb7ed82['queue']][_0x38d4('0x18')])){if(this[_0x38d4('0x6')][_0xb7ed82[_0x38d4('0x3b')]]){this[_0x38d4('0x8')][_0xb7ed82[_0x38d4('0x29')]]={'queue':_0xb7ed82['queue'],'interface':_0xb7ed82['interface'],'destlinkedid':_0xb7ed82['destlinkedid']};}}}catch(_0x1bd41d){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x1bd41d['message']);}};Acw[_0x38d4('0x34')][_0x38d4('0x3c')]=function(_0x58d913){try{if(this[_0x38d4('0x16')][_0x58d913[_0x38d4('0x15')]]&&(this[_0x38d4('0x16')][_0x58d913[_0x38d4('0x15')]][_0x38d4('0x4')]||this[_0x38d4('0x16')][_0x58d913[_0x38d4('0x15')]][_0x38d4('0x18')])){if(this[_0x38d4('0x6')][_0x58d913['interface']]){this[_0x38d4('0x8')][_0x58d913[_0x38d4('0x29')]]={'queue':_0x58d913[_0x38d4('0x15')],'interface':_0x58d913['interface']};}}}catch(_0xb9eb69){logger[_0x38d4('0x2f')](_0x38d4('0x3d'),_0xb9eb69[_0x38d4('0x33')]);}};Acw['prototype'][_0x38d4('0x3e')]=function(_0x14a7a0){try{if(this[_0x38d4('0x8')][_0x14a7a0[_0x38d4('0x29')]]&&_[_0x38d4('0x3f')](this[_0x38d4('0x8')][_0x14a7a0[_0x38d4('0x29')]][_0x38d4('0x40')])){logger[_0x38d4('0x1f')](_0x38d4('0x41'),_0x14a7a0[_0x38d4('0x29')]);this[_0x38d4('0x14')](_0x14a7a0[_0x38d4('0x29')]);}else if(this[_0x38d4('0x8')][_0x14a7a0[_0x38d4('0x42')]]&&_[_0x38d4('0x3f')](this['channels'][_0x14a7a0[_0x38d4('0x42')]][_0x38d4('0x40')])){logger[_0x38d4('0x1f')](_0x38d4('0x43'),_0x14a7a0[_0x38d4('0x42')]);this[_0x38d4('0x14')](_0x14a7a0[_0x38d4('0x42')]);}}catch(_0x2f7998){logger[_0x38d4('0x2f')](_0x38d4('0x44'),_0x2f7998[_0x38d4('0x33')]);}};Acw['prototype'][_0x38d4('0x45')]=function(_0x2bfcda){try{if(this['channels'][_0x2bfcda[_0x38d4('0x29')]]&&this[_0x38d4('0x8')][_0x2bfcda[_0x38d4('0x29')]][_0x38d4('0x40')]){logger['info'](_0x38d4('0x46'),_0x2bfcda[_0x38d4('0x29')]);this['startAcw'](_0x2bfcda['uniqueid']);}else if(this[_0x38d4('0x8')][_0x2bfcda[_0x38d4('0x42')]]&&this[_0x38d4('0x8')][_0x2bfcda['linkedid']][_0x38d4('0x40')]){logger[_0x38d4('0x1f')](_0x38d4('0x47'),_0x2bfcda['linkedid']);this['startAcw'](_0x2bfcda['linkedid']);}}catch(_0x26df47){logger[_0x38d4('0x2f')](_0x38d4('0x48'),_0x26df47[_0x38d4('0x33')]);}};Acw[_0x38d4('0x34')][_0x38d4('0x10')]=function(_0x294095){try{if(!_['isNil'](this[_0x38d4('0x8')][_0x294095[_0x38d4('0x49')]])){this[_0x38d4('0x14')](_0x294095[_0x38d4('0x49')]);if(this[_0x38d4('0x8')][_0x294095[_0x38d4('0x4a')]]){this[_0x38d4('0x8')][_0x294095['secondtransfereruniqueid']][_0x38d4('0x40')]=!![];this[_0x38d4('0x8')][_0x294095['transfertargetuniqueid']]=this[_0x38d4('0x8')][_0x294095[_0x38d4('0x4a')]];delete this['channels'][_0x294095[_0x38d4('0x4a')]];}}else if(!_[_0x38d4('0x4b')](this[_0x38d4('0x8')][_0x294095['transfertargetuniqueid']])){this['startAcw'](_0x294095[_0x38d4('0x4c')]);if(this[_0x38d4('0x8')][_0x294095[_0x38d4('0x4d')]]){this['channels'][_0x294095['origtransfereruniqueid']]['attended']=!![];this[_0x38d4('0x8')][_0x294095['transfereeuniqueid']]=this[_0x38d4('0x8')][_0x294095['origtransfereruniqueid']];delete this[_0x38d4('0x8')][_0x294095[_0x38d4('0x4d')]];}}}catch(_0x486bb1){logger[_0x38d4('0x2f')]('[ACW][syncAttendedTransfer]\x20%s',_0x486bb1[_0x38d4('0x33')]);}};Acw[_0x38d4('0x34')][_0x38d4('0x4e')]=function(_0x23cbb6){try{if(this[_0x38d4('0x8')][_0x23cbb6[_0x38d4('0x4f')]]){logger[_0x38d4('0x1f')](_0x38d4('0x50'),JSON[_0x38d4('0x51')](_0x23cbb6[_0x38d4('0x4f')]));this['startAcw'](_0x23cbb6[_0x38d4('0x4f')]);}else if(this['channels'][_0x23cbb6['transfererlinkedid']]){logger['info'](_0x38d4('0x52'),JSON[_0x38d4('0x51')](_0x23cbb6[_0x38d4('0x53')]));this[_0x38d4('0x14')](_0x23cbb6[_0x38d4('0x53')]);}}catch(_0x1dc70d){logger[_0x38d4('0x2f')](_0x38d4('0x54'),_0x1dc70d[_0x38d4('0x33')]);}};Acw['prototype'][_0x38d4('0xe')]=function(_0x456227){try{if(this['voiceQueues'][_0x456227[_0x38d4('0x15')]]&&this['voiceQueues'][_0x456227[_0x38d4('0x15')]][_0x38d4('0x55')]==='all'){if(this[_0x38d4('0x6')][_0x456227[_0x38d4('0x3b')]]){logger[_0x38d4('0x1f')](_0x38d4('0x56'),_0x456227[_0x38d4('0x29')],_0x456227[_0x38d4('0x3b')],_0x456227[_0x38d4('0x15')]);return RpcUser[_0x38d4('0x22')](this[_0x38d4('0x6')][_0x456227[_0x38d4('0x3b')]],'Auto-Pause',_0x456227[_0x38d4('0x29')]);}}}catch(_0x13ab51){logger[_0x38d4('0x2f')](_0x38d4('0x57'),_0x13ab51[_0x38d4('0x33')]);}};module[_0x38d4('0x58')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 0696f26..8ef1732 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x30d929,_0x2fd4f1){var _0x2e8b21=function(_0x2b2b71){while(--_0x2b2b71){_0x30d929['push'](_0x30d929['shift']());}};_0x2e8b21(++_0x2fd4f1);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file +var _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2032,0xd9));var _0x2203=function(_0x564134,_0x23bf09){_0x564134=_0x564134-0x0;var _0x25ef44=_0x2032[_0x564134];return _0x25ef44;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 08a2efe..002e325 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x323c7e,_0x3d16ec){var _0x2b0f72=function(_0x5a2310){while(--_0x5a2310){_0x323c7e['push'](_0x323c7e['shift']());}};_0x2b0f72(++_0x3d16ec);}(_0xac4a,0x13f));var _0xaac4=function(_0x3f330d,_0x28c2bd){_0x3f330d=_0x3f330d-0x0;var _0xc85453=_0xac4a[_0x3f330d];return _0xc85453;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0xe706,0xa3));var _0x6e70=function(_0x44654c,_0x926d31){_0x44654c=_0x44654c-0x0;var _0x2ecdea=_0xe706[_0x44654c];return _0x2ecdea;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index d86555f..ab1669c 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e7d=['\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0x5e7d,0x15c));var _0xd5e7=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x5e7d[_0x1aeda2];return _0x32dc6d;};'use strict';var util=require(_0xd5e7('0x0'));var _=require(_0xd5e7('0x1'));var moment=require(_0xd5e7('0x2'));function checkNameSurname(_0x62e30b,_0x43006f,_0x31735e){var _0x28c8fb='';if(!_['isNil'](_0x43006f)&&_0xd5e7('0x3')===typeof _0x43006f){_0x28c8fb+=_0x43006f;}if(!_[_0xd5e7('0x4')](_0x31735e)&&_0xd5e7('0x3')===typeof _0x31735e){_0x28c8fb+='\x20'+_0x31735e;}if(_0x28c8fb!==''){return _0x28c8fb;}return _0x62e30b;}function Action(_0x34118f,_0x527935,_0x4242ba){this[_0xd5e7('0x5')]=_0x34118f;this[_0xd5e7('0x6')]=_0x4242ba||undefined;this[_0xd5e7('0x7')]=checkNameSurname(_0x527935[_0xd5e7('0x8')]['phone'],_0x527935[_0xd5e7('0x8')][_0xd5e7('0x9')],_0x527935[_0xd5e7('0x8')][_0xd5e7('0xa')]);this[_0xd5e7('0xb')]=_0x527935[_0xd5e7('0xc')];this[_0xd5e7('0xd')]=_0x34118f[_0xd5e7('0x7')];this[_0xd5e7('0xe')]=_0x527935[_0xd5e7('0xe')]||![];this['type']=_0x34118f[_0xd5e7('0xf')];this[_0xd5e7('0x10')]=_0x34118f['dialQueueTimeout']||0x3;this['scheduledat']=_0x527935['scheduledat'];this[_0xd5e7('0x11')]=_0x527935[_0xd5e7('0x11')];this[_0xd5e7('0x12')]=_0x527935[_0xd5e7('0x12')];this[_0xd5e7('0x13')]=_0x527935[_0xd5e7('0x13')];this[_0xd5e7('0x14')]=_0x527935[_0xd5e7('0x14')];this['countdropretry']=_0x527935[_0xd5e7('0x15')];this[_0xd5e7('0x16')]=_0x527935[_0xd5e7('0x16')];this[_0xd5e7('0x17')]=_0x527935[_0xd5e7('0x17')];this[_0xd5e7('0x18')]=_0x527935[_0xd5e7('0x18')];this[_0xd5e7('0x19')]=_0x527935[_0xd5e7('0x19')];this[_0xd5e7('0x1a')]=_0x527935[_0xd5e7('0x1a')];this[_0xd5e7('0x1b')]=_0x527935[_0xd5e7('0x1b')];this[_0xd5e7('0x1c')]=_0x527935[_0xd5e7('0x1c')];this[_0xd5e7('0x1d')]=_0x527935[_0xd5e7('0x1d')];this[_0xd5e7('0x1e')]=_0x527935['id'];this[_0xd5e7('0x1f')]=_0x527935[_0xd5e7('0x8')]['firstName']||'';this[_0xd5e7('0x20')]=moment()[_0xd5e7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x527935['callback'];this[_0xd5e7('0x22')]=_0x527935[_0xd5e7('0x22')];this[_0xd5e7('0x23')]=_0x527935[_0xd5e7('0x23')];this[_0xd5e7('0x24')]=_0x527935[_0xd5e7('0x24')];this[_0xd5e7('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0xd5e7('0x26')]=function(){return util[_0xd5e7('0x21')](_0xd5e7('0x27'),this[_0xd5e7('0x7')],this['voiceQueue'][_0xd5e7('0x28')]>0x0?this[_0xd5e7('0xb')][_0xd5e7('0x29')](this[_0xd5e7('0x5')][_0xd5e7('0x28')]):this['number']);};Action[_0xd5e7('0x2a')]['getQueue']=function(){return this[_0xd5e7('0xd')];};module['exports']=Action; \ No newline at end of file +var _0xfa7f=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x31cdf8,_0xe4a1dc){var _0x4c3482=function(_0x59e604){while(--_0x59e604){_0x31cdf8['push'](_0x31cdf8['shift']());}};_0x4c3482(++_0xe4a1dc);}(_0xfa7f,0x97));var _0xffa7=function(_0x1c478b,_0x36f77b){_0x1c478b=_0x1c478b-0x0;var _0x410de3=_0xfa7f[_0x1c478b];return _0x410de3;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x10f182,_0x6c92c2,_0x1615a8){var _0x163b86='';if(!_[_0xffa7('0x0')](_0x6c92c2)&&_0xffa7('0x1')===typeof _0x6c92c2){_0x163b86+=_0x6c92c2;}if(!_[_0xffa7('0x0')](_0x1615a8)&&'string'===typeof _0x1615a8){_0x163b86+='\x20'+_0x1615a8;}if(_0x163b86!==''){return _0x163b86;}return _0x10f182;}function Action(_0x4a0c7b,_0x16ea1f,_0x47d43d){this[_0xffa7('0x2')]=_0x4a0c7b;this['uniqueid']=_0x47d43d||undefined;this[_0xffa7('0x3')]=checkNameSurname(_0x16ea1f[_0xffa7('0x4')][_0xffa7('0x5')],_0x16ea1f[_0xffa7('0x4')][_0xffa7('0x6')],_0x16ea1f[_0xffa7('0x4')][_0xffa7('0x7')]);this[_0xffa7('0x8')]=_0x16ea1f[_0xffa7('0x5')];this[_0xffa7('0x9')]=_0x4a0c7b[_0xffa7('0x3')];this[_0xffa7('0xa')]=_0x16ea1f['active']||![];this['type']=_0x4a0c7b[_0xffa7('0xb')];this['dialQueueTimeout']=_0x4a0c7b[_0xffa7('0xc')]||0x3;this[_0xffa7('0xd')]=_0x16ea1f[_0xffa7('0xd')];this[_0xffa7('0xe')]=_0x16ea1f[_0xffa7('0xe')];this[_0xffa7('0xf')]=_0x16ea1f[_0xffa7('0xf')];this['countnoanswerretry']=_0x16ea1f[_0xffa7('0x10')];this['countnosuchnumberretry']=_0x16ea1f['countnosuchnumberretry'];this[_0xffa7('0x11')]=_0x16ea1f[_0xffa7('0x11')];this[_0xffa7('0x12')]=_0x16ea1f[_0xffa7('0x12')];this[_0xffa7('0x13')]=_0x16ea1f[_0xffa7('0x13')];this[_0xffa7('0x14')]=_0x16ea1f[_0xffa7('0x14')];this[_0xffa7('0x15')]=_0x16ea1f[_0xffa7('0x15')];this[_0xffa7('0x16')]=_0x16ea1f[_0xffa7('0x16')];this[_0xffa7('0x17')]=_0x16ea1f['UserId'];this[_0xffa7('0x18')]=_0x16ea1f[_0xffa7('0x18')];this[_0xffa7('0x19')]=_0x16ea1f[_0xffa7('0x19')];this[_0xffa7('0x1a')]=_0x16ea1f['id'];this[_0xffa7('0x1b')]=_0x16ea1f['Contact'][_0xffa7('0x6')]||'';this[_0xffa7('0x1c')]=moment()[_0xffa7('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xffa7('0x1e')]=_0x16ea1f[_0xffa7('0x1e')];this[_0xffa7('0x1f')]=_0x16ea1f[_0xffa7('0x1f')];this[_0xffa7('0x20')]=_0x16ea1f[_0xffa7('0x20')];this['recallme']=_0x16ea1f['recallme'];this[_0xffa7('0x21')]='';this[_0xffa7('0x22')]='';}Action[_0xffa7('0x23')][_0xffa7('0x24')]=function(){return util['format'](_0xffa7('0x25'),this[_0xffa7('0x3')],this[_0xffa7('0x2')][_0xffa7('0x26')]>0x0?this[_0xffa7('0x8')]['substring'](this[_0xffa7('0x2')][_0xffa7('0x26')]):this['number']);};Action[_0xffa7('0x23')][_0xffa7('0x27')]=function(){return this[_0xffa7('0x9')];};module[_0xffa7('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b19410b..3f8275b 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8559=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number'];(function(_0x469014,_0x23f83b){var _0x24d9dd=function(_0x422065){while(--_0x422065){_0x469014['push'](_0x469014['shift']());}};_0x24d9dd(++_0x23f83b);}(_0x8559,0x6c));var _0x9855=function(_0x510247,_0x1bd049){_0x510247=_0x510247-0x0;var _0x180200=_0x8559[_0x510247];return _0x180200;};'use strict';var util=require(_0x9855('0x0'));var _=require(_0x9855('0x1'));var moment=require(_0x9855('0x2'));function getSeconds(_0x20f503,_0x3839d2){var _0x9b59d5=moment(_0x20f503)['milliseconds'](0x0);var _0x4c8de7=moment(_0x3839d2)['milliseconds'](0x0);return _0x9b59d5['diff'](_0x4c8de7,_0x9855('0x3'));}function AgentComplete(_0x280c08,_0x3dc6fa){this[_0x9855('0x4')]=0x4;this[_0x9855('0x5')]=_0x9855('0x6');this['scheduledat']=_0x280c08[_0x9855('0x7')];this[_0x9855('0x8')]=_0x280c08[_0x9855('0x8')];this['campaigntype']=_0x280c08[_0x9855('0x8')]===_0x9855('0x9')?_0x9855('0xa'):_0x280c08[_0x9855('0x8')];this[_0x9855('0xb')]=_0x280c08['countbusyretry'];this[_0x9855('0xc')]=_0x280c08[_0x9855('0xc')];this[_0x9855('0xd')]=_0x280c08['countnoanswerretry'];this[_0x9855('0xe')]=_0x280c08[_0x9855('0xb')]+_0x280c08['countcongestionretry']+_0x280c08[_0x9855('0xd')]+_0x280c08[_0x9855('0xf')]+_0x280c08[_0x9855('0x10')]+_0x280c08[_0x9855('0x11')]+_0x280c08[_0x9855('0x12')]+_0x280c08[_0x9855('0x13')];this['countnosuchnumberretry']=_0x280c08[_0x9855('0xf')];this['countdropretry']=_0x280c08[_0x9855('0x10')];this['countabandonedretry']=_0x280c08[_0x9855('0x11')];this[_0x9855('0x12')]=_0x280c08[_0x9855('0x12')];this[_0x9855('0x13')]=_0x280c08[_0x9855('0x13')];this['uniqueid']=_0x3dc6fa[_0x9855('0x14')];this[_0x9855('0x15')]=_0x280c08[_0x9855('0x16')];this['calleridnum']=_0x280c08[_0x9855('0x17')];this[_0x9855('0x18')]=_0x280c08[_0x9855('0x18')];this[_0x9855('0x19')]=_0x280c08[_0x9855('0x19')];this['answertime']=_0x280c08[_0x9855('0x1a')];this[_0x9855('0x1b')]=moment()[_0x9855('0x1c')](_0x9855('0x1d'));this[_0x9855('0x1e')]=getSeconds(_0x280c08[_0x9855('0x19')],_0x280c08['starttime']);this['holdtime']=getSeconds(_0x280c08[_0x9855('0x1a')],_0x280c08[_0x9855('0x19')]);this['talktime']=getSeconds(this[_0x9855('0x1b')],_0x280c08[_0x9855('0x1a')]);this[_0x9855('0xa')]=_0x3dc6fa[_0x9855('0xa')];this[_0x9855('0x1f')]=_0x3dc6fa[_0x9855('0x1f')];this[_0x9855('0x20')]=_0x3dc6fa[_0x9855('0x20')];this[_0x9855('0x21')]=_0x280c08['callback'];this[_0x9855('0x22')]=_0x280c08[_0x9855('0x22')];this[_0x9855('0x23')]=_0x280c08[_0x9855('0x23')];this[_0x9855('0x24')]=_0x280c08[_0x9855('0x24')];this[_0x9855('0x25')]=_0x280c08[_0x9855('0x25')];this['ListId']=_0x280c08[_0x9855('0x26')];this[_0x9855('0x27')]=_0x280c08[_0x9855('0x27')];this['VoiceQueueId']=_0x280c08[_0x9855('0x28')];this[_0x9855('0x29')]=_0x280c08[_0x9855('0x29')];this[_0x9855('0x2a')]=_0x280c08[_0x9855('0x2a')]||'';this['originatecalleridname']=_0x280c08['originatecalleridname']||'';}module[_0x9855('0x2b')]=AgentComplete; \ No newline at end of file +var _0xfead=['countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry'];(function(_0x1593ae,_0x20c060){var _0x14639a=function(_0x5127a8){while(--_0x5127a8){_0x1593ae['push'](_0x1593ae['shift']());}};_0x14639a(++_0x20c060);}(_0xfead,0x152));var _0xdfea=function(_0x21f92f,_0x477dce){_0x21f92f=_0x21f92f-0x0;var _0x5e28a8=_0xfead[_0x21f92f];return _0x5e28a8;};'use strict';var util=require(_0xdfea('0x0'));var _=require(_0xdfea('0x1'));var moment=require(_0xdfea('0x2'));function getSeconds(_0x5600d6,_0x20c91a){var _0x491c46=moment(_0x5600d6)[_0xdfea('0x3')](0x0);var _0xbf9cc5=moment(_0x20c91a)[_0xdfea('0x3')](0x0);return _0x491c46['diff'](_0xbf9cc5,_0xdfea('0x4'));}function AgentComplete(_0x4ccc53,_0x39d6d4){this[_0xdfea('0x5')]=0x4;this['statedesc']='Answer';this[_0xdfea('0x6')]=_0x4ccc53['scheduledat'];this[_0xdfea('0x7')]=_0x4ccc53[_0xdfea('0x7')];this[_0xdfea('0x8')]=_0x4ccc53['type']==='outbound'?_0xdfea('0x9'):_0x4ccc53[_0xdfea('0x7')];this[_0xdfea('0xa')]=_0x4ccc53['countbusyretry'];this[_0xdfea('0xb')]=_0x4ccc53['countcongestionretry'];this['countnoanswerretry']=_0x4ccc53['countnoanswerretry'];this[_0xdfea('0xc')]=_0x4ccc53[_0xdfea('0xa')]+_0x4ccc53[_0xdfea('0xb')]+_0x4ccc53[_0xdfea('0xd')]+_0x4ccc53[_0xdfea('0xe')]+_0x4ccc53['countdropretry']+_0x4ccc53[_0xdfea('0xf')]+_0x4ccc53[_0xdfea('0x10')]+_0x4ccc53['countagentrejectretry'];this['countnosuchnumberretry']=_0x4ccc53[_0xdfea('0xe')];this[_0xdfea('0x11')]=_0x4ccc53[_0xdfea('0x11')];this[_0xdfea('0xf')]=_0x4ccc53[_0xdfea('0xf')];this[_0xdfea('0x10')]=_0x4ccc53[_0xdfea('0x10')];this[_0xdfea('0x12')]=_0x4ccc53[_0xdfea('0x12')];this[_0xdfea('0x13')]=_0x39d6d4[_0xdfea('0x13')];this['calleridname']=_0x4ccc53['name'];this[_0xdfea('0x14')]=_0x4ccc53['number'];this[_0xdfea('0x15')]=_0x4ccc53['starttime'];this[_0xdfea('0x16')]=_0x4ccc53[_0xdfea('0x16')];this[_0xdfea('0x17')]=_0x4ccc53['answertime'];this[_0xdfea('0x18')]=moment()[_0xdfea('0x19')](_0xdfea('0x1a'));this[_0xdfea('0x1b')]=getSeconds(_0x4ccc53[_0xdfea('0x16')],_0x4ccc53[_0xdfea('0x15')]);this[_0xdfea('0x1c')]=getSeconds(_0x4ccc53[_0xdfea('0x17')],_0x4ccc53[_0xdfea('0x16')]);this[_0xdfea('0x1d')]=getSeconds(this['endtime'],_0x4ccc53[_0xdfea('0x17')]);this[_0xdfea('0x9')]=_0x39d6d4[_0xdfea('0x9')];this[_0xdfea('0x1e')]=_0x39d6d4[_0xdfea('0x1e')];this[_0xdfea('0x1f')]=_0x39d6d4[_0xdfea('0x1f')];this[_0xdfea('0x20')]=_0x4ccc53['callback'];this[_0xdfea('0x21')]=_0x4ccc53[_0xdfea('0x21')];this[_0xdfea('0x22')]=_0x4ccc53[_0xdfea('0x22')];this[_0xdfea('0x23')]=_0x4ccc53[_0xdfea('0x23')];this[_0xdfea('0x24')]=_0x4ccc53['ContactId'];this[_0xdfea('0x25')]=_0x4ccc53[_0xdfea('0x25')];this[_0xdfea('0x26')]=_0x4ccc53[_0xdfea('0x26')];this[_0xdfea('0x27')]=_0x4ccc53[_0xdfea('0x27')];this[_0xdfea('0x28')]=_0x4ccc53[_0xdfea('0x28')];this[_0xdfea('0x29')]=_0x4ccc53[_0xdfea('0x29')]||'';this['originatecalleridname']=_0x4ccc53[_0xdfea('0x2a')]||'';}module[_0xdfea('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2ed114f..f1fe7f6 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9649=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x4cf765,_0xc7a6bf){var _0x473760=function(_0x2d501d){while(--_0x2d501d){_0x4cf765['push'](_0x4cf765['shift']());}};_0x473760(++_0xc7a6bf);}(_0x9649,0x19f));var _0x9964=function(_0x356e3e,_0x44d117){_0x356e3e=_0x356e3e-0x0;var _0x3ff610=_0x9649[_0x356e3e];return _0x3ff610;};'use strict';var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var moment=require(_0x9964('0x2'));function getSeconds(_0x222303,_0x5e1430){var _0x457627=moment(_0x222303)[_0x9964('0x3')](0x0);var _0x48790a=moment(_0x5e1430)[_0x9964('0x3')](0x0);return _0x457627['diff'](_0x48790a,_0x9964('0x4'));}function Final(_0x32aeb4){this[_0x9964('0x5')]=_0x32aeb4[_0x9964('0x5')];this[_0x9964('0x6')]=_0x32aeb4[_0x9964('0x6')];this[_0x9964('0x7')]=_0x32aeb4['type'];this[_0x9964('0x8')]=_0x32aeb4[_0x9964('0x7')]==='outbound'?_0x9964('0x9'):_0x32aeb4[_0x9964('0x7')];this['countbusyretry']=_0x32aeb4['countbusyretry'];this[_0x9964('0xa')]=_0x32aeb4[_0x9964('0xa')];this[_0x9964('0xb')]=_0x32aeb4[_0x9964('0xb')];this[_0x9964('0xc')]=_0x32aeb4['countbusyretry']+_0x32aeb4[_0x9964('0xa')]+_0x32aeb4['countnoanswerretry']+_0x32aeb4[_0x9964('0xd')]+_0x32aeb4[_0x9964('0xe')]+_0x32aeb4['countabandonedretry']+_0x32aeb4[_0x9964('0xf')]+_0x32aeb4[_0x9964('0x10')];this['countnosuchnumberretry']=_0x32aeb4[_0x9964('0xd')];this[_0x9964('0xe')]=_0x32aeb4[_0x9964('0xe')];this[_0x9964('0x11')]=_0x32aeb4[_0x9964('0x11')];this['countmachineretry']=_0x32aeb4[_0x9964('0xf')];this[_0x9964('0x10')]=_0x32aeb4['countagentrejectretry'];this[_0x9964('0x9')]=_0x32aeb4[_0x9964('0x9')];this['calleridname']=_0x32aeb4[_0x9964('0x12')];this[_0x9964('0x13')]=_0x32aeb4[_0x9964('0x13')];this[_0x9964('0x14')]=_0x32aeb4['starttime'];this[_0x9964('0x15')]=_0x32aeb4[_0x9964('0x15')];this['endtime']=_0x32aeb4[_0x9964('0x15')];this[_0x9964('0x16')]=_0x32aeb4[_0x9964('0x16')]||0x0;this[_0x9964('0x17')]=_0x32aeb4[_0x9964('0x17')]||0x0;this[_0x9964('0x18')]=_0x32aeb4[_0x9964('0x18')]||0x0;this[_0x9964('0x19')]=_0x32aeb4[_0x9964('0x19')];this[_0x9964('0x1a')]=_0x32aeb4['callbackuniqueid'];this[_0x9964('0x1b')]=_0x32aeb4[_0x9964('0x1b')];this['recallme']=_0x32aeb4[_0x9964('0x1c')];this['ContactId']=_0x32aeb4[_0x9964('0x1d')];this[_0x9964('0x1e')]=_0x32aeb4[_0x9964('0x1e')];this[_0x9964('0x1f')]=_0x32aeb4[_0x9964('0x1f')];this[_0x9964('0x20')]=_0x32aeb4['VoiceQueueId'];this[_0x9964('0x21')]=_0x32aeb4[_0x9964('0x21')];this['originatecalleridnum']=_0x32aeb4[_0x9964('0x22')]||'';this[_0x9964('0x23')]=_0x32aeb4[_0x9964('0x23')]||'';}module[_0x9964('0x24')]=Final; \ No newline at end of file +var _0xca9e=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','calleridname','calleridnum','responsetime','endtime','ringtime'];(function(_0x56818b,_0x590fa4){var _0x2fac68=function(_0x3d1aed){while(--_0x3d1aed){_0x56818b['push'](_0x56818b['shift']());}};_0x2fac68(++_0x590fa4);}(_0xca9e,0x136));var _0xeca9=function(_0x2441c9,_0x382cf5){_0x2441c9=_0x2441c9-0x0;var _0x317b2a=_0xca9e[_0x2441c9];return _0x317b2a;};'use strict';var util=require(_0xeca9('0x0'));var _=require(_0xeca9('0x1'));var moment=require(_0xeca9('0x2'));function getSeconds(_0x1c579d,_0x2df937){var _0x1443e3=moment(_0x1c579d)[_0xeca9('0x3')](0x0);var _0x2c6185=moment(_0x2df937)[_0xeca9('0x3')](0x0);return _0x1443e3[_0xeca9('0x4')](_0x2c6185,_0xeca9('0x5'));}function Final(_0x1c4ce6){this[_0xeca9('0x6')]=_0x1c4ce6[_0xeca9('0x6')];this['scheduledat']=_0x1c4ce6[_0xeca9('0x7')];this[_0xeca9('0x8')]=_0x1c4ce6['type'];this['campaigntype']=_0x1c4ce6[_0xeca9('0x8')]===_0xeca9('0x9')?_0xeca9('0xa'):_0x1c4ce6['type'];this[_0xeca9('0xb')]=_0x1c4ce6[_0xeca9('0xb')];this[_0xeca9('0xc')]=_0x1c4ce6[_0xeca9('0xc')];this[_0xeca9('0xd')]=_0x1c4ce6[_0xeca9('0xd')];this['countglobal']=_0x1c4ce6[_0xeca9('0xb')]+_0x1c4ce6[_0xeca9('0xc')]+_0x1c4ce6['countnoanswerretry']+_0x1c4ce6[_0xeca9('0xe')]+_0x1c4ce6['countdropretry']+_0x1c4ce6[_0xeca9('0xf')]+_0x1c4ce6[_0xeca9('0x10')]+_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xe')]=_0x1c4ce6[_0xeca9('0xe')];this[_0xeca9('0x11')]=_0x1c4ce6['countdropretry'];this[_0xeca9('0xf')]=_0x1c4ce6[_0xeca9('0xf')];this[_0xeca9('0x10')]=_0x1c4ce6[_0xeca9('0x10')];this['countagentrejectretry']=_0x1c4ce6['countagentrejectretry'];this[_0xeca9('0xa')]=_0x1c4ce6[_0xeca9('0xa')];this['calleridname']=_0x1c4ce6[_0xeca9('0x12')];this[_0xeca9('0x13')]=_0x1c4ce6['calleridnum'];this['starttime']=_0x1c4ce6['starttime'];this[_0xeca9('0x14')]=_0x1c4ce6[_0xeca9('0x14')];this[_0xeca9('0x15')]=_0x1c4ce6['responsetime'];this[_0xeca9('0x16')]=_0x1c4ce6['ringtime']||0x0;this['holdtime']=_0x1c4ce6[_0xeca9('0x17')]||0x0;this['talktime']=_0x1c4ce6[_0xeca9('0x18')]||0x0;this[_0xeca9('0x19')]=_0x1c4ce6['callback'];this[_0xeca9('0x1a')]=_0x1c4ce6[_0xeca9('0x1a')];this['callbackat']=_0x1c4ce6[_0xeca9('0x1b')];this['recallme']=_0x1c4ce6[_0xeca9('0x1c')];this[_0xeca9('0x1d')]=_0x1c4ce6[_0xeca9('0x1d')];this['ListId']=_0x1c4ce6[_0xeca9('0x1e')];this[_0xeca9('0x1f')]=_0x1c4ce6['UserId'];this[_0xeca9('0x20')]=_0x1c4ce6[_0xeca9('0x20')];this[_0xeca9('0x21')]=_0x1c4ce6[_0xeca9('0x21')];this['originatecalleridnum']=_0x1c4ce6[_0xeca9('0x22')]||'';this['originatecalleridname']=_0x1c4ce6[_0xeca9('0x23')]||'';}module[_0xeca9('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9e1356a..99333a6 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf610=['countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countagentrejectretry'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf610,0x9f));var _0x0f61=function(_0x19c2cb,_0x150866){_0x19c2cb=_0x19c2cb-0x0;var _0x385c2f=_0xf610[_0x19c2cb];return _0x385c2f;};'use strict';var util=require(_0x0f61('0x0'));var _=require(_0x0f61('0x1'));var moment=require(_0x0f61('0x2'));function getSeconds(_0x15aca4,_0xf8537f){var _0x2ec9f3=moment(_0x15aca4)['milliseconds'](0x0);var _0x553a21=moment(_0xf8537f)[_0x0f61('0x3')](0x0);return _0x2ec9f3[_0x0f61('0x4')](_0x553a21,_0x0f61('0x5'));}function Hangup(_0x5eb814,_0x21546d){this['state']=0x4;this['statedesc']=_0x0f61('0x6');this[_0x0f61('0x7')]=_0x5eb814['scheduledat'];this['type']=_0x5eb814[_0x0f61('0x8')];this[_0x0f61('0x9')]=_0x5eb814[_0x0f61('0x8')]===_0x0f61('0xa')?'queue':_0x5eb814[_0x0f61('0x8')];this[_0x0f61('0xb')]=_0x5eb814[_0x0f61('0xb')];this[_0x0f61('0xc')]=_0x5eb814[_0x0f61('0xc')];this[_0x0f61('0xd')]=_0x5eb814[_0x0f61('0xd')];this[_0x0f61('0xe')]=_0x5eb814[_0x0f61('0xb')]+_0x5eb814['countcongestionretry']+_0x5eb814[_0x0f61('0xd')]+_0x5eb814['countnosuchnumberretry']+_0x5eb814[_0x0f61('0xf')]+_0x5eb814['countabandonedretry']+_0x5eb814['countmachineretry']+_0x5eb814[_0x0f61('0x10')];this['countnosuchnumberretry']=_0x5eb814[_0x0f61('0x11')];this[_0x0f61('0xf')]=_0x5eb814[_0x0f61('0xf')];this['countabandonedretry']=_0x5eb814[_0x0f61('0x12')];this[_0x0f61('0x13')]=_0x5eb814['countmachineretry'];this[_0x0f61('0x10')]=_0x5eb814[_0x0f61('0x10')];this[_0x0f61('0x14')]=_0x21546d['uniqueid'];this['calleridname']=_0x5eb814['name'];this[_0x0f61('0x15')]=_0x5eb814[_0x0f61('0x16')];this[_0x0f61('0x17')]=_0x5eb814[_0x0f61('0x17')];this[_0x0f61('0x18')]=_0x5eb814[_0x0f61('0x18')];this[_0x0f61('0x19')]=moment()['format'](_0x0f61('0x1a'));this[_0x0f61('0x1b')]=getSeconds(_0x5eb814[_0x0f61('0x18')],_0x5eb814['starttime']);this[_0x0f61('0x1c')]=0x0;this['talktime']=getSeconds(this[_0x0f61('0x19')],_0x5eb814[_0x0f61('0x18')]);this[_0x0f61('0x1d')]=_0x5eb814[_0x0f61('0x1d')];this[_0x0f61('0x1e')]=_0x0f61('0x1f');this[_0x0f61('0x20')]=_0x21546d[_0x0f61('0x21')];this[_0x0f61('0x22')]=_0x5eb814[_0x0f61('0x22')];this[_0x0f61('0x23')]=_0x5eb814[_0x0f61('0x23')];this[_0x0f61('0x24')]=_0x5eb814[_0x0f61('0x24')];this[_0x0f61('0x25')]=_0x5eb814[_0x0f61('0x25')];this[_0x0f61('0x26')]=_0x5eb814[_0x0f61('0x26')];this[_0x0f61('0x27')]=_0x5eb814['ListId'];this[_0x0f61('0x28')]=_0x5eb814[_0x0f61('0x28')];this[_0x0f61('0x29')]=_0x5eb814[_0x0f61('0x29')];this[_0x0f61('0x2a')]=_0x5eb814[_0x0f61('0x2a')];}module[_0x0f61('0x2b')]=Hangup; \ No newline at end of file +var _0xb906=['membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x849e7c,_0x34014e){var _0x11722f=function(_0x1a3fa3){while(--_0x1a3fa3){_0x849e7c['push'](_0x849e7c['shift']());}};_0x11722f(++_0x34014e);}(_0xb906,0x10f));var _0x6b90=function(_0x16d2e1,_0x1c276d){_0x16d2e1=_0x16d2e1-0x0;var _0x212284=_0xb906[_0x16d2e1];return _0x212284;};'use strict';var util=require(_0x6b90('0x0'));var _=require(_0x6b90('0x1'));var moment=require('moment');function getSeconds(_0x5f4d64,_0x59c20b){var _0x33e1ba=moment(_0x5f4d64)[_0x6b90('0x2')](0x0);var _0xe1be44=moment(_0x59c20b)['milliseconds'](0x0);return _0x33e1ba['diff'](_0xe1be44,'seconds');}function Hangup(_0x578045,_0x376e86){this[_0x6b90('0x3')]=0x4;this[_0x6b90('0x4')]='Answer';this[_0x6b90('0x5')]=_0x578045[_0x6b90('0x5')];this[_0x6b90('0x6')]=_0x578045[_0x6b90('0x6')];this[_0x6b90('0x7')]=_0x578045[_0x6b90('0x6')]===_0x6b90('0x8')?_0x6b90('0x9'):_0x578045[_0x6b90('0x6')];this[_0x6b90('0xa')]=_0x578045['countbusyretry'];this[_0x6b90('0xb')]=_0x578045['countcongestionretry'];this['countnoanswerretry']=_0x578045[_0x6b90('0xc')];this['countglobal']=_0x578045[_0x6b90('0xa')]+_0x578045['countcongestionretry']+_0x578045[_0x6b90('0xc')]+_0x578045[_0x6b90('0xd')]+_0x578045[_0x6b90('0xe')]+_0x578045['countabandonedretry']+_0x578045[_0x6b90('0xf')]+_0x578045[_0x6b90('0x10')];this[_0x6b90('0xd')]=_0x578045[_0x6b90('0xd')];this[_0x6b90('0xe')]=_0x578045[_0x6b90('0xe')];this[_0x6b90('0x11')]=_0x578045[_0x6b90('0x11')];this[_0x6b90('0xf')]=_0x578045[_0x6b90('0xf')];this[_0x6b90('0x10')]=_0x578045['countagentrejectretry'];this[_0x6b90('0x12')]=_0x376e86['uniqueid'];this[_0x6b90('0x13')]=_0x578045[_0x6b90('0x14')];this[_0x6b90('0x15')]=_0x578045[_0x6b90('0x16')];this[_0x6b90('0x17')]=_0x578045['starttime'];this[_0x6b90('0x18')]=_0x578045[_0x6b90('0x18')];this[_0x6b90('0x19')]=moment()[_0x6b90('0x1a')](_0x6b90('0x1b'));this[_0x6b90('0x1c')]=getSeconds(_0x578045[_0x6b90('0x18')],_0x578045[_0x6b90('0x17')]);this[_0x6b90('0x1d')]=0x0;this['talktime']=getSeconds(this[_0x6b90('0x19')],_0x578045[_0x6b90('0x18')]);this[_0x6b90('0x9')]=_0x578045[_0x6b90('0x9')];this[_0x6b90('0x1e')]=_0x6b90('0x1f');this[_0x6b90('0x20')]=_0x376e86['cause-txt'];this[_0x6b90('0x21')]=_0x578045[_0x6b90('0x21')];this[_0x6b90('0x22')]=_0x578045[_0x6b90('0x22')];this[_0x6b90('0x23')]=_0x578045[_0x6b90('0x23')];this['recallme']=_0x578045[_0x6b90('0x24')];this[_0x6b90('0x25')]=_0x578045[_0x6b90('0x25')];this[_0x6b90('0x26')]=_0x578045[_0x6b90('0x26')];this[_0x6b90('0x27')]=_0x578045['UserId'];this[_0x6b90('0x28')]=_0x578045['VoiceQueueId'];this['CampaignId']=_0x578045[_0x6b90('0x29')];}module[_0x6b90('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 10cab23..dffdd72 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x085e=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','name','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x2af589,_0x4c2792){var _0x4f91f6=function(_0x247a51){while(--_0x247a51){_0x2af589['push'](_0x2af589['shift']());}};_0x4f91f6(++_0x4c2792);}(_0x085e,0x105));var _0xe085=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x085e[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0xe085('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x13016e,_0x2d09ed){var _0x802898=moment(_0x13016e)[_0xe085('0x1')](0x0);var _0x4729b8=moment(_0x2d09ed)[_0xe085('0x1')](0x0);return _0x802898[_0xe085('0x2')](_0x4729b8,_0xe085('0x3'));}function History(_0x14f8c7){this['uniqueid']=_0x14f8c7[_0xe085('0x4')];this['scheduledat']=_0x14f8c7[_0xe085('0x5')]||undefined;this[_0xe085('0x6')]=_0x14f8c7[_0xe085('0x6')];this[_0xe085('0x7')]=_0x14f8c7[_0xe085('0x6')]==='outbound'?_0xe085('0x8'):_0x14f8c7[_0xe085('0x6')];this[_0xe085('0x9')]=_0x14f8c7[_0xe085('0x9')];this[_0xe085('0xa')]=_0x14f8c7[_0xe085('0xa')];this['countnoanswerretry']=_0x14f8c7[_0xe085('0xb')];this[_0xe085('0xc')]=_0x14f8c7['countbusyretry']+_0x14f8c7['countcongestionretry']+_0x14f8c7[_0xe085('0xb')]+_0x14f8c7[_0xe085('0xd')]+_0x14f8c7['countdropretry']+_0x14f8c7['countabandonedretry']+_0x14f8c7['countmachineretry']+_0x14f8c7[_0xe085('0xe')];this[_0xe085('0xd')]=_0x14f8c7['countnosuchnumberretry'];this[_0xe085('0xf')]=_0x14f8c7[_0xe085('0xf')];this[_0xe085('0x10')]=_0x14f8c7[_0xe085('0x10')];this[_0xe085('0x11')]=_0x14f8c7[_0xe085('0x11')];this['countagentrejectretry']=_0x14f8c7['countagentrejectretry'];this[_0xe085('0x8')]=_0x14f8c7[_0xe085('0x8')];this['calleridname']=_0x14f8c7[_0xe085('0x12')];this[_0xe085('0x13')]=_0x14f8c7[_0xe085('0x14')];this[_0xe085('0x15')]=_0x14f8c7[_0xe085('0x15')];this['responsetime']=_0x14f8c7[_0xe085('0x16')];this['endtime']=_0x14f8c7['responsetime'];this['ringtime']=getSeconds(_0x14f8c7[_0xe085('0x16')],_0x14f8c7[_0xe085('0x15')]);this[_0xe085('0x17')]=0x0;this[_0xe085('0x18')]=0x0;this[_0xe085('0x19')]=_0x14f8c7[_0xe085('0x19')];this[_0xe085('0x1a')]=_0x14f8c7[_0xe085('0x1a')];this['callbackat']=_0x14f8c7[_0xe085('0x1b')];this[_0xe085('0x1c')]=_0x14f8c7['recallme'];this[_0xe085('0x1d')]=_0x14f8c7[_0xe085('0x1d')];this[_0xe085('0x1e')]=_0x14f8c7[_0xe085('0x1e')];this[_0xe085('0x1f')]=_0x14f8c7[_0xe085('0x1f')];this[_0xe085('0x20')]=_0x14f8c7['VoiceQueueId'];this[_0xe085('0x21')]=_0x14f8c7[_0xe085('0x21')];this['originatecalleridnum']=_0x14f8c7[_0xe085('0x22')]||'';this[_0xe085('0x23')]=_0x14f8c7[_0xe085('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0x7e7b=['diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds'];(function(_0xfb61f0,_0x69e563){var _0x482683=function(_0xe9d4f9){while(--_0xe9d4f9){_0xfb61f0['push'](_0xfb61f0['shift']());}};_0x482683(++_0x69e563);}(_0x7e7b,0x17e));var _0xb7e7=function(_0x212cdc,_0x3bce12){_0x212cdc=_0x212cdc-0x0;var _0x516caa=_0x7e7b[_0x212cdc];return _0x516caa;};'use strict';var util=require(_0xb7e7('0x0'));var _=require(_0xb7e7('0x1'));var moment=require('moment');function getSeconds(_0x403ef6,_0x237e29){var _0x5df20b=moment(_0x403ef6)[_0xb7e7('0x2')](0x0);var _0x443269=moment(_0x237e29)[_0xb7e7('0x2')](0x0);return _0x5df20b[_0xb7e7('0x3')](_0x443269,'seconds');}function History(_0x1ae522){this[_0xb7e7('0x4')]=_0x1ae522[_0xb7e7('0x4')];this[_0xb7e7('0x5')]=_0x1ae522[_0xb7e7('0x5')]||undefined;this[_0xb7e7('0x6')]=_0x1ae522[_0xb7e7('0x6')];this['campaigntype']=_0x1ae522[_0xb7e7('0x6')]==='outbound'?_0xb7e7('0x7'):_0x1ae522[_0xb7e7('0x6')];this[_0xb7e7('0x8')]=_0x1ae522[_0xb7e7('0x8')];this[_0xb7e7('0x9')]=_0x1ae522[_0xb7e7('0x9')];this[_0xb7e7('0xa')]=_0x1ae522['countnoanswerretry'];this[_0xb7e7('0xb')]=_0x1ae522[_0xb7e7('0x8')]+_0x1ae522[_0xb7e7('0x9')]+_0x1ae522[_0xb7e7('0xa')]+_0x1ae522[_0xb7e7('0xc')]+_0x1ae522[_0xb7e7('0xd')]+_0x1ae522[_0xb7e7('0xe')]+_0x1ae522['countmachineretry']+_0x1ae522['countagentrejectretry'];this[_0xb7e7('0xc')]=_0x1ae522[_0xb7e7('0xc')];this[_0xb7e7('0xd')]=_0x1ae522[_0xb7e7('0xd')];this[_0xb7e7('0xe')]=_0x1ae522[_0xb7e7('0xe')];this['countmachineretry']=_0x1ae522['countmachineretry'];this[_0xb7e7('0xf')]=_0x1ae522[_0xb7e7('0xf')];this['queue']=_0x1ae522[_0xb7e7('0x7')];this[_0xb7e7('0x10')]=_0x1ae522['name'];this[_0xb7e7('0x11')]=_0x1ae522[_0xb7e7('0x12')];this[_0xb7e7('0x13')]=_0x1ae522['starttime'];this['responsetime']=_0x1ae522[_0xb7e7('0x14')];this['endtime']=_0x1ae522[_0xb7e7('0x14')];this['ringtime']=getSeconds(_0x1ae522[_0xb7e7('0x14')],_0x1ae522[_0xb7e7('0x13')]);this[_0xb7e7('0x15')]=0x0;this[_0xb7e7('0x16')]=0x0;this[_0xb7e7('0x17')]=_0x1ae522[_0xb7e7('0x17')];this[_0xb7e7('0x18')]=_0x1ae522['callbackuniqueid'];this[_0xb7e7('0x19')]=_0x1ae522[_0xb7e7('0x19')];this[_0xb7e7('0x1a')]=_0x1ae522['recallme'];this['ContactId']=_0x1ae522[_0xb7e7('0x1b')];this['ListId']=_0x1ae522[_0xb7e7('0x1c')];this[_0xb7e7('0x1d')]=_0x1ae522[_0xb7e7('0x1d')];this[_0xb7e7('0x1e')]=_0x1ae522[_0xb7e7('0x1e')];this[_0xb7e7('0x1f')]=_0x1ae522[_0xb7e7('0x1f')];this[_0xb7e7('0x20')]=_0x1ae522[_0xb7e7('0x20')]||'';this[_0xb7e7('0x21')]=_0x1ae522['originatecalleridname']||'';}module[_0xb7e7('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index db04d46..4011048 100644 --- a/server/services/ami/dialer/index.js +++ b/server/services/ami/dialer/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0490=['UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','HangupInAMD','membername','buildObj','amd','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','rescheduleContact','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','MACHINE','countglobal','countabandonedretry','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','roundrobin','locked','stateinterface','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','command','content','true','push','iftime\x20%s,%s','indexOf','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','filter','dialPreviewRecallmeReminder','online','map','Agent','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialMachineMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','createStateFinal','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','predictiveIntervalPauses','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','run','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','lodash','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','format','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','seconds','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22\x22\x20<>','inspect','error','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','statedesc','endtime','starttime','[uniqueid]','[actions]','clearZombieChannels','undefined','isNil','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','resolve','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ListId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0490,0x147));var _0x0049=function(_0x141bb7,_0x70b2ad){_0x141bb7=_0x141bb7-0x0;var _0x377848=_0x0490[_0x141bb7];return _0x377848;};'use strict';var util=require('util');var _=require(_0x0049('0x0'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0049('0x1'));var ut=require(_0x0049('0x2'));var config=require(_0x0049('0x3'));var logger=require(_0x0049('0x4'))(_0x0049('0x5'));var loggerBooked=require(_0x0049('0x4'))(_0x0049('0x6'));var loggerPredictive=require(_0x0049('0x4'))(_0x0049('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0049('0x8'));var loggerSyncQueueSummary=require(_0x0049('0x4'))(_0x0049('0x9'));var ami=require('../ami');config[_0x0049('0xa')]=_[_0x0049('0xb')](config[_0x0049('0xa')],{'host':_0x0049('0xc'),'port':0x18eb});var io=require(_0x0049('0xd'))(new Redis(config[_0x0049('0xa')]));var cmHopper=require(_0x0049('0xe'));var cmHopperHistory=require(_0x0049('0xf'));var cmHopperFinal=require(_0x0049('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0049('0x11'));var voiceQueueRt=require(_0x0049('0x12'));var RpcSetting=require(_0x0049('0x13'));var Action=require('./action');var History=require('./history');var Final=require(_0x0049('0x14'));var AgentComplete=require(_0x0049('0x15'));var QueueCallerAbandon=require(_0x0049('0x16'));var Hangup=require(_0x0049('0x17'));var ipAgi=process[_0x0049('0x18')]['XCALLY_IP_AGI']||_0x0049('0x19');var strategy={'rrmemory':_0x0049('0x1a'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0049('0x1b')][_0x0049('0x1c')]=function(_0x2d6b06){this[_0x0049('0x1d')]=this['tail']?this['tail'][_0x0049('0x1e')](_0x2d6b06):_0x2d6b06();};function Dialer(_0x2cdade,_0x291a94){this[_0x0049('0x1f')]=new Sequence();this[_0x0049('0x20')]=_0x291a94;this[_0x0049('0x21')]=_0x2cdade[_0x0049('0x21')];this[_0x0049('0x22')]=_0x2cdade[_0x0049('0x22')];this[_0x0049('0x23')]=_0x2cdade['agents'];this[_0x0049('0x24')]=_0x2cdade[_0x0049('0x24')];this['maxNumberOriginate']=config[_0x0049('0x25')]||0x2;this[_0x0049('0x26')]={};this[_0x0049('0x27')]={};this[_0x0049('0x28')]={};this[_0x0049('0x29')]={};this['optionPredictive']={};this[_0x0049('0x2a')]={};this[_0x0049('0x2b')]={};this['ivrOriginated']={};this[_0x0049('0x2c')]={};this[_0x0049('0x2d')]={};ami['on'](_0x0049('0x2e'),this[_0x0049('0x2f')][_0x0049('0x30')](this));ami['on'](_0x0049('0x31'),this[_0x0049('0x32')][_0x0049('0x30')](this));ami['on'](_0x0049('0x33'),this[_0x0049('0x34')][_0x0049('0x30')](this));ami['on'](_0x0049('0x35'),this['syncAgentComplete'][_0x0049('0x30')](this));ami['on'](_0x0049('0x36'),this[_0x0049('0x9')][_0x0049('0x30')](this));ami['on'](_0x0049('0x37'),this['syncQueueSummaryComplete'][_0x0049('0x30')](this));ami['on']('hangup',this[_0x0049('0x38')][_0x0049('0x30')](this));ami['on'](_0x0049('0x39'),this[_0x0049('0x3a')]['bind'](this));ami['on'](_0x0049('0x3b'),this[_0x0049('0x3c')][_0x0049('0x30')](this));ami['on'](_0x0049('0x3d'),this[_0x0049('0x3e')]['bind'](this));ami['on'](_0x0049('0x3f'),this[_0x0049('0x40')][_0x0049('0x30')](this));this['loopCampaigns']();this[_0x0049('0x41')]();RpcSetting[_0x0049('0x42')]()[_0x0049('0x43')](function(_0x25876e){previewRecallmeReminderInterval=_0x25876e['previewRecallmeReminderInterval'];});}function isNotNull(_0x30f400){return _0x30f400!==null&&!_[_0x0049('0x44')](_0x30f400);}function checkIsLoggedIn(_0x5c2d27,_0x1170b8){return function(){if(_0x1170b8<=0x0){_0x5c2d27[_0x0049('0x45')]='AGENTS_NOT_LOGGED';throw _0x5c2d27[_0x0049('0x46')]+_0x0049('0x47');}};}function isActive(_0x3d47d8){return _0x3d47d8;}function checkIsActive(_0x14b1d1,_0x178827){return function(){if(!isActive(_0x178827)){_0x14b1d1['message']=_0x0049('0x48');throw _0x14b1d1[_0x0049('0x46')]+_0x0049('0x49');}};}function checkInterval(_0x236e7a){return function(){if(!isNotNull(_0x236e7a[_0x0049('0x4a')])){_0x236e7a['message']=_0x0049('0x4b');throw _0x236e7a['name']+_0x0049('0x4c');}if(!isNotNull(_0x236e7a[_0x0049('0x4a')][_0x0049('0x4d')])){_0x236e7a['message']=_0x0049('0x4b');throw _0x236e7a['name']+_0x0049('0x4c');}if(!isNotNull(_[_0x0049('0x4e')](_0x236e7a[_0x0049('0x4a')]['Intervals']))){_0x236e7a[_0x0049('0x45')]=_0x0049('0x4b');throw _0x236e7a[_0x0049('0x46')]+_0x0049('0x4c');}};}function msgResponse(_0x1719ef,_0x207e43,_0x56c591){return{'action':_0x1719ef,'response':_0x207e43,'message':_0x56c591,'stack':_0x56c591};}function myreject(_0x40bef9){return function(_0x3902f5){return _0x40bef9(msgResponse('[ifTime][Action]','Error',JSON[_0x0049('0x4f')](_0x3902f5)));};}function getSeconds(_0xd254de,_0xc19c60){var _0x10b31b=moment(_0xd254de)[_0x0049('0x50')](0x0);var _0x5a21ed=moment(_0xc19c60)[_0x0049('0x50')](0x0);return _0x10b31b[_0x0049('0x51')](_0x5a21ed,'seconds');}function emit(_0x3bed47,_0x3332f1,_0x46c6b5){io['to'](_0x3bed47)[_0x0049('0x52')](_0x3332f1,_0x46c6b5);}function emitVoiceQueueSummary(_0xe8a86f){if(_0xe8a86f[_0x0049('0x53')]===_0x0049('0x54')){var _0x3fa25e={'id':_0xe8a86f['id'],'name':_0xe8a86f['name'],'strategy':_0xe8a86f[_0x0049('0x55')],'answered':_0xe8a86f[_0x0049('0x56')],'available':_0xe8a86f[_0x0049('0x57')],'loggedIn':_0xe8a86f[_0x0049('0x58')],'pTalking':_0xe8a86f[_0x0049('0x59')],'sumBillable':_0xe8a86f[_0x0049('0x5a')],'sumDuration':_0xe8a86f[_0x0049('0x5b')],'sumHoldTime':_0xe8a86f[_0x0049('0x5c')]||0x0,'talking':_0xe8a86f[_0x0049('0x5d')],'total':_0xe8a86f[_0x0049('0x5e')],'type':_0xe8a86f[_0x0049('0x53')],'unmanaged':_0xe8a86f[_0x0049('0x5f')],'abandoned':_0xe8a86f[_0x0049('0x60')],'waiting':_0xe8a86f['waiting'],'loggedInDb':_0xe8a86f[_0x0049('0x61')],'dialActive':_0xe8a86f[_0x0049('0x62')],'dialMethod':_0xe8a86f[_0x0049('0x63')],'dialOriginateCallerIdName':_0xe8a86f['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xe8a86f['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xe8a86f[_0x0049('0x64')],'dialPrefix':_0xe8a86f['dialPrefix'],'outboundAnswerAgiCallsDay':_0xe8a86f[_0x0049('0x65')],'outboundAnswerCallsDay':_0xe8a86f[_0x0049('0x66')],'outboundBlacklistCallsDay':_0xe8a86f[_0x0049('0x67')],'outboundBusyCallsDay':_0xe8a86f[_0x0049('0x68')],'outboundCongestionCallsDay':_0xe8a86f[_0x0049('0x69')],'outboundDropCallsDayACS':_0xe8a86f[_0x0049('0x6a')],'outboundDropCallsDayCallersExit':_0xe8a86f[_0x0049('0x6b')],'outboundDropCallsDayTimeout':_0xe8a86f[_0x0049('0x6c')],'outboundNoAnswerCallsDay':_0xe8a86f['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xe8a86f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0xe8a86f['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xe8a86f[_0x0049('0x6d')],'outboundRejectCallsDay':_0xe8a86f[_0x0049('0x6e')],'outboundUnknownCallsDay':_0xe8a86f[_0x0049('0x6f')],'predictiveIntervalAnsweredCalls':_0xe8a86f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xe8a86f[_0x0049('0x70')],'predictiveIntervalAvgTalktime':_0xe8a86f[_0x0049('0x71')],'predictiveIntervalDroppedCallsCallersExit':_0xe8a86f[_0x0049('0x72')],'predictiveIntervalDroppedCallsTimeout':_0xe8a86f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0xe8a86f['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xe8a86f['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xe8a86f[_0x0049('0x73')],'predictiveIntervalMultiplicativeFactor':_0xe8a86f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xe8a86f['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xe8a86f[_0x0049('0x74')],'predictiveIntervalTotalCalls':_0xe8a86f[_0x0049('0x75')],'message':_0xe8a86f[_0x0049('0x45')],'originated':_0xe8a86f[_0x0049('0x76')],'erlangCalls':_0xe8a86f[_0x0049('0x77')],'erlangCallToSecond':_0xe8a86f['erlangCallToSecond'],'erlangAbandonmentRate':_0xe8a86f[_0x0049('0x78')],'erlangBusyFactor':_0xe8a86f[_0x0049('0x79')],'startPredictive':_0xe8a86f[_0x0049('0x2a')],'startProgressive':_0xe8a86f[_0x0049('0x2b')]};if(_0xe8a86f[_0x0049('0x7a')]){_0x3fa25e[_0x0049('0x7a')]={'id':_0xe8a86f['Trunk']['id'],'name':_0xe8a86f[_0x0049('0x7a')]['name'],'active':_0xe8a86f[_0x0049('0x7a')]['active'],'callerid':_0xe8a86f[_0x0049('0x7a')][_0x0049('0x7b')]};}if(_0xe8a86f[_0x0049('0x4a')]){_0x3fa25e[_0x0049('0x4a')]={'id':_0xe8a86f[_0x0049('0x4a')]['id'],'name':_0xe8a86f['Interval'][_0x0049('0x46')]};}var _0x22af22=md5(JSON[_0x0049('0x4f')](_0x3fa25e));if(_0xe8a86f[_0x0049('0x7c')]!==_0x22af22){_0xe8a86f[_0x0049('0x7c')]=_0x22af22;emit(util[_0x0049('0x7d')]('voice:queue:%s',_0x3fa25e[_0x0049('0x46')]),'voice_queue:save',_0x3fa25e);}}}function emitCampaignSummary(_0x770e2a){if(_0x770e2a[_0x0049('0x53')]==='ivr'){emit(util[_0x0049('0x7d')](_0x0049('0x7e'),_0x770e2a[_0x0049('0x46')]),_0x0049('0x7f'),_0x770e2a);}}function checkGetDataPredictive(_0x31bce1){if(isNotNull(_0x31bce1)&&!_[_0x0049('0x4e')](_0x31bce1)){loggerPredictive[_0x0049('0x80')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0x0049('0x81'),_0x31bce1[_0x0049('0x75')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x82'),_0x31bce1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0049('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1[_0x0049('0x72')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x83'),_0x31bce1[_0x0049('0x70')]);loggerPredictive[_0x0049('0x80')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x31bce1['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0049('0x80')](_0x0049('0x84'));if(_0x31bce1[_0x0049('0x75')]>0x0){if(!_[_0x0049('0x44')](_0x31bce1['predictiveIntervalAvgTalktime'])&&_0x31bce1[_0x0049('0x71')]>0x0){return!![];}loggerPredictive[_0x0049('0x80')](_0x0049('0x85'));if(!_[_0x0049('0x44')](_0x31bce1[_0x0049('0x70')])&&_0x31bce1[_0x0049('0x70')]>0x0){return!![];}loggerPredictive['info'](_0x0049('0x86'));}else{loggerPredictive[_0x0049('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0049('0x80')](_0x0049('0x87'));}return![];}function mergeDataErlangB(_0x58668d){return function(_0x4cb4fd){loggerPredictive[_0x0049('0x80')](_0x0049('0x88'));loggerPredictive[_0x0049('0x80')](_0x0049('0x89'),_0x4cb4fd['erlangCalls']);loggerPredictive['info'](_0x0049('0x8a'),_0x4cb4fd[_0x0049('0x8b')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x8c'),_0x4cb4fd[_0x0049('0x78')]);loggerPredictive[_0x0049('0x80')](_0x0049('0x8d'),_0x4cb4fd[_0x0049('0x79')]);loggerPredictive[_0x0049('0x80')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cb4fd[_0x0049('0x78')]);loggerPredictive['info']('---------------------------');_[_0x0049('0x8e')](_0x58668d,_0x4cb4fd);};}function getDiff(_0xd3bfdd){var _0x21e261=moment()[_0x0049('0x50')](0x0);var _0x5a6550=moment(_0xd3bfdd)[_0x0049('0x50')](0x0);return _0x21e261[_0x0049('0x51')](_0x5a6550,_0x0049('0x8f'));}function ifInterval(_0x327383,_0x4d793a){if(_[_0x0049('0x44')](_0x4d793a)){return![];}return getDiff(_0x4d793a)<_0x327383*0x3c;}function freeVariablesPredictive(_0x137c28){if(isNotNull(_0x137c28)){if(!_['isUndefined'](_0x137c28[_0x0049('0x2b')])){_0x137c28[_0x0049('0x2b')]=undefined;loggerPredictive[_0x0049('0x80')](_0x137c28[_0x0049('0x46')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x0049('0x44')](_0x137c28['startPredictive'])){_0x137c28[_0x0049('0x2a')]=undefined;loggerPredictive['info'](_0x137c28['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0049('0x44')](_0x137c28[_0x0049('0x90')])){clearInterval(_0x137c28[_0x0049('0x90')]);_0x137c28[_0x0049('0x90')]=undefined;loggerPredictive[_0x0049('0x80')](_0x137c28[_0x0049('0x46')],_0x0049('0x91'));}}}function erlangb(_0x23588d,_0x2dbdf4){if(_0x2dbdf4===0x0){return 0x0;}var _0x7d642a=0x1;for(var _0x2a2bf0=0x1;_0x2a2bf0<=_0x2dbdf4;_0x2a2bf0+=0x1){_0x7d642a=0x1+_0x7d642a*_0x2a2bf0/_0x23588d;}return 0x1/_0x7d642a;}function isVoiceQueueOutbound(_0x24f836){return _0x24f836===_0x0049('0x54');}function isNotPreview(_0x3d88c6){return _0x3d88c6!==_0x0049('0x20');}function isCampaignIvr(_0x4701a9){return _0x4701a9===_0x0049('0x92');}function getCallerId(_0x1744d3,_0x4bd24b,_0x1460ae){if(!_[_0x0049('0x44')](_0x1460ae)&&typeof _0x1460ae==='string'&&!_[_0x0049('0x4e')](_0x1460ae)){if(!_[_0x0049('0x44')](_0x4bd24b)&&typeof _0x4bd24b==='string'&&!_[_0x0049('0x4e')](_0x4bd24b)){return util[_0x0049('0x7d')]('\x22%s\x22\x20<%s>',_0x4bd24b,_0x1460ae);}return util['format']('\x22%s\x22\x20<%s>',_0x1460ae,_0x1460ae);}if(!_[_0x0049('0x44')](_0x1744d3)&&typeof _0x1744d3==='string'&&!_[_0x0049('0x4e')](_0x1744d3)){return _0x1744d3;}return _0x0049('0x93');}function loggerCatchQueueSummary(_0x1e8554,_0x130086){return function(_0x4cfe61){freeVariablesPredictive(_0x130086);emitVoiceQueueSummary(_0x130086);emitCampaignSummary(_0x130086);loggerSyncQueueSummary['debug'](_0x1e8554,util[_0x0049('0x94')](_0x4cfe61,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3e45c6,_0x41304d){return function(_0x5035dd){loggerPredictive[_0x0049('0x95')](_0x41304d['name'],_0x3e45c6);loggerPredictive[_0x0049('0x95')](_0x5035dd[_0x0049('0x96')]);freeVariablesPredictive(_0x41304d);};}function loggerCatch(_0x489d8c){return function(_0x5dd385){logger[_0x0049('0x95')](_0x489d8c,util[_0x0049('0x94')](_0x5dd385,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d87e6){return _0x3d87e6&&!_[_0x0049('0x44')](_0x3d87e6)&&_0x3d87e6[_0x0049('0x97')]>0x0;}function decremetOriginate(_0x534340){if(!_['isUndefined'](_0x534340)&&_0x534340!==null){if(typeof _0x534340['originated']!=='undefined'){if(_0x534340['originated']>0x0){_0x534340[_0x0049('0x76')]-=0x1;}else{logger[_0x0049('0x95')](_0x0049('0x98'));}}}else{logger[_0x0049('0x95')](_0x0049('0x99'));}}function checkContactLowerLimitOriginate(_0x298e08,_0x35ec4b,_0x207165){if(_0x35ec4b>_0x207165){for(var _0x3ca0c5=0x0;_0x3ca0c5<_0x35ec4b-_0x207165;_0x3ca0c5+=0x1){decremetOriginate(_0x298e08);}}}function loggerGetContactDialer(_0x17c754,_0x1b018b,_0xa82195){return function(_0x442e71){checkContactLowerLimitOriginate(_0x1b018b,_0xa82195,0x0);logger['error'](_0x17c754,util[_0x0049('0x94')](_0x442e71,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x9144ae){return function(_0x5a6e55){if(isNotNull(_0x5a6e55)&&isNotNull(_0x5a6e55[0x0])){if(_0x5a6e55[0x0]['contactsRescheduled']>0x0){_0x9144ae['message']=_0x0049('0x9a');logger['info'](_0x0049('0x9b')+_0x9144ae[_0x0049('0x46')],_0x5a6e55[0x0]['contactsRescheduled'],_0x0049('0x9c'));}else{_0x9144ae[_0x0049('0x45')]=_0x0049('0x9d');logger[_0x0049('0x80')](_0x0049('0x9e')+_0x9144ae[_0x0049('0x46')]);}}};}function notSendMessagesQueue(_0x952a73){if(_0x952a73[_0x0049('0x9f')]){freeVariablesPredictive(_0x952a73);if(_0x952a73['originated']===0x0&&_0x952a73['talking']===0x0&&_0x952a73[_0x0049('0xa0')]===0x0&&(_0x952a73[_0x0049('0x59')]||0x0)===0x0){_0x952a73[_0x0049('0x9f')]=![];_0x952a73[_0x0049('0x57')]=0x0;_0x952a73[_0x0049('0x45')]=_0x0049('0x48');loggerSyncQueueSummary[_0x0049('0xa1')](_0x0049('0xa2'),_0x952a73[_0x0049('0x46')],_0x0049('0xa3'));}else{_0x952a73['message']='IS_DISACTIVED';loggerSyncQueueSummary['debug'](_0x0049('0xa2'),_0x952a73[_0x0049('0x46')],_0x0049('0xa4'));}emitVoiceQueueSummary(_0x952a73);}}function notSendMessagesCampaign(_0x183dc9){if(_0x183dc9['sendMessageOneNotActive']){if(_0x183dc9[_0x0049('0x76')]===0x0){_0x183dc9[_0x0049('0x9f')]=![];_0x183dc9[_0x0049('0x45')]=_0x0049('0x48');loggerSyncQueueSummary[_0x0049('0xa1')](_0x0049('0xa5'),_0x183dc9[_0x0049('0x46')],_0x0049('0xa3'));}else{_0x183dc9[_0x0049('0x45')]=_0x0049('0xa6');loggerSyncQueueSummary[_0x0049('0xa1')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x183dc9['name'],_0x0049('0xa4'));}emitCampaignSummary(_0x183dc9);}}function createObjHistory(_0xe01a96,_0x580941,_0x43217c,_0x375a5e,_0x421128){_0xe01a96[_0x0049('0x45')]=_0x43217c;var _0x2a4ca7=new Action(_0xe01a96,_0x580941);var _0x4ff9f0=new History(_0x2a4ca7);_0x4ff9f0['state']=_0x375a5e;_0x4ff9f0[_0x0049('0xa7')]=_0x421128;_0x4ff9f0[_0x0049('0xa8')]=_0x2a4ca7[_0x0049('0xa9')];return _0x4ff9f0;}Dialer[_0x0049('0x1b')]['loopClearZombieChannels']=function(){var _0x46d876=this;setInterval(function(){_0x46d876['clearZombieChannels'](_0x46d876[_0x0049('0x29')],_0x0049('0xaa'));_0x46d876['clearZombieChannels'](_0x46d876[_0x0049('0x27')],_0x0049('0xab'));},0x32c8);};Dialer[_0x0049('0x1b')][_0x0049('0xac')]=function(_0x8eb517,_0x4319d6){var _0x2264b6=this;for(var _0x543667 in _0x8eb517){if(typeof _0x8eb517[_0x543667]!==_0x0049('0xad')){this['sequence']['enqueue'](function(){if(!_[_0x0049('0xae')](_0x8eb517[_0x543667])){return ami[_0x0049('0xaf')]({'action':_0x0049('0xb0'),'channel':_0x8eb517[_0x543667]['channel']})[_0x0049('0xb1')](function(_0x58068b){if(_0x58068b['message']===_0x0049('0xb2')){setTimeout(function(){if(_0x8eb517[_0x543667]&&_0x8eb517[_0x543667][_0x0049('0x53')]!=='ivr'){_0x2264b6[_0x0049('0xb3')](_0x2264b6[_0x0049('0x21')][_0x8eb517[_0x543667][_0x0049('0xb4')]]);logger[_0x0049('0x95')](_0x0049('0xb5'),_0x4319d6,_0x543667,_0x8eb517[_0x543667][_0x0049('0xb4')]);delete _0x8eb517[_0x543667];}if(_0x8eb517[_0x543667]&&_0x8eb517[_0x543667][_0x0049('0x53')]===_0x0049('0x92')){_0x2264b6[_0x0049('0xb3')](_0x2264b6[_0x0049('0x22')][_0x8eb517[_0x543667]['queue']]);logger[_0x0049('0x95')](_0x0049('0xb6'),_0x4319d6,_0x543667,_0x8eb517[_0x543667][_0x0049('0xb4')]);delete _0x8eb517[_0x543667];}},0x2328);}});}});}}};Dialer[_0x0049('0x1b')][_0x0049('0xb7')]=function(_0x216f6f){return BPromise['resolve']()[_0x0049('0x43')](cmHopper['countReScheduled'](_0x216f6f))[_0x0049('0xb1')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0049('0x1b')][_0x0049('0xb8')]=function(_0x3d518f){return BPromise['resolve']()[_0x0049('0x43')](cmHopperBlack[_0x0049('0xb8')](_0x3d518f))[_0x0049('0xb1')](loggerCatch(_0x0049('0xb9')));};Dialer[_0x0049('0x1b')][_0x0049('0xba')]=function(_0x47c4ca,_0x121095,_0x391816){return BPromise[_0x0049('0xbb')]()['then'](cmHopperAdditionalPhone[_0x0049('0xba')](_0x47c4ca,_0x121095,_0x391816))[_0x0049('0xb1')](loggerCatch(_0x0049('0xbc')));};Dialer[_0x0049('0x1b')][_0x0049('0xbd')]=function(_0x4cc193,_0x1a8b83,_0x1a9707){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopperAdditionalPhone[_0x0049('0xbd')](_0x4cc193,_0x1a8b83,_0x1a9707))[_0x0049('0xb1')](loggerCatch(_0x0049('0xbe')));};Dialer[_0x0049('0x1b')][_0x0049('0xbf')]=function(_0x4e5b0f){return BPromise['resolve']()[_0x0049('0x43')](cmHopperBlack[_0x0049('0xbf')](_0x4e5b0f))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0049('0x1b')][_0x0049('0xc0')]=function(_0x369220){return BPromise[_0x0049('0xbb')]()['then'](cmHopperHistory[_0x0049('0xc1')](_0x369220))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc2')));};Dialer[_0x0049('0x1b')]['rescheduleContact']=function(_0x2f9903){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['rescheduleContact'](_0x2f9903))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc3')));};Dialer[_0x0049('0x1b')][_0x0049('0xc4')]=function(_0xa036ec,_0x404660,_0x5e2385){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper[_0x0049('0xc4')](_0xa036ec,_0x404660,_0x5e2385))[_0x0049('0xb1')](loggerCatch(_0x0049('0xc5')));};Dialer[_0x0049('0x1b')]['getContactDialer']=function(_0x1604b8,_0x4afab2,_0x459027,_0x3ef9a9,_0x40efe8){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper[_0x0049('0xc6')](_0x1604b8,_0x4afab2,_0x459027,_0x3ef9a9))['catch'](function(_0x520bed){_0x40efe8[_0x0049('0xc7')]-=_0x459027;_0x40efe8['temp']=_0x40efe8[_0x0049('0xc7')]>0x0?_0x40efe8[_0x0049('0xc7')]:0x0;loggerCatch(_0x0049('0xc8'))(_0x520bed);});};Dialer[_0x0049('0x1b')][_0x0049('0xc9')]=function(_0x3faf71,_0x2fcb98,_0x5c1923,_0x30bf95){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['getContactDialerIvr'](_0x3faf71,_0x2fcb98,_0x5c1923))[_0x0049('0xb1')](function(_0x545284){_0x30bf95['temp']-=_0x2fcb98;_0x30bf95['temp']=_0x30bf95[_0x0049('0xc7')]>0x0?_0x30bf95['temp']:0x0;loggerCatch(_0x0049('0xca'))(_0x545284);});};Dialer[_0x0049('0x1b')]['getVoiceQueueRtPauses']=function(_0x3c0d20){return BPromise['resolve']()['then'](voiceQueueRt[_0x0049('0xcb')](_0x3c0d20))[_0x0049('0xb1')](loggerCatch(_0x0049('0xcc')));};Dialer[_0x0049('0x1b')][_0x0049('0xcd')]=function(_0x4b134){return BPromise['resolve']()[_0x0049('0x43')](cmHopper['moveContactManagedDialer'](_0x4b134))[_0x0049('0xb1')](loggerCatch(_0x0049('0xce')));};Dialer[_0x0049('0x1b')][_0x0049('0xcf')]=function(_0x5816e3){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopperHistory['createHistory'](_0x5816e3))['catch'](loggerCatch(_0x0049('0xd0')));};Dialer[_0x0049('0x1b')]['updateOriginated']=function(_0x36a2fb){if(!_[_0x0049('0x44')](_0x36a2fb)&&_0x36a2fb!==null){if(typeof _0x36a2fb[_0x0049('0x76')]!==_0x0049('0xad')){if(_0x36a2fb[_0x0049('0x76')]>0x0){_0x36a2fb[_0x0049('0x76')]-=0x1;}else{logger[_0x0049('0x95')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0049('0xd1'));}};Dialer[_0x0049('0x1b')]['loggerHandler']=function(_0x22d89c,_0x5ec5bf){var _0x3b8c60=this;return function(_0x40953f){_0x3b8c60['updateOriginated'](_0x5ec5bf);logger[_0x0049('0x95')](_0x22d89c,util['inspect'](_0x40953f,{'showHidden':![],'depth':null}));};};Dialer[_0x0049('0x1b')][_0x0049('0xd2')]=function(_0x599dbc,_0x5cb6bd,_0x32648b){var _0x3de464={'state':0x19,'statedesc':_0x0049('0xd3')};this[_0x0049('0xb3')](_0x5cb6bd);this[_0x0049('0xd4')](_['merge'](_0x3de464,_[_0x0049('0xd5')](_0x32648b,['ContactId',_0x0049('0xd6'),_0x0049('0xd7'),_0x0049('0xd8'),_0x0049('0xd9')])),_0x0049('0xda'),_0x0049('0xdb'));logger['error'](_0x599dbc);};Dialer[_0x0049('0x1b')][_0x0049('0xdc')]=function(_0xa0009a){return _0xa0009a===_0x0049('0xdd');};Dialer[_0x0049('0x1b')][_0x0049('0xde')]=function(_0x498c18){return!_[_0x0049('0x44')](_0x498c18)&&_0x498c18&&!_[_0x0049('0x44')](_0x498c18['name'])&&!_[_0x0049('0x44')](_0x498c18[_0x0049('0xdf')])&&_0x498c18['active']&&(this['trunks'][util[_0x0049('0x7d')]('SIP/%s',_0x498c18['name'])]['status']===_0x0049('0xe0')||this[_0x0049('0x24')][util['format'](_0x0049('0xe1'),_0x498c18[_0x0049('0x46')])][_0x0049('0xb0')]==='unmonitored');};Dialer['prototype'][_0x0049('0xd4')]=function(_0x57fd54,_0x356ca1,_0x5b35dc){this['createHistory'](_0x57fd54)[_0x0049('0xb1')](loggerCatch(_0x356ca1));this['moveContactManagedDialer'](_0x57fd54)[_0x0049('0xb1')](loggerCatch(_0x5b35dc));};Dialer[_0x0049('0x1b')][_0x0049('0x3c')]=function(_0x2cbd43){var _0x3d4c62=this[_0x0049('0x29')][_0x2cbd43[_0x0049('0xe2')]];var _0x77a4f6;if(!_['isNil'](_0x2cbd43)&&!_[_0x0049('0xae')](_0x2cbd43['variable'])&&!_[_0x0049('0xae')](_0x2cbd43[_0x0049('0xe3')][_0x0049('0xe4')])&&_0x2cbd43[_0x0049('0xe5')]===_0x0049('0xe6')&&_0x3d4c62){if(_0x3d4c62[_0x0049('0x53')]!==_0x0049('0x92')&&this[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0xe9')){delete this[_0x0049('0x29')][_0x2cbd43[_0x0049('0xe2')]];this[_0x0049('0xb3')](this['voiceQueues'][_0x3d4c62[_0x0049('0xb4')]]);this['voiceQueues'][_0x3d4c62[_0x0049('0xb4')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x3d4c62['queue']][_0x0049('0x65')]+=0x1;_0x77a4f6=new Hangup(_0x3d4c62,_0x2cbd43);_0x77a4f6[_0x0049('0xea')]=0x12;_0x77a4f6['statedesc']=_0x0049('0xeb');_0x77a4f6[_0x0049('0xec')]='AMD';ami['emit']('custom:amd',ut[_0x0049('0xed')](_0x77a4f6,_0x0049('0xee')));this[_0x0049('0xd4')](_0x77a4f6,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x3d4c62[_0x0049('0x53')]!=='ivr'&&this[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]==='MACHINE'){var _0x172505=this;return new BPromise(function(_0x5b2252,_0x2dedd6){delete _0x172505['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];_0x172505['updateOriginated'](_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]]);_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;_0x172505[_0x0049('0x21')][_0x3d4c62['queue']][_0x0049('0x65')]+=0x1;var _0x2239bf=_0x172505[_0x0049('0x21')][_0x3d4c62[_0x0049('0xb4')]];var _0x41ecb1=new Hangup(_0x3d4c62,_0x2cbd43);_0x41ecb1[_0x0049('0xea')]=0x13;_0x41ecb1[_0x0049('0xa7')]='Machine';_0x41ecb1[_0x0049('0xec')]=_0x0049('0xef');_0x41ecb1[_0x0049('0xf0')]+=0x1;_0x41ecb1['countglobal']+=0x1;_0x41ecb1[_0x0049('0xee')]=!![];ami[_0x0049('0x52')](_0x0049('0xf1'),ut[_0x0049('0xed')](_0x41ecb1,_0x0049('0xee')));_0x172505[_0x0049('0xcf')](_0x41ecb1)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x41ecb1[_0x0049('0xf3')]+_0x41ecb1[_0x0049('0xf4')]+_0x41ecb1[_0x0049('0xf5')]+_0x41ecb1[_0x0049('0xf6')]+_0x41ecb1[_0x0049('0xf7')]+_0x41ecb1['countabandonedretry']+_0x41ecb1[_0x0049('0xf0')]+_0x41ecb1[_0x0049('0xf8')]>=_0x2239bf[_0x0049('0xf9')]){_0x172505[_0x0049('0xfa')](_0x41ecb1,_0x5b2252,_0x2dedd6,_0x0049('0xfb'));}else{if(_0x41ecb1[_0x0049('0xf0')]>=_0x2239bf['dialMachineMaxRetry']){_0x172505['createStateFinal'](_0x41ecb1,_0x5b2252,_0x2dedd6,'reason\x2019\x20machine....');}else{_0x172505[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x41ecb1[_0x0049('0xf0')],'scheduledat':moment()[_0x0049('0xfd')](_0x2239bf[_0x0049('0xfe')],'minutes')[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x41ecb1[_0x0049('0x100')],'ListId':_0x41ecb1[_0x0049('0xd6')],'VoiceQueueId':_0x41ecb1['VoiceQueueId']||undefined,'CampaignId':_0x41ecb1['CampaignId']||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));_0x5b2252({'reschedule':0x1});}}});}if(_0x3d4c62[_0x0049('0x53')]===_0x0049('0x92')&&this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0xe9')){delete this['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];this[_0x0049('0xb3')](this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]]);_0x77a4f6=new Hangup(_0x3d4c62,_0x2cbd43);_0x77a4f6[_0x0049('0xea')]=0x12;_0x77a4f6[_0x0049('0xa7')]=_0x0049('0xeb');_0x77a4f6[_0x0049('0xec')]=_0x0049('0xef');ami[_0x0049('0x52')](_0x0049('0xf1'),ut['buildObj'](_0x77a4f6,'amd'));this[_0x0049('0xd4')](_0x77a4f6,_0x0049('0x102'),'[syncHangupInAMDIvr]');}if(_0x3d4c62['type']===_0x0049('0x92')&&this[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0xe7')]&&_0x2cbd43[_0x0049('0xe8')]===_0x0049('0x103')){var _0x172505=this;return new BPromise(function(_0x1481dd,_0x8e166c){delete _0x172505['uniqueId'][_0x2cbd43[_0x0049('0xe2')]];_0x172505['updateOriginated'](_0x172505[_0x0049('0x22')][_0x3d4c62['queue']]);_0x172505[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;_0x172505[_0x0049('0x22')][_0x3d4c62[_0x0049('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x28c35d=_0x172505['campaigns'][_0x3d4c62['queue']];var _0x196eb9=new Hangup(_0x3d4c62,_0x2cbd43);_0x196eb9[_0x0049('0xea')]=0x13;_0x196eb9['statedesc']='Machine';_0x196eb9[_0x0049('0xec')]=_0x0049('0xef');_0x196eb9[_0x0049('0xf0')]+=0x1;_0x196eb9[_0x0049('0x104')]+=0x1;_0x196eb9[_0x0049('0xee')]=!![];ami[_0x0049('0x52')](_0x0049('0xf1'),ut[_0x0049('0xed')](_0x196eb9,_0x0049('0xee')));_0x172505[_0x0049('0xcf')](_0x196eb9)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x196eb9[_0x0049('0xf3')]+_0x196eb9[_0x0049('0xf4')]+_0x196eb9[_0x0049('0xf5')]+_0x196eb9[_0x0049('0xf6')]+_0x196eb9[_0x0049('0xf7')]+_0x196eb9[_0x0049('0x105')]+_0x196eb9[_0x0049('0xf0')]+_0x196eb9[_0x0049('0xf8')]>=_0x28c35d[_0x0049('0xf9')]){_0x172505['stateGlobal'](_0x196eb9,_0x1481dd,_0x8e166c,_0x0049('0xfb'));}else{if(_0x196eb9[_0x0049('0xf0')]>=_0x28c35d['dialMachineMaxRetry']){_0x172505['createStateFinal'](_0x196eb9,_0x1481dd,_0x8e166c,_0x0049('0x106'));}else{_0x172505[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x196eb9['countmachineretry'],'scheduledat':moment()[_0x0049('0xfd')](_0x28c35d[_0x0049('0xfe')],'minutes')[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x196eb9[_0x0049('0x100')],'ListId':_0x196eb9[_0x0049('0xd6')],'VoiceQueueId':_0x196eb9[_0x0049('0xd8')]||undefined,'CampaignId':_0x196eb9[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));_0x1481dd({'reschedule':0x1});}}});}}};Dialer[_0x0049('0x1b')][_0x0049('0x38')]=function(_0x384480){var _0x43d704=this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];var _0x54fd65=this;var _0x32c53a;if(_0x43d704&&_0x43d704[_0x0049('0x53')]==='ivr'){delete this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];this[_0x0049('0xb3')](this[_0x0049('0x22')][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x22')][_0x43d704['queue']][_0x0049('0x107')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x108')));this[_0x0049('0xcd')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x109')));}if(_0x43d704&&_0x43d704[_0x0049('0x53')]!==_0x0049('0x92')&&isNotNull(this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x10a')])){delete this['uniqueId'][_0x384480['uniqueid']];this[_0x0049('0xb3')](this['voiceQueues'][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x66')]+=0x1;this['voiceQueues'][_0x43d704['queue']][_0x0049('0x65')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);_0x32c53a[_0x0049('0xea')]=0x10;_0x32c53a[_0x0049('0xa7')]=_0x0049('0x10b');_0x32c53a['membername']=_0x0049('0x10c');this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0049('0xcd')](_0x32c53a)['catch'](loggerCatch(_0x0049('0x109')));}if(_0x43d704&&_0x43d704[_0x0049('0x53')]!==_0x0049('0x92')&&!isNotNull(this[_0x0049('0x21')][_0x43d704['queue']][_0x0049('0x10a')])){delete this[_0x0049('0x29')][_0x384480[_0x0049('0xe2')]];this[_0x0049('0xb3')](this['voiceQueues'][_0x43d704[_0x0049('0xb4')]]);this[_0x0049('0x21')][_0x43d704[_0x0049('0xb4')]][_0x0049('0x6f')]+=0x1;_0x32c53a=new Hangup(_0x43d704,_0x384480);_0x32c53a[_0x0049('0xea')]=0xc;_0x32c53a[_0x0049('0xa7')]=_0x384480['cause-txt'];_0x32c53a[_0x0049('0xec')]='Unknow';this[_0x0049('0xcf')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x108')));this[_0x0049('0xcd')](_0x32c53a)[_0x0049('0xb1')](loggerCatch(_0x0049('0x109')));}};Dialer[_0x0049('0x1b')][_0x0049('0x10d')]=function(_0x4a84ce){var _0x3a6770=this[_0x0049('0x29')][_0x4a84ce[_0x0049('0xe2')]];var _0x27521a=this;if(this['voiceQueues'][_0x4a84ce[_0x0049('0xb4')]]){if(_0x3a6770&&_0x3a6770['type']!==_0x0049('0x92')){delete this[_0x0049('0x29')][_0x4a84ce[_0x0049('0xe2')]];this['voiceQueues'][_0x4a84ce['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5378ba=new AgentComplete(_0x3a6770,_0x4a84ce);if(_0x4a84ce[_0x0049('0x10e')]==='agent'){_0x5378ba[_0x0049('0x10f')]=this[_0x0049('0x21')][_0x4a84ce['queue']][_0x0049('0x110')]&&this[_0x0049('0x21')][_0x4a84ce[_0x0049('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0x0049('0x7d')](_0x0049('0xff')):undefined;}this[_0x0049('0xcf')](_0x5378ba)[_0x0049('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x0049('0xcd')](_0x5378ba)[_0x0049('0xb1')](loggerCatch(_0x0049('0x111')));}}};Dialer[_0x0049('0x1b')][_0x0049('0x2f')]=function(_0x433d0e){if(this[_0x0049('0x21')][_0x433d0e[_0x0049('0xb4')]]){if(this[_0x0049('0x29')][_0x433d0e[_0x0049('0xe2')]]&&this[_0x0049('0x29')][_0x433d0e[_0x0049('0xe2')]][_0x0049('0x53')]!==_0x0049('0x92')){this['updateOriginated'](this[_0x0049('0x21')][_0x433d0e[_0x0049('0xb4')]]);this[_0x0049('0x29')][_0x433d0e['uniqueid']][_0x0049('0x112')]=moment()[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0049('0x1b')][_0x0049('0x113')]=function(_0x30200d,_0x4b4a7d){this['createHistory'](_0x30200d)[_0x0049('0xb1')](loggerCatch(_0x0049('0x114')));if(_0x4b4a7d==0x0){this['moveContactManagedDialer'](_0x30200d)[_0x0049('0xb1')](loggerCatch(_0x0049('0x115')));}};Dialer['prototype'][_0x0049('0x32')]=function(_0x13f6ac){var _0x29fd92=this[_0x0049('0x29')][_0x13f6ac[_0x0049('0xe2')]];var _0x4bfc32=this;var _0x45c2d4=![];var _0x5bec28;var _0xa7bd3f;if(this[_0x0049('0x21')][_0x13f6ac['queue']]){if(_0x29fd92&&_0x29fd92['type']!==_0x0049('0x92')){delete this[_0x0049('0x29')][_0x13f6ac[_0x0049('0xe2')]];this['updateOriginated'](this['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]]);_0x29fd92[_0x0049('0x116')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));var _0x2945bf=new QueueCallerAbandon(_0x29fd92,_0x13f6ac);if(getSeconds(_0x29fd92['droptime'],_0x29fd92[_0x0049('0x117')])>=_0x29fd92[_0x0049('0x118')]){this[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x119')]+=0x1;this['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x6c')]+=0x1;this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11a')]+=0x1;_0x2945bf[_0x0049('0xea')]=0xa;_0x2945bf[_0x0049('0xa7')]=_0x0049('0x11b');_0x2945bf[_0x0049('0x11c')]=_0x0049('0x11d');_0x2945bf['agiafterat']=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x110')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2945bf[_0x0049('0xf7')]+=0x1;_0x2945bf[_0x0049('0x104')]+=0x1;_0x5bec28=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11e')];_0xa7bd3f=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11f')];_0x4bfc32[_0x0049('0xba')](_0x2945bf,_0x2945bf[_0x0049('0xea')],_0x29fd92[_0x0049('0x120')])[_0x0049('0x43')](function(_0x1bfdfa){_0x45c2d4=_0x1bfdfa[_0x0049('0x121')]==0x1;if(_0x2945bf[_0x0049('0xf7')]>=_0x4bfc32['voiceQueues'][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x122')]){_0x4bfc32[_0x0049('0x113')](_0x2945bf,_0x1bfdfa[_0x0049('0x121')]);}else{_0x4bfc32[_0x0049('0xfc')]({'active':![],'countdropretry':_0x2945bf[_0x0049('0xf7')],'scheduledat':moment()[_0x0049('0xfd')](_0x4bfc32[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x11e')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x29fd92[_0x0049('0x100')],'ListId':_0x29fd92['ListId'],'VoiceQueueId':_0x29fd92[_0x0049('0xd8')]||undefined,'CampaignId':_0x29fd92[_0x0049('0xd9')]||undefined})['catch'](loggerCatch(_0x0049('0x124')));var _0x328300=new History(_0x2945bf);_0x328300['state']=0xa;_0x328300[_0x0049('0xa7')]=_0x0049('0x11b');_0x328300['starttime']=moment()[_0x0049('0x7d')](_0x0049('0xff'));_0x328300['endtime']=_0x328300[_0x0049('0xa9')];_0x328300[_0x0049('0x125')]=_0x2945bf[_0x0049('0x125')];_0x328300['calleridnum']=_0x2945bf[_0x0049('0x126')];_0x4bfc32['createHistory'](_0x328300)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x0049('0x43')](function(_0x126b8d){if(_0x45c2d4)_0x4bfc32['swapAdditionalPhones'](_0x2945bf,_0x5bec28,_0xa7bd3f)[_0x0049('0x43')](function(_0x314fb1){return 0x1;});});}else{this[_0x0049('0x21')][_0x13f6ac['queue']][_0x0049('0x72')]+=0x1;this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x6b')]+=0x1;_0x2945bf[_0x0049('0xea')]=0xb;_0x2945bf['statedesc']=_0x0049('0x127');_0x2945bf[_0x0049('0x11c')]=_0x0049('0x128');_0x2945bf[_0x0049('0x105')]+=0x1;_0x2945bf[_0x0049('0x104')]+=0x1;_0x5bec28=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]]['dialAbandonedRetryFrequency'];_0xa7bd3f=this[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x11f')];_0x4bfc32['verifyAdditionalPhones'](_0x2945bf,_0x2945bf[_0x0049('0xea')],_0x29fd92['voiceQueue'])[_0x0049('0x43')](function(_0x2cbffb){if(_0x2945bf[_0x0049('0x105')]>=_0x4bfc32[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x129')]){_0x4bfc32['queueCallerAbandonCreateState'](_0x2945bf,_0x2cbffb[_0x0049('0x121')]);}else{_0x4bfc32[_0x0049('0xfc')]({'active':![],'countabandonedretry':_0x2945bf[_0x0049('0x105')],'scheduledat':moment()['add'](_0x4bfc32[_0x0049('0x21')][_0x13f6ac[_0x0049('0xb4')]][_0x0049('0x12a')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x29fd92[_0x0049('0x100')],'ListId':_0x29fd92[_0x0049('0xd6')],'VoiceQueueId':_0x29fd92[_0x0049('0xd8')]||undefined,'CampaignId':_0x29fd92[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x12b')));var _0x350aeb=new History(_0x2945bf);_0x350aeb['state']=0xb;_0x350aeb[_0x0049('0xa7')]=_0x0049('0x127');_0x350aeb[_0x0049('0xa9')]=moment()[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');_0x350aeb[_0x0049('0xa8')]=_0x350aeb[_0x0049('0xa9')];_0x350aeb[_0x0049('0x125')]=_0x2945bf[_0x0049('0x125')];_0x350aeb[_0x0049('0x126')]=_0x2945bf[_0x0049('0x126')];_0x4bfc32[_0x0049('0xcf')](_0x350aeb)[_0x0049('0xb1')](loggerCatch(_0x0049('0x12c')));}})[_0x0049('0x43')](function(_0x1ff80f){if(_0x45c2d4)_0x4bfc32[_0x0049('0xbd')](_0x2945bf,_0x5bec28,_0xa7bd3f)[_0x0049('0x43')](function(_0x4a84da){return 0x1;});});}}}};Dialer[_0x0049('0x1b')][_0x0049('0x3a')]=function(_0x4c3649){if(this[_0x0049('0x27')][_0x4c3649[_0x0049('0xe2')]]){this['actions'][_0x4c3649[_0x0049('0xe2')]][_0x0049('0x12d')]=_0x4c3649['channel'];}if(this[_0x0049('0x29')][_0x4c3649[_0x0049('0xe2')]]){this['uniqueId'][_0x4c3649['uniqueid']]['channel']=_0x4c3649[_0x0049('0x12d')];}};Dialer['prototype'][_0x0049('0x3e')]=function(_0xa68c28){if(strategy[this[_0x0049('0x21')][this['actions'][_0xa68c28[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x55')]]===_0x0049('0x12f')){if(this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]&&_[_0x0049('0xae')](this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]][_0x0049('0x130')])&&_0xa68c28[_0x0049('0xb0')]==='1'&&_0xa68c28['paused']==='0'){if(this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]]){if(!this['agents'][_0xa68c28[_0x0049('0x131')]]['locked']){this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]][_0x0049('0x130')]=!![];this['actions'][_0xa68c28['actionid']][_0x0049('0x130')]=!![];this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]][_0x0049('0x131')]=_0xa68c28['stateinterface'];}}}}else if((strategy[this[_0x0049('0x21')][this['actions'][_0xa68c28['actionid']]['queue']][_0x0049('0x55')]]||_0x0049('0x1a'))===_0x0049('0x1a')){if(this[_0x0049('0x27')][_0xa68c28['actionid']]){if(this[_0x0049('0x23')][_0xa68c28[_0x0049('0x131')]]){this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]['stateinterface']=_0xa68c28[_0x0049('0x131')];if(_[_0x0049('0xae')](this['queueBooked'][this[_0x0049('0x27')][_0xa68c28['actionid']][_0x0049('0xb4')]])){this['queueBooked'][this[_0x0049('0x27')][_0xa68c28[_0x0049('0x12e')]]['queue']]=[];}this['queueBooked'][this['actions'][_0xa68c28[_0x0049('0x12e')]]['queue']]['push'](_[_0x0049('0x8e')](_[_0x0049('0xd5')](this[_0x0049('0x27')][_0xa68c28['actionid']],[_0x0049('0x132'),'stateinterface']),{'status':_0xa68c28[_0x0049('0xb0')],'paused':_0xa68c28[_0x0049('0x133')]}));}}}};function unlockQueueStatus(_0x3d1c31,_0x4e7b4b){setTimeout(function(){if(_[_0x0049('0x44')](_0x3d1c31[_0x0049('0x134')])){loggerBooked[_0x0049('0x95')](_0x0049('0x135'),_0x4e7b4b);}_0x3d1c31[_0x0049('0x134')]=!![];loggerBooked[_0x0049('0x80')](_0x0049('0x136'),_0x4e7b4b,JSON[_0x0049('0x4f')](_[_0x0049('0xd5')](_0x3d1c31,[_0x0049('0x46'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x0049('0x1b')][_0x0049('0x40')]=function(_0x15cbec){var _0x5290bc=this;var _0x1d06e0=_0x5290bc[_0x0049('0x21')][_0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']]['queue']];if(strategy[this['voiceQueues'][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]['queue']][_0x0049('0x55')]]===_0x0049('0x12f')){if(this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]&&this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')]){this[_0x0049('0x20')]['run'](this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x132')],this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')])[_0x0049('0xb1')](function(_0xcdfdd6){logger[_0x0049('0x95')](_0x0049('0x137'),util[_0x0049('0x94')](_0xcdfdd6,{'showHidden':![],'depth':null}));})['finally'](function(){_0x5290bc[_0x0049('0xb3')](_0x5290bc['voiceQueues'][_0x5290bc[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]);_0x5290bc[_0x0049('0x23')][_0x5290bc['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x131')]]['locked']=![];delete _0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']];unlockQueueStatus(_0x1d06e0);});}else{this[_0x0049('0xb3')](this[_0x0049('0x21')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]);this[_0x0049('0xfc')]({'active':![],'ContactId':this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0x100')],'ListId':this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xd6')],'VoiceQueueId':this[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xd8')]||undefined,'CampaignId':this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]['CampaignId']||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x15cbec[_0x0049('0x12e')]];unlockQueueStatus(_0x1d06e0);}}else if((strategy[this[_0x0049('0x21')][this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x55')]]||_0x0049('0x1a'))===_0x0049('0x1a')){var _0x747fd2;if(this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]]&&!_[_0x0049('0x4e')](this['queueBooked'][this['actions'][_0x15cbec['actionid']][_0x0049('0xb4')]])){if(this[_0x0049('0x2d')][_0x5290bc[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xb4')]]){this['queueBookedRR'][_0x5290bc[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]=this[_0x0049('0x2d')][this['actions'][_0x15cbec['actionid']][_0x0049('0xb4')]]?this[_0x0049('0x2d')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]:this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]]?this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]][_0x0049('0x138')]||0x0:0x0;}this[_0x0049('0x2c')][this[_0x0049('0x27')][_0x15cbec['actionid']][_0x0049('0xb4')]]['_rr']=this[_0x0049('0x2d')][this['actions'][_0x15cbec[_0x0049('0x12e')]][_0x0049('0xb4')]];for(var _0x38949d=0x0;_0x38949d=0x0;})[_0x0049('0xb1')](myreject(_0x107ded)));}}else{_0x2f14c5[_0x0049('0x151')](ami[_0x0049('0xaf')]({'action':_0x0049('0x14e'),'command':util['format'](_0x0049('0x152'),_0x58ef1d,!_[_0x0049('0x44')](config[_0x0049('0x14b')][_0x1a5b9e])?_0x1a5b9e:'')})[_0x0049('0x43')](function(_0x1caa01){return _0x1caa01[_0x0049('0x14f')][_0x0049('0x153')](_0x0049('0x150'))>=0x0;})['catch'](myreject(_0x107ded)));}BPromise['all'](_0x2f14c5)[_0x0049('0x43')](function(_0x382738){var _0x587090=_['some'](_0x382738);if(_0x587090){return _0x1015f4(_0x587090);}else{_0x1817b5[_0x0049('0x45')]=_0x477071?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0049('0x154');return _0x107ded(msgResponse(_0x0049('0x155'),_0x0049('0x148'),_0x0049('0x156')+_0x477071+'\x20'+_0xe5ffbb+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0049('0x94')](_0x58ef1d,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1a5b9e));}})['catch'](function(_0x18f06d){return _0x107ded(msgResponse(_0x0049('0x146'),_0x0049('0x148'),JSON[_0x0049('0x4f')](_0x18f06d)));});});};Dialer['prototype'][_0x0049('0x157')]=function(_0x45a7a4){var _0x2d0194=this;return function(){switch(_0x45a7a4['dialMethod']){case _0x0049('0x158'):freeVariablesPredictive(_0x45a7a4);_0x2d0194['handlePower'](_0x45a7a4,0x1);break;case _0x0049('0x159'):freeVariablesPredictive(_0x45a7a4);_0x2d0194[_0x0049('0x15a')](_0x45a7a4,_0x45a7a4[_0x0049('0x15b')]);break;case _0x0049('0x7'):_0x2d0194[_0x0049('0x7')](_0x45a7a4);break;case _0x0049('0x6'):freeVariablesPredictive(_0x45a7a4);_0x2d0194[_0x0049('0x15a')](_0x45a7a4,0x1);break;default:freeVariablesPredictive(_0x45a7a4);logger['error'](_0x0049('0x15c'),_0x45a7a4[_0x0049('0x46')],_0x0049('0x15d'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x46f442){var _0x6c881a=this;return function(){_0x6c881a[_0x0049('0x15e')](_0x46f442);};};Dialer[_0x0049('0x1b')][_0x0049('0x9')]=function(_0x3f6b5a){var _0x4abb50=this;if(isNotPreview(_0x3f6b5a[_0x0049('0x63')])){if(isVoiceQueueOutbound(_0x3f6b5a['type'])&&isActive(_0x3f6b5a[_0x0049('0x62')])){_0x3f6b5a[_0x0049('0x9f')]=!![];BPromise[_0x0049('0xbb')]()['then'](checkIsLoggedIn(_0x3f6b5a,_0x3f6b5a['loggedIn']))[_0x0049('0x43')](checkIsActive(_0x3f6b5a,_0x3f6b5a['dialActive']))[_0x0049('0x43')](checkInterval(_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x142')](_0x3f6b5a))['then'](_0x4abb50[_0x0049('0x145')](_0x3f6b5a[_0x0049('0x15f')],_0x3f6b5a[_0x0049('0x160')],_0x3f6b5a[_0x0049('0x46')],_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x147')](_0x3f6b5a[_0x0049('0x4a')],_0x3f6b5a[_0x0049('0x160')],_0x3f6b5a[_0x0049('0x46')],_0x3f6b5a))[_0x0049('0x43')](_0x4abb50[_0x0049('0x157')](_0x3f6b5a))['catch'](loggerCatchQueueSummary(_0x0049('0x161'),_0x3f6b5a));}else{notSendMessagesQueue(_0x3f6b5a);}}else{freeVariablesPredictive(_0x3f6b5a);}};Dialer[_0x0049('0x1b')][_0x0049('0x162')]=_['throttle'](function(){var _0x5226a6=_[_0x0049('0x163')](this[_0x0049('0x21')],function(_0x3d399f){return _0x3d399f[_0x0049('0x164')];});var _0x4daeed=_[_0x0049('0x163')](this[_0x0049('0x23')],function(_0x4fcb49){return _0x4fcb49[_0x0049('0x165')]&&_0x4fcb49[_0x0049('0xb0')]==='reachable';});if(_0x5226a6[_0x0049('0x97')]>0x0&&_0x4daeed[_0x0049('0x97')]>0x0){return BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x5226a6,'id'),previewRecallmeReminderInterval,_[_0x0049('0x166')](_0x4daeed,'id')))[_0x0049('0x43')](function(_0x19050a){for(var _0x1bb9d6=0x0;_0x1bb9d6<_0x19050a[_0x0049('0x97')];_0x1bb9d6++){var _0x522aa2=_0x19050a[_0x1bb9d6][_0x0049('0x167')][_0x0049('0x46')];if(_0x522aa2)io['to'](util[_0x0049('0x7d')]('user:%s',_0x522aa2))[_0x0049('0x52')]('user:dialPreviewRecallReminder',{'hopper':_0x19050a[_0x1bb9d6]});}})[_0x0049('0xb1')](function(_0x3c7774){logger[_0x0049('0x95')]('checkPreviewRecallReminder',_0x3c7774);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0049('0x141')]=function(){var _0x42d4ac=this;var _0x15ded0;for(var _0xe94d54 in this[_0x0049('0x22')]){if(typeof this['campaigns'][_0xe94d54]!==_0x0049('0xad')){_0x15ded0=this[_0x0049('0x22')][_0xe94d54];if(isCampaignIvr(_0x15ded0[_0x0049('0x53')])&&isActive(_0x15ded0[_0x0049('0xdf')])){_0x15ded0['sendMessageOneNotActive']=!![];BPromise[_0x0049('0xbb')]()[_0x0049('0x43')](checkIsActive(_0x15ded0,_0x15ded0[_0x0049('0xdf')]))[_0x0049('0x43')](checkInterval(_0x15ded0))[_0x0049('0x43')](_0x42d4ac[_0x0049('0x142')](_0x15ded0))[_0x0049('0x43')](_0x42d4ac['checkIfTime'](_0x15ded0[_0x0049('0x15f')],_0x15ded0[_0x0049('0x160')],_0x15ded0[_0x0049('0x46')],_0x15ded0))[_0x0049('0x43')](_0x42d4ac['checkIfTimeIntervals'](_0x15ded0[_0x0049('0x4a')],_0x15ded0[_0x0049('0x160')],_0x15ded0[_0x0049('0x46')],_0x15ded0))[_0x0049('0x43')](_0x42d4ac[_0x0049('0x168')](_0x15ded0))['catch'](loggerCatchQueueSummary(_0x0049('0x169'),_0x15ded0));}else{notSendMessagesCampaign(_0x15ded0);}}}};function getCallerIdRandom(_0x27477b,_0x7fd5f0){var _0x7d2f85;var _0x5e0010;var _0x1bbba7;if(_0x7fd5f0<=0x0){_0x7fd5f0=0x1;}_0x7d2f85=new RegExp(_0x0049('0x16a')+_0x7fd5f0+'}$');_0x5e0010=Math[_0x0049('0x16b')](0xa,_0x7fd5f0-0x1);_0x1bbba7=Math['pow'](0xa,_0x7fd5f0)-0x1;return util[_0x0049('0x7d')]('%s',_['replace'](_0x27477b,_0x7d2f85,_[_0x0049('0x16c')](_0x5e0010,_0x1bbba7)));}function extractCalleridName(_0xd6ccae){var _0x430083=_0xd6ccae[_0x0049('0x16d')](/"(.*?)"/);return _0x430083?_0x430083[0x1]:_0xd6ccae;}function extractCalleridNumber(_0x50ba91){var _0x985ea0=_0x50ba91[_0x0049('0x16d')](/<(.*?)>/);return _0x985ea0?_0x985ea0[0x1]:_0x50ba91;}Dialer[_0x0049('0x1b')][_0x0049('0x16e')]=function(_0x3dec60,_0x3425a6){var _0x3eaa4c=this;var _0x136bd7=uuid['v4']();this[_0x0049('0x27')][_0x136bd7]=new Action(_0x3dec60,_0x3425a6,_0x136bd7);return new BPromise(function(_0x4d2613,_0x2d2cb0){if(_[_0x0049('0x44')](_0x3dec60)&&typeof _0x3dec60!==_0x0049('0x16f')){return _0x2d2cb0(msgResponse('originate',_0x0049('0x148'),'voiceQueue\x20is\x20undefine'));}if(_[_0x0049('0x44')](_0x3425a6[_0x0049('0x170')])||_0x3425a6[_0x0049('0x170')]===null){return _0x2d2cb0(msgResponse(_0x0049('0x171'),'Failure',_0x0049('0x172')));}var _0x1f5d06={'XMD-CALLERID':_0x3eaa4c[_0x0049('0x27')][_0x136bd7][_0x0049('0x173')](),'XMD-AGI':_0x3dec60['dialQueueProject']?util[_0x0049('0x7d')](_0x0049('0x174'),ipAgi,_0x3dec60['dialQueueProject']):_0x0049('0x175'),'XMD-AGIAFTER':_0x3dec60[_0x0049('0x110')]?util['format'](_0x0049('0x174'),ipAgi,_0x3dec60['dialQueueProject2']):_0x0049('0x175'),'XMD-QUEUE':_0x3dec60[_0x0049('0x53')]===_0x0049('0x54')?util[_0x0049('0x7d')](_0x0049('0x176'),_0x3dec60[_0x0049('0x46')],_0x3dec60['dialQueueOptions']||'',_0x3dec60[_0x0049('0x177')]?'c':'',_0x3dec60[_0x0049('0x118')]||0x3):_0x0049('0x175'),'XMD-CONTACTID':_0x3425a6[_0x0049('0x100')],'XMD-CDRTYPE':_0x0049('0x5'),'CALLERID(all)':_0x3eaa4c['actions'][_0x136bd7][_0x0049('0x173')](),'XMD-AMD':_0x3dec60[_0x0049('0xe7')]?_0x0049('0x178'):_0x0049('0x175'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3dec60[_0x0049('0xe7')]){_0x1f5d06[_0x0049('0x179')]=_0x3dec60[_0x0049('0x17a')]||0x9c4;_0x1f5d06[_0x0049('0x17b')]=_0x3dec60['dialAMDGreeting']||0x5dc;_0x1f5d06[_0x0049('0x17c')]=_0x3dec60[_0x0049('0x17d')]||0x320;_0x1f5d06[_0x0049('0x17e')]=_0x3dec60[_0x0049('0x17f')]||0x1388;_0x1f5d06[_0x0049('0x180')]=_0x3dec60[_0x0049('0x181')]||0x64;_0x1f5d06['XMD-AMDBETWEENWORDSSILENCE']=_0x3dec60[_0x0049('0x182')]||0x32;_0x1f5d06[_0x0049('0x183')]=_0x3dec60[_0x0049('0x184')]||0x3;_0x1f5d06[_0x0049('0x185')]=_0x3dec60['dialAMDSilenceThreshold']||0x100;_0x1f5d06[_0x0049('0x186')]=_0x3dec60[_0x0049('0x187')]||0x1388;}if(_0x3dec60['type']==='outbound'){_0x1f5d06[_0x0049('0x188')]=_0x3425a6[_0x0049('0xd8')];}else{_0x1f5d06[_0x0049('0x189')]=_0x3425a6[_0x0049('0xd9')];}for(var _0x4328c3 in _0x3425a6['Contact']){if(typeof _0x3425a6[_0x0049('0x18a')][_0x4328c3]!==_0x0049('0xad')){if(isNotNull(_0x3425a6[_0x0049('0x18a')][_0x4328c3])&&_0x4328c3!=='id'&&_0x4328c3!==_0x0049('0x18b')&&_0x4328c3!==_0x0049('0x18c')&&_0x4328c3!==_0x0049('0x18d')){_0x1f5d06[util[_0x0049('0x7d')]('%s%s',_0x0049('0x18e'),_[_0x0049('0x18f')](_0x4328c3))]=_0x3425a6[_0x0049('0x18a')][_0x4328c3];}}}var _0x5c1807=_0x3eaa4c[_0x0049('0xde')](_0x3dec60[_0x0049('0x7a')])?getCallerId(_0x3dec60[_0x0049('0x7a')][_0x0049('0x7b')],_0x3dec60[_0x0049('0x190')],_0x3dec60[_0x0049('0x191')]>0x0?getCallerIdRandom(_0x3dec60[_0x0049('0x192')],_0x3dec60[_0x0049('0x191')]):_0x3dec60[_0x0049('0x192')]):getCallerId(_[_0x0049('0xae')](_0x3dec60[_0x0049('0x143')])?_0x3dec60['Trunk'][_0x0049('0x7b')]:_0x3dec60['TrunkBackup'][_0x0049('0x7b')],_0x3dec60['dialOriginateCallerIdName'],_0x3dec60['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3dec60[_0x0049('0x192')],_0x3dec60['dialRandomLastDigitCallerIdNumber']):_0x3dec60[_0x0049('0x192')]);if(_0x5c1807){_0x1f5d06[_0x0049('0x193')]=_0x3eaa4c[_0x0049('0x27')][_0x136bd7][_0x0049('0x194')]=extractCalleridName(_0x5c1807);_0x1f5d06[_0x0049('0x195')]=_0x3425a6[_0x0049('0x170')];}return ami[_0x0049('0xaf')]({'actionid':_0x136bd7,'action':_0x0049('0x171'),'channel':_0x3eaa4c['isTrunkReachable'](_0x3dec60[_0x0049('0x7a')])?util[_0x0049('0x7d')](_0x0049('0x196'),_0x3dec60[_0x0049('0x7a')][_0x0049('0x46')],isNotNull(_0x3dec60[_0x0049('0x197')])?_0x3dec60[_0x0049('0x197')][_0x0049('0x198')]()||'':'',_0x3dec60[_0x0049('0x199')]>0x0?_0x3425a6[_0x0049('0x170')][_0x0049('0x19a')](_0x3dec60[_0x0049('0x199')]):_0x3425a6[_0x0049('0x170')]):util[_0x0049('0x7d')](_0x0049('0x196'),_[_0x0049('0xae')](_0x3dec60[_0x0049('0x143')])?_0x3dec60[_0x0049('0x7a')][_0x0049('0x46')]:_0x3dec60[_0x0049('0x143')]['name'],isNotNull(_0x3dec60['dialPrefix'])?_0x3dec60['dialPrefix'][_0x0049('0x198')]()||'':'',_0x3dec60[_0x0049('0x199')]>0x0?_0x3425a6[_0x0049('0x170')][_0x0049('0x19a')](_0x3dec60[_0x0049('0x199')]):_0x3425a6['phone']),'callerid':_0x5c1807,'Exten':_0x0049('0xe6'),'Context':_0x0049('0x19b'),'Priority':'1','variable':_0x1f5d06,'timeout':(_0x3dec60[_0x0049('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x136bd7})['then'](function(_0x23b67e){return _0x4d2613(_0x23b67e);})['catch'](function(_0x2ebad4){_0x3dec60[_0x0049('0x19c')]+=0x1;var _0x192514=new History(_0x3eaa4c[_0x0049('0x27')][_0x136bd7]);logger[_0x0049('0x95')](util['format']('[originateError]:\x20%s',JSON[_0x0049('0x4f')](_0x2ebad4)));_0x192514['state']=0xe;_0x192514['statedesc']=_0x0049('0x19d');_0x192514[_0x0049('0xa9')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));_0x192514[_0x0049('0xa8')]=_0x192514[_0x0049('0xa9')];_0x3eaa4c[_0x0049('0xcf')](_0x192514)[_0x0049('0xb1')](loggerCatch('[originate][error]'));_0x3eaa4c['moveContactManagedDialer'](_0x192514)[_0x0049('0xb1')](loggerCatch(_0x0049('0x19e')))[_0x0049('0x1e')](function(){delete _0x3eaa4c[_0x0049('0x27')][_0x136bd7];return _0x2d2cb0(msgResponse(_0x0049('0x171'),_0x0049('0x19f'),_0x0049('0x1a0')));});});});};Dialer['prototype'][_0x0049('0x34')]=function(_0x42cecc){var _0x40655c=this['actions'][_0x42cecc[_0x0049('0x12e')]];if(_0x40655c){delete this['actions'][_0x42cecc[_0x0049('0x12e')]];_0x40655c[_0x0049('0x117')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));var _0x190c32=_0x40655c[_0x0049('0x53')]===_0x0049('0x92')?this['campaigns'][_0x40655c[_0x0049('0xb4')]]:this[_0x0049('0x21')][_0x40655c[_0x0049('0x1a1')]()];if(!this[_0x0049('0xdc')](_0x42cecc[_0x0049('0x1a2')])){this['updateOriginated'](_0x190c32);return this[_0x0049('0x1a3')](_0x40655c,_0x190c32,_0x42cecc)[_0x0049('0xb1')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x0049('0x29')][_0x42cecc[_0x0049('0xe2')]]=_0x40655c;}};Dialer[_0x0049('0x1b')][_0x0049('0x1a4')]=function(_0x4289be,_0x1c5164,_0x2803ec){var _0x19fae5=new History(_0x1c5164);if(_0x19fae5[_0x0049('0xf3')]+_0x19fae5[_0x0049('0xf4')]+_0x19fae5[_0x0049('0xf5')]+_0x19fae5[_0x0049('0xf6')]+_0x19fae5[_0x0049('0xf7')]+_0x19fae5[_0x0049('0x105')]+_0x19fae5['countmachineretry']+_0x19fae5[_0x0049('0xf8')]>=_0x2803ec[_0x0049('0xf9')]-0x1){return!![];}switch(_0x4289be){case 0x3:if(_0x19fae5[_0x0049('0xf5')]>=_0x2803ec[_0x0049('0x1a5')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countnoanswerretry':_0x19fae5[_0x0049('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1a6')],'minutes')['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5['VoiceQueueId']||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x19fae5[_0x0049('0xf3')]>=_0x2803ec[_0x0049('0x1a7')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countbusyretry':_0x19fae5['countbusyretry']+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x1a8')],'minutes')['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1a9')));break;case 0x8:if(_0x19fae5[_0x0049('0xf4')]>=_0x2803ec[_0x0049('0x1aa')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x19fae5[_0x0049('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1ab')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1ac')));break;case 0x0:if(_0x19fae5['countnosuchnumberretry']>=_0x2803ec['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x0049('0xfc')]({'active':![],'countnosuchnumberretry':_0x19fae5[_0x0049('0xf6')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x1ad')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})['catch'](loggerCatch(_0x0049('0x1ae')));}break;case 0xa:if(_0x19fae5['countdropretry']>=_0x2803ec[_0x0049('0x122')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countdropretry':_0x19fae5[_0x0049('0xf7')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x11e')],_0x0049('0x123'))[_0x0049('0x7d')](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x124')));break;case 0xb:if(_0x19fae5[_0x0049('0x105')]>=_0x2803ec['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countabandonedretry':_0x19fae5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec[_0x0049('0x12a')],_0x0049('0x123'))[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x12b')));break;case 0x13:if(_0x19fae5['countmachineretry']>=_0x2803ec[_0x0049('0x1af')]-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countmachineretry':_0x19fae5[_0x0049('0xf0')]+=0x1,'scheduledat':moment()[_0x0049('0xfd')](_0x2803ec['dialMachineRetryFrequency'],_0x0049('0x123'))[_0x0049('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19fae5['ContactId'],'ListId':_0x19fae5[_0x0049('0xd6')],'VoiceQueueId':_0x19fae5['VoiceQueueId']||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x101')));break;case 0x14:if(_0x19fae5[_0x0049('0xf8')]>=_0x2803ec['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x0049('0xfc')]({'active':![],'countagentrejectretry':_0x19fae5[_0x0049('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x2803ec[_0x0049('0x1b0')],_0x0049('0x123'))['format'](_0x0049('0xff')),'ContactId':_0x19fae5[_0x0049('0x100')],'ListId':_0x19fae5['ListId'],'VoiceQueueId':_0x19fae5[_0x0049('0xd8')]||undefined,'CampaignId':_0x19fae5[_0x0049('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x0049('0x1b')]['callProgressDetecting']=function(_0xb15b6d,_0x1cfb68,_0x14e8bd){var _0x2b3629=this;var _0x1e0de6=new History(_0xb15b6d);var _0x5d2129=![];var _0x2e1342;var _0x5306ff;return new BPromise(function(_0x104904,_0x1a221b){if(_[_0x0049('0x44')](_0x1cfb68)&&typeof _0x1cfb68!==_0x0049('0x16f')){return _0x1a221b(msgResponse(_0x0049('0x1b1'),_0x0049('0x148'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x14e8bd)&&typeof _0x14e8bd!==_0x0049('0x16f')){return _0x1a221b(msgResponse('[callProgressDetecting]','Failure',_0x0049('0x1b2')));}_0x2b3629[_0x0049('0xba')](_0x1e0de6,_0x14e8bd[_0x0049('0x10e')],_0x1cfb68)[_0x0049('0x43')](function(_0x590480){if(_0x590480['additional']==0x1)_0x5d2129=!![];switch(_0x14e8bd[_0x0049('0x10e')]){case'0':_0x1cfb68[_0x0049('0x1b3')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x0;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1b4');_0x1e0de6[_0x0049('0xf6')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;ami[_0x0049('0x52')](_0x0049('0x1b5'),ut['buildObj'](_0xb15b6d,_0x0049('0x1b6')));_0x2e1342=_0x1cfb68[_0x0049('0x1ad')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629[_0x0049('0xcf')](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0xf2')));if(_0x2b3629[_0x0049('0x1a4')](0x0,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf6')]>=_0x1cfb68[_0x0049('0x1b7')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,'reason\x200\x20no\x20such\x20number....');}else{_0x2b3629['stateGlobal'](_0x1e0de6,_0x104904,_0x1a221b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1cfb68[_0x0049('0x1b9')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x3;_0x1e0de6[_0x0049('0xa7')]='NoAnswer';_0x1e0de6[_0x0049('0xf5')]+=0x1;_0x1e0de6['countglobal']+=0x1;ami[_0x0049('0x52')](_0x0049('0x1ba'),ut['buildObj'](_0xb15b6d,_0x0049('0x1bb')));_0x2e1342=_0x1cfb68[_0x0049('0x1a6')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1bc')));if(_0x2b3629[_0x0049('0x1a4')](0x3,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf5')]>=_0x1cfb68[_0x0049('0x1a5')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1bd'));}}break;case'5':_0x1cfb68[_0x0049('0x68')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x5;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1be');_0x1e0de6['countbusyretry']+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;ami[_0x0049('0x52')](_0x0049('0x1bf'),ut[_0x0049('0xed')](_0xb15b6d,_0x0049('0x1c0')));_0x2e1342=_0x1cfb68[_0x0049('0x1a8')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2b3629['checkRetriveMax'](0x5,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countbusyretry']>=_0x1cfb68['dialBusyMaxRetry']){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c1'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c1'));}}break;case'8':_0x1cfb68[_0x0049('0x69')]+=0x1;_0x1e0de6['state']=0x8;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x1c2');_0x1e0de6[_0x0049('0xf4')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68['dialCongestionRetryFrequency'];_0x5306ff=_0x1cfb68['callAdditionalPhoneAfterMin'];ami[_0x0049('0x52')]('custom:agentcongestion',ut[_0x0049('0xed')](_0xb15b6d,_0x0049('0x1c3')));_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1c4')));if(_0x2b3629[_0x0049('0x1a4')](0x8,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf4')]>=_0x1cfb68[_0x0049('0x1aa')]){_0x2b3629['createStateFinal'](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c5'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c5'));}}break;case'11':_0x1cfb68[_0x0049('0x1c6')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0xb;_0x1e0de6[_0x0049('0xa7')]=_0x0049('0x127');_0x1e0de6[_0x0049('0x105')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68[_0x0049('0x12a')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629['createHistory'](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x12c')));if(_0x2b3629[_0x0049('0x1a4')](0xb,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countabandonedretry']>=_0x1cfb68[_0x0049('0x129')]){_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c7'));}else{_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1c7'));}}break;case'20':_0x1cfb68[_0x0049('0x6e')]+=0x1;_0x1e0de6[_0x0049('0xea')]=0x14;_0x1e0de6[_0x0049('0xa7')]='AgentReject';_0x1e0de6[_0x0049('0xf8')]+=0x1;_0x1e0de6[_0x0049('0x104')]+=0x1;_0x2e1342=_0x1cfb68[_0x0049('0x1b0')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];ami[_0x0049('0x52')](_0x0049('0x1c8'),ut['buildObj'](_0xb15b6d,_0x0049('0x1c9')));_0x2b3629['createHistory'](_0x1e0de6)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2b3629[_0x0049('0x1a4')](0x14,_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6['countagentrejectretry']>=_0x1cfb68['dialAgentRejectMaxRetry']){_0x2b3629['createStateFinal'](_0x1e0de6,_0x104904,_0x1a221b,'reason\x2020\x20agentreject');}else{_0x2b3629['stateGlobal'](_0x1e0de6,_0x104904,_0x1a221b,_0x0049('0x1ca'));}}break;default:_0x1cfb68[_0x0049('0x6f')]+=0x1;_0x1e0de6['state']=0xc;_0x1e0de6[_0x0049('0xa7')]=_0x14e8bd[_0x0049('0x10e')];_0x2e1342=_0x1cfb68[_0x0049('0x1b0')];_0x5306ff=_0x1cfb68[_0x0049('0x11f')];_0x2b3629[_0x0049('0xcf')](_0x1e0de6)[_0x0049('0xb1')](loggerCatch(_0x0049('0x1cb')));if(_0x2b3629[_0x0049('0x1a4')](_0x14e8bd['reason'],_0xb15b6d,_0x1cfb68)&&!_0x5d2129){if(_0x1e0de6[_0x0049('0xf3')]+_0x1e0de6[_0x0049('0xf4')]+_0x1e0de6[_0x0049('0xf5')]+_0x1e0de6[_0x0049('0xf6')]+_0x1e0de6['countdropretry']+_0x1e0de6['countabandonedretry']+_0x1e0de6[_0x0049('0xf0')]+_0x1e0de6[_0x0049('0xf8')]>=_0x1cfb68['dialGlobalMaxRetry']){_0x2b3629[_0x0049('0xfa')](_0x1e0de6,_0x104904,_0x1a221b,_0x14e8bd[_0x0049('0x10e')]);}else{_0x2b3629[_0x0049('0x1b8')](_0x1e0de6,_0x104904,_0x1a221b,_0x14e8bd[_0x0049('0x10e')]);}}}})[_0x0049('0x43')](function(_0x5228c5){if(_0x5d2129){_0x2b3629[_0x0049('0xbd')](_0x1e0de6,_0x2e1342,_0x5306ff)[_0x0049('0x43')](function(_0x16bbf3){return _0x104904(0x1);});}});});};Dialer[_0x0049('0x1b')][_0x0049('0xfa')]=function(_0x47a26a,_0x34fa4f,_0x37070a,_0x386b2e){var _0x5012ef=new Final(_0x47a26a);_0x5012ef[_0x0049('0xea')]=0xf;_0x5012ef[_0x0049('0xa7')]='Global';this[_0x0049('0x1b8')](_0x5012ef,_0x34fa4f,_0x37070a,_0x386b2e);};Dialer[_0x0049('0x1b')][_0x0049('0x1b8')]=function(_0x3956fa,_0x44a806,_0x2010b8,_0x1b93f9){this[_0x0049('0xcd')](_0x3956fa)[_0x0049('0x43')](function(){return _0x44a806(msgResponse(_0x0049('0x1b1'),'Success',_0x1b93f9));})[_0x0049('0xb1')](function(){return _0x2010b8(msgResponse(_0x0049('0x1cc'),_0x0049('0x148'),_0x0049('0x1cd')));});};Dialer[_0x0049('0x1b')][_0x0049('0x7')]=function(_0x7e7126){var _0x1485a9=_0x7e7126['dialPredictiveOptimizationPercentage']/0x64;var _0x19603c=_0x7e7126[_0x0049('0x6c')]/(_0x7e7126[_0x0049('0x6c')]+_0x7e7126['outboundAnswerCallsDay']);var _0x213021=Math['round'](_0x7e7126['predictiveIntervalAvailable']*(_0x7e7126['predictiveIntervalMaxThreshold']/0x64));var _0x764c71=Math[_0x0049('0x1ce')](_0x7e7126[_0x0049('0x74')]*(_0x7e7126[_0x0049('0x1cf')]/0x64));var _0x537fd6=_0x7e7126[_0x0049('0x57')]+_0x7e7126[_0x0049('0x5d')];var _0x134354=Math[_0x0049('0x1d0')](_0x7e7126['erlangCalls']*_0x7e7126[_0x0049('0x78')]*_0x7e7126[_0x0049('0x73')]*_0x7e7126[_0x0049('0x1d1')]);if(_['isUndefined'](_0x7e7126['startProgressive'])){if(!_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2a')])){_0x7e7126['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x7e7126[_0x0049('0x90')])){loggerPredictive[_0x0049('0x95')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x7e7126[_0x0049('0x90')]);_0x7e7126['handlePredictive']=undefined;}_0x7e7126[_0x0049('0x2b')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x7e7126[_0x0049('0x2b')]);this[_0x0049('0x15a')](_0x7e7126,0x1);}else if(ifInterval(_0x7e7126[_0x0049('0x1d2')],_0x7e7126['startProgressive'])){this[_0x0049('0x15a')](_0x7e7126,0x1);loggerPredictiveCalls['info'](_0x0049('0x1d3'),_0x7e7126[_0x0049('0x2b')],_0x7e7126[_0x0049('0x46')]);_0x7e7126[_0x0049('0x77')]=0x0;_0x7e7126[_0x0049('0x11a')]=0x0;}else if(_0x1485a9<_0x19603c&&_0x7e7126[_0x0049('0x1d4')]===_0x0049('0x1d5')){freeVariablesPredictive(_0x7e7126);loggerPredictive['info'](_0x0049('0x1d6'),_0x0049('0x1d7'),_0x19603c,'startProgressive',_0x7e7126[_0x0049('0x46')]);}else if(_0x134354<_0x7e7126['predictiveIntervalErlangCallsDroppedCalls']&&_0x7e7126[_0x0049('0x1d4')]===_0x0049('0x1d5')){freeVariablesPredictive(_0x7e7126);loggerPredictive[_0x0049('0x80')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x0049('0x1d8'),_0x134354,_0x0049('0x1d9'),_0x7e7126[_0x0049('0x11a')],'startProgressive',_0x7e7126[_0x0049('0x46')]);}else if(!ifInterval(_0x7e7126['dialPredictiveInterval'],_0x7e7126[_0x0049('0x2b')])&&_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2a')])&&!_[_0x0049('0x44')](_0x7e7126[_0x0049('0x2b')])){_0x7e7126[_0x0049('0x2a')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126['name'],_0x0049('0x1da'),_0x7e7126['startPredictive']);this['averageHandleTime'](_0x7e7126['dialPredictiveInterval'])[_0x0049('0x43')](this['getDataPredictive'](_0x7e7126))[_0x0049('0x43')](mergeDataErlangB(_0x7e7126))[_0x0049('0x43')](this[_0x0049('0x1db')](_0x7e7126))['catch'](loggerCatchPredictive(_0x0049('0x1dc'),_0x7e7126));}else if(!ifInterval(_0x7e7126[_0x0049('0x1d2')],_0x7e7126['startPredictive'])){_0x7e7126[_0x0049('0x11a')]=0x0;_0x7e7126[_0x0049('0x2a')]=moment()[_0x0049('0x7d')](_0x0049('0xff'));loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],'recalculate\x20predictive\x20at',_0x7e7126[_0x0049('0x2a')]);clearInterval(_0x7e7126['handlePredictive']);_0x7e7126[_0x0049('0x90')]=undefined;this[_0x0049('0xc0')](_0x7e7126['dialPredictiveInterval'])[_0x0049('0x43')](this[_0x0049('0x1dd')](_0x7e7126))[_0x0049('0x43')](mergeDataErlangB(_0x7e7126))[_0x0049('0x43')](this[_0x0049('0x1db')](_0x7e7126))['catch'](loggerCatchPredictive(_0x0049('0x1de'),_0x7e7126));}else if(_0x7e7126[_0x0049('0x74')]&&_0x537fd6<_0x7e7126[_0x0049('0x74')]-_0x764c71){freeVariablesPredictive(_0x7e7126);loggerPredictive[_0x0049('0x80')](_0x7e7126[_0x0049('0x46')],_0x0049('0x1df'),_0x537fd6,')\x20are\x20less\x20than\x20threshold\x20(',_0x7e7126['predictiveIntervalAvailable'],'-',_0x764c71,'=',_0x7e7126[_0x0049('0x74')]-_0x764c71,')');}else if(_0x7e7126['predictiveIntervalAvailable']&&_0x537fd6>_0x7e7126['predictiveIntervalAvailable']+_0x213021){freeVariablesPredictive(_0x7e7126);loggerPredictive['info'](_0x7e7126[_0x0049('0x46')],_0x0049('0x1df'),_0x537fd6,_0x0049('0x1e0'),_0x7e7126[_0x0049('0x74')],'+',_0x213021,'=',_0x7e7126[_0x0049('0x74')]+_0x213021,')');}};Dialer[_0x0049('0x1b')][_0x0049('0x1dd')]=function(_0x26a82a){var _0x1d6532=this;return function(_0x26c64d){return new BPromise(function(_0x4a064a,_0x2aad8e){_['merge'](_0x26a82a,_0x26c64d[0x0]);if(checkGetDataPredictive(_0x26c64d[0x0])){var _0x220410=_0x26a82a[_0x0049('0x74')]=_0x26a82a[_0x0049('0x5d')]+_0x26a82a[_0x0049('0x57')];var _0x315297=_0x26a82a[_0x0049('0x1d2')]*0x3c;var _0xa8126a=_0x26c64d[0x0]['predictiveIntervalAvgTalktime']+_0x26c64d[0x0][_0x0049('0x70')];var _0xcc1f9b=(_0x26c64d[0x0][_0x0049('0x1e1')]+_0x26c64d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x26c64d[0x0][_0x0049('0x72')])/_0x26c64d[0x0][_0x0049('0x75')];_0x26a82a[_0x0049('0x73')]=_0xcc1f9b>0x0?_0xcc1f9b:0x1;switch(_0x26a82a[_0x0049('0x1d4')]){case _0x0049('0x1d5'):var _0x14ea45=_0x26a82a['dialPredictiveOptimizationPercentage']/0x64;return _0x1d6532['abandonmentRate'](_0x220410,_0x315297,_0xa8126a,_0xcc1f9b,_0x14ea45)[_0x0049('0x43')](function(_0x27d838){return _0x4a064a(_0x27d838);});case _0x0049('0x1e2'):var _0xaa7bf2=_0x26a82a[_0x0049('0x1e3')]/0x64;return _0x1d6532[_0x0049('0x1e4')](_0x220410,_0x315297,_0xa8126a,_0xcc1f9b,_0xaa7bf2)[_0x0049('0x43')](function(_0x410660){return _0x4a064a(_0x410660);});default:return _0x2aad8e(msgResponse(_0x0049('0x1e5'),'Failure',_0x0049('0x1e6')));}}else{return _0x2aad8e(msgResponse(_0x0049('0x1e5'),_0x0049('0x148'),_0x0049('0x1e7')));}});};};Dialer[_0x0049('0x1b')][_0x0049('0x1e8')]=function(_0x4fa6b0){var _0x2f87e5=this;return function(_0x419fe4){return new BPromise(function(_0x3c42db,_0x5eb9bc){_['merge'](_0x4fa6b0,_0x419fe4[0x0]);if(checkGetDataPredictive(_0x419fe4[0x0])){loggerPredictive[_0x0049('0x80')](JSON[_0x0049('0x4f')](_0x419fe4[0x0]));if(_0x4fa6b0[_0x0049('0x1d4')]==='dropRate'){return _0x2f87e5['getVoiceQueueRtPauses'](_0x4fa6b0['id'])['then'](function(_0x526f2c){var _0x403212=_0x4fa6b0[_0x0049('0x58')]-_0x526f2c[0x0]['outboundQueuePauses'];var _0x4bf495=_0x4fa6b0['dialPredictiveInterval']*0x3c;var _0x81852e=_0x419fe4[0x0]['predictiveIntervalAvgTalktime']+_0x419fe4[0x0][_0x0049('0x70')];var _0xd57275=(_0x419fe4[0x0][_0x0049('0x1e1')]+_0x419fe4[0x0][_0x0049('0x119')]+_0x419fe4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x419fe4[0x0][_0x0049('0x75')];var _0x58a689=_0x4fa6b0[_0x0049('0x1e3')]/0x64;_0x4fa6b0[_0x0049('0x1e9')]=_0x526f2c[0x0][_0x0049('0x1ea')]||0x0;_0x4fa6b0[_0x0049('0x73')]=_0xd57275>0x0?_0xd57275:0x1;return _0x2f87e5[_0x0049('0x1eb')](_0x403212,_0x4bf495,_0x81852e,_0xd57275,_0x58a689);})[_0x0049('0x43')](function(_0x337783){return _0x3c42db(_0x337783);})[_0x0049('0xb1')](function(_0x486cd4){return _0x5eb9bc(msgResponse('[CatchErlangB]',_0x0049('0x148'),JSON['stringify'](_0x486cd4)));});}if(_0x4fa6b0[_0x0049('0x1d4')]===_0x0049('0x1e2')){return _0x2f87e5[_0x0049('0xcb')](_0x4fa6b0['id'])['then'](function(_0x127552){var _0x3bce22=_0x4fa6b0[_0x0049('0x58')]-_0x127552[0x0][_0x0049('0x1ea')];var _0x395df6=_0x4fa6b0[_0x0049('0x1d2')]*0x3c;var _0x175e7c=_0x419fe4[0x0][_0x0049('0x71')]+_0x419fe4[0x0][_0x0049('0x70')];var _0x44dc57=(_0x419fe4[0x0]['predictiveIntervalAnsweredCalls']+_0x419fe4[0x0][_0x0049('0x119')]+_0x419fe4[0x0][_0x0049('0x72')])/_0x419fe4[0x0][_0x0049('0x75')];var _0xc2e98e=_0x4fa6b0[_0x0049('0x1e3')]/0x64;_0x4fa6b0[_0x0049('0x1e9')]=_0x127552[0x0][_0x0049('0x1ea')]||0x0;_0x4fa6b0[_0x0049('0x73')]=_0x44dc57>0x0?_0x44dc57:0x1;return _0x2f87e5[_0x0049('0x1e4')](_0x3bce22,_0x395df6,_0x175e7c,_0x44dc57,_0xc2e98e);})[_0x0049('0x43')](function(_0x12dcd8){return _0x3c42db(_0x12dcd8);})['catch'](function(_0x51e18c){return _0x5eb9bc(msgResponse(_0x0049('0x1ec'),'Failure',JSON['stringify'](_0x51e18c)));});}}else{return _0x5eb9bc(msgResponse('[getDataPredictive]',_0x0049('0x148'),_0x0049('0x1e7')));}});};};Dialer[_0x0049('0x1b')][_0x0049('0x1db')]=function(_0x217584){var _0x59dfba=this;return function(){var _0x1d33c0=0x0;var _0x38b587=Math['floor'](_0x217584[_0x0049('0x8b')]*0x3e8);if(_0x38b587>0x0){_0x38b587=_0x38b587<0x64?0x64:_0x38b587;loggerPredictive[_0x0049('0x80')](_0x217584[_0x0049('0x46')],_0x0049('0x1ed'),_0x38b587,'milliseconds');_0x217584[_0x0049('0x90')]=setInterval(function(){_0x59dfba['handlePredictive'](_0x217584);loggerPredictiveCalls[_0x0049('0x80')](_0x0049('0x1ee'),_0x1d33c0+=0x1);},_0x38b587);}else{loggerPredictive[_0x0049('0x80')](_0x217584[_0x0049('0x46')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0049('0x1b')][_0x0049('0x1ef')]=function(_0x2b647a,_0x125e06){var _0x13d0b3=this;return function(_0x319c8f){if(_[_0x0049('0x4e')](_0x319c8f)){if(_[_0x0049('0xae')](_0x125e06[_0x0049('0xd7')])||!_0x125e06['recallme']){if(_0x2b647a[_0x0049('0x63')]==='booked'){_0x2b647a[_0x0049('0x134')]=_[_0x0049('0x44')](_0x2b647a[_0x0049('0x134')])?!![]:_0x2b647a[_0x0049('0x134')];var _0x5f1278=uuid['v4']();_0x13d0b3[_0x0049('0x27')][_0x5f1278]=new Action(_0x2b647a,_0x125e06,_0x5f1278);loggerBooked[_0x0049('0x80')]('[booked][checkContactBlack]',_0x5f1278,_0x0049('0x1f0'),JSON[_0x0049('0x4f')](_0x2b647a[_0x0049('0x134')]),_0x0049('0x1f1'),_0x2b647a[_0x0049('0x46')]);if(_0x2b647a[_0x0049('0x134')]){_0x2b647a[_0x0049('0x134')]=![];_0x13d0b3[_0x0049('0x2c')][_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xb4')]]=[];ami[_0x0049('0xaf')]({'actionid':_0x5f1278,'action':_0x0049('0x1f2'),'queue':_0x2b647a[_0x0049('0x46')]})['catch'](function(){_0x13d0b3['updateOriginated'](_0x2b647a);_0x13d0b3['rescheduleContact']({'active':![],'ContactId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0x100')],'ListId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd6')],'VoiceQueueId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd8')]||undefined,'CampaignId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1f3')));delete _0x13d0b3['actions'][_0x5f1278];});}else{loggerBooked[_0x0049('0x80')]('[booked][checkContactBlack][else]',JSON[_0x0049('0x4f')](_0x2b647a[_0x0049('0x134')]),'Queue:\x20',_0x2b647a['name']);_0x13d0b3[_0x0049('0xb3')](_0x2b647a);_0x13d0b3[_0x0049('0xfc')]({'active':![],'ContactId':_0x13d0b3['actions'][_0x5f1278]['ContactId'],'ListId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd6')],'VoiceQueueId':_0x13d0b3[_0x0049('0x27')][_0x5f1278][_0x0049('0xd8')]||undefined,'CampaignId':_0x13d0b3['actions'][_0x5f1278]['CampaignId']||undefined})[_0x0049('0xb1')](loggerCatch(_0x0049('0x1f3')));delete _0x13d0b3[_0x0049('0x27')][_0x5f1278];}}else{return _0x13d0b3[_0x0049('0x16e')](_0x2b647a,_0x125e06);}}else{if(getDiff(_0x125e06[_0x0049('0x1f4')])<_0x2b647a['dialRecallMeTimeout']*0x3c){if(_0x125e06['Agent']&&!_0x125e06[_0x0049('0x167')]['voicePause']){_0x13d0b3['preview'][_0x0049('0x1f5')](_0x125e06['id'])['finally'](function(){_0x13d0b3[_0x0049('0xb3')](_0x2b647a);});}else{_0x13d0b3[_0x0049('0xc4')]({'active':![]},_0x125e06['id'],0x1)[_0x0049('0x1e')](function(){_0x13d0b3[_0x0049('0xb3')](_0x2b647a);});}}else{_0x2b647a[_0x0049('0x6d')]+=0x1;_0x13d0b3['updateOriginated'](_0x2b647a);if(_0x2b647a[_0x0049('0x1f6')]){_0x13d0b3[_0x0049('0xfc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x125e06[_0x0049('0x100')],'ListId':_0x125e06['ListId'],'VoiceQueueId':_0x125e06[_0x0049('0xd8')]||undefined,'CampaignId':_0x125e06[_0x0049('0xd9')]||undefined})[_0x0049('0xb1')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x13d0b3['createHistory'](createObjHistory(_0x2b647a,_0x125e06,_0x0049('0x1f7'),0x17,_0x0049('0x1f8')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x13d0b3[_0x0049('0xd4')](createObjHistory(_0x2b647a,_0x125e06,'RECALLFAILEDTIMEOUT',0x16,_0x0049('0x1f9')),_0x0049('0x1fa'),_0x0049('0x1fb'));}}}}else{_0x2b647a[_0x0049('0x67')]+=0x1;_0x13d0b3[_0x0049('0xd4')](createObjHistory(_0x2b647a,_0x125e06,_0x0049('0x1fc'),0xd,_0x0049('0x1fd')),_0x0049('0x1fe'),_0x0049('0x1ff'));throw _0x0049('0x200');}};};Dialer[_0x0049('0x1b')][_0x0049('0x15e')]=function(_0xc3637b){var _0xa3652c=this;var _0x3541a4=_0xc3637b[_0x0049('0x201')]-_0xc3637b[_0x0049('0x76')]-_0xc3637b['temp'];emitCampaignSummary(_0xc3637b);if(_0x3541a4>0x0){if(_0x3541a4>this[_0x0049('0x25')]){_0x3541a4=this['maxNumberOriginate'];}_0xc3637b[_0x0049('0xc7')]+=_0x3541a4;this['getContactDialerIvr'](_0xc3637b['id'],_0x3541a4,_0xc3637b['dialOrderByScheduledAt'],_0xc3637b)[_0x0049('0x43')](function(_0xf3fee){_0xc3637b[_0x0049('0xc7')]-=_0x3541a4;_0xc3637b['temp']=_0xc3637b[_0x0049('0xc7')]>0x0?_0xc3637b[_0x0049('0xc7')]:0x0;if(!checkContactEmpty(_0xf3fee)){_0xc3637b[_0x0049('0x45')]=_0x0049('0x9d');logger[_0x0049('0x80')]('[getContactCampaign2][Empty]'+_0xc3637b[_0x0049('0x46')]);}else{_0xc3637b[_0x0049('0x76')]+=_0xf3fee[_0x0049('0x97')];_0xc3637b[_0x0049('0x45')]=_0x0049('0x202');for(var _0x2187fe=0x0;_0x2187fe<_0xf3fee[_0x0049('0x97')];_0x2187fe+=0x1){_0xc3637b[_0x0049('0x203')]+=0x1;if(_[_0x0049('0xae')](_0xf3fee[_0x2187fe])||_[_0x0049('0xae')](_0xf3fee[_0x2187fe]['Contact'])||_[_0x0049('0xae')](_0xf3fee[_0x2187fe][_0x0049('0x170')])){_0xa3652c['emptyContact']('[actionOriginate]\x20',_0xc3637b,_0xf3fee[_0x2187fe]);}else{_0xa3652c['checkIsBlackListIvr'](_[_0x0049('0xd5')](_0xf3fee[_0x2187fe],['CampaignId',_0x0049('0x204')]))[_0x0049('0x43')](_0xa3652c[_0x0049('0x1ef')](_0xc3637b,_0xf3fee[_0x2187fe]))[_0x0049('0xb1')](_0xa3652c[_0x0049('0x205')](_0x0049('0x206'),_0xc3637b));}}}})[_0x0049('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0xc3637b,_0x3541a4));}};Dialer[_0x0049('0x1b')][_0x0049('0x15a')]=function(_0x1a8e7a,_0x210363){var _0x5e4d8f=this;var _0x2b2d0a=[];var _0x2a6d69=_0x210363>=0x1?_0x210363:0x1;if(_0x1a8e7a['dialMethod']===_0x0049('0x6')){_0x2a6d69=0x1;}var _0x252735=Math[_0x0049('0x1d0')](_0x1a8e7a[_0x0049('0x57')]*_0x2a6d69)-_0x1a8e7a[_0x0049('0x76')]-_0x1a8e7a['temp'];emitVoiceQueueSummary(_0x1a8e7a);if(_0x1a8e7a[_0x0049('0x207')]>0x0){var _0x473ec3=_0x1a8e7a['dialLimitQueue']-_0x1a8e7a[_0x0049('0x76')]-_0x1a8e7a[_0x0049('0x5d')]-_0x1a8e7a['temp']-_0x1a8e7a[_0x0049('0x59')];if(_0x252735>_0x473ec3){_0x252735=_0x473ec3;}}if(_0x252735>0x0){if(_0x1a8e7a['dialMethod']===_0x0049('0x6')){_0x252735=0x1;}if(_0x252735>this[_0x0049('0x25')]){_0x252735=this[_0x0049('0x25')];}_0x1a8e7a[_0x0049('0xc7')]+=_0x252735;for(var _0x44de85 in this[_0x0049('0x23')]){if(typeof this[_0x0049('0x23')][_0x44de85]!==_0x0049('0xad')){if(this['agents'][_0x44de85][_0x0049('0xea')]===_0x0049('0x208')&&this[_0x0049('0x23')][_0x44de85][_0x0049('0xb0')]===_0x0049('0xe0')){_0x2b2d0a[_0x0049('0x151')](this[_0x0049('0x23')][_0x44de85]['id']);}}}this[_0x0049('0xc6')](_0x1a8e7a['id'],_0x2b2d0a,_0x252735,_0x1a8e7a[_0x0049('0x209')],_0x1a8e7a)[_0x0049('0x43')](function(_0x5dbdc4){_0x1a8e7a[_0x0049('0xc7')]-=_0x252735;_0x1a8e7a[_0x0049('0xc7')]=_0x1a8e7a[_0x0049('0xc7')]>0x0?_0x1a8e7a['temp']:0x0;if(!checkContactEmpty(_0x5dbdc4)){_0x5e4d8f[_0x0049('0xb7')](_0x1a8e7a)[_0x0049('0x43')](sendMessageReschedule(_0x1a8e7a))[_0x0049('0xb1')](loggerCatch(_0x0049('0x20a')));}else{_0x1a8e7a[_0x0049('0x76')]+=_0x5dbdc4[_0x0049('0x97')];_0x1a8e7a['message']=_0x1a8e7a['dialMethod']===_0x0049('0x6')?_0x0049('0x178'):_0x0049('0x202');for(var _0x347a7c=0x0;_0x347a7c<_0x5dbdc4[_0x0049('0x97')];_0x347a7c+=0x1){if(_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c])||_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c][_0x0049('0x18a')])||_[_0x0049('0xae')](_0x5dbdc4[_0x347a7c]['phone'])){_0x5e4d8f['emptyContact'](_0x0049('0x20b'),_0x1a8e7a,_0x5dbdc4[_0x347a7c]);}else{_0x5e4d8f[_0x0049('0xb8')](_[_0x0049('0xd5')](_0x5dbdc4[_0x347a7c],[_0x0049('0xd8'),_0x0049('0x204')]))['then'](_0x5e4d8f['checkContactBlack'](_0x1a8e7a,_0x5dbdc4[_0x347a7c]))[_0x0049('0xb1')](_0x5e4d8f[_0x0049('0x205')]('[actionOriginate]\x20',_0x1a8e7a));}}}})['catch'](loggerGetContactDialer(_0x0049('0x20c'),_0x1a8e7a,_0x252735));}};Dialer[_0x0049('0x1b')][_0x0049('0x90')]=function(_0x1f75b2){if(_0x1f75b2['dialLimitQueue']>0x0){var _0x47b3c1=_0x1f75b2['dialLimitQueue']-_0x1f75b2[_0x0049('0x76')]-_0x1f75b2[_0x0049('0x5d')];if(_0x47b3c1>0x0){this[_0x0049('0x20d')](_0x1f75b2);}else{loggerPredictiveCalls['info'](_0x0049('0x20e'));}}else{this[_0x0049('0x20d')](_0x1f75b2);}};Dialer[_0x0049('0x1b')]['tryOriginatePredictive']=function(_0x487112){var _0x2212de=this;var _0x554685=[];_0x487112[_0x0049('0x76')]+=0x1;for(var _0x4db25b in this['agents']){if(typeof this[_0x0049('0x23')][_0x4db25b]!==_0x0049('0xad')){if(this['agents'][_0x4db25b]['state']==='not_inuse'&&this[_0x0049('0x23')][_0x4db25b][_0x0049('0xb0')]===_0x0049('0xe0')){_0x554685['push'](this['agents'][_0x4db25b]['id']);}}}this['getContactDialer'](_0x487112['id'],_0x554685,0x1,_0x487112[_0x0049('0x209')],_0x487112)[_0x0049('0x43')](function(_0x2626b5){if(!checkContactEmpty(_0x2626b5)){checkContactLowerLimitOriginate(_0x487112,0x1,0x0);_0x2212de[_0x0049('0xb7')](_0x487112)[_0x0049('0x43')](sendMessageReschedule(_0x487112))[_0x0049('0xb1')](loggerCatch(_0x0049('0x20a')));}else{_0x487112[_0x0049('0x45')]=_0x0049('0x202');if(_['isNil'](_0x2626b5[0x0])||_[_0x0049('0xae')](_0x2626b5[0x0][_0x0049('0x18a')])||_[_0x0049('0xae')](_0x2626b5[0x0][_0x0049('0x170')])){_0x2212de[_0x0049('0xd2')]('[actionOriginate]\x20',_0x487112,_0x2626b5[0x0]);}else{_0x2212de[_0x0049('0xb8')](_[_0x0049('0xd5')](_0x2626b5[0x0],[_0x0049('0xd8'),_0x0049('0x204')]))[_0x0049('0x43')](_0x2212de[_0x0049('0x1ef')](_0x487112,_0x2626b5[0x0]))[_0x0049('0xb1')](_0x2212de[_0x0049('0x205')]('[actionOriginatePredictive]\x20',_0x487112));}}})[_0x0049('0xb1')](loggerGetContactDialer(_0x0049('0x20f'),_0x487112,0x1));emitVoiceQueueSummary(_0x487112);};Dialer['prototype'][_0x0049('0x1eb')]=function(_0x4530ff,_0x980d87,_0x5bda78,_0x129751,_0x1a9c9c,_0x5644aa){loggerPredictive[_0x0049('0x80')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x0049('0x80')](_0x0049('0x210'),_0x4530ff);loggerPredictive[_0x0049('0x80')](_0x0049('0x211'),_0x980d87);loggerPredictive[_0x0049('0x80')](_0x0049('0x212'),_0x5bda78);loggerPredictive[_0x0049('0x80')](_0x0049('0x213'),_0x129751);loggerPredictive[_0x0049('0x80')](_0x0049('0x214'),_0x1a9c9c);loggerPredictive['info'](_0x0049('0x84'));return new BPromise(function(_0x3cdfd2,_0x5e9f85){if(_0x4530ff<=0x0||isNaN(_0x4530ff)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),'m\x20=\x20'+_0x4530ff));}if(_0x5bda78<=0x0||isNaN(_0x5bda78)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),_0x0049('0x216')+_0x5bda78));}if(_0x129751<=0x0||isNaN(_0x129751)){return _0x5e9f85(msgResponse(_0x0049('0x215'),_0x0049('0x19f'),'p\x20=\x20'+_0x129751));}if(_0x980d87<=0x0||isNaN(_0x980d87)){return _0x5e9f85(msgResponse(_0x0049('0x215'),'Error',_0x0049('0x217')+_0x980d87));}if(_0x1a9c9c<=0x0||isNaN(_0x1a9c9c)){return _0x5e9f85(msgResponse('[abandonmentRate]','Error',_0x0049('0x218')+_0x1a9c9c));}_0x5644aa=_0x5644aa||0x0;var _0x44346d=0x1/_0x5bda78;var _0x409b6d=0x0;var _0x1ae471=0x0;var _0x426fbc=0x0;var _0x4fcf11=0x0;for(var _0x236e3b=0x0;_0x426fbc<_0x1a9c9c;_0x236e3b+=0x1){_0x1ae471=_0x236e3b/_0x980d87;_0x409b6d=(_0x129751*_0x1ae471+_0x5644aa)/_0x44346d;_0x426fbc=erlangb(_0x409b6d,_0x4530ff);_0x4fcf11=_0x409b6d/_0x4530ff*(0x1-erlangb(_0x409b6d,_0x4530ff));}return _0x3cdfd2({'erlangCalls':_0x236e3b,'erlangCallToSecond':_0x980d87/_0x236e3b,'erlangAbandonmentRate':_0x426fbc,'erlangBusyFactor':_0x4fcf11});});};Dialer['prototype']['busyFactor']=function(_0x49b2d2,_0x124a9,_0x2041eb,_0x644554,_0x1976a6,_0xf1fdcb){loggerPredictive['info'](_0x0049('0x219'));loggerPredictive[_0x0049('0x80')](_0x0049('0x210'),_0x49b2d2);loggerPredictive[_0x0049('0x80')](_0x0049('0x211'),_0x124a9);loggerPredictive[_0x0049('0x80')](_0x0049('0x212'),_0x2041eb);loggerPredictive[_0x0049('0x80')](_0x0049('0x213'),_0x644554);loggerPredictive[_0x0049('0x80')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1976a6);loggerPredictive[_0x0049('0x80')](_0x0049('0x84'));return new BPromise(function(_0x58a157,_0x6eb694){if(_0x49b2d2<=0x0||isNaN(_0x49b2d2)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x21b')+_0x49b2d2));}if(_0x2041eb<=0x0||isNaN(_0x2041eb)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x216')+_0x2041eb));}if(_0x644554<=0x0||isNaN(_0x644554)){return _0x6eb694(msgResponse('[busyFactor]',_0x0049('0x19f'),'p\x20=\x20'+_0x644554));}if(_0x124a9<=0x0||isNaN(_0x124a9)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x217')+_0x124a9));}if(_0x1976a6<=0x0||isNaN(_0x1976a6)){return _0x6eb694(msgResponse(_0x0049('0x21a'),_0x0049('0x19f'),_0x0049('0x21c')+_0x1976a6));}_0xf1fdcb=_0xf1fdcb||0x0;var _0x371a43=0x1/_0x2041eb;var _0x2f1f85=0x0;var _0xbf6b92=0x0;var _0x3a1a49=0x0;var _0x426c4b=0x0;for(var _0x57b520=0x0;_0x426c4b<_0x1976a6;_0x57b520+=0x1){_0xbf6b92=_0x57b520/_0x124a9;_0x2f1f85=(_0x644554*_0xbf6b92+_0xf1fdcb)/_0x371a43;_0x3a1a49=erlangb(_0x2f1f85,_0x49b2d2);_0x426c4b=_0x2f1f85/_0x49b2d2*(0x1-erlangb(_0x2f1f85,_0x49b2d2));}return _0x58a157({'erlangCalls':_0x57b520,'erlangCallToSecond':_0x124a9/_0x57b520,'erlangAbandonmentRate':_0x3a1a49,'erlangBusyFactor':_0x426c4b});});};module[_0x0049('0x21d')]=Dialer; \ No newline at end of file +var _0xf403=['Intervals','isEmpty','stringify','milliseconds','seconds','emit','type','outbound','strategy','available','pTalking','sumHoldTime','total','unmanaged','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','debug','inspect','error','stack','length','undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','clearZombieChannels','[uniqueid]','[actions]','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','[countReScheduled]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','unmonitored','syncVarSet','uniqueid','isNil','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','AMD','buildObj','MACHINE','state','Machine','membername','countmachineretry','countglobal','amd','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','countnoanswerretry','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','endtime','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','locked','paused','stateinterface','push','merge','idHopper','queueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','timezones','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','loggedIn','dialTimezone','[syncQueueSummary]','throttle','filter','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','[syncCampaigns]','pow','random','match','actionOriginate','voiceQueue\x20is\x20undefine','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','phone','Action','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','util','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL'];(function(_0x4f8fbf,_0x16b36b){var _0x2fe553=function(_0x128802){while(--_0x128802){_0x4f8fbf['push'](_0x4f8fbf['shift']());}};_0x2fe553(++_0x16b36b);}(_0xf403,0x1d3));var _0x3f40=function(_0x4dea05,_0x5e8c33){_0x4dea05=_0x4dea05-0x0;var _0x1fbb7c=_0xf403[_0x4dea05];return _0x1fbb7c;};'use strict';var util=require(_0x3f40('0x0'));var _=require('lodash');var BPromise=require(_0x3f40('0x1'));var uuid=require(_0x3f40('0x2'));var moment=require(_0x3f40('0x3'));var rr=require('rr');var md5=require(_0x3f40('0x4'));var Redis=require(_0x3f40('0x5'));var ut=require(_0x3f40('0x6'));var config=require(_0x3f40('0x7'));var logger=require(_0x3f40('0x8'))('dialer');var loggerBooked=require('../../../config/logger')(_0x3f40('0x9'));var loggerPredictive=require(_0x3f40('0x8'))(_0x3f40('0xa'));var loggerPredictiveCalls=require(_0x3f40('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x3f40('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x3f40('0xb')]=_[_0x3f40('0xc')](config[_0x3f40('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f40('0xb')]));var cmHopper=require(_0x3f40('0xd'));var cmHopperHistory=require(_0x3f40('0xe'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x3f40('0xf'));var cmHopperBlack=require(_0x3f40('0x10'));var voiceQueueRt=require(_0x3f40('0x11'));var RpcSetting=require('../rpc/setting');var Action=require(_0x3f40('0x12'));var History=require('./history');var Final=require(_0x3f40('0x13'));var AgentComplete=require(_0x3f40('0x14'));var QueueCallerAbandon=require(_0x3f40('0x15'));var Hangup=require(_0x3f40('0x16'));var ipAgi=process['env'][_0x3f40('0x17')]||_0x3f40('0x18');var strategy={'rrmemory':_0x3f40('0x19'),'roundrobin':_0x3f40('0x1a')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x3f40('0x1b')]['enqueue']=function(_0x2e51ed){this[_0x3f40('0x1c')]=this['tail']?this['tail']['finally'](_0x2e51ed):_0x2e51ed();};function Dialer(_0x206630,_0x13b950){this[_0x3f40('0x1d')]=new Sequence();this[_0x3f40('0x1e')]=_0x13b950;this[_0x3f40('0x1f')]=_0x206630['voiceQueues'];this[_0x3f40('0x20')]=_0x206630[_0x3f40('0x20')];this[_0x3f40('0x21')]=_0x206630[_0x3f40('0x21')];this[_0x3f40('0x22')]=_0x206630['trunks'];this[_0x3f40('0x23')]=config['maxNumberOriginate']||0x2;this[_0x3f40('0x24')]={};this[_0x3f40('0x25')]={};this[_0x3f40('0x26')]={};this[_0x3f40('0x27')]={};this[_0x3f40('0x28')]={};this['startPredictive']={};this[_0x3f40('0x29')]={};this[_0x3f40('0x2a')]={};this[_0x3f40('0x2b')]={};this[_0x3f40('0x2c')]={};ami['on'](_0x3f40('0x2d'),this[_0x3f40('0x2e')]['bind'](this));ami['on'](_0x3f40('0x2f'),this[_0x3f40('0x30')][_0x3f40('0x31')](this));ami['on']('originateresponse',this[_0x3f40('0x32')]['bind'](this));ami['on'](_0x3f40('0x33'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x3f40('0x34')][_0x3f40('0x31')](this));ami['on'](_0x3f40('0x35'),this[_0x3f40('0x36')]['bind'](this));ami['on'](_0x3f40('0x37'),this['syncHangup'][_0x3f40('0x31')](this));ami['on'](_0x3f40('0x38'),this[_0x3f40('0x39')]['bind'](this));ami['on'](_0x3f40('0x3a'),this['syncVarSet'][_0x3f40('0x31')](this));ami['on']('queuemember',this['syncQueueMember'][_0x3f40('0x31')](this));ami['on'](_0x3f40('0x3b'),this[_0x3f40('0x3c')][_0x3f40('0x31')](this));this[_0x3f40('0x3d')]();this[_0x3f40('0x3e')]();RpcSetting[_0x3f40('0x3f')]()[_0x3f40('0x40')](function(_0x572a4d){previewRecallmeReminderInterval=_0x572a4d[_0x3f40('0x41')];});}function isNotNull(_0x2d2624){return _0x2d2624!==null&&!_[_0x3f40('0x42')](_0x2d2624);}function checkIsLoggedIn(_0x2ec279,_0x3b20f4){return function(){if(_0x3b20f4<=0x0){_0x2ec279['message']=_0x3f40('0x43');throw _0x2ec279[_0x3f40('0x44')]+_0x3f40('0x45');}};}function isActive(_0x575bd8){return _0x575bd8;}function checkIsActive(_0x21c8eb,_0x2869d0){return function(){if(!isActive(_0x2869d0)){_0x21c8eb[_0x3f40('0x46')]=_0x3f40('0x47');throw _0x21c8eb[_0x3f40('0x44')]+_0x3f40('0x48');}};}function checkInterval(_0x23b7ec){return function(){if(!isNotNull(_0x23b7ec[_0x3f40('0x49')])){_0x23b7ec[_0x3f40('0x46')]=_0x3f40('0x4a');throw _0x23b7ec[_0x3f40('0x44')]+_0x3f40('0x4b');}if(!isNotNull(_0x23b7ec[_0x3f40('0x49')][_0x3f40('0x4c')])){_0x23b7ec[_0x3f40('0x46')]=_0x3f40('0x4a');throw _0x23b7ec[_0x3f40('0x44')]+_0x3f40('0x4b');}if(!isNotNull(_[_0x3f40('0x4d')](_0x23b7ec[_0x3f40('0x49')][_0x3f40('0x4c')]))){_0x23b7ec[_0x3f40('0x46')]=_0x3f40('0x4a');throw _0x23b7ec[_0x3f40('0x44')]+_0x3f40('0x4b');}};}function msgResponse(_0x460d02,_0x2e158a,_0x31ab72){return{'action':_0x460d02,'response':_0x2e158a,'message':_0x31ab72,'stack':_0x31ab72};}function myreject(_0x411c98){return function(_0x2df15b){return _0x411c98(msgResponse('[ifTime][Action]','Error',JSON[_0x3f40('0x4e')](_0x2df15b)));};}function getSeconds(_0x1b005e,_0x24f070){var _0x4778ec=moment(_0x1b005e)[_0x3f40('0x4f')](0x0);var _0x215d00=moment(_0x24f070)[_0x3f40('0x4f')](0x0);return _0x4778ec['diff'](_0x215d00,_0x3f40('0x50'));}function emit(_0x5ea348,_0x229bff,_0x3bec11){io['to'](_0x5ea348)[_0x3f40('0x51')](_0x229bff,_0x3bec11);}function emitVoiceQueueSummary(_0x53ecea){if(_0x53ecea[_0x3f40('0x52')]===_0x3f40('0x53')){var _0x5a5720={'id':_0x53ecea['id'],'name':_0x53ecea[_0x3f40('0x44')],'strategy':_0x53ecea[_0x3f40('0x54')],'answered':_0x53ecea['answered'],'available':_0x53ecea[_0x3f40('0x55')],'loggedIn':_0x53ecea['loggedIn'],'pTalking':_0x53ecea[_0x3f40('0x56')],'sumBillable':_0x53ecea['sumBillable'],'sumDuration':_0x53ecea['sumDuration'],'sumHoldTime':_0x53ecea[_0x3f40('0x57')]||0x0,'talking':_0x53ecea['talking'],'total':_0x53ecea[_0x3f40('0x58')],'type':_0x53ecea[_0x3f40('0x52')],'unmanaged':_0x53ecea[_0x3f40('0x59')],'abandoned':_0x53ecea[_0x3f40('0x5a')],'waiting':_0x53ecea['waiting'],'loggedInDb':_0x53ecea[_0x3f40('0x5b')],'dialActive':_0x53ecea['dialActive'],'dialMethod':_0x53ecea[_0x3f40('0x5c')],'dialOriginateCallerIdName':_0x53ecea[_0x3f40('0x5d')],'dialOriginateCallerIdNumber':_0x53ecea[_0x3f40('0x5e')],'dialOriginateTimeout':_0x53ecea['dialOriginateTimeout'],'dialPrefix':_0x53ecea['dialPrefix'],'outboundAnswerAgiCallsDay':_0x53ecea[_0x3f40('0x5f')],'outboundAnswerCallsDay':_0x53ecea[_0x3f40('0x60')],'outboundBlacklistCallsDay':_0x53ecea[_0x3f40('0x61')],'outboundBusyCallsDay':_0x53ecea[_0x3f40('0x62')],'outboundCongestionCallsDay':_0x53ecea[_0x3f40('0x63')],'outboundDropCallsDayACS':_0x53ecea[_0x3f40('0x64')],'outboundDropCallsDayCallersExit':_0x53ecea[_0x3f40('0x65')],'outboundDropCallsDayTimeout':_0x53ecea[_0x3f40('0x66')],'outboundNoAnswerCallsDay':_0x53ecea['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x53ecea[_0x3f40('0x67')],'outboundOriginateFailureCallsDay':_0x53ecea['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x53ecea['outboundReCallsDay'],'outboundRejectCallsDay':_0x53ecea[_0x3f40('0x68')],'outboundUnknownCallsDay':_0x53ecea[_0x3f40('0x69')],'predictiveIntervalAnsweredCalls':_0x53ecea[_0x3f40('0x6a')],'predictiveIntervalAvgHoldtime':_0x53ecea[_0x3f40('0x6b')],'predictiveIntervalAvgTalktime':_0x53ecea[_0x3f40('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x53ecea[_0x3f40('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x53ecea[_0x3f40('0x6e')],'predictiveIntervalErlangCalls':_0x53ecea[_0x3f40('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x53ecea[_0x3f40('0x70')],'predictiveIntervalHitRate':_0x53ecea[_0x3f40('0x71')],'predictiveIntervalMultiplicativeFactor':_0x53ecea[_0x3f40('0x72')],'predictiveIntervalPauses':_0x53ecea[_0x3f40('0x73')],'predictiveIntervalAvailable':_0x53ecea[_0x3f40('0x74')],'predictiveIntervalTotalCalls':_0x53ecea[_0x3f40('0x75')],'message':_0x53ecea['message'],'originated':_0x53ecea[_0x3f40('0x76')],'erlangCalls':_0x53ecea['erlangCalls'],'erlangCallToSecond':_0x53ecea[_0x3f40('0x77')],'erlangAbandonmentRate':_0x53ecea[_0x3f40('0x78')],'erlangBusyFactor':_0x53ecea['erlangBusyFactor'],'startPredictive':_0x53ecea[_0x3f40('0x79')],'startProgressive':_0x53ecea[_0x3f40('0x29')]};if(_0x53ecea[_0x3f40('0x7a')]){_0x5a5720[_0x3f40('0x7a')]={'id':_0x53ecea[_0x3f40('0x7a')]['id'],'name':_0x53ecea[_0x3f40('0x7a')][_0x3f40('0x44')],'active':_0x53ecea[_0x3f40('0x7a')][_0x3f40('0x7b')],'callerid':_0x53ecea[_0x3f40('0x7a')][_0x3f40('0x7c')]};}if(_0x53ecea[_0x3f40('0x49')]){_0x5a5720[_0x3f40('0x49')]={'id':_0x53ecea[_0x3f40('0x49')]['id'],'name':_0x53ecea[_0x3f40('0x49')][_0x3f40('0x44')]};}var _0x370d59=md5(JSON[_0x3f40('0x4e')](_0x5a5720));if(_0x53ecea[_0x3f40('0x4')]!==_0x370d59){_0x53ecea[_0x3f40('0x4')]=_0x370d59;emit(util[_0x3f40('0x7d')]('voice:queue:%s',_0x5a5720[_0x3f40('0x44')]),_0x3f40('0x7e'),_0x5a5720);}}}function emitCampaignSummary(_0x304a54){if(_0x304a54[_0x3f40('0x52')]===_0x3f40('0x7f')){emit(util['format']('campaign:ivr:%s',_0x304a54['name']),_0x3f40('0x80'),_0x304a54);}}function checkGetDataPredictive(_0x426d5b){if(isNotNull(_0x426d5b)&&!_['isEmpty'](_0x426d5b)){loggerPredictive[_0x3f40('0x81')](_0x3f40('0x82'));loggerPredictive['info'](_0x3f40('0x83'),_0x426d5b['predictiveIntervalTotalCalls']);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x84'),_0x426d5b[_0x3f40('0x6a')]);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x85'),_0x426d5b[_0x3f40('0x6e')]);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x86'),_0x426d5b[_0x3f40('0x6d')]);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x87'),_0x426d5b[_0x3f40('0x6b')]);loggerPredictive[_0x3f40('0x81')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x426d5b[_0x3f40('0x6c')]);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x88'));if(_0x426d5b[_0x3f40('0x75')]>0x0){if(!_[_0x3f40('0x42')](_0x426d5b['predictiveIntervalAvgTalktime'])&&_0x426d5b[_0x3f40('0x6c')]>0x0){return!![];}loggerPredictive[_0x3f40('0x81')](_0x3f40('0x89'));if(!_[_0x3f40('0x42')](_0x426d5b[_0x3f40('0x6b')])&&_0x426d5b['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0x3f40('0x8a'));}else{loggerPredictive[_0x3f40('0x81')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3f40('0x81')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x204cff){return function(_0x557c0c){loggerPredictive[_0x3f40('0x81')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x3f40('0x81')](_0x3f40('0x8b'),_0x557c0c[_0x3f40('0x8c')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x557c0c['erlangCallToSecond']);loggerPredictive['info'](_0x3f40('0x8d'),_0x557c0c['erlangAbandonmentRate']);loggerPredictive['info'](_0x3f40('0x8e'),_0x557c0c[_0x3f40('0x8f')]);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x8d'),_0x557c0c['erlangAbandonmentRate']);loggerPredictive[_0x3f40('0x81')]('---------------------------');_['merge'](_0x204cff,_0x557c0c);};}function getDiff(_0x48b0ed){var _0x27de18=moment()['milliseconds'](0x0);var _0x5c3be1=moment(_0x48b0ed)[_0x3f40('0x4f')](0x0);return _0x27de18[_0x3f40('0x90')](_0x5c3be1,_0x3f40('0x50'));}function ifInterval(_0x3df44b,_0x346ae4){if(_['isUndefined'](_0x346ae4)){return![];}return getDiff(_0x346ae4)<_0x3df44b*0x3c;}function freeVariablesPredictive(_0x8e4dea){if(isNotNull(_0x8e4dea)){if(!_['isUndefined'](_0x8e4dea[_0x3f40('0x29')])){_0x8e4dea[_0x3f40('0x29')]=undefined;loggerPredictive[_0x3f40('0x81')](_0x8e4dea['name'],_0x3f40('0x91'));}if(!_[_0x3f40('0x42')](_0x8e4dea[_0x3f40('0x79')])){_0x8e4dea[_0x3f40('0x79')]=undefined;loggerPredictive[_0x3f40('0x81')](_0x8e4dea['name'],_0x3f40('0x92'));}if(!_[_0x3f40('0x42')](_0x8e4dea[_0x3f40('0x93')])){clearInterval(_0x8e4dea[_0x3f40('0x93')]);_0x8e4dea[_0x3f40('0x93')]=undefined;loggerPredictive[_0x3f40('0x81')](_0x8e4dea[_0x3f40('0x44')],_0x3f40('0x94'));}}}function erlangb(_0x2fe529,_0x37add1){if(_0x37add1===0x0){return 0x0;}var _0x163dce=0x1;for(var _0x2fc05f=0x1;_0x2fc05f<=_0x37add1;_0x2fc05f+=0x1){_0x163dce=0x1+_0x163dce*_0x2fc05f/_0x2fe529;}return 0x1/_0x163dce;}function isVoiceQueueOutbound(_0x52c075){return _0x52c075==='outbound';}function isNotPreview(_0x5c0273){return _0x5c0273!==_0x3f40('0x1e');}function isCampaignIvr(_0x137cd8){return _0x137cd8===_0x3f40('0x7f');}function getCallerId(_0x27fc56,_0x14de8d,_0x32aa47){if(!_['isUndefined'](_0x32aa47)&&typeof _0x32aa47===_0x3f40('0x95')&&!_['isEmpty'](_0x32aa47)){if(!_[_0x3f40('0x42')](_0x14de8d)&&typeof _0x14de8d===_0x3f40('0x95')&&!_[_0x3f40('0x4d')](_0x14de8d)){return util[_0x3f40('0x7d')](_0x3f40('0x96'),_0x14de8d,_0x32aa47);}return util['format'](_0x3f40('0x96'),_0x32aa47,_0x32aa47);}if(!_['isUndefined'](_0x27fc56)&&typeof _0x27fc56==='string'&&!_[_0x3f40('0x4d')](_0x27fc56)){return _0x27fc56;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x3b1dfe,_0x1ae5f9){return function(_0x46ae68){freeVariablesPredictive(_0x1ae5f9);emitVoiceQueueSummary(_0x1ae5f9);emitCampaignSummary(_0x1ae5f9);loggerSyncQueueSummary[_0x3f40('0x97')](_0x3b1dfe,util[_0x3f40('0x98')](_0x46ae68,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x391997,_0x26b77d){return function(_0x5e0970){loggerPredictive[_0x3f40('0x99')](_0x26b77d[_0x3f40('0x44')],_0x391997);loggerPredictive[_0x3f40('0x99')](_0x5e0970[_0x3f40('0x9a')]);freeVariablesPredictive(_0x26b77d);};}function loggerCatch(_0x4285ad){return function(_0x53fbcf){logger[_0x3f40('0x99')](_0x4285ad,util[_0x3f40('0x98')](_0x53fbcf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x288f7c){return _0x288f7c&&!_[_0x3f40('0x42')](_0x288f7c)&&_0x288f7c[_0x3f40('0x9b')]>0x0;}function decremetOriginate(_0x2e1297){if(!_['isUndefined'](_0x2e1297)&&_0x2e1297!==null){if(typeof _0x2e1297[_0x3f40('0x76')]!==_0x3f40('0x9c')){if(_0x2e1297[_0x3f40('0x76')]>0x0){_0x2e1297[_0x3f40('0x76')]-=0x1;}else{logger[_0x3f40('0x99')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x25d8fb,_0x40ee4a,_0x212ca4){if(_0x40ee4a>_0x212ca4){for(var _0xb52921=0x0;_0xb52921<_0x40ee4a-_0x212ca4;_0xb52921+=0x1){decremetOriginate(_0x25d8fb);}}}function loggerGetContactDialer(_0x6ac505,_0x3aee52,_0x2762d5){return function(_0x2d5d57){checkContactLowerLimitOriginate(_0x3aee52,_0x2762d5,0x0);logger[_0x3f40('0x99')](_0x6ac505,util[_0x3f40('0x98')](_0x2d5d57,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x37ba89){return function(_0x38cb25){if(isNotNull(_0x38cb25)&&isNotNull(_0x38cb25[0x0])){if(_0x38cb25[0x0][_0x3f40('0x9d')]>0x0){_0x37ba89['message']=_0x3f40('0x9e');logger[_0x3f40('0x81')](_0x3f40('0x9f')+_0x37ba89['name'],_0x38cb25[0x0]['contactsRescheduled'],_0x3f40('0xa0'));}else{_0x37ba89[_0x3f40('0x46')]=_0x3f40('0xa1');logger[_0x3f40('0x81')]('[getContactDialer2][Empty]'+_0x37ba89[_0x3f40('0x44')]);}}};}function notSendMessagesQueue(_0x46a4d1){if(_0x46a4d1[_0x3f40('0xa2')]){freeVariablesPredictive(_0x46a4d1);if(_0x46a4d1[_0x3f40('0x76')]===0x0&&_0x46a4d1[_0x3f40('0xa3')]===0x0&&_0x46a4d1[_0x3f40('0xa4')]===0x0&&(_0x46a4d1[_0x3f40('0x56')]||0x0)===0x0){_0x46a4d1[_0x3f40('0xa2')]=![];_0x46a4d1[_0x3f40('0x55')]=0x0;_0x46a4d1[_0x3f40('0x46')]='NOT_ACTIVE';loggerSyncQueueSummary['debug'](_0x3f40('0xa5'),_0x46a4d1[_0x3f40('0x44')],_0x3f40('0xa6'));}else{_0x46a4d1[_0x3f40('0x46')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x3f40('0x97')](_0x3f40('0xa5'),_0x46a4d1[_0x3f40('0x44')],_0x3f40('0xa7'));}emitVoiceQueueSummary(_0x46a4d1);}}function notSendMessagesCampaign(_0xca2941){if(_0xca2941['sendMessageOneNotActive']){if(_0xca2941['originated']===0x0){_0xca2941[_0x3f40('0xa2')]=![];_0xca2941[_0x3f40('0x46')]=_0x3f40('0x47');loggerSyncQueueSummary['debug'](_0x3f40('0xa8'),_0xca2941[_0x3f40('0x44')],_0x3f40('0xa6'));}else{_0xca2941['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x3f40('0x97')](_0x3f40('0xa8'),_0xca2941[_0x3f40('0x44')],_0x3f40('0xa7'));}emitCampaignSummary(_0xca2941);}}function createObjHistory(_0xade25c,_0x274515,_0x330d5a,_0x59c918,_0xb4e27e){_0xade25c['message']=_0x330d5a;var _0x32b72d=new Action(_0xade25c,_0x274515);var _0x58e760=new History(_0x32b72d);_0x58e760['state']=_0x59c918;_0x58e760[_0x3f40('0xa9')]=_0xb4e27e;_0x58e760['endtime']=_0x32b72d['starttime'];return _0x58e760;}Dialer[_0x3f40('0x1b')][_0x3f40('0x3e')]=function(){var _0x3ba707=this;setInterval(function(){_0x3ba707[_0x3f40('0xaa')](_0x3ba707[_0x3f40('0x27')],_0x3f40('0xab'));_0x3ba707[_0x3f40('0xaa')](_0x3ba707['actions'],_0x3f40('0xac'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x2893d5,_0x33adae){var _0x3f1348=this;for(var _0x4b9223 in _0x2893d5){if(typeof _0x2893d5[_0x4b9223]!==_0x3f40('0x9c')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x2893d5[_0x4b9223])){return ami['Action']({'action':'status','channel':_0x2893d5[_0x4b9223]['channel']})[_0x3f40('0xad')](function(_0x105fde){if(_0x105fde[_0x3f40('0x46')]===_0x3f40('0xae')){setTimeout(function(){if(_0x2893d5[_0x4b9223]&&_0x2893d5[_0x4b9223][_0x3f40('0x52')]!==_0x3f40('0x7f')){_0x3f1348[_0x3f40('0xaf')](_0x3f1348[_0x3f40('0x1f')][_0x2893d5[_0x4b9223]['queue']]);logger[_0x3f40('0x99')](_0x3f40('0xb0'),_0x33adae,_0x4b9223,_0x2893d5[_0x4b9223][_0x3f40('0xb1')]);delete _0x2893d5[_0x4b9223];}if(_0x2893d5[_0x4b9223]&&_0x2893d5[_0x4b9223][_0x3f40('0x52')]===_0x3f40('0x7f')){_0x3f1348[_0x3f40('0xaf')](_0x3f1348[_0x3f40('0x20')][_0x2893d5[_0x4b9223][_0x3f40('0xb1')]]);logger[_0x3f40('0x99')](_0x3f40('0xb2'),_0x33adae,_0x4b9223,_0x2893d5[_0x4b9223]['queue']);delete _0x2893d5[_0x4b9223];}},0x2328);}});}});}}};Dialer[_0x3f40('0x1b')][_0x3f40('0xb3')]=function(_0x5e33ac){return BPromise['resolve']()['then'](cmHopper[_0x3f40('0xb3')](_0x5e33ac))['catch'](loggerCatch(_0x3f40('0xb4')));};Dialer[_0x3f40('0x1b')]['checkIsBlackList']=function(_0x445db2){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopperBlack[_0x3f40('0xb6')](_0x445db2))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xb7')));};Dialer[_0x3f40('0x1b')][_0x3f40('0xb8')]=function(_0xf7c09f,_0x30020c,_0x441028){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopperAdditionalPhone[_0x3f40('0xb8')](_0xf7c09f,_0x30020c,_0x441028))[_0x3f40('0xad')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x3f40('0x1b')][_0x3f40('0xb9')]=function(_0x3df1f4,_0x1926d3,_0xec63eb){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x3df1f4,_0x1926d3,_0xec63eb))[_0x3f40('0xad')](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0x3f40('0x1b')]['checkIsBlackListIvr']=function(_0x5c2a53){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopperBlack['checkIsBlackListIvr'](_0x5c2a53))[_0x3f40('0xad')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x3f40('0xba')]=function(_0x393e29){return BPromise[_0x3f40('0xb5')]()['then'](cmHopperHistory['avgHandleTime'](_0x393e29))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xbb')));};Dialer['prototype']['rescheduleContact']=function(_0x3621e7){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopper[_0x3f40('0xbc')](_0x3621e7))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xbd')));};Dialer[_0x3f40('0x1b')][_0x3f40('0xbe')]=function(_0x301297,_0x2bf2be,_0x56953d){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopper[_0x3f40('0xbe')](_0x301297,_0x2bf2be,_0x56953d))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xbf')));};Dialer[_0x3f40('0x1b')]['getContactDialer']=function(_0x1d9589,_0x5de0fc,_0x2e27e5,_0x196a29,_0x1790a8){return BPromise['resolve']()[_0x3f40('0x40')](cmHopper[_0x3f40('0xc0')](_0x1d9589,_0x5de0fc,_0x2e27e5,_0x196a29))[_0x3f40('0xad')](function(_0x1372e0){_0x1790a8[_0x3f40('0xc1')]-=_0x2e27e5;_0x1790a8[_0x3f40('0xc1')]=_0x1790a8[_0x3f40('0xc1')]>0x0?_0x1790a8[_0x3f40('0xc1')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x1372e0);});};Dialer[_0x3f40('0x1b')][_0x3f40('0xc2')]=function(_0x150caf,_0x12609a,_0x178f60,_0x530ea6){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopper[_0x3f40('0xc2')](_0x150caf,_0x12609a,_0x178f60))['catch'](function(_0x453156){_0x530ea6['temp']-=_0x12609a;_0x530ea6['temp']=_0x530ea6['temp']>0x0?_0x530ea6[_0x3f40('0xc1')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x453156);});};Dialer[_0x3f40('0x1b')]['getVoiceQueueRtPauses']=function(_0x4c0114){return BPromise['resolve']()[_0x3f40('0x40')](voiceQueueRt[_0x3f40('0xc3')](_0x4c0114))[_0x3f40('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x3f40('0x1b')]['moveContactManagedDialer']=function(_0x4ac4e0){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopper[_0x3f40('0xc4')](_0x4ac4e0))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x3f40('0x1b')][_0x3f40('0xc5')]=function(_0xb01f87){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopperHistory[_0x3f40('0xc5')](_0xb01f87))[_0x3f40('0xad')](loggerCatch('[createHistory]\x20'));};Dialer[_0x3f40('0x1b')][_0x3f40('0xaf')]=function(_0x8b8c0f){if(!_[_0x3f40('0x42')](_0x8b8c0f)&&_0x8b8c0f!==null){if(typeof _0x8b8c0f[_0x3f40('0x76')]!==_0x3f40('0x9c')){if(_0x8b8c0f[_0x3f40('0x76')]>0x0){_0x8b8c0f[_0x3f40('0x76')]-=0x1;}else{logger[_0x3f40('0x99')](_0x3f40('0xc6'));}}}else{logger[_0x3f40('0x99')](_0x3f40('0xc7'));}};Dialer[_0x3f40('0x1b')]['loggerHandler']=function(_0x31f3a5,_0x89cf90){var _0x32eee4=this;return function(_0xaae01b){_0x32eee4[_0x3f40('0xaf')](_0x89cf90);logger[_0x3f40('0x99')](_0x31f3a5,util[_0x3f40('0x98')](_0xaae01b,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x3f40('0xc8')]=function(_0x2b2dd5,_0x15c6ea,_0x28f542){var _0x31c206={'state':0x19,'statedesc':'notFound'};this['updateOriginated'](_0x15c6ea);this[_0x3f40('0xc9')](_['merge'](_0x31c206,_[_0x3f40('0xca')](_0x28f542,[_0x3f40('0xcb'),_0x3f40('0xcc'),'UserId',_0x3f40('0xcd'),_0x3f40('0xce')])),_0x3f40('0xcf'),_0x3f40('0xd0'));logger[_0x3f40('0x99')](_0x2b2dd5);};Dialer[_0x3f40('0x1b')]['isSuccess']=function(_0x40e98f){return _0x40e98f===_0x3f40('0xd1');};Dialer[_0x3f40('0x1b')][_0x3f40('0xd2')]=function(_0x85efd3){return!_[_0x3f40('0x42')](_0x85efd3)&&_0x85efd3&&!_[_0x3f40('0x42')](_0x85efd3[_0x3f40('0x44')])&&!_[_0x3f40('0x42')](_0x85efd3[_0x3f40('0x7b')])&&_0x85efd3[_0x3f40('0x7b')]&&(this[_0x3f40('0x22')][util['format'](_0x3f40('0xd3'),_0x85efd3['name'])]['status']==='reachable'||this[_0x3f40('0x22')][util[_0x3f40('0x7d')]('SIP/%s',_0x85efd3[_0x3f40('0x44')])][_0x3f40('0xd4')]===_0x3f40('0xd5'));};Dialer[_0x3f40('0x1b')][_0x3f40('0xc9')]=function(_0x568a10,_0x4be046,_0x4b704a){this[_0x3f40('0xc5')](_0x568a10)['catch'](loggerCatch(_0x4be046));this['moveContactManagedDialer'](_0x568a10)[_0x3f40('0xad')](loggerCatch(_0x4b704a));};Dialer[_0x3f40('0x1b')][_0x3f40('0xd6')]=function(_0x3ec8c4){var _0x5e83b7=this[_0x3f40('0x27')][_0x3ec8c4[_0x3f40('0xd7')]];var _0x543d14;if(!_[_0x3f40('0xd8')](_0x3ec8c4)&&!_['isNil'](_0x3ec8c4['variable'])&&!_['isNil'](_0x3ec8c4['variable'][_0x3f40('0xd9')])&&_0x3ec8c4['exten']===_0x3f40('0xda')&&_0x5e83b7){if(_0x5e83b7[_0x3f40('0x52')]!==_0x3f40('0x7f')&&this[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]][_0x3f40('0xdb')]&&_0x3ec8c4[_0x3f40('0xdc')]===_0x3f40('0xdd')){delete this['uniqueId'][_0x3ec8c4[_0x3f40('0xd7')]];this['updateOriginated'](this[_0x3f40('0x1f')][_0x5e83b7['queue']]);this['voiceQueues'][_0x5e83b7['queue']][_0x3f40('0x60')]+=0x1;this[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x543d14=new Hangup(_0x5e83b7,_0x3ec8c4);_0x543d14['state']=0x12;_0x543d14[_0x3f40('0xa9')]='HangupInAMD';_0x543d14['membername']=_0x3f40('0xde');ami[_0x3f40('0x51')]('custom:amd',ut[_0x3f40('0xdf')](_0x543d14,'amd'));this['saveInDb'](_0x543d14,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x5e83b7['type']!==_0x3f40('0x7f')&&this[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]]['dialAMDActive']&&_0x3ec8c4['value']===_0x3f40('0xe0')){var _0x5d8b86=this;return new BPromise(function(_0x5efa0e,_0x574143){delete _0x5d8b86[_0x3f40('0x27')][_0x3ec8c4['uniqueid']];_0x5d8b86[_0x3f40('0xaf')](_0x5d8b86[_0x3f40('0x1f')][_0x5e83b7['queue']]);_0x5d8b86[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x5d8b86[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]][_0x3f40('0x5f')]+=0x1;var _0x5f32c1=_0x5d8b86[_0x3f40('0x1f')][_0x5e83b7[_0x3f40('0xb1')]];var _0x595daa=new Hangup(_0x5e83b7,_0x3ec8c4);_0x595daa[_0x3f40('0xe1')]=0x13;_0x595daa[_0x3f40('0xa9')]=_0x3f40('0xe2');_0x595daa[_0x3f40('0xe3')]=_0x3f40('0xde');_0x595daa[_0x3f40('0xe4')]+=0x1;_0x595daa[_0x3f40('0xe5')]+=0x1;_0x595daa[_0x3f40('0xe6')]=!![];ami['emit'](_0x3f40('0xe7'),ut['buildObj'](_0x595daa,'amd'));_0x5d8b86[_0x3f40('0xc5')](_0x595daa)['catch'](loggerCatch(_0x3f40('0xe8')));if(_0x595daa[_0x3f40('0xe9')]+_0x595daa[_0x3f40('0xea')]+_0x595daa['countnoanswerretry']+_0x595daa[_0x3f40('0xeb')]+_0x595daa[_0x3f40('0xec')]+_0x595daa[_0x3f40('0xed')]+_0x595daa[_0x3f40('0xe4')]+_0x595daa[_0x3f40('0xee')]>=_0x5f32c1['dialGlobalMaxRetry']){_0x5d8b86[_0x3f40('0xef')](_0x595daa,_0x5efa0e,_0x574143,_0x3f40('0xf0'));}else{if(_0x595daa[_0x3f40('0xe4')]>=_0x5f32c1[_0x3f40('0xf1')]){_0x5d8b86['createStateFinal'](_0x595daa,_0x5efa0e,_0x574143,_0x3f40('0xf2'));}else{_0x5d8b86[_0x3f40('0xbc')]({'active':![],'countmachineretry':_0x595daa[_0x3f40('0xe4')],'scheduledat':moment()[_0x3f40('0xf3')](_0x5f32c1[_0x3f40('0xf4')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x595daa[_0x3f40('0xcb')],'ListId':_0x595daa[_0x3f40('0xcc')],'VoiceQueueId':_0x595daa[_0x3f40('0xcd')]||undefined,'CampaignId':_0x595daa[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0xf7')));_0x5efa0e({'reschedule':0x1});}}});}if(_0x5e83b7[_0x3f40('0x52')]==='ivr'&&this[_0x3f40('0x20')][_0x5e83b7[_0x3f40('0xb1')]]['dialAMDActive']&&_0x3ec8c4['value']===_0x3f40('0xdd')){delete this[_0x3f40('0x27')][_0x3ec8c4['uniqueid']];this['updateOriginated'](this[_0x3f40('0x20')][_0x5e83b7[_0x3f40('0xb1')]]);_0x543d14=new Hangup(_0x5e83b7,_0x3ec8c4);_0x543d14['state']=0x12;_0x543d14[_0x3f40('0xa9')]=_0x3f40('0xf8');_0x543d14[_0x3f40('0xe3')]='AMD';ami[_0x3f40('0x51')](_0x3f40('0xe7'),ut[_0x3f40('0xdf')](_0x543d14,_0x3f40('0xe6')));this[_0x3f40('0xc9')](_0x543d14,_0x3f40('0xf9'),'[syncHangupInAMDIvr]');}if(_0x5e83b7[_0x3f40('0x52')]===_0x3f40('0x7f')&&this[_0x3f40('0x20')][_0x5e83b7['queue']][_0x3f40('0xdb')]&&_0x3ec8c4['value']==='MACHINE'){var _0x5d8b86=this;return new BPromise(function(_0x4a45a0,_0x1c80bb){delete _0x5d8b86[_0x3f40('0x27')][_0x3ec8c4[_0x3f40('0xd7')]];_0x5d8b86[_0x3f40('0xaf')](_0x5d8b86['campaigns'][_0x5e83b7[_0x3f40('0xb1')]]);_0x5d8b86[_0x3f40('0x20')][_0x5e83b7[_0x3f40('0xb1')]][_0x3f40('0x60')]+=0x1;_0x5d8b86['campaigns'][_0x5e83b7[_0x3f40('0xb1')]][_0x3f40('0x5f')]+=0x1;var _0x4f011a=_0x5d8b86[_0x3f40('0x20')][_0x5e83b7[_0x3f40('0xb1')]];var _0x43bc0e=new Hangup(_0x5e83b7,_0x3ec8c4);_0x43bc0e['state']=0x13;_0x43bc0e[_0x3f40('0xa9')]='Machine';_0x43bc0e['membername']=_0x3f40('0xde');_0x43bc0e[_0x3f40('0xe4')]+=0x1;_0x43bc0e['countglobal']+=0x1;_0x43bc0e[_0x3f40('0xe6')]=!![];ami[_0x3f40('0x51')]('custom:amd',ut['buildObj'](_0x43bc0e,'amd'));_0x5d8b86[_0x3f40('0xc5')](_0x43bc0e)[_0x3f40('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x43bc0e['countbusyretry']+_0x43bc0e[_0x3f40('0xea')]+_0x43bc0e[_0x3f40('0xfa')]+_0x43bc0e[_0x3f40('0xeb')]+_0x43bc0e[_0x3f40('0xec')]+_0x43bc0e[_0x3f40('0xed')]+_0x43bc0e[_0x3f40('0xe4')]+_0x43bc0e[_0x3f40('0xee')]>=_0x4f011a['dialGlobalMaxRetry']){_0x5d8b86['stateGlobal'](_0x43bc0e,_0x4a45a0,_0x1c80bb,_0x3f40('0xf0'));}else{if(_0x43bc0e['countmachineretry']>=_0x4f011a[_0x3f40('0xf1')]){_0x5d8b86[_0x3f40('0xfb')](_0x43bc0e,_0x4a45a0,_0x1c80bb,_0x3f40('0xf2'));}else{_0x5d8b86[_0x3f40('0xbc')]({'active':![],'countmachineretry':_0x43bc0e['countmachineretry'],'scheduledat':moment()['add'](_0x4f011a[_0x3f40('0xf4')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x43bc0e[_0x3f40('0xcb')],'ListId':_0x43bc0e[_0x3f40('0xcc')],'VoiceQueueId':_0x43bc0e[_0x3f40('0xcd')]||undefined,'CampaignId':_0x43bc0e[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0xf7')));_0x4a45a0({'reschedule':0x1});}}});}}};Dialer[_0x3f40('0x1b')]['syncHangup']=function(_0x5c6808){var _0x169e52=this[_0x3f40('0x27')][_0x5c6808[_0x3f40('0xd7')]];var _0x5ee5bf=this;var _0x287449;if(_0x169e52&&_0x169e52['type']===_0x3f40('0x7f')){delete this['uniqueId'][_0x5c6808[_0x3f40('0xd7')]];this[_0x3f40('0xaf')](this[_0x3f40('0x20')][_0x169e52[_0x3f40('0xb1')]]);this['campaigns'][_0x169e52[_0x3f40('0xb1')]][_0x3f40('0xfc')]+=0x1;_0x287449=new Hangup(_0x169e52,_0x5c6808);this[_0x3f40('0xc5')](_0x287449)[_0x3f40('0xad')](loggerCatch(_0x3f40('0xfd')));this[_0x3f40('0xc4')](_0x287449)[_0x3f40('0xad')](loggerCatch(_0x3f40('0xfe')));}if(_0x169e52&&_0x169e52['type']!==_0x3f40('0x7f')&&isNotNull(this[_0x3f40('0x1f')][_0x169e52['queue']][_0x3f40('0xff')])){delete this[_0x3f40('0x27')][_0x5c6808['uniqueid']];this[_0x3f40('0xaf')](this['voiceQueues'][_0x169e52['queue']]);this[_0x3f40('0x1f')][_0x169e52[_0x3f40('0xb1')]][_0x3f40('0x60')]+=0x1;this[_0x3f40('0x1f')][_0x169e52[_0x3f40('0xb1')]][_0x3f40('0x5f')]+=0x1;_0x287449=new Hangup(_0x169e52,_0x5c6808);_0x287449['state']=0x10;_0x287449[_0x3f40('0xa9')]=_0x3f40('0x100');_0x287449[_0x3f40('0xe3')]=_0x3f40('0x101');this[_0x3f40('0xc5')](_0x287449)[_0x3f40('0xad')](loggerCatch(_0x3f40('0xfd')));this[_0x3f40('0xc4')](_0x287449)[_0x3f40('0xad')](loggerCatch(_0x3f40('0xfe')));}if(_0x169e52&&_0x169e52['type']!==_0x3f40('0x7f')&&!isNotNull(this[_0x3f40('0x1f')][_0x169e52['queue']][_0x3f40('0xff')])){delete this[_0x3f40('0x27')][_0x5c6808[_0x3f40('0xd7')]];this['updateOriginated'](this[_0x3f40('0x1f')][_0x169e52[_0x3f40('0xb1')]]);this[_0x3f40('0x1f')][_0x169e52[_0x3f40('0xb1')]][_0x3f40('0x69')]+=0x1;_0x287449=new Hangup(_0x169e52,_0x5c6808);_0x287449[_0x3f40('0xe1')]=0xc;_0x287449[_0x3f40('0xa9')]=_0x5c6808[_0x3f40('0x102')];_0x287449[_0x3f40('0xe3')]=_0x3f40('0x103');this['createHistory'](_0x287449)[_0x3f40('0xad')](loggerCatch(_0x3f40('0xfd')));this[_0x3f40('0xc4')](_0x287449)['catch'](loggerCatch(_0x3f40('0xfe')));}};Dialer[_0x3f40('0x1b')][_0x3f40('0x104')]=function(_0x5231aa){var _0x3d83e5=this[_0x3f40('0x27')][_0x5231aa[_0x3f40('0xd7')]];var _0x36d666=this;if(this[_0x3f40('0x1f')][_0x5231aa[_0x3f40('0xb1')]]){if(_0x3d83e5&&_0x3d83e5[_0x3f40('0x52')]!==_0x3f40('0x7f')){delete this[_0x3f40('0x27')][_0x5231aa['uniqueid']];this[_0x3f40('0x1f')][_0x5231aa[_0x3f40('0xb1')]][_0x3f40('0x60')]+=0x1;var _0x576c63=new AgentComplete(_0x3d83e5,_0x5231aa);if(_0x5231aa[_0x3f40('0x105')]===_0x3f40('0x106')){_0x576c63[_0x3f40('0x107')]=this[_0x3f40('0x1f')][_0x5231aa[_0x3f40('0xb1')]]['dialQueueProject2']&&this['voiceQueues'][_0x5231aa['queue']]['dialAgiAfterHangupAgent']?moment()[_0x3f40('0x7d')](_0x3f40('0xf6')):undefined;}this[_0x3f40('0xc5')](_0x576c63)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x108')));this[_0x3f40('0xc4')](_0x576c63)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x109')));}}};Dialer['prototype'][_0x3f40('0x2e')]=function(_0x9ad3d6){if(this[_0x3f40('0x1f')][_0x9ad3d6['queue']]){if(this[_0x3f40('0x27')][_0x9ad3d6[_0x3f40('0xd7')]]&&this['uniqueId'][_0x9ad3d6[_0x3f40('0xd7')]]['type']!==_0x3f40('0x7f')){this[_0x3f40('0xaf')](this[_0x3f40('0x1f')][_0x9ad3d6[_0x3f40('0xb1')]]);this[_0x3f40('0x27')][_0x9ad3d6[_0x3f40('0xd7')]]['answertime']=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));}}};Dialer[_0x3f40('0x1b')][_0x3f40('0x10a')]=function(_0x4eb579,_0x20cdab){this['createHistory'](_0x4eb579)['catch'](loggerCatch(_0x3f40('0x108')));if(_0x20cdab==0x0){this[_0x3f40('0xc4')](_0x4eb579)['catch'](loggerCatch(_0x3f40('0x10b')));}};Dialer[_0x3f40('0x1b')][_0x3f40('0x30')]=function(_0x23b657){var _0x1d67cc=this['uniqueId'][_0x23b657['uniqueid']];var _0xcf744d=this;var _0x509471=![];var _0x109e7b;var _0x5cf8c4;if(this['voiceQueues'][_0x23b657[_0x3f40('0xb1')]]){if(_0x1d67cc&&_0x1d67cc[_0x3f40('0x52')]!==_0x3f40('0x7f')){delete this[_0x3f40('0x27')][_0x23b657['uniqueid']];this[_0x3f40('0xaf')](this[_0x3f40('0x1f')][_0x23b657['queue']]);_0x1d67cc[_0x3f40('0x10c')]=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));var _0x1a330b=new QueueCallerAbandon(_0x1d67cc,_0x23b657);if(getSeconds(_0x1d67cc[_0x3f40('0x10c')],_0x1d67cc['responsetime'])>=_0x1d67cc['dialQueueTimeout']){this[_0x3f40('0x1f')][_0x23b657['queue']][_0x3f40('0x6e')]+=0x1;this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x66')]+=0x1;this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x70')]+=0x1;_0x1a330b[_0x3f40('0xe1')]=0xa;_0x1a330b[_0x3f40('0xa9')]=_0x3f40('0x10d');_0x1a330b['dropreason']=_0x3f40('0x10e');_0x1a330b[_0x3f40('0x107')]=this['voiceQueues'][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x10f')]?moment()[_0x3f40('0x7d')](_0x3f40('0xf6')):undefined;_0x1a330b[_0x3f40('0xec')]+=0x1;_0x1a330b[_0x3f40('0xe5')]+=0x1;_0x109e7b=this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x110')];_0x5cf8c4=this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x111')];_0xcf744d['verifyAdditionalPhones'](_0x1a330b,_0x1a330b[_0x3f40('0xe1')],_0x1d67cc[_0x3f40('0x112')])['then'](function(_0x343064){_0x509471=_0x343064[_0x3f40('0x113')]==0x1;if(_0x1a330b['countdropretry']>=_0xcf744d[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x114')]){_0xcf744d['queueCallerAbandonCreateState'](_0x1a330b,_0x343064[_0x3f40('0x113')]);}else{_0xcf744d[_0x3f40('0xbc')]({'active':![],'countdropretry':_0x1a330b[_0x3f40('0xec')],'scheduledat':moment()['add'](_0xcf744d[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x110')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x1d67cc[_0x3f40('0xcb')],'ListId':_0x1d67cc[_0x3f40('0xcc')],'VoiceQueueId':_0x1d67cc['VoiceQueueId']||undefined,'CampaignId':_0x1d67cc[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x115')));var _0x131f7b=new History(_0x1a330b);_0x131f7b[_0x3f40('0xe1')]=0xa;_0x131f7b['statedesc']=_0x3f40('0x10d');_0x131f7b[_0x3f40('0x116')]=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));_0x131f7b['endtime']=_0x131f7b[_0x3f40('0x116')];_0x131f7b[_0x3f40('0x117')]=_0x1a330b['calleridname'];_0x131f7b['calleridnum']=_0x1a330b[_0x3f40('0x118')];_0xcf744d[_0x3f40('0xc5')](_0x131f7b)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x119')));}})[_0x3f40('0x40')](function(_0x98a7f0){if(_0x509471)_0xcf744d[_0x3f40('0xb9')](_0x1a330b,_0x109e7b,_0x5cf8c4)[_0x3f40('0x40')](function(_0x469401){return 0x1;});});}else{this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x6d')]+=0x1;this[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x65')]+=0x1;_0x1a330b[_0x3f40('0xe1')]=0xb;_0x1a330b[_0x3f40('0xa9')]=_0x3f40('0x11a');_0x1a330b[_0x3f40('0x11b')]=_0x3f40('0x11c');_0x1a330b[_0x3f40('0xed')]+=0x1;_0x1a330b[_0x3f40('0xe5')]+=0x1;_0x109e7b=this[_0x3f40('0x1f')][_0x23b657['queue']][_0x3f40('0x11d')];_0x5cf8c4=this[_0x3f40('0x1f')][_0x23b657['queue']][_0x3f40('0x111')];_0xcf744d[_0x3f40('0xb8')](_0x1a330b,_0x1a330b[_0x3f40('0xe1')],_0x1d67cc[_0x3f40('0x112')])['then'](function(_0x567981){if(_0x1a330b[_0x3f40('0xed')]>=_0xcf744d[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]]['dialAbandonedMaxRetry']){_0xcf744d[_0x3f40('0x10a')](_0x1a330b,_0x567981[_0x3f40('0x113')]);}else{_0xcf744d[_0x3f40('0xbc')]({'active':![],'countabandonedretry':_0x1a330b['countabandonedretry'],'scheduledat':moment()[_0x3f40('0xf3')](_0xcf744d[_0x3f40('0x1f')][_0x23b657[_0x3f40('0xb1')]][_0x3f40('0x11d')],_0x3f40('0xf5'))[_0x3f40('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1d67cc[_0x3f40('0xcb')],'ListId':_0x1d67cc['ListId'],'VoiceQueueId':_0x1d67cc[_0x3f40('0xcd')]||undefined,'CampaignId':_0x1d67cc['CampaignId']||undefined})[_0x3f40('0xad')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x25b363=new History(_0x1a330b);_0x25b363['state']=0xb;_0x25b363[_0x3f40('0xa9')]='Abandoned';_0x25b363[_0x3f40('0x116')]=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));_0x25b363[_0x3f40('0x11e')]=_0x25b363[_0x3f40('0x116')];_0x25b363[_0x3f40('0x117')]=_0x1a330b['calleridname'];_0x25b363[_0x3f40('0x118')]=_0x1a330b[_0x3f40('0x118')];_0xcf744d[_0x3f40('0xc5')](_0x25b363)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x11f')));}})[_0x3f40('0x40')](function(_0x241cb7){if(_0x509471)_0xcf744d[_0x3f40('0xb9')](_0x1a330b,_0x109e7b,_0x5cf8c4)[_0x3f40('0x40')](function(_0x5589e2){return 0x1;});});}}}};Dialer[_0x3f40('0x1b')]['syncNewExten']=function(_0x5ff6b6){if(this[_0x3f40('0x25')][_0x5ff6b6[_0x3f40('0xd7')]]){this[_0x3f40('0x25')][_0x5ff6b6['uniqueid']]['channel']=_0x5ff6b6[_0x3f40('0x120')];}if(this[_0x3f40('0x27')][_0x5ff6b6[_0x3f40('0xd7')]]){this[_0x3f40('0x27')][_0x5ff6b6['uniqueid']][_0x3f40('0x120')]=_0x5ff6b6[_0x3f40('0x120')];}};Dialer[_0x3f40('0x1b')][_0x3f40('0x121')]=function(_0x5b5f8f){if(strategy[this[_0x3f40('0x1f')][this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]][_0x3f40('0xb1')]]['strategy']]===_0x3f40('0x1a')){if(this['actions'][_0x5b5f8f[_0x3f40('0x122')]]&&_[_0x3f40('0xd8')](this[_0x3f40('0x25')][_0x5b5f8f['actionid']][_0x3f40('0x123')])&&_0x5b5f8f['status']==='1'&&_0x5b5f8f[_0x3f40('0x124')]==='0'){if(this[_0x3f40('0x21')][_0x5b5f8f['stateinterface']]){if(!this[_0x3f40('0x21')][_0x5b5f8f['stateinterface']][_0x3f40('0x123')]){this['agents'][_0x5b5f8f['stateinterface']][_0x3f40('0x123')]=!![];this[_0x3f40('0x25')][_0x5b5f8f['actionid']]['locked']=!![];this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]][_0x3f40('0x125')]=_0x5b5f8f['stateinterface'];}}}}else if((strategy[this[_0x3f40('0x1f')][this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]][_0x3f40('0xb1')]][_0x3f40('0x54')]]||'rrmemory')===_0x3f40('0x19')){if(this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]]){if(this[_0x3f40('0x21')][_0x5b5f8f[_0x3f40('0x125')]]){this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]][_0x3f40('0x125')]=_0x5b5f8f['stateinterface'];if(_[_0x3f40('0xd8')](this[_0x3f40('0x2b')][this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]]['queue']])){this[_0x3f40('0x2b')][this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]][_0x3f40('0xb1')]]=[];}this['queueBooked'][this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]]['queue']][_0x3f40('0x126')](_[_0x3f40('0x127')](_[_0x3f40('0xca')](this[_0x3f40('0x25')][_0x5b5f8f[_0x3f40('0x122')]],[_0x3f40('0x128'),_0x3f40('0x125')]),{'status':_0x5b5f8f[_0x3f40('0xd4')],'paused':_0x5b5f8f[_0x3f40('0x124')]}));}}}};function unlockQueueStatus(_0x73d5b0,_0x4e0d13){setTimeout(function(){if(_[_0x3f40('0x42')](_0x73d5b0[_0x3f40('0x129')])){loggerBooked[_0x3f40('0x99')]('[unlockQueueStatus][undefined]',_0x4e0d13);}_0x73d5b0[_0x3f40('0x129')]=!![];loggerBooked[_0x3f40('0x81')]('[booked][unlockQueueStatus]',_0x4e0d13,JSON[_0x3f40('0x4e')](_[_0x3f40('0xca')](_0x73d5b0,[_0x3f40('0x44'),_0x3f40('0x129')])));},0x1f3);}Dialer['prototype'][_0x3f40('0x3c')]=function(_0x512dbc){var _0x2a7513=this;var _0x54975c=_0x2a7513['voiceQueues'][_0x2a7513['actions'][_0x512dbc['actionid']][_0x3f40('0xb1')]];if(strategy[this[_0x3f40('0x1f')][this[_0x3f40('0x25')][_0x512dbc['actionid']][_0x3f40('0xb1')]]['strategy']]===_0x3f40('0x1a')){if(this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]]&&this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0x125')]){this['preview']['run'](this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]]['idHopper'],this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0x125')])[_0x3f40('0xad')](function(_0x5c7e66){logger[_0x3f40('0x99')](_0x3f40('0x12a'),util['inspect'](_0x5c7e66,{'showHidden':![],'depth':null}));})[_0x3f40('0x12b')](function(){_0x2a7513[_0x3f40('0xaf')](_0x2a7513[_0x3f40('0x1f')][_0x2a7513['actions'][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xb1')]]);_0x2a7513[_0x3f40('0x21')][_0x2a7513['actions'][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0x125')]][_0x3f40('0x123')]=![];delete _0x2a7513['actions'][_0x512dbc[_0x3f40('0x122')]];unlockQueueStatus(_0x54975c);});}else{this[_0x3f40('0xaf')](this['voiceQueues'][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xb1')]]);this[_0x3f40('0xbc')]({'active':![],'ContactId':this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xcb')],'ListId':this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xcc')],'VoiceQueueId':this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x12c')));delete this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]];unlockQueueStatus(_0x54975c);}}else if((strategy[this['voiceQueues'][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xb1')]][_0x3f40('0x54')]]||_0x3f40('0x19'))===_0x3f40('0x19')){var _0x4f53db;if(this['actions'][_0x512dbc['actionid']]&&!_[_0x3f40('0x4d')](this['queueBooked'][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xb1')]])){if(this[_0x3f40('0x2c')][_0x2a7513[_0x3f40('0x25')][_0x512dbc['actionid']][_0x3f40('0xb1')]]){this['queueBookedRR'][_0x2a7513[_0x3f40('0x25')][_0x512dbc['actionid']][_0x3f40('0xb1')]]=this['queueBookedRR'][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]][_0x3f40('0xb1')]]?this[_0x3f40('0x2c')][this['actions'][_0x512dbc['actionid']]['queue']]:this['queueBooked'][this[_0x3f40('0x25')][_0x512dbc['actionid']][_0x3f40('0xb1')]]?this[_0x3f40('0x2b')][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]]['queue']][_0x3f40('0x12d')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x512dbc[_0x3f40('0x122')]]['queue']][_0x3f40('0x12d')]=this[_0x3f40('0x2c')][this[_0x3f40('0x25')][_0x512dbc[_0x3f40('0x122')]]['queue']];for(var _0x3dea4c=0x0;_0x3dea4c=0x0;})[_0x3f40('0xad')](myreject(_0x2871f0)));}}else{_0xb2ab84[_0x3f40('0x126')](ami['Action']({'action':'command','command':util[_0x3f40('0x7d')](_0x3f40('0x144'),_0x2d9473,!_[_0x3f40('0x42')](config[_0x3f40('0x140')][_0x43c191])?_0x43c191:'')})[_0x3f40('0x40')](function(_0x155467){return _0x155467[_0x3f40('0x146')][_0x3f40('0x148')]('true')>=0x0;})[_0x3f40('0xad')](myreject(_0x2871f0)));}BPromise[_0x3f40('0x149')](_0xb2ab84)[_0x3f40('0x40')](function(_0x19d690){var _0x3954e7=_[_0x3f40('0x14a')](_0x19d690);if(_0x3954e7){return _0x270209(_0x3954e7);}else{_0x55c588[_0x3f40('0x46')]=_0xf80bf7?_0x3f40('0x14b'):_0x3f40('0x14c');return _0x2871f0(msgResponse(_0x3f40('0x14d'),'Failure',_0x3f40('0x14e')+_0xf80bf7+'\x20'+_0x3b6ab5+_0x3f40('0x14f')+util[_0x3f40('0x98')](_0x2d9473,{'showHidden':![],'depth':null})+_0x3f40('0x150')+_0x43c191));}})[_0x3f40('0xad')](function(_0x4592d5){return _0x2871f0(msgResponse(_0x3f40('0x13c'),_0x3f40('0x13f'),JSON[_0x3f40('0x4e')](_0x4592d5)));});});};Dialer[_0x3f40('0x1b')][_0x3f40('0x151')]=function(_0x8f8106){var _0x4b9233=this;return function(){switch(_0x8f8106[_0x3f40('0x5c')]){case'progressive':freeVariablesPredictive(_0x8f8106);_0x4b9233[_0x3f40('0x152')](_0x8f8106,0x1);break;case _0x3f40('0x153'):freeVariablesPredictive(_0x8f8106);_0x4b9233[_0x3f40('0x152')](_0x8f8106,_0x8f8106['dialPowerLevel']);break;case'predictive':_0x4b9233[_0x3f40('0xa')](_0x8f8106);break;case _0x3f40('0x9'):freeVariablesPredictive(_0x8f8106);_0x4b9233[_0x3f40('0x152')](_0x8f8106,0x1);break;default:freeVariablesPredictive(_0x8f8106);logger[_0x3f40('0x99')](_0x3f40('0x154'),_0x8f8106[_0x3f40('0x44')],_0x3f40('0x155'));}};};Dialer[_0x3f40('0x1b')][_0x3f40('0x156')]=function(_0x341b06){var _0x2a3d1c=this;return function(){_0x2a3d1c[_0x3f40('0x157')](_0x341b06);};};Dialer['prototype'][_0x3f40('0x34')]=function(_0x219305){var _0x43ad40=this;if(isNotPreview(_0x219305[_0x3f40('0x5c')])){if(isVoiceQueueOutbound(_0x219305['type'])&&isActive(_0x219305[_0x3f40('0x158')])){_0x219305[_0x3f40('0xa2')]=!![];BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](checkIsLoggedIn(_0x219305,_0x219305[_0x3f40('0x159')]))[_0x3f40('0x40')](checkIsActive(_0x219305,_0x219305[_0x3f40('0x158')]))[_0x3f40('0x40')](checkInterval(_0x219305))[_0x3f40('0x40')](_0x43ad40['checkIsTrunkReachable'](_0x219305))[_0x3f40('0x40')](_0x43ad40['checkIfTime'](_0x219305['dialGlobalInterval'],_0x219305[_0x3f40('0x15a')],_0x219305['name'],_0x219305))[_0x3f40('0x40')](_0x43ad40['checkIfTimeIntervals'](_0x219305['Interval'],_0x219305[_0x3f40('0x15a')],_0x219305[_0x3f40('0x44')],_0x219305))[_0x3f40('0x40')](_0x43ad40['checkDialMethod'](_0x219305))[_0x3f40('0xad')](loggerCatchQueueSummary(_0x3f40('0x15b'),_0x219305));}else{notSendMessagesQueue(_0x219305);}}else{freeVariablesPredictive(_0x219305);}};Dialer[_0x3f40('0x1b')][_0x3f40('0x36')]=_[_0x3f40('0x15c')](function(){var _0x1394ad=_[_0x3f40('0x15d')](this[_0x3f40('0x1f')],function(_0x320349){return _0x320349['dialPreviewRecallmeReminder'];});var _0x43d67f=_[_0x3f40('0x15d')](this[_0x3f40('0x21')],function(_0x569654){return _0x569654[_0x3f40('0x15e')]&&_0x569654['status']===_0x3f40('0x15f');});if(_0x1394ad[_0x3f40('0x9b')]>0x0&&_0x43d67f[_0x3f40('0x9b')]>0x0){return BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](cmHopper['handlePreviewRecallNotifications'](_[_0x3f40('0x160')](_0x1394ad,'id'),previewRecallmeReminderInterval,_[_0x3f40('0x160')](_0x43d67f,'id')))[_0x3f40('0x40')](function(_0x623788){for(var _0x396ec2=0x0;_0x396ec2<_0x623788[_0x3f40('0x9b')];_0x396ec2++){var _0x44f497=_0x623788[_0x396ec2][_0x3f40('0x161')]['name'];if(_0x44f497)io['to'](util[_0x3f40('0x7d')](_0x3f40('0x162'),_0x44f497))[_0x3f40('0x51')](_0x3f40('0x163'),{'hopper':_0x623788[_0x396ec2]});}})[_0x3f40('0xad')](function(_0x45c311){logger[_0x3f40('0x99')](_0x3f40('0x164'),_0x45c311);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x3f40('0x1b')][_0x3f40('0x138')]=function(){var _0x416fd0=this;var _0xd2ce90;for(var _0xd347f6 in this[_0x3f40('0x20')]){if(typeof this[_0x3f40('0x20')][_0xd347f6]!==_0x3f40('0x9c')){_0xd2ce90=this[_0x3f40('0x20')][_0xd347f6];if(isCampaignIvr(_0xd2ce90[_0x3f40('0x52')])&&isActive(_0xd2ce90[_0x3f40('0x7b')])){_0xd2ce90[_0x3f40('0xa2')]=!![];BPromise[_0x3f40('0xb5')]()[_0x3f40('0x40')](checkIsActive(_0xd2ce90,_0xd2ce90[_0x3f40('0x7b')]))[_0x3f40('0x40')](checkInterval(_0xd2ce90))[_0x3f40('0x40')](_0x416fd0[_0x3f40('0x165')](_0xd2ce90))[_0x3f40('0x40')](_0x416fd0[_0x3f40('0x166')](_0xd2ce90[_0x3f40('0x167')],_0xd2ce90[_0x3f40('0x15a')],_0xd2ce90[_0x3f40('0x44')],_0xd2ce90))['then'](_0x416fd0[_0x3f40('0x13b')](_0xd2ce90['Interval'],_0xd2ce90[_0x3f40('0x15a')],_0xd2ce90[_0x3f40('0x44')],_0xd2ce90))[_0x3f40('0x40')](_0x416fd0[_0x3f40('0x156')](_0xd2ce90))['catch'](loggerCatchQueueSummary(_0x3f40('0x168'),_0xd2ce90));}else{notSendMessagesCampaign(_0xd2ce90);}}}};function getCallerIdRandom(_0x18454c,_0x1677b9){var _0x1cc82b;var _0x226d6e;var _0x1316a2;if(_0x1677b9<=0x0){_0x1677b9=0x1;}_0x1cc82b=new RegExp('\x5cw{0,'+_0x1677b9+'}$');_0x226d6e=Math['pow'](0xa,_0x1677b9-0x1);_0x1316a2=Math[_0x3f40('0x169')](0xa,_0x1677b9)-0x1;return util[_0x3f40('0x7d')]('%s',_['replace'](_0x18454c,_0x1cc82b,_[_0x3f40('0x16a')](_0x226d6e,_0x1316a2)));}function extractCalleridName(_0x1c7a53){var _0x553f29=_0x1c7a53[_0x3f40('0x16b')](/"(.*?)"/);return _0x553f29?_0x553f29[0x1]:_0x1c7a53;}function extractCalleridNumber(_0xfeb3f5){var _0x22622e=_0xfeb3f5[_0x3f40('0x16b')](/<(.*?)>/);return _0x22622e?_0x22622e[0x1]:_0xfeb3f5;}Dialer[_0x3f40('0x1b')][_0x3f40('0x16c')]=function(_0x1b47a5,_0x52a00f){var _0x589348=this;var _0x40d162=uuid['v4']();this[_0x3f40('0x25')][_0x40d162]=new Action(_0x1b47a5,_0x52a00f,_0x40d162);return new BPromise(function(_0x3e9bbf,_0x3dbf48){if(_['isUndefined'](_0x1b47a5)&&typeof _0x1b47a5!=='object'){return _0x3dbf48(msgResponse('originate',_0x3f40('0x13f'),_0x3f40('0x16d')));}if(_[_0x3f40('0x42')](_0x52a00f['phone'])||_0x52a00f['phone']===null){return _0x3dbf48(msgResponse(_0x3f40('0x16e'),_0x3f40('0x13f'),'contact\x20is\x20undefine'));}var _0x2cdd83={'XMD-CALLERID':_0x589348[_0x3f40('0x25')][_0x40d162][_0x3f40('0x16f')](),'XMD-AGI':_0x1b47a5[_0x3f40('0xff')]?util['format'](_0x3f40('0x170'),ipAgi,_0x1b47a5[_0x3f40('0xff')]):_0x3f40('0x171'),'XMD-AGIAFTER':_0x1b47a5[_0x3f40('0x10f')]?util[_0x3f40('0x7d')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1b47a5[_0x3f40('0x10f')]):_0x3f40('0x171'),'XMD-QUEUE':_0x1b47a5[_0x3f40('0x52')]==='outbound'?util[_0x3f40('0x7d')](_0x3f40('0x172'),_0x1b47a5['name'],_0x1b47a5[_0x3f40('0x173')]||'',_0x1b47a5['dialAgiAfterHangupAgent']?'c':'',_0x1b47a5['dialQueueTimeout']||0x3):_0x3f40('0x171'),'XMD-CONTACTID':_0x52a00f[_0x3f40('0xcb')],'XMD-CDRTYPE':_0x3f40('0x174'),'CALLERID(all)':_0x589348[_0x3f40('0x25')][_0x40d162][_0x3f40('0x16f')](),'XMD-AMD':_0x1b47a5['dialAMDActive']?_0x3f40('0x175'):_0x3f40('0x171'),'XMD-DESTINATION':_0x3f40('0xda')};if(_0x1b47a5[_0x3f40('0xdb')]){_0x2cdd83['XMD-AMDINITIALSILENCE']=_0x1b47a5[_0x3f40('0x176')]||0x9c4;_0x2cdd83[_0x3f40('0x177')]=_0x1b47a5[_0x3f40('0x178')]||0x5dc;_0x2cdd83[_0x3f40('0x179')]=_0x1b47a5[_0x3f40('0x17a')]||0x320;_0x2cdd83[_0x3f40('0x17b')]=_0x1b47a5[_0x3f40('0x17c')]||0x1388;_0x2cdd83[_0x3f40('0x17d')]=_0x1b47a5[_0x3f40('0x17e')]||0x64;_0x2cdd83[_0x3f40('0x17f')]=_0x1b47a5[_0x3f40('0x180')]||0x32;_0x2cdd83[_0x3f40('0x181')]=_0x1b47a5['dialAMDMaximumNumberOfWords']||0x3;_0x2cdd83['XMD-AMDSILENCETHRESHOLD']=_0x1b47a5[_0x3f40('0x182')]||0x100;_0x2cdd83['XMD-AMDMAXIMUMWORDLENGTH']=_0x1b47a5[_0x3f40('0x183')]||0x1388;}if(_0x1b47a5[_0x3f40('0x52')]==='outbound'){_0x2cdd83[_0x3f40('0x184')]=_0x52a00f[_0x3f40('0xcd')];}else{_0x2cdd83[_0x3f40('0x185')]=_0x52a00f[_0x3f40('0xce')];}for(var _0x1b6f44 in _0x52a00f[_0x3f40('0x186')]){if(typeof _0x52a00f[_0x3f40('0x186')][_0x1b6f44]!=='undefined'){if(isNotNull(_0x52a00f[_0x3f40('0x186')][_0x1b6f44])&&_0x1b6f44!=='id'&&_0x1b6f44!=='tags'&&_0x1b6f44!==_0x3f40('0x187')&&_0x1b6f44!==_0x3f40('0x188')){_0x2cdd83[util[_0x3f40('0x7d')]('%s%s',_0x3f40('0x189'),_['toUpper'](_0x1b6f44))]=_0x52a00f[_0x3f40('0x186')][_0x1b6f44];}}}var _0x1fc1db=_0x589348[_0x3f40('0xd2')](_0x1b47a5[_0x3f40('0x7a')])?getCallerId(_0x1b47a5[_0x3f40('0x7a')][_0x3f40('0x7c')],_0x1b47a5[_0x3f40('0x5d')],_0x1b47a5['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1b47a5['dialOriginateCallerIdNumber'],_0x1b47a5[_0x3f40('0x18a')]):_0x1b47a5[_0x3f40('0x5e')]):getCallerId(_['isNil'](_0x1b47a5[_0x3f40('0x139')])?_0x1b47a5[_0x3f40('0x7a')]['callerid']:_0x1b47a5[_0x3f40('0x139')][_0x3f40('0x7c')],_0x1b47a5['dialOriginateCallerIdName'],_0x1b47a5[_0x3f40('0x18a')]>0x0?getCallerIdRandom(_0x1b47a5[_0x3f40('0x5e')],_0x1b47a5[_0x3f40('0x18a')]):_0x1b47a5[_0x3f40('0x5e')]);if(_0x1fc1db){_0x2cdd83[_0x3f40('0x18b')]=_0x589348[_0x3f40('0x25')][_0x40d162][_0x3f40('0x18c')]=extractCalleridName(_0x1fc1db);_0x2cdd83[_0x3f40('0x18d')]=_0x52a00f[_0x3f40('0x18e')];}return ami[_0x3f40('0x18f')]({'actionid':_0x40d162,'action':_0x3f40('0x16e'),'channel':_0x589348['isTrunkReachable'](_0x1b47a5[_0x3f40('0x7a')])?util[_0x3f40('0x7d')](_0x3f40('0x190'),_0x1b47a5[_0x3f40('0x7a')]['name'],isNotNull(_0x1b47a5['dialPrefix'])?_0x1b47a5[_0x3f40('0x191')]['trim']()||'':'',_0x1b47a5[_0x3f40('0x192')]>0x0?_0x52a00f[_0x3f40('0x18e')][_0x3f40('0x193')](_0x1b47a5[_0x3f40('0x192')]):_0x52a00f[_0x3f40('0x18e')]):util[_0x3f40('0x7d')]('SIP/%s/%s%s',_['isNil'](_0x1b47a5[_0x3f40('0x139')])?_0x1b47a5[_0x3f40('0x7a')][_0x3f40('0x44')]:_0x1b47a5['TrunkBackup'][_0x3f40('0x44')],isNotNull(_0x1b47a5[_0x3f40('0x191')])?_0x1b47a5[_0x3f40('0x191')][_0x3f40('0x194')]()||'':'',_0x1b47a5[_0x3f40('0x192')]>0x0?_0x52a00f[_0x3f40('0x18e')][_0x3f40('0x193')](_0x1b47a5[_0x3f40('0x192')]):_0x52a00f[_0x3f40('0x18e')]),'callerid':_0x1fc1db,'Exten':_0x3f40('0xda'),'Context':_0x3f40('0x195'),'Priority':'1','variable':_0x2cdd83,'timeout':(_0x1b47a5[_0x3f40('0x196')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40d162})[_0x3f40('0x40')](function(_0x46cf40){return _0x3e9bbf(_0x46cf40);})[_0x3f40('0xad')](function(_0x1d5a49){_0x1b47a5[_0x3f40('0x197')]+=0x1;var _0x4b46af=new History(_0x589348[_0x3f40('0x25')][_0x40d162]);logger[_0x3f40('0x99')](util['format'](_0x3f40('0x198'),JSON[_0x3f40('0x4e')](_0x1d5a49)));_0x4b46af['state']=0xe;_0x4b46af[_0x3f40('0xa9')]='OriginateError';_0x4b46af[_0x3f40('0x116')]=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));_0x4b46af['endtime']=_0x4b46af[_0x3f40('0x116')];_0x589348[_0x3f40('0xc5')](_0x4b46af)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x199')));_0x589348['moveContactManagedDialer'](_0x4b46af)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x199')))['finally'](function(){delete _0x589348[_0x3f40('0x25')][_0x40d162];return _0x3dbf48(msgResponse(_0x3f40('0x16e'),_0x3f40('0x19a'),_0x3f40('0x19b')));});});});};Dialer[_0x3f40('0x1b')][_0x3f40('0x32')]=function(_0x25ee52){var _0x1b4394=this['actions'][_0x25ee52[_0x3f40('0x122')]];if(_0x1b4394){delete this[_0x3f40('0x25')][_0x25ee52[_0x3f40('0x122')]];_0x1b4394['responsetime']=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));var _0x23cc56=_0x1b4394[_0x3f40('0x52')]===_0x3f40('0x7f')?this[_0x3f40('0x20')][_0x1b4394[_0x3f40('0xb1')]]:this[_0x3f40('0x1f')][_0x1b4394[_0x3f40('0x19c')]()];if(!this['isSuccess'](_0x25ee52[_0x3f40('0x19d')])){this[_0x3f40('0xaf')](_0x23cc56);return this[_0x3f40('0x19e')](_0x1b4394,_0x23cc56,_0x25ee52)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x19f')));}this[_0x3f40('0x27')][_0x25ee52[_0x3f40('0xd7')]]=_0x1b4394;}};Dialer['prototype']['checkRetriveMax']=function(_0x3d19a2,_0x72ad4c,_0x553163){var _0x2c25ab=new History(_0x72ad4c);if(_0x2c25ab[_0x3f40('0xe9')]+_0x2c25ab[_0x3f40('0xea')]+_0x2c25ab[_0x3f40('0xfa')]+_0x2c25ab[_0x3f40('0xeb')]+_0x2c25ab[_0x3f40('0xec')]+_0x2c25ab[_0x3f40('0xed')]+_0x2c25ab[_0x3f40('0xe4')]+_0x2c25ab[_0x3f40('0xee')]>=_0x553163[_0x3f40('0x1a0')]-0x1){return!![];}switch(_0x3d19a2){case 0x3:if(_0x2c25ab[_0x3f40('0xfa')]>=_0x553163[_0x3f40('0x1a1')]-0x1){return!![];}this[_0x3f40('0xbc')]({'active':![],'countnoanswerretry':_0x2c25ab['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x3f40('0xf3')](_0x553163[_0x3f40('0x1a2')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x2c25ab['ContactId'],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab['VoiceQueueId']||undefined,'CampaignId':_0x2c25ab[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1a3')));break;case 0x5:if(_0x2c25ab[_0x3f40('0xe9')]>=_0x553163[_0x3f40('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x2c25ab[_0x3f40('0xe9')]+=0x1,'scheduledat':moment()[_0x3f40('0xf3')](_0x553163[_0x3f40('0x1a5')],_0x3f40('0xf5'))['format'](_0x3f40('0xf6')),'ContactId':_0x2c25ab['ContactId'],'ListId':_0x2c25ab['ListId'],'VoiceQueueId':_0x2c25ab[_0x3f40('0xcd')]||undefined,'CampaignId':_0x2c25ab[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1a6')));break;case 0x8:if(_0x2c25ab[_0x3f40('0xea')]>=_0x553163[_0x3f40('0x1a7')]-0x1){return!![];}this[_0x3f40('0xbc')]({'active':![],'countcongestionretry':_0x2c25ab['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3f40('0xf3')](_0x553163[_0x3f40('0x1a8')],'minutes')[_0x3f40('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab['VoiceQueueId']||undefined,'CampaignId':_0x2c25ab[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1a9')));break;case 0x0:if(_0x2c25ab[_0x3f40('0xeb')]>=_0x553163['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x3f40('0xbc')]({'active':![],'countnosuchnumberretry':_0x2c25ab[_0x3f40('0xeb')]+=0x1,'scheduledat':moment()[_0x3f40('0xf3')](_0x553163[_0x3f40('0x1aa')],_0x3f40('0xf5'))['format'](_0x3f40('0xf6')),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab[_0x3f40('0xcd')]||undefined,'CampaignId':_0x2c25ab['CampaignId']||undefined})[_0x3f40('0xad')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2c25ab[_0x3f40('0xec')]>=_0x553163[_0x3f40('0x114')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x2c25ab[_0x3f40('0xec')]+=0x1,'scheduledat':moment()['add'](_0x553163[_0x3f40('0x110')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab[_0x3f40('0xcd')]||undefined,'CampaignId':_0x2c25ab[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2c25ab[_0x3f40('0xed')]>=_0x553163['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x3f40('0xbc')]({'active':![],'countabandonedretry':_0x2c25ab[_0x3f40('0xed')]+=0x1,'scheduledat':moment()['add'](_0x553163[_0x3f40('0x11d')],'minutes')[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab[_0x3f40('0xcd')]||undefined,'CampaignId':_0x2c25ab[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2c25ab[_0x3f40('0xe4')]>=_0x553163['dialMachineMaxRetry']-0x1){return!![];}this[_0x3f40('0xbc')]({'active':![],'countmachineretry':_0x2c25ab[_0x3f40('0xe4')]+=0x1,'scheduledat':moment()['add'](_0x553163[_0x3f40('0xf4')],_0x3f40('0xf5'))[_0x3f40('0x7d')](_0x3f40('0xf6')),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab['ListId'],'VoiceQueueId':_0x2c25ab[_0x3f40('0xcd')]||undefined,'CampaignId':_0x2c25ab['CampaignId']||undefined})[_0x3f40('0xad')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2c25ab[_0x3f40('0xee')]>=_0x553163[_0x3f40('0x1ab')]-0x1){return!![];}this[_0x3f40('0xbc')]({'active':![],'countagentrejectretry':_0x2c25ab[_0x3f40('0xee')]+=0x1,'scheduledat':moment()[_0x3f40('0xf3')](_0x553163['dialAgentRejectRetryFrequency'],_0x3f40('0xf5'))['format'](_0x3f40('0xf6')),'ContactId':_0x2c25ab[_0x3f40('0xcb')],'ListId':_0x2c25ab[_0x3f40('0xcc')],'VoiceQueueId':_0x2c25ab['VoiceQueueId']||undefined,'CampaignId':_0x2c25ab['CampaignId']||undefined})['catch'](loggerCatch(_0x3f40('0x1ac')));break;default:return!![];}};Dialer[_0x3f40('0x1b')]['callProgressDetecting']=function(_0x599a62,_0x31c2e7,_0x2f6c85){var _0x5a2e91=this;var _0x82be6a=new History(_0x599a62);var _0x20ebd6=![];var _0x1656ed;var _0x44fef5;return new BPromise(function(_0xbb3470,_0x104798){if(_[_0x3f40('0x42')](_0x31c2e7)&&typeof _0x31c2e7!==_0x3f40('0x1ad')){return _0x104798(msgResponse('[callProgressDetecting]','Failure',_0x3f40('0x1ae')));}if(_[_0x3f40('0x42')](_0x2f6c85)&&typeof _0x2f6c85!==_0x3f40('0x1ad')){return _0x104798(msgResponse('[callProgressDetecting]',_0x3f40('0x13f'),_0x3f40('0x1af')));}_0x5a2e91[_0x3f40('0xb8')](_0x82be6a,_0x2f6c85[_0x3f40('0x105')],_0x31c2e7)[_0x3f40('0x40')](function(_0x33a17b){if(_0x33a17b[_0x3f40('0x113')]==0x1)_0x20ebd6=!![];switch(_0x2f6c85[_0x3f40('0x105')]){case'0':_0x31c2e7[_0x3f40('0x67')]+=0x1;_0x82be6a[_0x3f40('0xe1')]=0x0;_0x82be6a[_0x3f40('0xa9')]=_0x3f40('0x1b0');_0x82be6a[_0x3f40('0xeb')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x599a62,_0x3f40('0x1b1')));_0x1656ed=_0x31c2e7[_0x3f40('0x1aa')];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];_0x5a2e91[_0x3f40('0xc5')](_0x82be6a)[_0x3f40('0xad')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5a2e91['checkRetriveMax'](0x0,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a[_0x3f40('0xeb')]>=_0x31c2e7['dialNoSuchNumberMaxRetry']){_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1b2'));}else{_0x5a2e91[_0x3f40('0xef')](_0x82be6a,_0xbb3470,_0x104798,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x31c2e7['outboundNoAnswerCallsDay']+=0x1;_0x82be6a['state']=0x3;_0x82be6a[_0x3f40('0xa9')]=_0x3f40('0x1b3');_0x82be6a[_0x3f40('0xfa')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;ami[_0x3f40('0x51')]('custom:agentnoanswer',ut[_0x3f40('0xdf')](_0x599a62,_0x3f40('0x1b4')));_0x1656ed=_0x31c2e7[_0x3f40('0x1a2')];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];_0x5a2e91[_0x3f40('0xc5')](_0x82be6a)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1b5')));if(_0x5a2e91[_0x3f40('0x1b6')](0x3,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a['countnoanswerretry']>=_0x31c2e7['dialNoAnswerMaxRetry']){_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1b7'));}else{_0x5a2e91[_0x3f40('0xef')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1b7'));}}break;case'5':_0x31c2e7['outboundBusyCallsDay']+=0x1;_0x82be6a[_0x3f40('0xe1')]=0x5;_0x82be6a[_0x3f40('0xa9')]='Busy';_0x82be6a[_0x3f40('0xe9')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;ami[_0x3f40('0x51')]('custom:agentbusy',ut['buildObj'](_0x599a62,'busy'));_0x1656ed=_0x31c2e7['dialBusyRetryFrequency'];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];_0x5a2e91[_0x3f40('0xc5')](_0x82be6a)['catch'](loggerCatch(_0x3f40('0x1b8')));if(_0x5a2e91['checkRetriveMax'](0x5,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a[_0x3f40('0xe9')]>=_0x31c2e7[_0x3f40('0x1a4')]){_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1b9'));}else{_0x5a2e91[_0x3f40('0xef')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1b9'));}}break;case'8':_0x31c2e7['outboundCongestionCallsDay']+=0x1;_0x82be6a[_0x3f40('0xe1')]=0x8;_0x82be6a[_0x3f40('0xa9')]=_0x3f40('0x1ba');_0x82be6a[_0x3f40('0xea')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;_0x1656ed=_0x31c2e7[_0x3f40('0x1a8')];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];ami[_0x3f40('0x51')]('custom:agentcongestion',ut[_0x3f40('0xdf')](_0x599a62,_0x3f40('0x1bb')));_0x5a2e91['createHistory'](_0x82be6a)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1bc')));if(_0x5a2e91[_0x3f40('0x1b6')](0x8,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a[_0x3f40('0xea')]>=_0x31c2e7['dialCongestionMaxRetry']){_0x5a2e91['createStateFinal'](_0x82be6a,_0xbb3470,_0x104798,'reason\x208\x20congestion');}else{_0x5a2e91['stateGlobal'](_0x82be6a,_0xbb3470,_0x104798,'reason\x208\x20congestion');}}break;case'11':_0x31c2e7[_0x3f40('0x1bd')]+=0x1;_0x82be6a[_0x3f40('0xe1')]=0xb;_0x82be6a[_0x3f40('0xa9')]=_0x3f40('0x11a');_0x82be6a[_0x3f40('0xed')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;_0x1656ed=_0x31c2e7[_0x3f40('0x11d')];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];_0x5a2e91['createHistory'](_0x82be6a)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x11f')));if(_0x5a2e91[_0x3f40('0x1b6')](0xb,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a['countabandonedretry']>=_0x31c2e7[_0x3f40('0x1be')]){_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1bf'));}else{_0x5a2e91['stateGlobal'](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1bf'));}}break;case'20':_0x31c2e7[_0x3f40('0x68')]+=0x1;_0x82be6a['state']=0x14;_0x82be6a['statedesc']=_0x3f40('0x1c0');_0x82be6a[_0x3f40('0xee')]+=0x1;_0x82be6a[_0x3f40('0xe5')]+=0x1;_0x1656ed=_0x31c2e7['dialAgentRejectRetryFrequency'];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];ami['emit'](_0x3f40('0x1c1'),ut['buildObj'](_0x599a62,'agentreject'));_0x5a2e91[_0x3f40('0xc5')](_0x82be6a)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1c2')));if(_0x5a2e91[_0x3f40('0x1b6')](0x14,_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a['countagentrejectretry']>=_0x31c2e7['dialAgentRejectMaxRetry']){_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1c3'));}else{_0x5a2e91[_0x3f40('0xef')](_0x82be6a,_0xbb3470,_0x104798,_0x3f40('0x1c3'));}}break;default:_0x31c2e7[_0x3f40('0x69')]+=0x1;_0x82be6a[_0x3f40('0xe1')]=0xc;_0x82be6a[_0x3f40('0xa9')]=_0x2f6c85[_0x3f40('0x105')];_0x1656ed=_0x31c2e7[_0x3f40('0x1c4')];_0x44fef5=_0x31c2e7[_0x3f40('0x111')];_0x5a2e91['createHistory'](_0x82be6a)[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1c5')));if(_0x5a2e91[_0x3f40('0x1b6')](_0x2f6c85[_0x3f40('0x105')],_0x599a62,_0x31c2e7)&&!_0x20ebd6){if(_0x82be6a[_0x3f40('0xe9')]+_0x82be6a[_0x3f40('0xea')]+_0x82be6a[_0x3f40('0xfa')]+_0x82be6a['countnosuchnumberretry']+_0x82be6a['countdropretry']+_0x82be6a[_0x3f40('0xed')]+_0x82be6a[_0x3f40('0xe4')]+_0x82be6a[_0x3f40('0xee')]>=_0x31c2e7[_0x3f40('0x1a0')]){_0x5a2e91[_0x3f40('0xef')](_0x82be6a,_0xbb3470,_0x104798,_0x2f6c85[_0x3f40('0x105')]);}else{_0x5a2e91[_0x3f40('0xfb')](_0x82be6a,_0xbb3470,_0x104798,_0x2f6c85[_0x3f40('0x105')]);}}}})['then'](function(_0x24ca97){if(_0x20ebd6){_0x5a2e91[_0x3f40('0xb9')](_0x82be6a,_0x1656ed,_0x44fef5)[_0x3f40('0x40')](function(_0x266ccf){return _0xbb3470(0x1);});}});});};Dialer[_0x3f40('0x1b')][_0x3f40('0xef')]=function(_0x29e089,_0x46f8ec,_0xfbb213,_0xd1e4db){var _0x217523=new Final(_0x29e089);_0x217523['state']=0xf;_0x217523[_0x3f40('0xa9')]='Global';this[_0x3f40('0xfb')](_0x217523,_0x46f8ec,_0xfbb213,_0xd1e4db);};Dialer[_0x3f40('0x1b')][_0x3f40('0xfb')]=function(_0x41fb57,_0x3de671,_0x443d89,_0xaf9f36){this[_0x3f40('0xc4')](_0x41fb57)[_0x3f40('0x40')](function(){return _0x3de671(msgResponse(_0x3f40('0x1c6'),'Success',_0xaf9f36));})[_0x3f40('0xad')](function(){return _0x443d89(msgResponse(_0x3f40('0x1c7'),_0x3f40('0x13f'),_0x3f40('0x1c8')));});};Dialer[_0x3f40('0x1b')][_0x3f40('0xa')]=function(_0x286b0e){var _0x1463ab=_0x286b0e[_0x3f40('0x1c9')]/0x64;var _0x47f4b2=_0x286b0e[_0x3f40('0x66')]/(_0x286b0e[_0x3f40('0x66')]+_0x286b0e['outboundAnswerCallsDay']);var _0x17ca01=Math[_0x3f40('0x1ca')](_0x286b0e[_0x3f40('0x74')]*(_0x286b0e[_0x3f40('0x1cb')]/0x64));var _0x1f016f=Math[_0x3f40('0x1ca')](_0x286b0e[_0x3f40('0x74')]*(_0x286b0e[_0x3f40('0x1cc')]/0x64));var _0x29d711=_0x286b0e[_0x3f40('0x55')]+_0x286b0e[_0x3f40('0xa3')];var _0x29bdee=Math[_0x3f40('0x1cd')](_0x286b0e[_0x3f40('0x8c')]*_0x286b0e['erlangAbandonmentRate']*_0x286b0e[_0x3f40('0x71')]*_0x286b0e[_0x3f40('0x72')]);if(_[_0x3f40('0x42')](_0x286b0e[_0x3f40('0x29')])){if(!_[_0x3f40('0x42')](_0x286b0e[_0x3f40('0x79')])){_0x286b0e[_0x3f40('0x79')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x3f40('0x1ce'));}if(!_[_0x3f40('0x42')](_0x286b0e[_0x3f40('0x93')])){loggerPredictive[_0x3f40('0x99')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x286b0e[_0x3f40('0x93')]);_0x286b0e['handlePredictive']=undefined;}_0x286b0e['startProgressive']=moment()['format'](_0x3f40('0xf6'));loggerPredictive['info'](_0x286b0e[_0x3f40('0x44')],_0x3f40('0x1cf'),_0x286b0e[_0x3f40('0x29')]);this[_0x3f40('0x152')](_0x286b0e,0x1);}else if(ifInterval(_0x286b0e['dialPredictiveInterval'],_0x286b0e[_0x3f40('0x29')])){this[_0x3f40('0x152')](_0x286b0e,0x1);loggerPredictiveCalls[_0x3f40('0x81')](_0x3f40('0x1d0'),_0x286b0e[_0x3f40('0x29')],_0x286b0e[_0x3f40('0x44')]);_0x286b0e[_0x3f40('0x8c')]=0x0;_0x286b0e['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1463ab<_0x47f4b2&&_0x286b0e[_0x3f40('0x1d1')]==='dropRate'){freeVariablesPredictive(_0x286b0e);loggerPredictive['info'](_0x3f40('0x1d2'),_0x3f40('0x1d3'),_0x47f4b2,_0x3f40('0x29'),_0x286b0e['name']);}else if(_0x29bdee<_0x286b0e[_0x3f40('0x70')]&&_0x286b0e[_0x3f40('0x1d1')]==='dropRate'){freeVariablesPredictive(_0x286b0e);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x1d4'),_0x3f40('0x1d5'),_0x29bdee,_0x3f40('0x1d6'),_0x286b0e[_0x3f40('0x70')],'startProgressive',_0x286b0e[_0x3f40('0x44')]);}else if(!ifInterval(_0x286b0e['dialPredictiveInterval'],_0x286b0e[_0x3f40('0x29')])&&_['isUndefined'](_0x286b0e[_0x3f40('0x79')])&&!_[_0x3f40('0x42')](_0x286b0e[_0x3f40('0x29')])){_0x286b0e[_0x3f40('0x79')]=moment()['format'](_0x3f40('0xf6'));loggerPredictive[_0x3f40('0x81')](_0x286b0e[_0x3f40('0x44')],_0x3f40('0x1d7'),_0x286b0e[_0x3f40('0x79')]);this[_0x3f40('0xba')](_0x286b0e[_0x3f40('0x1d8')])[_0x3f40('0x40')](this[_0x3f40('0x1d9')](_0x286b0e))[_0x3f40('0x40')](mergeDataErlangB(_0x286b0e))[_0x3f40('0x40')](this[_0x3f40('0x1da')](_0x286b0e))[_0x3f40('0xad')](loggerCatchPredictive(_0x3f40('0x1db'),_0x286b0e));}else if(!ifInterval(_0x286b0e[_0x3f40('0x1d8')],_0x286b0e[_0x3f40('0x79')])){_0x286b0e[_0x3f40('0x70')]=0x0;_0x286b0e[_0x3f40('0x79')]=moment()[_0x3f40('0x7d')](_0x3f40('0xf6'));loggerPredictive[_0x3f40('0x81')](_0x286b0e[_0x3f40('0x44')],_0x3f40('0x1dc'),_0x286b0e[_0x3f40('0x79')]);clearInterval(_0x286b0e[_0x3f40('0x93')]);_0x286b0e[_0x3f40('0x93')]=undefined;this[_0x3f40('0xba')](_0x286b0e['dialPredictiveInterval'])[_0x3f40('0x40')](this[_0x3f40('0x1d9')](_0x286b0e))[_0x3f40('0x40')](mergeDataErlangB(_0x286b0e))[_0x3f40('0x40')](this[_0x3f40('0x1da')](_0x286b0e))['catch'](loggerCatchPredictive(_0x3f40('0x1dd'),_0x286b0e));}else if(_0x286b0e['predictiveIntervalAvailable']&&_0x29d711<_0x286b0e[_0x3f40('0x74')]-_0x1f016f){freeVariablesPredictive(_0x286b0e);loggerPredictive['info'](_0x286b0e[_0x3f40('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x29d711,_0x3f40('0x1de'),_0x286b0e['predictiveIntervalAvailable'],'-',_0x1f016f,'=',_0x286b0e[_0x3f40('0x74')]-_0x1f016f,')');}else if(_0x286b0e[_0x3f40('0x74')]&&_0x29d711>_0x286b0e[_0x3f40('0x74')]+_0x17ca01){freeVariablesPredictive(_0x286b0e);loggerPredictive[_0x3f40('0x81')](_0x286b0e['name'],_0x3f40('0x1df'),_0x29d711,_0x3f40('0x1e0'),_0x286b0e['predictiveIntervalAvailable'],'+',_0x17ca01,'=',_0x286b0e[_0x3f40('0x74')]+_0x17ca01,')');}};Dialer[_0x3f40('0x1b')]['getDataPredictive']=function(_0x225a1d){var _0xcc005=this;return function(_0x402149){return new BPromise(function(_0x3fef92,_0x243759){_[_0x3f40('0x127')](_0x225a1d,_0x402149[0x0]);if(checkGetDataPredictive(_0x402149[0x0])){var _0x37189d=_0x225a1d[_0x3f40('0x74')]=_0x225a1d[_0x3f40('0xa3')]+_0x225a1d[_0x3f40('0x55')];var _0x116c22=_0x225a1d[_0x3f40('0x1d8')]*0x3c;var _0x272cea=_0x402149[0x0][_0x3f40('0x6c')]+_0x402149[0x0][_0x3f40('0x6b')];var _0x47ea3b=(_0x402149[0x0]['predictiveIntervalAnsweredCalls']+_0x402149[0x0][_0x3f40('0x6e')]+_0x402149[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x402149[0x0]['predictiveIntervalTotalCalls'];_0x225a1d[_0x3f40('0x71')]=_0x47ea3b>0x0?_0x47ea3b:0x1;switch(_0x225a1d[_0x3f40('0x1d1')]){case _0x3f40('0x1e1'):var _0x3d2ee9=_0x225a1d['dialPredictiveOptimizationPercentage']/0x64;return _0xcc005['abandonmentRate'](_0x37189d,_0x116c22,_0x272cea,_0x47ea3b,_0x3d2ee9)[_0x3f40('0x40')](function(_0x4620bf){return _0x3fef92(_0x4620bf);});case _0x3f40('0x1e2'):var _0x588c61=_0x225a1d[_0x3f40('0x1c9')]/0x64;return _0xcc005['busyFactor'](_0x37189d,_0x116c22,_0x272cea,_0x47ea3b,_0x588c61)['then'](function(_0x53eae8){return _0x3fef92(_0x53eae8);});default:return _0x243759(msgResponse(_0x3f40('0x1e3'),_0x3f40('0x13f'),_0x3f40('0x1e4')));}}else{return _0x243759(msgResponse(_0x3f40('0x1e3'),_0x3f40('0x13f'),_0x3f40('0x1e5')));}});};};Dialer[_0x3f40('0x1b')][_0x3f40('0x1e6')]=function(_0x3c7fcf){var _0x1f9bc9=this;return function(_0x121167){return new BPromise(function(_0x4d580b,_0x543a87){_[_0x3f40('0x127')](_0x3c7fcf,_0x121167[0x0]);if(checkGetDataPredictive(_0x121167[0x0])){loggerPredictive[_0x3f40('0x81')](JSON[_0x3f40('0x4e')](_0x121167[0x0]));if(_0x3c7fcf[_0x3f40('0x1d1')]===_0x3f40('0x1e1')){return _0x1f9bc9[_0x3f40('0xc3')](_0x3c7fcf['id'])['then'](function(_0x551069){var _0x5f5236=_0x3c7fcf['loggedIn']-_0x551069[0x0][_0x3f40('0x1e7')];var _0x15650a=_0x3c7fcf[_0x3f40('0x1d8')]*0x3c;var _0x2690e9=_0x121167[0x0]['predictiveIntervalAvgTalktime']+_0x121167[0x0][_0x3f40('0x6b')];var _0x379b29=(_0x121167[0x0][_0x3f40('0x6a')]+_0x121167[0x0][_0x3f40('0x6e')]+_0x121167[0x0][_0x3f40('0x6d')])/_0x121167[0x0][_0x3f40('0x75')];var _0x16204c=_0x3c7fcf['dialPredictiveOptimizationPercentage']/0x64;_0x3c7fcf['predictiveIntervalPauses']=_0x551069[0x0]['outboundQueuePauses']||0x0;_0x3c7fcf[_0x3f40('0x71')]=_0x379b29>0x0?_0x379b29:0x1;return _0x1f9bc9[_0x3f40('0x1e8')](_0x5f5236,_0x15650a,_0x2690e9,_0x379b29,_0x16204c);})[_0x3f40('0x40')](function(_0x56a7c9){return _0x4d580b(_0x56a7c9);})[_0x3f40('0xad')](function(_0x472d78){return _0x543a87(msgResponse(_0x3f40('0x1e9'),'Failure',JSON['stringify'](_0x472d78)));});}if(_0x3c7fcf[_0x3f40('0x1d1')]===_0x3f40('0x1e2')){return _0x1f9bc9[_0x3f40('0xc3')](_0x3c7fcf['id'])[_0x3f40('0x40')](function(_0x373629){var _0x5bac0f=_0x3c7fcf['loggedIn']-_0x373629[0x0][_0x3f40('0x1e7')];var _0x5262a6=_0x3c7fcf[_0x3f40('0x1d8')]*0x3c;var _0x52493d=_0x121167[0x0][_0x3f40('0x6c')]+_0x121167[0x0][_0x3f40('0x6b')];var _0x303302=(_0x121167[0x0][_0x3f40('0x6a')]+_0x121167[0x0][_0x3f40('0x6e')]+_0x121167[0x0][_0x3f40('0x6d')])/_0x121167[0x0][_0x3f40('0x75')];var _0x139e2b=_0x3c7fcf[_0x3f40('0x1c9')]/0x64;_0x3c7fcf[_0x3f40('0x73')]=_0x373629[0x0][_0x3f40('0x1e7')]||0x0;_0x3c7fcf[_0x3f40('0x71')]=_0x303302>0x0?_0x303302:0x1;return _0x1f9bc9[_0x3f40('0x1ea')](_0x5bac0f,_0x5262a6,_0x52493d,_0x303302,_0x139e2b);})['then'](function(_0x24bdd8){return _0x4d580b(_0x24bdd8);})[_0x3f40('0xad')](function(_0xd36b35){return _0x543a87(msgResponse(_0x3f40('0x1e9'),_0x3f40('0x13f'),JSON['stringify'](_0xd36b35)));});}}else{return _0x543a87(msgResponse(_0x3f40('0x1e3'),_0x3f40('0x13f'),_0x3f40('0x1e5')));}});};};Dialer[_0x3f40('0x1b')][_0x3f40('0x1da')]=function(_0x167667){var _0x1a1031=this;return function(){var _0x592456=0x0;var _0x42e104=Math[_0x3f40('0x1cd')](_0x167667['erlangCallToSecond']*0x3e8);if(_0x42e104>0x0){_0x42e104=_0x42e104<0x64?0x64:_0x42e104;loggerPredictive[_0x3f40('0x81')](_0x167667[_0x3f40('0x44')],_0x3f40('0x1eb'),_0x42e104,'milliseconds');_0x167667[_0x3f40('0x93')]=setInterval(function(){_0x1a1031['handlePredictive'](_0x167667);loggerPredictiveCalls[_0x3f40('0x81')](_0x3f40('0x1ec'),_0x592456+=0x1);},_0x42e104);}else{loggerPredictive[_0x3f40('0x81')](_0x167667[_0x3f40('0x44')],_0x3f40('0x1ed'));}};};Dialer[_0x3f40('0x1b')][_0x3f40('0x1ee')]=function(_0x4a4435,_0x3070bf){var _0x27405c=this;return function(_0x3f6aed){if(_[_0x3f40('0x4d')](_0x3f6aed)){if(_[_0x3f40('0xd8')](_0x3070bf[_0x3f40('0x1ef')])||!_0x3070bf['recallme']){if(_0x4a4435['dialMethod']===_0x3f40('0x9')){_0x4a4435[_0x3f40('0x129')]=_[_0x3f40('0x42')](_0x4a4435[_0x3f40('0x129')])?!![]:_0x4a4435[_0x3f40('0x129')];var _0x303b16=uuid['v4']();_0x27405c[_0x3f40('0x25')][_0x303b16]=new Action(_0x4a4435,_0x3070bf,_0x303b16);loggerBooked[_0x3f40('0x81')](_0x3f40('0x1f0'),_0x303b16,_0x3f40('0x1f1'),JSON[_0x3f40('0x4e')](_0x4a4435['queueStatusComplete']),_0x3f40('0x1f2'),_0x4a4435[_0x3f40('0x44')]);if(_0x4a4435[_0x3f40('0x129')]){_0x4a4435[_0x3f40('0x129')]=![];_0x27405c[_0x3f40('0x2b')][_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xb1')]]=[];ami[_0x3f40('0x18f')]({'actionid':_0x303b16,'action':'queuestatus','queue':_0x4a4435[_0x3f40('0x44')]})[_0x3f40('0xad')](function(){_0x27405c[_0x3f40('0xaf')](_0x4a4435);_0x27405c['rescheduleContact']({'active':![],'ContactId':_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xcb')],'ListId':_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xcc')],'VoiceQueueId':_0x27405c[_0x3f40('0x25')][_0x303b16]['VoiceQueueId']||undefined,'CampaignId':_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xce')]||undefined})['catch'](loggerCatch(_0x3f40('0x1f3')));delete _0x27405c[_0x3f40('0x25')][_0x303b16];});}else{loggerBooked[_0x3f40('0x81')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x4a4435[_0x3f40('0x129')]),_0x3f40('0x1f2'),_0x4a4435[_0x3f40('0x44')]);_0x27405c[_0x3f40('0xaf')](_0x4a4435);_0x27405c[_0x3f40('0xbc')]({'active':![],'ContactId':_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xcb')],'ListId':_0x27405c[_0x3f40('0x25')][_0x303b16][_0x3f40('0xcc')],'VoiceQueueId':_0x27405c['actions'][_0x303b16][_0x3f40('0xcd')]||undefined,'CampaignId':_0x27405c['actions'][_0x303b16][_0x3f40('0xce')]||undefined})['catch'](loggerCatch(_0x3f40('0x1f3')));delete _0x27405c[_0x3f40('0x25')][_0x303b16];}}else{return _0x27405c[_0x3f40('0x16c')](_0x4a4435,_0x3070bf);}}else{if(getDiff(_0x3070bf[_0x3f40('0x1f4')])<_0x4a4435['dialRecallMeTimeout']*0x3c){if(_0x3070bf[_0x3f40('0x161')]&&!_0x3070bf['Agent'][_0x3f40('0x1f5')]){_0x27405c['preview']['run'](_0x3070bf['id'])[_0x3f40('0x12b')](function(){_0x27405c[_0x3f40('0xaf')](_0x4a4435);});}else{_0x27405c['unlockContact']({'active':![]},_0x3070bf['id'],0x1)['finally'](function(){_0x27405c[_0x3f40('0xaf')](_0x4a4435);});}}else{_0x4a4435[_0x3f40('0x1f6')]+=0x1;_0x27405c[_0x3f40('0xaf')](_0x4a4435);if(_0x4a4435[_0x3f40('0x1f7')]){_0x27405c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3070bf['ContactId'],'ListId':_0x3070bf[_0x3f40('0xcc')],'VoiceQueueId':_0x3070bf['VoiceQueueId']||undefined,'CampaignId':_0x3070bf[_0x3f40('0xce')]||undefined})[_0x3f40('0xad')](loggerCatch(_0x3f40('0x1f8')));_0x27405c[_0x3f40('0xc5')](createObjHistory(_0x4a4435,_0x3070bf,'RECALLINQUEUE',0x17,_0x3f40('0x1f9')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x27405c[_0x3f40('0xc9')](createObjHistory(_0x4a4435,_0x3070bf,'RECALLFAILEDTIMEOUT',0x16,_0x3f40('0x1fa')),_0x3f40('0x1fb'),_0x3f40('0x1fc'));}}}}else{_0x4a4435[_0x3f40('0x61')]+=0x1;_0x27405c[_0x3f40('0xc9')](createObjHistory(_0x4a4435,_0x3070bf,_0x3f40('0x1fd'),0xd,'Blacklist'),_0x3f40('0x1fe'),_0x3f40('0x1ff'));throw'inBlackList';}};};Dialer[_0x3f40('0x1b')][_0x3f40('0x157')]=function(_0x34ee7e){var _0x525f9c=this;var _0x371a1d=_0x34ee7e[_0x3f40('0x200')]-_0x34ee7e['originated']-_0x34ee7e[_0x3f40('0xc1')];emitCampaignSummary(_0x34ee7e);if(_0x371a1d>0x0){if(_0x371a1d>this['maxNumberOriginate']){_0x371a1d=this['maxNumberOriginate'];}_0x34ee7e[_0x3f40('0xc1')]+=_0x371a1d;this['getContactDialerIvr'](_0x34ee7e['id'],_0x371a1d,_0x34ee7e[_0x3f40('0x201')],_0x34ee7e)[_0x3f40('0x40')](function(_0x368a93){_0x34ee7e[_0x3f40('0xc1')]-=_0x371a1d;_0x34ee7e[_0x3f40('0xc1')]=_0x34ee7e['temp']>0x0?_0x34ee7e['temp']:0x0;if(!checkContactEmpty(_0x368a93)){_0x34ee7e[_0x3f40('0x46')]=_0x3f40('0xa1');logger['info'](_0x3f40('0x202')+_0x34ee7e['name']);}else{_0x34ee7e[_0x3f40('0x76')]+=_0x368a93[_0x3f40('0x9b')];_0x34ee7e[_0x3f40('0x46')]=_0x3f40('0x203');for(var _0x502840=0x0;_0x502840<_0x368a93[_0x3f40('0x9b')];_0x502840+=0x1){_0x34ee7e[_0x3f40('0x204')]+=0x1;if(_[_0x3f40('0xd8')](_0x368a93[_0x502840])||_[_0x3f40('0xd8')](_0x368a93[_0x502840][_0x3f40('0x186')])||_[_0x3f40('0xd8')](_0x368a93[_0x502840][_0x3f40('0x18e')])){_0x525f9c[_0x3f40('0xc8')](_0x3f40('0x205'),_0x34ee7e,_0x368a93[_0x502840]);}else{_0x525f9c[_0x3f40('0x206')](_['pick'](_0x368a93[_0x502840],[_0x3f40('0xce'),_0x3f40('0x207')]))['then'](_0x525f9c['checkContactBlack'](_0x34ee7e,_0x368a93[_0x502840]))[_0x3f40('0xad')](_0x525f9c[_0x3f40('0x208')](_0x3f40('0x209'),_0x34ee7e));}}}})[_0x3f40('0xad')](loggerGetContactDialer(_0x3f40('0x20a'),_0x34ee7e,_0x371a1d));}};Dialer['prototype'][_0x3f40('0x152')]=function(_0x102d9c,_0x2625e9){var _0x4d8216=this;var _0x74359d=[];var _0x36d5b7=_0x2625e9>=0x1?_0x2625e9:0x1;if(_0x102d9c[_0x3f40('0x5c')]===_0x3f40('0x9')){_0x36d5b7=0x1;}var _0x28304c=Math['floor'](_0x102d9c[_0x3f40('0x55')]*_0x36d5b7)-_0x102d9c[_0x3f40('0x76')]-_0x102d9c['temp'];emitVoiceQueueSummary(_0x102d9c);if(_0x102d9c['dialLimitQueue']>0x0){var _0x220ff4=_0x102d9c['dialLimitQueue']-_0x102d9c[_0x3f40('0x76')]-_0x102d9c['talking']-_0x102d9c[_0x3f40('0xc1')]-_0x102d9c[_0x3f40('0x56')];if(_0x28304c>_0x220ff4){_0x28304c=_0x220ff4;}}if(_0x28304c>0x0){if(_0x102d9c[_0x3f40('0x5c')]===_0x3f40('0x9')){_0x28304c=0x1;}if(_0x28304c>this[_0x3f40('0x23')]){_0x28304c=this[_0x3f40('0x23')];}_0x102d9c[_0x3f40('0xc1')]+=_0x28304c;for(var _0x313f0a in this[_0x3f40('0x21')]){if(typeof this[_0x3f40('0x21')][_0x313f0a]!=='undefined'){if(this[_0x3f40('0x21')][_0x313f0a]['state']===_0x3f40('0x20b')&&this[_0x3f40('0x21')][_0x313f0a][_0x3f40('0xd4')]==='reachable'){_0x74359d[_0x3f40('0x126')](this[_0x3f40('0x21')][_0x313f0a]['id']);}}}this[_0x3f40('0xc0')](_0x102d9c['id'],_0x74359d,_0x28304c,_0x102d9c[_0x3f40('0x201')],_0x102d9c)[_0x3f40('0x40')](function(_0x1e9ef9){_0x102d9c['temp']-=_0x28304c;_0x102d9c['temp']=_0x102d9c[_0x3f40('0xc1')]>0x0?_0x102d9c[_0x3f40('0xc1')]:0x0;if(!checkContactEmpty(_0x1e9ef9)){_0x4d8216['countReScheduled'](_0x102d9c)[_0x3f40('0x40')](sendMessageReschedule(_0x102d9c))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xb4')));}else{_0x102d9c[_0x3f40('0x76')]+=_0x1e9ef9[_0x3f40('0x9b')];_0x102d9c['message']=_0x102d9c[_0x3f40('0x5c')]===_0x3f40('0x9')?_0x3f40('0x175'):'RUNNING';for(var _0x568cf5=0x0;_0x568cf5<_0x1e9ef9[_0x3f40('0x9b')];_0x568cf5+=0x1){if(_[_0x3f40('0xd8')](_0x1e9ef9[_0x568cf5])||_[_0x3f40('0xd8')](_0x1e9ef9[_0x568cf5][_0x3f40('0x186')])||_['isNil'](_0x1e9ef9[_0x568cf5][_0x3f40('0x18e')])){_0x4d8216[_0x3f40('0xc8')](_0x3f40('0x205'),_0x102d9c,_0x1e9ef9[_0x568cf5]);}else{_0x4d8216[_0x3f40('0xb6')](_[_0x3f40('0xca')](_0x1e9ef9[_0x568cf5],[_0x3f40('0xcd'),_0x3f40('0x207')]))[_0x3f40('0x40')](_0x4d8216['checkContactBlack'](_0x102d9c,_0x1e9ef9[_0x568cf5]))['catch'](_0x4d8216[_0x3f40('0x208')](_0x3f40('0x205'),_0x102d9c));}}}})[_0x3f40('0xad')](loggerGetContactDialer(_0x3f40('0x20c'),_0x102d9c,_0x28304c));}};Dialer[_0x3f40('0x1b')][_0x3f40('0x93')]=function(_0x47dce3){if(_0x47dce3[_0x3f40('0x20d')]>0x0){var _0x497ea4=_0x47dce3[_0x3f40('0x20d')]-_0x47dce3[_0x3f40('0x76')]-_0x47dce3[_0x3f40('0xa3')];if(_0x497ea4>0x0){this[_0x3f40('0x20e')](_0x47dce3);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x3f40('0x20e')](_0x47dce3);}};Dialer[_0x3f40('0x1b')][_0x3f40('0x20e')]=function(_0x51b50f){var _0x4fdfef=this;var _0x444499=[];_0x51b50f[_0x3f40('0x76')]+=0x1;for(var _0x4c5f5d in this[_0x3f40('0x21')]){if(typeof this[_0x3f40('0x21')][_0x4c5f5d]!=='undefined'){if(this['agents'][_0x4c5f5d][_0x3f40('0xe1')]===_0x3f40('0x20b')&&this[_0x3f40('0x21')][_0x4c5f5d][_0x3f40('0xd4')]==='reachable'){_0x444499[_0x3f40('0x126')](this['agents'][_0x4c5f5d]['id']);}}}this[_0x3f40('0xc0')](_0x51b50f['id'],_0x444499,0x1,_0x51b50f['dialOrderByScheduledAt'],_0x51b50f)['then'](function(_0x3b6746){if(!checkContactEmpty(_0x3b6746)){checkContactLowerLimitOriginate(_0x51b50f,0x1,0x0);_0x4fdfef['countReScheduled'](_0x51b50f)[_0x3f40('0x40')](sendMessageReschedule(_0x51b50f))[_0x3f40('0xad')](loggerCatch(_0x3f40('0xb4')));}else{_0x51b50f[_0x3f40('0x46')]=_0x3f40('0x203');if(_['isNil'](_0x3b6746[0x0])||_[_0x3f40('0xd8')](_0x3b6746[0x0][_0x3f40('0x186')])||_[_0x3f40('0xd8')](_0x3b6746[0x0]['phone'])){_0x4fdfef[_0x3f40('0xc8')](_0x3f40('0x205'),_0x51b50f,_0x3b6746[0x0]);}else{_0x4fdfef[_0x3f40('0xb6')](_[_0x3f40('0xca')](_0x3b6746[0x0],['VoiceQueueId',_0x3f40('0x207')]))[_0x3f40('0x40')](_0x4fdfef[_0x3f40('0x1ee')](_0x51b50f,_0x3b6746[0x0]))[_0x3f40('0xad')](_0x4fdfef[_0x3f40('0x208')](_0x3f40('0x20f'),_0x51b50f));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x51b50f,0x1));emitVoiceQueueSummary(_0x51b50f);};Dialer[_0x3f40('0x1b')][_0x3f40('0x1e8')]=function(_0x445265,_0x573570,_0x39f4d9,_0x68a83f,_0x8b55ac,_0x3b0b0d){loggerPredictive['info'](_0x3f40('0x210'));loggerPredictive[_0x3f40('0x81')](_0x3f40('0x211'),_0x445265);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x212'),_0x573570);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x213'),_0x39f4d9);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x214'),_0x68a83f);loggerPredictive[_0x3f40('0x81')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x8b55ac);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x88'));return new BPromise(function(_0x3b4947,_0x14c7f4){if(_0x445265<=0x0||isNaN(_0x445265)){return _0x14c7f4(msgResponse(_0x3f40('0x215'),'Error',_0x3f40('0x216')+_0x445265));}if(_0x39f4d9<=0x0||isNaN(_0x39f4d9)){return _0x14c7f4(msgResponse(_0x3f40('0x215'),_0x3f40('0x19a'),_0x3f40('0x217')+_0x39f4d9));}if(_0x68a83f<=0x0||isNaN(_0x68a83f)){return _0x14c7f4(msgResponse(_0x3f40('0x215'),'Error',_0x3f40('0x218')+_0x68a83f));}if(_0x573570<=0x0||isNaN(_0x573570)){return _0x14c7f4(msgResponse(_0x3f40('0x215'),'Error','interval\x20=\x20'+_0x573570));}if(_0x8b55ac<=0x0||isNaN(_0x8b55ac)){return _0x14c7f4(msgResponse('[abandonmentRate]',_0x3f40('0x19a'),_0x3f40('0x219')+_0x8b55ac));}_0x3b0b0d=_0x3b0b0d||0x0;var _0xcd56fe=0x1/_0x39f4d9;var _0x2ddf68=0x0;var _0x306410=0x0;var _0x2b1db4=0x0;var _0x368483=0x0;for(var _0x1bbf6e=0x0;_0x2b1db4<_0x8b55ac;_0x1bbf6e+=0x1){_0x306410=_0x1bbf6e/_0x573570;_0x2ddf68=(_0x68a83f*_0x306410+_0x3b0b0d)/_0xcd56fe;_0x2b1db4=erlangb(_0x2ddf68,_0x445265);_0x368483=_0x2ddf68/_0x445265*(0x1-erlangb(_0x2ddf68,_0x445265));}return _0x3b4947({'erlangCalls':_0x1bbf6e,'erlangCallToSecond':_0x573570/_0x1bbf6e,'erlangAbandonmentRate':_0x2b1db4,'erlangBusyFactor':_0x368483});});};Dialer[_0x3f40('0x1b')][_0x3f40('0x1ea')]=function(_0x22cdbf,_0x4d7e34,_0x2fd65e,_0x449575,_0x2b5dd4,_0x544037){loggerPredictive[_0x3f40('0x81')](_0x3f40('0x21a'));loggerPredictive[_0x3f40('0x81')](_0x3f40('0x211'),_0x22cdbf);loggerPredictive['info'](_0x3f40('0x212'),_0x4d7e34);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x213'),_0x2fd65e);loggerPredictive['info'](_0x3f40('0x214'),_0x449575);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x21b'),_0x2b5dd4);loggerPredictive[_0x3f40('0x81')](_0x3f40('0x88'));return new BPromise(function(_0x2d8fdf,_0xf11eee){if(_0x22cdbf<=0x0||isNaN(_0x22cdbf)){return _0xf11eee(msgResponse(_0x3f40('0x21c'),_0x3f40('0x19a'),_0x3f40('0x216')+_0x22cdbf));}if(_0x2fd65e<=0x0||isNaN(_0x2fd65e)){return _0xf11eee(msgResponse(_0x3f40('0x21c'),'Error',_0x3f40('0x217')+_0x2fd65e));}if(_0x449575<=0x0||isNaN(_0x449575)){return _0xf11eee(msgResponse(_0x3f40('0x21c'),_0x3f40('0x19a'),'p\x20=\x20'+_0x449575));}if(_0x4d7e34<=0x0||isNaN(_0x4d7e34)){return _0xf11eee(msgResponse('[busyFactor]',_0x3f40('0x19a'),_0x3f40('0x21d')+_0x4d7e34));}if(_0x2b5dd4<=0x0||isNaN(_0x2b5dd4)){return _0xf11eee(msgResponse(_0x3f40('0x21c'),_0x3f40('0x19a'),_0x3f40('0x21e')+_0x2b5dd4));}_0x544037=_0x544037||0x0;var _0x22aabd=0x1/_0x2fd65e;var _0x5ac467=0x0;var _0x12bb1a=0x0;var _0xbdabf9=0x0;var _0x480322=0x0;for(var _0xb8fdbc=0x0;_0x480322<_0x2b5dd4;_0xb8fdbc+=0x1){_0x12bb1a=_0xb8fdbc/_0x4d7e34;_0x5ac467=(_0x449575*_0x12bb1a+_0x544037)/_0x22aabd;_0xbdabf9=erlangb(_0x5ac467,_0x22cdbf);_0x480322=_0x5ac467/_0x22cdbf*(0x1-erlangb(_0x5ac467,_0x22cdbf));}return _0x2d8fdf({'erlangCalls':_0xb8fdbc,'erlangCallToSecond':_0x4d7e34/_0xb8fdbc,'erlangAbandonmentRate':_0xbdabf9,'erlangBusyFactor':_0x480322});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 88fe70a..423483e 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84cd=['endtime','ringtime','holdtime','responsetime','talktime','membername','connectedlinename','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','number','starttime','droptime'];(function(_0x1616cd,_0x2037f2){var _0x5b9241=function(_0x405f5d){while(--_0x405f5d){_0x1616cd['push'](_0x1616cd['shift']());}};_0x5b9241(++_0x2037f2);}(_0x84cd,0xb2));var _0xd84c=function(_0x1bd9f7,_0x29b962){_0x1bd9f7=_0x1bd9f7-0x0;var _0x48a409=_0x84cd[_0x1bd9f7];return _0x48a409;};'use strict';var util=require(_0xd84c('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x46d9be,_0x3546ee){var _0x24f102=moment(_0x46d9be)[_0xd84c('0x1')](0x0);var _0x8c7448=moment(_0x3546ee)[_0xd84c('0x1')](0x0);return _0x24f102[_0xd84c('0x2')](_0x8c7448,_0xd84c('0x3'));}function QueueCallerAbandon(_0x2b0591,_0x50d923){this[_0xd84c('0x4')]=_0x2b0591[_0xd84c('0x4')];this[_0xd84c('0x5')]=_0x2b0591[_0xd84c('0x5')];this[_0xd84c('0x6')]=_0x2b0591['type']===_0xd84c('0x7')?_0xd84c('0x8'):_0x2b0591['type'];this['countbusyretry']=_0x2b0591[_0xd84c('0x9')];this[_0xd84c('0xa')]=_0x2b0591[_0xd84c('0xa')];this[_0xd84c('0xb')]=_0x2b0591[_0xd84c('0xb')];this[_0xd84c('0xc')]=_0x2b0591[_0xd84c('0x9')]+_0x2b0591['countcongestionretry']+_0x2b0591['countnoanswerretry']+_0x2b0591[_0xd84c('0xd')]+_0x2b0591[_0xd84c('0xe')]+_0x2b0591['countabandonedretry']+_0x2b0591[_0xd84c('0xf')]+_0x2b0591['countagentrejectretry'];this[_0xd84c('0xd')]=_0x2b0591[_0xd84c('0xd')];this[_0xd84c('0xe')]=_0x2b0591['countdropretry'];this[_0xd84c('0x10')]=_0x2b0591[_0xd84c('0x10')];this[_0xd84c('0xf')]=_0x2b0591[_0xd84c('0xf')];this[_0xd84c('0x11')]=_0x2b0591['countagentrejectretry'];this[_0xd84c('0x12')]=_0x50d923[_0xd84c('0x12')];this['calleridname']=_0x2b0591['name'];this['calleridnum']=_0x2b0591[_0xd84c('0x13')];this['starttime']=_0x2b0591[_0xd84c('0x14')];this['responsetime']=_0x2b0591['responsetime'];this[_0xd84c('0x15')]=_0x2b0591['droptime'];this[_0xd84c('0x16')]=this[_0xd84c('0x15')];this[_0xd84c('0x17')]=getSeconds(_0x2b0591['responsetime'],_0x2b0591['starttime']);this[_0xd84c('0x18')]=getSeconds(this[_0xd84c('0x15')],_0x2b0591[_0xd84c('0x19')]);this[_0xd84c('0x1a')]=0x0;this[_0xd84c('0x8')]=_0x50d923[_0xd84c('0x8')];this[_0xd84c('0x1b')]=_0x50d923[_0xd84c('0x1c')];this['reason']=_0x50d923['reason'];this['callback']=_0x2b0591[_0xd84c('0x1d')];this['callbackuniqueid']=_0x2b0591[_0xd84c('0x1e')];this['callbackat']=_0x2b0591['callbackat'];this[_0xd84c('0x1f')]=_0x2b0591[_0xd84c('0x1f')];this[_0xd84c('0x20')]=_0x2b0591[_0xd84c('0x20')];this[_0xd84c('0x21')]=_0x2b0591['ListId'];this[_0xd84c('0x22')]=_0x2b0591[_0xd84c('0x22')];this['VoiceQueueId']=_0x2b0591[_0xd84c('0x23')];this[_0xd84c('0x24')]=_0x2b0591[_0xd84c('0x24')];this[_0xd84c('0x25')]=_0x2b0591[_0xd84c('0x25')]||'';this[_0xd84c('0x26')]=_0x2b0591[_0xd84c('0x26')]||'';}module[_0xd84c('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x35c8=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x35c8,0xa6));var _0x835c=function(_0x4d6d67,_0x3cb87a){_0x4d6d67=_0x4d6d67-0x0;var _0x4baa79=_0x35c8[_0x4d6d67];return _0x4baa79;};'use strict';var util=require(_0x835c('0x0'));var _=require(_0x835c('0x1'));var moment=require(_0x835c('0x2'));function getSeconds(_0x1763c3,_0x306f59){var _0x541bd6=moment(_0x1763c3)['milliseconds'](0x0);var _0xbb7e9f=moment(_0x306f59)[_0x835c('0x3')](0x0);return _0x541bd6[_0x835c('0x4')](_0xbb7e9f,_0x835c('0x5'));}function QueueCallerAbandon(_0xef2221,_0x3c3f2f){this[_0x835c('0x6')]=_0xef2221[_0x835c('0x6')];this['type']=_0xef2221[_0x835c('0x7')];this[_0x835c('0x8')]=_0xef2221[_0x835c('0x7')]==='outbound'?_0x835c('0x9'):_0xef2221[_0x835c('0x7')];this[_0x835c('0xa')]=_0xef2221['countbusyretry'];this[_0x835c('0xb')]=_0xef2221[_0x835c('0xb')];this[_0x835c('0xc')]=_0xef2221[_0x835c('0xc')];this[_0x835c('0xd')]=_0xef2221['countbusyretry']+_0xef2221['countcongestionretry']+_0xef2221[_0x835c('0xc')]+_0xef2221[_0x835c('0xe')]+_0xef2221[_0x835c('0xf')]+_0xef2221['countabandonedretry']+_0xef2221[_0x835c('0x10')]+_0xef2221[_0x835c('0x11')];this['countnosuchnumberretry']=_0xef2221['countnosuchnumberretry'];this[_0x835c('0xf')]=_0xef2221[_0x835c('0xf')];this[_0x835c('0x12')]=_0xef2221[_0x835c('0x12')];this[_0x835c('0x10')]=_0xef2221['countmachineretry'];this[_0x835c('0x11')]=_0xef2221[_0x835c('0x11')];this[_0x835c('0x13')]=_0x3c3f2f[_0x835c('0x13')];this[_0x835c('0x14')]=_0xef2221[_0x835c('0x15')];this[_0x835c('0x16')]=_0xef2221[_0x835c('0x17')];this[_0x835c('0x18')]=_0xef2221[_0x835c('0x18')];this[_0x835c('0x19')]=_0xef2221[_0x835c('0x19')];this['droptime']=_0xef2221[_0x835c('0x1a')];this[_0x835c('0x1b')]=this[_0x835c('0x1a')];this[_0x835c('0x1c')]=getSeconds(_0xef2221['responsetime'],_0xef2221['starttime']);this[_0x835c('0x1d')]=getSeconds(this[_0x835c('0x1a')],_0xef2221[_0x835c('0x19')]);this[_0x835c('0x1e')]=0x0;this['queue']=_0x3c3f2f['queue'];this[_0x835c('0x1f')]=_0x3c3f2f[_0x835c('0x20')];this['reason']=_0x3c3f2f['reason'];this['callback']=_0xef2221[_0x835c('0x21')];this[_0x835c('0x22')]=_0xef2221[_0x835c('0x22')];this[_0x835c('0x23')]=_0xef2221['callbackat'];this[_0x835c('0x24')]=_0xef2221[_0x835c('0x24')];this[_0x835c('0x25')]=_0xef2221[_0x835c('0x25')];this[_0x835c('0x26')]=_0xef2221[_0x835c('0x26')];this[_0x835c('0x27')]=_0xef2221['UserId'];this[_0x835c('0x28')]=_0xef2221[_0x835c('0x28')];this[_0x835c('0x29')]=_0xef2221[_0x835c('0x29')];this[_0x835c('0x2a')]=_0xef2221['originatecalleridnum']||'';this[_0x835c('0x2b')]=_0xef2221[_0x835c('0x2b')]||'';}module[_0x835c('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index f29ae08..40413e5 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5b7d8f,_0x268879){var _0x54d7f1=function(_0x543eaf){while(--_0x543eaf){_0x5b7d8f['push'](_0x5b7d8f['shift']());}};_0x54d7f1(++_0x268879);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x54a5bb,_0x40d861){var _0x399c26=function(_0x253dbe){while(--_0x253dbe){_0x54a5bb['push'](_0x54a5bb['shift']());}};_0x399c26(++_0x40d861);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 2a8c951..9add334 100644 --- a/server/services/ami/fax/index.js +++ b/server/services/ami/fax/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabdc=['actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','fax','catch','error','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks'];(function(_0xa50d60,_0x97a526){var _0x4280cb=function(_0x122d1d){while(--_0x122d1d){_0xa50d60['push'](_0xa50d60['shift']());}};_0x4280cb(++_0x97a526);}(_0xabdc,0x15a));var _0xcabd=function(_0x2e9224,_0x52e025){_0x2e9224=_0x2e9224-0x0;var _0x1b632e=_0xabdc[_0x2e9224];return _0x1b632e;};'use strict';var util=require(_0xcabd('0x0'));var _=require(_0xcabd('0x1'));var BPromise=require('bluebird');var uuid=require(_0xcabd('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xcabd('0x3'));var gs=require(_0xcabd('0x4'));var logger=require(_0xcabd('0x5'))('fax');var ami=require(_0xcabd('0x6'));var rpcDb=require(_0xcabd('0x7'));var Channel=require(_0xcabd('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xcabd('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xcabd('0xa'));function Fax(_0x1ba1eb){this[_0xcabd('0xb')]={};this[_0xcabd('0xc')]=_0x1ba1eb['faxAccounts'];this[_0xcabd('0xd')]=_0x1ba1eb['trunks'];this[_0xcabd('0xe')]={};ami['on'](_0xcabd('0xf'),this[_0xcabd('0x10')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x12'),this[_0xcabd('0x13')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x14'),this[_0xcabd('0x15')]['bind'](this));ami['on'](_0xcabd('0x16'),this[_0xcabd('0x17')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x18'),this[_0xcabd('0x19')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x1a'),this[_0xcabd('0x1b')][_0xcabd('0x11')](this));ami['on'](_0xcabd('0x1c'),this[_0xcabd('0x1d')]['bind'](this));ami['on'](_0xcabd('0x1e'),this[_0xcabd('0x1f')][_0xcabd('0x11')](this));}Fax[_0xcabd('0x20')][_0xcabd('0x10')]=function(_0x11458c){if(_0x11458c['context']==='from-voip-provider'){for(var _0x164f6f in this['faxAccounts']){if(this[_0xcabd('0xc')][_0xcabd('0x21')](_0x164f6f)){if(_0x11458c[_0xcabd('0x22')]===this[_0xcabd('0xc')][_0x164f6f][_0xcabd('0x23')]){this['channels'][_0x11458c[_0xcabd('0x24')]]={};this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['channel']=_0x11458c['channel'];this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['id']=this[_0xcabd('0xc')][_0x164f6f]['id'];this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]][_0xcabd('0x25')]=this[_0xcabd('0xc')][_0x164f6f][_0xcabd('0x25')];logger[_0xcabd('0x26')](_0x11458c['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x11458c[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]={};this[_0xcabd('0xb')][_0x11458c[_0xcabd('0x24')]]['channel']=_0x11458c[_0xcabd('0x27')];logger[_0xcabd('0x26')](_0x11458c[_0xcabd('0x24')],_0xcabd('0x28'));}};Fax['prototype'][_0xcabd('0x13')]=function(_0x1da289){if(this['channels'][_0x1da289[_0xcabd('0x24')]]){for(var _0x346c8d in _0x1da289['variable']){if(_0x1da289[_0xcabd('0x29')][_0xcabd('0x21')](_0x346c8d)){this[_0xcabd('0xb')][_0x1da289[_0xcabd('0x24')]][_0x346c8d]=_0x1da289[_0xcabd('0x2a')];}}}};Fax[_0xcabd('0x20')][_0xcabd('0x15')]=function(_0x6a0d1f){if(this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]][_0xcabd('0x2b')]=_0x6a0d1f[_0xcabd('0x2b')];this[_0xcabd('0xb')][_0x6a0d1f[_0xcabd('0x24')]][_0xcabd('0x2c')]=_0x6a0d1f[_0xcabd('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x3c3c7e){if(this['channels'][_0x3c3c7e['uniqueid']]){for(var _0x452f14 in _0x3c3c7e[_0xcabd('0x29')]){if(_0x3c3c7e['variable']['hasOwnProperty'](_0x452f14)){this[_0xcabd('0xb')][_0x3c3c7e[_0xcabd('0x24')]][_0x452f14]=_0x3c3c7e[_0xcabd('0x2a')];}}}};Fax[_0xcabd('0x20')][_0xcabd('0x19')]=function(_0x1a7bb){if(this['channels'][_0x1a7bb[_0xcabd('0x24')]]){this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]][_0xcabd('0x2d')]=_0x1a7bb[_0xcabd('0x2d')];this['channels'][_0x1a7bb[_0xcabd('0x24')]]['status']=_0x1a7bb[_0xcabd('0x2e')];this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]]['localstationid']=_0x1a7bb[_0xcabd('0x23')];this[_0xcabd('0xb')][_0x1a7bb[_0xcabd('0x24')]]['filename']=_0x1a7bb['filename'];logger[_0xcabd('0x26')](_0x1a7bb[_0xcabd('0x24')],'\x20syncFaxStatus\x20');}};Fax['prototype']['syncReceiveFax']=function(_0x57661b){var _0x2a9428=this;if(this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]]){var _0x2daab9=this['channels'][_0x57661b['uniqueid']]['id'];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x2f')]=_0x57661b[_0xcabd('0x2f')];this[_0xcabd('0xb')][_0x57661b['uniqueid']][_0xcabd('0x30')]=_0x57661b[_0xcabd('0x30')];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x23')]=_0x57661b[_0xcabd('0x23')];this['channels'][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x31')]=_0x57661b[_0xcabd('0x31')];this[_0xcabd('0xb')][_0x57661b['uniqueid']][_0xcabd('0x32')]=_0x57661b[_0xcabd('0x32')];this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x33')]=_0x57661b[_0xcabd('0x33')];this['channels'][_0x57661b[_0xcabd('0x24')]]['calleridnum']=_0x57661b[_0xcabd('0x34')];if(this[_0xcabd('0xb')][_0x57661b[_0xcabd('0x24')]][_0xcabd('0x30')]>0x0){tiff2pdf(_0x57661b['filename'],_0xcabd('0x35'),function(_0x213923){logger['info'](_0x57661b['uniqueid'],_0xcabd('0x36'),_0x213923[_0xcabd('0x37')]);attachment['create']({'name':path['parse'](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')],'basename':path[_0xcabd('0x38')](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')]+_0xcabd('0x39'),'type':_0xcabd('0x3a')})[_0xcabd('0x3b')](function(_0x282312){faxAccount[_0xcabd('0x3c')](_0x2daab9,{'from':_0x57661b['calleridnum'],'mapKey':_0xcabd('0x3d'),'body':path[_0xcabd('0x38')](_0x57661b[_0xcabd('0x33')])[_0xcabd('0x25')]+'.pdf','AttachmentId':_0x282312['id']})[_0xcabd('0x3e')](function(_0x2005f8){logger[_0xcabd('0x3f')](_0x57661b[_0xcabd('0x24')],'\x20notify\x20',JSON[_0xcabd('0x40')](_0x2005f8));});})[_0xcabd('0x3e')](function(_0x3efb4e){logger[_0xcabd('0x3f')](_0x57661b[_0xcabd('0x24')],'\x20receiveFax\x20',JSON[_0xcabd('0x40')](_0x3efb4e));});});}logger['info'](_0x57661b[_0xcabd('0x24')],'\x20receiveFax\x20');}};Fax[_0xcabd('0x20')][_0xcabd('0x1f')]=function(_0x124776){if(this[_0xcabd('0xe')][_0x124776[_0xcabd('0x24')]]){_[_0xcabd('0x41')](this[_0xcabd('0xb')][_0x124776['uniqueid']],_[_0xcabd('0x42')](_0x124776,[_0xcabd('0x43'),_0xcabd('0x44')]));}};function updateStatus(_0x322b0f){if(_0x322b0f[_0xcabd('0x45')]){faxMessage[_0xcabd('0x46')](_0x322b0f[_0xcabd('0x45')],{'failMessage':_0xcabd('0x47')})[_0xcabd('0x3b')](function(_0x2526d0){ut[_0xcabd('0x48')](_0xcabd('0x49'),_0x2526d0);})[_0xcabd('0x3e')](function(_0x101adc){ut[_0xcabd('0x48')](_0xcabd('0x4a'),_0x101adc);});}else{ut[_0xcabd('0x48')](_0xcabd('0x4b'));}}Fax[_0xcabd('0x20')][_0xcabd('0x4c')]=function(_0x292e60,_0x530779,_0x48360d){var _0x492823=this;var _0x11a594={};if(_0x530779){_0x11a594={'read':_0x530779};}else{_0x11a594={'failMessage':_0x48360d};}if(this['actions'][_0x292e60][_0xcabd('0x45')]){faxMessage[_0xcabd('0x46')](this[_0xcabd('0xe')][_0x292e60][_0xcabd('0x45')],_0x11a594)[_0xcabd('0x3b')](function(_0x510b9a){ut['logger'](_0xcabd('0x4d'),_0x510b9a);})[_0xcabd('0x3e')](function(_0x87e36b){ut['logger'](_0xcabd('0x4e'),_0x87e36b);})['finally'](function(){delete _0x492823[_0xcabd('0xb')][_0x292e60];delete _0x492823[_0xcabd('0xe')][_0x292e60];});}else{ut['logger'](_0xcabd('0x4f'));delete this[_0xcabd('0xb')][_0x292e60];delete this[_0xcabd('0xe')][_0x292e60];}};Fax[_0xcabd('0x20')]['syncHangup']=function(_0x180870){var _0x49d6b4=this;if(this['channels'][_0x180870['uniqueid']]){if(this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]]){this['channels'][_0x180870[_0xcabd('0x24')]]['id']=this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]]['id'];this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]]['name']=this[_0xcabd('0xe')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x25')];}logger[_0xcabd('0x26')](_0x180870[_0xcabd('0x24')],this[_0xcabd('0xe')][_0x180870['uniqueid']]?_0xcabd('0x50'):_0xcabd('0x51'),JSON[_0xcabd('0x40')](this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]]));if(this[_0xcabd('0xe')][_0x180870['uniqueid']]){if(this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x52')]>0x0&&this['channels'][_0x180870['uniqueid']]['faxstatus']===_0xcabd('0x53')){this[_0xcabd('0x4c')](_0x180870[_0xcabd('0x24')],!![]);}else{this[_0xcabd('0x4c')](_0x180870[_0xcabd('0x24')],![],this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x54')]?_0xcabd('0x55')+this[_0xcabd('0xb')][_0x180870[_0xcabd('0x24')]][_0xcabd('0x54')]:_0xcabd('0x56'));}}}};Fax['prototype']['send']=function(_0x4cff2b){var _0x26c419=this;return new BPromise(function(_0x54adab,_0x27c6dd){_0x26c419[_0xcabd('0x57')](_0x4cff2b,_0x26c419['faxAccounts'][_0x4cff2b[_0xcabd('0x58')]])[_0xcabd('0x3b')](function(_0x25b272){ut[_0xcabd('0x48')](_0xcabd('0x59'),_0x25b272);_0x54adab(ut[_0xcabd('0x37')](_0xcabd('0x5a')));})[_0xcabd('0x3e')](function(_0x27aaa7){ut[_0xcabd('0x48')](_0xcabd('0x5b'),_0x27aaa7);updateStatus(_0x4cff2b);_0x27c6dd(ut[_0xcabd('0x37')](_0xcabd('0x5c')));});});};Fax['prototype'][_0xcabd('0x5d')]=function(_0x3d2eae){var _0x58ee28=this;return new BPromise(function(_0x402b7d,_0x2d6aae){var _0x1ee872=_0x58ee28[_0xcabd('0x5e')](_0x58ee28[_0xcabd('0xc')][_0x3d2eae['FaxAccountId']][_0xcabd('0x5f')],_0x3d2eae);if(_0x1ee872['isValid']){_0x402b7d(ut[_0xcabd('0x37')](_0xcabd('0x60')));}else{_0x2d6aae(ut[_0xcabd('0x37')](_0x1ee872[_0xcabd('0x37')]));}});};function originate(_0xdecf7a,_0x374e06,_0x1067d6){return new BPromise(function(_0x37bb6a,_0x4cf2e1){if(_0x1067d6){var _0x43c857=util['format'](_0xcabd('0x61'),path[_0xcabd('0x38')](_0xdecf7a[_0xcabd('0x62')])[_0xcabd('0x25')],_0xdecf7a[_0xcabd('0x62')]);gs[_0xcabd('0x63')](_0x43c857)['then'](function(){_0xdecf7a[_0xcabd('0x62')]=util['format'](_0xcabd('0x64'),path[_0xcabd('0x38')](_0xdecf7a[_0xcabd('0x62')])[_0xcabd('0x65')],path[_0xcabd('0x38')](_0xdecf7a['path'])[_0xcabd('0x25')]);_0x374e06[_0xcabd('0x66')]=_0xdecf7a[_0xcabd('0x62')];ut[_0xcabd('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0xcabd('0x67')](ut[_0xcabd('0x68')](_0xdecf7a,_0x374e06))['then'](function(_0x187733){_0x37bb6a(_0x187733);})[_0xcabd('0x3e')](function(_0x49a0a0){_0x4cf2e1(_0x49a0a0);});})[_0xcabd('0x3e')](function(_0x3f5612){_0x4cf2e1(_0x3f5612);});}else{ami[_0xcabd('0x67')](ut[_0xcabd('0x68')](_0xdecf7a,_0x374e06))[_0xcabd('0x3b')](function(_0x2cb6f1){_0x37bb6a(_0x2cb6f1);})[_0xcabd('0x3e')](function(_0x14b9aa){_0x4cf2e1(_0x14b9aa);});}});}Fax[_0xcabd('0x20')][_0xcabd('0x57')]=function(_0x28a6cb,_0x84fae1){var _0x527384=this;return new BPromise(function(_0x10406b,_0x22327f){var _0x16a90f=uuid['v4']();var _0x2ba1be=ut[_0xcabd('0x69')](_0x28a6cb,_0x84fae1);_0x527384[_0xcabd('0xe')][_0x16a90f]=new Action(_0x16a90f,_0x84fae1,_0x28a6cb);var _0x3f7d84=_0x527384[_0xcabd('0xe')][_0x16a90f];if(path[_0xcabd('0x38')](_0x28a6cb['path'])['ext']==='.pdf'){originate(_0x3f7d84,_0x2ba1be,!![])['then'](function(_0x1f1465){_0x10406b(_0x1f1465);})[_0xcabd('0x3e')](function(_0x34dfc7){_0x22327f(_0x34dfc7);});}else{originate(_0x3f7d84,_0x2ba1be,![])[_0xcabd('0x3b')](function(_0x15202f){_0x10406b(_0x15202f);})['catch'](function(_0x47da39){_0x22327f(_0x47da39);});}});};Fax[_0xcabd('0x20')][_0xcabd('0x6a')]=function(_0x4b4dd7){return!_[_0xcabd('0x6b')](_0x4b4dd7)&&!_['isNil'](_0x4b4dd7[_0xcabd('0x25')])&&!_['isNil'](_0x4b4dd7[_0xcabd('0x6c')])&&_0x4b4dd7[_0xcabd('0x6c')]&&!_[_0xcabd('0x6b')](this['trunks'][util[_0xcabd('0x6d')](_0xcabd('0x6e'),_0x4b4dd7['name'])])&&!_[_0xcabd('0x6b')](this[_0xcabd('0xd')][util[_0xcabd('0x6d')](_0xcabd('0x6e'),_0x4b4dd7['name'])][_0xcabd('0x2e')])&&(this['trunks'][util[_0xcabd('0x6d')]('SIP/%s',_0x4b4dd7[_0xcabd('0x25')])][_0xcabd('0x2e')]===_0xcabd('0x6f')||this[_0xcabd('0xd')][util['format'](_0xcabd('0x6e'),_0x4b4dd7[_0xcabd('0x25')])]['status']===_0xcabd('0x70'));};Fax['prototype'][_0xcabd('0x5e')]=function(_0x1edfe1,_0x2e525e){if(!this[_0xcabd('0x6a')](_0x1edfe1)){ut[_0xcabd('0x48')](_0xcabd('0x71'),_['isNil'](_0x1edfe1)?'':_0x1edfe1[_0xcabd('0x25')]+_0xcabd('0x72'));return{'isValid':![],'message':_0xcabd('0x73')};}if(_[_0xcabd('0x6b')](_0x2e525e[_0xcabd('0x3d')])){ut[_0xcabd('0x48')](_0xcabd('0x74'),JSON[_0xcabd('0x40')](_0x2e525e));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xcabd('0x6b')](_0x2e525e[_0xcabd('0x62')])){ut[_0xcabd('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xcabd('0x40')](_0x2e525e));return{'isValid':![],'message':_0xcabd('0x75')};}return{'isValid':!![],'message':_0xcabd('0x76')};};module[_0xcabd('0x77')]=Fax; \ No newline at end of file +var _0x5b9b=['\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','name','info','\x20syncNewchannel\x20','uniqueid','prototype','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/'];(function(_0x255fac,_0x205f09){var _0x11512c=function(_0x5d525f){while(--_0x5d525f){_0x255fac['push'](_0x255fac['shift']());}};_0x11512c(++_0x205f09);}(_0x5b9b,0xb4));var _0xb5b9=function(_0x516d64,_0x29545a){_0x516d64=_0x516d64-0x0;var _0x5d9118=_0x5b9b[_0x516d64];return _0x5d9118;};'use strict';var util=require('util');var _=require(_0xb5b9('0x0'));var BPromise=require(_0xb5b9('0x1'));var uuid=require(_0xb5b9('0x2'));var moment=require(_0xb5b9('0x3'));var path=require(_0xb5b9('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xb5b9('0x5'));var logger=require('../../../config/logger')(_0xb5b9('0x6'));var ami=require(_0xb5b9('0x7'));var rpcDb=require(_0xb5b9('0x8'));var Channel=require(_0xb5b9('0x9'));var ut=require(_0xb5b9('0xa'));var Action=require(_0xb5b9('0xb'));var faxAccount=require(_0xb5b9('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0xb5b9('0xd'));function Fax(_0x178433){this[_0xb5b9('0xe')]={};this[_0xb5b9('0xf')]=_0x178433[_0xb5b9('0xf')];this[_0xb5b9('0x10')]=_0x178433[_0xb5b9('0x10')];this[_0xb5b9('0x11')]={};ami['on']('newchannel',this[_0xb5b9('0x12')][_0xb5b9('0x13')](this));ami['on']('varset',this[_0xb5b9('0x14')][_0xb5b9('0x13')](this));ami['on'](_0xb5b9('0x15'),this[_0xb5b9('0x16')][_0xb5b9('0x13')](this));ami['on'](_0xb5b9('0x17'),this[_0xb5b9('0x18')][_0xb5b9('0x13')](this));ami['on'](_0xb5b9('0x19'),this[_0xb5b9('0x1a')][_0xb5b9('0x13')](this));ami['on'](_0xb5b9('0x1b'),this[_0xb5b9('0x1c')][_0xb5b9('0x13')](this));ami['on']('hangup',this[_0xb5b9('0x1d')][_0xb5b9('0x13')](this));ami['on']('originateresponse',this[_0xb5b9('0x1e')][_0xb5b9('0x13')](this));}Fax['prototype'][_0xb5b9('0x12')]=function(_0x29d8e3){if(_0x29d8e3[_0xb5b9('0x1f')]===_0xb5b9('0x20')){for(var _0xd7ed56 in this[_0xb5b9('0xf')]){if(this[_0xb5b9('0xf')][_0xb5b9('0x21')](_0xd7ed56)){if(_0x29d8e3[_0xb5b9('0x22')]===this['faxAccounts'][_0xd7ed56][_0xb5b9('0x23')]){this[_0xb5b9('0xe')][_0x29d8e3['uniqueid']]={};this[_0xb5b9('0xe')][_0x29d8e3['uniqueid']][_0xb5b9('0x24')]=_0x29d8e3[_0xb5b9('0x24')];this['channels'][_0x29d8e3['uniqueid']]['id']=this[_0xb5b9('0xf')][_0xd7ed56]['id'];this[_0xb5b9('0xe')][_0x29d8e3['uniqueid']][_0xb5b9('0x25')]=this['faxAccounts'][_0xd7ed56][_0xb5b9('0x25')];logger[_0xb5b9('0x26')](_0x29d8e3['uniqueid'],_0xb5b9('0x27'));}}}}if(this[_0xb5b9('0x11')][_0x29d8e3[_0xb5b9('0x28')]]){this[_0xb5b9('0xe')][_0x29d8e3[_0xb5b9('0x28')]]={};this[_0xb5b9('0xe')][_0x29d8e3['uniqueid']]['channel']=_0x29d8e3[_0xb5b9('0x24')];logger[_0xb5b9('0x26')](_0x29d8e3[_0xb5b9('0x28')],'\x20syncNewchannel\x20');}};Fax[_0xb5b9('0x29')][_0xb5b9('0x14')]=function(_0x489bac){if(this[_0xb5b9('0xe')][_0x489bac['uniqueid']]){for(var _0x216cc7 in _0x489bac[_0xb5b9('0x2a')]){if(_0x489bac[_0xb5b9('0x2a')][_0xb5b9('0x21')](_0x216cc7)){this['channels'][_0x489bac[_0xb5b9('0x28')]][_0x216cc7]=_0x489bac[_0xb5b9('0x2b')];}}}};Fax['prototype'][_0xb5b9('0x16')]=function(_0x1d01a8){if(this[_0xb5b9('0xe')][_0x1d01a8[_0xb5b9('0x28')]]){this['channels'][_0x1d01a8[_0xb5b9('0x28')]]['channelstate']=_0x1d01a8[_0xb5b9('0x2c')];this[_0xb5b9('0xe')][_0x1d01a8['uniqueid']][_0xb5b9('0x2d')]=_0x1d01a8[_0xb5b9('0x2d')];}};Fax[_0xb5b9('0x29')][_0xb5b9('0x18')]=function(_0x15877d){if(this[_0xb5b9('0xe')][_0x15877d[_0xb5b9('0x28')]]){for(var _0x2cc038 in _0x15877d['variable']){if(_0x15877d['variable']['hasOwnProperty'](_0x2cc038)){this[_0xb5b9('0xe')][_0x15877d[_0xb5b9('0x28')]][_0x2cc038]=_0x15877d[_0xb5b9('0x2b')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x3a912b){if(this[_0xb5b9('0xe')][_0x3a912b[_0xb5b9('0x28')]]){this[_0xb5b9('0xe')][_0x3a912b[_0xb5b9('0x28')]][_0xb5b9('0x2e')]=_0x3a912b[_0xb5b9('0x2e')];this[_0xb5b9('0xe')][_0x3a912b[_0xb5b9('0x28')]][_0xb5b9('0x2f')]=_0x3a912b['status'];this[_0xb5b9('0xe')][_0x3a912b[_0xb5b9('0x28')]]['localstationid']=_0x3a912b[_0xb5b9('0x23')];this['channels'][_0x3a912b[_0xb5b9('0x28')]][_0xb5b9('0x30')]=_0x3a912b[_0xb5b9('0x30')];logger[_0xb5b9('0x26')](_0x3a912b['uniqueid'],_0xb5b9('0x31'));}};Fax[_0xb5b9('0x29')][_0xb5b9('0x1c')]=function(_0xc8317d){var _0x4857dd=this;if(this[_0xb5b9('0xe')][_0xc8317d[_0xb5b9('0x28')]]){var _0x2ccb0c=this[_0xb5b9('0xe')][_0xc8317d[_0xb5b9('0x28')]]['id'];this[_0xb5b9('0xe')][_0xc8317d['uniqueid']]['remotestationid']=_0xc8317d[_0xb5b9('0x32')];this[_0xb5b9('0xe')][_0xc8317d[_0xb5b9('0x28')]][_0xb5b9('0x33')]=_0xc8317d[_0xb5b9('0x33')];this[_0xb5b9('0xe')][_0xc8317d['uniqueid']]['localstationid']=_0xc8317d[_0xb5b9('0x23')];this[_0xb5b9('0xe')][_0xc8317d[_0xb5b9('0x28')]]['resolution']=_0xc8317d[_0xb5b9('0x34')];this['channels'][_0xc8317d[_0xb5b9('0x28')]][_0xb5b9('0x35')]=_0xc8317d[_0xb5b9('0x35')];this['channels'][_0xc8317d['uniqueid']][_0xb5b9('0x30')]=_0xc8317d[_0xb5b9('0x30')];this[_0xb5b9('0xe')][_0xc8317d[_0xb5b9('0x28')]][_0xb5b9('0x36')]=_0xc8317d[_0xb5b9('0x36')];if(this['channels'][_0xc8317d[_0xb5b9('0x28')]]['pagestransferred']>0x0){tiff2pdf(_0xc8317d[_0xb5b9('0x30')],_0xb5b9('0x37'),function(_0x216fd6){logger[_0xb5b9('0x26')](_0xc8317d[_0xb5b9('0x28')],_0xb5b9('0x38'),_0x216fd6[_0xb5b9('0x39')]);attachment[_0xb5b9('0x3a')]({'name':path[_0xb5b9('0x3b')](_0xc8317d['filename'])[_0xb5b9('0x25')],'basename':path[_0xb5b9('0x3b')](_0xc8317d[_0xb5b9('0x30')])[_0xb5b9('0x25')]+_0xb5b9('0x3c'),'type':_0xb5b9('0x3d')})[_0xb5b9('0x3e')](function(_0x43a5b7){faxAccount['notify'](_0x2ccb0c,{'from':_0xc8317d[_0xb5b9('0x36')],'mapKey':'fax','body':path[_0xb5b9('0x3b')](_0xc8317d[_0xb5b9('0x30')])[_0xb5b9('0x25')]+'.pdf','AttachmentId':_0x43a5b7['id']})['catch'](function(_0x15c29e){logger[_0xb5b9('0x3f')](_0xc8317d[_0xb5b9('0x28')],_0xb5b9('0x40'),JSON[_0xb5b9('0x41')](_0x15c29e));});})['catch'](function(_0x5d46b8){logger[_0xb5b9('0x3f')](_0xc8317d[_0xb5b9('0x28')],_0xb5b9('0x42'),JSON['stringify'](_0x5d46b8));});});}logger[_0xb5b9('0x26')](_0xc8317d[_0xb5b9('0x28')],'\x20receiveFax\x20');}};Fax[_0xb5b9('0x29')]['syncOriginateResponse']=function(_0x374e2d){if(this[_0xb5b9('0x11')][_0x374e2d[_0xb5b9('0x28')]]){_[_0xb5b9('0x43')](this[_0xb5b9('0xe')][_0x374e2d['uniqueid']],_[_0xb5b9('0x44')](_0x374e2d,[_0xb5b9('0x45'),'reason']));}};function updateStatus(_0x1d5add){if(_0x1d5add[_0xb5b9('0x46')]){faxMessage[_0xb5b9('0x47')](_0x1d5add['AttachmentId'],{'failMessage':_0xb5b9('0x48')})[_0xb5b9('0x3e')](function(_0x3f4af5){ut[_0xb5b9('0x49')](_0xb5b9('0x4a'),_0x3f4af5);})[_0xb5b9('0x4b')](function(_0x4d702f){ut[_0xb5b9('0x49')](_0xb5b9('0x4c'),_0x4d702f);});}else{ut['logger'](_0xb5b9('0x4d'));}}Fax['prototype'][_0xb5b9('0x4e')]=function(_0x38e873,_0x228a73,_0x3049ec){var _0x558e50=this;var _0x56f0b8={};if(_0x228a73){_0x56f0b8={'read':_0x228a73};}else{_0x56f0b8={'failMessage':_0x3049ec};}if(this['actions'][_0x38e873]['AttachmentId']){faxMessage[_0xb5b9('0x47')](this[_0xb5b9('0x11')][_0x38e873]['AttachmentId'],_0x56f0b8)[_0xb5b9('0x3e')](function(_0x4969cd){ut[_0xb5b9('0x49')]('[Fax][Message][Updated]',_0x4969cd);})['catch'](function(_0x42bd1c){ut[_0xb5b9('0x49')](_0xb5b9('0x4f'),_0x42bd1c);})[_0xb5b9('0x50')](function(){delete _0x558e50[_0xb5b9('0xe')][_0x38e873];delete _0x558e50[_0xb5b9('0x11')][_0x38e873];});}else{ut[_0xb5b9('0x49')](_0xb5b9('0x51'));delete this[_0xb5b9('0xe')][_0x38e873];delete this[_0xb5b9('0x11')][_0x38e873];}};Fax[_0xb5b9('0x29')][_0xb5b9('0x1d')]=function(_0x202c29){var _0x40a139=this;if(this[_0xb5b9('0xe')][_0x202c29[_0xb5b9('0x28')]]){if(this[_0xb5b9('0x11')][_0x202c29[_0xb5b9('0x28')]]){this['channels'][_0x202c29[_0xb5b9('0x28')]]['id']=this[_0xb5b9('0x11')][_0x202c29[_0xb5b9('0x28')]]['id'];this[_0xb5b9('0xe')][_0x202c29['uniqueid']]['name']=this['actions'][_0x202c29[_0xb5b9('0x28')]][_0xb5b9('0x25')];}logger['info'](_0x202c29['uniqueid'],this[_0xb5b9('0x11')][_0x202c29[_0xb5b9('0x28')]]?_0xb5b9('0x52'):_0xb5b9('0x53'),JSON['stringify'](this[_0xb5b9('0xe')][_0x202c29[_0xb5b9('0x28')]]));if(this[_0xb5b9('0x11')][_0x202c29[_0xb5b9('0x28')]]){if(this['channels'][_0x202c29[_0xb5b9('0x28')]]['faxpages']>0x0&&this['channels'][_0x202c29[_0xb5b9('0x28')]][_0xb5b9('0x19')]===_0xb5b9('0x54')){this[_0xb5b9('0x4e')](_0x202c29[_0xb5b9('0x28')],!![]);}else{this[_0xb5b9('0x4e')](_0x202c29[_0xb5b9('0x28')],![],this['channels'][_0x202c29['uniqueid']][_0xb5b9('0x55')]?_0xb5b9('0x56')+this[_0xb5b9('0xe')][_0x202c29[_0xb5b9('0x28')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xb5b9('0x29')][_0xb5b9('0x57')]=function(_0x164044){var _0x1e7d1c=this;return new BPromise(function(_0x4e7843,_0x43f371){_0x1e7d1c[_0xb5b9('0x58')](_0x164044,_0x1e7d1c['faxAccounts'][_0x164044[_0xb5b9('0x59')]])[_0xb5b9('0x3e')](function(_0x407333){ut[_0xb5b9('0x49')](_0xb5b9('0x5a'),_0x407333);_0x4e7843(ut[_0xb5b9('0x39')](_0xb5b9('0x5b')));})[_0xb5b9('0x4b')](function(_0x49015c){ut['logger'](_0xb5b9('0x5c'),_0x49015c);updateStatus(_0x164044);_0x43f371(ut['message'](_0xb5b9('0x5d')));});});};Fax[_0xb5b9('0x29')]['checkAfterSend']=function(_0x5b4e39){var _0x507683=this;return new BPromise(function(_0xc2e641,_0x4f0752){var _0x5bf6f4=_0x507683[_0xb5b9('0x5e')](_0x507683[_0xb5b9('0xf')][_0x5b4e39[_0xb5b9('0x59')]][_0xb5b9('0x5f')],_0x5b4e39);if(_0x5bf6f4[_0xb5b9('0x60')]){_0xc2e641(ut['message'](_0xb5b9('0x61')));}else{_0x4f0752(ut[_0xb5b9('0x39')](_0x5bf6f4[_0xb5b9('0x39')]));}});};function originate(_0x3d2c8c,_0x95df88,_0x7260f2){return new BPromise(function(_0x5c092d,_0x5db838){if(_0x7260f2){var _0x120025=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0xb5b9('0x3b')](_0x3d2c8c['path'])[_0xb5b9('0x25')],_0x3d2c8c[_0xb5b9('0x4')]);gs['execute'](_0x120025)[_0xb5b9('0x3e')](function(){_0x3d2c8c['path']=util['format'](_0xb5b9('0x62'),path['parse'](_0x3d2c8c[_0xb5b9('0x4')])[_0xb5b9('0x63')],path[_0xb5b9('0x3b')](_0x3d2c8c[_0xb5b9('0x4')])[_0xb5b9('0x25')]);_0x95df88[_0xb5b9('0x64')]=_0x3d2c8c[_0xb5b9('0x4')];ut[_0xb5b9('0x49')](_0xb5b9('0x65'),'');ami[_0xb5b9('0x66')](ut['variablesAction'](_0x3d2c8c,_0x95df88))['then'](function(_0x5afebb){_0x5c092d(_0x5afebb);})['catch'](function(_0x3380d3){_0x5db838(_0x3380d3);});})[_0xb5b9('0x4b')](function(_0x4f94c2){_0x5db838(_0x4f94c2);});}else{ami[_0xb5b9('0x66')](ut[_0xb5b9('0x67')](_0x3d2c8c,_0x95df88))[_0xb5b9('0x3e')](function(_0xd0bf2b){_0x5c092d(_0xd0bf2b);})[_0xb5b9('0x4b')](function(_0xe45939){_0x5db838(_0xe45939);});}});}Fax['prototype'][_0xb5b9('0x58')]=function(_0x5ae917,_0x4b805e){var _0x229444=this;return new BPromise(function(_0x4db9ce,_0x569ff8){var _0x316d83=uuid['v4']();var _0x47ec55=ut[_0xb5b9('0x68')](_0x5ae917,_0x4b805e);_0x229444['actions'][_0x316d83]=new Action(_0x316d83,_0x4b805e,_0x5ae917);var _0x267e2f=_0x229444[_0xb5b9('0x11')][_0x316d83];if(path['parse'](_0x5ae917[_0xb5b9('0x4')])[_0xb5b9('0x69')]===_0xb5b9('0x3c')){originate(_0x267e2f,_0x47ec55,!![])[_0xb5b9('0x3e')](function(_0x28ccf0){_0x4db9ce(_0x28ccf0);})[_0xb5b9('0x4b')](function(_0x3e8101){_0x569ff8(_0x3e8101);});}else{originate(_0x267e2f,_0x47ec55,![])[_0xb5b9('0x3e')](function(_0xff173){_0x4db9ce(_0xff173);})[_0xb5b9('0x4b')](function(_0x1bb9df){_0x569ff8(_0x1bb9df);});}});};Fax[_0xb5b9('0x29')][_0xb5b9('0x6a')]=function(_0x132814){return!_[_0xb5b9('0x6b')](_0x132814)&&!_['isNil'](_0x132814[_0xb5b9('0x25')])&&!_['isNil'](_0x132814[_0xb5b9('0x6c')])&&_0x132814[_0xb5b9('0x6c')]&&!_[_0xb5b9('0x6b')](this[_0xb5b9('0x10')][util[_0xb5b9('0x6d')](_0xb5b9('0x6e'),_0x132814[_0xb5b9('0x25')])])&&!_['isNil'](this[_0xb5b9('0x10')][util[_0xb5b9('0x6d')](_0xb5b9('0x6e'),_0x132814[_0xb5b9('0x25')])][_0xb5b9('0x2f')])&&(this[_0xb5b9('0x10')][util[_0xb5b9('0x6d')]('SIP/%s',_0x132814[_0xb5b9('0x25')])][_0xb5b9('0x2f')]===_0xb5b9('0x6f')||this[_0xb5b9('0x10')][util['format'](_0xb5b9('0x6e'),_0x132814[_0xb5b9('0x25')])][_0xb5b9('0x2f')]==='unmonitored');};Fax[_0xb5b9('0x29')][_0xb5b9('0x5e')]=function(_0x44563a,_0x4347fa){if(!this['isTrunkReachable'](_0x44563a)){ut[_0xb5b9('0x49')](_0xb5b9('0x70'),_[_0xb5b9('0x6b')](_0x44563a)?'':_0x44563a[_0xb5b9('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xb5b9('0x71')};}if(_[_0xb5b9('0x6b')](_0x4347fa[_0xb5b9('0x6')])){ut[_0xb5b9('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xb5b9('0x41')](_0x4347fa));return{'isValid':![],'message':_0xb5b9('0x72')};}if(_[_0xb5b9('0x6b')](_0x4347fa['path'])){ut[_0xb5b9('0x49')](_0xb5b9('0x73'),JSON[_0xb5b9('0x41')](_0x4347fa));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xb5b9('0x74')};};module[_0xb5b9('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 2dac162..bc2759e 100644 --- a/server/services/ami/fax/rpcDb.js +++ b/server/services/ami/fax/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9a2=['[Notify]\x20','util','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','then','notify','catch'];(function(_0x366e75,_0x533d1d){var _0x3b167b=function(_0x3e9f1d){while(--_0x3e9f1d){_0x366e75['push'](_0x366e75['shift']());}};_0x3b167b(++_0x533d1d);}(_0xc9a2,0x65));var _0x2c9a=function(_0x30fe9f,_0x6a082d){_0x30fe9f=_0x30fe9f-0x0;var _0x41a82d=_0xc9a2[_0x30fe9f];return _0x41a82d;};'use strict';var util=require(_0x2c9a('0x0'));var BPromise=require(_0x2c9a('0x1'));var logger=require(_0x2c9a('0x2'))(_0x2c9a('0x3'));var _=require('lodash');var faxAccount=require(_0x2c9a('0x4'));function loggerCatch(_0xfd41c5){return function(_0x5d6c5b){logger['error'](_0xfd41c5,util[_0x2c9a('0x5')](_0x5d6c5b,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x26ba9c,_0x48c7d7){return BPromise['resolve']()[_0x2c9a('0x6')](faxAccount[_0x2c9a('0x7')](_0x26ba9c,_0x48c7d7))[_0x2c9a('0x8')](loggerCatch(_0x2c9a('0x9')));}; \ No newline at end of file +var _0xb32d=['notify','resolve','then','util','bluebird','preview','error','inspect'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0xb32d,0xf3));var _0xdb32=function(_0x21cffc,_0x386d53){_0x21cffc=_0x21cffc-0x0;var _0x5818f3=_0xb32d[_0x21cffc];return _0x5818f3;};'use strict';var util=require(_0xdb32('0x0'));var BPromise=require(_0xdb32('0x1'));var logger=require('../../../config/logger')(_0xdb32('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1670bc){return function(_0x58ab8c){logger[_0xdb32('0x3')](_0x1670bc,util[_0xdb32('0x4')](_0x58ab8c,{'showHidden':![],'depth':null}));};}exports[_0xdb32('0x5')]=function(_0x1c816b,_0x5cd645){return BPromise[_0xdb32('0x6')]()[_0xdb32('0x7')](faxAccount[_0xdb32('0x5')](_0x1c816b,_0x5cd645))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d55e9aa..a0d129b 100644 --- a/server/services/ami/fax/util/gs.js +++ b/server/services/ami/fax/util/gs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabcd=['bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xabcd,0x94));var _0xdabc=function(_0x859fb6,_0x59d4d4){_0x859fb6=_0x859fb6-0x0;var _0x2a0b82=_0xabcd[_0x859fb6];return _0x2a0b82;};'use strict';var util=require(_0xdabc('0x0'));var logger=require(_0xdabc('0x1'))('fax');var BPromise=require(_0xdabc('0x2'));var exec=require(_0xdabc('0x3'))[_0xdabc('0x4')];exports[_0xdabc('0x5')]=function(_0x4d1e9d){return new BPromise(function(_0x498349,_0x295754){exec(_0x4d1e9d,function(_0x4493af,_0x508d6e,_0x40654f){logger[_0xdabc('0x6')](_0xdabc('0x7'),_0x508d6e);if(_0x4493af){logger['info']('Exec\x20gs',_0xdabc('0x8'),util[_0xdabc('0x9')](_0x4493af,{'showHidden':![],'depth':null}),_0x508d6e,_0x40654f);_0x295754(_0x4493af);}_0x498349(_0x508d6e);});});}; \ No newline at end of file +var _0xaf71=['execute','info','Exec\x20gs','inspect','util','fax','bluebird','child_process'];(function(_0x5ba8f8,_0x5d7431){var _0x115f0f=function(_0x289a35){while(--_0x289a35){_0x5ba8f8['push'](_0x5ba8f8['shift']());}};_0x115f0f(++_0x5d7431);}(_0xaf71,0x11c));var _0x1af7=function(_0x4024c9,_0x3a6bd4){_0x4024c9=_0x4024c9-0x0;var _0x2e715f=_0xaf71[_0x4024c9];return _0x2e715f;};'use strict';var util=require(_0x1af7('0x0'));var logger=require('../../../../config/logger')(_0x1af7('0x1'));var BPromise=require(_0x1af7('0x2'));var exec=require(_0x1af7('0x3'))['exec'];exports[_0x1af7('0x4')]=function(_0x5de21f){return new BPromise(function(_0x3f4ac0,_0x4179fe){exec(_0x5de21f,function(_0x1fa8ee,_0x237faf,_0x2e48bd){logger[_0x1af7('0x5')](_0x1af7('0x6'),_0x237faf);if(_0x1fa8ee){logger[_0x1af7('0x5')](_0x1af7('0x6'),'\x20Error\x20:',util[_0x1af7('0x7')](_0x1fa8ee,{'showHidden':![],'depth':null}),_0x237faf,_0x2e48bd);_0x4179fe(_0x1fa8ee);}_0x3f4ac0(_0x237faf);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 5ccd3ab..310487b 100644 --- a/server/services/ami/fax/util/util.js +++ b/server/services/ami/fax/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f63=['ecm','headerinfo','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','addVariables'];(function(_0x175273,_0x9deeca){var _0x285273=function(_0x3e142d){while(--_0x3e142d){_0x175273['push'](_0x175273['shift']());}};_0x285273(++_0x9deeca);}(_0x1f63,0x1b2));var _0x31f6=function(_0x8d0f22,_0x303f48){_0x8d0f22=_0x8d0f22-0x0;var _0x312879=_0x1f63[_0x8d0f22];return _0x312879;};'use strict';var util=require(_0x31f6('0x0'));var _=require(_0x31f6('0x1'));var moment=require(_0x31f6('0x2'));var logger=require(_0x31f6('0x3'))(_0x31f6('0x4'));exports[_0x31f6('0x5')]=function(_0x410885){return{'message':_0x410885};};exports['logger']=function(_0x44145a,_0x3bd6be){logger['info'](_0x44145a,util['inspect'](_0x3bd6be,{'showHidden':![],'depth':null}));};exports[_0x31f6('0x6')]=function(_0x687318,_0x234542){var _0x559c9d={'XMF-ECM':_0x234542[_0x31f6('0x7')],'XMF-HEADERINFO':_0x234542[_0x31f6('0x8')],'XMF-MINRATE':_0x234542['minrate'],'XMF-MAXRATE':_0x234542[_0x31f6('0x9')],'XMF-MODEM':util['format'](_0x31f6('0xa'),_0x234542[_0x31f6('0xb')]),'XMF-GATEWAY':_0x234542['gateway'],'XMF-FAXDETECT':_0x234542[_0x31f6('0xc')],'XMF-T38TIMEOUT':_0x234542[_0x31f6('0xd')],'XMF-LOCALSTATIONID':_0x234542[_0x31f6('0xe')],'XMF-PATH':_0x687318['path']};return _0x559c9d;};exports[_0x31f6('0xf')]=function(_0x366eb2,_0x195beb){return{'actionid':_0x366eb2[_0x31f6('0x10')],'action':'originate','channel':_0x366eb2[_0x31f6('0x11')],'Exten':_0x31f6('0x12'),'Context':_0x31f6('0x13'),'Priority':'1','callerid':util['format'](_0x31f6('0x14'),_0x366eb2[_0x31f6('0x8')]?_0x366eb2[_0x31f6('0x8')]:'',_0x366eb2[_0x31f6('0xe')]),'variable':_0x195beb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x366eb2['uniqueid']};}; \ No newline at end of file +var _0xb8cf=['\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','info','addVariables','ecm','minrate','maxrate','format'];(function(_0x262dbc,_0x446266){var _0x111538=function(_0x4e6247){while(--_0x4e6247){_0x262dbc['push'](_0x262dbc['shift']());}};_0x111538(++_0x446266);}(_0xb8cf,0x193));var _0xfb8c=function(_0x34029a,_0x11fe5a){_0x34029a=_0x34029a-0x0;var _0x4d5b98=_0xb8cf[_0x34029a];return _0x4d5b98;};'use strict';var util=require(_0xfb8c('0x0'));var _=require(_0xfb8c('0x1'));var moment=require(_0xfb8c('0x2'));var logger=require(_0xfb8c('0x3'))(_0xfb8c('0x4'));exports[_0xfb8c('0x5')]=function(_0x6f1580){return{'message':_0x6f1580};};exports[_0xfb8c('0x6')]=function(_0xe80a03,_0x211a8c){logger[_0xfb8c('0x7')](_0xe80a03,util['inspect'](_0x211a8c,{'showHidden':![],'depth':null}));};exports[_0xfb8c('0x8')]=function(_0x5d2ad7,_0x4e1a18){var _0x37ce25={'XMF-ECM':_0x4e1a18[_0xfb8c('0x9')],'XMF-HEADERINFO':_0x4e1a18['headerinfo'],'XMF-MINRATE':_0x4e1a18[_0xfb8c('0xa')],'XMF-MAXRATE':_0x4e1a18[_0xfb8c('0xb')],'XMF-MODEM':util[_0xfb8c('0xc')](_0xfb8c('0xd'),_0x4e1a18[_0xfb8c('0xe')]),'XMF-GATEWAY':_0x4e1a18[_0xfb8c('0xf')],'XMF-FAXDETECT':_0x4e1a18[_0xfb8c('0x10')],'XMF-T38TIMEOUT':_0x4e1a18[_0xfb8c('0x11')],'XMF-LOCALSTATIONID':_0x4e1a18[_0xfb8c('0x12')],'XMF-PATH':_0x5d2ad7[_0xfb8c('0x13')]};return _0x37ce25;};exports[_0xfb8c('0x14')]=function(_0x552ef4,_0x2941f7){return{'actionid':_0x552ef4[_0xfb8c('0x15')],'action':_0xfb8c('0x16'),'channel':_0x552ef4['channel'],'Exten':_0xfb8c('0x17'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0xfb8c('0x18'),_0x552ef4[_0xfb8c('0x19')]?_0x552ef4[_0xfb8c('0x19')]:'',_0x552ef4[_0xfb8c('0x12')]),'variable':_0x2941f7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x552ef4['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7a9cafa..7fda131 100644 --- a/server/services/ami/index.js +++ b/server/services/ami/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f2a=['resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x0f2a,0x12e));var _0xa0f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f2a[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0xa0f2('0x0'));var util=require(_0xa0f2('0x1'));var moment=require(_0xa0f2('0x2'));var server=require(_0xa0f2('0x3'));var Realtime=require(_0xa0f2('0x4'));var Report=require(_0xa0f2('0x5'));var Acw=require(_0xa0f2('0x6'));var Trigger=require('./trigger');var Dialer=require(_0xa0f2('0x7'));var Preview=require(_0xa0f2('0x8'));var Fax=require(_0xa0f2('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xa0f2('0xa'));var voiceQueueReport=require(_0xa0f2('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xa0f2('0xc'));var template=require(_0xa0f2('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xa0f2('0xe'));var voiceExtension=require(_0xa0f2('0xf'));var faxAccount=require(_0xa0f2('0x10'));var zendesk=require(_0xa0f2('0x11'));var salesforce=require(_0xa0f2('0x12'));var sugarcrm=require(_0xa0f2('0x13'));var freshdesk=require(_0xa0f2('0x14'));var desk=require(_0xa0f2('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xa0f2('0x16'));var freshsales=require(_0xa0f2('0x17'));var servicenow=require(_0xa0f2('0x18'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xa0f2('0x19'))(_0xa0f2('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa0f2('0x1b')](_0xa0f2('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa0f2('0x1b')](_0xa0f2('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xa0f2('0x1d')](user[_0xa0f2('0x1e')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x1f')]())['then'](user[_0xa0f2('0x20')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x21')]())[_0xa0f2('0x1d')](trunk['getTrunks']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x22')]())['then'](voiceQueue[_0xa0f2('0x23')]())[_0xa0f2('0x1d')](realtime['initVoiceQueues']())[_0xa0f2('0x1d')](trigger[_0xa0f2('0x24')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x25')]())[_0xa0f2('0x1d')](template[_0xa0f2('0x26')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x27')]())[_0xa0f2('0x1d')](zendesk['getZendeskAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x28')]())[_0xa0f2('0x1d')](salesforce['getSalesforceAccounts']())[_0xa0f2('0x1d')](realtime['initSalesforceAccounts']())[_0xa0f2('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x29')]())[_0xa0f2('0x1d')](freshdesk[_0xa0f2('0x2a')]())[_0xa0f2('0x1d')](realtime['initFreshdeskAccounts']())[_0xa0f2('0x1d')](desk[_0xa0f2('0x2b')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2c')]())[_0xa0f2('0x1d')](zoho[_0xa0f2('0x2d')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2e')]())[_0xa0f2('0x1d')](vtiger['getVtigerAccounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x2f')]())[_0xa0f2('0x1d')](freshsales[_0xa0f2('0x30')]())['then'](realtime[_0xa0f2('0x31')]())['then'](servicenow[_0xa0f2('0x32')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x33')]())['then'](dynamics365['getDynamics365Accounts']())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x34')]())[_0xa0f2('0x1d')](campaign[_0xa0f2('0x35')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x36')]())[_0xa0f2('0x1d')](voiceExtension[_0xa0f2('0x37')]())['then'](realtime['initVoiceExtensions']())[_0xa0f2('0x1d')](faxAccount[_0xa0f2('0x38')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x39')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa0f2('0x3a')]()[_0xa0f2('0x1d')](voiceQueueReport[_0xa0f2('0x3b')]())['then'](realtime[_0xa0f2('0x3c')]())['then'](cmHopperHistory[_0xa0f2('0x3d')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x3e')]())[_0xa0f2('0x1d')](cmHopperHistory[_0xa0f2('0x3f')]())[_0xa0f2('0x1d')](realtime[_0xa0f2('0x40')]())[_0xa0f2('0x1d')](voiceCallReport[_0xa0f2('0x41')]())[_0xa0f2('0x1d')](realtime['initVoiceCallReports']())[_0xa0f2('0x42')](function(_0x290991){logger[_0xa0f2('0x43')](_0xa0f2('0x44'),util[_0xa0f2('0x45')](_0x290991,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa0f2('0x46')](realtime,preview,fax)[_0xa0f2('0x1d')](function(_0x24f1ce){return initRealtime();})['then'](function(){return initParams();})[_0xa0f2('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xa0f2('0x42')](function(_0xf74d22){logger[_0xa0f2('0x43')](_0xa0f2('0x47'),util[_0xa0f2('0x45')](_0xf74d22,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xc2f0=['catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports'];(function(_0x18dee5,_0x5f3707){var _0x393b92=function(_0x2394bd){while(--_0x2394bd){_0x18dee5['push'](_0x18dee5['shift']());}};_0x393b92(++_0x5f3707);}(_0xc2f0,0xf4));var _0x0c2f=function(_0x2293f9,_0x539ef6){_0x2293f9=_0x2293f9-0x0;var _0x27514e=_0xc2f0[_0x2293f9];return _0x27514e;};'use strict';var BPromise=require(_0x0c2f('0x0'));var util=require(_0x0c2f('0x1'));var moment=require(_0x0c2f('0x2'));var server=require(_0x0c2f('0x3'));var Realtime=require(_0x0c2f('0x4'));var Report=require(_0x0c2f('0x5'));var Acw=require('./acw');var Trigger=require(_0x0c2f('0x6'));var Dialer=require(_0x0c2f('0x7'));var Preview=require(_0x0c2f('0x8'));var Fax=require(_0x0c2f('0x9'));var user=require(_0x0c2f('0xa'));var voiceQueue=require(_0x0c2f('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0c2f('0xc'));var trunk=require(_0x0c2f('0xd'));var trigger=require(_0x0c2f('0xe'));var template=require(_0x0c2f('0xf'));var cmHopperHistory=require(_0x0c2f('0x10'));var campaign=require(_0x0c2f('0x11'));var voiceExtension=require(_0x0c2f('0x12'));var faxAccount=require(_0x0c2f('0x13'));var zendesk=require(_0x0c2f('0x14'));var salesforce=require(_0x0c2f('0x15'));var sugarcrm=require(_0x0c2f('0x16'));var freshdesk=require(_0x0c2f('0x17'));var desk=require(_0x0c2f('0x18'));var zoho=require(_0x0c2f('0x19'));var vtiger=require(_0x0c2f('0x1a'));var freshsales=require(_0x0c2f('0x1b'));var servicenow=require(_0x0c2f('0x1c'));var dynamics365=require(_0x0c2f('0x1d'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0c2f('0x1e'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0c2f('0x1f')](_0x0c2f('0x20'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0c2f('0x1f')](_0x0c2f('0x20'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x0c2f('0x21')](user[_0x0c2f('0x22')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x23')]())[_0x0c2f('0x21')](user[_0x0c2f('0x24')]())[_0x0c2f('0x21')](realtime['initTelephones']())[_0x0c2f('0x21')](trunk[_0x0c2f('0x25')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x26')]())[_0x0c2f('0x21')](voiceQueue[_0x0c2f('0x27')]())['then'](realtime['initVoiceQueues']())[_0x0c2f('0x21')](trigger[_0x0c2f('0x28')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x29')]())['then'](template[_0x0c2f('0x2a')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x2b')]())[_0x0c2f('0x21')](zendesk[_0x0c2f('0x2c')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x2d')]())[_0x0c2f('0x21')](salesforce[_0x0c2f('0x2e')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x2f')]())[_0x0c2f('0x21')](sugarcrm[_0x0c2f('0x30')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x31')]())[_0x0c2f('0x21')](freshdesk['getFreshdeskAccounts']())[_0x0c2f('0x21')](realtime['initFreshdeskAccounts']())['then'](desk[_0x0c2f('0x32')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x33')]())[_0x0c2f('0x21')](zoho[_0x0c2f('0x34')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x35')]())[_0x0c2f('0x21')](vtiger['getVtigerAccounts']())['then'](realtime[_0x0c2f('0x36')]())['then'](freshsales['getFreshsalesAccounts']())['then'](realtime[_0x0c2f('0x37')]())[_0x0c2f('0x21')](servicenow['getServicenowAccounts']())[_0x0c2f('0x21')](realtime[_0x0c2f('0x38')]())[_0x0c2f('0x21')](dynamics365['getDynamics365Accounts']())[_0x0c2f('0x21')](realtime[_0x0c2f('0x39')]())[_0x0c2f('0x21')](campaign[_0x0c2f('0x3a')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x3b')]())[_0x0c2f('0x21')](voiceExtension[_0x0c2f('0x3c')]())['then'](realtime[_0x0c2f('0x3d')]())[_0x0c2f('0x21')](faxAccount[_0x0c2f('0x3e')]())[_0x0c2f('0x21')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0c2f('0x3f')]()['then'](voiceQueueReport[_0x0c2f('0x40')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x41')]())[_0x0c2f('0x21')](cmHopperHistory[_0x0c2f('0x42')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x43')]())['then'](cmHopperHistory[_0x0c2f('0x44')]())[_0x0c2f('0x21')](realtime[_0x0c2f('0x45')]())[_0x0c2f('0x21')](voiceCallReport[_0x0c2f('0x46')]())['then'](realtime[_0x0c2f('0x47')]())[_0x0c2f('0x48')](function(_0x563b7e){logger[_0x0c2f('0x49')](_0x0c2f('0x4a'),util['inspect'](_0x563b7e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0c2f('0x4b')](realtime,preview,fax)[_0x0c2f('0x21')](function(_0x482696){return initRealtime();})[_0x0c2f('0x21')](function(){return initParams();})[_0x0c2f('0x21')](function(){report[_0x0c2f('0x4c')]();setInterval(initRealtime,0x1388);})[_0x0c2f('0x48')](function(_0x40a2b0){logger[_0x0c2f('0x49')](_0x0c2f('0x4d'),util[_0x0c2f('0x4e')](_0x40a2b0,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 91c8fbb..f6ddc76 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xedd9,0xfc));var _0x9edd=function(_0x21ee3b,_0x4a016f){_0x21ee3b=_0x21ee3b-0x0;var _0x15a46d=_0xedd9[_0x21ee3b];return _0x15a46d;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f4b05,_0x1ea7d7){_0x4f4b05=_0x4f4b05-0x0;var _0xf642bd=_0xedd9[_0x4f4b05];return _0xf642bd;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5d4265e..0ddf5b6 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10a6=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup'];(function(_0x41be5e,_0x179575){var _0x32cdee=function(_0x181214){while(--_0x181214){_0x41be5e['push'](_0x41be5e['shift']());}};_0x32cdee(++_0x179575);}(_0x10a6,0x16d));var _0x610a=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x10a6[_0x17406e];return _0x2bfc5a;};'use strict';function Campaign(_0x372c13){this['id']=_0x372c13['id']||0x0;this[_0x610a('0x0')]=_0x372c13[_0x610a('0x0')]||'';this[_0x610a('0x1')]=_0x372c13['type']||_0x610a('0x2');this[_0x610a('0x3')]=0x0;this[_0x610a('0x4')]=0x0;this[_0x610a('0x5')]=0x0;this[_0x610a('0x6')]=0x0;this[_0x610a('0x7')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x372c13['active'];this[_0x610a('0x8')]=_0x372c13[_0x610a('0x8')];this[_0x610a('0x9')]=_0x372c13[_0x610a('0x9')]||null;this[_0x610a('0xa')]=_0x372c13[_0x610a('0xa')]?_0x372c13[_0x610a('0xa')]:null;this[_0x610a('0xb')]=_0x372c13[_0x610a('0xb')];this[_0x610a('0xc')]=_0x372c13[_0x610a('0xc')];this[_0x610a('0xd')]=_0x372c13[_0x610a('0xd')]||0x1e;this[_0x610a('0xe')]=_0x372c13['dialCongestionMaxRetry'];this[_0x610a('0xf')]=_0x372c13[_0x610a('0xf')];this['dialBusyMaxRetry']=_0x372c13[_0x610a('0x10')];this[_0x610a('0x11')]=_0x372c13[_0x610a('0x11')];this[_0x610a('0x12')]=_0x372c13['dialNoAnswerMaxRetry'];this[_0x610a('0x13')]=_0x372c13['dialNoAnswerRetryFrequency'];this[_0x610a('0x14')]=_0x372c13[_0x610a('0x14')];this['dialNoSuchNumberMaxRetry']=_0x372c13['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x372c13[_0x610a('0x15')]||0x96;this[_0x610a('0x16')]=_0x372c13[_0x610a('0x16')]||0x3;this[_0x610a('0x17')]=_0x372c13['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x372c13[_0x610a('0x18')]||0x3;this[_0x610a('0x19')]=_0x372c13['dialAbandonedRetryFrequency']||0x96;this[_0x610a('0x1a')]=_0x372c13[_0x610a('0x1a')]||0x3;this[_0x610a('0x1b')]=_0x372c13[_0x610a('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x372c13[_0x610a('0x1c')]||0x3;this[_0x610a('0x1d')]=_0x372c13[_0x610a('0x1d')]||0x96;this[_0x610a('0x1e')]=_0x372c13[_0x610a('0x1e')]||_0x610a('0x1f');this[_0x610a('0x20')]=_0x372c13[_0x610a('0x20')]||undefined;this[_0x610a('0x21')]=_0x372c13[_0x610a('0x21')]||undefined;this['dialCutDigit']=_0x372c13['dialCutDigit']||undefined;this['TrunkBackup']=_0x372c13[_0x610a('0x22')]?_0x372c13[_0x610a('0x22')]:undefined;this[_0x610a('0x23')]=_0x372c13[_0x610a('0x23')]?_0x372c13['Trunk']:undefined;this['Interval']=_0x372c13[_0x610a('0x24')]?_0x372c13[_0x610a('0x24')]:undefined;this[_0x610a('0x25')]=_0x372c13[_0x610a('0x25')]?_0x372c13['SquareProject']:undefined;this[_0x610a('0x26')]=_0x372c13[_0x610a('0x25')]?_0x372c13['SquareProject']['name']:undefined;this['dialAMDActive']=_0x372c13[_0x610a('0x27')]||![];this['dialAMDInitialSilence']=_0x372c13[_0x610a('0x28')];this[_0x610a('0x29')]=_0x372c13['dialAMDGreeting'];this[_0x610a('0x2a')]=_0x372c13[_0x610a('0x2a')];this['dialAMDTotalAnalysisTime']=_0x372c13[_0x610a('0x2b')];this[_0x610a('0x2c')]=_0x372c13[_0x610a('0x2c')];this[_0x610a('0x2d')]=_0x372c13[_0x610a('0x2d')];this[_0x610a('0x2e')]=_0x372c13[_0x610a('0x2e')];this[_0x610a('0x2f')]=_0x372c13[_0x610a('0x2f')];this[_0x610a('0x30')]=_0x372c13[_0x610a('0x30')];}module[_0x610a('0x31')]=Campaign; \ No newline at end of file +var _0xdb16=['dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency'];(function(_0xa19dc4,_0x2f4f98){var _0x5d3484=function(_0xc8c170){while(--_0xc8c170){_0xa19dc4['push'](_0xa19dc4['shift']());}};_0x5d3484(++_0x2f4f98);}(_0xdb16,0x1ab));var _0x6db1=function(_0x4a232c,_0x4db76b){_0x4a232c=_0x4a232c-0x0;var _0xb5807f=_0xdb16[_0x4a232c];return _0xb5807f;};'use strict';function Campaign(_0x4ffacc){this['id']=_0x4ffacc['id']||0x0;this[_0x6db1('0x0')]=_0x4ffacc[_0x6db1('0x0')]||'';this['type']=_0x4ffacc[_0x6db1('0x1')]||_0x6db1('0x2');this[_0x6db1('0x3')]=0x0;this[_0x6db1('0x4')]=0x0;this[_0x6db1('0x5')]=0x0;this[_0x6db1('0x6')]=0x0;this[_0x6db1('0x7')]='';this[_0x6db1('0x8')]=!![];this[_0x6db1('0x9')]=_0x4ffacc['active'];this['limitCalls']=_0x4ffacc[_0x6db1('0xa')];this[_0x6db1('0xb')]=_0x4ffacc[_0x6db1('0xb')]||null;this[_0x6db1('0xc')]=_0x4ffacc[_0x6db1('0xc')]?_0x4ffacc[_0x6db1('0xc')]:null;this[_0x6db1('0xd')]=_0x4ffacc[_0x6db1('0xd')];this[_0x6db1('0xe')]=_0x4ffacc[_0x6db1('0xe')];this[_0x6db1('0xf')]=_0x4ffacc[_0x6db1('0xf')]||0x1e;this['dialCongestionMaxRetry']=_0x4ffacc[_0x6db1('0x10')];this[_0x6db1('0x11')]=_0x4ffacc['dialCongestionRetryFrequency'];this[_0x6db1('0x12')]=_0x4ffacc[_0x6db1('0x12')];this['dialBusyRetryFrequency']=_0x4ffacc[_0x6db1('0x13')];this[_0x6db1('0x14')]=_0x4ffacc[_0x6db1('0x14')];this['dialNoAnswerRetryFrequency']=_0x4ffacc[_0x6db1('0x15')];this[_0x6db1('0x16')]=_0x4ffacc[_0x6db1('0x16')];this[_0x6db1('0x17')]=_0x4ffacc['dialNoSuchNumberMaxRetry']||0x3;this[_0x6db1('0x18')]=_0x4ffacc['dialNoSuchNumberRetryFrequency']||0x96;this[_0x6db1('0x19')]=_0x4ffacc[_0x6db1('0x19')]||0x3;this[_0x6db1('0x1a')]=_0x4ffacc[_0x6db1('0x1a')]||0x96;this[_0x6db1('0x1b')]=_0x4ffacc[_0x6db1('0x1b')]||0x3;this[_0x6db1('0x1c')]=_0x4ffacc[_0x6db1('0x1c')]||0x96;this['dialMachineMaxRetry']=_0x4ffacc['dialMachineMaxRetry']||0x3;this[_0x6db1('0x1d')]=_0x4ffacc[_0x6db1('0x1d')]||0x96;this[_0x6db1('0x1e')]=_0x4ffacc[_0x6db1('0x1e')]||0x3;this[_0x6db1('0x1f')]=_0x4ffacc[_0x6db1('0x1f')]||0x96;this['dialOrderByScheduledAt']=_0x4ffacc[_0x6db1('0x20')]||_0x6db1('0x21');this[_0x6db1('0x22')]=_0x4ffacc[_0x6db1('0x22')]||undefined;this[_0x6db1('0x23')]=_0x4ffacc[_0x6db1('0x23')]||undefined;this['dialCutDigit']=_0x4ffacc['dialCutDigit']||undefined;this[_0x6db1('0x24')]=_0x4ffacc[_0x6db1('0x24')]?_0x4ffacc['TrunkBackup']:undefined;this['Trunk']=_0x4ffacc['Trunk']?_0x4ffacc[_0x6db1('0x25')]:undefined;this[_0x6db1('0x26')]=_0x4ffacc[_0x6db1('0x26')]?_0x4ffacc[_0x6db1('0x26')]:undefined;this['SquareProject']=_0x4ffacc[_0x6db1('0x27')]?_0x4ffacc[_0x6db1('0x27')]:undefined;this[_0x6db1('0x28')]=_0x4ffacc[_0x6db1('0x27')]?_0x4ffacc['SquareProject'][_0x6db1('0x0')]:undefined;this[_0x6db1('0x29')]=_0x4ffacc[_0x6db1('0x29')]||![];this[_0x6db1('0x2a')]=_0x4ffacc[_0x6db1('0x2a')];this[_0x6db1('0x2b')]=_0x4ffacc['dialAMDGreeting'];this[_0x6db1('0x2c')]=_0x4ffacc[_0x6db1('0x2c')];this[_0x6db1('0x2d')]=_0x4ffacc[_0x6db1('0x2d')];this[_0x6db1('0x2e')]=_0x4ffacc[_0x6db1('0x2e')];this[_0x6db1('0x2f')]=_0x4ffacc['dialAMDBetweenWordsSilence'];this[_0x6db1('0x30')]=_0x4ffacc[_0x6db1('0x30')];this[_0x6db1('0x31')]=_0x4ffacc[_0x6db1('0x31')];this[_0x6db1('0x32')]=_0x4ffacc['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e8a1d6a..8b3772c 100644 --- a/server/services/ami/model/channel.js +++ b/server/services/ami/model/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f48=['abandoned','lastapplication','lastdata','duration','holdtime','type','tag','queue','monitors','transfercalleridnum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','linkedid','answered','answertime','endtime','unmanaged'];(function(_0x332065,_0x1e6002){var _0x5ee81a=function(_0x6519d3){while(--_0x6519d3){_0x332065['push'](_0x332065['shift']());}};_0x5ee81a(++_0x1e6002);}(_0x3f48,0x17c));var _0x83f4=function(_0x2f296e,_0x117ffc){_0x2f296e=_0x2f296e-0x0;var _0x2c7a92=_0x3f48[_0x2f296e];return _0x2c7a92;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x83f4('0x0')]='';this[_0x83f4('0x1')]=0x0;this[_0x83f4('0x2')]='';this[_0x83f4('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x83f4('0x4')]=0x0;this[_0x83f4('0x5')]='';this['uniqueid']=0x0;this[_0x83f4('0x6')]=0x0;this['exten']=0x0;this[_0x83f4('0x7')]=![];this[_0x83f4('0x8')]=null;this[_0x83f4('0x9')]=null;this[_0x83f4('0xa')]=![];this[_0x83f4('0xb')]=![];this[_0x83f4('0xc')]='';this[_0x83f4('0xd')]='';this[_0x83f4('0xe')]=0x0;this['billableseconds']=0x0;this[_0x83f4('0xf')]=0x0;this[_0x83f4('0x10')]=null;this[_0x83f4('0x11')]=null;this['disposition']=null;this['monitor']=![];this['monitorFilename']=null;this[_0x83f4('0x12')]=null;this[_0x83f4('0x13')]=[];this[_0x83f4('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x83f4('0x15')]=undefined;this[_0x83f4('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x5453=['connectedlinenum','connectedlinename','uniqueid','linkedid','answered','endtime','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x5453,0x18b));var _0x3545=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5453[_0x138adb];return _0x1b27f2;};'use strict';function Channel(){this[_0x3545('0x0')]=null;this[_0x3545('0x1')]='';this[_0x3545('0x2')]='';this[_0x3545('0x3')]=0x0;this[_0x3545('0x4')]='';this[_0x3545('0x5')]=undefined;this[_0x3545('0x6')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x3545('0x7')]=0x0;this[_0x3545('0x8')]=0x0;this['exten']=0x0;this[_0x3545('0x9')]=![];this['answertime']=null;this[_0x3545('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x3545('0xb')]='';this[_0x3545('0xc')]='';this[_0x3545('0xd')]=0x0;this['billableseconds']=0x0;this[_0x3545('0xe')]=0x0;this[_0x3545('0xf')]=null;this[_0x3545('0x10')]=null;this[_0x3545('0x11')]=null;this[_0x3545('0x12')]=![];this[_0x3545('0x13')]=null;this[_0x3545('0x14')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x3545('0x15')]=undefined;this[_0x3545('0x16')]=undefined;this[_0x3545('0x17')]=0x0;}module[_0x3545('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f44c588..5d51b4f 100644 --- a/server/services/ami/model/deskAccount.js +++ b/server/services/ami/model/deskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca45=['Configurations','exports','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x2d0b4c,_0x10499f){var _0x1649af=function(_0x1256b3){while(--_0x1256b3){_0x2d0b4c['push'](_0x2d0b4c['shift']());}};_0x1649af(++_0x10499f);}(_0xca45,0x106));var _0x5ca4=function(_0x2384bb,_0x39682f){_0x2384bb=_0x2384bb-0x0;var _0x299201=_0xca45[_0x2384bb];return _0x299201;};'use strict';function DeskAccount(_0xebf9e5){this['id']=_0xebf9e5['id']||0x0;this['name']=_0xebf9e5['name']||'';this['username']=_0xebf9e5['username']||'';this[_0x5ca4('0x0')]=_0xebf9e5[_0x5ca4('0x0')]||'';this[_0x5ca4('0x1')]=_0xebf9e5[_0x5ca4('0x1')]||'';this[_0x5ca4('0x2')]=_0xebf9e5['password']||'';this['consumerKey']=_0xebf9e5['consumerKey']||'';this[_0x5ca4('0x3')]=_0xebf9e5[_0x5ca4('0x3')]||'';this[_0x5ca4('0x4')]=_0xebf9e5['token']||'';this[_0x5ca4('0x5')]=_0xebf9e5[_0x5ca4('0x5')]||'';this[_0x5ca4('0x6')]=_0xebf9e5[_0x5ca4('0x6')]||'';this[_0x5ca4('0x7')]=_0xebf9e5[_0x5ca4('0x7')]||'';this[_0x5ca4('0x8')]=_0xebf9e5[_0x5ca4('0x8')]||{};}module[_0x5ca4('0x9')]=DeskAccount; \ No newline at end of file +var _0xf433=['consumerSecret','token','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xf433,0xaa));var _0x3f43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf433[_0x2641f9];return _0x585741;};'use strict';function DeskAccount(_0x1c0a56){this['id']=_0x1c0a56['id']||0x0;this[_0x3f43('0x0')]=_0x1c0a56[_0x3f43('0x0')]||'';this[_0x3f43('0x1')]=_0x1c0a56[_0x3f43('0x1')]||'';this[_0x3f43('0x2')]=_0x1c0a56[_0x3f43('0x2')]||'';this[_0x3f43('0x3')]=_0x1c0a56['authType']||'';this[_0x3f43('0x4')]=_0x1c0a56['password']||'';this[_0x3f43('0x5')]=_0x1c0a56[_0x3f43('0x5')]||'';this[_0x3f43('0x6')]=_0x1c0a56[_0x3f43('0x6')]||'';this[_0x3f43('0x7')]=_0x1c0a56[_0x3f43('0x7')]||'';this['tokenSecret']=_0x1c0a56['tokenSecret']||'';this[_0x3f43('0x8')]=_0x1c0a56[_0x3f43('0x8')]||'';this[_0x3f43('0x9')]=_0x1c0a56['serverUrl']||'';this[_0x3f43('0xa')]=_0x1c0a56[_0x3f43('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 65537fe..0813f7f 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ae0=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations'];(function(_0x394fa5,_0x2195ab){var _0x260050=function(_0x12b112){while(--_0x12b112){_0x394fa5['push'](_0x394fa5['shift']());}};_0x260050(++_0x2195ab);}(_0x9ae0,0x18e));var _0x09ae=function(_0x29b186,_0x315a92){_0x29b186=_0x29b186-0x0;var _0x48fbc7=_0x9ae0[_0x29b186];return _0x48fbc7;};'use strict';function Dynamics365Account(_0x5d023c){this['id']=_0x5d023c['id']||0x0;this[_0x09ae('0x0')]=_0x5d023c[_0x09ae('0x0')]||'';this['username']=_0x5d023c[_0x09ae('0x1')]||'';this[_0x09ae('0x2')]=_0x5d023c[_0x09ae('0x2')]||'';this[_0x09ae('0x3')]=_0x5d023c[_0x09ae('0x3')]||'';this[_0x09ae('0x4')]=_0x5d023c['tenantId']||'';this[_0x09ae('0x5')]=_0x5d023c[_0x09ae('0x5')]||'';this['clientSecret']=_0x5d023c[_0x09ae('0x6')]||{};this['serverUrl']=_0x5d023c['serverUrl']||'';this[_0x09ae('0x7')]=_0x5d023c[_0x09ae('0x7')]||![];this[_0x09ae('0x8')]=_0x5d023c['Configurations']||{};this['CloudProvider']=_0x5d023c[_0x09ae('0x9')]||{};}module[_0x09ae('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x882b=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x2dc32a,_0x4a4cf5){var _0x2931e9=function(_0x11eb47){while(--_0x11eb47){_0x2dc32a['push'](_0x2dc32a['shift']());}};_0x2931e9(++_0x4a4cf5);}(_0x882b,0x138));var _0xb882=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x882b[_0x3bf83f];return _0x22c4a9;};'use strict';function Dynamics365Account(_0x519a61){this['id']=_0x519a61['id']||0x0;this[_0xb882('0x0')]=_0x519a61['name']||'';this[_0xb882('0x1')]=_0x519a61['username']||'';this[_0xb882('0x2')]=_0x519a61[_0xb882('0x2')]||'';this[_0xb882('0x3')]=_0x519a61[_0xb882('0x3')]||'';this[_0xb882('0x4')]=_0x519a61[_0xb882('0x4')]||'';this[_0xb882('0x5')]=_0x519a61['clientId']||'';this['clientSecret']=_0x519a61[_0xb882('0x6')]||{};this[_0xb882('0x7')]=_0x519a61[_0xb882('0x7')]||'';this[_0xb882('0x8')]=_0x519a61[_0xb882('0x8')]||![];this[_0xb882('0x9')]=_0x519a61[_0xb882('0x9')]||{};this[_0xb882('0xa')]=_0x519a61[_0xb882('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index faa1c20..09d7084 100644 --- a/server/services/ami/model/faxAccount.js +++ b/server/services/ami/model/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a65=['description','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x6a65,0x1a3));var _0x56a6=function(_0x1954b9,_0x1842aa){_0x1954b9=_0x1954b9-0x0;var _0x461e41=_0x6a65[_0x1954b9];return _0x461e41;};'use strict';function FaxAccount(_0x30c9fa){this['id']=_0x30c9fa['id']||0x0;this[_0x56a6('0x0')]=_0x30c9fa[_0x56a6('0x0')]||'';this[_0x56a6('0x1')]=_0x30c9fa[_0x56a6('0x1')];this['ecm']=_0x30c9fa['ecm'];this[_0x56a6('0x2')]=_0x30c9fa['headerinfo'];this[_0x56a6('0x3')]=_0x30c9fa['localstationid'];this[_0x56a6('0x4')]=_0x30c9fa[_0x56a6('0x4')]||0x960;this[_0x56a6('0x5')]=_0x30c9fa['maxrate']||0x3840;this['modem']=_0x30c9fa['modem']||'v17,v27,v29';this[_0x56a6('0x6')]=_0x30c9fa[_0x56a6('0x6')]||'no';this[_0x56a6('0x7')]=_0x30c9fa['faxdetect']||'no';this[_0x56a6('0x8')]=_0x30c9fa[_0x56a6('0x8')]||0x1388;this['tech']=_0x30c9fa[_0x56a6('0x9')]||_0x56a6('0xa');this['Trunk']=_0x30c9fa[_0x56a6('0xb')]?_0x30c9fa[_0x56a6('0xb')]:undefined;this['ListId']=_0x30c9fa[_0x56a6('0xc')];this[_0x56a6('0xd')]=_0x30c9fa['key'];}module[_0x56a6('0xe')]=FaxAccount; \ No newline at end of file +var _0xadfa=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0xadfa,0x65));var _0xaadf=function(_0x648ede,_0x46bf5b){_0x648ede=_0x648ede-0x0;var _0x47dc8a=_0xadfa[_0x648ede];return _0x47dc8a;};'use strict';function FaxAccount(_0x2e8727){this['id']=_0x2e8727['id']||0x0;this[_0xaadf('0x0')]=_0x2e8727['name']||'';this[_0xaadf('0x1')]=_0x2e8727[_0xaadf('0x1')];this['ecm']=_0x2e8727[_0xaadf('0x2')];this['headerinfo']=_0x2e8727[_0xaadf('0x3')];this['localstationid']=_0x2e8727['localstationid'];this[_0xaadf('0x4')]=_0x2e8727[_0xaadf('0x4')]||0x960;this['maxrate']=_0x2e8727[_0xaadf('0x5')]||0x3840;this[_0xaadf('0x6')]=_0x2e8727['modem']||'v17,v27,v29';this[_0xaadf('0x7')]=_0x2e8727['gateway']||'no';this['faxdetect']=_0x2e8727[_0xaadf('0x8')]||'no';this[_0xaadf('0x9')]=_0x2e8727[_0xaadf('0x9')]||0x1388;this[_0xaadf('0xa')]=_0x2e8727[_0xaadf('0xa')]||_0xaadf('0xb');this[_0xaadf('0xc')]=_0x2e8727[_0xaadf('0xc')]?_0x2e8727['Trunk']:undefined;this[_0xaadf('0xd')]=_0x2e8727[_0xaadf('0xd')];this[_0xaadf('0xe')]=_0x2e8727[_0xaadf('0xe')];}module[_0xaadf('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 2d3b189..c037dbf 100644 --- a/server/services/ami/model/freshdeskAccount.js +++ b/server/services/ami/model/freshdeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x468c=['apiKey','remoteUri','serverUrl','Configurations','name','username'];(function(_0x4ca0bf,_0x27eb4d){var _0x2b26b6=function(_0x109643){while(--_0x109643){_0x4ca0bf['push'](_0x4ca0bf['shift']());}};_0x2b26b6(++_0x27eb4d);}(_0x468c,0x112));var _0xc468=function(_0xd47916,_0x4be2a2){_0xd47916=_0xd47916-0x0;var _0x30759c=_0x468c[_0xd47916];return _0x30759c;};'use strict';function FreshdeskAccount(_0x56b37b){this['id']=_0x56b37b['id']||0x0;this[_0xc468('0x0')]=_0x56b37b[_0xc468('0x0')]||'';this[_0xc468('0x1')]=_0x56b37b['username']||'';this[_0xc468('0x2')]=_0x56b37b['token']||'';this[_0xc468('0x3')]=_0x56b37b[_0xc468('0x3')]||'';this[_0xc468('0x4')]=_0x56b37b[_0xc468('0x4')]||'';this[_0xc468('0x5')]=_0x56b37b[_0xc468('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xe6bf=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0xe6bf,0x156));var _0xfe6b=function(_0x36a217,_0x4a7a90){_0x36a217=_0x36a217-0x0;var _0x186433=_0xe6bf[_0x36a217];return _0x186433;};'use strict';function FreshdeskAccount(_0x67b70a){this['id']=_0x67b70a['id']||0x0;this[_0xfe6b('0x0')]=_0x67b70a['name']||'';this[_0xfe6b('0x1')]=_0x67b70a['username']||'';this['apiKey']=_0x67b70a[_0xfe6b('0x2')]||'';this[_0xfe6b('0x3')]=_0x67b70a[_0xfe6b('0x3')]||'';this['serverUrl']=_0x67b70a[_0xfe6b('0x4')]||'';this['Configurations']=_0x67b70a[_0xfe6b('0x5')]||{};}module[_0xfe6b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8d3a435..a1f6120 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5301=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3aa98c,_0x574cb6){var _0x49e505=function(_0x4de8dd){while(--_0x4de8dd){_0x3aa98c['push'](_0x3aa98c['shift']());}};_0x49e505(++_0x574cb6);}(_0x5301,0x157));var _0x1530=function(_0x571b72,_0x5168e2){_0x571b72=_0x571b72-0x0;var _0x33a2ab=_0x5301[_0x571b72];return _0x33a2ab;};'use strict';function FreshsalesAccount(_0x3b2e8f){this['id']=_0x3b2e8f['id']||0x0;this[_0x1530('0x0')]=_0x3b2e8f[_0x1530('0x0')]||'';this[_0x1530('0x1')]=_0x3b2e8f[_0x1530('0x1')]||'';this[_0x1530('0x2')]=_0x3b2e8f['token']||'';this[_0x1530('0x3')]=_0x3b2e8f[_0x1530('0x3')]||'';this[_0x1530('0x4')]=_0x3b2e8f[_0x1530('0x4')]||'';this['Configurations']=_0x3b2e8f[_0x1530('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xaeab=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x3b477d,_0x4495f9){var _0x45d4eb=function(_0x5a0c2b){while(--_0x5a0c2b){_0x3b477d['push'](_0x3b477d['shift']());}};_0x45d4eb(++_0x4495f9);}(_0xaeab,0x91));var _0xbaea=function(_0x5c09be,_0x539277){_0x5c09be=_0x5c09be-0x0;var _0xd0444b=_0xaeab[_0x5c09be];return _0xd0444b;};'use strict';function FreshsalesAccount(_0x262a54){this['id']=_0x262a54['id']||0x0;this['name']=_0x262a54[_0xbaea('0x0')]||'';this['username']=_0x262a54[_0xbaea('0x1')]||'';this[_0xbaea('0x2')]=_0x262a54[_0xbaea('0x3')]||'';this[_0xbaea('0x4')]=_0x262a54[_0xbaea('0x4')]||'';this[_0xbaea('0x5')]=_0x262a54[_0xbaea('0x5')]||'';this[_0xbaea('0x6')]=_0x262a54[_0xbaea('0x6')]||{};}module[_0xbaea('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b0b7a29..f02db2a 100644 --- a/server/services/ami/model/queueReport.js +++ b/server/services/ami/model/queueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49be=['motionChannel','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','holdtime','assigned','lastAssignedTo'];(function(_0x290fb9,_0xbc4966){var _0x289d53=function(_0x47eb0a){while(--_0x47eb0a){_0x290fb9['push'](_0x290fb9['shift']());}};_0x289d53(++_0xbc4966);}(_0x49be,0xe6));var _0xe49b=function(_0x4880fd,_0x2cc70d){_0x4880fd=_0x4880fd-0x0;var _0x4a4b50=_0x49be[_0x4880fd];return _0x4a4b50;};'use strict';function QueueReport(){this[_0xe49b('0x0')]='inbound';this[_0xe49b('0x1')]='';this[_0xe49b('0x2')]='';this[_0xe49b('0x3')]='';this[_0xe49b('0x4')]='';this[_0xe49b('0x5')]=null;this[_0xe49b('0x6')]=null;this['position']=0x1;this[_0xe49b('0x7')]=0x1;this[_0xe49b('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xe49b('0x9')]=![];this[_0xe49b('0xa')]=null;this[_0xe49b('0xb')]=![];this[_0xe49b('0xc')]=null;this['originalposition']=0x1;this[_0xe49b('0xd')]='';this[_0xe49b('0xe')]='';this[_0xe49b('0xf')]='';this[_0xe49b('0x10')]='';this['context']='';this['exten']='';this['priority']='';this[_0xe49b('0x11')]=0x0;this[_0xe49b('0x12')]=![];this[_0xe49b('0x13')]='';this[_0xe49b('0x14')]=_0xe49b('0x15');this[_0xe49b('0x16')]=0x0;this[_0xe49b('0x17')]={};}module[_0xe49b('0x18')]=QueueReport; \ No newline at end of file +var _0x5498=['assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority'];(function(_0x33c083,_0x2d6075){var _0x40cfbf=function(_0x495ee7){while(--_0x495ee7){_0x33c083['push'](_0x33c083['shift']());}};_0x40cfbf(++_0x2d6075);}(_0x5498,0x1e1));var _0x8549=function(_0x2f9c1d,_0x29fe7b){_0x2f9c1d=_0x2f9c1d-0x0;var _0x22e2b4=_0x5498[_0x2f9c1d];return _0x22e2b4;};'use strict';function QueueReport(){this[_0x8549('0x0')]='inbound';this[_0x8549('0x1')]='';this['calleridnum']='';this[_0x8549('0x2')]='';this['queue']='';this[_0x8549('0x3')]=null;this[_0x8549('0x4')]=null;this[_0x8549('0x5')]=0x1;this[_0x8549('0x6')]=0x1;this[_0x8549('0x7')]=![];this[_0x8549('0x8')]=null;this[_0x8549('0x9')]=![];this['queuecallercompleteAt']=null;this[_0x8549('0xa')]=![];this[_0x8549('0xb')]=null;this[_0x8549('0xc')]=0x1;this['channel']='';this[_0x8549('0xd')]='';this[_0x8549('0xe')]='';this[_0x8549('0xf')]='';this[_0x8549('0x10')]='';this[_0x8549('0x11')]='';this[_0x8549('0x12')]='';this['holdtime']=0x0;this[_0x8549('0x13')]=![];this[_0x8549('0x14')]='';this[_0x8549('0x15')]=_0x8549('0x16');this[_0x8549('0x17')]=0x0;this['variables']={};}module[_0x8549('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 96d8b7e..087164f 100644 --- a/server/services/ami/model/salesforceAccount.js +++ b/server/services/ami/model/salesforceAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f15=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','remoteUri','password'];(function(_0x17fd72,_0x2b8254){var _0xa8d8c6=function(_0x12bb6d){while(--_0x12bb6d){_0x17fd72['push'](_0x17fd72['shift']());}};_0xa8d8c6(++_0x2b8254);}(_0x3f15,0xb1));var _0x53f1=function(_0x2b79b3,_0xe85375){_0x2b79b3=_0x2b79b3-0x0;var _0x286535=_0x3f15[_0x2b79b3];return _0x286535;};'use strict';function SalesforceAccount(_0x4e0e33){this['id']=_0x4e0e33['id']||0x0;this[_0x53f1('0x0')]=_0x4e0e33[_0x53f1('0x0')]||'';this['username']=_0x4e0e33['username']||'';this[_0x53f1('0x1')]=_0x4e0e33[_0x53f1('0x1')]||'';this[_0x53f1('0x2')]=_0x4e0e33['password']||'';this['clientId']=_0x4e0e33[_0x53f1('0x3')]||'';this[_0x53f1('0x4')]=_0x4e0e33[_0x53f1('0x4')]||'';this[_0x53f1('0x5')]=_0x4e0e33['securityToken']||'';this[_0x53f1('0x6')]=_0x4e0e33[_0x53f1('0x6')]||_0x53f1('0x7');this[_0x53f1('0x8')]=_0x4e0e33[_0x53f1('0x8')]||'';this[_0x53f1('0x9')]=_0x4e0e33['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xe172=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x3db2c1,_0x36bd86){var _0x5257d9=function(_0x58e47e){while(--_0x58e47e){_0x3db2c1['push'](_0x3db2c1['shift']());}};_0x5257d9(++_0x36bd86);}(_0xe172,0x1bb));var _0x2e17=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xe172[_0x1928c9];return _0x51b5fb;};'use strict';function SalesforceAccount(_0x457207){this['id']=_0x457207['id']||0x0;this[_0x2e17('0x0')]=_0x457207['name']||'';this[_0x2e17('0x1')]=_0x457207[_0x2e17('0x1')]||'';this['remoteUri']=_0x457207[_0x2e17('0x2')]||'';this['password']=_0x457207[_0x2e17('0x3')]||'';this[_0x2e17('0x4')]=_0x457207[_0x2e17('0x4')]||'';this['clientSecret']=_0x457207['clientSecret']||'';this[_0x2e17('0x5')]=_0x457207[_0x2e17('0x5')]||'';this[_0x2e17('0x6')]=_0x457207[_0x2e17('0x6')]||_0x2e17('0x7');this[_0x2e17('0x8')]=_0x457207[_0x2e17('0x8')]||'';this[_0x2e17('0x9')]=_0x457207[_0x2e17('0x9')]||{};}module[_0x2e17('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index c8141eb..9eeafb2 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb620=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x246bc7,_0x207252){var _0x5afeb3=function(_0x34d4e5){while(--_0x34d4e5){_0x246bc7['push'](_0x246bc7['shift']());}};_0x5afeb3(++_0x207252);}(_0xb620,0x1c4));var _0x0b62=function(_0xfe9d7b,_0x51a835){_0xfe9d7b=_0xfe9d7b-0x0;var _0x3ded09=_0xb620[_0xfe9d7b];return _0x3ded09;};'use strict';function ServicenowAccount(_0x2db809){this['id']=_0x2db809['id']||0x0;this[_0x0b62('0x0')]=_0x2db809[_0x0b62('0x0')]||'';this[_0x0b62('0x1')]=_0x2db809[_0x0b62('0x1')]||'';this[_0x0b62('0x2')]=_0x2db809[_0x0b62('0x2')]||'';this[_0x0b62('0x3')]=_0x2db809['remoteUri']||'';this[_0x0b62('0x4')]=_0x2db809[_0x0b62('0x4')]||'';this['Configurations']=_0x2db809[_0x0b62('0x5')]||{};}module[_0x0b62('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4eac=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x4eac,0x141));var _0xc4ea=function(_0x8c20e5,_0x9f427f){_0x8c20e5=_0x8c20e5-0x0;var _0x3b524d=_0x4eac[_0x8c20e5];return _0x3b524d;};'use strict';function ServicenowAccount(_0x1f424a){this['id']=_0x1f424a['id']||0x0;this[_0xc4ea('0x0')]=_0x1f424a['name']||'';this[_0xc4ea('0x1')]=_0x1f424a[_0xc4ea('0x1')]||'';this[_0xc4ea('0x2')]=_0x1f424a[_0xc4ea('0x2')]||'';this['remoteUri']=_0x1f424a[_0xc4ea('0x3')]||'';this[_0xc4ea('0x4')]=_0x1f424a['serverUrl']||'';this[_0xc4ea('0x5')]=_0x1f424a['Configurations']||{};}module[_0xc4ea('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d624832..d3622c3 100644 --- a/server/services/ami/model/sugarcrmAccount.js +++ b/server/services/ami/model/sugarcrmAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58fb=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x58fb,0xda));var _0xb58f=function(_0x7740cc,_0x390585){_0x7740cc=_0x7740cc-0x0;var _0x429b91=_0x58fb[_0x7740cc];return _0x429b91;};'use strict';function SugarcrmAccount(_0x3a99f8){this['id']=_0x3a99f8['id']||0x0;this[_0xb58f('0x0')]=_0x3a99f8[_0xb58f('0x0')]||'';this[_0xb58f('0x1')]=_0x3a99f8[_0xb58f('0x1')]||'';this[_0xb58f('0x2')]=_0x3a99f8[_0xb58f('0x2')]||'';this[_0xb58f('0x3')]=_0x3a99f8[_0xb58f('0x3')]||'';this[_0xb58f('0x4')]=_0x3a99f8['serverUrl']||'';this[_0xb58f('0x5')]=_0x3a99f8[_0xb58f('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x956b=['password','serverUrl','exports','name','username'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x956b,0x71));var _0xb956=function(_0x447cd0,_0x51662b){_0x447cd0=_0x447cd0-0x0;var _0x2fb660=_0x956b[_0x447cd0];return _0x2fb660;};'use strict';function SugarcrmAccount(_0x54b013){this['id']=_0x54b013['id']||0x0;this[_0xb956('0x0')]=_0x54b013[_0xb956('0x0')]||'';this[_0xb956('0x1')]=_0x54b013[_0xb956('0x1')]||'';this['password']=_0x54b013[_0xb956('0x2')]||'';this['remoteUri']=_0x54b013['remoteUri']||'';this[_0xb956('0x3')]=_0x54b013[_0xb956('0x3')]||'';this['Configurations']=_0x54b013['Configurations']||{};}module[_0xb956('0x4')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ca663e2..e7b028a 100644 --- a/server/services/ami/model/telephone.js +++ b/server/services/ami/model/telephone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3870=['address','exports','name','accountcode','unknown','stateTime'];(function(_0x2e7306,_0x40163e){var _0x227f9e=function(_0x3ddd56){while(--_0x3ddd56){_0x2e7306['push'](_0x2e7306['shift']());}};_0x227f9e(++_0x40163e);}(_0x3870,0x146));var _0x0387=function(_0x1cf4a9,_0x3645c2){_0x1cf4a9=_0x1cf4a9-0x0;var _0x5d81de=_0x3870[_0x1cf4a9];return _0x5d81de;};'use strict';function Telephone(_0x251145){this['id']=_0x251145['id']||0x0;this[_0x0387('0x0')]=_0x251145[_0x0387('0x0')]||'';this['accountcode']=_0x251145[_0x0387('0x1')]||'';this['state']=_0x0387('0x2');this[_0x0387('0x3')]=0x0;this['status']=_0x0387('0x2');this[_0x0387('0x4')]='';}module[_0x0387('0x5')]=Telephone; \ No newline at end of file +var _0x711f=['status','unknown','address','accountcode','stateTime'];(function(_0x55e152,_0x56ec6e){var _0x3d7cef=function(_0x182f9e){while(--_0x182f9e){_0x55e152['push'](_0x55e152['shift']());}};_0x3d7cef(++_0x56ec6e);}(_0x711f,0x17a));var _0xf711=function(_0x5a18fc,_0xb1a4aa){_0x5a18fc=_0x5a18fc-0x0;var _0x57b441=_0x711f[_0x5a18fc];return _0x57b441;};'use strict';function Telephone(_0x48f0bf){this['id']=_0x48f0bf['id']||0x0;this['name']=_0x48f0bf['name']||'';this[_0xf711('0x0')]=_0x48f0bf[_0xf711('0x0')]||'';this['state']='unknown';this[_0xf711('0x1')]=0x0;this[_0xf711('0x2')]=_0xf711('0x3');this[_0xf711('0x4')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index b3c0e23..26bc319 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x553582,_0x3f18ad){var _0x11f472=function(_0x58e383){while(--_0x58e383){_0x553582['push'](_0x553582['shift']());}};_0x11f472(++_0x3f18ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5dcff4,_0x32eae5){var _0x6a7c53=function(_0x366fa7){while(--_0x366fa7){_0x5dcff4['push'](_0x5dcff4['shift']());}};_0x6a7c53(++_0x32eae5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 216b93f..8a851de 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x3c2b2e,_0x3e6e53){var _0x27a338=function(_0x40d29d){while(--_0x40d29d){_0x3c2b2e['push'](_0x3c2b2e['shift']());}};_0x27a338(++_0x3e6e53);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5d6b41,_0x3d1c8f){_0x5d6b41=_0x5d6b41-0x0;var _0x1c2dd6=_0x5eb8[_0x5d6b41];return _0x1c2dd6;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x2880d8,_0x284ded){var _0x51f5a9=function(_0xafd747){while(--_0xafd747){_0x2880d8['push'](_0x2880d8['shift']());}};_0x51f5a9(++_0x284ded);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index dc8d752..319bb35 100644 --- a/server/services/ami/model/trunk.js +++ b/server/services/ami/model/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c20=['registrationtime','address','defaultuser','exports','name','state','stateTime','unknown','registry','indexOf','split','host','port','domain','stateRegistry'];(function(_0x32ddd2,_0xe0f618){var _0x48de30=function(_0x13fad6){while(--_0x13fad6){_0x32ddd2['push'](_0x32ddd2['shift']());}};_0x48de30(++_0xe0f618);}(_0x3c20,0xa9));var _0x03c2=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x3c20[_0x47e7cb];return _0x2a8874;};'use strict';function Trunk(_0x298cb7){this['id']=_0x298cb7['id']||0x0;this['active']=_0x298cb7['active']||![];this['name']=_0x298cb7[_0x03c2('0x0')]||'';this[_0x03c2('0x1')]='unknown';this[_0x03c2('0x2')]=0x0;this['status']=_0x03c2('0x3');this[_0x03c2('0x4')]=_0x298cb7['registry']&&_0x298cb7[_0x03c2('0x4')][_0x03c2('0x5')](':')?_0x298cb7[_0x03c2('0x4')][_0x03c2('0x6')](':')[0x0]:'';this[_0x03c2('0x7')]='';this[_0x03c2('0x8')]='';this[_0x03c2('0x9')]='';this['domainport']='';this['refresh']='';this[_0x03c2('0xa')]='unknown';this[_0x03c2('0xb')]='';this[_0x03c2('0xc')]='';this[_0x03c2('0xd')]=_0x298cb7['defaultuser']||'';}module[_0x03c2('0xe')]=Trunk; \ No newline at end of file +var _0xf552=['unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','state','stateTime','status'];(function(_0x2577d9,_0x8f2f28){var _0x36fe58=function(_0xbba849){while(--_0xbba849){_0x2577d9['push'](_0x2577d9['shift']());}};_0x36fe58(++_0x8f2f28);}(_0xf552,0x1bd));var _0x2f55=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0xf552[_0x1c7f48];return _0x274c31;};'use strict';function Trunk(_0x50997c){this['id']=_0x50997c['id']||0x0;this[_0x2f55('0x0')]=_0x50997c[_0x2f55('0x0')]||![];this[_0x2f55('0x1')]=_0x50997c[_0x2f55('0x1')]||'';this[_0x2f55('0x2')]='unknown';this[_0x2f55('0x3')]=0x0;this[_0x2f55('0x4')]=_0x2f55('0x5');this['registry']=_0x50997c[_0x2f55('0x6')]&&_0x50997c[_0x2f55('0x6')][_0x2f55('0x7')](':')?_0x50997c[_0x2f55('0x6')][_0x2f55('0x8')](':')[0x0]:'';this[_0x2f55('0x9')]='';this[_0x2f55('0xa')]='';this[_0x2f55('0xb')]='';this[_0x2f55('0xc')]='';this[_0x2f55('0xd')]='';this[_0x2f55('0xe')]=_0x2f55('0x5');this[_0x2f55('0xf')]='';this['address']='';this[_0x2f55('0x10')]=_0x50997c[_0x2f55('0x10')]||'';}module[_0x2f55('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6c1dda0..22d8b4f 100644 --- a/server/services/ami/model/voiceExtension.js +++ b/server/services/ami/model/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa21f=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x2ba4ed,_0x3fd1ed){var _0x5b27fc=function(_0xa2b1c){while(--_0xa2b1c){_0x2ba4ed['push'](_0x2ba4ed['shift']());}};_0x5b27fc(++_0x3fd1ed);}(_0xa21f,0x6c));var _0xfa21=function(_0x28c1a2,_0x44f94e){_0x28c1a2=_0x28c1a2-0x0;var _0x5cc707=_0xa21f[_0x28c1a2];return _0x5cc707;};'use strict';function voiceExtension(_0x2d5b2c){this['id']=_0x2d5b2c['id']||0x0;this['exten']=_0x2d5b2c[_0xfa21('0x0')]||'';this[_0xfa21('0x1')]=_0x2d5b2c[_0xfa21('0x1')]||_0xfa21('0x2');this[_0xfa21('0x3')]=_0x2d5b2c[_0xfa21('0x3')]||![];}module[_0xfa21('0x4')]=voiceExtension; \ No newline at end of file +var _0x5e43=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x2a27cb,_0x33807e){var _0x25b5b7=function(_0x1c56e2){while(--_0x1c56e2){_0x2a27cb['push'](_0x2a27cb['shift']());}};_0x25b5b7(++_0x33807e);}(_0x5e43,0x1d1));var _0x35e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e43[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x1cc50d){this['id']=_0x1cc50d['id']||0x0;this[_0x35e4('0x0')]=_0x1cc50d[_0x35e4('0x0')]||'';this['recordingFormat']=_0x1cc50d[_0x35e4('0x1')]||_0x35e4('0x2');this[_0x35e4('0x3')]=_0x1cc50d[_0x35e4('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c52bee4..e38a336 100644 --- a/server/services/ami/model/voiceQueue.js +++ b/server/services/ami/model/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdae8=['busy','unavailable','ringing','ringinuse','onhold','wav','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','available','acw','autopause','sendMessageOneNotActive','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse'];(function(_0x30a1af,_0x3d5c28){var _0x16c800=function(_0x8604a8){while(--_0x8604a8){_0x30a1af['push'](_0x30a1af['shift']());}};_0x16c800(++_0x3d5c28);}(_0xdae8,0xe9));var _0x8dae=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xdae8[_0x359377];return _0x8be18a;};'use strict';var statusDesc=[_0x8dae('0x0'),_0x8dae('0x1'),_0x8dae('0x2'),_0x8dae('0x3'),'invalid',_0x8dae('0x4'),_0x8dae('0x5'),_0x8dae('0x6'),_0x8dae('0x7')];var monitorFormat={'wav':_0x8dae('0x8'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x8dae('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1b5f1d){this['id']=_0x1b5f1d['id']||0x0;this[_0x8dae('0xa')]=_0x1b5f1d[_0x8dae('0xa')]||'';this['monitor_format']=_0x1b5f1d[_0x8dae('0xb')]||'';this[_0x8dae('0xc')]=_0x1b5f1d['type']||_0x8dae('0xd');this[_0x8dae('0xe')]=0x0;this[_0x8dae('0xf')]=0x0;this[_0x8dae('0x10')]=0x0;this[_0x8dae('0x11')]=0x0;this[_0x8dae('0x12')]=0x0;this[_0x8dae('0x13')]=0x0;this[_0x8dae('0x14')]=0x0;this[_0x8dae('0x15')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0x8dae('0x16')]=0x0;this[_0x8dae('0x17')]=_0x1b5f1d[_0x8dae('0x17')]||![];this['acwTimeout']=_0x1b5f1d['acwTimeout']||0xa;this[_0x8dae('0x18')]=_0x1b5f1d['autopause']||'no';this[_0x8dae('0x19')]=!![];this['message']='';this[_0x8dae('0x1a')]=0x0;this[_0x8dae('0x1b')]=0x0;this['dialTimezone']=_0x1b5f1d['dialTimezone']||null;this['dialGlobalInterval']=_0x1b5f1d[_0x8dae('0x1c')]?_0x1b5f1d[_0x8dae('0x1c')]:null;this[_0x8dae('0x1d')]=_0x1b5f1d[_0x8dae('0x1d')];this[_0x8dae('0x1e')]=_0x1b5f1d[_0x8dae('0x1e')]||_0x8dae('0x1f');this[_0x8dae('0x20')]=_0x1b5f1d[_0x8dae('0x20')]||0x0;this[_0x8dae('0x21')]=_0x1b5f1d[_0x8dae('0x21')]||0x0;this[_0x8dae('0x22')]=_0x1b5f1d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x1b5f1d[_0x8dae('0x23')]||_0x8dae('0x24');this['dialPredictiveOptimizationPercentage']=_0x1b5f1d[_0x8dae('0x25')]||0.03;this[_0x8dae('0x26')]=_0x1b5f1d[_0x8dae('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x1b5f1d[_0x8dae('0x27')]||'anonymous';this[_0x8dae('0x28')]=_0x1b5f1d[_0x8dae('0x28')]||_0x8dae('0x29');this[_0x8dae('0x2a')]=_0x1b5f1d[_0x8dae('0x2a')]||0x1e;this[_0x8dae('0x2b')]=_0x1b5f1d[_0x8dae('0x2b')]||_0x8dae('0x2c');this[_0x8dae('0x2d')]=_0x1b5f1d[_0x8dae('0x2d')]||0x3;this['dialQueueProject']=_0x1b5f1d[_0x8dae('0x2e')]||undefined;this[_0x8dae('0x2f')]=_0x1b5f1d['dialCongestionMaxRetry']||0x3;this[_0x8dae('0x30')]=_0x1b5f1d[_0x8dae('0x30')]||0x96;this[_0x8dae('0x31')]=_0x1b5f1d['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x1b5f1d[_0x8dae('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x1b5f1d[_0x8dae('0x33')]||0x3;this[_0x8dae('0x34')]=_0x1b5f1d[_0x8dae('0x34')]||0x96;this[_0x8dae('0x35')]=_0x1b5f1d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1b5f1d['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8dae('0x36')]=_0x1b5f1d[_0x8dae('0x36')]||0x3;this[_0x8dae('0x37')]=_0x1b5f1d[_0x8dae('0x37')]||0x96;this[_0x8dae('0x38')]=_0x1b5f1d[_0x8dae('0x38')]||0x3;this[_0x8dae('0x39')]=_0x1b5f1d[_0x8dae('0x39')]||0x96;this['dialMachineMaxRetry']=_0x1b5f1d[_0x8dae('0x3a')]||0x3;this[_0x8dae('0x3b')]=_0x1b5f1d[_0x8dae('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x1b5f1d[_0x8dae('0x3c')]||0x3;this[_0x8dae('0x3d')]=_0x1b5f1d[_0x8dae('0x3d')]||0x96;this['callAdditionalPhoneAfterMin']=_0x1b5f1d[_0x8dae('0x3e')]||0x3;this[_0x8dae('0x3f')]=_0x1b5f1d[_0x8dae('0x3f')]||0x4;this['Trunk']=_0x1b5f1d['Trunk']?_0x1b5f1d[_0x8dae('0x40')]:undefined;this['TrunkBackup']=_0x1b5f1d[_0x8dae('0x41')]?_0x1b5f1d[_0x8dae('0x41')]:undefined;this[_0x8dae('0x42')]=_0x1b5f1d[_0x8dae('0x42')]||undefined;this['Interval']=_0x1b5f1d[_0x8dae('0x43')]?_0x1b5f1d[_0x8dae('0x43')]:undefined;this[_0x8dae('0x44')]=_0x1b5f1d['dialOrderByScheduledAt']||_0x8dae('0x45');this[_0x8dae('0x46')]=_0x1b5f1d[_0x8dae('0x46')]||undefined;this[_0x8dae('0x47')]=_0x1b5f1d[_0x8dae('0x47')]||undefined;this['strategy']=strategy[_0x1b5f1d['strategy']]||_0x8dae('0x9');this[_0x8dae('0x48')]=!![];this[_0x8dae('0x49')]=_0x1b5f1d[_0x8dae('0x49')]||![];this[_0x8dae('0x4a')]=_0x1b5f1d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1b5f1d['dialAMDGreeting'];this[_0x8dae('0x4b')]=_0x1b5f1d[_0x8dae('0x4b')];this[_0x8dae('0x4c')]=_0x1b5f1d[_0x8dae('0x4c')];this['dialAMDMinWordLength']=_0x1b5f1d[_0x8dae('0x4d')];this['dialAMDBetweenWordsSilence']=_0x1b5f1d[_0x8dae('0x4e')];this[_0x8dae('0x4f')]=_0x1b5f1d[_0x8dae('0x4f')];this[_0x8dae('0x50')]=_0x1b5f1d[_0x8dae('0x50')];this[_0x8dae('0x51')]=_0x1b5f1d['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x8dae('0x52')]=0x0;this[_0x8dae('0x53')]=_0x1b5f1d[_0x8dae('0x53')];this[_0x8dae('0x54')]=0x0;this[_0x8dae('0x55')]=0x0;this[_0x8dae('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x8dae('0x57')]=0x0;this[_0x8dae('0x58')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x8dae('0x59')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x8dae('0x5a')]=0x0;this[_0x8dae('0x5b')]=0x0;this[_0x8dae('0x5c')]=0x0;this[_0x8dae('0x5d')]=0x0;this[_0x8dae('0x5e')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x8dae('0x5f')]=undefined;this[_0x8dae('0x60')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x8dae('0x61')]=0x0;this[_0x8dae('0x62')]=0x0;this[_0x8dae('0x63')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x8dae('0x64')]=_0x1b5f1d[_0x8dae('0x65')]||0x14;this[_0x8dae('0x66')]=_0x1b5f1d[_0x8dae('0x65')]||0xa;this[_0x8dae('0x67')]=0x0;this[_0x8dae('0x68')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x8dae('0x69')]=0x0;this[_0x8dae('0x6a')]=0x0;this[_0x8dae('0x6b')]=0x0;this[_0x8dae('0x6c')]=0x0;this[_0x8dae('0x6d')]=_0x1b5f1d['dialRecallMeTimeout']||0x1e;this[_0x8dae('0x6e')]=_0x1b5f1d[_0x8dae('0x6e')]||![];this[_0x8dae('0x6f')]=!!_0x1b5f1d[_0x8dae('0x6f')]||![];this[_0x8dae('0x70')]=!!_0x1b5f1d['dialPreviewRecallmeReminder']||![];this[_0x8dae('0x71')]=_0x1b5f1d[_0x8dae('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x1b5f1d['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x1b5f1d[_0x8dae('0x72')]||![];this[_0x8dae('0xb')]=monitorFormat[_0x1b5f1d[_0x8dae('0xb')]]?monitorFormat[_0x1b5f1d[_0x8dae('0xb')]]:undefined;this[_0x8dae('0x73')]=_0x1b5f1d[_0x8dae('0x73')]||![];this[_0x8dae('0x74')]=_0x1b5f1d[_0x8dae('0x74')]?_0x1b5f1d[_0x8dae('0x74')]:undefined;}module[_0x8dae('0x75')]=VoiceQueue; \ No newline at end of file +var _0xc47f=['outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','invalid','ringing','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay'];(function(_0x1a213d,_0x3c71dd){var _0x2de115=function(_0x340216){while(--_0x340216){_0x1a213d['push'](_0x1a213d['shift']());}};_0x2de115(++_0x3c71dd);}(_0xc47f,0x186));var _0xfc47=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xc47f[_0x25e7cb];return _0x375d92;};'use strict';var statusDesc=[_0xfc47('0x0'),'not_inuse','inuse','busy',_0xfc47('0x1'),'unavailable',_0xfc47('0x2'),'ringinuse',_0xfc47('0x3')];var monitorFormat={'wav':_0xfc47('0x4'),'wav49':_0xfc47('0x5'),'gsm':_0xfc47('0x6')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xfc47('0x7')};function VoiceQueue(_0x49c7f8){this['id']=_0x49c7f8['id']||0x0;this[_0xfc47('0x8')]=_0x49c7f8[_0xfc47('0x8')]||'';this[_0xfc47('0x9')]=_0x49c7f8[_0xfc47('0x9')]||'';this[_0xfc47('0xa')]=_0x49c7f8[_0xfc47('0xa')]||_0xfc47('0xb');this[_0xfc47('0xc')]=0x0;this[_0xfc47('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xfc47('0xe')]=0x0;this['sumHoldTime']=0x0;this[_0xfc47('0xf')]=0x0;this[_0xfc47('0x10')]=0x0;this[_0xfc47('0x11')]=0x0;this[_0xfc47('0x12')]=0x0;this[_0xfc47('0x13')]=0x0;this[_0xfc47('0x14')]=_0x49c7f8[_0xfc47('0x14')]||![];this['acwTimeout']=_0x49c7f8[_0xfc47('0x15')]||0xa;this[_0xfc47('0x16')]=_0x49c7f8['autopause']||'no';this[_0xfc47('0x17')]=!![];this[_0xfc47('0x18')]='';this[_0xfc47('0x19')]=0x0;this[_0xfc47('0x1a')]=0x0;this['dialTimezone']=_0x49c7f8[_0xfc47('0x1b')]||null;this[_0xfc47('0x1c')]=_0x49c7f8[_0xfc47('0x1c')]?_0x49c7f8[_0xfc47('0x1c')]:null;this[_0xfc47('0x1d')]=_0x49c7f8['dialActive'];this['dialMethod']=_0x49c7f8['dialMethod']||_0xfc47('0x1e');this[_0xfc47('0x1f')]=_0x49c7f8[_0xfc47('0x1f')]||0x0;this['dialLimitQueue']=_0x49c7f8['dialLimitQueue']||0x0;this[_0xfc47('0x20')]=_0x49c7f8[_0xfc47('0x20')]||0x1;this[_0xfc47('0x21')]=_0x49c7f8[_0xfc47('0x21')]||_0xfc47('0x22');this[_0xfc47('0x23')]=_0x49c7f8['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x49c7f8['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x49c7f8['dialOriginateCallerIdName']||_0xfc47('0x24');this[_0xfc47('0x25')]=_0x49c7f8[_0xfc47('0x25')]||_0xfc47('0x24');this[_0xfc47('0x26')]=_0x49c7f8[_0xfc47('0x26')]||0x1e;this['dialQueueOptions']=_0x49c7f8[_0xfc47('0x27')]||_0xfc47('0x28');this['dialQueueTimeout']=_0x49c7f8[_0xfc47('0x29')]||0x3;this[_0xfc47('0x2a')]=_0x49c7f8[_0xfc47('0x2a')]||undefined;this[_0xfc47('0x2b')]=_0x49c7f8[_0xfc47('0x2b')]||0x3;this[_0xfc47('0x2c')]=_0x49c7f8['dialCongestionRetryFrequency']||0x96;this[_0xfc47('0x2d')]=_0x49c7f8[_0xfc47('0x2d')]||0x3;this[_0xfc47('0x2e')]=_0x49c7f8[_0xfc47('0x2e')]||0x96;this['dialNoAnswerMaxRetry']=_0x49c7f8[_0xfc47('0x2f')]||0x3;this[_0xfc47('0x30')]=_0x49c7f8['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x49c7f8['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x49c7f8['dialNoSuchNumberRetryFrequency']||0x96;this[_0xfc47('0x31')]=_0x49c7f8['dialDropMaxRetry']||0x3;this[_0xfc47('0x32')]=_0x49c7f8['dialDropRetryFrequency']||0x96;this[_0xfc47('0x33')]=_0x49c7f8[_0xfc47('0x33')]||0x3;this[_0xfc47('0x34')]=_0x49c7f8['dialAbandonedRetryFrequency']||0x96;this[_0xfc47('0x35')]=_0x49c7f8[_0xfc47('0x35')]||0x3;this['dialMachineRetryFrequency']=_0x49c7f8[_0xfc47('0x36')]||0x96;this[_0xfc47('0x37')]=_0x49c7f8[_0xfc47('0x37')]||0x3;this['dialAgentRejectRetryFrequency']=_0x49c7f8[_0xfc47('0x38')]||0x96;this[_0xfc47('0x39')]=_0x49c7f8[_0xfc47('0x39')]||0x3;this[_0xfc47('0x3a')]=_0x49c7f8[_0xfc47('0x3a')]||0x4;this[_0xfc47('0x3b')]=_0x49c7f8[_0xfc47('0x3b')]?_0x49c7f8[_0xfc47('0x3b')]:undefined;this['TrunkBackup']=_0x49c7f8[_0xfc47('0x3c')]?_0x49c7f8[_0xfc47('0x3c')]:undefined;this[_0xfc47('0x3d')]=_0x49c7f8['dialPrefix']||undefined;this['Interval']=_0x49c7f8[_0xfc47('0x3e')]?_0x49c7f8[_0xfc47('0x3e')]:undefined;this[_0xfc47('0x3f')]=_0x49c7f8['dialOrderByScheduledAt']||_0xfc47('0x40');this['dialRandomLastDigitCallerIdNumber']=_0x49c7f8[_0xfc47('0x41')]||undefined;this[_0xfc47('0x42')]=_0x49c7f8[_0xfc47('0x42')]||undefined;this[_0xfc47('0x43')]=strategy[_0x49c7f8[_0xfc47('0x43')]]||_0xfc47('0x44');this[_0xfc47('0x45')]=!![];this['dialAMDActive']=_0x49c7f8[_0xfc47('0x46')]||![];this[_0xfc47('0x47')]=_0x49c7f8['dialAMDInitialSilence'];this[_0xfc47('0x48')]=_0x49c7f8[_0xfc47('0x48')];this[_0xfc47('0x49')]=_0x49c7f8[_0xfc47('0x49')];this[_0xfc47('0x4a')]=_0x49c7f8[_0xfc47('0x4a')];this[_0xfc47('0x4b')]=_0x49c7f8['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x49c7f8['dialAMDBetweenWordsSilence'];this[_0xfc47('0x4c')]=_0x49c7f8[_0xfc47('0x4c')];this[_0xfc47('0x4d')]=_0x49c7f8[_0xfc47('0x4d')];this[_0xfc47('0x4e')]=_0x49c7f8[_0xfc47('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0xfc47('0x4f')]=0x0;this['timeout']=_0x49c7f8[_0xfc47('0x50')];this[_0xfc47('0x51')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xfc47('0x52')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xfc47('0x53')]=0x0;this[_0xfc47('0x54')]=0x0;this[_0xfc47('0x55')]=0x0;this[_0xfc47('0x56')]=0x0;this[_0xfc47('0x57')]=0x0;this[_0xfc47('0x58')]=0x0;this[_0xfc47('0x59')]=0x0;this[_0xfc47('0x5a')]=0x0;this[_0xfc47('0x5b')]=undefined;this['startPredictive']=undefined;this[_0xfc47('0x5c')]=undefined;this[_0xfc47('0x5d')]=1.05;this[_0xfc47('0x5e')]=0x0;this[_0xfc47('0x5f')]=0x0;this[_0xfc47('0x60')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xfc47('0x61')]=0x0;this[_0xfc47('0x62')]=0x0;this[_0xfc47('0x63')]=0x0;this[_0xfc47('0x64')]=0x0;this[_0xfc47('0x65')]=_0x49c7f8[_0xfc47('0x66')]||0x14;this[_0xfc47('0x67')]=_0x49c7f8[_0xfc47('0x66')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xfc47('0x68')]=0x0;this[_0xfc47('0x69')]=0x1;this[_0xfc47('0x6a')]=0x0;this[_0xfc47('0x6b')]=0x0;this[_0xfc47('0x6c')]=0x0;this[_0xfc47('0x6d')]=0x0;this[_0xfc47('0x6e')]=_0x49c7f8[_0xfc47('0x6e')]||0x1e;this[_0xfc47('0x6f')]=_0x49c7f8[_0xfc47('0x6f')]||![];this['dialPreviewAutoRecallMe']=!!_0x49c7f8[_0xfc47('0x70')]||![];this[_0xfc47('0x71')]=!!_0x49c7f8[_0xfc47('0x71')]||![];this[_0xfc47('0x72')]=_0x49c7f8[_0xfc47('0x72')]||undefined;this[_0xfc47('0x73')]=_0x49c7f8['dialAgiAfterHangupClient']||![];this[_0xfc47('0x74')]=_0x49c7f8[_0xfc47('0x74')]||![];this[_0xfc47('0x9')]=monitorFormat[_0x49c7f8[_0xfc47('0x9')]]?monitorFormat[_0x49c7f8[_0xfc47('0x9')]]:undefined;this[_0xfc47('0x75')]=_0x49c7f8[_0xfc47('0x75')]||![];this['mandatoryDispositionPause']=_0x49c7f8[_0xfc47('0x76')]?_0x49c7f8['mandatoryDispositionPause']:undefined;}module[_0xfc47('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 36db836..9d98490 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x986d=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x190161,_0x58587d){var _0x115438=function(_0x17a7ee){while(--_0x17a7ee){_0x190161['push'](_0x190161['shift']());}};_0x115438(++_0x58587d);}(_0x986d,0xa9));var _0xd986=function(_0x1bc1ee,_0xb8488f){_0x1bc1ee=_0x1bc1ee-0x0;var _0x49617a=_0x986d[_0x1bc1ee];return _0x49617a;};'use strict';function VtigerAccount(_0x1d5726){this['id']=_0x1d5726['id']||0x0;this['name']=_0x1d5726[_0xd986('0x0')]||'';this[_0xd986('0x1')]=_0x1d5726['username']||'';this[_0xd986('0x2')]=_0x1d5726[_0xd986('0x2')]||'';this[_0xd986('0x3')]=_0x1d5726[_0xd986('0x3')]||'';this[_0xd986('0x4')]=_0x1d5726[_0xd986('0x4')]||'';this[_0xd986('0x5')]=_0x1d5726['Configurations']||{};}module[_0xd986('0x6')]=VtigerAccount; \ No newline at end of file +var _0x0d91=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5934d4,_0x31f031){var _0x4fea31=function(_0x405575){while(--_0x405575){_0x5934d4['push'](_0x5934d4['shift']());}};_0x4fea31(++_0x31f031);}(_0x0d91,0x76));var _0x10d9=function(_0x1e699f,_0x3174f2){_0x1e699f=_0x1e699f-0x0;var _0x2719d6=_0x0d91[_0x1e699f];return _0x2719d6;};'use strict';function VtigerAccount(_0x576e87){this['id']=_0x576e87['id']||0x0;this[_0x10d9('0x0')]=_0x576e87[_0x10d9('0x0')]||'';this[_0x10d9('0x1')]=_0x576e87['username']||'';this[_0x10d9('0x2')]=_0x576e87[_0x10d9('0x2')]||'';this[_0x10d9('0x3')]=_0x576e87['remoteUri']||'';this[_0x10d9('0x4')]=_0x576e87[_0x10d9('0x4')]||'';this[_0x10d9('0x5')]=_0x576e87['Configurations']||{};}module[_0x10d9('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f07c9bc..c04e379 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd43d=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x6fda4c,_0x10ab5f){var _0x284923=function(_0x178cdd){while(--_0x178cdd){_0x6fda4c['push'](_0x6fda4c['shift']());}};_0x284923(++_0x10ab5f);}(_0xd43d,0x1d1));var _0xdd43=function(_0x7c7c7d,_0x358ce2){_0x7c7c7d=_0x7c7c7d-0x0;var _0x10bbff=_0xd43d[_0x7c7c7d];return _0x10bbff;};'use strict';function ZendeskAccount(_0x3eca12){this['id']=_0x3eca12['id']||0x0;this['name']=_0x3eca12[_0xdd43('0x0')]||'';this['username']=_0x3eca12[_0xdd43('0x1')]||'';this[_0xdd43('0x2')]=_0x3eca12[_0xdd43('0x2')]||'';this[_0xdd43('0x3')]=_0x3eca12[_0xdd43('0x3')]||'';this[_0xdd43('0x4')]=_0x3eca12[_0xdd43('0x4')]||'';this[_0xdd43('0x5')]=_0x3eca12[_0xdd43('0x5')]||'';this[_0xdd43('0x6')]=_0x3eca12['type']||_0xdd43('0x7');this[_0xdd43('0x8')]=_0x3eca12['serverUrl']||'';this[_0xdd43('0x9')]=_0x3eca12[_0xdd43('0x9')]||{};}module[_0xdd43('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x3ad5=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x2b9469,_0xcf3902){var _0x1c03f0=function(_0x22dab4){while(--_0x22dab4){_0x2b9469['push'](_0x2b9469['shift']());}};_0x1c03f0(++_0xcf3902);}(_0x3ad5,0x107));var _0x53ad=function(_0x117ad5,_0x4a7521){_0x117ad5=_0x117ad5-0x0;var _0x1a9640=_0x3ad5[_0x117ad5];return _0x1a9640;};'use strict';function ZendeskAccount(_0x4ab759){this['id']=_0x4ab759['id']||0x0;this[_0x53ad('0x0')]=_0x4ab759[_0x53ad('0x0')]||'';this[_0x53ad('0x1')]=_0x4ab759[_0x53ad('0x1')]||'';this[_0x53ad('0x2')]=_0x4ab759[_0x53ad('0x2')]||'';this['token']=_0x4ab759[_0x53ad('0x3')]||'';this['remoteUri']=_0x4ab759[_0x53ad('0x4')]||'';this[_0x53ad('0x5')]=_0x4ab759[_0x53ad('0x5')]||'';this[_0x53ad('0x6')]=_0x4ab759[_0x53ad('0x6')]||_0x53ad('0x7');this['serverUrl']=_0x4ab759[_0x53ad('0x8')]||'';this[_0x53ad('0x9')]=_0x4ab759[_0x53ad('0x9')]||{};}module[_0x53ad('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 13c0285..066780b 100644 --- a/server/services/ami/model/zohoAccount.js +++ b/server/services/ami/model/zohoAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a38=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a38,0x1ed));var _0x88a3=function(_0x4573bd,_0x19b9b5){_0x4573bd=_0x4573bd-0x0;var _0xc07bb9=_0x8a38[_0x4573bd];return _0xc07bb9;};'use strict';function ZohoAccount(_0x27bbf7){this['id']=_0x27bbf7['id']||0x0;this[_0x88a3('0x0')]=_0x27bbf7[_0x88a3('0x0')]||'';this[_0x88a3('0x1')]=_0x27bbf7['description']||'';this[_0x88a3('0x2')]=_0x27bbf7[_0x88a3('0x2')]||'';this[_0x88a3('0x3')]=_0x27bbf7[_0x88a3('0x3')]||'';this[_0x88a3('0x4')]=_0x27bbf7[_0x88a3('0x4')]||'';this[_0x88a3('0x5')]=_0x27bbf7[_0x88a3('0x5')]||'';this['serverUrl']=_0x27bbf7[_0x88a3('0x6')]||'';this[_0x88a3('0x7')]=_0x27bbf7['code']||'';this['refreshToken']=_0x27bbf7[_0x88a3('0x8')]||'';this['Configurations']=_0x27bbf7[_0x88a3('0x9')]||{};}module[_0x88a3('0xa')]=ZohoAccount; \ No newline at end of file +var _0x42f3=['description','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x13c38a,_0x522286){var _0x5c658a=function(_0x7ab113){while(--_0x7ab113){_0x13c38a['push'](_0x13c38a['shift']());}};_0x5c658a(++_0x522286);}(_0x42f3,0x74));var _0x342f=function(_0x55969b,_0x1ebe62){_0x55969b=_0x55969b-0x0;var _0x3d7fc1=_0x42f3[_0x55969b];return _0x3d7fc1;};'use strict';function ZohoAccount(_0x59b7b2){this['id']=_0x59b7b2['id']||0x0;this[_0x342f('0x0')]=_0x59b7b2['name']||'';this[_0x342f('0x1')]=_0x59b7b2[_0x342f('0x1')]||'';this['host']=_0x59b7b2['host']||'';this[_0x342f('0x2')]=_0x59b7b2[_0x342f('0x2')]||'';this[_0x342f('0x3')]=_0x59b7b2[_0x342f('0x3')]||'';this['clientSecret']=_0x59b7b2['clientSecret']||'';this[_0x342f('0x4')]=_0x59b7b2[_0x342f('0x4')]||'';this[_0x342f('0x5')]=_0x59b7b2[_0x342f('0x5')]||'';this['refreshToken']=_0x59b7b2[_0x342f('0x6')]||'';this['Configurations']=_0x59b7b2[_0x342f('0x7')]||{};}module[_0x342f('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d5f42c6..97da9b9 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3266=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x3266,0x6a));var _0x6326=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x3266[_0x44a64f];return _0x52024b;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));function checkNameSurname(_0x2bed83,_0x545df7,_0x6b67c0){var _0x29aef3='';if(!_[_0x6326('0x3')](_0x545df7)&&_0x6326('0x4')===typeof _0x545df7){_0x29aef3+=_0x545df7;}if(!_['isNil'](_0x6b67c0)&&_0x6326('0x4')===typeof _0x6b67c0){_0x29aef3+='\x20'+_0x6b67c0;}if(_0x29aef3!==''){return _0x29aef3;}return _0x2bed83;}function Action(_0x5f38a3,_0x25ecd8,_0x44460c,_0x14208e,_0x5402e5){this[_0x6326('0x5')]=_0x44460c||undefined;this['idContact']=_0x5f38a3['id'];this[_0x6326('0x6')]=_0x25ecd8[_0x6326('0x7')];this[_0x6326('0x8')]=_0x25ecd8[_0x6326('0x8')];this[_0x6326('0x9')]='queue';this[_0x6326('0xa')]=![];this[_0x6326('0xb')]=_[_0x6326('0x3')](_0x5f38a3[_0x6326('0xc')])?undefined:_0x5f38a3[_0x6326('0xc')][_0x6326('0x7')];this[_0x6326('0xd')]=this[_0x6326('0xb')]?util[_0x6326('0xe')](_0x6326('0xf'),this['membername']):_0x14208e||undefined;this['calleridname']=checkNameSurname(_0x5f38a3[_0x6326('0x10')][_0x6326('0x11')],_0x5f38a3['Contact'][_0x6326('0x12')],_0x5f38a3['Contact'][_0x6326('0x13')]);this[_0x6326('0x14')]=_0x5f38a3[_0x6326('0x14')]||![];this[_0x6326('0x15')]=_0x5f38a3[_0x6326('0x11')];this[_0x6326('0x16')]=_0x5f38a3['scheduledat'];this[_0x6326('0x17')]=_0x5f38a3['countbusyretry']||0x0;this['countcongestionretry']=_0x5f38a3['countcongestionretry']||0x0;this['countnoanswerretry']=_0x5f38a3['countnoanswerretry']||0x0;this['countglobal']=(_0x5f38a3[_0x6326('0x17')]||0x0)+(_0x5f38a3[_0x6326('0x18')]||0x0)+(_0x5f38a3[_0x6326('0x19')]||0x0)+(_0x5f38a3['countnosuchnumberretry']||0x0)+(_0x5f38a3['countdropretry']||0x0)+(_0x5f38a3[_0x6326('0x1a')]||0x0)+(_0x5f38a3[_0x6326('0x1b')]||0x0)+(_0x5f38a3[_0x6326('0x1c')]||0x0);this[_0x6326('0x1d')]=_0x5f38a3[_0x6326('0x1d')]||0x0;this[_0x6326('0x1e')]=_0x5f38a3[_0x6326('0x1e')]||0x0;this['countabandonedretry']=_0x5f38a3[_0x6326('0x1a')]||0x0;this['countmachineretry']=_0x5f38a3[_0x6326('0x1b')]||0x0;this[_0x6326('0x1c')]=_0x5f38a3[_0x6326('0x1c')]||0x0;this[_0x6326('0x1f')]=_0x5f38a3[_0x6326('0x1f')];this[_0x6326('0x20')]=_0x5f38a3[_0x6326('0x20')];this[_0x6326('0x21')]=_0x5f38a3[_0x6326('0x21')];this[_0x6326('0x22')]=_0x5f38a3[_0x6326('0x22')];this['ContactId']=_0x5f38a3[_0x6326('0x23')];this[_0x6326('0x24')]=_0x5f38a3['ListId'];this['UserId']=_['isNil'](_0x5f38a3[_0x6326('0xc')])?_0x5f38a3['UserId']:_0x5f38a3[_0x6326('0xc')]['id'];this[_0x6326('0x25')]=_0x5f38a3['VoiceQueueId'];this[_0x6326('0x26')]='';this[_0x6326('0x27')]='';}Action[_0x6326('0x28')][_0x6326('0x29')]=function(){return util[_0x6326('0xe')](_0x6326('0x2a'),this[_0x6326('0x2b')],this[_0x6326('0x2c')]);};module[_0x6326('0x2d')]=Action; \ No newline at end of file +var _0x5b12=['active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName'];(function(_0x292ae6,_0x55024e){var _0x4c56b0=function(_0xba805f){while(--_0xba805f){_0x292ae6['push'](_0x292ae6['shift']());}};_0x4c56b0(++_0x55024e);}(_0x5b12,0xa3));var _0x25b1=function(_0x4b2784,_0x436225){_0x4b2784=_0x4b2784-0x0;var _0x26231e=_0x5b12[_0x4b2784];return _0x26231e;};'use strict';var util=require(_0x25b1('0x0'));var _=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));function checkNameSurname(_0x569948,_0x1c9b07,_0x5b457b){var _0x2d491e='';if(!_[_0x25b1('0x3')](_0x1c9b07)&&'string'===typeof _0x1c9b07){_0x2d491e+=_0x1c9b07;}if(!_[_0x25b1('0x3')](_0x5b457b)&&'string'===typeof _0x5b457b){_0x2d491e+='\x20'+_0x5b457b;}if(_0x2d491e!==''){return _0x2d491e;}return _0x569948;}function Action(_0x5248c2,_0x35d90b,_0x5523c9,_0x5bb95b,_0x1f715d){this[_0x25b1('0x4')]=_0x5523c9||undefined;this[_0x25b1('0x5')]=_0x5248c2['id'];this[_0x25b1('0x6')]=_0x35d90b[_0x25b1('0x7')];this[_0x25b1('0x8')]=_0x35d90b[_0x25b1('0x8')];this[_0x25b1('0x9')]='queue';this[_0x25b1('0xa')]=![];this[_0x25b1('0xb')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?undefined:_0x5248c2[_0x25b1('0xc')][_0x25b1('0x7')];this[_0x25b1('0xd')]=this[_0x25b1('0xb')]?util[_0x25b1('0xe')](_0x25b1('0xf'),this[_0x25b1('0xb')]):_0x5bb95b||undefined;this[_0x25b1('0x10')]=checkNameSurname(_0x5248c2[_0x25b1('0x11')][_0x25b1('0x12')],_0x5248c2[_0x25b1('0x11')][_0x25b1('0x13')],_0x5248c2['Contact'][_0x25b1('0x14')]);this[_0x25b1('0x15')]=_0x5248c2['active']||![];this[_0x25b1('0x16')]=_0x5248c2[_0x25b1('0x12')];this[_0x25b1('0x17')]=_0x5248c2['scheduledat'];this['countbusyretry']=_0x5248c2[_0x25b1('0x18')]||0x0;this['countcongestionretry']=_0x5248c2[_0x25b1('0x19')]||0x0;this[_0x25b1('0x1a')]=_0x5248c2[_0x25b1('0x1a')]||0x0;this[_0x25b1('0x1b')]=(_0x5248c2[_0x25b1('0x18')]||0x0)+(_0x5248c2[_0x25b1('0x19')]||0x0)+(_0x5248c2[_0x25b1('0x1a')]||0x0)+(_0x5248c2[_0x25b1('0x1c')]||0x0)+(_0x5248c2['countdropretry']||0x0)+(_0x5248c2['countabandonedretry']||0x0)+(_0x5248c2[_0x25b1('0x1d')]||0x0)+(_0x5248c2['countagentrejectretry']||0x0);this[_0x25b1('0x1c')]=_0x5248c2['countnosuchnumberretry']||0x0;this[_0x25b1('0x1e')]=_0x5248c2['countdropretry']||0x0;this[_0x25b1('0x1f')]=_0x5248c2['countabandonedretry']||0x0;this[_0x25b1('0x1d')]=_0x5248c2['countmachineretry']||0x0;this['countagentrejectretry']=_0x5248c2['countagentrejectretry']||0x0;this[_0x25b1('0x20')]=_0x5248c2[_0x25b1('0x20')];this['callbackuniqueid']=_0x5248c2[_0x25b1('0x21')];this[_0x25b1('0x22')]=_0x5248c2[_0x25b1('0x22')];this[_0x25b1('0x23')]=_0x5248c2[_0x25b1('0x23')];this['ContactId']=_0x5248c2[_0x25b1('0x24')];this[_0x25b1('0x25')]=_0x5248c2[_0x25b1('0x25')];this[_0x25b1('0x26')]=_[_0x25b1('0x3')](_0x5248c2[_0x25b1('0xc')])?_0x5248c2['UserId']:_0x5248c2[_0x25b1('0xc')]['id'];this[_0x25b1('0x27')]=_0x5248c2[_0x25b1('0x27')];this['originatecalleridnum']='';this[_0x25b1('0x28')]='';}Action[_0x25b1('0x29')][_0x25b1('0x2a')]=function(){return util['format'](_0x25b1('0x2b'),this['calleridname'],this[_0x25b1('0x2c')]);};module[_0x25b1('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 22730c5..9bd3b03 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','syncCampaigns','hasOwnProperty','preview','outbound','clearZombieChannels','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','countbusyretry','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Call\x20failed','[Blacklist][error]','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','syncVarSet','filterKey','variable','keys','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','md5','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','answered','available','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0xb24ceb,_0x11d821){var _0x523526=function(_0x207652){while(--_0x207652){_0xb24ceb['push'](_0xb24ceb['shift']());}};_0x523526(++_0x11d821);}(_0x038b,0x114));var _0xb038=function(_0x5f11ab,_0x45d532){_0x5f11ab=_0x5f11ab-0x0;var _0x7ae297=_0x038b[_0x5f11ab];return _0x7ae297;};'use strict';var util=require('util');var _=require(_0xb038('0x0'));var BPromise=require(_0xb038('0x1'));var uuid=require(_0xb038('0x2'));var moment=require('moment');var md5=require(_0xb038('0x3'));var Redis=require('ioredis');var config=require(_0xb038('0x4'));var logger=require(_0xb038('0x5'))('preview');var loggerAction=require(_0xb038('0x5'))(_0xb038('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xb038('0x7'));var Action=require(_0xb038('0x8'));var ut=require(_0xb038('0x9'));config['redis']=_['defaults'](config[_0xb038('0xa')],{'host':_0xb038('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xb038('0xc')][_0xb038('0xd')]=function(_0x5c96b5){this[_0xb038('0xe')]=this[_0xb038('0xe')]?this[_0xb038('0xe')][_0xb038('0xf')](_0x5c96b5):_0x5c96b5();};function Preview(_0x3a09a3){this[_0xb038('0x10')]=new Sequence();this[_0xb038('0x11')]=_0x3a09a3[_0xb038('0x12')];this[_0xb038('0x13')]=_0x3a09a3[_0xb038('0x13')];this[_0xb038('0x14')]={};this[_0xb038('0x15')]=_0x3a09a3[_0xb038('0x15')];this[_0xb038('0x16')]=0x0;ami['on'](_0xb038('0x17'),this[_0xb038('0x18')][_0xb038('0x19')](this));ami['on']('hangup',this[_0xb038('0x1a')][_0xb038('0x19')](this));ami['on'](_0xb038('0x1b'),this[_0xb038('0x1c')][_0xb038('0x19')](this));ami['on'](_0xb038('0x1d'),this['syncDialEnd'][_0xb038('0x19')](this));ami['on'](_0xb038('0x1e'),this[_0xb038('0x1f')][_0xb038('0x19')](this));ami['on']('varset',this['syncVarSet'][_0xb038('0x19')](this));ami['on'](_0xb038('0x20'),this[_0xb038('0x21')][_0xb038('0x19')](this));ami['on']('blindtransfer',this[_0xb038('0x22')][_0xb038('0x19')](this));this[_0xb038('0x23')](this[_0xb038('0x11')]);}function emit(_0xc6cd61,_0x55be53,_0x2e0369){io['to'](_0xc6cd61)[_0xb038('0x24')](_0x55be53,_0x2e0369);}function emitCampaignPreview(_0x2481e2){if(_0x2481e2[_0xb038('0x25')]==='outbound'){var _0x2812c9={'id':_0x2481e2['id'],'name':_0x2481e2[_0xb038('0x26')],'strategy':_0x2481e2['strategy'],'answered':_0x2481e2[_0xb038('0x27')],'available':_0x2481e2[_0xb038('0x28')],'loggedIn':_0x2481e2['loggedIn'],'pTalking':_0x2481e2[_0xb038('0x29')],'sumBillable':_0x2481e2['sumBillable'],'sumDuration':_0x2481e2[_0xb038('0x2a')],'sumHoldTime':_0x2481e2[_0xb038('0x2b')]||0x0,'talking':_0x2481e2[_0xb038('0x2c')],'total':_0x2481e2[_0xb038('0x2d')],'type':_0x2481e2[_0xb038('0x25')],'unmanaged':_0x2481e2[_0xb038('0x2e')],'abandoned':_0x2481e2[_0xb038('0x2f')],'waiting':_0x2481e2['waiting'],'loggedInDb':_0x2481e2[_0xb038('0x30')],'dialActive':_0x2481e2[_0xb038('0x31')],'dialMethod':_0x2481e2[_0xb038('0x32')],'dialOriginateCallerIdName':_0x2481e2['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2481e2[_0xb038('0x33')],'dialOriginateTimeout':_0x2481e2[_0xb038('0x34')],'dialPrefix':_0x2481e2[_0xb038('0x35')],'outboundAnswerAgiCallsDay':_0x2481e2['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2481e2[_0xb038('0x36')],'outboundBlacklistCallsDay':_0x2481e2[_0xb038('0x37')],'outboundBusyCallsDay':_0x2481e2[_0xb038('0x38')],'outboundCongestionCallsDay':_0x2481e2[_0xb038('0x39')],'outboundDropCallsDayACS':_0x2481e2[_0xb038('0x3a')],'outboundDropCallsDayCallersExit':_0x2481e2['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2481e2[_0xb038('0x3b')],'outboundNoAnswerCallsDay':_0x2481e2[_0xb038('0x3c')],'outboundNoSuchCallsDay':_0x2481e2[_0xb038('0x3d')],'outboundOriginateFailureCallsDay':_0x2481e2[_0xb038('0x3e')],'outboundReCallsDay':_0x2481e2[_0xb038('0x3f')],'outboundRejectCallsDay':_0x2481e2[_0xb038('0x40')],'outboundUnknownCallsDay':_0x2481e2[_0xb038('0x41')],'outboundAbandonedCallsDay':_0x2481e2[_0xb038('0x42')],'predictiveIntervalAnsweredCalls':_0x2481e2[_0xb038('0x43')],'predictiveIntervalAvgHoldtime':_0x2481e2[_0xb038('0x44')],'predictiveIntervalAvgTalktime':_0x2481e2[_0xb038('0x45')],'predictiveIntervalDroppedCallsCallersExit':_0x2481e2[_0xb038('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x2481e2[_0xb038('0x47')],'predictiveIntervalErlangCalls':_0x2481e2['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2481e2[_0xb038('0x48')],'predictiveIntervalHitRate':_0x2481e2['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2481e2[_0xb038('0x49')],'predictiveIntervalPauses':_0x2481e2[_0xb038('0x4a')],'predictiveIntervalAvailable':_0x2481e2[_0xb038('0x4b')],'predictiveIntervalTotalCalls':_0x2481e2[_0xb038('0x4c')],'message':_0x2481e2[_0xb038('0x4d')],'originated':_0x2481e2[_0xb038('0x4e')],'erlangCalls':_0x2481e2[_0xb038('0x4f')],'erlangCallToSecond':_0x2481e2[_0xb038('0x50')],'erlangAbandonmentRate':_0x2481e2[_0xb038('0x51')],'erlangBusyFactor':_0x2481e2[_0xb038('0x52')],'startPredictive':_0x2481e2['startPredictive'],'startProgressive':_0x2481e2[_0xb038('0x53')]};if(_0x2481e2[_0xb038('0x54')]){_0x2812c9[_0xb038('0x54')]={'id':_0x2481e2['Trunk']['id'],'name':_0x2481e2['Trunk']['name'],'active':_0x2481e2[_0xb038('0x54')][_0xb038('0x55')],'callerid':_0x2481e2[_0xb038('0x54')][_0xb038('0x56')]};}if(_0x2481e2[_0xb038('0x57')]){_0x2812c9[_0xb038('0x57')]={'id':_0x2481e2['Interval']['id'],'name':_0x2481e2[_0xb038('0x57')][_0xb038('0x26')]};}var _0x1b6f1e=md5(JSON[_0xb038('0x58')](_0x2812c9));if(_0x2481e2['md5']!==_0x1b6f1e){_0x2481e2[_0xb038('0x3')]=_0x1b6f1e;emit(util[_0xb038('0x59')]('voice:queue:%s',_0x2812c9['name']),_0xb038('0x5a'),_0x2812c9);}}}function emitVoiceQueueChannelRemove(_0xa3d1b){logger[_0xb038('0x5b')](_0xb038('0x5c'),JSON[_0xb038('0x58')](_0xa3d1b));emit(util['format'](_0xb038('0x5d'),_0xa3d1b[_0xb038('0x26')]),_0xb038('0x5e'),_0xa3d1b);io[_0xb038('0x24')]('voice_queue_presence:remove',_0xa3d1b);}function notSendMessagesQueue(_0x793da9){if(_0x793da9[_0xb038('0x5f')]){if(_0x793da9[_0xb038('0x4e')]===0x0&&_0x793da9['pTalking']===0x0){_0x793da9[_0xb038('0x5f')]=![];_0x793da9['available']=0x0;_0x793da9[_0xb038('0x60')]=0x0;_0x793da9[_0xb038('0x4d')]=_0xb038('0x61');ut['logger'](_0xb038('0x62'),_0x793da9[_0xb038('0x26')]+_0xb038('0x63'));}else{_0x793da9['message']=_0xb038('0x64');ut[_0xb038('0x65')](_0xb038('0x62'),_0x793da9[_0xb038('0x26')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x793da9);}}Preview[_0xb038('0xc')][_0xb038('0x23')]=function(){var _0x18d8eb=this;setInterval(function(){_0x18d8eb[_0xb038('0x66')]();},0x7cf);};Preview['prototype'][_0xb038('0x66')]=function(){var _0x269c7d=this['campaignsPreview'];this[_0xb038('0x16')]+=0x1;for(var _0x2848bd in _0x269c7d){if(_0x269c7d[_0xb038('0x67')](_0x2848bd)&&(_0x269c7d[_0x2848bd]['dialMethod']===_0xb038('0x68')||_0x269c7d[_0x2848bd][_0xb038('0x32')]==='booked')&&_0x269c7d[_0x2848bd]['type']===_0xb038('0x69')){if(this[_0xb038('0x16')]>0x7){this[_0xb038('0x16')]=0x0;this[_0xb038('0x6a')]();}}if(_0x269c7d[_0xb038('0x67')](_0x2848bd)&&_0x269c7d[_0x2848bd][_0xb038('0x32')]===_0xb038('0x68')&&_0x269c7d[_0x2848bd][_0xb038('0x25')]==='outbound'){if(_0x269c7d[_0x2848bd]['dialActive']){this['setMessage'](_0x269c7d[_0x2848bd]);if(_0x269c7d[_0x2848bd][_0xb038('0x6b')])this[_0xb038('0x6c')](_0x269c7d[_0x2848bd]);}else{notSendMessagesQueue(_0x269c7d[_0x2848bd]);}}}};Preview['prototype'][_0xb038('0x6d')]=function(_0x20b6af){var _0x10ed9e=this;this['sequence'][_0xb038('0xd')](function(){if(!_['isNil'](_0x10ed9e['actions'][_0x20b6af])){loggerAction[_0xb038('0x5b')](_0xb038('0x6e'),_0x20b6af,_0xb038('0x6f'),_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')],_0xb038('0x71'),JSON[_0xb038('0x58')](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]]['originated']),_0xb038('0x72'),JSON[_0xb038('0x58')](_0x10ed9e['campaignsPreview'][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]]['pTalking']),JSON[_0xb038('0x58')](_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x73')]),JSON[_0xb038('0x58')](_[_0xb038('0x74')](_0x10ed9e[_0xb038('0x14')][_0x20b6af],[_0xb038('0x75'),_0xb038('0x76'),_0xb038('0x77'),'ListId'])));return ami[_0xb038('0x78')]({'action':_0xb038('0x79'),'channel':_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x7a')]})[_0xb038('0x7b')](function(_0x2e1875){if(_0x2e1875['message']===_0xb038('0x7c')){setTimeout(function(){if(_0x10ed9e[_0xb038('0x14')][_0x20b6af]){ut[_0xb038('0x7d')](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]],_0xb038('0x7e'));if(_0x10ed9e['actions'][_0x20b6af][_0xb038('0x73')]===!![]){ut['decrementTalkink'](_0x10ed9e[_0xb038('0x11')][_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]],_0xb038('0x7e'));ut[_0xb038('0x7f')]('[Dialer][checkChannel][pTalking][Preview]'+_0x20b6af,_0x10ed9e['actions'][_0x20b6af]['queue']);}ut[_0xb038('0x7f')](_0xb038('0x80')+_0x20b6af,_0x10ed9e[_0xb038('0x14')][_0x20b6af][_0xb038('0x70')]);delete _0x10ed9e[_0xb038('0x14')][_0x20b6af];}},0x2328);}});}});};Preview[_0xb038('0xc')]['clearZombieChannels']=function(){var _0x27758c=this;loggerAction[_0xb038('0x5b')]('[action]',_['size'](this[_0xb038('0x14')]));for(var _0x4b7557 in this[_0xb038('0x14')]){if(_0x27758c['actions'][_0xb038('0x67')](_0x4b7557)){_0x27758c[_0xb038('0x6d')](_0x4b7557);}}};Preview[_0xb038('0xc')][_0xb038('0x6c')]=function(_0x4ee38b){var _0x32aea0=this;rpcDb[_0xb038('0x81')](_0x4ee38b['id'],ut[_0xb038('0x82')](this[_0xb038('0x15')]))[_0xb038('0x83')](function(_0x1246c8){if(!_[_0xb038('0x84')](_0x1246c8)){for(var _0x401f4c=0x0;_0x401f4c<_0x1246c8[_0xb038('0x85')];_0x401f4c+=0x1){if(ut[_0xb038('0x86')](_0x1246c8[_0x401f4c][_0xb038('0x87')])<_0x4ee38b[_0xb038('0x88')]*0x3c){if(_0x1246c8[_0x401f4c]['Agent']&&!_0x1246c8[_0x401f4c][_0xb038('0x89')][_0xb038('0x8a')]){_0x32aea0[_0xb038('0x8b')](_0x1246c8[_0x401f4c]['id'])[_0xb038('0x83')](ut[_0xb038('0x8c')]('[RecallMe]'))[_0xb038('0x7b')](ut['logger2'](_0xb038('0x8d')));}else{rpcDb[_0xb038('0x8e')](_0x1246c8[_0x401f4c]['id']);}}else{var _0x47e809=new Action(_0x1246c8[_0x401f4c],_0x4ee38b);_0x47e809[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));_0x4ee38b[_0xb038('0x3f')]+=0x1;ut[_0xb038('0x91')](_0x47e809,0x17,_0xb038('0x92'));if(_0x4ee38b[_0xb038('0x93')]){rpcDb[_0xb038('0x94')](ut[_0xb038('0x95')](_0x1246c8[_0x401f4c]));rpcDb[_0xb038('0x96')](_0x47e809,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb038('0x91')](_0x47e809,0x16,'RecallFailedTimeout');rpcDb[_0xb038('0x96')](_0x47e809,_0xb038('0x97'));rpcDb[_0xb038('0x98')](_0x47e809,_0xb038('0x97'));}}}}})[_0xb038('0x7b')](ut[_0xb038('0x8c')](_0xb038('0x99')));};Preview['prototype']['setMessage']=function(_0x24ea03){_0x24ea03[_0xb038('0x5f')]=!![];if(ut[_0xb038('0x9a')](_0x24ea03['loggedIn'])){_0x24ea03['message']=_0xb038('0x9b');}else if(!ut['isActive'](_0x24ea03[_0xb038('0x31')])){_0x24ea03['message']=_0xb038('0x61');}else if(!this['isTrunkReachable'](_0x24ea03[_0xb038('0x54')])){if(!this[_0xb038('0x9c')](_0x24ea03[_0xb038('0x9d')])){_0x24ea03[_0xb038('0x4d')]=_0xb038('0x9e');}else{_0x24ea03[_0xb038('0x4d')]='ACTIVE';}}else{_0x24ea03['message']=_0xb038('0x9f');}emitCampaignPreview(_0x24ea03);};Preview['prototype'][_0xb038('0xa0')]=function(_0x42f5dc,_0x2f4650,_0x538690){var _0x3071c8=this;var _0x5ea148=this[_0xb038('0x14')][_0x2f4650];var _0x218394=this[_0xb038('0x11')][_0x5ea148[_0xb038('0x70')]];var _0x40abb7;var _0x41b1d1=![];var _0x3e2b92=0x2;var _0x137d26=0x3;if(_0x218394){switch(_0x538690){case'1':_0x218394[_0xb038('0x3d')]+=0x1;_0x5ea148['countnosuchnumberretry']+=0x1;_0x5ea148['countglobal']=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x0,'NoSuchNumber');ami[_0xb038('0x24')]('custom:agentnosuchnumber',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xa2')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xa3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'0',_0x218394)[_0xb038('0x83')](function(_0x9440bc){_0x41b1d1=_0x9440bc[_0xb038('0xa5')]==0x1;_0x3e2b92=_0x218394[_0xb038('0xa6')];_0x137d26=_0x218394[_0xb038('0xa7')];if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xac'));}else{if(_0x5ea148[_0xb038('0xad')]>=_0x218394[_0xb038('0xae')]){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xad'),_0x218394[_0xb038('0xa6')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];}else{_0x5ea148[_0xb038('0xad')]++;logger[_0xb038('0x5b')](_0xb038('0xb3'),_0x5ea148[_0xb038('0xad')]);logger[_0xb038('0x5b')]('id',_0x5ea148[_0xb038('0xb4')]);_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148['idContact'],'field':{'countnosuchnumberretry':_0x5ea148['countnosuchnumberretry']}})[_0xb038('0x83')](function(){_0x3071c8['swapAdditionalPhones'](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case'ANSWER':var _0x5da505=moment()['format'](_0xb038('0x90'));_0x5ea148[_0xb038('0xb6')]=_0x5da505;_0x5ea148['answertime']=_0x5da505;_0x5ea148[_0xb038('0x73')]=!![];_0x218394[_0xb038('0x29')]+=0x1;logger[_0xb038('0x5b')](_0xb038('0xb7'),_0x5ea148[_0xb038('0xb8')],_0xb038('0xb9'),_0x218394[_0xb038('0x26')],_0xb038('0x72'),_0x218394[_0xb038('0x29')]);ami[_0xb038('0x24')]('custom:agentconnect',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xba'),this[_0xb038('0x11')][_0x5ea148[_0xb038('0x70')]]));if(_0x218394[_0xb038('0xbb')]){ami[_0xb038('0x24')](_0xb038('0xbc'),ut['buildAcw'](_0x5ea148));}break;case'16':ami[_0xb038('0x24')](_0xb038('0xbd'),ut[_0xb038('0xa1')](_0x5ea148,'complete',this['campaignsPreview'][_0x5ea148[_0xb038('0x70')]]));emitVoiceQueueChannelRemove(ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xbe')));_0x218394['outboundAnswerCallsDay']+=0x1;_0x218394[_0xb038('0x2d')]+=0x1;_0x218394[_0xb038('0x27')]+=0x1;ut['decrementTalkink'](_0x218394,_0xb038('0xbf'));_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x4,_0xb038('0xc1'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xc2'));rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xc3'));rpcDb[_0xb038('0xc4')](_0x5ea148);_0x218394[_0xb038('0x2a')]+=_0x5ea148[_0xb038('0xc5')];_0x218394[_0xb038('0xc6')]+=_0x5ea148[_0xb038('0xc5')];logger['info'](_0xb038('0xc7'),_0x5ea148[_0xb038('0xb8')],_0xb038('0xb9'),_0x218394[_0xb038('0x26')],_0xb038('0x72'),_0x218394[_0xb038('0x29')]);delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];break;case'BUSY':_0x218394[_0xb038('0x38')]+=0x1;_0x5ea148[_0xb038('0xc8')]+=0x1;_0x5ea148['countglobal']=ut[_0xb038('0xa8')](_0x5ea148);ut['logCustomer'](_0x5ea148,0x5,'Busy');_0x3e2b92=_0x218394[_0xb038('0xc9')];_0x137d26=_0x218394['callAdditionalPhoneAfterMin'];ami[_0xb038('0x24')]('custom:agentbusy',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xca')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xcb'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'5',_0x218394)[_0xb038('0x83')](function(_0x11b8db){_0x41b1d1=_0x11b8db[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xcc'));}else{if(_0x5ea148['countbusyretry']>=_0x218394[_0xb038('0xcd')]){rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xcb'));}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xc8'),_0x218394[_0xb038('0xc9')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148[_0xb038('0xce')]);}}}else{_0x5ea148[_0xb038('0xc8')]++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148['idContact'],'field':{'countbusyretry':_0x5ea148[_0xb038('0xc8')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xd0'):_0x218394[_0xb038('0x3c')]+=0x1;_0x5ea148[_0xb038('0xd1')]+=0x1;_0x5ea148['countglobal']=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x3,_0xb038('0xd2'));_0x3e2b92=_0x218394[_0xb038('0xd3')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')]('custom:agentnoanswer',ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xd4')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xd5'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'3',_0x218394)[_0xb038('0x83')](function(_0x2532ed){_0x41b1d1=_0x2532ed[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xd6'));}else{if(_0x5ea148[_0xb038('0xd1')]>=_0x218394[_0xb038('0xd7')]){rpcDb['createCustomerFinal'](_0x5ea148,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xb038('0xaf')](ut[_0xb038('0xb0')](_0x5ea148,_0xb038('0xd1'),_0x218394['dialNoAnswerRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148[_0xb038('0xce')]);}}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148['idContact'],'field':{'countnoanswerretry':_0x5ea148['countnoanswerretry']}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(){});});}});break;case _0xb038('0xd8'):_0x218394[_0xb038('0x39')]+=0x1;_0x5ea148[_0xb038('0xd9')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x8,_0xb038('0xda'));_0x3e2b92=_0x218394[_0xb038('0xdb')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')](_0xb038('0xdc'),ut[_0xb038('0xa1')](_0x5ea148,'congestion'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xdd'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'8',_0x218394)['then'](function(_0x28e17e){_0x41b1d1=_0x28e17e['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5ea148['countcongestionretry']>=_0x218394['dialCongestionMaxRetry']){rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xdd'));}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,_0xb038('0xd9'),_0x218394['dialBusyRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148['countcongestionretry']++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countcongestionretry':_0x5ea148[_0xb038('0xd9')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xde'):_0x218394['outboundRejectCallsDay']+=0x1;_0x5ea148[_0xb038('0xdf')]+=0x1;_0x5ea148['countglobal']=ut['totalGlobal'](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x14,_0xb038('0xe0'));_0x3e2b92=_0x218394[_0xb038('0xe1')];_0x137d26=_0x218394[_0xb038('0xa7')];ami[_0xb038('0x24')](_0xb038('0xe2'),ut[_0xb038('0xa1')](_0x5ea148,'agentreject'));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xe3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'20',_0x218394)[_0xb038('0x83')](function(_0xaa45fd){_0x41b1d1=_0xaa45fd['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0x14,_0xb038('0xe0'));rpcDb['createCustomerFinal'](_0x40abb7,_0xb038('0xe4'));}else{if(_0x5ea148[_0xb038('0xdf')]>=_0x218394['dialAgentRejectMaxRetry']){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,'countagentrejectretry',_0x218394['dialAgentRejectRetryFrequency']),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case _0xb038('0xe5'):_0x218394['outboundAbandonedCallsDay']+=0x1;_0x5ea148[_0xb038('0xe6')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut['totalGlobal'](_0x5ea148);ut['logCustomer'](_0x5ea148,0xb,'Abandoned');rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xe7'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'11',_0x218394)['then'](function(_0x9687eb){_0x41b1d1=_0x9687eb[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut['cloneAction'](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xe7'));}else{if(_0x5ea148['countabandonedetry']>=_0x218394[_0xb038('0xe8')]){rpcDb[_0xb038('0x98')](_0x5ea148,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xb038('0xaf')](ut['scheduledAt'](_0x5ea148,'countabandonedretry',_0x218394[_0xb038('0xe9')]),_0x5ea148[_0xb038('0xb1')],_0x5ea148['activeContact']);}}}else{_0x5ea148['countnoanswerretry']++;_0x3071c8[_0xb038('0xb5')]({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});break;case'18':_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xea')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x12,_0x42f5dc[_0xb038('0xeb')]||_0x42f5dc[_0xb038('0xec')]);ami[_0xb038('0x24')](_0xb038('0xed'),ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xee')));rpcDb[_0xb038('0x96')](_0x5ea148,'[callProgressDetectingCustomer][hangupInAMD]');_0x3071c8[_0xb038('0xa4')](_0x5ea148,'18',_0x218394)['then'](function(_0x567ae0){_0x41b1d1=_0x567ae0['additional']==0x1;if(!_0x41b1d1){if(ut[_0xb038('0xa8')](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0x12,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xef'));}else{rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xef'));}}else{_0x5ea148[_0xb038('0xd1')]++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(){});});}});delete this[_0xb038('0x14')][_0x42f5dc['linkedid']];break;case'19':_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0x13,_0x42f5dc['cause-txt']||_0x42f5dc[_0xb038('0xec')]);ami[_0xb038('0x24')](_0xb038('0xed'),ut[_0xb038('0xa1')](_0x5ea148,_0xb038('0xee')));rpcDb[_0xb038('0x96')](_0x5ea148,_0xb038('0xf0'));_0x3071c8['verifyAdditionalPhones'](_0x5ea148,'18',_0x218394)['then'](function(_0x3927c9){_0x41b1d1=_0x3927c9[_0xb038('0xa5')]==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394['dialGlobalMaxRetry']){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,'Global');rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xf0'));}else{rpcDb[_0xb038('0x98')](_0x5ea148,_0xb038('0xf0'));}}else{_0x5ea148['countnoanswerretry']++;_0x3071c8['incrementPreviewCounters']({'id':_0x5ea148[_0xb038('0xb4')],'field':{'countnoanswerretry':_0x5ea148[_0xb038('0xd1')]}})[_0xb038('0x83')](function(){_0x3071c8['swapAdditionalPhones'](_0x5ea148,_0x3e2b92,_0x137d26)[_0xb038('0x83')](function(){});});}});delete this[_0xb038('0x14')][_0x42f5dc['linkedid']];break;default:if(_0x5ea148[_0xb038('0x73')]){ut['decrementTalkink'](_0x218394,_0xb038('0xf1'));ut[_0xb038('0x7f')](_0xb038('0xf2')+_0x218394[_0xb038('0x26')],_0x42f5dc);}_0x218394[_0xb038('0x41')]+=0x1;_0x5ea148[_0xb038('0xc0')]=ut[_0xb038('0xa8')](_0x5ea148);ut[_0xb038('0x91')](_0x5ea148,0xc,_0x42f5dc[_0xb038('0xeb')]||_0x42f5dc[_0xb038('0xec')]);_0x3e2b92=_0x218394['dialAgentRejectRetryFrequency'];_0x137d26=_0x218394[_0xb038('0xa7')];rpcDb['createCustomerHistory'](_0x5ea148,_0xb038('0xf3'));_0x3071c8[_0xb038('0xa4')](_0x5ea148,'20',_0x218394)[_0xb038('0x83')](function(_0x3a6168){_0x41b1d1=_0x3a6168['additional']==0x1;if(!_0x41b1d1){if(ut['totalGlobal'](_0x5ea148)>=_0x218394[_0xb038('0xa9')]){_0x40abb7=ut[_0xb038('0xaa')](_0x5ea148,0xf,_0xb038('0xab'));rpcDb[_0xb038('0x98')](_0x40abb7,_0xb038('0xf4'));}else{rpcDb['createCustomerFinal'](_0x5ea148,_0xb038('0xf4'));}delete this[_0xb038('0x14')][_0x42f5dc[_0xb038('0xb2')]];}else{_0x3071c8[_0xb038('0xcf')](_0x5ea148,_0x3e2b92,_0x137d26)['then'](function(_0x2efb3b){});}});}if(!(_0x5ea148['dialAnswer']&&_0x538690==='16')){ut[_0xb038('0x7d')](_0x218394,_0xb038('0xf5'));logger[_0xb038('0x5b')](_0xb038('0xf6'),_0x5ea148[_0xb038('0xb8')],'\x20Queue',_0x218394['name'],_0xb038('0x71'),_0x218394[_0xb038('0x4e')]);}if(_0x538690!=='ANSWER'){delete this['actions'][_0x42f5dc[_0xb038('0xb2')]];delete this['actions'][_0x42f5dc[_0xb038('0xf7')]];}}};Preview[_0xb038('0xc')]['callProgressDetectingAgent']=function(_0x2d3a9b,_0x43a956,_0x4db96a){if(_[_0xb038('0xf8')](_0x43a956)&&_0xb038('0xf9')!==typeof _0x43a956){return;}if(_[_0xb038('0xf8')](_0x4db96a)&&_0xb038('0xf9')!==typeof _0x4db96a){return;}switch(_0x4db96a[_0xb038('0xfa')]){case'0':ut[_0xb038('0xfb')](_0x2d3a9b,0x0,_0xb038('0xfc'));rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0xfe'));break;case'3':ut[_0xb038('0xfb')](_0x2d3a9b,0x3,'NoAnswer');rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0xff'));break;case'5':ut['logAgent'](_0x2d3a9b,0x5,'Busy');rpcDb['createAgentHistory'](_0x2d3a9b,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xb038('0xfb')](_0x2d3a9b,0x8,_0xb038('0xda'));rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0x100'));break;case'22':ut[_0xb038('0xfb')](_0x2d3a9b,0x16,_0xb038('0x101'));rpcDb['createAgentHistory'](_0x2d3a9b,_0xb038('0x102'));break;default:ut['logAgent'](_0x2d3a9b,0xc,_0x4db96a['reason']);rpcDb[_0xb038('0xfd')](_0x2d3a9b,_0xb038('0x100'));}ut[_0xb038('0x7d')](_0x43a956,_0xb038('0x103'));logger['info'](_0xb038('0x104'),_0x2d3a9b[_0xb038('0xb8')],_0xb038('0xb9'),_0x43a956['name'],_0xb038('0x71'),_0x43a956[_0xb038('0x4e')]);delete this['actions'][_0x2d3a9b['uniqueid']];};Preview[_0xb038('0xc')][_0xb038('0xa4')]=function(_0x4677ef,_0xf6c495,_0x212139){return BPromise[_0xb038('0x105')]()[_0xb038('0x83')](cmHopperAdditionalPhone[_0xb038('0xa4')](_0x4677ef,_0xf6c495,_0x212139))[_0xb038('0x7b')](logger[_0xb038('0x5b')]('[verifyAdditionalPhone]\x20'));};Preview[_0xb038('0xc')]['swapAdditionalPhones']=function(_0x2b7f91,_0xaab577,_0x4b32cc){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0xb038('0xcf')](_0x2b7f91,_0xaab577,_0x4b32cc))[_0xb038('0x7b')](logger[_0xb038('0x5b')]('[swapAdditionalPhone]\x20'));};Preview[_0xb038('0xc')][_0xb038('0xb5')]=function(_0x317881){return BPromise[_0xb038('0x105')]()[_0xb038('0x83')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x317881))['catch'](logger[_0xb038('0x5b')]('[incrementPreviewCounters]\x20'));};Preview[_0xb038('0xc')][_0xb038('0x106')]=function(_0x3838c5,_0x564492,_0x1f11de,_0x71799e,_0x564acf){var _0x1f8535=this;return new BPromise(function(_0x43343f,_0x1e221f){if(_[_0xb038('0x84')](_0x564492)||_[_0xb038('0x84')](_0x564492[_0xb038('0x107')])||_[_0xb038('0x84')](_0x564492[_0xb038('0x108')])||_['isNil'](_0x564492['VoiceQueueId'])){_0x1e221f(ut[_0xb038('0x4d')](_0xb038('0x109'),_0x71799e,_0x564acf));return;}var _0x417a64=uuid['v4']();var _0x3d24a3=_0x1f8535[_0xb038('0x11')][_0x564492[_0xb038('0x6f')][_0xb038('0x26')]];var _0x3dfdd9=_0x1f11de?_0x1f8535['agents'][_0x1f11de]['id']:undefined;_0x1f8535[_0xb038('0x14')][_0x417a64]=new Action(_0x564492,_0x3d24a3,_0x417a64,_0x1f11de,_0x3dfdd9);var _0x2623d5=_0x1f8535['actions'][_0x417a64];_0x2623d5[_0xb038('0xb1')]=_0x71799e;_0x2623d5[_0xb038('0xce')]=_0x564acf;_0x2623d5[_0xb038('0x10a')]=_0x1f11de;if(_[_0xb038('0x10b')](_0x3838c5)){_0x1f8535[_0xb038('0x10c')](_0x2623d5,_0x3d24a3,_0x564492,_0x1f11de)[_0xb038('0x83')](function(_0x30477c){logger[_0xb038('0x5b')](_0xb038('0x10d'),'Queue:\x20'+_0x2623d5[_0xb038('0x70')]+_0xb038('0x10e')+_0x2623d5[_0xb038('0xb4')],JSON[_0xb038('0x58')](_0x30477c));ami[_0xb038('0x24')](_0xb038('0x10f'),ut[_0xb038('0xa1')](_0x2623d5,_0xb038('0x110'),_0x1f8535[_0xb038('0x11')][_0x2623d5[_0xb038('0x70')]]));_0x43343f(ut[_0xb038('0x4d')]('Calling'));})['catch'](function(_0x76e7d6){ut[_0xb038('0x65')]('[Preview][execCall][failure]',_0x76e7d6);_0x1e221f(ut[_0xb038('0x4d')](_0xb038('0x111'),_0x71799e,_0x564acf));});}else{_0x3d24a3[_0xb038('0x37')]+=0x1;ut['logBlacklist'](_0x2623d5);rpcDb['createHistory'](_0x2623d5,_0xb038('0x112'));delete _0x1f8535[_0xb038('0x14')][_0x417a64];_0x1e221f(ut['message']('Contact\x20in\x20black\x20List',_0x71799e,_0x564acf));}});};Preview[_0xb038('0xc')][_0xb038('0x9c')]=function(_0x146ee9){return!_[_0xb038('0x84')](_0x146ee9)&&!_[_0xb038('0x84')](_0x146ee9['name'])&&!_[_0xb038('0x84')](_0x146ee9[_0xb038('0x55')])&&_0x146ee9[_0xb038('0x55')]&&!_['isNil'](this[_0xb038('0x13')][util[_0xb038('0x59')]('SIP/%s',_0x146ee9[_0xb038('0x26')])])&&!_[_0xb038('0x84')](this[_0xb038('0x13')][util[_0xb038('0x59')]('SIP/%s',_0x146ee9['name'])]['status'])&&(this[_0xb038('0x13')][util['format'](_0xb038('0x113'),_0x146ee9[_0xb038('0x26')])][_0xb038('0x79')]===_0xb038('0x114')||this[_0xb038('0x13')][util[_0xb038('0x59')](_0xb038('0x113'),_0x146ee9[_0xb038('0x26')])]['status']===_0xb038('0x115'));};Preview[_0xb038('0xc')][_0xb038('0x8b')]=function(_0x4af33a,_0x4bbc45){var _0x87d5c7=this;return new BPromise(function(_0x1e4c7f,_0x2b241f){_0x87d5c7[_0xb038('0x116')](_0x4af33a,_0x4bbc45)['then'](function(_0x2c74d6){_0x1e4c7f(_[_0xb038('0x74')](_0x2c74d6,[_0xb038('0x4d')]));})['catch'](function(_0x4a7bc4){if(_0x4a7bc4[_0xb038('0x117')]){rpcDb[_0xb038('0x118')](_0x4af33a);}if(_0x4a7bc4[_0xb038('0x55')]){rpcDb[_0xb038('0x8e')](_0x4af33a);}_0x2b241f(_[_0xb038('0x74')](_0x4a7bc4,['message']));});});};Preview[_0xb038('0xc')]['execRun']=function(_0xfa8336,_0x4a4570){var _0x489ee6=this;return new BPromise(function(_0x7c841a,_0x12eec4){var _0xcc4f24,_0x4f1755;rpcDb[_0xb038('0x119')](_0xfa8336)['then'](function(_0x5590df){if(!_['isNil'](_0x5590df[0x0])){_0x4f1755=_0x5590df[0x0][_0xb038('0x11a')]?![]:!![];_0xcc4f24=_0x5590df[0x0]['recallme']?!![]:![];_0xcc4f24=_0x4a4570?!![]:_0xcc4f24;}var _0x1da10e=_0x489ee6[_0xb038('0x11b')](_0x5590df);if(_0x1da10e[_0xb038('0x11c')]){rpcDb[_0xb038('0x11d')](_['pick'](_0x5590df[0x0],[_0xb038('0x77'),'phone']))[_0xb038('0x83')](function(_0x7a693d){_0x489ee6[_0xb038('0x106')](_0x7a693d,_0x5590df[0x0],_0x4a4570,_0x4f1755,_0xcc4f24)[_0xb038('0x83')](function(_0x120845){_0x7c841a(_0x120845);})[_0xb038('0x7b')](function(_0x54f188){_0x12eec4(_0x54f188);});})[_0xb038('0x7b')](function(_0x7049d2){ut[_0xb038('0x65')](_0xb038('0x11e'),_0x7049d2);_0x12eec4(ut[_0xb038('0x4d')]('Call\x20unsuccessful',_0x4f1755,_0xcc4f24));});}else{_0x12eec4(ut[_0xb038('0x4d')](_0x1da10e[_0xb038('0x4d')],_0x4f1755,_0xcc4f24));}})[_0xb038('0x7b')](function(_0x1b1750){ut['logger'](_0xb038('0x11f'),_0x1b1750);_0x12eec4(ut[_0xb038('0x4d')](_0xb038('0x120'),![],!![]));});});};Preview[_0xb038('0xc')][_0xb038('0x11b')]=function(_0x1f19f8){if(_[_0xb038('0x84')](_0x1f19f8)||_[_0xb038('0x10b')](_0x1f19f8)||!_['isNil'](_0x1f19f8[0x0][_0xb038('0x89')])&&_[_0xb038('0x84')](_0x1f19f8[0x0]['Agent']['name'])){ut[_0xb038('0x65')](_0xb038('0x121'),_0x1f19f8);return{'isValid':![],'message':_0xb038('0x122')};}var _0x2584d6=this[_0xb038('0x11')][_0x1f19f8[0x0]['Queue'][_0xb038('0x26')]];_0x2584d6[_0xb038('0x4d')]=_0xb038('0x9f');if(_[_0xb038('0x84')](_0x2584d6)){ut[_0xb038('0x65')](_0xb038('0x123'),_0x2584d6);return{'isValid':![],'message':_0xb038('0x124')};}if(!this[_0xb038('0x9c')](_0x2584d6[_0xb038('0x54')])){ut[_0xb038('0x65')](_0xb038('0x125'),_0xb038('0x126')+_0x2584d6['name']+_0xb038('0x127'));if(!this['isTrunkReachable'](_0x2584d6[_0xb038('0x9d')])){ut['logger'](_0xb038('0x125'),_0x2584d6[_0xb038('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xb038('0x128')};}}if(!ut['isActive'](_0x2584d6[_0xb038('0x31')])){ut['logger'](_0xb038('0x129'),_0x2584d6[_0xb038('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0xb038('0x126')+_0x2584d6[_0xb038('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0xb038('0x10c')]=function(_0x5b4c49,_0x48cf7a,_0x3c486c,_0x53c8ec){var _0x4be442=this;return new BPromise(function(_0x5371b9,_0x3db5c4){var _0x2f64bc=_0x5b4c49[_0xb038('0xb8')];var _0x29403e=_0x4be442[_0xb038('0x9c')](_0x48cf7a[_0xb038('0x54')])?util[_0xb038('0x59')](_0xb038('0x12a'),_0x48cf7a['Trunk'][_0xb038('0x26')],_[_0xb038('0x84')](_0x48cf7a[_0xb038('0x35')])?'':_0x48cf7a['dialPrefix'][_0xb038('0x12b')]()||'',_0x48cf7a[_0xb038('0x12c')]>0x0?_0x3c486c[_0xb038('0x108')][_0xb038('0x12d')](_0x48cf7a['dialCutDigit']):_0x3c486c['phone']):util[_0xb038('0x59')](_0xb038('0x12a'),_['isNil'](_0x48cf7a['TrunkBackup'])?_0x48cf7a[_0xb038('0x54')]['name']:_0x48cf7a[_0xb038('0x9d')][_0xb038('0x26')],_[_0xb038('0x84')](_0x48cf7a['dialPrefix'])?'':_0x48cf7a[_0xb038('0x35')][_0xb038('0x12b')]()||'',_0x48cf7a['dialCutDigit']>0x0?_0x3c486c[_0xb038('0x108')][_0xb038('0x12d')](_0x48cf7a[_0xb038('0x12c')]):_0x3c486c[_0xb038('0x108')]);var _0x253215=_0x4be442[_0xb038('0x9c')](_0x48cf7a[_0xb038('0x54')])?ut[_0xb038('0x12e')](_0x48cf7a['Trunk'][_0xb038('0x56')],_0x48cf7a[_0xb038('0x12f')],_0x48cf7a[_0xb038('0x130')]>0x0?ut[_0xb038('0x131')](_0x48cf7a[_0xb038('0x33')],_0x48cf7a[_0xb038('0x130')]):_0x48cf7a[_0xb038('0x33')]):ut[_0xb038('0x12e')](_[_0xb038('0x84')](_0x48cf7a['TrunkBackup'])?_0x48cf7a[_0xb038('0x54')][_0xb038('0x56')]:_0x48cf7a[_0xb038('0x9d')][_0xb038('0x56')],_0x48cf7a[_0xb038('0x12f')],_0x48cf7a[_0xb038('0x130')]>0x0?ut['getCallerIdRandom'](_0x48cf7a['dialOriginateCallerIdNumber'],_0x48cf7a[_0xb038('0x130')]):_0x48cf7a['dialOriginateCallerIdNumber']);if(_0x253215){_0x5b4c49[_0xb038('0x132')]=ut[_0xb038('0x133')](_0x253215);_0x5b4c49[_0xb038('0x134')]=ut[_0xb038('0x135')](_0x253215);}var _0x59801f=ut['addVariables'](_0x48cf7a,_0x3c486c,_0x29403e,_0x253215,_0x2f64bc,_0x5b4c49);_['merge'](_0x5b4c49,ut[_0xb038('0x136')](_0x59801f));_0x5b4c49[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));ami[_0xb038('0x78')](ut[_0xb038('0x137')](_0x5b4c49,_0x48cf7a,_0x59801f,_0x5b4c49['activeContact'],_0x53c8ec))[_0xb038('0x83')](function(_0x48e14f){_0x48cf7a[_0xb038('0x4e')]+=0x1;logger['info'](_0xb038('0x138'),_0x2f64bc,_0xb038('0xb9'),_0x48cf7a['name'],_0xb038('0x71'),_0x48cf7a[_0xb038('0x4e')]);_0x5371b9(_0x48e14f);})[_0xb038('0x7b')](function(_0x37a25d){ut[_0xb038('0xfb')](_0x5b4c49,0xe,_0xb038('0x139'));rpcDb[_0xb038('0xfd')](_0x5b4c49,_0xb038('0x13a'));_0x3db5c4(_0x37a25d);});});};Preview['prototype']['syncNewExten']=function(_0x4dfe77){if(this['actions'][_0x4dfe77[_0xb038('0xb2')]]){this['actions'][_0x4dfe77[_0xb038('0xb2')]]['channel']=_0x4dfe77[_0xb038('0x7a')];}};Preview[_0xb038('0xc')][_0xb038('0x18')]=function(_0xed23a9){var _0x1cf562=this;var _0x48863a=this['actions'][_0xed23a9[_0xb038('0x13b')]];if(_0x48863a){if(_0x48863a[_0xb038('0x10a')]&&this[_0xb038('0x15')][_0x48863a['lookAgent']]){ut[_0xb038('0x13c')](_0x48863a,this[_0xb038('0x15')][_0x48863a['lookAgent']][_0xb038('0x26')],this[_0xb038('0x15')][_0x48863a['lookAgent']]['id']);}var _0x1f0896=_[_0xb038('0x13d')](_0x48863a);_0x1f0896[_0xb038('0xb6')]=moment()[_0xb038('0x59')](_0xb038('0x90'));var _0x4eb901=_0x1cf562[_0xb038('0x11')][_0x48863a[_0xb038('0x70')]];if(ut['isFailure'](_0xed23a9[_0xb038('0x13e')])){if(_0x48863a['unlockAgent']){rpcDb['unlockContact'](_0x48863a[_0xb038('0xb4')]);}if(_0x48863a[_0xb038('0xce')]){rpcDb[_0xb038('0x8e')](_0x48863a[_0xb038('0xb4')]);}ami[_0xb038('0x24')](_0xb038('0x13f'),ut[_0xb038('0xa1')](_0x48863a,_0xb038('0x140'),this[_0xb038('0x11')][_0x48863a[_0xb038('0x70')]]));this[_0xb038('0x141')](_0x1f0896,_0x4eb901,_0xed23a9);}else{_0x48863a[_0xb038('0x8f')]=moment()[_0xb038('0x59')](_0xb038('0x90'));ut[_0xb038('0xfb')](_0x1f0896,0x4,'Answer');rpcDb['createAgentHistory'](_0x1f0896,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xb038('0xc')][_0xb038('0x1a')]=function(_0x263aee){var _0x42faf6=this;var _0x444219=this[_0xb038('0x14')][_0x263aee[_0xb038('0xb2')]];var _0x43c55f;if(_0x444219){_0x43c55f=this[_0xb038('0x11')][_0x444219[_0xb038('0x70')]];logger['info'](_0xb038('0x142'),_0x263aee[_0xb038('0xb2')],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],'pTalking:\x20',_0x43c55f[_0xb038('0x29')]);}if(this[_0xb038('0x14')][_0x263aee['linkedid']]&&_0x263aee[_0xb038('0xb2')]!==_0x263aee[_0xb038('0xb8')]){if(_0x263aee[_0xb038('0x143')]==='16'&&this['actions'][_0x263aee['linkedid']]['dialAnswer']){this[_0xb038('0xa0')](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}else if(this[_0xb038('0x14')][_0x263aee[_0xb038('0xb2')]][_0xb038('0x73')]){logger['info'](_0xb038('0x144'),_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')],'\x20Queue',_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this[_0xb038('0xa0')](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}}else if(_0x444219&&_[_0xb038('0x84')](_0x444219[_0xb038('0x145')])&&_0x43c55f[_0xb038('0x146')]&&_0x263aee[_0xb038('0xb2')]===_0x263aee['uniqueid']&&_[_0xb038('0x84')](_0x263aee[_0xb038('0xfa')])&&_0x263aee[_0xb038('0x143')]==='16'&&_0x263aee['channelstate']==='6'&&_[_0xb038('0xf8')](_0x444219['transfer'])){if(_0x444219[_0xb038('0xb1')]){rpcDb[_0xb038('0x118')](_0x444219[_0xb038('0xb4')]);}if(_0x444219[_0xb038('0xce')]){rpcDb['disableContact'](_0x444219[_0xb038('0xb4')]);}_0x263aee['reason']='22';this[_0xb038('0x141')](_0x444219,_0x43c55f,_0x263aee);}else if(_0x444219&&_0x444219[_0xb038('0x147')]){if(_0x263aee[_0xb038('0x143')]==='16'&&this[_0xb038('0x14')][_0x263aee['linkedid']]['dialAnswer']){logger[_0xb038('0x5b')](_0xb038('0x148'),_0x263aee[_0xb038('0xb2')],_0x263aee['cause'],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this['callProgressDetectingCustomer'](_0x263aee,_0x263aee['linkedid'],_0x263aee[_0xb038('0x143')]);}else if(this['actions'][_0x263aee[_0xb038('0xb2')]][_0xb038('0x73')]){logger[_0xb038('0x5b')](_0xb038('0x144'),_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')],_0xb038('0xb9'),_0x43c55f[_0xb038('0x26')],_0xb038('0x72'),_0x43c55f[_0xb038('0x29')]);this['callProgressDetectingCustomer'](_0x263aee,_0x263aee[_0xb038('0xb2')],_0x263aee[_0xb038('0x143')]);}}};Preview['prototype']['syncDialEnd']=function(_0x161579){if(this[_0xb038('0x14')][_0x161579[_0xb038('0xf7')]]&&_0x161579[_0xb038('0xf7')]!==_0x161579[_0xb038('0x149')]){this['callProgressDetectingCustomer'](_0x161579,_0x161579['destlinkedid'],_0x161579[_0xb038('0xec')]);}};Preview[_0xb038('0xc')][_0xb038('0x1c')]=function(_0x586d75){if(this[_0xb038('0x14')][_0x586d75['linkedid']]&&_0x586d75[_0xb038('0xb2')]!==_0x586d75[_0xb038('0xb8')]&&!this[_0xb038('0x14')][_0x586d75['linkedid']]['dialAnswer']){if(_0x586d75[_0xb038('0x143')]==='1'){this['callProgressDetectingCustomer'](_0x586d75,_0x586d75[_0xb038('0xb2')],_0x586d75[_0xb038('0x143')]);}}};Preview[_0xb038('0xc')][_0xb038('0x14a')]=function(_0x2fdecb,_0x20f0a6,_0x31e08c){if(this[_0xb038('0x14')][_0x2fdecb]){if(_[_0xb038('0x84')](this['actions'][_0x2fdecb]['variables'])){this[_0xb038('0x14')][_0x2fdecb][_0xb038('0x14b')]={};}this[_0xb038('0x14')][_0x2fdecb][_0xb038('0x14b')][_0x20f0a6]=_0x31e08c;}};Preview[_0xb038('0xc')][_0xb038('0x14c')]=function(_0x1174b8){try{if(!_[_0xb038('0x84')](_0x1174b8)){if(ut[_0xb038('0x14d')](_['keys'](_0x1174b8[_0xb038('0x14e')])[0x0])){this[_0xb038('0x14a')](_0x1174b8[_0xb038('0xb8')],_[_0xb038('0x14f')](_0x1174b8['variable'])[0x0],_0x1174b8[_0xb038('0x150')]);}}}catch(_0x192d55){logger[_0xb038('0x151')]('[syncVarSet][Preview]',util[_0xb038('0x152')](_0x192d55,{'showHidden':![],'depth':null}));}};Preview[_0xb038('0xc')][_0xb038('0x21')]=function(_0x1f61a5){if(_0x1f61a5){if(this['actions'][_0x1f61a5[_0xb038('0x153')]]){this['actions'][_0x1f61a5[_0xb038('0x153')]][_0xb038('0x147')]=!![];}}};Preview['prototype'][_0xb038('0x22')]=function(_0xe47dc1){if(_0xe47dc1){if(this[_0xb038('0x14')][_0xe47dc1[_0xb038('0x154')]]){this['actions'][_0xe47dc1[_0xb038('0x154')]][_0xb038('0x147')]=!![];}}};module[_0xb038('0x155')]=Preview; \ No newline at end of file +var _0x6334=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','loopCampaigns','syncCampaigns','prototype','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','actions','queue','pTalking:\x20','dialAnswer','contactId','UserId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','info','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','createCustomerHistory','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','linkedid','BUSY','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','additional','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','checkIsBlackList','pick','phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Queue','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','syncOriginateResponse','actionid','clone','responsetime','isFailure','[syncHangup][talking]','cause','statedesc','dialQueueProject','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x137a05,_0x4b306f){var _0x4627f7=function(_0x3e0d6b){while(--_0x3e0d6b){_0x137a05['push'](_0x137a05['shift']());}};_0x4627f7(++_0x4b306f);}(_0x6334,0x119));var _0x4633=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x6334[_0x22c684];return _0x39fcbb;};'use strict';var util=require(_0x4633('0x0'));var _=require(_0x4633('0x1'));var BPromise=require(_0x4633('0x2'));var uuid=require(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var md5=require(_0x4633('0x5'));var Redis=require('ioredis');var config=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var loggerAction=require(_0x4633('0x7'))(_0x4633('0x9'));var ami=require(_0x4633('0xa'));var rpcDb=require(_0x4633('0xb'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x4633('0xc'));var ut=require('./util/util');config[_0x4633('0xd')]=_[_0x4633('0xe')](config['redis'],{'host':_0x4633('0xf'),'port':0x18eb});var io=require(_0x4633('0x10'))(new Redis(config[_0x4633('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x4633('0x11')]=function(_0x2f07fa){this['tail']=this[_0x4633('0x12')]?this[_0x4633('0x12')][_0x4633('0x13')](_0x2f07fa):_0x2f07fa();};function Preview(_0x224384){this['sequence']=new Sequence();this[_0x4633('0x14')]=_0x224384[_0x4633('0x15')];this[_0x4633('0x16')]=_0x224384['trunks'];this['actions']={};this['agents']=_0x224384[_0x4633('0x17')];this[_0x4633('0x18')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x4633('0x19')](this));ami['on']('hangup',this[_0x4633('0x1a')][_0x4633('0x19')](this));ami['on'](_0x4633('0x1b'),this[_0x4633('0x1c')]['bind'](this));ami['on'](_0x4633('0x1d'),this[_0x4633('0x1e')][_0x4633('0x19')](this));ami['on']('newexten',this[_0x4633('0x1f')][_0x4633('0x19')](this));ami['on'](_0x4633('0x20'),this[_0x4633('0x21')][_0x4633('0x19')](this));ami['on']('attendedtransfer',this[_0x4633('0x22')][_0x4633('0x19')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4633('0x19')](this));this['loopCampaigns'](this[_0x4633('0x14')]);}function emit(_0x5b5011,_0x57dfb8,_0x109472){io['to'](_0x5b5011)[_0x4633('0x23')](_0x57dfb8,_0x109472);}function emitCampaignPreview(_0x23bc5e){if(_0x23bc5e[_0x4633('0x24')]===_0x4633('0x25')){var _0x2d46f7={'id':_0x23bc5e['id'],'name':_0x23bc5e['name'],'strategy':_0x23bc5e[_0x4633('0x26')],'answered':_0x23bc5e['answered'],'available':_0x23bc5e[_0x4633('0x27')],'loggedIn':_0x23bc5e[_0x4633('0x28')],'pTalking':_0x23bc5e[_0x4633('0x29')],'sumBillable':_0x23bc5e[_0x4633('0x2a')],'sumDuration':_0x23bc5e[_0x4633('0x2b')],'sumHoldTime':_0x23bc5e['sumHoldTime']||0x0,'talking':_0x23bc5e[_0x4633('0x2c')],'total':_0x23bc5e[_0x4633('0x2d')],'type':_0x23bc5e[_0x4633('0x24')],'unmanaged':_0x23bc5e[_0x4633('0x2e')],'abandoned':_0x23bc5e[_0x4633('0x2f')],'waiting':_0x23bc5e[_0x4633('0x30')],'loggedInDb':_0x23bc5e[_0x4633('0x31')],'dialActive':_0x23bc5e[_0x4633('0x32')],'dialMethod':_0x23bc5e[_0x4633('0x33')],'dialOriginateCallerIdName':_0x23bc5e[_0x4633('0x34')],'dialOriginateCallerIdNumber':_0x23bc5e[_0x4633('0x35')],'dialOriginateTimeout':_0x23bc5e[_0x4633('0x36')],'dialPrefix':_0x23bc5e[_0x4633('0x37')],'outboundAnswerAgiCallsDay':_0x23bc5e[_0x4633('0x38')],'outboundAnswerCallsDay':_0x23bc5e[_0x4633('0x39')],'outboundBlacklistCallsDay':_0x23bc5e[_0x4633('0x3a')],'outboundBusyCallsDay':_0x23bc5e[_0x4633('0x3b')],'outboundCongestionCallsDay':_0x23bc5e[_0x4633('0x3c')],'outboundDropCallsDayACS':_0x23bc5e['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x23bc5e[_0x4633('0x3d')],'outboundDropCallsDayTimeout':_0x23bc5e[_0x4633('0x3e')],'outboundNoAnswerCallsDay':_0x23bc5e[_0x4633('0x3f')],'outboundNoSuchCallsDay':_0x23bc5e[_0x4633('0x40')],'outboundOriginateFailureCallsDay':_0x23bc5e[_0x4633('0x41')],'outboundReCallsDay':_0x23bc5e[_0x4633('0x42')],'outboundRejectCallsDay':_0x23bc5e['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x23bc5e[_0x4633('0x43')],'outboundAbandonedCallsDay':_0x23bc5e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x23bc5e[_0x4633('0x44')],'predictiveIntervalAvgHoldtime':_0x23bc5e[_0x4633('0x45')],'predictiveIntervalAvgTalktime':_0x23bc5e[_0x4633('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0x23bc5e[_0x4633('0x47')],'predictiveIntervalDroppedCallsTimeout':_0x23bc5e[_0x4633('0x48')],'predictiveIntervalErlangCalls':_0x23bc5e[_0x4633('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x23bc5e[_0x4633('0x4a')],'predictiveIntervalHitRate':_0x23bc5e[_0x4633('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x23bc5e[_0x4633('0x4c')],'predictiveIntervalPauses':_0x23bc5e[_0x4633('0x4d')],'predictiveIntervalAvailable':_0x23bc5e[_0x4633('0x4e')],'predictiveIntervalTotalCalls':_0x23bc5e[_0x4633('0x4f')],'message':_0x23bc5e[_0x4633('0x50')],'originated':_0x23bc5e[_0x4633('0x51')],'erlangCalls':_0x23bc5e['erlangCalls'],'erlangCallToSecond':_0x23bc5e['erlangCallToSecond'],'erlangAbandonmentRate':_0x23bc5e[_0x4633('0x52')],'erlangBusyFactor':_0x23bc5e[_0x4633('0x53')],'startPredictive':_0x23bc5e['startPredictive'],'startProgressive':_0x23bc5e[_0x4633('0x54')]};if(_0x23bc5e[_0x4633('0x55')]){_0x2d46f7[_0x4633('0x55')]={'id':_0x23bc5e[_0x4633('0x55')]['id'],'name':_0x23bc5e['Trunk'][_0x4633('0x56')],'active':_0x23bc5e['Trunk'][_0x4633('0x57')],'callerid':_0x23bc5e[_0x4633('0x55')][_0x4633('0x58')]};}if(_0x23bc5e[_0x4633('0x59')]){_0x2d46f7[_0x4633('0x59')]={'id':_0x23bc5e[_0x4633('0x59')]['id'],'name':_0x23bc5e[_0x4633('0x59')][_0x4633('0x56')]};}var _0x546390=md5(JSON[_0x4633('0x5a')](_0x2d46f7));if(_0x23bc5e[_0x4633('0x5')]!==_0x546390){_0x23bc5e['md5']=_0x546390;emit(util[_0x4633('0x5b')](_0x4633('0x5c'),_0x2d46f7[_0x4633('0x56')]),_0x4633('0x5d'),_0x2d46f7);}}}function emitVoiceQueueChannelRemove(_0x47d574){logger['info'](_0x4633('0x5e'),JSON['stringify'](_0x47d574));emit(util['format'](_0x4633('0x5c'),_0x47d574['name']),'voice_queue_channel:remove',_0x47d574);io[_0x4633('0x23')](_0x4633('0x5f'),_0x47d574);}function notSendMessagesQueue(_0x129f3c){if(_0x129f3c[_0x4633('0x60')]){if(_0x129f3c[_0x4633('0x51')]===0x0&&_0x129f3c['pTalking']===0x0){_0x129f3c[_0x4633('0x60')]=![];_0x129f3c['available']=0x0;_0x129f3c[_0x4633('0x61')]=0x0;_0x129f3c[_0x4633('0x50')]=_0x4633('0x62');ut[_0x4633('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x129f3c[_0x4633('0x56')]+'\x20is\x20not\x20active');}else{_0x129f3c[_0x4633('0x50')]=_0x4633('0x64');ut[_0x4633('0x63')](_0x4633('0x65'),_0x129f3c[_0x4633('0x56')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x129f3c);}}Preview['prototype'][_0x4633('0x66')]=function(){var _0x43f5ab=this;setInterval(function(){_0x43f5ab[_0x4633('0x67')]();},0x7cf);};Preview[_0x4633('0x68')][_0x4633('0x67')]=function(){var _0x53669c=this[_0x4633('0x14')];this['clockClearZombieChannels']+=0x1;for(var _0x2eef89 in _0x53669c){if(_0x53669c['hasOwnProperty'](_0x2eef89)&&(_0x53669c[_0x2eef89][_0x4633('0x33')]==='preview'||_0x53669c[_0x2eef89][_0x4633('0x33')]===_0x4633('0x69'))&&_0x53669c[_0x2eef89][_0x4633('0x24')]===_0x4633('0x25')){if(this[_0x4633('0x18')]>0x7){this[_0x4633('0x18')]=0x0;this[_0x4633('0x6a')]();}}if(_0x53669c[_0x4633('0x6b')](_0x2eef89)&&_0x53669c[_0x2eef89][_0x4633('0x33')]===_0x4633('0x8')&&_0x53669c[_0x2eef89][_0x4633('0x24')]===_0x4633('0x25')){if(_0x53669c[_0x2eef89][_0x4633('0x32')]){this[_0x4633('0x6c')](_0x53669c[_0x2eef89]);if(_0x53669c[_0x2eef89][_0x4633('0x6d')])this[_0x4633('0x6e')](_0x53669c[_0x2eef89]);}else{notSendMessagesQueue(_0x53669c[_0x2eef89]);}}}};Preview[_0x4633('0x68')][_0x4633('0x6f')]=function(_0x185647){var _0x102b01=this;this[_0x4633('0x70')]['enqueue'](function(){if(!_['isNil'](_0x102b01[_0x4633('0x71')][_0x185647])){loggerAction['info']('[clearZombieChannels][talking]',_0x185647,'Queue',_0x102b01[_0x4633('0x71')][_0x185647][_0x4633('0x72')],'originated:\x20',JSON[_0x4633('0x5a')](_0x102b01[_0x4633('0x14')][_0x102b01[_0x4633('0x71')][_0x185647][_0x4633('0x72')]][_0x4633('0x51')]),_0x4633('0x73'),JSON['stringify'](_0x102b01['campaignsPreview'][_0x102b01['actions'][_0x185647][_0x4633('0x72')]][_0x4633('0x29')]),JSON[_0x4633('0x5a')](_0x102b01['actions'][_0x185647][_0x4633('0x74')]),JSON[_0x4633('0x5a')](_['pick'](_0x102b01[_0x4633('0x71')][_0x185647],[_0x4633('0x75'),_0x4633('0x76'),'VoiceQueueId','ListId'])));return ami[_0x4633('0x77')]({'action':_0x4633('0x78'),'channel':_0x102b01[_0x4633('0x71')][_0x185647][_0x4633('0x79')]})[_0x4633('0x7a')](function(_0x58be1d){if(_0x58be1d[_0x4633('0x50')]===_0x4633('0x7b')){setTimeout(function(){if(_0x102b01[_0x4633('0x71')][_0x185647]){ut[_0x4633('0x7c')](_0x102b01[_0x4633('0x14')][_0x102b01[_0x4633('0x71')][_0x185647]['queue']],_0x4633('0x7d'));if(_0x102b01['actions'][_0x185647]['dialAnswer']===!![]){ut['decrementTalkink'](_0x102b01[_0x4633('0x14')][_0x102b01[_0x4633('0x71')][_0x185647][_0x4633('0x72')]],_0x4633('0x7d'));ut['loggerError'](_0x4633('0x7e')+_0x185647,_0x102b01['actions'][_0x185647][_0x4633('0x72')]);}ut[_0x4633('0x7f')](_0x4633('0x80')+_0x185647,_0x102b01[_0x4633('0x71')][_0x185647][_0x4633('0x72')]);delete _0x102b01[_0x4633('0x71')][_0x185647];}},0x2328);}});}});};Preview[_0x4633('0x68')][_0x4633('0x6a')]=function(){var _0x5b84d2=this;loggerAction[_0x4633('0x81')]('[action]',_[_0x4633('0x82')](this[_0x4633('0x71')]));for(var _0x4b23a1 in this[_0x4633('0x71')]){if(_0x5b84d2[_0x4633('0x71')][_0x4633('0x6b')](_0x4b23a1)){_0x5b84d2[_0x4633('0x6f')](_0x4b23a1);}}};Preview[_0x4633('0x68')][_0x4633('0x6e')]=function(_0x1e4c32){var _0x27608f=this;rpcDb[_0x4633('0x83')](_0x1e4c32['id'],ut[_0x4633('0x84')](this['agents']))[_0x4633('0x85')](function(_0x82beee){if(!_[_0x4633('0x86')](_0x82beee)){for(var _0x2bee59=0x0;_0x2bee59<_0x82beee[_0x4633('0x87')];_0x2bee59+=0x1){if(ut[_0x4633('0x88')](_0x82beee[_0x2bee59][_0x4633('0x89')])<_0x1e4c32[_0x4633('0x8a')]*0x3c){if(_0x82beee[_0x2bee59][_0x4633('0x8b')]&&!_0x82beee[_0x2bee59][_0x4633('0x8b')][_0x4633('0x8c')]){_0x27608f['run'](_0x82beee[_0x2bee59]['id'])['then'](ut[_0x4633('0x8d')]('[RecallMe]'))[_0x4633('0x7a')](ut[_0x4633('0x8d')]('[RecallMe]'));}else{rpcDb[_0x4633('0x8e')](_0x82beee[_0x2bee59]['id']);}}else{var _0x344536=new Action(_0x82beee[_0x2bee59],_0x1e4c32);_0x344536[_0x4633('0x8f')]=moment()[_0x4633('0x5b')](_0x4633('0x90'));_0x1e4c32['outboundReCallsDay']+=0x1;ut[_0x4633('0x91')](_0x344536,0x17,_0x4633('0x92'));if(_0x1e4c32[_0x4633('0x93')]){rpcDb[_0x4633('0x94')](ut[_0x4633('0x95')](_0x82beee[_0x2bee59]));rpcDb['createCustomerHistory'](_0x344536,_0x4633('0x96'));}else{ut[_0x4633('0x91')](_0x344536,0x16,_0x4633('0x97'));rpcDb['createCustomerHistory'](_0x344536,_0x4633('0x98'));rpcDb[_0x4633('0x99')](_0x344536,_0x4633('0x98'));}}}}})[_0x4633('0x7a')](ut[_0x4633('0x8d')](_0x4633('0x9a')));};Preview[_0x4633('0x68')][_0x4633('0x6c')]=function(_0x40fa6a){_0x40fa6a[_0x4633('0x60')]=!![];if(ut[_0x4633('0x9b')](_0x40fa6a['loggedIn'])){_0x40fa6a['message']=_0x4633('0x9c');}else if(!ut[_0x4633('0x9d')](_0x40fa6a[_0x4633('0x32')])){_0x40fa6a['message']='NOT_ACTIVE';}else if(!this[_0x4633('0x9e')](_0x40fa6a[_0x4633('0x55')])){if(!this[_0x4633('0x9e')](_0x40fa6a['TrunkBackup'])){_0x40fa6a[_0x4633('0x50')]=_0x4633('0x9f');}else{_0x40fa6a[_0x4633('0x50')]='ACTIVE';}}else{_0x40fa6a['message']=_0x4633('0xa0');}emitCampaignPreview(_0x40fa6a);};Preview['prototype'][_0x4633('0xa1')]=function(_0x89146e,_0x4bcb5c,_0x158078){var _0x47108f=this;var _0x6302e6=this[_0x4633('0x71')][_0x4bcb5c];var _0x4f338c=this[_0x4633('0x14')][_0x6302e6[_0x4633('0x72')]];var _0x2fb553;var _0x36b0c2=![];var _0x2ea1a5=0x2;var _0x1677f9=0x3;if(_0x4f338c){switch(_0x158078){case'1':_0x4f338c[_0x4633('0x40')]+=0x1;_0x6302e6['countnosuchnumberretry']+=0x1;_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0x0,_0x4633('0xa4'));ami['emit']('custom:agentnosuchnumber',ut[_0x4633('0xa5')](_0x6302e6,'nosuchnumber'));rpcDb[_0x4633('0xa6')](_0x6302e6,'[callProgressDetectingCustomer][logNoSuch]');_0x47108f['verifyAdditionalPhones'](_0x6302e6,'0',_0x4f338c)[_0x4633('0x85')](function(_0x8e02c4){_0x36b0c2=_0x8e02c4['additional']==0x1;_0x2ea1a5=_0x4f338c[_0x4633('0xa7')];_0x1677f9=_0x4f338c[_0x4633('0xa8')];if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xac'));}else{if(_0x6302e6['countnosuchnumberretry']>=_0x4f338c[_0x4633('0xad')]){rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0xac'));}else{rpcDb['rescheduleContact'](ut[_0x4633('0xae')](_0x6302e6,_0x4633('0xaf'),_0x4f338c[_0x4633('0xa7')]),_0x6302e6[_0x4633('0xb0')],_0x6302e6[_0x4633('0xb1')]);}}delete this[_0x4633('0x71')][_0x89146e['linkedid']];}else{_0x6302e6[_0x4633('0xaf')]++;logger[_0x4633('0x81')](_0x4633('0xb2'),_0x6302e6['countnosuchnumberretry']);logger[_0x4633('0x81')]('id',_0x6302e6[_0x4633('0xb3')]);_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6[_0x4633('0xb3')],'field':{'countnosuchnumberretry':_0x6302e6[_0x4633('0xaf')]}})[_0x4633('0x85')](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)['then'](function(){});});}});break;case _0x4633('0xb5'):var _0x539a19=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x6302e6['responsetime']=_0x539a19;_0x6302e6[_0x4633('0xb6')]=_0x539a19;_0x6302e6[_0x4633('0x74')]=!![];_0x4f338c[_0x4633('0x29')]+=0x1;logger[_0x4633('0x81')](_0x4633('0xb7'),_0x6302e6['uniqueid'],_0x4633('0xb8'),_0x4f338c[_0x4633('0x56')],_0x4633('0x73'),_0x4f338c[_0x4633('0x29')]);ami[_0x4633('0x23')](_0x4633('0xb9'),ut['buildObj'](_0x6302e6,_0x4633('0xba'),this['campaignsPreview'][_0x6302e6[_0x4633('0x72')]]));if(_0x4f338c[_0x4633('0xbb')]){ami['emit'](_0x4633('0xbc'),ut[_0x4633('0xbd')](_0x6302e6));}break;case'16':ami['emit'](_0x4633('0xbe'),ut[_0x4633('0xa5')](_0x6302e6,_0x4633('0xbf'),this['campaignsPreview'][_0x6302e6['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x6302e6,_0x4633('0xbf')));_0x4f338c['outboundAnswerCallsDay']+=0x1;_0x4f338c[_0x4633('0x2d')]+=0x1;_0x4f338c['answered']+=0x1;ut[_0x4633('0xc0')](_0x4f338c,_0x4633('0xc1'));_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0x4,_0x4633('0xc2'));rpcDb[_0x4633('0xa6')](_0x6302e6,_0x4633('0xc3'));rpcDb[_0x4633('0x99')](_0x6302e6,_0x4633('0xc4'));rpcDb[_0x4633('0xc5')](_0x6302e6);_0x4f338c['sumDuration']+=_0x6302e6[_0x4633('0xc6')];_0x4f338c[_0x4633('0x2a')]+=_0x6302e6[_0x4633('0xc6')];logger[_0x4633('0x81')](_0x4633('0xc7'),_0x6302e6[_0x4633('0xc8')],'\x20Queue',_0x4f338c[_0x4633('0x56')],_0x4633('0x73'),_0x4f338c[_0x4633('0x29')]);delete this[_0x4633('0x71')][_0x89146e[_0x4633('0xc9')]];break;case _0x4633('0xca'):_0x4f338c[_0x4633('0x3b')]+=0x1;_0x6302e6['countbusyretry']+=0x1;_0x6302e6['countglobal']=ut[_0x4633('0xa3')](_0x6302e6);ut['logCustomer'](_0x6302e6,0x5,'Busy');_0x2ea1a5=_0x4f338c[_0x4633('0xcb')];_0x1677f9=_0x4f338c['callAdditionalPhoneAfterMin'];ami['emit'](_0x4633('0xcc'),ut[_0x4633('0xa5')](_0x6302e6,_0x4633('0xcd')));rpcDb[_0x4633('0xa6')](_0x6302e6,_0x4633('0xce'));_0x47108f[_0x4633('0xcf')](_0x6302e6,'5',_0x4f338c)['then'](function(_0xc9ad19){_0x36b0c2=_0xc9ad19[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut['totalGlobal'](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xd1'));}else{if(_0x6302e6[_0x4633('0xd2')]>=_0x4f338c[_0x4633('0xd3')]){rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0xce'));}else{rpcDb[_0x4633('0xd4')](ut['scheduledAt'](_0x6302e6,_0x4633('0xd2'),_0x4f338c[_0x4633('0xcb')]),_0x6302e6[_0x4633('0xb0')],_0x6302e6[_0x4633('0xb1')]);}}}else{_0x6302e6['countbusyretry']++;_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6[_0x4633('0xb3')],'field':{'countbusyretry':_0x6302e6[_0x4633('0xd2')]}})[_0x4633('0x85')](function(){_0x47108f[_0x4633('0xd5')](_0x6302e6,_0x2ea1a5,_0x1677f9)[_0x4633('0x85')](function(){});});}});break;case _0x4633('0xd6'):_0x4f338c['outboundNoAnswerCallsDay']+=0x1;_0x6302e6[_0x4633('0xd7')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0x3,_0x4633('0xd8'));_0x2ea1a5=_0x4f338c[_0x4633('0xd9')];_0x1677f9=_0x4f338c[_0x4633('0xa8')];ami[_0x4633('0x23')]('custom:agentnoanswer',ut['buildObj'](_0x6302e6,_0x4633('0xda')));rpcDb[_0x4633('0xa6')](_0x6302e6,'[callProgressDetectingCustomer][logNoAnswer]');_0x47108f[_0x4633('0xcf')](_0x6302e6,'3',_0x4f338c)[_0x4633('0x85')](function(_0x24d05c){_0x36b0c2=_0x24d05c[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xdb'));}else{if(_0x6302e6[_0x4633('0xd7')]>=_0x4f338c[_0x4633('0xdc')]){rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x4633('0xae')](_0x6302e6,_0x4633('0xd7'),_0x4f338c[_0x4633('0xd9')]),_0x6302e6[_0x4633('0xb0')],_0x6302e6[_0x4633('0xb1')]);}}}else{_0x6302e6[_0x4633('0xd7')]++;_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6['idContact'],'field':{'countnoanswerretry':_0x6302e6[_0x4633('0xd7')]}})[_0x4633('0x85')](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)[_0x4633('0x85')](function(){});});}});break;case _0x4633('0xde'):_0x4f338c[_0x4633('0x3c')]+=0x1;_0x6302e6[_0x4633('0xdf')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut['logCustomer'](_0x6302e6,0x8,_0x4633('0xe0'));_0x2ea1a5=_0x4f338c['dialCongestionRetryFrequency'];_0x1677f9=_0x4f338c['callAdditionalPhoneAfterMin'];ami[_0x4633('0x23')](_0x4633('0xe1'),ut[_0x4633('0xa5')](_0x6302e6,_0x4633('0xe2')));rpcDb[_0x4633('0xa6')](_0x6302e6,_0x4633('0xe3'));_0x47108f[_0x4633('0xcf')](_0x6302e6,'8',_0x4f338c)[_0x4633('0x85')](function(_0x1a1de7){_0x36b0c2=_0x1a1de7[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut['totalGlobal'](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut['cloneAction'](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xe4'));}else{if(_0x6302e6['countcongestionretry']>=_0x4f338c[_0x4633('0xe5')]){rpcDb[_0x4633('0x99')](_0x6302e6,_0x4633('0xe3'));}else{rpcDb[_0x4633('0xd4')](ut[_0x4633('0xae')](_0x6302e6,_0x4633('0xdf'),_0x4f338c['dialBusyRetryFrequency']),_0x6302e6[_0x4633('0xb0')],_0x6302e6[_0x4633('0xb1')]);}}}else{_0x6302e6[_0x4633('0xdf')]++;_0x47108f['incrementPreviewCounters']({'id':_0x6302e6['idContact'],'field':{'countcongestionretry':_0x6302e6[_0x4633('0xdf')]}})[_0x4633('0x85')](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)['then'](function(){});});}});break;case _0x4633('0xe6'):_0x4f338c[_0x4633('0xe7')]+=0x1;_0x6302e6[_0x4633('0xe8')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut['totalGlobal'](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0x14,_0x4633('0xe9'));_0x2ea1a5=_0x4f338c[_0x4633('0xea')];_0x1677f9=_0x4f338c['callAdditionalPhoneAfterMin'];ami[_0x4633('0x23')](_0x4633('0xeb'),ut['buildObj'](_0x6302e6,_0x4633('0xec')));rpcDb[_0x4633('0xa6')](_0x6302e6,_0x4633('0xed'));_0x47108f[_0x4633('0xcf')](_0x6302e6,'20',_0x4f338c)[_0x4633('0x85')](function(_0x3aec01){_0x36b0c2=_0x3aec01[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0x14,_0x4633('0xe9'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xee'));}else{if(_0x6302e6[_0x4633('0xe8')]>=_0x4f338c[_0x4633('0xef')]){rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0xee'));}else{rpcDb[_0x4633('0xd4')](ut[_0x4633('0xae')](_0x6302e6,_0x4633('0xe8'),_0x4f338c[_0x4633('0xea')]),_0x6302e6[_0x4633('0xb0')],_0x6302e6['activeContact']);}}}else{_0x6302e6['countnoanswerretry']++;_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6[_0x4633('0xb3')],'field':{'countnoanswerretry':_0x6302e6['countnoanswerretry']}})['then'](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)[_0x4633('0x85')](function(){});});}});break;case _0x4633('0xf0'):_0x4f338c['outboundAbandonedCallsDay']+=0x1;_0x6302e6[_0x4633('0xf1')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut['totalGlobal'](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0xb,_0x4633('0xf2'));rpcDb['createCustomerHistory'](_0x6302e6,'[callProgressDetectingCustomer][logAbandoned]');_0x47108f[_0x4633('0xcf')](_0x6302e6,'11',_0x4f338c)[_0x4633('0x85')](function(_0x520c3c){_0x36b0c2=_0x520c3c[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c[_0x4633('0xa9')]){_0x2fb553=ut['cloneAction'](_0x6302e6,0xf,'Global');rpcDb['createCustomerFinal'](_0x2fb553,_0x4633('0xf3'));}else{if(_0x6302e6[_0x4633('0xf4')]>=_0x4f338c[_0x4633('0xf5')]){rpcDb[_0x4633('0x99')](_0x6302e6,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x6302e6,'countabandonedretry',_0x4f338c[_0x4633('0xf6')]),_0x6302e6['unlockAgent'],_0x6302e6[_0x4633('0xb1')]);}}}else{_0x6302e6[_0x4633('0xd7')]++;_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6['idContact'],'field':{'countnoanswerretry':_0x6302e6[_0x4633('0xd7')]}})[_0x4633('0x85')](function(){_0x47108f[_0x4633('0xd5')](_0x6302e6,_0x2ea1a5,_0x1677f9)[_0x4633('0x85')](function(){});});}});break;case'18':_0x4f338c['outboundUnknownCallsDay']+=0x1;_0x6302e6[_0x4633('0xf7')]+=0x1;_0x6302e6['countglobal']=ut[_0x4633('0xa3')](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0x12,_0x89146e[_0x4633('0xf8')]||_0x89146e['dialstatus']);ami['emit'](_0x4633('0xf9'),ut[_0x4633('0xa5')](_0x6302e6,_0x4633('0xfa')));rpcDb['createCustomerHistory'](_0x6302e6,'[callProgressDetectingCustomer][hangupInAMD]');_0x47108f[_0x4633('0xcf')](_0x6302e6,'18',_0x4f338c)[_0x4633('0x85')](function(_0x297ff9){_0x36b0c2=_0x297ff9[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c['dialGlobalMaxRetry']){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0x12,'Global');rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xfb'));}else{rpcDb['createCustomerFinal'](_0x6302e6,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x6302e6[_0x4633('0xd7')]++;_0x47108f[_0x4633('0xb4')]({'id':_0x6302e6['idContact'],'field':{'countnoanswerretry':_0x6302e6[_0x4633('0xd7')]}})['then'](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)['then'](function(){});});}});delete this[_0x4633('0x71')][_0x89146e[_0x4633('0xc9')]];break;case'19':_0x4f338c[_0x4633('0x43')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut['logCustomer'](_0x6302e6,0x13,_0x89146e[_0x4633('0xf8')]||_0x89146e[_0x4633('0xfc')]);ami[_0x4633('0x23')](_0x4633('0xf9'),ut[_0x4633('0xa5')](_0x6302e6,'amd'));rpcDb['createCustomerHistory'](_0x6302e6,'[callProgressDetectingCustomer][machine]');_0x47108f[_0x4633('0xcf')](_0x6302e6,'18',_0x4f338c)['then'](function(_0x7357e1){_0x36b0c2=_0x7357e1[_0x4633('0xd0')]==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c['dialGlobalMaxRetry']){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,_0x4633('0xfd'));}else{rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0xfd'));}}else{_0x6302e6['countnoanswerretry']++;_0x47108f['incrementPreviewCounters']({'id':_0x6302e6[_0x4633('0xb3')],'field':{'countnoanswerretry':_0x6302e6['countnoanswerretry']}})[_0x4633('0x85')](function(){_0x47108f['swapAdditionalPhones'](_0x6302e6,_0x2ea1a5,_0x1677f9)['then'](function(){});});}});delete this['actions'][_0x89146e[_0x4633('0xc9')]];break;default:if(_0x6302e6[_0x4633('0x74')]){ut[_0x4633('0xc0')](_0x4f338c,_0x4633('0xfe'));ut[_0x4633('0x7f')](_0x4633('0xff')+_0x4f338c[_0x4633('0x56')],_0x89146e);}_0x4f338c[_0x4633('0x43')]+=0x1;_0x6302e6[_0x4633('0xa2')]=ut[_0x4633('0xa3')](_0x6302e6);ut[_0x4633('0x91')](_0x6302e6,0xc,_0x89146e[_0x4633('0xf8')]||_0x89146e['dialstatus']);_0x2ea1a5=_0x4f338c[_0x4633('0xea')];_0x1677f9=_0x4f338c[_0x4633('0xa8')];rpcDb[_0x4633('0xa6')](_0x6302e6,_0x4633('0x100'));_0x47108f[_0x4633('0xcf')](_0x6302e6,'20',_0x4f338c)[_0x4633('0x85')](function(_0x28cf4a){_0x36b0c2=_0x28cf4a['additional']==0x1;if(!_0x36b0c2){if(ut[_0x4633('0xa3')](_0x6302e6)>=_0x4f338c['dialGlobalMaxRetry']){_0x2fb553=ut[_0x4633('0xaa')](_0x6302e6,0xf,_0x4633('0xab'));rpcDb[_0x4633('0x99')](_0x2fb553,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x6302e6,_0x4633('0x101'));}delete this['actions'][_0x89146e['linkedid']];}else{_0x47108f[_0x4633('0xd5')](_0x6302e6,_0x2ea1a5,_0x1677f9)['then'](function(_0x52a1a5){});}});}if(!(_0x6302e6[_0x4633('0x74')]&&_0x158078==='16')){ut[_0x4633('0x7c')](_0x4f338c,_0x4633('0x102'));logger[_0x4633('0x81')](_0x4633('0x103'),_0x6302e6[_0x4633('0xc8')],'\x20Queue',_0x4f338c[_0x4633('0x56')],_0x4633('0x104'),_0x4f338c[_0x4633('0x51')]);}if(_0x158078!==_0x4633('0xb5')){delete this['actions'][_0x89146e[_0x4633('0xc9')]];delete this[_0x4633('0x71')][_0x89146e['destlinkedid']];}}};Preview[_0x4633('0x68')][_0x4633('0x105')]=function(_0x57add0,_0x4d337,_0x3f7605){if(_[_0x4633('0x106')](_0x4d337)&&'object'!==typeof _0x4d337){return;}if(_[_0x4633('0x106')](_0x3f7605)&&'object'!==typeof _0x3f7605){return;}switch(_0x3f7605[_0x4633('0x107')]){case'0':ut[_0x4633('0x108')](_0x57add0,0x0,_0x4633('0xa4'));rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10a'));break;case'3':ut['logAgent'](_0x57add0,0x3,'NoAnswer');rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10b'));break;case'5':ut[_0x4633('0x108')](_0x57add0,0x5,_0x4633('0x10c'));rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10d'));break;case'8':ut[_0x4633('0x108')](_0x57add0,0x8,'Congestion');rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10e'));break;case'22':ut[_0x4633('0x108')](_0x57add0,0x16,'AnswerAGI');rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10f'));break;default:ut['logAgent'](_0x57add0,0xc,_0x3f7605[_0x4633('0x107')]);rpcDb[_0x4633('0x109')](_0x57add0,_0x4633('0x10e'));}ut['updateOriginated'](_0x4d337,_0x4633('0x110'));logger[_0x4633('0x81')](_0x4633('0x111'),_0x57add0['uniqueid'],_0x4633('0xb8'),_0x4d337['name'],_0x4633('0x104'),_0x4d337['originated']);delete this[_0x4633('0x71')][_0x57add0[_0x4633('0xc8')]];};Preview['prototype']['verifyAdditionalPhones']=function(_0x1abe6d,_0x41ab0e,_0xd89306){return BPromise[_0x4633('0x112')]()[_0x4633('0x85')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x1abe6d,_0x41ab0e,_0xd89306))['catch'](logger[_0x4633('0x81')]('[verifyAdditionalPhone]\x20'));};Preview[_0x4633('0x68')]['swapAdditionalPhones']=function(_0x555dfc,_0x9e24fe,_0x5e34b8){return BPromise[_0x4633('0x112')]()[_0x4633('0x85')](cmHopperAdditionalPhone[_0x4633('0xd5')](_0x555dfc,_0x9e24fe,_0x5e34b8))['catch'](logger[_0x4633('0x81')](_0x4633('0x113')));};Preview['prototype'][_0x4633('0xb4')]=function(_0x3fe347){return BPromise[_0x4633('0x112')]()[_0x4633('0x85')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x3fe347))[_0x4633('0x7a')](logger['info']('[incrementPreviewCounters]\x20'));};Preview['prototype'][_0x4633('0x114')]=function(_0x389a0c,_0x1317ae,_0x2fb79f,_0x53d2d8,_0x478538){var _0x1303c4=this;return new BPromise(function(_0xfab118,_0x8907f8){if(_[_0x4633('0x86')](_0x1317ae)||_['isNil'](_0x1317ae[_0x4633('0x115')])||_[_0x4633('0x86')](_0x1317ae['phone'])||_[_0x4633('0x86')](_0x1317ae[_0x4633('0x116')])){_0x8907f8(ut[_0x4633('0x50')](_0x4633('0x117'),_0x53d2d8,_0x478538));return;}var _0xb80547=uuid['v4']();var _0x584adc=_0x1303c4[_0x4633('0x14')][_0x1317ae['Queue'][_0x4633('0x56')]];var _0x2cf5a3=_0x2fb79f?_0x1303c4[_0x4633('0x17')][_0x2fb79f]['id']:undefined;_0x1303c4['actions'][_0xb80547]=new Action(_0x1317ae,_0x584adc,_0xb80547,_0x2fb79f,_0x2cf5a3);var _0x2857c7=_0x1303c4[_0x4633('0x71')][_0xb80547];_0x2857c7[_0x4633('0xb0')]=_0x53d2d8;_0x2857c7[_0x4633('0xb1')]=_0x478538;_0x2857c7[_0x4633('0x118')]=_0x2fb79f;if(_['isEmpty'](_0x389a0c)){_0x1303c4[_0x4633('0x119')](_0x2857c7,_0x584adc,_0x1317ae,_0x2fb79f)['then'](function(_0x14ad3f){logger[_0x4633('0x81')](_0x4633('0x11a'),_0x4633('0x11b')+_0x2857c7[_0x4633('0x72')]+_0x4633('0x11c')+_0x2857c7[_0x4633('0xb3')],JSON[_0x4633('0x5a')](_0x14ad3f));ami[_0x4633('0x23')](_0x4633('0x11d'),ut[_0x4633('0xa5')](_0x2857c7,'called',_0x1303c4['campaignsPreview'][_0x2857c7[_0x4633('0x72')]]));_0xfab118(ut[_0x4633('0x50')](_0x4633('0x11e')));})['catch'](function(_0x1302a5){ut[_0x4633('0x63')](_0x4633('0x11f'),_0x1302a5);_0x8907f8(ut['message']('Call\x20failed',_0x53d2d8,_0x478538));});}else{_0x584adc[_0x4633('0x3a')]+=0x1;ut[_0x4633('0x120')](_0x2857c7);rpcDb['createHistory'](_0x2857c7,_0x4633('0x121'));delete _0x1303c4['actions'][_0xb80547];_0x8907f8(ut[_0x4633('0x50')](_0x4633('0x122'),_0x53d2d8,_0x478538));}});};Preview['prototype'][_0x4633('0x9e')]=function(_0x3af592){return!_[_0x4633('0x86')](_0x3af592)&&!_[_0x4633('0x86')](_0x3af592[_0x4633('0x56')])&&!_[_0x4633('0x86')](_0x3af592[_0x4633('0x57')])&&_0x3af592[_0x4633('0x57')]&&!_[_0x4633('0x86')](this[_0x4633('0x16')][util['format'](_0x4633('0x123'),_0x3af592[_0x4633('0x56')])])&&!_[_0x4633('0x86')](this[_0x4633('0x16')][util[_0x4633('0x5b')]('SIP/%s',_0x3af592[_0x4633('0x56')])][_0x4633('0x78')])&&(this[_0x4633('0x16')][util[_0x4633('0x5b')](_0x4633('0x123'),_0x3af592[_0x4633('0x56')])]['status']==='reachable'||this[_0x4633('0x16')][util[_0x4633('0x5b')](_0x4633('0x123'),_0x3af592['name'])][_0x4633('0x78')]==='unmonitored');};Preview[_0x4633('0x68')][_0x4633('0x124')]=function(_0x1725b6,_0x2027d7){var _0x2a500e=this;return new BPromise(function(_0x47c767,_0x116a6b){_0x2a500e[_0x4633('0x125')](_0x1725b6,_0x2027d7)['then'](function(_0x1a4bdb){_0x47c767(_['pick'](_0x1a4bdb,['message']));})[_0x4633('0x7a')](function(_0x27c777){if(_0x27c777[_0x4633('0x126')]){rpcDb[_0x4633('0x127')](_0x1725b6);}if(_0x27c777['active']){rpcDb[_0x4633('0x8e')](_0x1725b6);}_0x116a6b(_['pick'](_0x27c777,[_0x4633('0x50')]));});});};Preview['prototype'][_0x4633('0x125')]=function(_0x149aae,_0x56f8ee){var _0x2c25fe=this;return new BPromise(function(_0x4126bb,_0x41605c){var _0x46f774,_0x98428d;rpcDb[_0x4633('0x128')](_0x149aae)[_0x4633('0x85')](function(_0x89eebd){if(!_['isNil'](_0x89eebd[0x0])){_0x98428d=_0x89eebd[0x0]['recallme']?![]:!![];_0x46f774=_0x89eebd[0x0][_0x4633('0x129')]?!![]:![];_0x46f774=_0x56f8ee?!![]:_0x46f774;}var _0x4a7f71=_0x2c25fe[_0x4633('0x12a')](_0x89eebd);if(_0x4a7f71['isValid']){rpcDb[_0x4633('0x12b')](_[_0x4633('0x12c')](_0x89eebd[0x0],[_0x4633('0x116'),_0x4633('0x12d')]))[_0x4633('0x85')](function(_0x5e1423){_0x2c25fe[_0x4633('0x114')](_0x5e1423,_0x89eebd[0x0],_0x56f8ee,_0x98428d,_0x46f774)[_0x4633('0x85')](function(_0x3a88a3){_0x4126bb(_0x3a88a3);})['catch'](function(_0x1dec09){_0x41605c(_0x1dec09);});})[_0x4633('0x7a')](function(_0x1c6348){ut[_0x4633('0x63')](_0x4633('0x12e'),_0x1c6348);_0x41605c(ut['message']('Call\x20unsuccessful',_0x98428d,_0x46f774));});}else{_0x41605c(ut[_0x4633('0x50')](_0x4a7f71[_0x4633('0x50')],_0x98428d,_0x46f774));}})['catch'](function(_0x13e25d){ut[_0x4633('0x63')](_0x4633('0x12f'),_0x13e25d);_0x41605c(ut[_0x4633('0x50')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x4633('0x68')][_0x4633('0x12a')]=function(_0x190bc3){if(_['isNil'](_0x190bc3)||_[_0x4633('0x130')](_0x190bc3)||!_['isNil'](_0x190bc3[0x0][_0x4633('0x8b')])&&_['isNil'](_0x190bc3[0x0]['Agent']['name'])){ut[_0x4633('0x63')](_0x4633('0x131'),_0x190bc3);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x166e32=this['campaignsPreview'][_0x190bc3[0x0][_0x4633('0x132')][_0x4633('0x56')]];_0x166e32['message']=_0x4633('0xa0');if(_[_0x4633('0x86')](_0x166e32)){ut[_0x4633('0x63')]('[Preview][validateContact][Empty\x20Campaign]',_0x166e32);return{'isValid':![],'message':_0x4633('0x133')};}if(!this[_0x4633('0x9e')](_0x166e32[_0x4633('0x55')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4633('0x134')+_0x166e32['name']+_0x4633('0x135'));if(!this[_0x4633('0x9e')](_0x166e32[_0x4633('0x136')])){ut[_0x4633('0x63')](_0x4633('0x137'),_0x166e32[_0x4633('0x56')]+_0x4633('0x138'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x166e32[_0x4633('0x32')])){ut[_0x4633('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x166e32['name']+_0x4633('0x139'));return{'isValid':![],'message':_0x4633('0x134')+_0x166e32[_0x4633('0x56')]+_0x4633('0x139')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x4633('0x68')][_0x4633('0x119')]=function(_0x33671d,_0x5cfbc5,_0x73f8d5,_0x11a45d){var _0x17b29c=this;return new BPromise(function(_0x1258f4,_0x609fd3){var _0x812def=_0x33671d['uniqueid'];var _0x216737=_0x17b29c[_0x4633('0x9e')](_0x5cfbc5['Trunk'])?util['format'](_0x4633('0x13a'),_0x5cfbc5[_0x4633('0x55')]['name'],_[_0x4633('0x86')](_0x5cfbc5['dialPrefix'])?'':_0x5cfbc5[_0x4633('0x37')]['trim']()||'',_0x5cfbc5[_0x4633('0x13b')]>0x0?_0x73f8d5[_0x4633('0x12d')][_0x4633('0x13c')](_0x5cfbc5[_0x4633('0x13b')]):_0x73f8d5[_0x4633('0x12d')]):util[_0x4633('0x5b')]('SIP/%s/%s%s',_[_0x4633('0x86')](_0x5cfbc5['TrunkBackup'])?_0x5cfbc5[_0x4633('0x55')][_0x4633('0x56')]:_0x5cfbc5[_0x4633('0x136')]['name'],_[_0x4633('0x86')](_0x5cfbc5[_0x4633('0x37')])?'':_0x5cfbc5[_0x4633('0x37')][_0x4633('0x13d')]()||'',_0x5cfbc5[_0x4633('0x13b')]>0x0?_0x73f8d5[_0x4633('0x12d')][_0x4633('0x13c')](_0x5cfbc5[_0x4633('0x13b')]):_0x73f8d5[_0x4633('0x12d')]);var _0x13411c=_0x17b29c[_0x4633('0x9e')](_0x5cfbc5[_0x4633('0x55')])?ut[_0x4633('0x13e')](_0x5cfbc5[_0x4633('0x55')][_0x4633('0x58')],_0x5cfbc5[_0x4633('0x34')],_0x5cfbc5[_0x4633('0x13f')]>0x0?ut[_0x4633('0x140')](_0x5cfbc5[_0x4633('0x35')],_0x5cfbc5[_0x4633('0x13f')]):_0x5cfbc5[_0x4633('0x35')]):ut[_0x4633('0x13e')](_[_0x4633('0x86')](_0x5cfbc5[_0x4633('0x136')])?_0x5cfbc5[_0x4633('0x55')]['callerid']:_0x5cfbc5[_0x4633('0x136')][_0x4633('0x58')],_0x5cfbc5[_0x4633('0x34')],_0x5cfbc5['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4633('0x140')](_0x5cfbc5[_0x4633('0x35')],_0x5cfbc5[_0x4633('0x13f')]):_0x5cfbc5['dialOriginateCallerIdNumber']);if(_0x13411c){_0x33671d[_0x4633('0x141')]=ut[_0x4633('0x142')](_0x13411c);_0x33671d[_0x4633('0x143')]=ut[_0x4633('0x144')](_0x13411c);}var _0x23c305=ut[_0x4633('0x145')](_0x5cfbc5,_0x73f8d5,_0x216737,_0x13411c,_0x812def,_0x33671d);_['merge'](_0x33671d,ut[_0x4633('0x146')](_0x23c305));_0x33671d[_0x4633('0x8f')]=moment()[_0x4633('0x5b')](_0x4633('0x90'));ami[_0x4633('0x77')](ut[_0x4633('0x147')](_0x33671d,_0x5cfbc5,_0x23c305,_0x33671d[_0x4633('0xb1')],_0x11a45d))['then'](function(_0x4c1cbb){_0x5cfbc5[_0x4633('0x51')]+=0x1;logger['info']('[originated][increment]',_0x812def,_0x4633('0xb8'),_0x5cfbc5['name'],'originated:\x20',_0x5cfbc5[_0x4633('0x51')]);_0x1258f4(_0x4c1cbb);})[_0x4633('0x7a')](function(_0x2bef70){ut[_0x4633('0x108')](_0x33671d,0xe,_0x4633('0x148'));rpcDb[_0x4633('0x109')](_0x33671d,'[originateFailure][logOriginateFailure]');_0x609fd3(_0x2bef70);});});};Preview['prototype']['syncNewExten']=function(_0x1f48da){if(this[_0x4633('0x71')][_0x1f48da[_0x4633('0xc9')]]){this[_0x4633('0x71')][_0x1f48da[_0x4633('0xc9')]][_0x4633('0x79')]=_0x1f48da[_0x4633('0x79')];}};Preview[_0x4633('0x68')][_0x4633('0x149')]=function(_0x445b1a){var _0x4df426=this;var _0x4803ae=this['actions'][_0x445b1a[_0x4633('0x14a')]];if(_0x4803ae){if(_0x4803ae[_0x4633('0x118')]&&this[_0x4633('0x17')][_0x4803ae[_0x4633('0x118')]]){ut['logLookAgent'](_0x4803ae,this[_0x4633('0x17')][_0x4803ae[_0x4633('0x118')]][_0x4633('0x56')],this['agents'][_0x4803ae[_0x4633('0x118')]]['id']);}var _0x441b40=_[_0x4633('0x14b')](_0x4803ae);_0x441b40[_0x4633('0x14c')]=moment()[_0x4633('0x5b')](_0x4633('0x90'));var _0x4733bd=_0x4df426[_0x4633('0x14')][_0x4803ae[_0x4633('0x72')]];if(ut[_0x4633('0x14d')](_0x445b1a['response'])){if(_0x4803ae[_0x4633('0xb0')]){rpcDb[_0x4633('0x127')](_0x4803ae[_0x4633('0xb3')]);}if(_0x4803ae[_0x4633('0xb1')]){rpcDb['disableContact'](_0x4803ae[_0x4633('0xb3')]);}ami['emit']('custom:agentringnoanswer',ut[_0x4633('0xa5')](_0x4803ae,'rejected',this[_0x4633('0x14')][_0x4803ae[_0x4633('0x72')]]));this[_0x4633('0x105')](_0x441b40,_0x4733bd,_0x445b1a);}else{_0x4803ae['starttime']=moment()[_0x4633('0x5b')](_0x4633('0x90'));ut['logAgent'](_0x441b40,0x4,_0x4633('0xc2'));rpcDb[_0x4633('0x109')](_0x441b40,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x4633('0x68')][_0x4633('0x1a')]=function(_0x1cdd84){var _0x436252=this;var _0x2c4017=this[_0x4633('0x71')][_0x1cdd84[_0x4633('0xc9')]];var _0x173bda;if(_0x2c4017){_0x173bda=this[_0x4633('0x14')][_0x2c4017[_0x4633('0x72')]];logger['info'](_0x4633('0x14e'),_0x1cdd84['linkedid'],'\x20Queue',_0x173bda[_0x4633('0x56')],_0x4633('0x73'),_0x173bda[_0x4633('0x29')]);}if(this[_0x4633('0x71')][_0x1cdd84[_0x4633('0xc9')]]&&_0x1cdd84[_0x4633('0xc9')]!==_0x1cdd84['uniqueid']){if(_0x1cdd84[_0x4633('0x14f')]==='16'&&this['actions'][_0x1cdd84['linkedid']][_0x4633('0x74')]){this[_0x4633('0xa1')](_0x1cdd84,_0x1cdd84[_0x4633('0xc9')],_0x1cdd84[_0x4633('0x14f')]);}else if(this['actions'][_0x1cdd84[_0x4633('0xc9')]]['dialAnswer']){logger[_0x4633('0x81')]('[syncHangup][talking][cause]',_0x1cdd84[_0x4633('0xc9')],_0x1cdd84[_0x4633('0x14f')],_0x4633('0xb8'),_0x173bda['name'],'pTalking:\x20',_0x173bda['pTalking']);this[_0x4633('0xa1')](_0x1cdd84,_0x1cdd84[_0x4633('0xc9')],_0x1cdd84['cause']);}}else if(_0x2c4017&&_[_0x4633('0x86')](_0x2c4017[_0x4633('0x150')])&&_0x173bda[_0x4633('0x151')]&&_0x1cdd84[_0x4633('0xc9')]===_0x1cdd84[_0x4633('0xc8')]&&_['isNil'](_0x1cdd84['reason'])&&_0x1cdd84[_0x4633('0x14f')]==='16'&&_0x1cdd84['channelstate']==='6'&&_[_0x4633('0x106')](_0x2c4017['transfer'])){if(_0x2c4017[_0x4633('0xb0')]){rpcDb[_0x4633('0x127')](_0x2c4017[_0x4633('0xb3')]);}if(_0x2c4017[_0x4633('0xb1')]){rpcDb['disableContact'](_0x2c4017[_0x4633('0xb3')]);}_0x1cdd84[_0x4633('0x107')]='22';this['callProgressDetectingAgent'](_0x2c4017,_0x173bda,_0x1cdd84);}else if(_0x2c4017&&_0x2c4017['transfer']){if(_0x1cdd84[_0x4633('0x14f')]==='16'&&this['actions'][_0x1cdd84[_0x4633('0xc9')]][_0x4633('0x74')]){logger[_0x4633('0x81')]('[syncHangup][talking][transfer]',_0x1cdd84[_0x4633('0xc9')],_0x1cdd84[_0x4633('0x14f')],'\x20Queue',_0x173bda[_0x4633('0x56')],_0x4633('0x73'),_0x173bda[_0x4633('0x29')]);this[_0x4633('0xa1')](_0x1cdd84,_0x1cdd84[_0x4633('0xc9')],_0x1cdd84[_0x4633('0x14f')]);}else if(this['actions'][_0x1cdd84['linkedid']][_0x4633('0x74')]){logger['info'](_0x4633('0x152'),_0x1cdd84[_0x4633('0xc9')],_0x1cdd84[_0x4633('0x14f')],_0x4633('0xb8'),_0x173bda[_0x4633('0x56')],_0x4633('0x73'),_0x173bda[_0x4633('0x29')]);this['callProgressDetectingCustomer'](_0x1cdd84,_0x1cdd84['linkedid'],_0x1cdd84['cause']);}}};Preview[_0x4633('0x68')][_0x4633('0x1e')]=function(_0xf1f77a){if(this[_0x4633('0x71')][_0xf1f77a[_0x4633('0x153')]]&&_0xf1f77a['destlinkedid']!==_0xf1f77a[_0x4633('0x154')]){this[_0x4633('0xa1')](_0xf1f77a,_0xf1f77a[_0x4633('0x153')],_0xf1f77a[_0x4633('0xfc')]);}};Preview[_0x4633('0x68')][_0x4633('0x1c')]=function(_0xaf13c3){if(this['actions'][_0xaf13c3[_0x4633('0xc9')]]&&_0xaf13c3[_0x4633('0xc9')]!==_0xaf13c3[_0x4633('0xc8')]&&!this[_0x4633('0x71')][_0xaf13c3[_0x4633('0xc9')]][_0x4633('0x74')]){if(_0xaf13c3['cause']==='1'){this[_0x4633('0xa1')](_0xaf13c3,_0xaf13c3[_0x4633('0xc9')],_0xaf13c3[_0x4633('0x14f')]);}}};Preview['prototype'][_0x4633('0x155')]=function(_0x3cb77f,_0x118da7,_0x29310c){if(this[_0x4633('0x71')][_0x3cb77f]){if(_['isNil'](this[_0x4633('0x71')][_0x3cb77f]['variables'])){this[_0x4633('0x71')][_0x3cb77f][_0x4633('0x156')]={};}this[_0x4633('0x71')][_0x3cb77f][_0x4633('0x156')][_0x118da7]=_0x29310c;}};Preview[_0x4633('0x68')][_0x4633('0x21')]=function(_0x5abfe9){try{if(!_['isNil'](_0x5abfe9)){if(ut[_0x4633('0x157')](_['keys'](_0x5abfe9['variable'])[0x0])){this[_0x4633('0x155')](_0x5abfe9[_0x4633('0xc8')],_[_0x4633('0x158')](_0x5abfe9['variable'])[0x0],_0x5abfe9[_0x4633('0x159')]);}}}catch(_0x39ed50){logger[_0x4633('0x15a')](_0x4633('0x15b'),util[_0x4633('0x15c')](_0x39ed50,{'showHidden':![],'depth':null}));}};Preview[_0x4633('0x68')][_0x4633('0x22')]=function(_0x65521){if(_0x65521){if(this['actions'][_0x65521[_0x4633('0x15d')]]){this['actions'][_0x65521['transfertargetlinkedid']][_0x4633('0x15e')]=!![];}}};Preview[_0x4633('0x68')]['syncBlindTransfer']=function(_0x5a1665){if(_0x5a1665){if(this[_0x4633('0x71')][_0x5a1665[_0x4633('0x15f')]]){this[_0x4633('0x71')][_0x5a1665[_0x4633('0x15f')]][_0x4633('0x15e')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index cd3387f..0fd4910 100644 --- a/server/services/ami/preview/rpcDb.js +++ b/server/services/ami/preview/rpcDb.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8074=['lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x2d7eca,_0x18f317){var _0xa9299d=function(_0x352ccd){while(--_0x352ccd){_0x2d7eca['push'](_0x2d7eca['shift']());}};_0xa9299d(++_0x18f317);}(_0x8074,0x134));var _0x4807=function(_0x5cfd0d,_0x542eee){_0x5cfd0d=_0x5cfd0d-0x0;var _0x28b9af=_0x8074[_0x5cfd0d];return _0x28b9af;};'use strict';var util=require(_0x4807('0x0'));var BPromise=require(_0x4807('0x1'));var logger=require(_0x4807('0x2'))(_0x4807('0x3'));var _=require(_0x4807('0x4'));var cmHopper=require(_0x4807('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4807('0x6'));var voiceQueueRt=require(_0x4807('0x7'));var agentReportPreview=require(_0x4807('0x8'));var voiceQueueReport=require(_0x4807('0x9'));function loggerCatch(_0x236df2){return function(_0x83c7e5){logger[_0x4807('0xa')](_0x236df2,util['inspect'](_0x83c7e5,{'showHidden':![],'depth':null}));};}function create(_0x27e8e0){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopperHistory['createHistory'](_0x27e8e0))[_0x4807('0xd')](loggerCatch(_0x4807('0xe')));}function createAgent(_0xcf6519){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](agentReportPreview[_0x4807('0xf')](_0xcf6519))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x42daa8){return BPromise['resolve']()[_0x4807('0xc')](cmHopper[_0x4807('0x10')](_0x42daa8,!![]))[_0x4807('0xd')](loggerCatch(_0x4807('0x11')));}exports[_0x4807('0x12')]=function(_0x3a399e){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopperBlack[_0x4807('0x12')](_0x3a399e))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x4807('0x13')]=function(_0x26138b){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x13')](_0x26138b))[_0x4807('0xd')](loggerCatch(_0x4807('0x14')));};exports[_0x4807('0xf')]=function(_0x5ea473,_0x4e5647){create(_0x5ea473)[_0x4807('0xd')](loggerCatch(_0x4e5647));moveContact(_0x5ea473)[_0x4807('0xd')](loggerCatch(_0x4e5647));};exports[_0x4807('0x15')]=function(_0x391214,_0x2de021){createAgent(_0x391214)[_0x4807('0xd')](loggerCatch(_0x2de021));};exports[_0x4807('0x16')]=function(_0x478777,_0x1ada09){create(_0x478777)[_0x4807('0xd')](loggerCatch(_0x1ada09));};exports['createCustomerFinal']=function(_0x389c1c,_0x3c5ae7){moveContact(_0x389c1c)[_0x4807('0xd')](loggerCatch(_0x3c5ae7));};exports['rescheduleContact']=function(_0x444aab,_0x22f898,_0x31cef4){if(_0x22f898){_0x444aab['UserId']=null;}if(_0x31cef4){_0x444aab[_0x4807('0x17')]=![];}return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper['rescheduleContact'](_0x444aab))[_0x4807('0xd')](loggerCatch(_0x4807('0x18')));};exports['countReScheduled']=function(_0x426004){return BPromise[_0x4807('0xb')]()['then'](cmHopper['countReScheduled'](_0x426004))[_0x4807('0xd')](loggerCatch(_0x4807('0x19')));};exports['unlockContact']=function(_0x46eaa6){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x1a')]({'UserId':null},_0x46eaa6,0x1))[_0x4807('0xd')](loggerCatch(_0x4807('0x1b')));};exports['disableContact']=function(_0x66b1d){return BPromise['resolve']()[_0x4807('0xc')](cmHopper['unlockContact']({'active':![]},_0x66b1d,0x1))['catch'](loggerCatch(_0x4807('0x1c')));};exports[_0x4807('0x1d')]=function(_0x446497){var _0xbbda3d={};_0xbbda3d[_0x4807('0x1e')]=_0x446497[_0x4807('0x1e')];_0xbbda3d['uniqueid']=_0x446497['uniqueid'];_0xbbda3d[_0x4807('0x1f')]=_0x446497[_0x4807('0x1f')];_0xbbda3d[_0x4807('0x20')]=_0x446497[_0x4807('0x20')];_0xbbda3d[_0x4807('0x21')]=_0x446497[_0x4807('0x21')];_0xbbda3d[_0x4807('0x22')]=_0x446497[_0x4807('0x23')];_0xbbda3d[_0x4807('0x24')]=_0x446497[_0x4807('0x23')];_0xbbda3d['queuecallercomplete']=0x1;_0xbbda3d[_0x4807('0x25')]=_0x446497['endtime'];_0xbbda3d[_0x4807('0x26')]=_0x446497['membername'];_0xbbda3d[_0x4807('0x27')]='from-sip';_0xbbda3d[_0x4807('0x28')]='xcally-motion-preview';_0xbbda3d[_0x4807('0x29')]=0x0;_0xbbda3d[_0x4807('0x2a')]=0x1;_0xbbda3d[_0x4807('0x2b')]=_0x446497[_0x4807('0x2c')];_0xbbda3d[_0x4807('0x2d')]=_0x4807('0x2e');return BPromise['resolve']()[_0x4807('0xc')](voiceQueueReport[_0x4807('0x2f')](_0xbbda3d))[_0x4807('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x4807('0x30')]=function(_0x5bd077,_0x45eb24){return BPromise['resolve']()[_0x4807('0xc')](cmHopper[_0x4807('0x30')](_0x5bd077,_0x45eb24))['catch'](loggerCatch(_0x4807('0x31')));};exports['rescheduleContactInQueue']=function(_0x3a9400){return BPromise[_0x4807('0xb')]()[_0x4807('0xc')](cmHopper[_0x4807('0x32')](_0x3a9400,!![],!![]))[_0x4807('0xd')](loggerCatch(_0x4807('0x33')));}; \ No newline at end of file +var _0x8c83=['uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','[createHistory]\x20','createHistory','catch','checkIsBlackList','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0x441280,_0x5b3e27){var _0x315d71=function(_0xa188ff){while(--_0xa188ff){_0x441280['push'](_0x441280['shift']());}};_0x315d71(++_0x5b3e27);}(_0x8c83,0xdd));var _0x38c8=function(_0x2a6aaf,_0x39d3ca){_0x2a6aaf=_0x2a6aaf-0x0;var _0x1c52a8=_0x8c83[_0x2a6aaf];return _0x1c52a8;};'use strict';var util=require(_0x38c8('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')('preview');var _=require(_0x38c8('0x1'));var cmHopper=require(_0x38c8('0x2'));var cmHopperFinal=require(_0x38c8('0x3'));var cmHopperHistory=require(_0x38c8('0x4'));var cmHopperBlack=require(_0x38c8('0x5'));var voiceQueueRt=require(_0x38c8('0x6'));var agentReportPreview=require(_0x38c8('0x7'));var voiceQueueReport=require(_0x38c8('0x8'));function loggerCatch(_0x13aa15){return function(_0x230dbd){logger[_0x38c8('0x9')](_0x13aa15,util[_0x38c8('0xa')](_0x230dbd,{'showHidden':![],'depth':null}));};}function create(_0x25867f){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopperHistory['createHistory'](_0x25867f))['catch'](loggerCatch(_0x38c8('0xd')));}function createAgent(_0x10f53b){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](agentReportPreview[_0x38c8('0xe')](_0x10f53b))[_0x38c8('0xf')](loggerCatch(_0x38c8('0xd')));}function moveContact(_0x4b52e6){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper['moveContactManagedDialer'](_0x4b52e6,!![]))[_0x38c8('0xf')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x38c8('0x10')]=function(_0xfe501){return BPromise[_0x38c8('0xb')]()['then'](cmHopperBlack[_0x38c8('0x10')](_0xfe501))[_0x38c8('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x86ec52){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper['getContactPreview'](_0x86ec52))[_0x38c8('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x38c8('0xe')]=function(_0xe62737,_0x164034){create(_0xe62737)['catch'](loggerCatch(_0x164034));moveContact(_0xe62737)[_0x38c8('0xf')](loggerCatch(_0x164034));};exports[_0x38c8('0x11')]=function(_0x5d1b54,_0x267c83){createAgent(_0x5d1b54)[_0x38c8('0xf')](loggerCatch(_0x267c83));};exports[_0x38c8('0x12')]=function(_0x20bda9,_0x56f95f){create(_0x20bda9)[_0x38c8('0xf')](loggerCatch(_0x56f95f));};exports[_0x38c8('0x13')]=function(_0x53ed4b,_0x398afe){moveContact(_0x53ed4b)[_0x38c8('0xf')](loggerCatch(_0x398afe));};exports[_0x38c8('0x14')]=function(_0x5ba813,_0x1dd393,_0x3cf309){if(_0x1dd393){_0x5ba813[_0x38c8('0x15')]=null;}if(_0x3cf309){_0x5ba813[_0x38c8('0x16')]=![];}return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper[_0x38c8('0x14')](_0x5ba813))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x82bcc1){return BPromise[_0x38c8('0xb')]()['then'](cmHopper['countReScheduled'](_0x82bcc1))[_0x38c8('0xf')](loggerCatch(_0x38c8('0x17')));};exports[_0x38c8('0x18')]=function(_0x52fb3a){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper[_0x38c8('0x18')]({'UserId':null},_0x52fb3a,0x1))[_0x38c8('0xf')](loggerCatch('[unlockContact]\x20'));};exports[_0x38c8('0x19')]=function(_0x550e0d){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper[_0x38c8('0x18')]({'active':![]},_0x550e0d,0x1))[_0x38c8('0xf')](loggerCatch(_0x38c8('0x1a')));};exports[_0x38c8('0x1b')]=function(_0x1a11a2){var _0x977a88={};_0x977a88[_0x38c8('0x1c')]=_0x1a11a2[_0x38c8('0x1c')];_0x977a88[_0x38c8('0x1d')]=_0x1a11a2[_0x38c8('0x1d')];_0x977a88['calleridnum']=_0x1a11a2[_0x38c8('0x1e')];_0x977a88['calleridname']=_0x1a11a2['calleridname'];_0x977a88[_0x38c8('0x1f')]=_0x1a11a2[_0x38c8('0x1f')];_0x977a88['queuecallerjoinAt']=_0x1a11a2[_0x38c8('0x20')];_0x977a88[_0x38c8('0x21')]=_0x1a11a2['answertime'];_0x977a88['queuecallercomplete']=0x1;_0x977a88[_0x38c8('0x22')]=_0x1a11a2[_0x38c8('0x23')];_0x977a88[_0x38c8('0x24')]=_0x1a11a2[_0x38c8('0x25')];_0x977a88[_0x38c8('0x26')]=_0x38c8('0x27');_0x977a88[_0x38c8('0x28')]=_0x38c8('0x29');_0x977a88['holdtime']=0x0;_0x977a88[_0x38c8('0x2a')]=0x1;_0x977a88['lastAssignedTo']=_0x1a11a2[_0x38c8('0x25')];_0x977a88['queuecallerexitreason']=_0x38c8('0x2b');return BPromise[_0x38c8('0xb')]()['then'](voiceQueueReport[_0x38c8('0x2c')](_0x977a88))[_0x38c8('0xf')](loggerCatch(_0x38c8('0x2d')));};exports[_0x38c8('0x2e')]=function(_0x1df6dd,_0x4a7a13){return BPromise[_0x38c8('0xb')]()[_0x38c8('0xc')](cmHopper[_0x38c8('0x2e')](_0x1df6dd,_0x4a7a13))[_0x38c8('0xf')](loggerCatch(_0x38c8('0x2f')));};exports[_0x38c8('0x30')]=function(_0x2331ef){return BPromise['resolve']()[_0x38c8('0xc')](cmHopper['rescheduleContact'](_0x2331ef,!![],!![]))[_0x38c8('0xf')](loggerCatch(_0x38c8('0x31')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index f0cdf4b..b509db4 100644 --- a/server/services/ami/preview/util/util.js +++ b/server/services/ami/preview/util/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c6f=['isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','updatedAt','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','logCustomer','talktime','answertime','isFailure','RECALL','originate','from-sip','timeout','uniqueid','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','voice','mandatoryDisposition','buildAcw','channelAgent','agentReadyId','not_inuse','status','push','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countbusyretry','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','lodash','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message'];(function(_0xe0b81f,_0x1fb734){var _0x290e5e=function(_0x19b8d3){while(--_0x19b8d3){_0xe0b81f['push'](_0xe0b81f['shift']());}};_0x290e5e(++_0x1fb734);}(_0x1c6f,0x7e));var _0xf1c6=function(_0xf9e7d6,_0x466010){_0xf9e7d6=_0xf9e7d6-0x0;var _0x20ed5c=_0x1c6f[_0xf9e7d6];return _0x20ed5c;};'use strict';var util=require(_0xf1c6('0x0'));var _=require(_0xf1c6('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xf1c6('0x2')][_0xf1c6('0x3')]||_0xf1c6('0x4');function getSeconds(_0x16f438,_0x36f91c){var _0x192fae=moment(_0x16f438)[_0xf1c6('0x5')](0x0);var _0x5ec014=moment(_0x36f91c)[_0xf1c6('0x5')](0x0);return _0x192fae[_0xf1c6('0x6')](_0x5ec014,_0xf1c6('0x7'));}exports[_0xf1c6('0x8')]=function(_0x143515){return function(_0x59e8a4){logger[_0xf1c6('0x9')](_0x143515,util['inspect'](_0x59e8a4,{'showHidden':![],'depth':null}));};};exports[_0xf1c6('0xa')]=function(_0x5a38ac,_0x4e1834){logger[_0xf1c6('0xb')](_0x5a38ac,util[_0xf1c6('0xc')](_0x4e1834,{'showHidden':![],'depth':null}));};exports[_0xf1c6('0xd')]=function(_0xd0a7f3,_0x1bda81){logger['error'](_0xd0a7f3,util[_0xf1c6('0xc')](_0x1bda81,{'showHidden':![],'depth':null}));};exports[_0xf1c6('0xe')]=function(_0x20d345){return function(_0x5c60ee){logger['info'](_0x20d345,util['inspect'](_0x5c60ee,{'showHidden':![],'depth':null}));};};exports[_0xf1c6('0xf')]=function(_0x219002,_0x36e021,_0x4eb99e){return{'message':_0x219002,'unlock':_0x36e021,'active':_0x4eb99e};};exports['getCallerId']=function(_0x465419,_0x259bf2,_0x3ca60b){if(!_[_0xf1c6('0x10')](_0x3ca60b)&&_0xf1c6('0x11')===typeof _0x3ca60b&&!_[_0xf1c6('0x12')](_0x3ca60b)){if(!_[_0xf1c6('0x10')](_0x259bf2)&&_0xf1c6('0x11')===typeof _0x259bf2&&!_[_0xf1c6('0x12')](_0x259bf2)){return util[_0xf1c6('0x13')](_0xf1c6('0x14'),_0x259bf2,_0x3ca60b);}return util[_0xf1c6('0x13')]('\x22%s\x22\x20<%s>',_0x3ca60b,_0x3ca60b);}if(!_[_0xf1c6('0x10')](_0x465419)&&_0xf1c6('0x11')===typeof _0x465419&&!_[_0xf1c6('0x12')](_0x465419)){return _0x465419;}return _0xf1c6('0x15');};exports['isActive']=function(_0x4bb74e){if(_['isNil'](_0x4bb74e)){return![];}return _0x4bb74e;};exports[_0xf1c6('0x16')]=function(_0x27fc75,_0xd072a3,_0x37ab4d,_0xe235d0,_0x19b266,_0x1509a6){var _0x35cd3c={'XMD-QUEUE':_0xd072a3['Queue']?_0xd072a3[_0xf1c6('0x17')][_0xf1c6('0x18')]:'','XMD-CALLERID':_0xe235d0,'XMD-CALLERID-PREVIEW':_0x1509a6?util[_0xf1c6('0x13')](_0xf1c6('0x14'),_0x1509a6[_0xf1c6('0x19')],_0x1509a6[_0xf1c6('0x1a')]):_0xe235d0,'XMD-DIALID':_0x19b266,'XMD-CONTACTID':_0xd072a3[_0xf1c6('0x1b')],'XMD-CDRTYPE':_0xf1c6('0x1c'),'CALLERID(all)':_0xe235d0,'XMD-VOICEQUEUEID':_0xd072a3[_0xf1c6('0x1d')],'XMD-DIALCHANNEL':_0x37ab4d,'XMD-DIALTIMEOUT':_0x27fc75[_0xf1c6('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xf1c6('0x13')](_0xf1c6('0x1f'),_0x27fc75[_0xf1c6('0x20')]?'g':'',_[_0xf1c6('0x12')](_0x27fc75[_0xf1c6('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x27fc75[_0xf1c6('0x22')]||'','XMD-AGI':_0x27fc75[_0xf1c6('0x23')]?util[_0xf1c6('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x27fc75[_0xf1c6('0x23')]):_0xf1c6('0x24'),'XMD-AGIAFTER':_0x27fc75['dialQueueProject2']?util[_0xf1c6('0x13')](_0xf1c6('0x25'),ipAgi,_0x27fc75[_0xf1c6('0x20')]):_0xf1c6('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x1509a6?_0x1509a6[_0xf1c6('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1509a6?_0x1509a6[_0xf1c6('0x27')]:'','XMD-DESTINATION':_0xf1c6('0x28'),'SIPADDHEADER':_0xf1c6('0x29')};if(!_['isEmpty'](_0x27fc75[_0xf1c6('0x21')])){_0x35cd3c[util[_0xf1c6('0x13')]('%s',_0xf1c6('0x2a'))]=_0x27fc75[_0xf1c6('0x21')];_0x35cd3c[util[_0xf1c6('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x19b266;}if(_0xd072a3&&_0xd072a3[_0xf1c6('0x2b')]){for(var _0x157948 in _0xd072a3['Contact']){if(_0xd072a3[_0xf1c6('0x2b')][_0xf1c6('0x2c')](_0x157948)){if(!_[_0xf1c6('0x2d')](_0xd072a3[_0xf1c6('0x2b')][_0x157948])&&_0x157948!=='id'&&_0x157948!==_0xf1c6('0x2e')&&_0x157948!=='createdAt'&&_0x157948!==_0xf1c6('0x2f')){_0x35cd3c[util[_0xf1c6('0x13')]('%s%s',_0xf1c6('0x30'),_[_0xf1c6('0x31')](_0x157948))]=_0xd072a3[_0xf1c6('0x2b')][_0x157948];}}}}return _0x35cd3c;};exports[_0xf1c6('0x32')]=function(_0x25e56b){var _0x5ef358={};for(var _0x389c37 in _0x25e56b){if(_0x25e56b[_0xf1c6('0x2c')](_0x389c37)){_0x5ef358[util[_0xf1c6('0x13')]('%s',_[_0xf1c6('0x33')](_0x389c37))]=_0x25e56b[_0x389c37];}}return{'variables':_0x5ef358};};exports[_0xf1c6('0x34')]=function(_0x3af91c,_0x2993e3){if(!_[_0xf1c6('0x2d')](_0x3af91c)){if(_0x3af91c[_0xf1c6('0x2c')](_0xf1c6('0x35'))){if(_0x3af91c[_0xf1c6('0x35')]>0x0){_0x3af91c[_0xf1c6('0x35')]-=0x1;}else{logger[_0xf1c6('0x9')](_0xf1c6('0x36'),_0x2993e3);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2993e3);}};exports[_0xf1c6('0x37')]=function(_0x2b5081){var _0x29e4a4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b5081[_0xf1c6('0x38')]=0xd;_0x2b5081[_0xf1c6('0x39')]=_0xf1c6('0x3a');_0x2b5081[_0xf1c6('0x3b')]=_0x29e4a4;_0x2b5081[_0xf1c6('0x3c')]=_0x29e4a4;_0x2b5081[_0xf1c6('0x3d')]=_0x29e4a4;};exports[_0xf1c6('0x3e')]=function(_0x1120ae,_0x426c01,_0x348f4c){var _0x4d7a42=moment()[_0xf1c6('0x13')](_0xf1c6('0x3f'));_0x1120ae[_0xf1c6('0x38')]=_0x426c01;_0x1120ae[_0xf1c6('0x39')]=_0x348f4c;_0x1120ae[_0xf1c6('0x3c')]=_0x4d7a42;_0x1120ae['ringtime']=getSeconds(_0x1120ae[_0xf1c6('0x3c')],_0x1120ae['starttime']);};exports[_0xf1c6('0x40')]=function(_0x4ccf80,_0x2fe44e,_0x234821){_0x4ccf80['membername']=_0x2fe44e;_0x4ccf80['UserId']=_0x234821;};exports[_0xf1c6('0x41')]=function(_0x1c3bdb,_0x549ee3,_0x17c011){var _0x5e7560=moment()[_0xf1c6('0x13')](_0xf1c6('0x3f'));_0x1c3bdb['state']=_0x549ee3;_0x1c3bdb['statedesc']=_0x17c011;_0x1c3bdb[_0xf1c6('0x3c')]=_0x1c3bdb['responsetime']?_0x1c3bdb[_0xf1c6('0x3c')]:_0x5e7560;_0x1c3bdb[_0xf1c6('0x3d')]=_0x1c3bdb[_0xf1c6('0x3d')]?_0x1c3bdb[_0xf1c6('0x3d')]:_0x5e7560;_0x1c3bdb['ringtime']=getSeconds(_0x1c3bdb[_0xf1c6('0x3c')]||0x0,_0x1c3bdb[_0xf1c6('0x3b')]||0x0);_0x1c3bdb[_0xf1c6('0x42')]=_0x1c3bdb[_0xf1c6('0x43')]?getSeconds(_0x1c3bdb['endtime'],_0x1c3bdb['answertime']):0x0;};exports[_0xf1c6('0x44')]=function(_0x1429c4){return _0x1429c4==='Failure';};exports['variablesAction']=function(_0x2ed2b8,_0x111da8,_0x24d026,_0x5e9494,_0x245fdc){var _0x511641=_0x5e9494?_0xf1c6('0x45'):_0x2ed2b8[_0xf1c6('0x19')];_0x511641=_0x245fdc?'BOOKED':_0x511641;return{'actionid':_0x2ed2b8['uniqueid'],'action':_0xf1c6('0x46'),'channel':_0x2ed2b8['channelAgent'],'callerid':util[_0xf1c6('0x13')]('\x22%s\x22\x20<%s>',_0x511641,_0x2ed2b8[_0xf1c6('0x1a')]),'Exten':'xcally-motion-preview','Context':_0xf1c6('0x47'),'Priority':'1','variable':_0x24d026,'timeout':(_0x111da8[_0xf1c6('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ed2b8[_0xf1c6('0x49')]};};exports[_0xf1c6('0x4a')]=function(_0x5205c2){return _0x5205c2['countbusyretry']+_0x5205c2[_0xf1c6('0x4b')]+_0x5205c2[_0xf1c6('0x4c')]+_0x5205c2['countagentrejectretry']+_0x5205c2['countnosuchnumberretry'];};exports[_0xf1c6('0x4d')]=function(_0xaf0bc7){var _0x31dfa8=_['clone'](_0xaf0bc7);_0x31dfa8['state']=0xf;_0x31dfa8[_0xf1c6('0x39')]=_0xf1c6('0x4e');return _0x31dfa8;};exports['scheduledAt']=function(_0x5252d4,_0x25c619,_0x4f9d05){var _0xff1efc={};_0xff1efc[_0x25c619]=_0x5252d4[_0x25c619];_0xff1efc[_0xf1c6('0x4f')]=![];_0xff1efc[_0xf1c6('0x50')]=moment()[_0xf1c6('0x51')](_0x4f9d05,_0xf1c6('0x52'))['format'](_0xf1c6('0x3f'));_0xff1efc[_0xf1c6('0x1b')]=_0x5252d4[_0xf1c6('0x1b')];_0xff1efc[_0xf1c6('0x53')]=_0x5252d4['ListId'];_0xff1efc[_0xf1c6('0x1d')]=_0x5252d4[_0xf1c6('0x1d')]||undefined;return _0xff1efc;};exports[_0xf1c6('0x54')]=function(_0x51d233,_0x58d89f){if(!_[_0xf1c6('0x2d')](_0x51d233)){if(_0x51d233['pTalking']>0x0){_0x51d233[_0xf1c6('0x55')]-=0x1;}else{logger['error'](_0x58d89f,_0xf1c6('0x56'));}}else{logger[_0xf1c6('0x9')](_0x58d89f,_0xf1c6('0x57'));}};exports[_0xf1c6('0x58')]=function(_0x32dda4){if(_0x32dda4<=0x0){return!![];}return![];};exports[_0xf1c6('0x59')]=function(_0x51e3f4,_0xd6f14f,_0x364b19){_0x51e3f4[_0xf1c6('0x5a')]=_0xd6f14f;_0x51e3f4[_0xf1c6('0x18')]=_0x51e3f4[_0xf1c6('0x5b')];_0x51e3f4[_0xf1c6('0x5c')]=_0x51e3f4['channelAgent'];_0x51e3f4['motionChannel']=_0xf1c6('0x5d');if(_0x364b19){_0x51e3f4[_0xf1c6('0x5e')]=_0x364b19['mandatoryDisposition'];}return _0x51e3f4;};exports[_0xf1c6('0x5f')]=function(_0xcc9022){var _0x4c6f3a={};_0x4c6f3a[_0xf1c6('0x5b')]=_0xcc9022['queue'];_0x4c6f3a[_0xf1c6('0x5c')]=_0xcc9022[_0xf1c6('0x60')];_0x4c6f3a[_0xf1c6('0x49')]=_0xcc9022[_0xf1c6('0x49')];return _0x4c6f3a;};exports[_0xf1c6('0x61')]=function(_0x43a72a){var _0x2e8a7c=[];for(var _0xf1590a in _0x43a72a){if(_0x43a72a[_0xf1c6('0x2c')](_0xf1590a)){if(!_[_0xf1c6('0x2d')](_0x43a72a[_0xf1590a])&&_0x43a72a[_0xf1590a]['state']===_0xf1c6('0x62')&&_0x43a72a[_0xf1590a][_0xf1c6('0x63')]==='reachable'){_0x2e8a7c[_0xf1c6('0x64')](_0x43a72a[_0xf1590a]['id']);}}}return _0x2e8a7c;};exports[_0xf1c6('0x65')]=function(_0x37d3f3){var _0x544eb4=moment()[_0xf1c6('0x5')](0x0);var _0x4ccd37=moment(_0x37d3f3)[_0xf1c6('0x5')](0x0);return _0x544eb4['diff'](_0x4ccd37,_0xf1c6('0x7'));};exports[_0xf1c6('0x66')]=function(_0xa4e8f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa4e8f[_0xf1c6('0x1b')],'ListId':_0xa4e8f[_0xf1c6('0x53')],'VoiceQueueId':_0xa4e8f[_0xf1c6('0x1d')]||undefined,'CampaignId':_0xa4e8f[_0xf1c6('0x67')]||undefined};};exports[_0xf1c6('0x68')]=function(_0x1ffbcd){if(_0x1ffbcd===_0xf1c6('0x49')||_0x1ffbcd===_0xf1c6('0x69')||_0x1ffbcd===_0xf1c6('0x5b')||_0x1ffbcd==='type'||_0x1ffbcd===_0xf1c6('0x6a')||_0x1ffbcd===_0xf1c6('0x6b')||_0x1ffbcd===_0xf1c6('0x6c')||_0x1ffbcd===_0xf1c6('0x60')||_0x1ffbcd===_0xf1c6('0x19')||_0x1ffbcd===_0xf1c6('0x4f')||_0x1ffbcd===_0xf1c6('0x1a')||_0x1ffbcd==='scheduledat'||_0x1ffbcd===_0xf1c6('0x6d')||_0x1ffbcd===_0xf1c6('0x4b')||_0x1ffbcd===_0xf1c6('0x4c')||_0x1ffbcd===_0xf1c6('0x6e')||_0x1ffbcd===_0xf1c6('0x6f')||_0x1ffbcd===_0xf1c6('0x70')||_0x1ffbcd==='callbackat'||_0x1ffbcd===_0xf1c6('0x71')||_0x1ffbcd===_0xf1c6('0x1b')||_0x1ffbcd===_0xf1c6('0x53')||_0x1ffbcd==='UserId'||_0x1ffbcd===_0xf1c6('0x1d')||_0x1ffbcd==='sipcallid'||_0x1ffbcd===_0xf1c6('0x72')||_0x1ffbcd===_0xf1c6('0x73')||_0x1ffbcd===_0xf1c6('0x74')||_0x1ffbcd===_0xf1c6('0x75')||_0x1ffbcd===_0xf1c6('0x76')||_0x1ffbcd===_0xf1c6('0x77')||_0x1ffbcd===_0xf1c6('0x78')||_0x1ffbcd===_0xf1c6('0x79')||_0x1ffbcd===_0xf1c6('0x7a')||_0x1ffbcd==='xmd-contactid'||_0x1ffbcd===_0xf1c6('0x7b')||_0x1ffbcd===_0xf1c6('0x7c')||_0x1ffbcd===_0xf1c6('0x7d')||_0x1ffbcd==='xmd-agi'||_0x1ffbcd===_0xf1c6('0x7e')||_0x1ffbcd==='rtpaudioqosbridged'||_0x1ffbcd===_0xf1c6('0x7f')||_0x1ffbcd===_0xf1c6('0x80')||_0x1ffbcd===_0xf1c6('0x81')||_0x1ffbcd===_0xf1c6('0x82')||_0x1ffbcd===_0xf1c6('0x83')||_0x1ffbcd===_0xf1c6('0x84')||_0x1ffbcd===_0xf1c6('0x7e')||_0x1ffbcd===_0xf1c6('0x85')||_0x1ffbcd==='rtpaudioqosjitter'||_0x1ffbcd==='rtpaudioqosjitterbridged'||_0x1ffbcd===_0xf1c6('0x81')||_0x1ffbcd===_0xf1c6('0x82')||_0x1ffbcd===_0xf1c6('0x83')||_0x1ffbcd===_0xf1c6('0x84')||_0x1ffbcd===_0xf1c6('0x86')||_0x1ffbcd===_0xf1c6('0x87')||_0x1ffbcd==='state'||_0x1ffbcd==='statedesc'){return![];}return!![];};exports[_0xf1c6('0x88')]=function(_0x22fdf7,_0x1d4f23){var _0x28754f,_0x3262ac,_0x13b241;if(_0x1d4f23<=0x0){_0x1d4f23=0x1;}_0x28754f=new RegExp('\x5cw{0,'+_0x1d4f23+'}$');_0x3262ac=Math[_0xf1c6('0x89')](0xa,_0x1d4f23-0x1);_0x13b241=Math[_0xf1c6('0x89')](0xa,_0x1d4f23)-0x1;return util[_0xf1c6('0x13')]('%s',_[_0xf1c6('0x8a')](_0x22fdf7,_0x28754f,_[_0xf1c6('0x8b')](_0x3262ac,_0x13b241)));};exports['extractCalleridName']=function(_0x332e7d){var _0x13b0c1=_0x332e7d[_0xf1c6('0x8c')](/"(.*?)"/);return _0x13b0c1?_0x13b0c1[0x1]:_0x332e7d;};exports[_0xf1c6('0x8d')]=function(_0x30c130){var _0x2313c1=_0x30c130[_0xf1c6('0x8c')](/<(.*?)>/);return _0x2313c1?_0x2313c1[0x1]:_0x30c130;}; \ No newline at end of file +var _0x6650=['getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','addVariables','Queue','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','getDiff','createBody','CampaignId','idContact','type','dialAnswer','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosrtt','bridgepeer'];(function(_0x3e0628,_0x511646){var _0x4e1918=function(_0xe98ca7){while(--_0xe98ca7){_0x3e0628['push'](_0x3e0628['shift']());}};_0x4e1918(++_0x511646);}(_0x6650,0x97));var _0x0665=function(_0x9ae07b,_0x7881fa){_0x9ae07b=_0x9ae07b-0x0;var _0x4edaad=_0x6650[_0x9ae07b];return _0x4edaad;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x0665('0x0'));var logger=require('../../../../config/logger')(_0x0665('0x1'));var ipAgi=process['env'][_0x0665('0x2')]||_0x0665('0x3');function getSeconds(_0x3c99bc,_0xd5ed52){var _0x5d4ce9=moment(_0x3c99bc)[_0x0665('0x4')](0x0);var _0x8ecbf1=moment(_0xd5ed52)[_0x0665('0x4')](0x0);return _0x5d4ce9[_0x0665('0x5')](_0x8ecbf1,_0x0665('0x6'));}exports[_0x0665('0x7')]=function(_0x3dcdf8){return function(_0x2af924){logger[_0x0665('0x8')](_0x3dcdf8,util[_0x0665('0x9')](_0x2af924,{'showHidden':![],'depth':null}));};};exports[_0x0665('0xa')]=function(_0x152b2b,_0x5637ba){logger[_0x0665('0xb')](_0x152b2b,util[_0x0665('0x9')](_0x5637ba,{'showHidden':![],'depth':null}));};exports[_0x0665('0xc')]=function(_0x4f33f2,_0x2d0c60){logger['error'](_0x4f33f2,util[_0x0665('0x9')](_0x2d0c60,{'showHidden':![],'depth':null}));};exports[_0x0665('0xd')]=function(_0x1903ec){return function(_0x4c3058){logger[_0x0665('0xb')](_0x1903ec,util[_0x0665('0x9')](_0x4c3058,{'showHidden':![],'depth':null}));};};exports[_0x0665('0xe')]=function(_0x1ef709,_0x42c2e5,_0x4796c2){return{'message':_0x1ef709,'unlock':_0x42c2e5,'active':_0x4796c2};};exports[_0x0665('0xf')]=function(_0x499ff8,_0x307837,_0x3bd97f){if(!_['isUndefined'](_0x3bd97f)&&_0x0665('0x10')===typeof _0x3bd97f&&!_[_0x0665('0x11')](_0x3bd97f)){if(!_['isUndefined'](_0x307837)&&'string'===typeof _0x307837&&!_[_0x0665('0x11')](_0x307837)){return util['format'](_0x0665('0x12'),_0x307837,_0x3bd97f);}return util[_0x0665('0x13')](_0x0665('0x12'),_0x3bd97f,_0x3bd97f);}if(!_['isUndefined'](_0x499ff8)&&_0x0665('0x10')===typeof _0x499ff8&&!_['isEmpty'](_0x499ff8)){return _0x499ff8;}return _0x0665('0x14');};exports[_0x0665('0x15')]=function(_0x22000a){if(_['isNil'](_0x22000a)){return![];}return _0x22000a;};exports[_0x0665('0x16')]=function(_0x2f72ea,_0x211bd8,_0x1277ab,_0x52335a,_0x299dca,_0x2d3fac){var _0x4042fc={'XMD-QUEUE':_0x211bd8['Queue']?_0x211bd8[_0x0665('0x17')]['name']:'','XMD-CALLERID':_0x52335a,'XMD-CALLERID-PREVIEW':_0x2d3fac?util['format']('\x22%s\x22\x20<%s>',_0x2d3fac['calleridname'],_0x2d3fac[_0x0665('0x18')]):_0x52335a,'XMD-DIALID':_0x299dca,'XMD-CONTACTID':_0x211bd8[_0x0665('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x52335a,'XMD-VOICEQUEUEID':_0x211bd8[_0x0665('0x1a')],'XMD-DIALCHANNEL':_0x1277ab,'XMD-DIALTIMEOUT':_0x2f72ea[_0x0665('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x0665('0x13')]('\x22rtTxX%s%s\x22',_0x2f72ea[_0x0665('0x1c')]?'g':'',_[_0x0665('0x11')](_0x2f72ea[_0x0665('0x1d')])?'':_0x0665('0x1e')),'XMD-DIALURL':_0x2f72ea[_0x0665('0x1f')]||'','XMD-AGI':_0x2f72ea[_0x0665('0x20')]?util[_0x0665('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2f72ea['dialQueueProject']):_0x0665('0x21'),'XMD-AGIAFTER':_0x2f72ea[_0x0665('0x1c')]?util[_0x0665('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2f72ea[_0x0665('0x1c')]):_0x0665('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2d3fac?_0x2d3fac[_0x0665('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2d3fac?_0x2d3fac['originatecalleridname']:'','XMD-DESTINATION':_0x0665('0x23'),'SIPADDHEADER':_0x0665('0x24')};if(!_[_0x0665('0x11')](_0x2f72ea[_0x0665('0x1d')])){_0x4042fc[util[_0x0665('0x13')]('%s',_0x0665('0x25'))]=_0x2f72ea[_0x0665('0x1d')];_0x4042fc[util[_0x0665('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x299dca;}if(_0x211bd8&&_0x211bd8[_0x0665('0x26')]){for(var _0x418953 in _0x211bd8['Contact']){if(_0x211bd8[_0x0665('0x26')][_0x0665('0x27')](_0x418953)){if(!_[_0x0665('0x28')](_0x211bd8['Contact'][_0x418953])&&_0x418953!=='id'&&_0x418953!==_0x0665('0x29')&&_0x418953!=='createdAt'&&_0x418953!==_0x0665('0x2a')){_0x4042fc[util[_0x0665('0x13')](_0x0665('0x2b'),_0x0665('0x2c'),_[_0x0665('0x2d')](_0x418953))]=_0x211bd8[_0x0665('0x26')][_0x418953];}}}}return _0x4042fc;};exports[_0x0665('0x2e')]=function(_0x43245c){var _0x3413af={};for(var _0x116b49 in _0x43245c){if(_0x43245c[_0x0665('0x27')](_0x116b49)){_0x3413af[util[_0x0665('0x13')]('%s',_[_0x0665('0x2f')](_0x116b49))]=_0x43245c[_0x116b49];}}return{'variables':_0x3413af};};exports['updateOriginated']=function(_0x250864,_0xa59e4){if(!_[_0x0665('0x28')](_0x250864)){if(_0x250864[_0x0665('0x27')](_0x0665('0x30'))){if(_0x250864[_0x0665('0x30')]>0x0){_0x250864[_0x0665('0x30')]-=0x1;}else{logger[_0x0665('0x8')](_0x0665('0x31'),_0xa59e4);}}}else{logger[_0x0665('0x8')](_0x0665('0x32'),_0xa59e4);}};exports[_0x0665('0x33')]=function(_0x250c2c){var _0x253e0d=moment()[_0x0665('0x13')](_0x0665('0x34'));_0x250c2c[_0x0665('0x35')]=0xd;_0x250c2c[_0x0665('0x36')]=_0x0665('0x37');_0x250c2c[_0x0665('0x38')]=_0x253e0d;_0x250c2c['responsetime']=_0x253e0d;_0x250c2c[_0x0665('0x39')]=_0x253e0d;};exports['logAgent']=function(_0x213b65,_0x654284,_0x2020ce){var _0x3122a7=moment()[_0x0665('0x13')](_0x0665('0x34'));_0x213b65[_0x0665('0x35')]=_0x654284;_0x213b65['statedesc']=_0x2020ce;_0x213b65[_0x0665('0x3a')]=_0x3122a7;_0x213b65[_0x0665('0x3b')]=getSeconds(_0x213b65[_0x0665('0x3a')],_0x213b65[_0x0665('0x38')]);};exports[_0x0665('0x3c')]=function(_0x2034e1,_0x1e2d2d,_0x3491ca){_0x2034e1[_0x0665('0x3d')]=_0x1e2d2d;_0x2034e1[_0x0665('0x3e')]=_0x3491ca;};exports[_0x0665('0x3f')]=function(_0x56feea,_0xd29327,_0x1b1261){var _0x49b70c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x56feea[_0x0665('0x35')]=_0xd29327;_0x56feea[_0x0665('0x36')]=_0x1b1261;_0x56feea[_0x0665('0x3a')]=_0x56feea[_0x0665('0x3a')]?_0x56feea[_0x0665('0x3a')]:_0x49b70c;_0x56feea['endtime']=_0x56feea['endtime']?_0x56feea[_0x0665('0x39')]:_0x49b70c;_0x56feea[_0x0665('0x3b')]=getSeconds(_0x56feea[_0x0665('0x3a')]||0x0,_0x56feea[_0x0665('0x38')]||0x0);_0x56feea[_0x0665('0x40')]=_0x56feea[_0x0665('0x41')]?getSeconds(_0x56feea[_0x0665('0x39')],_0x56feea[_0x0665('0x41')]):0x0;};exports[_0x0665('0x42')]=function(_0x455271){return _0x455271==='Failure';};exports[_0x0665('0x43')]=function(_0x3efa83,_0x26812a,_0x2aff66,_0x3d7885,_0x2f6df7){var _0x2787be=_0x3d7885?_0x0665('0x44'):_0x3efa83[_0x0665('0x45')];_0x2787be=_0x2f6df7?_0x0665('0x46'):_0x2787be;return{'actionid':_0x3efa83['uniqueid'],'action':_0x0665('0x47'),'channel':_0x3efa83[_0x0665('0x48')],'callerid':util[_0x0665('0x13')]('\x22%s\x22\x20<%s>',_0x2787be,_0x3efa83[_0x0665('0x18')]),'Exten':'xcally-motion-preview','Context':_0x0665('0x49'),'Priority':'1','variable':_0x2aff66,'timeout':(_0x26812a[_0x0665('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3efa83[_0x0665('0x4b')]};};exports[_0x0665('0x4c')]=function(_0x45a1a4){return _0x45a1a4[_0x0665('0x4d')]+_0x45a1a4[_0x0665('0x4e')]+_0x45a1a4['countnoanswerretry']+_0x45a1a4['countagentrejectretry']+_0x45a1a4[_0x0665('0x4f')];};exports[_0x0665('0x50')]=function(_0x17c1e8){var _0x55d389=_['clone'](_0x17c1e8);_0x55d389[_0x0665('0x35')]=0xf;_0x55d389[_0x0665('0x36')]='Global';return _0x55d389;};exports[_0x0665('0x51')]=function(_0xac0240,_0x26c40f,_0xfb34ea){var _0x4c8ae0={};_0x4c8ae0[_0x26c40f]=_0xac0240[_0x26c40f];_0x4c8ae0[_0x0665('0x52')]=![];_0x4c8ae0[_0x0665('0x53')]=moment()[_0x0665('0x54')](_0xfb34ea,_0x0665('0x55'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c8ae0[_0x0665('0x19')]=_0xac0240[_0x0665('0x19')];_0x4c8ae0['ListId']=_0xac0240[_0x0665('0x56')];_0x4c8ae0[_0x0665('0x1a')]=_0xac0240['VoiceQueueId']||undefined;return _0x4c8ae0;};exports[_0x0665('0x57')]=function(_0x18edb5,_0x52fa65){if(!_[_0x0665('0x28')](_0x18edb5)){if(_0x18edb5[_0x0665('0x58')]>0x0){_0x18edb5[_0x0665('0x58')]-=0x1;}else{logger[_0x0665('0x8')](_0x52fa65,_0x0665('0x59'));}}else{logger[_0x0665('0x8')](_0x52fa65,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x0665('0x5a')]=function(_0x3958cc){if(_0x3958cc<=0x0){return!![];}return![];};exports[_0x0665('0x5b')]=function(_0x25d616,_0x5be9bf,_0x33d55d){_0x25d616[_0x0665('0x5c')]=_0x5be9bf;_0x25d616[_0x0665('0x5d')]=_0x25d616[_0x0665('0x5e')];_0x25d616[_0x0665('0x5f')]=_0x25d616['channelAgent'];_0x25d616[_0x0665('0x60')]=_0x0665('0x61');if(_0x33d55d){_0x25d616[_0x0665('0x62')]=_0x33d55d[_0x0665('0x62')];}return _0x25d616;};exports[_0x0665('0x63')]=function(_0x2305b0){var _0x2b1d03={};_0x2b1d03['queue']=_0x2305b0[_0x0665('0x5e')];_0x2b1d03['interface']=_0x2305b0['channelAgent'];_0x2b1d03[_0x0665('0x4b')]=_0x2305b0['uniqueid'];return _0x2b1d03;};exports[_0x0665('0x64')]=function(_0x29e525){var _0x50ab1d=[];for(var _0xebcb41 in _0x29e525){if(_0x29e525['hasOwnProperty'](_0xebcb41)){if(!_['isNil'](_0x29e525[_0xebcb41])&&_0x29e525[_0xebcb41][_0x0665('0x35')]==='not_inuse'&&_0x29e525[_0xebcb41][_0x0665('0x65')]===_0x0665('0x66')){_0x50ab1d[_0x0665('0x67')](_0x29e525[_0xebcb41]['id']);}}}return _0x50ab1d;};exports[_0x0665('0x68')]=function(_0x483544){var _0x22ceb4=moment()['milliseconds'](0x0);var _0x350ec6=moment(_0x483544)[_0x0665('0x4')](0x0);return _0x22ceb4['diff'](_0x350ec6,_0x0665('0x6'));};exports[_0x0665('0x69')]=function(_0x394e07){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x394e07[_0x0665('0x19')],'ListId':_0x394e07['ListId'],'VoiceQueueId':_0x394e07[_0x0665('0x1a')]||undefined,'CampaignId':_0x394e07[_0x0665('0x6a')]||undefined};};exports['filterKey']=function(_0x2326d8){if(_0x2326d8===_0x0665('0x4b')||_0x2326d8===_0x0665('0x6b')||_0x2326d8===_0x0665('0x5e')||_0x2326d8===_0x0665('0x6c')||_0x2326d8==='campaigntype'||_0x2326d8===_0x0665('0x6d')||_0x2326d8===_0x0665('0x3d')||_0x2326d8===_0x0665('0x48')||_0x2326d8===_0x0665('0x45')||_0x2326d8===_0x0665('0x52')||_0x2326d8===_0x0665('0x18')||_0x2326d8===_0x0665('0x53')||_0x2326d8===_0x0665('0x4d')||_0x2326d8===_0x0665('0x4e')||_0x2326d8===_0x0665('0x6e')||_0x2326d8==='countglobal'||_0x2326d8===_0x0665('0x6f')||_0x2326d8===_0x0665('0x70')||_0x2326d8===_0x0665('0x71')||_0x2326d8===_0x0665('0x72')||_0x2326d8===_0x0665('0x19')||_0x2326d8===_0x0665('0x56')||_0x2326d8===_0x0665('0x3e')||_0x2326d8==='VoiceQueueId'||_0x2326d8==='sipcallid'||_0x2326d8==='xmd-voicequeueid'||_0x2326d8===_0x0665('0x73')||_0x2326d8===_0x0665('0x74')||_0x2326d8===_0x0665('0x75')||_0x2326d8===_0x0665('0x76')||_0x2326d8===_0x0665('0x77')||_0x2326d8===_0x0665('0x78')||_0x2326d8===_0x0665('0x79')||_0x2326d8===_0x0665('0x7a')||_0x2326d8===_0x0665('0x7b')||_0x2326d8===_0x0665('0x7c')||_0x2326d8===_0x0665('0x7d')||_0x2326d8==='xmd-agiafter'||_0x2326d8===_0x0665('0x7e')||_0x2326d8==='rtpaudioqos'||_0x2326d8===_0x0665('0x7f')||_0x2326d8==='rtpaudioqosjitter'||_0x2326d8===_0x0665('0x80')||_0x2326d8===_0x0665('0x81')||_0x2326d8===_0x0665('0x82')||_0x2326d8==='rtpaudioqosrtt'||_0x2326d8===_0x0665('0x83')||_0x2326d8==='rtpaudioqos'||_0x2326d8==='rtpaudioqosbridged'||_0x2326d8===_0x0665('0x84')||_0x2326d8===_0x0665('0x80')||_0x2326d8===_0x0665('0x81')||_0x2326d8===_0x0665('0x82')||_0x2326d8===_0x0665('0x85')||_0x2326d8===_0x0665('0x83')||_0x2326d8===_0x0665('0x86')||_0x2326d8==='bridgepvtcallid'||_0x2326d8===_0x0665('0x35')||_0x2326d8===_0x0665('0x36')){return![];}return!![];};exports[_0x0665('0x87')]=function(_0x4cadfe,_0x51ba14){var _0x2f99c2,_0x51dea0,_0x17d6d4;if(_0x51ba14<=0x0){_0x51ba14=0x1;}_0x2f99c2=new RegExp(_0x0665('0x88')+_0x51ba14+'}$');_0x51dea0=Math[_0x0665('0x89')](0xa,_0x51ba14-0x1);_0x17d6d4=Math['pow'](0xa,_0x51ba14)-0x1;return util['format']('%s',_[_0x0665('0x8a')](_0x4cadfe,_0x2f99c2,_[_0x0665('0x8b')](_0x51dea0,_0x17d6d4)));};exports[_0x0665('0x8c')]=function(_0x16e70b){var _0x58d5b5=_0x16e70b[_0x0665('0x8d')](/"(.*?)"/);return _0x58d5b5?_0x58d5b5[0x1]:_0x16e70b;};exports[_0x0665('0x8e')]=function(_0x16f485){var _0x5e4b40=_0x16f485[_0x0665('0x8d')](/<(.*?)>/);return _0x5e4b40?_0x5e4b40[0x1]:_0x16f485;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index bdc2e69..30c2438 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5825=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean'];(function(_0xfa1272,_0xf55d62){var _0x384905=function(_0x369669){while(--_0x369669){_0xfa1272['push'](_0xfa1272['shift']());}};_0x384905(++_0xf55d62);}(_0x5825,0x68));var _0x5582=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5825[_0x122ef9];return _0x42fba0;};'use strict';exports[_0x5582('0x0')]={'queue':{'type':_0x5582('0x1'),'required':!![]},'interface':{'type':_0x5582('0x1'),'required':!![]},'membername':{'type':_0x5582('0x1'),'required':!![]},'penalty':{'type':_0x5582('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x5582('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0x4')]={'interface':{'type':_0x5582('0x1'),'required':!![]},'paused':{'type':_0x5582('0x5')},'reason':{'type':_0x5582('0x1'),'required':![]}};exports[_0x5582('0x6')]={'module':{'type':_0x5582('0x1'),'required':![]}};exports[_0x5582('0x7')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0x8')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x5582('0x9')]={'uniqueid':{'type':_0x5582('0x1'),'required':!![]}};exports[_0x5582('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x5582('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x746a=['reload','voicequeuechannel','voicechannel','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x2f0c5e,_0x44249c){var _0x5fc8ba=function(_0x126e36){while(--_0x126e36){_0x2f0c5e['push'](_0x2f0c5e['shift']());}};_0x5fc8ba(++_0x44249c);}(_0x746a,0x18f));var _0xa746=function(_0x1ee9d6,_0x5b7a66){_0x1ee9d6=_0x1ee9d6-0x0;var _0x50b20a=_0x746a[_0x1ee9d6];return _0x50b20a;};'use strict';exports[_0xa746('0x0')]={'queue':{'type':_0xa746('0x1'),'required':!![]},'interface':{'type':_0xa746('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xa746('0x2'),'required':![]},'paused':{'type':_0xa746('0x3'),'required':![]}};exports[_0xa746('0x4')]={'queue':{'type':_0xa746('0x1'),'required':!![]},'interface':{'type':_0xa746('0x1'),'required':!![]}};exports[_0xa746('0x5')]={'interface':{'type':_0xa746('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xa746('0x1'),'required':![]}};exports[_0xa746('0x6')]={'module':{'type':'string','required':![]}};exports[_0xa746('0x7')]={'uniqueid':{'type':_0xa746('0x1'),'required':!![]}};exports[_0xa746('0x8')]={'uniqueid':{'type':_0xa746('0x1'),'required':!![]},'filename':{'type':_0xa746('0x1')},'format':{'type':_0xa746('0x1')},'mixmonitorid':{'type':_0xa746('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa746('0x1'),'required':!![]},'context':{'type':_0xa746('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 2a0ea6b..69fc186 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1e7=['duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','unmanaged','outboundNoAnswerCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isUndefined','initTelephones','length','trunks','voiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerleaveAt','initVoiceCallReports'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xe1e7,0xda));var _0x7e1e=function(_0x1c1eeb,_0x5271c1){_0x1c1eeb=_0x1c1eeb-0x0;var _0x2214ee=_0xe1e7[_0x1c1eeb];return _0x2214ee;};'use strict';var BPromise=require('bluebird');var util=require(_0x7e1e('0x0'));var _=require(_0x7e1e('0x1'));var moment=require(_0x7e1e('0x2'));var Agent=require(_0x7e1e('0x3'));var Telephone=require(_0x7e1e('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x7e1e('0x5'));var Trigger=require(_0x7e1e('0x6'));var Template=require(_0x7e1e('0x7'));var Campaign=require(_0x7e1e('0x8'));var VoiceExtension=require(_0x7e1e('0x9'));var ZendeskAccount=require(_0x7e1e('0xa'));var SalesforceAccount=require(_0x7e1e('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x7e1e('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x7e1e('0xd'));var VtigerAccount=require(_0x7e1e('0xe'));var ServicenowAccount=require(_0x7e1e('0xf'));var Dynamics365Account=require(_0x7e1e('0x10'));var FreshsalesAccount=require(_0x7e1e('0x11'));var FaxAccount=require(_0x7e1e('0x12'));var Realtime=function(){this[_0x7e1e('0x13')]={};this[_0x7e1e('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0x7e1e('0x15')]={};this[_0x7e1e('0x16')]={};this[_0x7e1e('0x17')]={};this[_0x7e1e('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7e1e('0x19')]={};this[_0x7e1e('0x1a')]={};this[_0x7e1e('0x1b')]={};this[_0x7e1e('0x1c')]={};this['timers']={};this[_0x7e1e('0x1d')]={};this[_0x7e1e('0x1e')]={};this[_0x7e1e('0x1f')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x7e1e('0x20')]={};this[_0x7e1e('0x21')]={};this[_0x7e1e('0x22')]={};this['servicenowAccounts']={};this[_0x7e1e('0x23')]={};this[_0x7e1e('0x24')]={};this[_0x7e1e('0x25')]={};};function freeIsNotKey(_0x44c18c,_0x2577bf,_0x74c847){var _0xcababd=_[_0x7e1e('0x26')](_0x44c18c,function(_0xee98c4,_0x4cddef){return _0xee98c4[_0x74c847];});for(var _0x45e61d in _0x2577bf){if(_0x2577bf[_0x7e1e('0x27')](_0x45e61d)){if(!_0xcababd[_0x45e61d]){delete _0x2577bf[_0x45e61d];}}}}function freeIsNotKeySip(_0x29f40c,_0x5029b6){var _0x1ed134=_['mapKeys'](_0x29f40c,function(_0x207a18,_0x2d68dc){return util['format'](_0x7e1e('0x28'),_0x207a18[_0x7e1e('0x29')]);});for(var _0x550838 in _0x5029b6){if(_0x5029b6[_0x7e1e('0x27')](_0x550838)){if(!_0x1ed134[_0x550838]){delete _0x5029b6[_0x550838];}}}}function freeIsNotKeyAgent(_0x257f54,_0x2ea02d){var _0x570a30=_[_0x7e1e('0x26')](_0x257f54,function(_0x362dc2,_0x3ae67f){var _0x1b3366=_[_0x7e1e('0x2a')](_0x362dc2[_0x7e1e('0x2b')])?util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0x362dc2[_0x7e1e('0x29')]):_0x362dc2[_0x7e1e('0x2b')];return _0x1b3366;});for(var _0x28477b in _0x2ea02d){if(_0x2ea02d[_0x7e1e('0x27')](_0x28477b)){if(!_0x570a30[_0x28477b]){delete _0x2ea02d[_0x28477b];}}}}function clearVoiceCallReports(_0x4aeaef){_0x4aeaef[_0x7e1e('0x2d')]=0x0;_0x4aeaef[_0x7e1e('0x2e')]=0x0;_0x4aeaef[_0x7e1e('0x2f')]=0x0;_0x4aeaef[_0x7e1e('0x30')]=0x0;_0x4aeaef[_0x7e1e('0x31')]=0x0;}function clearCampaigns(_0x27b6bf){if(!_[_0x7e1e('0x32')](_0x27b6bf)){for(var _0xa73e81 in _0x27b6bf){if(_0x27b6bf[_0x7e1e('0x27')](_0xa73e81)){_0x27b6bf[_0xa73e81]['ivrTotalCallsDays']=0x0;_0x27b6bf[_0xa73e81]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x3a6617){if(!_[_0x7e1e('0x32')](_0x3a6617)){for(var _0x2cb522 in _0x3a6617){if(_0x3a6617['hasOwnProperty'](_0x2cb522)){_0x3a6617[_0x2cb522]['total']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x2e')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x33')]=0x0;_0x3a6617[_0x2cb522]['abandoned']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x2f')]=0x0;_0x3a6617[_0x2cb522]['sumDuration']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x31')]=0x0;_0x3a6617[_0x2cb522]['outboundAnswerAgiCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x34')]=0x0;_0x3a6617[_0x2cb522]['outboundBusyCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundCongestionCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundNoSuchCallsDay']=0x0;_0x3a6617[_0x2cb522]['outboundUnknownCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x35')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x36')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x37')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x38')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x39')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3a')]=0x0;_0x3a6617[_0x2cb522]['outboundAnswerAgiCallsDay']=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3b')]=0x0;_0x3a6617[_0x2cb522][_0x7e1e('0x3c')]=!![];}}}}Realtime[_0x7e1e('0x3d')][_0x7e1e('0x3e')]=function(_0x4475e0,_0x3916b0){for(var _0xa6a923 in _0x3916b0){if(_0x4475e0[_0x7e1e('0x27')](_0xa6a923)){_0x4475e0[_0xa6a923]=_0x3916b0[_0xa6a923];}}};Realtime[_0x7e1e('0x3d')]['initAgents']=function(){var _0x234d42=this;return function(_0x12a2ac){if(_0x12a2ac){freeIsNotKeyAgent(_0x12a2ac,_0x234d42[_0x7e1e('0x13')]);for(var _0x1fbfaf=0x0,_0x187b46={},_0x3a35a4={};_0x1fbfaf<_0x12a2ac['length'];_0x1fbfaf+=0x1){_0x187b46=_0x12a2ac[_0x1fbfaf];var _0x17cee4=_[_0x7e1e('0x2a')](_0x187b46[_0x7e1e('0x2b')])?util[_0x7e1e('0x2c')]('SIP/%s',_0x187b46[_0x7e1e('0x29')]):_0x187b46['interface'];if(_[_0x7e1e('0x3f')](_0x234d42[_0x7e1e('0x13')][_0x17cee4])){_0x234d42['agents'][_0x17cee4]=new Agent(_0x187b46);}else{_0x234d42[_0x7e1e('0x3e')](_0x234d42['agents'][_0x17cee4],_0x187b46);}}}return _0x234d42[_0x7e1e('0x13')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x40')]=function(){var _0x2e121c=this;return function(_0x4ad93c){if(_0x4ad93c){freeIsNotKeySip(_0x4ad93c,_0x2e121c[_0x7e1e('0x14')]);for(var _0x5383f0=0x0,_0x836ad0={},_0x448d01={};_0x5383f0<_0x4ad93c[_0x7e1e('0x41')];_0x5383f0+=0x1){_0x836ad0=_0x4ad93c[_0x5383f0];if(_[_0x7e1e('0x3f')](_0x2e121c[_0x7e1e('0x14')][util['format'](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])])){_0x2e121c[_0x7e1e('0x14')][util['format'](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])]=new Telephone(_0x836ad0);}else{_0x2e121c['mergeFromDatabase'](_0x2e121c['telephones'][util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0x836ad0[_0x7e1e('0x29')])],_0x836ad0);}}}return _0x2e121c[_0x7e1e('0x14')];};};Realtime[_0x7e1e('0x3d')]['initTrunks']=function(){var _0x1d0dc3=this;return function(_0x3ec3de){if(_0x3ec3de){freeIsNotKeySip(_0x3ec3de,_0x1d0dc3[_0x7e1e('0x42')]);for(var _0x5665be=0x0,_0xe062da={},_0x3b9741={};_0x5665be<_0x3ec3de[_0x7e1e('0x41')];_0x5665be+=0x1){_0xe062da=_0x3ec3de[_0x5665be];if(_[_0x7e1e('0x3f')](_0x1d0dc3[_0x7e1e('0x42')][util[_0x7e1e('0x2c')](_0x7e1e('0x28'),_0xe062da['name'])])){_0x1d0dc3['trunks'][util[_0x7e1e('0x2c')]('SIP/%s',_0xe062da[_0x7e1e('0x29')])]=new Trunk(_0xe062da);}else{_0x1d0dc3['mergeFromDatabase'](_0x1d0dc3[_0x7e1e('0x42')][util['format'](_0x7e1e('0x28'),_0xe062da[_0x7e1e('0x29')])],_0xe062da);}}}return _0x1d0dc3[_0x7e1e('0x42')];};};Realtime[_0x7e1e('0x3d')]['initVoiceQueues']=function(){var _0x4881bd=this;return function(_0x2639ba){if(_0x2639ba){freeIsNotKey(_0x2639ba,_0x4881bd[_0x7e1e('0x43')],_0x7e1e('0x29'));for(var _0x3f741e=0x0,_0x1351bb={},_0xfc4cb8={};_0x3f741e<_0x2639ba[_0x7e1e('0x41')];_0x3f741e+=0x1){_0x1351bb=_0x2639ba[_0x3f741e];if(_[_0x7e1e('0x3f')](_0x4881bd[_0x7e1e('0x43')][_0x1351bb[_0x7e1e('0x29')]])){_0x4881bd[_0x7e1e('0x43')][_0x1351bb['name']]=new VoiceQueue(_0x1351bb);}else{_0x4881bd[_0x7e1e('0x3e')](_0x4881bd[_0x7e1e('0x43')][_0x1351bb[_0x7e1e('0x29')]],_0x1351bb);}}}return _0x4881bd[_0x7e1e('0x43')];};};Realtime['prototype'][_0x7e1e('0x44')]=function(){var _0x4d0343=this;return function(_0x4c5d3f){if(_0x4c5d3f){freeIsNotKey(_0x4c5d3f,_0x4d0343[_0x7e1e('0x15')],'id');for(var _0x156ba8=0x0,_0x57bc3e={},_0x425430={};_0x156ba8<_0x4c5d3f[_0x7e1e('0x41')];_0x156ba8+=0x1){_0x57bc3e=_0x4c5d3f[_0x156ba8];if(_[_0x7e1e('0x3f')](_0x4d0343['triggers'][_0x57bc3e['id']])){_0x4d0343[_0x7e1e('0x15')][_0x57bc3e['id']]=new Trigger(_0x57bc3e);}else{_0x4d0343[_0x7e1e('0x3e')](_0x4d0343[_0x7e1e('0x15')][_0x57bc3e['id']],_0x57bc3e);}}}return _0x4d0343[_0x7e1e('0x15')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x45')]=function(){var _0x1112f7=this;return function(_0x14fb45){if(_0x14fb45){freeIsNotKey(_0x14fb45,_0x1112f7[_0x7e1e('0x17')],'id');for(var _0x1f2ece=0x0,_0x2d530a={},_0x1317b9={};_0x1f2ece<_0x14fb45['length'];_0x1f2ece+=0x1){_0x2d530a=_0x14fb45[_0x1f2ece];if(_[_0x7e1e('0x3f')](_0x1112f7[_0x7e1e('0x17')][_0x2d530a['id']])){_0x1112f7['templates'][_0x2d530a['id']]=new Template(_0x2d530a);}else{_0x1112f7[_0x7e1e('0x3e')](_0x1112f7['templates'][_0x2d530a['id']],_0x2d530a);}}}return _0x1112f7[_0x7e1e('0x17')];};};Realtime[_0x7e1e('0x3d')]['initZendeskAccounts']=function(){var _0x107f8c=this;return function(_0x32d1d9){if(_0x32d1d9){freeIsNotKey(_0x32d1d9,_0x107f8c[_0x7e1e('0x1e')],'id');for(var _0x4f794c=0x0,_0x4f14df={},_0x439b1e={};_0x4f794c<_0x32d1d9['length'];_0x4f794c+=0x1){_0x4f14df=_0x32d1d9[_0x4f794c];if(_[_0x7e1e('0x3f')](_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']])){_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']]=new ZendeskAccount(_0x4f14df);}else{_0x107f8c[_0x7e1e('0x3e')](_0x107f8c[_0x7e1e('0x1e')][_0x4f14df['id']],_0x4f14df);}}}return _0x107f8c[_0x7e1e('0x1e')];};};Realtime['prototype'][_0x7e1e('0x46')]=function(){var _0x456dfc=this;return function(_0x30f080){if(_0x30f080){freeIsNotKey(_0x30f080,_0x456dfc[_0x7e1e('0x1f')],'id');for(var _0x4d3ce6=0x0,_0x5f1d3e={},_0x436a49={};_0x4d3ce6<_0x30f080[_0x7e1e('0x41')];_0x4d3ce6+=0x1){_0x5f1d3e=_0x30f080[_0x4d3ce6];if(_[_0x7e1e('0x3f')](_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']])){_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']]=new SalesforceAccount(_0x5f1d3e);}else{_0x456dfc[_0x7e1e('0x3e')](_0x456dfc['salesforceAccounts'][_0x5f1d3e['id']],_0x5f1d3e);}}}return _0x456dfc[_0x7e1e('0x1f')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x47')]=function(){var _0xa444cf=this;return function(_0x25b26d){if(_0x25b26d){freeIsNotKey(_0x25b26d,_0xa444cf[_0x7e1e('0x48')],'id');for(var _0x2842c0=0x0,_0x4f4cb4={},_0x29234d={};_0x2842c0<_0x25b26d[_0x7e1e('0x41')];_0x2842c0+=0x1){_0x4f4cb4=_0x25b26d[_0x2842c0];if(_['isUndefined'](_0xa444cf[_0x7e1e('0x48')][_0x4f4cb4['id']])){_0xa444cf[_0x7e1e('0x48')][_0x4f4cb4['id']]=new FreshdeskAccount(_0x4f4cb4);}else{_0xa444cf[_0x7e1e('0x3e')](_0xa444cf['freshdeskAccounts'][_0x4f4cb4['id']],_0x4f4cb4);}}}return _0xa444cf[_0x7e1e('0x48')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x49')]=function(){var _0x4ae7e0=this;return function(_0x1f392e){if(_0x1f392e){freeIsNotKey(_0x1f392e,_0x4ae7e0['zohoAccounts'],'id');for(var _0x56c0c8=0x0,_0x4681ac={},_0x1a5e39={};_0x56c0c8<_0x1f392e[_0x7e1e('0x41')];_0x56c0c8+=0x1){_0x4681ac=_0x1f392e[_0x56c0c8];if(_[_0x7e1e('0x3f')](_0x4ae7e0[_0x7e1e('0x20')][_0x4681ac['id']])){_0x4ae7e0[_0x7e1e('0x20')][_0x4681ac['id']]=new ZohoAccount(_0x4681ac);}else{_0x4ae7e0['mergeFromDatabase'](_0x4ae7e0['zohoAccounts'][_0x4681ac['id']],_0x4681ac);}}}return _0x4ae7e0[_0x7e1e('0x20')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4a')]=function(){var _0x1f46ce=this;return function(_0x1f009b){if(_0x1f009b){freeIsNotKey(_0x1f009b,_0x1f46ce[_0x7e1e('0x21')],'id');for(var _0x1fdb60=0x0,_0x790924={},_0x23ad1f={};_0x1fdb60<_0x1f009b[_0x7e1e('0x41')];_0x1fdb60+=0x1){_0x790924=_0x1f009b[_0x1fdb60];if(_[_0x7e1e('0x3f')](_0x1f46ce['deskAccounts'][_0x790924['id']])){_0x1f46ce[_0x7e1e('0x21')][_0x790924['id']]=new DeskAccount(_0x790924);}else{_0x1f46ce['mergeFromDatabase'](_0x1f46ce['deskAccounts'][_0x790924['id']],_0x790924);}}}return _0x1f46ce[_0x7e1e('0x21')];};};Realtime['prototype'][_0x7e1e('0x4b')]=function(){var _0x123687=this;return function(_0x35b7a8){if(_0x35b7a8){freeIsNotKey(_0x35b7a8,_0x123687['sugarcrmAccounts'],'id');for(var _0x5b4767=0x0,_0x2bed42={},_0x3a43db={};_0x5b4767<_0x35b7a8[_0x7e1e('0x41')];_0x5b4767+=0x1){_0x2bed42=_0x35b7a8[_0x5b4767];if(_[_0x7e1e('0x3f')](_0x123687[_0x7e1e('0x4c')][_0x2bed42['id']])){_0x123687[_0x7e1e('0x4c')][_0x2bed42['id']]=new SugarcrmAccount(_0x2bed42);}else{_0x123687[_0x7e1e('0x3e')](_0x123687['sugarcrmAccounts'][_0x2bed42['id']],_0x2bed42);}}}return _0x123687[_0x7e1e('0x4c')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4d')]=function(){var _0x183071=this;return function(_0x52b68d){if(_0x52b68d){freeIsNotKey(_0x52b68d,_0x183071['vtigerAccounts'],'id');for(var _0xae8f6f=0x0,_0x2af4a4={},_0x473272={};_0xae8f6f<_0x52b68d[_0x7e1e('0x41')];_0xae8f6f+=0x1){_0x2af4a4=_0x52b68d[_0xae8f6f];if(_[_0x7e1e('0x3f')](_0x183071[_0x7e1e('0x22')][_0x2af4a4['id']])){_0x183071[_0x7e1e('0x22')][_0x2af4a4['id']]=new VtigerAccount(_0x2af4a4);}else{_0x183071[_0x7e1e('0x3e')](_0x183071['vtigerAccounts'][_0x2af4a4['id']],_0x2af4a4);}}}return _0x183071[_0x7e1e('0x22')];};};Realtime[_0x7e1e('0x3d')]['initServicenowAccounts']=function(){var _0x444e69=this;return function(_0x28f1f8){if(_0x28f1f8){freeIsNotKey(_0x28f1f8,_0x444e69[_0x7e1e('0x4e')],'id');for(var _0x41e2a0=0x0,_0x200dd5={},_0x181de8={};_0x41e2a0<_0x28f1f8[_0x7e1e('0x41')];_0x41e2a0+=0x1){_0x200dd5=_0x28f1f8[_0x41e2a0];if(_[_0x7e1e('0x3f')](_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']])){_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']]=new ServicenowAccount(_0x200dd5);}else{_0x444e69[_0x7e1e('0x3e')](_0x444e69[_0x7e1e('0x4e')][_0x200dd5['id']],_0x200dd5);}}}return _0x444e69['servicenowAccounts'];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x4f')]=function(){var _0x3ebb1b=this;return function(_0x3c0bc8){if(_0x3c0bc8){freeIsNotKey(_0x3c0bc8,_0x3ebb1b[_0x7e1e('0x23')],'id');for(var _0x5cdafe=0x0,_0x147b8f={},_0x58683b={};_0x5cdafe<_0x3c0bc8['length'];_0x5cdafe+=0x1){_0x147b8f=_0x3c0bc8[_0x5cdafe];if(_['isUndefined'](_0x3ebb1b[_0x7e1e('0x23')][_0x147b8f['id']])){_0x3ebb1b[_0x7e1e('0x23')][_0x147b8f['id']]=new Dynamics365Account(_0x147b8f);}else{_0x3ebb1b[_0x7e1e('0x3e')](_0x3ebb1b['dynamics365Accounts'][_0x147b8f['id']],_0x147b8f);}}}return _0x3ebb1b[_0x7e1e('0x23')];};};Realtime[_0x7e1e('0x3d')]['initFreshsalesAccounts']=function(){var _0x3e0e2c=this;return function(_0x40b71f){if(_0x40b71f){freeIsNotKey(_0x40b71f,_0x3e0e2c['freshsalesAccounts'],'id');for(var _0x4baa0d=0x0,_0x5afb50={},_0x1d8515={};_0x4baa0d<_0x40b71f['length'];_0x4baa0d+=0x1){_0x5afb50=_0x40b71f[_0x4baa0d];if(_[_0x7e1e('0x3f')](_0x3e0e2c[_0x7e1e('0x24')][_0x5afb50['id']])){_0x3e0e2c[_0x7e1e('0x24')][_0x5afb50['id']]=new FreshsalesAccount(_0x5afb50);}else{_0x3e0e2c[_0x7e1e('0x3e')](_0x3e0e2c['freshsalesAccounts'][_0x5afb50['id']],_0x5afb50);}}}return _0x3e0e2c[_0x7e1e('0x24')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x50')]=function(){var _0x4f67d0=this;return function(_0x5d06f9){for(var _0x5a2af1=0x0;_0x5a2af1<_0x5d06f9['length'];_0x5a2af1+=0x1){_[_0x7e1e('0x51')](_0x4f67d0['voiceQueues'][_0x5d06f9[_0x5a2af1][_0x7e1e('0x29')]],_0x5d06f9[_0x5a2af1]);}return _0x4f67d0['voiceQueues'];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x52')]=function(){var _0x4e9015=this;return function(_0x3ae9ea){clearVoiceQueues(_0x4e9015[_0x7e1e('0x43')]);if(_0x3ae9ea){_0x3ae9ea=_[_0x7e1e('0x53')](_0x3ae9ea,_0x7e1e('0x54'));for(var _0x3ad8ca in _0x3ae9ea){if(_0x3ae9ea[_0x7e1e('0x27')](_0x3ad8ca)){var _0x1c4b86={};for(var _0xce5e21=0x0;_0xce5e21<_0x3ae9ea[_0x3ad8ca][_0x7e1e('0x41')];_0xce5e21+=0x1){var _0x5b3ce6=_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x55')];if(_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6]){if(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x56')]){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x33')]+=0x1;}if(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerabandon']){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x57')]+=0x1;}_0x4e9015['voiceQueues'][_0x5b3ce6][_0x7e1e('0x2f')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerleaveAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x59')]),_0x7e1e('0x5a'))||0x0;if(_0xce5e21===_0x3ae9ea[_0x3ad8ca][_0x7e1e('0x41')]-0x1){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x30')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercompleteAt']||_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x5b')]||_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallerexitAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x59')]),_0x7e1e('0x5a'))||0x0;_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x2d')]+=0x1;if(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercomplete']){_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x2e')]+=0x1;_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x31')]+=moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21]['queuecallercompleteAt'])[_0x7e1e('0x58')](moment(_0x3ae9ea[_0x3ad8ca][_0xce5e21][_0x7e1e('0x5c')]),_0x7e1e('0x5a'))||0x0;}}else{_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6][_0x7e1e('0x30')]+=_0x4e9015[_0x7e1e('0x43')][_0x5b3ce6]['sumHoldTime']||0x0;}}}}}}return _0x4e9015['voiceQueues'];};};Realtime['prototype'][_0x7e1e('0x5d')]=function(){var _0x290512=this;return function(_0x42a222){clearVoiceCallReports(_0x290512[_0x7e1e('0x18')]);if(_0x42a222){for(var _0x17317e=0x0;_0x17317e<_0x42a222[_0x7e1e('0x41')];_0x17317e+=0x1){_0x290512[_0x7e1e('0x18')]['total']+=0x1;_0x290512[_0x7e1e('0x18')]['sumDuration']+=_0x42a222[_0x17317e][_0x7e1e('0x5e')];if(_0x42a222[_0x17317e][_0x7e1e('0x5f')]===_0x7e1e('0x60')){_0x290512['outbound'][_0x7e1e('0x2e')]+=0x1;_0x290512[_0x7e1e('0x18')][_0x7e1e('0x2f')]+=_0x42a222[_0x17317e][_0x7e1e('0x5e')]-_0x42a222[_0x17317e]['billableseconds']||0x0;_0x290512[_0x7e1e('0x18')][_0x7e1e('0x31')]+=_0x42a222[_0x17317e][_0x7e1e('0x61')];}}}return _0x290512[_0x7e1e('0x18')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x62')]=function(){var _0x3fe957=this;return function(_0x205e81){if(_0x205e81){freeIsNotKey(_0x205e81,_0x3fe957[_0x7e1e('0x16')],'name');for(var _0x2298ac=0x0,_0x2977d0={};_0x2298ac<_0x205e81['length'];_0x2298ac+=0x1){_0x2977d0=_0x205e81[_0x2298ac];if(_[_0x7e1e('0x3f')](_0x3fe957[_0x7e1e('0x16')][_0x2977d0['name']])){_0x3fe957['campaigns'][_0x2977d0[_0x7e1e('0x29')]]=new Campaign(_0x2977d0);}else{_0x3fe957['mergeFromDatabase'](_0x3fe957[_0x7e1e('0x16')][_0x2977d0[_0x7e1e('0x29')]],_0x2977d0);_0x3fe957[_0x7e1e('0x16')][_0x2977d0['name']][_0x7e1e('0x63')]=_0x2977d0[_0x7e1e('0x64')]?_0x2977d0[_0x7e1e('0x64')][_0x7e1e('0x29')]:undefined;}}}return _0x3fe957[_0x7e1e('0x16')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x65')]=function(){var _0x1478e0=this;return function(_0x3b83b1){if(_0x3b83b1){freeIsNotKey(_0x3b83b1,_0x1478e0['voiceExtensions'],'id');for(var _0x4139fe=0x0,_0x319d52={};_0x4139fe<_0x3b83b1['length'];_0x4139fe+=0x1){_0x319d52=_0x3b83b1[_0x4139fe];if(_['isUndefined'](_0x1478e0[_0x7e1e('0x19')][_0x319d52['id']])){_0x1478e0['voiceExtensions'][_0x319d52['id']]=new VoiceExtension(_0x319d52);}else{_0x1478e0[_0x7e1e('0x3e')](_0x1478e0['voiceExtensions'][_0x319d52['id']],_0x319d52);}}}return _0x1478e0[_0x7e1e('0x19')];};};Realtime['prototype'][_0x7e1e('0x66')]=function(){var _0x5c3f9f=this;return function(_0x1b53c5){clearCampaigns(_0x5c3f9f[_0x7e1e('0x16')]);for(var _0x535c7a=0x0;_0x535c7a<_0x1b53c5['length'];_0x535c7a+=0x1){_[_0x7e1e('0x51')](_0x5c3f9f[_0x7e1e('0x16')][_0x1b53c5[_0x535c7a][_0x7e1e('0x29')]],_0x1b53c5[_0x535c7a]);}return _0x5c3f9f[_0x7e1e('0x16')];};};Realtime[_0x7e1e('0x3d')][_0x7e1e('0x67')]=function(){var _0x529470=this;return function(_0x569672){if(_0x569672){freeIsNotKey(_0x569672,_0x529470[_0x7e1e('0x25')],'id');for(var _0x24428b=0x0,_0x2e3dbd={},_0x247eb7={};_0x24428b<_0x569672[_0x7e1e('0x41')];_0x24428b+=0x1){_0x2e3dbd=_0x569672[_0x24428b];if(_[_0x7e1e('0x3f')](_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']])){_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']]=new FaxAccount(_0x2e3dbd);}else{_0x529470[_0x7e1e('0x3e')](_0x529470[_0x7e1e('0x25')][_0x2e3dbd['id']],_0x2e3dbd);}}}return _0x529470[_0x7e1e('0x25')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7d9e=['abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','length','initTelephones','telephones','initTrunks','isUndefined','voiceQueues','initTriggers','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','queuecallercomplete','answered','disposition','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/freshsalesAccount','agents','trunks','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged'];(function(_0x50762b,_0x1e807f){var _0x31bfb8=function(_0x239e54){while(--_0x239e54){_0x50762b['push'](_0x50762b['shift']());}};_0x31bfb8(++_0x1e807f);}(_0x7d9e,0xa7));var _0xe7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9e[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xe7d9('0x0'));var util=require('util');var _=require(_0xe7d9('0x1'));var moment=require('moment');var Agent=require(_0xe7d9('0x2'));var Telephone=require(_0xe7d9('0x3'));var Trunk=require(_0xe7d9('0x4'));var VoiceQueue=require(_0xe7d9('0x5'));var Trigger=require('../model/trigger');var Template=require(_0xe7d9('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xe7d9('0x7'));var ZendeskAccount=require(_0xe7d9('0x8'));var SalesforceAccount=require(_0xe7d9('0x9'));var FreshdeskAccount=require(_0xe7d9('0xa'));var SugarcrmAccount=require(_0xe7d9('0xb'));var ZohoAccount=require(_0xe7d9('0xc'));var DeskAccount=require(_0xe7d9('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xe7d9('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xe7d9('0xf')]={};this['telephones']={};this[_0xe7d9('0x10')]={};this['voiceQueues']={};this[_0xe7d9('0x11')]={};this[_0xe7d9('0x12')]={};this['templates']={};this[_0xe7d9('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe7d9('0x14')]={};this[_0xe7d9('0x15')]={};this[_0xe7d9('0x16')]={};this[_0xe7d9('0x17')]={};this['timers']={};this[_0xe7d9('0x18')]={};this[_0xe7d9('0x19')]={};this[_0xe7d9('0x1a')]={};this[_0xe7d9('0x1b')]={};this[_0xe7d9('0x1c')]={};this['zohoAccounts']={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0xe7d9('0x1d')]={};this[_0xe7d9('0x1e')]={};this[_0xe7d9('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x32cab4,_0x3758ba,_0x2b1e7a){var _0x410a17=_[_0xe7d9('0x20')](_0x32cab4,function(_0x413192,_0x53263f){return _0x413192[_0x2b1e7a];});for(var _0x5543c8 in _0x3758ba){if(_0x3758ba[_0xe7d9('0x21')](_0x5543c8)){if(!_0x410a17[_0x5543c8]){delete _0x3758ba[_0x5543c8];}}}}function freeIsNotKeySip(_0x25375c,_0x19ad9c){var _0x523ca2=_[_0xe7d9('0x20')](_0x25375c,function(_0x47d050,_0x2e5fc0){return util['format'](_0xe7d9('0x22'),_0x47d050[_0xe7d9('0x23')]);});for(var _0x226be8 in _0x19ad9c){if(_0x19ad9c[_0xe7d9('0x21')](_0x226be8)){if(!_0x523ca2[_0x226be8]){delete _0x19ad9c[_0x226be8];}}}}function freeIsNotKeyAgent(_0x49b5bf,_0x5f42f3){var _0x20d431=_['mapKeys'](_0x49b5bf,function(_0x315ba1,_0x3fc2da){var _0x542ff3=_[_0xe7d9('0x24')](_0x315ba1[_0xe7d9('0x25')])?util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x315ba1[_0xe7d9('0x23')]):_0x315ba1['interface'];return _0x542ff3;});for(var _0x57a3f6 in _0x5f42f3){if(_0x5f42f3[_0xe7d9('0x21')](_0x57a3f6)){if(!_0x20d431[_0x57a3f6]){delete _0x5f42f3[_0x57a3f6];}}}}function clearVoiceCallReports(_0x4519be){_0x4519be[_0xe7d9('0x27')]=0x0;_0x4519be['answered']=0x0;_0x4519be[_0xe7d9('0x28')]=0x0;_0x4519be[_0xe7d9('0x29')]=0x0;_0x4519be[_0xe7d9('0x2a')]=0x0;}function clearCampaigns(_0x49006a){if(!_[_0xe7d9('0x2b')](_0x49006a)){for(var _0x569928 in _0x49006a){if(_0x49006a[_0xe7d9('0x21')](_0x569928)){_0x49006a[_0x569928][_0xe7d9('0x2c')]=0x0;_0x49006a[_0x569928][_0xe7d9('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x25a4e5){if(!_[_0xe7d9('0x2b')](_0x25a4e5)){for(var _0x4e330c in _0x25a4e5){if(_0x25a4e5[_0xe7d9('0x21')](_0x4e330c)){_0x25a4e5[_0x4e330c][_0xe7d9('0x27')]=0x0;_0x25a4e5[_0x4e330c]['answered']=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x2e')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x2f')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x28')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x29')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x2a')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x30')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x31')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x32')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x33')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x34')]=0x0;_0x25a4e5[_0x4e330c]['outboundUnknownCallsDay']=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x35')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x36')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x37')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x38')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x39')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x3a')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x30')]=0x0;_0x25a4e5[_0x4e330c][_0xe7d9('0x3b')]=0x0;_0x25a4e5[_0x4e330c]['queueStatusComplete']=!![];}}}}Realtime[_0xe7d9('0x3c')][_0xe7d9('0x3d')]=function(_0x147046,_0x163138){for(var _0x2d587f in _0x163138){if(_0x147046[_0xe7d9('0x21')](_0x2d587f)){_0x147046[_0x2d587f]=_0x163138[_0x2d587f];}}};Realtime[_0xe7d9('0x3c')]['initAgents']=function(){var _0x481c0d=this;return function(_0x47df79){if(_0x47df79){freeIsNotKeyAgent(_0x47df79,_0x481c0d[_0xe7d9('0xf')]);for(var _0x282ce4=0x0,_0x1ac752={},_0x36436f={};_0x282ce4<_0x47df79[_0xe7d9('0x3e')];_0x282ce4+=0x1){_0x1ac752=_0x47df79[_0x282ce4];var _0x2f22d5=_[_0xe7d9('0x24')](_0x1ac752['interface'])?util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x1ac752['name']):_0x1ac752['interface'];if(_['isUndefined'](_0x481c0d[_0xe7d9('0xf')][_0x2f22d5])){_0x481c0d[_0xe7d9('0xf')][_0x2f22d5]=new Agent(_0x1ac752);}else{_0x481c0d['mergeFromDatabase'](_0x481c0d[_0xe7d9('0xf')][_0x2f22d5],_0x1ac752);}}}return _0x481c0d[_0xe7d9('0xf')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x3f')]=function(){var _0x5b905b=this;return function(_0x4f281){if(_0x4f281){freeIsNotKeySip(_0x4f281,_0x5b905b[_0xe7d9('0x40')]);for(var _0x3f6c41=0x0,_0x38439d={},_0x7f6378={};_0x3f6c41<_0x4f281[_0xe7d9('0x3e')];_0x3f6c41+=0x1){_0x38439d=_0x4f281[_0x3f6c41];if(_['isUndefined'](_0x5b905b[_0xe7d9('0x40')][util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x38439d['name'])])){_0x5b905b[_0xe7d9('0x40')][util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x38439d['name'])]=new Telephone(_0x38439d);}else{_0x5b905b[_0xe7d9('0x3d')](_0x5b905b['telephones'][util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x38439d[_0xe7d9('0x23')])],_0x38439d);}}}return _0x5b905b[_0xe7d9('0x40')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x41')]=function(){var _0x3e5edb=this;return function(_0x203978){if(_0x203978){freeIsNotKeySip(_0x203978,_0x3e5edb[_0xe7d9('0x10')]);for(var _0x405056=0x0,_0x5e6537={},_0x110d9c={};_0x405056<_0x203978[_0xe7d9('0x3e')];_0x405056+=0x1){_0x5e6537=_0x203978[_0x405056];if(_[_0xe7d9('0x42')](_0x3e5edb[_0xe7d9('0x10')][util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x5e6537[_0xe7d9('0x23')])])){_0x3e5edb['trunks'][util[_0xe7d9('0x26')](_0xe7d9('0x22'),_0x5e6537['name'])]=new Trunk(_0x5e6537);}else{_0x3e5edb[_0xe7d9('0x3d')](_0x3e5edb[_0xe7d9('0x10')][util['format'](_0xe7d9('0x22'),_0x5e6537['name'])],_0x5e6537);}}}return _0x3e5edb[_0xe7d9('0x10')];};};Realtime[_0xe7d9('0x3c')]['initVoiceQueues']=function(){var _0x4912c8=this;return function(_0x3a3f74){if(_0x3a3f74){freeIsNotKey(_0x3a3f74,_0x4912c8[_0xe7d9('0x43')],_0xe7d9('0x23'));for(var _0x37822a=0x0,_0x4edbf6={},_0x5117f8={};_0x37822a<_0x3a3f74[_0xe7d9('0x3e')];_0x37822a+=0x1){_0x4edbf6=_0x3a3f74[_0x37822a];if(_[_0xe7d9('0x42')](_0x4912c8[_0xe7d9('0x43')][_0x4edbf6[_0xe7d9('0x23')]])){_0x4912c8['voiceQueues'][_0x4edbf6[_0xe7d9('0x23')]]=new VoiceQueue(_0x4edbf6);}else{_0x4912c8[_0xe7d9('0x3d')](_0x4912c8[_0xe7d9('0x43')][_0x4edbf6['name']],_0x4edbf6);}}}return _0x4912c8[_0xe7d9('0x43')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x44')]=function(){var _0x287d39=this;return function(_0x5f1875){if(_0x5f1875){freeIsNotKey(_0x5f1875,_0x287d39[_0xe7d9('0x11')],'id');for(var _0x1a60e4=0x0,_0x24f83e={},_0x1746b7={};_0x1a60e4<_0x5f1875[_0xe7d9('0x3e')];_0x1a60e4+=0x1){_0x24f83e=_0x5f1875[_0x1a60e4];if(_[_0xe7d9('0x42')](_0x287d39[_0xe7d9('0x11')][_0x24f83e['id']])){_0x287d39[_0xe7d9('0x11')][_0x24f83e['id']]=new Trigger(_0x24f83e);}else{_0x287d39[_0xe7d9('0x3d')](_0x287d39[_0xe7d9('0x11')][_0x24f83e['id']],_0x24f83e);}}}return _0x287d39[_0xe7d9('0x11')];};};Realtime['prototype']['initTemplates']=function(){var _0x1f6bd8=this;return function(_0x2ecea4){if(_0x2ecea4){freeIsNotKey(_0x2ecea4,_0x1f6bd8[_0xe7d9('0x45')],'id');for(var _0x510bed=0x0,_0x4809a2={},_0x51c18d={};_0x510bed<_0x2ecea4[_0xe7d9('0x3e')];_0x510bed+=0x1){_0x4809a2=_0x2ecea4[_0x510bed];if(_[_0xe7d9('0x42')](_0x1f6bd8['templates'][_0x4809a2['id']])){_0x1f6bd8['templates'][_0x4809a2['id']]=new Template(_0x4809a2);}else{_0x1f6bd8[_0xe7d9('0x3d')](_0x1f6bd8[_0xe7d9('0x45')][_0x4809a2['id']],_0x4809a2);}}}return _0x1f6bd8[_0xe7d9('0x45')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x46')]=function(){var _0x89312a=this;return function(_0x1b5223){if(_0x1b5223){freeIsNotKey(_0x1b5223,_0x89312a[_0xe7d9('0x19')],'id');for(var _0xfe2c52=0x0,_0x5138b9={},_0xc324cc={};_0xfe2c52<_0x1b5223[_0xe7d9('0x3e')];_0xfe2c52+=0x1){_0x5138b9=_0x1b5223[_0xfe2c52];if(_[_0xe7d9('0x42')](_0x89312a[_0xe7d9('0x19')][_0x5138b9['id']])){_0x89312a[_0xe7d9('0x19')][_0x5138b9['id']]=new ZendeskAccount(_0x5138b9);}else{_0x89312a['mergeFromDatabase'](_0x89312a['zendeskAccounts'][_0x5138b9['id']],_0x5138b9);}}}return _0x89312a[_0xe7d9('0x19')];};};Realtime['prototype'][_0xe7d9('0x47')]=function(){var _0x4aa480=this;return function(_0x50b46b){if(_0x50b46b){freeIsNotKey(_0x50b46b,_0x4aa480[_0xe7d9('0x1a')],'id');for(var _0x475e89=0x0,_0x44d6a1={},_0x404d44={};_0x475e89<_0x50b46b[_0xe7d9('0x3e')];_0x475e89+=0x1){_0x44d6a1=_0x50b46b[_0x475e89];if(_['isUndefined'](_0x4aa480[_0xe7d9('0x1a')][_0x44d6a1['id']])){_0x4aa480[_0xe7d9('0x1a')][_0x44d6a1['id']]=new SalesforceAccount(_0x44d6a1);}else{_0x4aa480[_0xe7d9('0x3d')](_0x4aa480[_0xe7d9('0x1a')][_0x44d6a1['id']],_0x44d6a1);}}}return _0x4aa480['salesforceAccounts'];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x48')]=function(){var _0x32fe69=this;return function(_0x3ec59b){if(_0x3ec59b){freeIsNotKey(_0x3ec59b,_0x32fe69[_0xe7d9('0x1c')],'id');for(var _0x268bab=0x0,_0x3d7891={},_0x401696={};_0x268bab<_0x3ec59b[_0xe7d9('0x3e')];_0x268bab+=0x1){_0x3d7891=_0x3ec59b[_0x268bab];if(_[_0xe7d9('0x42')](_0x32fe69['freshdeskAccounts'][_0x3d7891['id']])){_0x32fe69[_0xe7d9('0x1c')][_0x3d7891['id']]=new FreshdeskAccount(_0x3d7891);}else{_0x32fe69['mergeFromDatabase'](_0x32fe69[_0xe7d9('0x1c')][_0x3d7891['id']],_0x3d7891);}}}return _0x32fe69[_0xe7d9('0x1c')];};};Realtime['prototype'][_0xe7d9('0x49')]=function(){var _0x1354a5=this;return function(_0x2e94ca){if(_0x2e94ca){freeIsNotKey(_0x2e94ca,_0x1354a5[_0xe7d9('0x4a')],'id');for(var _0x34a82c=0x0,_0x1db128={},_0x409b65={};_0x34a82c<_0x2e94ca['length'];_0x34a82c+=0x1){_0x1db128=_0x2e94ca[_0x34a82c];if(_[_0xe7d9('0x42')](_0x1354a5['zohoAccounts'][_0x1db128['id']])){_0x1354a5[_0xe7d9('0x4a')][_0x1db128['id']]=new ZohoAccount(_0x1db128);}else{_0x1354a5[_0xe7d9('0x3d')](_0x1354a5['zohoAccounts'][_0x1db128['id']],_0x1db128);}}}return _0x1354a5[_0xe7d9('0x4a')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x4b')]=function(){var _0x4b6e11=this;return function(_0x43ab60){if(_0x43ab60){freeIsNotKey(_0x43ab60,_0x4b6e11['deskAccounts'],'id');for(var _0x394974=0x0,_0x45b8cb={},_0x21ad85={};_0x394974<_0x43ab60['length'];_0x394974+=0x1){_0x45b8cb=_0x43ab60[_0x394974];if(_[_0xe7d9('0x42')](_0x4b6e11[_0xe7d9('0x4c')][_0x45b8cb['id']])){_0x4b6e11[_0xe7d9('0x4c')][_0x45b8cb['id']]=new DeskAccount(_0x45b8cb);}else{_0x4b6e11[_0xe7d9('0x3d')](_0x4b6e11[_0xe7d9('0x4c')][_0x45b8cb['id']],_0x45b8cb);}}}return _0x4b6e11['deskAccounts'];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x4d')]=function(){var _0x184312=this;return function(_0x5d7f55){if(_0x5d7f55){freeIsNotKey(_0x5d7f55,_0x184312[_0xe7d9('0x1b')],'id');for(var _0x4cbedd=0x0,_0x2ee900={},_0x2a54f8={};_0x4cbedd<_0x5d7f55['length'];_0x4cbedd+=0x1){_0x2ee900=_0x5d7f55[_0x4cbedd];if(_[_0xe7d9('0x42')](_0x184312[_0xe7d9('0x1b')][_0x2ee900['id']])){_0x184312[_0xe7d9('0x1b')][_0x2ee900['id']]=new SugarcrmAccount(_0x2ee900);}else{_0x184312[_0xe7d9('0x3d')](_0x184312[_0xe7d9('0x1b')][_0x2ee900['id']],_0x2ee900);}}}return _0x184312[_0xe7d9('0x1b')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x4e')]=function(){var _0x4cf4bb=this;return function(_0x18a3a0){if(_0x18a3a0){freeIsNotKey(_0x18a3a0,_0x4cf4bb[_0xe7d9('0x4f')],'id');for(var _0x40ad64=0x0,_0x5cd3b9={},_0x47a1fb={};_0x40ad64<_0x18a3a0[_0xe7d9('0x3e')];_0x40ad64+=0x1){_0x5cd3b9=_0x18a3a0[_0x40ad64];if(_['isUndefined'](_0x4cf4bb[_0xe7d9('0x4f')][_0x5cd3b9['id']])){_0x4cf4bb['vtigerAccounts'][_0x5cd3b9['id']]=new VtigerAccount(_0x5cd3b9);}else{_0x4cf4bb['mergeFromDatabase'](_0x4cf4bb[_0xe7d9('0x4f')][_0x5cd3b9['id']],_0x5cd3b9);}}}return _0x4cf4bb[_0xe7d9('0x4f')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x50')]=function(){var _0x1f6962=this;return function(_0x498c38){if(_0x498c38){freeIsNotKey(_0x498c38,_0x1f6962[_0xe7d9('0x1d')],'id');for(var _0x24ebb2=0x0,_0x5f9ef8={},_0x1f76ac={};_0x24ebb2<_0x498c38[_0xe7d9('0x3e')];_0x24ebb2+=0x1){_0x5f9ef8=_0x498c38[_0x24ebb2];if(_[_0xe7d9('0x42')](_0x1f6962[_0xe7d9('0x1d')][_0x5f9ef8['id']])){_0x1f6962[_0xe7d9('0x1d')][_0x5f9ef8['id']]=new ServicenowAccount(_0x5f9ef8);}else{_0x1f6962[_0xe7d9('0x3d')](_0x1f6962[_0xe7d9('0x1d')][_0x5f9ef8['id']],_0x5f9ef8);}}}return _0x1f6962['servicenowAccounts'];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x51')]=function(){var _0x13102d=this;return function(_0x3abc64){if(_0x3abc64){freeIsNotKey(_0x3abc64,_0x13102d[_0xe7d9('0x1e')],'id');for(var _0x348581=0x0,_0x1f446f={},_0x4c3029={};_0x348581<_0x3abc64['length'];_0x348581+=0x1){_0x1f446f=_0x3abc64[_0x348581];if(_['isUndefined'](_0x13102d[_0xe7d9('0x1e')][_0x1f446f['id']])){_0x13102d[_0xe7d9('0x1e')][_0x1f446f['id']]=new Dynamics365Account(_0x1f446f);}else{_0x13102d[_0xe7d9('0x3d')](_0x13102d[_0xe7d9('0x1e')][_0x1f446f['id']],_0x1f446f);}}}return _0x13102d[_0xe7d9('0x1e')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x52')]=function(){var _0x38ec76=this;return function(_0x125c81){if(_0x125c81){freeIsNotKey(_0x125c81,_0x38ec76['freshsalesAccounts'],'id');for(var _0x328dac=0x0,_0x41f85a={},_0x241046={};_0x328dac<_0x125c81[_0xe7d9('0x3e')];_0x328dac+=0x1){_0x41f85a=_0x125c81[_0x328dac];if(_['isUndefined'](_0x38ec76['freshsalesAccounts'][_0x41f85a['id']])){_0x38ec76[_0xe7d9('0x1f')][_0x41f85a['id']]=new FreshsalesAccount(_0x41f85a);}else{_0x38ec76[_0xe7d9('0x3d')](_0x38ec76['freshsalesAccounts'][_0x41f85a['id']],_0x41f85a);}}}return _0x38ec76[_0xe7d9('0x1f')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x53')]=function(){var _0x1d31e8=this;return function(_0x3bd925){for(var _0x4e914c=0x0;_0x4e914c<_0x3bd925[_0xe7d9('0x3e')];_0x4e914c+=0x1){_[_0xe7d9('0x54')](_0x1d31e8[_0xe7d9('0x43')][_0x3bd925[_0x4e914c][_0xe7d9('0x23')]],_0x3bd925[_0x4e914c]);}return _0x1d31e8[_0xe7d9('0x43')];};};Realtime['prototype'][_0xe7d9('0x55')]=function(){var _0x9a6f21=this;return function(_0x5ab66c){clearVoiceQueues(_0x9a6f21[_0xe7d9('0x43')]);if(_0x5ab66c){_0x5ab66c=_[_0xe7d9('0x56')](_0x5ab66c,_0xe7d9('0x57'));for(var _0x33371a in _0x5ab66c){if(_0x5ab66c[_0xe7d9('0x21')](_0x33371a)){var _0x2d8736={};for(var _0x5400bf=0x0;_0x5400bf<_0x5ab66c[_0x33371a][_0xe7d9('0x3e')];_0x5400bf+=0x1){var _0x50cb7e=_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x58')];if(_0x9a6f21[_0xe7d9('0x43')][_0x50cb7e]){if(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x59')]){_0x9a6f21['voiceQueues'][_0x50cb7e][_0xe7d9('0x2e')]+=0x1;}if(_0x5ab66c[_0x33371a][_0x5400bf]['queuecallerabandon']){_0x9a6f21[_0xe7d9('0x43')][_0x50cb7e][_0xe7d9('0x2f')]+=0x1;}_0x9a6f21[_0xe7d9('0x43')][_0x50cb7e][_0xe7d9('0x28')]+=moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5a')])[_0xe7d9('0x5b')](moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5c')]),'seconds')||0x0;if(_0x5400bf===_0x5ab66c[_0x33371a]['length']-0x1){_0x9a6f21['voiceQueues'][_0x50cb7e][_0xe7d9('0x29')]+=moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5d')]||_0x5ab66c[_0x33371a][_0x5400bf]['queuecallerabandonAt']||_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5e')])['diff'](moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5c')]),_0xe7d9('0x5f'))||0x0;_0x9a6f21[_0xe7d9('0x43')][_0x50cb7e]['total']+=0x1;if(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x60')]){_0x9a6f21['voiceQueues'][_0x50cb7e][_0xe7d9('0x61')]+=0x1;_0x9a6f21['voiceQueues'][_0x50cb7e][_0xe7d9('0x2a')]+=moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5d')])[_0xe7d9('0x5b')](moment(_0x5ab66c[_0x33371a][_0x5400bf][_0xe7d9('0x5a')]),'seconds')||0x0;}}else{_0x9a6f21['voiceQueues'][_0x50cb7e]['sumDuration']+=_0x9a6f21['voiceQueues'][_0x50cb7e]['sumHoldTime']||0x0;}}}}}}return _0x9a6f21['voiceQueues'];};};Realtime[_0xe7d9('0x3c')]['initVoiceCallReports']=function(){var _0x29e9b0=this;return function(_0x38691d){clearVoiceCallReports(_0x29e9b0[_0xe7d9('0x13')]);if(_0x38691d){for(var _0x133e2f=0x0;_0x133e2f<_0x38691d[_0xe7d9('0x3e')];_0x133e2f+=0x1){_0x29e9b0['outbound'][_0xe7d9('0x27')]+=0x1;_0x29e9b0['outbound'][_0xe7d9('0x29')]+=_0x38691d[_0x133e2f]['duration'];if(_0x38691d[_0x133e2f][_0xe7d9('0x62')]===_0xe7d9('0x63')){_0x29e9b0['outbound'][_0xe7d9('0x61')]+=0x1;_0x29e9b0[_0xe7d9('0x13')][_0xe7d9('0x28')]+=_0x38691d[_0x133e2f]['duration']-_0x38691d[_0x133e2f][_0xe7d9('0x64')]||0x0;_0x29e9b0[_0xe7d9('0x13')][_0xe7d9('0x2a')]+=_0x38691d[_0x133e2f]['billableseconds'];}}}return _0x29e9b0['outbound'];};};Realtime[_0xe7d9('0x3c')]['initCampaigns']=function(){var _0x163910=this;return function(_0x1b6cf9){if(_0x1b6cf9){freeIsNotKey(_0x1b6cf9,_0x163910['campaigns'],'name');for(var _0x338f8a=0x0,_0x53b6e4={};_0x338f8a<_0x1b6cf9[_0xe7d9('0x3e')];_0x338f8a+=0x1){_0x53b6e4=_0x1b6cf9[_0x338f8a];if(_['isUndefined'](_0x163910[_0xe7d9('0x12')][_0x53b6e4['name']])){_0x163910[_0xe7d9('0x12')][_0x53b6e4[_0xe7d9('0x23')]]=new Campaign(_0x53b6e4);}else{_0x163910[_0xe7d9('0x3d')](_0x163910[_0xe7d9('0x12')][_0x53b6e4[_0xe7d9('0x23')]],_0x53b6e4);_0x163910[_0xe7d9('0x12')][_0x53b6e4['name']]['dialQueueProject']=_0x53b6e4[_0xe7d9('0x65')]?_0x53b6e4['SquareProject'][_0xe7d9('0x23')]:undefined;}}}return _0x163910[_0xe7d9('0x12')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x66')]=function(){var _0xe39ea1=this;return function(_0x3798e6){if(_0x3798e6){freeIsNotKey(_0x3798e6,_0xe39ea1[_0xe7d9('0x14')],'id');for(var _0x51f00e=0x0,_0x4b6f6f={};_0x51f00e<_0x3798e6['length'];_0x51f00e+=0x1){_0x4b6f6f=_0x3798e6[_0x51f00e];if(_[_0xe7d9('0x42')](_0xe39ea1[_0xe7d9('0x14')][_0x4b6f6f['id']])){_0xe39ea1['voiceExtensions'][_0x4b6f6f['id']]=new VoiceExtension(_0x4b6f6f);}else{_0xe39ea1['mergeFromDatabase'](_0xe39ea1[_0xe7d9('0x14')][_0x4b6f6f['id']],_0x4b6f6f);}}}return _0xe39ea1[_0xe7d9('0x14')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x67')]=function(){var _0x20755f=this;return function(_0x198414){clearCampaigns(_0x20755f[_0xe7d9('0x12')]);for(var _0x53dba0=0x0;_0x53dba0<_0x198414[_0xe7d9('0x3e')];_0x53dba0+=0x1){_[_0xe7d9('0x54')](_0x20755f[_0xe7d9('0x12')][_0x198414[_0x53dba0]['name']],_0x198414[_0x53dba0]);}return _0x20755f[_0xe7d9('0x12')];};};Realtime[_0xe7d9('0x3c')][_0xe7d9('0x68')]=function(){var _0x34f5aa=this;return function(_0x26982c){if(_0x26982c){freeIsNotKey(_0x26982c,_0x34f5aa['faxAccounts'],'id');for(var _0x26145d=0x0,_0x128c83={},_0x52f1f2={};_0x26145d<_0x26982c[_0xe7d9('0x3e')];_0x26145d+=0x1){_0x128c83=_0x26982c[_0x26145d];if(_[_0xe7d9('0x42')](_0x34f5aa['faxAccounts'][_0x128c83['id']])){_0x34f5aa[_0xe7d9('0x69')][_0x128c83['id']]=new FaxAccount(_0x128c83);}else{_0x34f5aa['mergeFromDatabase'](_0x34f5aa[_0xe7d9('0x69')][_0x128c83['id']],_0x128c83);}}}return _0x34f5aa[_0xe7d9('0x69')];};};module[_0xe7d9('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 55d0c90..dcd2697 100644 --- a/server/services/ami/report/index.js +++ b/server/services/ami/report/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e8c=['originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','transfers','linkedid','uniqueid','blindTransfer','UserId','split','membername','monitorFilename','monitors','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','length','assigned','interface','SIP/%s','queuecallercomplete','queuecallercompleteAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview'];(function(_0x63ee2a,_0xdbeb95){var _0xe4821=function(_0x4f7744){while(--_0x4f7744){_0x63ee2a['push'](_0x63ee2a['shift']());}};_0xe4821(++_0xdbeb95);}(_0x4e8c,0x13f));var _0xc4e8=function(_0x1d7907,_0x131382){_0x1d7907=_0x1d7907-0x0;var _0x4656fa=_0x4e8c[_0x1d7907];return _0x4656fa;};'use strict';var _=require(_0xc4e8('0x0'));var moment=require(_0xc4e8('0x1'));var util=require(_0xc4e8('0x2'));var config=require(_0xc4e8('0x3'));var ami=require(_0xc4e8('0x4'));var RpcVoiceAgentReport=require(_0xc4e8('0x5'));var RpcVoiceCallReport=require(_0xc4e8('0x6'));var RpcVoiceDialReport=require(_0xc4e8('0x7'));var RpcMemberReport=require(_0xc4e8('0x8'));var RpcVoiceQueueReport=require(_0xc4e8('0x9'));var RpcVoiceRecording=require(_0xc4e8('0xa'));var RpcVoiceTransferReport=require(_0xc4e8('0xb'));var VoiceQueueReport=require(_0xc4e8('0xc'));var VoiceCallReport=require(_0xc4e8('0xd'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xc4e8('0xe'));var UserReport=require('./userReport');function Report(_0x44633b){this['realtime']=_0x44633b;this['agents']=_0x44633b[_0xc4e8('0xf')];this[_0xc4e8('0x10')]=_0x44633b['telephones'];}Report[_0xc4e8('0x11')][_0xc4e8('0x12')]=function(_0x187fe0){var _0x46442c=new VoiceQueueReport(this[_0xc4e8('0x13')]);var _0x27ef31=new VoiceAgentReport(this[_0xc4e8('0x13')]);var _0x246a34=new VoiceDialReport(this[_0xc4e8('0x13')]);var _0x2e3b18=new VoiceCallReport(this[_0xc4e8('0x13')]);var _0x4a0899=new UserReport(this[_0xc4e8('0x13')]);if(config[_0xc4e8('0x14')]&&config[_0xc4e8('0x14')][_0xc4e8('0x15')]){ami['on'](_0xc4e8('0x16'),this[_0xc4e8('0x17')][_0xc4e8('0x18')](this));ami['on'](_0xc4e8('0x19'),this['voiceCallReport']['bind'](this));ami['on'](_0xc4e8('0x1a'),this[_0xc4e8('0x1b')][_0xc4e8('0x18')](this));ami['on'](_0xc4e8('0x1c'),this[_0xc4e8('0x1d')][_0xc4e8('0x18')](this));ami['on'](_0xc4e8('0x1e'),this['blindTransfer'][_0xc4e8('0x18')](this));ami['on'](_0xc4e8('0x1f'),this[_0xc4e8('0x20')][_0xc4e8('0x18')](this));}};Report['prototype'][_0xc4e8('0x21')]=function(_0x87504e){var _0x10bb14;_0x10bb14=_[_0xc4e8('0x22')](this[_0xc4e8('0xf')],function(_0x83c2a5){return _0x83c2a5['accountcode']==_0x87504e||_0x83c2a5[_0xc4e8('0x23')]==_0x87504e;});if(_[_0xc4e8('0x24')](_0x10bb14)){var _0x4edcd7=_[_0xc4e8('0x22')](this[_0xc4e8('0x10')],function(_0x69413a){return _0x69413a[_0xc4e8('0x25')]==_0x87504e||_0x69413a['name']==_0x87504e;});if(_0x4edcd7){_0x10bb14=_[_0xc4e8('0x22')](this[_0xc4e8('0xf')],function(_0x58425e){return _0x58425e['interface']==util['format']('SIP/%s',_0x4edcd7['name']);});}}return _0x10bb14;};Report['prototype'][_0xc4e8('0x17')]=function(_0x10a084){for(var _0x504bf6=0x0;_0x504bf6<_0x10a084[_0xc4e8('0x26')];_0x504bf6+=0x1){var _0x43883b=this[_0xc4e8('0x21')](_0x10a084[_0x504bf6]['connectedlinenum']);if(_0x43883b){_0x10a084[_0x504bf6][_0xc4e8('0x25')]=_0x43883b[_0xc4e8('0x25')];_0x10a084[_0x504bf6][_0xc4e8('0x27')]=!![];_0x10a084[_0x504bf6]['lastAssignedTo']=_0x43883b['name'];_0x10a084[_0x504bf6][_0xc4e8('0x28')]=_[_0xc4e8('0x24')](_0x43883b[_0xc4e8('0x28')])?util['format'](_0xc4e8('0x29'),_0x43883b[_0xc4e8('0x23')]):_0x43883b[_0xc4e8('0x28')];if(_0x10a084[_0x504bf6][_0xc4e8('0x2a')]){_0x10a084[_0x504bf6][_0xc4e8('0x2b')]=moment()[_0xc4e8('0x2c')](_0xc4e8('0x2d'));}if(_0x10a084[_0x504bf6]['queuecallerexit']){_0x10a084[_0x504bf6][_0xc4e8('0x2e')]=moment()[_0xc4e8('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc4e8('0x17')](_0x10a084[_0x504bf6]);}RpcVoiceQueueReport[_0xc4e8('0x2f')](_0x10a084[_0x504bf6]);}};function extractCalleridNumber(_0x2dde33){var _0x1c1a10=_0x2dde33[_0xc4e8('0x30')](/<(.*?)>/);return _0x1c1a10?_0x1c1a10[0x1]:_0x2dde33;}Report[_0xc4e8('0x11')][_0xc4e8('0x31')]=function(_0x2ee878){for(var _0x5027e7=0x0;_0x5027e7',_0x3f406c['calleridname'],_0x3f406c[_0xc4e8('0x35')]);}if(RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x3f406c[_0xc4e8('0x4b')]]){var _0x347a93=RpcVoiceTransferReport['transfers'][_0x3f406c[_0xc4e8('0x4b')]];_0x347a93['transfereelinkedid']=_0x3f406c[_0xc4e8('0x4c')];RpcVoiceTransferReport[_0xc4e8('0x4d')](_0x347a93);delete RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x3f406c[_0xc4e8('0x4b')]];}if(_['isNil'](_0x3f406c[_0xc4e8('0x3b')])){_0x3f406c[_0xc4e8('0x3b')]=this[_0xc4e8('0x33')](_0x3f406c);}if(_[_0xc4e8('0x24')](_0x3f406c[_0xc4e8('0x4e')])){var _0x4c06b3=_0x3f406c[_0xc4e8('0x34')][_0xc4e8('0x4f')]('-')[0x0];var _0x5bc31a=this['agents'][_0x4c06b3];if(!_0x5bc31a)_0x5bc31a=this[_0xc4e8('0x31')](_0x3f406c[_0xc4e8('0x25')]);if(_0x5bc31a){_0x3f406c[_0xc4e8('0x4e')]=_0x5bc31a['id'];_0x3f406c[_0xc4e8('0x50')]=_0x5bc31a['name'];}}RpcVoiceCallReport[_0xc4e8('0x2f')](_0x3f406c);if(_0x3f406c['monitor']){for(var _0x323515=0x0;_0x323515<_0x3f406c['monitors'][_0xc4e8('0x26')];_0x323515+=0x1){_0x3f406c[_0xc4e8('0x51')]=_0x3f406c[_0xc4e8('0x52')][_0x323515]['filename'];_0x3f406c[_0xc4e8('0x53')]=_0x3f406c[_0xc4e8('0x52')][_0x323515]['createdAt'];if(_0x3f406c[_0xc4e8('0x3a')]=='xcally-motion-preview'){_0x3f406c[_0xc4e8('0x35')]=_0x3f406c[_0xc4e8('0x49')];_0x3f406c[_0xc4e8('0x54')]=_0x3f406c[_0xc4e8('0x55')];_0x3f406c['connectedlinenum']=_0x3f406c[_0xc4e8('0x25')];_0x3f406c[_0xc4e8('0x55')]=_0x3f406c[_0xc4e8('0x50')];_0x3f406c[_0xc4e8('0x3a')]=_0x3f406c[_0xc4e8('0x45')];}else if(_0x3f406c[_0xc4e8('0x3a')]==_0xc4e8('0x56')){_0x3f406c[_0xc4e8('0x35')]=_0x3f406c[_0xc4e8('0x39')];_0x3f406c[_0xc4e8('0x3a')]=_0x3f406c['originatecalleridnum'];}RpcVoiceRecording['create'](_0x3f406c);}}};Report['prototype'][_0xc4e8('0x1b')]=function(_0x5038a4){if(_[_0xc4e8('0x57')](_0x5038a4)){_0x5038a4[_0xc4e8('0x58')](function(_0x58b109){RpcVoiceAgentReport[_0xc4e8('0x2f')](_0x58b109);});}else{RpcVoiceAgentReport[_0xc4e8('0x2f')](_0x5038a4);}};Report[_0xc4e8('0x11')][_0xc4e8('0x1d')]=function(_0x1a151d){RpcVoiceDialReport[_0xc4e8('0x2f')](_0x1a151d);var _0x47b16d;var _0xc845bc;var _0x5499b7=_0x1a151d[_0xc4e8('0x34')];if(_[_0xc4e8('0x59')](_0x5499b7,'Local')){_0xc845bc=_0x5499b7[_0xc4e8('0x5a')](_0x5499b7[_0xc4e8('0x5b')]('/')+0x1,_0x5499b7[_0xc4e8('0x5b')]('@'));_0x47b16d=_[_0xc4e8('0x22')](this[_0xc4e8('0xf')],function(_0x45cd9f){return _0x45cd9f[_0xc4e8('0x5c')]==_0xc845bc||_0x45cd9f[_0xc4e8('0x5d')]==_0xc845bc||_0x45cd9f[_0xc4e8('0x25')]==_0xc845bc;});}else{_0xc845bc=_0x5499b7[_0xc4e8('0x5a')](_0x5499b7[_0xc4e8('0x5b')]('/')+0x1,_0x5499b7[_0xc4e8('0x5e')]('-'));_0x47b16d=this[_0xc4e8('0x21')](_0xc845bc);}if(_0x47b16d){_0x1a151d[_0xc4e8('0x28')]=_[_0xc4e8('0x24')](_0x47b16d[_0xc4e8('0x28')])?util[_0xc4e8('0x2c')]('SIP/%s',_0x47b16d['name']):_0x47b16d[_0xc4e8('0x28')];_0x1a151d[_0xc4e8('0x50')]=_0x47b16d[_0xc4e8('0x23')];_0x1a151d['accountcode']=_0x47b16d[_0xc4e8('0x25')];RpcMemberReport['voiceDialReport'](_0x1a151d);}};Report[_0xc4e8('0x11')]['blindTransfer']=function(_0x164a4f){RpcVoiceTransferReport[_0xc4e8('0x4a')][_0x164a4f[_0xc4e8('0x5f')]]=_0x164a4f;};Report[_0xc4e8('0x11')]['attendedTransfer']=function(_0x41e4d0){RpcVoiceTransferReport['attendedTransfer'](_0x41e4d0);};module[_0xc4e8('0x60')]=Report; \ No newline at end of file +var _0xb2d5=['lastIndexOf','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','agents','accountcode','name','isNil','format','SIP/%s','assigned','interface','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','getAgentByInternal','keys','length','channel','split','calleridnum','internal','destination','exten','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','connectedlinenum','calleridname','transfers','linkedid','transfereelinkedid','type','getCallType','UserId','create','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x3ff966,_0x457f9f){var _0x393c80=function(_0x24fa9e){while(--_0x24fa9e){_0x3ff966['push'](_0x3ff966['shift']());}};_0x393c80(++_0x457f9f);}(_0xb2d5,0x176));var _0x5b2d=function(_0x565f98,_0x52e898){_0x565f98=_0x565f98-0x0;var _0xfebce4=_0xb2d5[_0x565f98];return _0xfebce4;};'use strict';var _=require(_0x5b2d('0x0'));var moment=require(_0x5b2d('0x1'));var util=require(_0x5b2d('0x2'));var config=require(_0x5b2d('0x3'));var ami=require(_0x5b2d('0x4'));var RpcVoiceAgentReport=require(_0x5b2d('0x5'));var RpcVoiceCallReport=require(_0x5b2d('0x6'));var RpcVoiceDialReport=require(_0x5b2d('0x7'));var RpcMemberReport=require(_0x5b2d('0x8'));var RpcVoiceQueueReport=require(_0x5b2d('0x9'));var RpcVoiceRecording=require(_0x5b2d('0xa'));var RpcVoiceTransferReport=require(_0x5b2d('0xb'));var VoiceQueueReport=require(_0x5b2d('0xc'));var VoiceCallReport=require(_0x5b2d('0xd'));var VoiceAgentReport=require(_0x5b2d('0xe'));var VoiceDialReport=require(_0x5b2d('0xf'));var UserReport=require(_0x5b2d('0x10'));function Report(_0x33e200){this[_0x5b2d('0x11')]=_0x33e200;this['agents']=_0x33e200['agents'];this[_0x5b2d('0x12')]=_0x33e200[_0x5b2d('0x12')];}Report['prototype'][_0x5b2d('0x13')]=function(_0xdd4d6d){var _0x4b6b9d=new VoiceQueueReport(this[_0x5b2d('0x11')]);var _0xd9d819=new VoiceAgentReport(this['realtime']);var _0x1eda91=new VoiceDialReport(this[_0x5b2d('0x11')]);var _0x549fe4=new VoiceCallReport(this[_0x5b2d('0x11')]);var _0x41c5ff=new UserReport(this['realtime']);if(config[_0x5b2d('0x14')]&&config[_0x5b2d('0x14')][_0x5b2d('0x15')]){ami['on'](_0x5b2d('0x16'),this[_0x5b2d('0x17')][_0x5b2d('0x18')](this));ami['on']('custom:voiceCallReport',this[_0x5b2d('0x19')][_0x5b2d('0x18')](this));ami['on'](_0x5b2d('0x1a'),this['voiceAgentReport']['bind'](this));ami['on'](_0x5b2d('0x1b'),this[_0x5b2d('0x1c')][_0x5b2d('0x18')](this));ami['on'](_0x5b2d('0x1d'),this[_0x5b2d('0x1e')][_0x5b2d('0x18')](this));ami['on'](_0x5b2d('0x1f'),this[_0x5b2d('0x20')][_0x5b2d('0x18')](this));}};Report[_0x5b2d('0x21')][_0x5b2d('0x22')]=function(_0x51df61){var _0x383a52;_0x383a52=_[_0x5b2d('0x23')](this[_0x5b2d('0x24')],function(_0x20e1a8){return _0x20e1a8[_0x5b2d('0x25')]==_0x51df61||_0x20e1a8[_0x5b2d('0x26')]==_0x51df61;});if(_[_0x5b2d('0x27')](_0x383a52)){var _0x19e5a1=_[_0x5b2d('0x23')](this[_0x5b2d('0x12')],function(_0x365932){return _0x365932[_0x5b2d('0x25')]==_0x51df61||_0x365932[_0x5b2d('0x26')]==_0x51df61;});if(_0x19e5a1){_0x383a52=_[_0x5b2d('0x23')](this['agents'],function(_0x3620ba){return _0x3620ba['interface']==util[_0x5b2d('0x28')](_0x5b2d('0x29'),_0x19e5a1[_0x5b2d('0x26')]);});}}return _0x383a52;};Report[_0x5b2d('0x21')][_0x5b2d('0x17')]=function(_0x2c49c4){for(var _0x587a6c=0x0;_0x587a6c<_0x2c49c4['length'];_0x587a6c+=0x1){var _0x22b91f=this[_0x5b2d('0x22')](_0x2c49c4[_0x587a6c]['connectedlinenum']);if(_0x22b91f){_0x2c49c4[_0x587a6c][_0x5b2d('0x25')]=_0x22b91f['accountcode'];_0x2c49c4[_0x587a6c][_0x5b2d('0x2a')]=!![];_0x2c49c4[_0x587a6c]['lastAssignedTo']=_0x22b91f['name'];_0x2c49c4[_0x587a6c][_0x5b2d('0x2b')]=_[_0x5b2d('0x27')](_0x22b91f[_0x5b2d('0x2b')])?util[_0x5b2d('0x28')]('SIP/%s',_0x22b91f[_0x5b2d('0x26')]):_0x22b91f[_0x5b2d('0x2b')];if(_0x2c49c4[_0x587a6c]['queuecallercomplete']){_0x2c49c4[_0x587a6c][_0x5b2d('0x2c')]=moment()[_0x5b2d('0x28')](_0x5b2d('0x2d'));}if(_0x2c49c4[_0x587a6c]['queuecallerexit']){_0x2c49c4[_0x587a6c]['queuecallerexitAt']=moment()[_0x5b2d('0x28')](_0x5b2d('0x2d'));}RpcMemberReport[_0x5b2d('0x17')](_0x2c49c4[_0x587a6c]);}RpcVoiceQueueReport['create'](_0x2c49c4[_0x587a6c]);}};function extractCalleridNumber(_0x102255){var _0x585584=_0x102255['match'](/<(.*?)>/);return _0x585584?_0x585584[0x1]:_0x102255;}Report['prototype'][_0x5b2d('0x2e')]=function(_0x256a0e){for(var _0x38ec2e=0x0;_0x38ec2e',_0x3b0e2a[_0x5b2d('0x45')],_0x3b0e2a[_0x5b2d('0x33')]);}if(RpcVoiceTransferReport[_0x5b2d('0x46')][_0x3b0e2a[_0x5b2d('0x47')]]){var _0x19c2d7=RpcVoiceTransferReport['transfers'][_0x3b0e2a[_0x5b2d('0x47')]];_0x19c2d7[_0x5b2d('0x48')]=_0x3b0e2a['uniqueid'];RpcVoiceTransferReport[_0x5b2d('0x1e')](_0x19c2d7);delete RpcVoiceTransferReport['transfers'][_0x3b0e2a[_0x5b2d('0x47')]];}if(_[_0x5b2d('0x27')](_0x3b0e2a[_0x5b2d('0x49')])){_0x3b0e2a[_0x5b2d('0x49')]=this[_0x5b2d('0x4a')](_0x3b0e2a);}if(_['isNil'](_0x3b0e2a[_0x5b2d('0x4b')])){var _0x2e63b5=_0x3b0e2a['channel']['split']('-')[0x0];var _0x3101a3=this[_0x5b2d('0x24')][_0x2e63b5];if(!_0x3101a3)_0x3101a3=this['getAgentByInternal'](_0x3b0e2a[_0x5b2d('0x25')]);if(_0x3101a3){_0x3b0e2a[_0x5b2d('0x4b')]=_0x3101a3['id'];_0x3b0e2a['membername']=_0x3101a3[_0x5b2d('0x26')];}}RpcVoiceCallReport[_0x5b2d('0x4c')](_0x3b0e2a);if(_0x3b0e2a['monitor']){for(var _0x5ce49e=0x0;_0x5ce49e<_0x3b0e2a[_0x5b2d('0x4d')][_0x5b2d('0x30')];_0x5ce49e+=0x1){_0x3b0e2a[_0x5b2d('0x4e')]=_0x3b0e2a[_0x5b2d('0x4d')][_0x5ce49e][_0x5b2d('0x4f')];_0x3b0e2a[_0x5b2d('0x50')]=_0x3b0e2a['monitors'][_0x5ce49e]['createdAt'];if(_0x3b0e2a['exten']==_0x5b2d('0x3f')){_0x3b0e2a[_0x5b2d('0x33')]=_0x3b0e2a[_0x5b2d('0x44')];_0x3b0e2a[_0x5b2d('0x45')]=_0x3b0e2a[_0x5b2d('0x51')];_0x3b0e2a[_0x5b2d('0x44')]=_0x3b0e2a[_0x5b2d('0x25')];_0x3b0e2a[_0x5b2d('0x51')]=_0x3b0e2a[_0x5b2d('0x52')];_0x3b0e2a[_0x5b2d('0x36')]=_0x3b0e2a[_0x5b2d('0x41')];}else if(_0x3b0e2a[_0x5b2d('0x36')]=='xcally-motion-dialer'){_0x3b0e2a['calleridnum']=_0x3b0e2a[_0x5b2d('0x35')];_0x3b0e2a[_0x5b2d('0x36')]=_0x3b0e2a[_0x5b2d('0x41')];}RpcVoiceRecording['create'](_0x3b0e2a);}}};Report['prototype'][_0x5b2d('0x53')]=function(_0x263ddf){if(_[_0x5b2d('0x54')](_0x263ddf)){_0x263ddf[_0x5b2d('0x55')](function(_0x102a5e){RpcVoiceAgentReport[_0x5b2d('0x4c')](_0x102a5e);});}else{RpcVoiceAgentReport[_0x5b2d('0x4c')](_0x263ddf);}};Report['prototype'][_0x5b2d('0x1c')]=function(_0x543006){RpcVoiceDialReport[_0x5b2d('0x4c')](_0x543006);var _0x3723e4;var _0x5c85b6;var _0x45189b=_0x543006[_0x5b2d('0x31')];if(_[_0x5b2d('0x56')](_0x45189b,_0x5b2d('0x57'))){_0x5c85b6=_0x45189b[_0x5b2d('0x58')](_0x45189b[_0x5b2d('0x59')]('/')+0x1,_0x45189b[_0x5b2d('0x59')]('@'));_0x3723e4=_[_0x5b2d('0x23')](this['agents'],function(_0x101fae){return _0x101fae[_0x5b2d('0x5a')]==_0x5c85b6||_0x101fae['phone']==_0x5c85b6||_0x101fae[_0x5b2d('0x25')]==_0x5c85b6;});}else{_0x5c85b6=_0x45189b[_0x5b2d('0x58')](_0x45189b[_0x5b2d('0x59')]('/')+0x1,_0x45189b[_0x5b2d('0x5b')]('-'));_0x3723e4=this[_0x5b2d('0x22')](_0x5c85b6);}if(_0x3723e4){_0x543006['interface']=_[_0x5b2d('0x27')](_0x3723e4[_0x5b2d('0x2b')])?util[_0x5b2d('0x28')](_0x5b2d('0x29'),_0x3723e4[_0x5b2d('0x26')]):_0x3723e4[_0x5b2d('0x2b')];_0x543006[_0x5b2d('0x52')]=_0x3723e4['name'];_0x543006[_0x5b2d('0x25')]=_0x3723e4['accountcode'];RpcMemberReport[_0x5b2d('0x1c')](_0x543006);}};Report[_0x5b2d('0x21')][_0x5b2d('0x1e')]=function(_0x323562){RpcVoiceTransferReport[_0x5b2d('0x46')][_0x323562['transfererlinkedid']]=_0x323562;};Report['prototype']['attendedTransfer']=function(_0x3c7e1e){RpcVoiceTransferReport[_0x5b2d('0x20')](_0x3c7e1e);};module[_0x5b2d('0x5c')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 92498db..a871359 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x28c3=['util','ioredis','bluebird','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','agents','toLowerCase','inuse','local','toNumber','updateStatusRealtime','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','startsWith','Local','substring','indexOf','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment'];(function(_0x3c6940,_0x3907ac){var _0x428a77=function(_0x4e184f){while(--_0x4e184f){_0x3c6940['push'](_0x3c6940['shift']());}};_0x428a77(++_0x3907ac);}(_0x28c3,0x189));var _0x328c=function(_0x5ef318,_0x4e4a43){_0x5ef318=_0x5ef318-0x0;var _0x5f1f71=_0x28c3[_0x5ef318];return _0x5f1f71;};'use strict';var _=require(_0x328c('0x0'));var moment=require(_0x328c('0x1'));var util=require(_0x328c('0x2'));var Redis=require(_0x328c('0x3'));var BPromise=require(_0x328c('0x4'));var config=require('../../../config/environment');var logger=require(_0x328c('0x5'))(_0x328c('0x6'));var ami=require(_0x328c('0x7'));config[_0x328c('0x8')]=_[_0x328c('0x9')](config[_0x328c('0x8')],{'host':_0x328c('0xa'),'port':0x18eb});var io=require(_0x328c('0xb'))(new Redis(config[_0x328c('0x8')]));function UserReport(_0x3bd1c3){this[_0x328c('0xc')]=_0x3bd1c3['trunks'];this['agents']=_0x3bd1c3['agents'];this[_0x328c('0xd')]=_0x3bd1c3[_0x328c('0xd')];ami['on'](_0x328c('0xe'),this[_0x328c('0xf')][_0x328c('0x10')](this));ami['on'](_0x328c('0x11'),this[_0x328c('0xf')][_0x328c('0x10')](this));ami['on']('devicestatechange',this[_0x328c('0x12')]['bind'](this));ami['on'](_0x328c('0x13'),this[_0x328c('0x14')][_0x328c('0x10')](this));return this[_0x328c('0x15')]();}function showSipRegistrations(){Promise[_0x328c('0x16')]()['then'](ami[_0x328c('0x17')]())[_0x328c('0x18')](function(_0x35bc56){logger[_0x328c('0x19')]('[userReport][sipshowregistry]',util[_0x328c('0x1a')](_0x35bc56,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x328c('0x16')]()[_0x328c('0x1b')](ami[_0x328c('0x1c')]())[_0x328c('0x18')](function(_0x1c29de){logger[_0x328c('0x19')](_0x328c('0x1d'),util[_0x328c('0x1a')](_0x1c29de,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x328c('0x16')]()[_0x328c('0x1b')](ami[_0x328c('0x1e')]())['catch'](function(_0x21ebf7){logger[_0x328c('0x19')](_0x328c('0x1f'),util[_0x328c('0x1a')](_0x21ebf7,{'showHidden':![],'depth':null}));});}UserReport[_0x328c('0x20')][_0x328c('0x15')]=function(){setInterval(function(){BPromise[_0x328c('0x16')]()[_0x328c('0x1b')](showSipRegistrations())[_0x328c('0x1b')](listDeviceStates())[_0x328c('0x1b')](showPeersStatus());},0x32c8);};UserReport[_0x328c('0x20')][_0x328c('0x21')]=function(_0x2b1fcc){return _0x2b1fcc!==null&&!_[_0x328c('0x22')](_0x2b1fcc);};UserReport['prototype'][_0x328c('0x23')]=function(_0x32fa1f,_0x182880,_0x311b69){io['to'](_0x32fa1f)[_0x328c('0x23')](_0x182880,_0x311b69);};UserReport[_0x328c('0x20')]['syncRegistry']=function(_0x2a7348){try{if(this['isNotNull'](_0x2a7348)){logger[_0x328c('0x24')](_0x328c('0x25'),_0x2a7348['username'],_0x2a7348[_0x328c('0x26')]);logger[_0x328c('0x27')](_0x328c('0x28'),util['inspect'](_0x2a7348,{'showHidden':![],'depth':null}));var _0x136b43=_[_0x328c('0x29')](this['trunks'],{'defaultuser':_0x2a7348[_0x328c('0x2a')]});if(_0x136b43){_0x2a7348[_0x328c('0x2b')]=_0x2a7348[_0x328c('0x26')];_['merge'](_0x136b43,_['omit'](_0x2a7348,[_0x328c('0x2c'),_0x328c('0x2d'),_0x328c('0x2a'),'state']));logger[_0x328c('0x27')](_0x328c('0x2e'),util[_0x328c('0x1a')](_0x136b43,{'showHidden':![],'depth':null}));this['emit'](util[_0x328c('0x2f')]('trunk:%s',_0x136b43[_0x328c('0x30')]),'trunk:save',_0x136b43);}}}catch(_0x586f56){logger[_0x328c('0x19')](_0x328c('0x28'),util['inspect'](_0x586f56,{'showHidden':![],'depth':null}));}};UserReport[_0x328c('0x20')][_0x328c('0x12')]=function(_0x3ddbc9){try{if(this[_0x328c('0x21')](_0x3ddbc9)){logger[_0x328c('0x24')](_0x328c('0x31'),_0x3ddbc9[_0x328c('0x32')],_0x3ddbc9[_0x328c('0x26')]);logger['debug'](_0x328c('0x33'),util['inspect'](_0x3ddbc9,{'showHidden':![],'depth':null}));if(this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]]){if(!this['agents'][_0x3ddbc9[_0x328c('0x32')]]['local']||_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]()==_0x328c('0x36')){this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x37')]=![];if(this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){this[_0x328c('0x34')][_0x3ddbc9[_0x328c('0x32')]]['stateTime']=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}this[_0x328c('0x34')][_0x3ddbc9['device']]['state']=_0x3ddbc9[_0x328c('0x26')]['toLowerCase']();this[_0x328c('0x34')][_0x3ddbc9['device']][_0x328c('0x39')](_0x3ddbc9);}}else if(this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]]){if(this[_0x328c('0xd')][_0x3ddbc9['device']][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]()){this['telephones'][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x3a')]=_['toNumber'](moment()['format']('x'));}this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]=_0x3ddbc9['state'][_0x328c('0x35')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x328c('0x1a')](this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]],{'showHidden':![],'depth':null}));this[_0x328c('0x23')](util['format'](_0x328c('0x3b'),this['telephones'][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x30')]),_0x328c('0x3c'),this[_0x328c('0xd')][_0x3ddbc9[_0x328c('0x32')]]);}else if(this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]]){if(this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x3a')]=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}this[_0x328c('0xc')][_0x3ddbc9['device']]['state']=_0x3ddbc9[_0x328c('0x26')]['toLowerCase']();logger['debug'](_0x328c('0x3d'),util[_0x328c('0x1a')](this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x328c('0x2f')](_0x328c('0x3e'),this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]][_0x328c('0x30')]),_0x328c('0x3f'),this[_0x328c('0xc')][_0x3ddbc9[_0x328c('0x32')]]);}else if(_[_0x328c('0x40')](_0x3ddbc9[_0x328c('0x32')],_0x328c('0x41'))){var _0x48450f=_0x3ddbc9[_0x328c('0x32')];var _0x3c9617=_0x48450f[_0x328c('0x42')](_0x48450f[_0x328c('0x43')]('/')+0x1,_0x48450f[_0x328c('0x43')]('@'));var _0xdf4f7d=_['find'](this[_0x328c('0x34')],function(_0x14b30d){return _0x14b30d[_0x328c('0x44')]==_0x3c9617||_0x14b30d['phone']==_0x3c9617||_0x14b30d[_0x328c('0x45')]==_0x3c9617;});if(_0xdf4f7d){if(_0xdf4f7d[_0x328c('0x26')]!==_0x3ddbc9[_0x328c('0x26')]['toLowerCase']()){_0xdf4f7d[_0x328c('0x3a')]=_[_0x328c('0x38')](moment()[_0x328c('0x2f')]('x'));}_0xdf4f7d[_0x328c('0x26')]=_0x3ddbc9[_0x328c('0x26')][_0x328c('0x35')]();_0xdf4f7d[_0x328c('0x37')]=!![];_0xdf4f7d[_0x328c('0x39')](_0x3ddbc9);}}}}catch(_0x375a1a){logger['error']('[userReport][devicestatechange]',util['inspect'](_0x375a1a,{'showHidden':![],'depth':null}));}};UserReport[_0x328c('0x20')][_0x328c('0x14')]=function(_0x46915c){try{if(this[_0x328c('0x21')](_0x46915c)&&this[_0x328c('0x21')](_0x46915c['peerstatus'])){logger['info'](_0x328c('0x46'),_0x46915c['peer'],_0x46915c[_0x328c('0x47')],_0x46915c[_0x328c('0x13')]);logger[_0x328c('0x27')](_0x328c('0x48'),util['inspect'](_0x46915c,{'showHidden':![],'depth':null}));if(this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]]){if(!this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x37')]||_0x46915c[_0x328c('0x13')][_0x328c('0x35')]()==_0x328c('0x4a')){this[_0x328c('0x34')][_0x46915c['peer']][_0x328c('0x37')]=![];this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c[_0x328c('0x13')][_0x328c('0x35')]();this[_0x328c('0x34')][_0x46915c['peer']][_0x328c('0x47')]=_0x46915c['address'];this[_0x328c('0x34')][_0x46915c[_0x328c('0x49')]][_0x328c('0x39')](_0x46915c);}}else if(this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]]){this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c['peerstatus']['toLowerCase']();this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x47')]=_0x46915c[_0x328c('0x47')];logger['debug'](_0x328c('0x4c'),util['inspect'](this['telephones'][_0x46915c['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x328c('0x3b'),this[_0x328c('0xd')][_0x46915c[_0x328c('0x49')]][_0x328c('0x30')]),_0x328c('0x3c'),this[_0x328c('0xd')][_0x46915c['peer']]);}else if(this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]]){this['trunks'][_0x46915c[_0x328c('0x49')]][_0x328c('0x4b')]=_0x46915c['peerstatus']['toLowerCase']();this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]]['address']=_0x46915c['address'];logger[_0x328c('0x27')](_0x328c('0x4d'),util[_0x328c('0x1a')](this[_0x328c('0xc')][_0x46915c[_0x328c('0x49')]],{'showHidden':![],'depth':null}));this[_0x328c('0x23')](util[_0x328c('0x2f')](_0x328c('0x3e'),this[_0x328c('0xc')][_0x46915c['peer']][_0x328c('0x30')]),_0x328c('0x3f'),this['trunks'][_0x46915c[_0x328c('0x49')]]);}}}catch(_0x30d67e){logger[_0x328c('0x19')](_0x328c('0x48'),util['inspect'](_0x30d67e,{'showHidden':![],'depth':null}));}};module[_0x328c('0x4e')]=UserReport; \ No newline at end of file +var _0xde5b=['mobile','phone','accountcode','[userReport][devicestatechange]','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:save','exports','lodash','moment','ioredis','bluebird','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','[userReport][registry]','find','username','state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','toLowerCase','inuse','local','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','stateTime','startsWith','Local','substring','indexOf'];(function(_0x23597f,_0x1e34ac){var _0x237f67=function(_0x46f9b8){while(--_0x46f9b8){_0x23597f['push'](_0x23597f['shift']());}};_0x237f67(++_0x1e34ac);}(_0xde5b,0x1e8));var _0xbde5=function(_0x578a75,_0x4993ed){_0x578a75=_0x578a75-0x0;var _0x40ffe2=_0xde5b[_0x578a75];return _0x40ffe2;};'use strict';var _=require(_0xbde5('0x0'));var moment=require(_0xbde5('0x1'));var util=require('util');var Redis=require(_0xbde5('0x2'));var BPromise=require(_0xbde5('0x3'));var config=require(_0xbde5('0x4'));var logger=require('../../../config/logger')(_0xbde5('0x5'));var ami=require(_0xbde5('0x6'));config['redis']=_[_0xbde5('0x7')](config[_0xbde5('0x8')],{'host':_0xbde5('0x9'),'port':0x18eb});var io=require(_0xbde5('0xa'))(new Redis(config[_0xbde5('0x8')]));function UserReport(_0x51d2d1){this[_0xbde5('0xb')]=_0x51d2d1[_0xbde5('0xb')];this[_0xbde5('0xc')]=_0x51d2d1[_0xbde5('0xc')];this[_0xbde5('0xd')]=_0x51d2d1['telephones'];ami['on']('registryentry',this[_0xbde5('0xe')][_0xbde5('0xf')](this));ami['on'](_0xbde5('0x10'),this[_0xbde5('0xe')][_0xbde5('0xf')](this));ami['on'](_0xbde5('0x11'),this[_0xbde5('0x12')][_0xbde5('0xf')](this));ami['on']('peerstatus',this[_0xbde5('0x13')][_0xbde5('0xf')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()[_0xbde5('0x14')](ami[_0xbde5('0x15')]())[_0xbde5('0x16')](function(_0x145120){logger[_0xbde5('0x17')](_0xbde5('0x18'),util[_0xbde5('0x19')](_0x145120,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xbde5('0x1a')]()[_0xbde5('0x14')](ami[_0xbde5('0x1b')]())['catch'](function(_0x71d9e){logger[_0xbde5('0x17')](_0xbde5('0x1c'),util[_0xbde5('0x19')](_0x71d9e,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xbde5('0x1a')]()[_0xbde5('0x14')](ami[_0xbde5('0x1d')]())[_0xbde5('0x16')](function(_0x502084){logger[_0xbde5('0x17')](_0xbde5('0x1e'),util['inspect'](_0x502084,{'showHidden':![],'depth':null}));});}UserReport[_0xbde5('0x1f')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xbde5('0x1a')]()['then'](showSipRegistrations())[_0xbde5('0x14')](listDeviceStates())[_0xbde5('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xbde5('0x1f')][_0xbde5('0x20')]=function(_0x3239ca){return _0x3239ca!==null&&!_[_0xbde5('0x21')](_0x3239ca);};UserReport[_0xbde5('0x1f')][_0xbde5('0x22')]=function(_0x4b4f32,_0x5d4d82,_0x3cc37e){io['to'](_0x4b4f32)[_0xbde5('0x22')](_0x5d4d82,_0x3cc37e);};UserReport[_0xbde5('0x1f')]['syncRegistry']=function(_0x4643a8){try{if(this[_0xbde5('0x20')](_0x4643a8)){logger[_0xbde5('0x23')](_0xbde5('0x24'),_0x4643a8['username'],_0x4643a8['state']);logger[_0xbde5('0x25')](_0xbde5('0x26'),util[_0xbde5('0x19')](_0x4643a8,{'showHidden':![],'depth':null}));var _0xc8b9f9=_[_0xbde5('0x27')](this[_0xbde5('0xb')],{'defaultuser':_0x4643a8[_0xbde5('0x28')]});if(_0xc8b9f9){_0x4643a8['stateRegistry']=_0x4643a8[_0xbde5('0x29')];_[_0xbde5('0x2a')](_0xc8b9f9,_[_0xbde5('0x2b')](_0x4643a8,[_0xbde5('0x2c'),_0xbde5('0x2d'),_0xbde5('0x28'),_0xbde5('0x29')]));logger['debug'](_0xbde5('0x2e'),util[_0xbde5('0x19')](_0xc8b9f9,{'showHidden':![],'depth':null}));this[_0xbde5('0x22')](util[_0xbde5('0x2f')](_0xbde5('0x30'),_0xc8b9f9[_0xbde5('0x31')]),'trunk:save',_0xc8b9f9);}}}catch(_0x31e989){logger[_0xbde5('0x17')](_0xbde5('0x26'),util['inspect'](_0x31e989,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xbde5('0x12')]=function(_0x209a60){try{if(this['isNotNull'](_0x209a60)){logger['info'](_0xbde5('0x32'),_0x209a60[_0xbde5('0x33')],_0x209a60[_0xbde5('0x29')]);logger[_0xbde5('0x25')]('[userReport][devicestatechange]',util[_0xbde5('0x19')](_0x209a60,{'showHidden':![],'depth':null}));if(this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]]){if(!this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]]['local']||_0x209a60['state'][_0xbde5('0x34')]()==_0xbde5('0x35')){this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x36')]=![];if(this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]]['state']!==_0x209a60[_0xbde5('0x29')]['toLowerCase']()){this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]]['stateTime']=_[_0xbde5('0x37')](moment()['format']('x'));}this[_0xbde5('0xc')][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x29')]=_0x209a60[_0xbde5('0x29')][_0xbde5('0x34')]();this['agents'][_0x209a60['device']][_0xbde5('0x38')](_0x209a60);}}else if(this['telephones'][_0x209a60[_0xbde5('0x33')]]){if(this[_0xbde5('0xd')][_0x209a60['device']][_0xbde5('0x29')]!==_0x209a60['state'][_0xbde5('0x34')]()){this['telephones'][_0x209a60[_0xbde5('0x33')]]['stateTime']=_[_0xbde5('0x37')](moment()[_0xbde5('0x2f')]('x'));}this[_0xbde5('0xd')][_0x209a60['device']][_0xbde5('0x29')]=_0x209a60[_0xbde5('0x29')][_0xbde5('0x34')]();logger[_0xbde5('0x25')](_0xbde5('0x39'),util[_0xbde5('0x19')](this[_0xbde5('0xd')][_0x209a60[_0xbde5('0x33')]],{'showHidden':![],'depth':null}));this[_0xbde5('0x22')](util[_0xbde5('0x2f')](_0xbde5('0x3a'),this[_0xbde5('0xd')][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x31')]),_0xbde5('0x3b'),this[_0xbde5('0xd')][_0x209a60['device']]);}else if(this[_0xbde5('0xb')][_0x209a60[_0xbde5('0x33')]]){if(this['trunks'][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x29')]!==_0x209a60[_0xbde5('0x29')]['toLowerCase']()){this[_0xbde5('0xb')][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x3c')]=_['toNumber'](moment()[_0xbde5('0x2f')]('x'));}this[_0xbde5('0xb')][_0x209a60['device']]['state']=_0x209a60['state'][_0xbde5('0x34')]();logger[_0xbde5('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xbde5('0x19')](this[_0xbde5('0xb')][_0x209a60[_0xbde5('0x33')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xbde5('0x2f')](_0xbde5('0x30'),this[_0xbde5('0xb')][_0x209a60[_0xbde5('0x33')]][_0xbde5('0x31')]),'trunk:save',this[_0xbde5('0xb')][_0x209a60[_0xbde5('0x33')]]);}else if(_[_0xbde5('0x3d')](_0x209a60[_0xbde5('0x33')],_0xbde5('0x3e'))){var _0x2251ea=_0x209a60[_0xbde5('0x33')];var _0x5a4648=_0x2251ea[_0xbde5('0x3f')](_0x2251ea[_0xbde5('0x40')]('/')+0x1,_0x2251ea[_0xbde5('0x40')]('@'));var _0x46ddc3=_[_0xbde5('0x27')](this[_0xbde5('0xc')],function(_0x4a7d7a){return _0x4a7d7a[_0xbde5('0x41')]==_0x5a4648||_0x4a7d7a[_0xbde5('0x42')]==_0x5a4648||_0x4a7d7a[_0xbde5('0x43')]==_0x5a4648;});if(_0x46ddc3){if(_0x46ddc3[_0xbde5('0x29')]!==_0x209a60[_0xbde5('0x29')][_0xbde5('0x34')]()){_0x46ddc3[_0xbde5('0x3c')]=_[_0xbde5('0x37')](moment()[_0xbde5('0x2f')]('x'));}_0x46ddc3[_0xbde5('0x29')]=_0x209a60[_0xbde5('0x29')][_0xbde5('0x34')]();_0x46ddc3[_0xbde5('0x36')]=!![];_0x46ddc3[_0xbde5('0x38')](_0x209a60);}}}}catch(_0x96964f){logger[_0xbde5('0x17')](_0xbde5('0x44'),util[_0xbde5('0x19')](_0x96964f,{'showHidden':![],'depth':null}));}};UserReport[_0xbde5('0x1f')][_0xbde5('0x13')]=function(_0x4c4acf){try{if(this[_0xbde5('0x20')](_0x4c4acf)&&this[_0xbde5('0x20')](_0x4c4acf[_0xbde5('0x45')])){logger['info'](_0xbde5('0x46'),_0x4c4acf[_0xbde5('0x47')],_0x4c4acf[_0xbde5('0x48')],_0x4c4acf['peerstatus']);logger['debug'](_0xbde5('0x49'),util[_0xbde5('0x19')](_0x4c4acf,{'showHidden':![],'depth':null}));if(this[_0xbde5('0xc')][_0x4c4acf['peer']]){if(!this[_0xbde5('0xc')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x36')]||_0x4c4acf[_0xbde5('0x45')][_0xbde5('0x34')]()==_0xbde5('0x4a')){this[_0xbde5('0xc')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x36')]=![];this[_0xbde5('0xc')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x4b')]=_0x4c4acf['peerstatus'][_0xbde5('0x34')]();this[_0xbde5('0xc')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x48')]=_0x4c4acf[_0xbde5('0x48')];this[_0xbde5('0xc')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x38')](_0x4c4acf);}}else if(this[_0xbde5('0xd')][_0x4c4acf[_0xbde5('0x47')]]){this[_0xbde5('0xd')][_0x4c4acf['peer']][_0xbde5('0x4b')]=_0x4c4acf[_0xbde5('0x45')]['toLowerCase']();this[_0xbde5('0xd')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x48')]=_0x4c4acf[_0xbde5('0x48')];logger['debug'](_0xbde5('0x4c'),util['inspect'](this[_0xbde5('0xd')][_0x4c4acf[_0xbde5('0x47')]],{'showHidden':![],'depth':null}));this[_0xbde5('0x22')](util['format']('telephone:%s',this[_0xbde5('0xd')][_0x4c4acf['peer']][_0xbde5('0x31')]),_0xbde5('0x3b'),this['telephones'][_0x4c4acf['peer']]);}else if(this[_0xbde5('0xb')][_0x4c4acf[_0xbde5('0x47')]]){this[_0xbde5('0xb')][_0x4c4acf['peer']][_0xbde5('0x4b')]=_0x4c4acf['peerstatus']['toLowerCase']();this[_0xbde5('0xb')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x48')]=_0x4c4acf[_0xbde5('0x48')];logger['debug']('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xbde5('0x19')](this['trunks'][_0x4c4acf[_0xbde5('0x47')]],{'showHidden':![],'depth':null}));this[_0xbde5('0x22')](util[_0xbde5('0x2f')](_0xbde5('0x30'),this[_0xbde5('0xb')][_0x4c4acf[_0xbde5('0x47')]][_0xbde5('0x31')]),_0xbde5('0x4d'),this[_0xbde5('0xb')][_0x4c4acf['peer']]);}}}catch(_0x195182){logger[_0xbde5('0x17')](_0xbde5('0x49'),util[_0xbde5('0x19')](_0x195182,{'showHidden':![],'depth':null}));}};module[_0xbde5('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 2320f75..ffc2852 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a89=['inbound','variables','voice','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','destconnectedlinenum','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','destaccountcode','user:agentcomplete','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','emit','prototype','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type'];(function(_0x33e94d,_0x3b8527){var _0x4b4373=function(_0x3c472b){while(--_0x3c472b){_0x33e94d['push'](_0x33e94d['shift']());}};_0x4b4373(++_0x3b8527);}(_0x5a89,0x6d));var _0x95a8=function(_0x23c466,_0x3243f3){_0x23c466=_0x23c466-0x0;var _0x146a6a=_0x5a89[_0x23c466];return _0x146a6a;};'use strict';var _=require(_0x95a8('0x0'));var moment=require(_0x95a8('0x1'));var util=require(_0x95a8('0x2'));var Redis=require(_0x95a8('0x3'));var config=require(_0x95a8('0x4'));var logger=require(_0x95a8('0x5'))(_0x95a8('0x6'));var ami=require(_0x95a8('0x7'));config[_0x95a8('0x8')]=_[_0x95a8('0x9')](config[_0x95a8('0x8')],{'host':_0x95a8('0xa'),'port':0x18eb});var io=require(_0x95a8('0xb'))(new Redis(config[_0x95a8('0x8')]));function VoiceAgentReport(_0x5aa5f5){this[_0x95a8('0xc')]={};this[_0x95a8('0xd')]=_0x5aa5f5[_0x95a8('0xc')];this[_0x95a8('0xe')]=_0x5aa5f5[_0x95a8('0xe')];this['agents']=_0x5aa5f5[_0x95a8('0xf')];this['variables']={};ami['on'](_0x95a8('0x10'),this[_0x95a8('0x11')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x13'),this[_0x95a8('0x14')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x15'),this[_0x95a8('0x16')][_0x95a8('0x12')](this));ami['on']('queuecallerabandon',this[_0x95a8('0x17')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x18'),this[_0x95a8('0x19')][_0x95a8('0x12')](this));ami['on']('varset',this[_0x95a8('0x1a')][_0x95a8('0x12')](this));ami['on']('hangup',this[_0x95a8('0x1b')][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1c'),this['syncMusicOnHoldStart'][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1d'),this['syncMusicOnHoldStop'][_0x95a8('0x12')](this));ami['on'](_0x95a8('0x1e'),this[_0x95a8('0x1f')][_0x95a8('0x12')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0x95a8('0x20')]=function(_0x3af717,_0x2371f5,_0x786d9){io['to'](_0x3af717)[_0x95a8('0x20')](_0x2371f5,_0x786d9);};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x22')]=function(_0x17f0af){return _0x17f0af!==null&&!_[_0x95a8('0x23')](_0x17f0af);};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x11')]=function(_0x408c98){try{if(this[_0x95a8('0x22')](_0x408c98)){logger[_0x95a8('0x24')](_0x95a8('0x25'),_0x408c98[_0x95a8('0x26')],_0x408c98['membername'],_0x408c98[_0x95a8('0x27')]);logger['debug'](_0x95a8('0x28'),_0x408c98['uniqueid'],util[_0x95a8('0x29')](_0x408c98,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x408c98[_0x95a8('0x26')]])){this['channels'][_0x408c98[_0x95a8('0x26')]]={};}if(_[_0x95a8('0x23')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]])){this['channels'][_0x408c98['uniqueid']][_0x408c98[_0x95a8('0x27')]]={'agentcalledAt':moment()[_0x95a8('0x2a')](_0x95a8('0x2b')),'lastevent':_0x95a8('0x2c'),'mandatoryDisposition':this[_0x95a8('0xe')][_0x408c98[_0x95a8('0x2d')]]?this[_0x95a8('0xe')][_0x408c98['queue']][_0x95a8('0x2e')]||![]:![],'type':this[_0x95a8('0xe')][_0x408c98['queue']]?this['voiceQueues'][_0x408c98[_0x95a8('0x2d')]][_0x95a8('0x2f')]||'inbound':_0x95a8('0x30'),'variables':this[_0x95a8('0x31')][_0x408c98[_0x95a8('0x26')]],'motionChannel':_0x95a8('0x32')};}_[_0x95a8('0x33')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98['destuniqueid']],_[_0x95a8('0x34')](_0x408c98,[_0x95a8('0x35'),_0x95a8('0x36')]));logger[_0x95a8('0x37')](_0x95a8('0x38'),_0x408c98['uniqueid'],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x39'),this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]]);var _0x3e8112={'id':this[_0x95a8('0xf')][_0x408c98['interface']]['id'],'calleridnum':this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]][_0x95a8('0x3a')],'queue':this['channels'][_0x408c98[_0x95a8('0x26')]][_0x408c98[_0x95a8('0x27')]]['queue'],'variables':this[_0x95a8('0xc')][_0x408c98['uniqueid']][_0x408c98[_0x95a8('0x27')]][_0x95a8('0x31')]};logger[_0x95a8('0x37')](_0x95a8('0x3b'),_0x408c98[_0x95a8('0x26')],util['inspect'](_0x3e8112,{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util['format'](_0x95a8('0x3c'),_0x408c98[_0x95a8('0x3d')]),_0x95a8('0x3e'),_0x3e8112);}}catch(_0x34b821){logger[_0x95a8('0x3f')](_0x95a8('0x40'),_0x408c98[_0x95a8('0x26')],util['inspect'](_0x34b821,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')]['syncAgentConnect']=function(_0xdee35b){try{if(this[_0x95a8('0x22')](_0xdee35b)){if(this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]]){logger[_0x95a8('0x37')](_0x95a8('0x41'),_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](_0xdee35b,{'showHidden':![],'depth':null}));for(var _0x191131 in this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]]){if(this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x95a8('0x42')](_0x191131)){if(_0xdee35b[_0x95a8('0x27')]===_0x191131){logger[_0x95a8('0x24')](_0x95a8('0x43'),_0xdee35b[_0x95a8('0x26')],_0xdee35b[_0x95a8('0x3d')],_0xdee35b[_0x95a8('0x27')]);this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x44')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131][_0x95a8('0x45')]=_0xdee35b['connectedlinename'];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131]['connectedlinenum']=_0xdee35b[_0x95a8('0x46')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x47')]=_0xdee35b['destchannelstate'];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x48')]=_0xdee35b[_0x95a8('0x48')];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x49')]=_0xdee35b[_0x95a8('0x49')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x4a')]=_0x95a8('0x4b');if(this['voiceChannels'][this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x26')]]){var _0x5cf682=this[_0x95a8('0xd')][this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x26')]][_0x95a8('0x4c')];this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x4c')]=_0x5cf682;_0xdee35b[_0x95a8('0x4c')]=_0x5cf682;}_[_0x95a8('0x33')](this[_0x95a8('0xf')][_0xdee35b[_0x95a8('0x4d')]],_['pick'](_0xdee35b,[_0x95a8('0x2d'),_0x95a8('0x4e'),_0x95a8('0x4c')]));logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0xdee35b[_0x95a8('0x26')],util['inspect'](this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x4f'),this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]]);logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](this['channels'][_0xdee35b[_0x95a8('0x26')]][_0xdee35b['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util[_0x95a8('0x2a')](_0x95a8('0x3c'),_0xdee35b['membername']),_0x95a8('0x50'),this['channels'][_0xdee35b[_0x95a8('0x26')]][_0xdee35b[_0x95a8('0x27')]]);}else if(!this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x15')]&&!this['channels'][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x51'),_0xdee35b[_0x95a8('0x26')],this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x3d')],_0x191131);this['channels'][_0xdee35b['uniqueid']][_0x191131][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['agentringnoanswerAt']=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['answeredelsewheredestinationuniqueid']=_0xdee35b['destuniqueid'];this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131]['answeredelsewheremembername']=_0xdee35b['membername'];this[_0x95a8('0xc')][_0xdee35b['uniqueid']][_0x191131]['lastevent']=_0x95a8('0x52');this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131][_0x95a8('0x53')]=_0x95a8('0x52');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x54'),this[_0x95a8('0xc')][_0xdee35b[_0x95a8('0x26')]][_0x191131]);}}}}}}catch(_0x43a185){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][agentconnect]',_0xdee35b[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x43a185,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')]['syncAgentRingNoAnswer']=function(_0x27ad26){try{if(this['isNotNull'](_0x27ad26)){logger[_0x95a8('0x37')](_0x95a8('0x55'),_0x27ad26[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x27ad26,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x27ad26['uniqueid']]&&this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26['destuniqueid']]){logger[_0x95a8('0x24')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x27ad26[_0x95a8('0x26')],_0x27ad26[_0x95a8('0x3d')],_0x27ad26['destuniqueid']);this['channels'][_0x27ad26[_0x95a8('0x26')]][_0x27ad26['destuniqueid']][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x56')]=moment()[_0x95a8('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x27ad26['uniqueid']][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x4a')]=_0x95a8('0x57');this[_0x95a8('0xc')][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]][_0x95a8('0x53')]=_0x95a8('0x57');logger[_0x95a8('0x37')](_0x95a8('0x58'),_0x27ad26['uniqueid'],util[_0x95a8('0x29')](this['channels'][_0x27ad26[_0x95a8('0x26')]][_0x27ad26[_0x95a8('0x27')]],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x59'),this[_0x95a8('0xc')][_0x27ad26['uniqueid']][_0x27ad26['destuniqueid']]);}}}catch(_0x4da94e){logger[_0x95a8('0x3f')](_0x95a8('0x5a'),_0x27ad26['uniqueid'],util['inspect'](_0x4da94e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x17')]=function(_0x45dd25){try{if(this[_0x95a8('0x22')](_0x45dd25)){logger[_0x95a8('0x37')](_0x95a8('0x5b'),_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x45dd25,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x45dd25['uniqueid']]){for(var _0x20dc90 in this[_0x95a8('0xc')][_0x45dd25['uniqueid']]){if(this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x95a8('0x42')](_0x20dc90)&&!this[_0x95a8('0xc')][_0x45dd25['uniqueid']][_0x20dc90][_0x95a8('0x15')]&&!this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x18')]){logger['info'](_0x95a8('0x5c'),_0x45dd25[_0x95a8('0x26')],this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x3d')],_0x20dc90);this['channels'][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x15')]=!![];this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90]['agentringnoanswerAt']=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x4a')]=_0x95a8('0x5d');this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90][_0x95a8('0x53')]=_0x95a8('0x5d');logger[_0x95a8('0x37')](_0x95a8('0x5e'),_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90],{'showHidden':![],'depth':null}));ami['emit'](_0x95a8('0x5f'),this[_0x95a8('0xc')][_0x45dd25[_0x95a8('0x26')]][_0x20dc90]);}}}}}catch(_0x5eeeea){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][queuecallerabandon]',_0x45dd25[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x5eeeea,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x19')]=function(_0x595a81){try{if(this['isNotNull'](_0x595a81)){logger[_0x95a8('0x37')](_0x95a8('0x60'),_0x595a81[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x595a81,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]]){for(var _0x245bc9 in this[_0x95a8('0xc')][_0x595a81['uniqueid']]){if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]]['hasOwnProperty'](_0x245bc9)){if(this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x44')]&&!this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x61'),_0x595a81['uniqueid'],this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x3d')],_0x245bc9);this[_0x95a8('0xc')][_0x595a81['uniqueid']][_0x245bc9][_0x95a8('0x18')]=!![];this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x4a')]=_0x95a8('0x63');this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9]['reason']=_0x595a81['reason']==_0x95a8('0x64')?_0x95a8('0x65'):_0x595a81[_0x95a8('0x53')];this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9][_0x95a8('0x66')]=_0x595a81['talktime'];if(this['voiceQueues'][_0x595a81[_0x95a8('0x2d')]]&&this[_0x95a8('0xe')][_0x595a81[_0x95a8('0x2d')]][_0x95a8('0x67')]){this[_0x95a8('0xc')][_0x595a81['uniqueid']][_0x245bc9]['acwtime']=this['voiceQueues'][_0x595a81[_0x95a8('0x2d')]]['acwTimeout'];this['channels'][_0x595a81['uniqueid']][_0x245bc9]['agentacw']=!![];}this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]=_['omit'](this[_0x95a8('0xf')][_0x595a81['interface']],[_0x95a8('0x2d'),_0x95a8('0x4e')]);logger['debug'](_0x95a8('0x68'),_0x595a81['uniqueid'],util['inspect'](this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9],{'showHidden':![],'depth':null}));ami[_0x95a8('0x20')](_0x95a8('0x69'),this[_0x95a8('0xc')][_0x595a81[_0x95a8('0x26')]][_0x245bc9]);logger[_0x95a8('0x37')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x595a81[_0x95a8('0x26')],util[_0x95a8('0x29')]({'id':this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]['id'],'destaccountcode':_0x595a81[_0x95a8('0x6a')]},{'showHidden':![],'depth':null}));this[_0x95a8('0x20')](util['format'](_0x95a8('0x3c'),_0x595a81['membername']),_0x95a8('0x6b'),{'id':this[_0x95a8('0xf')][_0x595a81[_0x95a8('0x4d')]]['id'],'destaccountcode':_0x595a81[_0x95a8('0x6a')]});}}}}}}catch(_0x4ba618){logger[_0x95a8('0x3f')]('[%s][voiceAgentReport][agentcomplete]',_0x595a81[_0x95a8('0x26')],util['inspect'](_0x4ba618,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1a')]=function(_0x3ded54){try{if(this[_0x95a8('0x22')](_0x3ded54)){logger[_0x95a8('0x37')]('[%s][voiceAgentReport][varset]\x20event:',_0x3ded54['uniqueid'],util[_0x95a8('0x29')](_0x3ded54,{'showHidden':![],'depth':null}));this['addVariable'](_0x3ded54[_0x95a8('0x26')],_[_0x95a8('0x6c')](_0x3ded54[_0x95a8('0x6d')])[0x0],_0x3ded54[_0x95a8('0x6e')]);if(this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]]){for(var _0x46599f in this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]]){if(this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x95a8('0x42')](_0x46599f)){logger[_0x95a8('0x24')](_0x95a8('0x6f'),_0x3ded54['uniqueid'],_0x46599f,_['keys'](_0x3ded54[_0x95a8('0x6d')])[0x0],_0x3ded54[_0x95a8('0x6e')]);if(_['isUndefined'](this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x46599f][_0x95a8('0x31')])){this[_0x95a8('0xc')][_0x3ded54['uniqueid']][_0x46599f][_0x95a8('0x31')]={};}this[_0x95a8('0xc')][_0x3ded54[_0x95a8('0x26')]][_0x46599f][_0x95a8('0x31')]=this['variables'][_0x3ded54[_0x95a8('0x26')]];}}}}}catch(_0x4c20f9){logger['error'](_0x95a8('0x70'),_0x3ded54['uniqueid'],util[_0x95a8('0x29')](_0x4c20f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x71')]=function(_0x702c7f,_0x52654c,_0x48004c){var _0x27e6a8=['rtpaudioqos',_0x95a8('0x72'),_0x95a8('0x73'),'rtpaudioqosjitterbridged',_0x95a8('0x74'),_0x95a8('0x75'),_0x95a8('0x76'),'rtpaudioqosrttbridged','sipcallid',_0x95a8('0x77'),_0x95a8('0x78'),_0x95a8('0x79'),_0x95a8('0x7a'),_0x95a8('0x7b'),_0x95a8('0x7c'),_0x95a8('0x7d'),_0x95a8('0x3d'),_0x95a8('0x7e'),_0x95a8('0x7f')];if(!_['isNil'](_0x52654c)&&!_[_0x95a8('0x80')](_0x27e6a8,_0x52654c)){if(_[_0x95a8('0x23')](this[_0x95a8('0x31')][_0x702c7f])){this[_0x95a8('0x31')][_0x702c7f]={};}this[_0x95a8('0x31')][_0x702c7f][_0x52654c]=_0x48004c;}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1b')]=function(_0x289798){try{if(this[_0x95a8('0x22')](_0x289798)){logger[_0x95a8('0x37')]('[%s][voiceAgentReport][hangup]\x20event:',_0x289798[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x289798,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]){for(var _0x727dd9 in this[_0x95a8('0xc')][_0x289798['uniqueid']]){if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]['hasOwnProperty'](_0x727dd9)){if(this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x53')]=='transfer'&&this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x18')]){logger[_0x95a8('0x24')](_0x95a8('0x81'),_0x289798[_0x95a8('0x26')],_0x727dd9);this['channels'][_0x289798[_0x95a8('0x26')]][_0x727dd9][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));}}}logger['debug'](_0x95a8('0x82'),_0x289798['uniqueid'],util['inspect'](_[_0x95a8('0x83')](this['channels'][_0x289798[_0x95a8('0x26')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_['values'](this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]]));delete this[_0x95a8('0xc')][_0x289798[_0x95a8('0x26')]];}if(this['variables'][_0x289798[_0x95a8('0x26')]]){delete this[_0x95a8('0x31')][_0x289798[_0x95a8('0x26')]];}}}catch(_0x322355){logger['error'](_0x95a8('0x84'),_0x289798[_0x95a8('0x26')],util['inspect'](_0x322355,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x1f')]=function(_0x437453){try{if(this[_0x95a8('0x22')](_0x437453)){logger[_0x95a8('0x37')](_0x95a8('0x85'),_0x437453[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x437453,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]){for(var _0x3385ed in this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]){if(this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x95a8('0x42')](_0x3385ed)){if(_0x437453['origtransfereruniqueid']===_0x3385ed){logger[_0x95a8('0x24')](_0x95a8('0x87'),_0x437453[_0x95a8('0x26')],this['channels'][_0x437453['transfereeuniqueid']][_0x3385ed][_0x95a8('0x3d')],_0x3385ed);var _0x4a9f38=moment();this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x18')]=!![];this['channels'][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x62')]=moment()[_0x95a8('0x2a')](_0x95a8('0x2b'));this['channels'][_0x437453[_0x95a8('0x86')]][_0x3385ed]['lastevent']=_0x95a8('0x63');this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x53')]='transfer';this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x66')]=_0x4a9f38[_0x95a8('0x88')](this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]][_0x3385ed][_0x95a8('0x44')],_0x95a8('0x89'));}}}}if(this[_0x95a8('0xc')][_0x437453['secondtransfereruniqueid']]){var _0x178c57=this['channels'][_0x437453[_0x95a8('0x8a')]];this['channels'][_0x437453[_0x95a8('0x8a')]]=this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]];this[_0x95a8('0xc')][_0x437453[_0x95a8('0x86')]]=_0x178c57;}}}catch(_0x4bdc6c){logger[_0x95a8('0x3f')](_0x95a8('0x8b'),_0x437453[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x4bdc6c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x8c')]=function(_0x21b20c){try{if(this['isNotNull'](_0x21b20c)){logger['debug'](_0x95a8('0x8d'),_0x21b20c[_0x95a8('0x26')],util['inspect'](_0x21b20c,{'showHidden':![],'depth':null}));if(this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]]){for(var _0x2e05cb in this['channels'][_0x21b20c['transfereeuniqueid']]){if(this['channels'][_0x21b20c['transfereeuniqueid']][_0x95a8('0x42')](_0x2e05cb)){if(_0x21b20c[_0x95a8('0x8e')]===_0x2e05cb){logger[_0x95a8('0x24')](_0x95a8('0x8f'),_0x21b20c[_0x95a8('0x26')],this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['membername'],_0x2e05cb);var _0xb73db1=moment();this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb][_0x95a8('0x18')]=!![];this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['agentcompleteAt']=_0xb73db1;this[_0x95a8('0xc')][_0x21b20c['transfereeuniqueid']][_0x2e05cb][_0x95a8('0x4a')]=_0x95a8('0x63');this['channels'][_0x21b20c['transfereeuniqueid']][_0x2e05cb]['reason']=_0x95a8('0x64');this[_0x95a8('0xc')][_0x21b20c[_0x95a8('0x86')]][_0x2e05cb]['talktime']=_0xb73db1[_0x95a8('0x88')](this[_0x95a8('0xc')][_0x21b20c['transfereeuniqueid']][_0x2e05cb][_0x95a8('0x44')],_0x95a8('0x89'));}}}}}}catch(_0x58ea0c){logger[_0x95a8('0x3f')](_0x95a8('0x90'),_0x21b20c[_0x95a8('0x26')],util['inspect'](_0x58ea0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x91')]=function(_0x47ac61){var _0x3a86c7='';try{if(this['isNotNull'](_0x47ac61)){logger[_0x95a8('0x37')](_0x95a8('0x92'),_0x47ac61[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x47ac61,{'showHidden':![],'depth':null}));if(_0x47ac61[_0x95a8('0x93')]){_0x3a86c7=_0x47ac61[_0x95a8('0x93')][_0x95a8('0x94')](0x0,_0x47ac61[_0x95a8('0x93')][_0x95a8('0x95')]('-'));if(this[_0x95a8('0xf')][_0x3a86c7]){logger[_0x95a8('0x24')](_0x95a8('0x96'),_0x47ac61[_0x95a8('0x26')],_0x3a86c7);this[_0x95a8('0xf')][_0x3a86c7]['onhold']=!![];}}}}catch(_0x5c063f){logger[_0x95a8('0x3f')](_0x95a8('0x97'),_0x47ac61[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x5c063f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x95a8('0x21')][_0x95a8('0x98')]=function(_0x3537ee){var _0x103818='';try{if(this['isNotNull'](_0x3537ee)){logger['debug'](_0x95a8('0x99'),_0x3537ee[_0x95a8('0x26')],util[_0x95a8('0x29')](_0x3537ee,{'showHidden':![],'depth':null}));if(_0x3537ee[_0x95a8('0x93')]){_0x103818=_0x3537ee[_0x95a8('0x93')][_0x95a8('0x94')](0x0,_0x3537ee[_0x95a8('0x93')]['lastIndexOf']('-'));if(this[_0x95a8('0xf')][_0x103818]){logger['info'](_0x95a8('0x9a'),_0x3537ee[_0x95a8('0x26')],_0x103818);this[_0x95a8('0xf')][_0x103818]['onhold']=![];}}}}catch(_0x356e92){logger[_0x95a8('0x3f')](_0x95a8('0x9b'),_0x3537ee[_0x95a8('0x26')],util['inspect'](_0x356e92,{'showHidden':![],'depth':null}));}};module[_0x95a8('0x9c')]=VoiceAgentReport; \ No newline at end of file +var _0xe663=['agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','format','called','queue','mandatoryDisposition','inbound','voice','omit','event','privilege','custom:agentcalled','calleridnum','user:%s','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','merge','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','lastevent','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','voiceChannels','channels','voiceQueues','agents','variables','agentcalled','bind'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xe663,0x12d));var _0x3e66=function(_0x32f1ba,_0x51e508){_0x32f1ba=_0x32f1ba-0x0;var _0x3dc6f4=_0xe663[_0x32f1ba];return _0x3dc6f4;};'use strict';var _=require(_0x3e66('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x3e66('0x1'));var config=require(_0x3e66('0x2'));var logger=require(_0x3e66('0x3'))(_0x3e66('0x4'));var ami=require(_0x3e66('0x5'));config[_0x3e66('0x6')]=_[_0x3e66('0x7')](config[_0x3e66('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x2417c1){this['channels']={};this[_0x3e66('0x8')]=_0x2417c1[_0x3e66('0x9')];this[_0x3e66('0xa')]=_0x2417c1[_0x3e66('0xa')];this[_0x3e66('0xb')]=_0x2417c1['agents'];this[_0x3e66('0xc')]={};ami['on'](_0x3e66('0xd'),this['syncAgentCalled'][_0x3e66('0xe')](this));ami['on'](_0x3e66('0xf'),this[_0x3e66('0x10')][_0x3e66('0xe')](this));ami['on'](_0x3e66('0x11'),this[_0x3e66('0x12')]['bind'](this));ami['on'](_0x3e66('0x13'),this[_0x3e66('0x14')]['bind'](this));ami['on'](_0x3e66('0x15'),this[_0x3e66('0x16')][_0x3e66('0xe')](this));ami['on']('varset',this[_0x3e66('0x17')][_0x3e66('0xe')](this));ami['on'](_0x3e66('0x18'),this['syncHangup'][_0x3e66('0xe')](this));ami['on'](_0x3e66('0x19'),this[_0x3e66('0x1a')][_0x3e66('0xe')](this));ami['on'](_0x3e66('0x1b'),this[_0x3e66('0x1c')][_0x3e66('0xe')](this));ami['on'](_0x3e66('0x1d'),this[_0x3e66('0x1e')]['bind'](this));ami['on']('blindtransfer',this[_0x3e66('0x1f')]['bind'](this));}VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x21')]=function(_0x4e939f,_0x45b67f,_0x25b1cf){io['to'](_0x4e939f)['emit'](_0x45b67f,_0x25b1cf);};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x22')]=function(_0x88de80){return _0x88de80!==null&&!_[_0x3e66('0x23')](_0x88de80);};VoiceAgentReport['prototype'][_0x3e66('0x24')]=function(_0x563b8f){try{if(this[_0x3e66('0x22')](_0x563b8f)){logger['info'](_0x3e66('0x25'),_0x563b8f[_0x3e66('0x26')],_0x563b8f[_0x3e66('0x27')],_0x563b8f[_0x3e66('0x28')]);logger[_0x3e66('0x29')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x563b8f[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x563b8f,{'showHidden':![],'depth':null}));if(_[_0x3e66('0x23')](this[_0x3e66('0x9')][_0x563b8f['uniqueid']])){this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]]={};}if(_[_0x3e66('0x23')](this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]][_0x563b8f['destuniqueid']])){this['channels'][_0x563b8f[_0x3e66('0x26')]][_0x563b8f[_0x3e66('0x28')]]={'agentcalledAt':moment()[_0x3e66('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x3e66('0x2c'),'mandatoryDisposition':this[_0x3e66('0xa')][_0x563b8f[_0x3e66('0x2d')]]?this['voiceQueues'][_0x563b8f[_0x3e66('0x2d')]][_0x3e66('0x2e')]||![]:![],'type':this[_0x3e66('0xa')][_0x563b8f[_0x3e66('0x2d')]]?this[_0x3e66('0xa')][_0x563b8f[_0x3e66('0x2d')]]['type']||_0x3e66('0x2f'):_0x3e66('0x2f'),'variables':this[_0x3e66('0xc')][_0x563b8f[_0x3e66('0x26')]],'motionChannel':_0x3e66('0x30')};}_['merge'](this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]][_0x563b8f[_0x3e66('0x28')]],_[_0x3e66('0x31')](_0x563b8f,[_0x3e66('0x32'),_0x3e66('0x33')]));logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x563b8f[_0x3e66('0x26')],util[_0x3e66('0x2a')](this[_0x3e66('0x9')][_0x563b8f['uniqueid']][_0x563b8f[_0x3e66('0x28')]],{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')](_0x3e66('0x34'),this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]][_0x563b8f[_0x3e66('0x28')]]);var _0x188377={'id':this[_0x3e66('0xb')][_0x563b8f['interface']]['id'],'calleridnum':this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]][_0x563b8f['destuniqueid']][_0x3e66('0x35')],'queue':this['channels'][_0x563b8f[_0x3e66('0x26')]][_0x563b8f[_0x3e66('0x28')]][_0x3e66('0x2d')],'variables':this[_0x3e66('0x9')][_0x563b8f[_0x3e66('0x26')]][_0x563b8f[_0x3e66('0x28')]]['variables']};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x563b8f[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x188377,{'showHidden':![],'depth':null}));this[_0x3e66('0x21')](util[_0x3e66('0x2b')](_0x3e66('0x36'),_0x563b8f[_0x3e66('0x27')]),'user:called',_0x188377);}}catch(_0x174965){logger['error'](_0x3e66('0x37'),_0x563b8f['uniqueid'],util[_0x3e66('0x2a')](_0x174965,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')]['syncAgentConnect']=function(_0x187298){try{if(this['isNotNull'](_0x187298)){if(this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]]){logger[_0x3e66('0x29')](_0x3e66('0x38'),_0x187298[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x187298,{'showHidden':![],'depth':null}));for(var _0x2f0a82 in this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]]){if(this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x3e66('0x39')](_0x2f0a82)){if(_0x187298[_0x3e66('0x28')]===_0x2f0a82){logger[_0x3e66('0x3a')](_0x3e66('0x3b'),_0x187298[_0x3e66('0x26')],_0x187298[_0x3e66('0x27')],_0x187298[_0x3e66('0x28')]);this[_0x3e66('0x9')][_0x187298['uniqueid']][_0x2f0a82][_0x3e66('0x3c')]=moment()[_0x3e66('0x2b')](_0x3e66('0x3d'));this[_0x3e66('0x9')][_0x187298['uniqueid']][_0x2f0a82][_0x3e66('0x3e')]=_0x187298['connectedlinename'];this['channels'][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x3f')]=_0x187298[_0x3e66('0x3f')];this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['destchannelstate']=_0x187298[_0x3e66('0x40')];this['channels'][_0x187298['uniqueid']][_0x2f0a82][_0x3e66('0x41')]=_0x187298[_0x3e66('0x41')];this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x42')]=_0x187298[_0x3e66('0x42')];this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['lastevent']=_0x3e66('0x43');if(this[_0x3e66('0x8')][this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x26')]]){var _0x31ecea=this[_0x3e66('0x8')][this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x26')]][_0x3e66('0x44')];this['channels'][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x44')]=_0x31ecea;_0x187298[_0x3e66('0x44')]=_0x31ecea;}_[_0x3e66('0x45')](this[_0x3e66('0xb')][_0x187298[_0x3e66('0x46')]],_[_0x3e66('0x47')](_0x187298,[_0x3e66('0x2d'),'destconnectedlinenum','routealias']));logger[_0x3e66('0x29')](_0x3e66('0x48'),_0x187298['uniqueid'],util['inspect'](this[_0x3e66('0x9')][_0x187298['uniqueid']][_0x187298['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x3e66('0x49'),this['channels'][_0x187298[_0x3e66('0x26')]][_0x187298['destuniqueid']]);logger['debug'](_0x3e66('0x4a'),_0x187298[_0x3e66('0x26')],util['inspect'](this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x187298['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x3e66('0x21')](util[_0x3e66('0x2b')](_0x3e66('0x36'),_0x187298[_0x3e66('0x27')]),_0x3e66('0x4b'),this['channels'][_0x187298['uniqueid']][_0x187298[_0x3e66('0x28')]]);}else if(!this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x11')]&&!this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['agentcomplete']){logger['info'](_0x3e66('0x4c'),_0x187298[_0x3e66('0x26')],this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['membername'],_0x2f0a82);this['channels'][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x11')]=!![];this[_0x3e66('0x9')][_0x187298['uniqueid']][_0x2f0a82][_0x3e66('0x4d')]=moment()['format'](_0x3e66('0x3d'));this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['answeredelsewheredestinationuniqueid']=_0x187298[_0x3e66('0x28')];this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82][_0x3e66('0x4e')]=_0x187298[_0x3e66('0x27')];this[_0x3e66('0x9')][_0x187298['uniqueid']][_0x2f0a82][_0x3e66('0x4f')]='answered_elsewhere';this['channels'][_0x187298[_0x3e66('0x26')]][_0x2f0a82]['reason']=_0x3e66('0x50');logger[_0x3e66('0x29')](_0x3e66('0x51'),_0x187298[_0x3e66('0x26')],util[_0x3e66('0x2a')](this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82],{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')](_0x3e66('0x52'),this[_0x3e66('0x9')][_0x187298[_0x3e66('0x26')]][_0x2f0a82]);}}}}}}catch(_0x234e83){logger['error'](_0x3e66('0x53'),_0x187298[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x234e83,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x12')]=function(_0x222d19){try{if(this[_0x3e66('0x22')](_0x222d19)){logger[_0x3e66('0x29')](_0x3e66('0x54'),_0x222d19[_0x3e66('0x26')],util['inspect'](_0x222d19,{'showHidden':![],'depth':null}));if(this[_0x3e66('0x9')][_0x222d19[_0x3e66('0x26')]]&&this['channels'][_0x222d19['uniqueid']][_0x222d19[_0x3e66('0x28')]]){logger[_0x3e66('0x3a')](_0x3e66('0x55'),_0x222d19['uniqueid'],_0x222d19['membername'],_0x222d19['destuniqueid']);this['channels'][_0x222d19[_0x3e66('0x26')]][_0x222d19[_0x3e66('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x222d19[_0x3e66('0x26')]][_0x222d19['destuniqueid']][_0x3e66('0x4d')]=moment()[_0x3e66('0x2b')](_0x3e66('0x3d'));this['channels'][_0x222d19[_0x3e66('0x26')]][_0x222d19[_0x3e66('0x28')]][_0x3e66('0x4f')]=_0x3e66('0x56');this[_0x3e66('0x9')][_0x222d19['uniqueid']][_0x222d19['destuniqueid']]['reason']=_0x3e66('0x56');logger[_0x3e66('0x29')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x222d19['uniqueid'],util[_0x3e66('0x2a')](this[_0x3e66('0x9')][_0x222d19['uniqueid']][_0x222d19[_0x3e66('0x28')]],{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')](_0x3e66('0x57'),this['channels'][_0x222d19['uniqueid']][_0x222d19[_0x3e66('0x28')]]);}}}catch(_0x1a8f57){logger[_0x3e66('0x58')](_0x3e66('0x59'),_0x222d19[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x1a8f57,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')]['syncQueueCallerAbandon']=function(_0x3c4c12){try{if(this[_0x3e66('0x22')](_0x3c4c12)){logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x3c4c12['uniqueid'],util[_0x3e66('0x2a')](_0x3c4c12,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c4c12[_0x3e66('0x26')]]){for(var _0x4e109b in this['channels'][_0x3c4c12[_0x3e66('0x26')]]){if(this['channels'][_0x3c4c12['uniqueid']][_0x3e66('0x39')](_0x4e109b)&&!this[_0x3e66('0x9')][_0x3c4c12['uniqueid']][_0x4e109b][_0x3e66('0x11')]&&!this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b][_0x3e66('0x15')]){logger['info'](_0x3e66('0x5a'),_0x3c4c12['uniqueid'],this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b][_0x3e66('0x27')],_0x4e109b);this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b][_0x3e66('0x11')]=!![];this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b][_0x3e66('0x4d')]=moment()['format'](_0x3e66('0x3d'));this[_0x3e66('0x9')][_0x3c4c12['uniqueid']][_0x4e109b][_0x3e66('0x4f')]='abandoned';this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b][_0x3e66('0x5b')]=_0x3e66('0x5c');logger[_0x3e66('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x3c4c12[_0x3e66('0x26')],util[_0x3e66('0x2a')](this[_0x3e66('0x9')][_0x3c4c12[_0x3e66('0x26')]][_0x4e109b],{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')](_0x3e66('0x5d'),this[_0x3e66('0x9')][_0x3c4c12['uniqueid']][_0x4e109b]);}}}}}catch(_0x4b2410){logger['error'](_0x3e66('0x5e'),_0x3c4c12[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x4b2410,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x16')]=function(_0x15959a){try{if(this[_0x3e66('0x22')](_0x15959a)){logger['debug'](_0x3e66('0x5f'),_0x15959a[_0x3e66('0x26')],util['inspect'](_0x15959a,{'showHidden':![],'depth':null}));if(this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]]){for(var _0x135d63 in this['channels'][_0x15959a[_0x3e66('0x26')]]){if(this[_0x3e66('0x9')][_0x15959a['uniqueid']][_0x3e66('0x39')](_0x135d63)){if(this[_0x3e66('0x9')][_0x15959a['uniqueid']][_0x135d63][_0x3e66('0x3c')]&&!this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]][_0x135d63][_0x3e66('0x15')]){logger['info'](_0x3e66('0x60'),_0x15959a['uniqueid'],this[_0x3e66('0x9')][_0x15959a['uniqueid']][_0x135d63][_0x3e66('0x27')],_0x135d63);this[_0x3e66('0x9')][_0x15959a['uniqueid']][_0x135d63][_0x3e66('0x15')]=!![];this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]][_0x135d63][_0x3e66('0x61')]=moment()[_0x3e66('0x2b')](_0x3e66('0x3d'));this['channels'][_0x15959a[_0x3e66('0x26')]][_0x135d63][_0x3e66('0x4f')]='complete';this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]][_0x135d63][_0x3e66('0x5b')]=_0x15959a['reason']==_0x3e66('0x62')?_0x3e66('0x63'):_0x15959a[_0x3e66('0x5b')];this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]][_0x135d63][_0x3e66('0x64')]=_0x15959a[_0x3e66('0x64')];if(this[_0x3e66('0xa')][_0x15959a[_0x3e66('0x2d')]]&&this[_0x3e66('0xa')][_0x15959a[_0x3e66('0x2d')]][_0x3e66('0x65')]){this[_0x3e66('0x9')][_0x15959a['uniqueid']][_0x135d63]['acwtime']=this[_0x3e66('0xa')][_0x15959a[_0x3e66('0x2d')]][_0x3e66('0x66')];this[_0x3e66('0x9')][_0x15959a[_0x3e66('0x26')]][_0x135d63]['agentacw']=!![];}this[_0x3e66('0xb')][_0x15959a[_0x3e66('0x46')]]=_['omit'](this[_0x3e66('0xb')][_0x15959a[_0x3e66('0x46')]],['queue',_0x3e66('0x67')]);logger['debug'](_0x3e66('0x68'),_0x15959a[_0x3e66('0x26')],util[_0x3e66('0x2a')](this['channels'][_0x15959a[_0x3e66('0x26')]][_0x135d63],{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')]('custom:agentcomplete',this['channels'][_0x15959a[_0x3e66('0x26')]][_0x135d63]);logger['debug'](_0x3e66('0x69'),_0x15959a[_0x3e66('0x26')],util[_0x3e66('0x2a')]({'id':this['agents'][_0x15959a[_0x3e66('0x46')]]['id'],'destaccountcode':_0x15959a[_0x3e66('0x6a')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x3e66('0x2b')](_0x3e66('0x36'),_0x15959a[_0x3e66('0x27')]),'user:agentcomplete',{'id':this[_0x3e66('0xb')][_0x15959a['interface']]['id'],'destaccountcode':_0x15959a[_0x3e66('0x6a')]});}}}}}}catch(_0x47b80c){logger[_0x3e66('0x58')](_0x3e66('0x6b'),_0x15959a['uniqueid'],util[_0x3e66('0x2a')](_0x47b80c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3e66('0x17')]=function(_0x559c4b){try{if(this[_0x3e66('0x22')](_0x559c4b)){logger[_0x3e66('0x29')](_0x3e66('0x6c'),_0x559c4b[_0x3e66('0x26')],util['inspect'](_0x559c4b,{'showHidden':![],'depth':null}));this[_0x3e66('0x6d')](_0x559c4b[_0x3e66('0x26')],_[_0x3e66('0x6e')](_0x559c4b[_0x3e66('0x6f')])[0x0],_0x559c4b[_0x3e66('0x70')]);if(this['channels'][_0x559c4b[_0x3e66('0x26')]]){for(var _0x197911 in this[_0x3e66('0x9')][_0x559c4b[_0x3e66('0x26')]]){if(this['channels'][_0x559c4b[_0x3e66('0x26')]][_0x3e66('0x39')](_0x197911)){logger['info'](_0x3e66('0x71'),_0x559c4b[_0x3e66('0x26')],_0x197911,_['keys'](_0x559c4b[_0x3e66('0x6f')])[0x0],_0x559c4b[_0x3e66('0x70')]);if(_[_0x3e66('0x23')](this[_0x3e66('0x9')][_0x559c4b[_0x3e66('0x26')]][_0x197911][_0x3e66('0xc')])){this[_0x3e66('0x9')][_0x559c4b[_0x3e66('0x26')]][_0x197911][_0x3e66('0xc')]={};}this[_0x3e66('0x9')][_0x559c4b[_0x3e66('0x26')]][_0x197911][_0x3e66('0xc')]=this[_0x3e66('0xc')][_0x559c4b[_0x3e66('0x26')]];}}}}}catch(_0x1008ae){logger[_0x3e66('0x58')](_0x3e66('0x72'),_0x559c4b[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x1008ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x6d')]=function(_0x11ead8,_0x17dd7f,_0x1a602c){var _0x197696=['rtpaudioqos',_0x3e66('0x73'),'rtpaudioqosjitter',_0x3e66('0x74'),'rtpaudioqosloss',_0x3e66('0x75'),_0x3e66('0x76'),_0x3e66('0x77'),_0x3e66('0x78'),_0x3e66('0x79'),_0x3e66('0x7a'),_0x3e66('0x7b'),'membercalls',_0x3e66('0x7c'),_0x3e66('0x7d'),_0x3e66('0x7e'),_0x3e66('0x27'),_0x3e66('0x7f'),_0x3e66('0x80')];if(!_[_0x3e66('0x81')](_0x17dd7f)&&!_[_0x3e66('0x82')](_0x197696,_0x17dd7f)){if(_[_0x3e66('0x23')](this[_0x3e66('0xc')][_0x11ead8])){this[_0x3e66('0xc')][_0x11ead8]={};}this['variables'][_0x11ead8][_0x17dd7f]=_0x1a602c;}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x83')]=function(_0x3794fe){try{if(this[_0x3e66('0x22')](_0x3794fe)){logger['debug'](_0x3e66('0x84'),_0x3794fe[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x3794fe,{'showHidden':![],'depth':null}));if(this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]]){for(var _0x4c51cb in this[_0x3e66('0x9')][_0x3794fe['uniqueid']]){if(this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]][_0x3e66('0x39')](_0x4c51cb)){if(this[_0x3e66('0x9')][_0x3794fe['uniqueid']][_0x4c51cb][_0x3e66('0x5b')]==_0x3e66('0x62')&&this['channels'][_0x3794fe[_0x3e66('0x26')]][_0x4c51cb]['agentcomplete']){logger[_0x3e66('0x3a')](_0x3e66('0x85'),_0x3794fe['uniqueid'],_0x4c51cb);this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]][_0x4c51cb][_0x3e66('0x61')]=moment()[_0x3e66('0x2b')](_0x3e66('0x3d'));}}}logger[_0x3e66('0x29')](_0x3e66('0x86'),_0x3794fe[_0x3e66('0x26')],util[_0x3e66('0x2a')](_[_0x3e66('0x87')](this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x3e66('0x21')](_0x3e66('0x88'),_[_0x3e66('0x87')](this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]]));delete this[_0x3e66('0x9')][_0x3794fe[_0x3e66('0x26')]];}if(this[_0x3e66('0xc')][_0x3794fe[_0x3e66('0x26')]]){delete this['variables'][_0x3794fe[_0x3e66('0x26')]];}}}catch(_0x1d5012){logger[_0x3e66('0x58')](_0x3e66('0x89'),_0x3794fe[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x1d5012,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x1e')]=function(_0x47611e){try{if(this[_0x3e66('0x22')](_0x47611e)){logger[_0x3e66('0x29')](_0x3e66('0x8a'),_0x47611e[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x47611e,{'showHidden':![],'depth':null}));if(this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]]){for(var _0x58459c in this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]]){if(this[_0x3e66('0x9')][_0x47611e['transfereeuniqueid']]['hasOwnProperty'](_0x58459c)){if(_0x47611e[_0x3e66('0x8c')]===_0x58459c){logger[_0x3e66('0x3a')](_0x3e66('0x8d'),_0x47611e['uniqueid'],this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]][_0x58459c][_0x3e66('0x27')],_0x58459c);var _0x4f3d59=moment();this[_0x3e66('0x9')][_0x47611e['transfereeuniqueid']][_0x58459c][_0x3e66('0x15')]=!![];this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]][_0x58459c][_0x3e66('0x61')]=moment()[_0x3e66('0x2b')](_0x3e66('0x3d'));this[_0x3e66('0x9')][_0x47611e['transfereeuniqueid']][_0x58459c][_0x3e66('0x4f')]='complete';this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]][_0x58459c][_0x3e66('0x5b')]='transfer';this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]][_0x58459c][_0x3e66('0x64')]=_0x4f3d59['diff'](this['channels'][_0x47611e['transfereeuniqueid']][_0x58459c][_0x3e66('0x3c')],_0x3e66('0x8e'));}}}}if(this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8f')]]){var _0x3328d8=this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8f')]];this[_0x3e66('0x9')][_0x47611e['secondtransfereruniqueid']]=this['channels'][_0x47611e[_0x3e66('0x8b')]];this[_0x3e66('0x9')][_0x47611e[_0x3e66('0x8b')]]=_0x3328d8;}}}catch(_0x5b798d){logger[_0x3e66('0x58')]('[%s][voiceAgentReport][attendedtransfer]',_0x47611e['uniqueid'],util[_0x3e66('0x2a')](_0x5b798d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x1f')]=function(_0x855e75){try{if(this[_0x3e66('0x22')](_0x855e75)){logger[_0x3e66('0x29')](_0x3e66('0x90'),_0x855e75[_0x3e66('0x26')],util['inspect'](_0x855e75,{'showHidden':![],'depth':null}));if(this[_0x3e66('0x9')][_0x855e75[_0x3e66('0x8b')]]){for(var _0x5d72b9 in this[_0x3e66('0x9')][_0x855e75[_0x3e66('0x8b')]]){if(this['channels'][_0x855e75[_0x3e66('0x8b')]]['hasOwnProperty'](_0x5d72b9)){if(_0x855e75[_0x3e66('0x91')]===_0x5d72b9){logger[_0x3e66('0x3a')](_0x3e66('0x92'),_0x855e75['uniqueid'],this[_0x3e66('0x9')][_0x855e75[_0x3e66('0x8b')]][_0x5d72b9][_0x3e66('0x27')],_0x5d72b9);var _0x8880ba=moment();this[_0x3e66('0x9')][_0x855e75['transfereeuniqueid']][_0x5d72b9]['agentcomplete']=!![];this[_0x3e66('0x9')][_0x855e75[_0x3e66('0x8b')]][_0x5d72b9][_0x3e66('0x61')]=_0x8880ba;this[_0x3e66('0x9')][_0x855e75['transfereeuniqueid']][_0x5d72b9][_0x3e66('0x4f')]='complete';this[_0x3e66('0x9')][_0x855e75['transfereeuniqueid']][_0x5d72b9][_0x3e66('0x5b')]=_0x3e66('0x62');this[_0x3e66('0x9')][_0x855e75[_0x3e66('0x8b')]][_0x5d72b9]['talktime']=_0x8880ba[_0x3e66('0x93')](this[_0x3e66('0x9')][_0x855e75['transfereeuniqueid']][_0x5d72b9][_0x3e66('0x3c')],_0x3e66('0x8e'));}}}}}}catch(_0x54ce07){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x855e75[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x54ce07,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x1a')]=function(_0x20f376){var _0x1debdb='';try{if(this[_0x3e66('0x22')](_0x20f376)){logger['debug'](_0x3e66('0x94'),_0x20f376['uniqueid'],util['inspect'](_0x20f376,{'showHidden':![],'depth':null}));if(_0x20f376[_0x3e66('0x95')]){_0x1debdb=_0x20f376[_0x3e66('0x95')][_0x3e66('0x96')](0x0,_0x20f376[_0x3e66('0x95')][_0x3e66('0x97')]('-'));if(this[_0x3e66('0xb')][_0x1debdb]){logger[_0x3e66('0x3a')](_0x3e66('0x98'),_0x20f376[_0x3e66('0x26')],_0x1debdb);this[_0x3e66('0xb')][_0x1debdb][_0x3e66('0x99')]=!![];}}}}catch(_0x20722f){logger[_0x3e66('0x58')](_0x3e66('0x9a'),_0x20f376[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x20722f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3e66('0x20')][_0x3e66('0x1c')]=function(_0x1a5aa8){var _0xff061d='';try{if(this['isNotNull'](_0x1a5aa8)){logger[_0x3e66('0x29')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1a5aa8[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0x1a5aa8,{'showHidden':![],'depth':null}));if(_0x1a5aa8[_0x3e66('0x95')]){_0xff061d=_0x1a5aa8['channel'][_0x3e66('0x96')](0x0,_0x1a5aa8[_0x3e66('0x95')][_0x3e66('0x97')]('-'));if(this[_0x3e66('0xb')][_0xff061d]){logger['info'](_0x3e66('0x9b'),_0x1a5aa8[_0x3e66('0x26')],_0xff061d);this[_0x3e66('0xb')][_0xff061d][_0x3e66('0x99')]=![];}}}}catch(_0xdb961d){logger[_0x3e66('0x58')](_0x3e66('0x9c'),_0x1a5aa8[_0x3e66('0x26')],util[_0x3e66('0x2a')](_0xdb961d,{'showHidden':![],'depth':null}));}};module[_0x3e66('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 1e48f8f..5c4e74c 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5db8=['voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','keys','context','from-sip','channel','exten','xcally-motion-preview','split','connectedlinenum','format','user:%s','name','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','starttime','disposition','toNumber','pick','destconnectedlinenum','accountcode','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','appdata','applicationdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','cdr(','match','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','routealias','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.wav49','.WAV','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','transferType','then','undefined','isEmpty','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','ATTENDED','origtransferercalleridnum','transferconnectedlinenum','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','set','queue','playback'];(function(_0x3f3abb,_0x42610a){var _0x201d8c=function(_0x2ccb41){while(--_0x2ccb41){_0x3f3abb['push'](_0x3f3abb['shift']());}};_0x201d8c(++_0x42610a);}(_0x5db8,0xbb));var _0x85db=function(_0x15c5b8,_0x3b670f){_0x15c5b8=_0x15c5b8-0x0;var _0xd45fe6=_0x5db8[_0x15c5b8];return _0xd45fe6;};'use strict';var _=require(_0x85db('0x0'));var moment=require(_0x85db('0x1'));var util=require(_0x85db('0x2'));var path=require('path');var Redis=require(_0x85db('0x3'));var config=require(_0x85db('0x4'));var logger=require(_0x85db('0x5'))('ami');var ami=require('../ami');var Channel=require(_0x85db('0x6'));var RpcSetting=require(_0x85db('0x7'));var applications=[_0x85db('0x8'),_0x85db('0x9'),'agi','dial',_0x85db('0xa'),_0x85db('0xb')];var dispositions=[_0x85db('0xc'),_0x85db('0xd'),'FAILED',_0x85db('0xc'),'NO\x20ANSWER',_0x85db('0xc'),_0x85db('0xe'),_0x85db('0xf'),_0x85db('0xd'),'FAILED','FAILED'];config['redis']=_[_0x85db('0x10')](config[_0x85db('0x11')],{'host':'localhost','port':0x18eb});var io=require(_0x85db('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x437f7a){this[_0x85db('0x13')]=_0x437f7a[_0x85db('0x13')];this[_0x85db('0x14')]=_0x437f7a[_0x85db('0x14')];this[_0x85db('0x15')]={};ami['on'](_0x85db('0x16'),this[_0x85db('0x17')][_0x85db('0x18')](this));ami['on'](_0x85db('0x19'),this[_0x85db('0x17')][_0x85db('0x18')](this));ami['on'](_0x85db('0x1a'),this['syncNewChannel'][_0x85db('0x18')](this));ami['on'](_0x85db('0x1b'),this[_0x85db('0x1c')][_0x85db('0x18')](this));ami['on'](_0x85db('0x1d'),this[_0x85db('0x1e')][_0x85db('0x18')](this));ami['on']('hangup',this[_0x85db('0x1f')][_0x85db('0x18')](this));ami['on'](_0x85db('0x20'),this[_0x85db('0x21')][_0x85db('0x18')](this));ami['on'](_0x85db('0x22'),this[_0x85db('0x23')][_0x85db('0x18')](this));ami['on'](_0x85db('0x24'),this[_0x85db('0x25')]['bind'](this));ami['on'](_0x85db('0x26'),this[_0x85db('0x27')][_0x85db('0x18')](this));ami['on'](_0x85db('0x28'),this[_0x85db('0x29')][_0x85db('0x18')](this));try{logger[_0x85db('0x2a')](_0x85db('0x2b'));ami['actionCoreShowChannels']();}catch(_0xfffea2){logger[_0x85db('0x2c')](_0x85db('0x2d'),util[_0x85db('0x2e')](_0xfffea2,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x85db('0x2f')][_0x85db('0x30')]=function(_0x51c948){return _0x51c948!==null&&!_[_0x85db('0x31')](_0x51c948);};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x32')]=function(_0x54ba03,_0x5467ad,_0x50ea52){io['to'](_0x54ba03)[_0x85db('0x32')](_0x5467ad,_0x50ea52);};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x21')]=function(_0x51b748){try{if(this[_0x85db('0x30')](_0x51b748)){logger[_0x85db('0x2a')](_0x85db('0x33'),_0x51b748['uniqueid'],_0x51b748['calleridname'],_0x51b748[_0x85db('0x34')]);logger[_0x85db('0x35')](_0x85db('0x36'),_0x51b748[_0x85db('0x37')],util[_0x85db('0x2e')](_0x51b748,{'showHidden':![],'depth':null}));if(_0x51b748[_0x85db('0x37')]===_0x51b748[_0x85db('0x38')]){if(!_[_0x85db('0x31')](this[_0x85db('0x13')][_0x51b748[_0x85db('0x37')]])){_['merge'](this['channels'][_0x51b748[_0x85db('0x37')]],_['pick'](_0x51b748,_[_0x85db('0x39')](this[_0x85db('0x13')][_0x51b748['uniqueid']])));}}if(_0x51b748[_0x85db('0x3a')]===_0x85db('0x3b')){if(this[_0x85db('0x14')][_0x51b748[_0x85db('0x3c')]['split']('-')[0x0]]){if(_0x51b748[_0x85db('0x3d')]==_0x85db('0x3e')){this[_0x85db('0x14')][_0x51b748[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['destconnectedlinenum']=_0x51b748[_0x85db('0x40')];this[_0x85db('0x32')](util[_0x85db('0x41')](_0x85db('0x42'),this['agents'][_0x51b748[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x43')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x51b748[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x51b748[_0x85db('0x40')]});}}}}}catch(_0x2e2879){logger[_0x85db('0x2c')](_0x85db('0x44'),_0x51b748[_0x85db('0x37')],util[_0x85db('0x2e')](_0x2e2879,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x45')]=function(_0x158ac8){try{if(this[_0x85db('0x30')](_0x158ac8)){logger[_0x85db('0x35')](_0x85db('0x46'),_0x158ac8['uniqueid'],util[_0x85db('0x2e')](_0x158ac8,{'showHidden':![],'depth':null}));if(this[_0x85db('0x13')][_0x158ac8[_0x85db('0x37')]])return;if(_0x158ac8[_0x85db('0x3c')]==='OutgoingSpoolFailed')return;if(_0x158ac8[_0x85db('0x37')]!==_0x158ac8[_0x85db('0x38')]&&!this[_0x85db('0x15')][_0x158ac8[_0x85db('0x38')]])return;logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x158ac8['uniqueid'],_0x158ac8['context'],_0x158ac8['exten']);this[_0x85db('0x13')][_0x158ac8[_0x85db('0x37')]]=new Channel();this[_0x85db('0x13')][_0x158ac8[_0x85db('0x37')]][_0x85db('0x47')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x85db('0x13')][_0x158ac8['uniqueid']][_0x85db('0x48')]=dispositions[_[_0x85db('0x49')](_0x158ac8['channelstate'])];_['merge'](this[_0x85db('0x13')][_0x158ac8[_0x85db('0x37')]],_[_0x85db('0x4a')](_0x158ac8,_[_0x85db('0x39')](this[_0x85db('0x13')][_0x158ac8['uniqueid']])));if(_0x158ac8[_0x85db('0x3a')]===_0x85db('0x3b')){if(this[_0x85db('0x14')][_0x158ac8['channel']['split']('-')[0x0]]){if(_['isUndefined'](this[_0x85db('0x14')][_0x158ac8[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x158ac8[_0x85db('0x3c')]['split']('-')[0x0]][_0x85db('0x4b')]=_0x158ac8[_0x85db('0x3d')];logger[_0x85db('0x35')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x158ac8[_0x85db('0x37')],util[_0x85db('0x2e')]({'id':this[_0x85db('0x14')][_0x158ac8[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x85db('0x14')][_0x158ac8[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x4c')],'destconnectedlinenum':_0x158ac8['exten']},{'showHidden':![],'depth':null}));this[_0x85db('0x32')](util[_0x85db('0x41')](_0x85db('0x42'),this[_0x85db('0x14')][_0x158ac8[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['name']),_0x85db('0x4d'),{'id':this[_0x85db('0x14')][_0x158ac8[_0x85db('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x158ac8[_0x85db('0x3c')]['split']('-')[0x0]][_0x85db('0x4c')],'destconnectedlinenum':_0x158ac8[_0x85db('0x3d')]});}}}}}catch(_0x24afcd){logger[_0x85db('0x2c')](_0x85db('0x4e'),_0x158ac8['uniqueid'],util['inspect'](_0x24afcd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x17')]=function(_0x8d01f){try{if(this[_0x85db('0x30')](_0x8d01f)){logger[_0x85db('0x35')](_0x85db('0x4f'),_0x8d01f[_0x85db('0x37')],util[_0x85db('0x2e')](_0x8d01f,{'showHidden':![],'depth':null}));if(_0x8d01f[_0x85db('0x3c')]===_0x85db('0x50')||_0x8d01f['exten']==='h')return;if(_0x8d01f[_0x85db('0x37')]===_0x8d01f[_0x85db('0x38')]||this['blindTransfers'][_0x8d01f['linkedid']]){_0x8d01f[_0x85db('0x51')]=_0x8d01f[_0x85db('0x51')]['toLowerCase']();_0x8d01f['applicationdata']=_0x8d01f[_0x85db('0x52')]||_0x8d01f[_0x85db('0x53')];if(_0x8d01f['appdata']&&!_0x8d01f[_0x85db('0x52')][_0x85db('0x54')](_0x85db('0x55'))&&_0x8d01f[_0x85db('0x51')]!==_0x85db('0x9')){_0x8d01f[_0x85db('0x53')]=_0x8d01f[_0x85db('0x53')][_0x85db('0x56')]();}logger[_0x85db('0x2a')](_0x85db('0x57'),_0x8d01f['uniqueid'],_0x8d01f['application'],_0x8d01f[_0x85db('0x53')]);if(_[_0x85db('0x31')](this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]])){this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]]=new Channel();this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]][_0x85db('0x47')]=_0x8d01f[_0x85db('0x58')]?moment()[_0x85db('0x59')](moment[_0x85db('0x58')](_0x8d01f[_0x85db('0x58')])[_0x85db('0x5a')](),'seconds')[_0x85db('0x41')](_0x85db('0x5b')):moment()['format'](_0x85db('0x5b'));this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]][_0x85db('0x48')]=_0x85db('0xc');}_[_0x85db('0x5c')](this[_0x85db('0x13')][_0x8d01f['uniqueid']],_[_0x85db('0x4a')](_0x8d01f,_[_0x85db('0x39')](this['channels'][_0x8d01f['uniqueid']])));if(_[_0x85db('0x5d')](applications,_0x8d01f['application'])){this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]][_0x85db('0x5e')]=_0x8d01f[_0x85db('0x51')];this['channels'][_0x8d01f[_0x85db('0x37')]]['lastdata']=_0x8d01f['applicationdata'];if(_0x8d01f['application']===_0x85db('0x8')&&_[_0x85db('0x54')](_0x8d01f['applicationdata'][_0x85db('0x56')](),_0x85db('0x5f'))){var _0x58a658=_0x8d01f[_0x85db('0x53')][_0x85db('0x3f')]('=');var _0x5d71aa=_0x58a658[0x0][_0x85db('0x56')]()[_0x85db('0x60')](/cdr\((.*)\)/);if(_0x5d71aa){if(_0x5d71aa[0x1]===_0x85db('0x61')&&!_['isNil'](this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]][_0x5d71aa[0x1]]))return;this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]][_0x5d71aa[0x1]]=_0x58a658[0x1];}}else if(_0x8d01f[_0x85db('0x51')]===_0x85db('0x9')){this[_0x85db('0x13')][_0x8d01f[_0x85db('0x37')]]['queue']=_0x8d01f['applicationdata']['split'](',')[0x0];}}}}}catch(_0x4e5e2a){logger[_0x85db('0x2c')](_0x85db('0x62'),_0x8d01f[_0x85db('0x37')],util[_0x85db('0x2e')](_0x4e5e2a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x1c')]=function(_0x5636fa){try{if(this[_0x85db('0x30')](_0x5636fa)){logger[_0x85db('0x2a')](_0x85db('0x63'),_0x5636fa[_0x85db('0x37')],_0x5636fa['linkedid'],_0x5636fa[_0x85db('0x64')],_0x5636fa[_0x85db('0x34')]);logger[_0x85db('0x35')](_0x85db('0x65'),_0x5636fa[_0x85db('0x37')],util[_0x85db('0x2e')](_0x5636fa,{'showHidden':![],'depth':null}));if(_0x5636fa[_0x85db('0x66')]!=='6')return;if(_0x5636fa[_0x85db('0x37')]!==_0x5636fa[_0x85db('0x38')]){var _0x22559c=moment();if(this['channels'][_0x5636fa[_0x85db('0x38')]]){if(!this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x67')]){this[_0x85db('0x13')][_0x5636fa['linkedid']][_0x85db('0x67')]=!![];this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x68')]=_0x22559c[_0x85db('0x41')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x47')]){this['channels'][_0x5636fa[_0x85db('0x38')]][_0x85db('0x69')]=_0x22559c[_0x85db('0x6a')](this['channels'][_0x5636fa[_0x85db('0x38')]][_0x85db('0x47')],'seconds');}}this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x38')]=_0x5636fa[_0x85db('0x37')];if(_0x5636fa[_0x85db('0x34')]!==_0x85db('0x3e')){this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x40')]=_0x5636fa[_0x85db('0x34')];}this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]][_0x85db('0x6b')]=_0x5636fa[_0x85db('0x64')];this[_0x85db('0x13')][_0x5636fa['linkedid']][_0x85db('0x6c')]=_0x5636fa[_0x85db('0x3c')];this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]]['disposition']=dispositions[_['toNumber'](_0x5636fa[_0x85db('0x66')])];if(this['agents'][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]){this[_0x85db('0x13')][_0x5636fa['linkedid']][_0x85db('0x6d')]=this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'];this['channels'][_0x5636fa[_0x85db('0x38')]]['membername']=this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x43')];}}if(this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]]){if(!this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]][_0x85db('0x67')]){this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]][_0x85db('0x67')]=!![];this[_0x85db('0x13')][_0x5636fa['uniqueid']][_0x85db('0x68')]=_0x22559c['format'](_0x85db('0x5b'));if(this[_0x85db('0x13')][_0x5636fa['uniqueid']][_0x85db('0x47')]){this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]]['holdtime']=_0x22559c[_0x85db('0x6a')](this['channels'][_0x5636fa[_0x85db('0x37')]]['starttime'],_0x85db('0x5a'));}}if(_0x5636fa[_0x85db('0x34')]!=='xcally-motion-preview'){this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]][_0x85db('0x40')]=_0x5636fa[_0x85db('0x34')];}this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]]['connectedlinename']=_0x5636fa[_0x85db('0x64')];this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]]['destinationchannel']=_0x5636fa[_0x85db('0x3c')];this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]][_0x85db('0x48')]=dispositions[_[_0x85db('0x49')](_0x5636fa[_0x85db('0x66')])];}}else{if(this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]]){if(this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]){this['channels'][_0x5636fa[_0x85db('0x37')]][_0x85db('0x6d')]=this[_0x85db('0x14')][_0x5636fa['channel'][_0x85db('0x3f')]('-')[0x0]]['id'];this['channels'][_0x5636fa[_0x85db('0x37')]]['membername']=this[_0x85db('0x14')][_0x5636fa['channel'][_0x85db('0x3f')]('-')[0x0]]['name'];}}}if(_0x5636fa[_0x85db('0x3a')]===_0x85db('0x3b')){if(this['agents'][_0x5636fa[_0x85db('0x3c')]['split']('-')[0x0]]){this['agents'][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x4b')]=_0x5636fa[_0x85db('0x3d')];var _0x19a23d,_0x2aa231;if(this['channels'][_0x5636fa[_0x85db('0x37')]]){_0x19a23d=this[_0x85db('0x13')][_0x5636fa[_0x85db('0x37')]][_0x85db('0x6e')];_0x2aa231=this[_0x85db('0x13')][_0x5636fa['uniqueid']][_0x85db('0x9')];}else if(this['channels'][_0x5636fa[_0x85db('0x38')]]){_0x19a23d=this[_0x85db('0x13')][_0x5636fa[_0x85db('0x38')]]['routealias'];_0x2aa231=this['channels'][_0x5636fa[_0x85db('0x38')]]['queue'];}logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x5636fa[_0x85db('0x37')],util[_0x85db('0x2e')]({'id':this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')]['split']('-')[0x0]][_0x85db('0x4c')],'destconnectedlinenum':_0x5636fa[_0x85db('0x3d')],'routealias':_0x19a23d,'queue':_0x2aa231||undefined},{'showHidden':![],'depth':null}));this[_0x85db('0x32')](util[_0x85db('0x41')](_0x85db('0x42'),this[_0x85db('0x14')][_0x5636fa['channel'][_0x85db('0x3f')]('-')[0x0]]['name']),'user:agentconnect',{'id':this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0x85db('0x14')][_0x5636fa[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x4c')],'destconnectedlinenum':_0x5636fa[_0x85db('0x3d')],'routealias':_0x19a23d,'queue':_0x2aa231||undefined});}}}}catch(_0x5e56e8){logger[_0x85db('0x2c')](_0x85db('0x6f'),_0x5636fa[_0x85db('0x37')],util[_0x85db('0x2e')](_0x5e56e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85db('0x2f')]['syncMixMonitorFilename']=function(_0xf6fbf0,_0x392253){try{if(this[_0x85db('0x13')][_0xf6fbf0]){logger[_0x85db('0x2a')](_0x85db('0x70'),_0xf6fbf0,_0x392253);this['channels'][_0xf6fbf0][_0x85db('0x71')]=!![];if(_[_0x85db('0x72')](_0x392253,'.wav49')){_0x392253=_0x392253[_0x85db('0x73')](_0x85db('0x74'),_0x85db('0x75'));}this[_0x85db('0x13')][_0xf6fbf0]['monitorFilename']=_0x392253;var _0xe269e7=_['find'](this[_0x85db('0x13')][_0xf6fbf0][_0x85db('0x76')],{'filename':_0x392253});if(_[_0x85db('0x77')](_0xe269e7)){this['channels'][_0xf6fbf0][_0x85db('0x76')][_0x85db('0x78')]({'filename':_0x392253,'createdAt':moment()[_0x85db('0x41')](_0x85db('0x5b')),'mixmonitorid':'','status':'rec'});}}}catch(_0x261b54){logger['error'](_0x85db('0x79'),_0xf6fbf0,util[_0x85db('0x2e')](_0x261b54,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x15b1fb){try{if(this['isNotNull'](_0x15b1fb)){logger[_0x85db('0x35')](_0x85db('0x7a'),_0x15b1fb['uniqueid'],util[_0x85db('0x2e')](_0x15b1fb,{'showHidden':![],'depth':null}));if(this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]]&&_0x15b1fb['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x15b1fb[_0x85db('0x7b')])){if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x7c')])){logger[_0x85db('0x2a')](_0x85db('0x7d'),_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x7f')](_0x15b1fb[_0x85db('0x37')],_0x15b1fb['value']);}else if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x80')])){logger[_0x85db('0x2a')](_0x85db('0x81'),_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb['uniqueid']][_0x85db('0x34')]=_0x15b1fb[_0x85db('0x7e')];}else if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x82')])){logger[_0x85db('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')]);this['channels'][_0x15b1fb['uniqueid']][_0x85db('0x83')]=_0x15b1fb[_0x85db('0x7e')];}else if(this[_0x85db('0x30')](_0x15b1fb['variable'][_0x85db('0x84')])){logger['info'](_0x85db('0x85'),_0x15b1fb['uniqueid'],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]][_0x85db('0x61')]=_0x15b1fb[_0x85db('0x7e')];}else if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x86')])){logger[_0x85db('0x2a')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')][_0x85db('0x3f')](',')[0x0]);this['channels'][_0x15b1fb['uniqueid']][_0x85db('0x9')]=_0x15b1fb[_0x85db('0x7e')][_0x85db('0x3f')](',')[0x0];}else if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')]['xmd-originatecalleridnum'])){logger[_0x85db('0x2a')](_0x85db('0x87'),_0x15b1fb['uniqueid'],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]][_0x85db('0x88')]=_0x15b1fb[_0x85db('0x7e')];}else if(this[_0x85db('0x30')](_0x15b1fb['variable']['xmd-destination'])){logger[_0x85db('0x2a')](_0x85db('0x89'),_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]][_0x85db('0x8a')]=_0x15b1fb[_0x85db('0x7e')];}else if(this['isNotNull'](_0x15b1fb[_0x85db('0x7b')]['xmd-callerid-preview'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x15b1fb['uniqueid'],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]]['calleridpreview']=_0x15b1fb['value'];}else if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x8b')])){logger['info'](_0x85db('0x8c'),_0x15b1fb[_0x85db('0x37')],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb['uniqueid']][_0x85db('0x9')]=_0x15b1fb[_0x85db('0x7e')];}else if(this['isNotNull'](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x8d')])){logger[_0x85db('0x2a')](_0x85db('0x8e'),_0x15b1fb['uniqueid'],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb[_0x85db('0x37')]][_0x85db('0x8f')]=_0x15b1fb['value'];}}}else if(this['isNotNull'](_0x15b1fb['variable'][_0x85db('0x7c')])){if(_0x15b1fb[_0x85db('0x7e')]){var _0x6494cc=path[_0x85db('0x90')](_0x15b1fb[_0x85db('0x7e')])[_0x85db('0x43')];logger[_0x85db('0x2a')](_0x85db('0x7d'),_0x6494cc,_0x15b1fb[_0x85db('0x7e')]);this['syncMixMonitorFilename'](_0x6494cc,_0x15b1fb[_0x85db('0x7e')]);}}else if(this['channels'][_0x15b1fb[_0x85db('0x38')]]){if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')])){if(this[_0x85db('0x30')](_0x15b1fb[_0x85db('0x7b')][_0x85db('0x8d')])){logger[_0x85db('0x2a')](_0x85db('0x8e'),_0x15b1fb[_0x85db('0x38')],_0x15b1fb[_0x85db('0x7e')]);this[_0x85db('0x13')][_0x15b1fb['linkedid']]['sipcalllinkedid']=_0x15b1fb[_0x85db('0x7e')];}}}}}catch(_0x10c29f){logger[_0x85db('0x2c')]('[%s][voiceCallReport][varset]',_0x15b1fb[_0x85db('0x37')],util[_0x85db('0x2e')](_0x10c29f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x85db('0x2f')][_0x85db('0x1f')]=function(_0x23207d){try{if(this[_0x85db('0x30')](_0x23207d)){logger[_0x85db('0x35')](_0x85db('0x91'),_0x23207d[_0x85db('0x37')],util['inspect'](_0x23207d,{'showHidden':![],'depth':null}));if(this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]]){if(this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x38')]]){this[_0x85db('0x13')][this['blindTransfers'][_0x23207d[_0x85db('0x38')]][_0x85db('0x38')]][_0x85db('0x37')]=_0x23207d[_0x85db('0x37')];this['channels'][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x38')]][_0x85db('0x67')]=this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x67')];this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]]['linkedid']][_0x85db('0x68')]=this[_0x85db('0x13')][_0x23207d['uniqueid']][_0x85db('0x68')];this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x38')]][_0x85db('0x6c')]=this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d['linkedid']][_0x85db('0x38')]][_0x85db('0x3c')];this['channels'][this[_0x85db('0x15')][_0x23207d['linkedid']]['linkedid']][_0x85db('0x48')]=this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x48')];this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]]=this[_0x85db('0x13')][this['blindTransfers'][_0x23207d[_0x85db('0x38')]]['linkedid']];delete this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x38')]];}else if(this[_0x85db('0x13')][this['blindTransfers'][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]]){this['channels'][this[_0x85db('0x15')][_0x23207d['linkedid']]['uniqueid']][_0x85db('0x37')]=[this[_0x85db('0x13')][this['blindTransfers'][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]][_0x85db('0x38')],this['channels'][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]]['linkedid']=this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]][_0x85db('0x37')]][0x0];this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]][_0x85db('0x67')]=this[_0x85db('0x13')][_0x23207d['uniqueid']][_0x85db('0x67')];this['channels'][this[_0x85db('0x15')][_0x23207d['linkedid']][_0x85db('0x37')]][_0x85db('0x68')]=this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x68')];this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]]['uniqueid']][_0x85db('0x6c')]=this['channels'][this[_0x85db('0x15')][_0x23207d['linkedid']][_0x85db('0x37')]]['channel'];this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]]['disposition']=this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x48')];this[_0x85db('0x13')][_0x23207d['uniqueid']]=this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]];delete this[_0x85db('0x13')][this[_0x85db('0x15')][_0x23207d[_0x85db('0x38')]][_0x85db('0x37')]];}}if(this['channels'][_0x23207d[_0x85db('0x37')]]){logger['info'](_0x85db('0x92'),_0x23207d[_0x85db('0x37')],_0x23207d['cause-txt']);var _0x1e444e=moment();this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x93')]=_0x1e444e[_0x85db('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]]['duration']=_0x1e444e[_0x85db('0x6a')](this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x47')],_0x85db('0x5a'));if(this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x67')]){this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x94')]=_0x1e444e[_0x85db('0x6a')](this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]][_0x85db('0x68')],_0x85db('0x5a'));this[_0x85db('0x13')][_0x23207d['uniqueid']]['holdtime']=this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]]['duration']-this[_0x85db('0x13')][_0x23207d[_0x85db('0x37')]]['billableseconds'];}if(_0x23207d[_0x85db('0x3a')]===_0x85db('0x3b')){if(this['agents'][_0x23207d['channel'][_0x85db('0x3f')]('-')[0x0]]){this[_0x85db('0x14')][_0x23207d['channel']['split']('-')[0x0]]=_[_0x85db('0x95')](this[_0x85db('0x14')][_0x23207d[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]],[_0x85db('0x4b')]);logger[_0x85db('0x35')](_0x85db('0x96'),_0x23207d[_0x85db('0x37')],util[_0x85db('0x2e')]({'id':this[_0x85db('0x14')][_0x23207d[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x23207d['channel']['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x85db('0x32')](util[_0x85db('0x41')](_0x85db('0x42'),this[_0x85db('0x14')][_0x23207d[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]][_0x85db('0x43')]),_0x85db('0x97'),{'id':this[_0x85db('0x14')][_0x23207d[_0x85db('0x3c')][_0x85db('0x3f')]('-')[0x0]]['id'],'destaccountcode':this[_0x85db('0x14')][_0x23207d['channel']['split']('-')[0x0]][_0x85db('0x4c')]});for(var _0x51618f=0x0;_0x51618f0x0?_0x30b199:0x0;this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]][_0x4495('0x32')]=this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]][_0x4495('0x32')]>_[_0x4495('0x6f')](_0x4f5796[_0x4495('0x70')])?_['toNumber'](_0x4f5796['loggedin']):this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]]['talking'];this[_0x4495('0x71')](this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]],'queuesummary');}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x4495('0x41')](this['voiceQueues'][_0x4f5796[_0x4495('0x6a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4495('0x72'),this[_0x4495('0x12')][_0x4f5796[_0x4495('0x6a')]]);}}}catch(_0x5a09ca){logger['error'](_0x4495('0x68'),util[_0x4495('0x41')](_0x5a09ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1a')]=function(_0x56884a){logger[_0x4495('0x61')](_0x4495('0x73'),util[_0x4495('0x41')](_0x56884a,{'showHidden':![],'depth':null}));ami[_0x4495('0x47')]('custom:queuesummarycomplete',{});this[_0x4495('0x13')]=!![];};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1b')]=function(_0x58e739){try{if(this[_0x4495('0x69')](_0x58e739)){logger[_0x4495('0x61')]('[%s][voiceQueueReport][queuecallerjoin]',_0x58e739[_0x4495('0x4a')],util[_0x4495('0x41')](_0x58e739,{'showHidden':![],'depth':null}));if(_[_0x4495('0x63')](this[_0x4495('0xe')][_0x58e739[_0x4495('0x4a')]]))this['queueReports'][_0x58e739['uniqueid']]=[];if(_[_0x4495('0x63')](this['channels'][_0x58e739['uniqueid']]))this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]={};var _0x4e3b9c=new QueueReport();_0x4e3b9c[_0x4495('0x4d')]=_0x58e739[_0x4495('0x6a')];_0x4e3b9c[_0x4495('0x5b')]=this[_0x4495('0x12')][_0x4e3b9c[_0x4495('0x4d')]]&&this[_0x4495('0x12')][_0x4e3b9c['name']][_0x4495('0x5b')]?this['voiceQueues'][_0x4e3b9c[_0x4495('0x4d')]][_0x4495('0x5b')]||_0x4495('0x74'):_0x4495('0x74');_0x4e3b9c[_0x4495('0x6a')]=_0x58e739[_0x4495('0x6a')];_0x4e3b9c[_0x4495('0x75')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x4e3b9c[_0x4495('0x77')]=_0x58e739[_0x4495('0x77')];_0x4e3b9c[_0x4495('0x78')]=_0x58e739['count'];_0x4e3b9c[_0x4495('0x4a')]=_0x58e739['uniqueid'];_0x4e3b9c[_0x4495('0x79')]=this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]['routealias'];logger[_0x4495('0x6c')](_0x4495('0x7a'),_0x4e3b9c[_0x4495('0x4d')],_0x4e3b9c[_0x4495('0x5b')]);_[_0x4495('0x7b')](_0x4e3b9c,_[_0x4495('0x7c')](_0x58e739,_[_0x4495('0x7d')](_0x4e3b9c)));this[_0x4495('0xe')][_0x58e739[_0x4495('0x4a')]]['push'](_0x4e3b9c);this[_0x4495('0x10')][_0x58e739[_0x4495('0x4a')]]=_0x4e3b9c;this['emitVoiceQueueChannelSave'](_0x4e3b9c,_0x4495('0x7e'));}}catch(_0x3cda72){logger[_0x4495('0x3f')](_0x4495('0x7f'),_0x58e739['uniqueid'],util[_0x4495('0x41')](_0x3cda72,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x4495('0x1d')]=function(_0x2f5c7d){try{if(this[_0x4495('0x69')](_0x2f5c7d)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x2f5c7d[_0x4495('0x4a')],util[_0x4495('0x41')](_0x2f5c7d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f5c7d['uniqueid']]){var _0x225e9e=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x2f5c7d['uniqueid']]);_0x225e9e['queuecallercomplete']=![];_0x225e9e[_0x4495('0x81')]=null;_0x225e9e[_0x4495('0x82')]=_0x2f5c7d[_0x4495('0x82')];_0x225e9e[_0x4495('0x83')]=_0x2f5c7d[_0x4495('0x83')];_0x225e9e[_0x4495('0x1c')]=!![];_0x225e9e[_0x4495('0x84')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x225e9e[_0x4495('0x85')]=_0x4495('0x86');_0x225e9e[_0x4495('0x87')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x225e9e[_0x4495('0x4d')],_0x225e9e[_0x4495('0x5b')]);this[_0x4495('0x10')][_0x2f5c7d['uniqueid']]=_0x225e9e;this[_0x4495('0x45')](_0x225e9e,'queuecallerabandon');}}}catch(_0x535878){logger[_0x4495('0x3f')](_0x4495('0x88'),_0x2f5c7d['uniqueid'],util[_0x4495('0x41')](_0x535878,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x1f')]=function(_0x57fa7c){try{if(this[_0x4495('0x69')](_0x57fa7c)){logger[_0x4495('0x61')]('[%s][voiceQueueReport][queuecallerleave]',_0x57fa7c[_0x4495('0x4a')],util['inspect'](_0x57fa7c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x57fa7c[_0x4495('0x4a')]]){var _0x3516b0=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x57fa7c['uniqueid']]);_0x3516b0[_0x4495('0x89')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x3516b0[_0x4495('0x8a')]=_0x57fa7c[_0x4495('0x8a')];_0x3516b0[_0x4495('0x8b')]=_0x57fa7c[_0x4495('0x8b')];logger[_0x4495('0x6c')](_0x4495('0x8c'),_0x3516b0[_0x4495('0x4d')],_0x3516b0[_0x4495('0x5b')],_0x57fa7c[_0x4495('0x8a')],_0x57fa7c[_0x4495('0x8b')]);this[_0x4495('0x10')][_0x57fa7c['uniqueid']]=_0x3516b0;this[_0x4495('0x48')](_0x3516b0,_0x4495('0x1e'));}}}catch(_0x47d584){logger[_0x4495('0x3f')](_0x4495('0x8d'),_0x57fa7c[_0x4495('0x4a')],util[_0x4495('0x41')](_0x47d584,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x23')]=function(_0x225468){try{if(this[_0x4495('0x69')](_0x225468)){logger['debug'](_0x4495('0x8e'),_0x225468['uniqueid'],util['inspect'](_0x225468,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x225468[_0x4495('0x4a')]]){var _0x3cbec1=_[_0x4495('0x80')](this['queueReports'][_0x225468[_0x4495('0x4a')]]);_0x3cbec1[_0x4495('0x8f')]=!![];_0x3cbec1[_0x4495('0x85')]=_0x4495('0x90');logger[_0x4495('0x6c')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3cbec1[_0x4495('0x4d')],_0x3cbec1[_0x4495('0x5b')]);}}}catch(_0x325cd5){logger[_0x4495('0x3f')](_0x4495('0x8e'),_0x225468[_0x4495('0x4a')],util[_0x4495('0x41')](_0x325cd5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')]['syncAgentComplete']=function(_0x1e5574){try{if(this[_0x4495('0x69')](_0x1e5574)){logger['debug'](_0x4495('0x91'),_0x1e5574[_0x4495('0x4a')],util[_0x4495('0x41')](_0x1e5574,{'showHidden':![],'depth':null}));if(this[_0x4495('0xe')][_0x1e5574[_0x4495('0x4a')]]){var _0xe78fdb=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x1e5574['uniqueid']]);_0xe78fdb[_0x4495('0x1c')]=![];_0xe78fdb['queuecallerabandonAt']=null;_0xe78fdb[_0x4495('0x92')]=!![];_0xe78fdb[_0x4495('0x87')]=_0x1e5574[_0x4495('0x93')];_0xe78fdb[_0x4495('0x82')]=_0x1e5574[_0x4495('0x82')];_0xe78fdb[_0x4495('0x8f')]=!![];_0xe78fdb['queuecallerexit']=![];_0xe78fdb[_0x4495('0x94')]=null;if(!_0xe78fdb[_0x4495('0x95')]){if(_0x1e5574[_0x4495('0x96')]=='transfer'){_0xe78fdb[_0x4495('0x85')]=_0x4495('0x97');logger[_0x4495('0x6c')](_0x4495('0x98'),_0xe78fdb[_0x4495('0x4d')],_0xe78fdb[_0x4495('0x5b')]);}else{if(_[_0x4495('0x99')](_0x1e5574[_0x4495('0x3c')][_0x4495('0x9a')](),_0x4495('0x9b'))){if(this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]){var _0x2391e4=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]);_0x2391e4[_0x4495('0x8f')]=![];_0x2391e4['queuecallerexit']=!![];_0x2391e4[_0x4495('0x94')]=moment(_0xe78fdb[_0x4495('0x75')])[_0x4495('0x9d')](_0x1e5574[_0x4495('0x82')],_0x4495('0x9e'))[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2391e4[_0x4495('0x85')]=_0x4495('0x9f');_0x2391e4['transfer']=!![];_0x2391e4[_0x4495('0xa0')]=_0x4495('0xa1');_0x2391e4[_0x4495('0xa2')]=_0x1e5574['destexten'];_0x2391e4['transferuniqueid']=_0x1e5574[_0x4495('0x4a')];logger['info'](_0x4495('0xa3'),_0x2391e4[_0x4495('0x4d')],_0x2391e4[_0x4495('0x5b')]);var _0x1a1121=this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]];this[_0x4495('0xe')][_0x1e5574[_0x4495('0x9c')]]=this[_0x4495('0xe')][_0x1e5574[_0x4495('0x4a')]];this['queueReports'][_0x1e5574[_0x4495('0x4a')]]=_0x1a1121;}}else{_0xe78fdb[_0x4495('0x85')]=_0x4495('0xa4')+_0x1e5574[_0x4495('0x96')]['toUpperCase']();logger[_0x4495('0x6c')](_0x4495('0xa5'),_0xe78fdb[_0x4495('0x4d')],_0xe78fdb[_0x4495('0x5b')],_0xe78fdb[_0x4495('0x85')]);}}}this[_0x4495('0x10')][_0x1e5574[_0x4495('0x4a')]]=_0xe78fdb;this[_0x4495('0x45')](_0xe78fdb,_0x4495('0x20'));}}}catch(_0x54a6c8){logger['error'](_0x4495('0x91'),_0x1e5574[_0x4495('0x4a')],util[_0x4495('0x41')](_0x54a6c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0x25')]=function(_0x13a397){try{if(this[_0x4495('0x69')](_0x13a397)){logger[_0x4495('0x61')](_0x4495('0xa6'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x13a397,{'showHidden':![],'depth':null}));this[_0x4495('0xa7')](_0x13a397[_0x4495('0x4a')],_[_0x4495('0x7d')](_0x13a397[_0x4495('0xa8')])[0x0],_0x13a397['value']);if(this[_0x4495('0xe')][_0x13a397[_0x4495('0x4a')]]){var _0x1ab80b=_[_0x4495('0x80')](this[_0x4495('0xe')][_0x13a397[_0x4495('0x4a')]]);if(_0x1ab80b){if(this['isNotNull'](_0x13a397[_0x4495('0xa8')])&&this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')][_0x4495('0xa9')])){switch(_0x13a397['value']){case _0x4495('0xaa'):_0x1ab80b[_0x4495('0xab')]=![];_0x1ab80b['queuecallerexitAt']=null;break;case _0x4495('0xac'):_0x1ab80b['lastevent']='timeout';_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b[_0x4495('0x94')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ab80b[_0x4495('0x89')]=moment()[_0x4495('0x4b')](_0x4495('0x76'));logger['debug'](_0x4495('0xad'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x1ab80b,{'showHidden':![],'depth':null}));ami[_0x4495('0x47')](_0x4495('0xae'),_0x1ab80b);break;default:_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b['queuecallerexitAt']=moment()[_0x4495('0x4b')](_0x4495('0x76'));_0x1ab80b['queuecallerleaveAt']=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1ab80b[_0x4495('0x1c')]=![];_0x1ab80b['queuecallerabandonAt']=null;_0x1ab80b[_0x4495('0x85')]=_0x13a397[_0x4495('0xaf')];this[_0x4495('0x10')][_0x13a397[_0x4495('0x4a')]]=_0x1ab80b;this[_0x4495('0x45')](_0x1ab80b,_0x4495('0x24'));}else if(this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')])&&this[_0x4495('0x69')](_0x13a397[_0x4495('0xa8')][_0x4495('0xb0')])){if(!_0x1ab80b[_0x4495('0x1c')]){_0x1ab80b[_0x4495('0xab')]=!![];_0x1ab80b[_0x4495('0x94')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ab80b[_0x4495('0x85')]=_0x4495('0xb1');_0x1ab80b[_0x4495('0x89')]=moment()[_0x4495('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4495('0x10')][_0x13a397[_0x4495('0x4a')]]=_0x1ab80b;}}logger[_0x4495('0x6c')](_0x4495('0xb2'),_0x13a397['uniqueid'],_0x1ab80b[_0x4495('0x4d')],_0x1ab80b[_0x4495('0x5b')],_[_0x4495('0x7d')](_0x13a397[_0x4495('0xa8')])[0x0],_0x13a397['value']);_0x1ab80b[_0x4495('0x15')]=this[_0x4495('0x15')][_0x13a397[_0x4495('0x4a')]];}}}}catch(_0x245015){logger[_0x4495('0x3f')](_0x4495('0xa6'),_0x13a397[_0x4495('0x4a')],util[_0x4495('0x41')](_0x245015,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0xa7')]=function(_0x1e1ea9,_0x37f299,_0x18d360){var _0x16aa3d=[_0x4495('0xb3'),_0x4495('0xb4'),_0x4495('0xb5'),_0x4495('0xb6'),'rtpaudioqosloss',_0x4495('0xb7'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x4495('0xb8'),_0x4495('0xb9'),_0x4495('0xba'),_0x4495('0xbb'),_0x4495('0xbc'),_0x4495('0xbd'),_0x4495('0xbe'),_0x4495('0xbf'),_0x4495('0x93'),_0x4495('0xc0'),_0x4495('0xc1')];if(!_[_0x4495('0xc2')](_0x37f299)&&!_[_0x4495('0xc3')](_0x16aa3d,_0x37f299)){if(_[_0x4495('0x63')](this[_0x4495('0x15')][_0x1e1ea9])){this[_0x4495('0x15')][_0x1e1ea9]={};}this[_0x4495('0x15')][_0x1e1ea9][_0x37f299]=_0x18d360;}};VoiceQueueReport[_0x4495('0xa')][_0x4495('0xc4')]=function(_0x1b660f,_0x9c5b53,_0x1ec652){var _0x12ea81={};for(var _0x5b573e=0x0;_0x5b573e0x0?_0xdb15e7:0x0;this['voiceQueues'][_0x5eea96[_0xf44a('0x69')]][_0xf44a('0x2f')]=this[_0xf44a('0x15')][_0x5eea96[_0xf44a('0x69')]][_0xf44a('0x2f')]>_[_0xf44a('0x6e')](_0x5eea96['loggedin'])?_[_0xf44a('0x6e')](_0x5eea96[_0xf44a('0x6f')]):this[_0xf44a('0x15')][_0x5eea96[_0xf44a('0x69')]]['talking'];this[_0xf44a('0x70')](this['voiceQueues'][_0x5eea96[_0xf44a('0x69')]],_0xf44a('0x19'));}logger['debug'](_0xf44a('0x71'),util[_0xf44a('0x39')](this[_0xf44a('0x15')][_0x5eea96[_0xf44a('0x69')]],{'showHidden':![],'depth':null}));ami[_0xf44a('0x40')](_0xf44a('0x72'),this[_0xf44a('0x15')][_0x5eea96[_0xf44a('0x69')]]);}}}catch(_0xbd2612){logger[_0xf44a('0x38')](_0xf44a('0x66'),util[_0xf44a('0x39')](_0xbd2612,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf44a('0x73')]=function(_0x2b218c){logger[_0xf44a('0x42')](_0xf44a('0x74'),util[_0xf44a('0x39')](_0x2b218c,{'showHidden':![],'depth':null}));ami[_0xf44a('0x40')](_0xf44a('0x75'),{});this[_0xf44a('0x16')]=!![];};VoiceQueueReport[_0xf44a('0xe')][_0xf44a('0x1b')]=function(_0x3302d4){try{if(this[_0xf44a('0x60')](_0x3302d4)){logger[_0xf44a('0x42')](_0xf44a('0x76'),_0x3302d4[_0xf44a('0x45')],util['inspect'](_0x3302d4,{'showHidden':![],'depth':null}));if(_[_0xf44a('0x61')](this[_0xf44a('0x3a')][_0x3302d4['uniqueid']]))this['queueReports'][_0x3302d4[_0xf44a('0x45')]]=[];if(_[_0xf44a('0x61')](this[_0xf44a('0x13')][_0x3302d4[_0xf44a('0x45')]]))this[_0xf44a('0x13')][_0x3302d4['uniqueid']]={};var _0x517854=new QueueReport();_0x517854['name']=_0x3302d4[_0xf44a('0x69')];_0x517854['type']=this[_0xf44a('0x15')][_0x517854[_0xf44a('0x4e')]]&&this[_0xf44a('0x15')][_0x517854[_0xf44a('0x4e')]][_0xf44a('0x55')]?this[_0xf44a('0x15')][_0x517854[_0xf44a('0x4e')]][_0xf44a('0x55')]||_0xf44a('0x4d'):_0xf44a('0x4d');_0x517854[_0xf44a('0x69')]=_0x3302d4[_0xf44a('0x69')];_0x517854[_0xf44a('0x77')]=moment()[_0xf44a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x517854[_0xf44a('0x78')]=_0x3302d4[_0xf44a('0x78')];_0x517854['count']=_0x3302d4[_0xf44a('0x79')];_0x517854[_0xf44a('0x45')]=_0x3302d4['uniqueid'];_0x517854[_0xf44a('0x7a')]=this[_0xf44a('0x13')][_0x3302d4[_0xf44a('0x45')]][_0xf44a('0x7a')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x517854[_0xf44a('0x4e')],_0x517854['type']);_['merge'](_0x517854,_[_0xf44a('0x7b')](_0x3302d4,_[_0xf44a('0x7c')](_0x517854)));this[_0xf44a('0x3a')][_0x3302d4[_0xf44a('0x45')]]['push'](_0x517854);this[_0xf44a('0x13')][_0x3302d4[_0xf44a('0x45')]]=_0x517854;this[_0xf44a('0x41')](_0x517854,'queuecallerjoin');}}catch(_0x55faf8){logger[_0xf44a('0x38')](_0xf44a('0x76'),_0x3302d4[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x55faf8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf44a('0xe')][_0xf44a('0x1c')]=function(_0x199b02){try{if(this['isNotNull'](_0x199b02)){logger['debug'](_0xf44a('0x7d'),_0x199b02[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x199b02,{'showHidden':![],'depth':null}));if(this[_0xf44a('0x3a')][_0x199b02[_0xf44a('0x45')]]){var _0x27e89f=_[_0xf44a('0x7e')](this['queueReports'][_0x199b02[_0xf44a('0x45')]]);_0x27e89f[_0xf44a('0x7f')]=![];_0x27e89f[_0xf44a('0x80')]=null;_0x27e89f['holdtime']=_0x199b02['holdtime'];_0x27e89f[_0xf44a('0x81')]=_0x199b02[_0xf44a('0x81')];_0x27e89f[_0xf44a('0x82')]=!![];_0x27e89f[_0xf44a('0x83')]=moment()[_0xf44a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x27e89f['queuecallerexitreason']=_0xf44a('0x84');_0x27e89f[_0xf44a('0x85')]=null;logger[_0xf44a('0x6a')](_0xf44a('0x86'),_0x27e89f[_0xf44a('0x4e')],_0x27e89f[_0xf44a('0x55')]);this[_0xf44a('0x13')][_0x199b02[_0xf44a('0x45')]]=_0x27e89f;this[_0xf44a('0x3e')](_0x27e89f,_0xf44a('0x82'));}}}catch(_0x57644d){logger[_0xf44a('0x38')]('[%s][voiceQueueReport][queuecallerabandon]',_0x199b02[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x57644d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf44a('0xe')][_0xf44a('0x1e')]=function(_0x5031bd){try{if(this[_0xf44a('0x60')](_0x5031bd)){logger['debug'](_0xf44a('0x87'),_0x5031bd[_0xf44a('0x45')],util['inspect'](_0x5031bd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5031bd[_0xf44a('0x45')]]){var _0x4de5f4=_['last'](this[_0xf44a('0x3a')][_0x5031bd[_0xf44a('0x45')]]);_0x4de5f4[_0xf44a('0x88')]=moment()[_0xf44a('0x4b')](_0xf44a('0x89'));_0x4de5f4[_0xf44a('0x8a')]=_0x5031bd[_0xf44a('0x8a')];_0x4de5f4[_0xf44a('0x8b')]=_0x5031bd[_0xf44a('0x8b')];logger[_0xf44a('0x6a')](_0xf44a('0x8c'),_0x4de5f4[_0xf44a('0x4e')],_0x4de5f4[_0xf44a('0x55')],_0x5031bd['connectedlinenum'],_0x5031bd['connectedlinename']);this['channels'][_0x5031bd[_0xf44a('0x45')]]=_0x4de5f4;this[_0xf44a('0x41')](_0x4de5f4,_0xf44a('0x1d'));}}}catch(_0x762cc2){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x5031bd[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x762cc2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf44a('0xe')][_0xf44a('0x21')]=function(_0x425bd1){try{if(this[_0xf44a('0x60')](_0x425bd1)){logger[_0xf44a('0x42')](_0xf44a('0x8d'),_0x425bd1[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x425bd1,{'showHidden':![],'depth':null}));if(this[_0xf44a('0x3a')][_0x425bd1[_0xf44a('0x45')]]){var _0x31d90b=_[_0xf44a('0x7e')](this[_0xf44a('0x3a')][_0x425bd1[_0xf44a('0x45')]]);_0x31d90b['queuecallercomplete']=!![];_0x31d90b[_0xf44a('0x4a')]=_0xf44a('0x8e');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x31d90b[_0xf44a('0x4e')],_0x31d90b[_0xf44a('0x55')]);}}}catch(_0x5e62ea){logger[_0xf44a('0x38')](_0xf44a('0x8d'),_0x425bd1['uniqueid'],util[_0xf44a('0x39')](_0x5e62ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf44a('0xe')][_0xf44a('0x8f')]=function(_0x31fe1a){try{if(this['isNotNull'](_0x31fe1a)){logger[_0xf44a('0x42')](_0xf44a('0x90'),_0x31fe1a[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x31fe1a,{'showHidden':![],'depth':null}));if(this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x45')]]){var _0x575c2e=_['last'](this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x45')]]);_0x575c2e[_0xf44a('0x82')]=![];_0x575c2e['queuecallerabandonAt']=null;_0x575c2e[_0xf44a('0x91')]=!![];_0x575c2e['lastAssignedTo']=_0x31fe1a[_0xf44a('0x92')];_0x575c2e['holdtime']=_0x31fe1a[_0xf44a('0x93')];_0x575c2e[_0xf44a('0x7f')]=!![];_0x575c2e[_0xf44a('0x94')]=![];_0x575c2e[_0xf44a('0x95')]=null;if(!_0x575c2e[_0xf44a('0x96')]){if(_0x31fe1a['reason']=='transfer'){_0x575c2e[_0xf44a('0x4a')]=_0xf44a('0x97');logger[_0xf44a('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x575c2e['name'],_0x575c2e[_0xf44a('0x55')]);}else{if(_[_0xf44a('0x98')](_0x31fe1a['channel'][_0xf44a('0x99')](),'local/')){if(this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x9a')]]){var _0x5ad8bb=_['last'](this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x9a')]]);_0x5ad8bb['queuecallercomplete']=![];_0x5ad8bb[_0xf44a('0x94')]=!![];_0x5ad8bb['queuecallerexitAt']=moment(_0x575c2e[_0xf44a('0x77')])['add'](_0x31fe1a[_0xf44a('0x93')],_0xf44a('0x9b'))['format'](_0xf44a('0x89'));_0x5ad8bb[_0xf44a('0x4a')]='FORWARDTRANSFER';_0x5ad8bb[_0xf44a('0x96')]=!![];_0x5ad8bb[_0xf44a('0x9c')]=_0xf44a('0x9d');_0x5ad8bb[_0xf44a('0x9e')]=_0x31fe1a[_0xf44a('0x9f')];_0x5ad8bb['transferuniqueid']=_0x31fe1a[_0xf44a('0x45')];logger[_0xf44a('0x6a')](_0xf44a('0xa0'),_0x5ad8bb[_0xf44a('0x4e')],_0x5ad8bb[_0xf44a('0x55')]);var _0x5df784=this[_0xf44a('0x3a')][_0x31fe1a['linkedid']];this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x9a')]]=this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x45')]];this[_0xf44a('0x3a')][_0x31fe1a[_0xf44a('0x45')]]=_0x5df784;}}else{_0x575c2e[_0xf44a('0x4a')]=_0xf44a('0xa1')+_0x31fe1a[_0xf44a('0xa2')][_0xf44a('0xa3')]();logger[_0xf44a('0x6a')](_0xf44a('0xa4'),_0x575c2e[_0xf44a('0x4e')],_0x575c2e['type'],_0x575c2e[_0xf44a('0x4a')]);}}}this['channels'][_0x31fe1a[_0xf44a('0x45')]]=_0x575c2e;this[_0xf44a('0x3e')](_0x575c2e,_0xf44a('0x1f'));}}}catch(_0x2a673e){logger[_0xf44a('0x38')](_0xf44a('0x90'),_0x31fe1a['uniqueid'],util[_0xf44a('0x39')](_0x2a673e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf44a('0xa5')]=function(_0x23c947){try{if(this[_0xf44a('0x60')](_0x23c947)){logger[_0xf44a('0x42')](_0xf44a('0xa6'),_0x23c947['uniqueid'],util[_0xf44a('0x39')](_0x23c947,{'showHidden':![],'depth':null}));this['addVariable'](_0x23c947['uniqueid'],_[_0xf44a('0x7c')](_0x23c947['variable'])[0x0],_0x23c947[_0xf44a('0xa7')]);if(this[_0xf44a('0x3a')][_0x23c947[_0xf44a('0x45')]]){var _0x488e9c=_['last'](this[_0xf44a('0x3a')][_0x23c947[_0xf44a('0x45')]]);if(_0x488e9c){if(this[_0xf44a('0x60')](_0x23c947[_0xf44a('0xa8')])&&this[_0xf44a('0x60')](_0x23c947[_0xf44a('0xa8')][_0xf44a('0xa9')])){switch(_0x23c947[_0xf44a('0xa7')]){case _0xf44a('0xaa'):_0x488e9c['queuecallerexit']=![];_0x488e9c[_0xf44a('0x95')]=null;break;case _0xf44a('0xab'):_0x488e9c['lastevent']=_0xf44a('0xac');_0x488e9c[_0xf44a('0x94')]=!![];_0x488e9c[_0xf44a('0x95')]=moment()[_0xf44a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x488e9c[_0xf44a('0x88')]=moment()[_0xf44a('0x4b')](_0xf44a('0x89'));logger[_0xf44a('0x42')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x23c947[_0xf44a('0x45')],util[_0xf44a('0x39')](_0x488e9c,{'showHidden':![],'depth':null}));ami[_0xf44a('0x40')](_0xf44a('0xad'),_0x488e9c);break;default:_0x488e9c['queuecallerexit']=!![];_0x488e9c[_0xf44a('0x95')]=moment()[_0xf44a('0x4b')](_0xf44a('0x89'));_0x488e9c[_0xf44a('0x88')]=moment()['format'](_0xf44a('0x89'));}_0x488e9c['queuecallerabandon']=![];_0x488e9c['queuecallerabandonAt']=null;_0x488e9c['queuecallerexitreason']=_0x23c947[_0xf44a('0xa7')];this[_0xf44a('0x13')][_0x23c947['uniqueid']]=_0x488e9c;this[_0xf44a('0x3e')](_0x488e9c,'varset');}else if(this[_0xf44a('0x60')](_0x23c947['variable'])&&this[_0xf44a('0x60')](_0x23c947[_0xf44a('0xa8')][_0xf44a('0xae')])){if(!_0x488e9c[_0xf44a('0x82')]){_0x488e9c['queuecallerexit']=!![];_0x488e9c[_0xf44a('0x95')]=moment()[_0xf44a('0x4b')](_0xf44a('0x89'));_0x488e9c[_0xf44a('0x4a')]=_0xf44a('0xaf');_0x488e9c[_0xf44a('0x88')]=moment()[_0xf44a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x23c947['uniqueid']]=_0x488e9c;}}logger[_0xf44a('0x6a')](_0xf44a('0xb0'),_0x23c947[_0xf44a('0x45')],_0x488e9c['name'],_0x488e9c[_0xf44a('0x55')],_['keys'](_0x23c947[_0xf44a('0xa8')])[0x0],_0x23c947['value']);_0x488e9c['variables']=this[_0xf44a('0x18')][_0x23c947['uniqueid']];}}}}catch(_0x52351b){logger[_0xf44a('0x38')](_0xf44a('0xa6'),_0x23c947['uniqueid'],util[_0xf44a('0x39')](_0x52351b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xf44a('0xb1')]=function(_0x26e895,_0x323bd9,_0x443f95){var _0x3bfb11=[_0xf44a('0xb2'),_0xf44a('0xb3'),_0xf44a('0xb4'),_0xf44a('0xb5'),_0xf44a('0xb6'),_0xf44a('0xb7'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xf44a('0xb8'),_0xf44a('0xb9'),_0xf44a('0xba'),'bridgepvtcallid',_0xf44a('0xbb'),'memberdynamic',_0xf44a('0xbc'),_0xf44a('0xbd'),_0xf44a('0x92'),_0xf44a('0xbe'),_0xf44a('0xbf')];if(!_[_0xf44a('0xc0')](_0x323bd9)&&!_['includes'](_0x3bfb11,_0x323bd9)){if(_[_0xf44a('0x61')](this[_0xf44a('0x18')][_0x26e895])){this['variables'][_0x26e895]={};}this['variables'][_0x26e895][_0x323bd9]=_0x443f95;}};VoiceQueueReport[_0xf44a('0xe')]['handleHangup']=function(_0x56c9df,_0x57b6df,_0x2c8c3e){var _0x3fcfa6={};for(var _0x4af3a4=0x0;_0x4af3a4=0x0?moment(_0x4a3096['endtime'])[_0xf4df('0xd')](_0x4a3096[_0xf4df('0x16')],_0xf4df('0xe')):null,'data1':'outbound','data2':_0x4a3096[_0xf4df('0x13')],'data3':_0x4a3096[_0xf4df('0x10')],'data4':_0x4a3096[_0xf4df('0x18')]||null,'role':_0xf4df('0x12'),'internal':_0x4a3096[_0xf4df('0x13')]?_[_0xf4df('0x19')](_0x4a3096[_0xf4df('0x13')]):undefined,'uniqueid':_0x4a3096[_0xf4df('0x1a')]},'log':_0xf4df('0x6')});}; \ No newline at end of file +var _0x993f=['diff','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','isNil','format','SIP/%s','lastAssignedTo','interface','TALKING'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x993f,0xd1));var _0xf993=function(_0x21dcad,_0x1cfe74){_0x21dcad=_0x21dcad-0x0;var _0x5d85ad=_0x993f[_0x21dcad];return _0x5d85ad;};'use strict';var moment=require(_0xf993('0x0'));var _=require(_0xf993('0x1'));var util=require(_0xf993('0x2'));var client=require(_0xf993('0x3'));exports[_0xf993('0x4')]=function(_0x13489c){var _0xd8f240=_0x13489c[_0xf993('0x5')]||_0x13489c['queuecallerexitAt'];return client[_0xf993('0x6')](_0xf993('0x7'),{'body':{'channel':_0xf993('0x8'),'membername':_0x13489c['lastAssignedTo'],'interface':_[_0xf993('0x9')](_0x13489c['interface'])?util[_0xf993('0xa')](_0xf993('0xb'),_0x13489c[_0xf993('0xc')]):_0x13489c[_0xf993('0xd')],'type':_0xf993('0xe'),'enterAt':_0x13489c['queuecallerleaveAt'],'exitAt':_0xd8f240,'duration':moment(_0xd8f240)[_0xf993('0xf')](_0x13489c[_0xf993('0x10')],_0xf993('0x11')),'data1':_0xf993('0x12'),'data2':_0x13489c[_0xf993('0x13')],'data3':_0x13489c['exten'],'data4':null,'data5':_0x13489c[_0xf993('0x14')],'role':_0xf993('0x15'),'internal':_0x13489c[_0xf993('0x16')]?_[_0xf993('0x17')](_0x13489c[_0xf993('0x16')]):undefined,'uniqueid':_0x13489c[_0xf993('0x18')]},'log':_0xf993('0x7')});};exports[_0xf993('0x19')]=function(_0x5d92c1){return client[_0xf993('0x6')]('CreateMemberReport',{'body':{'channel':_0xf993('0x8'),'membername':_0x5d92c1[_0xf993('0x1a')],'interface':_0x5d92c1[_0xf993('0xd')],'type':_0xf993('0xe'),'enterAt':_0x5d92c1[_0xf993('0x1b')],'exitAt':_0x5d92c1[_0xf993('0x1c')],'duration':moment(_0x5d92c1[_0xf993('0x1c')])[_0xf993('0xf')](_0x5d92c1[_0xf993('0x1b')],_0xf993('0x11'))>=0x0?moment(_0x5d92c1[_0xf993('0x1c')])['diff'](_0x5d92c1[_0xf993('0x1b')],'seconds'):null,'data1':_0xf993('0x1d'),'data2':_0x5d92c1[_0xf993('0x16')],'data3':_0x5d92c1[_0xf993('0x1e')],'data4':_0x5d92c1[_0xf993('0x1f')]||null,'role':_0xf993('0x15'),'internal':_0x5d92c1[_0xf993('0x16')]?_['toNumber'](_0x5d92c1[_0xf993('0x16')]):undefined,'uniqueid':_0x5d92c1[_0xf993('0x18')]},'log':_0xf993('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index f874d38..9bec0df 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00ea=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','Request'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0x00ea,0x19d));var _0xa00e=function(_0x397580,_0x281408){_0x397580=_0x397580-0x0;var _0x4d5b6e=_0x00ea[_0x397580];return _0x4d5b6e;};'use strict';var client=require('../client');exports[_0xa00e('0x0')]=function(){return client[_0xa00e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa00e('0x2'),_0xa00e('0x3')]},'log':_0xa00e('0x4')});}; \ No newline at end of file +var _0x281d=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','ShowSetting'];(function(_0x1f7c09,_0xe3dc0d){var _0x5a3eee=function(_0x1c2309){while(--_0x1c2309){_0x1f7c09['push'](_0x1f7c09['shift']());}};_0x5a3eee(++_0xe3dc0d);}(_0x281d,0x195));var _0xd281=function(_0x2dc5ef,_0x336490){_0x2dc5ef=_0x2dc5ef-0x0;var _0xb933ea=_0x281d[_0x2dc5ef];return _0xb933ea;};'use strict';var client=require(_0xd281('0x0'));exports[_0xd281('0x1')]=function(){return client['Request'](_0xd281('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd281('0x3'),_0xd281('0x4')]},'log':_0xd281('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 09c5244..ad9d587 100644 --- a/server/services/ami/rpc/template.js +++ b/server/services/ami/rpc/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd523=['getTemplates','GetTemplate','name','html','../client'];(function(_0xfc5fd4,_0x43c5dc){var _0x34fa22=function(_0x1f5770){while(--_0x1f5770){_0xfc5fd4['push'](_0xfc5fd4['shift']());}};_0x34fa22(++_0x43c5dc);}(_0xd523,0x153));var _0x3d52=function(_0x2e0176,_0xdb556b){_0x2e0176=_0x2e0176-0x0;var _0x534e95=_0xd523[_0x2e0176];return _0x534e95;};'use strict';var client=require(_0x3d52('0x0'));exports[_0x3d52('0x1')]=function(_0x3d35b0){return function(_0x3fcfcb){return client['Request'](_0x3d52('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3d52('0x3'),_0x3d52('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x9089=['GetTemplate','../client','getTemplates','name','html'];(function(_0x129464,_0x5c8948){var _0x5b6084=function(_0x541cd8){while(--_0x541cd8){_0x129464['push'](_0x129464['shift']());}};_0x5b6084(++_0x5c8948);}(_0x9089,0xf6));var _0x9908=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x9089[_0x5d6e35];return _0x5d7ada;};'use strict';var client=require(_0x9908('0x0'));exports[_0x9908('0x1')]=function(_0x51d682){return function(_0x34f210){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9908('0x2'),_0x9908('0x3')]},'log':_0x9908('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f1056f0..c454b27 100644 --- a/server/services/ami/rpc/trigger.js +++ b/server/services/ami/rpc/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9092=['data4','data5','data6','data7','Request','GetTrigger','Condition','AllConditions','field','value','Actions','action','data1','data2','data3'];(function(_0x2d604b,_0x4f1748){var _0x504857=function(_0x3c4990){while(--_0x3c4990){_0x2d604b['push'](_0x2d604b['shift']());}};_0x504857(++_0x4f1748);}(_0x9092,0x8b));var _0x2909=function(_0xc3753b,_0x4fb1ec){_0xc3753b=_0xc3753b-0x0;var _0x19c9ab=_0x9092[_0xc3753b];return _0x19c9ab;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x24569c){return function(_0x108113){return client[_0x2909('0x0')](_0x2909('0x1'),{'options':{'raw':![],'attributes':['id','name','channel','status'],'include':[{'model':_0x2909('0x2'),'as':_0x2909('0x3'),'attributes':['id',_0x2909('0x4'),'operator',_0x2909('0x5')]},{'model':_0x2909('0x2'),'as':'AnyConditions','attributes':['id',_0x2909('0x4'),'operator',_0x2909('0x5')]},{'model':'Action','as':_0x2909('0x6'),'attributes':['id',_0x2909('0x7'),_0x2909('0x8'),_0x2909('0x9'),_0x2909('0xa'),_0x2909('0xb'),_0x2909('0xc'),_0x2909('0xd'),_0x2909('0xe')]}]},'log':_0x2909('0x1')});};}; \ No newline at end of file +var _0xc1ae=['data5','data6','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','value','Action','Actions','action','data1','data2','data3','data4'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0xc1ae,0x158));var _0xec1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1ae[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xec1a('0x0'));exports[_0xec1a('0x1')]=function(_0x1c19dd){return function(_0x1b4b2e){return client[_0xec1a('0x2')](_0xec1a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xec1a('0x4'),_0xec1a('0x5')],'include':[{'model':_0xec1a('0x6'),'as':_0xec1a('0x7'),'attributes':['id',_0xec1a('0x8'),'operator',_0xec1a('0x9')]},{'model':_0xec1a('0x6'),'as':'AnyConditions','attributes':['id',_0xec1a('0x8'),'operator',_0xec1a('0x9')]},{'model':_0xec1a('0xa'),'as':_0xec1a('0xb'),'attributes':['id',_0xec1a('0xc'),_0xec1a('0xd'),_0xec1a('0xe'),_0xec1a('0xf'),_0xec1a('0x10'),_0xec1a('0x11'),_0xec1a('0x12'),'data7']}]},'log':_0xec1a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index cabc81e..02f9b56 100644 --- a/server/services/ami/rpc/trunk.js +++ b/server/services/ami/rpc/trunk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe647=['../client','getTrunks','Request','GetTrunk','defaultuser'];(function(_0x4b5396,_0x4f7d02){var _0x4798e4=function(_0x2c79a3){while(--_0x2c79a3){_0x4b5396['push'](_0x4b5396['shift']());}};_0x4798e4(++_0x4f7d02);}(_0xe647,0x16d));var _0x7e64=function(_0x545d0c,_0x52dbc1){_0x545d0c=_0x545d0c-0x0;var _0x1a22e6=_0xe647[_0x545d0c];return _0x1a22e6;};'use strict';var client=require(_0x7e64('0x0'));exports[_0x7e64('0x1')]=function(_0x54aaab){return function(_0x41d99f){return client[_0x7e64('0x2')](_0x7e64('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x7e64('0x4')]},'log':_0x7e64('0x3')});};}; \ No newline at end of file +var _0x04de=['GetTrunk','name','registry','defaultuser','../client','getTrunks','Request'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0x04de,0x107));var _0xe04d=function(_0x5abffc,_0x2d064b){_0x5abffc=_0x5abffc-0x0;var _0x5ee3cd=_0x04de[_0x5abffc];return _0x5ee3cd;};'use strict';var client=require(_0xe04d('0x0'));exports[_0xe04d('0x1')]=function(_0x398778){return function(_0x299552){return client[_0xe04d('0x2')](_0xe04d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe04d('0x4'),_0xe04d('0x5'),_0xe04d('0x6')]},'log':_0xe04d('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f1b252c..1fc24f1 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x110d68,_0x31e3d4){var _0x261ed4=function(_0x496220){while(--_0x496220){_0x110d68['push'](_0x110d68['shift']());}};_0x261ed4(++_0x31e3d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xcb91[_0x422be2];return _0x1b820e;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a66369e..5d6d233 100644 --- a/server/services/ami/rpc/voiceAgentReport.js +++ b/server/services/ami/rpc/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9792=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create','Request'];(function(_0x2d344f,_0x25fa84){var _0x2e796b=function(_0x10466a){while(--_0x10466a){_0x2d344f['push'](_0x2d344f['shift']());}};_0x2e796b(++_0x25fa84);}(_0x9792,0x76));var _0x2979=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9792[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports[_0x2979('0x0')]=function(_0x5e8ede){return client[_0x2979('0x1')]('CreateVoiceAgentReport',{'body':_0x5e8ede,'log':_0x2979('0x2')});};exports[_0x2979('0x3')]=function(_0x356674,_0xc31584,_0x3d72cf){return client[_0x2979('0x1')](_0x2979('0x4'),{'body':_0x356674,'options':{'where':{'uniqueid':_0xc31584,'interface':_0x3d72cf,'agentcomplete':!![]}},'log':_0x2979('0x4')});}; \ No newline at end of file +var _0x2239=['UpdateVoiceAgentReport','create','Request','CreateVoiceAgentReport','update'];(function(_0x20f4fa,_0x4511d0){var _0x3ee596=function(_0x29e9d4){while(--_0x29e9d4){_0x20f4fa['push'](_0x20f4fa['shift']());}};_0x3ee596(++_0x4511d0);}(_0x2239,0xab));var _0x9223=function(_0x1b8e44,_0x18bb1e){_0x1b8e44=_0x1b8e44-0x0;var _0x49a1cc=_0x2239[_0x1b8e44];return _0x49a1cc;};'use strict';var client=require('../client');exports[_0x9223('0x0')]=function(_0x30c4c2){return client[_0x9223('0x1')](_0x9223('0x2'),{'body':_0x30c4c2,'log':'CreateVoiceAgentReport'});};exports[_0x9223('0x3')]=function(_0x101839,_0x4163d1,_0x6b1c64){return client[_0x9223('0x1')]('UpdateVoiceAgentReport',{'body':_0x101839,'options':{'where':{'uniqueid':_0x4163d1,'interface':_0x6b1c64,'agentcomplete':!![]}},'log':_0x9223('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index a86f385..472a110 100644 --- a/server/services/ami/rpc/voiceCallReport.js +++ b/server/services/ami/rpc/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5104=['billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration'];(function(_0x1c9c29,_0x732fa6){var _0x56e56d=function(_0x556988){while(--_0x556988){_0x1c9c29['push'](_0x1c9c29['shift']());}};_0x56e56d(++_0x732fa6);}(_0x5104,0x1a6));var _0x4510=function(_0x54d816,_0x23294a){_0x54d816=_0x54d816-0x0;var _0xe47268=_0x5104[_0x54d816];return _0xe47268;};'use strict';var moment=require(_0x4510('0x0'));var util=require('util');var _=require(_0x4510('0x1'));var client=require(_0x4510('0x2'));exports[_0x4510('0x3')]=function(_0xf35e9a){return client[_0x4510('0x4')](_0x4510('0x5'),{'body':_['merge'](_0xf35e9a,{'source':_0xf35e9a[_0x4510('0x6')],'destinationcontext':_0xf35e9a['context'],'callerid':_0xf35e9a['callerid'],'amaflags':_0x4510('0x7')}),'log':_0x4510('0x5')});};exports[_0x4510('0x8')]=function(){return function(){return client['Request'](_0x4510('0x9'),{'options':{'where':{'type':[_0x4510('0xa')],'createdAt':{'$between':[moment()[_0x4510('0xb')](_0x4510('0xc'))[_0x4510('0xd')](_0x4510('0xe')),moment()[_0x4510('0xf')](_0x4510('0xc'))[_0x4510('0xd')](_0x4510('0xe'))]}},'attributes':[_0x4510('0x10'),'disposition',_0x4510('0x11'),_0x4510('0x12')]},'log':_0x4510('0x13')});};}; \ No newline at end of file +var _0xb555=['moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','billableseconds'];(function(_0x4cf9bf,_0x1c0fbc){var _0x20949b=function(_0x5db6d8){while(--_0x5db6d8){_0x4cf9bf['push'](_0x4cf9bf['shift']());}};_0x20949b(++_0x1c0fbc);}(_0xb555,0x1a0));var _0x5b55=function(_0x984aae,_0x580a3c){_0x984aae=_0x984aae-0x0;var _0xb9ba8c=_0xb555[_0x984aae];return _0xb9ba8c;};'use strict';var moment=require(_0x5b55('0x0'));var util=require('util');var _=require(_0x5b55('0x1'));var client=require(_0x5b55('0x2'));exports[_0x5b55('0x3')]=function(_0xa547f7){return client[_0x5b55('0x4')](_0x5b55('0x5'),{'body':_['merge'](_0xa547f7,{'source':_0xa547f7[_0x5b55('0x6')],'destinationcontext':_0xa547f7[_0x5b55('0x7')],'callerid':_0xa547f7['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x5b55('0x8')]=function(){return function(){return client[_0x5b55('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x5b55('0x9')],'createdAt':{'$between':[moment()['startOf'](_0x5b55('0xa'))[_0x5b55('0xb')](_0x5b55('0xc')),moment()[_0x5b55('0xd')](_0x5b55('0xa'))[_0x5b55('0xb')](_0x5b55('0xc'))]}},'attributes':['type',_0x5b55('0xe'),'duration',_0x5b55('0xf')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 874d50e..c2ba6c0 100644 --- a/server/services/ami/rpc/voiceDialReport.js +++ b/server/services/ami/rpc/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x214d=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x214d,0x182));var _0xd214=function(_0x3883bc,_0x98856d){_0x3883bc=_0x3883bc-0x0;var _0x3c57c3=_0x214d[_0x3883bc];return _0x3c57c3;};'use strict';var client=require(_0xd214('0x0'));exports[_0xd214('0x1')]=function(_0x380b2e){return client[_0xd214('0x2')](_0xd214('0x3'),{'body':_0x380b2e,'log':_0xd214('0x3')});}; \ No newline at end of file +var _0x704f=['../client','create','Request','CreateVoiceDialReport'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0x704f,0x1d4));var _0xf704=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x704f[_0x4f3b2d];return _0x3dddfa;};'use strict';var client=require(_0xf704('0x0'));exports[_0xf704('0x1')]=function(_0x16a2a0){return client[_0xf704('0x2')](_0xf704('0x3'),{'body':_0x16a2a0,'log':_0xf704('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ddcde36..ecd3235 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0834=['Request','GetVoiceExtension'];(function(_0x20fa14,_0x2f0234){var _0x161aa0=function(_0x1dca88){while(--_0x1dca88){_0x20fa14['push'](_0x20fa14['shift']());}};_0x161aa0(++_0x2f0234);}(_0x0834,0x18e));var _0x4083=function(_0x533958,_0x17c694){_0x533958=_0x533958-0x0;var _0x43520e=_0x0834[_0x533958];return _0x43520e;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x4083('0x0')](_0x4083('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x3c0d=['recordingFormat','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x36a224,_0x23bb6a){var _0x509df2=function(_0x14d39a){while(--_0x14d39a){_0x36a224['push'](_0x36a224['shift']());}};_0x509df2(++_0x23bb6a);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x121df1,_0x3a06c0){_0x121df1=_0x121df1-0x0;var _0x59b6f8=_0x3c0d[_0x121df1];return _0x59b6f8;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xd3c0('0x0'),{'options':{'raw':!![],'attributes':['id',_0xd3c0('0x1'),_0xd3c0('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xd3c0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index aa0caf1..e99708b 100644 --- a/server/services/ami/rpc/voiceQueue.js +++ b/server/services/ami/rpc/voiceQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x820f=['interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','Pause','mandatoryDispositionPause','name','TrunkBackup','callerid','Interval','Intervals'];(function(_0x10801a,_0x59ec47){var _0x5d2cb9=function(_0x17ea03){while(--_0x17ea03){_0x10801a['push'](_0x10801a['shift']());}};_0x5d2cb9(++_0x59ec47);}(_0x820f,0x163));var _0xf820=function(_0x46ff82,_0x59d48c){_0x46ff82=_0x46ff82-0x0;var _0x262d95=_0x820f[_0x46ff82];return _0x262d95;};'use strict';var client=require(_0xf820('0x0'));exports[_0xf820('0x1')]=function(){return function(){return client[_0xf820('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0xf820('0x3'),_0xf820('0x4'),_0xf820('0x5'),'monitor_format',_0xf820('0x6'),_0xf820('0x7'),_0xf820('0x8'),_0xf820('0x9'),_0xf820('0xa'),'dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0xf820('0xb'),_0xf820('0xc'),_0xf820('0xd'),_0xf820('0xe'),_0xf820('0xf'),'dialCongestionMaxRetry',_0xf820('0x10'),'dialBusyMaxRetry',_0xf820('0x11'),_0xf820('0x12'),_0xf820('0x13'),_0xf820('0x14'),'dialTimezone',_0xf820('0x15'),_0xf820('0x16'),'dialCheckDuplicateType',_0xf820('0x17'),_0xf820('0x18'),'dialAMDGreeting',_0xf820('0x19'),_0xf820('0x1a'),_0xf820('0x1b'),_0xf820('0x1c'),_0xf820('0x1d'),_0xf820('0x1e'),_0xf820('0x1f'),'timeout','dialRecallMeTimeout','dialRecallInQueue',_0xf820('0x20'),_0xf820('0x21'),_0xf820('0x22'),'dialQueueProject2',_0xf820('0x23'),'strategy',_0xf820('0x24'),_0xf820('0x25'),_0xf820('0x26'),'dialNoSuchNumberRetryFrequency',_0xf820('0x27'),_0xf820('0x28'),_0xf820('0x29'),'dialAbandonedRetryFrequency',_0xf820('0x2a'),_0xf820('0x2b'),_0xf820('0x2c'),_0xf820('0x2d'),'mandatoryDisposition',_0xf820('0x2e'),_0xf820('0x2f'),_0xf820('0x30'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':_0xf820('0x31'),'as':'Trunk','attributes':['id','name','callerid',_0xf820('0x32')]},{'model':_0xf820('0x33'),'as':_0xf820('0x34'),'attributes':['id',_0xf820('0x35')]},{'model':_0xf820('0x31'),'as':_0xf820('0x36'),'attributes':['id',_0xf820('0x35'),_0xf820('0x37'),_0xf820('0x32')]},{'model':_0xf820('0x38'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0xf820('0x38'),'as':_0xf820('0x39'),'attributes':['id','name',_0xf820('0x3a')]}]}]},'log':_0xf820('0x1')});};}; \ No newline at end of file +var _0x1be1=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be1,0xe4));var _0x11be=function(_0x311a6e,_0x2d4bef){_0x311a6e=_0x311a6e-0x0;var _0x56ecda=_0x1be1[_0x311a6e];return _0x56ecda;};'use strict';var client=require(_0x11be('0x0'));exports[_0x11be('0x1')]=function(){return function(){return client[_0x11be('0x2')](_0x11be('0x3'),{'options':{'raw':![],'attributes':['id',_0x11be('0x4'),_0x11be('0x5'),_0x11be('0x6'),_0x11be('0x7'),_0x11be('0x8'),'type',_0x11be('0x9'),'dialMethod',_0x11be('0xa'),_0x11be('0xb'),_0x11be('0xc'),_0x11be('0xd'),_0x11be('0xe'),'dialPredictiveInterval',_0x11be('0xf'),_0x11be('0x10'),_0x11be('0x11'),_0x11be('0x12'),_0x11be('0x13'),_0x11be('0x14'),_0x11be('0x15'),_0x11be('0x16'),_0x11be('0x17'),_0x11be('0x18'),_0x11be('0x19'),_0x11be('0x1a'),_0x11be('0x1b'),_0x11be('0x1c'),_0x11be('0x1d'),_0x11be('0x1e'),_0x11be('0x1f'),_0x11be('0x20'),_0x11be('0x21'),_0x11be('0x22'),'dialAMDAfterGreetingSilence',_0x11be('0x23'),_0x11be('0x24'),_0x11be('0x25'),_0x11be('0x26'),_0x11be('0x27'),_0x11be('0x28'),'timeout','dialRecallMeTimeout',_0x11be('0x29'),_0x11be('0x2a'),'dialAgiAfterHangupAgent',_0x11be('0x2b'),'dialQueueProject2',_0x11be('0x8'),_0x11be('0x2c'),_0x11be('0x2d'),_0x11be('0x2e'),_0x11be('0x2f'),_0x11be('0x30'),'dialDropMaxRetry',_0x11be('0x31'),'dialAbandonedMaxRetry',_0x11be('0x32'),_0x11be('0x33'),_0x11be('0x34'),_0x11be('0x35'),_0x11be('0x36'),_0x11be('0x37'),_0x11be('0x38'),_0x11be('0x39'),_0x11be('0x3a'),_0x11be('0x3b'),'callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x11be('0x4'),_0x11be('0x3c'),'active']},{'model':_0x11be('0x3d'),'as':_0x11be('0x3e'),'attributes':['id',_0x11be('0x4')]},{'model':'Trunk','as':_0x11be('0x3f'),'attributes':['id',_0x11be('0x4'),_0x11be('0x3c'),_0x11be('0x40')]},{'model':_0x11be('0x41'),'as':'Interval','attributes':['id',_0x11be('0x4')],'include':[{'model':_0x11be('0x41'),'as':_0x11be('0x42'),'attributes':['id','name',_0x11be('0x43')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5c46e1c..cc66d1c 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x44ac38,_0x34ca5a){var _0x54c8b5=function(_0x4c4e8d){while(--_0x4c4e8d){_0x44ac38['push'](_0x44ac38['shift']());}};_0x54c8b5(++_0x34ca5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1322fc,_0x439541){var _0x14e074=function(_0x96a783){while(--_0x96a783){_0x1322fc['push'](_0x1322fc['shift']());}};_0x14e074(++_0x439541);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 2a6a8f2..2cdbc58 100644 --- a/server/services/ami/rpc/voiceQueueRt.js +++ b/server/services/ami/rpc/voiceQueueRt.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f83=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x3e99d7,_0x73e3f0){var _0x5b0dbe=function(_0x48ca92){while(--_0x48ca92){_0x3e99d7['push'](_0x3e99d7['shift']());}};_0x5b0dbe(++_0x73e3f0);}(_0x6f83,0xcb));var _0x36f8=function(_0x4e2ae0,_0x3250ee){_0x4e2ae0=_0x4e2ae0-0x0;var _0x238a36=_0x6f83[_0x4e2ae0];return _0x238a36;};'use strict';var client=require(_0x36f8('0x0'));exports[_0x36f8('0x1')]=function(_0x395b3d){return function(){return client[_0x36f8('0x2')](_0x36f8('0x3'),{'options':{'where':{'VoiceQueueId':_0x395b3d,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xaec6=['getVoiceQueueRtPauses','Request'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0xaec6,0x118));var _0x6aec=function(_0x488a1d,_0x17a8da){_0x488a1d=_0x488a1d-0x0;var _0x1945b9=_0xaec6[_0x488a1d];return _0x1945b9;};'use strict';var client=require('../client');exports[_0x6aec('0x0')]=function(_0x29871d){return function(){return client[_0x6aec('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x29871d,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bb44dbb..dc8f01c 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4fd770,_0xd12ca8){var _0x35a347=function(_0x53f807){while(--_0x53f807){_0x4fd770['push'](_0x4fd770['shift']());}};_0x35a347(++_0xd12ca8);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x13f891,_0xad95d){var _0x230211=function(_0x48dc38){while(--_0x48dc38){_0x13f891['push'](_0x13f891['shift']());}};_0x230211(++_0xad95d);}(_0x7a54,0x106));var _0x47a5=function(_0x5d8af9,_0x56a990){_0x5d8af9=_0x5d8af9-0x0;var _0x3f032b=_0x7a54[_0x5d8af9];return _0x3f032b;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 534e7f6..3ec9422 100644 --- a/server/services/ami/rpc/voiceTransferReport.js +++ b/server/services/ami/rpc/voiceTransferReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x670c=['origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','result','origtransferercalleridnum'];(function(_0x2d7075,_0x3312b9){var _0x447f37=function(_0x1ea38a){while(--_0x1ea38a){_0x2d7075['push'](_0x2d7075['shift']());}};_0x447f37(++_0x3312b9);}(_0x670c,0xd4));var _0xc670=function(_0x2a782b,_0x460212){_0x2a782b=_0x2a782b-0x0;var _0x2a82c9=_0x670c[_0x2a782b];return _0x2a82c9;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x5dd35f){return client[_0xc670('0x0')]('CreateVoiceTransferReport',{'body':{'result':_0x5dd35f['result'],'transfererchannel':_0x5dd35f['transfererchannel'],'transferercalleridnum':_0x5dd35f[_0xc670('0x1')],'transferercalleridname':_0x5dd35f[_0xc670('0x2')],'transfererconnectedlinenum':_0x5dd35f[_0xc670('0x3')],'transfererconnectedlinename':_0x5dd35f[_0xc670('0x4')],'transfereraccountcode':_0x5dd35f[_0xc670('0x5')],'transferercontext':_0x5dd35f[_0xc670('0x6')],'transfererexten':_0x5dd35f[_0xc670('0x7')],'transfererlinkedid':_0x5dd35f[_0xc670('0x8')],'transfereechannel':_0x5dd35f[_0xc670('0x9')],'transfereecalleridnum':_0x5dd35f[_0xc670('0xa')],'transfereecalleridname':_0x5dd35f[_0xc670('0xb')],'transfereeconnectedlinenum':_0x5dd35f[_0xc670('0xc')],'transfereeconnectedlinename':_0x5dd35f[_0xc670('0xd')],'transfereeaccountcode':_0x5dd35f[_0xc670('0xe')],'transfereecontext':_0x5dd35f['transfereecontext'],'transfereeexten':_0x5dd35f['transfereeexten'],'transfereelinkedid':_0x5dd35f[_0xc670('0xf')],'isexternal':_0x5dd35f['isexternal'],'context':_0x5dd35f[_0xc670('0x10')],'extension':_0x5dd35f[_0xc670('0x11')],'type':_0xc670('0x12')},'log':_0xc670('0x13')});};exports['attendedTransfer']=function(_0x326d1c){return client['Request'](_0xc670('0x13'),{'body':{'result':_0x326d1c[_0xc670('0x14')],'transfererchannel':_0x326d1c['origtransfererchannel'],'transferercalleridnum':_0x326d1c[_0xc670('0x15')],'transferercalleridname':_0x326d1c[_0xc670('0x16')],'transfererconnectedlinenum':_0x326d1c[_0xc670('0x17')],'transfererconnectedlinename':_0x326d1c[_0xc670('0x18')],'transfereraccountcode':_0x326d1c['origtransfereraccountcode'],'transferercontext':_0x326d1c[_0xc670('0x19')],'transfererexten':_0x326d1c[_0xc670('0x1a')],'transfererlinkedid':_0x326d1c[_0xc670('0x1b')],'transfereechannel':_0x326d1c[_0xc670('0x1c')],'transfereecalleridnum':_0x326d1c[_0xc670('0x1d')],'transfereecalleridname':_0x326d1c[_0xc670('0x1e')],'transfereeconnectedlinenum':_0x326d1c[_0xc670('0x1f')],'transfereeconnectedlinename':_0x326d1c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x326d1c[_0xc670('0x20')],'transfereecontext':_0x326d1c[_0xc670('0x21')],'transfereeexten':_0x326d1c[_0xc670('0x22')],'transfereelinkedid':_0x326d1c[_0xc670('0x23')],'isexternal':_0x326d1c[_0xc670('0x24')],'context':_0x326d1c[_0xc670('0x25')],'extension':_0x326d1c[_0xc670('0x26')],'type':'attended'},'log':_0xc670('0x13')});}; \ No newline at end of file +var _0xf922=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename'];(function(_0x31173c,_0x4505a3){var _0x42c169=function(_0x16b3d3){while(--_0x16b3d3){_0x31173c['push'](_0x31173c['shift']());}};_0x42c169(++_0x4505a3);}(_0xf922,0x8a));var _0x2f92=function(_0x53e36d,_0x5d0411){_0x53e36d=_0x53e36d-0x0;var _0x4e6ec2=_0xf922[_0x53e36d];return _0x4e6ec2;};'use strict';var client=require(_0x2f92('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3870f1){return client[_0x2f92('0x1')](_0x2f92('0x2'),{'body':{'result':_0x3870f1[_0x2f92('0x3')],'transfererchannel':_0x3870f1[_0x2f92('0x4')],'transferercalleridnum':_0x3870f1[_0x2f92('0x5')],'transferercalleridname':_0x3870f1[_0x2f92('0x6')],'transfererconnectedlinenum':_0x3870f1[_0x2f92('0x7')],'transfererconnectedlinename':_0x3870f1[_0x2f92('0x8')],'transfereraccountcode':_0x3870f1['transfereraccountcode'],'transferercontext':_0x3870f1[_0x2f92('0x9')],'transfererexten':_0x3870f1['transfererexten'],'transfererlinkedid':_0x3870f1[_0x2f92('0xa')],'transfereechannel':_0x3870f1[_0x2f92('0xb')],'transfereecalleridnum':_0x3870f1[_0x2f92('0xc')],'transfereecalleridname':_0x3870f1[_0x2f92('0xd')],'transfereeconnectedlinenum':_0x3870f1[_0x2f92('0xe')],'transfereeconnectedlinename':_0x3870f1[_0x2f92('0xf')],'transfereeaccountcode':_0x3870f1['transfereeaccountcode'],'transfereecontext':_0x3870f1[_0x2f92('0x10')],'transfereeexten':_0x3870f1[_0x2f92('0x11')],'transfereelinkedid':_0x3870f1[_0x2f92('0x12')],'isexternal':_0x3870f1[_0x2f92('0x13')],'context':_0x3870f1[_0x2f92('0x14')],'extension':_0x3870f1[_0x2f92('0x15')],'type':_0x2f92('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x2f92('0x17')]=function(_0x4ee1b3){return client[_0x2f92('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x4ee1b3[_0x2f92('0x3')],'transfererchannel':_0x4ee1b3[_0x2f92('0x18')],'transferercalleridnum':_0x4ee1b3[_0x2f92('0x19')],'transferercalleridname':_0x4ee1b3[_0x2f92('0x1a')],'transfererconnectedlinenum':_0x4ee1b3[_0x2f92('0x1b')],'transfererconnectedlinename':_0x4ee1b3[_0x2f92('0x1c')],'transfereraccountcode':_0x4ee1b3[_0x2f92('0x1d')],'transferercontext':_0x4ee1b3[_0x2f92('0x1e')],'transfererexten':_0x4ee1b3[_0x2f92('0x1f')],'transfererlinkedid':_0x4ee1b3[_0x2f92('0x20')],'transfereechannel':_0x4ee1b3[_0x2f92('0x21')],'transfereecalleridnum':_0x4ee1b3[_0x2f92('0x22')],'transfereecalleridname':_0x4ee1b3[_0x2f92('0x23')],'transfereeconnectedlinenum':_0x4ee1b3[_0x2f92('0x24')],'transfereeconnectedlinename':_0x4ee1b3[_0x2f92('0x25')],'transfereeaccountcode':_0x4ee1b3['transfertargetaccountcode'],'transfereecontext':_0x4ee1b3[_0x2f92('0x26')],'transfereeexten':_0x4ee1b3[_0x2f92('0x27')],'transfereelinkedid':_0x4ee1b3[_0x2f92('0x28')],'isexternal':_0x4ee1b3['isexternal'],'context':_0x4ee1b3[_0x2f92('0x29')],'extension':_0x4ee1b3[_0x2f92('0x2a')],'type':_0x2f92('0x2b')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 3c98b6e..a0f4fe7 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1623=['stop','%s.%s','filename','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','map','isConnected','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','validate','bluebird','moment','../../../config/environment','../properties','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','asterisk','username','join','pick','keys','action','Reload','Action','then','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','name','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','type','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','length','omit','undefined','values','channels','voicechannel','find','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel'];(function(_0xb6afe,_0x38671f){var _0x335218=function(_0x325284){while(--_0x325284){_0xb6afe['push'](_0xb6afe['shift']());}};_0x335218(++_0x38671f);}(_0x1623,0xab));var _0x3162=function(_0x2372ef,_0x5951d0){_0x2372ef=_0x2372ef-0x0;var _0x26140c=_0x1623[_0x2372ef];return _0x26140c;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require(_0x3162('0x1'));var BPromise=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var config=require(_0x3162('0x4'));var properties=require(_0x3162('0x5'));var ami=require('../ami');exports['listen']=function(_0x7a4559,_0x4b77c4,_0x1b55f2){return new BPromise(function(_0x428de6,_0x53260d){var _0xffe9b6={'QueuePause':function(_0x2dc07e){return new Promise(function(_0x26ee32,_0x36609e){var _0x10d684=util[_0x3162('0x6')](_0x3162('0x7'),_0x3162('0x8'),_0x2dc07e['name']);if(_0x7a4559['timers']&&_0x7a4559[_0x3162('0x9')][_0x10d684]&&_0x7a4559[_0x3162('0x9')][_0x10d684][_0x3162('0xa')]){_0x7a4559[_0x3162('0x9')][_0x10d684][_0x3162('0xb')]();}if(_0x7a4559[_0x3162('0xc')][_0x10d684]){_0x7a4559[_0x3162('0xc')][_0x10d684][_0x3162('0xd')]({'statePause':_0x2dc07e[_0x3162('0xe')]?!![]:![]});}_0x26ee32({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x2d11c5){var _0x535f47=this;return new Promise(function(_0x3b9faf,_0x143c5a){if(ami['isConnected']()==![]){return _0x143c5a(_0x535f47['error'](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}_0x2d11c5=_[_0x3162('0x12')](_0x2d11c5,_[_0x3162('0x13')](properties['module']));_0x2d11c5[_0x3162('0x14')]=_0x3162('0x15');return ami[_0x3162('0x16')](_0x2d11c5)[_0x3162('0x17')](function(_0x930415){_0x3b9faf({'code':0xc8,'message':_0x930415[_0x3162('0x18')]});})[_0x3162('0x19')](function(_0x4b2bf3){_0x143c5a(_0x535f47[_0x3162('0x1a')](0x1f5,_0x4b2bf3[_0x3162('0x18')]));});});},'Command':function(_0x460b7b){var _0x36ca97=this;return new Promise(function(_0x491144,_0x1dfd5c){if(ami['isConnected']()==![]){return _0x1dfd5c(_0x36ca97['error'](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected']['join']('\x20')));}_0x460b7b=_[_0x3162('0x12')](_0x460b7b,_0x3162('0x1b'));_0x460b7b[_0x3162('0x14')]=_0x3162('0x1c');return ami[_0x3162('0x16')](_0x460b7b)[_0x3162('0x17')](function(_0x52ae25){_0x491144({'code':0xc8,'message':_0x52ae25[_0x3162('0x1d')]});})['catch'](function(_0xd283d6){_0x1dfd5c(_0x36ca97[_0x3162('0x1a')](0x1f5,_0xd283d6[_0x3162('0x18')]));});});},'VoiceQueues':function(_0x1fd76f){return new Promise(function(_0x1c9992,_0x3c543e){var _0x30552f=[];for(var _0x5f8f7 in _0x7a4559[_0x3162('0x1e')]){if(_0x7a4559[_0x3162('0x1e')][_0x3162('0x1f')](_0x5f8f7)){var _0x2f62d7=_0x7a4559[_0x3162('0x1e')][_0x5f8f7];var _0x48de45={'id':_0x2f62d7['id'],'name':_0x2f62d7[_0x3162('0x20')],'strategy':_0x2f62d7['strategy'],'answered':_0x2f62d7[_0x3162('0x21')],'available':_0x2f62d7[_0x3162('0x22')],'loggedIn':_0x2f62d7[_0x3162('0x23')],'pTalking':_0x2f62d7['pTalking'],'sumBillable':_0x2f62d7['sumBillable'],'sumDuration':_0x2f62d7[_0x3162('0x24')],'sumHoldTime':_0x2f62d7[_0x3162('0x25')]||0x0,'talking':_0x2f62d7[_0x3162('0x26')],'total':_0x2f62d7[_0x3162('0x27')],'type':_0x2f62d7[_0x3162('0x28')],'unmanaged':_0x2f62d7['unmanaged'],'abandoned':_0x2f62d7[_0x3162('0x29')],'waiting':_0x2f62d7['waiting'],'loggedInDb':_0x2f62d7[_0x3162('0x2a')]};if(_0x2f62d7[_0x3162('0x28')]===_0x3162('0x2b')){_0x48de45[_0x3162('0x2c')]=_0x2f62d7[_0x3162('0x2c')];_0x48de45[_0x3162('0x2d')]=_0x2f62d7[_0x3162('0x2d')];_0x48de45[_0x3162('0x2e')]=_0x2f62d7['dialOriginateCallerIdName'];_0x48de45[_0x3162('0x2f')]=_0x2f62d7[_0x3162('0x2f')];_0x48de45['dialOriginateTimeout']=_0x2f62d7[_0x3162('0x30')];_0x48de45[_0x3162('0x31')]=_0x2f62d7['dialPrefix'];_0x48de45['temp']=_0x2f62d7[_0x3162('0x32')];_0x48de45['outboundAnswerAgiCallsDay']=_0x2f62d7[_0x3162('0x33')];_0x48de45[_0x3162('0x34')]=_0x2f62d7[_0x3162('0x34')];_0x48de45['outboundBlacklistCallsDay']=_0x2f62d7['outboundBlacklistCallsDay'];_0x48de45[_0x3162('0x35')]=_0x2f62d7[_0x3162('0x35')];_0x48de45['outboundCongestionCallsDay']=_0x2f62d7[_0x3162('0x36')];_0x48de45['outboundDropCallsDayACS']=_0x2f62d7[_0x3162('0x37')];_0x48de45[_0x3162('0x38')]=_0x2f62d7[_0x3162('0x38')];_0x48de45[_0x3162('0x39')]=_0x2f62d7[_0x3162('0x39')];_0x48de45[_0x3162('0x3a')]=_0x2f62d7[_0x3162('0x3a')];_0x48de45[_0x3162('0x3b')]=_0x2f62d7[_0x3162('0x3b')];_0x48de45[_0x3162('0x3c')]=_0x2f62d7[_0x3162('0x3c')];_0x48de45['outboundReCallsDay']=_0x2f62d7[_0x3162('0x3d')];_0x48de45[_0x3162('0x3e')]=_0x2f62d7[_0x3162('0x3e')];_0x48de45['outboundUnknownCallsDay']=_0x2f62d7['outboundUnknownCallsDay'];_0x48de45[_0x3162('0x3f')]=_0x2f62d7[_0x3162('0x3f')];_0x48de45[_0x3162('0x40')]=_0x2f62d7[_0x3162('0x40')];_0x48de45['predictiveIntervalAvgTalktime']=_0x2f62d7[_0x3162('0x41')];_0x48de45['predictiveIntervalDroppedCallsCallersExit']=_0x2f62d7['predictiveIntervalDroppedCallsCallersExit'];_0x48de45['predictiveIntervalDroppedCallsTimeout']=_0x2f62d7[_0x3162('0x42')];_0x48de45[_0x3162('0x43')]=_0x2f62d7[_0x3162('0x43')];_0x48de45['predictiveIntervalErlangCallsDroppedCalls']=_0x2f62d7[_0x3162('0x44')];_0x48de45[_0x3162('0x45')]=_0x2f62d7[_0x3162('0x45')];_0x48de45[_0x3162('0x46')]=_0x2f62d7[_0x3162('0x46')];_0x48de45['predictiveIntervalPauses']=_0x2f62d7['predictiveIntervalPauses'];_0x48de45[_0x3162('0x47')]=_0x2f62d7[_0x3162('0x47')];_0x48de45['predictiveIntervalTotalCalls']=_0x2f62d7['predictiveIntervalTotalCalls'];_0x48de45[_0x3162('0x18')]=_0x2f62d7[_0x3162('0x18')];_0x48de45[_0x3162('0x48')]=_0x2f62d7['originated'];_0x48de45[_0x3162('0x49')]=_0x2f62d7[_0x3162('0x49')];_0x48de45[_0x3162('0x4a')]=_0x2f62d7[_0x3162('0x4a')];_0x48de45['erlangAbandonmentRate']=_0x2f62d7[_0x3162('0x4b')];_0x48de45[_0x3162('0x4c')]=_0x2f62d7['erlangBusyFactor'];_0x48de45[_0x3162('0x4d')]=_0x2f62d7[_0x3162('0x4d')];_0x48de45['startProgressive']=_0x2f62d7[_0x3162('0x4e')];}if(_0x2f62d7[_0x3162('0x4f')]){_0x48de45['Trunk']={'id':_0x2f62d7[_0x3162('0x4f')]['id'],'name':_0x2f62d7['Trunk'][_0x3162('0x20')],'active':_0x2f62d7[_0x3162('0x4f')][_0x3162('0x50')],'callerid':_0x2f62d7[_0x3162('0x4f')][_0x3162('0x51')]};}if(_0x2f62d7[_0x3162('0x52')]){_0x48de45['Interval']={'id':_0x2f62d7[_0x3162('0x52')]['id'],'name':_0x2f62d7[_0x3162('0x52')][_0x3162('0x20')]};}_0x30552f['push'](_0x48de45);}}_0x1c9992({'count':_0x30552f[_0x3162('0x53')],'rows':_0x30552f});});},'UpdateVoiceQueue':function(_0xeef972){return new Promise(function(_0x4a9cc9,_0x1f99d6){var _0x4d2180=_['find'](_0x7a4559['voiceQueues'],{'id':parseInt(_0xeef972['id'])});var _0x1a4bcf=_[_0x3162('0x54')](_0xeef972,['id']);if(_0x4d2180){for(var _0x2f68a0 in _0x1a4bcf){if(typeof _0x1a4bcf[_0x2f68a0]!==_0x3162('0x55')&&typeof _0x4d2180[_0x2f68a0]!==_0x3162('0x55')){_0x4d2180[_0x2f68a0]=_0x1a4bcf[_0x2f68a0];}}_0x4a9cc9(_0x4d2180);}else{_0x1f99d6();}});},'VoiceChannels':function(_0x41a8e0){return new Promise(function(_0x6d6b87,_0x1b363f){var _0x3d2958=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x57')]);_0x6d6b87({'count':_0x3d2958[_0x3162('0x53')],'rows':_0x3d2958});});},'VoiceChannelMixMonitor':function(_0x209383){var _0x56f9bf=this;return new Promise(function(_0x3ac940,_0x48cb8f){if(ami['isConnected']()==![]){return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}var _0x54941b=schema(properties[_0x3162('0x58')])[_0x3162('0x1')](_0x209383);if(_0x54941b['length']>0x0){return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f4,_['map'](_0x54941b,'message')[_0x3162('0x11')](',\x20')));}var _0x22c0a2=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x57')],{'uniqueid':_0x209383[_0x3162('0x5a')]});if(_0x22c0a2&&_0x22c0a2[_0x3162('0x5b')]){var _0x871a24=util[_0x3162('0x6')]('%s.%s',_0x209383['filename']||_0x209383['uniqueid'],_0x209383[_0x3162('0x6')]||_0x3162('0x5c'));return ami[_0x3162('0x16')]({'action':_0x3162('0x5d'),'channel':_0x22c0a2[_0x3162('0x5b')],'file':_0x871a24,'options':_0x3162('0x5e')})[_0x3162('0x17')](function(_0x4f46f3){var _0x1f35ae=_['find'](_0x22c0a2[_0x3162('0x5f')],{'filename':'/var/spool/asterisk/monitor/'+_0x871a24[_0x3162('0x60')]()});if(_['isNil'](_0x1f35ae)){_0x22c0a2[_0x3162('0x5f')][_0x3162('0x61')]({'filename':'/var/spool/asterisk/monitor/'+_0x871a24['toLowerCase'](),'createdAt':moment()[_0x3162('0x6')](_0x3162('0x62')),'mixmonitorid':_0x4f46f3['mixmonitorid'],'status':_0x3162('0x63')});}else{_0x1f35ae[_0x3162('0x64')]=_0x4f46f3[_0x3162('0x64')];_0x1f35ae[_0x3162('0x65')]=_0x3162('0x63');}_0x3ac940({'code':0xc8,'message':[_0x209383['uniqueid'],_0x3162('0x66'),_0x4f46f3[_0x3162('0x64')]]['join']('\x20'),'mixmonitorid':_0x4f46f3['mixmonitorid']});})[_0x3162('0x19')](function(_0x6ed643){_0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f5,[_0x209383['uniqueid'],_0x6ed643[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x48cb8f(_0x56f9bf[_0x3162('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x434cb2){var _0x286aad=this;return new Promise(function(_0x5262b6,_0x3179a){if(ami['isConnected']()==![]){return _0x3179a(_0x286aad[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')]['username'],_0x3162('0x67')][_0x3162('0x11')]('\x20')));}var _0x3f039a=schema(properties[_0x3162('0x58')])[_0x3162('0x1')](_0x434cb2);if(_0x3f039a[_0x3162('0x53')]>0x0){return _0x3179a(_0x286aad['error'](0x1f4,_['map'](_0x3f039a,'message')[_0x3162('0x11')](',\x20')));}var _0x5b2de9=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x57')],{'uniqueid':_0x434cb2[_0x3162('0x5a')]});if(_0x5b2de9){return BPromise[_0x3162('0x68')]()[_0x3162('0x17')](function(){if(_0x5b2de9['channel']){return ami['Action']({'action':_0x3162('0x69'),'channel':_0x5b2de9[_0x3162('0x5b')],'mixmonitorid':_0x434cb2['mixmonitorid']})[_0x3162('0x19')](function(_0x2bd1ba){});}})[_0x3162('0x17')](function(){if(_0x5b2de9[_0x3162('0x6a')]){return ami[_0x3162('0x16')]({'action':'StopMixMonitor','channel':_0x5b2de9[_0x3162('0x6a')],'mixmonitorid':_0x434cb2[_0x3162('0x64')]})[_0x3162('0x19')](function(_0x28f891){});}})[_0x3162('0x17')](function(_0x5c8cef){var _0x35fcf5=_[_0x3162('0x59')](_0x5b2de9[_0x3162('0x5f')],{'mixmonitorid':_0x434cb2[_0x3162('0x64')]});if(_0x35fcf5){_0x35fcf5['status']=_0x3162('0x6b');}})[_0x3162('0x17')](function(){var _0x36f4c1=util[_0x3162('0x6')](_0x3162('0x6c'),_0x434cb2[_0x3162('0x6d')]||_0x434cb2[_0x3162('0x5a')],_0x434cb2[_0x3162('0x6')]||_0x3162('0x5c'));var _0x262266=_['find'](_0x5b2de9[_0x3162('0x5f')],{'filename':_0x3162('0x6e')+_0x36f4c1['toLowerCase']()});if(_0x262266){_0x262266[_0x3162('0x65')]='stop';}})[_0x3162('0x17')](function(){_0x5262b6({'code':0xc8,'message':[_0x434cb2[_0x3162('0x5a')],_0x3162('0x6f')][_0x3162('0x11')]('\x20')});})[_0x3162('0x19')](function(_0x3b6d3d){_0x3179a(_0x286aad['error'](0x1f5,[_0x434cb2[_0x3162('0x5a')],_0x3b6d3d[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x3179a(_0x286aad[_0x3162('0x1a')](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannels':function(_0x509c99){return new Promise(function(_0x2a3e33,_0x111952){var _0x282a44=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x71')]);_0x2a3e33({'count':_0x282a44[_0x3162('0x53')],'rows':_0x282a44});});},'VoiceQueuesChannel':function(_0xb3d824){var _0x502120=this;return new Promise(function(_0x57200f,_0x505885){var _0x39e748=schema(properties[_0x3162('0x72')])['validate'](_0xb3d824);if(_0x39e748[_0x3162('0x53')]>0x0){return _0x505885(_0x502120[_0x3162('0x1a')](0x1f4,_[_0x3162('0x73')](_0x39e748,_0x3162('0x18'))['join'](',\x20')));}var _0x1e5d8a=_[_0x3162('0x59')](_0x7a4559['queueChannels'],{'uniqueid':_0xb3d824[_0x3162('0x5a')]});if(_0x1e5d8a){_0x57200f(_0x1e5d8a);}else{return _0x505885(_0x502120['error'](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannelHangup':function(_0x47fec8){var _0x302aa2=this;return new Promise(function(_0x58e47e,_0x1dc930){if(ami[_0x3162('0x74')]()==![]){return _0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],'ami\x20disconnected'][_0x3162('0x11')]('\x20')));}var _0x63f6c2=schema(properties[_0x3162('0x75')])['validate'](_0x47fec8);if(_0x63f6c2[_0x3162('0x53')]>0x0){return _0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f4,_[_0x3162('0x73')](_0x63f6c2,_0x3162('0x18'))[_0x3162('0x11')](',\x20')));}var _0x5c1489=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x71')],{'uniqueid':_0x47fec8['uniqueid']});if(_0x5c1489&&_0x5c1489['channel']){return ami[_0x3162('0x16')]({'action':_0x3162('0x76'),'channel':_0x5c1489['channel']})[_0x3162('0x17')](function(_0xede1c1){_0x58e47e({'code':0xc8,'message':[_0x47fec8[_0x3162('0x5a')],_0xede1c1[_0x3162('0x18')][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')});})[_0x3162('0x19')](function(_0x3da74a){_0x1dc930(_0x302aa2[_0x3162('0x1a')](0x1f5,[_0x47fec8['uniqueid'],_0x3da74a['message'][_0x3162('0x60')]()][_0x3162('0x11')]('\x20')));});}else{return _0x1dc930(_0x302aa2['error'](0x1f5,_0x3162('0x70')));}});},'VoiceQueuesChannelRedirect':function(_0x528d35){var _0x58a12c=this;return new Promise(function(_0x4bc14c,_0x31981a){if(ami['isConnected']()==![]){return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f4,[config[_0x3162('0xf')]['ip'],config[_0x3162('0xf')][_0x3162('0x10')],_0x3162('0x67')][_0x3162('0x11')]('\x20')));}var _0x36b427=schema(properties[_0x3162('0x77')])[_0x3162('0x1')](_0x528d35);if(_0x36b427[_0x3162('0x53')]>0x0){return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f4,_['map'](_0x36b427,_0x3162('0x18'))[_0x3162('0x11')](',\x20')));}var _0x42c195=_[_0x3162('0x59')](_0x7a4559[_0x3162('0x71')],{'uniqueid':_0x528d35[_0x3162('0x5a')]});if(_0x42c195&&_0x42c195[_0x3162('0x5b')]){return ami[_0x3162('0x16')]({'action':_0x3162('0x78'),'channel':_0x42c195[_0x3162('0x5b')],'exten':_0x528d35[_0x3162('0x79')],'context':_0x528d35[_0x3162('0x7a')]||_0x42c195['context'],'priority':0x1})[_0x3162('0x17')](function(_0x9d58e6){_0x4bc14c({'code':0xc8,'message':[_0x528d35[_0x3162('0x5a')],_0x9d58e6['message'][_0x3162('0x60')]()]['join']('\x20')});})[_0x3162('0x19')](function(_0x1caf1d){_0x31981a(_0x58a12c['error'](0x1f5,[_0x528d35['uniqueid'],_0x1caf1d[_0x3162('0x18')][_0x3162('0x60')]()]['join']('\x20')));});}else{return _0x31981a(_0x58a12c[_0x3162('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0xb48c1e){return new Promise(function(_0x3421a3,_0x287908){var _0x393765=_[_0x3162('0x56')](_0x7a4559[_0x3162('0xc')]);_0x3421a3({'count':_0x393765[_0x3162('0x53')],'rows':_0x393765});});},'Telephones':function(_0x3b58cc){return new Promise(function(_0xfafef4,_0x56fd04){var _0x42e4ef=_['values'](_0x7a4559[_0x3162('0x7b')]);_0xfafef4({'count':_0x42e4ef[_0x3162('0x53')],'rows':_0x42e4ef});});},'Trunks':function(_0x4e5420){return new Promise(function(_0x2d3fbe,_0x3ef7db){var _0x98de01=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x7c')]);_0x2d3fbe({'count':_0x98de01[_0x3162('0x53')],'rows':_0x98de01});});},'OutboundChannels':function(_0x1a9236){return new Promise(function(_0x59a84b,_0x40859e){var _0x23e10b=_[_0x3162('0x56')](_0x7a4559['outboundChannels']);_0x59a84b({'count':_0x23e10b[_0x3162('0x53')],'rows':_0x23e10b});});},'Outbound':function(_0x366891){return new Promise(function(_0x39529f,_0x2b8e21){_0x39529f(_0x7a4559[_0x3162('0x2b')]);});},'Campaigns':function(_0x398ffe){return new Promise(function(_0x4d144f,_0x1f2fd8){var _0x32147e=_[_0x3162('0x56')](_0x7a4559[_0x3162('0x7d')]);_0x4d144f({'count':_0x32147e[_0x3162('0x53')],'rows':_0x32147e});});},'VoiceQueuesPreview':function(_0x585482){var _0xf70787=this;return new Promise(function(_0x516805,_0x15f447){_0x4b77c4[_0x3162('0x7e')](_0x585482['id'])['then'](function(_0x2cf06c){_0x516805({'code':0xc8,'message':_0x2cf06c[_0x3162('0x18')]});})[_0x3162('0x19')](function(_0x53ac8e){_0x15f447(_0xf70787[_0x3162('0x1a')](0x1f4,_0x53ac8e['message']));});});},'EventManager':function(_0x5369a0){var _0x3096ec=this;return new Promise(function(_0x4cfdee,_0x26f424){if(!_0x5369a0[_0x3162('0x7f')]){return _0x26f424(_0x3096ec[_0x3162('0x1a')](0x1f4,_0x3162('0x80')));}ami[_0x3162('0x81')]('custom:'+_0x5369a0['event'],_0x5369a0['message']);_0x4cfdee({'code':0xc8,'message':_0x5369a0});});},'FaxAccounts':function(_0x22182c){return new Promise(function(_0x10cc38,_0x50c0ed){var _0x5c6a78=_[_0x3162('0x56')](_0x7a4559['faxAccounts']);_0x10cc38({'count':_0x5c6a78[_0x3162('0x53')],'rows':_0x5c6a78});});},'SendFax':function(_0x35d9f0){var _0x4408db=this;return new Promise(function(_0x377edb,_0x563197){_0x1b55f2[_0x3162('0x82')](_0x35d9f0)[_0x3162('0x17')](function(_0x2800f9){_0x377edb({'code':0xc8,'message':_0x2800f9['message']});})[_0x3162('0x19')](function(_0x5c952c){_0x563197(_0x4408db[_0x3162('0x1a')](0x1f4,_0x5c952c['message']));});});},'CheckAfterSend':function(_0x4468d3){var _0x3d414f=this;return new Promise(function(_0x3da909,_0x591bb7){_0x1b55f2[_0x3162('0x83')](_0x4468d3)[_0x3162('0x17')](function(_0x1d5775){_0x3da909({'code':0xc8,'message':_0x1d5775[_0x3162('0x18')]});})['catch'](function(_0x17b9d9){_0x591bb7(_0x3d414f[_0x3162('0x1a')](0x1f4,_0x17b9d9['message']));});});}};var _0x3f0d75=jayson[_0x3162('0x84')](_0xffe9b6)[_0x3162('0x85')]();_0x3f0d75['on'](_0x3162('0x1a'),function(_0xdccc1a){return _0x53260d(_0xdccc1a);});_0x3f0d75[_0x3162('0x86')](0x232a,_0x3162('0x87'),function(){console[_0x3162('0x88')](_0x3162('0x89'),0x232a);return _0x428de6(_0x3162('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x6c45=['join','voicechannel','map','channels','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','find','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','Redirect','exten','context','values','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','127.0.0.1','log','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','module','action','Action','then','message','catch','command','Command','voiceQueues','name','strategy','available','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','undefined','length'];(function(_0x1772d8,_0x306b9a){var _0x495fe4=function(_0x16230c){while(--_0x16230c){_0x1772d8['push'](_0x1772d8['shift']());}};_0x495fe4(++_0x306b9a);}(_0x6c45,0xb1));var _0x56c4=function(_0x5d613d,_0x2bb187){_0x5d613d=_0x5d613d-0x0;var _0x4aa9ea=_0x6c45[_0x5d613d];return _0x4aa9ea;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var jayson=require('jayson/promise');var schema=require(_0x56c4('0x2'));var BPromise=require(_0x56c4('0x3'));var moment=require(_0x56c4('0x4'));var config=require(_0x56c4('0x5'));var properties=require(_0x56c4('0x6'));var ami=require(_0x56c4('0x7'));exports[_0x56c4('0x8')]=function(_0x24d839,_0x1316a6,_0x3cc49e){return new BPromise(function(_0x1fcb9e,_0x330e6){var _0x1d0b9b={'QueuePause':function(_0x373748){return new Promise(function(_0x7e0748,_0x38dbd7){var _0x13b767=util[_0x56c4('0x9')](_0x56c4('0xa'),_0x56c4('0xb'),_0x373748['name']);if(_0x24d839[_0x56c4('0xc')]&&_0x24d839[_0x56c4('0xc')][_0x13b767]&&_0x24d839[_0x56c4('0xc')][_0x13b767][_0x56c4('0xd')]){_0x24d839['timers'][_0x13b767][_0x56c4('0xe')]();}if(_0x24d839[_0x56c4('0xf')][_0x13b767]){_0x24d839[_0x56c4('0xf')][_0x13b767][_0x56c4('0x10')]({'statePause':_0x373748['pause']?!![]:![]});}_0x7e0748({'code':0xc8,'message':_0x56c4('0x11')});});},'Reload':function(_0x5ec318){var _0x512d7e=this;return new Promise(function(_0x2cb56e,_0xec63c0){if(ami[_0x56c4('0x12')]()==![]){return _0xec63c0(_0x512d7e[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')]['join']('\x20')));}_0x5ec318=_[_0x56c4('0x17')](_0x5ec318,_[_0x56c4('0x18')](properties[_0x56c4('0x19')]));_0x5ec318[_0x56c4('0x1a')]='Reload';return ami[_0x56c4('0x1b')](_0x5ec318)[_0x56c4('0x1c')](function(_0x56324c){_0x2cb56e({'code':0xc8,'message':_0x56324c[_0x56c4('0x1d')]});})[_0x56c4('0x1e')](function(_0x110f71){_0xec63c0(_0x512d7e[_0x56c4('0x13')](0x1f5,_0x110f71['message']));});});},'Command':function(_0x100a6e){var _0xd696d7=this;return new Promise(function(_0x279a1e,_0x7a7612){if(ami[_0x56c4('0x12')]()==![]){return _0x7a7612(_0xd696d7[_0x56c4('0x13')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')]['join']('\x20')));}_0x100a6e=_[_0x56c4('0x17')](_0x100a6e,_0x56c4('0x1f'));_0x100a6e[_0x56c4('0x1a')]=_0x56c4('0x20');return ami[_0x56c4('0x1b')](_0x100a6e)[_0x56c4('0x1c')](function(_0xc130d6){_0x279a1e({'code':0xc8,'message':_0xc130d6['content']});})[_0x56c4('0x1e')](function(_0x3e1007){_0x7a7612(_0xd696d7[_0x56c4('0x13')](0x1f5,_0x3e1007['message']));});});},'VoiceQueues':function(_0xc8ed28){return new Promise(function(_0x4d1d9c,_0x213cc6){var _0xecf1e7=[];for(var _0x5945fb in _0x24d839[_0x56c4('0x21')]){if(_0x24d839[_0x56c4('0x21')]['hasOwnProperty'](_0x5945fb)){var _0x4c4a8c=_0x24d839['voiceQueues'][_0x5945fb];var _0x23fadb={'id':_0x4c4a8c['id'],'name':_0x4c4a8c[_0x56c4('0x22')],'strategy':_0x4c4a8c[_0x56c4('0x23')],'answered':_0x4c4a8c['answered'],'available':_0x4c4a8c[_0x56c4('0x24')],'loggedIn':_0x4c4a8c['loggedIn'],'pTalking':_0x4c4a8c['pTalking'],'sumBillable':_0x4c4a8c[_0x56c4('0x25')],'sumDuration':_0x4c4a8c[_0x56c4('0x26')],'sumHoldTime':_0x4c4a8c[_0x56c4('0x27')]||0x0,'talking':_0x4c4a8c[_0x56c4('0x28')],'total':_0x4c4a8c[_0x56c4('0x29')],'type':_0x4c4a8c[_0x56c4('0x2a')],'unmanaged':_0x4c4a8c[_0x56c4('0x2b')],'abandoned':_0x4c4a8c[_0x56c4('0x2c')],'waiting':_0x4c4a8c['waiting'],'loggedInDb':_0x4c4a8c[_0x56c4('0x2d')]};if(_0x4c4a8c[_0x56c4('0x2a')]===_0x56c4('0x2e')){_0x23fadb['dialActive']=_0x4c4a8c[_0x56c4('0x2f')];_0x23fadb[_0x56c4('0x30')]=_0x4c4a8c[_0x56c4('0x30')];_0x23fadb['dialOriginateCallerIdName']=_0x4c4a8c[_0x56c4('0x31')];_0x23fadb[_0x56c4('0x32')]=_0x4c4a8c['dialOriginateCallerIdNumber'];_0x23fadb[_0x56c4('0x33')]=_0x4c4a8c['dialOriginateTimeout'];_0x23fadb[_0x56c4('0x34')]=_0x4c4a8c[_0x56c4('0x34')];_0x23fadb[_0x56c4('0x35')]=_0x4c4a8c[_0x56c4('0x35')];_0x23fadb[_0x56c4('0x36')]=_0x4c4a8c['outboundAnswerAgiCallsDay'];_0x23fadb['outboundAnswerCallsDay']=_0x4c4a8c[_0x56c4('0x37')];_0x23fadb[_0x56c4('0x38')]=_0x4c4a8c[_0x56c4('0x38')];_0x23fadb[_0x56c4('0x39')]=_0x4c4a8c[_0x56c4('0x39')];_0x23fadb['outboundCongestionCallsDay']=_0x4c4a8c[_0x56c4('0x3a')];_0x23fadb[_0x56c4('0x3b')]=_0x4c4a8c[_0x56c4('0x3b')];_0x23fadb[_0x56c4('0x3c')]=_0x4c4a8c[_0x56c4('0x3c')];_0x23fadb[_0x56c4('0x3d')]=_0x4c4a8c[_0x56c4('0x3d')];_0x23fadb['outboundNoAnswerCallsDay']=_0x4c4a8c['outboundNoAnswerCallsDay'];_0x23fadb[_0x56c4('0x3e')]=_0x4c4a8c[_0x56c4('0x3e')];_0x23fadb[_0x56c4('0x3f')]=_0x4c4a8c[_0x56c4('0x3f')];_0x23fadb[_0x56c4('0x40')]=_0x4c4a8c['outboundReCallsDay'];_0x23fadb['outboundRejectCallsDay']=_0x4c4a8c[_0x56c4('0x41')];_0x23fadb['outboundUnknownCallsDay']=_0x4c4a8c[_0x56c4('0x42')];_0x23fadb[_0x56c4('0x43')]=_0x4c4a8c[_0x56c4('0x43')];_0x23fadb[_0x56c4('0x44')]=_0x4c4a8c['predictiveIntervalAvgHoldtime'];_0x23fadb[_0x56c4('0x45')]=_0x4c4a8c[_0x56c4('0x45')];_0x23fadb[_0x56c4('0x46')]=_0x4c4a8c[_0x56c4('0x46')];_0x23fadb[_0x56c4('0x47')]=_0x4c4a8c[_0x56c4('0x47')];_0x23fadb[_0x56c4('0x48')]=_0x4c4a8c['predictiveIntervalErlangCalls'];_0x23fadb['predictiveIntervalErlangCallsDroppedCalls']=_0x4c4a8c[_0x56c4('0x49')];_0x23fadb[_0x56c4('0x4a')]=_0x4c4a8c['predictiveIntervalHitRate'];_0x23fadb[_0x56c4('0x4b')]=_0x4c4a8c[_0x56c4('0x4b')];_0x23fadb['predictiveIntervalPauses']=_0x4c4a8c[_0x56c4('0x4c')];_0x23fadb[_0x56c4('0x4d')]=_0x4c4a8c['predictiveIntervalAvailable'];_0x23fadb['predictiveIntervalTotalCalls']=_0x4c4a8c[_0x56c4('0x4e')];_0x23fadb[_0x56c4('0x1d')]=_0x4c4a8c[_0x56c4('0x1d')];_0x23fadb[_0x56c4('0x4f')]=_0x4c4a8c['originated'];_0x23fadb['erlangCalls']=_0x4c4a8c['erlangCalls'];_0x23fadb[_0x56c4('0x50')]=_0x4c4a8c[_0x56c4('0x50')];_0x23fadb[_0x56c4('0x51')]=_0x4c4a8c['erlangAbandonmentRate'];_0x23fadb[_0x56c4('0x52')]=_0x4c4a8c[_0x56c4('0x52')];_0x23fadb['startPredictive']=_0x4c4a8c[_0x56c4('0x53')];_0x23fadb[_0x56c4('0x54')]=_0x4c4a8c[_0x56c4('0x54')];}if(_0x4c4a8c[_0x56c4('0x55')]){_0x23fadb[_0x56c4('0x55')]={'id':_0x4c4a8c[_0x56c4('0x55')]['id'],'name':_0x4c4a8c[_0x56c4('0x55')]['name'],'active':_0x4c4a8c['Trunk'][_0x56c4('0x56')],'callerid':_0x4c4a8c['Trunk']['callerid']};}if(_0x4c4a8c[_0x56c4('0x57')]){_0x23fadb['Interval']={'id':_0x4c4a8c[_0x56c4('0x57')]['id'],'name':_0x4c4a8c[_0x56c4('0x57')][_0x56c4('0x22')]};}_0xecf1e7[_0x56c4('0x58')](_0x23fadb);}}_0x4d1d9c({'count':_0xecf1e7['length'],'rows':_0xecf1e7});});},'UpdateVoiceQueue':function(_0x44d604){return new Promise(function(_0x42603f,_0x57bfe8){var _0x546b16=_['find'](_0x24d839['voiceQueues'],{'id':parseInt(_0x44d604['id'])});var _0x2651aa=_['omit'](_0x44d604,['id']);if(_0x546b16){for(var _0xd3b676 in _0x2651aa){if(typeof _0x2651aa[_0xd3b676]!=='undefined'&&typeof _0x546b16[_0xd3b676]!==_0x56c4('0x59')){_0x546b16[_0xd3b676]=_0x2651aa[_0xd3b676];}}_0x42603f(_0x546b16);}else{_0x57bfe8();}});},'VoiceChannels':function(_0x5f4c90){return new Promise(function(_0x4064b4,_0x593a2d){var _0xde1b7c=_['values'](_0x24d839['channels']);_0x4064b4({'count':_0xde1b7c[_0x56c4('0x5a')],'rows':_0xde1b7c});});},'VoiceChannelMixMonitor':function(_0x18f883){var _0x251ee2=this;return new Promise(function(_0x3886ec,_0x251c0c){if(ami[_0x56c4('0x12')]()==![]){return _0x251c0c(_0x251ee2['error'](0x1f4,[config[_0x56c4('0x14')]['ip'],config[_0x56c4('0x14')][_0x56c4('0x15')],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x1ca0fc=schema(properties[_0x56c4('0x5c')])[_0x56c4('0x2')](_0x18f883);if(_0x1ca0fc['length']>0x0){return _0x251c0c(_0x251ee2[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x1ca0fc,'message')[_0x56c4('0x5b')](',\x20')));}var _0x2b9010=_['find'](_0x24d839[_0x56c4('0x5e')],{'uniqueid':_0x18f883[_0x56c4('0x5f')]});if(_0x2b9010&&_0x2b9010[_0x56c4('0x60')]){var _0x227001=util[_0x56c4('0x9')]('%s.%s',_0x18f883[_0x56c4('0x61')]||_0x18f883['uniqueid'],_0x18f883[_0x56c4('0x9')]||_0x56c4('0x62'));return ami['Action']({'action':_0x56c4('0x63'),'channel':_0x2b9010[_0x56c4('0x60')],'file':_0x227001,'options':_0x56c4('0x64')})['then'](function(_0x3578f5){var _0x2c3cb0=_[_0x56c4('0x65')](_0x2b9010['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x227001[_0x56c4('0x66')]()});if(_[_0x56c4('0x67')](_0x2c3cb0)){_0x2b9010['monitors'][_0x56c4('0x58')]({'filename':_0x56c4('0x68')+_0x227001[_0x56c4('0x66')](),'createdAt':moment()[_0x56c4('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3578f5[_0x56c4('0x69')],'status':_0x56c4('0x6a')});}else{_0x2c3cb0[_0x56c4('0x69')]=_0x3578f5[_0x56c4('0x69')];_0x2c3cb0['status']=_0x56c4('0x6a');}_0x3886ec({'code':0xc8,'message':[_0x18f883['uniqueid'],_0x56c4('0x6b'),_0x3578f5[_0x56c4('0x69')]]['join']('\x20'),'mixmonitorid':_0x3578f5[_0x56c4('0x69')]});})[_0x56c4('0x1e')](function(_0x53a095){_0x251c0c(_0x251ee2['error'](0x1f5,[_0x18f883[_0x56c4('0x5f')],_0x53a095[_0x56c4('0x1d')]['toLowerCase']()][_0x56c4('0x5b')]('\x20')));});}else{return _0x251c0c(_0x251ee2[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x31bcb3){var _0x3eecfe=this;return new Promise(function(_0x237e1f,_0x1d9868){if(ami[_0x56c4('0x12')]()==![]){return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk'][_0x56c4('0x15')],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x1942fe=schema(properties[_0x56c4('0x5c')])[_0x56c4('0x2')](_0x31bcb3);if(_0x1942fe[_0x56c4('0x5a')]>0x0){return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x1942fe,_0x56c4('0x1d'))['join'](',\x20')));}var _0x1c8190=_[_0x56c4('0x65')](_0x24d839[_0x56c4('0x5e')],{'uniqueid':_0x31bcb3['uniqueid']});if(_0x1c8190){return BPromise[_0x56c4('0x6d')]()['then'](function(){if(_0x1c8190[_0x56c4('0x60')]){return ami[_0x56c4('0x1b')]({'action':_0x56c4('0x6e'),'channel':_0x1c8190[_0x56c4('0x60')],'mixmonitorid':_0x31bcb3[_0x56c4('0x69')]})[_0x56c4('0x1e')](function(_0x2ac7f2){});}})[_0x56c4('0x1c')](function(){if(_0x1c8190[_0x56c4('0x6f')]){return ami['Action']({'action':_0x56c4('0x6e'),'channel':_0x1c8190['destinationchannel'],'mixmonitorid':_0x31bcb3['mixmonitorid']})[_0x56c4('0x1e')](function(_0x364243){});}})['then'](function(_0x1dd10a){var _0x4a2cae=_['find'](_0x1c8190[_0x56c4('0x70')],{'mixmonitorid':_0x31bcb3[_0x56c4('0x69')]});if(_0x4a2cae){_0x4a2cae['status']=_0x56c4('0x71');}})[_0x56c4('0x1c')](function(){var _0x298145=util[_0x56c4('0x9')](_0x56c4('0x72'),_0x31bcb3[_0x56c4('0x61')]||_0x31bcb3[_0x56c4('0x5f')],_0x31bcb3[_0x56c4('0x9')]||'wav');var _0x240ad9=_[_0x56c4('0x65')](_0x1c8190['monitors'],{'filename':_0x56c4('0x68')+_0x298145['toLowerCase']()});if(_0x240ad9){_0x240ad9['status']=_0x56c4('0x71');}})[_0x56c4('0x1c')](function(){_0x237e1f({'code':0xc8,'message':[_0x31bcb3[_0x56c4('0x5f')],_0x56c4('0x73')]['join']('\x20')});})[_0x56c4('0x1e')](function(_0x1aabd6){_0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f5,[_0x31bcb3[_0x56c4('0x5f')],_0x1aabd6[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')));});}else{return _0x1d9868(_0x3eecfe[_0x56c4('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2c45f6){return new Promise(function(_0x3e4f3a,_0x40301c){var _0x6e2c28=_['values'](_0x24d839[_0x56c4('0x74')]);_0x3e4f3a({'count':_0x6e2c28['length'],'rows':_0x6e2c28});});},'VoiceQueuesChannel':function(_0xb59d24){var _0x4b0d9c=this;return new Promise(function(_0x56c92a,_0x2791b6){var _0x5ecd9f=schema(properties['voicequeuechannel'])['validate'](_0xb59d24);if(_0x5ecd9f['length']>0x0){return _0x2791b6(_0x4b0d9c[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x5ecd9f,_0x56c4('0x1d'))['join'](',\x20')));}var _0x1a9345=_['find'](_0x24d839[_0x56c4('0x74')],{'uniqueid':_0xb59d24['uniqueid']});if(_0x1a9345){_0x56c92a(_0x1a9345);}else{return _0x2791b6(_0x4b0d9c[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x20a3c9){var _0x51785f=this;return new Promise(function(_0x6c41c7,_0x39000f){if(ami['isConnected']()==![]){return _0x39000f(_0x51785f['error'](0x1f4,[config[_0x56c4('0x14')]['ip'],config[_0x56c4('0x14')]['username'],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x4feebd=schema(properties['voicequeuechannelhangup'])['validate'](_0x20a3c9);if(_0x4feebd[_0x56c4('0x5a')]>0x0){return _0x39000f(_0x51785f[_0x56c4('0x13')](0x1f4,_[_0x56c4('0x5d')](_0x4feebd,'message')[_0x56c4('0x5b')](',\x20')));}var _0x2fbe9d=_[_0x56c4('0x65')](_0x24d839['queueChannels'],{'uniqueid':_0x20a3c9['uniqueid']});if(_0x2fbe9d&&_0x2fbe9d[_0x56c4('0x60')]){return ami[_0x56c4('0x1b')]({'action':'Hangup','channel':_0x2fbe9d[_0x56c4('0x60')]})['then'](function(_0x5d1569){_0x6c41c7({'code':0xc8,'message':[_0x20a3c9['uniqueid'],_0x5d1569[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')});})[_0x56c4('0x1e')](function(_0xc82779){_0x39000f(_0x51785f[_0x56c4('0x13')](0x1f5,[_0x20a3c9[_0x56c4('0x5f')],_0xc82779[_0x56c4('0x1d')]['toLowerCase']()][_0x56c4('0x5b')]('\x20')));});}else{return _0x39000f(_0x51785f[_0x56c4('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x1e28b3){var _0x9bbbbc=this;return new Promise(function(_0xce0938,_0x2f24ad){if(ami['isConnected']()==![]){return _0x2f24ad(_0x9bbbbc[_0x56c4('0x13')](0x1f4,[config[_0x56c4('0x14')]['ip'],config['asterisk']['username'],_0x56c4('0x16')][_0x56c4('0x5b')]('\x20')));}var _0x127489=schema(properties['voicequeuechannelredirect'])[_0x56c4('0x2')](_0x1e28b3);if(_0x127489['length']>0x0){return _0x2f24ad(_0x9bbbbc['error'](0x1f4,_['map'](_0x127489,_0x56c4('0x1d'))['join'](',\x20')));}var _0x280e9f=_[_0x56c4('0x65')](_0x24d839[_0x56c4('0x74')],{'uniqueid':_0x1e28b3[_0x56c4('0x5f')]});if(_0x280e9f&&_0x280e9f['channel']){return ami['Action']({'action':_0x56c4('0x75'),'channel':_0x280e9f['channel'],'exten':_0x1e28b3[_0x56c4('0x76')],'context':_0x1e28b3[_0x56c4('0x77')]||_0x280e9f[_0x56c4('0x77')],'priority':0x1})['then'](function(_0x45a42e){_0xce0938({'code':0xc8,'message':[_0x1e28b3[_0x56c4('0x5f')],_0x45a42e[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')});})[_0x56c4('0x1e')](function(_0x537f7e){_0x2f24ad(_0x9bbbbc['error'](0x1f5,[_0x1e28b3[_0x56c4('0x5f')],_0x537f7e[_0x56c4('0x1d')][_0x56c4('0x66')]()][_0x56c4('0x5b')]('\x20')));});}else{return _0x2f24ad(_0x9bbbbc[_0x56c4('0x13')](0x1f5,_0x56c4('0x6c')));}});},'Agents':function(_0x1300e3){return new Promise(function(_0x2f5b76,_0x51c8c5){var _0x4f2126=_[_0x56c4('0x78')](_0x24d839['agents']);_0x2f5b76({'count':_0x4f2126[_0x56c4('0x5a')],'rows':_0x4f2126});});},'Telephones':function(_0x45520e){return new Promise(function(_0x13c8ec,_0x2800f5){var _0x463ecd=_['values'](_0x24d839[_0x56c4('0x79')]);_0x13c8ec({'count':_0x463ecd[_0x56c4('0x5a')],'rows':_0x463ecd});});},'Trunks':function(_0x3a40f2){return new Promise(function(_0x4df8ac,_0x32b4eb){var _0x12f3dd=_[_0x56c4('0x78')](_0x24d839[_0x56c4('0x7a')]);_0x4df8ac({'count':_0x12f3dd[_0x56c4('0x5a')],'rows':_0x12f3dd});});},'OutboundChannels':function(_0x3293b3){return new Promise(function(_0x34c4e1,_0xca6015){var _0x507551=_['values'](_0x24d839['outboundChannels']);_0x34c4e1({'count':_0x507551['length'],'rows':_0x507551});});},'Outbound':function(_0x226b1c){return new Promise(function(_0x146aee,_0x2a29e0){_0x146aee(_0x24d839[_0x56c4('0x2e')]);});},'Campaigns':function(_0x2bba5c){return new Promise(function(_0xb2be11,_0x3a2a69){var _0x2e2d43=_[_0x56c4('0x78')](_0x24d839[_0x56c4('0x7b')]);_0xb2be11({'count':_0x2e2d43[_0x56c4('0x5a')],'rows':_0x2e2d43});});},'VoiceQueuesPreview':function(_0x4a8686){var _0x3202d6=this;return new Promise(function(_0xaa6920,_0x5a57f9){_0x1316a6[_0x56c4('0x7c')](_0x4a8686['id'])['then'](function(_0x43a81d){_0xaa6920({'code':0xc8,'message':_0x43a81d[_0x56c4('0x1d')]});})[_0x56c4('0x1e')](function(_0xb2158){_0x5a57f9(_0x3202d6[_0x56c4('0x13')](0x1f4,_0xb2158['message']));});});},'EventManager':function(_0xfee620){var _0xc4a2ab=this;return new Promise(function(_0x813103,_0x257593){if(!_0xfee620[_0x56c4('0x7d')]){return _0x257593(_0xc4a2ab[_0x56c4('0x13')](0x1f4,_0x56c4('0x7e')));}ami[_0x56c4('0x7f')](_0x56c4('0x80')+_0xfee620['event'],_0xfee620[_0x56c4('0x1d')]);_0x813103({'code':0xc8,'message':_0xfee620});});},'FaxAccounts':function(_0x343d49){return new Promise(function(_0x1b29ec,_0x271204){var _0x1cc090=_['values'](_0x24d839[_0x56c4('0x81')]);_0x1b29ec({'count':_0x1cc090[_0x56c4('0x5a')],'rows':_0x1cc090});});},'SendFax':function(_0x56a607){var _0x28d973=this;return new Promise(function(_0x551268,_0x5dae49){_0x3cc49e['send'](_0x56a607)['then'](function(_0xe5a367){_0x551268({'code':0xc8,'message':_0xe5a367[_0x56c4('0x1d')]});})['catch'](function(_0x3a3906){_0x5dae49(_0x28d973[_0x56c4('0x13')](0x1f4,_0x3a3906[_0x56c4('0x1d')]));});});},'CheckAfterSend':function(_0x592c1f){var _0x2d37a0=this;return new Promise(function(_0x116be3,_0xb11a95){_0x3cc49e['checkAfterSend'](_0x592c1f)[_0x56c4('0x1c')](function(_0xb64a11){_0x116be3({'code':0xc8,'message':_0xb64a11[_0x56c4('0x1d')]});})['catch'](function(_0x5dee4b){_0xb11a95(_0x2d37a0['error'](0x1f4,_0x5dee4b[_0x56c4('0x1d')]));});});}};var _0x182eb9=jayson[_0x56c4('0x82')](_0x1d0b9b)[_0x56c4('0x83')]();_0x182eb9['on'](_0x56c4('0x13'),function(_0xebea9){return _0x330e6(_0xebea9);});_0x182eb9[_0x56c4('0x8')](0x232a,_0x56c4('0x84'),function(){console[_0x56c4('0x85')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1fcb9e('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 077aa70..abccce4 100644 --- a/server/services/ami/trigger/cmContact/index.js +++ b/server/services/ami/trigger/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb077=['ioredis','util','../../../../config/environment','../../../../config/logger','trigger','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','phone','mobile','createdAt','scheduledAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','','calleridname','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xb077,0x1c6));var _0x7b07=function(_0x25f30e,_0x2cc50c){_0x25f30e=_0x25f30e-0x0;var _0x22241d=_0xb077[_0x25f30e];return _0x22241d;};'use strict';var _=require(_0x7b07('0x0'));var BPromise=require(_0x7b07('0x1'));var Redis=require(_0x7b07('0x2'));var util=require(_0x7b07('0x3'));var config=require(_0x7b07('0x4'));var logger=require(_0x7b07('0x5'))(_0x7b07('0x6'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x7b07('0x7')](config[_0x7b07('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x7b07('0x9'))(new Redis(config[_0x7b07('0x8')]));function emit(_0x6959ff,_0x68e367,_0x26c5e2,_0x57bf92,_0x4c82c5){logger[_0x7b07('0xa')](_0x7b07('0xb'),_0x6959ff,_0x68e367['id'],_0x26c5e2,_0x57bf92,JSON['stringify'](_0x4c82c5));io['to'](_0x26c5e2)[_0x7b07('0xc')](_0x57bf92,_0x4c82c5);}exports[_0x7b07('0xd')]=function(_0x503980,_0x5aeac9,_0x238490,_0x2c22a1){var _0x1a1f8c,_0x4c4333;var _0x33aadd={};var _0x3896ed;var _0x336663=Number(_0x238490[_0x7b07('0xe')]);var _0x3d20b2=_0x238490['data2']?Boolean(Number(_0x238490['data2'])):![];var _0x5a12b7;var _0x1dd25d=![];if(!_[_0x7b07('0xf')](_0x238490[_0x7b07('0x10')])){if(_0x238490['data5']=='1')_0x1dd25d=!![];}if(!_0x1dd25d){if(_0x2c22a1[_0x7b07('0x11')]){_0x33aadd['id']=_0x2c22a1[_0x7b07('0x11')];}}if(!_0x33aadd['id']){_0x33aadd[_0x7b07('0x12')]=_0x336663;_0x5a12b7=_0x238490['data3']&&_0x238490[_0x7b07('0x13')]!=='0'?_0x238490[_0x7b07('0x13')][_0x7b07('0x14')](','):['phone'];_0x33aadd[_0x7b07('0x15')]=_[_0x7b07('0x16')](_0x5a12b7,function(_0xbdc10c){var _0x28e01d={};_0x28e01d[_0xbdc10c]=_0x2c22a1[_0x7b07('0x17')]?_0x2c22a1['destcalleridnum']:_0x2c22a1[_0x7b07('0x18')];return _0x28e01d;});_0x3896ed=_0x2c22a1[_0x7b07('0x17')]?_0x2c22a1[_0x7b07('0x19')]:_0x2c22a1['calleridnum'];}var _0x5bf98b=['id',_0x7b07('0x1a'),_0x7b07('0x1b'),_0x7b07('0x1c'),_0x7b07('0x1d'),'fax','ListId',_0x7b07('0x1e'),_0x7b07('0x1f'),'updatedAt'];var _0x166cdc=_[_0x7b07('0x20')](_0x5bf98b,_0x5a12b7);BPromise['resolve']()[_0x7b07('0x21')](cmContactRpc['getContacts']({'attributes':_0x166cdc,'where':_0x33aadd,'phone':_0x3896ed}))[_0x7b07('0x21')](function(_0x51433e){_0x4c4333=_0x51433e;if(!_[_0x7b07('0x22')](_0x4c4333)){if(_0x4c4333[_0x7b07('0x23')]===0x1){_0x1a1f8c=_0x4c4333[0x0];logger[_0x7b07('0xa')](_0x7b07('0x24'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id'],_0x1a1f8c['id']);}else{logger[_0x7b07('0xa')](_0x7b07('0x26'),_0x2c22a1['uniqueid'],_0x5aeac9['id'],_[_0x7b07('0x16')](_0x4c4333,'id')['join'](','));}return;}else{logger[_0x7b07('0xa')](_0x7b07('0x27'),_0x2c22a1['uniqueid'],_0x5aeac9['id']);var _0x5f2fc0={'ListId':_0x336663};var _0xa0bd4c=_0x238490[_0x7b07('0x28')]&&_0x238490['data4']!=='0'?_0x238490[_0x7b07('0x28')]:_0x7b07('0x1c');if(_0x3d20b2){logger[_0x7b07('0xa')](_0x7b07('0x29'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id']);_0x5f2fc0[_0xa0bd4c]=_[_0x7b07('0xf')](_0x2c22a1[_0x7b07('0x17')])?_0x2c22a1[_0x7b07('0x18')]:_0x2c22a1[_0x7b07('0x19')];if(_['isNil'](_0x2c22a1[_0x7b07('0x17')])){_0x5f2fc0[_0x7b07('0x1a')]=_0x2c22a1['calleridname']&&_0x2c22a1['calleridname']!==_0x7b07('0x2a')?_0x2c22a1[_0x7b07('0x2b')]:_0x7b07('0x2c');}else{_0x5f2fc0['firstName']=_0x2c22a1[_0x7b07('0x2d')]&&_0x2c22a1[_0x7b07('0x2d')]!==''?_0x2c22a1[_0x7b07('0x2d')]:'Unknown';}return BPromise[_0x7b07('0x2e')]()[_0x7b07('0x21')](cmContactRpc[_0x7b07('0x2f')](_0x5f2fc0))[_0x7b07('0x21')](function(_0x536df7){_0x1a1f8c=_0x536df7;_0x4c4333[_0x7b07('0x30')](_0x536df7);if(_0x1a1f8c){logger[_0x7b07('0xa')](_0x7b07('0x31'),_0x2c22a1[_0x7b07('0x25')],_0x5aeac9['id'],_0x1a1f8c['id']);}return;});}else{logger[_0x7b07('0xa')](_0x7b07('0x32'),_0x2c22a1['uniqueid'],_0x5aeac9['id']);_0x5f2fc0[_0xa0bd4c]=_[_0x7b07('0xf')](_0x2c22a1['routeId'])?_0x2c22a1['calleridnum']:_0x2c22a1[_0x7b07('0x19')];if(_[_0x7b07('0xf')](_0x2c22a1[_0x7b07('0x17')])){_0x5f2fc0['firstName']=_0x2c22a1[_0x7b07('0x2b')]&&_0x2c22a1['calleridname']!==''?_0x2c22a1[_0x7b07('0x2b')]:_0x7b07('0x2c');}else{_0x5f2fc0[_0x7b07('0x1a')]=_0x2c22a1[_0x7b07('0x2d')]&&_0x2c22a1[_0x7b07('0x2d')]!==_0x7b07('0x2a')?_0x2c22a1[_0x7b07('0x2d')]:_0x7b07('0x2c');}_0x1a1f8c=_0x5f2fc0;_0x4c4333[_0x7b07('0x30')](_0x5f2fc0);return;}}})[_0x7b07('0x21')](function(){if(_0x503980){emit(_0x2c22a1[_0x7b07('0x25')],_0x5aeac9,util['format']('user:%s',_0x503980[_0x7b07('0x33')]),util[_0x7b07('0x34')](_0x7b07('0x35'),_0x238490[_0x7b07('0x36')][_0x7b07('0x37')]()),{'evt':_[_0x7b07('0x38')](_0x2c22a1,{'autoCreate':_0x3d20b2}),'contact':_0x1a1f8c===undefined?{}:_0x1a1f8c,'contacts':_0x4c4333['length']===0x0?undefined:_0x4c4333});}});}; \ No newline at end of file +var _0xb06f=['[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data2','isNil','data5','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','then','getContacts','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join'];(function(_0x3b3c7e,_0xdb900a){var _0x4eca57=function(_0x549edc){while(--_0x549edc){_0x3b3c7e['push'](_0x3b3c7e['shift']());}};_0x4eca57(++_0xdb900a);}(_0xb06f,0x86));var _0xfb06=function(_0x43d897,_0x1bcac4){_0x43d897=_0x43d897-0x0;var _0x95f9ee=_0xb06f[_0x43d897];return _0x95f9ee;};'use strict';var _=require(_0xfb06('0x0'));var BPromise=require(_0xfb06('0x1'));var Redis=require(_0xfb06('0x2'));var util=require(_0xfb06('0x3'));var config=require(_0xfb06('0x4'));var logger=require(_0xfb06('0x5'))('trigger');var cmContactRpc=require(_0xfb06('0x6'));config[_0xfb06('0x7')]=_[_0xfb06('0x8')](config[_0xfb06('0x7')],{'host':_0xfb06('0x9'),'port':0x18eb});var io=require(_0xfb06('0xa'))(new Redis(config['redis']));function emit(_0x12bf23,_0x4142d0,_0x59936f,_0x54e5ce,_0x494fa9){logger[_0xfb06('0xb')]('[CM][%s][%s]',_0x12bf23,_0x4142d0['id'],_0x59936f,_0x54e5ce,JSON[_0xfb06('0xc')](_0x494fa9));io['to'](_0x59936f)[_0xfb06('0xd')](_0x54e5ce,_0x494fa9);}exports[_0xfb06('0xe')]=function(_0x810715,_0x40653a,_0x292818,_0x530e96){var _0x4cee70,_0x2d147d;var _0x3c7b5a={};var _0x953ba1;var _0x312bfa=Number(_0x292818['data1']);var _0x253f12=_0x292818[_0xfb06('0xf')]?Boolean(Number(_0x292818[_0xfb06('0xf')])):![];var _0x1275d9;var _0x25db0b=![];if(!_[_0xfb06('0x10')](_0x292818['data5'])){if(_0x292818[_0xfb06('0x11')]=='1')_0x25db0b=!![];}if(!_0x25db0b){if(_0x530e96['xmd-contactid']){_0x3c7b5a['id']=_0x530e96['xmd-contactid'];}}if(!_0x3c7b5a['id']){_0x3c7b5a[_0xfb06('0x12')]=_0x312bfa;_0x1275d9=_0x292818['data3']&&_0x292818[_0xfb06('0x13')]!=='0'?_0x292818[_0xfb06('0x13')][_0xfb06('0x14')](','):[_0xfb06('0x15')];_0x3c7b5a[_0xfb06('0x16')]=_[_0xfb06('0x17')](_0x1275d9,function(_0xd10576){var _0x5ca916={};_0x5ca916[_0xd10576]=_0x530e96[_0xfb06('0x18')]?_0x530e96[_0xfb06('0x19')]:_0x530e96[_0xfb06('0x1a')];return _0x5ca916;});_0x953ba1=_0x530e96[_0xfb06('0x18')]?_0x530e96[_0xfb06('0x19')]:_0x530e96[_0xfb06('0x1a')];}var _0x2d1c5f=['id',_0xfb06('0x1b'),_0xfb06('0x1c'),_0xfb06('0x15'),_0xfb06('0x1d'),'fax',_0xfb06('0x12'),_0xfb06('0x1e'),_0xfb06('0x1f'),_0xfb06('0x20')];var _0x4487cb=_[_0xfb06('0x21')](_0x2d1c5f,_0x1275d9);BPromise['resolve']()[_0xfb06('0x22')](cmContactRpc[_0xfb06('0x23')]({'attributes':_0x4487cb,'where':_0x3c7b5a,'phone':_0x953ba1}))['then'](function(_0x4363c1){_0x2d147d=_0x4363c1;if(!_['isEmpty'](_0x2d147d)){if(_0x2d147d[_0xfb06('0x24')]===0x1){_0x4cee70=_0x2d147d[0x0];logger[_0xfb06('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x530e96[_0xfb06('0x25')],_0x40653a['id'],_0x4cee70['id']);}else{logger[_0xfb06('0xb')](_0xfb06('0x26'),_0x530e96[_0xfb06('0x25')],_0x40653a['id'],_[_0xfb06('0x17')](_0x2d147d,'id')[_0xfb06('0x27')](','));}return;}else{logger[_0xfb06('0xb')](_0xfb06('0x28'),_0x530e96['uniqueid'],_0x40653a['id']);var _0x39efc4={'ListId':_0x312bfa};var _0x4dcda3=_0x292818['data4']&&_0x292818[_0xfb06('0x29')]!=='0'?_0x292818[_0xfb06('0x29')]:_0xfb06('0x15');if(_0x253f12){logger[_0xfb06('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x530e96[_0xfb06('0x25')],_0x40653a['id']);_0x39efc4[_0x4dcda3]=_['isNil'](_0x530e96[_0xfb06('0x18')])?_0x530e96[_0xfb06('0x1a')]:_0x530e96[_0xfb06('0x19')];if(_[_0xfb06('0x10')](_0x530e96[_0xfb06('0x18')])){_0x39efc4[_0xfb06('0x1b')]=_0x530e96[_0xfb06('0x2a')]&&_0x530e96[_0xfb06('0x2a')]!==_0xfb06('0x2b')?_0x530e96[_0xfb06('0x2a')]:_0xfb06('0x2c');}else{_0x39efc4[_0xfb06('0x1b')]=_0x530e96[_0xfb06('0x2d')]&&_0x530e96[_0xfb06('0x2d')]!==''?_0x530e96['destcalleridname']:_0xfb06('0x2c');}return BPromise[_0xfb06('0x2e')]()[_0xfb06('0x22')](cmContactRpc[_0xfb06('0x2f')](_0x39efc4))['then'](function(_0x22dbc7){_0x4cee70=_0x22dbc7;_0x2d147d[_0xfb06('0x30')](_0x22dbc7);if(_0x4cee70){logger[_0xfb06('0xb')](_0xfb06('0x31'),_0x530e96[_0xfb06('0x25')],_0x40653a['id'],_0x4cee70['id']);}return;});}else{logger[_0xfb06('0xb')](_0xfb06('0x32'),_0x530e96[_0xfb06('0x25')],_0x40653a['id']);_0x39efc4[_0x4dcda3]=_['isNil'](_0x530e96['routeId'])?_0x530e96[_0xfb06('0x1a')]:_0x530e96['destcalleridnum'];if(_[_0xfb06('0x10')](_0x530e96['routeId'])){_0x39efc4[_0xfb06('0x1b')]=_0x530e96[_0xfb06('0x2a')]&&_0x530e96['calleridname']!==_0xfb06('0x2b')?_0x530e96['calleridname']:'Unknown';}else{_0x39efc4[_0xfb06('0x1b')]=_0x530e96[_0xfb06('0x2d')]&&_0x530e96[_0xfb06('0x2d')]!==''?_0x530e96[_0xfb06('0x2d')]:_0xfb06('0x2c');}_0x4cee70=_0x39efc4;_0x2d147d[_0xfb06('0x30')](_0x39efc4);return;}}})['then'](function(){if(_0x810715){emit(_0x530e96[_0xfb06('0x25')],_0x40653a,util[_0xfb06('0x33')](_0xfb06('0x34'),_0x810715[_0xfb06('0x35')]),util[_0xfb06('0x33')](_0xfb06('0x36'),_0x292818[_0xfb06('0x37')][_0xfb06('0x38')]()),{'evt':_[_0xfb06('0x39')](_0x530e96,{'autoCreate':_0x253f12}),'contact':_0x4cee70===undefined?{}:_0x4cee70,'contacts':_0x2d147d[_0xfb06('0x24')]===0x0?undefined:_0x2d147d});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7bbeaf6..235628d 100644 --- a/server/services/ami/trigger/index.js +++ b/server/services/ami/trigger/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x597a=['ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','agent','membername','lastevent','mailSubstatus','null','substatus','created','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialend','custom:closedinteraction','custom:substatus','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','clone','motionChannel','undefined','voice','checkTriggers','hasOwnProperty','status','checkTrigger','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winapp','winApplication','winArguments','render','format','user:%s','interface','name','action','merge','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','AllConditions','checkConditions','AnyConditions','field','account','chat'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x597a,0x10e));var _0xa597=function(_0x2aa291,_0xda03df){_0x2aa291=_0x2aa291-0x0;var _0x2eb822=_0x597a[_0x2aa291];return _0x2eb822;};'use strict';var util=require(_0xa597('0x0'));var _=require(_0xa597('0x1'));var url=require(_0xa597('0x2'));var Mustache=require(_0xa597('0x3'));var Redis=require('ioredis');var urlforward=require(_0xa597('0x4'));var integration=require(_0xa597('0x5'));var cmContact=require(_0xa597('0x6'));var script=require('./script');var config=require(_0xa597('0x7'));var logger=require(_0xa597('0x8'))(_0xa597('0x9'));var ami=require('../ami');config[_0xa597('0xa')]=_[_0xa597('0xb')](config['redis'],{'host':_0xa597('0xc'),'port':0x18eb});var io=require(_0xa597('0xd'))(new Redis(config[_0xa597('0xa')]));var operators={'equals':function(_0x53ae75,_0x1cc504){return _0x53ae75==_0x1cc504;},'not_equals':function(_0x212dc2,_0x20c731){return _0x212dc2!=_0x20c731;}};var barAndWebActions=[_0xa597('0xe'),_0xa597('0x2'),'winapp'];function Trigger(_0x239976){this['triggers']=_0x239976[_0xa597('0xf')];this['agents']=_0x239976[_0xa597('0x10')];this['voiceQueues']=_0x239976[_0xa597('0x11')];this[_0xa597('0x12')]=_0x239976['templates'];this[_0xa597('0x13')]=_0x239976[_0xa597('0x13')];this[_0xa597('0x14')]=_0x239976[_0xa597('0x14')];this['freshdeskAccounts']=_0x239976[_0xa597('0x15')];this[_0xa597('0x16')]=_0x239976['salesforceAccounts'];this[_0xa597('0x17')]=_0x239976[_0xa597('0x17')];this['zohoAccounts']=_0x239976[_0xa597('0x18')];this[_0xa597('0x19')]=_0x239976[_0xa597('0x19')];this['vtigerAccounts']=_0x239976['vtigerAccounts'];this[_0xa597('0x1a')]=_0x239976[_0xa597('0x1a')];this[_0xa597('0x1b')]=_0x239976[_0xa597('0x1b')];this[_0xa597('0x1c')]=_0x239976[_0xa597('0x1c')];this[_0xa597('0x1d')]={'zendesk':this[_0xa597('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xa597('0x15')],'sugarcrm':this[_0xa597('0x17')],'zoho':this[_0xa597('0x18')],'desk':this[_0xa597('0x19')],'vtiger':this[_0xa597('0x1e')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xa597('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0xa597('0x1f'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x22'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x23'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x24'),this[_0xa597('0x20')]['bind'](this));ami['on'](_0xa597('0x25'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x26'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x27'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on']('custom:agentcongestion',this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x28'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x29'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x2a'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x2b'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on']('custom:dialbegin',this[_0xa597('0x2c')]['bind'](this));ami['on']('custom:dialconnect',this[_0xa597('0x2c')]['bind'](this));ami['on'](_0xa597('0x2d'),this[_0xa597('0x2c')][_0xa597('0x21')](this));ami['on']('custom:newinteraction',this['syncCustomEvent'][_0xa597('0x21')](this));ami['on'](_0xa597('0x2e'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x2f'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on']('custom:incomingmessage',this[_0xa597('0x20')]['bind'](this));ami['on'](_0xa597('0x30'),this[_0xa597('0x20')][_0xa597('0x21')](this));ami['on'](_0xa597('0x31'),this['syncCustomEvent'][_0xa597('0x21')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xa597('0x21')](this));ami['on'](_0xa597('0x32'),this[_0xa597('0x20')][_0xa597('0x21')](this));}Trigger[_0xa597('0x33')][_0xa597('0x34')]=function(_0x3d512e,_0x1ee4f7,_0x4e42a5){logger[_0xa597('0x35')](_0x3d512e,_0x1ee4f7,JSON['stringify'](_0x4e42a5));io['to'](_0x3d512e)[_0xa597('0x34')](_0x1ee4f7,_0x4e42a5);};Trigger[_0xa597('0x33')][_0xa597('0x20')]=function(_0x4008e6){var _0x5b561=_[_0xa597('0x36')](_0x4008e6);if(typeof _0x5b561[_0xa597('0x37')]===_0xa597('0x38')){_0x5b561[_0xa597('0x37')]=_0xa597('0x39');}this[_0xa597('0x3a')](_0x5b561);};Trigger[_0xa597('0x33')][_0xa597('0x2c')]=function(_0x594000){if(this[_0xa597('0x10')][_0x594000['interface']]){this[_0xa597('0x20')](_0x594000);}};Trigger[_0xa597('0x33')]['checkTriggers']=function(_0x357d34){var _0x864501;for(var _0x1d9548 in this['triggers']){if(this[_0xa597('0xf')][_0xa597('0x3b')](_0x1d9548)){if(this[_0xa597('0xf')][_0x1d9548][_0xa597('0x3c')]){_0x864501=this[_0xa597('0x3d')](this[_0xa597('0xf')][_0x1d9548],_0x357d34);if(_0x864501){_['merge'](_0x357d34,_0x357d34[_0xa597('0x3e')]);for(var _0x194d78=0x0,_0x4b6080,_0x44cf13,_0x1f463e;_0x194d780x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x1d0665,_0x1efe0b){var _0x16c7d9=function(_0x1ba010){while(--_0x1ba010){_0x1d0665['push'](_0x1d0665['shift']());}};_0x16c7d9(++_0x1efe0b);}(_0x3e74,0x175));var _0x43e7=function(_0x509213,_0x42e8d5){_0x509213=_0x509213-0x0;var _0x5d9033=_0x3e74[_0x509213];return _0x5d9033;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 940e421..4590e7d 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ee5=['forEach','includes','picklist','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','/contacts(','Fields','callDirection','queue','phonecalls','Descriptions','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','POST','clientId','password','clientSecret','then','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!'];(function(_0x42c7bf,_0x5ed895){var _0x32cafc=function(_0x19d617){while(--_0x19d617){_0x42c7bf['push'](_0x42c7bf['shift']());}};_0x32cafc(++_0x5ed895);}(_0x7ee5,0xa4));var _0x57ee=function(_0x57560d,_0x215718){_0x57560d=_0x57560d-0x0;var _0x50b44a=_0x7ee5[_0x57560d];return _0x50b44a;};'use strict';var _=require(_0x57ee('0x0'));var rp=require('request-promise');var util=require(_0x57ee('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x57ee('0x2'));var logger=require('../../../../config/logger')(_0x57ee('0x3'));var config=require(_0x57ee('0x4'));config[_0x57ee('0x5')]=_[_0x57ee('0x6')](config['redis'],{'host':_0x57ee('0x7'),'port':0x18eb});var io=require(_0x57ee('0x8'))(new Redis(config[_0x57ee('0x5')]));function getAuthToken(_0x5ad128,_0xea57d2,_0x5116ce){if(_0x5ad128[_0x57ee('0x9')]){_0x5ad128[_0x57ee('0xa')]=_0x5ad128[_0x57ee('0xb')][_0x57ee('0xc')];_0x5ad128['tenantId']=_0x5ad128['CloudProvider'][_0x57ee('0xd')];return Promise[_0x57ee('0xe')](_0x5ad128[_0x57ee('0xb')]['data5']);}var _0x5eb6ca={'method':_0x57ee('0xf'),'uri':_0xea57d2,'form':{'client_id':_0x5ad128[_0x57ee('0x10')],'resource':_0x5ad128[_0x57ee('0xa')],'username':_0x5ad128['username'],'password':_0x5ad128[_0x57ee('0x11')],'grant_type':_0x57ee('0x11'),'client_secret':_0x5ad128[_0x57ee('0x12')]},'json':!![]};return rp(_0x5eb6ca)[_0x57ee('0x13')](function(_0x47a8b1){return _0x47a8b1['access_token'];})[_0x57ee('0x14')](function(_0x488e8c){logger[_0x57ee('0x15')]('['+[_0x5116ce[_0x57ee('0x16')]()]+']\x20Wrong\x20credentials!');return _0x488e8c[_0x57ee('0x17')];});}function getUser(_0x762d4a,_0xbb6819,_0x4d5118,_0x3eb32d,_0x25c201,_0x1beb25){return new Promise(function(_0x106fd0,_0x3e7471){return getAuthToken(_0xbb6819,_0x3eb32d,_0x1beb25)[_0x57ee('0x13')](function(_0x2e2736){var _0x4ca6ac={'method':_0x57ee('0x18'),'uri':_0x25c201+_0x57ee('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x2e2736,'OData-Version':_0x57ee('0x1a')},'json':!![]};return rp(_0x4ca6ac);})['then'](function(_0x231e14){var _0x1261f9=_0x231e14[_0x57ee('0x1b')];var _0x377995=![];var _0x28a14e=null;if(!_[_0x57ee('0x1c')](_0x4d5118)){if(intUtil[_0x57ee('0x1d')](_0x4d5118['email'])){_0x762d4a['userEmail']=_0x4d5118[_0x57ee('0x1e')];for(_0x28a14e=0x0;_0x28a14e<_0x1261f9[_0x57ee('0x1f')];_0x28a14e++){if(_0x1261f9[_0x28a14e]['internalemailaddress']===_0x4d5118[_0x57ee('0x1e')]&&!_0x1261f9[_0x28a14e][_0x57ee('0x20')]){_0x377995=!![];logger['info']('['+[_0x1beb25[_0x57ee('0x16')]()]+_0x57ee('0x21')+_0x1261f9[_0x28a14e]['systemuserid']+'!');_0x762d4a[_0x57ee('0x22')]=_0x1261f9[_0x28a14e][_0x57ee('0x23')];}}}}if(!_0x377995){logger[_0x57ee('0x24')]('['+[_0x1beb25['toUpperCase']()]+_0x57ee('0x25'));_0x762d4a['userEmail']=_0xbb6819['username'];for(_0x28a14e=0x0;_0x28a14e<_0x1261f9[_0x57ee('0x1f')];_0x28a14e++){if(_0x1261f9[_0x28a14e][_0x57ee('0x26')]===_0xbb6819[_0x57ee('0x27')]){_0x762d4a[_0x57ee('0x22')]=_0x1261f9[_0x28a14e][_0x57ee('0x23')];}}}_0x106fd0(_0x762d4a);})[_0x57ee('0x14')](function(_0x1aefbb){_0x3e7471(_0x1aefbb[_0x57ee('0x17')]);});});}function createEndUser(_0x22f1e2,_0x1badac,_0x2aaeda,_0x3c56d2,_0x1dfc8c,_0x3428b5,_0x2efea6){return new Promise(function(_0x154aa3,_0x1175df){return getAuthToken(_0x1badac,_0x2aaeda,_0x3428b5)[_0x57ee('0x13')](function(_0x2f20b6){var _0x2acfa7=_0x3428b5[_0x57ee('0x28')]()===_0x57ee('0x29')?_0x1dfc8c[_0x57ee('0x2a')]:_0x1dfc8c[_0x57ee('0x2b')];var _0x27d711={'method':'POST','uri':_0x3c56d2+_0x57ee('0x2c'),'body':{'fullname':_0x2acfa7,'firstname':_0x2acfa7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x57ee('0x2d')+_0x22f1e2[_0x57ee('0x22')]+')'},'headers':{'Authorization':_0x57ee('0x2e')+_0x2f20b6,'OData-Version':_0x57ee('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x27d711[_0x57ee('0x2f')][_0x2efea6]=_0x2acfa7;return rp(_0x27d711);})[_0x57ee('0x13')](function(_0x1f465e){var _0x385464=_0x1f465e[_0x57ee('0x30')][_0x57ee('0x31')];var _0x51d46e=_0x385464['substring'](_0x385464['lastIndexOf']('(')+0x1,_0x385464[_0x57ee('0x32')](')'));_0x22f1e2[_0x57ee('0x33')]=_0x51d46e;_0x154aa3(_0x22f1e2);})[_0x57ee('0x14')](function(_0x4c701b){_0x1175df(_0x4c701b[_0x57ee('0x17')]);});});}function getEndUser(_0x1a94c6,_0x40f98c,_0x270645,_0x342bb8,_0x4fe882,_0x14dd28,_0x4aefba,_0x377ef8){var _0x420438=_0x14dd28[_0x57ee('0x28')]()===_0x57ee('0x29')?_0x4fe882[_0x57ee('0x2a')]:_0x4fe882[_0x57ee('0x2b')];return getAuthToken(_0x40f98c,_0x270645,_0x14dd28)['then'](function(_0x5d84b8){_0x377ef8=_0x377ef8?_0x377ef8:_0x57ee('0x34');var _0x444813={'method':_0x57ee('0x18'),'uri':_0x342bb8+_0x57ee('0x35')+_0x377ef8+'&$filter='+_0x377ef8+_0x57ee('0x36')+_0x420438[_0x57ee('0x37')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5d84b8,'If-None-Match':null,'OData-Version':_0x57ee('0x1a')},'json':!![]};return rp(_0x444813);})[_0x57ee('0x13')](function(_0x3bf568){var _0x47c5e9=![];if(!_0x3bf568)return _0x47c5e9;var _0x31cab3=_0x3bf568[_0x57ee('0x1b')];for(var _0x475e80=0x0;_0x475e80<_0x31cab3[_0x57ee('0x1f')];_0x475e80++){if(_0x31cab3[_0x475e80][_0x377ef8]===_0x420438){_0x47c5e9=!![];_0x1a94c6[_0x57ee('0x33')]=_0x31cab3[_0x475e80][_0x57ee('0x38')];}}return _0x47c5e9;})[_0x57ee('0x13')](function(_0x5ec56d){if(_0x5ec56d)return _0x1a94c6;if(_0x4aefba===_0x57ee('0x39')){logger[_0x57ee('0x24')]('['+[_0x14dd28[_0x57ee('0x16')]()]+_0x57ee('0x3a'));return _0x1a94c6;}return createEndUser(_0x1a94c6,_0x40f98c,_0x270645,_0x342bb8,_0x4fe882,_0x14dd28,_0x377ef8)[_0x57ee('0x13')](function(_0x220ca4){logger['info']('['+[_0x14dd28[_0x57ee('0x16')]()]+_0x57ee('0x3b'),_0x220ca4[_0x57ee('0x33')]);return _0x220ca4;});});}function getCustomFields(_0x15943f,_0x5ece13,_0x15f0fc){var _0x3cc967={};if(_0x15943f[_0x57ee('0x1f')]>0x0){_[_0x57ee('0x3c')](_0x15943f,function(_0xcb3ff8){if(_[_0x57ee('0x3d')](['string',_0x57ee('0x3e')],_0xcb3ff8['type'])&&_0xcb3ff8[_0x57ee('0x3f')]&&!_0xcb3ff8[_0x57ee('0x40')]){var _0x5197c5=_0xcb3ff8[_0x57ee('0x41')][_0x57ee('0x28')]();var _0xbe2f01=_0x5197c5[_0x57ee('0x42')](0x0,_0x5197c5[_0x57ee('0x43')]('_'));var _0x3f6dba=_0x5197c5[_0x57ee('0x42')](_0x5197c5['indexOf']('_')+0x1);if(_0xbe2f01===_0x15f0fc){_0x3cc967[_0x3f6dba]=_0xcb3ff8[_0x57ee('0x44')];}}});}return _0x3cc967;}function getTicket(_0x34befb,_0x175477,_0x5044f7,_0x5ca8bb,_0x1bcda0,_0xf40a9f,_0x25f322){return new Promise(function(_0x53dbb2,_0x317df4){var _0x29556d;return getAuthToken(_0x175477,_0x5044f7,_0x25f322)['then'](function(_0x594e98){if(_0xf40a9f[_0x57ee('0x45')]===_0x57ee('0x46')){_0x29556d={'method':_0x57ee('0xf'),'uri':_0x5ca8bb+_0x57ee('0x47'),'body':Object[_0x57ee('0x48')]({},{'title':intUtil['getString'](_0xf40a9f[_0x57ee('0x49')],_0x1bcda0,'\x20'),'description':intUtil[_0x57ee('0x4a')](_0xf40a9f['Descriptions'],_0x1bcda0,'\x0a'),'customerid_contact@odata.bind':_0x34befb[_0x57ee('0x33')]?_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')':undefined,'ownerid@odata.bind':_0x57ee('0x2d')+_0x34befb['userId']+')','caseorigincode':'1'},getCustomFields(_0xf40a9f[_0x57ee('0x4c')],_0x1bcda0,_0xf40a9f[_0x57ee('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x594e98,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xf40a9f['ticketType']==='phonecall'){var _0x1b5f60=_0x34befb[_0x57ee('0x33')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x34befb['userId']+')','participationtypemask':_0x34befb['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')','participationtypemask':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x57ee('0x2d')+_0x34befb[_0x57ee('0x22')]+')','participationtypemask':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?0x2:0x1}];_0x29556d={'method':'POST','uri':_0x5ca8bb+_0x57ee('0x4f'),'body':Object[_0x57ee('0x48')]({},{'subject':intUtil[_0x57ee('0x4a')](_0xf40a9f[_0x57ee('0x49')],_0x1bcda0,'\x20'),'phonenumber':String(_0x1bcda0[_0x57ee('0x2b')]),'description':intUtil[_0x57ee('0x4a')](_0xf40a9f[_0x57ee('0x50')],_0x1bcda0,'\x0a'),'regardingobjectid_contact@odata.bind':_0x34befb[_0x57ee('0x33')]?_0x57ee('0x4b')+_0x34befb[_0x57ee('0x33')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x34befb['userId']+')','directioncode':_0x34befb[_0x57ee('0x4d')]===_0x57ee('0x4e')?![]:!![],'phonecall_activity_parties':_0x1b5f60},getCustomFields(_0xf40a9f['Fields'],_0x1bcda0,_0xf40a9f[_0x57ee('0x45')])),'headers':{'Authorization':_0x57ee('0x2e')+_0x594e98,'OData-Version':_0x57ee('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x29556d);})[_0x57ee('0x13')](function(_0x53b49f){var _0x19aebb=_0x53b49f[_0x57ee('0x30')][_0x57ee('0x31')];var _0xe9daac=_0x19aebb[_0x57ee('0x42')](_0x19aebb[_0x57ee('0x32')]('(')+0x1,_0x19aebb[_0x57ee('0x32')](')'));_0x34befb['ticketId']=_0xe9daac;_0x53dbb2(_0x34befb);})[_0x57ee('0x14')](function(_0x1f5d66){_0x317df4(_0x1f5d66[_0x57ee('0x17')]);});});}function emit(_0x2fc357,_0x5a5877,_0xd93bbf,_0x4f109a){var _0x22f785={'uri':util['format'](_0x57ee('0x51'),_0x2fc357,_0xd93bbf,_0x4f109a)};io['to'](util[_0x57ee('0x52')]('user:%s',_0x5a5877))[_0x57ee('0x53')](_0x57ee('0x54'),_0x22f785);}exports['cs']=function(_0x6357de,_0x39b96b,_0x520f0b,_0x1d005c,_0x8eb0e,_0x40bdd3,_0x459e79,_0x52d261){var _0x28c182={};_0x40bdd3[_0x57ee('0xa')]=_0x40bdd3[_0x57ee('0x9')]?intUtil[_0x57ee('0x55')](_0x40bdd3['CloudProvider'][_0x57ee('0xc')]):intUtil[_0x57ee('0x55')](_0x40bdd3[_0x57ee('0xa')]);_0x40bdd3[_0x57ee('0x56')]=intUtil[_0x57ee('0x55')](_0x40bdd3[_0x57ee('0x56')]);_0x28c182[_0x57ee('0x4d')]=_0x52d261==='queue'||_0x52d261===_0x57ee('0x57')?_0x57ee('0x4e'):_0x57ee('0x29');var _0x1e5042=_0x40bdd3[_0x57ee('0x9')]?util[_0x57ee('0x52')](_0x57ee('0x58'),_0x40bdd3[_0x57ee('0xb')]['data7']):util[_0x57ee('0x52')](_0x57ee('0x58'),_0x40bdd3[_0x57ee('0xa')]);var _0x69b21b=util['format'](_0x57ee('0x59'),_0x40bdd3[_0x57ee('0x5a')]);var _0x30306c=util['format'](_0x57ee('0x5b'),_0x40bdd3['serverUrl'],_0x39b96b[_0x57ee('0x5c')],md5(_0x39b96b['uniqueid']));if(_0x8eb0e&&_0x8eb0e[_0x57ee('0x5d')]){logger[_0x57ee('0x24')](_0x57ee('0x5e'),_0x57ee('0x5f'));_0x39b96b['recordingURL']=_0x30306c;}else if(_0x459e79&&_0x459e79[_0x57ee('0x60')]&&_0x459e79[_0x57ee('0x60')]!==_0x57ee('0x61')){logger[_0x57ee('0x24')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x39b96b[_0x57ee('0x62')]=_0x30306c;}else{_0x39b96b[_0x57ee('0x62')]='';}return getUser(_0x28c182,_0x40bdd3,_0x1d005c,_0x69b21b,_0x1e5042,_0x52d261)[_0x57ee('0x13')](function(_0x23cb8f){logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x63'),_0x23cb8f['userId']);logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x64'),_0x23cb8f[_0x57ee('0x65')]);return getEndUser(_0x23cb8f,_0x40bdd3,_0x69b21b,_0x1e5042,_0x39b96b,_0x52d261,_0x520f0b[_0x57ee('0x66')],_0x520f0b[_0x57ee('0x67')]);})['then'](function(_0x541297){logger[_0x57ee('0x24')]('['+_0x52d261['toUpperCase']()+_0x57ee('0x68'),_0x541297[_0x57ee('0x33')]);logger['info']('['+_0x52d261['toUpperCase']()+_0x57ee('0x69'),_0x39b96b[_0x57ee('0x2b')]);return getTicket(_0x541297,_0x40bdd3,_0x69b21b,_0x1e5042,_0x39b96b,_0x520f0b,_0x52d261);})[_0x57ee('0x13')](function(_0x5cf3bc){logger[_0x57ee('0x24')](util[_0x57ee('0x52')]('['+_0x52d261[_0x57ee('0x16')]()+_0x57ee('0x6a'),_0x520f0b[_0x57ee('0x45')],_0x5cf3bc[_0x57ee('0x6b')]));logger[_0x57ee('0x24')](util[_0x57ee('0x52')]('['+_0x52d261[_0x57ee('0x16')]()+_0x57ee('0x6c'),_0x52d261));if(_0x52d261!==_0x57ee('0x57')&&_0x520f0b[_0x57ee('0x6d')]){logger[_0x57ee('0x24')]('['+_0x52d261[_0x57ee('0x16')]()+']',_0x57ee('0x6e'));emit(_0x40bdd3['remoteUri'],_0x1d005c[_0x57ee('0x6f')],_0x520f0b[_0x57ee('0x45')],_0x5cf3bc[_0x57ee('0x6b')]);}})['catch'](function(_0x5312ae){logger[_0x57ee('0x15')]('['+_0x52d261[_0x57ee('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x5312ae[_0x57ee('0x17')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x5312ae);});}; \ No newline at end of file +var _0xc248=['uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:','calleridnum',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','email','length','isdisabled','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing','includes','picklist','nameField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','queue','callDirection','phonecalls','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0xabc8f1,_0x49fd0d){var _0x535c1a=function(_0x2843ee){while(--_0x2843ee){_0xabc8f1['push'](_0xabc8f1['shift']());}};_0x535c1a(++_0x49fd0d);}(_0xc248,0xed));var _0x8c24=function(_0x2b2fbe,_0x176c87){_0x2b2fbe=_0x2b2fbe-0x0;var _0x9f9a6=_0xc248[_0x2b2fbe];return _0x9f9a6;};'use strict';var _=require(_0x8c24('0x0'));var rp=require(_0x8c24('0x1'));var util=require('util');var intUtil=require(_0x8c24('0x2'));var md5=require(_0x8c24('0x3'));var Redis=require('ioredis');var logger=require(_0x8c24('0x4'))('dynamics365');var config=require(_0x8c24('0x5'));config[_0x8c24('0x6')]=_[_0x8c24('0x7')](config[_0x8c24('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x8c24('0x8'))(new Redis(config[_0x8c24('0x6')]));function getAuthToken(_0x15229e,_0x3606c4,_0x400469){if(_0x15229e[_0x8c24('0x9')]){_0x15229e[_0x8c24('0xa')]=_0x15229e[_0x8c24('0xb')][_0x8c24('0xc')];_0x15229e[_0x8c24('0xd')]=_0x15229e['CloudProvider'][_0x8c24('0xe')];return Promise[_0x8c24('0xf')](_0x15229e['CloudProvider'][_0x8c24('0x10')]);}var _0xa575e7={'method':_0x8c24('0x11'),'uri':_0x3606c4,'form':{'client_id':_0x15229e['clientId'],'resource':_0x15229e[_0x8c24('0xa')],'username':_0x15229e['username'],'password':_0x15229e['password'],'grant_type':_0x8c24('0x12'),'client_secret':_0x15229e['clientSecret']},'json':!![]};return rp(_0xa575e7)[_0x8c24('0x13')](function(_0x221b48){return _0x221b48[_0x8c24('0x14')];})[_0x8c24('0x15')](function(_0x46fcf0){logger[_0x8c24('0x16')]('['+[_0x400469['toUpperCase']()]+_0x8c24('0x17'));return _0x46fcf0[_0x8c24('0x18')];});}function getUser(_0x23ab1e,_0x11f3e8,_0x19bde9,_0xa5d05b,_0x36f072,_0x544b96){return new Promise(function(_0x3c05c3,_0x2327ca){return getAuthToken(_0x11f3e8,_0xa5d05b,_0x544b96)[_0x8c24('0x13')](function(_0x443d86){var _0x30b7f2={'method':_0x8c24('0x19'),'uri':_0x36f072+_0x8c24('0x1a'),'headers':{'Authorization':'Bearer\x20'+_0x443d86,'OData-Version':_0x8c24('0x1b')},'json':!![]};return rp(_0x30b7f2);})[_0x8c24('0x13')](function(_0x56dc69){var _0x1043ba=_0x56dc69['value'];var _0x499577=![];var _0x72c227=null;if(!_[_0x8c24('0x1c')](_0x19bde9)){if(intUtil[_0x8c24('0x1d')](_0x19bde9[_0x8c24('0x1e')])){_0x23ab1e['userEmail']=_0x19bde9[_0x8c24('0x1e')];for(_0x72c227=0x0;_0x72c227<_0x1043ba[_0x8c24('0x1f')];_0x72c227++){if(_0x1043ba[_0x72c227]['internalemailaddress']===_0x19bde9[_0x8c24('0x1e')]&&!_0x1043ba[_0x72c227][_0x8c24('0x20')]){_0x499577=!![];logger['info']('['+[_0x544b96[_0x8c24('0x21')]()]+_0x8c24('0x22')+_0x1043ba[_0x72c227][_0x8c24('0x23')]+'!');_0x23ab1e[_0x8c24('0x24')]=_0x1043ba[_0x72c227][_0x8c24('0x23')];}}}}if(!_0x499577){logger[_0x8c24('0x25')]('['+[_0x544b96['toUpperCase']()]+_0x8c24('0x26'));_0x23ab1e[_0x8c24('0x27')]=_0x11f3e8['username'];for(_0x72c227=0x0;_0x72c227<_0x1043ba['length'];_0x72c227++){if(_0x1043ba[_0x72c227]['internalemailaddress']===_0x11f3e8[_0x8c24('0x28')]){_0x23ab1e[_0x8c24('0x24')]=_0x1043ba[_0x72c227][_0x8c24('0x23')];}}}_0x3c05c3(_0x23ab1e);})['catch'](function(_0x437591){_0x2327ca(_0x437591[_0x8c24('0x18')]);});});}function createEndUser(_0x395690,_0x1a4100,_0x7e71c2,_0x4a542f,_0xe8c839,_0x699cfd,_0x21690d){return new Promise(function(_0x57ca0e,_0x3b199e){return getAuthToken(_0x1a4100,_0x7e71c2,_0x699cfd)['then'](function(_0x18163a){var _0x20c11a=_0x699cfd[_0x8c24('0x29')]()===_0x8c24('0x2a')?_0xe8c839[_0x8c24('0x2b')]:_0xe8c839['calleridnum'];var _0x573602={'method':'POST','uri':_0x4a542f+_0x8c24('0x2c'),'body':{'fullname':_0x20c11a,'firstname':_0x20c11a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8c24('0x2d')+_0x395690['userId']+')'},'headers':{'Authorization':_0x8c24('0x2e')+_0x18163a,'OData-Version':_0x8c24('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x573602[_0x8c24('0x2f')][_0x21690d]=_0x20c11a;return rp(_0x573602);})[_0x8c24('0x13')](function(_0x17a3e2){var _0x380ef4=_0x17a3e2[_0x8c24('0x30')][_0x8c24('0x31')];var _0x18bb8f=_0x380ef4[_0x8c24('0x32')](_0x380ef4[_0x8c24('0x33')]('(')+0x1,_0x380ef4[_0x8c24('0x33')](')'));_0x395690[_0x8c24('0x34')]=_0x18bb8f;_0x57ca0e(_0x395690);})[_0x8c24('0x15')](function(_0x1ddfe9){_0x3b199e(_0x1ddfe9['message']);});});}function getEndUser(_0x378cf9,_0x494f4c,_0x537a10,_0x37d4e4,_0x9ccf4,_0xf4fdc3,_0x42a22f,_0x2e96ed){var _0x123a68=_0xf4fdc3[_0x8c24('0x29')]()===_0x8c24('0x2a')?_0x9ccf4['destcalleridnum']:_0x9ccf4['calleridnum'];return getAuthToken(_0x494f4c,_0x537a10,_0xf4fdc3)[_0x8c24('0x13')](function(_0x1854f6){_0x2e96ed=_0x2e96ed?_0x2e96ed:_0x8c24('0x35');var _0x2e0365={'method':_0x8c24('0x19'),'uri':_0x37d4e4+_0x8c24('0x36')+_0x2e96ed+_0x8c24('0x37')+_0x2e96ed+_0x8c24('0x38')+_0x123a68[_0x8c24('0x39')]('+',_0x8c24('0x3a'))+'\x27','headers':{'Authorization':_0x8c24('0x2e')+_0x1854f6,'If-None-Match':null,'OData-Version':_0x8c24('0x1b')},'json':!![]};return rp(_0x2e0365);})[_0x8c24('0x13')](function(_0x266492){var _0x373a75=![];if(!_0x266492)return _0x373a75;var _0x3c342c=_0x266492[_0x8c24('0x3b')];for(var _0x126f9d=0x0;_0x126f9d<_0x3c342c[_0x8c24('0x1f')];_0x126f9d++){if(_0x3c342c[_0x126f9d][_0x2e96ed]===_0x123a68){_0x373a75=!![];_0x378cf9[_0x8c24('0x34')]=_0x3c342c[_0x126f9d][_0x8c24('0x3c')];}}return _0x373a75;})['then'](function(_0x5be71){if(_0x5be71)return _0x378cf9;if(_0x42a22f===_0x8c24('0x3d')){logger['info']('['+[_0xf4fdc3[_0x8c24('0x21')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x378cf9;}return createEndUser(_0x378cf9,_0x494f4c,_0x537a10,_0x37d4e4,_0x9ccf4,_0xf4fdc3,_0x2e96ed)['then'](function(_0x27465f){logger['info']('['+[_0xf4fdc3[_0x8c24('0x21')]()]+']\x20Enduser\x20created!',_0x27465f['enduserId']);return _0x27465f;});});}function getCustomFields(_0xf28b9c,_0x4025ff,_0x3bbf43){var _0x1f14ef={};if(_0xf28b9c['length']>0x0){_['forEach'](_0xf28b9c,function(_0x1c545d){if(_[_0x8c24('0x3e')](['string',_0x8c24('0x3f')],_0x1c545d['type'])&&_0x1c545d[_0x8c24('0x40')]&&!_0x1c545d['customField']){var _0x41bb9e=_0x1c545d[_0x8c24('0x41')][_0x8c24('0x29')]();var _0x4bf31b=_0x41bb9e[_0x8c24('0x32')](0x0,_0x41bb9e['indexOf']('_'));var _0x2d61f5=_0x41bb9e[_0x8c24('0x32')](_0x41bb9e[_0x8c24('0x42')]('_')+0x1);if(_0x4bf31b===_0x3bbf43){_0x1f14ef[_0x2d61f5]=_0x1c545d[_0x8c24('0x43')];}}});}return _0x1f14ef;}function getTicket(_0x538120,_0x207dfc,_0x5015fb,_0x20526a,_0x52ebf3,_0x1491b0,_0x26f549){return new Promise(function(_0x1e0baf,_0x5d01f5){var _0x508703;return getAuthToken(_0x207dfc,_0x5015fb,_0x26f549)[_0x8c24('0x13')](function(_0x357e92){if(_0x1491b0[_0x8c24('0x44')]===_0x8c24('0x45')){_0x508703={'method':_0x8c24('0x11'),'uri':_0x20526a+_0x8c24('0x46'),'body':Object[_0x8c24('0x47')]({},{'title':intUtil[_0x8c24('0x48')](_0x1491b0[_0x8c24('0x49')],_0x52ebf3,'\x20'),'description':intUtil[_0x8c24('0x48')](_0x1491b0[_0x8c24('0x4a')],_0x52ebf3,'\x0a'),'customerid_contact@odata.bind':_0x538120[_0x8c24('0x34')]?_0x8c24('0x4b')+_0x538120[_0x8c24('0x34')]+')':undefined,'ownerid@odata.bind':_0x8c24('0x2d')+_0x538120[_0x8c24('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x1491b0['Fields'],_0x52ebf3,_0x1491b0[_0x8c24('0x44')])),'headers':{'Authorization':_0x8c24('0x2e')+_0x357e92,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1491b0[_0x8c24('0x44')]==='phonecall'){var _0x44e70f=_0x538120['enduserId']?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x538120['userId']+')','participationtypemask':_0x538120['callDirection']===_0x8c24('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x538120[_0x8c24('0x34')]+')','participationtypemask':_0x538120[_0x8c24('0x4d')]===_0x8c24('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x538120[_0x8c24('0x24')]+')','participationtypemask':_0x538120['callDirection']===_0x8c24('0x4c')?0x2:0x1}];_0x508703={'method':_0x8c24('0x11'),'uri':_0x20526a+_0x8c24('0x4e'),'body':Object[_0x8c24('0x47')]({},{'subject':intUtil['getString'](_0x1491b0['Subjects'],_0x52ebf3,'\x20'),'phonenumber':String(_0x52ebf3['calleridnum']),'description':intUtil['getString'](_0x1491b0[_0x8c24('0x4a')],_0x52ebf3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x538120[_0x8c24('0x34')]?_0x8c24('0x4b')+_0x538120[_0x8c24('0x34')]+')':undefined,'ownerid@odata.bind':_0x8c24('0x2d')+_0x538120[_0x8c24('0x24')]+')','directioncode':_0x538120[_0x8c24('0x4d')]===_0x8c24('0x4c')?![]:!![],'phonecall_activity_parties':_0x44e70f},getCustomFields(_0x1491b0['Fields'],_0x52ebf3,_0x1491b0[_0x8c24('0x44')])),'headers':{'Authorization':_0x8c24('0x2e')+_0x357e92,'OData-Version':_0x8c24('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x508703);})[_0x8c24('0x13')](function(_0x434e92){var _0x42cfb6=_0x434e92[_0x8c24('0x30')][_0x8c24('0x31')];var _0x7debb7=_0x42cfb6[_0x8c24('0x32')](_0x42cfb6[_0x8c24('0x33')]('(')+0x1,_0x42cfb6[_0x8c24('0x33')](')'));_0x538120[_0x8c24('0x4f')]=_0x7debb7;_0x1e0baf(_0x538120);})[_0x8c24('0x15')](function(_0xf7bb89){_0x5d01f5(_0xf7bb89[_0x8c24('0x18')]);});});}function emit(_0xc8aa00,_0x291d82,_0x5e9020,_0x23dfc1){var _0x2d7cab={'uri':util[_0x8c24('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xc8aa00,_0x5e9020,_0x23dfc1)};io['to'](util[_0x8c24('0x50')](_0x8c24('0x51'),_0x291d82))[_0x8c24('0x52')](_0x8c24('0x53'),_0x2d7cab);}exports['cs']=function(_0x2adbfb,_0x308b9b,_0x1f0903,_0x1acc5d,_0x4af01c,_0xcc0553,_0x3fe11f,_0x1155c8){var _0x28c59a={};_0xcc0553['remoteUri']=_0xcc0553['modernAuthentication']?intUtil[_0x8c24('0x54')](_0xcc0553['CloudProvider'][_0x8c24('0xc')]):intUtil[_0x8c24('0x54')](_0xcc0553[_0x8c24('0xa')]);_0xcc0553[_0x8c24('0x55')]=intUtil[_0x8c24('0x54')](_0xcc0553[_0x8c24('0x55')]);_0x28c59a[_0x8c24('0x4d')]=_0x1155c8==='queue'||_0x1155c8===_0x8c24('0x56')?_0x8c24('0x4c'):'outbound';var _0x54171c=_0xcc0553[_0x8c24('0x9')]?util[_0x8c24('0x50')]('%s/api/data/v9.0/',_0xcc0553[_0x8c24('0xb')][_0x8c24('0xc')]):util[_0x8c24('0x50')](_0x8c24('0x57'),_0xcc0553[_0x8c24('0xa')]);var _0x46c301=util[_0x8c24('0x50')](_0x8c24('0x58'),_0xcc0553[_0x8c24('0xd')]);var _0x2d270c=util[_0x8c24('0x50')](_0x8c24('0x59'),_0xcc0553['serverUrl'],_0x308b9b[_0x8c24('0x5a')],md5(_0x308b9b[_0x8c24('0x5a')]));if(_0x4af01c&&_0x4af01c[_0x8c24('0x5b')]){logger[_0x8c24('0x25')](_0x8c24('0x5c'),'Recording\x20is\x20enabled!');_0x308b9b[_0x8c24('0x5d')]=_0x2d270c;}else if(_0x3fe11f&&_0x3fe11f['recordingFormat']&&_0x3fe11f['recordingFormat']!==_0x8c24('0x5e')){logger[_0x8c24('0x25')](_0x8c24('0x5f'),_0x8c24('0x60'));_0x308b9b['recordingURL']=_0x2d270c;}else{_0x308b9b[_0x8c24('0x5d')]='';}return getUser(_0x28c59a,_0xcc0553,_0x1acc5d,_0x46c301,_0x54171c,_0x1155c8)[_0x8c24('0x13')](function(_0x596312){logger[_0x8c24('0x25')]('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x61'),_0x596312['userId']);logger[_0x8c24('0x25')]('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x62'),_0x596312['userEmail']);return getEndUser(_0x596312,_0xcc0553,_0x46c301,_0x54171c,_0x308b9b,_0x1155c8,_0x1f0903['moduleCreate'],_0x1f0903[_0x8c24('0x63')]);})['then'](function(_0x30980c){logger[_0x8c24('0x25')]('['+_0x1155c8[_0x8c24('0x21')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x30980c[_0x8c24('0x34')]);logger[_0x8c24('0x25')]('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x64'),_0x308b9b[_0x8c24('0x65')]);return getTicket(_0x30980c,_0xcc0553,_0x46c301,_0x54171c,_0x308b9b,_0x1f0903,_0x1155c8);})[_0x8c24('0x13')](function(_0x22fd88){logger['info'](util['format']('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x66'),_0x1f0903['ticketType'],_0x22fd88[_0x8c24('0x4f')]));logger[_0x8c24('0x25')](util[_0x8c24('0x50')]('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x67'),_0x1155c8));if(_0x1155c8!==_0x8c24('0x56')&&_0x1f0903[_0x8c24('0x68')]){logger['info']('['+_0x1155c8['toUpperCase']()+']',_0x8c24('0x69'));emit(_0xcc0553[_0x8c24('0xa')],_0x1acc5d[_0x8c24('0x6a')],_0x1f0903[_0x8c24('0x44')],_0x22fd88[_0x8c24('0x4f')]);}})[_0x8c24('0x15')](function(_0x311cf1){logger[_0x8c24('0x16')]('['+_0x1155c8[_0x8c24('0x21')]()+_0x8c24('0x6b'),_0x311cf1[_0x8c24('0x18')]);console[_0x8c24('0x16')](_0x8c24('0x6c'),_0x311cf1);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 811a8f5..4042374 100644 --- a/server/services/ami/trigger/integration/freshdesk.js +++ b/server/services/ami/trigger/integration/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6024=['Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','nameField','customField','type','push','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x4d3f27,_0x30546a){var _0x6fd21f=function(_0x3d6647){while(--_0x3d6647){_0x4d3f27['push'](_0x4d3f27['shift']());}};_0x6fd21f(++_0x30546a);}(_0x6024,0x1ec));var _0x4602=function(_0x16234e,_0x3643d6){_0x16234e=_0x16234e-0x0;var _0x1abfc0=_0x6024[_0x16234e];return _0x1abfc0;};'use strict';var _=require('lodash');var rp=require(_0x4602('0x0'));var md5=require(_0x4602('0x1'));var util=require('util');var Redis=require(_0x4602('0x2'));var intUtil=require(_0x4602('0x3'));var config=require(_0x4602('0x4'));var logger=require('../../../../config/logger')(_0x4602('0x5'));config[_0x4602('0x6')]=_[_0x4602('0x7')](config['redis'],{'host':_0x4602('0x8'),'port':0x18eb});var io=require(_0x4602('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x4602('0xa'),'Accept':'application/json'};function emit(_0x654361,_0x5468e4,_0x12ef72){io['to'](_0x654361)['emit'](_0x5468e4,_0x12ef72);}function getTicket(_0x109c19,_0x12637a,_0x3e8e23,_0x42f3cc,_0x1f8786){logger['info'](_0x4602('0xb'));var _0x4eb04e=_[_0x4602('0xc')]({'responder_id':_0x12637a['id'],'requester_id':_0x3e8e23['id'],'name':util[_0x4602('0xd')]('Caller\x20-\x20%s',_0x1f8786[_0x4602('0xe')]),'phone':_0x1f8786[_0x4602('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4602('0x10')](_0x42f3cc[_0x4602('0x11')],_0x1f8786,'\x20'),'description':intUtil[_0x4602('0x10')](_0x42f3cc[_0x4602('0x12')],_0x1f8786,_0x4602('0x13')),'tags':getTags(_0x42f3cc[_0x4602('0x14')],'name')},getCustomFields(_0x42f3cc[_0x4602('0x15')],_0x1f8786));_0x4eb04e[_0x4602('0x16')]=_[_0x4602('0x17')](_['keyBy'](_0x4eb04e['custom_fields'],'id'),_0x4602('0x18'));return request({'uri':util[_0x4602('0xd')]('%s/api/v2/tickets',_0x109c19[_0x4602('0x19')]),'method':_0x4602('0x1a'),'body':_0x4eb04e})[_0x4602('0x1b')](function(_0x4b613b){logger[_0x4602('0x1c')](_0x4602('0x1d'));return _0x4b613b;});}function getUser(_0x5d1e2b,_0x19d2fc){if(intUtil[_0x4602('0x1e')](_0x19d2fc)){return request({'uri':util['format'](_0x4602('0x1f'),_0x5d1e2b[_0x4602('0x19')]),'qs':{'email':_0x19d2fc}})['then'](function(_0x194459){if(_0x194459['length']){logger['info']('Agent\x20found!');return _[_0x4602('0x20')](_0x194459,function(_0x4462e3){return _0x4462e3['contact']['email']===_0x19d2fc;});}else{logger[_0x4602('0x1c')](_0x4602('0x21'));return request({'uri':util[_0x4602('0xd')](_0x4602('0x22'),_0x5d1e2b[_0x4602('0x19')])})[_0x4602('0x1b')](function(_0x483863){logger[_0x4602('0x1c')](_0x4602('0x23'));return _0x483863;});}});}else{logger['info'](_0x4602('0x24'));return request({'uri':util[_0x4602('0xd')](_0x4602('0x22'),_0x5d1e2b['remoteUri'])})[_0x4602('0x1b')](function(_0x1c3970){logger[_0x4602('0x1c')](_0x4602('0x23'));return _0x1c3970;});}}function getEndUser(_0x44547a,_0x23de17,_0x13ace9){logger[_0x4602('0x1c')](_0x4602('0x25'),_0x13ace9);return request({'uri':util['format'](_0x4602('0x26'),_0x44547a[_0x4602('0x19')]),'qs':{'phone':_0x13ace9}})['then'](function(_0xfd5275){if(_0xfd5275[_0x4602('0x27')]){logger['info'](_0x4602('0x28'));return _[_0x4602('0x20')](_0xfd5275,{'phone':_0x13ace9});}else{logger[_0x4602('0x1c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x4602('0x26'),_0x44547a[_0x4602('0x19')]),'method':_0x4602('0x1a'),'body':{'name':_0x23de17,'phone':_0x13ace9}})[_0x4602('0x1b')](function(_0x16f4b6){logger[_0x4602('0x1c')](_0x4602('0x29'));return _0x16f4b6;});}});}function getAuth(_0x2c1121){return util['format'](_0x4602('0x2a'),new Buffer(_0x2c1121[_0x4602('0x2b')]+':X')[_0x4602('0x2c')](_0x4602('0x2d')));}function request(_0x56faea){logger[_0x4602('0x2e')](_0x4602('0x2f'),JSON['stringify'](_0x56faea));return rp(_['defaults'](_0x56faea,{'method':_0x4602('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x44e5b1,_0x1c9064){var _0x159b0d=[];if(_0x44e5b1&&_0x44e5b1[_0x4602('0x27')]>0x0){_0x159b0d=_[_0x4602('0x31')](_0x44e5b1,_0x1c9064);}return _0x159b0d;}function getCustomFields(_0x58d34d,_0x14241d){var _0x54a740=[];var _0x2cbdb2={'custom_fields':[]};if(_0x58d34d['length']>0x0){_['forEach'](_0x58d34d,function(_0x1fb2de){if(_[_0x4602('0x32')]([_0x4602('0x33'),_0x4602('0x34')],_0x1fb2de['type'])&&_0x1fb2de[_0x4602('0x35')]&&!_0x1fb2de[_0x4602('0x36')]){_0x2cbdb2[_0x1fb2de[_0x4602('0x35')]['toLowerCase']()]=_0x1fb2de['content'][_0x4602('0x2c')]();}else if(_[_0x4602('0x32')](['string',_0x4602('0x34')],_0x1fb2de[_0x4602('0x37')])&&_0x1fb2de['idField']&&_0x1fb2de['customField']){_0x2cbdb2[_0x4602('0x16')][_0x4602('0x38')]({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x1fb2de[_0x4602('0x3a')][_0x4602('0x2c')]()});}else if(_0x1fb2de[_0x4602('0x37')]===_0x4602('0x3b')&&_0x1fb2de['variableName']&&_0x1fb2de['idField']&&_0x1fb2de[_0x4602('0x36')]){_0x14241d[_0x1fb2de[_0x4602('0x3c')]]&&_0x2cbdb2[_0x4602('0x16')]['push']({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x14241d[_0x1fb2de[_0x4602('0x3c')]][_0x4602('0x2c')]()});}else if(_0x1fb2de[_0x4602('0x37')]===_0x4602('0x3d')&&_0x1fb2de[_0x4602('0x3e')]&&_0x1fb2de[_0x4602('0x3e')][_0x4602('0x3f')]&&_0x1fb2de['idField']&&_0x1fb2de[_0x4602('0x36')]){_0x14241d[_0x1fb2de[_0x4602('0x3e')]['name'][_0x4602('0x40')]()]&&_0x2cbdb2['custom_fields'][_0x4602('0x38')]({'id':_0x1fb2de[_0x4602('0x39')],'value':_0x14241d[_0x1fb2de[_0x4602('0x3e')][_0x4602('0x3f')][_0x4602('0x40')]()]['toString']()});}});}return _0x2cbdb2;}exports['queue']=function(_0x5eb459,_0x399f6e,_0x15e795,_0x22be3e,_0x13f985,_0x1b4190){var _0x1e71d0,_0x16283c;_0x1b4190[_0x4602('0x19')]=intUtil[_0x4602('0x41')](_0x1b4190[_0x4602('0x19')]);_0x1b4190[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x1b4190[_0x4602('0x42')]);if(_0x13f985&&_0x13f985[_0x4602('0x43')]){logger[_0x4602('0x1c')](_0x4602('0x44'),_0x4602('0x45'));_0x399f6e[_0x4602('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1b4190[_0x4602('0x42')],_0x399f6e[_0x4602('0x47')],md5(_0x399f6e[_0x4602('0x47')]));}else{_0x399f6e[_0x4602('0x46')]='';}headers[_0x4602('0x48')]=getAuth(_0x1b4190);return getUser(_0x1b4190,_0x22be3e[_0x4602('0x49')])[_0x4602('0x1b')](function(_0x5d6af5){_0x1e71d0=_0x5d6af5;logger[_0x4602('0x1c')](_0x4602('0x4a'),_0x1e71d0['id']);return getEndUser(_0x1b4190,_0x399f6e[_0x4602('0xe')],_0x399f6e[_0x4602('0xf')]);})[_0x4602('0x1b')](function(_0x26406a){_0x16283c=_0x26406a;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x16283c['id']);return getTicket(_0x1b4190,_0x1e71d0,_0x16283c,_0x15e795,_0x399f6e);})[_0x4602('0x1b')](function(_0x58f443){if(_0x58f443&&_0x58f443['id']){logger[_0x4602('0x1c')](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x58f443['id']);logger['info']('[QUEUE]',_0x4602('0x4d'));emit(util[_0x4602('0xd')]('user:%s',_0x22be3e[_0x4602('0x3f')]),_0x4602('0x4e'),{'uri':util['format'](_0x4602('0x4f'),_0x1b4190[_0x4602('0x19')],_0x58f443['id'])});}})[_0x4602('0x50')](function(_0x54db5b){logger[_0x4602('0x51')](_0x4602('0x44'),JSON[_0x4602('0x52')](_0x54db5b));});};exports[_0x4602('0x53')]=function(_0x27b24b,_0x5f42c4,_0x445568,_0x162f93,_0x1aca45,_0x2dfef5,_0x27d65c){var _0x56cfe5,_0x28fd6b;_0x2dfef5['remoteUri']=intUtil[_0x4602('0x41')](_0x2dfef5['remoteUri']);_0x2dfef5[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x2dfef5[_0x4602('0x42')]);if(_0x27d65c&&_0x27d65c[_0x4602('0x54')]&&_0x27d65c[_0x4602('0x54')]!==_0x4602('0x55')){logger['info']('[OUTBOUND]',_0x4602('0x45'));_0x5f42c4[_0x4602('0x46')]=util[_0x4602('0xd')](_0x4602('0x56'),_0x2dfef5[_0x4602('0x42')],_0x5f42c4['uniqueid'],md5(_0x5f42c4[_0x4602('0x47')]));}headers[_0x4602('0x48')]=getAuth(_0x2dfef5);return getUser(_0x2dfef5,_0x162f93[_0x4602('0x49')])[_0x4602('0x1b')](function(_0x10284e){_0x56cfe5=_0x10284e;logger['info'](_0x4602('0x4a'),_0x56cfe5['id']);return getEndUser(_0x2dfef5,_0x5f42c4[_0x4602('0x57')],_0x5f42c4[_0x4602('0x58')]);})[_0x4602('0x1b')](function(_0x305750){_0x28fd6b=_0x305750;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x28fd6b['id']);return getTicket(_0x2dfef5,_0x56cfe5,_0x28fd6b,_0x445568,_0x5f42c4);})[_0x4602('0x1b')](function(_0x35f199){if(_0x35f199&&_0x35f199['id']){logger[_0x4602('0x1c')](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x35f199['id']);logger['info'](_0x4602('0x59'),_0x4602('0x4d'));emit(util['format'](_0x4602('0x5a'),_0x162f93[_0x4602('0x3f')]),_0x4602('0x4e'),{'uri':util[_0x4602('0xd')]('%s/helpdesk/tickets/%d',_0x2dfef5['remoteUri'],_0x35f199['id'])});}})['catch'](function(_0x506fe3){logger[_0x4602('0x51')](_0x4602('0x59'),JSON[_0x4602('0x52')](_0x506fe3));});};exports[_0x4602('0x5b')]=function(_0x285dd3,_0x16fb75,_0x1711af,_0x1e49dd,_0x4f18ca,_0x324157){var _0x492ce4,_0x1cebd6;_0x324157[_0x4602('0x19')]=intUtil[_0x4602('0x41')](_0x324157[_0x4602('0x19')]);_0x324157[_0x4602('0x42')]=intUtil[_0x4602('0x41')](_0x324157[_0x4602('0x42')]);if(_0x4f18ca&&_0x4f18ca[_0x4602('0x43')]){logger[_0x4602('0x1c')]('['+_0x16fb75[_0x4602('0x5c')][_0x4602('0x5d')]()+']',_0x4602('0x45'));_0x16fb75['recordingURL']=util[_0x4602('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x324157['serverUrl'],_0x16fb75[_0x4602('0x47')],md5(_0x16fb75['uniqueid']));}else{_0x16fb75[_0x4602('0x46')]='';}headers[_0x4602('0x48')]=getAuth(_0x324157);return getUser(_0x324157,'')[_0x4602('0x1b')](function(_0x367c74){_0x492ce4=_0x367c74;logger['info'](_0x4602('0x4a'),_0x492ce4['id']);return getEndUser(_0x324157,_0x16fb75['calleridname'],_0x16fb75[_0x4602('0xf')]);})['then'](function(_0x1a18d9){_0x1cebd6=_0x1a18d9;logger[_0x4602('0x1c')](_0x4602('0x4b'),_0x1cebd6['id']);return getTicket(_0x324157,_0x492ce4,_0x1cebd6,_0x1711af,_0x16fb75);})[_0x4602('0x1b')](function(_0x45cbe4){if(_0x45cbe4){logger['info'](_0x4602('0x1d'));logger[_0x4602('0x1c')](_0x4602('0x4c'),_0x45cbe4['id']);}})[_0x4602('0x50')](function(_0x2ca1db){logger[_0x4602('0x51')]('['+_0x16fb75[_0x4602('0x5c')]['toUpperCase']()+']',JSON[_0x4602('0x52')](_0x2ca1db));});}; \ No newline at end of file +var _0xa791=['Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Tags','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','GET','forEach','type','nameField','toLowerCase','content','includes','picklist','idField','push','variable','customField','variableName','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','emit','format'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0xa791,0x1b4));var _0x1a79=function(_0x309527,_0x3e2bff){_0x309527=_0x309527-0x0;var _0x194ab0=_0xa791[_0x309527];return _0x194ab0;};'use strict';var _=require(_0x1a79('0x0'));var rp=require(_0x1a79('0x1'));var md5=require(_0x1a79('0x2'));var util=require(_0x1a79('0x3'));var Redis=require(_0x1a79('0x4'));var intUtil=require(_0x1a79('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1a79('0x6'))(_0x1a79('0x7'));config['redis']=_[_0x1a79('0x8')](config[_0x1a79('0x9')],{'host':_0x1a79('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1a79('0x9')]));var headers={'Content-Type':_0x1a79('0xb'),'Accept':_0x1a79('0xb')};function emit(_0x3bdd27,_0x2cfe71,_0x10105e){io['to'](_0x3bdd27)[_0x1a79('0xc')](_0x2cfe71,_0x10105e);}function getTicket(_0xd97648,_0x2f7159,_0xf42478,_0x41901b,_0x589dbf){logger['info']('Creating\x20new\x20ticket...');var _0x34eebc=_['merge']({'responder_id':_0x2f7159['id'],'requester_id':_0xf42478['id'],'name':util[_0x1a79('0xd')](_0x1a79('0xe'),_0x589dbf[_0x1a79('0xf')]),'phone':_0x589dbf[_0x1a79('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x41901b[_0x1a79('0x11')],_0x589dbf,'\x20'),'description':intUtil[_0x1a79('0x12')](_0x41901b['Descriptions'],_0x589dbf,'
'),'tags':getTags(_0x41901b[_0x1a79('0x13')],'name')},getCustomFields(_0x41901b[_0x1a79('0x14')],_0x589dbf));_0x34eebc[_0x1a79('0x15')]=_[_0x1a79('0x16')](_['keyBy'](_0x34eebc[_0x1a79('0x15')],'id'),_0x1a79('0x17'));return request({'uri':util[_0x1a79('0xd')](_0x1a79('0x18'),_0xd97648[_0x1a79('0x19')]),'method':_0x1a79('0x1a'),'body':_0x34eebc})[_0x1a79('0x1b')](function(_0x1f26b3){logger[_0x1a79('0x1c')](_0x1a79('0x1d'));return _0x1f26b3;});}function getUser(_0x59c89c,_0x55fe86){if(intUtil['validateEmail'](_0x55fe86)){return request({'uri':util[_0x1a79('0xd')](_0x1a79('0x1e'),_0x59c89c[_0x1a79('0x19')]),'qs':{'email':_0x55fe86}})[_0x1a79('0x1b')](function(_0x5cd3f0){if(_0x5cd3f0[_0x1a79('0x1f')]){logger[_0x1a79('0x1c')](_0x1a79('0x20'));return _[_0x1a79('0x21')](_0x5cd3f0,function(_0x73572b){return _0x73572b[_0x1a79('0x22')]['email']===_0x55fe86;});}else{logger[_0x1a79('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1a79('0xd')]('%s/api/v2/agents/me',_0x59c89c[_0x1a79('0x19')])})[_0x1a79('0x1b')](function(_0x278aaa){logger[_0x1a79('0x1c')]('Admin\x20account\x20selected.');return _0x278aaa;});}});}else{logger['info'](_0x1a79('0x23'));return request({'uri':util[_0x1a79('0xd')](_0x1a79('0x24'),_0x59c89c[_0x1a79('0x19')])})[_0x1a79('0x1b')](function(_0xf05f95){logger[_0x1a79('0x1c')]('Admin\x20account\x20selected.');return _0xf05f95;});}}function getEndUser(_0x15fcb9,_0x3ef383,_0xcbd9e0){logger[_0x1a79('0x1c')](_0x1a79('0x25'),_0xcbd9e0);return request({'uri':util[_0x1a79('0xd')](_0x1a79('0x26'),_0x15fcb9[_0x1a79('0x19')]),'qs':{'phone':_0xcbd9e0}})[_0x1a79('0x1b')](function(_0x1db822){if(_0x1db822[_0x1a79('0x1f')]){logger[_0x1a79('0x1c')](_0x1a79('0x27'));return _[_0x1a79('0x21')](_0x1db822,{'phone':_0xcbd9e0});}else{logger[_0x1a79('0x1c')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x1a79('0xd')](_0x1a79('0x26'),_0x15fcb9['remoteUri']),'method':_0x1a79('0x1a'),'body':{'name':_0x3ef383,'phone':_0xcbd9e0}})['then'](function(_0x5f56a3){logger[_0x1a79('0x1c')](_0x1a79('0x28'));return _0x5f56a3;});}});}function getAuth(_0xaa025c){return util[_0x1a79('0xd')]('Basic\x20%s',new Buffer(_0xaa025c[_0x1a79('0x29')]+':X')[_0x1a79('0x2a')]('base64'));}function request(_0x331bc3){logger[_0x1a79('0x2b')](_0x1a79('0x2c'),JSON['stringify'](_0x331bc3));return rp(_[_0x1a79('0x8')](_0x331bc3,{'method':_0x1a79('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x59e0b6,_0x46f65c){var _0x4da74d=[];if(_0x59e0b6&&_0x59e0b6[_0x1a79('0x1f')]>0x0){_0x4da74d=_['map'](_0x59e0b6,_0x46f65c);}return _0x4da74d;}function getCustomFields(_0x4af5ec,_0x395f5a){var _0x1a7049=[];var _0x281a14={'custom_fields':[]};if(_0x4af5ec[_0x1a79('0x1f')]>0x0){_[_0x1a79('0x2e')](_0x4af5ec,function(_0x5173e2){if(_['includes'](['string','picklist'],_0x5173e2[_0x1a79('0x2f')])&&_0x5173e2[_0x1a79('0x30')]&&!_0x5173e2['customField']){_0x281a14[_0x5173e2[_0x1a79('0x30')][_0x1a79('0x31')]()]=_0x5173e2[_0x1a79('0x32')][_0x1a79('0x2a')]();}else if(_[_0x1a79('0x33')](['string',_0x1a79('0x34')],_0x5173e2['type'])&&_0x5173e2[_0x1a79('0x35')]&&_0x5173e2['customField']){_0x281a14['custom_fields'][_0x1a79('0x36')]({'id':_0x5173e2[_0x1a79('0x35')],'value':_0x5173e2[_0x1a79('0x32')][_0x1a79('0x2a')]()});}else if(_0x5173e2[_0x1a79('0x2f')]===_0x1a79('0x37')&&_0x5173e2['variableName']&&_0x5173e2[_0x1a79('0x35')]&&_0x5173e2[_0x1a79('0x38')]){_0x395f5a[_0x5173e2[_0x1a79('0x39')]]&&_0x281a14[_0x1a79('0x15')][_0x1a79('0x36')]({'id':_0x5173e2[_0x1a79('0x35')],'value':_0x395f5a[_0x5173e2[_0x1a79('0x39')]][_0x1a79('0x2a')]()});}else if(_0x5173e2['type']==='customVariable'&&_0x5173e2['Variable']&&_0x5173e2['Variable'][_0x1a79('0x3a')]&&_0x5173e2[_0x1a79('0x35')]&&_0x5173e2['customField']){_0x395f5a[_0x5173e2[_0x1a79('0x3b')][_0x1a79('0x3a')][_0x1a79('0x31')]()]&&_0x281a14[_0x1a79('0x15')][_0x1a79('0x36')]({'id':_0x5173e2[_0x1a79('0x35')],'value':_0x395f5a[_0x5173e2[_0x1a79('0x3b')][_0x1a79('0x3a')][_0x1a79('0x31')]()][_0x1a79('0x2a')]()});}});}return _0x281a14;}exports[_0x1a79('0x3c')]=function(_0x195f99,_0x128b6b,_0x1a5617,_0xeacb57,_0x2e2dc0,_0x17858d){var _0x4ae368,_0x51f94e;_0x17858d[_0x1a79('0x19')]=intUtil[_0x1a79('0x3d')](_0x17858d[_0x1a79('0x19')]);_0x17858d[_0x1a79('0x3e')]=intUtil[_0x1a79('0x3d')](_0x17858d[_0x1a79('0x3e')]);if(_0x2e2dc0&&_0x2e2dc0[_0x1a79('0x3f')]){logger[_0x1a79('0x1c')]('[QUEUE]',_0x1a79('0x40'));_0x128b6b[_0x1a79('0x41')]=util[_0x1a79('0xd')](_0x1a79('0x42'),_0x17858d['serverUrl'],_0x128b6b[_0x1a79('0x43')],md5(_0x128b6b[_0x1a79('0x43')]));}else{_0x128b6b[_0x1a79('0x41')]='';}headers[_0x1a79('0x44')]=getAuth(_0x17858d);return getUser(_0x17858d,_0xeacb57[_0x1a79('0x45')])['then'](function(_0x3b5a7c){_0x4ae368=_0x3b5a7c;logger[_0x1a79('0x1c')](_0x1a79('0x46'),_0x4ae368['id']);return getEndUser(_0x17858d,_0x128b6b['calleridname'],_0x128b6b[_0x1a79('0x10')]);})[_0x1a79('0x1b')](function(_0x3c0926){_0x51f94e=_0x3c0926;logger[_0x1a79('0x1c')](_0x1a79('0x47'),_0x51f94e['id']);return getTicket(_0x17858d,_0x4ae368,_0x51f94e,_0x1a5617,_0x128b6b);})[_0x1a79('0x1b')](function(_0x1007d0){if(_0x1007d0&&_0x1007d0['id']){logger['info'](_0x1a79('0x1d'));logger[_0x1a79('0x1c')](_0x1a79('0x48'),_0x1007d0['id']);logger[_0x1a79('0x1c')](_0x1a79('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1a79('0xd')](_0x1a79('0x4a'),_0xeacb57[_0x1a79('0x3a')]),_0x1a79('0x4b'),{'uri':util[_0x1a79('0xd')](_0x1a79('0x4c'),_0x17858d['remoteUri'],_0x1007d0['id'])});}})[_0x1a79('0x4d')](function(_0x910a26){logger[_0x1a79('0x4e')](_0x1a79('0x49'),JSON[_0x1a79('0x4f')](_0x910a26));});};exports[_0x1a79('0x50')]=function(_0x125ef6,_0x42a4d6,_0x299eb5,_0x59dd8e,_0x205d21,_0xe56b17,_0x451015){var _0x3dc79f,_0x1319fe;_0xe56b17['remoteUri']=intUtil['stripTrailingSlash'](_0xe56b17['remoteUri']);_0xe56b17[_0x1a79('0x3e')]=intUtil[_0x1a79('0x3d')](_0xe56b17[_0x1a79('0x3e')]);if(_0x451015&&_0x451015['recordingFormat']&&_0x451015[_0x1a79('0x51')]!==_0x1a79('0x52')){logger[_0x1a79('0x1c')](_0x1a79('0x53'),'Recording\x20is\x20enabled!');_0x42a4d6[_0x1a79('0x41')]=util[_0x1a79('0xd')](_0x1a79('0x42'),_0xe56b17[_0x1a79('0x3e')],_0x42a4d6['uniqueid'],md5(_0x42a4d6[_0x1a79('0x43')]));}headers[_0x1a79('0x44')]=getAuth(_0xe56b17);return getUser(_0xe56b17,_0x59dd8e[_0x1a79('0x45')])[_0x1a79('0x1b')](function(_0x297df2){_0x3dc79f=_0x297df2;logger[_0x1a79('0x1c')](_0x1a79('0x46'),_0x3dc79f['id']);return getEndUser(_0xe56b17,_0x42a4d6[_0x1a79('0x54')],_0x42a4d6[_0x1a79('0x55')]);})['then'](function(_0x18bebd){_0x1319fe=_0x18bebd;logger[_0x1a79('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x1319fe['id']);return getTicket(_0xe56b17,_0x3dc79f,_0x1319fe,_0x299eb5,_0x42a4d6);})[_0x1a79('0x1b')](function(_0x1ca1b4){if(_0x1ca1b4&&_0x1ca1b4['id']){logger[_0x1a79('0x1c')](_0x1a79('0x1d'));logger[_0x1a79('0x1c')](_0x1a79('0x48'),_0x1ca1b4['id']);logger[_0x1a79('0x1c')]('[OUTBOUND]',_0x1a79('0x56'));emit(util[_0x1a79('0xd')](_0x1a79('0x4a'),_0x59dd8e[_0x1a79('0x3a')]),'trigger:browser:url',{'uri':util[_0x1a79('0xd')](_0x1a79('0x4c'),_0xe56b17['remoteUri'],_0x1ca1b4['id'])});}})[_0x1a79('0x4d')](function(_0x217c96){logger[_0x1a79('0x4e')](_0x1a79('0x53'),JSON['stringify'](_0x217c96));});};exports[_0x1a79('0x57')]=function(_0x171ab7,_0x64813c,_0x28885a,_0x179065,_0x43970b,_0x599476){var _0x22f6e2,_0x33c3dd;_0x599476[_0x1a79('0x19')]=intUtil[_0x1a79('0x3d')](_0x599476[_0x1a79('0x19')]);_0x599476['serverUrl']=intUtil[_0x1a79('0x3d')](_0x599476[_0x1a79('0x3e')]);if(_0x43970b&&_0x43970b[_0x1a79('0x3f')]){logger[_0x1a79('0x1c')]('['+_0x64813c['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x64813c[_0x1a79('0x41')]=util[_0x1a79('0xd')](_0x1a79('0x42'),_0x599476['serverUrl'],_0x64813c['uniqueid'],md5(_0x64813c['uniqueid']));}else{_0x64813c['recordingURL']='';}headers[_0x1a79('0x44')]=getAuth(_0x599476);return getUser(_0x599476,'')[_0x1a79('0x1b')](function(_0x5d7351){_0x22f6e2=_0x5d7351;logger['info']('The\x20User\x20ID\x20is:',_0x22f6e2['id']);return getEndUser(_0x599476,_0x64813c[_0x1a79('0xf')],_0x64813c[_0x1a79('0x10')]);})['then'](function(_0x20a2e9){_0x33c3dd=_0x20a2e9;logger[_0x1a79('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x33c3dd['id']);return getTicket(_0x599476,_0x22f6e2,_0x33c3dd,_0x28885a,_0x64813c);})[_0x1a79('0x1b')](function(_0x3a653a){if(_0x3a653a){logger['info'](_0x1a79('0x1d'));logger[_0x1a79('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x3a653a['id']);}})[_0x1a79('0x4d')](function(_0x25bb91){logger[_0x1a79('0x4e')]('['+_0x64813c[_0x1a79('0x58')][_0x1a79('0x59')]()+']',JSON[_0x1a79('0x4f')](_0x25bb91));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index f0c42d0..ec90772 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72fc=['socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','none','recordingURL','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x72fc,0x1f4));var _0xc72f=function(_0x4c9b52,_0x36a55a){_0x4c9b52=_0x4c9b52-0x0;var _0x1f7179=_0x72fc[_0x4c9b52];return _0x1f7179;};'use strict';var _=require(_0xc72f('0x0'));var rp=require(_0xc72f('0x1'));var md5=require('md5');var util=require(_0xc72f('0x2'));var moment=require(_0xc72f('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0xc72f('0x4'));var config=require(_0xc72f('0x5'));var logger=require(_0xc72f('0x6'))('freshsales');config['redis']=_[_0xc72f('0x7')](config[_0xc72f('0x8')],{'host':_0xc72f('0x9'),'port':0x18eb});var io=require(_0xc72f('0xa'))(new Redis(config[_0xc72f('0x8')]));function getAdminId(_0x48fafc,_0x1b2184,_0x23e4d3,_0x24fc3b){return new Promise(function(_0x59384d,_0x4d7227){var _0x4088e5=![];var _0x556dc4={'method':_0xc72f('0xb'),'uri':_0x24fc3b+_0xc72f('0xc'),'json':!![]};_0x556dc4['headers']=_0x23e4d3;logger[_0xc72f('0xd')](_0xc72f('0xe'));return rp(_0x556dc4)[_0xc72f('0xf')](function(_0x560690){if(_0x560690){var _0x49ae65=_0x560690[_0xc72f('0x10')];var _0x251a42=null;for(_0x251a42=0x0;_0x251a42<_0x49ae65[_0xc72f('0x11')];_0x251a42++){if(_0x49ae65[_0x251a42][_0xc72f('0x12')]===_0x48fafc[_0xc72f('0x13')]){_0x48fafc[_0xc72f('0x14')]=_0x49ae65[_0x251a42]['id'];_0x4088e5=!![];}}if(_0x4088e5){logger[_0xc72f('0xd')](_0xc72f('0x15'),_0x48fafc[_0xc72f('0x14')]);_0x59384d(_0x48fafc);}else{_0x4d7227({'statusCode':0x194,'message':_0xc72f('0x16')});}}else{_0x4d7227({'statusCode':0x194,'message':_0xc72f('0x16')});}})[_0xc72f('0x17')](function(_0x7f99c4){logger[_0xc72f('0x18')]('['+[_0x1b2184[_0xc72f('0x19')]()]+']',_0x7f99c4[_0xc72f('0x1a')]);_0x4d7227(_0x7f99c4);});});}function getUser(_0x12f868,_0x2c249b,_0x5e6638){return function(_0x5eb6f0){return new Promise(function(_0x3a105e,_0x24a2e7){var _0x16c625={'method':_0xc72f('0xb'),'uri':_0x5e6638+_0xc72f('0xc'),'json':!![]};_0x16c625['headers']=_0x2c249b;logger[_0xc72f('0xd')](_0xc72f('0x1b'));return rp(_0x16c625)[_0xc72f('0xf')](function(_0x3ad086){if(_0x3ad086){var _0x2c58d3=_0x3ad086[_0xc72f('0x10')];var _0x4d70c9=![];var _0x18d274=null;if(_0x5eb6f0[_0xc72f('0x1c')]!==null){logger[_0xc72f('0xd')]('Getting\x20user\x20with\x20email',_0x5eb6f0[_0xc72f('0x1c')]);_0x5eb6f0[_0xc72f('0x1d')]=_0x5eb6f0[_0xc72f('0x1c')];for(_0x18d274=0x0;_0x18d274<_0x2c58d3['length'];_0x18d274++){if(_0x2c58d3[_0x18d274][_0xc72f('0x12')]===_0x5eb6f0[_0xc72f('0x1c')]){_0x4d70c9=!![];_0x5eb6f0['userId']=_0x2c58d3[_0x18d274]['id'];logger[_0xc72f('0xd')](_0xc72f('0x1e'),_0x5eb6f0[_0xc72f('0x1f')]);}}}if(!_0x4d70c9){logger[_0xc72f('0xd')](_0xc72f('0x20'));_0x5eb6f0[_0xc72f('0x1d')]=_0x5eb6f0[_0xc72f('0x13')];_0x5eb6f0[_0xc72f('0x1f')]=_0x5eb6f0[_0xc72f('0x14')];_0x4d70c9=!![];}if(_0x4d70c9){_0x3a105e(_0x5eb6f0);}else{_0x24a2e7({'statusCode':0x194,'message':_0xc72f('0x16')});}}else{_0x24a2e7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xc72f('0x17')](function(_0x10ce84){logger['error']('['+[_0x12f868[_0xc72f('0x19')]()]+']',_0x10ce84['message']);_0x24a2e7(_0x10ce84);});});};}function searchContact(_0x2369ea,_0x5d2d10,_0x54f0db,_0x448385){return new Promise(function(_0x5d5f7f,_0x23ae1e){var _0x57ce1b={'method':_0xc72f('0xb'),'headers':_0x5d2d10,'uri':_0x2369ea+_0xc72f('0x21')+_0x448385+_0xc72f('0x22')+_0x54f0db+_0xc72f('0x23'),'json':!![]};rp(_0x57ce1b)[_0xc72f('0xf')](function(_0x3472bf){var _0x19a67e=_[_0xc72f('0x24')](_0x3472bf[_0xc72f('0x25')][_0xc72f('0x25')],[_0x54f0db,_0x448385]);_0x5d5f7f(_0x19a67e);})[_0xc72f('0x17')](function(_0x433ed0){_0x23ae1e(_0x433ed0);});});}function getEndUser(_0xd87fef,_0xcbae1b,_0xcbf8cf){return function(_0x411cff){return new Promise(function(_0x5144bd,_0x1ea70d){logger['info'](util[_0xc72f('0x26')](_0xc72f('0x27'),_0x411cff[_0xc72f('0x28')]));searchContact(_0xcbf8cf,_0xcbae1b,_0xc72f('0x29'),_0x411cff[_0xc72f('0x28')])[_0xc72f('0xf')](function(_0x207691){if(_0x207691){_0x411cff[_0xc72f('0x2a')]=_0x207691['id'];logger[_0xc72f('0xd')](_0xc72f('0x2b'),_0x411cff[_0xc72f('0x2a')]);return _0x5144bd(_0x411cff);}searchContact(_0xcbf8cf,_0xcbae1b,'work_number',_0x411cff[_0xc72f('0x28')])[_0xc72f('0xf')](function(_0x1787a7){if(_0x1787a7){_0x411cff['endUserId']=_0x1787a7['id'];logger[_0xc72f('0xd')](_0xc72f('0x2c'),_0x411cff[_0xc72f('0x2a')]);return _0x5144bd(_0x411cff);}createEndUser(_0x411cff,_0xd87fef,_0xcbae1b,_0xcbf8cf)[_0xc72f('0xf')](function(_0x19a434){logger[_0xc72f('0xd')](_0xc72f('0x2d'),_0x19a434[_0xc72f('0x2a')]);return _0x5144bd(_0x19a434);});});})[_0xc72f('0x17')](function(_0x5a5ba5){_0x1ea70d(_0x5a5ba5);});});};}function createEndUser(_0x1a5a6b,_0x4aa2b8,_0x3ece4e,_0x939004){return new Promise(function(_0xacf170,_0x4ecc75){var _0x2ae8bd=moment();var _0x17eecb={'method':_0xc72f('0x2e'),'uri':_0x939004+_0xc72f('0x2f'),'body':{'contact':{'last_name':_0x1a5a6b[_0xc72f('0x28')],'work_number':_0x1a5a6b[_0xc72f('0x28')],'mobile_number':_0x1a5a6b[_0xc72f('0x28')],'owner_id':_0x1a5a6b[_0xc72f('0x1f')],'created_at':_0x2ae8bd[_0xc72f('0x26')](_0xc72f('0x30'))}},'json':!![]};_0x17eecb[_0xc72f('0x31')]=_0x3ece4e;logger[_0xc72f('0xd')](_0xc72f('0x32'));return rp(_0x17eecb)[_0xc72f('0xf')](function(_0x141114){_0x1a5a6b[_0xc72f('0x2a')]=_0x141114['contact']['id'];_0xacf170(_0x1a5a6b);})[_0xc72f('0x17')](function(_0x252343){logger['error']('['+[_0x4aa2b8[_0xc72f('0x19')]()]+']',_0x252343[_0xc72f('0x1a')]);_0x4ecc75(_0x252343[_0xc72f('0x1a')]);});});}function getTicket(_0x404f5c,_0x4f40f9,_0x2215ca,_0x26438e,_0x34fc2f){return function(_0x59e21){logger[_0xc72f('0xd')](_0xc72f('0x33'));return new Promise(function(_0x2479bc,_0x5593ef){var _0x517146=moment();var _0x3e18c5={'method':_0xc72f('0x2e'),'uri':_0x2215ca+_0xc72f('0x34'),'body':{'title':intUtil[_0xc72f('0x35')](_0x26438e[_0xc72f('0x36')],_0x34fc2f,'\x20'),'description':intUtil[_0xc72f('0x35')](_0x26438e[_0xc72f('0x37')],_0x34fc2f,'\x0a'),'owner_id':_0x59e21['userId'],'creater_id':_0x59e21[_0xc72f('0x14')],'targetable_id':_0x59e21[_0xc72f('0x2a')],'targetable_type':_0xc72f('0x38'),'created_at':_0x517146[_0xc72f('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x517146[_0xc72f('0x39')](0x1e,'m')['format'](_0xc72f('0x30'))},'json':!![]};_0x3e18c5['headers']=_0x4f40f9;return rp(_0x3e18c5)[_0xc72f('0xf')](function(_0x493ce0){_0x59e21['ticketId']=_0x493ce0[_0xc72f('0x3a')]['id'];logger['info'](_0xc72f('0x3b'),_0x59e21[_0xc72f('0x3c')]);_0x2479bc(_0x59e21);})[_0xc72f('0x17')](function(_0xee3cf1){logger[_0xc72f('0x18')]('['+[_0x404f5c['toUpperCase']()]+']',_0xee3cf1[_0xc72f('0x1a')]);_0x5593ef(_0xee3cf1[_0xc72f('0x1a')]);});});};}function emit(_0x331384,_0x5c1b8e,_0x5058e8){var _0x421d54={'uri':_0x331384+_0xc72f('0x3d')+_0x5058e8};io['to'](util[_0xc72f('0x26')](_0xc72f('0x3e'),_0x5c1b8e))[_0xc72f('0x3f')](_0xc72f('0x40'),_0x421d54);}exports['cs']=function(_0x3045d1,_0x255d62,_0x950df4,_0x554bb7,_0x41197b,_0x534999,_0x4a04d9,_0x567c2d){var _0x22d6cf={};var _0x41e931={'Authorization':_0xc72f('0x41')+_0x534999[_0xc72f('0x42')]};_0x534999[_0xc72f('0x43')]=intUtil[_0xc72f('0x44')](_0x534999[_0xc72f('0x43')]);_0x534999[_0xc72f('0x45')]=intUtil[_0xc72f('0x44')](_0x534999['serverUrl']);var _0x2e20aa=_0x534999[_0xc72f('0x43')];_0x22d6cf[_0xc72f('0x13')]=_0x534999['username'];_0x22d6cf[_0xc72f('0x28')]=_0x567c2d[_0xc72f('0x46')]()===_0xc72f('0x47')?_0x255d62[_0xc72f('0x48')]:_0x255d62[_0xc72f('0x49')];_0x22d6cf[_0xc72f('0x4a')]=_0x567c2d==='queue'||_0x567c2d===_0xc72f('0x4b')?'queue':'outbound';if(_0x554bb7){_0x22d6cf[_0xc72f('0x1c')]=_0x554bb7[_0xc72f('0x12')];}var _0x4f39d7=util[_0xc72f('0x26')](_0xc72f('0x4c'),_0x534999[_0xc72f('0x45')],_0x255d62[_0xc72f('0x4d')],md5(_0x255d62[_0xc72f('0x4d')]));if(_0x41197b&&_0x41197b['monitor_format']){logger[_0xc72f('0xd')](_0xc72f('0x4e'),_0xc72f('0x4f'));_0x255d62['recordingURL']=_0x4f39d7;}else if(_0x4a04d9&&_0x4a04d9['recordingFormat']&&_0x4a04d9['recordingFormat']!==_0xc72f('0x50')){logger[_0xc72f('0xd')]('[OUTBOUND]',_0xc72f('0x4f'));_0x255d62[_0xc72f('0x51')]=_0x4f39d7;}else{_0x255d62['recordingURL']='';}return getAdminId(_0x22d6cf,_0x567c2d,_0x41e931,_0x2e20aa)['then'](getUser(_0x567c2d,_0x41e931,_0x2e20aa))[_0xc72f('0xf')](getEndUser(_0x567c2d,_0x41e931,_0x2e20aa))[_0xc72f('0xf')](getTicket(_0x567c2d,_0x41e931,_0x2e20aa,_0x950df4,_0x255d62))[_0xc72f('0xf')](function(_0xdae498){logger['info'](util[_0xc72f('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0xdae498['ticketId']));if(_0x567c2d!==_0xc72f('0x4b')){logger[_0xc72f('0xd')]('['+[_0x567c2d[_0xc72f('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2e20aa,_0x554bb7[_0xc72f('0x52')],_0xdae498[_0xc72f('0x2a')]);}})['catch'](function(_0x2cf0b9){logger[_0xc72f('0x18')]('['+[_0x567c2d[_0xc72f('0x19')]()]+_0xc72f('0x53'),util[_0xc72f('0x54')](_0x2cf0b9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7ca6=['user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','bluebird','../../../../config/logger','freshsales','redis','socket.io-emitter','headers','then','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','agentEmail','User\x20found:','userId','Admin\x20selected','userEmail','/api/lookup?q=','&entities=contact','contacts','format','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/'];(function(_0x18c5a0,_0x2d19aa){var _0x490c7=function(_0x19cc18){while(--_0x19cc18){_0x18c5a0['push'](_0x18c5a0['shift']());}};_0x490c7(++_0x2d19aa);}(_0x7ca6,0x6d));var _0x67ca=function(_0x224d20,_0x122c12){_0x224d20=_0x224d20-0x0;var _0x287b24=_0x7ca6[_0x224d20];return _0x287b24;};'use strict';var _=require(_0x67ca('0x0'));var rp=require('request-promise');var md5=require(_0x67ca('0x1'));var util=require(_0x67ca('0x2'));var moment=require('moment');var Promise=require(_0x67ca('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x67ca('0x4'))(_0x67ca('0x5'));config[_0x67ca('0x6')]=_['defaults'](config[_0x67ca('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x67ca('0x7'))(new Redis(config['redis']));function getAdminId(_0x387392,_0x312c8e,_0x31cf22,_0x2a040b){return new Promise(function(_0x236456,_0xbe3de6){var _0x39ccff=![];var _0x2aa4bc={'method':'GET','uri':_0x2a040b+'/api/selector/owners','json':!![]};_0x2aa4bc[_0x67ca('0x8')]=_0x31cf22;logger['info']('Getting\x20admin\x20information');return rp(_0x2aa4bc)[_0x67ca('0x9')](function(_0x3cfce6){if(_0x3cfce6){var _0x136a40=_0x3cfce6[_0x67ca('0xa')];var _0xed2f31=null;for(_0xed2f31=0x0;_0xed2f31<_0x136a40[_0x67ca('0xb')];_0xed2f31++){if(_0x136a40[_0xed2f31][_0x67ca('0xc')]===_0x387392[_0x67ca('0xd')]){_0x387392[_0x67ca('0xe')]=_0x136a40[_0xed2f31]['id'];_0x39ccff=!![];}}if(_0x39ccff){logger[_0x67ca('0xf')](_0x67ca('0x10'),_0x387392[_0x67ca('0xe')]);_0x236456(_0x387392);}else{_0xbe3de6({'statusCode':0x194,'message':_0x67ca('0x11')});}}else{_0xbe3de6({'statusCode':0x194,'message':_0x67ca('0x11')});}})[_0x67ca('0x12')](function(_0x10a680){logger[_0x67ca('0x13')]('['+[_0x312c8e[_0x67ca('0x14')]()]+']',_0x10a680[_0x67ca('0x15')]);_0xbe3de6(_0x10a680);});});}function getUser(_0x4d90fd,_0x5ef487,_0x475591){return function(_0x3dae84){return new Promise(function(_0x531261,_0x60c20e){var _0x3a992c={'method':_0x67ca('0x16'),'uri':_0x475591+_0x67ca('0x17'),'json':!![]};_0x3a992c[_0x67ca('0x8')]=_0x5ef487;logger['info'](_0x67ca('0x18'));return rp(_0x3a992c)['then'](function(_0x16ebc6){if(_0x16ebc6){var _0x2b9694=_0x16ebc6[_0x67ca('0xa')];var _0x3b0f0a=![];var _0x4d46ec=null;if(_0x3dae84[_0x67ca('0x19')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x3dae84[_0x67ca('0x19')]);_0x3dae84['userEmail']=_0x3dae84[_0x67ca('0x19')];for(_0x4d46ec=0x0;_0x4d46ec<_0x2b9694[_0x67ca('0xb')];_0x4d46ec++){if(_0x2b9694[_0x4d46ec][_0x67ca('0xc')]===_0x3dae84[_0x67ca('0x19')]){_0x3b0f0a=!![];_0x3dae84['userId']=_0x2b9694[_0x4d46ec]['id'];logger[_0x67ca('0xf')](_0x67ca('0x1a'),_0x3dae84[_0x67ca('0x1b')]);}}}if(!_0x3b0f0a){logger[_0x67ca('0xf')](_0x67ca('0x1c'));_0x3dae84[_0x67ca('0x1d')]=_0x3dae84[_0x67ca('0xd')];_0x3dae84[_0x67ca('0x1b')]=_0x3dae84['adminId'];_0x3b0f0a=!![];}if(_0x3b0f0a){_0x531261(_0x3dae84);}else{_0x60c20e({'statusCode':0x194,'message':_0x67ca('0x11')});}}else{_0x60c20e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x67ca('0x12')](function(_0x5bcba6){logger[_0x67ca('0x13')]('['+[_0x4d90fd['toUpperCase']()]+']',_0x5bcba6[_0x67ca('0x15')]);_0x60c20e(_0x5bcba6);});});};}function searchContact(_0x153713,_0x1f7f3a,_0x40b04e,_0x40bf78){return new Promise(function(_0x3aebd9,_0x37a662){var _0x36504b={'method':_0x67ca('0x16'),'headers':_0x1f7f3a,'uri':_0x153713+_0x67ca('0x1e')+_0x40bf78+'&f='+_0x40b04e+_0x67ca('0x1f'),'json':!![]};rp(_0x36504b)[_0x67ca('0x9')](function(_0x2a0b8b){var _0x1b1bcf=_['find'](_0x2a0b8b[_0x67ca('0x20')][_0x67ca('0x20')],[_0x40b04e,_0x40bf78]);_0x3aebd9(_0x1b1bcf);})['catch'](function(_0x1a72c8){_0x37a662(_0x1a72c8);});});}function getEndUser(_0x67fca6,_0x29ae1a,_0x38aae5){return function(_0x1e5afa){return new Promise(function(_0x5551ea,_0x369ae3){logger['info'](util[_0x67ca('0x21')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1e5afa['contactNumber']));searchContact(_0x38aae5,_0x29ae1a,_0x67ca('0x22'),_0x1e5afa[_0x67ca('0x23')])['then'](function(_0x4536ee){if(_0x4536ee){_0x1e5afa[_0x67ca('0x24')]=_0x4536ee['id'];logger[_0x67ca('0xf')](_0x67ca('0x25'),_0x1e5afa[_0x67ca('0x24')]);return _0x5551ea(_0x1e5afa);}searchContact(_0x38aae5,_0x29ae1a,_0x67ca('0x26'),_0x1e5afa[_0x67ca('0x23')])[_0x67ca('0x9')](function(_0x22ec5d){if(_0x22ec5d){_0x1e5afa[_0x67ca('0x24')]=_0x22ec5d['id'];logger[_0x67ca('0xf')](_0x67ca('0x27'),_0x1e5afa[_0x67ca('0x24')]);return _0x5551ea(_0x1e5afa);}createEndUser(_0x1e5afa,_0x67fca6,_0x29ae1a,_0x38aae5)['then'](function(_0x9894e0){logger[_0x67ca('0xf')](_0x67ca('0x28'),_0x9894e0[_0x67ca('0x24')]);return _0x5551ea(_0x9894e0);});});})[_0x67ca('0x12')](function(_0x58c17b){_0x369ae3(_0x58c17b);});});};}function createEndUser(_0x3546c0,_0x139909,_0x5cfc2b,_0x7258b9){return new Promise(function(_0x581bda,_0x1bad2d){var _0x4d9c55=moment();var _0x525be8={'method':_0x67ca('0x29'),'uri':_0x7258b9+_0x67ca('0x2a'),'body':{'contact':{'last_name':_0x3546c0['contactNumber'],'work_number':_0x3546c0[_0x67ca('0x23')],'mobile_number':_0x3546c0[_0x67ca('0x23')],'owner_id':_0x3546c0[_0x67ca('0x1b')],'created_at':_0x4d9c55[_0x67ca('0x21')](_0x67ca('0x2b'))}},'json':!![]};_0x525be8['headers']=_0x5cfc2b;logger[_0x67ca('0xf')](_0x67ca('0x2c'));return rp(_0x525be8)[_0x67ca('0x9')](function(_0x2d94a7){_0x3546c0[_0x67ca('0x24')]=_0x2d94a7['contact']['id'];_0x581bda(_0x3546c0);})[_0x67ca('0x12')](function(_0xa1e01f){logger[_0x67ca('0x13')]('['+[_0x139909['toUpperCase']()]+']',_0xa1e01f['message']);_0x1bad2d(_0xa1e01f[_0x67ca('0x15')]);});});}function getTicket(_0x18b8f5,_0x23a750,_0x447366,_0x365c1c,_0x365df8){return function(_0x3182ee){logger[_0x67ca('0xf')](_0x67ca('0x2d'));return new Promise(function(_0x36cb77,_0x4b8df9){var _0x2d2a17=moment();var _0x1b8f00={'method':_0x67ca('0x29'),'uri':_0x447366+_0x67ca('0x2e'),'body':{'title':intUtil['getString'](_0x365c1c[_0x67ca('0x2f')],_0x365df8,'\x20'),'description':intUtil[_0x67ca('0x30')](_0x365c1c[_0x67ca('0x31')],_0x365df8,'\x0a'),'owner_id':_0x3182ee[_0x67ca('0x1b')],'creater_id':_0x3182ee[_0x67ca('0xe')],'targetable_id':_0x3182ee[_0x67ca('0x24')],'targetable_type':_0x67ca('0x32'),'created_at':_0x2d2a17[_0x67ca('0x21')](_0x67ca('0x2b')),'due_date':_0x2d2a17['add'](0x1e,'m')['format'](_0x67ca('0x2b'))},'json':!![]};_0x1b8f00[_0x67ca('0x8')]=_0x23a750;return rp(_0x1b8f00)['then'](function(_0x139f47){_0x3182ee[_0x67ca('0x33')]=_0x139f47[_0x67ca('0x34')]['id'];logger['info'](_0x67ca('0x35'),_0x3182ee['ticketId']);_0x36cb77(_0x3182ee);})['catch'](function(_0x44cc97){logger[_0x67ca('0x13')]('['+[_0x18b8f5['toUpperCase']()]+']',_0x44cc97[_0x67ca('0x15')]);_0x4b8df9(_0x44cc97[_0x67ca('0x15')]);});});};}function emit(_0x3669df,_0x2bb1f2,_0x4fb803){var _0x40d8b6={'uri':_0x3669df+_0x67ca('0x36')+_0x4fb803};io['to'](util[_0x67ca('0x21')](_0x67ca('0x37'),_0x2bb1f2))['emit'](_0x67ca('0x38'),_0x40d8b6);}exports['cs']=function(_0x547825,_0x2bd7f6,_0xf5553a,_0x152e98,_0x354885,_0x396c44,_0x76502e,_0x4cccfd){var _0x1488c0={};var _0x5d159b={'Authorization':_0x67ca('0x39')+_0x396c44[_0x67ca('0x3a')]};_0x396c44[_0x67ca('0x3b')]=intUtil[_0x67ca('0x3c')](_0x396c44[_0x67ca('0x3b')]);_0x396c44['serverUrl']=intUtil['stripTrailingSlash'](_0x396c44[_0x67ca('0x3d')]);var _0xd336eb=_0x396c44[_0x67ca('0x3b')];_0x1488c0[_0x67ca('0xd')]=_0x396c44[_0x67ca('0x3e')];_0x1488c0[_0x67ca('0x23')]=_0x4cccfd[_0x67ca('0x3f')]()==='outbound'?_0x2bd7f6[_0x67ca('0x40')]:_0x2bd7f6[_0x67ca('0x41')];_0x1488c0[_0x67ca('0x42')]=_0x4cccfd===_0x67ca('0x43')||_0x4cccfd===_0x67ca('0x44')?'queue':_0x67ca('0x45');if(_0x152e98){_0x1488c0[_0x67ca('0x19')]=_0x152e98[_0x67ca('0xc')];}var _0x78ab12=util[_0x67ca('0x21')](_0x67ca('0x46'),_0x396c44[_0x67ca('0x3d')],_0x2bd7f6['uniqueid'],md5(_0x2bd7f6['uniqueid']));if(_0x354885&&_0x354885[_0x67ca('0x47')]){logger[_0x67ca('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2bd7f6['recordingURL']=_0x78ab12;}else if(_0x76502e&&_0x76502e[_0x67ca('0x48')]&&_0x76502e[_0x67ca('0x48')]!==_0x67ca('0x49')){logger[_0x67ca('0xf')](_0x67ca('0x4a'),_0x67ca('0x4b'));_0x2bd7f6[_0x67ca('0x4c')]=_0x78ab12;}else{_0x2bd7f6['recordingURL']='';}return getAdminId(_0x1488c0,_0x4cccfd,_0x5d159b,_0xd336eb)[_0x67ca('0x9')](getUser(_0x4cccfd,_0x5d159b,_0xd336eb))[_0x67ca('0x9')](getEndUser(_0x4cccfd,_0x5d159b,_0xd336eb))[_0x67ca('0x9')](getTicket(_0x4cccfd,_0x5d159b,_0xd336eb,_0xf5553a,_0x2bd7f6))[_0x67ca('0x9')](function(_0x24a5f7){logger[_0x67ca('0xf')](util[_0x67ca('0x21')](_0x67ca('0x4d'),_0x24a5f7[_0x67ca('0x33')]));if(_0x4cccfd!=='unmanaged'){logger['info']('['+[_0x4cccfd['toUpperCase']()]+']',_0x67ca('0x4e'));emit(_0xd336eb,_0x152e98[_0x67ca('0x4f')],_0x24a5f7[_0x67ca('0x24')]);}})[_0x67ca('0x12')](function(_0x7405a7){logger[_0x67ca('0x13')]('['+[_0x4cccfd[_0x67ca('0x14')]()]+_0x67ca('0x50'),util[_0x67ca('0x51')](_0x7405a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 080973d..ab5125b 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbb1=['desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','zoho','servicenow','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','salesforce','sugarcrm','freshdesk'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x52577c,_0x3c2ff0){_0x52577c=_0x52577c-0x0;var _0xc2d3ec=_0xcbb1[_0x52577c];return _0xc2d3ec;};'use strict';var _=require('lodash');var util=require(_0x1cbb('0x0'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x1cbb('0x1'));var freshdesk=require(_0x1cbb('0x2'));var zoho=require(_0x1cbb('0x3'));var desk=require(_0x1cbb('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x1cbb('0x5'));var dynamics365=require(_0x1cbb('0x6'));var freshsales=require('./freshsales');var integrations=['zendesk',_0x1cbb('0x7'),_0x1cbb('0x8'),_0x1cbb('0x9'),'zoho',_0x1cbb('0xa'),_0x1cbb('0xb'),_0x1cbb('0xc'),_0x1cbb('0xd'),'servicenow'];exports[_0x1cbb('0xe')]=function(_0x3d37dc,_0x4c902c,_0x5709c0,_0x4ad043,_0x2a2e74,_0x10a347){if(_0x5709c0){if(_[_0x1cbb('0xf')](integrations,_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]())){try{var _0x24f950=null;var _0x559ba3='';var _0x4b63a9=_0x5709c0[_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]()];if(_0x4b63a9){var _0x3591d0=_0x4b63a9[_0x3d37dc[_0x1cbb('0x12')]];if(_0x3591d0){var _0x5ceb02=_['find'](_0x3591d0[_0x1cbb('0x13')],{'id':parseInt(_0x3d37dc[_0x1cbb('0x14')],0xa)});if(_0x5ceb02){if(_0x4ad043){if(_0x2a2e74&&_0x4c902c['queue']){_0x559ba3=_0x1cbb('0x15');}else if(_0x4c902c['routeId']){_0x559ba3=_0x1cbb('0x16');}else{console[_0x1cbb('0x17')](_0x1cbb('0x18'),_0x4c902c);}}else{_0x559ba3=_0x1cbb('0x19');}switch(_0x3d37dc['data1'][_0x1cbb('0x11')]()){case'zendesk':zendesk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x7'):salesforce[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'sugarcrm':sugarcrm[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x9'):freshdesk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0x1a'):zoho[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case _0x1cbb('0xa'):desk[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'vtiger':vtiger[_0x559ba3](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347);break;case'freshsales':freshsales['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;case _0x1cbb('0x1b'):servicenow['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;case _0x1cbb('0xc'):dynamics365['cs'](_0x3d37dc,_0x4c902c,_0x5ceb02,_0x4ad043,_0x2a2e74,_0x3591d0,_0x10a347,_0x559ba3);break;default:console[_0x1cbb('0x17')]('unknown\x20integration');}}else{_0x24f950=require(_0x1cbb('0x1c'))(_0x3d37dc['data1'][_0x1cbb('0x11')]());_0x24f950[_0x1cbb('0x1d')](_0x1cbb('0x1e'),util[_0x1cbb('0x1f')](_0x1cbb('0x20'),_0x3d37dc[_0x1cbb('0x10')]['toLowerCase'](),_0x3d37dc[_0x1cbb('0x14')]));}}else{_0x24f950=require(_0x1cbb('0x1c'))(_0x3d37dc[_0x1cbb('0x10')][_0x1cbb('0x11')]());_0x24f950[_0x1cbb('0x1d')](_0x1cbb('0x1e'),util[_0x1cbb('0x1f')](_0x1cbb('0x21'),_0x3d37dc['data1'][_0x1cbb('0x11')](),_0x3d37dc[_0x1cbb('0x12')]));}}else{}}catch(_0x1e9cf6){console[_0x1cbb('0x1d')](_0x1e9cf6);}}}}; \ No newline at end of file +var _0x4f4f=['../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','vtiger','dynamics365','log','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x4f4f,0x1ca));var _0xf4f4=function(_0x1cb931,_0x41493d){_0x1cb931=_0x1cb931-0x0;var _0x1ef86b=_0x4f4f[_0x1cb931];return _0x1ef86b;};'use strict';var _=require(_0xf4f4('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xf4f4('0x1'));var sugarcrm=require(_0xf4f4('0x2'));var freshdesk=require(_0xf4f4('0x3'));var zoho=require(_0xf4f4('0x4'));var desk=require('./desk');var vtiger=require(_0xf4f4('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xf4f4('0x6'));var freshsales=require(_0xf4f4('0x7'));var integrations=[_0xf4f4('0x8'),_0xf4f4('0x9'),_0xf4f4('0xa'),'freshdesk',_0xf4f4('0xb'),'desk','vtiger','dynamics365',_0xf4f4('0xc'),_0xf4f4('0xd')];exports[_0xf4f4('0xe')]=function(_0x4f5059,_0x560662,_0x45ca7b,_0x4a2920,_0x3e4d0a,_0x4431b3){if(_0x45ca7b){if(_[_0xf4f4('0xf')](integrations,_0x4f5059[_0xf4f4('0x10')][_0xf4f4('0x11')]())){try{var _0x1ab538=null;var _0x3b1776='';var _0x4b6fa7=_0x45ca7b[_0x4f5059[_0xf4f4('0x10')]['toLowerCase']()];if(_0x4b6fa7){var _0x4a0f3d=_0x4b6fa7[_0x4f5059[_0xf4f4('0x12')]];if(_0x4a0f3d){var _0x4943c8=_[_0xf4f4('0x13')](_0x4a0f3d[_0xf4f4('0x14')],{'id':parseInt(_0x4f5059[_0xf4f4('0x15')],0xa)});if(_0x4943c8){if(_0x4a2920){if(_0x3e4d0a&&_0x560662[_0xf4f4('0x16')]){_0x3b1776='queue';}else if(_0x560662['routeId']){_0x3b1776=_0xf4f4('0x17');}else{console['log'](_0xf4f4('0x18'),_0x560662);}}else{_0x3b1776=_0xf4f4('0x19');}switch(_0x4f5059['data1'][_0xf4f4('0x11')]()){case _0xf4f4('0x8'):zendesk[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0x9'):salesforce[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0xa'):sugarcrm[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0x1a'):freshdesk[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0xb'):zoho[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0x1b'):desk[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case _0xf4f4('0x1c'):vtiger[_0x3b1776](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3);break;case'freshsales':freshsales['cs'](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3,_0x3b1776);break;case'servicenow':servicenow['cs'](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3,_0x3b1776);break;case _0xf4f4('0x1d'):dynamics365['cs'](_0x4f5059,_0x560662,_0x4943c8,_0x4a2920,_0x3e4d0a,_0x4a0f3d,_0x4431b3,_0x3b1776);break;default:console[_0xf4f4('0x1e')](_0xf4f4('0x1f'));}}else{_0x1ab538=require('../../../../config/logger')(_0x4f5059[_0xf4f4('0x10')][_0xf4f4('0x11')]());_0x1ab538[_0xf4f4('0x20')](_0xf4f4('0x21'),util[_0xf4f4('0x22')](_0xf4f4('0x23'),_0x4f5059[_0xf4f4('0x10')][_0xf4f4('0x11')](),_0x4f5059[_0xf4f4('0x15')]));}}else{_0x1ab538=require(_0xf4f4('0x24'))(_0x4f5059[_0xf4f4('0x10')][_0xf4f4('0x11')]());_0x1ab538[_0xf4f4('0x20')](_0xf4f4('0x21'),util['format'](_0xf4f4('0x25'),_0x4f5059[_0xf4f4('0x10')][_0xf4f4('0x11')](),_0x4f5059[_0xf4f4('0x12')]));}}else{}}catch(_0x2f70b3){console['error'](_0x2f70b3);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index db138d4..713aba3 100644 --- a/server/services/ami/trigger/integration/salesforce.js +++ b/server/services/ami/trigger/integration/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7b3=['format','upperFirst','forEach','includes','picklist','idField','content','variable','variableName','toString','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','%s/%s/e','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','newTab','instanceUrl','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','WhatId','Case','contact','ContactId','account','leadId','sobject','create','isNil','validateEmail','User','find','execute','length','Email','info','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','Name','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','lead','Company','No\x20Company'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xb7b3,0x1aa));var _0x3b7b=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0xb7b3[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x3b7b('0x0'));var rp=require(_0x3b7b('0x1'));var moment=require(_0x3b7b('0x2'));var BPromise=require(_0x3b7b('0x3'));var md5=require('md5');var jsforce=require(_0x3b7b('0x4'));var util=require('util');var Redis=require(_0x3b7b('0x5'));var intUtil=require(_0x3b7b('0x6'));var config=require(_0x3b7b('0x7'));var logger=require(_0x3b7b('0x8'))(_0x3b7b('0x9'));config[_0x3b7b('0xa')]=_['defaults'](config[_0x3b7b('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3b7b('0xb'))(new Redis(config['redis']));function emit(_0x58431e,_0x38c31b,_0x3a1d10){io['to'](_0x58431e)['emit'](_0x38c31b,_0x3a1d10);}function getTicket(_0x48abb8,_0xcd0986,_0x34298e,_0x37de30,_0x34b0cb,_0x973b4d,_0x259b24,_0x41e5b5){var _0x3967da=Object[_0x3b7b('0xc')]({},{'OwnerId':_0xcd0986['id'],'Subject':intUtil[_0x3b7b('0xd')](_0x37de30[_0x3b7b('0xe')],_0x34b0cb,'\x20'),'Description':intUtil['getString'](_0x37de30[_0x3b7b('0xf')],_0x34b0cb,'\x0a')},getCustomFields(_0x973b4d,_0x34b0cb));if(_0x34298e){if(_0x37de30[_0x3b7b('0x10')]===_0x3b7b('0x11')){_0x3967da[_0x3b7b('0x12')]=moment[_0x3b7b('0x13')]();_0x3967da[_0x3b7b('0x14')]=![];_0x3967da[_0x3b7b('0x15')]=![];if(_0x34298e[_0x3b7b('0x16')]==='contact'||_0x34298e[_0x3b7b('0x16')]==='lead'){_0x3967da[_0x3b7b('0x17')]=_0x34298e['id'];}else if(_0x34298e['endUserType']==='account'){_0x3967da[_0x3b7b('0x18')]=_0x34298e['id'];}}else if(_0x37de30[_0x3b7b('0x10')]===_0x3b7b('0x19')){if(_0x34298e[_0x3b7b('0x16')]===_0x3b7b('0x1a')){_0x3967da[_0x3b7b('0x1b')]=_0x34298e['id'];}else if(_0x34298e[_0x3b7b('0x16')]===_0x3b7b('0x1c')){_0x3967da['AccountId']=_0x34298e['id'];}else if(_0x34298e[_0x3b7b('0x16')]==='lead'&&_0x37de30[_0x3b7b('0x1d')]){_0x3967da[_0x37de30['leadId']]=_0x34298e['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x259b24[_0x3b7b('0x1e')](_0x37de30[_0x3b7b('0x10')])[_0x3b7b('0x1f')](_0x3967da);}function getUser(_0x35981b,_0x307666,_0x324d18){if(!_[_0x3b7b('0x20')](_0x307666)&&intUtil[_0x3b7b('0x21')](_0x307666)){var _0xf7ffc={'Email':_0x307666};var _0x410b73={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x324d18[_0x3b7b('0x1e')](_0x3b7b('0x22'))[_0x3b7b('0x23')](_0xf7ffc,_0x410b73)[_0x3b7b('0x24')]()['then'](function(_0x42f948){if(_0x42f948[_0x3b7b('0x25')]){var _0x419977=_[_0x3b7b('0x23')](_0x42f948,function(_0x293056){return _0x293056[_0x3b7b('0x26')]===_0x307666;});if(_0x419977){logger[_0x3b7b('0x27')](_0x3b7b('0x28'),_0x307666);return BPromise[_0x3b7b('0x29')]({'id':_0x419977['Id'],'name':_0x419977['Name']});}}else{logger[_0x3b7b('0x27')](_0x3b7b('0x2a'),_0x307666);return _0x324d18[_0x3b7b('0x2b')]()[_0x3b7b('0x2c')](function(_0xa307a7){return BPromise[_0x3b7b('0x29')]({'id':_0xa307a7[_0x3b7b('0x2d')],'name':_0xa307a7[_0x3b7b('0x2e')]});});}});}else{logger[_0x3b7b('0x27')](_0x3b7b('0x2a'),_0x307666);return _0x324d18[_0x3b7b('0x2b')]()[_0x3b7b('0x2c')](function(_0xb518b3){return BPromise[_0x3b7b('0x29')]({'id':_0xb518b3['user_id'],'name':_0xb518b3[_0x3b7b('0x2e')]});});}}function getEndUser(_0x32247c,_0x47458a,_0x3a9181,_0x397b8b,_0x15edaf){var _0x2bc750={'$or':{'Phone':_0x397b8b}};var _0x6e0eac={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3b7b('0x29')]()[_0x3b7b('0x2c')](function(){logger[_0x3b7b('0x27')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x397b8b,_0x47458a[_0x3b7b('0x2f')]);switch(_0x47458a['moduleSearch']){case'contact_lead':var _0x3dd58c=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x65d892={};_0x65d892[_0x47458a['additionalSearchContact']]=_0x397b8b;_[_0x3b7b('0x32')](_0x3dd58c['$or'],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x3dd58c,_0x6e0eac)[_0x3b7b('0x24')]()[_0x3b7b('0x2c')](function(_0x383942){if(_0x383942&&_0x383942[_0x3b7b('0x25')]){return _0x383942;}else{var _0x573a4b=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x53b816={};_0x53b816[_0x47458a['additionalSearchLead']]=_0x397b8b;_[_0x3b7b('0x32')](_0x573a4b['$or'],_0x53b816);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x35'))[_0x3b7b('0x23')](_0x573a4b,_0x6e0eac);}});case _0x3b7b('0x36'):var _0x44bc2e=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x37')]){var _0x65d892={};_0x65d892[_0x47458a['additionalSearchAccount']]=_0x397b8b;_[_0x3b7b('0x32')](_0x44bc2e[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x39'))[_0x3b7b('0x23')](_0x44bc2e,_0x6e0eac)[_0x3b7b('0x24')]()[_0x3b7b('0x2c')](function(_0x2efbdd){if(_0x2efbdd&&_0x2efbdd['length']){return _0x2efbdd;}else{var _0x71a011=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x1680a0={};_0x1680a0[_0x47458a[_0x3b7b('0x31')]]=_0x397b8b;_['merge'](_0x71a011[_0x3b7b('0x38')],_0x1680a0);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x71a011,_0x6e0eac)[_0x3b7b('0x2c')](function(_0x35cee3){if(_0x35cee3&&_0x35cee3[_0x3b7b('0x25')]){return _0x35cee3;}else{var _0x45932f=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x514abd={};_0x514abd[_0x47458a[_0x3b7b('0x34')]]=_0x397b8b;_[_0x3b7b('0x32')](_0x45932f[_0x3b7b('0x38')],_0x514abd);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x35'))[_0x3b7b('0x23')](_0x45932f,_0x6e0eac);}});}});case _0x3b7b('0x1a'):var _0x3dd58c=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x31')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x31')]]=_0x397b8b;_['merge'](_0x3dd58c[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf[_0x3b7b('0x1e')](_0x3b7b('0x33'))[_0x3b7b('0x23')](_0x3dd58c,_0x6e0eac)[_0x3b7b('0x24')]();case'lead':var _0xc8e864=_[_0x3b7b('0x30')](_0x2bc750);if(_0x47458a[_0x3b7b('0x34')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x34')]]=_0x397b8b;_['merge'](_0xc8e864[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf['sobject']('Lead')[_0x3b7b('0x23')](_0xc8e864,_0x6e0eac);case _0x3b7b('0x1c'):var _0x44bc2e=_['cloneDeep'](_0x2bc750);if(_0x47458a[_0x3b7b('0x37')]){var _0x65d892={};_0x65d892[_0x47458a[_0x3b7b('0x37')]]=_0x397b8b;_['merge'](_0x44bc2e[_0x3b7b('0x38')],_0x65d892);}return _0x15edaf['sobject'](_0x3b7b('0x39'))['find'](_0x44bc2e,_0x6e0eac);default:return null;}})['then'](function(_0x4a41cf){if(_0x4a41cf&&_0x4a41cf[_0x3b7b('0x25')]){var _0x3e58f3=_['first'](_0x4a41cf);if(_0x3e58f3){return BPromise[_0x3b7b('0x29')]({'id':_0x3e58f3['Id'],'name':_0x3e58f3[_0x3b7b('0x3a')],'phone':_0x3e58f3[_0x3b7b('0x3b')],'endUserType':_0x3e58f3['attributes'][_0x3b7b('0x3c')]['toLowerCase']()});}}})[_0x3b7b('0x2c')](function(_0x2271fe){if(_0x2271fe){logger[_0x3b7b('0x27')](_0x3b7b('0x3d'),_0x2271fe[_0x3b7b('0x16')],_0x397b8b);return BPromise['resolve'](_0x2271fe);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x397b8b);var _0x4dc1de={'Phone':_0x397b8b};if(_0x47458a['moduleCreate']){if(_0x47458a[_0x3b7b('0x3e')]===_0x3b7b('0x1a')){logger[_0x3b7b('0x27')](_0x3b7b('0x3f'),_0x397b8b,_0x47458a[_0x3b7b('0x3e')]);_0x4dc1de[_0x3b7b('0x40')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util['format'](_0x3b7b('0x42'),_0x397b8b);}else if(_0x47458a['moduleCreate']===_0x3b7b('0x43')){logger[_0x3b7b('0x27')](_0x3b7b('0x3f'),_0x397b8b,_0x47458a['moduleCreate']);_0x4dc1de[_0x3b7b('0x40')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util['format'](_0x3b7b('0x42'),_0x397b8b);_0x4dc1de[_0x3b7b('0x44')]=_0x3b7b('0x45');}else if(_0x47458a[_0x3b7b('0x3e')]===_0x3b7b('0x1c')){logger[_0x3b7b('0x27')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x397b8b,_0x47458a[_0x3b7b('0x3e')]);_0x4dc1de[_0x3b7b('0x3a')]=_0x3a9181!==_0x3b7b('0x41')?_0x3a9181:util[_0x3b7b('0x46')](_0x3b7b('0x42'),_0x397b8b);}else{return null;}}return _0x15edaf[_0x3b7b('0x1e')](_[_0x3b7b('0x47')](_0x47458a['moduleCreate']))[_0x3b7b('0x1f')](_0x4dc1de)[_0x3b7b('0x2c')](function(_0x34ee8){return BPromise[_0x3b7b('0x29')]({'id':_0x34ee8['id'],'endUserType':_0x47458a[_0x3b7b('0x3e')]});});}});}function getCustomFields(_0x4b4c7e,_0x5b5d69){var _0x3f59e1={};if(_0x4b4c7e[_0x3b7b('0x25')]>0x0){_[_0x3b7b('0x48')](_0x4b4c7e,function(_0xa8fce){if(_[_0x3b7b('0x49')](['string',_0x3b7b('0x4a')],_0xa8fce[_0x3b7b('0x3c')])&&_0xa8fce[_0x3b7b('0x4b')]){_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0xa8fce[_0x3b7b('0x4c')]['toString']();}else if(_0xa8fce['type']===_0x3b7b('0x4d')&&_0xa8fce['variableName']&&_0xa8fce['idField']){_0x5b5d69[_0xa8fce[_0x3b7b('0x4e')]]&&(_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0x5b5d69[_0xa8fce[_0x3b7b('0x4e')]][_0x3b7b('0x4f')]());}else if(_0xa8fce['type']==='customVariable'&&_0xa8fce[_0x3b7b('0x50')]&&_0xa8fce['Variable'][_0x3b7b('0x51')]&&_0xa8fce[_0x3b7b('0x4b')]){_0x5b5d69[_0xa8fce[_0x3b7b('0x50')][_0x3b7b('0x51')][_0x3b7b('0x52')]()]&&(_0x3f59e1[_0xa8fce[_0x3b7b('0x4b')]]=_0x5b5d69[_0xa8fce['Variable']['name']['toLowerCase']()][_0x3b7b('0x4f')]());}});}return _0x3f59e1;}function getConnection(_0x26e10d){var _0x40c0a6=_0x26e10d[_0x3b7b('0x53')]['concat'](_0x26e10d[_0x3b7b('0x54')]);var _0x63b336=new jsforce[(_0x3b7b('0x55'))]({'oauth2':{'loginUrl':_0x26e10d[_0x3b7b('0x56')]||_0x3b7b('0x57'),'clientId':_0x26e10d[_0x3b7b('0x58')],'clientSecret':_0x26e10d[_0x3b7b('0x59')]}});return _0x63b336['login'](_0x26e10d[_0x3b7b('0x5a')],_0x40c0a6)[_0x3b7b('0x2c')](function(){logger[_0x3b7b('0x27')](_0x3b7b('0x5b'));return _0x63b336;});}exports['queue']=function(_0x504a8a,_0x5c7124,_0x309ceb,_0x30ebed,_0xcd1523,_0x79cbc4){var _0x209a38,_0xe2937c,_0x574585,_0x2dfae1;_0x79cbc4[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0x79cbc4['serverUrl']);_0x79cbc4[_0x3b7b('0x56')]=intUtil['stripTrailingSlash'](_0x79cbc4[_0x3b7b('0x56')]);if(_0xcd1523&&_0xcd1523[_0x3b7b('0x5e')]){logger[_0x3b7b('0x27')](_0x3b7b('0x5f'),_0x3b7b('0x60'));_0x5c7124[_0x3b7b('0x61')]=util[_0x3b7b('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x79cbc4[_0x3b7b('0x5c')],_0x5c7124['uniqueid'],md5(_0x5c7124[_0x3b7b('0x62')]));}else{_0x5c7124[_0x3b7b('0x61')]='';}return getConnection(_0x79cbc4)[_0x3b7b('0x2c')](function(_0x49d7b2){_0x2dfae1=_0x49d7b2;return getUser(_0x79cbc4,_0x30ebed['email'],_0x2dfae1);})['then'](function(_0x1c9a5f){_0x209a38=_0x1c9a5f;return getEndUser(_0x79cbc4,_0x309ceb,_0x5c7124[_0x3b7b('0x63')],_0x5c7124[_0x3b7b('0x64')],_0x2dfae1);})[_0x3b7b('0x2c')](function(_0x358d24){_0xe2937c=_0x358d24;return getTicket(_0x79cbc4,_0x209a38,_0xe2937c,_0x309ceb,_0x5c7124,_0x309ceb[_0x3b7b('0x65')],_0x2dfae1,_0x3b7b('0x66'));})[_0x3b7b('0x2c')](function(_0x4a9124){_0x574585=_0x4a9124;logger[_0x3b7b('0x27')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x574585['id']);logger[_0x3b7b('0x27')](_0x3b7b('0x67'),_0x574585['id'],_0x30ebed[_0x3b7b('0x51')],_0x79cbc4[_0x3b7b('0x3c')]);switch(_0x79cbc4[_0x3b7b('0x3c')]){case'integrationTab':emit(util[_0x3b7b('0x46')](_0x3b7b('0x68'),_0x30ebed[_0x3b7b('0x51')]),_0x3b7b('0x69'),{'recordId':_0x574585['id']});break;case'newTab':emit(util[_0x3b7b('0x46')](_0x3b7b('0x68'),_0x30ebed[_0x3b7b('0x51')]),'trigger:browser:url',{'uri':util[_0x3b7b('0x46')](_0x3b7b('0x6a'),_0x2dfae1['instanceUrl'],_0x574585['id'])});break;default:logger[_0x3b7b('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2d703e){logger[_0x3b7b('0x6b')](_0x3b7b('0x5f'),_0x2d703e);});};exports[_0x3b7b('0x6c')]=function(_0x4da458,_0xb72f96,_0xc3e2f5,_0x2b0154,_0x40e2c6,_0xc6f882,_0x464ad5){var _0x1dced3,_0x118e4d,_0x3803d3,_0x1879cf;_0xc6f882[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0xc6f882[_0x3b7b('0x5c')]);_0xc6f882[_0x3b7b('0x56')]=intUtil[_0x3b7b('0x5d')](_0xc6f882[_0x3b7b('0x56')]);if(_0x464ad5&&_0x464ad5[_0x3b7b('0x6d')]&&_0x464ad5[_0x3b7b('0x6d')]!==_0x3b7b('0x6e')){logger[_0x3b7b('0x27')](_0x3b7b('0x6f'),_0x3b7b('0x60'));_0xb72f96[_0x3b7b('0x61')]=util[_0x3b7b('0x46')](_0x3b7b('0x70'),_0xc6f882[_0x3b7b('0x5c')],_0xb72f96[_0x3b7b('0x62')],md5(_0xb72f96['uniqueid']));}return getConnection(_0xc6f882)[_0x3b7b('0x2c')](function(_0x4217df){_0x1879cf=_0x4217df;return getUser(_0xc6f882,_0x2b0154[_0x3b7b('0x71')],_0x1879cf);})[_0x3b7b('0x2c')](function(_0x837abd){_0x1dced3=_0x837abd;return getEndUser(_0xc6f882,_0xc3e2f5,_0xb72f96['destcalleridname'],_0xb72f96['destcalleridnum'],_0x1879cf);})['then'](function(_0x9e7b8){_0x118e4d=_0x9e7b8;return getTicket(_0xc6f882,_0x1dced3,_0x118e4d,_0xc3e2f5,_0xb72f96,_0xc3e2f5['Fields'],_0x1879cf,_0x3b7b('0x6c'));})['then'](function(_0x45ae26){_0x3803d3=_0x45ae26;logger[_0x3b7b('0x27')](_0x3b7b('0x72'),_0x3803d3['id']);logger[_0x3b7b('0x27')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3803d3['id'],_0x2b0154[_0x3b7b('0x51')],_0xc6f882[_0x3b7b('0x3c')]);switch(_0xc6f882[_0x3b7b('0x3c')]){case _0x3b7b('0x73'):emit(util['format']('user:%s',_0x2b0154[_0x3b7b('0x51')]),_0x3b7b('0x69'),{'recordId':_0x3803d3['id']});break;case _0x3b7b('0x74'):emit(util[_0x3b7b('0x46')]('user:%s',_0x2b0154[_0x3b7b('0x51')]),'trigger:browser:url',{'uri':util[_0x3b7b('0x46')](_0x3b7b('0x6a'),_0x1879cf[_0x3b7b('0x75')],_0x3803d3['id'])});break;default:logger[_0x3b7b('0x6b')](_0x3b7b('0x6f'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x527a5d){logger['error'](_0x3b7b('0x6f'),_0x527a5d);});};exports[_0x3b7b('0x76')]=function(_0x1dabc4,_0x5472c7,_0x576ebd,_0x5596a7,_0x42bf20,_0x5d5791){var _0x47fcc9,_0x1a4a33,_0x35271f,_0x1a3bcb;_0x5d5791[_0x3b7b('0x5c')]=intUtil[_0x3b7b('0x5d')](_0x5d5791[_0x3b7b('0x5c')]);_0x5d5791[_0x3b7b('0x56')]=intUtil[_0x3b7b('0x5d')](_0x5d5791[_0x3b7b('0x56')]);if(_0x42bf20&&_0x42bf20[_0x3b7b('0x5e')]){logger[_0x3b7b('0x27')]('['+_0x5472c7[_0x3b7b('0x77')]['toUpperCase']()+']',_0x3b7b('0x60'));_0x5472c7[_0x3b7b('0x61')]=util['format'](_0x3b7b('0x70'),_0x5d5791[_0x3b7b('0x5c')],_0x5472c7[_0x3b7b('0x62')],md5(_0x5472c7['uniqueid']));}else{_0x5472c7[_0x3b7b('0x61')]='';}return getConnection(_0x5d5791)[_0x3b7b('0x2c')](function(_0x2c9f2b){_0x1a3bcb=_0x2c9f2b;if(!_['isNil'](_0x5596a7)){return getUser(_0x5d5791,_0x5596a7[_0x3b7b('0x51')],_0x1a3bcb);}else{return getUser(_0x5d5791,null,_0x1a3bcb);}})[_0x3b7b('0x2c')](function(_0x52a88e){_0x47fcc9=_0x52a88e;return getEndUser(_0x5d5791,_0x576ebd,_0x5472c7[_0x3b7b('0x63')],_0x5472c7['calleridnum'],_0x1a3bcb);})[_0x3b7b('0x2c')](function(_0xf1626a){_0x1a4a33=_0xf1626a;return getTicket(_0x5d5791,_0x47fcc9,_0x1a4a33,_0x576ebd,_0x5472c7,_0x576ebd[_0x3b7b('0x65')],_0x1a3bcb);})[_0x3b7b('0x2c')](function(_0x44a293){_0x35271f=_0x44a293;logger[_0x3b7b('0x27')]('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+_0x3b7b('0x79'),_0x35271f['id']);logger['info']('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+_0x3b7b('0x7a'),_0x5d5791[_0x3b7b('0x3c')]);})[_0x3b7b('0x7b')](function(_0x48060e){logger[_0x3b7b('0x6b')]('['+_0x5472c7[_0x3b7b('0x77')][_0x3b7b('0x78')]()+']',_0x48060e);});}; \ No newline at end of file +var _0xf4c1=['Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','find','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','length','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','','forEach','includes','string','picklist','idField','content','toString','variable','variableName','type','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','none','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','localhost','emit','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','User','execute','then','Email','Agent\x20%s\x20found.'];(function(_0x13bda1,_0x55a6d4){var _0x5461fc=function(_0x1cefe9){while(--_0x1cefe9){_0x13bda1['push'](_0x13bda1['shift']());}};_0x5461fc(++_0x55a6d4);}(_0xf4c1,0x161));var _0x1f4c=function(_0x37bf35,_0x11f919){_0x37bf35=_0x37bf35-0x0;var _0xddfc34=_0xf4c1[_0x37bf35];return _0xddfc34;};'use strict';var _=require(_0x1f4c('0x0'));var rp=require('request-promise');var moment=require(_0x1f4c('0x1'));var BPromise=require(_0x1f4c('0x2'));var md5=require(_0x1f4c('0x3'));var jsforce=require(_0x1f4c('0x4'));var util=require(_0x1f4c('0x5'));var Redis=require(_0x1f4c('0x6'));var intUtil=require(_0x1f4c('0x7'));var config=require('../../../../config/environment');var logger=require(_0x1f4c('0x8'))(_0x1f4c('0x9'));config[_0x1f4c('0xa')]=_['defaults'](config[_0x1f4c('0xa')],{'host':_0x1f4c('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f4c('0xa')]));function emit(_0x3dc0da,_0xea6ac6,_0x5769d8){io['to'](_0x3dc0da)[_0x1f4c('0xc')](_0xea6ac6,_0x5769d8);}function getTicket(_0x559abd,_0x4c6620,_0x2db519,_0x4c9442,_0x3f9195,_0x3f7736,_0x2dbde9,_0x30fa4b){var _0x73af75=Object[_0x1f4c('0xd')]({},{'OwnerId':_0x4c6620['id'],'Subject':intUtil[_0x1f4c('0xe')](_0x4c9442[_0x1f4c('0xf')],_0x3f9195,'\x20'),'Description':intUtil['getString'](_0x4c9442[_0x1f4c('0x10')],_0x3f9195,'\x0a')},getCustomFields(_0x3f7736,_0x3f9195));if(_0x2db519){if(_0x4c9442['ticketType']===_0x1f4c('0x11')){_0x73af75[_0x1f4c('0x12')]=moment[_0x1f4c('0x13')]();_0x73af75[_0x1f4c('0x14')]=![];_0x73af75[_0x1f4c('0x15')]=![];if(_0x2db519[_0x1f4c('0x16')]===_0x1f4c('0x17')||_0x2db519[_0x1f4c('0x16')]===_0x1f4c('0x18')){_0x73af75[_0x1f4c('0x19')]=_0x2db519['id'];}else if(_0x2db519[_0x1f4c('0x16')]===_0x1f4c('0x1a')){_0x73af75[_0x1f4c('0x1b')]=_0x2db519['id'];}}else if(_0x4c9442[_0x1f4c('0x1c')]===_0x1f4c('0x1d')){if(_0x2db519[_0x1f4c('0x16')]===_0x1f4c('0x17')){_0x73af75[_0x1f4c('0x1e')]=_0x2db519['id'];}else if(_0x2db519[_0x1f4c('0x16')]==='account'){_0x73af75[_0x1f4c('0x1f')]=_0x2db519['id'];}else if(_0x2db519[_0x1f4c('0x16')]===_0x1f4c('0x18')&&_0x4c9442[_0x1f4c('0x20')]){_0x73af75[_0x4c9442[_0x1f4c('0x20')]]=_0x2db519['id'];}else{logger[_0x1f4c('0x21')](_0x1f4c('0x22'));}}}return _0x2dbde9['sobject'](_0x4c9442[_0x1f4c('0x1c')])[_0x1f4c('0x23')](_0x73af75);}function getUser(_0x238177,_0x537da4,_0x2700d4){if(!_[_0x1f4c('0x24')](_0x537da4)&&intUtil['validateEmail'](_0x537da4)){var _0x4dba44={'Email':_0x537da4};var _0x43472a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2700d4[_0x1f4c('0x25')](_0x1f4c('0x26'))['find'](_0x4dba44,_0x43472a)[_0x1f4c('0x27')]()[_0x1f4c('0x28')](function(_0x4d4301){if(_0x4d4301['length']){var _0xe3437=_['find'](_0x4d4301,function(_0x1f3918){return _0x1f3918[_0x1f4c('0x29')]===_0x537da4;});if(_0xe3437){logger[_0x1f4c('0x21')](_0x1f4c('0x2a'),_0x537da4);return BPromise['resolve']({'id':_0xe3437['Id'],'name':_0xe3437[_0x1f4c('0x2b')]});}}else{logger['info'](_0x1f4c('0x2c'),_0x537da4);return _0x2700d4[_0x1f4c('0x2d')]()[_0x1f4c('0x28')](function(_0x26c501){return BPromise['resolve']({'id':_0x26c501[_0x1f4c('0x2e')],'name':_0x26c501[_0x1f4c('0x2f')]});});}});}else{logger[_0x1f4c('0x21')](_0x1f4c('0x2c'),_0x537da4);return _0x2700d4[_0x1f4c('0x2d')]()[_0x1f4c('0x28')](function(_0x487969){return BPromise[_0x1f4c('0x30')]({'id':_0x487969[_0x1f4c('0x2e')],'name':_0x487969[_0x1f4c('0x2f')]});});}}function getEndUser(_0x4e7aff,_0x92609e,_0x1531c0,_0x4a7a9b,_0x252a08){var _0xcdc039={'$or':{'Phone':_0x4a7a9b}};var _0x19daf5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1f4c('0x30')]()[_0x1f4c('0x28')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4a7a9b,_0x92609e[_0x1f4c('0x31')]);switch(_0x92609e[_0x1f4c('0x31')]){case _0x1f4c('0x32'):var _0x3d0e03=_['cloneDeep'](_0xcdc039);if(_0x92609e[_0x1f4c('0x33')]){var _0x2ecb8a={};_0x2ecb8a[_0x92609e[_0x1f4c('0x33')]]=_0x4a7a9b;_[_0x1f4c('0x34')](_0x3d0e03[_0x1f4c('0x35')],_0x2ecb8a);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x36'))[_0x1f4c('0x37')](_0x3d0e03,_0x19daf5)[_0x1f4c('0x27')]()['then'](function(_0x220304){if(_0x220304&&_0x220304['length']){return _0x220304;}else{var _0x7ae865=_[_0x1f4c('0x38')](_0xcdc039);if(_0x92609e[_0x1f4c('0x39')]){var _0x237007={};_0x237007[_0x92609e[_0x1f4c('0x39')]]=_0x4a7a9b;_[_0x1f4c('0x34')](_0x7ae865[_0x1f4c('0x35')],_0x237007);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x3a'))[_0x1f4c('0x37')](_0x7ae865,_0x19daf5);}});case _0x1f4c('0x3b'):var _0xa2a4c4=_['cloneDeep'](_0xcdc039);if(_0x92609e[_0x1f4c('0x3c')]){var _0x2ecb8a={};_0x2ecb8a[_0x92609e['additionalSearchAccount']]=_0x4a7a9b;_[_0x1f4c('0x34')](_0xa2a4c4[_0x1f4c('0x35')],_0x2ecb8a);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x3d'))[_0x1f4c('0x37')](_0xa2a4c4,_0x19daf5)[_0x1f4c('0x27')]()[_0x1f4c('0x28')](function(_0x48067f){if(_0x48067f&&_0x48067f[_0x1f4c('0x3e')]){return _0x48067f;}else{var _0x4d890f=_[_0x1f4c('0x38')](_0xcdc039);if(_0x92609e[_0x1f4c('0x33')]){var _0x1df642={};_0x1df642[_0x92609e[_0x1f4c('0x33')]]=_0x4a7a9b;_[_0x1f4c('0x34')](_0x4d890f[_0x1f4c('0x35')],_0x1df642);}return _0x252a08['sobject'](_0x1f4c('0x36'))[_0x1f4c('0x37')](_0x4d890f,_0x19daf5)['then'](function(_0x3744f5){if(_0x3744f5&&_0x3744f5[_0x1f4c('0x3e')]){return _0x3744f5;}else{var _0x4a48ae=_[_0x1f4c('0x38')](_0xcdc039);if(_0x92609e[_0x1f4c('0x39')]){var _0x4fffab={};_0x4fffab[_0x92609e[_0x1f4c('0x39')]]=_0x4a7a9b;_['merge'](_0x4a48ae[_0x1f4c('0x35')],_0x4fffab);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x3a'))['find'](_0x4a48ae,_0x19daf5);}});}});case'contact':var _0x3d0e03=_['cloneDeep'](_0xcdc039);if(_0x92609e['additionalSearchContact']){var _0x2ecb8a={};_0x2ecb8a[_0x92609e[_0x1f4c('0x33')]]=_0x4a7a9b;_['merge'](_0x3d0e03[_0x1f4c('0x35')],_0x2ecb8a);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x36'))[_0x1f4c('0x37')](_0x3d0e03,_0x19daf5)[_0x1f4c('0x27')]();case _0x1f4c('0x18'):var _0x43a815=_[_0x1f4c('0x38')](_0xcdc039);if(_0x92609e[_0x1f4c('0x39')]){var _0x2ecb8a={};_0x2ecb8a[_0x92609e[_0x1f4c('0x39')]]=_0x4a7a9b;_[_0x1f4c('0x34')](_0x43a815[_0x1f4c('0x35')],_0x2ecb8a);}return _0x252a08['sobject']('Lead')['find'](_0x43a815,_0x19daf5);case _0x1f4c('0x1a'):var _0xa2a4c4=_[_0x1f4c('0x38')](_0xcdc039);if(_0x92609e[_0x1f4c('0x3c')]){var _0x2ecb8a={};_0x2ecb8a[_0x92609e['additionalSearchAccount']]=_0x4a7a9b;_[_0x1f4c('0x34')](_0xa2a4c4[_0x1f4c('0x35')],_0x2ecb8a);}return _0x252a08[_0x1f4c('0x25')](_0x1f4c('0x3d'))['find'](_0xa2a4c4,_0x19daf5);default:return null;}})[_0x1f4c('0x28')](function(_0xd1b6ba){if(_0xd1b6ba&&_0xd1b6ba[_0x1f4c('0x3e')]){var _0x2f9920=_[_0x1f4c('0x3f')](_0xd1b6ba);if(_0x2f9920){return BPromise[_0x1f4c('0x30')]({'id':_0x2f9920['Id'],'name':_0x2f9920['Name'],'phone':_0x2f9920[_0x1f4c('0x40')],'endUserType':_0x2f9920[_0x1f4c('0x41')]['type'][_0x1f4c('0x42')]()});}}})[_0x1f4c('0x28')](function(_0x1c9f66){if(_0x1c9f66){logger['info'](_0x1f4c('0x43'),_0x1c9f66[_0x1f4c('0x16')],_0x4a7a9b);return BPromise[_0x1f4c('0x30')](_0x1c9f66);}else{logger[_0x1f4c('0x21')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x4a7a9b);var _0x3a0467={'Phone':_0x4a7a9b};if(_0x92609e[_0x1f4c('0x44')]){if(_0x92609e[_0x1f4c('0x44')]===_0x1f4c('0x17')){logger[_0x1f4c('0x21')](_0x1f4c('0x45'),_0x4a7a9b,_0x92609e[_0x1f4c('0x44')]);_0x3a0467[_0x1f4c('0x46')]=_0x1531c0!==''?_0x1531c0:util[_0x1f4c('0x47')]('Caller\x20-\x20%s',_0x4a7a9b);}else if(_0x92609e[_0x1f4c('0x44')]===_0x1f4c('0x18')){logger[_0x1f4c('0x21')](_0x1f4c('0x45'),_0x4a7a9b,_0x92609e['moduleCreate']);_0x3a0467[_0x1f4c('0x46')]=_0x1531c0!==''?_0x1531c0:util[_0x1f4c('0x47')](_0x1f4c('0x48'),_0x4a7a9b);_0x3a0467[_0x1f4c('0x49')]=_0x1f4c('0x4a');}else if(_0x92609e['moduleCreate']===_0x1f4c('0x1a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4a7a9b,_0x92609e[_0x1f4c('0x44')]);_0x3a0467[_0x1f4c('0x2b')]=_0x1531c0!==_0x1f4c('0x4b')?_0x1531c0:util[_0x1f4c('0x47')](_0x1f4c('0x48'),_0x4a7a9b);}else{return null;}}return _0x252a08['sobject'](_['upperFirst'](_0x92609e['moduleCreate']))['create'](_0x3a0467)[_0x1f4c('0x28')](function(_0x39ba68){return BPromise[_0x1f4c('0x30')]({'id':_0x39ba68['id'],'endUserType':_0x92609e[_0x1f4c('0x44')]});});}});}function getCustomFields(_0x4dd19a,_0x3fb1f1){var _0x5758e6={};if(_0x4dd19a[_0x1f4c('0x3e')]>0x0){_[_0x1f4c('0x4c')](_0x4dd19a,function(_0x48cb7a){if(_[_0x1f4c('0x4d')]([_0x1f4c('0x4e'),_0x1f4c('0x4f')],_0x48cb7a['type'])&&_0x48cb7a[_0x1f4c('0x50')]){_0x5758e6[_0x48cb7a[_0x1f4c('0x50')]]=_0x48cb7a[_0x1f4c('0x51')][_0x1f4c('0x52')]();}else if(_0x48cb7a['type']===_0x1f4c('0x53')&&_0x48cb7a[_0x1f4c('0x54')]&&_0x48cb7a[_0x1f4c('0x50')]){_0x3fb1f1[_0x48cb7a[_0x1f4c('0x54')]]&&(_0x5758e6[_0x48cb7a[_0x1f4c('0x50')]]=_0x3fb1f1[_0x48cb7a[_0x1f4c('0x54')]][_0x1f4c('0x52')]());}else if(_0x48cb7a[_0x1f4c('0x55')]===_0x1f4c('0x56')&&_0x48cb7a[_0x1f4c('0x57')]&&_0x48cb7a['Variable'][_0x1f4c('0x58')]&&_0x48cb7a[_0x1f4c('0x50')]){_0x3fb1f1[_0x48cb7a['Variable'][_0x1f4c('0x58')][_0x1f4c('0x42')]()]&&(_0x5758e6[_0x48cb7a['idField']]=_0x3fb1f1[_0x48cb7a['Variable'][_0x1f4c('0x58')]['toLowerCase']()][_0x1f4c('0x52')]());}});}return _0x5758e6;}function getConnection(_0x187cf1){var _0x2902b3=_0x187cf1[_0x1f4c('0x59')][_0x1f4c('0x5a')](_0x187cf1[_0x1f4c('0x5b')]);var _0x71a803=new jsforce[(_0x1f4c('0x5c'))]({'oauth2':{'loginUrl':_0x187cf1[_0x1f4c('0x5d')]||_0x1f4c('0x5e'),'clientId':_0x187cf1[_0x1f4c('0x5f')],'clientSecret':_0x187cf1[_0x1f4c('0x60')]}});return _0x71a803['login'](_0x187cf1[_0x1f4c('0x61')],_0x2902b3)['then'](function(){logger['info']('Connection\x20established.');return _0x71a803;});}exports['queue']=function(_0x5dde35,_0x49e9db,_0x2cdb7e,_0x1806e0,_0x454a11,_0x5a279e){var _0x3714c0,_0xb07fe8,_0x22f938,_0x3da911;_0x5a279e[_0x1f4c('0x62')]=intUtil['stripTrailingSlash'](_0x5a279e[_0x1f4c('0x62')]);_0x5a279e[_0x1f4c('0x5d')]=intUtil[_0x1f4c('0x63')](_0x5a279e['remoteUri']);if(_0x454a11&&_0x454a11[_0x1f4c('0x64')]){logger[_0x1f4c('0x21')](_0x1f4c('0x65'),_0x1f4c('0x66'));_0x49e9db[_0x1f4c('0x67')]=util['format'](_0x1f4c('0x68'),_0x5a279e[_0x1f4c('0x62')],_0x49e9db[_0x1f4c('0x69')],md5(_0x49e9db['uniqueid']));}else{_0x49e9db[_0x1f4c('0x67')]='';}return getConnection(_0x5a279e)[_0x1f4c('0x28')](function(_0xcdab85){_0x3da911=_0xcdab85;return getUser(_0x5a279e,_0x1806e0['email'],_0x3da911);})['then'](function(_0x51b2d0){_0x3714c0=_0x51b2d0;return getEndUser(_0x5a279e,_0x2cdb7e,_0x49e9db[_0x1f4c('0x6a')],_0x49e9db['calleridnum'],_0x3da911);})[_0x1f4c('0x28')](function(_0x3bb2d1){_0xb07fe8=_0x3bb2d1;return getTicket(_0x5a279e,_0x3714c0,_0xb07fe8,_0x2cdb7e,_0x49e9db,_0x2cdb7e[_0x1f4c('0x6b')],_0x3da911,_0x1f4c('0x6c'));})[_0x1f4c('0x28')](function(_0x2d6c44){_0x22f938=_0x2d6c44;logger[_0x1f4c('0x21')](_0x1f4c('0x6d'),_0x22f938['id']);logger[_0x1f4c('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x22f938['id'],_0x1806e0['name'],_0x5a279e[_0x1f4c('0x55')]);switch(_0x5a279e[_0x1f4c('0x55')]){case _0x1f4c('0x6e'):emit(util[_0x1f4c('0x47')](_0x1f4c('0x6f'),_0x1806e0['name']),_0x1f4c('0x70'),{'recordId':_0x22f938['id']});break;case'newTab':emit(util['format'](_0x1f4c('0x6f'),_0x1806e0[_0x1f4c('0x58')]),_0x1f4c('0x71'),{'uri':util[_0x1f4c('0x47')]('%s/%s/e',_0x3da911[_0x1f4c('0x72')],_0x22f938['id'])});break;default:logger[_0x1f4c('0x73')](_0x1f4c('0x74'));}})[_0x1f4c('0x75')](function(_0x435c07){logger[_0x1f4c('0x73')](_0x1f4c('0x65'),_0x435c07);});};exports['outbound']=function(_0x4f1496,_0x5c0f96,_0x2e3e3a,_0x4201fd,_0xdb8ee6,_0x3334eb,_0x389c27){var _0x13e9dc,_0x1689fb,_0x422765,_0x7b4d8c;_0x3334eb[_0x1f4c('0x62')]=intUtil[_0x1f4c('0x63')](_0x3334eb[_0x1f4c('0x62')]);_0x3334eb[_0x1f4c('0x5d')]=intUtil[_0x1f4c('0x63')](_0x3334eb['remoteUri']);if(_0x389c27&&_0x389c27['recordingFormat']&&_0x389c27['recordingFormat']!==_0x1f4c('0x76')){logger[_0x1f4c('0x21')](_0x1f4c('0x77'),_0x1f4c('0x66'));_0x5c0f96[_0x1f4c('0x67')]=util[_0x1f4c('0x47')](_0x1f4c('0x68'),_0x3334eb['serverUrl'],_0x5c0f96[_0x1f4c('0x69')],md5(_0x5c0f96[_0x1f4c('0x69')]));}return getConnection(_0x3334eb)[_0x1f4c('0x28')](function(_0x1b92c1){_0x7b4d8c=_0x1b92c1;return getUser(_0x3334eb,_0x4201fd['email'],_0x7b4d8c);})[_0x1f4c('0x28')](function(_0x185bb6){_0x13e9dc=_0x185bb6;return getEndUser(_0x3334eb,_0x2e3e3a,_0x5c0f96[_0x1f4c('0x78')],_0x5c0f96['destcalleridnum'],_0x7b4d8c);})['then'](function(_0x1e1176){_0x1689fb=_0x1e1176;return getTicket(_0x3334eb,_0x13e9dc,_0x1689fb,_0x2e3e3a,_0x5c0f96,_0x2e3e3a[_0x1f4c('0x6b')],_0x7b4d8c,_0x1f4c('0x79'));})['then'](function(_0x40adc6){_0x422765=_0x40adc6;logger[_0x1f4c('0x21')](_0x1f4c('0x7a'),_0x422765['id']);logger['info'](_0x1f4c('0x7b'),_0x422765['id'],_0x4201fd[_0x1f4c('0x58')],_0x3334eb[_0x1f4c('0x55')]);switch(_0x3334eb[_0x1f4c('0x55')]){case _0x1f4c('0x6e'):emit(util['format'](_0x1f4c('0x6f'),_0x4201fd[_0x1f4c('0x58')]),'trigger:salesforce:display',{'recordId':_0x422765['id']});break;case _0x1f4c('0x7c'):emit(util[_0x1f4c('0x47')](_0x1f4c('0x6f'),_0x4201fd['name']),_0x1f4c('0x71'),{'uri':util[_0x1f4c('0x47')]('%s/%s/e',_0x7b4d8c[_0x1f4c('0x72')],_0x422765['id'])});break;default:logger[_0x1f4c('0x73')]('[OUTBOUND]',_0x1f4c('0x7d'));}})[_0x1f4c('0x75')](function(_0x274206){logger[_0x1f4c('0x73')](_0x1f4c('0x77'),_0x274206);});};exports[_0x1f4c('0x7e')]=function(_0x96b7a5,_0x137adf,_0x4027de,_0x3dcef0,_0x299c30,_0x3009b5){var _0x2c4190,_0x1388aa,_0x23c308,_0x20f610;_0x3009b5[_0x1f4c('0x62')]=intUtil[_0x1f4c('0x63')](_0x3009b5['serverUrl']);_0x3009b5[_0x1f4c('0x5d')]=intUtil[_0x1f4c('0x63')](_0x3009b5['remoteUri']);if(_0x299c30&&_0x299c30[_0x1f4c('0x64')]){logger[_0x1f4c('0x21')]('['+_0x137adf[_0x1f4c('0x7f')][_0x1f4c('0x80')]()+']',_0x1f4c('0x66'));_0x137adf[_0x1f4c('0x67')]=util[_0x1f4c('0x47')](_0x1f4c('0x68'),_0x3009b5[_0x1f4c('0x62')],_0x137adf[_0x1f4c('0x69')],md5(_0x137adf[_0x1f4c('0x69')]));}else{_0x137adf['recordingURL']='';}return getConnection(_0x3009b5)[_0x1f4c('0x28')](function(_0x46aaa4){_0x20f610=_0x46aaa4;if(!_[_0x1f4c('0x24')](_0x3dcef0)){return getUser(_0x3009b5,_0x3dcef0[_0x1f4c('0x58')],_0x20f610);}else{return getUser(_0x3009b5,null,_0x20f610);}})[_0x1f4c('0x28')](function(_0x5dfb43){_0x2c4190=_0x5dfb43;return getEndUser(_0x3009b5,_0x4027de,_0x137adf[_0x1f4c('0x6a')],_0x137adf[_0x1f4c('0x81')],_0x20f610);})[_0x1f4c('0x28')](function(_0x4c2387){_0x1388aa=_0x4c2387;return getTicket(_0x3009b5,_0x2c4190,_0x1388aa,_0x4027de,_0x137adf,_0x4027de['Fields'],_0x20f610);})[_0x1f4c('0x28')](function(_0xf97d1){_0x23c308=_0xf97d1;logger[_0x1f4c('0x21')]('['+_0x137adf[_0x1f4c('0x7f')][_0x1f4c('0x80')]()+_0x1f4c('0x82'),_0x23c308['id']);logger[_0x1f4c('0x21')]('['+_0x137adf[_0x1f4c('0x7f')]['toUpperCase']()+_0x1f4c('0x83'),_0x3009b5[_0x1f4c('0x55')]);})[_0x1f4c('0x75')](function(_0x42eb44){logger[_0x1f4c('0x73')]('['+_0x137adf[_0x1f4c('0x7f')]['toUpperCase']()+']',_0x42eb44);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 283d13a..3a1ce40 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x691e=['toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','string','picklist','type','nameField','customField','toLowerCase','toString','includes','idField','content','customVariable','Variable','name','incident','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','ticketNumber','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','length','adminId','info'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x691e,0xc9));var _0xe691=function(_0x57bb51,_0x5b2d77){_0x57bb51=_0x57bb51-0x0;var _0x3f854a=_0x691e[_0x57bb51];return _0x3f854a;};'use strict';var _=require(_0xe691('0x0'));var Promise=require(_0xe691('0x1'));var rp=require('request-promise');var util=require(_0xe691('0x2'));var md5=require(_0xe691('0x3'));var Redis=require(_0xe691('0x4'));var intUtil=require('./util');var config=require(_0xe691('0x5'));var logger=require('../../../../config/logger')(_0xe691('0x6'));config[_0xe691('0x7')]=_[_0xe691('0x8')](config[_0xe691('0x7')],{'host':_0xe691('0x9'),'port':0x18eb});var io=require(_0xe691('0xa'))(new Redis(config[_0xe691('0x7')]));function getAdminUser(_0x289c8c,_0xde5e99,_0x1a4b16,_0x2007b4,_0x339f29,_0x5a8dd8){return new Promise(function(_0x53abed,_0x5e348d){var _0x21ee97={'method':_0xe691('0xb'),'uri':_0x2007b4+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x339f29+'&'+_0x5a8dd8,'auth':_0xde5e99,'json':!![]};return rp(_0x21ee97)[_0xe691('0xc')](function(_0x513291){if(_0x513291[_0xe691('0xd')][_0xe691('0xe')]>0x0){_0x1a4b16[_0xe691('0xf')]=_0x513291['result'][0x0]['sys_id'];}logger[_0xe691('0x10')]('['+[_0x289c8c[_0xe691('0x11')]()]+_0xe691('0x12'),_0x1a4b16);_0x53abed(_0x1a4b16);})[_0xe691('0x13')](function(_0x560376){logger[_0xe691('0x14')]('['+[_0x289c8c[_0xe691('0x11')]()]+']',_0x560376['message']);_0x5e348d(_0x560376[_0xe691('0x15')]);});});}function getUser(_0x5ea90f,_0x2cd88a,_0x2e1d62,_0x49abe9,_0x5639d2){return function(_0x50eaae){logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x16'),_0x50eaae);return new Promise(function(_0x23baaa,_0xef0280){if(intUtil['validateEmail'](_0x50eaae[_0xe691('0x17')])){var _0x128356={'method':_0xe691('0xb'),'uri':_0x2e1d62+'sys_user?sysparm_query=email%3D'+_0x50eaae[_0xe691('0x17')]+'&'+_0x49abe9+'&'+_0x5639d2,'auth':_0x2cd88a,'json':!![]};logger['info']('['+[_0x5ea90f['toUpperCase']()]+_0xe691('0x18'),_0x128356);return rp(_0x128356)[_0xe691('0xc')](function(_0x462182){logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x19'),_0x462182);if(_0x462182[_0xe691('0xd')]['length']>0x0&&String(_0x462182['result'][0x0]['active'])===_0xe691('0x1a')){_0x50eaae['userId']=_0x462182[_0xe691('0xd')][0x0][_0xe691('0x1b')];}else{_0x50eaae[_0xe691('0x1c')]=_0x50eaae[_0xe691('0xf')];_0x50eaae[_0xe691('0x17')]=_0x50eaae[_0xe691('0x1d')];}logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x1e'),_0x50eaae);_0x23baaa(_0x50eaae);})[_0xe691('0x13')](function(_0x1c5d75){logger[_0xe691('0x14')]('['+[_0x5ea90f[_0xe691('0x11')]()]+']',_0x1c5d75['message']);_0xef0280(_0x1c5d75[_0xe691('0x15')]);});}else{logger[_0xe691('0x10')]('['+[_0x5ea90f[_0xe691('0x11')]()]+_0xe691('0x1f'));_0x50eaae[_0xe691('0x1c')]=_0x50eaae[_0xe691('0xf')];_0x50eaae[_0xe691('0x17')]=_0x50eaae[_0xe691('0x1d')];_0x23baaa(_0x50eaae);}});};}function createEndUser(_0x2f4b7c,_0x59395d,_0x276be7,_0x3a0429,_0x4db704){logger[_0xe691('0x10')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+_0xe691('0x20'),_0x276be7);return new Promise(function(_0x35ecbf,_0xd6f647){var _0x5de330={'method':_0xe691('0x21'),'uri':_0x3a0429+_0xe691('0x22')+_0x4db704,'body':{'user_name':_0x276be7[_0xe691('0x23')],'roles':_0xe691('0x24'),'first_name':_0x276be7[_0xe691('0x23')],'active':_0xe691('0x1a'),'date_format':_0xe691('0x25'),'phone':_0x276be7[_0xe691('0x23')]},'auth':_0x59395d,'json':!![]};return rp(_0x5de330)['then'](function(_0x22aabf){logger[_0xe691('0x10')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+'],\x20EndUser\x20schema',_0x22aabf[_0xe691('0xd')]);_0x276be7[_0xe691('0x26')]=_0x22aabf[_0xe691('0xd')][_0xe691('0x1b')];_0x35ecbf(_0x276be7);})[_0xe691('0x13')](function(_0x1d15ff){logger[_0xe691('0x14')]('['+[_0x2f4b7c[_0xe691('0x11')]()]+']',_0x1d15ff[_0xe691('0x15')]);_0xd6f647(_0x1d15ff['message']);});});}function getEndUser(_0x34f4dd,_0x3a1e20,_0x3062eb,_0x30a70d,_0x55622e){return function(_0x1ddfa3){logger[_0xe691('0x10')]('['+[_0x34f4dd['toUpperCase']()]+_0xe691('0x27'),_0x1ddfa3);return new Promise(function(_0x15ec58,_0x124b83){var _0x3c76a3={'method':_0xe691('0xb'),'uri':_0x3062eb+_0xe691('0x28')+_0x1ddfa3[_0xe691('0x23')]+'&'+_0x30a70d+'&'+_0x55622e,'auth':_0x3a1e20,'json':!![]};return rp(_0x3c76a3)['then'](function(_0x535a3b){if(_0x535a3b['result'][_0xe691('0xe')]>0x0){_0x1ddfa3[_0xe691('0x26')]=_0x535a3b[_0xe691('0xd')][0x0][_0xe691('0x1b')];logger[_0xe691('0x10')]('['+[_0x34f4dd[_0xe691('0x11')]()]+_0xe691('0x29'),_0x1ddfa3);_0x15ec58(_0x1ddfa3);}else{return createEndUser(_0x34f4dd,_0x3a1e20,_0x1ddfa3,_0x3062eb,_0x30a70d)[_0xe691('0xc')](function(_0x5157a0){logger['info']('['+[_0x34f4dd[_0xe691('0x11')]()]+_0xe691('0x2a'),_0x5157a0);_0x15ec58(_0x5157a0);});}})[_0xe691('0x13')](function(_0x5cf486){logger[_0xe691('0x14')]('['+[_0x34f4dd[_0xe691('0x11')]()]+']',_0x5cf486['message']);_0x124b83(_0x5cf486[_0xe691('0x15')]);});});};}function getCustomFields(_0x3ba5e8,_0xc1fda9){var _0x50fb24={};if(_0x3ba5e8[_0xe691('0xe')]>0x0){_['forEach'](_0x3ba5e8,function(_0x24d139){if(_['includes']([_0xe691('0x2b'),_0xe691('0x2c')],_0x24d139[_0xe691('0x2d')])&&_0x24d139[_0xe691('0x2e')]&&!_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x2e')][_0xe691('0x30')]()]=_0x24d139['content'][_0xe691('0x31')]();}else if(_[_0xe691('0x32')]([_0xe691('0x2b'),_0xe691('0x2c')],_0x24d139['type'])&&_0x24d139[_0xe691('0x33')]&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0x24d139[_0xe691('0x34')][_0xe691('0x31')]();}else if(_0x24d139['type']==='variable'&&_0x24d139['variableName']&&_0x24d139[_0xe691('0x33')]&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0xc1fda9[_0x24d139['variableName']][_0xe691('0x31')]();}else if(_0x24d139[_0xe691('0x2d')]===_0xe691('0x35')&&_0x24d139[_0xe691('0x36')]&&_0x24d139[_0xe691('0x36')]['name']&&_0x24d139['idField']&&_0x24d139[_0xe691('0x2f')]){_0x50fb24[_0x24d139[_0xe691('0x33')][_0xe691('0x30')]()]=_0xc1fda9[_0x24d139[_0xe691('0x36')][_0xe691('0x37')][_0xe691('0x30')]()][_0xe691('0x31')]();}});}return _0x50fb24;}function getTicket(_0x35c375,_0x5afb3f,_0x2b8a6f,_0x1af9b7,_0xe8bb35,_0x35b2de){return function(_0x56f117){logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x56f117);return new Promise(function(_0x13d11f,_0x5b863a){var _0x5c100b=_0x35c375[_0xe691('0x30')]()==='outbound'?_0x56f117[_0xe691('0x1c')]:_0x56f117[_0xe691('0x26')];var _0x32496c={'method':_0xe691('0x21'),'uri':_0x2b8a6f+_0xe691('0x38')+'?'+_0x35b2de,'body':Object['assign']({},{'active':_0xe691('0x1a'),'caller_id':_0x5c100b,'assigned_to':_0x56f117[_0xe691('0x1c')],'short_description':intUtil['getString'](_0x1af9b7[_0xe691('0x39')],_0xe8bb35,'\x20'),'description':intUtil['getString'](_0x1af9b7[_0xe691('0x3a')],_0xe8bb35,'\x0a')},getCustomFields(_0x1af9b7[_0xe691('0x3b')],_0xe8bb35)),'auth':_0x5afb3f,'json':!![]};return rp(_0x32496c)[_0xe691('0xc')](function(_0x40037f){logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+_0xe691('0x3c'),_0x40037f['result']);_0x56f117['ticketId']=_0x40037f['result'][_0xe691('0x1b')];_0x56f117['ticketNumber']=_0x40037f[_0xe691('0xd')][_0xe691('0x3d')];logger[_0xe691('0x10')]('['+[_0x35c375[_0xe691('0x11')]()]+_0xe691('0x3e'),_0x56f117);_0x13d11f(_0x56f117);})[_0xe691('0x13')](function(_0x9b118d){logger['error']('['+[_0x35c375[_0xe691('0x11')]()]+']',_0x9b118d[_0xe691('0x15')]);_0x5b863a(_0x9b118d[_0xe691('0x15')]);});});};}function createRemoteTag(_0x4b95aa,_0xf05c9b,_0x4fd57e,_0x18d375){return new Promise(function(_0x1a849b,_0x2d5df4){var _0x101efa={'method':_0xe691('0x21'),'uri':_0x4fd57e+_0xe691('0x3f')+'?'+_0x18d375,'body':{'short_description':_0x4b95aa,'global':!![],'active':!![],'name':_0x4b95aa},'auth':_0xf05c9b,'json':!![]};return rp(_0x101efa)[_0xe691('0xc')](function(_0x2ea3d5){var _0x2805da=_0x2ea3d5[_0xe691('0xd')][_0xe691('0x1b')];_0x1a849b(_0x2805da);});});}function getRemoteTag(_0x3f7e27,_0x570cd6,_0x11a7e3,_0x28a3d,_0x3a0b62){return new Promise(function(_0x269286,_0x2ff898){var _0x1c5af9={'method':'GET','uri':_0x11a7e3+_0xe691('0x3f')+_0xe691('0x40')+_0x3f7e27+'&'+_0x28a3d,'auth':_0x570cd6,'json':!![]};return rp(_0x1c5af9)[_0xe691('0xc')](function(_0x28cf43){if(_0x28cf43['result']['length']>0x0){var _0xae4589=_0x28cf43[_0xe691('0xd')][0x0][_0xe691('0x1b')];_0x269286(_0xae4589);}else{return createRemoteTag(_0x3f7e27,_0x570cd6,_0x11a7e3,_0x28a3d)['then'](function(_0x4da146){_0x269286(_0x4da146);});}});});}function assignTagToIncident(_0x4b636c,_0x374298,_0xb84c6a,_0x4bf8fc,_0x2aad43){return new Promise(function(_0x4b8686,_0xd0259a){var _0x3950af={'method':_0xe691('0x21'),'uri':_0xb84c6a+'label_entry'+'?'+_0x2aad43,'body':{'label':_0x4b636c,'table':_0xe691('0x38'),'id_type':_0xe691('0x41'),'table_key':_0x4bf8fc['ticketId'],'title':_0xe691('0x42')+_0x4bf8fc[_0xe691('0x43')],'id_display':_0x4bf8fc[_0xe691('0x43')]},'auth':_0x374298,'json':!![]};return rp(_0x3950af)[_0xe691('0xc')](function(_0x1c1148){_0x4b8686();})[_0xe691('0x13')](function(){_0x4b8686();});});}function manageTags(_0x1c1966,_0x1f7345,_0x4b6899,_0x2baada,_0xe2dd63,_0x294fb3,_0x271faf){return new Promise(function(_0x246e5e,_0x4c4758){var _0x16f08f=[];_0x1f7345[_0xe691('0x44')](function(_0xf58d5a){_0x16f08f[_0xe691('0x45')](getRemoteTag(_0xf58d5a,_0x4b6899,_0x2baada,_0x294fb3,_0x271faf));});return Promise[_0xe691('0x46')](_0x16f08f)['then'](function(_0x947de6){if(_0x947de6[_0xe691('0xe')]){logger[_0xe691('0x10')]('['+[_0x1c1966[_0xe691('0x11')]()]+_0xe691('0x47'),_0x947de6);var _0x2f4973=[];_0x947de6['forEach'](function(_0x50431e){_0x2f4973[_0xe691('0x45')](assignTagToIncident(_0x50431e,_0x4b6899,_0x2baada,_0xe2dd63,_0x294fb3));});return Promise['all'](_0x2f4973)['then'](function(){_0x246e5e();})[_0xe691('0x13')](function(){_0x246e5e();});}else{_0x246e5e();}});});}function getTags(_0x226169,_0x486952,_0x4ca4f1,_0x4f5e72,_0x2ce758,_0x2fd9fc){return function(_0x1655b2){return new Promise(function(_0x27d726,_0x18854d){var _0x57ca1a=[];var _0x37bf85=_0x4f5e72[_0xe691('0x48')];if(_0x37bf85&&_0x37bf85[_0xe691('0xe')]>0x0){_0x57ca1a=_[_0xe691('0x49')](_0x37bf85,_0xe691('0x37'));}if(_0x57ca1a[_0xe691('0xe')]>0x0){return manageTags(_0x226169,_0x57ca1a,_0x486952,_0x4ca4f1,_0x1655b2,_0x2ce758,_0x2fd9fc)[_0xe691('0xc')](function(){_0x27d726(_0x1655b2);});}else{_0x27d726(_0x1655b2);}});};}function emit(_0xe89284,_0x3edda1,_0x32ea7a){var _0x74e41f='%26sysparm_record_target%3Dincident'+_0xe691('0x4a')+_0xe691('0x4b')+_0xe691('0x4c');var _0x38fd02={'uri':_0xe89284+_0xe691('0x4d')+_0x32ea7a+_0x74e41f};io['to'](util[_0xe691('0x4e')](_0xe691('0x4f'),_0x3edda1))[_0xe691('0x50')](_0xe691('0x51'),_0x38fd02);}exports['cs']=function(_0x2465ae,_0x39ded0,_0x563c69,_0x2b4c6f,_0x1fc47a,_0x588a82,_0x3fbd38,_0x4afc5c){var _0x420901={};var _0x4b0d60={'user':_0x588a82['username'],'pass':_0x588a82['password']};var _0x1f08db='sysparm_limit=1';var _0x4d9af2=_0xe691('0x52');_0x588a82[_0xe691('0x53')]=intUtil[_0xe691('0x54')](_0x588a82[_0xe691('0x53')]);_0x588a82[_0xe691('0x55')]=intUtil[_0xe691('0x54')](_0x588a82[_0xe691('0x55')]);var _0xd60390=util[_0xe691('0x4e')](_0xe691('0x56'),_0x588a82[_0xe691('0x53')]);_0x420901['userEmail']=!_[_0xe691('0x57')](_0x2b4c6f)?_0x2b4c6f[_0xe691('0x58')]:null;_0x420901[_0xe691('0x1d')]=_0x588a82[_0xe691('0x58')];_0x420901['endUserNumber']=_0x4afc5c[_0xe691('0x30')]()===_0xe691('0x59')?_0x39ded0[_0xe691('0x5a')]:_0x39ded0[_0xe691('0x5b')];_0x420901[_0xe691('0x5c')]=_0x4afc5c==='queue'||_0x4afc5c===_0xe691('0x5d')?_0xe691('0x5e'):_0xe691('0x59');var _0x22f18b=util[_0xe691('0x4e')](_0xe691('0x5f'),_0x588a82['serverUrl'],_0x39ded0['uniqueid'],md5(_0x39ded0[_0xe691('0x60')]));if(_0x1fc47a&&_0x1fc47a[_0xe691('0x61')]){logger[_0xe691('0x10')](_0xe691('0x62'),_0xe691('0x63'));_0x39ded0[_0xe691('0x64')]=_0x22f18b;}else if(_0x3fbd38&&_0x3fbd38[_0xe691('0x65')]&&_0x3fbd38[_0xe691('0x65')]!==_0xe691('0x66')){logger[_0xe691('0x10')](_0xe691('0x67'),'Recording\x20is\x20enabled!');_0x39ded0[_0xe691('0x64')]=_0x22f18b;}else{_0x39ded0[_0xe691('0x64')]='';}return getAdminUser(_0x4afc5c,_0x4b0d60,_0x420901,_0xd60390,_0x4d9af2,_0x1f08db)[_0xe691('0xc')](getUser(_0x4afc5c,_0x4b0d60,_0xd60390,_0x4d9af2,_0x1f08db))[_0xe691('0xc')](getEndUser(_0x4afc5c,_0x4b0d60,_0xd60390,_0x4d9af2,_0x1f08db))['then'](getTicket(_0x4afc5c,_0x4b0d60,_0xd60390,_0x563c69,_0x39ded0,_0x4d9af2))[_0xe691('0xc')](function(_0x4cde33){logger['info'](util[_0xe691('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4cde33['ticketId']));logger['info'](util[_0xe691('0x4e')](_0xe691('0x68'),_0x4afc5c));if(_0x4afc5c!==_0xe691('0x5d')){logger[_0xe691('0x10')]('['+[_0x4afc5c[_0xe691('0x11')]()]+']',_0xe691('0x69'));emit(_0x588a82[_0xe691('0x53')],_0x2b4c6f[_0xe691('0x37')],_0x4cde33[_0xe691('0x6a')]);}})[_0xe691('0x13')](function(_0x43c39a){logger[_0xe691('0x14')]('['+[_0x4afc5c[_0xe691('0x11')]()]+_0xe691('0x6b'),util[_0xe691('0x6c')](_0x43c39a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0ea5=['],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','length','true','userId','error',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D'];(function(_0x55656c,_0x1a156d){var _0x3591fe=function(_0x52cdba){while(--_0x52cdba){_0x55656c['push'](_0x55656c['shift']());}};_0x3591fe(++_0x1a156d);}(_0x0ea5,0xb2));var _0x50ea=function(_0x58c0f1,_0x16f88a){_0x58c0f1=_0x58c0f1-0x0;var _0x2287f8=_0x0ea5[_0x58c0f1];return _0x2287f8;};'use strict';var _=require(_0x50ea('0x0'));var Promise=require(_0x50ea('0x1'));var rp=require(_0x50ea('0x2'));var util=require(_0x50ea('0x3'));var md5=require(_0x50ea('0x4'));var Redis=require(_0x50ea('0x5'));var intUtil=require(_0x50ea('0x6'));var config=require(_0x50ea('0x7'));var logger=require(_0x50ea('0x8'))('servicenow');config['redis']=_['defaults'](config[_0x50ea('0x9')],{'host':_0x50ea('0xa'),'port':0x18eb});var io=require(_0x50ea('0xb'))(new Redis(config[_0x50ea('0x9')]));function getAdminUser(_0x484c83,_0x4b209a,_0x5a3ebf,_0x3a6574,_0x390661,_0x39916b){return new Promise(function(_0x5572a8,_0x57ea7f){var _0x30691b={'method':'GET','uri':_0x3a6574+_0x50ea('0xc')+'&'+_0x390661+'&'+_0x39916b,'auth':_0x4b209a,'json':!![]};return rp(_0x30691b)[_0x50ea('0xd')](function(_0x26486f){if(_0x26486f['result']['length']>0x0){_0x5a3ebf[_0x50ea('0xe')]=_0x26486f['result'][0x0][_0x50ea('0xf')];}logger[_0x50ea('0x10')]('['+[_0x484c83['toUpperCase']()]+_0x50ea('0x11'),_0x5a3ebf);_0x5572a8(_0x5a3ebf);})[_0x50ea('0x12')](function(_0x431802){logger['error']('['+[_0x484c83[_0x50ea('0x13')]()]+']',_0x431802[_0x50ea('0x14')]);_0x57ea7f(_0x431802[_0x50ea('0x14')]);});});}function getUser(_0xe64292,_0xdebabb,_0x43292c,_0x3b18b4,_0x393099){return function(_0x556567){logger['info']('['+[_0xe64292[_0x50ea('0x13')]()]+_0x50ea('0x15'),_0x556567);return new Promise(function(_0x50ef52,_0x322c2b){if(intUtil[_0x50ea('0x16')](_0x556567[_0x50ea('0x17')])){var _0x4d9f67={'method':_0x50ea('0x18'),'uri':_0x43292c+_0x50ea('0x19')+_0x556567[_0x50ea('0x17')]+'&'+_0x3b18b4+'&'+_0x393099,'auth':_0xdebabb,'json':!![]};logger[_0x50ea('0x10')]('['+[_0xe64292[_0x50ea('0x13')]()]+_0x50ea('0x1a'),_0x4d9f67);return rp(_0x4d9f67)[_0x50ea('0xd')](function(_0x257f44){logger['info']('['+[_0xe64292[_0x50ea('0x13')]()]+_0x50ea('0x1b'),_0x257f44);if(_0x257f44[_0x50ea('0x1c')][_0x50ea('0x1d')]>0x0&&String(_0x257f44['result'][0x0]['active'])===_0x50ea('0x1e')){_0x556567[_0x50ea('0x1f')]=_0x257f44[_0x50ea('0x1c')][0x0]['sys_id'];}else{_0x556567[_0x50ea('0x1f')]=_0x556567['adminId'];_0x556567[_0x50ea('0x17')]=_0x556567['adminEmail'];}logger[_0x50ea('0x10')]('['+[_0xe64292[_0x50ea('0x13')]()]+'],\x20getUser\x20crm',_0x556567);_0x50ef52(_0x556567);})[_0x50ea('0x12')](function(_0x13f9ef){logger[_0x50ea('0x20')]('['+[_0xe64292[_0x50ea('0x13')]()]+']',_0x13f9ef[_0x50ea('0x14')]);_0x322c2b(_0x13f9ef['message']);});}else{logger[_0x50ea('0x10')]('['+[_0xe64292[_0x50ea('0x13')]()]+_0x50ea('0x21'));_0x556567[_0x50ea('0x1f')]=_0x556567[_0x50ea('0xe')];_0x556567[_0x50ea('0x17')]=_0x556567[_0x50ea('0x22')];_0x50ef52(_0x556567);}});};}function createEndUser(_0x2654fb,_0x3a709a,_0x30d0ef,_0xce1288,_0x3aa036){logger[_0x50ea('0x10')]('['+[_0x2654fb['toUpperCase']()]+_0x50ea('0x23'),_0x30d0ef);return new Promise(function(_0x3ce0c1,_0x223b70){var _0x1406c0={'method':_0x50ea('0x24'),'uri':_0xce1288+_0x50ea('0x25')+_0x3aa036,'body':{'user_name':_0x30d0ef[_0x50ea('0x26')],'roles':_0x50ea('0x27'),'first_name':_0x30d0ef[_0x50ea('0x26')],'active':_0x50ea('0x1e'),'date_format':_0x50ea('0x28'),'phone':_0x30d0ef['endUserNumber']},'auth':_0x3a709a,'json':!![]};return rp(_0x1406c0)[_0x50ea('0xd')](function(_0x2d1b5c){logger[_0x50ea('0x10')]('['+[_0x2654fb['toUpperCase']()]+_0x50ea('0x29'),_0x2d1b5c[_0x50ea('0x1c')]);_0x30d0ef[_0x50ea('0x2a')]=_0x2d1b5c[_0x50ea('0x1c')][_0x50ea('0xf')];_0x3ce0c1(_0x30d0ef);})[_0x50ea('0x12')](function(_0xbf00f1){logger[_0x50ea('0x20')]('['+[_0x2654fb[_0x50ea('0x13')]()]+']',_0xbf00f1[_0x50ea('0x14')]);_0x223b70(_0xbf00f1[_0x50ea('0x14')]);});});}function getEndUser(_0xbc3588,_0x752bca,_0x1ac049,_0x544940,_0xf95769){return function(_0x3a78d2){logger['info']('['+[_0xbc3588[_0x50ea('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x3a78d2);return new Promise(function(_0x3a7994,_0xfd4a93){var _0x56e71c={'method':'GET','uri':_0x1ac049+_0x50ea('0x2b')+_0x3a78d2[_0x50ea('0x26')]+'&'+_0x544940+'&'+_0xf95769,'auth':_0x752bca,'json':!![]};return rp(_0x56e71c)[_0x50ea('0xd')](function(_0x2aa73d){if(_0x2aa73d[_0x50ea('0x1c')][_0x50ea('0x1d')]>0x0){_0x3a78d2[_0x50ea('0x2a')]=_0x2aa73d[_0x50ea('0x1c')][0x0][_0x50ea('0xf')];logger[_0x50ea('0x10')]('['+[_0xbc3588[_0x50ea('0x13')]()]+'],\x20getEndUser\x20crm',_0x3a78d2);_0x3a7994(_0x3a78d2);}else{return createEndUser(_0xbc3588,_0x752bca,_0x3a78d2,_0x1ac049,_0x544940)[_0x50ea('0xd')](function(_0x1989fb){logger[_0x50ea('0x10')]('['+[_0xbc3588[_0x50ea('0x13')]()]+_0x50ea('0x2c'),_0x1989fb);_0x3a7994(_0x1989fb);});}})[_0x50ea('0x12')](function(_0x4a792f){logger[_0x50ea('0x20')]('['+[_0xbc3588[_0x50ea('0x13')]()]+']',_0x4a792f['message']);_0xfd4a93(_0x4a792f[_0x50ea('0x14')]);});});};}function getCustomFields(_0x52a2f2,_0x3b2084){var _0x2b734a={};if(_0x52a2f2[_0x50ea('0x1d')]>0x0){_[_0x50ea('0x2d')](_0x52a2f2,function(_0x317803){if(_[_0x50ea('0x2e')](['string',_0x50ea('0x2f')],_0x317803[_0x50ea('0x30')])&&_0x317803[_0x50ea('0x31')]&&!_0x317803[_0x50ea('0x32')]){_0x2b734a[_0x317803[_0x50ea('0x31')][_0x50ea('0x33')]()]=_0x317803[_0x50ea('0x34')][_0x50ea('0x35')]();}else if(_[_0x50ea('0x2e')]([_0x50ea('0x36'),_0x50ea('0x2f')],_0x317803[_0x50ea('0x30')])&&_0x317803[_0x50ea('0x37')]&&_0x317803[_0x50ea('0x32')]){_0x2b734a[_0x317803[_0x50ea('0x37')]['toLowerCase']()]=_0x317803[_0x50ea('0x34')][_0x50ea('0x35')]();}else if(_0x317803['type']===_0x50ea('0x38')&&_0x317803[_0x50ea('0x39')]&&_0x317803[_0x50ea('0x37')]&&_0x317803['customField']){_0x2b734a[_0x317803['idField']['toLowerCase']()]=_0x3b2084[_0x317803[_0x50ea('0x39')]][_0x50ea('0x35')]();}else if(_0x317803[_0x50ea('0x30')]==='customVariable'&&_0x317803[_0x50ea('0x3a')]&&_0x317803['Variable'][_0x50ea('0x3b')]&&_0x317803[_0x50ea('0x37')]&&_0x317803[_0x50ea('0x32')]){_0x2b734a[_0x317803[_0x50ea('0x37')]['toLowerCase']()]=_0x3b2084[_0x317803[_0x50ea('0x3a')][_0x50ea('0x3b')][_0x50ea('0x33')]()][_0x50ea('0x35')]();}});}return _0x2b734a;}function getTicket(_0x4ab1d1,_0x516b04,_0x4f8cc6,_0xd6a7ff,_0x3a9aa2,_0x536042){return function(_0x173954){logger[_0x50ea('0x10')]('['+[_0x4ab1d1[_0x50ea('0x13')]()]+_0x50ea('0x3c'),_0x173954);return new Promise(function(_0x5e627e,_0x19f366){var _0x59a46a=_0x4ab1d1[_0x50ea('0x33')]()===_0x50ea('0x3d')?_0x173954[_0x50ea('0x1f')]:_0x173954[_0x50ea('0x2a')];var _0x12186a={'method':_0x50ea('0x24'),'uri':_0x4f8cc6+_0x50ea('0x3e')+'?'+_0x536042,'body':Object[_0x50ea('0x3f')]({},{'active':_0x50ea('0x1e'),'caller_id':_0x59a46a,'assigned_to':_0x173954['userId'],'short_description':intUtil[_0x50ea('0x40')](_0xd6a7ff[_0x50ea('0x41')],_0x3a9aa2,'\x20'),'description':intUtil[_0x50ea('0x40')](_0xd6a7ff[_0x50ea('0x42')],_0x3a9aa2,'\x0a')},getCustomFields(_0xd6a7ff[_0x50ea('0x43')],_0x3a9aa2)),'auth':_0x516b04,'json':!![]};return rp(_0x12186a)[_0x50ea('0xd')](function(_0x25dd89){logger[_0x50ea('0x10')]('['+[_0x4ab1d1[_0x50ea('0x13')]()]+_0x50ea('0x44'),_0x25dd89[_0x50ea('0x1c')]);_0x173954[_0x50ea('0x45')]=_0x25dd89[_0x50ea('0x1c')][_0x50ea('0xf')];_0x173954[_0x50ea('0x46')]=_0x25dd89[_0x50ea('0x1c')][_0x50ea('0x47')];logger[_0x50ea('0x10')]('['+[_0x4ab1d1['toUpperCase']()]+_0x50ea('0x48'),_0x173954);_0x5e627e(_0x173954);})[_0x50ea('0x12')](function(_0x70aed1){logger[_0x50ea('0x20')]('['+[_0x4ab1d1['toUpperCase']()]+']',_0x70aed1[_0x50ea('0x14')]);_0x19f366(_0x70aed1[_0x50ea('0x14')]);});});};}function createRemoteTag(_0x2e4758,_0x44fa48,_0x59b8ec,_0x5f1f7f){return new Promise(function(_0x480292,_0x181ae1){var _0x97659f={'method':_0x50ea('0x24'),'uri':_0x59b8ec+'label'+'?'+_0x5f1f7f,'body':{'short_description':_0x2e4758,'global':!![],'active':!![],'name':_0x2e4758},'auth':_0x44fa48,'json':!![]};return rp(_0x97659f)[_0x50ea('0xd')](function(_0xfeb3ea){var _0xd4f6f9=_0xfeb3ea[_0x50ea('0x1c')]['sys_id'];_0x480292(_0xd4f6f9);});});}function getRemoteTag(_0x371a7b,_0x46a447,_0x597562,_0x7bd082,_0x5a4507){return new Promise(function(_0x450a6e,_0x54b0cc){var _0x193e0a={'method':'GET','uri':_0x597562+'label'+'?sysparm_query=name%3D'+_0x371a7b+'&'+_0x7bd082,'auth':_0x46a447,'json':!![]};return rp(_0x193e0a)[_0x50ea('0xd')](function(_0x289fe5){if(_0x289fe5['result'][_0x50ea('0x1d')]>0x0){var _0x5a3a37=_0x289fe5['result'][0x0]['sys_id'];_0x450a6e(_0x5a3a37);}else{return createRemoteTag(_0x371a7b,_0x46a447,_0x597562,_0x7bd082)[_0x50ea('0xd')](function(_0x21ce02){_0x450a6e(_0x21ce02);});}});});}function assignTagToIncident(_0x275596,_0x4cb0ab,_0x3e0759,_0x47931a,_0x10483d){return new Promise(function(_0xe53fa,_0x215d3b){var _0x43913b={'method':_0x50ea('0x24'),'uri':_0x3e0759+'label_entry'+'?'+_0x10483d,'body':{'label':_0x275596,'table':_0x50ea('0x3e'),'id_type':_0x50ea('0x49'),'table_key':_0x47931a['ticketId'],'title':'Incident\x20-\x20'+_0x47931a[_0x50ea('0x46')],'id_display':_0x47931a[_0x50ea('0x46')]},'auth':_0x4cb0ab,'json':!![]};return rp(_0x43913b)[_0x50ea('0xd')](function(_0x25b7f9){_0xe53fa();})[_0x50ea('0x12')](function(){_0xe53fa();});});}function manageTags(_0x42e90c,_0x5269be,_0x2b6aca,_0x53c86b,_0x9e087e,_0x491849,_0x3866fb){return new Promise(function(_0x133912,_0x42516f){var _0x49155c=[];_0x5269be['forEach'](function(_0x16466d){_0x49155c[_0x50ea('0x4a')](getRemoteTag(_0x16466d,_0x2b6aca,_0x53c86b,_0x491849,_0x3866fb));});return Promise[_0x50ea('0x4b')](_0x49155c)[_0x50ea('0xd')](function(_0x31c5b7){if(_0x31c5b7[_0x50ea('0x1d')]){logger[_0x50ea('0x10')]('['+[_0x42e90c[_0x50ea('0x13')]()]+_0x50ea('0x4c'),_0x31c5b7);var _0x4a83ed=[];_0x31c5b7[_0x50ea('0x2d')](function(_0x3bb835){_0x4a83ed[_0x50ea('0x4a')](assignTagToIncident(_0x3bb835,_0x2b6aca,_0x53c86b,_0x9e087e,_0x491849));});return Promise[_0x50ea('0x4b')](_0x4a83ed)['then'](function(){_0x133912();})[_0x50ea('0x12')](function(){_0x133912();});}else{_0x133912();}});});}function getTags(_0x1b929b,_0x19f0c0,_0x8e6968,_0x5320b5,_0x41efc9,_0x12a039){return function(_0x33df56){return new Promise(function(_0x4913f9,_0x2365cc){var _0x4522da=[];var _0x5c9ecf=_0x5320b5[_0x50ea('0x4d')];if(_0x5c9ecf&&_0x5c9ecf['length']>0x0){_0x4522da=_[_0x50ea('0x4e')](_0x5c9ecf,_0x50ea('0x3b'));}if(_0x4522da[_0x50ea('0x1d')]>0x0){return manageTags(_0x1b929b,_0x4522da,_0x19f0c0,_0x8e6968,_0x33df56,_0x41efc9,_0x12a039)[_0x50ea('0xd')](function(){_0x4913f9(_0x33df56);});}else{_0x4913f9(_0x33df56);}});};}function emit(_0x4639d3,_0x4d8428,_0x12ba4e){var _0x284ca0=_0x50ea('0x4f')+_0x50ea('0x50')+_0x50ea('0x51')+_0x50ea('0x52');var _0x30d2ac={'uri':_0x4639d3+_0x50ea('0x53')+_0x12ba4e+_0x284ca0};io['to'](util[_0x50ea('0x54')]('user:%s',_0x4d8428))['emit'](_0x50ea('0x55'),_0x30d2ac);}exports['cs']=function(_0x2d14e0,_0x112efa,_0x176e38,_0x4e78a5,_0x14bbf1,_0x1919a0,_0x13df98,_0x9d2a8b){var _0x2845a7={};var _0x425ada={'user':_0x1919a0[_0x50ea('0x56')],'pass':_0x1919a0[_0x50ea('0x57')]};var _0x37a1ec=_0x50ea('0x58');var _0x52959e='sysparm_display_value=true';_0x1919a0[_0x50ea('0x59')]=intUtil[_0x50ea('0x5a')](_0x1919a0['remoteUri']);_0x1919a0[_0x50ea('0x5b')]=intUtil[_0x50ea('0x5a')](_0x1919a0[_0x50ea('0x5b')]);var _0x100af=util['format'](_0x50ea('0x5c'),_0x1919a0[_0x50ea('0x59')]);_0x2845a7[_0x50ea('0x17')]=!_[_0x50ea('0x5d')](_0x4e78a5)?_0x4e78a5[_0x50ea('0x5e')]:null;_0x2845a7[_0x50ea('0x22')]=_0x1919a0[_0x50ea('0x5e')];_0x2845a7[_0x50ea('0x26')]=_0x9d2a8b['toLowerCase']()===_0x50ea('0x3d')?_0x112efa['destcalleridnum']:_0x112efa[_0x50ea('0x5f')];_0x2845a7[_0x50ea('0x60')]=_0x9d2a8b===_0x50ea('0x61')||_0x9d2a8b==='unmanaged'?_0x50ea('0x61'):'outbound';var _0x1dc6a7=util[_0x50ea('0x54')](_0x50ea('0x62'),_0x1919a0[_0x50ea('0x5b')],_0x112efa[_0x50ea('0x63')],md5(_0x112efa[_0x50ea('0x63')]));if(_0x14bbf1&&_0x14bbf1['monitor_format']){logger['info'](_0x50ea('0x64'),_0x50ea('0x65'));_0x112efa[_0x50ea('0x66')]=_0x1dc6a7;}else if(_0x13df98&&_0x13df98[_0x50ea('0x67')]&&_0x13df98[_0x50ea('0x67')]!==_0x50ea('0x68')){logger[_0x50ea('0x10')](_0x50ea('0x69'),'Recording\x20is\x20enabled!');_0x112efa[_0x50ea('0x66')]=_0x1dc6a7;}else{_0x112efa[_0x50ea('0x66')]='';}return getAdminUser(_0x9d2a8b,_0x425ada,_0x2845a7,_0x100af,_0x52959e,_0x37a1ec)[_0x50ea('0xd')](getUser(_0x9d2a8b,_0x425ada,_0x100af,_0x52959e,_0x37a1ec))['then'](getEndUser(_0x9d2a8b,_0x425ada,_0x100af,_0x52959e,_0x37a1ec))[_0x50ea('0xd')](getTicket(_0x9d2a8b,_0x425ada,_0x100af,_0x176e38,_0x112efa,_0x52959e))[_0x50ea('0xd')](function(_0x2f88a3){logger[_0x50ea('0x10')](util[_0x50ea('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2f88a3[_0x50ea('0x45')]));logger[_0x50ea('0x10')](util[_0x50ea('0x54')](_0x50ea('0x6a'),_0x9d2a8b));if(_0x9d2a8b!==_0x50ea('0x6b')){logger['info']('['+[_0x9d2a8b[_0x50ea('0x13')]()]+']',_0x50ea('0x6c'));emit(_0x1919a0[_0x50ea('0x59')],_0x4e78a5[_0x50ea('0x3b')],_0x2f88a3[_0x50ea('0x45')]);}})[_0x50ea('0x12')](function(_0x9ff4b4){logger[_0x50ea('0x20')]('['+[_0x9d2a8b[_0x50ea('0x13')]()]+_0x50ea('0x6d'),util[_0x50ea('0x6e')](_0x9ff4b4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index dc27205..c112bf8 100644 --- a/server/services/ami/trigger/integration/sugarcrm.js +++ b/server/services/ami/trigger/integration/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bb3=['recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','error','unmanaged','lastevent','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','assigned_user_id','description','getString','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','first_name','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','content','custom_fields','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch'];(function(_0x1e5755,_0x5e0d48){var _0x38975b=function(_0x1ec4a2){while(--_0x1ec4a2){_0x1e5755['push'](_0x1e5755['shift']());}};_0x38975b(++_0x5e0d48);}(_0x3bb3,0x106));var _0x33bb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3bb3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x33bb('0x0'));var rp=require(_0x33bb('0x1'));var BPromise=require(_0x33bb('0x2'));var md5=require(_0x33bb('0x3'));var util=require(_0x33bb('0x4'));var Redis=require(_0x33bb('0x5'));var intUtil=require(_0x33bb('0x6'));var config=require(_0x33bb('0x7'));var logger=require(_0x33bb('0x8'))(_0x33bb('0x9'));config[_0x33bb('0xa')]=_[_0x33bb('0xb')](config[_0x33bb('0xa')],{'host':_0x33bb('0xc'),'port':0x18eb});var io=require(_0x33bb('0xd'))(new Redis(config[_0x33bb('0xa')]));var def={'method':_0x33bb('0xe'),'json':!![]};function emit(_0x59c3da,_0x4eabc6,_0x3536a7){io['to'](_0x59c3da)[_0x33bb('0xf')](_0x4eabc6,_0x3536a7);}function getTicket(_0x4986c4,_0x5838e4,_0x47726a,_0x3988ed,_0x19fea7,_0x1d66a3,_0x1b490b,_0x4894f4){logger[_0x33bb('0x10')]('Creating\x20new\x20ticket...');var _0x253847=new Date();var _0x5d0bf4=[{'name':_0x33bb('0x11'),'value':intUtil['getString'](_0x3988ed['Subjects'],_0x19fea7,'\x20')},{'name':_0x33bb('0x12'),'value':_0x5838e4['id']},{'name':'created_by','value':_0x5838e4['id']},{'name':_0x33bb('0x13'),'value':intUtil[_0x33bb('0x14')](_0x3988ed[_0x33bb('0x15')],_0x19fea7,'\x0a')},{'name':_0x33bb('0x16'),'value':_0x253847[_0x33bb('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x33bb('0x18'),'value':'0'},{'name':_0x33bb('0x19'),'value':'15'},{'name':_0x33bb('0x1a'),'value':_0x47726a['id']},{'name':_0x33bb('0x1b'),'value':_0x33bb('0x1c')},{'name':_0x33bb('0x1d'),'value':_0x47726a[_0x33bb('0x11')]},{'name':_0x33bb('0x1e'),'value':_0x4894f4}];if(_0x1d66a3[_0x33bb('0x1f')]){_[_0x33bb('0x20')](_0x1d66a3,function(_0xc51b88){if(_0x19fea7[_0xc51b88['variableName']]){_0x5d0bf4[_0x33bb('0x21')]({'name':_0xc51b88[_0x33bb('0x22')],'value':_0x19fea7[_0xc51b88[_0x33bb('0x23')]]});}});}return request({'form':{'method':_0x33bb('0x24'),'input_type':'JSON','response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x1b490b['id'],'module_name':_0x33bb('0x27'),'name_value_list':_0x5d0bf4})}});}function getAuth(_0xbbdc1e){return util['format'](_0x33bb('0x28'),new Buffer(_0xbbdc1e[_0x33bb('0x29')]+':X')[_0x33bb('0x2a')](_0x33bb('0x2b')));}function getServerInfo(_0x104751){return request({'form':{'method':_0x33bb('0x2c'),'input_type':'JSON','response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x104751['id']})}});}function getUser(_0x29f989,_0x96ad7c,_0x133941){if(!_[_0x33bb('0x2d')](_0x96ad7c)){logger[_0x33bb('0x10')](_0x33bb('0x2e'),_0x96ad7c);return request({'form':{'method':_0x33bb('0x2f'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x133941['id'],'module_name':'Employees','query':util[_0x33bb('0x30')](_0x33bb('0x31'),_0x96ad7c),'order_by':'','offset':'0','select_fields':['id','name',_0x33bb('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x33bb('0x33')](function(_0x4a96e9){if(_0x4a96e9[_0x33bb('0x34')][_0x33bb('0x1f')]){var _0x4888aa=_[_0x33bb('0x35')](_0x4a96e9[_0x33bb('0x34')],function(_0x1ee59a){return _0x1ee59a['name_value_list'][_0x33bb('0x32')][_0x33bb('0x36')]===_0x96ad7c;});if(_0x4888aa){logger[_0x33bb('0x10')](_0x33bb('0x37'));return BPromise[_0x33bb('0x38')]({'id':_0x4888aa['name_value_list']['id'][_0x33bb('0x36')],'name':_0x4888aa[_0x33bb('0x39')][_0x33bb('0x11')]['value']});}}logger[_0x33bb('0x10')](_0x33bb('0x3a'));return BPromise[_0x33bb('0x38')]({'id':_0x133941['name_value_list'][_0x33bb('0x3b')][_0x33bb('0x36')],'name':_0x133941[_0x33bb('0x39')][_0x33bb('0x32')][_0x33bb('0x36')]});});}else{logger[_0x33bb('0x10')](_0x33bb('0x3c'));return BPromise['resolve']({'id':_0x133941[_0x33bb('0x39')]['user_id'][_0x33bb('0x36')],'name':_0x133941[_0x33bb('0x39')][_0x33bb('0x32')][_0x33bb('0x36')]});}}function getEndUser(_0x2f8890,_0x1beb4c,_0x419870,_0x40981b){logger[_0x33bb('0x10')](_0x33bb('0x3d'),_0x419870);return request({'form':{'method':_0x33bb('0x2f'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x40981b['id'],'module_name':'Contacts','query':util[_0x33bb('0x30')](_0x33bb('0x3e'),_0x419870),'order_by':'','offset':'0','select_fields':['id',_0x33bb('0x11'),_0x33bb('0x3f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x33bb('0x33')](function(_0x3c1316){if(_0x3c1316[_0x33bb('0x34')]['length']){var _0x4131c0=_[_0x33bb('0x35')](_0x3c1316[_0x33bb('0x34')],function(_0x2b2670){return _0x2b2670[_0x33bb('0x39')]['phone_home'][_0x33bb('0x36')]===_0x419870;});if(_0x4131c0){logger['info'](_0x33bb('0x40'));return BPromise[_0x33bb('0x38')]({'id':_0x4131c0[_0x33bb('0x39')]['id'][_0x33bb('0x36')],'name':_0x4131c0[_0x33bb('0x39')][_0x33bb('0x11')]['value'],'phone':_0x4131c0[_0x33bb('0x39')]['phone_home']['value']});}}else{logger['info'](_0x33bb('0x41'));return request({'form':{'method':_0x33bb('0x24'),'input_type':_0x33bb('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x40981b['id'],'module_name':_0x33bb('0x1c'),'name_value_list':[{'name':'first_name','value':_0x1beb4c!==''?_0x1beb4c:util['format'](_0x33bb('0x42'),_0x419870)},{'name':'phone_home','value':_0x419870}]})}})[_0x33bb('0x33')](function(_0x117a78){logger[_0x33bb('0x10')]('Enduser\x20created.');return BPromise[_0x33bb('0x38')]({'id':_0x117a78['id'],'name':_0x117a78[_0x33bb('0x34')][_0x33bb('0x43')]['value'],'phone':_0x117a78[_0x33bb('0x34')][_0x33bb('0x3f')][_0x33bb('0x36')]});});}});}function request(_0xbafeeb){logger[_0x33bb('0x44')](_0x33bb('0x45'),JSON[_0x33bb('0x26')](_0xbafeeb));return rp(_[_0x33bb('0x46')](def,_0xbafeeb));}function getTags(_0x29fbfd,_0x1f65fb){var _0x2a2bd8=[];if(_0x29fbfd&&_0x29fbfd['length']>0x0){_0x2a2bd8=_['map'](_0x29fbfd,_0x1f65fb);}return _0x2a2bd8;}function getCustomFields(_0x168a8a,_0x424629){var _0x5e3b95=[];var _0x30dfee={'custom_fields':[]};if(_0x168a8a[_0x33bb('0x1f')]>0x0){_[_0x33bb('0x20')](_0x168a8a,function(_0x20c97){if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x48')&&_0x20c97[_0x33bb('0x49')]&&!_0x20c97[_0x33bb('0x4a')]){_0x30dfee[_0x20c97['nameField'][_0x33bb('0x4b')]()]=_0x20c97[_0x33bb('0x4c')][_0x33bb('0x2a')]();}else if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x48')&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97[_0x33bb('0x22')],'value':_0x20c97[_0x33bb('0x4c')][_0x33bb('0x2a')]()});}else if(_0x20c97[_0x33bb('0x47')]==='variable'&&_0x20c97[_0x33bb('0x23')]&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x424629[_0x20c97[_0x33bb('0x23')]]&&_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97['idField'],'value':_0x424629[_0x20c97[_0x33bb('0x23')]]['toString']()});}else if(_0x20c97[_0x33bb('0x47')]===_0x33bb('0x4e')&&_0x20c97['Variable']&&_0x20c97['Variable']['name']&&_0x20c97[_0x33bb('0x22')]&&_0x20c97[_0x33bb('0x4a')]){_0x424629[_0x20c97[_0x33bb('0x4f')][_0x33bb('0x11')][_0x33bb('0x4b')]()]&&_0x30dfee[_0x33bb('0x4d')][_0x33bb('0x21')]({'id':_0x20c97[_0x33bb('0x22')],'value':_0x424629[_0x20c97['Variable']['name'][_0x33bb('0x4b')]()]['toString']()});}});}return _0x30dfee;}function getConnection(_0xcd917f){return request({'method':'POST','form':{'method':_0x33bb('0x50'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'user_auth':{'user_name':_0xcd917f[_0x33bb('0x51')],'password':_0xcd917f['password'],'encryption':_0x33bb('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x33bb('0x33')](function(_0x27bcb5){var _0x100d90=_0x27bcb5;if(_0x100d90['id']){def[_0x33bb('0x53')]=_0x100d90['id'];return BPromise[_0x33bb('0x38')](_0x100d90);}else{throw new Error(util[_0x33bb('0x30')](_0x33bb('0x54'),_0xcd917f['id']));}});}function setRelationship(_0x1eaada,_0x474700,_0xc6017e,_0x414af1){return request({'form':{'method':_0x33bb('0x55'),'input_type':_0x33bb('0x25'),'response_type':_0x33bb('0x25'),'rest_data':JSON[_0x33bb('0x26')]({'session':_0x1eaada['id'],'module_name':'Calls','module_id':_0xc6017e['id'],'link_field_name':_0x414af1,'related_ids':[_0x474700['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x33bb('0x56')]=function(_0x17006d,_0x2dded5,_0x573e49,_0x44ce9a,_0x5c217e,_0x46608c){var _0x38c5f1,_0x4a8df6,_0x568ce8,_0x247b24;_0x46608c['remoteUri']=intUtil[_0x33bb('0x57')](_0x46608c['remoteUri']);_0x46608c[_0x33bb('0x58')]=intUtil[_0x33bb('0x57')](_0x46608c[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util['format'](_0x33bb('0x5a'),_0x46608c[_0x33bb('0x5b')]);if(_0x5c217e&&_0x5c217e[_0x33bb('0x5c')]){logger[_0x33bb('0x10')]('[QUEUE]',_0x33bb('0x5d'));_0x2dded5[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x46608c[_0x33bb('0x58')],_0x2dded5[_0x33bb('0x60')],md5(_0x2dded5['uniqueid']));}else{_0x2dded5[_0x33bb('0x5e')]='';}return getConnection(_0x46608c)[_0x33bb('0x33')](function(_0x9e07b8){_0x247b24=_0x9e07b8;return getUser(_0x46608c,_0x44ce9a[_0x33bb('0x11')],_0x247b24);})[_0x33bb('0x33')](function(_0x5aa9fd){_0x38c5f1=_0x5aa9fd;logger[_0x33bb('0x10')](_0x33bb('0x61'),_0x38c5f1['id']);return getEndUser(_0x46608c,_0x2dded5[_0x33bb('0x62')],_0x2dded5[_0x33bb('0x63')],_0x247b24);})[_0x33bb('0x33')](function(_0x1a033b){_0x4a8df6=_0x1a033b;logger[_0x33bb('0x10')](_0x33bb('0x64'),_0x4a8df6['id']);return getTicket(_0x46608c,_0x38c5f1,_0x4a8df6,_0x573e49,_0x2dded5,_0x573e49[_0x33bb('0x65')],_0x247b24,'Inbound');})['then'](function(_0x5115b8){_0x568ce8=_0x5115b8;logger['info'](_0x33bb('0x66'));logger[_0x33bb('0x10')](_0x33bb('0x67'),_0x568ce8['id']);return setRelationship(_0x247b24,_0x38c5f1,_0x568ce8,'users');})[_0x33bb('0x33')](function(){return setRelationship(_0x247b24,_0x4a8df6,_0x568ce8,_0x33bb('0x68'));})[_0x33bb('0x33')](function(){return getServerInfo(_0x247b24);})[_0x33bb('0x33')](function(_0x4b5f9a){var _0x5c3927=parseInt(_0x4b5f9a[_0x33bb('0x69')][_0x33bb('0x6a')](0x0));var _0x2b4b38=util[_0x33bb('0x30')](_0x33bb('0x6b'),_0x46608c[_0x33bb('0x5b')],_0x568ce8['id']);if(_0x5c3927>0x6){_0x2b4b38=util[_0x33bb('0x30')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x46608c['remoteUri'],_0x568ce8['id']);}logger[_0x33bb('0x10')](_0x33bb('0x6c'),_0x33bb('0x6d'));emit(util['format'](_0x33bb('0x6e'),_0x44ce9a[_0x33bb('0x11')]),_0x33bb('0x6f'),{'uri':_0x2b4b38});})[_0x33bb('0x70')](function(_0x20f907){logger['error']('[QUEUE]',JSON[_0x33bb('0x26')](_0x20f907));});};exports['outbound']=function(_0x551f87,_0x34b1d6,_0x2d3df5,_0x1bcd2f,_0x2f18e4,_0x174211,_0x347dc6){var _0x4bc558,_0x57b755,_0xc7dbe3,_0x2f5aa4;_0x174211[_0x33bb('0x5b')]=intUtil['stripTrailingSlash'](_0x174211[_0x33bb('0x5b')]);_0x174211[_0x33bb('0x58')]=intUtil[_0x33bb('0x57')](_0x174211[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util[_0x33bb('0x30')](_0x33bb('0x5a'),_0x174211[_0x33bb('0x5b')]);if(_0x347dc6&&_0x347dc6[_0x33bb('0x71')]&&_0x347dc6[_0x33bb('0x71')]!=='none'){logger['info'](_0x33bb('0x72'),_0x33bb('0x5d'));_0x34b1d6[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x174211[_0x33bb('0x58')],_0x34b1d6[_0x33bb('0x60')],md5(_0x34b1d6[_0x33bb('0x60')]));}return getConnection(_0x174211)[_0x33bb('0x33')](function(_0x3e7ade){_0x2f5aa4=_0x3e7ade;return getUser(_0x174211,_0x1bcd2f[_0x33bb('0x11')],_0x2f5aa4);})[_0x33bb('0x33')](function(_0x272a80){_0x4bc558=_0x272a80;logger[_0x33bb('0x10')]('The\x20User\x20ID\x20is:',_0x4bc558['id']);return getEndUser(_0x174211,_0x34b1d6[_0x33bb('0x73')],_0x34b1d6[_0x33bb('0x74')],_0x2f5aa4);})[_0x33bb('0x33')](function(_0x5e569a){_0x57b755=_0x5e569a;logger[_0x33bb('0x10')]('The\x20Enduser\x20ID\x20is:',_0x57b755['id']);return getTicket(_0x174211,_0x4bc558,_0x57b755,_0x2d3df5,_0x34b1d6,_0x2d3df5[_0x33bb('0x65')],_0x2f5aa4,_0x33bb('0x75'));})['then'](function(_0x556fed){_0xc7dbe3=_0x556fed;logger[_0x33bb('0x10')]('Ticket\x20created!');logger[_0x33bb('0x10')](_0x33bb('0x67'),_0xc7dbe3['id']);return setRelationship(_0x2f5aa4,_0x4bc558,_0xc7dbe3,_0x33bb('0x76'));})[_0x33bb('0x33')](function(){return setRelationship(_0x2f5aa4,_0x57b755,_0xc7dbe3,_0x33bb('0x68'));})[_0x33bb('0x33')](function(){return getServerInfo(_0x2f5aa4);})[_0x33bb('0x33')](function(_0x2edc6f){var _0x18725a=parseInt(_0x2edc6f[_0x33bb('0x69')][_0x33bb('0x6a')](0x0));var _0x4c4a18=util['format'](_0x33bb('0x6b'),_0x174211[_0x33bb('0x5b')],_0xc7dbe3['id']);if(_0x18725a>0x6){_0x4c4a18=util[_0x33bb('0x30')](_0x33bb('0x77'),_0x174211[_0x33bb('0x5b')],_0xc7dbe3['id']);}logger[_0x33bb('0x10')](_0x33bb('0x72'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x33bb('0x30')](_0x33bb('0x6e'),_0x1bcd2f[_0x33bb('0x11')]),_0x33bb('0x6f'),{'uri':_0x4c4a18});})[_0x33bb('0x70')](function(_0x2a8307){logger[_0x33bb('0x78')](_0x33bb('0x72'),JSON[_0x33bb('0x26')](_0x2a8307));});};exports[_0x33bb('0x79')]=function(_0x4fb05a,_0x12d996,_0x2ce144,_0xa4ffd7,_0x29b255,_0x5bec07){var _0x4c86f6,_0x3bdcca,_0x38a013,_0x405ac7;_0x5bec07[_0x33bb('0x5b')]=intUtil[_0x33bb('0x57')](_0x5bec07[_0x33bb('0x5b')]);_0x5bec07['serverUrl']=intUtil['stripTrailingSlash'](_0x5bec07[_0x33bb('0x58')]);def[_0x33bb('0x59')]=util['format'](_0x33bb('0x5a'),_0x5bec07[_0x33bb('0x5b')]);if(_0x29b255&&_0x29b255['monitor_format']){logger[_0x33bb('0x10')]('['+_0x12d996[_0x33bb('0x7a')]['toUpperCase']()+']',_0x33bb('0x5d'));_0x12d996[_0x33bb('0x5e')]=util[_0x33bb('0x30')](_0x33bb('0x5f'),_0x5bec07[_0x33bb('0x58')],_0x12d996[_0x33bb('0x60')],md5(_0x12d996[_0x33bb('0x60')]));}else{_0x12d996[_0x33bb('0x5e')]='';}return getConnection(_0x5bec07)[_0x33bb('0x33')](function(_0x5b7d88){_0x405ac7=_0x5b7d88;if(!_[_0x33bb('0x2d')](_0xa4ffd7)){return getUser(_0x5bec07,_0xa4ffd7[_0x33bb('0x11')],_0x405ac7);}else{return getUser(_0x5bec07,null,_0x405ac7);}})[_0x33bb('0x33')](function(_0x2e03a6){_0x4c86f6=_0x2e03a6;logger['info'](_0x33bb('0x61'),_0x4c86f6['id']);return getEndUser(_0x5bec07,_0x12d996[_0x33bb('0x62')],_0x12d996[_0x33bb('0x63')],_0x405ac7);})[_0x33bb('0x33')](function(_0x439b94){_0x3bdcca=_0x439b94;logger[_0x33bb('0x10')](_0x33bb('0x64'),_0x3bdcca['id']);return getTicket(_0x5bec07,_0x4c86f6,_0x3bdcca,_0x2ce144,_0x12d996,_0x2ce144['Fields'],_0x405ac7,_0x33bb('0x7b'));})[_0x33bb('0x33')](function(_0x5ac598){_0x38a013=_0x5ac598;logger[_0x33bb('0x10')](_0x33bb('0x66'));logger[_0x33bb('0x10')](_0x33bb('0x67'),_0x38a013['id']);return setRelationship(_0x405ac7,_0x4c86f6,_0x38a013,_0x33bb('0x76'));})[_0x33bb('0x33')](function(){return setRelationship(_0x405ac7,_0x3bdcca,_0x38a013,'contacts');})['then'](function(){return getServerInfo(_0x405ac7);})[_0x33bb('0x70')](function(_0x1d29d9){logger[_0x33bb('0x78')]('['+_0x12d996[_0x33bb('0x7a')][_0x33bb('0x7c')]()+']',JSON['stringify'](_0x1d29d9));});}; \ No newline at end of file +var _0x4f32=['lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','description','toISOString','slice','duration_hours','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','Agent\x20found!','resolve','value','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','[HTTP]','map','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','unmanaged','lastevent','toUpperCase','Fields'];(function(_0x41e503,_0x3a9571){var _0x42e63d=function(_0xf42c87){while(--_0xf42c87){_0x41e503['push'](_0x41e503['shift']());}};_0x42e63d(++_0x3a9571);}(_0x4f32,0xf0));var _0x24f3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f32[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x24f3('0x0'));var rp=require(_0x24f3('0x1'));var BPromise=require(_0x24f3('0x2'));var md5=require(_0x24f3('0x3'));var util=require(_0x24f3('0x4'));var Redis=require(_0x24f3('0x5'));var intUtil=require(_0x24f3('0x6'));var config=require(_0x24f3('0x7'));var logger=require(_0x24f3('0x8'))('sugarcrm');config[_0x24f3('0x9')]=_[_0x24f3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x24f3('0xb'))(new Redis(config['redis']));var def={'method':_0x24f3('0xc'),'json':!![]};function emit(_0x572ad7,_0x2cb061,_0x5a1b1d){io['to'](_0x572ad7)[_0x24f3('0xd')](_0x2cb061,_0x5a1b1d);}function getTicket(_0x1579ee,_0x3caa9b,_0x15d4c7,_0x44f7c6,_0x4a139c,_0x1a3332,_0x2ccc57,_0x419c7d){logger[_0x24f3('0xe')](_0x24f3('0xf'));var _0x95b78a=new Date();var _0x480fc0=[{'name':_0x24f3('0x10'),'value':intUtil['getString'](_0x44f7c6['Subjects'],_0x4a139c,'\x20')},{'name':_0x24f3('0x11'),'value':_0x3caa9b['id']},{'name':'created_by','value':_0x3caa9b['id']},{'name':_0x24f3('0x12'),'value':intUtil['getString'](_0x44f7c6['Descriptions'],_0x4a139c,'\x0a')},{'name':'date_start','value':_0x95b78a[_0x24f3('0x13')]()[_0x24f3('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x24f3('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x15d4c7['id']},{'name':_0x24f3('0x16'),'value':_0x24f3('0x17')},{'name':_0x24f3('0x18'),'value':_0x15d4c7[_0x24f3('0x10')]},{'name':_0x24f3('0x19'),'value':_0x419c7d}];if(_0x1a3332[_0x24f3('0x1a')]){_[_0x24f3('0x1b')](_0x1a3332,function(_0xb14060){if(_0x4a139c[_0xb14060[_0x24f3('0x1c')]]){_0x480fc0[_0x24f3('0x1d')]({'name':_0xb14060[_0x24f3('0x1e')],'value':_0x4a139c[_0xb14060[_0x24f3('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x24f3('0x1f'),'response_type':_0x24f3('0x1f'),'rest_data':JSON['stringify']({'session':_0x2ccc57['id'],'module_name':_0x24f3('0x20'),'name_value_list':_0x480fc0})}});}function getAuth(_0x168207){return util[_0x24f3('0x21')](_0x24f3('0x22'),new Buffer(_0x168207[_0x24f3('0x23')]+':X')[_0x24f3('0x24')](_0x24f3('0x25')));}function getServerInfo(_0x23c9e5){return request({'form':{'method':_0x24f3('0x26'),'input_type':_0x24f3('0x1f'),'response_type':'JSON','rest_data':JSON[_0x24f3('0x27')]({'session':_0x23c9e5['id']})}});}function getUser(_0x1fbf22,_0x4cb651,_0x256452){if(!_[_0x24f3('0x28')](_0x4cb651)){logger[_0x24f3('0xe')](_0x24f3('0x29'),_0x4cb651);return request({'form':{'method':'get_entry_list','input_type':_0x24f3('0x1f'),'response_type':_0x24f3('0x1f'),'rest_data':JSON[_0x24f3('0x27')]({'session':_0x256452['id'],'module_name':_0x24f3('0x2a'),'query':util[_0x24f3('0x21')](_0x24f3('0x2b'),_0x4cb651),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x24f3('0x2c')](function(_0x31f6c4){if(_0x31f6c4[_0x24f3('0x2d')]['length']){var _0x2ca01a=_[_0x24f3('0x2e')](_0x31f6c4['entry_list'],function(_0x1c0126){return _0x1c0126['name_value_list'][_0x24f3('0x2f')]['value']===_0x4cb651;});if(_0x2ca01a){logger[_0x24f3('0xe')](_0x24f3('0x30'));return BPromise[_0x24f3('0x31')]({'id':_0x2ca01a['name_value_list']['id'][_0x24f3('0x32')],'name':_0x2ca01a[_0x24f3('0x33')][_0x24f3('0x10')][_0x24f3('0x32')]});}}logger[_0x24f3('0xe')](_0x24f3('0x34'));return BPromise['resolve']({'id':_0x256452['name_value_list'][_0x24f3('0x35')]['value'],'name':_0x256452['name_value_list'][_0x24f3('0x2f')][_0x24f3('0x32')]});});}else{logger[_0x24f3('0xe')](_0x24f3('0x36'));return BPromise['resolve']({'id':_0x256452[_0x24f3('0x33')][_0x24f3('0x35')][_0x24f3('0x32')],'name':_0x256452[_0x24f3('0x33')][_0x24f3('0x2f')]['value']});}}function getEndUser(_0xc5fab,_0x35f844,_0x5a3f7c,_0x21a6e3){logger['info']('Searching\x20enduser\x20with\x20phone',_0x5a3f7c);return request({'form':{'method':_0x24f3('0x37'),'input_type':_0x24f3('0x1f'),'response_type':_0x24f3('0x1f'),'rest_data':JSON[_0x24f3('0x27')]({'session':_0x21a6e3['id'],'module_name':_0x24f3('0x17'),'query':util[_0x24f3('0x21')](_0x24f3('0x38'),_0x5a3f7c),'order_by':'','offset':'0','select_fields':['id',_0x24f3('0x10'),_0x24f3('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x24f3('0x2c')](function(_0x40c41a){if(_0x40c41a[_0x24f3('0x2d')][_0x24f3('0x1a')]){var _0x294428=_['find'](_0x40c41a[_0x24f3('0x2d')],function(_0x1208a4){return _0x1208a4[_0x24f3('0x33')]['phone_home']['value']===_0x5a3f7c;});if(_0x294428){logger[_0x24f3('0xe')](_0x24f3('0x3a'));return BPromise['resolve']({'id':_0x294428[_0x24f3('0x33')]['id'][_0x24f3('0x32')],'name':_0x294428['name_value_list'][_0x24f3('0x10')][_0x24f3('0x32')],'phone':_0x294428[_0x24f3('0x33')][_0x24f3('0x39')][_0x24f3('0x32')]});}}else{logger[_0x24f3('0xe')](_0x24f3('0x3b'));return request({'form':{'method':_0x24f3('0x3c'),'input_type':_0x24f3('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x21a6e3['id'],'module_name':_0x24f3('0x17'),'name_value_list':[{'name':_0x24f3('0x3d'),'value':_0x35f844!==_0x24f3('0x3e')?_0x35f844:util[_0x24f3('0x21')](_0x24f3('0x3f'),_0x5a3f7c)},{'name':_0x24f3('0x39'),'value':_0x5a3f7c}]})}})['then'](function(_0x595729){logger[_0x24f3('0xe')]('Enduser\x20created.');return BPromise[_0x24f3('0x31')]({'id':_0x595729['id'],'name':_0x595729[_0x24f3('0x2d')][_0x24f3('0x3d')][_0x24f3('0x32')],'phone':_0x595729['entry_list'][_0x24f3('0x39')]['value']});});}});}function request(_0x2e7d67){logger['debug'](_0x24f3('0x40'),JSON[_0x24f3('0x27')](_0x2e7d67));return rp(_['merge'](def,_0x2e7d67));}function getTags(_0xf59c,_0x2bf0bc){var _0x2ab0d6=[];if(_0xf59c&&_0xf59c[_0x24f3('0x1a')]>0x0){_0x2ab0d6=_[_0x24f3('0x41')](_0xf59c,_0x2bf0bc);}return _0x2ab0d6;}function getCustomFields(_0x41a763,_0x1c6224){var _0x31ad8b=[];var _0x595d6c={'custom_fields':[]};if(_0x41a763[_0x24f3('0x1a')]>0x0){_[_0x24f3('0x1b')](_0x41a763,function(_0x109891){if(_0x109891[_0x24f3('0x42')]==='string'&&_0x109891[_0x24f3('0x43')]&&!_0x109891[_0x24f3('0x44')]){_0x595d6c[_0x109891['nameField'][_0x24f3('0x45')]()]=_0x109891[_0x24f3('0x46')]['toString']();}else if(_0x109891[_0x24f3('0x42')]===_0x24f3('0x47')&&_0x109891[_0x24f3('0x1e')]&&_0x109891['customField']){_0x595d6c[_0x24f3('0x48')]['push']({'id':_0x109891['idField'],'value':_0x109891[_0x24f3('0x46')][_0x24f3('0x24')]()});}else if(_0x109891['type']===_0x24f3('0x49')&&_0x109891[_0x24f3('0x1c')]&&_0x109891[_0x24f3('0x1e')]&&_0x109891[_0x24f3('0x44')]){_0x1c6224[_0x109891[_0x24f3('0x1c')]]&&_0x595d6c[_0x24f3('0x48')][_0x24f3('0x1d')]({'id':_0x109891['idField'],'value':_0x1c6224[_0x109891[_0x24f3('0x1c')]][_0x24f3('0x24')]()});}else if(_0x109891[_0x24f3('0x42')]==='customVariable'&&_0x109891[_0x24f3('0x4a')]&&_0x109891[_0x24f3('0x4a')][_0x24f3('0x10')]&&_0x109891[_0x24f3('0x1e')]&&_0x109891[_0x24f3('0x44')]){_0x1c6224[_0x109891[_0x24f3('0x4a')][_0x24f3('0x10')][_0x24f3('0x45')]()]&&_0x595d6c[_0x24f3('0x48')]['push']({'id':_0x109891[_0x24f3('0x1e')],'value':_0x1c6224[_0x109891[_0x24f3('0x4a')][_0x24f3('0x10')][_0x24f3('0x45')]()]['toString']()});}});}return _0x595d6c;}function getConnection(_0x3ba581){return request({'method':_0x24f3('0xc'),'form':{'method':_0x24f3('0x4b'),'input_type':'JSON','response_type':_0x24f3('0x1f'),'rest_data':JSON[_0x24f3('0x27')]({'user_auth':{'user_name':_0x3ba581[_0x24f3('0x4c')],'password':_0x3ba581['password'],'encryption':_0x24f3('0x4d')},'application':_0x24f3('0x4e')})}})[_0x24f3('0x2c')](function(_0xc57f9e){var _0x3aad9b=_0xc57f9e;if(_0x3aad9b['id']){def['sessionID']=_0x3aad9b['id'];return BPromise[_0x24f3('0x31')](_0x3aad9b);}else{throw new Error(util['format'](_0x24f3('0x4f'),_0x3ba581['id']));}});}function setRelationship(_0x100cd3,_0x1614ad,_0x49891e,_0x5094d3){return request({'form':{'method':'set_relationship','input_type':_0x24f3('0x1f'),'response_type':'JSON','rest_data':JSON[_0x24f3('0x27')]({'session':_0x100cd3['id'],'module_name':_0x24f3('0x20'),'module_id':_0x49891e['id'],'link_field_name':_0x5094d3,'related_ids':[_0x1614ad['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x24f3('0x50')]=function(_0x3626cb,_0x50859d,_0x4f4153,_0x3f0db4,_0x5b7f8a,_0x43d202){var _0xd18392,_0x3263e3,_0x28bb6a,_0x41b5b9;_0x43d202['remoteUri']=intUtil[_0x24f3('0x51')](_0x43d202[_0x24f3('0x52')]);_0x43d202[_0x24f3('0x53')]=intUtil['stripTrailingSlash'](_0x43d202[_0x24f3('0x53')]);def[_0x24f3('0x54')]=util[_0x24f3('0x21')](_0x24f3('0x55'),_0x43d202['remoteUri']);if(_0x5b7f8a&&_0x5b7f8a[_0x24f3('0x56')]){logger[_0x24f3('0xe')](_0x24f3('0x57'),'Recording\x20is\x20enabled!');_0x50859d[_0x24f3('0x58')]=util[_0x24f3('0x21')](_0x24f3('0x59'),_0x43d202[_0x24f3('0x53')],_0x50859d['uniqueid'],md5(_0x50859d[_0x24f3('0x5a')]));}else{_0x50859d[_0x24f3('0x58')]='';}return getConnection(_0x43d202)[_0x24f3('0x2c')](function(_0xc98343){_0x41b5b9=_0xc98343;return getUser(_0x43d202,_0x3f0db4['name'],_0x41b5b9);})['then'](function(_0x5ad01c){_0xd18392=_0x5ad01c;logger[_0x24f3('0xe')](_0x24f3('0x5b'),_0xd18392['id']);return getEndUser(_0x43d202,_0x50859d[_0x24f3('0x5c')],_0x50859d[_0x24f3('0x5d')],_0x41b5b9);})[_0x24f3('0x2c')](function(_0x43e6e6){_0x3263e3=_0x43e6e6;logger[_0x24f3('0xe')](_0x24f3('0x5e'),_0x3263e3['id']);return getTicket(_0x43d202,_0xd18392,_0x3263e3,_0x4f4153,_0x50859d,_0x4f4153['Fields'],_0x41b5b9,_0x24f3('0x5f'));})[_0x24f3('0x2c')](function(_0x3c019c){_0x28bb6a=_0x3c019c;logger['info'](_0x24f3('0x60'));logger[_0x24f3('0xe')](_0x24f3('0x61'),_0x28bb6a['id']);return setRelationship(_0x41b5b9,_0xd18392,_0x28bb6a,'users');})[_0x24f3('0x2c')](function(){return setRelationship(_0x41b5b9,_0x3263e3,_0x28bb6a,_0x24f3('0x62'));})['then'](function(){return getServerInfo(_0x41b5b9);})[_0x24f3('0x2c')](function(_0x25f8c7){var _0x38bd9f=parseInt(_0x25f8c7[_0x24f3('0x63')][_0x24f3('0x64')](0x0));var _0x2e3abf=util[_0x24f3('0x21')](_0x24f3('0x65'),_0x43d202[_0x24f3('0x52')],_0x28bb6a['id']);if(_0x38bd9f>0x6){_0x2e3abf=util[_0x24f3('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x43d202[_0x24f3('0x52')],_0x28bb6a['id']);}logger[_0x24f3('0xe')](_0x24f3('0x57'),_0x24f3('0x66'));emit(util['format'](_0x24f3('0x67'),_0x3f0db4[_0x24f3('0x10')]),_0x24f3('0x68'),{'uri':_0x2e3abf});})[_0x24f3('0x69')](function(_0x4439b3){logger[_0x24f3('0x6a')](_0x24f3('0x57'),JSON[_0x24f3('0x27')](_0x4439b3));});};exports['outbound']=function(_0x53db7a,_0x3c940b,_0x13bb68,_0x5c1e56,_0x3400b5,_0x453de6,_0x40fb4b){var _0x13e935,_0x3c706e,_0x19b923,_0x3e4754;_0x453de6[_0x24f3('0x52')]=intUtil[_0x24f3('0x51')](_0x453de6['remoteUri']);_0x453de6[_0x24f3('0x53')]=intUtil['stripTrailingSlash'](_0x453de6[_0x24f3('0x53')]);def['uri']=util[_0x24f3('0x21')](_0x24f3('0x55'),_0x453de6[_0x24f3('0x52')]);if(_0x40fb4b&&_0x40fb4b['recordingFormat']&&_0x40fb4b[_0x24f3('0x6b')]!==_0x24f3('0x6c')){logger[_0x24f3('0xe')](_0x24f3('0x6d'),_0x24f3('0x6e'));_0x3c940b[_0x24f3('0x58')]=util[_0x24f3('0x21')](_0x24f3('0x59'),_0x453de6[_0x24f3('0x53')],_0x3c940b[_0x24f3('0x5a')],md5(_0x3c940b[_0x24f3('0x5a')]));}return getConnection(_0x453de6)[_0x24f3('0x2c')](function(_0x53896a){_0x3e4754=_0x53896a;return getUser(_0x453de6,_0x5c1e56['name'],_0x3e4754);})[_0x24f3('0x2c')](function(_0x2b97ca){_0x13e935=_0x2b97ca;logger[_0x24f3('0xe')]('The\x20User\x20ID\x20is:',_0x13e935['id']);return getEndUser(_0x453de6,_0x3c940b[_0x24f3('0x6f')],_0x3c940b[_0x24f3('0x70')],_0x3e4754);})[_0x24f3('0x2c')](function(_0x1e268b){_0x3c706e=_0x1e268b;logger[_0x24f3('0xe')](_0x24f3('0x5e'),_0x3c706e['id']);return getTicket(_0x453de6,_0x13e935,_0x3c706e,_0x13bb68,_0x3c940b,_0x13bb68['Fields'],_0x3e4754,_0x24f3('0x71'));})[_0x24f3('0x2c')](function(_0x2f1cbe){_0x19b923=_0x2f1cbe;logger['info'](_0x24f3('0x60'));logger[_0x24f3('0xe')]('The\x20Ticket\x20ID\x20is:',_0x19b923['id']);return setRelationship(_0x3e4754,_0x13e935,_0x19b923,_0x24f3('0x72'));})['then'](function(){return setRelationship(_0x3e4754,_0x3c706e,_0x19b923,'contacts');})[_0x24f3('0x2c')](function(){return getServerInfo(_0x3e4754);})[_0x24f3('0x2c')](function(_0x149572){var _0x356eb8=parseInt(_0x149572[_0x24f3('0x63')][_0x24f3('0x64')](0x0));var _0x24d2f0=util[_0x24f3('0x21')](_0x24f3('0x65'),_0x453de6[_0x24f3('0x52')],_0x19b923['id']);if(_0x356eb8>0x6){_0x24d2f0=util[_0x24f3('0x21')](_0x24f3('0x73'),_0x453de6['remoteUri'],_0x19b923['id']);}logger[_0x24f3('0xe')](_0x24f3('0x6d'),_0x24f3('0x66'));emit(util[_0x24f3('0x21')](_0x24f3('0x67'),_0x5c1e56[_0x24f3('0x10')]),_0x24f3('0x68'),{'uri':_0x24d2f0});})[_0x24f3('0x69')](function(_0x2f82c4){logger['error'](_0x24f3('0x6d'),JSON['stringify'](_0x2f82c4));});};exports[_0x24f3('0x74')]=function(_0x24fd88,_0x3982e0,_0x27e3ad,_0x5f51ed,_0x59c3b1,_0x16a270){var _0x26eba6,_0x1f1fa7,_0x340eb3,_0x5490c3;_0x16a270[_0x24f3('0x52')]=intUtil[_0x24f3('0x51')](_0x16a270['remoteUri']);_0x16a270[_0x24f3('0x53')]=intUtil['stripTrailingSlash'](_0x16a270['serverUrl']);def[_0x24f3('0x54')]=util[_0x24f3('0x21')](_0x24f3('0x55'),_0x16a270[_0x24f3('0x52')]);if(_0x59c3b1&&_0x59c3b1[_0x24f3('0x56')]){logger[_0x24f3('0xe')]('['+_0x3982e0[_0x24f3('0x75')][_0x24f3('0x76')]()+']',_0x24f3('0x6e'));_0x3982e0[_0x24f3('0x58')]=util[_0x24f3('0x21')](_0x24f3('0x59'),_0x16a270[_0x24f3('0x53')],_0x3982e0[_0x24f3('0x5a')],md5(_0x3982e0[_0x24f3('0x5a')]));}else{_0x3982e0[_0x24f3('0x58')]='';}return getConnection(_0x16a270)[_0x24f3('0x2c')](function(_0x324d28){_0x5490c3=_0x324d28;if(!_[_0x24f3('0x28')](_0x5f51ed)){return getUser(_0x16a270,_0x5f51ed[_0x24f3('0x10')],_0x5490c3);}else{return getUser(_0x16a270,null,_0x5490c3);}})['then'](function(_0x2f4bd6){_0x26eba6=_0x2f4bd6;logger[_0x24f3('0xe')](_0x24f3('0x5b'),_0x26eba6['id']);return getEndUser(_0x16a270,_0x3982e0[_0x24f3('0x5c')],_0x3982e0['calleridnum'],_0x5490c3);})[_0x24f3('0x2c')](function(_0x4221f8){_0x1f1fa7=_0x4221f8;logger[_0x24f3('0xe')](_0x24f3('0x5e'),_0x1f1fa7['id']);return getTicket(_0x16a270,_0x26eba6,_0x1f1fa7,_0x27e3ad,_0x3982e0,_0x27e3ad[_0x24f3('0x77')],_0x5490c3,_0x24f3('0x5f'));})[_0x24f3('0x2c')](function(_0x3ebe8d){_0x340eb3=_0x3ebe8d;logger[_0x24f3('0xe')]('Ticket\x20created!');logger[_0x24f3('0xe')](_0x24f3('0x61'),_0x340eb3['id']);return setRelationship(_0x5490c3,_0x26eba6,_0x340eb3,_0x24f3('0x72'));})[_0x24f3('0x2c')](function(){return setRelationship(_0x5490c3,_0x1f1fa7,_0x340eb3,'contacts');})[_0x24f3('0x2c')](function(){return getServerInfo(_0x5490c3);})[_0x24f3('0x69')](function(_0x4ea838){logger[_0x24f3('0x6a')]('['+_0x3982e0[_0x24f3('0x75')][_0x24f3('0x76')]()+']',JSON['stringify'](_0x4ea838));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index 0830b3d..d414ab4 100644 --- a/server/services/ami/trigger/integration/util.js +++ b/server/services/ami/trigger/integration/util.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddf3=['slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','sortBy','type','string','push','content','variable','variableName','toString','name','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash'];(function(_0x5a49f7,_0x1c2d52){var _0x47c894=function(_0xe1cb31){while(--_0xe1cb31){_0x5a49f7['push'](_0x5a49f7['shift']());}};_0x47c894(++_0x1c2d52);}(_0xddf3,0x10b));var _0x3ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3ddf('0x0'));exports[_0x3ddf('0x1')]=function(_0x585bbf,_0x5d8bd8,_0x1f0da2){var _0x10d281=[];if(_0x585bbf[_0x3ddf('0x2')]>0x0){var _0x631eb9=_[_0x3ddf('0x3')](_0x585bbf,['id']);for(var _0x78e6b7=0x0;_0x78e6b7<_0x631eb9[_0x3ddf('0x2')];_0x78e6b7++){var _0x3b0d87=_0x631eb9[_0x78e6b7];if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0x5')){_0x10d281[_0x3ddf('0x6')](_0x3b0d87[_0x3ddf('0x7')]);}else if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0x8')&&_0x3b0d87[_0x3ddf('0x9')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]&&_0x10d281[_0x3ddf('0x6')](_0x5d8bd8[_0x3b0d87['variableName']][_0x3ddf('0xa')]());}else if(_0x3b0d87[_0x3ddf('0x4')]==='customVariable'&&_0x3b0d87['Variable']&&_0x3b0d87['Variable'][_0x3ddf('0xb')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]&&_0x10d281[_0x3ddf('0x6')](_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()][_0x3ddf('0xa')]());}else if(_0x3b0d87[_0x3ddf('0x4')]===_0x3ddf('0xe')){if(_0x3b0d87[_0x3ddf('0xf')]==='string'&&_0x3b0d87[_0x3ddf('0x10')]){_0x10d281[_0x3ddf('0x6')](util[_0x3ddf('0x11')](_0x3ddf('0x12'),_0x3b0d87['key'],_0x3b0d87[_0x3ddf('0x13')]));}else if(_0x3b0d87[_0x3ddf('0xf')]===_0x3ddf('0x8')&&_0x3b0d87[_0x3ddf('0x9')]&&_0x3b0d87['key']){_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]&&_0x10d281['push'](util[_0x3ddf('0x11')]('%s:\x20%s',_0x3b0d87[_0x3ddf('0x10')],_0x5d8bd8[_0x3b0d87[_0x3ddf('0x9')]]));}else if(_0x3b0d87[_0x3ddf('0xf')]===_0x3ddf('0x14')&&_0x3b0d87[_0x3ddf('0xc')]&&_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')]&&_0x3b0d87[_0x3ddf('0x10')]){_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]&&_0x10d281[_0x3ddf('0x6')](util[_0x3ddf('0x11')](_0x3ddf('0x12'),_0x3b0d87['key'],_0x5d8bd8[_0x3b0d87[_0x3ddf('0xc')][_0x3ddf('0xb')][_0x3ddf('0xd')]()]));}}}}return _0x10d281[_0x3ddf('0x15')](_0x1f0da2);};exports[_0x3ddf('0x16')]=function(_0x43cb3f){var _0x3c5fbd=_0x43cb3f[_0x3ddf('0x17')](-0x1);if(_0x3c5fbd==='/'){_0x43cb3f=_0x43cb3f[_0x3ddf('0x18')](0x0,_0x43cb3f[_0x3ddf('0x19')](_0x3c5fbd));}return _0x43cb3f;};exports[_0x3ddf('0x1a')]=function(_0x5511d1){if(!_[_0x3ddf('0x1b')](_0x5511d1)&&_0x5511d1!==''){var _0x7db6da=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x7db6da[_0x3ddf('0x1c')](String(_0x5511d1)[_0x3ddf('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x57cc=['customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','keyContent','%s:\x20%s','join','slice','lastIndexOf','validateEmail','isNil','util','length','sortBy','type','push','content','variable','variableName','toString'];(function(_0x1df93e,_0x169d5b){var _0x31d4ec=function(_0x2f407e){while(--_0x2f407e){_0x1df93e['push'](_0x1df93e['shift']());}};_0x31d4ec(++_0x169d5b);}(_0x57cc,0x8d));var _0xc57c=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x57cc[_0x46d0c9];return _0x174506;};'use strict';var _=require('lodash');var util=require(_0xc57c('0x0'));exports['getString']=function(_0x2d5278,_0x486248,_0x1e5462){var _0x7d3717=[];if(_0x2d5278[_0xc57c('0x1')]>0x0){var _0x2b20e5=_[_0xc57c('0x2')](_0x2d5278,['id']);for(var _0x182ab3=0x0;_0x182ab3<_0x2b20e5[_0xc57c('0x1')];_0x182ab3++){var _0x23ea34=_0x2b20e5[_0x182ab3];if(_0x23ea34[_0xc57c('0x3')]==='string'){_0x7d3717[_0xc57c('0x4')](_0x23ea34[_0xc57c('0x5')]);}else if(_0x23ea34['type']===_0xc57c('0x6')&&_0x23ea34[_0xc57c('0x7')]){_0x486248[_0x23ea34[_0xc57c('0x7')]]&&_0x7d3717[_0xc57c('0x4')](_0x486248[_0x23ea34[_0xc57c('0x7')]][_0xc57c('0x8')]());}else if(_0x23ea34[_0xc57c('0x3')]===_0xc57c('0x9')&&_0x23ea34[_0xc57c('0xa')]&&_0x23ea34[_0xc57c('0xa')][_0xc57c('0xb')]){_0x486248[_0x23ea34[_0xc57c('0xa')]['name'][_0xc57c('0xc')]()]&&_0x7d3717['push'](_0x486248[_0x23ea34[_0xc57c('0xa')][_0xc57c('0xb')][_0xc57c('0xc')]()][_0xc57c('0x8')]());}else if(_0x23ea34['type']===_0xc57c('0xd')){if(_0x23ea34[_0xc57c('0xe')]===_0xc57c('0xf')&&_0x23ea34[_0xc57c('0x10')]){_0x7d3717['push'](util[_0xc57c('0x11')]('%s:\x20%s',_0x23ea34[_0xc57c('0x10')],_0x23ea34[_0xc57c('0x12')]));}else if(_0x23ea34['keyType']==='variable'&&_0x23ea34['variableName']&&_0x23ea34[_0xc57c('0x10')]){_0x486248[_0x23ea34['variableName']]&&_0x7d3717['push'](util[_0xc57c('0x11')](_0xc57c('0x13'),_0x23ea34[_0xc57c('0x10')],_0x486248[_0x23ea34['variableName']]));}else if(_0x23ea34[_0xc57c('0xe')]==='customVariable'&&_0x23ea34['Variable']&&_0x23ea34[_0xc57c('0xa')][_0xc57c('0xb')]&&_0x23ea34['key']){_0x486248[_0x23ea34[_0xc57c('0xa')][_0xc57c('0xb')][_0xc57c('0xc')]()]&&_0x7d3717[_0xc57c('0x4')](util[_0xc57c('0x11')](_0xc57c('0x13'),_0x23ea34[_0xc57c('0x10')],_0x486248[_0x23ea34[_0xc57c('0xa')][_0xc57c('0xb')][_0xc57c('0xc')]()]));}}}}return _0x7d3717[_0xc57c('0x14')](_0x1e5462);};exports['stripTrailingSlash']=function(_0x3b1f4d){var _0x536c78=_0x3b1f4d[_0xc57c('0x15')](-0x1);if(_0x536c78==='/'){_0x3b1f4d=_0x3b1f4d['substring'](0x0,_0x3b1f4d[_0xc57c('0x16')](_0x536c78));}return _0x3b1f4d;};exports[_0xc57c('0x17')]=function(_0x24ace9){if(!_[_0xc57c('0x18')](_0x24ace9)&&_0x24ace9!==''){var _0xe747ac=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0xe747ac['test'](String(_0x24ace9)[_0xc57c('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index f967a92..4aa7049 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x5c2b85,_0x5a92c0){var _0x4462e8=function(_0x123ece){while(--_0x123ece){_0x5c2b85['push'](_0x5c2b85['shift']());}};_0x4462e8(++_0x5a92c0);}(_0x34e8,0x12c));var _0x834e=function(_0x543c8f,_0x24e161){_0x543c8f=_0x543c8f-0x0;var _0x5119c3=_0x34e8[_0x543c8f];return _0x5119c3;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x57e2eb,_0x3b2a5f){var _0x26cc4=function(_0x340835){while(--_0x340835){_0x57e2eb['push'](_0x57e2eb['shift']());}};_0x26cc4(++_0x3b2a5f);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index df90071..b1a24c3 100644 --- a/server/services/ami/trigger/integration/zendesk.js +++ b/server/services/ami/trigger/integration/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb9b=['uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','end-user','first','%s/users.json','POST','Caller\x20-\x20%s','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','picklist','type','content','string','customField','custom_fields','push','variable','variableName','idField','Variable','toLowerCase','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','serverUrl'];(function(_0x480a6,_0x2638c){var _0x521404=function(_0x2f373c){while(--_0x2f373c){_0x480a6['push'](_0x480a6['shift']());}};_0x521404(++_0x2638c);}(_0xfb9b,0x168));var _0xbfb9=function(_0x42cc2c,_0x5b0ab0){_0x42cc2c=_0x42cc2c-0x0;var _0x4a0275=_0xfb9b[_0x42cc2c];return _0x4a0275;};'use strict';var _=require('lodash');var rp=require(_0xbfb9('0x0'));var md5=require(_0xbfb9('0x1'));var util=require(_0xbfb9('0x2'));var Redis=require(_0xbfb9('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xbfb9('0x4'))(_0xbfb9('0x5'));config[_0xbfb9('0x6')]=_[_0xbfb9('0x7')](config[_0xbfb9('0x6')],{'host':_0xbfb9('0x8'),'port':0x18eb});var io=require(_0xbfb9('0x9'))(new Redis(config[_0xbfb9('0x6')]));function emit(_0x9ffcd2,_0x5e6d85,_0x56880f){io['to'](_0x9ffcd2)[_0xbfb9('0xa')](_0x5e6d85,_0x56880f);}var headers={'Content-Type':'application/json','Accept':_0xbfb9('0xb')};function getTicket(_0x499867,_0x1413c3,_0x53e75c,_0x5465dc,_0x4f23ca){logger['info'](_0xbfb9('0xc'));return request({'uri':util['format'](_0xbfb9('0xd'),_0x499867[_0xbfb9('0xe')]),'method':'POST','body':{'ticket':_[_0xbfb9('0xf')]({'requester_id':_0x53e75c['id'],'submitter_id':_0x1413c3?_0x1413c3['id']:undefined,'assignee_id':_0x1413c3?_0x1413c3['id']:undefined,'tags':getTags(_0x5465dc[_0xbfb9('0x10')],_0xbfb9('0x11')),'subject':intUtil[_0xbfb9('0x12')](_0x5465dc[_0xbfb9('0x13')],_0x4f23ca,'\x20'),'description':intUtil['getString'](_0x5465dc[_0xbfb9('0x14')],_0x4f23ca,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5465dc['Descriptions'],_0x4f23ca,'\x0a')}},getCustomFields(_0x5465dc['Fields'],_0x4f23ca))}})[_0xbfb9('0x15')](function(_0x1e09d0){logger[_0xbfb9('0x16')]('Ticket\x20created!');return _0x1e09d0[_0xbfb9('0x17')];});}function getUser(_0x1deea8,_0x248b61){if(intUtil[_0xbfb9('0x18')](_0x248b61)){logger['info'](_0xbfb9('0x19'),_0x248b61);return request({'uri':util['format'](_0xbfb9('0x1a'),_0x1deea8['remoteUri']),'qs':{'query':util[_0xbfb9('0x1b')](_0xbfb9('0x1c'),_0x248b61)}})[_0xbfb9('0x15')](function(_0x184983){if(_0x184983[_0xbfb9('0x1d')]){logger[_0xbfb9('0x16')](_0xbfb9('0x1e'));return _[_0xbfb9('0x1f')](_0x184983[_0xbfb9('0x20')],{'email':_0x248b61,'role':_0xbfb9('0x21')});}else{logger[_0xbfb9('0x16')](_0xbfb9('0x22'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x23'),_0x1deea8[_0xbfb9('0xe')])})[_0xbfb9('0x15')](function(_0x26b7e9){logger[_0xbfb9('0x16')]('Admin\x20account\x20selected.');return _0x26b7e9[_0xbfb9('0x24')];});}});}else{logger[_0xbfb9('0x16')](_0xbfb9('0x22'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x23'),_0x1deea8[_0xbfb9('0xe')])})[_0xbfb9('0x15')](function(_0x426d82){logger[_0xbfb9('0x16')](_0xbfb9('0x25'));return _0x426d82['user'];});}}function getEndUser(_0x236119,_0x1a3560,_0x1697ef){logger[_0xbfb9('0x16')](_0xbfb9('0x26'),_0x1697ef);return request({'uri':util['format'](_0xbfb9('0x1a'),_0x236119['remoteUri']),'qs':{'query':util[_0xbfb9('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x1697ef)}})['then'](function(_0x3e8729){var _0x36de5f;if(_0x3e8729[_0xbfb9('0x20')][_0xbfb9('0x27')]){_0x3e8729['results']=_['filter'](_0x3e8729[_0xbfb9('0x20')],{'suspended':![],'role':_0xbfb9('0x28')});if(_0x3e8729[_0xbfb9('0x20')][_0xbfb9('0x27')]){_0x36de5f=_[_0xbfb9('0x29')](_0x3e8729[_0xbfb9('0x20')]);}}if(_0x36de5f){logger['info']('Enduser\x20found!');return _0x36de5f;}else{logger[_0xbfb9('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x2a'),_0x236119['remoteUri']),'method':_0xbfb9('0x2b'),'body':{'user':{'role':_0xbfb9('0x28'),'name':util['format'](_0xbfb9('0x2c'),_0x1a3560||_0x1697ef),'phone':_0x1697ef}}})['then'](function(_0x1b6978){logger[_0xbfb9('0x16')]('Enduser\x20created.');return _0x1b6978[_0xbfb9('0x24')];});}});}function getAuth(_0x356913){var _0x2cf03d;if(_0x356913[_0xbfb9('0x2d')]===_0xbfb9('0x2e')){_0x2cf03d=util['format'](_0xbfb9('0x2f'),_0x356913[_0xbfb9('0x30')],_0x356913['password']);}else if(_0x356913['authType']===_0xbfb9('0x31')){_0x2cf03d=util[_0xbfb9('0x1b')](_0xbfb9('0x32'),_0x356913[_0xbfb9('0x30')],_0x356913[_0xbfb9('0x31')]);}return util[_0xbfb9('0x1b')](_0xbfb9('0x33'),new Buffer(_0x2cf03d)[_0xbfb9('0x34')](_0xbfb9('0x35')));}function request(_0x463f92){logger[_0xbfb9('0x36')](_0xbfb9('0x37'),JSON[_0xbfb9('0x38')](_0x463f92));return rp(_['defaults'](_0x463f92,{'method':_0xbfb9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x32b54e,_0x341db2){var _0x421620=[];if(_0x32b54e&&_0x32b54e[_0xbfb9('0x27')]>0x0){_0x421620=_['map'](_0x32b54e,_0x341db2);}return _0x421620;}function getCustomFields(_0x2161e8,_0x247865){var _0x5bb41a=[];var _0x9152fa={'custom_fields':[]};if(_0x2161e8['length']>0x0){_[_0xbfb9('0x3a')](_0x2161e8,function(_0x6e0bb8){if(_['includes'](['string',_0xbfb9('0x3b')],_0x6e0bb8[_0xbfb9('0x3c')])&&_0x6e0bb8['nameField']&&!_0x6e0bb8['customField']){_0x9152fa[_0x6e0bb8['nameField']['toLowerCase']()]=_0x6e0bb8[_0xbfb9('0x3d')]['toString']();}else if(_['includes']([_0xbfb9('0x3e'),'picklist'],_0x6e0bb8[_0xbfb9('0x3c')])&&_0x6e0bb8['idField']&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8['idField'],'value':_0x6e0bb8['content'][_0xbfb9('0x34')]()});}else if(_0x6e0bb8[_0xbfb9('0x3c')]===_0xbfb9('0x42')&&_0x6e0bb8[_0xbfb9('0x43')]&&_0x6e0bb8[_0xbfb9('0x44')]&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x247865[_0x6e0bb8[_0xbfb9('0x43')]]&&_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8['idField'],'value':_0x247865[_0x6e0bb8[_0xbfb9('0x43')]][_0xbfb9('0x34')]()});}else if(_0x6e0bb8['type']==='customVariable'&&_0x6e0bb8[_0xbfb9('0x45')]&&_0x6e0bb8['Variable'][_0xbfb9('0x11')]&&_0x6e0bb8['idField']&&_0x6e0bb8[_0xbfb9('0x3f')]){_0x247865[_0x6e0bb8[_0xbfb9('0x45')]['name'][_0xbfb9('0x46')]()]&&_0x9152fa[_0xbfb9('0x40')][_0xbfb9('0x41')]({'id':_0x6e0bb8[_0xbfb9('0x44')],'value':_0x247865[_0x6e0bb8['Variable'][_0xbfb9('0x11')]['toLowerCase']()][_0xbfb9('0x34')]()});}});}return _0x9152fa;}exports['queue']=function(_0x4c59a4,_0x16b096,_0xcdc5a9,_0x52bb12,_0x282b8f,_0x2416ea){var _0x2ec05a,_0x1397f0;_0x2416ea[_0xbfb9('0xe')]=intUtil['stripTrailingSlash'](_0x2416ea[_0xbfb9('0xe')]);_0x2416ea['serverUrl']=intUtil[_0xbfb9('0x47')](_0x2416ea['serverUrl']);if(_0x282b8f&&_0x282b8f[_0xbfb9('0x48')]){logger[_0xbfb9('0x16')](_0xbfb9('0x49'),_0xbfb9('0x4a'));_0x16b096['recordingURL']=util[_0xbfb9('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2416ea[_0xbfb9('0x4b')],_0x16b096[_0xbfb9('0x4c')],md5(_0x16b096['uniqueid']));}else{_0x16b096['recordingURL']='';}headers['Authorization']=getAuth(_0x2416ea);return getUser(_0x2416ea,_0x52bb12['email'])[_0xbfb9('0x15')](function(_0x2d55de){_0x2ec05a=_0x2d55de;logger['info'](_0xbfb9('0x4d'),_0x2ec05a['id']);return getEndUser(_0x2416ea,_0x16b096['calleridname'],_0x16b096[_0xbfb9('0x4e')]);})['then'](function(_0x188365){_0x1397f0=_0x188365;logger[_0xbfb9('0x16')](_0xbfb9('0x4f'),_0x1397f0['id']);return getTicket(_0x2416ea,_0x2ec05a,_0x1397f0,_0xcdc5a9,_0x16b096);})[_0xbfb9('0x15')](function(_0x103215){if(_0x103215){logger[_0xbfb9('0x16')]('The\x20Ticket\x20ID\x20is:',_0x103215['id']);switch(_0x2416ea[_0xbfb9('0x3c')]){case _0xbfb9('0x50'):logger[_0xbfb9('0x16')](_0xbfb9('0x49'),_0xbfb9('0x51'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x52'),_0x2416ea[_0xbfb9('0xe')],_0x2ec05a['id'],_0x103215['id']),'method':_0xbfb9('0x2b')});case _0xbfb9('0x53'):logger[_0xbfb9('0x16')](_0xbfb9('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbfb9('0x54'),_0x52bb12[_0xbfb9('0x11')]),_0xbfb9('0x55'),{'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x56'),_0x2416ea[_0xbfb9('0xe')][_0xbfb9('0x57')](_0xbfb9('0x58'),''),_0x103215['id'])});break;default:logger[_0xbfb9('0x59')](_0xbfb9('0x49'),_0xbfb9('0x5a'));}}})['catch'](function(_0x549836){logger[_0xbfb9('0x59')](_0xbfb9('0x5b'),util[_0xbfb9('0x5c')](_0x549836,{'showHidden':!![],'depth':null}));});};exports[_0xbfb9('0x5d')]=function(_0x5a9efb,_0xa4f8b9,_0x11f6cd,_0x319340,_0xffa5fd,_0x200bae,_0x163185){var _0x829f3c,_0x3ddb71;_0x200bae[_0xbfb9('0xe')]=intUtil[_0xbfb9('0x47')](_0x200bae['remoteUri']);_0x200bae[_0xbfb9('0x4b')]=intUtil[_0xbfb9('0x47')](_0x200bae[_0xbfb9('0x4b')]);if(_0x163185&&_0x163185[_0xbfb9('0x5e')]&&_0x163185[_0xbfb9('0x5e')]!=='none'){logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x4a'));_0xa4f8b9[_0xbfb9('0x60')]=util[_0xbfb9('0x1b')](_0xbfb9('0x61'),_0x200bae[_0xbfb9('0x4b')],_0xa4f8b9[_0xbfb9('0x4c')],md5(_0xa4f8b9[_0xbfb9('0x4c')]));}headers[_0xbfb9('0x62')]=getAuth(_0x200bae);return getUser(_0x200bae,_0x319340[_0xbfb9('0x63')])[_0xbfb9('0x15')](function(_0x519a8a){_0x829f3c=_0x519a8a;logger[_0xbfb9('0x16')](_0xbfb9('0x4d'),_0x829f3c['id']);return getEndUser(_0x200bae,_0xa4f8b9[_0xbfb9('0x64')],_0xa4f8b9[_0xbfb9('0x65')]);})[_0xbfb9('0x15')](function(_0x593ac8){_0x3ddb71=_0x593ac8;logger['info'](_0xbfb9('0x4f'),_0x3ddb71['id']);return getTicket(_0x200bae,_0x829f3c,_0x3ddb71,_0x11f6cd,_0xa4f8b9);})[_0xbfb9('0x15')](function(_0x8caaf0){if(_0x8caaf0){logger[_0xbfb9('0x16')](_0xbfb9('0x66'),_0x8caaf0['id']);switch(_0x200bae['type']){case _0xbfb9('0x50'):logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x51'));return request({'uri':util[_0xbfb9('0x1b')](_0xbfb9('0x52'),_0x200bae[_0xbfb9('0xe')],_0x829f3c['id'],_0x8caaf0['id']),'method':_0xbfb9('0x2b')});case _0xbfb9('0x53'):logger[_0xbfb9('0x16')](_0xbfb9('0x5f'),_0xbfb9('0x67'));emit(util[_0xbfb9('0x1b')](_0xbfb9('0x54'),_0x319340['name']),_0xbfb9('0x55'),{'uri':util[_0xbfb9('0x1b')]('%s/agent/tickets/%s',_0x200bae[_0xbfb9('0xe')]['replace'](_0xbfb9('0x58'),''),_0x8caaf0['id'])});break;default:logger[_0xbfb9('0x59')]('[OUTBOUND]',_0xbfb9('0x5a'));}}})[_0xbfb9('0x68')](function(_0x447867){logger['error'](_0xbfb9('0x69'),util[_0xbfb9('0x5c')](_0x447867,{'showHidden':!![],'depth':null}));});};exports[_0xbfb9('0x6a')]=function(_0x3aed67,_0x23d82d,_0x4271e1,_0x4892a0,_0x3bcaa4,_0x102d3b){var _0xc7d054,_0x5a7729;_0x102d3b[_0xbfb9('0xe')]=intUtil[_0xbfb9('0x47')](_0x102d3b['remoteUri']);_0x102d3b[_0xbfb9('0x4b')]=intUtil['stripTrailingSlash'](_0x102d3b[_0xbfb9('0x4b')]);if(_0x3bcaa4&&_0x3bcaa4['monitor_format']){logger[_0xbfb9('0x16')]('['+_0x23d82d[_0xbfb9('0x6b')]['toUpperCase']()+']',_0xbfb9('0x4a'));_0x23d82d['recordingURL']=util[_0xbfb9('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x102d3b[_0xbfb9('0x4b')],_0x23d82d[_0xbfb9('0x4c')],md5(_0x23d82d['uniqueid']));}else{_0x23d82d['recordingURL']='';}headers[_0xbfb9('0x62')]=getAuth(_0x102d3b);return getUser(_0x102d3b)[_0xbfb9('0x15')](function(_0xbadf65){_0xc7d054=_0xbadf65;logger[_0xbfb9('0x16')](_0xbfb9('0x4d'),_0xc7d054['id']);return getEndUser(_0x102d3b,_0x23d82d['calleridname'],_0x23d82d[_0xbfb9('0x4e')]);})['then'](function(_0x2c59ae){_0x5a7729=_0x2c59ae;logger[_0xbfb9('0x16')](_0xbfb9('0x4f'),_0x5a7729['id']);return getTicket(_0x102d3b,_0xc7d054,_0x5a7729,_0x4271e1,_0x23d82d);})[_0xbfb9('0x15')](function(_0x3f1e3c){if(_0x3f1e3c){logger['info'](_0xbfb9('0x66'),_0x3f1e3c['id']);}})[_0xbfb9('0x68')](function(_0x226d5d){logger['error']('['+_0x23d82d[_0xbfb9('0x6b')][_0xbfb9('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xbfb9('0x5c')](_0x226d5d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5d94=['Basic\x20%s','toString','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','idField','push','content','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','[OUTBOUND]','Authorization','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','name','Subjects','getString','Descriptions','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','then','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','user','authType','password','%s:%s','username','token','%s/token:%s'];(function(_0x5d056b,_0x23e6c4){var _0x209b09=function(_0x19b35e){while(--_0x19b35e){_0x5d056b['push'](_0x5d056b['shift']());}};_0x209b09(++_0x23e6c4);}(_0x5d94,0x194));var _0x45d9=function(_0x1dca5b,_0x236757){_0x1dca5b=_0x1dca5b-0x0;var _0x2cadf1=_0x5d94[_0x1dca5b];return _0x2cadf1;};'use strict';var _=require(_0x45d9('0x0'));var rp=require('request-promise');var md5=require(_0x45d9('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x45d9('0x2'));var config=require('../../../../config/environment');var logger=require(_0x45d9('0x3'))(_0x45d9('0x4'));config[_0x45d9('0x5')]=_[_0x45d9('0x6')](config[_0x45d9('0x5')],{'host':_0x45d9('0x7'),'port':0x18eb});var io=require(_0x45d9('0x8'))(new Redis(config['redis']));function emit(_0x20dd46,_0x464808,_0xafa668){io['to'](_0x20dd46)['emit'](_0x464808,_0xafa668);}var headers={'Content-Type':'application/json','Accept':_0x45d9('0x9')};function getTicket(_0x1b0df9,_0x135f6b,_0x430507,_0x25b27c,_0x3a064b){logger[_0x45d9('0xa')](_0x45d9('0xb'));return request({'uri':util[_0x45d9('0xc')](_0x45d9('0xd'),_0x1b0df9[_0x45d9('0xe')]),'method':'POST','body':{'ticket':_[_0x45d9('0xf')]({'requester_id':_0x430507['id'],'submitter_id':_0x135f6b?_0x135f6b['id']:undefined,'assignee_id':_0x135f6b?_0x135f6b['id']:undefined,'tags':getTags(_0x25b27c[_0x45d9('0x10')],_0x45d9('0x11')),'subject':intUtil['getString'](_0x25b27c[_0x45d9('0x12')],_0x3a064b,'\x20'),'description':intUtil['getString'](_0x25b27c['Descriptions'],_0x3a064b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x45d9('0x13')](_0x25b27c[_0x45d9('0x14')],_0x3a064b,'\x0a')}},getCustomFields(_0x25b27c['Fields'],_0x3a064b))}})['then'](function(_0x426b0d){logger[_0x45d9('0xa')]('Ticket\x20created!');return _0x426b0d[_0x45d9('0x15')];});}function getUser(_0x561eb4,_0x37bf11){if(intUtil['validateEmail'](_0x37bf11)){logger[_0x45d9('0xa')](_0x45d9('0x16'),_0x37bf11);return request({'uri':util['format'](_0x45d9('0x17'),_0x561eb4[_0x45d9('0xe')]),'qs':{'query':util[_0x45d9('0xc')](_0x45d9('0x18'),_0x37bf11)}})['then'](function(_0x12f264){if(_0x12f264[_0x45d9('0x19')]){logger['info'](_0x45d9('0x1a'));return _[_0x45d9('0x1b')](_0x12f264[_0x45d9('0x1c')],{'email':_0x37bf11,'role':_0x45d9('0x1d')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x45d9('0xc')](_0x45d9('0x1e'),_0x561eb4['remoteUri'])})[_0x45d9('0x1f')](function(_0x4c3238){logger[_0x45d9('0xa')](_0x45d9('0x20'));return _0x4c3238['user'];});}});}else{logger[_0x45d9('0xa')](_0x45d9('0x21'));return request({'uri':util[_0x45d9('0xc')]('%s/users/me.json',_0x561eb4[_0x45d9('0xe')])})[_0x45d9('0x1f')](function(_0x5ad54e){logger[_0x45d9('0xa')]('Admin\x20account\x20selected.');return _0x5ad54e['user'];});}}function getEndUser(_0x10b14d,_0xde15d2,_0x3ba5b8){logger[_0x45d9('0xa')](_0x45d9('0x22'),_0x3ba5b8);return request({'uri':util[_0x45d9('0xc')](_0x45d9('0x17'),_0x10b14d[_0x45d9('0xe')]),'qs':{'query':util[_0x45d9('0xc')](_0x45d9('0x23'),_0x3ba5b8)}})['then'](function(_0x18cda1){var _0x46fefa;if(_0x18cda1[_0x45d9('0x1c')][_0x45d9('0x24')]){_0x18cda1[_0x45d9('0x1c')]=_[_0x45d9('0x25')](_0x18cda1[_0x45d9('0x1c')],{'suspended':![],'role':_0x45d9('0x26')});if(_0x18cda1[_0x45d9('0x1c')]['length']){_0x46fefa=_[_0x45d9('0x27')](_0x18cda1['results']);}}if(_0x46fefa){logger[_0x45d9('0xa')](_0x45d9('0x28'));return _0x46fefa;}else{logger[_0x45d9('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x45d9('0xc')](_0x45d9('0x29'),_0x10b14d[_0x45d9('0xe')]),'method':_0x45d9('0x2a'),'body':{'user':{'role':_0x45d9('0x26'),'name':util[_0x45d9('0xc')](_0x45d9('0x2b'),_0xde15d2||_0x3ba5b8),'phone':_0x3ba5b8}}})[_0x45d9('0x1f')](function(_0x105838){logger[_0x45d9('0xa')](_0x45d9('0x2c'));return _0x105838[_0x45d9('0x2d')];});}});}function getAuth(_0x40a9e0){var _0x2933f9;if(_0x40a9e0[_0x45d9('0x2e')]===_0x45d9('0x2f')){_0x2933f9=util[_0x45d9('0xc')](_0x45d9('0x30'),_0x40a9e0[_0x45d9('0x31')],_0x40a9e0[_0x45d9('0x2f')]);}else if(_0x40a9e0['authType']===_0x45d9('0x32')){_0x2933f9=util[_0x45d9('0xc')](_0x45d9('0x33'),_0x40a9e0[_0x45d9('0x31')],_0x40a9e0[_0x45d9('0x32')]);}return util[_0x45d9('0xc')](_0x45d9('0x34'),new Buffer(_0x2933f9)[_0x45d9('0x35')](_0x45d9('0x36')));}function request(_0x1d8570){logger['debug'](_0x45d9('0x37'),JSON[_0x45d9('0x38')](_0x1d8570));return rp(_[_0x45d9('0x6')](_0x1d8570,{'method':_0x45d9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3e8c10,_0x4ef04f){var _0x5772d9=[];if(_0x3e8c10&&_0x3e8c10[_0x45d9('0x24')]>0x0){_0x5772d9=_[_0x45d9('0x3a')](_0x3e8c10,_0x4ef04f);}return _0x5772d9;}function getCustomFields(_0x6f7845,_0x2d983c){var _0xb80ccb=[];var _0x24bf78={'custom_fields':[]};if(_0x6f7845[_0x45d9('0x24')]>0x0){_[_0x45d9('0x3b')](_0x6f7845,function(_0x2e5129){if(_[_0x45d9('0x3c')]([_0x45d9('0x3d'),_0x45d9('0x3e')],_0x2e5129[_0x45d9('0x3f')])&&_0x2e5129[_0x45d9('0x40')]&&!_0x2e5129[_0x45d9('0x41')]){_0x24bf78[_0x2e5129['nameField']['toLowerCase']()]=_0x2e5129['content'][_0x45d9('0x35')]();}else if(_['includes'](['string',_0x45d9('0x3e')],_0x2e5129[_0x45d9('0x3f')])&&_0x2e5129[_0x45d9('0x42')]&&_0x2e5129[_0x45d9('0x41')]){_0x24bf78['custom_fields'][_0x45d9('0x43')]({'id':_0x2e5129[_0x45d9('0x42')],'value':_0x2e5129[_0x45d9('0x44')][_0x45d9('0x35')]()});}else if(_0x2e5129[_0x45d9('0x3f')]===_0x45d9('0x45')&&_0x2e5129[_0x45d9('0x46')]&&_0x2e5129[_0x45d9('0x42')]&&_0x2e5129[_0x45d9('0x41')]){_0x2d983c[_0x2e5129[_0x45d9('0x46')]]&&_0x24bf78[_0x45d9('0x47')][_0x45d9('0x43')]({'id':_0x2e5129['idField'],'value':_0x2d983c[_0x2e5129[_0x45d9('0x46')]][_0x45d9('0x35')]()});}else if(_0x2e5129[_0x45d9('0x3f')]===_0x45d9('0x48')&&_0x2e5129[_0x45d9('0x49')]&&_0x2e5129['Variable'][_0x45d9('0x11')]&&_0x2e5129[_0x45d9('0x42')]&&_0x2e5129[_0x45d9('0x41')]){_0x2d983c[_0x2e5129[_0x45d9('0x49')][_0x45d9('0x11')]['toLowerCase']()]&&_0x24bf78[_0x45d9('0x47')][_0x45d9('0x43')]({'id':_0x2e5129[_0x45d9('0x42')],'value':_0x2d983c[_0x2e5129[_0x45d9('0x49')][_0x45d9('0x11')][_0x45d9('0x4a')]()][_0x45d9('0x35')]()});}});}return _0x24bf78;}exports[_0x45d9('0x4b')]=function(_0x19af46,_0x8b0244,_0x30a8e6,_0x4268f6,_0x1d38fe,_0x28e239){var _0x5f1a82,_0x11dd31;_0x28e239[_0x45d9('0xe')]=intUtil['stripTrailingSlash'](_0x28e239[_0x45d9('0xe')]);_0x28e239[_0x45d9('0x4c')]=intUtil[_0x45d9('0x4d')](_0x28e239[_0x45d9('0x4c')]);if(_0x1d38fe&&_0x1d38fe[_0x45d9('0x4e')]){logger['info']('[QUEUE]',_0x45d9('0x4f'));_0x8b0244[_0x45d9('0x50')]=util[_0x45d9('0xc')](_0x45d9('0x51'),_0x28e239[_0x45d9('0x4c')],_0x8b0244[_0x45d9('0x52')],md5(_0x8b0244[_0x45d9('0x52')]));}else{_0x8b0244[_0x45d9('0x50')]='';}headers['Authorization']=getAuth(_0x28e239);return getUser(_0x28e239,_0x4268f6['email'])[_0x45d9('0x1f')](function(_0x31dee8){_0x5f1a82=_0x31dee8;logger[_0x45d9('0xa')]('The\x20User\x20ID\x20is:',_0x5f1a82['id']);return getEndUser(_0x28e239,_0x8b0244[_0x45d9('0x53')],_0x8b0244['calleridnum']);})[_0x45d9('0x1f')](function(_0x1fabce){_0x11dd31=_0x1fabce;logger[_0x45d9('0xa')]('The\x20Enduser\x20ID\x20is:',_0x11dd31['id']);return getTicket(_0x28e239,_0x5f1a82,_0x11dd31,_0x30a8e6,_0x8b0244);})[_0x45d9('0x1f')](function(_0x3c29ca){if(_0x3c29ca){logger[_0x45d9('0xa')](_0x45d9('0x54'),_0x3c29ca['id']);switch(_0x28e239[_0x45d9('0x3f')]){case _0x45d9('0x55'):logger[_0x45d9('0xa')](_0x45d9('0x56'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x45d9('0x57'),_0x28e239[_0x45d9('0xe')],_0x5f1a82['id'],_0x3c29ca['id']),'method':_0x45d9('0x2a')});case _0x45d9('0x58'):logger[_0x45d9('0xa')](_0x45d9('0x56'),_0x45d9('0x59'));emit(util[_0x45d9('0xc')]('user:%s',_0x4268f6[_0x45d9('0x11')]),'trigger:browser:url',{'uri':util[_0x45d9('0xc')](_0x45d9('0x5a'),_0x28e239[_0x45d9('0xe')]['replace'](_0x45d9('0x5b'),''),_0x3c29ca['id'])});break;default:logger[_0x45d9('0x5c')](_0x45d9('0x56'),_0x45d9('0x5d'));}}})[_0x45d9('0x5e')](function(_0x15b161){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x45d9('0x5f')](_0x15b161,{'showHidden':!![],'depth':null}));});};exports[_0x45d9('0x60')]=function(_0x5c0dfa,_0x8f513f,_0x5090c2,_0x177de0,_0x3e625f,_0x3fb9bd,_0x3e3d4e){var _0x5dc520,_0x3cf36f;_0x3fb9bd[_0x45d9('0xe')]=intUtil[_0x45d9('0x4d')](_0x3fb9bd[_0x45d9('0xe')]);_0x3fb9bd['serverUrl']=intUtil[_0x45d9('0x4d')](_0x3fb9bd[_0x45d9('0x4c')]);if(_0x3e3d4e&&_0x3e3d4e[_0x45d9('0x61')]&&_0x3e3d4e['recordingFormat']!=='none'){logger[_0x45d9('0xa')](_0x45d9('0x62'),_0x45d9('0x4f'));_0x8f513f[_0x45d9('0x50')]=util['format'](_0x45d9('0x51'),_0x3fb9bd[_0x45d9('0x4c')],_0x8f513f[_0x45d9('0x52')],md5(_0x8f513f[_0x45d9('0x52')]));}headers[_0x45d9('0x63')]=getAuth(_0x3fb9bd);return getUser(_0x3fb9bd,_0x177de0[_0x45d9('0x64')])[_0x45d9('0x1f')](function(_0x1904f7){_0x5dc520=_0x1904f7;logger[_0x45d9('0xa')](_0x45d9('0x65'),_0x5dc520['id']);return getEndUser(_0x3fb9bd,_0x8f513f[_0x45d9('0x66')],_0x8f513f[_0x45d9('0x67')]);})[_0x45d9('0x1f')](function(_0x35e11e){_0x3cf36f=_0x35e11e;logger[_0x45d9('0xa')](_0x45d9('0x68'),_0x3cf36f['id']);return getTicket(_0x3fb9bd,_0x5dc520,_0x3cf36f,_0x5090c2,_0x8f513f);})['then'](function(_0x59e9b1){if(_0x59e9b1){logger[_0x45d9('0xa')](_0x45d9('0x54'),_0x59e9b1['id']);switch(_0x3fb9bd[_0x45d9('0x3f')]){case _0x45d9('0x55'):logger[_0x45d9('0xa')](_0x45d9('0x62'),_0x45d9('0x69'));return request({'uri':util[_0x45d9('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3fb9bd['remoteUri'],_0x5dc520['id'],_0x59e9b1['id']),'method':_0x45d9('0x2a')});case _0x45d9('0x58'):logger[_0x45d9('0xa')]('[OUTBOUND]',_0x45d9('0x59'));emit(util[_0x45d9('0xc')](_0x45d9('0x6a'),_0x177de0[_0x45d9('0x11')]),_0x45d9('0x6b'),{'uri':util['format'](_0x45d9('0x5a'),_0x3fb9bd[_0x45d9('0xe')]['replace'](_0x45d9('0x5b'),''),_0x59e9b1['id'])});break;default:logger[_0x45d9('0x5c')](_0x45d9('0x62'),_0x45d9('0x5d'));}}})[_0x45d9('0x5e')](function(_0x4a6792){logger[_0x45d9('0x5c')](_0x45d9('0x6c'),util[_0x45d9('0x5f')](_0x4a6792,{'showHidden':!![],'depth':null}));});};exports[_0x45d9('0x6d')]=function(_0x5102b9,_0x49509c,_0xf8446c,_0x31a36c,_0x5f1a6e,_0x1af438){var _0x5d48f6,_0x57f0b8;_0x1af438[_0x45d9('0xe')]=intUtil[_0x45d9('0x4d')](_0x1af438[_0x45d9('0xe')]);_0x1af438['serverUrl']=intUtil[_0x45d9('0x4d')](_0x1af438['serverUrl']);if(_0x5f1a6e&&_0x5f1a6e[_0x45d9('0x4e')]){logger[_0x45d9('0xa')]('['+_0x49509c[_0x45d9('0x6e')][_0x45d9('0x6f')]()+']',_0x45d9('0x4f'));_0x49509c[_0x45d9('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1af438[_0x45d9('0x4c')],_0x49509c[_0x45d9('0x52')],md5(_0x49509c[_0x45d9('0x52')]));}else{_0x49509c[_0x45d9('0x50')]='';}headers['Authorization']=getAuth(_0x1af438);return getUser(_0x1af438)[_0x45d9('0x1f')](function(_0x1f6d48){_0x5d48f6=_0x1f6d48;logger['info']('The\x20User\x20ID\x20is:',_0x5d48f6['id']);return getEndUser(_0x1af438,_0x49509c['calleridname'],_0x49509c[_0x45d9('0x70')]);})[_0x45d9('0x1f')](function(_0xee68b8){_0x57f0b8=_0xee68b8;logger[_0x45d9('0xa')](_0x45d9('0x68'),_0x57f0b8['id']);return getTicket(_0x1af438,_0x5d48f6,_0x57f0b8,_0xf8446c,_0x49509c);})['then'](function(_0x54c2b0){if(_0x54c2b0){logger[_0x45d9('0xa')](_0x45d9('0x54'),_0x54c2b0['id']);}})['catch'](function(_0x4df6dc){logger[_0x45d9('0x5c')]('['+_0x49509c['lastevent'][_0x45d9('0x6f')]()+']'+_0x45d9('0x71'),util[_0x45d9('0x5f')](_0x4df6dc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 8ee0f81..a8e3679 100644 --- a/server/services/ami/trigger/integration/zoho.js +++ b/server/services/ami/trigger/integration/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa20=['Outbound','trigger:browser:url','unmanaged','stripTrailingSlash','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','variableName','toString','type','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','seconds','catch','Failing\x20creating\x20the\x20access_token','ActiveUsers','Zoho-oauthtoken\x20','then','users','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','last_name','code','startCase','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','format','called','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','details','stack','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridname'];(function(_0x1ae8db,_0x12f29c){var _0x12eca8=function(_0x3d8d53){while(--_0x3d8d53){_0x1ae8db['push'](_0x1ae8db['shift']());}};_0x12eca8(++_0x12f29c);}(_0xfa20,0x141));var _0x0fa2=function(_0x5309f0,_0x381caf){_0x5309f0=_0x5309f0-0x0;var _0x3c5ff0=_0xfa20[_0x5309f0];return _0x3c5ff0;};'use strict';var _=require(_0x0fa2('0x0'));var rp=require(_0x0fa2('0x1'));var md5=require(_0x0fa2('0x2'));var util=require(_0x0fa2('0x3'));var intUtil=require(_0x0fa2('0x4'));var moment=require(_0x0fa2('0x5'));var Redis=require(_0x0fa2('0x6'));var BPromise=require(_0x0fa2('0x7'));var config=require(_0x0fa2('0x8'));var logger=require(_0x0fa2('0x9'))(_0x0fa2('0xa'));config['redis']=_[_0x0fa2('0xb')](config[_0x0fa2('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x0fa2('0xd'))(new Redis(config[_0x0fa2('0xc')]));function emit(_0x1f3223,_0x11979c,_0x28cc4d){io['to'](_0x1f3223)[_0x0fa2('0xe')](_0x11979c,_0x28cc4d);}function request(_0x3ec7f3){logger[_0x0fa2('0xf')](_0x0fa2('0x10'),JSON[_0x0fa2('0x11')](_0x3ec7f3));return rp(_0x3ec7f3);}function getCustomFields(_0x5c59dc,_0xd34dd5){var _0x30fd6d={};if(_0x5c59dc[_0x0fa2('0x12')]>0x0){_[_0x0fa2('0x13')](_0x5c59dc,function(_0x46c980){if(_[_0x0fa2('0x14')]([_0x0fa2('0x15'),_0x0fa2('0x16')],_0x46c980['type'])&&_0x46c980[_0x0fa2('0x17')]){_0x30fd6d[_0x46c980['idField']]=_0x46c980[_0x0fa2('0x18')]['toString']();}else if(_0x46c980['type']==='variable'&&_0x46c980[_0x0fa2('0x19')]&&_0x46c980[_0x0fa2('0x17')]&&_0xd34dd5[_0x46c980[_0x0fa2('0x19')]]){_0x30fd6d[_0x46c980[_0x0fa2('0x17')]]=_0xd34dd5[_0x46c980[_0x0fa2('0x19')]][_0x0fa2('0x1a')]();}else if(_0x46c980[_0x0fa2('0x1b')]===_0x0fa2('0x1c')&&_0x46c980['Variable']&&_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')]&&_0x46c980[_0x0fa2('0x17')]&&_0xd34dd5[_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')][_0x0fa2('0x1f')]()]){_0x30fd6d[_0x46c980[_0x0fa2('0x17')]]=_0xd34dd5[_0x46c980[_0x0fa2('0x1d')][_0x0fa2('0x1e')][_0x0fa2('0x1f')]()]['toString']();}});}return _0x30fd6d;}function getName(_0x495870){if(_0x495870[_0x0fa2('0x20')]('\x20')>0x0){var _0x22cca6=_0x495870['split'](/ (.+)/);if(_0x22cca6[0x1]){return _0x22cca6;}}return[_0x495870,_0x495870];}var accountsTokens={};function getAccessToken(_0x383ebd){return new Promise(function(_0x29b93c,_0x13c103){if(!_['isNil'](accountsTokens[_0x383ebd['id']])&&!_[_0x0fa2('0x21')](accountsTokens[_0x383ebd['id']][_0x0fa2('0x22')])){if(moment()['isBefore'](accountsTokens[_0x383ebd['id']][_0x0fa2('0x23')])){_0x29b93c(accountsTokens[_0x383ebd['id']]['access_token']);}}var _0x357e7a;switch(_0x383ebd[_0x0fa2('0x24')]){case'US':_0x357e7a=_0x0fa2('0x25');break;case'AU':_0x357e7a=_0x0fa2('0x26');break;case'EU':_0x357e7a=_0x0fa2('0x27');break;case'IN':_0x357e7a='https://accounts.zoho.in';break;case'CN':_0x357e7a=_0x0fa2('0x28');break;default:_0x357e7a=_0x0fa2('0x27');break;}var _0x111028={'method':_0x0fa2('0x29'),'uri':_0x357e7a+_0x0fa2('0x2a'),'qs':{'refresh_token':_0x383ebd[_0x0fa2('0x2b')],'client_id':_0x383ebd[_0x0fa2('0x2c')],'client_secret':_0x383ebd['clientSecret'],'grant_type':_0x0fa2('0x2d')},'json':!![]};return rp(_0x111028)['then'](function(_0x3611ca){accountsTokens[_0x383ebd['id']]={'access_token':_0x3611ca['access_token'],'expires_in':moment()[_0x0fa2('0x2e')](_0x3611ca[_0x0fa2('0x23')],_0x0fa2('0x2f'))};_0x29b93c(_0x3611ca[_0x0fa2('0x22')]);})[_0x0fa2('0x30')](function(_0x338e9b){logger['error'](_0x0fa2('0x31'),_0x338e9b['stack']);_0x13c103(_0x338e9b);});});}function getUser(_0x5060bf,_0x12b59a,_0x100742,_0x1f6a4c){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x12b59a),'qs':{'type':_0x0fa2('0x32')},'headers':{'Authorization':_0x0fa2('0x33')+_0x5060bf},'json':!![]})[_0x0fa2('0x34')](function(_0x3f546f){if(_0x3f546f['users']){var _0x5e2578=-0x1;if(_['isArrayLikeObject'](_0x3f546f[_0x0fa2('0x35')])){if(!_['isNil'](_0x1f6a4c)){_0x5e2578=_[_0x0fa2('0x36')](_0x3f546f[_0x0fa2('0x35')],function(_0x37f4a8){return _0x37f4a8['email']===_0x1f6a4c;});}if(_0x5e2578>=0x0){logger['info'](_0x0fa2('0x37'));}else{logger[_0x0fa2('0x38')](_0x0fa2('0x39'));_0x5e2578=_[_0x0fa2('0x36')](_0x3f546f[_0x0fa2('0x35')],function(_0xf76d7){return _0xf76d7[_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x3b');});}return _0x3f546f[_0x0fa2('0x35')][_0x5e2578];}else{if(_0x3f546f[_0x0fa2('0x3c')][_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x3b')){logger[_0x0fa2('0x38')](_0x0fa2('0x39'));user=_0x3f546f[_0x0fa2('0x3c')];return user;}else{logger[_0x0fa2('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3f546f));throw new Error(_0x0fa2('0x3e')+JSON[_0x0fa2('0x11')](_0x3f546f));}}}else{logger[_0x0fa2('0x3d')](_0x0fa2('0x3f'),JSON[_0x0fa2('0x11')](_0x3f546f));throw new Error(_0x0fa2('0x3e')+JSON['stringify'](_0x3f546f));}})[_0x0fa2('0x30')](function(_0xe4fe1e){console[_0x0fa2('0x3d')](_0xe4fe1e);});}function getZohoUser(_0x1ca79c,_0x255c5c){return new BPromise(function(_0x52afb4,_0x139ab8){request(_0x1ca79c)[_0x0fa2('0x34')](function(_0x571546){var _0x15e04f=null;if(_0x571546){_0x15e04f=_0x571546[_0x0fa2('0x40')][0x0];_0x15e04f[_0x0fa2('0x41')]=_0x255c5c;}_0x52afb4(_0x15e04f);})['catch'](function(_0x594586){_0x139ab8(_0x594586);});});}function createEndUser(_0x4821c0,_0x52a6d0,_0x123155,_0x25b5cb,_0x43dc89,_0x481e1e){var _0x123155=getName(_0x123155);return request({'method':_0x0fa2('0x29'),'uri':_0x0fa2('0x42')+_0x52a6d0+_0x0fa2('0x43')+_['startCase'](_0x481e1e[_0x0fa2('0x44')])+'s','body':{'data':[{'Last_Name':_0x123155[0x1],'First_Name':_0x123155[0x0],'Phone':_0x25b5cb,'Owner':{'name':!_[_0x0fa2('0x21')](_0x43dc89[_0x0fa2('0x45')]['name'])?_0x43dc89[_0x0fa2('0x45')]['name']:!_[_0x0fa2('0x21')](_0x43dc89['first_name'])?_0x43dc89['first_name']+'\x20'+_0x43dc89[_0x0fa2('0x46')]:_0x43dc89[_0x0fa2('0x46')],'id':_0x43dc89['id']}}]},'headers':{'Authorization':_0x0fa2('0x33')+_0x4821c0},'json':!![]})[_0x0fa2('0x34')](function(_0x5bebf3){if(_0x5bebf3&&_0x5bebf3['data'][0x0][_0x0fa2('0x47')]==='SUCCESS'){var _0x17c36c=_0x5bebf3[_0x0fa2('0x40')][0x0]['details'];_0x17c36c[_0x0fa2('0x41')]=_[_0x0fa2('0x48')](_0x481e1e[_0x0fa2('0x44')])+'s';return _0x17c36c;}logger[_0x0fa2('0x3d')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0x0fa2('0x49')+JSON['stringify'](data));})[_0x0fa2('0x30')](function(_0x26bb7c){console[_0x0fa2('0x4a')]('CREATE\x20ERROR',_0x26bb7c);});}function getEndUser(_0x17f916,_0x1d3997,_0x45837a,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c){var _0xd8e181={'method':_0x0fa2('0x4b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x17f916},'json':!![]};switch(_0x2bd59c[_0x0fa2('0x4c')]){case _0x0fa2('0x4d'):_0xd8e181[_0x0fa2('0x4e')]='https://www.zohoapis.'+_0x1d3997+_0x0fa2('0x4f')+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x50'))['then'](function(_0xc0ff7b){if(_0xc0ff7b)return _0xc0ff7b;_0xd8e181['uri']=_0x0fa2('0x42')+_0x1d3997+_0x0fa2('0x51')+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x52'))[_0x0fa2('0x34')](function(_0x15c623){if(_0x15c623)return _0x15c623;if(_0x2bd59c[_0x0fa2('0x44')]!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});});break;case _0x0fa2('0x54'):_0xd8e181[_0x0fa2('0x4e')]='https://www.zohoapis.'+_0x1d3997+_0x0fa2('0x4f')+_0x317e9c+'))';return getZohoUser(_0xd8e181,'Contacts')[_0x0fa2('0x34')](function(_0x567d79){if(_0x567d79)return _0x567d79;if(_0x2bd59c[_0x0fa2('0x44')]!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});break;case _0x0fa2('0x55'):_0xd8e181['uri']='https://www.zohoapis.'+_0x1d3997+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x317e9c+'))';return getZohoUser(_0xd8e181,_0x0fa2('0x52'))[_0x0fa2('0x34')](function(_0x479d48){if(_0x479d48)return _0x479d48;if(_0x2bd59c['moduleCreate']!=_0x0fa2('0x53')){return createEndUser(_0x17f916,_0x1d3997,_0x3c4592,_0x317e9c,_0x2f4063,_0x2bd59c);}else{return{};}});break;}}function getCall(_0x4ae8ac,_0x8d5b85,_0x14fdfa,_0x52065c,_0x156316,_0x454cca,_0x2dc2a5,_0x151c57){logger[_0x0fa2('0x38')](_0x0fa2('0x56'));var _0x1858c3={};_0x1858c3[_0x0fa2('0x57')]={'name':!_[_0x0fa2('0x21')](_0x52065c[_0x0fa2('0x45')]['name'])&&!_[_0x0fa2('0x21')](_0x52065c[_0x0fa2('0x3a')][_0x0fa2('0x1e')])&&_0x52065c[_0x0fa2('0x3a')][_0x0fa2('0x1e')]===_0x0fa2('0x58')?_0x52065c[_0x0fa2('0x45')][_0x0fa2('0x1e')]:!_['isNil'](_0x52065c[_0x0fa2('0x59')])?_0x52065c['first_name']+'\x20'+_0x52065c[_0x0fa2('0x46')]:_0x52065c[_0x0fa2('0x46')],'id':_0x52065c['id']};_0x1858c3[_0x0fa2('0x5a')]=intUtil[_0x0fa2('0x5b')](_0x454cca[_0x0fa2('0x5c')],_0x2dc2a5,'\x20');_0x1858c3['Description']=intUtil[_0x0fa2('0x5b')](_0x454cca['Descriptions'],_0x2dc2a5,'\x0a');if(_0x156316[_0x0fa2('0x41')]===_0x0fa2('0x50')){_0x1858c3[_0x0fa2('0x5d')]={'name':!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5e')])?_0x156316['Full_Name']:!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5f')])?_0x156316[_0x0fa2('0x5f')]+'\x20'+_0x156316[_0x0fa2('0x60')]:_0x156316[_0x0fa2('0x60')],'id':_0x156316['id']};}if(_0x156316[_0x0fa2('0x41')]==='Leads'){_0x1858c3[_0x0fa2('0x61')]={'name':!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5e')])?_0x156316[_0x0fa2('0x5e')]:!_[_0x0fa2('0x21')](_0x156316[_0x0fa2('0x5f')])?_0x156316[_0x0fa2('0x5f')]+'\x20'+_0x156316[_0x0fa2('0x60')]:_0x156316[_0x0fa2('0x60')],'id':_0x156316['id']};_0x1858c3[_0x0fa2('0x62')]=_[_0x0fa2('0x48')](_0x156316['enduserType']);}if(_0x2dc2a5['talktime']){_0x1858c3[_0x0fa2('0x63')]=moment[_0x0fa2('0x64')](parseInt(_0x2dc2a5[_0x0fa2('0x65')])*0x3e8)['format'](_0x0fa2('0x66'));}else if(_0x2dc2a5[_0x0fa2('0x67')]&&_0x2dc2a5[_0x0fa2('0x68')]){_0x1858c3['Call_Duration']=moment[_0x0fa2('0x64')](moment(_0x2dc2a5['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x2dc2a5[_0x0fa2('0x69')],_0x0fa2('0x6a'))))[_0x0fa2('0x6b')](_0x0fa2('0x66'));}switch(_0x2dc2a5['lastevent']){case _0x0fa2('0x6c'):_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x6e');break;case _0x0fa2('0x6f'):case'connect':_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x70');break;case _0x0fa2('0x71'):_0x1858c3[_0x0fa2('0x6d')]='Rejected';break;case _0x0fa2('0x72'):_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x73');break;case'timeout':_0x1858c3[_0x0fa2('0x6d')]=_0x0fa2('0x74');default:}_0x1858c3[_0x0fa2('0x75')]=(_0x151c57===_0x0fa2('0x76')?moment(_0x2dc2a5[_0x0fa2('0x69')])[_0x0fa2('0x6b')](_0x0fa2('0x6a')):moment(_0x2dc2a5[_0x0fa2('0x77')])[_0x0fa2('0x6b')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x0fa2('0x6a'));_0x1858c3[_0x0fa2('0x78')]=_0x151c57||'Inbound';_0x1858c3=_[_0x0fa2('0x79')](_0x1858c3,getCustomFields(_0x454cca[_0x0fa2('0x7a')],_0x2dc2a5));return request({'method':_0x0fa2('0x29'),'uri':'https://www.zohoapis.'+_0x8d5b85+_0x0fa2('0x7b'),'headers':{'Authorization':_0x0fa2('0x33')+_0x4ae8ac},'body':{'data':[_0x1858c3]},'json':!![]})[_0x0fa2('0x34')](function(_0x552681){if(_0x552681&&_0x552681['data'][0x0]['code']==='SUCCESS'){logger[_0x0fa2('0x38')]('Call\x20created!');return{'id':_0x552681[_0x0fa2('0x40')][0x0][_0x0fa2('0x7c')]['id']};}})[_0x0fa2('0x30')](function(_0x2eeb2d){logger[_0x0fa2('0x38')]('err',_0x2eeb2d[_0x0fa2('0x7d')]);console[_0x0fa2('0x4a')]('err',_0x2eeb2d);});}exports['queue']=function(_0x1be0bb,_0x5216a0,_0x354d73,_0x2587db,_0xc029dd,_0x59aa28){var _0x2d0c01,_0x346f1c,_0x1c1306;_0x59aa28[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x59aa28[_0x0fa2('0x7e')]);_0x59aa28['serverUrl']=intUtil['stripTrailingSlash'](_0x59aa28[_0x0fa2('0x7f')]);if(_0xc029dd&&_0xc029dd['monitor_format']){logger[_0x0fa2('0x38')](_0x0fa2('0x80'),_0x0fa2('0x81'));_0x5216a0['recordingURL']=_0x59aa28[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x5216a0[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x5216a0[_0x0fa2('0x83')]);}else{_0x5216a0[_0x0fa2('0x85')]='';}var _0x1bfe9e=_0x59aa28[_0x0fa2('0x7e')]==='zoho.eu'?'eu':_0x0fa2('0x86');return getAccessToken(_0x59aa28)[_0x0fa2('0x34')](function(_0x514100){_0x1c1306=_0x514100;return getUser(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x2587db['email']);})[_0x0fa2('0x34')](function(_0x3a1db9){_0x2d0c01=_0x3a1db9;logger[_0x0fa2('0x38')](_0x0fa2('0x87'),_0x2d0c01['id']);return getEndUser(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x5216a0[_0x0fa2('0x88')],_0x5216a0[_0x0fa2('0x89')],_0x2d0c01,_0x354d73);})[_0x0fa2('0x34')](function(_0x1f2692){_0x346f1c=_0x1f2692;return getCall(_0x1c1306,_0x1bfe9e,_0x59aa28,_0x2d0c01,_0x346f1c,_0x354d73,_0x5216a0,_0x0fa2('0x8a'));})[_0x0fa2('0x34')](function(_0xd2140){if(_0xd2140){logger[_0x0fa2('0x38')](_0x0fa2('0x8b'),_0xd2140['id']);logger[_0x0fa2('0x38')](_0x0fa2('0x80'),_0x0fa2('0x8c'));emit(util['format'](_0x0fa2('0x8d'),_0x2587db[_0x0fa2('0x1e')]),'trigger:browser:url',{'uri':_0x0fa2('0x8e')+_0x59aa28[_0x0fa2('0x7e')]+_0x0fa2('0x8f')+_0xd2140['id']});}})[_0x0fa2('0x30')](function(_0x12327b){logger[_0x0fa2('0x3d')](_0x0fa2('0x80'),JSON[_0x0fa2('0x11')](_0x12327b));});};exports[_0x0fa2('0x76')]=function(_0x57d828,_0x1deea3,_0x561fc6,_0x5b82bd,_0x33b263,_0x58787e,_0x15d8a0){var _0x2088ca,_0x3dfc6f,_0x16e4dd;_0x58787e[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x58787e[_0x0fa2('0x7e')]);_0x58787e[_0x0fa2('0x7f')]=intUtil['stripTrailingSlash'](_0x58787e[_0x0fa2('0x7f')]);if(_0x15d8a0&&_0x15d8a0[_0x0fa2('0x90')]&&_0x15d8a0[_0x0fa2('0x90')]!==_0x0fa2('0x91')){logger['info'](_0x0fa2('0x92'),_0x0fa2('0x81'));_0x1deea3[_0x0fa2('0x85')]=_0x58787e[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x1deea3[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x1deea3[_0x0fa2('0x83')]);}var _0x5c19df=_0x58787e[_0x0fa2('0x7e')]===_0x0fa2('0x93')?'eu':_0x0fa2('0x86');return getAccessToken(_0x58787e)[_0x0fa2('0x34')](function(_0x44ddda){_0x16e4dd=_0x44ddda;return getUser(_0x16e4dd,_0x5c19df,_0x58787e,_0x5b82bd[_0x0fa2('0x94')]);})['then'](function(_0x110e02){_0x2088ca=_0x110e02;logger[_0x0fa2('0x38')]('The\x20User\x20ID\x20is:',_0x2088ca['id']);return getEndUser(_0x16e4dd,_0x5c19df,_0x58787e,_0x1deea3[_0x0fa2('0x95')],_0x1deea3['destcalleridnum'],_0x2088ca,_0x561fc6);})[_0x0fa2('0x34')](function(_0x444a48){_0x3dfc6f=_0x444a48;return getCall(_0x16e4dd,_0x5c19df,_0x58787e,_0x2088ca,_0x3dfc6f,_0x561fc6,_0x1deea3,_0x0fa2('0x96'));})[_0x0fa2('0x34')](function(_0x365081){if(_0x365081){logger['info'](_0x0fa2('0x8b'),_0x365081['id']);logger[_0x0fa2('0x38')](_0x0fa2('0x92'),_0x0fa2('0x8c'));emit(util[_0x0fa2('0x6b')]('user:%s',_0x5b82bd[_0x0fa2('0x1e')]),_0x0fa2('0x97'),{'uri':_0x0fa2('0x8e')+_0x58787e['host']+_0x0fa2('0x8f')+_0x365081['id']});}})[_0x0fa2('0x30')](function(_0x1f1e2d){logger[_0x0fa2('0x3d')](_0x0fa2('0x92'),JSON['stringify'](_0x1f1e2d));});};exports[_0x0fa2('0x98')]=function(_0x25e9a6,_0x381ecf,_0x1b6863,_0x515f3b,_0x56fcd6,_0x1b52d9){var _0x3afdaa,_0xef6995,_0x1f9d6c;_0x1b52d9[_0x0fa2('0x7e')]=intUtil['stripTrailingSlash'](_0x1b52d9[_0x0fa2('0x7e')]);_0x1b52d9['serverUrl']=intUtil[_0x0fa2('0x99')](_0x1b52d9[_0x0fa2('0x7f')]);if(_0x56fcd6&&_0x56fcd6[_0x0fa2('0x9a')]){logger['info']('['+_0x381ecf['lastevent'][_0x0fa2('0x9b')]()+']',_0x0fa2('0x81'));_0x381ecf[_0x0fa2('0x85')]=_0x1b52d9[_0x0fa2('0x7f')]+_0x0fa2('0x82')+_0x381ecf[_0x0fa2('0x83')]+_0x0fa2('0x84')+md5(_0x381ecf[_0x0fa2('0x83')]);}else{_0x381ecf[_0x0fa2('0x85')]='';}var _0xf8acbb=_0x1b52d9[_0x0fa2('0x7e')]===_0x0fa2('0x93')?'eu':_0x0fa2('0x86');return getAccessToken(_0x1b52d9)[_0x0fa2('0x34')](function(_0x5a4879){_0x1f9d6c=_0x5a4879;return getUser(_0x1f9d6c,_0xf8acbb,_0x1b52d9);})[_0x0fa2('0x34')](function(_0x39ab2c){_0x3afdaa=_0x39ab2c;logger[_0x0fa2('0x38')](_0x0fa2('0x87'),_0x3afdaa['id']);return getEndUser(_0x1f9d6c,_0xf8acbb,_0x1b52d9,_0x381ecf['calleridname'],_0x381ecf[_0x0fa2('0x89')],_0x3afdaa,_0x1b6863);})[_0x0fa2('0x34')](function(_0x29d984){_0xef6995=_0x29d984;return getCall(_0x1f9d6c,_0xf8acbb,_0x1b52d9,_0x3afdaa,_0xef6995,_0x1b6863,_0x381ecf,_0x0fa2('0x8a'));})[_0x0fa2('0x34')](function(_0x581aa0){if(_0x581aa0){logger['info']('The\x20Call\x20ID\x20is:',_0x581aa0['id']);}})[_0x0fa2('0x30')](function(_0x312cbb){logger[_0x0fa2('0x3d')]('['+_0x381ecf[_0x0fa2('0x9c')][_0x0fa2('0x9b')]()+']',JSON[_0x0fa2('0x11')](_0x312cbb));});}; \ No newline at end of file +var _0x5096=['Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','user','profile','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','moduleCreate','role','first_name','code','SUCCESS','details','startCase','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','connect','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','seconds','catch','error'];(function(_0x4eb3ec,_0x51b871){var _0x1a3de8=function(_0x179f80){while(--_0x179f80){_0x4eb3ec['push'](_0x4eb3ec['shift']());}};_0x1a3de8(++_0x51b871);}(_0x5096,0x6c));var _0x6509=function(_0x2b8388,_0x246b8f){_0x2b8388=_0x2b8388-0x0;var _0x3ba12a=_0x5096[_0x2b8388];return _0x3ba12a;};'use strict';var _=require(_0x6509('0x0'));var rp=require(_0x6509('0x1'));var md5=require(_0x6509('0x2'));var util=require(_0x6509('0x3'));var intUtil=require(_0x6509('0x4'));var moment=require('moment');var Redis=require(_0x6509('0x5'));var BPromise=require('bluebird');var config=require(_0x6509('0x6'));var logger=require(_0x6509('0x7'))(_0x6509('0x8'));config[_0x6509('0x9')]=_[_0x6509('0xa')](config[_0x6509('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x6509('0xb'))(new Redis(config[_0x6509('0x9')]));function emit(_0x4b67e8,_0x1d30be,_0xc614f1){io['to'](_0x4b67e8)[_0x6509('0xc')](_0x1d30be,_0xc614f1);}function request(_0x1ba1bd){logger[_0x6509('0xd')]('[HTTP]',JSON[_0x6509('0xe')](_0x1ba1bd));return rp(_0x1ba1bd);}function getCustomFields(_0x3e9667,_0x59620c){var _0x575c7e={};if(_0x3e9667[_0x6509('0xf')]>0x0){_[_0x6509('0x10')](_0x3e9667,function(_0x138db1){if(_[_0x6509('0x11')]([_0x6509('0x12'),_0x6509('0x13')],_0x138db1[_0x6509('0x14')])&&_0x138db1[_0x6509('0x15')]){_0x575c7e[_0x138db1[_0x6509('0x15')]]=_0x138db1[_0x6509('0x16')]['toString']();}else if(_0x138db1[_0x6509('0x14')]===_0x6509('0x17')&&_0x138db1[_0x6509('0x18')]&&_0x138db1['idField']&&_0x59620c[_0x138db1[_0x6509('0x18')]]){_0x575c7e[_0x138db1[_0x6509('0x15')]]=_0x59620c[_0x138db1[_0x6509('0x18')]][_0x6509('0x19')]();}else if(_0x138db1[_0x6509('0x14')]===_0x6509('0x1a')&&_0x138db1['Variable']&&_0x138db1[_0x6509('0x1b')][_0x6509('0x1c')]&&_0x138db1[_0x6509('0x15')]&&_0x59620c[_0x138db1['Variable']['name'][_0x6509('0x1d')]()]){_0x575c7e[_0x138db1[_0x6509('0x15')]]=_0x59620c[_0x138db1[_0x6509('0x1b')]['name'][_0x6509('0x1d')]()][_0x6509('0x19')]();}});}return _0x575c7e;}function getName(_0x506902){if(_0x506902[_0x6509('0x1e')]('\x20')>0x0){var _0x37398f=_0x506902[_0x6509('0x1f')](/ (.+)/);if(_0x37398f[0x1]){return _0x37398f;}}return[_0x506902,_0x506902];}var accountsTokens={};function getAccessToken(_0x5a582d){return new Promise(function(_0x6eb1e9,_0x476801){if(!_[_0x6509('0x20')](accountsTokens[_0x5a582d['id']])&&!_[_0x6509('0x20')](accountsTokens[_0x5a582d['id']][_0x6509('0x21')])){if(moment()[_0x6509('0x22')](accountsTokens[_0x5a582d['id']][_0x6509('0x23')])){_0x6eb1e9(accountsTokens[_0x5a582d['id']][_0x6509('0x21')]);}}var _0x5d373c;switch(_0x5a582d['zone']){case'US':_0x5d373c=_0x6509('0x24');break;case'AU':_0x5d373c=_0x6509('0x25');break;case'EU':_0x5d373c=_0x6509('0x26');break;case'IN':_0x5d373c=_0x6509('0x27');break;case'CN':_0x5d373c='https://accounts.zoho.com.cn';break;default:_0x5d373c=_0x6509('0x26');break;}var _0x32411e={'method':_0x6509('0x28'),'uri':_0x5d373c+_0x6509('0x29'),'qs':{'refresh_token':_0x5a582d[_0x6509('0x2a')],'client_id':_0x5a582d[_0x6509('0x2b')],'client_secret':_0x5a582d[_0x6509('0x2c')],'grant_type':_0x6509('0x2d')},'json':!![]};return rp(_0x32411e)['then'](function(_0x36294d){accountsTokens[_0x5a582d['id']]={'access_token':_0x36294d[_0x6509('0x21')],'expires_in':moment()[_0x6509('0x2e')](_0x36294d[_0x6509('0x23')],_0x6509('0x2f'))};_0x6eb1e9(_0x36294d[_0x6509('0x21')]);})[_0x6509('0x30')](function(_0x3977b3){logger[_0x6509('0x31')]('Failing\x20creating\x20the\x20access_token',_0x3977b3['stack']);_0x476801(_0x3977b3);});});}function getUser(_0x9f73bb,_0x2a7204,_0x492ed0,_0x4dce7d){logger['info'](_0x6509('0x32'));return request({'method':_0x6509('0x33'),'uri':util['format'](_0x6509('0x34'),_0x2a7204),'qs':{'type':_0x6509('0x35')},'headers':{'Authorization':_0x6509('0x36')+_0x9f73bb},'json':!![]})[_0x6509('0x37')](function(_0x287e79){if(_0x287e79[_0x6509('0x38')]){var _0x4256fc=-0x1;if(_[_0x6509('0x39')](_0x287e79['users'])){if(!_[_0x6509('0x20')](_0x4dce7d)){_0x4256fc=_[_0x6509('0x3a')](_0x287e79[_0x6509('0x38')],function(_0x3862da){return _0x3862da[_0x6509('0x3b')]===_0x4dce7d;});}if(_0x4256fc>=0x0){logger[_0x6509('0x3c')]('Agent\x20found!');}else{logger[_0x6509('0x3c')]('Using\x20the\x20admin\x20account!');_0x4256fc=_[_0x6509('0x3a')](_0x287e79[_0x6509('0x38')],function(_0xd30706){return _0xd30706['profile'][_0x6509('0x1c')]==='Administrator';});}return _0x287e79[_0x6509('0x38')][_0x4256fc];}else{if(_0x287e79[_0x6509('0x3d')][_0x6509('0x3e')]['name']===_0x6509('0x3f')){logger[_0x6509('0x3c')](_0x6509('0x40'));user=_0x287e79['user'];return user;}else{logger[_0x6509('0x31')](_0x6509('0x41'),JSON[_0x6509('0xe')](_0x287e79));throw new Error(_0x6509('0x42')+JSON[_0x6509('0xe')](_0x287e79));}}}else{logger[_0x6509('0x31')](_0x6509('0x41'),JSON[_0x6509('0xe')](_0x287e79));throw new Error(_0x6509('0x42')+JSON[_0x6509('0xe')](_0x287e79));}})[_0x6509('0x30')](function(_0x44e9c1){console[_0x6509('0x31')](_0x44e9c1);});}function getZohoUser(_0x5632a1,_0x326a58){return new BPromise(function(_0x30792e,_0x3abf35){request(_0x5632a1)[_0x6509('0x37')](function(_0x2060e7){var _0x4b672a=null;if(_0x2060e7){_0x4b672a=_0x2060e7[_0x6509('0x43')][0x0];_0x4b672a[_0x6509('0x44')]=_0x326a58;}_0x30792e(_0x4b672a);})[_0x6509('0x30')](function(_0x86f339){_0x3abf35(_0x86f339);});});}function createEndUser(_0x1c0f4c,_0x5f4dc,_0xcd56cb,_0x42777b,_0x3fff65,_0x35781b){var _0xcd56cb=getName(_0xcd56cb);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x5f4dc+'/crm/v2/'+_['startCase'](_0x35781b[_0x6509('0x45')])+'s','body':{'data':[{'Last_Name':_0xcd56cb[0x1],'First_Name':_0xcd56cb[0x0],'Phone':_0x42777b,'Owner':{'name':!_[_0x6509('0x20')](_0x3fff65[_0x6509('0x46')][_0x6509('0x1c')])?_0x3fff65[_0x6509('0x46')][_0x6509('0x1c')]:!_[_0x6509('0x20')](_0x3fff65[_0x6509('0x47')])?_0x3fff65['first_name']+'\x20'+_0x3fff65['last_name']:_0x3fff65['last_name'],'id':_0x3fff65['id']}}]},'headers':{'Authorization':_0x6509('0x36')+_0x1c0f4c},'json':!![]})[_0x6509('0x37')](function(_0x5ceff4){if(_0x5ceff4&&_0x5ceff4['data'][0x0][_0x6509('0x48')]===_0x6509('0x49')){var _0xe7ccdf=_0x5ceff4['data'][0x0][_0x6509('0x4a')];_0xe7ccdf[_0x6509('0x44')]=_[_0x6509('0x4b')](_0x35781b['moduleCreate'])+'s';return _0xe7ccdf;}logger[_0x6509('0x31')](_0x6509('0x41'),JSON[_0x6509('0xe')](data));throw new Error('Error:\x20'+JSON[_0x6509('0xe')](data));})[_0x6509('0x30')](function(_0x431859){console[_0x6509('0x4c')]('CREATE\x20ERROR',_0x431859);});}function getEndUser(_0x2df016,_0x150a89,_0x1ebc31,_0x35b876,_0x306a95,_0x170c70,_0x5e4ca8){var _0x157275={'method':_0x6509('0x33'),'uri':'','headers':{'Authorization':_0x6509('0x36')+_0x2df016},'json':!![]};switch(_0x5e4ca8[_0x6509('0x4d')]){case _0x6509('0x4e'):_0x157275[_0x6509('0x4f')]='https://www.zohoapis.'+_0x150a89+_0x6509('0x50')+_0x306a95+'))';return getZohoUser(_0x157275,_0x6509('0x51'))[_0x6509('0x37')](function(_0x49e9ae){if(_0x49e9ae)return _0x49e9ae;_0x157275[_0x6509('0x4f')]=_0x6509('0x52')+_0x150a89+_0x6509('0x53')+_0x306a95+'))';return getZohoUser(_0x157275,_0x6509('0x54'))[_0x6509('0x37')](function(_0x272d6c){if(_0x272d6c)return _0x272d6c;if(_0x5e4ca8[_0x6509('0x45')]!=_0x6509('0x55')){return createEndUser(_0x2df016,_0x150a89,_0x35b876,_0x306a95,_0x170c70,_0x5e4ca8);}else{return{};}});});break;case _0x6509('0x56'):_0x157275[_0x6509('0x4f')]=_0x6509('0x52')+_0x150a89+_0x6509('0x50')+_0x306a95+'))';return getZohoUser(_0x157275,_0x6509('0x51'))['then'](function(_0x18b9aa){if(_0x18b9aa)return _0x18b9aa;if(_0x5e4ca8[_0x6509('0x45')]!=_0x6509('0x55')){return createEndUser(_0x2df016,_0x150a89,_0x35b876,_0x306a95,_0x170c70,_0x5e4ca8);}else{return{};}});break;case _0x6509('0x57'):_0x157275[_0x6509('0x4f')]=_0x6509('0x52')+_0x150a89+_0x6509('0x53')+_0x306a95+'))';return getZohoUser(_0x157275,'Leads')[_0x6509('0x37')](function(_0x1cc12b){if(_0x1cc12b)return _0x1cc12b;if(_0x5e4ca8[_0x6509('0x45')]!='nothing'){return createEndUser(_0x2df016,_0x150a89,_0x35b876,_0x306a95,_0x170c70,_0x5e4ca8);}else{return{};}});break;}}function getCall(_0x578023,_0x127e30,_0x6ed684,_0x44f2c0,_0x24c6ee,_0x37dee4,_0x412a55,_0x1e8bb0){logger[_0x6509('0x3c')](_0x6509('0x58'));var _0x575fe8={};_0x575fe8[_0x6509('0x59')]={'name':!_[_0x6509('0x20')](_0x44f2c0[_0x6509('0x46')]['name'])&&!_[_0x6509('0x20')](_0x44f2c0[_0x6509('0x3e')][_0x6509('0x1c')])&&_0x44f2c0[_0x6509('0x3e')][_0x6509('0x1c')]===_0x6509('0x5a')?_0x44f2c0[_0x6509('0x46')][_0x6509('0x1c')]:!_['isNil'](_0x44f2c0[_0x6509('0x47')])?_0x44f2c0[_0x6509('0x47')]+'\x20'+_0x44f2c0[_0x6509('0x5b')]:_0x44f2c0[_0x6509('0x5b')],'id':_0x44f2c0['id']};_0x575fe8[_0x6509('0x5c')]=intUtil[_0x6509('0x5d')](_0x37dee4[_0x6509('0x5e')],_0x412a55,'\x20');_0x575fe8[_0x6509('0x5f')]=intUtil[_0x6509('0x5d')](_0x37dee4[_0x6509('0x60')],_0x412a55,'\x0a');if(_0x24c6ee[_0x6509('0x44')]==='Contacts'){_0x575fe8[_0x6509('0x61')]={'name':!_['isNil'](_0x24c6ee['Full_Name'])?_0x24c6ee['Full_Name']:!_[_0x6509('0x20')](_0x24c6ee[_0x6509('0x62')])?_0x24c6ee[_0x6509('0x62')]+'\x20'+_0x24c6ee[_0x6509('0x63')]:_0x24c6ee[_0x6509('0x63')],'id':_0x24c6ee['id']};}if(_0x24c6ee['enduserType']===_0x6509('0x54')){_0x575fe8[_0x6509('0x64')]={'name':!_['isNil'](_0x24c6ee['Full_Name'])?_0x24c6ee[_0x6509('0x65')]:!_[_0x6509('0x20')](_0x24c6ee[_0x6509('0x62')])?_0x24c6ee[_0x6509('0x62')]+'\x20'+_0x24c6ee[_0x6509('0x63')]:_0x24c6ee[_0x6509('0x63')],'id':_0x24c6ee['id']};_0x575fe8[_0x6509('0x66')]=_[_0x6509('0x4b')](_0x24c6ee[_0x6509('0x44')]);}if(_0x412a55['talktime']){_0x575fe8[_0x6509('0x67')]=moment[_0x6509('0x68')](parseInt(_0x412a55['talktime'])*0x3e8)[_0x6509('0x69')](_0x6509('0x6a'));}else if(_0x412a55[_0x6509('0x6b')]&&_0x412a55[_0x6509('0x6c')]){_0x575fe8[_0x6509('0x67')]=moment[_0x6509('0x68')](moment(_0x412a55[_0x6509('0x6c')],_0x6509('0x6d'))[_0x6509('0x6e')](moment(_0x412a55['starttime'],_0x6509('0x6d'))))[_0x6509('0x69')]('mm:ss');}switch(_0x412a55[_0x6509('0x6f')]){case'called':_0x575fe8[_0x6509('0x70')]=_0x6509('0x71');break;case'complete':case _0x6509('0x72'):_0x575fe8[_0x6509('0x70')]='Answered';break;case'rejected':_0x575fe8[_0x6509('0x70')]=_0x6509('0x73');break;case'abandoned':_0x575fe8[_0x6509('0x70')]=_0x6509('0x74');break;case _0x6509('0x75'):_0x575fe8[_0x6509('0x70')]=_0x6509('0x76');default:}_0x575fe8[_0x6509('0x77')]=(_0x1e8bb0===_0x6509('0x78')?moment(_0x412a55[_0x6509('0x79')])[_0x6509('0x69')](_0x6509('0x6d')):moment(_0x412a55[_0x6509('0x7a')])[_0x6509('0x69')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x6509('0x69')](_0x6509('0x6d'));_0x575fe8[_0x6509('0x7b')]=_0x1e8bb0||_0x6509('0x7c');_0x575fe8=_[_0x6509('0x7d')](_0x575fe8,getCustomFields(_0x37dee4['Fields'],_0x412a55));return request({'method':_0x6509('0x28'),'uri':_0x6509('0x52')+_0x127e30+_0x6509('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x578023},'body':{'data':[_0x575fe8]},'json':!![]})[_0x6509('0x37')](function(_0x5659ca){if(_0x5659ca&&_0x5659ca['data'][0x0]['code']===_0x6509('0x49')){logger[_0x6509('0x3c')](_0x6509('0x7f'));return{'id':_0x5659ca[_0x6509('0x43')][0x0]['details']['id']};}})['catch'](function(_0x430f76){logger[_0x6509('0x3c')](_0x6509('0x80'),_0x430f76[_0x6509('0x81')]);console[_0x6509('0x4c')]('err',_0x430f76);});}exports[_0x6509('0x82')]=function(_0x3c8e53,_0x2a10e1,_0x278b2c,_0x23effc,_0x1000d5,_0x4991ae){var _0x3e6d2d,_0x1a7bcc,_0xda3f29;_0x4991ae[_0x6509('0x83')]=intUtil[_0x6509('0x84')](_0x4991ae['host']);_0x4991ae[_0x6509('0x85')]=intUtil['stripTrailingSlash'](_0x4991ae[_0x6509('0x85')]);if(_0x1000d5&&_0x1000d5[_0x6509('0x86')]){logger['info'](_0x6509('0x87'),_0x6509('0x88'));_0x2a10e1[_0x6509('0x89')]=_0x4991ae[_0x6509('0x85')]+'/api/voice/recordings/'+_0x2a10e1[_0x6509('0x8a')]+_0x6509('0x8b')+md5(_0x2a10e1[_0x6509('0x8a')]);}else{_0x2a10e1['recordingURL']='';}var _0x3e348a=_0x4991ae[_0x6509('0x83')]===_0x6509('0x8c')?'eu':_0x6509('0x8d');return getAccessToken(_0x4991ae)['then'](function(_0x2c41c7){_0xda3f29=_0x2c41c7;return getUser(_0xda3f29,_0x3e348a,_0x4991ae,_0x23effc[_0x6509('0x3b')]);})['then'](function(_0x34ca08){_0x3e6d2d=_0x34ca08;logger[_0x6509('0x3c')](_0x6509('0x8e'),_0x3e6d2d['id']);return getEndUser(_0xda3f29,_0x3e348a,_0x4991ae,_0x2a10e1[_0x6509('0x8f')],_0x2a10e1[_0x6509('0x90')],_0x3e6d2d,_0x278b2c);})[_0x6509('0x37')](function(_0x3841f4){_0x1a7bcc=_0x3841f4;return getCall(_0xda3f29,_0x3e348a,_0x4991ae,_0x3e6d2d,_0x1a7bcc,_0x278b2c,_0x2a10e1,_0x6509('0x7c'));})['then'](function(_0x4c483a){if(_0x4c483a){logger[_0x6509('0x3c')]('The\x20Call\x20ID\x20is:',_0x4c483a['id']);logger[_0x6509('0x3c')](_0x6509('0x87'),_0x6509('0x91'));emit(util[_0x6509('0x69')]('user:%s',_0x23effc['name']),_0x6509('0x92'),{'uri':_0x6509('0x93')+_0x4991ae['host']+_0x6509('0x94')+_0x4c483a['id']});}})[_0x6509('0x30')](function(_0x5b9d44){logger[_0x6509('0x31')](_0x6509('0x87'),JSON[_0x6509('0xe')](_0x5b9d44));});};exports[_0x6509('0x78')]=function(_0x1819bb,_0x553f0f,_0x4fca10,_0x203f49,_0x2a7f10,_0x2a4fe2,_0x6c0314){var _0x28b1f9,_0x42fc45,_0x2fa808;_0x2a4fe2['host']=intUtil[_0x6509('0x84')](_0x2a4fe2[_0x6509('0x83')]);_0x2a4fe2[_0x6509('0x85')]=intUtil[_0x6509('0x84')](_0x2a4fe2[_0x6509('0x85')]);if(_0x6c0314&&_0x6c0314[_0x6509('0x95')]&&_0x6c0314[_0x6509('0x95')]!==_0x6509('0x96')){logger['info'](_0x6509('0x97'),'Recording\x20is\x20enabled!');_0x553f0f['recordingURL']=_0x2a4fe2[_0x6509('0x85')]+_0x6509('0x98')+_0x553f0f[_0x6509('0x8a')]+_0x6509('0x8b')+md5(_0x553f0f[_0x6509('0x8a')]);}var _0x7f0a1e=_0x2a4fe2[_0x6509('0x83')]===_0x6509('0x8c')?'eu':_0x6509('0x8d');return getAccessToken(_0x2a4fe2)[_0x6509('0x37')](function(_0x2fe253){_0x2fa808=_0x2fe253;return getUser(_0x2fa808,_0x7f0a1e,_0x2a4fe2,_0x203f49[_0x6509('0x3b')]);})[_0x6509('0x37')](function(_0x5bd3d8){_0x28b1f9=_0x5bd3d8;logger['info'](_0x6509('0x8e'),_0x28b1f9['id']);return getEndUser(_0x2fa808,_0x7f0a1e,_0x2a4fe2,_0x553f0f[_0x6509('0x99')],_0x553f0f['destcalleridnum'],_0x28b1f9,_0x4fca10);})[_0x6509('0x37')](function(_0x520e76){_0x42fc45=_0x520e76;return getCall(_0x2fa808,_0x7f0a1e,_0x2a4fe2,_0x28b1f9,_0x42fc45,_0x4fca10,_0x553f0f,_0x6509('0x9a'));})[_0x6509('0x37')](function(_0x58c850){if(_0x58c850){logger[_0x6509('0x3c')](_0x6509('0x9b'),_0x58c850['id']);logger[_0x6509('0x3c')]('[OUTBOUND]',_0x6509('0x91'));emit(util['format']('user:%s',_0x203f49[_0x6509('0x1c')]),_0x6509('0x92'),{'uri':_0x6509('0x93')+_0x2a4fe2[_0x6509('0x83')]+_0x6509('0x94')+_0x58c850['id']});}})[_0x6509('0x30')](function(_0x4adb10){logger['error'](_0x6509('0x97'),JSON['stringify'](_0x4adb10));});};exports[_0x6509('0x9c')]=function(_0x257d3c,_0x39061a,_0x90df83,_0x1c9d72,_0x5ebe0e,_0x8424de){var _0x3f0b4c,_0x280da7,_0x2addd2;_0x8424de['host']=intUtil[_0x6509('0x84')](_0x8424de['host']);_0x8424de['serverUrl']=intUtil[_0x6509('0x84')](_0x8424de[_0x6509('0x85')]);if(_0x5ebe0e&&_0x5ebe0e[_0x6509('0x86')]){logger['info']('['+_0x39061a[_0x6509('0x6f')]['toUpperCase']()+']',_0x6509('0x88'));_0x39061a[_0x6509('0x89')]=_0x8424de[_0x6509('0x85')]+_0x6509('0x98')+_0x39061a[_0x6509('0x8a')]+_0x6509('0x8b')+md5(_0x39061a[_0x6509('0x8a')]);}else{_0x39061a[_0x6509('0x89')]='';}var _0x5940f7=_0x8424de[_0x6509('0x83')]===_0x6509('0x8c')?'eu':_0x6509('0x8d');return getAccessToken(_0x8424de)[_0x6509('0x37')](function(_0x39d6b8){_0x2addd2=_0x39d6b8;return getUser(_0x2addd2,_0x5940f7,_0x8424de);})[_0x6509('0x37')](function(_0x3c8d87){_0x3f0b4c=_0x3c8d87;logger['info']('The\x20User\x20ID\x20is:',_0x3f0b4c['id']);return getEndUser(_0x2addd2,_0x5940f7,_0x8424de,_0x39061a[_0x6509('0x8f')],_0x39061a[_0x6509('0x90')],_0x3f0b4c,_0x90df83);})[_0x6509('0x37')](function(_0x5ceb9b){_0x280da7=_0x5ceb9b;return getCall(_0x2addd2,_0x5940f7,_0x8424de,_0x3f0b4c,_0x280da7,_0x90df83,_0x39061a,_0x6509('0x7c'));})[_0x6509('0x37')](function(_0x2cb5aa){if(_0x2cb5aa){logger[_0x6509('0x3c')](_0x6509('0x9b'),_0x2cb5aa['id']);}})[_0x6509('0x30')](function(_0x1d09fb){logger[_0x6509('0x31')]('['+_0x39061a['lastevent'][_0x6509('0x9d')]()+']',JSON[_0x6509('0xe')](_0x1d09fb));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 522cfc4..73678eb 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72d9=['util','shelljs','mustache','../../../../config/logger','exec','data2','Script','render','data3','error','format','info'];(function(_0xa0b573,_0x10cf71){var _0x511bb8=function(_0x181672){while(--_0x181672){_0xa0b573['push'](_0xa0b573['shift']());}};_0x511bb8(++_0x10cf71);}(_0x72d9,0x144));var _0x972d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x72d9[_0x4c12ec];return _0x3ae42c;};'use strict';var util=require(_0x972d('0x0'));var sh=require(_0x972d('0x1'));var Mustache=require(_0x972d('0x2'));var logger=require(_0x972d('0x3'))('trigger');exports[_0x972d('0x4')]=function(_0x493d95,_0x28911f){var _0x536daa=_0x493d95[_0x972d('0x5')]?_0x493d95['data2']:_0x972d('0x6');var _0x348e71=_0x493d95['data3']?Mustache[_0x972d('0x7')](_0x493d95[_0x972d('0x8')],_0x28911f):_0x28911f;sh['exec'](_0x348e71,function(_0x32341f,_0x554561,_0x21f3cf){if(_0x32341f!==0x0){logger[_0x972d('0x9')](util[_0x972d('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x536daa,_0x348e71,_0x32341f,_0x21f3cf));}else{logger[_0x972d('0xb')](util[_0x972d('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x536daa,_0x348e71,_0x554561));}});}; \ No newline at end of file +var _0xdf11=['Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2'];(function(_0x5dc841,_0x8c806b){var _0x4ccf39=function(_0x17d15c){while(--_0x17d15c){_0x5dc841['push'](_0x5dc841['shift']());}};_0x4ccf39(++_0x8c806b);}(_0xdf11,0x14c));var _0x1df1=function(_0x37e4ae,_0x34b0df){_0x37e4ae=_0x37e4ae-0x0;var _0x2e58c2=_0xdf11[_0x37e4ae];return _0x2e58c2;};'use strict';var util=require(_0x1df1('0x0'));var sh=require(_0x1df1('0x1'));var Mustache=require(_0x1df1('0x2'));var logger=require(_0x1df1('0x3'))('trigger');exports[_0x1df1('0x4')]=function(_0x11bd2d,_0x4f988a){var _0x3561a3=_0x11bd2d[_0x1df1('0x5')]?_0x11bd2d['data2']:_0x1df1('0x6');var _0x40be14=_0x11bd2d[_0x1df1('0x7')]?Mustache[_0x1df1('0x8')](_0x11bd2d[_0x1df1('0x7')],_0x4f988a):_0x4f988a;sh['exec'](_0x40be14,function(_0x533a56,_0x3cdf86,_0x317cd8){if(_0x533a56!==0x0){logger[_0x1df1('0x9')](util[_0x1df1('0xa')](_0x1df1('0xb'),_0x3561a3,_0x40be14,_0x533a56,_0x317cd8));}else{logger['info'](util[_0x1df1('0xa')](_0x1df1('0xc'),_0x3561a3,_0x40be14,_0x3cdf86));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index c24ff08..a75978e 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8902=['request-promise','util','trigger','exec','data1','toUpperCase','data5','headers','data6','parse','stack','GET','POST','PUT','data7','render','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8902,0xd9));var _0x2890=function(_0x323a7b,_0x4c1f83){_0x323a7b=_0x323a7b-0x0;var _0x442d03=_0x8902[_0x323a7b];return _0x442d03;};'use strict';var rp=require(_0x2890('0x0'));var util=require(_0x2890('0x1'));var _=require('lodash');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x2890('0x2'));exports[_0x2890('0x3')]=function(_0x322091,_0x2b1375){var _0x23e36b,_0x44f5c8;var _0x13c3e4={'method':_0x322091[_0x2890('0x4')][_0x2890('0x5')](),'uri':Mustache['render'](_0x322091['data2'],_0x2b1375),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x322091[_0x2890('0x6')])==='number'&&parseInt(_0x322091[_0x2890('0x6')])>=0x1&&parseInt(_0x322091[_0x2890('0x6')])<=0xa?parseInt(_0x322091[_0x2890('0x6')])*0x3e8:0x5*0x3e8};try{_0x13c3e4[_0x2890('0x7')]=_0x322091[_0x2890('0x8')]?JSON[_0x2890('0x9')](Mustache['render'](_0x322091[_0x2890('0x8')],_0x2b1375)):{};}catch(_0x143449){logger['error'](_0x143449[_0x2890('0xa')]);}switch(_0x322091[_0x2890('0x4')][_0x2890('0x5')]()){case _0x2890('0xb'):case'DELETE':_0x23e36b=null;_0x13c3e4['qs']=_0x2b1375;break;case _0x2890('0xc'):case _0x2890('0xd'):if(_0x322091[_0x2890('0xe')]){try{_0x23e36b=JSON[_0x2890('0x9')](Mustache[_0x2890('0xf')](_0x322091[_0x2890('0xe')],_0x2b1375));_0x13c3e4[_0x2890('0x10')]=_0x23e36b;}catch(_0x3ef3d8){logger['error'](_0x3ef3d8[_0x2890('0xa')]);logger[_0x2890('0x11')](_0x2890('0x12'));}}else{_0x23e36b=_0x2b1375;_0x13c3e4[_0x2890('0x10')]=_0x23e36b;}break;}logger['info'](util[_0x2890('0x13')](_0x2890('0x14'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],JSON['stringify'](_0x13c3e4)));rp(_0x13c3e4)['then'](function(_0x1f3e0f){_0x23e36b=!_[_0x2890('0x16')](_0x23e36b)?_0x2890('0x17')+_0x23e36b:'';_0x44f5c8=typeof _0x1f3e0f[_0x2890('0x10')]===_0x2890('0x18')?JSON[_0x2890('0x19')](_0x1f3e0f[_0x2890('0x10')]):_0x1f3e0f[_0x2890('0x10')];logger[_0x2890('0x1a')](util[_0x2890('0x13')](_0x2890('0x1b'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],_0x1f3e0f['statusCode'],_0x44f5c8));})['catch'](function(_0x228be8){logger['error'](util[_0x2890('0x13')](_0x2890('0x1c'),_0x322091[_0x2890('0x4')],_0x322091[_0x2890('0x15')],_0x228be8[_0x2890('0x1d')],_0x228be8['name'],_0x228be8[_0x2890('0x1e')]));});}; \ No newline at end of file +var _0x1aeb=['stack','GET','POST','PUT','data7','parse','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','body','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6'];(function(_0x474a14,_0x1b9db7){var _0x13c5b4=function(_0x315c76){while(--_0x315c76){_0x474a14['push'](_0x474a14['shift']());}};_0x13c5b4(++_0x1b9db7);}(_0x1aeb,0x188));var _0xb1ae=function(_0x177e8e,_0x2cd14a){_0x177e8e=_0x177e8e-0x0;var _0x46ea60=_0x1aeb[_0x177e8e];return _0x46ea60;};'use strict';var rp=require(_0xb1ae('0x0'));var util=require(_0xb1ae('0x1'));var _=require(_0xb1ae('0x2'));var Mustache=require(_0xb1ae('0x3'));var logger=require(_0xb1ae('0x4'))(_0xb1ae('0x5'));exports[_0xb1ae('0x6')]=function(_0x5a2c6c,_0xf1a17){var _0x4ff8e3,_0x27dda3;var _0x42e01c={'method':_0x5a2c6c[_0xb1ae('0x7')][_0xb1ae('0x8')](),'uri':Mustache[_0xb1ae('0x9')](_0x5a2c6c[_0xb1ae('0xa')],_0xf1a17),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5a2c6c[_0xb1ae('0xb')])===_0xb1ae('0xc')&&parseInt(_0x5a2c6c['data5'])>=0x1&&parseInt(_0x5a2c6c[_0xb1ae('0xb')])<=0xa?parseInt(_0x5a2c6c['data5'])*0x3e8:0x5*0x3e8};try{_0x42e01c[_0xb1ae('0xd')]=_0x5a2c6c['data6']?JSON['parse'](Mustache[_0xb1ae('0x9')](_0x5a2c6c[_0xb1ae('0xe')],_0xf1a17)):{};}catch(_0x3356dd){logger['error'](_0x3356dd[_0xb1ae('0xf')]);}switch(_0x5a2c6c[_0xb1ae('0x7')][_0xb1ae('0x8')]()){case _0xb1ae('0x10'):case'DELETE':_0x4ff8e3=null;_0x42e01c['qs']=_0xf1a17;break;case _0xb1ae('0x11'):case _0xb1ae('0x12'):if(_0x5a2c6c[_0xb1ae('0x13')]){try{_0x4ff8e3=JSON[_0xb1ae('0x14')](Mustache[_0xb1ae('0x9')](_0x5a2c6c['data7'],_0xf1a17));_0x42e01c['body']=_0x4ff8e3;}catch(_0x41fae7){logger[_0xb1ae('0x15')](_0x41fae7[_0xb1ae('0xf')]);logger['error'](_0xb1ae('0x16'));}}else{_0x4ff8e3=_0xf1a17;_0x42e01c['body']=_0x4ff8e3;}break;}logger[_0xb1ae('0x17')](util[_0xb1ae('0x18')](_0xb1ae('0x19'),_0x5a2c6c[_0xb1ae('0x7')],_0x5a2c6c[_0xb1ae('0xa')],JSON[_0xb1ae('0x1a')](_0x42e01c)));rp(_0x42e01c)[_0xb1ae('0x1b')](function(_0x2fc8d7){_0x4ff8e3=!_[_0xb1ae('0x1c')](_0x4ff8e3)?_0xb1ae('0x1d')+_0x4ff8e3:'';_0x27dda3=typeof _0x2fc8d7[_0xb1ae('0x1e')]==='object'?JSON[_0xb1ae('0x1a')](_0x2fc8d7['body']):_0x2fc8d7[_0xb1ae('0x1e')];logger[_0xb1ae('0x17')](util[_0xb1ae('0x18')](_0xb1ae('0x1f'),_0x5a2c6c['data1'],_0x5a2c6c[_0xb1ae('0xa')],_0x2fc8d7[_0xb1ae('0x20')],_0x27dda3));})[_0xb1ae('0x21')](function(_0x5f5a3a){logger[_0xb1ae('0x15')](util['format'](_0xb1ae('0x22'),_0x5a2c6c[_0xb1ae('0x7')],_0x5a2c6c[_0xb1ae('0xa')],_0x5f5a3a[_0xb1ae('0x20')],_0x5f5a3a[_0xb1ae('0x23')],_0x5f5a3a[_0xb1ae('0x24')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 8b77ce0..6a5ba8c 100644 --- a/server/services/email/client.js +++ b/server/services/email/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x96cc=['message','result','catch','exports','jayson/promise','../../config/logger','client','Request','request','then','debug','routing','error','rpc'];(function(_0x2511cd,_0x540090){var _0x31ba26=function(_0x1f9896){while(--_0x1f9896){_0x2511cd['push'](_0x2511cd['shift']());}};_0x31ba26(++_0x540090);}(_0x96cc,0x1e0));var _0xc96c=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0x96cc[_0x4d578c];return _0xf41cac;};'use strict';var jayson=require(_0xc96c('0x0'));var BPromise=require('bluebird');var logger=require(_0xc96c('0x1'))('routing');var client=jayson[_0xc96c('0x2')]['http']({'port':0x2329});client[_0xc96c('0x3')]=function(_0x2e0f57,_0x44f7d7){return new BPromise(function(_0x223913,_0x310dda){return client[_0xc96c('0x4')](_0x2e0f57,_0x44f7d7)[_0xc96c('0x5')](function(_0x2bf955){logger[_0xc96c('0x6')]('rpc',_0xc96c('0x7'),_0x2e0f57,_0x44f7d7,_0x2bf955);if(_0x2bf955[_0xc96c('0x8')]){logger[_0xc96c('0x8')](_0xc96c('0x9'),'routing',_0x2e0f57,_0x2bf955['error'][_0xc96c('0xa')],_0x44f7d7);return _0x310dda(_0x2bf955[_0xc96c('0x8')]['message']);}else{return _0x223913(_0x2bf955[_0xc96c('0xb')]);}})[_0xc96c('0xc')](function(_0x147cc8){logger['error']('rpc',_0xc96c('0x7'),_0x2e0f57,_0x147cc8,_0x44f7d7);return _0x310dda(_0x147cc8);});});};module[_0xc96c('0xd')]=client; \ No newline at end of file +var _0x83b9=['error','routing','message','result','catch','jayson/promise','bluebird','../../config/logger','http','Request','request','then','debug','rpc'];(function(_0x2421b0,_0x27a599){var _0x5c3647=function(_0x4027d9){while(--_0x4027d9){_0x2421b0['push'](_0x2421b0['shift']());}};_0x5c3647(++_0x27a599);}(_0x83b9,0x101));var _0x983b=function(_0x37d96d,_0x57b892){_0x37d96d=_0x37d96d-0x0;var _0x4736e8=_0x83b9[_0x37d96d];return _0x4736e8;};'use strict';var jayson=require(_0x983b('0x0'));var BPromise=require(_0x983b('0x1'));var logger=require(_0x983b('0x2'))('routing');var client=jayson['client'][_0x983b('0x3')]({'port':0x2329});client[_0x983b('0x4')]=function(_0x555164,_0x3f3e6c){return new BPromise(function(_0x93ca56,_0x4f97a1){return client[_0x983b('0x5')](_0x555164,_0x3f3e6c)[_0x983b('0x6')](function(_0x8425cb){logger[_0x983b('0x7')](_0x983b('0x8'),'routing',_0x555164,_0x3f3e6c,_0x8425cb);if(_0x8425cb[_0x983b('0x9')]){logger[_0x983b('0x9')](_0x983b('0x8'),_0x983b('0xa'),_0x555164,_0x8425cb[_0x983b('0x9')][_0x983b('0xb')],_0x3f3e6c);return _0x4f97a1(_0x8425cb['error'][_0x983b('0xb')]);}else{return _0x93ca56(_0x8425cb[_0x983b('0xc')]);}})[_0x983b('0xd')](function(_0x2e0790){logger[_0x983b('0x9')](_0x983b('0x8'),_0x983b('0xa'),_0x555164,_0x2e0790,_0x3f3e6c);return _0x4f97a1(_0x2e0790);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 09fffad..f7cd522 100644 --- a/server/services/email/index.js +++ b/server/services/email/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a59=['initMailAccounts','refresh','listen','loginMailFrequency','catch','error','./server','./realtime','./lib/email','../../config/logger','email','resolve','then'];(function(_0x3162fc,_0x4036f8){var _0x343423=function(_0x500d9b){while(--_0x500d9b){_0x3162fc['push'](_0x3162fc['shift']());}};_0x343423(++_0x4036f8);}(_0x4a59,0x14b));var _0x94a5=function(_0x4eab4b,_0x152d5b){_0x4eab4b=_0x4eab4b-0x0;var _0x576b6d=_0x4a59[_0x4eab4b];return _0x576b6d;};'use strict';var server=require(_0x94a5('0x0'));var Realtime=require(_0x94a5('0x1'));var EmailChannel=require(_0x94a5('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0x94a5('0x3'))(_0x94a5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x94a5('0x5')]()[_0x94a5('0x6')](mailAccount['getMailAccounts']())[_0x94a5('0x6')](realtime[_0x94a5('0x7')]())[_0x94a5('0x6')](function(){email[_0x94a5('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x94a5('0x9')](realtime,email)[_0x94a5('0x6')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x94a5('0x6')](function(_0x4342ca){return setInterval(initRealtime,_0x4342ca[_0x94a5('0xa')]*0x3e8);})[_0x94a5('0xb')](function(_0x2f9e43){logger[_0x94a5('0xc')]('Email\x20service\x20initialization',_0x2f9e43);});}main(); \ No newline at end of file +var _0x42ff=['error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/setting','../../config/logger','then','initMailAccounts','mailAccounts','getSettings','catch'];(function(_0x353856,_0x5ce89d){var _0xa58048=function(_0x2cc6a9){while(--_0x2cc6a9){_0x353856['push'](_0x353856['shift']());}};_0xa58048(++_0x5ce89d);}(_0x42ff,0x10a));var _0xf42f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x42ff[_0x3e5086];return _0xfeb102;};'use strict';var server=require('./server');var Realtime=require(_0xf42f('0x0'));var EmailChannel=require(_0xf42f('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xf42f('0x2'));var logger=require(_0xf42f('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xf42f('0x4')](mailAccount['getMailAccounts']())[_0xf42f('0x4')](realtime[_0xf42f('0x5')]())[_0xf42f('0x4')](function(){email['refresh'](realtime[_0xf42f('0x6')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xf42f('0x4')](function(){return setting[_0xf42f('0x7')]();})['then'](function(_0x51419c){return setInterval(initRealtime,_0x51419c['loginMailFrequency']*0x3e8);})[_0xf42f('0x8')](function(_0x47b7be){logger[_0xf42f('0x9')](_0xf42f('0xa'),_0x47b7be);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index c151ac8..c9d3d7e 100644 --- a/server/services/email/lib/email.js +++ b/server/services/email/lib/email.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb74=['Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','connected','messages','firstName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send'];(function(_0x2d03b1,_0x4ab3bc){var _0x2841bc=function(_0x52a193){while(--_0x52a193){_0x2d03b1['push'](_0x2d03b1['shift']());}};_0x2841bc(++_0x4ab3bc);}(_0xdb74,0x193));var _0x4db7=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xdb74[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x4db7('0x0'));var moment=require(_0x4db7('0x1'));var BPromise=require('bluebird');var md5=require(_0x4db7('0x2'));var Redis=require(_0x4db7('0x3'));var config=require(_0x4db7('0x4'));var logger=require(_0x4db7('0x5'))(_0x4db7('0x6'));config[_0x4db7('0x7')]=_[_0x4db7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4db7('0x9'))(new Redis(config[_0x4db7('0x7')]));var EmailImap=require(_0x4db7('0xa'));var EmailSmtp=require(_0x4db7('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x26132b){logger['info']('start\x20email\x20channel');this[_0x4db7('0xc')]=_0x26132b[_0x4db7('0xc')];this[_0x4db7('0xd')]={};this[_0x4db7('0xe')]=new EmailSmtp();}EmailChannel[_0x4db7('0xf')][_0x4db7('0x10')]=function(_0x5e4383){var _0x295d6f=this[_0x4db7('0xc')][_0x5e4383];var _0xcea444={'id':_0x295d6f['id'],'name':_0x295d6f[_0x4db7('0x11')],'key':_0x295d6f[_0x4db7('0x12')],'active':_0x295d6f['active'],'Imap':{'status':_0x295d6f[_0x4db7('0x13')][_0x4db7('0x14')],'messageStatus':_0x295d6f[_0x4db7('0x13')][_0x4db7('0x15')],'total':_0x295d6f['Imap'][_0x4db7('0x16')]}};if(_[_0x4db7('0x17')](md5Accounts[_0x5e4383])){md5Accounts[_0x5e4383]={};}var _0x18c061=md5(JSON[_0x4db7('0x18')](_0xcea444));if(md5Accounts[_0x5e4383]['md5']!==_0x18c061){md5Accounts[_0x5e4383][_0x4db7('0x2')]=_0x18c061;io[_0x4db7('0x10')](_0x4db7('0x19'),_0xcea444);}};EmailChannel[_0x4db7('0xf')][_0x4db7('0x1a')]=function(_0x5698e8){for(var _0x163fa5 in _0x5698e8){if(_0x5698e8[_0x4db7('0x1b')](_0x163fa5)){if(_0x5698e8[_0x163fa5][_0x4db7('0x13')]&&_0x5698e8[_0x163fa5][_0x4db7('0x1c')]){var _0x48c036=_0x5698e8[_0x163fa5]['Imap'];if(!_0x48c036[_0x4db7('0x1d')]&&_0x5698e8[_0x163fa5][_0x4db7('0x1e')]!==_0x4db7('0x1f'))_0x48c036[_0x4db7('0x1d')]=_0x5698e8[_0x163fa5]['provider'];if(!this[_0x4db7('0xd')][_0x4db7('0x1b')](_0x48c036['id'])){this[_0x4db7('0xd')][_0x48c036['id']]=new EmailImap(_0x48c036,_0x5698e8[_0x163fa5][_0x4db7('0x6')]);this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x20'),this[_0x4db7('0x21')][_0x4db7('0x22')](this,_0x163fa5));this['imapAccounts'][_0x48c036['id']]['on'](_0x4db7('0x6'),this[_0x4db7('0x23')]['bind'](this,_0x163fa5));this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x24'),this['handleImapEnd'][_0x4db7('0x22')](this,_0x163fa5));this[_0x4db7('0xd')][_0x48c036['id']]['on'](_0x4db7('0x25'),this[_0x4db7('0x26')][_0x4db7('0x22')](this,_0x163fa5));}}else{if(_[_0x4db7('0x17')](this[_0x4db7('0xc')][_0x163fa5][_0x4db7('0x13')])){this['mailAccounts'][_0x163fa5]['Imap']={};}this['mailAccounts'][_0x163fa5][_0x4db7('0x13')][_0x4db7('0x14')]='disabled';this[_0x4db7('0xc')][_0x163fa5][_0x4db7('0x13')]['messageStatus']='';this[_0x4db7('0x10')](_0x163fa5);}}}};EmailChannel[_0x4db7('0xf')]['handleImapBox']=function(_0x4e3f99,_0x8e8464){if(this['mailAccounts'][_0x4e3f99]){this['mailAccounts'][_0x4e3f99][_0x4db7('0x13')][_0x4db7('0x14')]=_0x4db7('0x27');this[_0x4db7('0xc')][_0x4e3f99]['Imap'][_0x4db7('0x15')]=_0x8e8464[_0x4db7('0x11')];if(_0x8e8464[_0x4db7('0x28')]){this[_0x4db7('0xc')][_0x4e3f99]['Imap'][_0x4db7('0x16')]=_0x8e8464[_0x4db7('0x28')][_0x4db7('0x16')];}return this[_0x4db7('0x10')](_0x4e3f99);}};EmailChannel[_0x4db7('0xf')][_0x4db7('0x23')]=function(_0x51f384,_0x3955f9){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3955f9[_0x4db7('0x29')],_0x3955f9['lastName'],_0x3955f9[_0x4db7('0x2a')],_0x51f384);if(this['mailAccounts'][_0x51f384]){return mailAccount[_0x4db7('0x2b')](_0x51f384,_0x3955f9)[_0x4db7('0x2c')](function(_0x44202c){if(_0x44202c){logger[_0x4db7('0x2d')](_0x4db7('0x2e'));}})[_0x4db7('0x2f')](function(_0x2e78b4){logger[_0x4db7('0x25')](_0x4db7('0x30'),JSON[_0x4db7('0x18')](_0x2e78b4));});}};EmailChannel['prototype'][_0x4db7('0x31')]=function(_0x361af0){if(this['mailAccounts'][_0x361af0]&&this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')]){if(this[_0x4db7('0xd')][this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')]['id']]){delete this[_0x4db7('0xd')][this['mailAccounts'][_0x361af0][_0x4db7('0x13')]['id']];}this[_0x4db7('0xc')][_0x361af0][_0x4db7('0x13')][_0x4db7('0x32')]=moment();this[_0x4db7('0x10')](_0x361af0);}};EmailChannel['prototype'][_0x4db7('0x26')]=function(_0x1f0ce6,_0x47d734){if(this[_0x4db7('0xc')][_0x1f0ce6]){this['mailAccounts'][_0x1f0ce6][_0x4db7('0x13')][_0x4db7('0x14')]=_0x4db7('0x25');this[_0x4db7('0xc')][_0x1f0ce6][_0x4db7('0x13')][_0x4db7('0x15')]=_0x47d734;return this['emit'](_0x1f0ce6);}};EmailChannel['prototype'][_0x4db7('0x33')]=function(_0x533242,_0xb439cd){return this[_0x4db7('0xe')][_0x4db7('0x34')](_0x533242,_0xb439cd);};EmailChannel[_0x4db7('0xf')]['verifySmtp']=function(_0x4f3ed3){var _0x5bd4ed=this;if(this[_0x4db7('0xc')][_0x4f3ed3['id']]){if(_[_0x4db7('0x17')](this[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')])){this[_0x4db7('0xc')][_0x4f3ed3['id']]['Smtp']={};}this[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x32')]=moment();return new BPromise(function(_0x325a19,_0x412ec1){return _0x5bd4ed['smtp'][_0x4db7('0x36')](_0x4f3ed3)[_0x4db7('0x2c')](function(_0x1c7c8e){_0x5bd4ed[_0x4db7('0xc')][_0x4f3ed3['id']]['Smtp'][_0x4db7('0x14')]=_0x4db7('0x37');_0x5bd4ed['mailAccounts'][_0x4f3ed3['id']]['Smtp'][_0x4db7('0x15')]='';_0x5bd4ed[_0x4db7('0x10')](_0x4f3ed3['id']);_0x325a19(_0x1c7c8e);})[_0x4db7('0x2f')](function(_0xe38463){_0x5bd4ed['mailAccounts'][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x14')]='error';_0x5bd4ed[_0x4db7('0xc')][_0x4f3ed3['id']][_0x4db7('0x35')][_0x4db7('0x15')]=_0xe38463;_0x5bd4ed[_0x4db7('0x10')](_0x4f3ed3['id']);_0x412ec1(_0xe38463);});});}return this[_0x4db7('0xe')][_0x4db7('0x36')](_0x4f3ed3);};module[_0x4db7('0x38')]=EmailChannel; \ No newline at end of file +var _0xf9ce=['Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','active','status','messageStatus','Imap','total','isNil','stringify','md5','emit','mailAccount:update','refresh','hasOwnProperty','service','imapAccounts','email','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x456103,_0x5330a3){var _0x8abcb3=function(_0x3373f0){while(--_0x3373f0){_0x456103['push'](_0x456103['shift']());}};_0x8abcb3(++_0x5330a3);}(_0xf9ce,0x11f));var _0xef9c=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xf9ce[_0x36feb2];return _0x292b43;};'use strict';var _=require(_0xef9c('0x0'));var moment=require('moment');var BPromise=require(_0xef9c('0x1'));var md5=require('md5');var Redis=require(_0xef9c('0x2'));var config=require(_0xef9c('0x3'));var logger=require(_0xef9c('0x4'))('email');config[_0xef9c('0x5')]=_[_0xef9c('0x6')](config[_0xef9c('0x5')],{'host':_0xef9c('0x7'),'port':0x18eb});var io=require(_0xef9c('0x8'))(new Redis(config[_0xef9c('0x5')]));var EmailImap=require(_0xef9c('0x9'));var EmailSmtp=require(_0xef9c('0xa'));var mailAccount=require(_0xef9c('0xb'));var md5Accounts={};function EmailChannel(_0x42e946){logger[_0xef9c('0xc')]('start\x20email\x20channel');this[_0xef9c('0xd')]=_0x42e946[_0xef9c('0xd')];this['imapAccounts']={};this[_0xef9c('0xe')]=new EmailSmtp();}EmailChannel[_0xef9c('0xf')]['emit']=function(_0xcc5451){var _0x163ca6=this[_0xef9c('0xd')][_0xcc5451];var _0x15dcbd={'id':_0x163ca6['id'],'name':_0x163ca6['name'],'key':_0x163ca6['key'],'active':_0x163ca6[_0xef9c('0x10')],'Imap':{'status':_0x163ca6['Imap'][_0xef9c('0x11')],'messageStatus':_0x163ca6['Imap'][_0xef9c('0x12')],'total':_0x163ca6[_0xef9c('0x13')][_0xef9c('0x14')]}};if(_[_0xef9c('0x15')](md5Accounts[_0xcc5451])){md5Accounts[_0xcc5451]={};}var _0x54341f=md5(JSON[_0xef9c('0x16')](_0x15dcbd));if(md5Accounts[_0xcc5451][_0xef9c('0x17')]!==_0x54341f){md5Accounts[_0xcc5451][_0xef9c('0x17')]=_0x54341f;io[_0xef9c('0x18')](_0xef9c('0x19'),_0x15dcbd);}};EmailChannel['prototype'][_0xef9c('0x1a')]=function(_0x56fc16){for(var _0x15b59d in _0x56fc16){if(_0x56fc16[_0xef9c('0x1b')](_0x15b59d)){if(_0x56fc16[_0x15b59d][_0xef9c('0x13')]&&_0x56fc16[_0x15b59d][_0xef9c('0x10')]){var _0xad485f=_0x56fc16[_0x15b59d][_0xef9c('0x13')];if(!_0xad485f['service']&&_0x56fc16[_0x15b59d]['provider']!=='custom')_0xad485f[_0xef9c('0x1c')]=_0x56fc16[_0x15b59d]['provider'];if(!this[_0xef9c('0x1d')][_0xef9c('0x1b')](_0xad485f['id'])){this[_0xef9c('0x1d')][_0xad485f['id']]=new EmailImap(_0xad485f,_0x56fc16[_0x15b59d][_0xef9c('0x1e')]);this[_0xef9c('0x1d')][_0xad485f['id']]['on'](_0xef9c('0x1f'),this[_0xef9c('0x20')]['bind'](this,_0x15b59d));this[_0xef9c('0x1d')][_0xad485f['id']]['on']('email',this[_0xef9c('0x21')][_0xef9c('0x22')](this,_0x15b59d));this[_0xef9c('0x1d')][_0xad485f['id']]['on'](_0xef9c('0x23'),this[_0xef9c('0x24')][_0xef9c('0x22')](this,_0x15b59d));this[_0xef9c('0x1d')][_0xad485f['id']]['on'](_0xef9c('0x25'),this[_0xef9c('0x26')]['bind'](this,_0x15b59d));}}else{if(_[_0xef9c('0x15')](this['mailAccounts'][_0x15b59d]['Imap'])){this[_0xef9c('0xd')][_0x15b59d][_0xef9c('0x13')]={};}this[_0xef9c('0xd')][_0x15b59d][_0xef9c('0x13')][_0xef9c('0x11')]=_0xef9c('0x27');this[_0xef9c('0xd')][_0x15b59d][_0xef9c('0x13')][_0xef9c('0x12')]='';this[_0xef9c('0x18')](_0x15b59d);}}}};EmailChannel[_0xef9c('0xf')][_0xef9c('0x20')]=function(_0x492ddc,_0x564dd8){if(this[_0xef9c('0xd')][_0x492ddc]){this['mailAccounts'][_0x492ddc][_0xef9c('0x13')][_0xef9c('0x11')]=_0xef9c('0x28');this[_0xef9c('0xd')][_0x492ddc][_0xef9c('0x13')]['messageStatus']=_0x564dd8['name'];if(_0x564dd8[_0xef9c('0x29')]){this[_0xef9c('0xd')][_0x492ddc][_0xef9c('0x13')][_0xef9c('0x14')]=_0x564dd8[_0xef9c('0x29')][_0xef9c('0x14')];}return this[_0xef9c('0x18')](_0x492ddc);}};EmailChannel['prototype'][_0xef9c('0x21')]=function(_0x3f5530,_0x58578b){logger[_0xef9c('0xc')](_0xef9c('0x2a'),_0x58578b[_0xef9c('0x2b')],_0x58578b[_0xef9c('0x2c')],_0x58578b['from'],_0x3f5530);if(this[_0xef9c('0xd')][_0x3f5530]){return mailAccount[_0xef9c('0x2d')](_0x3f5530,_0x58578b)[_0xef9c('0x2e')](function(_0x2e164d){if(_0x2e164d){logger[_0xef9c('0xc')](_0xef9c('0x2f'));}})[_0xef9c('0x30')](function(_0x5dbf91){logger[_0xef9c('0x25')](_0xef9c('0x31'),JSON[_0xef9c('0x16')](_0x5dbf91));});}};EmailChannel[_0xef9c('0xf')][_0xef9c('0x24')]=function(_0xf9937e){if(this[_0xef9c('0xd')][_0xf9937e]&&this[_0xef9c('0xd')][_0xf9937e][_0xef9c('0x13')]){if(this[_0xef9c('0x1d')][this[_0xef9c('0xd')][_0xf9937e][_0xef9c('0x13')]['id']]){delete this[_0xef9c('0x1d')][this[_0xef9c('0xd')][_0xf9937e][_0xef9c('0x13')]['id']];}this[_0xef9c('0xd')][_0xf9937e][_0xef9c('0x13')][_0xef9c('0x32')]=moment();this[_0xef9c('0x18')](_0xf9937e);}};EmailChannel[_0xef9c('0xf')][_0xef9c('0x26')]=function(_0x5b7805,_0x5ccec7){if(this[_0xef9c('0xd')][_0x5b7805]){this[_0xef9c('0xd')][_0x5b7805][_0xef9c('0x13')][_0xef9c('0x11')]='error';this[_0xef9c('0xd')][_0x5b7805]['Imap'][_0xef9c('0x12')]=_0x5ccec7;return this[_0xef9c('0x18')](_0x5b7805);}};EmailChannel[_0xef9c('0xf')][_0xef9c('0x33')]=function(_0x113473,_0x206145){return this[_0xef9c('0xe')][_0xef9c('0x34')](_0x113473,_0x206145);};EmailChannel[_0xef9c('0xf')]['verifySmtp']=function(_0x4a6489){var _0x3dad26=this;if(this['mailAccounts'][_0x4a6489['id']]){if(_[_0xef9c('0x15')](this[_0xef9c('0xd')][_0x4a6489['id']]['Smtp'])){this['mailAccounts'][_0x4a6489['id']][_0xef9c('0x35')]={};}this[_0xef9c('0xd')][_0x4a6489['id']][_0xef9c('0x35')]['lastSync']=moment();return new BPromise(function(_0x498c98,_0x3da41e){return _0x3dad26['smtp'][_0xef9c('0x36')](_0x4a6489)[_0xef9c('0x2e')](function(_0x44ab11){_0x3dad26['mailAccounts'][_0x4a6489['id']][_0xef9c('0x35')][_0xef9c('0x11')]=_0xef9c('0x37');_0x3dad26[_0xef9c('0xd')][_0x4a6489['id']]['Smtp'][_0xef9c('0x12')]='';_0x3dad26[_0xef9c('0x18')](_0x4a6489['id']);_0x498c98(_0x44ab11);})['catch'](function(_0x2a269d){_0x3dad26[_0xef9c('0xd')][_0x4a6489['id']][_0xef9c('0x35')]['status']=_0xef9c('0x25');_0x3dad26[_0xef9c('0xd')][_0x4a6489['id']][_0xef9c('0x35')][_0xef9c('0x12')]=_0x2a269d;_0x3dad26[_0xef9c('0x18')](_0x4a6489['id']);_0x3da41e(_0x2a269d);});});}return this[_0xef9c('0xe')][_0xef9c('0x36')](_0x4a6489);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index d6f1d46..23997ec 100644 --- a/server/services/email/lib/imap.js +++ b/server/services/email/lib/imap.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47c5=['service','user','anonymous@xcally.com','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','parser','emit','stringify','textCode','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout'];(function(_0x554622,_0x431310){var _0x1e8aca=function(_0xe7cfcd){while(--_0xe7cfcd){_0x554622['push'](_0x554622['shift']());}};_0x1e8aca(++_0x431310);}(_0x47c5,0x165));var _0x547c=function(_0x14f8f0,_0x5e2d51){_0x14f8f0=_0x14f8f0-0x0;var _0x5a1286=_0x47c5[_0x14f8f0];return _0x5a1286;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var Imap=require(_0x547c('0x2'));var simpleParser=require(_0x547c('0x3'))[_0x547c('0x4')];var Iconv=require(_0x547c('0x5'))['Iconv'];var EventEmitter=require(_0x547c('0x6'))[_0x547c('0x7')];var utils=require('./utils');var logger=require(_0x547c('0x8'))(_0x547c('0x9'));function EmailImap(_0x51ab7f,_0x2e5b57){this[_0x547c('0xa')]=_0x547c('0xb');this[_0x547c('0xc')]=this[_0x547c('0xd')](_0x51ab7f,_0x2e5b57);this[_0x547c('0x2')]=new Imap(this[_0x547c('0xc')]);this[_0x547c('0x2')][_0x547c('0xe')](_0x547c('0xf'),this[_0x547c('0x10')][_0x547c('0x11')](this));this[_0x547c('0x2')][_0x547c('0xe')](_0x547c('0x12'),this[_0x547c('0x13')][_0x547c('0x11')](this));this['imap']['on'](_0x547c('0x14'),this[_0x547c('0x15')]['bind'](this));this[_0x547c('0x2')][_0x547c('0x16')]();}util[_0x547c('0x17')](EmailImap,EventEmitter);EmailImap[_0x547c('0x18')][_0x547c('0xd')]=function(_0x150317,_0x2bc289){var _0xa3c7b0={'connTimeout':_0x150317[_0x547c('0x19')]?_0x150317[_0x547c('0x19')]*0x3e8:0x2710,'authTimeout':_0x150317[_0x547c('0x1a')]?_0x150317[_0x547c('0x1a')]*0x3e8:0x1388};if(_0x150317[_0x547c('0x1b')]){_0xa3c7b0[_0x547c('0x1c')]=_0x150317[_0x547c('0x1c')];_0xa3c7b0[_0x547c('0x9')]=_0x2bc289||_0x150317[_0x547c('0x1c')]||_0x547c('0x1d');if(_0x150317['modernAuthentication']){_0xa3c7b0['xoauth2']=utils[_0x547c('0x1e')](_0x150317[_0x547c('0x1f')][_0x547c('0x20')],_0x150317['user']);}else{_0xa3c7b0[_0x547c('0x21')]=_0x150317[_0x547c('0x21')];}}else{if(_0x150317[_0x547c('0x22')]){_0xa3c7b0['user']=_0x150317[_0x547c('0x1c')];_0xa3c7b0[_0x547c('0x21')]=_0x150317['password'];}}_0xa3c7b0['host']=_0x150317[_0x547c('0x23')];_0xa3c7b0[_0x547c('0x24')]=_0x150317['port']||0x3e1;if(_0x150317[_0x547c('0x25')]){_0xa3c7b0[_0x547c('0x25')]=!![];}else{_0xa3c7b0['tls']=![];_0xa3c7b0[_0x547c('0x26')]=_0x547c('0x27');}return _0xa3c7b0;};EmailImap[_0x547c('0x18')]['handleReady']=function(){this[_0x547c('0x2')][_0x547c('0x28')](this[_0x547c('0xa')],![],this[_0x547c('0x29')][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')][_0x547c('0x29')]=function(_0x17fa33,_0x507895){if(_0x17fa33){this[_0x547c('0x15')](_0x17fa33,!![]);}else{this['emit']('box',_0x507895);this['readUnseen']();}};EmailImap['prototype'][_0x547c('0x2a')]=function(_0x4c5256){if(_0x4c5256){this[_0x547c('0x15')](_0x4c5256,!![]);}else{this['imap'][_0x547c('0x12')]();}};EmailImap['prototype'][_0x547c('0x2b')]=function(){this[_0x547c('0x2')][_0x547c('0x2c')]([_0x547c('0x2d')],this[_0x547c('0x2e')]['bind'](this));};EmailImap['prototype'][_0x547c('0x2e')]=function(_0x54de6f,_0x303b57){if(_0x54de6f){this[_0x547c('0x15')](_0x54de6f,!![]);}else{if(_0x303b57[_0x547c('0x2f')]){try{var _0x1695be=this[_0x547c('0x2')][_0x547c('0x30')](_0x303b57,{'bodies':'','markSeen':!![]});_0x1695be['on'](_0x547c('0x31'),this['handleFetchMessage']['bind'](this));_0x1695be[_0x547c('0xe')](_0x547c('0x14'),this[_0x547c('0x32')][_0x547c('0x11')](this));_0x1695be[_0x547c('0xe')](_0x547c('0x12'),this[_0x547c('0x33')][_0x547c('0x11')](this));}catch(_0x378bac){logger[_0x547c('0x14')](_0x378bac);}}else{this[_0x547c('0x2')][_0x547c('0x34')](!![],this[_0x547c('0x2a')][_0x547c('0x11')](this));}}};EmailImap['prototype'][_0x547c('0x35')]=function(_0x553dcf){_0x553dcf['on']('body',this['handleMessageBody'][_0x547c('0x11')](this));_0x553dcf[_0x547c('0xe')](_0x547c('0x36'),this[_0x547c('0x37')][_0x547c('0x11')](this));_0x553dcf[_0x547c('0xe')]('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0x547c('0x18')][_0x547c('0x38')]=function(_0x3bb9cc){simpleParser(_0x3bb9cc,{'Iconv':Iconv},this[_0x547c('0x39')][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0x547c('0x18')]['handleMessageEnd']=function(){};EmailImap[_0x547c('0x18')][_0x547c('0x39')]=function(_0x5b80f4,_0x380705){if(_0x5b80f4){logger['error'](_0x5b80f4);}else{var _0x511103=this;utils[_0x547c('0x3a')](this[_0x547c('0xc')],_0x380705,function(_0x36bffe){_0x511103[_0x547c('0x3b')]('email',_0x36bffe);});}};EmailImap['prototype'][_0x547c('0x33')]=function(){this[_0x547c('0x2')][_0x547c('0x34')](!![],this['handleCloseBox'][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')][_0x547c('0x32')]=function(_0x5d4476){this[_0x547c('0x15')](_0x5d4476);this[_0x547c('0x2')][_0x547c('0x34')](!![],this['handleCloseBox'][_0x547c('0x11')](this));};EmailImap[_0x547c('0x18')]['handleEnd']=function(){this[_0x547c('0x3b')](_0x547c('0x12'));};EmailImap[_0x547c('0x18')]['handleError']=function(_0x62eb2,_0x4f2859){logger[_0x547c('0x14')]('handleError',this[_0x547c('0xc')][_0x547c('0x9')],JSON[_0x547c('0x3c')](_0x62eb2));var _0x3797d3='';if(_0x62eb2){if(_0x62eb2[_0x547c('0x3d')]){_0x3797d3=_0x62eb2[_0x547c('0x3d')];}else{for(var _0x5a271a in _0x62eb2){if(_0x62eb2['hasOwnProperty'](_0x5a271a)){_0x3797d3+=_[_0x547c('0x3e')](_0x5a271a)+':\x20'+_0x62eb2[_0x5a271a]+'\x0a';}}}}if(_0x4f2859){this[_0x547c('0x2')][_0x547c('0x12')]();}else{this['emit'](_0x547c('0x14'),_0x3797d3);this[_0x547c('0x3b')](_0x547c('0x12'));}};module[_0x547c('0x3f')]=EmailImap; \ No newline at end of file +var _0xdfa0=['prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','handleReady','handleOpenBox','handleError','emit','box','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','iconv','Iconv','events','./utils','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','handleEnd','error','inherits'];(function(_0x284998,_0x4c8733){var _0x1db6d6=function(_0x8718ac){while(--_0x8718ac){_0x284998['push'](_0x284998['shift']());}};_0x1db6d6(++_0x4c8733);}(_0xdfa0,0x69));var _0x0dfa=function(_0x4f6da3,_0x408e59){_0x4f6da3=_0x4f6da3-0x0;var _0x5aef6d=_0xdfa0[_0x4f6da3];return _0x5aef6d;};'use strict';var _=require(_0x0dfa('0x0'));var util=require('util');var Imap=require(_0x0dfa('0x1'));var simpleParser=require(_0x0dfa('0x2'))['simpleParser'];var Iconv=require(_0x0dfa('0x3'))[_0x0dfa('0x4')];var EventEmitter=require(_0x0dfa('0x5'))['EventEmitter'];var utils=require(_0x0dfa('0x6'));var logger=require('../../../config/logger')(_0x0dfa('0x7'));function EmailImap(_0x2efe20,_0x4830b6){this[_0x0dfa('0x8')]=_0x0dfa('0x9');this[_0x0dfa('0xa')]=this[_0x0dfa('0xb')](_0x2efe20,_0x4830b6);this[_0x0dfa('0x1')]=new Imap(this['account']);this[_0x0dfa('0x1')][_0x0dfa('0xc')](_0x0dfa('0xd'),this['handleReady'][_0x0dfa('0xe')](this));this['imap'][_0x0dfa('0xc')](_0x0dfa('0xf'),this[_0x0dfa('0x10')]['bind'](this));this[_0x0dfa('0x1')]['on'](_0x0dfa('0x11'),this['handleError'][_0x0dfa('0xe')](this));this[_0x0dfa('0x1')]['connect']();}util[_0x0dfa('0x12')](EmailImap,EventEmitter);EmailImap[_0x0dfa('0x13')][_0x0dfa('0xb')]=function(_0x3b0f4a,_0x416ce3){var _0x433241={'connTimeout':_0x3b0f4a['connTimeout']?_0x3b0f4a[_0x0dfa('0x14')]*0x3e8:0x2710,'authTimeout':_0x3b0f4a[_0x0dfa('0x15')]?_0x3b0f4a[_0x0dfa('0x15')]*0x3e8:0x1388};if(_0x3b0f4a[_0x0dfa('0x16')]){_0x433241[_0x0dfa('0x17')]=_0x3b0f4a[_0x0dfa('0x17')];_0x433241[_0x0dfa('0x7')]=_0x416ce3||_0x3b0f4a[_0x0dfa('0x17')]||_0x0dfa('0x18');if(_0x3b0f4a[_0x0dfa('0x19')]){_0x433241[_0x0dfa('0x1a')]=utils[_0x0dfa('0x1b')](_0x3b0f4a[_0x0dfa('0x1c')][_0x0dfa('0x1d')],_0x3b0f4a[_0x0dfa('0x17')]);}else{_0x433241['password']=_0x3b0f4a[_0x0dfa('0x1e')];}}else{if(_0x3b0f4a[_0x0dfa('0x1f')]){_0x433241[_0x0dfa('0x17')]=_0x3b0f4a[_0x0dfa('0x17')];_0x433241[_0x0dfa('0x1e')]=_0x3b0f4a['password'];}}_0x433241['host']=_0x3b0f4a[_0x0dfa('0x20')];_0x433241[_0x0dfa('0x21')]=_0x3b0f4a[_0x0dfa('0x21')]||0x3e1;if(_0x3b0f4a['tls']){_0x433241[_0x0dfa('0x22')]=!![];}else{_0x433241['tls']=![];_0x433241[_0x0dfa('0x23')]='required';}return _0x433241;};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x24')]=function(){this[_0x0dfa('0x1')]['openBox'](this[_0x0dfa('0x8')],![],this[_0x0dfa('0x25')][_0x0dfa('0xe')](this));};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x25')]=function(_0x12bd2a,_0x13005a){if(_0x12bd2a){this[_0x0dfa('0x26')](_0x12bd2a,!![]);}else{this[_0x0dfa('0x27')](_0x0dfa('0x28'),_0x13005a);this['readUnseen']();}};EmailImap['prototype'][_0x0dfa('0x29')]=function(_0x12610b){if(_0x12610b){this['handleError'](_0x12610b,!![]);}else{this[_0x0dfa('0x1')][_0x0dfa('0xf')]();}};EmailImap[_0x0dfa('0x13')]['readUnseen']=function(){this[_0x0dfa('0x1')][_0x0dfa('0x2a')]([_0x0dfa('0x2b')],this[_0x0dfa('0x2c')][_0x0dfa('0xe')](this));};EmailImap[_0x0dfa('0x13')]['handleReadUnseen']=function(_0xc6ed1e,_0x3361cc){if(_0xc6ed1e){this['handleError'](_0xc6ed1e,!![]);}else{if(_0x3361cc[_0x0dfa('0x2d')]){try{var _0x37e050=this[_0x0dfa('0x1')][_0x0dfa('0x2e')](_0x3361cc,{'bodies':'','markSeen':!![]});_0x37e050['on']('message',this[_0x0dfa('0x2f')][_0x0dfa('0xe')](this));_0x37e050[_0x0dfa('0xc')]('error',this['handleFetchError'][_0x0dfa('0xe')](this));_0x37e050[_0x0dfa('0xc')]('end',this['handleFetchEnd']['bind'](this));}catch(_0x26aae2){logger[_0x0dfa('0x11')](_0x26aae2);}}else{this[_0x0dfa('0x1')][_0x0dfa('0x30')](!![],this['handleCloseBox'][_0x0dfa('0xe')](this));}}};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x2f')]=function(_0x3153f7){_0x3153f7['on'](_0x0dfa('0x31'),this[_0x0dfa('0x32')][_0x0dfa('0xe')](this));_0x3153f7[_0x0dfa('0xc')](_0x0dfa('0x33'),this[_0x0dfa('0x34')]['bind'](this));_0x3153f7['once'](_0x0dfa('0xf'),this[_0x0dfa('0x35')][_0x0dfa('0xe')](this));};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x32')]=function(_0x4941aa){simpleParser(_0x4941aa,{'Iconv':Iconv},this[_0x0dfa('0x36')]['bind'](this));};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x34')]=function(){};EmailImap[_0x0dfa('0x13')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x0dfa('0x36')]=function(_0x2be829,_0x1ac128){if(_0x2be829){logger['error'](_0x2be829);}else{var _0x2df27c=this;utils['parser'](this[_0x0dfa('0xa')],_0x1ac128,function(_0xfbe1ce){_0x2df27c['emit'](_0x0dfa('0x7'),_0xfbe1ce);});}};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x37')]=function(){this[_0x0dfa('0x1')][_0x0dfa('0x30')](!![],this[_0x0dfa('0x29')]['bind'](this));};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x38')]=function(_0x2715e8){this[_0x0dfa('0x26')](_0x2715e8);this[_0x0dfa('0x1')][_0x0dfa('0x30')](!![],this[_0x0dfa('0x29')][_0x0dfa('0xe')](this));};EmailImap[_0x0dfa('0x13')][_0x0dfa('0x10')]=function(){this[_0x0dfa('0x27')]('end');};EmailImap['prototype'][_0x0dfa('0x26')]=function(_0x1d7750,_0x5c6625){logger['error']('handleError',this[_0x0dfa('0xa')]['email'],JSON[_0x0dfa('0x39')](_0x1d7750));var _0x2bdf64='';if(_0x1d7750){if(_0x1d7750[_0x0dfa('0x3a')]){_0x2bdf64=_0x1d7750[_0x0dfa('0x3a')];}else{for(var _0x14a295 in _0x1d7750){if(_0x1d7750[_0x0dfa('0x3b')](_0x14a295)){_0x2bdf64+=_[_0x0dfa('0x3c')](_0x14a295)+':\x20'+_0x1d7750[_0x14a295]+'\x0a';}}}}if(_0x5c6625){this[_0x0dfa('0x1')]['end']();}else{this[_0x0dfa('0x27')](_0x0dfa('0x11'),_0x2bdf64);this['emit'](_0x0dfa('0xf'));}};module[_0x0dfa('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2ed9620..64ca8ba 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bd9=['compile','sendMail','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x1ab015,_0x2b39c1){var _0x4cff2c=function(_0x461ee5){while(--_0x461ee5){_0x1ab015['push'](_0x1ab015['shift']());}};_0x4cff2c(++_0x2b39c1);}(_0x1bd9,0x118));var _0x91bd=function(_0x1e6b2b,_0x2bddcb){_0x1e6b2b=_0x1e6b2b-0x0;var _0x2add75=_0x1bd9[_0x1e6b2b];return _0x2add75;};'use strict';var nodemailer=require(_0x91bd('0x0'));var inlineBase64=require(_0x91bd('0x1'));function EmailSmtp(){}EmailSmtp[_0x91bd('0x2')][_0x91bd('0x3')]=function(_0x31b504,_0x5ed380){return new Promise(function(_0x46350b,_0x54fd4a){var _0x3dc0b7=nodemailer[_0x91bd('0x4')](_0x31b504);_0x3dc0b7[_0x91bd('0x5')](_0x91bd('0x6'),inlineBase64());_0x3dc0b7[_0x91bd('0x7')](_0x5ed380,function(_0x58cd59,_0x43fb82){if(_0x58cd59){_0x54fd4a(_0x58cd59[_0x91bd('0x8')]());}else{_0x46350b(_0x43fb82);}});});};EmailSmtp[_0x91bd('0x2')][_0x91bd('0x9')]=function(_0x2d2d80){return new Promise(function(_0x2254e7,_0x431bc8){var _0x2f15ac=nodemailer[_0x91bd('0x4')](_0x2d2d80);_0x2f15ac[_0x91bd('0x9')](function(_0x1abe6b,_0x1bfeee){if(_0x1abe6b){_0x431bc8(_0x1abe6b['toString']());}else{if(_0x1bfeee){_0x2254e7(_0x1bfeee);}else{_0x431bc8(_0x91bd('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xfc6e=['send','use','compile','sendMail','createTransport','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x2042a4,_0x16f91e){var _0x233995=function(_0x3a864f){while(--_0x3a864f){_0x2042a4['push'](_0x2042a4['shift']());}};_0x233995(++_0x16f91e);}(_0xfc6e,0xd9));var _0xefc6=function(_0xbcc6e1,_0x4c42f6){_0xbcc6e1=_0xbcc6e1-0x0;var _0x4985f9=_0xfc6e[_0xbcc6e1];return _0x4985f9;};'use strict';var nodemailer=require(_0xefc6('0x0'));var inlineBase64=require(_0xefc6('0x1'));function EmailSmtp(){}EmailSmtp[_0xefc6('0x2')][_0xefc6('0x3')]=function(_0x5e952b,_0x4c30c7){return new Promise(function(_0x44d135,_0x50a2e5){var _0x148f89=nodemailer['createTransport'](_0x5e952b);_0x148f89[_0xefc6('0x4')](_0xefc6('0x5'),inlineBase64());_0x148f89[_0xefc6('0x6')](_0x4c30c7,function(_0x47da52,_0x233a09){if(_0x47da52){_0x50a2e5(_0x47da52['toString']());}else{_0x44d135(_0x233a09);}});});};EmailSmtp[_0xefc6('0x2')]['verify']=function(_0x2cbd38){return new Promise(function(_0x4fadfc,_0x4dda5c){var _0x6d5b38=nodemailer[_0xefc6('0x7')](_0x2cbd38);_0x6d5b38[_0xefc6('0x8')](function(_0x25420b,_0x50cf1e){if(_0x25420b){_0x4dda5c(_0x25420b['toString']());}else{if(_0x50cf1e){_0x4fadfc(_0x50cf1e);}else{_0x4dda5c(_0xefc6('0x9'));}}});});};module[_0xefc6('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a12c40c..d01ddff 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb48=['contentType','headerLines','Auto-Submitted:\x20auto-replied','indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','Attachments','Title','

Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','generate','name','substring','split','length','join','Anonymous','pop','anonymous','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x1d9eb0['slice'](0x0,-0x1)[_0x8cb4('0xf')]('\x20'):_0x28dc1d[_0x8cb4('0xb')];}return _0x8cb4('0x10');}function getLastName(_0x18f3e5){var _0x53b512=_[_0x8cb4('0x7')](_0x18f3e5[_0x8cb4('0x8')]);if(_0x53b512&&_0x53b512[_0x8cb4('0xb')]){var _0xa1aded=_0x53b512[_0x8cb4('0xb')][_0x8cb4('0xd')](/\s+/);return _0xa1aded[_0x8cb4('0xe')]>0x1?_0xa1aded[_0x8cb4('0x11')]():'';}return'';}function getMails(_0x23e16f,_0x219233){var _0x2a567e='';for(var _0x189159=0x0;_0x189159<_0x219233['value']['length'];_0x189159+=0x1){if(_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]!==_0x23e16f){if(!_['isEmpty'](_0x2a567e)){_0x2a567e+=',';}_0x2a567e+=_0x219233['value'][_0x189159][_0x8cb4('0xb')]||_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]||'';_0x2a567e+='\x20<';_0x2a567e+=_0x219233[_0x8cb4('0x8')][_0x189159][_0x8cb4('0x9')]?_0x219233[_0x8cb4('0x8')][_0x189159]['address']:_0x8cb4('0x12')+random[_0x8cb4('0xa')](0x6)+'@xcally.com';_0x2a567e+='>';}}return _0x2a567e;}function parseEmail(_0x4269c6,_0x1b11a9,_0xfed31b){if(_0x1b11a9['html']){var _0x40c3e2=/)<[^<]*)*<\/script>/gi;while(_0x40c3e2[_0x8cb4('0x13')](_0x1b11a9[_0x8cb4('0x14')])){_0x1b11a9[_0x8cb4('0x14')]=_0x1b11a9['html'][_0x8cb4('0x15')](_0x40c3e2,'');}if(_0x1b11a9['html'][_0x8cb4('0x16')](_0x8cb4('0x17'))){var _0x2e9dbb=[];_0x1b11a9[_0x8cb4('0x18')]['forEach'](_0xdd7699=>{_0x2e9dbb[_0x8cb4('0x19')](_0xdd7699[_0x8cb4('0x1a')]);});var _0x3563af=/]+>/g;var _0x325923=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x12e06e=_0x1b11a9[_0x8cb4('0x14')][_0x8cb4('0x15')](_0x325923,'_SRC');var _0x59b231=_0x12e06e['replace'](_0x3563af,_0x8cb4('0x1b'));for(let _0x4b13cd=0x0;_0x4b13cd<_0x2e9dbb[_0x8cb4('0xe')];_0x4b13cd++){var _0x155faf=_0x59b231[_0x8cb4('0x15')]('_IMG',_0x8cb4('0x1c')+_0x2e9dbb[_0x4b13cd]+_0x8cb4('0x1d'));_0x59b231=_0x155faf;}_0x1b11a9[_0x8cb4('0x14')]=_0x59b231;}_0xfed31b[_0x8cb4('0x1e')]=_0x1b11a9['html'];}else{_0xfed31b['body']=_0x1b11a9['textAsHtml'];}if(_0xfed31b['body']){_0xfed31b[_0x8cb4('0x1e')]=_0xfed31b[_0x8cb4('0x1e')][_0x8cb4('0x15')](/0x0){var _0x7d750a=[_0x8cb4('0x2e'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x194ae0=0x0;_0x194ae0<_0x1b11a9['headerLines'][_0x8cb4('0xe')];_0x194ae0++){var _0x4b50d7=_[_0x8cb4('0x2f')](_0x7d750a,_0x1b11a9[_0x8cb4('0x2d')][_0x194ae0][_0x8cb4('0x30')]);if(_0x4b50d7>=0x0){_0xfed31b[_0x8cb4('0x31')]=!![];}}}return _0xfed31b;}exports[_0x8cb4('0x32')]=function(_0x4b43ce,_0x582830,_0x2ae372){var _0xbe1c2a={'from':getAddress(_0x582830[_0x8cb4('0x33')]),'firstName':getFirstName(_0x582830[_0x8cb4('0x33')]),'lastName':getLastName(_0x582830[_0x8cb4('0x33')]),'mapKey':_0x8cb4('0x5'),'message':{'from':getMails(_0x4b43ce['email'],_0x582830['from']),'to':_0x4b43ce['email'],'cc':'','subject':_0x582830[_0x8cb4('0x34')]||'','messageId':_0x582830[_0x8cb4('0x35')],'inReplyTo':_0x582830[_0x8cb4('0x36')],'sentAt':moment(_0x582830[_0x8cb4('0x37')])[_0x8cb4('0x25')](_0x8cb4('0x38')),'attach':![],'attachments':[]}};if(!_0x582830[_0x8cb4('0x14')]&&!_0x582830['textAsHtml']){var _0x58caff=_[_0x8cb4('0x39')](_0x582830[_0x8cb4('0x18')],{'contentType':_0x8cb4('0x3a')});if(_0x58caff[_0x8cb4('0xe')]){logger[_0x8cb4('0x3b')](util[_0x8cb4('0x25')](_0x8cb4('0x3c'),_0x582830[_0x8cb4('0x35')]));tnef[_0x8cb4('0x3d')](_['first'](_0x58caff)[_0x8cb4('0x2b')],function(_0x1b34e3,_0x308759){if(_0x308759){_0x582830[_0x8cb4('0x14')]=_0x308759[_0x8cb4('0x3e')]||'

Empty\x20message

';if(_0x308759[_0x8cb4('0x3f')]){for(var _0x4011cb=0x0;_0x4011cb<_0x308759[_0x8cb4('0x3f')][_0x8cb4('0xe')];_0x4011cb++){var _0x45b6f4=_0x308759[_0x8cb4('0x3f')][_0x4011cb];_0xbe1c2a[_0x8cb4('0x22')][_0x8cb4('0x18')]['push']({'filename':_0x45b6f4[_0x8cb4('0x40')],'content':Buffer[_0x8cb4('0x33')](_0x45b6f4['Data'])});}}}_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));});}else{_0x582830[_0x8cb4('0x14')]=_0x8cb4('0x41');_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));}}else{_0x2ae372(parseEmail(_0x4b43ce,_0x582830,_0xbe1c2a));}};exports[_0x8cb4('0x42')]=function(_0x19df33,_0x37d29e){var _0x4a720a=[_0x8cb4('0x43')+(_0x37d29e||''),'auth=Bearer\x20'+_0x19df33,'',''];return Buffer[_0x8cb4('0x33')](_0x4a720a[_0x8cb4('0xf')](''),_0x8cb4('0x44'))[_0x8cb4('0x45')](_0x8cb4('0x46'));}; \ No newline at end of file +var _0x9241=['attachments','attach','type','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','push','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','join','pop','html','replace','includes','\x20[Attachment:\x20','\x20]','message','originTo','isEmpty','originCc'];(function(_0x773640,_0x129506){var _0x1bfa70=function(_0x11023c){while(--_0x11023c){_0x773640['push'](_0x773640['shift']());}};_0x1bfa70(++_0x129506);}(_0x9241,0x177));var _0x1924=function(_0x2c8cdd,_0x380e20){_0x2c8cdd=_0x2c8cdd-0x0;var _0x4ff1a2=_0x9241[_0x2c8cdd];return _0x4ff1a2;};'use strict';var _=require('lodash');var moment=require(_0x1924('0x0'));var random=require(_0x1924('0x1'));var fs=require('fs');var path=require(_0x1924('0x2'));var util=require('util');var tnef=require(_0x1924('0x3'));var logger=require(_0x1924('0x4'))(_0x1924('0x5'));var config=require(_0x1924('0x6'));function getAddress(_0xb92b46){var _0x3be03c=_[_0x1924('0x7')](_0xb92b46[_0x1924('0x8')]);return _0x3be03c&&_0x3be03c[_0x1924('0x9')]?_0x3be03c[_0x1924('0x9')]:_0x1924('0xa')+random[_0x1924('0xb')](0x6)+_0x1924('0xc');}function getFirstName(_0x4dbc1c){var _0x540ca2=_[_0x1924('0x7')](_0x4dbc1c['value']);if(_0x540ca2&&_0x540ca2['name']){if(_0x540ca2[_0x1924('0xd')]==_0x540ca2[_0x1924('0x9')]){return _0x540ca2[_0x1924('0xd')][_0x1924('0xe')](0x0,_0x540ca2[_0x1924('0xd')][_0x1924('0xf')]('@'));}var _0x36b3b9=_0x540ca2[_0x1924('0xd')][_0x1924('0x10')](/\s+/);return _0x36b3b9[_0x1924('0x11')]>0x1?_0x36b3b9['slice'](0x0,-0x1)[_0x1924('0x12')]('\x20'):_0x540ca2[_0x1924('0xd')];}return'Anonymous';}function getLastName(_0x4ecd10){var _0x2eb490=_['head'](_0x4ecd10[_0x1924('0x8')]);if(_0x2eb490&&_0x2eb490[_0x1924('0xd')]){var _0x5045cd=_0x2eb490['name'][_0x1924('0x10')](/\s+/);return _0x5045cd[_0x1924('0x11')]>0x1?_0x5045cd[_0x1924('0x13')]():'';}return'';}function getMails(_0x3c8e54,_0x1fc896){var _0x215c34='';for(var _0x1bee3c=0x0;_0x1bee3c<_0x1fc896[_0x1924('0x8')][_0x1924('0x11')];_0x1bee3c+=0x1){if(_0x1fc896['value'][_0x1bee3c][_0x1924('0x9')]!==_0x3c8e54){if(!_['isEmpty'](_0x215c34)){_0x215c34+=',';}_0x215c34+=_0x1fc896['value'][_0x1bee3c][_0x1924('0xd')]||_0x1fc896[_0x1924('0x8')][_0x1bee3c][_0x1924('0x9')]||'';_0x215c34+='\x20<';_0x215c34+=_0x1fc896[_0x1924('0x8')][_0x1bee3c][_0x1924('0x9')]?_0x1fc896['value'][_0x1bee3c][_0x1924('0x9')]:'anonymous'+random[_0x1924('0xb')](0x6)+'@xcally.com';_0x215c34+='>';}}return _0x215c34;}function parseEmail(_0x350aaa,_0x22c16c,_0xf2e510){if(_0x22c16c[_0x1924('0x14')]){var _0x170126=/)<[^<]*)*<\/script>/gi;while(_0x170126['test'](_0x22c16c[_0x1924('0x14')])){_0x22c16c[_0x1924('0x14')]=_0x22c16c[_0x1924('0x14')][_0x1924('0x15')](_0x170126,'');}if(_0x22c16c[_0x1924('0x14')][_0x1924('0x16')](_0x1924('0x17'))){var _0x37d6b5=[];_0x22c16c['attachments'][_0x1924('0x18')](_0x2b15ec=>{_0x37d6b5['push'](_0x2b15ec[_0x1924('0x19')]);});var _0x3a8944=/]+>/g;var _0x1977e1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1e0da6=_0x22c16c['html'][_0x1924('0x15')](_0x1977e1,'_SRC');var _0x379cbc=_0x1e0da6[_0x1924('0x15')](_0x3a8944,_0x1924('0x1a'));for(let _0x4fa217=0x0;_0x4fa217<_0x37d6b5[_0x1924('0x11')];_0x4fa217++){var _0x189f0d=_0x379cbc['replace'](_0x1924('0x1a'),_0x1924('0x1b')+_0x37d6b5[_0x4fa217]+_0x1924('0x1c'));_0x379cbc=_0x189f0d;}_0x22c16c[_0x1924('0x14')]=_0x379cbc;}_0xf2e510['body']=_0x22c16c[_0x1924('0x14')];}else{_0xf2e510['body']=_0x22c16c['textAsHtml'];}if(_0xf2e510['body']){_0xf2e510['body']=_0xf2e510['body'][_0x1924('0x15')](/0x0){var _0x5e41dd=[_0x1924('0x2c'),_0x1924('0x2d'),_0x1924('0x2e')];for(var _0x1dd5c3=0x0;_0x1dd5c3<_0x22c16c[_0x1924('0x2b')][_0x1924('0x11')];_0x1dd5c3++){var _0x2c5046=_[_0x1924('0xf')](_0x5e41dd,_0x22c16c[_0x1924('0x2b')][_0x1dd5c3]['line']);if(_0x2c5046>=0x0){_0xf2e510['isAutoreply']=!![];}}}return _0xf2e510;}exports[_0x1924('0x2f')]=function(_0x50ab6c,_0x434fc4,_0x3dd2a4){var _0x48139b={'from':getAddress(_0x434fc4[_0x1924('0x30')]),'firstName':getFirstName(_0x434fc4[_0x1924('0x30')]),'lastName':getLastName(_0x434fc4[_0x1924('0x30')]),'mapKey':_0x1924('0x5'),'message':{'from':getMails(_0x50ab6c['email'],_0x434fc4[_0x1924('0x30')]),'to':_0x50ab6c['email'],'cc':'','subject':_0x434fc4['subject']||'','messageId':_0x434fc4['messageId'],'inReplyTo':_0x434fc4['inReplyTo'],'sentAt':moment(_0x434fc4['date'])[_0x1924('0x25')](_0x1924('0x31')),'attach':![],'attachments':[]}};if(!_0x434fc4[_0x1924('0x14')]&&!_0x434fc4[_0x1924('0x32')]){var _0x22875d=_[_0x1924('0x33')](_0x434fc4[_0x1924('0x21')],{'contentType':_0x1924('0x34')});if(_0x22875d['length']){logger[_0x1924('0x35')](util[_0x1924('0x25')](_0x1924('0x36'),_0x434fc4[_0x1924('0x37')]));tnef[_0x1924('0x38')](_[_0x1924('0x39')](_0x22875d)['content'],function(_0x5ca9e0,_0x287b1c){if(_0x287b1c){_0x434fc4[_0x1924('0x14')]=_0x287b1c[_0x1924('0x3a')]||_0x1924('0x3b');if(_0x287b1c['Attachments']){for(var _0x278ebd=0x0;_0x278ebd<_0x287b1c['Attachments'][_0x1924('0x11')];_0x278ebd++){var _0x4222e5=_0x287b1c[_0x1924('0x3c')][_0x278ebd];_0x48139b['message'][_0x1924('0x21')][_0x1924('0x2a')]({'filename':_0x4222e5[_0x1924('0x3d')],'content':Buffer[_0x1924('0x30')](_0x4222e5[_0x1924('0x3e')])});}}}_0x3dd2a4(parseEmail(_0x50ab6c,_0x434fc4,_0x48139b));});}else{_0x434fc4['html']=_0x1924('0x3b');_0x3dd2a4(parseEmail(_0x50ab6c,_0x434fc4,_0x48139b));}}else{_0x3dd2a4(parseEmail(_0x50ab6c,_0x434fc4,_0x48139b));}};exports[_0x1924('0x3f')]=function(_0x572cb6,_0x4dc38b){var _0x230e5e=[_0x1924('0x40')+(_0x4dc38b||''),_0x1924('0x41')+_0x572cb6,'',''];return Buffer[_0x1924('0x30')](_0x230e5e[_0x1924('0x12')](''),_0x1924('0x42'))[_0x1924('0x43')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5270470..4606042 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad74=['active','Imap','Smtp','exports','lodash','name','Service','key','SERV'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xad74,0xee));var _0x4ad7=function(_0x3460e3,_0x23d874){_0x3460e3=_0x3460e3-0x0;var _0x22a450=_0xad74[_0x3460e3];return _0x22a450;};'use strict';var _=require(_0x4ad7('0x0'));function MailAccount(_0x19d949){this['id']=_0x19d949['id']||0x0;this[_0x4ad7('0x1')]=_0x19d949[_0x4ad7('0x1')]||_0x4ad7('0x2');this[_0x4ad7('0x3')]=_0x19d949['key']||_0x4ad7('0x4');this[_0x4ad7('0x5')]=_0x19d949[_0x4ad7('0x5')]||![];this[_0x4ad7('0x6')]=_0x19d949[_0x4ad7('0x6')]||[];this['Smtp']=_0x19d949[_0x4ad7('0x7')]||[];}module[_0x4ad7('0x8')]=MailAccount; \ No newline at end of file +var _0x4dfa=['Imap','Smtp','lodash','name','active'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x4dfa,0x10b));var _0xa4df=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4dfa[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa4df('0x0'));function MailAccount(_0x53321d){this['id']=_0x53321d['id']||0x0;this[_0xa4df('0x1')]=_0x53321d[_0xa4df('0x1')]||'Service';this['key']=_0x53321d['key']||'SERV';this[_0xa4df('0x2')]=_0x53321d['active']||![];this[_0xa4df('0x3')]=_0x53321d[_0xa4df('0x3')]||[];this[_0xa4df('0x4')]=_0x53321d[_0xa4df('0x4')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3756c77..ba4d204 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa38d=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','lodash','mailAccounts'];(function(_0x20f66f,_0x1be5fc){var _0x3d7d0d=function(_0x4f258f){while(--_0x4f258f){_0x20f66f['push'](_0x20f66f['shift']());}};_0x3d7d0d(++_0x1be5fc);}(_0xa38d,0xc9));var _0xda38=function(_0x5c66e7,_0x17edfd){_0x5c66e7=_0x5c66e7-0x0;var _0x43203e=_0xa38d[_0x5c66e7];return _0x43203e;};'use strict';var _=require(_0xda38('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xda38('0x1')]={};};function freeIsNotKey(_0x565370,_0x172910,_0x43d2f9){var _0x544694=_[_0xda38('0x2')](_0x565370,function(_0x48072f,_0x1d1a86){return _0x48072f[_0x43d2f9];});for(var _0x54d426 in _0x172910){if(_0x172910[_0xda38('0x3')](_0x54d426)){if(!_0x544694[_0x54d426]){delete _0x172910[_0x54d426];}}}}Realtime[_0xda38('0x4')]['mergeFromDatabase']=function(_0x5befd8,_0x56e4bf){for(var _0x1f2ab4 in _0x56e4bf){if(_0x5befd8[_0xda38('0x3')](_0x1f2ab4)){_0x5befd8[_0x1f2ab4]=_0x56e4bf[_0x1f2ab4];}}};Realtime[_0xda38('0x4')][_0xda38('0x5')]=function(){var _0x5aa068=this;return function(_0x1748a0){if(_0x1748a0){freeIsNotKey(_0x1748a0,_0x5aa068['mailAccounts'],'id');for(var _0x497560=0x0,_0x44d1ed={},_0x4d4694={};_0x497560<_0x1748a0[_0xda38('0x6')];_0x497560+=0x1){_0x44d1ed=_0x1748a0[_0x497560];if(_['isUndefined'](_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']])){_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']]=new MailAccount(_0x44d1ed);}else{_['merge'](_0x5aa068[_0xda38('0x1')][_0x44d1ed['id']],_0x44d1ed);}}}return _0x5aa068[_0xda38('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x4a5f=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','exports','lodash','mailAccounts','mapKeys'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x4a5f,0x141));var _0xf4a5=function(_0x278b30,_0x5cf8a3){_0x278b30=_0x278b30-0x0;var _0x535b59=_0x4a5f[_0x278b30];return _0x535b59;};'use strict';var _=require(_0xf4a5('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xf4a5('0x1')]={};};function freeIsNotKey(_0xb8ea5d,_0x2ccd15,_0x19f774){var _0x4e233b=_[_0xf4a5('0x2')](_0xb8ea5d,function(_0x5ce996,_0x4440b9){return _0x5ce996[_0x19f774];});for(var _0x512619 in _0x2ccd15){if(_0x2ccd15[_0xf4a5('0x3')](_0x512619)){if(!_0x4e233b[_0x512619]){delete _0x2ccd15[_0x512619];}}}}Realtime[_0xf4a5('0x4')]['mergeFromDatabase']=function(_0x456ea7,_0x19634d){for(var _0x228d0a in _0x19634d){if(_0x456ea7['hasOwnProperty'](_0x228d0a)){_0x456ea7[_0x228d0a]=_0x19634d[_0x228d0a];}}};Realtime[_0xf4a5('0x4')][_0xf4a5('0x5')]=function(){var _0x500e88=this;return function(_0x4b10e9){if(_0x4b10e9){freeIsNotKey(_0x4b10e9,_0x500e88[_0xf4a5('0x1')],'id');for(var _0x2d9201=0x0,_0x482d10={},_0x59f674={};_0x2d9201<_0x4b10e9[_0xf4a5('0x6')];_0x2d9201+=0x1){_0x482d10=_0x4b10e9[_0x2d9201];if(_[_0xf4a5('0x7')](_0x500e88[_0xf4a5('0x1')][_0x482d10['id']])){_0x500e88[_0xf4a5('0x1')][_0x482d10['id']]=new MailAccount(_0x482d10);}else{_['merge'](_0x500e88['mailAccounts'][_0x482d10['id']],_0x482d10);}}}return _0x500e88[_0xf4a5('0x1')];};};module[_0xf4a5('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 35ede00..5e0d243 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe585=['NotifyMailAccount','../client','Request','name','provider','service','email','active','key','ListId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','type','notify'];(function(_0x1e1783,_0x1be1b9){var _0xbf8e4e=function(_0x40e252){while(--_0x40e252){_0x1e1783['push'](_0x1e1783['shift']());}};_0xbf8e4e(++_0x1be1b9);}(_0xe585,0x9a));var _0x5e58=function(_0x39b054,_0x423dfa){_0x39b054=_0x39b054-0x0;var _0x2c81c7=_0xe585[_0x39b054];return _0x2c81c7;};'use strict';var client=require(_0x5e58('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x5e58('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x5e58('0x2'),_0x5e58('0x3'),_0x5e58('0x4'),_0x5e58('0x5'),_0x5e58('0x6'),_0x5e58('0x7'),_0x5e58('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x5e58('0x9'),'as':_0x5e58('0xa'),'include':[{'model':_0x5e58('0xb'),'attributes':['id',_0x5e58('0x2'),_0x5e58('0x4'),'type',_0x5e58('0xc')],'as':_0x5e58('0xb')}]},{'model':_0x5e58('0xd'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x5e58('0x2'),_0x5e58('0x4'),_0x5e58('0xe'),_0x5e58('0xc')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x5e58('0xf')]=function(_0x5d9bbf,_0xf8665c){return client[_0x5e58('0x1')](_0x5e58('0x10'),{'account':{'id':_0x5d9bbf},'body':_0xf8665c,'log':_0x5e58('0x10')});}; \ No newline at end of file +var _0x3e26=['MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service','email','active','key','ListId','TemplateId'];(function(_0x3f8ebf,_0x51e67b){var _0x134086=function(_0x377a3c){while(--_0x377a3c){_0x3f8ebf['push'](_0x3f8ebf['shift']());}};_0x134086(++_0x51e67b);}(_0x3e26,0xed));var _0x63e2=function(_0x41a0b1,_0x4a3819){_0x41a0b1=_0x41a0b1-0x0;var _0x3044ab=_0x3e26[_0x41a0b1];return _0x3044ab;};'use strict';var client=require('../client');exports[_0x63e2('0x0')]=function(){return function(){return client['Request'](_0x63e2('0x1'),{'options':{'attributes':['id',_0x63e2('0x2'),_0x63e2('0x3'),_0x63e2('0x4'),_0x63e2('0x5'),_0x63e2('0x6'),_0x63e2('0x7'),_0x63e2('0x8'),_0x63e2('0x9')],'raw':![],'include':[{'model':_0x63e2('0xa'),'as':_0x63e2('0xb'),'include':[{'model':_0x63e2('0xc'),'attributes':['id',_0x63e2('0x2'),'service',_0x63e2('0xd'),_0x63e2('0xe')],'as':_0x63e2('0xc')}]},{'model':_0x63e2('0xf'),'as':_0x63e2('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x63e2('0x2'),_0x63e2('0x4'),_0x63e2('0xd'),'data5'],'as':_0x63e2('0xc')}]}]},'log':_0x63e2('0x11')});};};exports['notify']=function(_0x3abea6,_0x18fac2){return client['Request'](_0x63e2('0x12'),{'account':{'id':_0x3abea6},'body':_0x18fac2,'log':_0x63e2('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6b353c0..abd2b8d 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfde0=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x45aa1e,_0x4679f2){var _0x1812a0=function(_0x5f3795){while(--_0x5f3795){_0x45aa1e['push'](_0x45aa1e['shift']());}};_0x1812a0(++_0x4679f2);}(_0xfde0,0x1b7));var _0x0fde=function(_0x4eb02b,_0x25a4a8){_0x4eb02b=_0x4eb02b-0x0;var _0x38db96=_0xfde0[_0x4eb02b];return _0x38db96;};'use strict';var client=require(_0x0fde('0x0'));exports[_0x0fde('0x1')]=function(){return client[_0x0fde('0x2')](_0x0fde('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0fde('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x920a=['ShowSetting','../client','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x920a,0x6a));var _0xa920=function(_0x38d774,_0x448bb5){_0x38d774=_0x38d774-0x0;var _0x3f09d4=_0x920a[_0x38d774];return _0x3f09d4;};'use strict';var client=require(_0xa920('0x0'));exports['getSettings']=function(){return client[_0xa920('0x1')](_0xa920('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 21b7b8a..a0e05c8 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 933e6fe..a2cba2d 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87f7=['../../routes','listening','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default'];(function(_0x50f30b,_0x55e888){var _0x179bc2=function(_0x1c6486){while(--_0x1c6486){_0x50f30b['push'](_0x50f30b['shift']());}};_0x179bc2(++_0x55e888);}(_0x87f7,0x10c));var _0x787f=function(_0x41b369,_0x26bc76){_0x41b369=_0x41b369-0x0;var _0x16fae1=_0x87f7[_0x41b369];return _0x16fae1;};'use strict';var _=require(_0x787f('0x0'));var http=require(_0x787f('0x1'));var express=require(_0x787f('0x2'));var sticky=require(_0x787f('0x3'));var Redis=require(_0x787f('0x4'));var config=require(_0x787f('0x5'));var app=express();var server=http[_0x787f('0x6')](app);server[_0x787f('0x7')]=0xdbba0;if(sticky[_0x787f('0x8')](server,config['port'])){var socketio=require(_0x787f('0x9'))(server,{'transports':[_0x787f('0xa'),_0x787f('0xb')]});config[_0x787f('0xc')]=_['defaults'](config['redis'],{'host':_0x787f('0xd'),'port':0x18eb});socketio[_0x787f('0xe')](require(_0x787f('0xf'))({'pubClient':new Redis(config[_0x787f('0xc')]),'subClient':new Redis(config[_0x787f('0xc')])}));require(_0x787f('0x10'))['default']();require(_0x787f('0x11'))['default'](socketio);require(_0x787f('0x12'))[_0x787f('0x13')](app);require(_0x787f('0x14'))[_0x787f('0x13')](app);}else{server['once'](_0x787f('0x15'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x787f('0x16')]);});}exports=module[_0x787f('0x17')]=app; \ No newline at end of file +var _0xfafb=['timeout','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer'];(function(_0x5f57f5,_0x48b92d){var _0x406662=function(_0x4e79d2){while(--_0x4e79d2){_0x5f57f5['push'](_0x5f57f5['shift']());}};_0x406662(++_0x48b92d);}(_0xfafb,0x77));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfaf('0x0'));var http=require(_0xbfaf('0x1'));var express=require(_0xbfaf('0x2'));var sticky=require('sticky-session');var Redis=require(_0xbfaf('0x3'));var config=require(_0xbfaf('0x4'));var app=express();var server=http[_0xbfaf('0x5')](app);server[_0xbfaf('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0xbfaf('0x7')])){var socketio=require(_0xbfaf('0x8'))(server,{'transports':[_0xbfaf('0x9'),_0xbfaf('0xa')]});config[_0xbfaf('0xb')]=_[_0xbfaf('0xc')](config['redis'],{'host':_0xbfaf('0xd'),'port':0x18eb});socketio[_0xbfaf('0xe')](require(_0xbfaf('0xf'))({'pubClient':new Redis(config[_0xbfaf('0xb')]),'subClient':new Redis(config[_0xbfaf('0xb')])}));require('../../config/triggers')[_0xbfaf('0x10')]();require(_0xbfaf('0x11'))[_0xbfaf('0x10')](socketio);require(_0xbfaf('0x12'))[_0xbfaf('0x10')](app);require(_0xbfaf('0x13'))[_0xbfaf('0x10')](app);}else{server[_0xbfaf('0x14')](_0xbfaf('0x15'),function(){console[_0xbfaf('0x16')](_0xbfaf('0x17'),config[_0xbfaf('0x7')]);});}exports=module[_0xbfaf('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5e19255..46fc797 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9267=['jayson/promise','bluebird','../../config/logger','routing','Request','request','then','rpc','error','result','catch','exports'];(function(_0x2e7430,_0xbbb287){var _0x33d63d=function(_0x43dda3){while(--_0x43dda3){_0x2e7430['push'](_0x2e7430['shift']());}};_0x33d63d(++_0xbbb287);}(_0x9267,0x1e0));var _0x7926=function(_0x2473bb,_0x5ec86f){_0x2473bb=_0x2473bb-0x0;var _0x16a632=_0x9267[_0x2473bb];return _0x16a632;};'use strict';var jayson=require(_0x7926('0x0'));var BPromise=require(_0x7926('0x1'));var logger=require(_0x7926('0x2'))(_0x7926('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x7926('0x4')]=function(_0x88e649,_0x46847d){return new BPromise(function(_0x5d3882,_0x5b4e8e){return client[_0x7926('0x5')](_0x88e649,_0x46847d)[_0x7926('0x6')](function(_0x4f6c90){logger['debug'](_0x7926('0x7'),'routing',_0x88e649,_0x46847d,_0x4f6c90);if(_0x4f6c90[_0x7926('0x8')]){logger['error'](_0x7926('0x7'),_0x7926('0x3'),_0x88e649,_0x4f6c90[_0x7926('0x8')]['message'],_0x46847d);return _0x5b4e8e(_0x4f6c90[_0x7926('0x8')]['message']);}else{return _0x5d3882(_0x4f6c90[_0x7926('0x9')]);}})[_0x7926('0xa')](function(_0x7d0d6f){logger['error']('rpc',_0x7926('0x3'),_0x88e649,_0x7d0d6f,_0x46847d);return _0x5b4e8e(_0x7d0d6f);});});};module[_0x7926('0xb')]=client; \ No newline at end of file +var _0x69cd=['then','rpc','error','routing','message','result','catch','exports','../../config/logger','client','Request','request'];(function(_0x1d7466,_0x161771){var _0x3ebbb6=function(_0x2044f6){while(--_0x2044f6){_0x1d7466['push'](_0x1d7466['shift']());}};_0x3ebbb6(++_0x161771);}(_0x69cd,0x8c));var _0xd69c=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x69cd[_0x5f25b3];return _0x4ab9bf;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xd69c('0x0'))('routing');var client=jayson[_0xd69c('0x1')]['http']({'port':0x2329});client[_0xd69c('0x2')]=function(_0x2cac68,_0x19b116){return new BPromise(function(_0x3596b9,_0x38dcc0){return client[_0xd69c('0x3')](_0x2cac68,_0x19b116)[_0xd69c('0x4')](function(_0x7cc115){logger['debug'](_0xd69c('0x5'),'routing',_0x2cac68,_0x19b116,_0x7cc115);if(_0x7cc115['error']){logger[_0xd69c('0x6')](_0xd69c('0x5'),_0xd69c('0x7'),_0x2cac68,_0x7cc115[_0xd69c('0x6')]['message'],_0x19b116);return _0x38dcc0(_0x7cc115[_0xd69c('0x6')][_0xd69c('0x8')]);}else{return _0x3596b9(_0x7cc115[_0xd69c('0x9')]);}})[_0xd69c('0xa')](function(_0x5bdd3d){logger[_0xd69c('0x6')]('rpc','routing',_0x2cac68,_0x5bdd3d,_0x19b116);return _0x38dcc0(_0x5bdd3d);});});};module[_0xd69c('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 015f966..a9bd672 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa1b=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xfa1b,0x14a));var _0xbfa1=function(_0x4af727,_0x42ef49){_0x4af727=_0x4af727-0x0;var _0xc5b2d0=_0xfa1b[_0x4af727];return _0xc5b2d0;};'use strict';var BPromise=require(_0xbfa1('0x0'));var server=require(_0xbfa1('0x1'));var Realtime=require(_0xbfa1('0x2'));var user=require('./rpc/user');var interval=require(_0xbfa1('0x3'));var openchannelQueue=require(_0xbfa1('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xbfa1('0x5'));var mailQueue=require(_0xbfa1('0x6'));var faxQueue=require(_0xbfa1('0x7'));var whatsappQueue=require(_0xbfa1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbfa1('0x9')]()[_0xbfa1('0xa')](user[_0xbfa1('0xb')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0xc')]())[_0xbfa1('0xa')](interval['getIntervals']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xd')]())[_0xbfa1('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xe')]())['then'](chatQueue['getChatQueues']())[_0xbfa1('0xa')](realtime[_0xbfa1('0xf')]())[_0xbfa1('0xa')](smsQueue[_0xbfa1('0x10')]())['then'](realtime[_0xbfa1('0x11')]())[_0xbfa1('0xa')](mailQueue[_0xbfa1('0x12')]())['then'](realtime[_0xbfa1('0x13')]())[_0xbfa1('0xa')](faxQueue[_0xbfa1('0x14')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0x15')]())[_0xbfa1('0xa')](whatsappQueue[_0xbfa1('0x16')]())[_0xbfa1('0xa')](realtime[_0xbfa1('0x17')]())[_0xbfa1('0xa')](function(){return realtime;});}function main(){return server[_0xbfa1('0x18')](realtime)[_0xbfa1('0xa')](function(_0x2f5741){return initRealtime();})[_0xbfa1('0xa')](function(_0x5a900d){return setInterval(initRealtime,0x1388);})[_0xbfa1('0x19')](function(_0x23e70a){console[_0xbfa1('0x1a')](_0x23e70a);});}main(); \ No newline at end of file +var _0x2eea=['initIntervals','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','initAgents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eea,0xdb));var _0xa2ee=function(_0x3abc68,_0x157ff8){_0x3abc68=_0x3abc68-0x0;var _0x1c040c=_0x2eea[_0x3abc68];return _0x1c040c;};'use strict';var BPromise=require(_0xa2ee('0x0'));var server=require(_0xa2ee('0x1'));var Realtime=require(_0xa2ee('0x2'));var user=require(_0xa2ee('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xa2ee('0x4'));var chatQueue=require(_0xa2ee('0x5'));var smsQueue=require(_0xa2ee('0x6'));var mailQueue=require(_0xa2ee('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xa2ee('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa2ee('0x9')]()['then'](user['getAgents']())[_0xa2ee('0xa')](realtime[_0xa2ee('0xb')]())['then'](interval['getIntervals']())[_0xa2ee('0xa')](realtime[_0xa2ee('0xc')]())[_0xa2ee('0xa')](openchannelQueue['getOpenchannelQueues']())[_0xa2ee('0xa')](realtime[_0xa2ee('0xd')]())[_0xa2ee('0xa')](chatQueue['getChatQueues']())[_0xa2ee('0xa')](realtime[_0xa2ee('0xe')]())['then'](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())['then'](mailQueue[_0xa2ee('0xf')]())[_0xa2ee('0xa')](realtime[_0xa2ee('0x10')]())[_0xa2ee('0xa')](faxQueue[_0xa2ee('0x11')]())[_0xa2ee('0xa')](realtime['initFaxQueues']())[_0xa2ee('0xa')](whatsappQueue[_0xa2ee('0x12')]())[_0xa2ee('0xa')](realtime[_0xa2ee('0x13')]())[_0xa2ee('0xa')](function(){return realtime;});}function main(){return server[_0xa2ee('0x14')](realtime)[_0xa2ee('0xa')](function(_0x344bc6){return initRealtime();})[_0xa2ee('0xa')](function(_0x43fd87){return setInterval(initRealtime,0x1388);})['catch'](function(_0x741807){console['log'](_0x741807);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 0efe5cd..925d7c7 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4f219b,_0x841f7e){var _0x8a7718=function(_0x3e8f25){while(--_0x3e8f25){_0x4f219b['push'](_0x4f219b['shift']());}};_0x8a7718(++_0x841f7e);}(_0x326f,0xd1));var _0xf326=function(_0x219514,_0x585ad0){_0x219514=_0x219514-0x0;var _0x174362=_0x326f[_0x219514];return _0x174362;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x30cf8d,_0x286354){_0x30cf8d=_0x30cf8d-0x0;var _0x92e924=_0x1261[_0x30cf8d];return _0x92e924;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 16f4060..8e1c4f8 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1088=['bluebird','client','http','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x3f5522,_0x28e324){var _0x4731f1=function(_0xfe154){while(--_0xfe154){_0x3f5522['push'](_0x3f5522['shift']());}};_0x4731f1(++_0x28e324);}(_0x1088,0xdc));var _0x8108=function(_0x3529e7,_0x50bf14){_0x3529e7=_0x3529e7-0x0;var _0xc25ae7=_0x1088[_0x3529e7];return _0xc25ae7;};'use strict';var BPromise=require(_0x8108('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8108('0x1')][_0x8108('0x2')]({'port':0x232b});function request(_0x3d2244,_0x55d659){return new BPromise(function(_0x374100,_0x171059){return client[_0x8108('0x3')](_0x3d2244,_0x55d659)[_0x8108('0x4')](function(_0x50a91e){if(_0x50a91e[_0x8108('0x5')]){return _0x171059(_0x50a91e[_0x8108('0x5')][_0x8108('0x6')]);}else{return _0x374100(_0x50a91e['result']);}})[_0x8108('0x7')](function(_0x38fdcb){return _0x171059(_0x38fdcb);});});}exports[_0x8108('0x8')]=function(_0x30ab59,_0x415c6f){return request(_0x8108('0x9'),{'account':_0x30ab59,'message':_0x415c6f});}; \ No newline at end of file +var _0x4442=['then','error','result','bluebird','jayson/promise','client','http'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0x4442,0x73));var _0x2444=function(_0x5edcd3,_0x49d08c){_0x5edcd3=_0x5edcd3-0x0;var _0x5887cf=_0x4442[_0x5edcd3];return _0x5887cf;};'use strict';var BPromise=require(_0x2444('0x0'));var jayson=require(_0x2444('0x1'));var client=jayson[_0x2444('0x2')][_0x2444('0x3')]({'port':0x232b});function request(_0x45fd9e,_0x2ca46e){return new BPromise(function(_0x43806b,_0x3f77cd){return client['request'](_0x45fd9e,_0x2ca46e)[_0x2444('0x4')](function(_0x8027d3){if(_0x8027d3[_0x2444('0x5')]){return _0x3f77cd(_0x8027d3['error']['message']);}else{return _0x43806b(_0x8027d3[_0x2444('0x6')]);}})['catch'](function(_0x46fbe7){return _0x3f77cd(_0x46fbe7);});});}exports['sendMailMessage']=function(_0x31f4c4,_0x4388cb){return request('SendMail',{'account':_0x31f4c4,'message':_0x4388cb});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2f59eb3..619c65c 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x80e4=['whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','whatsapp','Status','toNumber','mailStatus','smsStatus','whatsappStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','unknown','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity'];(function(_0x297856,_0xd3d540){var _0x413d73=function(_0x545c8a){while(--_0x545c8a){_0x297856['push'](_0x297856['shift']());}};_0x413d73(++_0xd3d540);}(_0x80e4,0x103));var _0x480e=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x80e4[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x480e('0x0'));var moment=require(_0x480e('0x1'));var md5=require(_0x480e('0x2'));var Redis=require('ioredis');var config=require(_0x480e('0x3'));config[_0x480e('0x4')]=_[_0x480e('0x5')](config[_0x480e('0x4')],{'host':_0x480e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x480e('0x4')]));function Agent(_0x621c93){this['id']=_0x621c93['id']||0x0;this[_0x480e('0x7')]=_0x621c93[_0x480e('0x7')]||'';this[_0x480e('0x8')]=_0x621c93[_0x480e('0x8')]||!![];this[_0x480e('0x9')]=_0x621c93[_0x480e('0x9')]||![];this[_0x480e('0xa')]=_0x621c93[_0x480e('0xa')]||![];this[_0x480e('0xb')]=_0x621c93[_0x480e('0xb')]||![];this['faxPause']=_0x621c93[_0x480e('0xc')]||![];this[_0x480e('0xd')]=_0x621c93[_0x480e('0xd')]||![];this[_0x480e('0xe')]=_0x621c93[_0x480e('0xe')]||![];this[_0x480e('0xf')]='unknown';this[_0x480e('0x10')]=0x0;this[_0x480e('0x11')]=_0x621c93[_0x480e('0x11')]||0x0;this[_0x480e('0x12')]=0x0;this['mailStatus']=_0x480e('0x13');this[_0x480e('0x14')]=0x0;this[_0x480e('0x15')]=_0x621c93[_0x480e('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x480e('0x16')]='unknown';this[_0x480e('0x17')]=0x0;this[_0x480e('0x18')]=_0x621c93[_0x480e('0x18')]||0x0;this[_0x480e('0x19')]=0x0;this['smsStatus']=_0x480e('0x13');this[_0x480e('0x1a')]=0x0;this[_0x480e('0x1b')]=_0x621c93[_0x480e('0x1b')]||0x0;this[_0x480e('0x1c')]=0x0;this[_0x480e('0x1d')]=_0x480e('0x13');this['whatsappStatusTime']=0x0;this[_0x480e('0x1e')]=_0x621c93['whatsappCapacity']||0x0;this[_0x480e('0x1f')]=0x0;this[_0x480e('0x20')]=_0x480e('0x13');this[_0x480e('0x21')]=0x0;this[_0x480e('0x22')]=_0x621c93[_0x480e('0x22')]||0x0;this[_0x480e('0x23')]=0x0;this[_0x480e('0x24')]=![];this[_0x480e('0x25')]=undefined;this[_0x480e('0x2')]='';this['updateRealtime']();}Agent[_0x480e('0x26')][_0x480e('0x27')]=function(_0x3534f9){if(this[_0x3534f9+_0x480e('0x28')]>0x0){if(this[_0x3534f9+'Capacity']>0x0&&this[_0x3534f9+_0x480e('0x28')]>=this[_0x3534f9+_0x480e('0x29')]){return _0x480e('0x2a');}else{return _0x480e('0x2b');}}else{return _0x480e('0x2c');}};Agent[_0x480e('0x26')][_0x480e('0x2d')]=function(){var _0x53fb1b=['mail',_0x480e('0x2e'),_0x480e('0x2f'),'fax','sms',_0x480e('0x30')];for(var _0x1f095d=0x0;_0x1f095d<_0x53fb1b['length'];_0x1f095d+=0x1){var _0x712e65=this['getChannelStatus'](_0x53fb1b[_0x1f095d]);if(this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]!==_0x712e65){this[_0x53fb1b[_0x1f095d]+'StatusTime']=_[_0x480e('0x32')](moment()['format']('x'));}this[_0x53fb1b[_0x1f095d]+_0x480e('0x31')]=_0x712e65;}var _0x3bc0b0={'id':this['id'],'name':this['name'],'online':this[_0x480e('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x480e('0xa')],'mailPause':this[_0x480e('0xb')],'smsPause':this[_0x480e('0xd')],'faxPause':this[_0x480e('0xc')],'openchannelPause':this[_0x480e('0xe')],'chatStatus':this[_0x480e('0xf')],'chatStatusTime':this[_0x480e('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x480e('0x33')],'mailStatusTime':this[_0x480e('0x14')],'mailCapacity':this[_0x480e('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x480e('0x16')],'faxStatusTime':this[_0x480e('0x17')],'faxCapacity':this[_0x480e('0x18')],'faxCurrentCapacity':this[_0x480e('0x19')],'smsStatus':this[_0x480e('0x34')],'smsStatusTime':this[_0x480e('0x1a')],'smsCapacity':this[_0x480e('0x1b')],'smsCurrentCapacity':this[_0x480e('0x1c')],'whatsappStatus':this[_0x480e('0x1d')],'whatsappStatusTime':this[_0x480e('0x35')],'whatsappCapacity':this[_0x480e('0x1e')],'whatsappCurrentCapacity':this[_0x480e('0x1f')],'openchannelStatus':this[_0x480e('0x20')],'openchannelStatusTime':this[_0x480e('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x480e('0x23')],'busy':this[_0x480e('0x24')],'busyQueue':this['busyQueue']};var _0x8152bc=md5(JSON[_0x480e('0x36')](_0x3bc0b0));if(this[_0x480e('0x2')]!==_0x8152bc){this['md5']=_0x8152bc;io[_0x480e('0x37')](_0x480e('0x38'),_0x3bc0b0);}};module[_0x480e('0x39')]=Agent; \ No newline at end of file +var _0xe1fc=['emit','user:save','exports','lodash','md5','ioredis','redis','defaults','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','voicePause','busyQueue','stringify'];(function(_0x120053,_0x352a20){var _0x1a7566=function(_0xebf5af){while(--_0xebf5af){_0x120053['push'](_0x120053['shift']());}};_0x1a7566(++_0x352a20);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xe1fc[_0x264545];return _0x114d10;};'use strict';var _=require(_0xce1f('0x0'));var moment=require('moment');var md5=require(_0xce1f('0x1'));var Redis=require(_0xce1f('0x2'));var config=require('../../../config/environment');config[_0xce1f('0x3')]=_[_0xce1f('0x4')](config[_0xce1f('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xce1f('0x5'))(new Redis(config[_0xce1f('0x3')]));function Agent(_0x4668ec){this['id']=_0x4668ec['id']||0x0;this[_0xce1f('0x6')]=_0x4668ec[_0xce1f('0x6')]||'';this[_0xce1f('0x7')]=_0x4668ec['online']||!![];this['voicePause']=_0x4668ec['voicePause']||![];this[_0xce1f('0x8')]=_0x4668ec[_0xce1f('0x8')]||![];this[_0xce1f('0x9')]=_0x4668ec[_0xce1f('0x9')]||![];this[_0xce1f('0xa')]=_0x4668ec[_0xce1f('0xa')]||![];this[_0xce1f('0xb')]=_0x4668ec[_0xce1f('0xb')]||![];this[_0xce1f('0xc')]=_0x4668ec[_0xce1f('0xc')]||![];this[_0xce1f('0xd')]='unknown';this[_0xce1f('0xe')]=0x0;this[_0xce1f('0xf')]=_0x4668ec[_0xce1f('0xf')]||0x0;this[_0xce1f('0x10')]=0x0;this[_0xce1f('0x11')]=_0xce1f('0x12');this[_0xce1f('0x13')]=0x0;this[_0xce1f('0x14')]=_0x4668ec[_0xce1f('0x14')]||0x0;this[_0xce1f('0x15')]=0x0;this[_0xce1f('0x16')]=_0xce1f('0x12');this[_0xce1f('0x17')]=0x0;this[_0xce1f('0x18')]=_0x4668ec['faxCapacity']||0x0;this[_0xce1f('0x19')]=0x0;this[_0xce1f('0x1a')]=_0xce1f('0x12');this[_0xce1f('0x1b')]=0x0;this[_0xce1f('0x1c')]=_0x4668ec[_0xce1f('0x1c')]||0x0;this[_0xce1f('0x1d')]=0x0;this[_0xce1f('0x1e')]=_0xce1f('0x12');this[_0xce1f('0x1f')]=0x0;this[_0xce1f('0x20')]=_0x4668ec[_0xce1f('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xce1f('0x21')]=_0xce1f('0x12');this[_0xce1f('0x22')]=0x0;this['openchannelCapacity']=_0x4668ec[_0xce1f('0x23')]||0x0;this[_0xce1f('0x24')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0xce1f('0x1')]='';this[_0xce1f('0x25')]();}Agent[_0xce1f('0x26')][_0xce1f('0x27')]=function(_0x1ea84c){if(this[_0x1ea84c+_0xce1f('0x28')]>0x0){if(this[_0x1ea84c+_0xce1f('0x29')]>0x0&&this[_0x1ea84c+_0xce1f('0x28')]>=this[_0x1ea84c+'Capacity']){return _0xce1f('0x2a');}else{return'working';}}else{return'idle';}};Agent[_0xce1f('0x26')]['updateRealtime']=function(){var _0x2f808d=[_0xce1f('0x2b'),_0xce1f('0x2c'),_0xce1f('0x2d'),_0xce1f('0x2e'),_0xce1f('0x2f'),_0xce1f('0x30')];for(var _0x3fc180=0x0;_0x3fc180<_0x2f808d[_0xce1f('0x31')];_0x3fc180+=0x1){var _0x24e3d9=this[_0xce1f('0x27')](_0x2f808d[_0x3fc180]);if(this[_0x2f808d[_0x3fc180]+_0xce1f('0x32')]!==_0x24e3d9){this[_0x2f808d[_0x3fc180]+_0xce1f('0x33')]=_[_0xce1f('0x34')](moment()[_0xce1f('0x35')]('x'));}this[_0x2f808d[_0x3fc180]+_0xce1f('0x32')]=_0x24e3d9;}var _0x418be6={'id':this['id'],'name':this[_0xce1f('0x6')],'online':this[_0xce1f('0x7')],'voicePause':this[_0xce1f('0x36')],'chatPause':this[_0xce1f('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0xce1f('0xa')],'openchannelPause':this[_0xce1f('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xce1f('0xf')],'chatCurrentCapacity':this[_0xce1f('0x10')],'mailStatus':this[_0xce1f('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xce1f('0x15')],'faxStatus':this[_0xce1f('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xce1f('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xce1f('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xce1f('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xce1f('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xce1f('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xce1f('0x21')],'openchannelStatusTime':this[_0xce1f('0x22')],'openchannelCapacity':this[_0xce1f('0x23')],'openchannelCurrentCapacity':this[_0xce1f('0x24')],'busy':this['busy'],'busyQueue':this[_0xce1f('0x37')]};var _0x8a7f80=md5(JSON[_0xce1f('0x38')](_0x418be6));if(this['md5']!==_0x8a7f80){this[_0xce1f('0x1')]=_0x8a7f80;io[_0xce1f('0x39')](_0xce1f('0x3a'),_0x418be6);}};module[_0xce1f('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 94b23b0..574a0f7 100644 --- a/server/services/routing/model/chatQueue.js +++ b/server/services/routing/model/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97a6=['prototype','updateRouting','map','_rr','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime'];(function(_0x435163,_0x1627b6){var _0x227697=function(_0x20dccc){while(--_0x20dccc){_0x435163['push'](_0x435163['shift']());}};_0x227697(++_0x1627b6);}(_0x97a6,0x158));var _0x697a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x697a('0x0'));var util=require(_0x697a('0x1'));var Redis=require(_0x697a('0x2'));var config=require(_0x697a('0x3'));config[_0x697a('0x4')]=_[_0x697a('0x5')](config['redis'],{'host':_0x697a('0x6'),'port':0x18eb});var io=require(_0x697a('0x7'))(new Redis(config[_0x697a('0x4')]));function ChatQueue(_0x564fbc){this['id']=_0x564fbc['id']||0x0;this[_0x697a('0x8')]=_0x564fbc['name']||'';this['timeout']=_0x564fbc[_0x697a('0x9')]||0xa;this[_0x697a('0xa')]=_0x564fbc[_0x697a('0xa')]||_0x697a('0xb');this[_0x697a('0xc')]=_0x564fbc[_0x697a('0xc')];this[_0x697a('0xd')]={};this[_0x697a('0xe')]=0x0;this[_0x697a('0x0')]='';this['updateRouting']();this[_0x697a('0xf')]();}ChatQueue[_0x697a('0x10')][_0x697a('0x11')]=function(){var _0x975a36=this[_0x697a('0xd')]['_rr'];this[_0x697a('0xd')]=_[_0x697a('0x12')](this[_0x697a('0xc')],'id');this[_0x697a('0xd')][_0x697a('0x13')]=_0x975a36;};ChatQueue[_0x697a('0x10')][_0x697a('0xf')]=function(){this[_0x697a('0x14')]=0x0;this[_0x697a('0x15')]=0x0;for(var _0x16fe66=0x0;_0x16fe66=0x0?this[_0x697a('0x19')]:0x0;var _0x3e851e={'id':this['id'],'available':this[_0x697a('0x19')],'loggedIn':this[_0x697a('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x697a('0xe')]};var _0x2005bd=md5(JSON['stringify'](_0x3e851e));if(this[_0x697a('0x0')]!==_0x2005bd){this[_0x697a('0x0')]=_0x2005bd;io['to'](util[_0x697a('0x1a')](_0x697a('0x1b'),_0x3e851e[_0x697a('0x8')]))[_0x697a('0x1c')]('chat_queue:save',_0x3e851e);}};module[_0x697a('0x1d')]=ChatQueue; \ No newline at end of file +var _0x356a=['loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x9eb369,_0x4a4c46){var _0x3925e3=function(_0x7324a5){while(--_0x7324a5){_0x9eb369['push'](_0x9eb369['shift']());}};_0x3925e3(++_0x4a4c46);}(_0x356a,0xc5));var _0xa356=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x356a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa356('0x0'));var md5=require(_0xa356('0x1'));var util=require(_0xa356('0x2'));var Redis=require(_0xa356('0x3'));var config=require('../../../config/environment');config['redis']=_[_0xa356('0x4')](config[_0xa356('0x5')],{'host':_0xa356('0x6'),'port':0x18eb});var io=require(_0xa356('0x7'))(new Redis(config[_0xa356('0x5')]));function ChatQueue(_0x477ce2){this['id']=_0x477ce2['id']||0x0;this[_0xa356('0x8')]=_0x477ce2[_0xa356('0x8')]||'';this[_0xa356('0x9')]=_0x477ce2[_0xa356('0x9')]||0xa;this[_0xa356('0xa')]=_0x477ce2[_0xa356('0xa')]||_0xa356('0xb');this[_0xa356('0xc')]=_0x477ce2[_0xa356('0xc')];this[_0xa356('0xd')]={};this[_0xa356('0xe')]=0x0;this[_0xa356('0x1')]='';this[_0xa356('0xf')]();this[_0xa356('0x10')]();}ChatQueue[_0xa356('0x11')][_0xa356('0xf')]=function(){var _0x332717=this[_0xa356('0xd')][_0xa356('0x12')];this[_0xa356('0xd')]=_[_0xa356('0x13')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x332717;};ChatQueue[_0xa356('0x11')]['updateRealtime']=function(){this[_0xa356('0x14')]=0x0;this[_0xa356('0x15')]=0x0;for(var _0x3e5eda=0x0;_0x3e5eda=0x0?this['available']:0x0;var _0x387144={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x5cc67a=md5(JSON[_0xa356('0x1a')](_0x387144));if(this['md5']!==_0x5cc67a){this[_0xa356('0x1')]=_0x5cc67a;io['to'](util[_0xa356('0x1b')](_0xa356('0x1c'),_0x387144[_0xa356('0x8')]))[_0xa356('0x1d')](_0xa356('0x1e'),_0x387144);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4149448..0b5adaf 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5e0=['emit','fax_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','_rr','prototype','updateRealtime','loggedIn','paused','length','faxPause','available','format','fax:queue:%s'];(function(_0x20d33b,_0x1066f5){var _0x26450c=function(_0x316e34){while(--_0x316e34){_0x20d33b['push'](_0x20d33b['shift']());}};_0x26450c(++_0x1066f5);}(_0xa5e0,0x9e));var _0x0a5e=function(_0x409853,_0x28b80d){_0x409853=_0x409853-0x0;var _0x3127b8=_0xa5e0[_0x409853];return _0x3127b8;};'use strict';var _=require('lodash');var md5=require(_0x0a5e('0x0'));var util=require('util');var Redis=require(_0x0a5e('0x1'));var config=require(_0x0a5e('0x2'));config[_0x0a5e('0x3')]=_[_0x0a5e('0x4')](config[_0x0a5e('0x3')],{'host':_0x0a5e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a5e('0x3')]));function FaxQueue(_0x4abfbc){this['id']=_0x4abfbc['id']||0x0;this[_0x0a5e('0x6')]=_0x4abfbc['name']||'';this['timeout']=_0x4abfbc[_0x0a5e('0x7')]||0xa;this['strategy']=_0x4abfbc[_0x0a5e('0x8')]||'beepall';this[_0x0a5e('0x9')]=_0x4abfbc['Agents'];this[_0x0a5e('0xa')]={};this[_0x0a5e('0xb')]=0x0;this['md5']='';this[_0x0a5e('0xc')]();this['updateRealtime']();}FaxQueue['prototype'][_0x0a5e('0xc')]=function(){var _0x49a8f7=this[_0x0a5e('0xa')]['_rr'];this['mapAgentsId']=_[_0x0a5e('0xd')](this['Agents'],'id');this[_0x0a5e('0xa')][_0x0a5e('0xe')]=_0x49a8f7;};FaxQueue[_0x0a5e('0xf')][_0x0a5e('0x10')]=function(){this[_0x0a5e('0x11')]=0x0;this[_0x0a5e('0x12')]=0x0;for(var _0x20f77d=0x0;_0x20f77d=0x0?this[_0x0a5e('0x15')]:0x0;var _0x26ccb3={'id':this['id'],'available':this[_0x0a5e('0x15')],'loggedIn':this[_0x0a5e('0x11')],'name':this['name'],'paused':this[_0x0a5e('0x12')],'waiting':this['waiting']};var _0x4eb297=md5(JSON['stringify'](_0x26ccb3));if(this[_0x0a5e('0x0')]!==_0x4eb297){this[_0x0a5e('0x0')]=_0x4eb297;io['to'](util[_0x0a5e('0x16')](_0x0a5e('0x17'),_0x26ccb3[_0x0a5e('0x6')]))[_0x0a5e('0x18')](_0x0a5e('0x19'),_0x26ccb3);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x3a28=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','format','fax:queue:%s','fax_queue:save','exports','lodash','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x4d908f,_0x4bbb92){var _0x92ad41=function(_0x40c16f){while(--_0x40c16f){_0x4d908f['push'](_0x4d908f['shift']());}};_0x92ad41(++_0x4bbb92);}(_0x3a28,0x180));var _0x83a2=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x3a28[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x83a2('0x0'));var md5=require('md5');var util=require(_0x83a2('0x1'));var Redis=require('ioredis');var config=require(_0x83a2('0x2'));config[_0x83a2('0x3')]=_['defaults'](config['redis'],{'host':_0x83a2('0x4'),'port':0x18eb});var io=require(_0x83a2('0x5'))(new Redis(config[_0x83a2('0x3')]));function FaxQueue(_0x10968f){this['id']=_0x10968f['id']||0x0;this['name']=_0x10968f[_0x83a2('0x6')]||'';this[_0x83a2('0x7')]=_0x10968f[_0x83a2('0x7')]||0xa;this[_0x83a2('0x8')]=_0x10968f[_0x83a2('0x8')]||_0x83a2('0x9');this[_0x83a2('0xa')]=_0x10968f['Agents'];this[_0x83a2('0xb')]={};this[_0x83a2('0xc')]=0x0;this[_0x83a2('0xd')]='';this['updateRouting']();this[_0x83a2('0xe')]();}FaxQueue[_0x83a2('0xf')]['updateRouting']=function(){var _0xbb4710=this[_0x83a2('0xb')][_0x83a2('0x10')];this[_0x83a2('0xb')]=_[_0x83a2('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x83a2('0x10')]=_0xbb4710;};FaxQueue[_0x83a2('0xf')][_0x83a2('0xe')]=function(){this[_0x83a2('0x12')]=0x0;this[_0x83a2('0x13')]=0x0;for(var _0xfc726d=0x0;_0xfc726d=0x0?this['available']:0x0;var _0x39aa22={'id':this['id'],'available':this[_0x83a2('0x17')],'loggedIn':this[_0x83a2('0x12')],'name':this[_0x83a2('0x6')],'paused':this[_0x83a2('0x13')],'waiting':this[_0x83a2('0xc')]};var _0x3e48bf=md5(JSON['stringify'](_0x39aa22));if(this['md5']!==_0x3e48bf){this['md5']=_0x3e48bf;io['to'](util[_0x83a2('0x18')](_0x83a2('0x19'),_0x39aa22[_0x83a2('0x6')]))['emit'](_0x83a2('0x1a'),_0x39aa22);}};module[_0x83a2('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 16588cb..0a748fc 100644 --- a/server/services/routing/model/interval.js +++ b/server/services/routing/model/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd143=['name','Intervals'];(function(_0x4992be,_0x555abf){var _0x39e44e=function(_0x286e9f){while(--_0x286e9f){_0x4992be['push'](_0x4992be['shift']());}};_0x39e44e(++_0x555abf);}(_0xd143,0x1ae));var _0x3d14=function(_0x421a02,_0x28f532){_0x421a02=_0x421a02-0x0;var _0x387292=_0xd143[_0x421a02];return _0x387292;};'use strict';function Interval(_0xc7467b){this['id']=_0xc7467b['id']||0x0;this['name']=_0xc7467b[_0x3d14('0x0')]||'';this['Intervals']=_0xc7467b[_0x3d14('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x251a=['Intervals','exports','name'];(function(_0x20cd63,_0x1cd64c){var _0x360f0c=function(_0x5eac63){while(--_0x5eac63){_0x20cd63['push'](_0x20cd63['shift']());}};_0x360f0c(++_0x1cd64c);}(_0x251a,0x140));var _0xa251=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0x251a[_0x4e11e7];return _0x1d7d39;};'use strict';function Interval(_0x1e8770){this['id']=_0x1e8770['id']||0x0;this[_0xa251('0x0')]=_0x1e8770['name']||'';this[_0xa251('0x1')]=_0x1e8770[_0xa251('0x1')]||{};}module[_0xa251('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index b1ff99d..4c6c5d5 100644 --- a/server/services/routing/model/mailQueue.js +++ b/server/services/routing/model/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5e1=['_rr','map','loggedIn','paused','length','mailPause','available','format','mail:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0x1c5c40,_0x352417){var _0x5be7f8=function(_0x4251ed){while(--_0x4251ed){_0x1c5c40['push'](_0x1c5c40['shift']());}};_0x5be7f8(++_0x352417);}(_0xe5e1,0x92));var _0x1e5e=function(_0x5397f2,_0x1b5a17){_0x5397f2=_0x5397f2-0x0;var _0x4bae87=_0xe5e1[_0x5397f2];return _0x4bae87;};'use strict';var _=require(_0x1e5e('0x0'));var md5=require(_0x1e5e('0x1'));var util=require('util');var Redis=require(_0x1e5e('0x2'));var config=require(_0x1e5e('0x3'));config[_0x1e5e('0x4')]=_[_0x1e5e('0x5')](config[_0x1e5e('0x4')],{'host':_0x1e5e('0x6'),'port':0x18eb});var io=require(_0x1e5e('0x7'))(new Redis(config[_0x1e5e('0x4')]));function MailQueue(_0x2973ee){this['id']=_0x2973ee['id']||0x0;this[_0x1e5e('0x8')]=_0x2973ee[_0x1e5e('0x8')]||'';this[_0x1e5e('0x9')]=_0x2973ee[_0x1e5e('0x9')]||0xa;this[_0x1e5e('0xa')]=_0x2973ee['strategy']||'beepall';this[_0x1e5e('0xb')]=_0x2973ee[_0x1e5e('0xb')];this[_0x1e5e('0xc')]={};this['waiting']=0x0;this[_0x1e5e('0x1')]='';this[_0x1e5e('0xd')]();this[_0x1e5e('0xe')]();}MailQueue[_0x1e5e('0xf')][_0x1e5e('0xd')]=function(){var _0x4b6093=this['mapAgentsId'][_0x1e5e('0x10')];this[_0x1e5e('0xc')]=_[_0x1e5e('0x11')](this[_0x1e5e('0xb')],'id');this[_0x1e5e('0xc')][_0x1e5e('0x10')]=_0x4b6093;};MailQueue[_0x1e5e('0xf')]['updateRealtime']=function(){this[_0x1e5e('0x12')]=0x0;this[_0x1e5e('0x13')]=0x0;for(var _0xfa3886=0x0;_0xfa3886=0x0?this[_0x1e5e('0x16')]:0x0;var _0x4c4c1f={'id':this['id'],'available':this[_0x1e5e('0x16')],'loggedIn':this[_0x1e5e('0x12')],'name':this[_0x1e5e('0x8')],'paused':this[_0x1e5e('0x13')],'waiting':this['waiting']};var _0x597d8a=md5(JSON['stringify'](_0x4c4c1f));if(this['md5']!==_0x597d8a){this[_0x1e5e('0x1')]=_0x597d8a;io['to'](util[_0x1e5e('0x17')](_0x1e5e('0x18'),_0x4c4c1f['name']))[_0x1e5e('0x19')]('mail_queue:save',_0x4c4c1f);}};module[_0x1e5e('0x1a')]=MailQueue; \ No newline at end of file +var _0xfabd=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xfabd,0x17e));var _0xdfab=function(_0x2845fb,_0x53ea63){_0x2845fb=_0x2845fb-0x0;var _0x10ead4=_0xfabd[_0x2845fb];return _0x10ead4;};'use strict';var _=require('lodash');var md5=require(_0xdfab('0x0'));var util=require(_0xdfab('0x1'));var Redis=require(_0xdfab('0x2'));var config=require(_0xdfab('0x3'));config[_0xdfab('0x4')]=_[_0xdfab('0x5')](config[_0xdfab('0x4')],{'host':_0xdfab('0x6'),'port':0x18eb});var io=require(_0xdfab('0x7'))(new Redis(config[_0xdfab('0x4')]));function MailQueue(_0x491571){this['id']=_0x491571['id']||0x0;this[_0xdfab('0x8')]=_0x491571[_0xdfab('0x8')]||'';this[_0xdfab('0x9')]=_0x491571[_0xdfab('0x9')]||0xa;this[_0xdfab('0xa')]=_0x491571[_0xdfab('0xa')]||'beepall';this[_0xdfab('0xb')]=_0x491571[_0xdfab('0xb')];this[_0xdfab('0xc')]={};this[_0xdfab('0xd')]=0x0;this[_0xdfab('0x0')]='';this[_0xdfab('0xe')]();this[_0xdfab('0xf')]();}MailQueue['prototype']['updateRouting']=function(){var _0x54bfca=this[_0xdfab('0xc')][_0xdfab('0x10')];this[_0xdfab('0xc')]=_['map'](this[_0xdfab('0xb')],'id');this[_0xdfab('0xc')][_0xdfab('0x10')]=_0x54bfca;};MailQueue[_0xdfab('0x11')][_0xdfab('0xf')]=function(){this[_0xdfab('0x12')]=0x0;this['paused']=0x0;for(var _0x468f5e=0x0;_0x468f5e=0x0?this[_0xdfab('0x15')]:0x0;var _0x47f24c={'id':this['id'],'available':this[_0xdfab('0x15')],'loggedIn':this[_0xdfab('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x2b7156=md5(JSON[_0xdfab('0x16')](_0x47f24c));if(this[_0xdfab('0x0')]!==_0x2b7156){this[_0xdfab('0x0')]=_0x2b7156;io['to'](util[_0xdfab('0x17')](_0xdfab('0x18'),_0x47f24c[_0xdfab('0x8')]))[_0xdfab('0x19')](_0xdfab('0x1a'),_0x47f24c);}};module[_0xdfab('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index eb1a3fb..c5e66be 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1261,0x144));var _0x1126=function(_0x2d6d88,_0x2ea070){_0x2d6d88=_0x2d6d88-0x0;var _0x1991b0=_0x1261[_0x2d6d88];return _0x1991b0;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x1261,0x144));var _0x1126=function(_0x3b0515,_0x1fa41d){_0x3b0515=_0x3b0515-0x0;var _0x198d7a=_0x1261[_0x3b0515];return _0x198d7a;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ab33ded..a548876 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2b3=['waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x237cb1,_0x59915a){var _0x1b6419=function(_0x2fe611){while(--_0x2fe611){_0x237cb1['push'](_0x237cb1['shift']());}};_0x1b6419(++_0x59915a);}(_0xb2b3,0x71));var _0x3b2b=function(_0x3ffefd,_0x195e55){_0x3ffefd=_0x3ffefd-0x0;var _0x3478e8=_0xb2b3[_0x3ffefd];return _0x3478e8;};'use strict';var _=require(_0x3b2b('0x0'));var md5=require(_0x3b2b('0x1'));var util=require(_0x3b2b('0x2'));var Redis=require(_0x3b2b('0x3'));var config=require(_0x3b2b('0x4'));config[_0x3b2b('0x5')]=_[_0x3b2b('0x6')](config['redis'],{'host':_0x3b2b('0x7'),'port':0x18eb});var io=require(_0x3b2b('0x8'))(new Redis(config[_0x3b2b('0x5')]));function SmsQueue(_0x45e179){this['id']=_0x45e179['id']||0x0;this[_0x3b2b('0x9')]=_0x45e179[_0x3b2b('0x9')]||'';this[_0x3b2b('0xa')]=_0x45e179[_0x3b2b('0xa')]||0xa;this[_0x3b2b('0xb')]=_0x45e179[_0x3b2b('0xb')]||_0x3b2b('0xc');this[_0x3b2b('0xd')]=_0x45e179['Agents'];this[_0x3b2b('0xe')]={};this[_0x3b2b('0xf')]=0x0;this[_0x3b2b('0x1')]='';this[_0x3b2b('0x10')]();this[_0x3b2b('0x11')]();}SmsQueue[_0x3b2b('0x12')]['updateRouting']=function(){var _0x492f5f=this[_0x3b2b('0xe')][_0x3b2b('0x13')];this[_0x3b2b('0xe')]=_[_0x3b2b('0x14')](this['Agents'],'id');this[_0x3b2b('0xe')][_0x3b2b('0x13')]=_0x492f5f;};SmsQueue[_0x3b2b('0x12')][_0x3b2b('0x11')]=function(){this[_0x3b2b('0x15')]=0x0;this[_0x3b2b('0x16')]=0x0;for(var _0x52b63f=0x0;_0x52b63f=0x0?this[_0x3b2b('0x19')]:0x0;var _0x52bba5={'id':this['id'],'available':this[_0x3b2b('0x19')],'loggedIn':this[_0x3b2b('0x15')],'name':this['name'],'paused':this[_0x3b2b('0x16')],'waiting':this['waiting']};var _0x26f83=md5(JSON[_0x3b2b('0x1a')](_0x52bba5));if(this['md5']!==_0x26f83){this['md5']=_0x26f83;io['to'](util[_0x3b2b('0x1b')](_0x3b2b('0x1c'),_0x52bba5[_0x3b2b('0x9')]))[_0x3b2b('0x1d')](_0x3b2b('0x1e'),_0x52bba5);}};module[_0x3b2b('0x1f')]=SmsQueue; \ No newline at end of file +var _0xec56=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','paused','available','waiting','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults'];(function(_0x261b08,_0x563d91){var _0xeeaf84=function(_0x5aeb4b){while(--_0x5aeb4b){_0x261b08['push'](_0x261b08['shift']());}};_0xeeaf84(++_0x563d91);}(_0xec56,0x1bd));var _0x6ec5=function(_0x10bd9e,_0x22a55a){_0x10bd9e=_0x10bd9e-0x0;var _0x4790d9=_0xec56[_0x10bd9e];return _0x4790d9;};'use strict';var _=require(_0x6ec5('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x6ec5('0x1'));var config=require(_0x6ec5('0x2'));config[_0x6ec5('0x3')]=_[_0x6ec5('0x4')](config[_0x6ec5('0x3')],{'host':_0x6ec5('0x5'),'port':0x18eb});var io=require(_0x6ec5('0x6'))(new Redis(config[_0x6ec5('0x3')]));function SmsQueue(_0x3f876c){this['id']=_0x3f876c['id']||0x0;this[_0x6ec5('0x7')]=_0x3f876c[_0x6ec5('0x7')]||'';this[_0x6ec5('0x8')]=_0x3f876c[_0x6ec5('0x8')]||0xa;this[_0x6ec5('0x9')]=_0x3f876c[_0x6ec5('0x9')]||_0x6ec5('0xa');this[_0x6ec5('0xb')]=_0x3f876c[_0x6ec5('0xb')];this[_0x6ec5('0xc')]={};this['waiting']=0x0;this[_0x6ec5('0xd')]='';this[_0x6ec5('0xe')]();this[_0x6ec5('0xf')]();}SmsQueue[_0x6ec5('0x10')][_0x6ec5('0xe')]=function(){var _0x181e79=this[_0x6ec5('0xc')]['_rr'];this[_0x6ec5('0xc')]=_[_0x6ec5('0x11')](this[_0x6ec5('0xb')],'id');this[_0x6ec5('0xc')][_0x6ec5('0x12')]=_0x181e79;};SmsQueue[_0x6ec5('0x10')][_0x6ec5('0xf')]=function(){this[_0x6ec5('0x13')]=0x0;this['paused']=0x0;for(var _0x3ed07a=0x0;_0x3ed07a=0x0?this[_0x6ec5('0x17')]:0x0;var _0x4237bc={'id':this['id'],'available':this[_0x6ec5('0x17')],'loggedIn':this[_0x6ec5('0x13')],'name':this[_0x6ec5('0x7')],'paused':this[_0x6ec5('0x16')],'waiting':this[_0x6ec5('0x18')]};var _0x2228dd=md5(JSON[_0x6ec5('0x19')](_0x4237bc));if(this[_0x6ec5('0xd')]!==_0x2228dd){this[_0x6ec5('0xd')]=_0x2228dd;io['to'](util['format'](_0x6ec5('0x1a'),_0x4237bc[_0x6ec5('0x7')]))[_0x6ec5('0x1b')](_0x6ec5('0x1c'),_0x4237bc);}};module[_0x6ec5('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 22a07a4..b7f65cc 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe78b=['paused','length','available','stringify','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','Agents','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xe78b,0x160));var _0xbe78=function(_0x118e49,_0x576c16){_0x118e49=_0x118e49-0x0;var _0x528dfd=_0xe78b[_0x118e49];return _0x528dfd;};'use strict';var _=require(_0xbe78('0x0'));var md5=require(_0xbe78('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xbe78('0x2'));config['redis']=_[_0xbe78('0x3')](config[_0xbe78('0x4')],{'host':_0xbe78('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe78('0x4')]));function WhatsappQueue(_0x56e3c1){this['id']=_0x56e3c1['id']||0x0;this['name']=_0x56e3c1[_0xbe78('0x6')]||'';this[_0xbe78('0x7')]=_0x56e3c1[_0xbe78('0x7')]||0xa;this[_0xbe78('0x8')]=_0x56e3c1[_0xbe78('0x8')]||'beepall';this[_0xbe78('0x9')]=_0x56e3c1[_0xbe78('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xbe78('0x1')]='';this['updateRouting']();this[_0xbe78('0xa')]();}WhatsappQueue[_0xbe78('0xb')]['updateRouting']=function(){var _0x153bb8=this[_0xbe78('0xc')][_0xbe78('0xd')];this[_0xbe78('0xc')]=_[_0xbe78('0xe')](this[_0xbe78('0x9')],'id');this[_0xbe78('0xc')][_0xbe78('0xd')]=_0x153bb8;};WhatsappQueue[_0xbe78('0xb')][_0xbe78('0xa')]=function(){this[_0xbe78('0xf')]=0x0;this[_0xbe78('0x10')]=0x0;for(var _0x138acd=0x0;_0x138acd=0x0?this[_0xbe78('0x12')]:0x0;var _0x4c1460={'id':this['id'],'available':this[_0xbe78('0x12')],'loggedIn':this[_0xbe78('0xf')],'name':this[_0xbe78('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4bc5ad=md5(JSON[_0xbe78('0x13')](_0x4c1460));if(this[_0xbe78('0x1')]!==_0x4bc5ad){this['md5']=_0x4bc5ad;io['to'](util['format']('whatsapp:queue:%s',_0x4c1460['name']))[_0xbe78('0x14')](_0xbe78('0x15'),_0x4c1460);}};module[_0xbe78('0x16')]=WhatsappQueue; \ No newline at end of file +var _0x4f59=['timeout','Agents','waiting','updateRouting','mapAgentsId','_rr','prototype','updateRealtime','loggedIn','paused','length','whatsappPause','available','stringify','md5','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name'];(function(_0x41b06b,_0x34d7bb){var _0x52fce1=function(_0x894b7a){while(--_0x894b7a){_0x41b06b['push'](_0x41b06b['shift']());}};_0x52fce1(++_0x34d7bb);}(_0x4f59,0x18d));var _0x94f5=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x4f59[_0x4653f7];return _0x5454da;};'use strict';var _=require(_0x94f5('0x0'));var md5=require('md5');var util=require(_0x94f5('0x1'));var Redis=require(_0x94f5('0x2'));var config=require(_0x94f5('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x94f5('0x4'),'port':0x18eb});var io=require(_0x94f5('0x5'))(new Redis(config[_0x94f5('0x6')]));function WhatsappQueue(_0x332797){this['id']=_0x332797['id']||0x0;this[_0x94f5('0x7')]=_0x332797[_0x94f5('0x7')]||'';this[_0x94f5('0x8')]=_0x332797['timeout']||0xa;this['strategy']=_0x332797['strategy']||'beepall';this[_0x94f5('0x9')]=_0x332797['Agents'];this['mapAgentsId']={};this[_0x94f5('0xa')]=0x0;this['md5']='';this[_0x94f5('0xb')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x94f5('0xb')]=function(){var _0x57b102=this[_0x94f5('0xc')][_0x94f5('0xd')];this[_0x94f5('0xc')]=_['map'](this[_0x94f5('0x9')],'id');this['mapAgentsId'][_0x94f5('0xd')]=_0x57b102;};WhatsappQueue[_0x94f5('0xe')][_0x94f5('0xf')]=function(){this[_0x94f5('0x10')]=0x0;this[_0x94f5('0x11')]=0x0;for(var _0x15e507=0x0;_0x15e507=0x0?this[_0x94f5('0x14')]:0x0;var _0x20da72={'id':this['id'],'available':this[_0x94f5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x94f5('0x7')],'paused':this['paused'],'waiting':this[_0x94f5('0xa')]};var _0x349339=md5(JSON[_0x94f5('0x15')](_0x20da72));if(this[_0x94f5('0x16')]!==_0x349339){this[_0x94f5('0x16')]=_0x349339;io['to'](util['format'](_0x94f5('0x17'),_0x20da72[_0x94f5('0x7')]))[_0x94f5('0x18')](_0x94f5('0x19'),_0x20da72);}};module[_0x94f5('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8bd1758..3f900db 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index b27fc29..793c93e 100644 --- a/server/services/routing/rpc/chatInteraction.js +++ b/server/services/routing/rpc/chatInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c0d=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x3e17ec,_0x977d20){var _0x578ec7=function(_0x2b9340){while(--_0x2b9340){_0x3e17ec['push'](_0x3e17ec['shift']());}};_0x578ec7(++_0x977d20);}(_0x4c0d,0x170));var _0xd4c0=function(_0x26f484,_0x5dce63){_0x26f484=_0x26f484-0x0;var _0x39353a=_0x4c0d[_0x26f484];return _0x39353a;};'use strict';var client=require(_0xd4c0('0x0'));exports[_0xd4c0('0x1')]=function(_0x400dc9,_0x9f094b){return client[_0xd4c0('0x2')](_0xd4c0('0x3'),{'body':_0x9f094b,'options':{'where':{'id':_0x400dc9}},'log':_0xd4c0('0x4')});};exports[_0xd4c0('0x5')]=function(_0x620025,_0x35eae2){return client[_0xd4c0('0x2')](_0xd4c0('0x6'),{'body':_0x35eae2,'options':{'where':{'id':_0x620025}},'log':_0xd4c0('0x7')});}; \ No newline at end of file +var _0x0e81=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','updateChatInteraction'];(function(_0x3d09ee,_0x52cca9){var _0x5f24a9=function(_0x15c534){while(--_0x15c534){_0x3d09ee['push'](_0x3d09ee['shift']());}};_0x5f24a9(++_0x52cca9);}(_0x0e81,0xe3));var _0x10e8=function(_0x24a2cc,_0x455e1f){_0x24a2cc=_0x24a2cc-0x0;var _0x1cf0ad=_0x0e81[_0x24a2cc];return _0x1cf0ad;};'use strict';var client=require(_0x10e8('0x0'));exports[_0x10e8('0x1')]=function(_0x42be68,_0x2e3246){return client[_0x10e8('0x2')]('UpdateChatInteraction',{'body':_0x2e3246,'options':{'where':{'id':_0x42be68}},'log':_0x10e8('0x3')});};exports[_0x10e8('0x4')]=function(_0x47f6db,_0x444bdb){return client[_0x10e8('0x2')](_0x10e8('0x5'),{'body':_0x444bdb,'options':{'where':{'id':_0x47f6db}},'log':_0x10e8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 35b18c4..34c840b 100644 --- a/server/services/routing/rpc/chatMessage.js +++ b/server/services/routing/rpc/chatMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd329=['createChatMessage','../client','CreateChatMessage'];(function(_0x2c7407,_0x27095f){var _0x4412b1=function(_0x12c697){while(--_0x12c697){_0x2c7407['push'](_0x2c7407['shift']());}};_0x4412b1(++_0x27095f);}(_0xd329,0xcd));var _0x9d32=function(_0x3240fd,_0x429d2d){_0x3240fd=_0x3240fd-0x0;var _0x128a0c=_0xd329[_0x3240fd];return _0x128a0c;};'use strict';var client=require(_0x9d32('0x0'));exports['create']=function(_0x29f2d3){return client['Request'](_0x9d32('0x1'),{'body':_0x29f2d3,'log':_0x9d32('0x2')});}; \ No newline at end of file +var _0xde29=['createChatMessage','../client','CreateChatMessage'];(function(_0x5ef161,_0x27d16c){var _0x1c6e9e=function(_0x8fc2a6){while(--_0x8fc2a6){_0x5ef161['push'](_0x5ef161['shift']());}};_0x1c6e9e(++_0x27d16c);}(_0xde29,0x1cf));var _0x9de2=function(_0x80a6ad,_0x132c02){_0x80a6ad=_0x80a6ad-0x0;var _0x315c42=_0xde29[_0x80a6ad];return _0x315c42;};'use strict';var client=require(_0x9de2('0x0'));exports['create']=function(_0x425eb7){return client['Request'](_0x9de2('0x1'),{'body':_0x425eb7,'log':_0x9de2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 85bd29f..0e552b1 100644 --- a/server/services/routing/rpc/chatQueue.js +++ b/server/services/routing/rpc/chatQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fc5=['online','chatPause','getChatQueues','Request','name','timeout','strategy','User','Agents'];(function(_0xf1f11f,_0x522adc){var _0x4cfd63=function(_0x5860d5){while(--_0x5860d5){_0xf1f11f['push'](_0xf1f11f['shift']());}};_0x4cfd63(++_0x522adc);}(_0x9fc5,0xb6));var _0x59fc=function(_0x35181c,_0x82694a){_0x35181c=_0x35181c-0x0;var _0xe14bf9=_0x9fc5[_0x35181c];return _0xe14bf9;};'use strict';var client=require('../client');exports[_0x59fc('0x0')]=function(){return function(){return client[_0x59fc('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x59fc('0x2'),_0x59fc('0x3'),_0x59fc('0x4')],'include':[{'model':_0x59fc('0x5'),'as':_0x59fc('0x6'),'attributes':['id',_0x59fc('0x2'),_0x59fc('0x7'),_0x59fc('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xfd87=['Request','GetChatQueue','name','timeout','strategy','User','Agents','online','../client','getChatQueues'];(function(_0x51f632,_0x5a14d5){var _0x24cf36=function(_0x3f2799){while(--_0x3f2799){_0x51f632['push'](_0x51f632['shift']());}};_0x24cf36(++_0x5a14d5);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7fd8('0x0'));exports[_0x7fd8('0x1')]=function(){return function(){return client[_0x7fd8('0x2')](_0x7fd8('0x3'),{'options':{'raw':![],'attributes':['id',_0x7fd8('0x4'),_0x7fd8('0x5'),_0x7fd8('0x6')],'include':[{'model':_0x7fd8('0x7'),'as':_0x7fd8('0x8'),'attributes':['id',_0x7fd8('0x4'),_0x7fd8('0x9'),'chatPause']}]},'log':_0x7fd8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index c7f09f8..19cc9be 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25ad=['DESC','../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x25ad,0x1b1));var _0xd25a=function(_0x545795,_0x176bcf){_0x545795=_0x545795-0x0;var _0x4ad27f=_0x25ad[_0x545795];return _0x4ad27f;};'use strict';var client=require(_0xd25a('0x0'));exports['create']=function(_0xa9ddeb){return client[_0xd25a('0x1')](_0xd25a('0x2'),{'body':_0xa9ddeb,'log':'CreateChatQueueReport'});};exports[_0xd25a('0x3')]=function(_0x3a67e3,_0x1532c5){return client[_0xd25a('0x1')](_0xd25a('0x4'),{'body':_0x1532c5,'options':{'where':{'uniqueid':_0x3a67e3},'order':[['id',_0xd25a('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x1978=['update','UpdateChatQueueReport','create','Request','CreateChatQueueReport'];(function(_0x5e06c2,_0x58c49a){var _0x305704=function(_0x53489e){while(--_0x53489e){_0x5e06c2['push'](_0x5e06c2['shift']());}};_0x305704(++_0x58c49a);}(_0x1978,0x174));var _0x8197=function(_0x1b715c,_0x38b3e4){_0x1b715c=_0x1b715c-0x0;var _0x502cb1=_0x1978[_0x1b715c];return _0x502cb1;};'use strict';var client=require('../client');exports[_0x8197('0x0')]=function(_0x254e41){return client[_0x8197('0x1')](_0x8197('0x2'),{'body':_0x254e41,'log':_0x8197('0x2')});};exports[_0x8197('0x3')]=function(_0x38fffe,_0x346978){return client[_0x8197('0x1')](_0x8197('0x4'),{'body':_0x346978,'options':{'where':{'uniqueid':_0x38fffe},'order':[['id','DESC']],'limit':0x1},'log':_0x8197('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 023a31e..41ad71e 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2915a7,_0x451590){var _0xbaaeeb=function(_0x1f396f){while(--_0x1f396f){_0x2915a7['push'](_0x2915a7['shift']());}};_0xbaaeeb(++_0x451590);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x52d3b7,_0x8db840){var _0x29e285=function(_0x4c63a6){while(--_0x4c63a6){_0x52d3b7['push'](_0x52d3b7['shift']());}};_0x29e285(++_0x8db840);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ca8ba68..1a9a98e 100644 --- a/server/services/routing/rpc/faxMessage.js +++ b/server/services/routing/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf7d=['createFaxMessage','../client','create','Request'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xbf7d,0xc1));var _0xdbf7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf7d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdbf7('0x0'));exports[_0xdbf7('0x1')]=function(_0x4aebcf){return client[_0xdbf7('0x2')]('CreateFaxMessage',{'body':_0x4aebcf,'log':_0xdbf7('0x3')});}; \ No newline at end of file +var _0xf020=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x42c069,_0xdfa0f9){var _0x4f0740=function(_0x4c9fd9){while(--_0x4c9fd9){_0x42c069['push'](_0x42c069['shift']());}};_0x4f0740(++_0xdfa0f9);}(_0xf020,0x1ad));var _0x0f02=function(_0x122fc7,_0xa5aa79){_0x122fc7=_0x122fc7-0x0;var _0x1e6d11=_0xf020[_0x122fc7];return _0x1e6d11;};'use strict';var client=require(_0x0f02('0x0'));exports[_0x0f02('0x1')]=function(_0x301dee){return client[_0x0f02('0x2')](_0x0f02('0x3'),{'body':_0x301dee,'log':_0x0f02('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d48cda6..e1fc1be 100644 --- a/server/services/routing/rpc/faxQueue.js +++ b/server/services/routing/rpc/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb833=['timeout','User','Agents','name','online','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0xb833,0xe8));var _0x3b83=function(_0x12e0f4,_0x50e357){_0x12e0f4=_0x12e0f4-0x0;var _0x5713ad=_0xb833[_0x12e0f4];return _0x5713ad;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x3b83('0x0')](_0x3b83('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x3b83('0x2'),'strategy'],'include':[{'model':_0x3b83('0x3'),'as':_0x3b83('0x4'),'attributes':['id',_0x3b83('0x5'),_0x3b83('0x6'),_0x3b83('0x7')]}]},'log':_0x3b83('0x8')});};}; \ No newline at end of file +var _0xbfd9=['../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause'];(function(_0x374cf2,_0x2cb320){var _0x119a64=function(_0xf6b979){while(--_0xf6b979){_0x374cf2['push'](_0x374cf2['shift']());}};_0x119a64(++_0x2cb320);}(_0xbfd9,0xaa));var _0x9bfd=function(_0x1a9957,_0x346fb1){_0x1a9957=_0x1a9957-0x0;var _0xf39d99=_0xbfd9[_0x1a9957];return _0xf39d99;};'use strict';var client=require(_0x9bfd('0x0'));exports[_0x9bfd('0x1')]=function(){return function(){return client[_0x9bfd('0x2')](_0x9bfd('0x3'),{'options':{'raw':![],'attributes':['id',_0x9bfd('0x4'),_0x9bfd('0x5'),_0x9bfd('0x6')],'include':[{'model':_0x9bfd('0x7'),'as':_0x9bfd('0x8'),'attributes':['id',_0x9bfd('0x4'),'online',_0x9bfd('0x9')]}]},'log':_0x9bfd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d5c8f15..60b9281 100644 --- a/server/services/routing/rpc/faxQueueReport.js +++ b/server/services/routing/rpc/faxQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e38=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x1e1125,_0x5a9ad3){var _0x449502=function(_0x2963f9){while(--_0x2963f9){_0x1e1125['push'](_0x1e1125['shift']());}};_0x449502(++_0x5a9ad3);}(_0x3e38,0x68));var _0x83e3=function(_0x57de2a,_0x48323b){_0x57de2a=_0x57de2a-0x0;var _0x1c9964=_0x3e38[_0x57de2a];return _0x1c9964;};'use strict';var client=require(_0x83e3('0x0'));exports[_0x83e3('0x1')]=function(_0x494f68){return client[_0x83e3('0x2')](_0x83e3('0x3'),{'body':_0x494f68,'log':_0x83e3('0x3')});};exports['update']=function(_0x11775e,_0x4cd376){return client[_0x83e3('0x2')](_0x83e3('0x4'),{'body':_0x4cd376,'options':{'where':{'uniqueid':_0x11775e},'order':[['id',_0x83e3('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x11e0=['CreateFaxQueueReport','UpdateFaxQueueReport','create','Request'];(function(_0x5854bc,_0x1ebaa3){var _0x4332d3=function(_0x4e730c){while(--_0x4e730c){_0x5854bc['push'](_0x5854bc['shift']());}};_0x4332d3(++_0x1ebaa3);}(_0x11e0,0x1ca));var _0x011e=function(_0xb1f213,_0x509f3d){_0xb1f213=_0xb1f213-0x0;var _0x42476b=_0x11e0[_0xb1f213];return _0x42476b;};'use strict';var client=require('../client');exports[_0x011e('0x0')]=function(_0x26e0d4){return client[_0x011e('0x1')](_0x011e('0x2'),{'body':_0x26e0d4,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x35e039,_0x377920){return client[_0x011e('0x1')](_0x011e('0x3'),{'body':_0x377920,'options':{'where':{'uniqueid':_0x35e039},'order':[['id','DESC']],'limit':0x1},'log':_0x011e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 79526fc..65aa4ae 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ac9=['Request','Intervals','name','interval','../client'];(function(_0x36a403,_0x3956e6){var _0x172d03=function(_0x277d78){while(--_0x277d78){_0x36a403['push'](_0x36a403['shift']());}};_0x172d03(++_0x3956e6);}(_0x1ac9,0xae));var _0x91ac=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x1ac9[_0x1f4fe3];return _0xe8dd52;};'use strict';var client=require(_0x91ac('0x0'));exports['getIntervals']=function(){return function(){return client[_0x91ac('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x91ac('0x2'),'attributes':['id',_0x91ac('0x3'),_0x91ac('0x4')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xdb00=['Request','GetInterval','name','Interval','Intervals','../client','getIntervals'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdb00,0xec));var _0x0db0=function(_0x499729,_0x195f21){_0x499729=_0x499729-0x0;var _0x5342d4=_0xdb00[_0x499729];return _0x5342d4;};'use strict';var client=require(_0x0db0('0x0'));exports[_0x0db0('0x1')]=function(){return function(){return client[_0x0db0('0x2')](_0x0db0('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0db0('0x4')],'include':[{'model':_0x0db0('0x5'),'as':_0x0db0('0x6'),'attributes':['id',_0x0db0('0x4'),'interval']}]},'log':_0x0db0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f0c8112..191d85e 100644 --- a/server/services/routing/rpc/mailInteraction.js +++ b/server/services/routing/rpc/mailInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x065e=['UpdateMailInteraction','updateMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x065e,0x1a7));var _0xe065=function(_0x38b76a,_0x53d4a9){_0x38b76a=_0x38b76a-0x0;var _0x452681=_0x065e[_0x38b76a];return _0x452681;};'use strict';var client=require(_0xe065('0x0'));exports['update']=function(_0x549f09,_0x59293c){return client[_0xe065('0x1')](_0xe065('0x2'),{'body':_0x59293c,'options':{'where':{'id':_0x549f09}},'log':_0xe065('0x3')});};exports['addTags']=function(_0x4964fa,_0x4610a3){return client[_0xe065('0x1')]('AddTagsToMailInteraction',{'body':_0x4610a3,'options':{'where':{'id':_0x4964fa}},'log':_0xe065('0x4')});}; \ No newline at end of file +var _0xe820=['../client','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x567221,_0x3b0210){var _0x30f461=function(_0x6d1efc){while(--_0x6d1efc){_0x567221['push'](_0x567221['shift']());}};_0x30f461(++_0x3b0210);}(_0xe820,0xd2));var _0x0e82=function(_0x1c327c,_0x5ecfe0){_0x1c327c=_0x1c327c-0x0;var _0x109e60=_0xe820[_0x1c327c];return _0x109e60;};'use strict';var client=require(_0x0e82('0x0'));exports['update']=function(_0x908a54,_0x4e6b50){return client['Request'](_0x0e82('0x1'),{'body':_0x4e6b50,'options':{'where':{'id':_0x908a54}},'log':_0x0e82('0x2')});};exports[_0x0e82('0x3')]=function(_0x59b28d,_0xc6d61e){return client['Request'](_0x0e82('0x4'),{'body':_0xc6d61e,'options':{'where':{'id':_0x59b28d}},'log':_0x0e82('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cc4ed3c..861414c 100644 --- a/server/services/routing/rpc/mailMessage.js +++ b/server/services/routing/rpc/mailMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab9b=['../client','create','Request','CreateMailMessage'];(function(_0x48df6c,_0x228879){var _0x58757f=function(_0x43bbd7){while(--_0x43bbd7){_0x48df6c['push'](_0x48df6c['shift']());}};_0x58757f(++_0x228879);}(_0xab9b,0x158));var _0xbab9=function(_0x360e5c,_0x1d60de){_0x360e5c=_0x360e5c-0x0;var _0x3629ea=_0xab9b[_0x360e5c];return _0x3629ea;};'use strict';var client=require(_0xbab9('0x0'));exports[_0xbab9('0x1')]=function(_0x433e79){return client[_0xbab9('0x2')](_0xbab9('0x3'),{'body':_0x433e79,'log':'createMailMessage'});}; \ No newline at end of file +var _0xf44d=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf44d,0x125));var _0xdf44=function(_0x4bbdad,_0x37f928){_0x4bbdad=_0x4bbdad-0x0;var _0x2d516f=_0xf44d[_0x4bbdad];return _0x2d516f;};'use strict';var client=require(_0xdf44('0x0'));exports[_0xdf44('0x1')]=function(_0x3fb957){return client[_0xdf44('0x2')](_0xdf44('0x3'),{'body':_0x3fb957,'log':_0xdf44('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index b99b429..7c21798 100644 --- a/server/services/routing/rpc/mailQueue.js +++ b/server/services/routing/rpc/mailQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x220c=['Agents','name','mailPause','getMailQueues','Request','timeout','strategy'];(function(_0x83b2a9,_0x4d61a0){var _0x5edf72=function(_0x12bfc7){while(--_0x12bfc7){_0x83b2a9['push'](_0x83b2a9['shift']());}};_0x5edf72(++_0x4d61a0);}(_0x220c,0xf8));var _0xc220=function(_0x67d1cf,_0xc04ce3){_0x67d1cf=_0x67d1cf-0x0;var _0x49c66e=_0x220c[_0x67d1cf];return _0x49c66e;};'use strict';var client=require('../client');exports[_0xc220('0x0')]=function(){return function(){return client[_0xc220('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0xc220('0x2'),_0xc220('0x3')],'include':[{'model':'User','as':_0xc220('0x4'),'attributes':['id',_0xc220('0x5'),'online',_0xc220('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xc236=['timeout','strategy','User','Agents','online','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x462a9e,_0x4a934b){var _0x342a9e=function(_0x33f22c){while(--_0x33f22c){_0x462a9e['push'](_0x462a9e['shift']());}};_0x342a9e(++_0x4a934b);}(_0xc236,0x87));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6c23('0x0'));exports[_0x6c23('0x1')]=function(){return function(){return client[_0x6c23('0x2')](_0x6c23('0x3'),{'options':{'raw':![],'attributes':['id',_0x6c23('0x4'),_0x6c23('0x5'),_0x6c23('0x6')],'include':[{'model':_0x6c23('0x7'),'as':_0x6c23('0x8'),'attributes':['id',_0x6c23('0x4'),_0x6c23('0x9'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 52939bd..8997e73 100644 --- a/server/services/routing/rpc/mailQueueReport.js +++ b/server/services/routing/rpc/mailQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb483=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','DESC'];(function(_0x9333a9,_0xbe002d){var _0x24158c=function(_0x25f159){while(--_0x25f159){_0x9333a9['push'](_0x9333a9['shift']());}};_0x24158c(++_0xbe002d);}(_0xb483,0x6d));var _0x3b48=function(_0x106950,_0x2d2c1e){_0x106950=_0x106950-0x0;var _0xb8a467=_0xb483[_0x106950];return _0xb8a467;};'use strict';var client=require(_0x3b48('0x0'));exports[_0x3b48('0x1')]=function(_0x1802a0){return client[_0x3b48('0x2')](_0x3b48('0x3'),{'body':_0x1802a0,'log':_0x3b48('0x3')});};exports['update']=function(_0x127856,_0x28f093){return client[_0x3b48('0x2')]('UpdateMailQueueReport',{'body':_0x28f093,'options':{'where':{'uniqueid':_0x127856},'order':[['id',_0x3b48('0x4')]],'limit':0x1},'log':_0x3b48('0x5')});}; \ No newline at end of file +var _0x5554=['update','DESC','create','CreateMailQueueReport'];(function(_0x2c92d6,_0x1fc682){var _0x18515c=function(_0x2ed22c){while(--_0x2ed22c){_0x2c92d6['push'](_0x2c92d6['shift']());}};_0x18515c(++_0x1fc682);}(_0x5554,0x72));var _0x4555=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5554[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x4555('0x0')]=function(_0x1ab132){return client['Request']('CreateMailQueueReport',{'body':_0x1ab132,'log':_0x4555('0x1')});};exports[_0x4555('0x2')]=function(_0x371f33,_0x5c4db3){return client['Request']('UpdateMailQueueReport',{'body':_0x5c4db3,'options':{'where':{'uniqueid':_0x371f33},'order':[['id',_0x4555('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e4e1c8d..4fe1eb4 100644 --- a/server/services/routing/rpc/openchannelInteraction.js +++ b/server/services/routing/rpc/openchannelInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ad6=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x4ab441,_0x52f2d3){var _0x380e11=function(_0x5a5ed1){while(--_0x5a5ed1){_0x4ab441['push'](_0x4ab441['shift']());}};_0x380e11(++_0x52f2d3);}(_0x5ad6,0x1c6));var _0x65ad=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0x5ad6[_0x5a3ee9];return _0x45032c;};'use strict';var client=require('../client');exports[_0x65ad('0x0')]=function(_0x6ba6c3,_0x3348d5){return client[_0x65ad('0x1')](_0x65ad('0x2'),{'body':_0x3348d5,'options':{'where':{'id':_0x6ba6c3}},'log':_0x65ad('0x3')});};exports['addTags']=function(_0x8bed7a,_0x3b281b){return client['Request'](_0x65ad('0x4'),{'body':_0x3b281b,'options':{'where':{'id':_0x8bed7a}},'log':_0x65ad('0x5')});}; \ No newline at end of file +var _0x05b1=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client','update','Request'];(function(_0x2be264,_0x39b78b){var _0x576bfc=function(_0x61ec18){while(--_0x61ec18){_0x2be264['push'](_0x2be264['shift']());}};_0x576bfc(++_0x39b78b);}(_0x05b1,0x117));var _0x105b=function(_0xeeeab,_0x541537){_0xeeeab=_0xeeeab-0x0;var _0xc9afa9=_0x05b1[_0xeeeab];return _0xc9afa9;};'use strict';var client=require(_0x105b('0x0'));exports[_0x105b('0x1')]=function(_0x20ffcc,_0x3bdf45){return client[_0x105b('0x2')](_0x105b('0x3'),{'body':_0x3bdf45,'options':{'where':{'id':_0x20ffcc}},'log':_0x105b('0x4')});};exports['addTags']=function(_0x1c676a,_0x41deef){return client['Request'](_0x105b('0x5'),{'body':_0x41deef,'options':{'where':{'id':_0x1c676a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 61ab5fc..a8806e6 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5984=['../client','create','Request','createOpenchannelMessage'];(function(_0x129479,_0x256c7e){var _0x3fa0ce=function(_0x35401f){while(--_0x35401f){_0x129479['push'](_0x129479['shift']());}};_0x3fa0ce(++_0x256c7e);}(_0x5984,0xd8));var _0x4598=function(_0x5b3936,_0x532c5f){_0x5b3936=_0x5b3936-0x0;var _0x2de8da=_0x5984[_0x5b3936];return _0x2de8da;};'use strict';var client=require(_0x4598('0x0'));exports[_0x4598('0x1')]=function(_0x2c1c6a){return client[_0x4598('0x2')]('CreateOpenchannelMessage',{'body':_0x2c1c6a,'log':_0x4598('0x3')});}; \ No newline at end of file +var _0xa91b=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x1ef0ae,_0x39cafd){var _0x2b3f21=function(_0x499eba){while(--_0x499eba){_0x1ef0ae['push'](_0x1ef0ae['shift']());}};_0x2b3f21(++_0x39cafd);}(_0xa91b,0x66));var _0xba91=function(_0x2849e0,_0x318f3b){_0x2849e0=_0x2849e0-0x0;var _0x33e97a=_0xa91b[_0x2849e0];return _0x33e97a;};'use strict';var client=require(_0xba91('0x0'));exports[_0xba91('0x1')]=function(_0xe716d7){return client[_0xba91('0x2')](_0xba91('0x3'),{'body':_0xe716d7,'log':_0xba91('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e4e3f73..29841a3 100644 --- a/server/services/routing/rpc/openchannelQueue.js +++ b/server/services/routing/rpc/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc85c=['Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x1b22a2,_0x27eb42){var _0xa45a4d=function(_0x3563af){while(--_0x3563af){_0x1b22a2['push'](_0x1b22a2['shift']());}};_0xa45a4d(++_0x27eb42);}(_0xc85c,0xb9));var _0xcc85=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xc85c[_0x403c8d];return _0x4ca60d;};'use strict';var client=require(_0xcc85('0x0'));exports[_0xcc85('0x1')]=function(){return function(){return client[_0xcc85('0x2')](_0xcc85('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc85('0x4'),_0xcc85('0x5'),_0xcc85('0x6')],'include':[{'model':_0xcc85('0x7'),'as':_0xcc85('0x8'),'attributes':['id',_0xcc85('0x4'),_0xcc85('0x9'),_0xcc85('0xa')]}]},'log':_0xcc85('0x1')});};}; \ No newline at end of file +var _0xf83d=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','User','Agents','online','openchannelPause'];(function(_0x3c7090,_0x244e76){var _0x430361=function(_0x493879){while(--_0x493879){_0x3c7090['push'](_0x3c7090['shift']());}};_0x430361(++_0x244e76);}(_0xf83d,0x19e));var _0xdf83=function(_0x21868d,_0x5030b4){_0x21868d=_0x21868d-0x0;var _0x48fe21=_0xf83d[_0x21868d];return _0x48fe21;};'use strict';var client=require(_0xdf83('0x0'));exports[_0xdf83('0x1')]=function(){return function(){return client[_0xdf83('0x2')](_0xdf83('0x3'),{'options':{'raw':![],'attributes':['id',_0xdf83('0x4'),'timeout','strategy'],'include':[{'model':_0xdf83('0x5'),'as':_0xdf83('0x6'),'attributes':['id',_0xdf83('0x4'),_0xdf83('0x7'),_0xdf83('0x8')]}]},'log':_0xdf83('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c2434ea..5fbbb48 100644 --- a/server/services/routing/rpc/openchannelQueueReport.js +++ b/server/services/routing/rpc/openchannelQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf948=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xf948,0x79));var _0x8f94=function(_0x53ac5b,_0x9cef1e){_0x53ac5b=_0x53ac5b-0x0;var _0x5738ca=_0xf948[_0x53ac5b];return _0x5738ca;};'use strict';var client=require(_0x8f94('0x0'));exports[_0x8f94('0x1')]=function(_0x9ed8d0){return client[_0x8f94('0x2')]('CreateOpenchannelQueueReport',{'body':_0x9ed8d0,'log':_0x8f94('0x3')});};exports[_0x8f94('0x4')]=function(_0x268708,_0x2d3cbf){return client['Request'](_0x8f94('0x5'),{'body':_0x2d3cbf,'options':{'where':{'uniqueid':_0x268708},'order':[['id',_0x8f94('0x6')]],'limit':0x1},'log':_0x8f94('0x5')});}; \ No newline at end of file +var _0x7633=['update','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7633,0x1c4));var _0x3763=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7633[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x3763('0x0'));exports[_0x3763('0x1')]=function(_0x1a6321){return client[_0x3763('0x2')](_0x3763('0x3'),{'body':_0x1a6321,'log':'CreateOpenchannelQueueReport'});};exports[_0x3763('0x4')]=function(_0x383cae,_0x56a283){return client[_0x3763('0x2')](_0x3763('0x5'),{'body':_0x56a283,'options':{'where':{'uniqueid':_0x383cae},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d47c52d..e2d90a2 100644 --- a/server/services/routing/rpc/smsInteraction.js +++ b/server/services/routing/rpc/smsInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72a2=['addTags','update','Request','UpdateSmsInteraction'];(function(_0x13f2af,_0x39cb71){var _0xd864c0=function(_0x4afc23){while(--_0x4afc23){_0x13f2af['push'](_0x13f2af['shift']());}};_0xd864c0(++_0x39cb71);}(_0x72a2,0x161));var _0x272a=function(_0x27356b,_0x56ad7c){_0x27356b=_0x27356b-0x0;var _0x3230b8=_0x72a2[_0x27356b];return _0x3230b8;};'use strict';var client=require('../client');exports[_0x272a('0x0')]=function(_0xd12811,_0x1927cc){return client[_0x272a('0x1')](_0x272a('0x2'),{'body':_0x1927cc,'options':{'where':{'id':_0xd12811}},'log':'updateSmsInteraction'});};exports[_0x272a('0x3')]=function(_0x52287e,_0x1d154d){return client['Request']('AddTagsToSmsInteraction',{'body':_0x1d154d,'options':{'where':{'id':_0x52287e}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xf3cc=['addTags','Request','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x34ed99,_0x3e346d){_0x34ed99=_0x34ed99-0x0;var _0x35d584=_0xf3cc[_0x34ed99];return _0x35d584;};'use strict';var client=require(_0xcf3c('0x0'));exports[_0xcf3c('0x1')]=function(_0x170f33,_0x38c9f6){return client['Request'](_0xcf3c('0x2'),{'body':_0x38c9f6,'options':{'where':{'id':_0x170f33}},'log':_0xcf3c('0x3')});};exports[_0xcf3c('0x4')]=function(_0x582153,_0x2e0b47){return client[_0xcf3c('0x5')]('AddTagsToSmsInteraction',{'body':_0x2e0b47,'options':{'where':{'id':_0x582153}},'log':_0xcf3c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 130909b..64fb88d 100644 --- a/server/services/routing/rpc/smsMessage.js +++ b/server/services/routing/rpc/smsMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58dd=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x4445ee,_0x45aabd){var _0x1fbcb3=function(_0x20ace4){while(--_0x20ace4){_0x4445ee['push'](_0x4445ee['shift']());}};_0x1fbcb3(++_0x45aabd);}(_0x58dd,0x112));var _0xd58d=function(_0x58c2fd,_0x28c0d0){_0x58c2fd=_0x58c2fd-0x0;var _0x2c60e2=_0x58dd[_0x58c2fd];return _0x2c60e2;};'use strict';var client=require(_0xd58d('0x0'));exports[_0xd58d('0x1')]=function(_0x3d5593){return client[_0xd58d('0x2')](_0xd58d('0x3'),{'body':_0x3d5593,'log':_0xd58d('0x4')});}; \ No newline at end of file +var _0x9a4c=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x15562c,_0x5e0f3f){var _0x3b1b62=function(_0x536448){while(--_0x536448){_0x15562c['push'](_0x15562c['shift']());}};_0x3b1b62(++_0x5e0f3f);}(_0x9a4c,0x115));var _0xc9a4=function(_0x494213,_0x5264c6){_0x494213=_0x494213-0x0;var _0x23211c=_0x9a4c[_0x494213];return _0x23211c;};'use strict';var client=require(_0xc9a4('0x0'));exports[_0xc9a4('0x1')]=function(_0x4a0b7d){return client[_0xc9a4('0x2')](_0xc9a4('0x3'),{'body':_0x4a0b7d,'log':_0xc9a4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 4211d87..7411ccf 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x1c9a1b,_0x2909ea){var _0x5d5fc9=function(_0x326b3d){while(--_0x326b3d){_0x1c9a1b['push'](_0x1c9a1b['shift']());}};_0x5d5fc9(++_0x2909ea);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x406c55,_0x95763){var _0x2820ba=function(_0x41e6e6){while(--_0x41e6e6){_0x406c55['push'](_0x406c55['shift']());}};_0x2820ba(++_0x95763);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 429fccc..a216556 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x191746,_0x3c8646){var _0x2352ac=function(_0x2c859d){while(--_0x2c859d){_0x191746['push'](_0x191746['shift']());}};_0x2352ac(++_0x3c8646);}(_0x55ca,0x126));var _0xa55c=function(_0x311c35,_0x54a2b0){_0x311c35=_0x311c35-0x0;var _0x31ff65=_0x55ca[_0x311c35];return _0x31ff65;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x154727,_0x3cdc4a){var _0x1198b3=function(_0x34e891){while(--_0x34e891){_0x154727['push'](_0x154727['shift']());}};_0x1198b3(++_0x3cdc4a);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 779c6d3..9a7f718 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5a622c,_0x5b9f65){var _0x1c6a21=function(_0x27cd08){while(--_0x27cd08){_0x5a622c['push'](_0x5a622c['shift']());}};_0x1c6a21(++_0x5b9f65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0xe28928,_0x2b3120){var _0x3bb0dc=function(_0x404832){while(--_0x404832){_0xe28928['push'](_0xe28928['shift']());}};_0x3bb0dc(++_0x2b3120);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index ad46da0..7fa37dd 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e4b=['../client','update','Request','addTagsToWhatsappInteraction'];(function(_0x723767,_0x47dc73){var _0x5a7ca2=function(_0x2b38fa){while(--_0x2b38fa){_0x723767['push'](_0x723767['shift']());}};_0x5a7ca2(++_0x47dc73);}(_0x0e4b,0xdc));var _0xb0e4=function(_0xa8f012,_0x23780d){_0xa8f012=_0xa8f012-0x0;var _0x49c3b2=_0x0e4b[_0xa8f012];return _0x49c3b2;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(_0x65d4d1,_0x4dceb8){return client[_0xb0e4('0x2')]('UpdateWhatsappInteraction',{'body':_0x4dceb8,'options':{'where':{'id':_0x65d4d1}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x538147,_0x79717e){return client[_0xb0e4('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x79717e,'options':{'where':{'id':_0x538147}},'log':_0xb0e4('0x3')});}; \ No newline at end of file +var _0xd8fb=['addTags','Request','AddTagsToWhatsappInteraction','../client','update'];(function(_0x2a8d0f,_0x42983b){var _0xf4cc50=function(_0x15f048){while(--_0x15f048){_0x2a8d0f['push'](_0x2a8d0f['shift']());}};_0xf4cc50(++_0x42983b);}(_0xd8fb,0x99));var _0xbd8f=function(_0x13603f,_0x41891a){_0x13603f=_0x13603f-0x0;var _0x2e91cf=_0xd8fb[_0x13603f];return _0x2e91cf;};'use strict';var client=require(_0xbd8f('0x0'));exports[_0xbd8f('0x1')]=function(_0x1024c1,_0x2bd369){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2bd369,'options':{'where':{'id':_0x1024c1}},'log':'updateWhatsappInteraction'});};exports[_0xbd8f('0x2')]=function(_0x43d177,_0x53cccc){return client[_0xbd8f('0x3')](_0xbd8f('0x4'),{'body':_0x53cccc,'options':{'where':{'id':_0x43d177}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 3f64b09..25e14eb 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a33=['create','../client'];(function(_0x2a9f4,_0x25c14a){var _0x3c39e0=function(_0x3b8deb){while(--_0x3b8deb){_0x2a9f4['push'](_0x2a9f4['shift']());}};_0x3c39e0(++_0x25c14a);}(_0x5a33,0xbb));var _0x35a3=function(_0x2bb15a,_0x4fcfbd){_0x2bb15a=_0x2bb15a-0x0;var _0x30f3cb=_0x5a33[_0x2bb15a];return _0x30f3cb;};'use strict';var client=require(_0x35a3('0x0'));exports[_0x35a3('0x1')]=function(_0x137f34){return client['Request']('CreateWhatsappMessage',{'body':_0x137f34,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xe178=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x535891,_0x25fc49){var _0x1c1081=function(_0x154d16){while(--_0x154d16){_0x535891['push'](_0x535891['shift']());}};_0x1c1081(++_0x25fc49);}(_0xe178,0x1c2));var _0x8e17=function(_0x1ccc05,_0x3b2d0a){_0x1ccc05=_0x1ccc05-0x0;var _0x2e271b=_0xe178[_0x1ccc05];return _0x2e271b;};'use strict';var client=require(_0x8e17('0x0'));exports[_0x8e17('0x1')]=function(_0x2cd8b2){return client[_0x8e17('0x2')](_0x8e17('0x3'),{'body':_0x2cd8b2,'log':_0x8e17('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bbbf9f6..3ccad9f 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdab4=['strategy','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xdab4,0x72));var _0x4dab=function(_0x5ab779,_0xb205b4){_0x5ab779=_0x5ab779-0x0;var _0x56c6a3=_0xdab4[_0x5ab779];return _0x56c6a3;};'use strict';var client=require(_0x4dab('0x0'));exports[_0x4dab('0x1')]=function(){return function(){return client[_0x4dab('0x2')](_0x4dab('0x3'),{'options':{'raw':![],'attributes':['id',_0x4dab('0x4'),_0x4dab('0x5'),_0x4dab('0x6')],'include':[{'model':_0x4dab('0x7'),'as':_0x4dab('0x8'),'attributes':['id',_0x4dab('0x4'),_0x4dab('0x9'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x66a3=['whatsappPause','getWhatsappQueues','Request','name','timeout','strategy','online'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x66a3,0x197));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x366a('0x0')]=function(){return function(){return client[_0x366a('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x366a('0x2'),_0x366a('0x3'),_0x366a('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x366a('0x2'),_0x366a('0x5'),_0x366a('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 06b7818..3a97c50 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x170a=['update','DESC','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x170a,0x93));var _0xa170=function(_0x392b2c,_0x43fd76){_0x392b2c=_0x392b2c-0x0;var _0x5e77ae=_0x170a[_0x392b2c];return _0x5e77ae;};'use strict';var client=require(_0xa170('0x0'));exports[_0xa170('0x1')]=function(_0x326936){return client[_0xa170('0x2')]('CreateWhatsappQueueReport',{'body':_0x326936,'log':'CreateWhatsappQueueReport'});};exports[_0xa170('0x3')]=function(_0x50aead,_0x6f5c70){return client[_0xa170('0x2')]('UpdateWhatsappQueueReport',{'body':_0x6f5c70,'options':{'where':{'uniqueid':_0x50aead},'order':[['id',_0xa170('0x4')]],'limit':0x1},'log':_0xa170('0x5')});}; \ No newline at end of file +var _0x51d7=['DESC','../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x55f67f,_0x576589){var _0x14d206=function(_0x3cd004){while(--_0x3cd004){_0x55f67f['push'](_0x55f67f['shift']());}};_0x14d206(++_0x576589);}(_0x51d7,0x91));var _0x751d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x51d7[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x751d('0x0'));exports[_0x751d('0x1')]=function(_0x1b84c7){return client[_0x751d('0x2')](_0x751d('0x3'),{'body':_0x1b84c7,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x47dfdc,_0x29204a){return client[_0x751d('0x2')](_0x751d('0x4'),{'body':_0x29204a,'options':{'where':{'uniqueid':_0x47dfdc},'order':[['id',_0x751d('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 53173e1..9f57695 100644 --- a/server/services/routing/server/applications/agent.js +++ b/server/services/routing/server/applications/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe18a=['length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','timeout','createQueue','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x145ac8,_0x387ddb){var _0x3af403=function(_0x12c37c){while(--_0x12c37c){_0x145ac8['push'](_0x145ac8['shift']());}};_0x3af403(++_0x387ddb);}(_0xe18a,0x12d));var _0xae18=function(_0x3b632c,_0x13dbf8){_0x3b632c=_0x3b632c-0x0;var _0x3d5e8d=_0xe18a[_0x3b632c];return _0x3d5e8d;};'use strict';var schema=require(_0xae18('0x0'));var _=require(_0xae18('0x1'));var util=require(_0xae18('0x2'));var seqqueue=require(_0xae18('0x3'));var logger=require('../../../../config/logger')(_0xae18('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xae18('0x5')},'timeout':{'type':_0xae18('0x6'),'message':_0xae18('0x7')}});function writeLog(_0x4c208e,_0x42f3f8,_0x1dd15f){return logger[_0xae18('0x8')](util[_0xae18('0x9')](_0xae18('0xa'),_0x4c208e,_0x42f3f8[_0xae18('0xb')],_0x1dd15f));}function handleFindAgent(_0x1f3503){return function(_0x39e2e7){return _0x39e2e7['name'][_0xae18('0xc')]()===_0x1f3503['toLowerCase']();};}exports[_0xae18('0xd')]=function(_0x2c480f,_0x46a960,_0x5cd053,_0x3b6af3){return function(_0x544d1e){try{var _0x3fe6b8={'name':_0x46a960[0x0],'timeout':_0x46a960[0x1]};var _0x370c58=queue['validate'](_0x3fe6b8,{'typecast':!![]});if(_0x370c58[_0xae18('0xe')]){logger[_0xae18('0xf')](_0xae18('0x10'),_0x2c480f,_[_0xae18('0x11')](_0x370c58,_0xae18('0x12'))[_0xae18('0x13')](',\x20'));_0x544d1e[_0xae18('0x14')]();}else{var _0x3dfcc8=_[_0xae18('0x15')](_0x5cd053['agents'],handleFindAgent(_0x3fe6b8[_0xae18('0xb')]));if(_0x3dfcc8){var _0x160450=(_0x3fe6b8[_0xae18('0x16')]||0xa)*0x3e8;var _0x12bb8a,_0x6cacca;var _0x22d263=seqqueue[_0xae18('0x17')](_0x160450);_0x22d263['id']=_0x2c480f;_0x22d263['atimeout']=_0x160450;_0x22d263[_0xae18('0x18')]=_0x3b6af3['channel'];writeLog(_0x2c480f,_0x3dfcc8,util[_0xae18('0x9')](_0xae18('0x19'),_0x160450));_0x5cd053[_0xae18('0x1a')][_0x2c480f]['on']('end',function(){logger[_0xae18('0x8')](_0xae18('0x1b'),_0x2c480f);clearTimeout(_0x6cacca);_0x6cacca=undefined;_0x22d263[_0xae18('0x1c')]();if(_0x5cd053['rules'][_0x2c480f]){delete _0x5cd053[_0xae18('0x1a')][_0x2c480f];}_0x544d1e[_0xae18('0x14')]();});_0x5cd053[_0xae18('0x1a')][_0x2c480f]['on'](_0xae18('0x1d'),function(){if(_0x5cd053[_0xae18('0x1a')][_0x2c480f]){delete _0x5cd053[_0xae18('0x1a')][_0x2c480f];}});_0x6cacca=setTimeout(function(){logger[_0xae18('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x2c480f);clearTimeout(_0x6cacca);_0x22d263[_0xae18('0x1c')]();_0x544d1e[_0xae18('0x1e')]();},_0x160450);strategy[_0xae18('0x1f')](_0x22d263,_0x3dfcc8,_0x5cd053,_0x3b6af3);}else{logger[_0xae18('0xf')](_0xae18('0x20'),_0x2c480f,_0x3fe6b8[_0xae18('0xb')]);_0x544d1e[_0xae18('0x14')]();}}}catch(_0x219f62){console[_0xae18('0x21')](_0x219f62);logger['error'](_0xae18('0x22'),_0x2c480f,_0x219f62['stack']);_0x544d1e[_0xae18('0x14')]();}};}; \ No newline at end of file +var _0xbf9b=['length','error','map','message','join','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','info','complete','agent','log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence'];(function(_0x258230,_0x4c81da){var _0x1feaaa=function(_0x4f2f94){while(--_0x4f2f94){_0x258230['push'](_0x258230['shift']());}};_0x1feaaa(++_0x4c81da);}(_0xbf9b,0xd4));var _0xbbf9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xbf9b[_0x4709c0];return _0x13348b;};'use strict';var schema=require(_0xbbf9('0x0'));var _=require('lodash');var util=require(_0xbbf9('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xbbf9('0x2'))(_0xbbf9('0x3'));var strategy=require(_0xbbf9('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xbbf9('0x5')},'timeout':{'type':_0xbbf9('0x6'),'message':_0xbbf9('0x7')}});function writeLog(_0x11e44e,_0x5790b5,_0x4195db){return logger['info'](util[_0xbbf9('0x8')](_0xbbf9('0x9'),_0x11e44e,_0x5790b5[_0xbbf9('0xa')],_0x4195db));}function handleFindAgent(_0x316f42){return function(_0x9e5264){return _0x9e5264[_0xbbf9('0xa')]['toLowerCase']()===_0x316f42['toLowerCase']();};}exports[_0xbbf9('0xb')]=function(_0x5e4af3,_0x2e853b,_0x421f17,_0x186585){return function(_0x18d3b7){try{var _0x111758={'name':_0x2e853b[0x0],'timeout':_0x2e853b[0x1]};var _0x238db9=queue[_0xbbf9('0x0')](_0x111758,{'typecast':!![]});if(_0x238db9[_0xbbf9('0xc')]){logger[_0xbbf9('0xd')]('[%s][AGENT]\x20%s',_0x5e4af3,_[_0xbbf9('0xe')](_0x238db9,_0xbbf9('0xf'))[_0xbbf9('0x10')](',\x20'));_0x18d3b7[_0xbbf9('0x11')]();}else{var _0x3c6125=_[_0xbbf9('0x12')](_0x421f17[_0xbbf9('0x13')],handleFindAgent(_0x111758[_0xbbf9('0xa')]));if(_0x3c6125){var _0x1a69e8=(_0x111758['timeout']||0xa)*0x3e8;var _0x2aacfd,_0xdf4a95;var _0x2fa1fd=seqqueue[_0xbbf9('0x14')](_0x1a69e8);_0x2fa1fd['id']=_0x5e4af3;_0x2fa1fd[_0xbbf9('0x15')]=_0x1a69e8;_0x2fa1fd[_0xbbf9('0x16')]=_0x186585['channel'];writeLog(_0x5e4af3,_0x3c6125,util[_0xbbf9('0x8')](_0xbbf9('0x17'),_0x1a69e8));_0x421f17[_0xbbf9('0x18')][_0x5e4af3]['on'](_0xbbf9('0x19'),function(){logger[_0xbbf9('0x1a')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5e4af3);clearTimeout(_0xdf4a95);_0xdf4a95=undefined;_0x2fa1fd['close']();if(_0x421f17[_0xbbf9('0x18')][_0x5e4af3]){delete _0x421f17[_0xbbf9('0x18')][_0x5e4af3];}_0x18d3b7[_0xbbf9('0x11')]();});_0x421f17[_0xbbf9('0x18')][_0x5e4af3]['on'](_0xbbf9('0x1b'),function(){if(_0x421f17[_0xbbf9('0x18')][_0x5e4af3]){delete _0x421f17[_0xbbf9('0x18')][_0x5e4af3];}});_0xdf4a95=setTimeout(function(){logger[_0xbbf9('0x1a')]('[%s][AGENT]\x20ROUTING\x20END',_0x5e4af3);clearTimeout(_0xdf4a95);_0x2fa1fd['close']();_0x18d3b7['next']();},_0x1a69e8);strategy[_0xbbf9('0x1c')](_0x2fa1fd,_0x3c6125,_0x421f17,_0x186585);}else{logger[_0xbbf9('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x5e4af3,_0x111758[_0xbbf9('0xa')]);_0x18d3b7['stop']();}}}catch(_0x2f46b2){console[_0xbbf9('0x1d')](_0x2f46b2);logger[_0xbbf9('0xd')](_0xbbf9('0x1e'),_0x5e4af3,_0x2f46b2[_0xbbf9('0x1f')]);_0x18d3b7[_0xbbf9('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a65fadc..16a9791 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4898=['dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','amazonlex','providerName','providerResponse'];(function(_0xbcfcda,_0x5bacf7){var _0x38250a=function(_0x3eb527){while(--_0x3eb527){_0xbcfcda['push'](_0xbcfcda['shift']());}};_0x38250a(++_0x5bacf7);}(_0x4898,0x10a));var _0x8489=function(_0x50840f,_0x4f02ca){_0x50840f=_0x50840f-0x0;var _0x53640c=_0x4898[_0x50840f];return _0x53640c;};'use strict';var _=require(_0x8489('0x0'));var moment=require(_0x8489('0x1'));var AWS=require(_0x8489('0x2'));var utils=require(_0x8489('0x3'));var logger=require(_0x8489('0x4'))(_0x8489('0x5'));var rpc={'chatMessage':require(_0x8489('0x6')),'openchannelMessage':require(_0x8489('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8489('0x8')),'whatsappMessage':require(_0x8489('0x9'))};exports[_0x8489('0xa')]=function(_0x58ca5c,_0x1cc3a9){return function(_0x241f37){try{if(!_[_0x8489('0xb')](this['interaction'][_0x8489('0xc')])){logger[_0x8489('0xd')](_0x8489('0xe'),_0x58ca5c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x241f37[_0x8489('0xf')]();}var _0x217722={'ContactId':this[_0x8489('0x10')]['id'],'sentAt':moment()[_0x8489('0x11')](_0x8489('0x12')),'direction':_0x8489('0x13')};if(this[_0x8489('0x14')]===_0x8489('0x15')||this[_0x8489('0x14')]===_0x8489('0x16')){_0x217722[_0x8489('0x17')]=this[_0x8489('0x18')][_0x8489('0x17')];}var _0x4f2c6d=this[_0x8489('0x14')];if(_0x4f2c6d===_0x8489('0x19')){_0x217722[_0x8489('0x1a')]=this['account']['id'];}else{_0x217722[_['upperFirst'](_0x4f2c6d)+_0x8489('0x1b')]=this[_0x8489('0x1c')]['id'];}_0x217722[_[_0x8489('0x1d')](_0x4f2c6d)+_0x8489('0x1e')]=this[_0x8489('0x18')]['id'];if(this[_0x8489('0x18')][_0x8489('0x1f')]){var _0x195309=_0x1cc3a9[0x4];if(!_[_0x8489('0x20')](_0x195309)){_0x217722[_0x8489('0x21')]=utils[_0x8489('0x22')](_0x195309,this);return rpc[_0x4f2c6d+_0x8489('0x23')][_0x8489('0x24')](_0x217722)[_0x8489('0x25')](function(_0x30cb2c){logger[_0x8489('0xd')](_0x8489('0xe'),_0x58ca5c,_0x217722['body']);})[_0x8489('0x26')](function(_0x2925d5){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON[_0x8489('0x28')](_0x2925d5));})[_0x8489('0x29')](function(){logger[_0x8489('0xd')](_0x8489('0x2a'),_0x58ca5c);_0x241f37['stop']();});}else{logger['info'](_0x8489('0x2b'),_0x58ca5c);_0x241f37[_0x8489('0x2c')]();}}else{var _0x9f20af=this;var _0x162568=new AWS[(_0x8489('0x2d'))]({'accessKeyId':_0x1cc3a9[0x0],'secretAccessKey':_0x1cc3a9[0x1],'region':_0x1cc3a9[0x2]});var _0x57d269={'botAlias':'$LATEST','botName':_0x1cc3a9[0x3],'inputText':this[_0x8489('0x2e')][_0x8489('0x21')],'userId':this[_0x8489('0x14')]+':'+this[_0x8489('0x18')]['id'][_0x8489('0x2f')]()};_0x162568[_0x8489('0x30')](_0x57d269,function(_0x2d6fac,_0x18740c){if(_0x2d6fac){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,_0x2d6fac[_0x8489('0x2e')]);_0x241f37[_0x8489('0xf')]();}else if(_0x18740c&&_0x18740c['message']){_0x9f20af[_0x8489('0x21')][_0x8489('0x31')]=_0x18740c;_0x217722['body']=_0x18740c[_0x8489('0x2e')];_0x217722[_0x8489('0x32')]=_0x8489('0x31');_0x217722[_0x8489('0x33')]=JSON['stringify'](_0x18740c);return rpc[_0x4f2c6d+_0x8489('0x23')]['create'](_0x217722)[_0x8489('0x25')](function(_0x4b9a11){logger['info'](_0x8489('0xe'),_0x58ca5c,_0x217722[_0x8489('0x21')]);if(_0x18740c[_0x8489('0x34')]=='Failed'){_0x241f37['next']();}else{_0x241f37['stop']();}})[_0x8489('0x26')](function(_0x231514){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON['stringify'](_0x231514));_0x241f37['next']();});}else{_0x241f37[_0x8489('0xf')]();}});}}catch(_0x27e15c){logger[_0x8489('0x27')](_0x8489('0xe'),_0x58ca5c,JSON[_0x8489('0x28')](_0x27e15c));_0x241f37[_0x8489('0x2c')]();}};}; \ No newline at end of file +var _0x0bed=['../../rpc/whatsappMessage','isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','body','getMustacheRender','then','[%s][AMAZONLEX]\x20%s','catch','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerName','providerResponse','stringify','Message','create','dialogState','Failed','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x34d3ce,_0x7b865){var _0x3dddff=function(_0x20adee){while(--_0x20adee){_0x34d3ce['push'](_0x34d3ce['shift']());}};_0x3dddff(++_0x7b865);}(_0x0bed,0xbf));var _0xd0be=function(_0x5a73d3,_0x351c75){_0x5a73d3=_0x5a73d3-0x0;var _0x1c5dc0=_0x0bed[_0x5a73d3];return _0x1c5dc0;};'use strict';var _=require(_0xd0be('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0xd0be('0x1'));var logger=require(_0xd0be('0x2'))(_0xd0be('0x3'));var rpc={'chatMessage':require(_0xd0be('0x4')),'openchannelMessage':require(_0xd0be('0x5')),'mailMessage':require(_0xd0be('0x6')),'smsMessage':require(_0xd0be('0x7')),'faxMessage':require(_0xd0be('0x8')),'whatsappMessage':require(_0xd0be('0x9'))};exports['consequence']=function(_0x591556,_0x19b842){return function(_0x13823b){try{if(!_[_0xd0be('0xa')](this[_0xd0be('0xb')][_0xd0be('0xc')])){logger[_0xd0be('0xd')]('[%s][AMAZONLEX]\x20%s',_0x591556,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x13823b[_0xd0be('0xe')]();}var _0x30070e={'ContactId':this[_0xd0be('0xf')]['id'],'sentAt':moment()[_0xd0be('0x10')](_0xd0be('0x11')),'direction':'out'};if(this['channel']===_0xd0be('0x12')||this[_0xd0be('0x13')]===_0xd0be('0x14')){_0x30070e['phone']=this[_0xd0be('0xb')][_0xd0be('0x15')];}var _0x10bc24=this[_0xd0be('0x13')];if(_0x10bc24===_0xd0be('0x16')){_0x30070e[_0xd0be('0x17')]=this[_0xd0be('0x18')]['id'];}else{_0x30070e[_['upperFirst'](_0x10bc24)+_0xd0be('0x19')]=this[_0xd0be('0x18')]['id'];}_0x30070e[_[_0xd0be('0x1a')](_0x10bc24)+_0xd0be('0x1b')]=this[_0xd0be('0xb')]['id'];if(this[_0xd0be('0xb')]['created']){var _0x44014d=_0x19b842[0x4];if(!_['isEmpty'](_0x44014d)){_0x30070e[_0xd0be('0x1c')]=utils[_0xd0be('0x1d')](_0x44014d,this);return rpc[_0x10bc24+'Message']['create'](_0x30070e)[_0xd0be('0x1e')](function(_0x2add89){logger['info'](_0xd0be('0x1f'),_0x591556,_0x30070e[_0xd0be('0x1c')]);})[_0xd0be('0x20')](function(_0x2d032f){logger['error'](_0xd0be('0x1f'),_0x591556,JSON['stringify'](_0x2d032f));})['finally'](function(){logger['info'](_0xd0be('0x21'),_0x591556);_0x13823b[_0xd0be('0x22')]();});}else{logger[_0xd0be('0xd')](_0xd0be('0x23'),_0x591556);_0x13823b[_0xd0be('0x22')]();}}else{var _0x393fb=this;var _0x53f63e=new AWS[(_0xd0be('0x24'))]({'accessKeyId':_0x19b842[0x0],'secretAccessKey':_0x19b842[0x1],'region':_0x19b842[0x2]});var _0x5e9b95={'botAlias':_0xd0be('0x25'),'botName':_0x19b842[0x3],'inputText':this[_0xd0be('0x26')][_0xd0be('0x1c')],'userId':this['channel']+':'+this[_0xd0be('0xb')]['id'][_0xd0be('0x27')]()};_0x53f63e[_0xd0be('0x28')](_0x5e9b95,function(_0x353017,_0x50ba29){if(_0x353017){logger[_0xd0be('0x29')](_0xd0be('0x1f'),_0x591556,_0x353017[_0xd0be('0x26')]);_0x13823b[_0xd0be('0xe')]();}else if(_0x50ba29&&_0x50ba29[_0xd0be('0x26')]){_0x393fb[_0xd0be('0x1c')][_0xd0be('0x2a')]=_0x50ba29;_0x30070e[_0xd0be('0x1c')]=_0x50ba29['message'];_0x30070e[_0xd0be('0x2b')]=_0xd0be('0x2a');_0x30070e[_0xd0be('0x2c')]=JSON[_0xd0be('0x2d')](_0x50ba29);return rpc[_0x10bc24+_0xd0be('0x2e')][_0xd0be('0x2f')](_0x30070e)[_0xd0be('0x1e')](function(_0x2d9763){logger[_0xd0be('0xd')](_0xd0be('0x1f'),_0x591556,_0x30070e['body']);if(_0x50ba29[_0xd0be('0x30')]==_0xd0be('0x31')){_0x13823b[_0xd0be('0xe')]();}else{_0x13823b[_0xd0be('0x22')]();}})[_0xd0be('0x20')](function(_0x3cbd31){logger[_0xd0be('0x29')](_0xd0be('0x1f'),_0x591556,JSON[_0xd0be('0x2d')](_0x3cbd31));_0x13823b[_0xd0be('0xe')]();});}else{_0x13823b[_0xd0be('0xe')]();}});}}catch(_0x1e44b5){logger[_0xd0be('0x29')](_0xd0be('0x1f'),_0x591556,JSON[_0xd0be('0x2d')](_0x1e44b5));_0x13823b[_0xd0be('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 77dcf1d..d0d6b54 100644 --- a/server/services/routing/server/applications/autoreply.js +++ b/server/services/routing/server/applications/autoreply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a92=['stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId','','replace','','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s'];(function(_0x946e1b,_0x4f9f57){var _0x4db99b=function(_0x16f0e9){while(--_0x16f0e9){_0x946e1b['push'](_0x946e1b['shift']());}};_0x4db99b(++_0x4f9f57);}(_0x7a92,0xd9));var _0x27a9=function(_0x29dfe3,_0x48d751){_0x29dfe3=_0x29dfe3-0x0;var _0x221122=_0x7a92[_0x29dfe3];return _0x221122;};'use strict';var _=require(_0x27a9('0x0'));var moment=require(_0x27a9('0x1'));var utils=require(_0x27a9('0x2'));var logger=require(_0x27a9('0x3'))(_0x27a9('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x27a9('0x5')),'mailMessage':require(_0x27a9('0x6')),'smsMessage':require(_0x27a9('0x7')),'faxMessage':require(_0x27a9('0x8')),'whatsappMessage':require(_0x27a9('0x9')),'chatInteraction':require(_0x27a9('0xa')),'openchannelInteraction':require(_0x27a9('0xb')),'mailInteraction':require(_0x27a9('0xc')),'smsInteraction':require(_0x27a9('0xd')),'faxInteraction':require(_0x27a9('0xe')),'whatsappInteraction':require(_0x27a9('0xf'))};var mailRpc=require(_0x27a9('0x10'));exports[_0x27a9('0x11')]=function(_0x19b3f2,_0x4f352e,_0x264ca0,_0x49f904){return function(_0x57757d){try{var _0xfc3a72=this['channel'];if(_0xfc3a72===_0x27a9('0x12')&&_0x49f904[_0x27a9('0x13')]['isAutoreply']){logger[_0x27a9('0x14')]('[%s][AUTOREPLY]\x20%s',_0x19b3f2,_0x27a9('0x15'));return _0x57757d[_0x27a9('0x16')]();}if(_0x4f352e[0x0]==='1'&&(_[_0x27a9('0x17')](this[_0x27a9('0x18')]['created'])||!this['interaction'][_0x27a9('0x19')])){logger['info'](_0x27a9('0x1a'),_0x19b3f2,_0x27a9('0x1b'));return _0x57757d[_0x27a9('0x16')]();}if(_0x4f352e[0x0]==='2'&&this[_0x27a9('0x18')][_0x27a9('0x1c')]){logger[_0x27a9('0x14')](_0x27a9('0x1d'),_0x19b3f2,'One\x20Time\x20already\x20sent');return _0x57757d[_0x27a9('0x16')]();}var _0x3106ff={'ContactId':this[_0x27a9('0x1e')]['id'],'sentAt':moment()[_0x27a9('0x1f')](_0x27a9('0x20')),'direction':_0x27a9('0x21')};if(this[_0x27a9('0x22')]===_0x27a9('0x12')){_0x3106ff[_0x27a9('0x13')]=utils[_0x27a9('0x23')](_0x4f352e[0x2],this);}else{_0x3106ff[_0x27a9('0x13')]=utils['getMustacheRender'](_0x4f352e[0x1],this);}if(this[_0x27a9('0x24')]){_0x3106ff['to']=this[_0x27a9('0x24')][_0x27a9('0x25')]||'';if(this['channel']==='mail'&&_0x4f352e[0x1]==='1'){_0x3106ff['cc']=this[_0x27a9('0x24')]['cc']||'';}_0x3106ff[_0x27a9('0x25')]=this[_0x27a9('0x24')]['to']||'';_0x3106ff[_0x27a9('0x26')]=this[_0x27a9('0x24')]['phone']||'';_0x3106ff[_0x27a9('0x27')]=!![];if(this[_0x27a9('0x24')][_0x27a9('0x28')]){_0x3106ff[_0x27a9('0x28')]='';_0x3106ff[_0x27a9('0x28')]+=_[_0x27a9('0x29')](this[_0x27a9('0x24')][_0x27a9('0x28')],_0x27a9('0x2a'))?'':_0x27a9('0x2b');_0x3106ff[_0x27a9('0x28')]+=this[_0x27a9('0x24')][_0x27a9('0x28')];}}if(this[_0x27a9('0x22')]===_0x27a9('0x2c')){_0x3106ff['ChatWebsiteId']=this[_0x27a9('0x2d')]['id'];}else{_0x3106ff[_[_0x27a9('0x2e')](this['channel'])+_0x27a9('0x2f')]=this['account']['id'];}_0x3106ff[_[_0x27a9('0x2e')](this[_0x27a9('0x22')])+_0x27a9('0x30')]=this['interaction']['id'];var _0x4def1d=this[_0x27a9('0x18')];if(rpc[this[_0x27a9('0x22')]+'Message']){if(this['channel']==='mail'){_0x3106ff[_0x27a9('0x31')]=this[_0x27a9('0x24')][_0x27a9('0x32')];_0x3106ff['html']=_0x27a9('0x33')+_[_0x27a9('0x34')](_0x3106ff['body'],_0x27a9('0x35'),_0x27a9('0x36'))+_0x27a9('0x37');_0x3106ff['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x27a9('0x38'),'Precedence':_0x27a9('0x39')};return mailRpc[_0x27a9('0x3a')](this[_0x27a9('0x2d')][_0x27a9('0x3b')],_0x3106ff)[_0x27a9('0x3c')](function(_0x3d17bd){logger[_0x27a9('0x14')](_0x27a9('0x3d'),_0x19b3f2);_0x3106ff[_0x27a9('0x32')]=_0x3d17bd[_0x27a9('0x24')]['messageId'];return rpc[_0xfc3a72+_0x27a9('0x3e')][_0x27a9('0x3f')](_0x3106ff);})[_0x27a9('0x3c')](function(_0x1eab54){logger['info'](_0x27a9('0x1a'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x1eab54));})['catch'](function(_0x4604d4){logger['error'](_0x27a9('0x41'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x4604d4));})['finally'](function(){Promise[_0x27a9('0x42')]()[_0x27a9('0x3c')](function(){if(_0x4f352e[0x0]!=='2'||_0x4def1d[_0x27a9('0x1c')])return;return rpc[_0xfc3a72+'Interaction'][_0x27a9('0x43')](_0x4def1d['id'],{'autoreplyExecuted':!![]})[_0x27a9('0x3c')](function(_0x4cf363){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x19b3f2,JSON[_0x27a9('0x40')](_0x4cf363));})[_0x27a9('0x44')](function(_0x46c476){logger[_0x27a9('0x45')](_0x27a9('0x46'),_0x19b3f2,JSON['stringify'](_0x46c476));});})[_0x27a9('0x3c')](function(){_0x57757d[_0x27a9('0x16')]();});});}else{return rpc[this[_0x27a9('0x22')]+'Message'][_0x27a9('0x3f')](_0x3106ff)[_0x27a9('0x3c')](function(){logger[_0x27a9('0x14')](_0x27a9('0x1a'),_0x19b3f2,_0x3106ff['body']);})[_0x27a9('0x44')](function(_0x423a9a){logger[_0x27a9('0x45')](_0x27a9('0x1a'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x423a9a));})['finally'](function(){Promise[_0x27a9('0x42')]()[_0x27a9('0x3c')](function(){if(_0x4f352e[0x0]!=='2'||_0x4def1d[_0x27a9('0x1c')])return;return rpc[_0xfc3a72+'Interaction'][_0x27a9('0x43')](_0x4def1d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x415514){logger['info'](_0x27a9('0x1d'),_0x19b3f2,JSON[_0x27a9('0x40')](_0x415514));})['catch'](function(_0x5cf1ae){logger[_0x27a9('0x45')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x19b3f2,JSON[_0x27a9('0x40')](_0x5cf1ae));});})[_0x27a9('0x3c')](function(){_0x57757d['next']();});});}}}catch(_0x26babd){logger['error']('[%s][AUTOREPLY]\x20%s',_0x19b3f2,JSON['stringify'](_0x26babd));_0x57757d[_0x27a9('0x47')]();}};}; \ No newline at end of file +var _0x680f=['lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','mail','read','subject','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','html','','';_0x324b0d['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xf680('0x2c')};return mailRpc[_0xf680('0x2d')](this['account'][_0xf680('0x2e')],_0x324b0d)[_0xf680('0x2f')](function(_0x15a642){logger[_0xf680('0xf')](_0xf680('0x30'),_0x3bfc5e);_0x324b0d[_0xf680('0x31')]=_0x15a642[_0xf680('0x1c')][_0xf680('0x31')];return rpc[_0x5416e5+_0xf680('0x27')][_0xf680('0x32')](_0x324b0d);})[_0xf680('0x2f')](function(_0xf01234){logger['info'](_0xf680('0x10'),_0x3bfc5e,JSON[_0xf680('0x33')](_0xf01234));})[_0xf680('0x34')](function(_0x475311){logger[_0xf680('0x35')](_0xf680('0x36'),_0x3bfc5e,JSON[_0xf680('0x33')](_0x475311));})['finally'](function(){Promise[_0xf680('0x37')]()[_0xf680('0x2f')](function(){if(_0x448eed[0x0]!=='2'||_0x1e220a[_0xf680('0x17')])return;return rpc[_0x5416e5+_0xf680('0x38')][_0xf680('0x39')](_0x1e220a['id'],{'autoreplyExecuted':!![]})[_0xf680('0x2f')](function(_0x385855){logger[_0xf680('0xf')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3bfc5e,JSON[_0xf680('0x33')](_0x385855));})[_0xf680('0x34')](function(_0x3c47d3){logger[_0xf680('0x35')](_0xf680('0x3a'),_0x3bfc5e,JSON[_0xf680('0x33')](_0x3c47d3));});})[_0xf680('0x2f')](function(){_0x2d23b2[_0xf680('0x12')]();});});}else{return rpc[this['channel']+_0xf680('0x27')][_0xf680('0x32')](_0x324b0d)[_0xf680('0x2f')](function(){logger[_0xf680('0xf')](_0xf680('0x10'),_0x3bfc5e,_0x324b0d['body']);})[_0xf680('0x34')](function(_0x18425e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3bfc5e,JSON[_0xf680('0x33')](_0x18425e));})['finally'](function(){Promise[_0xf680('0x37')]()[_0xf680('0x2f')](function(){if(_0x448eed[0x0]!=='2'||_0x1e220a[_0xf680('0x17')])return;return rpc[_0x5416e5+_0xf680('0x38')]['update'](_0x1e220a['id'],{'autoreplyExecuted':!![]})[_0xf680('0x2f')](function(_0x3de49d){logger[_0xf680('0xf')](_0xf680('0x3b'),_0x3bfc5e,JSON[_0xf680('0x33')](_0x3de49d));})[_0xf680('0x34')](function(_0x1413d3){logger[_0xf680('0x35')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3bfc5e,JSON[_0xf680('0x33')](_0x1413d3));});})[_0xf680('0x2f')](function(){_0x2d23b2[_0xf680('0x12')]();});});}}}catch(_0x2eddc4){logger[_0xf680('0x35')](_0xf680('0x10'),_0x3bfc5e,JSON['stringify'](_0x2eddc4));_0x2d23b2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index f5afb2e..30e7a27 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a33=['channel','Interaction','update','interaction','then','catch','error','[%s][CLOSE]\x20%s','stringify','finally','moment','routing','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6a33,0xee));var _0x36a3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x6a33[_0x24259d];return _0x5a701;};'use strict';var moment=require(_0x36a3('0x0'));var logger=require('../../../../config/logger')(_0x36a3('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x36a3('0x2')),'mailInteraction':require(_0x36a3('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x36a3('0x4')]=function(_0xabf40d,_0x41c858,_0x49d9da,_0x18784d){return function(_0x3d4a43){try{logger[_0x36a3('0x5')](_0x36a3('0x6'),_0xabf40d,_0x41c858[0x0]);var _0x3ea45c={'closed':0x1,'closedAt':moment()[_0x36a3('0x7')](_0x36a3('0x8')),'closeReason':'system','disposition':_0x41c858[0x0]};if(rpc[_0x18784d[_0x36a3('0x9')]+_0x36a3('0xa')]){rpc[_0x18784d['channel']+_0x36a3('0xa')][_0x36a3('0xb')](_0x18784d[_0x36a3('0xc')]['id'],_0x3ea45c)[_0x36a3('0xd')](function(_0x2e2a81){logger[_0x36a3('0x5')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xabf40d,_0x18784d['interaction']['id']);})[_0x36a3('0xe')](function(_0x273860){logger[_0x36a3('0xf')](_0x36a3('0x10'),_0xabf40d,JSON[_0x36a3('0x11')](_0x273860));})[_0x36a3('0x12')](function(){_0x3d4a43['stop']();});}}catch(_0x483bf9){logger[_0x36a3('0xf')]('[%s][CLOSE]\x20%s',_0xabf40d,JSON[_0x36a3('0x11')](_0x483bf9));_0x3d4a43['stop']();}};}; \ No newline at end of file +var _0x9b8c=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x15f685,_0x413b02){var _0x45a5ce=function(_0x412d2e){while(--_0x412d2e){_0x15f685['push'](_0x15f685['shift']());}};_0x45a5ce(++_0x413b02);}(_0x9b8c,0xae));var _0xc9b8=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x9b8c[_0x2e3dfc];return _0x4b1245;};'use strict';var moment=require(_0xc9b8('0x0'));var logger=require('../../../../config/logger')(_0xc9b8('0x1'));var rpc={'chatInteraction':require(_0xc9b8('0x2')),'openchannelInteraction':require(_0xc9b8('0x3')),'smsInteraction':require(_0xc9b8('0x4')),'mailInteraction':require(_0xc9b8('0x5')),'faxInteraction':require(_0xc9b8('0x6')),'whatsappInteraction':require(_0xc9b8('0x7'))};exports[_0xc9b8('0x8')]=function(_0x451406,_0x26174e,_0x38481e,_0x22e784){return function(_0x3ca539){try{logger[_0xc9b8('0x9')](_0xc9b8('0xa'),_0x451406,_0x26174e[0x0]);var _0x19efc7={'closed':0x1,'closedAt':moment()['format'](_0xc9b8('0xb')),'closeReason':_0xc9b8('0xc'),'disposition':_0x26174e[0x0]};if(rpc[_0x22e784[_0xc9b8('0xd')]+_0xc9b8('0xe')]){rpc[_0x22e784[_0xc9b8('0xd')]+_0xc9b8('0xe')][_0xc9b8('0xf')](_0x22e784['interaction']['id'],_0x19efc7)[_0xc9b8('0x10')](function(_0x3369e1){logger[_0xc9b8('0x9')](_0xc9b8('0x11'),_0x451406,_0x22e784[_0xc9b8('0x12')]['id']);})[_0xc9b8('0x13')](function(_0x4b4f19){logger[_0xc9b8('0x14')](_0xc9b8('0x15'),_0x451406,JSON[_0xc9b8('0x16')](_0x4b4f19));})[_0xc9b8('0x17')](function(){_0x3ca539[_0xc9b8('0x18')]();});}}catch(_0x2eba2a){logger['error'](_0xc9b8('0x15'),_0x451406,JSON[_0xc9b8('0x16')](_0x2eba2a));_0x3ca539[_0xc9b8('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 8fbd032..07170ee 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94ff=['created','Message','catch','error','finally','stop','textRequest','message','body','then','dialogflow','fulfillment','speech','create','result','metadata','endConversation','next','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0x94ff,0xc3));var _0xf94f=function(_0x1b54e8,_0x53b5f5){_0x1b54e8=_0x1b54e8-0x0;var _0x4b1513=_0x94ff[_0x1b54e8];return _0x4b1513;};'use strict';var _=require(_0xf94f('0x0'));var moment=require('moment');var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xf94f('0x1'));var logger=require(_0xf94f('0x2'))(_0xf94f('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf94f('0x4')),'mailMessage':require(_0xf94f('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf94f('0x6')),'whatsappMessage':require(_0xf94f('0x7'))};exports['consequence']=function(_0x18919a,_0x5e3f9c){return function(_0x192f2c){try{if(!_[_0xf94f('0x8')](this['interaction'][_0xf94f('0x9')])){logger[_0xf94f('0xa')](_0xf94f('0xb'),_0x18919a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x192f2c['next']();}var _0x510972={'ContactId':this[_0xf94f('0xc')]['id'],'sentAt':moment()[_0xf94f('0xd')](_0xf94f('0xe')),'direction':_0xf94f('0xf')};if(this[_0xf94f('0x10')]===_0xf94f('0x11')||this[_0xf94f('0x10')]===_0xf94f('0x12')){_0x510972['phone']=this[_0xf94f('0x13')][_0xf94f('0x14')];}var _0xb83e27=this[_0xf94f('0x10')];if(_0xb83e27==='chat'){_0x510972[_0xf94f('0x15')]=this[_0xf94f('0x16')]['id'];}else{_0x510972[_[_0xf94f('0x17')](_0xb83e27)+_0xf94f('0x18')]=this[_0xf94f('0x16')]['id'];}_0x510972[_[_0xf94f('0x17')](_0xb83e27)+'InteractionId']=this[_0xf94f('0x13')]['id'];if(this['interaction'][_0xf94f('0x19')]){var _0x346c76=_0x5e3f9c[0x2];if(!_['isEmpty'](_0x346c76)){_0x510972['body']=utils['getMustacheRender'](_0x346c76,this);return rpc[_0xb83e27+_0xf94f('0x1a')]['create'](_0x510972)['then'](function(_0x3ccfb4){logger['info'](_0xf94f('0xb'),_0x18919a,_0x510972['body']);})[_0xf94f('0x1b')](function(_0x5e68da){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON['stringify'](_0x5e68da));})[_0xf94f('0x1d')](function(){logger[_0xf94f('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x18919a);_0x192f2c[_0xf94f('0x1e')]();});}else{logger[_0xf94f('0xa')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18919a);_0x192f2c[_0xf94f('0x1e')]();}}else{var _0x3aa34b=this;var _0x5beb9c=apiai(_0x5e3f9c[0x0],{'language':_0x5e3f9c[0x1]||'en'});return _0x5beb9c[_0xf94f('0x1f')](this[_0xf94f('0x20')][_0xf94f('0x21')],{'sessionId':md5(this[_0xf94f('0x13')]['id'])})[_0xf94f('0x22')](function(_0x4c9ec5){_0x3aa34b[_0xf94f('0x21')][_0xf94f('0x23')]=_0x4c9ec5;_0x510972[_0xf94f('0x21')]=_0x4c9ec5['result'][_0xf94f('0x24')][_0xf94f('0x25')];_0x510972['providerName']=_0xf94f('0x23');_0x510972['providerResponse']=JSON['stringify'](_0x4c9ec5);return rpc[_0xb83e27+_0xf94f('0x1a')][_0xf94f('0x26')](_0x510972)['then'](function(_0x55e414){logger[_0xf94f('0xa')](_0xf94f('0xb'),_0x18919a,_0x510972['body']);if(_0x4c9ec5[_0xf94f('0x27')][_0xf94f('0x28')][_0xf94f('0x29')]){_0x192f2c['next']();}else{_0x192f2c[_0xf94f('0x1e')]();}})['catch'](function(_0x2f3471){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON['stringify'](_0x2f3471));_0x192f2c[_0xf94f('0x2a')]();});})[_0xf94f('0x1b')](function(_0x432e12){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,_0x432e12[_0xf94f('0x20')]);_0x192f2c[_0xf94f('0x2a')]();});}}catch(_0x57716c){logger[_0xf94f('0x1c')](_0xf94f('0xb'),_0x18919a,JSON[_0xf94f('0x2b')](_0x57716c));_0x192f2c[_0xf94f('0x1e')]();}};}; \ No newline at end of file +var _0xc9ab=['speech','providerResponse','Message','endConversation','catch','lodash','moment','apiai-promise','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','next','contact','format','sms','channel','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','create','then','info','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment'];(function(_0x316888,_0x27ebd3){var _0x1cd670=function(_0x5eef48){while(--_0x5eef48){_0x316888['push'](_0x316888['shift']());}};_0x1cd670(++_0x27ebd3);}(_0xc9ab,0x125));var _0xbc9a=function(_0x1b0c66,_0x721990){_0x1b0c66=_0x1b0c66-0x0;var _0x185648=_0xc9ab[_0x1b0c66];return _0x185648;};'use strict';var _=require(_0xbc9a('0x0'));var moment=require(_0xbc9a('0x1'));var apiai=require(_0xbc9a('0x2'));var md5=require('md5');var utils=require('./utils');var logger=require('../../../../config/logger')(_0xbc9a('0x3'));var rpc={'chatMessage':require(_0xbc9a('0x4')),'openchannelMessage':require(_0xbc9a('0x5')),'mailMessage':require(_0xbc9a('0x6')),'smsMessage':require(_0xbc9a('0x7')),'faxMessage':require(_0xbc9a('0x8')),'whatsappMessage':require(_0xbc9a('0x9'))};exports[_0xbc9a('0xa')]=function(_0x477055,_0x3baf56){return function(_0x26f5f4){try{if(!_[_0xbc9a('0xb')](this[_0xbc9a('0xc')][_0xbc9a('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x477055,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x26f5f4[_0xbc9a('0xe')]();}var _0x58f385={'ContactId':this[_0xbc9a('0xf')]['id'],'sentAt':moment()[_0xbc9a('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xbc9a('0x11')||this[_0xbc9a('0x12')]==='whatsapp'){_0x58f385[_0xbc9a('0x13')]=this[_0xbc9a('0xc')][_0xbc9a('0x13')];}var _0x3f0436=this[_0xbc9a('0x12')];if(_0x3f0436===_0xbc9a('0x14')){_0x58f385[_0xbc9a('0x15')]=this['account']['id'];}else{_0x58f385[_[_0xbc9a('0x16')](_0x3f0436)+_0xbc9a('0x17')]=this[_0xbc9a('0x18')]['id'];}_0x58f385[_['upperFirst'](_0x3f0436)+'InteractionId']=this[_0xbc9a('0xc')]['id'];if(this[_0xbc9a('0xc')][_0xbc9a('0x19')]){var _0x42175f=_0x3baf56[0x2];if(!_[_0xbc9a('0x1a')](_0x42175f)){_0x58f385[_0xbc9a('0x1b')]=utils['getMustacheRender'](_0x42175f,this);return rpc[_0x3f0436+'Message'][_0xbc9a('0x1c')](_0x58f385)[_0xbc9a('0x1d')](function(_0x5b44fe){logger[_0xbc9a('0x1e')](_0xbc9a('0x1f'),_0x477055,_0x58f385[_0xbc9a('0x1b')]);})['catch'](function(_0x67b853){logger[_0xbc9a('0x20')](_0xbc9a('0x1f'),_0x477055,JSON[_0xbc9a('0x21')](_0x67b853));})[_0xbc9a('0x22')](function(){logger[_0xbc9a('0x1e')](_0xbc9a('0x23'),_0x477055);_0x26f5f4[_0xbc9a('0x24')]();});}else{logger[_0xbc9a('0x1e')](_0xbc9a('0x25'),_0x477055);_0x26f5f4[_0xbc9a('0x24')]();}}else{var _0x482a5a=this;var _0x5cf651=apiai(_0x3baf56[0x0],{'language':_0x3baf56[0x1]||'en'});return _0x5cf651[_0xbc9a('0x26')](this[_0xbc9a('0x27')][_0xbc9a('0x1b')],{'sessionId':md5(this[_0xbc9a('0xc')]['id'])})[_0xbc9a('0x1d')](function(_0xdea80c){_0x482a5a[_0xbc9a('0x1b')][_0xbc9a('0x28')]=_0xdea80c;_0x58f385[_0xbc9a('0x1b')]=_0xdea80c[_0xbc9a('0x29')][_0xbc9a('0x2a')][_0xbc9a('0x2b')];_0x58f385['providerName']=_0xbc9a('0x28');_0x58f385[_0xbc9a('0x2c')]=JSON[_0xbc9a('0x21')](_0xdea80c);return rpc[_0x3f0436+_0xbc9a('0x2d')][_0xbc9a('0x1c')](_0x58f385)[_0xbc9a('0x1d')](function(_0x2ea21b){logger['info'](_0xbc9a('0x1f'),_0x477055,_0x58f385[_0xbc9a('0x1b')]);if(_0xdea80c[_0xbc9a('0x29')]['metadata'][_0xbc9a('0x2e')]){_0x26f5f4[_0xbc9a('0xe')]();}else{_0x26f5f4[_0xbc9a('0x24')]();}})[_0xbc9a('0x2f')](function(_0x9e1a79){logger[_0xbc9a('0x20')](_0xbc9a('0x1f'),_0x477055,JSON[_0xbc9a('0x21')](_0x9e1a79));_0x26f5f4[_0xbc9a('0xe')]();});})['catch'](function(_0x2d3231){logger[_0xbc9a('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x477055,_0x2d3231['message']);_0x26f5f4[_0xbc9a('0xe')]();});}}catch(_0x4131cd){logger[_0xbc9a('0x20')](_0xbc9a('0x1f'),_0x477055,JSON[_0xbc9a('0x21')](_0x4131cd));_0x26f5f4[_0xbc9a('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 483bcf7..5df0165 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed04=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','next','catch','lodash','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','clone','body','Message','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','interaction','phone','chat','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','create','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x525370,_0x5abe18){var _0x4a1ae9=function(_0x257f97){while(--_0x257f97){_0x525370['push'](_0x525370['shift']());}};_0x4a1ae9(++_0x5abe18);}(_0xed04,0xa4));var _0x4ed0=function(_0xb8d164,_0x2e61bf){_0xb8d164=_0xb8d164-0x0;var _0x5da372=_0xed04[_0xb8d164];return _0x5da372;};'use strict';var _=require(_0x4ed0('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require('../../../../config/logger')(_0x4ed0('0x1'));var utils=require(_0x4ed0('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4ed0('0x3')),'mailMessage':require(_0x4ed0('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4ed0('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2838a9,_0x3d4e34,_0x57cddd,_0x54c3d6){return new Promise(function(_0x6a4bec,_0x512f2b){var _0x17a038=_[_0x4ed0('0x6')](_0x57cddd);_0x17a038[_0x4ed0('0x7')]=_0x54c3d6;return rpc[_0x3d4e34+_0x4ed0('0x8')]['create'](_0x17a038)['then'](function(){logger[_0x4ed0('0x9')](_0x4ed0('0xa'),_0x2838a9,_0x17a038[_0x4ed0('0x7')]);_0x6a4bec();})['catch'](function(_0x40744b){logger[_0x4ed0('0xb')](_0x4ed0('0xa'),_0x2838a9,JSON[_0x4ed0('0xc')](_0x40744b));_0x512f2b(_0x40744b);});});}exports['consequence']=function(_0xdbaeb6,_0x21c662){return function(_0x18c0b2){try{if(!_['isNil'](this['interaction'][_0x4ed0('0xd')])){logger[_0x4ed0('0x9')](_0x4ed0('0xa'),_0xdbaeb6,_0x4ed0('0xe'));return _0x18c0b2['next']();}var _0x3564e7={'ContactId':this[_0x4ed0('0xf')]['id'],'sentAt':moment()[_0x4ed0('0x10')](_0x4ed0('0x11')),'direction':_0x4ed0('0x12')};if(this[_0x4ed0('0x13')]===_0x4ed0('0x14')||this[_0x4ed0('0x13')]==='whatsapp'){_0x3564e7['phone']=this[_0x4ed0('0x15')][_0x4ed0('0x16')];}var _0x555cb7=this['channel'];if(_0x555cb7===_0x4ed0('0x17')){_0x3564e7['ChatWebsiteId']=this[_0x4ed0('0x18')]['id'];}else{_0x3564e7[_[_0x4ed0('0x19')](_0x555cb7)+_0x4ed0('0x1a')]=this[_0x4ed0('0x18')]['id'];}_0x3564e7[_['upperFirst'](_0x555cb7)+_0x4ed0('0x1b')]=this[_0x4ed0('0x15')]['id'];if(this[_0x4ed0('0x15')]['created']){var _0x567411=_0x21c662[0x4];if(!_[_0x4ed0('0x1c')](_0x567411)){_0x3564e7[_0x4ed0('0x7')]=utils[_0x4ed0('0x1d')](_0x567411,this);return rpc[_0x555cb7+'Message'][_0x4ed0('0x1e')](_0x3564e7)[_0x4ed0('0x1f')](function(_0x111d25){logger['info'](_0x4ed0('0xa'),_0xdbaeb6,_0x3564e7[_0x4ed0('0x7')]);})['catch'](function(_0x426e4a){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,JSON[_0x4ed0('0xc')](_0x426e4a));})[_0x4ed0('0x20')](function(){logger[_0x4ed0('0x9')](_0x4ed0('0x21'),_0xdbaeb6);_0x18c0b2['stop']();});}else{logger[_0x4ed0('0x9')](_0x4ed0('0x22'),_0xdbaeb6);_0x18c0b2[_0x4ed0('0x23')]();}}else{var _0x1e80a2=this;var _0x8f25e1=_0x21c662[0x2][_0x4ed0('0x24')](/\\n/g,'\x0a');var _0x48a49a={'credentials':{'private_key':_0x8f25e1,'client_email':_0x21c662[0x1]}};var _0x43d6a1=new dialogflow['SessionsClient'](_0x48a49a);var _0x26fbfa=_0x43d6a1['sessionPath'](_0x21c662[0x0],md5(_0x1e80a2[_0x4ed0('0x15')]['id']));var _0x56d2e2={'session':_0x26fbfa,'queryInput':{'text':{'text':_0x1e80a2[_0x4ed0('0x25')]['body'],'languageCode':_0x21c662[0x3]||'en'}}};return _0x43d6a1[_0x4ed0('0x26')](_0x56d2e2)[_0x4ed0('0x1f')](function(_0x177066){if(_0x177066&&_0x177066[_0x4ed0('0x27')]){_0x1e80a2['body'][_0x4ed0('0x28')]=_0x177066;var _0x52b195=_0x177066[0x0];var _0x44a8a5=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]&&_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]['fields']?_0x52b195['queryResult'][_0x4ed0('0x2a')][_0x4ed0('0x2b')][_0x4ed0('0x2c')][_0x4ed0('0x2d')]:![];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x2e')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2f')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x30')]=_0x52b195['queryResult']['allRequiredParamsPresent'];_0x1e80a2['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x2a')]&&_0x52b195['queryResult'][_0x4ed0('0x2a')][_0x4ed0('0x2b')]?_0x52b195['queryResult'][_0x4ed0('0x2a')]['fields'][_0x4ed0('0x2c')]['boolValue']:![];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x31')]=_0x52b195[_0x4ed0('0x29')]['intent'][_0x4ed0('0x32')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x33')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x34')][_0x4ed0('0x35')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x36')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x34')]['isFallback'];_0x1e80a2['body'][_0x4ed0('0x37')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x38')];_0x1e80a2[_0x4ed0('0x7')]['DIALOGFLOWV2_QUERYTEXT']=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x39')];_0x1e80a2[_0x4ed0('0x7')][_0x4ed0('0x3a')]=_0x52b195[_0x4ed0('0x29')][_0x4ed0('0x3b')];_0x3564e7['providerName']=_0x4ed0('0x28');_0x3564e7[_0x4ed0('0x3c')]=JSON[_0x4ed0('0xc')](_0x177066);var _0x595363=[];for(var _0x4a0c8d=0x0;_0x4a0c8d<_0x177066[_0x4ed0('0x27')];_0x4a0c8d++){var _0x7c15c0=_0x177066[_0x4a0c8d];if(_0x7c15c0&&_0x7c15c0[_0x4ed0('0x29')]&&_0x7c15c0[_0x4ed0('0x29')][_0x4ed0('0x3d')]){_0x595363[_0x4ed0('0x3e')](createMessage(_0xdbaeb6,_0x555cb7,_0x3564e7,_0x7c15c0[_0x4ed0('0x29')][_0x4ed0('0x3d')]));}}return Promise[_0x4ed0('0x3f')](_0x595363)[_0x4ed0('0x1f')](function(){if(_0x44a8a5){_0x18c0b2[_0x4ed0('0x40')]();}else{_0x18c0b2['stop']();}})[_0x4ed0('0x41')](function(_0x3ded9e){logger[_0x4ed0('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0xdbaeb6,JSON[_0x4ed0('0xc')](_0x3ded9e));_0x18c0b2['next']();});}})[_0x4ed0('0x41')](function(_0xa68b1){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,_0xa68b1[_0x4ed0('0x25')]);_0x18c0b2[_0x4ed0('0x40')]();});}}catch(_0x35c74c){logger['error'](_0x4ed0('0xa'),_0xdbaeb6,JSON['stringify'](_0x35c74c));_0x18c0b2[_0x4ed0('0x23')]();}};}; \ No newline at end of file +var _0x4c8b=['intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','length','fulfillmentText','push','all','message','lodash','dialogflow','bluebird','../../../../config/logger','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','interaction','created','isEmpty','getMustacheRender','then','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','sessionPath','detectIntent','dialogflowV2','fields','queryResult','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','diagnosticInfo','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME'];(function(_0x2f8de9,_0x5c0559){var _0xa3e497=function(_0x292837){while(--_0x292837){_0x2f8de9['push'](_0x2f8de9['shift']());}};_0xa3e497(++_0x5c0559);}(_0x4c8b,0x17d));var _0xb4c8=function(_0x579b0e,_0x4bf56a){_0x579b0e=_0x579b0e-0x0;var _0x3f289a=_0x4c8b[_0x579b0e];return _0x3f289a;};'use strict';var _=require(_0xb4c8('0x0'));var dialogflow=require(_0xb4c8('0x1'));var md5=require('md5');var moment=require('moment');var Promise=require(_0xb4c8('0x2'));var logger=require(_0xb4c8('0x3'))('routing');var utils=require(_0xb4c8('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xb4c8('0x5')),'mailMessage':require(_0xb4c8('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xb4c8('0x7'))};function createMessage(_0x1c5a6b,_0xa64910,_0x5b9df9,_0x5c833f){return new Promise(function(_0x2cadda,_0x1fcb57){var _0x9cd93a=_[_0xb4c8('0x8')](_0x5b9df9);_0x9cd93a[_0xb4c8('0x9')]=_0x5c833f;return rpc[_0xa64910+'Message'][_0xb4c8('0xa')](_0x9cd93a)['then'](function(){logger[_0xb4c8('0xb')](_0xb4c8('0xc'),_0x1c5a6b,_0x9cd93a[_0xb4c8('0x9')]);_0x2cadda();})['catch'](function(_0x22f68d){logger[_0xb4c8('0xd')](_0xb4c8('0xc'),_0x1c5a6b,JSON[_0xb4c8('0xe')](_0x22f68d));_0x1fcb57(_0x22f68d);});});}exports[_0xb4c8('0xf')]=function(_0x445453,_0x567c75){return function(_0xf3d5ad){try{if(!_[_0xb4c8('0x10')](this['interaction'][_0xb4c8('0x11')])){logger[_0xb4c8('0xb')](_0xb4c8('0xc'),_0x445453,_0xb4c8('0x12'));return _0xf3d5ad[_0xb4c8('0x13')]();}var _0x222af2={'ContactId':this[_0xb4c8('0x14')]['id'],'sentAt':moment()[_0xb4c8('0x15')](_0xb4c8('0x16')),'direction':_0xb4c8('0x17')};if(this[_0xb4c8('0x18')]===_0xb4c8('0x19')||this[_0xb4c8('0x18')]==='whatsapp'){_0x222af2[_0xb4c8('0x1a')]=this['interaction']['phone'];}var _0x576e4c=this[_0xb4c8('0x18')];if(_0x576e4c===_0xb4c8('0x1b')){_0x222af2[_0xb4c8('0x1c')]=this[_0xb4c8('0x1d')]['id'];}else{_0x222af2[_[_0xb4c8('0x1e')](_0x576e4c)+'AccountId']=this[_0xb4c8('0x1d')]['id'];}_0x222af2[_[_0xb4c8('0x1e')](_0x576e4c)+'InteractionId']=this[_0xb4c8('0x1f')]['id'];if(this[_0xb4c8('0x1f')][_0xb4c8('0x20')]){var _0x30253f=_0x567c75[0x4];if(!_[_0xb4c8('0x21')](_0x30253f)){_0x222af2[_0xb4c8('0x9')]=utils[_0xb4c8('0x22')](_0x30253f,this);return rpc[_0x576e4c+'Message'][_0xb4c8('0xa')](_0x222af2)[_0xb4c8('0x23')](function(_0x4a927d){logger[_0xb4c8('0xb')](_0xb4c8('0xc'),_0x445453,_0x222af2[_0xb4c8('0x9')]);})[_0xb4c8('0x24')](function(_0xace473){logger[_0xb4c8('0xd')](_0xb4c8('0xc'),_0x445453,JSON[_0xb4c8('0xe')](_0xace473));})[_0xb4c8('0x25')](function(){logger[_0xb4c8('0xb')](_0xb4c8('0x26'),_0x445453);_0xf3d5ad['stop']();});}else{logger['info'](_0xb4c8('0x27'),_0x445453);_0xf3d5ad[_0xb4c8('0x28')]();}}else{var _0x57f727=this;var _0x49892e=_0x567c75[0x2][_0xb4c8('0x29')](/\\n/g,'\x0a');var _0xe8da27={'credentials':{'private_key':_0x49892e,'client_email':_0x567c75[0x1]}};var _0x18edf3=new dialogflow['SessionsClient'](_0xe8da27);var _0x1d6c54=_0x18edf3[_0xb4c8('0x2a')](_0x567c75[0x0],md5(_0x57f727[_0xb4c8('0x1f')]['id']));var _0x5de3c6={'session':_0x1d6c54,'queryInput':{'text':{'text':_0x57f727['message'][_0xb4c8('0x9')],'languageCode':_0x567c75[0x3]||'en'}}};return _0x18edf3[_0xb4c8('0x2b')](_0x5de3c6)[_0xb4c8('0x23')](function(_0x5ebc4f){if(_0x5ebc4f&&_0x5ebc4f['length']){_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x2c')]=_0x5ebc4f;var _0x116068=_0x5ebc4f[0x0];var _0x34c422=_0x116068['queryResult']['diagnosticInfo']&&_0x116068['queryResult']['diagnosticInfo'][_0xb4c8('0x2d')]?_0x116068[_0xb4c8('0x2e')]['diagnosticInfo'][_0xb4c8('0x2d')][_0xb4c8('0x2f')][_0xb4c8('0x30')]:![];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x31')]=_0x116068[_0xb4c8('0x2e')]['action'];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x32')]=_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x33')];_0x57f727['body'][_0xb4c8('0x34')]=_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x35')]&&_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x35')][_0xb4c8('0x2d')]?_0x116068['queryResult'][_0xb4c8('0x35')][_0xb4c8('0x2d')][_0xb4c8('0x2f')]['boolValue']:![];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x36')]=_0x116068[_0xb4c8('0x2e')]['intent'][_0xb4c8('0x37')];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x38')]=_0x116068['queryResult'][_0xb4c8('0x39')][_0xb4c8('0x3a')];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x3b')]=_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x39')][_0xb4c8('0x3c')];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x3d')]=_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x3e')];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x3f')]=_0x116068[_0xb4c8('0x2e')][_0xb4c8('0x40')];_0x57f727[_0xb4c8('0x9')][_0xb4c8('0x41')]=_0x116068['queryResult'][_0xb4c8('0x42')];_0x222af2['providerName']='dialogflowV2';_0x222af2[_0xb4c8('0x43')]=JSON[_0xb4c8('0xe')](_0x5ebc4f);var _0x3b5406=[];for(var _0x21e8a5=0x0;_0x21e8a5<_0x5ebc4f[_0xb4c8('0x44')];_0x21e8a5++){var _0x17059=_0x5ebc4f[_0x21e8a5];if(_0x17059&&_0x17059['queryResult']&&_0x17059['queryResult'][_0xb4c8('0x45')]){_0x3b5406[_0xb4c8('0x46')](createMessage(_0x445453,_0x576e4c,_0x222af2,_0x17059[_0xb4c8('0x2e')][_0xb4c8('0x45')]));}}return Promise[_0xb4c8('0x47')](_0x3b5406)[_0xb4c8('0x23')](function(){if(_0x34c422){_0xf3d5ad['next']();}else{_0xf3d5ad['stop']();}})[_0xb4c8('0x24')](function(_0x3302f9){logger[_0xb4c8('0xd')](_0xb4c8('0xc'),_0x445453,JSON['stringify'](_0x3302f9));_0xf3d5ad['next']();});}})['catch'](function(_0x32e9ed){logger[_0xb4c8('0xd')](_0xb4c8('0xc'),_0x445453,_0x32e9ed[_0xb4c8('0x48')]);_0xf3d5ad['next']();});}}catch(_0x58ebc2){logger[_0xb4c8('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x445453,JSON['stringify'](_0x58ebc2));_0xf3d5ad[_0xb4c8('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 4f52790..d912175 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd660=['consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number'];(function(_0x1b9721,_0x14bca5){var _0x288bb1=function(_0x1fa311){while(--_0x1fa311){_0x1b9721['push'](_0x1b9721['shift']());}};_0x288bb1(++_0x14bca5);}(_0xd660,0xe7));var _0x0d66=function(_0x28678d,_0x54324f){_0x28678d=_0x28678d-0x0;var _0x1643e9=_0xd660[_0x28678d];return _0x1643e9;};'use strict';var schema=require(_0x0d66('0x0'));var _=require(_0x0d66('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x0d66('0x2'));var logger=require(_0x0d66('0x3'))(_0x0d66('0x4'));var gotoif=schema({'condition':{'type':_0x0d66('0x5'),'required':!![],'message':_0x0d66('0x6')},'priorityTrue':{'type':_0x0d66('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0d66('0x7'),'message':_0x0d66('0x8')}});exports[_0x0d66('0x9')]=function(_0x27db13,_0x3135fe){return function(_0x10b9f9){try{var _0x35a35c={'condition':htmlToText[_0x0d66('0xa')](utils[_0x0d66('0xb')](_0x3135fe[0x0],this),{'wordwrap':![]})[_0x0d66('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3135fe[0x1],'priorityFalse':_0x3135fe[0x2]};var _0x51c945=gotoif['validate'](_0x35a35c,{'typecast':!![]});if(_0x51c945[_0x0d66('0xd')]){logger['error'](_0x0d66('0xe'),_0x27db13,_[_0x0d66('0xf')](_0x51c945,_0x0d66('0x10'))[_0x0d66('0x11')](',\x20'));_0x10b9f9[_0x0d66('0x12')]();}else{try{var _0x2a25a0=eval('('+_0x35a35c[_0x0d66('0x13')]+')');var _0x3a5f76=_0x2a25a0?_0x35a35c[_0x0d66('0x14')]:_0x35a35c[_0x0d66('0x15')];logger[_0x0d66('0x16')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x27db13,_0x35a35c[_0x0d66('0x13')],_0x2a25a0,_0x3a5f76||_0x0d66('0x17'));if(_0x3a5f76){var _0x10f724=_['findIndex'](_0x10b9f9[_0x0d66('0x18')](),{'p':_0x3a5f76});if(_0x10f724>=0x0){logger[_0x0d66('0x16')](_0x0d66('0x19'),_0x27db13,_0x3a5f76||'next',_0x10f724);_0x10b9f9[_0x0d66('0x17')](_0x10f724);}else{logger[_0x0d66('0x16')](_0x0d66('0x1a'),_0x27db13,_0x3a5f76||_0x0d66('0x17'));_0x10b9f9[_0x0d66('0x12')]();}}else{_0x10b9f9[_0x0d66('0x17')]();}}catch(_0x47d77a){logger[_0x0d66('0x1b')](_0x0d66('0x1c'),_0x27db13,_0x47d77a[_0x0d66('0x10')]);_0x10b9f9[_0x0d66('0x12')]();}}}catch(_0x3ec0a7){logger['error'](_0x0d66('0xe'),_0x27db13,JSON[_0x0d66('0x1d')](_0x3ec0a7));_0x10b9f9['stop']();}};}; \ No newline at end of file +var _0xf2cd=['next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','length','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2cd,0x15a));var _0xdf2c=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xf2cd[_0x4bb66f];return _0xf2772f;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require(_0xdf2c('0x0'))('routing');var gotoif=schema({'condition':{'type':_0xdf2c('0x1'),'required':!![],'message':_0xdf2c('0x2')},'priorityTrue':{'type':_0xdf2c('0x3'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xdf2c('0x3'),'message':_0xdf2c('0x4')}});exports[_0xdf2c('0x5')]=function(_0x58c9ce,_0x377b60){return function(_0x51caad){try{var _0x3e0883={'condition':htmlToText[_0xdf2c('0x6')](utils['getMustacheRender'](_0x377b60[0x0],this),{'wordwrap':![]})[_0xdf2c('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x377b60[0x1],'priorityFalse':_0x377b60[0x2]};var _0x17108c=gotoif[_0xdf2c('0x8')](_0x3e0883,{'typecast':!![]});if(_0x17108c[_0xdf2c('0x9')]){logger['error']('[%s][GOTOIF]\x20%s',_0x58c9ce,_[_0xdf2c('0xa')](_0x17108c,'message')[_0xdf2c('0xb')](',\x20'));_0x51caad[_0xdf2c('0xc')]();}else{try{var _0x4ffa3f=eval('('+_0x3e0883[_0xdf2c('0xd')]+')');var _0x2bcf64=_0x4ffa3f?_0x3e0883[_0xdf2c('0xe')]:_0x3e0883[_0xdf2c('0xf')];logger[_0xdf2c('0x10')](_0xdf2c('0x11'),_0x58c9ce,_0x3e0883['condition'],_0x4ffa3f,_0x2bcf64||_0xdf2c('0x12'));if(_0x2bcf64){var _0x431cef=_[_0xdf2c('0x13')](_0x51caad[_0xdf2c('0x14')](),{'p':_0x2bcf64});if(_0x431cef>=0x0){logger[_0xdf2c('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x58c9ce,_0x2bcf64||'next',_0x431cef);_0x51caad[_0xdf2c('0x12')](_0x431cef);}else{logger['info'](_0xdf2c('0x15'),_0x58c9ce,_0x2bcf64||_0xdf2c('0x12'));_0x51caad[_0xdf2c('0xc')]();}}else{_0x51caad[_0xdf2c('0x12')]();}}catch(_0x265e3e){logger[_0xdf2c('0x16')](_0xdf2c('0x17'),_0x58c9ce,_0x265e3e[_0xdf2c('0x18')]);_0x51caad[_0xdf2c('0xc')]();}}}catch(_0x31f5da){logger['error'](_0xdf2c('0x19'),_0x58c9ce,JSON['stringify'](_0x31f5da));_0x51caad[_0xdf2c('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index ef26922..c3bdcfa 100644 --- a/server/services/routing/server/applications/gotop.js +++ b/server/services/routing/server/applications/gotop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x39ae=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing','number','length','error','[%s][GOTOP]\x20%s','map','join','stop'];(function(_0x4ec4a1,_0x304ef9){var _0x55de6c=function(_0x5b38cc){while(--_0x5b38cc){_0x4ec4a1['push'](_0x4ec4a1['shift']());}};_0x55de6c(++_0x304ef9);}(_0x39ae,0x100));var _0xe39a=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x39ae[_0x25e7cb];return _0x375d92;};'use strict';var schema=require(_0xe39a('0x0'));var _=require('lodash');var logger=require(_0xe39a('0x1'))(_0xe39a('0x2'));var gotop=schema({'priority':{'type':_0xe39a('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4e5e67,_0x51e422){return function(_0x5d60c8){try{var _0x3f7080={'priority':_0x51e422[0x0]};var _0x4c4e65=gotop[_0xe39a('0x0')](_0x3f7080,{'typecast':!![]});if(_0x4c4e65[_0xe39a('0x4')]){logger[_0xe39a('0x5')](_0xe39a('0x6'),_0x4e5e67,_[_0xe39a('0x7')](_0x4c4e65,'message')[_0xe39a('0x8')](',\x20'));_0x5d60c8[_0xe39a('0x9')]();}else{logger[_0xe39a('0xa')](_0xe39a('0xb'),_0x4e5e67,_0x3f7080['priority']);if(_0x3f7080[_0xe39a('0xc')]){var _0x8357d8=_[_0xe39a('0xd')](_0x5d60c8[_0xe39a('0xe')](),{'p':_0x3f7080['priority']});if(_0x8357d8>=0x0){logger['info'](_0xe39a('0xf'),_0x4e5e67,_0x3f7080[_0xe39a('0xc')]||_0xe39a('0x10'),_0x8357d8);_0x5d60c8[_0xe39a('0x10')](_0x8357d8);}else{logger[_0xe39a('0xa')](_0xe39a('0x11'),_0x4e5e67,_0x3f7080[_0xe39a('0xc')]||'next');_0x5d60c8['stop']();}}else{_0x5d60c8['next']();}}}catch(_0x1ba220){logger['error'](_0xe39a('0x6'),_0x4e5e67,JSON[_0xe39a('0x12')](_0x1ba220));_0x5d60c8['stop']();}};}; \ No newline at end of file +var _0x804f=['stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x57bd47,_0x321b35){var _0x2c1ce3=function(_0x172238){while(--_0x172238){_0x57bd47['push'](_0x57bd47['shift']());}};_0x2c1ce3(++_0x321b35);}(_0x804f,0xb1));var _0xf804=function(_0x490cff,_0x48876b){_0x490cff=_0x490cff-0x0;var _0x1c31cf=_0x804f[_0x490cff];return _0x1c31cf;};'use strict';var schema=require(_0xf804('0x0'));var _=require(_0xf804('0x1'));var logger=require('../../../../config/logger')(_0xf804('0x2'));var gotop=schema({'priority':{'type':_0xf804('0x3'),'required':!![],'message':_0xf804('0x4')}});exports['consequence']=function(_0x54ba0b,_0x23c13d){return function(_0x31245a){try{var _0x4b6c78={'priority':_0x23c13d[0x0]};var _0x5b89cf=gotop[_0xf804('0x0')](_0x4b6c78,{'typecast':!![]});if(_0x5b89cf['length']){logger[_0xf804('0x5')](_0xf804('0x6'),_0x54ba0b,_[_0xf804('0x7')](_0x5b89cf,_0xf804('0x8'))[_0xf804('0x9')](',\x20'));_0x31245a[_0xf804('0xa')]();}else{logger[_0xf804('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x54ba0b,_0x4b6c78[_0xf804('0xc')]);if(_0x4b6c78[_0xf804('0xc')]){var _0x5e6d22=_['findIndex'](_0x31245a[_0xf804('0xd')](),{'p':_0x4b6c78[_0xf804('0xc')]});if(_0x5e6d22>=0x0){logger[_0xf804('0xb')](_0xf804('0xe'),_0x54ba0b,_0x4b6c78[_0xf804('0xc')]||'next',_0x5e6d22);_0x31245a[_0xf804('0xf')](_0x5e6d22);}else{logger[_0xf804('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x54ba0b,_0x4b6c78[_0xf804('0xc')]||_0xf804('0xf'));_0x31245a[_0xf804('0xa')]();}}else{_0x31245a[_0xf804('0xf')]();}}}catch(_0x47fdf1){logger[_0xf804('0x5')]('[%s][GOTOP]\x20%s',_0x54ba0b,JSON[_0xf804('0x10')](_0x47fdf1));_0x31245a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 0bcf46c..042fb89 100644 --- a/server/services/routing/server/applications/message.js +++ b/server/services/routing/server/applications/message.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe9d=['create','info','[%s][MESSAGE]\x20%s','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','AccountId','upperFirst','channel','interaction','Message'];(function(_0x26fa5d,_0x37c7fd){var _0x5c4543=function(_0x13560){while(--_0x13560){_0x26fa5d['push'](_0x26fa5d['shift']());}};_0x5c4543(++_0x37c7fd);}(_0xbe9d,0x99));var _0xdbe9=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xbe9d[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xdbe9('0x0'));var utils=require(_0xdbe9('0x1'));var logger=require(_0xdbe9('0x2'))(_0xdbe9('0x3'));var rpc={'chatMessage':require(_0xdbe9('0x4')),'openchannelMessage':require(_0xdbe9('0x5')),'mailMessage':require(_0xdbe9('0x6')),'smsMessage':require(_0xdbe9('0x7')),'faxMessage':require(_0xdbe9('0x8')),'whatsappMessage':require(_0xdbe9('0x9'))};exports[_0xdbe9('0xa')]=function(_0x2602b1,_0x163517){return function(_0x52405e){try{var _0x56e9be={'body':utils[_0xdbe9('0xb')](_0x163517[0x0],this),'ContactId':this[_0xdbe9('0xc')]['id']};if(this['channel']===_0xdbe9('0xd')){_0x56e9be[_0xdbe9('0xe')]=this[_0xdbe9('0xf')]['id'];}else{_0x56e9be[_['upperFirst'](this['channel'])+_0xdbe9('0x10')]=this[_0xdbe9('0xf')]['id'];}_0x56e9be[_[_0xdbe9('0x11')](this[_0xdbe9('0x12')])+'InteractionId']=this[_0xdbe9('0x13')]['id'];if(rpc[this[_0xdbe9('0x12')]+_0xdbe9('0x14')]){return rpc[this[_0xdbe9('0x12')]+'Message'][_0xdbe9('0x15')](_0x56e9be)['then'](function(_0x31233b){logger[_0xdbe9('0x16')](_0xdbe9('0x17'),_0x2602b1,_0x56e9be['body']);_0x52405e[_0xdbe9('0x18')]();})[_0xdbe9('0x19')](function(_0x2429fb){logger['error'](_0xdbe9('0x17'),_0x2602b1,JSON['stringify'](_0x2429fb));_0x52405e[_0xdbe9('0x1a')]();});}}catch(_0x36b5c9){logger[_0xdbe9('0x1b')]('[%s][MESSAGE]\x20%s',_0x2602b1,JSON[_0xdbe9('0x1c')](_0x36b5c9));_0x52405e[_0xdbe9('0x1a')]();}};}; \ No newline at end of file +var _0x843e=['Message','create','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction'];(function(_0x54df86,_0x15133f){var _0x516809=function(_0x467808){while(--_0x467808){_0x54df86['push'](_0x54df86['shift']());}};_0x516809(++_0x15133f);}(_0x843e,0xcd));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe843('0x0'));var utils=require(_0xe843('0x1'));var logger=require(_0xe843('0x2'))(_0xe843('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe843('0x4')),'mailMessage':require(_0xe843('0x5')),'smsMessage':require(_0xe843('0x6')),'faxMessage':require(_0xe843('0x7')),'whatsappMessage':require(_0xe843('0x8'))};exports[_0xe843('0x9')]=function(_0x2e7e58,_0x4dcba9){return function(_0x3fdf63){try{var _0x329018={'body':utils['getMustacheRender'](_0x4dcba9[0x0],this),'ContactId':this[_0xe843('0xa')]['id']};if(this[_0xe843('0xb')]===_0xe843('0xc')){_0x329018[_0xe843('0xd')]=this[_0xe843('0xe')]['id'];}else{_0x329018[_[_0xe843('0xf')](this[_0xe843('0xb')])+_0xe843('0x10')]=this[_0xe843('0xe')]['id'];}_0x329018[_[_0xe843('0xf')](this[_0xe843('0xb')])+_0xe843('0x11')]=this[_0xe843('0x12')]['id'];if(rpc[this[_0xe843('0xb')]+_0xe843('0x13')]){return rpc[this[_0xe843('0xb')]+_0xe843('0x13')][_0xe843('0x14')](_0x329018)['then'](function(_0x2b1802){logger[_0xe843('0x15')](_0xe843('0x16'),_0x2e7e58,_0x329018[_0xe843('0x17')]);_0x3fdf63['next']();})[_0xe843('0x18')](function(_0x4547c9){logger[_0xe843('0x19')]('[%s][MESSAGE]\x20%s',_0x2e7e58,JSON[_0xe843('0x1a')](_0x4547c9));_0x3fdf63['stop']();});}}catch(_0x5c6f63){logger[_0xe843('0x19')](_0xe843('0x16'),_0x2e7e58,JSON[_0xe843('0x1a')](_0x5c6f63));_0x3fdf63[_0xe843('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 571a7c4..ee1c034 100644 --- a/server/services/routing/server/applications/noop.js +++ b/server/services/routing/server/applications/noop.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e7=['next','error','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x54e7,0x18f));var _0x754e=function(_0x49e990,_0x5935fc){_0x49e990=_0x49e990-0x0;var _0x5a5c83=_0x54e7[_0x49e990];return _0x5a5c83;};'use strict';var utils=require(_0x754e('0x0'));var logger=require(_0x754e('0x1'))('routing');exports[_0x754e('0x2')]=function(_0x1dd9d2,_0x2eff25){return function(_0x3918b5){try{logger[_0x754e('0x3')](_0x754e('0x4'),_0x1dd9d2,utils[_0x754e('0x5')](_0x2eff25[0x0],this));_0x3918b5[_0x754e('0x6')]();}catch(_0x1b5151){logger[_0x754e('0x7')](_0x754e('0x4'),_0x1dd9d2,JSON['stringify'](_0x1b5151));_0x3918b5[_0x754e('0x8')]();}};}; \ No newline at end of file +var _0x3204=['../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0x2e1339,_0x1ddcfc){var _0x866fcb=function(_0x946acc){while(--_0x946acc){_0x2e1339['push'](_0x2e1339['shift']());}};_0x866fcb(++_0x1ddcfc);}(_0x3204,0x14d));var _0x4320=function(_0x1253f1,_0x102227){_0x1253f1=_0x1253f1-0x0;var _0x4f1143=_0x3204[_0x1253f1];return _0x4f1143;};'use strict';var utils=require('./utils');var logger=require(_0x4320('0x0'))(_0x4320('0x1'));exports[_0x4320('0x2')]=function(_0x362b7f,_0x3a1376){return function(_0x10ac21){try{logger[_0x4320('0x3')](_0x4320('0x4'),_0x362b7f,utils['getMustacheRender'](_0x3a1376[0x0],this));_0x10ac21[_0x4320('0x5')]();}catch(_0x25cb75){logger[_0x4320('0x6')](_0x4320('0x4'),_0x362b7f,JSON[_0x4320('0x7')](_0x25cb75));_0x10ac21[_0x4320('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 8ac492b..1c53704 100644 --- a/server/services/routing/server/applications/queue.js +++ b/server/services/routing/server/applications/queue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b50=['rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/logger','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','join','stop','find','Queues','createQueue','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x17f12b,_0x2cdef8){var _0x54aec9=function(_0x4a1a66){while(--_0x4a1a66){_0x17f12b['push'](_0x17f12b['shift']());}};_0x54aec9(++_0x2cdef8);}(_0x7b50,0x1df));var _0x07b5=function(_0x52951a,_0x4e0b83){_0x52951a=_0x52951a-0x0;var _0x151f09=_0x7b50[_0x52951a];return _0x151f09;};'use strict';var schema=require(_0x07b5('0x0'));var _=require('lodash');var util=require(_0x07b5('0x1'));var seqqueue=require(_0x07b5('0x2'));var moment=require(_0x07b5('0x3'));var Redis=require(_0x07b5('0x4'));var config=require('../../../../config/environment');var logger=require(_0x07b5('0x5'))('routing');var strategy=require(_0x07b5('0x6'));config['redis']=_[_0x07b5('0x7')](config[_0x07b5('0x8')],{'host':_0x07b5('0x9'),'port':0x18eb});var io=require(_0x07b5('0xa'))(new Redis(config['redis']));var attributes=['id',_0x07b5('0xb'),_0x07b5('0xc'),_0x07b5('0xd'),_0x07b5('0xe'),_0x07b5('0xf')];function emit(_0x362621,_0x41134c,_0xd789a2){io['to'](_0x362621)[_0x07b5('0x10')](_0x41134c,_0xd789a2);}function emitChannelQueueInteraction(_0x5385fe,_0x1d8db7,_0x34509b,_0x318e52,_0x25092f,_0x24e4a7,_0x5b66bf,_0x59ce3f){var _0x56e9df=_[_0x07b5('0x11')](_0x34509b);_0x56e9df[_0x07b5('0xb')]=_0x59ce3f;_0x56e9df[_0x07b5('0xd')]=_0x1d8db7;_0x56e9df[_0x07b5('0xc')]=_0x318e52;_0x56e9df['id']=_0x25092f;if(_0x24e4a7){_0x5b66bf[util[_0x07b5('0x12')]('%sQueuesWaitingInteractions',_0x5385fe)][_0x25092f]=_[_0x07b5('0x13')](_0x56e9df,attributes);}else{delete _0x5b66bf[util[_0x07b5('0x12')](_0x07b5('0x14'),_0x5385fe)][_0x25092f];}emit(util[_0x07b5('0x12')]('%s:queue:%s',_0x5385fe,_0x1d8db7),util[_0x07b5('0x12')](_0x07b5('0x15'),_0x5385fe,_0x24e4a7?'save':_0x07b5('0x16')),_[_0x07b5('0x13')](_0x56e9df,attributes));}var rpc={'openchannelQueueReport':require(_0x07b5('0x17')),'mailQueueReport':require(_0x07b5('0x18')),'chatQueueReport':require(_0x07b5('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x07b5('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x07b5('0x1b'),'required':!![],'message':_0x07b5('0x1c')},'timeout':{'type':_0x07b5('0x1d'),'message':_0x07b5('0x1e')}});function startRouting(_0x291592,_0x4db60d,_0x146970,_0xdd5df8){if(_0x291592&&_0x4db60d&&_0x146970){_0x4db60d['waiting']+=0x1;var _0x1472c1={'uniqueid':_0x291592,'from':_0x146970[_0x07b5('0x1f')]?_0x146970[_0x07b5('0x1f')][_0x07b5('0xe')]:'','joinAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'ContactId':_0x146970[_0x07b5('0x21')]?_0x146970[_0x07b5('0x21')]['id']:null,'ListId':_0x146970[_0x07b5('0x22')]?_0x146970[_0x07b5('0x22')]['id']:null};_0x1472c1[_[_0x07b5('0x23')](_0x146970[_0x07b5('0x24')])+'QueueId']=_0x4db60d['id']||null;_0x1472c1[_['upperFirst'](_0x146970[_0x07b5('0x24')])+'InteractionId']=_0x146970[_0x07b5('0x25')]?_0x146970[_0x07b5('0x25')]['id']:null;_0x1472c1[_[_0x07b5('0x23')](_0x146970['channel'])+_0x07b5('0x26')]=_0x146970[_0x07b5('0x27')]?_0x146970[_0x07b5('0x27')]['id']:null;_0x1472c1[_[_0x07b5('0x23')](_0x146970['channel'])+(_0x146970[_0x07b5('0x24')]!==_0x07b5('0x28')?'AccountId':'WebsiteId')]=_0x146970['account']?_0x146970[_0x07b5('0xc')]['id']:null;logger[_0x07b5('0x29')](util['format'](_0x07b5('0x2a'),_0x291592,_0x4db60d['name']));emitChannelQueueInteraction(_0x146970[_0x07b5('0x24')],_0x4db60d['name'],_0x1472c1,_0x146970[_0x07b5('0xc')][_0x07b5('0x2b')],_0x146970[_0x07b5('0x27')]['id'],!![],_0xdd5df8,_0x4db60d['id']);if(rpc[_0x146970['channel']+_0x07b5('0x2c')]){return rpc[_0x146970['channel']+_0x07b5('0x2c')][_0x07b5('0x2d')](_0x1472c1)[_0x07b5('0x2e')](function(_0x378b85){logger[_0x07b5('0x2f')](_0x07b5('0x30'));});}}}function stopRouting(_0x4a1b7d,_0x3e7053,_0x2e6272,_0x9e3b03){if(_0x4a1b7d&&_0x3e7053){_0x3e7053[_0x07b5('0x31')]-=0x1;var _0x283560={'leaveAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'acceptAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'reason':_0x07b5('0x32')};logger[_0x07b5('0x29')](util[_0x07b5('0x12')](_0x07b5('0x33'),_0x4a1b7d,_0x3e7053['name']));emitChannelQueueInteraction(_0x2e6272[_0x07b5('0x24')],_0x3e7053[_0x07b5('0x2b')],_0x2e6272[_0x07b5('0x1f')],_0x2e6272[_0x07b5('0xc')][_0x07b5('0x2b')],_0x2e6272[_0x07b5('0x27')]['id'],![],_0x9e3b03,_0x3e7053['id']);if(rpc[_0x2e6272[_0x07b5('0x24')]+'QueueReport']){return rpc[_0x2e6272['channel']+_0x07b5('0x2c')][_0x07b5('0x34')](_0x4a1b7d,_0x283560)[_0x07b5('0x2e')](function(_0x2d7e58){logger['error'](_0x07b5('0x35'));});}}}function endRouting(_0x8b03ef,_0x784afd,_0x42f71a,_0x357fe6){if(_0x8b03ef&&_0x784afd){_0x784afd['waiting']-=0x1;var _0x3006ad={'leaveAt':moment()[_0x07b5('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x07b5('0x12')](_0x07b5('0x20')),'reason':_0x07b5('0x36')};logger[_0x07b5('0x29')](util['format'](_0x07b5('0x37'),_0x8b03ef,_0x784afd[_0x07b5('0x2b')]));emitChannelQueueInteraction(_0x42f71a[_0x07b5('0x24')],_0x784afd[_0x07b5('0x2b')],_0x42f71a[_0x07b5('0x1f')],_0x42f71a[_0x07b5('0xc')][_0x07b5('0x2b')],_0x42f71a[_0x07b5('0x27')]['id'],![],_0x357fe6);if(rpc[_0x42f71a[_0x07b5('0x24')]+'QueueReport']){return rpc[_0x42f71a[_0x07b5('0x24')]+'QueueReport'][_0x07b5('0x34')](_0x8b03ef,_0x3006ad)[_0x07b5('0x2e')](function(_0x511e80){logger[_0x07b5('0x2f')](_0x07b5('0x35'));});}}}function handleFindQueue(_0x39d18e){return function(_0x5d1cf2){return _0x5d1cf2[_0x07b5('0x2b')][_0x07b5('0x38')]()===_0x39d18e[_0x07b5('0x38')]();};}exports[_0x07b5('0x39')]=function(_0x24da56,_0x163cb9,_0x1c1186,_0x47e8aa){return function(_0x58f9cd){try{var _0x4815e1={'name':_0x163cb9[0x0],'timeout':_0x163cb9[0x1]};var _0x4eabc2=queue['validate'](_0x4815e1,{'typecast':!![]});if(_0x4eabc2[_0x07b5('0x3a')]){logger[_0x07b5('0x2f')]('[%s][QUEUE]\x20%s',_0x24da56,_['map'](_0x4eabc2,_0x07b5('0x27'))[_0x07b5('0x3b')](',\x20'));_0x58f9cd[_0x07b5('0x3c')]();}else{var _0x40b1b6=_[_0x07b5('0x3d')](_0x1c1186[_0x47e8aa[_0x07b5('0x24')]+_0x07b5('0x3e')],handleFindQueue(_0x4815e1[_0x07b5('0x2b')]));if(_0x40b1b6){startRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);var _0x504e37=(_0x40b1b6[_0x07b5('0x36')]||0xa)*0x3e8;var _0x14dd90=(_0x4815e1[_0x07b5('0x36')]||0x14)*0x3e8;var _0xedc0bd,_0x1b06bf;if(_0x504e37>_0x14dd90){_0x14dd90=_0x504e37;}var _0x4a9e58=seqqueue[_0x07b5('0x3f')](_0x504e37);_0x4a9e58['id']=_0x24da56;_0x4a9e58[_0x07b5('0x40')]=_0x504e37;_0x4a9e58['qtimeout']=_0x14dd90;_0x4a9e58[_0x07b5('0x24')]=_0x47e8aa['channel'];_0x1c1186['rules'][_0x24da56]['on'](_0x07b5('0x41'),function(){logger[_0x07b5('0x29')](_0x07b5('0x42'),_0x24da56);stopRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);clearTimeout(_0xedc0bd);_0xedc0bd=undefined;_0x4a9e58['close'](!![]);if(_0x1c1186['rules'][_0x24da56]){delete _0x1c1186[_0x07b5('0x43')][_0x24da56];}_0x58f9cd[_0x07b5('0x3c')]();});_0x1c1186[_0x07b5('0x43')][_0x24da56]['on']('complete',function(){if(_0x1c1186[_0x07b5('0x43')][_0x24da56]){delete _0x1c1186[_0x07b5('0x43')][_0x24da56];}});_0xedc0bd=setTimeout(function(){logger[_0x07b5('0x29')](_0x07b5('0x44'),_0x24da56);endRouting(_0x24da56,_0x40b1b6,_0x47e8aa,_0x1c1186);clearTimeout(_0xedc0bd);_0x4a9e58[_0x07b5('0x45')](!![]);_0x58f9cd[_0x07b5('0x46')]();},_0x14dd90);switch(_0x40b1b6[_0x07b5('0x47')]){case'rrmemory':strategy[_0x07b5('0x48')](_0x4a9e58,_0x40b1b6,_0x1c1186,_0x47e8aa);break;default:strategy[_0x07b5('0x49')](_0x4a9e58,_0x40b1b6,_0x1c1186,_0x47e8aa);}}else{logger[_0x07b5('0x2f')](_0x07b5('0x4a'),_0x24da56,_0x4815e1[_0x07b5('0x2b')]);_0x58f9cd['stop']();}}}catch(_0x3f0b17){console[_0x07b5('0x4b')](_0x3f0b17);logger['error'](_0x07b5('0x4c'),_0x24da56,_0x3f0b17[_0x07b5('0x4d')]);_0x58f9cd['stop']();}};}; \ No newline at end of file +var _0xdb2b=['WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','error','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','atimeout','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId'];(function(_0x1d334c,_0x53ac6c){var _0x2a3fa7=function(_0x1cb173){while(--_0x1cb173){_0x1d334c['push'](_0x1d334c['shift']());}};_0x2a3fa7(++_0x53ac6c);}(_0xdb2b,0x70));var _0xbdb2=function(_0x578a80,_0x412698){_0x578a80=_0x578a80-0x0;var _0x4b4ba8=_0xdb2b[_0x578a80];return _0x4b4ba8;};'use strict';var schema=require(_0xbdb2('0x0'));var _=require(_0xbdb2('0x1'));var util=require(_0xbdb2('0x2'));var seqqueue=require(_0xbdb2('0x3'));var moment=require(_0xbdb2('0x4'));var Redis=require(_0xbdb2('0x5'));var config=require(_0xbdb2('0x6'));var logger=require(_0xbdb2('0x7'))(_0xbdb2('0x8'));var strategy=require(_0xbdb2('0x9'));config[_0xbdb2('0xa')]=_[_0xbdb2('0xb')](config['redis'],{'host':_0xbdb2('0xc'),'port':0x18eb});var io=require(_0xbdb2('0xd'))(new Redis(config[_0xbdb2('0xa')]));var attributes=['id',_0xbdb2('0xe'),_0xbdb2('0xf'),_0xbdb2('0x10'),_0xbdb2('0x11'),_0xbdb2('0x12')];function emit(_0x5e7c8a,_0x4fa70e,_0x53aa93){io['to'](_0x5e7c8a)['emit'](_0x4fa70e,_0x53aa93);}function emitChannelQueueInteraction(_0x57be92,_0x19d3be,_0x120364,_0x1700ac,_0x467b15,_0x564c6a,_0x3cce57,_0x431032){var _0x45cc90=_[_0xbdb2('0x13')](_0x120364);_0x45cc90[_0xbdb2('0xe')]=_0x431032;_0x45cc90[_0xbdb2('0x10')]=_0x19d3be;_0x45cc90[_0xbdb2('0xf')]=_0x1700ac;_0x45cc90['id']=_0x467b15;if(_0x564c6a){_0x3cce57[util[_0xbdb2('0x14')]('%sQueuesWaitingInteractions',_0x57be92)][_0x467b15]=_[_0xbdb2('0x15')](_0x45cc90,attributes);}else{delete _0x3cce57[util[_0xbdb2('0x14')](_0xbdb2('0x16'),_0x57be92)][_0x467b15];}emit(util[_0xbdb2('0x14')](_0xbdb2('0x17'),_0x57be92,_0x19d3be),util[_0xbdb2('0x14')](_0xbdb2('0x18'),_0x57be92,_0x564c6a?_0xbdb2('0x19'):_0xbdb2('0x1a')),_[_0xbdb2('0x15')](_0x45cc90,attributes));}var rpc={'openchannelQueueReport':require(_0xbdb2('0x1b')),'mailQueueReport':require(_0xbdb2('0x1c')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xbdb2('0x1d')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbdb2('0x1e'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xbdb2('0x1f')},'timeout':{'type':_0xbdb2('0x20'),'message':_0xbdb2('0x21')}});function startRouting(_0x1ba0d1,_0x5e2750,_0x5eb3e4,_0x72db08){if(_0x1ba0d1&&_0x5e2750&&_0x5eb3e4){_0x5e2750[_0xbdb2('0x22')]+=0x1;var _0x317313={'uniqueid':_0x1ba0d1,'from':_0x5eb3e4[_0xbdb2('0x23')]?_0x5eb3e4[_0xbdb2('0x23')][_0xbdb2('0x11')]:'','joinAt':moment()[_0xbdb2('0x14')](_0xbdb2('0x24')),'ContactId':_0x5eb3e4[_0xbdb2('0x25')]?_0x5eb3e4[_0xbdb2('0x25')]['id']:null,'ListId':_0x5eb3e4[_0xbdb2('0x26')]?_0x5eb3e4['list']['id']:null};_0x317313[_[_0xbdb2('0x27')](_0x5eb3e4[_0xbdb2('0x28')])+_0xbdb2('0x29')]=_0x5e2750['id']||null;_0x317313[_[_0xbdb2('0x27')](_0x5eb3e4[_0xbdb2('0x28')])+'InteractionId']=_0x5eb3e4['interaction']?_0x5eb3e4[_0xbdb2('0x2a')]['id']:null;_0x317313[_[_0xbdb2('0x27')](_0x5eb3e4[_0xbdb2('0x28')])+'MessageId']=_0x5eb3e4[_0xbdb2('0x2b')]?_0x5eb3e4['message']['id']:null;_0x317313[_[_0xbdb2('0x27')](_0x5eb3e4['channel'])+(_0x5eb3e4[_0xbdb2('0x28')]!==_0xbdb2('0x2c')?_0xbdb2('0x2d'):_0xbdb2('0x2e'))]=_0x5eb3e4['account']?_0x5eb3e4['account']['id']:null;logger['info'](util['format'](_0xbdb2('0x2f'),_0x1ba0d1,_0x5e2750[_0xbdb2('0x30')]));emitChannelQueueInteraction(_0x5eb3e4[_0xbdb2('0x28')],_0x5e2750[_0xbdb2('0x30')],_0x317313,_0x5eb3e4[_0xbdb2('0xf')][_0xbdb2('0x30')],_0x5eb3e4[_0xbdb2('0x2b')]['id'],!![],_0x72db08,_0x5e2750['id']);if(rpc[_0x5eb3e4['channel']+_0xbdb2('0x31')]){return rpc[_0x5eb3e4[_0xbdb2('0x28')]+_0xbdb2('0x31')][_0xbdb2('0x32')](_0x317313)[_0xbdb2('0x33')](function(_0x4df568){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x5a1603,_0x43787d,_0x12f2b9,_0x138bdd){if(_0x5a1603&&_0x43787d){_0x43787d[_0xbdb2('0x22')]-=0x1;var _0xc08c8e={'leaveAt':moment()['format'](_0xbdb2('0x24')),'acceptAt':moment()[_0xbdb2('0x14')](_0xbdb2('0x24')),'reason':_0xbdb2('0x34')};logger[_0xbdb2('0x35')](util['format'](_0xbdb2('0x36'),_0x5a1603,_0x43787d[_0xbdb2('0x30')]));emitChannelQueueInteraction(_0x12f2b9[_0xbdb2('0x28')],_0x43787d['name'],_0x12f2b9['body'],_0x12f2b9['account']['name'],_0x12f2b9[_0xbdb2('0x2b')]['id'],![],_0x138bdd,_0x43787d['id']);if(rpc[_0x12f2b9[_0xbdb2('0x28')]+_0xbdb2('0x31')]){return rpc[_0x12f2b9[_0xbdb2('0x28')]+_0xbdb2('0x31')][_0xbdb2('0x37')](_0x5a1603,_0xc08c8e)[_0xbdb2('0x33')](function(_0x599a75){logger[_0xbdb2('0x38')]('update\x20queue\x20report');});}}}function endRouting(_0x96e1f,_0x12e411,_0x4e95dd,_0x57f8b4){if(_0x96e1f&&_0x12e411){_0x12e411['waiting']-=0x1;var _0x36a24a={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xbdb2('0x14')](_0xbdb2('0x24')),'reason':'timeout'};logger[_0xbdb2('0x35')](util[_0xbdb2('0x14')](_0xbdb2('0x39'),_0x96e1f,_0x12e411['name']));emitChannelQueueInteraction(_0x4e95dd[_0xbdb2('0x28')],_0x12e411[_0xbdb2('0x30')],_0x4e95dd[_0xbdb2('0x23')],_0x4e95dd[_0xbdb2('0xf')]['name'],_0x4e95dd[_0xbdb2('0x2b')]['id'],![],_0x57f8b4);if(rpc[_0x4e95dd[_0xbdb2('0x28')]+'QueueReport']){return rpc[_0x4e95dd[_0xbdb2('0x28')]+_0xbdb2('0x31')][_0xbdb2('0x37')](_0x96e1f,_0x36a24a)[_0xbdb2('0x33')](function(_0x48048d){logger[_0xbdb2('0x38')](_0xbdb2('0x3a'));});}}}function handleFindQueue(_0x317bc4){return function(_0x2f992a){return _0x2f992a[_0xbdb2('0x30')]['toLowerCase']()===_0x317bc4[_0xbdb2('0x3b')]();};}exports[_0xbdb2('0x3c')]=function(_0xa75dfb,_0x44921d,_0x560382,_0x23204f){return function(_0x143cf5){try{var _0x29a849={'name':_0x44921d[0x0],'timeout':_0x44921d[0x1]};var _0x470375=queue['validate'](_0x29a849,{'typecast':!![]});if(_0x470375[_0xbdb2('0x3d')]){logger[_0xbdb2('0x38')](_0xbdb2('0x3e'),_0xa75dfb,_[_0xbdb2('0x3f')](_0x470375,'message')[_0xbdb2('0x40')](',\x20'));_0x143cf5['stop']();}else{var _0x19b539=_[_0xbdb2('0x41')](_0x560382[_0x23204f[_0xbdb2('0x28')]+_0xbdb2('0x42')],handleFindQueue(_0x29a849['name']));if(_0x19b539){startRouting(_0xa75dfb,_0x19b539,_0x23204f,_0x560382);var _0xd90406=(_0x19b539['timeout']||0xa)*0x3e8;var _0x21ec74=(_0x29a849['timeout']||0x14)*0x3e8;var _0x3b239c,_0x4992e3;if(_0xd90406>_0x21ec74){_0x21ec74=_0xd90406;}var _0x5e55b7=seqqueue[_0xbdb2('0x43')](_0xd90406);_0x5e55b7['id']=_0xa75dfb;_0x5e55b7[_0xbdb2('0x44')]=_0xd90406;_0x5e55b7['qtimeout']=_0x21ec74;_0x5e55b7[_0xbdb2('0x28')]=_0x23204f[_0xbdb2('0x28')];_0x560382[_0xbdb2('0x45')][_0xa75dfb]['on'](_0xbdb2('0x46'),function(){logger[_0xbdb2('0x35')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa75dfb);stopRouting(_0xa75dfb,_0x19b539,_0x23204f,_0x560382);clearTimeout(_0x3b239c);_0x3b239c=undefined;_0x5e55b7[_0xbdb2('0x47')](!![]);if(_0x560382[_0xbdb2('0x45')][_0xa75dfb]){delete _0x560382['rules'][_0xa75dfb];}_0x143cf5[_0xbdb2('0x48')]();});_0x560382['rules'][_0xa75dfb]['on'](_0xbdb2('0x49'),function(){if(_0x560382[_0xbdb2('0x45')][_0xa75dfb]){delete _0x560382[_0xbdb2('0x45')][_0xa75dfb];}});_0x3b239c=setTimeout(function(){logger['info'](_0xbdb2('0x4a'),_0xa75dfb);endRouting(_0xa75dfb,_0x19b539,_0x23204f,_0x560382);clearTimeout(_0x3b239c);_0x5e55b7[_0xbdb2('0x47')](!![]);_0x143cf5['next']();},_0x21ec74);switch(_0x19b539['strategy']){case'rrmemory':strategy[_0xbdb2('0x4b')](_0x5e55b7,_0x19b539,_0x560382,_0x23204f);break;default:strategy[_0xbdb2('0x4c')](_0x5e55b7,_0x19b539,_0x560382,_0x23204f);}}else{logger[_0xbdb2('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa75dfb,_0x29a849[_0xbdb2('0x30')]);_0x143cf5[_0xbdb2('0x48')]();}}}catch(_0x16217b){console[_0xbdb2('0x4d')](_0x16217b);logger[_0xbdb2('0x38')](_0xbdb2('0x3e'),_0xa75dfb,_0x16217b[_0xbdb2('0x4e')]);_0x143cf5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 0cf3437..c1a737e 100644 --- a/server/services/routing/server/applications/strategy/agent.js +++ b/server/services/routing/server/applications/strategy/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4393=['handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','debug','[%s][AGENT]\x20timeout\x20with\x20%s','busy','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleTimeout','bind','timeout','drained'];(function(_0x19bf84,_0x577081){var _0x39a51a=function(_0x4116ff){while(--_0x4116ff){_0x19bf84['push'](_0x19bf84['shift']());}};_0x39a51a(++_0x577081);}(_0x4393,0x133));var _0x3439=function(_0x4d4f00,_0x26cd13){_0x4d4f00=_0x4d4f00-0x0;var _0x170bd5=_0x4393[_0x4d4f00];return _0x170bd5;};'use strict';var _=require(_0x3439('0x0'));var uuid=require(_0x3439('0x1'));var util=require('./util');var logger=require(_0x3439('0x2'))(_0x3439('0x3'));var Agent=function(_0x4afdaa,_0x43338c,_0x51772b,_0x4bac5f){this[_0x3439('0x4')]=uuid['v4']();this[_0x3439('0x5')]=_0x4afdaa;this[_0x3439('0x6')]=_0x43338c;this[_0x3439('0x7')]=_0x51772b;this[_0x3439('0x3')]=_0x4bac5f;this[_0x3439('0x5')][_0x3439('0x8')](this['handleRun']['bind'](this),this[_0x3439('0x9')][_0x3439('0xa')](this));this[_0x3439('0x5')]['on'](_0x3439('0xb'),this[_0x3439('0x9')][_0x3439('0xa')](this));this[_0x3439('0x5')]['on'](_0x3439('0xc'),this[_0x3439('0xd')][_0x3439('0xa')](this));};Agent[_0x3439('0xe')][_0x3439('0x8')]=function(){this[_0x3439('0x5')]['push'](this['handleRun'][_0x3439('0xa')](this),this['handleTimeout'][_0x3439('0xa')](this));};Agent[_0x3439('0xe')][_0x3439('0xd')]=function(){this[_0x3439('0x9')](!![]);};Agent[_0x3439('0xe')][_0x3439('0xf')]=function(){logger['debug'](_0x3439('0x10'),this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);if(_[_0x3439('0x11')](this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']])){logger['debug'](_0x3439('0x13'),this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);setTimeout(this[_0x3439('0x8')][_0x3439('0xa')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0x3439('0x7')]['agents'][this['agent']['id']],this[_0x3439('0x5')]['channel'],![])){this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']]['busy']=!![];this[_0x3439('0x7')]['agents'][this[_0x3439('0x6')]['id']][_0x3439('0x14')]=undefined;util[_0x3439('0x15')](this[_0x3439('0x4')],this['squeue']['id'],this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']],null,this[_0x3439('0x3')]);util[_0x3439('0x16')](this[_0x3439('0x5')]['id'],this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']],_0x3439('0x17')+(this[_0x3439('0x3')][_0x3439('0x18')]?_0x3439('0x19'):''));}else{logger['debug'](_0x3439('0x1a'),this[_0x3439('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0x3439('0xa')](this),0x3e8);}}};Agent[_0x3439('0xe')][_0x3439('0x9')]=function(_0x290243){if(_[_0x3439('0x11')](this['realtime'][_0x3439('0x12')][this[_0x3439('0x6')]['id']])){return logger[_0x3439('0x1b')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x3439('0x5')]['id'],this[_0x3439('0x6')]['id']);}else{logger[_0x3439('0x1b')](_0x3439('0x1c'),this['squeue']['id'],this[_0x3439('0x6')]['id']);util['hideNotification'](this[_0x3439('0x4')],this[_0x3439('0x5')]['id'],this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']],null,this['routing']);this['realtime'][_0x3439('0x12')][this['agent']['id']][_0x3439('0x1d')]=![];this[_0x3439('0x7')][_0x3439('0x12')][this[_0x3439('0x6')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this[_0x3439('0x7')][_0x3439('0x12')][this['agent']['id']],_0x290243?'STOP':_0x3439('0x1e'));}if(!_0x290243){setTimeout(this[_0x3439('0x8')][_0x3439('0xa')](this),0x3e8);}};function agent(_0x2422bf,_0x13b757,_0x27fd2b,_0x3967b3){return new Agent(_0x2422bf,_0x13b757,_0x27fd2b,_0x3967b3);}module[_0x3439('0x1f')]=agent; \ No newline at end of file +var _0xeba4=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','routing','notificationId','agent','realtime','bind','handleTimeout','squeue','timeout','handleDrained','prototype','push','debug','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING'];(function(_0x2fb2a8,_0x37c700){var _0x27107a=function(_0x5ef233){while(--_0x5ef233){_0x2fb2a8['push'](_0x2fb2a8['shift']());}};_0x27107a(++_0x37c700);}(_0xeba4,0xe7));var _0x4eba=function(_0x57dd90,_0x58ddc4){_0x57dd90=_0x57dd90-0x0;var _0x34abca=_0xeba4[_0x57dd90];return _0x34abca;};'use strict';var _=require(_0x4eba('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x4eba('0x1'))(_0x4eba('0x2'));var Agent=function(_0x50287a,_0xc8015a,_0x59d6e2,_0x2a901d){this[_0x4eba('0x3')]=uuid['v4']();this['squeue']=_0x50287a;this[_0x4eba('0x4')]=_0xc8015a;this[_0x4eba('0x5')]=_0x59d6e2;this[_0x4eba('0x2')]=_0x2a901d;this['squeue']['push'](this['handleRun'][_0x4eba('0x6')](this),this[_0x4eba('0x7')][_0x4eba('0x6')](this));this[_0x4eba('0x8')]['on'](_0x4eba('0x9'),this[_0x4eba('0x7')][_0x4eba('0x6')](this));this['squeue']['on']('drained',this[_0x4eba('0xa')]['bind'](this));};Agent[_0x4eba('0xb')][_0x4eba('0xc')]=function(){this[_0x4eba('0x8')][_0x4eba('0xc')](this['handleRun'][_0x4eba('0x6')](this),this[_0x4eba('0x7')][_0x4eba('0x6')](this));};Agent[_0x4eba('0xb')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x4eba('0xb')]['handleRun']=function(){logger[_0x4eba('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x4eba('0x8')]['id'],this['agent']['id']);if(_[_0x4eba('0xe')](this[_0x4eba('0x5')][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']])){logger[_0x4eba('0xd')](_0x4eba('0x10'),this[_0x4eba('0x8')]['id'],this[_0x4eba('0x4')]['id']);setTimeout(this[_0x4eba('0xc')][_0x4eba('0x6')](this),0x3e8);}else{if(this['routing'][_0x4eba('0x11')]||util[_0x4eba('0x12')](this[_0x4eba('0x8')]['id'],this['realtime'][_0x4eba('0xf')][this['agent']['id']],this['squeue'][_0x4eba('0x13')],![])){this['realtime'][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']][_0x4eba('0x14')]=!![];this[_0x4eba('0x5')]['agents'][this[_0x4eba('0x4')]['id']][_0x4eba('0x15')]=undefined;util[_0x4eba('0x16')](this[_0x4eba('0x3')],this[_0x4eba('0x8')]['id'],this[_0x4eba('0x5')]['agents'][this[_0x4eba('0x4')]['id']],null,this[_0x4eba('0x2')]);util[_0x4eba('0x17')](this[_0x4eba('0x8')]['id'],this['realtime'][_0x4eba('0xf')][this['agent']['id']],_0x4eba('0x18')+(this['routing']['forcedOwnership']?_0x4eba('0x19'):''));}else{logger[_0x4eba('0xd')](_0x4eba('0x1a'),this['squeue']['id'],this[_0x4eba('0x4')]['id']);setTimeout(this[_0x4eba('0xc')][_0x4eba('0x6')](this),0x3e8);}}};Agent[_0x4eba('0xb')]['handleTimeout']=function(_0x57684b){if(_[_0x4eba('0xe')](this[_0x4eba('0x5')]['agents'][this[_0x4eba('0x4')]['id']])){return logger[_0x4eba('0xd')](_0x4eba('0x10'),this[_0x4eba('0x8')]['id'],this[_0x4eba('0x4')]['id']);}else{logger['debug'](_0x4eba('0x1b'),this[_0x4eba('0x8')]['id'],this[_0x4eba('0x4')]['id']);util[_0x4eba('0x1c')](this[_0x4eba('0x3')],this[_0x4eba('0x8')]['id'],this[_0x4eba('0x5')][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']],null,this[_0x4eba('0x2')]);this[_0x4eba('0x5')][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']][_0x4eba('0x14')]=![];this[_0x4eba('0x5')][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']]['busyQueue']=undefined;util[_0x4eba('0x17')](this['squeue']['id'],this['realtime'][_0x4eba('0xf')][this[_0x4eba('0x4')]['id']],_0x57684b?_0x4eba('0x1d'):_0x4eba('0x1e'));}if(!_0x57684b){setTimeout(this[_0x4eba('0xc')][_0x4eba('0x6')](this),0x3e8);}};function agent(_0x5258aa,_0xf1e80b,_0x592c7c,_0x146f68){return new Agent(_0x5258aa,_0xf1e80b,_0x592c7c,_0x146f68);}module[_0x4eba('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 4dcf862..904c428 100644 --- a/server/services/routing/server/applications/strategy/beepall.js +++ b/server/services/routing/server/applications/strategy/beepall.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3360=['handleTimeout','timeout','drained','prototype','handleDrained','isNil','Agents','length','agents','debug','writeLog','busy','busyQueue','showNotification','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','lodash','uuid','notificationId','squeue','queue','realtime','push','handleRun','bind'];(function(_0x34f0fa,_0x51923e){var _0x2b15aa=function(_0x23705c){while(--_0x23705c){_0x34f0fa['push'](_0x34f0fa['shift']());}};_0x2b15aa(++_0x51923e);}(_0x3360,0x1d7));var _0x0336=function(_0x25dcd4,_0x32f345){_0x25dcd4=_0x25dcd4-0x0;var _0x116ce7=_0x3360[_0x25dcd4];return _0x116ce7;};'use strict';var _=require(_0x0336('0x0'));var uuid=require(_0x0336('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x12fd21,_0x56bf8b,_0x55df8b,_0x472555){this[_0x0336('0x2')]=uuid['v4']();this[_0x0336('0x3')]=_0x12fd21;this[_0x0336('0x4')]=_0x56bf8b;this[_0x0336('0x5')]=_0x55df8b;this['routing']=_0x472555;this['squeue'][_0x0336('0x6')](this[_0x0336('0x7')][_0x0336('0x8')](this),this[_0x0336('0x9')][_0x0336('0x8')](this));this['squeue']['on'](_0x0336('0xa'),this[_0x0336('0x9')][_0x0336('0x8')](this));this['squeue']['on'](_0x0336('0xb'),this['handleDrained'][_0x0336('0x8')](this));};Beepall[_0x0336('0xc')][_0x0336('0x6')]=function(){this[_0x0336('0x3')][_0x0336('0x6')](this['handleRun'][_0x0336('0x8')](this),this[_0x0336('0x9')][_0x0336('0x8')](this));};Beepall[_0x0336('0xc')][_0x0336('0xd')]=function(){this['handleTimeout'](!![]);};Beepall[_0x0336('0xc')][_0x0336('0x7')]=function(){var _0x260584=!![];if(!_[_0x0336('0xe')](this['queue'])&&!_[_0x0336('0xe')](this['queue'][_0x0336('0xf')])&&this[_0x0336('0x4')]['Agents']['length']>0x0){for(var _0x528d99=0x0,_0x10a8f1;_0x528d990x0){for(var _0x3c71ae=0x0,_0x75a896;_0x3c71ae0x0&&_0x5b85cc[_0x585243+_0x72d1('0x21')]>=_0x5b85cc[_0x585243+_0x72d1('0x22')]){writeLog(_0x506062,_0x5b85cc,_0x585243[_0x72d1('0x23')]()+_0x72d1('0x24'));return![];}}return!![];};exports[_0x72d1('0x25')]=function(_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85){return sendNotification(!![],_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85);};exports[_0x72d1('0x26')]=function(_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0){return sendNotification(![],_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0);};exports[_0x72d1('0x27')]=writeLog; \ No newline at end of file +var _0x7dfd=['lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','save','remove','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var utils=require(_0xd7df('0x2'));var Redis=require(_0xd7df('0x3'));var config=require(_0xd7df('0x4'));var logger=require(_0xd7df('0x5'))(_0xd7df('0x6'));config[_0xd7df('0x7')]=_[_0xd7df('0x8')](config[_0xd7df('0x7')],{'host':_0xd7df('0x9'),'port':0x18eb});var io=require(_0xd7df('0xa'))(new Redis(config[_0xd7df('0x7')]));function sendNotification(_0x39ce98,_0x354ea7,_0x16e50,_0x2c48a4,_0x5c220a,_0xab6742){io['to'](util[_0xd7df('0xb')](_0xd7df('0xc'),_0x2c48a4[_0xd7df('0xd')]))['emit'](_0xd7df('0xe'),_0x2c48a4);var _0x532c14=_0xab6742||{};var _0x183ace=_0x16e50['split']('.');var _0x394d32={'uniqueid':_0x354ea7,'channel':_0x183ace[0x0],'id':_0x183ace[0x1],'title':_0x183ace[0x0]+_0xd7df('0xf'),'interactionId':_0x183ace[0x2],'queue':_0x5c220a?_0x5c220a[_0xd7df('0xd')]:null,'sound':_0x532c14[_0xd7df('0x10')][_0xd7df('0x11')],'shake':_0x532c14[_0xd7df('0x10')][_0xd7df('0x12')]};try{if(!_0x532c14[_0xd7df('0x13')]){_0x532c14[_0xd7df('0x13')]={};}if(_0x5c220a){_0x532c14[_0xd7df('0x13')][_0xd7df('0x14')]=_0x5c220a;}else if(_0x532c14[_0xd7df('0x13')][_0xd7df('0x14')]){delete _0x532c14[_0xd7df('0x13')][_0xd7df('0x14')];}_0x394d32[_0xd7df('0x15')]=utils[_0xd7df('0x16')](_0x532c14['account'][_0xd7df('0x17')],_0x532c14);}catch(_0x23cdbc){_0x394d32['msg']=_0xd7df('0x18');logger[_0xd7df('0x19')](util['format'](_0xd7df('0x1a'),_0x354ea7,_0x23cdbc[_0xd7df('0x1b')]));}io['to'](util[_0xd7df('0xb')]('user:%s',_0x2c48a4[_0xd7df('0xd')]))[_0xd7df('0x1c')](util[_0xd7df('0xb')]('notification:%s',_0x39ce98?_0xd7df('0x1d'):_0xd7df('0x1e')),_0x394d32);}function writeLog(_0x4e1985,_0x5acb0a,_0x4188af){return logger['debug'](util[_0xd7df('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4e1985,_0x5acb0a[_0xd7df('0xd')],_0x4188af));}exports[_0xd7df('0x1f')]=function(_0x4eabb8,_0x5e59c3,_0xc50077,_0x502ae8){if(_0x5e59c3[_0xd7df('0x20')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x21'));return![];}if(!_0x5e59c3[_0xd7df('0x22')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x23'));return![];}if(_0x5e59c3[_0xc50077+_0xd7df('0x24')]){writeLog(_0x4eabb8,_0x5e59c3,_0xd7df('0x25'));return![];}if(_0x502ae8&&_0x5e59c3[_0xd7df('0x26')](_0xc50077+'Capacity')&&_0x5e59c3['hasOwnProperty'](_0xc50077+_0xd7df('0x27'))){if(_0x5e59c3[_0xc50077+_0xd7df('0x28')]>0x0&&_0x5e59c3[_0xc50077+_0xd7df('0x27')]>=_0x5e59c3[_0xc50077+_0xd7df('0x28')]){writeLog(_0x4eabb8,_0x5e59c3,_0xc50077[_0xd7df('0x29')]()+_0xd7df('0x2a'));return![];}}return!![];};exports[_0xd7df('0x2b')]=function(_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1){return sendNotification(!![],_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1);};exports[_0xd7df('0x2c')]=function(_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76){return sendNotification(![],_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 6d5b805..dd99406 100644 --- a/server/services/routing/server/applications/system.js +++ b/server/services/routing/server/applications/system.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5b5=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][SYSTEM]\x20%s','map','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x4ada86,_0x1f6515){var _0x118399=function(_0x21b040){while(--_0x21b040){_0x4ada86['push'](_0x4ada86['shift']());}};_0x118399(++_0x1f6515);}(_0xc5b5,0x1b2));var _0x5c5b=function(_0x48a928,_0x430727){_0x48a928=_0x48a928-0x0;var _0x11c1e9=_0xc5b5[_0x48a928];return _0x11c1e9;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x5c5b('0x0'));var utils=require(_0x5c5b('0x1'));var logger=require('../../../../config/logger')(_0x5c5b('0x2'));var system=schema({'command':{'type':_0x5c5b('0x3'),'required':!![],'message':_0x5c5b('0x4')}});exports[_0x5c5b('0x5')]=function(_0x5365a3,_0x80df0d){return function(_0x36f240){try{var _0x27509d={'command':_0x80df0d[0x0]};var _0x6cb181=system[_0x5c5b('0x6')](_0x27509d,{'typecast':!![]});if(_0x6cb181[_0x5c5b('0x7')]){logger['error'](_0x5c5b('0x8'),_0x5365a3,_[_0x5c5b('0x9')](_0x6cb181,'message')[_0x5c5b('0xa')](',\x20'));logger['info'](_0x5c5b('0xb'),_0x5365a3);_0x36f240[_0x5c5b('0xc')]();}else{var _0x178913=this;var _0x484f47=utils['getMustacheRender'](_0x80df0d[0x0],this);logger[_0x5c5b('0xd')](_0x5c5b('0xe'),_0x5365a3,_0x484f47);sh[_0x5c5b('0xf')](_['trim'](_0x484f47),function(_0x4c6724,_0x565650){logger[_0x5c5b('0xd')](_0x5c5b('0x10'),_0x5365a3,_0x4c6724);if(_0x4c6724==0x0){var _0xae277f=_0x565650[_0x5c5b('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x5c5b('0x12')](_0x80df0d[0x1])||_['isEmpty'](_0x80df0d[0x1])){logger[_0x5c5b('0xd')](_0x5c5b('0x13'),_0x5365a3);_0x178913[_0x5c5b('0x14')][_0x80df0d[0x1]]=_0xae277f;}else{logger[_0x5c5b('0xd')](_0x5c5b('0x15'),_0x5365a3,_0x80df0d[0x1],_0xae277f);_0x178913[_0x5c5b('0x14')][_0x80df0d[0x1]]=_0xae277f;}}_0x36f240[_0x5c5b('0xc')]();});}}catch(_0x101880){logger[_0x5c5b('0x16')]('[%s][SYSTEM]\x20%s',_0x5365a3,_[_0x5c5b('0x17')](_0x101880)?JSON[_0x5c5b('0x18')](_0x101880):_0x101880);logger[_0x5c5b('0xd')](_0x5c5b('0xb'),_0x5365a3);_0x36f240[_0x5c5b('0xc')]();}};}; \ No newline at end of file +var _0x6523=['isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6523,0x1a6));var _0x3652=function(_0x1f8b97,_0x1e98f5){_0x1f8b97=_0x1f8b97-0x0;var _0x1e77d2=_0x6523[_0x1f8b97];return _0x1e77d2;};'use strict';var schema=require(_0x3652('0x0'));var sh=require(_0x3652('0x1'));var _=require('lodash');var utils=require(_0x3652('0x2'));var logger=require(_0x3652('0x3'))(_0x3652('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x3652('0x5')}});exports[_0x3652('0x6')]=function(_0x137300,_0x36a893){return function(_0x54d47a){try{var _0x204f81={'command':_0x36a893[0x0]};var _0x18f1c3=system[_0x3652('0x0')](_0x204f81,{'typecast':!![]});if(_0x18f1c3[_0x3652('0x7')]){logger[_0x3652('0x8')](_0x3652('0x9'),_0x137300,_[_0x3652('0xa')](_0x18f1c3,_0x3652('0xb'))[_0x3652('0xc')](',\x20'));logger[_0x3652('0xd')](_0x3652('0xe'),_0x137300);_0x54d47a[_0x3652('0xf')]();}else{var _0x4c0458=this;var _0x3b8e36=utils[_0x3652('0x10')](_0x36a893[0x0],this);logger[_0x3652('0xd')](_0x3652('0x11'),_0x137300,_0x3b8e36);sh[_0x3652('0x12')](_[_0x3652('0x13')](_0x3b8e36),function(_0x5cb080,_0x497049){logger[_0x3652('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x137300,_0x5cb080);if(_0x5cb080==0x0){var _0x191ec5=_0x497049[_0x3652('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x3652('0x15')](_0x36a893[0x1])||_[_0x3652('0x16')](_0x36a893[0x1])){logger[_0x3652('0xd')](_0x3652('0x17'),_0x137300);_0x4c0458[_0x3652('0x18')][_0x36a893[0x1]]=_0x191ec5;}else{logger['info'](_0x3652('0x19'),_0x137300,_0x36a893[0x1],_0x191ec5);_0x4c0458[_0x3652('0x18')][_0x36a893[0x1]]=_0x191ec5;}}_0x54d47a[_0x3652('0xf')]();});}}catch(_0x4313a6){logger['error'](_0x3652('0x9'),_0x137300,_[_0x3652('0x1a')](_0x4313a6)?JSON[_0x3652('0x1b')](_0x4313a6):_0x4313a6);logger[_0x3652('0xd')](_0x3652('0xe'),_0x137300);_0x54d47a['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index de8a38a..9882a0d 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f4f=['Interaction','then','catch','stringify','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','length','error','[%s][TAG]\x20%s','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0xc8636e,_0x5f49d2){var _0x1d7040=function(_0x98cd1f){while(--_0x98cd1f){_0xc8636e['push'](_0xc8636e['shift']());}};_0x1d7040(++_0x5f49d2);}(_0x7f4f,0x1b5));var _0xf7f4=function(_0x1b864a,_0x5ee497){_0x1b864a=_0x1b864a-0x0;var _0x3e8b04=_0x7f4f[_0x1b864a];return _0x3e8b04;};'use strict';var schema=require('validate');var _=require(_0xf7f4('0x0'));var rpc={'chatInteraction':require(_0xf7f4('0x1')),'openchannelInteraction':require(_0xf7f4('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xf7f4('0x3')),'faxInteraction':require(_0xf7f4('0x4')),'whatsappInteraction':require(_0xf7f4('0x5'))};var logger=require(_0xf7f4('0x6'))(_0xf7f4('0x7'));var tag=schema({'tag':{'type':_0xf7f4('0x8'),'required':!![],'message':_0xf7f4('0x9')}});exports['consequence']=function(_0x3804ee,_0x30301f,_0x3bed82,_0x2eebce){return function(_0x25fa81){try{var _0x3fd887={'tag':_0x30301f[0x0]};var _0x3876e2=tag[_0xf7f4('0xa')](_0x3fd887,{'typecast':!![]});if(_0x3876e2[_0xf7f4('0xb')]){logger[_0xf7f4('0xc')](_0xf7f4('0xd'),_0x3804ee,_['map'](_0x3876e2,'message')[_0xf7f4('0xe')](',\x20'));logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);_0x25fa81[_0xf7f4('0x11')]();}else{var _0x34668b={'ids':[_0x30301f[0x0]]};if(rpc[_0x2eebce[_0xf7f4('0x12')]+_0xf7f4('0x13')]){rpc[_0x2eebce[_0xf7f4('0x12')]+'Interaction']['addTags'](_0x2eebce['interaction']['id'],_0x34668b)[_0xf7f4('0x14')](function(_0x24a6ef){logger[_0xf7f4('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3804ee,_0x30301f[0x1],_0x2eebce[_0xf7f4('0x12')],_0x2eebce['interaction']['id']);})[_0xf7f4('0x15')](function(_0x483abc){logger['error']('[%s][TAG]\x20%s',_0x3804ee,JSON[_0xf7f4('0x16')](_0x483abc));logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);})['finally'](function(){_0x25fa81[_0xf7f4('0x11')]();});}}}catch(_0x493ce3){logger[_0xf7f4('0xc')](_0xf7f4('0xd'),_0x3804ee,_[_0xf7f4('0x17')](_0x493ce3)?JSON['stringify'](_0x493ce3):_0x493ce3);logger[_0xf7f4('0xf')](_0xf7f4('0x10'),_0x3804ee);_0x25fa81['next']();}};}; \ No newline at end of file +var _0x461c=['validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','join','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x214927,_0x125c14){var _0x433402=function(_0x3b927d){while(--_0x3b927d){_0x214927['push'](_0x214927['shift']());}};_0x433402(++_0x125c14);}(_0x461c,0x104));var _0xc461=function(_0x586c31,_0x17c312){_0x586c31=_0x586c31-0x0;var _0x5064ef=_0x461c[_0x586c31];return _0x5064ef;};'use strict';var schema=require(_0xc461('0x0'));var _=require(_0xc461('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc461('0x2')),'smsInteraction':require(_0xc461('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xc461('0x4'))};var logger=require(_0xc461('0x5'))(_0xc461('0x6'));var tag=schema({'tag':{'type':_0xc461('0x7'),'required':!![],'message':_0xc461('0x8')}});exports[_0xc461('0x9')]=function(_0x33579d,_0x2f570f,_0x399b75,_0x218361){return function(_0x20df43){try{var _0xa8536c={'tag':_0x2f570f[0x0]};var _0x9e4565=tag[_0xc461('0x0')](_0xa8536c,{'typecast':!![]});if(_0x9e4565[_0xc461('0xa')]){logger[_0xc461('0xb')](_0xc461('0xc'),_0x33579d,_['map'](_0x9e4565,'message')[_0xc461('0xd')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x33579d);_0x20df43[_0xc461('0xe')]();}else{var _0x51c487={'ids':[_0x2f570f[0x0]]};if(rpc[_0x218361['channel']+_0xc461('0xf')]){rpc[_0x218361[_0xc461('0x10')]+_0xc461('0xf')][_0xc461('0x11')](_0x218361[_0xc461('0x12')]['id'],_0x51c487)[_0xc461('0x13')](function(_0x2cb7e6){logger['info'](_0xc461('0x14'),_0x33579d,_0x2f570f[0x1],_0x218361['channel'],_0x218361[_0xc461('0x12')]['id']);})[_0xc461('0x15')](function(_0x4880a4){logger[_0xc461('0xb')](_0xc461('0xc'),_0x33579d,JSON[_0xc461('0x16')](_0x4880a4));logger[_0xc461('0x17')](_0xc461('0x18'),_0x33579d);})[_0xc461('0x19')](function(){_0x20df43[_0xc461('0xe')]();});}}}catch(_0x2b66f2){logger['error']('[%s][TAG]\x20%s',_0x33579d,_['isObject'](_0x2b66f2)?JSON[_0xc461('0x16')](_0x2b66f2):_0x2b66f2);logger[_0xc461('0x17')](_0xc461('0x18'),_0x33579d);_0x20df43['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 6f309f4..ae86c39 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7834=['isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','info','catch','[%s][TVOX]\x20%s'];(function(_0x671a29,_0x505772){var _0x13c512=function(_0x3612d1){while(--_0x3612d1){_0x671a29['push'](_0x671a29['shift']());}};_0x13c512(++_0x505772);}(_0x7834,0x1d3));var _0x4783=function(_0x40a792,_0x146830){_0x40a792=_0x40a792-0x0;var _0x5e53d4=_0x7834[_0x40a792];return _0x5e53d4;};'use strict';var rp=require('request-promise');var logger=require(_0x4783('0x0'))(_0x4783('0x1'));var _=require(_0x4783('0x2'));var arr=[];exports[_0x4783('0x3')]=function(_0x341b6a,_0x20f8e7){return function(_0x171019){var _0x15df86=_0x20f8e7[0xa];var _0x192a98=_0x20f8e7[0xb];var _0x4c898f=_0x20f8e7[0xc];var _0x406f09=_0x20f8e7[0xd];var _0x245690=_0x20f8e7[0xe];var _0xbb2e90=_0x20f8e7[0xf][_0x4783('0x4')](/\n/g,_0x4783('0x5'));var _0x4f19fc=_0x20f8e7[0x10][_0x4783('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x192a98)){arr[_0x4783('0x6')](_0x192a98);var _0x2ef4ee=_0x20f8e7[0x3];var _0x3eaf2b=_0x20f8e7[0x4];var _0x21b7c9=_0x20f8e7[0x1];var _0x2be256=_0x20f8e7[0x0];var _0x2a018f={};_0x2a018f[_0x4783('0x7')]=_0x20f8e7[0x8]+_0x4783('0x8')+_0x4c898f+'|'+_0x15df86+'|'+_0x406f09+'|'+_0x192a98+'|'+_0x245690;_0x2a018f[_0x4783('0x9')]=_0x20f8e7[0x7]+_0x4783('0x8')+_0x4c898f+'|'+_0x15df86+'|'+_0x406f09+'|'+_0x192a98+'|'+_0x245690+'|'+_0xbb2e90+'|'+_0x4f19fc;_0x2a018f['title']=_0x20f8e7[0x9];var _0x495b92={};_0x495b92[_0x4783('0xa')]=_0x4783('0xb');_0x495b92['method']=_0x4783('0xc');var _0x16febd=[];_0x16febd['push'](_0x20f8e7[0x2]);_0x16febd[_0x4783('0x6')](_0x20f8e7[0x5]);_0x16febd[_0x4783('0x6')](_0x20f8e7[0x6]);_0x495b92[_0x4783('0xd')]=_0x16febd;_0x495b92['id']=0x1;var _0x163024=JSON[_0x4783('0xe')](_0x495b92);var _0x317c16={'encoding':'utf8','method':_0x4783('0xf'),'timeout':0x2710,'url':_0x2ef4ee,'headers':{'Content-Type':_0x4783('0x10')},'body':_0x163024};return rp(_0x317c16)[_0x4783('0x11')](function(_0x57680b){const _0x24a3b3=JSON[_0x4783('0x12')](_0x57680b);if(!_0x24a3b3[_0x4783('0x13')][_0x4783('0x14')]){throw new Error(_0x4783('0x15'));}var _0xa161b9=_0x192a98;var _0x2cea29='channelId='+_0x21b7c9+_0x4783('0x16')+_0x2be256+'&sessionId='+_0xa161b9+'&data='+JSON[_0x4783('0xe')](_0x2a018f);var _0x177705=_0x3eaf2b+'?'+_0x2cea29;return rp(_0x177705);})[_0x4783('0x11')](function(_0x1f382e){logger[_0x4783('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x341b6a,_0x1f382e);_0x171019['stop']();})[_0x4783('0x18')](function(_0x23cb3d){logger['error'](_0x4783('0x19'),_0x341b6a,_[_0x4783('0x1a')](_0x23cb3d)?JSON[_0x4783('0xe')](_0x23cb3d):_0x23cb3d);_0x171019[_0x4783('0x1b')]();});}else{logger[_0x4783('0x17')](_0x4783('0x1c'),_0x341b6a);_0x171019['next']();}};}; \ No newline at end of file +var _0xdf67=['consequence','\x20-\x20','replace','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','login','push','stringify','utf8','POST','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','info','stop','catch','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xdf67,0x133));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x7df6('0x0'));var logger=require(_0x7df6('0x1'))('routing');var _=require(_0x7df6('0x2'));var arr=[];exports[_0x7df6('0x3')]=function(_0x1d04ab,_0x2ce49c){return function(_0x9f0280){var _0xc782ae=_0x2ce49c[0xa];var _0x2d9b27=_0x2ce49c[0xb];var _0x3c048f=_0x2ce49c[0xc];var _0x558071=_0x2ce49c[0xd];var _0x22823f=_0x2ce49c[0xe];var _0x245215=_0x2ce49c[0xf]['replace'](/\n/g,_0x7df6('0x4'));var _0x3a5297=_0x2ce49c[0x10][_0x7df6('0x5')](/\n/g,'\x20');if(!arr[_0x7df6('0x6')](_0x2d9b27)){arr['push'](_0x2d9b27);var _0x584e91=_0x2ce49c[0x3];var _0x3cc873=_0x2ce49c[0x4];var _0xe6dd11=_0x2ce49c[0x1];var _0x218eee=_0x2ce49c[0x0];var _0x48b503={};_0x48b503[_0x7df6('0x7')]=_0x2ce49c[0x8]+_0x7df6('0x8')+_0x3c048f+'|'+_0xc782ae+'|'+_0x558071+'|'+_0x2d9b27+'|'+_0x22823f;_0x48b503[_0x7df6('0x9')]=_0x2ce49c[0x7]+_0x7df6('0x8')+_0x3c048f+'|'+_0xc782ae+'|'+_0x558071+'|'+_0x2d9b27+'|'+_0x22823f+'|'+_0x245215+'|'+_0x3a5297;_0x48b503[_0x7df6('0xa')]=_0x2ce49c[0x9];var _0x5b8405={};_0x5b8405[_0x7df6('0xb')]='2.0';_0x5b8405['method']=_0x7df6('0xc');var _0x474782=[];_0x474782[_0x7df6('0xd')](_0x2ce49c[0x2]);_0x474782['push'](_0x2ce49c[0x5]);_0x474782[_0x7df6('0xd')](_0x2ce49c[0x6]);_0x5b8405['params']=_0x474782;_0x5b8405['id']=0x1;var _0x37ee7a=JSON[_0x7df6('0xe')](_0x5b8405);var _0x5f237f={'encoding':_0x7df6('0xf'),'method':_0x7df6('0x10'),'timeout':0x2710,'url':_0x584e91,'headers':{'Content-Type':_0x7df6('0x11')},'body':_0x37ee7a};return rp(_0x5f237f)[_0x7df6('0x12')](function(_0x5bbf7a){const _0x27223c=JSON[_0x7df6('0x13')](_0x5bbf7a);if(!_0x27223c['result'][_0x7df6('0x14')]){throw new Error(_0x7df6('0x15'));}var _0x30e7cd=_0x2d9b27;var _0x276802='channelId='+_0xe6dd11+_0x7df6('0x16')+_0x218eee+_0x7df6('0x17')+_0x30e7cd+'&data='+JSON[_0x7df6('0xe')](_0x48b503);var _0x377409=_0x3cc873+'?'+_0x276802;return rp(_0x377409);})[_0x7df6('0x12')](function(_0x4d0ced){logger[_0x7df6('0x18')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x1d04ab,_0x4d0ced);_0x9f0280[_0x7df6('0x19')]();})[_0x7df6('0x1a')](function(_0x495dec){logger['error'](_0x7df6('0x1b'),_0x1d04ab,_[_0x7df6('0x1c')](_0x495dec)?JSON[_0x7df6('0xe')](_0x495dec):_0x495dec);_0x9f0280[_0x7df6('0x19')]();});}else{logger[_0x7df6('0x18')](_0x7df6('0x1d'),_0x1d04ab);_0x9f0280[_0x7df6('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 0f2bf72..4be35aa 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4b3a87,_0x2f56f6){var _0x4e5ba9=function(_0x12e4ae){while(--_0x12e4ae){_0x4b3a87['push'](_0x4b3a87['shift']());}};_0x4e5ba9(++_0x2f56f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xbaf0=['list','lodash','exports','render','merge','contact','message','account','interaction'];(function(_0x57b182,_0x5b9c77){var _0x40db1a=function(_0x4f78e0){while(--_0x4f78e0){_0x57b182['push'](_0x57b182['shift']());}};_0x40db1a(++_0x5b9c77);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Mustache=require('mustache');var _=require(_0x0baf('0x0'));module[_0x0baf('0x1')]={'getMustacheRender':function(_0x1e212d,_0x263f79){return Mustache[_0x0baf('0x2')](_0x1e212d,_[_0x0baf('0x3')](_0x263f79['body'],{'contact':_0x263f79[_0x0baf('0x4')],'message':_0x263f79[_0x0baf('0x5')],'account':_0x263f79[_0x0baf('0x6')],'interaction':_0x263f79[_0x0baf('0x7')],'list':_0x263f79[_0x0baf('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 94535c4..91b9064 100644 --- a/server/services/routing/server/index.js +++ b/server/services/routing/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9a7=['split','channel','mail','push','slice','join','dialogflowv2','appdata','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','isNil','format','%s:%s:%s','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','busy','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','error','message\x20is\x20empty','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','IntervalId','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','.js','app','autoreply'];(function(_0x4c69c7,_0x2f4850){var _0x20d218=function(_0x113ff0){while(--_0x113ff0){_0x4c69c7['push'](_0x4c69c7['shift']());}};_0x20d218(++_0x2f4850);}(_0xb9a7,0x112));var _0x7b9a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb9a7[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require(_0x7b9a('0x1'));var utils=require('./applications/utils');var config=require(_0x7b9a('0x2'));var logger=require(_0x7b9a('0x3'))(_0x7b9a('0x4'));var rpc={'openchannelQueueReport':require(_0x7b9a('0x5')),'mailQueueReport':require(_0x7b9a('0x6')),'chatQueueReport':require(_0x7b9a('0x7')),'smsQueueReport':require(_0x7b9a('0x8')),'faxQueueReport':require(_0x7b9a('0x9')),'whatsappQueueReport':require(_0x7b9a('0xa'))};var RuleEngine=require(_0x7b9a('0xb'));function getId(_0x4d3f20,_0x43d8e2,_0x3e84f1){return util['format']('%s.%s.%s',_0x4d3f20,_0x43d8e2||0x0,_0x3e84f1||0x0);}function getIntervals(_0x47e220,_0x15bc5b){var _0x31f3b7=[];if(!_['isNil'](_0x15bc5b[_0x7b9a('0xc')])&&!_['isNil'](_0x47e220[_0x15bc5b[_0x7b9a('0xc')]])&&!_['isNil'](_0x47e220[_0x15bc5b[_0x7b9a('0xc')]][_0x7b9a('0xd')])){_0x31f3b7=_[_0x7b9a('0xe')](_0x47e220[_0x15bc5b['IntervalId']][_0x7b9a('0xd')],_0x7b9a('0xf'));}else if(!_['isNil'](_0x15bc5b[_0x7b9a('0xf')])){_0x31f3b7=[_0x15bc5b[_0x7b9a('0xf')]];}return _0x31f3b7;}exports['listen']=function(_0xb157e5){_0xb157e5[_0x7b9a('0x10')]={};return new BPromise(function(_0x6fa16a,_0x2853f2){var _0x344fa7={'Start':function(_0x346daa){var _0x22a7e4=this;return new Promise(function(_0x35e602,_0x2f1899){if(_0x346daa){try{var _0x4996f1=[];var _0x34a82d=getId(_0x346daa['channel'],_0x346daa[_0x7b9a('0x11')]?_0x346daa[_0x7b9a('0x11')]['id']:0x0,_0x346daa[_0x7b9a('0x12')]?_0x346daa[_0x7b9a('0x12')]['id']:0x0);if(_0x346daa[_0x7b9a('0x13')]&&_[_0x7b9a('0x14')](_0x346daa[_0x7b9a('0x13')])&&_0x346daa[_0x7b9a('0x13')][_0x7b9a('0x15')]){for(var _0x588c48=0x0;_0x588c48<_0x346daa[_0x7b9a('0x13')][_0x7b9a('0x15')];_0x588c48+=0x1){var _0x3e65fa=_0x346daa['applications'][_0x588c48];if(fs[_0x7b9a('0x16')](path['join'](__dirname,_0x7b9a('0x13'),_0x3e65fa['app']+_0x7b9a('0x17')))){var _0x331ae6=[];switch(_0x3e65fa[_0x7b9a('0x18')]['toLowerCase']()){case _0x7b9a('0x19'):var _0x7f8972=_0x3e65fa['appdata'][_0x7b9a('0x1a')](',');if(_0x346daa[_0x7b9a('0x1b')]===_0x7b9a('0x1c')){_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x0]);_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x1]);_0x331ae6['push'](_0x7f8972[_0x7b9a('0x1e')](0x2,_0x7f8972[_0x7b9a('0x15')])['join'](','));}else{_0x331ae6[_0x7b9a('0x1d')](_0x7f8972[0x0]);_0x331ae6['push'](_0x7f8972[_0x7b9a('0x1e')](0x1,_0x7f8972[_0x7b9a('0x15')])['join'](','));}break;case'dialogflow':var _0x24d886=_0x3e65fa['appdata']['split'](',');_0x331ae6[_0x7b9a('0x1d')](_0x24d886[0x0]);_0x331ae6['push'](_0x24d886[0x1]);_0x331ae6['push'](_0x24d886[_0x7b9a('0x1e')](0x2,_0x24d886['length'])[_0x7b9a('0x1f')](','));break;case _0x7b9a('0x20'):var _0x4fee38=_0x3e65fa[_0x7b9a('0x21')][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x0]);_0x331ae6['push'](_0x4fee38[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[0x3]);_0x331ae6[_0x7b9a('0x1d')](_0x4fee38[_0x7b9a('0x1e')](0x4,_0x4fee38[_0x7b9a('0x15')])[_0x7b9a('0x1f')](','));break;case'amazonlex':var _0x4aa495=_0x3e65fa[_0x7b9a('0x21')][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x0]);_0x331ae6['push'](_0x4aa495[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x4aa495[0x3]);_0x331ae6['push'](_0x4aa495['slice'](0x4,_0x4aa495[_0x7b9a('0x15')])[_0x7b9a('0x1f')](','));break;case'message':_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x21')]);break;case _0x7b9a('0x22'):_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x23')]);_0x331ae6['push'](_0x3e65fa[_0x7b9a('0x21')]);break;case _0x7b9a('0x24'):var _0x14c227=utils[_0x7b9a('0x25')](_0x346daa[_0x7b9a('0x26')][_0x7b9a('0x27')],_0x346daa);var _0x5f1da4=_0x3e65fa['appdata'][_0x7b9a('0x1a')](',');_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x0]);_0x331ae6['push'](_0x5f1da4[0x1]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x2]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x3]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x4]);_0x331ae6['push'](_0x5f1da4[0x5]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x6]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0x7]);_0x331ae6['push'](_0x5f1da4[0x8]);_0x331ae6['push'](_0x5f1da4[0x9]);_0x331ae6[_0x7b9a('0x1d')](_0x5f1da4[0xa]);_0x331ae6[_0x7b9a('0x1d')](_0x346daa[_0x7b9a('0x12')]['id']);_0x331ae6[_0x7b9a('0x1d')](_0x346daa[_0x7b9a('0x11')]['id']);_0x331ae6[_0x7b9a('0x1d')](_0x3e65fa[_0x7b9a('0x28')]);_0x331ae6[_0x7b9a('0x1d')](_0x346daa['interaction'][_0x7b9a('0x29')]);_0x331ae6['push'](_0x346daa[_0x7b9a('0x2a')][_0x7b9a('0x2a')]);_0x331ae6[_0x7b9a('0x1d')](_0x14c227);break;default:_0x331ae6=_[_0x7b9a('0x2b')](_0x3e65fa[_0x7b9a('0x21')])?[]:_0x3e65fa[_0x7b9a('0x21')]['split'](',');}var _0x34eebe={'id':util[_0x7b9a('0x2c')](_0x7b9a('0x2d'),_0x34a82d,_0x3e65fa['id'],_0x3e65fa[_0x7b9a('0x18')]),'condition':require('./interval')[_0x7b9a('0x2e')](_0x34a82d,getIntervals(_0xb157e5[_0x7b9a('0x2f')],_0x3e65fa),_0xb157e5),'consequence':require(_0x7b9a('0x30')+_0x3e65fa[_0x7b9a('0x18')])['consequence'](_0x34a82d,_0x331ae6,_0xb157e5,_0x346daa),'p':_0x3e65fa[_0x7b9a('0x31')]||0x0};logger['info'](_0x7b9a('0x32'),_0x34eebe['id'],_0x7b9a('0x33'),getIntervals(_0xb157e5[_0x7b9a('0x2f')],_0x3e65fa)[_0x7b9a('0x1f')](_0x7b9a('0x34')));_0x4996f1[_0x7b9a('0x1d')](_0x34eebe);}else{logger['error'](_0x7b9a('0x35'),path[_0x7b9a('0x1f')](__dirname,_0x7b9a('0x13'),_0x3e65fa['app']+'.js'));}}_0xb157e5[_0x7b9a('0x10')][_0x34a82d]=new RuleEngine(_0x4996f1);_0xb157e5[_0x7b9a('0x10')][_0x34a82d][_0x7b9a('0x36')](_0x346daa,function(_0x5cd3dd){logger[_0x7b9a('0x37')](_0x7b9a('0x38'),JSON['stringify'](_0x5cd3dd['matchPath']));if(_0xb157e5['rules'][_0x34a82d]){_0xb157e5[_0x7b9a('0x10')][_0x34a82d][_0x7b9a('0x39')]('complete');}});return _0x35e602({'code':0xc8,'message':_0x346daa});}else{logger[_0x7b9a('0x37')](_0x7b9a('0x3a'));return _0x35e602({'code':0xc8,'message':_0x346daa});}}catch(_0x3e6549){logger['error'](_0x3e6549[_0x7b9a('0x3b')]);return _0x2f1899(_0x22a7e4['error'](0x1f4,_0x3e6549));}}return _0x2f1899(_0x7b9a('0x3c'));});},'AcceptMessage':function(_0x102d0c){var _0x365643=this;return new Promise(function(_0xeaa48c,_0x349bb8){if(_0x102d0c['agent']&&_0x102d0c[_0x7b9a('0x3d')]['id']){if(_0xb157e5['agents'][_0x102d0c[_0x7b9a('0x3d')]['id']]){_0xb157e5['agents'][_0x102d0c['agent']['id']][_0x7b9a('0x3e')]=![];_0xb157e5[_0x7b9a('0x3f')][_0x102d0c[_0x7b9a('0x3d')]['id']][_0x7b9a('0x40')]=undefined;}}if(_0x102d0c[_0x7b9a('0x11')]&&_0x102d0c[_0x7b9a('0x11')]['id']){try{var _0xd38628=getId(_0x102d0c[_0x7b9a('0x1b')],_0x102d0c[_0x7b9a('0x11')]?_0x102d0c['message']['id']:0x0,_0x102d0c[_0x7b9a('0x12')]?_0x102d0c[_0x7b9a('0x12')]['id']:0x0);if(_0xb157e5['rules'][_0xd38628]){_0xb157e5['rules'][_0xd38628]['emit'](_0x7b9a('0x41'));if(rpc[_0x102d0c[_0x7b9a('0x1b')]+_0x7b9a('0x42')]){rpc[_0x102d0c[_0x7b9a('0x1b')]+'QueueReport'][_0x7b9a('0x43')](_0xd38628,{'UserId':_0x102d0c[_0x7b9a('0x11')][_0x7b9a('0x44')]})[_0x7b9a('0x45')](function(_0x2d083b){logger['error'](_0x7b9a('0x46'));});}}return _0xeaa48c({'code':0xc8,'message':_0x102d0c});}catch(_0x54eb5f){logger[_0x7b9a('0x47')](_0x54eb5f[_0x7b9a('0x3b')]);return _0x349bb8(_0x365643[_0x7b9a('0x47')](0x1f4,_0x54eb5f));}}logger[_0x7b9a('0x47')]('message\x20is\x20empty');return _0x349bb8(_0x365643[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'RejectMessage':function(_0x354a87){var _0x28855a=this;return new Promise(function(_0x2b0db5,_0x3e2f1b){if(_0x354a87[_0x7b9a('0x3d')]&&_0x354a87['agent']['id']){try{if(_0xb157e5['agents'][_0x354a87['agent']['id']]){_0xb157e5[_0x7b9a('0x3f')][_0x354a87[_0x7b9a('0x3d')]['id']]['busy']=![];_0xb157e5['agents'][_0x354a87['agent']['id']]['busyQueue']=undefined;}return _0x2b0db5({'code':0xc8,'message':_0x354a87});}catch(_0x7c800f){logger[_0x7b9a('0x47')](_0x7c800f[_0x7b9a('0x3b')]);return _0x3e2f1b(_0x28855a[_0x7b9a('0x47')](0x1f4,_0x7c800f));}}logger[_0x7b9a('0x47')](_0x7b9a('0x48'));return _0x3e2f1b(_0x28855a[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'AbandonInteraction':function(_0x5dc17e){var _0x1f99f5=this;return new Promise(function(_0x5d499f,_0x23a0cb){if(_0x5dc17e[_0x7b9a('0x1b')]&&_0x5dc17e[_0x7b9a('0x12')]&&_0x5dc17e[_0x7b9a('0x12')]['id']){try{var _0x19e6e9=getId(_0x5dc17e['channel'],_0x5dc17e[_0x7b9a('0x11')]?_0x5dc17e['message']['id']:0x0,_0x5dc17e[_0x7b9a('0x12')]?_0x5dc17e[_0x7b9a('0x12')]['id']:0x0);if(_0xb157e5[_0x7b9a('0x10')][_0x19e6e9]){_0xb157e5['rules'][_0x19e6e9]['emit']('end');}return _0x5d499f({'code':0xc8,'message':_0x5dc17e});}catch(_0x4f6843){logger[_0x7b9a('0x47')](_0x4f6843[_0x7b9a('0x3b')]);return _0x23a0cb(_0x1f99f5[_0x7b9a('0x47')](0x1f4,_0x4f6843));}}logger['error'](_0x7b9a('0x48'));return _0x23a0cb(_0x1f99f5[_0x7b9a('0x47')](0x1f4,_0x7b9a('0x48')));});},'AgentCapacity':function(_0x3c70bf){var _0xea7b37=this;return new Promise(function(_0x4c3939,_0x8bd047){if(_0xb157e5[_0x7b9a('0x3f')][_0x7b9a('0x49')](_0x3c70bf['id'])){for(var _0x4fe869 in _0x3c70bf['capacity']){if(_0x3c70bf['capacity'][_0x7b9a('0x49')](_0x4fe869)){if(_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']][_0x7b9a('0x49')](_0x4fe869+'CurrentCapacity')){_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']][_0x4fe869+_0x7b9a('0x4a')]=parseInt(_0x3c70bf['capacity'][_0x4fe869],0xa);}}}_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']]['updateRealtime']();return _0x4c3939({'code':0xc8,'message':_0xb157e5[_0x7b9a('0x3f')][_0x3c70bf['id']]});}else{return _0x8bd047(_0xea7b37['error'](0x1f4,_0x7b9a('0x4b')));}});},'Agents':function(_0xfa4a89){return new Promise(function(_0x302f71,_0x4121d5){var _0x5d45ae=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x3f')]);_0x302f71({'count':_0x5d45ae[_0x7b9a('0x15')],'rows':_0x5d45ae});});},'ChatQueues':function(_0x273134){return new Promise(function(_0x567328,_0x239b62){var _0x551362=[];for(var _0x3ab2cb in _0xb157e5['chatQueues']){if(_0xb157e5[_0x7b9a('0x4d')]['hasOwnProperty'](_0x3ab2cb)){var _0x58fbd2=_0xb157e5['chatQueues'][_0x3ab2cb];var _0x48442a={'id':_0x58fbd2['id'],'available':_0x58fbd2[_0x7b9a('0x4e')],'loggedIn':_0x58fbd2[_0x7b9a('0x4f')],'name':_0x58fbd2[_0x7b9a('0x50')],'paused':_0x58fbd2[_0x7b9a('0x51')],'waiting':_0x58fbd2['waiting']};_0x551362[_0x7b9a('0x1d')](_0x48442a);}}_0x567328({'count':_0x551362['length'],'rows':_0x551362});});},'MailQueues':function(_0x50b6f1){return new Promise(function(_0x15679c,_0x564e51){var _0x54066a=[];for(var _0x7ad607 in _0xb157e5[_0x7b9a('0x52')]){if(_0xb157e5['mailQueues'][_0x7b9a('0x49')](_0x7ad607)){var _0x4a441c=_0xb157e5[_0x7b9a('0x52')][_0x7ad607];var _0x23ffd0={'id':_0x4a441c['id'],'available':_0x4a441c[_0x7b9a('0x4e')],'loggedIn':_0x4a441c['loggedIn'],'name':_0x4a441c['name'],'paused':_0x4a441c['paused'],'waiting':_0x4a441c['waiting']};_0x54066a[_0x7b9a('0x1d')](_0x23ffd0);}}_0x15679c({'count':_0x54066a[_0x7b9a('0x15')],'rows':_0x54066a});});},'OpenchannelQueues':function(_0x3fd697){return new Promise(function(_0x2092b6,_0x261a43){var _0x147d23=[];for(var _0x45014b in _0xb157e5['openchannelQueues']){if(_0xb157e5[_0x7b9a('0x53')][_0x7b9a('0x49')](_0x45014b)){var _0x4f312a=_0xb157e5[_0x7b9a('0x53')][_0x45014b];var _0x3f01dc={'id':_0x4f312a['id'],'available':_0x4f312a[_0x7b9a('0x4e')],'loggedIn':_0x4f312a['loggedIn'],'name':_0x4f312a['name'],'paused':_0x4f312a[_0x7b9a('0x51')],'waiting':_0x4f312a[_0x7b9a('0x54')]};_0x147d23['push'](_0x3f01dc);}}_0x2092b6({'count':_0x147d23[_0x7b9a('0x15')],'rows':_0x147d23});});},'SmsQueues':function(_0x5ab25f){return new Promise(function(_0x46aa05,_0xbbb057){var _0x3a46e9=[];for(var _0x59d4fa in _0xb157e5[_0x7b9a('0x55')]){if(_0xb157e5[_0x7b9a('0x55')][_0x7b9a('0x49')](_0x59d4fa)){var _0xe229ed=_0xb157e5[_0x7b9a('0x55')][_0x59d4fa];var _0x575c9e={'id':_0xe229ed['id'],'available':_0xe229ed['available'],'loggedIn':_0xe229ed[_0x7b9a('0x4f')],'name':_0xe229ed[_0x7b9a('0x50')],'paused':_0xe229ed['paused'],'waiting':_0xe229ed[_0x7b9a('0x54')]};_0x3a46e9[_0x7b9a('0x1d')](_0x575c9e);}}_0x46aa05({'count':_0x3a46e9[_0x7b9a('0x15')],'rows':_0x3a46e9});});},'FaxQueues':function(_0x5b02a6){return new Promise(function(_0x4af252,_0x17a29){var _0x13cea6=[];for(var _0x38b0da in _0xb157e5[_0x7b9a('0x56')]){if(_0xb157e5['faxQueues'][_0x7b9a('0x49')](_0x38b0da)){var _0x276da1=_0xb157e5[_0x7b9a('0x56')][_0x38b0da];var _0x4fdc1a={'id':_0x276da1['id'],'available':_0x276da1['available'],'loggedIn':_0x276da1[_0x7b9a('0x4f')],'name':_0x276da1[_0x7b9a('0x50')],'paused':_0x276da1[_0x7b9a('0x51')],'waiting':_0x276da1[_0x7b9a('0x54')]};_0x13cea6['push'](_0x4fdc1a);}}_0x4af252({'count':_0x13cea6[_0x7b9a('0x15')],'rows':_0x13cea6});});},'WhatsappQueues':function(_0x300a44){return new Promise(function(_0x52cc35,_0x26ea95){var _0x1ae9c5=[];for(var _0x471b37 in _0xb157e5[_0x7b9a('0x57')]){if(_0xb157e5[_0x7b9a('0x57')][_0x7b9a('0x49')](_0x471b37)){var _0xc408dd=_0xb157e5[_0x7b9a('0x57')][_0x471b37];var _0x449c2e={'id':_0xc408dd['id'],'available':_0xc408dd[_0x7b9a('0x4e')],'loggedIn':_0xc408dd[_0x7b9a('0x4f')],'name':_0xc408dd['name'],'paused':_0xc408dd['paused'],'waiting':_0xc408dd[_0x7b9a('0x54')]};_0x1ae9c5[_0x7b9a('0x1d')](_0x449c2e);}}_0x52cc35({'count':_0x1ae9c5['length'],'rows':_0x1ae9c5});});},'ChatQueuesWaitingInteractions':function(_0x2c0819){return new Promise(function(_0xa76006,_0x52f55c){var _0xff5477=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x58')]);_0xa76006({'count':_0xff5477[_0x7b9a('0x15')],'rows':_0xff5477});});},'MailQueuesWaitingInteractions':function(_0x449836){return new Promise(function(_0x327a74,_0x432405){var _0x237399=_[_0x7b9a('0x4c')](_0xb157e5['mailQueuesWaitingInteractions']);_0x327a74({'count':_0x237399[_0x7b9a('0x15')],'rows':_0x237399});});},'OpenchannelQueuesWaitingInteractions':function(_0x141340){return new Promise(function(_0x6d2d50,_0x3321b6){var _0x3d928e=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x59')]);_0x6d2d50({'count':_0x3d928e[_0x7b9a('0x15')],'rows':_0x3d928e});});},'SmsQueuesWaitingInteractions':function(_0x5d522b){return new Promise(function(_0x6937b9,_0x217ae5){var _0x3022e0=_['values'](_0xb157e5[_0x7b9a('0x5a')]);_0x6937b9({'count':_0x3022e0[_0x7b9a('0x15')],'rows':_0x3022e0});});},'FaxQueuesWaitingInteractions':function(_0x1c077d){return new Promise(function(_0x43e57d,_0x6e01d1){var _0x14f27e=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x5b')]);_0x43e57d({'count':_0x14f27e['length'],'rows':_0x14f27e});});},'WhatsappQueuesWaitingInteractions':function(_0x5260ca){return new Promise(function(_0x178ebc,_0x220146){var _0x16e506=_[_0x7b9a('0x4c')](_0xb157e5[_0x7b9a('0x5c')]);_0x178ebc({'count':_0x16e506[_0x7b9a('0x15')],'rows':_0x16e506});});}};var _0x18c96f=jayson[_0x7b9a('0x5d')](_0x344fa7)[_0x7b9a('0x5e')]();_0x18c96f['on'](_0x7b9a('0x47'),function(_0x5b0ab3){logger[_0x7b9a('0x47')](JSON[_0x7b9a('0x5f')](_0x5b0ab3));return _0x2853f2(_0x5b0ab3);});_0x18c96f[_0x7b9a('0x60')](0x232c,'127.0.0.1',function(){console[_0x7b9a('0x61')](_0x7b9a('0x62'),0x232c);return _0x6fa16a(_0x7b9a('0x63')+0x232c);});});}; \ No newline at end of file +var _0x2bc6=['message','interaction','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','dialogflowv2','amazonlex','split','tag','tvox','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agents','agent','busy','busyQueue','end','update','catch','error','stack','message\x20is\x20empty','hasOwnProperty','capacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel'];(function(_0x22c5eb,_0x5ae219){var _0x362789=function(_0x27623b){while(--_0x27623b){_0x22c5eb['push'](_0x22c5eb['shift']());}};_0x362789(++_0x5ae219);}(_0x2bc6,0x163));var _0x62bc=function(_0x509850,_0x2f4655){_0x509850=_0x509850-0x0;var _0xf2a663=_0x2bc6[_0x509850];return _0xf2a663;};'use strict';var _=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var path=require(_0x62bc('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x62bc('0x3'));var logger=require('../../../config/logger')(_0x62bc('0x4'));var rpc={'openchannelQueueReport':require(_0x62bc('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x62bc('0x6')),'smsQueueReport':require(_0x62bc('0x7')),'faxQueueReport':require(_0x62bc('0x8')),'whatsappQueueReport':require(_0x62bc('0x9'))};var RuleEngine=require(_0x62bc('0xa'));function getId(_0x3f625c,_0x5bedeb,_0x441722){return util[_0x62bc('0xb')](_0x62bc('0xc'),_0x3f625c,_0x5bedeb||0x0,_0x441722||0x0);}function getIntervals(_0x306bac,_0x481da1){var _0x436d03=[];if(!_[_0x62bc('0xd')](_0x481da1[_0x62bc('0xe')])&&!_['isNil'](_0x306bac[_0x481da1[_0x62bc('0xe')]])&&!_[_0x62bc('0xd')](_0x306bac[_0x481da1[_0x62bc('0xe')]][_0x62bc('0xf')])){_0x436d03=_[_0x62bc('0x10')](_0x306bac[_0x481da1[_0x62bc('0xe')]][_0x62bc('0xf')],'interval');}else if(!_[_0x62bc('0xd')](_0x481da1[_0x62bc('0x11')])){_0x436d03=[_0x481da1['interval']];}return _0x436d03;}exports[_0x62bc('0x12')]=function(_0x10230f){_0x10230f[_0x62bc('0x13')]={};return new BPromise(function(_0x4da447,_0x263424){var _0x94b649={'Start':function(_0x56eade){var _0x515c80=this;return new Promise(function(_0x39c5e0,_0x2d6820){if(_0x56eade){try{var _0x5bb569=[];var _0x278893=getId(_0x56eade[_0x62bc('0x14')],_0x56eade[_0x62bc('0x15')]?_0x56eade[_0x62bc('0x15')]['id']:0x0,_0x56eade[_0x62bc('0x16')]?_0x56eade[_0x62bc('0x16')]['id']:0x0);if(_0x56eade[_0x62bc('0x17')]&&_[_0x62bc('0x18')](_0x56eade[_0x62bc('0x17')])&&_0x56eade['applications']['length']){for(var _0x2b2e5f=0x0;_0x2b2e5f<_0x56eade[_0x62bc('0x17')][_0x62bc('0x19')];_0x2b2e5f+=0x1){var _0x51e451=_0x56eade[_0x62bc('0x17')][_0x2b2e5f];if(fs['existsSync'](path[_0x62bc('0x1a')](__dirname,_0x62bc('0x17'),_0x51e451[_0x62bc('0x1b')]+'.js'))){var _0x3b8644=[];switch(_0x51e451[_0x62bc('0x1b')][_0x62bc('0x1c')]()){case _0x62bc('0x1d'):var _0x278dcd=_0x51e451[_0x62bc('0x1e')]['split'](',');if(_0x56eade[_0x62bc('0x14')]===_0x62bc('0x1f')){_0x3b8644[_0x62bc('0x20')](_0x278dcd[0x0]);_0x3b8644[_0x62bc('0x20')](_0x278dcd[0x1]);_0x3b8644[_0x62bc('0x20')](_0x278dcd['slice'](0x2,_0x278dcd['length'])[_0x62bc('0x1a')](','));}else{_0x3b8644['push'](_0x278dcd[0x0]);_0x3b8644[_0x62bc('0x20')](_0x278dcd[_0x62bc('0x21')](0x1,_0x278dcd[_0x62bc('0x19')])['join'](','));}break;case _0x62bc('0x22'):var _0x19e689=_0x51e451[_0x62bc('0x1e')]['split'](',');_0x3b8644['push'](_0x19e689[0x0]);_0x3b8644[_0x62bc('0x20')](_0x19e689[0x1]);_0x3b8644[_0x62bc('0x20')](_0x19e689[_0x62bc('0x21')](0x2,_0x19e689['length'])[_0x62bc('0x1a')](','));break;case _0x62bc('0x23'):var _0x44600f=_0x51e451[_0x62bc('0x1e')]['split'](',');_0x3b8644[_0x62bc('0x20')](_0x44600f[0x0]);_0x3b8644['push'](_0x44600f[0x1]);_0x3b8644[_0x62bc('0x20')](_0x44600f[0x2]);_0x3b8644[_0x62bc('0x20')](_0x44600f[0x3]);_0x3b8644[_0x62bc('0x20')](_0x44600f[_0x62bc('0x21')](0x4,_0x44600f[_0x62bc('0x19')])[_0x62bc('0x1a')](','));break;case _0x62bc('0x24'):var _0x12d443=_0x51e451[_0x62bc('0x1e')][_0x62bc('0x25')](',');_0x3b8644[_0x62bc('0x20')](_0x12d443[0x0]);_0x3b8644[_0x62bc('0x20')](_0x12d443[0x1]);_0x3b8644[_0x62bc('0x20')](_0x12d443[0x2]);_0x3b8644[_0x62bc('0x20')](_0x12d443[0x3]);_0x3b8644[_0x62bc('0x20')](_0x12d443[_0x62bc('0x21')](0x4,_0x12d443[_0x62bc('0x19')])['join'](','));break;case _0x62bc('0x15'):_0x3b8644['push'](_0x51e451['appdata']);break;case _0x62bc('0x26'):_0x3b8644['push'](_0x51e451['TagId']);_0x3b8644['push'](_0x51e451[_0x62bc('0x1e')]);break;case _0x62bc('0x27'):var _0x26e043=utils['getMustacheRender'](_0x56eade['account']['notificationTemplate'],_0x56eade);var _0x3c938d=_0x51e451[_0x62bc('0x1e')]['split'](',');_0x3b8644['push'](_0x3c938d[0x0]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x1]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x2]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x3]);_0x3b8644['push'](_0x3c938d[0x4]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x5]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x6]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x7]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0x8]);_0x3b8644['push'](_0x3c938d[0x9]);_0x3b8644[_0x62bc('0x20')](_0x3c938d[0xa]);_0x3b8644[_0x62bc('0x20')](_0x56eade['interaction']['id']);_0x3b8644[_0x62bc('0x20')](_0x56eade[_0x62bc('0x15')]['id']);_0x3b8644[_0x62bc('0x20')](_0x51e451[_0x62bc('0x28')]);_0x3b8644['push'](_0x56eade[_0x62bc('0x16')]['ContactId']);_0x3b8644[_0x62bc('0x20')](_0x56eade[_0x62bc('0x29')][_0x62bc('0x29')]);_0x3b8644[_0x62bc('0x20')](_0x26e043);break;default:_0x3b8644=_['isNil'](_0x51e451[_0x62bc('0x1e')])?[]:_0x51e451[_0x62bc('0x1e')][_0x62bc('0x25')](',');}var _0x176b1f={'id':util[_0x62bc('0xb')](_0x62bc('0x2a'),_0x278893,_0x51e451['id'],_0x51e451[_0x62bc('0x1b')]),'condition':require(_0x62bc('0x2b'))[_0x62bc('0x2c')](_0x278893,getIntervals(_0x10230f[_0x62bc('0x2d')],_0x51e451),_0x10230f),'consequence':require(_0x62bc('0x2e')+_0x51e451['app'])['consequence'](_0x278893,_0x3b8644,_0x10230f,_0x56eade),'p':_0x51e451[_0x62bc('0x2f')]||0x0};logger[_0x62bc('0x30')]('Push\x20new\x20rule',_0x176b1f['id'],_0x62bc('0x31'),getIntervals(_0x10230f[_0x62bc('0x2d')],_0x51e451)[_0x62bc('0x1a')](_0x62bc('0x32')));_0x5bb569[_0x62bc('0x20')](_0x176b1f);}else{logger['error'](_0x62bc('0x33'),path[_0x62bc('0x1a')](__dirname,'applications',_0x51e451['app']+_0x62bc('0x34')));}}_0x10230f[_0x62bc('0x13')][_0x278893]=new RuleEngine(_0x5bb569);_0x10230f[_0x62bc('0x13')][_0x278893]['execute'](_0x56eade,function(_0x185423){logger[_0x62bc('0x30')](_0x62bc('0x35'),JSON[_0x62bc('0x36')](_0x185423[_0x62bc('0x37')]));if(_0x10230f[_0x62bc('0x13')][_0x278893]){_0x10230f['rules'][_0x278893][_0x62bc('0x38')]('complete');}});return _0x39c5e0({'code':0xc8,'message':_0x56eade});}else{logger[_0x62bc('0x30')](_0x62bc('0x39'));return _0x39c5e0({'code':0xc8,'message':_0x56eade});}}catch(_0x2929d4){logger['error'](_0x2929d4['stack']);return _0x2d6820(_0x515c80['error'](0x1f4,_0x2929d4));}}return _0x2d6820(_0x62bc('0x3a'));});},'AcceptMessage':function(_0x5983e9){var _0x10ea2e=this;return new Promise(function(_0x10ffa0,_0x487baf){if(_0x5983e9['agent']&&_0x5983e9['agent']['id']){if(_0x10230f[_0x62bc('0x3b')][_0x5983e9[_0x62bc('0x3c')]['id']]){_0x10230f[_0x62bc('0x3b')][_0x5983e9[_0x62bc('0x3c')]['id']][_0x62bc('0x3d')]=![];_0x10230f['agents'][_0x5983e9[_0x62bc('0x3c')]['id']][_0x62bc('0x3e')]=undefined;}}if(_0x5983e9['message']&&_0x5983e9[_0x62bc('0x15')]['id']){try{var _0x56f432=getId(_0x5983e9[_0x62bc('0x14')],_0x5983e9[_0x62bc('0x15')]?_0x5983e9[_0x62bc('0x15')]['id']:0x0,_0x5983e9[_0x62bc('0x16')]?_0x5983e9[_0x62bc('0x16')]['id']:0x0);if(_0x10230f[_0x62bc('0x13')][_0x56f432]){_0x10230f[_0x62bc('0x13')][_0x56f432]['emit'](_0x62bc('0x3f'));if(rpc[_0x5983e9[_0x62bc('0x14')]+'QueueReport']){rpc[_0x5983e9[_0x62bc('0x14')]+'QueueReport'][_0x62bc('0x40')](_0x56f432,{'UserId':_0x5983e9[_0x62bc('0x15')]['UserId']})[_0x62bc('0x41')](function(_0x3710a1){logger[_0x62bc('0x42')]('error\x20update\x20queue\x20report');});}}return _0x10ffa0({'code':0xc8,'message':_0x5983e9});}catch(_0xed0bef){logger[_0x62bc('0x42')](_0xed0bef[_0x62bc('0x43')]);return _0x487baf(_0x10ea2e[_0x62bc('0x42')](0x1f4,_0xed0bef));}}logger[_0x62bc('0x42')](_0x62bc('0x44'));return _0x487baf(_0x10ea2e[_0x62bc('0x42')](0x1f4,_0x62bc('0x44')));});},'RejectMessage':function(_0x260847){var _0x1fb6d3=this;return new Promise(function(_0x44d2a2,_0x601e5d){if(_0x260847[_0x62bc('0x3c')]&&_0x260847[_0x62bc('0x3c')]['id']){try{if(_0x10230f[_0x62bc('0x3b')][_0x260847[_0x62bc('0x3c')]['id']]){_0x10230f['agents'][_0x260847[_0x62bc('0x3c')]['id']][_0x62bc('0x3d')]=![];_0x10230f[_0x62bc('0x3b')][_0x260847[_0x62bc('0x3c')]['id']][_0x62bc('0x3e')]=undefined;}return _0x44d2a2({'code':0xc8,'message':_0x260847});}catch(_0x25342c){logger[_0x62bc('0x42')](_0x25342c[_0x62bc('0x43')]);return _0x601e5d(_0x1fb6d3[_0x62bc('0x42')](0x1f4,_0x25342c));}}logger[_0x62bc('0x42')](_0x62bc('0x44'));return _0x601e5d(_0x1fb6d3[_0x62bc('0x42')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x378047){var _0x50d761=this;return new Promise(function(_0xf8c4d5,_0x477b52){if(_0x378047[_0x62bc('0x14')]&&_0x378047[_0x62bc('0x16')]&&_0x378047[_0x62bc('0x16')]['id']){try{var _0xb6e13e=getId(_0x378047[_0x62bc('0x14')],_0x378047[_0x62bc('0x15')]?_0x378047['message']['id']:0x0,_0x378047['interaction']?_0x378047[_0x62bc('0x16')]['id']:0x0);if(_0x10230f[_0x62bc('0x13')][_0xb6e13e]){_0x10230f[_0x62bc('0x13')][_0xb6e13e]['emit'](_0x62bc('0x3f'));}return _0xf8c4d5({'code':0xc8,'message':_0x378047});}catch(_0x1325a4){logger[_0x62bc('0x42')](_0x1325a4[_0x62bc('0x43')]);return _0x477b52(_0x50d761['error'](0x1f4,_0x1325a4));}}logger[_0x62bc('0x42')](_0x62bc('0x44'));return _0x477b52(_0x50d761[_0x62bc('0x42')](0x1f4,_0x62bc('0x44')));});},'AgentCapacity':function(_0xeb24a9){var _0x21d470=this;return new Promise(function(_0x223f56,_0x4f196a){if(_0x10230f[_0x62bc('0x3b')][_0x62bc('0x45')](_0xeb24a9['id'])){for(var _0x39c443 in _0xeb24a9['capacity']){if(_0xeb24a9['capacity'][_0x62bc('0x45')](_0x39c443)){if(_0x10230f[_0x62bc('0x3b')][_0xeb24a9['id']][_0x62bc('0x45')](_0x39c443+'CurrentCapacity')){_0x10230f[_0x62bc('0x3b')][_0xeb24a9['id']][_0x39c443+'CurrentCapacity']=parseInt(_0xeb24a9[_0x62bc('0x46')][_0x39c443],0xa);}}}_0x10230f[_0x62bc('0x3b')][_0xeb24a9['id']]['updateRealtime']();return _0x223f56({'code':0xc8,'message':_0x10230f[_0x62bc('0x3b')][_0xeb24a9['id']]});}else{return _0x4f196a(_0x21d470['error'](0x1f4,_0x62bc('0x47')));}});},'Agents':function(_0x5999c7){return new Promise(function(_0x3e862f,_0x26a9ec){var _0x3f00f4=_[_0x62bc('0x48')](_0x10230f[_0x62bc('0x3b')]);_0x3e862f({'count':_0x3f00f4[_0x62bc('0x19')],'rows':_0x3f00f4});});},'ChatQueues':function(_0x5a28f4){return new Promise(function(_0x333390,_0x46fa83){var _0x2e28e4=[];for(var _0x4e5478 in _0x10230f[_0x62bc('0x49')]){if(_0x10230f[_0x62bc('0x49')][_0x62bc('0x45')](_0x4e5478)){var _0x132509=_0x10230f['chatQueues'][_0x4e5478];var _0x1a1ae8={'id':_0x132509['id'],'available':_0x132509[_0x62bc('0x4a')],'loggedIn':_0x132509[_0x62bc('0x4b')],'name':_0x132509[_0x62bc('0x4c')],'paused':_0x132509[_0x62bc('0x4d')],'waiting':_0x132509['waiting']};_0x2e28e4['push'](_0x1a1ae8);}}_0x333390({'count':_0x2e28e4[_0x62bc('0x19')],'rows':_0x2e28e4});});},'MailQueues':function(_0x5515bb){return new Promise(function(_0xf55012,_0x18779a){var _0x4dc4c8=[];for(var _0x166ee3 in _0x10230f['mailQueues']){if(_0x10230f[_0x62bc('0x4e')]['hasOwnProperty'](_0x166ee3)){var _0x468f58=_0x10230f['mailQueues'][_0x166ee3];var _0xfd3d8d={'id':_0x468f58['id'],'available':_0x468f58[_0x62bc('0x4a')],'loggedIn':_0x468f58[_0x62bc('0x4b')],'name':_0x468f58['name'],'paused':_0x468f58[_0x62bc('0x4d')],'waiting':_0x468f58[_0x62bc('0x4f')]};_0x4dc4c8[_0x62bc('0x20')](_0xfd3d8d);}}_0xf55012({'count':_0x4dc4c8[_0x62bc('0x19')],'rows':_0x4dc4c8});});},'OpenchannelQueues':function(_0x177fba){return new Promise(function(_0x4d79bc,_0x20d5cb){var _0x4341cd=[];for(var _0x4080e2 in _0x10230f[_0x62bc('0x50')]){if(_0x10230f[_0x62bc('0x50')][_0x62bc('0x45')](_0x4080e2)){var _0x3ee94c=_0x10230f[_0x62bc('0x50')][_0x4080e2];var _0x397fce={'id':_0x3ee94c['id'],'available':_0x3ee94c[_0x62bc('0x4a')],'loggedIn':_0x3ee94c[_0x62bc('0x4b')],'name':_0x3ee94c['name'],'paused':_0x3ee94c[_0x62bc('0x4d')],'waiting':_0x3ee94c[_0x62bc('0x4f')]};_0x4341cd[_0x62bc('0x20')](_0x397fce);}}_0x4d79bc({'count':_0x4341cd[_0x62bc('0x19')],'rows':_0x4341cd});});},'SmsQueues':function(_0x591a62){return new Promise(function(_0x2c65f1,_0x76701d){var _0x2b97f0=[];for(var _0x1c2db4 in _0x10230f[_0x62bc('0x51')]){if(_0x10230f[_0x62bc('0x51')][_0x62bc('0x45')](_0x1c2db4)){var _0x220536=_0x10230f['smsQueues'][_0x1c2db4];var _0x3e5fd6={'id':_0x220536['id'],'available':_0x220536[_0x62bc('0x4a')],'loggedIn':_0x220536[_0x62bc('0x4b')],'name':_0x220536[_0x62bc('0x4c')],'paused':_0x220536[_0x62bc('0x4d')],'waiting':_0x220536[_0x62bc('0x4f')]};_0x2b97f0[_0x62bc('0x20')](_0x3e5fd6);}}_0x2c65f1({'count':_0x2b97f0[_0x62bc('0x19')],'rows':_0x2b97f0});});},'FaxQueues':function(_0x39fe0f){return new Promise(function(_0x31ad54,_0x40e5d7){var _0x52550f=[];for(var _0x57ddd7 in _0x10230f[_0x62bc('0x52')]){if(_0x10230f[_0x62bc('0x52')]['hasOwnProperty'](_0x57ddd7)){var _0x44dc67=_0x10230f['faxQueues'][_0x57ddd7];var _0x3452d0={'id':_0x44dc67['id'],'available':_0x44dc67[_0x62bc('0x4a')],'loggedIn':_0x44dc67['loggedIn'],'name':_0x44dc67[_0x62bc('0x4c')],'paused':_0x44dc67['paused'],'waiting':_0x44dc67[_0x62bc('0x4f')]};_0x52550f['push'](_0x3452d0);}}_0x31ad54({'count':_0x52550f[_0x62bc('0x19')],'rows':_0x52550f});});},'WhatsappQueues':function(_0x5c9120){return new Promise(function(_0x25c3a8,_0x118669){var _0x1f80a0=[];for(var _0x33f932 in _0x10230f[_0x62bc('0x53')]){if(_0x10230f[_0x62bc('0x53')]['hasOwnProperty'](_0x33f932)){var _0x47394d=_0x10230f[_0x62bc('0x53')][_0x33f932];var _0x4af661={'id':_0x47394d['id'],'available':_0x47394d[_0x62bc('0x4a')],'loggedIn':_0x47394d[_0x62bc('0x4b')],'name':_0x47394d[_0x62bc('0x4c')],'paused':_0x47394d[_0x62bc('0x4d')],'waiting':_0x47394d[_0x62bc('0x4f')]};_0x1f80a0[_0x62bc('0x20')](_0x4af661);}}_0x25c3a8({'count':_0x1f80a0[_0x62bc('0x19')],'rows':_0x1f80a0});});},'ChatQueuesWaitingInteractions':function(_0x157532){return new Promise(function(_0x18dcaa,_0x166f90){var _0x4a0bf8=_['values'](_0x10230f['chatQueuesWaitingInteractions']);_0x18dcaa({'count':_0x4a0bf8[_0x62bc('0x19')],'rows':_0x4a0bf8});});},'MailQueuesWaitingInteractions':function(_0x49ee80){return new Promise(function(_0x3241f8,_0x23c5e3){var _0x2dc322=_[_0x62bc('0x48')](_0x10230f[_0x62bc('0x54')]);_0x3241f8({'count':_0x2dc322[_0x62bc('0x19')],'rows':_0x2dc322});});},'OpenchannelQueuesWaitingInteractions':function(_0x3a7a73){return new Promise(function(_0x45c997,_0x4c5ff2){var _0x30649e=_[_0x62bc('0x48')](_0x10230f[_0x62bc('0x55')]);_0x45c997({'count':_0x30649e['length'],'rows':_0x30649e});});},'SmsQueuesWaitingInteractions':function(_0xfea6d7){return new Promise(function(_0x4c8672,_0x339248){var _0x3aa295=_['values'](_0x10230f[_0x62bc('0x56')]);_0x4c8672({'count':_0x3aa295[_0x62bc('0x19')],'rows':_0x3aa295});});},'FaxQueuesWaitingInteractions':function(_0x47d30f){return new Promise(function(_0x4e2463,_0x5c279e){var _0x5f3c36=_[_0x62bc('0x48')](_0x10230f[_0x62bc('0x57')]);_0x4e2463({'count':_0x5f3c36[_0x62bc('0x19')],'rows':_0x5f3c36});});},'WhatsappQueuesWaitingInteractions':function(_0x397270){return new Promise(function(_0x3aac90,_0x5beb17){var _0xf887a3=_[_0x62bc('0x48')](_0x10230f[_0x62bc('0x58')]);_0x3aac90({'count':_0xf887a3[_0x62bc('0x19')],'rows':_0xf887a3});});}};var _0x311318=jayson[_0x62bc('0x59')](_0x94b649)[_0x62bc('0x5a')]();_0x311318['on'](_0x62bc('0x42'),function(_0x10ad1e){logger[_0x62bc('0x42')](JSON[_0x62bc('0x36')](_0x10ad1e));return _0x263424(_0x10ad1e);});_0x311318[_0x62bc('0x12')](0x232c,_0x62bc('0x5b'),function(){console[_0x62bc('0x5c')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x4da447(_0x62bc('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 869dade..ad03a9f 100644 --- a/server/services/routing/server/interval.js +++ b/server/services/routing/server/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9666=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','util','bluebird','jayson/promise','routing','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','iftime\x20%s'];(function(_0x32f951,_0x6479d0){var _0x3fc9bc=function(_0x517e62){while(--_0x517e62){_0x32f951['push'](_0x32f951['shift']());}};_0x3fc9bc(++_0x6479d0);}(_0x9666,0x1ca));var _0x6966=function(_0x4a05ee,_0x471f25){_0x4a05ee=_0x4a05ee-0x0;var _0x5abd8b=_0x9666[_0x4a05ee];return _0x5abd8b;};'use strict';var util=require(_0x6966('0x0'));var BPromise=require(_0x6966('0x1'));var jayson=require(_0x6966('0x2'));var _=require('lodash');var logger=require('../../../config/logger')(_0x6966('0x3'));var client=jayson['client'][_0x6966('0x4')]({'port':0x232a});function request(_0x4bd6c8,_0x495279){return new BPromise(function(_0x298763,_0xe2b08){return client[_0x6966('0x5')](_0x4bd6c8,_0x495279)[_0x6966('0x6')](function(_0x46aeea){if(_0x46aeea[_0x6966('0x7')]){return _0xe2b08(_0x46aeea['error'][_0x6966('0x8')]);}else{return _0x298763(_0x46aeea[_0x6966('0x9')]);}})[_0x6966('0xa')](function(_0x1161cd){return _0xe2b08(_0x1161cd);});});}exports[_0x6966('0xb')]=function(_0x4915a2,_0x52bffb,_0x3f1461){return function(_0x1eecd8){if(_0x3f1461[_0x6966('0xc')]&&!_0x3f1461['rules'][_0x4915a2]){logger[_0x6966('0xd')](_0x6966('0xe'),_0x4915a2);return _0x1eecd8[_0x6966('0xf')]();}var _0x11e33d=[];for(var _0x66cbb8=0x0;_0x66cbb8<_0x52bffb[_0x6966('0x10')];_0x66cbb8+=0x1){_0x11e33d['push'](request('Command',{'command':util['format'](_0x6966('0x11'),_0x52bffb[_0x66cbb8])})[_0x6966('0x6')](function(_0x56467c){return _0x56467c&&_0x56467c[_0x6966('0x8')]&&_0x56467c[_0x6966('0x8')]['indexOf'](_0x6966('0x12'))>=0x0?!![]:![];})[_0x6966('0xa')](function(_0x297d5c){logger[_0x6966('0x7')](_0x6966('0x13'),_0x4915a2,_0x52bffb[_0x66cbb8]);}));}BPromise[_0x6966('0x14')](_0x11e33d)[_0x6966('0x6')](function(_0x13236f){var _0x51c1ed=_[_0x6966('0x15')](_0x13236f);logger['info'](_0x6966('0x16'),_0x4915a2,_0x52bffb['join'](_0x6966('0x17')),_0x51c1ed);_0x1eecd8[_0x6966('0x18')](_0x51c1ed);})[_0x6966('0xa')](function(_0x2e8615){console[_0x6966('0x19')](_0x2e8615);logger['error'](_0x6966('0x16'),_0x4915a2,_0x52bffb[_0x6966('0x1a')]('\x20|\x20'),_0x2e8615[_0x6966('0x1b')]);_0x1eecd8[_0x6966('0xf')]();});};}; \ No newline at end of file +var _0xe621=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','then','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','request','error','message','result','catch','condition'];(function(_0x1dadef,_0x437ed1){var _0x1b2569=function(_0x588c57){while(--_0x588c57){_0x1dadef['push'](_0x1dadef['shift']());}};_0x1b2569(++_0x437ed1);}(_0xe621,0xf0));var _0x1e62=function(_0x48ad0a,_0x4bfc8c){_0x48ad0a=_0x48ad0a-0x0;var _0x5befe5=_0xe621[_0x48ad0a];return _0x5befe5;};'use strict';var util=require(_0x1e62('0x0'));var BPromise=require(_0x1e62('0x1'));var jayson=require(_0x1e62('0x2'));var _=require('lodash');var logger=require(_0x1e62('0x3'))(_0x1e62('0x4'));var client=jayson[_0x1e62('0x5')]['http']({'port':0x232a});function request(_0x2f2354,_0x265143){return new BPromise(function(_0x4caa85,_0x321697){return client[_0x1e62('0x6')](_0x2f2354,_0x265143)['then'](function(_0x52ee82){if(_0x52ee82[_0x1e62('0x7')]){return _0x321697(_0x52ee82['error'][_0x1e62('0x8')]);}else{return _0x4caa85(_0x52ee82[_0x1e62('0x9')]);}})[_0x1e62('0xa')](function(_0x67c82c){return _0x321697(_0x67c82c);});});}exports[_0x1e62('0xb')]=function(_0x4617ae,_0x14e5a3,_0x36a749){return function(_0x1abbc1){if(_0x36a749['rules']&&!_0x36a749['rules'][_0x4617ae]){logger[_0x1e62('0xc')](_0x1e62('0xd'),_0x4617ae);return _0x1abbc1['stop']();}var _0x2a5846=[];for(var _0x301fd6=0x0;_0x301fd6<_0x14e5a3['length'];_0x301fd6+=0x1){_0x2a5846[_0x1e62('0xe')](request(_0x1e62('0xf'),{'command':util[_0x1e62('0x10')]('iftime\x20%s',_0x14e5a3[_0x301fd6])})[_0x1e62('0x11')](function(_0x3383d1){return _0x3383d1&&_0x3383d1[_0x1e62('0x8')]&&_0x3383d1['message']['indexOf'](_0x1e62('0x12'))>=0x0?!![]:![];})[_0x1e62('0xa')](function(_0x54f6ec){logger[_0x1e62('0x7')](_0x1e62('0x13'),_0x4617ae,_0x14e5a3[_0x301fd6]);}));}BPromise[_0x1e62('0x14')](_0x2a5846)[_0x1e62('0x11')](function(_0x56f813){var _0x264132=_[_0x1e62('0x15')](_0x56f813);logger[_0x1e62('0xc')](_0x1e62('0x16'),_0x4617ae,_0x14e5a3[_0x1e62('0x17')](_0x1e62('0x18')),_0x264132);_0x1abbc1[_0x1e62('0x19')](_0x264132);})[_0x1e62('0xa')](function(_0x3a1158){console[_0x1e62('0x1a')](_0x3a1158);logger['error'](_0x1e62('0x16'),_0x4617ae,_0x14e5a3[_0x1e62('0x17')](_0x1e62('0x18')),_0x3a1158[_0x1e62('0x1b')]);_0x1abbc1['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b08dbed..3c971ff 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','destuniqueid','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','[%s][agents][agentcomplete]','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]'];(function(_0x310279,_0x23ea0a){var _0x1115cf=function(_0x153078){while(--_0x153078){_0x310279['push'](_0x310279['shift']());}};_0x1115cf(++_0x23ea0a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x3071('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2afa91,_0x27405a){utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x2afa91[_0x3071('0x3')],_0x2afa91[_0x3071('0x4')],_0x2afa91[_0x3071('0x5')],_0x2afa91[_0x3071('0x6')],_0x2afa91[_0x3071('0x7')],_0x2afa91[_0x3071('0x8')],_0x2afa91[_0x3071('0x9')],_0x2afa91[_0x3071('0xa')]));if(_0x2afa91[_0x3071('0x5')]){utils[_0x3071('0xb')](_0x2afa91[_0x3071('0x5')])[_0x3071('0xc')](function(_0x1a868e){if(_0x1a868e){_0x2afa91['type']=_0x1a868e[_0x3071('0xd')];_0x2afa91[_0x3071('0xe')]=_0x2afa91[_0x3071('0xf')]?_0x1a868e[_0x3071('0x10')]:![];_0x2afa91[_0x3071('0x11')]=_0x2afa91['agentacw']?_0x1a868e[_0x3071('0x12')]:0x0;}utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);});}else{utils[_0x3071('0x13')](_0x3071('0x14'),_0x2afa91);}if(_0x27405a){delete transfers[_0x2afa91['uniqueid']];}else{delete agents[_0x2afa91['destuniqueid']];}}exports[_0x3071('0x15')]=function(_0x5dc13b){try{utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][agentcalled]',_0x5dc13b[_0x3071('0x3')]),_0x5dc13b);agents[_0x5dc13b['destuniqueid']]=_0x5dc13b;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x18')]=utils[_0x3071('0x19')]();agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x1a');agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x9')]=null;agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x1b')]=null;utils['info'](util[_0x3071('0x2')](_0x3071('0x1c'),_0x5dc13b[_0x3071('0x3')],agents[_0x5dc13b[_0x3071('0x17')]][_0x3071('0x6')],_0x5dc13b[_0x3071('0x17')]));}catch(_0x105bbb){utils[_0x3071('0x1d')](util['format'](_0x3071('0x1e'),_0x5dc13b[_0x3071('0x3')]),_0x105bbb);}};exports[_0x3071('0x1f')]=function(_0x56c267){try{if(!_[_0x3071('0x20')](agents[_0x56c267['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x56c267);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x22'),_0x56c267[_0x3071('0x3')],agents[_0x56c267['destuniqueid']]['membername'],_0x56c267[_0x3071('0x17')]));agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x1f')]=!![];agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x23')]=utils[_0x3071('0x19')]();agents[_0x56c267[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x24');agents[_0x56c267['destuniqueid']][_0x3071('0x25')]=_0x3071('0x24');agents[_0x56c267[_0x3071('0x17')]]['holdtime']=_0x56c267[_0x3071('0x26')]?parseInt(_0x56c267[_0x3071('0x26')])/0x3e8:0x0;agents[_0x56c267[_0x3071('0x17')]][_0x3071('0x27')]=0x0;unanswered[_0x3071('0x28')](_0x56c267[_0x3071('0x17')]);}}catch(_0x177b5f){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x21'),_0x56c267[_0x3071('0x3')]),_0x177b5f);}};exports['queuecallerabandon']=function(_0x4f1484){try{_[_0x3071('0x29')](agents,function(_0x149e0d,_0x6ddf96){if(_0x149e0d[_0x3071('0x3')]==_0x4f1484[_0x3071('0x3')]&&!_[_0x3071('0x2a')](unanswered,_0x149e0d[_0x3071('0x17')])){utils[_0x3071('0x16')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484['uniqueid']),_0x4f1484);utils[_0x3071('0x1')](util[_0x3071('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x4f1484[_0x3071('0x3')],_0x149e0d[_0x3071('0x6')],_0x149e0d[_0x3071('0x17')]));_0x149e0d[_0x3071('0x1f')]=!![];_0x149e0d['agentringnoanswerAt']=utils[_0x3071('0x19')]();_0x149e0d[_0x3071('0xa')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x25')]=_0x3071('0x2b');_0x149e0d[_0x3071('0x2c')]=_0x4f1484[_0x3071('0x2c')];_0x149e0d[_0x3071('0x27')]=0x0;writeDB(_0x149e0d);}});}catch(_0x596cc3){utils[_0x3071('0x1d')](util['format']('[%s][agents][queuecallerabandon]',_0x4f1484[_0x3071('0x3')]),_0x596cc3);}};exports[_0x3071('0x2d')]=function(_0x54d9c3){try{if(agents[_0x54d9c3[_0x3071('0x17')]]){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x54d9c3);utils[_0x3071('0x1')](util['format'](_0x3071('0x2f'),_0x54d9c3[_0x3071('0x3')],agents[_0x54d9c3['destuniqueid']][_0x3071('0x6')],_0x54d9c3['destuniqueid']));agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0x30')]=utils['now']();agents[_0x54d9c3['destuniqueid']][_0x3071('0x9')]=_0x54d9c3[_0x3071('0x9')];agents[_0x54d9c3[_0x3071('0x17')]]['connectedlinename']=_0x54d9c3[_0x3071('0x1b')];agents[_0x54d9c3['destuniqueid']][_0x3071('0x2c')]=_0x54d9c3['ringtime'];agents[_0x54d9c3[_0x3071('0x17')]][_0x3071('0xa')]=_0x3071('0x31');_[_0x3071('0x29')](agents,function(_0x30ab68,_0x593c9c){if(_0x30ab68['destuniqueid']!=_0x54d9c3[_0x3071('0x17')]&&_0x30ab68[_0x3071('0x3')]==_0x54d9c3[_0x3071('0x3')]){_0x30ab68[_0x3071('0x27')]=0x0;_0x30ab68['holdtime']=_0x54d9c3[_0x3071('0x26')];_0x30ab68[_0x3071('0x1f')]=!![];_0x30ab68[_0x3071('0x23')]=utils[_0x3071('0x19')]();_0x30ab68[_0x3071('0xa')]=_0x3071('0x32');_0x30ab68['reason']=_0x3071('0x32');_0x30ab68['answeredelsewheredestinationuniqueid']=_0x54d9c3['destuniqueid'];_0x30ab68['answeredelsewheremembername']=_0x54d9c3['membername'];writeDB(_0x30ab68);}});}}catch(_0x2992e6){utils[_0x3071('0x1d')](util[_0x3071('0x2')](_0x3071('0x2e'),_0x54d9c3[_0x3071('0x3')]),_0x2992e6);}};exports[_0x3071('0xf')]=function(_0xa711b5){try{if(!_[_0x3071('0x20')](agents[_0xa711b5['destuniqueid']])){utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x33'),_0xa711b5[_0x3071('0x3')]),_0xa711b5);utils[_0x3071('0x1')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xa711b5[_0x3071('0x3')],agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x6')],_0xa711b5[_0x3071('0x17')]));agents[_0xa711b5[_0x3071('0x17')]]['agentcomplete']=!![];agents[_0xa711b5[_0x3071('0x17')]]['agentcompleteAt']=utils[_0x3071('0x19')]();agents[_0xa711b5['destuniqueid']]['talktime']=utils[_0x3071('0x34')](agents[_0xa711b5['destuniqueid']][_0x3071('0x35')],agents[_0xa711b5['destuniqueid']][_0x3071('0x30')]);agents[_0xa711b5[_0x3071('0x17')]][_0x3071('0x25')]=_0xa711b5[_0x3071('0x25')];agents[_0xa711b5['destuniqueid']][_0x3071('0xa')]='complete';writeDB(agents[_0xa711b5[_0x3071('0x17')]]);}}catch(_0x4b6bbb){utils[_0x3071('0x1d')](util[_0x3071('0x2')]('[%s][agents][agentcomplete]',_0xa711b5[_0x3071('0x3')]),_0x4b6bbb);}};exports[_0x3071('0x36')]=function(_0x224a70){try{if(!_[_0x3071('0x20')](agents[_0x224a70[_0x3071('0x37')]])){utils[_0x3071('0x16')](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x224a70);utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x38'),_0x224a70['uniqueid'],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x6')],agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')]));agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x39')]=!![];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3a')]=_0x3071('0x3b');agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3c')]=_0x224a70[_0x3071('0x3d')];agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3e')]=agents[_0x224a70[_0x3071('0x37')]][_0x3071('0x3')];}}catch(_0x596cdd){utils['error'](util[_0x3071('0x2')]('[%s][agents][blindtransfer]',_0x224a70[_0x3071('0x3')]),_0x596cdd);}};exports[_0x3071('0x3f')]=function(_0x15c6f8){try{utils['debug'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x15c6f8);if(_0x15c6f8['origtransfereruniqueid']==_0x15c6f8[_0x3071('0x41')]){if(!_[_0x3071('0x20')](agents[_0x15c6f8[_0x3071('0x42')]])){utils[_0x3071('0x1')](util['format'](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x42')]]['transfer']=!![];agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3a')]=_0x3071('0x45');agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x46')];agents[_0x15c6f8[_0x3071('0x42')]]['transferuniqueid']=_0x15c6f8['origtransfereruniqueid'];}if(_0x15c6f8[_0x3071('0x47')]&&agents[_0x15c6f8['transfereeuniqueid']]){agents[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x1;transfers[_0x15c6f8['transfereeuniqueid']]=_[_0x3071('0x49')](agents[_0x15c6f8[_0x3071('0x47')]]);transfers[_0x15c6f8['transfereeuniqueid']][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x42')]][_0x3071('0x8')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x4a')]=agents[_0x15c6f8['secondtransfereruniqueid']][_0x3071('0x4a')];transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x18')]=utils['now']();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x47')]][_0x3071('0x48')]=0x2;}}else if(_0x15c6f8[_0x3071('0x42')]==_0x15c6f8[_0x3071('0x4b')]){if(!_['isNil'](agents[_0x15c6f8[_0x3071('0x44')]])){utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x43'),_0x15c6f8[_0x3071('0x44')],agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x6')]));agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x39')]=!![];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3a')]='ATTENDED';agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3c')]=_0x15c6f8[_0x3071('0x4c')];agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x3e')]=_0x15c6f8[_0x3071('0x42')];}if(_0x15c6f8[_0x3071('0x4d')]&&agents[_0x15c6f8[_0x3071('0x4d')]]){agents[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x48')]=0x1;transfers[_0x15c6f8[_0x3071('0x4d')]]=_['clone'](agents[_0x15c6f8['transfertargetuniqueid']]);transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x8')]=agents[_0x15c6f8[_0x3071('0x44')]][_0x3071('0x8')];transfers[_0x15c6f8['transfertargetuniqueid']]['calleridname']=agents[_0x15c6f8[_0x3071('0x44')]]['calleridname'];transfers[_0x15c6f8['transfertargetuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x30')]=utils[_0x3071('0x19')]();transfers[_0x15c6f8['transfertargetuniqueid']][_0x3071('0x2c')]=0x0;transfers[_0x15c6f8[_0x3071('0x4d')]][_0x3071('0x48')]=0x2;}}}catch(_0x19a03d){utils['error'](util[_0x3071('0x2')](_0x3071('0x40'),_0x15c6f8['origtransfereruniqueid']),_0x19a03d);}};exports[_0x3071('0x4e')]=function(_0x29ee70){try{utils[_0x3071('0x16')](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70[_0x3071('0x3')]),_0x29ee70);if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']]['reason']===_0x3071('0x24')){if(_0x29ee70[_0x3071('0x50')]==='21'){agents[_0x29ee70[_0x3071('0x3')]]['reason']='rejected';agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x51');}utils[_0x3071('0x1')](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]]['membername'],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);var _0x2fbac7=unanswered[_0x3071('0x53')](_0x29ee70[_0x3071('0x3')]);if(_0x2fbac7>-0x1){unanswered[_0x3071('0x54')](_0x2fbac7,0x1);}}if(transfers[_0x29ee70[_0x3071('0x3')]]){transfers[_0x29ee70['uniqueid']][_0x3071('0xf')]=!![];transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils['now']();transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](transfers[_0x29ee70['uniqueid']]['agentcompleteAt'],transfers[_0x29ee70[_0x3071('0x3')]]['agentconnectAt']);transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')]=_0x3071('0x55');transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]=_0x3071('0x56');utils[_0x3071('0x1')](util['format'](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0x25')],transfers[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(transfers[_0x29ee70['uniqueid']],!![]);}if(agents[_0x29ee70[_0x3071('0x3')]]&&agents[_0x29ee70['uniqueid']][_0x3071('0x30')]){agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xf')]=!![];agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x35')]=utils[_0x3071('0x19')]();agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x27')]=utils[_0x3071('0x34')](agents[_0x29ee70[_0x3071('0x3')]]['agentcompleteAt'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x30')]);agents[_0x29ee70['uniqueid']][_0x3071('0x25')]=agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x39')]?_0x3071('0x39'):_0x3071('0x55');agents[_0x29ee70['uniqueid']]['lastevent']=_0x3071('0x56');utils['info'](util[_0x3071('0x2')](_0x3071('0x52'),_0x29ee70[_0x3071('0x3')],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0x6')],agents[_0x29ee70[_0x3071('0x3')]]['reason'],agents[_0x29ee70[_0x3071('0x3')]][_0x3071('0xa')]));writeDB(agents[_0x29ee70[_0x3071('0x3')]]);}}catch(_0x291bb9){utils['error'](util[_0x3071('0x2')](_0x3071('0x4f'),_0x29ee70['uniqueid']),_0x291bb9);}}; \ No newline at end of file +var _0xd4f4=['holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','transferexten','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','error','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','membername','agentringnoanswer','agentringnoanswerAt','reason','timeout'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x2f91ae,_0x50fa42){_0x2f91ae=_0x2f91ae-0x0;var _0x216713=_0xd4f4[_0x2f91ae];return _0x216713;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var utils=require(_0x4d4f('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3c9311,_0x2fc384){utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x5'),_0x3c9311[_0x4d4f('0x6')],_0x3c9311[_0x4d4f('0x7')],_0x3c9311[_0x4d4f('0x8')],_0x3c9311['membername'],_0x3c9311['interface'],_0x3c9311['calleridnum'],_0x3c9311[_0x4d4f('0x9')],_0x3c9311[_0x4d4f('0xa')]));if(_0x3c9311[_0x4d4f('0x8')]){utils[_0x4d4f('0xb')](_0x3c9311[_0x4d4f('0x8')])[_0x4d4f('0xc')](function(_0x1bd887){if(_0x1bd887){_0x3c9311[_0x4d4f('0xd')]=_0x1bd887[_0x4d4f('0xd')];_0x3c9311[_0x4d4f('0xe')]=_0x3c9311[_0x4d4f('0xf')]?_0x1bd887[_0x4d4f('0x10')]:![];_0x3c9311[_0x4d4f('0x11')]=_0x3c9311[_0x4d4f('0xe')]?_0x1bd887[_0x4d4f('0x12')]:0x0;}utils[_0x4d4f('0x13')](_0x4d4f('0x14'),_0x3c9311);});}else{utils[_0x4d4f('0x13')]('CreateVoiceAgentReport',_0x3c9311);}if(_0x2fc384){delete transfers[_0x3c9311['uniqueid']];}else{delete agents[_0x3c9311['destuniqueid']];}}exports[_0x4d4f('0x15')]=function(_0xe9b7a6){try{utils['debug'](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6[_0x4d4f('0x6')]),_0xe9b7a6);agents[_0xe9b7a6['destuniqueid']]=_0xe9b7a6;agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();agents[_0xe9b7a6['destuniqueid']][_0x4d4f('0xa')]='called';agents[_0xe9b7a6[_0x4d4f('0x17')]][_0x4d4f('0x9')]=null;agents[_0xe9b7a6[_0x4d4f('0x17')]]['connectedlinename']=null;utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe9b7a6['uniqueid'],agents[_0xe9b7a6['destuniqueid']]['membername'],_0xe9b7a6['destuniqueid']));}catch(_0x34429e){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x16'),_0xe9b7a6['uniqueid']),_0x34429e);}};exports['agentringnoanswer']=function(_0x1e1ae2){try{if(!_['isNil'](agents[_0x1e1ae2[_0x4d4f('0x17')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2[_0x4d4f('0x6')]),_0x1e1ae2);utils['info'](util['format'](_0x4d4f('0x1d'),_0x1e1ae2['uniqueid'],agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x1e1ae2[_0x4d4f('0x17')]));agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x1f')]=!![];agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0xa')]='timeout';agents[_0x1e1ae2['destuniqueid']][_0x4d4f('0x21')]=_0x4d4f('0x22');agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x1e1ae2['ringtime']?parseInt(_0x1e1ae2[_0x4d4f('0x24')])/0x3e8:0x0;agents[_0x1e1ae2[_0x4d4f('0x17')]][_0x4d4f('0x25')]=0x0;unanswered[_0x4d4f('0x26')](_0x1e1ae2['destuniqueid']);}}catch(_0x338ba2){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x1c'),_0x1e1ae2['uniqueid']),_0x338ba2);}};exports[_0x4d4f('0x27')]=function(_0x123383){try{_[_0x4d4f('0x28')](agents,function(_0x3d7f14,_0x19a502){if(_0x3d7f14[_0x4d4f('0x6')]==_0x123383['uniqueid']&&!_[_0x4d4f('0x29')](unanswered,_0x3d7f14[_0x4d4f('0x17')])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383['uniqueid']),_0x123383);utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x2b'),_0x123383['uniqueid'],_0x3d7f14['membername'],_0x3d7f14['destuniqueid']));_0x3d7f14[_0x4d4f('0x1f')]=!![];_0x3d7f14['agentringnoanswerAt']=utils[_0x4d4f('0x19')]();_0x3d7f14[_0x4d4f('0xa')]=_0x4d4f('0x2c');_0x3d7f14['reason']=_0x4d4f('0x2c');_0x3d7f14[_0x4d4f('0x23')]=_0x123383[_0x4d4f('0x23')];_0x3d7f14['talktime']=0x0;writeDB(_0x3d7f14);}});}catch(_0x6a30c4){utils['error'](util[_0x4d4f('0x4')](_0x4d4f('0x2a'),_0x123383[_0x4d4f('0x6')]),_0x6a30c4);}};exports[_0x4d4f('0x2d')]=function(_0x2448f3){try{if(agents[_0x2448f3[_0x4d4f('0x17')]]){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3['uniqueid']),_0x2448f3);utils[_0x4d4f('0x3')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2448f3[_0x4d4f('0x6')],agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x1e')],_0x2448f3[_0x4d4f('0x17')]));agents[_0x2448f3[_0x4d4f('0x17')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();agents[_0x2448f3[_0x4d4f('0x17')]]['connectedlinenum']=_0x2448f3[_0x4d4f('0x9')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x2e')]=_0x2448f3[_0x4d4f('0x2e')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0x23')]=_0x2448f3[_0x4d4f('0x24')];agents[_0x2448f3[_0x4d4f('0x17')]][_0x4d4f('0xa')]='connect';_['forIn'](agents,function(_0x1cb919,_0x324a3c){if(_0x1cb919[_0x4d4f('0x17')]!=_0x2448f3[_0x4d4f('0x17')]&&_0x1cb919['uniqueid']==_0x2448f3['uniqueid']){_0x1cb919[_0x4d4f('0x25')]=0x0;_0x1cb919[_0x4d4f('0x23')]=_0x2448f3['ringtime'];_0x1cb919['agentringnoanswer']=!![];_0x1cb919[_0x4d4f('0x20')]=utils[_0x4d4f('0x19')]();_0x1cb919['lastevent']=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x21')]=_0x4d4f('0x2f');_0x1cb919[_0x4d4f('0x30')]=_0x2448f3[_0x4d4f('0x17')];_0x1cb919['answeredelsewheremembername']=_0x2448f3[_0x4d4f('0x1e')];writeDB(_0x1cb919);}});}}catch(_0x4c7c24){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')]('[%s][agents][agentconnect]',_0x2448f3[_0x4d4f('0x6')]),_0x4c7c24);}};exports[_0x4d4f('0xf')]=function(_0x1f7169){try{if(!_['isNil'](agents[_0x1f7169[_0x4d4f('0x17')]])){utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][agentcomplete]',_0x1f7169[_0x4d4f('0x6')]),_0x1f7169);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x31'),_0x1f7169[_0x4d4f('0x6')],agents[_0x1f7169['destuniqueid']]['membername'],_0x1f7169[_0x4d4f('0x17')]));agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xf')]=!![];agents[_0x1f7169[_0x4d4f('0x17')]]['agentcompleteAt']=utils['now']();agents[_0x1f7169['destuniqueid']][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x33')],agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x34')]);agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0x21')]=_0x1f7169[_0x4d4f('0x21')];agents[_0x1f7169[_0x4d4f('0x17')]][_0x4d4f('0xa')]=_0x4d4f('0x35');writeDB(agents[_0x1f7169['destuniqueid']]);}}catch(_0xb0937d){utils[_0x4d4f('0x1a')](util['format'](_0x4d4f('0x36'),_0x1f7169['uniqueid']),_0xb0937d);}};exports[_0x4d4f('0x37')]=function(_0x401466){try{if(!_['isNil'](agents[_0x401466[_0x4d4f('0x38')]])){utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x401466);utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x3a'),_0x401466[_0x4d4f('0x6')],agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x1e')],agents[_0x401466[_0x4d4f('0x38')]]['uniqueid']));agents[_0x401466[_0x4d4f('0x38')]]['transfer']=!![];agents[_0x401466['transfereruniqueid']]['transfertype']=_0x4d4f('0x3b');agents[_0x401466[_0x4d4f('0x38')]]['transferexten']=_0x401466['extension'];agents[_0x401466[_0x4d4f('0x38')]][_0x4d4f('0x3c')]=agents[_0x401466['transfereruniqueid']][_0x4d4f('0x6')];}}catch(_0x528573){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x39'),_0x401466[_0x4d4f('0x6')]),_0x528573);}};exports['attendedtransfer']=function(_0x224b83){try{utils[_0x4d4f('0x1b')](util[_0x4d4f('0x4')](_0x4d4f('0x3d'),_0x224b83[_0x4d4f('0x3e')]),_0x224b83);if(_0x224b83['origtransfereruniqueid']==_0x224b83[_0x4d4f('0x3f')]){if(!_['isNil'](agents[_0x224b83[_0x4d4f('0x40')]])){utils['info'](util[_0x4d4f('0x4')](_0x4d4f('0x41'),_0x224b83['origtransfereruniqueid'],agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x1e')]));agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x42')]=!![];agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x43')]='ATTENDED';agents[_0x224b83['secondtransfereruniqueid']][_0x4d4f('0x44')]=_0x224b83[_0x4d4f('0x45')];agents[_0x224b83[_0x4d4f('0x40')]][_0x4d4f('0x3c')]=_0x224b83[_0x4d4f('0x3e')];}if(_0x224b83['transfereeuniqueid']&&agents[_0x224b83['transfereeuniqueid']]){agents[_0x224b83[_0x4d4f('0x46')]]['agententerreason']=0x1;transfers[_0x224b83[_0x4d4f('0x46')]]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x46')]]);transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridnum'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x49')]=agents[_0x224b83[_0x4d4f('0x40')]]['calleridname'];transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83['transfereeuniqueid']][_0x4d4f('0x34')]=utils['now']();transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x46')]][_0x4d4f('0x4a')]=0x2;}}else if(_0x224b83[_0x4d4f('0x40')]==_0x224b83[_0x4d4f('0x4b')]){if(!_[_0x4d4f('0x4c')](agents[_0x224b83[_0x4d4f('0x3e')]])){utils[_0x4d4f('0x3')](util['format'](_0x4d4f('0x41'),_0x224b83[_0x4d4f('0x3e')],agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x1e')]));agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x42')]=!![];agents[_0x224b83[_0x4d4f('0x3e')]]['transfertype']=_0x4d4f('0x4d');agents[_0x224b83[_0x4d4f('0x3e')]]['transferexten']=_0x224b83['secondtransfererexten'];agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x3c')]=_0x224b83['secondtransfereruniqueid'];}if(_0x224b83['transfertargetuniqueid']&&agents[_0x224b83['transfertargetuniqueid']]){agents[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x4a')]=0x1;transfers[_0x224b83['transfertargetuniqueid']]=_[_0x4d4f('0x47')](agents[_0x224b83[_0x4d4f('0x4e')]]);transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x48')]=agents[_0x224b83[_0x4d4f('0x3e')]][_0x4d4f('0x48')];transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x49')]=agents[_0x224b83['origtransfereruniqueid']][_0x4d4f('0x49')];transfers[_0x224b83['transfertargetuniqueid']][_0x4d4f('0x18')]=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]]['agentconnectAt']=utils[_0x4d4f('0x19')]();transfers[_0x224b83[_0x4d4f('0x4e')]][_0x4d4f('0x23')]=0x0;transfers[_0x224b83[_0x4d4f('0x4e')]]['agententerreason']=0x2;}}}catch(_0x4184fa){utils['error'](util[_0x4d4f('0x4')]('[%s][agents][attendedtransfer]',_0x224b83['origtransfereruniqueid']),_0x4184fa);}};exports[_0x4d4f('0x4f')]=function(_0x2d99e4){try{utils['debug'](util[_0x4d4f('0x4')]('[%s][agents][hangup]',_0x2d99e4[_0x4d4f('0x6')]),_0x2d99e4);if(agents[_0x2d99e4[_0x4d4f('0x6')]]&&agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]==='timeout'){if(_0x2d99e4[_0x4d4f('0x50')]==='21'){agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')]='rejected';agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x51');}utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4['uniqueid'],agents[_0x2d99e4['uniqueid']][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]]['reason'],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);var _0x133fc5=unanswered[_0x4d4f('0x53')](_0x2d99e4[_0x4d4f('0x6')]);if(_0x133fc5>-0x1){unanswered[_0x4d4f('0x54')](_0x133fc5,0x1);}}if(transfers[_0x2d99e4[_0x4d4f('0x6')]]){transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xf')]=!![];transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils['diffTime'](transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x34')]);transfers[_0x2d99e4['uniqueid']]['reason']=_0x4d4f('0x55');transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]=_0x4d4f('0x35');utils[_0x4d4f('0x3')](util[_0x4d4f('0x4')](_0x4d4f('0x52'),_0x2d99e4[_0x4d4f('0x6')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],transfers[_0x2d99e4['uniqueid']][_0x4d4f('0x21')],transfers[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0xa')]));writeDB(transfers[_0x2d99e4[_0x4d4f('0x6')]],!![]);}if(agents[_0x2d99e4['uniqueid']]&&agents[_0x2d99e4['uniqueid']]['agentconnectAt']){agents[_0x2d99e4[_0x4d4f('0x6')]]['agentcomplete']=!![];agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')]=utils[_0x4d4f('0x19')]();agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x25')]=utils[_0x4d4f('0x32')](agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x33')],agents[_0x2d99e4['uniqueid']]['agentconnectAt']);agents[_0x2d99e4[_0x4d4f('0x6')]]['reason']=agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x42')]?_0x4d4f('0x42'):'agent';agents[_0x2d99e4['uniqueid']]['lastevent']=_0x4d4f('0x35');utils['info'](util[_0x4d4f('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2d99e4[_0x4d4f('0x6')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x1e')],agents[_0x2d99e4[_0x4d4f('0x6')]][_0x4d4f('0x21')],agents[_0x2d99e4[_0x4d4f('0x6')]]['lastevent']));writeDB(agents[_0x2d99e4[_0x4d4f('0x6')]]);}}catch(_0x3beacf){utils[_0x4d4f('0x1a')](util[_0x4d4f('0x4')](_0x4d4f('0x56'),_0x2d99e4['uniqueid']),_0x3beacf);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index fdb2533..3a73145 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c7a=['context','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','callerid','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','ANSWERED','BUSY','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','lastevent','getUserByInternal','then','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','accountcode'];(function(_0x50bd8d,_0xa2cb7b){var _0x260560=function(_0x4d5c88){while(--_0x4d5c88){_0x50bd8d['push'](_0x50bd8d['shift']());}};_0x260560(++_0xa2cb7b);}(_0x8c7a,0x197));var _0xa8c7=function(_0x2d949c,_0x491476){_0x2d949c=_0x2d949c-0x0;var _0x9d19e1=_0x8c7a[_0x2d949c];return _0x9d19e1;};'use strict';var _=require(_0xa8c7('0x0'));var util=require(_0xa8c7('0x1'));var utils=require(_0xa8c7('0x2'));var transfers=require(_0xa8c7('0x3'));var dispositions=[_0xa8c7('0x4'),'FAILED','FAILED','NO\x20ANSWER',_0xa8c7('0x4'),_0xa8c7('0x4'),_0xa8c7('0x5'),_0xa8c7('0x6'),'FAILED',_0xa8c7('0x7'),_0xa8c7('0x7')];var channels={};function writeDB(_0x1ecf2d){var _0x13b3dd;if(transfers[_0xa8c7('0x8')][_0x1ecf2d['uniqueid']]){_0x13b3dd=_0x1ecf2d[_0xa8c7('0x9')];_0x1ecf2d[_0xa8c7('0x9')]=transfers[_0xa8c7('0x8')][_0x1ecf2d[_0xa8c7('0x9')]][_0xa8c7('0xa')];}utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0xd'),_0x1ecf2d[_0xa8c7('0x9')],_0x1ecf2d[_0xa8c7('0xe')],_0x1ecf2d[_0xa8c7('0xf')],_0x1ecf2d[_0xa8c7('0x10')],_0x1ecf2d['interface'],_0x1ecf2d[_0xa8c7('0x11')],_0x1ecf2d['connectedlinenum'],_0x1ecf2d[_0xa8c7('0x12')]));if(_0x1ecf2d['accountcode']){utils[_0xa8c7('0x13')](_0x1ecf2d['accountcode'])[_0xa8c7('0x14')](function(_0x552ef6){if(_0x552ef6){_0x1ecf2d['UserId']=_0x552ef6['id'];}utils['request']('CreateVoiceCallReport',_0x1ecf2d);});}else{utils[_0xa8c7('0x15')](_0xa8c7('0x16'),_0x1ecf2d);}if(channels[_0x1ecf2d[_0xa8c7('0x9')]]){delete channels[_0x1ecf2d[_0xa8c7('0x9')]];}else if(_0x13b3dd&&channels[_0x13b3dd]){if(!transfers[_0xa8c7('0x8')][_0x13b3dd]['recording'])delete transfers[_0xa8c7('0x8')][_0x13b3dd];delete channels[_0x13b3dd];}}exports['newchannel']=function(_0x5f30e2){try{utils[_0xa8c7('0x17')](util['format'](_0xa8c7('0x18'),_0x5f30e2['uniqueid']),_0x5f30e2);if(_0x5f30e2[_0xa8c7('0x9')]==_0x5f30e2[_0xa8c7('0x19')]&&_0x5f30e2[_0xa8c7('0xe')]!=_0xa8c7('0x1a')){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x1b'),_0x5f30e2['uniqueid'],_0x5f30e2['context'],_0x5f30e2['exten']));channels[_0x5f30e2[_0xa8c7('0x9')]]={'uniqueid':_0x5f30e2[_0xa8c7('0x9')],'accountcode':_0x5f30e2[_0xa8c7('0x1c')],'source':_0x5f30e2['calleridnum'],'destination':_0x5f30e2['exten'],'destinationcontext':_0x5f30e2[_0xa8c7('0x1d')],'channel':_0x5f30e2['channel'],'starttime':utils[_0xa8c7('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa8c7('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x551ddc){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x18'),_0x5f30e2[_0xa8c7('0x9')]),_0x551ddc);}};exports[_0xa8c7('0x20')]=function(_0x37bf0c){try{utils['debug'](util[_0xa8c7('0xc')](_0xa8c7('0x21'),_0x37bf0c[_0xa8c7('0x9')]),_0x37bf0c);if(!_[_0xa8c7('0x22')](channels[_0x37bf0c[_0xa8c7('0x9')]])&&_0x37bf0c[_0xa8c7('0x23')]==0x6){utils[_0xa8c7('0xb')](util['format'](_0xa8c7('0x24'),_0x37bf0c[_0xa8c7('0x9')],_0x37bf0c[_0xa8c7('0x1d')],_0x37bf0c[_0xa8c7('0xe')]));if(_[_0xa8c7('0x22')](channels[_0x37bf0c['uniqueid']][_0xa8c7('0x25')])){channels[_0x37bf0c['uniqueid']][_0xa8c7('0x25')]=utils[_0xa8c7('0x1e')]();}}else if(!_['isNil'](channels[_0x37bf0c[_0xa8c7('0x19')]])&&_0x37bf0c['channelstate']==0x6&&_0x37bf0c[_0xa8c7('0x1d')]!=_0xa8c7('0x26')){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x27'),_0x37bf0c[_0xa8c7('0x9')],_0x37bf0c['linkedid'],_0x37bf0c[_0xa8c7('0x1d')],_0x37bf0c[_0xa8c7('0xe')]));channels[_0x37bf0c['linkedid']][_0xa8c7('0x1c')]=_0x37bf0c['accountcode'];channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x28')]=_0x37bf0c[_0xa8c7('0xe')];if(_[_0xa8c7('0x22')](channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x29')])){channels[_0x37bf0c[_0xa8c7('0x19')]]['answertime']=utils[_0xa8c7('0x1e')]();}channels[_0x37bf0c[_0xa8c7('0x19')]][_0xa8c7('0x2a')]=dispositions[_[_0xa8c7('0x2b')](_0x37bf0c[_0xa8c7('0x23')])]||_0xa8c7('0x5');}}catch(_0x4cecdf){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')](_0xa8c7('0x21'),_0x37bf0c[_0xa8c7('0x9')]),_0x4cecdf);}};exports[_0xa8c7('0x2c')]=function(_0x472d37){try{if(!_['isNil'](channels[_0x472d37[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')]('[%s][calls][hangup]',_0x472d37['uniqueid']),_0x472d37);if(_[_0xa8c7('0x22')](channels[_0x472d37[_0xa8c7('0x9')]]['callerid'])){channels[_0x472d37[_0xa8c7('0x9')]]['callerid']=_0x472d37[_0xa8c7('0x2d')]+'\x20<'+_0x472d37[_0xa8c7('0x11')]+'>';}utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x2e'),_0x472d37['uniqueid'],channels[_0x472d37[_0xa8c7('0x9')]]['callerid'],_0x472d37[_0xa8c7('0x2f')]));channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x30')]=utils['now']();channels[_0x472d37['uniqueid']][_0xa8c7('0x31')]=utils[_0xa8c7('0x32')](channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x30')],channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x33')]);channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x34')]=channels[_0x472d37[_0xa8c7('0x9')]][_0xa8c7('0x29')]?utils['diffTime'](channels[_0x472d37[_0xa8c7('0x9')]]['endtime'],channels[_0x472d37[_0xa8c7('0x9')]]['answertime']):0x0;writeDB(channels[_0x472d37[_0xa8c7('0x9')]]);}}catch(_0x1cb780){utils['error'](util['format']('[%s][calls][hangup]',_0x472d37['uniqueid']),_0x1cb780);}};exports[_0xa8c7('0x35')]=function(_0x2b4a85){try{if(!_[_0xa8c7('0x22')](channels[_0x2b4a85[_0xa8c7('0x36')]])){utils['debug'](util[_0xa8c7('0xc')]('[%s][calls][attendedtransfer]',_0x2b4a85[_0xa8c7('0x37')]),_0x2b4a85);if(channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0xe')]==_0x2b4a85[_0xa8c7('0x38')]){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x39'),_0x2b4a85[_0xa8c7('0x37')],_0x2b4a85[_0xa8c7('0x36')],_0x2b4a85[_0xa8c7('0x3a')]));channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0x28')]=_0x2b4a85[_0xa8c7('0x3a')];channels[_0x2b4a85[_0xa8c7('0x36')]][_0xa8c7('0x3b')]=_0xa8c7('0x3c');}else if(channels[_0x2b4a85[_0xa8c7('0x36')]][_0xa8c7('0xe')]=_0x2b4a85[_0xa8c7('0x3d')]){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x39'),_0x2b4a85[_0xa8c7('0x37')],_0x2b4a85[_0xa8c7('0x36')],_0x2b4a85[_0xa8c7('0x3e')]));channels[_0x2b4a85['localtwolinkedid']][_0xa8c7('0x28')]=_0x2b4a85[_0xa8c7('0x3e')];channels[_0x2b4a85[_0xa8c7('0x36')]]['userfield']=_0xa8c7('0x3c');}}}catch(_0x1bbb13){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x3f'),_0x2b4a85[_0xa8c7('0x37')]),_0x1bbb13);}};exports['musiconholdstart']=function(_0xafe5d4){try{if(!_[_0xa8c7('0x22')](channels[_0xafe5d4[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util['format'](_0xa8c7('0x40'),_0xafe5d4[_0xa8c7('0x9')]),_0xafe5d4);channels[_0xafe5d4[_0xa8c7('0x9')]][_0xa8c7('0x41')]=utils[_0xa8c7('0x1e')]();utils['info'](util['format'](_0xa8c7('0x42'),_0xafe5d4[_0xa8c7('0x9')],channels[_0xafe5d4[_0xa8c7('0x9')]]['musiconholdstartAt']));}}catch(_0x432c72){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')]('[%s][calls][musiconholdstart]',_0xafe5d4[_0xa8c7('0x9')]),_0x432c72);}};exports['musiconholdstop']=function(_0x122bce){try{if(!_['isNil'](channels[_0x122bce[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')]('[%s][calls][musiconholdstop]',_0x122bce[_0xa8c7('0x9')]),_0x122bce);if(!_[_0xa8c7('0x22')](channels[_0x122bce[_0xa8c7('0x9')]]['musiconholdstartAt'])){channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x43')]+=utils[_0xa8c7('0x32')](utils[_0xa8c7('0x1e')](),channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x41')]);utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x44'),_0x122bce[_0xa8c7('0x9')],channels[_0x122bce[_0xa8c7('0x9')]][_0xa8c7('0x43')]));delete channels[_0x122bce[_0xa8c7('0x9')]]['musiconholdstartAt'];}}}catch(_0x2109cc){utils[_0xa8c7('0x1f')](util['format'](_0xa8c7('0x45'),_0x122bce[_0xa8c7('0x9')]),_0x2109cc);}};exports[_0xa8c7('0x46')]=function(_0x2e252d){try{if(!_[_0xa8c7('0x22')](channels[_0x2e252d[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')](_0xa8c7('0x47'),_0x2e252d[_0xa8c7('0x9')]),_0x2e252d);if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x49')])){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x4a'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d['uniqueid']][_0xa8c7('0x4c')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_['isNil'](_0x2e252d[_0xa8c7('0x48')]['xmd-phone'])){utils['info'](util[_0xa8c7('0xc')](_0xa8c7('0x4d'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d['uniqueid']][_0xa8c7('0x4e')]=_0x2e252d[_0xa8c7('0x4b')];channels[_0x2e252d['uniqueid']][_0xa8c7('0x4f')]='\x22'+_0x2e252d[_0xa8c7('0x4b')]+_0xa8c7('0x50')+_0x2e252d[_0xa8c7('0x4b')]+'>';}if(!_['isNil'](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x51')])||!_[_0xa8c7('0x22')](_0x2e252d['variable'][_0xa8c7('0x52')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2e252d['uniqueid'],!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x51')])?_0xa8c7('0x51'):_0xa8c7('0x52'),_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]]['callerid']=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')]['xmd-queue'])||!_[_0xa8c7('0x22')](_0x2e252d['variable']['xmcs-queue'])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x53'),_0x2e252d[_0xa8c7('0x9')],!_['isNil'](_0x2e252d[_0xa8c7('0x48')]['xmd-queue'])?_0xa8c7('0x54'):_0xa8c7('0x55'),_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x56')]=_0xa8c7('0x57');channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x58')]=_0x2e252d[_0xa8c7('0x4b')];channels[_0x2e252d['uniqueid']][_0xa8c7('0xf')]=!![];}if(!_['isNil'](_0x2e252d['variable'][_0xa8c7('0x59')])){utils['info'](util['format'](_0xa8c7('0x5a'),_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x5b')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x5c')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2e252d[_0xa8c7('0x9')],_0x2e252d['value']));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x5d')]=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')][_0xa8c7('0x5e')])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2e252d[_0xa8c7('0x9')],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]]['routeid']=_0x2e252d[_0xa8c7('0x4b')];}if(!_[_0xa8c7('0x22')](_0x2e252d[_0xa8c7('0x48')]['sipcallid'])){utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')](_0xa8c7('0x5f'),_0x2e252d['uniqueid'],_0x2e252d[_0xa8c7('0x4b')]));channels[_0x2e252d[_0xa8c7('0x9')]][_0xa8c7('0x60')]=_0x2e252d['value'];}}}catch(_0x4cb1e6){utils[_0xa8c7('0x1f')](util[_0xa8c7('0xc')](_0xa8c7('0x47'),_0x2e252d[_0xa8c7('0x9')]),_0x4cb1e6);}};exports[_0xa8c7('0x61')]=function(_0x284d21){try{if(!_[_0xa8c7('0x22')](channels[_0x284d21[_0xa8c7('0x9')]])){utils[_0xa8c7('0x17')](util[_0xa8c7('0xc')](_0xa8c7('0x62'),_0x284d21[_0xa8c7('0x9')]),_0x284d21);utils[_0xa8c7('0xb')](util[_0xa8c7('0xc')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x284d21[_0xa8c7('0x9')],_0x284d21['application'],_0x284d21['appdata']));if(_0x284d21[_0xa8c7('0x63')][_0xa8c7('0x64')]()==_0xa8c7('0x65')&&_[_0xa8c7('0x66')](_0x284d21[_0xa8c7('0x67')][_0xa8c7('0x64')](),'cdr')){var _0x451573=_0x284d21[_0xa8c7('0x67')]['split']('=');var _0x178a02=_0x451573[0x0]['substring'](_0x451573[0x0][_0xa8c7('0x68')]('(')+0x1,_0x451573[0x0][_0xa8c7('0x68')](')'));var _0x1fbc8c=_0x451573[0x1];channels[_0x284d21[_0xa8c7('0x9')]][_0x178a02]=_0x1fbc8c;}if(!_[_0xa8c7('0x69')]([_0xa8c7('0x2c'),_0xa8c7('0x6a'),_0xa8c7('0x6b'),_0xa8c7('0x65'),_0xa8c7('0x6c')],_0x284d21[_0xa8c7('0x63')][_0xa8c7('0x64')]())){channels[_0x284d21[_0xa8c7('0x9')]][_0xa8c7('0x56')]=_0x284d21[_0xa8c7('0x63')];channels[_0x284d21[_0xa8c7('0x9')]][_0xa8c7('0x58')]=_0x284d21[_0xa8c7('0x67')];}}}catch(_0x3ba523){utils['error'](util['format'](_0xa8c7('0x62'),_0x284d21[_0xa8c7('0x9')]),_0x3ba523);}}; \ No newline at end of file +var _0x04cc=['systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','routeid','sipcallid','newexten','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','accountcode','then','UserId','CreateVoiceCallReport','request','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x04cc,0x11a));var _0xc04c=function(_0x6bbb11,_0x44e6b5){_0x6bbb11=_0x6bbb11-0x0;var _0x4c4dc3=_0x04cc[_0x6bbb11];return _0x4c4dc3;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var utils=require(_0xc04c('0x2'));var transfers=require(_0xc04c('0x3'));var dispositions=['NO\x20ANSWER',_0xc04c('0x4'),'FAILED','NO\x20ANSWER',_0xc04c('0x5'),_0xc04c('0x5'),_0xc04c('0x6'),_0xc04c('0x7'),_0xc04c('0x4'),_0xc04c('0x4'),_0xc04c('0x4')];var channels={};function writeDB(_0x5a6076){var _0x422430;if(transfers[_0xc04c('0x8')][_0x5a6076[_0xc04c('0x9')]]){_0x422430=_0x5a6076[_0xc04c('0x9')];_0x5a6076[_0xc04c('0x9')]=transfers[_0xc04c('0x8')][_0x5a6076[_0xc04c('0x9')]][_0xc04c('0xa')];}utils['info'](util['format'](_0xc04c('0xb'),_0x5a6076[_0xc04c('0x9')],_0x5a6076[_0xc04c('0xc')],_0x5a6076[_0xc04c('0xd')],_0x5a6076[_0xc04c('0xe')],_0x5a6076[_0xc04c('0xf')],_0x5a6076[_0xc04c('0x10')],_0x5a6076['connectedlinenum'],_0x5a6076['lastevent']));if(_0x5a6076[_0xc04c('0x11')]){utils['getUserByInternal'](_0x5a6076[_0xc04c('0x11')])[_0xc04c('0x12')](function(_0x27a3f8){if(_0x27a3f8){_0x5a6076[_0xc04c('0x13')]=_0x27a3f8['id'];}utils['request'](_0xc04c('0x14'),_0x5a6076);});}else{utils[_0xc04c('0x15')](_0xc04c('0x14'),_0x5a6076);}if(channels[_0x5a6076[_0xc04c('0x9')]]){delete channels[_0x5a6076['uniqueid']];}else if(_0x422430&&channels[_0x422430]){if(!transfers['blinds'][_0x422430]['recording'])delete transfers[_0xc04c('0x8')][_0x422430];delete channels[_0x422430];}}exports[_0xc04c('0x16')]=function(_0x5b58b5){try{utils[_0xc04c('0x17')](util['format'](_0xc04c('0x18'),_0x5b58b5[_0xc04c('0x9')]),_0x5b58b5);if(_0x5b58b5['uniqueid']==_0x5b58b5[_0xc04c('0x19')]&&_0x5b58b5[_0xc04c('0xc')]!=_0xc04c('0x1a')){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x1d'),_0x5b58b5[_0xc04c('0x9')],_0x5b58b5[_0xc04c('0x1e')],_0x5b58b5[_0xc04c('0x1f')]));channels[_0x5b58b5[_0xc04c('0x9')]]={'uniqueid':_0x5b58b5[_0xc04c('0x9')],'accountcode':_0x5b58b5['accountcode'],'source':_0x5b58b5[_0xc04c('0x10')],'destination':_0x5b58b5[_0xc04c('0x1f')],'destinationcontext':_0x5b58b5[_0xc04c('0x1e')],'channel':_0x5b58b5[_0xc04c('0xc')],'starttime':utils[_0xc04c('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc04c('0x5'),'amaflags':_0xc04c('0x21')};}}catch(_0x244e80){utils[_0xc04c('0x22')](util[_0xc04c('0x1c')]('[%s][calls][newchannel]',_0x5b58b5[_0xc04c('0x9')]),_0x244e80);}};exports['newstate']=function(_0x275d83){try{utils[_0xc04c('0x17')](util[_0xc04c('0x1c')](_0xc04c('0x23'),_0x275d83[_0xc04c('0x9')]),_0x275d83);if(!_['isNil'](channels[_0x275d83[_0xc04c('0x9')]])&&_0x275d83[_0xc04c('0x24')]==0x6){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x25'),_0x275d83['uniqueid'],_0x275d83[_0xc04c('0x1e')],_0x275d83[_0xc04c('0xc')]));if(_[_0xc04c('0x26')](channels[_0x275d83['uniqueid']][_0xc04c('0x27')])){channels[_0x275d83['uniqueid']][_0xc04c('0x27')]=utils[_0xc04c('0x20')]();}}else if(!_[_0xc04c('0x26')](channels[_0x275d83['linkedid']])&&_0x275d83[_0xc04c('0x24')]==0x6&&_0x275d83['context']!=_0xc04c('0x28')){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x29'),_0x275d83[_0xc04c('0x9')],_0x275d83['linkedid'],_0x275d83[_0xc04c('0x1e')],_0x275d83['channel']));channels[_0x275d83[_0xc04c('0x19')]]['accountcode']=_0x275d83['accountcode'];channels[_0x275d83['linkedid']][_0xc04c('0x2a')]=_0x275d83[_0xc04c('0xc')];if(_['isNil'](channels[_0x275d83['linkedid']][_0xc04c('0x2b')])){channels[_0x275d83[_0xc04c('0x19')]][_0xc04c('0x2b')]=utils[_0xc04c('0x20')]();}channels[_0x275d83['linkedid']][_0xc04c('0x2c')]=dispositions[_[_0xc04c('0x2d')](_0x275d83[_0xc04c('0x24')])]||_0xc04c('0x6');}}catch(_0x2a2460){utils[_0xc04c('0x22')](util[_0xc04c('0x1c')](_0xc04c('0x23'),_0x275d83[_0xc04c('0x9')]),_0x2a2460);}};exports['hangup']=function(_0x326330){try{if(!_[_0xc04c('0x26')](channels[_0x326330[_0xc04c('0x9')]])){utils[_0xc04c('0x17')](util[_0xc04c('0x1c')](_0xc04c('0x2e'),_0x326330['uniqueid']),_0x326330);if(_[_0xc04c('0x26')](channels[_0x326330['uniqueid']]['callerid'])){channels[_0x326330['uniqueid']][_0xc04c('0x2f')]=_0x326330[_0xc04c('0x30')]+'\x20<'+_0x326330[_0xc04c('0x10')]+'>';}utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x31'),_0x326330[_0xc04c('0x9')],channels[_0x326330[_0xc04c('0x9')]]['callerid'],_0x326330[_0xc04c('0x32')]));channels[_0x326330[_0xc04c('0x9')]]['endtime']=utils[_0xc04c('0x20')]();channels[_0x326330[_0xc04c('0x9')]][_0xc04c('0x33')]=utils[_0xc04c('0x34')](channels[_0x326330[_0xc04c('0x9')]][_0xc04c('0x35')],channels[_0x326330[_0xc04c('0x9')]][_0xc04c('0x36')]);channels[_0x326330['uniqueid']][_0xc04c('0x37')]=channels[_0x326330['uniqueid']][_0xc04c('0x2b')]?utils[_0xc04c('0x34')](channels[_0x326330[_0xc04c('0x9')]][_0xc04c('0x35')],channels[_0x326330[_0xc04c('0x9')]][_0xc04c('0x2b')]):0x0;writeDB(channels[_0x326330[_0xc04c('0x9')]]);}}catch(_0x598ad7){utils[_0xc04c('0x22')](util[_0xc04c('0x1c')](_0xc04c('0x2e'),_0x326330[_0xc04c('0x9')]),_0x598ad7);}};exports[_0xc04c('0x38')]=function(_0x42eda4){try{if(!_[_0xc04c('0x26')](channels[_0x42eda4[_0xc04c('0x39')]])){utils[_0xc04c('0x17')](util['format'](_0xc04c('0x3a'),_0x42eda4[_0xc04c('0x3b')]),_0x42eda4);if(channels[_0x42eda4['localtwolinkedid']][_0xc04c('0xc')]==_0x42eda4[_0xc04c('0x3c')]){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x3d'),_0x42eda4[_0xc04c('0x3b')],_0x42eda4[_0xc04c('0x39')],_0x42eda4['secondtransfererchannel']));channels[_0x42eda4[_0xc04c('0x39')]][_0xc04c('0x2a')]=_0x42eda4['secondtransfererchannel'];channels[_0x42eda4[_0xc04c('0x39')]][_0xc04c('0x3e')]=_0xc04c('0x3f');}else if(channels[_0x42eda4[_0xc04c('0x39')]]['channel']=_0x42eda4['transfertargetchannel']){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x42eda4[_0xc04c('0x3b')],_0x42eda4[_0xc04c('0x39')],_0x42eda4['origtransfererchannel']));channels[_0x42eda4[_0xc04c('0x39')]][_0xc04c('0x2a')]=_0x42eda4[_0xc04c('0x40')];channels[_0x42eda4[_0xc04c('0x39')]][_0xc04c('0x3e')]='_attended';}}}catch(_0x4ca728){utils[_0xc04c('0x22')](util[_0xc04c('0x1c')](_0xc04c('0x3a'),_0x42eda4[_0xc04c('0x3b')]),_0x4ca728);}};exports[_0xc04c('0x41')]=function(_0x59f313){try{if(!_[_0xc04c('0x26')](channels[_0x59f313[_0xc04c('0x9')]])){utils[_0xc04c('0x17')](util[_0xc04c('0x1c')](_0xc04c('0x42'),_0x59f313['uniqueid']),_0x59f313);channels[_0x59f313[_0xc04c('0x9')]]['musiconholdstartAt']=utils['now']();utils[_0xc04c('0x1b')](util['format'](_0xc04c('0x43'),_0x59f313['uniqueid'],channels[_0x59f313[_0xc04c('0x9')]][_0xc04c('0x44')]));}}catch(_0x593408){utils[_0xc04c('0x22')](util['format'](_0xc04c('0x42'),_0x59f313[_0xc04c('0x9')]),_0x593408);}};exports[_0xc04c('0x45')]=function(_0x2cc72d){try{if(!_[_0xc04c('0x26')](channels[_0x2cc72d[_0xc04c('0x9')]])){utils[_0xc04c('0x17')](util['format'](_0xc04c('0x46'),_0x2cc72d[_0xc04c('0x9')]),_0x2cc72d);if(!_[_0xc04c('0x26')](channels[_0x2cc72d[_0xc04c('0x9')]][_0xc04c('0x44')])){channels[_0x2cc72d[_0xc04c('0x9')]][_0xc04c('0x47')]+=utils[_0xc04c('0x34')](utils[_0xc04c('0x20')](),channels[_0x2cc72d['uniqueid']]['musiconholdstartAt']);utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x48'),_0x2cc72d['uniqueid'],channels[_0x2cc72d[_0xc04c('0x9')]][_0xc04c('0x47')]));delete channels[_0x2cc72d[_0xc04c('0x9')]][_0xc04c('0x44')];}}}catch(_0xf3ff03){utils[_0xc04c('0x22')](util['format'](_0xc04c('0x46'),_0x2cc72d[_0xc04c('0x9')]),_0xf3ff03);}};exports[_0xc04c('0x49')]=function(_0x1cafcb){try{if(!_[_0xc04c('0x26')](channels[_0x1cafcb['uniqueid']])){utils['debug'](util[_0xc04c('0x1c')](_0xc04c('0x4a'),_0x1cafcb[_0xc04c('0x9')]),_0x1cafcb);if(!_['isNil'](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x4c')])){utils[_0xc04c('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1cafcb[_0xc04c('0x9')],_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb['uniqueid']]['source']=_0x1cafcb[_0xc04c('0x4d')];}if(!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x4e')])){utils[_0xc04c('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1cafcb[_0xc04c('0x9')],_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x4f')]=_0x1cafcb[_0xc04c('0x4d')];channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x2f')]='\x22'+_0x1cafcb['value']+_0xc04c('0x50')+_0x1cafcb[_0xc04c('0x4d')]+'>';}if(!_['isNil'](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x51')])||!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x52')])){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x53'),_0x1cafcb[_0xc04c('0x9')],!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')]['xmd-callerid-preview'])?_0xc04c('0x51'):_0xc04c('0x52'),_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x2f')]=_0x1cafcb[_0xc04c('0x4d')];}if(!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')]['xmd-queue'])||!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')]['xmcs-queue'])){utils[_0xc04c('0x1b')](util['format'](_0xc04c('0x53'),_0x1cafcb[_0xc04c('0x9')],!_['isNil'](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x54')])?'xmd-queue':'xmcs-queue',_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb['uniqueid']]['lastapplication']=_0xc04c('0x55');channels[_0x1cafcb['uniqueid']][_0xc04c('0x56')]=_0x1cafcb['value'];channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0xd')]=!![];}if(!_['isNil'](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x57')])){utils['info'](util[_0xc04c('0x1c')](_0xc04c('0x58'),_0x1cafcb[_0xc04c('0x9')],_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x59')]=_0x1cafcb[_0xc04c('0x4d')];}if(!_[_0xc04c('0x26')](_0x1cafcb['variable'][_0xc04c('0x5a')])){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')](_0xc04c('0x5b'),_0x1cafcb[_0xc04c('0x9')],_0x1cafcb['value']));channels[_0x1cafcb[_0xc04c('0x9')]]['type']=_0x1cafcb[_0xc04c('0x4d')];}if(!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')]['outboundrouteid'])){utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x1cafcb[_0xc04c('0x9')],_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x5c')]=_0x1cafcb[_0xc04c('0x4d')];}if(!_[_0xc04c('0x26')](_0x1cafcb[_0xc04c('0x4b')][_0xc04c('0x5d')])){utils[_0xc04c('0x1b')](util['format']('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1cafcb[_0xc04c('0x9')],_0x1cafcb[_0xc04c('0x4d')]));channels[_0x1cafcb[_0xc04c('0x9')]][_0xc04c('0x5d')]=_0x1cafcb['value'];}}}catch(_0x2f6c64){utils['error'](util[_0xc04c('0x1c')]('[%s][calls][varset]',_0x1cafcb[_0xc04c('0x9')]),_0x2f6c64);}};exports[_0xc04c('0x5e')]=function(_0xa33200){try{if(!_[_0xc04c('0x26')](channels[_0xa33200[_0xc04c('0x9')]])){utils[_0xc04c('0x17')](util['format']('[%s][calls][newexten]',_0xa33200['uniqueid']),_0xa33200);utils[_0xc04c('0x1b')](util[_0xc04c('0x1c')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xa33200[_0xc04c('0x9')],_0xa33200[_0xc04c('0x5f')],_0xa33200[_0xc04c('0x60')]));if(_0xa33200[_0xc04c('0x5f')][_0xc04c('0x61')]()=='set'&&_[_0xc04c('0x62')](_0xa33200['appdata'][_0xc04c('0x61')](),_0xc04c('0x63'))){var _0x2d1424=_0xa33200[_0xc04c('0x60')][_0xc04c('0x64')]('=');var _0x9e7406=_0x2d1424[0x0][_0xc04c('0x65')](_0x2d1424[0x0]['lastIndexOf']('(')+0x1,_0x2d1424[0x0][_0xc04c('0x66')](')'));var _0x54a4cc=_0x2d1424[0x1];channels[_0xa33200[_0xc04c('0x9')]][_0x9e7406]=_0x54a4cc;}if(!_[_0xc04c('0x67')](['hangup','noop',_0xc04c('0x68'),_0xc04c('0x69'),_0xc04c('0x6a')],_0xa33200[_0xc04c('0x5f')][_0xc04c('0x61')]())){channels[_0xa33200[_0xc04c('0x9')]]['lastapplication']=_0xa33200['application'];channels[_0xa33200[_0xc04c('0x9')]]['lastdata']=_0xa33200[_0xc04c('0x60')];}}}catch(_0x40b241){utils['error'](util[_0xc04c('0x1c')]('[%s][calls][newexten]',_0xa33200[_0xc04c('0x9')]),_0x40b241);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a34f5f9..fc7ee88 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ec=['[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xf2ec,0x13c));var _0xcf2e=function(_0x1705e2,_0x3892df){_0x1705e2=_0x1705e2-0x0;var _0xf314b3=_0xf2ec[_0x1705e2];return _0xf314b3;};'use strict';var utils=require(_0xcf2e('0x0'));exports['connect']=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x2'));};exports[_0xcf2e('0x3')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x4'));};exports[_0xcf2e('0x5')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0x6'));};exports[_0xcf2e('0x7')]=function(_0x5e4c6a){utils[_0xcf2e('0x7')](_0xcf2e('0x8'),_0x5e4c6a);};exports[_0xcf2e('0x9')]=function(){utils[_0xcf2e('0x1')](_0xcf2e('0xa'));};exports[_0xcf2e('0xb')]=function(_0x53d413){}; \ No newline at end of file +var _0x33c5=['connect','info','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x503699,_0x152145){var _0xd66c82=function(_0x48c6e7){while(--_0x48c6e7){_0x503699['push'](_0x503699['shift']());}};_0xd66c82(++_0x152145);}(_0x33c5,0xe6));var _0x533c=function(_0x2f8c05,_0x551e3d){_0x2f8c05=_0x2f8c05-0x0;var _0x14cfde=_0x33c5[_0x2f8c05];return _0x14cfde;};'use strict';var utils=require('./utils');exports[_0x533c('0x0')]=function(){utils[_0x533c('0x1')]('[core]\x20connected');};exports[_0x533c('0x2')]=function(){utils[_0x533c('0x1')](_0x533c('0x3'));};exports[_0x533c('0x4')]=function(){utils[_0x533c('0x1')]('[core]\x20fullybooted');};exports[_0x533c('0x5')]=function(_0x364b16){utils[_0x533c('0x5')](_0x533c('0x6'),_0x364b16);};exports[_0x533c('0x7')]=function(){utils[_0x533c('0x1')](_0x533c('0x8'));};exports[_0x533c('0x9')]=function(_0x2c297c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c9189d7..6fa805a 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3879=['calleridnum','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x38efc3,_0x338735){var _0x410980=function(_0x1d2e6b){while(--_0x1d2e6b){_0x38efc3['push'](_0x38efc3['shift']());}};_0x410980(++_0x338735);}(_0x3879,0xd9));var _0x9387=function(_0x7c7474,_0x35cb3d){_0x7c7474=_0x7c7474-0x0;var _0x40d0fa=_0x3879[_0x7c7474];return _0x40d0fa;};'use strict';var _=require(_0x9387('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x3f417f){utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x3'),_0x3f417f[_0x9387('0x4')],_0x3f417f[_0x9387('0x5')],_0x3f417f[_0x9387('0x6')],_0x3f417f['calleridnum'],_0x3f417f[_0x9387('0x7')],_0x3f417f[_0x9387('0x8')]));utils[_0x9387('0x9')]('CreateVoiceDialReport',_0x3f417f);delete dials[_0x3f417f['uniqueid']];}exports[_0x9387('0xa')]=function(_0x2b90ed){try{utils[_0x9387('0xb')](util[_0x9387('0x2')](_0x9387('0xc'),_0x2b90ed[_0x9387('0x4')]),_0x2b90ed);utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0xd'),_0x2b90ed['uniqueid'],_0x2b90ed[_0x9387('0xe')],_0x2b90ed[_0x9387('0xf')]));if(_0x2b90ed[_0x9387('0xe')][_0x9387('0x10')]()=='set'&&_[_0x9387('0x11')](_0x2b90ed[_0x9387('0xf')][_0x9387('0x10')](),_0x9387('0x12'))){var _0x46ae1a=_0x2b90ed[_0x9387('0xf')]['split']('=');dials[_0x2b90ed['uniqueid']]={'routeId':_0x46ae1a[0x1]};}}catch(_0x281a8d){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0xc'),_0x2b90ed[_0x9387('0x4')]),_0x281a8d);}};exports[_0x9387('0x14')]=function(_0x42b45f){try{utils[_0x9387('0xb')](util[_0x9387('0x2')](_0x9387('0x15'),_0x42b45f[_0x9387('0x4')]),_0x42b45f);if(!_[_0x9387('0x16')](_0x42b45f[_0x9387('0x17')]['outboundrouteid'])){utils[_0x9387('0x1')](util['format'](_0x9387('0x18'),_0x42b45f[_0x9387('0x4')],_0x42b45f[_0x9387('0x19')]));dials[_0x42b45f['uniqueid']]={'routeId':_0x42b45f[_0x9387('0x19')]};}}catch(_0x8a31da){utils[_0x9387('0x13')](util['format']('[%s][dials][varset]',_0x42b45f[_0x9387('0x4')]),_0x8a31da);}};exports[_0x9387('0x1a')]=function(_0x177b9b){try{if(!_[_0x9387('0x16')](dials[_0x177b9b[_0x9387('0x4')]])){utils[_0x9387('0xb')](util['format'](_0x9387('0x1b'),_0x177b9b['uniqueid']),_0x177b9b);dials[_0x177b9b[_0x9387('0x4')]]=_[_0x9387('0x1c')](dials[_0x177b9b[_0x9387('0x4')]],_0x177b9b);dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1d')]=utils[_0x9387('0x1e')]();dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1f')]=_0x9387('0x20');utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x21'),_0x177b9b[_0x9387('0x4')],dials[_0x177b9b[_0x9387('0x4')]][_0x9387('0x1d')]));}}catch(_0x4bbcd1){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0x1b'),_0x177b9b[_0x9387('0x4')]),_0x4bbcd1);}};exports['dialend']=function(_0x5032af){try{if(!_[_0x9387('0x16')](dials[_0x5032af[_0x9387('0x4')]])){utils['debug'](util[_0x9387('0x2')]('[%s][dials][dialend]',_0x5032af[_0x9387('0x4')]),_0x5032af);dials[_0x5032af['uniqueid']][_0x9387('0x8')]=_0x5032af[_0x9387('0x8')];if(_0x5032af[_0x9387('0x8')]==_0x9387('0x22')){dials[_0x5032af['uniqueid']]=_[_0x9387('0x1c')](dials[_0x5032af[_0x9387('0x4')]],_0x5032af);dials[_0x5032af[_0x9387('0x4')]][_0x9387('0x23')]=utils['now']();dials[_0x5032af[_0x9387('0x4')]][_0x9387('0x1f')]=_0x9387('0x24');utils[_0x9387('0x1')](util['format'](_0x9387('0x25'),_0x5032af[_0x9387('0x4')],_0x5032af['dialstatus'],dials[_0x5032af['uniqueid']][_0x9387('0x23')]));}else{utils['info'](util['format'](_0x9387('0x26'),_0x5032af[_0x9387('0x4')],_0x5032af[_0x9387('0x8')]));}}}catch(_0x45d12a){utils[_0x9387('0x13')](util[_0x9387('0x2')](_0x9387('0x27'),_0x5032af[_0x9387('0x4')]),_0x45d12a);}};exports[_0x9387('0x28')]=function(_0x5156d7){try{if(!_[_0x9387('0x16')](dials[_0x5156d7[_0x9387('0x4')]])){utils['debug'](util[_0x9387('0x2')](_0x9387('0x29'),_0x5156d7[_0x9387('0x4')]),_0x5156d7);utils[_0x9387('0x1')](util[_0x9387('0x2')](_0x9387('0x2a'),_0x5156d7['uniqueid'],_0x5156d7[_0x9387('0x2b')],_0x5156d7[_0x9387('0x2c')],_0x5156d7[_0x9387('0x2d')]));dials[_0x5156d7[_0x9387('0x4')]]=_[_0x9387('0x1c')](dials[_0x5156d7[_0x9387('0x4')]],{'endtime':utils[_0x9387('0x1e')](),'lastevent':_0x9387('0x2e')});dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x2f')]=utils['diffTime'](dials[_0x5156d7[_0x9387('0x4')]]['endtime'],dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x1d')]);dials[_0x5156d7[_0x9387('0x4')]][_0x9387('0x30')]=utils[_0x9387('0x31')](dials[_0x5156d7['uniqueid']][_0x9387('0x23')]||dials[_0x5156d7['uniqueid']][_0x9387('0x32')],dials[_0x5156d7['uniqueid']][_0x9387('0x1d')]);dials[_0x5156d7['uniqueid']][_0x9387('0x33')]=dials[_0x5156d7['uniqueid']][_0x9387('0x23')]?utils[_0x9387('0x31')](dials[_0x5156d7[_0x9387('0x4')]]['endtime'],dials[_0x5156d7['uniqueid']]['answertime']):0x0;writeDB(dials[_0x5156d7[_0x9387('0x4')]]);}}catch(_0x299e17){utils['error'](util[_0x9387('0x2')](_0x9387('0x29'),_0x5156d7['uniqueid']),_0x299e17);}}; \ No newline at end of file +var _0x4df4=['application','appdata','toLowerCase','startsWith','split','error','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][varset]','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','duration','diffTime','endtime','billableseconds','[%s][dials][hangup]','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s'];(function(_0x296144,_0x26bbbf){var _0x5329b1=function(_0x5d321b){while(--_0x5d321b){_0x296144['push'](_0x296144['shift']());}};_0x5329b1(++_0x26bbbf);}(_0x4df4,0x178));var _0x44df=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x4df4[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x44df('0x0'));var util=require(_0x44df('0x1'));var utils=require(_0x44df('0x2'));var dials={};function writeDB(_0x1df104){utils[_0x44df('0x3')](util[_0x44df('0x4')](_0x44df('0x5'),_0x1df104[_0x44df('0x6')],_0x1df104[_0x44df('0x7')],_0x1df104[_0x44df('0x8')],_0x1df104['calleridnum'],_0x1df104[_0x44df('0x9')],_0x1df104[_0x44df('0xa')]));utils['request'](_0x44df('0xb'),_0x1df104);delete dials[_0x1df104['uniqueid']];}exports[_0x44df('0xc')]=function(_0x59a7fa){try{utils[_0x44df('0xd')](util[_0x44df('0x4')](_0x44df('0xe'),_0x59a7fa['uniqueid']),_0x59a7fa);utils[_0x44df('0x3')](util['format'](_0x44df('0xf'),_0x59a7fa['uniqueid'],_0x59a7fa[_0x44df('0x10')],_0x59a7fa[_0x44df('0x11')]));if(_0x59a7fa['application'][_0x44df('0x12')]()=='set'&&_[_0x44df('0x13')](_0x59a7fa[_0x44df('0x11')][_0x44df('0x12')](),'cdr(routeid)')){var _0x26c07e=_0x59a7fa[_0x44df('0x11')][_0x44df('0x14')]('=');dials[_0x59a7fa[_0x44df('0x6')]]={'routeId':_0x26c07e[0x1]};}}catch(_0x33475f){utils[_0x44df('0x15')](util['format'](_0x44df('0xe'),_0x59a7fa['uniqueid']),_0x33475f);}};exports['varset']=function(_0x366a98){try{utils[_0x44df('0xd')](util['format']('[%s][dials][varset]',_0x366a98['uniqueid']),_0x366a98);if(!_[_0x44df('0x16')](_0x366a98['variable'][_0x44df('0x17')])){utils[_0x44df('0x3')](util[_0x44df('0x4')](_0x44df('0x18'),_0x366a98[_0x44df('0x6')],_0x366a98['value']));dials[_0x366a98[_0x44df('0x6')]]={'routeId':_0x366a98['value']};}}catch(_0xf31d12){utils[_0x44df('0x15')](util['format'](_0x44df('0x19'),_0x366a98[_0x44df('0x6')]),_0xf31d12);}};exports['dialbegin']=function(_0xb8ff82){try{if(!_[_0x44df('0x16')](dials[_0xb8ff82[_0x44df('0x6')]])){utils[_0x44df('0xd')](util[_0x44df('0x4')](_0x44df('0x1a'),_0xb8ff82[_0x44df('0x6')]),_0xb8ff82);dials[_0xb8ff82['uniqueid']]=_[_0x44df('0x1b')](dials[_0xb8ff82['uniqueid']],_0xb8ff82);dials[_0xb8ff82[_0x44df('0x6')]][_0x44df('0x1c')]=utils[_0x44df('0x1d')]();dials[_0xb8ff82[_0x44df('0x6')]]['lastevent']=_0x44df('0x1e');utils[_0x44df('0x3')](util[_0x44df('0x4')](_0x44df('0x1f'),_0xb8ff82[_0x44df('0x6')],dials[_0xb8ff82[_0x44df('0x6')]]['starttime']));}}catch(_0x4ed1e1){utils['error'](util[_0x44df('0x4')]('[%s][dials][dialbegin]',_0xb8ff82['uniqueid']),_0x4ed1e1);}};exports[_0x44df('0x20')]=function(_0x26ddfa){try{if(!_[_0x44df('0x16')](dials[_0x26ddfa[_0x44df('0x6')]])){utils['debug'](util[_0x44df('0x4')]('[%s][dials][dialend]',_0x26ddfa[_0x44df('0x6')]),_0x26ddfa);dials[_0x26ddfa[_0x44df('0x6')]]['dialstatus']=_0x26ddfa['dialstatus'];if(_0x26ddfa[_0x44df('0xa')]==_0x44df('0x21')){dials[_0x26ddfa[_0x44df('0x6')]]=_['assign'](dials[_0x26ddfa[_0x44df('0x6')]],_0x26ddfa);dials[_0x26ddfa['uniqueid']][_0x44df('0x22')]=utils[_0x44df('0x1d')]();dials[_0x26ddfa[_0x44df('0x6')]][_0x44df('0x23')]=_0x44df('0x24');utils[_0x44df('0x3')](util[_0x44df('0x4')](_0x44df('0x25'),_0x26ddfa[_0x44df('0x6')],_0x26ddfa[_0x44df('0xa')],dials[_0x26ddfa[_0x44df('0x6')]][_0x44df('0x22')]));}else{utils[_0x44df('0x3')](util[_0x44df('0x4')](_0x44df('0x26'),_0x26ddfa['uniqueid'],_0x26ddfa[_0x44df('0xa')]));}}}catch(_0x4edd27){utils[_0x44df('0x15')](util[_0x44df('0x4')]('[%s][dials][dialend]',_0x26ddfa[_0x44df('0x6')]),_0x4edd27);}};exports[_0x44df('0x27')]=function(_0x571ac3){try{if(!_[_0x44df('0x16')](dials[_0x571ac3['uniqueid']])){utils[_0x44df('0xd')](util[_0x44df('0x4')]('[%s][dials][hangup]',_0x571ac3[_0x44df('0x6')]),_0x571ac3);utils[_0x44df('0x3')](util['format'](_0x44df('0x28'),_0x571ac3[_0x44df('0x6')],_0x571ac3[_0x44df('0x29')],_0x571ac3[_0x44df('0x2a')],_0x571ac3['cause-txt']));dials[_0x571ac3[_0x44df('0x6')]]=_['assign'](dials[_0x571ac3[_0x44df('0x6')]],{'endtime':utils[_0x44df('0x1d')](),'lastevent':_0x44df('0x2b')});dials[_0x571ac3['uniqueid']][_0x44df('0x2c')]=utils[_0x44df('0x2d')](dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x2e')],dials[_0x571ac3['uniqueid']]['starttime']);dials[_0x571ac3[_0x44df('0x6')]]['holdtime']=utils[_0x44df('0x2d')](dials[_0x571ac3['uniqueid']][_0x44df('0x22')]||dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x2e')],dials[_0x571ac3[_0x44df('0x6')]]['starttime']);dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x2f')]=dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x22')]?utils[_0x44df('0x2d')](dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x2e')],dials[_0x571ac3[_0x44df('0x6')]][_0x44df('0x22')]):0x0;writeDB(dials[_0x571ac3['uniqueid']]);}}catch(_0x44718f){utils[_0x44df('0x15')](util[_0x44df('0x4')](_0x44df('0x30'),_0x571ac3[_0x44df('0x6')]),_0x44718f);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 983869d..0cb2ffd 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b15=['musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','local','asterisk','username','keepConnected','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','format','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','[%s][index][musiconholdstart]'];(function(_0x1db4f2,_0x4bcd69){var _0x3c2516=function(_0x31ca80){while(--_0x31ca80){_0x1db4f2['push'](_0x1db4f2['shift']());}};_0x3c2516(++_0x4bcd69);}(_0x3b15,0xd4));var _0x53b1=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x3b15[_0x912d27];return _0x31b918;};var AsteriskManager=require(_0x53b1('0x0'));var config=require(_0x53b1('0x1'));var utils=require(_0x53b1('0x2'));var util=require('util');var isXDREnabled=config[_0x53b1('0x3')]&&config[_0x53b1('0x3')]['disabled']?!config['xdr'][_0x53b1('0x4')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x53b1('0x3')]&&config['xdr'][_0x53b1('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x53b1('0x6')]['port'],config[_0x53b1('0x6')]['ip'],config[_0x53b1('0x6')][_0x53b1('0x7')],config[_0x53b1('0x6')]['password'],!![]);ami[_0x53b1('0x8')]();if(!isXDREnabled){utils['info'](_0x53b1('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x53b1('0xa'));var calls=require(_0x53b1('0xb'));var queues=require(_0x53b1('0xc'));var recordings=require(_0x53b1('0xd'));var members=require(_0x53b1('0xe'));var dials=require(_0x53b1('0xf'));var transfers=require('./transfers.controller');var core=require(_0x53b1('0x10'));ami['on'](_0x53b1('0x11'),core['connect']);ami['on'](_0x53b1('0x12'),core['shutdown']);ami['on'](_0x53b1('0x13'),core['fullybooted']);ami['on'](_0x53b1('0x14'),core[_0x53b1('0x14')]);ami['on'](_0x53b1('0x15'),core[_0x53b1('0x15')]);ami['on'](_0x53b1('0x16'),core[_0x53b1('0x16')]);ami['on']('devicestatechange',function(_0x3e44c5){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x18'),_0x3e44c5[_0x53b1('0x19')]),_0x3e44c5);members[_0x53b1('0x1a')](_0x3e44c5);}catch(_0x5933d5){utils[_0x53b1('0x14')](util['format']('[%s][index][devicestatechange]',_0x3e44c5['device']),_0x5933d5);}});ami['on'](_0x53b1('0x1b'),function(_0x4847f5){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][agentcalled]',_0x4847f5[_0x53b1('0x1d')]),_0x4847f5);agents['agentcalled'](_0x4847f5);}catch(_0xd8e667){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x1e'),_0x4847f5[_0x53b1('0x1d')]),_0xd8e667);}});ami['on']('agentringnoanswer',function(_0xc6727e){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x1f'),_0xc6727e[_0x53b1('0x1d')]),_0xc6727e);agents[_0x53b1('0x20')](_0xc6727e);}catch(_0x51732f){utils['error'](util[_0x53b1('0x1c')](_0x53b1('0x1f'),_0xc6727e[_0x53b1('0x1d')]),_0x51732f);}});ami['on']('agentconnect',function(_0x1c14a7){try{utils['debug'](util[_0x53b1('0x1c')](_0x53b1('0x21'),_0x1c14a7[_0x53b1('0x1d')]),_0x1c14a7);agents['agentconnect'](_0x1c14a7);queues[_0x53b1('0x22')](_0x1c14a7);}catch(_0x480c9f){utils['error'](util['format'](_0x53b1('0x21'),_0x1c14a7[_0x53b1('0x1d')]),_0x480c9f);}});ami['on'](_0x53b1('0x23'),function(_0x137f8b){try{utils[_0x53b1('0x17')](util['format']('[%s][index][agentcomplete]',_0x137f8b[_0x53b1('0x1d')]),_0x137f8b);agents[_0x53b1('0x23')](_0x137f8b);queues[_0x53b1('0x23')](_0x137f8b);members[_0x53b1('0x23')](_0x137f8b);}catch(_0x4fd1db){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x24'),_0x137f8b['uniqueid']),_0x4fd1db);}});ami['on']('queuecallerabandon',function(_0x1aa758){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x25'),_0x1aa758[_0x53b1('0x1d')]),_0x1aa758);agents[_0x53b1('0x26')](_0x1aa758);queues[_0x53b1('0x26')](_0x1aa758);}catch(_0x1d8a18){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x25'),_0x1aa758[_0x53b1('0x1d')]),_0x1d8a18);}});ami['on']('queuecallerjoin',function(_0x1fe8a6){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x27'),_0x1fe8a6[_0x53b1('0x1d')]),_0x1fe8a6);queues['queuecallerjoin'](_0x1fe8a6);recordings[_0x53b1('0x28')](_0x1fe8a6);}catch(_0x284799){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x27'),_0x1fe8a6[_0x53b1('0x1d')]),_0x284799);}});ami['on']('queuecallerleave',function(_0x2ac620){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x29'),_0x2ac620[_0x53b1('0x1d')]),_0x2ac620);queues[_0x53b1('0x2a')](_0x2ac620);}catch(_0x2c7079){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x29'),_0x2ac620[_0x53b1('0x1d')]),_0x2c7079);}});ami['on']('musiconholdstart',function(_0x51ad14){try{utils[_0x53b1('0x17')](util['format'](_0x53b1('0x2b'),_0x51ad14[_0x53b1('0x1d')]),_0x51ad14);queues[_0x53b1('0x2c')](_0x51ad14);calls[_0x53b1('0x2c')](_0x51ad14);}catch(_0x297f65){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x2b'),_0x51ad14['uniqueid']),_0x297f65);}});ami['on']('musiconholdstop',function(_0x3c4aa1){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x2d'),_0x3c4aa1['uniqueid']),_0x3c4aa1);queues[_0x53b1('0x2e')](_0x3c4aa1);calls[_0x53b1('0x2e')](_0x3c4aa1);}catch(_0x5197e8){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x2d'),_0x3c4aa1[_0x53b1('0x1d')]),_0x5197e8);}});ami['on'](_0x53b1('0x2f'),function(_0x2ee3c1){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x30'),_0x2ee3c1[_0x53b1('0x1d')]),_0x2ee3c1);calls[_0x53b1('0x2f')](_0x2ee3c1);recordings[_0x53b1('0x2f')](_0x2ee3c1);}catch(_0x510fab){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x30'),_0x2ee3c1['uniqueid']),_0x510fab);}});ami['on'](_0x53b1('0x31'),function(_0x526093){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x32'),_0x526093[_0x53b1('0x1d')]),_0x526093);calls[_0x53b1('0x31')](_0x526093);recordings[_0x53b1('0x31')](_0x526093);dials['hangup'](_0x526093);agents[_0x53b1('0x31')](_0x526093);queues[_0x53b1('0x31')](_0x526093);}catch(_0x2e9588){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x32'),_0x526093[_0x53b1('0x1d')]),_0x2e9588);}});ami['on']('cdr',function(_0x3fae45){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][cdr]',_0x3fae45['uniqueid']),_0x3fae45);members['cdr'](_0x3fae45);}catch(_0x10b17f){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')]('[%s][index][cdr]',_0x3fae45[_0x53b1('0x1d')]),_0x10b17f);}});ami['on'](_0x53b1('0x33'),function(_0x13881d){try{utils[_0x53b1('0x17')](util['format']('[%s][index][blindtransfer]',_0x13881d[_0x53b1('0x1d')]),_0x13881d);queues['blindtransfer'](_0x13881d);agents[_0x53b1('0x33')](_0x13881d);transfers[_0x53b1('0x33')](_0x13881d);recordings[_0x53b1('0x33')](_0x13881d);}catch(_0x7d6605){utils[_0x53b1('0x14')](util['format']('[%s][index][blindtransfer]',_0x13881d[_0x53b1('0x1d')]),_0x7d6605);}});ami['on'](_0x53b1('0x34'),function(_0x28ecde){try{utils['debug'](util['format'](_0x53b1('0x35'),_0x28ecde['origtransfereruniqueid']),_0x28ecde);queues[_0x53b1('0x34')](_0x28ecde);transfers[_0x53b1('0x34')](_0x28ecde);agents['attendedtransfer'](_0x28ecde);calls['attendedtransfer'](_0x28ecde);}catch(_0x4326c8){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x35'),_0x28ecde[_0x53b1('0x36')]),_0x4326c8);}});ami['on'](_0x53b1('0x37'),function(_0x1fc3a6){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x38'),_0x1fc3a6[_0x53b1('0x1d')]),_0x1fc3a6);queues[_0x53b1('0x37')](_0x1fc3a6);recordings[_0x53b1('0x37')](_0x1fc3a6);calls[_0x53b1('0x37')](_0x1fc3a6);dials[_0x53b1('0x37')](_0x1fc3a6);}catch(_0x17b463){utils['error'](util['format'](_0x53b1('0x38'),_0x1fc3a6[_0x53b1('0x1d')]),_0x17b463);}});ami['on'](_0x53b1('0x39'),function(_0x467c0f){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][newexten]',_0x467c0f[_0x53b1('0x1d')]),_0x467c0f);calls[_0x53b1('0x39')](_0x467c0f);recordings[_0x53b1('0x39')](_0x467c0f);dials[_0x53b1('0x39')](_0x467c0f);}catch(_0x5c3509){utils[_0x53b1('0x14')](util['format'](_0x53b1('0x3a'),_0x467c0f[_0x53b1('0x1d')]),_0x5c3509);}});ami['on'](_0x53b1('0x3b'),function(_0x3cf2ca){try{utils['debug'](util[_0x53b1('0x1c')]('[%s][index][newchannel]',_0x3cf2ca[_0x53b1('0x1d')]),_0x3cf2ca);calls['newchannel'](_0x3cf2ca);recordings[_0x53b1('0x3b')](_0x3cf2ca);}catch(_0x3a0c7d){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')]('[%s][index][newchannel]',_0x3cf2ca[_0x53b1('0x1d')]),_0x3a0c7d);}});ami['on']('dialbegin',function(_0x559879){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')](_0x53b1('0x3c'),_0x559879['uniqueid']),_0x559879);dials['dialbegin'](_0x559879);}catch(_0x1f5a9d){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x3d'),_0x559879[_0x53b1('0x1d')]),_0x1f5a9d);}});ami['on'](_0x53b1('0x3e'),function(_0x203921){try{utils[_0x53b1('0x17')](util[_0x53b1('0x1c')]('[%s][index][dialend]',_0x203921[_0x53b1('0x1d')]),_0x203921);dials[_0x53b1('0x3e')](_0x203921);}catch(_0x371777){utils[_0x53b1('0x14')](util[_0x53b1('0x1c')](_0x53b1('0x3f'),_0x203921[_0x53b1('0x1d')]),_0x371777);}});} \ No newline at end of file +var _0x15b6=['[%s][index][devicestatechange]','devicestatechange','device','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','env','production','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format'];(function(_0x14f6da,_0xce1730){var _0xc9ca1a=function(_0x199cc2){while(--_0x199cc2){_0x14f6da['push'](_0x14f6da['shift']());}};_0xc9ca1a(++_0xce1730);}(_0x15b6,0xaf));var _0x615b=function(_0x20e141,_0x960a82){_0x20e141=_0x20e141-0x0;var _0x509596=_0x15b6[_0x20e141];return _0x509596;};var AsteriskManager=require('asterisk-manager');var config=require(_0x615b('0x0'));var utils=require(_0x615b('0x1'));var util=require('util');var isXDREnabled=config['xdr']&&config[_0x615b('0x2')]['disabled']?!config[_0x615b('0x2')][_0x615b('0x3')]:!![];var isProduction=config[_0x615b('0x4')]===_0x615b('0x5')||![];var isLocalAsterisk=config[_0x615b('0x2')]&&config[_0x615b('0x2')][_0x615b('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x615b('0x7')],config[_0x615b('0x8')]['ip'],config['asterisk'][_0x615b('0x9')],config[_0x615b('0x8')][_0x615b('0xa')],!![]);ami[_0x615b('0xb')]();if(!isXDREnabled){utils[_0x615b('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x615b('0xc')](_0x615b('0xd'));}else{var agents=require(_0x615b('0xe'));var calls=require('./calls.controller');var queues=require(_0x615b('0xf'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x615b('0x10'));var transfers=require('./transfers.controller');var core=require(_0x615b('0x11'));ami['on'](_0x615b('0x12'),core[_0x615b('0x12')]);ami['on'](_0x615b('0x13'),core[_0x615b('0x13')]);ami['on'](_0x615b('0x14'),core['fullybooted']);ami['on'](_0x615b('0x15'),core[_0x615b('0x15')]);ami['on'](_0x615b('0x16'),core[_0x615b('0x16')]);ami['on'](_0x615b('0x17'),core[_0x615b('0x17')]);ami['on']('devicestatechange',function(_0x2079c4){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x1a'),_0x2079c4['device']),_0x2079c4);members[_0x615b('0x1b')](_0x2079c4);}catch(_0x5342d9){utils[_0x615b('0x15')](util['format']('[%s][index][devicestatechange]',_0x2079c4[_0x615b('0x1c')]),_0x5342d9);}});ami['on'](_0x615b('0x1d'),function(_0x1bc123){try{utils[_0x615b('0x18')](util[_0x615b('0x19')]('[%s][index][agentcalled]',_0x1bc123[_0x615b('0x1e')]),_0x1bc123);agents[_0x615b('0x1d')](_0x1bc123);}catch(_0x89e10e){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x1f'),_0x1bc123['uniqueid']),_0x89e10e);}});ami['on']('agentringnoanswer',function(_0x54b72d){try{utils['debug'](util[_0x615b('0x19')]('[%s][index][agentringnoanswer]',_0x54b72d[_0x615b('0x1e')]),_0x54b72d);agents['agentringnoanswer'](_0x54b72d);}catch(_0xcdb510){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x20'),_0x54b72d[_0x615b('0x1e')]),_0xcdb510);}});ami['on'](_0x615b('0x21'),function(_0x40291f){try{utils[_0x615b('0x18')](util['format'](_0x615b('0x22'),_0x40291f[_0x615b('0x1e')]),_0x40291f);agents[_0x615b('0x21')](_0x40291f);queues[_0x615b('0x21')](_0x40291f);}catch(_0x25dc5b){utils['error'](util[_0x615b('0x19')](_0x615b('0x22'),_0x40291f['uniqueid']),_0x25dc5b);}});ami['on'](_0x615b('0x23'),function(_0x32e34c){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x24'),_0x32e34c[_0x615b('0x1e')]),_0x32e34c);agents[_0x615b('0x23')](_0x32e34c);queues[_0x615b('0x23')](_0x32e34c);members[_0x615b('0x23')](_0x32e34c);}catch(_0x38ef60){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x24'),_0x32e34c[_0x615b('0x1e')]),_0x38ef60);}});ami['on']('queuecallerabandon',function(_0x2ad146){try{utils[_0x615b('0x18')](util[_0x615b('0x19')]('[%s][index][queuecallerabandon]',_0x2ad146[_0x615b('0x1e')]),_0x2ad146);agents[_0x615b('0x25')](_0x2ad146);queues[_0x615b('0x25')](_0x2ad146);}catch(_0x7a103c){utils[_0x615b('0x15')](util['format']('[%s][index][queuecallerabandon]',_0x2ad146['uniqueid']),_0x7a103c);}});ami['on']('queuecallerjoin',function(_0xcba60b){try{utils[_0x615b('0x18')](util['format'](_0x615b('0x26'),_0xcba60b[_0x615b('0x1e')]),_0xcba60b);queues['queuecallerjoin'](_0xcba60b);recordings[_0x615b('0x27')](_0xcba60b);}catch(_0x2a724e){utils['error'](util[_0x615b('0x19')](_0x615b('0x26'),_0xcba60b[_0x615b('0x1e')]),_0x2a724e);}});ami['on']('queuecallerleave',function(_0xd4458f){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x28'),_0xd4458f[_0x615b('0x1e')]),_0xd4458f);queues[_0x615b('0x29')](_0xd4458f);}catch(_0x1ed860){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x28'),_0xd4458f[_0x615b('0x1e')]),_0x1ed860);}});ami['on'](_0x615b('0x2a'),function(_0x3ecf42){try{utils['debug'](util['format'](_0x615b('0x2b'),_0x3ecf42[_0x615b('0x1e')]),_0x3ecf42);queues[_0x615b('0x2a')](_0x3ecf42);calls[_0x615b('0x2a')](_0x3ecf42);}catch(_0x9ecb14){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x2b'),_0x3ecf42[_0x615b('0x1e')]),_0x9ecb14);}});ami['on'](_0x615b('0x2c'),function(_0xb634c9){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x2d'),_0xb634c9[_0x615b('0x1e')]),_0xb634c9);queues['musiconholdstop'](_0xb634c9);calls[_0x615b('0x2c')](_0xb634c9);}catch(_0x3aa2c2){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x2d'),_0xb634c9[_0x615b('0x1e')]),_0x3aa2c2);}});ami['on'](_0x615b('0x2e'),function(_0x3e38da){try{utils['debug'](util['format'](_0x615b('0x2f'),_0x3e38da[_0x615b('0x1e')]),_0x3e38da);calls[_0x615b('0x2e')](_0x3e38da);recordings['newstate'](_0x3e38da);}catch(_0x5631c5){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x2f'),_0x3e38da[_0x615b('0x1e')]),_0x5631c5);}});ami['on'](_0x615b('0x30'),function(_0x147fe4){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x31'),_0x147fe4[_0x615b('0x1e')]),_0x147fe4);calls[_0x615b('0x30')](_0x147fe4);recordings[_0x615b('0x30')](_0x147fe4);dials[_0x615b('0x30')](_0x147fe4);agents['hangup'](_0x147fe4);queues['hangup'](_0x147fe4);}catch(_0x207972){utils[_0x615b('0x15')](util[_0x615b('0x19')]('[%s][index][hangup]',_0x147fe4[_0x615b('0x1e')]),_0x207972);}});ami['on'](_0x615b('0x32'),function(_0x52cdf8){try{utils[_0x615b('0x18')](util[_0x615b('0x19')]('[%s][index][cdr]',_0x52cdf8['uniqueid']),_0x52cdf8);members[_0x615b('0x32')](_0x52cdf8);}catch(_0xae2156){utils['error'](util[_0x615b('0x19')](_0x615b('0x33'),_0x52cdf8[_0x615b('0x1e')]),_0xae2156);}});ami['on'](_0x615b('0x34'),function(_0x54ec2e){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x35'),_0x54ec2e[_0x615b('0x1e')]),_0x54ec2e);queues['blindtransfer'](_0x54ec2e);agents[_0x615b('0x34')](_0x54ec2e);transfers['blindtransfer'](_0x54ec2e);recordings['blindtransfer'](_0x54ec2e);}catch(_0x333016){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x35'),_0x54ec2e[_0x615b('0x1e')]),_0x333016);}});ami['on'](_0x615b('0x36'),function(_0x1e3094){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x37'),_0x1e3094[_0x615b('0x38')]),_0x1e3094);queues[_0x615b('0x36')](_0x1e3094);transfers[_0x615b('0x36')](_0x1e3094);agents[_0x615b('0x36')](_0x1e3094);calls['attendedtransfer'](_0x1e3094);}catch(_0x4b4b3c){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x37'),_0x1e3094[_0x615b('0x38')]),_0x4b4b3c);}});ami['on'](_0x615b('0x39'),function(_0xe53a54){try{utils[_0x615b('0x18')](util[_0x615b('0x19')]('[%s][index][varset]',_0xe53a54[_0x615b('0x1e')]),_0xe53a54);queues[_0x615b('0x39')](_0xe53a54);recordings[_0x615b('0x39')](_0xe53a54);calls[_0x615b('0x39')](_0xe53a54);dials[_0x615b('0x39')](_0xe53a54);}catch(_0x3f0bb8){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x3a'),_0xe53a54['uniqueid']),_0x3f0bb8);}});ami['on'](_0x615b('0x3b'),function(_0x23c823){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x3c'),_0x23c823['uniqueid']),_0x23c823);calls[_0x615b('0x3b')](_0x23c823);recordings[_0x615b('0x3b')](_0x23c823);dials[_0x615b('0x3b')](_0x23c823);}catch(_0x567e2b){utils[_0x615b('0x15')](util[_0x615b('0x19')](_0x615b('0x3c'),_0x23c823[_0x615b('0x1e')]),_0x567e2b);}});ami['on']('newchannel',function(_0x2f860d){try{utils['debug'](util['format'](_0x615b('0x3d'),_0x2f860d[_0x615b('0x1e')]),_0x2f860d);calls[_0x615b('0x3e')](_0x2f860d);recordings['newchannel'](_0x2f860d);}catch(_0x3ea3e1){utils[_0x615b('0x15')](util[_0x615b('0x19')]('[%s][index][newchannel]',_0x2f860d[_0x615b('0x1e')]),_0x3ea3e1);}});ami['on'](_0x615b('0x3f'),function(_0x4c6abf){try{utils[_0x615b('0x18')](util[_0x615b('0x19')](_0x615b('0x40'),_0x4c6abf[_0x615b('0x1e')]),_0x4c6abf);dials[_0x615b('0x3f')](_0x4c6abf);}catch(_0x2cc1d8){utils['error'](util[_0x615b('0x19')]('[%s]dialbegin',_0x4c6abf[_0x615b('0x1e')]),_0x2cc1d8);}});ami['on'](_0x615b('0x41'),function(_0x14287e){try{utils[_0x615b('0x18')](util['format'](_0x615b('0x42'),_0x14287e[_0x615b('0x1e')]),_0x14287e);dials[_0x615b('0x41')](_0x14287e);}catch(_0x501fbe){utils['error'](util[_0x615b('0x19')]('[%s][index][dialend]',_0x14287e[_0x615b('0x1e')]),_0x501fbe);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 62c209b..a19c79e 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2821=['some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','uniqueid','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','split','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','data3','destinationchannel','assign','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','getUserByName','name','CreateMemberReport','error','[%s][members][writeDB]'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x2821,0xc3));var _0x1282=function(_0x403604,_0x26447b){_0x403604=_0x403604-0x0;var _0xed8fc9=_0x2821[_0x403604];return _0xed8fc9;};'use strict';var _=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var utils=require(_0x1282('0x2'));var members={};var exclude=[_0x1282('0x3'),_0x1282('0x4')];function writeDB(_0xabf2ba){utils['info'](util[_0x1282('0x5')](_0x1282('0x6'),_0xabf2ba['uniqueid'],_0xabf2ba[_0x1282('0x7')],_0xabf2ba[_0x1282('0x8')],_0xabf2ba[_0x1282('0x9')],_0xabf2ba[_0x1282('0xa')],_0xabf2ba[_0x1282('0xb')]));if(_0xabf2ba[_0x1282('0x7')]){utils[_0x1282('0xc')](_0xabf2ba['interface'])[_0x1282('0xd')](function(_0x48349c){if(_0x48349c){_0xabf2ba['membername']=_0x48349c['name'];_0xabf2ba[_0x1282('0xe')]=_0x48349c[_0x1282('0xe')];utils[_0x1282('0xf')]('CreateMemberReport',_0xabf2ba);}else{utils[_0x1282('0x10')](_0xabf2ba[_0x1282('0x7')]['split']('/')[0x1])['then'](function(_0x131ae4){if(_0x131ae4){_0xabf2ba[_0x1282('0xa')]=_0x131ae4[_0x1282('0x11')];_0xabf2ba['internal']=_0x131ae4['internal'];utils[_0x1282('0xf')](_0x1282('0x12'),_0xabf2ba);}});}})['catch'](function(_0x1ce472){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x14'),_0xabf2ba['uniqueid']),_0x1ce472);});}delete members[_0xabf2ba[_0x1282('0x7')]];}function startsWith(_0x5a16bf,_0x2af39e){return _[_0x1282('0x15')](_0x5a16bf,function(_0x4fa391){return _[_0x1282('0x16')](_0x2af39e,_0x4fa391);});}exports[_0x1282('0x17')]=function(_0x3bbf61){try{utils['debug'](util[_0x1282('0x5')](_0x1282('0x18'),members[_0x3bbf61[_0x1282('0x19')]]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')]),_0x3bbf61);utils[_0x1282('0x1b')](util[_0x1282('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3bbf61['device']]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')],_0x3bbf61[_0x1282('0x1c')],_0x3bbf61['device']));switch(_0x3bbf61[_0x1282('0x1c')]){case _0x1282('0x1d'):case _0x1282('0x1e'):if(!startsWith(exclude,_0x3bbf61[_0x1282('0x19')])){members[_0x3bbf61[_0x1282('0x19')]]={'channel':_0x1282('0x1f'),'interface':_0x3bbf61[_0x1282('0x19')],'type':_0x1282('0x20'),'enterAt':utils[_0x1282('0x21')](),'role':_0x1282('0x22')};}break;case _0x1282('0x23'):if(!_[_0x1282('0x24')](members[_0x3bbf61['device']])){members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x25')]=utils[_0x1282('0x21')]();members[_0x3bbf61[_0x1282('0x19')]]['duration']=utils[_0x1282('0x26')](members[_0x3bbf61['device']]['exitAt'],members[_0x3bbf61[_0x1282('0x19')]]['enterAt']);if(members[_0x3bbf61['device']][_0x1282('0x1a')]){writeDB(members[_0x3bbf61['device']]);}}break;default:break;}}catch(_0x4f1eac){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x18'),members[_0x3bbf61['device']]?members[_0x3bbf61[_0x1282('0x19')]][_0x1282('0x1a')]:_0x3bbf61[_0x1282('0x19')]),_0x4f1eac);}};exports[_0x1282('0x27')]=function(_0x46a9e0){try{if(!_[_0x1282('0x24')](members[_0x46a9e0[_0x1282('0x7')]])){utils[_0x1282('0x28')](util[_0x1282('0x5')](_0x1282('0x29'),_0x46a9e0[_0x1282('0x1a')]),_0x46a9e0);utils[_0x1282('0x1b')](util[_0x1282('0x5')](_0x1282('0x2a'),_0x46a9e0[_0x1282('0x1a')],_0x46a9e0[_0x1282('0x7')],_0x46a9e0[_0x1282('0x2b')]));members[_0x46a9e0[_0x1282('0x7')]]=_['assign'](members[_0x46a9e0[_0x1282('0x7')]],{'data4':_0x46a9e0[_0x1282('0x2b')],'uniqueid':_0x46a9e0['uniqueid']});}}catch(_0x1c0273){utils[_0x1282('0x13')](util[_0x1282('0x5')]('[%s][members][agentcomplete]',_0x46a9e0['uniqueid']),_0x1c0273);}};exports[_0x1282('0x2c')]=function(_0x1d866b){try{utils[_0x1282('0x28')](util[_0x1282('0x5')]('[%s][members][cdr]',_0x1d866b[_0x1282('0x1a')]),_0x1d866b);if(_0x1d866b[_0x1282('0x8')]){var _0x2f28eb=_0x1d866b['channel'][_0x1282('0x2d')]('-')[0x0];if(!_[_0x1282('0x24')](members[_0x2f28eb])){members[_0x2f28eb]=_['assign'](members[_0x2f28eb],{'data1':members[_0x2f28eb]['data1']||_0x1d866b[_0x1282('0xb')],'data2':members[_0x2f28eb][_0x1282('0x9')]||_0x1d866b[_0x1282('0x2e')],'data3':members[_0x2f28eb]['data3']||_0x1d866b[_0x1282('0x2f')],'uniqueid':members[_0x2f28eb][_0x1282('0x1a')]||_0x1d866b[_0x1282('0x1a')]});utils[_0x1282('0x1b')](util[_0x1282('0x5')](_0x1282('0x30'),_0x1d866b['uniqueid'],members[_0x2f28eb][_0x1282('0x31')],members[_0x2f28eb][_0x1282('0x9')],members[_0x2f28eb][_0x1282('0x32')]));if(members[_0x2f28eb][_0x1282('0x25')]){writeDB(members[_0x2f28eb]);}}}if(_0x1d866b['destinationchannel']){var _0x4b253a=_0x1d866b[_0x1282('0x33')]['split']('-')[0x0];if(!_['isNil'](members[_0x4b253a])){members[_0x4b253a]=_[_0x1282('0x34')](members[_0x4b253a],{'data1':members[_0x4b253a][_0x1282('0x31')]||_0x1d866b[_0x1282('0xb')],'data2':members[_0x4b253a][_0x1282('0x9')]||_0x1d866b[_0x1282('0x2e')],'data3':members[_0x4b253a][_0x1282('0x32')]||_0x1d866b[_0x1282('0x2f')],'uniqueid':members[_0x4b253a][_0x1282('0x1a')]||_0x1d866b[_0x1282('0x1a')]});utils[_0x1282('0x1b')](util['format'](_0x1282('0x30'),_0x1d866b['uniqueid'],members[_0x4b253a][_0x1282('0x31')],members[_0x4b253a][_0x1282('0x9')],members[_0x4b253a][_0x1282('0x32')]));if(members[_0x4b253a]['exitAt']){writeDB(members[_0x4b253a]);}}}}catch(_0x42e601){utils[_0x1282('0x13')](util[_0x1282('0x5')](_0x1282('0x35'),_0x1d866b[_0x1282('0x1a')]),_0x42e601);}}; \ No newline at end of file +var _0x16e4=['getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','data2','membername','type'];(function(_0x468fe7,_0x1fe7f8){var _0x43b759=function(_0x5e9409){while(--_0x5e9409){_0x468fe7['push'](_0x468fe7['shift']());}};_0x43b759(++_0x1fe7f8);}(_0x16e4,0x97));var _0x416e=function(_0x4da190,_0x1a1057){_0x4da190=_0x4da190-0x0;var _0x1e6d8f=_0x16e4[_0x4da190];return _0x1e6d8f;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var utils=require(_0x416e('0x2'));var members={};var exclude=[_0x416e('0x3'),_0x416e('0x4')];function writeDB(_0x2a9e9f){utils['info'](util[_0x416e('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x2a9e9f[_0x416e('0x6')],_0x2a9e9f[_0x416e('0x7')],_0x2a9e9f['channel'],_0x2a9e9f[_0x416e('0x8')],_0x2a9e9f[_0x416e('0x9')],_0x2a9e9f[_0x416e('0xa')]));if(_0x2a9e9f[_0x416e('0x7')]){utils[_0x416e('0xb')](_0x2a9e9f[_0x416e('0x7')])[_0x416e('0xc')](function(_0x760c80){if(_0x760c80){_0x2a9e9f[_0x416e('0x9')]=_0x760c80['name'];_0x2a9e9f[_0x416e('0xd')]=_0x760c80['internal'];utils[_0x416e('0xe')](_0x416e('0xf'),_0x2a9e9f);}else{utils[_0x416e('0x10')](_0x2a9e9f['interface'][_0x416e('0x11')]('/')[0x1])[_0x416e('0xc')](function(_0x149372){if(_0x149372){_0x2a9e9f['membername']=_0x149372[_0x416e('0x12')];_0x2a9e9f['internal']=_0x149372[_0x416e('0xd')];utils[_0x416e('0xe')](_0x416e('0xf'),_0x2a9e9f);}});}})[_0x416e('0x13')](function(_0x507d36){utils[_0x416e('0x14')](util[_0x416e('0x5')](_0x416e('0x15'),_0x2a9e9f[_0x416e('0x6')]),_0x507d36);});}delete members[_0x2a9e9f[_0x416e('0x7')]];}function startsWith(_0x253c30,_0x30ead5){return _[_0x416e('0x16')](_0x253c30,function(_0x36069b){return _['startsWith'](_0x30ead5,_0x36069b);});}exports['devicestatechange']=function(_0x5d8852){try{utils[_0x416e('0x17')](util[_0x416e('0x5')](_0x416e('0x18'),members[_0x5d8852[_0x416e('0x19')]]?members[_0x5d8852['device']][_0x416e('0x6')]:_0x5d8852[_0x416e('0x19')]),_0x5d8852);utils['info'](util[_0x416e('0x5')](_0x416e('0x1a'),members[_0x5d8852[_0x416e('0x19')]]?members[_0x5d8852[_0x416e('0x19')]][_0x416e('0x6')]:_0x5d8852[_0x416e('0x19')],_0x5d8852[_0x416e('0x1b')],_0x5d8852[_0x416e('0x19')]));switch(_0x5d8852[_0x416e('0x1b')]){case _0x416e('0x1c'):case _0x416e('0x1d'):if(!startsWith(exclude,_0x5d8852['device'])){members[_0x5d8852[_0x416e('0x19')]]={'channel':_0x416e('0x1e'),'interface':_0x5d8852[_0x416e('0x19')],'type':_0x416e('0x1f'),'enterAt':utils[_0x416e('0x20')](),'role':_0x416e('0x21')};}break;case'NOT_INUSE':if(!_[_0x416e('0x22')](members[_0x5d8852[_0x416e('0x19')]])){members[_0x5d8852[_0x416e('0x19')]]['exitAt']=utils[_0x416e('0x20')]();members[_0x5d8852[_0x416e('0x19')]][_0x416e('0x23')]=utils[_0x416e('0x24')](members[_0x5d8852['device']][_0x416e('0x25')],members[_0x5d8852[_0x416e('0x19')]][_0x416e('0x26')]);if(members[_0x5d8852[_0x416e('0x19')]][_0x416e('0x6')]){writeDB(members[_0x5d8852[_0x416e('0x19')]]);}}break;default:break;}}catch(_0x117e11){utils[_0x416e('0x14')](util[_0x416e('0x5')]('[%s][members][devicestatechange]',members[_0x5d8852[_0x416e('0x19')]]?members[_0x5d8852[_0x416e('0x19')]][_0x416e('0x6')]:_0x5d8852[_0x416e('0x19')]),_0x117e11);}};exports[_0x416e('0x27')]=function(_0x40f504){try{if(!_[_0x416e('0x22')](members[_0x40f504['interface']])){utils[_0x416e('0x17')](util[_0x416e('0x5')](_0x416e('0x28'),_0x40f504['uniqueid']),_0x40f504);utils[_0x416e('0x29')](util[_0x416e('0x5')](_0x416e('0x2a'),_0x40f504[_0x416e('0x6')],_0x40f504[_0x416e('0x7')],_0x40f504[_0x416e('0x2b')]));members[_0x40f504[_0x416e('0x7')]]=_[_0x416e('0x2c')](members[_0x40f504[_0x416e('0x7')]],{'data4':_0x40f504[_0x416e('0x2b')],'uniqueid':_0x40f504['uniqueid']});}}catch(_0xf5add1){utils[_0x416e('0x14')](util[_0x416e('0x5')]('[%s][members][agentcomplete]',_0x40f504[_0x416e('0x6')]),_0xf5add1);}};exports[_0x416e('0x2d')]=function(_0x218e78){try{utils['debug'](util[_0x416e('0x5')](_0x416e('0x2e'),_0x218e78['uniqueid']),_0x218e78);if(_0x218e78[_0x416e('0x2f')]){var _0x5abc31=_0x218e78['channel'][_0x416e('0x11')]('-')[0x0];if(!_[_0x416e('0x22')](members[_0x5abc31])){members[_0x5abc31]=_[_0x416e('0x2c')](members[_0x5abc31],{'data1':members[_0x5abc31][_0x416e('0x30')]||_0x218e78[_0x416e('0xa')],'data2':members[_0x5abc31][_0x416e('0x8')]||_0x218e78[_0x416e('0x31')],'data3':members[_0x5abc31][_0x416e('0x32')]||_0x218e78[_0x416e('0x33')],'uniqueid':members[_0x5abc31]['uniqueid']||_0x218e78[_0x416e('0x6')]});utils['info'](util[_0x416e('0x5')](_0x416e('0x34'),_0x218e78['uniqueid'],members[_0x5abc31][_0x416e('0x30')],members[_0x5abc31]['data2'],members[_0x5abc31][_0x416e('0x32')]));if(members[_0x5abc31][_0x416e('0x25')]){writeDB(members[_0x5abc31]);}}}if(_0x218e78['destinationchannel']){var _0x24e7ad=_0x218e78[_0x416e('0x35')][_0x416e('0x11')]('-')[0x0];if(!_['isNil'](members[_0x24e7ad])){members[_0x24e7ad]=_['assign'](members[_0x24e7ad],{'data1':members[_0x24e7ad]['data1']||_0x218e78[_0x416e('0xa')],'data2':members[_0x24e7ad][_0x416e('0x8')]||_0x218e78[_0x416e('0x31')],'data3':members[_0x24e7ad][_0x416e('0x32')]||_0x218e78[_0x416e('0x33')],'uniqueid':members[_0x24e7ad][_0x416e('0x6')]||_0x218e78[_0x416e('0x6')]});utils[_0x416e('0x29')](util[_0x416e('0x5')](_0x416e('0x34'),_0x218e78[_0x416e('0x6')],members[_0x24e7ad]['data1'],members[_0x24e7ad][_0x416e('0x8')],members[_0x24e7ad]['data3']));if(members[_0x24e7ad]['exitAt']){writeDB(members[_0x24e7ad]);}}}}catch(_0x285d1a){utils[_0x416e('0x14')](util[_0x416e('0x5')](_0x416e('0x2e'),_0x218e78[_0x416e('0x6')]),_0x285d1a);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b2367e5..38dfc62 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x812e=['extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transferexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','uniqueid','hangup','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','isNil','queuecallerexitAt','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','membername','assigned','destaccountcode','[%s][queues][agentconnect]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x812e,0x161));var _0xe812=function(_0x16ee22,_0x3c5612){_0x16ee22=_0x16ee22-0x0;var _0x4cc4e6=_0x812e[_0x16ee22];return _0x4cc4e6;};'use strict';var _=require(_0xe812('0x0'));var util=require(_0xe812('0x1'));var utils=require(_0xe812('0x2'));var queues={};function writeDB(_0x52a01e){utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x5'),_0x52a01e['uniqueid'],_0x52a01e[_0xe812('0x6')],_0x52a01e[_0xe812('0x7')],_0x52a01e[_0xe812('0x8')],_0x52a01e[_0xe812('0x9')],_0x52a01e[_0xe812('0xa')],_0x52a01e[_0xe812('0xb')]));if(_0x52a01e[_0xe812('0x7')]){utils[_0xe812('0xc')](_0x52a01e[_0xe812('0x7')])['then'](function(_0x5d847f){if(_0x5d847f){_0x52a01e[_0xe812('0xd')]=_0x5d847f[_0xe812('0xd')];}utils[_0xe812('0xe')](_0xe812('0xf'),_0x52a01e);});}else{utils[_0xe812('0xe')](_0xe812('0xf'),_0x52a01e);}if(_0x52a01e[_0xe812('0x10')]){delete queues[_0x52a01e[_0xe812('0x10')]];}else{delete queues[_0x52a01e['uniqueid']];}}exports[_0xe812('0x11')]=function(_0x99ba55){try{utils['debug'](util[_0xe812('0x4')](_0xe812('0x12'),_0x99ba55['uniqueid']),_0x99ba55);utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x13'),_0x99ba55['uniqueid'],_0x99ba55[_0xe812('0x7')],_0x99ba55['position']));queues[_0x99ba55['uniqueid']]=_[_0xe812('0x14')](_0x99ba55,{'originalposition':_0x99ba55['position'],'queuecallerjoinAt':utils[_0xe812('0x15')](),'mohtime':0x0});}catch(_0x20313e){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x12'),_0x99ba55[_0xe812('0x17')]),_0x20313e);}};exports[_0xe812('0x18')]=function(_0x3c0b26){try{if(!_['isNil'](queues[_0x3c0b26[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x1a'),_0x3c0b26[_0xe812('0x17')]),_0x3c0b26);if(queues[_0x3c0b26['uniqueid']][_0xe812('0x1b')]){if(!queues[_0x3c0b26['uniqueid']][_0xe812('0x1c')]&&!queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x1d')]){queues[_0x3c0b26['uniqueid']][_0xe812('0x1e')]=!![];queues[_0x3c0b26['uniqueid']][_0xe812('0x1f')]=utils[_0xe812('0x15')]();queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x20');}utils[_0xe812('0x3')](util['format'](_0xe812('0x21'),_0x3c0b26[_0xe812('0x17')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0xb')]));writeDB(queues[_0x3c0b26['uniqueid']]);}else if(queues[_0x3c0b26[_0xe812('0x17')]]['transfereduniqueid']){utils['info'](util[_0xe812('0x4')](_0xe812('0x23'),_0x3c0b26[_0xe812('0x17')],queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x3c0b26['uniqueid']][_0xe812('0x10')]));queues[queues[_0x3c0b26[_0xe812('0x17')]]['transfereduniqueid']]=queues[_0x3c0b26[_0xe812('0x17')]];queues[queues[_0x3c0b26[_0xe812('0x17')]][_0xe812('0x10')]][_0xe812('0x24')]=0x2;delete queues[_0x3c0b26[_0xe812('0x17')]];}}}catch(_0x360dd6){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x1a'),_0x3c0b26[_0xe812('0x17')]),_0x360dd6);}};exports[_0xe812('0x25')]=function(_0x17e692){try{utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x26'),_0x17e692[_0xe812('0x17')]),_0x17e692);if(!_['isNil'](_0x17e692[_0xe812('0x27')][_0xe812('0x28')])&&_0x17e692[_0xe812('0x29')][_0xe812('0x2a')]()!=='CONTINUE'){if(!_[_0xe812('0x2b')](queues[_0x17e692['uniqueid']])){queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0x17e692[_0xe812('0x17')]]['queuecallerabandonAt']=null;queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1d')]=!![];queues[_0x17e692['uniqueid']][_0xe812('0x2c')]=utils[_0xe812('0x15')]();queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]=_0x17e692['value']['toUpperCase']();utils[_0xe812('0x3')](util[_0xe812('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x17e692[_0xe812('0x17')],queues[_0x17e692['uniqueid']][_0xe812('0x22')],_0x17e692[_0xe812('0x29')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]));writeDB(queues[_0x17e692['uniqueid']]);}}else if(!_[_0xe812('0x2b')](_0x17e692['variable']['queueposition'])){if(!_['isNil'](queues[_0x17e692[_0xe812('0x17')]])&&!queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1c')]){queues[_0x17e692['uniqueid']][_0xe812('0x1c')]=![];queues[_0x17e692['uniqueid']][_0xe812('0x2d')]=null;queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x1d')]=!![];queues[_0x17e692['uniqueid']][_0xe812('0x2c')]=utils['now']();queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x2e');utils['info'](util['format'](_0xe812('0x2f'),_0x17e692[_0xe812('0x17')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0x22')],_0x17e692[_0xe812('0x29')],queues[_0x17e692[_0xe812('0x17')]][_0xe812('0xb')]));}}}catch(_0x503231){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x26'),_0x17e692[_0xe812('0x17')]),_0x503231);}};exports['queuecallerabandon']=function(_0x23ed9e){try{if(!_[_0xe812('0x2b')](queues[_0x23ed9e['uniqueid']])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][queuecallerabandon]',_0x23ed9e[_0xe812('0x17')]),_0x23ed9e);queues[_0x23ed9e['uniqueid']][_0xe812('0x1d')]=![];queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0x2c')]=null;queues[_0x23ed9e['uniqueid']]['queuecallerabandon']=!![];queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0x2d')]=utils[_0xe812('0x15')]();queues[_0x23ed9e[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x30');utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x31'),_0x23ed9e[_0xe812('0x17')],queues[_0x23ed9e[_0xe812('0x17')]]['name'],queues[_0x23ed9e['uniqueid']][_0xe812('0xb')]));}}catch(_0x92ff61){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x32'),_0x23ed9e[_0xe812('0x17')]),_0x92ff61);}};exports['queuecallerleave']=function(_0x40d6fa){try{if(!_[_0xe812('0x2b')](queues[_0x40d6fa[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x33'),_0x40d6fa['uniqueid']),_0x40d6fa);utils[_0xe812('0x3')](util['format'](_0xe812('0x34'),_0x40d6fa[_0xe812('0x17')],queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x22')],_0x40d6fa['connectedlinenum'],_0x40d6fa['connectedlinename']));queues[_0x40d6fa[_0xe812('0x17')]]['queuecallerleave']=!![];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x1b')]=utils[_0xe812('0x15')]();queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x35')]=utils[_0xe812('0x36')](queues[_0x40d6fa[_0xe812('0x17')]]['queuecallerleaveAt'],queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x37')]);queues[_0x40d6fa[_0xe812('0x17')]]['position']=_0x40d6fa[_0xe812('0x38')];queues[_0x40d6fa['uniqueid']][_0xe812('0x39')]=_0x40d6fa[_0xe812('0x39')];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x3a')]=_0x40d6fa[_0xe812('0x3a')];queues[_0x40d6fa[_0xe812('0x17')]][_0xe812('0x3b')]=_0x40d6fa[_0xe812('0x3b')];}}catch(_0x1c714b){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x33'),_0x40d6fa[_0xe812('0x17')]),_0x1c714b);}};exports['agentconnect']=function(_0x20b194){try{if(!_[_0xe812('0x2b')](queues[_0x20b194[_0xe812('0x17')]])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][agentconnect]',_0x20b194[_0xe812('0x17')]),_0x20b194);utils[_0xe812('0x3')](util[_0xe812('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x20b194[_0xe812('0x17')],queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x22')],_0x20b194[_0xe812('0x3c')],_0x20b194['destaccountcode']));queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0x20b194[_0xe812('0x17')]]['queuecallerabandon']=![];queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x2d')]=null;queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x1d')]=![];queues[_0x20b194['uniqueid']][_0xe812('0xb')]=null;queues[_0x20b194['uniqueid']][_0xe812('0x2c')]=null;queues[_0x20b194[_0xe812('0x17')]][_0xe812('0x3d')]=!![];queues[_0x20b194['uniqueid']]['accountcode']=_0x20b194[_0xe812('0x3e')];queues[_0x20b194['uniqueid']][_0xe812('0x8')]=_0x20b194[_0xe812('0x3c')];}}catch(_0x5d5c18){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x3f'),_0x20b194[_0xe812('0x17')]),_0x5d5c18);}};exports['agentcomplete']=function(_0xcf8cee){try{if(!_['isNil'](queues[_0xcf8cee[_0xe812('0x17')]])){if(queues[_0xcf8cee['uniqueid']][_0xe812('0x1b')]){utils[_0xe812('0x19')](util['format']('[%s][queues][agentcomplete]',_0xcf8cee[_0xe812('0x17')]),_0xcf8cee);queues[_0xcf8cee[_0xe812('0x17')]]['queuecallerabandon']=![];queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x1c')]=![];queues[_0xcf8cee['uniqueid']][_0xe812('0x2d')]=null;queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x1d')]=![];queues[_0xcf8cee['uniqueid']][_0xe812('0x2c')]=null;queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x3d')]=!![];queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x8')]=_0xcf8cee['membername'];queues[_0xcf8cee['uniqueid']][_0xe812('0x1e')]=!![];queues[_0xcf8cee['uniqueid']][_0xe812('0x1f')]=utils[_0xe812('0x15')]();if(_0xcf8cee[_0xe812('0x40')]==_0xe812('0x41')){if(!queues[_0xcf8cee['uniqueid']][_0xe812('0x41')]){queues[_0xcf8cee['uniqueid']][_0xe812('0xb')]=_0xe812('0x42');}}else{queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0xb')]=_0xe812('0x43')+_0xcf8cee[_0xe812('0x40')]['toUpperCase']();}utils['info'](util[_0xe812('0x4')](_0xe812('0x44'),_0xcf8cee[_0xe812('0x17')],queues[_0xcf8cee[_0xe812('0x17')]][_0xe812('0x22')],_0xcf8cee[_0xe812('0x3c')],queues[_0xcf8cee[_0xe812('0x17')]]['queuecallerexitreason']));writeDB(queues[_0xcf8cee[_0xe812('0x17')]]);}}}catch(_0x37e504){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x45'),_0xcf8cee[_0xe812('0x17')]),_0x37e504);}};exports[_0xe812('0x46')]=function(_0x212f20){try{if(!_[_0xe812('0x2b')](queues[_0x212f20[_0xe812('0x47')]])){utils[_0xe812('0x19')](util['format'](_0xe812('0x48'),_0x212f20[_0xe812('0x17')]),_0x212f20);queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x41')]=!![];queues[_0x212f20['transfereeuniqueid']][_0xe812('0x49')]=_0xe812('0x4a');queues[_0x212f20[_0xe812('0x47')]]['transferexten']=_0x212f20[_0xe812('0x4b')];queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x4c')]=_0x212f20['transfereeuniqueid'];queues[_0x212f20[_0xe812('0x47')]][_0xe812('0xb')]=_0xe812('0x4d');utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x4e'),_0x212f20[_0xe812('0x17')],queues[_0x212f20[_0xe812('0x47')]][_0xe812('0x22')],_0x212f20[_0xe812('0x47')],_0x212f20[_0xe812('0x4b')]));}}catch(_0x2fe3ae){utils[_0xe812('0x16')](util[_0xe812('0x4')](_0xe812('0x48'),_0x212f20['uniqueid']),_0x2fe3ae);}};exports[_0xe812('0x4f')]=function(_0x320efe){try{utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x50'),_0x320efe[_0xe812('0x51')]),_0x320efe);if(_0x320efe['origtransfereruniqueid']==_0x320efe[_0xe812('0x52')]){if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x53')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x22')],_0x320efe['origtransfererexten']));queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x41')]=!![];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x49')]=_0xe812('0x54');queues[_0x320efe[_0xe812('0x53')]]['transferexten']=_0x320efe[_0xe812('0x55')];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x4c')]=_0x320efe[_0xe812('0x51')];queues[_0x320efe[_0xe812('0x53')]][_0xe812('0xb')]=_0xe812('0x56');}if(!_[_0xe812('0x2b')](queues[_0x320efe['origtransfererlinkedid']])){if(_0x320efe[_0xe812('0x57')]&&queues[_0x320efe[_0xe812('0x57')]]){queues[_0x320efe[_0xe812('0x57')]][_0xe812('0x24')]=0x1;queues[_0x320efe['transfereeuniqueid']]=_[_0xe812('0x58')](queues[_0x320efe[_0xe812('0x57')]]);queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x59')];queues[_0x320efe['transfereeuniqueid']][_0xe812('0x24')]=0x2;queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x9')]=queues[_0x320efe['secondtransfererlinkedid']][_0xe812('0x9')];queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x5a')]=queues[_0x320efe[_0xe812('0x53')]]['calleridname'];queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x37')]=utils[_0xe812('0x15')]();queues[_0x320efe[_0xe812('0x47')]]['queuecallerleaveAt']=utils['now']();queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x35')]=0x0;queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x5b')]=0x0;utils['info'](util[_0xe812('0x4')](_0xe812('0x5c'),_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x22')],queues[_0x320efe[_0xe812('0x47')]][_0xe812('0x9')],queues[_0x320efe['transfereeuniqueid']][_0xe812('0x5a')]));}else{utils['info'](util[_0xe812('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x320efe[_0xe812('0x51')],queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x22')],_0x320efe[_0xe812('0x53')]));queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x10')]=_0x320efe['secondtransfererlinkedid'];}}}else if(_0x320efe[_0xe812('0x5d')]==_0x320efe['secondtransfererlinkedid']){if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x52')]])){utils[_0xe812('0x3')](util['format'](_0xe812('0x5e'),_0x320efe[_0xe812('0x51')],queues[_0x320efe['origtransfererlinkedid']][_0xe812('0x22')],_0x320efe[_0xe812('0x5d')],_0x320efe[_0xe812('0x5f')]));queues[_0x320efe[_0xe812('0x52')]]['transfer']=!![];queues[_0x320efe['origtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x60')]=_0x320efe[_0xe812('0x5f')];queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x4c')]=_0x320efe[_0xe812('0x5d')];queues[_0x320efe[_0xe812('0x52')]][_0xe812('0xb')]='ATTENDEDTRANSFER';}if(!_[_0xe812('0x2b')](queues[_0x320efe[_0xe812('0x53')]])){if(_0x320efe[_0xe812('0x61')]&&queues[_0x320efe[_0xe812('0x61')]]){queues[_0x320efe[_0xe812('0x61')]]['queuecallerenterreason']=0x1;queues[_0x320efe[_0xe812('0x59')]]=_[_0xe812('0x58')](queues[_0x320efe[_0xe812('0x61')]]);queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x59')];queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x24')]=0x2;queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x9')]=queues[_0x320efe['origtransfererlinkedid']][_0xe812('0x9')];queues[_0x320efe[_0xe812('0x59')]]['calleridname']=queues[_0x320efe[_0xe812('0x52')]][_0xe812('0x5a')];queues[_0x320efe['transfertargetuniqueid']][_0xe812('0x37')]=utils[_0xe812('0x15')]();queues[_0x320efe['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xe812('0x15')]();queues[_0x320efe[_0xe812('0x59')]]['holdtime']=0x0;queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x5b')]=0x0;utils[_0xe812('0x3')](util['format'](_0xe812('0x62'),_0x320efe[_0xe812('0x51')],queues[_0x320efe['transfertargetuniqueid']]['name'],queues[_0x320efe[_0xe812('0x59')]]['transfereduniqueid'],queues[_0x320efe[_0xe812('0x59')]][_0xe812('0x9')],queues[_0x320efe['transfertargetuniqueid']][_0xe812('0x5a')]));}else{utils[_0xe812('0x3')](util[_0xe812('0x4')](_0xe812('0x63'),_0x320efe['origtransfereruniqueid'],queues[_0x320efe['secondtransfererlinkedid']][_0xe812('0x22')],_0x320efe['origtransfererlinkedid']));queues[_0x320efe[_0xe812('0x53')]][_0xe812('0x10')]=_0x320efe[_0xe812('0x52')];}}}}catch(_0x29ed04){utils['error'](util['format']('[%s][queues][attendedtransfer]',_0x320efe[_0xe812('0x51')]),_0x29ed04);}};exports[_0xe812('0x64')]=function(_0x1dafaf){try{if(!_[_0xe812('0x2b')](queues[_0x1dafaf['uniqueid']])){utils[_0xe812('0x19')](util[_0xe812('0x4')]('[%s][queues][musiconholdstart]',_0x1dafaf[_0xe812('0x17')]),_0x1dafaf);queues[_0x1dafaf[_0xe812('0x17')]][_0xe812('0x65')]=utils[_0xe812('0x15')]();utils[_0xe812('0x3')](util['format'](_0xe812('0x66'),_0x1dafaf[_0xe812('0x17')],queues[_0x1dafaf['uniqueid']]['name'],queues[_0x1dafaf[_0xe812('0x17')]][_0xe812('0x65')]));}}catch(_0x49edfc){utils[_0xe812('0x16')](util['format'](_0xe812('0x67'),_0x1dafaf[_0xe812('0x17')]),_0x49edfc);}};exports[_0xe812('0x68')]=function(_0x2b5e58){try{if(!_[_0xe812('0x2b')](queues[_0x2b5e58[_0xe812('0x17')]])){if(!_['isNil'](queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x65')])){utils[_0xe812('0x19')](util[_0xe812('0x4')](_0xe812('0x69'),_0x2b5e58[_0xe812('0x17')]),_0x2b5e58);queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x5b')]+=utils[_0xe812('0x36')](utils[_0xe812('0x15')](),queues[_0x2b5e58[_0xe812('0x17')]]['musiconholdstartAt']);utils['info'](util[_0xe812('0x4')](_0xe812('0x6a'),_0x2b5e58[_0xe812('0x17')],queues[_0x2b5e58[_0xe812('0x17')]][_0xe812('0x22')],queues[_0x2b5e58[_0xe812('0x17')]]['mohtime']));delete queues[_0x2b5e58[_0xe812('0x17')]]['musiconholdstartAt'];}}}catch(_0x3e0cfd){utils['error'](util['format'](_0xe812('0x69'),_0x2b5e58[_0xe812('0x17')]),_0x3e0cfd);}}; \ No newline at end of file +var _0x4d2d=['format','position','assign','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerexit','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x4d2d,0x1f2));var _0xd4d2=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x4d2d[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xd4d2('0x0'));var util=require(_0xd4d2('0x1'));var utils=require(_0xd4d2('0x2'));var queues={};function writeDB(_0x40c715){utils[_0xd4d2('0x3')](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x40c715[_0xd4d2('0x4')],_0x40c715['channel'],_0x40c715[_0xd4d2('0x5')],_0x40c715[_0xd4d2('0x6')],_0x40c715[_0xd4d2('0x7')],_0x40c715[_0xd4d2('0x8')],_0x40c715[_0xd4d2('0x9')]));if(_0x40c715[_0xd4d2('0x5')]){utils[_0xd4d2('0xa')](_0x40c715[_0xd4d2('0x5')])[_0xd4d2('0xb')](function(_0x5024f1){if(_0x5024f1){_0x40c715[_0xd4d2('0xc')]=_0x5024f1[_0xd4d2('0xc')];}utils[_0xd4d2('0xd')](_0xd4d2('0xe'),_0x40c715);});}else{utils[_0xd4d2('0xd')](_0xd4d2('0xe'),_0x40c715);}if(_0x40c715[_0xd4d2('0xf')]){delete queues[_0x40c715[_0xd4d2('0xf')]];}else{delete queues[_0x40c715['uniqueid']];}}exports[_0xd4d2('0x10')]=function(_0x1fcc75){try{utils['debug'](util[_0xd4d2('0x11')]('[%s][queues][queuecallerjoin]',_0x1fcc75[_0xd4d2('0x4')]),_0x1fcc75);utils[_0xd4d2('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1fcc75[_0xd4d2('0x4')],_0x1fcc75[_0xd4d2('0x5')],_0x1fcc75[_0xd4d2('0x12')]));queues[_0x1fcc75[_0xd4d2('0x4')]]=_[_0xd4d2('0x13')](_0x1fcc75,{'originalposition':_0x1fcc75[_0xd4d2('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x460778){utils['error'](util[_0xd4d2('0x11')]('[%s][queues][queuecallerjoin]',_0x1fcc75['uniqueid']),_0x460778);}};exports[_0xd4d2('0x14')]=function(_0x3c5c47){try{if(!_[_0xd4d2('0x15')](queues[_0x3c5c47[_0xd4d2('0x4')]])){utils[_0xd4d2('0x16')](util['format'](_0xd4d2('0x17'),_0x3c5c47[_0xd4d2('0x4')]),_0x3c5c47);if(queues[_0x3c5c47[_0xd4d2('0x4')]]['queuecallerleaveAt']){if(!queues[_0x3c5c47['uniqueid']][_0xd4d2('0x18')]&&!queues[_0x3c5c47[_0xd4d2('0x4')]]['queuecallerexit']){queues[_0x3c5c47[_0xd4d2('0x4')]][_0xd4d2('0x19')]=!![];queues[_0x3c5c47[_0xd4d2('0x4')]]['queuecallercompleteAt']=utils[_0xd4d2('0x1a')]();queues[_0x3c5c47['uniqueid']]['queuecallerexitreason']=_0xd4d2('0x1b');}utils['info'](util[_0xd4d2('0x11')](_0xd4d2('0x1c'),_0x3c5c47[_0xd4d2('0x4')],queues[_0x3c5c47[_0xd4d2('0x4')]][_0xd4d2('0x1d')],queues[_0x3c5c47[_0xd4d2('0x4')]][_0xd4d2('0x9')]));writeDB(queues[_0x3c5c47['uniqueid']]);}else if(queues[_0x3c5c47[_0xd4d2('0x4')]][_0xd4d2('0xf')]){utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3c5c47[_0xd4d2('0x4')],queues[_0x3c5c47[_0xd4d2('0x4')]][_0xd4d2('0x1d')],queues[_0x3c5c47['uniqueid']][_0xd4d2('0xf')]));queues[queues[_0x3c5c47['uniqueid']][_0xd4d2('0xf')]]=queues[_0x3c5c47['uniqueid']];queues[queues[_0x3c5c47['uniqueid']]['transfereduniqueid']][_0xd4d2('0x1e')]=0x2;delete queues[_0x3c5c47[_0xd4d2('0x4')]];}}}catch(_0x30936a){utils['error'](util[_0xd4d2('0x11')](_0xd4d2('0x17'),_0x3c5c47[_0xd4d2('0x4')]),_0x30936a);}};exports[_0xd4d2('0x1f')]=function(_0x5474c4){try{utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')]('[%s][queues][varset]',_0x5474c4[_0xd4d2('0x4')]),_0x5474c4);if(!_['isNil'](_0x5474c4[_0xd4d2('0x20')][_0xd4d2('0x21')])&&_0x5474c4[_0xd4d2('0x22')][_0xd4d2('0x23')]()!=='CONTINUE'){if(!_[_0xd4d2('0x15')](queues[_0x5474c4['uniqueid']])){queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x18')]=![];queues[_0x5474c4['uniqueid']][_0xd4d2('0x24')]=null;queues[_0x5474c4[_0xd4d2('0x4')]]['queuecallerexit']=!![];queues[_0x5474c4['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x9')]=_0x5474c4['value'][_0xd4d2('0x23')]();utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x25'),_0x5474c4['uniqueid'],queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x1d')],_0x5474c4[_0xd4d2('0x22')],queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x9')]));writeDB(queues[_0x5474c4[_0xd4d2('0x4')]]);}}else if(!_[_0xd4d2('0x15')](_0x5474c4['variable'][_0xd4d2('0x26')])){if(!_[_0xd4d2('0x15')](queues[_0x5474c4[_0xd4d2('0x4')]])&&!queues[_0x5474c4[_0xd4d2('0x4')]]['queuecallerabandon']){queues[_0x5474c4[_0xd4d2('0x4')]]['queuecallerabandon']=![];queues[_0x5474c4['uniqueid']]['queuecallerabandonAt']=null;queues[_0x5474c4[_0xd4d2('0x4')]]['queuecallerexit']=!![];queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x27')]=utils[_0xd4d2('0x1a')]();queues[_0x5474c4[_0xd4d2('0x4')]][_0xd4d2('0x9')]=_0xd4d2('0x28');utils['info'](util['format'](_0xd4d2('0x29'),_0x5474c4['uniqueid'],queues[_0x5474c4[_0xd4d2('0x4')]]['name'],_0x5474c4[_0xd4d2('0x22')],queues[_0x5474c4['uniqueid']]['queuecallerexitreason']));}}}catch(_0x2db4c4){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')](_0xd4d2('0x2b'),_0x5474c4[_0xd4d2('0x4')]),_0x2db4c4);}};exports[_0xd4d2('0x18')]=function(_0x2c4bff){try{if(!_['isNil'](queues[_0x2c4bff[_0xd4d2('0x4')]])){utils['debug'](util[_0xd4d2('0x11')](_0xd4d2('0x2c'),_0x2c4bff['uniqueid']),_0x2c4bff);queues[_0x2c4bff['uniqueid']][_0xd4d2('0x2d')]=![];queues[_0x2c4bff['uniqueid']][_0xd4d2('0x27')]=null;queues[_0x2c4bff['uniqueid']][_0xd4d2('0x18')]=!![];queues[_0x2c4bff['uniqueid']][_0xd4d2('0x24')]=utils[_0xd4d2('0x1a')]();queues[_0x2c4bff[_0xd4d2('0x4')]]['queuecallerexitreason']='ABANDONED';utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x2c4bff[_0xd4d2('0x4')],queues[_0x2c4bff['uniqueid']][_0xd4d2('0x1d')],queues[_0x2c4bff[_0xd4d2('0x4')]]['queuecallerexitreason']));}}catch(_0x15f3c5){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')](_0xd4d2('0x2c'),_0x2c4bff[_0xd4d2('0x4')]),_0x15f3c5);}};exports[_0xd4d2('0x2e')]=function(_0x53b81f){try{if(!_[_0xd4d2('0x15')](queues[_0x53b81f[_0xd4d2('0x4')]])){utils['debug'](util[_0xd4d2('0x11')](_0xd4d2('0x2f'),_0x53b81f['uniqueid']),_0x53b81f);utils['info'](util[_0xd4d2('0x11')](_0xd4d2('0x30'),_0x53b81f[_0xd4d2('0x4')],queues[_0x53b81f[_0xd4d2('0x4')]]['name'],_0x53b81f[_0xd4d2('0x31')],_0x53b81f['connectedlinename']));queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x2e')]=!![];queues[_0x53b81f[_0xd4d2('0x4')]]['queuecallerleaveAt']=utils[_0xd4d2('0x1a')]();queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x32')]=utils[_0xd4d2('0x33')](queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x34')],queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x35')]);queues[_0x53b81f[_0xd4d2('0x4')]]['position']=_0x53b81f[_0xd4d2('0x12')];queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x36')]=_0x53b81f['count'];queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x31')]=_0x53b81f[_0xd4d2('0x31')];queues[_0x53b81f[_0xd4d2('0x4')]][_0xd4d2('0x37')]=_0x53b81f[_0xd4d2('0x37')];}}catch(_0xaeb203){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')]('[%s][queues][queuecallerleave]',_0x53b81f['uniqueid']),_0xaeb203);}};exports[_0xd4d2('0x38')]=function(_0x4f4c97){try{if(!_[_0xd4d2('0x15')](queues[_0x4f4c97[_0xd4d2('0x4')]])){utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')](_0xd4d2('0x39'),_0x4f4c97['uniqueid']),_0x4f4c97);utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x3a'),_0x4f4c97[_0xd4d2('0x4')],queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x1d')],_0x4f4c97['membername'],_0x4f4c97[_0xd4d2('0x3b')]));queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x18')]=![];queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x18')]=![];queues[_0x4f4c97[_0xd4d2('0x4')]]['queuecallerabandonAt']=null;queues[_0x4f4c97['uniqueid']][_0xd4d2('0x2d')]=![];queues[_0x4f4c97['uniqueid']][_0xd4d2('0x9')]=null;queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x27')]=null;queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x3c')]=!![];queues[_0x4f4c97['uniqueid']][_0xd4d2('0x8')]=_0x4f4c97['destaccountcode'];queues[_0x4f4c97[_0xd4d2('0x4')]][_0xd4d2('0x6')]=_0x4f4c97[_0xd4d2('0x3d')];}}catch(_0x39741d){utils['error'](util['format'](_0xd4d2('0x39'),_0x4f4c97['uniqueid']),_0x39741d);}};exports[_0xd4d2('0x3e')]=function(_0x41f952){try{if(!_[_0xd4d2('0x15')](queues[_0x41f952[_0xd4d2('0x4')]])){if(queues[_0x41f952[_0xd4d2('0x4')]]['queuecallerleaveAt']){utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')](_0xd4d2('0x3f'),_0x41f952[_0xd4d2('0x4')]),_0x41f952);queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x18')]=![];queues[_0x41f952['uniqueid']][_0xd4d2('0x18')]=![];queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x24')]=null;queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x2d')]=![];queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x27')]=null;queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x3c')]=!![];queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x6')]=_0x41f952[_0xd4d2('0x3d')];queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x19')]=!![];queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x40')]=utils['now']();if(_0x41f952[_0xd4d2('0x41')]==_0xd4d2('0x42')){if(!queues[_0x41f952[_0xd4d2('0x4')]]['transfer']){queues[_0x41f952['uniqueid']]['queuecallerexitreason']=_0xd4d2('0x43');}}else{queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x9')]=_0xd4d2('0x44')+_0x41f952[_0xd4d2('0x41')][_0xd4d2('0x23')]();}utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x45'),_0x41f952[_0xd4d2('0x4')],queues[_0x41f952['uniqueid']]['name'],_0x41f952['membername'],queues[_0x41f952[_0xd4d2('0x4')]][_0xd4d2('0x9')]));writeDB(queues[_0x41f952[_0xd4d2('0x4')]]);}}}catch(_0xbd775f){utils[_0xd4d2('0x2a')](util['format'](_0xd4d2('0x3f'),_0x41f952[_0xd4d2('0x4')]),_0xbd775f);}};exports[_0xd4d2('0x46')]=function(_0x379d16){try{if(!_['isNil'](queues[_0x379d16['transfereeuniqueid']])){utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')]('[%s][queues][blindtransfer]',_0x379d16[_0xd4d2('0x4')]),_0x379d16);queues[_0x379d16[_0xd4d2('0x47')]][_0xd4d2('0x42')]=!![];queues[_0x379d16[_0xd4d2('0x47')]]['transfertype']=_0xd4d2('0x48');queues[_0x379d16['transfereeuniqueid']][_0xd4d2('0x49')]=_0x379d16[_0xd4d2('0x4a')];queues[_0x379d16[_0xd4d2('0x47')]][_0xd4d2('0x4b')]=_0x379d16[_0xd4d2('0x47')];queues[_0x379d16[_0xd4d2('0x47')]][_0xd4d2('0x9')]='BLINDTRANSFER';utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x4c'),_0x379d16[_0xd4d2('0x4')],queues[_0x379d16[_0xd4d2('0x47')]]['name'],_0x379d16[_0xd4d2('0x47')],_0x379d16[_0xd4d2('0x4a')]));}}catch(_0x29ac4a){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')](_0xd4d2('0x4d'),_0x379d16[_0xd4d2('0x4')]),_0x29ac4a);}};exports['attendedtransfer']=function(_0x49a11a){try{utils['debug'](util[_0xd4d2('0x11')]('[%s][queues][attendedtransfer]',_0x49a11a[_0xd4d2('0x4e')]),_0x49a11a);if(_0x49a11a['origtransfereruniqueid']==_0x49a11a[_0xd4d2('0x4f')]){if(!_[_0xd4d2('0x15')](queues[_0x49a11a[_0xd4d2('0x50')]])){utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x49a11a[_0xd4d2('0x4e')],queues[_0x49a11a['secondtransfererlinkedid']][_0xd4d2('0x1d')],_0x49a11a[_0xd4d2('0x51')]));queues[_0x49a11a[_0xd4d2('0x50')]][_0xd4d2('0x42')]=!![];queues[_0x49a11a[_0xd4d2('0x50')]][_0xd4d2('0x52')]='ATTENDED';queues[_0x49a11a[_0xd4d2('0x50')]][_0xd4d2('0x49')]=_0x49a11a['origtransfererexten'];queues[_0x49a11a['secondtransfererlinkedid']][_0xd4d2('0x4b')]=_0x49a11a[_0xd4d2('0x4e')];queues[_0x49a11a[_0xd4d2('0x50')]][_0xd4d2('0x9')]=_0xd4d2('0x53');}if(!_[_0xd4d2('0x15')](queues[_0x49a11a['origtransfererlinkedid']])){if(_0x49a11a[_0xd4d2('0x54')]&&queues[_0x49a11a['transfereelinkedid']]){queues[_0x49a11a['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x49a11a['transfereeuniqueid']]=_[_0xd4d2('0x55')](queues[_0x49a11a[_0xd4d2('0x54')]]);queues[_0x49a11a['transfereeuniqueid']][_0xd4d2('0xf')]=_0x49a11a[_0xd4d2('0x56')];queues[_0x49a11a['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x49a11a[_0xd4d2('0x47')]]['calleridnum']=queues[_0x49a11a['secondtransfererlinkedid']][_0xd4d2('0x7')];queues[_0x49a11a[_0xd4d2('0x47')]][_0xd4d2('0x57')]=queues[_0x49a11a[_0xd4d2('0x50')]]['calleridname'];queues[_0x49a11a['transfereeuniqueid']][_0xd4d2('0x35')]=utils[_0xd4d2('0x1a')]();queues[_0x49a11a[_0xd4d2('0x47')]][_0xd4d2('0x34')]=utils[_0xd4d2('0x1a')]();queues[_0x49a11a[_0xd4d2('0x47')]][_0xd4d2('0x32')]=0x0;queues[_0x49a11a[_0xd4d2('0x47')]]['mohtime']=0x0;utils['info'](util[_0xd4d2('0x11')](_0xd4d2('0x58'),_0x49a11a['origtransfereruniqueid'],queues[_0x49a11a[_0xd4d2('0x47')]][_0xd4d2('0x1d')],queues[_0x49a11a[_0xd4d2('0x47')]][_0xd4d2('0x7')],queues[_0x49a11a[_0xd4d2('0x47')]]['calleridname']));}else{utils[_0xd4d2('0x3')](util['format'](_0xd4d2('0x59'),_0x49a11a['origtransfereruniqueid'],queues[_0x49a11a[_0xd4d2('0x4f')]][_0xd4d2('0x1d')],_0x49a11a[_0xd4d2('0x50')]));queues[_0x49a11a[_0xd4d2('0x4f')]]['transfereduniqueid']=_0x49a11a[_0xd4d2('0x50')];}}}else if(_0x49a11a[_0xd4d2('0x5a')]==_0x49a11a[_0xd4d2('0x50')]){if(!_[_0xd4d2('0x15')](queues[_0x49a11a[_0xd4d2('0x4f')]])){utils['info'](util[_0xd4d2('0x11')](_0xd4d2('0x5b'),_0x49a11a[_0xd4d2('0x4e')],queues[_0x49a11a[_0xd4d2('0x4f')]]['name'],_0x49a11a[_0xd4d2('0x5a')],_0x49a11a[_0xd4d2('0x5c')]));queues[_0x49a11a[_0xd4d2('0x4f')]]['transfer']=!![];queues[_0x49a11a['origtransfererlinkedid']][_0xd4d2('0x52')]=_0xd4d2('0x5d');queues[_0x49a11a[_0xd4d2('0x4f')]][_0xd4d2('0x49')]=_0x49a11a[_0xd4d2('0x5c')];queues[_0x49a11a[_0xd4d2('0x4f')]][_0xd4d2('0x4b')]=_0x49a11a[_0xd4d2('0x5a')];queues[_0x49a11a[_0xd4d2('0x4f')]][_0xd4d2('0x9')]=_0xd4d2('0x53');}if(!_[_0xd4d2('0x15')](queues[_0x49a11a['secondtransfererlinkedid']])){if(_0x49a11a[_0xd4d2('0x5e')]&&queues[_0x49a11a['transfertargetlinkedid']]){queues[_0x49a11a[_0xd4d2('0x5e')]][_0xd4d2('0x1e')]=0x1;queues[_0x49a11a[_0xd4d2('0x56')]]=_['clone'](queues[_0x49a11a['transfertargetlinkedid']]);queues[_0x49a11a[_0xd4d2('0x56')]][_0xd4d2('0xf')]=_0x49a11a[_0xd4d2('0x56')];queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x1e')]=0x2;queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x7')]=queues[_0x49a11a[_0xd4d2('0x4f')]][_0xd4d2('0x7')];queues[_0x49a11a[_0xd4d2('0x56')]][_0xd4d2('0x57')]=queues[_0x49a11a[_0xd4d2('0x4f')]]['calleridname'];queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x35')]=utils[_0xd4d2('0x1a')]();queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x34')]=utils[_0xd4d2('0x1a')]();queues[_0x49a11a[_0xd4d2('0x56')]][_0xd4d2('0x32')]=0x0;queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x5f')]=0x0;utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x60'),_0x49a11a[_0xd4d2('0x4e')],queues[_0x49a11a[_0xd4d2('0x56')]][_0xd4d2('0x1d')],queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0xf')],queues[_0x49a11a[_0xd4d2('0x56')]][_0xd4d2('0x7')],queues[_0x49a11a['transfertargetuniqueid']][_0xd4d2('0x57')]));}else{utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x49a11a[_0xd4d2('0x4e')],queues[_0x49a11a[_0xd4d2('0x50')]][_0xd4d2('0x1d')],_0x49a11a['origtransfererlinkedid']));queues[_0x49a11a['secondtransfererlinkedid']][_0xd4d2('0xf')]=_0x49a11a['origtransfererlinkedid'];}}}}catch(_0x2f3e1e){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')](_0xd4d2('0x61'),_0x49a11a['origtransfereruniqueid']),_0x2f3e1e);}};exports['musiconholdstart']=function(_0x154c28){try{if(!_['isNil'](queues[_0x154c28[_0xd4d2('0x4')]])){utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')]('[%s][queues][musiconholdstart]',_0x154c28[_0xd4d2('0x4')]),_0x154c28);queues[_0x154c28[_0xd4d2('0x4')]][_0xd4d2('0x62')]=utils['now']();utils['info'](util[_0xd4d2('0x11')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x154c28[_0xd4d2('0x4')],queues[_0x154c28[_0xd4d2('0x4')]]['name'],queues[_0x154c28[_0xd4d2('0x4')]][_0xd4d2('0x62')]));}}catch(_0x378518){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')](_0xd4d2('0x63'),_0x154c28['uniqueid']),_0x378518);}};exports[_0xd4d2('0x64')]=function(_0x46c7f2){try{if(!_[_0xd4d2('0x15')](queues[_0x46c7f2[_0xd4d2('0x4')]])){if(!_[_0xd4d2('0x15')](queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x62')])){utils[_0xd4d2('0x16')](util[_0xd4d2('0x11')](_0xd4d2('0x65'),_0x46c7f2[_0xd4d2('0x4')]),_0x46c7f2);queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x5f')]+=utils[_0xd4d2('0x33')](utils[_0xd4d2('0x1a')](),queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x62')]);utils[_0xd4d2('0x3')](util[_0xd4d2('0x11')](_0xd4d2('0x66'),_0x46c7f2['uniqueid'],queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x1d')],queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x5f')]));delete queues[_0x46c7f2[_0xd4d2('0x4')]][_0xd4d2('0x62')];}}}catch(_0x20da12){utils[_0xd4d2('0x2a')](util[_0xd4d2('0x11')]('[%s][queues][musiconholdstop]',_0x46c7f2[_0xd4d2('0x4')]),_0x20da12);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f6c6b97..2e765fc 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce60=['name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','format','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','lodash','info','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then'];(function(_0x5de7a5,_0x23948a){var _0x41e57b=function(_0x4b348e){while(--_0x4b348e){_0x5de7a5['push'](_0x5de7a5['shift']());}};_0x41e57b(++_0x23948a);}(_0xce60,0xca));var _0x0ce6=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xce60[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x0ce6('0x0'));var util=require('util');var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2e2a13){var _0x17df96;utils[_0x0ce6('0x1')](util['format'](_0x0ce6('0x2'),_0x2e2a13[_0x0ce6('0x3')]));if(transfers[_0x0ce6('0x4')][_0x2e2a13['uniqueid']]){_0x17df96=_0x2e2a13[_0x0ce6('0x3')];_0x2e2a13['uniqueid']=transfers[_0x0ce6('0x4')][_0x2e2a13[_0x0ce6('0x3')]]['transfereeuniqueid'];}if(_0x2e2a13[_0x0ce6('0x5')]){utils[_0x0ce6('0x6')](_0x2e2a13['accountcode'])[_0x0ce6('0x7')](function(_0x43a135){if(_0x43a135){_0x2e2a13['membername']=_0x43a135[_0x0ce6('0x8')];_0x2e2a13[_0x0ce6('0x9')]=_0x43a135['id'];}utils[_0x0ce6('0xa')](_0x0ce6('0xb'),_0x2e2a13);});}else{utils[_0x0ce6('0xa')]('CreateVoiceRecording',_0x2e2a13);}if(_0x17df96)delete transfers[_0x0ce6('0x4')][_0x17df96];}exports['newchannel']=function(_0x2782f6){try{utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0xd'),_0x2782f6[_0x0ce6('0x3')]),_0x2782f6);if(_0x2782f6[_0x0ce6('0x3')]==_0x2782f6[_0x0ce6('0xe')]){utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x10'),_0x2782f6[_0x0ce6('0x3')],_0x2782f6[_0x0ce6('0x11')],_0x2782f6[_0x0ce6('0x12')]));recordings[_0x2782f6[_0x0ce6('0x3')]]={'uniqueid':_0x2782f6['uniqueid'],'accountcode':_0x2782f6['accountcode'],'exten':_0x2782f6[_0x0ce6('0x12')],'context':_0x2782f6[_0x0ce6('0x11')],'channel':_0x2782f6[_0x0ce6('0x13')],'monitors':[]};}}catch(_0x119454){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0xd'),_0x2782f6[_0x0ce6('0x3')]),_0x119454);}};exports['newstate']=function(_0x3ccb9c){try{utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0x15'),_0x3ccb9c[_0x0ce6('0x3')]),_0x3ccb9c);if(!_[_0x0ce6('0x16')](recordings[_0x3ccb9c['uniqueid']])&&_0x3ccb9c['channelstate']==0x6){utils['info'](util['format'](_0x0ce6('0x17'),_0x3ccb9c['uniqueid'],_0x3ccb9c[_0x0ce6('0x11')],_0x3ccb9c[_0x0ce6('0x13')]));}else if(!_[_0x0ce6('0x16')](recordings[_0x3ccb9c[_0x0ce6('0xe')]])&&_0x3ccb9c[_0x0ce6('0x18')]==0x6&&_0x3ccb9c[_0x0ce6('0x11')]!=_0x0ce6('0x19')){utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x1a'),_0x3ccb9c[_0x0ce6('0x3')],_0x3ccb9c[_0x0ce6('0xe')],_0x3ccb9c[_0x0ce6('0x11')],_0x3ccb9c[_0x0ce6('0x13')]));recordings[_0x3ccb9c['linkedid']][_0x0ce6('0x5')]=_0x3ccb9c[_0x0ce6('0x5')];}}catch(_0x2555d9){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x15'),_0x3ccb9c[_0x0ce6('0x3')]),_0x2555d9);}};exports[_0x0ce6('0x1b')]=function(_0x3572d6){try{if(!_[_0x0ce6('0x16')](_0x3572d6[_0x0ce6('0x1c')])&&!_[_0x0ce6('0x16')](_0x3572d6[_0x0ce6('0x1c')][_0x0ce6('0x1d')])){utils[_0x0ce6('0xc')](util[_0x0ce6('0xf')]('[%s][recordings][varset]',_0x3572d6[_0x0ce6('0x3')]),_0x3572d6);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x1e'),_0x3572d6['uniqueid'],_0x3572d6[_0x0ce6('0x1c')],_0x3572d6[_0x0ce6('0x1f')]));if(_[_0x0ce6('0x20')](_0x3572d6['value'],_0x0ce6('0x21'))){_0x3572d6[_0x0ce6('0x1f')]=_0x3572d6['value'][_0x0ce6('0x22')]('.wav49',_0x0ce6('0x23'));}if(recordings[_0x3572d6['linkedid']]){var _0x7023a5=_[_0x0ce6('0x24')](recordings[_0x3572d6[_0x0ce6('0xe')]][_0x0ce6('0x25')],{'value':_0x3572d6[_0x0ce6('0x1f')]});if(_[_0x0ce6('0x16')](_0x7023a5)){recordings[_0x3572d6['linkedid']]['monitors'][_0x0ce6('0x26')]({'value':_0x3572d6[_0x0ce6('0x1f')]});}}}}catch(_0x2b9680){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x27'),_0x3572d6[_0x0ce6('0x3')]),_0x2b9680);}};exports['hangup']=function(_0x2d6e3d){try{if(!_['isNil'](recordings[_0x2d6e3d['uniqueid']])){utils[_0x0ce6('0xc')](util[_0x0ce6('0xf')](_0x0ce6('0x28'),_0x2d6e3d[_0x0ce6('0x3')]),_0x2d6e3d);utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x29'),_0x2d6e3d['uniqueid'],_0x2d6e3d[_0x0ce6('0x2a')],_0x2d6e3d[_0x0ce6('0x2b')],_0x2d6e3d[_0x0ce6('0x2c')]));recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x2a')]=_0x2d6e3d[_0x0ce6('0x2a')];recordings[_0x2d6e3d[_0x0ce6('0x3')]]['calleridname']=_0x2d6e3d[_0x0ce6('0x2b')];recordings[_0x2d6e3d['uniqueid']][_0x0ce6('0x2d')]=_0x2d6e3d[_0x0ce6('0x2d')];recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x2e')]=_0x2d6e3d[_0x0ce6('0x2e')];if(recordings[_0x2d6e3d[_0x0ce6('0x3')]]['type']==_0x0ce6('0x2f')&&recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x5')]){recordings[_0x2d6e3d['uniqueid']]['connectedlinenum']=recordings[_0x2d6e3d[_0x0ce6('0x3')]]['accountcode'];recordings[_0x2d6e3d[_0x0ce6('0x3')]]['connectedlinename']='';}recordings[_0x2d6e3d[_0x0ce6('0x3')]][_0x0ce6('0x25')][_0x0ce6('0x30')](function(_0x585fcd){var _0x119249=_[_0x0ce6('0x31')](recordings[_0x2d6e3d[_0x0ce6('0x3')]]);_0x119249['value']=_0x585fcd[_0x0ce6('0x1f')];writeDB(_0x119249);});delete recordings[_0x2d6e3d[_0x0ce6('0x3')]];}}catch(_0x43a7f4){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x28'),_0x2d6e3d[_0x0ce6('0x3')]),_0x43a7f4);}};exports['newexten']=function(_0x51da40){try{if(!_[_0x0ce6('0x16')](recordings[_0x51da40[_0x0ce6('0x3')]])){utils[_0x0ce6('0xc')](util['format'](_0x0ce6('0x32'),_0x51da40[_0x0ce6('0x3')]),_0x51da40);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x33'),_0x51da40['uniqueid'],_0x51da40[_0x0ce6('0x34')],_0x51da40[_0x0ce6('0x35')]));if(_0x51da40[_0x0ce6('0x34')][_0x0ce6('0x36')]()==_0x0ce6('0x37')&&_[_0x0ce6('0x38')](_0x51da40[_0x0ce6('0x35')][_0x0ce6('0x36')](),_0x0ce6('0x39'))){var _0x1d3969=_0x51da40['appdata'][_0x0ce6('0x3a')]('=');var _0x46c268=_0x1d3969[0x0][_0x0ce6('0x3b')](_0x1d3969[0x0][_0x0ce6('0x3c')]('(')+0x1,_0x1d3969[0x0]['lastIndexOf'](')'));var _0xcd20ed=_0x1d3969[0x1];recordings[_0x51da40[_0x0ce6('0x3')]][_0x46c268]=_0xcd20ed;}}}catch(_0x43540c){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')](_0x0ce6('0x32'),_0x51da40[_0x0ce6('0x3')]),_0x43540c);}};exports['queuecallerjoin']=function(_0x374af1){try{if(!_[_0x0ce6('0x16')](recordings[_0x374af1['uniqueid']])){utils[_0x0ce6('0xc')](util['format']('[%s][recordings][queuecallerjoin]',_0x374af1[_0x0ce6('0x3')]),_0x374af1);utils['info'](util[_0x0ce6('0xf')](_0x0ce6('0x3d'),_0x374af1[_0x0ce6('0x3')],_0x374af1['queue']));recordings[_0x374af1[_0x0ce6('0x3')]][_0x0ce6('0x3e')]=_0x374af1['queue'];}}catch(_0x476bd8){utils[_0x0ce6('0x14')](util['format'](_0x0ce6('0x3f'),_0x374af1[_0x0ce6('0x3')]),_0x476bd8);}};exports[_0x0ce6('0x40')]=function(_0x1a20eb){try{utils['debug'](util[_0x0ce6('0xf')](_0x0ce6('0x41'),_0x1a20eb[_0x0ce6('0x3')]),_0x1a20eb);utils[_0x0ce6('0x1')](util[_0x0ce6('0xf')](_0x0ce6('0x42'),_0x1a20eb[_0x0ce6('0x3')],_0x1a20eb['transferercalleridnum'],_0x1a20eb[_0x0ce6('0x43')],_0x1a20eb['transfereecalleridnum'],_0x1a20eb[_0x0ce6('0x44')]));if(recordings[_0x1a20eb[_0x0ce6('0x45')]]&&transfers[_0x0ce6('0x4')][_0x1a20eb[_0x0ce6('0x45')]]){transfers[_0x0ce6('0x4')][_0x1a20eb['transfereruniqueid']]['recording']=!![];}}catch(_0x273172){utils[_0x0ce6('0x14')](util[_0x0ce6('0xf')]('[%s][recordings][blindtransfer]',_0x1a20eb[_0x0ce6('0x3')]),_0x273172);}}; \ No newline at end of file +var _0x6098=['.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','util','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','accountcode','context','channel','error','newstate','format','[%s][recordings][newstate]','isNil','channelstate','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0x6098,0xfb));var _0x8609=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x6098[_0x16e9b5];return _0x206df0;};'use strict';var _=require(_0x8609('0x0'));var util=require(_0x8609('0x1'));var utils=require('./utils');var transfers=require(_0x8609('0x2'));var recordings={};function writeDB(_0xa1bc1f){var _0x1c2674;utils[_0x8609('0x3')](util['format'](_0x8609('0x4'),_0xa1bc1f[_0x8609('0x5')]));if(transfers[_0x8609('0x6')][_0xa1bc1f[_0x8609('0x5')]]){_0x1c2674=_0xa1bc1f[_0x8609('0x5')];_0xa1bc1f[_0x8609('0x5')]=transfers[_0x8609('0x6')][_0xa1bc1f['uniqueid']]['transfereeuniqueid'];}if(_0xa1bc1f['accountcode']){utils[_0x8609('0x7')](_0xa1bc1f['accountcode'])['then'](function(_0x1d9641){if(_0x1d9641){_0xa1bc1f[_0x8609('0x8')]=_0x1d9641[_0x8609('0x9')];_0xa1bc1f[_0x8609('0xa')]=_0x1d9641['id'];}utils[_0x8609('0xb')]('CreateVoiceRecording',_0xa1bc1f);});}else{utils['request'](_0x8609('0xc'),_0xa1bc1f);}if(_0x1c2674)delete transfers[_0x8609('0x6')][_0x1c2674];}exports[_0x8609('0xd')]=function(_0x1c9a22){try{utils[_0x8609('0xe')](util['format'](_0x8609('0xf'),_0x1c9a22[_0x8609('0x5')]),_0x1c9a22);if(_0x1c9a22[_0x8609('0x5')]==_0x1c9a22[_0x8609('0x10')]){utils[_0x8609('0x3')](util['format'](_0x8609('0x11'),_0x1c9a22[_0x8609('0x5')],_0x1c9a22['context'],_0x1c9a22[_0x8609('0x12')]));recordings[_0x1c9a22[_0x8609('0x5')]]={'uniqueid':_0x1c9a22[_0x8609('0x5')],'accountcode':_0x1c9a22[_0x8609('0x13')],'exten':_0x1c9a22[_0x8609('0x12')],'context':_0x1c9a22[_0x8609('0x14')],'channel':_0x1c9a22[_0x8609('0x15')],'monitors':[]};}}catch(_0x4898c1){utils[_0x8609('0x16')](util['format'](_0x8609('0xf'),_0x1c9a22[_0x8609('0x5')]),_0x4898c1);}};exports[_0x8609('0x17')]=function(_0x162ef3){try{utils[_0x8609('0xe')](util[_0x8609('0x18')](_0x8609('0x19'),_0x162ef3[_0x8609('0x5')]),_0x162ef3);if(!_[_0x8609('0x1a')](recordings[_0x162ef3['uniqueid']])&&_0x162ef3[_0x8609('0x1b')]==0x6){utils[_0x8609('0x3')](util[_0x8609('0x18')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x162ef3[_0x8609('0x5')],_0x162ef3[_0x8609('0x14')],_0x162ef3[_0x8609('0x15')]));}else if(!_[_0x8609('0x1a')](recordings[_0x162ef3[_0x8609('0x10')]])&&_0x162ef3[_0x8609('0x1b')]==0x6&&_0x162ef3[_0x8609('0x14')]!='transfer'){utils['info'](util[_0x8609('0x18')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x162ef3[_0x8609('0x5')],_0x162ef3[_0x8609('0x10')],_0x162ef3['context'],_0x162ef3[_0x8609('0x15')]));recordings[_0x162ef3[_0x8609('0x10')]]['accountcode']=_0x162ef3[_0x8609('0x13')];}}catch(_0x4fa674){utils[_0x8609('0x16')](util['format']('[%s][recordings][newstate]',_0x162ef3[_0x8609('0x5')]),_0x4fa674);}};exports[_0x8609('0x1c')]=function(_0x5e4c26){try{if(!_[_0x8609('0x1a')](_0x5e4c26[_0x8609('0x1d')])&&!_[_0x8609('0x1a')](_0x5e4c26[_0x8609('0x1d')]['mixmonitor_filename'])){utils[_0x8609('0xe')](util[_0x8609('0x18')]('[%s][recordings][varset]',_0x5e4c26[_0x8609('0x5')]),_0x5e4c26);utils['info'](util[_0x8609('0x18')](_0x8609('0x1e'),_0x5e4c26[_0x8609('0x5')],_0x5e4c26['variable'],_0x5e4c26['value']));if(_[_0x8609('0x1f')](_0x5e4c26[_0x8609('0x20')],_0x8609('0x21'))){_0x5e4c26[_0x8609('0x20')]=_0x5e4c26[_0x8609('0x20')][_0x8609('0x22')](_0x8609('0x21'),_0x8609('0x23'));}if(recordings[_0x5e4c26[_0x8609('0x10')]]){var _0x5429bb=_[_0x8609('0x24')](recordings[_0x5e4c26[_0x8609('0x10')]][_0x8609('0x25')],{'value':_0x5e4c26[_0x8609('0x20')]});if(_[_0x8609('0x1a')](_0x5429bb)){recordings[_0x5e4c26[_0x8609('0x10')]][_0x8609('0x25')][_0x8609('0x26')]({'value':_0x5e4c26['value']});}}}}catch(_0x2e8d03){utils[_0x8609('0x16')](util[_0x8609('0x18')](_0x8609('0x27'),_0x5e4c26[_0x8609('0x5')]),_0x2e8d03);}};exports[_0x8609('0x28')]=function(_0x55f18a){try{if(!_[_0x8609('0x1a')](recordings[_0x55f18a['uniqueid']])){utils[_0x8609('0xe')](util[_0x8609('0x18')]('[%s][recordings][hangup]',_0x55f18a[_0x8609('0x5')]),_0x55f18a);utils[_0x8609('0x3')](util[_0x8609('0x18')](_0x8609('0x29'),_0x55f18a[_0x8609('0x5')],_0x55f18a[_0x8609('0x2a')],_0x55f18a[_0x8609('0x2b')],_0x55f18a[_0x8609('0x2c')]));recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2a')]=_0x55f18a[_0x8609('0x2a')];recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2b')]=_0x55f18a[_0x8609('0x2b')];recordings[_0x55f18a[_0x8609('0x5')]]['connectedlinenum']=_0x55f18a[_0x8609('0x2d')];recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2e')]=_0x55f18a[_0x8609('0x2e')];if(recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2f')]==_0x8609('0x30')&&recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x13')]){recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2d')]=recordings[_0x55f18a[_0x8609('0x5')]]['accountcode'];recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x2e')]='';}recordings[_0x55f18a[_0x8609('0x5')]][_0x8609('0x25')][_0x8609('0x31')](function(_0x3cf81a){var _0x190b97=_['clone'](recordings[_0x55f18a['uniqueid']]);_0x190b97[_0x8609('0x20')]=_0x3cf81a[_0x8609('0x20')];writeDB(_0x190b97);});delete recordings[_0x55f18a[_0x8609('0x5')]];}}catch(_0x69c325){utils[_0x8609('0x16')](util['format'](_0x8609('0x32'),_0x55f18a[_0x8609('0x5')]),_0x69c325);}};exports[_0x8609('0x33')]=function(_0x433e7c){try{if(!_[_0x8609('0x1a')](recordings[_0x433e7c['uniqueid']])){utils[_0x8609('0xe')](util[_0x8609('0x18')](_0x8609('0x34'),_0x433e7c[_0x8609('0x5')]),_0x433e7c);utils['info'](util[_0x8609('0x18')](_0x8609('0x35'),_0x433e7c[_0x8609('0x5')],_0x433e7c[_0x8609('0x36')],_0x433e7c[_0x8609('0x37')]));if(_0x433e7c[_0x8609('0x36')][_0x8609('0x38')]()==_0x8609('0x39')&&_[_0x8609('0x3a')](_0x433e7c[_0x8609('0x37')]['toLowerCase'](),'cdr')){var _0x21a2c8=_0x433e7c['appdata']['split']('=');var _0x5b9f9f=_0x21a2c8[0x0][_0x8609('0x3b')](_0x21a2c8[0x0]['lastIndexOf']('(')+0x1,_0x21a2c8[0x0][_0x8609('0x3c')](')'));var _0x2970c9=_0x21a2c8[0x1];recordings[_0x433e7c[_0x8609('0x5')]][_0x5b9f9f]=_0x2970c9;}}}catch(_0x419212){utils[_0x8609('0x16')](util[_0x8609('0x18')](_0x8609('0x34'),_0x433e7c[_0x8609('0x5')]),_0x419212);}};exports[_0x8609('0x3d')]=function(_0x4f30fe){try{if(!_[_0x8609('0x1a')](recordings[_0x4f30fe[_0x8609('0x5')]])){utils[_0x8609('0xe')](util['format']('[%s][recordings][queuecallerjoin]',_0x4f30fe[_0x8609('0x5')]),_0x4f30fe);utils[_0x8609('0x3')](util['format'](_0x8609('0x3e'),_0x4f30fe[_0x8609('0x5')],_0x4f30fe[_0x8609('0x3f')]));recordings[_0x4f30fe[_0x8609('0x5')]][_0x8609('0x3f')]=_0x4f30fe[_0x8609('0x3f')];}}catch(_0x39f4be){utils[_0x8609('0x16')](util['format']('[%s][recordings][queuecallerjoin]',_0x4f30fe['uniqueid']),_0x39f4be);}};exports[_0x8609('0x40')]=function(_0x901a27){try{utils[_0x8609('0xe')](util[_0x8609('0x18')]('[%s][recordings][blindtransfer]',_0x901a27[_0x8609('0x5')]),_0x901a27);utils[_0x8609('0x3')](util[_0x8609('0x18')](_0x8609('0x41'),_0x901a27[_0x8609('0x5')],_0x901a27['transferercalleridnum'],_0x901a27[_0x8609('0x42')],_0x901a27[_0x8609('0x43')],_0x901a27['transfereecalleridname']));if(recordings[_0x901a27[_0x8609('0x44')]]&&transfers['blinds'][_0x901a27[_0x8609('0x44')]]){transfers[_0x8609('0x6')][_0x901a27[_0x8609('0x44')]][_0x8609('0x45')]=!![];}}catch(_0x527c2a){utils['error'](util[_0x8609('0x18')](_0x8609('0x46'),_0x901a27[_0x8609('0x5')]),_0x527c2a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5a1c234..56ff087 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01c8=['[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blinds','debug','format'];(function(_0x46dfa2,_0x1c6f5d){var _0x13a367=function(_0x6e88bf){while(--_0x6e88bf){_0x46dfa2['push'](_0x46dfa2['shift']());}};_0x13a367(++_0x1c6f5d);}(_0x01c8,0x1a0));var _0x801c=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x01c8[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x801c('0x0'));var util=require(_0x801c('0x1'));var utils=require(_0x801c('0x2'));function writeDB(_0x130faa){utils[_0x801c('0x3')](util['format'](_0x801c('0x4'),_0x130faa[_0x801c('0x5')]===_0x801c('0x6')?_0x130faa[_0x801c('0x7')]:_0x130faa[_0x801c('0x8')],_0x130faa[_0x801c('0x5')]));utils[_0x801c('0x9')]('CreateVoiceTransferReport',_0x130faa);}exports[_0x801c('0xa')]={};exports['blindtransfer']=function(_0x490241){try{utils[_0x801c('0xb')](util[_0x801c('0xc')](_0x801c('0xd'),_0x490241[_0x801c('0x8')]),_0x490241);utils['info'](util[_0x801c('0xc')](_0x801c('0xe'),_0x490241[_0x801c('0x8')],_0x490241['transferercalleridnum'],_0x490241[_0x801c('0xf')],_0x490241[_0x801c('0x10')],_0x490241[_0x801c('0x11')]));_0x490241[_0x801c('0x5')]=_0x801c('0x12');exports['blinds'][_0x490241['transfereruniqueid']]=_0x490241;writeDB(_0x490241);}catch(_0x394e7a){utils[_0x801c('0x13')](util[_0x801c('0xc')](_0x801c('0xd'),_0x490241[_0x801c('0x8')]),_0x394e7a);}};exports[_0x801c('0x14')]=function(_0x4f338d){try{utils[_0x801c('0xb')](util[_0x801c('0xc')](_0x801c('0x15'),_0x4f338d[_0x801c('0x7')]),_0x4f338d);utils['info'](util['format'](_0x801c('0x16'),_0x4f338d[_0x801c('0x7')],_0x4f338d['origtransferercalleridnum'],_0x4f338d[_0x801c('0x17')],_0x4f338d['transfertargetcalleridnum'],_0x4f338d['transfertargetcalleridname']));_0x4f338d=_[_0x801c('0x18')](_0x4f338d,{'transfererchannel':_0x4f338d[_0x801c('0x19')],'transferercalleridnum':_0x4f338d[_0x801c('0x1a')],'transferercalleridname':_0x4f338d['origtransferercalleridname'],'transfererconnectedlinenum':_0x4f338d[_0x801c('0x1b')],'transfererconnectedlinename':_0x4f338d['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4f338d[_0x801c('0x1c')],'transferercontext':_0x4f338d[_0x801c('0x1d')],'transfererexten':_0x4f338d['secondtransfererexten'],'transfererlinkedid':_0x4f338d['origtransfererlinkedid'],'context':_0x4f338d['origtransferercontext'],'extension':_0x4f338d['origtransfererexten'],'type':_0x801c('0x6')});if(_[_0x801c('0x1e')](_0x4f338d[_0x801c('0x1f')])){_0x4f338d=_[_0x801c('0x18')](_0x4f338d,{'transfereechannel':_0x4f338d['transfertargetchannel'],'transfereecalleridnum':_0x4f338d['transfertargetcalleridnum'],'transfereecalleridname':_0x4f338d[_0x801c('0x20')],'transfereeconnectedlinenum':_0x4f338d[_0x801c('0x21')],'transfereeconnectedlinename':_0x4f338d[_0x801c('0x22')],'transfereeaccountcode':_0x4f338d[_0x801c('0x23')],'transfereecontext':_0x4f338d[_0x801c('0x24')],'transfereeexten':_0x4f338d[_0x801c('0x25')],'transfereelinkedid':_0x4f338d[_0x801c('0x26')]});}writeDB(_0x4f338d);}catch(_0x21054b){utils['error'](util['format'](_0x801c('0x15'),_0x4f338d[_0x801c('0x7')]),_0x21054b);}}; \ No newline at end of file +var _0x00ac=['CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request'];(function(_0x3352bc,_0x56d886){var _0x498667=function(_0x150a17){while(--_0x150a17){_0x3352bc['push'](_0x3352bc['shift']());}};_0x498667(++_0x56d886);}(_0x00ac,0x74));var _0xc00a=function(_0x345a43,_0x143677){_0x345a43=_0x345a43-0x0;var _0x5bddf7=_0x00ac[_0x345a43];return _0x5bddf7;};'use strict';var _=require(_0xc00a('0x0'));var util=require('util');var utils=require(_0xc00a('0x1'));function writeDB(_0x4dca6d){utils[_0xc00a('0x2')](util[_0xc00a('0x3')](_0xc00a('0x4'),_0x4dca6d[_0xc00a('0x5')]===_0xc00a('0x6')?_0x4dca6d[_0xc00a('0x7')]:_0x4dca6d[_0xc00a('0x8')],_0x4dca6d['type']));utils[_0xc00a('0x9')](_0xc00a('0xa'),_0x4dca6d);}exports[_0xc00a('0xb')]={};exports[_0xc00a('0xc')]=function(_0x1b5cc7){try{utils[_0xc00a('0xd')](util[_0xc00a('0x3')](_0xc00a('0xe'),_0x1b5cc7[_0xc00a('0x8')]),_0x1b5cc7);utils[_0xc00a('0x2')](util[_0xc00a('0x3')](_0xc00a('0xf'),_0x1b5cc7[_0xc00a('0x8')],_0x1b5cc7[_0xc00a('0x10')],_0x1b5cc7['transferercalleridname'],_0x1b5cc7[_0xc00a('0x11')],_0x1b5cc7[_0xc00a('0x12')]));_0x1b5cc7[_0xc00a('0x5')]=_0xc00a('0x13');exports[_0xc00a('0xb')][_0x1b5cc7[_0xc00a('0x14')]]=_0x1b5cc7;writeDB(_0x1b5cc7);}catch(_0x53f7e6){utils['error'](util[_0xc00a('0x3')](_0xc00a('0xe'),_0x1b5cc7[_0xc00a('0x8')]),_0x53f7e6);}};exports['attendedtransfer']=function(_0x19d7f3){try{utils[_0xc00a('0xd')](util[_0xc00a('0x3')](_0xc00a('0x15'),_0x19d7f3[_0xc00a('0x7')]),_0x19d7f3);utils[_0xc00a('0x2')](util[_0xc00a('0x3')](_0xc00a('0x16'),_0x19d7f3[_0xc00a('0x7')],_0x19d7f3['origtransferercalleridnum'],_0x19d7f3['origtransferercalleridname'],_0x19d7f3['transfertargetcalleridnum'],_0x19d7f3[_0xc00a('0x17')]));_0x19d7f3=_['assign'](_0x19d7f3,{'transfererchannel':_0x19d7f3[_0xc00a('0x18')],'transferercalleridnum':_0x19d7f3['origtransferercalleridnum'],'transferercalleridname':_0x19d7f3['origtransferercalleridname'],'transfererconnectedlinenum':_0x19d7f3[_0xc00a('0x19')],'transfererconnectedlinename':_0x19d7f3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x19d7f3[_0xc00a('0x1a')],'transferercontext':_0x19d7f3['secondtransferercontext'],'transfererexten':_0x19d7f3[_0xc00a('0x1b')],'transfererlinkedid':_0x19d7f3[_0xc00a('0x1c')],'context':_0x19d7f3[_0xc00a('0x1d')],'extension':_0x19d7f3[_0xc00a('0x1e')],'type':_0xc00a('0x6')});if(_[_0xc00a('0x1f')](_0x19d7f3[_0xc00a('0x20')])){_0x19d7f3=_[_0xc00a('0x21')](_0x19d7f3,{'transfereechannel':_0x19d7f3[_0xc00a('0x22')],'transfereecalleridnum':_0x19d7f3[_0xc00a('0x23')],'transfereecalleridname':_0x19d7f3[_0xc00a('0x17')],'transfereeconnectedlinenum':_0x19d7f3['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x19d7f3[_0xc00a('0x24')],'transfereeaccountcode':_0x19d7f3[_0xc00a('0x25')],'transfereecontext':_0x19d7f3[_0xc00a('0x26')],'transfereeexten':_0x19d7f3[_0xc00a('0x27')],'transfereelinkedid':_0x19d7f3[_0xc00a('0x28')]});}writeDB(_0x19d7f3);}catch(_0x37be45){utils[_0xc00a('0x29')](util[_0xc00a('0x3')](_0xc00a('0x15'),_0x19d7f3[_0xc00a('0x7')]),_0x37be45);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4a65063..4ec73d4 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58c0=['acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','name','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getVoiceQueueByName','GetVoiceQueue'];(function(_0x1c2fa6,_0x593fb2){var _0x265636=function(_0x7bf181){while(--_0x7bf181){_0x1c2fa6['push'](_0x1c2fa6['shift']());}};_0x265636(++_0x593fb2);}(_0x58c0,0x1de));var _0x058c=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x58c0[_0x25fa5c];return _0x1bade2;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x058c('0x0'));var moment=require(_0x058c('0x1'));var util=require(_0x058c('0x2'));var client=jayson[_0x058c('0x3')][_0x058c('0x4')]({'port':0x2329});var logger=require(_0x058c('0x5'))(_0x058c('0x6'));exports['info']=function(_0x2dcec8,_0xccb4f2){logger[_0x058c('0x7')](_0x2dcec8,_0xccb4f2?util[_0x058c('0x8')](_0xccb4f2,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0x9')]=function(_0xbb39fe,_0x584e4a){logger[_0x058c('0x9')](_0xbb39fe,_0x584e4a?util[_0x058c('0x8')](_0x584e4a,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0xa')]=function(_0x4d81c7,_0xeace37){logger[_0x058c('0xa')](_0x4d81c7,_0xeace37?util['inspect'](_0xeace37,{'showHidden':![],'depth':null}):'');};exports[_0x058c('0xb')]=function(_0x1e8212,_0x2ef836){return client[_0x058c('0xb')](_0x1e8212,{'body':_0x2ef836})[_0x058c('0xc')](function(_0x49b485){logger[_0x058c('0x9')](_0x058c('0xd'),_0x1e8212,_0x49b485?util[_0x058c('0x8')](_0x49b485,{'showHidden':![],'depth':null}):'');})[_0x058c('0xe')](function(_0x23831d){logger[_0x058c('0xa')]('[utils][request]\x20name:%s',_0x1e8212,_0x23831d?util['inspect'](_0x23831d,{'showHidden':![],'depth':null}):'');});};function getUser(_0xfcf0c8){return client[_0x058c('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x058c('0xf'),'interface'],'where':_0xfcf0c8,'limit':0x1}})[_0x058c('0xc')](function(_0x177aaa){logger[_0x058c('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x058c('0x10')](_0xfcf0c8),_0x177aaa?util[_0x058c('0x8')](_0x177aaa,{'showHidden':![],'depth':null}):'');return _0x177aaa[_0x058c('0x11')]['length']?_0x177aaa['result'][0x0]:null;});}exports[_0x058c('0x12')]=function(_0x536439){return new BPromise(function(_0x3d04c4,_0x2a57c1){if(_0x536439){return getUser({'internal':_0x536439})[_0x058c('0xc')](function(_0x39ef85){logger[_0x058c('0x7')](_0x058c('0x13'),_0x536439,_0x39ef85?_0x058c('0x14'):'notfound');return _0x3d04c4(_0x39ef85);})['catch'](function(_0x4b50af){logger['error'](_0x058c('0x15'),_0x4b50af?util[_0x058c('0x8')](_0x4b50af,{'showHidden':![],'depth':null}):'');return _0x3d04c4(null);});}return _0x3d04c4(null);});};exports[_0x058c('0x16')]=function(_0x55fa1d){return new BPromise(function(_0x1181b9,_0x42811a){if(_0x55fa1d){return getUser({'interface':_0x55fa1d})[_0x058c('0xc')](function(_0x3f4c13){logger[_0x058c('0x7')](_0x058c('0x17'),_0x55fa1d,_0x3f4c13?_0x058c('0x14'):_0x058c('0x18'));return _0x1181b9(_0x3f4c13);})[_0x058c('0xe')](function(_0x3f5072){logger[_0x058c('0xa')](_0x058c('0x19'),_0x3f5072?util[_0x058c('0x8')](_0x3f5072,{'showHidden':![],'depth':null}):'');return _0x1181b9(null);});}return _0x1181b9(null);});};exports['getUserByName']=function(_0x367eda){return new BPromise(function(_0x1db895,_0x12d726){if(_0x367eda){return getUser({'name':_0x367eda})[_0x058c('0xc')](function(_0x453b50){logger[_0x058c('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x367eda,_0x453b50?_0x058c('0x14'):'notfound');return _0x1db895(_0x453b50);})['catch'](function(_0x187b73){logger['error']('[utils][getUserByName]',_0x187b73?util[_0x058c('0x8')](_0x187b73,{'showHidden':![],'depth':null}):'');return _0x1db895(null);});}return _0x1db895(null);});};exports[_0x058c('0x1a')]=function(_0x2ba90b){return new BPromise(function(_0x3ba9ca,_0x37367a){if(_0x2ba90b){return client['request'](_0x058c('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x058c('0xf'),'type',_0x058c('0x1c'),_0x058c('0x1d')],'where':{'name':_0x2ba90b},'limit':0x1}})[_0x058c('0xc')](function(_0x2e559f){logger[_0x058c('0x9')](_0x058c('0x1e'),_0x2ba90b,_0x2e559f?util[_0x058c('0x8')](_0x2e559f,{'showHidden':![],'depth':null}):'');logger['info'](_0x058c('0x1f'),_0x2ba90b,_0x2e559f?'found':_0x058c('0x18'));return _0x3ba9ca(_0x2e559f['result'][_0x058c('0x20')]?_0x2e559f[_0x058c('0x11')][0x0]:null);})[_0x058c('0xe')](function(_0x554068){logger['error'](_0x058c('0x21'),_0x554068?util[_0x058c('0x8')](_0x554068,{'showHidden':![],'depth':null}):'');return _0x3ba9ca(null);});}return _0x3ba9ca(null);});};exports[_0x058c('0x22')]=function(_0x4d7aee,_0x3de12b){return moment(_0x4d7aee)[_0x058c('0x23')](_0x3de12b,'seconds')['format'](_0x058c('0x24'));};exports[_0x058c('0x25')]=function(_0x38727a,_0x35fec9){return moment(_0x38727a)['subtract'](_0x35fec9,_0x058c('0x26'))[_0x058c('0x27')](_0x058c('0x24'));};exports[_0x058c('0x28')]=function(_0x27bb9d,_0x138ae0){return moment(_0x27bb9d)[_0x058c('0x29')](moment(_0x138ae0),'seconds');};exports[_0x058c('0x2a')]=function(_0x321c99,_0x2420bf){return parseInt(_0x321c99,0xa)+parseInt(_0x2420bf,0xa);};exports[_0x058c('0x2b')]=function(){return moment()['format'](_0x058c('0x24'));};exports[_0x058c('0x2c')]=function(_0x34b6f0,_0x657244){if(_0x657244){return moment(_0x34b6f0)[_0x058c('0x2c')](_0x657244);}return!![];};exports[_0x058c('0x2d')]=function(_0x3e6cda,_0x16deb5){if(_0x16deb5){return moment(_0x3e6cda)[_0x058c('0x2d')](_0x16deb5);}else if(_0x3e6cda){return!![];}return![];}; \ No newline at end of file +var _0x8757=['GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch'];(function(_0x5100bc,_0x35e471){var _0x1d6ec6=function(_0x24795f){while(--_0x24795f){_0x5100bc['push'](_0x5100bc['shift']());}};_0x1d6ec6(++_0x35e471);}(_0x8757,0x14f));var _0x7875=function(_0x552c7c,_0x3fd454){_0x552c7c=_0x552c7c-0x0;var _0x32ea28=_0x8757[_0x552c7c];return _0x32ea28;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7875('0x0'));var moment=require(_0x7875('0x1'));var util=require(_0x7875('0x2'));var client=jayson[_0x7875('0x3')][_0x7875('0x4')]({'port':0x2329});var logger=require(_0x7875('0x5'))(_0x7875('0x6'));exports['info']=function(_0x4d9b27,_0x5affb2){logger[_0x7875('0x7')](_0x4d9b27,_0x5affb2?util[_0x7875('0x8')](_0x5affb2,{'showHidden':![],'depth':null}):'');};exports[_0x7875('0x9')]=function(_0x37e998,_0x15db90){logger[_0x7875('0x9')](_0x37e998,_0x15db90?util[_0x7875('0x8')](_0x15db90,{'showHidden':![],'depth':null}):'');};exports[_0x7875('0xa')]=function(_0x522ee7,_0x40a2cc){logger[_0x7875('0xa')](_0x522ee7,_0x40a2cc?util[_0x7875('0x8')](_0x40a2cc,{'showHidden':![],'depth':null}):'');};exports[_0x7875('0xb')]=function(_0x813172,_0x473b00){return client[_0x7875('0xb')](_0x813172,{'body':_0x473b00})[_0x7875('0xc')](function(_0xef607d){logger[_0x7875('0x9')](_0x7875('0xd'),_0x813172,_0xef607d?util[_0x7875('0x8')](_0xef607d,{'showHidden':![],'depth':null}):'');})[_0x7875('0xe')](function(_0x138910){logger['error'](_0x7875('0xd'),_0x813172,_0x138910?util[_0x7875('0x8')](_0x138910,{'showHidden':![],'depth':null}):'');});};function getUser(_0x46fca8){return client[_0x7875('0xb')](_0x7875('0xf'),{'options':{'raw':!![],'attributes':['id',_0x7875('0x10'),_0x7875('0x11'),_0x7875('0x12')],'where':_0x46fca8,'limit':0x1}})[_0x7875('0xc')](function(_0x1e7c9a){logger['debug'](_0x7875('0x13'),JSON[_0x7875('0x14')](_0x46fca8),_0x1e7c9a?util[_0x7875('0x8')](_0x1e7c9a,{'showHidden':![],'depth':null}):'');return _0x1e7c9a[_0x7875('0x15')]['length']?_0x1e7c9a[_0x7875('0x15')][0x0]:null;});}exports[_0x7875('0x16')]=function(_0x4b5878){return new BPromise(function(_0x5c6ad9,_0x4fcf38){if(_0x4b5878){return getUser({'internal':_0x4b5878})[_0x7875('0xc')](function(_0x431f5c){logger[_0x7875('0x7')](_0x7875('0x17'),_0x4b5878,_0x431f5c?'found':_0x7875('0x18'));return _0x5c6ad9(_0x431f5c);})[_0x7875('0xe')](function(_0x6ff762){logger[_0x7875('0xa')]('[utils][getUserByInternal]',_0x6ff762?util[_0x7875('0x8')](_0x6ff762,{'showHidden':![],'depth':null}):'');return _0x5c6ad9(null);});}return _0x5c6ad9(null);});};exports['getUserByInterface']=function(_0x1adf5e){return new BPromise(function(_0x2f61d0,_0x5324e7){if(_0x1adf5e){return getUser({'interface':_0x1adf5e})[_0x7875('0xc')](function(_0x43462c){logger[_0x7875('0x7')](_0x7875('0x19'),_0x1adf5e,_0x43462c?'found':'notfound');return _0x2f61d0(_0x43462c);})[_0x7875('0xe')](function(_0x2e804f){logger[_0x7875('0xa')](_0x7875('0x1a'),_0x2e804f?util[_0x7875('0x8')](_0x2e804f,{'showHidden':![],'depth':null}):'');return _0x2f61d0(null);});}return _0x2f61d0(null);});};exports[_0x7875('0x1b')]=function(_0x1e5095){return new BPromise(function(_0x42aeda,_0x535e21){if(_0x1e5095){return getUser({'name':_0x1e5095})[_0x7875('0xc')](function(_0x1f0b0f){logger[_0x7875('0x7')](_0x7875('0x1c'),_0x1e5095,_0x1f0b0f?_0x7875('0x1d'):_0x7875('0x18'));return _0x42aeda(_0x1f0b0f);})['catch'](function(_0x2bfe00){logger['error'](_0x7875('0x1e'),_0x2bfe00?util[_0x7875('0x8')](_0x2bfe00,{'showHidden':![],'depth':null}):'');return _0x42aeda(null);});}return _0x42aeda(null);});};exports[_0x7875('0x1f')]=function(_0x1c3a16){return new BPromise(function(_0x22680a,_0x178130){if(_0x1c3a16){return client[_0x7875('0xb')](_0x7875('0x20'),{'options':{'raw':!![],'attributes':['id',_0x7875('0x11'),_0x7875('0x21'),'acw',_0x7875('0x22')],'where':{'name':_0x1c3a16},'limit':0x1}})[_0x7875('0xc')](function(_0x4536c9){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x1c3a16,_0x4536c9?util['inspect'](_0x4536c9,{'showHidden':![],'depth':null}):'');logger[_0x7875('0x7')](_0x7875('0x23'),_0x1c3a16,_0x4536c9?_0x7875('0x1d'):_0x7875('0x18'));return _0x22680a(_0x4536c9['result']['length']?_0x4536c9['result'][0x0]:null);})['catch'](function(_0x5c3949){logger[_0x7875('0xa')](_0x7875('0x24'),_0x5c3949?util['inspect'](_0x5c3949,{'showHidden':![],'depth':null}):'');return _0x22680a(null);});}return _0x22680a(null);});};exports[_0x7875('0x25')]=function(_0x4fabba,_0x53b4b9){return moment(_0x4fabba)[_0x7875('0x26')](_0x53b4b9,_0x7875('0x27'))[_0x7875('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7875('0x29')]=function(_0x2ef07e,_0x1423fc){return moment(_0x2ef07e)[_0x7875('0x2a')](_0x1423fc,_0x7875('0x27'))['format'](_0x7875('0x2b'));};exports[_0x7875('0x2c')]=function(_0x51ee45,_0x456481){return moment(_0x51ee45)[_0x7875('0x2d')](moment(_0x456481),'seconds');};exports[_0x7875('0x2e')]=function(_0x455fdc,_0x351c70){return parseInt(_0x455fdc,0xa)+parseInt(_0x351c70,0xa);};exports[_0x7875('0x2f')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x7875('0x30')]=function(_0x3bfefc,_0x143c18){if(_0x143c18){return moment(_0x3bfefc)[_0x7875('0x30')](_0x143c18);}return!![];};exports[_0x7875('0x31')]=function(_0xe3ffb4,_0x107200){if(_0x107200){return moment(_0xe3ffb4)[_0x7875('0x31')](_0x107200);}else if(_0xe3ffb4){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 301a299..f689461 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca16=['other','agent_id','agent_name','test','fs-extra','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','catch','then','user','no-user','data','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime'];(function(_0x4e553a,_0x164116){var _0x4171f9=function(_0x49aa1c){while(--_0x49aa1c){_0x4e553a['push'](_0x4e553a['shift']());}};_0x4171f9(++_0x164116);}(_0xca16,0x1a2));var _0x6ca1=function(_0x61fb2c,_0x20541f){_0x61fb2c=_0x61fb2c-0x0;var _0x15db8=_0xca16[_0x61fb2c];return _0x15db8;};var fs=require(_0x6ca1('0x0'));var _=require('lodash');var ewinston=require(_0x6ca1('0x1'));var path=require(_0x6ca1('0x2'));var util=require(_0x6ca1('0x3'));var fileLogger=require(_0x6ca1('0x4'))[_0x6ca1('0x5')];var safeTemplate=require('./safe-template')[_0x6ca1('0x6')];var maskSensitiveData=require(_0x6ca1('0x7'))[_0x6ca1('0x8')];function ClientSideLogger(){function _0x218ba4(_0x3c8953){var _0x11e0c8=path[_0x6ca1('0x9')](_0x6ca1('0xa'),_0x6ca1('0xb'),_0x6ca1('0xc'));var _0x2a081f=path[_0x6ca1('0x9')](_0x6ca1('0xd'),_0x3c8953['role']+'-'+_0x3c8953[_0x6ca1('0xe')]);return fs[_0x6ca1('0xf')](path['join'](_0x11e0c8,_0x2a081f))['then'](function(){var _0x5a0e38=fileLogger(_0x6ca1('0xd'),path[_0x6ca1('0x9')](_0x11e0c8,_0x2a081f));return _0x5a0e38;})[_0x6ca1('0x10')](function(_0x4215a3){throw _0x4215a3;});}this[_0x6ca1('0xb')]=function(_0x40f489,_0x34aac6,_0x4d7788,_0x1a89fc){return _0x218ba4(_0x40f489['user'])[_0x6ca1('0x11')](function(_0x1f4295){var _0x1c52d6=_0x1f4295[_0x34aac6];return _0x1c52d6;})['then'](function(_0x49e348){var _0x41aa39=_0x40f489[_0x6ca1('0x12')]?_0x40f489[_0x6ca1('0x12')]['id']:_0x6ca1('0x13');var _0x2d7f57=_0x1a89fc[_0x6ca1('0x14')];var _0x3ab880=_0x1a89fc['timestamp'];var _0x48cacb=new Date(Number(_0x3ab880));return _0x49e348(_0x41aa39,_0x48cacb,_0x4d7788,_0x2d7f57);})[_0x6ca1('0x10')](function(_0x154ed2){fileLogger('client')['error'](_0x154ed2);});};}function setupLoggers(_0x13108c){return new Promise(function(_0x1d2ba8){var _0x37fbc4=new ClientSideLogger();var _0x1619f3=fileLogger('api');var _0x399200=fileLogger(_0x6ca1('0x15'));_0x13108c['set'](_0x6ca1('0x16'),_0x37fbc4);_0x13108c[_0x6ca1('0x17')](ewinston[_0x6ca1('0x18')]({'winstonInstance':_0x1619f3,'meta':![],'statusLevels':!![],'msg':function(_0x9203be,_0xc61ed8){var _0x3efd78=_0x6ca1('0x19');if(!_[_0x6ca1('0x1a')](_0x9203be[_0x6ca1('0x1b')])){_0x3efd78+=_0x6ca1('0x1c');var _0x3a6ab0=_0x9203be[_0x6ca1('0x1b')];maskSensitiveData(_0x3a6ab0);}return safeTemplate(util[_0x6ca1('0x1d')](_0x3efd78,_0x9203be[_0x6ca1('0x1e')],_0x9203be['headers']['x-forwarded-for']?_0x9203be[_0x6ca1('0x1f')][_0x6ca1('0x20')]:_0x9203be[_0x6ca1('0x21')][_0x6ca1('0x22')]||_0x9203be['ip'],_0x9203be[_0x6ca1('0x23')],_0xc61ed8['statusCode'],_0xc61ed8['responseTime'],_0x9203be[_0x6ca1('0x12')]?_0x9203be[_0x6ca1('0x12')]['id']:null,_0x9203be[_0x6ca1('0x12')]?_0x9203be['user'][_0x6ca1('0xe')]:null,_0x9203be[_0x6ca1('0x12')]?_0x9203be[_0x6ca1('0x12')][_0x6ca1('0x24')]:null,_0x3a6ab0?util[_0x6ca1('0x25')](_0x3a6ab0,![],null):''));}}));_0x13108c[_0x6ca1('0x17')](ewinston['logger']({'winstonInstance':_0x399200,'meta':![],'statusLevels':!![],'msg':function(_0x4fdd48,_0x4f0688){var _0x234872=_0x6ca1('0x26');if(_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x27')]&&_0x4fdd48[_0x6ca1('0x1b')]['agent_id']){_0x234872=_0x6ca1('0x28');}return util[_0x6ca1('0x1d')](_0x234872,_0x4fdd48[_0x6ca1('0x1e')],_0x4fdd48['headers'][_0x6ca1('0x20')]?_0x4fdd48[_0x6ca1('0x1f')][_0x6ca1('0x20')]:_0x4fdd48[_0x6ca1('0x21')][_0x6ca1('0x22')]||_0x4fdd48['ip'],_0x4fdd48[_0x6ca1('0x23')],_0x4f0688['statusCode'],_0x4f0688[_0x6ca1('0x29')],_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48['user']['id']:null,_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48['user'][_0x6ca1('0xe')]:null,_0x4fdd48[_0x6ca1('0x12')]?_0x4fdd48[_0x6ca1('0x12')][_0x6ca1('0x24')]:null,_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x27')]?_0x4fdd48['body'][_0x6ca1('0x27')]:_0x6ca1('0x2a'),_0x4fdd48[_0x6ca1('0x1b')]&&_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x2b')]?_0x4fdd48[_0x6ca1('0x1b')]['agent_id']:'',_0x4fdd48['body']&&_0x4fdd48[_0x6ca1('0x1b')]['agent_name']?_0x4fdd48[_0x6ca1('0x1b')][_0x6ca1('0x2c')]:'');},'ignoreRoute':function(_0x362652){var _0x20e77c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20e77c[_0x6ca1('0x2d')](_0x362652[_0x6ca1('0x23')]);}}));return _0x1d2ba8();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x1f01=['path','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','xcally','client','role','name','ensureDir','catch','log','user','then','no-user','data','timestamp','error','api','auth','use','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','logger','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','test','fs-extra','express-winston'];(function(_0x53286a,_0x485c92){var _0x5730ff=function(_0x478c81){while(--_0x478c81){_0x53286a['push'](_0x53286a['shift']());}};_0x5730ff(++_0x485c92);}(_0x1f01,0x12b));var _0x11f0=function(_0x547302,_0x5c1853){_0x547302=_0x547302-0x0;var _0x120aa6=_0x1f01[_0x547302];return _0x120aa6;};var fs=require(_0x11f0('0x0'));var _=require('lodash');var ewinston=require(_0x11f0('0x1'));var path=require(_0x11f0('0x2'));var util=require('util');var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x11f0('0x3'))[_0x11f0('0x4')];var maskSensitiveData=require(_0x11f0('0x5'))[_0x11f0('0x6')];function ClientSideLogger(){function _0xb14b(_0x30243e){var _0x2ad223=path[_0x11f0('0x7')]('/var','log',_0x11f0('0x8'));var _0xea79fc=path[_0x11f0('0x7')](_0x11f0('0x9'),_0x30243e[_0x11f0('0xa')]+'-'+_0x30243e[_0x11f0('0xb')]);return fs[_0x11f0('0xc')](path['join'](_0x2ad223,_0xea79fc))['then'](function(){var _0x16f438=fileLogger(_0x11f0('0x9'),path[_0x11f0('0x7')](_0x2ad223,_0xea79fc));return _0x16f438;})[_0x11f0('0xd')](function(_0x2b7c2b){throw _0x2b7c2b;});}this[_0x11f0('0xe')]=function(_0x359c2c,_0xdfd586,_0x20c1d5,_0x3bbda3){return _0xb14b(_0x359c2c[_0x11f0('0xf')])[_0x11f0('0x10')](function(_0x1abf77){var _0x26b4f5=_0x1abf77[_0xdfd586];return _0x26b4f5;})[_0x11f0('0x10')](function(_0xec6ad1){var _0x1feac8=_0x359c2c[_0x11f0('0xf')]?_0x359c2c['user']['id']:_0x11f0('0x11');var _0x165f4=_0x3bbda3[_0x11f0('0x12')];var _0x96ee85=_0x3bbda3[_0x11f0('0x13')];var _0x226a75=new Date(Number(_0x96ee85));return _0xec6ad1(_0x1feac8,_0x226a75,_0x20c1d5,_0x165f4);})[_0x11f0('0xd')](function(_0x5b9f1e){fileLogger(_0x11f0('0x9'))[_0x11f0('0x14')](_0x5b9f1e);});};}function setupLoggers(_0x1f568e){return new Promise(function(_0x4308c4){var _0x3c0ba6=new ClientSideLogger();var _0x40b128=fileLogger(_0x11f0('0x15'));var _0x279cf8=fileLogger(_0x11f0('0x16'));_0x1f568e['set']('client-side-logger',_0x3c0ba6);_0x1f568e[_0x11f0('0x17')](ewinston['logger']({'winstonInstance':_0x40b128,'meta':![],'statusLevels':!![],'msg':function(_0x3da7a5,_0x277278){var _0x2fd33d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x11f0('0x18')](_0x3da7a5[_0x11f0('0x19')])){_0x2fd33d+=_0x11f0('0x1a');var _0x6e1883=_0x3da7a5[_0x11f0('0x19')];maskSensitiveData(_0x6e1883);}return safeTemplate(util[_0x11f0('0x1b')](_0x2fd33d,_0x3da7a5['method'],_0x3da7a5[_0x11f0('0x1c')]['x-forwarded-for']?_0x3da7a5[_0x11f0('0x1c')][_0x11f0('0x1d')]:_0x3da7a5[_0x11f0('0x1e')][_0x11f0('0x1f')]||_0x3da7a5['ip'],_0x3da7a5[_0x11f0('0x20')],_0x277278[_0x11f0('0x21')],_0x277278[_0x11f0('0x22')],_0x3da7a5[_0x11f0('0xf')]?_0x3da7a5[_0x11f0('0xf')]['id']:null,_0x3da7a5[_0x11f0('0xf')]?_0x3da7a5[_0x11f0('0xf')][_0x11f0('0xb')]:null,_0x3da7a5[_0x11f0('0xf')]?_0x3da7a5[_0x11f0('0xf')][_0x11f0('0xa')]:null,_0x6e1883?util[_0x11f0('0x23')](_0x6e1883,![],null):''));}}));_0x1f568e[_0x11f0('0x17')](ewinston[_0x11f0('0x24')]({'winstonInstance':_0x279cf8,'meta':![],'statusLevels':!![],'msg':function(_0x364242,_0x4f7c6d){var _0x185fa3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x364242[_0x11f0('0x19')]&&_0x364242[_0x11f0('0x19')][_0x11f0('0x25')]&&_0x364242[_0x11f0('0x19')]['agent_id']){_0x185fa3=_0x11f0('0x26');}return util[_0x11f0('0x1b')](_0x185fa3,_0x364242['method'],_0x364242['headers'][_0x11f0('0x1d')]?_0x364242[_0x11f0('0x1c')]['x-forwarded-for']:_0x364242[_0x11f0('0x1e')][_0x11f0('0x1f')]||_0x364242['ip'],_0x364242[_0x11f0('0x20')],_0x4f7c6d[_0x11f0('0x21')],_0x4f7c6d['responseTime'],_0x364242[_0x11f0('0xf')]?_0x364242['user']['id']:null,_0x364242[_0x11f0('0xf')]?_0x364242[_0x11f0('0xf')][_0x11f0('0xb')]:null,_0x364242[_0x11f0('0xf')]?_0x364242['user'][_0x11f0('0xa')]:null,_0x364242[_0x11f0('0x19')]&&_0x364242[_0x11f0('0x19')]['device']?_0x364242[_0x11f0('0x19')][_0x11f0('0x25')]:_0x11f0('0x27'),_0x364242[_0x11f0('0x19')]&&_0x364242[_0x11f0('0x19')][_0x11f0('0x28')]?_0x364242[_0x11f0('0x19')][_0x11f0('0x28')]:'',_0x364242['body']&&_0x364242[_0x11f0('0x19')][_0x11f0('0x29')]?_0x364242['body'][_0x11f0('0x29')]:'');},'ignoreRoute':function(_0x908e41){var _0x20975e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20975e[_0x11f0('0x2a')](_0x908e41['url']);}}));return _0x4308c4();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 605e355..dbfe3e3 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfefa=['Logger','transports','Console','warn','error','%s-%s','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s'];(function(_0x52d9f4,_0x32b8b2){var _0x5ce27a=function(_0x3cce76){while(--_0x3cce76){_0x52d9f4['push'](_0x52d9f4['shift']());}};_0x5ce27a(++_0x32b8b2);}(_0xfefa,0x18d));var _0xafef=function(_0x3e90f5,_0x4985c2){_0x3e90f5=_0x3e90f5-0x0;var _0x43eb62=_0xfefa[_0x3e90f5];return _0x43eb62;};'use strict';var path=require(_0xafef('0x0'));var util=require(_0xafef('0x1'));var moment=require(_0xafef('0x2'));var winston=require(_0xafef('0x3'));var config=require(_0xafef('0x4'));var debugLevel=config[_0xafef('0x5')]?config['debugLevel'][_0xafef('0x6')]():_0xafef('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xafef('0x8'),'warn':_0xafef('0x9'),'info':_0xafef('0xa'),'print':'bold\x20white','success':'bold\x20green','http':_0xafef('0xb'),'verbose':_0xafef('0xc'),'debug':_0xafef('0xd'),'silly':_0xafef('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0xdfdf7f,_0x3c7d0c,_0x347f01){var _0x431bbd=_0xdfdf7f||_0xafef('0xf');return path[_0xafef('0x10')](_0x431bbd,util['format'](_0xafef('0x11'),_0x3c7d0c,_0x347f01));}function formatter(_0x48f6d8,_0x221fc9){_0x221fc9[_0xafef('0x12')]=_0x221fc9[_0xafef('0x12')]['replace'](/@@{/g,_0xafef('0x13'))[_0xafef('0x14')](/}@@/g,_0xafef('0x15'))[_0xafef('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0xafef('0x16'),moment()[_0xafef('0x17')](_0xafef('0x18')),_0x221fc9[_0xafef('0x19')][_0xafef('0x1a')](),_0x48f6d8,_0x221fc9[_0xafef('0x12')]);}function fileFormat(_0x3e1132,_0x55e040){_0x55e040['message']=_0x55e040[_0xafef('0x12')][_0xafef('0x14')](/@@{/g,_0xafef('0x13'))['replace'](/}@@/g,_0xafef('0x15'))[_0xafef('0x14')](/@{/g,'{{')[_0xafef('0x14')](/}@/g,'}}');var _0xa86603=_0x55e040[_0xafef('0x1b')]&&Object[_0xafef('0x1c')](_0x55e040['meta'])[_0xafef('0x1d')]?'\x0a\x09'+JSON[_0xafef('0x1e')](_0x55e040['meta']):'';return util[_0xafef('0x17')](_0xafef('0x1f'),moment()[_0xafef('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),_0x55e040[_0xafef('0x19')]['toUpperCase'](),_0x3e1132,_0x55e040[_0xafef('0x12')],_0xa86603);}function consoleLogger(){var _0x2c0b19=new winston[(_0xafef('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xafef('0x21'))][(_0xafef('0x22'))]({'level':_0xafef('0x23'),'json':![],'formatter':function(_0x2ff1c4){return formatter('',_0x2ff1c4);}})]});return _0x2c0b19;}function fileLogger(_0x3c037d,_0x122d53){var _0x47b3de=new winston[(_0xafef('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['File']({'name':util[_0xafef('0x17')]('%s-%s',_0x3c037d,'error'),'filename':getLogFileName(_0x122d53,_0x3c037d,_0xafef('0x24')),'level':_0xafef('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x27af2c){return fileFormat(_0x3c037d,_0x27af2c);}}),new winston[(_0xafef('0x21'))]['File']({'name':util[_0xafef('0x17')](_0xafef('0x25'),_0x3c037d,debugLevel),'filename':getLogFileName(_0x122d53,_0x3c037d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18291b){return fileFormat(_0x3c037d,_0x18291b);}}),new winston[(_0xafef('0x21'))][(_0xafef('0x22'))]({'level':'warn','json':![],'formatter':function(_0x37c63e){return fileFormat(_0x3c037d,_0x37c63e);}})]});return _0x47b3de;}exports['consoleLogger']=consoleLogger;exports[_0xafef('0x26')]=fileLogger; \ No newline at end of file +var _0x1c1f=['YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','transports','warn','File','%s-%s','error','Console','consoleLogger','util','moment','winston','../config/environment','debugLevel','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','level','}}}','meta','length'];(function(_0x58689d,_0x48e976){var _0x411abe=function(_0x36a92f){while(--_0x36a92f){_0x58689d['push'](_0x58689d['shift']());}};_0x411abe(++_0x48e976);}(_0x1c1f,0x172));var _0xf1c1=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x1c1f[_0x10004e];return _0x5af990;};'use strict';var path=require('path');var util=require(_0xf1c1('0x0'));var moment=require(_0xf1c1('0x1'));var winston=require(_0xf1c1('0x2'));var config=require(_0xf1c1('0x3'));var debugLevel=config[_0xf1c1('0x4')]?config['debugLevel']['toLowerCase']():_0xf1c1('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xf1c1('0x6'),'warn':_0xf1c1('0x7'),'info':'white','print':_0xf1c1('0x8'),'success':_0xf1c1('0x9'),'http':_0xf1c1('0xa'),'verbose':_0xf1c1('0xb'),'debug':_0xf1c1('0xc'),'silly':_0xf1c1('0xd')};winston[_0xf1c1('0xe')](XC_LOG_COLORS);function getLogFileName(_0x3b7f11,_0x3caf3c,_0x1c1819){var _0x2fcb03=_0x3b7f11||_0xf1c1('0xf');return path[_0xf1c1('0x10')](_0x2fcb03,util[_0xf1c1('0x11')](_0xf1c1('0x12'),_0x3caf3c,_0x1c1819));}function formatter(_0x2f79c9,_0x549e4c){_0x549e4c['message']=_0x549e4c[_0xf1c1('0x13')][_0xf1c1('0x14')](/@@{/g,_0xf1c1('0x15'))[_0xf1c1('0x14')](/}@@/g,'}}}')[_0xf1c1('0x14')](/@{/g,'{{')[_0xf1c1('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xf1c1('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x549e4c[_0xf1c1('0x16')]['toUpperCase'](),_0x2f79c9,_0x549e4c['message']);}function fileFormat(_0x1c8fe4,_0x5eb6b4){_0x5eb6b4[_0xf1c1('0x13')]=_0x5eb6b4[_0xf1c1('0x13')][_0xf1c1('0x14')](/@@{/g,_0xf1c1('0x15'))[_0xf1c1('0x14')](/}@@/g,_0xf1c1('0x17'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x7d3caf=_0x5eb6b4[_0xf1c1('0x18')]&&Object['keys'](_0x5eb6b4[_0xf1c1('0x18')])[_0xf1c1('0x19')]?'\x0a\x09'+JSON['stringify'](_0x5eb6b4[_0xf1c1('0x18')]):'';return util[_0xf1c1('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xf1c1('0x11')](_0xf1c1('0x1a')),_0x5eb6b4[_0xf1c1('0x16')][_0xf1c1('0x1b')](),_0x1c8fe4,_0x5eb6b4[_0xf1c1('0x13')],_0x7d3caf);}function consoleLogger(){var _0x41d79f=new winston[(_0xf1c1('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf1c1('0x1d'))]['Console']({'level':_0xf1c1('0x1e'),'json':![],'formatter':function(_0x2559f1){return formatter('',_0x2559f1);}})]});return _0x41d79f;}function fileLogger(_0x2edf10,_0x3d603a){var _0x4b4c8a=new winston[(_0xf1c1('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf1c1('0x1d'))][(_0xf1c1('0x1f'))]({'name':util[_0xf1c1('0x11')](_0xf1c1('0x20'),_0x2edf10,_0xf1c1('0x21')),'filename':getLogFileName(_0x3d603a,_0x2edf10,'error'),'level':_0xf1c1('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a2bb6){return fileFormat(_0x2edf10,_0x5a2bb6);}}),new winston[(_0xf1c1('0x1d'))][(_0xf1c1('0x1f'))]({'name':util[_0xf1c1('0x11')](_0xf1c1('0x20'),_0x2edf10,debugLevel),'filename':getLogFileName(_0x3d603a,_0x2edf10,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x61831a){return fileFormat(_0x2edf10,_0x61831a);}}),new winston[(_0xf1c1('0x1d'))][(_0xf1c1('0x22'))]({'level':'warn','json':![],'formatter':function(_0x459494){return fileFormat(_0x2edf10,_0x459494);}})]});return _0x4b4c8a;}exports[_0xf1c1('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 2190dac..45b9038 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x3204f2,_0x5d1dd8){var _0x28ea6a=function(_0x3f8f2c){while(--_0x3f8f2c){_0x3204f2['push'](_0x3204f2['shift']());}};_0x28ea6a(++_0x5d1dd8);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x0295,0x1f0));var _0x5029=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x0295[_0x25b24a];return _0x224e68;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 2ca8473..0e5b753 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x34bff6,_0x36f01d){var _0x2704ee=function(_0x2fea17){while(--_0x2fea17){_0x34bff6['push'](_0x34bff6['shift']());}};_0x2704ee(++_0x36f01d);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file +var _0xd4a2=['exports','safeTemplate','lodash','\x20}\x20}','replace','map','isPlainObject','keys','reduce'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xd4a2,0x173));var _0x2d4a=function(_0x42b323,_0x195428){_0x42b323=_0x42b323-0x0;var _0x4dae00=_0xd4a2[_0x42b323];return _0x4dae00;};var _=require(_0x2d4a('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5d70e1){return _0x5d70e1==='{{'?'{\x20{\x20':_0x2d4a('0x1');}function safeTemplate(_0x576ffe){var _0x2a8a71=_0x576ffe;if(typeof _0x576ffe==='string'){_0x2a8a71=_0x576ffe[_0x2d4a('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x576ffe)){_0x2a8a71=_0x576ffe[_0x2d4a('0x3')](function(_0x40d744){return safeTemplate(_0x40d744);});}else if(_[_0x2d4a('0x4')](_0x576ffe)){_0x2a8a71=Object[_0x2d4a('0x5')](_0x576ffe)[_0x2d4a('0x6')](function(_0x57058f,_0x45fefb){_0x57058f[_0x45fefb]=safeTemplate(_0x576ffe[_0x45fefb]);return _0x57058f;},{});}return _0x2a8a71;}module[_0x2d4a('0x7')][_0x2d4a('0x8')]=safeTemplate; \ No newline at end of file